From: support Date: Wed, 15 Mar 2023 09:30:26 +0000 (+0000) Subject: Built motion from commit 06eb8eb0.|2.6.31 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=5dbe76f9f2552bc7b26ceadd9f471ab90465e861;p=motion2.git Built motion from commit 06eb8eb0.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 09c2610..7931981 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-15T08:58:43.051Z", + "time": "2023-03-15T09:21:20.897Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c9addf5..d809b86 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-15T08:58:43.051Z", + "time": "2023-03-15T09:21:20.897Z", "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 e7ae441..1132464 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 _0x5bf5=['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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','motionbar','jscripty','urlForward','bot','script'];(function(_0xc7496f,_0x198920){var _0x16a05a=function(_0x5489d7){while(--_0x5489d7){_0xc7496f['push'](_0xc7496f['shift']());}};_0x16a05a(++_0x198920);}(_0x5bf5,0xf1));var _0x55bf=function(_0x50e23b,_0x1d8b9a){_0x50e23b=_0x50e23b-0x0;var _0x4ee522=_0x5bf5[_0x50e23b];return _0x4ee522;};'use strict';var Sequelize=require(_0x55bf('0x0'));module[_0x55bf('0x1')]={'name':{'type':Sequelize[_0x55bf('0x2')],'get':function(_0x2635b3){return this[_0x55bf('0x3')]('action');}},'action':{'type':Sequelize[_0x55bf('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x55bf('0x5'),'integration',_0x55bf('0x6'),_0x55bf('0x7'),_0x55bf('0x8'),'browser',_0x55bf('0x9'),_0x55bf('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x55bf('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x55bf('0xc')},'data2':{'type':Sequelize[_0x55bf('0x4')](0x1000),'comment':_0x55bf('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x55bf('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x55bf('0xf')},'data5':{'type':Sequelize[_0x55bf('0x4')](0x1000),'comments':_0x55bf('0x10')},'data6':{'type':Sequelize[_0x55bf('0x4')],'comments':_0x55bf('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x4134=['integration','jscripty','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','STRING','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','contactManager'];(function(_0x1f2104,_0x3d1a56){var _0x590031=function(_0x16e37d){while(--_0x16e37d){_0x1f2104['push'](_0x1f2104['shift']());}};_0x590031(++_0x3d1a56);}(_0x4134,0x89));var _0x4413=function(_0x373285,_0xd7c6ad){_0x373285=_0x373285-0x0;var _0x498640=_0x4134[_0x373285];return _0x498640;};'use strict';var Sequelize=require(_0x4413('0x0'));module['exports']={'name':{'type':Sequelize[_0x4413('0x1')],'get':function(_0x11dc8f){return this['getDataValue']('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x4413('0x2'),_0x4413('0x3'),'motionbar',_0x4413('0x4'),'urlForward','browser','bot','script']],'msg':_0x4413('0x5')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4413('0x6')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x4413('0x7')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x4413('0x8')},'data5':{'type':Sequelize[_0x4413('0x9')](0x1000),'comments':_0x4413('0xa')},'data6':{'type':Sequelize['STRING'],'comments':_0x4413('0xb')},'data7':{'type':Sequelize[_0x4413('0xc')],'comments':_0x4413('0xd')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5433a62..08ef0ab 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 _0xa327=['set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','body','find','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','offset','undefined','limit','count'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xa327,0x1d1));var _0x7a32=function(_0xb89943,_0x226560){_0xb89943=_0xb89943-0x0;var _0x179c17=_0xa327[_0xb89943];return _0x179c17;};'use strict';var emlformat=require(_0x7a32('0x0'));var rimraf=require(_0x7a32('0x1'));var zipdir=require(_0x7a32('0x2'));var jsonpatch=require(_0x7a32('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a32('0x4'));var Mustache=require('mustache');var util=require(_0x7a32('0x5'));var path=require(_0x7a32('0x6'));var sox=require(_0x7a32('0x7'));var csv=require(_0x7a32('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a32('0x9'));var squel=require(_0x7a32('0xa'));var crypto=require('crypto');var jsforce=require(_0x7a32('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7a32('0x8'));var querystring=require(_0x7a32('0xc'));var Papa=require(_0x7a32('0xd'));var Redis=require(_0x7a32('0xe'));var authService=require(_0x7a32('0xf'));var qs=require(_0x7a32('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a32('0x11'));var logger=require(_0x7a32('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7a32('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fe134,_0x47026a){_0x47026a=_0x47026a||0xcc;return function(_0x53d428){if(_0x53d428){return _0x4fe134['sendStatus'](_0x47026a);}return _0x4fe134[_0x7a32('0x14')](_0x47026a)[_0x7a32('0x15')]();};}function respondWithResult(_0x149f0e,_0x1b48b1){_0x1b48b1=_0x1b48b1||0xc8;return function(_0x426670){if(_0x426670){return _0x149f0e['status'](_0x1b48b1)[_0x7a32('0x16')](_0x426670);}};}function respondWithFilteredResult(_0x5d8c53,_0x3a1bc5){return function(_0x22b147){if(_0x22b147){var _0x3ea8ff=typeof _0x3a1bc5[_0x7a32('0x17')]===_0x7a32('0x18')&&typeof _0x3a1bc5[_0x7a32('0x19')]==='undefined';var _0x14242c=_0x22b147[_0x7a32('0x1a')];var _0x361c19=_0x3ea8ff?0x0:_0x3a1bc5['offset'];var _0x514d3d=_0x3ea8ff?_0x22b147['count']:_0x3a1bc5[_0x7a32('0x17')]+_0x3a1bc5[_0x7a32('0x19')];var _0x4bf063;if(_0x514d3d>=_0x14242c){_0x514d3d=_0x14242c;_0x4bf063=0xc8;}else{_0x4bf063=0xce;}_0x5d8c53['status'](_0x4bf063);return _0x5d8c53[_0x7a32('0x1b')](_0x7a32('0x1c'),_0x361c19+'-'+_0x514d3d+'/'+_0x14242c)['json'](_0x22b147);}return null;};}function patchUpdates(_0x54c50e){return function(_0x3d20c1){try{jsonpatch['apply'](_0x3d20c1,_0x54c50e,!![]);}catch(_0x18a162){return BPromise['reject'](_0x18a162);}return _0x3d20c1[_0x7a32('0x1d')]();};}function saveUpdates(_0x313584,_0x4e0724){return function(_0x19c7d4){if(_0x19c7d4){return _0x19c7d4['update'](_0x313584)[_0x7a32('0x1e')](function(_0x5a25bd){return _0x5a25bd;});}return null;};}function removeEntity(_0x4465b2,_0x5f2aea){return function(_0x25b3b9){if(_0x25b3b9){return _0x25b3b9[_0x7a32('0x1f')]()[_0x7a32('0x1e')](function(){_0x4465b2[_0x7a32('0x14')](0xcc)[_0x7a32('0x15')]();});}};}function handleEntityNotFound(_0x9f58ba,_0xc48d44){return function(_0x255378){if(!_0x255378){_0x9f58ba[_0x7a32('0x20')](0x194);}return _0x255378;};}function handleError(_0x439721,_0x35c76e){_0x35c76e=_0x35c76e||0x1f4;return function(_0x31d102){logger[_0x7a32('0x21')](_0x31d102[_0x7a32('0x22')]);if(_0x31d102[_0x7a32('0x23')]){delete _0x31d102[_0x7a32('0x23')];}_0x439721['status'](_0x35c76e)[_0x7a32('0x24')](_0x31d102);};}exports['update']=function(_0x21779b,_0x146d5b){if(_0x21779b[_0x7a32('0x25')]['id']){delete _0x21779b['body']['id'];}return db['Action'][_0x7a32('0x26')]({'where':{'id':_0x21779b['params']['id']}})[_0x7a32('0x1e')](handleEntityNotFound(_0x146d5b,null))['then'](saveUpdates(_0x21779b['body'],null))[_0x7a32('0x1e')](respondWithResult(_0x146d5b,null))[_0x7a32('0x27')](handleError(_0x146d5b,null));};exports[_0x7a32('0x1f')]=function(_0x562cfc,_0x351d45){return db[_0x7a32('0x28')][_0x7a32('0x26')]({'where':{'id':_0x562cfc['params']['id']}})['then'](handleEntityNotFound(_0x351d45,null))[_0x7a32('0x1e')](removeEntity(_0x351d45,null))[_0x7a32('0x27')](handleError(_0x351d45,null));}; \ No newline at end of file +var _0x4823=['save','update','then','destroy','sendStatus','error','name','body','Action','params','catch','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x2d2d11,_0x2eafd9){var _0x2628a6=function(_0x9df7b1){while(--_0x9df7b1){_0x2d2d11['push'](_0x2d2d11['shift']());}};_0x2628a6(++_0x2eafd9);}(_0x4823,0x9b));var _0x3482=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x4823[_0x3cc9d9];return _0x1a425d;};'use strict';var emlformat=require(_0x3482('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3482('0x1'));var moment=require(_0x3482('0x2'));var BPromise=require(_0x3482('0x3'));var Mustache=require(_0x3482('0x4'));var util=require('util');var path=require(_0x3482('0x5'));var sox=require(_0x3482('0x6'));var csv=require(_0x3482('0x7'));var ejs=require(_0x3482('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3482('0x9'));var squel=require('squel');var crypto=require(_0x3482('0xa'));var jsforce=require(_0x3482('0xb'));var deskjs=require(_0x3482('0xc'));var toCsv=require(_0x3482('0x7'));var querystring=require(_0x3482('0xd'));var Papa=require(_0x3482('0xe'));var Redis=require(_0x3482('0xf'));var authService=require(_0x3482('0x10'));var qs=require(_0x3482('0x11'));var as=require(_0x3482('0x12'));var hardwareService=require(_0x3482('0x13'));var logger=require(_0x3482('0x14'))(_0x3482('0x15'));var utils=require(_0x3482('0x16'));var config=require(_0x3482('0x17'));var licenseUtil=require(_0x3482('0x18'));var db=require(_0x3482('0x19'))['db'];function respondWithStatusCode(_0xdbde6e,_0x5547f5){_0x5547f5=_0x5547f5||0xcc;return function(_0x5c4afb){if(_0x5c4afb){return _0xdbde6e['sendStatus'](_0x5547f5);}return _0xdbde6e[_0x3482('0x1a')](_0x5547f5)[_0x3482('0x1b')]();};}function respondWithResult(_0x11ce85,_0x10d5c4){_0x10d5c4=_0x10d5c4||0xc8;return function(_0x2fd57d){if(_0x2fd57d){return _0x11ce85['status'](_0x10d5c4)[_0x3482('0x1c')](_0x2fd57d);}};}function respondWithFilteredResult(_0x3bd7cb,_0xea0164){return function(_0x3c8aac){if(_0x3c8aac){var _0x5af75c=typeof _0xea0164[_0x3482('0x1d')]==='undefined'&&typeof _0xea0164[_0x3482('0x1e')]===_0x3482('0x1f');var _0x59d556=_0x3c8aac[_0x3482('0x20')];var _0x35c84f=_0x5af75c?0x0:_0xea0164[_0x3482('0x1d')];var _0x431b5d=_0x5af75c?_0x3c8aac[_0x3482('0x20')]:_0xea0164['offset']+_0xea0164[_0x3482('0x1e')];var _0x38774f;if(_0x431b5d>=_0x59d556){_0x431b5d=_0x59d556;_0x38774f=0xc8;}else{_0x38774f=0xce;}_0x3bd7cb[_0x3482('0x1a')](_0x38774f);return _0x3bd7cb[_0x3482('0x21')](_0x3482('0x22'),_0x35c84f+'-'+_0x431b5d+'/'+_0x59d556)[_0x3482('0x1c')](_0x3c8aac);}return null;};}function patchUpdates(_0xd3c3fb){return function(_0x232e89){try{jsonpatch[_0x3482('0x23')](_0x232e89,_0xd3c3fb,!![]);}catch(_0x119afd){return BPromise[_0x3482('0x24')](_0x119afd);}return _0x232e89[_0x3482('0x25')]();};}function saveUpdates(_0x45e121,_0x4469dd){return function(_0x58810c){if(_0x58810c){return _0x58810c[_0x3482('0x26')](_0x45e121)[_0x3482('0x27')](function(_0x326cfe){return _0x326cfe;});}return null;};}function removeEntity(_0x54d729,_0x59286a){return function(_0x4a6c1d){if(_0x4a6c1d){return _0x4a6c1d[_0x3482('0x28')]()[_0x3482('0x27')](function(){_0x54d729[_0x3482('0x1a')](0xcc)[_0x3482('0x1b')]();});}};}function handleEntityNotFound(_0x5e1ebd,_0x51c815){return function(_0x5ee542){if(!_0x5ee542){_0x5e1ebd[_0x3482('0x29')](0x194);}return _0x5ee542;};}function handleError(_0x472411,_0x29538c){_0x29538c=_0x29538c||0x1f4;return function(_0x302c9a){logger[_0x3482('0x2a')](_0x302c9a['stack']);if(_0x302c9a[_0x3482('0x2b')]){delete _0x302c9a['name'];}_0x472411[_0x3482('0x1a')](_0x29538c)['send'](_0x302c9a);};}exports['update']=function(_0x399c93,_0x18ca10){if(_0x399c93[_0x3482('0x2c')]['id']){delete _0x399c93[_0x3482('0x2c')]['id'];}return db[_0x3482('0x2d')]['find']({'where':{'id':_0x399c93[_0x3482('0x2e')]['id']}})[_0x3482('0x27')](handleEntityNotFound(_0x18ca10,null))['then'](saveUpdates(_0x399c93['body'],null))['then'](respondWithResult(_0x18ca10,null))[_0x3482('0x2f')](handleError(_0x18ca10,null));};exports['destroy']=function(_0x59638d,_0x169097){return db[_0x3482('0x2d')]['find']({'where':{'id':_0x59638d[_0x3482('0x2e')]['id']}})[_0x3482('0x27')](handleEntityNotFound(_0x169097,null))['then'](removeEntity(_0x169097,null))[_0x3482('0x2f')](handleError(_0x169097,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 58edeef..5445543 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 _0x7269=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util'];(function(_0x49e89d,_0x536e20){var _0x26a457=function(_0x4ae781){while(--_0x4ae781){_0x49e89d['push'](_0x49e89d['shift']());}};_0x26a457(++_0x536e20);}(_0x7269,0x76));var _0x9726=function(_0x53f92b,_0x442be7){_0x53f92b=_0x53f92b-0x0;var _0x323ffa=_0x7269[_0x53f92b];return _0x323ffa;};'use strict';var _=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var logger=require(_0x9726('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9726('0x3'));var rp=require(_0x9726('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9726('0x5'));var config=require(_0x9726('0x6'));var attributes=require(_0x9726('0x7'));module[_0x9726('0x8')]=function(_0x795889,_0x832cb){return _0x795889[_0x9726('0x9')](_0x9726('0xa'),attributes,{'tableName':_0x9726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6f9=['Action','tools_actions','util','../../config/logger','api','bluebird','../../config/environment','define'];(function(_0x90743f,_0x5d89b8){var _0x2e3ab5=function(_0x17dc66){while(--_0x17dc66){_0x90743f['push'](_0x90743f['shift']());}};_0x2e3ab5(++_0x5d89b8);}(_0xa6f9,0x11a));var _0x9a6f=function(_0x2bac1e,_0x38ed30){_0x2bac1e=_0x2bac1e-0x0;var _0x4a3370=_0xa6f9[_0x2bac1e];return _0x4a3370;};'use strict';var _=require('lodash');var util=require(_0x9a6f('0x0'));var logger=require(_0x9a6f('0x1'))(_0x9a6f('0x2'));var moment=require('moment');var BPromise=require(_0x9a6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a6f('0x4'));var attributes=require('./action.attributes');module['exports']=function(_0x3261f7,_0x30d9a7){return _0x3261f7[_0x9a6f('0x5')](_0x9a6f('0x6'),attributes,{'tableName':_0x9a6f('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 8314f36..6ec8e62 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x518960,_0x3cf94e){var _0x2bd762=function(_0x29d33c){while(--_0x29d33c){_0x518960['push'](_0x518960['shift']());}};_0x2bd762(++_0x3cf94e);}(_0x1261,0x144));var _0x1126=function(_0x27b3df,_0x34a01a){_0x27b3df=_0x27b3df-0x0;var _0x275390=_0x1261[_0x27b3df];return _0x275390;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x1cb9,0x14e));var _0x91cb=function(_0x27b2bb,_0x4a9b6b){_0x27b2bb=_0x27b2bb-0x0;var _0x2d29f8=_0x1cb9[_0x27b2bb];return _0x2d29f8;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 73176de..b8215cc 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 _0x239b=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x239b,0x1db));var _0xb239=function(_0x2f4adf,_0x3ec0cc){_0x2f4adf=_0x2f4adf-0x0;var _0x22205a=_0x239b[_0x2f4adf];return _0x22205a;};'use strict';var multer=require(_0xb239('0x0'));var util=require(_0xb239('0x1'));var path=require(_0xb239('0x2'));var timeout=require(_0xb239('0x3'));var express=require(_0xb239('0x4'));var router=express['Router']();var fs_extra=require(_0xb239('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb239('0x6'));var config=require(_0xb239('0x7'));var controller=require(_0xb239('0x8'));router['put'](_0xb239('0x9'),auth[_0xb239('0xa')](),controller[_0xb239('0xb')]);router[_0xb239('0xc')](_0xb239('0x9'),auth[_0xb239('0xa')](),controller['destroy']);module[_0xb239('0xd')]=router; \ No newline at end of file +var _0xed08=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x3452ce,_0x124927){var _0xee20c5=function(_0x16dceb){while(--_0x16dceb){_0x3452ce['push'](_0x3452ce['shift']());}};_0xee20c5(++_0x124927);}(_0xed08,0x14b));var _0x8ed0=function(_0x3d750b,_0x330074){_0x3d750b=_0x3d750b-0x0;var _0x7ffc20=_0xed08[_0x3d750b];return _0x7ffc20;};'use strict';var multer=require(_0x8ed0('0x0'));var util=require(_0x8ed0('0x1'));var path=require(_0x8ed0('0x2'));var timeout=require(_0x8ed0('0x3'));var express=require(_0x8ed0('0x4'));var router=express[_0x8ed0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8ed0('0x6'));var interaction=require(_0x8ed0('0x7'));var config=require(_0x8ed0('0x8'));var controller=require(_0x8ed0('0x9'));router[_0x8ed0('0xa')](_0x8ed0('0xb'),auth[_0x8ed0('0xc')](),controller[_0x8ed0('0xd')]);router[_0x8ed0('0xe')](_0x8ed0('0xb'),auth[_0x8ed0('0xc')](),controller['destroy']);module[_0x8ed0('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2a752c7..5068e15 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 _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x5dc789,_0x3ab94d){var _0x18dd8b=function(_0x4a1417){while(--_0x4a1417){_0x5dc789['push'](_0x5dc789['shift']());}};_0x18dd8b(++_0x3ab94d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x285bb5,_0xc147b5){_0x285bb5=_0x285bb5-0x0;var _0x1e4a45=_0x3f8a[_0x285bb5];return _0x1e4a45;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file +var _0x038b=['exports','STRING','TEXT'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x038b,0x114));var _0xb038=function(_0x486868,_0x115dee){_0x486868=_0x486868-0x0;var _0x28cba2=_0x038b[_0x486868];return _0x28cba2;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7f54090..bda6749 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 _0xba3a=['save','update','then','destroy','get','CustomReports','end','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','keys','options','create','body','user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','preview','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','table','MetricId','metric','replace','function','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20NULL','getFields','format','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','MIN(%s)','IS\x20EMPTY','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','dbH','sendStatus','offset','undefined','count','limit','status','set','Content-Range','apply','reject'];(function(_0x11aed0,_0x4089f3){var _0x8d889d=function(_0x2c61d8){while(--_0x2c61d8){_0x11aed0['push'](_0x11aed0['shift']());}};_0x8d889d(++_0x4089f3);}(_0xba3a,0x84));var _0xaba3=function(_0xb89931,_0x461b9e){_0xb89931=_0xb89931-0x0;var _0x324b86=_0xba3a[_0xb89931];return _0x324b86;};'use strict';var emlformat=require(_0xaba3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaba3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaba3('0x2'));var moment=require(_0xaba3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaba3('0x4'));var util=require(_0xaba3('0x5'));var path=require(_0xaba3('0x6'));var sox=require(_0xaba3('0x7'));var csv=require(_0xaba3('0x8'));var ejs=require(_0xaba3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaba3('0xa'));var squel=require(_0xaba3('0xb'));var crypto=require(_0xaba3('0xc'));var jsforce=require(_0xaba3('0xd'));var deskjs=require(_0xaba3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaba3('0xf'));var Papa=require(_0xaba3('0x10'));var Redis=require(_0xaba3('0x11'));var authService=require(_0xaba3('0x12'));var qs=require(_0xaba3('0x13'));var as=require(_0xaba3('0x14'));var hardwareService=require(_0xaba3('0x15'));var logger=require(_0xaba3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xaba3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaba3('0x18'))['db'];var dbH=require(_0xaba3('0x18'))[_0xaba3('0x19')];function respondWithStatusCode(_0x19cd77,_0x1c37f3){_0x1c37f3=_0x1c37f3||0xcc;return function(_0xd9f259){if(_0xd9f259){return _0x19cd77[_0xaba3('0x1a')](_0x1c37f3);}return _0x19cd77['status'](_0x1c37f3)['end']();};}function respondWithResult(_0x1be968,_0x265010){_0x265010=_0x265010||0xc8;return function(_0x577260){if(_0x577260){return _0x1be968['status'](_0x265010)['json'](_0x577260);}};}function respondWithFilteredResult(_0x1b3920,_0x53e86a){return function(_0x31da1e){if(_0x31da1e){var _0x17aaee=typeof _0x53e86a[_0xaba3('0x1b')]===_0xaba3('0x1c')&&typeof _0x53e86a['limit']===_0xaba3('0x1c');var _0x1583bf=_0x31da1e[_0xaba3('0x1d')];var _0x1a2cd9=_0x17aaee?0x0:_0x53e86a[_0xaba3('0x1b')];var _0xcc2ebf=_0x17aaee?_0x31da1e[_0xaba3('0x1d')]:_0x53e86a[_0xaba3('0x1b')]+_0x53e86a[_0xaba3('0x1e')];var _0x5e7d74;if(_0xcc2ebf>=_0x1583bf){_0xcc2ebf=_0x1583bf;_0x5e7d74=0xc8;}else{_0x5e7d74=0xce;}_0x1b3920[_0xaba3('0x1f')](_0x5e7d74);return _0x1b3920[_0xaba3('0x20')](_0xaba3('0x21'),_0x1a2cd9+'-'+_0xcc2ebf+'/'+_0x1583bf)['json'](_0x31da1e);}return null;};}function patchUpdates(_0x20d70e){return function(_0x411c7a){try{jsonpatch[_0xaba3('0x22')](_0x411c7a,_0x20d70e,!![]);}catch(_0x289464){return BPromise[_0xaba3('0x23')](_0x289464);}return _0x411c7a[_0xaba3('0x24')]();};}function saveUpdates(_0x5d2341,_0x73be00){return function(_0x5070f3){if(_0x5070f3){return _0x5070f3[_0xaba3('0x25')](_0x5d2341)[_0xaba3('0x26')](function(_0x5af2c4){return _0x5af2c4;});}return null;};}function removeEntity(_0x2c77e0,_0x38cc9b){return function(_0x1aeb77){if(_0x1aeb77){return _0x1aeb77[_0xaba3('0x27')]()[_0xaba3('0x26')](function(){var _0x4226c0=_0x1aeb77[_0xaba3('0x28')]({'plain':!![]});var _0xfcc6e9=_0xaba3('0x29');return db['UserProfileResource'][_0xaba3('0x27')]({'where':{'type':_0xfcc6e9,'resourceId':_0x4226c0['id']}})[_0xaba3('0x26')](function(){return _0x1aeb77;});})[_0xaba3('0x26')](function(){_0x2c77e0[_0xaba3('0x1f')](0xcc)[_0xaba3('0x2a')]();});}};}function handleEntityNotFound(_0x492d3a,_0x51a88d){return function(_0x2176d0){if(!_0x2176d0){_0x492d3a[_0xaba3('0x1a')](0x194);}return _0x2176d0;};}function handleError(_0xa86f46,_0x5e4e01){_0x5e4e01=_0x5e4e01||0x1f4;return function(_0x47f436){logger[_0xaba3('0x2b')](_0x47f436['stack']);if(_0x47f436[_0xaba3('0x2c')]){delete _0x47f436[_0xaba3('0x2c')];}_0xa86f46[_0xaba3('0x1f')](_0x5e4e01)[_0xaba3('0x2d')](_0x47f436);};}exports[_0xaba3('0x2e')]=function(_0x42dcfb,_0x3ec29c){var _0x409042={},_0x39fc95={},_0x969b00={'count':0x0,'rows':[]};var _0x43fc68=_[_0xaba3('0x2f')](db[_0xaba3('0x30')][_0xaba3('0x31')],function(_0x596ae2){return{'name':_0x596ae2[_0xaba3('0x32')],'type':_0x596ae2[_0xaba3('0x33')][_0xaba3('0x34')]};});_0x39fc95[_0xaba3('0x35')]=_[_0xaba3('0x2f')](_0x43fc68,'name');_0x39fc95[_0xaba3('0x36')]=_['keys'](_0x42dcfb[_0xaba3('0x36')]);_0x39fc95['filters']=_['intersection'](_0x39fc95[_0xaba3('0x35')],_0x39fc95[_0xaba3('0x36')]);_0x409042[_0xaba3('0x37')]=_[_0xaba3('0x38')](_0x39fc95[_0xaba3('0x35')],qs[_0xaba3('0x39')](_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x39')]));_0x409042[_0xaba3('0x37')]=_0x409042[_0xaba3('0x37')][_0xaba3('0x3a')]?_0x409042[_0xaba3('0x37')]:_0x39fc95[_0xaba3('0x35')];if(!_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x3b')](_0xaba3('0x3c'))){_0x409042[_0xaba3('0x1e')]=qs[_0xaba3('0x1e')](_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x1e')]);_0x409042[_0xaba3('0x1b')]=qs['offset'](_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x1b')]);}_0x409042[_0xaba3('0x3d')]=qs[_0xaba3('0x3e')](_0x42dcfb[_0xaba3('0x36')]['sort']);_0x409042[_0xaba3('0x3f')]=qs[_0xaba3('0x40')](_[_0xaba3('0x41')](_0x42dcfb['query'],_0x39fc95[_0xaba3('0x40')]),_0x43fc68);if(_0x42dcfb[_0xaba3('0x36')]['filter']){_0x409042[_0xaba3('0x3f')]=_[_0xaba3('0x42')](_0x409042[_0xaba3('0x3f')],{'$or':_[_0xaba3('0x2f')](_0x43fc68,function(_0x4b6841){if(_0x4b6841[_0xaba3('0x33')]!==_0xaba3('0x43')){var _0x2f868a={};_0x2f868a[_0x4b6841['name']]={'$like':'%'+_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x44')]+'%'};return _0x2f868a;}})});}_0x409042=_[_0xaba3('0x42')]({},_0x409042,_0x42dcfb['options']);var _0x325709={'where':_0x409042[_0xaba3('0x3f')]};return db[_0xaba3('0x30')]['count'](_0x325709)[_0xaba3('0x26')](function(_0x3a3b60){_0x969b00[_0xaba3('0x1d')]=_0x3a3b60;if(_0x42dcfb[_0xaba3('0x36')][_0xaba3('0x45')]){_0x409042[_0xaba3('0x46')]=[{'all':!![]}];}return db[_0xaba3('0x30')]['findAll'](_0x409042);})[_0xaba3('0x26')](function(_0x44cfb2){_0x969b00['rows']=_0x44cfb2;return _0x969b00;})['then'](respondWithFilteredResult(_0x3ec29c,_0x409042))[_0xaba3('0x47')](handleError(_0x3ec29c,null));};exports[_0xaba3('0x48')]=function(_0x32c54e,_0x4c01db){var _0x5b375a={'raw':![],'where':{'id':_0x32c54e[_0xaba3('0x49')]['id']}},_0x1b7245={};_0x1b7245[_0xaba3('0x35')]=_[_0xaba3('0x4a')](db[_0xaba3('0x30')][_0xaba3('0x31')]);_0x1b7245[_0xaba3('0x36')]=_[_0xaba3('0x4a')](_0x32c54e[_0xaba3('0x36')]);_0x1b7245['filters']=_['intersection'](_0x1b7245['model'],_0x1b7245[_0xaba3('0x36')]);_0x5b375a[_0xaba3('0x37')]=_[_0xaba3('0x38')](_0x1b7245[_0xaba3('0x35')],qs[_0xaba3('0x39')](_0x32c54e[_0xaba3('0x36')][_0xaba3('0x39')]));_0x5b375a[_0xaba3('0x37')]=_0x5b375a[_0xaba3('0x37')][_0xaba3('0x3a')]?_0x5b375a[_0xaba3('0x37')]:_0x1b7245[_0xaba3('0x35')];if(_0x32c54e[_0xaba3('0x36')][_0xaba3('0x45')]){_0x5b375a[_0xaba3('0x46')]=[{'all':!![]}];}_0x5b375a=_[_0xaba3('0x42')]({},_0x5b375a,_0x32c54e[_0xaba3('0x4b')]);return db[_0xaba3('0x30')]['find'](_0x5b375a)[_0xaba3('0x26')](handleEntityNotFound(_0x4c01db,null))[_0xaba3('0x26')](respondWithResult(_0x4c01db,null))['catch'](handleError(_0x4c01db,null));};exports[_0xaba3('0x4c')]=function(_0x1c346f,_0x50cad0){return db[_0xaba3('0x30')]['create'](_0x1c346f[_0xaba3('0x4d')],{})[_0xaba3('0x26')](function(_0x47abec){var _0x27f3bf=_0x1c346f[_0xaba3('0x4e')][_0xaba3('0x28')]({'plain':!![]});if(!_0x27f3bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27f3bf[_0xaba3('0x4f')]===_0xaba3('0x4e')){var _0x361f4a=_0x47abec[_0xaba3('0x28')]({'plain':!![]});var _0x4168a6=_0xaba3('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x4168a6,'userProfileId':_0x27f3bf[_0xaba3('0x51')]},'raw':!![]})[_0xaba3('0x26')](function(_0x48c97b){if(_0x48c97b&&_0x48c97b[_0xaba3('0x52')]===0x0){return db[_0xaba3('0x53')][_0xaba3('0x4c')]({'name':_0x361f4a[_0xaba3('0x2c')],'resourceId':_0x361f4a['id'],'type':'CustomReports','sectionId':_0x48c97b['id']},{})[_0xaba3('0x26')](function(){return _0x47abec;});}else{return _0x47abec;}})[_0xaba3('0x47')](function(_0x5c400c){logger[_0xaba3('0x2b')](_0xaba3('0x54'),_0x5c400c);throw _0x5c400c;});}return _0x47abec;})[_0xaba3('0x26')](respondWithResult(_0x50cad0,0xc9))['catch'](handleError(_0x50cad0,null));};exports[_0xaba3('0x25')]=function(_0x532848,_0x4f2c20){if(_0x532848[_0xaba3('0x4d')]['id']){delete _0x532848[_0xaba3('0x4d')]['id'];}return db['AnalyticCustomReport'][_0xaba3('0x55')]({'where':{'id':_0x532848[_0xaba3('0x49')]['id']}})[_0xaba3('0x26')](handleEntityNotFound(_0x4f2c20,null))['then'](saveUpdates(_0x532848['body'],null))[_0xaba3('0x26')](respondWithResult(_0x4f2c20,null))[_0xaba3('0x47')](handleError(_0x4f2c20,null));};exports[_0xaba3('0x27')]=function(_0x2effca,_0x5dc116){return db[_0xaba3('0x30')][_0xaba3('0x55')]({'where':{'id':_0x2effca[_0xaba3('0x49')]['id']}})[_0xaba3('0x26')](handleEntityNotFound(_0x5dc116,null))['then'](removeEntity(_0x5dc116,null))[_0xaba3('0x47')](handleError(_0x5dc116,null));};exports[_0xaba3('0x56')]=function(_0x50191e,_0x526b74){var _0x2f036f=0xa;var _0x370626=['join',_0xaba3('0x57'),'right_join',_0xaba3('0x58')];var _0x4cbbc5={'SUM':_0xaba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xaba3('0x5a'),'MAX':_0xaba3('0x5b'),'MIN':'MIN(%s)','AVG':_0xaba3('0x5c'),'GROUP_CONCAT':_0xaba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xaba3('0x5e')};var _0x15eb02={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xaba3('0x5f'),'HOUR':_0xaba3('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xaba3('0x61')};var _0x5ed98d=function(_0x2f8791){return!_[_0xaba3('0x62')](['IS\x20NULL',_0xaba3('0x63'),'IS\x20EMPTY',_0xaba3('0x64')],_0x2f8791);};var _0x2155dc=function(_0x182f9a){if(!_0x182f9a||!_0x182f9a[_0xaba3('0x65')][_0xaba3('0x3a')]){return'';}for(var _0x1b1208='(',_0x201f57=0x0;_0x201f57<_0x182f9a['rules'][_0xaba3('0x3a')];_0x201f57+=0x1){_0x201f57>0x0&&(_0x1b1208+='\x20'+_0x182f9a[_0xaba3('0x66')]+'\x20');_0x1b1208+=_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x67')]?_0x2155dc(_0x182f9a['rules'][_0x201f57][_0xaba3('0x67')]):_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x68')]+'\x20'+_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x69')]+(_0x5ed98d(_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x69')])?'\x20'+_0x182f9a[_0xaba3('0x65')][_0x201f57][_0xaba3('0x6a')]:'');}return _0x1b1208+')';};var _0x20feb7={'where':{'id':_0x50191e[_0xaba3('0x49')]['id']}},_0x1aba02,_0x329afc,_0x525ddf,_0x5df91a,_0x12b2eb;_0x20feb7=_['merge']({},_0x20feb7,_0x50191e[_0xaba3('0x4b')]);return db[_0xaba3('0x30')]['find'](_0x20feb7)['then'](function(_0x193e10){if(_0x193e10){_0x1aba02=_0x193e10;return _0x193e10['getFields']();}return null;})[_0xaba3('0x26')](function(_0x4181ea){if(_0x4181ea){if(!_0x4181ea[_0xaba3('0x3a')]){throw new db[(_0xaba3('0x6b'))][(_0xaba3('0x6c'))](_0xaba3('0x6d'),0x193);}_0x329afc=_0x4181ea;return db[_0xaba3('0x6e')][_0xaba3('0x6f')]({'raw':!![]});}return null;})['then'](function(_0x5f2e55){if(_0x5f2e55){_0x525ddf=_['keyBy'](_0x5f2e55,'id');var _0x5f3fa1;var _0x42cbde=squel[_0xaba3('0x70')]();_0x42cbde[_0xaba3('0x71')](_0x1aba02[_0xaba3('0x72')]);for(var _0x6ad674=0x0;_0x6ad674<_0x329afc[_0xaba3('0x3a')];_0x6ad674+=0x1){_0x5f3fa1=_0x329afc[_0x6ad674][_0xaba3('0x73')]?_0x525ddf[_0x329afc[_0x6ad674][_0xaba3('0x73')]][_0xaba3('0x74')]:_0x329afc[_0x6ad674][_0xaba3('0x68')];_0x5f3fa1=_0x329afc[_0x6ad674]['function']?_[_0xaba3('0x75')](_0x4cbbc5[_0x329afc[_0x6ad674][_0xaba3('0x76')]],'%s',_0x5f3fa1):_0x5f3fa1;_0x5f3fa1=_0x329afc[_0x6ad674]['format']?_[_0xaba3('0x75')](_0x15eb02[_0x329afc[_0x6ad674]['format']],'%s',_0x5f3fa1):_0x5f3fa1;if(_0x329afc[_0x6ad674][_0xaba3('0x77')]){_0x42cbde['group'](_0x5f3fa1);}_0x329afc[_0x6ad674]['orderBy']&&_0x42cbde['order'](_0x5f3fa1,_0x329afc[_0x6ad674][_0xaba3('0x78')]===_0xaba3('0x79')?![]:!![]);_0x42cbde[_0xaba3('0x68')](_0x5f3fa1,_0x329afc[_0x6ad674][_0xaba3('0x7a')]||_0x5f3fa1);}if(_0x1aba02['joins']){_0x1aba02[_0xaba3('0x7b')]=JSON[_0xaba3('0x7c')](_0x1aba02[_0xaba3('0x7b')]);for(var _0x8e559=0x0;_0x8e559<_0x1aba02[_0xaba3('0x7b')][_0xaba3('0x3a')];_0x8e559+=0x1){if(_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x33')]&&_[_0xaba3('0x62')](_0x370626,_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x33')])&&_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7d')]&&_0x1aba02['joins'][_0x8e559]['foreignTable']&&_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7e')]){_0x42cbde[_0x1aba02['joins'][_0x8e559][_0xaba3('0x33')]](_0x1aba02['joins'][_0x8e559][_0xaba3('0x7f')],null,util['format'](_0xaba3('0x80'),_0x1aba02[_0xaba3('0x72')],_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7d')],_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7f')],_0x1aba02[_0xaba3('0x7b')][_0x8e559][_0xaba3('0x7e')]));}}}if(_0x1aba02['conditions']){_0x1aba02['conditions']=JSON[_0xaba3('0x7c')](_0x1aba02[_0xaba3('0x81')]);_0x42cbde[_0xaba3('0x3f')](_0x2155dc(_0x1aba02[_0xaba3('0x81')]['group']));}_0x12b2eb=_0x42cbde[_0xaba3('0x82')]();_0x42cbde['limit'](_0x2f036f);_0x42cbde['offset'](0x0);logger[_0xaba3('0x83')](_0xaba3('0x84'),_0x42cbde[_0xaba3('0x85')]());return dbH[_0xaba3('0x86')][_0xaba3('0x36')](_0x42cbde[_0xaba3('0x85')](),{'type':dbH['sequelize'][_0xaba3('0x87')][_0xaba3('0x88')]});}})[_0xaba3('0x26')](respondWithResult(_0x526b74,null))[_0xaba3('0x47')](handleError(_0x526b74,null));};function runReport(_0x3d9aa7,_0x4f5d51,_0x31111d){var _0x4a7a10=_0x4f5d51[_0xaba3('0x2c')];var _0x4be6b8=0xa;var _0x5836aa=[_0xaba3('0x89'),'left_join',_0xaba3('0x8a'),_0xaba3('0x58')];var _0x261961={'SUM':_0xaba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xaba3('0x5b'),'MIN':'MIN(%s)','AVG':_0xaba3('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xaba3('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x133ba7={'SEC_TO_TIME':_0xaba3('0x8c'),'DATE':_0xaba3('0x5f'),'HOUR':_0xaba3('0x60'),'ROUND':_0xaba3('0x8d'),'UNIX_TIMESTAMP':_0xaba3('0x61')};var _0x279871=function(_0x360e44){return!_[_0xaba3('0x62')]([_0xaba3('0x8e'),_0xaba3('0x63'),'IS\x20EMPTY',_0xaba3('0x64')],_0x360e44);};var _0x3c95f6=function(_0x13a4df){if(!_0x13a4df||!_0x13a4df[_0xaba3('0x65')][_0xaba3('0x3a')]){return'';}for(var _0x37ff77='(',_0x409274=0x0;_0x409274<_0x13a4df['rules'][_0xaba3('0x3a')];_0x409274+=0x1){_0x409274>0x0&&(_0x37ff77+='\x20'+_0x13a4df[_0xaba3('0x66')]+'\x20');_0x37ff77+=_0x13a4df[_0xaba3('0x65')][_0x409274][_0xaba3('0x67')]?_0x3c95f6(_0x13a4df['rules'][_0x409274]['group']):_0x13a4df['rules'][_0x409274]['field']+'\x20'+_0x13a4df['rules'][_0x409274][_0xaba3('0x69')]+(_0x279871(_0x13a4df[_0xaba3('0x65')][_0x409274][_0xaba3('0x69')])?'\x20'+_0x13a4df[_0xaba3('0x65')][_0x409274][_0xaba3('0x6a')]:'');}return _0x37ff77+')';};var _0x5b50a3={'where':{'id':_0x3d9aa7['id']}},_0x37c9c5,_0x10be6e,_0x5a4d0e,_0x217236,_0x261a81;_0x5b50a3=_['merge']({},_0x5b50a3,_0x31111d);return db[_0xaba3('0x30')][_0xaba3('0x55')](_0x5b50a3)[_0xaba3('0x26')](function(_0x36ad9d){if(_0x36ad9d){_0x37c9c5=_0x36ad9d;return _0x36ad9d[_0xaba3('0x8f')]();}return null;})['then'](function(_0x558bd6){if(_0x558bd6){if(!_0x558bd6['length']){throw new db[(_0xaba3('0x6b'))]['ValidationErrorItem'](_0xaba3('0x6d'),0x193);}_0x10be6e=_0x558bd6;return db[_0xaba3('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xaba3('0x26')](function(_0x5027a6){if(_0x5027a6){_0x5a4d0e=_['keyBy'](_0x5027a6,'id');var _0x41a28b;var _0x280e08=squel[_0xaba3('0x70')]();_0x280e08['from'](_0x37c9c5[_0xaba3('0x72')]);for(var _0x52b565=0x0;_0x52b565<_0x10be6e['length'];_0x52b565+=0x1){_0x41a28b=_0x10be6e[_0x52b565]['MetricId']?_0x5a4d0e[_0x10be6e[_0x52b565]['MetricId']][_0xaba3('0x74')]:_0x10be6e[_0x52b565][_0xaba3('0x68')];_0x41a28b=_0x10be6e[_0x52b565][_0xaba3('0x76')]?_[_0xaba3('0x75')](_0x261961[_0x10be6e[_0x52b565][_0xaba3('0x76')]],'%s',_0x41a28b):_0x41a28b;_0x41a28b=_0x10be6e[_0x52b565][_0xaba3('0x90')]?_['replace'](_0x133ba7[_0x10be6e[_0x52b565][_0xaba3('0x90')]],'%s',_0x41a28b):_0x41a28b;if(_0x10be6e[_0x52b565][_0xaba3('0x77')]){_0x280e08['group'](_0x41a28b);}_0x10be6e[_0x52b565]['orderBy']&&_0x280e08[_0xaba3('0x3d')](_0x41a28b,_0x10be6e[_0x52b565]['orderBy']===_0xaba3('0x79')?![]:!![]);_0x280e08[_0xaba3('0x68')](_0x41a28b,_0x10be6e[_0x52b565][_0xaba3('0x7a')]||_0x41a28b);}if(_0x37c9c5['joins']){_0x37c9c5['joins']=JSON['parse'](_0x37c9c5[_0xaba3('0x7b')]);for(var _0x381753=0x0;_0x381753<_0x37c9c5[_0xaba3('0x7b')]['length'];_0x381753+=0x1){if(_0x37c9c5[_0xaba3('0x7b')][_0x381753]['type']&&_[_0xaba3('0x62')](_0x5836aa,_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x33')])&&_0x37c9c5[_0xaba3('0x7b')][_0x381753]['parentKey']&&_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7f')]&&_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7e')]){_0x280e08[_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x33')]](_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7f')],null,util[_0xaba3('0x90')](_0xaba3('0x80'),_0x37c9c5[_0xaba3('0x72')],_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7d')],_0x37c9c5[_0xaba3('0x7b')][_0x381753][_0xaba3('0x7f')],_0x37c9c5[_0xaba3('0x7b')][_0x381753]['foreignKey']));}}}if(_0x37c9c5[_0xaba3('0x81')]){_0x37c9c5[_0xaba3('0x81')]=JSON['parse'](_0x37c9c5[_0xaba3('0x81')]);_0x280e08[_0xaba3('0x3f')](_0x3c95f6(_0x37c9c5[_0xaba3('0x81')][_0xaba3('0x67')]));}_0x261a81=_0x280e08[_0xaba3('0x82')]();_0x280e08['limit'](_0x4be6b8);_0x280e08[_0xaba3('0x1b')](0x0);return;}})[_0xaba3('0x26')](function(){if(_0x4f5d51[_0xaba3('0x91')]===_0xaba3('0x92')){return null;}var _0x521baa=_[_0xaba3('0x42')](_0x4f5d51,{'name':_0x4f5d51['fullPath']||_0x4f5d51[_0xaba3('0x2c')]||_0x37c9c5['name'],'basename':_0x4a7a10,'savename':util[_0xaba3('0x90')](_0xaba3('0x93'),_0x4f5d51[_0xaba3('0x2c')]||_0x37c9c5[_0xaba3('0x2c')],require(_0xaba3('0x94'))[_0xaba3('0x95')](0x4),_0x4f5d51[_0xaba3('0x91')]||_0xaba3('0x96')),'reportId':_0x37c9c5['id'],'reportType':_0xaba3('0x97')});return db['AnalyticExtractedReport'][_0xaba3('0x4c')](_0x521baa,{'raw':!![]});})[_0xaba3('0x26')](function(_0x39368f){if(_0x37c9c5['table']===_0xaba3('0x98')){_0x261a81['where'](_0x37c9c5[_0xaba3('0x72')]+_0xaba3('0x99'),_0x4f5d51[_0xaba3('0x9a')],_0x4f5d51[_0xaba3('0x9b')]);}else{_0x261a81['where'](_0x37c9c5[_0xaba3('0x72')]+_0xaba3('0x9c'),_0x4f5d51[_0xaba3('0x9a')],_0x4f5d51['endDate']);}if(_0x39368f){logger['info'](_0xaba3('0x9d'),_0x261a81[_0xaba3('0x85')]());require(_0xaba3('0x9e'))[_0xaba3('0x9f')](path[_0xaba3('0x89')](__dirname,_0xaba3('0xa0'),_0x39368f[_0xaba3('0x91')]),[_0x39368f['id'],_0x261a81[_0xaba3('0x85')](),path[_0xaba3('0x89')](__dirname,'../../files/reports',_0x39368f[_0xaba3('0xa1')]),_0x4a7a10]);return _0x39368f;}else{var _0x17f3d8=squel[_0xaba3('0x70')]();_0x17f3d8[_0xaba3('0x71')]('('+_0x261a81[_0xaba3('0x85')]()+')',_0xaba3('0xa2'));_0x17f3d8[_0xaba3('0x68')](_0xaba3('0xa3'),'count');_0x261a81['limit'](_0x4f5d51['limit']||_0x4be6b8);_0x261a81[_0xaba3('0x1b')](_0x4f5d51['offset']||0x0);return dbH['sequelize'][_0xaba3('0x36')](_0x17f3d8[_0xaba3('0x85')](),{'type':dbH[_0xaba3('0x86')]['QueryTypes'][_0xaba3('0x88')]})['then'](function(_0x4e9975){if(!_0x4e9975[_0xaba3('0x3a')]){_0x217236=0x0;}else{_0x217236=_0x4e9975[0x0]['count']||0x0;}return dbH[_0xaba3('0x86')][_0xaba3('0x36')](_0x261a81[_0xaba3('0x85')](),{'type':dbH[_0xaba3('0x86')]['QueryTypes']['SELECT']});})['then'](function(_0xc36b06){return{'rows':_0xc36b06||[],'count':_0x217236};});}});}exports[_0xaba3('0xa4')]=function(_0x18feb5,_0x367727){return runReport(_0x18feb5['params'],_0x18feb5[_0xaba3('0x36')],_0x18feb5[_0xaba3('0x4b')])[_0xaba3('0x26')](respondWithResult(_0x367727,null))[_0xaba3('0x47')](handleError(_0x367727,null));};exports[_0xaba3('0xa5')]=runReport;exports['query']=function(_0x551071,_0x257ef5){var _0x40d0ae=0xa;var _0x2eef50=[_0xaba3('0x89'),_0xaba3('0x57'),'right_join','cross_join'];var _0x1851ec={'SUM':_0xaba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xaba3('0x5a'),'MAX':_0xaba3('0x5b'),'MIN':_0xaba3('0xa6'),'AVG':_0xaba3('0x5c'),'GROUP_CONCAT':_0xaba3('0x5d'),'GROUP_CONCAT ASC':_0xaba3('0x8b'),'GROUP_CONCAT DESC':_0xaba3('0x5e')};var _0x373247={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xaba3('0x5f'),'HOUR':_0xaba3('0x60'),'ROUND':_0xaba3('0x8d'),'UNIX_TIMESTAMP':_0xaba3('0x61')};var _0x2b3c0f=function(_0x4b6dac){return!_[_0xaba3('0x62')]([_0xaba3('0x8e'),_0xaba3('0x63'),_0xaba3('0xa7'),_0xaba3('0x64')],_0x4b6dac);};var _0x46a1d4=function(_0x330289){if(!_0x330289||!_0x330289[_0xaba3('0x65')][_0xaba3('0x3a')]){return'';}for(var _0x229e1a='(',_0xeb1e04=0x0;_0xeb1e04<_0x330289[_0xaba3('0x65')][_0xaba3('0x3a')];_0xeb1e04+=0x1){_0xeb1e04>0x0&&(_0x229e1a+='\x20'+_0x330289['operator']+'\x20');_0x229e1a+=_0x330289[_0xaba3('0x65')][_0xeb1e04]['group']?_0x46a1d4(_0x330289[_0xaba3('0x65')][_0xeb1e04][_0xaba3('0x67')]):_0x330289[_0xaba3('0x65')][_0xeb1e04]['field']+'\x20'+_0x330289[_0xaba3('0x65')][_0xeb1e04]['condition']+(_0x2b3c0f(_0x330289[_0xaba3('0x65')][_0xeb1e04][_0xaba3('0x69')])?'\x20'+_0x330289['rules'][_0xeb1e04][_0xaba3('0x6a')]:'');}return _0x229e1a+')';};var _0x3a2404={'where':{'id':_0x551071['params']['id']}},_0x57d892,_0x1c8702,_0x3f0f6f,_0x146ed7,_0x4a78a4;_0x3a2404=_['merge']({},_0x3a2404,_0x551071[_0xaba3('0x4b')]);return db['AnalyticCustomReport'][_0xaba3('0x55')](_0x3a2404)[_0xaba3('0x26')](function(_0x25efd9){if(_0x25efd9){_0x57d892=_0x25efd9;return _0x25efd9['getFields']();}return null;})[_0xaba3('0x26')](function(_0x11b878){if(_0x11b878){if(!_0x11b878[_0xaba3('0x3a')]){throw new db['Sequelize'][(_0xaba3('0x6c'))](_0xaba3('0x6d'),0x193);}_0x1c8702=_0x11b878;return db[_0xaba3('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xaba3('0x26')](function(_0x4b177c){if(_0x4b177c){_0x3f0f6f=_['keyBy'](_0x4b177c,'id');var _0x56ed59;var _0x226779=squel['select']();_0x226779[_0xaba3('0x71')](_0x57d892[_0xaba3('0x72')]);for(var _0x4190b4=0x0;_0x4190b4<_0x1c8702[_0xaba3('0x3a')];_0x4190b4+=0x1){_0x56ed59=_0x1c8702[_0x4190b4][_0xaba3('0x73')]?_0x3f0f6f[_0x1c8702[_0x4190b4][_0xaba3('0x73')]][_0xaba3('0x74')]:_0x1c8702[_0x4190b4][_0xaba3('0x68')];_0x56ed59=_0x1c8702[_0x4190b4][_0xaba3('0x76')]?_[_0xaba3('0x75')](_0x1851ec[_0x1c8702[_0x4190b4][_0xaba3('0x76')]],'%s',_0x56ed59):_0x56ed59;_0x56ed59=_0x1c8702[_0x4190b4]['format']?_[_0xaba3('0x75')](_0x373247[_0x1c8702[_0x4190b4]['format']],'%s',_0x56ed59):_0x56ed59;if(_0x1c8702[_0x4190b4]['groupBy']){_0x226779['group'](_0x56ed59);}_0x1c8702[_0x4190b4]['orderBy']&&_0x226779[_0xaba3('0x3d')](_0x56ed59,_0x1c8702[_0x4190b4][_0xaba3('0x78')]===_0xaba3('0x79')?![]:!![]);_0x226779[_0xaba3('0x68')](_0x56ed59,_0x1c8702[_0x4190b4]['alias']||_0x56ed59);}if(_0x57d892['joins']){_0x57d892['joins']=JSON[_0xaba3('0x7c')](_0x57d892[_0xaba3('0x7b')]);for(var _0x1bab1b=0x0;_0x1bab1b<_0x57d892['joins'][_0xaba3('0x3a')];_0x1bab1b+=0x1){if(_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x33')]&&_[_0xaba3('0x62')](_0x2eef50,_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x33')])&&_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7d')]&&_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7f')]&&_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7e')]){_0x226779[_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x33')]](_0x57d892[_0xaba3('0x7b')][_0x1bab1b]['foreignTable'],null,util[_0xaba3('0x90')](_0xaba3('0x80'),_0x57d892['table'],_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7d')],_0x57d892[_0xaba3('0x7b')][_0x1bab1b][_0xaba3('0x7f')],_0x57d892['joins'][_0x1bab1b][_0xaba3('0x7e')]));}}}if(_0x57d892[_0xaba3('0x81')]){_0x57d892[_0xaba3('0x81')]=JSON[_0xaba3('0x7c')](_0x57d892[_0xaba3('0x81')]);_0x226779[_0xaba3('0x3f')](_0x46a1d4(_0x57d892[_0xaba3('0x81')][_0xaba3('0x67')]));}_0x4a78a4=_0x226779[_0xaba3('0x82')]();_0x226779[_0xaba3('0x1e')](_0x40d0ae);_0x226779[_0xaba3('0x1b')](0x0);logger['debug'](_0xaba3('0x84'),_0x226779[_0xaba3('0x85')]());return dbH['sequelize'][_0xaba3('0x36')](_0x226779['toString'](),{'type':dbH[_0xaba3('0x86')][_0xaba3('0x87')][_0xaba3('0x88')]});}})[_0xaba3('0x26')](function(){return{'sql':_0x4a78a4[_0xaba3('0x85')]()};})['then'](respondWithResult(_0x257ef5,null))['catch'](handleError(_0x257ef5,null));}; \ No newline at end of file +var _0x4dd8=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','destroy','then','get','CustomReports','UserProfileResource','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','error','update','preview','join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','keyBy','from','table','MetricId','function','format','groupBy','order','orderBy','DESC','joins','parse','foreignTable','foreignKey','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_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)','SEC_TO_TIME(%s)','HOUR(%s)','value','Please\x20insert\x20at\x20least\x20one\x20field','metric','replace','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../files/reports','savename','select','countTable','COUNT(*)','run','runReport','AVG(%s)','Sequelize','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x4ee804,_0xd164c1){var _0x316cc9=function(_0x4beaf7){while(--_0x4beaf7){_0x4ee804['push'](_0x4ee804['shift']());}};_0x316cc9(++_0xd164c1);}(_0x4dd8,0x1e7));var _0x84dd=function(_0x112e53,_0x3ec1de){_0x112e53=_0x112e53-0x0;var _0x47740e=_0x4dd8[_0x112e53];return _0x47740e;};'use strict';var emlformat=require(_0x84dd('0x0'));var rimraf=require(_0x84dd('0x1'));var zipdir=require(_0x84dd('0x2'));var jsonpatch=require(_0x84dd('0x3'));var rp=require(_0x84dd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x84dd('0x5'));var util=require('util');var path=require(_0x84dd('0x6'));var sox=require(_0x84dd('0x7'));var csv=require(_0x84dd('0x8'));var ejs=require(_0x84dd('0x9'));var fs=require('fs');var fs_extra=require(_0x84dd('0xa'));var _=require(_0x84dd('0xb'));var squel=require(_0x84dd('0xc'));var crypto=require(_0x84dd('0xd'));var jsforce=require(_0x84dd('0xe'));var deskjs=require(_0x84dd('0xf'));var toCsv=require(_0x84dd('0x8'));var querystring=require('querystring');var Papa=require(_0x84dd('0x10'));var Redis=require(_0x84dd('0x11'));var authService=require(_0x84dd('0x12'));var qs=require(_0x84dd('0x13'));var as=require(_0x84dd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x84dd('0x15'));var utils=require(_0x84dd('0x16'));var config=require(_0x84dd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x84dd('0x18'))['db'];var dbH=require(_0x84dd('0x18'))[_0x84dd('0x19')];function respondWithStatusCode(_0x510f5e,_0x131897){_0x131897=_0x131897||0xcc;return function(_0x27df72){if(_0x27df72){return _0x510f5e[_0x84dd('0x1a')](_0x131897);}return _0x510f5e[_0x84dd('0x1b')](_0x131897)[_0x84dd('0x1c')]();};}function respondWithResult(_0x2abe0c,_0x5b905e){_0x5b905e=_0x5b905e||0xc8;return function(_0x19bec6){if(_0x19bec6){return _0x2abe0c[_0x84dd('0x1b')](_0x5b905e)[_0x84dd('0x1d')](_0x19bec6);}};}function respondWithFilteredResult(_0x251ec5,_0x1ba75f){return function(_0x24ae78){if(_0x24ae78){var _0x308cda=typeof _0x1ba75f['offset']===_0x84dd('0x1e')&&typeof _0x1ba75f[_0x84dd('0x1f')]==='undefined';var _0x36a6c7=_0x24ae78['count'];var _0x576b3a=_0x308cda?0x0:_0x1ba75f[_0x84dd('0x20')];var _0x2f3e19=_0x308cda?_0x24ae78[_0x84dd('0x21')]:_0x1ba75f[_0x84dd('0x20')]+_0x1ba75f[_0x84dd('0x1f')];var _0x21e0e6;if(_0x2f3e19>=_0x36a6c7){_0x2f3e19=_0x36a6c7;_0x21e0e6=0xc8;}else{_0x21e0e6=0xce;}_0x251ec5[_0x84dd('0x1b')](_0x21e0e6);return _0x251ec5['set'](_0x84dd('0x22'),_0x576b3a+'-'+_0x2f3e19+'/'+_0x36a6c7)[_0x84dd('0x1d')](_0x24ae78);}return null;};}function patchUpdates(_0x2ece4e){return function(_0x2c82f3){try{jsonpatch[_0x84dd('0x23')](_0x2c82f3,_0x2ece4e,!![]);}catch(_0x58a93c){return BPromise[_0x84dd('0x24')](_0x58a93c);}return _0x2c82f3[_0x84dd('0x25')]();};}function saveUpdates(_0x9d1c0f,_0x44187d){return function(_0x1a05f6){if(_0x1a05f6){return _0x1a05f6['update'](_0x9d1c0f)['then'](function(_0x216721){return _0x216721;});}return null;};}function removeEntity(_0x5390e1,_0x5783b6){return function(_0x54472a){if(_0x54472a){return _0x54472a[_0x84dd('0x26')]()[_0x84dd('0x27')](function(){var _0x3224d0=_0x54472a[_0x84dd('0x28')]({'plain':!![]});var _0x36c838=_0x84dd('0x29');return db[_0x84dd('0x2a')]['destroy']({'where':{'type':_0x36c838,'resourceId':_0x3224d0['id']}})[_0x84dd('0x27')](function(){return _0x54472a;});})[_0x84dd('0x27')](function(){_0x5390e1[_0x84dd('0x1b')](0xcc)[_0x84dd('0x1c')]();});}};}function handleEntityNotFound(_0x246d9b,_0x115bce){return function(_0x282b0b){if(!_0x282b0b){_0x246d9b[_0x84dd('0x1a')](0x194);}return _0x282b0b;};}function handleError(_0x126ecc,_0x31816e){_0x31816e=_0x31816e||0x1f4;return function(_0x49dc6c){logger['error'](_0x49dc6c[_0x84dd('0x2b')]);if(_0x49dc6c[_0x84dd('0x2c')]){delete _0x49dc6c[_0x84dd('0x2c')];}_0x126ecc[_0x84dd('0x1b')](_0x31816e)[_0x84dd('0x2d')](_0x49dc6c);};}exports[_0x84dd('0x2e')]=function(_0x5a2fe2,_0xc14cf1){var _0x5de42d={},_0x55d1e3={},_0x3ff71c={'count':0x0,'rows':[]};var _0x3e384e=_[_0x84dd('0x2f')](db[_0x84dd('0x30')][_0x84dd('0x31')],function(_0x5f0ac6){return{'name':_0x5f0ac6[_0x84dd('0x32')],'type':_0x5f0ac6[_0x84dd('0x33')][_0x84dd('0x34')]};});_0x55d1e3['model']=_[_0x84dd('0x2f')](_0x3e384e,_0x84dd('0x2c'));_0x55d1e3['query']=_['keys'](_0x5a2fe2['query']);_0x55d1e3[_0x84dd('0x35')]=_[_0x84dd('0x36')](_0x55d1e3[_0x84dd('0x37')],_0x55d1e3[_0x84dd('0x38')]);_0x5de42d[_0x84dd('0x39')]=_[_0x84dd('0x36')](_0x55d1e3[_0x84dd('0x37')],qs[_0x84dd('0x3a')](_0x5a2fe2[_0x84dd('0x38')][_0x84dd('0x3a')]));_0x5de42d[_0x84dd('0x39')]=_0x5de42d[_0x84dd('0x39')][_0x84dd('0x3b')]?_0x5de42d[_0x84dd('0x39')]:_0x55d1e3[_0x84dd('0x37')];if(!_0x5a2fe2[_0x84dd('0x38')][_0x84dd('0x3c')](_0x84dd('0x3d'))){_0x5de42d[_0x84dd('0x1f')]=qs[_0x84dd('0x1f')](_0x5a2fe2[_0x84dd('0x38')][_0x84dd('0x1f')]);_0x5de42d[_0x84dd('0x20')]=qs[_0x84dd('0x20')](_0x5a2fe2[_0x84dd('0x38')][_0x84dd('0x20')]);}_0x5de42d['order']=qs[_0x84dd('0x3e')](_0x5a2fe2['query']['sort']);_0x5de42d[_0x84dd('0x3f')]=qs[_0x84dd('0x35')](_[_0x84dd('0x40')](_0x5a2fe2[_0x84dd('0x38')],_0x55d1e3[_0x84dd('0x35')]),_0x3e384e);if(_0x5a2fe2[_0x84dd('0x38')][_0x84dd('0x41')]){_0x5de42d[_0x84dd('0x3f')]=_[_0x84dd('0x42')](_0x5de42d['where'],{'$or':_['map'](_0x3e384e,function(_0x26688a){if(_0x26688a['type']!==_0x84dd('0x43')){var _0x1e8f41={};_0x1e8f41[_0x26688a['name']]={'$like':'%'+_0x5a2fe2['query']['filter']+'%'};return _0x1e8f41;}})});}_0x5de42d=_['merge']({},_0x5de42d,_0x5a2fe2[_0x84dd('0x44')]);var _0x5833a={'where':_0x5de42d['where']};return db[_0x84dd('0x30')][_0x84dd('0x21')](_0x5833a)[_0x84dd('0x27')](function(_0x38e4a8){_0x3ff71c[_0x84dd('0x21')]=_0x38e4a8;if(_0x5a2fe2[_0x84dd('0x38')]['includeAll']){_0x5de42d['include']=[{'all':!![]}];}return db[_0x84dd('0x30')][_0x84dd('0x45')](_0x5de42d);})[_0x84dd('0x27')](function(_0x2eaceb){_0x3ff71c[_0x84dd('0x46')]=_0x2eaceb;return _0x3ff71c;})['then'](respondWithFilteredResult(_0xc14cf1,_0x5de42d))[_0x84dd('0x47')](handleError(_0xc14cf1,null));};exports['show']=function(_0xbfbafa,_0x5a75e8){var _0x1d6784={'raw':![],'where':{'id':_0xbfbafa[_0x84dd('0x48')]['id']}},_0x4e8e8e={};_0x4e8e8e[_0x84dd('0x37')]=_[_0x84dd('0x49')](db[_0x84dd('0x30')][_0x84dd('0x31')]);_0x4e8e8e['query']=_[_0x84dd('0x49')](_0xbfbafa[_0x84dd('0x38')]);_0x4e8e8e[_0x84dd('0x35')]=_[_0x84dd('0x36')](_0x4e8e8e[_0x84dd('0x37')],_0x4e8e8e[_0x84dd('0x38')]);_0x1d6784[_0x84dd('0x39')]=_['intersection'](_0x4e8e8e[_0x84dd('0x37')],qs['fields'](_0xbfbafa[_0x84dd('0x38')][_0x84dd('0x3a')]));_0x1d6784[_0x84dd('0x39')]=_0x1d6784[_0x84dd('0x39')][_0x84dd('0x3b')]?_0x1d6784[_0x84dd('0x39')]:_0x4e8e8e[_0x84dd('0x37')];if(_0xbfbafa[_0x84dd('0x38')][_0x84dd('0x4a')]){_0x1d6784['include']=[{'all':!![]}];}_0x1d6784=_[_0x84dd('0x42')]({},_0x1d6784,_0xbfbafa[_0x84dd('0x44')]);return db[_0x84dd('0x30')][_0x84dd('0x4b')](_0x1d6784)[_0x84dd('0x27')](handleEntityNotFound(_0x5a75e8,null))[_0x84dd('0x27')](respondWithResult(_0x5a75e8,null))['catch'](handleError(_0x5a75e8,null));};exports['create']=function(_0xe35b04,_0xd369f1){return db[_0x84dd('0x30')][_0x84dd('0x4c')](_0xe35b04[_0x84dd('0x4d')],{})[_0x84dd('0x27')](function(_0x584bc7){var _0x460741=_0xe35b04[_0x84dd('0x4e')][_0x84dd('0x28')]({'plain':!![]});if(!_0x460741)throw new Error(_0x84dd('0x4f'));if(_0x460741[_0x84dd('0x50')]===_0x84dd('0x4e')){var _0xe0ef5f=_0x584bc7[_0x84dd('0x28')]({'plain':!![]});var _0x3e3f5e=_0x84dd('0x51');return db[_0x84dd('0x52')][_0x84dd('0x4b')]({'where':{'name':_0x3e3f5e,'userProfileId':_0x460741['userProfileId']},'raw':!![]})[_0x84dd('0x27')](function(_0x3ff970){if(_0x3ff970&&_0x3ff970[_0x84dd('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0xe0ef5f[_0x84dd('0x2c')],'resourceId':_0xe0ef5f['id'],'type':_0x84dd('0x29'),'sectionId':_0x3ff970['id']},{})[_0x84dd('0x27')](function(){return _0x584bc7;});}else{return _0x584bc7;}})[_0x84dd('0x47')](function(_0x35f13a){logger[_0x84dd('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35f13a);throw _0x35f13a;});}return _0x584bc7;})['then'](respondWithResult(_0xd369f1,0xc9))['catch'](handleError(_0xd369f1,null));};exports[_0x84dd('0x55')]=function(_0x3f3722,_0x32d956){if(_0x3f3722[_0x84dd('0x4d')]['id']){delete _0x3f3722[_0x84dd('0x4d')]['id'];}return db[_0x84dd('0x30')][_0x84dd('0x4b')]({'where':{'id':_0x3f3722[_0x84dd('0x48')]['id']}})['then'](handleEntityNotFound(_0x32d956,null))[_0x84dd('0x27')](saveUpdates(_0x3f3722[_0x84dd('0x4d')],null))[_0x84dd('0x27')](respondWithResult(_0x32d956,null))[_0x84dd('0x47')](handleError(_0x32d956,null));};exports[_0x84dd('0x26')]=function(_0x489e8c,_0x321088){return db[_0x84dd('0x30')][_0x84dd('0x4b')]({'where':{'id':_0x489e8c[_0x84dd('0x48')]['id']}})[_0x84dd('0x27')](handleEntityNotFound(_0x321088,null))[_0x84dd('0x27')](removeEntity(_0x321088,null))[_0x84dd('0x47')](handleError(_0x321088,null));};exports[_0x84dd('0x56')]=function(_0x2602d3,_0xb452d){var _0x50da91=0xa;var _0x47dae5=[_0x84dd('0x57'),'left_join',_0x84dd('0x58'),'cross_join'];var _0x3aee7b={'SUM':_0x84dd('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x84dd('0x5a'),'MAX':_0x84dd('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2de814={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x84dd('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x84dd('0x5d'),'UNIX_TIMESTAMP':_0x84dd('0x5e')};var _0x21d5c5=function(_0x2e3ddf){return!_[_0x84dd('0x5f')]([_0x84dd('0x60'),_0x84dd('0x61'),_0x84dd('0x62'),_0x84dd('0x63')],_0x2e3ddf);};var _0x386b87=function(_0x2ed4a3){if(!_0x2ed4a3||!_0x2ed4a3[_0x84dd('0x64')][_0x84dd('0x3b')]){return'';}for(var _0x32c4cf='(',_0x5a6d5b=0x0;_0x5a6d5b<_0x2ed4a3[_0x84dd('0x64')][_0x84dd('0x3b')];_0x5a6d5b+=0x1){_0x5a6d5b>0x0&&(_0x32c4cf+='\x20'+_0x2ed4a3[_0x84dd('0x65')]+'\x20');_0x32c4cf+=_0x2ed4a3[_0x84dd('0x64')][_0x5a6d5b][_0x84dd('0x66')]?_0x386b87(_0x2ed4a3[_0x84dd('0x64')][_0x5a6d5b][_0x84dd('0x66')]):_0x2ed4a3[_0x84dd('0x64')][_0x5a6d5b][_0x84dd('0x67')]+'\x20'+_0x2ed4a3[_0x84dd('0x64')][_0x5a6d5b][_0x84dd('0x68')]+(_0x21d5c5(_0x2ed4a3[_0x84dd('0x64')][_0x5a6d5b][_0x84dd('0x68')])?'\x20'+_0x2ed4a3['rules'][_0x5a6d5b]['value']:'');}return _0x32c4cf+')';};var _0x430df5={'where':{'id':_0x2602d3[_0x84dd('0x48')]['id']}},_0x26ddf5,_0x96141,_0xe50cc3,_0x4bf94e,_0x1ee27a;_0x430df5=_[_0x84dd('0x42')]({},_0x430df5,_0x2602d3[_0x84dd('0x44')]);return db['AnalyticCustomReport'][_0x84dd('0x4b')](_0x430df5)[_0x84dd('0x27')](function(_0x3fde8e){if(_0x3fde8e){_0x26ddf5=_0x3fde8e;return _0x3fde8e[_0x84dd('0x69')]();}return null;})[_0x84dd('0x27')](function(_0x36e266){if(_0x36e266){if(!_0x36e266[_0x84dd('0x3b')]){throw new db['Sequelize'][(_0x84dd('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x96141=_0x36e266;return db['AnalyticMetric'][_0x84dd('0x45')]({'raw':!![]});}return null;})[_0x84dd('0x27')](function(_0x22412b){if(_0x22412b){_0xe50cc3=_[_0x84dd('0x6b')](_0x22412b,'id');var _0x355c34;var _0x3093d0=squel['select']();_0x3093d0[_0x84dd('0x6c')](_0x26ddf5[_0x84dd('0x6d')]);for(var _0x2c6834=0x0;_0x2c6834<_0x96141[_0x84dd('0x3b')];_0x2c6834+=0x1){_0x355c34=_0x96141[_0x2c6834][_0x84dd('0x6e')]?_0xe50cc3[_0x96141[_0x2c6834][_0x84dd('0x6e')]]['metric']:_0x96141[_0x2c6834][_0x84dd('0x67')];_0x355c34=_0x96141[_0x2c6834][_0x84dd('0x6f')]?_['replace'](_0x3aee7b[_0x96141[_0x2c6834]['function']],'%s',_0x355c34):_0x355c34;_0x355c34=_0x96141[_0x2c6834][_0x84dd('0x70')]?_['replace'](_0x2de814[_0x96141[_0x2c6834][_0x84dd('0x70')]],'%s',_0x355c34):_0x355c34;if(_0x96141[_0x2c6834][_0x84dd('0x71')]){_0x3093d0[_0x84dd('0x66')](_0x355c34);}_0x96141[_0x2c6834]['orderBy']&&_0x3093d0[_0x84dd('0x72')](_0x355c34,_0x96141[_0x2c6834][_0x84dd('0x73')]===_0x84dd('0x74')?![]:!![]);_0x3093d0[_0x84dd('0x67')](_0x355c34,_0x96141[_0x2c6834]['alias']||_0x355c34);}if(_0x26ddf5[_0x84dd('0x75')]){_0x26ddf5[_0x84dd('0x75')]=JSON[_0x84dd('0x76')](_0x26ddf5[_0x84dd('0x75')]);for(var _0x379cc7=0x0;_0x379cc7<_0x26ddf5[_0x84dd('0x75')][_0x84dd('0x3b')];_0x379cc7+=0x1){if(_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x33')]&&_[_0x84dd('0x5f')](_0x47dae5,_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x33')])&&_0x26ddf5['joins'][_0x379cc7]['parentKey']&&_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x77')]&&_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x78')]){_0x3093d0[_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x33')]](_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x77')],null,util[_0x84dd('0x70')]('%s.%s\x20=\x20%s.%s',_0x26ddf5[_0x84dd('0x6d')],_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x79')],_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x77')],_0x26ddf5[_0x84dd('0x75')][_0x379cc7][_0x84dd('0x78')]));}}}if(_0x26ddf5['conditions']){_0x26ddf5[_0x84dd('0x7a')]=JSON[_0x84dd('0x76')](_0x26ddf5[_0x84dd('0x7a')]);_0x3093d0[_0x84dd('0x3f')](_0x386b87(_0x26ddf5[_0x84dd('0x7a')][_0x84dd('0x66')]));}_0x1ee27a=_0x3093d0[_0x84dd('0x7b')]();_0x3093d0[_0x84dd('0x1f')](_0x50da91);_0x3093d0[_0x84dd('0x20')](0x0);logger[_0x84dd('0x7c')](_0x84dd('0x7d'),_0x3093d0[_0x84dd('0x7e')]());return dbH[_0x84dd('0x7f')][_0x84dd('0x38')](_0x3093d0[_0x84dd('0x7e')](),{'type':dbH[_0x84dd('0x7f')][_0x84dd('0x80')][_0x84dd('0x81')]});}})[_0x84dd('0x27')](respondWithResult(_0xb452d,null))['catch'](handleError(_0xb452d,null));};function runReport(_0x29599c,_0x35f032,_0x173ca3){var _0x3e5f6f=_0x35f032[_0x84dd('0x2c')];var _0x5c092d=0xa;var _0x21066a=[_0x84dd('0x57'),_0x84dd('0x82'),_0x84dd('0x58'),_0x84dd('0x83')];var _0x4e0832={'SUM':'SUM(%s)','COUNT':_0x84dd('0x84'),'COUNT DISTINCT':_0x84dd('0x5a'),'MAX':'MAX(%s)','MIN':_0x84dd('0x85'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x84dd('0x86'),'GROUP_CONCAT ASC':_0x84dd('0x87'),'GROUP_CONCAT DESC':_0x84dd('0x88')};var _0x1d6490={'SEC_TO_TIME':_0x84dd('0x89'),'DATE':_0x84dd('0x5c'),'HOUR':_0x84dd('0x8a'),'ROUND':_0x84dd('0x5d'),'UNIX_TIMESTAMP':_0x84dd('0x5e')};var _0x29463b=function(_0x4ae3be){return!_[_0x84dd('0x5f')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x84dd('0x63')],_0x4ae3be);};var _0x428d92=function(_0x1d2918){if(!_0x1d2918||!_0x1d2918['rules']['length']){return'';}for(var _0x2c9d49='(',_0x13100f=0x0;_0x13100f<_0x1d2918[_0x84dd('0x64')][_0x84dd('0x3b')];_0x13100f+=0x1){_0x13100f>0x0&&(_0x2c9d49+='\x20'+_0x1d2918['operator']+'\x20');_0x2c9d49+=_0x1d2918['rules'][_0x13100f][_0x84dd('0x66')]?_0x428d92(_0x1d2918[_0x84dd('0x64')][_0x13100f][_0x84dd('0x66')]):_0x1d2918[_0x84dd('0x64')][_0x13100f][_0x84dd('0x67')]+'\x20'+_0x1d2918[_0x84dd('0x64')][_0x13100f][_0x84dd('0x68')]+(_0x29463b(_0x1d2918[_0x84dd('0x64')][_0x13100f][_0x84dd('0x68')])?'\x20'+_0x1d2918[_0x84dd('0x64')][_0x13100f][_0x84dd('0x8b')]:'');}return _0x2c9d49+')';};var _0x2ec272={'where':{'id':_0x29599c['id']}},_0x1112a7,_0x59f77f,_0x17382b,_0x2e9577,_0x18026;_0x2ec272=_['merge']({},_0x2ec272,_0x173ca3);return db[_0x84dd('0x30')][_0x84dd('0x4b')](_0x2ec272)[_0x84dd('0x27')](function(_0x2c18f0){if(_0x2c18f0){_0x1112a7=_0x2c18f0;return _0x2c18f0[_0x84dd('0x69')]();}return null;})[_0x84dd('0x27')](function(_0x50f39a){if(_0x50f39a){if(!_0x50f39a[_0x84dd('0x3b')]){throw new db['Sequelize'][(_0x84dd('0x6a'))](_0x84dd('0x8c'),0x193);}_0x59f77f=_0x50f39a;return db['AnalyticMetric'][_0x84dd('0x45')]({'raw':!![]});}return null;})[_0x84dd('0x27')](function(_0x1871d6){if(_0x1871d6){_0x17382b=_[_0x84dd('0x6b')](_0x1871d6,'id');var _0x298ea2;var _0x128545=squel['select']();_0x128545[_0x84dd('0x6c')](_0x1112a7[_0x84dd('0x6d')]);for(var _0x54ac9c=0x0;_0x54ac9c<_0x59f77f['length'];_0x54ac9c+=0x1){_0x298ea2=_0x59f77f[_0x54ac9c][_0x84dd('0x6e')]?_0x17382b[_0x59f77f[_0x54ac9c][_0x84dd('0x6e')]][_0x84dd('0x8d')]:_0x59f77f[_0x54ac9c][_0x84dd('0x67')];_0x298ea2=_0x59f77f[_0x54ac9c][_0x84dd('0x6f')]?_['replace'](_0x4e0832[_0x59f77f[_0x54ac9c][_0x84dd('0x6f')]],'%s',_0x298ea2):_0x298ea2;_0x298ea2=_0x59f77f[_0x54ac9c][_0x84dd('0x70')]?_[_0x84dd('0x8e')](_0x1d6490[_0x59f77f[_0x54ac9c][_0x84dd('0x70')]],'%s',_0x298ea2):_0x298ea2;if(_0x59f77f[_0x54ac9c]['groupBy']){_0x128545[_0x84dd('0x66')](_0x298ea2);}_0x59f77f[_0x54ac9c][_0x84dd('0x73')]&&_0x128545[_0x84dd('0x72')](_0x298ea2,_0x59f77f[_0x54ac9c][_0x84dd('0x73')]==='DESC'?![]:!![]);_0x128545[_0x84dd('0x67')](_0x298ea2,_0x59f77f[_0x54ac9c][_0x84dd('0x8f')]||_0x298ea2);}if(_0x1112a7[_0x84dd('0x75')]){_0x1112a7['joins']=JSON[_0x84dd('0x76')](_0x1112a7['joins']);for(var _0x4f4dc4=0x0;_0x4f4dc4<_0x1112a7['joins']['length'];_0x4f4dc4+=0x1){if(_0x1112a7[_0x84dd('0x75')][_0x4f4dc4][_0x84dd('0x33')]&&_['includes'](_0x21066a,_0x1112a7[_0x84dd('0x75')][_0x4f4dc4]['type'])&&_0x1112a7[_0x84dd('0x75')][_0x4f4dc4][_0x84dd('0x79')]&&_0x1112a7['joins'][_0x4f4dc4][_0x84dd('0x77')]&&_0x1112a7[_0x84dd('0x75')][_0x4f4dc4][_0x84dd('0x78')]){_0x128545[_0x1112a7[_0x84dd('0x75')][_0x4f4dc4][_0x84dd('0x33')]](_0x1112a7[_0x84dd('0x75')][_0x4f4dc4][_0x84dd('0x77')],null,util[_0x84dd('0x70')](_0x84dd('0x90'),_0x1112a7[_0x84dd('0x6d')],_0x1112a7[_0x84dd('0x75')][_0x4f4dc4][_0x84dd('0x79')],_0x1112a7[_0x84dd('0x75')][_0x4f4dc4][_0x84dd('0x77')],_0x1112a7['joins'][_0x4f4dc4][_0x84dd('0x78')]));}}}if(_0x1112a7[_0x84dd('0x7a')]){_0x1112a7['conditions']=JSON[_0x84dd('0x76')](_0x1112a7[_0x84dd('0x7a')]);_0x128545[_0x84dd('0x3f')](_0x428d92(_0x1112a7['conditions'][_0x84dd('0x66')]));}_0x18026=_0x128545[_0x84dd('0x7b')]();_0x128545[_0x84dd('0x1f')](_0x5c092d);_0x128545[_0x84dd('0x20')](0x0);return;}})[_0x84dd('0x27')](function(){if(_0x35f032[_0x84dd('0x91')]===_0x84dd('0x92')){return null;}var _0x56d029=_['merge'](_0x35f032,{'name':_0x35f032[_0x84dd('0x93')]||_0x35f032[_0x84dd('0x2c')]||_0x1112a7[_0x84dd('0x2c')],'basename':_0x3e5f6f,'savename':util[_0x84dd('0x70')]('%s-%s.%s',_0x35f032[_0x84dd('0x2c')]||_0x1112a7[_0x84dd('0x2c')],require(_0x84dd('0x94'))['generate'](0x4),_0x35f032[_0x84dd('0x91')]||'csv'),'reportId':_0x1112a7['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x84dd('0x4c')](_0x56d029,{'raw':!![]});})['then'](function(_0x3bdf3a){if(_0x1112a7[_0x84dd('0x6d')]===_0x84dd('0x95')){_0x18026[_0x84dd('0x3f')](_0x1112a7['table']+_0x84dd('0x96'),_0x35f032[_0x84dd('0x97')],_0x35f032[_0x84dd('0x98')]);}else{_0x18026['where'](_0x1112a7[_0x84dd('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x35f032[_0x84dd('0x97')],_0x35f032[_0x84dd('0x98')]);}if(_0x3bdf3a){logger[_0x84dd('0x99')](_0x84dd('0x9a'),_0x18026[_0x84dd('0x7e')]());require('child_process')[_0x84dd('0x9b')](path['join'](__dirname,'../../components/export/',_0x3bdf3a[_0x84dd('0x91')]),[_0x3bdf3a['id'],_0x18026[_0x84dd('0x7e')](),path[_0x84dd('0x57')](__dirname,_0x84dd('0x9c'),_0x3bdf3a[_0x84dd('0x9d')]),_0x3e5f6f]);return _0x3bdf3a;}else{var _0x4b392b=squel[_0x84dd('0x9e')]();_0x4b392b['from']('('+_0x18026[_0x84dd('0x7e')]()+')',_0x84dd('0x9f'));_0x4b392b[_0x84dd('0x67')](_0x84dd('0xa0'),'count');_0x18026[_0x84dd('0x1f')](_0x35f032[_0x84dd('0x1f')]||_0x5c092d);_0x18026[_0x84dd('0x20')](_0x35f032[_0x84dd('0x20')]||0x0);return dbH[_0x84dd('0x7f')][_0x84dd('0x38')](_0x4b392b[_0x84dd('0x7e')](),{'type':dbH['sequelize']['QueryTypes'][_0x84dd('0x81')]})[_0x84dd('0x27')](function(_0x545d09){if(!_0x545d09[_0x84dd('0x3b')]){_0x2e9577=0x0;}else{_0x2e9577=_0x545d09[0x0]['count']||0x0;}return dbH[_0x84dd('0x7f')][_0x84dd('0x38')](_0x18026[_0x84dd('0x7e')](),{'type':dbH[_0x84dd('0x7f')]['QueryTypes'][_0x84dd('0x81')]});})['then'](function(_0x197a18){return{'rows':_0x197a18||[],'count':_0x2e9577};});}});}exports[_0x84dd('0xa1')]=function(_0x2a4156,_0x271948){return runReport(_0x2a4156['params'],_0x2a4156['query'],_0x2a4156[_0x84dd('0x44')])[_0x84dd('0x27')](respondWithResult(_0x271948,null))[_0x84dd('0x47')](handleError(_0x271948,null));};exports[_0x84dd('0xa2')]=runReport;exports['query']=function(_0x19b561,_0x2d1c29){var _0xf78df4=0xa;var _0x6c0063=[_0x84dd('0x57'),_0x84dd('0x82'),'right_join','cross_join'];var _0x2c93f8={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x84dd('0x5a'),'MAX':'MAX(%s)','MIN':_0x84dd('0x85'),'AVG':_0x84dd('0xa3'),'GROUP_CONCAT':_0x84dd('0x86'),'GROUP_CONCAT ASC':_0x84dd('0x87'),'GROUP_CONCAT DESC':_0x84dd('0x88')};var _0x127c8c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x84dd('0x5c'),'HOUR':_0x84dd('0x8a'),'ROUND':_0x84dd('0x5d'),'UNIX_TIMESTAMP':_0x84dd('0x5e')};var _0x5cea01=function(_0x684549){return!_[_0x84dd('0x5f')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x84dd('0x62'),_0x84dd('0x63')],_0x684549);};var _0x4f6a56=function(_0x121928){if(!_0x121928||!_0x121928[_0x84dd('0x64')][_0x84dd('0x3b')]){return'';}for(var _0x4632fe='(',_0x4f7901=0x0;_0x4f7901<_0x121928[_0x84dd('0x64')][_0x84dd('0x3b')];_0x4f7901+=0x1){_0x4f7901>0x0&&(_0x4632fe+='\x20'+_0x121928[_0x84dd('0x65')]+'\x20');_0x4632fe+=_0x121928['rules'][_0x4f7901][_0x84dd('0x66')]?_0x4f6a56(_0x121928['rules'][_0x4f7901]['group']):_0x121928['rules'][_0x4f7901][_0x84dd('0x67')]+'\x20'+_0x121928[_0x84dd('0x64')][_0x4f7901]['condition']+(_0x5cea01(_0x121928['rules'][_0x4f7901]['condition'])?'\x20'+_0x121928[_0x84dd('0x64')][_0x4f7901][_0x84dd('0x8b')]:'');}return _0x4632fe+')';};var _0x5e9d82={'where':{'id':_0x19b561['params']['id']}},_0xedbb26,_0x529133,_0x19b8df,_0x6f499a,_0x15e276;_0x5e9d82=_[_0x84dd('0x42')]({},_0x5e9d82,_0x19b561[_0x84dd('0x44')]);return db['AnalyticCustomReport'][_0x84dd('0x4b')](_0x5e9d82)['then'](function(_0x3bfaec){if(_0x3bfaec){_0xedbb26=_0x3bfaec;return _0x3bfaec[_0x84dd('0x69')]();}return null;})['then'](function(_0x4bedb3){if(_0x4bedb3){if(!_0x4bedb3[_0x84dd('0x3b')]){throw new db[(_0x84dd('0xa4'))]['ValidationErrorItem'](_0x84dd('0x8c'),0x193);}_0x529133=_0x4bedb3;return db[_0x84dd('0xa5')][_0x84dd('0x45')]({'raw':!![]});}return null;})[_0x84dd('0x27')](function(_0x87da06){if(_0x87da06){_0x19b8df=_['keyBy'](_0x87da06,'id');var _0x443af3;var _0x39ab4b=squel[_0x84dd('0x9e')]();_0x39ab4b[_0x84dd('0x6c')](_0xedbb26[_0x84dd('0x6d')]);for(var _0x44bf51=0x0;_0x44bf51<_0x529133[_0x84dd('0x3b')];_0x44bf51+=0x1){_0x443af3=_0x529133[_0x44bf51][_0x84dd('0x6e')]?_0x19b8df[_0x529133[_0x44bf51]['MetricId']][_0x84dd('0x8d')]:_0x529133[_0x44bf51][_0x84dd('0x67')];_0x443af3=_0x529133[_0x44bf51][_0x84dd('0x6f')]?_[_0x84dd('0x8e')](_0x2c93f8[_0x529133[_0x44bf51][_0x84dd('0x6f')]],'%s',_0x443af3):_0x443af3;_0x443af3=_0x529133[_0x44bf51][_0x84dd('0x70')]?_[_0x84dd('0x8e')](_0x127c8c[_0x529133[_0x44bf51][_0x84dd('0x70')]],'%s',_0x443af3):_0x443af3;if(_0x529133[_0x44bf51][_0x84dd('0x71')]){_0x39ab4b[_0x84dd('0x66')](_0x443af3);}_0x529133[_0x44bf51][_0x84dd('0x73')]&&_0x39ab4b['order'](_0x443af3,_0x529133[_0x44bf51][_0x84dd('0x73')]==='DESC'?![]:!![]);_0x39ab4b[_0x84dd('0x67')](_0x443af3,_0x529133[_0x44bf51][_0x84dd('0x8f')]||_0x443af3);}if(_0xedbb26['joins']){_0xedbb26[_0x84dd('0x75')]=JSON[_0x84dd('0x76')](_0xedbb26[_0x84dd('0x75')]);for(var _0x15f24c=0x0;_0x15f24c<_0xedbb26[_0x84dd('0x75')]['length'];_0x15f24c+=0x1){if(_0xedbb26[_0x84dd('0x75')][_0x15f24c][_0x84dd('0x33')]&&_[_0x84dd('0x5f')](_0x6c0063,_0xedbb26[_0x84dd('0x75')][_0x15f24c]['type'])&&_0xedbb26[_0x84dd('0x75')][_0x15f24c][_0x84dd('0x79')]&&_0xedbb26[_0x84dd('0x75')][_0x15f24c][_0x84dd('0x77')]&&_0xedbb26[_0x84dd('0x75')][_0x15f24c]['foreignKey']){_0x39ab4b[_0xedbb26[_0x84dd('0x75')][_0x15f24c]['type']](_0xedbb26[_0x84dd('0x75')][_0x15f24c][_0x84dd('0x77')],null,util[_0x84dd('0x70')](_0x84dd('0x90'),_0xedbb26[_0x84dd('0x6d')],_0xedbb26[_0x84dd('0x75')][_0x15f24c][_0x84dd('0x79')],_0xedbb26[_0x84dd('0x75')][_0x15f24c][_0x84dd('0x77')],_0xedbb26['joins'][_0x15f24c][_0x84dd('0x78')]));}}}if(_0xedbb26[_0x84dd('0x7a')]){_0xedbb26['conditions']=JSON['parse'](_0xedbb26[_0x84dd('0x7a')]);_0x39ab4b[_0x84dd('0x3f')](_0x4f6a56(_0xedbb26[_0x84dd('0x7a')][_0x84dd('0x66')]));}_0x15e276=_0x39ab4b['clone']();_0x39ab4b[_0x84dd('0x1f')](_0xf78df4);_0x39ab4b[_0x84dd('0x20')](0x0);logger[_0x84dd('0x7c')](_0x84dd('0x7d'),_0x39ab4b['toString']());return dbH[_0x84dd('0x7f')][_0x84dd('0x38')](_0x39ab4b['toString'](),{'type':dbH[_0x84dd('0x7f')][_0x84dd('0x80')]['SELECT']});}})[_0x84dd('0x27')](function(){return{'sql':_0x15e276[_0x84dd('0x7e')]()};})[_0x84dd('0x27')](respondWithResult(_0x2d1c29,null))[_0x84dd('0x47')](handleError(_0x2d1c29,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5e1f4f6..aa2e96c 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 _0xf01a=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xf01a,0x9b));var _0xaf01=function(_0x4ab2d9,_0x707e21){_0x4ab2d9=_0x4ab2d9-0x0;var _0x16f489=_0xf01a[_0x4ab2d9];return _0x16f489;};'use strict';var _=require(_0xaf01('0x0'));var util=require(_0xaf01('0x1'));var logger=require(_0xaf01('0x2'))(_0xaf01('0x3'));var moment=require(_0xaf01('0x4'));var BPromise=require(_0xaf01('0x5'));var rp=require(_0xaf01('0x6'));var fs=require('fs');var path=require(_0xaf01('0x7'));var rimraf=require(_0xaf01('0x8'));var config=require(_0xaf01('0x9'));var attributes=require(_0xaf01('0xa'));module[_0xaf01('0xb')]=function(_0x4d14b3,_0x179b11){return _0x4d14b3['define'](_0xaf01('0xc'),attributes,{'tableName':_0xaf01('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22bd=['exports','define','AnalyticCustomReport','lodash','util','bluebird','request-promise','path','./analyticCustomReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22bd,0x1aa));var _0xd22b=function(_0x41f278,_0x172157){_0x41f278=_0x41f278-0x0;var _0x57688d=_0x22bd[_0x41f278];return _0x57688d;};'use strict';var _=require(_0xd22b('0x0'));var util=require(_0xd22b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd22b('0x2'));var rp=require(_0xd22b('0x3'));var fs=require('fs');var path=require(_0xd22b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd22b('0x5'));module[_0xd22b('0x6')]=function(_0x30db8c,_0x449de8){return _0x30db8c[_0xd22b('0x7')](_0xd22b('0x8'),attributes,{'tableName':'analytics_custom_reports','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 57890e6..fa44b9c 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 _0x224d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x224d,0xe3));var _0xd224=function(_0x2e0748,_0x55284){_0x2e0748=_0x2e0748-0x0;var _0x15d429=_0x224d[_0x2e0748];return _0x15d429;};'use strict';var _=require(_0xd224('0x0'));var util=require(_0xd224('0x1'));var moment=require(_0xd224('0x2'));var BPromise=require(_0xd224('0x3'));var rs=require(_0xd224('0x4'));var fs=require('fs');var Redis=require(_0xd224('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd224('0x6'));var logger=require(_0xd224('0x7'))(_0xd224('0x8'));var config=require(_0xd224('0x9'));var jayson=require(_0xd224('0xa'));var client=jayson[_0xd224('0xb')][_0xd224('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x327ade,_0x3a73b8,_0x3ab7ec){return new BPromise(function(_0x10f5fd,_0x561153){return client[_0xd224('0xd')](_0x327ade,_0x3ab7ec)[_0xd224('0xe')](function(_0x1c8cfa){logger[_0xd224('0xf')](_0xd224('0x10'),_0x3a73b8,_0xd224('0x11'));logger['debug'](_0xd224('0x12'),_0x3a73b8,_0xd224('0x11'),JSON[_0xd224('0x13')](_0x1c8cfa));if(_0x1c8cfa[_0xd224('0x14')]){if(_0x1c8cfa[_0xd224('0x14')]['code']===0x1f4){logger[_0xd224('0x14')](_0xd224('0x10'),_0x3a73b8,_0x1c8cfa[_0xd224('0x14')][_0xd224('0x15')]);return _0x561153(_0x1c8cfa[_0xd224('0x14')]['message']);}logger[_0xd224('0x14')](_0xd224('0x10'),_0x3a73b8,_0x1c8cfa[_0xd224('0x14')][_0xd224('0x15')]);return _0x10f5fd(_0x1c8cfa[_0xd224('0x14')][_0xd224('0x15')]);}else{logger[_0xd224('0xf')](_0xd224('0x10'),_0x3a73b8,'request\x20sent');_0x10f5fd(_0x1c8cfa['result']['message']);}})[_0xd224('0x16')](function(_0x4a6222){logger['error'](_0xd224('0x10'),_0x3a73b8,_0x4a6222);_0x561153(_0x4a6222);});});} \ No newline at end of file +var _0xa6d8=['lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','AnalyticCustomReport,\x20%s,\x20%s','result'];(function(_0xb41680,_0x39f19c){var _0x56ce27=function(_0x3745e1){while(--_0x3745e1){_0xb41680['push'](_0xb41680['shift']());}};_0x56ce27(++_0x39f19c);}(_0xa6d8,0xd2));var _0x8a6d=function(_0x22a409,_0x1e7083){_0x22a409=_0x22a409-0x0;var _0x4ffcf0=_0xa6d8[_0x22a409];return _0x4ffcf0;};'use strict';var _=require(_0x8a6d('0x0'));var util=require(_0x8a6d('0x1'));var moment=require(_0x8a6d('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a6d('0x3'));var fs=require('fs');var Redis=require(_0x8a6d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8a6d('0x5'))(_0x8a6d('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a6d('0x7'));var client=jayson[_0x8a6d('0x8')][_0x8a6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe06879,_0x11a94c,_0x4d2a83){return new BPromise(function(_0x5dd35f,_0x410f65){return client[_0x8a6d('0xa')](_0xe06879,_0x4d2a83)[_0x8a6d('0xb')](function(_0xc4e7bd){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x11a94c,_0x8a6d('0xc'));logger[_0x8a6d('0xd')](_0x8a6d('0xe'),_0x11a94c,_0x8a6d('0xc'),JSON[_0x8a6d('0xf')](_0xc4e7bd));if(_0xc4e7bd['error']){if(_0xc4e7bd[_0x8a6d('0x10')]['code']===0x1f4){logger[_0x8a6d('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x11a94c,_0xc4e7bd['error']['message']);return _0x410f65(_0xc4e7bd[_0x8a6d('0x10')][_0x8a6d('0x11')]);}logger[_0x8a6d('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x11a94c,_0xc4e7bd[_0x8a6d('0x10')][_0x8a6d('0x11')]);return _0x5dd35f(_0xc4e7bd[_0x8a6d('0x10')]['message']);}else{logger[_0x8a6d('0x12')](_0x8a6d('0x13'),_0x11a94c,'request\x20sent');_0x5dd35f(_0xc4e7bd[_0x8a6d('0x14')]['message']);}})['catch'](function(_0x304dff){logger[_0x8a6d('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x11a94c,_0x304dff);_0x410f65(_0x304dff);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 81e810c..7cea083 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 _0xf602=['create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','run','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf602,0xf9));var _0x2f60=function(_0x313b86,_0x48a1da){_0x313b86=_0x313b86-0x0;var _0x333462=_0xf602[_0x313b86];return _0x333462;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2f60('0x0'));var timeout=require(_0x2f60('0x1'));var express=require(_0x2f60('0x2'));var router=express[_0x2f60('0x3')]();var fs_extra=require(_0x2f60('0x4'));var auth=require(_0x2f60('0x5'));var interaction=require(_0x2f60('0x6'));var config=require('../../config/environment');var controller=require(_0x2f60('0x7'));router[_0x2f60('0x8')]('/',auth[_0x2f60('0x9')](),controller[_0x2f60('0xa')]);router['get']('/:id',auth[_0x2f60('0x9')](),controller[_0x2f60('0xb')]);router[_0x2f60('0x8')](_0x2f60('0xc'),auth[_0x2f60('0x9')](),controller['preview']);router[_0x2f60('0x8')]('/:id/run',auth[_0x2f60('0x9')](),controller[_0x2f60('0xd')]);router[_0x2f60('0x8')]('/:id/query',auth[_0x2f60('0x9')](),controller[_0x2f60('0xe')]);router['post']('/',auth[_0x2f60('0x9')](),controller[_0x2f60('0xf')]);router[_0x2f60('0x10')]('/:id',auth[_0x2f60('0x9')](),controller[_0x2f60('0x11')]);router[_0x2f60('0x12')](_0x2f60('0x13'),auth[_0x2f60('0x9')](),controller[_0x2f60('0x14')]);module[_0x2f60('0x15')]=router; \ No newline at end of file +var _0xc13c=['query','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query'];(function(_0x2b742d,_0x55c8ed){var _0x4bc41e=function(_0x30f8e1){while(--_0x30f8e1){_0x2b742d['push'](_0x2b742d['shift']());}};_0x4bc41e(++_0x55c8ed);}(_0xc13c,0x197));var _0xcc13=function(_0x3e9fdd,_0xb15aec){_0x3e9fdd=_0x3e9fdd-0x0;var _0x483704=_0xc13c[_0x3e9fdd];return _0x483704;};'use strict';var multer=require(_0xcc13('0x0'));var util=require(_0xcc13('0x1'));var path=require(_0xcc13('0x2'));var timeout=require(_0xcc13('0x3'));var express=require(_0xcc13('0x4'));var router=express[_0xcc13('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc13('0x6'));var interaction=require(_0xcc13('0x7'));var config=require(_0xcc13('0x8'));var controller=require(_0xcc13('0x9'));router[_0xcc13('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcc13('0xb'),auth[_0xcc13('0xc')](),controller[_0xcc13('0xd')]);router['get'](_0xcc13('0xe'),auth[_0xcc13('0xc')](),controller[_0xcc13('0xf')]);router[_0xcc13('0xa')](_0xcc13('0x10'),auth[_0xcc13('0xc')](),controller['run']);router[_0xcc13('0xa')](_0xcc13('0x11'),auth[_0xcc13('0xc')](),controller[_0xcc13('0x12')]);router[_0xcc13('0x13')]('/',auth[_0xcc13('0xc')](),controller['create']);router[_0xcc13('0x14')](_0xcc13('0xb'),auth['isAuthenticated'](),controller[_0xcc13('0x15')]);router[_0xcc13('0x16')](_0xcc13('0xb'),auth['isAuthenticated'](),controller[_0xcc13('0x17')]);module[_0xcc13('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a901069..d6828f4 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 _0xda19=['exports','STRING','TEXT'];(function(_0xa4a370,_0x3d1946){var _0x21efa4=function(_0x1783c7){while(--_0x1783c7){_0xa4a370['push'](_0xa4a370['shift']());}};_0x21efa4(++_0x3d1946);}(_0xda19,0xd5));var _0x9da1=function(_0x8821a8,_0x4be205){_0x8821a8=_0x8821a8-0x0;var _0x1e443c=_0xda19[_0x8821a8];return _0x1e443c;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4819=['TEXT','exports','STRING'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x4819,0xcd));var _0x9481=function(_0x4b366e,_0x479e1f){_0x4b366e=_0x4b366e-0x0;var _0x464dff=_0x4819[_0x4b366e];return _0x464dff;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index b9f71fc..884b396 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 _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0xbc9b7f,_0x4cc6f9){var _0x1bd96f=function(_0x4573b9){while(--_0x4573b9){_0xbc9b7f['push'](_0xbc9b7f['shift']());}};_0x1bd96f(++_0x4cc6f9);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x53a963,_0x3079f2){_0x53a963=_0x53a963-0x0;var _0x13fb39=_0x3f8a[_0x53a963];return _0x13fb39;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file +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(_0xaa7b76,_0xbe504f){_0xaa7b76=_0xaa7b76-0x0;var _0x158e48=_0x326f[_0xaa7b76];return _0x158e48;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 49cfdf6..e428237 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 _0x8412=['rimraf','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1fc018,_0x5ea2e6){var _0xdddf7b=function(_0x287a5b){while(--_0x287a5b){_0x1fc018['push'](_0x1fc018['shift']());}};_0xdddf7b(++_0x5ea2e6);}(_0x8412,0xc0));var _0x2841=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x8412[_0x102f97];return _0xd22058;};'use strict';var _=require(_0x2841('0x0'));var util=require(_0x2841('0x1'));var logger=require(_0x2841('0x2'))(_0x2841('0x3'));var moment=require(_0x2841('0x4'));var BPromise=require('bluebird');var rp=require(_0x2841('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2841('0x6'));var config=require('../../config/environment');var attributes=require(_0x2841('0x7'));module[_0x2841('0x8')]=function(_0x51c440,_0x2c1ee7){return _0x51c440['define'](_0x2841('0x9'),attributes,{'tableName':_0x2841('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb9c=['analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','AnalyticDefaultReport'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xbb9c,0x198));var _0xcbb9=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xbb9c[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xcbb9('0x0'));var util=require(_0xcbb9('0x1'));var logger=require(_0xcbb9('0x2'))(_0xcbb9('0x3'));var moment=require('moment');var BPromise=require(_0xcbb9('0x4'));var rp=require(_0xcbb9('0x5'));var fs=require('fs');var path=require(_0xcbb9('0x6'));var rimraf=require(_0xcbb9('0x7'));var config=require(_0xcbb9('0x8'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x1b872c,_0x202037){return _0x1b872c['define'](_0xcbb9('0x9'),attributes,{'tableName':_0xcbb9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 33f8410..35e87c5 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 _0x307b=['client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x42115e,_0x3a3b4d){var _0x221c8e=function(_0x23cf81){while(--_0x23cf81){_0x42115e['push'](_0x42115e['shift']());}};_0x221c8e(++_0x3a3b4d);}(_0x307b,0x156));var _0xb307=function(_0xa10d08,_0xedde0){_0xa10d08=_0xa10d08-0x0;var _0x5b48df=_0x307b[_0xa10d08];return _0x5b48df;};'use strict';var _=require(_0xb307('0x0'));var util=require(_0xb307('0x1'));var moment=require(_0xb307('0x2'));var BPromise=require(_0xb307('0x3'));var rs=require(_0xb307('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb307('0x5'))['db'];var utils=require(_0xb307('0x6'));var logger=require(_0xb307('0x7'))('rpc');var config=require(_0xb307('0x8'));var jayson=require(_0xb307('0x9'));var client=jayson[_0xb307('0xa')][_0xb307('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37f397,_0x484cfa,_0x36c70a){return new BPromise(function(_0x66df32,_0x42517e){return client[_0xb307('0xc')](_0x37f397,_0x36c70a)['then'](function(_0x1db8e1){logger[_0xb307('0xd')](_0xb307('0xe'),_0x484cfa,_0xb307('0xf'));logger[_0xb307('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x484cfa,_0xb307('0xf'),JSON[_0xb307('0x11')](_0x1db8e1));if(_0x1db8e1[_0xb307('0x12')]){if(_0x1db8e1[_0xb307('0x12')][_0xb307('0x13')]===0x1f4){logger[_0xb307('0x12')](_0xb307('0xe'),_0x484cfa,_0x1db8e1['error']['message']);return _0x42517e(_0x1db8e1[_0xb307('0x12')][_0xb307('0x14')]);}logger['error'](_0xb307('0xe'),_0x484cfa,_0x1db8e1[_0xb307('0x12')][_0xb307('0x14')]);return _0x66df32(_0x1db8e1[_0xb307('0x12')][_0xb307('0x14')]);}else{logger[_0xb307('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x484cfa,_0xb307('0xf'));_0x66df32(_0x1db8e1['result'][_0xb307('0x14')]);}})[_0xb307('0x15')](function(_0x5c946a){logger[_0xb307('0x12')](_0xb307('0xe'),_0x484cfa,_0x5c946a);_0x42517e(_0x5c946a);});});} \ No newline at end of file +var _0x147f=['util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x476839,_0x51dbad){var _0x220636=function(_0x556762){while(--_0x556762){_0x476839['push'](_0x476839['shift']());}};_0x220636(++_0x51dbad);}(_0x147f,0xa7));var _0xf147=function(_0x8a0ed3,_0x23981b){_0x8a0ed3=_0x8a0ed3-0x0;var _0x561cf2=_0x147f[_0x8a0ed3];return _0x561cf2;};'use strict';var _=require(_0xf147('0x0'));var util=require(_0xf147('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf147('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf147('0x3'));var logger=require(_0xf147('0x4'))(_0xf147('0x5'));var config=require(_0xf147('0x6'));var jayson=require(_0xf147('0x7'));var client=jayson[_0xf147('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3c17,_0x4ad92f,_0x8626c9){return new BPromise(function(_0xd9e60f,_0x17e0cf){return client[_0xf147('0x9')](_0x1f3c17,_0x8626c9)[_0xf147('0xa')](function(_0x61e491){logger[_0xf147('0xb')](_0xf147('0xc'),_0x4ad92f,_0xf147('0xd'));logger[_0xf147('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4ad92f,_0xf147('0xd'),JSON[_0xf147('0xf')](_0x61e491));if(_0x61e491[_0xf147('0x10')]){if(_0x61e491[_0xf147('0x10')][_0xf147('0x11')]===0x1f4){logger['error'](_0xf147('0xc'),_0x4ad92f,_0x61e491[_0xf147('0x10')][_0xf147('0x12')]);return _0x17e0cf(_0x61e491[_0xf147('0x10')][_0xf147('0x12')]);}logger[_0xf147('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4ad92f,_0x61e491['error'][_0xf147('0x12')]);return _0xd9e60f(_0x61e491[_0xf147('0x10')][_0xf147('0x12')]);}else{logger[_0xf147('0xb')](_0xf147('0xc'),_0x4ad92f,_0xf147('0xd'));_0xd9e60f(_0x61e491[_0xf147('0x13')][_0xf147('0x12')]);}})[_0xf147('0x14')](function(_0x1b2bfe){logger['error'](_0xf147('0xc'),_0x4ad92f,_0x1b2bfe);_0x17e0cf(_0x1b2bfe);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 23e9b52..44e840f 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 _0xf433=['isAuthenticated','show','preview','/:id/run','/:id/query','create','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id'];(function(_0xbed931,_0x4fab0b){var _0x1ea640=function(_0x56a48d){while(--_0x56a48d){_0xbed931['push'](_0xbed931['shift']());}};_0x1ea640(++_0x4fab0b);}(_0xf433,0x198));var _0x3f43=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf433[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x3f43('0x0'));var path=require(_0x3f43('0x1'));var timeout=require(_0x3f43('0x2'));var express=require(_0x3f43('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3f43('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f43('0x5'));var controller=require(_0x3f43('0x6'));router[_0x3f43('0x7')]('/',auth['isAuthenticated'](),controller[_0x3f43('0x8')]);router['get'](_0x3f43('0x9'),auth[_0x3f43('0xa')](),controller[_0x3f43('0xb')]);router[_0x3f43('0x7')]('/:id/preview',auth[_0x3f43('0xa')](),controller[_0x3f43('0xc')]);router[_0x3f43('0x7')](_0x3f43('0xd'),auth[_0x3f43('0xa')](),controller['run']);router[_0x3f43('0x7')](_0x3f43('0xe'),auth[_0x3f43('0xa')](),controller['query']);router['post']('/',auth[_0x3f43('0xa')](),controller[_0x3f43('0xf')]);router['put']('/:id',auth[_0x3f43('0xa')](),controller[_0x3f43('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3f43('0x11')]);module[_0x3f43('0x12')]=router; \ No newline at end of file +var _0x278b=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','/:id','update','delete'];(function(_0x12a01a,_0x3937db){var _0x131ebe=function(_0x292b7a){while(--_0x292b7a){_0x12a01a['push'](_0x12a01a['shift']());}};_0x131ebe(++_0x3937db);}(_0x278b,0xec));var _0xb278=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x278b[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require('multer');var util=require(_0xb278('0x0'));var path=require(_0xb278('0x1'));var timeout=require(_0xb278('0x2'));var express=require(_0xb278('0x3'));var router=express[_0xb278('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb278('0x5'));var interaction=require(_0xb278('0x6'));var config=require(_0xb278('0x7'));var controller=require(_0xb278('0x8'));router['get']('/',auth[_0xb278('0x9')](),controller[_0xb278('0xa')]);router[_0xb278('0xb')]('/:id',auth[_0xb278('0x9')](),controller[_0xb278('0xc')]);router[_0xb278('0xb')](_0xb278('0xd'),auth[_0xb278('0x9')](),controller[_0xb278('0xe')]);router[_0xb278('0xb')](_0xb278('0xf'),auth[_0xb278('0x9')](),controller[_0xb278('0x10')]);router['get'](_0xb278('0x11'),auth[_0xb278('0x9')](),controller[_0xb278('0x12')]);router['post']('/',auth[_0xb278('0x9')](),controller[_0xb278('0x13')]);router[_0xb278('0x14')](_0xb278('0x15'),auth['isAuthenticated'](),controller[_0xb278('0x16')]);router[_0xb278('0x17')]('/:id',auth[_0xb278('0x9')](),controller[_0xb278('0x18')]);module[_0xb278('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 744ca2b..fb818e7 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 _0x2369=['STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports'];(function(_0x462b4f,_0x2f1c0e){var _0x24f643=function(_0x3cc960){while(--_0x3cc960){_0x462b4f['push'](_0x462b4f['shift']());}};_0x24f643(++_0x2f1c0e);}(_0x2369,0xb3));var _0x9236=function(_0xb60a95,_0xdb478f){_0xb60a95=_0xb60a95-0x0;var _0x2c876c=_0x2369[_0xb60a95];return _0x2c876c;};'use strict';var Sequelize=require(_0x9236('0x0'));var moment=require(_0x9236('0x1'));module[_0x9236('0x2')]={'name':{'type':Sequelize[_0x9236('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x9236('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x9236('0x4')]('csv',_0x9236('0x5'),_0x9236('0x6')),'allowNull':![],'defaultValue':_0x9236('0x7')},'savename':{'type':Sequelize[_0x9236('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9236('0x8')]},'endDate':{'type':Sequelize[_0x9236('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x9236('0x9')},'type':{'type':Sequelize[_0x9236('0x4')](_0x9236('0xa'),_0x9236('0xb')),'allowNull':![],'defaultValue':_0x9236('0xa')},'reportId':{'type':Sequelize[_0x9236('0xc')](0xb)[_0x9236('0xd')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41e8=['ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x3e0136,_0x43cb63){var _0x4f9b41=function(_0x29fa9b){while(--_0x29fa9b){_0x3e0136['push'](_0x3e0136['shift']());}};_0x4f9b41(++_0x43cb63);}(_0x41e8,0x106));var _0x841e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x41e8[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x841e('0x0'));var moment=require(_0x841e('0x1'));module[_0x841e('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x841e('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x841e('0x4')]('csv',_0x841e('0x5'),_0x841e('0x6')),'allowNull':![],'defaultValue':_0x841e('0x7')},'savename':{'type':Sequelize[_0x841e('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x841e('0x8')]},'endDate':{'type':Sequelize[_0x841e('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x841e('0x9')},'type':{'type':Sequelize[_0x841e('0x4')](_0x841e('0xa'),_0x841e('0xb')),'allowNull':![],'defaultValue':_0x841e('0xa')},'reportId':{'type':Sequelize[_0x841e('0xc')](0xb)[_0x841e('0xd')]},'reportType':{'type':Sequelize[_0x841e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 518971d..8123ab3 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 _0x6fa0=['join','format','%s.%s','toLowerCase','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../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','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','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','download','basename','savename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists'];(function(_0x5adee8,_0x2c4f67){var _0x473002=function(_0xad680d){while(--_0xad680d){_0x5adee8['push'](_0x5adee8['shift']());}};_0x473002(++_0x2c4f67);}(_0x6fa0,0x1ee));var _0x06fa=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6fa0[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x06fa('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06fa('0x1'));var moment=require('moment');var BPromise=require(_0x06fa('0x2'));var Mustache=require(_0x06fa('0x3'));var util=require(_0x06fa('0x4'));var path=require(_0x06fa('0x5'));var sox=require('sox');var csv=require(_0x06fa('0x6'));var ejs=require(_0x06fa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06fa('0x8'));var squel=require(_0x06fa('0x9'));var crypto=require(_0x06fa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x06fa('0xb'));var toCsv=require('to-csv');var querystring=require(_0x06fa('0xc'));var Papa=require(_0x06fa('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x06fa('0xe'));var as=require(_0x06fa('0xf'));var hardwareService=require(_0x06fa('0x10'));var logger=require(_0x06fa('0x11'))(_0x06fa('0x12'));var utils=require(_0x06fa('0x13'));var config=require(_0x06fa('0x14'));var licenseUtil=require(_0x06fa('0x15'));var db=require(_0x06fa('0x16'))['db'];function respondWithStatusCode(_0xc20a2d,_0x1fb792){_0x1fb792=_0x1fb792||0xcc;return function(_0x3753dd){if(_0x3753dd){return _0xc20a2d[_0x06fa('0x17')](_0x1fb792);}return _0xc20a2d[_0x06fa('0x18')](_0x1fb792)[_0x06fa('0x19')]();};}function respondWithResult(_0xc5b318,_0x520a6f){_0x520a6f=_0x520a6f||0xc8;return function(_0x4ee1de){if(_0x4ee1de){return _0xc5b318[_0x06fa('0x18')](_0x520a6f)[_0x06fa('0x1a')](_0x4ee1de);}};}function respondWithFilteredResult(_0x41c270,_0x3aaf46){return function(_0x24982d){if(_0x24982d){var _0x533cfd=typeof _0x3aaf46['offset']===_0x06fa('0x1b')&&typeof _0x3aaf46[_0x06fa('0x1c')]===_0x06fa('0x1b');var _0x430207=_0x24982d[_0x06fa('0x1d')];var _0x4060ee=_0x533cfd?0x0:_0x3aaf46[_0x06fa('0x1e')];var _0x3d776c=_0x533cfd?_0x24982d[_0x06fa('0x1d')]:_0x3aaf46[_0x06fa('0x1e')]+_0x3aaf46[_0x06fa('0x1c')];var _0x584045;if(_0x3d776c>=_0x430207){_0x3d776c=_0x430207;_0x584045=0xc8;}else{_0x584045=0xce;}_0x41c270[_0x06fa('0x18')](_0x584045);return _0x41c270[_0x06fa('0x1f')](_0x06fa('0x20'),_0x4060ee+'-'+_0x3d776c+'/'+_0x430207)[_0x06fa('0x1a')](_0x24982d);}return null;};}function patchUpdates(_0x16ad82){return function(_0xfd37c8){try{jsonpatch['apply'](_0xfd37c8,_0x16ad82,!![]);}catch(_0x55d183){return BPromise[_0x06fa('0x21')](_0x55d183);}return _0xfd37c8[_0x06fa('0x22')]();};}function saveUpdates(_0x6ae0be,_0x6f70f8){return function(_0x4763f3){if(_0x4763f3){return _0x4763f3[_0x06fa('0x23')](_0x6ae0be)[_0x06fa('0x24')](function(_0x19faab){return _0x19faab;});}return null;};}function removeEntity(_0x1c1237,_0x149535){return function(_0xd66468){if(_0xd66468){return _0xd66468[_0x06fa('0x25')]()['then'](function(){var _0x308e1d=_0xd66468[_0x06fa('0x26')]({'plain':!![]});var _0x1ebfee=_0x06fa('0x27');return db[_0x06fa('0x28')][_0x06fa('0x25')]({'where':{'type':_0x1ebfee,'resourceId':_0x308e1d['id']}})[_0x06fa('0x24')](function(){return _0xd66468;});})['then'](function(){_0x1c1237['status'](0xcc)[_0x06fa('0x19')]();});}};}function handleEntityNotFound(_0x25bb7d,_0x18081d){return function(_0x5ba5a8){if(!_0x5ba5a8){_0x25bb7d[_0x06fa('0x17')](0x194);}return _0x5ba5a8;};}function handleError(_0x28514f,_0x58c3a3){_0x58c3a3=_0x58c3a3||0x1f4;return function(_0x1d4ab7){logger[_0x06fa('0x29')](_0x1d4ab7[_0x06fa('0x2a')]);if(_0x1d4ab7['name']){delete _0x1d4ab7[_0x06fa('0x2b')];}_0x28514f[_0x06fa('0x18')](_0x58c3a3)[_0x06fa('0x2c')](_0x1d4ab7);};}exports[_0x06fa('0x2d')]=function(_0x3f6f3e,_0x111f7d){var _0xaaae98={},_0x7b88a3={},_0x1cecc2={'count':0x0,'rows':[]};var _0x390d82=_[_0x06fa('0x2e')](db[_0x06fa('0x2f')][_0x06fa('0x30')],function(_0x3c45a0){return{'name':_0x3c45a0[_0x06fa('0x31')],'type':_0x3c45a0[_0x06fa('0x32')][_0x06fa('0x33')]};});_0x7b88a3[_0x06fa('0x34')]=_[_0x06fa('0x2e')](_0x390d82,_0x06fa('0x2b'));_0x7b88a3['query']=_[_0x06fa('0x35')](_0x3f6f3e[_0x06fa('0x36')]);_0x7b88a3[_0x06fa('0x37')]=_[_0x06fa('0x38')](_0x7b88a3[_0x06fa('0x34')],_0x7b88a3[_0x06fa('0x36')]);_0xaaae98[_0x06fa('0x39')]=_[_0x06fa('0x38')](_0x7b88a3['model'],qs[_0x06fa('0x3a')](_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x3a')]));_0xaaae98[_0x06fa('0x39')]=_0xaaae98[_0x06fa('0x39')][_0x06fa('0x3b')]?_0xaaae98[_0x06fa('0x39')]:_0x7b88a3[_0x06fa('0x34')];if(!_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x3c')](_0x06fa('0x3d'))){_0xaaae98['limit']=qs[_0x06fa('0x1c')](_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x1c')]);_0xaaae98[_0x06fa('0x1e')]=qs[_0x06fa('0x1e')](_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x1e')]);}_0xaaae98[_0x06fa('0x3e')]=qs[_0x06fa('0x3f')](_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x3f')]);_0xaaae98[_0x06fa('0x40')]=qs['filters'](_[_0x06fa('0x41')](_0x3f6f3e['query'],_0x7b88a3[_0x06fa('0x37')]),_0x390d82);if(_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x42')]){_0xaaae98[_0x06fa('0x40')]=_[_0x06fa('0x43')](_0xaaae98['where'],{'$or':_[_0x06fa('0x2e')](_0x390d82,function(_0x114001){if(_0x114001['type']!==_0x06fa('0x44')){var _0x225ee2={};_0x225ee2[_0x114001[_0x06fa('0x2b')]]={'$like':'%'+_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x42')]+'%'};return _0x225ee2;}})});}_0xaaae98=_['merge']({},_0xaaae98,_0x3f6f3e[_0x06fa('0x45')]);var _0x32f1b4={'where':_0xaaae98[_0x06fa('0x40')]};return db[_0x06fa('0x2f')][_0x06fa('0x1d')](_0x32f1b4)[_0x06fa('0x24')](function(_0x5ac314){_0x1cecc2[_0x06fa('0x1d')]=_0x5ac314;if(_0x3f6f3e[_0x06fa('0x36')][_0x06fa('0x46')]){_0xaaae98['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x06fa('0x47')](_0xaaae98);})['then'](function(_0x23158b){_0x1cecc2['rows']=_0x23158b;return _0x1cecc2;})[_0x06fa('0x24')](respondWithFilteredResult(_0x111f7d,_0xaaae98))[_0x06fa('0x48')](handleError(_0x111f7d,null));};exports['show']=function(_0x4d278f,_0x2b4759){var _0x1cc43d={'raw':!![],'where':{'id':_0x4d278f[_0x06fa('0x49')]['id']}},_0x441ba9={};_0x441ba9[_0x06fa('0x34')]=_[_0x06fa('0x35')](db['AnalyticExtractedReport']['rawAttributes']);_0x441ba9[_0x06fa('0x36')]=_['keys'](_0x4d278f[_0x06fa('0x36')]);_0x441ba9[_0x06fa('0x37')]=_[_0x06fa('0x38')](_0x441ba9['model'],_0x441ba9[_0x06fa('0x36')]);_0x1cc43d[_0x06fa('0x39')]=_[_0x06fa('0x38')](_0x441ba9[_0x06fa('0x34')],qs[_0x06fa('0x3a')](_0x4d278f[_0x06fa('0x36')][_0x06fa('0x3a')]));_0x1cc43d[_0x06fa('0x39')]=_0x1cc43d[_0x06fa('0x39')][_0x06fa('0x3b')]?_0x1cc43d['attributes']:_0x441ba9[_0x06fa('0x34')];if(_0x4d278f['query'][_0x06fa('0x46')]){_0x1cc43d['include']=[{'all':!![]}];}_0x1cc43d=_[_0x06fa('0x43')]({},_0x1cc43d,_0x4d278f['options']);return db[_0x06fa('0x2f')][_0x06fa('0x4a')](_0x1cc43d)[_0x06fa('0x24')](handleEntityNotFound(_0x2b4759,null))[_0x06fa('0x24')](respondWithResult(_0x2b4759,null))[_0x06fa('0x48')](handleError(_0x2b4759,null));};exports['create']=function(_0x172a55,_0x43bb87){return db[_0x06fa('0x2f')][_0x06fa('0x4b')](_0x172a55[_0x06fa('0x4c')],{})[_0x06fa('0x24')](function(_0x5d0f03){var _0x328d0a=_0x172a55[_0x06fa('0x4d')][_0x06fa('0x26')]({'plain':!![]});if(!_0x328d0a)throw new Error(_0x06fa('0x4e'));if(_0x328d0a[_0x06fa('0x4f')]===_0x06fa('0x4d')){var _0x4b5096=_0x5d0f03[_0x06fa('0x26')]({'plain':!![]});var _0x17f5af=_0x06fa('0x27');return db[_0x06fa('0x50')][_0x06fa('0x4a')]({'where':{'name':_0x17f5af,'userProfileId':_0x328d0a[_0x06fa('0x51')]},'raw':!![]})['then'](function(_0x3be817){if(_0x3be817&&_0x3be817[_0x06fa('0x52')]===0x0){return db['UserProfileResource'][_0x06fa('0x4b')]({'name':_0x4b5096[_0x06fa('0x2b')],'resourceId':_0x4b5096['id'],'type':_0x3be817['name'],'sectionId':_0x3be817['id']},{})[_0x06fa('0x24')](function(){return _0x5d0f03;});}else{return _0x5d0f03;}})['catch'](function(_0x4ce17e){logger[_0x06fa('0x29')](_0x06fa('0x53'),_0x4ce17e);throw _0x4ce17e;});}return _0x5d0f03;})[_0x06fa('0x24')](respondWithResult(_0x43bb87,0xc9))[_0x06fa('0x48')](handleError(_0x43bb87,null));};exports[_0x06fa('0x23')]=function(_0x185f9f,_0x42dbfd){if(_0x185f9f[_0x06fa('0x4c')]['id']){delete _0x185f9f[_0x06fa('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0x06fa('0x4a')]({'where':{'id':_0x185f9f[_0x06fa('0x49')]['id']}})['then'](handleEntityNotFound(_0x42dbfd,null))['then'](saveUpdates(_0x185f9f['body'],null))['then'](respondWithResult(_0x42dbfd,null))[_0x06fa('0x48')](handleError(_0x42dbfd,null));};exports[_0x06fa('0x25')]=function(_0x243e45,_0x57a430){return db['AnalyticExtractedReport'][_0x06fa('0x4a')]({'where':{'id':_0x243e45['params']['id']}})[_0x06fa('0x24')](handleEntityNotFound(_0x57a430,null))['then'](removeEntity(_0x57a430,null))['catch'](handleError(_0x57a430,null));};exports[_0x06fa('0x54')]=function(_0x2787c4,_0x1f602a,_0x2f7b71){return db[_0x06fa('0x2f')]['find']({'where':{'id':_0x2787c4['params']['id']},'attributes':['name',_0x06fa('0x55'),_0x06fa('0x56'),_0x06fa('0x57')],'raw':!![]})[_0x06fa('0x24')](handleEntityNotFound(_0x1f602a,null))[_0x06fa('0x24')](function(_0x237694){if(_0x237694){if(!fs[_0x06fa('0x58')](path['join'](config[_0x06fa('0x59')],_0x06fa('0x5a'),_0x237694[_0x06fa('0x56')]))){throw new db['Sequelize'][(_0x06fa('0x5b'))](_0x06fa('0x5c'));}if(_0x2787c4[_0x06fa('0x36')][_0x06fa('0x5d')]){return _0x1f602a[_0x06fa('0x17')](0xc8);}return _0x1f602a[_0x06fa('0x54')](path[_0x06fa('0x5e')](config[_0x06fa('0x59')],'server/files/reports',_0x237694[_0x06fa('0x56')]),util[_0x06fa('0x5f')](_0x06fa('0x60'),_0x237694[_0x06fa('0x55')]||_0x237694[_0x06fa('0x2b')],_0x237694['output'][_0x06fa('0x61')]()));}})[_0x06fa('0x48')](handleError(_0x1f602a,null));}; \ No newline at end of file +var _0xc64c=['apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','join','root','format','%s.%s','output','toLowerCase','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc64c,0x9f));var _0xcc64=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xc64c[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc64('0x0'));var moment=require(_0xcc64('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xcc64('0x2'));var util=require(_0xcc64('0x3'));var path=require(_0xcc64('0x4'));var sox=require(_0xcc64('0x5'));var csv=require('to-csv');var ejs=require(_0xcc64('0x6'));var fs=require('fs');var fs_extra=require(_0xcc64('0x7'));var _=require(_0xcc64('0x8'));var squel=require(_0xcc64('0x9'));var crypto=require('crypto');var jsforce=require(_0xcc64('0xa'));var deskjs=require(_0xcc64('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcc64('0xc'));var Papa=require(_0xcc64('0xd'));var Redis=require('ioredis');var authService=require(_0xcc64('0xe'));var qs=require(_0xcc64('0xf'));var as=require(_0xcc64('0x10'));var hardwareService=require(_0xcc64('0x11'));var logger=require(_0xcc64('0x12'))(_0xcc64('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc64('0x14'));var db=require(_0xcc64('0x15'))['db'];function respondWithStatusCode(_0x20eff1,_0x49bd09){_0x49bd09=_0x49bd09||0xcc;return function(_0x1dd770){if(_0x1dd770){return _0x20eff1[_0xcc64('0x16')](_0x49bd09);}return _0x20eff1[_0xcc64('0x17')](_0x49bd09)['end']();};}function respondWithResult(_0x154390,_0x189040){_0x189040=_0x189040||0xc8;return function(_0x5e3642){if(_0x5e3642){return _0x154390[_0xcc64('0x17')](_0x189040)['json'](_0x5e3642);}};}function respondWithFilteredResult(_0x2e36e1,_0x576f22){return function(_0x288e20){if(_0x288e20){var _0x434a69=typeof _0x576f22['offset']===_0xcc64('0x18')&&typeof _0x576f22[_0xcc64('0x19')]===_0xcc64('0x18');var _0x50130f=_0x288e20[_0xcc64('0x1a')];var _0x2d4467=_0x434a69?0x0:_0x576f22['offset'];var _0x679904=_0x434a69?_0x288e20['count']:_0x576f22[_0xcc64('0x1b')]+_0x576f22[_0xcc64('0x19')];var _0x54cf1b;if(_0x679904>=_0x50130f){_0x679904=_0x50130f;_0x54cf1b=0xc8;}else{_0x54cf1b=0xce;}_0x2e36e1['status'](_0x54cf1b);return _0x2e36e1[_0xcc64('0x1c')](_0xcc64('0x1d'),_0x2d4467+'-'+_0x679904+'/'+_0x50130f)[_0xcc64('0x1e')](_0x288e20);}return null;};}function patchUpdates(_0x4d5e47){return function(_0x36be91){try{jsonpatch[_0xcc64('0x1f')](_0x36be91,_0x4d5e47,!![]);}catch(_0x43ce25){return BPromise[_0xcc64('0x20')](_0x43ce25);}return _0x36be91[_0xcc64('0x21')]();};}function saveUpdates(_0x59d109,_0x1d551d){return function(_0x3a9df6){if(_0x3a9df6){return _0x3a9df6[_0xcc64('0x22')](_0x59d109)[_0xcc64('0x23')](function(_0x1d37e5){return _0x1d37e5;});}return null;};}function removeEntity(_0x868c6c,_0x5d9835){return function(_0x455df6){if(_0x455df6){return _0x455df6[_0xcc64('0x24')]()['then'](function(){var _0x34dd35=_0x455df6[_0xcc64('0x25')]({'plain':!![]});var _0x41b552=_0xcc64('0x26');return db[_0xcc64('0x27')][_0xcc64('0x24')]({'where':{'type':_0x41b552,'resourceId':_0x34dd35['id']}})['then'](function(){return _0x455df6;});})[_0xcc64('0x23')](function(){_0x868c6c[_0xcc64('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x131acc,_0x342add){return function(_0x3ba3b3){if(!_0x3ba3b3){_0x131acc['sendStatus'](0x194);}return _0x3ba3b3;};}function handleError(_0x247b06,_0x2e3ebc){_0x2e3ebc=_0x2e3ebc||0x1f4;return function(_0x4bf17c){logger['error'](_0x4bf17c[_0xcc64('0x28')]);if(_0x4bf17c['name']){delete _0x4bf17c[_0xcc64('0x29')];}_0x247b06[_0xcc64('0x17')](_0x2e3ebc)[_0xcc64('0x2a')](_0x4bf17c);};}exports[_0xcc64('0x2b')]=function(_0x347db5,_0x5d1cea){var _0x3e2188={},_0xdf4b1a={},_0xde3ffe={'count':0x0,'rows':[]};var _0x120a3a=_[_0xcc64('0x2c')](db[_0xcc64('0x2d')][_0xcc64('0x2e')],function(_0x5ea920){return{'name':_0x5ea920[_0xcc64('0x2f')],'type':_0x5ea920[_0xcc64('0x30')]['key']};});_0xdf4b1a[_0xcc64('0x31')]=_[_0xcc64('0x2c')](_0x120a3a,_0xcc64('0x29'));_0xdf4b1a['query']=_[_0xcc64('0x32')](_0x347db5[_0xcc64('0x33')]);_0xdf4b1a[_0xcc64('0x34')]=_[_0xcc64('0x35')](_0xdf4b1a[_0xcc64('0x31')],_0xdf4b1a['query']);_0x3e2188[_0xcc64('0x36')]=_[_0xcc64('0x35')](_0xdf4b1a[_0xcc64('0x31')],qs[_0xcc64('0x37')](_0x347db5[_0xcc64('0x33')][_0xcc64('0x37')]));_0x3e2188[_0xcc64('0x36')]=_0x3e2188[_0xcc64('0x36')][_0xcc64('0x38')]?_0x3e2188['attributes']:_0xdf4b1a[_0xcc64('0x31')];if(!_0x347db5[_0xcc64('0x33')][_0xcc64('0x39')](_0xcc64('0x3a'))){_0x3e2188['limit']=qs[_0xcc64('0x19')](_0x347db5[_0xcc64('0x33')]['limit']);_0x3e2188[_0xcc64('0x1b')]=qs[_0xcc64('0x1b')](_0x347db5['query'][_0xcc64('0x1b')]);}_0x3e2188[_0xcc64('0x3b')]=qs[_0xcc64('0x3c')](_0x347db5[_0xcc64('0x33')]['sort']);_0x3e2188['where']=qs[_0xcc64('0x34')](_['pick'](_0x347db5['query'],_0xdf4b1a[_0xcc64('0x34')]),_0x120a3a);if(_0x347db5[_0xcc64('0x33')][_0xcc64('0x3d')]){_0x3e2188['where']=_['merge'](_0x3e2188[_0xcc64('0x3e')],{'$or':_[_0xcc64('0x2c')](_0x120a3a,function(_0x519a2e){if(_0x519a2e[_0xcc64('0x30')]!==_0xcc64('0x3f')){var _0x23a440={};_0x23a440[_0x519a2e[_0xcc64('0x29')]]={'$like':'%'+_0x347db5[_0xcc64('0x33')][_0xcc64('0x3d')]+'%'};return _0x23a440;}})});}_0x3e2188=_['merge']({},_0x3e2188,_0x347db5['options']);var _0x1bf37f={'where':_0x3e2188[_0xcc64('0x3e')]};return db[_0xcc64('0x2d')]['count'](_0x1bf37f)[_0xcc64('0x23')](function(_0x43fbf6){_0xde3ffe[_0xcc64('0x1a')]=_0x43fbf6;if(_0x347db5[_0xcc64('0x33')][_0xcc64('0x40')]){_0x3e2188[_0xcc64('0x41')]=[{'all':!![]}];}return db[_0xcc64('0x2d')]['findAll'](_0x3e2188);})['then'](function(_0x41a32b){_0xde3ffe[_0xcc64('0x42')]=_0x41a32b;return _0xde3ffe;})[_0xcc64('0x23')](respondWithFilteredResult(_0x5d1cea,_0x3e2188))[_0xcc64('0x43')](handleError(_0x5d1cea,null));};exports['show']=function(_0xc4782a,_0x1de3d9){var _0x2f2ca7={'raw':!![],'where':{'id':_0xc4782a[_0xcc64('0x44')]['id']}},_0x6180aa={};_0x6180aa[_0xcc64('0x31')]=_[_0xcc64('0x32')](db[_0xcc64('0x2d')][_0xcc64('0x2e')]);_0x6180aa[_0xcc64('0x33')]=_[_0xcc64('0x32')](_0xc4782a['query']);_0x6180aa[_0xcc64('0x34')]=_[_0xcc64('0x35')](_0x6180aa[_0xcc64('0x31')],_0x6180aa[_0xcc64('0x33')]);_0x2f2ca7['attributes']=_[_0xcc64('0x35')](_0x6180aa[_0xcc64('0x31')],qs[_0xcc64('0x37')](_0xc4782a['query']['fields']));_0x2f2ca7[_0xcc64('0x36')]=_0x2f2ca7['attributes'][_0xcc64('0x38')]?_0x2f2ca7[_0xcc64('0x36')]:_0x6180aa[_0xcc64('0x31')];if(_0xc4782a[_0xcc64('0x33')][_0xcc64('0x40')]){_0x2f2ca7[_0xcc64('0x41')]=[{'all':!![]}];}_0x2f2ca7=_['merge']({},_0x2f2ca7,_0xc4782a[_0xcc64('0x45')]);return db[_0xcc64('0x2d')][_0xcc64('0x46')](_0x2f2ca7)[_0xcc64('0x23')](handleEntityNotFound(_0x1de3d9,null))[_0xcc64('0x23')](respondWithResult(_0x1de3d9,null))[_0xcc64('0x43')](handleError(_0x1de3d9,null));};exports[_0xcc64('0x47')]=function(_0x402c0e,_0x2c9fe4){return db[_0xcc64('0x2d')][_0xcc64('0x47')](_0x402c0e[_0xcc64('0x48')],{})[_0xcc64('0x23')](function(_0x28471d){var _0x3defc7=_0x402c0e[_0xcc64('0x49')][_0xcc64('0x25')]({'plain':!![]});if(!_0x3defc7)throw new Error(_0xcc64('0x4a'));if(_0x3defc7[_0xcc64('0x4b')]===_0xcc64('0x49')){var _0x2325a6=_0x28471d[_0xcc64('0x25')]({'plain':!![]});var _0x150e22=_0xcc64('0x26');return db[_0xcc64('0x4c')][_0xcc64('0x46')]({'where':{'name':_0x150e22,'userProfileId':_0x3defc7[_0xcc64('0x4d')]},'raw':!![]})[_0xcc64('0x23')](function(_0x26ab07){if(_0x26ab07&&_0x26ab07[_0xcc64('0x4e')]===0x0){return db[_0xcc64('0x27')][_0xcc64('0x47')]({'name':_0x2325a6[_0xcc64('0x29')],'resourceId':_0x2325a6['id'],'type':_0x26ab07[_0xcc64('0x29')],'sectionId':_0x26ab07['id']},{})[_0xcc64('0x23')](function(){return _0x28471d;});}else{return _0x28471d;}})['catch'](function(_0x13fd87){logger[_0xcc64('0x4f')](_0xcc64('0x50'),_0x13fd87);throw _0x13fd87;});}return _0x28471d;})[_0xcc64('0x23')](respondWithResult(_0x2c9fe4,0xc9))[_0xcc64('0x43')](handleError(_0x2c9fe4,null));};exports[_0xcc64('0x22')]=function(_0xf86724,_0x3def5e){if(_0xf86724['body']['id']){delete _0xf86724[_0xcc64('0x48')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0xf86724[_0xcc64('0x44')]['id']}})[_0xcc64('0x23')](handleEntityNotFound(_0x3def5e,null))[_0xcc64('0x23')](saveUpdates(_0xf86724[_0xcc64('0x48')],null))[_0xcc64('0x23')](respondWithResult(_0x3def5e,null))[_0xcc64('0x43')](handleError(_0x3def5e,null));};exports['destroy']=function(_0x4b83c7,_0x76eed2){return db['AnalyticExtractedReport'][_0xcc64('0x46')]({'where':{'id':_0x4b83c7[_0xcc64('0x44')]['id']}})[_0xcc64('0x23')](handleEntityNotFound(_0x76eed2,null))['then'](removeEntity(_0x76eed2,null))[_0xcc64('0x43')](handleError(_0x76eed2,null));};exports['download']=function(_0x30c43e,_0x4348d1,_0x43aa75){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x30c43e[_0xcc64('0x44')]['id']},'attributes':[_0xcc64('0x29'),_0xcc64('0x51'),_0xcc64('0x52'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x4348d1,null))[_0xcc64('0x23')](function(_0xb867e1){if(_0xb867e1){if(!fs[_0xcc64('0x53')](path['join'](config['root'],_0xcc64('0x54'),_0xb867e1[_0xcc64('0x52')]))){throw new db[(_0xcc64('0x55'))][(_0xcc64('0x56'))](_0xcc64('0x57'));}if(_0x30c43e[_0xcc64('0x33')]['exists']){return _0x4348d1[_0xcc64('0x16')](0xc8);}return _0x4348d1[_0xcc64('0x58')](path[_0xcc64('0x59')](config[_0xcc64('0x5a')],_0xcc64('0x54'),_0xb867e1['savename']),util[_0xcc64('0x5b')](_0xcc64('0x5c'),_0xb867e1[_0xcc64('0x51')]||_0xb867e1['name'],_0xb867e1[_0xcc64('0x5d')][_0xcc64('0x5e')]()));}})[_0xcc64('0x43')](handleError(_0x4348d1,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 11842ec..c4ba7a5 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 _0xce07=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0xce07,0x166));var _0x7ce0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xce07[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x7ce0('0x0'));var util=require(_0x7ce0('0x1'));var logger=require(_0x7ce0('0x2'))(_0x7ce0('0x3'));var moment=require('moment');var BPromise=require(_0x7ce0('0x4'));var rp=require(_0x7ce0('0x5'));var fs=require('fs');var path=require(_0x7ce0('0x6'));var rimraf=require(_0x7ce0('0x7'));var config=require(_0x7ce0('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x7ce0('0x9')]=function(_0x592283,_0x62f999){return _0x592283['define'](_0x7ce0('0xa'),attributes,{'tableName':_0x7ce0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd32=['AnalyticExtractedReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','define'];(function(_0x154b19,_0x21e4cf){var _0x10f433=function(_0x44e746){while(--_0x44e746){_0x154b19['push'](_0x154b19['shift']());}};_0x10f433(++_0x21e4cf);}(_0xcd32,0xe5));var _0x2cd3=function(_0x4df274,_0x413c22){_0x4df274=_0x4df274-0x0;var _0x41d37b=_0xcd32[_0x4df274];return _0x41d37b;};'use strict';var _=require(_0x2cd3('0x0'));var util=require(_0x2cd3('0x1'));var logger=require('../../config/logger')(_0x2cd3('0x2'));var moment=require(_0x2cd3('0x3'));var BPromise=require(_0x2cd3('0x4'));var rp=require(_0x2cd3('0x5'));var fs=require('fs');var path=require(_0x2cd3('0x6'));var rimraf=require(_0x2cd3('0x7'));var config=require('../../config/environment');var attributes=require(_0x2cd3('0x8'));module[_0x2cd3('0x9')]=function(_0x27a260,_0x36945d){return _0x27a260[_0x2cd3('0xa')](_0x2cd3('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 09aca32..7ec316c 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 _0x47fe=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x54f01a,_0x12e01c){var _0x4787f1=function(_0x89ae1b){while(--_0x89ae1b){_0x54f01a['push'](_0x54f01a['shift']());}};_0x4787f1(++_0x12e01c);}(_0x47fe,0x1c0));var _0xe47f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x47fe[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xe47f('0x0'));var moment=require('moment');var BPromise=require(_0xe47f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe47f('0x2'));var db=require(_0xe47f('0x3'))['db'];var utils=require(_0xe47f('0x4'));var logger=require(_0xe47f('0x5'))(_0xe47f('0x6'));var config=require(_0xe47f('0x7'));var jayson=require(_0xe47f('0x8'));var client=jayson['client'][_0xe47f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x449031,_0x115040,_0x33f76b){return new BPromise(function(_0x59f0e9,_0x547327){return client['request'](_0x449031,_0x33f76b)[_0xe47f('0xa')](function(_0x1fa867){logger[_0xe47f('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x115040,'request\x20sent');logger['debug'](_0xe47f('0xc'),_0x115040,'request\x20sent',JSON['stringify'](_0x1fa867));if(_0x1fa867[_0xe47f('0xd')]){if(_0x1fa867[_0xe47f('0xd')][_0xe47f('0xe')]===0x1f4){logger[_0xe47f('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x115040,_0x1fa867[_0xe47f('0xd')][_0xe47f('0xf')]);return _0x547327(_0x1fa867[_0xe47f('0xd')][_0xe47f('0xf')]);}logger['error'](_0xe47f('0x10'),_0x115040,_0x1fa867[_0xe47f('0xd')][_0xe47f('0xf')]);return _0x59f0e9(_0x1fa867[_0xe47f('0xd')][_0xe47f('0xf')]);}else{logger[_0xe47f('0xb')](_0xe47f('0x10'),_0x115040,_0xe47f('0x11'));_0x59f0e9(_0x1fa867[_0xe47f('0x12')][_0xe47f('0xf')]);}})[_0xe47f('0x13')](function(_0x55da4f){logger[_0xe47f('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x115040,_0x55da4f);_0x547327(_0x55da4f);});});} \ No newline at end of file +var _0x0dd9=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20efe6,_0x2d6285){var _0x2680c2=function(_0x1c969b){while(--_0x1c969b){_0x20efe6['push'](_0x20efe6['shift']());}};_0x2680c2(++_0x2d6285);}(_0x0dd9,0x84));var _0x90dd=function(_0x2e1d31,_0x4b580f){_0x2e1d31=_0x2e1d31-0x0;var _0x106d77=_0x0dd9[_0x2e1d31];return _0x106d77;};'use strict';var _=require(_0x90dd('0x0'));var util=require(_0x90dd('0x1'));var moment=require('moment');var BPromise=require(_0x90dd('0x2'));var rs=require(_0x90dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90dd('0x4'))['db'];var utils=require(_0x90dd('0x5'));var logger=require('../../config/logger')(_0x90dd('0x6'));var config=require(_0x90dd('0x7'));var jayson=require(_0x90dd('0x8'));var client=jayson[_0x90dd('0x9')][_0x90dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28bc25,_0x3be145,_0x4d1d61){return new BPromise(function(_0x3b4a60,_0x34f138){return client['request'](_0x28bc25,_0x4d1d61)[_0x90dd('0xb')](function(_0x414127){logger['info'](_0x90dd('0xc'),_0x3be145,_0x90dd('0xd'));logger[_0x90dd('0xe')](_0x90dd('0xf'),_0x3be145,_0x90dd('0xd'),JSON[_0x90dd('0x10')](_0x414127));if(_0x414127[_0x90dd('0x11')]){if(_0x414127['error']['code']===0x1f4){logger[_0x90dd('0x11')](_0x90dd('0xc'),_0x3be145,_0x414127[_0x90dd('0x11')][_0x90dd('0x12')]);return _0x34f138(_0x414127[_0x90dd('0x11')][_0x90dd('0x12')]);}logger[_0x90dd('0x11')](_0x90dd('0xc'),_0x3be145,_0x414127[_0x90dd('0x11')][_0x90dd('0x12')]);return _0x3b4a60(_0x414127[_0x90dd('0x11')][_0x90dd('0x12')]);}else{logger[_0x90dd('0x13')](_0x90dd('0xc'),_0x3be145,_0x90dd('0xd'));_0x3b4a60(_0x414127['result'][_0x90dd('0x12')]);}})[_0x90dd('0x14')](function(_0x1fdadf){logger[_0x90dd('0x11')](_0x90dd('0xc'),_0x3be145,_0x1fdadf);_0x34f138(_0x1fdadf);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d0b974a..7835d99 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 _0x9d7b=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','post'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9d7b,0x1e8));var _0xb9d7=function(_0x1b63c0,_0x56224f){_0x1b63c0=_0x1b63c0-0x0;var _0x3baae1=_0x9d7b[_0x1b63c0];return _0x3baae1;};'use strict';var multer=require(_0xb9d7('0x0'));var util=require(_0xb9d7('0x1'));var path=require(_0xb9d7('0x2'));var timeout=require(_0xb9d7('0x3'));var express=require(_0xb9d7('0x4'));var router=express[_0xb9d7('0x5')]();var fs_extra=require(_0xb9d7('0x6'));var auth=require(_0xb9d7('0x7'));var interaction=require(_0xb9d7('0x8'));var config=require(_0xb9d7('0x9'));var controller=require(_0xb9d7('0xa'));router[_0xb9d7('0xb')]('/',auth[_0xb9d7('0xc')](),controller['index']);router[_0xb9d7('0xb')](_0xb9d7('0xd'),auth['isAuthenticated'](),controller[_0xb9d7('0xe')]);router[_0xb9d7('0xb')](_0xb9d7('0xf'),auth[_0xb9d7('0xc')](),controller[_0xb9d7('0x10')]);router[_0xb9d7('0x11')]('/',auth[_0xb9d7('0xc')](),controller[_0xb9d7('0x12')]);router[_0xb9d7('0x13')](_0xb9d7('0xd'),auth[_0xb9d7('0xc')](),controller['update']);router[_0xb9d7('0x14')](_0xb9d7('0xd'),auth['isAuthenticated'](),controller[_0xb9d7('0x15')]);module[_0xb9d7('0x16')]=router; \ No newline at end of file +var _0x0427=['isAuthenticated','index','show','/:id/download','post','put','/:id','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x18d058,_0x5850ef){var _0x1c5870=function(_0x2faedc){while(--_0x2faedc){_0x18d058['push'](_0x18d058['shift']());}};_0x1c5870(++_0x5850ef);}(_0x0427,0x199));var _0x7042=function(_0x57fa70,_0x2f1ba0){_0x57fa70=_0x57fa70-0x0;var _0x2b9671=_0x0427[_0x57fa70];return _0x2b9671;};'use strict';var multer=require('multer');var util=require(_0x7042('0x0'));var path=require(_0x7042('0x1'));var timeout=require(_0x7042('0x2'));var express=require(_0x7042('0x3'));var router=express['Router']();var fs_extra=require(_0x7042('0x4'));var auth=require(_0x7042('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7042('0x6'));var controller=require(_0x7042('0x7'));router[_0x7042('0x8')]('/',auth[_0x7042('0x9')](),controller[_0x7042('0xa')]);router[_0x7042('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7042('0xb')]);router['get'](_0x7042('0xc'),auth[_0x7042('0x9')](),controller['download']);router[_0x7042('0xd')]('/',auth[_0x7042('0x9')](),controller['create']);router[_0x7042('0xe')](_0x7042('0xf'),auth[_0x7042('0x9')](),controller[_0x7042('0x10')]);router[_0x7042('0x11')](_0x7042('0xf'),auth[_0x7042('0x9')](),controller[_0x7042('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9f60eb9..5d98c2c 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 _0x99a6=['TEXT','STRING','BOOLEAN','exports'];(function(_0x1a29ae,_0x24e30f){var _0x2e810c=function(_0x148f60){while(--_0x148f60){_0x1a29ae['push'](_0x1a29ae['shift']());}};_0x2e810c(++_0x24e30f);}(_0x99a6,0x1c3));var _0x699a=function(_0x126af7,_0x25fa06){_0x126af7=_0x126af7-0x0;var _0x25b500=_0x99a6[_0x126af7];return _0x25b500;};'use strict';var Sequelize=require('sequelize');module[_0x699a('0x0')]={'field':{'type':Sequelize[_0x699a('0x1')]},'alias':{'type':Sequelize[_0x699a('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x699a('0x2')]},'groupBy':{'type':Sequelize[_0x699a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x699a('0x2')]},'custom':{'type':Sequelize[_0x699a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7008=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x17e751,_0x59eb9b){var _0x3c8367=function(_0x21b2dd){while(--_0x21b2dd){_0x17e751['push'](_0x17e751['shift']());}};_0x3c8367(++_0x59eb9b);}(_0x7008,0x1ac));var _0x8700=function(_0x89ca46,_0x4b0536){_0x89ca46=_0x89ca46-0x0;var _0x519ea8=_0x7008[_0x89ca46];return _0x519ea8;};'use strict';var Sequelize=require(_0x8700('0x0'));module[_0x8700('0x1')]={'field':{'type':Sequelize[_0x8700('0x2')]},'alias':{'type':Sequelize[_0x8700('0x3')]},'function':{'type':Sequelize[_0x8700('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x8700('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'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 7585f80..367dfae 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 _0x6dfa=['index','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','stack','name','send'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x6dfa,0x7b));var _0xa6df=function(_0x571239,_0x23d386){_0x571239=_0x571239-0x0;var _0xa89b75=_0x6dfa[_0x571239];return _0xa89b75;};'use strict';var emlformat=require(_0xa6df('0x0'));var rimraf=require(_0xa6df('0x1'));var zipdir=require(_0xa6df('0x2'));var jsonpatch=require(_0xa6df('0x3'));var rp=require(_0xa6df('0x4'));var moment=require('moment');var BPromise=require(_0xa6df('0x5'));var Mustache=require('mustache');var util=require(_0xa6df('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa6df('0x7'));var ejs=require(_0xa6df('0x8'));var fs=require('fs');var fs_extra=require(_0xa6df('0x9'));var _=require(_0xa6df('0xa'));var squel=require(_0xa6df('0xb'));var crypto=require(_0xa6df('0xc'));var jsforce=require(_0xa6df('0xd'));var deskjs=require(_0xa6df('0xe'));var toCsv=require(_0xa6df('0x7'));var querystring=require(_0xa6df('0xf'));var Papa=require('papaparse');var Redis=require(_0xa6df('0x10'));var authService=require(_0xa6df('0x11'));var qs=require(_0xa6df('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6df('0x13'));var logger=require('../../config/logger')(_0xa6df('0x14'));var utils=require(_0xa6df('0x15'));var config=require(_0xa6df('0x16'));var licenseUtil=require(_0xa6df('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6bdaa,_0x500e77){_0x500e77=_0x500e77||0xcc;return function(_0x1540f1){if(_0x1540f1){return _0x6bdaa[_0xa6df('0x18')](_0x500e77);}return _0x6bdaa[_0xa6df('0x19')](_0x500e77)[_0xa6df('0x1a')]();};}function respondWithResult(_0x53325a,_0x1e536d){_0x1e536d=_0x1e536d||0xc8;return function(_0x5bbd9e){if(_0x5bbd9e){return _0x53325a[_0xa6df('0x19')](_0x1e536d)[_0xa6df('0x1b')](_0x5bbd9e);}};}function respondWithFilteredResult(_0x59c2a2,_0x300a72){return function(_0x414cae){if(_0x414cae){var _0x23f4c1=typeof _0x300a72[_0xa6df('0x1c')]===_0xa6df('0x1d')&&typeof _0x300a72['limit']===_0xa6df('0x1d');var _0x3f9a6b=_0x414cae[_0xa6df('0x1e')];var _0x172bb9=_0x23f4c1?0x0:_0x300a72['offset'];var _0x203375=_0x23f4c1?_0x414cae[_0xa6df('0x1e')]:_0x300a72[_0xa6df('0x1c')]+_0x300a72[_0xa6df('0x1f')];var _0x48de1c;if(_0x203375>=_0x3f9a6b){_0x203375=_0x3f9a6b;_0x48de1c=0xc8;}else{_0x48de1c=0xce;}_0x59c2a2['status'](_0x48de1c);return _0x59c2a2[_0xa6df('0x20')]('Content-Range',_0x172bb9+'-'+_0x203375+'/'+_0x3f9a6b)[_0xa6df('0x1b')](_0x414cae);}return null;};}function patchUpdates(_0xfefceb){return function(_0x297e0f){try{jsonpatch[_0xa6df('0x21')](_0x297e0f,_0xfefceb,!![]);}catch(_0x2f41e1){return BPromise['reject'](_0x2f41e1);}return _0x297e0f[_0xa6df('0x22')]();};}function saveUpdates(_0x37dcbd,_0x3c09de){return function(_0x10fb11){if(_0x10fb11){return _0x10fb11[_0xa6df('0x23')](_0x37dcbd)[_0xa6df('0x24')](function(_0x539be3){return _0x539be3;});}return null;};}function removeEntity(_0x4be3e0,_0xcaa3a1){return function(_0x111659){if(_0x111659){return _0x111659[_0xa6df('0x25')]()[_0xa6df('0x24')](function(){_0x4be3e0[_0xa6df('0x19')](0xcc)[_0xa6df('0x1a')]();});}};}function handleEntityNotFound(_0x557aa6,_0x51e836){return function(_0x1f138b){if(!_0x1f138b){_0x557aa6[_0xa6df('0x18')](0x194);}return _0x1f138b;};}function handleError(_0x2745f8,_0x50e7b8){_0x50e7b8=_0x50e7b8||0x1f4;return function(_0x54ff44){logger['error'](_0x54ff44[_0xa6df('0x26')]);if(_0x54ff44['name']){delete _0x54ff44[_0xa6df('0x27')];}_0x2745f8[_0xa6df('0x19')](_0x50e7b8)[_0xa6df('0x28')](_0x54ff44);};}exports[_0xa6df('0x29')]=function(_0x37b079,_0x25a36a){var _0x55161d={},_0x42fa1b={},_0x417c8a={'count':0x0,'rows':[]};var _0x42fa29=_[_0xa6df('0x2a')](db[_0xa6df('0x2b')]['rawAttributes'],function(_0x29eacf){return{'name':_0x29eacf[_0xa6df('0x2c')],'type':_0x29eacf['type'][_0xa6df('0x2d')]};});_0x42fa1b[_0xa6df('0x2e')]=_['map'](_0x42fa29,_0xa6df('0x27'));_0x42fa1b[_0xa6df('0x2f')]=_[_0xa6df('0x30')](_0x37b079[_0xa6df('0x2f')]);_0x42fa1b[_0xa6df('0x31')]=_['intersection'](_0x42fa1b[_0xa6df('0x2e')],_0x42fa1b[_0xa6df('0x2f')]);_0x55161d[_0xa6df('0x32')]=_[_0xa6df('0x33')](_0x42fa1b['model'],qs[_0xa6df('0x34')](_0x37b079['query'][_0xa6df('0x34')]));_0x55161d[_0xa6df('0x32')]=_0x55161d[_0xa6df('0x32')][_0xa6df('0x35')]?_0x55161d[_0xa6df('0x32')]:_0x42fa1b[_0xa6df('0x2e')];if(!_0x37b079[_0xa6df('0x2f')][_0xa6df('0x36')](_0xa6df('0x37'))){_0x55161d[_0xa6df('0x1f')]=qs[_0xa6df('0x1f')](_0x37b079['query']['limit']);_0x55161d[_0xa6df('0x1c')]=qs[_0xa6df('0x1c')](_0x37b079[_0xa6df('0x2f')][_0xa6df('0x1c')]);}_0x55161d[_0xa6df('0x38')]=qs['sort'](_0x37b079[_0xa6df('0x2f')][_0xa6df('0x39')]);_0x55161d[_0xa6df('0x3a')]=qs[_0xa6df('0x31')](_[_0xa6df('0x3b')](_0x37b079['query'],_0x42fa1b[_0xa6df('0x31')]),_0x42fa29);if(_0x37b079[_0xa6df('0x2f')][_0xa6df('0x3c')]){_0x55161d['where']=_[_0xa6df('0x3d')](_0x55161d['where'],{'$or':_['map'](_0x42fa29,function(_0x56d9e6){if(_0x56d9e6[_0xa6df('0x3e')]!==_0xa6df('0x3f')){var _0x4c54a0={};_0x4c54a0[_0x56d9e6['name']]={'$like':'%'+_0x37b079[_0xa6df('0x2f')][_0xa6df('0x3c')]+'%'};return _0x4c54a0;}})});}_0x55161d=_[_0xa6df('0x3d')]({},_0x55161d,_0x37b079[_0xa6df('0x40')]);var _0x2e3da8={'where':_0x55161d['where']};return db[_0xa6df('0x2b')][_0xa6df('0x1e')](_0x2e3da8)[_0xa6df('0x24')](function(_0x5ab682){_0x417c8a[_0xa6df('0x1e')]=_0x5ab682;if(_0x37b079[_0xa6df('0x2f')][_0xa6df('0x41')]){_0x55161d['include']=[{'all':!![]}];}return db[_0xa6df('0x2b')]['findAll'](_0x55161d);})[_0xa6df('0x24')](function(_0x4b4815){_0x417c8a[_0xa6df('0x42')]=_0x4b4815;return _0x417c8a;})[_0xa6df('0x24')](respondWithFilteredResult(_0x25a36a,_0x55161d))[_0xa6df('0x43')](handleError(_0x25a36a,null));};exports[_0xa6df('0x44')]=function(_0x217696,_0x4f99a0){var _0x3ea622={'raw':![],'where':{'id':_0x217696[_0xa6df('0x45')]['id']}},_0x5e277f={};_0x5e277f[_0xa6df('0x2e')]=_[_0xa6df('0x30')](db['AnalyticFieldReport'][_0xa6df('0x46')]);_0x5e277f[_0xa6df('0x2f')]=_[_0xa6df('0x30')](_0x217696[_0xa6df('0x2f')]);_0x5e277f[_0xa6df('0x31')]=_['intersection'](_0x5e277f[_0xa6df('0x2e')],_0x5e277f[_0xa6df('0x2f')]);_0x3ea622[_0xa6df('0x32')]=_['intersection'](_0x5e277f['model'],qs['fields'](_0x217696[_0xa6df('0x2f')][_0xa6df('0x34')]));_0x3ea622[_0xa6df('0x32')]=_0x3ea622[_0xa6df('0x32')][_0xa6df('0x35')]?_0x3ea622['attributes']:_0x5e277f[_0xa6df('0x2e')];if(_0x217696[_0xa6df('0x2f')][_0xa6df('0x41')]){_0x3ea622['include']=[{'all':!![]}];}_0x3ea622=_['merge']({},_0x3ea622,_0x217696['options']);return db[_0xa6df('0x2b')][_0xa6df('0x47')](_0x3ea622)[_0xa6df('0x24')](handleEntityNotFound(_0x4f99a0,null))['then'](respondWithResult(_0x4f99a0,null))[_0xa6df('0x43')](handleError(_0x4f99a0,null));};exports['create']=function(_0x3c4adc,_0x1278b3){return db['AnalyticFieldReport'][_0xa6df('0x48')](_0x3c4adc[_0xa6df('0x49')],{})[_0xa6df('0x24')](respondWithResult(_0x1278b3,0xc9))[_0xa6df('0x43')](handleError(_0x1278b3,null));};exports['bulkCreate']=function(_0x3b48a0,_0xdb3379){return db['AnalyticFieldReport']['bulkCreate'](_0x3b48a0['body'],{'raw':![],'individualHooks':!![]})[_0xa6df('0x24')](respondWithResult(_0xdb3379,0xc9))[_0xa6df('0x43')](handleError(_0xdb3379,null));};exports[_0xa6df('0x23')]=function(_0x15865c,_0x39a95b){if(_0x15865c[_0xa6df('0x49')]['id']){delete _0x15865c['body']['id'];}return db[_0xa6df('0x2b')][_0xa6df('0x47')]({'where':{'id':_0x15865c[_0xa6df('0x45')]['id']}})[_0xa6df('0x24')](handleEntityNotFound(_0x39a95b,null))[_0xa6df('0x24')](saveUpdates(_0x15865c[_0xa6df('0x49')],null))[_0xa6df('0x24')](respondWithResult(_0x39a95b,null))[_0xa6df('0x43')](handleError(_0x39a95b,null));};exports[_0xa6df('0x25')]=function(_0x423499,_0x31688c){return db[_0xa6df('0x2b')][_0xa6df('0x47')]({'where':{'id':_0x423499[_0xa6df('0x45')]['id']}})[_0xa6df('0x24')](handleEntityNotFound(_0x31688c,null))[_0xa6df('0x24')](removeEntity(_0x31688c,null))[_0xa6df('0x43')](handleError(_0x31688c,null));};exports['bulkDestroy']=function(_0x2825a0,_0x7e7e92){return db[_0xa6df('0x2b')][_0xa6df('0x25')]({'where':{'id':_0x2825a0[_0xa6df('0x2f')][_0xa6df('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xa6df('0x24')](respondWithResult(_0x7e7e92,0xcc))[_0xa6df('0x43')](handleError(_0x7e7e92,null));};exports[_0xa6df('0x4b')]=function(_0x9ae7c3,_0x32119d,_0x5a2d47){return db[_0xa6df('0x4c')][_0xa6df('0x4d')]({'where':{'id':_0x9ae7c3[_0xa6df('0x45')]['id']}})[_0xa6df('0x24')](handleEntityNotFound(_0x32119d,null))[_0xa6df('0x24')](function(_0x5ea5f9){if(_0x5ea5f9){return db[_0xa6df('0x4e')]['transaction'](function(_0x275225){return db[_0xa6df('0x2b')][_0xa6df('0x25')]({'where':{'CustomReportId':_0x9ae7c3[_0xa6df('0x45')]['id']},'transaction':_0x275225})[_0xa6df('0x24')](function(_0x5e1c15){var _0x3aa8a2=_[_0xa6df('0x2a')](_0x9ae7c3[_0xa6df('0x49')],function(_0x2c3fbc){delete _0x2c3fbc['id'];_0x2c3fbc[_0xa6df('0x4f')]=_0x9ae7c3[_0xa6df('0x45')]['id'];return _0x2c3fbc;});return db[_0xa6df('0x2b')][_0xa6df('0x50')](_0x3aa8a2,{'transaction':_0x275225});});})[_0xa6df('0x24')](function(){return db[_0xa6df('0x2b')][_0xa6df('0x51')]({'where':{'CustomReportId':_0x9ae7c3[_0xa6df('0x45')]['id']}});});}})[_0xa6df('0x24')](respondWithResult(_0x32119d,null))[_0xa6df('0x43')](handleError(_0x32119d,null));}; \ No newline at end of file +var _0x923c=['util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','bulkCreate','body','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','zip-dir','moment','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x923c,0xa1));var _0xc923=function(_0x5bebee,_0x330ddf){_0x5bebee=_0x5bebee-0x0;var _0xcd8a8e=_0x923c[_0x5bebee];return _0xcd8a8e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc923('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc923('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc923('0x2'));var util=require(_0xc923('0x3'));var path=require(_0xc923('0x4'));var sox=require(_0xc923('0x5'));var csv=require('to-csv');var ejs=require(_0xc923('0x6'));var fs=require('fs');var fs_extra=require(_0xc923('0x7'));var _=require(_0xc923('0x8'));var squel=require(_0xc923('0x9'));var crypto=require(_0xc923('0xa'));var jsforce=require(_0xc923('0xb'));var deskjs=require(_0xc923('0xc'));var toCsv=require(_0xc923('0xd'));var querystring=require('querystring');var Papa=require(_0xc923('0xe'));var Redis=require(_0xc923('0xf'));var authService=require(_0xc923('0x10'));var qs=require(_0xc923('0x11'));var as=require(_0xc923('0x12'));var hardwareService=require(_0xc923('0x13'));var logger=require(_0xc923('0x14'))(_0xc923('0x15'));var utils=require('../../config/utils');var config=require(_0xc923('0x16'));var licenseUtil=require(_0xc923('0x17'));var db=require(_0xc923('0x18'))['db'];function respondWithStatusCode(_0x483877,_0x473e1e){_0x473e1e=_0x473e1e||0xcc;return function(_0x46a886){if(_0x46a886){return _0x483877['sendStatus'](_0x473e1e);}return _0x483877[_0xc923('0x19')](_0x473e1e)['end']();};}function respondWithResult(_0x48613e,_0x3a8dca){_0x3a8dca=_0x3a8dca||0xc8;return function(_0x1678bd){if(_0x1678bd){return _0x48613e[_0xc923('0x19')](_0x3a8dca)['json'](_0x1678bd);}};}function respondWithFilteredResult(_0x17dfa9,_0x9491a4){return function(_0x43e21d){if(_0x43e21d){var _0x477f6d=typeof _0x9491a4['offset']==='undefined'&&typeof _0x9491a4['limit']===_0xc923('0x1a');var _0x351ad2=_0x43e21d[_0xc923('0x1b')];var _0x587ca3=_0x477f6d?0x0:_0x9491a4[_0xc923('0x1c')];var _0x2a5402=_0x477f6d?_0x43e21d[_0xc923('0x1b')]:_0x9491a4[_0xc923('0x1c')]+_0x9491a4[_0xc923('0x1d')];var _0x1c4165;if(_0x2a5402>=_0x351ad2){_0x2a5402=_0x351ad2;_0x1c4165=0xc8;}else{_0x1c4165=0xce;}_0x17dfa9[_0xc923('0x19')](_0x1c4165);return _0x17dfa9[_0xc923('0x1e')]('Content-Range',_0x587ca3+'-'+_0x2a5402+'/'+_0x351ad2)[_0xc923('0x1f')](_0x43e21d);}return null;};}function patchUpdates(_0x4fd8e1){return function(_0x24a719){try{jsonpatch[_0xc923('0x20')](_0x24a719,_0x4fd8e1,!![]);}catch(_0x4f1ff3){return BPromise[_0xc923('0x21')](_0x4f1ff3);}return _0x24a719['save']();};}function saveUpdates(_0x5bb872,_0xe3d1ac){return function(_0x358051){if(_0x358051){return _0x358051[_0xc923('0x22')](_0x5bb872)[_0xc923('0x23')](function(_0x6a931b){return _0x6a931b;});}return null;};}function removeEntity(_0x140c81,_0x118dee){return function(_0x2507a0){if(_0x2507a0){return _0x2507a0[_0xc923('0x24')]()[_0xc923('0x23')](function(){_0x140c81[_0xc923('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5af964,_0x3c3588){return function(_0x57df17){if(!_0x57df17){_0x5af964['sendStatus'](0x194);}return _0x57df17;};}function handleError(_0x52bffe,_0x4c4592){_0x4c4592=_0x4c4592||0x1f4;return function(_0x52b296){logger[_0xc923('0x25')](_0x52b296[_0xc923('0x26')]);if(_0x52b296[_0xc923('0x27')]){delete _0x52b296['name'];}_0x52bffe[_0xc923('0x19')](_0x4c4592)[_0xc923('0x28')](_0x52b296);};}exports[_0xc923('0x29')]=function(_0x158e7e,_0x5c29b4){var _0x300477={},_0x399d9a={},_0x48fd02={'count':0x0,'rows':[]};var _0x24cb58=_[_0xc923('0x2a')](db[_0xc923('0x2b')]['rawAttributes'],function(_0x2e4ef9){return{'name':_0x2e4ef9[_0xc923('0x2c')],'type':_0x2e4ef9[_0xc923('0x2d')][_0xc923('0x2e')]};});_0x399d9a[_0xc923('0x2f')]=_[_0xc923('0x2a')](_0x24cb58,'name');_0x399d9a[_0xc923('0x30')]=_[_0xc923('0x31')](_0x158e7e[_0xc923('0x30')]);_0x399d9a[_0xc923('0x32')]=_[_0xc923('0x33')](_0x399d9a[_0xc923('0x2f')],_0x399d9a[_0xc923('0x30')]);_0x300477[_0xc923('0x34')]=_[_0xc923('0x33')](_0x399d9a[_0xc923('0x2f')],qs[_0xc923('0x35')](_0x158e7e[_0xc923('0x30')][_0xc923('0x35')]));_0x300477[_0xc923('0x34')]=_0x300477['attributes'][_0xc923('0x36')]?_0x300477[_0xc923('0x34')]:_0x399d9a[_0xc923('0x2f')];if(!_0x158e7e[_0xc923('0x30')][_0xc923('0x37')](_0xc923('0x38'))){_0x300477[_0xc923('0x1d')]=qs['limit'](_0x158e7e[_0xc923('0x30')][_0xc923('0x1d')]);_0x300477[_0xc923('0x1c')]=qs['offset'](_0x158e7e['query'][_0xc923('0x1c')]);}_0x300477[_0xc923('0x39')]=qs['sort'](_0x158e7e['query'][_0xc923('0x3a')]);_0x300477['where']=qs[_0xc923('0x32')](_[_0xc923('0x3b')](_0x158e7e['query'],_0x399d9a[_0xc923('0x32')]),_0x24cb58);if(_0x158e7e[_0xc923('0x30')]['filter']){_0x300477['where']=_['merge'](_0x300477[_0xc923('0x3c')],{'$or':_[_0xc923('0x2a')](_0x24cb58,function(_0x53946a){if(_0x53946a['type']!==_0xc923('0x3d')){var _0x332dd4={};_0x332dd4[_0x53946a[_0xc923('0x27')]]={'$like':'%'+_0x158e7e[_0xc923('0x30')][_0xc923('0x3e')]+'%'};return _0x332dd4;}})});}_0x300477=_[_0xc923('0x3f')]({},_0x300477,_0x158e7e[_0xc923('0x40')]);var _0x2001c5={'where':_0x300477[_0xc923('0x3c')]};return db['AnalyticFieldReport']['count'](_0x2001c5)[_0xc923('0x23')](function(_0x385da4){_0x48fd02[_0xc923('0x1b')]=_0x385da4;if(_0x158e7e[_0xc923('0x30')][_0xc923('0x41')]){_0x300477[_0xc923('0x42')]=[{'all':!![]}];}return db[_0xc923('0x2b')][_0xc923('0x43')](_0x300477);})[_0xc923('0x23')](function(_0x36cc2a){_0x48fd02['rows']=_0x36cc2a;return _0x48fd02;})[_0xc923('0x23')](respondWithFilteredResult(_0x5c29b4,_0x300477))[_0xc923('0x44')](handleError(_0x5c29b4,null));};exports['show']=function(_0x179d8e,_0x44ffb0){var _0x23891a={'raw':![],'where':{'id':_0x179d8e[_0xc923('0x45')]['id']}},_0x4a69f3={};_0x4a69f3[_0xc923('0x2f')]=_[_0xc923('0x31')](db[_0xc923('0x2b')][_0xc923('0x46')]);_0x4a69f3[_0xc923('0x30')]=_[_0xc923('0x31')](_0x179d8e[_0xc923('0x30')]);_0x4a69f3[_0xc923('0x32')]=_[_0xc923('0x33')](_0x4a69f3['model'],_0x4a69f3[_0xc923('0x30')]);_0x23891a['attributes']=_[_0xc923('0x33')](_0x4a69f3[_0xc923('0x2f')],qs[_0xc923('0x35')](_0x179d8e[_0xc923('0x30')]['fields']));_0x23891a[_0xc923('0x34')]=_0x23891a[_0xc923('0x34')]['length']?_0x23891a['attributes']:_0x4a69f3['model'];if(_0x179d8e['query'][_0xc923('0x41')]){_0x23891a[_0xc923('0x42')]=[{'all':!![]}];}_0x23891a=_['merge']({},_0x23891a,_0x179d8e['options']);return db[_0xc923('0x2b')][_0xc923('0x47')](_0x23891a)[_0xc923('0x23')](handleEntityNotFound(_0x44ffb0,null))['then'](respondWithResult(_0x44ffb0,null))[_0xc923('0x44')](handleError(_0x44ffb0,null));};exports[_0xc923('0x48')]=function(_0x5137c5,_0x4fc951){return db[_0xc923('0x2b')][_0xc923('0x48')](_0x5137c5['body'],{})[_0xc923('0x23')](respondWithResult(_0x4fc951,0xc9))['catch'](handleError(_0x4fc951,null));};exports[_0xc923('0x49')]=function(_0x5c5710,_0x1d234a){return db['AnalyticFieldReport'][_0xc923('0x49')](_0x5c5710['body'],{'raw':![],'individualHooks':!![]})[_0xc923('0x23')](respondWithResult(_0x1d234a,0xc9))['catch'](handleError(_0x1d234a,null));};exports[_0xc923('0x22')]=function(_0x25d5b0,_0x49cada){if(_0x25d5b0[_0xc923('0x4a')]['id']){delete _0x25d5b0[_0xc923('0x4a')]['id'];}return db['AnalyticFieldReport'][_0xc923('0x47')]({'where':{'id':_0x25d5b0[_0xc923('0x45')]['id']}})['then'](handleEntityNotFound(_0x49cada,null))['then'](saveUpdates(_0x25d5b0[_0xc923('0x4a')],null))[_0xc923('0x23')](respondWithResult(_0x49cada,null))['catch'](handleError(_0x49cada,null));};exports[_0xc923('0x24')]=function(_0xa41e5a,_0x1d6037){return db[_0xc923('0x2b')][_0xc923('0x47')]({'where':{'id':_0xa41e5a['params']['id']}})['then'](handleEntityNotFound(_0x1d6037,null))[_0xc923('0x23')](removeEntity(_0x1d6037,null))[_0xc923('0x44')](handleError(_0x1d6037,null));};exports['bulkDestroy']=function(_0x3d3adf,_0xc76c8c){return db['AnalyticFieldReport'][_0xc923('0x24')]({'where':{'id':_0x3d3adf[_0xc923('0x30')][_0xc923('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xc923('0x23')](respondWithResult(_0xc76c8c,0xcc))[_0xc923('0x44')](handleError(_0xc76c8c,null));};exports[_0xc923('0x4c')]=function(_0xe9d8,_0x30ca05,_0x5da10f){return db[_0xc923('0x4d')][_0xc923('0x4e')]({'where':{'id':_0xe9d8[_0xc923('0x45')]['id']}})[_0xc923('0x23')](handleEntityNotFound(_0x30ca05,null))[_0xc923('0x23')](function(_0x3cf707){if(_0x3cf707){return db[_0xc923('0x4f')][_0xc923('0x50')](function(_0x5648c7){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0xe9d8[_0xc923('0x45')]['id']},'transaction':_0x5648c7})[_0xc923('0x23')](function(_0x351139){var _0x244c6e=_[_0xc923('0x2a')](_0xe9d8[_0xc923('0x4a')],function(_0x33fc96){delete _0x33fc96['id'];_0x33fc96[_0xc923('0x51')]=_0xe9d8[_0xc923('0x45')]['id'];return _0x33fc96;});return db[_0xc923('0x2b')][_0xc923('0x49')](_0x244c6e,{'transaction':_0x5648c7});});})[_0xc923('0x23')](function(){return db['AnalyticFieldReport'][_0xc923('0x43')]({'where':{'CustomReportId':_0xe9d8['params']['id']}});});}})[_0xc923('0x23')](respondWithResult(_0x30ca05,null))['catch'](handleError(_0x30ca05,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c0acbfc..38b882c 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 _0x457b=['./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4cc6ef,_0x421fdb){var _0x33082d=function(_0xf3e3b){while(--_0xf3e3b){_0x4cc6ef['push'](_0x4cc6ef['shift']());}};_0x33082d(++_0x421fdb);}(_0x457b,0x108));var _0xb457=function(_0xe5287b,_0x26b8ab){_0xe5287b=_0xe5287b-0x0;var _0x346f77=_0x457b[_0xe5287b];return _0x346f77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb457('0x0'))(_0xb457('0x1'));var moment=require(_0xb457('0x2'));var BPromise=require(_0xb457('0x3'));var rp=require(_0xb457('0x4'));var fs=require('fs');var path=require(_0xb457('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb457('0x6'));module['exports']=function(_0x463d96,_0x2b1442){return _0x463d96[_0xb457('0x7')](_0xb457('0x8'),attributes,{'tableName':_0xb457('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x556e=['define','AnalyticFieldReport','analytics_report_fields','lodash','api','moment','request-promise','path','../../config/environment','./analyticFieldReport.attributes'];(function(_0x597e84,_0xfb6943){var _0x29ae7d=function(_0x4ddd07){while(--_0x4ddd07){_0x597e84['push'](_0x597e84['shift']());}};_0x29ae7d(++_0xfb6943);}(_0x556e,0x1cf));var _0xe556=function(_0x597106,_0x44de51){_0x597106=_0x597106-0x0;var _0x3ca6b5=_0x556e[_0x597106];return _0x3ca6b5;};'use strict';var _=require(_0xe556('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe556('0x1'));var moment=require(_0xe556('0x2'));var BPromise=require('bluebird');var rp=require(_0xe556('0x3'));var fs=require('fs');var path=require(_0xe556('0x4'));var rimraf=require('rimraf');var config=require(_0xe556('0x5'));var attributes=require(_0xe556('0x6'));module['exports']=function(_0x2cafed,_0x64c1ce){return _0x2cafed[_0xe556('0x7')](_0xe556('0x8'),attributes,{'tableName':_0xe556('0x9'),'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 9b67d4d..fcfe25a 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 _0x01a4=['info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x72c4dc,_0x5efac5){var _0x21057d=function(_0x547585){while(--_0x547585){_0x72c4dc['push'](_0x72c4dc['shift']());}};_0x21057d(++_0x5efac5);}(_0x01a4,0x70));var _0x401a=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0x01a4[_0x5a6961];return _0x4af0a6;};'use strict';var _=require(_0x401a('0x0'));var util=require(_0x401a('0x1'));var moment=require(_0x401a('0x2'));var BPromise=require(_0x401a('0x3'));var rs=require(_0x401a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x401a('0x5'))['db'];var utils=require(_0x401a('0x6'));var logger=require(_0x401a('0x7'))(_0x401a('0x8'));var config=require(_0x401a('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455801,_0xd48404,_0x31db0f){return new BPromise(function(_0x3627a3,_0x3c7f19){return client[_0x401a('0xa')](_0x455801,_0x31db0f)[_0x401a('0xb')](function(_0x10962a){logger['info'](_0x401a('0xc'),_0xd48404,_0x401a('0xd'));logger[_0x401a('0xe')](_0x401a('0xf'),_0xd48404,_0x401a('0xd'),JSON[_0x401a('0x10')](_0x10962a));if(_0x10962a[_0x401a('0x11')]){if(_0x10962a[_0x401a('0x11')][_0x401a('0x12')]===0x1f4){logger[_0x401a('0x11')](_0x401a('0xc'),_0xd48404,_0x10962a['error'][_0x401a('0x13')]);return _0x3c7f19(_0x10962a[_0x401a('0x11')][_0x401a('0x13')]);}logger[_0x401a('0x11')](_0x401a('0xc'),_0xd48404,_0x10962a[_0x401a('0x11')][_0x401a('0x13')]);return _0x3627a3(_0x10962a['error']['message']);}else{logger[_0x401a('0x14')](_0x401a('0xc'),_0xd48404,_0x401a('0xd'));_0x3627a3(_0x10962a[_0x401a('0x15')][_0x401a('0x13')]);}})['catch'](function(_0x3390c1){logger[_0x401a('0x11')](_0x401a('0xc'),_0xd48404,_0x3390c1);_0x3c7f19(_0x3390c1);});});} \ No newline at end of file +var _0x5894=['client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b2f12,_0x1e7128){var _0x36a818=function(_0x5cca31){while(--_0x5cca31){_0x3b2f12['push'](_0x3b2f12['shift']());}};_0x36a818(++_0x1e7128);}(_0x5894,0xff));var _0x4589=function(_0x175e22,_0x3d7be1){_0x175e22=_0x175e22-0x0;var _0x393b37=_0x5894[_0x175e22];return _0x393b37;};'use strict';var _=require('lodash');var util=require(_0x4589('0x0'));var moment=require(_0x4589('0x1'));var BPromise=require(_0x4589('0x2'));var rs=require(_0x4589('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4589('0x4'));var logger=require(_0x4589('0x5'))(_0x4589('0x6'));var config=require(_0x4589('0x7'));var jayson=require(_0x4589('0x8'));var client=jayson[_0x4589('0x9')][_0x4589('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46268c,_0x240238,_0x399e11){return new BPromise(function(_0x238d46,_0x50c75a){return client[_0x4589('0xb')](_0x46268c,_0x399e11)[_0x4589('0xc')](function(_0x5b35c7){logger[_0x4589('0xd')](_0x4589('0xe'),_0x240238,_0x4589('0xf'));logger[_0x4589('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x240238,_0x4589('0xf'),JSON[_0x4589('0x11')](_0x5b35c7));if(_0x5b35c7[_0x4589('0x12')]){if(_0x5b35c7[_0x4589('0x12')][_0x4589('0x13')]===0x1f4){logger[_0x4589('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x240238,_0x5b35c7[_0x4589('0x12')]['message']);return _0x50c75a(_0x5b35c7[_0x4589('0x12')][_0x4589('0x14')]);}logger[_0x4589('0x12')](_0x4589('0xe'),_0x240238,_0x5b35c7[_0x4589('0x12')]['message']);return _0x238d46(_0x5b35c7[_0x4589('0x12')][_0x4589('0x14')]);}else{logger[_0x4589('0xd')](_0x4589('0xe'),_0x240238,_0x4589('0xf'));_0x238d46(_0x5b35c7['result']['message']);}})[_0x4589('0x15')](function(_0x5c8471){logger[_0x4589('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x240238,_0x5c8471);_0x50c75a(_0x5c8471);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c0104f0..fb2299e 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(_0x1818d,_0x5f94e){var _0x37de5d=function(_0x1846df){while(--_0x1846df){_0x1818d['push'](_0x1818d['shift']());}};_0x37de5d(++_0x5f94e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +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(_0x3836cf,_0x479950){var _0x53e36b=function(_0x14f844){while(--_0x14f844){_0x3836cf['push'](_0x3836cf['shift']());}};_0x53e36b(++_0x479950);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 8254735..0245c3b 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 _0x6170=['TEXT','sequelize','exports','STRING','name'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6170,0x17d));var _0x0617=function(_0x136612,_0x462f26){_0x136612=_0x136612-0x0;var _0x50d439=_0x6170[_0x136612];return _0x50d439;};'use strict';var Sequelize=require(_0x0617('0x0'));module[_0x0617('0x1')]={'name':{'type':Sequelize[_0x0617('0x2')],'allowNull':![],'unique':_0x0617('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x0617('0x4')]},'description':{'type':Sequelize[_0x0617('0x2')]}}; \ No newline at end of file +var _0xfd6f=['name','sequelize','exports','STRING'];(function(_0x3e5458,_0x2eeddb){var _0x316ee5=function(_0x2424e7){while(--_0x2424e7){_0x3e5458['push'](_0x3e5458['shift']());}};_0x316ee5(++_0x2eeddb);}(_0xfd6f,0x19d));var _0xffd6=function(_0x302b51,_0x538aa0){_0x302b51=_0x302b51-0x0;var _0x4083f9=_0xfd6f[_0x302b51];return _0x4083f9;};'use strict';var Sequelize=require(_0xffd6('0x0'));module[_0xffd6('0x1')]={'name':{'type':Sequelize[_0xffd6('0x2')],'allowNull':![],'unique':_0xffd6('0x3')},'table':{'type':Sequelize[_0xffd6('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xffd6('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3a09096..dcc3283 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 _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x56f4e7,_0x161437){var _0x21c723=function(_0x326681){while(--_0x326681){_0x56f4e7['push'](_0x56f4e7['shift']());}};_0x21c723(++_0x161437);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1cff5e,_0x1aaa69){_0x1cff5e=_0x1cff5e-0x0;var _0x15f36b=_0xdc97[_0x1cff5e];return _0x15f36b;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file +var _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x84ab,0x12f));var _0xb84a=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x84ab[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 19dc2ec..2eb1dd3 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 _0x7b84=['path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x43028e,_0x33a648){var _0x2fed6d=function(_0x3d2598){while(--_0x3d2598){_0x43028e['push'](_0x43028e['shift']());}};_0x2fed6d(++_0x33a648);}(_0x7b84,0x167));var _0x47b8=function(_0x3d2077,_0x59dc7f){_0x3d2077=_0x3d2077-0x0;var _0x5ebf17=_0x7b84[_0x3d2077];return _0x5ebf17;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x47b8('0x3'));var rp=require(_0x47b8('0x4'));var fs=require('fs');var path=require(_0x47b8('0x5'));var rimraf=require(_0x47b8('0x6'));var config=require(_0x47b8('0x7'));var attributes=require(_0x47b8('0x8'));module[_0x47b8('0x9')]=function(_0x1072a8,_0x172e57){return _0x1072a8[_0x47b8('0xa')](_0x47b8('0xb'),attributes,{'tableName':_0x47b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87f1=['path','../../config/environment','exports','AnalyticMetric','analytics_metrics','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15c659,_0x2bd857){var _0x2f018c=function(_0x4bc351){while(--_0x4bc351){_0x15c659['push'](_0x15c659['shift']());}};_0x2f018c(++_0x2bd857);}(_0x87f1,0x170));var _0x187f=function(_0x160af8,_0xaa32a3){_0x160af8=_0x160af8-0x0;var _0x3baef8=_0x87f1[_0x160af8];return _0x3baef8;};'use strict';var _=require('lodash');var util=require(_0x187f('0x0'));var logger=require(_0x187f('0x1'))(_0x187f('0x2'));var moment=require(_0x187f('0x3'));var BPromise=require(_0x187f('0x4'));var rp=require(_0x187f('0x5'));var fs=require('fs');var path=require(_0x187f('0x6'));var rimraf=require('rimraf');var config=require(_0x187f('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x187f('0x8')]=function(_0x591147,_0x1115d1){return _0x591147['define'](_0x187f('0x9'),attributes,{'tableName':_0x187f('0xa'),'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 6b83929..6449ce8 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 _0xc35e=['jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x202c77,_0x14cd91){var _0x41541e=function(_0x37161f){while(--_0x37161f){_0x202c77['push'](_0x202c77['shift']());}};_0x41541e(++_0x14cd91);}(_0xc35e,0x168));var _0xec35=function(_0x10cf5d,_0x396a02){_0x10cf5d=_0x10cf5d-0x0;var _0x5b9d4b=_0xc35e[_0x10cf5d];return _0x5b9d4b;};'use strict';var _=require(_0xec35('0x0'));var util=require(_0xec35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec35('0x2'));var fs=require('fs');var Redis=require(_0xec35('0x3'));var db=require(_0xec35('0x4'))['db'];var utils=require(_0xec35('0x5'));var logger=require('../../config/logger')(_0xec35('0x6'));var config=require(_0xec35('0x7'));var jayson=require(_0xec35('0x8'));var client=jayson[_0xec35('0x9')][_0xec35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ae794,_0x37756e,_0x2b4991){return new BPromise(function(_0x5299cc,_0x12e6b0){return client[_0xec35('0xb')](_0x4ae794,_0x2b4991)[_0xec35('0xc')](function(_0xaa87ae){logger['info'](_0xec35('0xd'),_0x37756e,_0xec35('0xe'));logger[_0xec35('0xf')](_0xec35('0x10'),_0x37756e,_0xec35('0xe'),JSON[_0xec35('0x11')](_0xaa87ae));if(_0xaa87ae[_0xec35('0x12')]){if(_0xaa87ae['error']['code']===0x1f4){logger[_0xec35('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x37756e,_0xaa87ae['error'][_0xec35('0x13')]);return _0x12e6b0(_0xaa87ae[_0xec35('0x12')][_0xec35('0x13')]);}logger[_0xec35('0x12')](_0xec35('0xd'),_0x37756e,_0xaa87ae[_0xec35('0x12')]['message']);return _0x5299cc(_0xaa87ae[_0xec35('0x12')][_0xec35('0x13')]);}else{logger[_0xec35('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x37756e,_0xec35('0xe'));_0x5299cc(_0xaa87ae[_0xec35('0x15')][_0xec35('0x13')]);}})[_0xec35('0x16')](function(_0x16920f){logger[_0xec35('0x12')](_0xec35('0xd'),_0x37756e,_0x16920f);_0x12e6b0(_0x16920f);});});} \ No newline at end of file +var _0xa587=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','bluebird','ioredis'];(function(_0x27538b,_0x47639d){var _0x4a0938=function(_0x10fdf5){while(--_0x10fdf5){_0x27538b['push'](_0x27538b['shift']());}};_0x4a0938(++_0x47639d);}(_0xa587,0xc4));var _0x7a58=function(_0x153268,_0x10fb17){_0x153268=_0x153268-0x0;var _0x120f98=_0xa587[_0x153268];return _0x120f98;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7a58('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a58('0x1'));var db=require(_0x7a58('0x2'))['db'];var utils=require(_0x7a58('0x3'));var logger=require(_0x7a58('0x4'))(_0x7a58('0x5'));var config=require(_0x7a58('0x6'));var jayson=require(_0x7a58('0x7'));var client=jayson['client'][_0x7a58('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f207,_0x3c0992,_0x2e91b9){return new BPromise(function(_0x40d384,_0x5d6bb4){return client[_0x7a58('0x9')](_0x20f207,_0x2e91b9)[_0x7a58('0xa')](function(_0x4aad23){logger[_0x7a58('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x3c0992,_0x7a58('0xc'));logger[_0x7a58('0xd')](_0x7a58('0xe'),_0x3c0992,'request\x20sent',JSON[_0x7a58('0xf')](_0x4aad23));if(_0x4aad23[_0x7a58('0x10')]){if(_0x4aad23[_0x7a58('0x10')][_0x7a58('0x11')]===0x1f4){logger['error'](_0x7a58('0x12'),_0x3c0992,_0x4aad23[_0x7a58('0x10')]['message']);return _0x5d6bb4(_0x4aad23['error'][_0x7a58('0x13')]);}logger[_0x7a58('0x10')](_0x7a58('0x12'),_0x3c0992,_0x4aad23[_0x7a58('0x10')][_0x7a58('0x13')]);return _0x40d384(_0x4aad23[_0x7a58('0x10')][_0x7a58('0x13')]);}else{logger[_0x7a58('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x3c0992,_0x7a58('0xc'));_0x40d384(_0x4aad23[_0x7a58('0x14')]['message']);}})[_0x7a58('0x15')](function(_0x2d8f61){logger['error'](_0x7a58('0x12'),_0x3c0992,_0x2d8f61);_0x5d6bb4(_0x2d8f61);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index debd118..27a1cc7 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 _0x2e3b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','isAuthenticated','show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x363027,_0x5998b6){var _0x25318f=function(_0x3286ab){while(--_0x3286ab){_0x363027['push'](_0x363027['shift']());}};_0x25318f(++_0x5998b6);}(_0x2e3b,0x81));var _0xb2e3=function(_0x1f3a06,_0x1dd867){_0x1f3a06=_0x1f3a06-0x0;var _0x416071=_0x2e3b[_0x1f3a06];return _0x416071;};'use strict';var multer=require('multer');var util=require(_0xb2e3('0x0'));var path=require(_0xb2e3('0x1'));var timeout=require(_0xb2e3('0x2'));var express=require(_0xb2e3('0x3'));var router=express[_0xb2e3('0x4')]();var fs_extra=require(_0xb2e3('0x5'));var auth=require(_0xb2e3('0x6'));var interaction=require(_0xb2e3('0x7'));var config=require('../../config/environment');var controller=require(_0xb2e3('0x8'));router[_0xb2e3('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2e3('0xa')]);router[_0xb2e3('0x9')]('/:id',auth[_0xb2e3('0xb')](),controller[_0xb2e3('0xc')]);router['post']('/',auth[_0xb2e3('0xb')](),controller[_0xb2e3('0xd')]);router[_0xb2e3('0xe')](_0xb2e3('0xf'),auth[_0xb2e3('0xb')](),controller['update']);router[_0xb2e3('0x10')]('/:id',auth[_0xb2e3('0xb')](),controller[_0xb2e3('0x11')]);module[_0xb2e3('0x12')]=router; \ No newline at end of file +var _0x4250=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5028d8,_0x538b4b){var _0x1ba240=function(_0xa6c8a3){while(--_0xa6c8a3){_0x5028d8['push'](_0x5028d8['shift']());}};_0x1ba240(++_0x538b4b);}(_0x4250,0x146));var _0x0425=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x4250[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0425('0x0'));var util=require(_0x0425('0x1'));var path=require(_0x0425('0x2'));var timeout=require(_0x0425('0x3'));var express=require('express');var router=express[_0x0425('0x4')]();var fs_extra=require(_0x0425('0x5'));var auth=require(_0x0425('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0425('0x7'));var controller=require(_0x0425('0x8'));router[_0x0425('0x9')]('/',auth[_0x0425('0xa')](),controller[_0x0425('0xb')]);router[_0x0425('0x9')](_0x0425('0xc'),auth[_0x0425('0xa')](),controller[_0x0425('0xd')]);router[_0x0425('0xe')]('/',auth[_0x0425('0xa')](),controller[_0x0425('0xf')]);router[_0x0425('0x10')](_0x0425('0xc'),auth[_0x0425('0xa')](),controller[_0x0425('0x11')]);router[_0x0425('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0425('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index df54b4f..a08377c 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 _0xef6d=['TEXT','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef6d,0x13f));var _0xdef6=function(_0xfb21d,_0x180250){_0xfb21d=_0xfb21d-0x0;var _0x31b4c3=_0xef6d[_0xfb21d];return _0x31b4c3;};'use strict';var Sequelize=require(_0xdef6('0x0'));module['exports']={'tree':{'type':Sequelize[_0xdef6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4858=['sequelize','exports','TEXT'];(function(_0x4bfd15,_0x57c9f2){var _0xfd58be=function(_0x23d742){while(--_0x23d742){_0x4bfd15['push'](_0x4bfd15['shift']());}};_0xfd58be(++_0x57c9f2);}(_0x4858,0x12c));var _0x8485=function(_0x1331b8,_0x24465f){_0x1331b8=_0x1331b8-0x0;var _0x3a57ce=_0x4858[_0x1331b8];return _0x3a57ce;};'use strict';var Sequelize=require(_0x8485('0x0'));module[_0x8485('0x1')]={'tree':{'type':Sequelize[_0x8485('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 9f01ca3..f83e92c 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 _0x9ec1=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','fields','includeAll','merge','find','catch','create','body','rimraf'];(function(_0x3fa37f,_0x4ee9e6){var _0x5595b5=function(_0x23168f){while(--_0x23168f){_0x3fa37f['push'](_0x3fa37f['shift']());}};_0x5595b5(++_0x4ee9e6);}(_0x9ec1,0x1bb));var _0x19ec=function(_0x1d1eaf,_0x31b7bc){_0x1d1eaf=_0x1d1eaf-0x0;var _0xb0dc37=_0x9ec1[_0x1d1eaf];return _0xb0dc37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19ec('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19ec('0x1'));var rp=require(_0x19ec('0x2'));var moment=require('moment');var BPromise=require(_0x19ec('0x3'));var Mustache=require(_0x19ec('0x4'));var util=require(_0x19ec('0x5'));var path=require(_0x19ec('0x6'));var sox=require('sox');var csv=require(_0x19ec('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x19ec('0x8'));var _=require(_0x19ec('0x9'));var squel=require(_0x19ec('0xa'));var crypto=require(_0x19ec('0xb'));var jsforce=require(_0x19ec('0xc'));var deskjs=require(_0x19ec('0xd'));var toCsv=require(_0x19ec('0x7'));var querystring=require('querystring');var Papa=require(_0x19ec('0xe'));var Redis=require(_0x19ec('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x19ec('0x10'));var as=require(_0x19ec('0x11'));var hardwareService=require(_0x19ec('0x12'));var logger=require(_0x19ec('0x13'))(_0x19ec('0x14'));var utils=require(_0x19ec('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x19ec('0x16'));var db=require(_0x19ec('0x17'))['db'];function respondWithStatusCode(_0x40b6c0,_0xda5c74){_0xda5c74=_0xda5c74||0xcc;return function(_0x8d0f77){if(_0x8d0f77){return _0x40b6c0['sendStatus'](_0xda5c74);}return _0x40b6c0[_0x19ec('0x18')](_0xda5c74)[_0x19ec('0x19')]();};}function respondWithResult(_0x4c93be,_0x4ca753){_0x4ca753=_0x4ca753||0xc8;return function(_0x5cddf8){if(_0x5cddf8){return _0x4c93be[_0x19ec('0x18')](_0x4ca753)[_0x19ec('0x1a')](_0x5cddf8);}};}function respondWithFilteredResult(_0x5ddbfb,_0x7ec3e0){return function(_0xa49f89){if(_0xa49f89){var _0xd3010e=typeof _0x7ec3e0[_0x19ec('0x1b')]==='undefined'&&typeof _0x7ec3e0['limit']===_0x19ec('0x1c');var _0xcb6668=_0xa49f89[_0x19ec('0x1d')];var _0x51b9e1=_0xd3010e?0x0:_0x7ec3e0[_0x19ec('0x1b')];var _0x11ac4a=_0xd3010e?_0xa49f89['count']:_0x7ec3e0['offset']+_0x7ec3e0[_0x19ec('0x1e')];var _0x299c45;if(_0x11ac4a>=_0xcb6668){_0x11ac4a=_0xcb6668;_0x299c45=0xc8;}else{_0x299c45=0xce;}_0x5ddbfb[_0x19ec('0x18')](_0x299c45);return _0x5ddbfb['set'](_0x19ec('0x1f'),_0x51b9e1+'-'+_0x11ac4a+'/'+_0xcb6668)[_0x19ec('0x1a')](_0xa49f89);}return null;};}function patchUpdates(_0x88e9a7){return function(_0x33e248){try{jsonpatch[_0x19ec('0x20')](_0x33e248,_0x88e9a7,!![]);}catch(_0x332bb2){return BPromise[_0x19ec('0x21')](_0x332bb2);}return _0x33e248[_0x19ec('0x22')]();};}function saveUpdates(_0x45cb86,_0x731887){return function(_0x54cf3b){if(_0x54cf3b){return _0x54cf3b[_0x19ec('0x23')](_0x45cb86)[_0x19ec('0x24')](function(_0x1d84bc){return _0x1d84bc;});}return null;};}function removeEntity(_0x50ecab,_0x357b1c){return function(_0x27eb31){if(_0x27eb31){return _0x27eb31[_0x19ec('0x25')]()[_0x19ec('0x24')](function(){_0x50ecab[_0x19ec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d4ee,_0x56c7d){return function(_0x331b73){if(!_0x331b73){_0x46d4ee[_0x19ec('0x26')](0x194);}return _0x331b73;};}function handleError(_0x55b44d,_0x46e37e){_0x46e37e=_0x46e37e||0x1f4;return function(_0xc0394e){logger[_0x19ec('0x27')](_0xc0394e[_0x19ec('0x28')]);if(_0xc0394e[_0x19ec('0x29')]){delete _0xc0394e[_0x19ec('0x29')];}_0x55b44d[_0x19ec('0x18')](_0x46e37e)[_0x19ec('0x2a')](_0xc0394e);};}exports['index']=function(_0x23ae7e,_0x3cb5a6){var _0xa4dd65={},_0x4304b7={},_0x54455d={'count':0x0,'rows':[]};var _0x278acb=_[_0x19ec('0x2b')](db[_0x19ec('0x2c')][_0x19ec('0x2d')],function(_0x1e1faa){return{'name':_0x1e1faa[_0x19ec('0x2e')],'type':_0x1e1faa[_0x19ec('0x2f')]['key']};});_0x4304b7[_0x19ec('0x30')]=_[_0x19ec('0x2b')](_0x278acb,'name');_0x4304b7['query']=_[_0x19ec('0x31')](_0x23ae7e[_0x19ec('0x32')]);_0x4304b7[_0x19ec('0x33')]=_[_0x19ec('0x34')](_0x4304b7[_0x19ec('0x30')],_0x4304b7['query']);_0xa4dd65[_0x19ec('0x35')]=_[_0x19ec('0x34')](_0x4304b7[_0x19ec('0x30')],qs['fields'](_0x23ae7e[_0x19ec('0x32')]['fields']));_0xa4dd65['attributes']=_0xa4dd65[_0x19ec('0x35')][_0x19ec('0x36')]?_0xa4dd65['attributes']:_0x4304b7['model'];if(!_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x37')](_0x19ec('0x38'))){_0xa4dd65[_0x19ec('0x1e')]=qs[_0x19ec('0x1e')](_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x1e')]);_0xa4dd65[_0x19ec('0x1b')]=qs['offset'](_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x1b')]);}_0xa4dd65['order']=qs[_0x19ec('0x39')](_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x39')]);_0xa4dd65[_0x19ec('0x3a')]=qs[_0x19ec('0x33')](_[_0x19ec('0x3b')](_0x23ae7e[_0x19ec('0x32')],_0x4304b7[_0x19ec('0x33')]),_0x278acb);if(_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x3c')]){_0xa4dd65[_0x19ec('0x3a')]=_['merge'](_0xa4dd65[_0x19ec('0x3a')],{'$or':_[_0x19ec('0x2b')](_0x278acb,function(_0x409262){if(_0x409262[_0x19ec('0x2f')]!==_0x19ec('0x3d')){var _0x5853e8={};_0x5853e8[_0x409262[_0x19ec('0x29')]]={'$like':'%'+_0x23ae7e[_0x19ec('0x32')][_0x19ec('0x3c')]+'%'};return _0x5853e8;}})});}_0xa4dd65=_['merge']({},_0xa4dd65,_0x23ae7e[_0x19ec('0x3e')]);var _0x2b6f43={'where':_0xa4dd65[_0x19ec('0x3a')]};return db[_0x19ec('0x2c')][_0x19ec('0x1d')](_0x2b6f43)['then'](function(_0x5ba1f7){_0x54455d[_0x19ec('0x1d')]=_0x5ba1f7;if(_0x23ae7e[_0x19ec('0x32')]['includeAll']){_0xa4dd65[_0x19ec('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x19ec('0x40')](_0xa4dd65);})[_0x19ec('0x24')](function(_0x2b6767){_0x54455d[_0x19ec('0x41')]=_0x2b6767;return _0x54455d;})['then'](respondWithFilteredResult(_0x3cb5a6,_0xa4dd65))['catch'](handleError(_0x3cb5a6,null));};exports['show']=function(_0x4af12b,_0xb846f0){var _0x19b95d={'raw':!![],'where':{'id':_0x4af12b[_0x19ec('0x42')]['id']}},_0x58e335={};_0x58e335[_0x19ec('0x30')]=_[_0x19ec('0x31')](db['AnalyticTreeReport'][_0x19ec('0x2d')]);_0x58e335[_0x19ec('0x32')]=_[_0x19ec('0x31')](_0x4af12b[_0x19ec('0x32')]);_0x58e335[_0x19ec('0x33')]=_[_0x19ec('0x34')](_0x58e335[_0x19ec('0x30')],_0x58e335[_0x19ec('0x32')]);_0x19b95d[_0x19ec('0x35')]=_[_0x19ec('0x34')](_0x58e335[_0x19ec('0x30')],qs[_0x19ec('0x43')](_0x4af12b[_0x19ec('0x32')][_0x19ec('0x43')]));_0x19b95d['attributes']=_0x19b95d[_0x19ec('0x35')][_0x19ec('0x36')]?_0x19b95d[_0x19ec('0x35')]:_0x58e335['model'];if(_0x4af12b[_0x19ec('0x32')][_0x19ec('0x44')]){_0x19b95d[_0x19ec('0x3f')]=[{'all':!![]}];}_0x19b95d=_[_0x19ec('0x45')]({},_0x19b95d,_0x4af12b['options']);return db[_0x19ec('0x2c')][_0x19ec('0x46')](_0x19b95d)['then'](handleEntityNotFound(_0xb846f0,null))['then'](respondWithResult(_0xb846f0,null))[_0x19ec('0x47')](handleError(_0xb846f0,null));};exports[_0x19ec('0x48')]=function(_0x561fb3,_0x556716){return db[_0x19ec('0x2c')][_0x19ec('0x48')](_0x561fb3[_0x19ec('0x49')],{})[_0x19ec('0x24')](respondWithResult(_0x556716,0xc9))[_0x19ec('0x47')](handleError(_0x556716,null));};exports[_0x19ec('0x23')]=function(_0x44d6f1,_0xd07b14){if(_0x44d6f1[_0x19ec('0x49')]['id']){delete _0x44d6f1['body']['id'];}return db['AnalyticTreeReport'][_0x19ec('0x46')]({'where':{'id':_0x44d6f1[_0x19ec('0x42')]['id']}})[_0x19ec('0x24')](handleEntityNotFound(_0xd07b14,null))['then'](saveUpdates(_0x44d6f1[_0x19ec('0x49')],null))[_0x19ec('0x24')](respondWithResult(_0xd07b14,null))[_0x19ec('0x47')](handleError(_0xd07b14,null));};exports['destroy']=function(_0x4dbb31,_0x296bf0){return db[_0x19ec('0x2c')]['find']({'where':{'id':_0x4dbb31[_0x19ec('0x42')]['id']}})['then'](handleEntityNotFound(_0x296bf0,null))[_0x19ec('0x24')](removeEntity(_0x296bf0,null))[_0x19ec('0x47')](handleError(_0x296bf0,null));}; \ No newline at end of file +var _0x48b4=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','set','reject','update','then','destroy','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type'];(function(_0x22da09,_0x29f1b0){var _0x56a486=function(_0x5cdfb0){while(--_0x5cdfb0){_0x22da09['push'](_0x22da09['shift']());}};_0x56a486(++_0x29f1b0);}(_0x48b4,0x13c));var _0x448b=function(_0x33ab3e,_0x5ed230){_0x33ab3e=_0x33ab3e-0x0;var _0x5592c5=_0x48b4[_0x33ab3e];return _0x5592c5;};'use strict';var emlformat=require(_0x448b('0x0'));var rimraf=require(_0x448b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x448b('0x2'));var rp=require('request-promise');var moment=require(_0x448b('0x3'));var BPromise=require(_0x448b('0x4'));var Mustache=require(_0x448b('0x5'));var util=require(_0x448b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x448b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x448b('0x8'));var _=require('lodash');var squel=require(_0x448b('0x9'));var crypto=require(_0x448b('0xa'));var jsforce=require(_0x448b('0xb'));var deskjs=require(_0x448b('0xc'));var toCsv=require(_0x448b('0x7'));var querystring=require(_0x448b('0xd'));var Papa=require(_0x448b('0xe'));var Redis=require(_0x448b('0xf'));var authService=require(_0x448b('0x10'));var qs=require(_0x448b('0x11'));var as=require(_0x448b('0x12'));var hardwareService=require(_0x448b('0x13'));var logger=require('../../config/logger')(_0x448b('0x14'));var utils=require(_0x448b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x448b('0x16'));var db=require(_0x448b('0x17'))['db'];function respondWithStatusCode(_0xb03c78,_0x499666){_0x499666=_0x499666||0xcc;return function(_0x2dd993){if(_0x2dd993){return _0xb03c78['sendStatus'](_0x499666);}return _0xb03c78[_0x448b('0x18')](_0x499666)[_0x448b('0x19')]();};}function respondWithResult(_0x43a5b9,_0x59a627){_0x59a627=_0x59a627||0xc8;return function(_0x3c053f){if(_0x3c053f){return _0x43a5b9[_0x448b('0x18')](_0x59a627)[_0x448b('0x1a')](_0x3c053f);}};}function respondWithFilteredResult(_0x189f62,_0x1f83d2){return function(_0x21e421){if(_0x21e421){var _0x37a542=typeof _0x1f83d2['offset']===_0x448b('0x1b')&&typeof _0x1f83d2['limit']==='undefined';var _0x42320d=_0x21e421['count'];var _0x359648=_0x37a542?0x0:_0x1f83d2['offset'];var _0x85731f=_0x37a542?_0x21e421[_0x448b('0x1c')]:_0x1f83d2[_0x448b('0x1d')]+_0x1f83d2['limit'];var _0x2f54a0;if(_0x85731f>=_0x42320d){_0x85731f=_0x42320d;_0x2f54a0=0xc8;}else{_0x2f54a0=0xce;}_0x189f62['status'](_0x2f54a0);return _0x189f62[_0x448b('0x1e')]('Content-Range',_0x359648+'-'+_0x85731f+'/'+_0x42320d)[_0x448b('0x1a')](_0x21e421);}return null;};}function patchUpdates(_0x5a9dce){return function(_0x3d481e){try{jsonpatch['apply'](_0x3d481e,_0x5a9dce,!![]);}catch(_0x30c26a){return BPromise[_0x448b('0x1f')](_0x30c26a);}return _0x3d481e['save']();};}function saveUpdates(_0x311641,_0x4bf1dc){return function(_0x485a0a){if(_0x485a0a){return _0x485a0a[_0x448b('0x20')](_0x311641)[_0x448b('0x21')](function(_0x5dd52b){return _0x5dd52b;});}return null;};}function removeEntity(_0x16d1d1,_0xd7e150){return function(_0x1254ef){if(_0x1254ef){return _0x1254ef[_0x448b('0x22')]()[_0x448b('0x21')](function(){_0x16d1d1[_0x448b('0x18')](0xcc)[_0x448b('0x19')]();});}};}function handleEntityNotFound(_0x529fdb,_0x26668d){return function(_0x33d77f){if(!_0x33d77f){_0x529fdb['sendStatus'](0x194);}return _0x33d77f;};}function handleError(_0x48da72,_0x5dfdf9){_0x5dfdf9=_0x5dfdf9||0x1f4;return function(_0x3cea5c){logger[_0x448b('0x23')](_0x3cea5c[_0x448b('0x24')]);if(_0x3cea5c[_0x448b('0x25')]){delete _0x3cea5c[_0x448b('0x25')];}_0x48da72[_0x448b('0x18')](_0x5dfdf9)[_0x448b('0x26')](_0x3cea5c);};}exports['index']=function(_0x2a03b8,_0x5ec38c){var _0x4af15c={},_0x1b7419={},_0x366aa4={'count':0x0,'rows':[]};var _0xf0537e=_[_0x448b('0x27')](db[_0x448b('0x28')][_0x448b('0x29')],function(_0x539714){return{'name':_0x539714[_0x448b('0x2a')],'type':_0x539714[_0x448b('0x2b')][_0x448b('0x2c')]};});_0x1b7419[_0x448b('0x2d')]=_['map'](_0xf0537e,'name');_0x1b7419[_0x448b('0x2e')]=_[_0x448b('0x2f')](_0x2a03b8[_0x448b('0x2e')]);_0x1b7419[_0x448b('0x30')]=_[_0x448b('0x31')](_0x1b7419[_0x448b('0x2d')],_0x1b7419[_0x448b('0x2e')]);_0x4af15c[_0x448b('0x32')]=_[_0x448b('0x31')](_0x1b7419['model'],qs[_0x448b('0x33')](_0x2a03b8[_0x448b('0x2e')][_0x448b('0x33')]));_0x4af15c[_0x448b('0x32')]=_0x4af15c[_0x448b('0x32')]['length']?_0x4af15c[_0x448b('0x32')]:_0x1b7419['model'];if(!_0x2a03b8['query'][_0x448b('0x34')](_0x448b('0x35'))){_0x4af15c['limit']=qs[_0x448b('0x36')](_0x2a03b8[_0x448b('0x2e')][_0x448b('0x36')]);_0x4af15c['offset']=qs[_0x448b('0x1d')](_0x2a03b8[_0x448b('0x2e')][_0x448b('0x1d')]);}_0x4af15c[_0x448b('0x37')]=qs[_0x448b('0x38')](_0x2a03b8['query'][_0x448b('0x38')]);_0x4af15c[_0x448b('0x39')]=qs[_0x448b('0x30')](_['pick'](_0x2a03b8[_0x448b('0x2e')],_0x1b7419['filters']),_0xf0537e);if(_0x2a03b8[_0x448b('0x2e')][_0x448b('0x3a')]){_0x4af15c[_0x448b('0x39')]=_[_0x448b('0x3b')](_0x4af15c[_0x448b('0x39')],{'$or':_[_0x448b('0x27')](_0xf0537e,function(_0x2aa6e5){if(_0x2aa6e5[_0x448b('0x2b')]!==_0x448b('0x3c')){var _0x342061={};_0x342061[_0x2aa6e5[_0x448b('0x25')]]={'$like':'%'+_0x2a03b8[_0x448b('0x2e')][_0x448b('0x3a')]+'%'};return _0x342061;}})});}_0x4af15c=_[_0x448b('0x3b')]({},_0x4af15c,_0x2a03b8[_0x448b('0x3d')]);var _0x5231c0={'where':_0x4af15c['where']};return db[_0x448b('0x28')][_0x448b('0x1c')](_0x5231c0)['then'](function(_0x307aa1){_0x366aa4[_0x448b('0x1c')]=_0x307aa1;if(_0x2a03b8[_0x448b('0x2e')][_0x448b('0x3e')]){_0x4af15c['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x4af15c);})[_0x448b('0x21')](function(_0x4b052e){_0x366aa4[_0x448b('0x3f')]=_0x4b052e;return _0x366aa4;})[_0x448b('0x21')](respondWithFilteredResult(_0x5ec38c,_0x4af15c))[_0x448b('0x40')](handleError(_0x5ec38c,null));};exports[_0x448b('0x41')]=function(_0x5f2ade,_0x31bcff){var _0x5a273f={'raw':!![],'where':{'id':_0x5f2ade[_0x448b('0x42')]['id']}},_0x8dcf1f={};_0x8dcf1f[_0x448b('0x2d')]=_[_0x448b('0x2f')](db[_0x448b('0x28')][_0x448b('0x29')]);_0x8dcf1f[_0x448b('0x2e')]=_['keys'](_0x5f2ade[_0x448b('0x2e')]);_0x8dcf1f[_0x448b('0x30')]=_[_0x448b('0x31')](_0x8dcf1f[_0x448b('0x2d')],_0x8dcf1f[_0x448b('0x2e')]);_0x5a273f[_0x448b('0x32')]=_[_0x448b('0x31')](_0x8dcf1f[_0x448b('0x2d')],qs[_0x448b('0x33')](_0x5f2ade['query'][_0x448b('0x33')]));_0x5a273f['attributes']=_0x5a273f['attributes'][_0x448b('0x43')]?_0x5a273f[_0x448b('0x32')]:_0x8dcf1f[_0x448b('0x2d')];if(_0x5f2ade['query'][_0x448b('0x3e')]){_0x5a273f[_0x448b('0x44')]=[{'all':!![]}];}_0x5a273f=_[_0x448b('0x3b')]({},_0x5a273f,_0x5f2ade[_0x448b('0x3d')]);return db[_0x448b('0x28')][_0x448b('0x45')](_0x5a273f)[_0x448b('0x21')](handleEntityNotFound(_0x31bcff,null))[_0x448b('0x21')](respondWithResult(_0x31bcff,null))['catch'](handleError(_0x31bcff,null));};exports[_0x448b('0x46')]=function(_0x3107a9,_0x1d4203){return db[_0x448b('0x28')][_0x448b('0x46')](_0x3107a9[_0x448b('0x47')],{})[_0x448b('0x21')](respondWithResult(_0x1d4203,0xc9))[_0x448b('0x40')](handleError(_0x1d4203,null));};exports['update']=function(_0x2b50de,_0xe25ab9){if(_0x2b50de[_0x448b('0x47')]['id']){delete _0x2b50de['body']['id'];}return db['AnalyticTreeReport'][_0x448b('0x45')]({'where':{'id':_0x2b50de['params']['id']}})[_0x448b('0x21')](handleEntityNotFound(_0xe25ab9,null))[_0x448b('0x21')](saveUpdates(_0x2b50de[_0x448b('0x47')],null))[_0x448b('0x21')](respondWithResult(_0xe25ab9,null))[_0x448b('0x40')](handleError(_0xe25ab9,null));};exports[_0x448b('0x22')]=function(_0xba4f4b,_0x5b3ca8){return db['AnalyticTreeReport']['find']({'where':{'id':_0xba4f4b[_0x448b('0x42')]['id']}})[_0x448b('0x21')](handleEntityNotFound(_0x5b3ca8,null))['then'](removeEntity(_0x5b3ca8,null))[_0x448b('0x40')](handleError(_0x5b3ca8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 4b4d811..2a9bca5 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 _0x6d8e=['moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','util','../../config/logger','api'];(function(_0x38341c,_0x2d886f){var _0x56c38a=function(_0x16601a){while(--_0x16601a){_0x38341c['push'](_0x38341c['shift']());}};_0x56c38a(++_0x2d886f);}(_0x6d8e,0x1d1));var _0xe6d8=function(_0x53ce70,_0x305811){_0x53ce70=_0x53ce70-0x0;var _0x26d76e=_0x6d8e[_0x53ce70];return _0x26d76e;};'use strict';var _=require('lodash');var util=require(_0xe6d8('0x0'));var logger=require(_0xe6d8('0x1'))(_0xe6d8('0x2'));var moment=require(_0xe6d8('0x3'));var BPromise=require(_0xe6d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6d8('0x5'));var rimraf=require(_0xe6d8('0x6'));var config=require(_0xe6d8('0x7'));var attributes=require(_0xe6d8('0x8'));module[_0xe6d8('0x9')]=function(_0x3749ec,_0x1e7884){return _0x3749ec[_0xe6d8('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xe6d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2b3=['util','../../config/logger','api','moment','request-promise','rimraf','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xc2b3,0x168));var _0x3c2b=function(_0x31cf2b,_0x5296c2){_0x31cf2b=_0x31cf2b-0x0;var _0x45acb1=_0xc2b3[_0x31cf2b];return _0x45acb1;};'use strict';var _=require('lodash');var util=require(_0x3c2b('0x0'));var logger=require(_0x3c2b('0x1'))(_0x3c2b('0x2'));var moment=require(_0x3c2b('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c2b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c2b('0x5'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x3c2b('0x6')]=function(_0x5bd430,_0xfbfeb0){return _0x5bd430[_0x3c2b('0x7')](_0x3c2b('0x8'),attributes,{'tableName':_0x3c2b('0x9'),'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 4ed3aa3..ece3af2 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0xadb5,0xad));var _0x5adb=function(_0x741998,_0x5328a3){_0x741998=_0x741998-0x0;var _0x399663=_0xadb5[_0x741998];return _0x399663;};'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']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xfe328a,_0x40602a){var _0x54d9a4=function(_0x591e40){while(--_0x591e40){_0xfe328a['push'](_0xfe328a['shift']());}};_0x54d9a4(++_0x40602a);}(_0x2ef3,0xba));var _0x32ef=function(_0x39a5ae,_0x7678ef){_0x39a5ae=_0x39a5ae-0x0;var _0x459a37=_0x2ef3[_0x39a5ae];return _0x459a37;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 465b14f..0050efa 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 _0x9c5d=['index','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x513401,_0x2b3f2c){var _0x2c4a0b=function(_0x47dbdd){while(--_0x47dbdd){_0x513401['push'](_0x513401['shift']());}};_0x2c4a0b(++_0x2b3f2c);}(_0x9c5d,0x14b));var _0xd9c5=function(_0x571d85,_0xda439c){_0x571d85=_0x571d85-0x0;var _0x3c2e07=_0x9c5d[_0x571d85];return _0x3c2e07;};'use strict';var multer=require(_0xd9c5('0x0'));var util=require(_0xd9c5('0x1'));var path=require(_0xd9c5('0x2'));var timeout=require(_0xd9c5('0x3'));var express=require('express');var router=express[_0xd9c5('0x4')]();var fs_extra=require(_0xd9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd9c5('0x6'));var config=require(_0xd9c5('0x7'));var controller=require(_0xd9c5('0x8'));router[_0xd9c5('0x9')]('/',auth[_0xd9c5('0xa')](),controller[_0xd9c5('0xb')]);router[_0xd9c5('0x9')](_0xd9c5('0xc'),auth[_0xd9c5('0xa')](),controller[_0xd9c5('0xd')]);router[_0xd9c5('0xe')]('/',auth['isAuthenticated'](),controller[_0xd9c5('0xf')]);router[_0xd9c5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd9c5('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd9c5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0cab=['Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x4a5438,_0x19aa59){var _0x35a70d=function(_0x42b805){while(--_0x42b805){_0x4a5438['push'](_0x4a5438['shift']());}};_0x35a70d(++_0x19aa59);}(_0x0cab,0x1b6));var _0xb0ca=function(_0x351e3d,_0x13c1f4){_0x351e3d=_0x351e3d-0x0;var _0x2d1b16=_0x0cab[_0x351e3d];return _0x2d1b16;};'use strict';var multer=require(_0xb0ca('0x0'));var util=require(_0xb0ca('0x1'));var path=require('path');var timeout=require(_0xb0ca('0x2'));var express=require(_0xb0ca('0x3'));var router=express[_0xb0ca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb0ca('0x5'));var interaction=require(_0xb0ca('0x6'));var config=require('../../config/environment');var controller=require(_0xb0ca('0x7'));router['get']('/',auth[_0xb0ca('0x8')](),controller[_0xb0ca('0x9')]);router[_0xb0ca('0xa')](_0xb0ca('0xb'),auth[_0xb0ca('0x8')](),controller['show']);router[_0xb0ca('0xc')]('/',auth[_0xb0ca('0x8')](),controller[_0xb0ca('0xd')]);router['put']('/:id',auth[_0xb0ca('0x8')](),controller[_0xb0ca('0xe')]);router[_0xb0ca('0xf')]('/:id',auth[_0xb0ca('0x8')](),controller[_0xb0ca('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 1ab7951..6de6195 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 _0xc964=['sequelize','exports','STRING'];(function(_0x5dbc1d,_0x43e816){var _0xbd1883=function(_0x21a9b4){while(--_0x21a9b4){_0x5dbc1d['push'](_0x5dbc1d['shift']());}};_0xbd1883(++_0x43e816);}(_0xc964,0x7e));var _0x4c96=function(_0x115d32,_0x4de46d){_0x115d32=_0x115d32-0x0;var _0x4dcd42=_0xc964[_0x115d32];return _0x4dcd42;};'use strict';var Sequelize=require(_0x4c96('0x0'));module[_0x4c96('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x4c96('0x2')]},'type':{'type':Sequelize[_0x4c96('0x2')]}}; \ No newline at end of file +var _0xba47=['exports','STRING','sequelize'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xba47,0x1ac));var _0x7ba4=function(_0x39259d,_0x21399d){_0x39259d=_0x39259d-0x0;var _0x18e87d=_0xba47[_0x39259d];return _0x18e87d;};'use strict';var Sequelize=require(_0x7ba4('0x0'));module[_0x7ba4('0x1')]={'name':{'type':Sequelize[_0x7ba4('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7ba4('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b4ef3dc..34a3ee1 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 _0x8005=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','end','sendStatus','error','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','find','clone','include','createdAt','updatedAt','body','create','includeAll','destroy','basename','file','filename','download','join','root','server/files/attachments/','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x4f9589,_0x508341){var _0x461484=function(_0x292e1b){while(--_0x292e1b){_0x4f9589['push'](_0x4f9589['shift']());}};_0x461484(++_0x508341);}(_0x8005,0x154));var _0x5800=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0x8005[_0x5933fb];return _0x44d988;};'use strict';var emlformat=require(_0x5800('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5800('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5800('0x2'));var moment=require('moment');var BPromise=require(_0x5800('0x3'));var Mustache=require(_0x5800('0x4'));var util=require(_0x5800('0x5'));var path=require(_0x5800('0x6'));var sox=require('sox');var csv=require(_0x5800('0x7'));var ejs=require(_0x5800('0x8'));var fs=require('fs');var fs_extra=require(_0x5800('0x9'));var _=require(_0x5800('0xa'));var squel=require(_0x5800('0xb'));var crypto=require(_0x5800('0xc'));var jsforce=require(_0x5800('0xd'));var deskjs=require(_0x5800('0xe'));var toCsv=require(_0x5800('0x7'));var querystring=require('querystring');var Papa=require(_0x5800('0xf'));var Redis=require(_0x5800('0x10'));var authService=require(_0x5800('0x11'));var qs=require(_0x5800('0x12'));var as=require(_0x5800('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5800('0x14'))('api');var utils=require(_0x5800('0x15'));var config=require(_0x5800('0x16'));var licenseUtil=require(_0x5800('0x17'));var db=require(_0x5800('0x18'))['db'];function respondWithStatusCode(_0x152a60,_0x1058dd){_0x1058dd=_0x1058dd||0xcc;return function(_0x6396a7){if(_0x6396a7){return _0x152a60['sendStatus'](_0x1058dd);}return _0x152a60[_0x5800('0x19')](_0x1058dd)['end']();};}function respondWithResult(_0x21fbae,_0x4c2508){_0x4c2508=_0x4c2508||0xc8;return function(_0x1e1af6){if(_0x1e1af6){return _0x21fbae[_0x5800('0x19')](_0x4c2508)[_0x5800('0x1a')](_0x1e1af6);}};}function respondWithFilteredResult(_0x1d7e77,_0x463216){return function(_0x3693fb){if(_0x3693fb){var _0x436f49=typeof _0x463216[_0x5800('0x1b')]==='undefined'&&typeof _0x463216[_0x5800('0x1c')]===_0x5800('0x1d');var _0x1f8ff3=_0x3693fb[_0x5800('0x1e')];var _0x2c52e6=_0x436f49?0x0:_0x463216[_0x5800('0x1b')];var _0x6861d4=_0x436f49?_0x3693fb['count']:_0x463216['offset']+_0x463216[_0x5800('0x1c')];var _0x384c44;if(_0x6861d4>=_0x1f8ff3){_0x6861d4=_0x1f8ff3;_0x384c44=0xc8;}else{_0x384c44=0xce;}_0x1d7e77[_0x5800('0x19')](_0x384c44);return _0x1d7e77[_0x5800('0x1f')](_0x5800('0x20'),_0x2c52e6+'-'+_0x6861d4+'/'+_0x1f8ff3)[_0x5800('0x1a')](_0x3693fb);}return null;};}function patchUpdates(_0xddd10e){return function(_0x35c184){try{jsonpatch[_0x5800('0x21')](_0x35c184,_0xddd10e,!![]);}catch(_0x5374be){return BPromise['reject'](_0x5374be);}return _0x35c184[_0x5800('0x22')]();};}function saveUpdates(_0x2c8f0d,_0x1187ee){return function(_0x51cacb){if(_0x51cacb){return _0x51cacb[_0x5800('0x23')](_0x2c8f0d)['then'](function(_0x5805e3){return _0x5805e3;});}return null;};}function removeEntity(_0x219425,_0x57aa69){return function(_0x7772d5){if(_0x7772d5){return _0x7772d5['destroy']()[_0x5800('0x24')](function(){_0x219425[_0x5800('0x19')](0xcc)[_0x5800('0x25')]();});}};}function handleEntityNotFound(_0x4a8309,_0x1cad92){return function(_0x263e26){if(!_0x263e26){_0x4a8309[_0x5800('0x26')](0x194);}return _0x263e26;};}function handleError(_0xcb9c8b,_0x4f4cfc){_0x4f4cfc=_0x4f4cfc||0x1f4;return function(_0x485f04){logger[_0x5800('0x27')](_0x485f04['stack']);if(_0x485f04['name']){delete _0x485f04[_0x5800('0x28')];}_0xcb9c8b[_0x5800('0x19')](_0x4f4cfc)[_0x5800('0x29')](_0x485f04);};}exports[_0x5800('0x2a')]=function(_0x43b514,_0x12d2de){var _0x135776={},_0x2fc899={},_0x20ba88={'count':0x0,'rows':[]};var _0x138f33=_[_0x5800('0x2b')](db[_0x5800('0x2c')][_0x5800('0x2d')],function(_0x260e08){return{'name':_0x260e08[_0x5800('0x2e')],'type':_0x260e08['type'][_0x5800('0x2f')]};});_0x2fc899[_0x5800('0x30')]=_[_0x5800('0x2b')](_0x138f33,_0x5800('0x28'));_0x2fc899[_0x5800('0x31')]=_[_0x5800('0x32')](_0x43b514[_0x5800('0x31')]);_0x2fc899[_0x5800('0x33')]=_[_0x5800('0x34')](_0x2fc899[_0x5800('0x30')],_0x2fc899[_0x5800('0x31')]);_0x135776[_0x5800('0x35')]=_[_0x5800('0x34')](_0x2fc899['model'],qs['fields'](_0x43b514[_0x5800('0x31')][_0x5800('0x36')]));_0x135776['attributes']=_0x135776['attributes'][_0x5800('0x37')]?_0x135776[_0x5800('0x35')]:_0x2fc899[_0x5800('0x30')];if(!_0x43b514[_0x5800('0x31')][_0x5800('0x38')]('nolimit')){_0x135776['limit']=qs['limit'](_0x43b514[_0x5800('0x31')][_0x5800('0x1c')]);_0x135776['offset']=qs['offset'](_0x43b514[_0x5800('0x31')]['offset']);}_0x135776[_0x5800('0x39')]=qs[_0x5800('0x3a')](_0x43b514[_0x5800('0x31')][_0x5800('0x3a')]);_0x135776[_0x5800('0x3b')]=qs[_0x5800('0x33')](_[_0x5800('0x3c')](_0x43b514[_0x5800('0x31')],_0x2fc899[_0x5800('0x33')]),_0x138f33);if(_0x43b514[_0x5800('0x31')][_0x5800('0x3d')]){_0x135776[_0x5800('0x3b')]=_[_0x5800('0x3e')](_0x135776[_0x5800('0x3b')],{'$or':_[_0x5800('0x2b')](_0x138f33,function(_0x31e728){if(_0x31e728[_0x5800('0x3f')]!==_0x5800('0x40')){var _0x4e281e={};_0x4e281e[_0x31e728['name']]={'$like':'%'+_0x43b514['query'][_0x5800('0x3d')]+'%'};return _0x4e281e;}})});}_0x135776=_[_0x5800('0x3e')]({},_0x135776,_0x43b514[_0x5800('0x41')]);var _0x562544={'where':_0x135776[_0x5800('0x3b')]};return db[_0x5800('0x2c')]['count'](_0x562544)[_0x5800('0x24')](function(_0x529bf0){_0x20ba88[_0x5800('0x1e')]=_0x529bf0;if(_0x43b514[_0x5800('0x31')]['includeAll']){_0x135776['include']=[{'all':!![]}];}return db[_0x5800('0x2c')][_0x5800('0x42')](_0x135776);})[_0x5800('0x24')](function(_0x26c007){_0x20ba88[_0x5800('0x43')]=_0x26c007;return _0x20ba88;})[_0x5800('0x24')](respondWithFilteredResult(_0x12d2de,_0x135776))[_0x5800('0x44')](handleError(_0x12d2de,null));};exports[_0x5800('0x45')]=function(_0x4b2d48,_0x129455){var _0x4cccfc={'raw':!![],'where':{'id':_0x4b2d48[_0x5800('0x46')]['id']}},_0x52fec6={};_0x52fec6[_0x5800('0x30')]=_[_0x5800('0x32')](db[_0x5800('0x2c')][_0x5800('0x2d')]);_0x52fec6[_0x5800('0x31')]=_['keys'](_0x4b2d48[_0x5800('0x31')]);_0x52fec6['filters']=_[_0x5800('0x34')](_0x52fec6[_0x5800('0x30')],_0x52fec6[_0x5800('0x31')]);_0x4cccfc[_0x5800('0x35')]=_[_0x5800('0x34')](_0x52fec6[_0x5800('0x30')],qs[_0x5800('0x36')](_0x4b2d48['query'][_0x5800('0x36')]));_0x4cccfc[_0x5800('0x35')]=_0x4cccfc[_0x5800('0x35')][_0x5800('0x37')]?_0x4cccfc[_0x5800('0x35')]:_0x52fec6[_0x5800('0x30')];if(_0x4b2d48[_0x5800('0x31')]['includeAll']){_0x4cccfc['include']=[{'all':!![]}];}_0x4cccfc=_['merge']({},_0x4cccfc,_0x4b2d48['options']);return db['Attachment'][_0x5800('0x47')](_0x4cccfc)['then'](handleEntityNotFound(_0x129455,null))[_0x5800('0x24')](respondWithResult(_0x129455,null))[_0x5800('0x44')](handleError(_0x129455,null));};exports[_0x5800('0x48')]=function(_0x2ada1f,_0x320eea){var _0x511c6f={'where':{'id':_0x2ada1f[_0x5800('0x46')]['id']}},_0x2ba64d={};_0x2ba64d[_0x5800('0x30')]=_[_0x5800('0x32')](db[_0x5800('0x2c')][_0x5800('0x2d')]);_0x511c6f[_0x5800('0x35')]=_[_0x5800('0x34')](_0x2ba64d[_0x5800('0x30')],qs[_0x5800('0x36')](_0x2ada1f[_0x5800('0x31')][_0x5800('0x36')]));_0x511c6f['attributes']=_0x511c6f['attributes']['length']?_0x511c6f[_0x5800('0x35')]:_0x2ba64d['model'];if(_0x2ada1f['query']['includeAll']){_0x511c6f[_0x5800('0x49')]=[{'all':!![]}];}_0x511c6f=_['merge']({},_0x511c6f,_0x2ada1f['options']);return db['Attachment'][_0x5800('0x47')](_0x511c6f)[_0x5800('0x24')](handleEntityNotFound(_0x320eea,null))['then'](function(_0x3d087f){if(_0x3d087f){var _0x3e4f59=_0x3d087f['get']({'plain':!![]});_0x3e4f59=qs['omit'](_0x3e4f59,['id',_0x5800('0x4a'),_0x5800('0x4b')]);_0x2ada1f[_0x5800('0x4c')]=_['omit'](_0x2ada1f['body'],['id',_0x5800('0x4a'),_0x5800('0x4b')]);return db[_0x5800('0x2c')][_0x5800('0x4d')](_['merge'](_0x3e4f59,_0x2ada1f['body']),{'include':_0x2ada1f[_0x5800('0x31')][_0x5800('0x4e')]?[{'all':!![]}]:undefined});}})[_0x5800('0x24')](respondWithResult(_0x320eea,0xc9))[_0x5800('0x44')](handleError(_0x320eea,null));};exports[_0x5800('0x23')]=function(_0x520e0d,_0x4b8491){if(_0x520e0d[_0x5800('0x4c')]['id']){delete _0x520e0d[_0x5800('0x4c')]['id'];}return db['Attachment'][_0x5800('0x47')]({'where':{'id':_0x520e0d['params']['id']}})[_0x5800('0x24')](handleEntityNotFound(_0x4b8491,null))[_0x5800('0x24')](saveUpdates(_0x520e0d[_0x5800('0x4c')],null))[_0x5800('0x24')](respondWithResult(_0x4b8491,null))[_0x5800('0x44')](handleError(_0x4b8491,null));};exports[_0x5800('0x4f')]=function(_0x5bfe07,_0x3c4cf5){return db[_0x5800('0x2c')][_0x5800('0x47')]({'where':{'id':_0x5bfe07[_0x5800('0x46')]['id']}})[_0x5800('0x24')](handleEntityNotFound(_0x3c4cf5,null))[_0x5800('0x24')](removeEntity(_0x3c4cf5,null))['catch'](handleError(_0x3c4cf5,null));};exports['create']=function(_0x2909a6,_0x289b23,_0x142b37){_0x2909a6[_0x5800('0x4c')]['name']=_0x2909a6['file']['originalname'];_0x2909a6['body'][_0x5800('0x50')]=_0x2909a6[_0x5800('0x51')][_0x5800('0x52')];_0x2909a6[_0x5800('0x4c')][_0x5800('0x3f')]=_0x2909a6['file']['mimetype'];return db['Attachment'][_0x5800('0x4d')](_0x2909a6[_0x5800('0x4c')])[_0x5800('0x24')](respondWithResult(_0x289b23,0xc9))[_0x5800('0x44')](handleError(_0x289b23,null));};exports[_0x5800('0x53')]=function(_0x306710,_0x353540,_0x520a30){return db[_0x5800('0x2c')]['findOne']({'where':{'id':_0x306710['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x353540,null))[_0x5800('0x24')](function(_0x51d2bc){if(_0x51d2bc){var _0x3b399d=_0x51d2bc['ChatOfflineMessageId']!==null;var _0x42a954=path[_0x5800('0x54')](config[_0x5800('0x55')],_0x5800('0x56'));if(_0x3b399d){_0x42a954=path['join'](_0x42a954,'offline-chat/');}var _0x7769a5=path[_0x5800('0x54')](_0x42a954,_0x51d2bc[_0x5800('0x50')]);return _0x353540[_0x5800('0x53')](_0x7769a5);}})['catch'](handleError(_0x353540,null));}; \ No newline at end of file +var _0xa7fe=['../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','Attachment','count','includeAll','include','findAll','catch','params','rawAttributes','merge','options','find','get','omit','body','createdAt','updatedAt','create','update','file','basename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api'];(function(_0x1ccefa,_0x5f0dd9){var _0x2ffc70=function(_0x552c06){while(--_0x552c06){_0x1ccefa['push'](_0x1ccefa['shift']());}};_0x2ffc70(++_0x5f0dd9);}(_0xa7fe,0x142));var _0xea7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xea7f('0x0'));var rimraf=require(_0xea7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea7f('0x2'));var rp=require(_0xea7f('0x3'));var moment=require(_0xea7f('0x4'));var BPromise=require(_0xea7f('0x5'));var Mustache=require(_0xea7f('0x6'));var util=require(_0xea7f('0x7'));var path=require(_0xea7f('0x8'));var sox=require(_0xea7f('0x9'));var csv=require(_0xea7f('0xa'));var ejs=require(_0xea7f('0xb'));var fs=require('fs');var fs_extra=require(_0xea7f('0xc'));var _=require(_0xea7f('0xd'));var squel=require('squel');var crypto=require(_0xea7f('0xe'));var jsforce=require(_0xea7f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xea7f('0xa'));var querystring=require(_0xea7f('0x10'));var Papa=require(_0xea7f('0x11'));var Redis=require(_0xea7f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea7f('0x13'));var logger=require(_0xea7f('0x14'))(_0xea7f('0x15'));var utils=require(_0xea7f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xea7f('0x17'))['db'];function respondWithStatusCode(_0x54d84c,_0x2a3703){_0x2a3703=_0x2a3703||0xcc;return function(_0x154f26){if(_0x154f26){return _0x54d84c[_0xea7f('0x18')](_0x2a3703);}return _0x54d84c[_0xea7f('0x19')](_0x2a3703)[_0xea7f('0x1a')]();};}function respondWithResult(_0x4d20bc,_0x5c5e72){_0x5c5e72=_0x5c5e72||0xc8;return function(_0x13563b){if(_0x13563b){return _0x4d20bc[_0xea7f('0x19')](_0x5c5e72)['json'](_0x13563b);}};}function respondWithFilteredResult(_0x6f833c,_0x2f2d8d){return function(_0x8b9b7e){if(_0x8b9b7e){var _0x19309d=typeof _0x2f2d8d[_0xea7f('0x1b')]==='undefined'&&typeof _0x2f2d8d[_0xea7f('0x1c')]===_0xea7f('0x1d');var _0x515a39=_0x8b9b7e['count'];var _0x33a1ff=_0x19309d?0x0:_0x2f2d8d['offset'];var _0x2862a3=_0x19309d?_0x8b9b7e['count']:_0x2f2d8d[_0xea7f('0x1b')]+_0x2f2d8d[_0xea7f('0x1c')];var _0x515b8d;if(_0x2862a3>=_0x515a39){_0x2862a3=_0x515a39;_0x515b8d=0xc8;}else{_0x515b8d=0xce;}_0x6f833c[_0xea7f('0x19')](_0x515b8d);return _0x6f833c[_0xea7f('0x1e')]('Content-Range',_0x33a1ff+'-'+_0x2862a3+'/'+_0x515a39)['json'](_0x8b9b7e);}return null;};}function patchUpdates(_0x1dc282){return function(_0x4dae2d){try{jsonpatch[_0xea7f('0x1f')](_0x4dae2d,_0x1dc282,!![]);}catch(_0x5498d9){return BPromise[_0xea7f('0x20')](_0x5498d9);}return _0x4dae2d[_0xea7f('0x21')]();};}function saveUpdates(_0x4cdc8d,_0x49059f){return function(_0x2867c2){if(_0x2867c2){return _0x2867c2['update'](_0x4cdc8d)[_0xea7f('0x22')](function(_0x498441){return _0x498441;});}return null;};}function removeEntity(_0x3bd639,_0x5ccd83){return function(_0x1e1989){if(_0x1e1989){return _0x1e1989[_0xea7f('0x23')]()[_0xea7f('0x22')](function(){_0x3bd639['status'](0xcc)[_0xea7f('0x1a')]();});}};}function handleEntityNotFound(_0x139236,_0x42c42f){return function(_0x5814bc){if(!_0x5814bc){_0x139236[_0xea7f('0x18')](0x194);}return _0x5814bc;};}function handleError(_0x3dd0ab,_0x3cb148){_0x3cb148=_0x3cb148||0x1f4;return function(_0x1dc081){logger[_0xea7f('0x24')](_0x1dc081[_0xea7f('0x25')]);if(_0x1dc081[_0xea7f('0x26')]){delete _0x1dc081[_0xea7f('0x26')];}_0x3dd0ab['status'](_0x3cb148)[_0xea7f('0x27')](_0x1dc081);};}exports[_0xea7f('0x28')]=function(_0x2f6049,_0x3db025){var _0x1693f2={},_0x3f7f39={},_0x8061eb={'count':0x0,'rows':[]};var _0x43f960=_[_0xea7f('0x29')](db['Attachment']['rawAttributes'],function(_0x17f1ea){return{'name':_0x17f1ea[_0xea7f('0x2a')],'type':_0x17f1ea[_0xea7f('0x2b')][_0xea7f('0x2c')]};});_0x3f7f39[_0xea7f('0x2d')]=_[_0xea7f('0x29')](_0x43f960,_0xea7f('0x26'));_0x3f7f39['query']=_[_0xea7f('0x2e')](_0x2f6049[_0xea7f('0x2f')]);_0x3f7f39[_0xea7f('0x30')]=_[_0xea7f('0x31')](_0x3f7f39[_0xea7f('0x2d')],_0x3f7f39[_0xea7f('0x2f')]);_0x1693f2[_0xea7f('0x32')]=_[_0xea7f('0x31')](_0x3f7f39[_0xea7f('0x2d')],qs[_0xea7f('0x33')](_0x2f6049[_0xea7f('0x2f')][_0xea7f('0x33')]));_0x1693f2['attributes']=_0x1693f2[_0xea7f('0x32')][_0xea7f('0x34')]?_0x1693f2[_0xea7f('0x32')]:_0x3f7f39[_0xea7f('0x2d')];if(!_0x2f6049[_0xea7f('0x2f')][_0xea7f('0x35')](_0xea7f('0x36'))){_0x1693f2[_0xea7f('0x1c')]=qs['limit'](_0x2f6049[_0xea7f('0x2f')][_0xea7f('0x1c')]);_0x1693f2[_0xea7f('0x1b')]=qs['offset'](_0x2f6049['query'][_0xea7f('0x1b')]);}_0x1693f2[_0xea7f('0x37')]=qs[_0xea7f('0x38')](_0x2f6049[_0xea7f('0x2f')][_0xea7f('0x38')]);_0x1693f2['where']=qs[_0xea7f('0x30')](_[_0xea7f('0x39')](_0x2f6049[_0xea7f('0x2f')],_0x3f7f39[_0xea7f('0x30')]),_0x43f960);if(_0x2f6049[_0xea7f('0x2f')][_0xea7f('0x3a')]){_0x1693f2['where']=_['merge'](_0x1693f2[_0xea7f('0x3b')],{'$or':_['map'](_0x43f960,function(_0x3f3715){if(_0x3f3715['type']!=='VIRTUAL'){var _0x5118da={};_0x5118da[_0x3f3715['name']]={'$like':'%'+_0x2f6049[_0xea7f('0x2f')][_0xea7f('0x3a')]+'%'};return _0x5118da;}})});}_0x1693f2=_['merge']({},_0x1693f2,_0x2f6049['options']);var _0xe41079={'where':_0x1693f2[_0xea7f('0x3b')]};return db[_0xea7f('0x3c')][_0xea7f('0x3d')](_0xe41079)[_0xea7f('0x22')](function(_0x271220){_0x8061eb[_0xea7f('0x3d')]=_0x271220;if(_0x2f6049[_0xea7f('0x2f')][_0xea7f('0x3e')]){_0x1693f2[_0xea7f('0x3f')]=[{'all':!![]}];}return db[_0xea7f('0x3c')][_0xea7f('0x40')](_0x1693f2);})['then'](function(_0x3173ff){_0x8061eb['rows']=_0x3173ff;return _0x8061eb;})['then'](respondWithFilteredResult(_0x3db025,_0x1693f2))[_0xea7f('0x41')](handleError(_0x3db025,null));};exports['show']=function(_0x13a0b9,_0x5a4f5d){var _0x1e0f42={'raw':!![],'where':{'id':_0x13a0b9[_0xea7f('0x42')]['id']}},_0x18b6a4={};_0x18b6a4[_0xea7f('0x2d')]=_[_0xea7f('0x2e')](db[_0xea7f('0x3c')][_0xea7f('0x43')]);_0x18b6a4['query']=_[_0xea7f('0x2e')](_0x13a0b9[_0xea7f('0x2f')]);_0x18b6a4[_0xea7f('0x30')]=_[_0xea7f('0x31')](_0x18b6a4['model'],_0x18b6a4[_0xea7f('0x2f')]);_0x1e0f42[_0xea7f('0x32')]=_[_0xea7f('0x31')](_0x18b6a4[_0xea7f('0x2d')],qs[_0xea7f('0x33')](_0x13a0b9[_0xea7f('0x2f')][_0xea7f('0x33')]));_0x1e0f42[_0xea7f('0x32')]=_0x1e0f42[_0xea7f('0x32')][_0xea7f('0x34')]?_0x1e0f42[_0xea7f('0x32')]:_0x18b6a4[_0xea7f('0x2d')];if(_0x13a0b9['query'][_0xea7f('0x3e')]){_0x1e0f42[_0xea7f('0x3f')]=[{'all':!![]}];}_0x1e0f42=_[_0xea7f('0x44')]({},_0x1e0f42,_0x13a0b9[_0xea7f('0x45')]);return db[_0xea7f('0x3c')]['find'](_0x1e0f42)['then'](handleEntityNotFound(_0x5a4f5d,null))['then'](respondWithResult(_0x5a4f5d,null))[_0xea7f('0x41')](handleError(_0x5a4f5d,null));};exports['clone']=function(_0x3abbae,_0xdbfc0b){var _0x42252a={'where':{'id':_0x3abbae['params']['id']}},_0x23e432={};_0x23e432[_0xea7f('0x2d')]=_['keys'](db[_0xea7f('0x3c')][_0xea7f('0x43')]);_0x42252a['attributes']=_[_0xea7f('0x31')](_0x23e432[_0xea7f('0x2d')],qs[_0xea7f('0x33')](_0x3abbae[_0xea7f('0x2f')][_0xea7f('0x33')]));_0x42252a[_0xea7f('0x32')]=_0x42252a['attributes'][_0xea7f('0x34')]?_0x42252a[_0xea7f('0x32')]:_0x23e432['model'];if(_0x3abbae[_0xea7f('0x2f')]['includeAll']){_0x42252a[_0xea7f('0x3f')]=[{'all':!![]}];}_0x42252a=_['merge']({},_0x42252a,_0x3abbae['options']);return db[_0xea7f('0x3c')][_0xea7f('0x46')](_0x42252a)['then'](handleEntityNotFound(_0xdbfc0b,null))['then'](function(_0x42fb4d){if(_0x42fb4d){var _0x8e1f27=_0x42fb4d[_0xea7f('0x47')]({'plain':!![]});_0x8e1f27=qs[_0xea7f('0x48')](_0x8e1f27,['id','createdAt','updatedAt']);_0x3abbae[_0xea7f('0x49')]=_[_0xea7f('0x48')](_0x3abbae['body'],['id',_0xea7f('0x4a'),_0xea7f('0x4b')]);return db[_0xea7f('0x3c')][_0xea7f('0x4c')](_[_0xea7f('0x44')](_0x8e1f27,_0x3abbae[_0xea7f('0x49')]),{'include':_0x3abbae[_0xea7f('0x2f')][_0xea7f('0x3e')]?[{'all':!![]}]:undefined});}})[_0xea7f('0x22')](respondWithResult(_0xdbfc0b,0xc9))[_0xea7f('0x41')](handleError(_0xdbfc0b,null));};exports[_0xea7f('0x4d')]=function(_0x231a96,_0x1a4b92){if(_0x231a96['body']['id']){delete _0x231a96[_0xea7f('0x49')]['id'];}return db[_0xea7f('0x3c')][_0xea7f('0x46')]({'where':{'id':_0x231a96[_0xea7f('0x42')]['id']}})[_0xea7f('0x22')](handleEntityNotFound(_0x1a4b92,null))[_0xea7f('0x22')](saveUpdates(_0x231a96[_0xea7f('0x49')],null))['then'](respondWithResult(_0x1a4b92,null))[_0xea7f('0x41')](handleError(_0x1a4b92,null));};exports[_0xea7f('0x23')]=function(_0x1a95cc,_0xd1152){return db[_0xea7f('0x3c')][_0xea7f('0x46')]({'where':{'id':_0x1a95cc[_0xea7f('0x42')]['id']}})[_0xea7f('0x22')](handleEntityNotFound(_0xd1152,null))[_0xea7f('0x22')](removeEntity(_0xd1152,null))['catch'](handleError(_0xd1152,null));};exports[_0xea7f('0x4c')]=function(_0x17d89a,_0x3c3c16,_0x22a584){_0x17d89a['body']['name']=_0x17d89a[_0xea7f('0x4e')]['originalname'];_0x17d89a[_0xea7f('0x49')][_0xea7f('0x4f')]=_0x17d89a['file']['filename'];_0x17d89a[_0xea7f('0x49')][_0xea7f('0x2b')]=_0x17d89a[_0xea7f('0x4e')][_0xea7f('0x50')];return db[_0xea7f('0x3c')]['create'](_0x17d89a[_0xea7f('0x49')])[_0xea7f('0x22')](respondWithResult(_0x3c3c16,0xc9))[_0xea7f('0x41')](handleError(_0x3c3c16,null));};exports[_0xea7f('0x51')]=function(_0x651b4d,_0x5445b6,_0x405650){return db['Attachment'][_0xea7f('0x52')]({'where':{'id':_0x651b4d['params']['id']},'raw':!![]})[_0xea7f('0x22')](handleEntityNotFound(_0x5445b6,null))['then'](function(_0x33c5c0){if(_0x33c5c0){var _0x347223=_0x33c5c0[_0xea7f('0x53')]!==null;var _0x161fa7=path[_0xea7f('0x54')](config['root'],_0xea7f('0x55'));if(_0x347223){_0x161fa7=path[_0xea7f('0x54')](_0x161fa7,'offline-chat/');}var _0x55fe00=path[_0xea7f('0x54')](_0x161fa7,_0x33c5c0[_0xea7f('0x4f')]);return _0x5445b6[_0xea7f('0x51')](_0x55fe00);}})[_0xea7f('0x41')](handleError(_0x5445b6,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 86f161c..a816fc3 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 _0x5f8d=['define','Attachment','attachments','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x458b29,_0x42a728){var _0x1f5d48=function(_0x14d382){while(--_0x14d382){_0x458b29['push'](_0x458b29['shift']());}};_0x1f5d48(++_0x42a728);}(_0x5f8d,0x1d7));var _0xd5f8=function(_0x32e9c5,_0x2a90d3){_0x32e9c5=_0x32e9c5-0x0;var _0x285708=_0x5f8d[_0x32e9c5];return _0x285708;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd5f8('0x0'))('api');var moment=require(_0xd5f8('0x1'));var BPromise=require(_0xd5f8('0x2'));var rp=require(_0xd5f8('0x3'));var fs=require('fs');var path=require(_0xd5f8('0x4'));var rimraf=require(_0xd5f8('0x5'));var config=require(_0xd5f8('0x6'));var attributes=require(_0xd5f8('0x7'));module[_0xd5f8('0x8')]=function(_0x5a8f1f,_0x3a2aa6){return _0x5a8f1f[_0xd5f8('0x9')](_0xd5f8('0xa'),attributes,{'tableName':_0xd5f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87a2=['exports','define','Attachment','attachments','lodash','util','api','moment','bluebird','rimraf'];(function(_0x4eb832,_0x324bff){var _0x2e5927=function(_0x4687ce){while(--_0x4687ce){_0x4eb832['push'](_0x4eb832['shift']());}};_0x2e5927(++_0x324bff);}(_0x87a2,0xcc));var _0x287a=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x87a2[_0x2a453b];return _0x132f79;};'use strict';var _=require(_0x287a('0x0'));var util=require(_0x287a('0x1'));var logger=require('../../config/logger')(_0x287a('0x2'));var moment=require(_0x287a('0x3'));var BPromise=require(_0x287a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x287a('0x5'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x287a('0x6')]=function(_0x92d3d5,_0x4b1f9d){return _0x92d3d5[_0x287a('0x7')](_0x287a('0x8'),attributes,{'tableName':_0x287a('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 21d132c..c3e7fd0 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 _0x4517=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateAttachment','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4517,0x112));var _0x7451=function(_0x288050,_0x9e8961){_0x288050=_0x288050-0x0;var _0x1d0684=_0x4517[_0x288050];return _0x1d0684;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var moment=require(_0x7451('0x1'));var BPromise=require('bluebird');var rs=require(_0x7451('0x2'));var fs=require('fs');var Redis=require(_0x7451('0x3'));var db=require(_0x7451('0x4'))['db'];var utils=require(_0x7451('0x5'));var logger=require(_0x7451('0x6'))(_0x7451('0x7'));var config=require(_0x7451('0x8'));var jayson=require(_0x7451('0x9'));var client=jayson[_0x7451('0xa')][_0x7451('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac271,_0x1bfc08,_0x26306e){return new BPromise(function(_0x443b80,_0x2c2ace){return client[_0x7451('0xc')](_0x3ac271,_0x26306e)[_0x7451('0xd')](function(_0x4b7888){logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));logger[_0x7451('0x11')](_0x7451('0x12'),_0x1bfc08,_0x7451('0x10'),JSON[_0x7451('0x13')](_0x4b7888));if(_0x4b7888['error']){if(_0x4b7888['error'][_0x7451('0x14')]===0x1f4){logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')]['message']);return _0x2c2ace(_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);}logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);return _0x443b80(_0x4b7888[_0x7451('0x15')]['message']);}else{logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));_0x443b80(_0x4b7888['result']['message']);}})[_0x7451('0x17')](function(_0x1db688){logger[_0x7451('0x15')](_0x7451('0xf'),_0x1bfc08,_0x1db688);_0x2c2ace(_0x1db688);});});}exports[_0x7451('0x18')]=function(_0xd47ee4){var _0x31a4b2=this;return new Promise(function(_0x1120b1,_0x125ab1){return db['Attachment'][_0x7451('0x19')](_0xd47ee4[_0x7451('0x1a')],{'raw':_0xd47ee4[_0x7451('0x1b')]?_0xd47ee4['options'][_0x7451('0x1c')]===undefined?!![]:![]:!![]})[_0x7451('0xd')](function(_0x3ffb08){logger[_0x7451('0xe')](_0x7451('0x18'),_0xd47ee4);logger[_0x7451('0x11')](_0x7451('0x18'),_0xd47ee4,JSON['stringify'](_0x3ffb08));_0x1120b1(_0x3ffb08);})[_0x7451('0x17')](function(_0x309be0){logger['error'](_0x7451('0x18'),_0x309be0[_0x7451('0x16')],_0xd47ee4);_0x125ab1(_0x31a4b2[_0x7451('0x15')](0x1f4,_0x309be0['message']));});});}; \ No newline at end of file +var _0x4d46=['debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','info','result','catch','Attachment','create','body','options','raw','then','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request\x20sent'];(function(_0x1d6cb8,_0x31a3f3){var _0x38a43f=function(_0x4ef6bd){while(--_0x4ef6bd){_0x1d6cb8['push'](_0x1d6cb8['shift']());}};_0x38a43f(++_0x31a3f3);}(_0x4d46,0x197));var _0x64d4=function(_0x913c5f,_0x1d68db){_0x913c5f=_0x913c5f-0x0;var _0xe39136=_0x4d46[_0x913c5f];return _0xe39136;};'use strict';var _=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var moment=require(_0x64d4('0x2'));var BPromise=require(_0x64d4('0x3'));var rs=require(_0x64d4('0x4'));var fs=require('fs');var Redis=require(_0x64d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x64d4('0x6'));var logger=require(_0x64d4('0x7'))(_0x64d4('0x8'));var config=require(_0x64d4('0x9'));var jayson=require(_0x64d4('0xa'));var client=jayson[_0x64d4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321a51,_0x33b72d,_0x51faf7){return new BPromise(function(_0x45158d,_0x34d00a){return client['request'](_0x321a51,_0x51faf7)['then'](function(_0x4d9e23){logger['info']('Attachment,\x20%s,\x20%s',_0x33b72d,_0x64d4('0xc'));logger[_0x64d4('0xd')](_0x64d4('0xe'),_0x33b72d,_0x64d4('0xc'),JSON[_0x64d4('0xf')](_0x4d9e23));if(_0x4d9e23[_0x64d4('0x10')]){if(_0x4d9e23[_0x64d4('0x10')][_0x64d4('0x11')]===0x1f4){logger[_0x64d4('0x10')]('Attachment,\x20%s,\x20%s',_0x33b72d,_0x4d9e23[_0x64d4('0x10')]['message']);return _0x34d00a(_0x4d9e23[_0x64d4('0x10')][_0x64d4('0x12')]);}logger[_0x64d4('0x10')](_0x64d4('0x13'),_0x33b72d,_0x4d9e23[_0x64d4('0x10')][_0x64d4('0x12')]);return _0x45158d(_0x4d9e23['error'][_0x64d4('0x12')]);}else{logger[_0x64d4('0x14')](_0x64d4('0x13'),_0x33b72d,_0x64d4('0xc'));_0x45158d(_0x4d9e23[_0x64d4('0x15')][_0x64d4('0x12')]);}})[_0x64d4('0x16')](function(_0x4b3335){logger[_0x64d4('0x10')](_0x64d4('0x13'),_0x33b72d,_0x4b3335);_0x34d00a(_0x4b3335);});});}exports['CreateAttachment']=function(_0x1bbaf0){var _0x155b60=this;return new Promise(function(_0x13900e,_0xe79978){return db[_0x64d4('0x17')][_0x64d4('0x18')](_0x1bbaf0[_0x64d4('0x19')],{'raw':_0x1bbaf0[_0x64d4('0x1a')]?_0x1bbaf0['options'][_0x64d4('0x1b')]===undefined?!![]:![]:!![]})[_0x64d4('0x1c')](function(_0x35ee04){logger[_0x64d4('0x14')]('CreateAttachment',_0x1bbaf0);logger['debug'](_0x64d4('0x1d'),_0x1bbaf0,JSON[_0x64d4('0xf')](_0x35ee04));_0x13900e(_0x35ee04);})[_0x64d4('0x16')](function(_0x4c0b0b){logger[_0x64d4('0x10')](_0x64d4('0x1d'),_0x4c0b0b[_0x64d4('0x12')],_0x1bbaf0);_0xe79978(_0x155b60[_0x64d4('0x10')](0x1f4,_0x4c0b0b[_0x64d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a784ebc..b8c2ca9 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x0b0e,0x187));var _0xe0b0=function(_0x290492,_0x18cfad){_0x290492=_0x290492-0x0;var _0x52b5bf=_0x0b0e[_0x290492];return _0x52b5bf;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5e80ecd..8759314 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x095d=['../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','blocked','blockedAt','online','admin','user','agent','domain','blockDuration','add','clearBlockUser','getLicense','status','send','message','login','ad-login','signToken','json','User','Strategy','activedirectory2','bluebird','util'];(function(_0x2ccb36,_0x1ae845){var _0x273535=function(_0x2713c9){while(--_0x2713c9){_0x2ccb36['push'](_0x2ccb36['shift']());}};_0x273535(++_0x1ae845);}(_0x095d,0xdd));var _0xd095=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x095d[_0x5216e0];return _0x5b3f40;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0xd095('0x0')];var moment=require('moment');var ActiveDirectory=require(_0xd095('0x1'));var BPromise=require(_0xd095('0x2'));var util=require(_0xd095('0x3'));var db=require(_0xd095('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xd095('0x5'));var config=require(_0xd095('0x6'));var logger=require(_0xd095('0x7'))(_0xd095('0x8'));function isActiveDirectoryConfigured(_0x392bde){var _0x335fc8=![];if(typeof _0x392bde[_0xd095('0x9')]!==_0xd095('0xa')){_0x335fc8=_0x392bde[_0xd095('0x9')][_0xd095('0xb')]&&_0x392bde[_0xd095('0x9')]['url']&&_0x392bde[_0xd095('0x9')]['domain'];}return _0x335fc8;}function adAuthenticate(_0x3cd0d9,_0x4b1207,_0x93a97b){return new BPromise(function(_0x17c744,_0x2834b8){try{var _0x2ee5f7=new ActiveDirectory(_0x3cd0d9);_0x2ee5f7[_0xd095('0xc')](_0x4b1207,_0x93a97b,function(_0x1c4089,_0x4ee079){if(_0x1c4089){logger[_0xd095('0xd')](_0xd095('0xe'),_0x4b1207,util[_0xd095('0xf')](_0x1c4089,{'showHidden':![],'depth':null}));_0x2834b8(_0xd095('0x10'));}else if(!_0x4ee079){logger['error'](_0xd095('0x11'),_0x4b1207);_0x2834b8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x17c744(_0x4ee079);}});}catch(_0x10c276){_0x2834b8(_0x10c276);}});}function ActiveDirectoryAuthenticate(_0x1dcfde,_0x145637,_0x5973ae,_0x40390f){var _0x521793,_0x5e08d1;if(!isActiveDirectoryConfigured(config)){logger[_0xd095('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x145637);return _0x40390f(null,![],{'message':_0xd095('0x10')});}return db[_0xd095('0x12')][_0xd095('0x13')]({'where':{'id':0x1},'attributes':[_0xd095('0x14'),'blockDuration'],'raw':!![]})[_0xd095('0x15')](function(_0x2606fd){_0x521793=_0x2606fd;if(!_0x521793[_0xd095('0x14')]){logger[_0xd095('0xd')](_0xd095('0x16'),_0x145637);throw new Error(_0xd095('0x10'));}return _0x1dcfde[_0xd095('0x13')]({'attributes':['id',_0xd095('0x17'),_0xd095('0x18'),'salt',_0xd095('0x19'),'disabled',_0xd095('0x1a'),_0xd095('0x1b'),_0xd095('0x1c')],'where':{'name':_0x145637,'role':{'$or':[_0xd095('0x1d'),_0xd095('0x1e'),_0xd095('0x1f')]},'adSsoEnabled':!![]}});})[_0xd095('0x15')](function(_0x6384d){if(!_0x6384d||_0x6384d&&_0x6384d[_0xd095('0x17')]!==_0x145637){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5e08d1=_0x6384d;var _0x44001b=_0x5e08d1[_0xd095('0x17')]+'@'+config['activedirectory'][_0xd095('0x20')];return adAuthenticate(config['activedirectory'],_0x44001b,_0x5973ae);})[_0xd095('0x15')](function(_0x22c7ec){if(_0x5e08d1['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x521793[_0xd095('0x21')]>0x0){if(_0x5e08d1[_0xd095('0x1a')]){if(moment(_0x5e08d1['blockedAt'])[_0xd095('0x22')](_0x521793[_0xd095('0x21')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xd095('0x23')](_0x5e08d1,0x0,![],null)[_0xd095('0x15')](function(){return utils['getLicense'](_0x5e08d1);})[_0xd095('0x15')](function(){return _0x40390f(null,_0x5e08d1);});}else{return utils[_0xd095('0x24')](_0x5e08d1)[_0xd095('0x15')](function(){return _0x40390f(null,_0x5e08d1);});}}else{return utils[_0xd095('0x24')](_0x5e08d1)['then'](function(){return _0x40390f(null,_0x5e08d1);});}})['catch'](function(_0x213e38){return _0x40390f(null,![],_0x213e38);});}function handleError(_0x456215,_0x1125cf,_0x1ba3af){return _0x456215[_0xd095('0x25')](_0x1125cf||0x1f4)[_0xd095('0x26')]({'message':_0x1ba3af?_0x1ba3af[_0xd095('0x27')]||_0x1ba3af:''});}exports[_0xd095('0x28')]=function(_0x54a170,_0x148096,_0x33ebb4){passport[_0xd095('0xc')](_0xd095('0x29'),function(_0x4ba1a6,_0x57860f,_0x11f4bd){var _0x516eaa=_0x4ba1a6||_0x11f4bd;if(_0x516eaa){return handleError(_0x148096,0x191,_0x516eaa);}if(!_0x57860f){return handleError(_0x148096,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3da2e2={'payload':{'id':_0x57860f['id'],'role':_0x57860f[_0xd095('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0xd095('0x2a')](_0x3da2e2)['then'](function(_0x1bcc2a){_0x148096[_0xd095('0x2b')]({'id':_0x57860f['id'],'token':_0x1bcc2a,'statusCall':'','isAlreadyLogged':_0x57860f[_0xd095('0x1c')]});});}})(_0x54a170,_0x148096,_0x33ebb4);};passport['use'](_0xd095('0x29'),new LocalStrategy({'usernameField':_0xd095('0x17'),'passwordField':_0xd095('0x18')},function(_0x45b1f0,_0x4aac55,_0x5e777f){return ActiveDirectoryAuthenticate(db[_0xd095('0x2c')],_0x45b1f0,_0x4aac55,_0x5e777f);})); \ No newline at end of file +var _0x6fe4=['minutes','clearBlockUser','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','undefined','activedirectory','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','role','disabled','online','admin','agent','blocked','blockedAt'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6fe4,0xc8));var _0x46fe=function(_0x2c1f4f,_0xa3c2c8){_0x2c1f4f=_0x2c1f4f-0x0;var _0x957b1a=_0x6fe4[_0x2c1f4f];return _0x957b1a;};'use strict';var passport=require(_0x46fe('0x0'));var LocalStrategy=require(_0x46fe('0x1'))[_0x46fe('0x2')];var moment=require(_0x46fe('0x3'));var ActiveDirectory=require(_0x46fe('0x4'));var BPromise=require(_0x46fe('0x5'));var util=require(_0x46fe('0x6'));var db=require(_0x46fe('0x7'))['db'];var authService=require(_0x46fe('0x8'));var utils=require('../../config/utils');var config=require(_0x46fe('0x9'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x4a212f){var _0x240d2d=![];if(typeof _0x4a212f['activedirectory']!==_0x46fe('0xa')){_0x240d2d=_0x4a212f[_0x46fe('0xb')]['baseDN']&&_0x4a212f[_0x46fe('0xb')][_0x46fe('0xc')]&&_0x4a212f[_0x46fe('0xb')][_0x46fe('0xd')];}return _0x240d2d;}function adAuthenticate(_0x2154ea,_0xebbc1b,_0x24689f){return new BPromise(function(_0x35c2ff,_0x40501a){try{var _0x5991b1=new ActiveDirectory(_0x2154ea);_0x5991b1[_0x46fe('0xe')](_0xebbc1b,_0x24689f,function(_0x3e61d4,_0x367352){if(_0x3e61d4){logger[_0x46fe('0xf')](_0x46fe('0x10'),_0xebbc1b,util[_0x46fe('0x11')](_0x3e61d4,{'showHidden':![],'depth':null}));_0x40501a(_0x46fe('0x12'));}else if(!_0x367352){logger[_0x46fe('0xf')](_0x46fe('0x13'),_0xebbc1b);_0x40501a(_0x46fe('0x12'));}else{_0x35c2ff(_0x367352);}});}catch(_0x572b9e){_0x40501a(_0x572b9e);}});}function ActiveDirectoryAuthenticate(_0x3d40d9,_0x55dbf4,_0x281bbb,_0xfe22bd){var _0x13dec3,_0x2a7646;if(!isActiveDirectoryConfigured(config)){logger[_0x46fe('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x55dbf4);return _0xfe22bd(null,![],{'message':_0x46fe('0x12')});}return db[_0x46fe('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0x46fe('0x15'),_0x46fe('0x16')],'raw':!![]})[_0x46fe('0x17')](function(_0x4a92d6){_0x13dec3=_0x4a92d6;if(!_0x13dec3[_0x46fe('0x15')]){logger[_0x46fe('0xf')](_0x46fe('0x18'),_0x55dbf4);throw new Error(_0x46fe('0x12'));}return _0x3d40d9[_0x46fe('0x19')]({'attributes':['id',_0x46fe('0x1a'),_0x46fe('0x1b'),'salt',_0x46fe('0x1c'),_0x46fe('0x1d'),'blocked','blockedAt',_0x46fe('0x1e')],'where':{'name':_0x55dbf4,'role':{'$or':[_0x46fe('0x1f'),'user',_0x46fe('0x20')]},'adSsoEnabled':!![]}});})[_0x46fe('0x17')](function(_0x24ace7){if(!_0x24ace7||_0x24ace7&&_0x24ace7['name']!==_0x55dbf4){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2a7646=_0x24ace7;var _0x5a736b=_0x2a7646[_0x46fe('0x1a')]+'@'+config[_0x46fe('0xb')][_0x46fe('0xd')];return adAuthenticate(config['activedirectory'],_0x5a736b,_0x281bbb);})[_0x46fe('0x17')](function(_0x110ab8){if(_0x2a7646['disabled']){throw new Error(_0x46fe('0x12'));}if(_0x13dec3[_0x46fe('0x16')]>0x0){if(_0x2a7646[_0x46fe('0x21')]){if(moment(_0x2a7646[_0x46fe('0x22')])['add'](_0x13dec3[_0x46fe('0x16')],_0x46fe('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x46fe('0x24')](_0x2a7646,0x0,![],null)[_0x46fe('0x17')](function(){return utils[_0x46fe('0x25')](_0x2a7646);})['then'](function(){return _0xfe22bd(null,_0x2a7646);});}else{return utils[_0x46fe('0x25')](_0x2a7646)[_0x46fe('0x17')](function(){return _0xfe22bd(null,_0x2a7646);});}}else{return utils[_0x46fe('0x25')](_0x2a7646)['then'](function(){return _0xfe22bd(null,_0x2a7646);});}})[_0x46fe('0x26')](function(_0x7ac065){return _0xfe22bd(null,![],_0x7ac065);});}function handleError(_0x1dd469,_0x20064d,_0x5aebd8){return _0x1dd469[_0x46fe('0x27')](_0x20064d||0x1f4)[_0x46fe('0x28')]({'message':_0x5aebd8?_0x5aebd8[_0x46fe('0x29')]||_0x5aebd8:''});}exports['login']=function(_0x6947d4,_0x42a2b1,_0x334218){passport[_0x46fe('0xe')](_0x46fe('0x2a'),function(_0x3c197a,_0x5767e8,_0x7a0d31){var _0x15e63d=_0x3c197a||_0x7a0d31;if(_0x15e63d){return handleError(_0x42a2b1,0x191,_0x15e63d);}if(!_0x5767e8){return handleError(_0x42a2b1,0x194,{'message':_0x46fe('0x2b')});}else{var _0x4c3bc2={'payload':{'id':_0x5767e8['id'],'role':_0x5767e8[_0x46fe('0x1c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4c3bc2)[_0x46fe('0x17')](function(_0x2ca3cf){_0x42a2b1[_0x46fe('0x2c')]({'id':_0x5767e8['id'],'token':_0x2ca3cf,'statusCall':'','isAlreadyLogged':_0x5767e8[_0x46fe('0x1e')]});});}})(_0x6947d4,_0x42a2b1,_0x334218);};passport[_0x46fe('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0x46fe('0x1a'),'passwordField':'password'},function(_0x7945a5,_0x10ecfa,_0x1f0ce3){return ActiveDirectoryAuthenticate(db[_0x46fe('0x2e')],_0x7945a5,_0x10ecfa,_0x1f0ce3);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 5ec24fc..2c2e70f 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe493=['exports','express','Router'];(function(_0x24bbec,_0x3b2d63){var _0x478a94=function(_0x446aea){while(--_0x446aea){_0x24bbec['push'](_0x24bbec['shift']());}};_0x478a94(++_0x3b2d63);}(_0xe493,0xb5));var _0x3e49=function(_0xdcc555,_0x4bee14){_0xdcc555=_0xdcc555-0x0;var _0x112a06=_0xe493[_0xdcc555];return _0x112a06;};'use strict';var express=require(_0x3e49('0x0'));var router=express[_0x3e49('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller['login']);module[_0x3e49('0x2')]=router; \ No newline at end of file +var _0x78ad=['Router','./authActiveDirectory.controller','post','login','express'];(function(_0x246568,_0x57af04){var _0x19b302=function(_0x4ae034){while(--_0x4ae034){_0x246568['push'](_0x246568['shift']());}};_0x19b302(++_0x57af04);}(_0x78ad,0x1da));var _0xd78a=function(_0x39b94d,_0x21cae0){_0x39b94d=_0x39b94d-0x0;var _0x1934fe=_0x78ad[_0x39b94d];return _0x1934fe;};'use strict';var express=require(_0xd78a('0x0'));var router=express[_0xd78a('0x1')]();var controller=require(_0xd78a('0x2'));router[_0xd78a('0x3')]('/',controller[_0xd78a('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 68909c4..7c1fb94 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x7a54,0x106));var _0x47a5=function(_0x56277f,_0x4fc6b9){_0x56277f=_0x56277f-0x0;var _0x38add7=_0x7a54[_0x56277f];return _0x38add7;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x46fa5e,_0x3973d7){var _0x2a9360=function(_0x5673eb){while(--_0x5673eb){_0x46fa5e['push'](_0x46fa5e['shift']());}};_0x2a9360(++_0x3973d7);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index cc1200f..e40c755 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 _0x83b4=['callback','isMiddleware','login','setTokenCookie','Router','./authGoogle.controller','../user/user.controller.js','get'];(function(_0x3b025f,_0x3f4d04){var _0xb129b2=function(_0x2fb05a){while(--_0x2fb05a){_0x3b025f['push'](_0x3b025f['shift']());}};_0xb129b2(++_0x3f4d04);}(_0x83b4,0xc4));var _0x483b=function(_0x20b326,_0x23e1dd){_0x20b326=_0x20b326-0x0;var _0x150fc9=_0x83b4[_0x20b326];return _0x150fc9;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x483b('0x0')]();var controller=require(_0x483b('0x1'));var userController=require(_0x483b('0x2'));var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0x483b('0x3')]('/callback',controller[_0x483b('0x4')],authService[_0x483b('0x5')],userController[_0x483b('0x6')],authService[_0x483b('0x7')]);module['exports']=router; \ No newline at end of file +var _0x53f3=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller'];(function(_0x4247f7,_0x34a9aa){var _0x571ccd=function(_0xf5360d){while(--_0xf5360d){_0x4247f7['push'](_0x4247f7['shift']());}};_0x571ccd(++_0x34a9aa);}(_0x53f3,0xe0));var _0x353f=function(_0xc05e87,_0x5c6dba){_0xc05e87=_0xc05e87-0x0;var _0x47c69f=_0x53f3[_0xc05e87];return _0x47c69f;};'use strict';var express=require(_0x353f('0x0'));var passport=require(_0x353f('0x1'));var router=express[_0x353f('0x2')]();var controller=require(_0x353f('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x353f('0x4'));router[_0x353f('0x5')]('/',controller[_0x353f('0x6')]);router[_0x353f('0x5')](_0x353f('0x7'),controller[_0x353f('0x8')],authService[_0x353f('0x9')],userController[_0x353f('0x6')],authService[_0x353f('0xa')]);module[_0x353f('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 275384f..12f6e23 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 _0x23e6=['validatePasswordPattern','validatePasswordHistory','previousPasswords','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','util','passport','Strategy','jayson/promise','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','clearBlockUser','minutes','catch','getLicense','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','signToken','online','forgot','body','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','/reset/','Reset\x20Email\x20sent!','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','securePassword'];(function(_0x2637bd,_0xdcbfbe){var _0xde2f0d=function(_0x1d7fcb){while(--_0x1d7fcb){_0x2637bd['push'](_0x2637bd['shift']());}};_0xde2f0d(++_0xdcbfbe);}(_0x23e6,0xed));var _0x623e=function(_0x1b16ba,_0xe1a8dc){_0x1b16ba=_0x1b16ba-0x0;var _0x30d703=_0x23e6[_0x1b16ba];return _0x30d703;};'use strict';var util=require(_0x623e('0x0'));var passport=require(_0x623e('0x1'));var LocalStrategy=require('passport-local')[_0x623e('0x2')];var jayson=require(_0x623e('0x3'));var _=require('lodash');var rs=require(_0x623e('0x4'));var moment=require('moment');var db=require(_0x623e('0x5'))['db'];var authService=require(_0x623e('0x6'));var utils=require(_0x623e('0x7'));var client=jayson['client'][_0x623e('0x8')]({'port':0x232b});function localAuthenticate(_0x2d7cba,_0x24af01,_0xcf1866,_0x4adc5c){var _0x518b5e,_0x437668;return db[_0x623e('0x9')][_0x623e('0xa')]({'where':{'id':0x1},'attributes':[_0x623e('0xb'),'blockDuration'],'raw':!![]})[_0x623e('0xc')](function(_0x461726){_0x518b5e=_0x461726;return _0x2d7cba[_0x623e('0xa')]({'attributes':['id',_0x623e('0xd'),_0x623e('0xe'),'salt',_0x623e('0xf'),_0x623e('0x10'),_0x623e('0x11'),_0x623e('0x12'),_0x623e('0x13')],'where':{'name':_0x24af01,'role':{'$or':[_0x623e('0x14'),_0x623e('0x15'),_0x623e('0x16')]}}});})[_0x623e('0xc')](function(_0x4f3a3e){if(!_0x4f3a3e||_0x4f3a3e&&_0x4f3a3e[_0x623e('0xd')]!==_0x24af01){throw new Error(_0x623e('0x17'));}else{_0x437668=_0x4f3a3e;return _0x437668;}})['then'](function(){_0x437668[_0x623e('0x18')](_0xcf1866,function(_0x14c480,_0x4977be){var _0x429943=_0x437668[_0x623e('0x13')]+0x1;if(_0x14c480){return _0x4adc5c(_0x14c480);}else if(!_0x4977be){if(_0x437668[_0x623e('0x10')]){return _0x4adc5c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x518b5e[_0x623e('0xb')]>0x0){if(_0x437668[_0x623e('0x11')]){if(_0x518b5e[_0x623e('0x19')]>0x0){if(moment(_0x437668[_0x623e('0x12')])[_0x623e('0x1a')](_0x518b5e['blockDuration'],'minutes')>moment()){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}else{return utils[_0x623e('0x1b')](_0x437668,_0x429943,![],null)[_0x623e('0xc')](function(){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});});}}else{return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}}else{if(_0x429943>=_0x518b5e[_0x623e('0xb')]){return utils[_0x623e('0x1b')](_0x437668,0x0,!![],moment())[_0x623e('0xc')](function(){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});});}else{return utils[_0x623e('0x1b')](_0x437668,_0x429943,![],null)[_0x623e('0xc')](function(){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});});}}}else{return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}}else{if(_0x437668[_0x623e('0x10')]){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}else if(_0x518b5e[_0x623e('0xb')]>0x0){if(_0x437668[_0x623e('0x11')]){if(_0x518b5e[_0x623e('0x19')]>0x0){if(moment(_0x437668[_0x623e('0x12')])[_0x623e('0x1a')](_0x518b5e[_0x623e('0x19')],_0x623e('0x1c'))>moment()){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}else{return utils[_0x623e('0x1b')](_0x437668,0x0,![],null)[_0x623e('0xc')](function(){return utils['getLicense'](_0x437668);})[_0x623e('0xc')](function(){return _0x4adc5c(null,_0x437668);});}}else{return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}}else{return utils[_0x623e('0x1b')](_0x437668,0x0,![],null)['then'](function(){return utils['getLicense'](_0x437668);})['then'](function(){return _0x4adc5c(null,_0x437668);})[_0x623e('0x1d')](function(_0x42e488){return _0x4adc5c(null,![],_0x42e488);});}}else{if(_0x437668[_0x623e('0x11')]){return _0x4adc5c(null,![],{'message':_0x623e('0x17')});}else{return utils[_0x623e('0x1e')](_0x437668)[_0x623e('0xc')](function(){return _0x4adc5c(null,_0x437668);});}}}});})['catch'](function(_0x519f0f){return _0x4adc5c(null,![],_0x519f0f);});}function sendServiceMail(_0x319c36){return db[_0x623e('0x1f')][_0x623e('0x20')]({'where':{'service':!![]},'attributes':['id',_0x623e('0xd'),_0x623e('0x21')],'include':[{'model':db[_0x623e('0x22')],'as':_0x623e('0x23'),'include':[{'model':db[_0x623e('0x24')],'as':_0x623e('0x24')}]}]})[_0x623e('0xc')](function(_0x273091){if(!_0x273091){throw new Error(_0x623e('0x25'));}var _0xb70723=_0x273091['getSmtpOptions']();var _0x334e80={'account':_0xb70723,'message':_[_0x623e('0x26')]({'from':util[_0x623e('0x27')](_0x623e('0x28'),_0x273091[_0x623e('0xd')],_0x273091[_0x623e('0x21')]||_0x273091[_0x623e('0x23')][_0x623e('0x15')])},_0x319c36)};return client['request']('SendMail',_0x334e80);})[_0x623e('0xc')](function(_0x31efee){if(_0x31efee[_0x623e('0x29')]){throw new Error(util[_0x623e('0x27')](_0x623e('0x2a'),_0x31efee[_0x623e('0x29')][_0x623e('0x2b')]||JSON[_0x623e('0x2c')](_0x31efee[_0x623e('0x29')])));}return!![];});}function handleError(_0x367a01,_0x560c94,_0x51b3f8){return _0x367a01[_0x623e('0x2d')](_0x560c94||0x1f4)[_0x623e('0x2e')]({'message':_0x51b3f8?_0x51b3f8[_0x623e('0x2b')]||_0x51b3f8:''});}exports[_0x623e('0x2f')]=function(_0x41e8c6,_0x26ebe6,_0x30a1bc){passport[_0x623e('0x18')](_0x623e('0x30'),function(_0x5c7df1,_0x5054ba,_0x3de14b){var _0x4c5b39=_0x5c7df1||_0x3de14b;if(_0x4c5b39){return handleError(_0x26ebe6,0x191,_0x4c5b39);}if(!_0x5054ba){return handleError(_0x26ebe6,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x35c57f={'payload':{'id':_0x5054ba['id'],'role':_0x5054ba['role']},'options':{'expiresIn':0x15180}};return authService[_0x623e('0x31')](_0x35c57f)[_0x623e('0xc')](function(_0x5e2660){_0x26ebe6['json']({'id':_0x5054ba['id'],'token':_0x5e2660,'statusCall':'','isAlreadyLogged':_0x5054ba[_0x623e('0x32')]});});}})(_0x41e8c6,_0x26ebe6,_0x30a1bc);};exports[_0x623e('0x33')]=function(_0x1c1079,_0x17e1f5){if(!_0x1c1079[_0x623e('0x34')][_0x623e('0x21')]){return handleError(_0x17e1f5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xa5a466=rs['generate']();_0x1c1079[_0x623e('0x34')][_0x623e('0x21')]=_0x1c1079['body']['email'][_0x623e('0x35')]()[_0x623e('0x36')]();var _0x4112d7;return db[_0x623e('0x9')][_0x623e('0xa')]({'where':{'id':0x1},'attributes':[_0x623e('0xb'),_0x623e('0x19')],'raw':!![]})[_0x623e('0xc')](function(_0x221c3d){_0x4112d7=_0x221c3d;return db['User'][_0x623e('0x20')]({'where':{'email':_0x1c1079[_0x623e('0x34')][_0x623e('0x21')]}});})['then'](function(_0x5e0e7f){if(!_0x5e0e7f){throw new Error(_0x623e('0x37'));}if(_0x5e0e7f[_0x623e('0x10')]){throw new Error(_0x623e('0x38'));}if(_0x5e0e7f[_0x623e('0x11')]){if(moment(_0x5e0e7f[_0x623e('0x12')])[_0x623e('0x1a')](_0x4112d7[_0x623e('0x19')],_0x623e('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x5e0e7f['blocked']=![];_0x5e0e7f['blockedAt']=null;}}_0x5e0e7f[_0x623e('0x39')]=_0xa5a466;_0x5e0e7f['resetPasswordExpires']=Date[_0x623e('0x3a')]()+0x36ee80;return _0x5e0e7f[_0x623e('0x3b')]();})['then'](function(){return sendServiceMail({'to':_0x1c1079['body'][_0x623e('0x21')],'subject':_0x623e('0x3c'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x623e('0x3d')+'https://'+_0x1c1079['headers'][_0x623e('0x3e')]+_0x623e('0x3f')+_0xa5a466+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x17e1f5[_0x623e('0x2d')](0xc8)[_0x623e('0x2e')]({'message':_0x623e('0x40')});})[_0x623e('0x1d')](function(_0x495641){return handleError(_0x17e1f5,0x1f4,_0x495641);});};exports[_0x623e('0x41')]=function(_0x38dc81,_0x21fdc9){return db[_0x623e('0x42')][_0x623e('0x20')]({'where':{'resetPasswordToken':_0x38dc81[_0x623e('0x43')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x3879bd){if(!_0x3879bd){throw new Error(_0x623e('0x44'));}return db['Setting'][_0x623e('0xa')]({'attributes':['id','securePassword',_0x623e('0x45'),'passwordHistoryLimit']})[_0x623e('0xc')](function(_0x51a863){if(_0x51a863[_0x623e('0x46')])authService[_0x623e('0x47')](_0x38dc81['body'][_0x623e('0xe')]);if(!_0x51a863[_0x623e('0x45')]||!_0x3879bd['previousPasswords'])return _0x3879bd;authService[_0x623e('0x48')](_0x38dc81[_0x623e('0x34')]['password'],_0x3879bd[_0x623e('0x49')],_0x51a863[_0x623e('0x4a')]);return _0x3879bd;})[_0x623e('0xc')](function(){_0x3879bd[_0x623e('0xe')]=_0x38dc81['body'][_0x623e('0xe')];_0x3879bd['resetPasswordToken']=null;_0x3879bd[_0x623e('0x4b')]=null;return _0x3879bd[_0x623e('0x3b')]();});})[_0x623e('0xc')](function(){_0x21fdc9[_0x623e('0x2d')](0xc8)['send']({'message':_0x623e('0x4c')});})[_0x623e('0x1d')](function(_0x4ff9e8){return handleError(_0x21fdc9,0x1f4,_0x4ff9e8);});};passport['use'](_0x623e('0x30'),new LocalStrategy({'usernameField':_0x623e('0xd'),'passwordField':_0x623e('0xe')},function(_0x213210,_0x5acf43,_0x229347){return localAuthenticate(db[_0x623e('0x42')],_0x213210,_0x5acf43,_0x229347);})); \ No newline at end of file +var _0x58d2=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','Strategy','lodash','moment','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','findOne','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','then','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','error','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x592e40,_0x2ed011){var _0x5d4288=function(_0x366e87){while(--_0x366e87){_0x592e40['push'](_0x592e40['shift']());}};_0x5d4288(++_0x2ed011);}(_0x58d2,0x69));var _0x258d=function(_0x3a0579,_0x17d535){_0x3a0579=_0x3a0579-0x0;var _0xa6faf3=_0x58d2[_0x3a0579];return _0xa6faf3;};'use strict';var util=require(_0x258d('0x0'));var passport=require(_0x258d('0x1'));var LocalStrategy=require('passport-local')[_0x258d('0x2')];var jayson=require('jayson/promise');var _=require(_0x258d('0x3'));var rs=require('randomstring');var moment=require(_0x258d('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x258d('0x5'));var utils=require(_0x258d('0x6'));var client=jayson['client'][_0x258d('0x7')]({'port':0x232b});function localAuthenticate(_0x352767,_0x23135b,_0x50600d,_0x1c7438){var _0x9c7ba8,_0x2dabb2;return db[_0x258d('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x258d('0x9'),_0x258d('0xa')],'raw':!![]})['then'](function(_0x564cc0){_0x9c7ba8=_0x564cc0;return _0x352767[_0x258d('0xb')]({'attributes':['id','name',_0x258d('0xc'),_0x258d('0xd'),_0x258d('0xe'),_0x258d('0xf'),_0x258d('0x10'),_0x258d('0x11'),_0x258d('0x12')],'where':{'name':_0x23135b,'role':{'$or':[_0x258d('0x13'),_0x258d('0x14'),_0x258d('0x15')]}}});})['then'](function(_0x7fa00c){if(!_0x7fa00c||_0x7fa00c&&_0x7fa00c['name']!==_0x23135b){throw new Error(_0x258d('0x16'));}else{_0x2dabb2=_0x7fa00c;return _0x2dabb2;}})['then'](function(){_0x2dabb2[_0x258d('0x17')](_0x50600d,function(_0x256625,_0x114786){var _0x28bac7=_0x2dabb2['loginAttempts']+0x1;if(_0x256625){return _0x1c7438(_0x256625);}else if(!_0x114786){if(_0x2dabb2[_0x258d('0xf')]){return _0x1c7438(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x9c7ba8[_0x258d('0x9')]>0x0){if(_0x2dabb2[_0x258d('0x10')]){if(_0x9c7ba8['blockDuration']>0x0){if(moment(_0x2dabb2['blockedAt'])[_0x258d('0x18')](_0x9c7ba8[_0x258d('0xa')],_0x258d('0x19'))>moment()){return _0x1c7438(null,![],{'message':_0x258d('0x16')});}else{return utils['clearBlockUser'](_0x2dabb2,_0x28bac7,![],null)[_0x258d('0x1a')](function(){return _0x1c7438(null,![],{'message':_0x258d('0x16')});});}}else{return _0x1c7438(null,![],{'message':_0x258d('0x16')});}}else{if(_0x28bac7>=_0x9c7ba8[_0x258d('0x9')]){return utils[_0x258d('0x1b')](_0x2dabb2,0x0,!![],moment())[_0x258d('0x1a')](function(){return _0x1c7438(null,![],{'message':_0x258d('0x16')});});}else{return utils['clearBlockUser'](_0x2dabb2,_0x28bac7,![],null)[_0x258d('0x1a')](function(){return _0x1c7438(null,![],{'message':_0x258d('0x16')});});}}}else{return _0x1c7438(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2dabb2[_0x258d('0xf')]){return _0x1c7438(null,![],{'message':_0x258d('0x16')});}else if(_0x9c7ba8[_0x258d('0x9')]>0x0){if(_0x2dabb2[_0x258d('0x10')]){if(_0x9c7ba8[_0x258d('0xa')]>0x0){if(moment(_0x2dabb2[_0x258d('0x11')])[_0x258d('0x18')](_0x9c7ba8['blockDuration'],_0x258d('0x19'))>moment()){return _0x1c7438(null,![],{'message':_0x258d('0x16')});}else{return utils['clearBlockUser'](_0x2dabb2,0x0,![],null)['then'](function(){return utils[_0x258d('0x1c')](_0x2dabb2);})['then'](function(){return _0x1c7438(null,_0x2dabb2);});}}else{return _0x1c7438(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x2dabb2,0x0,![],null)[_0x258d('0x1a')](function(){return utils[_0x258d('0x1c')](_0x2dabb2);})['then'](function(){return _0x1c7438(null,_0x2dabb2);})[_0x258d('0x1d')](function(_0x80b84a){return _0x1c7438(null,![],_0x80b84a);});}}else{if(_0x2dabb2[_0x258d('0x10')]){return _0x1c7438(null,![],{'message':_0x258d('0x16')});}else{return utils[_0x258d('0x1c')](_0x2dabb2)[_0x258d('0x1a')](function(){return _0x1c7438(null,_0x2dabb2);});}}}});})[_0x258d('0x1d')](function(_0xe95354){return _0x1c7438(null,![],_0xe95354);});}function sendServiceMail(_0x250871){return db[_0x258d('0x1e')]['find']({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x258d('0x1f')],'as':_0x258d('0x20'),'include':[{'model':db[_0x258d('0x21')],'as':_0x258d('0x21')}]}]})[_0x258d('0x1a')](function(_0x33b933){if(!_0x33b933){throw new Error(_0x258d('0x22'));}var _0x4b9ab9=_0x33b933[_0x258d('0x23')]();var _0x19205c={'account':_0x4b9ab9,'message':_[_0x258d('0x24')]({'from':util[_0x258d('0x25')](_0x258d('0x26'),_0x33b933['name'],_0x33b933[_0x258d('0x27')]||_0x33b933['Smtp'][_0x258d('0x14')])},_0x250871)};return client['request']('SendMail',_0x19205c);})[_0x258d('0x1a')](function(_0x445b97){if(_0x445b97[_0x258d('0x28')]){throw new Error(util[_0x258d('0x25')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x445b97[_0x258d('0x28')][_0x258d('0x29')]||JSON[_0x258d('0x2a')](_0x445b97[_0x258d('0x28')])));}return!![];});}function handleError(_0x374c8f,_0xe16998,_0xc0fd60){return _0x374c8f[_0x258d('0x2b')](_0xe16998||0x1f4)[_0x258d('0x2c')]({'message':_0xc0fd60?_0xc0fd60[_0x258d('0x29')]||_0xc0fd60:''});}exports[_0x258d('0x2d')]=function(_0x2ee75f,_0x498a60,_0x21314f){passport['authenticate']('local-login',function(_0x547ed8,_0x23b1e1,_0x5b070d){var _0x1e41e5=_0x547ed8||_0x5b070d;if(_0x1e41e5){return handleError(_0x498a60,0x191,_0x1e41e5);}if(!_0x23b1e1){return handleError(_0x498a60,0x194,{'message':_0x258d('0x2e')});}else{var _0x309a93={'payload':{'id':_0x23b1e1['id'],'role':_0x23b1e1[_0x258d('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x258d('0x2f')](_0x309a93)[_0x258d('0x1a')](function(_0xfeb598){_0x498a60[_0x258d('0x30')]({'id':_0x23b1e1['id'],'token':_0xfeb598,'statusCall':'','isAlreadyLogged':_0x23b1e1[_0x258d('0x31')]});});}})(_0x2ee75f,_0x498a60,_0x21314f);};exports[_0x258d('0x32')]=function(_0x35d57b,_0x41a482){if(!_0x35d57b[_0x258d('0x33')][_0x258d('0x27')]){return handleError(_0x41a482,0x1f4,{'message':_0x258d('0x34')});}var _0x571237=rs[_0x258d('0x35')]();_0x35d57b[_0x258d('0x33')][_0x258d('0x27')]=_0x35d57b[_0x258d('0x33')]['email'][_0x258d('0x36')]()[_0x258d('0x37')]();var _0x19fd11;return db[_0x258d('0x8')][_0x258d('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x4d960d){_0x19fd11=_0x4d960d;return db[_0x258d('0x38')][_0x258d('0x39')]({'where':{'email':_0x35d57b[_0x258d('0x33')]['email']}});})[_0x258d('0x1a')](function(_0x1299d4){if(!_0x1299d4){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x1299d4['disabled']){throw new Error(_0x258d('0x3a'));}if(_0x1299d4[_0x258d('0x10')]){if(moment(_0x1299d4[_0x258d('0x11')])['add'](_0x19fd11[_0x258d('0xa')],_0x258d('0x19'))>moment()){throw new Error(_0x258d('0x3b'));}else{_0x1299d4[_0x258d('0x10')]=![];_0x1299d4['blockedAt']=null;}}_0x1299d4[_0x258d('0x3c')]=_0x571237;_0x1299d4[_0x258d('0x3d')]=Date[_0x258d('0x3e')]()+0x36ee80;return _0x1299d4[_0x258d('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0x35d57b[_0x258d('0x33')][_0x258d('0x27')],'subject':_0x258d('0x40'),'text':_0x258d('0x41')+_0x258d('0x42')+'https://'+_0x35d57b[_0x258d('0x43')][_0x258d('0x44')]+'/reset/'+_0x571237+'\x0a\x0a'+_0x258d('0x45')});})[_0x258d('0x1a')](function(){_0x41a482[_0x258d('0x2b')](0xc8)[_0x258d('0x2c')]({'message':_0x258d('0x46')});})['catch'](function(_0x41f768){return handleError(_0x41a482,0x1f4,_0x41f768);});};exports[_0x258d('0x47')]=function(_0x7ce7e4,_0x40898c){return db['User']['find']({'where':{'resetPasswordToken':_0x7ce7e4[_0x258d('0x48')]['token'],'resetPasswordExpires':{'$gt':Date[_0x258d('0x3e')]()}}})[_0x258d('0x1a')](function(_0x5c24d7){if(!_0x5c24d7){throw new Error(_0x258d('0x49'));}return db[_0x258d('0x8')][_0x258d('0xb')]({'attributes':['id',_0x258d('0x4a'),_0x258d('0x4b'),_0x258d('0x4c')]})[_0x258d('0x1a')](function(_0xeecf44){if(_0xeecf44[_0x258d('0x4a')])authService[_0x258d('0x4d')](_0x7ce7e4[_0x258d('0x33')][_0x258d('0xc')]);if(!_0xeecf44[_0x258d('0x4b')]||!_0x5c24d7[_0x258d('0x4e')])return _0x5c24d7;authService[_0x258d('0x4f')](_0x7ce7e4[_0x258d('0x33')][_0x258d('0xc')],_0x5c24d7[_0x258d('0x4e')],_0xeecf44[_0x258d('0x4c')]);return _0x5c24d7;})[_0x258d('0x1a')](function(){_0x5c24d7[_0x258d('0xc')]=_0x7ce7e4[_0x258d('0x33')]['password'];_0x5c24d7[_0x258d('0x3c')]=null;_0x5c24d7[_0x258d('0x3d')]=null;return _0x5c24d7[_0x258d('0x3f')]();});})[_0x258d('0x1a')](function(){_0x40898c['status'](0xc8)[_0x258d('0x2c')]({'message':_0x258d('0x50')});})[_0x258d('0x1d')](function(_0x5a3416){return handleError(_0x40898c,0x1f4,_0x5a3416);});};passport[_0x258d('0x51')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x210a34,_0x1213f2,_0x4b3f90){return localAuthenticate(db[_0x258d('0x38')],_0x210a34,_0x1213f2,_0x4b3f90);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3363714..3d55252 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 _0xceb0=['forgot','/reset/:token','reset','exports','express','./authLocal.controller','post','/forgot'];(function(_0x5fca4f,_0x571272){var _0x30444c=function(_0xb75dc5){while(--_0xb75dc5){_0x5fca4f['push'](_0x5fca4f['shift']());}};_0x30444c(++_0x571272);}(_0xceb0,0x174));var _0x0ceb=function(_0x1894fc,_0x317c9a){_0x1894fc=_0x1894fc-0x0;var _0x4993e5=_0xceb0[_0x1894fc];return _0x4993e5;};'use strict';var express=require(_0x0ceb('0x0'));var router=express['Router']();var controller=require(_0x0ceb('0x1'));router[_0x0ceb('0x2')]('/',controller['login']);router[_0x0ceb('0x2')](_0x0ceb('0x3'),controller[_0x0ceb('0x4')]);router[_0x0ceb('0x2')](_0x0ceb('0x5'),controller[_0x0ceb('0x6')]);module[_0x0ceb('0x7')]=router; \ No newline at end of file +var _0x7d90=['post','/forgot','/reset/:token','reset','exports','express','./authLocal.controller'];(function(_0x4d2943,_0x501535){var _0x51f1b3=function(_0x3432da){while(--_0x3432da){_0x4d2943['push'](_0x4d2943['shift']());}};_0x51f1b3(++_0x501535);}(_0x7d90,0x132));var _0x07d9=function(_0x460e63,_0x8a47d6){_0x460e63=_0x460e63-0x0;var _0x5c65ba=_0x7d90[_0x460e63];return _0x5c65ba;};'use strict';var express=require(_0x07d9('0x0'));var router=express['Router']();var controller=require(_0x07d9('0x1'));router[_0x07d9('0x2')]('/',controller['login']);router[_0x07d9('0x2')](_0x07d9('0x3'),controller['forgot']);router[_0x07d9('0x2')](_0x07d9('0x4'),controller[_0x07d9('0x5')]);module[_0x07d9('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e5821b2..efed69b 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 _0x1c87=['exports','STRING','INTEGER'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1c87,0xc3));var _0x71c8=function(_0x2ce00f,_0x41d23a){_0x2ce00f=_0x2ce00f-0x0;var _0x47f2f7=_0x1c87[_0x2ce00f];return _0x47f2f7;};'use strict';var Sequelize=require('sequelize');module[_0x71c8('0x0')]={'name':{'type':Sequelize[_0x71c8('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x71c8('0x1')]},'description':{'type':Sequelize[_0x71c8('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x71c8('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x07c5=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0xbe5ecd,_0x1a48bd){var _0x27ffa8=function(_0x105001){while(--_0x105001){_0xbe5ecd['push'](_0xbe5ecd['shift']());}};_0x27ffa8(++_0x1a48bd);}(_0x07c5,0x151));var _0x507c=function(_0x4d35e6,_0x5d3ab9){_0x4d35e6=_0x4d35e6-0x0;var _0x14fba6=_0x07c5[_0x4d35e6];return _0x14fba6;};'use strict';var Sequelize=require(_0x507c('0x0'));module[_0x507c('0x1')]={'name':{'type':Sequelize[_0x507c('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x507c('0x2')]},'description':{'type':Sequelize[_0x507c('0x2')]},'status':{'type':Sequelize[_0x507c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x507c('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 7200299..6604f33 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 _0x16b6=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','params','include','options','catch','create','body','find','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x50ab49,_0x2b7733){var _0x14c763=function(_0x592609){while(--_0x592609){_0x50ab49['push'](_0x50ab49['shift']());}};_0x14c763(++_0x2b7733);}(_0x16b6,0x143));var _0x616b=function(_0x39ad89,_0x1ecd5a){_0x39ad89=_0x39ad89-0x0;var _0x2338d8=_0x16b6[_0x39ad89];return _0x2338d8;};'use strict';var emlformat=require(_0x616b('0x0'));var rimraf=require(_0x616b('0x1'));var zipdir=require(_0x616b('0x2'));var jsonpatch=require(_0x616b('0x3'));var rp=require(_0x616b('0x4'));var moment=require(_0x616b('0x5'));var BPromise=require(_0x616b('0x6'));var Mustache=require(_0x616b('0x7'));var util=require(_0x616b('0x8'));var path=require(_0x616b('0x9'));var sox=require(_0x616b('0xa'));var csv=require(_0x616b('0xb'));var ejs=require(_0x616b('0xc'));var fs=require('fs');var fs_extra=require(_0x616b('0xd'));var _=require(_0x616b('0xe'));var squel=require(_0x616b('0xf'));var crypto=require('crypto');var jsforce=require(_0x616b('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x616b('0x11'));var Papa=require('papaparse');var Redis=require(_0x616b('0x12'));var authService=require(_0x616b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x616b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x616b('0x15'));var db=require(_0x616b('0x16'))['db'];function respondWithStatusCode(_0x53142e,_0xff9888){_0xff9888=_0xff9888||0xcc;return function(_0x410a32){if(_0x410a32){return _0x53142e[_0x616b('0x17')](_0xff9888);}return _0x53142e[_0x616b('0x18')](_0xff9888)['end']();};}function respondWithResult(_0x39a4a1,_0x43b8dd){_0x43b8dd=_0x43b8dd||0xc8;return function(_0x4ad19e){if(_0x4ad19e){return _0x39a4a1['status'](_0x43b8dd)[_0x616b('0x19')](_0x4ad19e);}};}function respondWithFilteredResult(_0x19282e,_0x4c9601){return function(_0x5d158c){if(_0x5d158c){var _0xbf7905=typeof _0x4c9601[_0x616b('0x1a')]===_0x616b('0x1b')&&typeof _0x4c9601[_0x616b('0x1c')]===_0x616b('0x1b');var _0x3116f8=_0x5d158c[_0x616b('0x1d')];var _0x2d135d=_0xbf7905?0x0:_0x4c9601[_0x616b('0x1a')];var _0xd14135=_0xbf7905?_0x5d158c['count']:_0x4c9601[_0x616b('0x1a')]+_0x4c9601[_0x616b('0x1c')];var _0x56ca9b;if(_0xd14135>=_0x3116f8){_0xd14135=_0x3116f8;_0x56ca9b=0xc8;}else{_0x56ca9b=0xce;}_0x19282e[_0x616b('0x18')](_0x56ca9b);return _0x19282e['set'](_0x616b('0x1e'),_0x2d135d+'-'+_0xd14135+'/'+_0x3116f8)[_0x616b('0x19')](_0x5d158c);}return null;};}function patchUpdates(_0x328566){return function(_0x54283a){try{jsonpatch[_0x616b('0x1f')](_0x54283a,_0x328566,!![]);}catch(_0x3da462){return BPromise[_0x616b('0x20')](_0x3da462);}return _0x54283a[_0x616b('0x21')]();};}function saveUpdates(_0x5dac99,_0x4eda4){return function(_0x3f5f0d){if(_0x3f5f0d){return _0x3f5f0d[_0x616b('0x22')](_0x5dac99)[_0x616b('0x23')](function(_0xfc68a1){return _0xfc68a1;});}return null;};}function removeEntity(_0x4dd899,_0x254b77){return function(_0x372de8){if(_0x372de8){return _0x372de8[_0x616b('0x24')]()[_0x616b('0x23')](function(){_0x4dd899[_0x616b('0x18')](0xcc)[_0x616b('0x25')]();});}};}function handleEntityNotFound(_0x504ef7,_0x128314){return function(_0x456be3){if(!_0x456be3){_0x504ef7[_0x616b('0x17')](0x194);}return _0x456be3;};}function handleError(_0x1230f7,_0x4db018){_0x4db018=_0x4db018||0x1f4;return function(_0x4266a8){logger[_0x616b('0x26')](_0x4266a8[_0x616b('0x27')]);if(_0x4266a8[_0x616b('0x28')]){delete _0x4266a8[_0x616b('0x28')];}_0x1230f7[_0x616b('0x18')](_0x4db018)[_0x616b('0x29')](_0x4266a8);};}exports[_0x616b('0x2a')]=function(_0xf13c81,_0x4d438b){var _0x5064f2={},_0x29175b={},_0x3f425a={'count':0x0,'rows':[]};var _0x39163a=_[_0x616b('0x2b')](db[_0x616b('0x2c')][_0x616b('0x2d')],function(_0x35775e){return{'name':_0x35775e[_0x616b('0x2e')],'type':_0x35775e[_0x616b('0x2f')][_0x616b('0x30')]};});_0x29175b[_0x616b('0x31')]=_[_0x616b('0x2b')](_0x39163a,_0x616b('0x28'));_0x29175b[_0x616b('0x32')]=_[_0x616b('0x33')](_0xf13c81['query']);_0x29175b[_0x616b('0x34')]=_[_0x616b('0x35')](_0x29175b[_0x616b('0x31')],_0x29175b['query']);_0x5064f2[_0x616b('0x36')]=_[_0x616b('0x35')](_0x29175b['model'],qs['fields'](_0xf13c81[_0x616b('0x32')][_0x616b('0x37')]));_0x5064f2[_0x616b('0x36')]=_0x5064f2['attributes'][_0x616b('0x38')]?_0x5064f2['attributes']:_0x29175b[_0x616b('0x31')];if(!_0xf13c81['query'][_0x616b('0x39')](_0x616b('0x3a'))){_0x5064f2[_0x616b('0x1c')]=qs[_0x616b('0x1c')](_0xf13c81['query'][_0x616b('0x1c')]);_0x5064f2[_0x616b('0x1a')]=qs[_0x616b('0x1a')](_0xf13c81[_0x616b('0x32')]['offset']);}_0x5064f2[_0x616b('0x3b')]=qs['sort'](_0xf13c81[_0x616b('0x32')][_0x616b('0x3c')]);_0x5064f2[_0x616b('0x3d')]=qs[_0x616b('0x34')](_[_0x616b('0x3e')](_0xf13c81[_0x616b('0x32')],_0x29175b['filters']),_0x39163a);if(_0xf13c81[_0x616b('0x32')][_0x616b('0x3f')]){_0x5064f2['where']=_[_0x616b('0x40')](_0x5064f2['where'],{'$or':_[_0x616b('0x2b')](_0x39163a,function(_0x228a64){if(_0x228a64[_0x616b('0x2f')]!==_0x616b('0x41')){var _0x2aff35={};_0x2aff35[_0x228a64['name']]={'$like':'%'+_0xf13c81[_0x616b('0x32')][_0x616b('0x3f')]+'%'};return _0x2aff35;}})});}_0x5064f2=_['merge']({},_0x5064f2,_0xf13c81['options']);var _0x12d677={'where':_0x5064f2[_0x616b('0x3d')]};return db[_0x616b('0x2c')]['count'](_0x12d677)['then'](function(_0x421482){_0x3f425a[_0x616b('0x1d')]=_0x421482;if(_0xf13c81[_0x616b('0x32')][_0x616b('0x42')]){_0x5064f2['include']=[{'all':!![]}];}return db[_0x616b('0x2c')]['findAll'](_0x5064f2);})[_0x616b('0x23')](function(_0x4eaade){_0x3f425a['rows']=_0x4eaade;return _0x3f425a;})[_0x616b('0x23')](respondWithFilteredResult(_0x4d438b,_0x5064f2))['catch'](handleError(_0x4d438b,null));};exports['show']=function(_0x16b22e,_0x465f81){var _0x289b0e={'raw':![],'where':{'id':_0x16b22e[_0x616b('0x43')]['id']}},_0xfd6247={};_0xfd6247[_0x616b('0x31')]=_[_0x616b('0x33')](db['Automation'][_0x616b('0x2d')]);_0xfd6247[_0x616b('0x32')]=_[_0x616b('0x33')](_0x16b22e[_0x616b('0x32')]);_0xfd6247[_0x616b('0x34')]=_['intersection'](_0xfd6247[_0x616b('0x31')],_0xfd6247[_0x616b('0x32')]);_0x289b0e[_0x616b('0x36')]=_['intersection'](_0xfd6247[_0x616b('0x31')],qs[_0x616b('0x37')](_0x16b22e[_0x616b('0x32')][_0x616b('0x37')]));_0x289b0e[_0x616b('0x36')]=_0x289b0e[_0x616b('0x36')][_0x616b('0x38')]?_0x289b0e['attributes']:_0xfd6247[_0x616b('0x31')];if(_0x16b22e[_0x616b('0x32')][_0x616b('0x42')]){_0x289b0e[_0x616b('0x44')]=[{'all':!![]}];}_0x289b0e=_[_0x616b('0x40')]({},_0x289b0e,_0x16b22e[_0x616b('0x45')]);return db[_0x616b('0x2c')]['find'](_0x289b0e)[_0x616b('0x23')](handleEntityNotFound(_0x465f81,null))[_0x616b('0x23')](respondWithResult(_0x465f81,null))[_0x616b('0x46')](handleError(_0x465f81,null));};exports[_0x616b('0x47')]=function(_0x3f1256,_0x1c0069){return db[_0x616b('0x2c')][_0x616b('0x47')](_0x3f1256[_0x616b('0x48')],{})[_0x616b('0x23')](respondWithResult(_0x1c0069,0xc9))['catch'](handleError(_0x1c0069,null));};exports[_0x616b('0x22')]=function(_0x2867f7,_0x2403fe){if(_0x2867f7['body']['id']){delete _0x2867f7[_0x616b('0x48')]['id'];}return db[_0x616b('0x2c')][_0x616b('0x49')]({'where':{'id':_0x2867f7[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x2403fe,null))[_0x616b('0x23')](saveUpdates(_0x2867f7[_0x616b('0x48')],null))[_0x616b('0x23')](respondWithResult(_0x2403fe,null))[_0x616b('0x46')](handleError(_0x2403fe,null));};exports['destroy']=function(_0x186445,_0x57fc1f){return db['Automation'][_0x616b('0x49')]({'where':{'id':_0x186445[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x57fc1f,null))[_0x616b('0x23')](removeEntity(_0x57fc1f,null))[_0x616b('0x46')](handleError(_0x57fc1f,null));};exports[_0x616b('0x4a')]=function(_0x487b0f,_0x191555,_0x4fad2c){return db['Condition'][_0x616b('0x49')]({'where':{'id':_0x487b0f[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x191555,null))['then'](function(_0x4f4e14){if(_0x4f4e14){return _0x4f4e14['addConditions'](_0x487b0f[_0x616b('0x48')][_0x616b('0x4b')],_[_0x616b('0x4c')](_0x487b0f[_0x616b('0x48')],['ids','id'])||{});}})[_0x616b('0x23')](respondWithResult(_0x191555,null))[_0x616b('0x46')](handleError(_0x191555,null));};exports[_0x616b('0x4d')]=function(_0x48c24c,_0x2e9098,_0x37955a){var _0x13e801={};var _0x4a31a7={};var _0xc8aca0;var _0x4a63ab;return db['Automation'][_0x616b('0x4e')]({'where':{'id':_0x48c24c['params']['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x2e9098,null))['then'](function(_0x180c7d){if(_0x180c7d){_0xc8aca0=_0x180c7d;_0x4a31a7[_0x616b('0x31')]=_[_0x616b('0x33')](db[_0x616b('0x4f')][_0x616b('0x2d')]);_0x4a31a7[_0x616b('0x32')]=_[_0x616b('0x33')](_0x48c24c[_0x616b('0x32')]);_0x4a31a7[_0x616b('0x34')]=_['intersection'](_0x4a31a7['model'],_0x4a31a7[_0x616b('0x32')]);_0x13e801['attributes']=_[_0x616b('0x35')](_0x4a31a7[_0x616b('0x31')],qs[_0x616b('0x37')](_0x48c24c['query']['fields']));_0x13e801[_0x616b('0x36')]=_0x13e801['attributes'][_0x616b('0x38')]?_0x13e801[_0x616b('0x36')]:_0x4a31a7[_0x616b('0x31')];_0x13e801[_0x616b('0x3b')]=qs[_0x616b('0x3c')](_0x48c24c[_0x616b('0x32')][_0x616b('0x3c')]);_0x13e801[_0x616b('0x3d')]=qs[_0x616b('0x34')](_[_0x616b('0x3e')](_0x48c24c[_0x616b('0x32')],_0x4a31a7[_0x616b('0x34')]));if(_0x48c24c[_0x616b('0x32')]['filter']){_0x13e801[_0x616b('0x3d')]=_[_0x616b('0x40')](_0x13e801[_0x616b('0x3d')],{'$or':_[_0x616b('0x2b')](_0x13e801[_0x616b('0x36')],function(_0x237cd9){var _0x306286={};_0x306286[_0x237cd9]={'$like':'%'+_0x48c24c['query'][_0x616b('0x3f')]+'%'};return _0x306286;})});}_0x13e801=_[_0x616b('0x40')]({},_0x13e801,_0x48c24c['options']);return _0xc8aca0[_0x616b('0x4d')](_0x13e801);}})[_0x616b('0x23')](function(_0x13590a){if(_0x13590a){_0x4a63ab=_0x13590a[_0x616b('0x38')];if(!_0x48c24c[_0x616b('0x32')][_0x616b('0x39')](_0x616b('0x3a'))){_0x13e801['limit']=qs['limit'](_0x48c24c[_0x616b('0x32')]['limit']);_0x13e801[_0x616b('0x1a')]=qs[_0x616b('0x1a')](_0x48c24c['query'][_0x616b('0x1a')]);}return _0xc8aca0[_0x616b('0x4d')](_0x13e801);}})[_0x616b('0x23')](function(_0x292c9d){if(_0x292c9d){return _0x292c9d?{'count':_0x4a63ab,'rows':_0x292c9d}:null;}})['then'](respondWithResult(_0x2e9098,null))[_0x616b('0x46')](handleError(_0x2e9098,null));};exports['addActions']=function(_0x3ec1ed,_0x49700f,_0x5b80be){return db['Action'][_0x616b('0x49')]({'where':{'id':_0x3ec1ed[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x49700f,null))['then'](function(_0x21bd20){if(_0x21bd20){return _0x21bd20[_0x616b('0x50')](_0x3ec1ed['body']['ids'],_['omit'](_0x3ec1ed[_0x616b('0x48')],[_0x616b('0x4b'),'id'])||{});}})[_0x616b('0x23')](respondWithResult(_0x49700f,null))[_0x616b('0x46')](handleError(_0x49700f,null));};exports['getActions']=function(_0x463bdf,_0x47579f,_0x293ecf){var _0x27fcaa={};var _0x4c1900={};var _0x2b3632;var _0x6dcd2a;return db[_0x616b('0x2c')][_0x616b('0x4e')]({'where':{'id':_0x463bdf[_0x616b('0x43')]['id']}})[_0x616b('0x23')](handleEntityNotFound(_0x47579f,null))['then'](function(_0x564c78){if(_0x564c78){_0x2b3632=_0x564c78;_0x4c1900[_0x616b('0x31')]=_[_0x616b('0x33')](db[_0x616b('0x51')][_0x616b('0x2d')]);_0x4c1900[_0x616b('0x32')]=_['keys'](_0x463bdf[_0x616b('0x32')]);_0x4c1900[_0x616b('0x34')]=_[_0x616b('0x35')](_0x4c1900[_0x616b('0x31')],_0x4c1900[_0x616b('0x32')]);_0x27fcaa[_0x616b('0x36')]=_['intersection'](_0x4c1900[_0x616b('0x31')],qs[_0x616b('0x37')](_0x463bdf['query']['fields']));_0x27fcaa[_0x616b('0x36')]=_0x27fcaa[_0x616b('0x36')][_0x616b('0x38')]?_0x27fcaa[_0x616b('0x36')]:_0x4c1900[_0x616b('0x31')];_0x27fcaa[_0x616b('0x3b')]=qs[_0x616b('0x3c')](_0x463bdf[_0x616b('0x32')][_0x616b('0x3c')]);_0x27fcaa[_0x616b('0x3d')]=qs[_0x616b('0x34')](_[_0x616b('0x3e')](_0x463bdf[_0x616b('0x32')],_0x4c1900[_0x616b('0x34')]));if(_0x463bdf['query']['filter']){_0x27fcaa['where']=_[_0x616b('0x40')](_0x27fcaa['where'],{'$or':_[_0x616b('0x2b')](_0x27fcaa[_0x616b('0x36')],function(_0x5e2c99){var _0x2c524d={};_0x2c524d[_0x5e2c99]={'$like':'%'+_0x463bdf[_0x616b('0x32')][_0x616b('0x3f')]+'%'};return _0x2c524d;})});}_0x27fcaa=_[_0x616b('0x40')]({},_0x27fcaa,_0x463bdf['options']);return _0x2b3632[_0x616b('0x52')](_0x27fcaa);}})[_0x616b('0x23')](function(_0xa10d1e){if(_0xa10d1e){_0x6dcd2a=_0xa10d1e['length'];if(!_0x463bdf[_0x616b('0x32')][_0x616b('0x39')]('nolimit')){_0x27fcaa[_0x616b('0x1c')]=qs[_0x616b('0x1c')](_0x463bdf[_0x616b('0x32')][_0x616b('0x1c')]);_0x27fcaa['offset']=qs[_0x616b('0x1a')](_0x463bdf[_0x616b('0x32')][_0x616b('0x1a')]);}return _0x2b3632[_0x616b('0x52')](_0x27fcaa);}})[_0x616b('0x23')](function(_0x53a1a7){if(_0x53a1a7){return _0x53a1a7?{'count':_0x6dcd2a,'rows':_0x53a1a7}:null;}})[_0x616b('0x23')](respondWithResult(_0x47579f,null))[_0x616b('0x46')](handleError(_0x47579f,null));}; \ No newline at end of file +var _0xfc98=['save','update','then','destroy','error','name','index','map','Automation','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','addConditions','Condition','ids','omit','findOne','keys','getConditions','Action','getActions','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','reject'];(function(_0x128043,_0x53dde9){var _0x1e7aa3=function(_0x485410){while(--_0x485410){_0x128043['push'](_0x128043['shift']());}};_0x1e7aa3(++_0x53dde9);}(_0xfc98,0x83));var _0x8fc9=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xfc98[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x8fc9('0x0'));var rimraf=require(_0x8fc9('0x1'));var zipdir=require(_0x8fc9('0x2'));var jsonpatch=require(_0x8fc9('0x3'));var rp=require(_0x8fc9('0x4'));var moment=require('moment');var BPromise=require(_0x8fc9('0x5'));var Mustache=require('mustache');var util=require(_0x8fc9('0x6'));var path=require(_0x8fc9('0x7'));var sox=require(_0x8fc9('0x8'));var csv=require(_0x8fc9('0x9'));var ejs=require(_0x8fc9('0xa'));var fs=require('fs');var fs_extra=require(_0x8fc9('0xb'));var _=require(_0x8fc9('0xc'));var squel=require(_0x8fc9('0xd'));var crypto=require(_0x8fc9('0xe'));var jsforce=require(_0x8fc9('0xf'));var deskjs=require(_0x8fc9('0x10'));var toCsv=require(_0x8fc9('0x9'));var querystring=require('querystring');var Papa=require(_0x8fc9('0x11'));var Redis=require(_0x8fc9('0x12'));var authService=require(_0x8fc9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8fc9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fc9('0x15'))(_0x8fc9('0x16'));var utils=require(_0x8fc9('0x17'));var config=require(_0x8fc9('0x18'));var licenseUtil=require(_0x8fc9('0x19'));var db=require(_0x8fc9('0x1a'))['db'];function respondWithStatusCode(_0x1d918d,_0x149bf7){_0x149bf7=_0x149bf7||0xcc;return function(_0xdb80b7){if(_0xdb80b7){return _0x1d918d[_0x8fc9('0x1b')](_0x149bf7);}return _0x1d918d['status'](_0x149bf7)[_0x8fc9('0x1c')]();};}function respondWithResult(_0x590708,_0x168640){_0x168640=_0x168640||0xc8;return function(_0x15242a){if(_0x15242a){return _0x590708[_0x8fc9('0x1d')](_0x168640)[_0x8fc9('0x1e')](_0x15242a);}};}function respondWithFilteredResult(_0x270174,_0x503774){return function(_0x1fb082){if(_0x1fb082){var _0x291d7b=typeof _0x503774['offset']===_0x8fc9('0x1f')&&typeof _0x503774[_0x8fc9('0x20')]===_0x8fc9('0x1f');var _0x1a66a8=_0x1fb082[_0x8fc9('0x21')];var _0x3f7298=_0x291d7b?0x0:_0x503774['offset'];var _0x350915=_0x291d7b?_0x1fb082['count']:_0x503774['offset']+_0x503774[_0x8fc9('0x20')];var _0x5efa12;if(_0x350915>=_0x1a66a8){_0x350915=_0x1a66a8;_0x5efa12=0xc8;}else{_0x5efa12=0xce;}_0x270174['status'](_0x5efa12);return _0x270174[_0x8fc9('0x22')](_0x8fc9('0x23'),_0x3f7298+'-'+_0x350915+'/'+_0x1a66a8)['json'](_0x1fb082);}return null;};}function patchUpdates(_0x24c05d){return function(_0xd8b37a){try{jsonpatch['apply'](_0xd8b37a,_0x24c05d,!![]);}catch(_0x7f50d9){return BPromise[_0x8fc9('0x24')](_0x7f50d9);}return _0xd8b37a[_0x8fc9('0x25')]();};}function saveUpdates(_0x256330,_0x5793f0){return function(_0x4ae26f){if(_0x4ae26f){return _0x4ae26f[_0x8fc9('0x26')](_0x256330)[_0x8fc9('0x27')](function(_0x2a764b){return _0x2a764b;});}return null;};}function removeEntity(_0x141b20,_0x420f5b){return function(_0x161f75){if(_0x161f75){return _0x161f75[_0x8fc9('0x28')]()[_0x8fc9('0x27')](function(){_0x141b20[_0x8fc9('0x1d')](0xcc)[_0x8fc9('0x1c')]();});}};}function handleEntityNotFound(_0x5356b2,_0x1a33c0){return function(_0x1907a7){if(!_0x1907a7){_0x5356b2[_0x8fc9('0x1b')](0x194);}return _0x1907a7;};}function handleError(_0x148f26,_0x3c58f2){_0x3c58f2=_0x3c58f2||0x1f4;return function(_0x1dac1e){logger[_0x8fc9('0x29')](_0x1dac1e['stack']);if(_0x1dac1e[_0x8fc9('0x2a')]){delete _0x1dac1e[_0x8fc9('0x2a')];}_0x148f26[_0x8fc9('0x1d')](_0x3c58f2)['send'](_0x1dac1e);};}exports[_0x8fc9('0x2b')]=function(_0x672830,_0x1b2678){var _0x370647={},_0x1a09a8={},_0x5f484b={'count':0x0,'rows':[]};var _0x286e35=_[_0x8fc9('0x2c')](db[_0x8fc9('0x2d')][_0x8fc9('0x2e')],function(_0x5c861d){return{'name':_0x5c861d['fieldName'],'type':_0x5c861d['type'][_0x8fc9('0x2f')]};});_0x1a09a8['model']=_['map'](_0x286e35,_0x8fc9('0x2a'));_0x1a09a8['query']=_['keys'](_0x672830[_0x8fc9('0x30')]);_0x1a09a8[_0x8fc9('0x31')]=_[_0x8fc9('0x32')](_0x1a09a8[_0x8fc9('0x33')],_0x1a09a8[_0x8fc9('0x30')]);_0x370647[_0x8fc9('0x34')]=_[_0x8fc9('0x32')](_0x1a09a8['model'],qs[_0x8fc9('0x35')](_0x672830[_0x8fc9('0x30')][_0x8fc9('0x35')]));_0x370647[_0x8fc9('0x34')]=_0x370647[_0x8fc9('0x34')][_0x8fc9('0x36')]?_0x370647[_0x8fc9('0x34')]:_0x1a09a8[_0x8fc9('0x33')];if(!_0x672830[_0x8fc9('0x30')][_0x8fc9('0x37')](_0x8fc9('0x38'))){_0x370647[_0x8fc9('0x20')]=qs[_0x8fc9('0x20')](_0x672830['query'][_0x8fc9('0x20')]);_0x370647[_0x8fc9('0x39')]=qs['offset'](_0x672830[_0x8fc9('0x30')][_0x8fc9('0x39')]);}_0x370647['order']=qs[_0x8fc9('0x3a')](_0x672830[_0x8fc9('0x30')][_0x8fc9('0x3a')]);_0x370647[_0x8fc9('0x3b')]=qs[_0x8fc9('0x31')](_[_0x8fc9('0x3c')](_0x672830[_0x8fc9('0x30')],_0x1a09a8[_0x8fc9('0x31')]),_0x286e35);if(_0x672830[_0x8fc9('0x30')][_0x8fc9('0x3d')]){_0x370647['where']=_[_0x8fc9('0x3e')](_0x370647[_0x8fc9('0x3b')],{'$or':_[_0x8fc9('0x2c')](_0x286e35,function(_0x369ad0){if(_0x369ad0['type']!==_0x8fc9('0x3f')){var _0xc6641f={};_0xc6641f[_0x369ad0[_0x8fc9('0x2a')]]={'$like':'%'+_0x672830[_0x8fc9('0x30')][_0x8fc9('0x3d')]+'%'};return _0xc6641f;}})});}_0x370647=_['merge']({},_0x370647,_0x672830[_0x8fc9('0x40')]);var _0x3dfd65={'where':_0x370647[_0x8fc9('0x3b')]};return db[_0x8fc9('0x2d')][_0x8fc9('0x21')](_0x3dfd65)[_0x8fc9('0x27')](function(_0x3670bf){_0x5f484b['count']=_0x3670bf;if(_0x672830[_0x8fc9('0x30')][_0x8fc9('0x41')]){_0x370647['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x370647);})['then'](function(_0x239828){_0x5f484b[_0x8fc9('0x42')]=_0x239828;return _0x5f484b;})[_0x8fc9('0x27')](respondWithFilteredResult(_0x1b2678,_0x370647))[_0x8fc9('0x43')](handleError(_0x1b2678,null));};exports[_0x8fc9('0x44')]=function(_0x3db037,_0x4e2741){var _0x32d50f={'raw':![],'where':{'id':_0x3db037[_0x8fc9('0x45')]['id']}},_0x19b4aa={};_0x19b4aa[_0x8fc9('0x33')]=_['keys'](db[_0x8fc9('0x2d')][_0x8fc9('0x2e')]);_0x19b4aa[_0x8fc9('0x30')]=_['keys'](_0x3db037[_0x8fc9('0x30')]);_0x19b4aa[_0x8fc9('0x31')]=_[_0x8fc9('0x32')](_0x19b4aa[_0x8fc9('0x33')],_0x19b4aa[_0x8fc9('0x30')]);_0x32d50f[_0x8fc9('0x34')]=_[_0x8fc9('0x32')](_0x19b4aa['model'],qs[_0x8fc9('0x35')](_0x3db037[_0x8fc9('0x30')][_0x8fc9('0x35')]));_0x32d50f[_0x8fc9('0x34')]=_0x32d50f[_0x8fc9('0x34')][_0x8fc9('0x36')]?_0x32d50f[_0x8fc9('0x34')]:_0x19b4aa[_0x8fc9('0x33')];if(_0x3db037['query'][_0x8fc9('0x41')]){_0x32d50f[_0x8fc9('0x46')]=[{'all':!![]}];}_0x32d50f=_['merge']({},_0x32d50f,_0x3db037[_0x8fc9('0x40')]);return db[_0x8fc9('0x2d')][_0x8fc9('0x47')](_0x32d50f)[_0x8fc9('0x27')](handleEntityNotFound(_0x4e2741,null))[_0x8fc9('0x27')](respondWithResult(_0x4e2741,null))[_0x8fc9('0x43')](handleError(_0x4e2741,null));};exports[_0x8fc9('0x48')]=function(_0x2c2abc,_0x30c14d){return db[_0x8fc9('0x2d')][_0x8fc9('0x48')](_0x2c2abc['body'],{})[_0x8fc9('0x27')](respondWithResult(_0x30c14d,0xc9))[_0x8fc9('0x43')](handleError(_0x30c14d,null));};exports[_0x8fc9('0x26')]=function(_0x22a3d0,_0x2a76a7){if(_0x22a3d0[_0x8fc9('0x49')]['id']){delete _0x22a3d0[_0x8fc9('0x49')]['id'];}return db['Automation'][_0x8fc9('0x47')]({'where':{'id':_0x22a3d0['params']['id']}})[_0x8fc9('0x27')](handleEntityNotFound(_0x2a76a7,null))[_0x8fc9('0x27')](saveUpdates(_0x22a3d0[_0x8fc9('0x49')],null))[_0x8fc9('0x27')](respondWithResult(_0x2a76a7,null))[_0x8fc9('0x43')](handleError(_0x2a76a7,null));};exports[_0x8fc9('0x28')]=function(_0x1ae513,_0x50f73d){return db[_0x8fc9('0x2d')][_0x8fc9('0x47')]({'where':{'id':_0x1ae513[_0x8fc9('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f73d,null))[_0x8fc9('0x27')](removeEntity(_0x50f73d,null))[_0x8fc9('0x43')](handleError(_0x50f73d,null));};exports[_0x8fc9('0x4a')]=function(_0x2b32b7,_0x5ab0e6,_0x1baab2){return db[_0x8fc9('0x4b')]['find']({'where':{'id':_0x2b32b7[_0x8fc9('0x45')]['id']}})[_0x8fc9('0x27')](handleEntityNotFound(_0x5ab0e6,null))[_0x8fc9('0x27')](function(_0x30b385){if(_0x30b385){return _0x30b385[_0x8fc9('0x4a')](_0x2b32b7['body'][_0x8fc9('0x4c')],_[_0x8fc9('0x4d')](_0x2b32b7[_0x8fc9('0x49')],[_0x8fc9('0x4c'),'id'])||{});}})[_0x8fc9('0x27')](respondWithResult(_0x5ab0e6,null))[_0x8fc9('0x43')](handleError(_0x5ab0e6,null));};exports['getConditions']=function(_0xadb5d7,_0x607a85,_0x1ddc79){var _0x1d070f={};var _0x416edb={};var _0x53ad3a;var _0x49f2dd;return db['Automation'][_0x8fc9('0x4e')]({'where':{'id':_0xadb5d7[_0x8fc9('0x45')]['id']}})['then'](handleEntityNotFound(_0x607a85,null))[_0x8fc9('0x27')](function(_0x1c7786){if(_0x1c7786){_0x53ad3a=_0x1c7786;_0x416edb[_0x8fc9('0x33')]=_[_0x8fc9('0x4f')](db[_0x8fc9('0x4b')][_0x8fc9('0x2e')]);_0x416edb[_0x8fc9('0x30')]=_[_0x8fc9('0x4f')](_0xadb5d7[_0x8fc9('0x30')]);_0x416edb[_0x8fc9('0x31')]=_['intersection'](_0x416edb[_0x8fc9('0x33')],_0x416edb['query']);_0x1d070f[_0x8fc9('0x34')]=_[_0x8fc9('0x32')](_0x416edb[_0x8fc9('0x33')],qs[_0x8fc9('0x35')](_0xadb5d7[_0x8fc9('0x30')]['fields']));_0x1d070f[_0x8fc9('0x34')]=_0x1d070f[_0x8fc9('0x34')][_0x8fc9('0x36')]?_0x1d070f[_0x8fc9('0x34')]:_0x416edb[_0x8fc9('0x33')];_0x1d070f['order']=qs[_0x8fc9('0x3a')](_0xadb5d7['query'][_0x8fc9('0x3a')]);_0x1d070f[_0x8fc9('0x3b')]=qs['filters'](_['pick'](_0xadb5d7[_0x8fc9('0x30')],_0x416edb['filters']));if(_0xadb5d7[_0x8fc9('0x30')][_0x8fc9('0x3d')]){_0x1d070f['where']=_[_0x8fc9('0x3e')](_0x1d070f[_0x8fc9('0x3b')],{'$or':_[_0x8fc9('0x2c')](_0x1d070f['attributes'],function(_0x2b9fdc){var _0x3b3ada={};_0x3b3ada[_0x2b9fdc]={'$like':'%'+_0xadb5d7['query']['filter']+'%'};return _0x3b3ada;})});}_0x1d070f=_[_0x8fc9('0x3e')]({},_0x1d070f,_0xadb5d7[_0x8fc9('0x40')]);return _0x53ad3a[_0x8fc9('0x50')](_0x1d070f);}})[_0x8fc9('0x27')](function(_0x19f85a){if(_0x19f85a){_0x49f2dd=_0x19f85a[_0x8fc9('0x36')];if(!_0xadb5d7[_0x8fc9('0x30')]['hasOwnProperty'](_0x8fc9('0x38'))){_0x1d070f[_0x8fc9('0x20')]=qs[_0x8fc9('0x20')](_0xadb5d7[_0x8fc9('0x30')][_0x8fc9('0x20')]);_0x1d070f[_0x8fc9('0x39')]=qs[_0x8fc9('0x39')](_0xadb5d7['query'][_0x8fc9('0x39')]);}return _0x53ad3a[_0x8fc9('0x50')](_0x1d070f);}})['then'](function(_0x1cb197){if(_0x1cb197){return _0x1cb197?{'count':_0x49f2dd,'rows':_0x1cb197}:null;}})['then'](respondWithResult(_0x607a85,null))[_0x8fc9('0x43')](handleError(_0x607a85,null));};exports['addActions']=function(_0x45eb16,_0x46fb06,_0x3413b7){return db[_0x8fc9('0x51')][_0x8fc9('0x47')]({'where':{'id':_0x45eb16[_0x8fc9('0x45')]['id']}})['then'](handleEntityNotFound(_0x46fb06,null))[_0x8fc9('0x27')](function(_0x2cee81){if(_0x2cee81){return _0x2cee81['addActions'](_0x45eb16['body'][_0x8fc9('0x4c')],_[_0x8fc9('0x4d')](_0x45eb16[_0x8fc9('0x49')],[_0x8fc9('0x4c'),'id'])||{});}})[_0x8fc9('0x27')](respondWithResult(_0x46fb06,null))['catch'](handleError(_0x46fb06,null));};exports[_0x8fc9('0x52')]=function(_0xfbf7b2,_0x1c0bc9,_0x5c3a6c){var _0x48f3e0={};var _0x22f65e={};var _0x51febc;var _0x1d97df;return db[_0x8fc9('0x2d')][_0x8fc9('0x4e')]({'where':{'id':_0xfbf7b2['params']['id']}})[_0x8fc9('0x27')](handleEntityNotFound(_0x1c0bc9,null))['then'](function(_0x51a411){if(_0x51a411){_0x51febc=_0x51a411;_0x22f65e[_0x8fc9('0x33')]=_[_0x8fc9('0x4f')](db[_0x8fc9('0x51')][_0x8fc9('0x2e')]);_0x22f65e[_0x8fc9('0x30')]=_[_0x8fc9('0x4f')](_0xfbf7b2[_0x8fc9('0x30')]);_0x22f65e[_0x8fc9('0x31')]=_[_0x8fc9('0x32')](_0x22f65e[_0x8fc9('0x33')],_0x22f65e[_0x8fc9('0x30')]);_0x48f3e0[_0x8fc9('0x34')]=_[_0x8fc9('0x32')](_0x22f65e[_0x8fc9('0x33')],qs[_0x8fc9('0x35')](_0xfbf7b2[_0x8fc9('0x30')][_0x8fc9('0x35')]));_0x48f3e0[_0x8fc9('0x34')]=_0x48f3e0[_0x8fc9('0x34')]['length']?_0x48f3e0['attributes']:_0x22f65e[_0x8fc9('0x33')];_0x48f3e0[_0x8fc9('0x53')]=qs[_0x8fc9('0x3a')](_0xfbf7b2[_0x8fc9('0x30')][_0x8fc9('0x3a')]);_0x48f3e0['where']=qs['filters'](_['pick'](_0xfbf7b2[_0x8fc9('0x30')],_0x22f65e[_0x8fc9('0x31')]));if(_0xfbf7b2['query'][_0x8fc9('0x3d')]){_0x48f3e0['where']=_[_0x8fc9('0x3e')](_0x48f3e0[_0x8fc9('0x3b')],{'$or':_[_0x8fc9('0x2c')](_0x48f3e0[_0x8fc9('0x34')],function(_0xb06341){var _0x26f1ca={};_0x26f1ca[_0xb06341]={'$like':'%'+_0xfbf7b2[_0x8fc9('0x30')]['filter']+'%'};return _0x26f1ca;})});}_0x48f3e0=_[_0x8fc9('0x3e')]({},_0x48f3e0,_0xfbf7b2[_0x8fc9('0x40')]);return _0x51febc[_0x8fc9('0x52')](_0x48f3e0);}})[_0x8fc9('0x27')](function(_0x268519){if(_0x268519){_0x1d97df=_0x268519['length'];if(!_0xfbf7b2[_0x8fc9('0x30')][_0x8fc9('0x37')](_0x8fc9('0x38'))){_0x48f3e0[_0x8fc9('0x20')]=qs[_0x8fc9('0x20')](_0xfbf7b2[_0x8fc9('0x30')][_0x8fc9('0x20')]);_0x48f3e0[_0x8fc9('0x39')]=qs[_0x8fc9('0x39')](_0xfbf7b2[_0x8fc9('0x30')][_0x8fc9('0x39')]);}return _0x51febc['getActions'](_0x48f3e0);}})['then'](function(_0xe98f80){if(_0xe98f80){return _0xe98f80?{'count':_0x1d97df,'rows':_0xe98f80}:null;}})['then'](respondWithResult(_0x1c0bc9,null))[_0x8fc9('0x43')](handleError(_0x1c0bc9,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2cd8a16..4115901 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 _0x0fee=['api','moment','bluebird','request-promise','path','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x5b27e0,_0x40544b){var _0x70191f=function(_0x4057ba){while(--_0x4057ba){_0x5b27e0['push'](_0x5b27e0['shift']());}};_0x70191f(++_0x40544b);}(_0x0fee,0x129));var _0xe0fe=function(_0x2a5b3e,_0x1394b3){_0x2a5b3e=_0x2a5b3e-0x0;var _0x4e2e93=_0x0fee[_0x2a5b3e];return _0x4e2e93;};'use strict';var _=require(_0xe0fe('0x0'));var util=require(_0xe0fe('0x1'));var logger=require(_0xe0fe('0x2'))(_0xe0fe('0x3'));var moment=require(_0xe0fe('0x4'));var BPromise=require(_0xe0fe('0x5'));var rp=require(_0xe0fe('0x6'));var fs=require('fs');var path=require(_0xe0fe('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe0fe('0x8'));module[_0xe0fe('0x9')]=function(_0x31d6cc,_0x2693c6){return _0x31d6cc['define'](_0xe0fe('0xa'),attributes,{'tableName':_0xe0fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6251=['api','moment','bluebird','path','../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash','util'];(function(_0x1fa226,_0x575465){var _0x3579a6=function(_0xf8a680){while(--_0xf8a680){_0x1fa226['push'](_0x1fa226['shift']());}};_0x3579a6(++_0x575465);}(_0x6251,0x1b6));var _0x1625=function(_0x52b250,_0x5e6396){_0x52b250=_0x52b250-0x0;var _0x592993=_0x6251[_0x52b250];return _0x592993;};'use strict';var _=require(_0x1625('0x0'));var util=require(_0x1625('0x1'));var logger=require('../../config/logger')(_0x1625('0x2'));var moment=require(_0x1625('0x3'));var BPromise=require(_0x1625('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1625('0x5'));var rimraf=require('rimraf');var config=require(_0x1625('0x6'));var attributes=require(_0x1625('0x7'));module['exports']=function(_0x2ace66,_0x2e3eab){return _0x2ace66[_0x1625('0x8')](_0x1625('0x9'),attributes,{'tableName':_0x1625('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index d3fe999..4a7811c 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 _0x337f=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2609d3,_0x4d262d){var _0x4bb1d6=function(_0x1afb0d){while(--_0x1afb0d){_0x2609d3['push'](_0x2609d3['shift']());}};_0x4bb1d6(++_0x4d262d);}(_0x337f,0x11c));var _0xf337=function(_0x4ee072,_0x1c3b0c){_0x4ee072=_0x4ee072-0x0;var _0x41f87a=_0x337f[_0x4ee072];return _0x41f87a;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var moment=require(_0xf337('0x2'));var BPromise=require('bluebird');var rs=require(_0xf337('0x3'));var fs=require('fs');var Redis=require(_0xf337('0x4'));var db=require(_0xf337('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf337('0x6'))(_0xf337('0x7'));var config=require('../../config/environment');var jayson=require(_0xf337('0x8'));var client=jayson['client'][_0xf337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ae4d6,_0x2be604,_0x56bd39){return new BPromise(function(_0x4b80a2,_0x1f0a95){return client[_0xf337('0xa')](_0x5ae4d6,_0x56bd39)[_0xf337('0xb')](function(_0x2a4619){logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,_0xf337('0xe'));logger[_0xf337('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x2be604,_0xf337('0xe'),JSON[_0xf337('0x10')](_0x2a4619));if(_0x2a4619[_0xf337('0x11')]){if(_0x2a4619[_0xf337('0x11')][_0xf337('0x12')]===0x1f4){logger[_0xf337('0x11')](_0xf337('0xd'),_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x1f0a95(_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);}logger[_0xf337('0x11')]('Automation,\x20%s,\x20%s',_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x4b80a2(_0x2a4619[_0xf337('0x11')]['message']);}else{logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,'request\x20sent');_0x4b80a2(_0x2a4619[_0xf337('0x14')][_0xf337('0x13')]);}})[_0xf337('0x15')](function(_0x4a7e4c){logger[_0xf337('0x11')]('Automation,\x20%s,\x20%s',_0x2be604,_0x4a7e4c);_0x1f0a95(_0x4a7e4c);});});} \ No newline at end of file +var _0xa329=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x46f0e7,_0xf642b1){var _0x31bc18=function(_0x1c7f25){while(--_0x1c7f25){_0x46f0e7['push'](_0x46f0e7['shift']());}};_0x31bc18(++_0xf642b1);}(_0xa329,0x162));var _0x9a32=function(_0x1a761a,_0xb6f892){_0x1a761a=_0x1a761a-0x0;var _0x4d4149=_0xa329[_0x1a761a];return _0x4d4149;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var moment=require('moment');var BPromise=require(_0x9a32('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a32('0x3'));var db=require(_0x9a32('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a32('0x5'));var config=require(_0x9a32('0x6'));var jayson=require(_0x9a32('0x7'));var client=jayson[_0x9a32('0x8')][_0x9a32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x235b92,_0x4a8fba,_0x5b8b5e){return new BPromise(function(_0x4dc7f8,_0x344b35){return client[_0x9a32('0xa')](_0x235b92,_0x5b8b5e)['then'](function(_0x38f6cc){logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x4a8fba,_0x9a32('0xd'));logger[_0x9a32('0xe')](_0x9a32('0xf'),_0x4a8fba,'request\x20sent',JSON[_0x9a32('0x10')](_0x38f6cc));if(_0x38f6cc[_0x9a32('0x11')]){if(_0x38f6cc['error']['code']===0x1f4){logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x38f6cc['error']['message']);return _0x344b35(_0x38f6cc[_0x9a32('0x11')][_0x9a32('0x12')]);}logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x38f6cc['error'][_0x9a32('0x12')]);return _0x4dc7f8(_0x38f6cc[_0x9a32('0x11')]['message']);}else{logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x4a8fba,_0x9a32('0xd'));_0x4dc7f8(_0x38f6cc[_0x9a32('0x13')][_0x9a32('0x12')]);}})[_0x9a32('0x14')](function(_0x4fa645){logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x4fa645);_0x344b35(_0x4fa645);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 2d824c0..4c10c19 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 _0xe5f7=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','index','/:id','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','put','update','delete'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xe5f7,0x178));var _0x7e5f=function(_0x28e10e,_0x563c1c){_0x28e10e=_0x28e10e-0x0;var _0x27822c=_0xe5f7[_0x28e10e];return _0x27822c;};'use strict';var multer=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var path=require(_0x7e5f('0x2'));var timeout=require(_0x7e5f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7e5f('0x4'));var auth=require(_0x7e5f('0x5'));var interaction=require(_0x7e5f('0x6'));var config=require('../../config/environment');var controller=require(_0x7e5f('0x7'));router[_0x7e5f('0x8')]('/',auth['isAuthenticated'](),controller[_0x7e5f('0x9')]);router[_0x7e5f('0x8')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0xc')]);router[_0x7e5f('0x8')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x7e5f('0xd')]);router[_0x7e5f('0x8')](_0x7e5f('0xe'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0xf')]);router[_0x7e5f('0x10')]('/',auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x11')]);router[_0x7e5f('0x10')](_0x7e5f('0x12'),auth['isAuthenticated'](),controller[_0x7e5f('0x13')]);router['post'](_0x7e5f('0xe'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x14')]);router[_0x7e5f('0x15')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x16')]);router[_0x7e5f('0x17')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller['destroy']);module[_0x7e5f('0x18')]=router; \ No newline at end of file +var _0x4d33=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','put','update','destroy','util','connect-timeout'];(function(_0x2ff2a5,_0x564e1){var _0x2f7dcb=function(_0x45fbb5){while(--_0x45fbb5){_0x2ff2a5['push'](_0x2ff2a5['shift']());}};_0x2f7dcb(++_0x564e1);}(_0x4d33,0x1cc));var _0x34d3=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x4d33[_0xac0de1];return _0x1c1995;};'use strict';var multer=require('multer');var util=require(_0x34d3('0x0'));var path=require('path');var timeout=require(_0x34d3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x34d3('0x2'));var auth=require(_0x34d3('0x3'));var interaction=require(_0x34d3('0x4'));var config=require(_0x34d3('0x5'));var controller=require(_0x34d3('0x6'));router[_0x34d3('0x7')]('/',auth[_0x34d3('0x8')](),controller['index']);router[_0x34d3('0x7')](_0x34d3('0x9'),auth[_0x34d3('0x8')](),controller[_0x34d3('0xa')]);router['get']('/:id/conditions',auth[_0x34d3('0x8')](),controller['getConditions']);router[_0x34d3('0x7')](_0x34d3('0xb'),auth['isAuthenticated'](),controller[_0x34d3('0xc')]);router[_0x34d3('0xd')]('/',auth[_0x34d3('0x8')](),controller[_0x34d3('0xe')]);router[_0x34d3('0xd')](_0x34d3('0xf'),auth['isAuthenticated'](),controller[_0x34d3('0x10')]);router[_0x34d3('0xd')](_0x34d3('0xb'),auth[_0x34d3('0x8')](),controller[_0x34d3('0x11')]);router[_0x34d3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x34d3('0x13')]);router['delete']('/:id',auth[_0x34d3('0x8')](),controller[_0x34d3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 1ce313b..5a7e498 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 _0x6ee5=['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,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x668bb5,_0x5eae15){var _0x52ed91=function(_0x366e9b){while(--_0x366e9b){_0x668bb5['push'](_0x668bb5['shift']());}};_0x52ed91(++_0x5eae15);}(_0x6ee5,0x92));var _0x56ee=function(_0xd25bc,_0x58f058){_0xd25bc=_0xd25bc-0x0;var _0x177b30=_0x6ee5[_0xd25bc];return _0x177b30;};'use strict';var Sequelize=require(_0x56ee('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x56ee('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x56ee('0x2')](_0x56ee('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x56ee('0x4')]},'active':{'type':Sequelize[_0x56ee('0x5')],'defaultValue':0x0,'comment':_0x56ee('0x6')},'limitCalls':{'type':Sequelize[_0x56ee('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x56ee('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x56ee('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)[_0x56ee('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)[_0x56ee('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)[_0x56ee('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x56ee('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x56ee('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x56ee('0x11')},'dialTimezone':{'type':Sequelize[_0x56ee('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x56ee('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x56ee('0x2')]('always',_0x56ee('0x13'),_0x56ee('0x14')),'defaultValue':_0x56ee('0x15')},'dialAMDActive':{'type':Sequelize[_0x56ee('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x56ee('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x56ee('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x56ee('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x56ee('0x7')](0x9)[_0x56ee('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x56ee('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x56ee('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x56ee('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x56ee('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x56ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x56ee('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x56ee('0x7')](0x5)[_0x56ee('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x56ee('0x7')](0x9)[_0x56ee('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x56ee('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x56ee('0x1e')),'defaultValue':_0x56ee('0x1f')},'dialPrefix':{'type':Sequelize[_0x56ee('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x56ee('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x56ee('0x20')},'dialCutDigit':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)[_0x56ee('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0x21')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x56ee('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x56ee('0x7')](0x3)[_0x56ee('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ee('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x56ee('0x7')](0x5)[_0x56ee('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ee('0x27')}}; \ No newline at end of file +var _0x9c3b=['onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','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)','ENUM','always','never'];(function(_0x1e5681,_0xe9698f){var _0x484a8a=function(_0xa4c0e8){while(--_0xa4c0e8){_0x1e5681['push'](_0x1e5681['shift']());}};_0x484a8a(++_0xe9698f);}(_0x9c3b,0x12f));var _0xb9c3=function(_0x237340,_0x39b15d){_0x237340=_0x237340-0x0;var _0x5542c8=_0x9c3b[_0x237340];return _0x5542c8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb9c3('0x0')],'unique':_0xb9c3('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0xb9c3('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xb9c3('0x3')],'defaultValue':0x0,'comment':_0xb9c3('0x4')},'limitCalls':{'type':Sequelize[_0xb9c3('0x5')](0x4)[_0xb9c3('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb9c3('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb9c3('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb9c3('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xb9c3('0x5')](0x3)[_0xb9c3('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb9c3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb9c3('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0xb9c3('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb9c3('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb9c3('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb9c3('0x5')](0x3)[_0xb9c3('0x6')],'defaultValue':0x3,'comment':_0xb9c3('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb9c3('0x5')](0x5)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb9c3('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb9c3('0x5')](0x3)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb9c3('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb9c3('0x0')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xb9c3('0xe')](_0xb9c3('0xf'),_0xb9c3('0x10'),_0xb9c3('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xb9c3('0x3')],'defaultValue':0x0,'comment':_0xb9c3('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xb9c3('0x5')](0x9)[_0xb9c3('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb9c3('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xb9c3('0x5')](0x9)[_0xb9c3('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb9c3('0x5')](0x9)[_0xb9c3('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb9c3('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xb9c3('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb9c3('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xb9c3('0x5')](0x9)[_0xb9c3('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb9c3('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb9c3('0x5')](0x9)[_0xb9c3('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb9c3('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb9c3('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb9c3('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb9c3('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb9c3('0xe')](_0xb9c3('0x18'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xb9c3('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb9c3('0x5')](0x3)[_0xb9c3('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb9c3('0x19')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb9c3('0x5')](0x3)[_0xb9c3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb9c3('0x5')](0x5)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb9c3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb9c3('0x1a')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb9c3('0x1b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb9c3('0x5')](0x3)[_0xb9c3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb9c3('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb9c3('0x5')](0x5)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb9c3('0x1d')},'dialMachineMaxRetry':{'type':Sequelize[_0xb9c3('0x5')](0x3)[_0xb9c3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xb9c3('0x5')](0x5)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb9c3('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb9c3('0x5')](0x3)[_0xb9c3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb9c3('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb9c3('0x5')](0x5)[_0xb9c3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 1075d4a..8cca80e 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 _0x58a4=['rows','getHopperBlacks','CmHopperBlack','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','UserProfileSection','update','getHoppers','findOne','CmHopper','hasOwnProperty','pick','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal'];(function(_0x49bc42,_0x366921){var _0x301dff=function(_0x10684e){while(--_0x10684e){_0x49bc42['push'](_0x49bc42['shift']());}};_0x301dff(++_0x366921);}(_0x58a4,0xbf));var _0x458a=function(_0x298de3,_0x43e88d){_0x298de3=_0x298de3-0x0;var _0x2bcf0a=_0x58a4[_0x298de3];return _0x2bcf0a;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){var _0xcda8cc=_0x36b08e[_0x458a('0x27')]({'plain':!![]});var _0x19bd5=_0x458a('0x28');return db[_0x458a('0x29')][_0x458a('0x26')]({'where':{'type':_0x19bd5,'resourceId':_0xcda8cc['id']}})[_0x458a('0x25')](function(){return _0x36b08e;});})[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x5a55b7,_0xb94bd9){return function(_0x112fa6){if(!_0x112fa6){_0x5a55b7['sendStatus'](0x194);}return _0x112fa6;};}function handleError(_0x5df150,_0x41b23d){_0x41b23d=_0x41b23d||0x1f4;return function(_0x596fe2){logger[_0x458a('0x2a')](_0x596fe2[_0x458a('0x2b')]);if(_0x596fe2[_0x458a('0x2c')]){delete _0x596fe2['name'];}_0x5df150[_0x458a('0x1b')](_0x41b23d)[_0x458a('0x2d')](_0x596fe2);};}exports[_0x458a('0x2e')]=function(_0x562c36,_0x47e20d){var _0x18c890={},_0x4cf059={},_0x185f1c={'count':0x0,'rows':[]};var _0x56e0b9=_[_0x458a('0x2f')](db[_0x458a('0x30')]['rawAttributes'],function(_0x309a6a){return{'name':_0x309a6a[_0x458a('0x31')],'type':_0x309a6a[_0x458a('0x32')]['key']};});_0x4cf059[_0x458a('0x33')]=_[_0x458a('0x2f')](_0x56e0b9,_0x458a('0x2c'));_0x4cf059[_0x458a('0x34')]=_[_0x458a('0x35')](_0x562c36['query']);_0x4cf059[_0x458a('0x36')]=_[_0x458a('0x37')](_0x4cf059[_0x458a('0x33')],_0x4cf059[_0x458a('0x34')]);_0x18c890[_0x458a('0x38')]=_[_0x458a('0x37')](_0x4cf059['model'],qs[_0x458a('0x39')](_0x562c36[_0x458a('0x34')][_0x458a('0x39')]));_0x18c890[_0x458a('0x38')]=_0x18c890[_0x458a('0x38')][_0x458a('0x3a')]?_0x18c890[_0x458a('0x38')]:_0x4cf059[_0x458a('0x33')];if(!_0x562c36[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x18c890[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x562c36[_0x458a('0x34')][_0x458a('0x1e')]);_0x18c890[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x562c36[_0x458a('0x34')][_0x458a('0x20')]);}_0x18c890[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x562c36[_0x458a('0x34')][_0x458a('0x3d')]);_0x18c890[_0x458a('0x3e')]=qs[_0x458a('0x36')](_['pick'](_0x562c36[_0x458a('0x34')],_0x4cf059[_0x458a('0x36')]),_0x56e0b9);if(_0x562c36[_0x458a('0x34')][_0x458a('0x3f')]){_0x18c890[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x18c890[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x56e0b9,function(_0x41d125){if(_0x41d125[_0x458a('0x32')]!==_0x458a('0x41')){var _0x4efbeb={};_0x4efbeb[_0x41d125[_0x458a('0x2c')]]={'$like':'%'+_0x562c36[_0x458a('0x34')]['filter']+'%'};return _0x4efbeb;}})});}_0x18c890=_[_0x458a('0x40')]({},_0x18c890,_0x562c36[_0x458a('0x42')]);var _0x4286a3={'where':_0x18c890['where']};return db[_0x458a('0x30')][_0x458a('0x1f')](_0x4286a3)[_0x458a('0x25')](function(_0x1e51d2){_0x185f1c[_0x458a('0x1f')]=_0x1e51d2;if(_0x562c36[_0x458a('0x34')][_0x458a('0x43')]){_0x18c890[_0x458a('0x44')]=[{'all':!![]}];}return db['Campaign'][_0x458a('0x45')](_0x18c890);})[_0x458a('0x25')](function(_0x2b9030){_0x185f1c['rows']=_0x2b9030;return _0x185f1c;})[_0x458a('0x25')](respondWithFilteredResult(_0x47e20d,_0x18c890))[_0x458a('0x46')](handleError(_0x47e20d,null));};exports['show']=function(_0x598707,_0x124f64){var _0x2be08f={'raw':![],'where':{'id':_0x598707[_0x458a('0x47')]['id']}},_0x36c391={};_0x36c391['model']=_['keys'](db[_0x458a('0x30')][_0x458a('0x48')]);_0x36c391[_0x458a('0x34')]=_[_0x458a('0x35')](_0x598707['query']);_0x36c391[_0x458a('0x36')]=_[_0x458a('0x37')](_0x36c391['model'],_0x36c391[_0x458a('0x34')]);_0x2be08f['attributes']=_[_0x458a('0x37')](_0x36c391[_0x458a('0x33')],qs[_0x458a('0x39')](_0x598707['query'][_0x458a('0x39')]));_0x2be08f[_0x458a('0x38')]=_0x2be08f[_0x458a('0x38')]['length']?_0x2be08f['attributes']:_0x36c391[_0x458a('0x33')];if(_0x598707[_0x458a('0x34')][_0x458a('0x43')]){_0x2be08f['include']=[{'all':!![]}];}_0x2be08f=_['merge']({},_0x2be08f,_0x598707[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x2be08f)[_0x458a('0x25')](handleEntityNotFound(_0x124f64,null))[_0x458a('0x25')](respondWithResult(_0x124f64,null))[_0x458a('0x46')](handleError(_0x124f64,null));};exports[_0x458a('0x4a')]=function(_0x30cdaf,_0xb22232){return db[_0x458a('0x30')][_0x458a('0x4a')](_0x30cdaf[_0x458a('0x4b')],{})[_0x458a('0x25')](function(_0x1b0c11){var _0x1ddc39=_0x30cdaf[_0x458a('0x4c')]['get']({'plain':!![]});if(!_0x1ddc39)throw new Error(_0x458a('0x4d'));if(_0x1ddc39[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x396bb3=_0x1b0c11[_0x458a('0x27')]({'plain':!![]});var _0x5630cf='IvrCampaigns';return db['UserProfileSection'][_0x458a('0x49')]({'where':{'name':_0x5630cf,'userProfileId':_0x1ddc39['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x58946){if(_0x58946&&_0x58946[_0x458a('0x4f')]===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x396bb3['name'],'resourceId':_0x396bb3['id'],'type':_0x58946['name'],'sectionId':_0x58946['id']},{})[_0x458a('0x25')](function(){return _0x1b0c11;});}else{return _0x1b0c11;}})[_0x458a('0x46')](function(_0x2587a1){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x2587a1);throw _0x2587a1;});}return _0x1b0c11;})['then'](respondWithResult(_0xb22232,0xc9))[_0x458a('0x46')](handleError(_0xb22232,null));};exports['clone']=function(_0xa51e28,_0x5b428c){var _0x3ea8f0={'where':{'id':_0xa51e28['params']['id']}},_0x59ae40={};_0x59ae40['model']=_[_0x458a('0x35')](db[_0x458a('0x30')]['rawAttributes']);_0x3ea8f0[_0x458a('0x38')]=_[_0x458a('0x37')](_0x59ae40[_0x458a('0x33')],qs['fields'](_0xa51e28[_0x458a('0x34')][_0x458a('0x39')]));_0x3ea8f0[_0x458a('0x38')]=_0x3ea8f0[_0x458a('0x38')][_0x458a('0x3a')]?_0x3ea8f0[_0x458a('0x38')]:_0x59ae40['model'];if(_0xa51e28[_0x458a('0x34')][_0x458a('0x43')]){_0x3ea8f0[_0x458a('0x44')]=[{'all':!![]}];}_0x3ea8f0=_[_0x458a('0x40')]({},_0x3ea8f0,_0xa51e28[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x3ea8f0)[_0x458a('0x25')](handleEntityNotFound(_0x5b428c,null))['then'](function(_0xb365f5){if(_0xb365f5){var _0x4abe93=_0xb365f5[_0x458a('0x27')]({'plain':!![]});_0x4abe93=qs[_0x458a('0x51')](_0x4abe93,['id',_0x458a('0x52'),_0x458a('0x53')]);_0xa51e28['body']=_['omit'](_0xa51e28[_0x458a('0x4b')],['id',_0x458a('0x52'),_0x458a('0x53')]);return db[_0x458a('0x30')][_0x458a('0x4a')](_[_0x458a('0x40')](_0x4abe93,_0xa51e28['body']),{'include':_0xa51e28[_0x458a('0x34')][_0x458a('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x18d83a){var _0x47b334=_0xa51e28[_0x458a('0x4c')][_0x458a('0x27')]({'plain':!![]});if(!_0x47b334)throw new Error(_0x458a('0x4d'));if(_0x47b334[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x226083=_0x18d83a[_0x458a('0x27')]({'plain':!![]});var _0xbd36cc='IvrCampaigns';return db[_0x458a('0x54')][_0x458a('0x49')]({'where':{'name':_0xbd36cc,'userProfileId':_0x47b334['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x3da617){if(_0x3da617&&_0x3da617['autoAssociation']===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x226083['name'],'resourceId':_0x226083['id'],'type':_0x3da617[_0x458a('0x2c')],'sectionId':_0x3da617['id']},{})[_0x458a('0x25')](function(){return _0x18d83a;});}else{return _0x18d83a;}})['catch'](function(_0x16f82f){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x16f82f);throw _0x16f82f;});}return _0x18d83a;});}})[_0x458a('0x25')](respondWithResult(_0x5b428c,0xc9))[_0x458a('0x46')](handleError(_0x5b428c,null));};exports[_0x458a('0x55')]=function(_0x4199a7,_0x397595){if(_0x4199a7['body']['id']){delete _0x4199a7[_0x458a('0x4b')]['id'];}return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x4199a7[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x397595,null))[_0x458a('0x25')](saveUpdates(_0x4199a7[_0x458a('0x4b')],null))[_0x458a('0x25')](respondWithResult(_0x397595,null))[_0x458a('0x46')](handleError(_0x397595,null));};exports[_0x458a('0x26')]=function(_0x546519,_0x3837b7){return db['Campaign'][_0x458a('0x49')]({'where':{'id':_0x546519[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x3837b7,null))[_0x458a('0x25')](removeEntity(_0x3837b7,null))[_0x458a('0x46')](handleError(_0x3837b7,null));};exports[_0x458a('0x56')]=function(_0x2c6a00,_0x3745d5,_0x2b67dd){var _0x413d7c={'raw':!![],'where':{}};var _0x31074e={};var _0x448cbc={'count':0x0,'rows':[]};return db[_0x458a('0x30')][_0x458a('0x57')]({'where':{'id':_0x2c6a00[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x3745d5,null))['then'](function(_0x120b8e){if(_0x120b8e){_0x31074e['model']=_[_0x458a('0x35')](db[_0x458a('0x58')]['rawAttributes']);_0x31074e[_0x458a('0x34')]=_[_0x458a('0x35')](_0x2c6a00[_0x458a('0x34')]);_0x31074e['filters']=_[_0x458a('0x37')](_0x31074e[_0x458a('0x33')],_0x31074e[_0x458a('0x34')]);_0x413d7c[_0x458a('0x38')]=_[_0x458a('0x37')](_0x31074e[_0x458a('0x33')],qs['fields'](_0x2c6a00[_0x458a('0x34')]['fields']));_0x413d7c['attributes']=_0x413d7c[_0x458a('0x38')][_0x458a('0x3a')]?_0x413d7c[_0x458a('0x38')]:_0x31074e[_0x458a('0x33')];if(!_0x2c6a00[_0x458a('0x34')][_0x458a('0x59')](_0x458a('0x3b'))){_0x413d7c[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x2c6a00[_0x458a('0x34')][_0x458a('0x1e')]);_0x413d7c[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x2c6a00[_0x458a('0x34')]['offset']);}_0x413d7c['order']=qs['sort'](_0x2c6a00[_0x458a('0x34')]['sort']);_0x413d7c[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x5a')](_0x2c6a00[_0x458a('0x34')],_0x31074e[_0x458a('0x36')]));_0x413d7c[_0x458a('0x3e')][_0x458a('0x5b')]=_0x120b8e['id'];if(_0x2c6a00['query'][_0x458a('0x3f')]){_0x413d7c[_0x458a('0x3e')]=_['merge'](_0x413d7c[_0x458a('0x3e')],{'$or':_['map'](_0x413d7c[_0x458a('0x38')],function(_0x58d29d){var _0x26b3f7={};_0x26b3f7[_0x58d29d]={'$like':'%'+_0x2c6a00[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x26b3f7;})});}_0x413d7c=_[_0x458a('0x40')]({},_0x413d7c,_0x2c6a00['options']);return db[_0x458a('0x58')][_0x458a('0x1f')]({'where':_0x413d7c[_0x458a('0x3e')]})[_0x458a('0x25')](function(_0x18fb71){_0x448cbc[_0x458a('0x1f')]=_0x18fb71;if(_0x2c6a00[_0x458a('0x34')][_0x458a('0x43')]){_0x413d7c['include']=[{'all':!![]}];}return db[_0x458a('0x58')][_0x458a('0x45')](_0x413d7c);})[_0x458a('0x25')](function(_0x4212af){_0x448cbc['rows']=_0x4212af;return _0x448cbc;});}})[_0x458a('0x25')](respondWithFilteredResult(_0x3745d5,_0x413d7c))[_0x458a('0x46')](handleError(_0x3745d5,null));};exports['getHopperHistories']=function(_0x32bc59,_0x110801,_0x9b98e){var _0x45e06c={'raw':!![],'where':{}};var _0x3b0888={};var _0x48d2a3={'count':0x0,'rows':[]};return db[_0x458a('0x30')][_0x458a('0x57')]({'where':{'id':_0x32bc59[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x110801,null))[_0x458a('0x25')](function(_0x46ac5c){if(_0x46ac5c){_0x3b0888[_0x458a('0x33')]=_['keys'](db[_0x458a('0x5c')]['rawAttributes']);_0x3b0888[_0x458a('0x34')]=_[_0x458a('0x35')](_0x32bc59[_0x458a('0x34')]);_0x3b0888['filters']=_[_0x458a('0x37')](_0x3b0888['model'],_0x3b0888['query']);_0x45e06c[_0x458a('0x38')]=_[_0x458a('0x37')](_0x3b0888['model'],qs['fields'](_0x32bc59[_0x458a('0x34')][_0x458a('0x39')]));_0x45e06c[_0x458a('0x38')]=_0x45e06c[_0x458a('0x38')][_0x458a('0x3a')]?_0x45e06c['attributes']:_0x3b0888[_0x458a('0x33')];if(!_0x32bc59['query'][_0x458a('0x59')](_0x458a('0x3b'))){_0x45e06c[_0x458a('0x1e')]=qs['limit'](_0x32bc59[_0x458a('0x34')][_0x458a('0x1e')]);_0x45e06c['offset']=qs[_0x458a('0x20')](_0x32bc59['query'][_0x458a('0x20')]);}_0x45e06c[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x32bc59[_0x458a('0x34')]['sort']);_0x45e06c[_0x458a('0x3e')]=qs['filters'](_['pick'](_0x32bc59[_0x458a('0x34')],_0x3b0888[_0x458a('0x36')]));_0x45e06c[_0x458a('0x3e')][_0x458a('0x5b')]=_0x46ac5c['id'];if(_0x32bc59[_0x458a('0x34')][_0x458a('0x3f')]){_0x45e06c['where']=_[_0x458a('0x40')](_0x45e06c[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x45e06c[_0x458a('0x38')],function(_0x17099e){var _0x1bff6a={};_0x1bff6a[_0x17099e]={'$like':'%'+_0x32bc59['query'][_0x458a('0x3f')]+'%'};return _0x1bff6a;})});}_0x45e06c=_[_0x458a('0x40')]({},_0x45e06c,_0x32bc59[_0x458a('0x42')]);return db['CmHopperHistory'][_0x458a('0x1f')]({'where':_0x45e06c[_0x458a('0x3e')]})[_0x458a('0x25')](function(_0x5d1c66){_0x48d2a3['count']=_0x5d1c66;if(_0x32bc59[_0x458a('0x34')]['includeAll']){_0x45e06c['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x45e06c);})['then'](function(_0x3f14bf){_0x48d2a3['rows']=_0x3f14bf;return _0x48d2a3;});}})[_0x458a('0x25')](respondWithFilteredResult(_0x110801,_0x45e06c))[_0x458a('0x46')](handleError(_0x110801,null));};exports[_0x458a('0x5d')]=function(_0xfcb712,_0x277685,_0x42c217){var _0x555190={'raw':!![],'where':{}};var _0x11ebe7={};var _0x59ad9c={'count':0x0,'rows':[]};return db[_0x458a('0x30')]['findOne']({'where':{'id':_0xfcb712[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x277685,null))['then'](function(_0x5d0912){if(_0x5d0912){_0x11ebe7['model']=_[_0x458a('0x35')](db[_0x458a('0x5e')][_0x458a('0x48')]);_0x11ebe7[_0x458a('0x34')]=_[_0x458a('0x35')](_0xfcb712['query']);_0x11ebe7[_0x458a('0x36')]=_[_0x458a('0x37')](_0x11ebe7[_0x458a('0x33')],_0x11ebe7[_0x458a('0x34')]);_0x555190[_0x458a('0x38')]=_[_0x458a('0x37')](_0x11ebe7[_0x458a('0x33')],qs[_0x458a('0x39')](_0xfcb712['query'][_0x458a('0x39')]));_0x555190[_0x458a('0x38')]=_0x555190[_0x458a('0x38')][_0x458a('0x3a')]?_0x555190[_0x458a('0x38')]:_0x11ebe7[_0x458a('0x33')];if(!_0xfcb712[_0x458a('0x34')]['hasOwnProperty']('nolimit')){_0x555190['limit']=qs['limit'](_0xfcb712[_0x458a('0x34')][_0x458a('0x1e')]);_0x555190[_0x458a('0x20')]=qs[_0x458a('0x20')](_0xfcb712['query'][_0x458a('0x20')]);}_0x555190[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0xfcb712[_0x458a('0x34')]['sort']);_0x555190['where']=qs[_0x458a('0x36')](_[_0x458a('0x5a')](_0xfcb712[_0x458a('0x34')],_0x11ebe7[_0x458a('0x36')]));_0x555190['where'][_0x458a('0x5b')]=_0x5d0912['id'];if(_0xfcb712[_0x458a('0x34')][_0x458a('0x3f')]){_0x555190[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x555190[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x555190[_0x458a('0x38')],function(_0x39dd8a){var _0x2ebb0b={};_0x2ebb0b[_0x39dd8a]={'$like':'%'+_0xfcb712['query']['filter']+'%'};return _0x2ebb0b;})});}_0x555190=_[_0x458a('0x40')]({},_0x555190,_0xfcb712[_0x458a('0x42')]);return db[_0x458a('0x5e')][_0x458a('0x1f')]({'where':_0x555190[_0x458a('0x3e')]})[_0x458a('0x25')](function(_0x213f2f){_0x59ad9c['count']=_0x213f2f;if(_0xfcb712[_0x458a('0x34')]['includeAll']){_0x555190[_0x458a('0x44')]=[{'all':!![]}];}return db[_0x458a('0x5e')][_0x458a('0x45')](_0x555190);})['then'](function(_0x589496){_0x59ad9c[_0x458a('0x5f')]=_0x589496;return _0x59ad9c;});}})[_0x458a('0x25')](respondWithFilteredResult(_0x277685,_0x555190))[_0x458a('0x46')](handleError(_0x277685,null));};exports[_0x458a('0x60')]=function(_0x21d4df,_0x53d065,_0x391854){var _0x35d811={'raw':!![],'where':{}};var _0x3b8a15={};var _0x43bc92={'count':0x0,'rows':[]};return db[_0x458a('0x30')][_0x458a('0x57')]({'where':{'id':_0x21d4df[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x53d065,null))[_0x458a('0x25')](function(_0x52b844){if(_0x52b844){_0x3b8a15[_0x458a('0x33')]=_['keys'](db[_0x458a('0x61')][_0x458a('0x48')]);_0x3b8a15[_0x458a('0x34')]=_['keys'](_0x21d4df['query']);_0x3b8a15[_0x458a('0x36')]=_['intersection'](_0x3b8a15[_0x458a('0x33')],_0x3b8a15['query']);_0x35d811[_0x458a('0x38')]=_[_0x458a('0x37')](_0x3b8a15[_0x458a('0x33')],qs['fields'](_0x21d4df[_0x458a('0x34')][_0x458a('0x39')]));_0x35d811['attributes']=_0x35d811[_0x458a('0x38')]['length']?_0x35d811[_0x458a('0x38')]:_0x3b8a15[_0x458a('0x33')];if(!_0x21d4df[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x35d811[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x21d4df[_0x458a('0x34')][_0x458a('0x1e')]);_0x35d811[_0x458a('0x20')]=qs['offset'](_0x21d4df[_0x458a('0x34')][_0x458a('0x20')]);}_0x35d811['order']=qs[_0x458a('0x3d')](_0x21d4df[_0x458a('0x34')][_0x458a('0x3d')]);_0x35d811['where']=qs[_0x458a('0x36')](_[_0x458a('0x5a')](_0x21d4df[_0x458a('0x34')],_0x3b8a15['filters']));_0x35d811[_0x458a('0x3e')][_0x458a('0x5b')]=_0x52b844['id'];if(_0x21d4df[_0x458a('0x34')][_0x458a('0x3f')]){_0x35d811[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x35d811[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x35d811['attributes'],function(_0x3c3c7b){var _0x4bb339={};_0x4bb339[_0x3c3c7b]={'$like':'%'+_0x21d4df['query'][_0x458a('0x3f')]+'%'};return _0x4bb339;})});}_0x35d811=_[_0x458a('0x40')]({},_0x35d811,_0x21d4df['options']);return db[_0x458a('0x61')]['count']({'where':_0x35d811[_0x458a('0x3e')]})['then'](function(_0x31b9ba){_0x43bc92[_0x458a('0x1f')]=_0x31b9ba;if(_0x21d4df[_0x458a('0x34')][_0x458a('0x43')]){_0x35d811['include']=[{'all':!![]}];}return db[_0x458a('0x61')][_0x458a('0x45')](_0x35d811);})[_0x458a('0x25')](function(_0x4df0b4){_0x43bc92[_0x458a('0x5f')]=_0x4df0b4;return _0x43bc92;});}})[_0x458a('0x25')](respondWithFilteredResult(_0x53d065,_0x35d811))[_0x458a('0x46')](handleError(_0x53d065,null));};exports[_0x458a('0x62')]=function(_0x4ca16b,_0x159253,_0x59df0a){var _0x5edd35={};var _0x53dfea={};var _0x34712b;var _0x202311;return db['Campaign'][_0x458a('0x57')]({'where':{'id':_0x4ca16b['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x159253,null))['then'](function(_0x310a09){if(_0x310a09){_0x34712b=_0x310a09;_0x53dfea['model']=_[_0x458a('0x35')](db[_0x458a('0x63')][_0x458a('0x48')]);_0x53dfea[_0x458a('0x34')]=_[_0x458a('0x35')](_0x4ca16b[_0x458a('0x34')]);_0x53dfea[_0x458a('0x36')]=_['intersection'](_0x53dfea[_0x458a('0x33')],_0x53dfea[_0x458a('0x34')]);_0x5edd35[_0x458a('0x38')]=_['intersection'](_0x53dfea['model'],qs[_0x458a('0x39')](_0x4ca16b[_0x458a('0x34')][_0x458a('0x39')]));_0x5edd35[_0x458a('0x38')]=_0x5edd35[_0x458a('0x38')]['length']?_0x5edd35[_0x458a('0x38')]:_0x53dfea[_0x458a('0x33')];_0x5edd35[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x4ca16b[_0x458a('0x34')]['sort']);_0x5edd35[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x5a')](_0x4ca16b[_0x458a('0x34')],_0x53dfea[_0x458a('0x36')]));if(_0x4ca16b[_0x458a('0x34')][_0x458a('0x3f')]){_0x5edd35['where']=_[_0x458a('0x40')](_0x5edd35['where'],{'$or':_[_0x458a('0x2f')](_0x5edd35[_0x458a('0x38')],function(_0x293d9c){var _0xee6749={};_0xee6749[_0x293d9c]={'$like':'%'+_0x4ca16b[_0x458a('0x34')]['filter']+'%'};return _0xee6749;})});}_0x5edd35=_[_0x458a('0x40')]({},_0x5edd35,_0x4ca16b[_0x458a('0x42')]);return _0x34712b[_0x458a('0x62')](_0x5edd35);}})[_0x458a('0x25')](function(_0x1eca8e){if(_0x1eca8e){_0x202311=_0x1eca8e['length'];if(!_0x4ca16b[_0x458a('0x34')][_0x458a('0x59')](_0x458a('0x3b'))){_0x5edd35[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x4ca16b['query']['limit']);_0x5edd35['offset']=qs[_0x458a('0x20')](_0x4ca16b[_0x458a('0x34')][_0x458a('0x20')]);}return _0x34712b[_0x458a('0x62')](_0x5edd35);}})[_0x458a('0x25')](function(_0x5108ad){if(_0x5108ad){return _0x5108ad?{'count':_0x202311,'rows':_0x5108ad}:null;}})[_0x458a('0x25')](respondWithResult(_0x159253,null))[_0x458a('0x46')](handleError(_0x159253,null));};exports['addLists']=function(_0x441ea0,_0x2db3d4,_0x51ce46){var _0x31cdbd,_0x218e33;var _0x33e71f=[];var _0x5dd2ec=moment()['format'](_0x458a('0x64'));return db[_0x458a('0x30')]['find']({'where':{'id':_0x441ea0[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2db3d4,null))[_0x458a('0x25')](function(_0x40aa5d){if(_0x40aa5d){_0x218e33=_0x40aa5d;return _0x40aa5d['addLists'](_0x441ea0[_0x458a('0x4b')][_0x458a('0x65')],_[_0x458a('0x51')](_0x441ea0['body'],[_0x458a('0x65'),'id'])||{});}return null;})[_0x458a('0x66')](function(_0x3c204e){var _0x45f4c6;var _0x4c2550;_0x31cdbd=_0x3c204e||[];var _0x1ff9cf=[];if(_0x3c204e){for(var _0x44e32b=0x0;_0x44e32b<_0x3c204e[_0x458a('0x3a')];_0x44e32b+=0x1){var _0x2c20b6=_0x3c204e[_0x44e32b][_0x458a('0x27')]({'plain':!![]});_0x218e33[_0x458a('0x67')]=_0x441ea0['body'][_0x458a('0x67')]?_0x441ea0[_0x458a('0x4b')][_0x458a('0x67')]:_0x218e33['dialCheckDuplicateType'];switch(_0x218e33[_0x458a('0x67')]){case _0x458a('0x68'):_0x45f4c6=squel[_0x458a('0x69')]()[_0x458a('0x6a')]('cm_hopper')[_0x458a('0x6b')]([_0x458a('0x6c'),_0x458a('0x6d'),_0x458a('0x6e'),_0x458a('0x6f'),_0x458a('0x5b'),'createdAt',_0x458a('0x53')],squel[_0x458a('0x70')]()[_0x458a('0x71')](_0x458a('0x6c'),'phone')[_0x458a('0x71')]('NOW()',_0x458a('0x6d'))[_0x458a('0x71')]('id',_0x458a('0x6e'))[_0x458a('0x71')](_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')](),'ListId')[_0x458a('0x71')](_0x441ea0['params']['id'][_0x458a('0x73')](),'CampaignId')[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x52'))[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x53'))[_0x458a('0x74')](_0x458a('0x75'))[_0x458a('0x3e')](_0x458a('0x76'))[_0x458a('0x3e')](_0x458a('0x77'),_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')]())['where'](_0x458a('0x78'))['where'](_0x458a('0x79'),squel[_0x458a('0x70')]()[_0x458a('0x71')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0x458a('0x3e')](_0x458a('0x7a'),_0x441ea0[_0x458a('0x47')]['id']['toString']()))[_0x458a('0x3e')](_0x458a('0x79'),squel[_0x458a('0x70')]()['field'](_0x458a('0x7b'))[_0x458a('0x74')]('cm_hopper')[_0x458a('0x3e')](_0x458a('0x7a'),_0x441ea0[_0x458a('0x47')]['id'][_0x458a('0x73')]())))['toString']();break;case _0x458a('0x7c'):_0x45f4c6=squel[_0x458a('0x69')]()[_0x458a('0x6a')](_0x458a('0x7d'))[_0x458a('0x6b')]([_0x458a('0x6c'),_0x458a('0x6d'),_0x458a('0x6e'),_0x458a('0x6f'),_0x458a('0x5b'),_0x458a('0x52'),_0x458a('0x53')],squel['select']()['field'](_0x458a('0x6c'),_0x458a('0x6c'))[_0x458a('0x71')](_0x458a('0x7e'),_0x458a('0x6d'))['field']('id',_0x458a('0x6e'))[_0x458a('0x71')](_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')](),_0x458a('0x6f'))[_0x458a('0x71')](_0x441ea0[_0x458a('0x47')]['id']['toString'](),_0x458a('0x5b'))[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27','createdAt')[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x53'))[_0x458a('0x74')](_0x458a('0x75'))['where'](_0x458a('0x76'))[_0x458a('0x3e')](_0x458a('0x77'),_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')]())[_0x458a('0x3e')](_0x458a('0x78'))[_0x458a('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x458a('0x70')]()[_0x458a('0x71')](_0x458a('0x7b'))['from'](_0x458a('0x7d'))[_0x458a('0x3e')]('CampaignId\x20=\x20?',_0x441ea0[_0x458a('0x47')]['id'][_0x458a('0x73')]())))[_0x458a('0x73')]();break;default:_0x45f4c6=squel[_0x458a('0x69')]()['into'](_0x458a('0x7d'))['fromQuery']([_0x458a('0x6c'),_0x458a('0x6d'),_0x458a('0x6e'),_0x458a('0x6f'),_0x458a('0x5b'),_0x458a('0x52'),_0x458a('0x53')],squel['select']()[_0x458a('0x71')](_0x458a('0x6c'),'phone')[_0x458a('0x71')](_0x458a('0x7e'),'scheduledAt')['field']('id',_0x458a('0x6e'))[_0x458a('0x71')](_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')](),_0x458a('0x6f'))['field'](_0x441ea0[_0x458a('0x47')]['id'][_0x458a('0x73')](),_0x458a('0x5b'))[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27','createdAt')[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x53'))[_0x458a('0x74')](_0x458a('0x75'))[_0x458a('0x3e')](_0x458a('0x76'))[_0x458a('0x3e')]('ListId\x20=\x20?',_0x2c20b6[_0x458a('0x72')][_0x458a('0x73')]())[_0x458a('0x3e')](_0x458a('0x78')))[_0x458a('0x73')]();}_0x4c2550=squel[_0x458a('0x69')]()[_0x458a('0x6a')](_0x458a('0x7f'))['fromQuery']([_0x458a('0x80'),_0x458a('0x6d'),_0x458a('0x6c'),_0x458a('0x81'),'createdAt',_0x458a('0x53')],squel[_0x458a('0x70')]()['field']('h.id','id')[_0x458a('0x71')](_0x458a('0x7e'),'scheduledAt')[_0x458a('0x71')]('ci.item',_0x458a('0x6c'))['field'](_0x458a('0x82'),_0x458a('0x81'))['field']('\x27'+_0x5dd2ec+'\x27',_0x458a('0x52'))[_0x458a('0x71')]('\x27'+_0x5dd2ec+'\x27',_0x458a('0x53'))[_0x458a('0x74')](_0x458a('0x83'),'ci')[_0x458a('0x84')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x458a('0x3e')](_0x458a('0x85'),_0x2c20b6['CmListId'][_0x458a('0x73')]())['where'](_0x458a('0x86'),_0x441ea0[_0x458a('0x47')]['id'][_0x458a('0x73')]())[_0x458a('0x3e')]('h.createdAt\x20=\x20?',_0x5dd2ec))['toString']();_0x1ff9cf[_0x458a('0x87')](db['sequelize'][_0x458a('0x34')](_0x45f4c6));_0x33e71f['push'](db[_0x458a('0x88')][_0x458a('0x34')](_0x4c2550));}return BPromise[_0x458a('0x89')](_0x1ff9cf);}})['then'](function(){return BPromise[_0x458a('0x89')](_0x33e71f);})[_0x458a('0x25')](function(){return _0x31cdbd;})['then'](respondWithResult(_0x2db3d4,null))[_0x458a('0x46')](handleError(_0x2db3d4,null));};exports[_0x458a('0x8a')]=function(_0x2f7643,_0x246cad,_0x5cf14d){return db['Campaign']['find']({'where':{'id':_0x2f7643['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x246cad,null))['then'](function(_0x1af080){if(_0x1af080){return _0x1af080[_0x458a('0x8a')](_0x2f7643[_0x458a('0x34')][_0x458a('0x65')]);}})[_0x458a('0x25')](function(_0x4861e3){if(_0x4861e3){return db[_0x458a('0x58')][_0x458a('0x26')]({'where':{'ListId':_0x2f7643[_0x458a('0x34')]['ids'],'CampaignId':_0x2f7643[_0x458a('0x47')]['id']}})['then'](function(){return _0x4861e3;});}})[_0x458a('0x25')](respondWithStatusCode(_0x246cad,null))[_0x458a('0x46')](handleError(_0x246cad,null));};exports['getBlackLists']=function(_0x4788e1,_0x292c1e,_0x4b275f){var _0x1897bb={};var _0x564bdb={};var _0x183db9;var _0x1875b4;return db[_0x458a('0x30')][_0x458a('0x57')]({'where':{'id':_0x4788e1['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x292c1e,null))['then'](function(_0xf5de4d){if(_0xf5de4d){_0x183db9=_0xf5de4d;_0x564bdb[_0x458a('0x33')]=_[_0x458a('0x35')](db[_0x458a('0x63')][_0x458a('0x48')]);_0x564bdb[_0x458a('0x34')]=_[_0x458a('0x35')](_0x4788e1['query']);_0x564bdb[_0x458a('0x36')]=_[_0x458a('0x37')](_0x564bdb[_0x458a('0x33')],_0x564bdb[_0x458a('0x34')]);_0x1897bb['attributes']=_[_0x458a('0x37')](_0x564bdb['model'],qs['fields'](_0x4788e1[_0x458a('0x34')][_0x458a('0x39')]));_0x1897bb[_0x458a('0x38')]=_0x1897bb[_0x458a('0x38')][_0x458a('0x3a')]?_0x1897bb[_0x458a('0x38')]:_0x564bdb[_0x458a('0x33')];_0x1897bb[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x4788e1[_0x458a('0x34')][_0x458a('0x3d')]);_0x1897bb[_0x458a('0x3e')]=qs['filters'](_[_0x458a('0x5a')](_0x4788e1[_0x458a('0x34')],_0x564bdb[_0x458a('0x36')]));if(_0x4788e1['query'][_0x458a('0x3f')]){_0x1897bb['where']=_['merge'](_0x1897bb[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x1897bb[_0x458a('0x38')],function(_0xa608fb){var _0x239d5e={};_0x239d5e[_0xa608fb]={'$like':'%'+_0x4788e1[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x239d5e;})});}_0x1897bb=_[_0x458a('0x40')]({},_0x1897bb,_0x4788e1[_0x458a('0x42')]);return _0x183db9['getBlackLists'](_0x1897bb);}})['then'](function(_0x581309){if(_0x581309){_0x1875b4=_0x581309[_0x458a('0x3a')];if(!_0x4788e1[_0x458a('0x34')][_0x458a('0x59')](_0x458a('0x3b'))){_0x1897bb[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x4788e1['query'][_0x458a('0x1e')]);_0x1897bb[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x4788e1[_0x458a('0x34')][_0x458a('0x20')]);}return _0x183db9['getBlackLists'](_0x1897bb);}})[_0x458a('0x25')](function(_0x474070){if(_0x474070){return _0x474070?{'count':_0x1875b4,'rows':_0x474070}:null;}})[_0x458a('0x25')](respondWithResult(_0x292c1e,null))['catch'](handleError(_0x292c1e,null));};exports[_0x458a('0x8b')]=function(_0x26ed49,_0xd022a8,_0x41cd77){var _0x203d8a,_0x50eebc;var _0x599e45=[];var _0x571c0e=moment()[_0x458a('0x8c')](_0x458a('0x64'));return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x26ed49[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0xd022a8,null))[_0x458a('0x25')](function(_0x3f5ef3){if(_0x3f5ef3){_0x50eebc=_0x3f5ef3;return _0x3f5ef3[_0x458a('0x8b')](_0x26ed49[_0x458a('0x4b')][_0x458a('0x65')],_['omit'](_0x26ed49[_0x458a('0x4b')],[_0x458a('0x65'),'id'])||{});}return null;})[_0x458a('0x66')](function(_0x4a3c74){var _0x18bafd;var _0x51cf12;_0x203d8a=_0x4a3c74||[];var _0x423fd7=[];if(_0x4a3c74){for(var _0x5cc7b4=0x0;_0x5cc7b4<_0x4a3c74[_0x458a('0x3a')];_0x5cc7b4+=0x1){var _0x327d8d=_0x4a3c74[_0x5cc7b4][_0x458a('0x27')]({'plain':!![]});_0x18bafd=squel['insert']()[_0x458a('0x6a')](_0x458a('0x8d'))[_0x458a('0x6b')]([_0x458a('0x6c'),_0x458a('0x6e'),_0x458a('0x6f'),'CampaignId','createdAt',_0x458a('0x53')],squel['select']()[_0x458a('0x71')](_0x458a('0x6c'),_0x458a('0x6c'))[_0x458a('0x71')]('id',_0x458a('0x6e'))[_0x458a('0x71')](_0x327d8d['CmListId'][_0x458a('0x73')](),_0x458a('0x6f'))[_0x458a('0x71')](_0x26ed49[_0x458a('0x47')]['id'][_0x458a('0x73')](),_0x458a('0x5b'))[_0x458a('0x71')](_0x458a('0x7e'),_0x458a('0x52'))['field'](_0x458a('0x7e'),'updatedAt')[_0x458a('0x74')](_0x458a('0x75'))[_0x458a('0x3e')]('deletedAt\x20IS\x20NULL')[_0x458a('0x3e')]('ListId\x20=\x20?',_0x327d8d['CmListId'][_0x458a('0x73')]())[_0x458a('0x3e')](_0x458a('0x78')))[_0x458a('0x73')]();_0x423fd7[_0x458a('0x87')](db[_0x458a('0x88')][_0x458a('0x34')](_0x18bafd));}return BPromise[_0x458a('0x89')](_0x423fd7);}})['then'](function(){return _0x203d8a;})[_0x458a('0x25')](respondWithResult(_0xd022a8,null))[_0x458a('0x46')](handleError(_0xd022a8,null));};exports['removeBlackLists']=function(_0x1ec986,_0x174ada,_0x267ea2){return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x1ec986[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x174ada,null))[_0x458a('0x25')](function(_0x3b6884){if(_0x3b6884){return _0x3b6884[_0x458a('0x8e')](_0x1ec986[_0x458a('0x34')][_0x458a('0x65')]);}})[_0x458a('0x25')](function(_0x5c1efd){if(_0x5c1efd){return db[_0x458a('0x61')][_0x458a('0x26')]({'where':{'ListId':_0x1ec986[_0x458a('0x34')][_0x458a('0x65')],'CampaignId':_0x1ec986[_0x458a('0x47')]['id']}})[_0x458a('0x25')](function(){return _0x5c1efd;});}})[_0x458a('0x25')](respondWithStatusCode(_0x174ada,null))['catch'](handleError(_0x174ada,null));}; \ No newline at end of file +var _0xb8fb=['OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.CampaignId=?','h.createdAt\x20=\x20?','push','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','findOne','nolimit','CmHopper','getHopperHistories','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','cm_hopper_additional_phones'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0xb8fb,0xa4));var _0xbb8f=function(_0x46ff3f,_0x27e699){_0x46ff3f=_0x46ff3f-0x0;var _0x4b88ec=_0xb8fb[_0x46ff3f];return _0x4b88ec;};'use strict';var emlformat=require(_0xbb8f('0x0'));var rimraf=require(_0xbb8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb8f('0x2'));var rp=require(_0xbb8f('0x3'));var moment=require(_0xbb8f('0x4'));var BPromise=require(_0xbb8f('0x5'));var Mustache=require(_0xbb8f('0x6'));var util=require(_0xbb8f('0x7'));var path=require(_0xbb8f('0x8'));var sox=require(_0xbb8f('0x9'));var csv=require('to-csv');var ejs=require(_0xbb8f('0xa'));var fs=require('fs');var fs_extra=require(_0xbb8f('0xb'));var _=require(_0xbb8f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb8f('0xd'));var deskjs=require(_0xbb8f('0xe'));var toCsv=require(_0xbb8f('0xf'));var querystring=require(_0xbb8f('0x10'));var Papa=require(_0xbb8f('0x11'));var Redis=require(_0xbb8f('0x12'));var authService=require(_0xbb8f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb8f('0x14'));var logger=require(_0xbb8f('0x15'))(_0xbb8f('0x16'));var utils=require(_0xbb8f('0x17'));var config=require(_0xbb8f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17dc8e,_0xd1ed57){_0xd1ed57=_0xd1ed57||0xcc;return function(_0x550863){if(_0x550863){return _0x17dc8e['sendStatus'](_0xd1ed57);}return _0x17dc8e[_0xbb8f('0x19')](_0xd1ed57)['end']();};}function respondWithResult(_0x580e59,_0x27dfc7){_0x27dfc7=_0x27dfc7||0xc8;return function(_0x220e2e){if(_0x220e2e){return _0x580e59[_0xbb8f('0x19')](_0x27dfc7)[_0xbb8f('0x1a')](_0x220e2e);}};}function respondWithFilteredResult(_0x3b1319,_0xcb28dc){return function(_0x3d8bf9){if(_0x3d8bf9){var _0x59a50b=typeof _0xcb28dc[_0xbb8f('0x1b')]===_0xbb8f('0x1c')&&typeof _0xcb28dc[_0xbb8f('0x1d')]==='undefined';var _0x49407d=_0x3d8bf9[_0xbb8f('0x1e')];var _0x5a3b42=_0x59a50b?0x0:_0xcb28dc['offset'];var _0x4569cf=_0x59a50b?_0x3d8bf9[_0xbb8f('0x1e')]:_0xcb28dc['offset']+_0xcb28dc['limit'];var _0x30b927;if(_0x4569cf>=_0x49407d){_0x4569cf=_0x49407d;_0x30b927=0xc8;}else{_0x30b927=0xce;}_0x3b1319[_0xbb8f('0x19')](_0x30b927);return _0x3b1319[_0xbb8f('0x1f')](_0xbb8f('0x20'),_0x5a3b42+'-'+_0x4569cf+'/'+_0x49407d)[_0xbb8f('0x1a')](_0x3d8bf9);}return null;};}function patchUpdates(_0x17af11){return function(_0xe44ce6){try{jsonpatch[_0xbb8f('0x21')](_0xe44ce6,_0x17af11,!![]);}catch(_0x251ab5){return BPromise[_0xbb8f('0x22')](_0x251ab5);}return _0xe44ce6[_0xbb8f('0x23')]();};}function saveUpdates(_0x168cc9,_0x3694e6){return function(_0x2fd010){if(_0x2fd010){return _0x2fd010[_0xbb8f('0x24')](_0x168cc9)[_0xbb8f('0x25')](function(_0x36ee1c){return _0x36ee1c;});}return null;};}function removeEntity(_0x1ed971,_0x5ac3d7){return function(_0x138883){if(_0x138883){return _0x138883[_0xbb8f('0x26')]()[_0xbb8f('0x25')](function(){var _0x48936f=_0x138883['get']({'plain':!![]});var _0x4de617=_0xbb8f('0x27');return db[_0xbb8f('0x28')][_0xbb8f('0x26')]({'where':{'type':_0x4de617,'resourceId':_0x48936f['id']}})['then'](function(){return _0x138883;});})['then'](function(){_0x1ed971[_0xbb8f('0x19')](0xcc)[_0xbb8f('0x29')]();});}};}function handleEntityNotFound(_0x16c705,_0xab1b4){return function(_0x432e3f){if(!_0x432e3f){_0x16c705[_0xbb8f('0x2a')](0x194);}return _0x432e3f;};}function handleError(_0x1b44d3,_0x51ec97){_0x51ec97=_0x51ec97||0x1f4;return function(_0x31d1e3){logger[_0xbb8f('0x2b')](_0x31d1e3['stack']);if(_0x31d1e3['name']){delete _0x31d1e3[_0xbb8f('0x2c')];}_0x1b44d3[_0xbb8f('0x19')](_0x51ec97)[_0xbb8f('0x2d')](_0x31d1e3);};}exports[_0xbb8f('0x2e')]=function(_0x4937c7,_0x1a695b){var _0x18d24f={},_0x40f78f={},_0x4948e5={'count':0x0,'rows':[]};var _0x51800d=_[_0xbb8f('0x2f')](db['Campaign'][_0xbb8f('0x30')],function(_0x44c24f){return{'name':_0x44c24f[_0xbb8f('0x31')],'type':_0x44c24f['type'][_0xbb8f('0x32')]};});_0x40f78f[_0xbb8f('0x33')]=_[_0xbb8f('0x2f')](_0x51800d,'name');_0x40f78f['query']=_[_0xbb8f('0x34')](_0x4937c7[_0xbb8f('0x35')]);_0x40f78f[_0xbb8f('0x36')]=_[_0xbb8f('0x37')](_0x40f78f[_0xbb8f('0x33')],_0x40f78f[_0xbb8f('0x35')]);_0x18d24f[_0xbb8f('0x38')]=_['intersection'](_0x40f78f['model'],qs[_0xbb8f('0x39')](_0x4937c7[_0xbb8f('0x35')][_0xbb8f('0x39')]));_0x18d24f[_0xbb8f('0x38')]=_0x18d24f[_0xbb8f('0x38')]['length']?_0x18d24f['attributes']:_0x40f78f['model'];if(!_0x4937c7[_0xbb8f('0x35')][_0xbb8f('0x3a')]('nolimit')){_0x18d24f[_0xbb8f('0x1d')]=qs[_0xbb8f('0x1d')](_0x4937c7[_0xbb8f('0x35')]['limit']);_0x18d24f[_0xbb8f('0x1b')]=qs[_0xbb8f('0x1b')](_0x4937c7[_0xbb8f('0x35')][_0xbb8f('0x1b')]);}_0x18d24f[_0xbb8f('0x3b')]=qs[_0xbb8f('0x3c')](_0x4937c7[_0xbb8f('0x35')][_0xbb8f('0x3c')]);_0x18d24f[_0xbb8f('0x3d')]=qs[_0xbb8f('0x36')](_[_0xbb8f('0x3e')](_0x4937c7['query'],_0x40f78f[_0xbb8f('0x36')]),_0x51800d);if(_0x4937c7['query'][_0xbb8f('0x3f')]){_0x18d24f[_0xbb8f('0x3d')]=_[_0xbb8f('0x40')](_0x18d24f[_0xbb8f('0x3d')],{'$or':_['map'](_0x51800d,function(_0x15d440){if(_0x15d440[_0xbb8f('0x41')]!==_0xbb8f('0x42')){var _0x2a4fd9={};_0x2a4fd9[_0x15d440[_0xbb8f('0x2c')]]={'$like':'%'+_0x4937c7[_0xbb8f('0x35')][_0xbb8f('0x3f')]+'%'};return _0x2a4fd9;}})});}_0x18d24f=_[_0xbb8f('0x40')]({},_0x18d24f,_0x4937c7[_0xbb8f('0x43')]);var _0x752d7={'where':_0x18d24f[_0xbb8f('0x3d')]};return db[_0xbb8f('0x44')]['count'](_0x752d7)[_0xbb8f('0x25')](function(_0x4117a7){_0x4948e5[_0xbb8f('0x1e')]=_0x4117a7;if(_0x4937c7[_0xbb8f('0x35')][_0xbb8f('0x45')]){_0x18d24f[_0xbb8f('0x46')]=[{'all':!![]}];}return db['Campaign'][_0xbb8f('0x47')](_0x18d24f);})[_0xbb8f('0x25')](function(_0x35d82a){_0x4948e5[_0xbb8f('0x48')]=_0x35d82a;return _0x4948e5;})[_0xbb8f('0x25')](respondWithFilteredResult(_0x1a695b,_0x18d24f))[_0xbb8f('0x49')](handleError(_0x1a695b,null));};exports[_0xbb8f('0x4a')]=function(_0x14470d,_0x2c0df5){var _0x4d074a={'raw':![],'where':{'id':_0x14470d['params']['id']}},_0x519e00={};_0x519e00[_0xbb8f('0x33')]=_[_0xbb8f('0x34')](db['Campaign'][_0xbb8f('0x30')]);_0x519e00['query']=_[_0xbb8f('0x34')](_0x14470d[_0xbb8f('0x35')]);_0x519e00[_0xbb8f('0x36')]=_[_0xbb8f('0x37')](_0x519e00[_0xbb8f('0x33')],_0x519e00[_0xbb8f('0x35')]);_0x4d074a[_0xbb8f('0x38')]=_['intersection'](_0x519e00[_0xbb8f('0x33')],qs['fields'](_0x14470d[_0xbb8f('0x35')][_0xbb8f('0x39')]));_0x4d074a['attributes']=_0x4d074a[_0xbb8f('0x38')][_0xbb8f('0x4b')]?_0x4d074a[_0xbb8f('0x38')]:_0x519e00['model'];if(_0x14470d['query'][_0xbb8f('0x45')]){_0x4d074a[_0xbb8f('0x46')]=[{'all':!![]}];}_0x4d074a=_[_0xbb8f('0x40')]({},_0x4d074a,_0x14470d[_0xbb8f('0x43')]);return db[_0xbb8f('0x44')][_0xbb8f('0x4c')](_0x4d074a)[_0xbb8f('0x25')](handleEntityNotFound(_0x2c0df5,null))['then'](respondWithResult(_0x2c0df5,null))[_0xbb8f('0x49')](handleError(_0x2c0df5,null));};exports['create']=function(_0x3769dc,_0xb3cb20){return db['Campaign'][_0xbb8f('0x4d')](_0x3769dc[_0xbb8f('0x4e')],{})[_0xbb8f('0x25')](function(_0xbcb01f){var _0x18a516=_0x3769dc[_0xbb8f('0x4f')]['get']({'plain':!![]});if(!_0x18a516)throw new Error(_0xbb8f('0x50'));if(_0x18a516[_0xbb8f('0x51')]===_0xbb8f('0x4f')){var _0x2d3ace=_0xbcb01f[_0xbb8f('0x52')]({'plain':!![]});var _0x3f90af=_0xbb8f('0x27');return db[_0xbb8f('0x53')][_0xbb8f('0x4c')]({'where':{'name':_0x3f90af,'userProfileId':_0x18a516[_0xbb8f('0x54')]},'raw':!![]})[_0xbb8f('0x25')](function(_0x27cfaa){if(_0x27cfaa&&_0x27cfaa[_0xbb8f('0x55')]===0x0){return db[_0xbb8f('0x28')][_0xbb8f('0x4d')]({'name':_0x2d3ace[_0xbb8f('0x2c')],'resourceId':_0x2d3ace['id'],'type':_0x27cfaa[_0xbb8f('0x2c')],'sectionId':_0x27cfaa['id']},{})[_0xbb8f('0x25')](function(){return _0xbcb01f;});}else{return _0xbcb01f;}})[_0xbb8f('0x49')](function(_0x3c78ad){logger[_0xbb8f('0x2b')](_0xbb8f('0x56'),_0x3c78ad);throw _0x3c78ad;});}return _0xbcb01f;})[_0xbb8f('0x25')](respondWithResult(_0xb3cb20,0xc9))[_0xbb8f('0x49')](handleError(_0xb3cb20,null));};exports['clone']=function(_0x11615e,_0x132058){var _0x199590={'where':{'id':_0x11615e[_0xbb8f('0x57')]['id']}},_0x4b53cf={};_0x4b53cf[_0xbb8f('0x33')]=_['keys'](db[_0xbb8f('0x44')]['rawAttributes']);_0x199590['attributes']=_['intersection'](_0x4b53cf[_0xbb8f('0x33')],qs[_0xbb8f('0x39')](_0x11615e[_0xbb8f('0x35')][_0xbb8f('0x39')]));_0x199590[_0xbb8f('0x38')]=_0x199590['attributes'][_0xbb8f('0x4b')]?_0x199590[_0xbb8f('0x38')]:_0x4b53cf['model'];if(_0x11615e[_0xbb8f('0x35')][_0xbb8f('0x45')]){_0x199590['include']=[{'all':!![]}];}_0x199590=_[_0xbb8f('0x40')]({},_0x199590,_0x11615e['options']);return db['Campaign'][_0xbb8f('0x4c')](_0x199590)[_0xbb8f('0x25')](handleEntityNotFound(_0x132058,null))['then'](function(_0xc3227c){if(_0xc3227c){var _0x4b978f=_0xc3227c[_0xbb8f('0x52')]({'plain':!![]});_0x4b978f=qs[_0xbb8f('0x58')](_0x4b978f,['id','createdAt','updatedAt']);_0x11615e[_0xbb8f('0x4e')]=_[_0xbb8f('0x58')](_0x11615e['body'],['id',_0xbb8f('0x59'),_0xbb8f('0x5a')]);return db[_0xbb8f('0x44')][_0xbb8f('0x4d')](_['merge'](_0x4b978f,_0x11615e[_0xbb8f('0x4e')]),{'include':_0x11615e[_0xbb8f('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x54d846){var _0x467d0d=_0x11615e['user'][_0xbb8f('0x52')]({'plain':!![]});if(!_0x467d0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x467d0d[_0xbb8f('0x51')]===_0xbb8f('0x4f')){var _0xe5b4bb=_0x54d846[_0xbb8f('0x52')]({'plain':!![]});var _0x3cc52e=_0xbb8f('0x27');return db['UserProfileSection'][_0xbb8f('0x4c')]({'where':{'name':_0x3cc52e,'userProfileId':_0x467d0d[_0xbb8f('0x54')]},'raw':!![]})[_0xbb8f('0x25')](function(_0x10607d){if(_0x10607d&&_0x10607d[_0xbb8f('0x55')]===0x0){return db[_0xbb8f('0x28')]['create']({'name':_0xe5b4bb[_0xbb8f('0x2c')],'resourceId':_0xe5b4bb['id'],'type':_0x10607d[_0xbb8f('0x2c')],'sectionId':_0x10607d['id']},{})[_0xbb8f('0x25')](function(){return _0x54d846;});}else{return _0x54d846;}})['catch'](function(_0x5e38a7){logger[_0xbb8f('0x2b')](_0xbb8f('0x56'),_0x5e38a7);throw _0x5e38a7;});}return _0x54d846;});}})[_0xbb8f('0x25')](respondWithResult(_0x132058,0xc9))[_0xbb8f('0x49')](handleError(_0x132058,null));};exports[_0xbb8f('0x24')]=function(_0x4fc9d7,_0xd76966){if(_0x4fc9d7[_0xbb8f('0x4e')]['id']){delete _0x4fc9d7[_0xbb8f('0x4e')]['id'];}return db[_0xbb8f('0x44')][_0xbb8f('0x4c')]({'where':{'id':_0x4fc9d7['params']['id']}})['then'](handleEntityNotFound(_0xd76966,null))[_0xbb8f('0x25')](saveUpdates(_0x4fc9d7['body'],null))[_0xbb8f('0x25')](respondWithResult(_0xd76966,null))[_0xbb8f('0x49')](handleError(_0xd76966,null));};exports['destroy']=function(_0x34428f,_0x1bf763){return db[_0xbb8f('0x44')]['find']({'where':{'id':_0x34428f[_0xbb8f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1bf763,null))[_0xbb8f('0x25')](removeEntity(_0x1bf763,null))[_0xbb8f('0x49')](handleError(_0x1bf763,null));};exports['getHoppers']=function(_0x3e5bc0,_0x143202,_0x3273c4){var _0x2f38b3={'raw':!![],'where':{}};var _0x5be30b={};var _0x5d8853={'count':0x0,'rows':[]};return db[_0xbb8f('0x44')][_0xbb8f('0x5b')]({'where':{'id':_0x3e5bc0[_0xbb8f('0x57')]['id']}})[_0xbb8f('0x25')](handleEntityNotFound(_0x143202,null))[_0xbb8f('0x25')](function(_0x1a89c5){if(_0x1a89c5){_0x5be30b['model']=_[_0xbb8f('0x34')](db['CmHopper'][_0xbb8f('0x30')]);_0x5be30b[_0xbb8f('0x35')]=_[_0xbb8f('0x34')](_0x3e5bc0[_0xbb8f('0x35')]);_0x5be30b[_0xbb8f('0x36')]=_[_0xbb8f('0x37')](_0x5be30b[_0xbb8f('0x33')],_0x5be30b[_0xbb8f('0x35')]);_0x2f38b3[_0xbb8f('0x38')]=_[_0xbb8f('0x37')](_0x5be30b[_0xbb8f('0x33')],qs[_0xbb8f('0x39')](_0x3e5bc0[_0xbb8f('0x35')]['fields']));_0x2f38b3['attributes']=_0x2f38b3[_0xbb8f('0x38')][_0xbb8f('0x4b')]?_0x2f38b3[_0xbb8f('0x38')]:_0x5be30b[_0xbb8f('0x33')];if(!_0x3e5bc0[_0xbb8f('0x35')][_0xbb8f('0x3a')](_0xbb8f('0x5c'))){_0x2f38b3[_0xbb8f('0x1d')]=qs[_0xbb8f('0x1d')](_0x3e5bc0[_0xbb8f('0x35')][_0xbb8f('0x1d')]);_0x2f38b3[_0xbb8f('0x1b')]=qs['offset'](_0x3e5bc0['query'][_0xbb8f('0x1b')]);}_0x2f38b3['order']=qs[_0xbb8f('0x3c')](_0x3e5bc0[_0xbb8f('0x35')][_0xbb8f('0x3c')]);_0x2f38b3[_0xbb8f('0x3d')]=qs['filters'](_[_0xbb8f('0x3e')](_0x3e5bc0[_0xbb8f('0x35')],_0x5be30b[_0xbb8f('0x36')]));_0x2f38b3[_0xbb8f('0x3d')]['CampaignId']=_0x1a89c5['id'];if(_0x3e5bc0[_0xbb8f('0x35')][_0xbb8f('0x3f')]){_0x2f38b3[_0xbb8f('0x3d')]=_[_0xbb8f('0x40')](_0x2f38b3[_0xbb8f('0x3d')],{'$or':_[_0xbb8f('0x2f')](_0x2f38b3['attributes'],function(_0x39c087){var _0x549449={};_0x549449[_0x39c087]={'$like':'%'+_0x3e5bc0[_0xbb8f('0x35')][_0xbb8f('0x3f')]+'%'};return _0x549449;})});}_0x2f38b3=_[_0xbb8f('0x40')]({},_0x2f38b3,_0x3e5bc0[_0xbb8f('0x43')]);return db[_0xbb8f('0x5d')]['count']({'where':_0x2f38b3[_0xbb8f('0x3d')]})['then'](function(_0x318651){_0x5d8853['count']=_0x318651;if(_0x3e5bc0['query'][_0xbb8f('0x45')]){_0x2f38b3[_0xbb8f('0x46')]=[{'all':!![]}];}return db[_0xbb8f('0x5d')][_0xbb8f('0x47')](_0x2f38b3);})[_0xbb8f('0x25')](function(_0x5a979d){_0x5d8853[_0xbb8f('0x48')]=_0x5a979d;return _0x5d8853;});}})[_0xbb8f('0x25')](respondWithFilteredResult(_0x143202,_0x2f38b3))[_0xbb8f('0x49')](handleError(_0x143202,null));};exports[_0xbb8f('0x5e')]=function(_0x260a60,_0xc54f1e,_0x195063){var _0xd4b433={'raw':!![],'where':{}};var _0x4cb14f={};var _0x474c70={'count':0x0,'rows':[]};return db[_0xbb8f('0x44')][_0xbb8f('0x5b')]({'where':{'id':_0x260a60[_0xbb8f('0x57')]['id']}})['then'](handleEntityNotFound(_0xc54f1e,null))['then'](function(_0x36329f){if(_0x36329f){_0x4cb14f[_0xbb8f('0x33')]=_['keys'](db['CmHopperHistory'][_0xbb8f('0x30')]);_0x4cb14f[_0xbb8f('0x35')]=_[_0xbb8f('0x34')](_0x260a60[_0xbb8f('0x35')]);_0x4cb14f[_0xbb8f('0x36')]=_[_0xbb8f('0x37')](_0x4cb14f[_0xbb8f('0x33')],_0x4cb14f[_0xbb8f('0x35')]);_0xd4b433[_0xbb8f('0x38')]=_[_0xbb8f('0x37')](_0x4cb14f[_0xbb8f('0x33')],qs[_0xbb8f('0x39')](_0x260a60[_0xbb8f('0x35')][_0xbb8f('0x39')]));_0xd4b433['attributes']=_0xd4b433[_0xbb8f('0x38')][_0xbb8f('0x4b')]?_0xd4b433['attributes']:_0x4cb14f[_0xbb8f('0x33')];if(!_0x260a60['query']['hasOwnProperty'](_0xbb8f('0x5c'))){_0xd4b433[_0xbb8f('0x1d')]=qs[_0xbb8f('0x1d')](_0x260a60[_0xbb8f('0x35')][_0xbb8f('0x1d')]);_0xd4b433[_0xbb8f('0x1b')]=qs['offset'](_0x260a60[_0xbb8f('0x35')][_0xbb8f('0x1b')]);}_0xd4b433['order']=qs[_0xbb8f('0x3c')](_0x260a60[_0xbb8f('0x35')][_0xbb8f('0x3c')]);_0xd4b433[_0xbb8f('0x3d')]=qs['filters'](_[_0xbb8f('0x3e')](_0x260a60[_0xbb8f('0x35')],_0x4cb14f[_0xbb8f('0x36')]));_0xd4b433['where'][_0xbb8f('0x5f')]=_0x36329f['id'];if(_0x260a60['query'][_0xbb8f('0x3f')]){_0xd4b433['where']=_[_0xbb8f('0x40')](_0xd4b433[_0xbb8f('0x3d')],{'$or':_[_0xbb8f('0x2f')](_0xd4b433[_0xbb8f('0x38')],function(_0x283cd5){var _0x5311e2={};_0x5311e2[_0x283cd5]={'$like':'%'+_0x260a60[_0xbb8f('0x35')][_0xbb8f('0x3f')]+'%'};return _0x5311e2;})});}_0xd4b433=_[_0xbb8f('0x40')]({},_0xd4b433,_0x260a60[_0xbb8f('0x43')]);return db['CmHopperHistory'][_0xbb8f('0x1e')]({'where':_0xd4b433[_0xbb8f('0x3d')]})[_0xbb8f('0x25')](function(_0x1190c6){_0x474c70[_0xbb8f('0x1e')]=_0x1190c6;if(_0x260a60[_0xbb8f('0x35')][_0xbb8f('0x45')]){_0xd4b433[_0xbb8f('0x46')]=[{'all':!![]}];}return db[_0xbb8f('0x60')]['findAll'](_0xd4b433);})['then'](function(_0x43d0ec){_0x474c70[_0xbb8f('0x48')]=_0x43d0ec;return _0x474c70;});}})[_0xbb8f('0x25')](respondWithFilteredResult(_0xc54f1e,_0xd4b433))[_0xbb8f('0x49')](handleError(_0xc54f1e,null));};exports[_0xbb8f('0x61')]=function(_0x3ab72e,_0x9b8604,_0x59f1e1){var _0x21c7f8={'raw':!![],'where':{}};var _0x815664={};var _0x251b36={'count':0x0,'rows':[]};return db[_0xbb8f('0x44')][_0xbb8f('0x5b')]({'where':{'id':_0x3ab72e['params']['id']}})[_0xbb8f('0x25')](handleEntityNotFound(_0x9b8604,null))['then'](function(_0x5a7676){if(_0x5a7676){_0x815664[_0xbb8f('0x33')]=_[_0xbb8f('0x34')](db[_0xbb8f('0x62')][_0xbb8f('0x30')]);_0x815664[_0xbb8f('0x35')]=_['keys'](_0x3ab72e[_0xbb8f('0x35')]);_0x815664[_0xbb8f('0x36')]=_[_0xbb8f('0x37')](_0x815664[_0xbb8f('0x33')],_0x815664['query']);_0x21c7f8[_0xbb8f('0x38')]=_[_0xbb8f('0x37')](_0x815664[_0xbb8f('0x33')],qs['fields'](_0x3ab72e[_0xbb8f('0x35')]['fields']));_0x21c7f8[_0xbb8f('0x38')]=_0x21c7f8['attributes'][_0xbb8f('0x4b')]?_0x21c7f8['attributes']:_0x815664[_0xbb8f('0x33')];if(!_0x3ab72e['query'][_0xbb8f('0x3a')](_0xbb8f('0x5c'))){_0x21c7f8[_0xbb8f('0x1d')]=qs[_0xbb8f('0x1d')](_0x3ab72e[_0xbb8f('0x35')][_0xbb8f('0x1d')]);_0x21c7f8[_0xbb8f('0x1b')]=qs[_0xbb8f('0x1b')](_0x3ab72e[_0xbb8f('0x35')][_0xbb8f('0x1b')]);}_0x21c7f8[_0xbb8f('0x3b')]=qs[_0xbb8f('0x3c')](_0x3ab72e[_0xbb8f('0x35')][_0xbb8f('0x3c')]);_0x21c7f8['where']=qs[_0xbb8f('0x36')](_['pick'](_0x3ab72e[_0xbb8f('0x35')],_0x815664[_0xbb8f('0x36')]));_0x21c7f8[_0xbb8f('0x3d')][_0xbb8f('0x5f')]=_0x5a7676['id'];if(_0x3ab72e[_0xbb8f('0x35')][_0xbb8f('0x3f')]){_0x21c7f8[_0xbb8f('0x3d')]=_[_0xbb8f('0x40')](_0x21c7f8[_0xbb8f('0x3d')],{'$or':_[_0xbb8f('0x2f')](_0x21c7f8[_0xbb8f('0x38')],function(_0x492a22){var _0x3f5d56={};_0x3f5d56[_0x492a22]={'$like':'%'+_0x3ab72e[_0xbb8f('0x35')][_0xbb8f('0x3f')]+'%'};return _0x3f5d56;})});}_0x21c7f8=_[_0xbb8f('0x40')]({},_0x21c7f8,_0x3ab72e['options']);return db[_0xbb8f('0x62')][_0xbb8f('0x1e')]({'where':_0x21c7f8['where']})[_0xbb8f('0x25')](function(_0x30b92d){_0x251b36[_0xbb8f('0x1e')]=_0x30b92d;if(_0x3ab72e[_0xbb8f('0x35')][_0xbb8f('0x45')]){_0x21c7f8[_0xbb8f('0x46')]=[{'all':!![]}];}return db[_0xbb8f('0x62')][_0xbb8f('0x47')](_0x21c7f8);})['then'](function(_0x26d0f5){_0x251b36['rows']=_0x26d0f5;return _0x251b36;});}})[_0xbb8f('0x25')](respondWithFilteredResult(_0x9b8604,_0x21c7f8))[_0xbb8f('0x49')](handleError(_0x9b8604,null));};exports['getHopperBlacks']=function(_0x45cda2,_0x5ef55f,_0x2333e3){var _0x26f30b={'raw':!![],'where':{}};var _0x20b2a9={};var _0x3de54c={'count':0x0,'rows':[]};return db['Campaign'][_0xbb8f('0x5b')]({'where':{'id':_0x45cda2[_0xbb8f('0x57')]['id']}})['then'](handleEntityNotFound(_0x5ef55f,null))['then'](function(_0x731f4c){if(_0x731f4c){_0x20b2a9['model']=_[_0xbb8f('0x34')](db[_0xbb8f('0x63')]['rawAttributes']);_0x20b2a9[_0xbb8f('0x35')]=_[_0xbb8f('0x34')](_0x45cda2[_0xbb8f('0x35')]);_0x20b2a9['filters']=_[_0xbb8f('0x37')](_0x20b2a9[_0xbb8f('0x33')],_0x20b2a9[_0xbb8f('0x35')]);_0x26f30b[_0xbb8f('0x38')]=_[_0xbb8f('0x37')](_0x20b2a9[_0xbb8f('0x33')],qs[_0xbb8f('0x39')](_0x45cda2[_0xbb8f('0x35')][_0xbb8f('0x39')]));_0x26f30b[_0xbb8f('0x38')]=_0x26f30b[_0xbb8f('0x38')][_0xbb8f('0x4b')]?_0x26f30b[_0xbb8f('0x38')]:_0x20b2a9[_0xbb8f('0x33')];if(!_0x45cda2[_0xbb8f('0x35')][_0xbb8f('0x3a')](_0xbb8f('0x5c'))){_0x26f30b[_0xbb8f('0x1d')]=qs[_0xbb8f('0x1d')](_0x45cda2['query']['limit']);_0x26f30b[_0xbb8f('0x1b')]=qs[_0xbb8f('0x1b')](_0x45cda2[_0xbb8f('0x35')][_0xbb8f('0x1b')]);}_0x26f30b[_0xbb8f('0x3b')]=qs[_0xbb8f('0x3c')](_0x45cda2[_0xbb8f('0x35')]['sort']);_0x26f30b[_0xbb8f('0x3d')]=qs[_0xbb8f('0x36')](_[_0xbb8f('0x3e')](_0x45cda2[_0xbb8f('0x35')],_0x20b2a9['filters']));_0x26f30b[_0xbb8f('0x3d')][_0xbb8f('0x5f')]=_0x731f4c['id'];if(_0x45cda2[_0xbb8f('0x35')][_0xbb8f('0x3f')]){_0x26f30b['where']=_[_0xbb8f('0x40')](_0x26f30b[_0xbb8f('0x3d')],{'$or':_[_0xbb8f('0x2f')](_0x26f30b[_0xbb8f('0x38')],function(_0x32464e){var _0x267b1c={};_0x267b1c[_0x32464e]={'$like':'%'+_0x45cda2['query']['filter']+'%'};return _0x267b1c;})});}_0x26f30b=_[_0xbb8f('0x40')]({},_0x26f30b,_0x45cda2[_0xbb8f('0x43')]);return db[_0xbb8f('0x63')][_0xbb8f('0x1e')]({'where':_0x26f30b[_0xbb8f('0x3d')]})[_0xbb8f('0x25')](function(_0x43b817){_0x3de54c['count']=_0x43b817;if(_0x45cda2['query'][_0xbb8f('0x45')]){_0x26f30b[_0xbb8f('0x46')]=[{'all':!![]}];}return db[_0xbb8f('0x63')][_0xbb8f('0x47')](_0x26f30b);})[_0xbb8f('0x25')](function(_0x339621){_0x3de54c[_0xbb8f('0x48')]=_0x339621;return _0x3de54c;});}})[_0xbb8f('0x25')](respondWithFilteredResult(_0x5ef55f,_0x26f30b))[_0xbb8f('0x49')](handleError(_0x5ef55f,null));};exports[_0xbb8f('0x64')]=function(_0x35a6be,_0xfa1bac,_0x1dfa2f){var _0x4cf8ae={};var _0x1e20ed={};var _0x35ab2a;var _0x4ad4a8;return db[_0xbb8f('0x44')]['findOne']({'where':{'id':_0x35a6be[_0xbb8f('0x57')]['id']}})[_0xbb8f('0x25')](handleEntityNotFound(_0xfa1bac,null))[_0xbb8f('0x25')](function(_0x13d6af){if(_0x13d6af){_0x35ab2a=_0x13d6af;_0x1e20ed[_0xbb8f('0x33')]=_[_0xbb8f('0x34')](db[_0xbb8f('0x65')][_0xbb8f('0x30')]);_0x1e20ed[_0xbb8f('0x35')]=_[_0xbb8f('0x34')](_0x35a6be[_0xbb8f('0x35')]);_0x1e20ed[_0xbb8f('0x36')]=_[_0xbb8f('0x37')](_0x1e20ed[_0xbb8f('0x33')],_0x1e20ed[_0xbb8f('0x35')]);_0x4cf8ae[_0xbb8f('0x38')]=_[_0xbb8f('0x37')](_0x1e20ed['model'],qs[_0xbb8f('0x39')](_0x35a6be[_0xbb8f('0x35')][_0xbb8f('0x39')]));_0x4cf8ae[_0xbb8f('0x38')]=_0x4cf8ae['attributes'][_0xbb8f('0x4b')]?_0x4cf8ae[_0xbb8f('0x38')]:_0x1e20ed['model'];_0x4cf8ae[_0xbb8f('0x3b')]=qs[_0xbb8f('0x3c')](_0x35a6be[_0xbb8f('0x35')][_0xbb8f('0x3c')]);_0x4cf8ae[_0xbb8f('0x3d')]=qs[_0xbb8f('0x36')](_['pick'](_0x35a6be[_0xbb8f('0x35')],_0x1e20ed[_0xbb8f('0x36')]));if(_0x35a6be['query']['filter']){_0x4cf8ae[_0xbb8f('0x3d')]=_[_0xbb8f('0x40')](_0x4cf8ae[_0xbb8f('0x3d')],{'$or':_[_0xbb8f('0x2f')](_0x4cf8ae[_0xbb8f('0x38')],function(_0x3974e5){var _0xeb2186={};_0xeb2186[_0x3974e5]={'$like':'%'+_0x35a6be['query']['filter']+'%'};return _0xeb2186;})});}_0x4cf8ae=_[_0xbb8f('0x40')]({},_0x4cf8ae,_0x35a6be['options']);return _0x35ab2a['getLists'](_0x4cf8ae);}})['then'](function(_0x1e0d58){if(_0x1e0d58){_0x4ad4a8=_0x1e0d58[_0xbb8f('0x4b')];if(!_0x35a6be['query'][_0xbb8f('0x3a')](_0xbb8f('0x5c'))){_0x4cf8ae['limit']=qs[_0xbb8f('0x1d')](_0x35a6be[_0xbb8f('0x35')][_0xbb8f('0x1d')]);_0x4cf8ae['offset']=qs[_0xbb8f('0x1b')](_0x35a6be[_0xbb8f('0x35')][_0xbb8f('0x1b')]);}return _0x35ab2a['getLists'](_0x4cf8ae);}})['then'](function(_0x146c70){if(_0x146c70){return _0x146c70?{'count':_0x4ad4a8,'rows':_0x146c70}:null;}})[_0xbb8f('0x25')](respondWithResult(_0xfa1bac,null))[_0xbb8f('0x49')](handleError(_0xfa1bac,null));};exports[_0xbb8f('0x66')]=function(_0x12380b,_0x1eadf9,_0x1ca25b){var _0x2a73d7,_0xbff0e6;var _0x477a94=[];var _0x21e6e6=moment()['format'](_0xbb8f('0x67'));return db[_0xbb8f('0x44')]['find']({'where':{'id':_0x12380b[_0xbb8f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1eadf9,null))[_0xbb8f('0x25')](function(_0x218e4d){if(_0x218e4d){_0xbff0e6=_0x218e4d;return _0x218e4d[_0xbb8f('0x66')](_0x12380b[_0xbb8f('0x4e')][_0xbb8f('0x68')],_[_0xbb8f('0x58')](_0x12380b[_0xbb8f('0x4e')],[_0xbb8f('0x68'),'id'])||{});}return null;})[_0xbb8f('0x69')](function(_0x1b3f1e){var _0x5cbbe8;var _0x4f6be2;_0x2a73d7=_0x1b3f1e||[];var _0x2b481c=[];if(_0x1b3f1e){for(var _0x20f1a7=0x0;_0x20f1a7<_0x1b3f1e[_0xbb8f('0x4b')];_0x20f1a7+=0x1){var _0x3397db=_0x1b3f1e[_0x20f1a7]['get']({'plain':!![]});_0xbff0e6['dialCheckDuplicateType']=_0x12380b[_0xbb8f('0x4e')]['dialCheckDuplicateType']?_0x12380b[_0xbb8f('0x4e')][_0xbb8f('0x6a')]:_0xbff0e6[_0xbb8f('0x6a')];switch(_0xbff0e6['dialCheckDuplicateType']){case _0xbb8f('0x6b'):_0x5cbbe8=squel[_0xbb8f('0x6c')]()[_0xbb8f('0x6d')](_0xbb8f('0x6e'))[_0xbb8f('0x6f')]([_0xbb8f('0x70'),_0xbb8f('0x71'),_0xbb8f('0x72'),_0xbb8f('0x73'),'CampaignId',_0xbb8f('0x59'),'updatedAt'],squel[_0xbb8f('0x74')]()[_0xbb8f('0x75')](_0xbb8f('0x70'),'phone')[_0xbb8f('0x75')](_0xbb8f('0x76'),_0xbb8f('0x71'))[_0xbb8f('0x75')]('id','ContactId')[_0xbb8f('0x75')](_0x3397db[_0xbb8f('0x77')][_0xbb8f('0x78')](),_0xbb8f('0x73'))['field'](_0x12380b['params']['id'][_0xbb8f('0x78')](),_0xbb8f('0x5f'))[_0xbb8f('0x75')]('\x27'+_0x21e6e6+'\x27','createdAt')[_0xbb8f('0x75')]('\x27'+_0x21e6e6+'\x27','updatedAt')[_0xbb8f('0x79')]('cm_contacts')['where'](_0xbb8f('0x7a'))[_0xbb8f('0x3d')](_0xbb8f('0x7b'),_0x3397db[_0xbb8f('0x77')][_0xbb8f('0x78')]())[_0xbb8f('0x3d')](_0xbb8f('0x7c'))[_0xbb8f('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbb8f('0x74')]()[_0xbb8f('0x75')](_0xbb8f('0x7d'))[_0xbb8f('0x79')]('cm_hopper_final')[_0xbb8f('0x3d')](_0xbb8f('0x7e'),_0x12380b[_0xbb8f('0x57')]['id'][_0xbb8f('0x78')]()))[_0xbb8f('0x3d')](_0xbb8f('0x7f'),squel[_0xbb8f('0x74')]()[_0xbb8f('0x75')](_0xbb8f('0x80'))[_0xbb8f('0x79')](_0xbb8f('0x6e'))[_0xbb8f('0x3d')](_0xbb8f('0x7e'),_0x12380b[_0xbb8f('0x57')]['id']['toString']())))[_0xbb8f('0x78')]();break;case _0xbb8f('0x81'):_0x5cbbe8=squel[_0xbb8f('0x6c')]()['into'](_0xbb8f('0x6e'))['fromQuery']([_0xbb8f('0x70'),_0xbb8f('0x71'),_0xbb8f('0x72'),_0xbb8f('0x73'),_0xbb8f('0x5f'),'createdAt',_0xbb8f('0x5a')],squel['select']()[_0xbb8f('0x75')](_0xbb8f('0x70'),_0xbb8f('0x70'))['field'](_0xbb8f('0x76'),_0xbb8f('0x71'))[_0xbb8f('0x75')]('id','ContactId')[_0xbb8f('0x75')](_0x3397db['CmListId'][_0xbb8f('0x78')](),_0xbb8f('0x73'))[_0xbb8f('0x75')](_0x12380b[_0xbb8f('0x57')]['id'][_0xbb8f('0x78')](),_0xbb8f('0x5f'))[_0xbb8f('0x75')]('\x27'+_0x21e6e6+'\x27',_0xbb8f('0x59'))[_0xbb8f('0x75')]('\x27'+_0x21e6e6+'\x27',_0xbb8f('0x5a'))[_0xbb8f('0x79')](_0xbb8f('0x82'))[_0xbb8f('0x3d')](_0xbb8f('0x7a'))[_0xbb8f('0x3d')]('ListId\x20=\x20?',_0x3397db[_0xbb8f('0x77')][_0xbb8f('0x78')]())[_0xbb8f('0x3d')](_0xbb8f('0x7c'))['where'](_0xbb8f('0x7f'),squel[_0xbb8f('0x74')]()[_0xbb8f('0x75')](_0xbb8f('0x80'))[_0xbb8f('0x79')](_0xbb8f('0x6e'))[_0xbb8f('0x3d')](_0xbb8f('0x7e'),_0x12380b[_0xbb8f('0x57')]['id']['toString']())))[_0xbb8f('0x78')]();break;default:_0x5cbbe8=squel['insert']()[_0xbb8f('0x6d')](_0xbb8f('0x6e'))[_0xbb8f('0x6f')](['phone',_0xbb8f('0x71'),_0xbb8f('0x72'),'ListId',_0xbb8f('0x5f'),_0xbb8f('0x59'),_0xbb8f('0x5a')],squel['select']()[_0xbb8f('0x75')](_0xbb8f('0x70'),_0xbb8f('0x70'))[_0xbb8f('0x75')]('NOW()','scheduledAt')[_0xbb8f('0x75')]('id','ContactId')[_0xbb8f('0x75')](_0x3397db['CmListId'][_0xbb8f('0x78')](),_0xbb8f('0x73'))[_0xbb8f('0x75')](_0x12380b['params']['id'][_0xbb8f('0x78')](),_0xbb8f('0x5f'))[_0xbb8f('0x75')]('\x27'+_0x21e6e6+'\x27',_0xbb8f('0x59'))[_0xbb8f('0x75')]('\x27'+_0x21e6e6+'\x27',_0xbb8f('0x5a'))[_0xbb8f('0x79')](_0xbb8f('0x82'))[_0xbb8f('0x3d')](_0xbb8f('0x7a'))['where'](_0xbb8f('0x7b'),_0x3397db[_0xbb8f('0x77')]['toString']())['where'](_0xbb8f('0x7c')))['toString']();}_0x4f6be2=squel['insert']()[_0xbb8f('0x6d')](_0xbb8f('0x83'))['fromQuery'](['cmHopperId',_0xbb8f('0x71'),'phone',_0xbb8f('0x84'),_0xbb8f('0x59'),'updatedAt'],squel[_0xbb8f('0x74')]()['field'](_0xbb8f('0x85'),'id')[_0xbb8f('0x75')](_0xbb8f('0x76'),_0xbb8f('0x71'))[_0xbb8f('0x75')](_0xbb8f('0x86'),_0xbb8f('0x70'))[_0xbb8f('0x75')](_0xbb8f('0x87'),'OrderBy')[_0xbb8f('0x75')]('\x27'+_0x21e6e6+'\x27',_0xbb8f('0x59'))['field']('\x27'+_0x21e6e6+'\x27',_0xbb8f('0x5a'))[_0xbb8f('0x79')](_0xbb8f('0x88'),'ci')['join'](_0xbb8f('0x6e'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xbb8f('0x3d')]('h.ListId\x20=\x20?',_0x3397db['CmListId']['toString']())[_0xbb8f('0x3d')](_0xbb8f('0x89'),_0x12380b[_0xbb8f('0x57')]['id'][_0xbb8f('0x78')]())[_0xbb8f('0x3d')](_0xbb8f('0x8a'),_0x21e6e6))['toString']();_0x2b481c['push'](db['sequelize'][_0xbb8f('0x35')](_0x5cbbe8));_0x477a94[_0xbb8f('0x8b')](db['sequelize'][_0xbb8f('0x35')](_0x4f6be2));}return BPromise[_0xbb8f('0x8c')](_0x2b481c);}})[_0xbb8f('0x25')](function(){return BPromise[_0xbb8f('0x8c')](_0x477a94);})['then'](function(){return _0x2a73d7;})[_0xbb8f('0x25')](respondWithResult(_0x1eadf9,null))['catch'](handleError(_0x1eadf9,null));};exports[_0xbb8f('0x8d')]=function(_0x1af1da,_0x39a8b0,_0x36039c){return db['Campaign'][_0xbb8f('0x4c')]({'where':{'id':_0x1af1da[_0xbb8f('0x57')]['id']}})[_0xbb8f('0x25')](handleEntityNotFound(_0x39a8b0,null))[_0xbb8f('0x25')](function(_0x4b072f){if(_0x4b072f){return _0x4b072f[_0xbb8f('0x8d')](_0x1af1da['query'][_0xbb8f('0x68')]);}})[_0xbb8f('0x25')](function(_0x274f5d){if(_0x274f5d){return db[_0xbb8f('0x5d')][_0xbb8f('0x26')]({'where':{'ListId':_0x1af1da[_0xbb8f('0x35')][_0xbb8f('0x68')],'CampaignId':_0x1af1da[_0xbb8f('0x57')]['id']}})[_0xbb8f('0x25')](function(){return _0x274f5d;});}})[_0xbb8f('0x25')](respondWithStatusCode(_0x39a8b0,null))[_0xbb8f('0x49')](handleError(_0x39a8b0,null));};exports['getBlackLists']=function(_0x37691f,_0x339f7f,_0x37f677){var _0xc8b880={};var _0x192fdf={};var _0x207ba5;var _0x3dc08d;return db[_0xbb8f('0x44')]['findOne']({'where':{'id':_0x37691f['params']['id']}})['then'](handleEntityNotFound(_0x339f7f,null))[_0xbb8f('0x25')](function(_0x442880){if(_0x442880){_0x207ba5=_0x442880;_0x192fdf[_0xbb8f('0x33')]=_['keys'](db[_0xbb8f('0x65')][_0xbb8f('0x30')]);_0x192fdf['query']=_[_0xbb8f('0x34')](_0x37691f[_0xbb8f('0x35')]);_0x192fdf[_0xbb8f('0x36')]=_[_0xbb8f('0x37')](_0x192fdf['model'],_0x192fdf['query']);_0xc8b880[_0xbb8f('0x38')]=_[_0xbb8f('0x37')](_0x192fdf[_0xbb8f('0x33')],qs['fields'](_0x37691f['query'][_0xbb8f('0x39')]));_0xc8b880['attributes']=_0xc8b880[_0xbb8f('0x38')][_0xbb8f('0x4b')]?_0xc8b880['attributes']:_0x192fdf[_0xbb8f('0x33')];_0xc8b880[_0xbb8f('0x3b')]=qs[_0xbb8f('0x3c')](_0x37691f[_0xbb8f('0x35')][_0xbb8f('0x3c')]);_0xc8b880['where']=qs[_0xbb8f('0x36')](_['pick'](_0x37691f[_0xbb8f('0x35')],_0x192fdf[_0xbb8f('0x36')]));if(_0x37691f[_0xbb8f('0x35')][_0xbb8f('0x3f')]){_0xc8b880[_0xbb8f('0x3d')]=_[_0xbb8f('0x40')](_0xc8b880[_0xbb8f('0x3d')],{'$or':_[_0xbb8f('0x2f')](_0xc8b880[_0xbb8f('0x38')],function(_0xe96fad){var _0x1166c4={};_0x1166c4[_0xe96fad]={'$like':'%'+_0x37691f['query'][_0xbb8f('0x3f')]+'%'};return _0x1166c4;})});}_0xc8b880=_[_0xbb8f('0x40')]({},_0xc8b880,_0x37691f[_0xbb8f('0x43')]);return _0x207ba5[_0xbb8f('0x8e')](_0xc8b880);}})[_0xbb8f('0x25')](function(_0x415640){if(_0x415640){_0x3dc08d=_0x415640['length'];if(!_0x37691f[_0xbb8f('0x35')][_0xbb8f('0x3a')](_0xbb8f('0x5c'))){_0xc8b880['limit']=qs[_0xbb8f('0x1d')](_0x37691f[_0xbb8f('0x35')][_0xbb8f('0x1d')]);_0xc8b880[_0xbb8f('0x1b')]=qs['offset'](_0x37691f['query'][_0xbb8f('0x1b')]);}return _0x207ba5[_0xbb8f('0x8e')](_0xc8b880);}})[_0xbb8f('0x25')](function(_0x5cc49d){if(_0x5cc49d){return _0x5cc49d?{'count':_0x3dc08d,'rows':_0x5cc49d}:null;}})['then'](respondWithResult(_0x339f7f,null))[_0xbb8f('0x49')](handleError(_0x339f7f,null));};exports[_0xbb8f('0x8f')]=function(_0x5c3038,_0x43d55e,_0x376071){var _0x528a4a,_0x3757ca;var _0x2800b8=[];var _0x34e226=moment()[_0xbb8f('0x90')](_0xbb8f('0x67'));return db[_0xbb8f('0x44')][_0xbb8f('0x4c')]({'where':{'id':_0x5c3038[_0xbb8f('0x57')]['id']}})['then'](handleEntityNotFound(_0x43d55e,null))[_0xbb8f('0x25')](function(_0x12cf8c){if(_0x12cf8c){_0x3757ca=_0x12cf8c;return _0x12cf8c['addBlackLists'](_0x5c3038[_0xbb8f('0x4e')][_0xbb8f('0x68')],_[_0xbb8f('0x58')](_0x5c3038['body'],[_0xbb8f('0x68'),'id'])||{});}return null;})[_0xbb8f('0x69')](function(_0x158f82){var _0x49012a;var _0x1678c2;_0x528a4a=_0x158f82||[];var _0x510e7d=[];if(_0x158f82){for(var _0x3669a2=0x0;_0x3669a2<_0x158f82[_0xbb8f('0x4b')];_0x3669a2+=0x1){var _0x392a68=_0x158f82[_0x3669a2]['get']({'plain':!![]});_0x49012a=squel[_0xbb8f('0x6c')]()['into'](_0xbb8f('0x91'))['fromQuery']([_0xbb8f('0x70'),_0xbb8f('0x72'),_0xbb8f('0x73'),_0xbb8f('0x5f'),_0xbb8f('0x59'),_0xbb8f('0x5a')],squel[_0xbb8f('0x74')]()[_0xbb8f('0x75')]('phone','phone')[_0xbb8f('0x75')]('id',_0xbb8f('0x72'))[_0xbb8f('0x75')](_0x392a68[_0xbb8f('0x77')][_0xbb8f('0x78')](),_0xbb8f('0x73'))[_0xbb8f('0x75')](_0x5c3038['params']['id'][_0xbb8f('0x78')](),_0xbb8f('0x5f'))['field'](_0xbb8f('0x76'),_0xbb8f('0x59'))[_0xbb8f('0x75')](_0xbb8f('0x76'),'updatedAt')[_0xbb8f('0x79')](_0xbb8f('0x82'))[_0xbb8f('0x3d')](_0xbb8f('0x7a'))[_0xbb8f('0x3d')](_0xbb8f('0x7b'),_0x392a68['CmListId']['toString']())[_0xbb8f('0x3d')](_0xbb8f('0x7c')))[_0xbb8f('0x78')]();_0x510e7d[_0xbb8f('0x8b')](db[_0xbb8f('0x92')][_0xbb8f('0x35')](_0x49012a));}return BPromise[_0xbb8f('0x8c')](_0x510e7d);}})[_0xbb8f('0x25')](function(){return _0x528a4a;})[_0xbb8f('0x25')](respondWithResult(_0x43d55e,null))[_0xbb8f('0x49')](handleError(_0x43d55e,null));};exports[_0xbb8f('0x93')]=function(_0x6adae,_0x1b3dee,_0x4b2b79){return db[_0xbb8f('0x44')][_0xbb8f('0x4c')]({'where':{'id':_0x6adae[_0xbb8f('0x57')]['id']}})[_0xbb8f('0x25')](handleEntityNotFound(_0x1b3dee,null))[_0xbb8f('0x25')](function(_0x3dc6bb){if(_0x3dc6bb){return _0x3dc6bb[_0xbb8f('0x93')](_0x6adae[_0xbb8f('0x35')][_0xbb8f('0x68')]);}})[_0xbb8f('0x25')](function(_0x271f8c){if(_0x271f8c){return db[_0xbb8f('0x63')][_0xbb8f('0x26')]({'where':{'ListId':_0x6adae[_0xbb8f('0x35')][_0xbb8f('0x68')],'CampaignId':_0x6adae[_0xbb8f('0x57')]['id']}})[_0xbb8f('0x25')](function(){return _0x271f8c;});}})['then'](respondWithStatusCode(_0x1b3dee,null))[_0xbb8f('0x49')](handleError(_0x1b3dee,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 11125ab..d825eae 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(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_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':'campaigns','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 70854e0..91a80cf 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 _0xe3ee=['../../mysqldb','rpc','jayson/promise','client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Campaign','options','raw','where','attributes','limit','include','map','model','GetCampaign','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe3ee,0x116));var _0xee3e=function(_0x59df39,_0x125888){_0x59df39=_0x59df39-0x0;var _0x565afb=_0xe3ee[_0x59df39];return _0x565afb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee3e('0x0'));var BPromise=require(_0xee3e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee3e('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee3e('0x3'));var config=require('../../config/environment');var jayson=require(_0xee3e('0x4'));var client=jayson[_0xee3e('0x5')][_0xee3e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd893ca,_0x42d135,_0x39a770){return new BPromise(function(_0x43ab67,_0x17fba1){return client['request'](_0xd893ca,_0x39a770)[_0xee3e('0x7')](function(_0x2f6153){logger['info'](_0xee3e('0x8'),_0x42d135,_0xee3e('0x9'));logger['debug'](_0xee3e('0xa'),_0x42d135,_0xee3e('0x9'),JSON[_0xee3e('0xb')](_0x2f6153));if(_0x2f6153[_0xee3e('0xc')]){if(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xd')]===0x1f4){logger[_0xee3e('0xc')](_0xee3e('0x8'),_0x42d135,_0x2f6153['error']['message']);return _0x17fba1(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);}logger['error'](_0xee3e('0x8'),_0x42d135,_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);return _0x43ab67(_0x2f6153['error'][_0xee3e('0xe')]);}else{logger[_0xee3e('0xf')]('Campaign,\x20%s,\x20%s',_0x42d135,'request\x20sent');_0x43ab67(_0x2f6153[_0xee3e('0x10')][_0xee3e('0xe')]);}})[_0xee3e('0x11')](function(_0x512609){logger['error']('Campaign,\x20%s,\x20%s',_0x42d135,_0x512609);_0x17fba1(_0x512609);});});}exports['GetCampaign']=function(_0x2589c0){var _0x23cd1f=this;return new Promise(function(_0x372605,_0x253530){return db[_0xee3e('0x12')]['findAll']({'raw':_0x2589c0[_0xee3e('0x13')]?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x14')]===undefined?!![]:![]:!![],'where':_0x2589c0[_0xee3e('0x13')]?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x15')]||null:null,'attributes':_0x2589c0['options']?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x16')]||null:null,'limit':_0x2589c0[_0xee3e('0x13')]?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x17')]||null:null,'include':_0x2589c0[_0xee3e('0x13')]?_0x2589c0[_0xee3e('0x13')][_0xee3e('0x18')]?_[_0xee3e('0x19')](_0x2589c0[_0xee3e('0x13')]['include'],function(_0x5e4100){return{'model':db[_0x5e4100['model']],'as':_0x5e4100['as'],'attributes':_0x5e4100['attributes'],'include':_0x5e4100[_0xee3e('0x18')]?_[_0xee3e('0x19')](_0x5e4100['include'],function(_0xbfc488){return{'model':db[_0xbfc488[_0xee3e('0x1a')]],'as':_0xbfc488['as'],'attributes':_0xbfc488[_0xee3e('0x16')],'include':_0xbfc488['include']?_[_0xee3e('0x19')](_0xbfc488[_0xee3e('0x18')],function(_0x2b96b8){return{'model':db[_0x2b96b8[_0xee3e('0x1a')]],'as':_0x2b96b8['as'],'attributes':_0x2b96b8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c687c){logger[_0xee3e('0xf')](_0xee3e('0x1b'),_0x2589c0);logger['debug']('GetCampaign',_0x2589c0,JSON[_0xee3e('0xb')](_0x1c687c));_0x372605(_0x1c687c);})[_0xee3e('0x11')](function(_0x179406){logger[_0xee3e('0xc')](_0xee3e('0x1b'),_0x179406[_0xee3e('0xe')],_0x2589c0);_0x253530(_0x23cd1f[_0xee3e('0xc')](0x1f4,_0x179406['message']));});});}; \ No newline at end of file +var _0x92e8=['where','attributes','limit','include','map','model','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','GetCampaign','findAll','options','raw'];(function(_0x14e899,_0x3da87f){var _0x1fc140=function(_0x446dbe){while(--_0x446dbe){_0x14e899['push'](_0x14e899['shift']());}};_0x1fc140(++_0x3da87f);}(_0x92e8,0x7f));var _0x892e=function(_0x1c1b8c,_0x4c253d){_0x1c1b8c=_0x1c1b8c-0x0;var _0x1ee4c4=_0x92e8[_0x1c1b8c];return _0x1ee4c4;};'use strict';var _=require(_0x892e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x892e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x892e('0x2'));var db=require(_0x892e('0x3'))['db'];var utils=require(_0x892e('0x4'));var logger=require(_0x892e('0x5'))(_0x892e('0x6'));var config=require(_0x892e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x892e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a2c8,_0x5f2fd8,_0x35856f){return new BPromise(function(_0x5bfa77,_0x2724e3){return client[_0x892e('0x9')](_0x41a2c8,_0x35856f)[_0x892e('0xa')](function(_0x5b37af){logger[_0x892e('0xb')](_0x892e('0xc'),_0x5f2fd8,_0x892e('0xd'));logger[_0x892e('0xe')](_0x892e('0xf'),_0x5f2fd8,'request\x20sent',JSON[_0x892e('0x10')](_0x5b37af));if(_0x5b37af[_0x892e('0x11')]){if(_0x5b37af[_0x892e('0x11')]['code']===0x1f4){logger[_0x892e('0x11')]('Campaign,\x20%s,\x20%s',_0x5f2fd8,_0x5b37af[_0x892e('0x11')][_0x892e('0x12')]);return _0x2724e3(_0x5b37af[_0x892e('0x11')][_0x892e('0x12')]);}logger[_0x892e('0x11')](_0x892e('0xc'),_0x5f2fd8,_0x5b37af[_0x892e('0x11')][_0x892e('0x12')]);return _0x5bfa77(_0x5b37af[_0x892e('0x11')][_0x892e('0x12')]);}else{logger[_0x892e('0xb')]('Campaign,\x20%s,\x20%s',_0x5f2fd8,_0x892e('0xd'));_0x5bfa77(_0x5b37af['result'][_0x892e('0x12')]);}})['catch'](function(_0x54da87){logger[_0x892e('0x11')](_0x892e('0xc'),_0x5f2fd8,_0x54da87);_0x2724e3(_0x54da87);});});}exports[_0x892e('0x13')]=function(_0x4366a2){var _0x263ae9=this;return new Promise(function(_0x628dc2,_0xdb6924){return db['Campaign'][_0x892e('0x14')]({'raw':_0x4366a2[_0x892e('0x15')]?_0x4366a2[_0x892e('0x15')][_0x892e('0x16')]===undefined?!![]:![]:!![],'where':_0x4366a2[_0x892e('0x15')]?_0x4366a2[_0x892e('0x15')][_0x892e('0x17')]||null:null,'attributes':_0x4366a2[_0x892e('0x15')]?_0x4366a2[_0x892e('0x15')][_0x892e('0x18')]||null:null,'limit':_0x4366a2[_0x892e('0x15')]?_0x4366a2[_0x892e('0x15')][_0x892e('0x19')]||null:null,'include':_0x4366a2['options']?_0x4366a2['options'][_0x892e('0x1a')]?_[_0x892e('0x1b')](_0x4366a2[_0x892e('0x15')]['include'],function(_0x2a9a0b){return{'model':db[_0x2a9a0b[_0x892e('0x1c')]],'as':_0x2a9a0b['as'],'attributes':_0x2a9a0b[_0x892e('0x18')],'include':_0x2a9a0b['include']?_[_0x892e('0x1b')](_0x2a9a0b['include'],function(_0x5d8f7c){return{'model':db[_0x5d8f7c['model']],'as':_0x5d8f7c['as'],'attributes':_0x5d8f7c[_0x892e('0x18')],'include':_0x5d8f7c[_0x892e('0x1a')]?_[_0x892e('0x1b')](_0x5d8f7c[_0x892e('0x1a')],function(_0x32505d){return{'model':db[_0x32505d['model']],'as':_0x32505d['as'],'attributes':_0x32505d['attributes']};}):[]};}):[]};}):[]:[]})[_0x892e('0xa')](function(_0x1dfc69){logger[_0x892e('0xb')]('GetCampaign',_0x4366a2);logger['debug'](_0x892e('0x13'),_0x4366a2,JSON['stringify'](_0x1dfc69));_0x628dc2(_0x1dfc69);})[_0x892e('0x1d')](function(_0x253c76){logger['error']('GetCampaign',_0x253c76[_0x892e('0x12')],_0x4366a2);_0xdb6924(_0x263ae9[_0x892e('0x11')](0x1f4,_0x253c76['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index c1a35ae..e8e2b46 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 _0x2bca=['getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','/:id','update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists'];(function(_0x3bbbfd,_0x45a809){var _0x2b2d15=function(_0x486d69){while(--_0x486d69){_0x3bbbfd['push'](_0x3bbbfd['shift']());}};_0x2b2d15(++_0x45a809);}(_0x2bca,0xc6));var _0xa2bc=function(_0x1a0872,_0xc778c9){_0x1a0872=_0x1a0872-0x0;var _0x294d38=_0x2bca[_0x1a0872];return _0x294d38;};'use strict';var multer=require(_0xa2bc('0x0'));var util=require(_0xa2bc('0x1'));var path=require(_0xa2bc('0x2'));var timeout=require(_0xa2bc('0x3'));var express=require(_0xa2bc('0x4'));var router=express[_0xa2bc('0x5')]();var fs_extra=require(_0xa2bc('0x6'));var auth=require(_0xa2bc('0x7'));var interaction=require(_0xa2bc('0x8'));var config=require(_0xa2bc('0x9'));var controller=require('./campaign.controller');router[_0xa2bc('0xa')]('/',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0xc')]);router[_0xa2bc('0xa')]('/:id',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0xd')]);router[_0xa2bc('0xa')](_0xa2bc('0xe'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0xf')]);router[_0xa2bc('0xa')](_0xa2bc('0x10'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x11')]);router['get'](_0xa2bc('0x12'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x13')]);router['get'](_0xa2bc('0x14'),auth[_0xa2bc('0xb')](),controller['getHopperBlacks']);router[_0xa2bc('0xa')](_0xa2bc('0x15'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x16')]);router[_0xa2bc('0xa')](_0xa2bc('0x17'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x18')]);router[_0xa2bc('0x19')]('/',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x1a')]);router[_0xa2bc('0x19')](_0xa2bc('0x1b'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x1c')]);router[_0xa2bc('0x19')]('/:id/lists',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x1d')]);router[_0xa2bc('0x19')]('/:id/blacklists',auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x1e')]);router['put'](_0xa2bc('0x1f'),auth['isAuthenticated'](),controller[_0xa2bc('0x20')]);router[_0xa2bc('0x21')](_0xa2bc('0x1f'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x22')]);router[_0xa2bc('0x21')](_0xa2bc('0x15'),auth[_0xa2bc('0xb')](),controller[_0xa2bc('0x23')]);router[_0xa2bc('0x21')](_0xa2bc('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xa2bc('0x24')]=router; \ No newline at end of file +var _0x9fb1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','exports','multer','util','path'];(function(_0x26166b,_0x1d2fb6){var _0x470ac3=function(_0x2a3e55){while(--_0x2a3e55){_0x26166b['push'](_0x26166b['shift']());}};_0x470ac3(++_0x1d2fb6);}(_0x9fb1,0x11d));var _0x19fb=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9fb1[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x19fb('0x0'));var util=require(_0x19fb('0x1'));var path=require(_0x19fb('0x2'));var timeout=require(_0x19fb('0x3'));var express=require(_0x19fb('0x4'));var router=express[_0x19fb('0x5')]();var fs_extra=require(_0x19fb('0x6'));var auth=require(_0x19fb('0x7'));var interaction=require(_0x19fb('0x8'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x19fb('0x9')]('/',auth[_0x19fb('0xa')](),controller['index']);router[_0x19fb('0x9')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0xc')]);router[_0x19fb('0x9')](_0x19fb('0xd'),auth['isAuthenticated'](),controller[_0x19fb('0xe')]);router[_0x19fb('0x9')](_0x19fb('0xf'),auth[_0x19fb('0xa')](),controller['getHopperHistories']);router[_0x19fb('0x9')]('/:id/hopper_finals',auth[_0x19fb('0xa')](),controller['getHopperFinals']);router[_0x19fb('0x9')](_0x19fb('0x10'),auth[_0x19fb('0xa')](),controller['getHopperBlacks']);router['get'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x12')]);router[_0x19fb('0x9')]('/:id/blacklists',auth[_0x19fb('0xa')](),controller[_0x19fb('0x13')]);router[_0x19fb('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x19fb('0x14')](_0x19fb('0x15'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x16')]);router['post'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x17')]);router['post'](_0x19fb('0x18'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x19')]);router[_0x19fb('0x1a')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1b')]);router[_0x19fb('0x1c')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1d')]);router['delete'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1e')]);router[_0x19fb('0x1c')](_0x19fb('0x18'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x19fb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 8099136..88f0eab 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 _0x87aa=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x8b7922,_0x38b017){var _0xa6a73a=function(_0x4b3493){while(--_0x4b3493){_0x8b7922['push'](_0x8b7922['shift']());}};_0xa6a73a(++_0x38b017);}(_0x87aa,0x17d));var _0xa87a=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x87aa[_0x4828b1];return _0x1fec1b;};'use strict';var Sequelize=require(_0xa87a('0x0'));module[_0xa87a('0x1')]={'key':{'type':Sequelize[_0xa87a('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xa87a('0x2')]},'name':{'type':Sequelize[_0xa87a('0x3')],'get':function(){return this[_0xa87a('0x4')](_0xa87a('0x5'));}}}; \ No newline at end of file +var _0xe0c9=['getDataValue','exports','STRING','medium','VIRTUAL'];(function(_0x55e229,_0x41fa8b){var _0x309db0=function(_0x23bfcf){while(--_0x23bfcf){_0x55e229['push'](_0x55e229['shift']());}};_0x309db0(++_0x41fa8b);}(_0xe0c9,0x1d7));var _0x9e0c=function(_0x3d6452,_0x505d30){_0x3d6452=_0x3d6452-0x0;var _0x8d324c=_0xe0c9[_0x3d6452];return _0x8d324c;};'use strict';var Sequelize=require('sequelize');module[_0x9e0c('0x0')]={'key':{'type':Sequelize[_0x9e0c('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x9e0c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9e0c('0x1')]},'name':{'type':Sequelize[_0x9e0c('0x3')],'get':function(){return this[_0x9e0c('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 9d614c8..c154378 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 _0x03bc=['reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','filter','options','count','includeAll','include','findAll','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply'];(function(_0x18bd5c,_0x1be050){var _0x1ec634=function(_0x3f2953){while(--_0x3f2953){_0x18bd5c['push'](_0x18bd5c['shift']());}};_0x1ec634(++_0x1be050);}(_0x03bc,0x197));var _0xc03b=function(_0x24e5e5,_0x3b8a4e){_0x24e5e5=_0x24e5e5-0x0;var _0x5ea7c9=_0x03bc[_0x24e5e5];return _0x5ea7c9;};'use strict';var emlformat=require(_0xc03b('0x0'));var rimraf=require(_0xc03b('0x1'));var zipdir=require(_0xc03b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc03b('0x3'));var moment=require(_0xc03b('0x4'));var BPromise=require(_0xc03b('0x5'));var Mustache=require(_0xc03b('0x6'));var util=require(_0xc03b('0x7'));var path=require('path');var sox=require(_0xc03b('0x8'));var csv=require(_0xc03b('0x9'));var ejs=require(_0xc03b('0xa'));var fs=require('fs');var fs_extra=require(_0xc03b('0xb'));var _=require('lodash');var squel=require(_0xc03b('0xc'));var crypto=require(_0xc03b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc03b('0x9'));var querystring=require(_0xc03b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc03b('0xf'));var hardwareService=require(_0xc03b('0x10'));var logger=require(_0xc03b('0x11'))(_0xc03b('0x12'));var utils=require(_0xc03b('0x13'));var config=require(_0xc03b('0x14'));var licenseUtil=require(_0xc03b('0x15'));var db=require(_0xc03b('0x16'))['db'];function respondWithStatusCode(_0x2502de,_0x4aaaa8){_0x4aaaa8=_0x4aaaa8||0xcc;return function(_0x447229){if(_0x447229){return _0x2502de[_0xc03b('0x17')](_0x4aaaa8);}return _0x2502de[_0xc03b('0x18')](_0x4aaaa8)[_0xc03b('0x19')]();};}function respondWithResult(_0x3f61c1,_0xa4b044){_0xa4b044=_0xa4b044||0xc8;return function(_0x50bc74){if(_0x50bc74){return _0x3f61c1[_0xc03b('0x18')](_0xa4b044)['json'](_0x50bc74);}};}function respondWithFilteredResult(_0xcbd558,_0xfd90a8){return function(_0x5d507a){if(_0x5d507a){var _0x38a4b4=typeof _0xfd90a8[_0xc03b('0x1a')]===_0xc03b('0x1b')&&typeof _0xfd90a8['limit']==='undefined';var _0x42c3d2=_0x5d507a['count'];var _0x375827=_0x38a4b4?0x0:_0xfd90a8[_0xc03b('0x1a')];var _0x33066d=_0x38a4b4?_0x5d507a['count']:_0xfd90a8[_0xc03b('0x1a')]+_0xfd90a8[_0xc03b('0x1c')];var _0x19bee9;if(_0x33066d>=_0x42c3d2){_0x33066d=_0x42c3d2;_0x19bee9=0xc8;}else{_0x19bee9=0xce;}_0xcbd558['status'](_0x19bee9);return _0xcbd558[_0xc03b('0x1d')](_0xc03b('0x1e'),_0x375827+'-'+_0x33066d+'/'+_0x42c3d2)[_0xc03b('0x1f')](_0x5d507a);}return null;};}function patchUpdates(_0x1a70a2){return function(_0x51cf84){try{jsonpatch[_0xc03b('0x20')](_0x51cf84,_0x1a70a2,!![]);}catch(_0x4c0a4d){return BPromise[_0xc03b('0x21')](_0x4c0a4d);}return _0x51cf84[_0xc03b('0x22')]();};}function saveUpdates(_0x480545,_0x14d3ab){return function(_0x336ca3){if(_0x336ca3){return _0x336ca3[_0xc03b('0x23')](_0x480545)[_0xc03b('0x24')](function(_0x2de452){return _0x2de452;});}return null;};}function removeEntity(_0x48a0a3,_0x5cc66a){return function(_0xe36749){if(_0xe36749){return _0xe36749['destroy']()[_0xc03b('0x24')](function(){var _0x402e28=_0xe36749[_0xc03b('0x25')]({'plain':!![]});var _0x319550=_0xc03b('0x26');return db[_0xc03b('0x27')][_0xc03b('0x28')]({'where':{'type':_0x319550,'resourceId':_0x402e28['id']}})[_0xc03b('0x24')](function(){return _0xe36749;});})['then'](function(){_0x48a0a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6082a4,_0xf034c9){return function(_0x3d40b8){if(!_0x3d40b8){_0x6082a4[_0xc03b('0x17')](0x194);}return _0x3d40b8;};}function handleError(_0x2974fc,_0x28c26e){_0x28c26e=_0x28c26e||0x1f4;return function(_0x574a84){logger[_0xc03b('0x29')](_0x574a84['stack']);if(_0x574a84[_0xc03b('0x2a')]){delete _0x574a84[_0xc03b('0x2a')];}_0x2974fc['status'](_0x28c26e)[_0xc03b('0x2b')](_0x574a84);};}exports[_0xc03b('0x2c')]=function(_0x1d32f7,_0x2073d1){var _0x4c1084={},_0x515aa8={},_0x24c6a1={'count':0x0,'rows':[]};var _0x5a4ac8=_[_0xc03b('0x2d')](db[_0xc03b('0x2e')][_0xc03b('0x2f')],function(_0x50b1f8){return{'name':_0x50b1f8[_0xc03b('0x30')],'type':_0x50b1f8[_0xc03b('0x31')][_0xc03b('0x32')]};});_0x515aa8[_0xc03b('0x33')]=_['map'](_0x5a4ac8,_0xc03b('0x2a'));_0x515aa8[_0xc03b('0x34')]=_[_0xc03b('0x35')](_0x1d32f7[_0xc03b('0x34')]);_0x515aa8[_0xc03b('0x36')]=_[_0xc03b('0x37')](_0x515aa8[_0xc03b('0x33')],_0x515aa8[_0xc03b('0x34')]);_0x4c1084['attributes']=_['intersection'](_0x515aa8[_0xc03b('0x33')],qs['fields'](_0x1d32f7['query'][_0xc03b('0x38')]));_0x4c1084['attributes']=_0x4c1084[_0xc03b('0x39')][_0xc03b('0x3a')]?_0x4c1084['attributes']:_0x515aa8[_0xc03b('0x33')];if(!_0x1d32f7['query']['hasOwnProperty'](_0xc03b('0x3b'))){_0x4c1084['limit']=qs[_0xc03b('0x1c')](_0x1d32f7[_0xc03b('0x34')]['limit']);_0x4c1084[_0xc03b('0x1a')]=qs[_0xc03b('0x1a')](_0x1d32f7[_0xc03b('0x34')][_0xc03b('0x1a')]);}_0x4c1084[_0xc03b('0x3c')]=qs[_0xc03b('0x3d')](_0x1d32f7[_0xc03b('0x34')][_0xc03b('0x3d')]);_0x4c1084['where']=qs['filters'](_[_0xc03b('0x3e')](_0x1d32f7[_0xc03b('0x34')],_0x515aa8[_0xc03b('0x36')]),_0x5a4ac8);if(_0x1d32f7[_0xc03b('0x34')]['filter']){_0x4c1084[_0xc03b('0x3f')]=_[_0xc03b('0x40')](_0x4c1084['where'],{'$or':[{'key':{'$like':'%'+_0x1d32f7['query']['filter']+'%'}},{'value':{'$like':'%'+_0x1d32f7[_0xc03b('0x34')][_0xc03b('0x41')]+'%'}}]});}_0x4c1084=_['merge']({},_0x4c1084,_0x1d32f7[_0xc03b('0x42')]);var _0x1d95c2={'where':_0x4c1084[_0xc03b('0x3f')]};return db['CannedAnswer'][_0xc03b('0x43')](_0x1d95c2)[_0xc03b('0x24')](function(_0x35800f){_0x24c6a1[_0xc03b('0x43')]=_0x35800f;if(_0x1d32f7[_0xc03b('0x34')][_0xc03b('0x44')]){_0x4c1084[_0xc03b('0x45')]=[{'all':!![]}];}return db[_0xc03b('0x2e')][_0xc03b('0x46')](_0x4c1084);})[_0xc03b('0x24')](function(_0x21e65b){_0x24c6a1['rows']=_0x21e65b;return _0x24c6a1;})[_0xc03b('0x24')](respondWithFilteredResult(_0x2073d1,_0x4c1084))[_0xc03b('0x47')](handleError(_0x2073d1,null));};exports[_0xc03b('0x48')]=function(_0x4672ac,_0x41224d){var _0x5ad720={'raw':!![],'where':{'id':_0x4672ac[_0xc03b('0x49')]['id']}},_0x25318a={};_0x25318a[_0xc03b('0x33')]=_['keys'](db[_0xc03b('0x2e')]['rawAttributes']);_0x25318a['query']=_['keys'](_0x4672ac[_0xc03b('0x34')]);_0x25318a['filters']=_[_0xc03b('0x37')](_0x25318a[_0xc03b('0x33')],_0x25318a[_0xc03b('0x34')]);_0x5ad720[_0xc03b('0x39')]=_[_0xc03b('0x37')](_0x25318a[_0xc03b('0x33')],qs['fields'](_0x4672ac[_0xc03b('0x34')][_0xc03b('0x38')]));_0x5ad720['attributes']=_0x5ad720['attributes']['length']?_0x5ad720['attributes']:_0x25318a[_0xc03b('0x33')];if(_0x4672ac['query'][_0xc03b('0x44')]){_0x5ad720[_0xc03b('0x45')]=[{'all':!![]}];}_0x5ad720=_['merge']({},_0x5ad720,_0x4672ac[_0xc03b('0x42')]);return db[_0xc03b('0x2e')][_0xc03b('0x4a')](_0x5ad720)['then'](handleEntityNotFound(_0x41224d,null))[_0xc03b('0x24')](respondWithResult(_0x41224d,null))[_0xc03b('0x47')](handleError(_0x41224d,null));};exports[_0xc03b('0x23')]=function(_0x1507d4,_0x276d29){if(_0x1507d4[_0xc03b('0x4b')]['id']){delete _0x1507d4[_0xc03b('0x4b')]['id'];}return db['CannedAnswer'][_0xc03b('0x4a')]({'where':{'id':_0x1507d4[_0xc03b('0x49')]['id']}})['then'](handleEntityNotFound(_0x276d29,null))[_0xc03b('0x24')](saveUpdates(_0x1507d4[_0xc03b('0x4b')],null))[_0xc03b('0x24')](respondWithResult(_0x276d29,null))[_0xc03b('0x47')](handleError(_0x276d29,null));};exports[_0xc03b('0x28')]=function(_0x4a76af,_0xbd7737){return db[_0xc03b('0x2e')][_0xc03b('0x4a')]({'where':{'id':_0x4a76af['params']['id']}})[_0xc03b('0x24')](handleEntityNotFound(_0xbd7737,null))[_0xc03b('0x24')](removeEntity(_0xbd7737,null))[_0xc03b('0x47')](handleError(_0xbd7737,null));};exports[_0xc03b('0x4c')]=function(_0x553d21,_0x16f3a7){var _0x6efad9={'key':_0x553d21['body'][_0xc03b('0x32')]};if(_0x553d21['body'][_0xc03b('0x4d')]){_0x6efad9[_0xc03b('0x4d')]=_0x553d21[_0xc03b('0x4b')][_0xc03b('0x4d')];}else if(_0x553d21[_0xc03b('0x4b')][_0xc03b('0x4e')]){_0x6efad9['SmsAccountId']=_0x553d21['body']['SmsAccountId'];}else if(_0x553d21['body'][_0xc03b('0x4f')]){_0x6efad9[_0xc03b('0x4f')]=_0x553d21[_0xc03b('0x4b')][_0xc03b('0x4f')];}else if(_0x553d21['body']['ChatWebsiteId']){_0x6efad9[_0xc03b('0x50')]=_0x553d21[_0xc03b('0x4b')][_0xc03b('0x50')];}return db[_0xc03b('0x2e')][_0xc03b('0x4a')]({'where':_0x6efad9})[_0xc03b('0x24')](function(_0x5a3e27){if(_0x5a3e27){throw new db['Sequelize'][(_0xc03b('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xc03b('0x4c')](_0x553d21[_0xc03b('0x4b')]);})[_0xc03b('0x24')](function(_0x4e3368){var _0x20c9d5=_0x553d21['user'][_0xc03b('0x25')]({'plain':!![]});if(!_0x20c9d5)throw new Error(_0xc03b('0x52'));if(_0x20c9d5[_0xc03b('0x53')]===_0xc03b('0x54')){var _0x2a36c3=_0x4e3368['get']({'plain':!![]});return db[_0xc03b('0x55')]['find']({'where':{'name':_0xc03b('0x26'),'userProfileId':_0x20c9d5[_0xc03b('0x56')]},'raw':!![]})['then'](function(_0x151419){if(_0x151419&&_0x151419['autoAssociation']===0x0){return db[_0xc03b('0x27')][_0xc03b('0x4c')]({'name':_0x2a36c3[_0xc03b('0x2a')],'resourceId':_0x2a36c3['id'],'type':_0x151419['name'],'sectionId':_0x151419['id']},{})['then'](function(){return _0x4e3368;});}else{return _0x4e3368;}})[_0xc03b('0x47')](function(_0x2eead5){logger[_0xc03b('0x29')](_0xc03b('0x57'),_0x2eead5);throw _0x2eead5;});}return _0x4e3368;})[_0xc03b('0x24')](respondWithResult(_0x16f3a7,0xc9))[_0xc03b('0x47')](handleError(_0x16f3a7,null));}; \ No newline at end of file +var _0x73dd=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','length','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','update','destroy','get','CannedAnswers','UserProfileResource','then','end','stack','name','index','map','CannedAnswer'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x73dd,0x1d7));var _0xd73d=function(_0x2309a0,_0xe0e409){_0x2309a0=_0x2309a0-0x0;var _0x274abc=_0x73dd[_0x2309a0];return _0x274abc;};'use strict';var emlformat=require(_0xd73d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd73d('0x1'));var jsonpatch=require(_0xd73d('0x2'));var rp=require(_0xd73d('0x3'));var moment=require(_0xd73d('0x4'));var BPromise=require(_0xd73d('0x5'));var Mustache=require(_0xd73d('0x6'));var util=require(_0xd73d('0x7'));var path=require(_0xd73d('0x8'));var sox=require(_0xd73d('0x9'));var csv=require('to-csv');var ejs=require(_0xd73d('0xa'));var fs=require('fs');var fs_extra=require(_0xd73d('0xb'));var _=require('lodash');var squel=require(_0xd73d('0xc'));var crypto=require('crypto');var jsforce=require(_0xd73d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd73d('0xe'));var Papa=require(_0xd73d('0xf'));var Redis=require(_0xd73d('0x10'));var authService=require(_0xd73d('0x11'));var qs=require(_0xd73d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd73d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd73d('0x14'));var config=require(_0xd73d('0x15'));var licenseUtil=require(_0xd73d('0x16'));var db=require(_0xd73d('0x17'))['db'];function respondWithStatusCode(_0x16c5b8,_0x530e43){_0x530e43=_0x530e43||0xcc;return function(_0x3ebf38){if(_0x3ebf38){return _0x16c5b8[_0xd73d('0x18')](_0x530e43);}return _0x16c5b8[_0xd73d('0x19')](_0x530e43)['end']();};}function respondWithResult(_0x20d64c,_0x20641c){_0x20641c=_0x20641c||0xc8;return function(_0x26c6fb){if(_0x26c6fb){return _0x20d64c['status'](_0x20641c)[_0xd73d('0x1a')](_0x26c6fb);}};}function respondWithFilteredResult(_0x417fd4,_0xb27fab){return function(_0x23f6cf){if(_0x23f6cf){var _0x37ac3a=typeof _0xb27fab[_0xd73d('0x1b')]===_0xd73d('0x1c')&&typeof _0xb27fab['limit']===_0xd73d('0x1c');var _0x160d93=_0x23f6cf[_0xd73d('0x1d')];var _0x1cad83=_0x37ac3a?0x0:_0xb27fab[_0xd73d('0x1b')];var _0x2c81a0=_0x37ac3a?_0x23f6cf[_0xd73d('0x1d')]:_0xb27fab[_0xd73d('0x1b')]+_0xb27fab[_0xd73d('0x1e')];var _0x136574;if(_0x2c81a0>=_0x160d93){_0x2c81a0=_0x160d93;_0x136574=0xc8;}else{_0x136574=0xce;}_0x417fd4['status'](_0x136574);return _0x417fd4['set'](_0xd73d('0x1f'),_0x1cad83+'-'+_0x2c81a0+'/'+_0x160d93)[_0xd73d('0x1a')](_0x23f6cf);}return null;};}function patchUpdates(_0x2f3de4){return function(_0x3e87ad){try{jsonpatch['apply'](_0x3e87ad,_0x2f3de4,!![]);}catch(_0x579146){return BPromise[_0xd73d('0x20')](_0x579146);}return _0x3e87ad['save']();};}function saveUpdates(_0x356357,_0x3c11ec){return function(_0x155b87){if(_0x155b87){return _0x155b87[_0xd73d('0x21')](_0x356357)['then'](function(_0x520331){return _0x520331;});}return null;};}function removeEntity(_0x21b578,_0x115608){return function(_0x42482f){if(_0x42482f){return _0x42482f[_0xd73d('0x22')]()['then'](function(){var _0x3d43f5=_0x42482f[_0xd73d('0x23')]({'plain':!![]});var _0x2f84e4=_0xd73d('0x24');return db[_0xd73d('0x25')]['destroy']({'where':{'type':_0x2f84e4,'resourceId':_0x3d43f5['id']}})[_0xd73d('0x26')](function(){return _0x42482f;});})[_0xd73d('0x26')](function(){_0x21b578[_0xd73d('0x19')](0xcc)[_0xd73d('0x27')]();});}};}function handleEntityNotFound(_0x5093d1,_0x1466b6){return function(_0x498d92){if(!_0x498d92){_0x5093d1[_0xd73d('0x18')](0x194);}return _0x498d92;};}function handleError(_0x5688c5,_0x2475cb){_0x2475cb=_0x2475cb||0x1f4;return function(_0x27f5e6){logger['error'](_0x27f5e6[_0xd73d('0x28')]);if(_0x27f5e6[_0xd73d('0x29')]){delete _0x27f5e6[_0xd73d('0x29')];}_0x5688c5['status'](_0x2475cb)['send'](_0x27f5e6);};}exports[_0xd73d('0x2a')]=function(_0x28a97f,_0x26609d){var _0x58aa73={},_0x51b8e4={},_0x439f12={'count':0x0,'rows':[]};var _0xe48b4c=_[_0xd73d('0x2b')](db[_0xd73d('0x2c')][_0xd73d('0x2d')],function(_0x5d3983){return{'name':_0x5d3983[_0xd73d('0x2e')],'type':_0x5d3983[_0xd73d('0x2f')][_0xd73d('0x30')]};});_0x51b8e4[_0xd73d('0x31')]=_[_0xd73d('0x2b')](_0xe48b4c,_0xd73d('0x29'));_0x51b8e4['query']=_['keys'](_0x28a97f[_0xd73d('0x32')]);_0x51b8e4[_0xd73d('0x33')]=_[_0xd73d('0x34')](_0x51b8e4[_0xd73d('0x31')],_0x51b8e4[_0xd73d('0x32')]);_0x58aa73[_0xd73d('0x35')]=_[_0xd73d('0x34')](_0x51b8e4[_0xd73d('0x31')],qs['fields'](_0x28a97f[_0xd73d('0x32')]['fields']));_0x58aa73['attributes']=_0x58aa73[_0xd73d('0x35')]['length']?_0x58aa73['attributes']:_0x51b8e4['model'];if(!_0x28a97f[_0xd73d('0x32')][_0xd73d('0x36')]('nolimit')){_0x58aa73[_0xd73d('0x1e')]=qs[_0xd73d('0x1e')](_0x28a97f[_0xd73d('0x32')][_0xd73d('0x1e')]);_0x58aa73[_0xd73d('0x1b')]=qs['offset'](_0x28a97f[_0xd73d('0x32')][_0xd73d('0x1b')]);}_0x58aa73[_0xd73d('0x37')]=qs[_0xd73d('0x38')](_0x28a97f['query']['sort']);_0x58aa73[_0xd73d('0x39')]=qs[_0xd73d('0x33')](_[_0xd73d('0x3a')](_0x28a97f[_0xd73d('0x32')],_0x51b8e4[_0xd73d('0x33')]),_0xe48b4c);if(_0x28a97f['query'][_0xd73d('0x3b')]){_0x58aa73[_0xd73d('0x39')]=_['merge'](_0x58aa73[_0xd73d('0x39')],{'$or':[{'key':{'$like':'%'+_0x28a97f['query']['filter']+'%'}},{'value':{'$like':'%'+_0x28a97f['query']['filter']+'%'}}]});}_0x58aa73=_[_0xd73d('0x3c')]({},_0x58aa73,_0x28a97f[_0xd73d('0x3d')]);var _0x731a8f={'where':_0x58aa73[_0xd73d('0x39')]};return db[_0xd73d('0x2c')]['count'](_0x731a8f)['then'](function(_0x4c5772){_0x439f12[_0xd73d('0x1d')]=_0x4c5772;if(_0x28a97f[_0xd73d('0x32')][_0xd73d('0x3e')]){_0x58aa73[_0xd73d('0x3f')]=[{'all':!![]}];}return db[_0xd73d('0x2c')][_0xd73d('0x40')](_0x58aa73);})[_0xd73d('0x26')](function(_0x195d97){_0x439f12[_0xd73d('0x41')]=_0x195d97;return _0x439f12;})['then'](respondWithFilteredResult(_0x26609d,_0x58aa73))[_0xd73d('0x42')](handleError(_0x26609d,null));};exports['show']=function(_0x1c5733,_0x13cdc6){var _0x447885={'raw':!![],'where':{'id':_0x1c5733[_0xd73d('0x43')]['id']}},_0x23a2a9={};_0x23a2a9[_0xd73d('0x31')]=_['keys'](db[_0xd73d('0x2c')]['rawAttributes']);_0x23a2a9[_0xd73d('0x32')]=_[_0xd73d('0x44')](_0x1c5733['query']);_0x23a2a9[_0xd73d('0x33')]=_[_0xd73d('0x34')](_0x23a2a9[_0xd73d('0x31')],_0x23a2a9[_0xd73d('0x32')]);_0x447885[_0xd73d('0x35')]=_[_0xd73d('0x34')](_0x23a2a9[_0xd73d('0x31')],qs['fields'](_0x1c5733['query']['fields']));_0x447885[_0xd73d('0x35')]=_0x447885['attributes'][_0xd73d('0x45')]?_0x447885[_0xd73d('0x35')]:_0x23a2a9[_0xd73d('0x31')];if(_0x1c5733[_0xd73d('0x32')][_0xd73d('0x3e')]){_0x447885[_0xd73d('0x3f')]=[{'all':!![]}];}_0x447885=_[_0xd73d('0x3c')]({},_0x447885,_0x1c5733[_0xd73d('0x3d')]);return db[_0xd73d('0x2c')][_0xd73d('0x46')](_0x447885)[_0xd73d('0x26')](handleEntityNotFound(_0x13cdc6,null))['then'](respondWithResult(_0x13cdc6,null))['catch'](handleError(_0x13cdc6,null));};exports['update']=function(_0x189a63,_0x1cb0bd){if(_0x189a63[_0xd73d('0x47')]['id']){delete _0x189a63['body']['id'];}return db[_0xd73d('0x2c')][_0xd73d('0x46')]({'where':{'id':_0x189a63[_0xd73d('0x43')]['id']}})[_0xd73d('0x26')](handleEntityNotFound(_0x1cb0bd,null))[_0xd73d('0x26')](saveUpdates(_0x189a63['body'],null))[_0xd73d('0x26')](respondWithResult(_0x1cb0bd,null))[_0xd73d('0x42')](handleError(_0x1cb0bd,null));};exports[_0xd73d('0x22')]=function(_0x5ef318,_0x19b7bd){return db[_0xd73d('0x2c')]['find']({'where':{'id':_0x5ef318[_0xd73d('0x43')]['id']}})[_0xd73d('0x26')](handleEntityNotFound(_0x19b7bd,null))[_0xd73d('0x26')](removeEntity(_0x19b7bd,null))['catch'](handleError(_0x19b7bd,null));};exports[_0xd73d('0x48')]=function(_0x38478e,_0x1eb8e2){var _0x232396={'key':_0x38478e[_0xd73d('0x47')]['key']};if(_0x38478e[_0xd73d('0x47')]['MailAccountId']){_0x232396[_0xd73d('0x49')]=_0x38478e[_0xd73d('0x47')][_0xd73d('0x49')];}else if(_0x38478e[_0xd73d('0x47')][_0xd73d('0x4a')]){_0x232396[_0xd73d('0x4a')]=_0x38478e[_0xd73d('0x47')][_0xd73d('0x4a')];}else if(_0x38478e[_0xd73d('0x47')][_0xd73d('0x4b')]){_0x232396[_0xd73d('0x4b')]=_0x38478e['body'][_0xd73d('0x4b')];}else if(_0x38478e[_0xd73d('0x47')][_0xd73d('0x4c')]){_0x232396['ChatWebsiteId']=_0x38478e[_0xd73d('0x47')][_0xd73d('0x4c')];}return db[_0xd73d('0x2c')][_0xd73d('0x46')]({'where':_0x232396})[_0xd73d('0x26')](function(_0x3e457a){if(_0x3e457a){throw new db[(_0xd73d('0x4d'))][(_0xd73d('0x4e'))](_0xd73d('0x4f'));}return db[_0xd73d('0x2c')][_0xd73d('0x48')](_0x38478e[_0xd73d('0x47')]);})[_0xd73d('0x26')](function(_0x37178b){var _0x3e8493=_0x38478e[_0xd73d('0x50')]['get']({'plain':!![]});if(!_0x3e8493)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e8493[_0xd73d('0x51')]===_0xd73d('0x50')){var _0x32d9c8=_0x37178b[_0xd73d('0x23')]({'plain':!![]});return db[_0xd73d('0x52')][_0xd73d('0x46')]({'where':{'name':'CannedAnswers','userProfileId':_0x3e8493[_0xd73d('0x53')]},'raw':!![]})[_0xd73d('0x26')](function(_0x5c1bb2){if(_0x5c1bb2&&_0x5c1bb2[_0xd73d('0x54')]===0x0){return db[_0xd73d('0x25')]['create']({'name':_0x32d9c8[_0xd73d('0x29')],'resourceId':_0x32d9c8['id'],'type':_0x5c1bb2[_0xd73d('0x29')],'sectionId':_0x5c1bb2['id']},{})[_0xd73d('0x26')](function(){return _0x37178b;});}else{return _0x37178b;}})[_0xd73d('0x42')](function(_0x1c383b){logger['error'](_0xd73d('0x55'),_0x1c383b);throw _0x1c383b;});}return _0x37178b;})[_0xd73d('0x26')](respondWithResult(_0x1eb8e2,0xc9))[_0xd73d('0x42')](handleError(_0x1eb8e2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index e4333ea..4154122 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 _0x304a=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x487f15,_0xcca6e3){var _0x379a0=function(_0x3a4687){while(--_0x3a4687){_0x487f15['push'](_0x487f15['shift']());}};_0x379a0(++_0xcca6e3);}(_0x304a,0x19a));var _0xa304=function(_0x3c8ad0,_0x2f9d30){_0x3c8ad0=_0x3c8ad0-0x0;var _0x4926d9=_0x304a[_0x3c8ad0];return _0x4926d9;};'use strict';var _=require(_0xa304('0x0'));var util=require(_0xa304('0x1'));var logger=require(_0xa304('0x2'))(_0xa304('0x3'));var moment=require(_0xa304('0x4'));var BPromise=require(_0xa304('0x5'));var rp=require(_0xa304('0x6'));var fs=require('fs');var path=require(_0xa304('0x7'));var rimraf=require(_0xa304('0x8'));var config=require(_0xa304('0x9'));var attributes=require(_0xa304('0xa'));module['exports']=function(_0x350c70,_0x35d8f1){return _0x350c70[_0xa304('0xb')](_0xa304('0xc'),attributes,{'tableName':_0xa304('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa304('0xe'),'collate':_0xa304('0xf')});}; \ No newline at end of file +var _0xc0f3=['define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xc0f3,0x1d8));var _0x3c0f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc0f3[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x3c0f('0x0'));var logger=require(_0x3c0f('0x1'))(_0x3c0f('0x2'));var moment=require('moment');var BPromise=require(_0x3c0f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3c0f('0x4'));var config=require(_0x3c0f('0x5'));var attributes=require(_0x3c0f('0x6'));module[_0x3c0f('0x7')]=function(_0x1512d2,_0x5871c0){return _0x1512d2[_0x3c0f('0x8')](_0x3c0f('0x9'),attributes,{'tableName':_0x3c0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c0f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b8aec73..a48bb0b 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(_0x2b00f8,_0x50c19a){var _0xf43bac=function(_0x4e5f33){while(--_0x4e5f33){_0x2b00f8['push'](_0x2b00f8['shift']());}};_0xf43bac(++_0x50c19a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x3b3d75,_0x546685){var _0x477866=function(_0x127da3){while(--_0x127da3){_0x3b3d75['push'](_0x3b3d75['shift']());}};_0x477866(++_0x546685);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 ce63019..ee9e24e 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 _0x13fc=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x59e5d8,_0x1c4464){var _0x358a19=function(_0x43b658){while(--_0x43b658){_0x59e5d8['push'](_0x59e5d8['shift']());}};_0x358a19(++_0x1c4464);}(_0x13fc,0x1a0));var _0xc13f=function(_0x54ab,_0x4eb47e){_0x54ab=_0x54ab-0x0;var _0x1996a5=_0x13fc[_0x54ab];return _0x1996a5;};'use strict';var multer=require(_0xc13f('0x0'));var util=require('util');var path=require(_0xc13f('0x1'));var timeout=require(_0xc13f('0x2'));var express=require('express');var router=express[_0xc13f('0x3')]();var fs_extra=require(_0xc13f('0x4'));var auth=require(_0xc13f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc13f('0x6'));router[_0xc13f('0x7')]('/',auth[_0xc13f('0x8')](),controller['index']);router[_0xc13f('0x7')]('/:id',auth[_0xc13f('0x8')](),controller[_0xc13f('0x9')]);router[_0xc13f('0xa')]('/',auth[_0xc13f('0x8')](),controller[_0xc13f('0xb')]);router[_0xc13f('0xc')](_0xc13f('0xd'),auth[_0xc13f('0x8')](),controller[_0xc13f('0xe')]);router[_0xc13f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc13f('0x10')]);module[_0xc13f('0x11')]=router; \ No newline at end of file +var _0xe72a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','index','/:id','show','post','put','isAuthenticated','update','destroy','exports','util','path','connect-timeout'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xe72a,0xe7));var _0xae72=function(_0x4a1359,_0x30cf06){_0x4a1359=_0x4a1359-0x0;var _0x1fe0a6=_0xe72a[_0x4a1359];return _0x1fe0a6;};'use strict';var multer=require('multer');var util=require(_0xae72('0x0'));var path=require(_0xae72('0x1'));var timeout=require(_0xae72('0x2'));var express=require('express');var router=express[_0xae72('0x3')]();var fs_extra=require(_0xae72('0x4'));var auth=require(_0xae72('0x5'));var interaction=require(_0xae72('0x6'));var config=require(_0xae72('0x7'));var controller=require(_0xae72('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xae72('0x9')]);router['get'](_0xae72('0xa'),auth['isAuthenticated'](),controller[_0xae72('0xb')]);router[_0xae72('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xae72('0xd')]('/:id',auth[_0xae72('0xe')](),controller[_0xae72('0xf')]);router['delete']('/:id',auth[_0xae72('0xe')](),controller[_0xae72('0x10')]);module[_0xae72('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 73ea73d..e5571fe 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 _0xcc94=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x5f5870,_0x5d4521){var _0x172b00=function(_0x1c1fc7){while(--_0x1c1fc7){_0x5f5870['push'](_0x5f5870['shift']());}};_0x172b00(++_0x5d4521);}(_0xcc94,0xee));var _0x4cc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc94[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x4cc9('0x0')]={'calldate':{'type':Sequelize[_0x4cc9('0x1')],'allowNull':![],'defaultValue':_0x4cc9('0x2')},'clid':{'type':Sequelize[_0x4cc9('0x3')]},'src':{'type':Sequelize[_0x4cc9('0x3')]},'dst':{'type':Sequelize[_0x4cc9('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x4cc9('0x3')]},'lastapp':{'type':Sequelize[_0x4cc9('0x3')]},'lastdata':{'type':Sequelize[_0x4cc9('0x3')]},'duration':{'type':Sequelize[_0x4cc9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4cc9('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4cc9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4cc9('0x3')]},'uniqueid':{'type':Sequelize[_0x4cc9('0x3')]},'linkedid':{'type':Sequelize[_0x4cc9('0x3')]},'sequence':{'type':Sequelize[_0x4cc9('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x4cc9('0x3')]}}; \ No newline at end of file +var _0x0aaf=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1fc73f,_0x3ecabc){var _0x1df95a=function(_0x350d0f){while(--_0x350d0f){_0x1fc73f['push'](_0x1fc73f['shift']());}};_0x1df95a(++_0x3ecabc);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x17266e,_0x5d273d){_0x17266e=_0x17266e-0x0;var _0x8eeaf4=_0x0aaf[_0x17266e];return _0x8eeaf4;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xf0aa('0x0')],'allowNull':![],'defaultValue':_0xf0aa('0x1')},'clid':{'type':Sequelize[_0xf0aa('0x2')]},'src':{'type':Sequelize[_0xf0aa('0x2')]},'dst':{'type':Sequelize[_0xf0aa('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf0aa('0x2')]},'dstchannel':{'type':Sequelize[_0xf0aa('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf0aa('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf0aa('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf0aa('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf0aa('0x2')]},'userfield':{'type':Sequelize[_0xf0aa('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf0aa('0x2')]},'sequence':{'type':Sequelize[_0xf0aa('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf0aa('0x2')]},'tag':{'type':Sequelize[_0xf0aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 612b216..a8a5560 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 _0x8ca9=['show','params','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','sendStatus','stack','index','map','Cdr','type','key','name','keys','filters','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0x8ca9,0x9c));var _0x98ca=function(_0x2ee8c3,_0x295892){_0x2ee8c3=_0x2ee8c3-0x0;var _0x4bd0fb=_0x8ca9[_0x2ee8c3];return _0x4bd0fb;};'use strict';var emlformat=require(_0x98ca('0x0'));var rimraf=require(_0x98ca('0x1'));var zipdir=require(_0x98ca('0x2'));var jsonpatch=require(_0x98ca('0x3'));var rp=require(_0x98ca('0x4'));var moment=require(_0x98ca('0x5'));var BPromise=require(_0x98ca('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x98ca('0x7'));var sox=require('sox');var csv=require(_0x98ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98ca('0x9'));var _=require(_0x98ca('0xa'));var squel=require(_0x98ca('0xb'));var crypto=require(_0x98ca('0xc'));var jsforce=require(_0x98ca('0xd'));var deskjs=require(_0x98ca('0xe'));var toCsv=require(_0x98ca('0x8'));var querystring=require(_0x98ca('0xf'));var Papa=require(_0x98ca('0x10'));var Redis=require(_0x98ca('0x11'));var authService=require(_0x98ca('0x12'));var qs=require(_0x98ca('0x13'));var as=require(_0x98ca('0x14'));var hardwareService=require(_0x98ca('0x15'));var logger=require(_0x98ca('0x16'))(_0x98ca('0x17'));var utils=require(_0x98ca('0x18'));var config=require(_0x98ca('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ca('0x1a'))['db'];function respondWithStatusCode(_0x44b65b,_0xba3887){_0xba3887=_0xba3887||0xcc;return function(_0x472e13){if(_0x472e13){return _0x44b65b['sendStatus'](_0xba3887);}return _0x44b65b[_0x98ca('0x1b')](_0xba3887)[_0x98ca('0x1c')]();};}function respondWithResult(_0x9a230e,_0xa2bab4){_0xa2bab4=_0xa2bab4||0xc8;return function(_0x3df0ef){if(_0x3df0ef){return _0x9a230e[_0x98ca('0x1b')](_0xa2bab4)[_0x98ca('0x1d')](_0x3df0ef);}};}function respondWithFilteredResult(_0x4940ca,_0x330713){return function(_0x29df1b){if(_0x29df1b){var _0x29f46b=typeof _0x330713[_0x98ca('0x1e')]==='undefined'&&typeof _0x330713[_0x98ca('0x1f')]===_0x98ca('0x20');var _0xe9f8ad=_0x29df1b[_0x98ca('0x21')];var _0x4523bb=_0x29f46b?0x0:_0x330713[_0x98ca('0x1e')];var _0x28c8a6=_0x29f46b?_0x29df1b[_0x98ca('0x21')]:_0x330713[_0x98ca('0x1e')]+_0x330713[_0x98ca('0x1f')];var _0x1b2c69;if(_0x28c8a6>=_0xe9f8ad){_0x28c8a6=_0xe9f8ad;_0x1b2c69=0xc8;}else{_0x1b2c69=0xce;}_0x4940ca['status'](_0x1b2c69);return _0x4940ca[_0x98ca('0x22')]('Content-Range',_0x4523bb+'-'+_0x28c8a6+'/'+_0xe9f8ad)[_0x98ca('0x1d')](_0x29df1b);}return null;};}function patchUpdates(_0x2fe568){return function(_0x50f8b4){try{jsonpatch['apply'](_0x50f8b4,_0x2fe568,!![]);}catch(_0x4620e3){return BPromise[_0x98ca('0x23')](_0x4620e3);}return _0x50f8b4[_0x98ca('0x24')]();};}function saveUpdates(_0x519927,_0x2f7742){return function(_0xc23332){if(_0xc23332){return _0xc23332['update'](_0x519927)[_0x98ca('0x25')](function(_0x5dc400){return _0x5dc400;});}return null;};}function removeEntity(_0x3fd0bd,_0x323cdb){return function(_0x430d16){if(_0x430d16){return _0x430d16[_0x98ca('0x26')]()[_0x98ca('0x25')](function(){_0x3fd0bd[_0x98ca('0x1b')](0xcc)[_0x98ca('0x1c')]();});}};}function handleEntityNotFound(_0x50b1a2,_0x2029cb){return function(_0x4fc3c9){if(!_0x4fc3c9){_0x50b1a2[_0x98ca('0x27')](0x194);}return _0x4fc3c9;};}function handleError(_0x1bdb75,_0x5eb829){_0x5eb829=_0x5eb829||0x1f4;return function(_0x1f569b){logger['error'](_0x1f569b[_0x98ca('0x28')]);if(_0x1f569b['name']){delete _0x1f569b['name'];}_0x1bdb75[_0x98ca('0x1b')](_0x5eb829)['send'](_0x1f569b);};}exports[_0x98ca('0x29')]=function(_0x35b920,_0x13f766){var _0x21a12a={},_0x3b3e60={},_0x1e7fcf={'count':0x0,'rows':[]};var _0x11389a=_[_0x98ca('0x2a')](db[_0x98ca('0x2b')]['rawAttributes'],function(_0x2ebf28){return{'name':_0x2ebf28['fieldName'],'type':_0x2ebf28[_0x98ca('0x2c')][_0x98ca('0x2d')]};});_0x3b3e60['model']=_['map'](_0x11389a,_0x98ca('0x2e'));_0x3b3e60['query']=_[_0x98ca('0x2f')](_0x35b920['query']);_0x3b3e60[_0x98ca('0x30')]=_['intersection'](_0x3b3e60[_0x98ca('0x31')],_0x3b3e60[_0x98ca('0x32')]);_0x21a12a['attributes']=_[_0x98ca('0x33')](_0x3b3e60[_0x98ca('0x31')],qs['fields'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x34')]));_0x21a12a['attributes']=_0x21a12a[_0x98ca('0x35')][_0x98ca('0x36')]?_0x21a12a[_0x98ca('0x35')]:_0x3b3e60[_0x98ca('0x31')];if(!_0x35b920[_0x98ca('0x32')]['hasOwnProperty'](_0x98ca('0x37'))){_0x21a12a[_0x98ca('0x1f')]=qs['limit'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x1f')]);_0x21a12a[_0x98ca('0x1e')]=qs['offset'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x1e')]);}_0x21a12a[_0x98ca('0x38')]=qs['sort'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x39')]);_0x21a12a[_0x98ca('0x3a')]=qs['filters'](_['pick'](_0x35b920[_0x98ca('0x32')],_0x3b3e60[_0x98ca('0x30')]),_0x11389a);if(_0x35b920[_0x98ca('0x32')]['filter']){_0x21a12a[_0x98ca('0x3a')]=_[_0x98ca('0x3b')](_0x21a12a[_0x98ca('0x3a')],{'$or':_['map'](_0x11389a,function(_0x1f513b){if(_0x1f513b[_0x98ca('0x2c')]!==_0x98ca('0x3c')){var _0x450745={};_0x450745[_0x1f513b[_0x98ca('0x2e')]]={'$like':'%'+_0x35b920['query']['filter']+'%'};return _0x450745;}})});}_0x21a12a=_['merge']({},_0x21a12a,_0x35b920[_0x98ca('0x3d')]);var _0x2ef2f4={'where':_0x21a12a[_0x98ca('0x3a')]};return db[_0x98ca('0x2b')][_0x98ca('0x21')](_0x2ef2f4)[_0x98ca('0x25')](function(_0x29801f){_0x1e7fcf['count']=_0x29801f;if(_0x35b920['query'][_0x98ca('0x3e')]){_0x21a12a[_0x98ca('0x3f')]=[{'all':!![]}];}return db[_0x98ca('0x2b')][_0x98ca('0x40')](_0x21a12a);})[_0x98ca('0x25')](function(_0x535fdc){_0x1e7fcf['rows']=_0x535fdc;return _0x1e7fcf;})['then'](respondWithFilteredResult(_0x13f766,_0x21a12a))[_0x98ca('0x41')](handleError(_0x13f766,null));};exports[_0x98ca('0x42')]=function(_0x914606,_0x3f260b){var _0x4ede34={'raw':!![],'where':{'id':_0x914606[_0x98ca('0x43')]['id']}},_0x4c2515={};_0x4c2515[_0x98ca('0x31')]=_[_0x98ca('0x2f')](db[_0x98ca('0x2b')][_0x98ca('0x44')]);_0x4c2515[_0x98ca('0x32')]=_[_0x98ca('0x2f')](_0x914606[_0x98ca('0x32')]);_0x4c2515[_0x98ca('0x30')]=_[_0x98ca('0x33')](_0x4c2515[_0x98ca('0x31')],_0x4c2515['query']);_0x4ede34[_0x98ca('0x35')]=_[_0x98ca('0x33')](_0x4c2515[_0x98ca('0x31')],qs[_0x98ca('0x34')](_0x914606[_0x98ca('0x32')][_0x98ca('0x34')]));_0x4ede34[_0x98ca('0x35')]=_0x4ede34[_0x98ca('0x35')][_0x98ca('0x36')]?_0x4ede34['attributes']:_0x4c2515[_0x98ca('0x31')];if(_0x914606[_0x98ca('0x32')]['includeAll']){_0x4ede34[_0x98ca('0x3f')]=[{'all':!![]}];}_0x4ede34=_['merge']({},_0x4ede34,_0x914606[_0x98ca('0x3d')]);return db[_0x98ca('0x2b')][_0x98ca('0x45')](_0x4ede34)[_0x98ca('0x25')](handleEntityNotFound(_0x3f260b,null))[_0x98ca('0x25')](respondWithResult(_0x3f260b,null))[_0x98ca('0x41')](handleError(_0x3f260b,null));};exports[_0x98ca('0x46')]=function(_0x15ed74,_0x2c7d53){return db[_0x98ca('0x2b')][_0x98ca('0x46')](_0x15ed74[_0x98ca('0x47')],{})['then'](respondWithResult(_0x2c7d53,0xc9))[_0x98ca('0x41')](handleError(_0x2c7d53,null));};exports[_0x98ca('0x48')]=function(_0x40498f,_0x19dc39){if(_0x40498f['body']['id']){delete _0x40498f[_0x98ca('0x47')]['id'];}return db[_0x98ca('0x2b')][_0x98ca('0x45')]({'where':{'id':_0x40498f[_0x98ca('0x43')]['id']}})[_0x98ca('0x25')](handleEntityNotFound(_0x19dc39,null))[_0x98ca('0x25')](saveUpdates(_0x40498f[_0x98ca('0x47')],null))['then'](respondWithResult(_0x19dc39,null))['catch'](handleError(_0x19dc39,null));};exports['destroy']=function(_0x3247af,_0x3715cb){return db[_0x98ca('0x2b')][_0x98ca('0x45')]({'where':{'id':_0x3247af['params']['id']}})['then'](handleEntityNotFound(_0x3715cb,null))[_0x98ca('0x25')](removeEntity(_0x3715cb,null))[_0x98ca('0x41')](handleError(_0x3715cb,null));};exports[_0x98ca('0x49')]=function(_0x408266,_0x46bb13){return db[_0x98ca('0x2b')][_0x98ca('0x49')]()[_0x98ca('0x25')](respondWithResult(_0x46bb13,null))[_0x98ca('0x41')](handleError(_0x46bb13,null));}; \ No newline at end of file +var _0x0d4d=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','Cdr','rows','catch','show','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf'];(function(_0x4c587a,_0x3bf54a){var _0x3e66fc=function(_0x48529b){while(--_0x48529b){_0x4c587a['push'](_0x4c587a['shift']());}};_0x3e66fc(++_0x3bf54a);}(_0x0d4d,0x132));var _0xd0d4=function(_0x5da23b,_0x264565){_0x5da23b=_0x5da23b-0x0;var _0x10d8ce=_0x0d4d[_0x5da23b];return _0x10d8ce;};'use strict';var emlformat=require(_0xd0d4('0x0'));var rimraf=require(_0xd0d4('0x1'));var zipdir=require(_0xd0d4('0x2'));var jsonpatch=require(_0xd0d4('0x3'));var rp=require(_0xd0d4('0x4'));var moment=require(_0xd0d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd0d4('0x6'));var util=require('util');var path=require(_0xd0d4('0x7'));var sox=require(_0xd0d4('0x8'));var csv=require('to-csv');var ejs=require(_0xd0d4('0x9'));var fs=require('fs');var fs_extra=require(_0xd0d4('0xa'));var _=require(_0xd0d4('0xb'));var squel=require('squel');var crypto=require(_0xd0d4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd0d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd0d4('0xe'));var Papa=require(_0xd0d4('0xf'));var Redis=require(_0xd0d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd0d4('0x11'));var as=require(_0xd0d4('0x12'));var hardwareService=require(_0xd0d4('0x13'));var logger=require(_0xd0d4('0x14'))(_0xd0d4('0x15'));var utils=require(_0xd0d4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd0d4('0x17'));var db=require(_0xd0d4('0x18'))['db'];function respondWithStatusCode(_0x29ee49,_0x2ddeca){_0x2ddeca=_0x2ddeca||0xcc;return function(_0x38ca06){if(_0x38ca06){return _0x29ee49[_0xd0d4('0x19')](_0x2ddeca);}return _0x29ee49['status'](_0x2ddeca)[_0xd0d4('0x1a')]();};}function respondWithResult(_0x2131c8,_0x10a175){_0x10a175=_0x10a175||0xc8;return function(_0x5d6dd7){if(_0x5d6dd7){return _0x2131c8['status'](_0x10a175)[_0xd0d4('0x1b')](_0x5d6dd7);}};}function respondWithFilteredResult(_0x186405,_0x553b47){return function(_0x29bda4){if(_0x29bda4){var _0x1e8608=typeof _0x553b47['offset']==='undefined'&&typeof _0x553b47[_0xd0d4('0x1c')]===_0xd0d4('0x1d');var _0x268e1a=_0x29bda4['count'];var _0x5cf4c6=_0x1e8608?0x0:_0x553b47['offset'];var _0x407cda=_0x1e8608?_0x29bda4[_0xd0d4('0x1e')]:_0x553b47[_0xd0d4('0x1f')]+_0x553b47['limit'];var _0x568c75;if(_0x407cda>=_0x268e1a){_0x407cda=_0x268e1a;_0x568c75=0xc8;}else{_0x568c75=0xce;}_0x186405[_0xd0d4('0x20')](_0x568c75);return _0x186405['set'](_0xd0d4('0x21'),_0x5cf4c6+'-'+_0x407cda+'/'+_0x268e1a)[_0xd0d4('0x1b')](_0x29bda4);}return null;};}function patchUpdates(_0x1dcc1b){return function(_0x485cd8){try{jsonpatch[_0xd0d4('0x22')](_0x485cd8,_0x1dcc1b,!![]);}catch(_0x4d9fac){return BPromise['reject'](_0x4d9fac);}return _0x485cd8[_0xd0d4('0x23')]();};}function saveUpdates(_0xda03dd,_0x49b6f0){return function(_0x50f959){if(_0x50f959){return _0x50f959[_0xd0d4('0x24')](_0xda03dd)[_0xd0d4('0x25')](function(_0x398a00){return _0x398a00;});}return null;};}function removeEntity(_0x4c94b1,_0x1d8033){return function(_0x1c0831){if(_0x1c0831){return _0x1c0831['destroy']()[_0xd0d4('0x25')](function(){_0x4c94b1['status'](0xcc)[_0xd0d4('0x1a')]();});}};}function handleEntityNotFound(_0x1b03ef,_0x16808c){return function(_0x5380c3){if(!_0x5380c3){_0x1b03ef['sendStatus'](0x194);}return _0x5380c3;};}function handleError(_0x131de5,_0x4e7cc1){_0x4e7cc1=_0x4e7cc1||0x1f4;return function(_0x50e7f0){logger[_0xd0d4('0x26')](_0x50e7f0[_0xd0d4('0x27')]);if(_0x50e7f0[_0xd0d4('0x28')]){delete _0x50e7f0[_0xd0d4('0x28')];}_0x131de5['status'](_0x4e7cc1)[_0xd0d4('0x29')](_0x50e7f0);};}exports[_0xd0d4('0x2a')]=function(_0x45acf8,_0x22e142){var _0x7eecce={},_0xefce4f={},_0x1b07e8={'count':0x0,'rows':[]};var _0x266b91=_[_0xd0d4('0x2b')](db['Cdr'][_0xd0d4('0x2c')],function(_0x7aa87e){return{'name':_0x7aa87e[_0xd0d4('0x2d')],'type':_0x7aa87e[_0xd0d4('0x2e')][_0xd0d4('0x2f')]};});_0xefce4f[_0xd0d4('0x30')]=_['map'](_0x266b91,'name');_0xefce4f[_0xd0d4('0x31')]=_['keys'](_0x45acf8[_0xd0d4('0x31')]);_0xefce4f[_0xd0d4('0x32')]=_[_0xd0d4('0x33')](_0xefce4f[_0xd0d4('0x30')],_0xefce4f[_0xd0d4('0x31')]);_0x7eecce[_0xd0d4('0x34')]=_[_0xd0d4('0x33')](_0xefce4f['model'],qs['fields'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x35')]));_0x7eecce['attributes']=_0x7eecce[_0xd0d4('0x34')]['length']?_0x7eecce['attributes']:_0xefce4f[_0xd0d4('0x30')];if(!_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x36')](_0xd0d4('0x37'))){_0x7eecce['limit']=qs['limit'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x1c')]);_0x7eecce[_0xd0d4('0x1f')]=qs['offset'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x1f')]);}_0x7eecce[_0xd0d4('0x38')]=qs[_0xd0d4('0x39')](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x39')]);_0x7eecce[_0xd0d4('0x3a')]=qs[_0xd0d4('0x32')](_['pick'](_0x45acf8[_0xd0d4('0x31')],_0xefce4f['filters']),_0x266b91);if(_0x45acf8['query'][_0xd0d4('0x3b')]){_0x7eecce['where']=_[_0xd0d4('0x3c')](_0x7eecce[_0xd0d4('0x3a')],{'$or':_[_0xd0d4('0x2b')](_0x266b91,function(_0x1d6329){if(_0x1d6329[_0xd0d4('0x2e')]!==_0xd0d4('0x3d')){var _0x560e77={};_0x560e77[_0x1d6329[_0xd0d4('0x28')]]={'$like':'%'+_0x45acf8[_0xd0d4('0x31')]['filter']+'%'};return _0x560e77;}})});}_0x7eecce=_['merge']({},_0x7eecce,_0x45acf8[_0xd0d4('0x3e')]);var _0x3e6527={'where':_0x7eecce[_0xd0d4('0x3a')]};return db['Cdr'][_0xd0d4('0x1e')](_0x3e6527)[_0xd0d4('0x25')](function(_0x230101){_0x1b07e8[_0xd0d4('0x1e')]=_0x230101;if(_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x3f')]){_0x7eecce[_0xd0d4('0x40')]=[{'all':!![]}];}return db[_0xd0d4('0x41')]['findAll'](_0x7eecce);})[_0xd0d4('0x25')](function(_0x4174e8){_0x1b07e8[_0xd0d4('0x42')]=_0x4174e8;return _0x1b07e8;})['then'](respondWithFilteredResult(_0x22e142,_0x7eecce))[_0xd0d4('0x43')](handleError(_0x22e142,null));};exports[_0xd0d4('0x44')]=function(_0x5db657,_0x11b77e){var _0x32d1c1={'raw':!![],'where':{'id':_0x5db657[_0xd0d4('0x45')]['id']}},_0x429b84={};_0x429b84[_0xd0d4('0x30')]=_[_0xd0d4('0x46')](db['Cdr'][_0xd0d4('0x2c')]);_0x429b84[_0xd0d4('0x31')]=_[_0xd0d4('0x46')](_0x5db657[_0xd0d4('0x31')]);_0x429b84['filters']=_[_0xd0d4('0x33')](_0x429b84[_0xd0d4('0x30')],_0x429b84[_0xd0d4('0x31')]);_0x32d1c1[_0xd0d4('0x34')]=_[_0xd0d4('0x33')](_0x429b84[_0xd0d4('0x30')],qs[_0xd0d4('0x35')](_0x5db657['query'][_0xd0d4('0x35')]));_0x32d1c1[_0xd0d4('0x34')]=_0x32d1c1['attributes'][_0xd0d4('0x47')]?_0x32d1c1[_0xd0d4('0x34')]:_0x429b84[_0xd0d4('0x30')];if(_0x5db657[_0xd0d4('0x31')][_0xd0d4('0x3f')]){_0x32d1c1[_0xd0d4('0x40')]=[{'all':!![]}];}_0x32d1c1=_['merge']({},_0x32d1c1,_0x5db657[_0xd0d4('0x3e')]);return db['Cdr'][_0xd0d4('0x48')](_0x32d1c1)[_0xd0d4('0x25')](handleEntityNotFound(_0x11b77e,null))['then'](respondWithResult(_0x11b77e,null))[_0xd0d4('0x43')](handleError(_0x11b77e,null));};exports['create']=function(_0x5d61d5,_0x1dad8b){return db['Cdr'][_0xd0d4('0x49')](_0x5d61d5[_0xd0d4('0x4a')],{})['then'](respondWithResult(_0x1dad8b,0xc9))[_0xd0d4('0x43')](handleError(_0x1dad8b,null));};exports['update']=function(_0xdf2562,_0x258cd1){if(_0xdf2562[_0xd0d4('0x4a')]['id']){delete _0xdf2562[_0xd0d4('0x4a')]['id'];}return db[_0xd0d4('0x41')][_0xd0d4('0x48')]({'where':{'id':_0xdf2562[_0xd0d4('0x45')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x258cd1,null))[_0xd0d4('0x25')](saveUpdates(_0xdf2562['body'],null))['then'](respondWithResult(_0x258cd1,null))[_0xd0d4('0x43')](handleError(_0x258cd1,null));};exports[_0xd0d4('0x4b')]=function(_0x333a5b,_0x6af64e){return db[_0xd0d4('0x41')][_0xd0d4('0x48')]({'where':{'id':_0x333a5b[_0xd0d4('0x45')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x6af64e,null))[_0xd0d4('0x25')](removeEntity(_0x6af64e,null))['catch'](handleError(_0x6af64e,null));};exports[_0xd0d4('0x4c')]=function(_0x5b23bb,_0x4b97e1){return db[_0xd0d4('0x41')]['describe']()[_0xd0d4('0x25')](respondWithResult(_0x4b97e1,null))[_0xd0d4('0x43')](handleError(_0x4b97e1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 91d0d94..fbce907 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(_0x391e46,_0x15620f){var _0x30f716=function(_0x28d242){while(--_0x28d242){_0x391e46['push'](_0x391e46['shift']());}};_0x30f716(++_0x15620f);}(_0x7a54,0x106));var _0x47a5=function(_0x7a5cf1,_0x43a166){_0x7a5cf1=_0x7a5cf1-0x0;var _0x4e670a=_0x7a54[_0x7a5cf1];return _0x4e670a;};'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(_0x42c440,_0x28ee66){var _0x4a9172=function(_0x314cf7){while(--_0x314cf7){_0x42c440['push'](_0x42c440['shift']());}};_0x4a9172(++_0x28ee66);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 c234152..136082f 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 _0x899f=['../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x899f,0x101));var _0xf899=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x899f[_0x41f2f5];return _0x3d49f1;};'use strict';var _=require(_0xf899('0x0'));var util=require(_0xf899('0x1'));var moment=require('moment');var BPromise=require(_0xf899('0x2'));var rs=require(_0xf899('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf899('0x4'))['db'];var utils=require(_0xf899('0x5'));var logger=require('../../config/logger')(_0xf899('0x6'));var config=require(_0xf899('0x7'));var jayson=require(_0xf899('0x8'));var client=jayson[_0xf899('0x9')][_0xf899('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x426ea3,_0x5f2024,_0x1e78e8){return new BPromise(function(_0x3f4f11,_0x54c924){return client[_0xf899('0xb')](_0x426ea3,_0x1e78e8)[_0xf899('0xc')](function(_0x1410c7){logger[_0xf899('0xd')](_0xf899('0xe'),_0x5f2024,_0xf899('0xf'));logger['debug'](_0xf899('0x10'),_0x5f2024,_0xf899('0xf'),JSON[_0xf899('0x11')](_0x1410c7));if(_0x1410c7[_0xf899('0x12')]){if(_0x1410c7[_0xf899('0x12')][_0xf899('0x13')]===0x1f4){logger['error'](_0xf899('0xe'),_0x5f2024,_0x1410c7[_0xf899('0x12')][_0xf899('0x14')]);return _0x54c924(_0x1410c7[_0xf899('0x12')][_0xf899('0x14')]);}logger[_0xf899('0x12')](_0xf899('0xe'),_0x5f2024,_0x1410c7[_0xf899('0x12')][_0xf899('0x14')]);return _0x3f4f11(_0x1410c7['error'][_0xf899('0x14')]);}else{logger[_0xf899('0xd')]('Cdr,\x20%s,\x20%s',_0x5f2024,_0xf899('0xf'));_0x3f4f11(_0x1410c7[_0xf899('0x15')][_0xf899('0x14')]);}})['catch'](function(_0x1df4f1){logger['error'](_0xf899('0xe'),_0x5f2024,_0x1df4f1);_0x54c924(_0x1df4f1);});});} \ No newline at end of file +var _0x5f61=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','info','result','catch'];(function(_0x4b4b04,_0x14d717){var _0x30bb5b=function(_0x514ded){while(--_0x514ded){_0x4b4b04['push'](_0x4b4b04['shift']());}};_0x30bb5b(++_0x14d717);}(_0x5f61,0x150));var _0x15f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f61[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x15f6('0x0'));var util=require(_0x15f6('0x1'));var moment=require(_0x15f6('0x2'));var BPromise=require(_0x15f6('0x3'));var rs=require(_0x15f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15f6('0x5'));var logger=require(_0x15f6('0x6'))(_0x15f6('0x7'));var config=require(_0x15f6('0x8'));var jayson=require(_0x15f6('0x9'));var client=jayson[_0x15f6('0xa')][_0x15f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be938,_0x57b7de,_0x544a93){return new BPromise(function(_0x4009cc,_0x2223f7){return client[_0x15f6('0xc')](_0x2be938,_0x544a93)['then'](function(_0x2a2396){logger['info']('Cdr,\x20%s,\x20%s',_0x57b7de,_0x15f6('0xd'));logger[_0x15f6('0xe')](_0x15f6('0xf'),_0x57b7de,_0x15f6('0xd'),JSON[_0x15f6('0x10')](_0x2a2396));if(_0x2a2396[_0x15f6('0x11')]){if(_0x2a2396[_0x15f6('0x11')][_0x15f6('0x12')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x57b7de,_0x2a2396[_0x15f6('0x11')][_0x15f6('0x13')]);return _0x2223f7(_0x2a2396[_0x15f6('0x11')][_0x15f6('0x13')]);}logger['error'](_0x15f6('0x14'),_0x57b7de,_0x2a2396[_0x15f6('0x11')][_0x15f6('0x13')]);return _0x4009cc(_0x2a2396[_0x15f6('0x11')][_0x15f6('0x13')]);}else{logger[_0x15f6('0x15')](_0x15f6('0x14'),_0x57b7de,_0x15f6('0xd'));_0x4009cc(_0x2a2396[_0x15f6('0x16')][_0x15f6('0x13')]);}})[_0x15f6('0x17')](function(_0x36fb43){logger[_0x15f6('0x11')](_0x15f6('0x14'),_0x57b7de,_0x36fb43);_0x2223f7(_0x36fb43);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f9de83d..dcb494b 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2fa457,_0x7021df){var _0x4f250a=function(_0xef901e){while(--_0xef901e){_0x2fa457['push'](_0x2fa457['shift']());}};_0x4f250a(++_0x7021df);}(_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 +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(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_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 6731491..a49fa4c 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 _0xf103=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x1ca037,_0x33e239){var _0x4f8516=function(_0x52affd){while(--_0x52affd){_0x1ca037['push'](_0x1ca037['shift']());}};_0x4f8516(++_0x33e239);}(_0xf103,0x1d8));var _0x3f10=function(_0x4db00c,_0x50cab8){_0x4db00c=_0x4db00c-0x0;var _0x2bf17e=_0xf103[_0x4db00c];return _0x2bf17e;};'use strict';var Sequelize=require(_0x3f10('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3f10('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3f10('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3f10('0x3')]()},'description':{'type':Sequelize[_0x3f10('0x2')]},'interval':{'type':Sequelize[_0x3f10('0x2')],'defaultValue':_0x3f10('0x4')}}; \ No newline at end of file +var _0x4bfb=['*,*,*,*','STRING','noop','TEXT'];(function(_0x2ae3d8,_0x1d7954){var _0x278dd3=function(_0x50d820){while(--_0x50d820){_0x2ae3d8['push'](_0x2ae3d8['shift']());}};_0x278dd3(++_0x1d7954);}(_0x4bfb,0x1dd));var _0xb4bf=function(_0x217a6f,_0x3ecd8b){_0x217a6f=_0x217a6f-0x0;var _0x5553f3=_0x4bfb[_0x217a6f];return _0x5553f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb4bf('0x0')],'allowNull':![],'defaultValue':_0xb4bf('0x1')},'appdata':{'type':Sequelize[_0xb4bf('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb4bf('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 8b31b16..a7e99a4 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 _0x087b=['undefined','count','set','apply','reject','save','then','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','length','includeAll','include','options','find','catch','update','body','params','destroy','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x2f707a,_0x1af79d){var _0x556d27=function(_0x343ba6){while(--_0x343ba6){_0x2f707a['push'](_0x2f707a['shift']());}};_0x556d27(++_0x1af79d);}(_0x087b,0x11a));var _0xb087=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x087b[_0x725b8e];return _0x43ac45;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2dc6,_0x50745a){return function(_0x598b99){if(!_0x598b99){_0x5a2dc6['sendStatus'](0x194);}return _0x598b99;};}function handleError(_0x304840,_0x45685d){_0x45685d=_0x45685d||0x1f4;return function(_0x1d124f){logger[_0xb087('0x28')](_0x1d124f[_0xb087('0x29')]);if(_0x1d124f[_0xb087('0x2a')]){delete _0x1d124f[_0xb087('0x2a')];}_0x304840[_0xb087('0x1c')](_0x45685d)[_0xb087('0x2b')](_0x1d124f);};}exports[_0xb087('0x2c')]=function(_0x18058c,_0x31e3e6){var _0xb0baf6={'raw':!![],'where':{'id':_0x18058c['params']['id']}},_0x263259={};_0x263259[_0xb087('0x2d')]=_[_0xb087('0x2e')](db[_0xb087('0x2f')][_0xb087('0x30')]);_0x263259[_0xb087('0x31')]=_[_0xb087('0x2e')](_0x18058c[_0xb087('0x31')]);_0x263259[_0xb087('0x32')]=_['intersection'](_0x263259['model'],_0x263259[_0xb087('0x31')]);_0xb0baf6[_0xb087('0x33')]=_['intersection'](_0x263259[_0xb087('0x2d')],qs[_0xb087('0x34')](_0x18058c[_0xb087('0x31')][_0xb087('0x34')]));_0xb0baf6[_0xb087('0x33')]=_0xb0baf6[_0xb087('0x33')][_0xb087('0x35')]?_0xb0baf6[_0xb087('0x33')]:_0x263259[_0xb087('0x2d')];if(_0x18058c[_0xb087('0x31')][_0xb087('0x36')]){_0xb0baf6[_0xb087('0x37')]=[{'all':!![]}];}_0xb0baf6=_['merge']({},_0xb0baf6,_0x18058c[_0xb087('0x38')]);return db['ChatApplication'][_0xb087('0x39')](_0xb0baf6)[_0xb087('0x27')](handleEntityNotFound(_0x31e3e6,null))[_0xb087('0x27')](respondWithResult(_0x31e3e6,null))[_0xb087('0x3a')](handleError(_0x31e3e6,null));};exports[_0xb087('0x3b')]=function(_0x1a4b17,_0x32c3e8){if(_0x1a4b17[_0xb087('0x3c')]['id']){delete _0x1a4b17[_0xb087('0x3c')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x1a4b17[_0xb087('0x3d')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x32c3e8,null))[_0xb087('0x27')](saveUpdates(_0x1a4b17[_0xb087('0x3c')],null))[_0xb087('0x27')](respondWithResult(_0x32c3e8,null))['catch'](handleError(_0x32c3e8,null));};exports[_0xb087('0x3e')]=function(_0x1fdc19,_0x48524e){return db['ChatApplication'][_0xb087('0x39')]({'where':{'id':_0x1fdc19[_0xb087('0x3d')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x48524e,null))['then'](removeEntity(_0x48524e,null))[_0xb087('0x3a')](handleError(_0x48524e,null));}; \ No newline at end of file +var _0xcd60=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','then','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x469af4,_0x463713){var _0x180c10=function(_0x527aa7){while(--_0x527aa7){_0x469af4['push'](_0x469af4['shift']());}};_0x180c10(++_0x463713);}(_0xcd60,0xf0));var _0x0cd6=function(_0x270812,_0x222d57){_0x270812=_0x270812-0x0;var _0x3c00b2=_0xcd60[_0x270812];return _0x3c00b2;};'use strict';var emlformat=require(_0x0cd6('0x0'));var rimraf=require(_0x0cd6('0x1'));var zipdir=require(_0x0cd6('0x2'));var jsonpatch=require(_0x0cd6('0x3'));var rp=require(_0x0cd6('0x4'));var moment=require(_0x0cd6('0x5'));var BPromise=require(_0x0cd6('0x6'));var Mustache=require('mustache');var util=require(_0x0cd6('0x7'));var path=require(_0x0cd6('0x8'));var sox=require(_0x0cd6('0x9'));var csv=require(_0x0cd6('0xa'));var ejs=require(_0x0cd6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cd6('0xc'));var squel=require(_0x0cd6('0xd'));var crypto=require('crypto');var jsforce=require(_0x0cd6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0cd6('0xa'));var querystring=require(_0x0cd6('0xf'));var Papa=require(_0x0cd6('0x10'));var Redis=require(_0x0cd6('0x11'));var authService=require(_0x0cd6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0cd6('0x13'));var hardwareService=require(_0x0cd6('0x14'));var logger=require(_0x0cd6('0x15'))(_0x0cd6('0x16'));var utils=require(_0x0cd6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0cd6('0x18'))['db'];function respondWithStatusCode(_0x327d41,_0x2750c9){_0x2750c9=_0x2750c9||0xcc;return function(_0x54c660){if(_0x54c660){return _0x327d41[_0x0cd6('0x19')](_0x2750c9);}return _0x327d41['status'](_0x2750c9)[_0x0cd6('0x1a')]();};}function respondWithResult(_0x259190,_0x134b64){_0x134b64=_0x134b64||0xc8;return function(_0x443290){if(_0x443290){return _0x259190[_0x0cd6('0x1b')](_0x134b64)[_0x0cd6('0x1c')](_0x443290);}};}function respondWithFilteredResult(_0xf6fdb3,_0x1efb4a){return function(_0x1727e5){if(_0x1727e5){var _0x364880=typeof _0x1efb4a[_0x0cd6('0x1d')]===_0x0cd6('0x1e')&&typeof _0x1efb4a[_0x0cd6('0x1f')]===_0x0cd6('0x1e');var _0x596a46=_0x1727e5[_0x0cd6('0x20')];var _0x202d73=_0x364880?0x0:_0x1efb4a['offset'];var _0x5c37ee=_0x364880?_0x1727e5['count']:_0x1efb4a[_0x0cd6('0x1d')]+_0x1efb4a['limit'];var _0x5bdd3f;if(_0x5c37ee>=_0x596a46){_0x5c37ee=_0x596a46;_0x5bdd3f=0xc8;}else{_0x5bdd3f=0xce;}_0xf6fdb3[_0x0cd6('0x1b')](_0x5bdd3f);return _0xf6fdb3['set'](_0x0cd6('0x21'),_0x202d73+'-'+_0x5c37ee+'/'+_0x596a46)[_0x0cd6('0x1c')](_0x1727e5);}return null;};}function patchUpdates(_0x1b29b1){return function(_0x1bb2d6){try{jsonpatch[_0x0cd6('0x22')](_0x1bb2d6,_0x1b29b1,!![]);}catch(_0x33b228){return BPromise[_0x0cd6('0x23')](_0x33b228);}return _0x1bb2d6[_0x0cd6('0x24')]();};}function saveUpdates(_0x5734a5,_0x643aa0){return function(_0x1488bf){if(_0x1488bf){return _0x1488bf[_0x0cd6('0x25')](_0x5734a5)['then'](function(_0x55f68f){return _0x55f68f;});}return null;};}function removeEntity(_0x5cacd5,_0x6689ab){return function(_0x5c8b8b){if(_0x5c8b8b){return _0x5c8b8b['destroy']()['then'](function(){_0x5cacd5['status'](0xcc)[_0x0cd6('0x1a')]();});}};}function handleEntityNotFound(_0x37ff86,_0x2a883a){return function(_0x304a09){if(!_0x304a09){_0x37ff86['sendStatus'](0x194);}return _0x304a09;};}function handleError(_0x55def9,_0x147d7e){_0x147d7e=_0x147d7e||0x1f4;return function(_0x47cd69){logger[_0x0cd6('0x26')](_0x47cd69[_0x0cd6('0x27')]);if(_0x47cd69[_0x0cd6('0x28')]){delete _0x47cd69[_0x0cd6('0x28')];}_0x55def9[_0x0cd6('0x1b')](_0x147d7e)[_0x0cd6('0x29')](_0x47cd69);};}exports[_0x0cd6('0x2a')]=function(_0x341cee,_0x90fa6d){var _0x72c358={'raw':!![],'where':{'id':_0x341cee[_0x0cd6('0x2b')]['id']}},_0x1cb053={};_0x1cb053[_0x0cd6('0x2c')]=_[_0x0cd6('0x2d')](db[_0x0cd6('0x2e')][_0x0cd6('0x2f')]);_0x1cb053['query']=_[_0x0cd6('0x2d')](_0x341cee[_0x0cd6('0x30')]);_0x1cb053[_0x0cd6('0x31')]=_[_0x0cd6('0x32')](_0x1cb053['model'],_0x1cb053[_0x0cd6('0x30')]);_0x72c358[_0x0cd6('0x33')]=_[_0x0cd6('0x32')](_0x1cb053[_0x0cd6('0x2c')],qs[_0x0cd6('0x34')](_0x341cee['query'][_0x0cd6('0x34')]));_0x72c358[_0x0cd6('0x33')]=_0x72c358[_0x0cd6('0x33')][_0x0cd6('0x35')]?_0x72c358[_0x0cd6('0x33')]:_0x1cb053['model'];if(_0x341cee[_0x0cd6('0x30')][_0x0cd6('0x36')]){_0x72c358['include']=[{'all':!![]}];}_0x72c358=_[_0x0cd6('0x37')]({},_0x72c358,_0x341cee[_0x0cd6('0x38')]);return db[_0x0cd6('0x2e')]['find'](_0x72c358)[_0x0cd6('0x39')](handleEntityNotFound(_0x90fa6d,null))[_0x0cd6('0x39')](respondWithResult(_0x90fa6d,null))['catch'](handleError(_0x90fa6d,null));};exports[_0x0cd6('0x25')]=function(_0x12bdb4,_0xf8ec39){if(_0x12bdb4['body']['id']){delete _0x12bdb4[_0x0cd6('0x3a')]['id'];}return db[_0x0cd6('0x2e')][_0x0cd6('0x3b')]({'where':{'id':_0x12bdb4['params']['id']}})[_0x0cd6('0x39')](handleEntityNotFound(_0xf8ec39,null))['then'](saveUpdates(_0x12bdb4[_0x0cd6('0x3a')],null))[_0x0cd6('0x39')](respondWithResult(_0xf8ec39,null))[_0x0cd6('0x3c')](handleError(_0xf8ec39,null));};exports['destroy']=function(_0x2ac6ab,_0x2ab84d){return db[_0x0cd6('0x2e')][_0x0cd6('0x3b')]({'where':{'id':_0x2ac6ab[_0x0cd6('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2ab84d,null))['then'](removeEntity(_0x2ab84d,null))[_0x0cd6('0x3c')](handleError(_0x2ab84d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5ac6d16..9a81a4d 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 _0x383a=['../../config/environment','define','util','../../config/logger','bluebird','path','rimraf'];(function(_0x200b99,_0x55ecd3){var _0x68c6d6=function(_0x4feb82){while(--_0x4feb82){_0x200b99['push'](_0x200b99['shift']());}};_0x68c6d6(++_0x55ecd3);}(_0x383a,0x1ad));var _0xa383=function(_0x54f253,_0x13acb1){_0x54f253=_0x54f253-0x0;var _0x207e8d=_0x383a[_0x54f253];return _0x207e8d;};'use strict';var _=require('lodash');var util=require(_0xa383('0x0'));var logger=require(_0xa383('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa383('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa383('0x3'));var rimraf=require(_0xa383('0x4'));var config=require(_0xa383('0x5'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0xc72371,_0x160e4f){return _0xc72371[_0xa383('0x6')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5eb7=['define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','./chatApplication.attributes','exports'];(function(_0x145307,_0x44360f){var _0x536970=function(_0x310060){while(--_0x310060){_0x145307['push'](_0x145307['shift']());}};_0x536970(++_0x44360f);}(_0x5eb7,0xa0));var _0x75eb=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x5eb7[_0xee3051];return _0x139e81;};'use strict';var _=require(_0x75eb('0x0'));var util=require(_0x75eb('0x1'));var logger=require(_0x75eb('0x2'))('api');var moment=require('moment');var BPromise=require(_0x75eb('0x3'));var rp=require(_0x75eb('0x4'));var fs=require('fs');var path=require(_0x75eb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x75eb('0x6'));module[_0x75eb('0x7')]=function(_0x14f91a,_0x2229f3){return _0x14f91a[_0x75eb('0x8')]('ChatApplication',attributes,{'tableName':_0x75eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x75eb('0xa'),'collate':_0x75eb('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 7aaa99e..7b39cdf 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 _0xc84c=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc84c,0x12f));var _0xcc84=function(_0xa99357,_0x50ffad){_0xa99357=_0xa99357-0x0;var _0x111875=_0xc84c[_0xa99357];return _0x111875;};'use strict';var _=require(_0xcc84('0x0'));var util=require(_0xcc84('0x1'));var moment=require(_0xcc84('0x2'));var BPromise=require(_0xcc84('0x3'));var rs=require(_0xcc84('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc84('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc84('0x6'))(_0xcc84('0x7'));var config=require(_0xcc84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30030b,_0x54fc2b,_0x8daa1f){return new BPromise(function(_0x2635c4,_0x45c5cc){return client[_0xcc84('0xa')](_0x30030b,_0x8daa1f)[_0xcc84('0xb')](function(_0x58e08f){logger['info'](_0xcc84('0xc'),_0x54fc2b,_0xcc84('0xd'));logger[_0xcc84('0xe')](_0xcc84('0xf'),_0x54fc2b,_0xcc84('0xd'),JSON[_0xcc84('0x10')](_0x58e08f));if(_0x58e08f[_0xcc84('0x11')]){if(_0x58e08f[_0xcc84('0x11')]['code']===0x1f4){logger[_0xcc84('0x11')]('ChatApplication,\x20%s,\x20%s',_0x54fc2b,_0x58e08f[_0xcc84('0x11')][_0xcc84('0x12')]);return _0x45c5cc(_0x58e08f[_0xcc84('0x11')]['message']);}logger[_0xcc84('0x11')]('ChatApplication,\x20%s,\x20%s',_0x54fc2b,_0x58e08f['error']['message']);return _0x2635c4(_0x58e08f['error'][_0xcc84('0x12')]);}else{logger[_0xcc84('0x13')](_0xcc84('0xc'),_0x54fc2b,_0xcc84('0xd'));_0x2635c4(_0x58e08f[_0xcc84('0x14')][_0xcc84('0x12')]);}})[_0xcc84('0x15')](function(_0x334ec8){logger[_0xcc84('0x11')](_0xcc84('0xc'),_0x54fc2b,_0x334ec8);_0x45c5cc(_0x334ec8);});});} \ No newline at end of file +var _0xc6fc=['client','http','request','then','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5902c1,_0x3adf56){var _0xa6084=function(_0x28b739){while(--_0x28b739){_0x5902c1['push'](_0x5902c1['shift']());}};_0xa6084(++_0x3adf56);}(_0xc6fc,0x17b));var _0xcc6f=function(_0x422b48,_0xf131fb){_0x422b48=_0x422b48-0x0;var _0x4a6f67=_0xc6fc[_0x422b48];return _0x4a6f67;};'use strict';var _=require(_0xcc6f('0x0'));var util=require(_0xcc6f('0x1'));var moment=require(_0xcc6f('0x2'));var BPromise=require(_0xcc6f('0x3'));var rs=require(_0xcc6f('0x4'));var fs=require('fs');var Redis=require(_0xcc6f('0x5'));var db=require(_0xcc6f('0x6'))['db'];var utils=require(_0xcc6f('0x7'));var logger=require(_0xcc6f('0x8'))(_0xcc6f('0x9'));var config=require(_0xcc6f('0xa'));var jayson=require(_0xcc6f('0xb'));var client=jayson[_0xcc6f('0xc')][_0xcc6f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a59f4,_0x1dc938,_0x2f5778){return new BPromise(function(_0x3af2b1,_0x7e93f9){return client[_0xcc6f('0xe')](_0x3a59f4,_0x2f5778)[_0xcc6f('0xf')](function(_0x1cffc1){logger[_0xcc6f('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1dc938,_0xcc6f('0x11'));logger['debug'](_0xcc6f('0x12'),_0x1dc938,'request\x20sent',JSON['stringify'](_0x1cffc1));if(_0x1cffc1[_0xcc6f('0x13')]){if(_0x1cffc1[_0xcc6f('0x13')]['code']===0x1f4){logger[_0xcc6f('0x13')](_0xcc6f('0x14'),_0x1dc938,_0x1cffc1[_0xcc6f('0x13')][_0xcc6f('0x15')]);return _0x7e93f9(_0x1cffc1['error']['message']);}logger[_0xcc6f('0x13')](_0xcc6f('0x14'),_0x1dc938,_0x1cffc1[_0xcc6f('0x13')][_0xcc6f('0x15')]);return _0x3af2b1(_0x1cffc1[_0xcc6f('0x13')][_0xcc6f('0x15')]);}else{logger[_0xcc6f('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1dc938,_0xcc6f('0x11'));_0x3af2b1(_0x1cffc1['result'][_0xcc6f('0x15')]);}})[_0xcc6f('0x16')](function(_0x3a1e64){logger[_0xcc6f('0x13')](_0xcc6f('0x14'),_0x1dc938,_0x3a1e64);_0x7e93f9(_0x3a1e64);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index fae4bb3..7d01e57 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 _0xce8a=['show','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x48a024,_0x5135cf){var _0x93a358=function(_0x52d479){while(--_0x52d479){_0x48a024['push'](_0x48a024['shift']());}};_0x93a358(++_0x5135cf);}(_0xce8a,0x14f));var _0xace8=function(_0x1ff1a4,_0x3aa6bb){_0x1ff1a4=_0x1ff1a4-0x0;var _0x4a49d2=_0xce8a[_0x1ff1a4];return _0x4a49d2;};'use strict';var multer=require(_0xace8('0x0'));var util=require('util');var path=require(_0xace8('0x1'));var timeout=require(_0xace8('0x2'));var express=require('express');var router=express[_0xace8('0x3')]();var fs_extra=require(_0xace8('0x4'));var auth=require(_0xace8('0x5'));var interaction=require(_0xace8('0x6'));var config=require(_0xace8('0x7'));var controller=require('./chatApplication.controller');router[_0xace8('0x8')]('/:id',auth[_0xace8('0x9')](),controller[_0xace8('0xa')]);router['put'](_0xace8('0xb'),auth['isAuthenticated'](),controller[_0xace8('0xc')]);router[_0xace8('0xd')](_0xace8('0xb'),auth[_0xace8('0x9')](),controller[_0xace8('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7d80=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','put'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x7d80,0xa6));var _0x07d8=function(_0x6eecec,_0x5624a1){_0x6eecec=_0x6eecec-0x0;var _0x151d8d=_0x7d80[_0x6eecec];return _0x151d8d;};'use strict';var multer=require(_0x07d8('0x0'));var util=require(_0x07d8('0x1'));var path=require(_0x07d8('0x2'));var timeout=require(_0x07d8('0x3'));var express=require(_0x07d8('0x4'));var router=express[_0x07d8('0x5')]();var fs_extra=require(_0x07d8('0x6'));var auth=require(_0x07d8('0x7'));var interaction=require(_0x07d8('0x8'));var config=require(_0x07d8('0x9'));var controller=require('./chatApplication.controller');router['get'](_0x07d8('0xa'),auth[_0x07d8('0xb')](),controller[_0x07d8('0xc')]);router[_0x07d8('0xd')](_0x07d8('0xa'),auth[_0x07d8('0xb')](),controller[_0x07d8('0xe')]);router[_0x07d8('0xf')](_0x07d8('0xa'),auth['isAuthenticated'](),controller[_0x07d8('0x10')]);module[_0x07d8('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 880d638..12e98a5 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 _0xbf6c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5cdc13,_0x4702cf){var _0x2a76d8=function(_0x32e6d2){while(--_0x32e6d2){_0x5cdc13['push'](_0x5cdc13['shift']());}};_0x2a76d8(++_0x4702cf);}(_0xbf6c,0x1a6));var _0xcbf6=function(_0x12369b,_0x45cc7f){_0x12369b=_0x12369b-0x0;var _0x2b33c0=_0xbf6c[_0x12369b];return _0x2b33c0;};'use strict';var Sequelize=require(_0xcbf6('0x0'));module[_0xcbf6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcbf6('0x2')]},'write':{'type':Sequelize[_0xcbf6('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcbe1=['exports','STRING','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcbe1,0xd7));var _0x1cbe=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xcbe1[_0x2f57b2];return _0x5ace77;};'use strict';var Sequelize=require(_0x1cbe('0x0'));module[_0x1cbe('0x1')]={'name':{'type':Sequelize[_0x1cbe('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x1cbe('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 988c67a..bb07580 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 _0x76bf=['removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User'];(function(_0x1a27c4,_0x2a320d){var _0x3efcfb=function(_0xe52c1c){while(--_0xe52c1c){_0x1a27c4['push'](_0x1a27c4['shift']());}};_0x3efcfb(++_0x2a320d);}(_0x76bf,0x125));var _0xf76b=function(_0x39093b,_0x1c54f1){_0x39093b=_0x39093b-0x0;var _0x248080=_0x76bf[_0x39093b];return _0x248080;};'use strict';var emlformat=require(_0xf76b('0x0'));var rimraf=require(_0xf76b('0x1'));var zipdir=require(_0xf76b('0x2'));var jsonpatch=require(_0xf76b('0x3'));var rp=require(_0xf76b('0x4'));var moment=require(_0xf76b('0x5'));var BPromise=require(_0xf76b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf76b('0x7'));var sox=require('sox');var csv=require(_0xf76b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf76b('0x9'));var _=require(_0xf76b('0xa'));var squel=require(_0xf76b('0xb'));var crypto=require(_0xf76b('0xc'));var jsforce=require(_0xf76b('0xd'));var deskjs=require(_0xf76b('0xe'));var toCsv=require(_0xf76b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf76b('0xf'));var authService=require(_0xf76b('0x10'));var qs=require(_0xf76b('0x11'));var as=require(_0xf76b('0x12'));var hardwareService=require(_0xf76b('0x13'));var logger=require(_0xf76b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf76b('0x15'));var licenseUtil=require(_0xf76b('0x16'));var db=require('../../mysqldb')['db'];config[_0xf76b('0x17')]=_['defaults'](config[_0xf76b('0x17')],{'host':_0xf76b('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf76b('0x17')]));require(_0xf76b('0x19'))['register'](socket);function respondWithStatusCode(_0x2dce43,_0x44ce4b){_0x44ce4b=_0x44ce4b||0xcc;return function(_0x42e048){if(_0x42e048){return _0x2dce43[_0xf76b('0x1a')](_0x44ce4b);}return _0x2dce43[_0xf76b('0x1b')](_0x44ce4b)['end']();};}function respondWithResult(_0x115ad,_0xf60d64){_0xf60d64=_0xf60d64||0xc8;return function(_0x45e8a5){if(_0x45e8a5){return _0x115ad['status'](_0xf60d64)[_0xf76b('0x1c')](_0x45e8a5);}};}function respondWithFilteredResult(_0x59ee7c,_0x512b6d){return function(_0x40b740){if(_0x40b740){var _0x49ed9e=typeof _0x512b6d[_0xf76b('0x1d')]===_0xf76b('0x1e')&&typeof _0x512b6d[_0xf76b('0x1f')]===_0xf76b('0x1e');var _0x597095=_0x40b740[_0xf76b('0x20')];var _0x9caf21=_0x49ed9e?0x0:_0x512b6d['offset'];var _0x11dbaf=_0x49ed9e?_0x40b740['count']:_0x512b6d[_0xf76b('0x1d')]+_0x512b6d[_0xf76b('0x1f')];var _0x4f0a46;if(_0x11dbaf>=_0x597095){_0x11dbaf=_0x597095;_0x4f0a46=0xc8;}else{_0x4f0a46=0xce;}_0x59ee7c[_0xf76b('0x1b')](_0x4f0a46);return _0x59ee7c[_0xf76b('0x21')](_0xf76b('0x22'),_0x9caf21+'-'+_0x11dbaf+'/'+_0x597095)[_0xf76b('0x1c')](_0x40b740);}return null;};}function patchUpdates(_0x52622e){return function(_0x552249){try{jsonpatch['apply'](_0x552249,_0x52622e,!![]);}catch(_0x1c5af6){return BPromise[_0xf76b('0x23')](_0x1c5af6);}return _0x552249[_0xf76b('0x24')]();};}function saveUpdates(_0x1a1ba5,_0x35acc8){return function(_0x4a07a9){if(_0x4a07a9){return _0x4a07a9['update'](_0x1a1ba5)[_0xf76b('0x25')](function(_0x1208f4){return _0x1208f4;});}return null;};}function removeEntity(_0x263eb8,_0x1c1981){return function(_0x2bf29d){if(_0x2bf29d){return _0x2bf29d[_0xf76b('0x26')]()[_0xf76b('0x25')](function(){_0x263eb8[_0xf76b('0x1b')](0xcc)[_0xf76b('0x27')]();});}};}function handleEntityNotFound(_0x210d5d,_0x448391){return function(_0x1500a8){if(!_0x1500a8){_0x210d5d['sendStatus'](0x194);}return _0x1500a8;};}function handleError(_0x3440bf,_0x51e4b6){_0x51e4b6=_0x51e4b6||0x1f4;return function(_0x1b9472){logger[_0xf76b('0x28')](_0x1b9472[_0xf76b('0x29')]);if(_0x1b9472['name']){delete _0x1b9472[_0xf76b('0x2a')];}_0x3440bf[_0xf76b('0x1b')](_0x51e4b6)[_0xf76b('0x2b')](_0x1b9472);};}exports['index']=function(_0x5809d6,_0xea71d7){var _0x3b9792={},_0x4b40be={},_0x110dbb={'count':0x0,'rows':[]};var _0x56370b=_[_0xf76b('0x2c')](db[_0xf76b('0x2d')][_0xf76b('0x2e')],function(_0x40788f){return{'name':_0x40788f[_0xf76b('0x2f')],'type':_0x40788f['type'][_0xf76b('0x30')]};});_0x4b40be['model']=_['map'](_0x56370b,'name');_0x4b40be[_0xf76b('0x31')]=_[_0xf76b('0x32')](_0x5809d6[_0xf76b('0x31')]);_0x4b40be[_0xf76b('0x33')]=_[_0xf76b('0x34')](_0x4b40be[_0xf76b('0x35')],_0x4b40be[_0xf76b('0x31')]);_0x3b9792[_0xf76b('0x36')]=_[_0xf76b('0x34')](_0x4b40be[_0xf76b('0x35')],qs[_0xf76b('0x37')](_0x5809d6['query'][_0xf76b('0x37')]));_0x3b9792[_0xf76b('0x36')]=_0x3b9792[_0xf76b('0x36')][_0xf76b('0x38')]?_0x3b9792[_0xf76b('0x36')]:_0x4b40be[_0xf76b('0x35')];if(!_0x5809d6[_0xf76b('0x31')][_0xf76b('0x39')](_0xf76b('0x3a'))){_0x3b9792[_0xf76b('0x1f')]=qs[_0xf76b('0x1f')](_0x5809d6['query'][_0xf76b('0x1f')]);_0x3b9792[_0xf76b('0x1d')]=qs[_0xf76b('0x1d')](_0x5809d6['query']['offset']);}_0x3b9792[_0xf76b('0x3b')]=qs['sort'](_0x5809d6[_0xf76b('0x31')][_0xf76b('0x3c')]);_0x3b9792[_0xf76b('0x3d')]=qs['filters'](_[_0xf76b('0x3e')](_0x5809d6[_0xf76b('0x31')],_0x4b40be[_0xf76b('0x33')]),_0x56370b);if(_0x5809d6['query'][_0xf76b('0x3f')]){_0x3b9792['where']=_['merge'](_0x3b9792[_0xf76b('0x3d')],{'$or':_[_0xf76b('0x2c')](_0x56370b,function(_0x168809){if(_0x168809[_0xf76b('0x40')]!==_0xf76b('0x41')){var _0x1b3dca={};_0x1b3dca[_0x168809[_0xf76b('0x2a')]]={'$like':'%'+_0x5809d6[_0xf76b('0x31')]['filter']+'%'};return _0x1b3dca;}})});}_0x3b9792=_[_0xf76b('0x42')]({},_0x3b9792,_0x5809d6[_0xf76b('0x43')]);var _0x3252cf={'where':_0x3b9792[_0xf76b('0x3d')]};return db['ChatGroup'][_0xf76b('0x20')](_0x3252cf)[_0xf76b('0x25')](function(_0x48fff1){_0x110dbb[_0xf76b('0x20')]=_0x48fff1;if(_0x5809d6[_0xf76b('0x31')][_0xf76b('0x44')]){_0x3b9792[_0xf76b('0x45')]=[{'all':!![]}];}return db['ChatGroup'][_0xf76b('0x46')](_0x3b9792);})[_0xf76b('0x25')](function(_0x350f0d){_0x110dbb[_0xf76b('0x47')]=_0x350f0d;return _0x110dbb;})[_0xf76b('0x25')](respondWithFilteredResult(_0xea71d7,_0x3b9792))[_0xf76b('0x48')](handleError(_0xea71d7,null));};exports['show']=function(_0x4dc7f5,_0x31bfa7){var _0x1ebe0e={'raw':!![],'where':{'id':_0x4dc7f5[_0xf76b('0x49')]['id']}},_0x3cd096={};_0x3cd096[_0xf76b('0x35')]=_[_0xf76b('0x32')](db[_0xf76b('0x2d')]['rawAttributes']);_0x3cd096[_0xf76b('0x31')]=_[_0xf76b('0x32')](_0x4dc7f5[_0xf76b('0x31')]);_0x3cd096[_0xf76b('0x33')]=_[_0xf76b('0x34')](_0x3cd096['model'],_0x3cd096['query']);_0x1ebe0e[_0xf76b('0x36')]=_['intersection'](_0x3cd096[_0xf76b('0x35')],qs[_0xf76b('0x37')](_0x4dc7f5[_0xf76b('0x31')]['fields']));_0x1ebe0e['attributes']=_0x1ebe0e[_0xf76b('0x36')][_0xf76b('0x38')]?_0x1ebe0e[_0xf76b('0x36')]:_0x3cd096[_0xf76b('0x35')];if(_0x4dc7f5[_0xf76b('0x31')][_0xf76b('0x44')]){_0x1ebe0e[_0xf76b('0x45')]=[{'all':!![]}];}_0x1ebe0e=_[_0xf76b('0x42')]({},_0x1ebe0e,_0x4dc7f5['options']);return db[_0xf76b('0x2d')][_0xf76b('0x4a')](_0x1ebe0e)[_0xf76b('0x25')](handleEntityNotFound(_0x31bfa7,null))[_0xf76b('0x25')](respondWithResult(_0x31bfa7,null))[_0xf76b('0x48')](handleError(_0x31bfa7,null));};exports[_0xf76b('0x4b')]=function(_0x3fb123,_0x1aaed9){return db[_0xf76b('0x2d')]['create'](_0x3fb123[_0xf76b('0x4c')],{})[_0xf76b('0x25')](respondWithResult(_0x1aaed9,0xc9))[_0xf76b('0x48')](handleError(_0x1aaed9,null));};exports[_0xf76b('0x4d')]=function(_0x363990,_0x4ae3fd){if(_0x363990['body']['id']){delete _0x363990[_0xf76b('0x4c')]['id'];}return db[_0xf76b('0x2d')][_0xf76b('0x4a')]({'where':{'id':_0x363990[_0xf76b('0x49')]['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x4ae3fd,null))['then'](saveUpdates(_0x363990['body'],null))['then'](respondWithResult(_0x4ae3fd,null))['catch'](handleError(_0x4ae3fd,null));};exports[_0xf76b('0x26')]=function(_0x51b420,_0x372647){return db['ChatGroup'][_0xf76b('0x4a')]({'where':{'id':_0x51b420[_0xf76b('0x49')]['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x372647,null))['then'](removeEntity(_0x372647,null))[_0xf76b('0x48')](handleError(_0x372647,null));};exports['describe']=function(_0xf652fc,_0x2878a4){return db[_0xf76b('0x2d')]['describe']()[_0xf76b('0x25')](respondWithResult(_0x2878a4,null))[_0xf76b('0x48')](handleError(_0x2878a4,null));};exports[_0xf76b('0x4e')]=function(_0x4986f3,_0x236610,_0x2f321f){return db[_0xf76b('0x4f')][_0xf76b('0x20')]({'where':{'ChatGroupId':_0x4986f3[_0xf76b('0x49')]['id'],'ToId':_0x4986f3[_0xf76b('0x50')]['id'],'read':![]}})['then'](function(_0x18aa6b){return{'id':_['toInteger'](_0x4986f3[_0xf76b('0x49')]['id']),'count':_0x18aa6b};})[_0xf76b('0x25')](respondWithResult(_0x236610,null))[_0xf76b('0x48')](handleError(_0x236610,null));};exports['addMembers']=function(_0x1e4547,_0x39fc48,_0xfbceb7){return db[_0xf76b('0x2d')]['find']({'where':{'id':_0x1e4547['params']['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x39fc48,null))[_0xf76b('0x25')](function(_0x1c87cb){if(_0x1c87cb){return _0x1c87cb[_0xf76b('0x51')](_0x1e4547[_0xf76b('0x4c')][_0xf76b('0x52')],_[_0xf76b('0x53')](_0x1e4547[_0xf76b('0x4c')],[_0xf76b('0x52'),'id'])||{});}})[_0xf76b('0x25')](respondWithResult(_0x39fc48,null))['catch'](handleError(_0x39fc48,null));};exports[_0xf76b('0x54')]=function(_0x4e2347,_0x5940fe,_0x41b787){var _0x4ab087={};var _0x4658ef={};var _0x5556e7;var _0x4af2d8;return db[_0xf76b('0x2d')][_0xf76b('0x55')]({'where':{'id':_0x4e2347['params']['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x5940fe,null))[_0xf76b('0x25')](function(_0x90a844){if(_0x90a844){_0x5556e7=_0x90a844;_0x4658ef['model']=_[_0xf76b('0x32')](db[_0xf76b('0x56')][_0xf76b('0x2e')]);_0x4658ef[_0xf76b('0x31')]=_[_0xf76b('0x32')](_0x4e2347[_0xf76b('0x31')]);_0x4658ef[_0xf76b('0x33')]=_[_0xf76b('0x34')](_0x4658ef['model'],_0x4658ef['query']);_0x4ab087[_0xf76b('0x36')]=_['intersection'](_0x4658ef[_0xf76b('0x35')],qs['fields'](_0x4e2347[_0xf76b('0x31')]['fields']));_0x4ab087[_0xf76b('0x36')]=_0x4ab087[_0xf76b('0x36')][_0xf76b('0x38')]?_0x4ab087['attributes']:_0x4658ef[_0xf76b('0x35')];_0x4ab087[_0xf76b('0x3b')]=qs[_0xf76b('0x3c')](_0x4e2347[_0xf76b('0x31')][_0xf76b('0x3c')]);_0x4ab087[_0xf76b('0x3d')]=qs[_0xf76b('0x33')](_[_0xf76b('0x3e')](_0x4e2347['query'],_0x4658ef['filters']));if(_0x4e2347[_0xf76b('0x31')][_0xf76b('0x3f')]){_0x4ab087[_0xf76b('0x3d')]=_['merge'](_0x4ab087[_0xf76b('0x3d')],{'$or':_['map'](_0x4ab087['attributes'],function(_0x260a89){var _0x456ca3={};_0x456ca3[_0x260a89]={'$like':'%'+_0x4e2347[_0xf76b('0x31')][_0xf76b('0x3f')]+'%'};return _0x456ca3;})});}_0x4ab087=_['merge']({},_0x4ab087,_0x4e2347['options']);return _0x5556e7['getMembers'](_0x4ab087);}})[_0xf76b('0x25')](function(_0x52191a){if(_0x52191a){_0x4af2d8=_0x52191a['length'];if(!_0x4e2347[_0xf76b('0x31')][_0xf76b('0x39')](_0xf76b('0x3a'))){_0x4ab087[_0xf76b('0x1f')]=qs[_0xf76b('0x1f')](_0x4e2347[_0xf76b('0x31')][_0xf76b('0x1f')]);_0x4ab087['offset']=qs[_0xf76b('0x1d')](_0x4e2347['query']['offset']);}return _0x5556e7[_0xf76b('0x54')](_0x4ab087);}})[_0xf76b('0x25')](function(_0x1a73c3){if(_0x1a73c3){return _0x1a73c3?{'count':_0x4af2d8,'rows':_0x1a73c3}:null;}})[_0xf76b('0x25')](respondWithResult(_0x5940fe,null))[_0xf76b('0x48')](handleError(_0x5940fe,null));};exports[_0xf76b('0x57')]=function(_0x162039,_0x3b7d0a,_0x156780){return db[_0xf76b('0x2d')]['find']({'where':{'id':_0x162039[_0xf76b('0x49')]['id']}})[_0xf76b('0x25')](handleEntityNotFound(_0x3b7d0a,null))[_0xf76b('0x25')](function(_0x4c6c35){if(_0x4c6c35){return _0x4c6c35[_0xf76b('0x57')](_0x162039[_0xf76b('0x31')]['ids']);}})[_0xf76b('0x25')](respondWithStatusCode(_0x3b7d0a,null))[_0xf76b('0x48')](handleError(_0x3b7d0a,null));};exports[_0xf76b('0x58')]=function(_0x178036,_0x136145,_0x4a1ca3){if(_0x178036[_0xf76b('0x4c')]['id']){delete _0x178036[_0xf76b('0x4c')]['id'];}return db[_0xf76b('0x2d')][_0xf76b('0x4a')]({'where':{'id':_0x178036[_0xf76b('0x49')]['id']}})['then'](handleEntityNotFound(_0x136145,null))[_0xf76b('0x25')](function(_0x4a1ee3){if(_0x4a1ee3){_0x178036[_0xf76b('0x4c')][_0xf76b('0x59')]=_0x4a1ee3['id'];return db[_0xf76b('0x4f')][_0xf76b('0x4b')](_0x178036[_0xf76b('0x4c')]);}})[_0xf76b('0x25')](respondWithResult(_0x136145,null))['catch'](handleError(_0x136145,null));};exports[_0xf76b('0x5a')]=function(_0x297058,_0x193296,_0x261bea){var _0xe9fb63={};var _0x4f560a={};var _0x11d0fe;var _0x179047;return db['ChatGroup'][_0xf76b('0x55')]({'where':{'id':_0x297058[_0xf76b('0x49')]['id']}})['then'](handleEntityNotFound(_0x193296,null))[_0xf76b('0x25')](function(_0x3c4095){if(_0x3c4095){_0x11d0fe=_0x3c4095;_0x4f560a['model']=_[_0xf76b('0x32')](db[_0xf76b('0x4f')][_0xf76b('0x2e')]);_0x4f560a[_0xf76b('0x31')]=_[_0xf76b('0x32')](_0x297058[_0xf76b('0x31')]);_0x4f560a[_0xf76b('0x33')]=_[_0xf76b('0x34')](_0x4f560a[_0xf76b('0x35')],_0x4f560a[_0xf76b('0x31')]);_0xe9fb63[_0xf76b('0x36')]=_[_0xf76b('0x34')](_0x4f560a['model'],qs[_0xf76b('0x37')](_0x297058[_0xf76b('0x31')][_0xf76b('0x37')]));_0xe9fb63['attributes']=_0xe9fb63['attributes']['length']?_0xe9fb63[_0xf76b('0x36')]:_0x4f560a[_0xf76b('0x35')];_0xe9fb63[_0xf76b('0x3b')]=qs[_0xf76b('0x3c')](_0x297058[_0xf76b('0x31')][_0xf76b('0x3c')]);_0xe9fb63[_0xf76b('0x3d')]=qs[_0xf76b('0x33')](_[_0xf76b('0x3e')](_0x297058[_0xf76b('0x31')],_0x4f560a[_0xf76b('0x33')]));if(_0x297058['query'][_0xf76b('0x3f')]){_0xe9fb63['where']=_[_0xf76b('0x42')](_0xe9fb63['where'],{'$or':_[_0xf76b('0x2c')](_0xe9fb63['attributes'],function(_0x4bc7f8){var _0x25fbbf={};_0x25fbbf[_0x4bc7f8]={'$like':'%'+_0x297058[_0xf76b('0x31')][_0xf76b('0x3f')]+'%'};return _0x25fbbf;})});}if(_0x297058[_0xf76b('0x31')]['$gte']){var _0x55f514=_0x297058[_0xf76b('0x31')][_0xf76b('0x5b')][_0xf76b('0x5c')](',');var _0x287556={};_0x287556[_0x55f514[0x0]]={'$gte':moment(_0x55f514[0x1])[_0xf76b('0x5d')](_0xf76b('0x5e'))};_0xe9fb63[_0xf76b('0x3d')]=_[_0xf76b('0x42')](_0xe9fb63[_0xf76b('0x3d')],_0x287556);}_0xe9fb63=_[_0xf76b('0x42')]({},_0xe9fb63,_0x297058[_0xf76b('0x43')]);return _0x11d0fe['getMessages'](_0xe9fb63);}})[_0xf76b('0x25')](function(_0xf7f90c){if(_0xf7f90c){_0x179047=_0xf7f90c['length'];if(!_0x297058['query'][_0xf76b('0x39')](_0xf76b('0x3a'))){_0xe9fb63[_0xf76b('0x1f')]=qs[_0xf76b('0x1f')](_0x297058[_0xf76b('0x31')][_0xf76b('0x1f')]);_0xe9fb63[_0xf76b('0x1d')]=qs[_0xf76b('0x1d')](_0x297058['query']['offset']);}return _0x11d0fe[_0xf76b('0x5a')](_0xe9fb63);}})[_0xf76b('0x25')](function(_0x528fec){if(_0x528fec){return _0x528fec?{'count':_0x179047,'rows':_0x528fec}:null;}})['then'](respondWithResult(_0x193296,null))['catch'](handleError(_0x193296,null));}; \ No newline at end of file +var _0x10bf=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','catch','show','params','options','find','create','body','update','describe','getUnread','ChatInternalMessage','addMembers','ids','omit','getMembers','User','order','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0x10bf,0x171));var _0xf10b=function(_0x2442a8,_0x3e0d90){_0x2442a8=_0x2442a8-0x0;var _0x105340=_0x10bf[_0x2442a8];return _0x105340;};'use strict';var emlformat=require(_0xf10b('0x0'));var rimraf=require(_0xf10b('0x1'));var zipdir=require(_0xf10b('0x2'));var jsonpatch=require(_0xf10b('0x3'));var rp=require(_0xf10b('0x4'));var moment=require(_0xf10b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf10b('0x6'));var util=require(_0xf10b('0x7'));var path=require('path');var sox=require(_0xf10b('0x8'));var csv=require(_0xf10b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf10b('0xa'));var _=require(_0xf10b('0xb'));var squel=require(_0xf10b('0xc'));var crypto=require('crypto');var jsforce=require(_0xf10b('0xd'));var deskjs=require(_0xf10b('0xe'));var toCsv=require(_0xf10b('0x9'));var querystring=require(_0xf10b('0xf'));var Papa=require('papaparse');var Redis=require(_0xf10b('0x10'));var authService=require(_0xf10b('0x11'));var qs=require(_0xf10b('0x12'));var as=require(_0xf10b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf10b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf10b('0x15'));var licenseUtil=require(_0xf10b('0x16'));var db=require(_0xf10b('0x17'))['db'];config[_0xf10b('0x18')]=_[_0xf10b('0x19')](config[_0xf10b('0x18')],{'host':_0xf10b('0x1a'),'port':0x18eb});var socket=require(_0xf10b('0x1b'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xf10b('0x1c')](socket);function respondWithStatusCode(_0x6c41be,_0x412d8e){_0x412d8e=_0x412d8e||0xcc;return function(_0x269766){if(_0x269766){return _0x6c41be[_0xf10b('0x1d')](_0x412d8e);}return _0x6c41be['status'](_0x412d8e)['end']();};}function respondWithResult(_0x5241fc,_0x268c50){_0x268c50=_0x268c50||0xc8;return function(_0x4ff2d2){if(_0x4ff2d2){return _0x5241fc[_0xf10b('0x1e')](_0x268c50)[_0xf10b('0x1f')](_0x4ff2d2);}};}function respondWithFilteredResult(_0x2c2e38,_0x47b8e8){return function(_0x448169){if(_0x448169){var _0x56a00b=typeof _0x47b8e8[_0xf10b('0x20')]===_0xf10b('0x21')&&typeof _0x47b8e8['limit']===_0xf10b('0x21');var _0x139357=_0x448169[_0xf10b('0x22')];var _0x320bf0=_0x56a00b?0x0:_0x47b8e8[_0xf10b('0x20')];var _0x113e69=_0x56a00b?_0x448169[_0xf10b('0x22')]:_0x47b8e8[_0xf10b('0x20')]+_0x47b8e8[_0xf10b('0x23')];var _0x5d2778;if(_0x113e69>=_0x139357){_0x113e69=_0x139357;_0x5d2778=0xc8;}else{_0x5d2778=0xce;}_0x2c2e38['status'](_0x5d2778);return _0x2c2e38[_0xf10b('0x24')](_0xf10b('0x25'),_0x320bf0+'-'+_0x113e69+'/'+_0x139357)[_0xf10b('0x1f')](_0x448169);}return null;};}function patchUpdates(_0x5de37d){return function(_0x250e0d){try{jsonpatch[_0xf10b('0x26')](_0x250e0d,_0x5de37d,!![]);}catch(_0x1385f8){return BPromise[_0xf10b('0x27')](_0x1385f8);}return _0x250e0d[_0xf10b('0x28')]();};}function saveUpdates(_0x5b1885,_0x27edbe){return function(_0x3d26f1){if(_0x3d26f1){return _0x3d26f1['update'](_0x5b1885)['then'](function(_0x338a49){return _0x338a49;});}return null;};}function removeEntity(_0x2b0c4f,_0x505b6d){return function(_0x7644c0){if(_0x7644c0){return _0x7644c0[_0xf10b('0x29')]()[_0xf10b('0x2a')](function(){_0x2b0c4f[_0xf10b('0x1e')](0xcc)[_0xf10b('0x2b')]();});}};}function handleEntityNotFound(_0x197c5f,_0x521ee4){return function(_0xdf3146){if(!_0xdf3146){_0x197c5f[_0xf10b('0x1d')](0x194);}return _0xdf3146;};}function handleError(_0x3c1eac,_0x37a48d){_0x37a48d=_0x37a48d||0x1f4;return function(_0x570524){logger[_0xf10b('0x2c')](_0x570524[_0xf10b('0x2d')]);if(_0x570524['name']){delete _0x570524[_0xf10b('0x2e')];}_0x3c1eac['status'](_0x37a48d)[_0xf10b('0x2f')](_0x570524);};}exports[_0xf10b('0x30')]=function(_0x4068e9,_0x56616f){var _0xcf3016={},_0x1fef27={},_0x37dd86={'count':0x0,'rows':[]};var _0x79927f=_[_0xf10b('0x31')](db[_0xf10b('0x32')][_0xf10b('0x33')],function(_0x3a0ec3){return{'name':_0x3a0ec3[_0xf10b('0x34')],'type':_0x3a0ec3[_0xf10b('0x35')][_0xf10b('0x36')]};});_0x1fef27[_0xf10b('0x37')]=_[_0xf10b('0x31')](_0x79927f,_0xf10b('0x2e'));_0x1fef27['query']=_[_0xf10b('0x38')](_0x4068e9[_0xf10b('0x39')]);_0x1fef27['filters']=_['intersection'](_0x1fef27[_0xf10b('0x37')],_0x1fef27['query']);_0xcf3016[_0xf10b('0x3a')]=_[_0xf10b('0x3b')](_0x1fef27[_0xf10b('0x37')],qs['fields'](_0x4068e9[_0xf10b('0x39')][_0xf10b('0x3c')]));_0xcf3016[_0xf10b('0x3a')]=_0xcf3016[_0xf10b('0x3a')][_0xf10b('0x3d')]?_0xcf3016[_0xf10b('0x3a')]:_0x1fef27[_0xf10b('0x37')];if(!_0x4068e9[_0xf10b('0x39')][_0xf10b('0x3e')]('nolimit')){_0xcf3016['limit']=qs[_0xf10b('0x23')](_0x4068e9['query'][_0xf10b('0x23')]);_0xcf3016['offset']=qs[_0xf10b('0x20')](_0x4068e9[_0xf10b('0x39')]['offset']);}_0xcf3016['order']=qs[_0xf10b('0x3f')](_0x4068e9[_0xf10b('0x39')][_0xf10b('0x3f')]);_0xcf3016[_0xf10b('0x40')]=qs[_0xf10b('0x41')](_[_0xf10b('0x42')](_0x4068e9[_0xf10b('0x39')],_0x1fef27[_0xf10b('0x41')]),_0x79927f);if(_0x4068e9[_0xf10b('0x39')]['filter']){_0xcf3016[_0xf10b('0x40')]=_[_0xf10b('0x43')](_0xcf3016['where'],{'$or':_['map'](_0x79927f,function(_0x440de5){if(_0x440de5[_0xf10b('0x35')]!==_0xf10b('0x44')){var _0x1b67e0={};_0x1b67e0[_0x440de5[_0xf10b('0x2e')]]={'$like':'%'+_0x4068e9[_0xf10b('0x39')][_0xf10b('0x45')]+'%'};return _0x1b67e0;}})});}_0xcf3016=_[_0xf10b('0x43')]({},_0xcf3016,_0x4068e9['options']);var _0x3c6b44={'where':_0xcf3016[_0xf10b('0x40')]};return db[_0xf10b('0x32')]['count'](_0x3c6b44)['then'](function(_0x45065f){_0x37dd86['count']=_0x45065f;if(_0x4068e9[_0xf10b('0x39')][_0xf10b('0x46')]){_0xcf3016['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0xcf3016);})[_0xf10b('0x2a')](function(_0x1ba4cf){_0x37dd86['rows']=_0x1ba4cf;return _0x37dd86;})['then'](respondWithFilteredResult(_0x56616f,_0xcf3016))[_0xf10b('0x47')](handleError(_0x56616f,null));};exports[_0xf10b('0x48')]=function(_0x7b2ccf,_0x5cafd3){var _0x4dc548={'raw':!![],'where':{'id':_0x7b2ccf[_0xf10b('0x49')]['id']}},_0x383903={};_0x383903['model']=_['keys'](db[_0xf10b('0x32')][_0xf10b('0x33')]);_0x383903[_0xf10b('0x39')]=_[_0xf10b('0x38')](_0x7b2ccf[_0xf10b('0x39')]);_0x383903[_0xf10b('0x41')]=_[_0xf10b('0x3b')](_0x383903['model'],_0x383903[_0xf10b('0x39')]);_0x4dc548[_0xf10b('0x3a')]=_[_0xf10b('0x3b')](_0x383903[_0xf10b('0x37')],qs[_0xf10b('0x3c')](_0x7b2ccf[_0xf10b('0x39')][_0xf10b('0x3c')]));_0x4dc548['attributes']=_0x4dc548[_0xf10b('0x3a')][_0xf10b('0x3d')]?_0x4dc548[_0xf10b('0x3a')]:_0x383903[_0xf10b('0x37')];if(_0x7b2ccf[_0xf10b('0x39')][_0xf10b('0x46')]){_0x4dc548['include']=[{'all':!![]}];}_0x4dc548=_['merge']({},_0x4dc548,_0x7b2ccf[_0xf10b('0x4a')]);return db['ChatGroup'][_0xf10b('0x4b')](_0x4dc548)[_0xf10b('0x2a')](handleEntityNotFound(_0x5cafd3,null))[_0xf10b('0x2a')](respondWithResult(_0x5cafd3,null))[_0xf10b('0x47')](handleError(_0x5cafd3,null));};exports[_0xf10b('0x4c')]=function(_0xc64a79,_0x3f9049){return db[_0xf10b('0x32')][_0xf10b('0x4c')](_0xc64a79[_0xf10b('0x4d')],{})['then'](respondWithResult(_0x3f9049,0xc9))['catch'](handleError(_0x3f9049,null));};exports[_0xf10b('0x4e')]=function(_0x29ff9b,_0x56fd22){if(_0x29ff9b[_0xf10b('0x4d')]['id']){delete _0x29ff9b[_0xf10b('0x4d')]['id'];}return db[_0xf10b('0x32')][_0xf10b('0x4b')]({'where':{'id':_0x29ff9b[_0xf10b('0x49')]['id']}})[_0xf10b('0x2a')](handleEntityNotFound(_0x56fd22,null))[_0xf10b('0x2a')](saveUpdates(_0x29ff9b[_0xf10b('0x4d')],null))[_0xf10b('0x2a')](respondWithResult(_0x56fd22,null))[_0xf10b('0x47')](handleError(_0x56fd22,null));};exports[_0xf10b('0x29')]=function(_0x36608f,_0x5a387a){return db[_0xf10b('0x32')][_0xf10b('0x4b')]({'where':{'id':_0x36608f[_0xf10b('0x49')]['id']}})[_0xf10b('0x2a')](handleEntityNotFound(_0x5a387a,null))[_0xf10b('0x2a')](removeEntity(_0x5a387a,null))['catch'](handleError(_0x5a387a,null));};exports[_0xf10b('0x4f')]=function(_0x17fdd8,_0x4931e5){return db[_0xf10b('0x32')][_0xf10b('0x4f')]()[_0xf10b('0x2a')](respondWithResult(_0x4931e5,null))[_0xf10b('0x47')](handleError(_0x4931e5,null));};exports[_0xf10b('0x50')]=function(_0x159f7b,_0x386066,_0x23e3fc){return db[_0xf10b('0x51')][_0xf10b('0x22')]({'where':{'ChatGroupId':_0x159f7b[_0xf10b('0x49')]['id'],'ToId':_0x159f7b['user']['id'],'read':![]}})[_0xf10b('0x2a')](function(_0xf28ac5){return{'id':_['toInteger'](_0x159f7b[_0xf10b('0x49')]['id']),'count':_0xf28ac5};})[_0xf10b('0x2a')](respondWithResult(_0x386066,null))[_0xf10b('0x47')](handleError(_0x386066,null));};exports[_0xf10b('0x52')]=function(_0x560b24,_0x309fd7,_0x31538e){return db[_0xf10b('0x32')]['find']({'where':{'id':_0x560b24[_0xf10b('0x49')]['id']}})[_0xf10b('0x2a')](handleEntityNotFound(_0x309fd7,null))[_0xf10b('0x2a')](function(_0x330e7f){if(_0x330e7f){return _0x330e7f[_0xf10b('0x52')](_0x560b24['body'][_0xf10b('0x53')],_[_0xf10b('0x54')](_0x560b24['body'],[_0xf10b('0x53'),'id'])||{});}})[_0xf10b('0x2a')](respondWithResult(_0x309fd7,null))['catch'](handleError(_0x309fd7,null));};exports[_0xf10b('0x55')]=function(_0x55bed7,_0x3822a4,_0x3fed7d){var _0x40226e={};var _0x24cd90={};var _0x3dc34c;var _0x416e59;return db[_0xf10b('0x32')]['findOne']({'where':{'id':_0x55bed7[_0xf10b('0x49')]['id']}})['then'](handleEntityNotFound(_0x3822a4,null))[_0xf10b('0x2a')](function(_0x11b583){if(_0x11b583){_0x3dc34c=_0x11b583;_0x24cd90['model']=_[_0xf10b('0x38')](db[_0xf10b('0x56')][_0xf10b('0x33')]);_0x24cd90['query']=_['keys'](_0x55bed7[_0xf10b('0x39')]);_0x24cd90['filters']=_['intersection'](_0x24cd90[_0xf10b('0x37')],_0x24cd90['query']);_0x40226e[_0xf10b('0x3a')]=_[_0xf10b('0x3b')](_0x24cd90['model'],qs['fields'](_0x55bed7['query'][_0xf10b('0x3c')]));_0x40226e[_0xf10b('0x3a')]=_0x40226e[_0xf10b('0x3a')]['length']?_0x40226e[_0xf10b('0x3a')]:_0x24cd90[_0xf10b('0x37')];_0x40226e[_0xf10b('0x57')]=qs[_0xf10b('0x3f')](_0x55bed7[_0xf10b('0x39')]['sort']);_0x40226e[_0xf10b('0x40')]=qs['filters'](_['pick'](_0x55bed7[_0xf10b('0x39')],_0x24cd90[_0xf10b('0x41')]));if(_0x55bed7['query'][_0xf10b('0x45')]){_0x40226e[_0xf10b('0x40')]=_[_0xf10b('0x43')](_0x40226e[_0xf10b('0x40')],{'$or':_[_0xf10b('0x31')](_0x40226e[_0xf10b('0x3a')],function(_0x306edf){var _0x3d8eea={};_0x3d8eea[_0x306edf]={'$like':'%'+_0x55bed7['query'][_0xf10b('0x45')]+'%'};return _0x3d8eea;})});}_0x40226e=_['merge']({},_0x40226e,_0x55bed7['options']);return _0x3dc34c[_0xf10b('0x55')](_0x40226e);}})[_0xf10b('0x2a')](function(_0x42e262){if(_0x42e262){_0x416e59=_0x42e262[_0xf10b('0x3d')];if(!_0x55bed7[_0xf10b('0x39')]['hasOwnProperty'](_0xf10b('0x58'))){_0x40226e[_0xf10b('0x23')]=qs[_0xf10b('0x23')](_0x55bed7['query'][_0xf10b('0x23')]);_0x40226e[_0xf10b('0x20')]=qs[_0xf10b('0x20')](_0x55bed7[_0xf10b('0x39')][_0xf10b('0x20')]);}return _0x3dc34c[_0xf10b('0x55')](_0x40226e);}})[_0xf10b('0x2a')](function(_0x4218b1){if(_0x4218b1){return _0x4218b1?{'count':_0x416e59,'rows':_0x4218b1}:null;}})[_0xf10b('0x2a')](respondWithResult(_0x3822a4,null))[_0xf10b('0x47')](handleError(_0x3822a4,null));};exports[_0xf10b('0x59')]=function(_0x7cc9c9,_0x2cf80a,_0x580671){return db['ChatGroup'][_0xf10b('0x4b')]({'where':{'id':_0x7cc9c9['params']['id']}})[_0xf10b('0x2a')](handleEntityNotFound(_0x2cf80a,null))[_0xf10b('0x2a')](function(_0x14a3c8){if(_0x14a3c8){return _0x14a3c8[_0xf10b('0x59')](_0x7cc9c9[_0xf10b('0x39')][_0xf10b('0x53')]);}})[_0xf10b('0x2a')](respondWithStatusCode(_0x2cf80a,null))['catch'](handleError(_0x2cf80a,null));};exports[_0xf10b('0x5a')]=function(_0x46d1c8,_0x1534d8,_0x7e1fc8){if(_0x46d1c8[_0xf10b('0x4d')]['id']){delete _0x46d1c8[_0xf10b('0x4d')]['id'];}return db['ChatGroup'][_0xf10b('0x4b')]({'where':{'id':_0x46d1c8['params']['id']}})[_0xf10b('0x2a')](handleEntityNotFound(_0x1534d8,null))[_0xf10b('0x2a')](function(_0x30f4b4){if(_0x30f4b4){_0x46d1c8[_0xf10b('0x4d')][_0xf10b('0x5b')]=_0x30f4b4['id'];return db[_0xf10b('0x51')][_0xf10b('0x4c')](_0x46d1c8['body']);}})[_0xf10b('0x2a')](respondWithResult(_0x1534d8,null))[_0xf10b('0x47')](handleError(_0x1534d8,null));};exports[_0xf10b('0x5c')]=function(_0x29112e,_0x43a4ff,_0x5ee753){var _0x436cd7={};var _0x46fb8b={};var _0x59cd56;var _0x177995;return db['ChatGroup'][_0xf10b('0x5d')]({'where':{'id':_0x29112e[_0xf10b('0x49')]['id']}})['then'](handleEntityNotFound(_0x43a4ff,null))[_0xf10b('0x2a')](function(_0x3cb08c){if(_0x3cb08c){_0x59cd56=_0x3cb08c;_0x46fb8b['model']=_[_0xf10b('0x38')](db['ChatInternalMessage'][_0xf10b('0x33')]);_0x46fb8b[_0xf10b('0x39')]=_[_0xf10b('0x38')](_0x29112e[_0xf10b('0x39')]);_0x46fb8b[_0xf10b('0x41')]=_[_0xf10b('0x3b')](_0x46fb8b[_0xf10b('0x37')],_0x46fb8b[_0xf10b('0x39')]);_0x436cd7[_0xf10b('0x3a')]=_[_0xf10b('0x3b')](_0x46fb8b['model'],qs[_0xf10b('0x3c')](_0x29112e['query']['fields']));_0x436cd7[_0xf10b('0x3a')]=_0x436cd7[_0xf10b('0x3a')]['length']?_0x436cd7[_0xf10b('0x3a')]:_0x46fb8b['model'];_0x436cd7[_0xf10b('0x57')]=qs[_0xf10b('0x3f')](_0x29112e[_0xf10b('0x39')][_0xf10b('0x3f')]);_0x436cd7[_0xf10b('0x40')]=qs[_0xf10b('0x41')](_['pick'](_0x29112e[_0xf10b('0x39')],_0x46fb8b['filters']));if(_0x29112e[_0xf10b('0x39')][_0xf10b('0x45')]){_0x436cd7[_0xf10b('0x40')]=_['merge'](_0x436cd7[_0xf10b('0x40')],{'$or':_[_0xf10b('0x31')](_0x436cd7[_0xf10b('0x3a')],function(_0x21096a){var _0x55af28={};_0x55af28[_0x21096a]={'$like':'%'+_0x29112e['query']['filter']+'%'};return _0x55af28;})});}if(_0x29112e['query']['$gte']){var _0x3fa761=_0x29112e[_0xf10b('0x39')][_0xf10b('0x5e')][_0xf10b('0x5f')](',');var _0x3011e0={};_0x3011e0[_0x3fa761[0x0]]={'$gte':moment(_0x3fa761[0x1])[_0xf10b('0x60')](_0xf10b('0x61'))};_0x436cd7[_0xf10b('0x40')]=_['merge'](_0x436cd7[_0xf10b('0x40')],_0x3011e0);}_0x436cd7=_['merge']({},_0x436cd7,_0x29112e[_0xf10b('0x4a')]);return _0x59cd56['getMessages'](_0x436cd7);}})[_0xf10b('0x2a')](function(_0x524e3a){if(_0x524e3a){_0x177995=_0x524e3a[_0xf10b('0x3d')];if(!_0x29112e['query'][_0xf10b('0x3e')]('nolimit')){_0x436cd7[_0xf10b('0x23')]=qs[_0xf10b('0x23')](_0x29112e[_0xf10b('0x39')][_0xf10b('0x23')]);_0x436cd7['offset']=qs[_0xf10b('0x20')](_0x29112e['query'][_0xf10b('0x20')]);}return _0x59cd56[_0xf10b('0x5c')](_0x436cd7);}})[_0xf10b('0x2a')](function(_0x18ce74){if(_0x18ce74){return _0x18ce74?{'count':_0x177995,'rows':_0x18ce74}:null;}})[_0xf10b('0x2a')](respondWithResult(_0x43a4ff,null))['catch'](handleError(_0x43a4ff,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 804becf..71c554b 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 _0xdbfd=['emit','hasOwnProperty','exports','events','../../mysqldb','update','remove'];(function(_0x10bcc4,_0x4400e2){var _0x2da988=function(_0x2ee849){while(--_0x2ee849){_0x10bcc4['push'](_0x10bcc4['shift']());}};_0x2da988(++_0x4400e2);}(_0xdbfd,0x18b));var _0xddbf=function(_0x514410,_0x4c853e){_0x514410=_0x514410-0x0;var _0x664186=_0xdbfd[_0x514410];return _0x664186;};'use strict';var EventEmitter=require(_0xddbf('0x0'));var ChatGroup=require(_0xddbf('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xddbf('0x2'),'afterDestroy':_0xddbf('0x3')};function emitEvent(_0x4f6d02){return function(_0xce0459,_0x3d7079,_0x4ba2f0){ChatGroupEvents['emit'](_0x4f6d02+':'+_0xce0459['id'],_0xce0459);ChatGroupEvents[_0xddbf('0x4')](_0x4f6d02,_0xce0459);_0x4ba2f0(null);};}for(var e in events){if(events[_0xddbf('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xddbf('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xd758=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xd758,0x172));var _0x8d75=function(_0x2bc024,_0xf121dc){_0x2bc024=_0x2bc024-0x0;var _0x56f871=_0xd758[_0x2bc024];return _0x56f871;};'use strict';var EventEmitter=require(_0x8d75('0x0'));var ChatGroup=require(_0x8d75('0x1'))['db'][_0x8d75('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8d75('0x3')](0x0);var events={'afterCreate':_0x8d75('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xff80b0){return function(_0x52f1fc,_0x2b06a7,_0x50247f){ChatGroupEvents[_0x8d75('0x5')](_0xff80b0+':'+_0x52f1fc['id'],_0x52f1fc);ChatGroupEvents[_0x8d75('0x5')](_0xff80b0,_0x52f1fc);_0x50247f(null);};}for(var e in events){if(events[_0x8d75('0x6')](e)){var event=events[e];ChatGroup[_0x8d75('0x7')](e,emitEvent(event));}}module[_0x8d75('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 8aab583..ab15717 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 _0x3e63=['define','chat_groups','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes'];(function(_0x924691,_0x12e72e){var _0x347738=function(_0x1757d7){while(--_0x1757d7){_0x924691['push'](_0x924691['shift']());}};_0x347738(++_0x12e72e);}(_0x3e63,0x1e6));var _0x33e6=function(_0x4fa738,_0x2a491c){_0x4fa738=_0x4fa738-0x0;var _0x55bf55=_0x3e63[_0x4fa738];return _0x55bf55;};'use strict';var _=require(_0x33e6('0x0'));var util=require(_0x33e6('0x1'));var logger=require('../../config/logger')(_0x33e6('0x2'));var moment=require(_0x33e6('0x3'));var BPromise=require(_0x33e6('0x4'));var rp=require(_0x33e6('0x5'));var fs=require('fs');var path=require(_0x33e6('0x6'));var rimraf=require('rimraf');var config=require(_0x33e6('0x7'));var attributes=require(_0x33e6('0x8'));module['exports']=function(_0x46e573,_0x17ab9b){return _0x46e573[_0x33e6('0x9')]('ChatGroup',attributes,{'tableName':_0x33e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3489=['bluebird','request-promise','path','define','ChatGroup','lodash','../../config/logger','api','moment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3489,0x1c7));var _0x9348=function(_0x50fb8c,_0x301924){_0x50fb8c=_0x50fb8c-0x0;var _0x3e25b1=_0x3489[_0x50fb8c];return _0x3e25b1;};'use strict';var _=require(_0x9348('0x0'));var util=require('util');var logger=require(_0x9348('0x1'))(_0x9348('0x2'));var moment=require(_0x9348('0x3'));var BPromise=require(_0x9348('0x4'));var rp=require(_0x9348('0x5'));var fs=require('fs');var path=require(_0x9348('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module['exports']=function(_0x1cdd25,_0x13a01c){return _0x1cdd25[_0x9348('0x7')](_0x9348('0x8'),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 0f29740..de7e496 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 _0x0f17=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x0f17,0x8b));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70f1('0x0'));var util=require(_0x70f1('0x1'));var moment=require(_0x70f1('0x2'));var BPromise=require(_0x70f1('0x3'));var rs=require(_0x70f1('0x4'));var fs=require('fs');var Redis=require(_0x70f1('0x5'));var db=require(_0x70f1('0x6'))['db'];var utils=require(_0x70f1('0x7'));var logger=require(_0x70f1('0x8'))(_0x70f1('0x9'));var config=require(_0x70f1('0xa'));var jayson=require(_0x70f1('0xb'));var client=jayson[_0x70f1('0xc')][_0x70f1('0xd')]({'port':0x232a});config[_0x70f1('0xe')]=_[_0x70f1('0xf')](config['redis'],{'host':_0x70f1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70f1('0xe')]));require(_0x70f1('0x11'))['register'](socket);function respondWithRpcPromise(_0x261425,_0x7c8ac5,_0x3ecfbf){return new BPromise(function(_0x50cd72,_0x4274e9){return client[_0x70f1('0x12')](_0x261425,_0x3ecfbf)['then'](function(_0x23fe2c){logger[_0x70f1('0x13')](_0x70f1('0x14'),_0x7c8ac5,_0x70f1('0x15'));logger[_0x70f1('0x16')](_0x70f1('0x17'),_0x7c8ac5,_0x70f1('0x15'),JSON[_0x70f1('0x18')](_0x23fe2c));if(_0x23fe2c['error']){if(_0x23fe2c[_0x70f1('0x19')]['code']===0x1f4){logger[_0x70f1('0x19')]('ChatGroup,\x20%s,\x20%s',_0x7c8ac5,_0x23fe2c[_0x70f1('0x19')][_0x70f1('0x1a')]);return _0x4274e9(_0x23fe2c[_0x70f1('0x19')][_0x70f1('0x1a')]);}logger[_0x70f1('0x19')](_0x70f1('0x14'),_0x7c8ac5,_0x23fe2c[_0x70f1('0x19')]['message']);return _0x50cd72(_0x23fe2c[_0x70f1('0x19')]['message']);}else{logger[_0x70f1('0x13')](_0x70f1('0x14'),_0x7c8ac5,_0x70f1('0x15'));_0x50cd72(_0x23fe2c[_0x70f1('0x1b')][_0x70f1('0x1a')]);}})['catch'](function(_0x48e81a){logger[_0x70f1('0x19')](_0x70f1('0x14'),_0x7c8ac5,_0x48e81a);_0x4274e9(_0x48e81a);});});} \ No newline at end of file +var _0x2383=['ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring'];(function(_0x2da971,_0x2d06fa){var _0x125f81=function(_0x40d31e){while(--_0x40d31e){_0x2da971['push'](_0x2da971['shift']());}};_0x125f81(++_0x2d06fa);}(_0x2383,0xb2));var _0x3238=function(_0x142cce,_0x1e8de2){_0x142cce=_0x142cce-0x0;var _0x492245=_0x2383[_0x142cce];return _0x492245;};'use strict';var _=require(_0x3238('0x0'));var util=require(_0x3238('0x1'));var moment=require('moment');var BPromise=require(_0x3238('0x2'));var rs=require(_0x3238('0x3'));var fs=require('fs');var Redis=require(_0x3238('0x4'));var db=require(_0x3238('0x5'))['db'];var utils=require(_0x3238('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3238('0x7'));var client=jayson[_0x3238('0x8')]['http']({'port':0x232a});config[_0x3238('0x9')]=_[_0x3238('0xa')](config[_0x3238('0x9')],{'host':_0x3238('0xb'),'port':0x18eb});var socket=require(_0x3238('0xc'))(new Redis(config['redis']));require(_0x3238('0xd'))[_0x3238('0xe')](socket);function respondWithRpcPromise(_0x33aec1,_0x423651,_0x200aeb){return new BPromise(function(_0xaf0019,_0x51543f){return client[_0x3238('0xf')](_0x33aec1,_0x200aeb)[_0x3238('0x10')](function(_0x4a12ff){logger['info'](_0x3238('0x11'),_0x423651,'request\x20sent');logger['debug'](_0x3238('0x12'),_0x423651,'request\x20sent',JSON['stringify'](_0x4a12ff));if(_0x4a12ff[_0x3238('0x13')]){if(_0x4a12ff[_0x3238('0x13')][_0x3238('0x14')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x423651,_0x4a12ff['error'][_0x3238('0x15')]);return _0x51543f(_0x4a12ff[_0x3238('0x13')]['message']);}logger[_0x3238('0x13')](_0x3238('0x11'),_0x423651,_0x4a12ff['error']['message']);return _0xaf0019(_0x4a12ff[_0x3238('0x13')][_0x3238('0x15')]);}else{logger[_0x3238('0x16')](_0x3238('0x11'),_0x423651,_0x3238('0x17'));_0xaf0019(_0x4a12ff[_0x3238('0x18')]['message']);}})[_0x3238('0x19')](function(_0x29237e){logger[_0x3238('0x13')](_0x3238('0x11'),_0x423651,_0x29237e);_0x51543f(_0x29237e);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ee47e76..9adba34 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 _0x5042=['remove','update','removeListener','length','chatGroup:','./chatGroup.events'];(function(_0x360076,_0x481a6f){var _0x1d593d=function(_0x3fe7bd){while(--_0x3fe7bd){_0x360076['push'](_0x360076['shift']());}};_0x1d593d(++_0x481a6f);}(_0x5042,0xa1));var _0x2504=function(_0xc4c57f,_0x2d9649){_0xc4c57f=_0xc4c57f-0x0;var _0x280f0=_0x5042[_0xc4c57f];return _0x280f0;};'use strict';var ChatGroupEvents=require(_0x2504('0x0'));var events=['save',_0x2504('0x1'),_0x2504('0x2')];function createListener(_0x338f42,_0x46afe5){return function(_0x5d418d){_0x46afe5['emit'](_0x338f42,_0x5d418d);};}function removeListener(_0x2e3597,_0x530a92){return function(){ChatGroupEvents[_0x2504('0x3')](_0x2e3597,_0x530a92);};}exports['register']=function(_0x295e63){for(var _0x419c3a=0x0,_0x4d4c71=events[_0x2504('0x4')];_0x419c3a<_0x4d4c71;_0x419c3a++){var _0x362975=events[_0x419c3a];var _0x36f07b=createListener(_0x2504('0x5')+_0x362975,_0x295e63);ChatGroupEvents['on'](_0x362975,_0x36f07b);}}; \ No newline at end of file +var _0x7f0a=['update','emit','removeListener','register','length','chatGroup:','save','remove'];(function(_0x43613c,_0x4e380f){var _0x2a0ce2=function(_0x1b2fc6){while(--_0x1b2fc6){_0x43613c['push'](_0x43613c['shift']());}};_0x2a0ce2(++_0x4e380f);}(_0x7f0a,0x1c6));var _0xa7f0=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7f0a[_0x4fde08];return _0x12e725;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xa7f0('0x0'),_0xa7f0('0x1'),_0xa7f0('0x2')];function createListener(_0x3866be,_0x218948){return function(_0x2d0382){_0x218948[_0xa7f0('0x3')](_0x3866be,_0x2d0382);};}function removeListener(_0x264d8c,_0x1a7f73){return function(){ChatGroupEvents[_0xa7f0('0x4')](_0x264d8c,_0x1a7f73);};}exports[_0xa7f0('0x5')]=function(_0x89988b){for(var _0x32c37c=0x0,_0x28e05a=events[_0xa7f0('0x6')];_0x32c37c<_0x28e05a;_0x32c37c++){var _0x41d3be=events[_0x32c37c];var _0x30a299=createListener(_0xa7f0('0x7')+_0x41d3be,_0x89988b);ChatGroupEvents['on'](_0x41d3be,_0x30a299);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index f909051..64ed8e5 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 _0xe57e=['/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','isAuthenticated','/:id','show','/:id/unread','/:id/members','getMessages','post','create','addMembers'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0xe57e,0x19d));var _0xee57=function(_0x345865,_0x37e16f){_0x345865=_0x345865-0x0;var _0x3a33c9=_0xe57e[_0x345865];return _0x3a33c9;};'use strict';var multer=require(_0xee57('0x0'));var util=require('util');var path=require(_0xee57('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee57('0x2')]();var fs_extra=require(_0xee57('0x3'));var auth=require(_0xee57('0x4'));var interaction=require(_0xee57('0x5'));var config=require(_0xee57('0x6'));var controller=require(_0xee57('0x7'));router[_0xee57('0x8')]('/',auth['isAuthenticated'](),controller[_0xee57('0x9')]);router[_0xee57('0x8')]('/describe',auth[_0xee57('0xa')](),controller['describe']);router[_0xee57('0x8')](_0xee57('0xb'),auth['isAuthenticated'](),controller[_0xee57('0xc')]);router['get'](_0xee57('0xd'),auth[_0xee57('0xa')](),controller['getUnread']);router[_0xee57('0x8')](_0xee57('0xe'),auth[_0xee57('0xa')](),controller['getMembers']);router[_0xee57('0x8')]('/:id/messages',auth[_0xee57('0xa')](),controller[_0xee57('0xf')]);router[_0xee57('0x10')]('/',auth[_0xee57('0xa')](),controller[_0xee57('0x11')]);router[_0xee57('0x10')]('/:id/members',auth[_0xee57('0xa')](),controller[_0xee57('0x12')]);router[_0xee57('0x10')](_0xee57('0x13'),auth['isAuthenticated'](),controller[_0xee57('0x14')]);router[_0xee57('0x15')](_0xee57('0xb'),auth[_0xee57('0xa')](),controller[_0xee57('0x16')]);router[_0xee57('0x17')](_0xee57('0xb'),auth['isAuthenticated'](),controller[_0xee57('0x18')]);router[_0xee57('0x17')](_0xee57('0xe'),auth[_0xee57('0xa')](),controller[_0xee57('0x19')]);module[_0xee57('0x1a')]=router; \ No newline at end of file +var _0x965f=['/:id','show','/:id/unread','getUnread','getMembers','getMessages','post','create','put','update','delete','destroy','/:id/members','removeMembers','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x5856a1,_0x4927f6){var _0x9967df=function(_0x474306){while(--_0x474306){_0x5856a1['push'](_0x5856a1['shift']());}};_0x9967df(++_0x4927f6);}(_0x965f,0x17a));var _0xf965=function(_0x24fa2,_0x17e55d){_0x24fa2=_0x24fa2-0x0;var _0x4cc9f9=_0x965f[_0x24fa2];return _0x4cc9f9;};'use strict';var multer=require(_0xf965('0x0'));var util=require(_0xf965('0x1'));var path=require(_0xf965('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf965('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf965('0x4'));var interaction=require(_0xf965('0x5'));var config=require('../../config/environment');var controller=require(_0xf965('0x6'));router['get']('/',auth[_0xf965('0x7')](),controller[_0xf965('0x8')]);router[_0xf965('0x9')](_0xf965('0xa'),auth['isAuthenticated'](),controller[_0xf965('0xb')]);router[_0xf965('0x9')](_0xf965('0xc'),auth[_0xf965('0x7')](),controller[_0xf965('0xd')]);router[_0xf965('0x9')](_0xf965('0xe'),auth['isAuthenticated'](),controller[_0xf965('0xf')]);router[_0xf965('0x9')]('/:id/members',auth[_0xf965('0x7')](),controller[_0xf965('0x10')]);router['get']('/:id/messages',auth[_0xf965('0x7')](),controller[_0xf965('0x11')]);router[_0xf965('0x12')]('/',auth[_0xf965('0x7')](),controller[_0xf965('0x13')]);router['post']('/:id/members',auth[_0xf965('0x7')](),controller['addMembers']);router['post']('/:id/messages',auth[_0xf965('0x7')](),controller['addMessage']);router[_0xf965('0x14')](_0xf965('0xc'),auth[_0xf965('0x7')](),controller[_0xf965('0x15')]);router[_0xf965('0x16')](_0xf965('0xc'),auth[_0xf965('0x7')](),controller[_0xf965('0x17')]);router[_0xf965('0x16')](_0xf965('0x18'),auth[_0xf965('0x7')](),controller[_0xf965('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2d202aa..cf4648f 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 _0xec31=['BOOLEAN','INTEGER','star','thumb','TEXT','STRING','long','DATE','ENUM','out','exports'];(function(_0x3cab38,_0x439e61){var _0x187d60=function(_0x285a14){while(--_0x285a14){_0x3cab38['push'](_0x3cab38['shift']());}};_0x187d60(++_0x439e61);}(_0xec31,0x196));var _0x1ec3=function(_0x1fe7e4,_0x5d39a4){_0x1fe7e4=_0x1fe7e4-0x0;var _0x4b3e54=_0xec31[_0x1fe7e4];return _0x4b3e54;};'use strict';var Sequelize=require('sequelize');module[_0x1ec3('0x0')]={'closed':{'type':Sequelize[_0x1ec3('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1ec3('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1ec3('0x3'),_0x1ec3('0x4')),'defaultValue':_0x1ec3('0x3')},'ratingMessage':{'type':Sequelize[_0x1ec3('0x5')]},'pathTranscript':{'type':Sequelize[_0x1ec3('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1ec3('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1ec3('0x6')]},'note':{'type':Sequelize[_0x1ec3('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1ec3('0x6')]},'osName':{'type':Sequelize[_0x1ec3('0x6')]},'osVersion':{'type':Sequelize[_0x1ec3('0x6')]},'deviceModel':{'type':Sequelize[_0x1ec3('0x6')]},'deviceVendor':{'type':Sequelize[_0x1ec3('0x6')]},'deviceType':{'type':Sequelize[_0x1ec3('0x6')]},'referer':{'type':Sequelize[_0x1ec3('0x5')]},'customerIp':{'type':Sequelize[_0x1ec3('0x6')]},'formData':{'type':Sequelize[_0x1ec3('0x5')](_0x1ec3('0x7'))},'read1stAt':{'type':Sequelize[_0x1ec3('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1ec3('0x9')]('in',_0x1ec3('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1ec3('0x6')]},'customerPort':{'type':Sequelize[_0x1ec3('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1ec3('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x1ec3('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8e13=['out','BOOLEAN','sequelize','exports','INTEGER','star','thumb','TEXT','DATE','STRING','ENUM'];(function(_0x5f2a81,_0x3f90d4){var _0x5be519=function(_0x2c98af){while(--_0x2c98af){_0x5f2a81['push'](_0x5f2a81['shift']());}};_0x5be519(++_0x3f90d4);}(_0x8e13,0x1ba));var _0x38e1=function(_0x46a41b,_0x1f9c73){_0x46a41b=_0x46a41b-0x0;var _0x5a53fd=_0x8e13[_0x46a41b];return _0x5a53fd;};'use strict';var Sequelize=require(_0x38e1('0x0'));module[_0x38e1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x38e1('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x38e1('0x3'),_0x38e1('0x4')),'defaultValue':_0x38e1('0x3')},'ratingMessage':{'type':Sequelize[_0x38e1('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x38e1('0x6')]},'disposition':{'type':Sequelize[_0x38e1('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x38e1('0x7')]},'note':{'type':Sequelize[_0x38e1('0x7')]},'browserName':{'type':Sequelize[_0x38e1('0x7')]},'browserVersion':{'type':Sequelize[_0x38e1('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x38e1('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x38e1('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x38e1('0x5')]},'customerIp':{'type':Sequelize[_0x38e1('0x7')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x38e1('0x6')]},'lastMsgAt':{'type':Sequelize[_0x38e1('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x38e1('0x8')]('in',_0x38e1('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x38e1('0x7')]},'customerPort':{'type':Sequelize[_0x38e1('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x38e1('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x38e1('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x38e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9f38b53..8c15207 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 _0x2ff7=['[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','push','rows','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','tmp','attachments','transcript-%d-%s.zip','Contact','lastName','read','Owner','mkdirSync','Chat','Account','N.A.','closedAt','disposition','browserName','osName','customerPort','tail','existsSync','pipe','createWriteStream','firstName','value','server','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','sendStatus','rimraf','request-promise','moment','bluebird','mustache','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','status','offset','undefined','limit','count','end','stack','name','send','merge','body','contact','agent','interaction','account','map','ChatInteraction','fieldName','key','findAll','query','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','update','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','entity\x20not\x20found','UserId','closed','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','type','mimetype','Attachment','json','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','Messages','User','ContactId','%s%d','System','customer','agentIdentifier','agent_alias','alias','agent_fullname','agentAlias'];(function(_0xb6db7d,_0xd781c7){var _0x37923b=function(_0x42eb46){while(--_0x42eb46){_0xb6db7d['push'](_0xb6db7d['shift']());}};_0x37923b(++_0xd781c7);}(_0x2ff7,0x1dd));var _0x72ff=function(_0xe66942,_0x3e74b9){_0xe66942=_0xe66942-0x0;var _0x5efbda=_0x2ff7[_0xe66942];return _0x5efbda;};'use strict';var rimraf=require(_0x72ff('0x0'));var zipdir=require('zip-dir');var rp=require(_0x72ff('0x1'));var moment=require(_0x72ff('0x2'));var BPromise=require(_0x72ff('0x3'));var Mustache=require(_0x72ff('0x4'));var util=require('util');var path=require(_0x72ff('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x72ff('0x6'));var Redis=require(_0x72ff('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x72ff('0x8'));var pdf=require(_0x72ff('0x9'));var logger=require(_0x72ff('0xa'))(_0x72ff('0xb'));var config=require(_0x72ff('0xc'));var db=require('../../mysqldb')['db'];config[_0x72ff('0xd')]=_['defaults'](config[_0x72ff('0xd')],{'host':_0x72ff('0xe'),'port':0x18eb});var socket=require(_0x72ff('0xf'))(new Redis(config[_0x72ff('0xd')]));require(_0x72ff('0x10'))['register'](socket);var jayson=require(_0x72ff('0x11'));var client=jayson[_0x72ff('0x12')]['http']({'port':0x232b});var client9004=jayson[_0x72ff('0x12')][_0x72ff('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x1c5d40,_0xe6679,_0xd88cdd,_0x2a1b38){return new BPromise(function(_0x37b05d,_0x480559){var _0x4c7783=_0x2a1b38||client;return _0x4c7783[_0x72ff('0x14')](_0x1c5d40,_0xd88cdd)[_0x72ff('0x15')](function(_0x7cc3e5){logger[_0x72ff('0x16')](_0x72ff('0x17'),_0xe6679,_0x72ff('0x18'));logger[_0x72ff('0x19')](_0x72ff('0x1a'),_0xe6679,_0x72ff('0x18'),JSON['stringify'](_0x7cc3e5));if(_0x7cc3e5[_0x72ff('0x1b')]){if(_0x7cc3e5[_0x72ff('0x1b')]['code']===0x1f4){logger['error'](_0x72ff('0x17'),_0xe6679,_0x7cc3e5[_0x72ff('0x1b')][_0x72ff('0x1c')]);return _0x480559(_0x7cc3e5['error'][_0x72ff('0x1c')]);}logger['error'](_0x72ff('0x17'),_0xe6679,_0x7cc3e5[_0x72ff('0x1b')][_0x72ff('0x1c')]);return _0x37b05d(_0x7cc3e5[_0x72ff('0x1b')][_0x72ff('0x1c')]);}else{logger[_0x72ff('0x16')](_0x72ff('0x17'),_0xe6679,_0x72ff('0x18'));_0x37b05d(_0x7cc3e5['result'][_0x72ff('0x1c')]);}})[_0x72ff('0x1d')](function(_0x4f00fb){logger[_0x72ff('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0xe6679,_0x4f00fb);_0x480559(_0x4f00fb);});});}function respondWithStatusCode(_0x2ce1c2,_0x42b59a){_0x42b59a=_0x42b59a||0xcc;return function(_0x4f9bfe){if(_0x4f9bfe){return _0x2ce1c2['sendStatus'](_0x42b59a);}return _0x2ce1c2[_0x72ff('0x1e')](_0x42b59a)['end']();};}function respondWithResult(_0x45392c,_0x567ceb){_0x567ceb=_0x567ceb||0xc8;return function(_0x557140){if(_0x557140){return _0x45392c['status'](_0x567ceb)['json'](_0x557140);}};}function respondWithFilteredResult(_0x3bce10,_0x20f904){return function(_0x397719){if(_0x397719){var _0x48e92a=typeof _0x20f904[_0x72ff('0x1f')]===_0x72ff('0x20')&&typeof _0x20f904[_0x72ff('0x21')]===_0x72ff('0x20');var _0x365c56=_0x397719[_0x72ff('0x22')];var _0x24ae90=_0x48e92a?0x0:_0x20f904[_0x72ff('0x1f')];var _0x3aaf40=_0x48e92a?_0x397719[_0x72ff('0x22')]:_0x20f904[_0x72ff('0x1f')]+_0x20f904[_0x72ff('0x21')];var _0x3f6fab;if(_0x3aaf40>=_0x365c56){_0x3aaf40=_0x365c56;_0x3f6fab=0xc8;}else{_0x3f6fab=0xce;}_0x3bce10[_0x72ff('0x1e')](_0x3f6fab);return _0x3bce10['set']('Content-Range',_0x24ae90+'-'+_0x3aaf40+'/'+_0x365c56)['json'](_0x397719);}return null;};}function saveUpdates(_0x3042f6){return function(_0x25bbc2){if(_0x25bbc2){return _0x25bbc2['update'](_0x3042f6)[_0x72ff('0x15')](function(_0xd918d3){return _0xd918d3;});}return null;};}function removeEntity(_0x261e11){return function(_0xfe2165){if(_0xfe2165){return _0xfe2165['destroy']()[_0x72ff('0x15')](function(){_0x261e11['status'](0xcc)[_0x72ff('0x23')]();});}};}function handleEntityNotFound(_0x4ce6e6){return function(_0x45d073){if(!_0x45d073){_0x4ce6e6['sendStatus'](0x194);}return _0x45d073;};}function handleError(_0x18174f,_0x48af7e){_0x48af7e=_0x48af7e||0x1f4;return function(_0x8264ee){logger[_0x72ff('0x1b')](_0x8264ee[_0x72ff('0x24')]);if(_0x8264ee[_0x72ff('0x25')]){delete _0x8264ee[_0x72ff('0x25')];}_0x18174f[_0x72ff('0x1e')](_0x48af7e)[_0x72ff('0x26')](_0x8264ee);};}function getMustacheRender(_0x158314,_0x53f0b1){return Mustache['render'](_0x158314,_[_0x72ff('0x27')](_0x53f0b1[_0x72ff('0x28')],{'contact':_0x53f0b1[_0x72ff('0x29')],'message':_0x53f0b1[_0x72ff('0x1c')],'agent':_0x53f0b1[_0x72ff('0x2a')],'interaction':_0x53f0b1[_0x72ff('0x2b')],'account':_0x53f0b1[_0x72ff('0x2c')]}))||'';}exports['index']=function(_0x627c9,_0x3a2d25){var _0xa562d5={};var _0x2ce777=_[_0x72ff('0x2d')](db[_0x72ff('0x2e')]['rawAttributes'],function(_0x4161e3){return{'name':_0x4161e3[_0x72ff('0x2f')],'type':_0x4161e3['type'][_0x72ff('0x30')]};});_0xa562d5=qs['getOptions'](_0x2ce777,_0x627c9);return interaction[_0x72ff('0x31')]('chat',_0x627c9[_0x72ff('0x32')],_0x627c9['user'],_0xa562d5,_0x2ce777)[_0x72ff('0x15')](respondWithFilteredResult(_0x3a2d25,_0xa562d5))[_0x72ff('0x1d')](handleError(_0x3a2d25,null));};exports['show']=function(_0x31f4f5,_0x3dbda7){var _0x404a93={'raw':![],'where':{'id':_0x31f4f5[_0x72ff('0x33')]['id']}},_0x70eaee={};_0x70eaee[_0x72ff('0x34')]=_[_0x72ff('0x35')](db[_0x72ff('0x2e')][_0x72ff('0x36')]);_0x70eaee[_0x72ff('0x32')]=_['keys'](_0x31f4f5[_0x72ff('0x32')]);_0x70eaee[_0x72ff('0x37')]=_[_0x72ff('0x38')](_0x70eaee['model'],_0x70eaee[_0x72ff('0x32')]);_0x404a93['attributes']=_[_0x72ff('0x38')](_0x70eaee[_0x72ff('0x34')],qs[_0x72ff('0x39')](_0x31f4f5[_0x72ff('0x32')][_0x72ff('0x39')]));_0x404a93[_0x72ff('0x3a')]=_0x404a93[_0x72ff('0x3a')][_0x72ff('0x3b')]?_0x404a93[_0x72ff('0x3a')]:_0x70eaee['model'];if(_0x31f4f5[_0x72ff('0x32')][_0x72ff('0x3c')]){_0x404a93[_0x72ff('0x3d')]=[{'all':!![]}];}_0x404a93=_[_0x72ff('0x27')]({},_0x404a93,_0x31f4f5[_0x72ff('0x3e')]);return db['ChatInteraction'][_0x72ff('0x3f')](_0x404a93)[_0x72ff('0x15')](handleEntityNotFound(_0x3dbda7,null))[_0x72ff('0x15')](respondWithResult(_0x3dbda7,null))[_0x72ff('0x1d')](handleError(_0x3dbda7,null));};exports[_0x72ff('0x40')]=function(_0x190763,_0x381304){return db[_0x72ff('0x2e')][_0x72ff('0x40')](_0x190763['body'],{})[_0x72ff('0x15')](respondWithResult(_0x381304,0xc9))[_0x72ff('0x1d')](handleError(_0x381304,null));};exports[_0x72ff('0x41')]=function(_0x137e2a,_0x1c0d38){if(_0x137e2a['body']['id']){delete _0x137e2a[_0x72ff('0x28')]['id'];}return db['ChatInteraction'][_0x72ff('0x3f')]({'where':{'id':_0x137e2a[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x1c0d38,null))['then'](saveUpdates(_0x137e2a[_0x72ff('0x28')],null))['then'](respondWithResult(_0x1c0d38,null))[_0x72ff('0x1d')](handleError(_0x1c0d38,null));};exports[_0x72ff('0x42')]=function(_0x31064d,_0x12b10a){return db['ChatInteraction']['find']({'where':{'id':_0x31064d[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x12b10a,null))[_0x72ff('0x15')](removeEntity(_0x12b10a,null))[_0x72ff('0x1d')](handleError(_0x12b10a,null));};exports[_0x72ff('0x43')]=function(_0x3746d9,_0x5c32e3){return db['ChatInteraction']['describe']()[_0x72ff('0x15')](respondWithResult(_0x5c32e3,null))[_0x72ff('0x1d')](handleError(_0x5c32e3,null));};exports[_0x72ff('0x44')]=function(_0x5c100b,_0x4e1da3){var _0x5c2e5c=_0x5c100b['params']['id'];var _0x337a19;var _0x31172c;var _0x59a45e;return db[_0x72ff('0x2e')][_0x72ff('0x45')]({'where':{'id':_0x5c2e5c}})[_0x72ff('0x15')](function(_0x5eb341){_0x337a19=_0x5eb341;return db[_0x72ff('0x46')]['findOne']({'where':{'id':_0x5eb341[_0x72ff('0x47')]},'attributes':['id',_0x72ff('0x48'),_0x72ff('0x49'),_0x72ff('0x4a'),_0x72ff('0x4b'),_0x72ff('0x4c')],'raw':!![]});})[_0x72ff('0x15')](function(_0x57e619){if(_0x57e619&&_0x57e619['vidaooApiKey']&&_0x57e619[_0x72ff('0x49')]){_0x31172c=_0x57e619;var _0x5ab291={'interaction':{'id':_0x5c2e5c},'agent':{'id':_0x5c100b[_0x72ff('0x4d')]['id'],'name':_0x5c100b[_0x72ff('0x4d')][_0x72ff('0x25')],'fullname':_0x5c100b[_0x72ff('0x4d')][_0x72ff('0x4e')],'email':_0x5c100b[_0x72ff('0x4d')]['email']},'contact':_0x5c100b['body'][_0x72ff('0x29')],'account':_0x5c100b[_0x72ff('0x28')][_0x72ff('0x2c')]};var _0x3399a7={'rejectUnauthorized':![],'method':'POST','url':_0x72ff('0x4f'),'headers':{'X-APIKEY':_0x57e619[_0x72ff('0x48')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5c100b['user'][_0x72ff('0x50')]],'buttons':null,'topic':_0x31172c['vidaooTopic'],'note':_[_0x72ff('0x51')](_0x31172c[_0x72ff('0x4b')])?null:getMustacheRender(_0x31172c[_0x72ff('0x4b')],_0x5ab291),'metadata':null},'redirect':_0x72ff('0x52'),'json':!![]};try{if(!_[_0x72ff('0x51')](_0x31172c[_0x72ff('0x4c')])){var _0x2640d5=getMustacheRender(_0x31172c[_0x72ff('0x4c')],_0x5ab291);var _0x58db4c=JSON[_0x72ff('0x53')](_0x2640d5);_0x3399a7[_0x72ff('0x28')]['metadata']=_0x58db4c;}}catch(_0x2753d5){throw new db[(_0x72ff('0x54'))][(_0x72ff('0x55'))](_0x72ff('0x56'));}return rp(_0x3399a7);}else{throw new db['Sequelize']['ValidationError'](_0x72ff('0x57'));}})[_0x72ff('0x15')](function(_0x587f23){_0x59a45e=_0x587f23;if(_0x59a45e['id']){var _0x2924cb={'body':_0x59a45e[_0x72ff('0x58')],'ChatWebsiteId':_0x31172c['id'],'ChatInteractionId':_0x337a19['id'],'direction':_0x72ff('0x59'),'UserId':_0x5c100b[_0x72ff('0x4d')]['id']};return db['ChatMessage'][_0x72ff('0x40')](_0x2924cb,{});}else{throw new db[(_0x72ff('0x54'))][(_0x72ff('0x55'))](_0x72ff('0x5a'));}})[_0x72ff('0x15')](function(){return _0x337a19[_0x72ff('0x5b')]({'vidaooSessionId':_0x59a45e['id']});})['then'](respondWithResult(_0x4e1da3,null))[_0x72ff('0x1d')](handleError(_0x4e1da3,null));};exports[_0x72ff('0x5c')]=function(_0x2c8656,_0x2b83a7){if(_0x2c8656['body']['id']){delete _0x2c8656[_0x72ff('0x28')]['id'];}return db[_0x72ff('0x2e')][_0x72ff('0x3f')]({'where':{'id':_0x2c8656[_0x72ff('0x33')]['id']},'include':[{'model':db[_0x72ff('0x5d')],'as':'Contact'}]})[_0x72ff('0x15')](handleEntityNotFound(_0x2b83a7,null))[_0x72ff('0x15')](saveUpdates(_0x2c8656[_0x72ff('0x28')],null))['then'](respondWithResult(_0x2b83a7,null))[_0x72ff('0x1d')](handleError(_0x2b83a7,null));};exports['abandon']=function(_0x1cf398,_0x783b07){if(_0x1cf398[_0x72ff('0x28')]['id']){delete _0x1cf398[_0x72ff('0x28')]['id'];}return db[_0x72ff('0x2e')]['find']({'where':{'id':_0x1cf398['params']['id']}})[_0x72ff('0x15')](function(_0x3a1a51){if(!_0x3a1a51){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x72ff('0x5e'));_0x783b07['sendStatus'](0x194);}else{if(_0x3a1a51[_0x72ff('0x5f')]){throw new db[(_0x72ff('0x54'))][(_0x72ff('0x55'))]('Interaction\x20already\x20assigned');}}return _0x3a1a51;})['then'](function(_0x3b3e55){if(_0x3b3e55){return _0x3b3e55['update']({'closed':_0x1cf398[_0x72ff('0x28')][_0x72ff('0x60')],'disposition':_0x1cf398[_0x72ff('0x28')]['disposition']})[_0x72ff('0x15')](function(_0x32ccf1){return _0x32ccf1;});}})[_0x72ff('0x15')](function(){return respondWithRpcPromise(_0x72ff('0x61'),_0x72ff('0x62'),_0x1cf398[_0x72ff('0x28')],client9004);})['then'](respondWithResult(_0x783b07,null))[_0x72ff('0x1d')](handleError(_0x783b07,null));};exports[_0x72ff('0x63')]=function(_0x1591f9,_0x45d20f){_0x1591f9[_0x72ff('0x28')]['name']=_0x1591f9[_0x72ff('0x64')][_0x72ff('0x65')];_0x1591f9['body'][_0x72ff('0x66')]=_0x1591f9[_0x72ff('0x64')][_0x72ff('0x67')];_0x1591f9[_0x72ff('0x28')][_0x72ff('0x68')]=_0x1591f9['file'][_0x72ff('0x69')];return db[_0x72ff('0x6a')]['create'](_0x1591f9['body'])[_0x72ff('0x15')](respondWithResult(_0x45d20f,0xc9))[_0x72ff('0x1d')](handleError(_0x45d20f,null));};exports['attachmentDownload']=function(_0x2be2d1,_0x26d1b2){return db[_0x72ff('0x2e')][_0x72ff('0x45')]({'where':{'id':_0x2be2d1['params']['id']},'raw':!![]})[_0x72ff('0x15')](handleEntityNotFound(_0x26d1b2,null))[_0x72ff('0x15')](function(_0x401a45){if(_0x401a45){if(_0x401a45[_0x72ff('0x60')]){return _0x26d1b2[_0x72ff('0x1e')](0x193)[_0x72ff('0x6b')]({'status':0x193,'message':_0x72ff('0x6c')});}return db['Attachment'][_0x72ff('0x45')]({'where':{'id':_0x2be2d1[_0x72ff('0x32')]['attachId']},'raw':!![]})[_0x72ff('0x15')](handleEntityNotFound(_0x26d1b2,null));}})[_0x72ff('0x15')](function(_0x2a6441){if(_0x2a6441){var _0x553bcc=_0x2a6441[_0x72ff('0x6d')]!==null;var _0x486c8f=path['join'](config[_0x72ff('0x6e')],_0x72ff('0x6f'));if(_0x553bcc){_0x486c8f=path[_0x72ff('0x70')](_0x486c8f,'offline-chat/');}var _0xff5021=path[_0x72ff('0x70')](_0x486c8f,_0x2a6441['basename']);return _0x26d1b2[_0x72ff('0x71')](_0xff5021);}})['catch'](handleError(_0x26d1b2,null));};exports[_0x72ff('0x72')]=function(_0x595bae,_0x21c1ad){var _0x3e26a1=null;var _0x4648d1=null;var _0x2a5e6b=null;if(_0x595bae[_0x72ff('0x28')]['id']){delete _0x595bae[_0x72ff('0x28')]['id'];}if(_0x595bae['body'][_0x72ff('0x73')]){_0x2a5e6b=path[_0x72ff('0x70')](config[_0x72ff('0x6e')],_0x72ff('0x74'),util[_0x72ff('0x75')](_0x72ff('0x76'),Date[_0x72ff('0x77')]()));_0x595bae[_0x72ff('0x28')]['pathTranscript']=_0x2a5e6b;}return db[_0x72ff('0x2e')][_0x72ff('0x3f')]({'where':{'id':_0x595bae[_0x72ff('0x33')]['id']},'include':[{'model':db[_0x72ff('0x78')],'as':_0x72ff('0x79'),'include':[{'model':db[_0x72ff('0x7a')],'as':_0x72ff('0x7a')}]}]})['then'](handleEntityNotFound(_0x21c1ad,null))[_0x72ff('0x15')](saveUpdates(_0x595bae[_0x72ff('0x28')],null))[_0x72ff('0x15')](function(_0xf004fc){if(_0xf004fc){_0x3e26a1=_0xf004fc;return db[_0x72ff('0x46')][_0x72ff('0x3f')]({'where':{'id':_0x3e26a1[_0x72ff('0x47')]}});}})['then'](function(_0x542711){if(_0x542711){_0x4648d1=_0x542711;return db[_0x72ff('0x5d')][_0x72ff('0x3f')]({'where':{'id':_0x3e26a1[_0x72ff('0x7b')]}});}})[_0x72ff('0x15')](function(_0xeaf379){if(_0xeaf379){if(_0x2a5e6b){var _0x369cfb=null;for(var _0x48e0dc=0x1;_0x48e0dc<_0x3e26a1[_0x72ff('0x79')]['length'];++_0x48e0dc){_0x369cfb=_0x3e26a1[_0x72ff('0x79')][_0x48e0dc];var _0xe11c4b=_0x369cfb['UserId']?util[_0x72ff('0x75')](_0x72ff('0x7c'),_0x4648d1['agentAlias'],_0x369cfb['UserId']):_0x72ff('0x7d');var _0x4a36f8=_0x595bae[_0x72ff('0x28')][_0x72ff('0x7e')]||util[_0x72ff('0x75')](_0x72ff('0x7c'),'Visitor',_0x369cfb[_0x72ff('0x7b')]);switch(_0x4648d1[_0x72ff('0x7f')]){case'website_alias':_0xe11c4b=_0x369cfb[_0x72ff('0x5f')]?util[_0x72ff('0x75')]('%s%d',_0x4648d1['agentAlias'],_0x369cfb[_0x72ff('0x5f')]):_0x72ff('0x7d');break;case _0x72ff('0x80'):_0xe11c4b=_0x369cfb[_0x72ff('0x5f')]?_0x369cfb['User'][_0x72ff('0x81')]||_0x369cfb[_0x72ff('0x7a')][_0x72ff('0x4e')]:_0x72ff('0x7d');break;case _0x72ff('0x82'):_0xe11c4b=_0x369cfb[_0x72ff('0x5f')]?_0x369cfb[_0x72ff('0x7a')][_0x72ff('0x4e')]:_0x72ff('0x7d');break;default:_0xe11c4b=_0x369cfb[_0x72ff('0x5f')]?util[_0x72ff('0x75')]('%s%d',_0x4648d1[_0x72ff('0x83')],_0x369cfb[_0x72ff('0x5f')]):_0x72ff('0x7d');}var _0x20ac21=util[_0x72ff('0x75')](_0x72ff('0x84'),moment(_0x369cfb[_0x72ff('0x85')])[_0x72ff('0x75')](_0x72ff('0x86')),_0x369cfb[_0x72ff('0x87')]==='in'?_0x4a36f8:_0xe11c4b,_0x369cfb['body']);if(!_0x369cfb[_0x72ff('0x88')]){fs[_0x72ff('0x89')](_0x2a5e6b,_0x20ac21);}}return db[_0x72ff('0x8a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x72ff('0x8b')],'as':_0x72ff('0x8c'),'raw':!![],'include':[{'model':db[_0x72ff('0x8d')],'as':_0x72ff('0x8d'),'raw':!![]}]}]});}}})[_0x72ff('0x15')](function(_0x348ca2){if(!_0x348ca2||!_0x348ca2[_0x72ff('0x8c')]||!_0x595bae[_0x72ff('0x28')])return _0x3e26a1;var _0xb5a900=_0x348ca2['getSmtpOptions']();return respondWithRpcPromise(_0x72ff('0x8e'),_0x72ff('0x8f'),{'account':_0xb5a900,'message':{'from':util[_0x72ff('0x75')](_0x72ff('0x90'),_0x348ca2[_0x72ff('0x25')],_0x348ca2[_0x72ff('0x50')]||_0x348ca2[_0x72ff('0x8c')][_0x72ff('0x4d')]),'to':_0x595bae['body'][_0x72ff('0x73')],'subject':'Mail\x20Transcript','text':util[_0x72ff('0x75')](_0x72ff('0x91'),_0x595bae['body'][_0x72ff('0x73')]),'attachments':[{'path':_0x2a5e6b}]}})[_0x72ff('0x15')](function(){return _0x3e26a1;})[_0x72ff('0x1d')](function(_0x141054){logger['error'](_0x141054);});})[_0x72ff('0x15')](respondWithStatusCode(_0x21c1ad,0xc8))[_0x72ff('0x1d')](handleError(_0x21c1ad,null));};exports['addMessage']=function(_0x2ddc11,_0x30063b){return db['ChatMessage'][_0x72ff('0x3f')]({'where':{'id':_0x2ddc11[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x30063b,null))[_0x72ff('0x15')](function(_0x42a6f6){if(_0x42a6f6){return _0x42a6f6[_0x72ff('0x92')](_0x2ddc11[_0x72ff('0x28')][_0x72ff('0x93')],_[_0x72ff('0x94')](_0x2ddc11[_0x72ff('0x28')],[_0x72ff('0x93'),'id'])||{});}})['then'](respondWithResult(_0x30063b,null))[_0x72ff('0x1d')](handleError(_0x30063b,null));};exports[_0x72ff('0x95')]=function(_0x1e3b98,_0x46eec9){var _0x10eb80={'raw':![],'where':{}};var _0x4b0462={};var _0x4c240b={'count':0x0,'rows':[]};return db[_0x72ff('0x2e')]['findOne']({'where':{'id':_0x1e3b98[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x46eec9,null))['then'](function(_0x131e77){if(_0x131e77){_0x4b0462[_0x72ff('0x34')]=_[_0x72ff('0x35')](db[_0x72ff('0x78')][_0x72ff('0x36')]);_0x4b0462[_0x72ff('0x32')]=_[_0x72ff('0x35')](_0x1e3b98[_0x72ff('0x32')]);_0x4b0462[_0x72ff('0x37')]=_['intersection'](_0x4b0462[_0x72ff('0x34')],_0x4b0462[_0x72ff('0x32')]);_0x10eb80[_0x72ff('0x3a')]=_[_0x72ff('0x38')](_0x4b0462['model'],qs[_0x72ff('0x39')](_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x39')]));_0x10eb80['attributes']=_0x10eb80[_0x72ff('0x3a')][_0x72ff('0x3b')]?_0x10eb80[_0x72ff('0x3a')]:_0x4b0462[_0x72ff('0x34')];if(!_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x96')](_0x72ff('0x97'))){_0x10eb80['limit']=qs[_0x72ff('0x21')](_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x21')]);_0x10eb80[_0x72ff('0x1f')]=qs['offset'](_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x1f')]);}_0x10eb80[_0x72ff('0x98')]=qs[_0x72ff('0x99')](_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x99')]);_0x10eb80[_0x72ff('0x9a')]=qs['filters'](_[_0x72ff('0x9b')](_0x1e3b98[_0x72ff('0x32')],_0x4b0462[_0x72ff('0x37')]));_0x10eb80[_0x72ff('0x9a')][_0x72ff('0x9c')]=_0x131e77['id'];if(_0x1e3b98['query'][_0x72ff('0x9d')]){_0x10eb80[_0x72ff('0x9a')]=_[_0x72ff('0x27')](_0x10eb80[_0x72ff('0x9a')],{'$or':_[_0x72ff('0x2d')](_0x10eb80[_0x72ff('0x3a')],function(_0x107441){var _0x4654f6={};_0x4654f6[_0x107441]={'$like':'%'+_0x1e3b98[_0x72ff('0x32')]['filter']+'%'};return _0x4654f6;})});}if(_0x1e3b98[_0x72ff('0x32')]['$gte']){var _0x2102af=_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x9e')]['split'](',');var _0x298a6b={};_0x298a6b[_0x2102af[0x0]]={'$gte':moment(_0x2102af[0x1])['format'](_0x72ff('0x9f'))};_0x10eb80[_0x72ff('0x9a')]=_[_0x72ff('0x27')](_0x10eb80[_0x72ff('0x9a')],_0x298a6b);}_0x10eb80=_[_0x72ff('0x27')]({},_0x10eb80,_0x1e3b98[_0x72ff('0x3e')]);return db[_0x72ff('0x78')][_0x72ff('0x22')]({'where':_0x10eb80[_0x72ff('0x9a')]})[_0x72ff('0x15')](function(_0x144aab){_0x4c240b[_0x72ff('0x22')]=_0x144aab;if(_0x1e3b98[_0x72ff('0x32')][_0x72ff('0x3c')]){_0x10eb80[_0x72ff('0x3d')]=[{'all':!![]}];}return db['ChatMessage'][_0x72ff('0x31')](_0x10eb80);})[_0x72ff('0x15')](function(_0x4ddab4){_0x4c240b['rows']=_0x4ddab4;return _0x4c240b;});}})[_0x72ff('0x15')](respondWithFilteredResult(_0x46eec9,_0x10eb80))['catch'](handleError(_0x46eec9,null));};exports[_0x72ff('0xa0')]=function(_0x3094f6,_0x3d090f){var _0x4c7b20={'where':{}},_0xc0ead5={},_0x26d55b={'count':0x0,'rows':[]};return db[_0x72ff('0x2e')][_0x72ff('0x45')]({'where':{'id':_0x3094f6[_0x72ff('0x33')]['id']}})['then'](handleEntityNotFound(_0x3d090f,null))['then'](function(_0x5b8b88){if(_0x5b8b88){_0xc0ead5['model']=_[_0x72ff('0x35')](db[_0x72ff('0x78')][_0x72ff('0x36')]);_0xc0ead5['query']=_['keys'](_0x3094f6['query']);_0xc0ead5[_0x72ff('0x37')]=_[_0x72ff('0x38')](_0xc0ead5[_0x72ff('0x34')],_0xc0ead5[_0x72ff('0x32')]);_0x4c7b20[_0x72ff('0x3a')]=_[_0x72ff('0x38')](_0xc0ead5[_0x72ff('0x34')],qs[_0x72ff('0x39')](_0x3094f6[_0x72ff('0x32')][_0x72ff('0x39')]));_0x4c7b20['attributes']=_0x4c7b20['attributes'][_0x72ff('0x3b')]?_0x4c7b20[_0x72ff('0x3a')]:_0xc0ead5[_0x72ff('0x34')];if(!_0x3094f6[_0x72ff('0x32')][_0x72ff('0x96')](_0x72ff('0x97'))){_0x4c7b20[_0x72ff('0x21')]=qs[_0x72ff('0x21')](_0x3094f6[_0x72ff('0x32')][_0x72ff('0x21')]);_0x4c7b20['offset']=qs[_0x72ff('0x1f')](_0x3094f6[_0x72ff('0x32')][_0x72ff('0x1f')]);}_0x4c7b20[_0x72ff('0x98')]=qs[_0x72ff('0x99')](_0x3094f6[_0x72ff('0x32')][_0x72ff('0x99')]);_0x4c7b20[_0x72ff('0x9a')]=qs['filters'](_['pick'](_0x3094f6[_0x72ff('0x32')],_0xc0ead5[_0x72ff('0x37')]));_0x4c7b20[_0x72ff('0x9a')]['ChatInteractionId']=_0x5b8b88['id'];if(_0x3094f6['query'][_0x72ff('0x9d')]){_0x4c7b20[_0x72ff('0x9a')]=_[_0x72ff('0x27')](_0x4c7b20[_0x72ff('0x9a')],{'$or':_[_0x72ff('0x2d')](_0x4c7b20[_0x72ff('0x3a')],function(_0xf825ff){var _0x9acbf0={};_0x9acbf0[_0xf825ff]={'$like':'%'+_0x3094f6[_0x72ff('0x32')][_0x72ff('0x9d')]+'%'};return _0x9acbf0;})});}_0x4c7b20['where'][_0x72ff('0x88')]=![];if(_0x3094f6['query']['id']){_0x4c7b20['where']['id']={'$gt':_0x3094f6[_0x72ff('0x32')]['id']};}_0x4c7b20=_['merge']({},_0x4c7b20,_0x3094f6[_0x72ff('0x3e')]);return db['ChatMessage']['count']({'where':_0x4c7b20[_0x72ff('0x9a')]})[_0x72ff('0x15')](function(_0x165729){_0x26d55b[_0x72ff('0x22')]=_0x165729;_0x4c7b20[_0x72ff('0x3d')]=[];if(_0x3094f6[_0x72ff('0x32')][_0x72ff('0xa1')]){_0x4c7b20[_0x72ff('0x3d')][_0x72ff('0xa2')]({'model':db[_0x72ff('0x7a')],'as':'User','attributes':['id',_0x72ff('0x4e'),_0x72ff('0x81')]});}if(_0x3094f6[_0x72ff('0x32')]['includeAll']){_0x4c7b20[_0x72ff('0x3d')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4c7b20);})[_0x72ff('0x15')](function(_0x3c0c66){_0x26d55b[_0x72ff('0xa3')]=_0x3c0c66;return _0x26d55b;});}})[_0x72ff('0x15')](respondWithFilteredResult(_0x3d090f,_0x4c7b20))[_0x72ff('0x1d')](handleError(_0x3d090f,null));};exports[_0x72ff('0xa4')]=function(_0x36c8bc,_0x2a1622){return db[_0x72ff('0x2e')]['find']({'where':{'id':_0x36c8bc['params']['id']}})['then'](handleEntityNotFound(_0x2a1622,null))[_0x72ff('0x15')](function(_0x18e597){if(_0x18e597){return _0x18e597[_0x72ff('0xa5')](_0x36c8bc['body'][_0x72ff('0x93')],_[_0x72ff('0x94')](_0x36c8bc['body'],['ids','id'])||{})[_0x72ff('0xa6')](function(){return db['Tag'][_0x72ff('0x31')]({'attributes':['id',_0x72ff('0x25'),_0x72ff('0xa7')],'where':{'id':_0x36c8bc[_0x72ff('0x28')][_0x72ff('0x93')]}});})[_0x72ff('0x15')](function(_0x1401c5){socket[_0x72ff('0xa8')](_0x72ff('0xa9'),{'id':Number(_0x36c8bc['params']['id']),'tags':_0x1401c5||[]});return{'id':Number(_0x36c8bc[_0x72ff('0x33')]['id']),'tags':_0x1401c5||[]};});}})[_0x72ff('0x15')](respondWithResult(_0x2a1622,null))[_0x72ff('0x1d')](handleError(_0x2a1622,null));};exports[_0x72ff('0xaa')]=function(_0x57bc6c,_0x2b8cf7){return db[_0x72ff('0x2e')][_0x72ff('0x3f')]({'where':{'id':_0x57bc6c[_0x72ff('0x33')]['id']}})[_0x72ff('0x15')](handleEntityNotFound(_0x2b8cf7,null))[_0x72ff('0x15')](function(_0x46553b){if(_0x46553b){return _0x46553b[_0x72ff('0xaa')](_0x57bc6c[_0x72ff('0x32')][_0x72ff('0x93')]);}})[_0x72ff('0x15')](respondWithStatusCode(_0x2b8cf7,null))[_0x72ff('0x1d')](handleError(_0x2b8cf7,null));};exports[_0x72ff('0x71')]=function(_0x7f9c20,_0x4f1023){var _0x407aba=moment()[_0x72ff('0xab')]()[_0x72ff('0xac')]();var _0x1cc839=path[_0x72ff('0x70')](config['root'],'server',_0x72ff('0xad'),_0x72ff('0xae'));var _0x56f288=path['join'](config[_0x72ff('0x6e')],'server',_0x72ff('0xad'),_0x72ff('0xaf'));var _0x2e7de0=path[_0x72ff('0x70')](_0x1cc839,_0x407aba);var _0x327da5=util[_0x72ff('0x75')](_0x72ff('0xb0'),_0x7f9c20[_0x72ff('0x33')]['id'],_0x407aba);var _0x3dce98=path['join'](_0x1cc839,_0x327da5);var _0x7c008a=[];_0x7c008a[_0x72ff('0xa2')]({'model':db[_0x72ff('0x7a')],'as':_0x72ff('0x7a'),'attributes':['id',_0x72ff('0x4e')],'raw':!![]});_0x7c008a[_0x72ff('0xa2')]({'model':db[_0x72ff('0x5d')],'as':_0x72ff('0xb1'),'attributes':['id','firstName',_0x72ff('0xb2')],'raw':!![]});if(_0x7f9c20[_0x72ff('0x32')][_0x72ff('0xaf')]){_0x7c008a[_0x72ff('0xa2')]({'model':db[_0x72ff('0x6a')],'as':'Attachment','raw':!![]});}var _0x11637b=[{'model':db[_0x72ff('0x78')],'as':_0x72ff('0x79'),'attributes':['id',_0x72ff('0x28'),_0x72ff('0x85'),_0x72ff('0x87'),_0x72ff('0x88'),_0x72ff('0xb3')],'include':_0x7c008a}];_0x11637b[_0x72ff('0xa2')]({'model':db[_0x72ff('0x46')],'as':'Account','attributes':['id',_0x72ff('0x25')]});_0x11637b[_0x72ff('0xa2')]({'model':db[_0x72ff('0x7a')],'as':_0x72ff('0xb4'),'attributes':['id',_0x72ff('0x4e')]});return db[_0x72ff('0x2e')][_0x72ff('0x3f')]({'where':{'id':_0x7f9c20['params']['id']},'include':_0x11637b})[_0x72ff('0x15')](handleEntityNotFound(_0x4f1023,null))[_0x72ff('0x15')](function(_0x50839d){if(_0x50839d){var _0x496de9=_0x50839d['get']({'plain':!![]});fs[_0x72ff('0xb5')](_0x2e7de0);var _0x4d9dc5={'channel':_0x72ff('0xb6'),'account':_0x496de9[_0x72ff('0xb7')]['name'],'agent':_0x496de9[_0x72ff('0xb4')]?_0x496de9['Owner'][_0x72ff('0x4e')]:_0x72ff('0xb8'),'createdAt':moment(_0x496de9[_0x72ff('0x85')])[_0x72ff('0x75')](_0x72ff('0x9f'))[_0x72ff('0xac')](),'closedAt':_0x496de9['closed']?moment(_0x496de9[_0x72ff('0xb9')])[_0x72ff('0x75')](_0x72ff('0x9f'))['toString']():'','disposition':_0x496de9[_0x72ff('0xba')],'chatInfo':{'browser':_0x496de9[_0x72ff('0xbb')],'os':_0x496de9[_0x72ff('0xbc')],'referer':_0x496de9['referer'],'customerIp':_0x496de9['customerIp'],'customerPort':_0x496de9[_0x72ff('0xbd')]?_0x496de9['customerPort']:_0x72ff('0xb8')},'messages':_(_0x496de9[_0x72ff('0x79')])[_0x72ff('0xbe')]()[_0x72ff('0x9d')]({'secret':![]})[_0x72ff('0x2d')](function(_0x332536){if(_0x332536['Attachment']){var _0x21f119=path[_0x72ff('0x70')](_0x56f288,_0x332536[_0x72ff('0x6a')][_0x72ff('0x66')]);if(fs[_0x72ff('0xbf')](_0x21f119)){fs['createReadStream'](_0x21f119)[_0x72ff('0xc0')](fs[_0x72ff('0xc1')](path['join'](_0x2e7de0,_0x332536['Attachment']['basename'])));}}return{'date':moment(_0x332536[_0x72ff('0x85')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x72ff('0xac')](),'sender':_0x332536[_0x72ff('0x87')]==='out'?_0x332536['User']?_0x332536['User'][_0x72ff('0x4e')]:_0x72ff('0x7d'):_0x332536[_0x72ff('0xb1')][_0x72ff('0xc2')]+(_0x332536[_0x72ff('0xb1')][_0x72ff('0xb2')]?'\x20'+_0x332536[_0x72ff('0xb1')]['lastName']:''),'body':_0x332536[_0x72ff('0x6a')]?_0x332536[_0x72ff('0x6a')][_0x72ff('0x66')]:_0x332536['body'],'direction':_0x332536[_0x72ff('0x87')]===_0x72ff('0x59')?'A':'C','secret':_0x332536[_0x72ff('0x88')],'read':_0x332536['read'],'attachment':_0x332536[_0x72ff('0x6a')]};})[_0x72ff('0xc3')]()};return ejs['renderFile'](path[_0x72ff('0x70')](config[_0x72ff('0x6e')],_0x72ff('0xc4'),_0x72ff('0xc5'),_0x72ff('0xc6')),{'interaction':_0x4d9dc5})[_0x72ff('0x15')](function(_0x2dea60){var _0x59d73a=path[_0x72ff('0x70')](_0x2e7de0,_0x72ff('0xc7')+_0x496de9['id']+'-'+_0x407aba+'.pdf');var _0x1fdd33={'path':_0x59d73a,'channel':'Chat','interactionId':_0x496de9['id']};return pdf[_0x72ff('0xc8')](_0x2dea60,_0x1fdd33);})[_0x72ff('0x15')](function(){return new Promise(function(_0x2f274,_0x195dcd){zipdir(_0x2e7de0,{'saveTo':_0x3dce98},function(_0x479ad1,_0x206576){if(_0x479ad1)return _0x195dcd(_0x479ad1);return _0x2f274(_0x206576);});})[_0x72ff('0x15')](function(){return new BPromise(function(_0x2eef6f,_0x55933d){rimraf(_0x2e7de0,function(_0x17a701){if(_0x17a701)_0x55933d(_0x17a701);return _0x2eef6f();});});})[_0x72ff('0x15')](function(){return _0x4f1023['download'](_0x3dce98,_0x327da5,function(_0x344220){if(_0x344220){logger[_0x72ff('0x1b')](_0x72ff('0xc9'),_0x344220);}else{fs['unlinkSync'](_0x3dce98);}});});});}else{return _0x4f1023[_0x72ff('0xca')](0xc8);}})[_0x72ff('0x1d')](handleError(_0x4f1023,null));}; \ No newline at end of file +var _0x825c=['merge','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','getMyMessages','secret','push','rows','addTags','spread','Tag','findAll','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','Contact','firstName','lastName','direction','read','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','toString','disposition','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../config/logger','../../mysqldb','defaults','redis','localhost','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','json','destroy','name','send','render','body','contact','agent','account','map','ChatInteraction','rawAttributes','fieldName','getOptions','chat','query','user','params','keys','filters','intersection','model','attributes','fields','length','options','create','update','find','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooMetadata','metadata','ValidationError','Sequelize','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','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','type','mimetype','attachmentDownload','Attachment','attachId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','root','format','transcript-%s.txt','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','UserId','System','customer','agentIdentifier','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','order','sort','ChatInteractionId'];(function(_0x9c6e38,_0x1fc24e){var _0x148e08=function(_0x415b66){while(--_0x415b66){_0x9c6e38['push'](_0x9c6e38['shift']());}};_0x148e08(++_0x1fc24e);}(_0x825c,0x1cb));var _0xc825=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x825c[_0x307d86];return _0x361745;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc825('0x0'));var rp=require(_0xc825('0x1'));var moment=require(_0xc825('0x2'));var BPromise=require(_0xc825('0x3'));var Mustache=require(_0xc825('0x4'));var util=require(_0xc825('0x5'));var path=require(_0xc825('0x6'));var ejs=require(_0xc825('0x7'));var fs=require('fs');var _=require(_0xc825('0x8'));var Redis=require(_0xc825('0x9'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xc825('0xa'))('api');var config=require('../../config/environment');var db=require(_0xc825('0xb'))['db'];config['redis']=_[_0xc825('0xc')](config[_0xc825('0xd')],{'host':_0xc825('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc825('0xd')]));require(_0xc825('0xf'))[_0xc825('0x10')](socket);var jayson=require(_0xc825('0x11'));var client=jayson['client'][_0xc825('0x12')]({'port':0x232b});var client9004=jayson[_0xc825('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4d4795,_0x241fd3,_0x46c884,_0x188ce2){return new BPromise(function(_0x5c5a02,_0x1626c6){var _0x266cbe=_0x188ce2||client;return _0x266cbe[_0xc825('0x14')](_0x4d4795,_0x46c884)[_0xc825('0x15')](function(_0x5b7ac8){logger[_0xc825('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x241fd3,'request\x20sent');logger[_0xc825('0x17')](_0xc825('0x18'),_0x241fd3,_0xc825('0x19'),JSON[_0xc825('0x1a')](_0x5b7ac8));if(_0x5b7ac8[_0xc825('0x1b')]){if(_0x5b7ac8[_0xc825('0x1b')]['code']===0x1f4){logger[_0xc825('0x1b')](_0xc825('0x1c'),_0x241fd3,_0x5b7ac8[_0xc825('0x1b')][_0xc825('0x1d')]);return _0x1626c6(_0x5b7ac8['error'][_0xc825('0x1d')]);}logger[_0xc825('0x1b')](_0xc825('0x1c'),_0x241fd3,_0x5b7ac8[_0xc825('0x1b')][_0xc825('0x1d')]);return _0x5c5a02(_0x5b7ac8[_0xc825('0x1b')][_0xc825('0x1d')]);}else{logger[_0xc825('0x16')](_0xc825('0x1c'),_0x241fd3,_0xc825('0x19'));_0x5c5a02(_0x5b7ac8['result'][_0xc825('0x1d')]);}})[_0xc825('0x1e')](function(_0x53528d){logger['error'](_0xc825('0x1c'),_0x241fd3,_0x53528d);_0x1626c6(_0x53528d);});});}function respondWithStatusCode(_0x3c7e6f,_0x26e09f){_0x26e09f=_0x26e09f||0xcc;return function(_0x197598){if(_0x197598){return _0x3c7e6f[_0xc825('0x1f')](_0x26e09f);}return _0x3c7e6f['status'](_0x26e09f)[_0xc825('0x20')]();};}function respondWithResult(_0x4147a3,_0x2466c6){_0x2466c6=_0x2466c6||0xc8;return function(_0x26c88b){if(_0x26c88b){return _0x4147a3[_0xc825('0x21')](_0x2466c6)['json'](_0x26c88b);}};}function respondWithFilteredResult(_0x79c632,_0x32330e){return function(_0x12d206){if(_0x12d206){var _0x12d538=typeof _0x32330e[_0xc825('0x22')]===_0xc825('0x23')&&typeof _0x32330e[_0xc825('0x24')]===_0xc825('0x23');var _0x150919=_0x12d206[_0xc825('0x25')];var _0xcaaec5=_0x12d538?0x0:_0x32330e['offset'];var _0x799a87=_0x12d538?_0x12d206['count']:_0x32330e[_0xc825('0x22')]+_0x32330e[_0xc825('0x24')];var _0x27a73e;if(_0x799a87>=_0x150919){_0x799a87=_0x150919;_0x27a73e=0xc8;}else{_0x27a73e=0xce;}_0x79c632[_0xc825('0x21')](_0x27a73e);return _0x79c632[_0xc825('0x26')]('Content-Range',_0xcaaec5+'-'+_0x799a87+'/'+_0x150919)[_0xc825('0x27')](_0x12d206);}return null;};}function saveUpdates(_0xd36abd){return function(_0x57c3f0){if(_0x57c3f0){return _0x57c3f0['update'](_0xd36abd)[_0xc825('0x15')](function(_0x205305){return _0x205305;});}return null;};}function removeEntity(_0x3e63dc){return function(_0x392db4){if(_0x392db4){return _0x392db4[_0xc825('0x28')]()[_0xc825('0x15')](function(){_0x3e63dc['status'](0xcc)[_0xc825('0x20')]();});}};}function handleEntityNotFound(_0x3a7ed5){return function(_0x585337){if(!_0x585337){_0x3a7ed5[_0xc825('0x1f')](0x194);}return _0x585337;};}function handleError(_0x3acab7,_0x2dc6cf){_0x2dc6cf=_0x2dc6cf||0x1f4;return function(_0x403ad0){logger['error'](_0x403ad0['stack']);if(_0x403ad0[_0xc825('0x29')]){delete _0x403ad0[_0xc825('0x29')];}_0x3acab7['status'](_0x2dc6cf)[_0xc825('0x2a')](_0x403ad0);};}function getMustacheRender(_0x1b2660,_0x44135e){return Mustache[_0xc825('0x2b')](_0x1b2660,_['merge'](_0x44135e[_0xc825('0x2c')],{'contact':_0x44135e[_0xc825('0x2d')],'message':_0x44135e[_0xc825('0x1d')],'agent':_0x44135e[_0xc825('0x2e')],'interaction':_0x44135e['interaction'],'account':_0x44135e[_0xc825('0x2f')]}))||'';}exports['index']=function(_0x30db7e,_0x1b3563){var _0x2d3f65={};var _0x40834d=_[_0xc825('0x30')](db[_0xc825('0x31')][_0xc825('0x32')],function(_0x1de89d){return{'name':_0x1de89d[_0xc825('0x33')],'type':_0x1de89d['type']['key']};});_0x2d3f65=qs[_0xc825('0x34')](_0x40834d,_0x30db7e);return interaction['findAll'](_0xc825('0x35'),_0x30db7e[_0xc825('0x36')],_0x30db7e[_0xc825('0x37')],_0x2d3f65,_0x40834d)[_0xc825('0x15')](respondWithFilteredResult(_0x1b3563,_0x2d3f65))['catch'](handleError(_0x1b3563,null));};exports['show']=function(_0x17ad46,_0xe942f9){var _0x25d013={'raw':![],'where':{'id':_0x17ad46[_0xc825('0x38')]['id']}},_0x1cca8a={};_0x1cca8a['model']=_[_0xc825('0x39')](db[_0xc825('0x31')][_0xc825('0x32')]);_0x1cca8a['query']=_[_0xc825('0x39')](_0x17ad46[_0xc825('0x36')]);_0x1cca8a[_0xc825('0x3a')]=_[_0xc825('0x3b')](_0x1cca8a[_0xc825('0x3c')],_0x1cca8a[_0xc825('0x36')]);_0x25d013[_0xc825('0x3d')]=_[_0xc825('0x3b')](_0x1cca8a[_0xc825('0x3c')],qs[_0xc825('0x3e')](_0x17ad46['query'][_0xc825('0x3e')]));_0x25d013[_0xc825('0x3d')]=_0x25d013['attributes'][_0xc825('0x3f')]?_0x25d013['attributes']:_0x1cca8a['model'];if(_0x17ad46[_0xc825('0x36')]['includeAll']){_0x25d013['include']=[{'all':!![]}];}_0x25d013=_['merge']({},_0x25d013,_0x17ad46[_0xc825('0x40')]);return db['ChatInteraction']['find'](_0x25d013)[_0xc825('0x15')](handleEntityNotFound(_0xe942f9,null))[_0xc825('0x15')](respondWithResult(_0xe942f9,null))[_0xc825('0x1e')](handleError(_0xe942f9,null));};exports[_0xc825('0x41')]=function(_0x2c15e2,_0x1e5193){return db[_0xc825('0x31')][_0xc825('0x41')](_0x2c15e2[_0xc825('0x2c')],{})[_0xc825('0x15')](respondWithResult(_0x1e5193,0xc9))[_0xc825('0x1e')](handleError(_0x1e5193,null));};exports[_0xc825('0x42')]=function(_0x4be5de,_0x5acd78){if(_0x4be5de[_0xc825('0x2c')]['id']){delete _0x4be5de[_0xc825('0x2c')]['id'];}return db[_0xc825('0x31')][_0xc825('0x43')]({'where':{'id':_0x4be5de['params']['id']}})[_0xc825('0x15')](handleEntityNotFound(_0x5acd78,null))['then'](saveUpdates(_0x4be5de['body'],null))['then'](respondWithResult(_0x5acd78,null))[_0xc825('0x1e')](handleError(_0x5acd78,null));};exports[_0xc825('0x28')]=function(_0x1e2bed,_0x5b6d54){return db[_0xc825('0x31')][_0xc825('0x43')]({'where':{'id':_0x1e2bed[_0xc825('0x38')]['id']}})[_0xc825('0x15')](handleEntityNotFound(_0x5b6d54,null))[_0xc825('0x15')](removeEntity(_0x5b6d54,null))[_0xc825('0x1e')](handleError(_0x5b6d54,null));};exports[_0xc825('0x44')]=function(_0x3d955d,_0x4b5bcf){return db[_0xc825('0x31')][_0xc825('0x44')]()[_0xc825('0x15')](respondWithResult(_0x4b5bcf,null))[_0xc825('0x1e')](handleError(_0x4b5bcf,null));};exports[_0xc825('0x45')]=function(_0xc05397,_0x46412e){var _0x501be2=_0xc05397[_0xc825('0x38')]['id'];var _0x527f1f;var _0x109451;var _0x49110b;return db[_0xc825('0x31')]['findOne']({'where':{'id':_0x501be2}})['then'](function(_0x1c29ed){_0x527f1f=_0x1c29ed;return db[_0xc825('0x46')][_0xc825('0x47')]({'where':{'id':_0x1c29ed[_0xc825('0x48')]},'attributes':['id',_0xc825('0x49'),_0xc825('0x4a'),'vidaooTopic',_0xc825('0x4b'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x248fe0){if(_0x248fe0&&_0x248fe0['vidaooApiKey']&&_0x248fe0[_0xc825('0x4a')]){_0x109451=_0x248fe0;var _0x19a552={'interaction':{'id':_0x501be2},'agent':{'id':_0xc05397[_0xc825('0x37')]['id'],'name':_0xc05397[_0xc825('0x37')][_0xc825('0x29')],'fullname':_0xc05397[_0xc825('0x37')]['fullname'],'email':_0xc05397[_0xc825('0x37')][_0xc825('0x4c')]},'contact':_0xc05397[_0xc825('0x2c')][_0xc825('0x2d')],'account':_0xc05397[_0xc825('0x2c')][_0xc825('0x2f')]};var _0x4cfd0e={'rejectUnauthorized':![],'method':_0xc825('0x4d'),'url':_0xc825('0x4e'),'headers':{'X-APIKEY':_0x248fe0[_0xc825('0x49')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xc05397['user'][_0xc825('0x4c')]],'buttons':null,'topic':_0x109451[_0xc825('0x4f')],'note':_[_0xc825('0x50')](_0x109451[_0xc825('0x4b')])?null:getMustacheRender(_0x109451[_0xc825('0x4b')],_0x19a552),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xc825('0x50')](_0x109451[_0xc825('0x51')])){var _0xe38a47=getMustacheRender(_0x109451[_0xc825('0x51')],_0x19a552);var _0xb6dfe0=JSON['parse'](_0xe38a47);_0x4cfd0e['body'][_0xc825('0x52')]=_0xb6dfe0;}}catch(_0x3cc4fd){throw new db['Sequelize'][(_0xc825('0x53'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x4cfd0e);}else{throw new db[(_0xc825('0x54'))]['ValidationError'](_0xc825('0x55'));}})[_0xc825('0x15')](function(_0x274bbe){_0x49110b=_0x274bbe;if(_0x49110b['id']){var _0x55f378={'body':_0x49110b[_0xc825('0x56')],'ChatWebsiteId':_0x109451['id'],'ChatInteractionId':_0x527f1f['id'],'direction':_0xc825('0x57'),'UserId':_0xc05397[_0xc825('0x37')]['id']};return db[_0xc825('0x58')]['create'](_0x55f378,{});}else{throw new db['Sequelize'][(_0xc825('0x53'))](_0xc825('0x59'));}})[_0xc825('0x15')](function(){return _0x527f1f[_0xc825('0x5a')]({'vidaooSessionId':_0x49110b['id']});})[_0xc825('0x15')](respondWithResult(_0x46412e,null))[_0xc825('0x1e')](handleError(_0x46412e,null));};exports[_0xc825('0x5b')]=function(_0x5a5d69,_0x124744){if(_0x5a5d69[_0xc825('0x2c')]['id']){delete _0x5a5d69[_0xc825('0x2c')]['id'];}return db['ChatInteraction'][_0xc825('0x43')]({'where':{'id':_0x5a5d69[_0xc825('0x38')]['id']},'include':[{'model':db[_0xc825('0x5c')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x124744,null))[_0xc825('0x15')](saveUpdates(_0x5a5d69['body'],null))[_0xc825('0x15')](respondWithResult(_0x124744,null))[_0xc825('0x1e')](handleError(_0x124744,null));};exports[_0xc825('0x5d')]=function(_0x294275,_0x4d40c7){if(_0x294275['body']['id']){delete _0x294275[_0xc825('0x2c')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x294275[_0xc825('0x38')]['id']}})['then'](function(_0x4123a7){if(!_0x4123a7){logger[_0xc825('0x1b')](_0xc825('0x5e'),_0xc825('0x5d'),0x194,_0xc825('0x5f'));_0x4d40c7[_0xc825('0x1f')](0x194);}else{if(_0x4123a7['UserId']){throw new db[(_0xc825('0x54'))]['ValidationError'](_0xc825('0x60'));}}return _0x4123a7;})[_0xc825('0x15')](function(_0x9d29d5){if(_0x9d29d5){return _0x9d29d5[_0xc825('0x42')]({'closed':_0x294275[_0xc825('0x2c')][_0xc825('0x61')],'disposition':_0x294275[_0xc825('0x2c')]['disposition']})[_0xc825('0x15')](function(_0x55c155){return _0x55c155;});}})[_0xc825('0x15')](function(){return respondWithRpcPromise(_0xc825('0x62'),_0xc825('0x5d'),_0x294275[_0xc825('0x2c')],client9004);})['then'](respondWithResult(_0x4d40c7,null))['catch'](handleError(_0x4d40c7,null));};exports[_0xc825('0x63')]=function(_0x3a5c8d,_0x167010){_0x3a5c8d['body'][_0xc825('0x29')]=_0x3a5c8d[_0xc825('0x64')][_0xc825('0x65')];_0x3a5c8d[_0xc825('0x2c')][_0xc825('0x66')]=_0x3a5c8d[_0xc825('0x64')]['filename'];_0x3a5c8d['body'][_0xc825('0x67')]=_0x3a5c8d[_0xc825('0x64')][_0xc825('0x68')];return db['Attachment'][_0xc825('0x41')](_0x3a5c8d[_0xc825('0x2c')])['then'](respondWithResult(_0x167010,0xc9))[_0xc825('0x1e')](handleError(_0x167010,null));};exports[_0xc825('0x69')]=function(_0x2e5c0b,_0x6172f7){return db['ChatInteraction'][_0xc825('0x47')]({'where':{'id':_0x2e5c0b[_0xc825('0x38')]['id']},'raw':!![]})[_0xc825('0x15')](handleEntityNotFound(_0x6172f7,null))['then'](function(_0x2f92a0){if(_0x2f92a0){if(_0x2f92a0['closed']){return _0x6172f7[_0xc825('0x21')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xc825('0x6a')][_0xc825('0x47')]({'where':{'id':_0x2e5c0b[_0xc825('0x36')][_0xc825('0x6b')]},'raw':!![]})[_0xc825('0x15')](handleEntityNotFound(_0x6172f7,null));}})[_0xc825('0x15')](function(_0x41193e){if(_0x41193e){var _0xed05e1=_0x41193e['ChatOfflineMessageId']!==null;var _0x496de2=path[_0xc825('0x6c')](config['root'],_0xc825('0x6d'));if(_0xed05e1){_0x496de2=path[_0xc825('0x6c')](_0x496de2,_0xc825('0x6e'));}var _0x2ca9ac=path[_0xc825('0x6c')](_0x496de2,_0x41193e[_0xc825('0x66')]);return _0x6172f7[_0xc825('0x6f')](_0x2ca9ac);}})[_0xc825('0x1e')](handleError(_0x6172f7,null));};exports[_0xc825('0x70')]=function(_0x1a134f,_0xe2bc58){var _0x18cecc=null;var _0x5b656e=null;var _0x5e0ace=null;if(_0x1a134f[_0xc825('0x2c')]['id']){delete _0x1a134f[_0xc825('0x2c')]['id'];}if(_0x1a134f[_0xc825('0x2c')][_0xc825('0x71')]){_0x5e0ace=path[_0xc825('0x6c')](config[_0xc825('0x72')],'server/files/chat/upload/',util[_0xc825('0x73')](_0xc825('0x74'),Date['now']()));_0x1a134f[_0xc825('0x2c')][_0xc825('0x75')]=_0x5e0ace;}return db[_0xc825('0x31')][_0xc825('0x43')]({'where':{'id':_0x1a134f[_0xc825('0x38')]['id']},'include':[{'model':db[_0xc825('0x58')],'as':_0xc825('0x76'),'include':[{'model':db[_0xc825('0x77')],'as':'User'}]}]})['then'](handleEntityNotFound(_0xe2bc58,null))[_0xc825('0x15')](saveUpdates(_0x1a134f['body'],null))[_0xc825('0x15')](function(_0x977732){if(_0x977732){_0x18cecc=_0x977732;return db[_0xc825('0x46')][_0xc825('0x43')]({'where':{'id':_0x18cecc[_0xc825('0x48')]}});}})['then'](function(_0x589c49){if(_0x589c49){_0x5b656e=_0x589c49;return db[_0xc825('0x5c')]['find']({'where':{'id':_0x18cecc[_0xc825('0x78')]}});}})['then'](function(_0x595c05){if(_0x595c05){if(_0x5e0ace){var _0x219f71=null;for(var _0x830ee0=0x1;_0x830ee0<_0x18cecc[_0xc825('0x76')][_0xc825('0x3f')];++_0x830ee0){_0x219f71=_0x18cecc[_0xc825('0x76')][_0x830ee0];var _0x4e74c8=_0x219f71['UserId']?util['format'](_0xc825('0x79'),_0x5b656e[_0xc825('0x7a')],_0x219f71[_0xc825('0x7b')]):_0xc825('0x7c');var _0x56a94e=_0x1a134f[_0xc825('0x2c')][_0xc825('0x7d')]||util[_0xc825('0x73')](_0xc825('0x79'),'Visitor',_0x219f71[_0xc825('0x78')]);switch(_0x5b656e[_0xc825('0x7e')]){case'website_alias':_0x4e74c8=_0x219f71[_0xc825('0x7b')]?util['format'](_0xc825('0x79'),_0x5b656e[_0xc825('0x7a')],_0x219f71[_0xc825('0x7b')]):_0xc825('0x7c');break;case _0xc825('0x7f'):_0x4e74c8=_0x219f71[_0xc825('0x7b')]?_0x219f71[_0xc825('0x77')][_0xc825('0x80')]||_0x219f71[_0xc825('0x77')][_0xc825('0x81')]:_0xc825('0x7c');break;case _0xc825('0x82'):_0x4e74c8=_0x219f71['UserId']?_0x219f71['User']['fullname']:'System';break;default:_0x4e74c8=_0x219f71[_0xc825('0x7b')]?util[_0xc825('0x73')](_0xc825('0x79'),_0x5b656e[_0xc825('0x7a')],_0x219f71[_0xc825('0x7b')]):_0xc825('0x7c');}var _0x30f1f5=util[_0xc825('0x73')](_0xc825('0x83'),moment(_0x219f71[_0xc825('0x84')])['format'](_0xc825('0x85')),_0x219f71['direction']==='in'?_0x56a94e:_0x4e74c8,_0x219f71[_0xc825('0x2c')]);if(!_0x219f71['secret']){fs[_0xc825('0x86')](_0x5e0ace,_0x30f1f5);}}return db[_0xc825('0x87')][_0xc825('0x47')]({'where':{'service':!![]},'include':[{'model':db[_0xc825('0x88')],'as':_0xc825('0x89'),'raw':!![],'include':[{'model':db[_0xc825('0x8a')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x2bc3fd){if(!_0x2bc3fd||!_0x2bc3fd[_0xc825('0x89')]||!_0x1a134f[_0xc825('0x2c')])return _0x18cecc;var _0x591e15=_0x2bc3fd[_0xc825('0x8b')]();return respondWithRpcPromise(_0xc825('0x8c'),_0xc825('0x8d'),{'account':_0x591e15,'message':{'from':util[_0xc825('0x73')](_0xc825('0x8e'),_0x2bc3fd[_0xc825('0x29')],_0x2bc3fd[_0xc825('0x4c')]||_0x2bc3fd[_0xc825('0x89')]['user']),'to':_0x1a134f['body']['mailTranscript'],'subject':_0xc825('0x8f'),'text':util['format'](_0xc825('0x90'),_0x1a134f[_0xc825('0x2c')][_0xc825('0x71')]),'attachments':[{'path':_0x5e0ace}]}})['then'](function(){return _0x18cecc;})[_0xc825('0x1e')](function(_0x4c2d66){logger['error'](_0x4c2d66);});})[_0xc825('0x15')](respondWithStatusCode(_0xe2bc58,0xc8))[_0xc825('0x1e')](handleError(_0xe2bc58,null));};exports[_0xc825('0x91')]=function(_0x326654,_0x38444c){return db[_0xc825('0x58')][_0xc825('0x43')]({'where':{'id':_0x326654['params']['id']}})[_0xc825('0x15')](handleEntityNotFound(_0x38444c,null))[_0xc825('0x15')](function(_0x51aba5){if(_0x51aba5){return _0x51aba5['addMessage'](_0x326654[_0xc825('0x2c')][_0xc825('0x92')],_[_0xc825('0x93')](_0x326654[_0xc825('0x2c')],[_0xc825('0x92'),'id'])||{});}})['then'](respondWithResult(_0x38444c,null))['catch'](handleError(_0x38444c,null));};exports['getMessages']=function(_0x3f64ac,_0x4e63f7){var _0xd7271={'raw':![],'where':{}};var _0x4ff10c={};var _0x54238f={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc825('0x47')]({'where':{'id':_0x3f64ac[_0xc825('0x38')]['id']}})['then'](handleEntityNotFound(_0x4e63f7,null))[_0xc825('0x15')](function(_0x33c701){if(_0x33c701){_0x4ff10c['model']=_[_0xc825('0x39')](db[_0xc825('0x58')][_0xc825('0x32')]);_0x4ff10c[_0xc825('0x36')]=_[_0xc825('0x39')](_0x3f64ac[_0xc825('0x36')]);_0x4ff10c[_0xc825('0x3a')]=_[_0xc825('0x3b')](_0x4ff10c['model'],_0x4ff10c['query']);_0xd7271[_0xc825('0x3d')]=_[_0xc825('0x3b')](_0x4ff10c[_0xc825('0x3c')],qs[_0xc825('0x3e')](_0x3f64ac[_0xc825('0x36')][_0xc825('0x3e')]));_0xd7271['attributes']=_0xd7271[_0xc825('0x3d')][_0xc825('0x3f')]?_0xd7271[_0xc825('0x3d')]:_0x4ff10c['model'];if(!_0x3f64ac['query'][_0xc825('0x94')](_0xc825('0x95'))){_0xd7271[_0xc825('0x24')]=qs[_0xc825('0x24')](_0x3f64ac[_0xc825('0x36')]['limit']);_0xd7271[_0xc825('0x22')]=qs[_0xc825('0x22')](_0x3f64ac[_0xc825('0x36')][_0xc825('0x22')]);}_0xd7271[_0xc825('0x96')]=qs[_0xc825('0x97')](_0x3f64ac[_0xc825('0x36')][_0xc825('0x97')]);_0xd7271['where']=qs[_0xc825('0x3a')](_['pick'](_0x3f64ac['query'],_0x4ff10c['filters']));_0xd7271['where'][_0xc825('0x98')]=_0x33c701['id'];if(_0x3f64ac[_0xc825('0x36')]['filter']){_0xd7271['where']=_[_0xc825('0x99')](_0xd7271[_0xc825('0x9a')],{'$or':_[_0xc825('0x30')](_0xd7271[_0xc825('0x3d')],function(_0x362e80){var _0x2f05d3={};_0x2f05d3[_0x362e80]={'$like':'%'+_0x3f64ac['query'][_0xc825('0x9b')]+'%'};return _0x2f05d3;})});}if(_0x3f64ac[_0xc825('0x36')][_0xc825('0x9c')]){var _0x389f78=_0x3f64ac[_0xc825('0x36')][_0xc825('0x9c')][_0xc825('0x9d')](',');var _0x474b9e={};_0x474b9e[_0x389f78[0x0]]={'$gte':moment(_0x389f78[0x1])[_0xc825('0x73')](_0xc825('0x9e'))};_0xd7271[_0xc825('0x9a')]=_[_0xc825('0x99')](_0xd7271[_0xc825('0x9a')],_0x474b9e);}_0xd7271=_[_0xc825('0x99')]({},_0xd7271,_0x3f64ac[_0xc825('0x40')]);return db['ChatMessage']['count']({'where':_0xd7271[_0xc825('0x9a')]})[_0xc825('0x15')](function(_0x44d34e){_0x54238f[_0xc825('0x25')]=_0x44d34e;if(_0x3f64ac[_0xc825('0x36')][_0xc825('0x9f')]){_0xd7271[_0xc825('0xa0')]=[{'all':!![]}];}return db[_0xc825('0x58')]['findAll'](_0xd7271);})[_0xc825('0x15')](function(_0x1ece62){_0x54238f['rows']=_0x1ece62;return _0x54238f;});}})[_0xc825('0x15')](respondWithFilteredResult(_0x4e63f7,_0xd7271))[_0xc825('0x1e')](handleError(_0x4e63f7,null));};exports[_0xc825('0xa1')]=function(_0x8ad242,_0x5e34b0){var _0x24a704={'where':{}},_0x44b7ca={},_0x5e3ce3={'count':0x0,'rows':[]};return db[_0xc825('0x31')][_0xc825('0x47')]({'where':{'id':_0x8ad242[_0xc825('0x38')]['id']}})['then'](handleEntityNotFound(_0x5e34b0,null))[_0xc825('0x15')](function(_0x61eda1){if(_0x61eda1){_0x44b7ca[_0xc825('0x3c')]=_[_0xc825('0x39')](db[_0xc825('0x58')][_0xc825('0x32')]);_0x44b7ca[_0xc825('0x36')]=_[_0xc825('0x39')](_0x8ad242[_0xc825('0x36')]);_0x44b7ca['filters']=_[_0xc825('0x3b')](_0x44b7ca['model'],_0x44b7ca[_0xc825('0x36')]);_0x24a704[_0xc825('0x3d')]=_[_0xc825('0x3b')](_0x44b7ca['model'],qs[_0xc825('0x3e')](_0x8ad242['query'][_0xc825('0x3e')]));_0x24a704['attributes']=_0x24a704['attributes'][_0xc825('0x3f')]?_0x24a704[_0xc825('0x3d')]:_0x44b7ca[_0xc825('0x3c')];if(!_0x8ad242[_0xc825('0x36')][_0xc825('0x94')](_0xc825('0x95'))){_0x24a704[_0xc825('0x24')]=qs[_0xc825('0x24')](_0x8ad242[_0xc825('0x36')][_0xc825('0x24')]);_0x24a704['offset']=qs[_0xc825('0x22')](_0x8ad242[_0xc825('0x36')][_0xc825('0x22')]);}_0x24a704[_0xc825('0x96')]=qs[_0xc825('0x97')](_0x8ad242[_0xc825('0x36')][_0xc825('0x97')]);_0x24a704[_0xc825('0x9a')]=qs[_0xc825('0x3a')](_['pick'](_0x8ad242[_0xc825('0x36')],_0x44b7ca[_0xc825('0x3a')]));_0x24a704[_0xc825('0x9a')][_0xc825('0x98')]=_0x61eda1['id'];if(_0x8ad242[_0xc825('0x36')]['filter']){_0x24a704[_0xc825('0x9a')]=_['merge'](_0x24a704[_0xc825('0x9a')],{'$or':_[_0xc825('0x30')](_0x24a704['attributes'],function(_0x341498){var _0xe26688={};_0xe26688[_0x341498]={'$like':'%'+_0x8ad242[_0xc825('0x36')][_0xc825('0x9b')]+'%'};return _0xe26688;})});}_0x24a704[_0xc825('0x9a')][_0xc825('0xa2')]=![];if(_0x8ad242['query']['id']){_0x24a704[_0xc825('0x9a')]['id']={'$gt':_0x8ad242[_0xc825('0x36')]['id']};}_0x24a704=_['merge']({},_0x24a704,_0x8ad242[_0xc825('0x40')]);return db[_0xc825('0x58')][_0xc825('0x25')]({'where':_0x24a704[_0xc825('0x9a')]})[_0xc825('0x15')](function(_0x13ffb1){_0x5e3ce3['count']=_0x13ffb1;_0x24a704[_0xc825('0xa0')]=[];if(_0x8ad242['query']['includeAgent']){_0x24a704['include'][_0xc825('0xa3')]({'model':db['User'],'as':_0xc825('0x77'),'attributes':['id','fullname','alias']});}if(_0x8ad242[_0xc825('0x36')]['includeAll']){_0x24a704[_0xc825('0xa0')]=[{'all':!![]}];}return db[_0xc825('0x58')]['findAll'](_0x24a704);})['then'](function(_0x4a1edf){_0x5e3ce3[_0xc825('0xa4')]=_0x4a1edf;return _0x5e3ce3;});}})['then'](respondWithFilteredResult(_0x5e34b0,_0x24a704))[_0xc825('0x1e')](handleError(_0x5e34b0,null));};exports[_0xc825('0xa5')]=function(_0xe84429,_0x35a2f7){return db[_0xc825('0x31')][_0xc825('0x43')]({'where':{'id':_0xe84429['params']['id']}})[_0xc825('0x15')](handleEntityNotFound(_0x35a2f7,null))[_0xc825('0x15')](function(_0x29ff19){if(_0x29ff19){return _0x29ff19['setTags'](_0xe84429['body'][_0xc825('0x92')],_[_0xc825('0x93')](_0xe84429[_0xc825('0x2c')],[_0xc825('0x92'),'id'])||{})[_0xc825('0xa6')](function(){return db[_0xc825('0xa7')][_0xc825('0xa8')]({'attributes':['id','name',_0xc825('0xa9')],'where':{'id':_0xe84429[_0xc825('0x2c')][_0xc825('0x92')]}});})[_0xc825('0x15')](function(_0x162bc){socket[_0xc825('0xaa')](_0xc825('0xab'),{'id':Number(_0xe84429['params']['id']),'tags':_0x162bc||[]});return{'id':Number(_0xe84429[_0xc825('0x38')]['id']),'tags':_0x162bc||[]};});}})[_0xc825('0x15')](respondWithResult(_0x35a2f7,null))[_0xc825('0x1e')](handleError(_0x35a2f7,null));};exports[_0xc825('0xac')]=function(_0x5c50c7,_0x135eed){return db[_0xc825('0x31')][_0xc825('0x43')]({'where':{'id':_0x5c50c7['params']['id']}})[_0xc825('0x15')](handleEntityNotFound(_0x135eed,null))[_0xc825('0x15')](function(_0x39db3d){if(_0x39db3d){return _0x39db3d[_0xc825('0xac')](_0x5c50c7[_0xc825('0x36')][_0xc825('0x92')]);}})['then'](respondWithStatusCode(_0x135eed,null))[_0xc825('0x1e')](handleError(_0x135eed,null));};exports[_0xc825('0x6f')]=function(_0x10e9b6,_0x24c15f){var _0x2a77ea=moment()[_0xc825('0xad')]()['toString']();var _0x30cfa8=path[_0xc825('0x6c')](config[_0xc825('0x72')],_0xc825('0xae'),_0xc825('0xaf'),_0xc825('0xb0'));var _0x33eb07=path[_0xc825('0x6c')](config[_0xc825('0x72')],_0xc825('0xae'),_0xc825('0xaf'),_0xc825('0xb1'));var _0x594909=path[_0xc825('0x6c')](_0x30cfa8,_0x2a77ea);var _0x31c766=util[_0xc825('0x73')]('transcript-%d-%s.zip',_0x10e9b6[_0xc825('0x38')]['id'],_0x2a77ea);var _0x38b22d=path[_0xc825('0x6c')](_0x30cfa8,_0x31c766);var _0x5ebef4=[];_0x5ebef4[_0xc825('0xa3')]({'model':db[_0xc825('0x77')],'as':_0xc825('0x77'),'attributes':['id',_0xc825('0x81')],'raw':!![]});_0x5ebef4[_0xc825('0xa3')]({'model':db[_0xc825('0x5c')],'as':_0xc825('0xb2'),'attributes':['id',_0xc825('0xb3'),_0xc825('0xb4')],'raw':!![]});if(_0x10e9b6[_0xc825('0x36')][_0xc825('0xb1')]){_0x5ebef4[_0xc825('0xa3')]({'model':db[_0xc825('0x6a')],'as':'Attachment','raw':!![]});}var _0x12db94=[{'model':db[_0xc825('0x58')],'as':_0xc825('0x76'),'attributes':['id',_0xc825('0x2c'),_0xc825('0x84'),_0xc825('0xb5'),_0xc825('0xa2'),_0xc825('0xb6')],'include':_0x5ebef4}];_0x12db94[_0xc825('0xa3')]({'model':db['ChatWebsite'],'as':_0xc825('0xb7'),'attributes':['id',_0xc825('0x29')]});_0x12db94['push']({'model':db[_0xc825('0x77')],'as':'Owner','attributes':['id',_0xc825('0x81')]});return db[_0xc825('0x31')][_0xc825('0x43')]({'where':{'id':_0x10e9b6['params']['id']},'include':_0x12db94})[_0xc825('0x15')](handleEntityNotFound(_0x24c15f,null))[_0xc825('0x15')](function(_0x4aa07f){if(_0x4aa07f){var _0x27ebf4=_0x4aa07f[_0xc825('0xb8')]({'plain':!![]});fs[_0xc825('0xb9')](_0x594909);var _0x512ea8={'channel':_0xc825('0xba'),'account':_0x27ebf4[_0xc825('0xb7')][_0xc825('0x29')],'agent':_0x27ebf4[_0xc825('0xbb')]?_0x27ebf4[_0xc825('0xbb')][_0xc825('0x81')]:_0xc825('0xbc'),'createdAt':moment(_0x27ebf4[_0xc825('0x84')])[_0xc825('0x73')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x27ebf4[_0xc825('0x61')]?moment(_0x27ebf4[_0xc825('0xbd')])[_0xc825('0x73')](_0xc825('0x9e'))[_0xc825('0xbe')]():'','disposition':_0x27ebf4[_0xc825('0xbf')],'chatInfo':{'browser':_0x27ebf4[_0xc825('0xc0')],'os':_0x27ebf4['osName'],'referer':_0x27ebf4['referer'],'customerIp':_0x27ebf4[_0xc825('0xc1')],'customerPort':_0x27ebf4['customerPort']?_0x27ebf4[_0xc825('0xc2')]:_0xc825('0xbc')},'messages':_(_0x27ebf4['Messages'])[_0xc825('0xc3')]()[_0xc825('0x9b')]({'secret':![]})['map'](function(_0x1570e0){if(_0x1570e0[_0xc825('0x6a')]){var _0x2d6b4d=path[_0xc825('0x6c')](_0x33eb07,_0x1570e0['Attachment'][_0xc825('0x66')]);if(fs[_0xc825('0xc4')](_0x2d6b4d)){fs[_0xc825('0xc5')](_0x2d6b4d)[_0xc825('0xc6')](fs[_0xc825('0xc7')](path[_0xc825('0x6c')](_0x594909,_0x1570e0['Attachment'][_0xc825('0x66')])));}}return{'date':moment(_0x1570e0[_0xc825('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1570e0[_0xc825('0xb5')]==='out'?_0x1570e0[_0xc825('0x77')]?_0x1570e0[_0xc825('0x77')][_0xc825('0x81')]:_0xc825('0x7c'):_0x1570e0[_0xc825('0xb2')][_0xc825('0xb3')]+(_0x1570e0[_0xc825('0xb2')][_0xc825('0xb4')]?'\x20'+_0x1570e0['Contact'][_0xc825('0xb4')]:''),'body':_0x1570e0[_0xc825('0x6a')]?_0x1570e0[_0xc825('0x6a')][_0xc825('0x66')]:_0x1570e0[_0xc825('0x2c')],'direction':_0x1570e0[_0xc825('0xb5')]==='out'?'A':'C','secret':_0x1570e0[_0xc825('0xa2')],'read':_0x1570e0['read'],'attachment':_0x1570e0[_0xc825('0x6a')]};})[_0xc825('0xc8')]()};return ejs[_0xc825('0xc9')](path[_0xc825('0x6c')](config[_0xc825('0x72')],_0xc825('0xae'),_0xc825('0xca'),_0xc825('0xcb')),{'interaction':_0x512ea8})[_0xc825('0x15')](function(_0xad356e){var _0x8478a3=path[_0xc825('0x6c')](_0x594909,'transcript-'+_0x27ebf4['id']+'-'+_0x2a77ea+'.pdf');var _0x5cf6a0={'path':_0x8478a3,'channel':_0xc825('0xba'),'interactionId':_0x27ebf4['id']};return pdf['createPdfFromHTML'](_0xad356e,_0x5cf6a0);})[_0xc825('0x15')](function(){return new Promise(function(_0x38b80c,_0x1298bc){zipdir(_0x594909,{'saveTo':_0x38b22d},function(_0x7f22bf,_0x38123d){if(_0x7f22bf)return _0x1298bc(_0x7f22bf);return _0x38b80c(_0x38123d);});})[_0xc825('0x15')](function(){return new BPromise(function(_0x1c8cf4,_0x3d1db6){rimraf(_0x594909,function(_0x4ad09f){if(_0x4ad09f)_0x3d1db6(_0x4ad09f);return _0x1c8cf4();});});})['then'](function(){return _0x24c15f[_0xc825('0x6f')](_0x38b22d,_0x31c766,function(_0x243f23){if(_0x243f23){logger[_0xc825('0x1b')]('err',_0x243f23);}else{fs['unlinkSync'](_0x38b22d);}});});});}else{return _0x24c15f[_0xc825('0x1f')](0xc8);}})[_0xc825('0x1e')](handleError(_0x24c15f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index af3ec7d..fcd3597 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 _0xdef0=['hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x23d1b3,_0x4656d1){var _0xb3ab39=function(_0x158225){while(--_0x158225){_0x23d1b3['push'](_0x23d1b3['shift']());}};_0xb3ab39(++_0x4656d1);}(_0xdef0,0x11b));var _0x0def=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdef0[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x0def('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x0def('0x1')];var ChatMessage=require(_0x0def('0x2'))['db'][_0x0def('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0def('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0def('0x5'),'afterDestroy':_0x0def('0x6')};function emitEvent(_0x12ec4b){return function(_0x29420d,_0x11495b,_0x16742e){_0x29420d[_0x0def('0x7')]({'attributes':['id'],'raw':!![]})[_0x0def('0x8')](function(_0x1f7d6b){_0x29420d[_0x0def('0x9')](_0x0def('0xa'),_0x1f7d6b[_0x0def('0xb')](function(_0x60543e){return{'id':_0x60543e['id']};}));return ChatMessage[_0x0def('0xc')]({'where':{'ChatInteractionId':_0x29420d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0def('0x8')](function(_0x2b565d){_0x29420d[_0x0def('0x9')](_0x0def('0xd'),_0x2b565d[_0x0def('0xe')]);ChatInteractionEvents[_0x0def('0xf')](_0x12ec4b+':'+_0x29420d['id'],_0x29420d);ChatInteractionEvents[_0x0def('0xf')](_0x12ec4b,_0x29420d);_0x16742e(null);})[_0x0def('0x10')](_0x16742e(null));};}for(var e in events){if(events[_0x0def('0x11')](e)){var event=events[e];ChatInteraction[_0x0def('0x12')](e,emitEvent(event));}}module[_0x0def('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0x423f=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x423f,0x1bd));var _0xf423=function(_0xe7641a,_0x1d152d){_0xe7641a=_0xe7641a-0x0;var _0x50c566=_0x423f[_0xe7641a];return _0x50c566;};'use strict';var EventEmitter=require(_0xf423('0x0'));var ChatInteraction=require(_0xf423('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xf423('0x1'))['db'][_0xf423('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf423('0x3')](0x0);var events={'afterCreate':_0xf423('0x4'),'afterUpdate':_0xf423('0x5'),'afterDestroy':_0xf423('0x6')};function emitEvent(_0x14b7cf){return function(_0x3f51bb,_0x6b4865,_0x3e62bc){_0x3f51bb[_0xf423('0x7')]({'attributes':['id'],'raw':!![]})[_0xf423('0x8')](function(_0x389794){_0x3f51bb[_0xf423('0x9')]('Users',_0x389794[_0xf423('0xa')](function(_0x4b794d){return{'id':_0x4b794d['id']};}));return ChatMessage[_0xf423('0xb')]({'where':{'ChatInteractionId':_0x3f51bb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf423('0x8')](function(_0x47270c){_0x3f51bb[_0xf423('0x9')](_0xf423('0xc'),_0x47270c[_0xf423('0xd')]);ChatInteractionEvents[_0xf423('0xe')](_0x14b7cf+':'+_0x3f51bb['id'],_0x3f51bb);ChatInteractionEvents['emit'](_0x14b7cf,_0x3f51bb);_0x3e62bc(null);})[_0xf423('0xf')](_0x3e62bc(null));};}for(var e in events){if(events[_0xf423('0x10')](e)){var event=events[e];ChatInteraction[_0xf423('0x11')](e,emitEvent(event));}}module[_0xf423('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 2f740a1..862f13d 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 _0x15f6=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','closedAt'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x15f6,0x1f3));var _0x615f=function(_0x548d2d,_0x538efb){_0x548d2d=_0x548d2d-0x0;var _0x4cd970=_0x15f6[_0x548d2d];return _0x4cd970;};'use strict';var _=require(_0x615f('0x0'));var util=require('util');var logger=require(_0x615f('0x1'))('api');var moment=require(_0x615f('0x2'));var BPromise=require(_0x615f('0x3'));var rp=require(_0x615f('0x4'));var fs=require('fs');var path=require(_0x615f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x615f('0x6'));module['exports']=function(_0x5e6222,_0x1877c8){return _0x5e6222['define'](_0x615f('0x7'),attributes,{'tableName':_0x615f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d600c,_0x1bf8cf,_0x3e600c){if(_0x5d600c[_0x615f('0x9')]('closed')){_0x5d600c[_0x615f('0xa')]=moment()[_0x615f('0xb')](_0x615f('0xc'));}_0x3e600c(null,_0x5d600c);}},'charset':_0x615f('0xd'),'collate':_0x615f('0xe')});}; \ No newline at end of file +var _0xbf7d=['format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0xbf7d,0xb7));var _0xdbf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf7d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbf7('0x0'));var util=require(_0xdbf7('0x1'));var logger=require(_0xdbf7('0x2'))(_0xdbf7('0x3'));var moment=require(_0xdbf7('0x4'));var BPromise=require('bluebird');var rp=require(_0xdbf7('0x5'));var fs=require('fs');var path=require(_0xdbf7('0x6'));var rimraf=require(_0xdbf7('0x7'));var config=require('../../config/environment');var attributes=require(_0xdbf7('0x8'));module[_0xdbf7('0x9')]=function(_0x19ca8d,_0x3078d6){return _0x19ca8d[_0xdbf7('0xa')](_0xdbf7('0xb'),attributes,{'tableName':_0xdbf7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2293fe,_0x42a4f8,_0x4ce7d2){if(_0x2293fe[_0xdbf7('0xd')]('closed')){_0x2293fe[_0xdbf7('0xe')]=moment()[_0xdbf7('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ce7d2(null,_0x2293fe);}},'charset':_0xdbf7('0x10'),'collate':_0xdbf7('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7d71b3c..25ff719 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 _0x6cfc=['rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','UpdateChatInteraction','ChatInteraction','body','where','options','catch','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6cfc,0xe2));var _0xc6cf=function(_0x372515,_0xdd11f){_0x372515=_0x372515-0x0;var _0xa3bf4e=_0x6cfc[_0x372515];return _0xa3bf4e;};'use strict';var _=require(_0xc6cf('0x0'));var util=require(_0xc6cf('0x1'));var moment=require(_0xc6cf('0x2'));var BPromise=require(_0xc6cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6cf('0x4'));var db=require(_0xc6cf('0x5'))['db'];var utils=require(_0xc6cf('0x6'));var logger=require(_0xc6cf('0x7'))(_0xc6cf('0x8'));var config=require(_0xc6cf('0x9'));var jayson=require(_0xc6cf('0xa'));var client=jayson['client'][_0xc6cf('0xb')]({'port':0x232a});config['redis']=_[_0xc6cf('0xc')](config[_0xc6cf('0xd')],{'host':_0xc6cf('0xe'),'port':0x18eb});var socket=require(_0xc6cf('0xf'))(new Redis(config[_0xc6cf('0xd')]));require(_0xc6cf('0x10'))['register'](socket);function respondWithRpcPromise(_0x335999,_0x54c9e7,_0x484b1b){return new BPromise(function(_0x2fe3be,_0x3a77e0){return client['request'](_0x335999,_0x484b1b)[_0xc6cf('0x11')](function(_0x43b2ad){logger[_0xc6cf('0x12')](_0xc6cf('0x13'),_0x54c9e7,'request\x20sent');logger[_0xc6cf('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x54c9e7,_0xc6cf('0x15'),JSON[_0xc6cf('0x16')](_0x43b2ad));if(_0x43b2ad[_0xc6cf('0x17')]){if(_0x43b2ad[_0xc6cf('0x17')][_0xc6cf('0x18')]===0x1f4){logger[_0xc6cf('0x17')](_0xc6cf('0x13'),_0x54c9e7,_0x43b2ad[_0xc6cf('0x17')][_0xc6cf('0x19')]);return _0x3a77e0(_0x43b2ad[_0xc6cf('0x17')]['message']);}logger[_0xc6cf('0x17')](_0xc6cf('0x13'),_0x54c9e7,_0x43b2ad['error']['message']);return _0x2fe3be(_0x43b2ad['error'][_0xc6cf('0x19')]);}else{logger[_0xc6cf('0x12')](_0xc6cf('0x13'),_0x54c9e7,_0xc6cf('0x15'));_0x2fe3be(_0x43b2ad['result']['message']);}})['catch'](function(_0x3726b5){logger[_0xc6cf('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x54c9e7,_0x3726b5);_0x3a77e0(_0x3726b5);});});}exports[_0xc6cf('0x1a')]=function(_0x34abd9){var _0x121505=this;return new Promise(function(_0x3ee4e7,_0x1837d0){return db[_0xc6cf('0x1b')]['update'](_0x34abd9[_0xc6cf('0x1c')],{'raw':_0x34abd9['options']?_0x34abd9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34abd9['options']?_0x34abd9['options'][_0xc6cf('0x1d')]||null:null,'attributes':_0x34abd9[_0xc6cf('0x1e')]?_0x34abd9['options']['attributes']||null:null,'limit':_0x34abd9[_0xc6cf('0x1e')]?_0x34abd9[_0xc6cf('0x1e')]['limit']||null:null})['then'](function(_0x511908){logger[_0xc6cf('0x12')]('UpdateChatInteraction',_0x34abd9);logger[_0xc6cf('0x14')](_0xc6cf('0x1a'),_0x34abd9,JSON['stringify'](_0x511908));_0x3ee4e7(_0x511908);})[_0xc6cf('0x1f')](function(_0x5525b8){logger[_0xc6cf('0x17')]('UpdateChatInteraction',_0x5525b8[_0xc6cf('0x19')],_0x34abd9);_0x1837d0(_0x121505[_0xc6cf('0x17')](0x1f4,_0x5525b8[_0xc6cf('0x19')]));});});};exports[_0xc6cf('0x20')]=function(_0x3d3397){return new Promise(function(_0x52d933,_0x3074c9){return db[_0xc6cf('0x1b')][_0xc6cf('0x21')]({'where':_0x3d3397[_0xc6cf('0x1e')]?_0x3d3397['options'][_0xc6cf('0x1d')]||null:null})[_0xc6cf('0x11')](function(_0x16a842){if(_0x16a842){return _0x16a842[_0xc6cf('0x22')](_0x3d3397[_0xc6cf('0x1c')][_0xc6cf('0x23')],_[_0xc6cf('0x24')](_0x3d3397[_0xc6cf('0x1c')],[_0xc6cf('0x23'),'id'])||{});}})[_0xc6cf('0x25')](function(_0xd2d3e1){logger[_0xc6cf('0x12')](_0xc6cf('0x26'),_0x3d3397);logger[_0xc6cf('0x14')](_0xc6cf('0x26'),_0x3d3397,JSON['stringify'](_0xd2d3e1));_0x52d933(_0xd2d3e1);})[_0xc6cf('0x1f')](function(_0x215f4a){logger[_0xc6cf('0x17')](_0xc6cf('0x26'),_0x215f4a[_0xc6cf('0x19')],_0x3d3397);_0x3074c9(_this['error'](0x1f4,_0x215f4a['message']));});});}; \ No newline at end of file +var _0x83f9=['body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction','ChatInteraction','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x83f9,0x10b));var _0x983f=function(_0x4bdbee,_0x324bed){_0x4bdbee=_0x4bdbee-0x0;var _0x26bb41=_0x83f9[_0x4bdbee];return _0x26bb41;};'use strict';var _=require('lodash');var util=require(_0x983f('0x0'));var moment=require(_0x983f('0x1'));var BPromise=require(_0x983f('0x2'));var rs=require(_0x983f('0x3'));var fs=require('fs');var Redis=require(_0x983f('0x4'));var db=require(_0x983f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x983f('0x6'))(_0x983f('0x7'));var config=require(_0x983f('0x8'));var jayson=require(_0x983f('0x9'));var client=jayson[_0x983f('0xa')][_0x983f('0xb')]({'port':0x232a});config[_0x983f('0xc')]=_['defaults'](config[_0x983f('0xc')],{'host':_0x983f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x983f('0xc')]));require(_0x983f('0xe'))[_0x983f('0xf')](socket);function respondWithRpcPromise(_0x5dcd0b,_0x214dbe,_0x48e09f){return new BPromise(function(_0x2ba793,_0x117668){return client[_0x983f('0x10')](_0x5dcd0b,_0x48e09f)[_0x983f('0x11')](function(_0x3ccaf9){logger[_0x983f('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x214dbe,_0x983f('0x13'));logger[_0x983f('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x214dbe,'request\x20sent',JSON['stringify'](_0x3ccaf9));if(_0x3ccaf9['error']){if(_0x3ccaf9[_0x983f('0x15')]['code']===0x1f4){logger[_0x983f('0x15')](_0x983f('0x16'),_0x214dbe,_0x3ccaf9['error'][_0x983f('0x17')]);return _0x117668(_0x3ccaf9[_0x983f('0x15')][_0x983f('0x17')]);}logger[_0x983f('0x15')](_0x983f('0x16'),_0x214dbe,_0x3ccaf9[_0x983f('0x15')][_0x983f('0x17')]);return _0x2ba793(_0x3ccaf9[_0x983f('0x15')][_0x983f('0x17')]);}else{logger[_0x983f('0x12')](_0x983f('0x16'),_0x214dbe,_0x983f('0x13'));_0x2ba793(_0x3ccaf9[_0x983f('0x18')]['message']);}})[_0x983f('0x19')](function(_0x443f52){logger[_0x983f('0x15')](_0x983f('0x16'),_0x214dbe,_0x443f52);_0x117668(_0x443f52);});});}exports['UpdateChatInteraction']=function(_0x3c84b6){var _0x110d71=this;return new Promise(function(_0x2a43d1,_0x39b27b){return db['ChatInteraction'][_0x983f('0x1a')](_0x3c84b6[_0x983f('0x1b')],{'raw':_0x3c84b6[_0x983f('0x1c')]?_0x3c84b6[_0x983f('0x1c')][_0x983f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c84b6[_0x983f('0x1c')]?_0x3c84b6['options'][_0x983f('0x1e')]||null:null,'attributes':_0x3c84b6[_0x983f('0x1c')]?_0x3c84b6[_0x983f('0x1c')][_0x983f('0x1f')]||null:null,'limit':_0x3c84b6['options']?_0x3c84b6[_0x983f('0x1c')][_0x983f('0x20')]||null:null})[_0x983f('0x11')](function(_0x41c5f0){logger[_0x983f('0x12')](_0x983f('0x21'),_0x3c84b6);logger[_0x983f('0x14')](_0x983f('0x21'),_0x3c84b6,JSON[_0x983f('0x22')](_0x41c5f0));_0x2a43d1(_0x41c5f0);})[_0x983f('0x19')](function(_0x5e8e81){logger[_0x983f('0x15')](_0x983f('0x21'),_0x5e8e81['message'],_0x3c84b6);_0x39b27b(_0x110d71[_0x983f('0x15')](0x1f4,_0x5e8e81['message']));});});};exports[_0x983f('0x23')]=function(_0x15b326){return new Promise(function(_0x1558ba,_0x120796){return db[_0x983f('0x24')]['find']({'where':_0x15b326[_0x983f('0x1c')]?_0x15b326[_0x983f('0x1c')][_0x983f('0x1e')]||null:null})[_0x983f('0x11')](function(_0x2b48cb){if(_0x2b48cb){return _0x2b48cb[_0x983f('0x25')](_0x15b326['body']['ids'],_[_0x983f('0x26')](_0x15b326[_0x983f('0x1b')],[_0x983f('0x27'),'id'])||{});}})[_0x983f('0x28')](function(_0x375926){logger[_0x983f('0x12')]('AddTags',_0x15b326);logger[_0x983f('0x14')](_0x983f('0x29'),_0x15b326,JSON[_0x983f('0x22')](_0x375926));_0x1558ba(_0x375926);})['catch'](function(_0x10a5ea){logger['error'](_0x983f('0x29'),_0x10a5ea[_0x983f('0x17')],_0x15b326);_0x120796(_this[_0x983f('0x15')](0x1f4,_0x10a5ea[_0x983f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a1990b1..1312da2 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 _0xf5fd=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','remove'];(function(_0x4f32f6,_0x3f1dbb){var _0x5ddda2=function(_0x3ead85){while(--_0x3ead85){_0x4f32f6['push'](_0x4f32f6['shift']());}};_0x5ddda2(++_0x3f1dbb);}(_0xf5fd,0xbe));var _0xdf5f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf5fd[_0x46698a];return _0x356db0;};'use strict';var ChatInteractionEvents=require(_0xdf5f('0x0'));var events=['save',_0xdf5f('0x1'),_0xdf5f('0x2')];function createListener(_0xc5c38,_0x40080b){return function(_0xa051b9){_0x40080b[_0xdf5f('0x3')](_0xc5c38,_0xa051b9);};}function removeListener(_0x1c9717,_0x408279){return function(){ChatInteractionEvents[_0xdf5f('0x4')](_0x1c9717,_0x408279);};}exports[_0xdf5f('0x5')]=function(_0x3cf43f){for(var _0x30ebd6=0x0,_0x283e6f=events[_0xdf5f('0x6')];_0x30ebd6<_0x283e6f;_0x30ebd6++){var _0x135b2a=events[_0x30ebd6];var _0x31a792=createListener(_0xdf5f('0x7')+_0x135b2a,_0x3cf43f);ChatInteractionEvents['on'](_0x135b2a,_0x31a792);}}; \ No newline at end of file +var _0x5923=['update','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x1f5266,_0x559eb4){var _0x16fd54=function(_0x1316b6){while(--_0x1316b6){_0x1f5266['push'](_0x1f5266['shift']());}};_0x16fd54(++_0x559eb4);}(_0x5923,0x185));var _0x3592=function(_0x49cefe,_0x31f709){_0x49cefe=_0x49cefe-0x0;var _0x4da46e=_0x5923[_0x49cefe];return _0x4da46e;};'use strict';var ChatInteractionEvents=require(_0x3592('0x0'));var events=[_0x3592('0x1'),_0x3592('0x2'),_0x3592('0x3')];function createListener(_0x3fa67c,_0x253aa8){return function(_0x7b5697){_0x253aa8['emit'](_0x3fa67c,_0x7b5697);};}function removeListener(_0xe304f4,_0x1e6d33){return function(){ChatInteractionEvents[_0x3592('0x4')](_0xe304f4,_0x1e6d33);};}exports[_0x3592('0x5')]=function(_0x37570b){for(var _0x298e7b=0x0,_0x4d2b4f=events[_0x3592('0x6')];_0x298e7b<_0x4d2b4f;_0x298e7b++){var _0x4f2276=events[_0x298e7b];var _0x552825=createListener(_0x3592('0x7')+_0x4f2276,_0x37570b);ChatInteractionEvents['on'](_0x4f2276,_0x552825);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a4ab8e5..7a649eb 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 _0x9999=['%s-%s','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','/:id','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format'];(function(_0x3ab47e,_0x32c722){var _0x1578c3=function(_0x1c8fc9){while(--_0x1c8fc9){_0x3ab47e['push'](_0x3ab47e['shift']());}};_0x1578c3(++_0x32c722);}(_0x9999,0x17d));var _0x9999=function(_0x1fde23,_0x77ef6){_0x1fde23=_0x1fde23-0x0;var _0x59d7c0=_0x9999[_0x1fde23];return _0x59d7c0;};'use strict';var multer=require(_0x9999('0x0'));var util=require(_0x9999('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9999('0x2')]();var fs_extra=require(_0x9999('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9999('0x4'));var config=require(_0x9999('0x5'));var controller=require('./chatInteraction.controller');router[_0x9999('0x6')]('/',auth[_0x9999('0x7')](),controller[_0x9999('0x8')]);router['get'](_0x9999('0x9'),auth[_0x9999('0x7')](),controller['describe']);router[_0x9999('0x6')]('/:id',auth[_0x9999('0xa')](),controller['show']);router[_0x9999('0x6')](_0x9999('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x9999('0xc')]);router['get'](_0x9999('0xd'),auth[_0x9999('0x7')](),controller[_0x9999('0xe')]);router[_0x9999('0x6')](_0x9999('0xf'),auth[_0x9999('0xa')](),controller[_0x9999('0x10')]);router[_0x9999('0x6')](_0x9999('0x11'),auth[_0x9999('0x7')](),controller[_0x9999('0x12')]);router[_0x9999('0x13')]('/',auth[_0x9999('0x7')](),controller[_0x9999('0x14')]);router[_0x9999('0x13')](_0x9999('0x15'),auth[_0x9999('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x9999('0x16')]({'destination':function(_0x3a03d0,_0x27da76,_0x226dc9){_0x226dc9(null,path[_0x9999('0x17')](config[_0x9999('0x18')],_0x9999('0x19')));},'filename':function(_0x52c29c,_0x4a562f,_0x59aac3){_0x59aac3(null,util[_0x9999('0x1a')](_0x9999('0x1b'),Date['now'](),_0x4a562f['originalname'][_0x9999('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9999('0x13')](_0x9999('0x1d'),upload['single'](_0x9999('0x1e')),controller[_0x9999('0x1f')]);router[_0x9999('0x13')]('/:id/messages',auth[_0x9999('0xa')](),controller[_0x9999('0x20')]);router[_0x9999('0x13')](_0x9999('0x21'),auth[_0x9999('0x7')](),interaction[_0x9999('0x22')]('chat',_0x9999('0x23')),controller['addTags']);router[_0x9999('0x24')](_0x9999('0x25'),auth[_0x9999('0x7')](),interaction['tracked'](_0x9999('0x26'),_0x9999('0x27')),controller[_0x9999('0x28')]);router[_0x9999('0x24')](_0x9999('0x29'),controller[_0x9999('0x2a')]);router[_0x9999('0x24')](_0x9999('0x2b'),auth['isChatInteractionAuthorized'](),controller['abandon']);router['put'](_0x9999('0x2c'),controller[_0x9999('0x2d')]);router['delete'](_0x9999('0x25'),auth['isAuthenticated'](),interaction[_0x9999('0x22')](_0x9999('0x26'),_0x9999('0x2e')),controller[_0x9999('0x2f')]);router[_0x9999('0x30')]('/:id/tags',auth[_0x9999('0x7')](),controller[_0x9999('0x31')]);module[_0x9999('0x32')]=router; \ No newline at end of file +var _0xe83a=['path','connect-timeout','express','Router','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','createVidaooSession','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','multer','util'];(function(_0x1208e4,_0x37baad){var _0x2f401e=function(_0xfaa445){while(--_0xfaa445){_0x1208e4['push'](_0x1208e4['shift']());}};_0x2f401e(++_0x37baad);}(_0xe83a,0x8e));var _0xae83=function(_0x498b80,_0x4a207c){_0x498b80=_0x498b80-0x0;var _0x368941=_0xe83a[_0x498b80];return _0x368941;};'use strict';var multer=require(_0xae83('0x0'));var util=require(_0xae83('0x1'));var path=require(_0xae83('0x2'));var timeout=require(_0xae83('0x3'));var express=require(_0xae83('0x4'));var router=express[_0xae83('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae83('0x6'));var config=require('../../config/environment');var controller=require(_0xae83('0x7'));router[_0xae83('0x8')]('/',auth[_0xae83('0x9')](),controller[_0xae83('0xa')]);router[_0xae83('0x8')](_0xae83('0xb'),auth[_0xae83('0x9')](),controller[_0xae83('0xc')]);router[_0xae83('0x8')](_0xae83('0xd'),auth[_0xae83('0xe')](),controller['show']);router[_0xae83('0x8')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xae83('0xf')]);router['get'](_0xae83('0x10'),auth[_0xae83('0x9')](),controller[_0xae83('0x11')]);router[_0xae83('0x8')](_0xae83('0x12'),auth[_0xae83('0xe')](),controller['getMyMessages']);router[_0xae83('0x8')](_0xae83('0x13'),auth[_0xae83('0x9')](),controller[_0xae83('0x14')]);router[_0xae83('0x15')]('/',auth[_0xae83('0x9')](),controller[_0xae83('0x16')]);router[_0xae83('0x15')]('/:id/vidaoo',auth[_0xae83('0x9')](),controller[_0xae83('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bb423,_0x1311a2,_0x249cab){_0x249cab(null,path[_0xae83('0x18')](config['root'],_0xae83('0x19')));},'filename':function(_0x50995e,_0x1ec273,_0x9852fa){_0x9852fa(null,util[_0xae83('0x1a')]('%s-%s',Date[_0xae83('0x1b')](),_0x1ec273[_0xae83('0x1c')][_0xae83('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xae83('0x15')](_0xae83('0x1e'),upload[_0xae83('0x1f')]('file'),controller[_0xae83('0x20')]);router['post'](_0xae83('0x10'),auth[_0xae83('0xe')](),controller[_0xae83('0x21')]);router[_0xae83('0x15')](_0xae83('0x22'),auth[_0xae83('0x9')](),interaction[_0xae83('0x23')](_0xae83('0x24'),_0xae83('0x25')),controller[_0xae83('0x26')]);router[_0xae83('0x27')]('/:id',auth['isAuthenticated'](),interaction[_0xae83('0x23')](_0xae83('0x24'),'chatinteraction:update'),controller['update']);router[_0xae83('0x27')](_0xae83('0x28'),controller[_0xae83('0x29')]);router[_0xae83('0x27')](_0xae83('0x2a'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xae83('0x27')](_0xae83('0x2b'),controller[_0xae83('0x2c')]);router[_0xae83('0x2d')](_0xae83('0xd'),auth[_0xae83('0x9')](),interaction[_0xae83('0x23')](_0xae83('0x24'),_0xae83('0x2e')),controller['destroy']);router[_0xae83('0x2d')](_0xae83('0x22'),auth[_0xae83('0x9')](),controller[_0xae83('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e9cc286..7ebf841 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 _0x7d4c=['exports','TEXT','medium','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d4c,0xd1));var _0xc7d4=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x7d4c[_0x51ac09];return _0x3f827d;};'use strict';var Sequelize=require(_0xc7d4('0x0'));module[_0xc7d4('0x1')]={'body':{'type':Sequelize[_0xc7d4('0x2')](_0xc7d4('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc7d4('0x4')]}}; \ No newline at end of file +var _0x9a39=['sequelize','exports','BOOLEAN','INTEGER'];(function(_0x1be07e,_0x8e9930){var _0x52b7e5=function(_0x48289d){while(--_0x48289d){_0x1be07e['push'](_0x1be07e['shift']());}};_0x52b7e5(++_0x8e9930);}(_0x9a39,0x104));var _0x99a3=function(_0x5b772f,_0x28043f){_0x5b772f=_0x5b772f-0x0;var _0x3ff5c8=_0x9a39[_0x5b772f];return _0x3ff5c8;};'use strict';var Sequelize=require(_0x99a3('0x0'));module[_0x99a3('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x99a3('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x99a3('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fee6546..0d77f74 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 _0x87ce=['VIRTUAL','options','where','includeAll','include','ChatInternalMessage','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','get','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','read','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./chatInternalMessage.socket','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type'];(function(_0x5e75ef,_0x4ce765){var _0x3c28b2=function(_0x29a66c){while(--_0x29a66c){_0x5e75ef['push'](_0x5e75ef['shift']());}};_0x3c28b2(++_0x4ce765);}(_0x87ce,0xa4));var _0xe87c=function(_0x44d510,_0xa1eebb){_0x44d510=_0x44d510-0x0;var _0x156bcb=_0x87ce[_0x44d510];return _0x156bcb;};'use strict';var emlformat=require(_0xe87c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe87c('0x1'));var rp=require(_0xe87c('0x2'));var moment=require(_0xe87c('0x3'));var BPromise=require(_0xe87c('0x4'));var Mustache=require(_0xe87c('0x5'));var util=require(_0xe87c('0x6'));var path=require(_0xe87c('0x7'));var sox=require(_0xe87c('0x8'));var csv=require('to-csv');var ejs=require(_0xe87c('0x9'));var fs=require('fs');var fs_extra=require(_0xe87c('0xa'));var _=require(_0xe87c('0xb'));var squel=require(_0xe87c('0xc'));var crypto=require('crypto');var jsforce=require(_0xe87c('0xd'));var deskjs=require(_0xe87c('0xe'));var toCsv=require(_0xe87c('0xf'));var querystring=require(_0xe87c('0x10'));var Papa=require(_0xe87c('0x11'));var Redis=require(_0xe87c('0x12'));var authService=require(_0xe87c('0x13'));var qs=require(_0xe87c('0x14'));var as=require(_0xe87c('0x15'));var hardwareService=require(_0xe87c('0x16'));var logger=require(_0xe87c('0x17'))(_0xe87c('0x18'));var utils=require(_0xe87c('0x19'));var config=require(_0xe87c('0x1a'));var licenseUtil=require(_0xe87c('0x1b'));var db=require(_0xe87c('0x1c'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe87c('0x1d'))(new Redis(config[_0xe87c('0x1e')]));require(_0xe87c('0x1f'))['register'](socket);function respondWithStatusCode(_0x3e926b,_0x4f102a){_0x4f102a=_0x4f102a||0xcc;return function(_0x37d9cd){if(_0x37d9cd){return _0x3e926b['sendStatus'](_0x4f102a);}return _0x3e926b[_0xe87c('0x20')](_0x4f102a)['end']();};}function respondWithResult(_0x66eb16,_0x12d397){_0x12d397=_0x12d397||0xc8;return function(_0x145105){if(_0x145105){return _0x66eb16[_0xe87c('0x20')](_0x12d397)[_0xe87c('0x21')](_0x145105);}};}function respondWithFilteredResult(_0x5f4b58,_0x5ad4bf){return function(_0x4517c5){if(_0x4517c5){var _0x4ad234=typeof _0x5ad4bf[_0xe87c('0x22')]===_0xe87c('0x23')&&typeof _0x5ad4bf[_0xe87c('0x24')]===_0xe87c('0x23');var _0x1b344b=_0x4517c5[_0xe87c('0x25')];var _0x276bc1=_0x4ad234?0x0:_0x5ad4bf['offset'];var _0x23ca74=_0x4ad234?_0x4517c5[_0xe87c('0x25')]:_0x5ad4bf[_0xe87c('0x22')]+_0x5ad4bf[_0xe87c('0x24')];var _0x5d09ac;if(_0x23ca74>=_0x1b344b){_0x23ca74=_0x1b344b;_0x5d09ac=0xc8;}else{_0x5d09ac=0xce;}_0x5f4b58['status'](_0x5d09ac);return _0x5f4b58[_0xe87c('0x26')](_0xe87c('0x27'),_0x276bc1+'-'+_0x23ca74+'/'+_0x1b344b)[_0xe87c('0x21')](_0x4517c5);}return null;};}function patchUpdates(_0xbe7528){return function(_0x15f33e){try{jsonpatch[_0xe87c('0x28')](_0x15f33e,_0xbe7528,!![]);}catch(_0x466b93){return BPromise[_0xe87c('0x29')](_0x466b93);}return _0x15f33e[_0xe87c('0x2a')]();};}function saveUpdates(_0x5a9633,_0x5d7a99){return function(_0x57218f){if(_0x57218f){return _0x57218f[_0xe87c('0x2b')](_0x5a9633)[_0xe87c('0x2c')](function(_0xfc965){return _0xfc965;});}return null;};}function removeEntity(_0x43b257,_0x33f3d3){return function(_0x3d6105){if(_0x3d6105){return _0x3d6105['destroy']()[_0xe87c('0x2c')](function(){_0x43b257[_0xe87c('0x20')](0xcc)[_0xe87c('0x2d')]();});}};}function handleEntityNotFound(_0x92110d,_0x58fcb6){return function(_0x271f72){if(!_0x271f72){_0x92110d[_0xe87c('0x2e')](0x194);}return _0x271f72;};}function handleError(_0x1b3193,_0x44d706){_0x44d706=_0x44d706||0x1f4;return function(_0x39dff5){logger['error'](_0x39dff5[_0xe87c('0x2f')]);if(_0x39dff5[_0xe87c('0x30')]){delete _0x39dff5['name'];}_0x1b3193['status'](_0x44d706)[_0xe87c('0x31')](_0x39dff5);};}exports[_0xe87c('0x32')]=function(_0x73b89d,_0x10b03c){var _0x2b1eb0={},_0x980157={},_0x4d96a7={'count':0x0,'rows':[]};var _0x266829=_[_0xe87c('0x33')](db['ChatInternalMessage'][_0xe87c('0x34')],function(_0x3c0456){return{'name':_0x3c0456[_0xe87c('0x35')],'type':_0x3c0456['type'][_0xe87c('0x36')]};});_0x980157[_0xe87c('0x37')]=_[_0xe87c('0x33')](_0x266829,_0xe87c('0x30'));_0x980157['query']=_[_0xe87c('0x38')](_0x73b89d[_0xe87c('0x39')]);_0x980157[_0xe87c('0x3a')]=_[_0xe87c('0x3b')](_0x980157[_0xe87c('0x37')],_0x980157['query']);_0x2b1eb0[_0xe87c('0x3c')]=_[_0xe87c('0x3b')](_0x980157[_0xe87c('0x37')],qs['fields'](_0x73b89d[_0xe87c('0x39')][_0xe87c('0x3d')]));_0x2b1eb0[_0xe87c('0x3c')]=_0x2b1eb0['attributes']['length']?_0x2b1eb0[_0xe87c('0x3c')]:_0x980157[_0xe87c('0x37')];if(!_0x73b89d[_0xe87c('0x39')][_0xe87c('0x3e')](_0xe87c('0x3f'))){_0x2b1eb0['limit']=qs[_0xe87c('0x24')](_0x73b89d[_0xe87c('0x39')][_0xe87c('0x24')]);_0x2b1eb0[_0xe87c('0x22')]=qs[_0xe87c('0x22')](_0x73b89d[_0xe87c('0x39')][_0xe87c('0x22')]);}_0x2b1eb0[_0xe87c('0x40')]=qs[_0xe87c('0x41')](_0x73b89d['query'][_0xe87c('0x41')]);_0x2b1eb0['where']=qs[_0xe87c('0x3a')](_[_0xe87c('0x42')](_0x73b89d[_0xe87c('0x39')],_0x980157[_0xe87c('0x3a')]),_0x266829);if(_0x73b89d['query'][_0xe87c('0x43')]){_0x2b1eb0['where']=_[_0xe87c('0x44')](_0x2b1eb0['where'],{'$or':_['map'](_0x266829,function(_0xf9d67b){if(_0xf9d67b[_0xe87c('0x45')]!==_0xe87c('0x46')){var _0xa26c44={};_0xa26c44[_0xf9d67b[_0xe87c('0x30')]]={'$like':'%'+_0x73b89d[_0xe87c('0x39')][_0xe87c('0x43')]+'%'};return _0xa26c44;}})});}_0x2b1eb0=_['merge']({},_0x2b1eb0,_0x73b89d[_0xe87c('0x47')]);var _0x5c5999={'where':_0x2b1eb0[_0xe87c('0x48')]};return db['ChatInternalMessage']['count'](_0x5c5999)[_0xe87c('0x2c')](function(_0x3849ef){_0x4d96a7[_0xe87c('0x25')]=_0x3849ef;if(_0x73b89d['query'][_0xe87c('0x49')]){_0x2b1eb0[_0xe87c('0x4a')]=[{'all':!![]}];}return db[_0xe87c('0x4b')][_0xe87c('0x4c')](_0x2b1eb0);})[_0xe87c('0x2c')](function(_0x34e40a){_0x4d96a7[_0xe87c('0x4d')]=_0x34e40a;return _0x4d96a7;})[_0xe87c('0x2c')](respondWithFilteredResult(_0x10b03c,_0x2b1eb0))[_0xe87c('0x4e')](handleError(_0x10b03c,null));};exports[_0xe87c('0x4f')]=function(_0x4bbe85,_0xcbe8b5){var _0x5acd21={'raw':!![],'where':{'id':_0x4bbe85['params']['id']}},_0x4fa0d1={};_0x4fa0d1[_0xe87c('0x37')]=_[_0xe87c('0x38')](db[_0xe87c('0x4b')]['rawAttributes']);_0x4fa0d1[_0xe87c('0x39')]=_['keys'](_0x4bbe85[_0xe87c('0x39')]);_0x4fa0d1[_0xe87c('0x3a')]=_[_0xe87c('0x3b')](_0x4fa0d1[_0xe87c('0x37')],_0x4fa0d1['query']);_0x5acd21[_0xe87c('0x3c')]=_[_0xe87c('0x3b')](_0x4fa0d1[_0xe87c('0x37')],qs[_0xe87c('0x3d')](_0x4bbe85[_0xe87c('0x39')][_0xe87c('0x3d')]));_0x5acd21[_0xe87c('0x3c')]=_0x5acd21[_0xe87c('0x3c')][_0xe87c('0x50')]?_0x5acd21[_0xe87c('0x3c')]:_0x4fa0d1[_0xe87c('0x37')];if(_0x4bbe85[_0xe87c('0x39')][_0xe87c('0x49')]){_0x5acd21[_0xe87c('0x4a')]=[{'all':!![]}];}_0x5acd21=_[_0xe87c('0x44')]({},_0x5acd21,_0x4bbe85['options']);return db['ChatInternalMessage'][_0xe87c('0x51')](_0x5acd21)[_0xe87c('0x2c')](handleEntityNotFound(_0xcbe8b5,null))['then'](respondWithResult(_0xcbe8b5,null))[_0xe87c('0x4e')](handleError(_0xcbe8b5,null));};exports['create']=function(_0x489f1e,_0x162ad6){return db[_0xe87c('0x4b')][_0xe87c('0x52')](_0x489f1e[_0xe87c('0x53')],{})[_0xe87c('0x2c')](respondWithResult(_0x162ad6,0xc9))[_0xe87c('0x4e')](handleError(_0x162ad6,null));};exports['update']=function(_0xfc3003,_0x57be06){if(_0xfc3003[_0xe87c('0x53')]['id']){delete _0xfc3003[_0xe87c('0x53')]['id'];}return db[_0xe87c('0x4b')][_0xe87c('0x51')]({'where':{'id':_0xfc3003[_0xe87c('0x54')]['id']}})[_0xe87c('0x2c')](handleEntityNotFound(_0x57be06,null))[_0xe87c('0x2c')](saveUpdates(_0xfc3003[_0xe87c('0x53')],null))[_0xe87c('0x2c')](respondWithResult(_0x57be06,null))[_0xe87c('0x4e')](handleError(_0x57be06,null));};exports[_0xe87c('0x55')]=function(_0x3b544a,_0x50bb31){return db['ChatInternalMessage'][_0xe87c('0x51')]({'where':{'id':_0x3b544a['params']['id']}})[_0xe87c('0x2c')](handleEntityNotFound(_0x50bb31,null))['then'](removeEntity(_0x50bb31,null))[_0xe87c('0x4e')](handleError(_0x50bb31,null));};exports[_0xe87c('0x56')]=function(_0x5d2bbc,_0x4e212b){return db[_0xe87c('0x4b')][_0xe87c('0x56')]()['then'](respondWithResult(_0x4e212b,null))['catch'](handleError(_0x4e212b,null));};function wrapUser(_0x48b972){return function(_0x3834dd){var _0x2fcc0f=_0x48b972[_0xe87c('0x57')]({'plain':!![]});_0x2fcc0f['messages']=[];if(_0x3834dd){_0x2fcc0f['lastMessageAt']=_0x3834dd[_0xe87c('0x58')];_0x2fcc0f[_0xe87c('0x59')]=_0x3834dd;}else{_0x2fcc0f[_0xe87c('0x5a')]=moment(0x0)['format'](_0xe87c('0x5b'));_0x2fcc0f[_0xe87c('0x59')]={};}return _0x2fcc0f;};}exports[_0xe87c('0x5c')]=function(_0x288b71,_0x3e43c1,_0x3180eb){var _0x4447b5=[];return db[_0xe87c('0x5d')][_0xe87c('0x4c')]({'where':{'role':[_0xe87c('0x5e'),_0xe87c('0x5f'),_0xe87c('0x60')]},'attributes':['id',_0xe87c('0x61'),_0xe87c('0x30'),_0xe87c('0x62'),'userpic',_0xe87c('0x63'),_0xe87c('0x64'),_0xe87c('0x65'),_0xe87c('0x66'),_0xe87c('0x67')],'order':qs[_0xe87c('0x41')](_0xe87c('0x68')),'include':[{'model':db[_0xe87c('0x69')],'as':'VoiceQueues','attributes':['id',_0xe87c('0x30'),_0xe87c('0x45')],'through':{'attributes':[]}}]})[_0xe87c('0x2c')](function(_0x539504){if(_0x539504){var _0xea84a4=_0x288b71[_0xe87c('0x60')][_0xe87c('0x57')]({'plain':!![]});if(!_0xea84a4)throw new Error(_0xe87c('0x6a'));if(_0xea84a4[_0xe87c('0x62')]===_0xe87c('0x60')){return db[_0xe87c('0x6b')]['find']({'where':{'name':_0xe87c('0x6c'),'userProfileId':_0xea84a4[_0xe87c('0x6d')]},'raw':!![]})['then'](function(_0x2954f9){if(_0x2954f9){if(_0x2954f9[_0xe87c('0x6e')]===0x0){return db[_0xe87c('0x6f')][_0xe87c('0x4c')]({'where':{'sectionId':_0x2954f9['id']},'raw':!![]})[_0xe87c('0x2c')](function(_0x27d705){var _0x887f75=[];if(_[_0xe87c('0x70')](_0x27d705)){_0x887f75=_[_0xe87c('0x43')](_0x539504,function(_0x56cb58){if(_0x56cb58[_0xe87c('0x62')]!==_0xe87c('0x5e')){return _0x56cb58;}});return _0x887f75;}else{for(var _0x175a9d=0x0;_0x175a9d<_0x539504[_0xe87c('0x50')];_0x175a9d++){var _0x1724c5=_0x539504[_0x175a9d];if(_0x1724c5[_0xe87c('0x62')]===_0xe87c('0x5e')){var _0x261073=_[_0xe87c('0x51')](_0x27d705,function(_0x581c9d){return _0x581c9d[_0xe87c('0x71')]===_0x1724c5['id'];});if(_0x261073)_0x887f75['push'](_0x1724c5);}else{_0x887f75[_0xe87c('0x72')](_0x1724c5);}}return _0x887f75;}});}else{return _0x539504;}}else{var _0x4322d5=_[_0xe87c('0x43')](_0x539504,function(_0x183b1b){if(_0x183b1b[_0xe87c('0x62')]!==_0xe87c('0x5e')){return _0x183b1b;}});return _0x4322d5;}});}else{return _0x539504;}}})[_0xe87c('0x2c')](function(_0x4283f4){var _0x259896=[];if(_0x4283f4){_0x4447b5=_0x4283f4;for(var _0x54f161=0x0;_0x54f161<_0x4283f4[_0xe87c('0x50')];_0x54f161+=0x1){_0x4447b5[_0x54f161][_0xe87c('0x73')]=[];_0x259896['push'](db['ChatInternalMessage'][_0xe87c('0x51')]({'where':{'FromId':[_0x288b71[_0xe87c('0x60')]['id'],_0x4283f4[_0x54f161]['id']],'ToId':[_0x288b71[_0xe87c('0x60')]['id'],_0x4283f4[_0x54f161]['id']],'ChatGroupId':null},'attributes':['id',_0xe87c('0x58'),'FromId','ToId',_0xe87c('0x74'),_0xe87c('0x53')],'order':qs[_0xe87c('0x41')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe87c('0x2c')](wrapUser(_0x4283f4[_0x54f161])));}return BPromise['all'](_0x259896);}return[];})['then'](function(_0x46e2e8){return{'rows':_0x46e2e8,'count':_0x46e2e8[_0xe87c('0x50')]};})[_0xe87c('0x2c')](respondWithResult(_0x3e43c1,null))['catch'](handleError(_0x3e43c1,null));}; \ No newline at end of file +var _0xf91e=['findAll','rows','catch','show','params','keys','find','update','body','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','name','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','include'];(function(_0x1fa0e7,_0x4aa291){var _0x4b8d19=function(_0x572c1e){while(--_0x572c1e){_0x1fa0e7['push'](_0x1fa0e7['shift']());}};_0x4b8d19(++_0x4aa291);}(_0xf91e,0x176));var _0xef91=function(_0xfaecee,_0x2b764c){_0xfaecee=_0xfaecee-0x0;var _0x306c65=_0xf91e[_0xfaecee];return _0x306c65;};'use strict';var emlformat=require(_0xef91('0x0'));var rimraf=require(_0xef91('0x1'));var zipdir=require(_0xef91('0x2'));var jsonpatch=require(_0xef91('0x3'));var rp=require(_0xef91('0x4'));var moment=require(_0xef91('0x5'));var BPromise=require(_0xef91('0x6'));var Mustache=require(_0xef91('0x7'));var util=require(_0xef91('0x8'));var path=require('path');var sox=require(_0xef91('0x9'));var csv=require('to-csv');var ejs=require(_0xef91('0xa'));var fs=require('fs');var fs_extra=require(_0xef91('0xb'));var _=require('lodash');var squel=require(_0xef91('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xef91('0xd'));var toCsv=require('to-csv');var querystring=require(_0xef91('0xe'));var Papa=require('papaparse');var Redis=require(_0xef91('0xf'));var authService=require(_0xef91('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xef91('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef91('0x12'))('api');var utils=require(_0xef91('0x13'));var config=require(_0xef91('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xef91('0x15'))['db'];config[_0xef91('0x16')]=_[_0xef91('0x17')](config[_0xef91('0x16')],{'host':_0xef91('0x18'),'port':0x18eb});var socket=require(_0xef91('0x19'))(new Redis(config[_0xef91('0x16')]));require(_0xef91('0x1a'))[_0xef91('0x1b')](socket);function respondWithStatusCode(_0x58be23,_0x57a8e9){_0x57a8e9=_0x57a8e9||0xcc;return function(_0x3bec80){if(_0x3bec80){return _0x58be23[_0xef91('0x1c')](_0x57a8e9);}return _0x58be23[_0xef91('0x1d')](_0x57a8e9)[_0xef91('0x1e')]();};}function respondWithResult(_0x21ba3e,_0x369575){_0x369575=_0x369575||0xc8;return function(_0x183a8f){if(_0x183a8f){return _0x21ba3e[_0xef91('0x1d')](_0x369575)[_0xef91('0x1f')](_0x183a8f);}};}function respondWithFilteredResult(_0x2c364a,_0x16de23){return function(_0x384ea0){if(_0x384ea0){var _0x10b208=typeof _0x16de23[_0xef91('0x20')]==='undefined'&&typeof _0x16de23[_0xef91('0x21')]===_0xef91('0x22');var _0x7a2754=_0x384ea0[_0xef91('0x23')];var _0xf2af0=_0x10b208?0x0:_0x16de23[_0xef91('0x20')];var _0x3d7196=_0x10b208?_0x384ea0[_0xef91('0x23')]:_0x16de23[_0xef91('0x20')]+_0x16de23[_0xef91('0x21')];var _0x1be159;if(_0x3d7196>=_0x7a2754){_0x3d7196=_0x7a2754;_0x1be159=0xc8;}else{_0x1be159=0xce;}_0x2c364a[_0xef91('0x1d')](_0x1be159);return _0x2c364a[_0xef91('0x24')](_0xef91('0x25'),_0xf2af0+'-'+_0x3d7196+'/'+_0x7a2754)[_0xef91('0x1f')](_0x384ea0);}return null;};}function patchUpdates(_0x408c73){return function(_0x328331){try{jsonpatch[_0xef91('0x26')](_0x328331,_0x408c73,!![]);}catch(_0x4dbdb1){return BPromise[_0xef91('0x27')](_0x4dbdb1);}return _0x328331[_0xef91('0x28')]();};}function saveUpdates(_0x528c96,_0x26a03b){return function(_0x3f0978){if(_0x3f0978){return _0x3f0978['update'](_0x528c96)[_0xef91('0x29')](function(_0x4802ca){return _0x4802ca;});}return null;};}function removeEntity(_0x1205d8,_0x286549){return function(_0x2823a2){if(_0x2823a2){return _0x2823a2['destroy']()[_0xef91('0x29')](function(){_0x1205d8[_0xef91('0x1d')](0xcc)[_0xef91('0x1e')]();});}};}function handleEntityNotFound(_0x30d3ff,_0x2b54cb){return function(_0x3fcb6f){if(!_0x3fcb6f){_0x30d3ff[_0xef91('0x1c')](0x194);}return _0x3fcb6f;};}function handleError(_0x22d2bd,_0x54214a){_0x54214a=_0x54214a||0x1f4;return function(_0xcbdde0){logger[_0xef91('0x2a')](_0xcbdde0[_0xef91('0x2b')]);if(_0xcbdde0['name']){delete _0xcbdde0['name'];}_0x22d2bd[_0xef91('0x1d')](_0x54214a)[_0xef91('0x2c')](_0xcbdde0);};}exports['index']=function(_0x7f4576,_0x5775f6){var _0x15a876={},_0x56cad0={},_0x4a34db={'count':0x0,'rows':[]};var _0x306e80=_[_0xef91('0x2d')](db[_0xef91('0x2e')][_0xef91('0x2f')],function(_0x35dd72){return{'name':_0x35dd72[_0xef91('0x30')],'type':_0x35dd72[_0xef91('0x31')][_0xef91('0x32')]};});_0x56cad0['model']=_['map'](_0x306e80,_0xef91('0x33'));_0x56cad0[_0xef91('0x34')]=_['keys'](_0x7f4576[_0xef91('0x34')]);_0x56cad0['filters']=_[_0xef91('0x35')](_0x56cad0[_0xef91('0x36')],_0x56cad0[_0xef91('0x34')]);_0x15a876[_0xef91('0x37')]=_[_0xef91('0x35')](_0x56cad0[_0xef91('0x36')],qs[_0xef91('0x38')](_0x7f4576[_0xef91('0x34')][_0xef91('0x38')]));_0x15a876[_0xef91('0x37')]=_0x15a876[_0xef91('0x37')][_0xef91('0x39')]?_0x15a876['attributes']:_0x56cad0['model'];if(!_0x7f4576[_0xef91('0x34')][_0xef91('0x3a')]('nolimit')){_0x15a876[_0xef91('0x21')]=qs[_0xef91('0x21')](_0x7f4576['query'][_0xef91('0x21')]);_0x15a876[_0xef91('0x20')]=qs['offset'](_0x7f4576[_0xef91('0x34')][_0xef91('0x20')]);}_0x15a876[_0xef91('0x3b')]=qs[_0xef91('0x3c')](_0x7f4576[_0xef91('0x34')]['sort']);_0x15a876['where']=qs[_0xef91('0x3d')](_[_0xef91('0x3e')](_0x7f4576['query'],_0x56cad0['filters']),_0x306e80);if(_0x7f4576['query'][_0xef91('0x3f')]){_0x15a876['where']=_[_0xef91('0x40')](_0x15a876['where'],{'$or':_[_0xef91('0x2d')](_0x306e80,function(_0x25c342){if(_0x25c342[_0xef91('0x31')]!==_0xef91('0x41')){var _0x318ed7={};_0x318ed7[_0x25c342[_0xef91('0x33')]]={'$like':'%'+_0x7f4576[_0xef91('0x34')]['filter']+'%'};return _0x318ed7;}})});}_0x15a876=_[_0xef91('0x40')]({},_0x15a876,_0x7f4576[_0xef91('0x42')]);var _0x5369ad={'where':_0x15a876[_0xef91('0x43')]};return db[_0xef91('0x2e')][_0xef91('0x23')](_0x5369ad)[_0xef91('0x29')](function(_0x5e70e0){_0x4a34db[_0xef91('0x23')]=_0x5e70e0;if(_0x7f4576[_0xef91('0x34')][_0xef91('0x44')]){_0x15a876[_0xef91('0x45')]=[{'all':!![]}];}return db[_0xef91('0x2e')][_0xef91('0x46')](_0x15a876);})['then'](function(_0x258918){_0x4a34db[_0xef91('0x47')]=_0x258918;return _0x4a34db;})[_0xef91('0x29')](respondWithFilteredResult(_0x5775f6,_0x15a876))[_0xef91('0x48')](handleError(_0x5775f6,null));};exports[_0xef91('0x49')]=function(_0x236fe3,_0x5e3117){var _0x2e12bc={'raw':!![],'where':{'id':_0x236fe3[_0xef91('0x4a')]['id']}},_0x3c047f={};_0x3c047f['model']=_[_0xef91('0x4b')](db['ChatInternalMessage'][_0xef91('0x2f')]);_0x3c047f[_0xef91('0x34')]=_[_0xef91('0x4b')](_0x236fe3[_0xef91('0x34')]);_0x3c047f[_0xef91('0x3d')]=_[_0xef91('0x35')](_0x3c047f[_0xef91('0x36')],_0x3c047f['query']);_0x2e12bc['attributes']=_[_0xef91('0x35')](_0x3c047f[_0xef91('0x36')],qs['fields'](_0x236fe3[_0xef91('0x34')][_0xef91('0x38')]));_0x2e12bc['attributes']=_0x2e12bc[_0xef91('0x37')]['length']?_0x2e12bc[_0xef91('0x37')]:_0x3c047f['model'];if(_0x236fe3['query']['includeAll']){_0x2e12bc[_0xef91('0x45')]=[{'all':!![]}];}_0x2e12bc=_[_0xef91('0x40')]({},_0x2e12bc,_0x236fe3['options']);return db[_0xef91('0x2e')][_0xef91('0x4c')](_0x2e12bc)[_0xef91('0x29')](handleEntityNotFound(_0x5e3117,null))[_0xef91('0x29')](respondWithResult(_0x5e3117,null))['catch'](handleError(_0x5e3117,null));};exports['create']=function(_0x46b195,_0x5704d9){return db['ChatInternalMessage']['create'](_0x46b195['body'],{})[_0xef91('0x29')](respondWithResult(_0x5704d9,0xc9))[_0xef91('0x48')](handleError(_0x5704d9,null));};exports[_0xef91('0x4d')]=function(_0x22629d,_0x330eb2){if(_0x22629d[_0xef91('0x4e')]['id']){delete _0x22629d[_0xef91('0x4e')]['id'];}return db[_0xef91('0x2e')][_0xef91('0x4c')]({'where':{'id':_0x22629d[_0xef91('0x4a')]['id']}})[_0xef91('0x29')](handleEntityNotFound(_0x330eb2,null))[_0xef91('0x29')](saveUpdates(_0x22629d[_0xef91('0x4e')],null))[_0xef91('0x29')](respondWithResult(_0x330eb2,null))['catch'](handleError(_0x330eb2,null));};exports[_0xef91('0x4f')]=function(_0x14ab48,_0x502248){return db[_0xef91('0x2e')][_0xef91('0x4c')]({'where':{'id':_0x14ab48[_0xef91('0x4a')]['id']}})[_0xef91('0x29')](handleEntityNotFound(_0x502248,null))[_0xef91('0x29')](removeEntity(_0x502248,null))[_0xef91('0x48')](handleError(_0x502248,null));};exports[_0xef91('0x50')]=function(_0x113853,_0x4477c5){return db['ChatInternalMessage']['describe']()[_0xef91('0x29')](respondWithResult(_0x4477c5,null))[_0xef91('0x48')](handleError(_0x4477c5,null));};function wrapUser(_0x1a2882){return function(_0x38ce40){var _0xd4745=_0x1a2882['get']({'plain':!![]});_0xd4745[_0xef91('0x51')]=[];if(_0x38ce40){_0xd4745[_0xef91('0x52')]=_0x38ce40[_0xef91('0x53')];_0xd4745[_0xef91('0x54')]=_0x38ce40;}else{_0xd4745[_0xef91('0x52')]=moment(0x0)[_0xef91('0x55')](_0xef91('0x56'));_0xd4745[_0xef91('0x54')]={};}return _0xd4745;};}exports['getUsers']=function(_0xfade99,_0x52d4d6,_0x58a52d){var _0x23335f=[];return db[_0xef91('0x57')][_0xef91('0x46')]({'where':{'role':[_0xef91('0x58'),_0xef91('0x59'),_0xef91('0x5a')]},'attributes':['id','fullname','name',_0xef91('0x5b'),_0xef91('0x5c'),_0xef91('0x5d'),_0xef91('0x5e'),_0xef91('0x5f'),'allowmessenger',_0xef91('0x60')],'order':qs['sort'](_0xef91('0x61')),'include':[{'model':db[_0xef91('0x62')],'as':_0xef91('0x63'),'attributes':['id',_0xef91('0x33'),_0xef91('0x31')],'through':{'attributes':[]}}]})[_0xef91('0x29')](function(_0x361282){if(_0x361282){var _0x11aec5=_0xfade99[_0xef91('0x5a')]['get']({'plain':!![]});if(!_0x11aec5)throw new Error(_0xef91('0x64'));if(_0x11aec5['role']===_0xef91('0x5a')){return db[_0xef91('0x65')][_0xef91('0x4c')]({'where':{'name':'Agents','userProfileId':_0x11aec5[_0xef91('0x66')]},'raw':!![]})['then'](function(_0x34cbbd){if(_0x34cbbd){if(_0x34cbbd['autoAssociation']===0x0){return db[_0xef91('0x67')][_0xef91('0x46')]({'where':{'sectionId':_0x34cbbd['id']},'raw':!![]})[_0xef91('0x29')](function(_0x2ab10e){var _0x500411=[];if(_[_0xef91('0x68')](_0x2ab10e)){_0x500411=_[_0xef91('0x3f')](_0x361282,function(_0x4876f6){if(_0x4876f6[_0xef91('0x5b')]!=='agent'){return _0x4876f6;}});return _0x500411;}else{for(var _0x2b122d=0x0;_0x2b122d<_0x361282['length'];_0x2b122d++){var _0x53e16d=_0x361282[_0x2b122d];if(_0x53e16d[_0xef91('0x5b')]==='agent'){var _0x539ecf=_[_0xef91('0x4c')](_0x2ab10e,function(_0x20da17){return _0x20da17[_0xef91('0x69')]===_0x53e16d['id'];});if(_0x539ecf)_0x500411[_0xef91('0x6a')](_0x53e16d);}else{_0x500411['push'](_0x53e16d);}}return _0x500411;}});}else{return _0x361282;}}else{var _0x950a7c=_[_0xef91('0x3f')](_0x361282,function(_0x683395){if(_0x683395[_0xef91('0x5b')]!==_0xef91('0x58')){return _0x683395;}});return _0x950a7c;}});}else{return _0x361282;}}})['then'](function(_0x38d9d8){var _0x879c=[];if(_0x38d9d8){_0x23335f=_0x38d9d8;for(var _0x44442d=0x0;_0x44442d<_0x38d9d8[_0xef91('0x39')];_0x44442d+=0x1){_0x23335f[_0x44442d][_0xef91('0x51')]=[];_0x879c['push'](db[_0xef91('0x2e')]['find']({'where':{'FromId':[_0xfade99['user']['id'],_0x38d9d8[_0x44442d]['id']],'ToId':[_0xfade99[_0xef91('0x5a')]['id'],_0x38d9d8[_0x44442d]['id']],'ChatGroupId':null},'attributes':['id',_0xef91('0x53'),_0xef91('0x6b'),_0xef91('0x6c'),_0xef91('0x6d'),_0xef91('0x4e')],'order':qs[_0xef91('0x3c')](_0xef91('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xef91('0x29')](wrapUser(_0x38d9d8[_0x44442d])));}return BPromise['all'](_0x879c);}return[];})[_0xef91('0x29')](function(_0x1cf789){return{'rows':_0x1cf789,'count':_0x1cf789[_0xef91('0x39')]};})[_0xef91('0x29')](respondWithResult(_0x52d4d6,null))[_0xef91('0x48')](handleError(_0x52d4d6,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1b57db9..11cb76c 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 _0x6b09=['exports','events','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4a2529,_0x3b3082){var _0x1f6f12=function(_0x35681e){while(--_0x35681e){_0x4a2529['push'](_0x4a2529['shift']());}};_0x1f6f12(++_0x3b3082);}(_0x6b09,0x17d));var _0x96b0=function(_0x45ce90,_0x114609){_0x45ce90=_0x45ce90-0x0;var _0x313c45=_0x6b09[_0x45ce90];return _0x313c45;};'use strict';var EventEmitter=require(_0x96b0('0x0'));var ChatInternalMessage=require(_0x96b0('0x1'))['db'][_0x96b0('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x96b0('0x3'),'afterUpdate':_0x96b0('0x4'),'afterDestroy':_0x96b0('0x5')};function emitEvent(_0x45c7da){return function(_0x31fc97,_0xa76b50,_0x16e3bd){ChatInternalMessageEvents['emit'](_0x45c7da+':'+_0x31fc97['id'],_0x31fc97);ChatInternalMessageEvents[_0x96b0('0x6')](_0x45c7da,_0x31fc97);_0x16e3bd(null);};}for(var e in events){if(events[_0x96b0('0x7')](e)){var event=events[e];ChatInternalMessage[_0x96b0('0x8')](e,emitEvent(event));}}module[_0x96b0('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb1a6=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','save','update'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0xb1a6,0x143));var _0x6b1a=function(_0x5e8efc,_0x2e71eb){_0x5e8efc=_0x5e8efc-0x0;var _0x33dd03=_0xb1a6[_0x5e8efc];return _0x33dd03;};'use strict';var EventEmitter=require(_0x6b1a('0x0'));var ChatInternalMessage=require(_0x6b1a('0x1'))['db'][_0x6b1a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b1a('0x3'),'afterUpdate':_0x6b1a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x25c003){return function(_0xb2058d,_0x17a3d9,_0x157bdd){ChatInternalMessageEvents['emit'](_0x25c003+':'+_0xb2058d['id'],_0xb2058d);ChatInternalMessageEvents[_0x6b1a('0x5')](_0x25c003,_0xb2058d);_0x157bdd(null);};}for(var e in events){if(events[_0x6b1a('0x6')](e)){var event=events[e];ChatInternalMessage[_0x6b1a('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 13c4204..ec4fac4 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 _0x2a24=['./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x50dcd8,_0x7c96d1){var _0x2bdc68=function(_0x175198){while(--_0x175198){_0x50dcd8['push'](_0x50dcd8['shift']());}};_0x2bdc68(++_0x7c96d1);}(_0x2a24,0xe0));var _0x42a2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2a24[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x42a2('0x0'));var util=require('util');var logger=require(_0x42a2('0x1'))('api');var moment=require(_0x42a2('0x2'));var BPromise=require(_0x42a2('0x3'));var rp=require(_0x42a2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42a2('0x5'));var config=require(_0x42a2('0x6'));var attributes=require(_0x42a2('0x7'));module[_0x42a2('0x8')]=function(_0x4be38a,_0x1e1cdd){return _0x4be38a['define'](_0x42a2('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x42a2('0xa')});}; \ No newline at end of file +var _0xf453=['path','rimraf','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x5d2f39,_0x11e2f4){var _0x3df8f6=function(_0x50eeaf){while(--_0x50eeaf){_0x5d2f39['push'](_0x5d2f39['shift']());}};_0x3df8f6(++_0x11e2f4);}(_0xf453,0xbc));var _0x3f45=function(_0x689841,_0x2718e4){_0x689841=_0x689841-0x0;var _0x283fdf=_0xf453[_0x689841];return _0x283fdf;};'use strict';var _=require(_0x3f45('0x0'));var util=require(_0x3f45('0x1'));var logger=require(_0x3f45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3f45('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f45('0x4'));var rimraf=require(_0x3f45('0x5'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x3f45('0x6')]=function(_0x205f0a,_0x2e1068){return _0x205f0a[_0x3f45('0x7')](_0x3f45('0x8'),attributes,{'tableName':_0x3f45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f45('0xa'),'collate':_0x3f45('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index a9a424b..8c8b367 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 _0x370d=['error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e215a,_0x41fc9a){var _0x18d22a=function(_0x59c683){while(--_0x59c683){_0x1e215a['push'](_0x1e215a['shift']());}};_0x18d22a(++_0x41fc9a);}(_0x370d,0xc6));var _0xd370=function(_0xffe27f,_0x5c2bbb){_0xffe27f=_0xffe27f-0x0;var _0x354510=_0x370d[_0xffe27f];return _0x354510;};'use strict';var _=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var moment=require('moment');var BPromise=require(_0xd370('0x2'));var rs=require(_0xd370('0x3'));var fs=require('fs');var Redis=require(_0xd370('0x4'));var db=require(_0xd370('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd370('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd370('0x7')]({'port':0x232a});config[_0xd370('0x8')]=_[_0xd370('0x9')](config[_0xd370('0x8')],{'host':_0xd370('0xa'),'port':0x18eb});var socket=require(_0xd370('0xb'))(new Redis(config[_0xd370('0x8')]));require(_0xd370('0xc'))['register'](socket);function respondWithRpcPromise(_0x438297,_0x118ae2,_0x2f2181){return new BPromise(function(_0x494667,_0x36e395){return client[_0xd370('0xd')](_0x438297,_0x2f2181)['then'](function(_0x416544){logger[_0xd370('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x118ae2,_0xd370('0xf'));logger['debug'](_0xd370('0x10'),_0x118ae2,_0xd370('0xf'),JSON[_0xd370('0x11')](_0x416544));if(_0x416544[_0xd370('0x12')]){if(_0x416544[_0xd370('0x12')][_0xd370('0x13')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x118ae2,_0x416544[_0xd370('0x12')][_0xd370('0x14')]);return _0x36e395(_0x416544[_0xd370('0x12')]['message']);}logger['error'](_0xd370('0x15'),_0x118ae2,_0x416544[_0xd370('0x12')][_0xd370('0x14')]);return _0x494667(_0x416544[_0xd370('0x12')][_0xd370('0x14')]);}else{logger[_0xd370('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x118ae2,'request\x20sent');_0x494667(_0x416544[_0xd370('0x16')][_0xd370('0x14')]);}})[_0xd370('0x17')](function(_0x44edb8){logger[_0xd370('0x12')](_0xd370('0x15'),_0x118ae2,_0x44edb8);_0x36e395(_0x44edb8);});});} \ No newline at end of file +var _0x49c2=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x49c2,0x176));var _0x249c=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0x49c2[_0xae1a83];return _0xdb9da8;};'use strict';var _=require(_0x249c('0x0'));var util=require(_0x249c('0x1'));var moment=require(_0x249c('0x2'));var BPromise=require(_0x249c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x249c('0x4'));var db=require(_0x249c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x249c('0x6'))(_0x249c('0x7'));var config=require('../../config/environment');var jayson=require(_0x249c('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x249c('0x9')],{'host':_0x249c('0xa'),'port':0x18eb});var socket=require(_0x249c('0xb'))(new Redis(config[_0x249c('0x9')]));require(_0x249c('0xc'))[_0x249c('0xd')](socket);function respondWithRpcPromise(_0x2216eb,_0x35a42b,_0x7a5971){return new BPromise(function(_0x422d7b,_0x4b18fe){return client[_0x249c('0xe')](_0x2216eb,_0x7a5971)[_0x249c('0xf')](function(_0x4a0d30){logger['info'](_0x249c('0x10'),_0x35a42b,_0x249c('0x11'));logger[_0x249c('0x12')](_0x249c('0x13'),_0x35a42b,_0x249c('0x11'),JSON[_0x249c('0x14')](_0x4a0d30));if(_0x4a0d30[_0x249c('0x15')]){if(_0x4a0d30[_0x249c('0x15')]['code']===0x1f4){logger[_0x249c('0x15')](_0x249c('0x10'),_0x35a42b,_0x4a0d30[_0x249c('0x15')][_0x249c('0x16')]);return _0x4b18fe(_0x4a0d30['error']['message']);}logger[_0x249c('0x15')](_0x249c('0x10'),_0x35a42b,_0x4a0d30[_0x249c('0x15')][_0x249c('0x16')]);return _0x422d7b(_0x4a0d30[_0x249c('0x15')][_0x249c('0x16')]);}else{logger[_0x249c('0x17')](_0x249c('0x10'),_0x35a42b,_0x249c('0x11'));_0x422d7b(_0x4a0d30[_0x249c('0x18')]['message']);}})['catch'](function(_0xeb289a){logger[_0x249c('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x35a42b,_0xeb289a);_0x4b18fe(_0xeb289a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 3961f6d..0e94e90 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 _0x29c8=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x29c8,0x19a));var _0x829c=function(_0x415b08,_0x435b11){_0x415b08=_0x415b08-0x0;var _0x50f7bd=_0x29c8[_0x415b08];return _0x50f7bd;};'use strict';var ChatInternalMessageEvents=require(_0x829c('0x0'));var events=[_0x829c('0x1'),_0x829c('0x2'),_0x829c('0x3')];function createListener(_0x6c1c04,_0x5830cf){return function(_0xde857c){_0x5830cf[_0x829c('0x4')](_0x6c1c04,_0xde857c);};}function removeListener(_0x2d1443,_0x4c81f9){return function(){ChatInternalMessageEvents[_0x829c('0x5')](_0x2d1443,_0x4c81f9);};}exports[_0x829c('0x6')]=function(_0x59ae76){for(var _0x4def7f=0x0,_0x200947=events[_0x829c('0x7')];_0x4def7f<_0x200947;_0x4def7f++){var _0x3a88e9=events[_0x4def7f];var _0x19ea3b=createListener(_0x829c('0x8')+_0x3a88e9,_0x59ae76);ChatInternalMessageEvents['on'](_0x3a88e9,_0x19ea3b);}}; \ No newline at end of file +var _0x2cb1=['save','remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x2cb1,0x177));var _0x12cb=function(_0x12eb99,_0x4cec49){_0x12eb99=_0x12eb99-0x0;var _0x133fc8=_0x2cb1[_0x12eb99];return _0x133fc8;};'use strict';var ChatInternalMessageEvents=require(_0x12cb('0x0'));var events=[_0x12cb('0x1'),_0x12cb('0x2'),'update'];function createListener(_0x4dbe18,_0x54a050){return function(_0x53e133){_0x54a050[_0x12cb('0x3')](_0x4dbe18,_0x53e133);};}function removeListener(_0x29bca8,_0x5e5764){return function(){ChatInternalMessageEvents[_0x12cb('0x4')](_0x29bca8,_0x5e5764);};}exports[_0x12cb('0x5')]=function(_0xc23888){for(var _0x1f1524=0x0,_0x5af47b=events[_0x12cb('0x6')];_0x1f1524<_0x5af47b;_0x1f1524++){var _0x32b836=events[_0x1f1524];var _0x24ed18=createListener(_0x12cb('0x7')+_0x32b836,_0xc23888);ChatInternalMessageEvents['on'](_0x32b836,_0x24ed18);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 27be06b..a1705b0 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 _0xeb10=['get','isAuthenticated','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller'];(function(_0xcc04c2,_0x5d13cf){var _0x24c46b=function(_0xcec449){while(--_0xcec449){_0xcc04c2['push'](_0xcc04c2['shift']());}};_0x24c46b(++_0x5d13cf);}(_0xeb10,0x15e));var _0x0eb1=function(_0x2f11b7,_0x137966){_0x2f11b7=_0x2f11b7-0x0;var _0x246ae4=_0xeb10[_0x2f11b7];return _0x246ae4;};'use strict';var multer=require('multer');var util=require(_0x0eb1('0x0'));var path=require(_0x0eb1('0x1'));var timeout=require(_0x0eb1('0x2'));var express=require('express');var router=express[_0x0eb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0eb1('0x4'));var interaction=require(_0x0eb1('0x5'));var config=require('../../config/environment');var controller=require(_0x0eb1('0x6'));router[_0x0eb1('0x7')]('/',auth[_0x0eb1('0x8')](),controller['index']);router['get'](_0x0eb1('0x9'),auth['isAuthenticated'](),controller[_0x0eb1('0xa')]);router[_0x0eb1('0x7')](_0x0eb1('0xb'),auth[_0x0eb1('0x8')](),controller[_0x0eb1('0xc')]);router[_0x0eb1('0x7')](_0x0eb1('0xd'),auth[_0x0eb1('0x8')](),controller[_0x0eb1('0xe')]);router[_0x0eb1('0xf')]('/',auth[_0x0eb1('0x8')](),controller[_0x0eb1('0x10')]);router[_0x0eb1('0x11')](_0x0eb1('0xd'),controller[_0x0eb1('0x12')]);router[_0x0eb1('0x13')]('/:id',auth[_0x0eb1('0x8')](),controller[_0x0eb1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8e9a=['show','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','/:id'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x8e9a,0xf6));var _0xa8e9=function(_0x132d06,_0x314aad){_0x132d06=_0x132d06-0x0;var _0x3490a4=_0x8e9a[_0x132d06];return _0x3490a4;};'use strict';var multer=require('multer');var util=require(_0xa8e9('0x0'));var path=require(_0xa8e9('0x1'));var timeout=require(_0xa8e9('0x2'));var express=require(_0xa8e9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa8e9('0x4'));var interaction=require(_0xa8e9('0x5'));var config=require(_0xa8e9('0x6'));var controller=require(_0xa8e9('0x7'));router[_0xa8e9('0x8')]('/',auth[_0xa8e9('0x9')](),controller[_0xa8e9('0xa')]);router[_0xa8e9('0x8')]('/describe',auth[_0xa8e9('0x9')](),controller[_0xa8e9('0xb')]);router[_0xa8e9('0x8')](_0xa8e9('0xc'),auth[_0xa8e9('0x9')](),controller['getUsers']);router[_0xa8e9('0x8')](_0xa8e9('0xd'),auth[_0xa8e9('0x9')](),controller[_0xa8e9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa8e9('0xf')]);router[_0xa8e9('0x10')](_0xa8e9('0xd'),controller['update']);router[_0xa8e9('0x11')](_0xa8e9('0xd'),auth[_0xa8e9('0x9')](),controller[_0xa8e9('0x12')]);module[_0xa8e9('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f07f462..f197191 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 _0x94e6=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x36b671,_0x44610a){var _0x44e968=function(_0x5e0071){while(--_0x5e0071){_0x36b671['push'](_0x36b671['shift']());}};_0x44e968(++_0x44610a);}(_0x94e6,0x194));var _0x694e=function(_0x1ff1ab,_0xd1426c){_0x1ff1ab=_0x1ff1ab-0x0;var _0x28839e=_0x94e6[_0x1ff1ab];return _0x28839e;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'body':{'type':Sequelize[_0x694e('0x1')](_0x694e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x694e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x694e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x694e('0x4')]('in',_0x694e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x694e('0x6')]},'providerName':{'type':Sequelize[_0x694e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x63c6=['DATE','STRING','TEXT','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0xf78d2e,_0x3b3dff){var _0xbd54c1=function(_0x5e9ca1){while(--_0x5e9ca1){_0xf78d2e['push'](_0xf78d2e['shift']());}};_0xbd54c1(++_0x3b3dff);}(_0x63c6,0xbb));var _0x663c=function(_0x5cf30b,_0x41598f){_0x5cf30b=_0x5cf30b-0x0;var _0xe6f60=_0x63c6[_0x5cf30b];return _0xe6f60;};'use strict';var Sequelize=require(_0x663c('0x0'));module[_0x663c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x663c('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x663c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x663c('0x3')]('in',_0x663c('0x4')),'defaultValue':_0x663c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x663c('0x5')]},'providerName':{'type':Sequelize[_0x663c('0x6')]},'providerResponse':{'type':Sequelize[_0x663c('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index eedab53..5047e00 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 _0xa3e0=['model','map','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','options','includeAll','include','findAll','show','keys','rawAttributes','find','create','body','params','describe','chat','reject','UserId','user','agent','ChatInteraction','ChatInteractionId','interaction','get','info','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','parse','formData','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','./chatMessage.socket','register','jayson/promise','client','http','chat-interactions','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','ChatMessage','fieldName','type','key'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xa3e0,0x16f));var _0x0a3e=function(_0x60f18e,_0x40e8f3){_0x60f18e=_0x60f18e-0x0;var _0x1c02e3=_0xa3e0[_0x60f18e];return _0x1c02e3;};'use strict';var util=require(_0x0a3e('0x0'));var _=require(_0x0a3e('0x1'));var Redis=require(_0x0a3e('0x2'));var interactionService=require(_0x0a3e('0x3'));var qs=require(_0x0a3e('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x0a3e('0x5'));var db=require(_0x0a3e('0x6'))['db'];config[_0x0a3e('0x7')]=_['defaults'](config[_0x0a3e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a3e('0x8'))[_0x0a3e('0x9')](socket);var jayson=require(_0x0a3e('0xa'));var client=jayson[_0x0a3e('0xb')][_0x0a3e('0xc')]({'port':0x232c});var client9002=jayson[_0x0a3e('0xb')][_0x0a3e('0xc')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x0a3e('0xd'));function respondWithRpcPromise(_0x411942,_0x8202eb,_0x29a63e,_0x16e35c){return new Promise(function(_0x146c75,_0x2db053){var _0x165460=_0x16e35c||client;return _0x165460[_0x0a3e('0xe')](_0x411942,_0x29a63e)[_0x0a3e('0xf')](function(_0x6269dd){logger['info'](_0x0a3e('0x10'),_0x8202eb,_0x0a3e('0x11'));logger[_0x0a3e('0x12')](_0x0a3e('0x13'),_0x8202eb,_0x0a3e('0x11'),JSON[_0x0a3e('0x14')](_0x6269dd));if(_0x6269dd[_0x0a3e('0x15')]){if(_0x6269dd[_0x0a3e('0x15')][_0x0a3e('0x16')]===0x1f4){logger[_0x0a3e('0x15')]('ChatMessage,\x20%s,\x20%s',_0x8202eb,_0x6269dd[_0x0a3e('0x15')][_0x0a3e('0x17')]);return _0x2db053(_0x6269dd['error']['message']);}logger[_0x0a3e('0x15')](_0x0a3e('0x10'),_0x8202eb,_0x6269dd['error'][_0x0a3e('0x17')]);return _0x146c75(_0x6269dd[_0x0a3e('0x15')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x8202eb,_0x0a3e('0x11'));_0x146c75(_0x6269dd[_0x0a3e('0x18')][_0x0a3e('0x17')]);}})[_0x0a3e('0x19')](function(_0x27de61){logger['error'](_0x0a3e('0x10'),_0x8202eb,_0x27de61);_0x2db053(_0x27de61);});});}function respondWithResult(_0x537314,_0x46744b){_0x46744b=_0x46744b||0xc8;return function(_0xe44fba){if(_0xe44fba){return _0x537314[_0x0a3e('0x1a')](_0x46744b)[_0x0a3e('0x1b')](_0xe44fba);}};}function respondWithFilteredResult(_0x54ab44,_0x594caf){return function(_0x32b590){if(_0x32b590){var _0x19c514=typeof _0x594caf[_0x0a3e('0x1c')]===_0x0a3e('0x1d')&&typeof _0x594caf[_0x0a3e('0x1e')]===_0x0a3e('0x1d');var _0x389962=_0x32b590[_0x0a3e('0x1f')];var _0x5836d1=_0x19c514?0x0:_0x594caf['offset'];var _0x342e44=_0x19c514?_0x32b590[_0x0a3e('0x1f')]:_0x594caf[_0x0a3e('0x1c')]+_0x594caf['limit'];var _0x4361c5;if(_0x342e44>=_0x389962){_0x342e44=_0x389962;_0x4361c5=0xc8;}else{_0x4361c5=0xce;}_0x54ab44['status'](_0x4361c5);return _0x54ab44['set'](_0x0a3e('0x20'),_0x5836d1+'-'+_0x342e44+'/'+_0x389962)['json'](_0x32b590);}return null;};}function saveUpdates(_0x304625){return function(_0x3196d6){if(_0x3196d6){return _0x3196d6[_0x0a3e('0x21')](_0x304625)[_0x0a3e('0xf')](function(_0x4b3020){return _0x4b3020;});}return null;};}function removeEntity(_0x3be0a3){return function(_0x319027){if(_0x319027){return _0x319027[_0x0a3e('0x22')]()[_0x0a3e('0xf')](function(){_0x3be0a3[_0x0a3e('0x1a')](0xcc)[_0x0a3e('0x23')]();});}};}function handleEntityNotFound(_0x45a9a5){return function(_0x4f6d76){if(!_0x4f6d76){_0x45a9a5[_0x0a3e('0x24')](0x194);}return _0x4f6d76;};}function handleError(_0x3d3580,_0x2f5b1f){_0x2f5b1f=_0x2f5b1f||0x1f4;return function(_0x2b3e2d){logger[_0x0a3e('0x15')](_0x2b3e2d[_0x0a3e('0x25')]);if(_0x2b3e2d[_0x0a3e('0x26')]){delete _0x2b3e2d['name'];}_0x3d3580[_0x0a3e('0x1a')](_0x2f5b1f)[_0x0a3e('0x27')](_0x2b3e2d);};}exports[_0x0a3e('0x28')]=function(_0x1eb446,_0x374e7f){var _0x4410b5={},_0x1d54ec={},_0xec409={'count':0x0,'rows':[]};var _0x5a0977=_['map'](db[_0x0a3e('0x29')]['rawAttributes'],function(_0x274529){return{'name':_0x274529[_0x0a3e('0x2a')],'type':_0x274529[_0x0a3e('0x2b')][_0x0a3e('0x2c')]};});_0x1d54ec[_0x0a3e('0x2d')]=_[_0x0a3e('0x2e')](_0x5a0977,'name');_0x1d54ec[_0x0a3e('0x2f')]=_['keys'](_0x1eb446[_0x0a3e('0x2f')]);_0x1d54ec['filters']=_[_0x0a3e('0x30')](_0x1d54ec[_0x0a3e('0x2d')],_0x1d54ec[_0x0a3e('0x2f')]);_0x4410b5['attributes']=_['intersection'](_0x1d54ec['model'],qs[_0x0a3e('0x31')](_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x31')]));_0x4410b5[_0x0a3e('0x32')]=_0x4410b5[_0x0a3e('0x32')][_0x0a3e('0x33')]?_0x4410b5[_0x0a3e('0x32')]:_0x1d54ec[_0x0a3e('0x2d')];if(!_0x1eb446['query'][_0x0a3e('0x34')]('nolimit')){_0x4410b5[_0x0a3e('0x1e')]=qs[_0x0a3e('0x1e')](_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x1e')]);_0x4410b5[_0x0a3e('0x1c')]=qs[_0x0a3e('0x1c')](_0x1eb446[_0x0a3e('0x2f')]['offset']);}_0x4410b5['order']=qs[_0x0a3e('0x35')](_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x35')]);_0x4410b5[_0x0a3e('0x36')]=qs[_0x0a3e('0x37')](_['pick'](_0x1eb446[_0x0a3e('0x2f')],_0x1d54ec['filters']),_0x5a0977);if(_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x38')]){_0x4410b5[_0x0a3e('0x36')]=_[_0x0a3e('0x39')](_0x4410b5[_0x0a3e('0x36')],{'$or':_['map'](_0x5a0977,function(_0x4fa575){if(_0x4fa575[_0x0a3e('0x2b')]!=='VIRTUAL'){var _0x2d1bfe={};_0x2d1bfe[_0x4fa575['name']]={'$like':'%'+_0x1eb446[_0x0a3e('0x2f')][_0x0a3e('0x38')]+'%'};return _0x2d1bfe;}})});}_0x4410b5=_[_0x0a3e('0x39')]({},_0x4410b5,_0x1eb446[_0x0a3e('0x3a')]);var _0x19c894={'where':_0x4410b5[_0x0a3e('0x36')]};return db['ChatMessage']['count'](_0x19c894)['then'](function(_0x10bdd8){_0xec409['count']=_0x10bdd8;if(_0x1eb446['query'][_0x0a3e('0x3b')]){_0x4410b5[_0x0a3e('0x3c')]=[{'all':!![]}];}return db[_0x0a3e('0x29')][_0x0a3e('0x3d')](_0x4410b5);})[_0x0a3e('0xf')](function(_0x2815d7){_0xec409['rows']=_0x2815d7;return _0xec409;})['then'](respondWithFilteredResult(_0x374e7f,_0x4410b5))['catch'](handleError(_0x374e7f,null));};exports[_0x0a3e('0x3e')]=function(_0xb0f016,_0x4885d1){var _0x26954c={'raw':!![],'where':{'id':_0xb0f016['params']['id']}},_0xd47d46={};_0xd47d46[_0x0a3e('0x2d')]=_[_0x0a3e('0x3f')](db[_0x0a3e('0x29')][_0x0a3e('0x40')]);_0xd47d46['query']=_['keys'](_0xb0f016['query']);_0xd47d46[_0x0a3e('0x37')]=_[_0x0a3e('0x30')](_0xd47d46['model'],_0xd47d46[_0x0a3e('0x2f')]);_0x26954c[_0x0a3e('0x32')]=_[_0x0a3e('0x30')](_0xd47d46[_0x0a3e('0x2d')],qs[_0x0a3e('0x31')](_0xb0f016[_0x0a3e('0x2f')][_0x0a3e('0x31')]));_0x26954c[_0x0a3e('0x32')]=_0x26954c['attributes'][_0x0a3e('0x33')]?_0x26954c[_0x0a3e('0x32')]:_0xd47d46[_0x0a3e('0x2d')];if(_0xb0f016[_0x0a3e('0x2f')][_0x0a3e('0x3b')]){_0x26954c[_0x0a3e('0x3c')]=[{'all':!![]}];}_0x26954c=_[_0x0a3e('0x39')]({},_0x26954c,_0xb0f016[_0x0a3e('0x3a')]);return db[_0x0a3e('0x29')][_0x0a3e('0x41')](_0x26954c)['then'](handleEntityNotFound(_0x4885d1,null))[_0x0a3e('0xf')](respondWithResult(_0x4885d1,null))['catch'](handleError(_0x4885d1,null));};exports[_0x0a3e('0x42')]=function(_0x5d44bc,_0x19c3a3){return db[_0x0a3e('0x29')][_0x0a3e('0x42')](_0x5d44bc[_0x0a3e('0x43')],{})['then'](respondWithResult(_0x19c3a3,0xc9))['catch'](handleError(_0x19c3a3,null));};exports['update']=function(_0x2917f1,_0x5395ed){if(_0x2917f1[_0x0a3e('0x43')]['id']){delete _0x2917f1[_0x0a3e('0x43')]['id'];}return db[_0x0a3e('0x29')][_0x0a3e('0x41')]({'where':{'id':_0x2917f1[_0x0a3e('0x44')]['id']}})[_0x0a3e('0xf')](handleEntityNotFound(_0x5395ed,null))[_0x0a3e('0xf')](saveUpdates(_0x2917f1[_0x0a3e('0x43')],null))[_0x0a3e('0xf')](respondWithResult(_0x5395ed,null))[_0x0a3e('0x19')](handleError(_0x5395ed,null));};exports[_0x0a3e('0x22')]=function(_0xc6e57b,_0x41b8a0){return db[_0x0a3e('0x29')][_0x0a3e('0x41')]({'where':{'id':_0xc6e57b[_0x0a3e('0x44')]['id']}})[_0x0a3e('0xf')](handleEntityNotFound(_0x41b8a0,null))[_0x0a3e('0xf')](removeEntity(_0x41b8a0,null))[_0x0a3e('0x19')](handleError(_0x41b8a0,null));};exports[_0x0a3e('0x45')]=function(_0x8c93f7,_0x1c3bb2){return db['ChatMessage']['describe']()[_0x0a3e('0xf')](respondWithResult(_0x1c3bb2,null))['catch'](handleError(_0x1c3bb2,null));};exports['accept']=function(_0x33c4f0,_0x232b13){var _0x1d5447=_0x0a3e('0x46');return interactionService['acceptMessage'](_0x33c4f0,_0x1d5447)[_0x0a3e('0xf')](respondWithResult(_0x232b13,null))[_0x0a3e('0x19')](handleError(_0x232b13,null));};exports[_0x0a3e('0x47')]=function(_0x1bf39c,_0x1a1b62){var _0x455408={'agent':{},'channel':_0x0a3e('0x46')};if(_0x1bf39c[_0x0a3e('0x43')]['id']){delete _0x1bf39c[_0x0a3e('0x43')]['id'];}_0x1bf39c['body']['UserId']=_0x1bf39c[_0x0a3e('0x43')][_0x0a3e('0x48')]||_0x1bf39c[_0x0a3e('0x49')]['id'];_0x455408[_0x0a3e('0x4a')]['id']=_0x1bf39c[_0x0a3e('0x43')]['UserId'];return db[_0x0a3e('0x29')][_0x0a3e('0x41')]({'where':{'id':_0x1bf39c[_0x0a3e('0x44')]['id'],'UserId':null}})[_0x0a3e('0xf')](handleEntityNotFound(_0x1a1b62,null))[_0x0a3e('0xf')](function(_0x5295e3){if(_0x5295e3){_0x455408[_0x0a3e('0x17')]=_0x5295e3['get']({'plain':!![]});return db[_0x0a3e('0x4b')][_0x0a3e('0x41')]({'where':{'id':_0x5295e3[_0x0a3e('0x4c')]}});}return null;})['then'](handleEntityNotFound(_0x1a1b62,null))['then'](function(_0x31b2d6){if(_0x31b2d6){_0x455408[_0x0a3e('0x4d')]=_0x31b2d6[_0x0a3e('0x4e')]({'plain':!![]});interaction_log[_0x0a3e('0x4f')](_0x0a3e('0x50'),_0x1bf39c[_0x0a3e('0x49')]['id'],_0x1bf39c[_0x0a3e('0x49')][_0x0a3e('0x26')],_0x1bf39c[_0x0a3e('0x49')][_0x0a3e('0x51')],_0x455408['interaction']['id'],_0x1bf39c[_0x0a3e('0x43')]?JSON[_0x0a3e('0x14')](_0x1bf39c[_0x0a3e('0x43')]):'null');return respondWithRpcPromise(_0x0a3e('0x52'),_0x0a3e('0x53'),_0x455408);}return null;})[_0x0a3e('0xf')](function(_0xf0cfd8){var _0x204c7d=_0x0a3e('0x54')+_0xf0cfd8[_0x0a3e('0x17')][_0x0a3e('0x55')];return db[_0x0a3e('0x56')][_0x0a3e('0x2f')](_0x204c7d,{'type':db[_0x0a3e('0x57')][_0x0a3e('0x58')][_0x0a3e('0x59')],'raw':!![]})[_0x0a3e('0xf')](function(_0x48aab8){return _0x48aab8;});})[_0x0a3e('0xf')](function(_0x8a466){if(_0x8a466){_0x455408['message'][_0x0a3e('0x5a')]=_0x8a466[0x0];if(!_0x1bf39c['body'][_0x0a3e('0x48')])return;return db[_0x0a3e('0x5b')][_0x0a3e('0x41')]({'where':{'id':_0x1bf39c[_0x0a3e('0x43')][_0x0a3e('0x48')],'role':_0x0a3e('0x4a')},'attributes':['id',_0x0a3e('0x26'),_0x0a3e('0x5c'),_0x0a3e('0x5d'),_0x0a3e('0x5e')],'raw':!![]});}return null;})[_0x0a3e('0xf')](function(_0x479373){if(!_0x479373)return null;_0x455408[_0x0a3e('0x17')]['agent']=_0x479373;return _0x455408;})[_0x0a3e('0xf')](function(_0x1045da){if(_0x1045da){_0x1045da[_0x0a3e('0x17')][_0x0a3e('0x5f')]=util[_0x0a3e('0x60')](_0x0a3e('0x61'),_0x1bf39c[_0x0a3e('0x49')][_0x0a3e('0x26')]);_0x1045da[_0x0a3e('0x17')][_0x0a3e('0x62')]=_0x455408['channel'];_0x1045da[_0x0a3e('0x17')][_0x0a3e('0x63')]=_0x455408['channel'];_0x1045da[_0x0a3e('0x17')][_0x0a3e('0x64')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_[_0x0a3e('0x39')](_0x455408[_0x0a3e('0x17')],JSON[_0x0a3e('0x65')](_0x455408[_0x0a3e('0x4d')][_0x0a3e('0x66')]))},client9002);return _0x455408;}return null;})['then'](respondWithResult(_0x1a1b62,null))[_0x0a3e('0x19')](handleError(_0x1a1b62,null));}; \ No newline at end of file +var _0xd1d3=['fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','fields','include','catch','create','body','find','params','describe','chat','reject','UserId','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','name','role','interaction','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','interface','format','SIP/%s','channel','motionChannel','event','EventManager','formData','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','send','map','ChatMessage','rawAttributes'];(function(_0x245b3f,_0x165efe){var _0x2f6657=function(_0x3649d9){while(--_0x3649d9){_0x245b3f['push'](_0x245b3f['shift']());}};_0x2f6657(++_0x165efe);}(_0xd1d3,0xa1));var _0x3d1d=function(_0x4a43c8,_0x1d873f){_0x4a43c8=_0x4a43c8-0x0;var _0xd47631=_0xd1d3[_0x4a43c8];return _0xd47631;};'use strict';var util=require('util');var _=require(_0x3d1d('0x0'));var Redis=require(_0x3d1d('0x1'));var interactionService=require(_0x3d1d('0x2'));var qs=require(_0x3d1d('0x3'));var logger=require(_0x3d1d('0x4'))('api');var config=require(_0x3d1d('0x5'));var db=require(_0x3d1d('0x6'))['db'];config[_0x3d1d('0x7')]=_[_0x3d1d('0x8')](config[_0x3d1d('0x7')],{'host':_0x3d1d('0x9'),'port':0x18eb});var socket=require(_0x3d1d('0xa'))(new Redis(config[_0x3d1d('0x7')]));require(_0x3d1d('0xb'))[_0x3d1d('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3d1d('0xd')][_0x3d1d('0xe')]({'port':0x232c});var client9002=jayson[_0x3d1d('0xd')][_0x3d1d('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')('chat-interactions');function respondWithRpcPromise(_0x4bcc00,_0x32bfe5,_0x22ec53,_0x3a75ca){return new Promise(function(_0x1f43a1,_0x271f5e){var _0x2d7d4d=_0x3a75ca||client;return _0x2d7d4d['request'](_0x4bcc00,_0x22ec53)[_0x3d1d('0xf')](function(_0x2bf063){logger[_0x3d1d('0x10')](_0x3d1d('0x11'),_0x32bfe5,_0x3d1d('0x12'));logger[_0x3d1d('0x13')](_0x3d1d('0x14'),_0x32bfe5,'request\x20sent',JSON[_0x3d1d('0x15')](_0x2bf063));if(_0x2bf063[_0x3d1d('0x16')]){if(_0x2bf063[_0x3d1d('0x16')][_0x3d1d('0x17')]===0x1f4){logger[_0x3d1d('0x16')](_0x3d1d('0x11'),_0x32bfe5,_0x2bf063[_0x3d1d('0x16')][_0x3d1d('0x18')]);return _0x271f5e(_0x2bf063[_0x3d1d('0x16')][_0x3d1d('0x18')]);}logger[_0x3d1d('0x16')](_0x3d1d('0x11'),_0x32bfe5,_0x2bf063[_0x3d1d('0x16')][_0x3d1d('0x18')]);return _0x1f43a1(_0x2bf063[_0x3d1d('0x16')][_0x3d1d('0x18')]);}else{logger[_0x3d1d('0x10')]('ChatMessage,\x20%s,\x20%s',_0x32bfe5,_0x3d1d('0x12'));_0x1f43a1(_0x2bf063['result'][_0x3d1d('0x18')]);}})['catch'](function(_0x479e73){logger[_0x3d1d('0x16')](_0x3d1d('0x11'),_0x32bfe5,_0x479e73);_0x271f5e(_0x479e73);});});}function respondWithResult(_0x51f506,_0x1fb7aa){_0x1fb7aa=_0x1fb7aa||0xc8;return function(_0x3da8fe){if(_0x3da8fe){return _0x51f506['status'](_0x1fb7aa)['json'](_0x3da8fe);}};}function respondWithFilteredResult(_0x22f32f,_0x594a35){return function(_0x2ea1e2){if(_0x2ea1e2){var _0x1c0553=typeof _0x594a35[_0x3d1d('0x19')]===_0x3d1d('0x1a')&&typeof _0x594a35[_0x3d1d('0x1b')]==='undefined';var _0x54ce10=_0x2ea1e2['count'];var _0x1cebbb=_0x1c0553?0x0:_0x594a35[_0x3d1d('0x19')];var _0x4d77e6=_0x1c0553?_0x2ea1e2[_0x3d1d('0x1c')]:_0x594a35[_0x3d1d('0x19')]+_0x594a35[_0x3d1d('0x1b')];var _0x301734;if(_0x4d77e6>=_0x54ce10){_0x4d77e6=_0x54ce10;_0x301734=0xc8;}else{_0x301734=0xce;}_0x22f32f[_0x3d1d('0x1d')](_0x301734);return _0x22f32f[_0x3d1d('0x1e')](_0x3d1d('0x1f'),_0x1cebbb+'-'+_0x4d77e6+'/'+_0x54ce10)['json'](_0x2ea1e2);}return null;};}function saveUpdates(_0x4c49a3){return function(_0x3ca923){if(_0x3ca923){return _0x3ca923[_0x3d1d('0x20')](_0x4c49a3)['then'](function(_0x2cdde6){return _0x2cdde6;});}return null;};}function removeEntity(_0x4f2322){return function(_0x39ebc3){if(_0x39ebc3){return _0x39ebc3[_0x3d1d('0x21')]()['then'](function(){_0x4f2322[_0x3d1d('0x1d')](0xcc)[_0x3d1d('0x22')]();});}};}function handleEntityNotFound(_0x763ff8){return function(_0x2c3b8e){if(!_0x2c3b8e){_0x763ff8[_0x3d1d('0x23')](0x194);}return _0x2c3b8e;};}function handleError(_0x428500,_0x3eabbe){_0x3eabbe=_0x3eabbe||0x1f4;return function(_0x48dccb){logger[_0x3d1d('0x16')](_0x48dccb[_0x3d1d('0x24')]);if(_0x48dccb['name']){delete _0x48dccb['name'];}_0x428500[_0x3d1d('0x1d')](_0x3eabbe)[_0x3d1d('0x25')](_0x48dccb);};}exports['index']=function(_0x35571e,_0x23ba22){var _0xa43d91={},_0x27e1ce={},_0x3bcd56={'count':0x0,'rows':[]};var _0xde4672=_[_0x3d1d('0x26')](db[_0x3d1d('0x27')][_0x3d1d('0x28')],function(_0x46784a){return{'name':_0x46784a[_0x3d1d('0x29')],'type':_0x46784a[_0x3d1d('0x2a')]['key']};});_0x27e1ce['model']=_[_0x3d1d('0x26')](_0xde4672,'name');_0x27e1ce[_0x3d1d('0x2b')]=_[_0x3d1d('0x2c')](_0x35571e[_0x3d1d('0x2b')]);_0x27e1ce[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x27e1ce[_0x3d1d('0x2f')],_0x27e1ce[_0x3d1d('0x2b')]);_0xa43d91[_0x3d1d('0x30')]=_[_0x3d1d('0x2e')](_0x27e1ce['model'],qs['fields'](_0x35571e[_0x3d1d('0x2b')]['fields']));_0xa43d91['attributes']=_0xa43d91['attributes'][_0x3d1d('0x31')]?_0xa43d91[_0x3d1d('0x30')]:_0x27e1ce[_0x3d1d('0x2f')];if(!_0x35571e[_0x3d1d('0x2b')][_0x3d1d('0x32')](_0x3d1d('0x33'))){_0xa43d91[_0x3d1d('0x1b')]=qs[_0x3d1d('0x1b')](_0x35571e[_0x3d1d('0x2b')]['limit']);_0xa43d91[_0x3d1d('0x19')]=qs[_0x3d1d('0x19')](_0x35571e['query'][_0x3d1d('0x19')]);}_0xa43d91[_0x3d1d('0x34')]=qs[_0x3d1d('0x35')](_0x35571e['query'][_0x3d1d('0x35')]);_0xa43d91[_0x3d1d('0x36')]=qs[_0x3d1d('0x2d')](_[_0x3d1d('0x37')](_0x35571e['query'],_0x27e1ce[_0x3d1d('0x2d')]),_0xde4672);if(_0x35571e[_0x3d1d('0x2b')]['filter']){_0xa43d91[_0x3d1d('0x36')]=_['merge'](_0xa43d91[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0xde4672,function(_0x57b1a6){if(_0x57b1a6['type']!==_0x3d1d('0x38')){var _0x9ab4a={};_0x9ab4a[_0x57b1a6['name']]={'$like':'%'+_0x35571e['query'][_0x3d1d('0x39')]+'%'};return _0x9ab4a;}})});}_0xa43d91=_[_0x3d1d('0x3a')]({},_0xa43d91,_0x35571e[_0x3d1d('0x3b')]);var _0x33e8e8={'where':_0xa43d91[_0x3d1d('0x36')]};return db[_0x3d1d('0x27')]['count'](_0x33e8e8)['then'](function(_0x32dfd9){_0x3bcd56[_0x3d1d('0x1c')]=_0x32dfd9;if(_0x35571e[_0x3d1d('0x2b')][_0x3d1d('0x3c')]){_0xa43d91['include']=[{'all':!![]}];}return db[_0x3d1d('0x27')][_0x3d1d('0x3d')](_0xa43d91);})['then'](function(_0x50b645){_0x3bcd56['rows']=_0x50b645;return _0x3bcd56;})[_0x3d1d('0xf')](respondWithFilteredResult(_0x23ba22,_0xa43d91))['catch'](handleError(_0x23ba22,null));};exports['show']=function(_0x7ebbcd,_0x42d171){var _0x15b373={'raw':!![],'where':{'id':_0x7ebbcd['params']['id']}},_0x5d83a3={};_0x5d83a3[_0x3d1d('0x2f')]=_[_0x3d1d('0x2c')](db[_0x3d1d('0x27')][_0x3d1d('0x28')]);_0x5d83a3['query']=_[_0x3d1d('0x2c')](_0x7ebbcd['query']);_0x5d83a3['filters']=_[_0x3d1d('0x2e')](_0x5d83a3[_0x3d1d('0x2f')],_0x5d83a3[_0x3d1d('0x2b')]);_0x15b373[_0x3d1d('0x30')]=_[_0x3d1d('0x2e')](_0x5d83a3[_0x3d1d('0x2f')],qs[_0x3d1d('0x3e')](_0x7ebbcd['query']['fields']));_0x15b373[_0x3d1d('0x30')]=_0x15b373[_0x3d1d('0x30')][_0x3d1d('0x31')]?_0x15b373[_0x3d1d('0x30')]:_0x5d83a3['model'];if(_0x7ebbcd[_0x3d1d('0x2b')][_0x3d1d('0x3c')]){_0x15b373[_0x3d1d('0x3f')]=[{'all':!![]}];}_0x15b373=_[_0x3d1d('0x3a')]({},_0x15b373,_0x7ebbcd['options']);return db[_0x3d1d('0x27')]['find'](_0x15b373)[_0x3d1d('0xf')](handleEntityNotFound(_0x42d171,null))[_0x3d1d('0xf')](respondWithResult(_0x42d171,null))[_0x3d1d('0x40')](handleError(_0x42d171,null));};exports['create']=function(_0x2d5755,_0x556706){return db[_0x3d1d('0x27')][_0x3d1d('0x41')](_0x2d5755['body'],{})['then'](respondWithResult(_0x556706,0xc9))[_0x3d1d('0x40')](handleError(_0x556706,null));};exports['update']=function(_0x2b1259,_0x5ac3cb){if(_0x2b1259[_0x3d1d('0x42')]['id']){delete _0x2b1259[_0x3d1d('0x42')]['id'];}return db[_0x3d1d('0x27')][_0x3d1d('0x43')]({'where':{'id':_0x2b1259[_0x3d1d('0x44')]['id']}})[_0x3d1d('0xf')](handleEntityNotFound(_0x5ac3cb,null))[_0x3d1d('0xf')](saveUpdates(_0x2b1259[_0x3d1d('0x42')],null))[_0x3d1d('0xf')](respondWithResult(_0x5ac3cb,null))[_0x3d1d('0x40')](handleError(_0x5ac3cb,null));};exports[_0x3d1d('0x21')]=function(_0x4a5f7d,_0x415b2c){return db['ChatMessage']['find']({'where':{'id':_0x4a5f7d['params']['id']}})['then'](handleEntityNotFound(_0x415b2c,null))[_0x3d1d('0xf')](removeEntity(_0x415b2c,null))[_0x3d1d('0x40')](handleError(_0x415b2c,null));};exports[_0x3d1d('0x45')]=function(_0xc9e133,_0x12b8fb){return db[_0x3d1d('0x27')][_0x3d1d('0x45')]()[_0x3d1d('0xf')](respondWithResult(_0x12b8fb,null))[_0x3d1d('0x40')](handleError(_0x12b8fb,null));};exports['accept']=function(_0x43e21b,_0x515b53){var _0x77a564=_0x3d1d('0x46');return interactionService['acceptMessage'](_0x43e21b,_0x77a564)['then'](respondWithResult(_0x515b53,null))[_0x3d1d('0x40')](handleError(_0x515b53,null));};exports[_0x3d1d('0x47')]=function(_0x870fb9,_0x1ef90e){var _0x1c036d={'agent':{},'channel':_0x3d1d('0x46')};if(_0x870fb9[_0x3d1d('0x42')]['id']){delete _0x870fb9[_0x3d1d('0x42')]['id'];}_0x870fb9[_0x3d1d('0x42')][_0x3d1d('0x48')]=_0x870fb9[_0x3d1d('0x42')][_0x3d1d('0x48')]||_0x870fb9['user']['id'];_0x1c036d['agent']['id']=_0x870fb9[_0x3d1d('0x42')][_0x3d1d('0x48')];return db[_0x3d1d('0x27')][_0x3d1d('0x43')]({'where':{'id':_0x870fb9[_0x3d1d('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ef90e,null))['then'](function(_0x277fa1){if(_0x277fa1){_0x1c036d[_0x3d1d('0x18')]=_0x277fa1[_0x3d1d('0x49')]({'plain':!![]});return db[_0x3d1d('0x4a')]['find']({'where':{'id':_0x277fa1[_0x3d1d('0x4b')]}});}return null;})[_0x3d1d('0xf')](handleEntityNotFound(_0x1ef90e,null))[_0x3d1d('0xf')](function(_0x40d387){if(_0x40d387){_0x1c036d['interaction']=_0x40d387[_0x3d1d('0x49')]({'plain':!![]});interaction_log[_0x3d1d('0x10')](_0x3d1d('0x4c'),_0x870fb9[_0x3d1d('0x4d')]['id'],_0x870fb9['user'][_0x3d1d('0x4e')],_0x870fb9[_0x3d1d('0x4d')][_0x3d1d('0x4f')],_0x1c036d[_0x3d1d('0x50')]['id'],_0x870fb9['body']?JSON[_0x3d1d('0x15')](_0x870fb9[_0x3d1d('0x42')]):'null');return respondWithRpcPromise('RejectMessage',_0x3d1d('0x51'),_0x1c036d);}return null;})[_0x3d1d('0xf')](function(_0x5d7ae0){var _0x16c6d3=_0x3d1d('0x52')+_0x5d7ae0['message'][_0x3d1d('0x53')];return db[_0x3d1d('0x54')]['query'](_0x16c6d3,{'type':db[_0x3d1d('0x55')][_0x3d1d('0x56')][_0x3d1d('0x57')],'raw':!![]})[_0x3d1d('0xf')](function(_0x450a01){return _0x450a01;});})['then'](function(_0x52ca4d){if(_0x52ca4d){_0x1c036d[_0x3d1d('0x18')][_0x3d1d('0x58')]=_0x52ca4d[0x0];if(!_0x870fb9[_0x3d1d('0x42')][_0x3d1d('0x48')])return;return db[_0x3d1d('0x59')]['find']({'where':{'id':_0x870fb9[_0x3d1d('0x42')][_0x3d1d('0x48')],'role':_0x3d1d('0x5a')},'attributes':['id','name',_0x3d1d('0x5b'),_0x3d1d('0x5c'),'internal'],'raw':!![]});}return null;})[_0x3d1d('0xf')](function(_0x359a79){if(!_0x359a79)return null;_0x1c036d['message'][_0x3d1d('0x5a')]=_0x359a79;return _0x1c036d;})['then'](function(_0x149b63){if(_0x149b63){_0x149b63[_0x3d1d('0x18')][_0x3d1d('0x5d')]=util[_0x3d1d('0x5e')](_0x3d1d('0x5f'),_0x870fb9['user'][_0x3d1d('0x4e')]);_0x149b63['message']['channel']=_0x1c036d[_0x3d1d('0x60')];_0x149b63[_0x3d1d('0x18')][_0x3d1d('0x61')]=_0x1c036d[_0x3d1d('0x60')];_0x149b63[_0x3d1d('0x18')][_0x3d1d('0x62')]='reject';respondWithRpcPromise(_0x3d1d('0x63'),'EventManager',{'event':'rejectmessage','message':_['merge'](_0x1c036d[_0x3d1d('0x18')],JSON['parse'](_0x1c036d[_0x3d1d('0x50')][_0x3d1d('0x64')]))},client9002);return _0x1c036d;}return null;})['then'](respondWithResult(_0x1ef90e,null))[_0x3d1d('0x40')](handleError(_0x1ef90e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index fe1cae2..efdaf63 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 _0xab7b=['ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2a622b,_0x42665c){var _0x104aa1=function(_0x24e6f8){while(--_0x24e6f8){_0x2a622b['push'](_0x2a622b['shift']());}};_0x104aa1(++_0x42665c);}(_0xab7b,0x171));var _0xbab7=function(_0x3a1972,_0x194511){_0x3a1972=_0x3a1972-0x0;var _0xc7e0b5=_0xab7b[_0x3a1972];return _0xc7e0b5;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xbab7('0x0'))['db'][_0xbab7('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbab7('0x2')](0x0);var events={'afterCreate':_0xbab7('0x3'),'afterUpdate':_0xbab7('0x4'),'afterDestroy':_0xbab7('0x5')};function emitEvent(_0x1e8a22){return function(_0x12b305,_0x157a47,_0x181a71){ChatMessageEvents[_0xbab7('0x6')](_0x1e8a22+':'+_0x12b305['id'],_0x12b305);ChatMessageEvents[_0xbab7('0x6')](_0x1e8a22,_0x12b305);_0x181a71(null);};}for(var e in events){if(events[_0xbab7('0x7')](e)){var event=events[e];ChatMessage[_0xbab7('0x8')](e,emitEvent(event));}}module[_0xbab7('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x9a23=['hook','exports','events','setMaxListeners','emit','hasOwnProperty'];(function(_0x39b9ee,_0xa7e997){var _0x1b3cf=function(_0x177645){while(--_0x177645){_0x39b9ee['push'](_0x39b9ee['shift']());}};_0x1b3cf(++_0xa7e997);}(_0x9a23,0xe6));var _0x39a2=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x9a23[_0x82129b];return _0x2ae5dc;};'use strict';var EventEmitter=require(_0x39a2('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x39a2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b26cc){return function(_0x325067,_0x57bf4f,_0xeeb0e4){ChatMessageEvents[_0x39a2('0x2')](_0x1b26cc+':'+_0x325067['id'],_0x325067);ChatMessageEvents['emit'](_0x1b26cc,_0x325067);_0xeeb0e4(null);};}for(var e in events){if(events[_0x39a2('0x3')](e)){var event=events[e];ChatMessage[_0x39a2('0x4')](e,emitEvent(event));}}module[_0x39a2('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index af807de..a2051e9 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 _0xb806=['then','update','catch','error','utf8mb4_unicode_ci','lodash','api','moment','path','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','ChatInteraction','findOne'];(function(_0x40ffbd,_0xacc000){var _0x4f65ee=function(_0x4c057f){while(--_0x4c057f){_0x40ffbd['push'](_0x40ffbd['shift']());}};_0x4f65ee(++_0xacc000);}(_0xb806,0x95));var _0x6b80=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xb806[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0x6b80('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b80('0x1'));var moment=require(_0x6b80('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b80('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b80('0x4'));module[_0x6b80('0x5')]=function(_0x2ab150,_0x520aef){return _0x2ab150[_0x6b80('0x6')](_0x6b80('0x7'),attributes,{'tableName':_0x6b80('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x6b80('0x9')],'type':_0x6b80('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x44bdc3,_0x2282b6,_0x415fdb){var _0xbe1b37=_0x2ab150[_0x6b80('0xb')];var _0x462f02=_0x44bdc3[_0x6b80('0xc')]({'plain':!![]});if(_0x462f02[_0x6b80('0xd')][_0x6b80('0xe')]()==='in'||_0x462f02[_0x6b80('0xd')][_0x6b80('0xe')]()==='out'&&!_0x462f02[_0x6b80('0xf')]&&!_['isNil'](_0x462f02[_0x6b80('0x10')])){_0xbe1b37[_0x6b80('0x11')][_0x6b80('0x12')]({'where':{'id':_0x462f02['ChatInteractionId']}})[_0x6b80('0x13')](function(_0x28218d){if(_0x28218d){_0x28218d[_0x6b80('0x14')]({'lastMsgAt':_0x462f02['createdAt'],'lastMsgDirection':_0x462f02[_0x6b80('0xd')]['toLowerCase']()});}})[_0x6b80('0x15')](function(_0x20dcd6){console[_0x6b80('0x16')](_0x20dcd6);});}_0x415fdb();}},'charset':'utf8mb4','collate':_0x6b80('0x17')});}; \ No newline at end of file +var _0x99b3=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash'];(function(_0x19ca86,_0x80c6a3){var _0x296609=function(_0x4e7d9e){while(--_0x4e7d9e){_0x19ca86['push'](_0x19ca86['shift']());}};_0x296609(++_0x80c6a3);}(_0x99b3,0x1db));var _0x399b=function(_0x32b9c9,_0x5881e6){_0x32b9c9=_0x32b9c9-0x0;var _0x1a837f=_0x99b3[_0x32b9c9];return _0x1a837f;};'use strict';var _=require(_0x399b('0x0'));var util=require(_0x399b('0x1'));var logger=require(_0x399b('0x2'))('api');var moment=require(_0x399b('0x3'));var BPromise=require('bluebird');var rp=require(_0x399b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x399b('0x5'));var config=require(_0x399b('0x6'));var attributes=require('./chatMessage.attributes');module[_0x399b('0x7')]=function(_0x212d5f,_0x5c1e79){return _0x212d5f[_0x399b('0x8')](_0x399b('0x9'),attributes,{'tableName':_0x399b('0xa'),'paranoid':![],'indexes':[{'name':_0x399b('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50d8b0,_0x17535b,_0x2d593d){var _0x3226a9=_0x212d5f[_0x399b('0xc')];var _0x49d3d2=_0x50d8b0[_0x399b('0xd')]({'plain':!![]});if(_0x49d3d2[_0x399b('0xe')]['toLowerCase']()==='in'||_0x49d3d2['direction'][_0x399b('0xf')]()===_0x399b('0x10')&&!_0x49d3d2[_0x399b('0x11')]&&!_['isNil'](_0x49d3d2[_0x399b('0x12')])){_0x3226a9[_0x399b('0x13')][_0x399b('0x14')]({'where':{'id':_0x49d3d2[_0x399b('0x15')]}})[_0x399b('0x16')](function(_0x3b45b9){if(_0x3b45b9){_0x3b45b9[_0x399b('0x17')]({'lastMsgAt':_0x49d3d2[_0x399b('0x18')],'lastMsgDirection':_0x49d3d2[_0x399b('0xe')][_0x399b('0xf')]()});}})[_0x399b('0x19')](function(_0x170280){console[_0x399b('0x1a')](_0x170280);});}_0x2d593d();}},'charset':'utf8mb4','collate':_0x399b('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 95d7b39..afc0d21 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 _0x8163=['ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./chatMessage.socket','register','request','then','info'];(function(_0x3fc837,_0x3f57d4){var _0x51f292=function(_0xc70386){while(--_0xc70386){_0x3fc837['push'](_0x3fc837['shift']());}};_0x51f292(++_0x3f57d4);}(_0x8163,0x11b));var _0x3816=function(_0x3b6f46,_0x6b0d76){_0x3b6f46=_0x3b6f46-0x0;var _0x26c584=_0x8163[_0x3b6f46];return _0x26c584;};'use strict';var _=require(_0x3816('0x0'));var util=require(_0x3816('0x1'));var moment=require(_0x3816('0x2'));var BPromise=require(_0x3816('0x3'));var rs=require(_0x3816('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3816('0x5'));var logger=require('../../config/logger')(_0x3816('0x6'));var config=require(_0x3816('0x7'));var jayson=require(_0x3816('0x8'));var client=jayson['client'][_0x3816('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3816('0xa')],{'host':_0x3816('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3816('0xa')]));require(_0x3816('0xc'))[_0x3816('0xd')](socket);function respondWithRpcPromise(_0x393ac6,_0x571961,_0xac572c){return new BPromise(function(_0x288e33,_0x3cf618){return client[_0x3816('0xe')](_0x393ac6,_0xac572c)[_0x3816('0xf')](function(_0x3c9e1e){logger[_0x3816('0x10')](_0x3816('0x11'),_0x571961,_0x3816('0x12'));logger['debug'](_0x3816('0x13'),_0x571961,'request\x20sent',JSON[_0x3816('0x14')](_0x3c9e1e));if(_0x3c9e1e[_0x3816('0x15')]){if(_0x3c9e1e[_0x3816('0x15')]['code']===0x1f4){logger[_0x3816('0x15')](_0x3816('0x11'),_0x571961,_0x3c9e1e[_0x3816('0x15')][_0x3816('0x16')]);return _0x3cf618(_0x3c9e1e[_0x3816('0x15')]['message']);}logger[_0x3816('0x15')](_0x3816('0x11'),_0x571961,_0x3c9e1e['error'][_0x3816('0x16')]);return _0x288e33(_0x3c9e1e['error'][_0x3816('0x16')]);}else{logger['info'](_0x3816('0x11'),_0x571961,_0x3816('0x12'));_0x288e33(_0x3c9e1e[_0x3816('0x17')][_0x3816('0x16')]);}})[_0x3816('0x18')](function(_0x38b5b9){logger[_0x3816('0x15')](_0x3816('0x11'),_0x571961,_0x38b5b9);_0x3cf618(_0x38b5b9);});});}exports[_0x3816('0x19')]=function(_0x4eec4a){var _0x4190c5=this;return new Promise(function(_0x3d3872,_0x568e12){return db['ChatMessage'][_0x3816('0x1a')](_0x4eec4a[_0x3816('0x1b')],{'raw':_0x4eec4a[_0x3816('0x1c')]?_0x4eec4a['options'][_0x3816('0x1d')]===undefined?!![]:![]:!![]})[_0x3816('0xf')](function(_0x19fabf){logger[_0x3816('0x10')](_0x3816('0x19'),_0x4eec4a);logger['debug']('CreateChatMessage',_0x4eec4a,JSON[_0x3816('0x14')](_0x19fabf));_0x3d3872(_0x19fabf);})[_0x3816('0x18')](function(_0x7fd0d7){logger[_0x3816('0x15')](_0x3816('0x19'),_0x7fd0d7[_0x3816('0x16')],_0x4eec4a);_0x568e12(_0x4190c5[_0x3816('0x15')](0x1f4,_0x7fd0d7[_0x3816('0x16')]));});});}; \ No newline at end of file +var _0xdb6b=['socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xdb6b,0x1b4));var _0xbdb6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb6b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbdb6('0x0'));var util=require(_0xbdb6('0x1'));var moment=require('moment');var BPromise=require(_0xbdb6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdb6('0x3'))['db'];var utils=require(_0xbdb6('0x4'));var logger=require(_0xbdb6('0x5'))(_0xbdb6('0x6'));var config=require('../../config/environment');var jayson=require(_0xbdb6('0x7'));var client=jayson[_0xbdb6('0x8')][_0xbdb6('0x9')]({'port':0x232a});config[_0xbdb6('0xa')]=_[_0xbdb6('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbdb6('0xc'))(new Redis(config['redis']));require(_0xbdb6('0xd'))[_0xbdb6('0xe')](socket);function respondWithRpcPromise(_0x4a6da6,_0x2b5793,_0x19a9a5){return new BPromise(function(_0x24fc33,_0x370abd){return client[_0xbdb6('0xf')](_0x4a6da6,_0x19a9a5)[_0xbdb6('0x10')](function(_0x3a352b){logger[_0xbdb6('0x11')](_0xbdb6('0x12'),_0x2b5793,_0xbdb6('0x13'));logger[_0xbdb6('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2b5793,_0xbdb6('0x13'),JSON[_0xbdb6('0x15')](_0x3a352b));if(_0x3a352b['error']){if(_0x3a352b['error'][_0xbdb6('0x16')]===0x1f4){logger[_0xbdb6('0x17')]('ChatMessage,\x20%s,\x20%s',_0x2b5793,_0x3a352b[_0xbdb6('0x17')][_0xbdb6('0x18')]);return _0x370abd(_0x3a352b[_0xbdb6('0x17')][_0xbdb6('0x18')]);}logger[_0xbdb6('0x17')](_0xbdb6('0x12'),_0x2b5793,_0x3a352b[_0xbdb6('0x17')]['message']);return _0x24fc33(_0x3a352b['error'][_0xbdb6('0x18')]);}else{logger[_0xbdb6('0x11')](_0xbdb6('0x12'),_0x2b5793,'request\x20sent');_0x24fc33(_0x3a352b[_0xbdb6('0x19')][_0xbdb6('0x18')]);}})[_0xbdb6('0x1a')](function(_0x2ece53){logger[_0xbdb6('0x17')](_0xbdb6('0x12'),_0x2b5793,_0x2ece53);_0x370abd(_0x2ece53);});});}exports[_0xbdb6('0x1b')]=function(_0x96734e){var _0xe5e5b4=this;return new Promise(function(_0x3b7a23,_0x58e0b1){return db[_0xbdb6('0x1c')][_0xbdb6('0x1d')](_0x96734e['body'],{'raw':_0x96734e[_0xbdb6('0x1e')]?_0x96734e[_0xbdb6('0x1e')][_0xbdb6('0x1f')]===undefined?!![]:![]:!![]})[_0xbdb6('0x10')](function(_0x21334a){logger['info'](_0xbdb6('0x1b'),_0x96734e);logger[_0xbdb6('0x14')](_0xbdb6('0x1b'),_0x96734e,JSON['stringify'](_0x21334a));_0x3b7a23(_0x21334a);})[_0xbdb6('0x1a')](function(_0x5d21a0){logger[_0xbdb6('0x17')]('CreateChatMessage',_0x5d21a0['message'],_0x96734e);_0x58e0b1(_0xe5e5b4[_0xbdb6('0x17')](0x1f4,_0x5d21a0[_0xbdb6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 3f7cbef..e05ba99 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 _0xfc17=['emit','removeListener','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x397b11,_0x387927){var _0x1ad3df=function(_0x2fea4e){while(--_0x2fea4e){_0x397b11['push'](_0x397b11['shift']());}};_0x1ad3df(++_0x387927);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x200b5f,_0x51adf6){_0x200b5f=_0x200b5f-0x0;var _0x23d840=_0xfc17[_0x200b5f];return _0x23d840;};'use strict';var ChatMessageEvents=require(_0x7fc1('0x0'));var events=[_0x7fc1('0x1'),_0x7fc1('0x2'),_0x7fc1('0x3')];function createListener(_0x524e76,_0x184a4d){return function(_0x3bbf44){_0x184a4d[_0x7fc1('0x4')](_0x524e76,_0x3bbf44);};}function removeListener(_0x1f6079,_0x44101d){return function(){ChatMessageEvents[_0x7fc1('0x5')](_0x1f6079,_0x44101d);};}exports['register']=function(_0x30f5f8){for(var _0x1867ea=0x0,_0x2267ea=events[_0x7fc1('0x6')];_0x1867ea<_0x2267ea;_0x1867ea++){var _0x24c678=events[_0x1867ea];var _0x1b7106=createListener(_0x7fc1('0x7')+_0x24c678,_0x30f5f8);ChatMessageEvents['on'](_0x24c678,_0x1b7106);}}; \ No newline at end of file +var _0x3595=['emit','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x12f28d,_0xa13732){var _0x252592=function(_0x14c9d2){while(--_0x14c9d2){_0x12f28d['push'](_0x12f28d['shift']());}};_0x252592(++_0xa13732);}(_0x3595,0x147));var _0x5359=function(_0x197e40,_0x1babb7){_0x197e40=_0x197e40-0x0;var _0x2f4388=_0x3595[_0x197e40];return _0x2f4388;};'use strict';var ChatMessageEvents=require(_0x5359('0x0'));var events=[_0x5359('0x1'),_0x5359('0x2'),'update'];function createListener(_0x18677f,_0x398ac6){return function(_0xcb2beb){_0x398ac6[_0x5359('0x3')](_0x18677f,_0xcb2beb);};}function removeListener(_0x1fa814,_0x125c76){return function(){ChatMessageEvents['removeListener'](_0x1fa814,_0x125c76);};}exports['register']=function(_0x1cb891){for(var _0x24545a=0x0,_0x1b6f48=events[_0x5359('0x4')];_0x24545a<_0x1b6f48;_0x24545a++){var _0x39fcd8=events[_0x24545a];var _0x51b2fb=createListener(_0x5359('0x5')+_0x39fcd8,_0x1cb891);ChatMessageEvents['on'](_0x39fcd8,_0x51b2fb);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 96558f6..1db0c7d 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 _0x7e13=['reject','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7e13,0xb1));var _0x37e1=function(_0x39bd2d,_0x333d60){_0x39bd2d=_0x39bd2d-0x0;var _0x3edaf9=_0x7e13[_0x39bd2d];return _0x3edaf9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x37e1('0x0'));var timeout=require(_0x37e1('0x1'));var express=require(_0x37e1('0x2'));var router=express[_0x37e1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x37e1('0x4'));var interaction=require(_0x37e1('0x5'));var config=require(_0x37e1('0x6'));var controller=require(_0x37e1('0x7'));router[_0x37e1('0x8')]('/',auth['isAuthenticated'](),controller[_0x37e1('0x9')]);router[_0x37e1('0x8')](_0x37e1('0xa'),auth[_0x37e1('0xb')](),controller[_0x37e1('0xc')]);router[_0x37e1('0x8')](_0x37e1('0xd'),auth[_0x37e1('0xb')](),controller[_0x37e1('0xe')]);router['post']('/',auth[_0x37e1('0xb')](),interaction[_0x37e1('0xf')](_0x37e1('0x10'),_0x37e1('0x11')),controller[_0x37e1('0x12')]);router[_0x37e1('0x13')]('/:id',controller[_0x37e1('0x14')]);router[_0x37e1('0x13')](_0x37e1('0x15'),auth[_0x37e1('0xb')](),controller['accept']);router[_0x37e1('0x13')](_0x37e1('0x16'),auth[_0x37e1('0xb')](),controller[_0x37e1('0x17')]);router['delete']('/:id',auth[_0x37e1('0xb')](),controller[_0x37e1('0x18')]);module['exports']=router; \ No newline at end of file +var _0xbd39=['/describe','isAuthenticated','describe','/:id','show','post','tracked','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','index','get'];(function(_0x2f9e62,_0x233b61){var _0x276576=function(_0x26d1eb){while(--_0x26d1eb){_0x2f9e62['push'](_0x2f9e62['shift']());}};_0x276576(++_0x233b61);}(_0xbd39,0x1d2));var _0x9bd3=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xbd39[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require(_0x9bd3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9bd3('0x1'));var express=require('express');var router=express[_0x9bd3('0x2')]();var fs_extra=require(_0x9bd3('0x3'));var auth=require(_0x9bd3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9bd3('0x5'));var controller=require(_0x9bd3('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9bd3('0x7')]);router[_0x9bd3('0x8')](_0x9bd3('0x9'),auth[_0x9bd3('0xa')](),controller[_0x9bd3('0xb')]);router[_0x9bd3('0x8')](_0x9bd3('0xc'),auth[_0x9bd3('0xa')](),controller[_0x9bd3('0xd')]);router[_0x9bd3('0xe')]('/',auth[_0x9bd3('0xa')](),interaction[_0x9bd3('0xf')]('chat','chatmessage:create'),controller[_0x9bd3('0x10')]);router[_0x9bd3('0x11')](_0x9bd3('0xc'),controller[_0x9bd3('0x12')]);router[_0x9bd3('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x9bd3('0x13')]);router[_0x9bd3('0x11')](_0x9bd3('0x14'),auth[_0x9bd3('0xa')](),controller[_0x9bd3('0x15')]);router[_0x9bd3('0x16')](_0x9bd3('0xc'),auth[_0x9bd3('0xa')](),controller[_0x9bd3('0x17')]);module[_0x9bd3('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 80d457e..8beb938 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x468658,_0xa6e84a){var _0xe8fbe6=function(_0x55bd79){while(--_0x55bd79){_0x468658['push'](_0x468658['shift']());}};_0xe8fbe6(++_0xa6e84a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5be46a,_0x2fb035){_0x5be46a=_0x5be46a-0x0;var _0x1ce3b8=_0xb10b[_0x5be46a];return _0x1ce3b8;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x216b9b,_0x1bf025){var _0x51ba89=function(_0x5bab61){while(--_0x5bab61){_0x216b9b['push'](_0x216b9b['shift']());}};_0x51ba89(++_0x1bf025);}(_0x2032,0xd9));var _0x2203=function(_0xc90105,_0x5140f3){_0xc90105=_0xc90105-0x0;var _0x5d645d=_0x2032[_0xc90105];return _0x5d645d;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 038b1c1..f8fd191 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(_0x54eea3,_0x681f76){var _0x5937dc=function(_0x357dd4){while(--_0x357dd4){_0x54eea3['push'](_0x54eea3['shift']());}};_0x5937dc(++_0x681f76);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x7a54,0x106));var _0x47a5=function(_0x1ca49e,_0x3da9d5){_0x1ca49e=_0x1ca49e-0x0;var _0x22b8ea=_0x7a54[_0x1ca49e];return _0x22b8ea;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 09e6fa0..07f5d8d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18c3=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update'];(function(_0x11e1ef,_0x3cbe5e){var _0x125d5b=function(_0x36267f){while(--_0x36267f){_0x11e1ef['push'](_0x11e1ef['shift']());}};_0x125d5b(++_0x3cbe5e);}(_0x18c3,0x136));var _0x318c=function(_0x3bd433,_0x58f9d9){_0x3bd433=_0x3bd433-0x0;var _0x192ad1=_0x18c3[_0x3bd433];return _0x192ad1;};'use strict';var EventEmitter=require(_0x318c('0x0'));var ChatOfflineMessage=require(_0x318c('0x1'))['db'][_0x318c('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x318c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x318c('0x4'),'afterDestroy':_0x318c('0x5')};function emitEvent(_0x4b6690){return function(_0x4bf0fd,_0x907dd5,_0x112aa7){ChatOfflineMessageEvents[_0x318c('0x6')](_0x4b6690+':'+_0x4bf0fd['id'],_0x4bf0fd);ChatOfflineMessageEvents[_0x318c('0x6')](_0x4b6690,_0x4bf0fd);_0x112aa7(null);};}for(var e in events){if(events[_0x318c('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x318c('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x7ca0=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x1882b5,_0x34314d){var _0x3286b8=function(_0x1503ed){while(--_0x1503ed){_0x1882b5['push'](_0x1882b5['shift']());}};_0x3286b8(++_0x34314d);}(_0x7ca0,0xe2));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x07ca('0x0'));var ChatOfflineMessage=require(_0x07ca('0x1'))['db'][_0x07ca('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x07ca('0x3')](0x0);var events={'afterCreate':_0x07ca('0x4'),'afterUpdate':'update','afterDestroy':_0x07ca('0x5')};function emitEvent(_0xcc4c90){return function(_0x5a82f8,_0x26e58d,_0x52ba7a){ChatOfflineMessageEvents[_0x07ca('0x6')](_0xcc4c90+':'+_0x5a82f8['id'],_0x5a82f8);ChatOfflineMessageEvents[_0x07ca('0x6')](_0xcc4c90,_0x5a82f8);_0x52ba7a(null);};}for(var e in events){if(events[_0x07ca('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x07ca('0x8')](e,emitEvent(event));}}module[_0x07ca('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index bbd1c16..46c9778 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 _0x0529=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define'];(function(_0x2245c7,_0x47951d){var _0x267daa=function(_0x21db85){while(--_0x21db85){_0x2245c7['push'](_0x2245c7['shift']());}};_0x267daa(++_0x47951d);}(_0x0529,0x139));var _0x9052=function(_0x1b756c,_0x1622c1){_0x1b756c=_0x1b756c-0x0;var _0x2704c0=_0x0529[_0x1b756c];return _0x2704c0;};'use strict';var attributes=require(_0x9052('0x0'));module['exports']=function(_0x33167e){return _0x33167e[_0x9052('0x1')](_0x9052('0x2'),attributes,{'tableName':_0x9052('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9052('0x4')});}; \ No newline at end of file +var _0x5c1f=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x20172d,_0x3ca859){var _0x305c17=function(_0x3020e9){while(--_0x3020e9){_0x20172d['push'](_0x20172d['shift']());}};_0x305c17(++_0x3ca859);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x5c1f[_0x338f73];return _0x163fdf;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xf5c1('0x0')]=function(_0x2cf2a5){return _0x2cf2a5[_0xf5c1('0x1')](_0xf5c1('0x2'),attributes,{'tableName':_0xf5c1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf5c1('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c003802..eefdce9 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 _0x919b=['ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x27fedb,_0x31c693){var _0x58ab78=function(_0x532732){while(--_0x532732){_0x27fedb['push'](_0x27fedb['shift']());}};_0x58ab78(++_0x31c693);}(_0x919b,0xb7));var _0xb919=function(_0x3527a4,_0x59397f){_0x3527a4=_0x3527a4-0x0;var _0x9f8962=_0x919b[_0x3527a4];return _0x9f8962;};'use strict';var _=require(_0xb919('0x0'));var util=require(_0xb919('0x1'));var moment=require(_0xb919('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb919('0x3'))['db'];var utils=require(_0xb919('0x4'));var logger=require(_0xb919('0x5'))('rpc');var config=require(_0xb919('0x6'));var jayson=require(_0xb919('0x7'));var client=jayson[_0xb919('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6a72,_0x2f3ea1,_0x3132e5){return new BPromise(function(_0x229463,_0x17685d){return client[_0xb919('0x9')](_0x4e6a72,_0x3132e5)[_0xb919('0xa')](function(_0x19956e){logger[_0xb919('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2f3ea1,_0xb919('0xc'));logger['debug'](_0xb919('0xd'),_0x2f3ea1,_0xb919('0xc'),JSON[_0xb919('0xe')](_0x19956e));if(_0x19956e['error']){if(_0x19956e[_0xb919('0xf')][_0xb919('0x10')]===0x1f4){logger[_0xb919('0xf')](_0xb919('0x11'),_0x2f3ea1,_0x19956e['error'][_0xb919('0x12')]);return _0x17685d(_0x19956e['error'][_0xb919('0x12')]);}logger['error'](_0xb919('0x11'),_0x2f3ea1,_0x19956e[_0xb919('0xf')][_0xb919('0x12')]);return _0x229463(_0x19956e['error'][_0xb919('0x12')]);}else{logger[_0xb919('0xb')](_0xb919('0x11'),_0x2f3ea1,_0xb919('0xc'));_0x229463(_0x19956e['result']['message']);}})[_0xb919('0x13')](function(_0xeba921){logger[_0xb919('0xf')](_0xb919('0x11'),_0x2f3ea1,_0xeba921);_0x17685d(_0xeba921);});});} \ No newline at end of file +var _0xf128=['rpc','../../config/environment','jayson/promise','client','request','then','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x416959,_0x1f34e2){var _0x3c849a=function(_0x5ef736){while(--_0x5ef736){_0x416959['push'](_0x416959['shift']());}};_0x3c849a(++_0x1f34e2);}(_0xf128,0x109));var _0x8f12=function(_0x42fb0e,_0x55fc22){_0x42fb0e=_0x42fb0e-0x0;var _0x595566=_0xf128[_0x42fb0e];return _0x595566;};'use strict';var _=require(_0x8f12('0x0'));var util=require(_0x8f12('0x1'));var moment=require(_0x8f12('0x2'));var BPromise=require(_0x8f12('0x3'));var rs=require(_0x8f12('0x4'));var fs=require('fs');var Redis=require(_0x8f12('0x5'));var db=require(_0x8f12('0x6'))['db'];var utils=require(_0x8f12('0x7'));var logger=require('../../config/logger')(_0x8f12('0x8'));var config=require(_0x8f12('0x9'));var jayson=require(_0x8f12('0xa'));var client=jayson[_0x8f12('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x297aef,_0x3a563d,_0x2ff8d3){return new BPromise(function(_0x5087e6,_0x30db87){return client[_0x8f12('0xc')](_0x297aef,_0x2ff8d3)[_0x8f12('0xd')](function(_0x186c89){logger['info'](_0x8f12('0xe'),_0x3a563d,'request\x20sent');logger['debug'](_0x8f12('0xf'),_0x3a563d,_0x8f12('0x10'),JSON['stringify'](_0x186c89));if(_0x186c89[_0x8f12('0x11')]){if(_0x186c89['error']['code']===0x1f4){logger[_0x8f12('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3a563d,_0x186c89[_0x8f12('0x11')][_0x8f12('0x12')]);return _0x30db87(_0x186c89[_0x8f12('0x11')][_0x8f12('0x12')]);}logger[_0x8f12('0x11')](_0x8f12('0xe'),_0x3a563d,_0x186c89[_0x8f12('0x11')]['message']);return _0x5087e6(_0x186c89[_0x8f12('0x11')][_0x8f12('0x12')]);}else{logger[_0x8f12('0x13')](_0x8f12('0xe'),_0x3a563d,_0x8f12('0x10'));_0x5087e6(_0x186c89[_0x8f12('0x14')][_0x8f12('0x12')]);}})['catch'](function(_0x52bf35){logger[_0x8f12('0x11')](_0x8f12('0xe'),_0x3a563d,_0x52bf35);_0x30db87(_0x52bf35);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d8b6473..85960dd 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 _0x0fb6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x5c2d75,_0x4035fc){var _0x48f399=function(_0x576db0){while(--_0x576db0){_0x5c2d75['push'](_0x5c2d75['shift']());}};_0x48f399(++_0x4035fc);}(_0x0fb6,0x181));var _0x60fb=function(_0x1d8b88,_0x1854e3){_0x1d8b88=_0x1d8b88-0x0;var _0x4bf7e0=_0x0fb6[_0x1d8b88];return _0x4bf7e0;};'use strict';var multer=require(_0x60fb('0x0'));var util=require(_0x60fb('0x1'));var path=require(_0x60fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x60fb('0x3'));var router=express[_0x60fb('0x4')]();var fs_extra=require(_0x60fb('0x5'));var auth=require(_0x60fb('0x6'));var interaction=require(_0x60fb('0x7'));var config=require(_0x60fb('0x8'));var controller=require(_0x60fb('0x9'));router[_0x60fb('0xa')]('/',auth[_0x60fb('0xb')](),controller[_0x60fb('0xc')]);router[_0x60fb('0xa')](_0x60fb('0xd'),auth[_0x60fb('0xb')](),controller[_0x60fb('0xe')]);router[_0x60fb('0xa')](_0x60fb('0xf'),auth[_0x60fb('0xb')](),controller['show']);router[_0x60fb('0x10')]('/',auth[_0x60fb('0xb')](),controller[_0x60fb('0x11')]);router[_0x60fb('0x12')]('/:id',auth[_0x60fb('0xb')](),controller[_0x60fb('0x13')]);router[_0x60fb('0x14')](_0x60fb('0xf'),auth[_0x60fb('0xb')](),controller[_0x60fb('0x15')]);module[_0x60fb('0x16')]=router; \ No newline at end of file +var _0x110e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','isAuthenticated','describe','show','post','create','/:id','update','exports','multer','util','path'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x110e,0x1c9));var _0xe110=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x110e[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var path=require(_0xe110('0x2'));var timeout=require(_0xe110('0x3'));var express=require(_0xe110('0x4'));var router=express[_0xe110('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe110('0x6'));var interaction=require(_0xe110('0x7'));var config=require(_0xe110('0x8'));var controller=require(_0xe110('0x9'));router[_0xe110('0xa')]('/',auth['isAuthenticated'](),controller[_0xe110('0xb')]);router[_0xe110('0xa')]('/describe',auth[_0xe110('0xc')](),controller[_0xe110('0xd')]);router[_0xe110('0xa')]('/:id',auth[_0xe110('0xc')](),controller[_0xe110('0xe')]);router[_0xe110('0xf')]('/',auth['isAuthenticated'](),controller[_0xe110('0x10')]);router['put'](_0xe110('0x11'),auth['isAuthenticated'](),controller[_0xe110('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe110('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c22a9a3..1da29b5 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 _0xb5ec=['mouseOver','sequelize','exports','STRING','timeout'];(function(_0x51f3ee,_0x55c355){var _0x2c7762=function(_0x5f477b){while(--_0x5f477b){_0x51f3ee['push'](_0x51f3ee['shift']());}};_0x2c7762(++_0x55c355);}(_0xb5ec,0x15f));var _0xcb5e=function(_0x434b64,_0x308507){_0x434b64=_0x434b64-0x0;var _0x451dae=_0xb5ec[_0x434b64];return _0x451dae;};'use strict';var Sequelize=require(_0xcb5e('0x0'));module[_0xcb5e('0x1')]={'name':{'type':Sequelize[_0xcb5e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xcb5e('0x3')),'defaultValue':_0xcb5e('0x4')},'selector':{'type':Sequelize[_0xcb5e('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb307=['mouseOver','sequelize','exports','STRING','ENUM','timeout'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0xb307,0x8b));var _0x7b30=function(_0x710ca0,_0x105983){_0x710ca0=_0x710ca0-0x0;var _0x3b65db=_0xb307[_0x710ca0];return _0x3b65db;};'use strict';var Sequelize=require(_0x7b30('0x0'));module[_0x7b30('0x1')]={'name':{'type':Sequelize[_0x7b30('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7b30('0x3')]('mouseOver',_0x7b30('0x4')),'defaultValue':_0x7b30('0x5')},'selector':{'type':Sequelize[_0x7b30('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 182a42c..1279322 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 _0x3f27=['find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','end','error','stack','name','send','params','model','keys','ChatProactiveAction','query','intersection','attributes','length','includeAll','include','options'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x3f27,0x1f4));var _0x73f2=function(_0x222335,_0x134d98){_0x222335=_0x222335-0x0;var _0x1acb89=_0x3f27[_0x222335];return _0x1acb89;};'use strict';var emlformat=require(_0x73f2('0x0'));var rimraf=require(_0x73f2('0x1'));var zipdir=require(_0x73f2('0x2'));var jsonpatch=require(_0x73f2('0x3'));var rp=require(_0x73f2('0x4'));var moment=require('moment');var BPromise=require(_0x73f2('0x5'));var Mustache=require(_0x73f2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73f2('0x7'));var ejs=require(_0x73f2('0x8'));var fs=require('fs');var fs_extra=require(_0x73f2('0x9'));var _=require(_0x73f2('0xa'));var squel=require(_0x73f2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x73f2('0xc'));var toCsv=require(_0x73f2('0x7'));var querystring=require(_0x73f2('0xd'));var Papa=require(_0x73f2('0xe'));var Redis=require(_0x73f2('0xf'));var authService=require(_0x73f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x73f2('0x11'));var hardwareService=require(_0x73f2('0x12'));var logger=require(_0x73f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73f2('0x14'));var db=require(_0x73f2('0x15'))['db'];function respondWithStatusCode(_0x20d4f3,_0x25e1bc){_0x25e1bc=_0x25e1bc||0xcc;return function(_0x454352){if(_0x454352){return _0x20d4f3[_0x73f2('0x16')](_0x25e1bc);}return _0x20d4f3[_0x73f2('0x17')](_0x25e1bc)['end']();};}function respondWithResult(_0x4d4bd2,_0x469686){_0x469686=_0x469686||0xc8;return function(_0x45e8e0){if(_0x45e8e0){return _0x4d4bd2['status'](_0x469686)['json'](_0x45e8e0);}};}function respondWithFilteredResult(_0x2c0720,_0x39feae){return function(_0x2a1ac6){if(_0x2a1ac6){var _0x262f51=typeof _0x39feae[_0x73f2('0x18')]===_0x73f2('0x19')&&typeof _0x39feae[_0x73f2('0x1a')]===_0x73f2('0x19');var _0x41e10c=_0x2a1ac6[_0x73f2('0x1b')];var _0x1dee61=_0x262f51?0x0:_0x39feae[_0x73f2('0x18')];var _0x2546a0=_0x262f51?_0x2a1ac6['count']:_0x39feae[_0x73f2('0x18')]+_0x39feae[_0x73f2('0x1a')];var _0x13c6ec;if(_0x2546a0>=_0x41e10c){_0x2546a0=_0x41e10c;_0x13c6ec=0xc8;}else{_0x13c6ec=0xce;}_0x2c0720[_0x73f2('0x17')](_0x13c6ec);return _0x2c0720['set'](_0x73f2('0x1c'),_0x1dee61+'-'+_0x2546a0+'/'+_0x41e10c)[_0x73f2('0x1d')](_0x2a1ac6);}return null;};}function patchUpdates(_0x416ead){return function(_0x2ae791){try{jsonpatch['apply'](_0x2ae791,_0x416ead,!![]);}catch(_0xd80727){return BPromise[_0x73f2('0x1e')](_0xd80727);}return _0x2ae791[_0x73f2('0x1f')]();};}function saveUpdates(_0x55416e,_0x4a723b){return function(_0x444b06){if(_0x444b06){return _0x444b06[_0x73f2('0x20')](_0x55416e)[_0x73f2('0x21')](function(_0x5e8f4c){return _0x5e8f4c;});}return null;};}function removeEntity(_0x4844df,_0x11a5da){return function(_0xd5bb3b){if(_0xd5bb3b){return _0xd5bb3b['destroy']()[_0x73f2('0x21')](function(){_0x4844df[_0x73f2('0x17')](0xcc)[_0x73f2('0x22')]();});}};}function handleEntityNotFound(_0x4ecdc7,_0x1b3f34){return function(_0x87e4e4){if(!_0x87e4e4){_0x4ecdc7[_0x73f2('0x16')](0x194);}return _0x87e4e4;};}function handleError(_0x5e06cb,_0x58bd99){_0x58bd99=_0x58bd99||0x1f4;return function(_0x5c52e3){logger[_0x73f2('0x23')](_0x5c52e3[_0x73f2('0x24')]);if(_0x5c52e3[_0x73f2('0x25')]){delete _0x5c52e3[_0x73f2('0x25')];}_0x5e06cb[_0x73f2('0x17')](_0x58bd99)[_0x73f2('0x26')](_0x5c52e3);};}exports['show']=function(_0x2840f0,_0xf0e828){var _0x4a90ac={'raw':!![],'where':{'id':_0x2840f0[_0x73f2('0x27')]['id']}},_0x21b18={};_0x21b18[_0x73f2('0x28')]=_[_0x73f2('0x29')](db[_0x73f2('0x2a')]['rawAttributes']);_0x21b18[_0x73f2('0x2b')]=_[_0x73f2('0x29')](_0x2840f0['query']);_0x21b18['filters']=_[_0x73f2('0x2c')](_0x21b18[_0x73f2('0x28')],_0x21b18[_0x73f2('0x2b')]);_0x4a90ac['attributes']=_['intersection'](_0x21b18['model'],qs['fields'](_0x2840f0[_0x73f2('0x2b')]['fields']));_0x4a90ac[_0x73f2('0x2d')]=_0x4a90ac[_0x73f2('0x2d')][_0x73f2('0x2e')]?_0x4a90ac[_0x73f2('0x2d')]:_0x21b18['model'];if(_0x2840f0[_0x73f2('0x2b')][_0x73f2('0x2f')]){_0x4a90ac[_0x73f2('0x30')]=[{'all':!![]}];}_0x4a90ac=_['merge']({},_0x4a90ac,_0x2840f0[_0x73f2('0x31')]);return db[_0x73f2('0x2a')][_0x73f2('0x32')](_0x4a90ac)['then'](handleEntityNotFound(_0xf0e828,null))[_0x73f2('0x21')](respondWithResult(_0xf0e828,null))[_0x73f2('0x33')](handleError(_0xf0e828,null));};exports[_0x73f2('0x34')]=function(_0x2ba1ec,_0x3f50b2){return db[_0x73f2('0x2a')][_0x73f2('0x34')](_0x2ba1ec[_0x73f2('0x35')],{})[_0x73f2('0x21')](respondWithResult(_0x3f50b2,0xc9))['catch'](handleError(_0x3f50b2,null));};exports['update']=function(_0x54a21f,_0x379cee){if(_0x54a21f[_0x73f2('0x35')]['id']){delete _0x54a21f[_0x73f2('0x35')]['id'];}return db['ChatProactiveAction'][_0x73f2('0x32')]({'where':{'id':_0x54a21f[_0x73f2('0x27')]['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x379cee,null))[_0x73f2('0x21')](saveUpdates(_0x54a21f[_0x73f2('0x35')],null))['then'](respondWithResult(_0x379cee,null))[_0x73f2('0x33')](handleError(_0x379cee,null));};exports[_0x73f2('0x36')]=function(_0xde2a1c,_0x42e3b5){return db[_0x73f2('0x2a')][_0x73f2('0x32')]({'where':{'id':_0xde2a1c['params']['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x42e3b5,null))['then'](removeEntity(_0x42e3b5,null))[_0x73f2('0x33')](handleError(_0x42e3b5,null));}; \ No newline at end of file +var _0x89fe=['body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','catch','create'];(function(_0xc52b9,_0x107a9c){var _0x1b91b6=function(_0x1c9621){while(--_0x1c9621){_0xc52b9['push'](_0xc52b9['shift']());}};_0x1b91b6(++_0x107a9c);}(_0x89fe,0x83));var _0xe89f=function(_0x92f065,_0x90e4a5){_0x92f065=_0x92f065-0x0;var _0x55ed79=_0x89fe[_0x92f065];return _0x55ed79;};'use strict';var emlformat=require(_0xe89f('0x0'));var rimraf=require(_0xe89f('0x1'));var zipdir=require(_0xe89f('0x2'));var jsonpatch=require(_0xe89f('0x3'));var rp=require('request-promise');var moment=require(_0xe89f('0x4'));var BPromise=require(_0xe89f('0x5'));var Mustache=require('mustache');var util=require(_0xe89f('0x6'));var path=require(_0xe89f('0x7'));var sox=require(_0xe89f('0x8'));var csv=require(_0xe89f('0x9'));var ejs=require(_0xe89f('0xa'));var fs=require('fs');var fs_extra=require(_0xe89f('0xb'));var _=require(_0xe89f('0xc'));var squel=require('squel');var crypto=require(_0xe89f('0xd'));var jsforce=require(_0xe89f('0xe'));var deskjs=require(_0xe89f('0xf'));var toCsv=require(_0xe89f('0x9'));var querystring=require(_0xe89f('0x10'));var Papa=require('papaparse');var Redis=require(_0xe89f('0x11'));var authService=require(_0xe89f('0x12'));var qs=require(_0xe89f('0x13'));var as=require(_0xe89f('0x14'));var hardwareService=require(_0xe89f('0x15'));var logger=require(_0xe89f('0x16'))(_0xe89f('0x17'));var utils=require(_0xe89f('0x18'));var config=require(_0xe89f('0x19'));var licenseUtil=require(_0xe89f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b6fc7,_0x548a3b){_0x548a3b=_0x548a3b||0xcc;return function(_0x4976a1){if(_0x4976a1){return _0x4b6fc7['sendStatus'](_0x548a3b);}return _0x4b6fc7[_0xe89f('0x1b')](_0x548a3b)[_0xe89f('0x1c')]();};}function respondWithResult(_0x4919f2,_0x489ef2){_0x489ef2=_0x489ef2||0xc8;return function(_0x4617e7){if(_0x4617e7){return _0x4919f2[_0xe89f('0x1b')](_0x489ef2)[_0xe89f('0x1d')](_0x4617e7);}};}function respondWithFilteredResult(_0x45d41e,_0xf1d0bf){return function(_0x2c82c3){if(_0x2c82c3){var _0x38050e=typeof _0xf1d0bf[_0xe89f('0x1e')]===_0xe89f('0x1f')&&typeof _0xf1d0bf[_0xe89f('0x20')]==='undefined';var _0x23f097=_0x2c82c3[_0xe89f('0x21')];var _0x510e6e=_0x38050e?0x0:_0xf1d0bf['offset'];var _0x11e5e1=_0x38050e?_0x2c82c3[_0xe89f('0x21')]:_0xf1d0bf[_0xe89f('0x1e')]+_0xf1d0bf[_0xe89f('0x20')];var _0xff80f5;if(_0x11e5e1>=_0x23f097){_0x11e5e1=_0x23f097;_0xff80f5=0xc8;}else{_0xff80f5=0xce;}_0x45d41e['status'](_0xff80f5);return _0x45d41e['set'](_0xe89f('0x22'),_0x510e6e+'-'+_0x11e5e1+'/'+_0x23f097)['json'](_0x2c82c3);}return null;};}function patchUpdates(_0x237718){return function(_0x33c584){try{jsonpatch[_0xe89f('0x23')](_0x33c584,_0x237718,!![]);}catch(_0x24715c){return BPromise[_0xe89f('0x24')](_0x24715c);}return _0x33c584[_0xe89f('0x25')]();};}function saveUpdates(_0x21dc02,_0x559d84){return function(_0x415505){if(_0x415505){return _0x415505[_0xe89f('0x26')](_0x21dc02)['then'](function(_0x4fc334){return _0x4fc334;});}return null;};}function removeEntity(_0x18b52e,_0x5b548d){return function(_0x24878d){if(_0x24878d){return _0x24878d[_0xe89f('0x27')]()['then'](function(){_0x18b52e[_0xe89f('0x1b')](0xcc)[_0xe89f('0x1c')]();});}};}function handleEntityNotFound(_0x5b3135,_0x5d7bff){return function(_0x2bd661){if(!_0x2bd661){_0x5b3135[_0xe89f('0x28')](0x194);}return _0x2bd661;};}function handleError(_0x312ad8,_0x29b9ff){_0x29b9ff=_0x29b9ff||0x1f4;return function(_0x288d8f){logger[_0xe89f('0x29')](_0x288d8f[_0xe89f('0x2a')]);if(_0x288d8f['name']){delete _0x288d8f['name'];}_0x312ad8[_0xe89f('0x1b')](_0x29b9ff)[_0xe89f('0x2b')](_0x288d8f);};}exports[_0xe89f('0x2c')]=function(_0xed3fc9,_0x26604a){var _0x5cf085={'raw':!![],'where':{'id':_0xed3fc9[_0xe89f('0x2d')]['id']}},_0x3c773c={};_0x3c773c[_0xe89f('0x2e')]=_[_0xe89f('0x2f')](db[_0xe89f('0x30')][_0xe89f('0x31')]);_0x3c773c[_0xe89f('0x32')]=_['keys'](_0xed3fc9[_0xe89f('0x32')]);_0x3c773c[_0xe89f('0x33')]=_['intersection'](_0x3c773c[_0xe89f('0x2e')],_0x3c773c[_0xe89f('0x32')]);_0x5cf085[_0xe89f('0x34')]=_[_0xe89f('0x35')](_0x3c773c[_0xe89f('0x2e')],qs[_0xe89f('0x36')](_0xed3fc9['query'][_0xe89f('0x36')]));_0x5cf085[_0xe89f('0x34')]=_0x5cf085['attributes'][_0xe89f('0x37')]?_0x5cf085[_0xe89f('0x34')]:_0x3c773c[_0xe89f('0x2e')];if(_0xed3fc9[_0xe89f('0x32')][_0xe89f('0x38')]){_0x5cf085[_0xe89f('0x39')]=[{'all':!![]}];}_0x5cf085=_[_0xe89f('0x3a')]({},_0x5cf085,_0xed3fc9[_0xe89f('0x3b')]);return db[_0xe89f('0x30')][_0xe89f('0x3c')](_0x5cf085)[_0xe89f('0x3d')](handleEntityNotFound(_0x26604a,null))[_0xe89f('0x3d')](respondWithResult(_0x26604a,null))[_0xe89f('0x3e')](handleError(_0x26604a,null));};exports[_0xe89f('0x3f')]=function(_0x4cb2db,_0x8dbd2f){return db['ChatProactiveAction'][_0xe89f('0x3f')](_0x4cb2db[_0xe89f('0x40')],{})['then'](respondWithResult(_0x8dbd2f,0xc9))[_0xe89f('0x3e')](handleError(_0x8dbd2f,null));};exports['update']=function(_0x13c9d0,_0x2e7a2f){if(_0x13c9d0[_0xe89f('0x40')]['id']){delete _0x13c9d0[_0xe89f('0x40')]['id'];}return db[_0xe89f('0x30')][_0xe89f('0x3c')]({'where':{'id':_0x13c9d0[_0xe89f('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2e7a2f,null))[_0xe89f('0x3d')](saveUpdates(_0x13c9d0[_0xe89f('0x40')],null))['then'](respondWithResult(_0x2e7a2f,null))[_0xe89f('0x3e')](handleError(_0x2e7a2f,null));};exports[_0xe89f('0x27')]=function(_0x4dc3f8,_0xe7df71){return db[_0xe89f('0x30')][_0xe89f('0x3c')]({'where':{'id':_0x4dc3f8[_0xe89f('0x2d')]['id']}})[_0xe89f('0x3d')](handleEntityNotFound(_0xe7df71,null))[_0xe89f('0x3d')](removeEntity(_0xe7df71,null))[_0xe89f('0x3e')](handleError(_0xe7df71,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index af44814..405ea31 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 _0xc48b=['chat_proactive_actions','lodash','../../config/logger','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x2021e4,_0x2ba7de){var _0x28452a=function(_0x4e73a9){while(--_0x4e73a9){_0x2021e4['push'](_0x2021e4['shift']());}};_0x28452a(++_0x2ba7de);}(_0xc48b,0x6f));var _0xbc48=function(_0xd49e15,_0x5e34ac){_0xd49e15=_0xd49e15-0x0;var _0x306b6a=_0xc48b[_0xd49e15];return _0x306b6a;};'use strict';var _=require(_0xbc48('0x0'));var util=require('util');var logger=require(_0xbc48('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc48('0x2'));var fs=require('fs');var path=require(_0xbc48('0x3'));var rimraf=require(_0xbc48('0x4'));var config=require('../../config/environment');var attributes=require(_0xbc48('0x5'));module[_0xbc48('0x6')]=function(_0x4e7d0f,_0x448217){return _0x4e7d0f[_0xbc48('0x7')](_0xbc48('0x8'),attributes,{'tableName':_0xbc48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf684=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x5be19b,_0x4b5f71){var _0xb312ed=function(_0x5b4648){while(--_0x5b4648){_0x5be19b['push'](_0x5be19b['shift']());}};_0xb312ed(++_0x4b5f71);}(_0xf684,0xe9));var _0x4f68=function(_0x5bb21e,_0x3b2726){_0x5bb21e=_0x5bb21e-0x0;var _0x53ca16=_0xf684[_0x5bb21e];return _0x53ca16;};'use strict';var _=require(_0x4f68('0x0'));var util=require(_0x4f68('0x1'));var logger=require(_0x4f68('0x2'))('api');var moment=require(_0x4f68('0x3'));var BPromise=require(_0x4f68('0x4'));var rp=require(_0x4f68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f68('0x6'));var config=require(_0x4f68('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x4f68('0x8')]=function(_0x1c39ab,_0x43bbb3){return _0x1c39ab['define'](_0x4f68('0x9'),attributes,{'tableName':_0x4f68('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 564a077..8682341 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 _0xd654=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','ChatProactiveAction,\x20%s,\x20%s','debug'];(function(_0x335e45,_0x20f8af){var _0x1680d0=function(_0x3e5149){while(--_0x3e5149){_0x335e45['push'](_0x335e45['shift']());}};_0x1680d0(++_0x20f8af);}(_0xd654,0x16d));var _0x4d65=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd654[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x4d65('0x0'));var util=require('util');var moment=require(_0x4d65('0x1'));var BPromise=require(_0x4d65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d65('0x3'));var db=require(_0x4d65('0x4'))['db'];var utils=require(_0x4d65('0x5'));var logger=require(_0x4d65('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4d65('0x7'));var client=jayson[_0x4d65('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa67ade,_0x1aefa5,_0x4236d5){return new BPromise(function(_0x4e8a56,_0x5f7963){return client[_0x4d65('0x9')](_0xa67ade,_0x4236d5)[_0x4d65('0xa')](function(_0x587730){logger['info'](_0x4d65('0xb'),_0x1aefa5,'request\x20sent');logger[_0x4d65('0xc')](_0x4d65('0xd'),_0x1aefa5,_0x4d65('0xe'),JSON['stringify'](_0x587730));if(_0x587730[_0x4d65('0xf')]){if(_0x587730['error']['code']===0x1f4){logger[_0x4d65('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1aefa5,_0x587730['error'][_0x4d65('0x10')]);return _0x5f7963(_0x587730[_0x4d65('0xf')][_0x4d65('0x10')]);}logger[_0x4d65('0xf')](_0x4d65('0xb'),_0x1aefa5,_0x587730[_0x4d65('0xf')]['message']);return _0x4e8a56(_0x587730[_0x4d65('0xf')][_0x4d65('0x10')]);}else{logger[_0x4d65('0x11')](_0x4d65('0xb'),_0x1aefa5,'request\x20sent');_0x4e8a56(_0x587730['result'][_0x4d65('0x10')]);}})['catch'](function(_0x30d397){logger[_0x4d65('0xf')](_0x4d65('0xb'),_0x1aefa5,_0x30d397);_0x5f7963(_0x30d397);});});} \ No newline at end of file +var _0x4dff=['randomstring','../../config/utils','rpc','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x2cf384,_0x50ce36){var _0x5d7346=function(_0x148176){while(--_0x148176){_0x2cf384['push'](_0x2cf384['shift']());}};_0x5d7346(++_0x50ce36);}(_0x4dff,0xce));var _0xf4df=function(_0x329577,_0x2af941){_0x329577=_0x329577-0x0;var _0x1cf6bf=_0x4dff[_0x329577];return _0x1cf6bf;};'use strict';var _=require('lodash');var util=require(_0xf4df('0x0'));var moment=require(_0xf4df('0x1'));var BPromise=require(_0xf4df('0x2'));var rs=require(_0xf4df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf4df('0x4'));var logger=require('../../config/logger')(_0xf4df('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4df('0x6')][_0xf4df('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3115f7,_0x9cd311,_0x44e890){return new BPromise(function(_0x588e67,_0x34590){return client['request'](_0x3115f7,_0x44e890)[_0xf4df('0x8')](function(_0x491db0){logger[_0xf4df('0x9')](_0xf4df('0xa'),_0x9cd311,_0xf4df('0xb'));logger[_0xf4df('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x9cd311,_0xf4df('0xb'),JSON[_0xf4df('0xd')](_0x491db0));if(_0x491db0[_0xf4df('0xe')]){if(_0x491db0[_0xf4df('0xe')][_0xf4df('0xf')]===0x1f4){logger['error'](_0xf4df('0xa'),_0x9cd311,_0x491db0[_0xf4df('0xe')][_0xf4df('0x10')]);return _0x34590(_0x491db0[_0xf4df('0xe')][_0xf4df('0x10')]);}logger[_0xf4df('0xe')](_0xf4df('0xa'),_0x9cd311,_0x491db0[_0xf4df('0xe')]['message']);return _0x588e67(_0x491db0['error'][_0xf4df('0x10')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x9cd311,_0xf4df('0xb'));_0x588e67(_0x491db0[_0xf4df('0x11')][_0xf4df('0x10')]);}})[_0xf4df('0x12')](function(_0x21c234){logger[_0xf4df('0xe')](_0xf4df('0xa'),_0x9cd311,_0x21c234);_0x34590(_0x21c234);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 940332c..bdb2172 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 _0x98a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x98a8,0x12c));var _0x898a=function(_0x16c219,_0x297392){_0x16c219=_0x16c219-0x0;var _0x4f3430=_0x98a8[_0x16c219];return _0x4f3430;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')](_0x898a('0xb'),auth['isAuthenticated'](),controller[_0x898a('0xc')]);router['post']('/',auth[_0x898a('0xd')](),controller['create']);router[_0x898a('0xe')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0x11')]);module[_0x898a('0x12')]=router; \ No newline at end of file +var _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x320225,_0xa8578){_0x320225=_0x320225-0x0;var _0x301e7b=_0x8d0e[_0x320225];return _0x301e7b;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 62e95a6..d3592f4 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 _0xdb75=['rrmemory','beepall','exports','name','ENUM'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xdb75,0x138));var _0x5db7=function(_0x402baf,_0x1ef0ba){_0x402baf=_0x402baf-0x0;var _0x1974d8=_0xdb75[_0x402baf];return _0x1974d8;};'use strict';var Sequelize=require('sequelize');module[_0x5db7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5db7('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5db7('0x2')](_0x5db7('0x3'),_0x5db7('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x2d09=['rrmemory','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d09,0x16e));var _0x92d0=function(_0x10f034,_0x4de98c){_0x10f034=_0x10f034-0x0;var _0xe8ccba=_0x2d09[_0x10f034];return _0xe8ccba;};'use strict';var Sequelize=require(_0x92d0('0x0'));module[_0x92d0('0x1')]={'name':{'type':Sequelize[_0x92d0('0x2')],'unique':_0x92d0('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x92d0('0x4')](_0x92d0('0x5'),'beepall',_0x92d0('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 510c6d9..f36de95 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 _0xa263=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','describe','length','hasOwnProperty','order','sort','where','ChatQueueId','filter','merge','options','UserChatQueue','User','UserId','agent','chatPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','findOne','pick','nolimit','addTeams','Team','Agents','voicePause','interface','flatMap','each','findOrCreate','userChatQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','includes','all','compact','transaction','isEmpty','removeAgents','forEach','emit','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','show','params','model','query','keys','filters','intersection','attributes','fields','includeAll','find','create','user'];(function(_0x545817,_0x4598d1){var _0x4a9efb=function(_0x295e53){while(--_0x295e53){_0x545817['push'](_0x545817['shift']());}};_0x4a9efb(++_0x4598d1);}(_0xa263,0x145));var _0x3a26=function(_0x4041ee,_0x18a1c3){_0x4041ee=_0x4041ee-0x0;var _0x1b44dc=_0xa263[_0x4041ee];return _0x1b44dc;};'use strict';var BPromise=require(_0x3a26('0x0'));var util=require('util');var _=require(_0x3a26('0x1'));var squel=require(_0x3a26('0x2'));var Redis=require(_0x3a26('0x3'));var qs=require(_0x3a26('0x4'));var logger=require(_0x3a26('0x5'))(_0x3a26('0x6'));var config=require(_0x3a26('0x7'));var db=require(_0x3a26('0x8'))['db'];config[_0x3a26('0x9')]=_[_0x3a26('0xa')](config['redis'],{'host':_0x3a26('0xb'),'port':0x18eb});var socket=require(_0x3a26('0xc'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x3a26('0xd')](socket);function respondWithStatusCode(_0x355e26,_0x3ca0b2){_0x3ca0b2=_0x3ca0b2||0xcc;return function(_0x1c8c2){if(_0x1c8c2){return _0x355e26[_0x3a26('0xe')](_0x3ca0b2);}return _0x355e26[_0x3a26('0xf')](_0x3ca0b2)[_0x3a26('0x10')]();};}function respondWithResult(_0x40f254,_0x44fa4c){_0x44fa4c=_0x44fa4c||0xc8;return function(_0x45b9d7){if(_0x45b9d7){return _0x40f254[_0x3a26('0xf')](_0x44fa4c)[_0x3a26('0x11')](_0x45b9d7);}};}function respondWithFilteredResult(_0x3d30a0,_0x46bfc8){return function(_0x2bfe65){if(_0x2bfe65){var _0x5e3a5c=typeof _0x46bfc8[_0x3a26('0x12')]==='undefined'&&typeof _0x46bfc8[_0x3a26('0x13')]==='undefined';var _0x3e74aa=_0x2bfe65[_0x3a26('0x14')];var _0x11c889=_0x5e3a5c?0x0:_0x46bfc8['offset'];var _0x31a283=_0x5e3a5c?_0x2bfe65[_0x3a26('0x14')]:_0x46bfc8[_0x3a26('0x12')]+_0x46bfc8[_0x3a26('0x13')];var _0x2e49d8;if(_0x31a283>=_0x3e74aa){_0x31a283=_0x3e74aa;_0x2e49d8=0xc8;}else{_0x2e49d8=0xce;}_0x3d30a0[_0x3a26('0xf')](_0x2e49d8);return _0x3d30a0[_0x3a26('0x15')](_0x3a26('0x16'),_0x11c889+'-'+_0x31a283+'/'+_0x3e74aa)[_0x3a26('0x11')](_0x2bfe65);}return null;};}function saveUpdates(_0x56dd52){return function(_0x2e52e1){if(_0x2e52e1){return _0x2e52e1[_0x3a26('0x17')](_0x56dd52)[_0x3a26('0x18')](function(_0xd51007){return _0xd51007;});}return null;};}function removeEntity(_0x5488d5){return function(_0xd7abf3){if(_0xd7abf3){return _0xd7abf3[_0x3a26('0x19')]()[_0x3a26('0x18')](function(){var _0x41faf5=_0xd7abf3[_0x3a26('0x1a')]({'plain':!![]});var _0x4e9636=_0x3a26('0x1b');return db[_0x3a26('0x1c')]['destroy']({'where':{'type':_0x4e9636,'resourceId':_0x41faf5['id']}})[_0x3a26('0x18')](function(){return _0xd7abf3;});})[_0x3a26('0x18')](function(){_0x5488d5[_0x3a26('0xf')](0xcc)[_0x3a26('0x10')]();});}};}function handleEntityNotFound(_0x3e5ab0){return function(_0x479f4a){if(!_0x479f4a){_0x3e5ab0[_0x3a26('0xe')](0x194);}return _0x479f4a;};}function handleError(_0x51ca19,_0xd63e69){_0xd63e69=_0xd63e69||0x1f4;return function(_0x346134){logger[_0x3a26('0x1d')](_0x346134[_0x3a26('0x1e')]);if(_0x346134[_0x3a26('0x1f')]){delete _0x346134[_0x3a26('0x1f')];}_0x51ca19[_0x3a26('0xf')](_0xd63e69)[_0x3a26('0x20')](_0x346134);};}exports[_0x3a26('0x21')]=function(_0x1f48da,_0x377a0c){var _0x1df4cc={};var _0x44955c={'count':0x0,'rows':[]};var _0x21c23a=_[_0x3a26('0x22')](db[_0x3a26('0x23')][_0x3a26('0x24')],function(_0x376e70){return{'name':_0x376e70[_0x3a26('0x25')],'type':_0x376e70[_0x3a26('0x26')][_0x3a26('0x27')]};});_0x1df4cc=qs[_0x3a26('0x28')](_0x21c23a,_0x1f48da);var _0x1e1ffb={'where':_0x1df4cc['where']};return db[_0x3a26('0x23')][_0x3a26('0x14')](_0x1e1ffb)[_0x3a26('0x18')](function(_0x3b5991){_0x44955c['count']=_0x3b5991;_0x1df4cc[_0x3a26('0x29')]=qs[_0x3a26('0x29')](_0x1f48da['query']);return db['ChatQueue'][_0x3a26('0x2a')](_0x1df4cc);})[_0x3a26('0x18')](function(_0x157fbd){_0x44955c['rows']=_0x157fbd;return _0x44955c;})[_0x3a26('0x18')](respondWithFilteredResult(_0x377a0c,_0x1df4cc))['catch'](handleError(_0x377a0c,null));};exports[_0x3a26('0x2b')]=function(_0x20501c,_0xb20ecc){var _0x427c05={'raw':!![],'where':{'id':_0x20501c[_0x3a26('0x2c')]['id']}},_0x4c00c5={};_0x4c00c5[_0x3a26('0x2d')]=_['keys'](db[_0x3a26('0x23')]['rawAttributes']);_0x4c00c5[_0x3a26('0x2e')]=_[_0x3a26('0x2f')](_0x20501c[_0x3a26('0x2e')]);_0x4c00c5[_0x3a26('0x30')]=_[_0x3a26('0x31')](_0x4c00c5['model'],_0x4c00c5[_0x3a26('0x2e')]);_0x427c05[_0x3a26('0x32')]=_[_0x3a26('0x31')](_0x4c00c5[_0x3a26('0x2d')],qs[_0x3a26('0x33')](_0x20501c['query'][_0x3a26('0x33')]));_0x427c05[_0x3a26('0x32')]=_0x427c05[_0x3a26('0x32')]['length']?_0x427c05[_0x3a26('0x32')]:_0x4c00c5[_0x3a26('0x2d')];if(_0x20501c[_0x3a26('0x2e')][_0x3a26('0x34')]){_0x427c05[_0x3a26('0x29')]=[{'all':!![]}];}_0x427c05=_['merge']({},_0x427c05,_0x20501c['options']);return db[_0x3a26('0x23')][_0x3a26('0x35')](_0x427c05)['then'](handleEntityNotFound(_0xb20ecc,null))['then'](respondWithResult(_0xb20ecc,null))['catch'](handleError(_0xb20ecc,null));};exports[_0x3a26('0x36')]=function(_0x2d4cda,_0x3e7e4b){return db[_0x3a26('0x23')][_0x3a26('0x36')](_0x2d4cda['body'],{})['then'](function(_0x2f4c5e){var _0x5a8744=_0x2d4cda[_0x3a26('0x37')][_0x3a26('0x1a')]({'plain':!![]});if(!_0x5a8744)throw new Error(_0x3a26('0x38'));if(_0x5a8744['role']==='user'){var _0x175f4f=_0x2f4c5e[_0x3a26('0x1a')]({'plain':!![]});var _0x58c419='ChatQueues';return db[_0x3a26('0x39')][_0x3a26('0x35')]({'where':{'name':_0x58c419,'userProfileId':_0x5a8744[_0x3a26('0x3a')]},'raw':!![]})[_0x3a26('0x18')](function(_0xaa6cca){if(_0xaa6cca&&_0xaa6cca[_0x3a26('0x3b')]===0x0){return db[_0x3a26('0x1c')][_0x3a26('0x36')]({'name':_0x175f4f[_0x3a26('0x1f')],'resourceId':_0x175f4f['id'],'type':_0xaa6cca[_0x3a26('0x1f')],'sectionId':_0xaa6cca['id']},{})[_0x3a26('0x18')](function(){return _0x2f4c5e;});}else{return _0x2f4c5e;}})['catch'](function(_0x46ca89){logger[_0x3a26('0x1d')](_0x3a26('0x3c'),_0x46ca89);throw _0x46ca89;});}return _0x2f4c5e;})[_0x3a26('0x18')](respondWithResult(_0x3e7e4b,0xc9))[_0x3a26('0x3d')](handleError(_0x3e7e4b,null));};exports[_0x3a26('0x17')]=function(_0x36cc79,_0x3e922b){if(_0x36cc79[_0x3a26('0x3e')]['id']){delete _0x36cc79[_0x3a26('0x3e')]['id'];}return db[_0x3a26('0x23')][_0x3a26('0x35')]({'where':{'id':_0x36cc79[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x3e922b,null))[_0x3a26('0x18')](saveUpdates(_0x36cc79[_0x3a26('0x3e')],null))[_0x3a26('0x18')](respondWithResult(_0x3e922b,null))[_0x3a26('0x3d')](handleError(_0x3e922b,null));};exports['destroy']=function(_0x48022a,_0x3f3021){return db['ChatQueue'][_0x3a26('0x35')]({'where':{'id':_0x48022a['params']['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x3f3021,null))[_0x3a26('0x18')](removeEntity(_0x3f3021,null))[_0x3a26('0x3d')](handleError(_0x3f3021,null));};exports[_0x3a26('0x3f')]=function(_0x35a620,_0x391c8f){return db[_0x3a26('0x23')]['describe']()[_0x3a26('0x18')](respondWithResult(_0x391c8f,null))['catch'](handleError(_0x391c8f,null));};exports['getMembers']=function(_0x364852,_0x26e9af){var _0x3571ef={'raw':!![],'where':{}},_0x392054={},_0x44a87e;return db[_0x3a26('0x23')]['findOne']({'where':{'id':_0x364852[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x26e9af,null))['then'](function(_0x353912){if(_0x353912){_0x44a87e=_0x353912['get']({'plain':!![]});_0x392054[_0x3a26('0x2d')]=_[_0x3a26('0x2f')](db['UserChatQueue'][_0x3a26('0x24')]);_0x392054['query']=_[_0x3a26('0x2f')](_0x364852[_0x3a26('0x2e')]);_0x392054['filters']=_[_0x3a26('0x31')](_0x392054[_0x3a26('0x2d')],_0x392054['query']);_0x3571ef[_0x3a26('0x32')]=_[_0x3a26('0x31')](_0x392054[_0x3a26('0x2d')],qs[_0x3a26('0x33')](_0x364852[_0x3a26('0x2e')][_0x3a26('0x33')]));_0x3571ef['attributes']=_0x3571ef[_0x3a26('0x32')][_0x3a26('0x40')]?_0x3571ef[_0x3a26('0x32')]:_0x392054[_0x3a26('0x2d')];if(!_0x364852['query'][_0x3a26('0x41')]('nolimit')){_0x3571ef[_0x3a26('0x13')]=qs[_0x3a26('0x13')](_0x364852[_0x3a26('0x2e')]['limit']);_0x3571ef['offset']=qs[_0x3a26('0x12')](_0x364852[_0x3a26('0x2e')][_0x3a26('0x12')]);}_0x3571ef[_0x3a26('0x42')]=qs['sort'](_0x364852['query'][_0x3a26('0x43')]);_0x3571ef['where']=qs['filters'](_['pick'](_0x364852[_0x3a26('0x2e')],_0x392054[_0x3a26('0x30')]));_0x3571ef[_0x3a26('0x44')][_0x3a26('0x45')]=_0x353912['id'];if(_0x364852[_0x3a26('0x2e')][_0x3a26('0x46')]){_0x3571ef[_0x3a26('0x44')]=_[_0x3a26('0x47')](_0x3571ef[_0x3a26('0x44')],{'$or':_[_0x3a26('0x22')](_0x3571ef[_0x3a26('0x32')],function(_0x228909){var _0x3653a4={};_0x3653a4[_0x228909]={'$like':'%'+_0x364852[_0x3a26('0x2e')]['filter']+'%'};return _0x3653a4;})});}_0x3571ef=_['merge']({},_0x3571ef,_0x364852[_0x3a26('0x48')]);return db[_0x3a26('0x49')][_0x3a26('0x2a')](_0x3571ef);}})[_0x3a26('0x18')](function(_0xfb27b4){if(_0xfb27b4){return db[_0x3a26('0x4a')]['findAndCountAll']({'where':{'id':_['map'](_0xfb27b4,_0x3a26('0x4b')),'role':_0x3a26('0x4c')},'attributes':['id','name',_0x3a26('0x4d'),'updatedAt',_0x3a26('0x4e')]});}})[_0x3a26('0x18')](function(_0x12dcdf){if(_0x12dcdf){return{'count':_0x12dcdf[_0x3a26('0x14')],'rows':_[_0x3a26('0x22')](_0x12dcdf[_0x3a26('0x4f')],function(_0x2d62f1){return{'membername':_0x2d62f1[_0x3a26('0x1f')],'UserId':_0x2d62f1['id'],'queue_name':_0x44a87e['name'],'ChatQueueId':_0x44a87e['id'],'interface':util[_0x3a26('0x50')](_0x3a26('0x51'),_0x3a26('0x52'),_0x2d62f1[_0x3a26('0x1f')]),'penalty':0x0,'paused':_0x2d62f1[_0x3a26('0x4d')],'createdAt':_0x2d62f1[_0x3a26('0x4e')],'updatedAt':_0x2d62f1[_0x3a26('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3a26('0x18')](respondWithFilteredResult(_0x26e9af,_0x3571ef))[_0x3a26('0x3d')](handleError(_0x26e9af,null));};exports[_0x3a26('0x54')]=function(_0x5702ba,_0x5b0246){var _0x4d828f={};var _0xf59c7c={};var _0x429323;var _0x35c051;return db[_0x3a26('0x23')][_0x3a26('0x55')]({'where':{'id':_0x5702ba['params']['id']}})['then'](handleEntityNotFound(_0x5b0246,null))['then'](function(_0xe53194){if(_0xe53194){_0x429323=_0xe53194;_0xf59c7c[_0x3a26('0x2d')]=_[_0x3a26('0x2f')](db['Team'][_0x3a26('0x24')]);_0xf59c7c[_0x3a26('0x2e')]=_[_0x3a26('0x2f')](_0x5702ba[_0x3a26('0x2e')]);_0xf59c7c[_0x3a26('0x30')]=_['intersection'](_0xf59c7c[_0x3a26('0x2d')],_0xf59c7c[_0x3a26('0x2e')]);_0x4d828f[_0x3a26('0x32')]=_[_0x3a26('0x31')](_0xf59c7c[_0x3a26('0x2d')],qs['fields'](_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x33')]));_0x4d828f[_0x3a26('0x32')]=_0x4d828f[_0x3a26('0x32')][_0x3a26('0x40')]?_0x4d828f['attributes']:_0xf59c7c['model'];_0x4d828f[_0x3a26('0x42')]=qs[_0x3a26('0x43')](_0x5702ba[_0x3a26('0x2e')]['sort']);_0x4d828f['where']=qs['filters'](_[_0x3a26('0x56')](_0x5702ba[_0x3a26('0x2e')],_0xf59c7c['filters']));if(_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x46')]){_0x4d828f[_0x3a26('0x44')]=_['merge'](_0x4d828f['where'],{'$or':_[_0x3a26('0x22')](_0x4d828f[_0x3a26('0x32')],function(_0x2d3dcc){var _0x187546={};_0x187546[_0x2d3dcc]={'$like':'%'+_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x46')]+'%'};return _0x187546;})});}_0x4d828f=_['merge']({},_0x4d828f,_0x5702ba['options']);return _0x429323['getTeams'](_0x4d828f);}})[_0x3a26('0x18')](function(_0x4c7c0b){if(_0x4c7c0b){_0x35c051=_0x4c7c0b[_0x3a26('0x40')];if(!_0x5702ba[_0x3a26('0x2e')]['hasOwnProperty'](_0x3a26('0x57'))){_0x4d828f[_0x3a26('0x13')]=qs[_0x3a26('0x13')](_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x13')]);_0x4d828f[_0x3a26('0x12')]=qs[_0x3a26('0x12')](_0x5702ba[_0x3a26('0x2e')][_0x3a26('0x12')]);}return _0x429323[_0x3a26('0x54')](_0x4d828f);}})[_0x3a26('0x18')](function(_0x112be8){if(_0x112be8){return _0x112be8?{'count':_0x35c051,'rows':_0x112be8}:null;}})[_0x3a26('0x18')](respondWithResult(_0x5b0246,null))[_0x3a26('0x3d')](handleError(_0x5b0246,null));};exports[_0x3a26('0x58')]=function(_0xddee1a,_0x55d301){var _0x591da8=_0xddee1a[_0x3a26('0x3e')]['ids'];return db[_0x3a26('0x59')][_0x3a26('0x2a')]({'where':{'id':_0x591da8},'attributes':['id'],'include':[{'model':db[_0x3a26('0x4a')],'as':_0x3a26('0x5a'),'attributes':['id',_0x3a26('0x1f'),'online',_0x3a26('0x5b'),_0x3a26('0x5c')],'raw':!![]}]})[_0x3a26('0x18')](function(_0x56f600){if(_0x56f600){var _0x310064=_[_0x3a26('0x5d')](_0x56f600,function(_0x2dbbb1){var _0x190dc6=_0x2dbbb1[_0x3a26('0x1a')]({'plain':!![]});return _0x190dc6[_0x3a26('0x5a')];});return db[_0x3a26('0x23')]['find']({'where':{'id':_0xddee1a[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](function(_0x66a738){return db['sequelize']['transaction'](function(_0x4f5ced){return _0x66a738[_0x3a26('0x58')](_0x591da8,{'transaction':_0x4f5ced})['then'](function(){return BPromise[_0x3a26('0x5e')](_0x310064,function(_0x164d7d){return db[_0x3a26('0x49')][_0x3a26('0x5f')]({'where':{'UserId':_0x164d7d['id'],'ChatQueueId':_0xddee1a[_0x3a26('0x2c')]['id']},'transaction':_0x4f5ced});});})['then'](function(){_0x310064['forEach'](function(_0x2d7a19){socket['emit'](_0x3a26('0x60'),{'UserId':_0x2d7a19['id'],'ChatQueueId':_0x66a738['id']});});});});});}})[_0x3a26('0x18')](respondWithStatusCode(_0x55d301,null))[_0x3a26('0x3d')](handleError(_0x55d301,null));};exports[_0x3a26('0x61')]=function(_0x587b19,_0x506415){return db[_0x3a26('0x59')][_0x3a26('0x2a')]({'where':{'id':_0x587b19[_0x3a26('0x2e')][_0x3a26('0x62')]},'attributes':['id'],'include':[{'model':db[_0x3a26('0x4a')],'as':_0x3a26('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x3a26('0x18')](handleEntityNotFound(_0x506415,null))['then'](function(_0x5d3953){var _0x2897da=_[_0x3a26('0x22')](_0x5d3953,'id');var _0x57ff45=[];var _0x567012=[];var _0x9b89a0=squel[_0x3a26('0x63')]();_0x9b89a0['field'](_0x3a26('0x64'))[_0x3a26('0x65')](_0x3a26('0x66'),'tq')[_0x3a26('0x67')](_0x3a26('0x68'),'ut',_0x3a26('0x69'))[_0x3a26('0x44')](_0x3a26('0x6a'),_0x587b19[_0x3a26('0x2c')]['id']);for(var _0x438a37=0x0;_0x438a37<_0x5d3953[_0x3a26('0x40')];_0x438a37+=0x1){let _0x506566=_0x5d3953[_0x438a37];for(var _0x6464e0=0x0;_0x6464e0<_0x506566[_0x3a26('0x5a')][_0x3a26('0x40')];_0x6464e0+=0x1){let _0x454656=_0x506566['Agents'][_0x6464e0];var _0x677481=_0x9b89a0[_0x3a26('0x6b')]();_0x677481['where'](_0x3a26('0x6c'),_0x454656['id']);_0x567012['push'](db[_0x3a26('0x6d')][_0x3a26('0x2e')](_0x677481[_0x3a26('0x6e')](),{'type':db[_0x3a26('0x6d')]['QueryTypes'][_0x3a26('0x6f')]})['then'](function(_0x3cec38){if(_0x3cec38[_0x3a26('0x40')]===0x1){return _0x454656['id'];}else{var _0x9efea6=_[_0x3a26('0x70')](_[_0x3a26('0x22')](_0x3cec38,'TeamId'),function(_0x38c152){return _[_0x3a26('0x71')](_0x2897da,_0x38c152);});if(_0x9efea6){return _0x454656['id'];}}}));}}return BPromise[_0x3a26('0x72')](_0x567012)[_0x3a26('0x18')](function(_0x46bf90){_0x57ff45=_(_0x57ff45)['union'](_0x46bf90)[_0x3a26('0x73')]()['value']();return db['ChatQueue']['find']({'where':{'id':_0x587b19[_0x3a26('0x2c')]['id']}})['then'](function(_0x11a53b){return db[_0x3a26('0x6d')][_0x3a26('0x74')](function(_0x11f1b9){return _0x11a53b['removeTeams'](_0x587b19['query'][_0x3a26('0x62')],{'transaction':_0x11f1b9})[_0x3a26('0x18')](function(){if(!_[_0x3a26('0x75')](_0x57ff45)){return _0x11a53b[_0x3a26('0x76')](_0x57ff45,{'transaction':_0x11f1b9});}})[_0x3a26('0x18')](function(){_0x57ff45[_0x3a26('0x77')](function(_0x532dbc){socket[_0x3a26('0x78')]('userChatQueue:remove',{'UserId':_0x532dbc,'ChatQueueId':_0x11a53b['id']});});});});});});})[_0x3a26('0x18')](respondWithStatusCode(_0x506415,null))[_0x3a26('0x3d')](handleError(_0x506415,null));};exports[_0x3a26('0x79')]=function(_0x5d7f05,_0x1f7b3e){return db[_0x3a26('0x23')][_0x3a26('0x35')]({'where':{'id':_0x5d7f05[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x1f7b3e,null))[_0x3a26('0x18')](function(_0x2579d8){if(_0x2579d8){return _0x2579d8[_0x3a26('0x79')](_0x5d7f05[_0x3a26('0x3e')]['ids'],_[_0x3a26('0x7a')](_0x5d7f05[_0x3a26('0x3e')],[_0x3a26('0x62'),'id'])||{})[_0x3a26('0x7b')](function(_0xe04e65){for(var _0x3f8bdd=0x0;_0x3f8bdd<_0x5d7f05['body'][_0x3a26('0x62')][_0x3a26('0x40')];_0x3f8bdd+=0x1){socket[_0x3a26('0x78')](_0x3a26('0x60'),{'UserId':Number(_0x5d7f05['body']['ids'][_0x3f8bdd]),'ChatQueueId':Number(_0x5d7f05['params']['id'])});}return _0xe04e65;});}})[_0x3a26('0x18')](respondWithResult(_0x1f7b3e,null))['catch'](handleError(_0x1f7b3e,null));};exports[_0x3a26('0x76')]=function(_0x477607,_0x44c56b){return db[_0x3a26('0x23')][_0x3a26('0x35')]({'where':{'id':_0x477607[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x44c56b,null))[_0x3a26('0x18')](function(_0x1af95c){if(_0x1af95c){return _0x1af95c[_0x3a26('0x76')](_0x477607[_0x3a26('0x2e')][_0x3a26('0x62')])[_0x3a26('0x18')](function(){if(_[_0x3a26('0x7c')](_0x477607['query']['ids'])){for(var _0x210f2e=0x0;_0x210f2e<_0x477607[_0x3a26('0x2e')][_0x3a26('0x62')][_0x3a26('0x40')];_0x210f2e+=0x1){socket[_0x3a26('0x78')](_0x3a26('0x7d'),{'UserId':Number(_0x477607[_0x3a26('0x2e')][_0x3a26('0x62')][_0x210f2e]),'ChatQueueId':Number(_0x477607[_0x3a26('0x2c')]['id'])});}}else{socket['emit'](_0x3a26('0x7d'),{'UserId':Number(_0x477607['query'][_0x3a26('0x62')]),'ChatQueueId':Number(_0x477607[_0x3a26('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x44c56b,null))[_0x3a26('0x3d')](handleError(_0x44c56b,null));};exports[_0x3a26('0x7e')]=function(_0x543945,_0x3269a7){var _0x2bdd9e={};var _0x437676={};var _0x2f480f;var _0x40ade4;return db['ChatQueue'][_0x3a26('0x55')]({'where':{'id':_0x543945[_0x3a26('0x2c')]['id']}})[_0x3a26('0x18')](handleEntityNotFound(_0x3269a7,null))['then'](function(_0x232e42){if(_0x232e42){_0x2f480f=_0x232e42;_0x437676[_0x3a26('0x2d')]=_['keys'](db['User'][_0x3a26('0x24')]);_0x437676['query']=_['keys'](_0x543945[_0x3a26('0x2e')]);_0x437676[_0x3a26('0x30')]=_['intersection'](_0x437676[_0x3a26('0x2d')],_0x437676[_0x3a26('0x2e')]);_0x2bdd9e[_0x3a26('0x32')]=_['intersection'](_0x437676[_0x3a26('0x2d')],qs[_0x3a26('0x33')](_0x543945[_0x3a26('0x2e')][_0x3a26('0x33')]));_0x2bdd9e[_0x3a26('0x32')]=_0x2bdd9e[_0x3a26('0x32')][_0x3a26('0x40')]?_0x2bdd9e['attributes']:_0x437676['model'];_0x2bdd9e['order']=qs[_0x3a26('0x43')](_0x543945[_0x3a26('0x2e')][_0x3a26('0x43')]);_0x2bdd9e[_0x3a26('0x44')]=qs['filters'](_[_0x3a26('0x56')](_0x543945[_0x3a26('0x2e')],_0x437676[_0x3a26('0x30')]));if(_0x543945[_0x3a26('0x2e')]['filter']){_0x2bdd9e['where']=_['merge'](_0x2bdd9e[_0x3a26('0x44')],{'$or':_['map'](_0x2bdd9e['attributes'],function(_0x460ddc){var _0x3c60c0={};_0x3c60c0[_0x460ddc]={'$like':'%'+_0x543945[_0x3a26('0x2e')][_0x3a26('0x46')]+'%'};return _0x3c60c0;})});}_0x2bdd9e=_[_0x3a26('0x47')]({},_0x2bdd9e,_0x543945[_0x3a26('0x48')]);return _0x2f480f[_0x3a26('0x7e')](_0x2bdd9e);}})['then'](function(_0x3fd7d0){if(_0x3fd7d0){_0x40ade4=_0x3fd7d0['length'];if(!_0x543945[_0x3a26('0x2e')][_0x3a26('0x41')](_0x3a26('0x57'))){_0x2bdd9e[_0x3a26('0x13')]=qs[_0x3a26('0x13')](_0x543945[_0x3a26('0x2e')][_0x3a26('0x13')]);_0x2bdd9e[_0x3a26('0x12')]=qs[_0x3a26('0x12')](_0x543945[_0x3a26('0x2e')][_0x3a26('0x12')]);}return _0x2f480f[_0x3a26('0x7e')](_0x2bdd9e);}})['then'](function(_0x24b955){if(_0x24b955){return _0x24b955?{'count':_0x40ade4,'rows':_0x24b955}:null;}})['then'](respondWithResult(_0x3269a7,null))[_0x3a26('0x3d')](handleError(_0x3269a7,null));}; \ No newline at end of file +var _0xc0aa=['squel','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','status','json','offset','undefined','limit','count','set','update','destroy','UserProfileResource','then','end','sendStatus','error','stack','name','send','map','ChatQueue','fieldName','key','getOptions','where','include','findAll','catch','params','keys','rawAttributes','query','filters','model','attributes','fields','length','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','get','UserChatQueue','intersection','hasOwnProperty','sort','ChatQueueId','filter','options','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','order','pick','nolimit','addTeams','ids','online','voicePause','interface','flatMap','Agents','transaction','each','emit','userChatQueue:save','removeTeams','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','TeamId','includes','compact','value','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','findOne','bluebird','util','lodash'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xc0aa,0x15c));var _0xac0a=function(_0x29e6d7,_0x209e67){_0x29e6d7=_0x29e6d7-0x0;var _0x2d7263=_0xc0aa[_0x29e6d7];return _0x2d7263;};'use strict';var BPromise=require(_0xac0a('0x0'));var util=require(_0xac0a('0x1'));var _=require(_0xac0a('0x2'));var squel=require(_0xac0a('0x3'));var Redis=require('ioredis');var qs=require(_0xac0a('0x4'));var logger=require('../../config/logger')(_0xac0a('0x5'));var config=require('../../config/environment');var db=require(_0xac0a('0x6'))['db'];config[_0xac0a('0x7')]=_[_0xac0a('0x8')](config[_0xac0a('0x7')],{'host':_0xac0a('0x9'),'port':0x18eb});var socket=require(_0xac0a('0xa'))(new Redis(config['redis']));require(_0xac0a('0xb'))[_0xac0a('0xc')](socket);function respondWithStatusCode(_0x564ffc,_0x3b055d){_0x3b055d=_0x3b055d||0xcc;return function(_0x5e4ce6){if(_0x5e4ce6){return _0x564ffc['sendStatus'](_0x3b055d);}return _0x564ffc[_0xac0a('0xd')](_0x3b055d)['end']();};}function respondWithResult(_0x43de45,_0x167eeb){_0x167eeb=_0x167eeb||0xc8;return function(_0x492574){if(_0x492574){return _0x43de45['status'](_0x167eeb)[_0xac0a('0xe')](_0x492574);}};}function respondWithFilteredResult(_0x3eb07e,_0x29905b){return function(_0x4590cd){if(_0x4590cd){var _0x578e3c=typeof _0x29905b[_0xac0a('0xf')]===_0xac0a('0x10')&&typeof _0x29905b[_0xac0a('0x11')]===_0xac0a('0x10');var _0x2435b4=_0x4590cd[_0xac0a('0x12')];var _0x7fe4b2=_0x578e3c?0x0:_0x29905b[_0xac0a('0xf')];var _0x385748=_0x578e3c?_0x4590cd['count']:_0x29905b[_0xac0a('0xf')]+_0x29905b[_0xac0a('0x11')];var _0x378609;if(_0x385748>=_0x2435b4){_0x385748=_0x2435b4;_0x378609=0xc8;}else{_0x378609=0xce;}_0x3eb07e[_0xac0a('0xd')](_0x378609);return _0x3eb07e[_0xac0a('0x13')]('Content-Range',_0x7fe4b2+'-'+_0x385748+'/'+_0x2435b4)['json'](_0x4590cd);}return null;};}function saveUpdates(_0x3397fa){return function(_0x291224){if(_0x291224){return _0x291224[_0xac0a('0x14')](_0x3397fa)['then'](function(_0x43c839){return _0x43c839;});}return null;};}function removeEntity(_0x237877){return function(_0x534898){if(_0x534898){return _0x534898[_0xac0a('0x15')]()['then'](function(){var _0x5104f5=_0x534898['get']({'plain':!![]});var _0x1a28f8='ChatQueues';return db[_0xac0a('0x16')][_0xac0a('0x15')]({'where':{'type':_0x1a28f8,'resourceId':_0x5104f5['id']}})[_0xac0a('0x17')](function(){return _0x534898;});})[_0xac0a('0x17')](function(){_0x237877[_0xac0a('0xd')](0xcc)[_0xac0a('0x18')]();});}};}function handleEntityNotFound(_0x48416b){return function(_0x168016){if(!_0x168016){_0x48416b[_0xac0a('0x19')](0x194);}return _0x168016;};}function handleError(_0x5081c6,_0x340636){_0x340636=_0x340636||0x1f4;return function(_0x11ce01){logger[_0xac0a('0x1a')](_0x11ce01[_0xac0a('0x1b')]);if(_0x11ce01[_0xac0a('0x1c')]){delete _0x11ce01[_0xac0a('0x1c')];}_0x5081c6['status'](_0x340636)[_0xac0a('0x1d')](_0x11ce01);};}exports['index']=function(_0x515674,_0x8cbf8f){var _0x1b2d85={};var _0xed5aa8={'count':0x0,'rows':[]};var _0x327488=_[_0xac0a('0x1e')](db[_0xac0a('0x1f')]['rawAttributes'],function(_0x197ba7){return{'name':_0x197ba7[_0xac0a('0x20')],'type':_0x197ba7['type'][_0xac0a('0x21')]};});_0x1b2d85=qs[_0xac0a('0x22')](_0x327488,_0x515674);var _0x313086={'where':_0x1b2d85[_0xac0a('0x23')]};return db[_0xac0a('0x1f')]['count'](_0x313086)[_0xac0a('0x17')](function(_0x17996c){_0xed5aa8[_0xac0a('0x12')]=_0x17996c;_0x1b2d85[_0xac0a('0x24')]=qs[_0xac0a('0x24')](_0x515674['query']);return db[_0xac0a('0x1f')][_0xac0a('0x25')](_0x1b2d85);})['then'](function(_0xdb75d4){_0xed5aa8['rows']=_0xdb75d4;return _0xed5aa8;})[_0xac0a('0x17')](respondWithFilteredResult(_0x8cbf8f,_0x1b2d85))[_0xac0a('0x26')](handleError(_0x8cbf8f,null));};exports['show']=function(_0x3a7ee6,_0x4b079e){var _0x508d84={'raw':!![],'where':{'id':_0x3a7ee6[_0xac0a('0x27')]['id']}},_0x5dbd1a={};_0x5dbd1a['model']=_[_0xac0a('0x28')](db[_0xac0a('0x1f')][_0xac0a('0x29')]);_0x5dbd1a[_0xac0a('0x2a')]=_[_0xac0a('0x28')](_0x3a7ee6['query']);_0x5dbd1a[_0xac0a('0x2b')]=_['intersection'](_0x5dbd1a[_0xac0a('0x2c')],_0x5dbd1a[_0xac0a('0x2a')]);_0x508d84[_0xac0a('0x2d')]=_['intersection'](_0x5dbd1a[_0xac0a('0x2c')],qs['fields'](_0x3a7ee6[_0xac0a('0x2a')][_0xac0a('0x2e')]));_0x508d84[_0xac0a('0x2d')]=_0x508d84[_0xac0a('0x2d')][_0xac0a('0x2f')]?_0x508d84['attributes']:_0x5dbd1a['model'];if(_0x3a7ee6[_0xac0a('0x2a')]['includeAll']){_0x508d84[_0xac0a('0x24')]=[{'all':!![]}];}_0x508d84=_[_0xac0a('0x30')]({},_0x508d84,_0x3a7ee6['options']);return db[_0xac0a('0x1f')]['find'](_0x508d84)[_0xac0a('0x17')](handleEntityNotFound(_0x4b079e,null))[_0xac0a('0x17')](respondWithResult(_0x4b079e,null))[_0xac0a('0x26')](handleError(_0x4b079e,null));};exports[_0xac0a('0x31')]=function(_0x4bc3d5,_0x1a0dd3){return db['ChatQueue']['create'](_0x4bc3d5[_0xac0a('0x32')],{})['then'](function(_0x29ff96){var _0x5075f1=_0x4bc3d5['user']['get']({'plain':!![]});if(!_0x5075f1)throw new Error(_0xac0a('0x33'));if(_0x5075f1[_0xac0a('0x34')]===_0xac0a('0x35')){var _0x50bc99=_0x29ff96['get']({'plain':!![]});var _0x2c8ae9=_0xac0a('0x36');return db[_0xac0a('0x37')][_0xac0a('0x38')]({'where':{'name':_0x2c8ae9,'userProfileId':_0x5075f1['userProfileId']},'raw':!![]})[_0xac0a('0x17')](function(_0x12df5d){if(_0x12df5d&&_0x12df5d[_0xac0a('0x39')]===0x0){return db[_0xac0a('0x16')]['create']({'name':_0x50bc99[_0xac0a('0x1c')],'resourceId':_0x50bc99['id'],'type':_0x12df5d[_0xac0a('0x1c')],'sectionId':_0x12df5d['id']},{})['then'](function(){return _0x29ff96;});}else{return _0x29ff96;}})[_0xac0a('0x26')](function(_0x7a052b){logger[_0xac0a('0x1a')](_0xac0a('0x3a'),_0x7a052b);throw _0x7a052b;});}return _0x29ff96;})[_0xac0a('0x17')](respondWithResult(_0x1a0dd3,0xc9))[_0xac0a('0x26')](handleError(_0x1a0dd3,null));};exports[_0xac0a('0x14')]=function(_0xa29231,_0x5d203e){if(_0xa29231[_0xac0a('0x32')]['id']){delete _0xa29231[_0xac0a('0x32')]['id'];}return db['ChatQueue'][_0xac0a('0x38')]({'where':{'id':_0xa29231[_0xac0a('0x27')]['id']}})[_0xac0a('0x17')](handleEntityNotFound(_0x5d203e,null))[_0xac0a('0x17')](saveUpdates(_0xa29231[_0xac0a('0x32')],null))[_0xac0a('0x17')](respondWithResult(_0x5d203e,null))[_0xac0a('0x26')](handleError(_0x5d203e,null));};exports['destroy']=function(_0x4c0c01,_0x2f4f18){return db[_0xac0a('0x1f')][_0xac0a('0x38')]({'where':{'id':_0x4c0c01[_0xac0a('0x27')]['id']}})[_0xac0a('0x17')](handleEntityNotFound(_0x2f4f18,null))[_0xac0a('0x17')](removeEntity(_0x2f4f18,null))[_0xac0a('0x26')](handleError(_0x2f4f18,null));};exports[_0xac0a('0x3b')]=function(_0xa76a58,_0x203f11){return db[_0xac0a('0x1f')]['describe']()[_0xac0a('0x17')](respondWithResult(_0x203f11,null))[_0xac0a('0x26')](handleError(_0x203f11,null));};exports['getMembers']=function(_0x71e95f,_0x83f535){var _0x35a78e={'raw':!![],'where':{}},_0x19a63a={},_0x16a526;return db['ChatQueue']['findOne']({'where':{'id':_0x71e95f[_0xac0a('0x27')]['id']}})['then'](handleEntityNotFound(_0x83f535,null))[_0xac0a('0x17')](function(_0x32359f){if(_0x32359f){_0x16a526=_0x32359f[_0xac0a('0x3c')]({'plain':!![]});_0x19a63a['model']=_[_0xac0a('0x28')](db[_0xac0a('0x3d')]['rawAttributes']);_0x19a63a['query']=_['keys'](_0x71e95f['query']);_0x19a63a[_0xac0a('0x2b')]=_[_0xac0a('0x3e')](_0x19a63a[_0xac0a('0x2c')],_0x19a63a[_0xac0a('0x2a')]);_0x35a78e[_0xac0a('0x2d')]=_[_0xac0a('0x3e')](_0x19a63a[_0xac0a('0x2c')],qs['fields'](_0x71e95f['query'][_0xac0a('0x2e')]));_0x35a78e['attributes']=_0x35a78e['attributes'][_0xac0a('0x2f')]?_0x35a78e[_0xac0a('0x2d')]:_0x19a63a[_0xac0a('0x2c')];if(!_0x71e95f['query'][_0xac0a('0x3f')]('nolimit')){_0x35a78e['limit']=qs[_0xac0a('0x11')](_0x71e95f[_0xac0a('0x2a')][_0xac0a('0x11')]);_0x35a78e[_0xac0a('0xf')]=qs[_0xac0a('0xf')](_0x71e95f[_0xac0a('0x2a')][_0xac0a('0xf')]);}_0x35a78e['order']=qs[_0xac0a('0x40')](_0x71e95f[_0xac0a('0x2a')][_0xac0a('0x40')]);_0x35a78e[_0xac0a('0x23')]=qs[_0xac0a('0x2b')](_['pick'](_0x71e95f['query'],_0x19a63a[_0xac0a('0x2b')]));_0x35a78e['where'][_0xac0a('0x41')]=_0x32359f['id'];if(_0x71e95f['query'][_0xac0a('0x42')]){_0x35a78e[_0xac0a('0x23')]=_[_0xac0a('0x30')](_0x35a78e[_0xac0a('0x23')],{'$or':_[_0xac0a('0x1e')](_0x35a78e[_0xac0a('0x2d')],function(_0x234e9d){var _0x381f9b={};_0x381f9b[_0x234e9d]={'$like':'%'+_0x71e95f['query']['filter']+'%'};return _0x381f9b;})});}_0x35a78e=_[_0xac0a('0x30')]({},_0x35a78e,_0x71e95f[_0xac0a('0x43')]);return db[_0xac0a('0x3d')][_0xac0a('0x25')](_0x35a78e);}})['then'](function(_0x7efed0){if(_0x7efed0){return db[_0xac0a('0x44')][_0xac0a('0x45')]({'where':{'id':_['map'](_0x7efed0,'UserId'),'role':_0xac0a('0x46')},'attributes':['id',_0xac0a('0x1c'),_0xac0a('0x47'),_0xac0a('0x48'),_0xac0a('0x49')]});}})['then'](function(_0xb560e4){if(_0xb560e4){return{'count':_0xb560e4[_0xac0a('0x12')],'rows':_[_0xac0a('0x1e')](_0xb560e4['rows'],function(_0x1c2b55){return{'membername':_0x1c2b55[_0xac0a('0x1c')],'UserId':_0x1c2b55['id'],'queue_name':_0x16a526['name'],'ChatQueueId':_0x16a526['id'],'interface':util['format'](_0xac0a('0x4a'),_0xac0a('0x4b'),_0x1c2b55['name']),'penalty':0x0,'paused':_0x1c2b55[_0xac0a('0x47')],'createdAt':_0x1c2b55[_0xac0a('0x49')],'updatedAt':_0x1c2b55[_0xac0a('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xac0a('0x17')](respondWithFilteredResult(_0x83f535,_0x35a78e))[_0xac0a('0x26')](handleError(_0x83f535,null));};exports[_0xac0a('0x4c')]=function(_0x38ea6b,_0x5df02d){var _0x3446db={};var _0x1f265b={};var _0x2acb81;var _0xdec0cc;return db[_0xac0a('0x1f')]['findOne']({'where':{'id':_0x38ea6b[_0xac0a('0x27')]['id']}})[_0xac0a('0x17')](handleEntityNotFound(_0x5df02d,null))[_0xac0a('0x17')](function(_0xddcd38){if(_0xddcd38){_0x2acb81=_0xddcd38;_0x1f265b[_0xac0a('0x2c')]=_[_0xac0a('0x28')](db[_0xac0a('0x4d')][_0xac0a('0x29')]);_0x1f265b['query']=_['keys'](_0x38ea6b[_0xac0a('0x2a')]);_0x1f265b[_0xac0a('0x2b')]=_[_0xac0a('0x3e')](_0x1f265b[_0xac0a('0x2c')],_0x1f265b[_0xac0a('0x2a')]);_0x3446db[_0xac0a('0x2d')]=_['intersection'](_0x1f265b[_0xac0a('0x2c')],qs[_0xac0a('0x2e')](_0x38ea6b[_0xac0a('0x2a')][_0xac0a('0x2e')]));_0x3446db[_0xac0a('0x2d')]=_0x3446db[_0xac0a('0x2d')][_0xac0a('0x2f')]?_0x3446db[_0xac0a('0x2d')]:_0x1f265b[_0xac0a('0x2c')];_0x3446db[_0xac0a('0x4e')]=qs[_0xac0a('0x40')](_0x38ea6b[_0xac0a('0x2a')][_0xac0a('0x40')]);_0x3446db[_0xac0a('0x23')]=qs[_0xac0a('0x2b')](_[_0xac0a('0x4f')](_0x38ea6b[_0xac0a('0x2a')],_0x1f265b[_0xac0a('0x2b')]));if(_0x38ea6b[_0xac0a('0x2a')]['filter']){_0x3446db['where']=_[_0xac0a('0x30')](_0x3446db[_0xac0a('0x23')],{'$or':_[_0xac0a('0x1e')](_0x3446db[_0xac0a('0x2d')],function(_0x4bba8f){var _0x330fae={};_0x330fae[_0x4bba8f]={'$like':'%'+_0x38ea6b[_0xac0a('0x2a')][_0xac0a('0x42')]+'%'};return _0x330fae;})});}_0x3446db=_[_0xac0a('0x30')]({},_0x3446db,_0x38ea6b[_0xac0a('0x43')]);return _0x2acb81[_0xac0a('0x4c')](_0x3446db);}})[_0xac0a('0x17')](function(_0x118b98){if(_0x118b98){_0xdec0cc=_0x118b98['length'];if(!_0x38ea6b[_0xac0a('0x2a')][_0xac0a('0x3f')](_0xac0a('0x50'))){_0x3446db['limit']=qs[_0xac0a('0x11')](_0x38ea6b['query'][_0xac0a('0x11')]);_0x3446db[_0xac0a('0xf')]=qs[_0xac0a('0xf')](_0x38ea6b[_0xac0a('0x2a')][_0xac0a('0xf')]);}return _0x2acb81[_0xac0a('0x4c')](_0x3446db);}})[_0xac0a('0x17')](function(_0x1cf8b1){if(_0x1cf8b1){return _0x1cf8b1?{'count':_0xdec0cc,'rows':_0x1cf8b1}:null;}})[_0xac0a('0x17')](respondWithResult(_0x5df02d,null))[_0xac0a('0x26')](handleError(_0x5df02d,null));};exports[_0xac0a('0x51')]=function(_0x3d0abc,_0x146935){var _0x9c1151=_0x3d0abc[_0xac0a('0x32')][_0xac0a('0x52')];return db['Team'][_0xac0a('0x25')]({'where':{'id':_0x9c1151},'attributes':['id'],'include':[{'model':db[_0xac0a('0x44')],'as':'Agents','attributes':['id',_0xac0a('0x1c'),_0xac0a('0x53'),_0xac0a('0x54'),_0xac0a('0x55')],'raw':!![]}]})[_0xac0a('0x17')](function(_0x2a2bbe){if(_0x2a2bbe){var _0x55d458=_[_0xac0a('0x56')](_0x2a2bbe,function(_0x53273d){var _0x2b4fac=_0x53273d[_0xac0a('0x3c')]({'plain':!![]});return _0x2b4fac[_0xac0a('0x57')];});return db[_0xac0a('0x1f')][_0xac0a('0x38')]({'where':{'id':_0x3d0abc[_0xac0a('0x27')]['id']}})[_0xac0a('0x17')](function(_0x29055e){return db['sequelize'][_0xac0a('0x58')](function(_0x199caf){return _0x29055e[_0xac0a('0x51')](_0x9c1151,{'transaction':_0x199caf})[_0xac0a('0x17')](function(){return BPromise[_0xac0a('0x59')](_0x55d458,function(_0x475a44){return db[_0xac0a('0x3d')]['findOrCreate']({'where':{'UserId':_0x475a44['id'],'ChatQueueId':_0x3d0abc[_0xac0a('0x27')]['id']},'transaction':_0x199caf});});})[_0xac0a('0x17')](function(){_0x55d458['forEach'](function(_0x48f79f){socket[_0xac0a('0x5a')](_0xac0a('0x5b'),{'UserId':_0x48f79f['id'],'ChatQueueId':_0x29055e['id']});});});});});}})[_0xac0a('0x17')](respondWithStatusCode(_0x146935,null))[_0xac0a('0x26')](handleError(_0x146935,null));};exports[_0xac0a('0x5c')]=function(_0x257ed2,_0x2c4478){return db['Team']['findAll']({'where':{'id':_0x257ed2['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xac0a('0x44')],'as':_0xac0a('0x57'),'attributes':['id'],'raw':!![]}]})[_0xac0a('0x17')](handleEntityNotFound(_0x2c4478,null))[_0xac0a('0x17')](function(_0x24e538){var _0x5d0dec=_[_0xac0a('0x1e')](_0x24e538,'id');var _0x4160a5=[];var _0x4cc431=[];var _0x582b73=squel['select']();_0x582b73[_0xac0a('0x5d')](_0xac0a('0x5e'))['from'](_0xac0a('0x5f'),'tq')[_0xac0a('0x60')](_0xac0a('0x61'),'ut',_0xac0a('0x62'))[_0xac0a('0x23')]('ChatQueueId\x20=\x20?',_0x257ed2[_0xac0a('0x27')]['id']);for(var _0x23875f=0x0;_0x23875f<_0x24e538[_0xac0a('0x2f')];_0x23875f+=0x1){let _0x5a7cbe=_0x24e538[_0x23875f];for(var _0xb7e715=0x0;_0xb7e715<_0x5a7cbe[_0xac0a('0x57')][_0xac0a('0x2f')];_0xb7e715+=0x1){let _0x195c4e=_0x5a7cbe[_0xac0a('0x57')][_0xb7e715];var _0xf5982=_0x582b73[_0xac0a('0x63')]();_0xf5982['where'](_0xac0a('0x64'),_0x195c4e['id']);_0x4cc431[_0xac0a('0x65')](db[_0xac0a('0x66')][_0xac0a('0x2a')](_0xf5982[_0xac0a('0x67')](),{'type':db[_0xac0a('0x66')]['QueryTypes'][_0xac0a('0x68')]})['then'](function(_0x18080d){if(_0x18080d[_0xac0a('0x2f')]===0x1){return _0x195c4e['id'];}else{var _0x571681=_['every'](_[_0xac0a('0x1e')](_0x18080d,_0xac0a('0x69')),function(_0x159823){return _[_0xac0a('0x6a')](_0x5d0dec,_0x159823);});if(_0x571681){return _0x195c4e['id'];}}}));}}return BPromise['all'](_0x4cc431)[_0xac0a('0x17')](function(_0xfaf3e0){_0x4160a5=_(_0x4160a5)['union'](_0xfaf3e0)[_0xac0a('0x6b')]()[_0xac0a('0x6c')]();return db[_0xac0a('0x1f')][_0xac0a('0x38')]({'where':{'id':_0x257ed2[_0xac0a('0x27')]['id']}})[_0xac0a('0x17')](function(_0x4f21d5){return db[_0xac0a('0x66')][_0xac0a('0x58')](function(_0x521acd){return _0x4f21d5[_0xac0a('0x5c')](_0x257ed2['query'][_0xac0a('0x52')],{'transaction':_0x521acd})[_0xac0a('0x17')](function(){if(!_['isEmpty'](_0x4160a5)){return _0x4f21d5[_0xac0a('0x6d')](_0x4160a5,{'transaction':_0x521acd});}})[_0xac0a('0x17')](function(){_0x4160a5[_0xac0a('0x6e')](function(_0x37e312){socket[_0xac0a('0x5a')](_0xac0a('0x6f'),{'UserId':_0x37e312,'ChatQueueId':_0x4f21d5['id']});});});});});});})[_0xac0a('0x17')](respondWithStatusCode(_0x2c4478,null))[_0xac0a('0x26')](handleError(_0x2c4478,null));};exports[_0xac0a('0x70')]=function(_0x1a1b06,_0x24796d){return db['ChatQueue']['find']({'where':{'id':_0x1a1b06[_0xac0a('0x27')]['id']}})[_0xac0a('0x17')](handleEntityNotFound(_0x24796d,null))['then'](function(_0x242ae0){if(_0x242ae0){return _0x242ae0[_0xac0a('0x70')](_0x1a1b06[_0xac0a('0x32')][_0xac0a('0x52')],_[_0xac0a('0x71')](_0x1a1b06[_0xac0a('0x32')],[_0xac0a('0x52'),'id'])||{})[_0xac0a('0x72')](function(_0x341b4f){for(var _0x3227c6=0x0;_0x3227c6<_0x1a1b06[_0xac0a('0x32')]['ids'][_0xac0a('0x2f')];_0x3227c6+=0x1){socket[_0xac0a('0x5a')](_0xac0a('0x5b'),{'UserId':Number(_0x1a1b06['body'][_0xac0a('0x52')][_0x3227c6]),'ChatQueueId':Number(_0x1a1b06[_0xac0a('0x27')]['id'])});}return _0x341b4f;});}})['then'](respondWithResult(_0x24796d,null))[_0xac0a('0x26')](handleError(_0x24796d,null));};exports['removeAgents']=function(_0x1a961e,_0xb00df5){return db[_0xac0a('0x1f')][_0xac0a('0x38')]({'where':{'id':_0x1a961e['params']['id']}})['then'](handleEntityNotFound(_0xb00df5,null))[_0xac0a('0x17')](function(_0x1bfd2a){if(_0x1bfd2a){return _0x1bfd2a[_0xac0a('0x6d')](_0x1a961e[_0xac0a('0x2a')][_0xac0a('0x52')])[_0xac0a('0x17')](function(){if(_[_0xac0a('0x73')](_0x1a961e[_0xac0a('0x2a')][_0xac0a('0x52')])){for(var _0x24cd1d=0x0;_0x24cd1d<_0x1a961e[_0xac0a('0x2a')][_0xac0a('0x52')][_0xac0a('0x2f')];_0x24cd1d+=0x1){socket[_0xac0a('0x5a')](_0xac0a('0x6f'),{'UserId':Number(_0x1a961e[_0xac0a('0x2a')][_0xac0a('0x52')][_0x24cd1d]),'ChatQueueId':Number(_0x1a961e[_0xac0a('0x27')]['id'])});}}else{socket['emit'](_0xac0a('0x6f'),{'UserId':Number(_0x1a961e[_0xac0a('0x2a')][_0xac0a('0x52')]),'ChatQueueId':Number(_0x1a961e['params']['id'])});}});}})[_0xac0a('0x17')](respondWithStatusCode(_0xb00df5,null))[_0xac0a('0x26')](handleError(_0xb00df5,null));};exports['getAgents']=function(_0x645684,_0x542bbc){var _0x2ca172={};var _0x392bfc={};var _0x31ef9f;var _0x4fb7ae;return db[_0xac0a('0x1f')][_0xac0a('0x74')]({'where':{'id':_0x645684[_0xac0a('0x27')]['id']}})[_0xac0a('0x17')](handleEntityNotFound(_0x542bbc,null))['then'](function(_0x1548f0){if(_0x1548f0){_0x31ef9f=_0x1548f0;_0x392bfc[_0xac0a('0x2c')]=_[_0xac0a('0x28')](db[_0xac0a('0x44')][_0xac0a('0x29')]);_0x392bfc[_0xac0a('0x2a')]=_[_0xac0a('0x28')](_0x645684[_0xac0a('0x2a')]);_0x392bfc[_0xac0a('0x2b')]=_[_0xac0a('0x3e')](_0x392bfc[_0xac0a('0x2c')],_0x392bfc['query']);_0x2ca172[_0xac0a('0x2d')]=_['intersection'](_0x392bfc[_0xac0a('0x2c')],qs[_0xac0a('0x2e')](_0x645684[_0xac0a('0x2a')][_0xac0a('0x2e')]));_0x2ca172['attributes']=_0x2ca172['attributes']['length']?_0x2ca172[_0xac0a('0x2d')]:_0x392bfc[_0xac0a('0x2c')];_0x2ca172[_0xac0a('0x4e')]=qs['sort'](_0x645684[_0xac0a('0x2a')][_0xac0a('0x40')]);_0x2ca172[_0xac0a('0x23')]=qs[_0xac0a('0x2b')](_[_0xac0a('0x4f')](_0x645684[_0xac0a('0x2a')],_0x392bfc[_0xac0a('0x2b')]));if(_0x645684[_0xac0a('0x2a')][_0xac0a('0x42')]){_0x2ca172['where']=_[_0xac0a('0x30')](_0x2ca172[_0xac0a('0x23')],{'$or':_[_0xac0a('0x1e')](_0x2ca172[_0xac0a('0x2d')],function(_0x4ce239){var _0x46c824={};_0x46c824[_0x4ce239]={'$like':'%'+_0x645684[_0xac0a('0x2a')][_0xac0a('0x42')]+'%'};return _0x46c824;})});}_0x2ca172=_[_0xac0a('0x30')]({},_0x2ca172,_0x645684[_0xac0a('0x43')]);return _0x31ef9f['getAgents'](_0x2ca172);}})[_0xac0a('0x17')](function(_0x37df48){if(_0x37df48){_0x4fb7ae=_0x37df48['length'];if(!_0x645684['query'][_0xac0a('0x3f')](_0xac0a('0x50'))){_0x2ca172['limit']=qs[_0xac0a('0x11')](_0x645684[_0xac0a('0x2a')][_0xac0a('0x11')]);_0x2ca172[_0xac0a('0xf')]=qs[_0xac0a('0xf')](_0x645684[_0xac0a('0x2a')][_0xac0a('0xf')]);}return _0x31ef9f['getAgents'](_0x2ca172);}})[_0xac0a('0x17')](function(_0x1fffa5){if(_0x1fffa5){return _0x1fffa5?{'count':_0x4fb7ae,'rows':_0x1fffa5}:null;}})[_0xac0a('0x17')](respondWithResult(_0x542bbc,null))[_0xac0a('0x26')](handleError(_0x542bbc,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5812f2c..2303179 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 _0xd2d6=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','save','update'];(function(_0x125214,_0xa7fbf2){var _0x7ef230=function(_0x8bf45a){while(--_0x8bf45a){_0x125214['push'](_0x125214['shift']());}};_0x7ef230(++_0xa7fbf2);}(_0xd2d6,0xa3));var _0x6d2d=function(_0x4939bc,_0x4dd446){_0x4939bc=_0x4939bc-0x0;var _0x164412=_0xd2d6[_0x4939bc];return _0x164412;};'use strict';var EventEmitter=require(_0x6d2d('0x0'));var ChatQueue=require(_0x6d2d('0x1'))['db'][_0x6d2d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6d2d('0x3'),'afterUpdate':_0x6d2d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1fa2e3){return function(_0x2fd17c,_0x33f5aa,_0x351f8b){ChatQueueEvents[_0x6d2d('0x5')](_0x1fa2e3+':'+_0x2fd17c['id'],_0x2fd17c);ChatQueueEvents[_0x6d2d('0x5')](_0x1fa2e3,_0x2fd17c);_0x351f8b(null);};}for(var e in events){if(events[_0x6d2d('0x6')](e)){var event=events[e];ChatQueue[_0x6d2d('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x9c44=['events','../../mysqldb','update','emit','hook','exports'];(function(_0x540e54,_0x20f35e){var _0x1a4ed3=function(_0x36e100){while(--_0x36e100){_0x540e54['push'](_0x540e54['shift']());}};_0x1a4ed3(++_0x20f35e);}(_0x9c44,0x84));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require(_0x49c4('0x0'));var ChatQueue=require(_0x49c4('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x49c4('0x2'),'afterDestroy':'remove'};function emitEvent(_0x45ae73){return function(_0x5e8b43,_0x15b775,_0x21f94c){ChatQueueEvents[_0x49c4('0x3')](_0x45ae73+':'+_0x5e8b43['id'],_0x5e8b43);ChatQueueEvents[_0x49c4('0x3')](_0x45ae73,_0x5e8b43);_0x21f94c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x49c4('0x4')](e,emitEvent(event));}}module[_0x49c4('0x5')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index b00ff7e..4f36585 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 _0x4d3e=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x3b1f1c,_0x577b23){var _0x3f0a47=function(_0x129b83){while(--_0x129b83){_0x3b1f1c['push'](_0x3b1f1c['shift']());}};_0x3f0a47(++_0x577b23);}(_0x4d3e,0x129));var _0xe4d3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4d3e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe4d3('0x0'));var util=require(_0xe4d3('0x1'));var logger=require(_0xe4d3('0x2'))(_0xe4d3('0x3'));var moment=require(_0xe4d3('0x4'));var BPromise=require(_0xe4d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d3('0x6'));var rimraf=require(_0xe4d3('0x7'));var config=require(_0xe4d3('0x8'));var attributes=require(_0xe4d3('0x9'));module[_0xe4d3('0xa')]=function(_0x2fec27,_0x47c1ec){return _0x2fec27[_0xe4d3('0xb')](_0xe4d3('0xc'),attributes,{'tableName':_0xe4d3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c4a=['request-promise','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x475f1f,_0x16af02){var _0x2b4d83=function(_0x1b6510){while(--_0x1b6510){_0x475f1f['push'](_0x475f1f['shift']());}};_0x2b4d83(++_0x16af02);}(_0x0c4a,0x74));var _0xa0c4=function(_0x135b19,_0x296771){_0x135b19=_0x135b19-0x0;var _0x31c7ac=_0x0c4a[_0x135b19];return _0x31c7ac;};'use strict';var _=require(_0xa0c4('0x0'));var util=require(_0xa0c4('0x1'));var logger=require(_0xa0c4('0x2'))(_0xa0c4('0x3'));var moment=require(_0xa0c4('0x4'));var BPromise=require('bluebird');var rp=require(_0xa0c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa0c4('0x6'));module[_0xa0c4('0x7')]=function(_0x1acc28,_0x554924){return _0x1acc28[_0xa0c4('0x8')](_0xa0c4('0x9'),attributes,{'tableName':_0xa0c4('0xa'),'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 1c0717a..ef061ea 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 _0xc16a=['client','http','defaults','redis','localhost','./chatQueue.socket','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowChatQueue','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xc16a,0x160));var _0xac16=function(_0x3611da,_0x253e90){_0x3611da=_0x3611da-0x0;var _0x275c6c=_0xc16a[_0x3611da];return _0x275c6c;};'use strict';var _=require(_0xac16('0x0'));var util=require(_0xac16('0x1'));var moment=require(_0xac16('0x2'));var BPromise=require(_0xac16('0x3'));var rs=require(_0xac16('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac16('0x5'))['db'];var utils=require(_0xac16('0x6'));var logger=require(_0xac16('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xac16('0x8')][_0xac16('0x9')]({'port':0x232a});config['redis']=_[_0xac16('0xa')](config[_0xac16('0xb')],{'host':_0xac16('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac16('0xb')]));require(_0xac16('0xd'))['register'](socket);function respondWithRpcPromise(_0x19155b,_0x93ed67,_0x5e3993){return new BPromise(function(_0x66310c,_0x2f23ed){return client['request'](_0x19155b,_0x5e3993)['then'](function(_0x17b372){logger[_0xac16('0xe')](_0xac16('0xf'),_0x93ed67,_0xac16('0x10'));logger['debug'](_0xac16('0x11'),_0x93ed67,_0xac16('0x10'),JSON[_0xac16('0x12')](_0x17b372));if(_0x17b372[_0xac16('0x13')]){if(_0x17b372[_0xac16('0x13')]['code']===0x1f4){logger[_0xac16('0x13')](_0xac16('0xf'),_0x93ed67,_0x17b372[_0xac16('0x13')]['message']);return _0x2f23ed(_0x17b372[_0xac16('0x13')][_0xac16('0x14')]);}logger[_0xac16('0x13')](_0xac16('0xf'),_0x93ed67,_0x17b372[_0xac16('0x13')]['message']);return _0x66310c(_0x17b372[_0xac16('0x13')][_0xac16('0x14')]);}else{logger[_0xac16('0xe')](_0xac16('0xf'),_0x93ed67,_0xac16('0x10'));_0x66310c(_0x17b372[_0xac16('0x15')]['message']);}})[_0xac16('0x16')](function(_0x91adca){logger[_0xac16('0x13')](_0xac16('0xf'),_0x93ed67,_0x91adca);_0x2f23ed(_0x91adca);});});}exports[_0xac16('0x17')]=function(_0x3b4249){var _0x16096a=this;return new Promise(function(_0x2cfc0b,_0x1070ba){return db['ChatQueue'][_0xac16('0x18')]({'raw':_0x3b4249[_0xac16('0x19')]?_0x3b4249[_0xac16('0x19')][_0xac16('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b4249[_0xac16('0x19')]?_0x3b4249[_0xac16('0x19')][_0xac16('0x1b')]||null:null,'attributes':_0x3b4249[_0xac16('0x19')]?_0x3b4249['options'][_0xac16('0x1c')]||null:null,'limit':_0x3b4249[_0xac16('0x19')]?_0x3b4249[_0xac16('0x19')][_0xac16('0x1d')]||null:null,'include':_0x3b4249[_0xac16('0x19')]?_0x3b4249['options'][_0xac16('0x1e')]?_['map'](_0x3b4249[_0xac16('0x19')]['include'],function(_0x173572){return{'model':db[_0x173572[_0xac16('0x1f')]],'as':_0x173572['as'],'attributes':_0x173572[_0xac16('0x1c')],'include':_0x173572[_0xac16('0x1e')]?_['map'](_0x173572[_0xac16('0x1e')],function(_0x16d0fe){return{'model':db[_0x16d0fe['model']],'as':_0x16d0fe['as'],'attributes':_0x16d0fe[_0xac16('0x1c')],'include':_0x16d0fe['include']?_[_0xac16('0x20')](_0x16d0fe[_0xac16('0x1e')],function(_0x12d0f2){return{'model':db[_0x12d0f2[_0xac16('0x1f')]],'as':_0x12d0f2['as'],'attributes':_0x12d0f2[_0xac16('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b6c19){logger[_0xac16('0xe')](_0xac16('0x17'),_0x3b4249);logger[_0xac16('0x21')](_0xac16('0x17'),_0x3b4249,JSON[_0xac16('0x12')](_0x3b6c19));_0x2cfc0b(_0x3b6c19);})[_0xac16('0x16')](function(_0x16723d){logger['error']('GetChatQueue',_0x16723d[_0xac16('0x14')],_0x3b4249);_0x1070ba(_0x16096a['error'](0x1f4,_0x16723d['message']));});});};exports[_0xac16('0x22')]=function(_0xeb2f20){var _0x294dba=this;return new Promise(function(_0xb2eba9,_0x382aaf){return db['ChatQueue']['find']({'raw':_0xeb2f20[_0xac16('0x19')]?_0xeb2f20[_0xac16('0x19')][_0xac16('0x1a')]===undefined?!![]:![]:!![],'where':_0xeb2f20[_0xac16('0x19')]?_0xeb2f20['options'][_0xac16('0x1b')]||null:null,'attributes':_0xeb2f20['options']?_0xeb2f20['options'][_0xac16('0x1c')]||null:null,'include':_0xeb2f20[_0xac16('0x19')]?_0xeb2f20[_0xac16('0x19')][_0xac16('0x1e')]?_[_0xac16('0x20')](_0xeb2f20[_0xac16('0x19')][_0xac16('0x1e')],function(_0x2908c3){return{'model':db[_0x2908c3['model']],'as':_0x2908c3['as'],'attributes':_0x2908c3[_0xac16('0x1c')],'include':_0x2908c3['include']?_['map'](_0x2908c3['include'],function(_0xe2fc74){return{'model':db[_0xe2fc74[_0xac16('0x1f')]],'as':_0xe2fc74['as'],'attributes':_0xe2fc74[_0xac16('0x1c')],'include':_0xe2fc74['include']?_[_0xac16('0x20')](_0xe2fc74['include'],function(_0x5c4a85){return{'model':db[_0x5c4a85[_0xac16('0x1f')]],'as':_0x5c4a85['as'],'attributes':_0x5c4a85[_0xac16('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xac16('0x23')](function(_0x3eef35){logger['info'](_0xac16('0x22'),_0xeb2f20);logger[_0xac16('0x21')](_0xac16('0x22'),_0xeb2f20,JSON[_0xac16('0x12')](_0x3eef35));_0xb2eba9(_0x3eef35);})['catch'](function(_0xf3f17b){logger[_0xac16('0x13')]('ShowChatQueue',_0xf3f17b[_0xac16('0x14')],_0xeb2f20);_0x382aaf(_0x294dba[_0xac16('0x13')](0x1f4,_0xf3f17b[_0xac16('0x14')]));});});}; \ No newline at end of file +var _0xda20=['then','GetChatQueue','stringify','ShowChatQueue','find','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','ChatQueue','raw','options','where','attributes','limit','include','map','model'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xda20,0x1d9));var _0x0da2=function(_0x6febcb,_0x105519){_0x6febcb=_0x6febcb-0x0;var _0x3dd2fa=_0xda20[_0x6febcb];return _0x3dd2fa;};'use strict';var _=require(_0x0da2('0x0'));var util=require('util');var moment=require(_0x0da2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0da2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0da2('0x3'));var logger=require(_0x0da2('0x4'))('rpc');var config=require(_0x0da2('0x5'));var jayson=require(_0x0da2('0x6'));var client=jayson['client'][_0x0da2('0x7')]({'port':0x232a});config[_0x0da2('0x8')]=_[_0x0da2('0x9')](config[_0x0da2('0x8')],{'host':_0x0da2('0xa'),'port':0x18eb});var socket=require(_0x0da2('0xb'))(new Redis(config[_0x0da2('0x8')]));require(_0x0da2('0xc'))[_0x0da2('0xd')](socket);function respondWithRpcPromise(_0x4e491f,_0x127bed,_0xe9b4a8){return new BPromise(function(_0x18ff2b,_0x13fe84){return client['request'](_0x4e491f,_0xe9b4a8)['then'](function(_0x286402){logger[_0x0da2('0xe')](_0x0da2('0xf'),_0x127bed,_0x0da2('0x10'));logger[_0x0da2('0x11')](_0x0da2('0x12'),_0x127bed,_0x0da2('0x10'),JSON['stringify'](_0x286402));if(_0x286402[_0x0da2('0x13')]){if(_0x286402['error']['code']===0x1f4){logger['error'](_0x0da2('0xf'),_0x127bed,_0x286402['error'][_0x0da2('0x14')]);return _0x13fe84(_0x286402[_0x0da2('0x13')]['message']);}logger[_0x0da2('0x13')](_0x0da2('0xf'),_0x127bed,_0x286402['error'][_0x0da2('0x14')]);return _0x18ff2b(_0x286402[_0x0da2('0x13')][_0x0da2('0x14')]);}else{logger['info'](_0x0da2('0xf'),_0x127bed,_0x0da2('0x10'));_0x18ff2b(_0x286402['result']['message']);}})[_0x0da2('0x15')](function(_0x500bf4){logger[_0x0da2('0x13')]('ChatQueue,\x20%s,\x20%s',_0x127bed,_0x500bf4);_0x13fe84(_0x500bf4);});});}exports['GetChatQueue']=function(_0x495311){var _0x5cf40a=this;return new Promise(function(_0x109645,_0x1d685c){return db[_0x0da2('0x16')]['findAll']({'raw':_0x495311['options']?_0x495311['options'][_0x0da2('0x17')]===undefined?!![]:![]:!![],'where':_0x495311[_0x0da2('0x18')]?_0x495311[_0x0da2('0x18')][_0x0da2('0x19')]||null:null,'attributes':_0x495311[_0x0da2('0x18')]?_0x495311['options'][_0x0da2('0x1a')]||null:null,'limit':_0x495311[_0x0da2('0x18')]?_0x495311[_0x0da2('0x18')][_0x0da2('0x1b')]||null:null,'include':_0x495311[_0x0da2('0x18')]?_0x495311[_0x0da2('0x18')][_0x0da2('0x1c')]?_[_0x0da2('0x1d')](_0x495311[_0x0da2('0x18')]['include'],function(_0x43966a){return{'model':db[_0x43966a['model']],'as':_0x43966a['as'],'attributes':_0x43966a[_0x0da2('0x1a')],'include':_0x43966a[_0x0da2('0x1c')]?_[_0x0da2('0x1d')](_0x43966a[_0x0da2('0x1c')],function(_0x4b9333){return{'model':db[_0x4b9333[_0x0da2('0x1e')]],'as':_0x4b9333['as'],'attributes':_0x4b9333[_0x0da2('0x1a')],'include':_0x4b9333[_0x0da2('0x1c')]?_[_0x0da2('0x1d')](_0x4b9333[_0x0da2('0x1c')],function(_0x5083e0){return{'model':db[_0x5083e0[_0x0da2('0x1e')]],'as':_0x5083e0['as'],'attributes':_0x5083e0['attributes']};}):[]};}):[]};}):[]:[]})[_0x0da2('0x1f')](function(_0xb1ba88){logger[_0x0da2('0xe')](_0x0da2('0x20'),_0x495311);logger[_0x0da2('0x11')](_0x0da2('0x20'),_0x495311,JSON[_0x0da2('0x21')](_0xb1ba88));_0x109645(_0xb1ba88);})[_0x0da2('0x15')](function(_0x1f2b6f){logger[_0x0da2('0x13')](_0x0da2('0x20'),_0x1f2b6f['message'],_0x495311);_0x1d685c(_0x5cf40a['error'](0x1f4,_0x1f2b6f['message']));});});};exports[_0x0da2('0x22')]=function(_0x45d53d){var _0x54eda5=this;return new Promise(function(_0x52f248,_0x1c4ea4){return db[_0x0da2('0x16')][_0x0da2('0x23')]({'raw':_0x45d53d[_0x0da2('0x18')]?_0x45d53d['options'][_0x0da2('0x17')]===undefined?!![]:![]:!![],'where':_0x45d53d['options']?_0x45d53d[_0x0da2('0x18')][_0x0da2('0x19')]||null:null,'attributes':_0x45d53d[_0x0da2('0x18')]?_0x45d53d[_0x0da2('0x18')][_0x0da2('0x1a')]||null:null,'include':_0x45d53d[_0x0da2('0x18')]?_0x45d53d[_0x0da2('0x18')]['include']?_[_0x0da2('0x1d')](_0x45d53d[_0x0da2('0x18')][_0x0da2('0x1c')],function(_0xbef5da){return{'model':db[_0xbef5da[_0x0da2('0x1e')]],'as':_0xbef5da['as'],'attributes':_0xbef5da[_0x0da2('0x1a')],'include':_0xbef5da['include']?_[_0x0da2('0x1d')](_0xbef5da[_0x0da2('0x1c')],function(_0x314ea2){return{'model':db[_0x314ea2[_0x0da2('0x1e')]],'as':_0x314ea2['as'],'attributes':_0x314ea2['attributes'],'include':_0x314ea2['include']?_[_0x0da2('0x1d')](_0x314ea2[_0x0da2('0x1c')],function(_0x300010){return{'model':db[_0x300010[_0x0da2('0x1e')]],'as':_0x300010['as'],'attributes':_0x300010[_0x0da2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0da2('0x1f')](function(_0xe4bf41){logger[_0x0da2('0xe')](_0x0da2('0x22'),_0x45d53d);logger['debug'](_0x0da2('0x22'),_0x45d53d,JSON[_0x0da2('0x21')](_0xe4bf41));_0x52f248(_0xe4bf41);})[_0x0da2('0x15')](function(_0x41a55e){logger[_0x0da2('0x13')](_0x0da2('0x22'),_0x41a55e[_0x0da2('0x14')],_0x45d53d);_0x1c4ea4(_0x54eda5[_0x0da2('0x13')](0x1f4,_0x41a55e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9297506..44b77d9 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 _0x4d9e=['removeListener','register','length','chatQueue:','./chatQueue.events','update','emit'];(function(_0x5de102,_0x167b89){var _0x1e5afc=function(_0x43778c){while(--_0x43778c){_0x5de102['push'](_0x5de102['shift']());}};_0x1e5afc(++_0x167b89);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x56053f,_0xdf37f9){_0x56053f=_0x56053f-0x0;var _0x37513a=_0x4d9e[_0x56053f];return _0x37513a;};'use strict';var ChatQueueEvents=require(_0xe4d9('0x0'));var events=['save','remove',_0xe4d9('0x1')];function createListener(_0x574c1d,_0x36adac){return function(_0x4d7687){_0x36adac[_0xe4d9('0x2')](_0x574c1d,_0x4d7687);};}function removeListener(_0x2deaef,_0x47a09f){return function(){ChatQueueEvents[_0xe4d9('0x3')](_0x2deaef,_0x47a09f);};}exports[_0xe4d9('0x4')]=function(_0x278035){for(var _0x34c2a2=0x0,_0x125dbc=events[_0xe4d9('0x5')];_0x34c2a2<_0x125dbc;_0x34c2a2++){var _0x54a63a=events[_0x34c2a2];var _0x36316f=createListener(_0xe4d9('0x6')+_0x54a63a,_0x278035);ChatQueueEvents['on'](_0x54a63a,_0x36316f);}}; \ No newline at end of file +var _0x5089=['length','chatQueue:','./chatQueue.events','save','update','emit','register'];(function(_0x2526ed,_0x378c1f){var _0x1c4184=function(_0x15ae9d){while(--_0x15ae9d){_0x2526ed['push'](_0x2526ed['shift']());}};_0x1c4184(++_0x378c1f);}(_0x5089,0x1bb));var _0x9508=function(_0x29a08d,_0x551eca){_0x29a08d=_0x29a08d-0x0;var _0x10fc1a=_0x5089[_0x29a08d];return _0x10fc1a;};'use strict';var ChatQueueEvents=require(_0x9508('0x0'));var events=[_0x9508('0x1'),'remove',_0x9508('0x2')];function createListener(_0x35878a,_0x7dd13d){return function(_0x100d7e){_0x7dd13d[_0x9508('0x3')](_0x35878a,_0x100d7e);};}function removeListener(_0x59d3ee,_0x86540d){return function(){ChatQueueEvents['removeListener'](_0x59d3ee,_0x86540d);};}exports[_0x9508('0x4')]=function(_0x4538dd){for(var _0x257318=0x0,_0x4ab3c6=events[_0x9508('0x5')];_0x257318<_0x4ab3c6;_0x257318++){var _0x42d13a=events[_0x257318];var _0x55a5de=createListener(_0x9508('0x6')+_0x42d13a,_0x4538dd);ChatQueueEvents['on'](_0x42d13a,_0x55a5de);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index d1dcc37..6bdbc9b 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(_0x2ea2c2,_0x396f43){var _0x543e71=function(_0x337eea){while(--_0x337eea){_0x2ea2c2['push'](_0x2ea2c2['shift']());}};_0x543e71(++_0x396f43);}(_0x008c,0x188));var _0xc008=function(_0x19561b,_0x2dccef){_0x19561b=_0x19561b-0x0;var _0x135586=_0x008c[_0x19561b];return _0x135586;};'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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x4bef2c,_0x24b163){var _0x451c0f=function(_0x60ec06){while(--_0x60ec06){_0x4bef2c['push'](_0x4bef2c['shift']());}};_0x451c0f(++_0x24b163);}(_0x55ca,0x126));var _0xa55c=function(_0x1194d1,_0x71821b){_0x1194d1=_0x1194d1-0x0;var _0x24c777=_0x55ca[_0x1194d1];return _0x24c777;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 400fbd5..176d363 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 _0xb2c0=['moment','exports','STRING','DATE'];(function(_0x474dfe,_0x557fbf){var _0x345ba1=function(_0xeb5acc){while(--_0xeb5acc){_0x474dfe['push'](_0x474dfe['shift']());}};_0x345ba1(++_0x557fbf);}(_0xb2c0,0x110));var _0x0b2c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb2c0[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0x0b2c('0x0'));var Sequelize=require('sequelize');module[_0x0b2c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0b2c('0x2')]},'joinAt':{'type':Sequelize[_0x0b2c('0x3')]},'leaveAt':{'type':Sequelize[_0x0b2c('0x3')]},'acceptAt':{'type':Sequelize[_0x0b2c('0x3')]},'exitAt':{'type':Sequelize[_0x0b2c('0x3')]},'reason':{'type':Sequelize[_0x0b2c('0x2')]}}; \ No newline at end of file +var _0x6927=['STRING','DATE','exports'];(function(_0x14748b,_0x439b91){var _0x1c93c2=function(_0x16a00){while(--_0x16a00){_0x14748b['push'](_0x14748b['shift']());}};_0x1c93c2(++_0x439b91);}(_0x6927,0x11c));var _0x7692=function(_0x2fa981,_0xfbf900){_0x2fa981=_0x2fa981-0x0;var _0x331b7b=_0x6927[_0x2fa981];return _0x331b7b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x7692('0x0')]={'uniqueid':{'type':Sequelize[_0x7692('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7692('0x1')]},'joinAt':{'type':Sequelize[_0x7692('0x2')]},'leaveAt':{'type':Sequelize[_0x7692('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7692('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 3114833..049f617 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 _0x2e88=['moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x8ffa46,_0x33be18){var _0x1247eb=function(_0x4ab03a){while(--_0x4ab03a){_0x8ffa46['push'](_0x8ffa46['shift']());}};_0x1247eb(++_0x33be18);}(_0x2e88,0x95));var _0x82e8=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0x2e88[_0xc69f39];return _0x93be41;};'use strict';var emlformat=require(_0x82e8('0x0'));var rimraf=require(_0x82e8('0x1'));var zipdir=require(_0x82e8('0x2'));var jsonpatch=require(_0x82e8('0x3'));var rp=require(_0x82e8('0x4'));var moment=require(_0x82e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x82e8('0x6'));var util=require(_0x82e8('0x7'));var path=require('path');var sox=require(_0x82e8('0x8'));var csv=require(_0x82e8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82e8('0xa'));var _=require(_0x82e8('0xb'));var squel=require(_0x82e8('0xc'));var crypto=require(_0x82e8('0xd'));var jsforce=require(_0x82e8('0xe'));var deskjs=require(_0x82e8('0xf'));var toCsv=require(_0x82e8('0x9'));var querystring=require(_0x82e8('0x10'));var Papa=require(_0x82e8('0x11'));var Redis=require(_0x82e8('0x12'));var authService=require(_0x82e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x82e8('0x14'));var hardwareService=require(_0x82e8('0x15'));var logger=require(_0x82e8('0x16'))(_0x82e8('0x17'));var utils=require(_0x82e8('0x18'));var config=require(_0x82e8('0x19'));var licenseUtil=require(_0x82e8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253a36,_0xdf1b65){_0xdf1b65=_0xdf1b65||0xcc;return function(_0xb6d94a){if(_0xb6d94a){return _0x253a36[_0x82e8('0x1b')](_0xdf1b65);}return _0x253a36[_0x82e8('0x1c')](_0xdf1b65)['end']();};}function respondWithResult(_0x3353e0,_0x2c9569){_0x2c9569=_0x2c9569||0xc8;return function(_0xad6055){if(_0xad6055){return _0x3353e0[_0x82e8('0x1c')](_0x2c9569)['json'](_0xad6055);}};}function respondWithFilteredResult(_0x25b60e,_0x461744){return function(_0x3253d2){if(_0x3253d2){var _0xf53214=typeof _0x461744[_0x82e8('0x1d')]==='undefined'&&typeof _0x461744[_0x82e8('0x1e')]===_0x82e8('0x1f');var _0x574ba2=_0x3253d2[_0x82e8('0x20')];var _0xf287da=_0xf53214?0x0:_0x461744[_0x82e8('0x1d')];var _0x380f44=_0xf53214?_0x3253d2[_0x82e8('0x20')]:_0x461744[_0x82e8('0x1d')]+_0x461744[_0x82e8('0x1e')];var _0x5d7986;if(_0x380f44>=_0x574ba2){_0x380f44=_0x574ba2;_0x5d7986=0xc8;}else{_0x5d7986=0xce;}_0x25b60e[_0x82e8('0x1c')](_0x5d7986);return _0x25b60e[_0x82e8('0x21')](_0x82e8('0x22'),_0xf287da+'-'+_0x380f44+'/'+_0x574ba2)[_0x82e8('0x23')](_0x3253d2);}return null;};}function patchUpdates(_0xbfecf2){return function(_0x5db337){try{jsonpatch[_0x82e8('0x24')](_0x5db337,_0xbfecf2,!![]);}catch(_0x497c48){return BPromise[_0x82e8('0x25')](_0x497c48);}return _0x5db337[_0x82e8('0x26')]();};}function saveUpdates(_0x1475cf,_0x3ab5a2){return function(_0x198c3d){if(_0x198c3d){return _0x198c3d[_0x82e8('0x27')](_0x1475cf)[_0x82e8('0x28')](function(_0x591583){return _0x591583;});}return null;};}function removeEntity(_0x2b82eb,_0x57cc9c){return function(_0x4de0d2){if(_0x4de0d2){return _0x4de0d2['destroy']()[_0x82e8('0x28')](function(){_0x2b82eb['status'](0xcc)[_0x82e8('0x29')]();});}};}function handleEntityNotFound(_0x305710,_0xeff996){return function(_0x488b06){if(!_0x488b06){_0x305710[_0x82e8('0x1b')](0x194);}return _0x488b06;};}function handleError(_0x476602,_0x336015){_0x336015=_0x336015||0x1f4;return function(_0x2400c5){logger[_0x82e8('0x2a')](_0x2400c5['stack']);if(_0x2400c5['name']){delete _0x2400c5[_0x82e8('0x2b')];}_0x476602[_0x82e8('0x1c')](_0x336015)[_0x82e8('0x2c')](_0x2400c5);};}exports[_0x82e8('0x2d')]=function(_0x1c2160,_0x4756ac){var _0x14450e={},_0x1e9eee={},_0x1c2173={'count':0x0,'rows':[]};var _0xf52391=_[_0x82e8('0x2e')](db[_0x82e8('0x2f')][_0x82e8('0x30')],function(_0x4902af){return{'name':_0x4902af[_0x82e8('0x31')],'type':_0x4902af[_0x82e8('0x32')][_0x82e8('0x33')]};});_0x1e9eee[_0x82e8('0x34')]=_[_0x82e8('0x2e')](_0xf52391,_0x82e8('0x2b'));_0x1e9eee[_0x82e8('0x35')]=_[_0x82e8('0x36')](_0x1c2160[_0x82e8('0x35')]);_0x1e9eee[_0x82e8('0x37')]=_[_0x82e8('0x38')](_0x1e9eee['model'],_0x1e9eee[_0x82e8('0x35')]);_0x14450e[_0x82e8('0x39')]=_[_0x82e8('0x38')](_0x1e9eee[_0x82e8('0x34')],qs[_0x82e8('0x3a')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x3a')]));_0x14450e[_0x82e8('0x39')]=_0x14450e['attributes'][_0x82e8('0x3b')]?_0x14450e['attributes']:_0x1e9eee[_0x82e8('0x34')];if(!_0x1c2160[_0x82e8('0x35')]['hasOwnProperty']('nolimit')){_0x14450e[_0x82e8('0x1e')]=qs['limit'](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x1e')]);_0x14450e[_0x82e8('0x1d')]=qs[_0x82e8('0x1d')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x1d')]);}_0x14450e[_0x82e8('0x3c')]=qs[_0x82e8('0x3d')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x3d')]);_0x14450e[_0x82e8('0x3e')]=qs[_0x82e8('0x37')](_['pick'](_0x1c2160[_0x82e8('0x35')],_0x1e9eee[_0x82e8('0x37')]),_0xf52391);if(_0x1c2160[_0x82e8('0x35')]['filter']){_0x14450e[_0x82e8('0x3e')]=_[_0x82e8('0x3f')](_0x14450e[_0x82e8('0x3e')],{'$or':_[_0x82e8('0x2e')](_0xf52391,function(_0x28e1b2){if(_0x28e1b2[_0x82e8('0x32')]!==_0x82e8('0x40')){var _0x1eceef={};_0x1eceef[_0x28e1b2[_0x82e8('0x2b')]]={'$like':'%'+_0x1c2160[_0x82e8('0x35')][_0x82e8('0x41')]+'%'};return _0x1eceef;}})});}_0x14450e=_['merge']({},_0x14450e,_0x1c2160[_0x82e8('0x42')]);var _0x3f379d={'where':_0x14450e[_0x82e8('0x3e')]};return db[_0x82e8('0x2f')][_0x82e8('0x20')](_0x3f379d)[_0x82e8('0x28')](function(_0x26c6ad){_0x1c2173[_0x82e8('0x20')]=_0x26c6ad;if(_0x1c2160[_0x82e8('0x35')][_0x82e8('0x43')]){_0x14450e[_0x82e8('0x44')]=[{'all':!![]}];}return db[_0x82e8('0x2f')][_0x82e8('0x45')](_0x14450e);})[_0x82e8('0x28')](function(_0x3878af){_0x1c2173['rows']=_0x3878af;return _0x1c2173;})[_0x82e8('0x28')](respondWithFilteredResult(_0x4756ac,_0x14450e))['catch'](handleError(_0x4756ac,null));};exports[_0x82e8('0x46')]=function(_0x2da19b,_0x8428e1){var _0xc996f7={'raw':!![],'where':{'id':_0x2da19b[_0x82e8('0x47')]['id']}},_0x3ff396={};_0x3ff396['model']=_[_0x82e8('0x36')](db['ChatQueueReport'][_0x82e8('0x30')]);_0x3ff396[_0x82e8('0x35')]=_[_0x82e8('0x36')](_0x2da19b[_0x82e8('0x35')]);_0x3ff396[_0x82e8('0x37')]=_['intersection'](_0x3ff396['model'],_0x3ff396[_0x82e8('0x35')]);_0xc996f7['attributes']=_[_0x82e8('0x38')](_0x3ff396['model'],qs['fields'](_0x2da19b['query']['fields']));_0xc996f7[_0x82e8('0x39')]=_0xc996f7[_0x82e8('0x39')]['length']?_0xc996f7[_0x82e8('0x39')]:_0x3ff396[_0x82e8('0x34')];if(_0x2da19b['query'][_0x82e8('0x43')]){_0xc996f7['include']=[{'all':!![]}];}_0xc996f7=_[_0x82e8('0x3f')]({},_0xc996f7,_0x2da19b[_0x82e8('0x42')]);return db[_0x82e8('0x2f')][_0x82e8('0x48')](_0xc996f7)[_0x82e8('0x28')](handleEntityNotFound(_0x8428e1,null))[_0x82e8('0x28')](respondWithResult(_0x8428e1,null))['catch'](handleError(_0x8428e1,null));};exports[_0x82e8('0x49')]=function(_0x40fcae,_0x33c605){return db[_0x82e8('0x2f')]['create'](_0x40fcae[_0x82e8('0x4a')],{})['then'](respondWithResult(_0x33c605,0xc9))[_0x82e8('0x4b')](handleError(_0x33c605,null));};exports['update']=function(_0x25c206,_0xd3290c){if(_0x25c206[_0x82e8('0x4a')]['id']){delete _0x25c206['body']['id'];}return db[_0x82e8('0x2f')]['find']({'where':{'id':_0x25c206['params']['id']}})[_0x82e8('0x28')](handleEntityNotFound(_0xd3290c,null))[_0x82e8('0x28')](saveUpdates(_0x25c206[_0x82e8('0x4a')],null))['then'](respondWithResult(_0xd3290c,null))[_0x82e8('0x4b')](handleError(_0xd3290c,null));};exports['destroy']=function(_0x5735a2,_0x51710a){return db['ChatQueueReport'][_0x82e8('0x48')]({'where':{'id':_0x5735a2[_0x82e8('0x47')]['id']}})[_0x82e8('0x28')](handleEntityNotFound(_0x51710a,null))[_0x82e8('0x28')](removeEntity(_0x51710a,null))['catch'](handleError(_0x51710a,null));};exports[_0x82e8('0x4c')]=function(_0x7b1c26,_0x17f348){return db[_0x82e8('0x2f')][_0x82e8('0x4c')]()[_0x82e8('0x28')](respondWithResult(_0x17f348,null))['catch'](handleError(_0x17f348,null));}; \ No newline at end of file +var _0x39e6=['params','keys','find','create','update','body','destroy','describe','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','then','sendStatus','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','catch','show'];(function(_0x2f4345,_0x14c406){var _0x59f2e4=function(_0x4ba093){while(--_0x4ba093){_0x2f4345['push'](_0x2f4345['shift']());}};_0x59f2e4(++_0x14c406);}(_0x39e6,0x9e));var _0x639e=function(_0x3c7f57,_0x570433){_0x3c7f57=_0x3c7f57-0x0;var _0x30ed7b=_0x39e6[_0x3c7f57];return _0x30ed7b;};'use strict';var emlformat=require(_0x639e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x639e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x639e('0x2'));var BPromise=require(_0x639e('0x3'));var Mustache=require('mustache');var util=require(_0x639e('0x4'));var path=require(_0x639e('0x5'));var sox=require(_0x639e('0x6'));var csv=require(_0x639e('0x7'));var ejs=require(_0x639e('0x8'));var fs=require('fs');var fs_extra=require(_0x639e('0x9'));var _=require(_0x639e('0xa'));var squel=require(_0x639e('0xb'));var crypto=require(_0x639e('0xc'));var jsforce=require(_0x639e('0xd'));var deskjs=require(_0x639e('0xe'));var toCsv=require(_0x639e('0x7'));var querystring=require(_0x639e('0xf'));var Papa=require(_0x639e('0x10'));var Redis=require(_0x639e('0x11'));var authService=require(_0x639e('0x12'));var qs=require(_0x639e('0x13'));var as=require(_0x639e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x639e('0x15'));var utils=require(_0x639e('0x16'));var config=require(_0x639e('0x17'));var licenseUtil=require(_0x639e('0x18'));var db=require(_0x639e('0x19'))['db'];function respondWithStatusCode(_0x16117b,_0x30b490){_0x30b490=_0x30b490||0xcc;return function(_0x4f3d38){if(_0x4f3d38){return _0x16117b['sendStatus'](_0x30b490);}return _0x16117b[_0x639e('0x1a')](_0x30b490)[_0x639e('0x1b')]();};}function respondWithResult(_0x89302c,_0x199fb5){_0x199fb5=_0x199fb5||0xc8;return function(_0x37b8e2){if(_0x37b8e2){return _0x89302c[_0x639e('0x1a')](_0x199fb5)['json'](_0x37b8e2);}};}function respondWithFilteredResult(_0x31826a,_0x20bfbb){return function(_0x23f0f9){if(_0x23f0f9){var _0x4077c5=typeof _0x20bfbb['offset']===_0x639e('0x1c')&&typeof _0x20bfbb['limit']===_0x639e('0x1c');var _0x3932a8=_0x23f0f9[_0x639e('0x1d')];var _0x20b76f=_0x4077c5?0x0:_0x20bfbb[_0x639e('0x1e')];var _0x1c023e=_0x4077c5?_0x23f0f9['count']:_0x20bfbb[_0x639e('0x1e')]+_0x20bfbb[_0x639e('0x1f')];var _0x36f71d;if(_0x1c023e>=_0x3932a8){_0x1c023e=_0x3932a8;_0x36f71d=0xc8;}else{_0x36f71d=0xce;}_0x31826a[_0x639e('0x1a')](_0x36f71d);return _0x31826a['set'](_0x639e('0x20'),_0x20b76f+'-'+_0x1c023e+'/'+_0x3932a8)[_0x639e('0x21')](_0x23f0f9);}return null;};}function patchUpdates(_0x44dd33){return function(_0x149472){try{jsonpatch[_0x639e('0x22')](_0x149472,_0x44dd33,!![]);}catch(_0x50de77){return BPromise[_0x639e('0x23')](_0x50de77);}return _0x149472[_0x639e('0x24')]();};}function saveUpdates(_0x4f4421,_0x25ead8){return function(_0x48dce7){if(_0x48dce7){return _0x48dce7['update'](_0x4f4421)[_0x639e('0x25')](function(_0x3813f6){return _0x3813f6;});}return null;};}function removeEntity(_0x3ab673,_0x24e1ad){return function(_0x211fcb){if(_0x211fcb){return _0x211fcb['destroy']()[_0x639e('0x25')](function(){_0x3ab673[_0x639e('0x1a')](0xcc)[_0x639e('0x1b')]();});}};}function handleEntityNotFound(_0x2da264,_0x2df4d1){return function(_0x5f27f6){if(!_0x5f27f6){_0x2da264[_0x639e('0x26')](0x194);}return _0x5f27f6;};}function handleError(_0x97665a,_0x3a4fe3){_0x3a4fe3=_0x3a4fe3||0x1f4;return function(_0x10abb0){logger['error'](_0x10abb0[_0x639e('0x27')]);if(_0x10abb0[_0x639e('0x28')]){delete _0x10abb0[_0x639e('0x28')];}_0x97665a['status'](_0x3a4fe3)[_0x639e('0x29')](_0x10abb0);};}exports['index']=function(_0x38ce3a,_0x4da5f4){var _0x525a1f={},_0x2c8e3a={},_0x2a3f56={'count':0x0,'rows':[]};var _0x3f7b0f=_[_0x639e('0x2a')](db[_0x639e('0x2b')][_0x639e('0x2c')],function(_0x5797da){return{'name':_0x5797da[_0x639e('0x2d')],'type':_0x5797da[_0x639e('0x2e')]['key']};});_0x2c8e3a['model']=_[_0x639e('0x2a')](_0x3f7b0f,_0x639e('0x28'));_0x2c8e3a[_0x639e('0x2f')]=_['keys'](_0x38ce3a[_0x639e('0x2f')]);_0x2c8e3a['filters']=_[_0x639e('0x30')](_0x2c8e3a[_0x639e('0x31')],_0x2c8e3a[_0x639e('0x2f')]);_0x525a1f['attributes']=_[_0x639e('0x30')](_0x2c8e3a['model'],qs[_0x639e('0x32')](_0x38ce3a[_0x639e('0x2f')][_0x639e('0x32')]));_0x525a1f['attributes']=_0x525a1f[_0x639e('0x33')][_0x639e('0x34')]?_0x525a1f[_0x639e('0x33')]:_0x2c8e3a['model'];if(!_0x38ce3a[_0x639e('0x2f')]['hasOwnProperty'](_0x639e('0x35'))){_0x525a1f[_0x639e('0x1f')]=qs[_0x639e('0x1f')](_0x38ce3a[_0x639e('0x2f')][_0x639e('0x1f')]);_0x525a1f['offset']=qs[_0x639e('0x1e')](_0x38ce3a[_0x639e('0x2f')][_0x639e('0x1e')]);}_0x525a1f[_0x639e('0x36')]=qs['sort'](_0x38ce3a[_0x639e('0x2f')][_0x639e('0x37')]);_0x525a1f[_0x639e('0x38')]=qs['filters'](_[_0x639e('0x39')](_0x38ce3a['query'],_0x2c8e3a[_0x639e('0x3a')]),_0x3f7b0f);if(_0x38ce3a[_0x639e('0x2f')][_0x639e('0x3b')]){_0x525a1f[_0x639e('0x38')]=_[_0x639e('0x3c')](_0x525a1f[_0x639e('0x38')],{'$or':_['map'](_0x3f7b0f,function(_0xebceb5){if(_0xebceb5[_0x639e('0x2e')]!=='VIRTUAL'){var _0x26e637={};_0x26e637[_0xebceb5['name']]={'$like':'%'+_0x38ce3a[_0x639e('0x2f')][_0x639e('0x3b')]+'%'};return _0x26e637;}})});}_0x525a1f=_[_0x639e('0x3c')]({},_0x525a1f,_0x38ce3a[_0x639e('0x3d')]);var _0x35878c={'where':_0x525a1f[_0x639e('0x38')]};return db[_0x639e('0x2b')][_0x639e('0x1d')](_0x35878c)['then'](function(_0x485359){_0x2a3f56['count']=_0x485359;if(_0x38ce3a['query'][_0x639e('0x3e')]){_0x525a1f[_0x639e('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x639e('0x40')](_0x525a1f);})[_0x639e('0x25')](function(_0x16a792){_0x2a3f56['rows']=_0x16a792;return _0x2a3f56;})[_0x639e('0x25')](respondWithFilteredResult(_0x4da5f4,_0x525a1f))[_0x639e('0x41')](handleError(_0x4da5f4,null));};exports[_0x639e('0x42')]=function(_0x3c7d42,_0xb9ef6c){var _0x1bede6={'raw':!![],'where':{'id':_0x3c7d42[_0x639e('0x43')]['id']}},_0x21b62d={};_0x21b62d[_0x639e('0x31')]=_['keys'](db[_0x639e('0x2b')][_0x639e('0x2c')]);_0x21b62d[_0x639e('0x2f')]=_[_0x639e('0x44')](_0x3c7d42[_0x639e('0x2f')]);_0x21b62d[_0x639e('0x3a')]=_['intersection'](_0x21b62d[_0x639e('0x31')],_0x21b62d[_0x639e('0x2f')]);_0x1bede6[_0x639e('0x33')]=_[_0x639e('0x30')](_0x21b62d[_0x639e('0x31')],qs[_0x639e('0x32')](_0x3c7d42[_0x639e('0x2f')][_0x639e('0x32')]));_0x1bede6[_0x639e('0x33')]=_0x1bede6[_0x639e('0x33')][_0x639e('0x34')]?_0x1bede6[_0x639e('0x33')]:_0x21b62d['model'];if(_0x3c7d42[_0x639e('0x2f')]['includeAll']){_0x1bede6['include']=[{'all':!![]}];}_0x1bede6=_[_0x639e('0x3c')]({},_0x1bede6,_0x3c7d42[_0x639e('0x3d')]);return db[_0x639e('0x2b')][_0x639e('0x45')](_0x1bede6)[_0x639e('0x25')](handleEntityNotFound(_0xb9ef6c,null))['then'](respondWithResult(_0xb9ef6c,null))[_0x639e('0x41')](handleError(_0xb9ef6c,null));};exports[_0x639e('0x46')]=function(_0x56ecea,_0x32000e){return db[_0x639e('0x2b')][_0x639e('0x46')](_0x56ecea['body'],{})[_0x639e('0x25')](respondWithResult(_0x32000e,0xc9))[_0x639e('0x41')](handleError(_0x32000e,null));};exports[_0x639e('0x47')]=function(_0x39c352,_0x4d0d3b){if(_0x39c352[_0x639e('0x48')]['id']){delete _0x39c352['body']['id'];}return db[_0x639e('0x2b')]['find']({'where':{'id':_0x39c352[_0x639e('0x43')]['id']}})[_0x639e('0x25')](handleEntityNotFound(_0x4d0d3b,null))[_0x639e('0x25')](saveUpdates(_0x39c352[_0x639e('0x48')],null))[_0x639e('0x25')](respondWithResult(_0x4d0d3b,null))['catch'](handleError(_0x4d0d3b,null));};exports[_0x639e('0x49')]=function(_0x1d3ace,_0x20a122){return db['ChatQueueReport'][_0x639e('0x45')]({'where':{'id':_0x1d3ace[_0x639e('0x43')]['id']}})[_0x639e('0x25')](handleEntityNotFound(_0x20a122,null))[_0x639e('0x25')](removeEntity(_0x20a122,null))['catch'](handleError(_0x20a122,null));};exports[_0x639e('0x4a')]=function(_0x5915ed,_0x9f62aa){return db[_0x639e('0x2b')][_0x639e('0x4a')]()[_0x639e('0x25')](respondWithResult(_0x9f62aa,null))['catch'](handleError(_0x9f62aa,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9bdbb72..1aa8e69 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x168583,_0x562155){var _0x4b0df2=function(_0x388126){while(--_0x388126){_0x168583['push'](_0x168583['shift']());}};_0x4b0df2(++_0x562155);}(_0xb7e7,0x121));var _0x7b7e=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb7e7[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0xfb8251,_0x22867e){var _0x2fcd5f=function(_0x2d47c0){while(--_0x2d47c0){_0xfb8251['push'](_0xfb8251['shift']());}};_0x2fcd5f(++_0x22867e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 893bb88..f183033 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 _0xca25=['util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','limit','lodash'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xca25,0x116));var _0x5ca2=function(_0x4b3da3,_0x7e6f6a){_0x4b3da3=_0x4b3da3-0x0;var _0x373c4f=_0xca25[_0x4b3da3];return _0x373c4f;};'use strict';var _=require(_0x5ca2('0x0'));var util=require(_0x5ca2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ca2('0x2'));var db=require(_0x5ca2('0x3'))['db'];var utils=require(_0x5ca2('0x4'));var logger=require('../../config/logger')(_0x5ca2('0x5'));var config=require(_0x5ca2('0x6'));var jayson=require(_0x5ca2('0x7'));var client=jayson[_0x5ca2('0x8')][_0x5ca2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27a188,_0x29aa51,_0xe6e7b3){return new BPromise(function(_0x4a97bb,_0x4b234a){return client[_0x5ca2('0xa')](_0x27a188,_0xe6e7b3)[_0x5ca2('0xb')](function(_0xb55a7f){logger['info'](_0x5ca2('0xc'),_0x29aa51,'request\x20sent');logger['debug'](_0x5ca2('0xd'),_0x29aa51,_0x5ca2('0xe'),JSON[_0x5ca2('0xf')](_0xb55a7f));if(_0xb55a7f[_0x5ca2('0x10')]){if(_0xb55a7f[_0x5ca2('0x10')][_0x5ca2('0x11')]===0x1f4){logger['error'](_0x5ca2('0xc'),_0x29aa51,_0xb55a7f[_0x5ca2('0x10')][_0x5ca2('0x12')]);return _0x4b234a(_0xb55a7f['error'][_0x5ca2('0x12')]);}logger[_0x5ca2('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x29aa51,_0xb55a7f[_0x5ca2('0x10')][_0x5ca2('0x12')]);return _0x4a97bb(_0xb55a7f[_0x5ca2('0x10')][_0x5ca2('0x12')]);}else{logger[_0x5ca2('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x29aa51,_0x5ca2('0xe'));_0x4a97bb(_0xb55a7f[_0x5ca2('0x14')][_0x5ca2('0x12')]);}})[_0x5ca2('0x15')](function(_0x41ddef){logger[_0x5ca2('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x29aa51,_0x41ddef);_0x4b234a(_0x41ddef);});});}exports[_0x5ca2('0x16')]=function(_0x32c8b0){var _0x5ea738=this;return new Promise(function(_0x16e6e2,_0x48d865){return db[_0x5ca2('0x17')][_0x5ca2('0x18')](_0x32c8b0[_0x5ca2('0x19')],{'raw':_0x32c8b0['options']?_0x32c8b0[_0x5ca2('0x1a')][_0x5ca2('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x475338){logger[_0x5ca2('0x13')](_0x5ca2('0x16'),_0x32c8b0);logger[_0x5ca2('0x1c')](_0x5ca2('0x16'),_0x32c8b0,JSON[_0x5ca2('0xf')](_0x475338));_0x16e6e2(_0x475338);})[_0x5ca2('0x15')](function(_0x5aa3f0){logger[_0x5ca2('0x10')]('CreateChatQueueReport',_0x5aa3f0['message'],_0x32c8b0);_0x48d865(_0x5ea738[_0x5ca2('0x10')](0x1f4,_0x5aa3f0['message']));});});};exports[_0x5ca2('0x1d')]=function(_0x58d526){var _0x2f3b5=this;return new Promise(function(_0x5a0cdf,_0x3d7568){return db[_0x5ca2('0x17')]['update'](_0x58d526['body'],{'raw':_0x58d526[_0x5ca2('0x1a')]?_0x58d526[_0x5ca2('0x1a')][_0x5ca2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58d526[_0x5ca2('0x1a')]?_0x58d526[_0x5ca2('0x1a')]['where']||null:null,'attributes':_0x58d526[_0x5ca2('0x1a')]?_0x58d526[_0x5ca2('0x1a')]['attributes']||null:null,'limit':_0x58d526[_0x5ca2('0x1a')]?_0x58d526[_0x5ca2('0x1a')][_0x5ca2('0x1e')]||null:null})[_0x5ca2('0xb')](function(_0xa77047){logger[_0x5ca2('0x13')](_0x5ca2('0x1d'),_0x58d526);logger[_0x5ca2('0x1c')](_0x5ca2('0x1d'),_0x58d526,JSON['stringify'](_0xa77047));_0x5a0cdf(_0xa77047);})[_0x5ca2('0x15')](function(_0x329643){logger['error'](_0x5ca2('0x1d'),_0x329643[_0x5ca2('0x12')],_0x58d526);_0x3d7568(_0x2f3b5[_0x5ca2('0x10')](0x1f4,_0x329643[_0x5ca2('0x12')]));});});}; \ No newline at end of file +var _0xb240=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','catch','CreateChatQueueReport','ChatQueueReport','options','raw','update','where','attributes','limit','then','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb240,0x7e));var _0x0b24=function(_0x24bdc3,_0x4e7ce7){_0x24bdc3=_0x24bdc3-0x0;var _0xc43c1a=_0xb240[_0x24bdc3];return _0xc43c1a;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var moment=require(_0x0b24('0x2'));var BPromise=require(_0x0b24('0x3'));var rs=require(_0x0b24('0x4'));var fs=require('fs');var Redis=require(_0x0b24('0x5'));var db=require(_0x0b24('0x6'))['db'];var utils=require(_0x0b24('0x7'));var logger=require(_0x0b24('0x8'))('rpc');var config=require(_0x0b24('0x9'));var jayson=require(_0x0b24('0xa'));var client=jayson[_0x0b24('0xb')][_0x0b24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x162a50,_0x53526b,_0x238a19){return new BPromise(function(_0x34be24,_0x41b7b9){return client['request'](_0x162a50,_0x238a19)['then'](function(_0x2679d5){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x53526b,_0x0b24('0xd'));logger[_0x0b24('0xe')](_0x0b24('0xf'),_0x53526b,_0x0b24('0xd'),JSON[_0x0b24('0x10')](_0x2679d5));if(_0x2679d5[_0x0b24('0x11')]){if(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x12')]===0x1f4){logger['error'](_0x0b24('0x13'),_0x53526b,_0x2679d5[_0x0b24('0x11')]['message']);return _0x41b7b9(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x14')]);}logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x2679d5['error']['message']);return _0x34be24(_0x2679d5['error']['message']);}else{logger[_0x0b24('0x15')](_0x0b24('0x13'),_0x53526b,_0x0b24('0xd'));_0x34be24(_0x2679d5['result'][_0x0b24('0x14')]);}})[_0x0b24('0x16')](function(_0x1fd966){logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x1fd966);_0x41b7b9(_0x1fd966);});});}exports[_0x0b24('0x17')]=function(_0x5518a5){var _0x377fd5=this;return new Promise(function(_0x1d619f,_0x4a1218){return db[_0x0b24('0x18')]['create'](_0x5518a5['body'],{'raw':_0x5518a5[_0x0b24('0x19')]?_0x5518a5[_0x0b24('0x19')][_0x0b24('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2fec2b){logger[_0x0b24('0x15')]('CreateChatQueueReport',_0x5518a5);logger[_0x0b24('0xe')](_0x0b24('0x17'),_0x5518a5,JSON[_0x0b24('0x10')](_0x2fec2b));_0x1d619f(_0x2fec2b);})[_0x0b24('0x16')](function(_0x46124d){logger[_0x0b24('0x11')](_0x0b24('0x17'),_0x46124d[_0x0b24('0x14')],_0x5518a5);_0x4a1218(_0x377fd5[_0x0b24('0x11')](0x1f4,_0x46124d['message']));});});};exports['UpdateChatQueueReport']=function(_0x1f88cf){var _0x3f92ac=this;return new Promise(function(_0x15c95d,_0xc93a22){return db['ChatQueueReport'][_0x0b24('0x1b')](_0x1f88cf['body'],{'raw':_0x1f88cf[_0x0b24('0x19')]?_0x1f88cf[_0x0b24('0x19')][_0x0b24('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f88cf[_0x0b24('0x19')]?_0x1f88cf[_0x0b24('0x19')][_0x0b24('0x1c')]||null:null,'attributes':_0x1f88cf[_0x0b24('0x19')]?_0x1f88cf[_0x0b24('0x19')][_0x0b24('0x1d')]||null:null,'limit':_0x1f88cf[_0x0b24('0x19')]?_0x1f88cf[_0x0b24('0x19')][_0x0b24('0x1e')]||null:null})[_0x0b24('0x1f')](function(_0x408511){logger[_0x0b24('0x15')](_0x0b24('0x20'),_0x1f88cf);logger[_0x0b24('0xe')](_0x0b24('0x20'),_0x1f88cf,JSON[_0x0b24('0x10')](_0x408511));_0x15c95d(_0x408511);})[_0x0b24('0x16')](function(_0x4a5b53){logger[_0x0b24('0x11')]('UpdateChatQueueReport',_0x4a5b53[_0x0b24('0x14')],_0x1f88cf);_0xc93a22(_0x3f92ac[_0x0b24('0x11')](0x1f4,_0x4a5b53['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6fe6a8b..51e6624 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 _0xc4f6=['/describe','/:id','post','create','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x3faff1,_0x596331){var _0x114695=function(_0x9d391c){while(--_0x9d391c){_0x3faff1['push'](_0x3faff1['shift']());}};_0x114695(++_0x596331);}(_0xc4f6,0x1e8));var _0x6c4f=function(_0x18ce93,_0x45645b){_0x18ce93=_0x18ce93-0x0;var _0x3ff555=_0xc4f6[_0x18ce93];return _0x3ff555;};'use strict';var multer=require(_0x6c4f('0x0'));var util=require(_0x6c4f('0x1'));var path=require(_0x6c4f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c4f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6c4f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x6c4f('0x5')]('/',auth[_0x6c4f('0x6')](),controller['index']);router['get'](_0x6c4f('0x7'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x6c4f('0x8'),auth[_0x6c4f('0x6')](),controller['show']);router[_0x6c4f('0x9')]('/',auth[_0x6c4f('0x6')](),controller[_0x6c4f('0xa')]);router[_0x6c4f('0xb')](_0x6c4f('0x8'),auth[_0x6c4f('0x6')](),controller[_0x6c4f('0xc')]);router['delete'](_0x6c4f('0x8'),auth['isAuthenticated'](),controller[_0x6c4f('0xd')]);module[_0x6c4f('0xe')]=router; \ No newline at end of file +var _0x8fd5=['/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x24380a,_0x139674){var _0x514298=function(_0x5939c6){while(--_0x5939c6){_0x24380a['push'](_0x24380a['shift']());}};_0x514298(++_0x139674);}(_0x8fd5,0x1e2));var _0x58fd=function(_0x3e4f74,_0x26ce71){_0x3e4f74=_0x3e4f74-0x0;var _0xd07d99=_0x8fd5[_0x3e4f74];return _0xd07d99;};'use strict';var multer=require('multer');var util=require(_0x58fd('0x0'));var path=require(_0x58fd('0x1'));var timeout=require(_0x58fd('0x2'));var express=require(_0x58fd('0x3'));var router=express[_0x58fd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x58fd('0x5'));var config=require(_0x58fd('0x6'));var controller=require(_0x58fd('0x7'));router[_0x58fd('0x8')]('/',auth[_0x58fd('0x9')](),controller[_0x58fd('0xa')]);router[_0x58fd('0x8')](_0x58fd('0xb'),auth[_0x58fd('0x9')](),controller['describe']);router['get'](_0x58fd('0xc'),auth[_0x58fd('0x9')](),controller['show']);router[_0x58fd('0xd')]('/',auth[_0x58fd('0x9')](),controller[_0x58fd('0xe')]);router[_0x58fd('0xf')](_0x58fd('0xc'),auth['isAuthenticated'](),controller[_0x58fd('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x58fd('0x11')]);module[_0x58fd('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 9972efe..61314c2 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1ee1be,_0x28b241){_0x1ee1be=_0x1ee1be-0x0;var _0x5c0954=_0xb43b[_0x1ee1be];return _0x5c0954;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x52abb5,_0x7d9937){var _0x1f307c=function(_0x107b7b){while(--_0x107b7b){_0x52abb5['push'](_0x52abb5['shift']());}};_0x1f307c(++_0x7d9937);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x352713,_0x737610){_0x352713=_0x352713-0x0;var _0x46a4ea=_0xf3cd[_0x352713];return _0x46a4ea;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c067448..d8572f2 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 _0xf6cf=['update','then','status','end','error','stack','name','send','index','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','ChatTransferReport','include','findAll','rows','catch','params','length','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','ejs','fs-extra','lodash','squel','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x4452f1,_0x5ad396){var _0x6cedd0=function(_0x1448f0){while(--_0x1448f0){_0x4452f1['push'](_0x4452f1['shift']());}};_0x6cedd0(++_0x5ad396);}(_0xf6cf,0x72));var _0xff6c=function(_0x16e46d,_0x1a5751){_0x16e46d=_0x16e46d-0x0;var _0x45c70d=_0xf6cf[_0x16e46d];return _0x45c70d;};'use strict';var emlformat=require(_0xff6c('0x0'));var rimraf=require(_0xff6c('0x1'));var zipdir=require(_0xff6c('0x2'));var jsonpatch=require(_0xff6c('0x3'));var rp=require(_0xff6c('0x4'));var moment=require(_0xff6c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff6c('0x6'));var fs=require('fs');var fs_extra=require(_0xff6c('0x7'));var _=require(_0xff6c('0x8'));var squel=require(_0xff6c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff6c('0xa'));var querystring=require(_0xff6c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xff6c('0xc'));var qs=require(_0xff6c('0xd'));var as=require(_0xff6c('0xe'));var hardwareService=require(_0xff6c('0xf'));var logger=require(_0xff6c('0x10'))(_0xff6c('0x11'));var utils=require('../../config/utils');var config=require(_0xff6c('0x12'));var licenseUtil=require(_0xff6c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c018b,_0x44408a){_0x44408a=_0x44408a||0xcc;return function(_0x3a40d3){if(_0x3a40d3){return _0x1c018b[_0xff6c('0x14')](_0x44408a);}return _0x1c018b['status'](_0x44408a)['end']();};}function respondWithResult(_0x5ec24f,_0x3b9db0){_0x3b9db0=_0x3b9db0||0xc8;return function(_0x4582ed){if(_0x4582ed){return _0x5ec24f['status'](_0x3b9db0)[_0xff6c('0x15')](_0x4582ed);}};}function respondWithFilteredResult(_0x59f6fd,_0x78ca97){return function(_0x91a6d3){if(_0x91a6d3){var _0x267a3b=typeof _0x78ca97[_0xff6c('0x16')]===_0xff6c('0x17')&&typeof _0x78ca97[_0xff6c('0x18')]===_0xff6c('0x17');var _0x19f5fd=_0x91a6d3[_0xff6c('0x19')];var _0x5c8bbf=_0x267a3b?0x0:_0x78ca97[_0xff6c('0x16')];var _0x322e46=_0x267a3b?_0x91a6d3[_0xff6c('0x19')]:_0x78ca97[_0xff6c('0x16')]+_0x78ca97[_0xff6c('0x18')];var _0x3052be;if(_0x322e46>=_0x19f5fd){_0x322e46=_0x19f5fd;_0x3052be=0xc8;}else{_0x3052be=0xce;}_0x59f6fd['status'](_0x3052be);return _0x59f6fd['set'](_0xff6c('0x1a'),_0x5c8bbf+'-'+_0x322e46+'/'+_0x19f5fd)[_0xff6c('0x15')](_0x91a6d3);}return null;};}function patchUpdates(_0x56d2bc){return function(_0x1d9418){try{jsonpatch[_0xff6c('0x1b')](_0x1d9418,_0x56d2bc,!![]);}catch(_0x292fd2){return BPromise[_0xff6c('0x1c')](_0x292fd2);}return _0x1d9418[_0xff6c('0x1d')]();};}function saveUpdates(_0x35b1d2,_0x4ef982){return function(_0x482011){if(_0x482011){return _0x482011[_0xff6c('0x1e')](_0x35b1d2)[_0xff6c('0x1f')](function(_0x37de5e){return _0x37de5e;});}return null;};}function removeEntity(_0x30fc9e,_0x48d670){return function(_0x386218){if(_0x386218){return _0x386218['destroy']()[_0xff6c('0x1f')](function(){_0x30fc9e[_0xff6c('0x20')](0xcc)[_0xff6c('0x21')]();});}};}function handleEntityNotFound(_0x4e326e,_0xc7e7b3){return function(_0x3209f1){if(!_0x3209f1){_0x4e326e[_0xff6c('0x14')](0x194);}return _0x3209f1;};}function handleError(_0xed81b0,_0x5be7d8){_0x5be7d8=_0x5be7d8||0x1f4;return function(_0x761622){logger[_0xff6c('0x22')](_0x761622[_0xff6c('0x23')]);if(_0x761622['name']){delete _0x761622[_0xff6c('0x24')];}_0xed81b0[_0xff6c('0x20')](_0x5be7d8)[_0xff6c('0x25')](_0x761622);};}exports[_0xff6c('0x26')]=function(_0x590261,_0x4269d5){var _0xa79f4a={},_0x120c70={},_0xeae2e6={'count':0x0,'rows':[]};var _0x581ed0=_['map'](db['ChatTransferReport'][_0xff6c('0x27')],function(_0x2e1249){return{'name':_0x2e1249[_0xff6c('0x28')],'type':_0x2e1249['type'][_0xff6c('0x29')]};});_0x120c70['model']=_['map'](_0x581ed0,'name');_0x120c70[_0xff6c('0x2a')]=_[_0xff6c('0x2b')](_0x590261['query']);_0x120c70['filters']=_[_0xff6c('0x2c')](_0x120c70[_0xff6c('0x2d')],_0x120c70[_0xff6c('0x2a')]);_0xa79f4a[_0xff6c('0x2e')]=_['intersection'](_0x120c70[_0xff6c('0x2d')],qs['fields'](_0x590261[_0xff6c('0x2a')][_0xff6c('0x2f')]));_0xa79f4a['attributes']=_0xa79f4a[_0xff6c('0x2e')]['length']?_0xa79f4a[_0xff6c('0x2e')]:_0x120c70[_0xff6c('0x2d')];if(!_0x590261[_0xff6c('0x2a')][_0xff6c('0x30')](_0xff6c('0x31'))){_0xa79f4a[_0xff6c('0x18')]=qs['limit'](_0x590261['query'][_0xff6c('0x18')]);_0xa79f4a[_0xff6c('0x16')]=qs[_0xff6c('0x16')](_0x590261[_0xff6c('0x2a')]['offset']);}_0xa79f4a['order']=qs[_0xff6c('0x32')](_0x590261[_0xff6c('0x2a')]['sort']);_0xa79f4a[_0xff6c('0x33')]=qs[_0xff6c('0x34')](_[_0xff6c('0x35')](_0x590261[_0xff6c('0x2a')],_0x120c70['filters']),_0x581ed0);if(_0x590261[_0xff6c('0x2a')][_0xff6c('0x36')]){_0xa79f4a[_0xff6c('0x33')]=_[_0xff6c('0x37')](_0xa79f4a[_0xff6c('0x33')],{'$or':_[_0xff6c('0x38')](_0x581ed0,function(_0x3e0eb5){if(_0x3e0eb5['type']!==_0xff6c('0x39')){var _0x42f98e={};_0x42f98e[_0x3e0eb5['name']]={'$like':'%'+_0x590261[_0xff6c('0x2a')]['filter']+'%'};return _0x42f98e;}})});}_0xa79f4a=_[_0xff6c('0x37')]({},_0xa79f4a,_0x590261[_0xff6c('0x3a')]);var _0x4f400d={'where':_0xa79f4a[_0xff6c('0x33')]};return db[_0xff6c('0x3b')][_0xff6c('0x19')](_0x4f400d)[_0xff6c('0x1f')](function(_0x421e20){_0xeae2e6[_0xff6c('0x19')]=_0x421e20;if(_0x590261[_0xff6c('0x2a')]['includeAll']){_0xa79f4a[_0xff6c('0x3c')]=[{'all':!![]}];}return db[_0xff6c('0x3b')][_0xff6c('0x3d')](_0xa79f4a);})[_0xff6c('0x1f')](function(_0x35521d){_0xeae2e6[_0xff6c('0x3e')]=_0x35521d;return _0xeae2e6;})[_0xff6c('0x1f')](respondWithFilteredResult(_0x4269d5,_0xa79f4a))[_0xff6c('0x3f')](handleError(_0x4269d5,null));};exports['show']=function(_0x3a5b96,_0x108c53){var _0x226613={'raw':!![],'where':{'id':_0x3a5b96[_0xff6c('0x40')]['id']}},_0x1f1d43={};_0x1f1d43[_0xff6c('0x2d')]=_[_0xff6c('0x2b')](db[_0xff6c('0x3b')][_0xff6c('0x27')]);_0x1f1d43[_0xff6c('0x2a')]=_[_0xff6c('0x2b')](_0x3a5b96[_0xff6c('0x2a')]);_0x1f1d43[_0xff6c('0x34')]=_['intersection'](_0x1f1d43[_0xff6c('0x2d')],_0x1f1d43[_0xff6c('0x2a')]);_0x226613[_0xff6c('0x2e')]=_[_0xff6c('0x2c')](_0x1f1d43['model'],qs[_0xff6c('0x2f')](_0x3a5b96[_0xff6c('0x2a')][_0xff6c('0x2f')]));_0x226613[_0xff6c('0x2e')]=_0x226613[_0xff6c('0x2e')][_0xff6c('0x41')]?_0x226613[_0xff6c('0x2e')]:_0x1f1d43['model'];if(_0x3a5b96[_0xff6c('0x2a')][_0xff6c('0x42')]){_0x226613[_0xff6c('0x3c')]=[{'all':!![]}];}_0x226613=_[_0xff6c('0x37')]({},_0x226613,_0x3a5b96[_0xff6c('0x3a')]);return db[_0xff6c('0x3b')][_0xff6c('0x43')](_0x226613)['then'](handleEntityNotFound(_0x108c53,null))[_0xff6c('0x1f')](respondWithResult(_0x108c53,null))[_0xff6c('0x3f')](handleError(_0x108c53,null));};exports[_0xff6c('0x44')]=function(_0x38f1fa,_0x4a857b){return db[_0xff6c('0x3b')][_0xff6c('0x44')](_0x38f1fa[_0xff6c('0x45')],{})[_0xff6c('0x1f')](respondWithResult(_0x4a857b,0xc9))['catch'](handleError(_0x4a857b,null));};exports[_0xff6c('0x1e')]=function(_0x35f4ca,_0x5b24a0){if(_0x35f4ca[_0xff6c('0x45')]['id']){delete _0x35f4ca['body']['id'];}return db['ChatTransferReport'][_0xff6c('0x43')]({'where':{'id':_0x35f4ca[_0xff6c('0x40')]['id']}})['then'](handleEntityNotFound(_0x5b24a0,null))[_0xff6c('0x1f')](saveUpdates(_0x35f4ca['body'],null))[_0xff6c('0x1f')](respondWithResult(_0x5b24a0,null))[_0xff6c('0x3f')](handleError(_0x5b24a0,null));};exports[_0xff6c('0x46')]=function(_0x55bce3,_0x1e83f0){return db['ChatTransferReport'][_0xff6c('0x43')]({'where':{'id':_0x55bce3['params']['id']}})['then'](handleEntityNotFound(_0x1e83f0,null))[_0xff6c('0x1f')](removeEntity(_0x1e83f0,null))[_0xff6c('0x3f')](handleError(_0x1e83f0,null));};exports[_0xff6c('0x47')]=function(_0x3bdefb,_0x2d116c){return db['ChatTransferReport'][_0xff6c('0x47')]()['then'](respondWithResult(_0x2d116c,null))[_0xff6c('0x3f')](handleError(_0x2d116c,null));}; \ No newline at end of file +var _0x8091=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','error','name','send','index','map','ChatTransferReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x3b450c,_0x6ec533){var _0x169742=function(_0x33e08b){while(--_0x33e08b){_0x3b450c['push'](_0x3b450c['shift']());}};_0x169742(++_0x6ec533);}(_0x8091,0x124));var _0x1809=function(_0x244431,_0x5eab55){_0x244431=_0x244431-0x0;var _0x55f978=_0x8091[_0x244431];return _0x55f978;};'use strict';var emlformat=require(_0x1809('0x0'));var rimraf=require(_0x1809('0x1'));var zipdir=require(_0x1809('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1809('0x3'));var BPromise=require(_0x1809('0x4'));var Mustache=require(_0x1809('0x5'));var util=require(_0x1809('0x6'));var path=require(_0x1809('0x7'));var sox=require(_0x1809('0x8'));var csv=require('to-csv');var ejs=require(_0x1809('0x9'));var fs=require('fs');var fs_extra=require(_0x1809('0xa'));var _=require(_0x1809('0xb'));var squel=require(_0x1809('0xc'));var crypto=require(_0x1809('0xd'));var jsforce=require(_0x1809('0xe'));var deskjs=require(_0x1809('0xf'));var toCsv=require(_0x1809('0x10'));var querystring=require('querystring');var Papa=require(_0x1809('0x11'));var Redis=require(_0x1809('0x12'));var authService=require(_0x1809('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1809('0x14'));var hardwareService=require(_0x1809('0x15'));var logger=require(_0x1809('0x16'))(_0x1809('0x17'));var utils=require(_0x1809('0x18'));var config=require(_0x1809('0x19'));var licenseUtil=require(_0x1809('0x1a'));var db=require(_0x1809('0x1b'))['db'];function respondWithStatusCode(_0x33dc31,_0x4a50ec){_0x4a50ec=_0x4a50ec||0xcc;return function(_0x142b90){if(_0x142b90){return _0x33dc31[_0x1809('0x1c')](_0x4a50ec);}return _0x33dc31[_0x1809('0x1d')](_0x4a50ec)['end']();};}function respondWithResult(_0x558563,_0x4f5adb){_0x4f5adb=_0x4f5adb||0xc8;return function(_0x2d67ac){if(_0x2d67ac){return _0x558563['status'](_0x4f5adb)[_0x1809('0x1e')](_0x2d67ac);}};}function respondWithFilteredResult(_0x5a32f3,_0x506402){return function(_0x13df4a){if(_0x13df4a){var _0x19aae6=typeof _0x506402[_0x1809('0x1f')]===_0x1809('0x20')&&typeof _0x506402[_0x1809('0x21')]===_0x1809('0x20');var _0x48e665=_0x13df4a['count'];var _0x8a8a41=_0x19aae6?0x0:_0x506402['offset'];var _0x5ceef8=_0x19aae6?_0x13df4a[_0x1809('0x22')]:_0x506402[_0x1809('0x1f')]+_0x506402[_0x1809('0x21')];var _0x496228;if(_0x5ceef8>=_0x48e665){_0x5ceef8=_0x48e665;_0x496228=0xc8;}else{_0x496228=0xce;}_0x5a32f3['status'](_0x496228);return _0x5a32f3['set'](_0x1809('0x23'),_0x8a8a41+'-'+_0x5ceef8+'/'+_0x48e665)[_0x1809('0x1e')](_0x13df4a);}return null;};}function patchUpdates(_0x13a7f){return function(_0x47a52a){try{jsonpatch['apply'](_0x47a52a,_0x13a7f,!![]);}catch(_0x32dfb9){return BPromise[_0x1809('0x24')](_0x32dfb9);}return _0x47a52a[_0x1809('0x25')]();};}function saveUpdates(_0x3481cd,_0x2a2b8f){return function(_0x317abb){if(_0x317abb){return _0x317abb[_0x1809('0x26')](_0x3481cd)['then'](function(_0x428185){return _0x428185;});}return null;};}function removeEntity(_0x2d2979,_0xde93c3){return function(_0x47c032){if(_0x47c032){return _0x47c032[_0x1809('0x27')]()[_0x1809('0x28')](function(){_0x2d2979[_0x1809('0x1d')](0xcc)[_0x1809('0x29')]();});}};}function handleEntityNotFound(_0x81b24d,_0x45594c){return function(_0x6c44fb){if(!_0x6c44fb){_0x81b24d[_0x1809('0x1c')](0x194);}return _0x6c44fb;};}function handleError(_0x25b279,_0x509b14){_0x509b14=_0x509b14||0x1f4;return function(_0x5c3be0){logger[_0x1809('0x2a')](_0x5c3be0['stack']);if(_0x5c3be0['name']){delete _0x5c3be0[_0x1809('0x2b')];}_0x25b279[_0x1809('0x1d')](_0x509b14)[_0x1809('0x2c')](_0x5c3be0);};}exports[_0x1809('0x2d')]=function(_0x599f7c,_0x5a609e){var _0x38b86c={},_0x36e1a4={},_0x493e32={'count':0x0,'rows':[]};var _0x5129a9=_[_0x1809('0x2e')](db[_0x1809('0x2f')]['rawAttributes'],function(_0x5bde61){return{'name':_0x5bde61[_0x1809('0x30')],'type':_0x5bde61[_0x1809('0x31')]['key']};});_0x36e1a4[_0x1809('0x32')]=_['map'](_0x5129a9,_0x1809('0x2b'));_0x36e1a4[_0x1809('0x33')]=_[_0x1809('0x34')](_0x599f7c[_0x1809('0x33')]);_0x36e1a4[_0x1809('0x35')]=_[_0x1809('0x36')](_0x36e1a4[_0x1809('0x32')],_0x36e1a4[_0x1809('0x33')]);_0x38b86c[_0x1809('0x37')]=_[_0x1809('0x36')](_0x36e1a4[_0x1809('0x32')],qs[_0x1809('0x38')](_0x599f7c[_0x1809('0x33')][_0x1809('0x38')]));_0x38b86c['attributes']=_0x38b86c[_0x1809('0x37')][_0x1809('0x39')]?_0x38b86c[_0x1809('0x37')]:_0x36e1a4[_0x1809('0x32')];if(!_0x599f7c['query']['hasOwnProperty'](_0x1809('0x3a'))){_0x38b86c['limit']=qs[_0x1809('0x21')](_0x599f7c['query'][_0x1809('0x21')]);_0x38b86c[_0x1809('0x1f')]=qs[_0x1809('0x1f')](_0x599f7c[_0x1809('0x33')]['offset']);}_0x38b86c[_0x1809('0x3b')]=qs[_0x1809('0x3c')](_0x599f7c[_0x1809('0x33')][_0x1809('0x3c')]);_0x38b86c[_0x1809('0x3d')]=qs['filters'](_['pick'](_0x599f7c['query'],_0x36e1a4['filters']),_0x5129a9);if(_0x599f7c[_0x1809('0x33')][_0x1809('0x3e')]){_0x38b86c[_0x1809('0x3d')]=_[_0x1809('0x3f')](_0x38b86c[_0x1809('0x3d')],{'$or':_['map'](_0x5129a9,function(_0x1ba9f4){if(_0x1ba9f4[_0x1809('0x31')]!=='VIRTUAL'){var _0x28ab8e={};_0x28ab8e[_0x1ba9f4[_0x1809('0x2b')]]={'$like':'%'+_0x599f7c[_0x1809('0x33')]['filter']+'%'};return _0x28ab8e;}})});}_0x38b86c=_['merge']({},_0x38b86c,_0x599f7c[_0x1809('0x40')]);var _0x34acef={'where':_0x38b86c['where']};return db[_0x1809('0x2f')][_0x1809('0x22')](_0x34acef)[_0x1809('0x28')](function(_0xe66fd){_0x493e32[_0x1809('0x22')]=_0xe66fd;if(_0x599f7c[_0x1809('0x33')][_0x1809('0x41')]){_0x38b86c[_0x1809('0x42')]=[{'all':!![]}];}return db[_0x1809('0x2f')][_0x1809('0x43')](_0x38b86c);})[_0x1809('0x28')](function(_0x2d2e1e){_0x493e32['rows']=_0x2d2e1e;return _0x493e32;})[_0x1809('0x28')](respondWithFilteredResult(_0x5a609e,_0x38b86c))['catch'](handleError(_0x5a609e,null));};exports[_0x1809('0x44')]=function(_0xdb15f6,_0x4e5e97){var _0xefbf57={'raw':!![],'where':{'id':_0xdb15f6['params']['id']}},_0x4faec5={};_0x4faec5[_0x1809('0x32')]=_[_0x1809('0x34')](db['ChatTransferReport']['rawAttributes']);_0x4faec5[_0x1809('0x33')]=_[_0x1809('0x34')](_0xdb15f6[_0x1809('0x33')]);_0x4faec5[_0x1809('0x35')]=_[_0x1809('0x36')](_0x4faec5[_0x1809('0x32')],_0x4faec5[_0x1809('0x33')]);_0xefbf57[_0x1809('0x37')]=_['intersection'](_0x4faec5['model'],qs[_0x1809('0x38')](_0xdb15f6[_0x1809('0x33')][_0x1809('0x38')]));_0xefbf57['attributes']=_0xefbf57[_0x1809('0x37')][_0x1809('0x39')]?_0xefbf57['attributes']:_0x4faec5[_0x1809('0x32')];if(_0xdb15f6[_0x1809('0x33')][_0x1809('0x41')]){_0xefbf57[_0x1809('0x42')]=[{'all':!![]}];}_0xefbf57=_[_0x1809('0x3f')]({},_0xefbf57,_0xdb15f6[_0x1809('0x40')]);return db[_0x1809('0x2f')]['find'](_0xefbf57)[_0x1809('0x28')](handleEntityNotFound(_0x4e5e97,null))[_0x1809('0x28')](respondWithResult(_0x4e5e97,null))[_0x1809('0x45')](handleError(_0x4e5e97,null));};exports[_0x1809('0x46')]=function(_0x58de8f,_0x360858){return db[_0x1809('0x2f')][_0x1809('0x46')](_0x58de8f[_0x1809('0x47')],{})[_0x1809('0x28')](respondWithResult(_0x360858,0xc9))[_0x1809('0x45')](handleError(_0x360858,null));};exports[_0x1809('0x26')]=function(_0x5d99e9,_0x212786){if(_0x5d99e9['body']['id']){delete _0x5d99e9['body']['id'];}return db[_0x1809('0x2f')][_0x1809('0x48')]({'where':{'id':_0x5d99e9[_0x1809('0x49')]['id']}})['then'](handleEntityNotFound(_0x212786,null))['then'](saveUpdates(_0x5d99e9[_0x1809('0x47')],null))[_0x1809('0x28')](respondWithResult(_0x212786,null))[_0x1809('0x45')](handleError(_0x212786,null));};exports[_0x1809('0x27')]=function(_0x238dff,_0x244142){return db['ChatTransferReport'][_0x1809('0x48')]({'where':{'id':_0x238dff[_0x1809('0x49')]['id']}})[_0x1809('0x28')](handleEntityNotFound(_0x244142,null))[_0x1809('0x28')](removeEntity(_0x244142,null))[_0x1809('0x45')](handleError(_0x244142,null));};exports[_0x1809('0x4a')]=function(_0x528388,_0x159572){return db[_0x1809('0x2f')][_0x1809('0x4a')]()[_0x1809('0x28')](respondWithResult(_0x159572,null))[_0x1809('0x45')](handleError(_0x159572,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e35eb81..f1e307e 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 _0xf549=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer'];(function(_0x572a8b,_0x51b7bd){var _0x496dc4=function(_0x1f8548){while(--_0x1f8548){_0x572a8b['push'](_0x572a8b['shift']());}};_0x496dc4(++_0x51b7bd);}(_0xf549,0x1cf));var _0x9f54=function(_0x2bdf00,_0x494ed2){_0x2bdf00=_0x2bdf00-0x0;var _0x39752e=_0xf549[_0x2bdf00];return _0x39752e;};'use strict';var _=require(_0x9f54('0x0'));var util=require(_0x9f54('0x1'));var logger=require(_0x9f54('0x2'))('api');var moment=require(_0x9f54('0x3'));var BPromise=require(_0x9f54('0x4'));var rp=require(_0x9f54('0x5'));var fs=require('fs');var path=require(_0x9f54('0x6'));var rimraf=require(_0x9f54('0x7'));var config=require(_0x9f54('0x8'));var attributes=require(_0x9f54('0x9'));module[_0x9f54('0xa')]=function(_0x541dfc,_0x574b50){return _0x541dfc[_0x9f54('0xb')]('ChatTransferReport',attributes,{'tableName':_0x9f54('0xc'),'paranoid':![],'indexes':[{'name':_0x9f54('0xd'),'fields':[_0x9f54('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50e0=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api','moment'];(function(_0xadd417,_0x207028){var _0x5c79e7=function(_0xa07df0){while(--_0xa07df0){_0xadd417['push'](_0xadd417['shift']());}};_0x5c79e7(++_0x207028);}(_0x50e0,0x184));var _0x050e=function(_0x13712c,_0x573099){_0x13712c=_0x13712c-0x0;var _0x50e135=_0x50e0[_0x13712c];return _0x50e135;};'use strict';var _=require('lodash');var util=require(_0x050e('0x0'));var logger=require(_0x050e('0x1'))(_0x050e('0x2'));var moment=require(_0x050e('0x3'));var BPromise=require(_0x050e('0x4'));var rp=require(_0x050e('0x5'));var fs=require('fs');var path=require(_0x050e('0x6'));var rimraf=require(_0x050e('0x7'));var config=require(_0x050e('0x8'));var attributes=require(_0x050e('0x9'));module['exports']=function(_0x1c7981,_0x103a41){return _0x1c7981[_0x050e('0xa')](_0x050e('0xb'),attributes,{'tableName':_0x050e('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x050e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 3b3a26a..0d943bb 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 _0x0434=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0x0434,0xee));var _0x4043=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x0434[_0x23e6bb];return _0x1e3b4c;};'use strict';var _=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var moment=require('moment');var BPromise=require(_0x4043('0x2'));var rs=require(_0x4043('0x3'));var fs=require('fs');var Redis=require(_0x4043('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4043('0x5'));var logger=require(_0x4043('0x6'))(_0x4043('0x7'));var config=require(_0x4043('0x8'));var jayson=require(_0x4043('0x9'));var client=jayson[_0x4043('0xa')][_0x4043('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4873d7,_0x30d83f,_0x2181fb){return new BPromise(function(_0x4543ee,_0x54cde1){return client[_0x4043('0xc')](_0x4873d7,_0x2181fb)[_0x4043('0xd')](function(_0x40251e){logger[_0x4043('0xe')](_0x4043('0xf'),_0x30d83f,_0x4043('0x10'));logger[_0x4043('0x11')](_0x4043('0x12'),_0x30d83f,_0x4043('0x10'),JSON[_0x4043('0x13')](_0x40251e));if(_0x40251e[_0x4043('0x14')]){if(_0x40251e[_0x4043('0x14')][_0x4043('0x15')]===0x1f4){logger[_0x4043('0x14')](_0x4043('0xf'),_0x30d83f,_0x40251e[_0x4043('0x14')][_0x4043('0x16')]);return _0x54cde1(_0x40251e[_0x4043('0x14')][_0x4043('0x16')]);}logger[_0x4043('0x14')](_0x4043('0xf'),_0x30d83f,_0x40251e[_0x4043('0x14')][_0x4043('0x16')]);return _0x4543ee(_0x40251e['error'][_0x4043('0x16')]);}else{logger['info'](_0x4043('0xf'),_0x30d83f,_0x4043('0x10'));_0x4543ee(_0x40251e[_0x4043('0x17')][_0x4043('0x16')]);}})[_0x4043('0x18')](function(_0x2e2c35){logger['error'](_0x4043('0xf'),_0x30d83f,_0x2e2c35);_0x54cde1(_0x2e2c35);});});} \ No newline at end of file +var _0x61be=['error','code','message','info','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x15e983,_0x5824c8){var _0x3a1ec0=function(_0x8d5a32){while(--_0x8d5a32){_0x15e983['push'](_0x15e983['shift']());}};_0x3a1ec0(++_0x5824c8);}(_0x61be,0xae));var _0xe61b=function(_0x3849ff,_0x4ae25e){_0x3849ff=_0x3849ff-0x0;var _0x3ab676=_0x61be[_0x3849ff];return _0x3ab676;};'use strict';var _=require(_0xe61b('0x0'));var util=require('util');var moment=require(_0xe61b('0x1'));var BPromise=require(_0xe61b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe61b('0x3'))['db'];var utils=require(_0xe61b('0x4'));var logger=require(_0xe61b('0x5'))(_0xe61b('0x6'));var config=require(_0xe61b('0x7'));var jayson=require(_0xe61b('0x8'));var client=jayson[_0xe61b('0x9')][_0xe61b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3317db,_0x2d2bef,_0x55bcd8){return new BPromise(function(_0x3f4197,_0x1c3f6e){return client[_0xe61b('0xb')](_0x3317db,_0x55bcd8)[_0xe61b('0xc')](function(_0x40ed7e){logger['info'](_0xe61b('0xd'),_0x2d2bef,_0xe61b('0xe'));logger[_0xe61b('0xf')](_0xe61b('0x10'),_0x2d2bef,'request\x20sent',JSON[_0xe61b('0x11')](_0x40ed7e));if(_0x40ed7e[_0xe61b('0x12')]){if(_0x40ed7e[_0xe61b('0x12')][_0xe61b('0x13')]===0x1f4){logger[_0xe61b('0x12')](_0xe61b('0xd'),_0x2d2bef,_0x40ed7e[_0xe61b('0x12')][_0xe61b('0x14')]);return _0x1c3f6e(_0x40ed7e[_0xe61b('0x12')][_0xe61b('0x14')]);}logger[_0xe61b('0x12')](_0xe61b('0xd'),_0x2d2bef,_0x40ed7e['error']['message']);return _0x3f4197(_0x40ed7e['error']['message']);}else{logger[_0xe61b('0x15')]('ChatTransferReport,\x20%s,\x20%s',_0x2d2bef,'request\x20sent');_0x3f4197(_0x40ed7e[_0xe61b('0x16')][_0xe61b('0x14')]);}})[_0xe61b('0x17')](function(_0x21bb9e){logger[_0xe61b('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2d2bef,_0x21bb9e);_0x1c3f6e(_0x21bb9e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 20b76ed..2b20a33 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 _0x1554=['fs-extra','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','path','connect-timeout','express','Router'];(function(_0x12d603,_0x170b32){var _0x24c8fe=function(_0x5483d8){while(--_0x5483d8){_0x12d603['push'](_0x12d603['shift']());}};_0x24c8fe(++_0x170b32);}(_0x1554,0x8c));var _0x4155=function(_0x3adc34,_0x442cc0){_0x3adc34=_0x3adc34-0x0;var _0x5586bc=_0x1554[_0x3adc34];return _0x5586bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4155('0x0'));var timeout=require(_0x4155('0x1'));var express=require(_0x4155('0x2'));var router=express[_0x4155('0x3')]();var fs_extra=require(_0x4155('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4155('0x5'));router[_0x4155('0x6')]('/',auth[_0x4155('0x7')](),controller[_0x4155('0x8')]);router[_0x4155('0x6')]('/describe',auth[_0x4155('0x7')](),controller[_0x4155('0x9')]);router[_0x4155('0x6')](_0x4155('0xa'),auth[_0x4155('0x7')](),controller['show']);router[_0x4155('0xb')]('/',auth[_0x4155('0x7')](),controller[_0x4155('0xc')]);router[_0x4155('0xd')](_0x4155('0xa'),auth[_0x4155('0x7')](),controller[_0x4155('0xe')]);router[_0x4155('0xf')](_0x4155('0xa'),auth[_0x4155('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x658e=['/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0x2fef75,_0x2a4b1b){var _0x46bcd8=function(_0x534900){while(--_0x534900){_0x2fef75['push'](_0x2fef75['shift']());}};_0x46bcd8(++_0x2a4b1b);}(_0x658e,0x12a));var _0xe658=function(_0x50e4ef,_0x4f6739){_0x50e4ef=_0x50e4ef-0x0;var _0xd9168e=_0x658e[_0x50e4ef];return _0xd9168e;};'use strict';var multer=require(_0xe658('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe658('0x1'));var express=require(_0xe658('0x2'));var router=express[_0xe658('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe658('0x4'));router[_0xe658('0x5')]('/',auth[_0xe658('0x6')](),controller[_0xe658('0x7')]);router[_0xe658('0x5')](_0xe658('0x8'),auth[_0xe658('0x6')](),controller[_0xe658('0x9')]);router[_0xe658('0x5')](_0xe658('0xa'),auth[_0xe658('0x6')](),controller['show']);router[_0xe658('0xb')]('/',auth[_0xe658('0x6')](),controller[_0xe658('0xc')]);router['put'](_0xe658('0xa'),auth[_0xe658('0x6')](),controller[_0xe658('0xd')]);router[_0xe658('0xe')](_0xe658('0xa'),auth[_0xe658('0x6')](),controller[_0xe658('0xf')]);module[_0xe658('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 239a4c0..b25fd19 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 _0x21f9=['INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#011F6A','#ffffff'];(function(_0x21ec2a,_0x2e6abf){var _0x553942=function(_0x550d68){while(--_0x550d68){_0x21ec2a['push'](_0x21ec2a['shift']());}};_0x553942(++_0x2e6abf);}(_0x21f9,0xfd));var _0x921f=function(_0x5d3c28,_0xf86932){_0x5d3c28=_0x5d3c28-0x0;var _0x7940de=_0x21f9[_0x5d3c28];return _0x7940de;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x921f('0x0'));module['exports']={'name':{'type':Sequelize[_0x921f('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'unique':_0x921f('0x2')},'description':{'type':Sequelize[_0x921f('0x1')]},'mapKey':{'type':Sequelize[_0x921f('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x3')},'key':{'type':Sequelize[_0x921f('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x4')},'customerAlias':{'type':Sequelize[_0x921f('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x921f('0x9')](_0x921f('0xa'),'squared'),'defaultValue':_0x921f('0xa')},'header_online':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xb')},'start_chat_button':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xc')},'offline_chat_button':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xd')},'header_offline':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xe')},'download_transcript':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x921f('0x10')]},'closingQuestion':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x13')},'noteTitle':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0xd')},'skipMessageButton':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x16')},'conditionAgreement':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x921f('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x921f('0x9')](_0x921f('0x17'),_0x921f('0x18')),'defaultValue':_0x921f('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x921f('0x10')],'defaultValue':function(){return JSON[_0x921f('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x921f('0x1a'),'type':_0x921f('0x1b'),'required':!![]},'props':{'title':_0x921f('0x1a'),'helpText':''}},{'type':_0x921f('0x1c'),'props':{'title':_0x921f('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x921f('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x921f('0x1d')](_0x921f('0x1e'))?JSON[_0x921f('0x1f')](this[_0x921f('0x1d')](_0x921f('0x1e'))):{};},'set':function(_0x24c66a){return this[_0x921f('0x20')](_0x921f('0x1e'),JSON['stringify'](_0x24c66a));}},'offlineForm':{'type':Sequelize[_0x921f('0x10')],'defaultValue':function(){return JSON[_0x921f('0x19')]({'items':[{'type':_0x921f('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x921f('0x3')},'variable':null},{'type':_0x921f('0x21'),'config':{'placeholder':_0x921f('0x22')},'props':{'title':_0x921f('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x921f('0x1d')]('offlineForm')?JSON[_0x921f('0x1f')](this['getDataValue'](_0x921f('0x23'))):{};},'set':function(_0xf0a137){return this[_0x921f('0x20')](_0x921f('0x23'),JSON[_0x921f('0x19')](_0xf0a137));}},'token':{'type':Sequelize[_0x921f('0x1')],'defaultValue':function(){return rs[_0x921f('0x24')]();}},'autoclose':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x921f('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x921f('0x1')]},'waitingTitle':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x27')},'offlineMessageBody':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x921f('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x921f('0x16')},'sendUnmanaged':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x921f('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x921f('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x921f('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x921f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x2b')},'verticalAlignment':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x2c')},'messagesAlignment':{'type':Sequelize[_0x921f('0x1')],'defaultValue':_0x921f('0x2d')},'defaultTitle':{'type':Sequelize[_0x921f('0x1')]},'customerAvatar':{'type':Sequelize[_0x921f('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x921f('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x921f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x921f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x921f('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x921f('0x7')],'comment':_0x921f('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x561c38){if(!_0x561c38)this[_0x921f('0x20')](_0x921f('0x30'),null);this[_0x921f('0x20')](_0x921f('0x31'),_0x561c38);}},'vidaooEscalation':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x921f('0x1')]},'vidaooTopic':{'type':Sequelize[_0x921f('0x1')],'allowNull':![],'defaultValue':_0x921f('0x32')},'vidaooNote':{'type':Sequelize[_0x921f('0x1')],'defaultValue':function(){return _0x921f('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x921f('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x921f('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x921f('0x10')]}}; \ No newline at end of file +var _0x9456=['New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Feedback','ENUM','star','thumb','input','name','text','email','getDataValue','parse','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x4e4430,_0x550c2a){var _0x56c5e5=function(_0x14c1c7){while(--_0x14c1c7){_0x4e4430['push'](_0x4e4430['shift']());}};_0x56c5e5(++_0x550c2a);}(_0x9456,0xa9));var _0x6945=function(_0x2e2420,_0x53b1d0){_0x2e2420=_0x2e2420-0x0;var _0x1c6a09=_0x9456[_0x2e2420];return _0x1c6a09;};'use strict';var Sequelize=require(_0x6945('0x0'));var rs=require(_0x6945('0x1'));module[_0x6945('0x2')]={'name':{'type':Sequelize[_0x6945('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6945('0x3')],'allowNull':![],'unique':_0x6945('0x4')},'description':{'type':Sequelize[_0x6945('0x3')]},'mapKey':{'type':Sequelize[_0x6945('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x6945('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x6945('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6945('0x3')],'allowNull':![],'defaultValue':_0x6945('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6945('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6945('0x3')],'allowNull':![],'defaultValue':_0x6945('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6945('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6945('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x6945('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x6945('0xa'),'squared'),'defaultValue':_0x6945('0xa')},'header_online':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x6945('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x6945('0xd')},'header_offline':{'type':Sequelize[_0x6945('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x6945('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6945('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6945('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6945('0xe')]},'closingQuestion':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0xf')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6945('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x6945('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6945('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6945('0x12')},'closingMessage':{'type':Sequelize[_0x6945('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0xd')},'skipMessageButton':{'type':Sequelize[_0x6945('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x13')},'ratingType':{'type':Sequelize[_0x6945('0x14')](_0x6945('0x15'),_0x6945('0x16')),'defaultValue':_0x6945('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6945('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6945('0x17'),'variable':null,'config':{'placeholder':_0x6945('0x18'),'type':_0x6945('0x19'),'required':!![]},'props':{'title':_0x6945('0x18'),'helpText':''}},{'type':_0x6945('0x17'),'props':{'title':_0x6945('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6945('0x1a')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6945('0x1b')]('onlineForm')?JSON[_0x6945('0x1c')](this[_0x6945('0x1b')](_0x6945('0x1d'))):{};},'set':function(_0x24fce9){return this[_0x6945('0x1e')](_0x6945('0x1d'),JSON[_0x6945('0x1f')](_0x24fce9));}},'offlineForm':{'type':Sequelize[_0x6945('0xe')],'defaultValue':function(){return JSON[_0x6945('0x1f')]({'items':[{'type':_0x6945('0x17'),'props':{'title':_0x6945('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':_0x6945('0x1a'),'type':_0x6945('0x1a')},'variable':null},{'type':_0x6945('0x20'),'config':{'placeholder':_0x6945('0x21')},'props':{'title':_0x6945('0x21'),'helpText':_0x6945('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x6945('0x1b')](_0x6945('0x23'))?JSON['parse'](this[_0x6945('0x1b')](_0x6945('0x23'))):{};},'set':function(_0x488f8d){return this[_0x6945('0x1e')](_0x6945('0x23'),JSON[_0x6945('0x1f')](_0x488f8d));}},'token':{'type':Sequelize[_0x6945('0x3')],'defaultValue':function(){return rs[_0x6945('0x24')]();}},'autoclose':{'type':Sequelize[_0x6945('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6945('0x3')]},'waitingTitle':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x25')},'waitingMessage':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x27')},'offlineMessageBody':{'type':Sequelize[_0x6945('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x6945('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x28')},'skipUnmanaged':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x29')},'sendUnmanaged':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6945('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6945('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6945('0xe')],'defaultValue':function(){return _0x6945('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6945('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6945('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6945('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x6945('0x2d')},'messagesAlignment':{'type':Sequelize[_0x6945('0x3')],'defaultValue':_0x6945('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6945('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6945('0x3')],'allowNull':![],'defaultValue':_0x6945('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6945('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6945('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x6945('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6945('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6945('0x30'),'set':function(_0x3f3efa){if(!_0x3f3efa)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x6945('0x31'),_0x3f3efa);}},'vidaooEscalation':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x6945('0x3')],'allowNull':![],'defaultValue':_0x6945('0x32')},'vidaooNote':{'type':Sequelize[_0x6945('0x3')],'defaultValue':function(){return _0x6945('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x6945('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6945('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6945('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4fd8501..8a3c262 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 _0xba1e=['EventManager','notify','offline','ValidationError','no\x20available\x20attributes','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','Intervals','interval','getProactiveActions','../../config/license/util','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.12.2','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','replace','alignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','params','keys','find','create','body','trim','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','address','forEach','testWildcardValidity','describe','addDisposition','Disposition','findOne','pick','ChatWebsiteId','options','includeAll','removeDispositions','ids','getAnswers','CannedAnswer','file','agentAvatar','filename','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','sitepic','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','isNil','Interval','resolve','timezone','ifTime','chat','from','From\x20is\x20mandatory','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','mapKey','List','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','defaults','headers','threadId','ChatInteraction','closed','externalUrl','ContactId','interaction','Writing\x20on\x20closed\x20interaction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','Start','startRouting'];(function(_0x521106,_0x10d3ec){var _0xd55a3f=function(_0x12cd98){while(--_0x12cd98){_0x521106['push'](_0x521106['shift']());}};_0xd55a3f(++_0x10d3ec);}(_0xba1e,0x6b));var _0xeba1=function(_0x3a8688,_0x347bd2){_0x3a8688=_0x3a8688-0x0;var _0x1f61a7=_0xba1e[_0x3a8688];return _0x1f61a7;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require(_0xeba1('0x0'));var fs=require('fs');var fs_extra=require(_0xeba1('0x1'));var _=require(_0xeba1('0x2'));var querystring=require(_0xeba1('0x3'));var htmlToText=require(_0xeba1('0x4'));var Redis=require(_0xeba1('0x5'));var jayson=require(_0xeba1('0x6'));var qs=require(_0xeba1('0x7'));var logger=require('../../config/logger')('api');var config=require(_0xeba1('0x8'));var APIBadRequestError=require(_0xeba1('0x9'))[_0xeba1('0xa')];var APINotFoundError=require('../../errors/api')[_0xeba1('0xb')];var APIOutOfIntervalError=require(_0xeba1('0x9'))[_0xeba1('0xc')];var APIHandleError=require('../../errors/api')[_0xeba1('0xd')];var APIConflictError=require(_0xeba1('0x9'))[_0xeba1('0xe')];var wildcardUtils=require(_0xeba1('0xf'));var URL=require('url')[_0xeba1('0x10')];var db=require(_0xeba1('0x11'))['db'];config[_0xeba1('0x12')]=_['defaults'](config['redis'],{'host':_0xeba1('0x13'),'port':0x18eb});var socket=require(_0xeba1('0x14'))(new Redis(config[_0xeba1('0x12')]));require(_0xeba1('0x15'))[_0xeba1('0x16')](socket);var client=jayson[_0xeba1('0x17')]['http']({'port':0x232c});var client9002=jayson[_0xeba1('0x17')][_0xeba1('0x18')]({'port':0x232a});var client9003=jayson['client'][_0xeba1('0x18')]({'port':0x232b});var client9001=jayson[_0xeba1('0x17')][_0xeba1('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x397063,_0x49afc7,_0x486f62,_0x37769e){return new Promise(function(_0x4f7818,_0x1e3d7d){var _0x2138ac=_0x37769e||client;return _0x2138ac[_0xeba1('0x19')](_0x397063,_0x486f62)['then'](function(_0x7d3db3){logger[_0xeba1('0x1a')](_0xeba1('0x1b'),_0x49afc7,_0xeba1('0x1c'));logger['debug'](_0xeba1('0x1d'),_0x49afc7,_0xeba1('0x1c'),JSON[_0xeba1('0x1e')](_0x7d3db3));if(_0x7d3db3[_0xeba1('0x1f')]){if(_0x7d3db3[_0xeba1('0x1f')][_0xeba1('0x20')]===0x1f4){logger[_0xeba1('0x1f')](_0xeba1('0x1b'),_0x49afc7,_0x7d3db3[_0xeba1('0x1f')][_0xeba1('0x21')]);return _0x1e3d7d(_0x7d3db3['error'][_0xeba1('0x21')]);}logger[_0xeba1('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x49afc7,_0x7d3db3[_0xeba1('0x1f')][_0xeba1('0x21')]);return _0x4f7818(_0x7d3db3['error'][_0xeba1('0x21')]);}else{logger[_0xeba1('0x1a')](_0xeba1('0x1b'),_0x49afc7,_0xeba1('0x1c'));_0x4f7818(_0x7d3db3['result'][_0xeba1('0x21')]);}})[_0xeba1('0x22')](function(_0x16fdc2){logger['error'](_0xeba1('0x1b'),_0x49afc7,_0x16fdc2);_0x1e3d7d(_0x16fdc2);});});}function respondWithStatusCode(_0x15c721,_0x5cf19c){_0x5cf19c=_0x5cf19c||0xcc;return function(_0x5cf7ec){if(_0x5cf7ec){return _0x15c721[_0xeba1('0x23')](_0x5cf19c);}return _0x15c721[_0xeba1('0x24')](_0x5cf19c)[_0xeba1('0x25')]();};}function respondWithResult(_0x3a45ee,_0x4ae303){_0x4ae303=_0x4ae303||0xc8;return function(_0x2bbfdb){if(_0x2bbfdb){return _0x3a45ee['status'](_0x4ae303)[_0xeba1('0x26')](_0x2bbfdb);}};}function respondWithFilteredResult(_0x3c63d5,_0x167823){return function(_0x343044){if(_0x343044){var _0x4e92c6=typeof _0x167823['offset']==='undefined'&&typeof _0x167823['limit']===_0xeba1('0x27');var _0x2558cd=_0x343044[_0xeba1('0x28')];var _0x2158d8=_0x4e92c6?0x0:_0x167823[_0xeba1('0x29')];var _0x374407=_0x4e92c6?_0x343044[_0xeba1('0x28')]:_0x167823['offset']+_0x167823[_0xeba1('0x2a')];var _0x22f322;if(_0x374407>=_0x2558cd){_0x374407=_0x2558cd;_0x22f322=0xc8;}else{_0x22f322=0xce;}_0x3c63d5['status'](_0x22f322);return _0x3c63d5['set'](_0xeba1('0x2b'),_0x2158d8+'-'+_0x374407+'/'+_0x2558cd)['json'](_0x343044);}return null;};}function saveUpdates(_0xeec822){return function(_0x112d29){if(_0x112d29){return _0x112d29[_0xeba1('0x2c')](_0xeec822)[_0xeba1('0x2d')](function(_0x5579fa){return _0x5579fa;});}return null;};}function removeEntity(_0x3b970b){return function(_0x161e1b){if(_0x161e1b){return _0x161e1b[_0xeba1('0x2e')]()[_0xeba1('0x2d')](function(){var _0x58b3dc=_0x161e1b[_0xeba1('0x2f')]({'plain':!![]});var _0x405ec1=_0xeba1('0x30');return db[_0xeba1('0x31')][_0xeba1('0x2e')]({'where':{'type':_0x405ec1,'resourceId':_0x58b3dc['id']}})['then'](function(){return _0x161e1b;});})[_0xeba1('0x2d')](function(){_0x3b970b[_0xeba1('0x24')](0xcc)[_0xeba1('0x25')]();});}};}function handleEntityNotFound(_0x47cfc1){return function(_0x56d415){if(!_0x56d415){_0x47cfc1[_0xeba1('0x23')](0x194);}return _0x56d415;};}function handleError(_0x4eab63,_0x1a359f){_0x1a359f=_0x1a359f||0x1f4;return function(_0x2d162b){logger[_0xeba1('0x1f')](_0x2d162b[_0xeba1('0x32')]);if(_0x2d162b[_0xeba1('0x33')]){delete _0x2d162b[_0xeba1('0x33')];}_0x4eab63[_0xeba1('0x24')](_0x1a359f)[_0xeba1('0x34')](_0x2d162b);};}function createInteractionObject(_0x369743,_0x53e47f,_0x392a6b,_0x41272c){var _0x4eff52=require(_0xeba1('0x35'));var _0x30ba3e=new _0x4eff52();var _0x139898=_0x30ba3e[_0xeba1('0x36')](_0x392a6b[_0xeba1('0x37')])[_0xeba1('0x38')]();var _0x10324f=_0x53e47f[_0xeba1('0x39')];if(_0x392a6b[_0xeba1('0x3a')]){_0x10324f=_0x392a6b[_0xeba1('0x3a')];}else if(_0x392a6b[_0xeba1('0x3b')]){_0x10324f=_[_0xeba1('0x3c')](_0x392a6b[_0xeba1('0x3b')][_0xeba1('0x3d')](','));}return{'ContactId':_0x41272c['id'],'ChatWebsiteId':_0x369743,'from':(_0x41272c['firstName']||'')+'\x20'+(_0x41272c[_0xeba1('0x3e')]||''),'customerIp':_0x10324f,'customerPort':_0x392a6b['x-real-port']?_0x392a6b[_0xeba1('0x3f')]:null,'referer':_0x53e47f[_0xeba1('0x40')],'browserName':_0x139898[_0xeba1('0x41')][_0xeba1('0x33')]&&_0x139898['browser'][_0xeba1('0x42')]?util[_0xeba1('0x43')](_0xeba1('0x44'),_0x139898[_0xeba1('0x41')][_0xeba1('0x33')],_0x139898[_0xeba1('0x41')][_0xeba1('0x42')]):_0xeba1('0x45'),'browserVersion':_0x139898[_0xeba1('0x41')][_0xeba1('0x42')]||_0xeba1('0x45'),'osName':util[_0xeba1('0x43')](_0xeba1('0x44'),_0x139898['os'][_0xeba1('0x33')],_0x139898['os'][_0xeba1('0x42')]),'osVersion':_0x139898['os'][_0xeba1('0x42')],'deviceModel':_0x139898[_0xeba1('0x46')][_0xeba1('0x47')]&&_0x139898['device'][_0xeba1('0x48')]?util[_0xeba1('0x43')](_0xeba1('0x49'),_0x139898[_0xeba1('0x46')][_0xeba1('0x47')],_0x139898[_0xeba1('0x46')]['vendor'],_0x139898[_0xeba1('0x46')][_0xeba1('0x4a')]):null,'deviceVendor':_0x139898['device'][_0xeba1('0x48')],'deviceType':_0x139898['device'][_0xeba1('0x4a')],'formData':JSON[_0xeba1('0x1e')](_0x53e47f)};}exports[_0xeba1('0x4b')]=function(_0x5b7feb,_0x1fe7dc){var _0x65e57d={'include':[{'model':db[_0xeba1('0x4c')],'as':_0xeba1('0x4d')}]},_0x32a8ab={},_0x303dc5={'count':0x0,'rows':[]};var _0x44d671=_[_0xeba1('0x4e')](db[_0xeba1('0x4f')][_0xeba1('0x50')],function(_0x521b4c){return{'name':_0x521b4c[_0xeba1('0x51')],'type':_0x521b4c[_0xeba1('0x4a')][_0xeba1('0x52')]};});_0x32a8ab[_0xeba1('0x47')]=_[_0xeba1('0x4e')](_0x44d671,_0xeba1('0x33'));_0x32a8ab[_0xeba1('0x53')]=_['keys'](_0x5b7feb[_0xeba1('0x53')]);_0x32a8ab[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x32a8ab['model'],_0x32a8ab['query']);_0x65e57d['attributes']=_[_0xeba1('0x55')](_0x32a8ab['model'],qs[_0xeba1('0x56')](_0x5b7feb['query']['fields']));_0x65e57d[_0xeba1('0x57')]=_0x65e57d[_0xeba1('0x57')][_0xeba1('0x58')]?_0x65e57d[_0xeba1('0x57')]:_0x32a8ab[_0xeba1('0x47')];if(!_0x5b7feb[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x65e57d[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0x5b7feb['query'][_0xeba1('0x2a')]);_0x65e57d['offset']=qs[_0xeba1('0x29')](_0x5b7feb[_0xeba1('0x53')][_0xeba1('0x29')]);}_0x65e57d[_0xeba1('0x5b')]=qs['sort'](_0x5b7feb[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x65e57d[_0xeba1('0x5d')]=qs[_0xeba1('0x54')](_['pick'](_0x5b7feb[_0xeba1('0x53')],_0x32a8ab['filters']),_0x44d671);if(_0x5b7feb[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x65e57d[_0xeba1('0x5d')]=_[_0xeba1('0x5f')](_0x65e57d[_0xeba1('0x5d')],{'$or':_[_0xeba1('0x4e')](_0x44d671,function(_0xe1e50e){if(_0xe1e50e[_0xeba1('0x4a')]!==_0xeba1('0x60')){var _0x1972dd={};_0x1972dd[_0xe1e50e[_0xeba1('0x33')]]={'$like':'%'+_0x5b7feb[_0xeba1('0x53')]['filter']+'%'};return _0x1972dd;}})});}_0x65e57d=_[_0xeba1('0x5f')]({},_0x65e57d,_0x5b7feb['options']);var _0x1d87c1={'where':_0x65e57d[_0xeba1('0x5d')]};return db['ChatWebsite'][_0xeba1('0x28')](_0x1d87c1)[_0xeba1('0x2d')](function(_0x31a647){_0x303dc5['count']=_0x31a647;if(_0x5b7feb[_0xeba1('0x53')]['includeAll']){_0x65e57d[_0xeba1('0x61')]=[{'all':!![]}];}return db['ChatWebsite'][_0xeba1('0x62')](_0x65e57d);})[_0xeba1('0x2d')](function(_0xf802ac){_0x303dc5[_0xeba1('0x63')]=_0xf802ac;return _0x303dc5;})[_0xeba1('0x2d')](respondWithFilteredResult(_0x1fe7dc,_0x65e57d))['catch'](handleError(_0x1fe7dc,null));};exports[_0xeba1('0x64')]=function(_0x14fd24,_0x3b181b){var _0x2cf1da={'raw':![],'where':{'id':_0x14fd24[_0xeba1('0x65')]['id']},'include':[{'model':db[_0xeba1('0x4c')],'as':_0xeba1('0x4d')}]},_0x297834={};_0x297834[_0xeba1('0x47')]=_[_0xeba1('0x66')](db[_0xeba1('0x4f')][_0xeba1('0x50')]);_0x297834['query']=_['keys'](_0x14fd24[_0xeba1('0x53')]);_0x297834['filters']=_[_0xeba1('0x55')](_0x297834[_0xeba1('0x47')],_0x297834[_0xeba1('0x53')]);_0x2cf1da['attributes']=_[_0xeba1('0x55')](_0x297834[_0xeba1('0x47')],qs[_0xeba1('0x56')](_0x14fd24[_0xeba1('0x53')][_0xeba1('0x56')]));_0x2cf1da[_0xeba1('0x57')]=_0x2cf1da['attributes']['length']?_0x2cf1da[_0xeba1('0x57')]:_0x297834['model'];if(_0x14fd24['query']['includeAll']){_0x2cf1da[_0xeba1('0x61')]=[{'all':!![]}];}_0x2cf1da=_[_0xeba1('0x5f')]({},_0x2cf1da,_0x14fd24['options']);return db[_0xeba1('0x4f')][_0xeba1('0x67')](_0x2cf1da)[_0xeba1('0x2d')](handleEntityNotFound(_0x3b181b,null))['then'](respondWithResult(_0x3b181b,null))['catch'](handleError(_0x3b181b,null));};exports[_0xeba1('0x68')]=function(_0x5037d2,_0x4dbebb){var _0x54f5ba=null;_0x5037d2[_0xeba1('0x69')]['address'][_0xeba1('0x3d')](',')['forEach'](_0x502bea=>{if(_0x502bea['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x502bea[_0xeba1('0x6a')]())){_0x54f5ba=new APIBadRequestError('\x22'+_0x502bea[_0xeba1('0x6a')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x54f5ba){return handleError(_0x4dbebb,null)(_0x54f5ba);}return db['ChatWebsite'][_0xeba1('0x68')](_0x5037d2['body'],{})['then'](function(_0x68350d){var _0x418cfb=_0x5037d2[_0xeba1('0x6b')][_0xeba1('0x2f')]({'plain':!![]});if(!_0x418cfb)throw new Error(_0xeba1('0x6c'));if(_0x418cfb[_0xeba1('0x6d')]===_0xeba1('0x6b')){var _0x5b76ef=_0x68350d[_0xeba1('0x2f')]({'plain':!![]});var _0x1a2fad=_0xeba1('0x30');return db[_0xeba1('0x6e')][_0xeba1('0x67')]({'where':{'name':_0x1a2fad,'userProfileId':_0x418cfb[_0xeba1('0x6f')]},'raw':!![]})[_0xeba1('0x2d')](function(_0x28f0d4){if(_0x28f0d4&&_0x28f0d4[_0xeba1('0x70')]===0x0){return db[_0xeba1('0x31')]['create']({'name':_0x5b76ef[_0xeba1('0x33')],'resourceId':_0x5b76ef['id'],'type':_0x28f0d4[_0xeba1('0x33')],'sectionId':_0x28f0d4['id']},{})['then'](function(){return _0x68350d;});}else{return _0x68350d;}})[_0xeba1('0x22')](function(_0x2ed240){logger[_0xeba1('0x1f')](_0xeba1('0x71'),_0x2ed240);throw _0x2ed240;});}return _0x68350d;})[_0xeba1('0x2d')](respondWithResult(_0x4dbebb,0xc9))[_0xeba1('0x22')](handleError(_0x4dbebb,null));};exports['update']=function(_0x1e9b1c,_0x109abc){var _0x43ec32=null;_0x1e9b1c[_0xeba1('0x69')][_0xeba1('0x72')]['split'](',')[_0xeba1('0x73')](_0x3c02e9=>{if(_0x3c02e9[_0xeba1('0x6a')]()!==''&&!wildcardUtils[_0xeba1('0x74')](_0x3c02e9[_0xeba1('0x6a')]())){_0x43ec32=new APIBadRequestError('\x22'+_0x3c02e9[_0xeba1('0x6a')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x43ec32){return handleError(_0x109abc,null)(_0x43ec32);}if(_0x1e9b1c['body']['id']){delete _0x1e9b1c[_0xeba1('0x69')]['id'];}return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x1e9b1c[_0xeba1('0x65')]['id']},'include':[{'model':db[_0xeba1('0x4c')],'as':'mandatoryDispositionPause'}]})[_0xeba1('0x2d')](handleEntityNotFound(_0x109abc,null))['then'](saveUpdates(_0x1e9b1c[_0xeba1('0x69')],null))['then'](respondWithResult(_0x109abc,null))['catch'](handleError(_0x109abc,null));};exports[_0xeba1('0x2e')]=function(_0x5ee7ee,_0x39b8f1){return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x5ee7ee[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x39b8f1,null))[_0xeba1('0x2d')](removeEntity(_0x39b8f1,null))[_0xeba1('0x22')](handleError(_0x39b8f1,null));};exports[_0xeba1('0x75')]=function(_0x4ae943,_0x240956){return db[_0xeba1('0x4f')][_0xeba1('0x75')]()[_0xeba1('0x2d')](respondWithResult(_0x240956,null))[_0xeba1('0x22')](handleError(_0x240956,null));};exports[_0xeba1('0x76')]=function(_0x332b41,_0x1c6013){if(_0x332b41['body']['id']){delete _0x332b41[_0xeba1('0x69')]['id'];}return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x332b41[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x1c6013,null))[_0xeba1('0x2d')](function(_0x22604f){if(_0x22604f){_0x332b41['body']['ChatWebsiteId']=_0x22604f['id'];return db[_0xeba1('0x77')][_0xeba1('0x68')](_0x332b41['body']);}})['then'](respondWithResult(_0x1c6013,null))[_0xeba1('0x22')](handleError(_0x1c6013,null));};exports['getDispositions']=function(_0x384247,_0x3a39b3){var _0x42bed7={'raw':![],'where':{}};var _0x186c88={};var _0x3f3a1a={'count':0x0,'rows':[]};return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0x384247[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x3a39b3,null))[_0xeba1('0x2d')](function(_0xbefbef){if(_0xbefbef){_0x186c88['model']=_['keys'](db[_0xeba1('0x77')][_0xeba1('0x50')]);_0x186c88[_0xeba1('0x53')]=_['keys'](_0x384247[_0xeba1('0x53')]);_0x186c88[_0xeba1('0x54')]=_['intersection'](_0x186c88['model'],_0x186c88[_0xeba1('0x53')]);_0x42bed7[_0xeba1('0x57')]=_[_0xeba1('0x55')](_0x186c88[_0xeba1('0x47')],qs['fields'](_0x384247[_0xeba1('0x53')][_0xeba1('0x56')]));_0x42bed7[_0xeba1('0x57')]=_0x42bed7['attributes'][_0xeba1('0x58')]?_0x42bed7[_0xeba1('0x57')]:_0x186c88[_0xeba1('0x47')];if(!_0x384247[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x42bed7['limit']=qs[_0xeba1('0x2a')](_0x384247[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x42bed7[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0x384247['query'][_0xeba1('0x29')]);}_0x42bed7[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x384247[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x42bed7['where']=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0x384247[_0xeba1('0x53')],_0x186c88['filters']));_0x42bed7[_0xeba1('0x5d')][_0xeba1('0x7a')]=_0xbefbef['id'];if(_0x384247[_0xeba1('0x53')]['filter']){_0x42bed7[_0xeba1('0x5d')]=_[_0xeba1('0x5f')](_0x42bed7['where'],{'$or':_[_0xeba1('0x4e')](_0x42bed7[_0xeba1('0x57')],function(_0x3873e9){var _0x279e29={};_0x279e29[_0x3873e9]={'$like':'%'+_0x384247[_0xeba1('0x53')][_0xeba1('0x5e')]+'%'};return _0x279e29;})});}_0x42bed7=_[_0xeba1('0x5f')]({},_0x42bed7,_0x384247[_0xeba1('0x7b')]);return db['Disposition']['count']({'where':_0x42bed7[_0xeba1('0x5d')]})[_0xeba1('0x2d')](function(_0x22ca7a){_0x3f3a1a[_0xeba1('0x28')]=_0x22ca7a;if(_0x384247[_0xeba1('0x53')][_0xeba1('0x7c')]){_0x42bed7[_0xeba1('0x61')]=[{'all':!![]}];}return db[_0xeba1('0x77')]['findAll'](_0x42bed7);})[_0xeba1('0x2d')](function(_0x7eb43){_0x3f3a1a[_0xeba1('0x63')]=_0x7eb43;return _0x3f3a1a;});}})[_0xeba1('0x2d')](respondWithFilteredResult(_0x3a39b3,_0x42bed7))[_0xeba1('0x22')](handleError(_0x3a39b3,null));};exports[_0xeba1('0x7d')]=function(_0x41758d,_0x29ebb7){return db['ChatWebsite'][_0xeba1('0x67')]({'where':{'id':_0x41758d[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x29ebb7,null))['then'](function(_0x4f1949){if(_0x4f1949){return _0x4f1949['removeDispositions'](_0x41758d[_0xeba1('0x53')][_0xeba1('0x7e')]);}})[_0xeba1('0x2d')](respondWithStatusCode(_0x29ebb7,null))[_0xeba1('0x22')](handleError(_0x29ebb7,null));};exports['addAnswer']=function(_0xc4bfa2,_0x58d356){if(_0xc4bfa2['body']['id']){delete _0xc4bfa2[_0xeba1('0x69')]['id'];}return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0xc4bfa2[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x58d356,null))[_0xeba1('0x2d')](function(_0x1f45cc){if(_0x1f45cc){_0xc4bfa2[_0xeba1('0x69')]['ChatWebsiteId']=_0x1f45cc['id'];return db['CannedAnswer'][_0xeba1('0x68')](_0xc4bfa2['body']);}})[_0xeba1('0x2d')](respondWithResult(_0x58d356,null))['catch'](handleError(_0x58d356,null));};exports[_0xeba1('0x7f')]=function(_0xe25f2e,_0x1ae090){var _0x14ea74={'raw':![],'where':{}};var _0x257754={};var _0x21bfb7={'count':0x0,'rows':[]};return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0xe25f2e['params']['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x1ae090,null))[_0xeba1('0x2d')](function(_0x4c5cbd){if(_0x4c5cbd){_0x257754[_0xeba1('0x47')]=_[_0xeba1('0x66')](db[_0xeba1('0x80')][_0xeba1('0x50')]);_0x257754[_0xeba1('0x53')]=_[_0xeba1('0x66')](_0xe25f2e['query']);_0x257754[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x257754[_0xeba1('0x47')],_0x257754['query']);_0x14ea74[_0xeba1('0x57')]=_['intersection'](_0x257754[_0xeba1('0x47')],qs[_0xeba1('0x56')](_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x56')]));_0x14ea74[_0xeba1('0x57')]=_0x14ea74['attributes'][_0xeba1('0x58')]?_0x14ea74[_0xeba1('0x57')]:_0x257754['model'];if(!_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x14ea74[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0xe25f2e['query'][_0xeba1('0x2a')]);_0x14ea74[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0xe25f2e['query']['offset']);}_0x14ea74['order']=qs['sort'](_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x14ea74[_0xeba1('0x5d')]=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0xe25f2e[_0xeba1('0x53')],_0x257754[_0xeba1('0x54')]));_0x14ea74['where'][_0xeba1('0x7a')]=_0x4c5cbd['id'];if(_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x14ea74[_0xeba1('0x5d')]=_['merge'](_0x14ea74['where'],{'$or':_['map'](_0x14ea74['attributes'],function(_0x145495){var _0x22c461={};_0x22c461[_0x145495]={'$like':'%'+_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x5e')]+'%'};return _0x22c461;})});}_0x14ea74=_['merge']({},_0x14ea74,_0xe25f2e[_0xeba1('0x7b')]);return db[_0xeba1('0x80')][_0xeba1('0x28')]({'where':_0x14ea74[_0xeba1('0x5d')]})['then'](function(_0x1f6c61){_0x21bfb7[_0xeba1('0x28')]=_0x1f6c61;if(_0xe25f2e[_0xeba1('0x53')][_0xeba1('0x7c')]){_0x14ea74[_0xeba1('0x61')]=[{'all':!![]}];}return db[_0xeba1('0x80')][_0xeba1('0x62')](_0x14ea74);})[_0xeba1('0x2d')](function(_0x306746){_0x21bfb7['rows']=_0x306746;return _0x21bfb7;});}})['then'](respondWithFilteredResult(_0x1ae090,_0x14ea74))[_0xeba1('0x22')](handleError(_0x1ae090,null));};exports['removeAnswers']=function(_0x2ff0d2,_0x250300){return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x2ff0d2[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x250300,null))[_0xeba1('0x2d')](function(_0x25d1ea){if(_0x25d1ea){return _0x25d1ea['removeAnswers'](_0x2ff0d2[_0xeba1('0x53')][_0xeba1('0x7e')]);}})[_0xeba1('0x2d')](respondWithStatusCode(_0x250300,null))[_0xeba1('0x22')](handleError(_0x250300,null));};exports['addLogo']=function(_0x39be2e,_0xa32a37){_0x39be2e[_0xeba1('0x69')]['sitepic']=_0x39be2e[_0xeba1('0x81')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x39be2e[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0xa32a37,null))[_0xeba1('0x2d')](saveUpdates(_0x39be2e[_0xeba1('0x69')],null))[_0xeba1('0x2d')](respondWithResult(_0xa32a37,null))[_0xeba1('0x22')](handleError(_0xa32a37,null));};exports['addAvatar']=function(_0x1198cf,_0xbdeec0){_0x1198cf[_0xeba1('0x69')][_0xeba1('0x82')]=_0x1198cf[_0xeba1('0x81')][_0xeba1('0x83')];return db[_0xeba1('0x4f')]['find']({'where':{'id':_0x1198cf[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0xbdeec0,null))[_0xeba1('0x2d')](saveUpdates(_0x1198cf[_0xeba1('0x69')],null))['then'](respondWithResult(_0xbdeec0,null))[_0xeba1('0x22')](handleError(_0xbdeec0,null));};exports[_0xeba1('0x84')]=function(_0x355042,_0x2682c2){_0x355042[_0xeba1('0x69')][_0xeba1('0x85')]=_0x355042[_0xeba1('0x81')]['filename'];return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x355042['params']['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x2682c2,null))[_0xeba1('0x2d')](saveUpdates(_0x355042['body'],null))[_0xeba1('0x2d')](respondWithResult(_0x2682c2,null))[_0xeba1('0x22')](handleError(_0x2682c2,null));};exports['addSystemAvatar']=function(_0x3c2a73,_0x4da7bc){_0x3c2a73['body'][_0xeba1('0x86')]=_0x3c2a73[_0xeba1('0x81')][_0xeba1('0x83')];return db[_0xeba1('0x4f')]['find']({'where':{'id':_0x3c2a73[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x4da7bc,null))[_0xeba1('0x2d')](saveUpdates(_0x3c2a73[_0xeba1('0x69')],null))[_0xeba1('0x2d')](respondWithResult(_0x4da7bc,null))[_0xeba1('0x22')](handleError(_0x4da7bc,null));};exports[_0xeba1('0x87')]=function(_0x2c7d7e,_0x177a8a){var _0x9834dc=path[_0xeba1('0x88')](config['root'],_0xeba1('0x89'));var _0x452160={'where':{'id':_0x2c7d7e[_0xeba1('0x65')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x276a5d=![];return require('../../config/license/util')[_0xeba1('0x8a')]()['then'](function(_0x46396f){if(_0x46396f){_0x276a5d=_0x46396f['custom'];}})[_0xeba1('0x2d')](function(){return db['ChatWebsite']['find'](_0x452160);})[_0xeba1('0x2d')](handleEntityNotFound(_0x177a8a,null))[_0xeba1('0x2d')](function(_0x440f0e){if(_0x440f0e){if(!_['isNil'](_0x440f0e[_0xeba1('0x8b')])){if(fs[_0xeba1('0x8c')](path['join'](config[_0xeba1('0x8d')],_0xeba1('0x8e'),_0x440f0e[_0xeba1('0x8b')]))&&_0x276a5d){_0x9834dc=path[_0xeba1('0x88')](config['root'],_0xeba1('0x8e'),_0x440f0e['sitepic']);}}return _0x177a8a[_0xeba1('0x8f')](_0x9834dc);}})['catch'](handleError(_0x177a8a,null));};exports['getAvatar']=function(_0x4a062c,_0x2af028){var _0x733974=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x90'));var _0x2b646b={'where':{'id':_0x4a062c['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xeba1('0x4f')]['find'](_0x2b646b)[_0xeba1('0x2d')](handleEntityNotFound(_0x2af028,null))[_0xeba1('0x2d')](function(_0x3aef0f){if(_0x3aef0f){if(!_['isNil'](_0x3aef0f[_0xeba1('0x82')])){if(fs['existsSync'](path[_0xeba1('0x88')](config['root'],_0xeba1('0x91'),_0x3aef0f[_0xeba1('0x82')]))){_0x733974=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x91'),_0x3aef0f[_0xeba1('0x82')]);}}return _0x2af028[_0xeba1('0x8f')](_0x733974);}})['catch'](handleError(_0x2af028,null));};exports[_0xeba1('0x92')]=function(_0x3fc6f5,_0x5605c3){var _0x504c9f=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x93'));var _0x27c847={'where':{'id':_0x3fc6f5['params']['id']},'attributes':['id',_0xeba1('0x85'),_0xeba1('0x94')],'raw':!![]};return db[_0xeba1('0x4f')][_0xeba1('0x67')](_0x27c847)[_0xeba1('0x2d')](handleEntityNotFound(_0x5605c3,null))[_0xeba1('0x2d')](function(_0x1abd5a){if(_0x1abd5a){if(!_['isNil'](_0x1abd5a[_0xeba1('0x85')])){if(fs[_0xeba1('0x8c')](path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x91'),_0x1abd5a[_0xeba1('0x85')]))&&_0x1abd5a[_0xeba1('0x94')]){_0x504c9f=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x91'),_0x1abd5a['customerAvatar']);}}return _0x5605c3[_0xeba1('0x8f')](_0x504c9f);}})[_0xeba1('0x22')](handleError(_0x5605c3,null));};exports[_0xeba1('0x95')]=function(_0x4aa4f4,_0x130f83){var _0x5078ed=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],'server/files/images/avatars/system_avatar.png');var _0x4e84ca={'where':{'id':_0x4aa4f4['params']['id']},'attributes':['id',_0xeba1('0x86')],'raw':!![]};return db[_0xeba1('0x4f')][_0xeba1('0x67')](_0x4e84ca)[_0xeba1('0x2d')](handleEntityNotFound(_0x130f83,null))['then'](function(_0x3903a6){if(_0x3903a6){if(!_[_0xeba1('0x96')](_0x3903a6[_0xeba1('0x86')])){if(fs['existsSync'](path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x91'),_0x3903a6[_0xeba1('0x86')]))){_0x5078ed=path[_0xeba1('0x88')](config[_0xeba1('0x8d')],'server/files/images/avatars/',_0x3903a6[_0xeba1('0x86')]);}}return _0x130f83[_0xeba1('0x8f')](_0x5078ed);}})[_0xeba1('0x22')](handleError(_0x130f83,null));};function checkWebsiteInterval(_0x69fdff){var _0x45af5a=_0x69fdff[_0xeba1('0x97')];if(!_0x45af5a){return Promise[_0xeba1('0x98')](_0x69fdff);}var _0xee3617=_0x69fdff[_0xeba1('0x99')]||undefined;return _0x45af5a[_0xeba1('0x9a')](_0xee3617)[_0xeba1('0x2d')](function(_0x5bab99){if(!_0x5bab99){throw new APIOutOfIntervalError();}return _0x69fdff;});}exports['notify']=function(_0x5a0de1,_0x218ef1){var _0x5f3092={'body':_0x5a0de1['body'],'channel':_0xeba1('0x9b')};var _0x1c2c84=[];var _0x5c1e21=[];var _0x3deaae={};var _0x131c80=![];if(_0x5a0de1[_0xeba1('0x69')]['id']){delete _0x5a0de1['body']['id'];}if(_[_0xeba1('0x96')](_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x9c')])){throw new APIBadRequestError(_0xeba1('0x9d'));}if(_[_0xeba1('0x96')](_0x5a0de1[_0xeba1('0x69')]['mapKey'])){throw new APIBadRequestError(_0xeba1('0x9e'));}if(_[_0xeba1('0x9f')](_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x69')])){throw new APIBadRequestError(_0xeba1('0xa0'));}var _0x2f2589=_0x5a0de1['body']['customerIp']&&_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x40')];return db[_0xeba1('0xa1')][_0xeba1('0x75')]()[_0xeba1('0x2d')](function(_0x32eb4d){if(!_0x32eb4d){throw new Error('No\x20available\x20attributes');}_0x1c2c84=Object[_0xeba1('0x66')](_0x32eb4d)[_0xeba1('0x5e')](function(_0x4906fe){return![_0xeba1('0xa2'),_0xeba1('0xa3')][_0xeba1('0xa4')](_0x4906fe);});_0x5c1e21=Object['keys'](_0x32eb4d)[_0xeba1('0x5e')](function(_0x33f839){return![_0xeba1('0xa2'),_0xeba1('0xa3'),_0xeba1('0xa5'),_0xeba1('0xa6')][_0xeba1('0xa4')](_0x33f839);});if(!_[_0xeba1('0xa4')](_0x5c1e21,_0x5a0de1[_0xeba1('0x69')]['mapKey'])){throw new APIBadRequestError(_0xeba1('0xa7')+_0x5c1e21['join'](',\x20'));}_0x3deaae[_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xa8')]]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x9c')];})[_0xeba1('0x2d')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x5a0de1[_0xeba1('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0xeba1('0xa9'),'include':[{'model':db[_0xeba1('0xa1')],'as':_0xeba1('0xaa'),'where':_0x3deaae,'limit':0x1,'order':[[_0xeba1('0xa3'),_0xeba1('0xab')]]}]},{'model':db[_0xeba1('0xac')],'as':_0xeba1('0xad')},{'model':db[_0xeba1('0x97')],'as':_0xeba1('0x97'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]});})[_0xeba1('0x2d')](function(_0x5d1684){if(!_0x5d1684){throw new APINotFoundError(util['format'](_0xeba1('0xae'),_0x5a0de1[_0xeba1('0x65')]['id']));}if(_0x2f2589){return checkWebsiteInterval(_0x5d1684);}return _0x5d1684;})['then'](function(_0x205dc1){_0x5f3092[_0xeba1('0xaf')]=_0x205dc1;_0x5f3092[_0xeba1('0xb0')]=_[_0xeba1('0xb1')](_0x205dc1[_0xeba1('0xad')],[_0xeba1('0xb2')],[_0xeba1('0xb3')]);if(_0x5f3092[_0xeba1('0xaf')][_0xeba1('0xad')]){delete _0x5f3092[_0xeba1('0xaf')][_0xeba1('0xad')];}_0x5f3092['list']=_0x205dc1[_0xeba1('0xa9')]||{'id':_0x205dc1[_0xeba1('0xa6')]};if(_0x5f3092[_0xeba1('0xb4')]&&_0x5f3092[_0xeba1('0xb4')]['Contacts'][_0xeba1('0x58')]){return _0x5f3092[_0xeba1('0xb4')][_0xeba1('0xaa')][0x0];}var _0x4edc9f=_[_0xeba1('0xb5')](_0x5a0de1[_0xeba1('0x69')],{'firstName':_0x5a0de1[_0xeba1('0x69')]['from'],'ListId':_0x205dc1['ListId']});_0x4edc9f[_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xa8')]]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x9c')];return db[_0xeba1('0xa1')][_0xeba1('0x68')](_0x4edc9f,{'fields':_0x1c2c84,'raw':!![]});})['then'](function(_0x5f4136){_0x5f3092['contact']=_0x5f4136;var _0x591752=createInteractionObject(_0x5a0de1[_0xeba1('0x65')]['id'],_0x5a0de1[_0xeba1('0x69')],_0x5a0de1[_0xeba1('0xb6')],_0x5f4136);var _0x14aa8c={'ChatWebsiteId':_0x5a0de1[_0xeba1('0x65')]['id']};if(_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xb7')]){_0x14aa8c[_0xeba1('0xb7')]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xb7')];_0x14aa8c['closed']=![];return db[_0xeba1('0xb8')]['find']({'where':_0x14aa8c})[_0xeba1('0x2d')](function(_0x1bba0a){var _0x5e7423=_0x5a0de1['body']['customerIp']&&_0x5a0de1[_0xeba1('0x69')]['referer'];if(_0x1bba0a){_0x131c80=!![];return _0x1bba0a;}else if(!_0x5e7423&&_0x1bba0a&&_0x1bba0a[_0xeba1('0xb9')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x591752[_0xeba1('0xb7')]=_0x5a0de1['body']['threadId'];_0x591752[_0xeba1('0xba')]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xba')];return db['ChatInteraction'][_0xeba1('0x68')](_0x591752);});}_0x14aa8c[_0xeba1('0xbb')]=_0x5f4136['id'];if(_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xbc')]&&_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xbc')]['id']){_0x14aa8c['id']=_0x5a0de1['body'][_0xeba1('0xbc')]['id'];return db[_0xeba1('0xb8')][_0xeba1('0x67')]({'where':_0x14aa8c})[_0xeba1('0x2d')](function(_0x1b9811){var _0x21dea8=_0x5a0de1['body'][_0xeba1('0x39')]&&_0x5a0de1['body']['referer'];if(!_0x21dea8&&_0x1b9811&&_0x1b9811[_0xeba1('0xb9')]){throw new APIConflictError(_0xeba1('0xbd'));}else if(_0x1b9811){_0x131c80=!![];return _0x1b9811;}else{return db['ChatInteraction'][_0xeba1('0x68')](_0x591752);}});}return db[_0xeba1('0xb8')]['create'](_0x591752);})[_0xeba1('0x2d')](function(_0x2ea0a3){if(!_0x131c80){return _0x2ea0a3;}var _0x45b00f={'from':(_0x5f3092[_0xeba1('0xbe')]['firstName']||'')+'\x20'+(_0x5f3092[_0xeba1('0xbe')][_0xeba1('0x3e')]||'')};if(_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xb7')]&&_0x5a0de1[_0xeba1('0x69')]['messageId']&&_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xb7')]!=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xbf')]){_0x45b00f[_0xeba1('0xb7')]=_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xbf')];}return _0x2ea0a3[_0xeba1('0x2c')](_0x45b00f);})[_0xeba1('0x2d')](function(_0x79cc17){_0x5f3092['interaction']=_0x79cc17[_0xeba1('0x2f')]({'plain':!![]});_0x5f3092[_0xeba1('0xbc')]['created']=!_0x131c80;if(_0x5f3092[_0xeba1('0xbc')][_0xeba1('0xc0')]){if(_0x5f3092[_0xeba1('0xaf')][_0xeba1('0xc1')]){_0x5f3092[_0xeba1('0xb0')][_0xeba1('0xc2')]({'id':0x0,'priority':_0x5f3092['applications']['length']+0x1,'app':_0xeba1('0xc3'),'appdata':_0xeba1('0xc4'),'interval':_0xeba1('0xc5')});}}return db['ChatMessage']['create']({'body':_0x5a0de1[_0xeba1('0x69')][_0xeba1('0x69')],'ChatWebsiteId':_0x5a0de1[_0xeba1('0x65')]['id'],'ChatInteractionId':_0x79cc17['id'],'direction':'in','ContactId':_0x5f3092['contact']['id'],'AttachmentId':_0x5a0de1[_0xeba1('0x69')][_0xeba1('0xc6')]});})[_0xeba1('0x2d')](function(_0x283f4f){_0x5f3092['message']=_0x283f4f;if(!_0x5f3092[_0xeba1('0xbc')][_0xeba1('0xc7')]){return;}return db[_0xeba1('0xc8')][_0xeba1('0x67')]({'attributes':['id',_0xeba1('0x33')],'where':{'id':_0x5f3092[_0xeba1('0xbc')][_0xeba1('0xc7')]}});})['then'](function(_0x365ad0){if(_0x365ad0){_0x5f3092[_0xeba1('0xb0')][_0xeba1('0xc9')]({'id':0x0,'priority':0x0,'app':_0xeba1('0xca'),'appdata':_0x365ad0[_0xeba1('0x33')]+','+(_0x5f3092['account'][_0xeba1('0xcb')]||0xa),'interval':_0xeba1('0xc5')});_0x5f3092[_0xeba1('0xcc')]=!![];}if(!_0x5f3092[_0xeba1('0xbc')][_0xeba1('0xcd')]){return;}return db[_0xeba1('0xce')][_0xeba1('0x67')]({'attributes':['id',_0xeba1('0x33')],'where':{'id':_0x5f3092[_0xeba1('0xbc')]['queueId']}});})[_0xeba1('0x2d')](function(_0x2e47f3){if(_0x2e47f3){_0x5f3092[_0xeba1('0xb0')][_0xeba1('0xc9')]({'id':0x0,'priority':0x1,'app':_0xeba1('0xcf'),'appdata':_0x2e47f3[_0xeba1('0x33')]+','+(_0x5f3092['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xeba1('0xd0'),_0xeba1('0xd1'),_0x5f3092);})[_0xeba1('0x2d')](function(_0x4497c1){respondWithRpcPromise(_0xeba1('0xd2'),_0xeba1('0xd2'),{'event':_0xeba1('0xd3'),'message':_0x4497c1},client9002);return _0x4497c1;})[_0xeba1('0x2d')](respondWithResult(_0x218ef1,null))[_0xeba1('0x22')](APIHandleError(_0x218ef1));};exports[_0xeba1('0xd4')]=function(_0x5d6926,_0x509fb2){var _0xd8d5dd,_0x271338,_0x3ea268;var _0x1a84ce=[];var _0x488fca={};var _0x382fd9=_0x5d6926['files']||[];var _0x47d9b9=[];var _0x4989b9;return db[_0xeba1('0xa1')][_0xeba1('0x75')]()[_0xeba1('0x2d')](function(_0x51edd8){if(!_0x51edd8){throw new db['Sequelize'][(_0xeba1('0xd5'))](_0xeba1('0xd6'));}_0x1a84ce=_['difference'](_[_0xeba1('0x66')](_0x51edd8),['createdAt',_0xeba1('0xa3'),_0xeba1('0xa5'),_0xeba1('0xa6')]);if(_0x5d6926[_0xeba1('0x69')]['id']){delete _0x5d6926[_0xeba1('0x69')]['id'];}if(_['isNil'](_0x5d6926[_0xeba1('0x69')][_0xeba1('0x9c')])){throw _0x509fb2[_0xeba1('0x24')](0x1f4)[_0xeba1('0x34')](new db[(_0xeba1('0xd7'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xeba1('0x96')](_0x5d6926[_0xeba1('0x69')]['body'])||_0x5d6926[_0xeba1('0x69')][_0xeba1('0x69')]===''){throw _0x509fb2[_0xeba1('0x24')](0x1f4)[_0xeba1('0x34')](new db[(_0xeba1('0xd7'))][(_0xeba1('0xd5'))](_0xeba1('0xd8')));}if(_[_0xeba1('0x96')](_0x5d6926['body'][_0xeba1('0xd9')])){throw _0x509fb2[_0xeba1('0x24')](0x1f4)[_0xeba1('0x34')](new db[(_0xeba1('0xd7'))][(_0xeba1('0xd5'))](_0xeba1('0xda')+_0x1a84ce));}if(!_[_0xeba1('0xa4')](_0x1a84ce,_0x5d6926[_0xeba1('0x69')][_0xeba1('0xd9')])){throw _0x509fb2[_0xeba1('0x24')](0x1f4)[_0xeba1('0x34')](new db[(_0xeba1('0xd7'))][(_0xeba1('0xd5'))](_0xeba1('0xdb')+_0x1a84ce));}_0x488fca[_0x5d6926['body'][_0xeba1('0xd9')]]=_0x5d6926[_0xeba1('0x69')][_0xeba1('0x9c')];})[_0xeba1('0x2d')](function(){return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x5d6926['params']['id']},'include':[{'model':db['CmList'],'as':_0xeba1('0xa9')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xeba1('0x2d')](handleEntityNotFound(_0x509fb2,null))[_0xeba1('0x2d')](function(_0x23370c){if(_0x23370c&&_0x23370c[_0xeba1('0xa9')]){_0x271338=_0x23370c;var _0x4160c0=_[_0xeba1('0xb5')](_0x5d6926[_0xeba1('0x69')],{'firstName':_0x5d6926[_0xeba1('0x69')][_0xeba1('0x9c')],'phone':_0x5d6926[_0xeba1('0x69')]['from'],'ListId':_0x23370c[_0xeba1('0xa6')]});_0x4160c0[_0x5d6926[_0xeba1('0x69')][_0xeba1('0xd9')]]=_0x5d6926[_0xeba1('0x69')][_0xeba1('0x9c')];return db['CmContact'][_0xeba1('0xdc')]({'where':_0x488fca,'defaults':_0x4160c0});}})[_0xeba1('0xdd')](function(_0xabf666){if(_0xabf666){_0x3ea268=_0xabf666;var _0x24d7b4=fs[_0xeba1('0xde')](path[_0xeba1('0x88')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x328f78=ejs[_0xeba1('0xdf')](_0x24d7b4,{'body':_[_0xeba1('0xe0')](_0x5d6926['body'][_0xeba1('0x69')]),'bodyTitle':_0x271338['offlineMessageBody']});return db[_0xeba1('0xe1')]['create']({'body':_0x328f78,'plainBody':htmlToText[_0xeba1('0xe2')](_0x328f78),'ContactId':_0xabf666['id'],'ChatWebsiteId':_0x271338['id']});}})['then'](function(_0x2588c5){_0x4989b9=_0x2588c5;if(_0x382fd9[_0xeba1('0x58')]){var _0xbebbcb=_0x382fd9[_0xeba1('0x4e')](function(_0x492561){return{'name':_0x492561[_0xeba1('0xe3')],'basename':_0x492561[_0xeba1('0x83')],'type':_0x492561[_0xeba1('0xe4')],'ChatOfflineMessageId':_0x2588c5['id']};});_0x47d9b9=_0xbebbcb[_0xeba1('0x4e')](_0x325210=>{var _0x60e077={'filename':_0x325210[_0xeba1('0x33')],'path':path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0xe5'),_0xeba1('0xe6'),_0xeba1('0xe7'),_0xeba1('0xe8'),_0x325210['basename'])};return _0x60e077;});if(!_0x271338[_0xeba1('0xe9')]){return db[_0xeba1('0xea')][_0xeba1('0xeb')](function(_0x28244a){return db[_0xeba1('0xec')]['bulkCreate'](_0xbebbcb,{'transaction':_0x28244a});});}}})[_0xeba1('0x2d')](function(){if(_0x4989b9){_0xd8d5dd=_0x4989b9;return db[_0xeba1('0xed')][_0xeba1('0x78')]({'where':{'service':!![]},'include':[{'model':db[_0xeba1('0xee')],'as':_0xeba1('0xef'),'raw':!![],'include':[{'model':db[_0xeba1('0xf0')],'as':_0xeba1('0xf0'),'raw':!![]}]}]});}})[_0xeba1('0x2d')](function(_0x261f6e){if(_0x261f6e&&_0x261f6e[_0xeba1('0xef')]&&_0x271338[_0xeba1('0xf1')]&&_0x271338[_0xeba1('0xf2')]){var _0x383de0=_0x261f6e[_0xeba1('0xf3')]();return respondWithRpcPromise(_0xeba1('0xf4'),_0xeba1('0xf5'),{'account':_0x383de0,'message':{'from':util[_0xeba1('0x43')](_0xeba1('0xf6'),_0x261f6e['name'],_0x261f6e[_0xeba1('0xf7')]||_0x261f6e[_0xeba1('0xef')][_0xeba1('0x6b')]),'to':_0x271338[_0xeba1('0xf2')],'subject':_0x271338[_0xeba1('0xf8')],'html':_0xd8d5dd['body'],'attachments':_0x47d9b9}},client9003)[_0xeba1('0x2d')](function(){return _0xd8d5dd;})[_0xeba1('0x22')](function(_0x38dc1d){logger[_0xeba1('0x1f')](_0x38dc1d);});}})[_0xeba1('0x2d')](function(){if(_0x271338&&_0x271338[_0xeba1('0xe9')]&&_0x271338[_0xeba1('0xf9')]){var _0x56e79a=[];if(_0x382fd9[_0xeba1('0x58')]){_0x56e79a=_0x382fd9[_0xeba1('0x4e')](function(_0xd9f6c3){return{'name':_0xd9f6c3['originalname'],'basename':_0xd9f6c3['filename'],'type':_0xd9f6c3['mimetype'],'ChatOfflineMessageId':_0x4989b9['id']};});}var _0x3df57b;if(!_[_0xeba1('0x96')](_0x271338[_0xeba1('0xfa')])){var _0x203dec=_[_0xeba1('0x4e')](_0x5d6926[_0xeba1('0x69')],function(_0x1c3145){return _0x1c3145;});var _0x47988b=_[_0xeba1('0xfb')](_0x203dec)[0x0];var _0x299fe0=_[_0xeba1('0xfc')](_0x47988b,function(_0x398d38){return _0x398d38;});_0x3df57b=_0x299fe0[0x1][_0x271338['subjectOffline']];}var _0x520ec0={'from':_0x3ea268[_0xeba1('0xf7')],'firstName':_0x3ea268['firstName'],'lastName':_0x3ea268['lastName'],'mapKey':_0xeba1('0xf7'),'message':{'from':_0x3ea268['email'],'to':_0x271338['MailAccount']['email'],'cc':'','subject':_[_0xeba1('0x96')](_0x3df57b)?_0x271338[_0xeba1('0xf8')]:_0x3df57b,'messageId':'','sentAt':new Date(),'attach':_0x56e79a[_0xeba1('0x58')],'attachments':_0x56e79a,'originChannel':_0xeba1('0xfd'),'ChatWebsiteId':_0x271338['id'],'ChatOfflineMessageId':_0xd8d5dd['id'],'originTo':_0x271338['MailAccount']['email']},'body':_0xd8d5dd[_0xeba1('0x69')]};var _0x1deb82={'account':{'id':_0x271338[_0xeba1('0xf9')]},'body':_0x520ec0,'log':_0xeba1('0xfe')};return respondWithRpcPromise('NotifyMailAccount',_0xeba1('0xff'),_0x1deb82,client9001)[_0xeba1('0x2d')](function(){return _0xd8d5dd;})[_0xeba1('0x22')](function(_0x18ac52){logger['error'](_0x18ac52);});}return;})['then'](function(){if(_0xd8d5dd){return _0xd8d5dd;}})[_0xeba1('0x2d')](respondWithResult(_0x509fb2,null))[_0xeba1('0x22')](function(){for(var _0x284eb6 of _0x382fd9){var _0x45fb86=path['join'](config[_0xeba1('0x8d')],_0xeba1('0xe5'),_0xeba1('0xe6'),_0xeba1('0xe7'),_0xeba1('0xe8'),_0x284eb6[_0xeba1('0x83')]);fs_extra[_0xeba1('0x100')](_0x45fb86)['catch'](function(_0x1713d3){logger[_0xeba1('0x1f')](_0xeba1('0x101'),_0x45fb86,_0x1713d3);});}});};exports[_0xeba1('0x102')]=function(_0x125be7,_0x5340d4){return db['ChatInteraction']['find']({'where':{'id':_0x125be7[_0xeba1('0x65')]['id']}})['then'](handleEntityNotFound(_0x5340d4,null))[_0xeba1('0x2d')](function(_0x4c3a72){if(_0x4c3a72){return _0x4c3a72[_0xeba1('0x102')](_0x125be7['body'][_0xeba1('0x7e')],_[_0xeba1('0x103')](_0x125be7[_0xeba1('0x69')],[_0xeba1('0x7e'),'id'])||{});}})[_0xeba1('0x2d')](respondWithResult(_0x5340d4,null))[_0xeba1('0x22')](handleError(_0x5340d4,null));};exports[_0xeba1('0x104')]=function(_0x3445de,_0x251f15){var _0x7ebf8b={'raw':![],'where':{}};var _0x2d6053={};var _0x431079={'count':0x0,'rows':[]};return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0x3445de['params']['id']}})['then'](handleEntityNotFound(_0x251f15,null))[_0xeba1('0x2d')](function(_0x34fbd5){if(_0x34fbd5){_0x2d6053[_0xeba1('0x47')]=_[_0xeba1('0x66')](db[_0xeba1('0xb8')][_0xeba1('0x50')]);_0x2d6053[_0xeba1('0x53')]=_[_0xeba1('0x66')](_0x3445de[_0xeba1('0x53')]);_0x2d6053[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x2d6053[_0xeba1('0x47')],_0x2d6053['query']);_0x7ebf8b[_0xeba1('0x57')]=_[_0xeba1('0x55')](_0x2d6053['model'],qs[_0xeba1('0x56')](_0x3445de[_0xeba1('0x53')]['fields']));_0x7ebf8b[_0xeba1('0x57')]=_0x7ebf8b[_0xeba1('0x57')][_0xeba1('0x58')]?_0x7ebf8b['attributes']:_0x2d6053[_0xeba1('0x47')];if(!_0x3445de[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x7ebf8b['limit']=qs[_0xeba1('0x2a')](_0x3445de[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x7ebf8b[_0xeba1('0x29')]=qs['offset'](_0x3445de[_0xeba1('0x53')][_0xeba1('0x29')]);}_0x7ebf8b[_0xeba1('0x5b')]=qs['sort'](_0x3445de[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x7ebf8b['where']=qs[_0xeba1('0x54')](_['pick'](_0x3445de[_0xeba1('0x53')],_0x2d6053['filters']));_0x7ebf8b[_0xeba1('0x5d')][_0xeba1('0x7a')]=_0x34fbd5['id'];if(_0x3445de[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x7ebf8b['where']=_[_0xeba1('0x5f')](_0x7ebf8b['where'],{'$or':_[_0xeba1('0x4e')](_0x7ebf8b[_0xeba1('0x57')],function(_0x107f4e){var _0x2d4960={};_0x2d4960[_0x107f4e]={'$like':'%'+_0x3445de['query'][_0xeba1('0x5e')]+'%'};return _0x2d4960;})});}_0x7ebf8b=_[_0xeba1('0x5f')]({},_0x7ebf8b,_0x3445de[_0xeba1('0x7b')]);return db['ChatInteraction'][_0xeba1('0x28')]({'where':_0x7ebf8b[_0xeba1('0x5d')]})['then'](function(_0x4db9bf){_0x431079['count']=_0x4db9bf;if(_0x3445de[_0xeba1('0x53')]['includeAll']){_0x7ebf8b[_0xeba1('0x61')]=[{'model':db[_0xeba1('0xa1')],'as':_0xeba1('0x105'),'required':![]},{'model':db[_0xeba1('0xc8')],'as':_0xeba1('0x106'),'attributes':['name',_0xeba1('0x107'),_0xeba1('0x108')],'required':![]},{'model':db[_0xeba1('0x109')],'as':_0xeba1('0x10a'),'attributes':['id','name',_0xeba1('0x10b')],'where':_0x3445de[_0xeba1('0x53')][_0xeba1('0x10c')]?{'id':_0x3445de[_0xeba1('0x53')][_0xeba1('0x10c')]}:undefined,'required':_0x3445de[_0xeba1('0x53')][_0xeba1('0x10c')]?!![]:![]}];}return db['ChatInteraction'][_0xeba1('0x62')](_0x7ebf8b);})[_0xeba1('0x2d')](function(_0x44610f){_0x431079['rows']=_0x44610f;return _0x431079;});}})[_0xeba1('0x2d')](respondWithFilteredResult(_0x251f15,_0x7ebf8b))[_0xeba1('0x22')](handleError(_0x251f15,null));};exports[_0xeba1('0x10d')]=function(_0x5d3751,_0x35f37f){var _0x537dc0=0x0;var _0x2a6d43=0x0;var _0x230537=![];var _0x536e66;var _0xed78d7;return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x5d3751[_0xeba1('0x65')]['id']},'include':[{'model':db['Interval'],'as':_0xeba1('0x97'),'include':[{'model':db[_0xeba1('0x97')],'as':_0xeba1('0x10e'),'attributes':['id',_0xeba1('0x10f')]}]}]})[_0xeba1('0x2d')](handleEntityNotFound(_0x35f37f,null))[_0xeba1('0x2d')](function(_0x4b9365){if(_0x4b9365){_0x536e66=_0x4b9365;return _0x4b9365[_0xeba1('0x110')]({'raw':!![]});}})['then'](function(_0x50ee6){if(_0x536e66){if(_0x50ee6){_0xed78d7=_0x50ee6;}}return require(_0xeba1('0x111'))[_0xeba1('0x8a')]();})[_0xeba1('0x2d')](function(_0x4e7e56){if(_0x4e7e56){_0x2a6d43=_0x4e7e56[_0xeba1('0x112')];_0x230537=_0x4e7e56[_0xeba1('0x113')];}})[_0xeba1('0x2d')](function(){return db[_0xeba1('0xb8')][_0xeba1('0x28')]({'where':{'closed':![]}});})[_0xeba1('0x2d')](function(_0x21bd2d){_0x537dc0=_0x21bd2d;if(_0x2a6d43&&_0x21bd2d>_0x2a6d43){return db[_0xeba1('0x114')][_0xeba1('0x78')]({'where':{'id':0x1}})[_0xeba1('0x2d')](function(_0x24bb78){if(_0x24bb78){_0x24bb78[_0xeba1('0x115')](_0xeba1('0x116'));}});}})[_0xeba1('0x2d')](function(){var _0x93ded7=_0x536e66[_0xeba1('0x97')];var _0xa473cc=_0x536e66[_0xeba1('0x99')]||undefined;return _0x93ded7?_0x93ded7[_0xeba1('0x9a')](_0xa473cc):!![];})[_0xeba1('0x2d')](function(_0x49221c){var _0x3d0713=fs[_0xeba1('0xde')](path[_0xeba1('0x88')](config[_0xeba1('0x8d')],_0xeba1('0x117')),'utf8');var _0x40e3c3=_0xeba1('0x118');var _0x1b136f=![];var _0x2f4980,_0x1573ef;if(_0x5d3751[_0xeba1('0xb6')][_0xeba1('0x40')]){_0x2f4980=new URL(_0x5d3751['headers'][_0xeba1('0x40')])[_0xeba1('0x119')];}else if(_0x5d3751['headers'][_0xeba1('0x119')]){_0x2f4980=new URL(_0x5d3751[_0xeba1('0xb6')][_0xeba1('0x119')])[_0xeba1('0x119')];}else{_0x2f4980=_0xeba1('0x11a');}_0x1573ef=typeof _0x536e66[_0xeba1('0x72')]['split'](',')[_0xeba1('0x67')](function(_0x43114f){return wildcardUtils[_0xeba1('0x11b')](_0x43114f,_0x2f4980);})!=='undefined';var _0x2dda3e={'chatVersion':_0x40e3c3,'chatWebsiteAddressOrigin':_0x1573ef?_0x2f4980:_0x536e66[_0xeba1('0x72')],'remote':_0x536e66[_0xeba1('0x11c')],'query':querystring['stringify'](_[_0xeba1('0x5f')](_0x536e66[_0xeba1('0x2f')]({'plain':!![]}),{'customerIp':_0x5d3751[_0xeba1('0xb6')][_0xeba1('0x3b')]||_0x5d3751[_0xeba1('0xb6')]['x-real-ip']||_0x5d3751[_0xeba1('0x11d')]['remoteAddress']||_0x5d3751['ip'],'referer':_0x5d3751[_0xeba1('0xb6')][_0xeba1('0x40')],'openedInteractions':_0x537dc0,'maxInteractions':_0x2a6d43,'virtual':_0x230537['virtual'],'online':_0x49221c,'custom':_0x230537,'address':_0x1573ef?_0x2f4980:null}))[_0xeba1('0x11e')](/'/g,'\x5c\x27')};_0x35f37f['send'](ejs[_0xeba1('0xdf')](Mustache[_0xeba1('0xdf')](_0x3d0713,_0x2dda3e),{'proactiveActions':_0xed78d7,'alignment':_0x536e66[_0xeba1('0x11f')],'verticalAlignment':_0x536e66['verticalAlignment'],'div_color':_0x536e66[_0xeba1('0x10b')],'labelText':_0x536e66[_0xeba1('0x120')],'text_color':_0x536e66[_0xeba1('0x121')],'text_button_color':_0x536e66[_0xeba1('0x122')],'button_color':_0x536e66['color_button'],'background_color':_0x536e66[_0xeba1('0x123')],'hideWhenOffline':_0x536e66[_0xeba1('0x124')],'intervalId':_0x536e66[_0xeba1('0x125')],'isDevelopment':_0x1b136f,'chatVersion':_0x40e3c3}));})[_0xeba1('0x22')](handleError(_0x35f37f,null));};exports[_0xeba1('0x126')]=function(_0x57fc12,_0x2527ae){var _0x4f2a9e=_0x57fc12[_0xeba1('0x65')]['id'];var _0x417ae2=_0x57fc12[_0xeba1('0x69')];var _0x4bedaa=0xc8;var _0x5f6b6e=null;return db[_0xeba1('0xea')][_0xeba1('0xeb')]({'isolationLevel':db[_0xeba1('0xea')][_0xeba1('0x127')][_0xeba1('0x128')]['READ_COMMITTED']},function(_0xba278a){return db['ChatWebsite']['findOne']({'where':{'id':_0x4f2a9e},'transaction':_0xba278a})[_0xeba1('0x2d')](function(_0x4078d1){if(_0x4078d1){return db['ChatApplication'][_0xeba1('0x2e')]({'where':{'ChatWebsiteId':_0x4f2a9e},'transaction':_0xba278a})[_0xeba1('0x2d')](function(){var _0x43d15b=_[_0xeba1('0x4e')](_0x417ae2,function(_0x4f69c9){_0x4f69c9[_0xeba1('0x7a')]=_0x4f2a9e;return _0x4f69c9;});return db[_0xeba1('0xac')][_0xeba1('0x129')](_0x43d15b,{'transaction':_0xba278a});});}else{_0x4bedaa=0x194;_0x5f6b6e=[];}});})['then'](function(){if(_0x4bedaa!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x4f2a9e},'order':_0xeba1('0xb2')})['then'](function(_0x2103ba){_0x5f6b6e=_0x2103ba;});}})[_0xeba1('0x22')](function(_0x1e4945){_0x4bedaa=0x1f4;logger[_0xeba1('0x1f')](_0x1e4945['stack']);if(_0x1e4945['name']){delete _0x1e4945[_0xeba1('0x33')];}_0x5f6b6e=_0x1e4945;})['finally'](function(){if(_0x5f6b6e===null){_0x2527ae[_0xeba1('0x23')](_0x4bedaa);}else{if(_0x4bedaa===0x1f4){_0x2527ae[_0xeba1('0x24')](_0x4bedaa)[_0xeba1('0x34')](_0x5f6b6e);}else{_0x2527ae[_0xeba1('0x24')](_0x4bedaa)[_0xeba1('0x26')](_0x5f6b6e);}}});};exports[_0xeba1('0x12a')]=function(_0x3973d9,_0x43502a){var _0x53b16f={};var _0x1ad176={};var _0x3f6773;var _0x740bad;return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0x3973d9[_0xeba1('0x65')]['id']}})['then'](handleEntityNotFound(_0x43502a,null))[_0xeba1('0x2d')](function(_0x105b47){if(_0x105b47){_0x3f6773=_0x105b47;_0x1ad176[_0xeba1('0x47')]=_['keys'](db[_0xeba1('0xac')][_0xeba1('0x50')]);_0x1ad176[_0xeba1('0x53')]=_[_0xeba1('0x66')](_0x3973d9[_0xeba1('0x53')]);_0x1ad176[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x1ad176[_0xeba1('0x47')],_0x1ad176[_0xeba1('0x53')]);_0x53b16f[_0xeba1('0x57')]=_[_0xeba1('0x55')](_0x1ad176[_0xeba1('0x47')],qs[_0xeba1('0x56')](_0x3973d9[_0xeba1('0x53')][_0xeba1('0x56')]));_0x53b16f[_0xeba1('0x57')]=_0x53b16f[_0xeba1('0x57')][_0xeba1('0x58')]?_0x53b16f[_0xeba1('0x57')]:_0x1ad176[_0xeba1('0x47')];_0x53b16f[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x3973d9[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x53b16f[_0xeba1('0x5d')]=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0x3973d9[_0xeba1('0x53')],_0x1ad176[_0xeba1('0x54')]));if(_0x3973d9[_0xeba1('0x53')]['filter']){_0x53b16f[_0xeba1('0x5d')]=_[_0xeba1('0x5f')](_0x53b16f['where'],{'$or':_[_0xeba1('0x4e')](_0x53b16f[_0xeba1('0x57')],function(_0x315c80){var _0x329c46={};_0x329c46[_0x315c80]={'$like':'%'+_0x3973d9[_0xeba1('0x53')][_0xeba1('0x5e')]+'%'};return _0x329c46;})});}_0x53b16f=_[_0xeba1('0x5f')]({},_0x53b16f,_0x3973d9[_0xeba1('0x7b')]);return _0x3f6773['getApplications'](_0x53b16f);}})[_0xeba1('0x2d')](function(_0x175782){if(_0x175782){_0x740bad=_0x175782[_0xeba1('0x58')];if(!_0x3973d9[_0xeba1('0x53')]['hasOwnProperty'](_0xeba1('0x5a'))){_0x53b16f['limit']=qs['limit'](_0x3973d9[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x53b16f[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0x3973d9[_0xeba1('0x53')][_0xeba1('0x29')]);}return _0x3f6773['getApplications'](_0x53b16f);}})[_0xeba1('0x2d')](function(_0x2407b4){if(_0x2407b4){return _0x2407b4?{'count':_0x740bad,'rows':_0x2407b4}:null;}})[_0xeba1('0x2d')](respondWithResult(_0x43502a,null))[_0xeba1('0x22')](handleError(_0x43502a,null));};exports[_0xeba1('0x12b')]=function(_0x5b0d79,_0x509138){return db[_0xeba1('0x12c')]['find']({'where':{'id':_0x5b0d79[_0xeba1('0x65')]['id']}})['then'](handleEntityNotFound(_0x509138,null))[_0xeba1('0x2d')](function(_0x1f9ac3){if(_0x1f9ac3){return _0x1f9ac3[_0xeba1('0x12b')](_0x5b0d79['body']['ids'],_[_0xeba1('0x103')](_0x5b0d79[_0xeba1('0x69')],[_0xeba1('0x7e'),'id'])||{});}})[_0xeba1('0x2d')](respondWithResult(_0x509138,null))[_0xeba1('0x22')](handleError(_0x509138,null));};exports[_0xeba1('0x110')]=function(_0x217a82,_0x2dfcc9){var _0x293dc2={};var _0x40f199={};var _0x39a0b8;var _0x16b8de;return db['ChatWebsite'][_0xeba1('0x78')]({'where':{'id':_0x217a82[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x2dfcc9,null))['then'](function(_0x162ab2){if(_0x162ab2){_0x39a0b8=_0x162ab2;_0x40f199[_0xeba1('0x47')]=_[_0xeba1('0x66')](db[_0xeba1('0x12d')][_0xeba1('0x50')]);_0x40f199['query']=_[_0xeba1('0x66')](_0x217a82['query']);_0x40f199[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x40f199[_0xeba1('0x47')],_0x40f199['query']);_0x293dc2[_0xeba1('0x57')]=_['intersection'](_0x40f199['model'],qs['fields'](_0x217a82['query'][_0xeba1('0x56')]));_0x293dc2[_0xeba1('0x57')]=_0x293dc2[_0xeba1('0x57')]['length']?_0x293dc2[_0xeba1('0x57')]:_0x40f199[_0xeba1('0x47')];_0x293dc2[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x217a82['query'][_0xeba1('0x5c')]);_0x293dc2['where']=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0x217a82['query'],_0x40f199[_0xeba1('0x54')]));if(_0x217a82[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x293dc2[_0xeba1('0x5d')]=_['merge'](_0x293dc2[_0xeba1('0x5d')],{'$or':_[_0xeba1('0x4e')](_0x293dc2['attributes'],function(_0x4bd7bd){var _0x25d044={};_0x25d044[_0x4bd7bd]={'$like':'%'+_0x217a82['query'][_0xeba1('0x5e')]+'%'};return _0x25d044;})});}_0x293dc2=_[_0xeba1('0x5f')]({},_0x293dc2,_0x217a82[_0xeba1('0x7b')]);return _0x39a0b8['getProactiveActions'](_0x293dc2);}})[_0xeba1('0x2d')](function(_0x299586){if(_0x299586){_0x16b8de=_0x299586[_0xeba1('0x58')];if(!_0x217a82[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x293dc2[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0x217a82['query'][_0xeba1('0x2a')]);_0x293dc2[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0x217a82[_0xeba1('0x53')][_0xeba1('0x29')]);}return _0x39a0b8[_0xeba1('0x110')](_0x293dc2);}})[_0xeba1('0x2d')](function(_0x4ad44a){if(_0x4ad44a){return _0x4ad44a?{'count':_0x16b8de,'rows':_0x4ad44a}:null;}})[_0xeba1('0x2d')](respondWithResult(_0x2dfcc9,null))[_0xeba1('0x22')](handleError(_0x2dfcc9,null));};exports[_0xeba1('0x12e')]=function(_0x165645,_0x3c6947){var _0x40d115=_0x165645['query']['online']===_0xeba1('0x12f')?_0xeba1('0x130'):_0xeba1('0x131');return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'attributes':['id',_0x40d115],'where':{'id':_0x165645[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x3c6947,null))['then'](function(_0x23bd47){if(_0x23bd47){var _0x144942=_0x23bd47[_0x40d115];var _0x3e573f=_0x144942&&_0x144942[_0xeba1('0x132')]?_0x144942[_0xeba1('0x132')]:[];_0x3c6947[_0xeba1('0x34')]({'fromKey':_[_0xeba1('0x96')](_0x144942[_0xeba1('0x133')])?undefined:_0x144942[_0xeba1('0x133')],'count':_0x3e573f[_0xeba1('0x58')],'rows':_0x3e573f});}})['catch'](handleError(_0x3c6947,null));};exports[_0xeba1('0x134')]=function(_0x116a7d,_0x68485a){var _0x47bdf8={'raw':![],'where':{}};var _0x83cb3b={};var _0x3204f1={'count':0x0,'rows':[]};return db[_0xeba1('0x4f')][_0xeba1('0x78')]({'where':{'id':_0x116a7d[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x68485a,null))['then'](function(_0x1c62f9){if(_0x1c62f9){_0x83cb3b[_0xeba1('0x47')]=_['keys'](db[_0xeba1('0xe1')][_0xeba1('0x50')]);_0x83cb3b['query']=_[_0xeba1('0x66')](_0x116a7d[_0xeba1('0x53')]);_0x83cb3b[_0xeba1('0x54')]=_[_0xeba1('0x55')](_0x83cb3b[_0xeba1('0x47')],_0x83cb3b[_0xeba1('0x53')]);_0x47bdf8[_0xeba1('0x57')]=_[_0xeba1('0x55')](_0x83cb3b[_0xeba1('0x47')],qs['fields'](_0x116a7d['query'][_0xeba1('0x56')]));_0x47bdf8[_0xeba1('0x57')]=_0x47bdf8['attributes'][_0xeba1('0x58')]?_0x47bdf8['attributes']:_0x83cb3b[_0xeba1('0x47')];if(!_0x116a7d[_0xeba1('0x53')]['hasOwnProperty']('nolimit')){_0x47bdf8[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0x116a7d[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x47bdf8[_0xeba1('0x29')]=qs['offset'](_0x116a7d[_0xeba1('0x53')][_0xeba1('0x29')]);}_0x47bdf8[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x116a7d[_0xeba1('0x53')]['sort']);_0x47bdf8[_0xeba1('0x5d')]=qs[_0xeba1('0x54')](_[_0xeba1('0x79')](_0x116a7d[_0xeba1('0x53')],_0x83cb3b[_0xeba1('0x54')]));_0x47bdf8[_0xeba1('0x5d')][_0xeba1('0x7a')]=_0x1c62f9['id'];if(_0x116a7d[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x47bdf8[_0xeba1('0x5d')]=_[_0xeba1('0x5f')](_0x47bdf8[_0xeba1('0x5d')],{'$or':_[_0xeba1('0x4e')](_0x47bdf8[_0xeba1('0x57')],function(_0x10d65d){var _0x7ffee9={};_0x7ffee9[_0x10d65d]={'$like':'%'+_0x116a7d[_0xeba1('0x53')][_0xeba1('0x5e')]+'%'};return _0x7ffee9;})});}_0x47bdf8=_[_0xeba1('0x5f')]({},_0x47bdf8,_0x116a7d['options']);return db[_0xeba1('0xe1')][_0xeba1('0x28')]({'where':_0x47bdf8[_0xeba1('0x5d')]})[_0xeba1('0x2d')](function(_0x17dd4f){_0x3204f1['count']=_0x17dd4f;if(_0x116a7d[_0xeba1('0x53')]['includeAll']){_0x47bdf8[_0xeba1('0x61')]=[{'all':!![]}];}else{_0x47bdf8['include']=[{'model':db[_0xeba1('0xa1')],'as':_0xeba1('0x105'),'required':![]},{'model':db[_0xeba1('0xec')],'as':_0xeba1('0x135'),'required':![]}];}return db[_0xeba1('0xe1')][_0xeba1('0x62')](_0x47bdf8);})[_0xeba1('0x2d')](function(_0x15fdb){_0x3204f1[_0xeba1('0x63')]=_0x15fdb;return _0x3204f1;});}})[_0xeba1('0x2d')](respondWithFilteredResult(_0x68485a,_0x47bdf8))[_0xeba1('0x22')](handleError(_0x68485a,null));};exports[_0xeba1('0x136')]=function(_0x4b6ecf,_0x1be543){return db['ChatWebsite'][_0xeba1('0x67')]({'where':{'id':_0x4b6ecf[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x1be543,null))[_0xeba1('0x2d')](function(_0x5b50ef){if(_0x5b50ef){return _0x5b50ef['addAgents'](_0x4b6ecf[_0xeba1('0x69')][_0xeba1('0x7e')],_['omit'](_0x4b6ecf['body'],[_0xeba1('0x7e'),'id'])||{})['spread'](function(_0x1574d3){for(var _0x5c4f9e=0x0;_0x5c4f9e<_0x4b6ecf[_0xeba1('0x69')][_0xeba1('0x7e')][_0xeba1('0x58')];_0x5c4f9e+=0x1){socket['emit'](_0xeba1('0x137'),{'UserId':Number(_0x4b6ecf[_0xeba1('0x69')]['ids'][_0x5c4f9e]),'ChatWebsiteId':Number(_0x4b6ecf[_0xeba1('0x65')]['id'])});}return _0x1574d3;});}})[_0xeba1('0x2d')](respondWithResult(_0x1be543,null))[_0xeba1('0x22')](handleError(_0x1be543,null));};exports[_0xeba1('0x138')]=function(_0x3d4af6,_0x50ecb4){return db[_0xeba1('0x4f')][_0xeba1('0x67')]({'where':{'id':_0x3d4af6[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x50ecb4,null))['then'](function(_0x34c28d){if(_0x34c28d){return _0x34c28d[_0xeba1('0x138')](_0x3d4af6[_0xeba1('0x53')][_0xeba1('0x7e')])[_0xeba1('0x2d')](function(){if(_[_0xeba1('0x139')](_0x3d4af6['query'][_0xeba1('0x7e')])){for(var _0x2238b2=0x0;_0x2238b2<_0x3d4af6[_0xeba1('0x53')][_0xeba1('0x7e')]['length'];_0x2238b2+=0x1){socket['emit'](_0xeba1('0x13a'),{'UserId':Number(_0x3d4af6[_0xeba1('0x53')][_0xeba1('0x7e')][_0x2238b2]),'ChatWebsiteId':Number(_0x3d4af6[_0xeba1('0x65')]['id'])});}}else{socket[_0xeba1('0x13b')](_0xeba1('0x13a'),{'UserId':Number(_0x3d4af6[_0xeba1('0x53')][_0xeba1('0x7e')]),'ChatWebsiteId':Number(_0x3d4af6['params']['id'])});}});}})[_0xeba1('0x2d')](respondWithStatusCode(_0x50ecb4,null))[_0xeba1('0x22')](handleError(_0x50ecb4,null));};exports['getAgents']=function(_0x2fad96,_0x4fa65b){var _0x5f3181={};var _0x14188b={};var _0x58992d;var _0x299140;return db['ChatWebsite'][_0xeba1('0x78')]({'where':{'id':_0x2fad96[_0xeba1('0x65')]['id']}})[_0xeba1('0x2d')](handleEntityNotFound(_0x4fa65b,null))[_0xeba1('0x2d')](function(_0x2f58e8){if(_0x2f58e8){_0x58992d=_0x2f58e8;_0x14188b[_0xeba1('0x47')]=_['keys'](db['User'][_0xeba1('0x50')]);_0x14188b[_0xeba1('0x53')]=_['keys'](_0x2fad96[_0xeba1('0x53')]);_0x14188b[_0xeba1('0x54')]=_['intersection'](_0x14188b[_0xeba1('0x47')],_0x14188b[_0xeba1('0x53')]);_0x5f3181[_0xeba1('0x57')]=_['intersection'](_0x14188b[_0xeba1('0x47')],qs[_0xeba1('0x56')](_0x2fad96[_0xeba1('0x53')][_0xeba1('0x56')]));_0x5f3181[_0xeba1('0x57')]=_0x5f3181[_0xeba1('0x57')][_0xeba1('0x58')]?_0x5f3181[_0xeba1('0x57')]:_0x14188b['model'];_0x5f3181[_0xeba1('0x5b')]=qs[_0xeba1('0x5c')](_0x2fad96[_0xeba1('0x53')][_0xeba1('0x5c')]);_0x5f3181['where']=qs[_0xeba1('0x54')](_['pick'](_0x2fad96[_0xeba1('0x53')],_0x14188b[_0xeba1('0x54')]));if(_0x2fad96[_0xeba1('0x53')][_0xeba1('0x5e')]){_0x5f3181['where']=_[_0xeba1('0x5f')](_0x5f3181['where'],{'$or':_[_0xeba1('0x4e')](_0x5f3181[_0xeba1('0x57')],function(_0x231b68){var _0x265cbe={};_0x265cbe[_0x231b68]={'$like':'%'+_0x2fad96[_0xeba1('0x53')]['filter']+'%'};return _0x265cbe;})});}_0x5f3181=_[_0xeba1('0x5f')]({},_0x5f3181,_0x2fad96[_0xeba1('0x7b')]);return _0x58992d[_0xeba1('0x13c')](_0x5f3181);}})[_0xeba1('0x2d')](function(_0x328a68){if(_0x328a68){_0x299140=_0x328a68[_0xeba1('0x58')];if(!_0x2fad96[_0xeba1('0x53')][_0xeba1('0x59')](_0xeba1('0x5a'))){_0x5f3181[_0xeba1('0x2a')]=qs[_0xeba1('0x2a')](_0x2fad96[_0xeba1('0x53')][_0xeba1('0x2a')]);_0x5f3181[_0xeba1('0x29')]=qs[_0xeba1('0x29')](_0x2fad96['query']['offset']);}return _0x58992d[_0xeba1('0x13c')](_0x5f3181);}})[_0xeba1('0x2d')](function(_0x210f8e){if(_0x210f8e){return _0x210f8e?{'count':_0x299140,'rows':_0x210f8e}:null;}})['then'](respondWithResult(_0x4fa65b,null))['catch'](handleError(_0x4fa65b,null));}; \ No newline at end of file +var _0x6715=['forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','MailAccountId','subjectOffline','toPairsIn','mapValues','lastName','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Owner','fullname','internal','Tag','color','tag','getProactiveActions','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.12.2','origin','headers','http://localhost:9000','testWebsiteWithWildcard','remote','connection','virtual','alignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','url','URL','redis','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','status','end','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','ChatWebsites','sendStatus','stack','name','send','user-agent-parser','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','stringify','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','params','describe','Disposition','getDispositions','order','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','download','server/files/images/avatars/customer_avatar.png','server/files/images/avatars/','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','ifTime','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','customerIp','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','List','CmContact','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','list','Contacts','defaults','contact','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','EventManager','files','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','basename','transaction','Attachment','MailServerOut','Smtp','CloudProvider'];(function(_0x5313c4,_0x2d2377){var _0xee704d=function(_0x53ef55){while(--_0x53ef55){_0x5313c4['push'](_0x5313c4['shift']());}};_0xee704d(++_0x2d2377);}(_0x6715,0x179));var _0x5671=function(_0x4639e7,_0x54f36f){_0x4639e7=_0x4639e7-0x0;var _0x555eb4=_0x6715[_0x4639e7];return _0x555eb4;};'use strict';var Mustache=require(_0x5671('0x0'));var util=require(_0x5671('0x1'));var path=require(_0x5671('0x2'));var ejs=require(_0x5671('0x3'));var fs=require('fs');var fs_extra=require(_0x5671('0x4'));var _=require(_0x5671('0x5'));var querystring=require(_0x5671('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x5671('0x7'));var jayson=require('jayson/promise');var qs=require(_0x5671('0x8'));var logger=require('../../config/logger')(_0x5671('0x9'));var config=require(_0x5671('0xa'));var APIBadRequestError=require(_0x5671('0xb'))[_0x5671('0xc')];var APINotFoundError=require(_0x5671('0xb'))[_0x5671('0xd')];var APIOutOfIntervalError=require(_0x5671('0xb'))[_0x5671('0xe')];var APIHandleError=require(_0x5671('0xb'))['handleError'];var APIConflictError=require(_0x5671('0xb'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0x5671('0xf'))[_0x5671('0x10')];var db=require('../../mysqldb')['db'];config[_0x5671('0x11')]=_['defaults'](config['redis'],{'host':_0x5671('0x12'),'port':0x18eb});var socket=require(_0x5671('0x13'))(new Redis(config[_0x5671('0x11')]));require(_0x5671('0x14'))['register'](socket);var client=jayson[_0x5671('0x15')][_0x5671('0x16')]({'port':0x232c});var client9002=jayson[_0x5671('0x15')]['http']({'port':0x232a});var client9003=jayson['client'][_0x5671('0x16')]({'port':0x232b});var client9001=jayson[_0x5671('0x15')][_0x5671('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x5bf1a7,_0x10a7c2,_0x3bc87c,_0x3ba2ac){return new Promise(function(_0x3e179b,_0xbae66d){var _0x351336=_0x3ba2ac||client;return _0x351336[_0x5671('0x17')](_0x5bf1a7,_0x3bc87c)['then'](function(_0x544e92){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x10a7c2,_0x5671('0x18'));logger['debug'](_0x5671('0x19'),_0x10a7c2,_0x5671('0x18'),JSON['stringify'](_0x544e92));if(_0x544e92[_0x5671('0x1a')]){if(_0x544e92[_0x5671('0x1a')][_0x5671('0x1b')]===0x1f4){logger[_0x5671('0x1a')](_0x5671('0x1c'),_0x10a7c2,_0x544e92['error'][_0x5671('0x1d')]);return _0xbae66d(_0x544e92['error'][_0x5671('0x1d')]);}logger['error'](_0x5671('0x1c'),_0x10a7c2,_0x544e92[_0x5671('0x1a')][_0x5671('0x1d')]);return _0x3e179b(_0x544e92['error'][_0x5671('0x1d')]);}else{logger[_0x5671('0x1e')](_0x5671('0x1c'),_0x10a7c2,'request\x20sent');_0x3e179b(_0x544e92[_0x5671('0x1f')][_0x5671('0x1d')]);}})[_0x5671('0x20')](function(_0x3c15fa){logger[_0x5671('0x1a')](_0x5671('0x1c'),_0x10a7c2,_0x3c15fa);_0xbae66d(_0x3c15fa);});});}function respondWithStatusCode(_0x84162f,_0x5a9124){_0x5a9124=_0x5a9124||0xcc;return function(_0x176aa3){if(_0x176aa3){return _0x84162f['sendStatus'](_0x5a9124);}return _0x84162f[_0x5671('0x21')](_0x5a9124)[_0x5671('0x22')]();};}function respondWithResult(_0x3ed0ab,_0x446051){_0x446051=_0x446051||0xc8;return function(_0x3eb750){if(_0x3eb750){return _0x3ed0ab[_0x5671('0x21')](_0x446051)[_0x5671('0x23')](_0x3eb750);}};}function respondWithFilteredResult(_0x3a0152,_0x2756d5){return function(_0x5ed665){if(_0x5ed665){var _0xb455be=typeof _0x2756d5['offset']==='undefined'&&typeof _0x2756d5[_0x5671('0x24')]===_0x5671('0x25');var _0x4411dd=_0x5ed665[_0x5671('0x26')];var _0xb2107f=_0xb455be?0x0:_0x2756d5[_0x5671('0x27')];var _0x9d66b4=_0xb455be?_0x5ed665['count']:_0x2756d5['offset']+_0x2756d5['limit'];var _0x4661e1;if(_0x9d66b4>=_0x4411dd){_0x9d66b4=_0x4411dd;_0x4661e1=0xc8;}else{_0x4661e1=0xce;}_0x3a0152['status'](_0x4661e1);return _0x3a0152[_0x5671('0x28')](_0x5671('0x29'),_0xb2107f+'-'+_0x9d66b4+'/'+_0x4411dd)['json'](_0x5ed665);}return null;};}function saveUpdates(_0x3d7f91){return function(_0x4c54b7){if(_0x4c54b7){return _0x4c54b7[_0x5671('0x2a')](_0x3d7f91)[_0x5671('0x2b')](function(_0x317c73){return _0x317c73;});}return null;};}function removeEntity(_0x16a92d){return function(_0x57afe0){if(_0x57afe0){return _0x57afe0[_0x5671('0x2c')]()[_0x5671('0x2b')](function(){var _0x54fc76=_0x57afe0['get']({'plain':!![]});var _0x2d33de=_0x5671('0x2d');return db['UserProfileResource'][_0x5671('0x2c')]({'where':{'type':_0x2d33de,'resourceId':_0x54fc76['id']}})[_0x5671('0x2b')](function(){return _0x57afe0;});})[_0x5671('0x2b')](function(){_0x16a92d[_0x5671('0x21')](0xcc)[_0x5671('0x22')]();});}};}function handleEntityNotFound(_0x55da73){return function(_0x94c4a6){if(!_0x94c4a6){_0x55da73[_0x5671('0x2e')](0x194);}return _0x94c4a6;};}function handleError(_0x22f4e1,_0x56aeea){_0x56aeea=_0x56aeea||0x1f4;return function(_0x558c3f){logger[_0x5671('0x1a')](_0x558c3f[_0x5671('0x2f')]);if(_0x558c3f[_0x5671('0x30')]){delete _0x558c3f[_0x5671('0x30')];}_0x22f4e1[_0x5671('0x21')](_0x56aeea)[_0x5671('0x31')](_0x558c3f);};}function createInteractionObject(_0x5ddcb0,_0x36b507,_0xc74181,_0x1df606){var _0x3bd0e2=require(_0x5671('0x32'));var _0x1a05f7=new _0x3bd0e2();var _0x74b1f3=_0x1a05f7['setUA'](_0xc74181[_0x5671('0x33')])[_0x5671('0x34')]();var _0x63fc1=_0x36b507['customerIp'];if(_0xc74181[_0x5671('0x35')]){_0x63fc1=_0xc74181[_0x5671('0x35')];}else if(_0xc74181[_0x5671('0x36')]){_0x63fc1=_[_0x5671('0x37')](_0xc74181[_0x5671('0x36')][_0x5671('0x38')](','));}return{'ContactId':_0x1df606['id'],'ChatWebsiteId':_0x5ddcb0,'from':(_0x1df606[_0x5671('0x39')]||'')+'\x20'+(_0x1df606['lastName']||''),'customerIp':_0x63fc1,'customerPort':_0xc74181[_0x5671('0x3a')]?_0xc74181[_0x5671('0x3a')]:null,'referer':_0x36b507[_0x5671('0x3b')],'browserName':_0x74b1f3[_0x5671('0x3c')][_0x5671('0x30')]&&_0x74b1f3['browser'][_0x5671('0x3d')]?util[_0x5671('0x3e')](_0x5671('0x3f'),_0x74b1f3[_0x5671('0x3c')][_0x5671('0x30')],_0x74b1f3[_0x5671('0x3c')][_0x5671('0x3d')]):_0x5671('0x40'),'browserVersion':_0x74b1f3[_0x5671('0x3c')][_0x5671('0x3d')]||_0x5671('0x40'),'osName':util[_0x5671('0x3e')](_0x5671('0x3f'),_0x74b1f3['os']['name'],_0x74b1f3['os'][_0x5671('0x3d')]),'osVersion':_0x74b1f3['os']['version'],'deviceModel':_0x74b1f3[_0x5671('0x41')][_0x5671('0x42')]&&_0x74b1f3[_0x5671('0x41')][_0x5671('0x43')]?util[_0x5671('0x3e')](_0x5671('0x44'),_0x74b1f3[_0x5671('0x41')][_0x5671('0x42')],_0x74b1f3[_0x5671('0x41')][_0x5671('0x43')],_0x74b1f3[_0x5671('0x41')]['type']):null,'deviceVendor':_0x74b1f3[_0x5671('0x41')]['vendor'],'deviceType':_0x74b1f3['device']['type'],'formData':JSON[_0x5671('0x45')](_0x36b507)};}exports[_0x5671('0x46')]=function(_0x1bf367,_0x1faca2){var _0x3fa4db={'include':[{'model':db[_0x5671('0x47')],'as':_0x5671('0x48')}]},_0x4dbb4f={},_0x47d23b={'count':0x0,'rows':[]};var _0x323408=_[_0x5671('0x49')](db[_0x5671('0x4a')][_0x5671('0x4b')],function(_0x3be19e){return{'name':_0x3be19e[_0x5671('0x4c')],'type':_0x3be19e[_0x5671('0x4d')]['key']};});_0x4dbb4f[_0x5671('0x42')]=_[_0x5671('0x49')](_0x323408,'name');_0x4dbb4f[_0x5671('0x4e')]=_[_0x5671('0x4f')](_0x1bf367['query']);_0x4dbb4f['filters']=_[_0x5671('0x50')](_0x4dbb4f[_0x5671('0x42')],_0x4dbb4f[_0x5671('0x4e')]);_0x3fa4db[_0x5671('0x51')]=_['intersection'](_0x4dbb4f[_0x5671('0x42')],qs[_0x5671('0x52')](_0x1bf367[_0x5671('0x4e')]['fields']));_0x3fa4db[_0x5671('0x51')]=_0x3fa4db[_0x5671('0x51')][_0x5671('0x53')]?_0x3fa4db[_0x5671('0x51')]:_0x4dbb4f[_0x5671('0x42')];if(!_0x1bf367[_0x5671('0x4e')][_0x5671('0x54')](_0x5671('0x55'))){_0x3fa4db[_0x5671('0x24')]=qs[_0x5671('0x24')](_0x1bf367[_0x5671('0x4e')][_0x5671('0x24')]);_0x3fa4db[_0x5671('0x27')]=qs['offset'](_0x1bf367['query'][_0x5671('0x27')]);}_0x3fa4db['order']=qs[_0x5671('0x56')](_0x1bf367['query'][_0x5671('0x56')]);_0x3fa4db[_0x5671('0x57')]=qs[_0x5671('0x58')](_['pick'](_0x1bf367[_0x5671('0x4e')],_0x4dbb4f['filters']),_0x323408);if(_0x1bf367[_0x5671('0x4e')][_0x5671('0x59')]){_0x3fa4db[_0x5671('0x57')]=_[_0x5671('0x5a')](_0x3fa4db[_0x5671('0x57')],{'$or':_['map'](_0x323408,function(_0x529a12){if(_0x529a12[_0x5671('0x4d')]!==_0x5671('0x5b')){var _0x5c23cf={};_0x5c23cf[_0x529a12['name']]={'$like':'%'+_0x1bf367[_0x5671('0x4e')][_0x5671('0x59')]+'%'};return _0x5c23cf;}})});}_0x3fa4db=_['merge']({},_0x3fa4db,_0x1bf367[_0x5671('0x5c')]);var _0x1406d4={'where':_0x3fa4db[_0x5671('0x57')]};return db[_0x5671('0x4a')][_0x5671('0x26')](_0x1406d4)[_0x5671('0x2b')](function(_0x286757){_0x47d23b['count']=_0x286757;if(_0x1bf367[_0x5671('0x4e')][_0x5671('0x5d')]){_0x3fa4db[_0x5671('0x5e')]=[{'all':!![]}];}return db[_0x5671('0x4a')][_0x5671('0x5f')](_0x3fa4db);})[_0x5671('0x2b')](function(_0x121112){_0x47d23b[_0x5671('0x60')]=_0x121112;return _0x47d23b;})[_0x5671('0x2b')](respondWithFilteredResult(_0x1faca2,_0x3fa4db))[_0x5671('0x20')](handleError(_0x1faca2,null));};exports['show']=function(_0x163423,_0x410569){var _0x5cf71d={'raw':![],'where':{'id':_0x163423['params']['id']},'include':[{'model':db[_0x5671('0x47')],'as':_0x5671('0x48')}]},_0x2febe0={};_0x2febe0[_0x5671('0x42')]=_[_0x5671('0x4f')](db[_0x5671('0x4a')]['rawAttributes']);_0x2febe0[_0x5671('0x4e')]=_[_0x5671('0x4f')](_0x163423[_0x5671('0x4e')]);_0x2febe0['filters']=_[_0x5671('0x50')](_0x2febe0[_0x5671('0x42')],_0x2febe0[_0x5671('0x4e')]);_0x5cf71d['attributes']=_[_0x5671('0x50')](_0x2febe0[_0x5671('0x42')],qs['fields'](_0x163423[_0x5671('0x4e')][_0x5671('0x52')]));_0x5cf71d[_0x5671('0x51')]=_0x5cf71d[_0x5671('0x51')][_0x5671('0x53')]?_0x5cf71d['attributes']:_0x2febe0[_0x5671('0x42')];if(_0x163423['query'][_0x5671('0x5d')]){_0x5cf71d[_0x5671('0x5e')]=[{'all':!![]}];}_0x5cf71d=_[_0x5671('0x5a')]({},_0x5cf71d,_0x163423['options']);return db['ChatWebsite'][_0x5671('0x61')](_0x5cf71d)['then'](handleEntityNotFound(_0x410569,null))['then'](respondWithResult(_0x410569,null))['catch'](handleError(_0x410569,null));};exports['create']=function(_0x2d899b,_0x169f17){var _0x2ef081=null;_0x2d899b[_0x5671('0x62')][_0x5671('0x63')]['split'](',')[_0x5671('0x64')](_0x2f0c5b=>{if(_0x2f0c5b[_0x5671('0x65')]()!==''&&!wildcardUtils[_0x5671('0x66')](_0x2f0c5b['trim']())){_0x2ef081=new APIBadRequestError('\x22'+_0x2f0c5b[_0x5671('0x65')]()+_0x5671('0x67'));}});if(_0x2ef081){return handleError(_0x169f17,null)(_0x2ef081);}return db[_0x5671('0x4a')]['create'](_0x2d899b[_0x5671('0x62')],{})['then'](function(_0x5b6885){var _0xc21ee3=_0x2d899b['user'][_0x5671('0x68')]({'plain':!![]});if(!_0xc21ee3)throw new Error(_0x5671('0x69'));if(_0xc21ee3[_0x5671('0x6a')]==='user'){var _0x122985=_0x5b6885['get']({'plain':!![]});var _0x2a2c16=_0x5671('0x2d');return db[_0x5671('0x6b')][_0x5671('0x61')]({'where':{'name':_0x2a2c16,'userProfileId':_0xc21ee3[_0x5671('0x6c')]},'raw':!![]})['then'](function(_0x3e9af1){if(_0x3e9af1&&_0x3e9af1[_0x5671('0x6d')]===0x0){return db[_0x5671('0x6e')][_0x5671('0x6f')]({'name':_0x122985[_0x5671('0x30')],'resourceId':_0x122985['id'],'type':_0x3e9af1[_0x5671('0x30')],'sectionId':_0x3e9af1['id']},{})[_0x5671('0x2b')](function(){return _0x5b6885;});}else{return _0x5b6885;}})[_0x5671('0x20')](function(_0x2ae18d){logger[_0x5671('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae18d);throw _0x2ae18d;});}return _0x5b6885;})['then'](respondWithResult(_0x169f17,0xc9))[_0x5671('0x20')](handleError(_0x169f17,null));};exports[_0x5671('0x2a')]=function(_0x13763a,_0x263436){var _0x4fd65d=null;_0x13763a[_0x5671('0x62')][_0x5671('0x63')][_0x5671('0x38')](',')[_0x5671('0x64')](_0x5311a7=>{if(_0x5311a7['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x5311a7['trim']())){_0x4fd65d=new APIBadRequestError('\x22'+_0x5311a7[_0x5671('0x65')]()+_0x5671('0x67'));}});if(_0x4fd65d){return handleError(_0x263436,null)(_0x4fd65d);}if(_0x13763a['body']['id']){delete _0x13763a[_0x5671('0x62')]['id'];}return db[_0x5671('0x4a')][_0x5671('0x61')]({'where':{'id':_0x13763a[_0x5671('0x70')]['id']},'include':[{'model':db[_0x5671('0x47')],'as':_0x5671('0x48')}]})['then'](handleEntityNotFound(_0x263436,null))[_0x5671('0x2b')](saveUpdates(_0x13763a[_0x5671('0x62')],null))['then'](respondWithResult(_0x263436,null))['catch'](handleError(_0x263436,null));};exports[_0x5671('0x2c')]=function(_0x124e80,_0x4db4cc){return db[_0x5671('0x4a')][_0x5671('0x61')]({'where':{'id':_0x124e80[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x4db4cc,null))[_0x5671('0x2b')](removeEntity(_0x4db4cc,null))[_0x5671('0x20')](handleError(_0x4db4cc,null));};exports[_0x5671('0x71')]=function(_0x414b14,_0x169296){return db['ChatWebsite'][_0x5671('0x71')]()[_0x5671('0x2b')](respondWithResult(_0x169296,null))[_0x5671('0x20')](handleError(_0x169296,null));};exports['addDisposition']=function(_0x16be0a,_0x4dfd11){if(_0x16be0a['body']['id']){delete _0x16be0a[_0x5671('0x62')]['id'];}return db[_0x5671('0x4a')][_0x5671('0x61')]({'where':{'id':_0x16be0a[_0x5671('0x70')]['id']}})['then'](handleEntityNotFound(_0x4dfd11,null))[_0x5671('0x2b')](function(_0x2e13fe){if(_0x2e13fe){_0x16be0a[_0x5671('0x62')]['ChatWebsiteId']=_0x2e13fe['id'];return db[_0x5671('0x72')][_0x5671('0x6f')](_0x16be0a[_0x5671('0x62')]);}})[_0x5671('0x2b')](respondWithResult(_0x4dfd11,null))['catch'](handleError(_0x4dfd11,null));};exports[_0x5671('0x73')]=function(_0x53d253,_0x508531){var _0x4c93c8={'raw':![],'where':{}};var _0x5568ad={};var _0x8f92e0={'count':0x0,'rows':[]};return db[_0x5671('0x4a')]['findOne']({'where':{'id':_0x53d253[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x508531,null))[_0x5671('0x2b')](function(_0x2eb578){if(_0x2eb578){_0x5568ad[_0x5671('0x42')]=_[_0x5671('0x4f')](db[_0x5671('0x72')]['rawAttributes']);_0x5568ad[_0x5671('0x4e')]=_[_0x5671('0x4f')](_0x53d253[_0x5671('0x4e')]);_0x5568ad[_0x5671('0x58')]=_[_0x5671('0x50')](_0x5568ad['model'],_0x5568ad[_0x5671('0x4e')]);_0x4c93c8[_0x5671('0x51')]=_[_0x5671('0x50')](_0x5568ad[_0x5671('0x42')],qs[_0x5671('0x52')](_0x53d253['query'][_0x5671('0x52')]));_0x4c93c8['attributes']=_0x4c93c8[_0x5671('0x51')][_0x5671('0x53')]?_0x4c93c8['attributes']:_0x5568ad[_0x5671('0x42')];if(!_0x53d253[_0x5671('0x4e')][_0x5671('0x54')](_0x5671('0x55'))){_0x4c93c8[_0x5671('0x24')]=qs[_0x5671('0x24')](_0x53d253['query']['limit']);_0x4c93c8[_0x5671('0x27')]=qs[_0x5671('0x27')](_0x53d253[_0x5671('0x4e')][_0x5671('0x27')]);}_0x4c93c8[_0x5671('0x74')]=qs[_0x5671('0x56')](_0x53d253[_0x5671('0x4e')][_0x5671('0x56')]);_0x4c93c8[_0x5671('0x57')]=qs['filters'](_[_0x5671('0x75')](_0x53d253[_0x5671('0x4e')],_0x5568ad[_0x5671('0x58')]));_0x4c93c8[_0x5671('0x57')][_0x5671('0x76')]=_0x2eb578['id'];if(_0x53d253[_0x5671('0x4e')][_0x5671('0x59')]){_0x4c93c8['where']=_[_0x5671('0x5a')](_0x4c93c8[_0x5671('0x57')],{'$or':_[_0x5671('0x49')](_0x4c93c8[_0x5671('0x51')],function(_0x29192c){var _0x16cabb={};_0x16cabb[_0x29192c]={'$like':'%'+_0x53d253[_0x5671('0x4e')]['filter']+'%'};return _0x16cabb;})});}_0x4c93c8=_[_0x5671('0x5a')]({},_0x4c93c8,_0x53d253[_0x5671('0x5c')]);return db[_0x5671('0x72')][_0x5671('0x26')]({'where':_0x4c93c8[_0x5671('0x57')]})['then'](function(_0x1a67da){_0x8f92e0['count']=_0x1a67da;if(_0x53d253[_0x5671('0x4e')][_0x5671('0x5d')]){_0x4c93c8[_0x5671('0x5e')]=[{'all':!![]}];}return db[_0x5671('0x72')][_0x5671('0x5f')](_0x4c93c8);})[_0x5671('0x2b')](function(_0x473afc){_0x8f92e0['rows']=_0x473afc;return _0x8f92e0;});}})[_0x5671('0x2b')](respondWithFilteredResult(_0x508531,_0x4c93c8))[_0x5671('0x20')](handleError(_0x508531,null));};exports[_0x5671('0x77')]=function(_0x41ca14,_0x58db89){return db[_0x5671('0x4a')]['find']({'where':{'id':_0x41ca14[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x58db89,null))[_0x5671('0x2b')](function(_0x4344c0){if(_0x4344c0){return _0x4344c0[_0x5671('0x77')](_0x41ca14['query'][_0x5671('0x78')]);}})['then'](respondWithStatusCode(_0x58db89,null))[_0x5671('0x20')](handleError(_0x58db89,null));};exports[_0x5671('0x79')]=function(_0x1c3d2a,_0x1ab2bb){if(_0x1c3d2a['body']['id']){delete _0x1c3d2a[_0x5671('0x62')]['id'];}return db[_0x5671('0x4a')][_0x5671('0x61')]({'where':{'id':_0x1c3d2a[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x1ab2bb,null))[_0x5671('0x2b')](function(_0x12e2fe){if(_0x12e2fe){_0x1c3d2a[_0x5671('0x62')]['ChatWebsiteId']=_0x12e2fe['id'];return db['CannedAnswer'][_0x5671('0x6f')](_0x1c3d2a[_0x5671('0x62')]);}})[_0x5671('0x2b')](respondWithResult(_0x1ab2bb,null))['catch'](handleError(_0x1ab2bb,null));};exports['getAnswers']=function(_0x4067b0,_0x2eab6d){var _0x1b9676={'raw':![],'where':{}};var _0x1c0415={};var _0x3b9d1e={'count':0x0,'rows':[]};return db[_0x5671('0x4a')][_0x5671('0x7a')]({'where':{'id':_0x4067b0['params']['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x2eab6d,null))['then'](function(_0x34f7c3){if(_0x34f7c3){_0x1c0415['model']=_[_0x5671('0x4f')](db[_0x5671('0x7b')][_0x5671('0x4b')]);_0x1c0415[_0x5671('0x4e')]=_[_0x5671('0x4f')](_0x4067b0[_0x5671('0x4e')]);_0x1c0415['filters']=_[_0x5671('0x50')](_0x1c0415['model'],_0x1c0415[_0x5671('0x4e')]);_0x1b9676[_0x5671('0x51')]=_[_0x5671('0x50')](_0x1c0415[_0x5671('0x42')],qs[_0x5671('0x52')](_0x4067b0[_0x5671('0x4e')][_0x5671('0x52')]));_0x1b9676['attributes']=_0x1b9676[_0x5671('0x51')]['length']?_0x1b9676[_0x5671('0x51')]:_0x1c0415[_0x5671('0x42')];if(!_0x4067b0['query'][_0x5671('0x54')]('nolimit')){_0x1b9676['limit']=qs[_0x5671('0x24')](_0x4067b0['query'][_0x5671('0x24')]);_0x1b9676[_0x5671('0x27')]=qs[_0x5671('0x27')](_0x4067b0['query'][_0x5671('0x27')]);}_0x1b9676['order']=qs[_0x5671('0x56')](_0x4067b0[_0x5671('0x4e')]['sort']);_0x1b9676['where']=qs[_0x5671('0x58')](_[_0x5671('0x75')](_0x4067b0[_0x5671('0x4e')],_0x1c0415[_0x5671('0x58')]));_0x1b9676['where']['ChatWebsiteId']=_0x34f7c3['id'];if(_0x4067b0[_0x5671('0x4e')][_0x5671('0x59')]){_0x1b9676[_0x5671('0x57')]=_[_0x5671('0x5a')](_0x1b9676[_0x5671('0x57')],{'$or':_[_0x5671('0x49')](_0x1b9676['attributes'],function(_0x3629b6){var _0x1942cb={};_0x1942cb[_0x3629b6]={'$like':'%'+_0x4067b0[_0x5671('0x4e')][_0x5671('0x59')]+'%'};return _0x1942cb;})});}_0x1b9676=_[_0x5671('0x5a')]({},_0x1b9676,_0x4067b0[_0x5671('0x5c')]);return db[_0x5671('0x7b')][_0x5671('0x26')]({'where':_0x1b9676['where']})['then'](function(_0x24899f){_0x3b9d1e[_0x5671('0x26')]=_0x24899f;if(_0x4067b0[_0x5671('0x4e')][_0x5671('0x5d')]){_0x1b9676[_0x5671('0x5e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1b9676);})[_0x5671('0x2b')](function(_0x10fc7f){_0x3b9d1e[_0x5671('0x60')]=_0x10fc7f;return _0x3b9d1e;});}})['then'](respondWithFilteredResult(_0x2eab6d,_0x1b9676))[_0x5671('0x20')](handleError(_0x2eab6d,null));};exports[_0x5671('0x7c')]=function(_0x513de5,_0xd32f95){return db[_0x5671('0x4a')][_0x5671('0x61')]({'where':{'id':_0x513de5['params']['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0xd32f95,null))[_0x5671('0x2b')](function(_0x459047){if(_0x459047){return _0x459047[_0x5671('0x7c')](_0x513de5[_0x5671('0x4e')]['ids']);}})[_0x5671('0x2b')](respondWithStatusCode(_0xd32f95,null))['catch'](handleError(_0xd32f95,null));};exports['addLogo']=function(_0x2af70e,_0x5ac74a){_0x2af70e[_0x5671('0x62')][_0x5671('0x7d')]=_0x2af70e[_0x5671('0x7e')][_0x5671('0x7f')];return db['ChatWebsite'][_0x5671('0x61')]({'where':{'id':_0x2af70e[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x5ac74a,null))[_0x5671('0x2b')](saveUpdates(_0x2af70e[_0x5671('0x62')],null))[_0x5671('0x2b')](respondWithResult(_0x5ac74a,null))[_0x5671('0x20')](handleError(_0x5ac74a,null));};exports[_0x5671('0x80')]=function(_0x1e8bd5,_0x1bbdaf){_0x1e8bd5['body']['agentAvatar']=_0x1e8bd5[_0x5671('0x7e')]['filename'];return db[_0x5671('0x4a')][_0x5671('0x61')]({'where':{'id':_0x1e8bd5[_0x5671('0x70')]['id']}})['then'](handleEntityNotFound(_0x1bbdaf,null))[_0x5671('0x2b')](saveUpdates(_0x1e8bd5['body'],null))[_0x5671('0x2b')](respondWithResult(_0x1bbdaf,null))[_0x5671('0x20')](handleError(_0x1bbdaf,null));};exports[_0x5671('0x81')]=function(_0x7b4c92,_0x48b2fd){_0x7b4c92[_0x5671('0x62')][_0x5671('0x82')]=_0x7b4c92[_0x5671('0x7e')][_0x5671('0x7f')];return db['ChatWebsite'][_0x5671('0x61')]({'where':{'id':_0x7b4c92['params']['id']}})['then'](handleEntityNotFound(_0x48b2fd,null))[_0x5671('0x2b')](saveUpdates(_0x7b4c92[_0x5671('0x62')],null))['then'](respondWithResult(_0x48b2fd,null))['catch'](handleError(_0x48b2fd,null));};exports['addSystemAvatar']=function(_0x8d2639,_0xe3994a){_0x8d2639[_0x5671('0x62')]['systemAvatar']=_0x8d2639[_0x5671('0x7e')][_0x5671('0x7f')];return db[_0x5671('0x4a')]['find']({'where':{'id':_0x8d2639[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0xe3994a,null))[_0x5671('0x2b')](saveUpdates(_0x8d2639[_0x5671('0x62')],null))[_0x5671('0x2b')](respondWithResult(_0xe3994a,null))[_0x5671('0x20')](handleError(_0xe3994a,null));};exports[_0x5671('0x83')]=function(_0x17c08e,_0x38e471){var _0x1a976e=path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0x86'));var _0x1a7eae={'where':{'id':_0x17c08e['params']['id']},'attributes':['id',_0x5671('0x7d')],'raw':!![]};var _0x8ab2f6=![];return require(_0x5671('0x87'))[_0x5671('0x88')]()[_0x5671('0x2b')](function(_0x4a3605){if(_0x4a3605){_0x8ab2f6=_0x4a3605[_0x5671('0x89')];}})['then'](function(){return db[_0x5671('0x4a')][_0x5671('0x61')](_0x1a7eae);})['then'](handleEntityNotFound(_0x38e471,null))[_0x5671('0x2b')](function(_0x55572c){if(_0x55572c){if(!_['isNil'](_0x55572c[_0x5671('0x7d')])){if(fs[_0x5671('0x8a')](path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0x8b'),_0x55572c['sitepic']))&&_0x8ab2f6){_0x1a976e=path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0x8b'),_0x55572c[_0x5671('0x7d')]);}}return _0x38e471['download'](_0x1a976e);}})[_0x5671('0x20')](handleError(_0x38e471,null));};exports['getAvatar']=function(_0x374a9b,_0x41d357){var _0x9515fe=path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0x8c'));var _0x344794={'where':{'id':_0x374a9b[_0x5671('0x70')]['id']},'attributes':['id',_0x5671('0x8d')],'raw':!![]};return db[_0x5671('0x4a')]['find'](_0x344794)['then'](handleEntityNotFound(_0x41d357,null))[_0x5671('0x2b')](function(_0x47685f){if(_0x47685f){if(!_[_0x5671('0x8e')](_0x47685f[_0x5671('0x8d')])){if(fs[_0x5671('0x8a')](path[_0x5671('0x84')](config[_0x5671('0x85')],'server/files/images/avatars/',_0x47685f[_0x5671('0x8d')]))){_0x9515fe=path[_0x5671('0x84')](config[_0x5671('0x85')],'server/files/images/avatars/',_0x47685f[_0x5671('0x8d')]);}}return _0x41d357[_0x5671('0x8f')](_0x9515fe);}})[_0x5671('0x20')](handleError(_0x41d357,null));};exports['getCustomerAvatar']=function(_0x10703a,_0xbf7a54){var _0x26550a=path[_0x5671('0x84')](config['root'],_0x5671('0x90'));var _0x2bcfda={'where':{'id':_0x10703a[_0x5671('0x70')]['id']},'attributes':['id',_0x5671('0x82'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x2bcfda)[_0x5671('0x2b')](handleEntityNotFound(_0xbf7a54,null))[_0x5671('0x2b')](function(_0x411150){if(_0x411150){if(!_[_0x5671('0x8e')](_0x411150[_0x5671('0x82')])){if(fs[_0x5671('0x8a')](path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0x91'),_0x411150['customerAvatar']))&&_0x411150[_0x5671('0x92')]){_0x26550a=path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0x91'),_0x411150[_0x5671('0x82')]);}}return _0xbf7a54[_0x5671('0x8f')](_0x26550a);}})[_0x5671('0x20')](handleError(_0xbf7a54,null));};exports['getSystemAvatar']=function(_0x163733,_0xb41f1c){var _0x53bc08=path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0x93'));var _0x23dba2={'where':{'id':_0x163733[_0x5671('0x70')]['id']},'attributes':['id',_0x5671('0x94')],'raw':!![]};return db[_0x5671('0x4a')][_0x5671('0x61')](_0x23dba2)[_0x5671('0x2b')](handleEntityNotFound(_0xb41f1c,null))[_0x5671('0x2b')](function(_0xc6d797){if(_0xc6d797){if(!_[_0x5671('0x8e')](_0xc6d797[_0x5671('0x94')])){if(fs[_0x5671('0x8a')](path[_0x5671('0x84')](config['root'],_0x5671('0x91'),_0xc6d797[_0x5671('0x94')]))){_0x53bc08=path['join'](config[_0x5671('0x85')],'server/files/images/avatars/',_0xc6d797[_0x5671('0x94')]);}}return _0xb41f1c[_0x5671('0x8f')](_0x53bc08);}})[_0x5671('0x20')](handleError(_0xb41f1c,null));};function checkWebsiteInterval(_0x33bec9){var _0x24fe9e=_0x33bec9['Interval'];if(!_0x24fe9e){return Promise['resolve'](_0x33bec9);}var _0x3058cc=_0x33bec9['timezone']||undefined;return _0x24fe9e[_0x5671('0x95')](_0x3058cc)['then'](function(_0x35821a){if(!_0x35821a){throw new APIOutOfIntervalError();}return _0x33bec9;});}exports['notify']=function(_0x161b78,_0x22d316){var _0x15c57e={'body':_0x161b78[_0x5671('0x62')],'channel':'chat'};var _0x166721=[];var _0x288224=[];var _0x31725c={};var _0x127edc=![];if(_0x161b78[_0x5671('0x62')]['id']){delete _0x161b78['body']['id'];}if(_['isNil'](_0x161b78[_0x5671('0x62')][_0x5671('0x96')])){throw new APIBadRequestError(_0x5671('0x97'));}if(_[_0x5671('0x8e')](_0x161b78['body'][_0x5671('0x98')])){throw new APIBadRequestError(_0x5671('0x99'));}if(_[_0x5671('0x9a')](_0x161b78[_0x5671('0x62')]['body'])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x4732b2=_0x161b78['body'][_0x5671('0x9b')]&&_0x161b78[_0x5671('0x62')][_0x5671('0x3b')];return db['CmContact'][_0x5671('0x71')]()[_0x5671('0x2b')](function(_0x30bba7){if(!_0x30bba7){throw new Error(_0x5671('0x9c'));}_0x166721=Object[_0x5671('0x4f')](_0x30bba7)[_0x5671('0x59')](function(_0x5155db){return![_0x5671('0x9d'),_0x5671('0x9e')][_0x5671('0x9f')](_0x5155db);});_0x288224=Object['keys'](_0x30bba7)['filter'](function(_0x309fa3){return!['createdAt',_0x5671('0x9e'),_0x5671('0xa0'),_0x5671('0xa1')][_0x5671('0x9f')](_0x309fa3);});if(!_[_0x5671('0x9f')](_0x288224,_0x161b78[_0x5671('0x62')][_0x5671('0x98')])){throw new APIBadRequestError(_0x5671('0xa2')+_0x288224[_0x5671('0x84')](',\x20'));}_0x31725c[_0x161b78['body']['mapKey']]=_0x161b78[_0x5671('0x62')][_0x5671('0x96')];})[_0x5671('0x2b')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x161b78[_0x5671('0x70')]['id']},'include':[{'model':db['CmList'],'as':_0x5671('0xa3'),'include':[{'model':db[_0x5671('0xa4')],'as':'Contacts','where':_0x31725c,'limit':0x1,'order':[[_0x5671('0x9e'),_0x5671('0xa5')]]}]},{'model':db[_0x5671('0xa6')],'as':_0x5671('0xa7')},{'model':db['Interval'],'as':_0x5671('0xa8'),'include':[{'model':db[_0x5671('0xa8')],'as':_0x5671('0xa9'),'attributes':['id',_0x5671('0xaa')],'raw':!![]}]}]});})[_0x5671('0x2b')](function(_0x30710d){if(!_0x30710d){throw new APINotFoundError(util[_0x5671('0x3e')](_0x5671('0xab'),_0x161b78[_0x5671('0x70')]['id']));}if(_0x4732b2){return checkWebsiteInterval(_0x30710d);}return _0x30710d;})['then'](function(_0x2e755c){_0x15c57e[_0x5671('0xac')]=_0x2e755c;_0x15c57e[_0x5671('0xad')]=_['orderBy'](_0x2e755c[_0x5671('0xa7')],['priority'],['asc']);if(_0x15c57e[_0x5671('0xac')]['Applications']){delete _0x15c57e['account']['Applications'];}_0x15c57e['list']=_0x2e755c[_0x5671('0xa3')]||{'id':_0x2e755c[_0x5671('0xa1')]};if(_0x15c57e[_0x5671('0xae')]&&_0x15c57e['list'][_0x5671('0xaf')]['length']){return _0x15c57e[_0x5671('0xae')][_0x5671('0xaf')][0x0];}var _0x46ccf7=_[_0x5671('0xb0')](_0x161b78[_0x5671('0x62')],{'firstName':_0x161b78['body'][_0x5671('0x96')],'ListId':_0x2e755c[_0x5671('0xa1')]});_0x46ccf7[_0x161b78['body'][_0x5671('0x98')]]=_0x161b78[_0x5671('0x62')][_0x5671('0x96')];return db[_0x5671('0xa4')][_0x5671('0x6f')](_0x46ccf7,{'fields':_0x166721,'raw':!![]});})[_0x5671('0x2b')](function(_0x461f8e){_0x15c57e[_0x5671('0xb1')]=_0x461f8e;var _0x915e77=createInteractionObject(_0x161b78['params']['id'],_0x161b78['body'],_0x161b78['headers'],_0x461f8e);var _0x1f7058={'ChatWebsiteId':_0x161b78[_0x5671('0x70')]['id']};if(_0x161b78[_0x5671('0x62')][_0x5671('0xb2')]){_0x1f7058[_0x5671('0xb2')]=_0x161b78[_0x5671('0x62')][_0x5671('0xb2')];_0x1f7058['closed']=![];return db[_0x5671('0xb3')][_0x5671('0x61')]({'where':_0x1f7058})[_0x5671('0x2b')](function(_0x11fe91){var _0x1f20e4=_0x161b78[_0x5671('0x62')][_0x5671('0x9b')]&&_0x161b78['body'][_0x5671('0x3b')];if(_0x11fe91){_0x127edc=!![];return _0x11fe91;}else if(!_0x1f20e4&&_0x11fe91&&_0x11fe91[_0x5671('0xb4')]){throw new APIConflictError(_0x5671('0xb5'));}_0x915e77[_0x5671('0xb2')]=_0x161b78['body'][_0x5671('0xb2')];_0x915e77[_0x5671('0xb6')]=_0x161b78[_0x5671('0x62')][_0x5671('0xb6')];return db[_0x5671('0xb3')][_0x5671('0x6f')](_0x915e77);});}_0x1f7058[_0x5671('0xb7')]=_0x461f8e['id'];if(_0x161b78['body'][_0x5671('0xb8')]&&_0x161b78[_0x5671('0x62')][_0x5671('0xb8')]['id']){_0x1f7058['id']=_0x161b78[_0x5671('0x62')][_0x5671('0xb8')]['id'];return db[_0x5671('0xb3')][_0x5671('0x61')]({'where':_0x1f7058})['then'](function(_0x4ce4cb){var _0xe9e3bb=_0x161b78['body'][_0x5671('0x9b')]&&_0x161b78[_0x5671('0x62')]['referer'];if(!_0xe9e3bb&&_0x4ce4cb&&_0x4ce4cb[_0x5671('0xb4')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x4ce4cb){_0x127edc=!![];return _0x4ce4cb;}else{return db[_0x5671('0xb3')][_0x5671('0x6f')](_0x915e77);}});}return db[_0x5671('0xb3')][_0x5671('0x6f')](_0x915e77);})[_0x5671('0x2b')](function(_0x34860a){if(!_0x127edc){return _0x34860a;}var _0x491d94={'from':(_0x15c57e['contact'][_0x5671('0x39')]||'')+'\x20'+(_0x15c57e[_0x5671('0xb1')]['lastName']||'')};if(_0x161b78['body']['threadId']&&_0x161b78[_0x5671('0x62')][_0x5671('0xb9')]&&_0x161b78['body'][_0x5671('0xb2')]!=_0x161b78[_0x5671('0x62')]['messageId']){_0x491d94[_0x5671('0xb2')]=_0x161b78[_0x5671('0x62')][_0x5671('0xb9')];}return _0x34860a[_0x5671('0x2a')](_0x491d94);})[_0x5671('0x2b')](function(_0x364a16){_0x15c57e[_0x5671('0xb8')]=_0x364a16[_0x5671('0x68')]({'plain':!![]});_0x15c57e['interaction'][_0x5671('0xba')]=!_0x127edc;if(_0x15c57e[_0x5671('0xb8')]['created']){if(_0x15c57e['account']['autoclose']){_0x15c57e[_0x5671('0xad')][_0x5671('0xbb')]({'id':0x0,'priority':_0x15c57e[_0x5671('0xad')]['length']+0x1,'app':_0x5671('0xbc'),'appdata':_0x5671('0xbd'),'interval':_0x5671('0xbe')});}}return db[_0x5671('0xbf')]['create']({'body':_0x161b78[_0x5671('0x62')][_0x5671('0x62')],'ChatWebsiteId':_0x161b78[_0x5671('0x70')]['id'],'ChatInteractionId':_0x364a16['id'],'direction':'in','ContactId':_0x15c57e[_0x5671('0xb1')]['id'],'AttachmentId':_0x161b78[_0x5671('0x62')][_0x5671('0xc0')]});})[_0x5671('0x2b')](function(_0x3889a0){_0x15c57e[_0x5671('0x1d')]=_0x3889a0;if(!_0x15c57e[_0x5671('0xb8')][_0x5671('0xc1')]){return;}return db[_0x5671('0xc2')][_0x5671('0x61')]({'attributes':['id',_0x5671('0x30')],'where':{'id':_0x15c57e['interaction'][_0x5671('0xc1')]}});})['then'](function(_0x1f0fe3){if(_0x1f0fe3){_0x15c57e[_0x5671('0xad')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5671('0xc3'),'appdata':_0x1f0fe3[_0x5671('0x30')]+','+(_0x15c57e[_0x5671('0xac')][_0x5671('0xc4')]||0xa),'interval':'*,*,*,*'});_0x15c57e[_0x5671('0xc5')]=!![];}if(!_0x15c57e[_0x5671('0xb8')][_0x5671('0xc6')]){return;}return db['ChatQueue']['find']({'attributes':['id',_0x5671('0x30')],'where':{'id':_0x15c57e['interaction']['queueId']}});})[_0x5671('0x2b')](function(_0x5b0eb8){if(_0x5b0eb8){_0x15c57e[_0x5671('0xad')][_0x5671('0xc7')]({'id':0x0,'priority':0x1,'app':_0x5671('0xc8'),'appdata':_0x5b0eb8[_0x5671('0x30')]+','+(_0x15c57e[_0x5671('0xac')][_0x5671('0xc9')]||0x12c),'interval':_0x5671('0xbe')});}return respondWithRpcPromise('Start',_0x5671('0xca'),_0x15c57e);})[_0x5671('0x2b')](function(_0x3afcdc){respondWithRpcPromise(_0x5671('0xcb'),'EventManager',{'event':'notify','message':_0x3afcdc},client9002);return _0x3afcdc;})[_0x5671('0x2b')](respondWithResult(_0x22d316,null))['catch'](APIHandleError(_0x22d316));};exports['offline']=function(_0x2ecc32,_0x5bcebf){var _0x2e465a,_0x1892f6,_0x187afc;var _0x18fae1=[];var _0x356227={};var _0x27c30f=_0x2ecc32[_0x5671('0xcc')]||[];var _0x228503=[];var _0x1e2980;return db[_0x5671('0xa4')][_0x5671('0x71')]()[_0x5671('0x2b')](function(_0x4fef8d){if(!_0x4fef8d){throw new db[(_0x5671('0xcd'))][(_0x5671('0xce'))]('no\x20available\x20attributes');}_0x18fae1=_['difference'](_[_0x5671('0x4f')](_0x4fef8d),[_0x5671('0x9d'),_0x5671('0x9e'),'CompanyId',_0x5671('0xa1')]);if(_0x2ecc32[_0x5671('0x62')]['id']){delete _0x2ecc32['body']['id'];}if(_[_0x5671('0x8e')](_0x2ecc32['body'][_0x5671('0x96')])){throw _0x5bcebf[_0x5671('0x21')](0x1f4)[_0x5671('0x31')](new db[(_0x5671('0xcd'))][(_0x5671('0xce'))](_0x5671('0xcf')));}if(_[_0x5671('0x8e')](_0x2ecc32['body'][_0x5671('0x62')])||_0x2ecc32[_0x5671('0x62')][_0x5671('0x62')]===''){throw _0x5bcebf[_0x5671('0x21')](0x1f4)[_0x5671('0x31')](new db['Sequelize'][(_0x5671('0xce'))](_0x5671('0xd0')));}if(_[_0x5671('0x8e')](_0x2ecc32['body']['mapKeyOffline'])){throw _0x5bcebf[_0x5671('0x21')](0x1f4)[_0x5671('0x31')](new db[(_0x5671('0xcd'))][(_0x5671('0xce'))](_0x5671('0xd1')+_0x18fae1));}if(!_[_0x5671('0x9f')](_0x18fae1,_0x2ecc32[_0x5671('0x62')][_0x5671('0xd2')])){throw _0x5bcebf[_0x5671('0x21')](0x1f4)[_0x5671('0x31')](new db['Sequelize'][(_0x5671('0xce'))](_0x5671('0xd3')+_0x18fae1));}_0x356227[_0x2ecc32[_0x5671('0x62')][_0x5671('0xd2')]]=_0x2ecc32['body'][_0x5671('0x96')];})[_0x5671('0x2b')](function(){return db[_0x5671('0x4a')]['find']({'where':{'id':_0x2ecc32[_0x5671('0x70')]['id']},'include':[{'model':db['CmList'],'as':_0x5671('0xa3')},{'model':db[_0x5671('0xd4')],'as':_0x5671('0xd4')}]});})[_0x5671('0x2b')](handleEntityNotFound(_0x5bcebf,null))[_0x5671('0x2b')](function(_0x36e9d){if(_0x36e9d&&_0x36e9d[_0x5671('0xa3')]){_0x1892f6=_0x36e9d;var _0x13b893=_['defaults'](_0x2ecc32[_0x5671('0x62')],{'firstName':_0x2ecc32[_0x5671('0x62')][_0x5671('0x96')],'phone':_0x2ecc32[_0x5671('0x62')][_0x5671('0x96')],'ListId':_0x36e9d[_0x5671('0xa1')]});_0x13b893[_0x2ecc32[_0x5671('0x62')]['mapKeyOffline']]=_0x2ecc32[_0x5671('0x62')][_0x5671('0x96')];return db[_0x5671('0xa4')]['findOrCreate']({'where':_0x356227,'defaults':_0x13b893});}})[_0x5671('0xd5')](function(_0x307894){if(_0x307894){_0x187afc=_0x307894;var _0x338e34=fs[_0x5671('0xd6')](path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0xd7')),_0x5671('0xd8'));var _0x40b709=ejs['render'](_0x338e34,{'body':_[_0x5671('0xd9')](_0x2ecc32[_0x5671('0x62')][_0x5671('0x62')]),'bodyTitle':_0x1892f6['offlineMessageBody']});return db[_0x5671('0xda')][_0x5671('0x6f')]({'body':_0x40b709,'plainBody':htmlToText[_0x5671('0xdb')](_0x40b709),'ContactId':_0x307894['id'],'ChatWebsiteId':_0x1892f6['id']});}})[_0x5671('0x2b')](function(_0x41e688){_0x1e2980=_0x41e688;if(_0x27c30f['length']){var _0x3175d6=_0x27c30f[_0x5671('0x49')](function(_0x306396){return{'name':_0x306396[_0x5671('0xdc')],'basename':_0x306396['filename'],'type':_0x306396[_0x5671('0xdd')],'ChatOfflineMessageId':_0x41e688['id']};});_0x228503=_0x3175d6[_0x5671('0x49')](_0x2d7da5=>{var _0x505a91={'filename':_0x2d7da5['name'],'path':path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0xde'),'files','attachments','offline-chat',_0x2d7da5[_0x5671('0xdf')])};return _0x505a91;});if(!_0x1892f6['openNewInteraction']){return db['sequelize'][_0x5671('0xe0')](function(_0x5ade4d){return db[_0x5671('0xe1')]['bulkCreate'](_0x3175d6,{'transaction':_0x5ade4d});});}}})[_0x5671('0x2b')](function(){if(_0x1e2980){_0x2e465a=_0x1e2980;return db['MailAccount'][_0x5671('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0x5671('0xe2')],'as':_0x5671('0xe3'),'raw':!![],'include':[{'model':db[_0x5671('0xe4')],'as':_0x5671('0xe4'),'raw':!![]}]}]});}})[_0x5671('0x2b')](function(_0xc88b24){if(_0xc88b24&&_0xc88b24['Smtp']&&_0x1892f6['forwardOffline']&&_0x1892f6[_0x5671('0xe5')]){var _0x2d9b9e=_0xc88b24['getSmtpOptions']();return respondWithRpcPromise(_0x5671('0xe6'),_0x5671('0xe7'),{'account':_0x2d9b9e,'message':{'from':util['format'](_0x5671('0xe8'),_0xc88b24[_0x5671('0x30')],_0xc88b24[_0x5671('0xe9')]||_0xc88b24['Smtp'][_0x5671('0xea')]),'to':_0x1892f6[_0x5671('0xe5')],'subject':_0x1892f6['offlineMessageSubject'],'html':_0x2e465a[_0x5671('0x62')],'attachments':_0x228503}},client9003)[_0x5671('0x2b')](function(){return _0x2e465a;})[_0x5671('0x20')](function(_0x365d6c){logger[_0x5671('0x1a')](_0x365d6c);});}})[_0x5671('0x2b')](function(){if(_0x1892f6&&_0x1892f6['openNewInteraction']&&_0x1892f6[_0x5671('0xeb')]){var _0x11cc51=[];if(_0x27c30f['length']){_0x11cc51=_0x27c30f[_0x5671('0x49')](function(_0x595ccd){return{'name':_0x595ccd['originalname'],'basename':_0x595ccd[_0x5671('0x7f')],'type':_0x595ccd[_0x5671('0xdd')],'ChatOfflineMessageId':_0x1e2980['id']};});}var _0x1d6c7a;if(!_[_0x5671('0x8e')](_0x1892f6[_0x5671('0xec')])){var _0x2eeafb=_[_0x5671('0x49')](_0x2ecc32[_0x5671('0x62')],function(_0x29e486){return _0x29e486;});var _0x25ef1e=_[_0x5671('0xed')](_0x2eeafb)[0x0];var _0x1751bc=_[_0x5671('0xee')](_0x25ef1e,function(_0x4a657a){return _0x4a657a;});_0x1d6c7a=_0x1751bc[0x1][_0x1892f6['subjectOffline']];}var _0x4ee8e4={'from':_0x187afc[_0x5671('0xe9')],'firstName':_0x187afc['firstName'],'lastName':_0x187afc[_0x5671('0xef')],'mapKey':_0x5671('0xe9'),'message':{'from':_0x187afc['email'],'to':_0x1892f6['MailAccount'][_0x5671('0xe9')],'cc':'','subject':_['isNil'](_0x1d6c7a)?_0x1892f6[_0x5671('0xf0')]:_0x1d6c7a,'messageId':'','sentAt':new Date(),'attach':_0x11cc51['length'],'attachments':_0x11cc51,'originChannel':_0x5671('0xf1'),'ChatWebsiteId':_0x1892f6['id'],'ChatOfflineMessageId':_0x2e465a['id'],'originTo':_0x1892f6[_0x5671('0xd4')][_0x5671('0xe9')]},'body':_0x2e465a[_0x5671('0x62')]};var _0x2c0172={'account':{'id':_0x1892f6['MailAccountId']},'body':_0x4ee8e4,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x5671('0xf2'),_0x5671('0xf3'),_0x2c0172,client9001)[_0x5671('0x2b')](function(){return _0x2e465a;})['catch'](function(_0x31da1e){logger['error'](_0x31da1e);});}return;})[_0x5671('0x2b')](function(){if(_0x2e465a){return _0x2e465a;}})[_0x5671('0x2b')](respondWithResult(_0x5bcebf,null))['catch'](function(){for(var _0x461a1b of _0x27c30f){var _0x2c107a=path[_0x5671('0x84')](config[_0x5671('0x85')],_0x5671('0xde'),_0x5671('0xcc'),_0x5671('0xf4'),_0x5671('0xf5'),_0x461a1b[_0x5671('0x7f')]);fs_extra[_0x5671('0xf6')](_0x2c107a)[_0x5671('0x20')](function(_0x21ed8a){logger[_0x5671('0x1a')](_0x5671('0xf7'),_0x2c107a,_0x21ed8a);});}});};exports[_0x5671('0xf8')]=function(_0x226cbd,_0x14961a){return db[_0x5671('0xb3')]['find']({'where':{'id':_0x226cbd['params']['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x14961a,null))['then'](function(_0x527285){if(_0x527285){return _0x527285[_0x5671('0xf8')](_0x226cbd[_0x5671('0x62')]['ids'],_['omit'](_0x226cbd[_0x5671('0x62')],[_0x5671('0x78'),'id'])||{});}})[_0x5671('0x2b')](respondWithResult(_0x14961a,null))[_0x5671('0x20')](handleError(_0x14961a,null));};exports['getInteractions']=function(_0x1e4301,_0x29753f){var _0x257d5a={'raw':![],'where':{}};var _0x4d1744={};var _0x380497={'count':0x0,'rows':[]};return db[_0x5671('0x4a')]['findOne']({'where':{'id':_0x1e4301[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x29753f,null))[_0x5671('0x2b')](function(_0x4aee8c){if(_0x4aee8c){_0x4d1744[_0x5671('0x42')]=_[_0x5671('0x4f')](db[_0x5671('0xb3')]['rawAttributes']);_0x4d1744[_0x5671('0x4e')]=_[_0x5671('0x4f')](_0x1e4301['query']);_0x4d1744[_0x5671('0x58')]=_[_0x5671('0x50')](_0x4d1744[_0x5671('0x42')],_0x4d1744[_0x5671('0x4e')]);_0x257d5a[_0x5671('0x51')]=_[_0x5671('0x50')](_0x4d1744[_0x5671('0x42')],qs[_0x5671('0x52')](_0x1e4301['query'][_0x5671('0x52')]));_0x257d5a[_0x5671('0x51')]=_0x257d5a[_0x5671('0x51')]['length']?_0x257d5a['attributes']:_0x4d1744[_0x5671('0x42')];if(!_0x1e4301[_0x5671('0x4e')][_0x5671('0x54')](_0x5671('0x55'))){_0x257d5a['limit']=qs[_0x5671('0x24')](_0x1e4301[_0x5671('0x4e')]['limit']);_0x257d5a[_0x5671('0x27')]=qs[_0x5671('0x27')](_0x1e4301[_0x5671('0x4e')]['offset']);}_0x257d5a[_0x5671('0x74')]=qs[_0x5671('0x56')](_0x1e4301[_0x5671('0x4e')][_0x5671('0x56')]);_0x257d5a[_0x5671('0x57')]=qs[_0x5671('0x58')](_[_0x5671('0x75')](_0x1e4301[_0x5671('0x4e')],_0x4d1744[_0x5671('0x58')]));_0x257d5a['where'][_0x5671('0x76')]=_0x4aee8c['id'];if(_0x1e4301['query'][_0x5671('0x59')]){_0x257d5a[_0x5671('0x57')]=_[_0x5671('0x5a')](_0x257d5a[_0x5671('0x57')],{'$or':_[_0x5671('0x49')](_0x257d5a[_0x5671('0x51')],function(_0x122b9b){var _0x20459e={};_0x20459e[_0x122b9b]={'$like':'%'+_0x1e4301[_0x5671('0x4e')][_0x5671('0x59')]+'%'};return _0x20459e;})});}_0x257d5a=_['merge']({},_0x257d5a,_0x1e4301[_0x5671('0x5c')]);return db['ChatInteraction'][_0x5671('0x26')]({'where':_0x257d5a[_0x5671('0x57')]})[_0x5671('0x2b')](function(_0x3b9279){_0x380497[_0x5671('0x26')]=_0x3b9279;if(_0x1e4301['query'][_0x5671('0x5d')]){_0x257d5a[_0x5671('0x5e')]=[{'model':db[_0x5671('0xa4')],'as':'Contact','required':![]},{'model':db[_0x5671('0xc2')],'as':_0x5671('0xf9'),'attributes':[_0x5671('0x30'),_0x5671('0xfa'),_0x5671('0xfb')],'required':![]},{'model':db[_0x5671('0xfc')],'as':'Tags','attributes':['id',_0x5671('0x30'),_0x5671('0xfd')],'where':_0x1e4301[_0x5671('0x4e')][_0x5671('0xfe')]?{'id':_0x1e4301['query'][_0x5671('0xfe')]}:undefined,'required':_0x1e4301[_0x5671('0x4e')][_0x5671('0xfe')]?!![]:![]}];}return db[_0x5671('0xb3')][_0x5671('0x5f')](_0x257d5a);})[_0x5671('0x2b')](function(_0x2f56ef){_0x380497[_0x5671('0x60')]=_0x2f56ef;return _0x380497;});}})[_0x5671('0x2b')](respondWithFilteredResult(_0x29753f,_0x257d5a))['catch'](handleError(_0x29753f,null));};exports['getSnippet']=function(_0x517feb,_0x49e5e0){var _0x443ac6=0x0;var _0x2ed6f9=0x0;var _0x2da02f=![];var _0x915c81;var _0x51f6f7;return db[_0x5671('0x4a')][_0x5671('0x61')]({'where':{'id':_0x517feb[_0x5671('0x70')]['id']},'include':[{'model':db[_0x5671('0xa8')],'as':_0x5671('0xa8'),'include':[{'model':db[_0x5671('0xa8')],'as':_0x5671('0xa9'),'attributes':['id',_0x5671('0xaa')]}]}]})[_0x5671('0x2b')](handleEntityNotFound(_0x49e5e0,null))['then'](function(_0x5e0bda){if(_0x5e0bda){_0x915c81=_0x5e0bda;return _0x5e0bda[_0x5671('0xff')]({'raw':!![]});}})[_0x5671('0x2b')](function(_0x5336b0){if(_0x915c81){if(_0x5336b0){_0x51f6f7=_0x5336b0;}}return require(_0x5671('0x87'))[_0x5671('0x88')]();})[_0x5671('0x2b')](function(_0x1bdbb2){if(_0x1bdbb2){_0x2ed6f9=_0x1bdbb2['virtual'];_0x2da02f=_0x1bdbb2[_0x5671('0x89')];}})[_0x5671('0x2b')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x5671('0x2b')](function(_0x5971a1){_0x443ac6=_0x5971a1;if(_0x2ed6f9&&_0x5971a1>_0x2ed6f9){return db['License'][_0x5671('0x7a')]({'where':{'id':0x1}})[_0x5671('0x2b')](function(_0x243f97){if(_0x243f97){_0x243f97[_0x5671('0x100')](_0x5671('0x101'));}});}})[_0x5671('0x2b')](function(){var _0x48eb12=_0x915c81[_0x5671('0xa8')];var _0x21f698=_0x915c81['timezone']||undefined;return _0x48eb12?_0x48eb12[_0x5671('0x95')](_0x21f698):!![];})[_0x5671('0x2b')](function(_0x487d83){var _0x32f1fe=fs[_0x5671('0xd6')](path['join'](config[_0x5671('0x85')],_0x5671('0x102')),_0x5671('0xd8'));var _0x3920db=_0x5671('0x103');var _0x4fab68=![];var _0x4ab7d7,_0x206d54;if(_0x517feb['headers'][_0x5671('0x3b')]){_0x4ab7d7=new URL(_0x517feb['headers']['referer'])[_0x5671('0x104')];}else if(_0x517feb[_0x5671('0x105')][_0x5671('0x104')]){_0x4ab7d7=new URL(_0x517feb[_0x5671('0x105')]['origin'])[_0x5671('0x104')];}else{_0x4ab7d7=_0x5671('0x106');}_0x206d54=typeof _0x915c81['address'][_0x5671('0x38')](',')['find'](function(_0x398523){return wildcardUtils[_0x5671('0x107')](_0x398523,_0x4ab7d7);})!==_0x5671('0x25');var _0x3d5294={'chatVersion':_0x3920db,'chatWebsiteAddressOrigin':_0x206d54?_0x4ab7d7:_0x915c81[_0x5671('0x63')],'remote':_0x915c81[_0x5671('0x108')],'query':querystring[_0x5671('0x45')](_[_0x5671('0x5a')](_0x915c81['get']({'plain':!![]}),{'customerIp':_0x517feb['headers']['x-forwarded-for']||_0x517feb['headers']['x-real-ip']||_0x517feb[_0x5671('0x109')]['remoteAddress']||_0x517feb['ip'],'referer':_0x517feb['headers'][_0x5671('0x3b')],'openedInteractions':_0x443ac6,'maxInteractions':_0x2ed6f9,'virtual':_0x2da02f[_0x5671('0x10a')],'online':_0x487d83,'custom':_0x2da02f,'address':_0x206d54?_0x4ab7d7:null}))['replace'](/'/g,'\x5c\x27')};_0x49e5e0[_0x5671('0x31')](ejs['render'](Mustache['render'](_0x32f1fe,_0x3d5294),{'proactiveActions':_0x51f6f7,'alignment':_0x915c81[_0x5671('0x10b')],'verticalAlignment':_0x915c81['verticalAlignment'],'div_color':_0x915c81[_0x5671('0xfd')],'labelText':_0x915c81[_0x5671('0x10c')],'text_color':_0x915c81[_0x5671('0x10d')],'text_button_color':_0x915c81[_0x5671('0x10e')],'button_color':_0x915c81[_0x5671('0x10f')],'background_color':_0x915c81[_0x5671('0x110')],'hideWhenOffline':_0x915c81[_0x5671('0x111')],'intervalId':_0x915c81[_0x5671('0x112')],'isDevelopment':_0x4fab68,'chatVersion':_0x3920db}));})[_0x5671('0x20')](handleError(_0x49e5e0,null));};exports[_0x5671('0x113')]=function(_0x5cdb6c,_0x1ca7bd){var _0xfd0569=_0x5cdb6c[_0x5671('0x70')]['id'];var _0x528566=_0x5cdb6c['body'];var _0x2021eb=0xc8;var _0x2b3ba5=null;return db[_0x5671('0x114')][_0x5671('0xe0')]({'isolationLevel':db[_0x5671('0x114')][_0x5671('0x115')][_0x5671('0x116')][_0x5671('0x117')]},function(_0x59f80c){return db[_0x5671('0x4a')][_0x5671('0x7a')]({'where':{'id':_0xfd0569},'transaction':_0x59f80c})[_0x5671('0x2b')](function(_0x512315){if(_0x512315){return db[_0x5671('0xa6')][_0x5671('0x2c')]({'where':{'ChatWebsiteId':_0xfd0569},'transaction':_0x59f80c})[_0x5671('0x2b')](function(){var _0xb1d956=_[_0x5671('0x49')](_0x528566,function(_0x1e05da){_0x1e05da['ChatWebsiteId']=_0xfd0569;return _0x1e05da;});return db[_0x5671('0xa6')][_0x5671('0x118')](_0xb1d956,{'transaction':_0x59f80c});});}else{_0x2021eb=0x194;_0x2b3ba5=[];}});})[_0x5671('0x2b')](function(){if(_0x2021eb!==0x194){return db[_0x5671('0xa6')][_0x5671('0x119')]({'where':{'ChatWebsiteId':_0xfd0569},'order':_0x5671('0x11a')})[_0x5671('0x2b')](function(_0x3cc5e5){_0x2b3ba5=_0x3cc5e5;});}})[_0x5671('0x20')](function(_0x311c4d){_0x2021eb=0x1f4;logger[_0x5671('0x1a')](_0x311c4d[_0x5671('0x2f')]);if(_0x311c4d[_0x5671('0x30')]){delete _0x311c4d[_0x5671('0x30')];}_0x2b3ba5=_0x311c4d;})[_0x5671('0x11b')](function(){if(_0x2b3ba5===null){_0x1ca7bd['sendStatus'](_0x2021eb);}else{if(_0x2021eb===0x1f4){_0x1ca7bd[_0x5671('0x21')](_0x2021eb)[_0x5671('0x31')](_0x2b3ba5);}else{_0x1ca7bd['status'](_0x2021eb)['json'](_0x2b3ba5);}}});};exports[_0x5671('0x11c')]=function(_0x2e2f5b,_0x36ab82){var _0x5cba22={};var _0xe62cc9={};var _0x37cb01;var _0x291064;return db[_0x5671('0x4a')][_0x5671('0x7a')]({'where':{'id':_0x2e2f5b[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x36ab82,null))[_0x5671('0x2b')](function(_0x13ead7){if(_0x13ead7){_0x37cb01=_0x13ead7;_0xe62cc9[_0x5671('0x42')]=_[_0x5671('0x4f')](db['ChatApplication'][_0x5671('0x4b')]);_0xe62cc9[_0x5671('0x4e')]=_[_0x5671('0x4f')](_0x2e2f5b[_0x5671('0x4e')]);_0xe62cc9['filters']=_['intersection'](_0xe62cc9[_0x5671('0x42')],_0xe62cc9[_0x5671('0x4e')]);_0x5cba22[_0x5671('0x51')]=_[_0x5671('0x50')](_0xe62cc9['model'],qs[_0x5671('0x52')](_0x2e2f5b[_0x5671('0x4e')][_0x5671('0x52')]));_0x5cba22[_0x5671('0x51')]=_0x5cba22[_0x5671('0x51')]['length']?_0x5cba22['attributes']:_0xe62cc9[_0x5671('0x42')];_0x5cba22['order']=qs['sort'](_0x2e2f5b[_0x5671('0x4e')][_0x5671('0x56')]);_0x5cba22['where']=qs[_0x5671('0x58')](_[_0x5671('0x75')](_0x2e2f5b[_0x5671('0x4e')],_0xe62cc9[_0x5671('0x58')]));if(_0x2e2f5b[_0x5671('0x4e')][_0x5671('0x59')]){_0x5cba22[_0x5671('0x57')]=_[_0x5671('0x5a')](_0x5cba22[_0x5671('0x57')],{'$or':_['map'](_0x5cba22[_0x5671('0x51')],function(_0x483647){var _0x3fa7bd={};_0x3fa7bd[_0x483647]={'$like':'%'+_0x2e2f5b[_0x5671('0x4e')][_0x5671('0x59')]+'%'};return _0x3fa7bd;})});}_0x5cba22=_[_0x5671('0x5a')]({},_0x5cba22,_0x2e2f5b[_0x5671('0x5c')]);return _0x37cb01[_0x5671('0x11c')](_0x5cba22);}})[_0x5671('0x2b')](function(_0x6a6f5){if(_0x6a6f5){_0x291064=_0x6a6f5[_0x5671('0x53')];if(!_0x2e2f5b[_0x5671('0x4e')][_0x5671('0x54')](_0x5671('0x55'))){_0x5cba22['limit']=qs[_0x5671('0x24')](_0x2e2f5b[_0x5671('0x4e')][_0x5671('0x24')]);_0x5cba22['offset']=qs[_0x5671('0x27')](_0x2e2f5b[_0x5671('0x4e')]['offset']);}return _0x37cb01[_0x5671('0x11c')](_0x5cba22);}})['then'](function(_0x5e54ba){if(_0x5e54ba){return _0x5e54ba?{'count':_0x291064,'rows':_0x5e54ba}:null;}})[_0x5671('0x2b')](respondWithResult(_0x36ab82,null))[_0x5671('0x20')](handleError(_0x36ab82,null));};exports[_0x5671('0x11d')]=function(_0xd1b45a,_0x4b1c53){return db['chatProactiveAction'][_0x5671('0x61')]({'where':{'id':_0xd1b45a[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x4b1c53,null))['then'](function(_0x3af37b){if(_0x3af37b){return _0x3af37b['addProactiveActions'](_0xd1b45a[_0x5671('0x62')]['ids'],_[_0x5671('0x11e')](_0xd1b45a[_0x5671('0x62')],[_0x5671('0x78'),'id'])||{});}})[_0x5671('0x2b')](respondWithResult(_0x4b1c53,null))[_0x5671('0x20')](handleError(_0x4b1c53,null));};exports[_0x5671('0xff')]=function(_0x2e77f5,_0x75ea59){var _0x2abf7c={};var _0x1f2e50={};var _0x3c20d0;var _0x287328;return db[_0x5671('0x4a')][_0x5671('0x7a')]({'where':{'id':_0x2e77f5[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x75ea59,null))[_0x5671('0x2b')](function(_0x3cd701){if(_0x3cd701){_0x3c20d0=_0x3cd701;_0x1f2e50[_0x5671('0x42')]=_[_0x5671('0x4f')](db[_0x5671('0x11f')]['rawAttributes']);_0x1f2e50['query']=_[_0x5671('0x4f')](_0x2e77f5[_0x5671('0x4e')]);_0x1f2e50['filters']=_[_0x5671('0x50')](_0x1f2e50[_0x5671('0x42')],_0x1f2e50[_0x5671('0x4e')]);_0x2abf7c['attributes']=_[_0x5671('0x50')](_0x1f2e50[_0x5671('0x42')],qs['fields'](_0x2e77f5[_0x5671('0x4e')][_0x5671('0x52')]));_0x2abf7c['attributes']=_0x2abf7c[_0x5671('0x51')][_0x5671('0x53')]?_0x2abf7c[_0x5671('0x51')]:_0x1f2e50[_0x5671('0x42')];_0x2abf7c['order']=qs[_0x5671('0x56')](_0x2e77f5[_0x5671('0x4e')][_0x5671('0x56')]);_0x2abf7c[_0x5671('0x57')]=qs[_0x5671('0x58')](_[_0x5671('0x75')](_0x2e77f5[_0x5671('0x4e')],_0x1f2e50[_0x5671('0x58')]));if(_0x2e77f5['query']['filter']){_0x2abf7c[_0x5671('0x57')]=_['merge'](_0x2abf7c[_0x5671('0x57')],{'$or':_[_0x5671('0x49')](_0x2abf7c[_0x5671('0x51')],function(_0x33442a){var _0x5c71ee={};_0x5c71ee[_0x33442a]={'$like':'%'+_0x2e77f5['query'][_0x5671('0x59')]+'%'};return _0x5c71ee;})});}_0x2abf7c=_[_0x5671('0x5a')]({},_0x2abf7c,_0x2e77f5[_0x5671('0x5c')]);return _0x3c20d0[_0x5671('0xff')](_0x2abf7c);}})[_0x5671('0x2b')](function(_0x4af61e){if(_0x4af61e){_0x287328=_0x4af61e[_0x5671('0x53')];if(!_0x2e77f5[_0x5671('0x4e')][_0x5671('0x54')]('nolimit')){_0x2abf7c[_0x5671('0x24')]=qs[_0x5671('0x24')](_0x2e77f5[_0x5671('0x4e')]['limit']);_0x2abf7c['offset']=qs['offset'](_0x2e77f5[_0x5671('0x4e')][_0x5671('0x27')]);}return _0x3c20d0[_0x5671('0xff')](_0x2abf7c);}})['then'](function(_0x29e20c){if(_0x29e20c){return _0x29e20c?{'count':_0x287328,'rows':_0x29e20c}:null;}})[_0x5671('0x2b')](respondWithResult(_0x75ea59,null))[_0x5671('0x20')](handleError(_0x75ea59,null));};exports[_0x5671('0x120')]=function(_0x3c95a9,_0x68010d){var _0x2fa723=_0x3c95a9[_0x5671('0x4e')][_0x5671('0x121')]===_0x5671('0x122')?_0x5671('0x123'):'onlineForm';return db[_0x5671('0x4a')][_0x5671('0x61')]({'attributes':['id',_0x2fa723],'where':{'id':_0x3c95a9['params']['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x68010d,null))['then'](function(_0x4661d5){if(_0x4661d5){var _0x10ef69=_0x4661d5[_0x2fa723];var _0x15b953=_0x10ef69&&_0x10ef69[_0x5671('0x124')]?_0x10ef69[_0x5671('0x124')]:[];_0x68010d[_0x5671('0x31')]({'fromKey':_[_0x5671('0x8e')](_0x10ef69['fromKey'])?undefined:_0x10ef69[_0x5671('0x125')],'count':_0x15b953['length'],'rows':_0x15b953});}})[_0x5671('0x20')](handleError(_0x68010d,null));};exports[_0x5671('0x126')]=function(_0x3fcbf8,_0xc6f1cd){var _0x1a9283={'raw':![],'where':{}};var _0x2fd038={};var _0x10e7a3={'count':0x0,'rows':[]};return db[_0x5671('0x4a')][_0x5671('0x7a')]({'where':{'id':_0x3fcbf8[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0xc6f1cd,null))[_0x5671('0x2b')](function(_0x4b6176){if(_0x4b6176){_0x2fd038[_0x5671('0x42')]=_[_0x5671('0x4f')](db[_0x5671('0xda')][_0x5671('0x4b')]);_0x2fd038[_0x5671('0x4e')]=_[_0x5671('0x4f')](_0x3fcbf8[_0x5671('0x4e')]);_0x2fd038[_0x5671('0x58')]=_['intersection'](_0x2fd038[_0x5671('0x42')],_0x2fd038['query']);_0x1a9283[_0x5671('0x51')]=_[_0x5671('0x50')](_0x2fd038[_0x5671('0x42')],qs[_0x5671('0x52')](_0x3fcbf8[_0x5671('0x4e')][_0x5671('0x52')]));_0x1a9283[_0x5671('0x51')]=_0x1a9283[_0x5671('0x51')][_0x5671('0x53')]?_0x1a9283[_0x5671('0x51')]:_0x2fd038[_0x5671('0x42')];if(!_0x3fcbf8['query'][_0x5671('0x54')]('nolimit')){_0x1a9283[_0x5671('0x24')]=qs['limit'](_0x3fcbf8[_0x5671('0x4e')][_0x5671('0x24')]);_0x1a9283[_0x5671('0x27')]=qs['offset'](_0x3fcbf8[_0x5671('0x4e')][_0x5671('0x27')]);}_0x1a9283[_0x5671('0x74')]=qs[_0x5671('0x56')](_0x3fcbf8[_0x5671('0x4e')][_0x5671('0x56')]);_0x1a9283['where']=qs['filters'](_['pick'](_0x3fcbf8[_0x5671('0x4e')],_0x2fd038[_0x5671('0x58')]));_0x1a9283[_0x5671('0x57')][_0x5671('0x76')]=_0x4b6176['id'];if(_0x3fcbf8[_0x5671('0x4e')][_0x5671('0x59')]){_0x1a9283[_0x5671('0x57')]=_[_0x5671('0x5a')](_0x1a9283['where'],{'$or':_[_0x5671('0x49')](_0x1a9283[_0x5671('0x51')],function(_0x3a997a){var _0x486bc1={};_0x486bc1[_0x3a997a]={'$like':'%'+_0x3fcbf8[_0x5671('0x4e')][_0x5671('0x59')]+'%'};return _0x486bc1;})});}_0x1a9283=_[_0x5671('0x5a')]({},_0x1a9283,_0x3fcbf8['options']);return db['ChatOfflineMessage'][_0x5671('0x26')]({'where':_0x1a9283[_0x5671('0x57')]})[_0x5671('0x2b')](function(_0x314ea2){_0x10e7a3['count']=_0x314ea2;if(_0x3fcbf8[_0x5671('0x4e')][_0x5671('0x5d')]){_0x1a9283[_0x5671('0x5e')]=[{'all':!![]}];}else{_0x1a9283[_0x5671('0x5e')]=[{'model':db[_0x5671('0xa4')],'as':_0x5671('0x127'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0x5671('0xda')][_0x5671('0x5f')](_0x1a9283);})[_0x5671('0x2b')](function(_0x2b0985){_0x10e7a3[_0x5671('0x60')]=_0x2b0985;return _0x10e7a3;});}})['then'](respondWithFilteredResult(_0xc6f1cd,_0x1a9283))['catch'](handleError(_0xc6f1cd,null));};exports[_0x5671('0x128')]=function(_0x2ecaa0,_0x408279){return db[_0x5671('0x4a')]['find']({'where':{'id':_0x2ecaa0[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x408279,null))['then'](function(_0x52ca45){if(_0x52ca45){return _0x52ca45['addAgents'](_0x2ecaa0[_0x5671('0x62')][_0x5671('0x78')],_[_0x5671('0x11e')](_0x2ecaa0[_0x5671('0x62')],[_0x5671('0x78'),'id'])||{})['spread'](function(_0x3eeaf4){for(var _0x1523ad=0x0;_0x1523ad<_0x2ecaa0[_0x5671('0x62')][_0x5671('0x78')][_0x5671('0x53')];_0x1523ad+=0x1){socket[_0x5671('0x129')](_0x5671('0x12a'),{'UserId':Number(_0x2ecaa0['body'][_0x5671('0x78')][_0x1523ad]),'ChatWebsiteId':Number(_0x2ecaa0[_0x5671('0x70')]['id'])});}return _0x3eeaf4;});}})[_0x5671('0x2b')](respondWithResult(_0x408279,null))['catch'](handleError(_0x408279,null));};exports[_0x5671('0x12b')]=function(_0x4876b0,_0x2509da){return db[_0x5671('0x4a')][_0x5671('0x61')]({'where':{'id':_0x4876b0['params']['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x2509da,null))[_0x5671('0x2b')](function(_0x53924c){if(_0x53924c){return _0x53924c['removeAgents'](_0x4876b0['query']['ids'])['then'](function(){if(_[_0x5671('0x12c')](_0x4876b0['query'][_0x5671('0x78')])){for(var _0x15c1da=0x0;_0x15c1da<_0x4876b0['query']['ids'][_0x5671('0x53')];_0x15c1da+=0x1){socket[_0x5671('0x129')](_0x5671('0x12d'),{'UserId':Number(_0x4876b0[_0x5671('0x4e')]['ids'][_0x15c1da]),'ChatWebsiteId':Number(_0x4876b0['params']['id'])});}}else{socket['emit'](_0x5671('0x12d'),{'UserId':Number(_0x4876b0[_0x5671('0x4e')][_0x5671('0x78')]),'ChatWebsiteId':Number(_0x4876b0[_0x5671('0x70')]['id'])});}});}})['then'](respondWithStatusCode(_0x2509da,null))[_0x5671('0x20')](handleError(_0x2509da,null));};exports[_0x5671('0x12e')]=function(_0x4c1b74,_0x179c91){var _0x5cbac0={};var _0x228ff4={};var _0x41ce64;var _0x36df2d;return db['ChatWebsite']['findOne']({'where':{'id':_0x4c1b74[_0x5671('0x70')]['id']}})[_0x5671('0x2b')](handleEntityNotFound(_0x179c91,null))['then'](function(_0x48d278){if(_0x48d278){_0x41ce64=_0x48d278;_0x228ff4[_0x5671('0x42')]=_[_0x5671('0x4f')](db[_0x5671('0xc2')][_0x5671('0x4b')]);_0x228ff4[_0x5671('0x4e')]=_[_0x5671('0x4f')](_0x4c1b74[_0x5671('0x4e')]);_0x228ff4[_0x5671('0x58')]=_['intersection'](_0x228ff4[_0x5671('0x42')],_0x228ff4[_0x5671('0x4e')]);_0x5cbac0[_0x5671('0x51')]=_['intersection'](_0x228ff4[_0x5671('0x42')],qs[_0x5671('0x52')](_0x4c1b74[_0x5671('0x4e')][_0x5671('0x52')]));_0x5cbac0[_0x5671('0x51')]=_0x5cbac0[_0x5671('0x51')][_0x5671('0x53')]?_0x5cbac0[_0x5671('0x51')]:_0x228ff4[_0x5671('0x42')];_0x5cbac0[_0x5671('0x74')]=qs[_0x5671('0x56')](_0x4c1b74[_0x5671('0x4e')][_0x5671('0x56')]);_0x5cbac0[_0x5671('0x57')]=qs['filters'](_[_0x5671('0x75')](_0x4c1b74[_0x5671('0x4e')],_0x228ff4['filters']));if(_0x4c1b74[_0x5671('0x4e')][_0x5671('0x59')]){_0x5cbac0[_0x5671('0x57')]=_[_0x5671('0x5a')](_0x5cbac0[_0x5671('0x57')],{'$or':_[_0x5671('0x49')](_0x5cbac0[_0x5671('0x51')],function(_0x210cf3){var _0x5f27b9={};_0x5f27b9[_0x210cf3]={'$like':'%'+_0x4c1b74[_0x5671('0x4e')]['filter']+'%'};return _0x5f27b9;})});}_0x5cbac0=_[_0x5671('0x5a')]({},_0x5cbac0,_0x4c1b74[_0x5671('0x5c')]);return _0x41ce64[_0x5671('0x12e')](_0x5cbac0);}})[_0x5671('0x2b')](function(_0x32ca38){if(_0x32ca38){_0x36df2d=_0x32ca38[_0x5671('0x53')];if(!_0x4c1b74[_0x5671('0x4e')][_0x5671('0x54')](_0x5671('0x55'))){_0x5cbac0['limit']=qs['limit'](_0x4c1b74[_0x5671('0x4e')]['limit']);_0x5cbac0[_0x5671('0x27')]=qs[_0x5671('0x27')](_0x4c1b74[_0x5671('0x4e')]['offset']);}return _0x41ce64[_0x5671('0x12e')](_0x5cbac0);}})['then'](function(_0x5572e2){if(_0x5572e2){return _0x5572e2?{'count':_0x36df2d,'rows':_0x5572e2}:null;}})[_0x5671('0x2b')](respondWithResult(_0x179c91,null))[_0x5671('0x20')](handleError(_0x179c91,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ea73735..dd99e19 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 _0x4453=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x5d18c9,_0x3ccc2b){var _0x196faa=function(_0x58dde6){while(--_0x58dde6){_0x5d18c9['push'](_0x5d18c9['shift']());}};_0x196faa(++_0x3ccc2b);}(_0x4453,0x9c));var _0x3445=function(_0x6cf5ec,_0x194d2e){_0x6cf5ec=_0x6cf5ec-0x0;var _0x271c4f=_0x4453[_0x6cf5ec];return _0x271c4f;};'use strict';var EventEmitter=require(_0x3445('0x0'));var ChatWebsite=require(_0x3445('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3445('0x2')](0x0);var events={'afterCreate':_0x3445('0x3'),'afterUpdate':'update','afterDestroy':_0x3445('0x4')};function emitEvent(_0x1419a5){return function(_0xfff5,_0x22c15c,_0x461d8a){ChatWebsiteEvents[_0x3445('0x5')](_0x1419a5+':'+_0xfff5['id'],_0xfff5);ChatWebsiteEvents[_0x3445('0x5')](_0x1419a5,_0xfff5);_0x461d8a(null);};}for(var e in events){if(events[_0x3445('0x6')](e)){var event=events[e];ChatWebsite[_0x3445('0x7')](e,emitEvent(event));}}module[_0x3445('0x8')]=ChatWebsiteEvents; \ No newline at end of file +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(_0x48371c,_0x20cbe6){_0x48371c=_0x48371c-0x0;var _0x1ba807=_0xe14b[_0x48371c];return _0x1ba807;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var ChatWebsite=require(_0xbe14('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){ChatWebsiteEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);ChatWebsiteEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];ChatWebsite[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('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 1a669dc..be12546 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 _0xda09=['api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x165ffc,_0x3f9d50){var _0xe2cb59=function(_0x56877a){while(--_0x56877a){_0x165ffc['push'](_0x165ffc['shift']());}};_0xe2cb59(++_0x3f9d50);}(_0xda09,0x76));var _0x9da0=function(_0x20f9f8,_0x3e374c){_0x20f9f8=_0x20f9f8-0x0;var _0x1b10d0=_0xda09[_0x20f9f8];return _0x1b10d0;};'use strict';var _=require(_0x9da0('0x0'));var util=require(_0x9da0('0x1'));var logger=require('../../config/logger')(_0x9da0('0x2'));var moment=require(_0x9da0('0x3'));var BPromise=require('bluebird');var rp=require(_0x9da0('0x4'));var fs=require('fs');var path=require(_0x9da0('0x5'));var rimraf=require(_0x9da0('0x6'));var config=require(_0x9da0('0x7'));var attributes=require(_0x9da0('0x8'));module['exports']=function(_0x28eaea,_0x20ba10){return _0x28eaea[_0x9da0('0x9')](_0x9da0('0xa'),attributes,{'tableName':_0x9da0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0836=['ChatWebsite','chat_websites','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x4e2636,_0x8d131){var _0x49b6c4=function(_0x10ba1a){while(--_0x10ba1a){_0x4e2636['push'](_0x4e2636['shift']());}};_0x49b6c4(++_0x8d131);}(_0x0836,0x182));var _0x6083=function(_0x34f8f3,_0x5377ce){_0x34f8f3=_0x34f8f3-0x0;var _0x2b2ec7=_0x0836[_0x34f8f3];return _0x2b2ec7;};'use strict';var _=require('lodash');var util=require(_0x6083('0x0'));var logger=require(_0x6083('0x1'))(_0x6083('0x2'));var moment=require('moment');var BPromise=require(_0x6083('0x3'));var rp=require(_0x6083('0x4'));var fs=require('fs');var path=require(_0x6083('0x5'));var rimraf=require('rimraf');var config=require(_0x6083('0x6'));var attributes=require(_0x6083('0x7'));module[_0x6083('0x8')]=function(_0x248a78,_0x88ca15){return _0x248a78[_0x6083('0x9')](_0x6083('0xa'),attributes,{'tableName':_0x6083('0xb'),'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 740accd..ad48f80 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 _0xea81=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x3bfe12,_0x13ebc1){var _0x139809=function(_0x2d413f){while(--_0x2d413f){_0x3bfe12['push'](_0x3bfe12['shift']());}};_0x139809(++_0x13ebc1);}(_0xea81,0xbf));var _0x1ea8=function(_0x59b889,_0x4b026c){_0x59b889=_0x59b889-0x0;var _0x470d3f=_0xea81[_0x59b889];return _0x470d3f;};'use strict';var _=require(_0x1ea8('0x0'));var util=require(_0x1ea8('0x1'));var moment=require(_0x1ea8('0x2'));var BPromise=require(_0x1ea8('0x3'));var rs=require(_0x1ea8('0x4'));var fs=require('fs');var Redis=require(_0x1ea8('0x5'));var db=require(_0x1ea8('0x6'))['db'];var utils=require(_0x1ea8('0x7'));var logger=require(_0x1ea8('0x8'))(_0x1ea8('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ea8('0xa')][_0x1ea8('0xb')]({'port':0x232a});config[_0x1ea8('0xc')]=_[_0x1ea8('0xd')](config['redis'],{'host':_0x1ea8('0xe'),'port':0x18eb});var socket=require(_0x1ea8('0xf'))(new Redis(config[_0x1ea8('0xc')]));require(_0x1ea8('0x10'))['register'](socket);function respondWithRpcPromise(_0x29366b,_0x55ad6c,_0x1060ec){return new BPromise(function(_0x59f398,_0x59cf0c){return client[_0x1ea8('0x11')](_0x29366b,_0x1060ec)[_0x1ea8('0x12')](function(_0x36787c){logger['info'](_0x1ea8('0x13'),_0x55ad6c,_0x1ea8('0x14'));logger['debug'](_0x1ea8('0x15'),_0x55ad6c,'request\x20sent',JSON['stringify'](_0x36787c));if(_0x36787c[_0x1ea8('0x16')]){if(_0x36787c[_0x1ea8('0x16')]['code']===0x1f4){logger['error'](_0x1ea8('0x13'),_0x55ad6c,_0x36787c['error']['message']);return _0x59cf0c(_0x36787c[_0x1ea8('0x16')][_0x1ea8('0x17')]);}logger['error'](_0x1ea8('0x13'),_0x55ad6c,_0x36787c[_0x1ea8('0x16')][_0x1ea8('0x17')]);return _0x59f398(_0x36787c[_0x1ea8('0x16')][_0x1ea8('0x17')]);}else{logger[_0x1ea8('0x18')](_0x1ea8('0x13'),_0x55ad6c,_0x1ea8('0x14'));_0x59f398(_0x36787c[_0x1ea8('0x19')][_0x1ea8('0x17')]);}})[_0x1ea8('0x1a')](function(_0x1c175e){logger['error'](_0x1ea8('0x13'),_0x55ad6c,_0x1c175e);_0x59cf0c(_0x1c175e);});});} \ No newline at end of file +var _0x579c=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x579c,0xfe));var _0xc579=function(_0x10dfad,_0x1a7fca){_0x10dfad=_0x10dfad-0x0;var _0x5b2e1b=_0x579c[_0x10dfad];return _0x5b2e1b;};'use strict';var _=require(_0xc579('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc579('0x1'));var rs=require(_0xc579('0x2'));var fs=require('fs');var Redis=require(_0xc579('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc579('0x4'));var logger=require(_0xc579('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc579('0x6'));var client=jayson[_0xc579('0x7')][_0xc579('0x8')]({'port':0x232a});config[_0xc579('0x9')]=_[_0xc579('0xa')](config[_0xc579('0x9')],{'host':_0xc579('0xb'),'port':0x18eb});var socket=require(_0xc579('0xc'))(new Redis(config[_0xc579('0x9')]));require('./chatWebsite.socket')[_0xc579('0xd')](socket);function respondWithRpcPromise(_0xe1d58c,_0x59c827,_0x5d168e){return new BPromise(function(_0x46d536,_0x46364a){return client[_0xc579('0xe')](_0xe1d58c,_0x5d168e)[_0xc579('0xf')](function(_0x5209d2){logger['info'](_0xc579('0x10'),_0x59c827,'request\x20sent');logger[_0xc579('0x11')](_0xc579('0x12'),_0x59c827,_0xc579('0x13'),JSON[_0xc579('0x14')](_0x5209d2));if(_0x5209d2[_0xc579('0x15')]){if(_0x5209d2[_0xc579('0x15')][_0xc579('0x16')]===0x1f4){logger['error'](_0xc579('0x10'),_0x59c827,_0x5209d2[_0xc579('0x15')][_0xc579('0x17')]);return _0x46364a(_0x5209d2[_0xc579('0x15')][_0xc579('0x17')]);}logger[_0xc579('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x59c827,_0x5209d2[_0xc579('0x15')][_0xc579('0x17')]);return _0x46d536(_0x5209d2[_0xc579('0x15')][_0xc579('0x17')]);}else{logger[_0xc579('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x59c827,_0xc579('0x13'));_0x46d536(_0x5209d2[_0xc579('0x19')][_0xc579('0x17')]);}})['catch'](function(_0x4cb52b){logger['error'](_0xc579('0x10'),_0x59c827,_0x4cb52b);_0x46364a(_0x4cb52b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 475578a..cb8f48c 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 _0xb9ab=['remove','update','register','length','./chatWebsite.events','save'];(function(_0x48d2f9,_0x2e4981){var _0x2d9527=function(_0xc37d7b){while(--_0xc37d7b){_0x48d2f9['push'](_0x48d2f9['shift']());}};_0x2d9527(++_0x2e4981);}(_0xb9ab,0xa6));var _0xbb9a=function(_0x305c1f,_0xf8de1c){_0x305c1f=_0x305c1f-0x0;var _0x3579b2=_0xb9ab[_0x305c1f];return _0x3579b2;};'use strict';var ChatWebsiteEvents=require(_0xbb9a('0x0'));var events=[_0xbb9a('0x1'),_0xbb9a('0x2'),_0xbb9a('0x3')];function createListener(_0x4f5ca1,_0x51a914){return function(_0x5b3aea){_0x51a914['emit'](_0x4f5ca1,_0x5b3aea);};}function removeListener(_0x3bd27a,_0x1ffab0){return function(){ChatWebsiteEvents['removeListener'](_0x3bd27a,_0x1ffab0);};}exports[_0xbb9a('0x4')]=function(_0x19499d){for(var _0x1e2d0a=0x0,_0xdad3e6=events[_0xbb9a('0x5')];_0x1e2d0a<_0xdad3e6;_0x1e2d0a++){var _0x4794b0=events[_0x1e2d0a];var _0x38adca=createListener('chatWebsite:'+_0x4794b0,_0x19499d);ChatWebsiteEvents['on'](_0x4794b0,_0x38adca);}}; \ No newline at end of file +var _0x5dd5=['save','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x288b96,_0x53221f){var _0x1123d6=function(_0x3eb99e){while(--_0x3eb99e){_0x288b96['push'](_0x288b96['shift']());}};_0x1123d6(++_0x53221f);}(_0x5dd5,0xe9));var _0x55dd=function(_0x5b688e,_0x36b47c){_0x5b688e=_0x5b688e-0x0;var _0xf41e43=_0x5dd5[_0x5b688e];return _0xf41e43;};'use strict';var ChatWebsiteEvents=require(_0x55dd('0x0'));var events=[_0x55dd('0x1'),'remove','update'];function createListener(_0x45911f,_0x5a1eb1){return function(_0x405367){_0x5a1eb1['emit'](_0x45911f,_0x405367);};}function removeListener(_0x4c8e31,_0x390fd0){return function(){ChatWebsiteEvents[_0x55dd('0x2')](_0x4c8e31,_0x390fd0);};}exports[_0x55dd('0x3')]=function(_0x21f12d){for(var _0x47fa26=0x0,_0x442c55=events[_0x55dd('0x4')];_0x47fa26<_0x442c55;_0x47fa26++){var _0x126962=events[_0x47fa26];var _0x5e1319=createListener(_0x55dd('0x5')+_0x126962,_0x21f12d);ChatWebsiteEvents['on'](_0x126962,_0x5e1319);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index dd38e41..b6a4973 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2af8=['localhost','test','exports','../../../utils/misc','url','URL','replace','trim','([\x5cw]+)'];(function(_0x21309c,_0x97398e){var _0x39af74=function(_0x2c8a79){while(--_0x2c8a79){_0x21309c['push'](_0x21309c['shift']());}};_0x39af74(++_0x97398e);}(_0x2af8,0xf6));var _0x82af=function(_0x381b03,_0x3604d3){_0x381b03=_0x381b03-0x0;var _0x19d10d=_0x2af8[_0x381b03];return _0x19d10d;};var escapeRegExp=require(_0x82af('0x0'))['escapeRegExp'];var URL=require(_0x82af('0x1'))[_0x82af('0x2')];function testWildcardValidity(_0x4fb4ff){var _0x267196=!![];try{new URL(_0x4fb4ff[_0x82af('0x3')]('*','localhost'));}catch(_0x29c672){_0x267196=![];}return _0x267196&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x4fb4ff);}function testWebsiteWithWildcard(_0xafdd39,_0x3de1ed){var _0x4dd422;var _0x3d29ef=escapeRegExp(_0xafdd39[_0x82af('0x4')]()['replace'](/\/$/,''))[_0x82af('0x3')]('\x5c*',_0x82af('0x5'));try{new URL(_0xafdd39[_0x82af('0x3')]('\x5c*',_0x82af('0x6')));_0x4dd422=new RegExp(_0x3d29ef)[_0x82af('0x7')](_0x3de1ed);}catch(_0x38d823){_0x4dd422=![];}return _0x4dd422;}module[_0x82af('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x40f3=['url','test','trim','replace','localhost','exports','escapeRegExp'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x40f3,0x8b));var _0x340f=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x40f3[_0xd511d];return _0x3f148e;};var escapeRegExp=require('../../../utils/misc')[_0x340f('0x0')];var URL=require(_0x340f('0x1'))['URL'];function testWildcardValidity(_0x1f3fab){var _0x208c37=!![];try{new URL(_0x1f3fab['replace']('*','localhost'));}catch(_0x42b102){_0x208c37=![];}return _0x208c37&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x340f('0x2')](_0x1f3fab);}function testWebsiteWithWildcard(_0x5b331a,_0x2b87e6){var _0x496502;var _0x48d1e8=escapeRegExp(_0x5b331a[_0x340f('0x3')]()[_0x340f('0x4')](/\/$/,''))[_0x340f('0x4')]('\x5c*','([\x5cw]+)');try{new URL(_0x5b331a['replace']('\x5c*',_0x340f('0x5')));_0x496502=new RegExp(_0x48d1e8)[_0x340f('0x2')](_0x2b87e6);}catch(_0x112b1f){_0x496502=![];}return _0x496502;}module[_0x340f('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 973601e..89f3cd6 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 _0xa824=['attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addAgents','/:id','destroy','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post','create','addAnswer','root','server/files/images/logos/','%s-%s','now','originalname','file','addLogo','diskStorage','join','/:id/avatar','addAvatar','format','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files'];(function(_0x363958,_0x210039){var _0x2fdcd7=function(_0x325c03){while(--_0x325c03){_0x363958['push'](_0x363958['shift']());}};_0x2fdcd7(++_0x210039);}(_0xa824,0x124));var _0x4a82=function(_0x14da60,_0x5e6ae0){_0x14da60=_0x14da60-0x0;var _0x55dd8c=_0xa824[_0x14da60];return _0x55dd8c;};'use strict';var multer=require(_0x4a82('0x0'));var util=require('util');var path=require(_0x4a82('0x1'));var timeout=require(_0x4a82('0x2'));var express=require(_0x4a82('0x3'));var router=express[_0x4a82('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a82('0x5'));var interaction=require(_0x4a82('0x6'));var config=require(_0x4a82('0x7'));var controller=require('./chatWebsite.controller');router[_0x4a82('0x8')]('/',auth[_0x4a82('0x9')](),controller['index']);router['get'](_0x4a82('0xa'),auth[_0x4a82('0x9')](),controller['describe']);router['get']('/:id',auth[_0x4a82('0x9')](),controller['show']);router[_0x4a82('0x8')](_0x4a82('0xb'),auth[_0x4a82('0x9')](),controller[_0x4a82('0xc')]);router['get'](_0x4a82('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4a82('0x8')](_0x4a82('0xe'),controller[_0x4a82('0xf')]);router['get']('/:id/avatar',controller['getAvatar']);router[_0x4a82('0x8')](_0x4a82('0x10'),controller[_0x4a82('0x11')]);router[_0x4a82('0x8')](_0x4a82('0x12'),controller[_0x4a82('0x13')]);router[_0x4a82('0x8')](_0x4a82('0x14'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x15')]);router['get'](_0x4a82('0x16'),controller[_0x4a82('0x17')]);router[_0x4a82('0x8')](_0x4a82('0x18'),auth['isAuthenticated'](),controller[_0x4a82('0x19')]);router['get'](_0x4a82('0x1a'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x1b')]);router[_0x4a82('0x8')](_0x4a82('0x1c'),controller['getFields']);router[_0x4a82('0x8')](_0x4a82('0x1d'),auth[_0x4a82('0x9')](),controller['getOfflineMessages']);router['get'](_0x4a82('0x1e'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x1f')]);router[_0x4a82('0x20')]('/',auth[_0x4a82('0x9')](),controller[_0x4a82('0x21')]);router[_0x4a82('0x20')](_0x4a82('0xb'),auth[_0x4a82('0x9')](),controller['addDisposition']);router[_0x4a82('0x20')](_0x4a82('0xd'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36cf45,_0x576997,_0x262a90){_0x262a90(null,path['join'](config[_0x4a82('0x23')],_0x4a82('0x24')));},'filename':function(_0x3c0c76,_0x778fff,_0x43f905){_0x43f905(null,util['format'](_0x4a82('0x25'),Date[_0x4a82('0x26')](),_0x778fff[_0x4a82('0x27')]));}})});router[_0x4a82('0x20')](_0x4a82('0xe'),upload['single'](_0x4a82('0x28')),controller[_0x4a82('0x29')]);var upload=multer({'storage':multer[_0x4a82('0x2a')]({'destination':function(_0x3c8b3d,_0x4e4ea7,_0x229510){_0x229510(null,path[_0x4a82('0x2b')](config[_0x4a82('0x23')],'server/files/images/avatars/'));},'filename':function(_0x2a7fdb,_0x3ffb67,_0x46b3bd){_0x46b3bd(null,util['format'](_0x4a82('0x25'),Date[_0x4a82('0x26')](),_0x3ffb67[_0x4a82('0x27')]));}})});router[_0x4a82('0x20')](_0x4a82('0x2c'),upload['single'](_0x4a82('0x28')),controller[_0x4a82('0x2d')]);var upload=multer({'storage':multer[_0x4a82('0x2a')]({'destination':function(_0xdc16e1,_0x2d5783,_0x28fda0){_0x28fda0(null,path['join'](config[_0x4a82('0x23')],'server/files/images/avatars/'));},'filename':function(_0x4873e9,_0xf52a65,_0x3cafd7){_0x3cafd7(null,util[_0x4a82('0x2e')](_0x4a82('0x25'),Date[_0x4a82('0x26')](),_0xf52a65[_0x4a82('0x27')]));}})});router['post'](_0x4a82('0x10'),upload[_0x4a82('0x2f')](_0x4a82('0x28')),controller[_0x4a82('0x30')]);var upload=multer({'storage':multer[_0x4a82('0x2a')]({'destination':function(_0x6ee2bd,_0xef7cd,_0x24a495){_0x24a495(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x41077e,_0x5ca4e3,_0x26c9a4){_0x26c9a4(null,util[_0x4a82('0x2e')](_0x4a82('0x25'),Date[_0x4a82('0x26')](),_0x5ca4e3[_0x4a82('0x27')]));}})});router[_0x4a82('0x20')](_0x4a82('0x12'),upload['single'](_0x4a82('0x28')),controller[_0x4a82('0x31')]);router[_0x4a82('0x20')](_0x4a82('0x32'),controller[_0x4a82('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x4a82('0x2a')]({'destination':function(_0x40f8cb,_0x4d8ac4,_0x2f73a9){const _0x42e133=path['join'](config['root'],_0x4a82('0x34'),_0x4a82('0x35'),_0x4a82('0x36'));fs_extra['ensureDir'](_0x42e133,function(){_0x2f73a9(null,_0x42e133);});},'filename':function(_0x544d9c,_0x22d440,_0x1a7e54){const _0x293dff=_0x22d440['originalname'][_0x4a82('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x546dac=path[_0x4a82('0x38')](_0x293dff);const _0x1058b4=Date[_0x4a82('0x26')]()+'-'+_0x293dff[_0x4a82('0x37')](_0x546dac,'')+_0x546dac;_0x1a7e54(null,_0x1058b4);}})});router[_0x4a82('0x20')](_0x4a82('0x39'),offlineUploadMulter[_0x4a82('0x3a')](),controller[_0x4a82('0x3b')]);router[_0x4a82('0x20')](_0x4a82('0x14'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x3c')]);router[_0x4a82('0x20')]('/:id/applications',auth[_0x4a82('0x9')](),controller[_0x4a82('0x3d')]);router[_0x4a82('0x20')](_0x4a82('0x1a'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x4a82('0x20')](_0x4a82('0x1e'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x3e')]);router['put']('/:id',auth[_0x4a82('0x9')](),controller['update']);router['delete'](_0x4a82('0x3f'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x40')]);router['delete'](_0x4a82('0xb'),auth[_0x4a82('0x9')](),controller['removeDispositions']);router[_0x4a82('0x41')]('/:id/canned_answers',auth[_0x4a82('0x9')](),controller[_0x4a82('0x42')]);router[_0x4a82('0x41')](_0x4a82('0x1e'),auth[_0x4a82('0x9')](),controller[_0x4a82('0x43')]);module[_0x4a82('0x44')]=router; \ No newline at end of file +var _0x3b20=['server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','diskStorage','addSystemAvatar','/:id/notify','notify'];(function(_0x1f1deb,_0x44266a){var _0x301baa=function(_0x91cf35){while(--_0x91cf35){_0x1f1deb['push'](_0x1f1deb['shift']());}};_0x301baa(++_0x44266a);}(_0x3b20,0xeb));var _0x03b2=function(_0x182408,_0x136a4b){_0x182408=_0x182408-0x0;var _0xfa1409=_0x3b20[_0x182408];return _0xfa1409;};'use strict';var multer=require('multer');var util=require(_0x03b2('0x0'));var path=require('path');var timeout=require(_0x03b2('0x1'));var express=require('express');var router=express[_0x03b2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x03b2('0x3'));var interaction=require(_0x03b2('0x4'));var config=require(_0x03b2('0x5'));var controller=require(_0x03b2('0x6'));router['get']('/',auth[_0x03b2('0x7')](),controller[_0x03b2('0x8')]);router[_0x03b2('0x9')]('/describe',auth[_0x03b2('0x7')](),controller[_0x03b2('0xa')]);router[_0x03b2('0x9')](_0x03b2('0xb'),auth[_0x03b2('0x7')](),controller[_0x03b2('0xc')]);router[_0x03b2('0x9')](_0x03b2('0xd'),auth[_0x03b2('0x7')](),controller[_0x03b2('0xe')]);router[_0x03b2('0x9')](_0x03b2('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x03b2('0x9')](_0x03b2('0x10'),controller['getLogo']);router['get'](_0x03b2('0x11'),controller[_0x03b2('0x12')]);router[_0x03b2('0x9')](_0x03b2('0x13'),controller[_0x03b2('0x14')]);router['get'](_0x03b2('0x15'),controller[_0x03b2('0x16')]);router['get']('/:id/interactions',auth[_0x03b2('0x7')](),controller[_0x03b2('0x17')]);router[_0x03b2('0x9')](_0x03b2('0x18'),controller[_0x03b2('0x19')]);router[_0x03b2('0x9')](_0x03b2('0x1a'),auth[_0x03b2('0x7')](),controller['getApplications']);router[_0x03b2('0x9')](_0x03b2('0x1b'),auth[_0x03b2('0x7')](),controller[_0x03b2('0x1c')]);router[_0x03b2('0x9')](_0x03b2('0x1d'),controller[_0x03b2('0x1e')]);router['get']('/:id/offline_messages',auth[_0x03b2('0x7')](),controller[_0x03b2('0x1f')]);router[_0x03b2('0x9')](_0x03b2('0x20'),auth[_0x03b2('0x7')](),controller[_0x03b2('0x21')]);router['post']('/',auth[_0x03b2('0x7')](),controller[_0x03b2('0x22')]);router[_0x03b2('0x23')](_0x03b2('0xd'),auth[_0x03b2('0x7')](),controller[_0x03b2('0x24')]);router[_0x03b2('0x23')](_0x03b2('0xf'),auth[_0x03b2('0x7')](),controller[_0x03b2('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27ef33,_0x41c613,_0x4fd49d){_0x4fd49d(null,path[_0x03b2('0x26')](config[_0x03b2('0x27')],_0x03b2('0x28')));},'filename':function(_0x2fbfc6,_0x4466d1,_0x14e960){_0x14e960(null,util[_0x03b2('0x29')](_0x03b2('0x2a'),Date[_0x03b2('0x2b')](),_0x4466d1[_0x03b2('0x2c')]));}})});router['post'](_0x03b2('0x10'),upload[_0x03b2('0x2d')](_0x03b2('0x2e')),controller[_0x03b2('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x211dcc,_0x20ef37,_0xf58ad2){_0xf58ad2(null,path[_0x03b2('0x26')](config[_0x03b2('0x27')],_0x03b2('0x30')));},'filename':function(_0x3da9e3,_0x45ab41,_0x5c7a84){_0x5c7a84(null,util['format'](_0x03b2('0x2a'),Date[_0x03b2('0x2b')](),_0x45ab41[_0x03b2('0x2c')]));}})});router[_0x03b2('0x23')](_0x03b2('0x11'),upload[_0x03b2('0x2d')](_0x03b2('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0x03b2('0x31')]({'destination':function(_0x272168,_0x525354,_0x29cc40){_0x29cc40(null,path[_0x03b2('0x26')](config[_0x03b2('0x27')],_0x03b2('0x30')));},'filename':function(_0x14ec9e,_0x31b3a2,_0x1b57bb){_0x1b57bb(null,util[_0x03b2('0x29')]('%s-%s',Date[_0x03b2('0x2b')](),_0x31b3a2[_0x03b2('0x2c')]));}})});router['post'](_0x03b2('0x13'),upload[_0x03b2('0x2d')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x03b2('0x31')]({'destination':function(_0x41e120,_0x4ebcb4,_0x1a8505){_0x1a8505(null,path['join'](config[_0x03b2('0x27')],_0x03b2('0x30')));},'filename':function(_0x3c713c,_0x6d56f8,_0x2bd7f2){_0x2bd7f2(null,util['format'](_0x03b2('0x2a'),Date[_0x03b2('0x2b')](),_0x6d56f8[_0x03b2('0x2c')]));}})});router['post'](_0x03b2('0x15'),upload['single'](_0x03b2('0x2e')),controller[_0x03b2('0x32')]);router[_0x03b2('0x23')](_0x03b2('0x33'),controller[_0x03b2('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x03b2('0x31')]({'destination':function(_0x54127b,_0x8a5c05,_0x2a21f6){const _0x1702d1=path[_0x03b2('0x26')](config[_0x03b2('0x27')],_0x03b2('0x35'),_0x03b2('0x36'),'offline-chat');fs_extra[_0x03b2('0x37')](_0x1702d1,function(){_0x2a21f6(null,_0x1702d1);});},'filename':function(_0xe5dba6,_0x1b52a9,_0x2dff91){const _0x23a352=_0x1b52a9[_0x03b2('0x2c')][_0x03b2('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2349bd=path[_0x03b2('0x39')](_0x23a352);const _0x351012=Date[_0x03b2('0x2b')]()+'-'+_0x23a352[_0x03b2('0x38')](_0x2349bd,'')+_0x2349bd;_0x2dff91(null,_0x351012);}})});router['post'](_0x03b2('0x3a'),offlineUploadMulter[_0x03b2('0x3b')](),controller[_0x03b2('0x3c')]);router[_0x03b2('0x23')](_0x03b2('0x3d'),auth['isAuthenticated'](),controller[_0x03b2('0x3e')]);router['post'](_0x03b2('0x1a'),auth['isAuthenticated'](),controller[_0x03b2('0x3f')]);router[_0x03b2('0x23')](_0x03b2('0x1b'),auth[_0x03b2('0x7')](),controller[_0x03b2('0x40')]);router[_0x03b2('0x23')]('/:id/users',auth[_0x03b2('0x7')](),controller[_0x03b2('0x41')]);router[_0x03b2('0x42')](_0x03b2('0xb'),auth[_0x03b2('0x7')](),controller[_0x03b2('0x43')]);router[_0x03b2('0x44')](_0x03b2('0xb'),auth[_0x03b2('0x7')](),controller[_0x03b2('0x45')]);router['delete'](_0x03b2('0xd'),auth[_0x03b2('0x7')](),controller['removeDispositions']);router[_0x03b2('0x44')](_0x03b2('0xf'),auth[_0x03b2('0x7')](),controller['removeAnswers']);router['delete'](_0x03b2('0x20'),auth[_0x03b2('0x7')](),controller[_0x03b2('0x46')]);module[_0x03b2('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 4bae808..b3c0666 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2137=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!'];(function(_0xd3f6f7,_0x4f80a5){var _0x3323db=function(_0x1aa363){while(--_0x1aa363){_0xd3f6f7['push'](_0xd3f6f7['shift']());}};_0x3323db(++_0x4f80a5);}(_0x2137,0x185));var _0x7213=function(_0x4ba54b,_0x46f4de){_0x4ba54b=_0x4ba54b-0x0;var _0x364bfe=_0x2137[_0x4ba54b];return _0x364bfe;};var beaverLogger=require(_0x7213('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x7213('0x1'));var router=express[_0x7213('0x2')]();var isProduction=config[_0x7213('0x3')]===_0x7213('0x4')||![];function clientSideLogs(_0x5ad2c7,_0x57521d,_0x2fe4f6){var _0x3e40b4=_0x5ad2c7[_0x7213('0x5')]['get']('client-side-logger');if(!_0x3e40b4){throw new Error(_0x7213('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0x7213('0x7'),'logger':_0x3e40b4,'enableCors':!isProduction})(_0x5ad2c7,_0x57521d,_0x2fe4f6);}router[_0x7213('0x8')](auth[_0x7213('0x9')](),clientSideLogs);module[_0x7213('0xa')]=router; \ No newline at end of file +var _0x9412=['use','isAuthenticated','exports','beaver-logger/server','express','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9412,0xc6));var _0x2941=function(_0x221230,_0x5ed5cc){_0x221230=_0x221230-0x0;var _0xbdf131=_0x9412[_0x221230];return _0xbdf131;};var beaverLogger=require(_0x2941('0x0'));var express=require(_0x2941('0x1'));var auth=require('../components/auth/service');var config=require(_0x2941('0x2'));var router=express[_0x2941('0x3')]();var isProduction=config[_0x2941('0x4')]===_0x2941('0x5')||![];function clientSideLogs(_0x39020e,_0x33280e,_0x37eff8){var _0x135ecb=_0x39020e[_0x2941('0x6')][_0x2941('0x7')](_0x2941('0x8'));if(!_0x135ecb){throw new Error(_0x2941('0x9'));}return beaverLogger[_0x2941('0xa')]({'uri':_0x2941('0xb'),'logger':_0x135ecb,'enableCors':!isProduction})(_0x39020e,_0x33280e,_0x37eff8);}router[_0x2941('0xc')](auth[_0x2941('0xd')](),clientSideLogs);module[_0x2941('0xe')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index fb8a55e..2ac9e45 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 _0xba2b=['sequelize','exports','STRING','ENUM','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x285a14,_0x394a27){var _0x3430cc=function(_0x46d2d7){while(--_0x46d2d7){_0x285a14['push'](_0x285a14['shift']());}};_0x3430cc(++_0x394a27);}(_0xba2b,0xb4));var _0xbba2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xba2b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xbba2('0x0'));module[_0xbba2('0x1')]={'name':{'type':Sequelize[_0xbba2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xbba2('0x3')]('AmazonAWS','Google',_0xbba2('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xbba2('0x3')](_0xbba2('0x5'),_0xbba2('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0xbba2('0x7')},'data2':{'type':Sequelize[_0xbba2('0x2')],'comment':_0xbba2('0x8')},'data3':{'type':Sequelize[_0xbba2('0x2')],'comment':_0xbba2('0x9')},'data4':{'type':Sequelize[_0xbba2('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xbba2('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xbba2('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xbba2('0xa')],'comment':_0xbba2('0xb')}}; \ No newline at end of file +var _0xc960=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xc960,0x16c));var _0x0c96=function(_0x30f8ba,_0x533118){_0x30f8ba=_0x30f8ba-0x0;var _0xce6c4c=_0xc960[_0x30f8ba];return _0xce6c4c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0c96('0x0')](_0x0c96('0x1'),_0x0c96('0x2'),_0x0c96('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0c96('0x0')](_0x0c96('0x4'),_0x0c96('0x5'))},'data1':{'type':Sequelize[_0x0c96('0x6')],'comment':_0x0c96('0x7')},'data2':{'type':Sequelize[_0x0c96('0x6')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x0c96('0x6')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x0c96('0x6')],'comment':_0x0c96('0x8')},'data5':{'type':Sequelize[_0x0c96('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x0c96('0x9')],'comment':_0x0c96('0xa')},'data7':{'type':Sequelize[_0x0c96('0x9')],'comment':_0x0c96('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index cac89d2..a8aa061 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 _0x9516=['findOne','generateMicrosoftAuthorizationUrl','user','Invalid\x20state\x20parameter','parse','state','base64','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','startRefreshInterval','emit','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','error','name','send','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','include','findAll','service','MicrosoftAzure','decryptString','data3','then','catch','show','params','merge','create','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x9516,0x6e));var _0x6951=function(_0x1a9bdf,_0x43130a){_0x1a9bdf=_0x1a9bdf-0x0;var _0x61a042=_0x9516[_0x1a9bdf];return _0x61a042;};'use strict';var _=require(_0x6951('0x0'));var Redis=require(_0x6951('0x1'));var qs=require(_0x6951('0x2'));var encryptor=require(_0x6951('0x3'));var config=require(_0x6951('0x4'));var logger=require(_0x6951('0x5'))(_0x6951('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0x6951('0x7'));config[_0x6951('0x8')]=_[_0x6951('0x9')](config[_0x6951('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x6951('0x8')]);function respondWithStatusCode(_0x1cb218,_0x1a41a2){_0x1a41a2=_0x1a41a2||0xcc;return function(_0x5027bb){if(_0x5027bb){return _0x1cb218[_0x6951('0xa')](_0x1a41a2);}return _0x1cb218[_0x6951('0xb')](_0x1a41a2)['end']();};}function respondWithResult(_0x324f8a,_0x16a569){_0x16a569=_0x16a569||0xc8;return function(_0x565ef4){if(_0x565ef4){return _0x324f8a['status'](_0x16a569)[_0x6951('0xc')](_0x565ef4);}};}function respondWithFilteredResult(_0x2f2e24,_0x241d67){return function(_0x19fda3){if(_0x19fda3){var _0x4077de=typeof _0x241d67[_0x6951('0xd')]===_0x6951('0xe')&&typeof _0x241d67[_0x6951('0xf')]==='undefined';var _0x5ef329=_0x19fda3[_0x6951('0x10')];var _0x3a48f5=_0x4077de?0x0:_0x241d67['offset'];var _0x41f23b=_0x4077de?_0x19fda3[_0x6951('0x10')]:_0x241d67[_0x6951('0xd')]+_0x241d67[_0x6951('0xf')];var _0x174c50;if(_0x41f23b>=_0x5ef329){_0x41f23b=_0x5ef329;_0x174c50=0xc8;}else{_0x174c50=0xce;}_0x2f2e24[_0x6951('0xb')](_0x174c50);return _0x2f2e24['set'](_0x6951('0x11'),_0x3a48f5+'-'+_0x41f23b+'/'+_0x5ef329)[_0x6951('0xc')](_0x19fda3);}return null;};}function saveUpdates(_0x1aa77d){return function(_0x1f08d7){if(_0x1f08d7){return _0x1f08d7[_0x6951('0x12')](_0x1aa77d)['then'](function(_0x4504fe){return _0x4504fe;});}return null;};}function removeEntity(_0x463806){return function(_0x5e035d){if(_0x5e035d){return _0x5e035d[_0x6951('0x13')]()['then'](function(){_0x463806[_0x6951('0xb')](0xcc)[_0x6951('0x14')]();});}};}function handleEntityNotFound(_0xaaf15d){return function(_0x4d6f14){if(!_0x4d6f14){_0xaaf15d[_0x6951('0xa')](0x194);}return _0x4d6f14;};}function handleError(_0x44bb86,_0x207f92){_0x207f92=_0x207f92||0x1f4;return function(_0x4fccc1){logger[_0x6951('0x15')](_0x4fccc1['stack']);if(_0x4fccc1[_0x6951('0x16')]){delete _0x4fccc1[_0x6951('0x16')];}_0x44bb86[_0x6951('0xb')](_0x207f92)[_0x6951('0x17')](_0x4fccc1);};}function maskClientSecret(_0x192b05){return _['padEnd'](_0x192b05['slice'](0x0,0x3),0x14,'*');}exports[_0x6951('0x18')]=function(_0x5e5a8b,_0x426a94){var _0x141601={},_0x5a61d3={},_0x1e23b1={'count':0x0,'rows':[]};var _0x14613a=_[_0x6951('0x19')](db[_0x6951('0x1a')]['rawAttributes'],function(_0x37bd15){return{'name':_0x37bd15[_0x6951('0x1b')],'type':_0x37bd15[_0x6951('0x1c')][_0x6951('0x1d')]};});_0x5a61d3[_0x6951('0x1e')]=_[_0x6951('0x19')](_0x14613a,'name');_0x5a61d3[_0x6951('0x1f')]=_[_0x6951('0x20')](_0x5e5a8b['query']);_0x5a61d3[_0x6951('0x21')]=_[_0x6951('0x22')](_0x5a61d3[_0x6951('0x1e')],_0x5a61d3['query']);_0x141601[_0x6951('0x23')]=_['intersection'](_0x5a61d3[_0x6951('0x1e')],qs[_0x6951('0x24')](_0x5e5a8b[_0x6951('0x1f')][_0x6951('0x24')]));_0x141601[_0x6951('0x23')]=_0x141601['attributes'][_0x6951('0x25')]?_0x141601['attributes']:_0x5a61d3['model'];if(!_0x5e5a8b['query'][_0x6951('0x26')](_0x6951('0x27'))){_0x141601[_0x6951('0xf')]=qs[_0x6951('0xf')](_0x5e5a8b[_0x6951('0x1f')][_0x6951('0xf')]);_0x141601[_0x6951('0xd')]=qs[_0x6951('0xd')](_0x5e5a8b[_0x6951('0x1f')][_0x6951('0xd')]);}_0x141601[_0x6951('0x28')]=qs[_0x6951('0x29')](_0x5e5a8b[_0x6951('0x1f')][_0x6951('0x29')]);_0x141601['where']=qs[_0x6951('0x21')](_['pick'](_0x5e5a8b['query'],_0x5a61d3[_0x6951('0x21')]),_0x14613a);if(_0x5e5a8b[_0x6951('0x1f')]['filter']){_0x141601[_0x6951('0x2a')]=_['merge'](_0x141601[_0x6951('0x2a')],{'$or':_[_0x6951('0x19')](_0x14613a,function(_0x56bfd0){if(_0x56bfd0[_0x6951('0x1c')]!==_0x6951('0x2b')){var _0x591370={};_0x591370[_0x56bfd0['name']]={'$like':'%'+_0x5e5a8b[_0x6951('0x1f')][_0x6951('0x2c')]+'%'};return _0x591370;}})});}_0x141601=_['merge']({},_0x141601,_0x5e5a8b[_0x6951('0x2d')]);var _0x1cfffb={'where':_0x141601[_0x6951('0x2a')]};return db[_0x6951('0x1a')][_0x6951('0x10')](_0x1cfffb)['then'](function(_0x2b1120){_0x1e23b1[_0x6951('0x10')]=_0x2b1120;if(_0x5e5a8b[_0x6951('0x1f')]['includeAll']){_0x141601[_0x6951('0x2e')]=[{'all':!![]}];}return db[_0x6951('0x1a')][_0x6951('0x2f')](_0x141601);})['then'](function(_0x262bf3){_0x1e23b1['rows']=_[_0x6951('0x19')](_0x262bf3,function(_0x4d4bdc){if(_0x4d4bdc[_0x6951('0x30')]===_0x6951('0x31')){var _0x1876c8=encryptor[_0x6951('0x32')](_0x4d4bdc[_0x6951('0x33')]);_0x4d4bdc[_0x6951('0x33')]=maskClientSecret(_0x1876c8);}return _0x4d4bdc;});return _0x1e23b1;})[_0x6951('0x34')](respondWithFilteredResult(_0x426a94,_0x141601))[_0x6951('0x35')](handleError(_0x426a94,null));};exports[_0x6951('0x36')]=function(_0x38ed05,_0x429036){var _0x34fec3={'raw':!![],'where':{'id':_0x38ed05[_0x6951('0x37')]['id']}},_0x703136={};_0x703136[_0x6951('0x1e')]=_[_0x6951('0x20')](db[_0x6951('0x1a')]['rawAttributes']);_0x703136[_0x6951('0x1f')]=_[_0x6951('0x20')](_0x38ed05[_0x6951('0x1f')]);_0x703136[_0x6951('0x21')]=_[_0x6951('0x22')](_0x703136[_0x6951('0x1e')],_0x703136['query']);_0x34fec3[_0x6951('0x23')]=_[_0x6951('0x22')](_0x703136[_0x6951('0x1e')],qs[_0x6951('0x24')](_0x38ed05['query'][_0x6951('0x24')]));_0x34fec3[_0x6951('0x23')]=_0x34fec3[_0x6951('0x23')][_0x6951('0x25')]?_0x34fec3[_0x6951('0x23')]:_0x703136[_0x6951('0x1e')];if(_0x38ed05[_0x6951('0x1f')]['includeAll']){_0x34fec3[_0x6951('0x2e')]=[{'all':!![]}];}_0x34fec3=_[_0x6951('0x38')]({},_0x34fec3,_0x38ed05[_0x6951('0x2d')]);return db[_0x6951('0x1a')]['find'](_0x34fec3)[_0x6951('0x34')](handleEntityNotFound(_0x429036,null))['then'](function(_0x23b721){if(_0x23b721[_0x6951('0x30')]==='MicrosoftAzure'){var _0x2eeeec=encryptor[_0x6951('0x32')](_0x23b721[_0x6951('0x33')]);_0x23b721['data3']=maskClientSecret(_0x2eeeec);}return _0x23b721;})[_0x6951('0x34')](respondWithResult(_0x429036,null))[_0x6951('0x35')](handleError(_0x429036,null));};exports[_0x6951('0x39')]=function(_0x236b54,_0x3c2c23){if(!_0x236b54[_0x6951('0x3a')][_0x6951('0x16')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x236b54['body'][_0x6951('0x30')])throw new Error(_0x6951('0x3b'));var _0x155da2=db['CloudProvider']['rawAttributes']['service']['values'];if(!_0x155da2[_0x6951('0x3c')](_0x236b54['body']['service']))throw new Error(_0x6951('0x3d')+_0x155da2['join'](',\x20'));if(_0x236b54[_0x6951('0x3a')]['service']===_0x6951('0x31')&&_0x236b54[_0x6951('0x3a')][_0x6951('0x33')]){_0x236b54[_0x6951('0x3a')][_0x6951('0x33')]=encryptor[_0x6951('0x3e')](_0x236b54[_0x6951('0x3a')][_0x6951('0x33')]);}return db[_0x6951('0x1a')]['create'](_0x236b54[_0x6951('0x3a')],{})['then'](respondWithResult(_0x3c2c23,0xc9))[_0x6951('0x35')](handleError(_0x3c2c23,null));};exports[_0x6951('0x12')]=function(_0x1dbca4,_0x454660){if(_0x1dbca4['body']['id']){delete _0x1dbca4[_0x6951('0x3a')]['id'];}return db['CloudProvider'][_0x6951('0x3f')]({'where':{'id':_0x1dbca4[_0x6951('0x37')]['id']}})['then'](handleEntityNotFound(_0x454660,null))[_0x6951('0x34')](function(_0x1b7bd2){if(_0x1b7bd2[_0x6951('0x30')]==='MicrosoftAzure'&&_0x1dbca4[_0x6951('0x3a')][_0x6951('0x33')]){_0x1dbca4[_0x6951('0x3a')][_0x6951('0x33')]=encryptor[_0x6951('0x3e')](_0x1dbca4[_0x6951('0x3a')][_0x6951('0x33')]);}return _0x1b7bd2;})['then'](saveUpdates(_0x1dbca4[_0x6951('0x3a')],null))[_0x6951('0x34')](respondWithResult(_0x454660,null))[_0x6951('0x35')](handleError(_0x454660,null));};exports[_0x6951('0x13')]=function(_0x1180cb,_0x4b9315){return db['CloudProvider'][_0x6951('0x3f')]({'where':{'id':_0x1180cb['params']['id']}})['then'](handleEntityNotFound(_0x4b9315,null))[_0x6951('0x34')](removeEntity(_0x4b9315,null))[_0x6951('0x35')](handleError(_0x4b9315,null));};exports['oauth2MicrosoftAuthorize']=function(_0x323224,_0x2799f7){return db[_0x6951('0x1a')][_0x6951('0x40')]({'where':{'id':_0x323224[_0x6951('0x37')]['id']},'raw':!![]})[_0x6951('0x34')](function(_0x1bb6f5){if(!_0x1bb6f5)return _0x2799f7[_0x6951('0xa')](0x194);return{'url':oauth[_0x6951('0x41')](_0x1bb6f5,_0x323224[_0x6951('0x42')]['id'])};})[_0x6951('0x34')](respondWithResult(_0x2799f7,null))[_0x6951('0x35')](handleError(_0x2799f7,null));};exports['oauth2MicrosoftCallback']=function(_0x155c04,_0x24968e){var _0x5b5f60=_0x155c04[_0x6951('0x3a')];var _0x460677;var _0xda384c;if(_0x5b5f60[_0x6951('0x15')])throw _0x5b5f60;redis['get'](_0x5b5f60['state'])[_0x6951('0x34')](function(_0x2316be){if(!_0x2316be)throw new Error(_0x6951('0x43'));_0x460677=JSON[_0x6951('0x44')](_0x2316be);var _0x2a4e66=Buffer['from'](_0x5b5f60[_0x6951('0x45')],_0x6951('0x46'))[_0x6951('0x47')](_0x6951('0x48'));_0xda384c=JSON[_0x6951('0x44')](_0x2a4e66);if(!oauth['isValidIdToken'](_0x5b5f60[_0x6951('0x49')],_0x460677[_0x6951('0x4a')]))throw new Error(_0x6951('0x4b'));redis[_0x6951('0x4c')](_0x5b5f60[_0x6951('0x45')]);return oauth[_0x6951('0x4d')](_0x5b5f60[_0x6951('0x4e')],_0x460677);})[_0x6951('0x34')](function(_0x219073){_0x460677[_0x6951('0x4f')]=_0x219073[_0x6951('0x50')];_0x460677['data6']=_0x219073[_0x6951('0x51')];return db[_0x6951('0x1a')]['update']({'data5':_0x460677[_0x6951('0x4f')],'data6':_0x460677[_0x6951('0x52')]},{'where':{'id':_0x460677['id']}});})[_0x6951('0x34')](function(){oauth[_0x6951('0x53')](_0x460677);socket[_0x6951('0x54')]('microsoftAuthorization:success',{'id':_0xda384c['id']});return;})[_0x6951('0x34')](respondWithStatusCode(_0x24968e,null))[_0x6951('0x35')](function(_0x359288){if(_0xda384c){socket[_0x6951('0x54')]('microsoftAuthorization:error',{'id':_0xda384c['id']});}if(!_0x460677){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x359288);return _0x24968e[_0x6951('0xb')](0x1f4)[_0x6951('0x17')](_0x359288['message']);}logger[_0x6951('0x15')](_0x6951('0x55'),_0x460677['id'],JSON[_0x6951('0x56')](_0x359288));});}; \ No newline at end of file +var _0xac7f=['../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','Name\x20parameter\x20not\x20specified','body','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','toString','id_token','oauth2Claims','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac7f,0x178));var _0xfac7=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xac7f[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xfac7('0x0'));var Redis=require(_0xfac7('0x1'));var qs=require(_0xfac7('0x2'));var encryptor=require(_0xfac7('0x3'));var config=require(_0xfac7('0x4'));var logger=require(_0xfac7('0x5'))(_0xfac7('0x6'));var db=require(_0xfac7('0x7'))['db'];var oauth=require(_0xfac7('0x8'));config[_0xfac7('0x9')]=_['defaults'](config[_0xfac7('0x9')],{'host':_0xfac7('0xa'),'port':0x18eb});var socket=require(_0xfac7('0xb'))(new Redis(config[_0xfac7('0x9')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x11a3e5,_0x34fbc2){_0x34fbc2=_0x34fbc2||0xcc;return function(_0x4ae476){if(_0x4ae476){return _0x11a3e5[_0xfac7('0xc')](_0x34fbc2);}return _0x11a3e5[_0xfac7('0xd')](_0x34fbc2)[_0xfac7('0xe')]();};}function respondWithResult(_0x9f07d7,_0x2fc7d0){_0x2fc7d0=_0x2fc7d0||0xc8;return function(_0x2d16e3){if(_0x2d16e3){return _0x9f07d7[_0xfac7('0xd')](_0x2fc7d0)[_0xfac7('0xf')](_0x2d16e3);}};}function respondWithFilteredResult(_0x53d4df,_0xb50b26){return function(_0x5a6f06){if(_0x5a6f06){var _0x16fe90=typeof _0xb50b26[_0xfac7('0x10')]===_0xfac7('0x11')&&typeof _0xb50b26[_0xfac7('0x12')]===_0xfac7('0x11');var _0x5ea5b5=_0x5a6f06[_0xfac7('0x13')];var _0x1c2cdd=_0x16fe90?0x0:_0xb50b26['offset'];var _0x12dae3=_0x16fe90?_0x5a6f06[_0xfac7('0x13')]:_0xb50b26[_0xfac7('0x10')]+_0xb50b26[_0xfac7('0x12')];var _0x207faa;if(_0x12dae3>=_0x5ea5b5){_0x12dae3=_0x5ea5b5;_0x207faa=0xc8;}else{_0x207faa=0xce;}_0x53d4df[_0xfac7('0xd')](_0x207faa);return _0x53d4df[_0xfac7('0x14')](_0xfac7('0x15'),_0x1c2cdd+'-'+_0x12dae3+'/'+_0x5ea5b5)[_0xfac7('0xf')](_0x5a6f06);}return null;};}function saveUpdates(_0x4cc9b3){return function(_0x1be897){if(_0x1be897){return _0x1be897[_0xfac7('0x16')](_0x4cc9b3)[_0xfac7('0x17')](function(_0x6e16e){return _0x6e16e;});}return null;};}function removeEntity(_0x251746){return function(_0x5981da){if(_0x5981da){return _0x5981da[_0xfac7('0x18')]()[_0xfac7('0x17')](function(){_0x251746[_0xfac7('0xd')](0xcc)[_0xfac7('0xe')]();});}};}function handleEntityNotFound(_0x5ad289){return function(_0x10e2f5){if(!_0x10e2f5){_0x5ad289[_0xfac7('0xc')](0x194);}return _0x10e2f5;};}function handleError(_0x214f0b,_0x3a9372){_0x3a9372=_0x3a9372||0x1f4;return function(_0x1e5ddb){logger[_0xfac7('0x19')](_0x1e5ddb[_0xfac7('0x1a')]);if(_0x1e5ddb[_0xfac7('0x1b')]){delete _0x1e5ddb[_0xfac7('0x1b')];}_0x214f0b['status'](_0x3a9372)[_0xfac7('0x1c')](_0x1e5ddb);};}function maskClientSecret(_0x583070){return _[_0xfac7('0x1d')](_0x583070['slice'](0x0,0x3),0x14,'*');}exports[_0xfac7('0x1e')]=function(_0x3ecc08,_0x3c3b0c){var _0x4927f7={},_0x54e200={},_0x5346d2={'count':0x0,'rows':[]};var _0x8e8dcc=_[_0xfac7('0x1f')](db[_0xfac7('0x20')][_0xfac7('0x21')],function(_0xd1e4ea){return{'name':_0xd1e4ea[_0xfac7('0x22')],'type':_0xd1e4ea[_0xfac7('0x23')][_0xfac7('0x24')]};});_0x54e200['model']=_['map'](_0x8e8dcc,'name');_0x54e200[_0xfac7('0x25')]=_[_0xfac7('0x26')](_0x3ecc08[_0xfac7('0x25')]);_0x54e200[_0xfac7('0x27')]=_[_0xfac7('0x28')](_0x54e200['model'],_0x54e200[_0xfac7('0x25')]);_0x4927f7[_0xfac7('0x29')]=_[_0xfac7('0x28')](_0x54e200[_0xfac7('0x2a')],qs[_0xfac7('0x2b')](_0x3ecc08[_0xfac7('0x25')][_0xfac7('0x2b')]));_0x4927f7[_0xfac7('0x29')]=_0x4927f7[_0xfac7('0x29')][_0xfac7('0x2c')]?_0x4927f7[_0xfac7('0x29')]:_0x54e200[_0xfac7('0x2a')];if(!_0x3ecc08[_0xfac7('0x25')][_0xfac7('0x2d')](_0xfac7('0x2e'))){_0x4927f7[_0xfac7('0x12')]=qs[_0xfac7('0x12')](_0x3ecc08['query'][_0xfac7('0x12')]);_0x4927f7[_0xfac7('0x10')]=qs[_0xfac7('0x10')](_0x3ecc08[_0xfac7('0x25')][_0xfac7('0x10')]);}_0x4927f7[_0xfac7('0x2f')]=qs[_0xfac7('0x30')](_0x3ecc08[_0xfac7('0x25')][_0xfac7('0x30')]);_0x4927f7[_0xfac7('0x31')]=qs[_0xfac7('0x27')](_[_0xfac7('0x32')](_0x3ecc08[_0xfac7('0x25')],_0x54e200[_0xfac7('0x27')]),_0x8e8dcc);if(_0x3ecc08[_0xfac7('0x25')][_0xfac7('0x33')]){_0x4927f7[_0xfac7('0x31')]=_[_0xfac7('0x34')](_0x4927f7[_0xfac7('0x31')],{'$or':_[_0xfac7('0x1f')](_0x8e8dcc,function(_0x4c35dc){if(_0x4c35dc[_0xfac7('0x23')]!=='VIRTUAL'){var _0x3115ff={};_0x3115ff[_0x4c35dc[_0xfac7('0x1b')]]={'$like':'%'+_0x3ecc08[_0xfac7('0x25')][_0xfac7('0x33')]+'%'};return _0x3115ff;}})});}_0x4927f7=_[_0xfac7('0x34')]({},_0x4927f7,_0x3ecc08[_0xfac7('0x35')]);var _0x238150={'where':_0x4927f7[_0xfac7('0x31')]};return db[_0xfac7('0x20')][_0xfac7('0x13')](_0x238150)[_0xfac7('0x17')](function(_0x421d2d){_0x5346d2[_0xfac7('0x13')]=_0x421d2d;if(_0x3ecc08[_0xfac7('0x25')][_0xfac7('0x36')]){_0x4927f7[_0xfac7('0x37')]=[{'all':!![]}];}return db['CloudProvider'][_0xfac7('0x38')](_0x4927f7);})['then'](function(_0x554874){_0x5346d2[_0xfac7('0x39')]=_[_0xfac7('0x1f')](_0x554874,function(_0x2e11eb){if(_0x2e11eb[_0xfac7('0x3a')]===_0xfac7('0x3b')){var _0x5863d0=encryptor[_0xfac7('0x3c')](_0x2e11eb[_0xfac7('0x3d')]);_0x2e11eb[_0xfac7('0x3d')]=maskClientSecret(_0x5863d0);}return _0x2e11eb;});return _0x5346d2;})[_0xfac7('0x17')](respondWithFilteredResult(_0x3c3b0c,_0x4927f7))[_0xfac7('0x3e')](handleError(_0x3c3b0c,null));};exports[_0xfac7('0x3f')]=function(_0x3daf38,_0x119c18){var _0x14dc5c={'raw':!![],'where':{'id':_0x3daf38[_0xfac7('0x40')]['id']}},_0x6c08c={};_0x6c08c['model']=_[_0xfac7('0x26')](db[_0xfac7('0x20')][_0xfac7('0x21')]);_0x6c08c[_0xfac7('0x25')]=_[_0xfac7('0x26')](_0x3daf38[_0xfac7('0x25')]);_0x6c08c['filters']=_[_0xfac7('0x28')](_0x6c08c['model'],_0x6c08c[_0xfac7('0x25')]);_0x14dc5c['attributes']=_[_0xfac7('0x28')](_0x6c08c[_0xfac7('0x2a')],qs[_0xfac7('0x2b')](_0x3daf38[_0xfac7('0x25')][_0xfac7('0x2b')]));_0x14dc5c[_0xfac7('0x29')]=_0x14dc5c[_0xfac7('0x29')][_0xfac7('0x2c')]?_0x14dc5c['attributes']:_0x6c08c[_0xfac7('0x2a')];if(_0x3daf38[_0xfac7('0x25')][_0xfac7('0x36')]){_0x14dc5c[_0xfac7('0x37')]=[{'all':!![]}];}_0x14dc5c=_['merge']({},_0x14dc5c,_0x3daf38['options']);return db[_0xfac7('0x20')][_0xfac7('0x41')](_0x14dc5c)[_0xfac7('0x17')](handleEntityNotFound(_0x119c18,null))['then'](function(_0x2bd7c9){if(_0x2bd7c9[_0xfac7('0x3a')]==='MicrosoftAzure'){var _0x48e1e3=encryptor['decryptString'](_0x2bd7c9[_0xfac7('0x3d')]);_0x2bd7c9['data3']=maskClientSecret(_0x48e1e3);}return _0x2bd7c9;})[_0xfac7('0x17')](respondWithResult(_0x119c18,null))[_0xfac7('0x3e')](handleError(_0x119c18,null));};exports[_0xfac7('0x42')]=function(_0x1d3f42,_0x18e1d7){if(!_0x1d3f42['body']['name'])throw new Error(_0xfac7('0x43'));if(!_0x1d3f42[_0xfac7('0x44')][_0xfac7('0x3a')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x4d59cd=db[_0xfac7('0x20')][_0xfac7('0x21')][_0xfac7('0x3a')]['values'];if(!_0x4d59cd[_0xfac7('0x45')](_0x1d3f42[_0xfac7('0x44')][_0xfac7('0x3a')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x4d59cd[_0xfac7('0x46')](',\x20'));if(_0x1d3f42[_0xfac7('0x44')]['service']==='MicrosoftAzure'&&_0x1d3f42['body']['data3']){_0x1d3f42[_0xfac7('0x44')]['data3']=encryptor[_0xfac7('0x47')](_0x1d3f42['body']['data3']);}return db[_0xfac7('0x20')][_0xfac7('0x42')](_0x1d3f42[_0xfac7('0x44')],{})['then'](respondWithResult(_0x18e1d7,0xc9))['catch'](handleError(_0x18e1d7,null));};exports[_0xfac7('0x16')]=function(_0x381c07,_0x47e583){if(_0x381c07[_0xfac7('0x44')]['id']){delete _0x381c07[_0xfac7('0x44')]['id'];}return db[_0xfac7('0x20')][_0xfac7('0x41')]({'where':{'id':_0x381c07[_0xfac7('0x40')]['id']}})[_0xfac7('0x17')](handleEntityNotFound(_0x47e583,null))['then'](function(_0xbbf494){if(_0xbbf494[_0xfac7('0x3a')]==='MicrosoftAzure'&&_0x381c07['body']['data3']){_0x381c07[_0xfac7('0x44')][_0xfac7('0x3d')]=encryptor[_0xfac7('0x47')](_0x381c07[_0xfac7('0x44')][_0xfac7('0x3d')]);}return _0xbbf494;})[_0xfac7('0x17')](saveUpdates(_0x381c07[_0xfac7('0x44')],null))[_0xfac7('0x17')](respondWithResult(_0x47e583,null))['catch'](handleError(_0x47e583,null));};exports[_0xfac7('0x18')]=function(_0x369068,_0x59b29e){return db[_0xfac7('0x20')]['find']({'where':{'id':_0x369068['params']['id']}})[_0xfac7('0x17')](handleEntityNotFound(_0x59b29e,null))['then'](removeEntity(_0x59b29e,null))['catch'](handleError(_0x59b29e,null));};exports[_0xfac7('0x48')]=function(_0x1569c6,_0x240095){return db[_0xfac7('0x20')][_0xfac7('0x49')]({'where':{'id':_0x1569c6['params']['id']},'raw':!![]})[_0xfac7('0x17')](function(_0x284ead){if(!_0x284ead)return _0x240095[_0xfac7('0xc')](0x194);return{'url':oauth[_0xfac7('0x4a')](_0x284ead,_0x1569c6[_0xfac7('0x4b')]['id'])};})['then'](respondWithResult(_0x240095,null))[_0xfac7('0x3e')](handleError(_0x240095,null));};exports[_0xfac7('0x4c')]=function(_0x946057,_0x5cdb7f){var _0x4daa49=_0x946057[_0xfac7('0x44')];var _0x5315a8;var _0x4af104;if(_0x4daa49['error'])throw _0x4daa49;redis['get'](_0x4daa49[_0xfac7('0x4d')])[_0xfac7('0x17')](function(_0x5dd355){if(!_0x5dd355)throw new Error(_0xfac7('0x4e'));_0x5315a8=JSON[_0xfac7('0x4f')](_0x5dd355);var _0xf716c9=Buffer[_0xfac7('0x50')](_0x4daa49[_0xfac7('0x4d')],'base64')[_0xfac7('0x51')]('ascii');_0x4af104=JSON[_0xfac7('0x4f')](_0xf716c9);if(!oauth['isValidIdToken'](_0x4daa49[_0xfac7('0x52')],_0x5315a8[_0xfac7('0x53')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x4daa49[_0xfac7('0x4d')]);return oauth['getOauth2MicrosoftAccessToken'](_0x4daa49[_0xfac7('0x54')],_0x5315a8);})['then'](function(_0x6fac35){_0x5315a8[_0xfac7('0x55')]=_0x6fac35[_0xfac7('0x56')];_0x5315a8[_0xfac7('0x57')]=_0x6fac35[_0xfac7('0x58')];return db[_0xfac7('0x20')][_0xfac7('0x16')]({'data5':_0x5315a8[_0xfac7('0x55')],'data6':_0x5315a8['data6']},{'where':{'id':_0x5315a8['id']}});})[_0xfac7('0x17')](function(){oauth[_0xfac7('0x59')](_0x5315a8);socket[_0xfac7('0x5a')](_0xfac7('0x5b'),{'id':_0x4af104['id']});return;})[_0xfac7('0x17')](respondWithStatusCode(_0x5cdb7f,null))['catch'](function(_0x37163e){if(_0x4af104){socket[_0xfac7('0x5a')]('microsoftAuthorization:error',{'id':_0x4af104['id']});}if(!_0x5315a8){logger[_0xfac7('0x19')]('Invalid\x20authentication\x20state\x20parameter',_0x37163e);return _0x5cdb7f['status'](0x1f4)[_0xfac7('0x1c')](_0x37163e[_0xfac7('0x5c')]);}logger[_0xfac7('0x19')](_0xfac7('0x5d'),_0x5315a8['id'],JSON[_0xfac7('0x5e')](_0x37163e));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f6a6133..b8b9e95 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 _0xea6c=['CloudProvider','cloud_providers','util','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2cf805,_0x330700){var _0x18bbaf=function(_0x539276){while(--_0x539276){_0x2cf805['push'](_0x2cf805['shift']());}};_0x18bbaf(++_0x330700);}(_0xea6c,0x124));var _0xcea6=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0xea6c[_0x3181cc];return _0x547a4a;};'use strict';var _=require('lodash');var util=require(_0xcea6('0x0'));var logger=require('../../config/logger')(_0xcea6('0x1'));var moment=require('moment');var BPromise=require(_0xcea6('0x2'));var rp=require(_0xcea6('0x3'));var fs=require('fs');var path=require(_0xcea6('0x4'));var rimraf=require('rimraf');var config=require(_0xcea6('0x5'));var attributes=require('./cloudProvider.attributes');module[_0xcea6('0x6')]=function(_0x30fbd4,_0x3f1627){return _0x30fbd4[_0xcea6('0x7')](_0xcea6('0x8'),attributes,{'tableName':_0xcea6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95f5=['api','request-promise','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','../../config/logger'];(function(_0x20c2d2,_0x2c31a0){var _0x10f4b3=function(_0x42314e){while(--_0x42314e){_0x20c2d2['push'](_0x20c2d2['shift']());}};_0x10f4b3(++_0x2c31a0);}(_0x95f5,0x1c0));var _0x595f=function(_0x4bf27a,_0x435cc2){_0x4bf27a=_0x4bf27a-0x0;var _0x22a0ba=_0x95f5[_0x4bf27a];return _0x22a0ba;};'use strict';var _=require(_0x595f('0x0'));var util=require(_0x595f('0x1'));var logger=require(_0x595f('0x2'))(_0x595f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x595f('0x4'));var fs=require('fs');var path=require(_0x595f('0x5'));var rimraf=require('rimraf');var config=require(_0x595f('0x6'));var attributes=require(_0x595f('0x7'));module['exports']=function(_0x2a1d5c,_0x4f65d3){return _0x2a1d5c[_0x595f('0x8')](_0x595f('0x9'),attributes,{'tableName':_0x595f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index a90e1dc..4e9b367 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf829=['openid','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','/.default','join','Outlook365','data7','replace','data2','code','id_token','from','stringify','base64','randomBytes','hex','client_id','data1','response_type','data4','form_post','scope','state','prompt','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','audience','nonce','isAfter','unix','exp','resolve','then','findOne','refresh_token','decryptString','data3','POST','{TENANT_ID}','data5','access_token','data6','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','map','all','inspect','exports','crypto','moment','ioredis','request-promise','util','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf829,0x17a));var _0x9f82=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xf829[_0x1c9c24];return _0x349c69;};'use strict';var _=require('lodash');var crypto=require(_0x9f82('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0x9f82('0x1'));var Redis=require(_0x9f82('0x2'));var rp=require(_0x9f82('0x3'));var util=require(_0x9f82('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0x9f82('0x5'));var logger=require('../../config/logger')('api');var schedule=require(_0x9f82('0x6'));var db=require(_0x9f82('0x7'))['db'];config[_0x9f82('0x8')]=_[_0x9f82('0x9')](config[_0x9f82('0x8')],{'host':_0x9f82('0xa'),'port':0x18eb});var redis=new Redis(config[_0x9f82('0x8')]);var MICROSOFT_AUTH_URL=_0x9f82('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9f82('0xc'),'profile','email',_0x9f82('0xd'),_0x9f82('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0x9f82('0xf')],'Dynamics365':['openid',_0x9f82('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x9f82('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x9f82('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4bdd3c){var _0x364796=_['map'](AZURE_AUTH_SCOPES[_0x4bdd3c[_0x9f82('0x12')]]);if(_0x4bdd3c[_0x9f82('0x12')]===_0x9f82('0x13'))_0x364796['push'](_0x4bdd3c['data7']+_0x9f82('0x14'));return _0x364796[_0x9f82('0x15')]('\x20');}function getAccessTokenScope(_0x32170b){if(_0x32170b['type']===_0x9f82('0x16'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x32170b[_0x9f82('0x12')]===_0x9f82('0x13'))return _0x32170b[_0x9f82('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x57b947,_0xb27add){var _0x37b83d=MICROSOFT_AUTH_URL[_0x9f82('0x18')]('{TENANT_ID}',_0x57b947[_0x9f82('0x19')]);var _0xdec93b=[_0x9f82('0x1a'),_0x9f82('0x1b')];var _0x3a879e=Buffer[_0x9f82('0x1c')](JSON[_0x9f82('0x1d')]({'id':_0xb27add}))['toString'](_0x9f82('0x1e'));var _0x35ac40=crypto[_0x9f82('0x1f')](0x10)['toString'](_0x9f82('0x20'));var _0x4ca8f1=getAuthorizationScopes(_0x57b947);var _0x45cf99=[{'key':_0x9f82('0x21'),'value':_0x57b947[_0x9f82('0x22')]},{'key':_0x9f82('0x23'),'value':encodeURIComponent(_0xdec93b[_0x9f82('0x15')]('\x20'))},{'key':'redirect_uri','value':_0x57b947[_0x9f82('0x24')]},{'key':'response_mode','value':_0x9f82('0x25')},{'key':_0x9f82('0x26'),'value':encodeURIComponent(_0x4ca8f1)},{'key':_0x9f82('0x27'),'value':_0x3a879e},{'key':'nonce','value':_0x35ac40},{'key':_0x9f82('0x28'),'value':'login'}];var _0x23ac4f=_0x37b83d+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x45cf99,function(_0x43eb2f){return _0x43eb2f[_0x9f82('0x29')]+'='+_0x43eb2f[_0x9f82('0x2a')];})[_0x9f82('0x15')]('&');_0x57b947[_0x9f82('0x2b')]={'issuer':_0x37b83d[_0x9f82('0x18')](_0x9f82('0x2c'),''),'audience':_0x57b947[_0x9f82('0x22')],'state':_0x3a879e,'nonce':_0x35ac40};redis[_0x9f82('0x2d')](_0x3a879e,JSON[_0x9f82('0x1d')](_0x57b947));return _0x23ac4f;}function isValidIdToken(_0x1e2247,_0x31d450){try{var _0x351cd4=jwt[_0x9f82('0x2e')](_0x1e2247,{'complete':!![]});var _0x253869=_0x351cd4[_0x9f82('0x2f')];if(_0x253869[_0x9f82('0x30')]!==_0x31d450['issuer'])return![];if(_0x253869['aud']!==_0x31d450[_0x9f82('0x31')])return![];if(_0x253869[_0x9f82('0x32')]!==_0x31d450[_0x9f82('0x32')])return![];if(moment()[_0x9f82('0x33')](moment[_0x9f82('0x34')](_0x253869[_0x9f82('0x35')])))return![];return!![];}catch(_0x15c63b){throw _0x15c63b;}}function refreshOauth2MicrosoftAccessToken(_0x2b6946){return Promise[_0x9f82('0x36')]()[_0x9f82('0x37')](function(){if(_0x2b6946['data3'])return _0x2b6946;return db['CloudProvider'][_0x9f82('0x38')]({'where':{'id':_0x2b6946['id']},'raw':!![]});})[_0x9f82('0x37')](function(_0x5b466f){var _0x246139={'grant_type':_0x9f82('0x39'),'refresh_token':_0x5b466f['data6'],'scope':getAccessTokenScope(_0x5b466f),'redirect_uri':_0x5b466f[_0x9f82('0x24')],'client_id':_0x5b466f['data1'],'client_secret':encryptor[_0x9f82('0x3a')](_0x5b466f[_0x9f82('0x3b')])};var _0x466f31={'method':_0x9f82('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x9f82('0x18')](_0x9f82('0x3d'),_0x5b466f[_0x9f82('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x246139,'json':!![]};return rp(_0x466f31);})['then'](function(_0x32caf6){_0x2b6946[_0x9f82('0x3e')]=_0x32caf6[_0x9f82('0x3f')];_0x2b6946[_0x9f82('0x40')]=_0x32caf6[_0x9f82('0x39')];return db[_0x9f82('0x41')][_0x9f82('0x42')]({'data5':_0x2b6946[_0x9f82('0x3e')],'data6':_0x2b6946[_0x9f82('0x40')]},{'where':{'id':_0x2b6946['id']}});})[_0x9f82('0x37')](function(){return _0x2b6946;})[_0x9f82('0x43')](function(_0x27cd3d){logger[_0x9f82('0x44')](_0x9f82('0x45'),_0x2b6946['id'],_0x27cd3d);});}function getOauth2MicrosoftAccessToken(_0x5a44d4,_0x34d60c){var _0x59f7ed={'grant_type':_0x9f82('0x46'),'code':_0x5a44d4,'scope':getAccessTokenScope(_0x34d60c),'redirect_uri':_0x34d60c[_0x9f82('0x24')],'client_id':_0x34d60c[_0x9f82('0x22')],'client_secret':encryptor[_0x9f82('0x3a')](_0x34d60c[_0x9f82('0x3b')])};var _0x4e7550={'method':_0x9f82('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x9f82('0x18')](_0x9f82('0x3d'),_0x34d60c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x59f7ed,'json':!![]};return rp(_0x4e7550);}function startRefreshInterval(_0x5a260f){var _0x50a4dd=schedule[_0x9f82('0x47')];if(_0x50a4dd[_0x5a260f['id']])clearInterval(_0x50a4dd[_0x5a260f['id']]);_0x50a4dd[_0x5a260f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9f82('0x48')](this,{'id':_0x5a260f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x50a4dd;}function startAllRefreshIntervals(){return db[_0x9f82('0x41')][_0x9f82('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9f82('0x37')](function(_0x242a3e){var _0x361b5a=_0x242a3e[_0x9f82('0x4a')](function(_0x1a9e1a){return refreshOauth2MicrosoftAccessToken(_0x1a9e1a)[_0x9f82('0x37')](function(_0x132fda){startRefreshInterval(_0x132fda);});});return Promise[_0x9f82('0x4b')](_0x361b5a);})[_0x9f82('0x43')](function(_0xe4c737){var _0xd974a8=_0xe4c737?util[_0x9f82('0x4c')](_0xe4c737,{'showHidden':![],'depth':null}):'';logger[_0x9f82('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0xd974a8);});}module[_0x9f82('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x0919=['offline_access','https://outlook.office.com/POP.AccessAsUser.All','/token','type','Dynamics365','push','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','data7','/.default','{TENANT_ID}','data2','code','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','form_post','state','nonce','prompt','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','audience','isAfter','unix','exp','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','replace','update','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','POST','intervals','map','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','defaults','redis','localhost','openid','profile','email'];(function(_0x522fb1,_0x2981c5){var _0x32972a=function(_0x3e26c8){while(--_0x3e26c8){_0x522fb1['push'](_0x522fb1['shift']());}};_0x32972a(++_0x2981c5);}(_0x0919,0x16d));var _0x9091=function(_0x39665a,_0xc729df){_0x39665a=_0x39665a-0x0;var _0x173185=_0x0919[_0x39665a];return _0x173185;};'use strict';var _=require(_0x9091('0x0'));var crypto=require(_0x9091('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0x9091('0x2'));var rp=require(_0x9091('0x3'));var util=require(_0x9091('0x4'));var encryptor=require(_0x9091('0x5'));var config=require(_0x9091('0x6'));var logger=require(_0x9091('0x7'))(_0x9091('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9091('0x9')](config[_0x9091('0xa')],{'host':_0x9091('0xb'),'port':0x18eb});var redis=new Redis(config[_0x9091('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x9091('0xc'),_0x9091('0xd'),_0x9091('0xe'),_0x9091('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x9091('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x9091('0xc'),_0x9091('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x9091('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x108f9c){var _0x239680=_['map'](AZURE_AUTH_SCOPES[_0x108f9c[_0x9091('0x12')]]);if(_0x108f9c[_0x9091('0x12')]===_0x9091('0x13'))_0x239680[_0x9091('0x14')](_0x108f9c['data7']+'/.default');return _0x239680[_0x9091('0x15')]('\x20');}function getAccessTokenScope(_0x42ed78){if(_0x42ed78['type']===_0x9091('0x16'))return _0x9091('0x17');if(_0x42ed78[_0x9091('0x12')]===_0x9091('0x13'))return _0x42ed78[_0x9091('0x18')]+_0x9091('0x19');}function generateMicrosoftAuthorizationUrl(_0x7a1f6d,_0x534b07){var _0x3755d6=MICROSOFT_AUTH_URL['replace'](_0x9091('0x1a'),_0x7a1f6d[_0x9091('0x1b')]);var _0x5cec0e=[_0x9091('0x1c'),'id_token'];var _0x592f3a=Buffer[_0x9091('0x1d')](JSON[_0x9091('0x1e')]({'id':_0x534b07}))[_0x9091('0x1f')](_0x9091('0x20'));var _0x4c1c06=crypto[_0x9091('0x21')](0x10)[_0x9091('0x1f')](_0x9091('0x22'));var _0x223d57=getAuthorizationScopes(_0x7a1f6d);var _0x245e84=[{'key':_0x9091('0x23'),'value':_0x7a1f6d[_0x9091('0x24')]},{'key':_0x9091('0x25'),'value':encodeURIComponent(_0x5cec0e[_0x9091('0x15')]('\x20'))},{'key':_0x9091('0x26'),'value':_0x7a1f6d[_0x9091('0x27')]},{'key':'response_mode','value':_0x9091('0x28')},{'key':'scope','value':encodeURIComponent(_0x223d57)},{'key':_0x9091('0x29'),'value':_0x592f3a},{'key':_0x9091('0x2a'),'value':_0x4c1c06},{'key':_0x9091('0x2b'),'value':'login'}];var _0x36564c=_0x3755d6+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x245e84,function(_0x24b90b){return _0x24b90b['key']+'='+_0x24b90b[_0x9091('0x2c')];})[_0x9091('0x15')]('&');_0x7a1f6d[_0x9091('0x2d')]={'issuer':_0x3755d6['replace'](_0x9091('0x2e'),''),'audience':_0x7a1f6d[_0x9091('0x24')],'state':_0x592f3a,'nonce':_0x4c1c06};redis[_0x9091('0x2f')](_0x592f3a,JSON['stringify'](_0x7a1f6d));return _0x36564c;}function isValidIdToken(_0x1efef3,_0x562979){try{var _0x5a4f06=jwt[_0x9091('0x30')](_0x1efef3,{'complete':!![]});var _0x9814=_0x5a4f06[_0x9091('0x31')];if(_0x9814[_0x9091('0x32')]!==_0x562979[_0x9091('0x33')])return![];if(_0x9814['aud']!==_0x562979[_0x9091('0x34')])return![];if(_0x9814['nonce']!==_0x562979[_0x9091('0x2a')])return![];if(moment()[_0x9091('0x35')](moment[_0x9091('0x36')](_0x9814[_0x9091('0x37')])))return![];return!![];}catch(_0x2923e4){throw _0x2923e4;}}function refreshOauth2MicrosoftAccessToken(_0x1e315f){return Promise['resolve']()[_0x9091('0x38')](function(){if(_0x1e315f['data3'])return _0x1e315f;return db[_0x9091('0x39')][_0x9091('0x3a')]({'where':{'id':_0x1e315f['id']},'raw':!![]});})[_0x9091('0x38')](function(_0x20b071){var _0x1d1c83={'grant_type':_0x9091('0x3b'),'refresh_token':_0x20b071[_0x9091('0x3c')],'scope':getAccessTokenScope(_0x20b071),'redirect_uri':_0x20b071[_0x9091('0x27')],'client_id':_0x20b071['data1'],'client_secret':encryptor[_0x9091('0x3d')](_0x20b071[_0x9091('0x3e')])};var _0x244f33={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x9091('0x3f')](_0x9091('0x1a'),_0x20b071[_0x9091('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1d1c83,'json':!![]};return rp(_0x244f33);})[_0x9091('0x38')](function(_0x26d399){_0x1e315f['data5']=_0x26d399['access_token'];_0x1e315f['data6']=_0x26d399[_0x9091('0x3b')];return db[_0x9091('0x39')][_0x9091('0x40')]({'data5':_0x1e315f[_0x9091('0x41')],'data6':_0x1e315f[_0x9091('0x3c')]},{'where':{'id':_0x1e315f['id']}});})[_0x9091('0x38')](function(){return _0x1e315f;})['catch'](function(_0x2d9683){logger[_0x9091('0x42')](_0x9091('0x43'),_0x1e315f['id'],_0x2d9683);});}function getOauth2MicrosoftAccessToken(_0x1ce5cb,_0x64f828){var _0x48e510={'grant_type':'authorization_code','code':_0x1ce5cb,'scope':getAccessTokenScope(_0x64f828),'redirect_uri':_0x64f828[_0x9091('0x27')],'client_id':_0x64f828[_0x9091('0x24')],'client_secret':encryptor[_0x9091('0x3d')](_0x64f828[_0x9091('0x3e')])};var _0x573d2d={'method':_0x9091('0x44'),'uri':MICROSOFT_AUTH_URL['replace'](_0x9091('0x1a'),_0x64f828[_0x9091('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x48e510,'json':!![]};return rp(_0x573d2d);}function startRefreshInterval(_0xe226fa){var _0x459834=schedule[_0x9091('0x45')];if(_0x459834[_0xe226fa['id']])clearInterval(_0x459834[_0xe226fa['id']]);_0x459834[_0xe226fa['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0xe226fa['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x459834;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9091('0x38')](function(_0x401862){var _0x4dbdba=_0x401862[_0x9091('0x46')](function(_0x154267){return refreshOauth2MicrosoftAccessToken(_0x154267)['then'](function(_0x4e070a){startRefreshInterval(_0x4e070a);});});return Promise[_0x9091('0x47')](_0x4dbdba);})[_0x9091('0x48')](function(_0x401733){var _0x58b5dd=_0x401733?util[_0x9091('0x49')](_0x401733,{'showHidden':![],'depth':null}):'';logger['error'](_0x9091('0x4a'),_0x58b5dd);});}module[_0x9091('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 97aa899..a11154d 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 _0x2deb=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var moment=require(_0xb2de('0x2'));var BPromise=require(_0xb2de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2de('0x4'))['db'];var utils=require(_0xb2de('0x5'));var logger=require(_0xb2de('0x6'))(_0xb2de('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2de('0x8')][_0xb2de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191004,_0x49307b,_0x253d0b){return new BPromise(function(_0x1a4c44,_0x53ab0e){return client[_0xb2de('0xa')](_0x191004,_0x253d0b)[_0xb2de('0xb')](function(_0x1d40ec){logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));logger[_0xb2de('0xe')](_0xb2de('0xf'),_0x49307b,'request\x20sent',JSON['stringify'](_0x1d40ec));if(_0x1d40ec[_0xb2de('0x10')]){if(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x11')]===0x1f4){logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);return _0x53ab0e(_0x1d40ec['error'][_0xb2de('0x12')]);}logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec['error'][_0xb2de('0x12')]);return _0x1a4c44(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);}else{logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));_0x1a4c44(_0x1d40ec[_0xb2de('0x13')][_0xb2de('0x12')]);}})[_0xb2de('0x14')](function(_0x2dc15c){logger[_0xb2de('0x10')](_0xb2de('0xc'),_0x49307b,_0x2dc15c);_0x53ab0e(_0x2dc15c);});});} \ No newline at end of file +var _0xfe39=['../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x552c3d,_0x3ba8d1){var _0x107aa7=function(_0x134dcf){while(--_0x134dcf){_0x552c3d['push'](_0x552c3d['shift']());}};_0x107aa7(++_0x3ba8d1);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xfe39[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var moment=require('moment');var BPromise=require(_0x9fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fe3('0x3'))['db'];var utils=require(_0x9fe3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fe3('0x5'));var jayson=require(_0x9fe3('0x6'));var client=jayson[_0x9fe3('0x7')][_0x9fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc469b7,_0x4183ce,_0x25868f){return new BPromise(function(_0x5a3bd6,_0x211eb2){return client[_0x9fe3('0x9')](_0xc469b7,_0x25868f)[_0x9fe3('0xa')](function(_0x35c391){logger[_0x9fe3('0xb')](_0x9fe3('0xc'),_0x4183ce,'request\x20sent');logger['debug'](_0x9fe3('0xd'),_0x4183ce,_0x9fe3('0xe'),JSON['stringify'](_0x35c391));if(_0x35c391[_0x9fe3('0xf')]){if(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x10')]===0x1f4){logger[_0x9fe3('0xf')]('CloudProvider,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x211eb2(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x5a3bd6(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}else{logger[_0x9fe3('0xb')]('CloudProvider,\x20%s,\x20%s',_0x4183ce,'request\x20sent');_0x5a3bd6(_0x35c391[_0x9fe3('0x12')][_0x9fe3('0x11')]);}})[_0x9fe3('0x13')](function(_0x2d28d4){logger['error'](_0x9fe3('0xc'),_0x4183ce,_0x2d28d4);_0x211eb2(_0x2d28d4);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 0c9936a..9db5e31 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x5c745b,_0x1197fd){var _0x22d4e1=function(_0x2ec518){while(--_0x2ec518){_0x5c745b['push'](_0x5c745b['shift']());}};_0x22d4e1(++_0x1197fd);}(_0xdb28,0x106));var _0x8db2=function(_0x32475e,_0x2b89fe){_0x32475e=_0x32475e-0x0;var _0x3e14b3=_0xdb28[_0x32475e];return _0x3e14b3;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x3a34b8,_0x38f752){var _0x529b92=function(_0x2bcb1d){while(--_0x2bcb1d){_0x3a34b8['push'](_0x3a34b8['shift']());}};_0x529b92(++_0x38f752);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e40af,_0x54b67d){_0x5e40af=_0x5e40af-0x0;var _0x45ae04=_0x2ef3[_0x5e40af];return _0x45ae04;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a2e0cef..ee55857 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 _0xc141=['STRING','sequelize','exports','name'];(function(_0x37facb,_0x3f7f8a){var _0x19c83c=function(_0x2819a4){while(--_0x2819a4){_0x37facb['push'](_0x37facb['shift']());}};_0x19c83c(++_0x3f7f8a);}(_0xc141,0x1dd));var _0x1c14=function(_0x259449,_0x32f882){_0x259449=_0x259449-0x0;var _0x321ae4=_0xc141[_0x259449];return _0x321ae4;};'use strict';var Sequelize=require(_0x1c14('0x0'));module[_0x1c14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1c14('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1c14('0x3')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1c14('0x3')]},'phone':{'type':Sequelize[_0x1c14('0x3')]},'fax':{'type':Sequelize[_0x1c14('0x3')]},'type':{'type':Sequelize[_0x1c14('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1c14('0x3')]},'city':{'type':Sequelize[_0x1c14('0x3')]},'country':{'type':Sequelize[_0x1c14('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1c14('0x3')]},'sStreet':{'type':Sequelize[_0x1c14('0x3')]},'sPostalCode':{'type':Sequelize[_0x1c14('0x3')]},'sCity':{'type':Sequelize[_0x1c14('0x3')]},'sCountry':{'type':Sequelize[_0x1c14('0x3')]},'description':{'type':Sequelize[_0x1c14('0x3')]}}; \ No newline at end of file +var _0xfcbf=['STRING','name'];(function(_0x59012f,_0x899479){var _0x50086e=function(_0x2bdbbc){while(--_0x2bdbbc){_0x59012f['push'](_0x59012f['shift']());}};_0x50086e(++_0x899479);}(_0xfcbf,0x158));var _0xffcb=function(_0x590efc,_0x5d66a5){_0x590efc=_0x590efc-0x0;var _0x503a0a=_0xfcbf[_0x590efc];return _0x503a0a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xffcb('0x0')],'unique':_0xffcb('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xffcb('0x0')]},'companyId':{'type':Sequelize[_0xffcb('0x0')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xffcb('0x0')]},'fax':{'type':Sequelize[_0xffcb('0x0')]},'type':{'type':Sequelize[_0xffcb('0x0')]},'street':{'type':Sequelize[_0xffcb('0x0')]},'postalCode':{'type':Sequelize[_0xffcb('0x0')]},'city':{'type':Sequelize[_0xffcb('0x0')]},'country':{'type':Sequelize[_0xffcb('0x0')]},'email':{'type':Sequelize[_0xffcb('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xffcb('0x0')]},'sStreet':{'type':Sequelize[_0xffcb('0x0')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xffcb('0x0')]},'sCountry':{'type':Sequelize[_0xffcb('0x0')]},'description':{'type':Sequelize[_0xffcb('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 625418a..df3e960 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 _0xe168=['options','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','map','includeAll','include','rows','catch','show','params','CmCompany','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes'];(function(_0x5420e2,_0x6d5b58){var _0x563c91=function(_0x5c3cd6){while(--_0x5c3cd6){_0x5420e2['push'](_0x5420e2['shift']());}};_0x563c91(++_0x6d5b58);}(_0xe168,0x1c4));var _0x8e16=function(_0x310377,_0x114e09){_0x310377=_0x310377-0x0;var _0x55600d=_0xe168[_0x310377];return _0x55600d;};'use strict';var emlformat=require(_0x8e16('0x0'));var rimraf=require(_0x8e16('0x1'));var zipdir=require(_0x8e16('0x2'));var jsonpatch=require(_0x8e16('0x3'));var rp=require(_0x8e16('0x4'));var moment=require('moment');var BPromise=require(_0x8e16('0x5'));var Mustache=require(_0x8e16('0x6'));var util=require(_0x8e16('0x7'));var path=require(_0x8e16('0x8'));var sox=require(_0x8e16('0x9'));var csv=require(_0x8e16('0xa'));var ejs=require(_0x8e16('0xb'));var fs=require('fs');var fs_extra=require(_0x8e16('0xc'));var _=require(_0x8e16('0xd'));var squel=require(_0x8e16('0xe'));var crypto=require(_0x8e16('0xf'));var jsforce=require(_0x8e16('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8e16('0x11'));var Papa=require(_0x8e16('0x12'));var Redis=require(_0x8e16('0x13'));var authService=require(_0x8e16('0x14'));var qs=require(_0x8e16('0x15'));var as=require(_0x8e16('0x16'));var hardwareService=require(_0x8e16('0x17'));var logger=require('../../config/logger')(_0x8e16('0x18'));var utils=require(_0x8e16('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8e16('0x1a'));var db=require(_0x8e16('0x1b'))['db'];function respondWithStatusCode(_0x83be2,_0x2a33c1){_0x2a33c1=_0x2a33c1||0xcc;return function(_0xdeb3f6){if(_0xdeb3f6){return _0x83be2['sendStatus'](_0x2a33c1);}return _0x83be2[_0x8e16('0x1c')](_0x2a33c1)['end']();};}function respondWithResult(_0xcee177,_0x2f7cbf){_0x2f7cbf=_0x2f7cbf||0xc8;return function(_0x5a4887){if(_0x5a4887){return _0xcee177[_0x8e16('0x1c')](_0x2f7cbf)[_0x8e16('0x1d')](_0x5a4887);}};}function respondWithFilteredResult(_0x18a8c1,_0x37b62d){return function(_0x132875){if(_0x132875){var _0xdf7522=typeof _0x37b62d[_0x8e16('0x1e')]===_0x8e16('0x1f')&&typeof _0x37b62d['limit']==='undefined';var _0x30ad16=_0x132875[_0x8e16('0x20')];var _0x247400=_0xdf7522?0x0:_0x37b62d[_0x8e16('0x1e')];var _0x115dbe=_0xdf7522?_0x132875['count']:_0x37b62d[_0x8e16('0x1e')]+_0x37b62d[_0x8e16('0x21')];var _0x27de51;if(_0x115dbe>=_0x30ad16){_0x115dbe=_0x30ad16;_0x27de51=0xc8;}else{_0x27de51=0xce;}_0x18a8c1[_0x8e16('0x1c')](_0x27de51);return _0x18a8c1[_0x8e16('0x22')](_0x8e16('0x23'),_0x247400+'-'+_0x115dbe+'/'+_0x30ad16)['json'](_0x132875);}return null;};}function patchUpdates(_0x2496be){return function(_0xccf3d5){try{jsonpatch[_0x8e16('0x24')](_0xccf3d5,_0x2496be,!![]);}catch(_0x562e15){return BPromise['reject'](_0x562e15);}return _0xccf3d5['save']();};}function saveUpdates(_0x3c4243,_0x28b5d1){return function(_0x52f050){if(_0x52f050){return _0x52f050[_0x8e16('0x25')](_0x3c4243)[_0x8e16('0x26')](function(_0x84d721){return _0x84d721;});}return null;};}function removeEntity(_0x52ffaf,_0x1dd287){return function(_0x5c4ee0){if(_0x5c4ee0){return _0x5c4ee0['destroy']()[_0x8e16('0x26')](function(){var _0x327bfe=_0x5c4ee0[_0x8e16('0x27')]({'plain':!![]});var _0x14ff81=_0x8e16('0x28');return db[_0x8e16('0x29')][_0x8e16('0x2a')]({'where':{'type':_0x14ff81,'resourceId':_0x327bfe['id']}})[_0x8e16('0x26')](function(){return _0x5c4ee0;});})['then'](function(){_0x52ffaf[_0x8e16('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446a05,_0x4bdf10){return function(_0x54e672){if(!_0x54e672){_0x446a05['sendStatus'](0x194);}return _0x54e672;};}function handleError(_0x2ae374,_0x1d6405){_0x1d6405=_0x1d6405||0x1f4;return function(_0x3a6a29){logger[_0x8e16('0x2b')](_0x3a6a29[_0x8e16('0x2c')]);if(_0x3a6a29['name']){delete _0x3a6a29[_0x8e16('0x2d')];}_0x2ae374[_0x8e16('0x1c')](_0x1d6405)[_0x8e16('0x2e')](_0x3a6a29);};}exports[_0x8e16('0x2f')]=function(_0x25b4c8,_0x1e7dae){var _0x4c1298={},_0x2f678c={},_0x3a5f2f={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x8e16('0x26')](function(_0x42258f){_0x2f678c[_0x8e16('0x30')]=_[_0x8e16('0x31')](_0x42258f);_0x2f678c['query']=_['keys'](_0x25b4c8['query']);_0x2f678c['filters']=_[_0x8e16('0x32')](_0x2f678c[_0x8e16('0x30')],_0x2f678c[_0x8e16('0x33')]);_0x4c1298[_0x8e16('0x34')]=_[_0x8e16('0x32')](_0x2f678c[_0x8e16('0x30')],qs[_0x8e16('0x35')](_0x25b4c8['query'][_0x8e16('0x35')]));_0x4c1298['attributes']=_0x4c1298[_0x8e16('0x34')][_0x8e16('0x36')]?_0x4c1298['attributes']:_0x2f678c[_0x8e16('0x30')];if(!_0x25b4c8[_0x8e16('0x33')][_0x8e16('0x37')]('nolimit')){_0x4c1298['limit']=qs[_0x8e16('0x21')](_0x25b4c8['query'][_0x8e16('0x21')]);_0x4c1298[_0x8e16('0x1e')]=qs[_0x8e16('0x1e')](_0x25b4c8[_0x8e16('0x33')][_0x8e16('0x1e')]);}_0x4c1298[_0x8e16('0x38')]=qs[_0x8e16('0x39')](_0x25b4c8[_0x8e16('0x33')]['sort']);_0x4c1298['where']=qs[_0x8e16('0x3a')](_[_0x8e16('0x3b')](_0x25b4c8[_0x8e16('0x33')],_0x2f678c['filters']),_0x42258f);if(_0x25b4c8['query'][_0x8e16('0x3c')]){_0x4c1298[_0x8e16('0x3d')]=_[_0x8e16('0x3e')](_0x4c1298['where'],{'$or':_[_0x8e16('0x3f')](_0x4c1298['attributes'],function(_0x1bc8de){var _0x1bd2c3={};_0x1bd2c3[_0x1bc8de]={'$like':'%'+_0x25b4c8[_0x8e16('0x33')]['filter']+'%'};return _0x1bd2c3;})});}_0x4c1298=_[_0x8e16('0x3e')]({},_0x4c1298,_0x25b4c8['options']);var _0x34afa9={'where':_0x4c1298['where']};return db['CmCompany'][_0x8e16('0x20')](_0x34afa9)['then'](function(_0x3288e0){_0x3a5f2f[_0x8e16('0x20')]=_0x3288e0;if(_0x25b4c8[_0x8e16('0x33')][_0x8e16('0x40')]){_0x4c1298[_0x8e16('0x41')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x4c1298);})[_0x8e16('0x26')](function(_0x311dc9){_0x3a5f2f[_0x8e16('0x42')]=_0x311dc9;return _0x3a5f2f;})[_0x8e16('0x26')](respondWithFilteredResult(_0x1e7dae,_0x4c1298))[_0x8e16('0x43')](handleError(_0x1e7dae,null));})[_0x8e16('0x43')](handleError(_0x1e7dae,null));};exports[_0x8e16('0x44')]=function(_0x4cc4e5,_0x17cf73){var _0x248094={'raw':![],'where':{'id':_0x4cc4e5[_0x8e16('0x45')]['id']}},_0x3991a8={};_0x3991a8['model']=_[_0x8e16('0x31')](db[_0x8e16('0x46')]['rawAttributes']);_0x3991a8[_0x8e16('0x33')]=_['keys'](_0x4cc4e5[_0x8e16('0x33')]);_0x3991a8[_0x8e16('0x3a')]=_['intersection'](_0x3991a8[_0x8e16('0x30')],_0x3991a8[_0x8e16('0x33')]);_0x248094[_0x8e16('0x34')]=_[_0x8e16('0x32')](_0x3991a8[_0x8e16('0x30')],qs[_0x8e16('0x35')](_0x4cc4e5[_0x8e16('0x33')][_0x8e16('0x35')]));_0x248094[_0x8e16('0x34')]=_0x248094[_0x8e16('0x34')][_0x8e16('0x36')]?_0x248094[_0x8e16('0x34')]:_0x3991a8['model'];if(_0x4cc4e5[_0x8e16('0x33')][_0x8e16('0x40')]){_0x248094[_0x8e16('0x41')]=[{'all':!![]}];}_0x248094=_[_0x8e16('0x3e')]({},_0x248094,_0x4cc4e5['options']);return db['CmCompany'][_0x8e16('0x47')](_0x248094)[_0x8e16('0x26')](handleEntityNotFound(_0x17cf73,null))[_0x8e16('0x26')](respondWithResult(_0x17cf73,null))['catch'](handleError(_0x17cf73,null));};exports['create']=function(_0x504ae3,_0x56d929){return db['CmCompany'][_0x8e16('0x48')](_0x504ae3[_0x8e16('0x49')],{})[_0x8e16('0x26')](function(_0x378432){var _0x4d7f94=_0x504ae3[_0x8e16('0x4a')][_0x8e16('0x27')]({'plain':!![]});if(!_0x4d7f94)throw new Error(_0x8e16('0x4b'));if(_0x4d7f94['role']===_0x8e16('0x4a')){var _0x333adc=_0x378432[_0x8e16('0x27')]({'plain':!![]});var _0x8c5e2f=_0x8e16('0x28');return db[_0x8e16('0x4c')][_0x8e16('0x47')]({'where':{'name':_0x8c5e2f,'userProfileId':_0x4d7f94[_0x8e16('0x4d')]},'raw':!![]})[_0x8e16('0x26')](function(_0x21eb59){if(_0x21eb59&&_0x21eb59[_0x8e16('0x4e')]===0x0){return db[_0x8e16('0x29')][_0x8e16('0x48')]({'name':_0x333adc[_0x8e16('0x2d')],'resourceId':_0x333adc['id'],'type':_0x21eb59[_0x8e16('0x2d')],'sectionId':_0x21eb59['id']},{})[_0x8e16('0x26')](function(){return _0x378432;});}else{return _0x378432;}})['catch'](function(_0x5888a0){logger[_0x8e16('0x2b')](_0x8e16('0x4f'),_0x5888a0);throw _0x5888a0;});}return _0x378432;})[_0x8e16('0x26')](respondWithResult(_0x56d929,0xc9))['catch'](handleError(_0x56d929,null));};exports['update']=function(_0x206791,_0x3fd2c7){if(_0x206791[_0x8e16('0x49')]['id']){delete _0x206791[_0x8e16('0x49')]['id'];}return db[_0x8e16('0x46')][_0x8e16('0x47')]({'where':{'id':_0x206791['params']['id']}})[_0x8e16('0x26')](handleEntityNotFound(_0x3fd2c7,null))[_0x8e16('0x26')](saveUpdates(_0x206791[_0x8e16('0x49')],null))[_0x8e16('0x26')](respondWithResult(_0x3fd2c7,null))[_0x8e16('0x43')](handleError(_0x3fd2c7,null));};exports[_0x8e16('0x2a')]=function(_0x2211d6,_0x1c8c41){return db[_0x8e16('0x46')][_0x8e16('0x47')]({'where':{'id':_0x2211d6[_0x8e16('0x45')]['id']}})[_0x8e16('0x26')](handleEntityNotFound(_0x1c8c41,null))[_0x8e16('0x26')](removeEntity(_0x1c8c41,null))[_0x8e16('0x43')](handleError(_0x1c8c41,null));};exports['describe']=function(_0x356df5,_0x50a9d3){return db[_0x8e16('0x46')][_0x8e16('0x50')]()['then'](respondWithResult(_0x50a9d3,null))[_0x8e16('0x43')](handleError(_0x50a9d3,null));};exports[_0x8e16('0x51')]=function(_0x4e3d0b,_0x194593,_0x5ddd34){return db[_0x8e16('0x52')]['find']({'where':{'id':_0x4e3d0b[_0x8e16('0x45')]['id']}})[_0x8e16('0x26')](handleEntityNotFound(_0x194593,null))['then'](function(_0x4d0855){if(_0x4d0855){return _0x4d0855[_0x8e16('0x51')](_0x4e3d0b[_0x8e16('0x49')][_0x8e16('0x53')],_[_0x8e16('0x54')](_0x4e3d0b[_0x8e16('0x49')],[_0x8e16('0x53'),'id'])||{});}})['then'](respondWithResult(_0x194593,null))['catch'](handleError(_0x194593,null));};exports[_0x8e16('0x55')]=function(_0x5d98ca,_0x121f00,_0x4713cb){var _0x20268f={};var _0x52312a={};var _0x4694c3;var _0x384a20;return db[_0x8e16('0x46')][_0x8e16('0x56')]({'where':{'id':_0x5d98ca['params']['id']}})['then'](handleEntityNotFound(_0x121f00,null))['then'](function(_0x5bc935){if(_0x5bc935){_0x4694c3=_0x5bc935;_0x52312a[_0x8e16('0x30')]=_[_0x8e16('0x31')](db[_0x8e16('0x52')][_0x8e16('0x57')]);_0x52312a[_0x8e16('0x33')]=_[_0x8e16('0x31')](_0x5d98ca['query']);_0x52312a[_0x8e16('0x3a')]=_['intersection'](_0x52312a[_0x8e16('0x30')],_0x52312a['query']);_0x20268f[_0x8e16('0x34')]=_[_0x8e16('0x32')](_0x52312a['model'],qs[_0x8e16('0x35')](_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x35')]));_0x20268f[_0x8e16('0x34')]=_0x20268f[_0x8e16('0x34')][_0x8e16('0x36')]?_0x20268f[_0x8e16('0x34')]:_0x52312a['model'];_0x20268f[_0x8e16('0x38')]=qs[_0x8e16('0x39')](_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x39')]);_0x20268f[_0x8e16('0x3d')]=qs[_0x8e16('0x3a')](_[_0x8e16('0x3b')](_0x5d98ca['query'],_0x52312a[_0x8e16('0x3a')]));if(_0x5d98ca['query']['filter']){_0x20268f[_0x8e16('0x3d')]=_['merge'](_0x20268f[_0x8e16('0x3d')],{'$or':_[_0x8e16('0x3f')](_0x20268f['attributes'],function(_0x341c77){var _0x3117a2={};_0x3117a2[_0x341c77]={'$like':'%'+_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x3c')]+'%'};return _0x3117a2;})});}_0x20268f=_[_0x8e16('0x3e')]({},_0x20268f,_0x5d98ca[_0x8e16('0x58')]);return _0x4694c3['getContacts'](_0x20268f);}})[_0x8e16('0x26')](function(_0x5f10e3){if(_0x5f10e3){_0x384a20=_0x5f10e3[_0x8e16('0x36')];if(!_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x37')](_0x8e16('0x59'))){_0x20268f[_0x8e16('0x21')]=qs[_0x8e16('0x21')](_0x5d98ca[_0x8e16('0x33')][_0x8e16('0x21')]);_0x20268f[_0x8e16('0x1e')]=qs[_0x8e16('0x1e')](_0x5d98ca[_0x8e16('0x33')]['offset']);}return _0x4694c3[_0x8e16('0x55')](_0x20268f);}})['then'](function(_0x3d1d3b){if(_0x3d1d3b){return _0x3d1d3b?{'count':_0x384a20,'rows':_0x3d1d3b}:null;}})[_0x8e16('0x26')](respondWithResult(_0x121f00,null))['catch'](handleError(_0x121f00,null));}; \ No newline at end of file +var _0x405e=['fields','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','get','Companies','then','sendStatus','error','name','send','CmCompany','describe','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','map','includeAll','include','findAll','catch','show','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x405e,0x15d));var _0xe405=function(_0x4da2e1,_0x357b75){_0x4da2e1=_0x4da2e1-0x0;var _0x933021=_0x405e[_0x4da2e1];return _0x933021;};'use strict';var emlformat=require(_0xe405('0x0'));var rimraf=require(_0xe405('0x1'));var zipdir=require(_0xe405('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe405('0x3'));var moment=require(_0xe405('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe405('0x5'));var util=require(_0xe405('0x6'));var path=require(_0xe405('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe405('0x8'));var fs=require('fs');var fs_extra=require(_0xe405('0x9'));var _=require(_0xe405('0xa'));var squel=require('squel');var crypto=require(_0xe405('0xb'));var jsforce=require(_0xe405('0xc'));var deskjs=require(_0xe405('0xd'));var toCsv=require(_0xe405('0xe'));var querystring=require(_0xe405('0xf'));var Papa=require(_0xe405('0x10'));var Redis=require(_0xe405('0x11'));var authService=require(_0xe405('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe405('0x13'));var hardwareService=require(_0xe405('0x14'));var logger=require(_0xe405('0x15'))(_0xe405('0x16'));var utils=require(_0xe405('0x17'));var config=require(_0xe405('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x354505,_0xccda99){_0xccda99=_0xccda99||0xcc;return function(_0x16307f){if(_0x16307f){return _0x354505['sendStatus'](_0xccda99);}return _0x354505['status'](_0xccda99)['end']();};}function respondWithResult(_0x210ee3,_0x4a691d){_0x4a691d=_0x4a691d||0xc8;return function(_0x5e6efd){if(_0x5e6efd){return _0x210ee3[_0xe405('0x19')](_0x4a691d)[_0xe405('0x1a')](_0x5e6efd);}};}function respondWithFilteredResult(_0x3953f5,_0x5959e6){return function(_0x5663b3){if(_0x5663b3){var _0x890f95=typeof _0x5959e6[_0xe405('0x1b')]==='undefined'&&typeof _0x5959e6['limit']===_0xe405('0x1c');var _0x24628e=_0x5663b3['count'];var _0x5c0373=_0x890f95?0x0:_0x5959e6[_0xe405('0x1b')];var _0x55db19=_0x890f95?_0x5663b3[_0xe405('0x1d')]:_0x5959e6[_0xe405('0x1b')]+_0x5959e6[_0xe405('0x1e')];var _0x2d1dfd;if(_0x55db19>=_0x24628e){_0x55db19=_0x24628e;_0x2d1dfd=0xc8;}else{_0x2d1dfd=0xce;}_0x3953f5['status'](_0x2d1dfd);return _0x3953f5['set'](_0xe405('0x1f'),_0x5c0373+'-'+_0x55db19+'/'+_0x24628e)['json'](_0x5663b3);}return null;};}function patchUpdates(_0x2246a9){return function(_0x5009e2){try{jsonpatch[_0xe405('0x20')](_0x5009e2,_0x2246a9,!![]);}catch(_0x432833){return BPromise[_0xe405('0x21')](_0x432833);}return _0x5009e2['save']();};}function saveUpdates(_0x2460f5,_0x33a742){return function(_0x189596){if(_0x189596){return _0x189596[_0xe405('0x22')](_0x2460f5)['then'](function(_0x5a7e93){return _0x5a7e93;});}return null;};}function removeEntity(_0x505632,_0x37a80b){return function(_0xc4d223){if(_0xc4d223){return _0xc4d223[_0xe405('0x23')]()['then'](function(){var _0x455138=_0xc4d223[_0xe405('0x24')]({'plain':!![]});var _0x17132a=_0xe405('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x17132a,'resourceId':_0x455138['id']}})[_0xe405('0x26')](function(){return _0xc4d223;});})['then'](function(){_0x505632[_0xe405('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4891c8,_0x49d5be){return function(_0xf033d){if(!_0xf033d){_0x4891c8[_0xe405('0x27')](0x194);}return _0xf033d;};}function handleError(_0x5e2796,_0x4d7bb6){_0x4d7bb6=_0x4d7bb6||0x1f4;return function(_0x3bd630){logger[_0xe405('0x28')](_0x3bd630['stack']);if(_0x3bd630[_0xe405('0x29')]){delete _0x3bd630[_0xe405('0x29')];}_0x5e2796[_0xe405('0x19')](_0x4d7bb6)[_0xe405('0x2a')](_0x3bd630);};}exports['index']=function(_0x32e07e,_0x46d70e){var _0x4262ce={},_0x2e19e9={},_0x2c8b10={'count':0x0,'rows':[]};return db[_0xe405('0x2b')][_0xe405('0x2c')]()[_0xe405('0x26')](function(_0x577945){_0x2e19e9[_0xe405('0x2d')]=_[_0xe405('0x2e')](_0x577945);_0x2e19e9[_0xe405('0x2f')]=_[_0xe405('0x2e')](_0x32e07e[_0xe405('0x2f')]);_0x2e19e9['filters']=_[_0xe405('0x30')](_0x2e19e9[_0xe405('0x2d')],_0x2e19e9[_0xe405('0x2f')]);_0x4262ce[_0xe405('0x31')]=_[_0xe405('0x30')](_0x2e19e9[_0xe405('0x2d')],qs['fields'](_0x32e07e[_0xe405('0x2f')]['fields']));_0x4262ce[_0xe405('0x31')]=_0x4262ce[_0xe405('0x31')]['length']?_0x4262ce[_0xe405('0x31')]:_0x2e19e9[_0xe405('0x2d')];if(!_0x32e07e[_0xe405('0x2f')][_0xe405('0x32')](_0xe405('0x33'))){_0x4262ce[_0xe405('0x1e')]=qs['limit'](_0x32e07e[_0xe405('0x2f')][_0xe405('0x1e')]);_0x4262ce[_0xe405('0x1b')]=qs[_0xe405('0x1b')](_0x32e07e['query'][_0xe405('0x1b')]);}_0x4262ce[_0xe405('0x34')]=qs[_0xe405('0x35')](_0x32e07e[_0xe405('0x2f')][_0xe405('0x35')]);_0x4262ce['where']=qs[_0xe405('0x36')](_[_0xe405('0x37')](_0x32e07e[_0xe405('0x2f')],_0x2e19e9[_0xe405('0x36')]),_0x577945);if(_0x32e07e[_0xe405('0x2f')][_0xe405('0x38')]){_0x4262ce['where']=_[_0xe405('0x39')](_0x4262ce[_0xe405('0x3a')],{'$or':_[_0xe405('0x3b')](_0x4262ce[_0xe405('0x31')],function(_0xef81f0){var _0x1dc8f1={};_0x1dc8f1[_0xef81f0]={'$like':'%'+_0x32e07e['query'][_0xe405('0x38')]+'%'};return _0x1dc8f1;})});}_0x4262ce=_[_0xe405('0x39')]({},_0x4262ce,_0x32e07e['options']);var _0x36c2c8={'where':_0x4262ce[_0xe405('0x3a')]};return db['CmCompany'][_0xe405('0x1d')](_0x36c2c8)[_0xe405('0x26')](function(_0x582ae8){_0x2c8b10[_0xe405('0x1d')]=_0x582ae8;if(_0x32e07e[_0xe405('0x2f')][_0xe405('0x3c')]){_0x4262ce[_0xe405('0x3d')]=[{'all':!![]}];}return db[_0xe405('0x2b')][_0xe405('0x3e')](_0x4262ce);})[_0xe405('0x26')](function(_0x5aae48){_0x2c8b10['rows']=_0x5aae48;return _0x2c8b10;})[_0xe405('0x26')](respondWithFilteredResult(_0x46d70e,_0x4262ce))[_0xe405('0x3f')](handleError(_0x46d70e,null));})[_0xe405('0x3f')](handleError(_0x46d70e,null));};exports[_0xe405('0x40')]=function(_0x411cf6,_0x2ed971){var _0x3a701f={'raw':![],'where':{'id':_0x411cf6[_0xe405('0x41')]['id']}},_0x268043={};_0x268043[_0xe405('0x2d')]=_[_0xe405('0x2e')](db['CmCompany']['rawAttributes']);_0x268043['query']=_['keys'](_0x411cf6[_0xe405('0x2f')]);_0x268043['filters']=_['intersection'](_0x268043['model'],_0x268043[_0xe405('0x2f')]);_0x3a701f[_0xe405('0x31')]=_[_0xe405('0x30')](_0x268043[_0xe405('0x2d')],qs[_0xe405('0x42')](_0x411cf6['query'][_0xe405('0x42')]));_0x3a701f[_0xe405('0x31')]=_0x3a701f[_0xe405('0x31')][_0xe405('0x43')]?_0x3a701f[_0xe405('0x31')]:_0x268043[_0xe405('0x2d')];if(_0x411cf6[_0xe405('0x2f')][_0xe405('0x3c')]){_0x3a701f['include']=[{'all':!![]}];}_0x3a701f=_['merge']({},_0x3a701f,_0x411cf6[_0xe405('0x44')]);return db[_0xe405('0x2b')]['find'](_0x3a701f)[_0xe405('0x26')](handleEntityNotFound(_0x2ed971,null))[_0xe405('0x26')](respondWithResult(_0x2ed971,null))[_0xe405('0x3f')](handleError(_0x2ed971,null));};exports[_0xe405('0x45')]=function(_0x3f691b,_0x514af5){return db[_0xe405('0x2b')][_0xe405('0x45')](_0x3f691b[_0xe405('0x46')],{})['then'](function(_0x25dd14){var _0x423088=_0x3f691b[_0xe405('0x47')]['get']({'plain':!![]});if(!_0x423088)throw new Error(_0xe405('0x48'));if(_0x423088[_0xe405('0x49')]==='user'){var _0x2256cd=_0x25dd14['get']({'plain':!![]});var _0x3c3cea=_0xe405('0x25');return db[_0xe405('0x4a')][_0xe405('0x4b')]({'where':{'name':_0x3c3cea,'userProfileId':_0x423088[_0xe405('0x4c')]},'raw':!![]})[_0xe405('0x26')](function(_0x455029){if(_0x455029&&_0x455029[_0xe405('0x4d')]===0x0){return db[_0xe405('0x4e')][_0xe405('0x45')]({'name':_0x2256cd['name'],'resourceId':_0x2256cd['id'],'type':_0x455029[_0xe405('0x29')],'sectionId':_0x455029['id']},{})['then'](function(){return _0x25dd14;});}else{return _0x25dd14;}})['catch'](function(_0x4ef51c){logger[_0xe405('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ef51c);throw _0x4ef51c;});}return _0x25dd14;})[_0xe405('0x26')](respondWithResult(_0x514af5,0xc9))[_0xe405('0x3f')](handleError(_0x514af5,null));};exports[_0xe405('0x22')]=function(_0x125d76,_0xf39db0){if(_0x125d76['body']['id']){delete _0x125d76['body']['id'];}return db[_0xe405('0x2b')][_0xe405('0x4b')]({'where':{'id':_0x125d76['params']['id']}})[_0xe405('0x26')](handleEntityNotFound(_0xf39db0,null))['then'](saveUpdates(_0x125d76[_0xe405('0x46')],null))[_0xe405('0x26')](respondWithResult(_0xf39db0,null))['catch'](handleError(_0xf39db0,null));};exports['destroy']=function(_0x2ddbf4,_0xbeb719){return db['CmCompany'][_0xe405('0x4b')]({'where':{'id':_0x2ddbf4[_0xe405('0x41')]['id']}})[_0xe405('0x26')](handleEntityNotFound(_0xbeb719,null))[_0xe405('0x26')](removeEntity(_0xbeb719,null))[_0xe405('0x3f')](handleError(_0xbeb719,null));};exports['describe']=function(_0x599e2a,_0x482a41){return db[_0xe405('0x2b')][_0xe405('0x2c')]()[_0xe405('0x26')](respondWithResult(_0x482a41,null))[_0xe405('0x3f')](handleError(_0x482a41,null));};exports['addContacts']=function(_0x1fc1cf,_0xb1a69,_0x39034f){return db['CmContact'][_0xe405('0x4b')]({'where':{'id':_0x1fc1cf['params']['id']}})[_0xe405('0x26')](handleEntityNotFound(_0xb1a69,null))['then'](function(_0x559bf5){if(_0x559bf5){return _0x559bf5['addContacts'](_0x1fc1cf[_0xe405('0x46')][_0xe405('0x4f')],_[_0xe405('0x50')](_0x1fc1cf[_0xe405('0x46')],['ids','id'])||{});}})['then'](respondWithResult(_0xb1a69,null))[_0xe405('0x3f')](handleError(_0xb1a69,null));};exports[_0xe405('0x51')]=function(_0x3e0e6a,_0x2364f3,_0x165394){var _0x412c6e={};var _0x291c16={};var _0x5656d2;var _0x32ad12;return db['CmCompany'][_0xe405('0x52')]({'where':{'id':_0x3e0e6a[_0xe405('0x41')]['id']}})[_0xe405('0x26')](handleEntityNotFound(_0x2364f3,null))[_0xe405('0x26')](function(_0x401f4e){if(_0x401f4e){_0x5656d2=_0x401f4e;_0x291c16[_0xe405('0x2d')]=_['keys'](db['CmContact']['rawAttributes']);_0x291c16['query']=_[_0xe405('0x2e')](_0x3e0e6a[_0xe405('0x2f')]);_0x291c16['filters']=_[_0xe405('0x30')](_0x291c16['model'],_0x291c16[_0xe405('0x2f')]);_0x412c6e['attributes']=_['intersection'](_0x291c16[_0xe405('0x2d')],qs[_0xe405('0x42')](_0x3e0e6a['query'][_0xe405('0x42')]));_0x412c6e[_0xe405('0x31')]=_0x412c6e['attributes'][_0xe405('0x43')]?_0x412c6e['attributes']:_0x291c16[_0xe405('0x2d')];_0x412c6e['order']=qs[_0xe405('0x35')](_0x3e0e6a['query'][_0xe405('0x35')]);_0x412c6e['where']=qs[_0xe405('0x36')](_[_0xe405('0x37')](_0x3e0e6a[_0xe405('0x2f')],_0x291c16['filters']));if(_0x3e0e6a[_0xe405('0x2f')][_0xe405('0x38')]){_0x412c6e['where']=_[_0xe405('0x39')](_0x412c6e[_0xe405('0x3a')],{'$or':_[_0xe405('0x3b')](_0x412c6e[_0xe405('0x31')],function(_0x4340c2){var _0x38fd8c={};_0x38fd8c[_0x4340c2]={'$like':'%'+_0x3e0e6a[_0xe405('0x2f')][_0xe405('0x38')]+'%'};return _0x38fd8c;})});}_0x412c6e=_[_0xe405('0x39')]({},_0x412c6e,_0x3e0e6a['options']);return _0x5656d2[_0xe405('0x51')](_0x412c6e);}})[_0xe405('0x26')](function(_0x34843d){if(_0x34843d){_0x32ad12=_0x34843d[_0xe405('0x43')];if(!_0x3e0e6a['query']['hasOwnProperty'](_0xe405('0x33'))){_0x412c6e[_0xe405('0x1e')]=qs[_0xe405('0x1e')](_0x3e0e6a[_0xe405('0x2f')]['limit']);_0x412c6e[_0xe405('0x1b')]=qs[_0xe405('0x1b')](_0x3e0e6a[_0xe405('0x2f')][_0xe405('0x1b')]);}return _0x5656d2[_0xe405('0x51')](_0x412c6e);}})[_0xe405('0x26')](function(_0x4fa3b4){if(_0x4fa3b4){return _0x4fa3b4?{'count':_0x32ad12,'rows':_0x4fa3b4}:null;}})[_0xe405('0x26')](respondWithResult(_0x2364f3,null))[_0xe405('0x3f')](handleError(_0x2364f3,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 5ec1c2b..6870c4e 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 _0x9cd3=['moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','util','api'];(function(_0x14a62c,_0x5c77e1){var _0x5bab14=function(_0xa6dc35){while(--_0xa6dc35){_0x14a62c['push'](_0x14a62c['shift']());}};_0x5bab14(++_0x5c77e1);}(_0x9cd3,0xc4));var _0x39cd=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x9cd3[_0x54381d];return _0x5308a7;};'use strict';var _=require('lodash');var util=require(_0x39cd('0x0'));var logger=require('../../config/logger')(_0x39cd('0x1'));var moment=require(_0x39cd('0x2'));var BPromise=require(_0x39cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39cd('0x4'));var rimraf=require(_0x39cd('0x5'));var config=require(_0x39cd('0x6'));var attributes=require(_0x39cd('0x7'));module['exports']=function(_0x4bee5a,_0x14de06){return _0x4bee5a[_0x39cd('0x8')](_0x39cd('0x9'),attributes,{'tableName':_0x39cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x385d=['rimraf','./cmCompany.attributes','define','CmCompany','cm_companies','util','../../config/logger','moment','request-promise','path'];(function(_0x3abeb3,_0x170117){var _0x54b697=function(_0x3664a0){while(--_0x3664a0){_0x3abeb3['push'](_0x3abeb3['shift']());}};_0x54b697(++_0x170117);}(_0x385d,0x113));var _0xd385=function(_0x150b04,_0x1cae6a){_0x150b04=_0x150b04-0x0;var _0x3bbd28=_0x385d[_0x150b04];return _0x3bbd28;};'use strict';var _=require('lodash');var util=require(_0xd385('0x0'));var logger=require(_0xd385('0x1'))('api');var moment=require(_0xd385('0x2'));var BPromise=require('bluebird');var rp=require(_0xd385('0x3'));var fs=require('fs');var path=require(_0xd385('0x4'));var rimraf=require(_0xd385('0x5'));var config=require('../../config/environment');var attributes=require(_0xd385('0x6'));module['exports']=function(_0x28732a,_0x1297ac){return _0x28732a[_0xd385('0x7')](_0xd385('0x8'),attributes,{'tableName':_0xd385('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index d18e682..30d4dac 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 _0xea73=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xea73,0x1e4));var _0x3ea7=function(_0xb73831,_0x3a2638){_0xb73831=_0xb73831-0x0;var _0x3673bf=_0xea73[_0xb73831];return _0x3673bf;};'use strict';var _=require(_0x3ea7('0x0'));var util=require('util');var moment=require(_0x3ea7('0x1'));var BPromise=require(_0x3ea7('0x2'));var rs=require(_0x3ea7('0x3'));var fs=require('fs');var Redis=require(_0x3ea7('0x4'));var db=require(_0x3ea7('0x5'))['db'];var utils=require(_0x3ea7('0x6'));var logger=require(_0x3ea7('0x7'))(_0x3ea7('0x8'));var config=require(_0x3ea7('0x9'));var jayson=require(_0x3ea7('0xa'));var client=jayson[_0x3ea7('0xb')][_0x3ea7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30851a,_0x1ad15a,_0x273cf8){return new BPromise(function(_0x51a6a8,_0x5bab96){return client[_0x3ea7('0xd')](_0x30851a,_0x273cf8)[_0x3ea7('0xe')](function(_0x5821d9){logger[_0x3ea7('0xf')](_0x3ea7('0x10'),_0x1ad15a,_0x3ea7('0x11'));logger[_0x3ea7('0x12')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1ad15a,'request\x20sent',JSON['stringify'](_0x5821d9));if(_0x5821d9['error']){if(_0x5821d9[_0x3ea7('0x13')][_0x3ea7('0x14')]===0x1f4){logger[_0x3ea7('0x13')](_0x3ea7('0x10'),_0x1ad15a,_0x5821d9[_0x3ea7('0x13')][_0x3ea7('0x15')]);return _0x5bab96(_0x5821d9['error']['message']);}logger[_0x3ea7('0x13')](_0x3ea7('0x10'),_0x1ad15a,_0x5821d9[_0x3ea7('0x13')]['message']);return _0x51a6a8(_0x5821d9[_0x3ea7('0x13')][_0x3ea7('0x15')]);}else{logger[_0x3ea7('0xf')](_0x3ea7('0x10'),_0x1ad15a,'request\x20sent');_0x51a6a8(_0x5821d9[_0x3ea7('0x16')][_0x3ea7('0x15')]);}})[_0x3ea7('0x17')](function(_0x640299){logger[_0x3ea7('0x13')](_0x3ea7('0x10'),_0x1ad15a,_0x640299);_0x5bab96(_0x640299);});});} \ No newline at end of file +var _0xb814=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb814,0x195));var _0x4b81=function(_0xdda64d,_0x444ab2){_0xdda64d=_0xdda64d-0x0;var _0x17f684=_0xb814[_0xdda64d];return _0x17f684;};'use strict';var _=require(_0x4b81('0x0'));var util=require(_0x4b81('0x1'));var moment=require(_0x4b81('0x2'));var BPromise=require(_0x4b81('0x3'));var rs=require(_0x4b81('0x4'));var fs=require('fs');var Redis=require(_0x4b81('0x5'));var db=require(_0x4b81('0x6'))['db'];var utils=require(_0x4b81('0x7'));var logger=require(_0x4b81('0x8'))(_0x4b81('0x9'));var config=require('../../config/environment');var jayson=require(_0x4b81('0xa'));var client=jayson[_0x4b81('0xb')][_0x4b81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23dd78,_0x4113ee,_0x46b9cb){return new BPromise(function(_0x2fa35a,_0x139634){return client[_0x4b81('0xd')](_0x23dd78,_0x46b9cb)[_0x4b81('0xe')](function(_0x4c7fb4){logger[_0x4b81('0xf')](_0x4b81('0x10'),_0x4113ee,_0x4b81('0x11'));logger[_0x4b81('0x12')](_0x4b81('0x13'),_0x4113ee,_0x4b81('0x11'),JSON['stringify'](_0x4c7fb4));if(_0x4c7fb4[_0x4b81('0x14')]){if(_0x4c7fb4[_0x4b81('0x14')]['code']===0x1f4){logger[_0x4b81('0x14')](_0x4b81('0x10'),_0x4113ee,_0x4c7fb4[_0x4b81('0x14')][_0x4b81('0x15')]);return _0x139634(_0x4c7fb4['error']['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0x4113ee,_0x4c7fb4[_0x4b81('0x14')][_0x4b81('0x15')]);return _0x2fa35a(_0x4c7fb4[_0x4b81('0x14')]['message']);}else{logger[_0x4b81('0xf')](_0x4b81('0x10'),_0x4113ee,_0x4b81('0x11'));_0x2fa35a(_0x4c7fb4[_0x4b81('0x16')][_0x4b81('0x15')]);}})[_0x4b81('0x17')](function(_0x307de7){logger[_0x4b81('0x14')](_0x4b81('0x10'),_0x4113ee,_0x307de7);_0x139634(_0x307de7);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index dd8bc50..afdaacf 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 _0x1717=['post','create','addContacts','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts'];(function(_0x1fa929,_0x5a8059){var _0x34d01e=function(_0x19b98c){while(--_0x19b98c){_0x1fa929['push'](_0x1fa929['shift']());}};_0x34d01e(++_0x5a8059);}(_0x1717,0x14b));var _0x7171=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x1717[_0x3d38ae];return _0x3757ee;};'use strict';var multer=require(_0x7171('0x0'));var util=require(_0x7171('0x1'));var path=require(_0x7171('0x2'));var timeout=require(_0x7171('0x3'));var express=require(_0x7171('0x4'));var router=express[_0x7171('0x5')]();var fs_extra=require(_0x7171('0x6'));var auth=require(_0x7171('0x7'));var interaction=require(_0x7171('0x8'));var config=require(_0x7171('0x9'));var controller=require(_0x7171('0xa'));router[_0x7171('0xb')]('/',auth[_0x7171('0xc')](),controller[_0x7171('0xd')]);router[_0x7171('0xb')](_0x7171('0xe'),auth['isAuthenticated'](),controller[_0x7171('0xf')]);router['get'](_0x7171('0x10'),auth['isAuthenticated'](),controller[_0x7171('0x11')]);router['get'](_0x7171('0x12'),auth[_0x7171('0xc')](),controller[_0x7171('0x13')]);router[_0x7171('0x14')]('/',auth[_0x7171('0xc')](),controller[_0x7171('0x15')]);router[_0x7171('0x14')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x7171('0x16')]);router[_0x7171('0x17')](_0x7171('0x10'),auth[_0x7171('0xc')](),controller['update']);router[_0x7171('0x18')](_0x7171('0x10'),auth[_0x7171('0xc')](),controller[_0x7171('0x19')]);module[_0x7171('0x1a')]=router; \ No newline at end of file +var _0xa6bf=['isAuthenticated','index','/describe','describe','/:id','getContacts','create','post','/:id/contacts','addContacts','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0xd6a1c9,_0x203324){var _0x51ea29=function(_0x165a30){while(--_0x165a30){_0xd6a1c9['push'](_0xd6a1c9['shift']());}};_0x51ea29(++_0x203324);}(_0xa6bf,0x184));var _0xfa6b=function(_0x256dfb,_0x2b4b6e){_0x256dfb=_0x256dfb-0x0;var _0x899957=_0xa6bf[_0x256dfb];return _0x899957;};'use strict';var multer=require(_0xfa6b('0x0'));var util=require(_0xfa6b('0x1'));var path=require('path');var timeout=require(_0xfa6b('0x2'));var express=require(_0xfa6b('0x3'));var router=express['Router']();var fs_extra=require(_0xfa6b('0x4'));var auth=require(_0xfa6b('0x5'));var interaction=require(_0xfa6b('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xfa6b('0x7')]('/',auth[_0xfa6b('0x8')](),controller[_0xfa6b('0x9')]);router[_0xfa6b('0x7')](_0xfa6b('0xa'),auth[_0xfa6b('0x8')](),controller[_0xfa6b('0xb')]);router[_0xfa6b('0x7')](_0xfa6b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfa6b('0x7')]('/:id/contacts',auth[_0xfa6b('0x8')](),controller[_0xfa6b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa6b('0xe')]);router[_0xfa6b('0xf')](_0xfa6b('0x10'),auth[_0xfa6b('0x8')](),controller[_0xfa6b('0x11')]);router[_0xfa6b('0x12')](_0xfa6b('0xc'),auth[_0xfa6b('0x8')](),controller['update']);router[_0xfa6b('0x13')](_0xfa6b('0xc'),auth[_0xfa6b('0x8')](),controller[_0xfa6b('0x14')]);module[_0xfa6b('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6bdc0f0..51eb1d9 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 _0x2c12=['STRING','TEXT','INTEGER','UNSIGNED','DATE','exports'];(function(_0x4b389c,_0x47981f){var _0x1ba055=function(_0x40d928){while(--_0x40d928){_0x4b389c['push'](_0x4b389c['shift']());}};_0x1ba055(++_0x47981f);}(_0x2c12,0x137));var _0x22c1=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x2c12[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x22c1('0x0')]={'firstName':{'type':Sequelize[_0x22c1('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x22c1('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x22c1('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x22c1('0x1')]},'description':{'type':Sequelize[_0x22c1('0x2')]},'phone':{'type':Sequelize[_0x22c1('0x1')]},'mobile':{'type':Sequelize[_0x22c1('0x1')]},'fax':{'type':Sequelize[_0x22c1('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x22c1('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x22c1('0x1')]},'teams':{'type':Sequelize[_0x22c1('0x1')]},'viber':{'type':Sequelize[_0x22c1('0x1')]},'line':{'type':Sequelize[_0x22c1('0x1')]},'wechat':{'type':Sequelize[_0x22c1('0x1')]},'telegram':{'type':Sequelize[_0x22c1('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x22c1('0x1')]},'priority':{'type':Sequelize[_0x22c1('0x3')](0x2)[_0x22c1('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x22c1('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x22c1('0x1')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0df3=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x273632,_0x279621){var _0x4262bf=function(_0x4cf841){while(--_0x4cf841){_0x273632['push'](_0x273632['shift']());}};_0x4262bf(++_0x279621);}(_0x0df3,0xa2));var _0x30df=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x0df3[_0x396466];return _0x5e9ab4;};'use strict';var _=require(_0x30df('0x0'));var Sequelize=require(_0x30df('0x1'));module[_0x30df('0x2')]={'firstName':{'type':Sequelize[_0x30df('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x30df('0x3')]},'street':{'type':Sequelize[_0x30df('0x3')]},'postalCode':{'type':Sequelize[_0x30df('0x3')]},'city':{'type':Sequelize[_0x30df('0x3')]},'country':{'type':Sequelize[_0x30df('0x3')]},'dateOfBirth':{'type':Sequelize[_0x30df('0x3')]},'description':{'type':Sequelize[_0x30df('0x4')]},'phone':{'type':Sequelize[_0x30df('0x3')]},'mobile':{'type':Sequelize[_0x30df('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x30df('0x3')]},'url':{'type':Sequelize[_0x30df('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x30df('0x3')]},'teams':{'type':Sequelize[_0x30df('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x30df('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x30df('0x3')]},'UserId':{'type':Sequelize[_0x30df('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x30df('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x30df('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x30df('0x7')]},'dialTimezone':{'type':Sequelize[_0x30df('0x3')]},'utcOffset':{'type':Sequelize[_0x30df('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c9bef0d..6482a6a 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 _0xe5b9=['getOptions','findAll','user','catch','CmContact','params','tags','length','keys','startsWith','displayName','query','analytics','cf_','columnName','alias','custom','type','values','forEach','merge','body','from','get','mergeWith','isArray','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','join','dialTimezone','isNil','timezones','utcOffset','additionalPhones','each','duplicates','where','push','ListId','findOrCreate','spread','hasOwnProperty','contact','all','show','Tag','color','tag','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','cf_%d','find','CmCustomField','pickBy','format','isEmpty','table','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','rows','getHopperHistories','CmHopperHistory','ContactId','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','meta','User','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','agent','../../components/import/cm/csvUpdates','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','fullname','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Tags','DESC','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','externalUrl','startCase','Interaction','findAndCountAll','Owner','flatten','sortBy','value','slice','moment','util','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','redis','defaults','localhost','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','update','destroy','then','end','sendStatus','error','stack','name','send','index','describe'];(function(_0x1f3ce3,_0xa5ebec){var _0x16fd8c=function(_0x2eb724){while(--_0x2eb724){_0x1f3ce3['push'](_0x1f3ce3['shift']());}};_0x16fd8c(++_0xa5ebec);}(_0xe5b9,0x1e8));var _0x9e5b=function(_0x5ab012,_0x450b13){_0x5ab012=_0x5ab012-0x0;var _0x3585dd=_0xe5b9[_0x5ab012];return _0x3585dd;};'use strict';var moment=require(_0x9e5b('0x0'));var BPromise=require('bluebird');var util=require(_0x9e5b('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x9e5b('0x2'));var squel=require(_0x9e5b('0x3'));var Papa=require(_0x9e5b('0x4'));var Redis=require(_0x9e5b('0x5'));var contacts=require(_0x9e5b('0x6'));var qs=require(_0x9e5b('0x7'));var logger=require(_0x9e5b('0x8'))(_0x9e5b('0x9'));var config=require('../../config/environment');var shared=require(_0x9e5b('0xa'));var db=require('../../mysqldb')['db'];config[_0x9e5b('0xb')]=_[_0x9e5b('0xc')](config[_0x9e5b('0xb')],{'host':_0x9e5b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e5b('0xe'))[_0x9e5b('0xf')](socket);function respondWithResult(_0xc97c62,_0x32cd08){_0x32cd08=_0x32cd08||0xc8;return function(_0x313cd7){if(_0x313cd7){return _0xc97c62[_0x9e5b('0x10')](_0x32cd08)[_0x9e5b('0x11')](_0x313cd7);}};}function respondWithFilteredResult(_0x44bb70,_0x500447){return function(_0x525c68){if(_0x525c68){var _0x1f32d9=typeof _0x500447[_0x9e5b('0x12')]==='undefined'&&typeof _0x500447[_0x9e5b('0x13')]===_0x9e5b('0x14');var _0x536068=_0x525c68[_0x9e5b('0x15')];var _0x27eb9f=_0x1f32d9?0x0:_0x500447[_0x9e5b('0x12')];var _0x9f794e=_0x1f32d9?_0x525c68['count']:_0x500447[_0x9e5b('0x12')]+_0x500447[_0x9e5b('0x13')];var _0x13cd1e;if(_0x9f794e>=_0x536068){_0x9f794e=_0x536068;_0x13cd1e=0xc8;}else{_0x13cd1e=0xce;}_0x44bb70[_0x9e5b('0x10')](_0x13cd1e);return _0x44bb70[_0x9e5b('0x16')]('Content-Range',_0x27eb9f+'-'+_0x9f794e+'/'+_0x536068)[_0x9e5b('0x11')](_0x525c68);}return null;};}function saveUpdates(_0x45365d){return function(_0x16662c){if(_0x16662c){return _0x16662c[_0x9e5b('0x17')](_0x45365d)['then'](function(_0x4e558b){return _0x4e558b;});}return null;};}function removeEntity(_0x540a64){return function(_0x2c2ea8){if(_0x2c2ea8){return _0x2c2ea8[_0x9e5b('0x18')]()[_0x9e5b('0x19')](function(){_0x540a64[_0x9e5b('0x10')](0xcc)[_0x9e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4d6a0b){return function(_0x50f2fe){if(!_0x50f2fe){_0x4d6a0b[_0x9e5b('0x1b')](0x194);}return _0x50f2fe;};}function handleError(_0x518e82,_0x241450){_0x241450=_0x241450||0x1f4;return function(_0x4ee073){logger[_0x9e5b('0x1c')](_0x4ee073[_0x9e5b('0x1d')]);if(_0x4ee073[_0x9e5b('0x1e')]){delete _0x4ee073[_0x9e5b('0x1e')];}_0x518e82[_0x9e5b('0x10')](_0x241450)[_0x9e5b('0x1f')](_0x4ee073);};}exports[_0x9e5b('0x20')]=function(_0x25579d,_0x21315c){var _0xf1b3fc={};return contacts[_0x9e5b('0x21')]()['then'](function(_0xaf935c){_0xf1b3fc=qs[_0x9e5b('0x22')](_0xaf935c,_0x25579d);return contacts[_0x9e5b('0x23')](_0x25579d['query'],_0x25579d[_0x9e5b('0x24')],_0xf1b3fc,_0xaf935c);})[_0x9e5b('0x19')](respondWithFilteredResult(_0x21315c,_0xf1b3fc))[_0x9e5b('0x25')](handleError(_0x21315c,null));};exports[_0x9e5b('0x18')]=function(_0xa29151,_0x7121f5){return db[_0x9e5b('0x26')]['find']({'where':{'id':_0xa29151[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x7121f5,null))['then'](removeEntity(_0x7121f5,null))[_0x9e5b('0x25')](handleError(_0x7121f5,null));};exports[_0x9e5b('0x21')]=function(_0x881030,_0x1d0253){return db[_0x9e5b('0x26')][_0x9e5b('0x21')]()[_0x9e5b('0x19')](function(_0x3e8211){delete _0x3e8211[_0x9e5b('0x28')];for(var _0x46bd3f=0x0;_0x46bd3f0x0){return new Promise(function(_0x532be5){var _0x5dfd4c=[];for(var _0x464f5c=0x0;_0x464f5c<_0x1a3e5f[_0x9e5b('0x29')];_0x464f5c++){_0x5dfd4c['push'](insertAdditionalPhones(_0x1a3e5f[_0x464f5c][_0x9e5b('0x64')],_0x1a3e5f[_0x464f5c]['additionalPhones']));}Promise[_0x9e5b('0x65')](_0x5dfd4c)['then'](function(){_0x532be5(0x1);});})[_0x9e5b('0x19')](function(){return{'success':_0x1812cd,'failure':_0x106ecd,'duplicates':_0x193994};});}else{return{'success':_0x1812cd,'failure':_0x106ecd,'duplicates':_0x193994};}}})['then'](respondWithResult(_0x4c0f0b,0xc9))[_0x9e5b('0x25')](handleError(_0x4c0f0b,null));};exports[_0x9e5b('0x66')]=function(_0x11d275,_0x2f5e73){var _0x130e64;return db[_0x9e5b('0x26')][_0x9e5b('0x21')]()[_0x9e5b('0x19')](function(_0x42886b){return db[_0x9e5b('0x26')]['find']({'where':{'id':_0x11d275[_0x9e5b('0x27')]['id']},'include':[{'model':db[_0x9e5b('0x67')],'as':'Tags','attributes':['id',_0x9e5b('0x1e'),_0x9e5b('0x68')],'required':_0x11d275['query'][_0x9e5b('0x69')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x11d275[_0x9e5b('0x27')]['id']},'required':![],'include':[{'model':db[_0x9e5b('0x6a')],'as':_0x9e5b('0x6b')}]}],'order':[db[_0x9e5b('0x6c')][_0x9e5b('0x6d')](_0x9e5b('0x6e'))],'attributes':_[_0x9e5b('0x2a')](_0x42886b)});})[_0x9e5b('0x19')](function(_0x1ab98b){if(!_['isNil'](_0x1ab98b)){_0x130e64=_0x1ab98b['get']({'plain':!![]});var _0x5b98ae={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1ab98b&&_0x1ab98b[_0x9e5b('0x60')]){if(_0x1ab98b['ListId']){_0x5b98ae['where'][_0x9e5b('0x6f')][_0x9e5b('0x5f')]({'ListId':{'$ne':_0x1ab98b[_0x9e5b('0x60')]}});}}return db['CmCustomField'][_0x9e5b('0x23')](_0x5b98ae);}})[_0x9e5b('0x19')](function(_0x1261a7){if(!_['isNil'](_0x1261a7)){return _[_0x9e5b('0x70')](_0x130e64,_[_0x9e5b('0x71')](_0x1261a7,function(_0x2b93da){return util['format'](_0x9e5b('0x72'),_0x2b93da['id']);}));}})[_0x9e5b('0x19')](handleEntityNotFound(_0x2f5e73,null))[_0x9e5b('0x19')](respondWithResult(_0x2f5e73,null))[_0x9e5b('0x25')](handleError(_0x2f5e73,null));};exports[_0x9e5b('0x17')]=function(_0x15c11c,_0x434f66){var _0x2e28a0;if(_0x15c11c['body']['id']){delete _0x15c11c['body']['id'];}if(!_[_0x9e5b('0x58')](_0x15c11c[_0x9e5b('0x37')][_0x9e5b('0x57')])){var _0x59e8c1=_0x15c11c[_0x9e5b('0x37')][_0x9e5b('0x57')];if(!_[_0x9e5b('0x58')](shared[_0x9e5b('0x59')][_0x59e8c1]))_0x15c11c[_0x9e5b('0x37')][_0x9e5b('0x5a')]=shared[_0x9e5b('0x59')][_0x59e8c1][_0x9e5b('0x5a')];}return db[_0x9e5b('0x26')][_0x9e5b('0x73')]({'where':{'id':_0x15c11c[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x434f66,null))[_0x9e5b('0x19')](saveUpdates(_0x15c11c[_0x9e5b('0x37')],null))['then'](function(_0x243164){_0x2e28a0=_0x243164;var _0x1da800={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x243164&&_0x243164[_0x9e5b('0x60')]){if(_0x243164[_0x9e5b('0x60')]){_0x1da800[_0x9e5b('0x5e')]['$and']['push']({'ListId':{'$ne':_0x243164[_0x9e5b('0x60')]}});}}return db[_0x9e5b('0x74')][_0x9e5b('0x23')](_0x1da800);})[_0x9e5b('0x19')](function(_0x2a8ef5){if(_0x2a8ef5){return _['omit'](_[_0x9e5b('0x75')](_0x15c11c['body'],function(_0x48d640,_0x21e424){return _[_0x9e5b('0x2b')](_0x21e424,'cf_');}),_['map'](_0x2a8ef5,function(_0x533b85){return util[_0x9e5b('0x76')](_0x9e5b('0x72'),_0x533b85['id']);}));}})[_0x9e5b('0x19')](function(_0xd64ada){if(_0xd64ada&&!_[_0x9e5b('0x77')](_0xd64ada)){var _0xf96f3b=squel[_0x9e5b('0x17')]()[_0x9e5b('0x78')]('cm_contacts')['setFields'](_0xd64ada)[_0x9e5b('0x5e')](_0x9e5b('0x79'),_0x15c11c['params']['id'])[_0x9e5b('0x7a')]();return db[_0x9e5b('0x6c')][_0x9e5b('0x2d')](_0xf96f3b[_0x9e5b('0x7b')],{'replacements':_0xf96f3b[_0x9e5b('0x34')]});}})[_0x9e5b('0x19')](function(){if(_0x15c11c[_0x9e5b('0x37')][_0x9e5b('0x7c')]&&_0x2e28a0){return db[_0x9e5b('0x3d')][_0x9e5b('0x17')]({'phone':_0x15c11c['body'][_0x9e5b('0x7c')],'OrderBy':0x0},{'where':{'ContactId':_0x2e28a0['id']}});}})[_0x9e5b('0x19')](function(){return _0x2e28a0;})[_0x9e5b('0x19')](respondWithResult(_0x434f66,null))[_0x9e5b('0x25')](handleError(_0x434f66,null));};exports[_0x9e5b('0x7d')]=function(_0x4c6286,_0x4f59ba){var _0x4f86b7={};var _0x593f53={};var _0x23a243;var _0x5f44db;return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x4c6286[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x4f59ba,null))['then'](function(_0x4089c9){if(_0x4089c9){_0x23a243=_0x4089c9;_0x593f53[_0x9e5b('0x7f')]=_[_0x9e5b('0x2a')](db[_0x9e5b('0x67')][_0x9e5b('0x80')]);_0x593f53['query']=_[_0x9e5b('0x2a')](_0x4c6286['query']);_0x593f53[_0x9e5b('0x81')]=_[_0x9e5b('0x82')](_0x593f53[_0x9e5b('0x7f')],_0x593f53[_0x9e5b('0x2d')]);_0x4f86b7[_0x9e5b('0x83')]=_[_0x9e5b('0x82')](_0x593f53[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x4c6286[_0x9e5b('0x2d')][_0x9e5b('0x84')]));_0x4f86b7[_0x9e5b('0x83')]=_0x4f86b7['attributes'][_0x9e5b('0x29')]?_0x4f86b7['attributes']:_0x593f53['model'];_0x4f86b7[_0x9e5b('0x85')]=qs['sort'](_0x4c6286[_0x9e5b('0x2d')][_0x9e5b('0x86')]);_0x4f86b7[_0x9e5b('0x5e')]=qs[_0x9e5b('0x81')](_[_0x9e5b('0x87')](_0x4c6286[_0x9e5b('0x2d')],_0x593f53['filters']));if(_0x4c6286[_0x9e5b('0x2d')][_0x9e5b('0x88')]){_0x4f86b7[_0x9e5b('0x5e')]=_[_0x9e5b('0x36')](_0x4f86b7['where'],{'$or':_[_0x9e5b('0x71')](_0x4f86b7['attributes'],function(_0x38c68b){var _0xc410da={};_0xc410da[_0x38c68b]={'$like':'%'+_0x4c6286['query'][_0x9e5b('0x88')]+'%'};return _0xc410da;})});}_0x4f86b7=_[_0x9e5b('0x36')]({},_0x4f86b7,_0x4c6286[_0x9e5b('0x89')]);return _0x23a243['getTags'](_0x4f86b7);}})['then'](function(_0x36f050){if(_0x36f050){_0x5f44db=_0x36f050['length'];if(!_0x4c6286[_0x9e5b('0x2d')]['hasOwnProperty'](_0x9e5b('0x8a'))){_0x4f86b7['limit']=qs[_0x9e5b('0x13')](_0x4c6286['query']['limit']);_0x4f86b7[_0x9e5b('0x12')]=qs[_0x9e5b('0x12')](_0x4c6286[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}return _0x23a243[_0x9e5b('0x7d')](_0x4f86b7);}})[_0x9e5b('0x19')](function(_0x34724a){if(_0x34724a){return _0x34724a?{'count':_0x5f44db,'rows':_0x34724a}:null;}})[_0x9e5b('0x19')](respondWithResult(_0x4f59ba,null))['catch'](handleError(_0x4f59ba,null));};exports[_0x9e5b('0x8b')]=function(_0x3d8e91,_0x156cf4){if(_0x3d8e91[_0x9e5b('0x37')]['id']){delete _0x3d8e91[_0x9e5b('0x37')]['id'];}return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x3d8e91[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x156cf4,null))[_0x9e5b('0x19')](function(_0x38e6ef){if(_0x38e6ef){return _0x38e6ef[_0x9e5b('0x8b')](_0x3d8e91[_0x9e5b('0x37')][_0x9e5b('0x8c')]||[]);}return null;})[_0x9e5b('0x19')](respondWithResult(_0x156cf4,null))[_0x9e5b('0x25')](handleError(_0x156cf4,null));};exports[_0x9e5b('0x8d')]=function(_0x518310,_0x2a43e7){var _0x480043=[];_0x480043[_0x9e5b('0x5f')](addAdditionalPhones(_0x518310['body']));Promise[_0x9e5b('0x65')](_0x480043)[_0x9e5b('0x19')](function(){_0x480043=[];_0x480043[_0x9e5b('0x5f')](deleteCmHopperPhones(_0x518310[_0x9e5b('0x37')]['id']));_0x480043[_0x9e5b('0x5f')](addCmHopperPhones(_0x518310[_0x9e5b('0x37')]['id']));Promise[_0x9e5b('0x65')](_0x480043)['then'](function(){return[0x1];})[_0x9e5b('0x19')](respondWithResult(_0x2a43e7,null));});};function addAdditionalPhones(_0x1d9a4f){var _0x49e0e1;return new Promise(function(_0x55aaed){return db[_0x9e5b('0x4b')][_0x9e5b('0x18')]({'where':{'CmContactId':_0x1d9a4f['id']}})['then'](function(){db[_0x9e5b('0x6a')][_0x9e5b('0x23')]({'raw':!![],'attributes':['id',_0x9e5b('0x8e')]})[_0x9e5b('0x19')](function(_0x20d361){var _0x173535=[];for(var _0x500b6d=0x0;_0x500b6d<_0x1d9a4f[_0x9e5b('0x8f')][_0x9e5b('0x29')];_0x500b6d++){var _0x39c579=_0x1d9a4f[_0x9e5b('0x90')]?_['isNil'](_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d])?'':_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d]:_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x91')]?_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x91')]:'';var _0x5138bf=_['isNil'](_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d]['description'])?'':_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x92')];var _0x4bad8a=_0x39c579+':'+_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x7c')]+'§'+_0x5138bf;if(_[_0x9e5b('0x58')](_0x49e0e1))_0x49e0e1=_0x4bad8a;else _0x49e0e1+=';'+_0x4bad8a;var _0x21e8c4=null;var _0x6f42a1=null;if(_0x1d9a4f[_0x9e5b('0x90')]){if(!_[_0x9e5b('0x58')](_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d])){_0x6f42a1=_[_0x9e5b('0x73')](_0x20d361,function(_0x5c3703){return _0x5c3703['id']===_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d];});if(!_['isNil'](_0x6f42a1)){_0x21e8c4=_0x6f42a1['OrderBy'];}}}else{if(!_[_0x9e5b('0x58')](_0x1d9a4f['items'][_0x500b6d])){_0x6f42a1=_[_0x9e5b('0x73')](_0x20d361,function(_0x6c7ca){return _0x6c7ca['id']===_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x91')];});if(!_['isNil'](_0x6f42a1)){_0x21e8c4=_0x500b6d;}}}if(_['isNil'](_0x21e8c4)){_0x21e8c4=0x64;}_0x173535[_0x9e5b('0x5f')](addAdditionalPhone(_0x1d9a4f['id'],_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d][_0x9e5b('0x7c')],_0x1d9a4f[_0x9e5b('0x90')]?_[_0x9e5b('0x58')](_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d])?null:_0x1d9a4f[_0x9e5b('0x90')][_0x500b6d]:_0x1d9a4f['items'][_0x500b6d][_0x9e5b('0x91')]?_0x1d9a4f[_0x9e5b('0x8f')][_0x500b6d]['ItemTypeId']:null,_0x21e8c4,_0x5138bf));}Promise['all'](_0x173535)[_0x9e5b('0x19')](function(){db[_0x9e5b('0x26')][_0x9e5b('0x17')]({'AdditionalPhones':_0x49e0e1},{'where':{'id':_0x1d9a4f['id']}})[_0x9e5b('0x19')](function(){_0x55aaed(0x1);});});});});});}function addAdditionalPhone(_0x55c317,_0x3277df,_0x209bc0,_0x4edccb,_0x5a64c7){return db['CmContactHasItem'][_0x9e5b('0x73')]({'where':{'CmContactId':_0x55c317,'item':_0x3277df}})['then'](function(_0x25a670){if(_0x25a670)logger['info'](_0x9e5b('0x93'),_0x25a670);else{db[_0x9e5b('0x4b')][_0x9e5b('0x41')]({'CmContactId':_0x55c317,'item':_0x3277df,'ItemTypeId':_0x209bc0,'OrderBy':_0x4edccb,'ItemClass':_0x9e5b('0x94'),'description':_0x5a64c7});}});}function deleteCmHopperPhones(_0x13e922){return new Promise(function(_0x1b2795){return db[_0x9e5b('0x3d')][_0x9e5b('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x13e922}})[_0x9e5b('0x19')](function(_0x353dc5){db[_0x9e5b('0x95')][_0x9e5b('0x18')]({'where':{'CmHopperId':{'$in':_[_0x9e5b('0x71')](_0x353dc5,'id')}}});})[_0x9e5b('0x19')](function(){_0x1b2795(0x1);});});}function addCmHopperPhones(_0x5c8b3b){return new Promise(function(_0x41633b){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5c8b3b}})['then'](function(_0x3895f7){var _0x11d1f2=[];_[_0x9e5b('0x71')](_0x3895f7,function(_0x2fe68b){_0x11d1f2[_0x9e5b('0x5f')](createCmHopperPhone(_0x5c8b3b,_0x2fe68b['id']));});Promise[_0x9e5b('0x65')](_0x11d1f2)['then'](function(){_0x41633b(0x1);});});});}function createCmHopperPhone(_0x5b6198,_0x4c7c49){return new Promise(function(_0x519ab9){db['CmContactHasItem'][_0x9e5b('0x23')]({'raw':!![],'attributes':[_0x9e5b('0x96'),_0x9e5b('0x8e')],'where':{'CmContactId':_0x5b6198,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x9e5b('0x6b')}],'order':[_0x9e5b('0x8e'),db[_0x9e5b('0x6c')][_0x9e5b('0x6d')](_0x9e5b('0x97'))]})['then'](function(_0x216fb5){var _0x24af61=0x1;var _0x5deea5=_['map'](_0x216fb5,function(_0x246e2b){_0x246e2b['CmHopperId']=_0x4c7c49;_0x246e2b['phone']=_0x246e2b[_0x9e5b('0x96')];_0x246e2b[_0x9e5b('0x8e')]=_0x24af61;delete _0x246e2b['ItemType.OrderBy'];_0x24af61=_0x24af61+0x1;return _0x246e2b;});return db[_0x9e5b('0x95')][_0x9e5b('0x98')](_0x5deea5,{});})[_0x9e5b('0x19')](function(){_0x519ab9(0x1);});});}function insertAdditionalPhones(_0x10dfa8,_0x21060a){return new Promise(function(_0x293cda){var _0x358fb5=[];for(var _0x59789d=0x0;_0x59789d<_0x21060a['length'];_0x59789d++){var _0x3bba19=_0x21060a[_0x59789d];_0x358fb5['push'](parseContactItemType(_0x3bba19));}Promise[_0x9e5b('0x65')](_0x358fb5)[_0x9e5b('0x19')](function(){var _0xc7cba7={'id':_0x10dfa8['id'],'items':_0x21060a};return addAdditionalPhones(_0xc7cba7)[_0x9e5b('0x19')](function(){return addCmHopperPhones(_0x10dfa8['id']);});})[_0x9e5b('0x19')](function(){_0x293cda(_0x10dfa8);});});}function parseContactItemType(_0x5b02d2){return new Promise(function(_0x11bc90){if(_0x5b02d2[_0x9e5b('0x63')]('ItemTypeId')){_0x11bc90(_0x5b02d2);}else{return db[_0x9e5b('0x6a')][_0x9e5b('0x73')]({'where':{'name':_0x5b02d2[_0x9e5b('0x6b')]}})[_0x9e5b('0x19')](function(_0x5ebe94){if(_[_0x9e5b('0x58')](_0x5ebe94))_0x5b02d2[_0x9e5b('0x91')]=null;else _0x5b02d2[_0x9e5b('0x91')]=_0x5ebe94['id'];_0x11bc90(_0x5b02d2);});}});}exports[_0x9e5b('0x99')]=function(_0xfcd3a7,_0x49a98b){return db['CmContactHasItem'][_0x9e5b('0x23')]({'raw':!![],'where':{'CmContactId':_0xfcd3a7['params']['id'],'ItemClass':_0x9e5b('0x94')},'include':[{'model':db['ContactItemType'],'as':_0x9e5b('0x6b')}],'order':[['OrderBy'],[db['sequelize'][_0x9e5b('0x6d')](_0x9e5b('0x97'))]]})[_0x9e5b('0x19')](function(_0x39e50a){return _0x39e50a;})[_0x9e5b('0x19')](respondWithResult(_0x49a98b,null))[_0x9e5b('0x25')](handleError(_0x49a98b,null));};exports[_0x9e5b('0x9a')]=function(_0x278055,_0x325f16){return db[_0x9e5b('0x4b')][_0x9e5b('0x23')]({'raw':!![],'where':{'CmContactId':_0x278055[_0x9e5b('0x37')][_0x9e5b('0x9b')]}})['then'](function(_0x238088){var _0x4e86f1=_['map'](_0x238088,function(_0x299653){_0x299653[_0x9e5b('0x9c')]=_0x278055[_0x9e5b('0x37')][_0x9e5b('0x9d')];return _0x299653;});return db[_0x9e5b('0x4b')]['bulkCreate'](_0x4e86f1,{});})[_0x9e5b('0x19')](function(){return addCmHopperPhones(_0x278055['body'][_0x9e5b('0x9d')]);})[_0x9e5b('0x19')](function(){return['ok'];})[_0x9e5b('0x19')](respondWithResult(_0x325f16,null))[_0x9e5b('0x25')](handleError(_0x325f16,null));};exports[_0x9e5b('0x9e')]=function(_0x2bf9c8,_0x9dd8ab){var _0x348562=[];_0x348562[_0x9e5b('0x5f')](createCmHopperPhone(_0x2bf9c8[_0x9e5b('0x37')]['id'],_0x2bf9c8[_0x9e5b('0x37')][_0x9e5b('0x9f')]));Promise[_0x9e5b('0x65')](_0x348562)[_0x9e5b('0x19')](function(){return[0x1];})[_0x9e5b('0x19')](respondWithResult(_0x9dd8ab,null));};exports[_0x9e5b('0xa0')]=function(_0x5a1c8c,_0x1a4f6e){var _0x413a3f={'raw':![],'where':{}};var _0x1573bf={};var _0x401eee={'count':0x0,'rows':[]};return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x5a1c8c['params']['id']}})['then'](handleEntityNotFound(_0x1a4f6e,null))['then'](function(_0x1d52a1){if(_0x1d52a1){_0x1573bf[_0x9e5b('0x7f')]=_[_0x9e5b('0x2a')](db['CmHopper']['rawAttributes']);_0x1573bf[_0x9e5b('0x2d')]=_[_0x9e5b('0x2a')](_0x5a1c8c['query']);_0x1573bf[_0x9e5b('0x81')]=_[_0x9e5b('0x82')](_0x1573bf['model'],_0x1573bf[_0x9e5b('0x2d')]);_0x413a3f['attributes']=_[_0x9e5b('0x82')](_0x1573bf[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0x84')]));_0x413a3f[_0x9e5b('0x83')]=_0x413a3f[_0x9e5b('0x83')][_0x9e5b('0x29')]?_0x413a3f[_0x9e5b('0x83')]:_0x1573bf['model'];if(!_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0x63')]('nolimit')){_0x413a3f[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x5a1c8c['query'][_0x9e5b('0x13')]);_0x413a3f[_0x9e5b('0x12')]=qs[_0x9e5b('0x12')](_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}_0x413a3f['order']=qs[_0x9e5b('0x86')](_0x5a1c8c['query'][_0x9e5b('0x86')]);_0x413a3f[_0x9e5b('0x5e')]=qs[_0x9e5b('0x81')](_[_0x9e5b('0x87')](_0x5a1c8c['query'],_0x1573bf['filters']));_0x413a3f[_0x9e5b('0x5e')]['ContactId']=_0x1d52a1['id'];if(_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0x88')]){_0x413a3f['where']=_[_0x9e5b('0x36')](_0x413a3f[_0x9e5b('0x5e')],{'$or':_[_0x9e5b('0x71')](_0x413a3f[_0x9e5b('0x83')],function(_0xc426cf){var _0xa68de5={};_0xa68de5[_0xc426cf]={'$like':'%'+_0x5a1c8c['query']['filter']+'%'};return _0xa68de5;})});}_0x413a3f=_[_0x9e5b('0x36')]({},_0x413a3f,_0x5a1c8c[_0x9e5b('0x89')]);return db['CmHopper'][_0x9e5b('0x15')]({'where':_0x413a3f[_0x9e5b('0x5e')]})[_0x9e5b('0x19')](function(_0x5eb73f){_0x401eee[_0x9e5b('0x15')]=_0x5eb73f;if(_0x5a1c8c[_0x9e5b('0x2d')][_0x9e5b('0xa1')]){_0x413a3f[_0x9e5b('0xa2')]=[{'all':!![]}];}return db[_0x9e5b('0x3d')][_0x9e5b('0x23')](_0x413a3f);})[_0x9e5b('0x19')](function(_0x7fc36){_0x401eee[_0x9e5b('0xa3')]=_0x7fc36;return _0x401eee;});}})[_0x9e5b('0x19')](respondWithFilteredResult(_0x1a4f6e,_0x413a3f))['catch'](handleError(_0x1a4f6e,null));};exports[_0x9e5b('0xa4')]=function(_0x450a82,_0xc3580f){var _0x160024={'raw':!![],'where':{}};var _0x3a8e9e={};var _0xb9cdfb={'count':0x0,'rows':[]};return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x450a82[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0xc3580f,null))[_0x9e5b('0x19')](function(_0x4974a7){if(_0x4974a7){_0x3a8e9e[_0x9e5b('0x7f')]=_[_0x9e5b('0x2a')](db[_0x9e5b('0xa5')][_0x9e5b('0x80')]);_0x3a8e9e[_0x9e5b('0x2d')]=_[_0x9e5b('0x2a')](_0x450a82[_0x9e5b('0x2d')]);_0x3a8e9e['filters']=_[_0x9e5b('0x82')](_0x3a8e9e['model'],_0x3a8e9e[_0x9e5b('0x2d')]);_0x160024['attributes']=_[_0x9e5b('0x82')](_0x3a8e9e[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x84')]));_0x160024[_0x9e5b('0x83')]=_0x160024[_0x9e5b('0x83')][_0x9e5b('0x29')]?_0x160024[_0x9e5b('0x83')]:_0x3a8e9e[_0x9e5b('0x7f')];if(!_0x450a82[_0x9e5b('0x2d')]['hasOwnProperty']('nolimit')){_0x160024[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x450a82['query'][_0x9e5b('0x13')]);_0x160024['offset']=qs[_0x9e5b('0x12')](_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}_0x160024[_0x9e5b('0x85')]=qs[_0x9e5b('0x86')](_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x86')]);_0x160024['where']=qs['filters'](_[_0x9e5b('0x87')](_0x450a82['query'],_0x3a8e9e[_0x9e5b('0x81')]));_0x160024[_0x9e5b('0x5e')]['ContactId']=_0x4974a7['id'];if(_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x88')]){_0x160024[_0x9e5b('0x5e')]=_[_0x9e5b('0x36')](_0x160024[_0x9e5b('0x5e')],{'$or':_['map'](_0x160024[_0x9e5b('0x83')],function(_0x96d295){var _0x49edbd={};_0x49edbd[_0x96d295]={'$like':'%'+_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0x88')]+'%'};return _0x49edbd;})});}_0x160024=_[_0x9e5b('0x36')]({},_0x160024,_0x450a82[_0x9e5b('0x89')]);return db[_0x9e5b('0xa5')]['count']({'where':_0x160024['where']})[_0x9e5b('0x19')](function(_0x3dbf06){_0xb9cdfb[_0x9e5b('0x15')]=_0x3dbf06;if(_0x450a82[_0x9e5b('0x2d')][_0x9e5b('0xa1')]){_0x160024[_0x9e5b('0xa2')]=[{'all':!![]}];}return db[_0x9e5b('0xa5')]['findAll'](_0x160024);})['then'](function(_0x1dfbed){_0xb9cdfb[_0x9e5b('0xa3')]=_0x1dfbed;return _0xb9cdfb;});}})['then'](respondWithFilteredResult(_0xc3580f,_0x160024))[_0x9e5b('0x25')](handleError(_0xc3580f,null));};exports['getHopperFinals']=function(_0x366636,_0x4a0f98){var _0x541309={'raw':!![],'where':{}};var _0x288ca9={};var _0x4bcc79={'count':0x0,'rows':[]};return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x366636[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x4a0f98,null))[_0x9e5b('0x19')](function(_0x3b076f){if(_0x3b076f){_0x288ca9['model']=_[_0x9e5b('0x2a')](db[_0x9e5b('0x4c')][_0x9e5b('0x80')]);_0x288ca9[_0x9e5b('0x2d')]=_[_0x9e5b('0x2a')](_0x366636[_0x9e5b('0x2d')]);_0x288ca9[_0x9e5b('0x81')]=_['intersection'](_0x288ca9[_0x9e5b('0x7f')],_0x288ca9[_0x9e5b('0x2d')]);_0x541309['attributes']=_['intersection'](_0x288ca9[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x366636['query']['fields']));_0x541309[_0x9e5b('0x83')]=_0x541309[_0x9e5b('0x83')][_0x9e5b('0x29')]?_0x541309[_0x9e5b('0x83')]:_0x288ca9[_0x9e5b('0x7f')];if(!_0x366636['query']['hasOwnProperty'](_0x9e5b('0x8a'))){_0x541309[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x366636['query'][_0x9e5b('0x13')]);_0x541309['offset']=qs[_0x9e5b('0x12')](_0x366636['query'][_0x9e5b('0x12')]);}_0x541309['order']=qs[_0x9e5b('0x86')](_0x366636[_0x9e5b('0x2d')][_0x9e5b('0x86')]);_0x541309['where']=qs[_0x9e5b('0x81')](_[_0x9e5b('0x87')](_0x366636['query'],_0x288ca9[_0x9e5b('0x81')]));_0x541309['where'][_0x9e5b('0xa6')]=_0x3b076f['id'];if(_0x366636['query'][_0x9e5b('0x88')]){_0x541309[_0x9e5b('0x5e')]=_['merge'](_0x541309[_0x9e5b('0x5e')],{'$or':_[_0x9e5b('0x71')](_0x541309[_0x9e5b('0x83')],function(_0x4f2185){var _0x52203e={};_0x52203e[_0x4f2185]={'$like':'%'+_0x366636[_0x9e5b('0x2d')][_0x9e5b('0x88')]+'%'};return _0x52203e;})});}_0x541309=_['merge']({},_0x541309,_0x366636[_0x9e5b('0x89')]);return db[_0x9e5b('0x4c')][_0x9e5b('0x15')]({'where':_0x541309[_0x9e5b('0x5e')]})[_0x9e5b('0x19')](function(_0x329845){_0x4bcc79[_0x9e5b('0x15')]=_0x329845;if(_0x366636['query']['includeAll']){_0x541309['include']=[{'all':!![]}];}return db[_0x9e5b('0x4c')][_0x9e5b('0x23')](_0x541309);})[_0x9e5b('0x19')](function(_0x55be6d){_0x4bcc79[_0x9e5b('0xa3')]=_0x55be6d;return _0x4bcc79;});}})[_0x9e5b('0x19')](respondWithFilteredResult(_0x4a0f98,_0x541309))['catch'](handleError(_0x4a0f98,null));};exports['getJscriptySessions']=function(_0x5c2061,_0x29930a){var _0x4a530e={'raw':!![],'where':{}};var _0x153f25={};var _0x36f850={'count':0x0,'rows':[]};return db[_0x9e5b('0x26')][_0x9e5b('0x7e')]({'where':{'id':_0x5c2061[_0x9e5b('0x27')]['id']}})[_0x9e5b('0x19')](handleEntityNotFound(_0x29930a,null))[_0x9e5b('0x19')](function(_0x4d43af){if(_0x4d43af){_0x153f25['model']=_['keys'](db[_0x9e5b('0x53')][_0x9e5b('0x80')]);_0x153f25[_0x9e5b('0x2d')]=_[_0x9e5b('0x2a')](_0x5c2061[_0x9e5b('0x2d')]);_0x153f25['filters']=_[_0x9e5b('0x82')](_0x153f25[_0x9e5b('0x7f')],_0x153f25[_0x9e5b('0x2d')]);_0x4a530e[_0x9e5b('0x83')]=_[_0x9e5b('0x82')](_0x153f25[_0x9e5b('0x7f')],qs[_0x9e5b('0x84')](_0x5c2061[_0x9e5b('0x2d')][_0x9e5b('0x84')]));_0x4a530e[_0x9e5b('0x83')]=_0x4a530e['attributes']['length']?_0x4a530e[_0x9e5b('0x83')]:_0x153f25[_0x9e5b('0x7f')];if(!_0x5c2061[_0x9e5b('0x2d')]['hasOwnProperty']('nolimit')){_0x4a530e[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x5c2061['query'][_0x9e5b('0x13')]);_0x4a530e[_0x9e5b('0x12')]=qs[_0x9e5b('0x12')](_0x5c2061[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}_0x4a530e['order']=qs[_0x9e5b('0x86')](_0x5c2061['query'][_0x9e5b('0x86')]);_0x4a530e[_0x9e5b('0x5e')]=qs['filters'](_[_0x9e5b('0x87')](_0x5c2061[_0x9e5b('0x2d')],_0x153f25[_0x9e5b('0x81')]));_0x4a530e[_0x9e5b('0x5e')][_0x9e5b('0xa6')]=_0x4d43af['id'];if(_0x5c2061[_0x9e5b('0x2d')][_0x9e5b('0x88')]){_0x4a530e[_0x9e5b('0x5e')]=_[_0x9e5b('0x36')](_0x4a530e[_0x9e5b('0x5e')],{'$or':_[_0x9e5b('0x71')](_0x4a530e[_0x9e5b('0x83')],function(_0x151f5b){var _0x59389b={};_0x59389b[_0x151f5b]={'$like':'%'+_0x5c2061[_0x9e5b('0x2d')][_0x9e5b('0x88')]+'%'};return _0x59389b;})});}_0x4a530e=_[_0x9e5b('0x36')]({},_0x4a530e,_0x5c2061[_0x9e5b('0x89')]);return db[_0x9e5b('0x53')]['count']({'where':_0x4a530e['where']})['then'](function(_0x171118){_0x36f850['count']=_0x171118;if(_0x5c2061['query']['includeAll']){_0x4a530e[_0x9e5b('0xa2')]=[{'all':!![]}];}return db[_0x9e5b('0x53')]['findAll'](_0x4a530e);})['then'](function(_0x4c99c2){_0x36f850['rows']=_0x4c99c2;return _0x36f850;});}})[_0x9e5b('0x19')](respondWithFilteredResult(_0x29930a,_0x4a530e))['catch'](handleError(_0x29930a,null));};exports[_0x9e5b('0xa7')]=function(_0x4503c0,_0x489a91){try{if(!_0x4503c0['body'][_0x9e5b('0x60')]){throw new Error(_0x9e5b('0xa8'));}if(!_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xa9')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4503c0[_0x9e5b('0x37')]['binding_values']){throw new Error(_0x9e5b('0xaa'));}if(!_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xab')]){throw new Error(_0x9e5b('0xac'));}var _0x484fb0=_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xa9')][_0x9e5b('0xad')](',');var _0x227649=_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xae')]['split'](',');if(!_0x484fb0[_0x9e5b('0x29')]||!_0x227649[_0x9e5b('0x29')]||_0x484fb0[_0x9e5b('0x29')]!==_0x227649[_0x9e5b('0x29')]){throw new Error(_0x9e5b('0xaf'));}_0x4503c0[_0x9e5b('0x37')]['fields']=_[_0x9e5b('0xb0')](_0x484fb0,_0x227649);if(!_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0x84')][_0x9e5b('0x7c')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0x84')][_0x9e5b('0xb1')]){throw new Error(_0x9e5b('0xb2'));}var _0x11f252=path[_0x9e5b('0x56')](config[_0x9e5b('0xb3')],_0x9e5b('0xb4'),_0x4503c0[_0x9e5b('0xb5')][_0x9e5b('0xb6')]);fs['chmodSync'](_0x11f252,parseInt(_0x9e5b('0xb7'),0x8));var _0x3ba0bb=require(_0x9e5b('0xb8'))[_0x9e5b('0xb9')](path['join'](__dirname,_0x9e5b('0xba')),[_0x11f252,_0x4503c0[_0x9e5b('0x37')]['binding_keys'],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xae')],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0x60')],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xbb')],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0x5d')],_0x4503c0[_0x9e5b('0x37')][_0x9e5b('0xab')]]);return _0x489a91[_0x9e5b('0x10')](0xc8)[_0x9e5b('0x11')]({'message':_0x9e5b('0xbc'),'pid':_0x3ba0bb[_0x9e5b('0xbd')]});}catch(_0x5fc239){return _0x489a91[_0x9e5b('0x10')](0x1f4)['send'](_0x5fc239);}};exports[_0x9e5b('0xbe')]=function(_0x1456f8,_0x4b90f4){var _0x317a78=fs[_0x9e5b('0xbf')](_0x1456f8['file'][_0x9e5b('0xc0')]);Papa['parse'](_0x317a78,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x509775){return _0x4b90f4['status'](0xc8)['json']({'file':_0x1456f8[_0x9e5b('0xb5')],'fields':_0x509775[_0x9e5b('0xc1')][_0x9e5b('0x84')]});}});};exports['import']=function(_0x4e3e8c,_0xb75846){return db[_0x9e5b('0xc2')][_0x9e5b('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x96cc10){var _0x2420d7=![];if(!_0x4e3e8c[_0x9e5b('0x37')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x4e3e8c[_0x9e5b('0x37')][_0x9e5b('0xc3')][_0x9e5b('0x7c')]){throw new Error(_0x9e5b('0xc4'));}if(!_0x4e3e8c['body'][_0x9e5b('0xc3')]['firstName']){throw new Error(_0x9e5b('0xb2'));}if(!_0x4e3e8c['body']['socket_timestamp']){throw new Error(_0x9e5b('0xac'));}var _0x25af9f=require(_0x9e5b('0xb8'))[_0x9e5b('0xb9')](path[_0x9e5b('0x56')](__dirname,_0x9e5b('0xc5')),[_0x4e3e8c[_0x9e5b('0x27')]['id'],JSON[_0x9e5b('0xc6')](_0x4e3e8c[_0x9e5b('0x37')]),JSON[_0x9e5b('0xc6')](_0x96cc10)]);_0x25af9f['on'](_0x9e5b('0xc7'),function(){_0x2420d7=!![];return _0xb75846['status'](0xc8)[_0x9e5b('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x25af9f[_0x9e5b('0xbd')]});});_0x25af9f['on'](_0x9e5b('0xc8'),function(_0x4fe9a1){if(_0x4fe9a1&&!_0x2420d7){return _0xb75846[_0x9e5b('0x10')](0x1f4)[_0x9e5b('0x11')]({'message':_0x9e5b('0xc9'),'pid':_0x25af9f[_0x9e5b('0xbd')]});}});})[_0x9e5b('0x25')](handleError(_0xb75846,null));};exports['importUpdates']=function(_0x4eea3f,_0x35f195){return db['User'][_0x9e5b('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x9e5b('0xca')}})[_0x9e5b('0x19')](function(_0x16b388){var _0x591e80=![];if(!_0x4eea3f[_0x9e5b('0x37')]['ListId']){throw new Error(_0x9e5b('0xa8'));}if(!_0x4eea3f[_0x9e5b('0x37')][_0x9e5b('0xc3')]['phone']){throw new Error(_0x9e5b('0xc4'));}if(!_0x4eea3f['body'][_0x9e5b('0xc3')][_0x9e5b('0xb1')]){throw new Error(_0x9e5b('0xb2'));}if(!_0x4eea3f[_0x9e5b('0x37')][_0x9e5b('0xab')]){throw new Error(_0x9e5b('0xac'));}var _0x4e070=require(_0x9e5b('0xb8'))[_0x9e5b('0xb9')](path[_0x9e5b('0x56')](__dirname,_0x9e5b('0xcb')),[_0x4eea3f[_0x9e5b('0x27')]['id'],JSON[_0x9e5b('0xc6')](_0x4eea3f['body']),JSON[_0x9e5b('0xc6')](_0x16b388)]);_0x4e070['on']('message',function(){_0x591e80=!![];return _0x35f195[_0x9e5b('0x10')](0xc8)[_0x9e5b('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x4e070['pid']});});_0x4e070['on']('exit',function(_0x2b2e71){if(_0x2b2e71&&!_0x591e80){return _0x35f195[_0x9e5b('0x10')](0x1f4)[_0x9e5b('0x11')]({'message':_0x9e5b('0xc9'),'pid':_0x4e070['pid']});}});})[_0x9e5b('0x25')](handleError(_0x35f195,null));};exports[_0x9e5b('0xcc')]=function(_0x3a1f29,_0x181ced){var _0xaa2b98=['mail',_0x9e5b('0xcd'),_0x9e5b('0xce'),_0x9e5b('0xcf'),_0x9e5b('0xd0'),_0x9e5b('0xd1'),_0x9e5b('0xd2')];var _0x13be92={'offset':0x0,'order':qs[_0x9e5b('0x86')](_0x9e5b('0xd3'))},_0x2c624d={'count':0x0,'rows':[]};Promise[_0x9e5b('0xd4')]()[_0x9e5b('0x19')](function(){if(_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd5')]){if(!_[_0x9e5b('0xd6')](_0xaa2b98,_0x3a1f29['query'][_0x9e5b('0xd5')][_0x9e5b('0xd7')]())){throw new Error(_0x9e5b('0xd8'));}_0xaa2b98=[_0x3a1f29['query'][_0x9e5b('0xd5')][_0x9e5b('0xd7')]()];}if(_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd9')]){try{var _0x424ba9=JSON['parse'](_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd9')]);if(!moment(_0x424ba9['from'])['isValid']()){throw new Error(_0x9e5b('0xda'));}if(!moment(_0x424ba9['to'])['isValid']()){throw new Error(_0x9e5b('0xdb'));}}catch(_0x52ae9f){throw new Error(_0x9e5b('0xdc'));}}if(!_0x3a1f29[_0x9e5b('0x2d')]['hasOwnProperty'](_0x9e5b('0x8a'))){_0x13be92[_0x9e5b('0x13')]=qs[_0x9e5b('0x13')](_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0x13')]||0xa);_0x13be92[_0x9e5b('0x12')]=qs[_0x9e5b('0x12')](_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0x12')]);}var _0x8f2125=_0xaa2b98[_0x9e5b('0x71')](function(_0x322193){if(_0x322193===_0x9e5b('0xd2')){var _0x4e58f1={'attributes':['id',_0x9e5b('0xdd'),_0x9e5b('0x33'),_0x9e5b('0xde'),_0x9e5b('0xdf'),_0x9e5b('0xe0'),_0x9e5b('0xe1'),_0x9e5b('0xe2'),'duration',_0x9e5b('0xe3'),_0x9e5b('0xe4'),'userDisposition',_0x9e5b('0xe5'),_0x9e5b('0xe6'),'UserId'],'where':{'ContactId':_0x3a1f29['params']['id']},'include':[{'model':db[_0x9e5b('0xc2')],'as':'User','attributes':['id','name',_0x9e5b('0xe7'),'alias']}],'order':[[_0x9e5b('0xe4'),'DESC']]};if(_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd9')]){_0x4e58f1[_0x9e5b('0x5e')][_0x9e5b('0xe4')]={'$gte':_0x424ba9[_0x9e5b('0x38')],'$lte':_0x424ba9['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x4e58f1)[_0x9e5b('0x19')](function(_0x38cec1){_0x2c624d[_0x9e5b('0x15')]+=_0x38cec1[_0x9e5b('0x15')];return _[_0x9e5b('0x71')](_0x38cec1[_0x9e5b('0xa3')],function(_0x1fe088){var _0x53d84f=_0x1fe088[_0x9e5b('0x39')]({'plain':!![]});_0x53d84f[_0x9e5b('0xd5')]=_0x322193;if(_0x53d84f['User']){_0x53d84f['User']={'id':_0x53d84f['User']['id'],'name':_0x53d84f[_0x9e5b('0xc2')][_0x9e5b('0x1e')],'fullname':_0x53d84f['User'][_0x9e5b('0xe7')],'alias':_0x53d84f[_0x9e5b('0xc2')]['alias']};}return _0x53d84f;});});}else{var _0x33d38a=_['startCase'](_0x322193)+(_0x322193===_0x9e5b('0xcd')?_0x9e5b('0xe8'):'Account');var _0x2ab6a8={'attributes':['id',_0x9e5b('0xe9'),_0x9e5b('0xea'),_0x9e5b('0xe4'),'note',_0x9e5b('0xeb'),_0x9e5b('0xec'),_0x9e5b('0xed'),'UserId',_0x33d38a+'Id'],'where':{'ContactId':_0x3a1f29[_0x9e5b('0x27')]['id']},'include':[{'model':db[_0x33d38a],'as':'Account','attributes':['id',_0x9e5b('0x1e'),_0x9e5b('0xee')]},{'model':db[_0x9e5b('0xc2')],'as':'Owner','attributes':['id',_0x9e5b('0x1e'),'fullname']},{'model':db['Tag'],'as':_0x9e5b('0xef'),'attributes':['id',_0x9e5b('0x1e'),_0x9e5b('0x68')],'through':{'attributes':[]}}],'order':[[_0x9e5b('0xe4'),_0x9e5b('0xf0')]]};if(_0x3a1f29[_0x9e5b('0x2d')][_0x9e5b('0xd9')]){_0x2ab6a8[_0x9e5b('0x5e')][_0x9e5b('0xe4')]={'$gte':_0x424ba9[_0x9e5b('0x38')],'$lte':_0x424ba9['to']};}switch(_0x322193){case _0x9e5b('0xcd'):_0x2ab6a8[_0x9e5b('0x83')][_0x9e5b('0x5f')](_0x9e5b('0xf1'),_0x9e5b('0xf2'),_0x9e5b('0xf3'),_0x9e5b('0xf4'),_0x9e5b('0xf5'),_0x9e5b('0xf6'),_0x9e5b('0xf7'),_0x9e5b('0xf8'),_0x9e5b('0xf9'));break;case _0x9e5b('0xfa'):_0x2ab6a8[_0x9e5b('0x83')][_0x9e5b('0x5f')](_0x9e5b('0xfb'),'substatus');break;case _0x9e5b('0xcf'):_0x2ab6a8['attributes'][_0x9e5b('0x5f')](_0x9e5b('0xfc'),'threadId');break;}return db[_[_0x9e5b('0xfd')](_0x322193)+_0x9e5b('0xfe')][_0x9e5b('0xff')](_0x2ab6a8)[_0x9e5b('0x19')](function(_0x52d735){_0x2c624d['count']+=_0x52d735[_0x9e5b('0x15')];return _[_0x9e5b('0x71')](_0x52d735[_0x9e5b('0xa3')],function(_0x4f926f){var _0x12473a=_0x4f926f[_0x9e5b('0x39')]({'plain':!![]});_0x12473a[_0x9e5b('0xd5')]=_0x322193;if(_0x12473a[_0x9e5b('0x100')]){_0x12473a[_0x9e5b('0x100')]={'id':_0x12473a[_0x9e5b('0x100')]['id'],'name':_0x12473a[_0x9e5b('0x100')][_0x9e5b('0x1e')],'fullname':_0x12473a['Owner']['fullname']};}return _0x12473a;});});}});return Promise['all'](_0x8f2125);})[_0x9e5b('0x19')](function(_0x3f0ba5){return _(_0x3f0ba5)[_0x9e5b('0x101')]()[_0x9e5b('0x102')](_0x9e5b('0xe4'))['reverse']()[_0x9e5b('0x103')]();})[_0x9e5b('0x19')](function(_0x1a5a62){_0x2c624d['rows']=_0x13be92['limit']?_0x1a5a62[_0x9e5b('0x104')](_0x13be92[_0x9e5b('0x12')],_0x13be92[_0x9e5b('0x12')]+_0x13be92[_0x9e5b('0x13')]):_0x1a5a62;return _0x2c624d;})[_0x9e5b('0x19')](respondWithFilteredResult(_0x181ced,_0x13be92))['catch'](handleError(_0x181ced,null));}; \ No newline at end of file +var _0x576d=['util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','end','error','stack','name','index','getOptions','findAll','catch','CmContact','find','params','describe','tags','keys','startsWith','cf_','columnName','displayName','query','CmCustomField','length','alias','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','isNil','timezones','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','push','contact','all','show','Tag','Tags','color','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','format','dialTimezone','utcOffset','table','cm_contacts','setFields','toParam','values','phone','getTags','findOne','model','rawAttributes','intersection','attributes','order','sort','filters','pick','filter','map','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','getHoppers','fields','nolimit','ContactId','options','rows','includeAll','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','send','upload','createReadStream','import','agent','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','importUpdates','../../components/import/cm/csvUpdates','error\x20child\x20process','getJourney','mail','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','User','fullname','DESC','findAndCountAll','chat','Website','Account','closed','closedAt','key','Owner','browserName','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','externalUrl','threadId','startCase','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird'];(function(_0x702a59,_0x2e8ec8){var _0x542e9c=function(_0x4e3149){while(--_0x4e3149){_0x702a59['push'](_0x702a59['shift']());}};_0x542e9c(++_0x2e8ec8);}(_0x576d,0xfd));var _0xd576=function(_0x41d5e0,_0x4661a4){_0x41d5e0=_0x41d5e0-0x0;var _0x385243=_0x576d[_0x41d5e0];return _0x385243;};'use strict';var moment=require(_0xd576('0x0'));var BPromise=require(_0xd576('0x1'));var util=require(_0xd576('0x2'));var path=require(_0xd576('0x3'));var fs=require('fs');var _=require(_0xd576('0x4'));var squel=require(_0xd576('0x5'));var Papa=require(_0xd576('0x6'));var Redis=require(_0xd576('0x7'));var contacts=require(_0xd576('0x8'));var qs=require(_0xd576('0x9'));var logger=require('../../config/logger')(_0xd576('0xa'));var config=require('../../config/environment');var shared=require(_0xd576('0xb'));var db=require(_0xd576('0xc'))['db'];config[_0xd576('0xd')]=_['defaults'](config['redis'],{'host':_0xd576('0xe'),'port':0x18eb});var socket=require(_0xd576('0xf'))(new Redis(config[_0xd576('0xd')]));require(_0xd576('0x10'))[_0xd576('0x11')](socket);function respondWithResult(_0xf87256,_0x307627){_0x307627=_0x307627||0xc8;return function(_0x5d2887){if(_0x5d2887){return _0xf87256[_0xd576('0x12')](_0x307627)[_0xd576('0x13')](_0x5d2887);}};}function respondWithFilteredResult(_0x36572c,_0x100caf){return function(_0x53b5e3){if(_0x53b5e3){var _0x294584=typeof _0x100caf['offset']===_0xd576('0x14')&&typeof _0x100caf[_0xd576('0x15')]==='undefined';var _0x323269=_0x53b5e3[_0xd576('0x16')];var _0x5eaaa3=_0x294584?0x0:_0x100caf[_0xd576('0x17')];var _0x98d3a3=_0x294584?_0x53b5e3['count']:_0x100caf[_0xd576('0x17')]+_0x100caf[_0xd576('0x15')];var _0x2b2ac5;if(_0x98d3a3>=_0x323269){_0x98d3a3=_0x323269;_0x2b2ac5=0xc8;}else{_0x2b2ac5=0xce;}_0x36572c[_0xd576('0x12')](_0x2b2ac5);return _0x36572c['set'](_0xd576('0x18'),_0x5eaaa3+'-'+_0x98d3a3+'/'+_0x323269)[_0xd576('0x13')](_0x53b5e3);}return null;};}function saveUpdates(_0x58025c){return function(_0x393602){if(_0x393602){return _0x393602[_0xd576('0x19')](_0x58025c)[_0xd576('0x1a')](function(_0x31a0f0){return _0x31a0f0;});}return null;};}function removeEntity(_0x5e9c45){return function(_0x417729){if(_0x417729){return _0x417729[_0xd576('0x1b')]()[_0xd576('0x1a')](function(){_0x5e9c45['status'](0xcc)[_0xd576('0x1c')]();});}};}function handleEntityNotFound(_0x5685b2){return function(_0x118159){if(!_0x118159){_0x5685b2['sendStatus'](0x194);}return _0x118159;};}function handleError(_0x3cab93,_0x16651b){_0x16651b=_0x16651b||0x1f4;return function(_0x5d0372){logger[_0xd576('0x1d')](_0x5d0372[_0xd576('0x1e')]);if(_0x5d0372[_0xd576('0x1f')]){delete _0x5d0372[_0xd576('0x1f')];}_0x3cab93[_0xd576('0x12')](_0x16651b)['send'](_0x5d0372);};}exports[_0xd576('0x20')]=function(_0x47dda8,_0x534ab4){var _0x1a4972={};return contacts['describe']()['then'](function(_0x1f6b7c){_0x1a4972=qs[_0xd576('0x21')](_0x1f6b7c,_0x47dda8);return contacts[_0xd576('0x22')](_0x47dda8['query'],_0x47dda8['user'],_0x1a4972,_0x1f6b7c);})[_0xd576('0x1a')](respondWithFilteredResult(_0x534ab4,_0x1a4972))[_0xd576('0x23')](handleError(_0x534ab4,null));};exports[_0xd576('0x1b')]=function(_0xc22964,_0x12e5a4){return db[_0xd576('0x24')][_0xd576('0x25')]({'where':{'id':_0xc22964[_0xd576('0x26')]['id']}})[_0xd576('0x1a')](handleEntityNotFound(_0x12e5a4,null))[_0xd576('0x1a')](removeEntity(_0x12e5a4,null))['catch'](handleError(_0x12e5a4,null));};exports[_0xd576('0x27')]=function(_0x1ea37f,_0xb1fa32){return db[_0xd576('0x24')]['describe']()[_0xd576('0x1a')](function(_0x2626d4){delete _0x2626d4[_0xd576('0x28')];for(var _0x4e69d3=0x0;_0x4e69d30x0){return new Promise(function(_0x30cb91){var _0x160829=[];for(var _0x714201=0x0;_0x714201<_0x9169ae[_0xd576('0x30')];_0x714201++){_0x160829[_0xd576('0x62')](insertAdditionalPhones(_0x9169ae[_0x714201][_0xd576('0x63')],_0x9169ae[_0x714201]['additionalPhones']));}Promise[_0xd576('0x64')](_0x160829)[_0xd576('0x1a')](function(){_0x30cb91(0x1);});})[_0xd576('0x1a')](function(){return{'success':_0x59b2ad,'failure':_0x35e17c,'duplicates':_0x235d0f};});}else{return{'success':_0x59b2ad,'failure':_0x35e17c,'duplicates':_0x235d0f};}}})[_0xd576('0x1a')](respondWithResult(_0x314f93,0xc9))[_0xd576('0x23')](handleError(_0x314f93,null));};exports[_0xd576('0x65')]=function(_0x500d0a,_0x2ed70c){var _0x12bcd4;return db['CmContact'][_0xd576('0x27')]()[_0xd576('0x1a')](function(_0x594983){return db[_0xd576('0x24')][_0xd576('0x25')]({'where':{'id':_0x500d0a[_0xd576('0x26')]['id']},'include':[{'model':db[_0xd576('0x66')],'as':_0xd576('0x67'),'attributes':['id',_0xd576('0x1f'),_0xd576('0x68')],'required':_0x500d0a[_0xd576('0x2e')]['tag']?!![]:![]},{'model':db[_0xd576('0x4d')],'as':_0xd576('0x69'),'where':{'CmContactId':_0x500d0a[_0xd576('0x26')]['id']},'required':![],'include':[{'model':db[_0xd576('0x6a')],'as':_0xd576('0x6b')}]}],'order':[db[_0xd576('0x6c')][_0xd576('0x6d')](_0xd576('0x6e'))],'attributes':_[_0xd576('0x29')](_0x594983)});})[_0xd576('0x1a')](function(_0x10359c){if(!_[_0xd576('0x58')](_0x10359c)){_0x12bcd4=_0x10359c['get']({'plain':!![]});var _0x376bec={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x10359c&&_0x10359c['ListId']){if(_0x10359c['ListId']){_0x376bec[_0xd576('0x5e')][_0xd576('0x6f')][_0xd576('0x62')]({'ListId':{'$ne':_0x10359c[_0xd576('0x60')]}});}}return db['CmCustomField'][_0xd576('0x22')](_0x376bec);}})[_0xd576('0x1a')](function(_0x2c963f){if(!_[_0xd576('0x58')](_0x2c963f)){return _[_0xd576('0x70')](_0x12bcd4,_['map'](_0x2c963f,function(_0xa14bf3){return util[_0xd576('0x71')]('cf_%d',_0xa14bf3['id']);}));}})[_0xd576('0x1a')](handleEntityNotFound(_0x2ed70c,null))[_0xd576('0x1a')](respondWithResult(_0x2ed70c,null))['catch'](handleError(_0x2ed70c,null));};exports['update']=function(_0x4080bb,_0x15c46f){var _0x5dad9c;if(_0x4080bb[_0xd576('0x39')]['id']){delete _0x4080bb[_0xd576('0x39')]['id'];}if(!_[_0xd576('0x58')](_0x4080bb[_0xd576('0x39')][_0xd576('0x72')])){var _0x24256e=_0x4080bb['body'][_0xd576('0x72')];if(!_['isNil'](shared[_0xd576('0x59')][_0x24256e]))_0x4080bb[_0xd576('0x39')][_0xd576('0x73')]=shared[_0xd576('0x59')][_0x24256e][_0xd576('0x73')];}return db[_0xd576('0x24')][_0xd576('0x25')]({'where':{'id':_0x4080bb[_0xd576('0x26')]['id']}})['then'](handleEntityNotFound(_0x15c46f,null))[_0xd576('0x1a')](saveUpdates(_0x4080bb[_0xd576('0x39')],null))[_0xd576('0x1a')](function(_0x18918a){_0x5dad9c=_0x18918a;var _0x2c990b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x18918a&&_0x18918a['ListId']){if(_0x18918a[_0xd576('0x60')]){_0x2c990b[_0xd576('0x5e')][_0xd576('0x6f')]['push']({'ListId':{'$ne':_0x18918a[_0xd576('0x60')]}});}}return db[_0xd576('0x2f')]['findAll'](_0x2c990b);})['then'](function(_0x52c559){if(_0x52c559){return _[_0xd576('0x70')](_['pickBy'](_0x4080bb[_0xd576('0x39')],function(_0x266de4,_0x14e82f){return _[_0xd576('0x2a')](_0x14e82f,_0xd576('0x2b'));}),_['map'](_0x52c559,function(_0x2e012f){return util[_0xd576('0x71')]('cf_%d',_0x2e012f['id']);}));}})[_0xd576('0x1a')](function(_0x8c538b){if(_0x8c538b&&!_['isEmpty'](_0x8c538b)){var _0x5a98c1=squel['update']()[_0xd576('0x74')](_0xd576('0x75'))[_0xd576('0x76')](_0x8c538b)[_0xd576('0x5e')]('id\x20=\x20?',_0x4080bb[_0xd576('0x26')]['id'])[_0xd576('0x77')]();return db['sequelize'][_0xd576('0x2e')](_0x5a98c1['text'],{'replacements':_0x5a98c1[_0xd576('0x78')]});}})['then'](function(){if(_0x4080bb[_0xd576('0x39')][_0xd576('0x79')]&&_0x5dad9c){return db[_0xd576('0x40')][_0xd576('0x19')]({'phone':_0x4080bb['body'][_0xd576('0x79')],'OrderBy':0x0},{'where':{'ContactId':_0x5dad9c['id']}});}})['then'](function(){return _0x5dad9c;})['then'](respondWithResult(_0x15c46f,null))[_0xd576('0x23')](handleError(_0x15c46f,null));};exports[_0xd576('0x7a')]=function(_0x28f91b,_0x2ba29c){var _0x5464e6={};var _0x11d3c1={};var _0x40403a;var _0x21d84c;return db[_0xd576('0x24')][_0xd576('0x7b')]({'where':{'id':_0x28f91b[_0xd576('0x26')]['id']}})['then'](handleEntityNotFound(_0x2ba29c,null))[_0xd576('0x1a')](function(_0xe7ccba){if(_0xe7ccba){_0x40403a=_0xe7ccba;_0x11d3c1[_0xd576('0x7c')]=_[_0xd576('0x29')](db[_0xd576('0x66')][_0xd576('0x7d')]);_0x11d3c1[_0xd576('0x2e')]=_[_0xd576('0x29')](_0x28f91b['query']);_0x11d3c1['filters']=_[_0xd576('0x7e')](_0x11d3c1[_0xd576('0x7c')],_0x11d3c1[_0xd576('0x2e')]);_0x5464e6[_0xd576('0x7f')]=_['intersection'](_0x11d3c1[_0xd576('0x7c')],qs['fields'](_0x28f91b[_0xd576('0x2e')]['fields']));_0x5464e6[_0xd576('0x7f')]=_0x5464e6[_0xd576('0x7f')][_0xd576('0x30')]?_0x5464e6[_0xd576('0x7f')]:_0x11d3c1['model'];_0x5464e6[_0xd576('0x80')]=qs[_0xd576('0x81')](_0x28f91b['query'][_0xd576('0x81')]);_0x5464e6[_0xd576('0x5e')]=qs[_0xd576('0x82')](_[_0xd576('0x83')](_0x28f91b[_0xd576('0x2e')],_0x11d3c1[_0xd576('0x82')]));if(_0x28f91b[_0xd576('0x2e')][_0xd576('0x84')]){_0x5464e6[_0xd576('0x5e')]=_[_0xd576('0x38')](_0x5464e6[_0xd576('0x5e')],{'$or':_[_0xd576('0x85')](_0x5464e6[_0xd576('0x7f')],function(_0x1992d5){var _0x5b83dc={};_0x5b83dc[_0x1992d5]={'$like':'%'+_0x28f91b[_0xd576('0x2e')][_0xd576('0x84')]+'%'};return _0x5b83dc;})});}_0x5464e6=_[_0xd576('0x38')]({},_0x5464e6,_0x28f91b['options']);return _0x40403a[_0xd576('0x7a')](_0x5464e6);}})['then'](function(_0xdafa80){if(_0xdafa80){_0x21d84c=_0xdafa80[_0xd576('0x30')];if(!_0x28f91b[_0xd576('0x2e')][_0xd576('0x37')]('nolimit')){_0x5464e6[_0xd576('0x15')]=qs[_0xd576('0x15')](_0x28f91b[_0xd576('0x2e')]['limit']);_0x5464e6[_0xd576('0x17')]=qs['offset'](_0x28f91b[_0xd576('0x2e')][_0xd576('0x17')]);}return _0x40403a[_0xd576('0x7a')](_0x5464e6);}})[_0xd576('0x1a')](function(_0x5fc774){if(_0x5fc774){return _0x5fc774?{'count':_0x21d84c,'rows':_0x5fc774}:null;}})[_0xd576('0x1a')](respondWithResult(_0x2ba29c,null))[_0xd576('0x23')](handleError(_0x2ba29c,null));};exports[_0xd576('0x86')]=function(_0x5e42a4,_0x52abd9){if(_0x5e42a4[_0xd576('0x39')]['id']){delete _0x5e42a4[_0xd576('0x39')]['id'];}return db[_0xd576('0x24')][_0xd576('0x7b')]({'where':{'id':_0x5e42a4[_0xd576('0x26')]['id']}})[_0xd576('0x1a')](handleEntityNotFound(_0x52abd9,null))[_0xd576('0x1a')](function(_0x123073){if(_0x123073){return _0x123073['setTags'](_0x5e42a4[_0xd576('0x39')]['ids']||[]);}return null;})['then'](respondWithResult(_0x52abd9,null))[_0xd576('0x23')](handleError(_0x52abd9,null));};exports[_0xd576('0x87')]=function(_0x21a1ec,_0x3c678a){var _0x2bf70c=[];_0x2bf70c[_0xd576('0x62')](addAdditionalPhones(_0x21a1ec[_0xd576('0x39')]));Promise[_0xd576('0x64')](_0x2bf70c)[_0xd576('0x1a')](function(){_0x2bf70c=[];_0x2bf70c[_0xd576('0x62')](deleteCmHopperPhones(_0x21a1ec[_0xd576('0x39')]['id']));_0x2bf70c[_0xd576('0x62')](addCmHopperPhones(_0x21a1ec[_0xd576('0x39')]['id']));Promise[_0xd576('0x64')](_0x2bf70c)[_0xd576('0x1a')](function(){return[0x1];})[_0xd576('0x1a')](respondWithResult(_0x3c678a,null));});};function addAdditionalPhones(_0x301fd8){var _0x5a1474;return new Promise(function(_0x59e300){return db[_0xd576('0x4d')][_0xd576('0x1b')]({'where':{'CmContactId':_0x301fd8['id']}})[_0xd576('0x1a')](function(){db['ContactItemType'][_0xd576('0x22')]({'raw':!![],'attributes':['id',_0xd576('0x88')]})[_0xd576('0x1a')](function(_0x10835c){var _0x1691f6=[];for(var _0x4dd7b0=0x0;_0x4dd7b0<_0x301fd8[_0xd576('0x89')][_0xd576('0x30')];_0x4dd7b0++){var _0x2a38a7=_0x301fd8['item_types']?_[_0xd576('0x58')](_0x301fd8[_0xd576('0x8a')][_0x4dd7b0])?'':_0x301fd8[_0xd576('0x8a')][_0x4dd7b0]:_0x301fd8[_0xd576('0x89')][_0x4dd7b0]['ItemTypeId']?_0x301fd8[_0xd576('0x89')][_0x4dd7b0][_0xd576('0x8b')]:'';var _0x1cf713=_[_0xd576('0x58')](_0x301fd8[_0xd576('0x89')][_0x4dd7b0][_0xd576('0x8c')])?'':_0x301fd8['items'][_0x4dd7b0][_0xd576('0x8c')];var _0x530b6f=_0x2a38a7+':'+_0x301fd8[_0xd576('0x89')][_0x4dd7b0][_0xd576('0x79')]+'§'+_0x1cf713;if(_[_0xd576('0x58')](_0x5a1474))_0x5a1474=_0x530b6f;else _0x5a1474+=';'+_0x530b6f;var _0x2fe442=null;var _0x2215be=null;if(_0x301fd8['item_types']){if(!_[_0xd576('0x58')](_0x301fd8[_0xd576('0x8a')][_0x4dd7b0])){_0x2215be=_['find'](_0x10835c,function(_0x2ce795){return _0x2ce795['id']===_0x301fd8['item_types'][_0x4dd7b0];});if(!_['isNil'](_0x2215be)){_0x2fe442=_0x2215be[_0xd576('0x88')];}}}else{if(!_[_0xd576('0x58')](_0x301fd8[_0xd576('0x89')][_0x4dd7b0])){_0x2215be=_[_0xd576('0x25')](_0x10835c,function(_0x1a176e){return _0x1a176e['id']===_0x301fd8[_0xd576('0x89')][_0x4dd7b0][_0xd576('0x8b')];});if(!_['isNil'](_0x2215be)){_0x2fe442=_0x4dd7b0;}}}if(_[_0xd576('0x58')](_0x2fe442)){_0x2fe442=0x64;}_0x1691f6[_0xd576('0x62')](addAdditionalPhone(_0x301fd8['id'],_0x301fd8[_0xd576('0x89')][_0x4dd7b0][_0xd576('0x79')],_0x301fd8[_0xd576('0x8a')]?_[_0xd576('0x58')](_0x301fd8[_0xd576('0x8a')][_0x4dd7b0])?null:_0x301fd8['item_types'][_0x4dd7b0]:_0x301fd8['items'][_0x4dd7b0][_0xd576('0x8b')]?_0x301fd8['items'][_0x4dd7b0]['ItemTypeId']:null,_0x2fe442,_0x1cf713));}Promise[_0xd576('0x64')](_0x1691f6)[_0xd576('0x1a')](function(){db[_0xd576('0x24')][_0xd576('0x19')]({'AdditionalPhones':_0x5a1474},{'where':{'id':_0x301fd8['id']}})['then'](function(){_0x59e300(0x1);});});});});});}function addAdditionalPhone(_0xca7cb7,_0x58bb10,_0x485f6d,_0x9c2692,_0x2e3c0f){return db['CmContactHasItem'][_0xd576('0x25')]({'where':{'CmContactId':_0xca7cb7,'item':_0x58bb10}})[_0xd576('0x1a')](function(_0x315659){if(_0x315659)logger['info'](_0xd576('0x8d'),_0x315659);else{db[_0xd576('0x4d')][_0xd576('0x44')]({'CmContactId':_0xca7cb7,'item':_0x58bb10,'ItemTypeId':_0x485f6d,'OrderBy':_0x9c2692,'ItemClass':'PHONE','description':_0x2e3c0f});}});}function deleteCmHopperPhones(_0x1fa855){return new Promise(function(_0x4ba138){return db[_0xd576('0x40')][_0xd576('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1fa855}})[_0xd576('0x1a')](function(_0x2421ef){db[_0xd576('0x8e')][_0xd576('0x1b')]({'where':{'CmHopperId':{'$in':_['map'](_0x2421ef,'id')}}});})[_0xd576('0x1a')](function(){_0x4ba138(0x1);});});}function addCmHopperPhones(_0xd42e33){return new Promise(function(_0xb57d0){return db[_0xd576('0x40')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xd42e33}})['then'](function(_0x92c6f3){var _0x6c6c8f=[];_[_0xd576('0x85')](_0x92c6f3,function(_0x9aaaab){_0x6c6c8f['push'](createCmHopperPhone(_0xd42e33,_0x9aaaab['id']));});Promise[_0xd576('0x64')](_0x6c6c8f)['then'](function(){_0xb57d0(0x1);});});});}function createCmHopperPhone(_0x5c9b23,_0x48000c){return new Promise(function(_0x501718){db['CmContactHasItem'][_0xd576('0x22')]({'raw':!![],'attributes':[_0xd576('0x8f'),_0xd576('0x88')],'where':{'CmContactId':_0x5c9b23,'ItemClass':_0xd576('0x90')},'include':[{'model':db[_0xd576('0x6a')],'attributes':['OrderBy'],'as':_0xd576('0x6b')}],'order':[_0xd576('0x88'),db[_0xd576('0x6c')][_0xd576('0x6d')]('`ItemType`.OrderBy')]})[_0xd576('0x1a')](function(_0xd88e02){var _0xa85f09=0x1;var _0x10bebd=_['map'](_0xd88e02,function(_0x244ad){_0x244ad['CmHopperId']=_0x48000c;_0x244ad['phone']=_0x244ad['item'];_0x244ad[_0xd576('0x88')]=_0xa85f09;delete _0x244ad[_0xd576('0x91')];_0xa85f09=_0xa85f09+0x1;return _0x244ad;});return db[_0xd576('0x8e')][_0xd576('0x5b')](_0x10bebd,{});})[_0xd576('0x1a')](function(){_0x501718(0x1);});});}function insertAdditionalPhones(_0x3385da,_0xa548ff){return new Promise(function(_0x5087c6){var _0x1e267a=[];for(var _0x22a726=0x0;_0x22a726<_0xa548ff[_0xd576('0x30')];_0x22a726++){var _0x3683dd=_0xa548ff[_0x22a726];_0x1e267a[_0xd576('0x62')](parseContactItemType(_0x3683dd));}Promise[_0xd576('0x64')](_0x1e267a)[_0xd576('0x1a')](function(){var _0x2547fc={'id':_0x3385da['id'],'items':_0xa548ff};return addAdditionalPhones(_0x2547fc)[_0xd576('0x1a')](function(){return addCmHopperPhones(_0x3385da['id']);});})[_0xd576('0x1a')](function(){_0x5087c6(_0x3385da);});});}function parseContactItemType(_0x35eaf0){return new Promise(function(_0x35e767){if(_0x35eaf0[_0xd576('0x37')](_0xd576('0x8b'))){_0x35e767(_0x35eaf0);}else{return db[_0xd576('0x6a')]['find']({'where':{'name':_0x35eaf0[_0xd576('0x6b')]}})['then'](function(_0x203706){if(_[_0xd576('0x58')](_0x203706))_0x35eaf0[_0xd576('0x8b')]=null;else _0x35eaf0[_0xd576('0x8b')]=_0x203706['id'];_0x35e767(_0x35eaf0);});}});}exports[_0xd576('0x92')]=function(_0x91a35c,_0x5d8737){return db['CmContactHasItem'][_0xd576('0x22')]({'raw':!![],'where':{'CmContactId':_0x91a35c['params']['id'],'ItemClass':_0xd576('0x90')},'include':[{'model':db[_0xd576('0x6a')],'as':_0xd576('0x6b')}],'order':[[_0xd576('0x88')],[db[_0xd576('0x6c')][_0xd576('0x6d')]('`ItemType`.OrderBy')]]})[_0xd576('0x1a')](function(_0x15425c){return _0x15425c;})[_0xd576('0x1a')](respondWithResult(_0x5d8737,null))[_0xd576('0x23')](handleError(_0x5d8737,null));};exports[_0xd576('0x93')]=function(_0x966d06,_0x576a50){return db[_0xd576('0x4d')][_0xd576('0x22')]({'raw':!![],'where':{'CmContactId':_0x966d06[_0xd576('0x39')][_0xd576('0x94')]}})[_0xd576('0x1a')](function(_0x34ecac){var _0x57320b=_[_0xd576('0x85')](_0x34ecac,function(_0x591c2b){_0x591c2b[_0xd576('0x95')]=_0x966d06[_0xd576('0x39')]['toContactId'];return _0x591c2b;});return db[_0xd576('0x4d')]['bulkCreate'](_0x57320b,{});})['then'](function(){return addCmHopperPhones(_0x966d06[_0xd576('0x39')][_0xd576('0x96')]);})[_0xd576('0x1a')](function(){return['ok'];})[_0xd576('0x1a')](respondWithResult(_0x576a50,null))['catch'](handleError(_0x576a50,null));};exports['rescheduleAdditionalPhones']=function(_0x39c223,_0x185418){var _0x294704=[];_0x294704[_0xd576('0x62')](createCmHopperPhone(_0x39c223['body']['id'],_0x39c223[_0xd576('0x39')]['hopperId']));Promise[_0xd576('0x64')](_0x294704)[_0xd576('0x1a')](function(){return[0x1];})[_0xd576('0x1a')](respondWithResult(_0x185418,null));};exports[_0xd576('0x97')]=function(_0x1ab20d,_0x31ffea){var _0x3dcec7={'raw':![],'where':{}};var _0x5c1134={};var _0x2cec90={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x1ab20d[_0xd576('0x26')]['id']}})['then'](handleEntityNotFound(_0x31ffea,null))[_0xd576('0x1a')](function(_0x5e9ef3){if(_0x5e9ef3){_0x5c1134['model']=_[_0xd576('0x29')](db[_0xd576('0x40')]['rawAttributes']);_0x5c1134['query']=_[_0xd576('0x29')](_0x1ab20d[_0xd576('0x2e')]);_0x5c1134[_0xd576('0x82')]=_[_0xd576('0x7e')](_0x5c1134[_0xd576('0x7c')],_0x5c1134[_0xd576('0x2e')]);_0x3dcec7['attributes']=_['intersection'](_0x5c1134[_0xd576('0x7c')],qs[_0xd576('0x98')](_0x1ab20d['query'][_0xd576('0x98')]));_0x3dcec7[_0xd576('0x7f')]=_0x3dcec7[_0xd576('0x7f')][_0xd576('0x30')]?_0x3dcec7[_0xd576('0x7f')]:_0x5c1134[_0xd576('0x7c')];if(!_0x1ab20d[_0xd576('0x2e')][_0xd576('0x37')](_0xd576('0x99'))){_0x3dcec7[_0xd576('0x15')]=qs[_0xd576('0x15')](_0x1ab20d[_0xd576('0x2e')][_0xd576('0x15')]);_0x3dcec7['offset']=qs[_0xd576('0x17')](_0x1ab20d[_0xd576('0x2e')][_0xd576('0x17')]);}_0x3dcec7[_0xd576('0x80')]=qs[_0xd576('0x81')](_0x1ab20d[_0xd576('0x2e')]['sort']);_0x3dcec7['where']=qs[_0xd576('0x82')](_['pick'](_0x1ab20d[_0xd576('0x2e')],_0x5c1134[_0xd576('0x82')]));_0x3dcec7[_0xd576('0x5e')][_0xd576('0x9a')]=_0x5e9ef3['id'];if(_0x1ab20d['query'][_0xd576('0x84')]){_0x3dcec7[_0xd576('0x5e')]=_['merge'](_0x3dcec7['where'],{'$or':_['map'](_0x3dcec7[_0xd576('0x7f')],function(_0xb32485){var _0x76a79e={};_0x76a79e[_0xb32485]={'$like':'%'+_0x1ab20d[_0xd576('0x2e')]['filter']+'%'};return _0x76a79e;})});}_0x3dcec7=_[_0xd576('0x38')]({},_0x3dcec7,_0x1ab20d[_0xd576('0x9b')]);return db[_0xd576('0x40')][_0xd576('0x16')]({'where':_0x3dcec7[_0xd576('0x5e')]})['then'](function(_0x54aa00){_0x2cec90[_0xd576('0x16')]=_0x54aa00;if(_0x1ab20d[_0xd576('0x2e')]['includeAll']){_0x3dcec7['include']=[{'all':!![]}];}return db[_0xd576('0x40')]['findAll'](_0x3dcec7);})[_0xd576('0x1a')](function(_0x6021f1){_0x2cec90[_0xd576('0x9c')]=_0x6021f1;return _0x2cec90;});}})[_0xd576('0x1a')](respondWithFilteredResult(_0x31ffea,_0x3dcec7))[_0xd576('0x23')](handleError(_0x31ffea,null));};exports['getHopperHistories']=function(_0x4c43c6,_0x42a6f2){var _0x447a35={'raw':!![],'where':{}};var _0x6efb51={};var _0x302f4a={'count':0x0,'rows':[]};return db[_0xd576('0x24')][_0xd576('0x7b')]({'where':{'id':_0x4c43c6[_0xd576('0x26')]['id']}})[_0xd576('0x1a')](handleEntityNotFound(_0x42a6f2,null))[_0xd576('0x1a')](function(_0x4754d1){if(_0x4754d1){_0x6efb51[_0xd576('0x7c')]=_[_0xd576('0x29')](db[_0xd576('0x4f')][_0xd576('0x7d')]);_0x6efb51[_0xd576('0x2e')]=_[_0xd576('0x29')](_0x4c43c6['query']);_0x6efb51[_0xd576('0x82')]=_[_0xd576('0x7e')](_0x6efb51[_0xd576('0x7c')],_0x6efb51[_0xd576('0x2e')]);_0x447a35[_0xd576('0x7f')]=_[_0xd576('0x7e')](_0x6efb51[_0xd576('0x7c')],qs[_0xd576('0x98')](_0x4c43c6[_0xd576('0x2e')][_0xd576('0x98')]));_0x447a35['attributes']=_0x447a35[_0xd576('0x7f')][_0xd576('0x30')]?_0x447a35['attributes']:_0x6efb51['model'];if(!_0x4c43c6[_0xd576('0x2e')][_0xd576('0x37')]('nolimit')){_0x447a35[_0xd576('0x15')]=qs[_0xd576('0x15')](_0x4c43c6['query']['limit']);_0x447a35[_0xd576('0x17')]=qs['offset'](_0x4c43c6[_0xd576('0x2e')][_0xd576('0x17')]);}_0x447a35[_0xd576('0x80')]=qs[_0xd576('0x81')](_0x4c43c6[_0xd576('0x2e')][_0xd576('0x81')]);_0x447a35[_0xd576('0x5e')]=qs['filters'](_[_0xd576('0x83')](_0x4c43c6['query'],_0x6efb51[_0xd576('0x82')]));_0x447a35['where'][_0xd576('0x9a')]=_0x4754d1['id'];if(_0x4c43c6[_0xd576('0x2e')][_0xd576('0x84')]){_0x447a35['where']=_[_0xd576('0x38')](_0x447a35[_0xd576('0x5e')],{'$or':_[_0xd576('0x85')](_0x447a35[_0xd576('0x7f')],function(_0x5dee19){var _0x44c415={};_0x44c415[_0x5dee19]={'$like':'%'+_0x4c43c6[_0xd576('0x2e')][_0xd576('0x84')]+'%'};return _0x44c415;})});}_0x447a35=_['merge']({},_0x447a35,_0x4c43c6[_0xd576('0x9b')]);return db[_0xd576('0x4f')][_0xd576('0x16')]({'where':_0x447a35['where']})['then'](function(_0x237a33){_0x302f4a[_0xd576('0x16')]=_0x237a33;if(_0x4c43c6[_0xd576('0x2e')][_0xd576('0x9d')]){_0x447a35[_0xd576('0x9e')]=[{'all':!![]}];}return db[_0xd576('0x4f')][_0xd576('0x22')](_0x447a35);})[_0xd576('0x1a')](function(_0x5c2447){_0x302f4a[_0xd576('0x9c')]=_0x5c2447;return _0x302f4a;});}})[_0xd576('0x1a')](respondWithFilteredResult(_0x42a6f2,_0x447a35))['catch'](handleError(_0x42a6f2,null));};exports[_0xd576('0x9f')]=function(_0x2fd0da,_0x18562e){var _0x56a1ee={'raw':!![],'where':{}};var _0x92c93e={};var _0x1208a4={'count':0x0,'rows':[]};return db['CmContact'][_0xd576('0x7b')]({'where':{'id':_0x2fd0da[_0xd576('0x26')]['id']}})[_0xd576('0x1a')](handleEntityNotFound(_0x18562e,null))[_0xd576('0x1a')](function(_0x15b694){if(_0x15b694){_0x92c93e['model']=_[_0xd576('0x29')](db[_0xd576('0x4e')][_0xd576('0x7d')]);_0x92c93e[_0xd576('0x2e')]=_[_0xd576('0x29')](_0x2fd0da[_0xd576('0x2e')]);_0x92c93e[_0xd576('0x82')]=_[_0xd576('0x7e')](_0x92c93e[_0xd576('0x7c')],_0x92c93e[_0xd576('0x2e')]);_0x56a1ee[_0xd576('0x7f')]=_[_0xd576('0x7e')](_0x92c93e[_0xd576('0x7c')],qs[_0xd576('0x98')](_0x2fd0da[_0xd576('0x2e')]['fields']));_0x56a1ee[_0xd576('0x7f')]=_0x56a1ee['attributes'][_0xd576('0x30')]?_0x56a1ee[_0xd576('0x7f')]:_0x92c93e[_0xd576('0x7c')];if(!_0x2fd0da['query'][_0xd576('0x37')](_0xd576('0x99'))){_0x56a1ee['limit']=qs[_0xd576('0x15')](_0x2fd0da['query']['limit']);_0x56a1ee[_0xd576('0x17')]=qs[_0xd576('0x17')](_0x2fd0da[_0xd576('0x2e')][_0xd576('0x17')]);}_0x56a1ee['order']=qs['sort'](_0x2fd0da[_0xd576('0x2e')]['sort']);_0x56a1ee['where']=qs[_0xd576('0x82')](_['pick'](_0x2fd0da[_0xd576('0x2e')],_0x92c93e[_0xd576('0x82')]));_0x56a1ee['where'][_0xd576('0x9a')]=_0x15b694['id'];if(_0x2fd0da[_0xd576('0x2e')][_0xd576('0x84')]){_0x56a1ee['where']=_[_0xd576('0x38')](_0x56a1ee['where'],{'$or':_[_0xd576('0x85')](_0x56a1ee[_0xd576('0x7f')],function(_0x4099cf){var _0x36ef4f={};_0x36ef4f[_0x4099cf]={'$like':'%'+_0x2fd0da[_0xd576('0x2e')][_0xd576('0x84')]+'%'};return _0x36ef4f;})});}_0x56a1ee=_[_0xd576('0x38')]({},_0x56a1ee,_0x2fd0da[_0xd576('0x9b')]);return db['CmHopperFinal'][_0xd576('0x16')]({'where':_0x56a1ee[_0xd576('0x5e')]})['then'](function(_0x1af411){_0x1208a4[_0xd576('0x16')]=_0x1af411;if(_0x2fd0da[_0xd576('0x2e')][_0xd576('0x9d')]){_0x56a1ee[_0xd576('0x9e')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x56a1ee);})[_0xd576('0x1a')](function(_0x2203f5){_0x1208a4[_0xd576('0x9c')]=_0x2203f5;return _0x1208a4;});}})['then'](respondWithFilteredResult(_0x18562e,_0x56a1ee))[_0xd576('0x23')](handleError(_0x18562e,null));};exports[_0xd576('0xa0')]=function(_0x14fa00,_0x11cd90){var _0x21ee62={'raw':!![],'where':{}};var _0x5da2db={};var _0x5a0b73={'count':0x0,'rows':[]};return db['CmContact'][_0xd576('0x7b')]({'where':{'id':_0x14fa00[_0xd576('0x26')]['id']}})[_0xd576('0x1a')](handleEntityNotFound(_0x11cd90,null))[_0xd576('0x1a')](function(_0x4d5ef5){if(_0x4d5ef5){_0x5da2db[_0xd576('0x7c')]=_[_0xd576('0x29')](db[_0xd576('0x55')][_0xd576('0x7d')]);_0x5da2db[_0xd576('0x2e')]=_[_0xd576('0x29')](_0x14fa00[_0xd576('0x2e')]);_0x5da2db[_0xd576('0x82')]=_['intersection'](_0x5da2db['model'],_0x5da2db['query']);_0x21ee62[_0xd576('0x7f')]=_[_0xd576('0x7e')](_0x5da2db[_0xd576('0x7c')],qs[_0xd576('0x98')](_0x14fa00[_0xd576('0x2e')][_0xd576('0x98')]));_0x21ee62[_0xd576('0x7f')]=_0x21ee62['attributes']['length']?_0x21ee62[_0xd576('0x7f')]:_0x5da2db[_0xd576('0x7c')];if(!_0x14fa00[_0xd576('0x2e')][_0xd576('0x37')]('nolimit')){_0x21ee62[_0xd576('0x15')]=qs[_0xd576('0x15')](_0x14fa00[_0xd576('0x2e')][_0xd576('0x15')]);_0x21ee62['offset']=qs['offset'](_0x14fa00[_0xd576('0x2e')][_0xd576('0x17')]);}_0x21ee62['order']=qs[_0xd576('0x81')](_0x14fa00['query']['sort']);_0x21ee62[_0xd576('0x5e')]=qs['filters'](_[_0xd576('0x83')](_0x14fa00['query'],_0x5da2db[_0xd576('0x82')]));_0x21ee62[_0xd576('0x5e')][_0xd576('0x9a')]=_0x4d5ef5['id'];if(_0x14fa00['query'][_0xd576('0x84')]){_0x21ee62[_0xd576('0x5e')]=_[_0xd576('0x38')](_0x21ee62[_0xd576('0x5e')],{'$or':_[_0xd576('0x85')](_0x21ee62['attributes'],function(_0x323411){var _0x167ff5={};_0x167ff5[_0x323411]={'$like':'%'+_0x14fa00[_0xd576('0x2e')][_0xd576('0x84')]+'%'};return _0x167ff5;})});}_0x21ee62=_['merge']({},_0x21ee62,_0x14fa00[_0xd576('0x9b')]);return db[_0xd576('0x55')]['count']({'where':_0x21ee62[_0xd576('0x5e')]})[_0xd576('0x1a')](function(_0x133cff){_0x5a0b73[_0xd576('0x16')]=_0x133cff;if(_0x14fa00[_0xd576('0x2e')][_0xd576('0x9d')]){_0x21ee62['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd576('0x22')](_0x21ee62);})['then'](function(_0xfa696a){_0x5a0b73[_0xd576('0x9c')]=_0xfa696a;return _0x5a0b73;});}})[_0xd576('0x1a')](respondWithFilteredResult(_0x11cd90,_0x21ee62))[_0xd576('0x23')](handleError(_0x11cd90,null));};exports[_0xd576('0xa1')]=function(_0x1c376f,_0x12f0c0){try{if(!_0x1c376f['body'][_0xd576('0x60')]){throw new Error(_0xd576('0xa2'));}if(!_0x1c376f['body']['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x1c376f['body'][_0xd576('0xa3')]){throw new Error(_0xd576('0xa4'));}if(!_0x1c376f[_0xd576('0x39')][_0xd576('0xa5')]){throw new Error(_0xd576('0xa6'));}var _0x98b317=_0x1c376f[_0xd576('0x39')][_0xd576('0xa7')][_0xd576('0xa8')](',');var _0x120ac5=_0x1c376f[_0xd576('0x39')][_0xd576('0xa3')]['split'](',');if(!_0x98b317['length']||!_0x120ac5[_0xd576('0x30')]||_0x98b317[_0xd576('0x30')]!==_0x120ac5[_0xd576('0x30')]){throw new Error(_0xd576('0xa9'));}_0x1c376f[_0xd576('0x39')][_0xd576('0x98')]=_['zipObject'](_0x98b317,_0x120ac5);if(!_0x1c376f[_0xd576('0x39')][_0xd576('0x98')][_0xd576('0x79')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1c376f[_0xd576('0x39')][_0xd576('0x98')][_0xd576('0xaa')]){throw new Error(_0xd576('0xab'));}var _0x186810=path['join'](config[_0xd576('0xac')],_0xd576('0xad'),_0x1c376f[_0xd576('0xae')][_0xd576('0xaf')]);fs[_0xd576('0xb0')](_0x186810,parseInt(_0xd576('0xb1'),0x8));var _0x34ffe2=require(_0xd576('0xb2'))[_0xd576('0xb3')](path[_0xd576('0x3e')](__dirname,_0xd576('0xb4')),[_0x186810,_0x1c376f[_0xd576('0x39')][_0xd576('0xa7')],_0x1c376f[_0xd576('0x39')][_0xd576('0xa3')],_0x1c376f[_0xd576('0x39')][_0xd576('0x60')],_0x1c376f[_0xd576('0x39')][_0xd576('0xb5')],_0x1c376f[_0xd576('0x39')][_0xd576('0x5d')],_0x1c376f['body'][_0xd576('0xa5')]]);return _0x12f0c0[_0xd576('0x12')](0xc8)['json']({'message':_0xd576('0xb6'),'pid':_0x34ffe2['pid']});}catch(_0x512c51){return _0x12f0c0[_0xd576('0x12')](0x1f4)[_0xd576('0xb7')](_0x512c51);}};exports[_0xd576('0xb8')]=function(_0x2bd31c,_0x4fcba0){var _0x2b2316=fs[_0xd576('0xb9')](_0x2bd31c[_0xd576('0xae')][_0xd576('0x3')]);Papa['parse'](_0x2b2316,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2e2df8){return _0x4fcba0['status'](0xc8)[_0xd576('0x13')]({'file':_0x2bd31c[_0xd576('0xae')],'fields':_0x2e2df8['meta'][_0xd576('0x98')]});}});};exports[_0xd576('0xba')]=function(_0x2d4209,_0x1cd905){return db['User'][_0xd576('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd576('0xbb')}})[_0xd576('0x1a')](function(_0x20877b){var _0x503251=![];if(!_0x2d4209[_0xd576('0x39')][_0xd576('0x60')]){throw new Error(_0xd576('0xa2'));}if(!_0x2d4209[_0xd576('0x39')][_0xd576('0xbc')][_0xd576('0x79')]){throw new Error(_0xd576('0xbd'));}if(!_0x2d4209[_0xd576('0x39')][_0xd576('0xbc')]['firstName']){throw new Error(_0xd576('0xab'));}if(!_0x2d4209['body'][_0xd576('0xa5')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x31aaf3=require(_0xd576('0xb2'))['fork'](path['join'](__dirname,_0xd576('0xbe')),[_0x2d4209[_0xd576('0x26')]['id'],JSON['stringify'](_0x2d4209[_0xd576('0x39')]),JSON[_0xd576('0xbf')](_0x20877b)]);_0x31aaf3['on'](_0xd576('0xc0'),function(){_0x503251=!![];return _0x1cd905[_0xd576('0x12')](0xc8)[_0xd576('0x13')]({'message':_0xd576('0xc1'),'pid':_0x31aaf3[_0xd576('0xc2')]});});_0x31aaf3['on'](_0xd576('0xc3'),function(_0x34b900){if(_0x34b900&&!_0x503251){return _0x1cd905['status'](0x1f4)[_0xd576('0x13')]({'message':'error\x20child\x20process','pid':_0x31aaf3[_0xd576('0xc2')]});}});})['catch'](handleError(_0x1cd905,null));};exports[_0xd576('0xc4')]=function(_0x1a8125,_0xdaa7e7){return db['User'][_0xd576('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xd576('0x1a')](function(_0x294e6d){var _0x43e909=![];if(!_0x1a8125[_0xd576('0x39')][_0xd576('0x60')]){throw new Error(_0xd576('0xa2'));}if(!_0x1a8125[_0xd576('0x39')][_0xd576('0xbc')][_0xd576('0x79')]){throw new Error(_0xd576('0xbd'));}if(!_0x1a8125[_0xd576('0x39')][_0xd576('0xbc')][_0xd576('0xaa')]){throw new Error(_0xd576('0xab'));}if(!_0x1a8125['body'][_0xd576('0xa5')]){throw new Error(_0xd576('0xa6'));}var _0x381497=require(_0xd576('0xb2'))[_0xd576('0xb3')](path['join'](__dirname,_0xd576('0xc5')),[_0x1a8125['params']['id'],JSON[_0xd576('0xbf')](_0x1a8125['body']),JSON[_0xd576('0xbf')](_0x294e6d)]);_0x381497['on']('message',function(){_0x43e909=!![];return _0xdaa7e7[_0xd576('0x12')](0xc8)[_0xd576('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x381497[_0xd576('0xc2')]});});_0x381497['on'](_0xd576('0xc3'),function(_0x586755){if(_0x586755&&!_0x43e909){return _0xdaa7e7[_0xd576('0x12')](0x1f4)[_0xd576('0x13')]({'message':_0xd576('0xc6'),'pid':_0x381497[_0xd576('0xc2')]});}});})[_0xd576('0x23')](handleError(_0xdaa7e7,null));};exports[_0xd576('0xc7')]=function(_0x44c21f,_0x2084eb){var _0x1abcbe=[_0xd576('0xc8'),'chat','sms','openchannel',_0xd576('0xc9'),_0xd576('0xca'),'voice'];var _0x635887={'offset':0x0,'order':qs['sort'](_0xd576('0xcb'))},_0x16516a={'count':0x0,'rows':[]};Promise[_0xd576('0xcc')]()[_0xd576('0x1a')](function(){if(_0x44c21f['query']['channel']){if(!_['includes'](_0x1abcbe,_0x44c21f['query'][_0xd576('0xcd')][_0xd576('0xce')]())){throw new Error(_0xd576('0xcf'));}_0x1abcbe=[_0x44c21f['query'][_0xd576('0xcd')][_0xd576('0xce')]()];}if(_0x44c21f['query'][_0xd576('0xd0')]){try{var _0x1b5aee=JSON[_0xd576('0xd1')](_0x44c21f[_0xd576('0x2e')][_0xd576('0xd0')]);if(!moment(_0x1b5aee[_0xd576('0x3a')])[_0xd576('0xd2')]()){throw new Error(_0xd576('0xd3'));}if(!moment(_0x1b5aee['to'])['isValid']()){throw new Error(_0xd576('0xd4'));}}catch(_0x597fe3){throw new Error(_0xd576('0xd5'));}}if(!_0x44c21f[_0xd576('0x2e')][_0xd576('0x37')](_0xd576('0x99'))){_0x635887['limit']=qs[_0xd576('0x15')](_0x44c21f[_0xd576('0x2e')][_0xd576('0x15')]||0xa);_0x635887[_0xd576('0x17')]=qs[_0xd576('0x17')](_0x44c21f[_0xd576('0x2e')][_0xd576('0x17')]);}var _0x1b7ff8=_0x1abcbe[_0xd576('0x85')](function(_0x3aff9a){if(_0x3aff9a===_0xd576('0xd6')){var _0x22fc5f={'attributes':['id',_0xd576('0xd7'),'type',_0xd576('0xd8'),'destination',_0xd576('0xd9'),'starttime',_0xd576('0xda'),_0xd576('0xdb'),_0xd576('0xdc'),_0xd576('0xdd'),_0xd576('0xde'),_0xd576('0xdf'),_0xd576('0xe0'),_0xd576('0xe1')],'where':{'ContactId':_0x44c21f[_0xd576('0x26')]['id']},'include':[{'model':db[_0xd576('0xe2')],'as':_0xd576('0xe2'),'attributes':['id',_0xd576('0x1f'),_0xd576('0xe3'),_0xd576('0x31')]}],'order':[['createdAt',_0xd576('0xe4')]]};if(_0x44c21f[_0xd576('0x2e')]['range']){_0x22fc5f[_0xd576('0x5e')][_0xd576('0xdd')]={'$gte':_0x1b5aee['from'],'$lte':_0x1b5aee['to']};}return db[_0xd576('0x50')][_0xd576('0xe5')](_0x22fc5f)[_0xd576('0x1a')](function(_0x360c16){_0x16516a[_0xd576('0x16')]+=_0x360c16['count'];return _['map'](_0x360c16[_0xd576('0x9c')],function(_0x956d95){var _0x1eaf93=_0x956d95[_0xd576('0x3b')]({'plain':!![]});_0x1eaf93[_0xd576('0xcd')]=_0x3aff9a;if(_0x1eaf93[_0xd576('0xe2')]){_0x1eaf93[_0xd576('0xe2')]={'id':_0x1eaf93[_0xd576('0xe2')]['id'],'name':_0x1eaf93[_0xd576('0xe2')]['name'],'fullname':_0x1eaf93[_0xd576('0xe2')][_0xd576('0xe3')],'alias':_0x1eaf93['User']['alias']};}return _0x1eaf93;});});}else{var _0x410dfc=_['startCase'](_0x3aff9a)+(_0x3aff9a===_0xd576('0xe6')?_0xd576('0xe7'):_0xd576('0xe8'));var _0x2bad2d={'attributes':['id',_0xd576('0xe9'),_0xd576('0xea'),_0xd576('0xdd'),_0xd576('0xdc'),'disposition','secondDisposition','thirdDisposition',_0xd576('0xe1'),_0x410dfc+'Id'],'where':{'ContactId':_0x44c21f[_0xd576('0x26')]['id']},'include':[{'model':db[_0x410dfc],'as':_0xd576('0xe8'),'attributes':['id',_0xd576('0x1f'),_0xd576('0xeb')]},{'model':db['User'],'as':_0xd576('0xec'),'attributes':['id','name',_0xd576('0xe3')]},{'model':db[_0xd576('0x66')],'as':'Tags','attributes':['id',_0xd576('0x1f'),_0xd576('0x68')],'through':{'attributes':[]}}],'order':[[_0xd576('0xdd'),'DESC']]};if(_0x44c21f[_0xd576('0x2e')][_0xd576('0xd0')]){_0x2bad2d[_0xd576('0x5e')][_0xd576('0xdd')]={'$gte':_0x1b5aee[_0xd576('0x3a')],'$lte':_0x1b5aee['to']};}switch(_0x3aff9a){case _0xd576('0xe6'):_0x2bad2d[_0xd576('0x7f')][_0xd576('0x62')](_0xd576('0xed'),'customerIp',_0xd576('0xee'),'deviceModel',_0xd576('0xef'),_0xd576('0xf0'),_0xd576('0xf1'),_0xd576('0xf2'),_0xd576('0xf3'));break;case _0xd576('0xc8'):_0x2bad2d['attributes'][_0xd576('0x62')](_0xd576('0xf4'),'substatus');break;case _0xd576('0xf5'):_0x2bad2d[_0xd576('0x7f')][_0xd576('0x62')](_0xd576('0xf6'),_0xd576('0xf7'));break;}return db[_[_0xd576('0xf8')](_0x3aff9a)+_0xd576('0xf9')]['findAndCountAll'](_0x2bad2d)[_0xd576('0x1a')](function(_0x33c3b2){_0x16516a[_0xd576('0x16')]+=_0x33c3b2[_0xd576('0x16')];return _[_0xd576('0x85')](_0x33c3b2[_0xd576('0x9c')],function(_0x913407){var _0x49ec16=_0x913407[_0xd576('0x3b')]({'plain':!![]});_0x49ec16[_0xd576('0xcd')]=_0x3aff9a;if(_0x49ec16[_0xd576('0xec')]){_0x49ec16[_0xd576('0xec')]={'id':_0x49ec16[_0xd576('0xec')]['id'],'name':_0x49ec16['Owner']['name'],'fullname':_0x49ec16[_0xd576('0xec')][_0xd576('0xe3')]};}return _0x49ec16;});});}});return Promise[_0xd576('0x64')](_0x1b7ff8);})[_0xd576('0x1a')](function(_0xfaa9bb){return _(_0xfaa9bb)[_0xd576('0xfa')]()[_0xd576('0xfb')](_0xd576('0xdd'))[_0xd576('0xfc')]()[_0xd576('0xfd')]();})['then'](function(_0x4d2192){_0x16516a[_0xd576('0x9c')]=_0x635887[_0xd576('0x15')]?_0x4d2192[_0xd576('0xfe')](_0x635887[_0xd576('0x17')],_0x635887[_0xd576('0x17')]+_0x635887['limit']):_0x4d2192;return _0x16516a;})[_0xd576('0x1a')](respondWithFilteredResult(_0x2084eb,_0x635887))[_0xd576('0x23')](handleError(_0x2084eb,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 1a24a66..85ca0af 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e25=['hasOwnProperty','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x14ee58,_0x44c760){var _0x49c343=function(_0x2be457){while(--_0x2be457){_0x14ee58['push'](_0x14ee58['shift']());}};_0x49c343(++_0x44c760);}(_0x6e25,0x185));var _0x56e2=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0x6e25[_0x58ceb9];return _0x3d0ff5;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x56e2('0x0'))['db'][_0x56e2('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x56e2('0x2')](0x0);var events={'afterCreate':_0x56e2('0x3'),'afterUpdate':_0x56e2('0x4'),'afterDestroy':_0x56e2('0x5')};function emitEvent(_0x938d71){return function(_0x40995d,_0x463497,_0x5b4c06){CmContactEvents['emit'](_0x938d71+':'+_0x40995d['id'],_0x40995d);CmContactEvents[_0x56e2('0x6')](_0x938d71,_0x40995d);_0x5b4c06(null);};}for(var e in events){if(events[_0x56e2('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x56e2('0x8')]=CmContactEvents; \ No newline at end of file +var _0xe9ef=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0xcecc7b,_0x3b135a){var _0x41c3ce=function(_0x3e2281){while(--_0x3e2281){_0xcecc7b['push'](_0xcecc7b['shift']());}};_0x41c3ce(++_0x3b135a);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xe9ef[_0x3718b7];return _0xf8c91e;};'use strict';var EventEmitter=require(_0xfe9e('0x0'));var CmContact=require(_0xfe9e('0x1'))['db'][_0xfe9e('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xfe9e('0x3')](0x0);var events={'afterCreate':_0xfe9e('0x4'),'afterUpdate':_0xfe9e('0x5'),'afterDestroy':_0xfe9e('0x6')};function emitEvent(_0x18df90){return function(_0xc14436,_0x2cb4d2,_0x24643e){CmContactEvents[_0xfe9e('0x7')](_0x18df90+':'+_0xc14436['id'],_0xc14436);CmContactEvents[_0xfe9e('0x7')](_0x18df90,_0xc14436);_0x24643e(null);};}for(var e in events){if(events[_0xfe9e('0x8')](e)){var event=events[e];CmContact[_0xfe9e('0x9')](e,emitEvent(event));}}module[_0xfe9e('0xa')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 716425c..f7a27a8 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c92=['[cmContact][afterCreate]','message','models','isEmpty','length','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','then','timezones','utcOffset','add','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','all','dialCheckDuplicateType','BlackLists','CmHopperBlack','define','cm_contacts','firstName','lastName','email','FULLTEXT','utf8mb4_unicode_ci','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch'];(function(_0x1b808e,_0x446e18){var _0x5a6726=function(_0x3eabfa){while(--_0x3eabfa){_0x1b808e['push'](_0x1b808e['shift']());}};_0x5a6726(++_0x446e18);}(_0x7c92,0xd0));var _0x27c9=function(_0xa0bc94,_0x2be459){_0xa0bc94=_0xa0bc94-0x0;var _0x13b2cd=_0x7c92[_0xa0bc94];return _0x13b2cd;};'use strict';var _=require(_0x27c9('0x0'));var util=require(_0x27c9('0x1'));var logger=require(_0x27c9('0x2'))(_0x27c9('0x3'));var moment=require(_0x27c9('0x4'));var shared=require('../../config/environment/shared');var attributes=require(_0x27c9('0x5'));function getTimezoneCallbackAt(_0x23ab5f,_0x33dce7,_0x22147e,_0x2cf9cb){var _0x54bb87=_0x2cf9cb?_0x27c9('0x6'):_0x27c9('0x7');var _0x3488de=_0x22147e[_0x27c9('0x8')]?_0x22147e[_0x27c9('0x8')]:moment()[_0x27c9('0x9')](_0x27c9('0xa'));if(_[_0x27c9('0xb')](_0x22147e[_0x27c9('0xc')])){return Promise[_0x27c9('0xd')](_0x3488de);}return _0x23ab5f[_0x54bb87]['findOne']({'where':{'id':_0x33dce7}})[_0x27c9('0xe')](function(_0x377d66){if(_[_0x27c9('0xb')](_0x377d66)||_['isNil'](_0x377d66[_0x27c9('0xc')])){return Promise[_0x27c9('0xd')](_0x3488de);}var _0x248094=shared[_0x27c9('0xf')];var _0x5e684b=_0x248094[_0x377d66[_0x27c9('0xc')]];var _0x9b1657=_0x248094[_0x22147e[_0x27c9('0xc')]];if(_[_0x27c9('0xb')](_0x5e684b)&&_[_0x27c9('0xb')](_0x9b1657)){return Promise[_0x27c9('0xd')](_0x3488de);}var _0x360b1e=_0x5e684b[_0x27c9('0x10')]-_0x9b1657[_0x27c9('0x10')];var _0x215ba6=_0x22147e['scheduledat']?_0x22147e[_0x27c9('0x8')]:moment();_0x3488de=moment(_0x215ba6)[_0x27c9('0x11')](_0x360b1e,_0x27c9('0x12'))[_0x27c9('0x9')](_0x27c9('0xa'));return Promise['resolve'](_0x3488de);});}function getNewHopperPayload(_0x2d7e94){return{'phone':_0x2d7e94[_0x27c9('0x13')],'ContactId':_0x2d7e94['id'],'ListId':_0x2d7e94[_0x27c9('0x14')],'scheduledat':_0x2d7e94[_0x27c9('0x8')]?_0x2d7e94[_0x27c9('0x8')]:moment()[_0x27c9('0x9')](_0x27c9('0xa')),'priority':_0x2d7e94[_0x27c9('0x15')]?_0x2d7e94[_0x27c9('0x15')]:0x2,'callback':_0x2d7e94[_0x27c9('0x16')]?!![]:![],'callbackuniqueid':_0x2d7e94[_0x27c9('0x16')]?_0x2d7e94['callbackUniqueid']:undefined,'callbackat':_0x2d7e94[_0x27c9('0x16')]?moment()[_0x27c9('0x9')](_0x27c9('0xa')):undefined};}function handleAlwaysCheckDuplicate(_0x236ad9,_0x20a393,_0x5b7be9,_0x3f3fcc){var _0x40057a={'phone':_0x5b7be9['phone']};var _0x19981c={'calleridnum':_0x5b7be9[_0x27c9('0x13')]};if(_0x3f3fcc){Object[_0x27c9('0x17')](_0x40057a,{'CampaignId':_0x20a393['id']});Object[_0x27c9('0x17')](_0x19981c,{'CampaignId':_0x20a393['id']});}else{Object[_0x27c9('0x17')](_0x40057a,{'VoiceQueueId':_0x20a393['id']});Object['assign'](_0x19981c,{'VoiceQueueId':_0x20a393['id']});}return _0x236ad9[_0x27c9('0x18')][_0x27c9('0x19')]({'where':_0x40057a})['then'](function(_0x51f6da){if(_0x51f6da){throw new Error(_0x27c9('0x1a')+_0x5b7be9[_0x27c9('0x13')]+_0x27c9('0x1b')+_0x20a393['id']);}return _0x236ad9[_0x27c9('0x1c')]['findOne']({'where':_0x19981c});})['then'](function(_0x1c15ec){if(_0x1c15ec){throw new Error(_0x27c9('0x1d')+_0x5b7be9[_0x27c9('0x13')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x20a393['id']);}var _0x418a8a=getNewHopperPayload(_0x5b7be9);if(_0x3f3fcc){_0x418a8a[_0x27c9('0x1e')]=_0x20a393['id'];}else{_0x418a8a[_0x27c9('0x1f')]=_0x20a393['id'];}return _0x236ad9[_0x27c9('0x18')][_0x27c9('0x20')](_0x418a8a);});}function handleOnlyIfOpenCheckDuplicate(_0x3dcb4f,_0x5e0ffb,_0x5af2b2,_0x5c6edb){var _0x538e63={'phone':_0x5af2b2['phone']};if(_0x5c6edb){Object[_0x27c9('0x17')](_0x538e63,{'CampaignId':_0x5e0ffb['id']});}else{Object[_0x27c9('0x17')](_0x538e63,{'VoiceQueueId':_0x5e0ffb['id']});}return _0x3dcb4f[_0x27c9('0x18')][_0x27c9('0x19')]({'where':_0x538e63})[_0x27c9('0xe')](function(_0x2425e4){if(_0x2425e4){throw new Error(_0x27c9('0x21')+_0x5af2b2[_0x27c9('0x13')]+_0x27c9('0x1b')+_0x5e0ffb['id']);}var _0x4d8398=getNewHopperPayload(_0x5af2b2);if(_0x5c6edb){_0x4d8398[_0x27c9('0x1e')]=_0x5e0ffb['id'];}else{_0x4d8398['VoiceQueueId']=_0x5e0ffb['id'];}return _0x3dcb4f['CmHopper']['create'](_0x4d8398);});}function handleNeverCheckDuplicate(_0x1fc7ac,_0x4528c9,_0x3eb7e6){var _0x3d98f7=getNewHopperPayload(_0x3eb7e6);_0x3d98f7[_0x27c9('0x1f')]=_0x4528c9['id'];return _0x1fc7ac['CmHopper'][_0x27c9('0x20')](_0x3d98f7);}function handleCheckDuplicate(_0x59e852,_0x3b43ab,_0x4e768b,_0x5ca266){return getTimezoneCallbackAt(_0x59e852,_0x3b43ab,_0x4e768b,_0x5ca266)[_0x27c9('0xe')](function(_0x34c2ab){_0x4e768b['scheduledat']=_0x34c2ab;switch(_0x3b43ab['dialCheckDuplicateType']){case _0x27c9('0x22'):return handleAlwaysCheckDuplicate(_0x59e852,_0x3b43ab,_0x4e768b,_0x5ca266);case _0x27c9('0x23'):return handleOnlyIfOpenCheckDuplicate(_0x59e852,_0x3b43ab,_0x4e768b,_0x5ca266);default:return handleNeverCheckDuplicate(_0x59e852,_0x3b43ab,_0x4e768b);}});}function createHopperForVoiceQueues(_0x227c82,_0x43acd4){return _0x227c82[_0x27c9('0x7')][_0x27c9('0x24')]({'where':{'type':_0x27c9('0x25')},'attributes':['id','dialCheckDuplicateType',_0x27c9('0xc')],'include':[{'model':_0x227c82[_0x27c9('0x26')],'as':_0x27c9('0x27'),'where':{'id':_0x43acd4[_0x27c9('0x14')]}}],'raw':!![]})[_0x27c9('0xe')](function(_0x54648b){var _0x1709e0=_0x54648b[_0x27c9('0x28')](function(_0x57e99c){return handleCheckDuplicate(_0x227c82,_0x57e99c,_0x43acd4,![]);});return Promise[_0x27c9('0x29')](_0x1709e0);});}function createHopperForCampaigns(_0x34503b,_0x241ff4){return _0x34503b[_0x27c9('0x6')][_0x27c9('0x24')]({'attributes':['id',_0x27c9('0x2a'),_0x27c9('0xc')],'include':[{'model':_0x34503b[_0x27c9('0x26')],'as':_0x27c9('0x27'),'where':{'id':_0x241ff4[_0x27c9('0x14')]}}],'raw':!![]})[_0x27c9('0xe')](function(_0x4d1796){var _0x365f02=_0x4d1796[_0x27c9('0x28')](function(_0x1b294c){return handleCheckDuplicate(_0x34503b,_0x1b294c,_0x241ff4,!![]);});return Promise[_0x27c9('0x29')](_0x365f02);});}function createHopperBlackForVoiceQueues(_0x247196,_0x142270){return _0x247196[_0x27c9('0x7')][_0x27c9('0x24')]({'where':{'type':_0x27c9('0x25')},'attributes':['id'],'include':[{'model':_0x247196[_0x27c9('0x26')],'as':_0x27c9('0x2b'),'where':{'id':_0x142270[_0x27c9('0x14')]}}],'raw':!![]})[_0x27c9('0xe')](function(_0x232629){var _0x446d27=_0x232629['map'](function(_0x5b9739){return _0x247196[_0x27c9('0x2c')]['create']({'phone':_0x142270['phone'],'ContactId':_0x142270['id'],'ListId':_0x142270[_0x27c9('0x14')],'VoiceQueueId':_0x5b9739['id']});});return Promise[_0x27c9('0x29')](_0x446d27);});}function createHopperBlackForCampaigns(_0x27416a,_0x360b5e){return _0x27416a[_0x27c9('0x6')][_0x27c9('0x24')]({'attributes':['id'],'include':[{'model':_0x27416a['CmList'],'as':_0x27c9('0x2b'),'where':{'id':_0x360b5e[_0x27c9('0x14')]}}],'raw':!![]})['then'](function(_0x317ddf){var _0x106489=_0x317ddf[_0x27c9('0x28')](function(_0x1442fe){return _0x27416a[_0x27c9('0x2c')][_0x27c9('0x20')]({'phone':_0x360b5e[_0x27c9('0x13')],'ContactId':_0x360b5e['id'],'ListId':_0x360b5e['ListId'],'CampaignId':_0x1442fe['id']});});return Promise['all'](_0x106489);});}module['exports']=function(_0x10e0b1){return _0x10e0b1[_0x27c9('0x2d')]('CmContact',attributes,{'tableName':_0x27c9('0x2e'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x27c9('0x13')]},{'name':'fti_cm_contacts','fields':[_0x27c9('0x2f'),_0x27c9('0x30'),_0x27c9('0x13'),'mobile','fax',_0x27c9('0x31')],'type':_0x27c9('0x32')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x27c9('0x33'),'hooks':{'afterCreate':function(_0x5b58b9,_0x3721bd,_0xaaaa2a){var _0xbe36df=_0x10e0b1['models'];var _0x3edc21=_0x5b58b9[_0x27c9('0x34')]({'plain':!![]});if(!_0x3edc21[_0x27c9('0x14')]){logger[_0x27c9('0x35')](_0x27c9('0x36')+_0x3edc21['id']);return _0xaaaa2a();}if(!_0x3edc21[_0x27c9('0x13')]){return _0xaaaa2a();}return createHopperForVoiceQueues(_0xbe36df,_0x3edc21)['then'](function(){return createHopperBlackForVoiceQueues(_0xbe36df,_0x3edc21);})[_0x27c9('0xe')](function(){return createHopperForCampaigns(_0xbe36df,_0x3edc21);})[_0x27c9('0xe')](function(){return createHopperBlackForCampaigns(_0xbe36df,_0x3edc21);})[_0x27c9('0xe')](function(){return _0xaaaa2a();})[_0x27c9('0x37')](function(_0x8ae876){logger[_0x27c9('0x35')](_0x27c9('0x38'),_0x8ae876[_0x27c9('0x39')]);_0xaaaa2a();});},'afterDestroy':function(_0x44ab8c,_0xe9ce5b,_0x47782f){var _0x76f47f=_0x10e0b1[_0x27c9('0x3a')];var _0x2ecf09=_0x44ab8c['get']({'plain':!![]});return _0x76f47f['CmHopper'][_0x27c9('0x24')]({'raw':!![],'where':{'ListId':_0x2ecf09[_0x27c9('0x14')],'ContactId':_0x2ecf09['id']}})['then'](function(_0x1f8f7b){if(!_[_0x27c9('0x3b')](_0x1f8f7b)){var _0x538bd0=[];for(var _0x5d490d=0x0;_0x5d490d<_0x1f8f7b[_0x27c9('0x3c')];_0x5d490d+=0x1){var _0x292cf7=_0x76f47f['CmHopper']['destroy']({'where':{'ListId':_0x1f8f7b[_0x5d490d]['ListId'],'ContactId':_0x1f8f7b[_0x5d490d][_0x27c9('0x3d')],'VoiceQueueId':_0x1f8f7b[_0x5d490d][_0x27c9('0x1f')],'CampaignId':_0x1f8f7b[_0x5d490d][_0x27c9('0x1e')]}});_0x538bd0[_0x27c9('0x3e')](_0x292cf7);}return Promise[_0x27c9('0x29')](_0x538bd0);}})[_0x27c9('0xe')](function(_0x11db9e){logger['info'](_0x27c9('0x3f'),util[_0x27c9('0x40')](_0x11db9e,{'showHidden':![],'depth':null}));_0x47782f();})[_0x27c9('0x37')](function(_0x16162c){logger[_0x27c9('0x35')](_0x27c9('0x41'),util[_0x27c9('0x40')](_0x16162c,{'showHidden':![],'depth':null}));_0x47782f(_0x16162c);});}}});}; \ No newline at end of file +var _0xb50b=['utf8mb4','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','length','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','dialTimezone','resolve','findOne','then','isNil','timezones','utcOffset','add','minutes','phone','ListId','YYYY-MM-DD\x20HH:mm:ss','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','findAll','outbound','CmList','map','all','CmHopperBlack','BlackLists','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','FULLTEXT'];(function(_0xefb517,_0x301785){var _0x41eaae=function(_0x59bfe7){while(--_0x59bfe7){_0xefb517['push'](_0xefb517['shift']());}};_0x41eaae(++_0x301785);}(_0xb50b,0x13e));var _0xbb50=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xb50b[_0x16aaef];return _0x1c82ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbb50('0x0'));var moment=require(_0xbb50('0x1'));var shared=require(_0xbb50('0x2'));var attributes=require(_0xbb50('0x3'));function getTimezoneCallbackAt(_0x550df8,_0x1b34c2,_0x47f6b3,_0x207246){var _0x1682fc=_0x207246?_0xbb50('0x4'):_0xbb50('0x5');var _0x555c52=_0x47f6b3[_0xbb50('0x6')]?_0x47f6b3[_0xbb50('0x6')]:moment()[_0xbb50('0x7')]('YYYY-MM-DD\x20HH:mm:ss');if(_['isNil'](_0x47f6b3[_0xbb50('0x8')])){return Promise[_0xbb50('0x9')](_0x555c52);}return _0x550df8[_0x1682fc][_0xbb50('0xa')]({'where':{'id':_0x1b34c2}})[_0xbb50('0xb')](function(_0x94cc5d){if(_[_0xbb50('0xc')](_0x94cc5d)||_[_0xbb50('0xc')](_0x94cc5d[_0xbb50('0x8')])){return Promise['resolve'](_0x555c52);}var _0x371198=shared[_0xbb50('0xd')];var _0x3fb482=_0x371198[_0x94cc5d[_0xbb50('0x8')]];var _0x5db727=_0x371198[_0x47f6b3[_0xbb50('0x8')]];if(_[_0xbb50('0xc')](_0x3fb482)&&_[_0xbb50('0xc')](_0x5db727)){return Promise['resolve'](_0x555c52);}var _0x581079=_0x3fb482[_0xbb50('0xe')]-_0x5db727['utcOffset'];var _0x467b2d=_0x47f6b3[_0xbb50('0x6')]?_0x47f6b3[_0xbb50('0x6')]:moment();_0x555c52=moment(_0x467b2d)[_0xbb50('0xf')](_0x581079,_0xbb50('0x10'))[_0xbb50('0x7')]('YYYY-MM-DD\x20HH:mm:ss');return Promise['resolve'](_0x555c52);});}function getNewHopperPayload(_0x57c0c2){return{'phone':_0x57c0c2[_0xbb50('0x11')],'ContactId':_0x57c0c2['id'],'ListId':_0x57c0c2[_0xbb50('0x12')],'scheduledat':_0x57c0c2[_0xbb50('0x6')]?_0x57c0c2[_0xbb50('0x6')]:moment()[_0xbb50('0x7')](_0xbb50('0x13')),'priority':_0x57c0c2[_0xbb50('0x14')]?_0x57c0c2[_0xbb50('0x14')]:0x2,'callback':_0x57c0c2[_0xbb50('0x15')]?!![]:![],'callbackuniqueid':_0x57c0c2['callbackUniqueid']?_0x57c0c2['callbackUniqueid']:undefined,'callbackat':_0x57c0c2[_0xbb50('0x15')]?moment()['format'](_0xbb50('0x13')):undefined};}function handleAlwaysCheckDuplicate(_0x96fa05,_0x247ba6,_0x51103d,_0x2efd3e){var _0x282036={'phone':_0x51103d[_0xbb50('0x11')]};var _0x48f1df={'calleridnum':_0x51103d[_0xbb50('0x11')]};if(_0x2efd3e){Object[_0xbb50('0x16')](_0x282036,{'CampaignId':_0x247ba6['id']});Object[_0xbb50('0x16')](_0x48f1df,{'CampaignId':_0x247ba6['id']});}else{Object['assign'](_0x282036,{'VoiceQueueId':_0x247ba6['id']});Object['assign'](_0x48f1df,{'VoiceQueueId':_0x247ba6['id']});}return _0x96fa05[_0xbb50('0x17')][_0xbb50('0xa')]({'where':_0x282036})[_0xbb50('0xb')](function(_0x4835ac){if(_0x4835ac){throw new Error(_0xbb50('0x18')+_0x51103d[_0xbb50('0x11')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x247ba6['id']);}return _0x96fa05['CmHopperFinal'][_0xbb50('0xa')]({'where':_0x48f1df});})[_0xbb50('0xb')](function(_0x4c675a){if(_0x4c675a){throw new Error(_0xbb50('0x19')+_0x51103d[_0xbb50('0x11')]+_0xbb50('0x1a')+_0x247ba6['id']);}var _0x547413=getNewHopperPayload(_0x51103d);if(_0x2efd3e){_0x547413[_0xbb50('0x1b')]=_0x247ba6['id'];}else{_0x547413['VoiceQueueId']=_0x247ba6['id'];}return _0x96fa05[_0xbb50('0x17')][_0xbb50('0x1c')](_0x547413);});}function handleOnlyIfOpenCheckDuplicate(_0x1af142,_0x5d4073,_0x4c98e1,_0x563ec6){var _0x3d2dd3={'phone':_0x4c98e1[_0xbb50('0x11')]};if(_0x563ec6){Object[_0xbb50('0x16')](_0x3d2dd3,{'CampaignId':_0x5d4073['id']});}else{Object[_0xbb50('0x16')](_0x3d2dd3,{'VoiceQueueId':_0x5d4073['id']});}return _0x1af142[_0xbb50('0x17')]['findOne']({'where':_0x3d2dd3})[_0xbb50('0xb')](function(_0x5b8a1d){if(_0x5b8a1d){throw new Error(_0xbb50('0x1d')+_0x4c98e1[_0xbb50('0x11')]+_0xbb50('0x1a')+_0x5d4073['id']);}var _0x50314f=getNewHopperPayload(_0x4c98e1);if(_0x563ec6){_0x50314f['CampaignId']=_0x5d4073['id'];}else{_0x50314f[_0xbb50('0x1e')]=_0x5d4073['id'];}return _0x1af142['CmHopper']['create'](_0x50314f);});}function handleNeverCheckDuplicate(_0x1818c6,_0x19a992,_0x374963){var _0x16c77c=getNewHopperPayload(_0x374963);_0x16c77c[_0xbb50('0x1e')]=_0x19a992['id'];return _0x1818c6[_0xbb50('0x17')][_0xbb50('0x1c')](_0x16c77c);}function handleCheckDuplicate(_0x5889ac,_0x31eb33,_0xa4e39b,_0x446081){return getTimezoneCallbackAt(_0x5889ac,_0x31eb33,_0xa4e39b,_0x446081)[_0xbb50('0xb')](function(_0x2dcef5){_0xa4e39b[_0xbb50('0x6')]=_0x2dcef5;switch(_0x31eb33[_0xbb50('0x1f')]){case _0xbb50('0x20'):return handleAlwaysCheckDuplicate(_0x5889ac,_0x31eb33,_0xa4e39b,_0x446081);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x5889ac,_0x31eb33,_0xa4e39b,_0x446081);default:return handleNeverCheckDuplicate(_0x5889ac,_0x31eb33,_0xa4e39b);}});}function createHopperForVoiceQueues(_0x2c5766,_0x49c4a0){return _0x2c5766[_0xbb50('0x5')][_0xbb50('0x21')]({'where':{'type':_0xbb50('0x22')},'attributes':['id',_0xbb50('0x1f'),'dialTimezone'],'include':[{'model':_0x2c5766[_0xbb50('0x23')],'as':'Lists','where':{'id':_0x49c4a0[_0xbb50('0x12')]}}],'raw':!![]})[_0xbb50('0xb')](function(_0x47d72f){var _0x221be3=_0x47d72f[_0xbb50('0x24')](function(_0x4eddb7){return handleCheckDuplicate(_0x2c5766,_0x4eddb7,_0x49c4a0,![]);});return Promise[_0xbb50('0x25')](_0x221be3);});}function createHopperForCampaigns(_0x2d175d,_0xe180d1){return _0x2d175d[_0xbb50('0x4')]['findAll']({'attributes':['id',_0xbb50('0x1f'),'dialTimezone'],'include':[{'model':_0x2d175d['CmList'],'as':'Lists','where':{'id':_0xe180d1[_0xbb50('0x12')]}}],'raw':!![]})[_0xbb50('0xb')](function(_0xfe70f1){var _0x5388dd=_0xfe70f1['map'](function(_0x4f6f14){return handleCheckDuplicate(_0x2d175d,_0x4f6f14,_0xe180d1,!![]);});return Promise['all'](_0x5388dd);});}function createHopperBlackForVoiceQueues(_0x146403,_0x5dd920){return _0x146403[_0xbb50('0x5')][_0xbb50('0x21')]({'where':{'type':_0xbb50('0x22')},'attributes':['id'],'include':[{'model':_0x146403[_0xbb50('0x23')],'as':'BlackLists','where':{'id':_0x5dd920[_0xbb50('0x12')]}}],'raw':!![]})['then'](function(_0x50ba4b){var _0x17b303=_0x50ba4b[_0xbb50('0x24')](function(_0x3fa6e3){return _0x146403[_0xbb50('0x26')]['create']({'phone':_0x5dd920['phone'],'ContactId':_0x5dd920['id'],'ListId':_0x5dd920['ListId'],'VoiceQueueId':_0x3fa6e3['id']});});return Promise[_0xbb50('0x25')](_0x17b303);});}function createHopperBlackForCampaigns(_0x16b586,_0x573ded){return _0x16b586[_0xbb50('0x4')][_0xbb50('0x21')]({'attributes':['id'],'include':[{'model':_0x16b586[_0xbb50('0x23')],'as':_0xbb50('0x27'),'where':{'id':_0x573ded[_0xbb50('0x12')]}}],'raw':!![]})[_0xbb50('0xb')](function(_0x3d7e0b){var _0x294008=_0x3d7e0b[_0xbb50('0x24')](function(_0x492e61){return _0x16b586[_0xbb50('0x26')][_0xbb50('0x1c')]({'phone':_0x573ded[_0xbb50('0x11')],'ContactId':_0x573ded['id'],'ListId':_0x573ded[_0xbb50('0x12')],'CampaignId':_0x492e61['id']});});return Promise[_0xbb50('0x25')](_0x294008);});}module['exports']=function(_0x1327cd){return _0x1327cd[_0xbb50('0x28')](_0xbb50('0x29'),attributes,{'tableName':_0xbb50('0x2a'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xbb50('0x11')]},{'name':_0xbb50('0x2b'),'fields':[_0xbb50('0x2c'),_0xbb50('0x2d'),'phone',_0xbb50('0x2e'),'fax','email'],'type':_0xbb50('0x2f')}],'timestamps':!![],'charset':_0xbb50('0x30'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x584052,_0x24a998,_0x5380b3){var _0x58d6d6=_0x1327cd[_0xbb50('0x31')];var _0x3889dd=_0x584052[_0xbb50('0x32')]({'plain':!![]});if(!_0x3889dd['ListId']){logger[_0xbb50('0x33')](_0xbb50('0x34')+_0x3889dd['id']);return _0x5380b3();}if(!_0x3889dd[_0xbb50('0x11')]){return _0x5380b3();}return createHopperForVoiceQueues(_0x58d6d6,_0x3889dd)[_0xbb50('0xb')](function(){return createHopperBlackForVoiceQueues(_0x58d6d6,_0x3889dd);})[_0xbb50('0xb')](function(){return createHopperForCampaigns(_0x58d6d6,_0x3889dd);})[_0xbb50('0xb')](function(){return createHopperBlackForCampaigns(_0x58d6d6,_0x3889dd);})[_0xbb50('0xb')](function(){return _0x5380b3();})[_0xbb50('0x35')](function(_0x1bb511){logger['error'](_0xbb50('0x36'),_0x1bb511[_0xbb50('0x37')]);_0x5380b3();});},'afterDestroy':function(_0x5102b3,_0xa1c557,_0x317f65){var _0x55681c=_0x1327cd[_0xbb50('0x31')];var _0x253a70=_0x5102b3[_0xbb50('0x32')]({'plain':!![]});return _0x55681c[_0xbb50('0x17')][_0xbb50('0x21')]({'raw':!![],'where':{'ListId':_0x253a70[_0xbb50('0x12')],'ContactId':_0x253a70['id']}})['then'](function(_0xb51466){if(!_['isEmpty'](_0xb51466)){var _0x829c6=[];for(var _0x5e345e=0x0;_0x5e345e<_0xb51466[_0xbb50('0x38')];_0x5e345e+=0x1){var _0x6d7065=_0x55681c['CmHopper']['destroy']({'where':{'ListId':_0xb51466[_0x5e345e][_0xbb50('0x12')],'ContactId':_0xb51466[_0x5e345e][_0xbb50('0x39')],'VoiceQueueId':_0xb51466[_0x5e345e]['VoiceQueueId'],'CampaignId':_0xb51466[_0x5e345e]['CampaignId']}});_0x829c6[_0xbb50('0x3a')](_0x6d7065);}return Promise[_0xbb50('0x25')](_0x829c6);}})[_0xbb50('0xb')](function(_0x12f99e){logger['info'](_0xbb50('0x3b'),util[_0xbb50('0x3c')](_0x12f99e,{'showHidden':![],'depth':null}));_0x317f65();})[_0xbb50('0x35')](function(_0x19e90f){logger['error']('[CmContact][afterDestroy][Error]',util[_0xbb50('0x3c')](_0x19e90f,{'showHidden':![],'depth':null}));_0x317f65(_0x19e90f);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 53e3c58..293dcfa 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x1b7e5a,_0x4181d1){var _0x491ef6=function(_0x53277a){while(--_0x53277a){_0x1b7e5a['push'](_0x1b7e5a['shift']());}};_0x491ef6(++_0x4181d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index fa74a03..9fa7cdb 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fdc=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0x2ecf58,_0x4795ee){var _0x2f6f18=function(_0x5b60a1){while(--_0x5b60a1){_0x2ecf58['push'](_0x2ecf58['shift']());}};_0x2f6f18(++_0x4795ee);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x1fdc[_0x4450b1];return _0x399b0b;};'use strict';var Sequelize=require(_0xc1fd('0x0'));module[_0xc1fd('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xc1fd('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc1fd('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc1fd('0x2')],'defaultValue':_0xc1fd('0x4')},'OrderBy':{'type':Sequelize[_0xc1fd('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xc1fd('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xcfac=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xcfac,0x105));var _0xccfa=function(_0x911633,_0xac5af2){_0x911633=_0x911633-0x0;var _0x56e661=_0xcfac[_0x911633];return _0x56e661;};'use strict';var Sequelize=require(_0xccfa('0x0'));module[_0xccfa('0x1')]={'CmContactId':{'type':Sequelize[_0xccfa('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xccfa('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xccfa('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xccfa('0x3')],'defaultValue':_0xccfa('0x4')},'OrderBy':{'type':Sequelize[_0xccfa('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xccfa('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 95a817b..519b9a1 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff11=['name','send','map','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','CmContactHasItem','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','request-promise','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','get','CmContactHasItems','UserProfileResource','then','sendStatus','error','stack'];(function(_0x3a5fdd,_0x3c2047){var _0x4f0aeb=function(_0x4bf54d){while(--_0x4bf54d){_0x3a5fdd['push'](_0x3a5fdd['shift']());}};_0x4f0aeb(++_0x3c2047);}(_0xff11,0x10e));var _0x1ff1=function(_0x4f4b58,_0xc7bd71){_0x4f4b58=_0x4f4b58-0x0;var _0x26672b=_0xff11[_0x4f4b58];return _0x26672b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ff1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1ff1('0x1'));var moment=require('moment');var BPromise=require(_0x1ff1('0x2'));var Mustache=require(_0x1ff1('0x3'));var util=require('util');var path=require(_0x1ff1('0x4'));var sox=require(_0x1ff1('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ff1('0x6'));var _=require('lodash');var squel=require(_0x1ff1('0x7'));var crypto=require(_0x1ff1('0x8'));var jsforce=require(_0x1ff1('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ff1('0xa'));var Papa=require('papaparse');var Redis=require(_0x1ff1('0xb'));var authService=require(_0x1ff1('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ff1('0xd'));var logger=require(_0x1ff1('0xe'))(_0x1ff1('0xf'));var utils=require(_0x1ff1('0x10'));var config=require(_0x1ff1('0x11'));var licenseUtil=require(_0x1ff1('0x12'));var db=require(_0x1ff1('0x13'))['db'];function respondWithStatusCode(_0x2374cd,_0x2bffcb){_0x2bffcb=_0x2bffcb||0xcc;return function(_0x325f31){if(_0x325f31){return _0x2374cd['sendStatus'](_0x2bffcb);}return _0x2374cd[_0x1ff1('0x14')](_0x2bffcb)[_0x1ff1('0x15')]();};}function respondWithResult(_0x88151b,_0x351f6e){_0x351f6e=_0x351f6e||0xc8;return function(_0x21123d){if(_0x21123d){return _0x88151b[_0x1ff1('0x14')](_0x351f6e)[_0x1ff1('0x16')](_0x21123d);}};}function respondWithFilteredResult(_0x43d686,_0x1426de){return function(_0x568d40){if(_0x568d40){var _0x5754f5=typeof _0x1426de[_0x1ff1('0x17')]===_0x1ff1('0x18')&&typeof _0x1426de[_0x1ff1('0x19')]===_0x1ff1('0x18');var _0x3040a9=_0x568d40[_0x1ff1('0x1a')];var _0x5eed93=_0x5754f5?0x0:_0x1426de[_0x1ff1('0x17')];var _0x26d2c2=_0x5754f5?_0x568d40[_0x1ff1('0x1a')]:_0x1426de['offset']+_0x1426de[_0x1ff1('0x19')];var _0x1e33af;if(_0x26d2c2>=_0x3040a9){_0x26d2c2=_0x3040a9;_0x1e33af=0xc8;}else{_0x1e33af=0xce;}_0x43d686[_0x1ff1('0x14')](_0x1e33af);return _0x43d686[_0x1ff1('0x1b')](_0x1ff1('0x1c'),_0x5eed93+'-'+_0x26d2c2+'/'+_0x3040a9)[_0x1ff1('0x16')](_0x568d40);}return null;};}function patchUpdates(_0x4c55c9){return function(_0x4c9ea0){try{jsonpatch['apply'](_0x4c9ea0,_0x4c55c9,!![]);}catch(_0x26a773){return BPromise[_0x1ff1('0x1d')](_0x26a773);}return _0x4c9ea0['save']();};}function saveUpdates(_0x218c03,_0x3fd5bc){return function(_0x3753dc){if(_0x3753dc){return _0x3753dc['update'](_0x218c03)['then'](function(_0x2cbb89){return _0x2cbb89;});}return null;};}function removeEntity(_0x6a708,_0x211810){return function(_0x2c077f){if(_0x2c077f){return _0x2c077f[_0x1ff1('0x1e')]()['then'](function(){var _0x57f674=_0x2c077f[_0x1ff1('0x1f')]({'plain':!![]});var _0x320e27=_0x1ff1('0x20');return db[_0x1ff1('0x21')]['destroy']({'where':{'type':_0x320e27,'resourceId':_0x57f674['id']}})[_0x1ff1('0x22')](function(){return _0x2c077f;});})[_0x1ff1('0x22')](function(){_0x6a708[_0x1ff1('0x14')](0xcc)[_0x1ff1('0x15')]();});}};}function handleEntityNotFound(_0x48a20e,_0x5ba3f3){return function(_0x836363){if(!_0x836363){_0x48a20e[_0x1ff1('0x23')](0x194);}return _0x836363;};}function handleError(_0x59838e,_0x552e9a){_0x552e9a=_0x552e9a||0x1f4;return function(_0x58dddb){logger[_0x1ff1('0x24')](_0x58dddb[_0x1ff1('0x25')]);if(_0x58dddb['name']){delete _0x58dddb[_0x1ff1('0x26')];}_0x59838e[_0x1ff1('0x14')](_0x552e9a)[_0x1ff1('0x27')](_0x58dddb);};}exports['index']=function(_0x3b179e,_0x34efc2){var _0x51168e={},_0x3723cd={},_0x1928f9={'count':0x0,'rows':[]};var _0x3156b0=_[_0x1ff1('0x28')](db['CmContactHasItem']['rawAttributes'],function(_0x4ffd37){return{'name':_0x4ffd37['fieldName'],'type':_0x4ffd37[_0x1ff1('0x29')]['key']};});_0x3723cd['model']=_[_0x1ff1('0x28')](_0x3156b0,_0x1ff1('0x26'));_0x3723cd[_0x1ff1('0x2a')]=_['keys'](_0x3b179e[_0x1ff1('0x2a')]);_0x3723cd[_0x1ff1('0x2b')]=_[_0x1ff1('0x2c')](_0x3723cd[_0x1ff1('0x2d')],_0x3723cd[_0x1ff1('0x2a')]);_0x51168e[_0x1ff1('0x2e')]=_[_0x1ff1('0x2c')](_0x3723cd['model'],qs['fields'](_0x3b179e[_0x1ff1('0x2a')][_0x1ff1('0x2f')]));_0x51168e[_0x1ff1('0x2e')]=_0x51168e[_0x1ff1('0x2e')][_0x1ff1('0x30')]?_0x51168e[_0x1ff1('0x2e')]:_0x3723cd['model'];if(!_0x3b179e[_0x1ff1('0x2a')][_0x1ff1('0x31')](_0x1ff1('0x32'))){_0x51168e[_0x1ff1('0x19')]=qs[_0x1ff1('0x19')](_0x3b179e[_0x1ff1('0x2a')][_0x1ff1('0x19')]);_0x51168e[_0x1ff1('0x17')]=qs['offset'](_0x3b179e[_0x1ff1('0x2a')]['offset']);}_0x51168e['order']=qs[_0x1ff1('0x33')](_0x3b179e['query'][_0x1ff1('0x33')]);_0x51168e[_0x1ff1('0x34')]=qs[_0x1ff1('0x2b')](_[_0x1ff1('0x35')](_0x3b179e[_0x1ff1('0x2a')],_0x3723cd[_0x1ff1('0x2b')]),_0x3156b0);if(_0x3b179e[_0x1ff1('0x2a')]['filter']){_0x51168e[_0x1ff1('0x34')]=_[_0x1ff1('0x36')](_0x51168e[_0x1ff1('0x34')],{'$or':_[_0x1ff1('0x28')](_0x3156b0,function(_0x3baa8b){if(_0x3baa8b['type']!==_0x1ff1('0x37')){var _0x37f587={};_0x37f587[_0x3baa8b['name']]={'$like':'%'+_0x3b179e[_0x1ff1('0x2a')][_0x1ff1('0x38')]+'%'};return _0x37f587;}})});}_0x51168e=_[_0x1ff1('0x36')]({},_0x51168e,_0x3b179e[_0x1ff1('0x39')]);var _0x5216b6={'where':_0x51168e[_0x1ff1('0x34')]};return db[_0x1ff1('0x3a')][_0x1ff1('0x1a')](_0x5216b6)[_0x1ff1('0x22')](function(_0x5d9d1b){_0x1928f9[_0x1ff1('0x1a')]=_0x5d9d1b;if(_0x3b179e[_0x1ff1('0x2a')]['includeAll']){_0x51168e[_0x1ff1('0x3b')]=[{'all':!![]}];}return db[_0x1ff1('0x3a')][_0x1ff1('0x3c')](_0x51168e);})[_0x1ff1('0x22')](function(_0x3ec8c2){_0x1928f9[_0x1ff1('0x3d')]=_0x3ec8c2;return _0x1928f9;})[_0x1ff1('0x22')](respondWithFilteredResult(_0x34efc2,_0x51168e))[_0x1ff1('0x3e')](handleError(_0x34efc2,null));};exports[_0x1ff1('0x3f')]=function(_0xb1b9a8,_0x4af9a7){var _0x233f92={'raw':!![],'where':{'id':_0xb1b9a8[_0x1ff1('0x40')]['id']}},_0x19c358={};_0x19c358['model']=_[_0x1ff1('0x41')](db['CmContactHasItem']['rawAttributes']);_0x19c358['query']=_[_0x1ff1('0x41')](_0xb1b9a8[_0x1ff1('0x2a')]);_0x19c358[_0x1ff1('0x2b')]=_[_0x1ff1('0x2c')](_0x19c358['model'],_0x19c358[_0x1ff1('0x2a')]);_0x233f92[_0x1ff1('0x2e')]=_[_0x1ff1('0x2c')](_0x19c358[_0x1ff1('0x2d')],qs[_0x1ff1('0x2f')](_0xb1b9a8[_0x1ff1('0x2a')]['fields']));_0x233f92['attributes']=_0x233f92['attributes'][_0x1ff1('0x30')]?_0x233f92[_0x1ff1('0x2e')]:_0x19c358[_0x1ff1('0x2d')];if(_0xb1b9a8[_0x1ff1('0x2a')][_0x1ff1('0x42')]){_0x233f92[_0x1ff1('0x3b')]=[{'all':!![]}];}_0x233f92=_[_0x1ff1('0x36')]({},_0x233f92,_0xb1b9a8['options']);return db[_0x1ff1('0x3a')][_0x1ff1('0x43')](_0x233f92)[_0x1ff1('0x22')](handleEntityNotFound(_0x4af9a7,null))['then'](respondWithResult(_0x4af9a7,null))[_0x1ff1('0x3e')](handleError(_0x4af9a7,null));};exports[_0x1ff1('0x44')]=function(_0x570d34,_0x3eda8d){return db[_0x1ff1('0x3a')]['create'](_0x570d34[_0x1ff1('0x45')],{})['then'](function(_0x234b04){var _0x3394fc=_0x570d34[_0x1ff1('0x46')]['get']({'plain':!![]});if(!_0x3394fc)throw new Error(_0x1ff1('0x47'));if(_0x3394fc[_0x1ff1('0x48')]===_0x1ff1('0x46')){var _0x5775a6=_0x234b04['get']({'plain':!![]});var _0x3fc64c=_0x1ff1('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x3fc64c,'userProfileId':_0x3394fc[_0x1ff1('0x49')]},'raw':!![]})['then'](function(_0x5d0a14){if(_0x5d0a14&&_0x5d0a14[_0x1ff1('0x4a')]===0x0){return db[_0x1ff1('0x21')]['create']({'name':_0x5775a6[_0x1ff1('0x26')],'resourceId':_0x5775a6['id'],'type':_0x5d0a14['name'],'sectionId':_0x5d0a14['id']},{})['then'](function(){return _0x234b04;});}else{return _0x234b04;}})['catch'](function(_0x554cd8){logger[_0x1ff1('0x24')](_0x1ff1('0x4b'),_0x554cd8);throw _0x554cd8;});}return _0x234b04;})['then'](respondWithResult(_0x3eda8d,0xc9))[_0x1ff1('0x3e')](handleError(_0x3eda8d,null));};exports[_0x1ff1('0x4c')]=function(_0x3d3b9b,_0x5cf517){if(_0x3d3b9b[_0x1ff1('0x45')]['id']){delete _0x3d3b9b[_0x1ff1('0x45')]['id'];}return db[_0x1ff1('0x3a')][_0x1ff1('0x43')]({'where':{'id':_0x3d3b9b[_0x1ff1('0x40')]['id']}})[_0x1ff1('0x22')](handleEntityNotFound(_0x5cf517,null))['then'](saveUpdates(_0x3d3b9b[_0x1ff1('0x45')],null))[_0x1ff1('0x22')](respondWithResult(_0x5cf517,null))['catch'](handleError(_0x5cf517,null));};exports[_0x1ff1('0x1e')]=function(_0x5bd4a1,_0x535d84){return db[_0x1ff1('0x3a')]['find']({'where':{'id':_0x5bd4a1[_0x1ff1('0x40')]['id']}})[_0x1ff1('0x22')](handleEntityNotFound(_0x535d84,null))[_0x1ff1('0x22')](removeEntity(_0x535d84,null))[_0x1ff1('0x3e')](handleError(_0x535d84,null));}; \ No newline at end of file +var _0x54e4=['attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','error','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','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','limit','count','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','model','map','keys','query','intersection'];(function(_0x13d5a3,_0x4fe4ec){var _0xf5e40d=function(_0x240fe2){while(--_0x240fe2){_0x13d5a3['push'](_0x13d5a3['shift']());}};_0xf5e40d(++_0x4fe4ec);}(_0x54e4,0x1b3));var _0x454e=function(_0x423f2a,_0x5a0be7){_0x423f2a=_0x423f2a-0x0;var _0x17092e=_0x54e4[_0x423f2a];return _0x17092e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x454e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x454e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x454e('0x2'));var Mustache=require(_0x454e('0x3'));var util=require(_0x454e('0x4'));var path=require('path');var sox=require(_0x454e('0x5'));var csv=require(_0x454e('0x6'));var ejs=require(_0x454e('0x7'));var fs=require('fs');var fs_extra=require(_0x454e('0x8'));var _=require('lodash');var squel=require(_0x454e('0x9'));var crypto=require(_0x454e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x454e('0xb'));var toCsv=require(_0x454e('0x6'));var querystring=require(_0x454e('0xc'));var Papa=require(_0x454e('0xd'));var Redis=require(_0x454e('0xe'));var authService=require(_0x454e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x454e('0x10'))(_0x454e('0x11'));var utils=require(_0x454e('0x12'));var config=require(_0x454e('0x13'));var licenseUtil=require(_0x454e('0x14'));var db=require(_0x454e('0x15'))['db'];function respondWithStatusCode(_0xb307e6,_0x131a7e){_0x131a7e=_0x131a7e||0xcc;return function(_0x20f0fb){if(_0x20f0fb){return _0xb307e6[_0x454e('0x16')](_0x131a7e);}return _0xb307e6[_0x454e('0x17')](_0x131a7e)[_0x454e('0x18')]();};}function respondWithResult(_0x32975e,_0x2ca46e){_0x2ca46e=_0x2ca46e||0xc8;return function(_0x37e35e){if(_0x37e35e){return _0x32975e[_0x454e('0x17')](_0x2ca46e)[_0x454e('0x19')](_0x37e35e);}};}function respondWithFilteredResult(_0x205ca0,_0x40a461){return function(_0x12f00d){if(_0x12f00d){var _0x4ee2d3=typeof _0x40a461[_0x454e('0x1a')]===_0x454e('0x1b')&&typeof _0x40a461[_0x454e('0x1c')]===_0x454e('0x1b');var _0x3b973d=_0x12f00d[_0x454e('0x1d')];var _0x163ea5=_0x4ee2d3?0x0:_0x40a461[_0x454e('0x1a')];var _0x2e566d=_0x4ee2d3?_0x12f00d[_0x454e('0x1d')]:_0x40a461['offset']+_0x40a461[_0x454e('0x1c')];var _0x15e1b9;if(_0x2e566d>=_0x3b973d){_0x2e566d=_0x3b973d;_0x15e1b9=0xc8;}else{_0x15e1b9=0xce;}_0x205ca0[_0x454e('0x17')](_0x15e1b9);return _0x205ca0['set'](_0x454e('0x1e'),_0x163ea5+'-'+_0x2e566d+'/'+_0x3b973d)[_0x454e('0x19')](_0x12f00d);}return null;};}function patchUpdates(_0x2caa40){return function(_0x39e34d){try{jsonpatch[_0x454e('0x1f')](_0x39e34d,_0x2caa40,!![]);}catch(_0xce2b88){return BPromise[_0x454e('0x20')](_0xce2b88);}return _0x39e34d[_0x454e('0x21')]();};}function saveUpdates(_0x119748,_0x119322){return function(_0x2b02db){if(_0x2b02db){return _0x2b02db[_0x454e('0x22')](_0x119748)[_0x454e('0x23')](function(_0x1410bb){return _0x1410bb;});}return null;};}function removeEntity(_0x3de5fc,_0x474ca4){return function(_0xc317f4){if(_0xc317f4){return _0xc317f4['destroy']()[_0x454e('0x23')](function(){var _0x208773=_0xc317f4[_0x454e('0x24')]({'plain':!![]});var _0x26bfb2='CmContactHasItems';return db[_0x454e('0x25')][_0x454e('0x26')]({'where':{'type':_0x26bfb2,'resourceId':_0x208773['id']}})[_0x454e('0x23')](function(){return _0xc317f4;});})[_0x454e('0x23')](function(){_0x3de5fc[_0x454e('0x17')](0xcc)[_0x454e('0x18')]();});}};}function handleEntityNotFound(_0x1b6ea3,_0x33dd39){return function(_0xc13588){if(!_0xc13588){_0x1b6ea3['sendStatus'](0x194);}return _0xc13588;};}function handleError(_0x50d244,_0x1920f5){_0x1920f5=_0x1920f5||0x1f4;return function(_0x583497){logger['error'](_0x583497[_0x454e('0x27')]);if(_0x583497[_0x454e('0x28')]){delete _0x583497[_0x454e('0x28')];}_0x50d244[_0x454e('0x17')](_0x1920f5)[_0x454e('0x29')](_0x583497);};}exports[_0x454e('0x2a')]=function(_0x3ed578,_0x5912d1){var _0x37e42c={},_0x4955aa={},_0x492f41={'count':0x0,'rows':[]};var _0x33735d=_['map'](db[_0x454e('0x2b')][_0x454e('0x2c')],function(_0x299049){return{'name':_0x299049[_0x454e('0x2d')],'type':_0x299049['type']['key']};});_0x4955aa[_0x454e('0x2e')]=_[_0x454e('0x2f')](_0x33735d,_0x454e('0x28'));_0x4955aa['query']=_[_0x454e('0x30')](_0x3ed578[_0x454e('0x31')]);_0x4955aa['filters']=_[_0x454e('0x32')](_0x4955aa[_0x454e('0x2e')],_0x4955aa[_0x454e('0x31')]);_0x37e42c[_0x454e('0x33')]=_[_0x454e('0x32')](_0x4955aa[_0x454e('0x2e')],qs[_0x454e('0x34')](_0x3ed578['query'][_0x454e('0x34')]));_0x37e42c[_0x454e('0x33')]=_0x37e42c[_0x454e('0x33')]['length']?_0x37e42c['attributes']:_0x4955aa[_0x454e('0x2e')];if(!_0x3ed578[_0x454e('0x31')]['hasOwnProperty'](_0x454e('0x35'))){_0x37e42c[_0x454e('0x1c')]=qs['limit'](_0x3ed578[_0x454e('0x31')][_0x454e('0x1c')]);_0x37e42c[_0x454e('0x1a')]=qs['offset'](_0x3ed578[_0x454e('0x31')][_0x454e('0x1a')]);}_0x37e42c[_0x454e('0x36')]=qs[_0x454e('0x37')](_0x3ed578[_0x454e('0x31')][_0x454e('0x37')]);_0x37e42c[_0x454e('0x38')]=qs[_0x454e('0x39')](_[_0x454e('0x3a')](_0x3ed578[_0x454e('0x31')],_0x4955aa[_0x454e('0x39')]),_0x33735d);if(_0x3ed578[_0x454e('0x31')][_0x454e('0x3b')]){_0x37e42c[_0x454e('0x38')]=_[_0x454e('0x3c')](_0x37e42c[_0x454e('0x38')],{'$or':_[_0x454e('0x2f')](_0x33735d,function(_0xd37001){if(_0xd37001[_0x454e('0x3d')]!==_0x454e('0x3e')){var _0x56249e={};_0x56249e[_0xd37001[_0x454e('0x28')]]={'$like':'%'+_0x3ed578['query'][_0x454e('0x3b')]+'%'};return _0x56249e;}})});}_0x37e42c=_['merge']({},_0x37e42c,_0x3ed578[_0x454e('0x3f')]);var _0x2853ee={'where':_0x37e42c[_0x454e('0x38')]};return db['CmContactHasItem']['count'](_0x2853ee)['then'](function(_0x4c751e){_0x492f41[_0x454e('0x1d')]=_0x4c751e;if(_0x3ed578[_0x454e('0x31')][_0x454e('0x40')]){_0x37e42c[_0x454e('0x41')]=[{'all':!![]}];}return db[_0x454e('0x2b')]['findAll'](_0x37e42c);})[_0x454e('0x23')](function(_0x24777e){_0x492f41[_0x454e('0x42')]=_0x24777e;return _0x492f41;})[_0x454e('0x23')](respondWithFilteredResult(_0x5912d1,_0x37e42c))[_0x454e('0x43')](handleError(_0x5912d1,null));};exports[_0x454e('0x44')]=function(_0x391c42,_0x20f3a1){var _0x4c0d2e={'raw':!![],'where':{'id':_0x391c42[_0x454e('0x45')]['id']}},_0x4a1ce0={};_0x4a1ce0['model']=_['keys'](db[_0x454e('0x2b')][_0x454e('0x2c')]);_0x4a1ce0[_0x454e('0x31')]=_[_0x454e('0x30')](_0x391c42[_0x454e('0x31')]);_0x4a1ce0[_0x454e('0x39')]=_[_0x454e('0x32')](_0x4a1ce0[_0x454e('0x2e')],_0x4a1ce0[_0x454e('0x31')]);_0x4c0d2e[_0x454e('0x33')]=_['intersection'](_0x4a1ce0[_0x454e('0x2e')],qs['fields'](_0x391c42[_0x454e('0x31')][_0x454e('0x34')]));_0x4c0d2e[_0x454e('0x33')]=_0x4c0d2e[_0x454e('0x33')][_0x454e('0x46')]?_0x4c0d2e[_0x454e('0x33')]:_0x4a1ce0[_0x454e('0x2e')];if(_0x391c42[_0x454e('0x31')]['includeAll']){_0x4c0d2e[_0x454e('0x41')]=[{'all':!![]}];}_0x4c0d2e=_[_0x454e('0x3c')]({},_0x4c0d2e,_0x391c42['options']);return db[_0x454e('0x2b')][_0x454e('0x47')](_0x4c0d2e)[_0x454e('0x23')](handleEntityNotFound(_0x20f3a1,null))[_0x454e('0x23')](respondWithResult(_0x20f3a1,null))['catch'](handleError(_0x20f3a1,null));};exports[_0x454e('0x48')]=function(_0xdc8544,_0x5a28f4){return db[_0x454e('0x2b')][_0x454e('0x48')](_0xdc8544[_0x454e('0x49')],{})['then'](function(_0x20611c){var _0x328aef=_0xdc8544[_0x454e('0x4a')][_0x454e('0x24')]({'plain':!![]});if(!_0x328aef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x328aef[_0x454e('0x4b')]===_0x454e('0x4a')){var _0x3bb71e=_0x20611c[_0x454e('0x24')]({'plain':!![]});var _0x52ffb0=_0x454e('0x4c');return db[_0x454e('0x4d')]['find']({'where':{'name':_0x52ffb0,'userProfileId':_0x328aef[_0x454e('0x4e')]},'raw':!![]})[_0x454e('0x23')](function(_0x337452){if(_0x337452&&_0x337452[_0x454e('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x3bb71e[_0x454e('0x28')],'resourceId':_0x3bb71e['id'],'type':_0x337452[_0x454e('0x28')],'sectionId':_0x337452['id']},{})[_0x454e('0x23')](function(){return _0x20611c;});}else{return _0x20611c;}})[_0x454e('0x43')](function(_0xdb29bb){logger[_0x454e('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdb29bb);throw _0xdb29bb;});}return _0x20611c;})[_0x454e('0x23')](respondWithResult(_0x5a28f4,0xc9))[_0x454e('0x43')](handleError(_0x5a28f4,null));};exports[_0x454e('0x22')]=function(_0x23ff88,_0x48e43f){if(_0x23ff88[_0x454e('0x49')]['id']){delete _0x23ff88[_0x454e('0x49')]['id'];}return db[_0x454e('0x2b')][_0x454e('0x47')]({'where':{'id':_0x23ff88[_0x454e('0x45')]['id']}})[_0x454e('0x23')](handleEntityNotFound(_0x48e43f,null))[_0x454e('0x23')](saveUpdates(_0x23ff88[_0x454e('0x49')],null))[_0x454e('0x23')](respondWithResult(_0x48e43f,null))[_0x454e('0x43')](handleError(_0x48e43f,null));};exports[_0x454e('0x26')]=function(_0x4db6ff,_0x15525c){return db[_0x454e('0x2b')][_0x454e('0x47')]({'where':{'id':_0x4db6ff['params']['id']}})[_0x454e('0x23')](handleEntityNotFound(_0x15525c,null))[_0x454e('0x23')](removeEntity(_0x15525c,null))['catch'](handleError(_0x15525c,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index f1a7395..8dbdfa9 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc45d=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x6e5e90,_0x181771){var _0x2cff97=function(_0xa09816){while(--_0xa09816){_0x6e5e90['push'](_0x6e5e90['shift']());}};_0x2cff97(++_0x181771);}(_0xc45d,0x190));var _0xdc45=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0xc45d[_0x1f9f5f];return _0x51d649;};'use strict';var _=require(_0xdc45('0x0'));var util=require(_0xdc45('0x1'));var logger=require(_0xdc45('0x2'))(_0xdc45('0x3'));var moment=require(_0xdc45('0x4'));var BPromise=require(_0xdc45('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc45('0x6'));var rimraf=require('rimraf');var config=require(_0xdc45('0x7'));var attributes=require(_0xdc45('0x8'));module[_0xdc45('0x9')]=function(_0x10bf43,_0x465920){return _0x10bf43[_0xdc45('0xa')](_0xdc45('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19cd=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x5478e7,_0x2ebc3a){var _0x155b49=function(_0xe8a98b){while(--_0xe8a98b){_0x5478e7['push'](_0x5478e7['shift']());}};_0x155b49(++_0x2ebc3a);}(_0x19cd,0xf2));var _0xd19c=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x19cd[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0xd19c('0x0'));var util=require(_0xd19c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd19c('0x2'));var rp=require(_0xd19c('0x3'));var fs=require('fs');var path=require(_0xd19c('0x4'));var rimraf=require(_0xd19c('0x5'));var config=require(_0xd19c('0x6'));var attributes=require(_0xd19c('0x7'));module[_0xd19c('0x8')]=function(_0x4fc46f,_0x454964){return _0x4fc46f[_0xd19c('0x9')](_0xd19c('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index ce38708..e1a7ead 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf994=['http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x2bfa1b,_0x1985d2){var _0x1217a7=function(_0x31de68){while(--_0x31de68){_0x2bfa1b['push'](_0x2bfa1b['shift']());}};_0x1217a7(++_0x1985d2);}(_0xf994,0x66));var _0x4f99=function(_0x2d1343,_0x84096){_0x2d1343=_0x2d1343-0x0;var _0x30d5d8=_0xf994[_0x2d1343];return _0x30d5d8;};'use strict';var _=require(_0x4f99('0x0'));var util=require('util');var moment=require(_0x4f99('0x1'));var BPromise=require('bluebird');var rs=require(_0x4f99('0x2'));var fs=require('fs');var Redis=require(_0x4f99('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f99('0x4'));var logger=require(_0x4f99('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f99('0x6'));var client=jayson[_0x4f99('0x7')][_0x4f99('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29e3e7,_0x3704e9,_0x2c6257){return new BPromise(function(_0x3d0769,_0x55685e){return client[_0x4f99('0x9')](_0x29e3e7,_0x2c6257)[_0x4f99('0xa')](function(_0x31fd37){logger[_0x4f99('0xb')](_0x4f99('0xc'),_0x3704e9,_0x4f99('0xd'));logger[_0x4f99('0xe')](_0x4f99('0xf'),_0x3704e9,_0x4f99('0xd'),JSON[_0x4f99('0x10')](_0x31fd37));if(_0x31fd37[_0x4f99('0x11')]){if(_0x31fd37['error'][_0x4f99('0x12')]===0x1f4){logger['error'](_0x4f99('0xc'),_0x3704e9,_0x31fd37[_0x4f99('0x11')][_0x4f99('0x13')]);return _0x55685e(_0x31fd37[_0x4f99('0x11')]['message']);}logger[_0x4f99('0x11')](_0x4f99('0xc'),_0x3704e9,_0x31fd37['error']['message']);return _0x3d0769(_0x31fd37[_0x4f99('0x11')][_0x4f99('0x13')]);}else{logger[_0x4f99('0xb')](_0x4f99('0xc'),_0x3704e9,_0x4f99('0xd'));_0x3d0769(_0x31fd37[_0x4f99('0x14')][_0x4f99('0x13')]);}})[_0x4f99('0x15')](function(_0x2f1106){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x3704e9,_0x2f1106);_0x55685e(_0x2f1106);});});} \ No newline at end of file +var _0x3df4=['request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5f0d77,_0xfcbbb4){var _0x222f4f=function(_0x40fcd2){while(--_0x40fcd2){_0x5f0d77['push'](_0x5f0d77['shift']());}};_0x222f4f(++_0xfcbbb4);}(_0x3df4,0xe7));var _0x43df=function(_0x5ab4a3,_0x40c61f){_0x5ab4a3=_0x5ab4a3-0x0;var _0xd7bd1=_0x3df4[_0x5ab4a3];return _0xd7bd1;};'use strict';var _=require(_0x43df('0x0'));var util=require(_0x43df('0x1'));var moment=require('moment');var BPromise=require(_0x43df('0x2'));var rs=require(_0x43df('0x3'));var fs=require('fs');var Redis=require(_0x43df('0x4'));var db=require(_0x43df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x43df('0x6'))(_0x43df('0x7'));var config=require('../../config/environment');var jayson=require(_0x43df('0x8'));var client=jayson[_0x43df('0x9')][_0x43df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x269c9b,_0x401c17,_0x39772a){return new BPromise(function(_0x109ecd,_0x5f4297){return client[_0x43df('0xb')](_0x269c9b,_0x39772a)[_0x43df('0xc')](function(_0x236303){logger[_0x43df('0xd')](_0x43df('0xe'),_0x401c17,_0x43df('0xf'));logger[_0x43df('0x10')](_0x43df('0x11'),_0x401c17,'request\x20sent',JSON['stringify'](_0x236303));if(_0x236303['error']){if(_0x236303[_0x43df('0x12')][_0x43df('0x13')]===0x1f4){logger[_0x43df('0x12')](_0x43df('0xe'),_0x401c17,_0x236303[_0x43df('0x12')][_0x43df('0x14')]);return _0x5f4297(_0x236303[_0x43df('0x12')][_0x43df('0x14')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x401c17,_0x236303['error'][_0x43df('0x14')]);return _0x109ecd(_0x236303[_0x43df('0x12')][_0x43df('0x14')]);}else{logger['info'](_0x43df('0xe'),_0x401c17,_0x43df('0xf'));_0x109ecd(_0x236303[_0x43df('0x15')][_0x43df('0x14')]);}})['catch'](function(_0x3b7c74){logger[_0x43df('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x401c17,_0x3b7c74);_0x5f4297(_0x3b7c74);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index cd53a50..d578ea0 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2234=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports'];(function(_0x38b73e,_0x5b93f4){var _0x4bbfbd=function(_0x1b1e86){while(--_0x1b1e86){_0x38b73e['push'](_0x38b73e['shift']());}};_0x4bbfbd(++_0x5b93f4);}(_0x2234,0x18c));var _0x4223=function(_0xc9b988,_0x429150){_0xc9b988=_0xc9b988-0x0;var _0x5f14fe=_0x2234[_0xc9b988];return _0x5f14fe;};'use strict';var multer=require('multer');var util=require(_0x4223('0x0'));var path=require(_0x4223('0x1'));var timeout=require(_0x4223('0x2'));var express=require('express');var router=express[_0x4223('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4223('0x4'));var interaction=require(_0x4223('0x5'));var config=require(_0x4223('0x6'));var controller=require(_0x4223('0x7'));router[_0x4223('0x8')]('/',auth[_0x4223('0x9')](),controller[_0x4223('0xa')]);router[_0x4223('0x8')](_0x4223('0xb'),auth[_0x4223('0x9')](),controller[_0x4223('0xc')]);router[_0x4223('0xd')]('/',auth[_0x4223('0x9')](),controller[_0x4223('0xe')]);router[_0x4223('0xf')](_0x4223('0xb'),auth[_0x4223('0x9')](),controller['update']);router[_0x4223('0x10')](_0x4223('0xb'),auth[_0x4223('0x9')](),controller['destroy']);module[_0x4223('0x11')]=router; \ No newline at end of file +var _0x105d=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x105d,0xf2));var _0xd105=function(_0x1113dc,_0x188e4b){_0x1113dc=_0x1113dc-0x0;var _0x1ebf6e=_0x105d[_0x1113dc];return _0x1ebf6e;};'use strict';var multer=require(_0xd105('0x0'));var util=require(_0xd105('0x1'));var path=require(_0xd105('0x2'));var timeout=require(_0xd105('0x3'));var express=require(_0xd105('0x4'));var router=express[_0xd105('0x5')]();var fs_extra=require(_0xd105('0x6'));var auth=require(_0xd105('0x7'));var interaction=require(_0xd105('0x8'));var config=require(_0xd105('0x9'));var controller=require('./cmContactHasItem.controller');router[_0xd105('0xa')]('/',auth[_0xd105('0xb')](),controller[_0xd105('0xc')]);router['get'](_0xd105('0xd'),auth[_0xd105('0xb')](),controller[_0xd105('0xe')]);router[_0xd105('0xf')]('/',auth[_0xd105('0xb')](),controller['create']);router['put']('/:id',auth[_0xd105('0xb')](),controller[_0xd105('0x10')]);router[_0xd105('0x11')](_0xd105('0xd'),auth[_0xd105('0xb')](),controller[_0xd105('0x12')]);module[_0xd105('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 433094b..81ab2ab 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 _0xfa25=['BOOLEAN','voice','sequelize','exports','getDataValue','alias','STRING','setDataValue','long','type','select','values','isArray'];(function(_0xf89934,_0x1e8c65){var _0x4292f4=function(_0x40e3a8){while(--_0x40e3a8){_0xf89934['push'](_0xf89934['shift']());}};_0x4292f4(++_0x1e8c65);}(_0xfa25,0x6a));var _0x5fa2=function(_0x39149,_0x548a65){_0x39149=_0x39149-0x0;var _0x5a0f05=_0xfa25[_0x39149];return _0x5a0f05;};'use strict';var Sequelize=require(_0x5fa2('0x0'));var _=require('lodash');module[_0x5fa2('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x127510){return this[_0x5fa2('0x2')](_0x5fa2('0x3'));}},'alias':{'type':Sequelize[_0x5fa2('0x4')],'allowNull':![],'set':function(_0x87c5c9){this[_0x5fa2('0x5')]('alias',_0x87c5c9?_0x87c5c9:this[_0x5fa2('0x2')]('name'));}},'type':{'type':Sequelize[_0x5fa2('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x5fa2('0x6')),'get':function(){if(this[_0x5fa2('0x2')](_0x5fa2('0x7'))===_0x5fa2('0x8')){return JSON['parse'](this[_0x5fa2('0x2')](_0x5fa2('0x9')));}else{return this[_0x5fa2('0x2')](_0x5fa2('0x9'));}},'set':function(_0x46ecf1){if(Array[_0x5fa2('0xa')](_0x46ecf1)){this[_0x5fa2('0x5')](_0x5fa2('0x9'),JSON['stringify'](_0x46ecf1));}else{this[_0x5fa2('0x5')](_0x5fa2('0x9'),_0x46ecf1);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5fa2('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x5fa2('0xc'))}}; \ No newline at end of file +var _0x68ec=['type','parse','values','isArray','setDataValue','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','name','STRING','long'];(function(_0x564cf1,_0x59aa1d){var _0x2b5622=function(_0x5d264b){while(--_0x5d264b){_0x564cf1['push'](_0x564cf1['shift']());}};_0x2b5622(++_0x59aa1d);}(_0x68ec,0x198));var _0xc68e=function(_0x57b248,_0x2d5053){_0x57b248=_0x57b248-0x0;var _0x3a55f5=_0x68ec[_0x57b248];return _0x3a55f5;};'use strict';var Sequelize=require(_0xc68e('0x0'));var _=require('lodash');module[_0xc68e('0x1')]={'name':{'type':Sequelize[_0xc68e('0x2')],'get':function(_0x5c5048){return this[_0xc68e('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2392e7){this['setDataValue'](_0xc68e('0x4'),_0x2392e7?_0x2392e7:this[_0xc68e('0x3')](_0xc68e('0x5')));}},'type':{'type':Sequelize[_0xc68e('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xc68e('0x7')),'get':function(){if(this[_0xc68e('0x3')](_0xc68e('0x8'))==='select'){return JSON[_0xc68e('0x9')](this[_0xc68e('0x3')](_0xc68e('0xa')));}else{return this[_0xc68e('0x3')](_0xc68e('0xa'));}},'set':function(_0x2f94b0){if(Array[_0xc68e('0xb')](_0x2f94b0)){this['setDataValue'](_0xc68e('0xa'),JSON['stringify'](_0x2f94b0));}else{this[_0xc68e('0xc')](_0xc68e('0xa'),_0x2f94b0);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc68e('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc68e('0xe')](_0xc68e('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f58326b..46f3a9c 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 _0x8237=['findAll','rows','catch','show','params','include','options','body','find','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','merge'];(function(_0x4fec9f,_0x33cc0e){var _0x481749=function(_0x5bd5ea){while(--_0x5bd5ea){_0x4fec9f['push'](_0x4fec9f['shift']());}};_0x481749(++_0x33cc0e);}(_0x8237,0x117));var _0x7823=function(_0x223e57,_0x2ac299){_0x223e57=_0x223e57-0x0;var _0x32bd53=_0x8237[_0x223e57];return _0x32bd53;};'use strict';var emlformat=require(_0x7823('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7823('0x1'));var rp=require(_0x7823('0x2'));var moment=require('moment');var BPromise=require(_0x7823('0x3'));var Mustache=require(_0x7823('0x4'));var util=require(_0x7823('0x5'));var path=require('path');var sox=require(_0x7823('0x6'));var csv=require('to-csv');var ejs=require(_0x7823('0x7'));var fs=require('fs');var fs_extra=require(_0x7823('0x8'));var _=require('lodash');var squel=require(_0x7823('0x9'));var crypto=require(_0x7823('0xa'));var jsforce=require(_0x7823('0xb'));var deskjs=require(_0x7823('0xc'));var toCsv=require(_0x7823('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7823('0xe'));var authService=require(_0x7823('0xf'));var qs=require(_0x7823('0x10'));var as=require(_0x7823('0x11'));var hardwareService=require(_0x7823('0x12'));var logger=require('../../config/logger')(_0x7823('0x13'));var utils=require('../../config/utils');var config=require(_0x7823('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x177bf9,_0x5c732b){_0x5c732b=_0x5c732b||0xcc;return function(_0x41b052){if(_0x41b052){return _0x177bf9[_0x7823('0x15')](_0x5c732b);}return _0x177bf9[_0x7823('0x16')](_0x5c732b)['end']();};}function respondWithResult(_0x7b3d12,_0x2ca530){_0x2ca530=_0x2ca530||0xc8;return function(_0x25b4cb){if(_0x25b4cb){return _0x7b3d12[_0x7823('0x16')](_0x2ca530)[_0x7823('0x17')](_0x25b4cb);}};}function respondWithFilteredResult(_0x633e2a,_0x31005e){return function(_0x480b15){if(_0x480b15){var _0x1732e3=typeof _0x31005e[_0x7823('0x18')]===_0x7823('0x19')&&typeof _0x31005e['limit']===_0x7823('0x19');var _0x16792c=_0x480b15[_0x7823('0x1a')];var _0x5ae6c9=_0x1732e3?0x0:_0x31005e[_0x7823('0x18')];var _0x56caae=_0x1732e3?_0x480b15[_0x7823('0x1a')]:_0x31005e['offset']+_0x31005e[_0x7823('0x1b')];var _0xce9a92;if(_0x56caae>=_0x16792c){_0x56caae=_0x16792c;_0xce9a92=0xc8;}else{_0xce9a92=0xce;}_0x633e2a[_0x7823('0x16')](_0xce9a92);return _0x633e2a[_0x7823('0x1c')](_0x7823('0x1d'),_0x5ae6c9+'-'+_0x56caae+'/'+_0x16792c)[_0x7823('0x17')](_0x480b15);}return null;};}function patchUpdates(_0x37a9a2){return function(_0x476e70){try{jsonpatch[_0x7823('0x1e')](_0x476e70,_0x37a9a2,!![]);}catch(_0x472c05){return BPromise['reject'](_0x472c05);}return _0x476e70[_0x7823('0x1f')]();};}function saveUpdates(_0x4b82dd,_0x29bc41){return function(_0x5bd28e){if(_0x5bd28e){return _0x5bd28e[_0x7823('0x20')](_0x4b82dd)['then'](function(_0x1f4eca){return _0x1f4eca;});}return null;};}function removeEntity(_0x39a975,_0x1765f8){return function(_0x9b742d){if(_0x9b742d){return _0x9b742d[_0x7823('0x21')]()[_0x7823('0x22')](function(){_0x39a975[_0x7823('0x16')](0xcc)[_0x7823('0x23')]();});}};}function handleEntityNotFound(_0x5b3ec0,_0x330294){return function(_0x462cb5){if(!_0x462cb5){_0x5b3ec0[_0x7823('0x15')](0x194);}return _0x462cb5;};}function handleError(_0x11be3b,_0x2d6bea){_0x2d6bea=_0x2d6bea||0x1f4;return function(_0x32ffac){logger[_0x7823('0x24')](_0x32ffac[_0x7823('0x25')]);if(_0x32ffac['name']){delete _0x32ffac[_0x7823('0x26')];}_0x11be3b[_0x7823('0x16')](_0x2d6bea)[_0x7823('0x27')](_0x32ffac);};}exports[_0x7823('0x28')]=function(_0x361e23,_0x5298e0){var _0x2a4943={},_0xa63b16={},_0x355e89={'count':0x0,'rows':[]};var _0x70eed1=_[_0x7823('0x29')](db[_0x7823('0x2a')][_0x7823('0x2b')],function(_0x9d0620){return{'name':_0x9d0620[_0x7823('0x2c')],'type':_0x9d0620[_0x7823('0x2d')]['key']};});_0xa63b16[_0x7823('0x2e')]=_[_0x7823('0x2f')](_[_0x7823('0x29')](_0x70eed1,_0x7823('0x26')),[_0x7823('0x26')]);_0xa63b16[_0x7823('0x30')]=_[_0x7823('0x31')](_0x361e23[_0x7823('0x30')]);_0xa63b16[_0x7823('0x32')]=_[_0x7823('0x33')](_0xa63b16['model'],_0xa63b16['query']);_0x2a4943[_0x7823('0x34')]=_[_0x7823('0x33')](_0xa63b16['model'],qs[_0x7823('0x35')](_0x361e23[_0x7823('0x30')][_0x7823('0x35')]));_0x2a4943['attributes']=_0x2a4943[_0x7823('0x34')][_0x7823('0x36')]?_0x2a4943[_0x7823('0x34')]:_0xa63b16[_0x7823('0x2e')];if(!_0x361e23['query'][_0x7823('0x37')]('nolimit')){_0x2a4943[_0x7823('0x1b')]=qs[_0x7823('0x1b')](_0x361e23[_0x7823('0x30')][_0x7823('0x1b')]);_0x2a4943[_0x7823('0x18')]=qs[_0x7823('0x18')](_0x361e23[_0x7823('0x30')][_0x7823('0x18')]);}_0x2a4943['order']=qs[_0x7823('0x38')](_0x361e23[_0x7823('0x30')]['sort']);_0x2a4943[_0x7823('0x39')]=qs[_0x7823('0x32')](_[_0x7823('0x3a')](_0x361e23[_0x7823('0x30')],_0xa63b16[_0x7823('0x32')]),_0x70eed1);if(_0x361e23[_0x7823('0x30')]['filter']){_0x2a4943['where']=_['merge'](_0x2a4943[_0x7823('0x39')],{'$or':_['map'](_0x70eed1,function(_0x3fd43b){if(_0x3fd43b[_0x7823('0x2d')]!==_0x7823('0x3b')){var _0x5a6e1b={};_0x5a6e1b[_0x3fd43b[_0x7823('0x26')]]={'$like':'%'+_0x361e23[_0x7823('0x30')]['filter']+'%'};return _0x5a6e1b;}})});}_0x2a4943=_[_0x7823('0x3c')]({},_0x2a4943,_0x361e23['options']);var _0x1b27fe={'where':_0x2a4943['where']};return db[_0x7823('0x2a')][_0x7823('0x1a')](_0x1b27fe)[_0x7823('0x22')](function(_0x37f427){_0x355e89[_0x7823('0x1a')]=_0x37f427;if(_0x361e23[_0x7823('0x30')]['includeAll']){_0x2a4943['include']=[{'all':!![]}];}return db[_0x7823('0x2a')][_0x7823('0x3d')](_0x2a4943);})[_0x7823('0x22')](function(_0xf1ce07){_0x355e89[_0x7823('0x3e')]=_0xf1ce07;return _0x355e89;})[_0x7823('0x22')](respondWithFilteredResult(_0x5298e0,_0x2a4943))[_0x7823('0x3f')](handleError(_0x5298e0,null));};exports[_0x7823('0x40')]=function(_0x23cf50,_0x26e132){var _0x42fa85={'raw':!![],'where':{'id':_0x23cf50[_0x7823('0x41')]['id']}},_0x3956bf={};_0x3956bf[_0x7823('0x2e')]=_['keys'](db[_0x7823('0x2a')][_0x7823('0x2b')]);_0x3956bf['query']=_['keys'](_0x23cf50[_0x7823('0x30')]);_0x3956bf['filters']=_[_0x7823('0x33')](_0x3956bf[_0x7823('0x2e')],_0x3956bf[_0x7823('0x30')]);_0x42fa85[_0x7823('0x34')]=_[_0x7823('0x33')](_0x3956bf['model'],qs[_0x7823('0x35')](_0x23cf50[_0x7823('0x30')][_0x7823('0x35')]));_0x42fa85[_0x7823('0x34')]=_0x42fa85[_0x7823('0x34')]['length']?_0x42fa85[_0x7823('0x34')]:_0x3956bf[_0x7823('0x2e')];if(_0x23cf50[_0x7823('0x30')]['includeAll']){_0x42fa85[_0x7823('0x42')]=[{'all':!![]}];}_0x42fa85=_[_0x7823('0x3c')]({},_0x42fa85,_0x23cf50[_0x7823('0x43')]);return db[_0x7823('0x2a')]['find'](_0x42fa85)[_0x7823('0x22')](handleEntityNotFound(_0x26e132,null))[_0x7823('0x22')](respondWithResult(_0x26e132,null))[_0x7823('0x3f')](handleError(_0x26e132,null));};exports[_0x7823('0x20')]=function(_0x5a15f2,_0x4c2d8b){if(_0x5a15f2[_0x7823('0x44')]['id']){delete _0x5a15f2['body']['id'];}return db[_0x7823('0x2a')]['find']({'where':{'id':_0x5a15f2['params']['id']}})[_0x7823('0x22')](handleEntityNotFound(_0x4c2d8b,null))[_0x7823('0x22')](saveUpdates(_0x5a15f2[_0x7823('0x44')],null))[_0x7823('0x22')](respondWithResult(_0x4c2d8b,null))[_0x7823('0x3f')](handleError(_0x4c2d8b,null));};exports['destroy']=function(_0x4791fc,_0x25f854){return db['CmCustomField'][_0x7823('0x45')]({'where':{'id':_0x4791fc[_0x7823('0x41')]['id']}})[_0x7823('0x22')](handleEntityNotFound(_0x25f854,null))[_0x7823('0x22')](removeEntity(_0x25f854,null))[_0x7823('0x3f')](handleError(_0x25f854,null));};exports[_0x7823('0x46')]=function(_0x3bbd40,_0x166e85){var _0x3a2dc5;return db[_0x7823('0x47')]['transaction'](function(_0x1adfdf){return db[_0x7823('0x2a')][_0x7823('0x46')](_0x3bbd40['body'],{'transaction':_0x1adfdf})[_0x7823('0x22')](function(_0x1ba15d){_0x3a2dc5=_0x1ba15d;var _0x59cfd0={'type':db[_0x7823('0x48')][_0x7823('0x49')],'transaction':_0x1adfdf};switch(_0x3bbd40[_0x7823('0x44')]['type']){case _0x7823('0x4a'):_0x59cfd0[_0x7823('0x2d')]=db[_0x7823('0x48')][_0x7823('0x49')];break;case _0x7823('0x4b'):_0x59cfd0[_0x7823('0x2d')]=db['Sequelize'][_0x7823('0x4c')];break;case _0x7823('0x4d'):_0x59cfd0[_0x7823('0x2d')]=db[_0x7823('0x48')][_0x7823('0x4e')];_0x59cfd0[_0x7823('0x4f')]=![];break;default:}return db[_0x7823('0x47')][_0x7823('0x50')][_0x7823('0x51')](_0x7823('0x52'),util[_0x7823('0x53')](_0x7823('0x54'),_0x3a2dc5['id']),_0x59cfd0);})[_0x7823('0x22')](function(){return _0x3a2dc5;});})[_0x7823('0x22')](respondWithResult(_0x166e85,0xc9))[_0x7823('0x3f')](handleError(_0x166e85,null));}; \ No newline at end of file +var _0xbe14=['reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','CmCustomField','includeAll','include','rows','catch','show','params','update','body','find','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json'];(function(_0x168fc1,_0x7218ae){var _0x13850b=function(_0x4229e0){while(--_0x4229e0){_0x168fc1['push'](_0x168fc1['shift']());}};_0x13850b(++_0x7218ae);}(_0xbe14,0xe4));var _0x4be1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbe14[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x4be1('0x0'));var rimraf=require(_0x4be1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4be1('0x2'));var moment=require(_0x4be1('0x3'));var BPromise=require(_0x4be1('0x4'));var Mustache=require(_0x4be1('0x5'));var util=require(_0x4be1('0x6'));var path=require('path');var sox=require(_0x4be1('0x7'));var csv=require(_0x4be1('0x8'));var ejs=require(_0x4be1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4be1('0xa'));var crypto=require(_0x4be1('0xb'));var jsforce=require(_0x4be1('0xc'));var deskjs=require(_0x4be1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4be1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4be1('0xf'));var qs=require(_0x4be1('0x10'));var as=require(_0x4be1('0x11'));var hardwareService=require(_0x4be1('0x12'));var logger=require(_0x4be1('0x13'))(_0x4be1('0x14'));var utils=require('../../config/utils');var config=require(_0x4be1('0x15'));var licenseUtil=require(_0x4be1('0x16'));var db=require(_0x4be1('0x17'))['db'];function respondWithStatusCode(_0x3a81c0,_0x1300f0){_0x1300f0=_0x1300f0||0xcc;return function(_0x10b461){if(_0x10b461){return _0x3a81c0[_0x4be1('0x18')](_0x1300f0);}return _0x3a81c0[_0x4be1('0x19')](_0x1300f0)[_0x4be1('0x1a')]();};}function respondWithResult(_0x2a4b90,_0xd7d4aa){_0xd7d4aa=_0xd7d4aa||0xc8;return function(_0x33d770){if(_0x33d770){return _0x2a4b90[_0x4be1('0x19')](_0xd7d4aa)['json'](_0x33d770);}};}function respondWithFilteredResult(_0x1f58bd,_0x4b41dc){return function(_0x289cbe){if(_0x289cbe){var _0x356abb=typeof _0x4b41dc['offset']===_0x4be1('0x1b')&&typeof _0x4b41dc[_0x4be1('0x1c')]==='undefined';var _0x5c6991=_0x289cbe[_0x4be1('0x1d')];var _0x21c69c=_0x356abb?0x0:_0x4b41dc[_0x4be1('0x1e')];var _0x2c5cba=_0x356abb?_0x289cbe['count']:_0x4b41dc[_0x4be1('0x1e')]+_0x4b41dc[_0x4be1('0x1c')];var _0x4b3ca4;if(_0x2c5cba>=_0x5c6991){_0x2c5cba=_0x5c6991;_0x4b3ca4=0xc8;}else{_0x4b3ca4=0xce;}_0x1f58bd[_0x4be1('0x19')](_0x4b3ca4);return _0x1f58bd['set'](_0x4be1('0x1f'),_0x21c69c+'-'+_0x2c5cba+'/'+_0x5c6991)[_0x4be1('0x20')](_0x289cbe);}return null;};}function patchUpdates(_0x220008){return function(_0x1fc284){try{jsonpatch['apply'](_0x1fc284,_0x220008,!![]);}catch(_0x282c58){return BPromise[_0x4be1('0x21')](_0x282c58);}return _0x1fc284[_0x4be1('0x22')]();};}function saveUpdates(_0xc15ab4,_0x186267){return function(_0x332c07){if(_0x332c07){return _0x332c07['update'](_0xc15ab4)[_0x4be1('0x23')](function(_0x328a65){return _0x328a65;});}return null;};}function removeEntity(_0x557549,_0x4f3cc7){return function(_0x33d2e1){if(_0x33d2e1){return _0x33d2e1[_0x4be1('0x24')]()[_0x4be1('0x23')](function(){_0x557549[_0x4be1('0x19')](0xcc)[_0x4be1('0x1a')]();});}};}function handleEntityNotFound(_0x422ada,_0x5acfcd){return function(_0x10b004){if(!_0x10b004){_0x422ada[_0x4be1('0x18')](0x194);}return _0x10b004;};}function handleError(_0x4f56ba,_0x5b95d7){_0x5b95d7=_0x5b95d7||0x1f4;return function(_0x45f93c){logger[_0x4be1('0x25')](_0x45f93c['stack']);if(_0x45f93c[_0x4be1('0x26')]){delete _0x45f93c[_0x4be1('0x26')];}_0x4f56ba[_0x4be1('0x19')](_0x5b95d7)[_0x4be1('0x27')](_0x45f93c);};}exports[_0x4be1('0x28')]=function(_0x36f8c7,_0x411d46){var _0x1959a={},_0x12c5be={},_0x301b90={'count':0x0,'rows':[]};var _0x59f9ef=_[_0x4be1('0x29')](db['CmCustomField'][_0x4be1('0x2a')],function(_0x53de0b){return{'name':_0x53de0b[_0x4be1('0x2b')],'type':_0x53de0b[_0x4be1('0x2c')][_0x4be1('0x2d')]};});_0x12c5be[_0x4be1('0x2e')]=_[_0x4be1('0x2f')](_[_0x4be1('0x29')](_0x59f9ef,_0x4be1('0x26')),[_0x4be1('0x26')]);_0x12c5be['query']=_[_0x4be1('0x30')](_0x36f8c7[_0x4be1('0x31')]);_0x12c5be['filters']=_[_0x4be1('0x32')](_0x12c5be[_0x4be1('0x2e')],_0x12c5be[_0x4be1('0x31')]);_0x1959a[_0x4be1('0x33')]=_[_0x4be1('0x32')](_0x12c5be['model'],qs[_0x4be1('0x34')](_0x36f8c7[_0x4be1('0x31')][_0x4be1('0x34')]));_0x1959a[_0x4be1('0x33')]=_0x1959a[_0x4be1('0x33')][_0x4be1('0x35')]?_0x1959a[_0x4be1('0x33')]:_0x12c5be[_0x4be1('0x2e')];if(!_0x36f8c7[_0x4be1('0x31')][_0x4be1('0x36')](_0x4be1('0x37'))){_0x1959a[_0x4be1('0x1c')]=qs[_0x4be1('0x1c')](_0x36f8c7[_0x4be1('0x31')][_0x4be1('0x1c')]);_0x1959a[_0x4be1('0x1e')]=qs[_0x4be1('0x1e')](_0x36f8c7[_0x4be1('0x31')]['offset']);}_0x1959a[_0x4be1('0x38')]=qs[_0x4be1('0x39')](_0x36f8c7['query'][_0x4be1('0x39')]);_0x1959a['where']=qs[_0x4be1('0x3a')](_[_0x4be1('0x3b')](_0x36f8c7['query'],_0x12c5be[_0x4be1('0x3a')]),_0x59f9ef);if(_0x36f8c7['query'][_0x4be1('0x3c')]){_0x1959a[_0x4be1('0x3d')]=_[_0x4be1('0x3e')](_0x1959a[_0x4be1('0x3d')],{'$or':_[_0x4be1('0x29')](_0x59f9ef,function(_0x43bb3e){if(_0x43bb3e[_0x4be1('0x2c')]!==_0x4be1('0x3f')){var _0x106d55={};_0x106d55[_0x43bb3e['name']]={'$like':'%'+_0x36f8c7[_0x4be1('0x31')]['filter']+'%'};return _0x106d55;}})});}_0x1959a=_[_0x4be1('0x3e')]({},_0x1959a,_0x36f8c7['options']);var _0x309428={'where':_0x1959a[_0x4be1('0x3d')]};return db[_0x4be1('0x40')][_0x4be1('0x1d')](_0x309428)['then'](function(_0x1662e1){_0x301b90[_0x4be1('0x1d')]=_0x1662e1;if(_0x36f8c7['query'][_0x4be1('0x41')]){_0x1959a[_0x4be1('0x42')]=[{'all':!![]}];}return db[_0x4be1('0x40')]['findAll'](_0x1959a);})[_0x4be1('0x23')](function(_0xf3a7fe){_0x301b90[_0x4be1('0x43')]=_0xf3a7fe;return _0x301b90;})[_0x4be1('0x23')](respondWithFilteredResult(_0x411d46,_0x1959a))[_0x4be1('0x44')](handleError(_0x411d46,null));};exports[_0x4be1('0x45')]=function(_0x11207,_0x3e0ffc){var _0x53889b={'raw':!![],'where':{'id':_0x11207[_0x4be1('0x46')]['id']}},_0x231370={};_0x231370[_0x4be1('0x2e')]=_[_0x4be1('0x30')](db[_0x4be1('0x40')][_0x4be1('0x2a')]);_0x231370['query']=_['keys'](_0x11207['query']);_0x231370[_0x4be1('0x3a')]=_[_0x4be1('0x32')](_0x231370['model'],_0x231370[_0x4be1('0x31')]);_0x53889b[_0x4be1('0x33')]=_[_0x4be1('0x32')](_0x231370['model'],qs['fields'](_0x11207[_0x4be1('0x31')][_0x4be1('0x34')]));_0x53889b[_0x4be1('0x33')]=_0x53889b['attributes'][_0x4be1('0x35')]?_0x53889b['attributes']:_0x231370[_0x4be1('0x2e')];if(_0x11207[_0x4be1('0x31')][_0x4be1('0x41')]){_0x53889b[_0x4be1('0x42')]=[{'all':!![]}];}_0x53889b=_[_0x4be1('0x3e')]({},_0x53889b,_0x11207['options']);return db['CmCustomField']['find'](_0x53889b)[_0x4be1('0x23')](handleEntityNotFound(_0x3e0ffc,null))[_0x4be1('0x23')](respondWithResult(_0x3e0ffc,null))[_0x4be1('0x44')](handleError(_0x3e0ffc,null));};exports[_0x4be1('0x47')]=function(_0x237c23,_0x5f12b4){if(_0x237c23[_0x4be1('0x48')]['id']){delete _0x237c23[_0x4be1('0x48')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x237c23['params']['id']}})[_0x4be1('0x23')](handleEntityNotFound(_0x5f12b4,null))['then'](saveUpdates(_0x237c23[_0x4be1('0x48')],null))[_0x4be1('0x23')](respondWithResult(_0x5f12b4,null))[_0x4be1('0x44')](handleError(_0x5f12b4,null));};exports[_0x4be1('0x24')]=function(_0x3ae33e,_0x11cda5){return db['CmCustomField'][_0x4be1('0x49')]({'where':{'id':_0x3ae33e['params']['id']}})[_0x4be1('0x23')](handleEntityNotFound(_0x11cda5,null))['then'](removeEntity(_0x11cda5,null))[_0x4be1('0x44')](handleError(_0x11cda5,null));};exports[_0x4be1('0x4a')]=function(_0xb613cf,_0x63cfa0){var _0x2c6a15;return db['sequelize'][_0x4be1('0x4b')](function(_0x25b67e){return db[_0x4be1('0x40')][_0x4be1('0x4a')](_0xb613cf[_0x4be1('0x48')],{'transaction':_0x25b67e})[_0x4be1('0x23')](function(_0x15a2ae){_0x2c6a15=_0x15a2ae;var _0xae8f7d={'type':db[_0x4be1('0x4c')][_0x4be1('0x4d')],'transaction':_0x25b67e};switch(_0xb613cf[_0x4be1('0x48')][_0x4be1('0x2c')]){case _0x4be1('0x4e'):_0xae8f7d[_0x4be1('0x2c')]=db['Sequelize'][_0x4be1('0x4d')];break;case _0x4be1('0x4f'):_0xae8f7d['type']=db[_0x4be1('0x4c')][_0x4be1('0x50')];break;case _0x4be1('0x51'):_0xae8f7d[_0x4be1('0x2c')]=db[_0x4be1('0x4c')][_0x4be1('0x52')];_0xae8f7d[_0x4be1('0x53')]=![];break;default:}return db['sequelize']['queryInterface'][_0x4be1('0x54')](_0x4be1('0x55'),util['format'](_0x4be1('0x56'),_0x2c6a15['id']),_0xae8f7d);})[_0x4be1('0x23')](function(){return _0x2c6a15;});})['then'](respondWithResult(_0x63cfa0,0xc9))['catch'](handleError(_0x63cfa0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 338d332..7ce6960 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 _0x57db=['./cmCustomField.attributes','define','lodash','util','../../config/logger','api','moment','../../config/environment'];(function(_0x2598da,_0x323754){var _0x196ba0=function(_0x254836){while(--_0x254836){_0x2598da['push'](_0x2598da['shift']());}};_0x196ba0(++_0x323754);}(_0x57db,0x152));var _0xb57d=function(_0x5a4d52,_0x5e5882){_0x5a4d52=_0x5a4d52-0x0;var _0x27063d=_0x57db[_0x5a4d52];return _0x27063d;};'use strict';var _=require(_0xb57d('0x0'));var util=require(_0xb57d('0x1'));var logger=require(_0xb57d('0x2'))(_0xb57d('0x3'));var moment=require(_0xb57d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb57d('0x5'));var attributes=require(_0xb57d('0x6'));module['exports']=function(_0x19162a,_0x4e5996){return _0x19162a[_0xb57d('0x7')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab93=['./cmCustomField.attributes','define','CmCustomField','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1ddda0,_0x354966){var _0x110aea=function(_0x89b271){while(--_0x89b271){_0x1ddda0['push'](_0x1ddda0['shift']());}};_0x110aea(++_0x354966);}(_0xab93,0x1b1));var _0x3ab9=function(_0x24d272,_0x306ff6){_0x24d272=_0x24d272-0x0;var _0x452729=_0xab93[_0x24d272];return _0x452729;};'use strict';var _=require('lodash');var util=require(_0x3ab9('0x0'));var logger=require('../../config/logger')(_0x3ab9('0x1'));var moment=require('moment');var BPromise=require(_0x3ab9('0x2'));var rp=require(_0x3ab9('0x3'));var fs=require('fs');var path=require(_0x3ab9('0x4'));var rimraf=require(_0x3ab9('0x5'));var config=require(_0x3ab9('0x6'));var attributes=require(_0x3ab9('0x7'));module['exports']=function(_0x26e624,_0x4cbc88){return _0x26e624[_0x3ab9('0x8')](_0x3ab9('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index fb09725..b00518e 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 _0x8cdf=['jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31a871,_0x455b03){var _0x18d7aa=function(_0x14e8f2){while(--_0x14e8f2){_0x31a871['push'](_0x31a871['shift']());}};_0x18d7aa(++_0x455b03);}(_0x8cdf,0x147));var _0xf8cd=function(_0x1737e5,_0x146b76){_0x1737e5=_0x1737e5-0x0;var _0x5d88e4=_0x8cdf[_0x1737e5];return _0x5d88e4;};'use strict';var _=require(_0xf8cd('0x0'));var util=require(_0xf8cd('0x1'));var moment=require(_0xf8cd('0x2'));var BPromise=require(_0xf8cd('0x3'));var rs=require(_0xf8cd('0x4'));var fs=require('fs');var Redis=require(_0xf8cd('0x5'));var db=require(_0xf8cd('0x6'))['db'];var utils=require(_0xf8cd('0x7'));var logger=require(_0xf8cd('0x8'))(_0xf8cd('0x9'));var config=require(_0xf8cd('0xa'));var jayson=require(_0xf8cd('0xb'));var client=jayson[_0xf8cd('0xc')][_0xf8cd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x8d4f12,_0xb7e575,_0x3c58b5){return new BPromise(function(_0x1f26e7,_0x4776b2){return client[_0xf8cd('0xe')](_0x8d4f12,_0x3c58b5)[_0xf8cd('0xf')](function(_0x4058cd){logger['info'](_0xf8cd('0x10'),_0xb7e575,_0xf8cd('0x11'));logger[_0xf8cd('0x12')](_0xf8cd('0x13'),_0xb7e575,_0xf8cd('0x11'),JSON['stringify'](_0x4058cd));if(_0x4058cd['error']){if(_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x15')]===0x1f4){logger[_0xf8cd('0x14')]('CmCustomField,\x20%s,\x20%s',_0xb7e575,_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x16')]);return _0x4776b2(_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x16')]);}logger[_0xf8cd('0x14')](_0xf8cd('0x10'),_0xb7e575,_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x16')]);return _0x1f26e7(_0x4058cd[_0xf8cd('0x14')][_0xf8cd('0x16')]);}else{logger[_0xf8cd('0x17')](_0xf8cd('0x10'),_0xb7e575,_0xf8cd('0x11'));_0x1f26e7(_0x4058cd[_0xf8cd('0x18')][_0xf8cd('0x16')]);}})[_0xf8cd('0x19')](function(_0x22ec03){logger[_0xf8cd('0x14')](_0xf8cd('0x10'),_0xb7e575,_0x22ec03);_0x4776b2(_0x22ec03);});});} \ No newline at end of file +var _0x7310=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','util'];(function(_0x873d48,_0x3cf3c0){var _0x50c8ca=function(_0x954fd0){while(--_0x954fd0){_0x873d48['push'](_0x873d48['shift']());}};_0x50c8ca(++_0x3cf3c0);}(_0x7310,0x117));var _0x0731=function(_0x1e50bf,_0x336435){_0x1e50bf=_0x1e50bf-0x0;var _0x29da19=_0x7310[_0x1e50bf];return _0x29da19;};'use strict';var _=require('lodash');var util=require(_0x0731('0x0'));var moment=require(_0x0731('0x1'));var BPromise=require('bluebird');var rs=require(_0x0731('0x2'));var fs=require('fs');var Redis=require(_0x0731('0x3'));var db=require(_0x0731('0x4'))['db'];var utils=require(_0x0731('0x5'));var logger=require(_0x0731('0x6'))('rpc');var config=require(_0x0731('0x7'));var jayson=require(_0x0731('0x8'));var client=jayson[_0x0731('0x9')][_0x0731('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d39b8,_0x33dfb0,_0x2281b9){return new BPromise(function(_0x52bc25,_0x5f6a2f){return client[_0x0731('0xb')](_0x5d39b8,_0x2281b9)['then'](function(_0x71ed67){logger[_0x0731('0xc')](_0x0731('0xd'),_0x33dfb0,'request\x20sent');logger[_0x0731('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x33dfb0,'request\x20sent',JSON['stringify'](_0x71ed67));if(_0x71ed67[_0x0731('0xf')]){if(_0x71ed67[_0x0731('0xf')][_0x0731('0x10')]===0x1f4){logger[_0x0731('0xf')]('CmCustomField,\x20%s,\x20%s',_0x33dfb0,_0x71ed67[_0x0731('0xf')][_0x0731('0x11')]);return _0x5f6a2f(_0x71ed67[_0x0731('0xf')][_0x0731('0x11')]);}logger[_0x0731('0xf')](_0x0731('0xd'),_0x33dfb0,_0x71ed67[_0x0731('0xf')][_0x0731('0x11')]);return _0x52bc25(_0x71ed67[_0x0731('0xf')][_0x0731('0x11')]);}else{logger[_0x0731('0xc')](_0x0731('0xd'),_0x33dfb0,_0x0731('0x12'));_0x52bc25(_0x71ed67[_0x0731('0x13')][_0x0731('0x11')]);}})['catch'](function(_0x2e8090){logger[_0x0731('0xf')](_0x0731('0xd'),_0x33dfb0,_0x2e8090);_0x5f6a2f(_0x2e8090);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 98a09fa..6230c0f 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 _0x7579=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','post','create','/:id','update','delete'];(function(_0x578db0,_0x5dca17){var _0x135d83=function(_0x17890d){while(--_0x17890d){_0x578db0['push'](_0x578db0['shift']());}};_0x135d83(++_0x5dca17);}(_0x7579,0x1e2));var _0x9757=function(_0x13b4c4,_0x1e4734){_0x13b4c4=_0x13b4c4-0x0;var _0x52cff0=_0x7579[_0x13b4c4];return _0x52cff0;};'use strict';var multer=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var path=require(_0x9757('0x2'));var timeout=require(_0x9757('0x3'));var express=require(_0x9757('0x4'));var router=express[_0x9757('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9757('0x6'));var interaction=require(_0x9757('0x7'));var config=require(_0x9757('0x8'));var controller=require(_0x9757('0x9'));router['get']('/',auth[_0x9757('0xa')](),controller[_0x9757('0xb')]);router[_0x9757('0xc')]('/:id',auth[_0x9757('0xa')](),controller['show']);router[_0x9757('0xd')]('/',auth[_0x9757('0xa')](),controller[_0x9757('0xe')]);router['put'](_0x9757('0xf'),auth[_0x9757('0xa')](),controller[_0x9757('0x10')]);router[_0x9757('0x11')](_0x9757('0xf'),auth[_0x9757('0xa')](),controller[_0x9757('0x12')]);module[_0x9757('0x13')]=router; \ No newline at end of file +var _0x2a9b=['index','create','put','/:id','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0x168c36,_0x18598d){var _0x50e5db=function(_0x43ca6b){while(--_0x43ca6b){_0x168c36['push'](_0x168c36['shift']());}};_0x50e5db(++_0x18598d);}(_0x2a9b,0x14b));var _0xb2a9=function(_0xa0113c,_0x1aa0be){_0xa0113c=_0xa0113c-0x0;var _0x2d96a4=_0x2a9b[_0xa0113c];return _0x2d96a4;};'use strict';var multer=require('multer');var util=require(_0xb2a9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb2a9('0x1'));var router=express[_0xb2a9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb2a9('0x3'));var interaction=require(_0xb2a9('0x4'));var config=require(_0xb2a9('0x5'));var controller=require(_0xb2a9('0x6'));router[_0xb2a9('0x7')]('/',auth[_0xb2a9('0x8')](),controller[_0xb2a9('0x9')]);router[_0xb2a9('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb2a9('0xa')]);router[_0xb2a9('0xb')](_0xb2a9('0xc'),auth[_0xb2a9('0x8')](),controller[_0xb2a9('0xd')]);router[_0xb2a9('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb2a9('0xf')]);module[_0xb2a9('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 14a04b4..84e9cfc 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 _0xcb14=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','exports','STRING','BOOLEAN'];(function(_0x3d3458,_0x2bb392){var _0x902073=function(_0x188b92){while(--_0x188b92){_0x3d3458['push'](_0x3d3458['shift']());}};_0x902073(++_0x2bb392);}(_0xcb14,0x1e2));var _0x4cb1=function(_0x46753c,_0x1d8501){_0x46753c=_0x46753c-0x0;var _0x5edd01=_0xcb14[_0x46753c];return _0x5edd01;};'use strict';var moment=require(_0x4cb1('0x0'));var Sequelize=require('sequelize');module[_0x4cb1('0x1')]={'phone':{'type':Sequelize[_0x4cb1('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x4cb1('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4cb1('0x4')],'defaultValue':moment()[_0x4cb1('0x5')](_0x4cb1('0x6'))},'countbusyretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4cb1('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x4cb1('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4cb1('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4cb1('0x7')],'unique':_0x4cb1('0x8')},'ListId':{'type':Sequelize[_0x4cb1('0x7')],'unique':_0x4cb1('0x8')},'UserId':{'type':Sequelize[_0x4cb1('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4cb1('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4cb1('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4cb1('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4cb1('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xf717=['STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports'];(function(_0x2a2029,_0x29d5cb){var _0x3dd557=function(_0x17cdce){while(--_0x17cdce){_0x2a2029['push'](_0x2a2029['shift']());}};_0x3dd557(++_0x29d5cb);}(_0xf717,0xe8));var _0x7f71=function(_0x47707a,_0x4f7d3d){_0x47707a=_0x47707a-0x0;var _0x28c05b=_0xf717[_0x47707a];return _0x28c05b;};'use strict';var moment=require(_0x7f71('0x0'));var Sequelize=require('sequelize');module[_0x7f71('0x1')]={'phone':{'type':Sequelize[_0x7f71('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x7f71('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7f71('0x4')],'defaultValue':moment()['format'](_0x7f71('0x5'))},'countbusyretry':{'type':Sequelize[_0x7f71('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7f71('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7f71('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7f71('0x4')]},'priority':{'type':Sequelize[_0x7f71('0x6')](0x2)[_0x7f71('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7f71('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7f71('0x6')],'unique':_0x7f71('0x8')},'ListId':{'type':Sequelize[_0x7f71('0x6')],'unique':_0x7f71('0x8')},'UserId':{'type':Sequelize[_0x7f71('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x7f71('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x7f71('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7f71('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7f71('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7f71('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7f71('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7f71('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x7f71('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 21ed8a4..b023fab 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 _0xc03e=['options','includeAll','include','findAll','rows','catch','show','find','create','params','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','LOCK','UPDATE','CmCompany','CmList','List','getPreviewRecall','findOne','scheduledat','Company','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','../../config/logger','../../config/environment','status','json','undefined','limit','offset','count','Content-Range','update','then','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL'];(function(_0x5e33f6,_0x36c590){var _0x1eefe7=function(_0xa14c10){while(--_0xa14c10){_0x5e33f6['push'](_0x5e33f6['shift']());}};_0x1eefe7(++_0x36c590);}(_0xc03e,0x15a));var _0xec03=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0xc03e[_0x328b40];return _0x556a56;};'use strict';var moment=require(_0xec03('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xec03('0x1'))('api');var shared=require(_0xec03('0x2'));var db=require('../../mysqldb')['db'];function respondWithResult(_0xfed10f,_0x269001){_0x269001=_0x269001||0xc8;return function(_0x3e3a78){if(_0x3e3a78){return _0xfed10f[_0xec03('0x3')](_0x269001)[_0xec03('0x4')](_0x3e3a78);}};}function respondWithFilteredResult(_0x1ce78a,_0x31db21){return function(_0xcaaf03){if(_0xcaaf03){var _0x278f90=typeof _0x31db21['offset']===_0xec03('0x5')&&typeof _0x31db21[_0xec03('0x6')]===_0xec03('0x5');var _0x3959b4=_0xcaaf03['count'];var _0x375e4a=_0x278f90?0x0:_0x31db21[_0xec03('0x7')];var _0x2d8711=_0x278f90?_0xcaaf03[_0xec03('0x8')]:_0x31db21[_0xec03('0x7')]+_0x31db21[_0xec03('0x6')];var _0x2c81b3;if(_0x2d8711>=_0x3959b4){_0x2d8711=_0x3959b4;_0x2c81b3=0xc8;}else{_0x2c81b3=0xce;}_0x1ce78a[_0xec03('0x3')](_0x2c81b3);return _0x1ce78a['set'](_0xec03('0x9'),_0x375e4a+'-'+_0x2d8711+'/'+_0x3959b4)[_0xec03('0x4')](_0xcaaf03);}return null;};}function saveUpdates(_0x398720,_0x2f65a1){return function(_0x9908ef){if(_0x9908ef){return _0x9908ef[_0xec03('0xa')](_0x398720)[_0xec03('0xb')](function(_0x9a818f){return _0x9a818f;});}return null;};}function handleEntityNotFound(_0x4ba43a,_0x555447){return function(_0x5ca0e2){if(!_0x5ca0e2){_0x4ba43a[_0xec03('0xc')](0x194);}return _0x5ca0e2;};}function handleError(_0x2d177e,_0x3501ab){_0x3501ab=_0x3501ab||0x1f4;return function(_0x515680){logger[_0xec03('0xd')](_0x515680[_0xec03('0xe')]);if(_0x515680[_0xec03('0xf')]){delete _0x515680[_0xec03('0xf')];}_0x2d177e['status'](_0x3501ab)[_0xec03('0x10')](_0x515680);};}exports['index']=function(_0x46a669,_0x5e8ae2){var _0x25292d={},_0x5b3e04={},_0x57dc2d={'count':0x0,'rows':[]};var _0x26f431=_[_0xec03('0x11')](db[_0xec03('0x12')][_0xec03('0x13')],function(_0x4b9df8){return{'name':_0x4b9df8[_0xec03('0x14')],'type':_0x4b9df8['type'][_0xec03('0x15')]};});_0x5b3e04[_0xec03('0x16')]=_[_0xec03('0x11')](_0x26f431,_0xec03('0xf'));_0x5b3e04[_0xec03('0x17')]=_[_0xec03('0x18')](_0x46a669[_0xec03('0x17')]);_0x5b3e04[_0xec03('0x19')]=_['intersection'](_0x5b3e04[_0xec03('0x16')],_0x5b3e04[_0xec03('0x17')]);_0x5b3e04[_0xec03('0x19')]=_[_0xec03('0x1a')](_0x5b3e04[_0xec03('0x19')],[_0xec03('0x1b'),'$or',_0xec03('0x1c'),_0xec03('0x1d'),'$lt',_0xec03('0x1e'),_0xec03('0x1f'),_0xec03('0x20'),_0xec03('0x21'),_0xec03('0x22'),'$notBetween',_0xec03('0x23'),_0xec03('0x24'),_0xec03('0x25'),_0xec03('0x26'),_0xec03('0x27'),'$notILike',_0xec03('0x25'),_0xec03('0x28'),'$contains','$contained',_0xec03('0x29')]);_0x25292d[_0xec03('0x2a')]=_[_0xec03('0x2b')](_0x5b3e04[_0xec03('0x16')],qs[_0xec03('0x2c')](_0x46a669[_0xec03('0x17')][_0xec03('0x2c')]));_0x25292d[_0xec03('0x2a')]=_0x25292d['attributes'][_0xec03('0x2d')]?_0x25292d[_0xec03('0x2a')]:_0x5b3e04[_0xec03('0x16')];if(!_0x46a669[_0xec03('0x17')][_0xec03('0x2e')](_0xec03('0x2f'))){_0x25292d[_0xec03('0x6')]=qs[_0xec03('0x6')](_0x46a669[_0xec03('0x17')]['limit']);_0x25292d['offset']=qs['offset'](_0x46a669[_0xec03('0x17')][_0xec03('0x7')]);}_0x25292d[_0xec03('0x30')]=qs[_0xec03('0x31')](_0x46a669['query']['sort']);_0x25292d['where']=qs['filters'](_[_0xec03('0x32')](_0x46a669[_0xec03('0x17')],_0x5b3e04[_0xec03('0x19')]),_0x26f431);if(_0x46a669[_0xec03('0x17')][_0xec03('0x33')]){_0x25292d[_0xec03('0x34')]=_[_0xec03('0x35')](_0x25292d[_0xec03('0x34')],{'$or':_[_0xec03('0x11')](_0x26f431,function(_0x1a5c10){if(_0x1a5c10[_0xec03('0x36')]!==_0xec03('0x37')){var _0x5b9267={};_0x5b9267[_0x1a5c10[_0xec03('0xf')]]={'$like':'%'+_0x46a669[_0xec03('0x17')][_0xec03('0x33')]+'%'};return _0x5b9267;}})});}_0x25292d=_['merge']({},_0x25292d,_0x46a669[_0xec03('0x38')]);var _0x159208={'where':_0x25292d[_0xec03('0x34')]};return db[_0xec03('0x12')][_0xec03('0x8')](_0x159208)[_0xec03('0xb')](function(_0x124324){_0x57dc2d[_0xec03('0x8')]=_0x124324;if(_0x46a669[_0xec03('0x17')][_0xec03('0x39')]){_0x25292d[_0xec03('0x3a')]=[{'all':!![]}];}return db['CmHopper'][_0xec03('0x3b')](_0x25292d);})[_0xec03('0xb')](function(_0x37819a){_0x57dc2d[_0xec03('0x3c')]=_0x37819a;return _0x57dc2d;})[_0xec03('0xb')](respondWithFilteredResult(_0x5e8ae2,_0x25292d))[_0xec03('0x3d')](handleError(_0x5e8ae2,null));};exports[_0xec03('0x3e')]=function(_0xa95d46,_0x4f95c9){var _0x454e91={'raw':!![],'where':{'id':_0xa95d46['params']['id']}},_0x4eef2b={};_0x4eef2b[_0xec03('0x16')]=_['keys'](db['CmHopper'][_0xec03('0x13')]);_0x4eef2b[_0xec03('0x17')]=_['keys'](_0xa95d46[_0xec03('0x17')]);_0x4eef2b['filters']=_['intersection'](_0x4eef2b['model'],_0x4eef2b[_0xec03('0x17')]);_0x454e91[_0xec03('0x2a')]=_[_0xec03('0x2b')](_0x4eef2b[_0xec03('0x16')],qs['fields'](_0xa95d46[_0xec03('0x17')][_0xec03('0x2c')]));_0x454e91[_0xec03('0x2a')]=_0x454e91[_0xec03('0x2a')][_0xec03('0x2d')]?_0x454e91[_0xec03('0x2a')]:_0x4eef2b[_0xec03('0x16')];if(_0xa95d46[_0xec03('0x17')][_0xec03('0x39')]){_0x454e91['include']=[{'all':!![]}];}_0x454e91=_[_0xec03('0x35')]({},_0x454e91,_0xa95d46[_0xec03('0x38')]);return db[_0xec03('0x12')][_0xec03('0x3f')](_0x454e91)['then'](handleEntityNotFound(_0x4f95c9,null))[_0xec03('0xb')](respondWithResult(_0x4f95c9,null))[_0xec03('0x3d')](handleError(_0x4f95c9,null));};exports[_0xec03('0x40')]=function(_0xfdadb1,_0x25d241){return db[_0xec03('0x12')]['create'](_0xfdadb1['body'],{})[_0xec03('0xb')](respondWithResult(_0x25d241,0xc9))[_0xec03('0x3d')](handleError(_0x25d241,null));};exports[_0xec03('0xa')]=function(_0x19e390,_0x3ae1bd){if(_0x19e390['body']['id']){delete _0x19e390['body']['id'];}return db[_0xec03('0x12')]['find']({'where':{'id':_0x19e390[_0xec03('0x41')]['id']}})[_0xec03('0xb')](handleEntityNotFound(_0x3ae1bd,null))[_0xec03('0xb')](saveUpdates(_0x19e390[_0xec03('0x42')],null))['then'](respondWithResult(_0x3ae1bd,null))[_0xec03('0x3d')](handleError(_0x3ae1bd,null));};exports[_0xec03('0x43')]=function(_0x3c7e18,_0x30e9ae){return db['CmHopper'][_0xec03('0x43')]()['then'](respondWithResult(_0x30e9ae,null))[_0xec03('0x3d')](handleError(_0x30e9ae,null));};exports[_0xec03('0x44')]=function(_0xdb9a99,_0x1c6b87){var _0x2eba66;var _0x15fe1d=_0xdb9a99[_0xec03('0x41')]['id'];return db['CmHopper'][_0xec03('0x3f')]({'where':{'id':_0xdb9a99[_0xec03('0x41')]['id']}})[_0xec03('0xb')](handleEntityNotFound(_0x1c6b87,null))[_0xec03('0xb')](function(_0x53a51e){if(_0x53a51e){return _0x53a51e[_0xec03('0x44')]()['then'](function(_0xe0e874){return _0xe0e874;});}})[_0xec03('0xb')](function(_0x2c281d){_0x2eba66=_0x2c281d;if(_0x2c281d){if(_0x2c281d[_0xec03('0x45')]||_0x2c281d['CampaignId']){return db[_0x2c281d[_0xec03('0x45')]?_0xec03('0x46'):_0xec03('0x47')][_0xec03('0x3f')]({'where':{'id':_0x2c281d[_0xec03('0x45')]?_0x2c281d['VoiceQueueId']:_0x2c281d[_0xec03('0x48')]},'attributes':['id',_0xec03('0xf')],'raw':!![]});}}})[_0xec03('0xb')](function(_0x4c434a){var _0x52c176={};if(_0x4c434a){_[_0xec03('0x35')](_0x52c176,_[_0xec03('0x49')](_0x2eba66[_0xec03('0x4a')],[_0xec03('0x4b'),'updatedAt','id']));_0x52c176[_0xec03('0x4c')]=0x15;_0x52c176[_0xec03('0x4d')]=_0xec03('0x4e');_0x52c176[_0xec03('0x4f')]=_0x4c434a['name'];_0x52c176[_0xec03('0x50')]=_0xdb9a99[_0xec03('0x51')][_0xec03('0xf')];_0x52c176[_0xec03('0x52')]=_0xdb9a99[_0xec03('0x51')]['id'];_0x52c176[_0xec03('0x4e')]=!![];_0x52c176[_0xec03('0x53')]=moment()[_0xec03('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x52c176[_0xec03('0x55')]=_0x2eba66[_0xec03('0x56')];_0x52c176[_0xec03('0x57')]=_0x2eba66[_0xec03('0x45')]?'queue':_0xec03('0x58');return db[_0xec03('0x59')][_0xec03('0x3f')]({'where':{'id':_0x52c176[_0xec03('0x5a')]},'attributes':['firstName',_0xec03('0x5b')]})[_0xec03('0xb')](function(_0x13fae4){if(!_[_0xec03('0x5c')](_0x1c6b87)&&!_[_0xec03('0x5c')](_0x13fae4[_0xec03('0x5d')])){_0x52c176[_0xec03('0x5e')]=_0x13fae4[_0xec03('0x5d')];if(!_['isNil'](_0x13fae4[_0xec03('0x5b')])){_0x52c176['calleridname']+='\x20'+_0x13fae4[_0xec03('0x5b')];}}})['finally'](function(){return db[_0xec03('0x5f')][_0xec03('0x40')](_0x52c176);});}})[_0xec03('0xb')](function(_0x3e2498){return db[_0xec03('0x60')][_0xec03('0x44')]({'where':{'CmHopperId':_0x15fe1d}});})[_0xec03('0xb')](function(){return _0x1c6b87[_0xec03('0x3')](0xcc)['end']();})[_0xec03('0x3d')](handleError(_0x1c6b87,null));};exports[_0xec03('0x61')]=function(_0x4f1daf,_0x430e4b){var _0x39095c=[];return db['CmContact']['describe']()[_0xec03('0xb')](function(_0x370f97){_0x39095c=_[_0xec03('0x18')](_0x370f97);return _0x4f1daf[_0xec03('0x51')][_0xec03('0x62')]({'where':{'type':_0xec03('0x63'),'dialActive':!![],'dialMethod':_0xec03('0x64')},'attributes':['id',_0xec03('0x65'),_0xec03('0x66')],'raw':!![]});})[_0xec03('0xb')](function(_0x462ac8){if(_0x462ac8&&_0x462ac8[_0xec03('0x2d')]){return db[_0xec03('0x67')][_0xec03('0x68')](function(_0x24a4c0){var _0x555065={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xec03('0x54')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xec03('0x11')](_0x462ac8,'id')},'$or':[{'UserId':null},{'UserId':_0x4f1daf[_0xec03('0x51')]['id']}]};var _0x179416={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x462ac8)[_0xec03('0x33')]([_0xec03('0x66'),0x0])[_0xec03('0x11')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4f1daf[_0xec03('0x51')]['id']}]};var _0x400652={'$or':[_0x555065,_0x179416]};var _0x2dc181=[];if(_0x4f1daf[_0xec03('0x42')][_0xec03('0x69')]&&_0x4f1daf[_0xec03('0x42')][_0xec03('0x69')]===_0xec03('0x6a')){if(!_['isEmpty'](_0x4f1daf[_0xec03('0x42')][_0xec03('0x6b')])){_0x400652['id']={'$in':_0x4f1daf['body'][_0xec03('0x6b')]};}_0x2dc181=[[_0xec03('0x6c'),_0xec03('0x6d')],[_0xec03('0x6e'),_0x462ac8[0x0][_0xec03('0x65')]==='ASC'?_0xec03('0x6f'):_0xec03('0x6d')],db[_0xec03('0x67')][_0xec03('0x70')](_0xec03('0x71')),['id',_0xec03('0x6f')]];}else{if(!_[_0xec03('0x72')](_0x4f1daf['body'][_0xec03('0x6b')])){_0x400652['id']={'$notIn':_0x4f1daf[_0xec03('0x42')][_0xec03('0x6b')]};}_0x2dc181=[['priority',_0xec03('0x6f')],['scheduledAt',_0x462ac8[0x0]['dialOrderByScheduledAt']],db[_0xec03('0x67')][_0xec03('0x70')](_0xec03('0x73')),['id',_0xec03('0x6d')]];}return db[_0xec03('0x12')]['findOne']({'attributes':['id','scheduledat','phone',_0xec03('0x74')],'where':_0x400652,'order':_0x2dc181,'transaction':_0x24a4c0,'lock':_0x24a4c0[_0xec03('0x75')][_0xec03('0x76')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x39095c,'include':[{'model':db[_0xec03('0x77')],'as':'Company','attributes':['id',_0xec03('0xf')]}]},{'model':db[_0xec03('0x78')],'as':_0xec03('0x79'),'attributes':['id','name']},{'model':db[_0xec03('0x46')],'as':'Queue','attributes':['id',_0xec03('0xf'),'dialActive']}]})['then'](function(_0x5a83b5){if(_0x5a83b5){return _0x5a83b5[_0xec03('0xa')]({'UserId':_0x4f1daf[_0xec03('0x51')]['id']},{'transaction':_0x24a4c0});}});});}})[_0xec03('0xb')](handleEntityNotFound(_0x430e4b,null))[_0xec03('0xb')](respondWithResult(_0x430e4b,null))[_0xec03('0x3d')](handleError(_0x430e4b,null));};exports[_0xec03('0x7a')]=function(_0x9f642f,_0x58b8a2,_0x1b346d){var _0xaad563=[];var _0x4bf355=_0x9f642f[_0xec03('0x41')]['id'];var _0x5286bc=_0x9f642f[_0xec03('0x51')]['id'];return db[_0xec03('0x59')][_0xec03('0x43')]()['then'](function(_0x17b507){_0xaad563=_[_0xec03('0x18')](_0x17b507);return db['sequelize']['transaction'](function(_0x111493){const _0x225855={'id':_0x4bf355};return db[_0xec03('0x12')][_0xec03('0x7b')]({'attributes':['id',_0xec03('0x7c'),_0xec03('0x74')],'where':_0x225855,'transaction':_0x111493,'lock':_0x111493[_0xec03('0x75')][_0xec03('0x76')],'include':[{'model':db[_0xec03('0x59')],'as':'Contact','attributes':_0xaad563,'include':[{'model':db[_0xec03('0x77')],'as':_0xec03('0x7d'),'attributes':['id',_0xec03('0xf')]}]},{'model':db[_0xec03('0x78')],'as':_0xec03('0x79'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xec03('0xf'),'dialActive']}]})[_0xec03('0xb')](function(_0x1048c2){if(_0x1048c2){return _0x1048c2[_0xec03('0xa')]({'UserId':_0x5286bc},{'transaction':_0x111493});}});});})[_0xec03('0xb')](handleEntityNotFound(_0x58b8a2,null))['then'](respondWithResult(_0x58b8a2,null))[_0xec03('0x3d')](handleError(_0x58b8a2,null));};exports[_0xec03('0x7e')]=function(_0x539004,_0x2d3172){return _0x539004['user'][_0xec03('0x62')]({'where':{'type':_0xec03('0x63'),'dialActive':!![],'dialMethod':_0xec03('0x64')},'attributes':['id'],'raw':!![]})['then'](function(_0x4cab14){if(_0x4cab14&&_0x4cab14[_0xec03('0x2d')]){return db[_0xec03('0x12')][_0xec03('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xec03('0x54')](_0xec03('0x7f'))},'VoiceQueueId':{'$in':_[_0xec03('0x11')](_0x4cab14,'id')},'$or':[{'UserId':null},{'UserId':_0x539004['user']['id']}]}});}return 0x0;})[_0xec03('0xb')](function(_0x152b93){if(!_[_0xec03('0x5c')](_0x152b93)&&_[_0xec03('0x80')](_0x152b93)){return _0x2d3172[_0xec03('0x3')](0xc8)[_0xec03('0x4')]({'contacts':_0x152b93});}else{logger[_0xec03('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xec03('0x7e'),0x194,_0xec03('0x81'));_0x2d3172['sendStatus'](0x194);}})['catch'](handleError(_0x2d3172,null));};exports[_0xec03('0x82')]=function(_0x525b31,_0x2c6b0a){var _0x205d44=shared[_0xec03('0x83')];var _0x2684b6=[];_[_0xec03('0x11')](_0x205d44,function(_0x2ffdd5){_0x2684b6['push']({'id':_0x2ffdd5['name'],'name':_0x2ffdd5[_0xec03('0xf')],'utcOffset':_0x2ffdd5[_0xec03('0x84')]});});return _0x2c6b0a[_0xec03('0x3')](0xc8)[_0xec03('0x4')]({'tz':_0x2684b6});};exports[_0xec03('0x85')]=function(_0x165c1f,_0xdf204a){var _0x245cb1=shared[_0xec03('0x83')];var _0x2ff3f6={};if(!_[_0xec03('0x5c')](_0x245cb1[_0x165c1f[_0xec03('0x42')]['id']]))_0x2ff3f6=_0x245cb1[_0x165c1f[_0xec03('0x42')]['id']];return _0xdf204a[_0xec03('0x3')](0xc8)[_0xec03('0x4')](_0x2ff3f6);}; \ No newline at end of file +var _0x885a=['key','model','query','keys','filters','concat','$and','$gt','$gte','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','dialActive','getPreviewRecall','transaction','recallme','Contact','Queue','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','then','error','stack','name','index','CmHopper','rawAttributes','type'];(function(_0x465bff,_0x206cb1){var _0x370519=function(_0x4c8a41){while(--_0x4c8a41){_0x465bff['push'](_0x465bff['shift']());}};_0x370519(++_0x206cb1);}(_0x885a,0x180));var _0xa885=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x885a[_0x17d9e3];return _0x14192d;};'use strict';var moment=require('moment');var _=require(_0xa885('0x0'));var qs=require(_0xa885('0x1'));var logger=require(_0xa885('0x2'))(_0xa885('0x3'));var shared=require('../../config/environment');var db=require(_0xa885('0x4'))['db'];function respondWithResult(_0x1c41b5,_0x2386ec){_0x2386ec=_0x2386ec||0xc8;return function(_0x106e16){if(_0x106e16){return _0x1c41b5[_0xa885('0x5')](_0x2386ec)[_0xa885('0x6')](_0x106e16);}};}function respondWithFilteredResult(_0x5dfd7e,_0x7ac6bd){return function(_0x1200c7){if(_0x1200c7){var _0x31fd77=typeof _0x7ac6bd['offset']===_0xa885('0x7')&&typeof _0x7ac6bd[_0xa885('0x8')]===_0xa885('0x7');var _0x5e49d0=_0x1200c7[_0xa885('0x9')];var _0x299f57=_0x31fd77?0x0:_0x7ac6bd[_0xa885('0xa')];var _0x745710=_0x31fd77?_0x1200c7[_0xa885('0x9')]:_0x7ac6bd[_0xa885('0xa')]+_0x7ac6bd[_0xa885('0x8')];var _0x571c0d;if(_0x745710>=_0x5e49d0){_0x745710=_0x5e49d0;_0x571c0d=0xc8;}else{_0x571c0d=0xce;}_0x5dfd7e[_0xa885('0x5')](_0x571c0d);return _0x5dfd7e[_0xa885('0xb')](_0xa885('0xc'),_0x299f57+'-'+_0x745710+'/'+_0x5e49d0)[_0xa885('0x6')](_0x1200c7);}return null;};}function saveUpdates(_0x412b2a,_0x3e9c7a){return function(_0x4585d9){if(_0x4585d9){return _0x4585d9['update'](_0x412b2a)[_0xa885('0xd')](function(_0x1d789f){return _0x1d789f;});}return null;};}function handleEntityNotFound(_0x27b24a,_0x12d81c){return function(_0x33ce2e){if(!_0x33ce2e){_0x27b24a['sendStatus'](0x194);}return _0x33ce2e;};}function handleError(_0x1c9687,_0x2ca5c5){_0x2ca5c5=_0x2ca5c5||0x1f4;return function(_0x5296e6){logger[_0xa885('0xe')](_0x5296e6[_0xa885('0xf')]);if(_0x5296e6['name']){delete _0x5296e6[_0xa885('0x10')];}_0x1c9687[_0xa885('0x5')](_0x2ca5c5)['send'](_0x5296e6);};}exports[_0xa885('0x11')]=function(_0x543e7a,_0x2e9290){var _0x3960ea={},_0x8c26c={},_0x4e4d51={'count':0x0,'rows':[]};var _0x289b76=_['map'](db[_0xa885('0x12')][_0xa885('0x13')],function(_0x113043){return{'name':_0x113043['fieldName'],'type':_0x113043[_0xa885('0x14')][_0xa885('0x15')]};});_0x8c26c[_0xa885('0x16')]=_['map'](_0x289b76,_0xa885('0x10'));_0x8c26c[_0xa885('0x17')]=_[_0xa885('0x18')](_0x543e7a['query']);_0x8c26c[_0xa885('0x19')]=_['intersection'](_0x8c26c[_0xa885('0x16')],_0x8c26c[_0xa885('0x17')]);_0x8c26c['filters']=_[_0xa885('0x1a')](_0x8c26c[_0xa885('0x19')],[_0xa885('0x1b'),'$or',_0xa885('0x1c'),_0xa885('0x1d'),'$lt',_0xa885('0x1e'),'$ne',_0xa885('0x1f'),'$not',_0xa885('0x20'),_0xa885('0x21'),_0xa885('0x22'),_0xa885('0x23'),_0xa885('0x24'),_0xa885('0x25'),_0xa885('0x26'),_0xa885('0x27'),'$like','$overlap','$contains','$contained',_0xa885('0x28')]);_0x3960ea[_0xa885('0x29')]=_[_0xa885('0x2a')](_0x8c26c[_0xa885('0x16')],qs[_0xa885('0x2b')](_0x543e7a[_0xa885('0x17')]['fields']));_0x3960ea[_0xa885('0x29')]=_0x3960ea['attributes'][_0xa885('0x2c')]?_0x3960ea['attributes']:_0x8c26c[_0xa885('0x16')];if(!_0x543e7a['query'][_0xa885('0x2d')](_0xa885('0x2e'))){_0x3960ea[_0xa885('0x8')]=qs['limit'](_0x543e7a[_0xa885('0x17')][_0xa885('0x8')]);_0x3960ea['offset']=qs[_0xa885('0xa')](_0x543e7a['query'][_0xa885('0xa')]);}_0x3960ea[_0xa885('0x2f')]=qs[_0xa885('0x30')](_0x543e7a['query'][_0xa885('0x30')]);_0x3960ea[_0xa885('0x31')]=qs[_0xa885('0x19')](_['pick'](_0x543e7a[_0xa885('0x17')],_0x8c26c[_0xa885('0x19')]),_0x289b76);if(_0x543e7a[_0xa885('0x17')][_0xa885('0x32')]){_0x3960ea[_0xa885('0x31')]=_[_0xa885('0x33')](_0x3960ea[_0xa885('0x31')],{'$or':_[_0xa885('0x34')](_0x289b76,function(_0x5235af){if(_0x5235af['type']!==_0xa885('0x35')){var _0x1d43b5={};_0x1d43b5[_0x5235af[_0xa885('0x10')]]={'$like':'%'+_0x543e7a[_0xa885('0x17')][_0xa885('0x32')]+'%'};return _0x1d43b5;}})});}_0x3960ea=_[_0xa885('0x33')]({},_0x3960ea,_0x543e7a[_0xa885('0x36')]);var _0x337e55={'where':_0x3960ea[_0xa885('0x31')]};return db['CmHopper']['count'](_0x337e55)[_0xa885('0xd')](function(_0x576c78){_0x4e4d51['count']=_0x576c78;if(_0x543e7a[_0xa885('0x17')]['includeAll']){_0x3960ea[_0xa885('0x37')]=[{'all':!![]}];}return db[_0xa885('0x12')][_0xa885('0x38')](_0x3960ea);})[_0xa885('0xd')](function(_0x2d433e){_0x4e4d51[_0xa885('0x39')]=_0x2d433e;return _0x4e4d51;})[_0xa885('0xd')](respondWithFilteredResult(_0x2e9290,_0x3960ea))[_0xa885('0x3a')](handleError(_0x2e9290,null));};exports[_0xa885('0x3b')]=function(_0x2f48a9,_0x531586){var _0x30759d={'raw':!![],'where':{'id':_0x2f48a9[_0xa885('0x3c')]['id']}},_0x4012b3={};_0x4012b3[_0xa885('0x16')]=_[_0xa885('0x18')](db['CmHopper']['rawAttributes']);_0x4012b3[_0xa885('0x17')]=_[_0xa885('0x18')](_0x2f48a9[_0xa885('0x17')]);_0x4012b3[_0xa885('0x19')]=_[_0xa885('0x2a')](_0x4012b3['model'],_0x4012b3[_0xa885('0x17')]);_0x30759d[_0xa885('0x29')]=_['intersection'](_0x4012b3['model'],qs[_0xa885('0x2b')](_0x2f48a9[_0xa885('0x17')]['fields']));_0x30759d['attributes']=_0x30759d[_0xa885('0x29')][_0xa885('0x2c')]?_0x30759d[_0xa885('0x29')]:_0x4012b3[_0xa885('0x16')];if(_0x2f48a9[_0xa885('0x17')][_0xa885('0x3d')]){_0x30759d[_0xa885('0x37')]=[{'all':!![]}];}_0x30759d=_[_0xa885('0x33')]({},_0x30759d,_0x2f48a9[_0xa885('0x36')]);return db[_0xa885('0x12')][_0xa885('0x3e')](_0x30759d)['then'](handleEntityNotFound(_0x531586,null))[_0xa885('0xd')](respondWithResult(_0x531586,null))[_0xa885('0x3a')](handleError(_0x531586,null));};exports[_0xa885('0x3f')]=function(_0x49c6a7,_0x47f3b4){return db[_0xa885('0x12')][_0xa885('0x3f')](_0x49c6a7[_0xa885('0x40')],{})['then'](respondWithResult(_0x47f3b4,0xc9))[_0xa885('0x3a')](handleError(_0x47f3b4,null));};exports['update']=function(_0x2d4bb5,_0x245fe9){if(_0x2d4bb5['body']['id']){delete _0x2d4bb5[_0xa885('0x40')]['id'];}return db[_0xa885('0x12')][_0xa885('0x3e')]({'where':{'id':_0x2d4bb5[_0xa885('0x3c')]['id']}})[_0xa885('0xd')](handleEntityNotFound(_0x245fe9,null))['then'](saveUpdates(_0x2d4bb5[_0xa885('0x40')],null))[_0xa885('0xd')](respondWithResult(_0x245fe9,null))[_0xa885('0x3a')](handleError(_0x245fe9,null));};exports['describe']=function(_0x4d146e,_0x52fbeb){return db[_0xa885('0x12')][_0xa885('0x41')]()[_0xa885('0xd')](respondWithResult(_0x52fbeb,null))[_0xa885('0x3a')](handleError(_0x52fbeb,null));};exports[_0xa885('0x42')]=function(_0x49aa9b,_0x43245c){var _0x476532;var _0x4397d6=_0x49aa9b[_0xa885('0x3c')]['id'];return db[_0xa885('0x12')]['find']({'where':{'id':_0x49aa9b['params']['id']}})['then'](handleEntityNotFound(_0x43245c,null))[_0xa885('0xd')](function(_0x289716){if(_0x289716){return _0x289716[_0xa885('0x42')]()[_0xa885('0xd')](function(_0x164d9d){return _0x164d9d;});}})[_0xa885('0xd')](function(_0x35e931){_0x476532=_0x35e931;if(_0x35e931){if(_0x35e931['VoiceQueueId']||_0x35e931[_0xa885('0x43')]){return db[_0x35e931[_0xa885('0x44')]?_0xa885('0x45'):_0xa885('0x46')][_0xa885('0x3e')]({'where':{'id':_0x35e931[_0xa885('0x44')]?_0x35e931[_0xa885('0x44')]:_0x35e931['CampaignId']},'attributes':['id',_0xa885('0x10')],'raw':!![]});}}})[_0xa885('0xd')](function(_0x1fde66){var _0x55ea83={};if(_0x1fde66){_[_0xa885('0x33')](_0x55ea83,_[_0xa885('0x47')](_0x476532[_0xa885('0x48')],[_0xa885('0x49'),_0xa885('0x4a'),'id']));_0x55ea83[_0xa885('0x4b')]=0x15;_0x55ea83[_0xa885('0x4c')]=_0xa885('0x4d');_0x55ea83['campaign']=_0x1fde66[_0xa885('0x10')];_0x55ea83[_0xa885('0x4e')]=_0x49aa9b[_0xa885('0x4f')]['name'];_0x55ea83[_0xa885('0x50')]=_0x49aa9b[_0xa885('0x4f')]['id'];_0x55ea83[_0xa885('0x4d')]=!![];_0x55ea83[_0xa885('0x51')]=moment()[_0xa885('0x52')](_0xa885('0x53'));_0x55ea83['calleridnum']=_0x476532[_0xa885('0x54')];_0x55ea83[_0xa885('0x55')]=_0x476532[_0xa885('0x44')]?'queue':_0xa885('0x56');return db[_0xa885('0x57')][_0xa885('0x3e')]({'where':{'id':_0x55ea83[_0xa885('0x58')]},'attributes':[_0xa885('0x59'),_0xa885('0x5a')]})[_0xa885('0xd')](function(_0x288bbc){if(!_[_0xa885('0x5b')](_0x43245c)&&!_['isNil'](_0x288bbc[_0xa885('0x59')])){_0x55ea83[_0xa885('0x5c')]=_0x288bbc['firstName'];if(!_['isNil'](_0x288bbc[_0xa885('0x5a')])){_0x55ea83[_0xa885('0x5c')]+='\x20'+_0x288bbc['lastName'];}}})[_0xa885('0x5d')](function(){return db[_0xa885('0x5e')][_0xa885('0x3f')](_0x55ea83);});}})[_0xa885('0xd')](function(_0x1e3576){return db[_0xa885('0x5f')][_0xa885('0x42')]({'where':{'CmHopperId':_0x4397d6}});})['then'](function(){return _0x43245c[_0xa885('0x5')](0xcc)[_0xa885('0x60')]();})['catch'](handleError(_0x43245c,null));};exports[_0xa885('0x61')]=function(_0x48ded4,_0x117cfe){var _0x5698d6=[];return db[_0xa885('0x57')][_0xa885('0x41')]()[_0xa885('0xd')](function(_0x22eb32){_0x5698d6=_['keys'](_0x22eb32);return _0x48ded4[_0xa885('0x4f')][_0xa885('0x62')]({'where':{'type':_0xa885('0x63'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa885('0x64'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xa885('0xd')](function(_0xb066be){if(_0xb066be&&_0xb066be['length']){return db[_0xa885('0x65')]['transaction'](function(_0x36c7ba){var _0x2f053a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa885('0x53'))},'VoiceQueueId':{'$in':_[_0xa885('0x34')](_0xb066be,'id')},'$or':[{'UserId':null},{'UserId':_0x48ded4[_0xa885('0x4f')]['id']}]};var _0x3bc750={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xb066be)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xa885('0x34')]('id')[_0xa885('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x48ded4['user']['id']}]};var _0x55d5d0={'$or':[_0x2f053a,_0x3bc750]};var _0x3c9df4=[];if(_0x48ded4[_0xa885('0x40')][_0xa885('0x67')]&&_0x48ded4[_0xa885('0x40')][_0xa885('0x67')]===_0xa885('0x68')){if(!_[_0xa885('0x69')](_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')])){_0x55d5d0['id']={'$in':_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')]};}_0x3c9df4=[['priority',_0xa885('0x6b')],[_0xa885('0x6c'),_0xb066be[0x0][_0xa885('0x64')]===_0xa885('0x6b')?_0xa885('0x6d'):'ASC'],db[_0xa885('0x65')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa885('0x6d')]];}else{if(!_[_0xa885('0x69')](_0x48ded4['body']['hopperIds'])){_0x55d5d0['id']={'$notIn':_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')]};}_0x3c9df4=[[_0xa885('0x6e'),'DESC'],['scheduledAt',_0xb066be[0x0][_0xa885('0x64')]],db[_0xa885('0x65')][_0xa885('0x6f')](_0xa885('0x70')),['id','ASC']];}return db[_0xa885('0x12')][_0xa885('0x71')]({'attributes':['id',_0xa885('0x72'),'phone','recallme'],'where':_0x55d5d0,'order':_0x3c9df4,'transaction':_0x36c7ba,'lock':_0x36c7ba[_0xa885('0x73')][_0xa885('0x74')],'include':[{'model':db[_0xa885('0x57')],'as':'Contact','attributes':_0x5698d6,'include':[{'model':db[_0xa885('0x75')],'as':_0xa885('0x76'),'attributes':['id',_0xa885('0x10')]}]},{'model':db[_0xa885('0x77')],'as':'List','attributes':['id',_0xa885('0x10')]},{'model':db[_0xa885('0x45')],'as':'Queue','attributes':['id',_0xa885('0x10'),_0xa885('0x78')]}]})['then'](function(_0x314d83){if(_0x314d83){return _0x314d83['update']({'UserId':_0x48ded4[_0xa885('0x4f')]['id']},{'transaction':_0x36c7ba});}});});}})[_0xa885('0xd')](handleEntityNotFound(_0x117cfe,null))[_0xa885('0xd')](respondWithResult(_0x117cfe,null))[_0xa885('0x3a')](handleError(_0x117cfe,null));};exports[_0xa885('0x79')]=function(_0x29ed6e,_0x1ca586,_0x3aa8bc){var _0x490d15=[];var _0x55413d=_0x29ed6e[_0xa885('0x3c')]['id'];var _0xb1eac6=_0x29ed6e['user']['id'];return db[_0xa885('0x57')][_0xa885('0x41')]()['then'](function(_0x425374){_0x490d15=_['keys'](_0x425374);return db[_0xa885('0x65')][_0xa885('0x7a')](function(_0x37ef1b){const _0x26950f={'id':_0x55413d};return db['CmHopper']['findOne']({'attributes':['id',_0xa885('0x72'),_0xa885('0x7b')],'where':_0x26950f,'transaction':_0x37ef1b,'lock':_0x37ef1b[_0xa885('0x73')][_0xa885('0x74')],'include':[{'model':db[_0xa885('0x57')],'as':_0xa885('0x7c'),'attributes':_0x490d15,'include':[{'model':db[_0xa885('0x75')],'as':_0xa885('0x76'),'attributes':['id','name']}]},{'model':db[_0xa885('0x77')],'as':'List','attributes':['id',_0xa885('0x10')]},{'model':db[_0xa885('0x45')],'as':_0xa885('0x7d'),'attributes':['id','name',_0xa885('0x78')]}]})[_0xa885('0xd')](function(_0x50a7ef){if(_0x50a7ef){return _0x50a7ef['update']({'UserId':_0xb1eac6},{'transaction':_0x37ef1b});}});});})[_0xa885('0xd')](handleEntityNotFound(_0x1ca586,null))[_0xa885('0xd')](respondWithResult(_0x1ca586,null))[_0xa885('0x3a')](handleError(_0x1ca586,null));};exports[_0xa885('0x7e')]=function(_0x243d5e,_0x4bd60c){return _0x243d5e['user'][_0xa885('0x62')]({'where':{'type':_0xa885('0x63'),'dialActive':!![],'dialMethod':_0xa885('0x7f')},'attributes':['id'],'raw':!![]})[_0xa885('0xd')](function(_0x56bd37){if(_0x56bd37&&_0x56bd37['length']){return db['CmHopper'][_0xa885('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa885('0x52')](_0xa885('0x53'))},'VoiceQueueId':{'$in':_[_0xa885('0x34')](_0x56bd37,'id')},'$or':[{'UserId':null},{'UserId':_0x243d5e[_0xa885('0x4f')]['id']}]}});}return 0x0;})[_0xa885('0xd')](function(_0x220614){if(!_['isNil'](_0x220614)&&_['isNumber'](_0x220614)){return _0x4bd60c[_0xa885('0x5')](0xc8)['json']({'contacts':_0x220614});}else{logger[_0xa885('0xe')](_0xa885('0x80'),_0xa885('0x7e'),0x194,_0xa885('0x81'));_0x4bd60c['sendStatus'](0x194);}})[_0xa885('0x3a')](handleError(_0x4bd60c,null));};exports[_0xa885('0x82')]=function(_0x2ff728,_0x5a6f1f){var _0xe5881c=shared[_0xa885('0x83')];var _0x9cda91=[];_['map'](_0xe5881c,function(_0x1d51ac){_0x9cda91[_0xa885('0x84')]({'id':_0x1d51ac[_0xa885('0x10')],'name':_0x1d51ac[_0xa885('0x10')],'utcOffset':_0x1d51ac[_0xa885('0x85')]});});return _0x5a6f1f[_0xa885('0x5')](0xc8)['json']({'tz':_0x9cda91});};exports[_0xa885('0x86')]=function(_0x40a85d,_0x3be76a){var _0x1689c8=shared['timezones'];var _0x3c088d={};if(!_[_0xa885('0x5b')](_0x1689c8[_0x40a85d[_0xa885('0x40')]['id']]))_0x3c088d=_0x1689c8[_0x40a85d[_0xa885('0x40')]['id']];return _0x3be76a[_0xa885('0x5')](0xc8)[_0xa885('0x6')](_0x3c088d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 9c6b624..1e4e4a7 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x57b7f5,_0x6e56a){var _0x59e151=function(_0x4c9c54){while(--_0x4c9c54){_0x57b7f5['push'](_0x57b7f5['shift']());}};_0x59e151(++_0x6e56a);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x6c40ba,_0x5e39fa){_0x6c40ba=_0x6c40ba-0x0;var _0x7a54dd=_0x687b[_0x6c40ba];return _0x7a54dd;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 489da65..358a319 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 _0x31b9=['GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','List','CmHopperHandlePreviewRecallNotifications','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','error','message','ShowCmHopper','catch','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','describe'];(function(_0x141295,_0xb221c9){var _0x18753b=function(_0x68ad6e){while(--_0x68ad6e){_0x141295['push'](_0x141295['shift']());}};_0x18753b(++_0xb221c9);}(_0x31b9,0xb4));var _0x931b=function(_0x46d58d,_0x157397){_0x46d58d=_0x46d58d-0x0;var _0x3e1f10=_0x31b9[_0x46d58d];return _0x3e1f10;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x931b('0x0'));var BPromise=require(_0x931b('0x1'));var db=require(_0x931b('0x2'))['db'];var logger=require(_0x931b('0x3'))(_0x931b('0x4'));exports[_0x931b('0x5')]=function(_0x4e9c87){var _0x402c2f=this;return new Promise(function(_0x29953a,_0x5e1c5d){return db[_0x931b('0x6')][_0x931b('0x7')]({'raw':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87['options'][_0x931b('0xa')]||null:null,'attributes':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')]['attributes']||null:null,'limit':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87['options'][_0x931b('0xb')]||null:null,'include':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')][_0x931b('0xc')]?_[_0x931b('0xd')](_0x4e9c87[_0x931b('0x8')][_0x931b('0xc')],function(_0x2318e5){return{'model':db[_0x2318e5[_0x931b('0xe')]],'as':_0x2318e5['as'],'attributes':_0x2318e5[_0x931b('0xf')],'include':_0x2318e5[_0x931b('0xc')]?_[_0x931b('0xd')](_0x2318e5[_0x931b('0xc')],function(_0x4b7f06){return{'model':db[_0x4b7f06['model']],'as':_0x4b7f06['as'],'attributes':_0x4b7f06['attributes'],'include':_0x4b7f06[_0x931b('0xc')]?_['map'](_0x4b7f06[_0x931b('0xc')],function(_0x45b0c7){return{'model':db[_0x45b0c7['model']],'as':_0x45b0c7['as'],'attributes':_0x45b0c7[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x19c35b){logger[_0x931b('0x11')](_0x931b('0x5'),_0x4e9c87);logger[_0x931b('0x12')]('GetCmHopper',_0x4e9c87,JSON[_0x931b('0x13')](_0x19c35b));_0x29953a(_0x19c35b);})['catch'](function(_0x4bdead){logger[_0x931b('0x14')]('GetCmHopper',_0x4bdead[_0x931b('0x15')],_0x4e9c87);_0x5e1c5d(_0x402c2f[_0x931b('0x14')](0x1f4,_0x4bdead[_0x931b('0x15')]));});});};exports[_0x931b('0x16')]=function(_0x448c20){var _0x4b0858=this;return new Promise(function(_0x5a4042,_0x58e33d){return db[_0x931b('0x6')]['find']({'raw':_0x448c20['options']?_0x448c20[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x448c20[_0x931b('0x8')]?_0x448c20[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x448c20[_0x931b('0x8')]?_0x448c20['options']['attributes']||null:null,'include':_0x448c20['options']?_0x448c20['options'][_0x931b('0xc')]?_[_0x931b('0xd')](_0x448c20[_0x931b('0x8')][_0x931b('0xc')],function(_0x35638e){return{'model':db[_0x35638e[_0x931b('0xe')]],'as':_0x35638e['as'],'attributes':_0x35638e[_0x931b('0xf')],'include':_0x35638e[_0x931b('0xc')]?_[_0x931b('0xd')](_0x35638e[_0x931b('0xc')],function(_0xb16da6){return{'model':db[_0xb16da6['model']],'as':_0xb16da6['as'],'attributes':_0xb16da6['attributes'],'include':_0xb16da6[_0x931b('0xc')]?_['map'](_0xb16da6[_0x931b('0xc')],function(_0x1b9d09){return{'model':db[_0x1b9d09[_0x931b('0xe')]],'as':_0x1b9d09['as'],'attributes':_0x1b9d09[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x5f44df){logger[_0x931b('0x11')](_0x931b('0x16'),_0x448c20);logger[_0x931b('0x12')]('ShowCmHopper',_0x448c20,JSON['stringify'](_0x5f44df));_0x5a4042(_0x5f44df);})[_0x931b('0x17')](function(_0x2ee978){logger['error'](_0x931b('0x16'),_0x2ee978[_0x931b('0x15')],_0x448c20);_0x58e33d(_0x4b0858[_0x931b('0x14')](0x1f4,_0x2ee978[_0x931b('0x15')]));});});};exports[_0x931b('0x18')]=function(_0x2176e8){var _0x4e1da9=this;return new Promise(function(_0x197219,_0xaafbf){return db[_0x931b('0x6')][_0x931b('0x19')](_0x2176e8[_0x931b('0x1a')],{'raw':_0x2176e8[_0x931b('0x8')]?_0x2176e8[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x370648){logger['info'](_0x931b('0x18'),_0x2176e8);logger[_0x931b('0x12')](_0x931b('0x18'),_0x2176e8,JSON[_0x931b('0x13')](_0x370648));_0x197219(_0x370648);})[_0x931b('0x17')](function(_0x1c1fbe){logger[_0x931b('0x14')](_0x931b('0x18'),_0x1c1fbe[_0x931b('0x15')],_0x2176e8);_0xaafbf(_0x4e1da9[_0x931b('0x14')](0x1f4,_0x1c1fbe[_0x931b('0x15')]));});});};exports['UpdateCmHopper']=function(_0x401e5c){var _0x35bff5=this;return new Promise(function(_0x33630f,_0x2bf3c3){return db['CmHopper'][_0x931b('0x1b')](_0x401e5c[_0x931b('0x1a')],{'raw':_0x401e5c[_0x931b('0x8')]?_0x401e5c[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x401e5c[_0x931b('0x8')]?_0x401e5c[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x401e5c['options']?_0x401e5c['options'][_0x931b('0xf')]||null:null,'limit':_0x401e5c['options']?_0x401e5c[_0x931b('0x8')]['limit']||null:null})[_0x931b('0x10')](function(_0x52bfbc){logger[_0x931b('0x11')](_0x931b('0x1c'),_0x401e5c);logger[_0x931b('0x11')](_0x931b('0x1d'),JSON[_0x931b('0x13')](_0x401e5c['options'][_0x931b('0xa')]),_0x401e5c['body'][_0x931b('0x1e')]);logger[_0x931b('0x12')](_0x931b('0x1c'),_0x401e5c,JSON[_0x931b('0x13')](_0x52bfbc));_0x33630f(_0x52bfbc);})['catch'](function(_0x2f8398){logger['error'](_0x931b('0x1c'),_0x2f8398[_0x931b('0x15')],_0x401e5c);_0x2bf3c3(_0x35bff5[_0x931b('0x14')](0x1f4,_0x2f8398['message']));});});};exports[_0x931b('0x1f')]=function(_0x1f9d21){var _0x261391=this;return new Promise(function(_0xf321b9,_0x558021){return db[_0x931b('0x6')][_0x931b('0x20')]({'where':_0x1f9d21['options']?_0x1f9d21[_0x931b('0x8')][_0x931b('0xa')]||null:null})[_0x931b('0x10')](function(_0x3713dc){logger[_0x931b('0x11')](_0x931b('0x1f'),_0x1f9d21);logger[_0x931b('0x12')](_0x931b('0x1f'),_0x1f9d21,JSON[_0x931b('0x13')](_0x3713dc));_0xf321b9(_0x3713dc);})[_0x931b('0x17')](function(_0x5a89e0){logger['error']('DestroyCmHopper',_0x5a89e0[_0x931b('0x15')],_0x1f9d21);_0x558021(_0x261391[_0x931b('0x14')](0x1f4,_0x5a89e0[_0x931b('0x15')]));});});};exports[_0x931b('0x21')]=function(_0xb37ea4){var _0x37e1a9=this;return new Promise(function(_0x2abd78,_0x299225){return db['CmContact']['describe']()[_0x931b('0x10')](function(_0x49c36e){return db['sequelize']['transaction'](function(_0x18182){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')]['where']||null:null,'attributes':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0xf')]||null:null,'limit':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0xb')]||null:null,'order':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0x22')]||null:null,'transaction':_0x18182,'lock':_0x18182[_0x931b('0x23')][_0x931b('0x24')],'include':[{'model':db['CmContact'],'as':_0x931b('0x25'),'attributes':_[_0x931b('0x26')](_0x49c36e)},{'model':db['User'],'as':_0x931b('0x27'),'attributes':['id','name',_0x931b('0x28')]}]})[_0x931b('0x10')](function(_0x4442c1){var _0x29beae=[];var _0x2f437a=[];for(var _0x333306=0x0;_0x333306<_0x4442c1['length'];_0x333306+=0x1){var _0xf82002=_0x4442c1[_0x333306][_0x931b('0x29')];if(_0xf82002===null){_0x29beae[_0x931b('0x2a')](_0x4442c1[_0x333306][_0x931b('0x1b')](_0xb37ea4[_0x931b('0x1a')],{'transaction':_0x18182}));}else if(!_0x2f437a[_0x931b('0x2b')](_0xf82002)){_0x2f437a[_0x931b('0x2a')](_0xf82002);_0x29beae['push'](_0x4442c1[_0x333306][_0x931b('0x1b')](_0xb37ea4['body'],{'transaction':_0x18182}));}}return BPromise[_0x931b('0x2c')](_0x29beae);});})[_0x931b('0x10')](function(_0x49a467){logger[_0x931b('0x11')](_0x931b('0x21'),_0xb37ea4);if(_0x49a467[_0x931b('0x2d')]>0x0){logger[_0x931b('0x11')](_0x931b('0x2e'),_0x49a467[0x0][_0x931b('0x2f')]['id'],_0x49a467[0x0]['dataValues'][_0x931b('0x30')],_0x49a467[0x0]['dataValues'][_0x931b('0x1e')]);}logger[_0x931b('0x12')]('GetContactDialer',_0xb37ea4,JSON['stringify'](_0x49a467));_0x2abd78(_0x49a467);})[_0x931b('0x17')](function(_0x25cf76){logger[_0x931b('0x14')](_0x931b('0x21'),_0x25cf76[_0x931b('0x15')],_0xb37ea4);_0x299225(_0x37e1a9['error'](0x1f4,_0x25cf76[_0x931b('0x15')]));});});});};exports[_0x931b('0x31')]=function(_0x2cabcd){var _0x3334b5=this;return new Promise(function(_0x5a7b59,_0x2f3038){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x19f85a){return db[_0x931b('0x34')][_0x931b('0x19')](_0x2cabcd[_0x931b('0x1a')],{'raw':_0x2cabcd[_0x931b('0x8')]?_0x2cabcd[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'transaction':_0x19f85a})[_0x931b('0x10')](function(){logger[_0x931b('0x11')](_0x931b('0x35'),JSON[_0x931b('0x13')](_0x2cabcd['options'][_0x931b('0xa')]),_0x2cabcd[_0x931b('0x8')]['where']['active']);return db[_0x931b('0x6')][_0x931b('0x20')]({'where':_0x2cabcd['options']?_0x2cabcd[_0x931b('0x8')][_0x931b('0xa')]||null:null,'transaction':_0x19f85a});});})['then'](function(_0x5bfd7d){logger['info'](_0x931b('0x31'),_0x2cabcd);logger[_0x931b('0x12')]('MoveContactManagedDialer',_0x2cabcd,JSON[_0x931b('0x13')](_0x5bfd7d));_0x5a7b59(_0x5bfd7d);})[_0x931b('0x17')](function(_0x1f5d5b){logger['error'](_0x931b('0x31'),_0x1f5d5b[_0x931b('0x15')],_0x2cabcd);_0x2f3038(_0x3334b5[_0x931b('0x14')](0x1f4,_0x1f5d5b['message']));});});};exports[_0x931b('0x36')]=function(_0x62cb69){var _0x2eca9d=this;return new Promise(function(_0x2f2c05,_0x1706a0){return db['CmHopper'][_0x931b('0x7')]({'raw':_0x62cb69[_0x931b('0x8')]?_0x62cb69['options']['raw']===undefined?!![]:![]:!![],'where':_0x62cb69[_0x931b('0x8')]?_0x62cb69[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0x931b('0x37'),db[_0x931b('0x32')]['fn']('IF',db[_0x931b('0x32')][_0x931b('0x38')](_0x931b('0x39')+util['format'](_0x931b('0x3a'),moment()[_0x931b('0x3b')](_0x931b('0x3c')))+_0x931b('0x3d')))),_0x931b('0x3e')]]})['then'](function(_0x4b428c){logger[_0x931b('0x11')](_0x931b('0x36'),_0x62cb69);logger['debug'](_0x931b('0x36'),_0x62cb69,JSON['stringify'](_0x4b428c));_0x2f2c05(_0x4b428c);})[_0x931b('0x17')](function(_0x180158){logger[_0x931b('0x14')]('CountReScheduled',_0x180158[_0x931b('0x15')],_0x62cb69);_0x1706a0(_0x2eca9d[_0x931b('0x14')](0x1f4,_0x180158[_0x931b('0x15')]));});});};exports[_0x931b('0x3f')]=function(_0x1240ed){var _0x3c7e1d=this;return new Promise(function(_0x1cc6ba,_0x5b1ccd){return db[_0x931b('0x40')][_0x931b('0x41')]()[_0x931b('0x10')](function(){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x461205){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')][_0x931b('0xf')]||null:null,'limit':0x1,'order':_0x1240ed['options']?_0x1240ed[_0x931b('0x8')][_0x931b('0x22')]||null:null,'group':db[_0x931b('0x6')][_0x931b('0x29')],'transaction':_0x461205,'lock':_0x461205[_0x931b('0x23')][_0x931b('0x24')],'include':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')]['include']?_[_0x931b('0xd')](_0x1240ed[_0x931b('0x8')]['include'],function(_0x4b8b34){return{'model':db[_0x4b8b34[_0x931b('0xe')]],'as':_0x4b8b34['as'],'attributes':_0x4b8b34['attributes'],'include':_0x4b8b34[_0x931b('0xc')]?_[_0x931b('0xd')](_0x4b8b34['include'],function(_0x4afdd6){return{'model':db[_0x4afdd6[_0x931b('0xe')]],'as':_0x4afdd6['as'],'attributes':_0x4afdd6['attributes'],'include':_0x4afdd6['include']?_[_0x931b('0xd')](_0x4afdd6[_0x931b('0xc')],function(_0x358bc0){return{'model':db[_0x358bc0[_0x931b('0xe')]],'as':_0x358bc0['as'],'attributes':_0x358bc0[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x287708){var _0x156ee9=[];for(var _0xdf54b0=0x0;_0xdf54b0<_0x287708[_0x931b('0x2d')];_0xdf54b0+=0x1){_0x156ee9[_0x931b('0x2a')](_0x287708[_0xdf54b0][_0x931b('0x1b')](_0x1240ed[_0x931b('0x1a')],{'transaction':_0x461205}));}return BPromise[_0x931b('0x2c')](_0x156ee9);});})[_0x931b('0x10')](function(_0x4942ec){logger[_0x931b('0x11')](_0x931b('0x3f'),_0x1240ed);logger[_0x931b('0x12')]('GetContactRecallMe',_0x1240ed,JSON[_0x931b('0x13')](_0x4942ec));_0x1cc6ba(_0x4942ec);})[_0x931b('0x17')](function(_0x2eceea){logger['error'](_0x931b('0x3f'),_0x2eceea[_0x931b('0x15')],_0x1240ed);_0x5b1ccd(_0x3c7e1d[_0x931b('0x14')](0x1f4,_0x2eceea['message']));});});});};exports[_0x931b('0x42')]=function(_0x126d2f){var _0x3f70f1=this;return new Promise(function(_0x166499,_0xe75079){db[_0x931b('0x40')][_0x931b('0x41')]()[_0x931b('0x10')](function(_0x1f7a05){return db['CmHopper']['findAll']({'raw':_0x126d2f['options']?_0x126d2f['options'][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x126d2f[_0x931b('0x8')]?_0x126d2f[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x126d2f['options']?_0x126d2f[_0x931b('0x8')]['attributes']||null:null,'limit':_0x126d2f[_0x931b('0x8')]?_0x126d2f[_0x931b('0x8')]['limit']||null:null,'include':_0x126d2f['options']?_0x126d2f['options'][_0x931b('0xc')]?_['map'](_0x126d2f[_0x931b('0x8')][_0x931b('0xc')],function(_0x1c972e){return{'model':db[_0x1c972e[_0x931b('0xe')]],'as':_0x1c972e['as'],'attributes':_0x1c972e['as']===_0x931b('0x25')?_['keys'](_0x1f7a05):_0x1c972e[_0x931b('0xf')],'include':_0x1c972e[_0x931b('0xc')]?_['map'](_0x1c972e['include'],function(_0x39928e){return{'model':db[_0x39928e['model']],'as':_0x39928e['as'],'attributes':_0x39928e[_0x931b('0xf')],'include':_0x39928e[_0x931b('0xc')]?_['map'](_0x39928e[_0x931b('0xc')],function(_0x1c7554){return{'model':db[_0x1c7554[_0x931b('0xe')]],'as':_0x1c7554['as'],'attributes':_0x1c7554['attributes']};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x59772d){logger[_0x931b('0x11')](_0x931b('0x5'),_0x126d2f);logger[_0x931b('0x12')](_0x931b('0x5'),_0x126d2f,JSON['stringify'](_0x59772d));_0x166499(_0x59772d);})[_0x931b('0x17')](function(_0xe447d0){logger[_0x931b('0x14')](_0x931b('0x5'),_0xe447d0[_0x931b('0x15')],_0x126d2f);_0xe75079(_0x3f70f1[_0x931b('0x14')](0x1f4,_0xe447d0[_0x931b('0x15')]));});});});};exports['GetContactByPhone']=function(_0x242546){var _0x628278=this;return new Promise(function(_0x1c37aa,_0x142e6d){return db[_0x931b('0x40')][_0x931b('0x43')]({'raw':!![],'where':{'phone':_0x242546[_0x931b('0x8')]['where'][_0x931b('0x44')]},'attributes':['id',_0x931b('0x45')],'order':[['id',_0x931b('0x46')]]})[_0x931b('0x10')](function(_0x5243ed){logger['info'](_0x931b('0x47'),_0x242546);logger['debug']('getContactByPhone',_0x242546,JSON[_0x931b('0x13')](_0x5243ed));_0x1c37aa(_0x5243ed);})[_0x931b('0x17')](function(_0x4bdcd8){logger[_0x931b('0x14')](_0x931b('0x47'),_0x4bdcd8[_0x931b('0x15')],_0x242546);_0x142e6d(_0x628278['error'](0x1f4,_0x4bdcd8[_0x931b('0x15')]));});});};exports['ResetActiveCalls']=function(_0x1aaf3f){var _0x306961=this;return new Promise(function(_0x547b75,_0x642d57){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0xc87405){var _0x20dee5=_0x1aaf3f[_0x931b('0x8')]&&_0x1aaf3f[_0x931b('0x8')][_0x931b('0xa')]?_0x1aaf3f[_0x931b('0x8')][_0x931b('0xa')]:{};return db['CmHopper'][_0x931b('0x1b')](_0x1aaf3f[_0x931b('0x1a')],{'where':_0x20dee5,'transaction':_0xc87405})[_0x931b('0x10')](function(_0x4e0315){logger[_0x931b('0x11')]('ResetActiveCalls',_0x1aaf3f);logger[_0x931b('0x12')](_0x931b('0x48'),_0x1aaf3f,JSON[_0x931b('0x13')](_0x4e0315));_0x547b75(_0x4e0315);})['catch'](function(_0x3988a3){logger[_0x931b('0x14')](_0x931b('0x48'),_0x3988a3[_0x931b('0x15')],_0x1aaf3f);_0x642d57(_0x306961[_0x931b('0x14')](0x1f4,_0x3988a3[_0x931b('0x15')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x3c593f){var _0x56fc33=this;var _0x1ed045=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x49')];var _0x36b375=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x4a')];var _0x57b3c4=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x4b')];return new Promise(function(_0x21d06,_0xbc1a15){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':{'voiceQueueId':{'$in':_0x1ed045},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x931b('0x32')][_0x931b('0x38')](_0x931b('0x4c')+_0x36b375+_0x931b('0x4d')),'$gt':db[_0x931b('0x32')]['literal'](_0x931b('0x4e'))}},'UserId':{'$in':_0x57b3c4}},'include':[{'model':db['CmContact'],'as':_0x931b('0x25')},{'model':db[_0x931b('0x4f')],'as':_0x931b('0x27'),'attributes':['id','name',_0x931b('0x28')]},{'model':db['CmList'],'as':_0x931b('0x50')}]})['then'](function(_0x4f3093){if(_0x4f3093[_0x931b('0x2d')]>0x0){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x454577){return db[_0x931b('0x6')]['update']({'recallmeNotifiedDate':db[_0x931b('0x32')][_0x931b('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0x931b('0xd')](_0x4f3093,'id')}},'transaction':_0x454577})[_0x931b('0x10')](function(){_0x21d06(_0x4f3093);})[_0x931b('0x17')](function(_0x3c4302){logger[_0x931b('0x14')](_0x931b('0x51'),_0x3c4302['message'],_0x3c593f);_0xbc1a15(_0x56fc33[_0x931b('0x14')](0x1f4,_0x3c4302[_0x931b('0x15')]));});})['catch'](function(_0x86535b){logger['error'](_0x931b('0x51'),_0x86535b[_0x931b('0x15')],_0x3c593f);_0xbc1a15(_0x56fc33['error'](0x1f4,_0x86535b[_0x931b('0x15')]));});}else{_0x21d06(_0x4f3093);}});});}; \ No newline at end of file +var _0xb362=['info','debug','stringify','catch','error','message','ShowCmHopper','CreateCmHopper','UpdateCmHopper','update','body','limit','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','findAll','order','UPDATE','CmContact','User','Agent','name','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','length','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','voicePause','CmList','List','NOW()','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','../../config/logger','GetCmHopper','CmHopper','options','raw','where','attributes','include','map','model','then'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xb362,0x8a));var _0x2b36=function(_0x49ce01,_0x43026d){_0x49ce01=_0x49ce01-0x0;var _0x291129=_0xb362[_0x49ce01];return _0x291129;};'use strict';var _=require(_0x2b36('0x0'));var util=require(_0x2b36('0x1'));var moment=require(_0x2b36('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x2b36('0x3'))('rpc');exports[_0x2b36('0x4')]=function(_0x5acede){var _0xc034=this;return new Promise(function(_0x34a32a,_0x386032){return db[_0x2b36('0x5')]['findAll']({'raw':_0x5acede[_0x2b36('0x6')]?_0x5acede[_0x2b36('0x6')][_0x2b36('0x7')]===undefined?!![]:![]:!![],'where':_0x5acede[_0x2b36('0x6')]?_0x5acede[_0x2b36('0x6')][_0x2b36('0x8')]||null:null,'attributes':_0x5acede[_0x2b36('0x6')]?_0x5acede[_0x2b36('0x6')][_0x2b36('0x9')]||null:null,'limit':_0x5acede[_0x2b36('0x6')]?_0x5acede[_0x2b36('0x6')]['limit']||null:null,'include':_0x5acede[_0x2b36('0x6')]?_0x5acede[_0x2b36('0x6')][_0x2b36('0xa')]?_[_0x2b36('0xb')](_0x5acede[_0x2b36('0x6')][_0x2b36('0xa')],function(_0x312bf0){return{'model':db[_0x312bf0[_0x2b36('0xc')]],'as':_0x312bf0['as'],'attributes':_0x312bf0[_0x2b36('0x9')],'include':_0x312bf0[_0x2b36('0xa')]?_[_0x2b36('0xb')](_0x312bf0[_0x2b36('0xa')],function(_0x2ba663){return{'model':db[_0x2ba663[_0x2b36('0xc')]],'as':_0x2ba663['as'],'attributes':_0x2ba663[_0x2b36('0x9')],'include':_0x2ba663['include']?_['map'](_0x2ba663[_0x2b36('0xa')],function(_0x27dfab){return{'model':db[_0x27dfab[_0x2b36('0xc')]],'as':_0x27dfab['as'],'attributes':_0x27dfab[_0x2b36('0x9')]};}):[]};}):[]};}):[]:[]})[_0x2b36('0xd')](function(_0x11d3ff){logger[_0x2b36('0xe')](_0x2b36('0x4'),_0x5acede);logger[_0x2b36('0xf')]('GetCmHopper',_0x5acede,JSON[_0x2b36('0x10')](_0x11d3ff));_0x34a32a(_0x11d3ff);})[_0x2b36('0x11')](function(_0xbc9f31){logger[_0x2b36('0x12')]('GetCmHopper',_0xbc9f31['message'],_0x5acede);_0x386032(_0xc034['error'](0x1f4,_0xbc9f31[_0x2b36('0x13')]));});});};exports['ShowCmHopper']=function(_0x37a0ee){var _0x153fb9=this;return new Promise(function(_0x2eb7f3,_0x5518fe){return db[_0x2b36('0x5')]['find']({'raw':_0x37a0ee[_0x2b36('0x6')]?_0x37a0ee[_0x2b36('0x6')][_0x2b36('0x7')]===undefined?!![]:![]:!![],'where':_0x37a0ee[_0x2b36('0x6')]?_0x37a0ee[_0x2b36('0x6')][_0x2b36('0x8')]||null:null,'attributes':_0x37a0ee[_0x2b36('0x6')]?_0x37a0ee['options'][_0x2b36('0x9')]||null:null,'include':_0x37a0ee[_0x2b36('0x6')]?_0x37a0ee[_0x2b36('0x6')]['include']?_['map'](_0x37a0ee[_0x2b36('0x6')][_0x2b36('0xa')],function(_0x27cff4){return{'model':db[_0x27cff4[_0x2b36('0xc')]],'as':_0x27cff4['as'],'attributes':_0x27cff4[_0x2b36('0x9')],'include':_0x27cff4['include']?_[_0x2b36('0xb')](_0x27cff4[_0x2b36('0xa')],function(_0x54d6c3){return{'model':db[_0x54d6c3['model']],'as':_0x54d6c3['as'],'attributes':_0x54d6c3[_0x2b36('0x9')],'include':_0x54d6c3[_0x2b36('0xa')]?_[_0x2b36('0xb')](_0x54d6c3[_0x2b36('0xa')],function(_0x773074){return{'model':db[_0x773074['model']],'as':_0x773074['as'],'attributes':_0x773074[_0x2b36('0x9')]};}):[]};}):[]};}):[]:[]})[_0x2b36('0xd')](function(_0x2a7b13){logger[_0x2b36('0xe')](_0x2b36('0x14'),_0x37a0ee);logger[_0x2b36('0xf')](_0x2b36('0x14'),_0x37a0ee,JSON[_0x2b36('0x10')](_0x2a7b13));_0x2eb7f3(_0x2a7b13);})['catch'](function(_0x596cef){logger[_0x2b36('0x12')](_0x2b36('0x14'),_0x596cef[_0x2b36('0x13')],_0x37a0ee);_0x5518fe(_0x153fb9[_0x2b36('0x12')](0x1f4,_0x596cef[_0x2b36('0x13')]));});});};exports[_0x2b36('0x15')]=function(_0x43af42){var _0x2b4709=this;return new Promise(function(_0x48814b,_0x2d4566){return db[_0x2b36('0x5')]['create'](_0x43af42['body'],{'raw':_0x43af42[_0x2b36('0x6')]?_0x43af42[_0x2b36('0x6')][_0x2b36('0x7')]===undefined?!![]:![]:!![]})[_0x2b36('0xd')](function(_0x49f04d){logger[_0x2b36('0xe')]('CreateCmHopper',_0x43af42);logger[_0x2b36('0xf')](_0x2b36('0x15'),_0x43af42,JSON[_0x2b36('0x10')](_0x49f04d));_0x48814b(_0x49f04d);})[_0x2b36('0x11')](function(_0x10ddec){logger[_0x2b36('0x12')](_0x2b36('0x15'),_0x10ddec[_0x2b36('0x13')],_0x43af42);_0x2d4566(_0x2b4709[_0x2b36('0x12')](0x1f4,_0x10ddec[_0x2b36('0x13')]));});});};exports[_0x2b36('0x16')]=function(_0x40b905){var _0x34f7c5=this;return new Promise(function(_0x4e3365,_0x33052b){return db[_0x2b36('0x5')][_0x2b36('0x17')](_0x40b905[_0x2b36('0x18')],{'raw':_0x40b905[_0x2b36('0x6')]?_0x40b905[_0x2b36('0x6')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40b905['options']?_0x40b905['options'][_0x2b36('0x8')]||null:null,'attributes':_0x40b905[_0x2b36('0x6')]?_0x40b905[_0x2b36('0x6')][_0x2b36('0x9')]||null:null,'limit':_0x40b905[_0x2b36('0x6')]?_0x40b905[_0x2b36('0x6')][_0x2b36('0x19')]||null:null})[_0x2b36('0xd')](function(_0x37524f){logger['info'](_0x2b36('0x16'),_0x40b905);logger[_0x2b36('0xe')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x40b905['options'][_0x2b36('0x8')]),_0x40b905[_0x2b36('0x18')]['active']);logger[_0x2b36('0xf')]('UpdateCmHopper',_0x40b905,JSON[_0x2b36('0x10')](_0x37524f));_0x4e3365(_0x37524f);})[_0x2b36('0x11')](function(_0x19929a){logger['error']('UpdateCmHopper',_0x19929a[_0x2b36('0x13')],_0x40b905);_0x33052b(_0x34f7c5[_0x2b36('0x12')](0x1f4,_0x19929a['message']));});});};exports[_0x2b36('0x1a')]=function(_0x100b8b){var _0x35fcdb=this;return new Promise(function(_0x2fc00d,_0x9ad339){return db[_0x2b36('0x5')]['destroy']({'where':_0x100b8b[_0x2b36('0x6')]?_0x100b8b[_0x2b36('0x6')][_0x2b36('0x8')]||null:null})[_0x2b36('0xd')](function(_0x2e8153){logger[_0x2b36('0xe')](_0x2b36('0x1a'),_0x100b8b);logger[_0x2b36('0xf')](_0x2b36('0x1a'),_0x100b8b,JSON[_0x2b36('0x10')](_0x2e8153));_0x2fc00d(_0x2e8153);})['catch'](function(_0x113cb1){logger[_0x2b36('0x12')](_0x2b36('0x1a'),_0x113cb1[_0x2b36('0x13')],_0x100b8b);_0x9ad339(_0x35fcdb[_0x2b36('0x12')](0x1f4,_0x113cb1[_0x2b36('0x13')]));});});};exports[_0x2b36('0x1b')]=function(_0xa7edc8){var _0x1a05e5=this;return new Promise(function(_0x5d81cd,_0x3b9abc){return db['CmContact'][_0x2b36('0x1c')]()[_0x2b36('0xd')](function(_0x53bac2){return db[_0x2b36('0x1d')][_0x2b36('0x1e')](function(_0x4fccd7){return db[_0x2b36('0x5')][_0x2b36('0x1f')]({'where':_0xa7edc8[_0x2b36('0x6')]?_0xa7edc8[_0x2b36('0x6')][_0x2b36('0x8')]||null:null,'attributes':_0xa7edc8['options']?_0xa7edc8[_0x2b36('0x6')][_0x2b36('0x9')]||null:null,'limit':_0xa7edc8[_0x2b36('0x6')]?_0xa7edc8['options'][_0x2b36('0x19')]||null:null,'order':_0xa7edc8[_0x2b36('0x6')]?_0xa7edc8[_0x2b36('0x6')][_0x2b36('0x20')]||null:null,'transaction':_0x4fccd7,'lock':_0x4fccd7['LOCK'][_0x2b36('0x21')],'include':[{'model':db[_0x2b36('0x22')],'as':'Contact','attributes':_['keys'](_0x53bac2)},{'model':db[_0x2b36('0x23')],'as':_0x2b36('0x24'),'attributes':['id',_0x2b36('0x25'),'voicePause']}]})[_0x2b36('0xd')](function(_0xac82bd){var _0x5719e5=[];var _0x39503d=[];for(var _0x3c5ccc=0x0;_0x3c5ccc<_0xac82bd['length'];_0x3c5ccc+=0x1){var _0x2da01d=_0xac82bd[_0x3c5ccc][_0x2b36('0x26')];if(_0x2da01d===null){_0x5719e5['push'](_0xac82bd[_0x3c5ccc][_0x2b36('0x17')](_0xa7edc8['body'],{'transaction':_0x4fccd7}));}else if(!_0x39503d['includes'](_0x2da01d)){_0x39503d[_0x2b36('0x27')](_0x2da01d);_0x5719e5[_0x2b36('0x27')](_0xac82bd[_0x3c5ccc][_0x2b36('0x17')](_0xa7edc8[_0x2b36('0x18')],{'transaction':_0x4fccd7}));}}return BPromise[_0x2b36('0x28')](_0x5719e5);});})[_0x2b36('0xd')](function(_0x1adf26){logger[_0x2b36('0xe')]('GetContactDialer',_0xa7edc8);if(_0x1adf26['length']>0x0){logger['info'](_0x2b36('0x29'),_0x1adf26[0x0][_0x2b36('0x2a')]['id'],_0x1adf26[0x0][_0x2b36('0x2a')]['ContactId'],_0x1adf26[0x0][_0x2b36('0x2a')][_0x2b36('0x2b')]);}logger[_0x2b36('0xf')](_0x2b36('0x1b'),_0xa7edc8,JSON[_0x2b36('0x10')](_0x1adf26));_0x5d81cd(_0x1adf26);})[_0x2b36('0x11')](function(_0x258d4a){logger[_0x2b36('0x12')](_0x2b36('0x1b'),_0x258d4a[_0x2b36('0x13')],_0xa7edc8);_0x3b9abc(_0x1a05e5['error'](0x1f4,_0x258d4a[_0x2b36('0x13')]));});});});};exports[_0x2b36('0x2c')]=function(_0x3e76e2){var _0x82a979=this;return new Promise(function(_0x183c50,_0x1a3a39){return db[_0x2b36('0x1d')][_0x2b36('0x1e')](function(_0x9a70b3){return db[_0x2b36('0x2d')]['create'](_0x3e76e2[_0x2b36('0x18')],{'raw':_0x3e76e2[_0x2b36('0x6')]?_0x3e76e2[_0x2b36('0x6')][_0x2b36('0x7')]===undefined?!![]:![]:!![],'transaction':_0x9a70b3})[_0x2b36('0xd')](function(){logger[_0x2b36('0xe')](_0x2b36('0x2e'),JSON[_0x2b36('0x10')](_0x3e76e2[_0x2b36('0x6')][_0x2b36('0x8')]),_0x3e76e2[_0x2b36('0x6')][_0x2b36('0x8')]['active']);return db[_0x2b36('0x5')][_0x2b36('0x2f')]({'where':_0x3e76e2[_0x2b36('0x6')]?_0x3e76e2['options'][_0x2b36('0x8')]||null:null,'transaction':_0x9a70b3});});})[_0x2b36('0xd')](function(_0x362bf5){logger[_0x2b36('0xe')](_0x2b36('0x2c'),_0x3e76e2);logger[_0x2b36('0xf')](_0x2b36('0x2c'),_0x3e76e2,JSON[_0x2b36('0x10')](_0x362bf5));_0x183c50(_0x362bf5);})['catch'](function(_0x346e44){logger[_0x2b36('0x12')](_0x2b36('0x2c'),_0x346e44['message'],_0x3e76e2);_0x1a3a39(_0x82a979[_0x2b36('0x12')](0x1f4,_0x346e44['message']));});});};exports[_0x2b36('0x30')]=function(_0x323466){var _0x59f1bd=this;return new Promise(function(_0x2ca5b9,_0x4da49d){return db[_0x2b36('0x5')][_0x2b36('0x1f')]({'raw':_0x323466[_0x2b36('0x6')]?_0x323466['options'][_0x2b36('0x7')]===undefined?!![]:![]:!![],'where':_0x323466[_0x2b36('0x6')]?_0x323466[_0x2b36('0x6')]['where']||null:null,'attributes':[[db[_0x2b36('0x1d')]['fn'](_0x2b36('0x31'),db['sequelize']['fn']('IF',db[_0x2b36('0x1d')][_0x2b36('0x32')]('`scheduledat`\x20>=\x20'+util[_0x2b36('0x33')](_0x2b36('0x34'),moment()[_0x2b36('0x33')](_0x2b36('0x35')))+_0x2b36('0x36')))),_0x2b36('0x37')]]})[_0x2b36('0xd')](function(_0x374f40){logger[_0x2b36('0xe')](_0x2b36('0x30'),_0x323466);logger['debug'](_0x2b36('0x30'),_0x323466,JSON[_0x2b36('0x10')](_0x374f40));_0x2ca5b9(_0x374f40);})[_0x2b36('0x11')](function(_0x10afa0){logger[_0x2b36('0x12')](_0x2b36('0x30'),_0x10afa0[_0x2b36('0x13')],_0x323466);_0x4da49d(_0x59f1bd[_0x2b36('0x12')](0x1f4,_0x10afa0[_0x2b36('0x13')]));});});};exports['GetContactRecallMe']=function(_0xd23751){var _0x2f1277=this;return new Promise(function(_0x2402ee,_0x26b072){return db[_0x2b36('0x22')]['describe']()[_0x2b36('0xd')](function(){return db[_0x2b36('0x1d')][_0x2b36('0x1e')](function(_0x269b1e){return db['CmHopper'][_0x2b36('0x1f')]({'where':_0xd23751[_0x2b36('0x6')]?_0xd23751['options'][_0x2b36('0x8')]||null:null,'attributes':_0xd23751[_0x2b36('0x6')]?_0xd23751[_0x2b36('0x6')]['attributes']||null:null,'limit':0x1,'order':_0xd23751[_0x2b36('0x6')]?_0xd23751[_0x2b36('0x6')][_0x2b36('0x20')]||null:null,'group':db[_0x2b36('0x5')][_0x2b36('0x26')],'transaction':_0x269b1e,'lock':_0x269b1e['LOCK']['UPDATE'],'include':_0xd23751['options']?_0xd23751[_0x2b36('0x6')]['include']?_[_0x2b36('0xb')](_0xd23751[_0x2b36('0x6')][_0x2b36('0xa')],function(_0xa9c9ac){return{'model':db[_0xa9c9ac[_0x2b36('0xc')]],'as':_0xa9c9ac['as'],'attributes':_0xa9c9ac[_0x2b36('0x9')],'include':_0xa9c9ac[_0x2b36('0xa')]?_[_0x2b36('0xb')](_0xa9c9ac[_0x2b36('0xa')],function(_0x44d20d){return{'model':db[_0x44d20d[_0x2b36('0xc')]],'as':_0x44d20d['as'],'attributes':_0x44d20d[_0x2b36('0x9')],'include':_0x44d20d[_0x2b36('0xa')]?_[_0x2b36('0xb')](_0x44d20d['include'],function(_0x33396a){return{'model':db[_0x33396a['model']],'as':_0x33396a['as'],'attributes':_0x33396a[_0x2b36('0x9')]};}):[]};}):[]};}):[]:[]})[_0x2b36('0xd')](function(_0x4838ad){var _0x5e976a=[];for(var _0x5b4543=0x0;_0x5b4543<_0x4838ad[_0x2b36('0x38')];_0x5b4543+=0x1){_0x5e976a[_0x2b36('0x27')](_0x4838ad[_0x5b4543]['update'](_0xd23751[_0x2b36('0x18')],{'transaction':_0x269b1e}));}return BPromise[_0x2b36('0x28')](_0x5e976a);});})[_0x2b36('0xd')](function(_0x38375e){logger[_0x2b36('0xe')]('GetContactRecallMe',_0xd23751);logger['debug'](_0x2b36('0x39'),_0xd23751,JSON[_0x2b36('0x10')](_0x38375e));_0x2402ee(_0x38375e);})[_0x2b36('0x11')](function(_0x303b8e){logger[_0x2b36('0x12')](_0x2b36('0x39'),_0x303b8e[_0x2b36('0x13')],_0xd23751);_0x26b072(_0x2f1277[_0x2b36('0x12')](0x1f4,_0x303b8e[_0x2b36('0x13')]));});});});};exports[_0x2b36('0x3a')]=function(_0x28038a){var _0xf55960=this;return new Promise(function(_0x1341a5,_0x18ba86){db['CmContact'][_0x2b36('0x1c')]()[_0x2b36('0xd')](function(_0x56801c){return db[_0x2b36('0x5')][_0x2b36('0x1f')]({'raw':_0x28038a['options']?_0x28038a[_0x2b36('0x6')][_0x2b36('0x7')]===undefined?!![]:![]:!![],'where':_0x28038a[_0x2b36('0x6')]?_0x28038a['options'][_0x2b36('0x8')]||null:null,'attributes':_0x28038a[_0x2b36('0x6')]?_0x28038a['options'][_0x2b36('0x9')]||null:null,'limit':_0x28038a[_0x2b36('0x6')]?_0x28038a[_0x2b36('0x6')][_0x2b36('0x19')]||null:null,'include':_0x28038a[_0x2b36('0x6')]?_0x28038a[_0x2b36('0x6')][_0x2b36('0xa')]?_[_0x2b36('0xb')](_0x28038a['options'][_0x2b36('0xa')],function(_0x171587){return{'model':db[_0x171587[_0x2b36('0xc')]],'as':_0x171587['as'],'attributes':_0x171587['as']===_0x2b36('0x3b')?_[_0x2b36('0x3c')](_0x56801c):_0x171587['attributes'],'include':_0x171587[_0x2b36('0xa')]?_[_0x2b36('0xb')](_0x171587['include'],function(_0x5207ab){return{'model':db[_0x5207ab['model']],'as':_0x5207ab['as'],'attributes':_0x5207ab[_0x2b36('0x9')],'include':_0x5207ab[_0x2b36('0xa')]?_[_0x2b36('0xb')](_0x5207ab['include'],function(_0x430baa){return{'model':db[_0x430baa[_0x2b36('0xc')]],'as':_0x430baa['as'],'attributes':_0x430baa[_0x2b36('0x9')]};}):[]};}):[]};}):[]:[]})[_0x2b36('0xd')](function(_0x2bab2c){logger[_0x2b36('0xe')](_0x2b36('0x4'),_0x28038a);logger[_0x2b36('0xf')](_0x2b36('0x4'),_0x28038a,JSON['stringify'](_0x2bab2c));_0x1341a5(_0x2bab2c);})[_0x2b36('0x11')](function(_0x28841c){logger['error'](_0x2b36('0x4'),_0x28841c[_0x2b36('0x13')],_0x28038a);_0x18ba86(_0xf55960['error'](0x1f4,_0x28841c[_0x2b36('0x13')]));});});});};exports[_0x2b36('0x3d')]=function(_0x570429){var _0x433bb7=this;return new Promise(function(_0x2b50aa,_0x142833){return db[_0x2b36('0x22')]['findOne']({'raw':!![],'where':{'phone':_0x570429[_0x2b36('0x6')][_0x2b36('0x8')][_0x2b36('0x3e')]},'attributes':['id','dialTimezone'],'order':[['id',_0x2b36('0x3f')]]})[_0x2b36('0xd')](function(_0x2dc4b2){logger[_0x2b36('0xe')](_0x2b36('0x40'),_0x570429);logger[_0x2b36('0xf')](_0x2b36('0x40'),_0x570429,JSON[_0x2b36('0x10')](_0x2dc4b2));_0x2b50aa(_0x2dc4b2);})[_0x2b36('0x11')](function(_0x3c78dc){logger[_0x2b36('0x12')](_0x2b36('0x40'),_0x3c78dc['message'],_0x570429);_0x142833(_0x433bb7['error'](0x1f4,_0x3c78dc[_0x2b36('0x13')]));});});};exports[_0x2b36('0x41')]=function(_0x303319){var _0xbf3a68=this;return new Promise(function(_0x1ad883,_0x25f3aa){return db[_0x2b36('0x1d')][_0x2b36('0x1e')](function(_0x36d724){var _0x4cd8e9=_0x303319[_0x2b36('0x6')]&&_0x303319[_0x2b36('0x6')]['where']?_0x303319[_0x2b36('0x6')][_0x2b36('0x8')]:{};return db[_0x2b36('0x5')][_0x2b36('0x17')](_0x303319[_0x2b36('0x18')],{'where':_0x4cd8e9,'transaction':_0x36d724})[_0x2b36('0xd')](function(_0x213568){logger[_0x2b36('0xe')](_0x2b36('0x41'),_0x303319);logger['debug'](_0x2b36('0x41'),_0x303319,JSON[_0x2b36('0x10')](_0x213568));_0x1ad883(_0x213568);})[_0x2b36('0x11')](function(_0x48c7ed){logger[_0x2b36('0x12')](_0x2b36('0x41'),_0x48c7ed[_0x2b36('0x13')],_0x303319);_0x25f3aa(_0xbf3a68[_0x2b36('0x12')](0x1f4,_0x48c7ed['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4caf0f){var _0x31857a=this;var _0x41391b=_0x4caf0f['body'][_0x2b36('0x8')][_0x2b36('0x42')];var _0x42434b=_0x4caf0f[_0x2b36('0x18')][_0x2b36('0x8')][_0x2b36('0x43')];var _0x4e46a1=_0x4caf0f[_0x2b36('0x18')][_0x2b36('0x8')][_0x2b36('0x44')];return new Promise(function(_0x41699b,_0x1f5e8f){return db[_0x2b36('0x5')]['findAll']({'where':{'voiceQueueId':{'$in':_0x41391b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x2b36('0x1d')][_0x2b36('0x32')](_0x2b36('0x45')+_0x42434b+_0x2b36('0x46')),'$gt':db[_0x2b36('0x1d')]['literal']('NOW()')}},'UserId':{'$in':_0x4e46a1}},'include':[{'model':db[_0x2b36('0x22')],'as':_0x2b36('0x3b')},{'model':db[_0x2b36('0x23')],'as':_0x2b36('0x24'),'attributes':['id',_0x2b36('0x25'),_0x2b36('0x47')]},{'model':db[_0x2b36('0x48')],'as':_0x2b36('0x49')}]})[_0x2b36('0xd')](function(_0x50d9f8){if(_0x50d9f8[_0x2b36('0x38')]>0x0){return db[_0x2b36('0x1d')][_0x2b36('0x1e')](function(_0x151b3c){return db[_0x2b36('0x5')]['update']({'recallmeNotifiedDate':db[_0x2b36('0x1d')][_0x2b36('0x32')](_0x2b36('0x4a'))},{'where':{'id':{'$in':_[_0x2b36('0xb')](_0x50d9f8,'id')}},'transaction':_0x151b3c})[_0x2b36('0xd')](function(){_0x41699b(_0x50d9f8);})[_0x2b36('0x11')](function(_0x3b7e81){logger[_0x2b36('0x12')](_0x2b36('0x4b'),_0x3b7e81[_0x2b36('0x13')],_0x4caf0f);_0x1f5e8f(_0x31857a[_0x2b36('0x12')](0x1f4,_0x3b7e81['message']));});})[_0x2b36('0x11')](function(_0x36e768){logger[_0x2b36('0x12')](_0x2b36('0x4b'),_0x36e768[_0x2b36('0x13')],_0x4caf0f);_0x1f5e8f(_0x31857a[_0x2b36('0x12')](0x1f4,_0x36e768['message']));});}else{_0x41699b(_0x50d9f8);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 241db68..a70dbf8 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 _0xa848=['delete','destroy','exports','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','create','post','getPreview','/timezone','/:id','update'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa848,0xdf));var _0x8a84=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa848[_0x3ab51d];return _0x29a04e;};'use strict';var express=require('express');var router=express[_0x8a84('0x0')]();var auth=require(_0x8a84('0x1'));var controller=require('./cmHopper.controller');router[_0x8a84('0x2')]('/',auth[_0x8a84('0x3')](),controller[_0x8a84('0x4')]);router[_0x8a84('0x2')](_0x8a84('0x5'),auth['isAuthenticated'](),controller[_0x8a84('0x6')]);router[_0x8a84('0x2')](_0x8a84('0x7'),auth[_0x8a84('0x3')](),controller['getOpenContacts']);router[_0x8a84('0x2')](_0x8a84('0x8'),auth[_0x8a84('0x3')](),controller[_0x8a84('0x9')]);router['get']('/:id',auth[_0x8a84('0x3')](),controller[_0x8a84('0xa')]);router[_0x8a84('0x2')](_0x8a84('0xb'),auth[_0x8a84('0x3')](),controller[_0x8a84('0xc')]);router['post']('/',auth[_0x8a84('0x3')](),controller[_0x8a84('0xd')]);router[_0x8a84('0xe')]('/preview',auth[_0x8a84('0x3')](),controller[_0x8a84('0xf')]);router['post'](_0x8a84('0x10'),auth[_0x8a84('0x3')](),controller['getTimezone']);router['put'](_0x8a84('0x11'),auth[_0x8a84('0x3')](),controller[_0x8a84('0x12')]);router[_0x8a84('0x13')](_0x8a84('0x11'),auth[_0x8a84('0x3')](),controller[_0x8a84('0x14')]);module[_0x8a84('0x15')]=router; \ No newline at end of file +var _0x4a7c=['destroy','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getTimezones','/:id','getPreviewRecall','create','/preview','getPreview','post','/timezone','getTimezone','update','delete'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x4a7c,0x1a5));var _0xc4a7=function(_0x3decd9,_0x31fce5){_0x3decd9=_0x3decd9-0x0;var _0x4623f7=_0x4a7c[_0x3decd9];return _0x4623f7;};'use strict';var express=require('express');var router=express[_0xc4a7('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xc4a7('0x1'));router[_0xc4a7('0x2')]('/',auth[_0xc4a7('0x3')](),controller[_0xc4a7('0x4')]);router[_0xc4a7('0x2')](_0xc4a7('0x5'),auth[_0xc4a7('0x3')](),controller[_0xc4a7('0x6')]);router[_0xc4a7('0x2')](_0xc4a7('0x7'),auth[_0xc4a7('0x3')](),controller['getOpenContacts']);router[_0xc4a7('0x2')]('/timezones',auth[_0xc4a7('0x3')](),controller[_0xc4a7('0x8')]);router[_0xc4a7('0x2')](_0xc4a7('0x9'),auth[_0xc4a7('0x3')](),controller['show']);router['get']('/:id/previewrecall',auth['isAuthenticated'](),controller[_0xc4a7('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc4a7('0xb')]);router['post'](_0xc4a7('0xc'),auth[_0xc4a7('0x3')](),controller[_0xc4a7('0xd')]);router[_0xc4a7('0xe')](_0xc4a7('0xf'),auth[_0xc4a7('0x3')](),controller[_0xc4a7('0x10')]);router['put'](_0xc4a7('0x9'),auth['isAuthenticated'](),controller[_0xc4a7('0x11')]);router[_0xc4a7('0x12')](_0xc4a7('0x9'),auth[_0xc4a7('0x3')](),controller[_0xc4a7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 92eb9f8..4e4c197 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49cd=['STRING','DATE','moment','exports','INTEGER'];(function(_0x270af2,_0x1ee972){var _0x5948f0=function(_0x69dd0e){while(--_0x69dd0e){_0x270af2['push'](_0x270af2['shift']());}};_0x5948f0(++_0x1ee972);}(_0x49cd,0x1ec));var _0xd49c=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x49cd[_0x5ebc04];return _0x17845c;};'use strict';var moment=require(_0xd49c('0x0'));var Sequelize=require('sequelize');module[_0xd49c('0x1')]={'CmHopperId':{'type':Sequelize[_0xd49c('0x2')]},'phone':{'type':Sequelize[_0xd49c('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xd49c('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd49c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b23=['exports','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x1389f3,_0xe01bdf){var _0x1b791b=function(_0x2fc514){while(--_0x2fc514){_0x1389f3['push'](_0x1389f3['shift']());}};_0x1b791b(++_0xe01bdf);}(_0x3b23,0x11c));var _0x33b2=function(_0x3b3a2b,_0xa63181){_0x3b3a2b=_0x3b3a2b-0x0;var _0x43228c=_0x3b23[_0x3b3a2b];return _0x43228c;};'use strict';var moment=require(_0x33b2('0x0'));var Sequelize=require('sequelize');module[_0x33b2('0x1')]={'CmHopperId':{'type':Sequelize[_0x33b2('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x33b2('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x33b2('0x3')],'defaultValue':moment()['format'](_0x33b2('0x4'))},'countbusyretry':{'type':Sequelize[_0x33b2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x33b2('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x33b2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x33b2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x33b2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x33b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 6df0cc8..aea8aeb 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d54=['include','findAll','params','keys','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','status','end','sendStatus','error','stack','name','index','CmHopperAdditionalPhone','rawAttributes','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5d54,0x14e));var _0x45d5=function(_0xcd3753,_0x5f170f){_0xcd3753=_0xcd3753-0x0;var _0x4831f1=_0x5d54[_0xcd3753];return _0x4831f1;};'use strict';var emlformat=require(_0x45d5('0x0'));var rimraf=require(_0x45d5('0x1'));var zipdir=require(_0x45d5('0x2'));var jsonpatch=require(_0x45d5('0x3'));var rp=require(_0x45d5('0x4'));var moment=require(_0x45d5('0x5'));var BPromise=require(_0x45d5('0x6'));var Mustache=require(_0x45d5('0x7'));var util=require(_0x45d5('0x8'));var path=require(_0x45d5('0x9'));var sox=require(_0x45d5('0xa'));var csv=require(_0x45d5('0xb'));var ejs=require(_0x45d5('0xc'));var fs=require('fs');var fs_extra=require(_0x45d5('0xd'));var _=require(_0x45d5('0xe'));var squel=require('squel');var crypto=require(_0x45d5('0xf'));var jsforce=require(_0x45d5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x45d5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x45d5('0x11'));var qs=require(_0x45d5('0x12'));var as=require(_0x45d5('0x13'));var hardwareService=require(_0x45d5('0x14'));var logger=require('../../config/logger')(_0x45d5('0x15'));var utils=require(_0x45d5('0x16'));var config=require(_0x45d5('0x17'));var licenseUtil=require(_0x45d5('0x18'));var db=require(_0x45d5('0x19'))['db'];function respondWithStatusCode(_0x3f6e23,_0x339e27){_0x339e27=_0x339e27||0xcc;return function(_0x27cc4c){if(_0x27cc4c){return _0x3f6e23['sendStatus'](_0x339e27);}return _0x3f6e23['status'](_0x339e27)['end']();};}function respondWithResult(_0xf736a8,_0x329849){_0x329849=_0x329849||0xc8;return function(_0x9bd7c9){if(_0x9bd7c9){return _0xf736a8['status'](_0x329849)[_0x45d5('0x1a')](_0x9bd7c9);}};}function respondWithFilteredResult(_0x123e50,_0x4a0c40){return function(_0x3f15f4){if(_0x3f15f4){var _0x5378dc=typeof _0x4a0c40[_0x45d5('0x1b')]===_0x45d5('0x1c')&&typeof _0x4a0c40[_0x45d5('0x1d')]===_0x45d5('0x1c');var _0x52a60b=_0x3f15f4[_0x45d5('0x1e')];var _0x5db259=_0x5378dc?0x0:_0x4a0c40[_0x45d5('0x1b')];var _0x1204ff=_0x5378dc?_0x3f15f4[_0x45d5('0x1e')]:_0x4a0c40[_0x45d5('0x1b')]+_0x4a0c40[_0x45d5('0x1d')];var _0x5123ee;if(_0x1204ff>=_0x52a60b){_0x1204ff=_0x52a60b;_0x5123ee=0xc8;}else{_0x5123ee=0xce;}_0x123e50['status'](_0x5123ee);return _0x123e50[_0x45d5('0x1f')](_0x45d5('0x20'),_0x5db259+'-'+_0x1204ff+'/'+_0x52a60b)['json'](_0x3f15f4);}return null;};}function patchUpdates(_0x4b06ee){return function(_0x294b47){try{jsonpatch[_0x45d5('0x21')](_0x294b47,_0x4b06ee,!![]);}catch(_0xb5924d){return BPromise[_0x45d5('0x22')](_0xb5924d);}return _0x294b47[_0x45d5('0x23')]();};}function saveUpdates(_0x1c1e6d,_0xc51856){return function(_0x18e353){if(_0x18e353){return _0x18e353['update'](_0x1c1e6d)['then'](function(_0x1ac511){return _0x1ac511;});}return null;};}function removeEntity(_0x427818,_0x4721f0){return function(_0x365d72){if(_0x365d72){return _0x365d72[_0x45d5('0x24')]()[_0x45d5('0x25')](function(){var _0x58f278=_0x365d72[_0x45d5('0x26')]({'plain':!![]});var _0x2da742='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x45d5('0x24')]({'where':{'type':_0x2da742,'resourceId':_0x58f278['id']}})[_0x45d5('0x25')](function(){return _0x365d72;});})[_0x45d5('0x25')](function(){_0x427818[_0x45d5('0x27')](0xcc)[_0x45d5('0x28')]();});}};}function handleEntityNotFound(_0x2edf4e,_0x3b6aa6){return function(_0x4a5b13){if(!_0x4a5b13){_0x2edf4e[_0x45d5('0x29')](0x194);}return _0x4a5b13;};}function handleError(_0x76082a,_0x488369){_0x488369=_0x488369||0x1f4;return function(_0x321a7d){logger[_0x45d5('0x2a')](_0x321a7d[_0x45d5('0x2b')]);if(_0x321a7d['name']){delete _0x321a7d[_0x45d5('0x2c')];}_0x76082a[_0x45d5('0x27')](_0x488369)['send'](_0x321a7d);};}exports[_0x45d5('0x2d')]=function(_0x593f72,_0x329d60){var _0x4bc61e={},_0x421f83={},_0x342fd7={'count':0x0,'rows':[]};var _0x49f958=_['map'](db[_0x45d5('0x2e')][_0x45d5('0x2f')],function(_0x37a2ca){return{'name':_0x37a2ca['fieldName'],'type':_0x37a2ca[_0x45d5('0x30')][_0x45d5('0x31')]};});_0x421f83[_0x45d5('0x32')]=_[_0x45d5('0x33')](_0x49f958,_0x45d5('0x2c'));_0x421f83['query']=_['keys'](_0x593f72['query']);_0x421f83[_0x45d5('0x34')]=_[_0x45d5('0x35')](_0x421f83['model'],_0x421f83[_0x45d5('0x36')]);_0x4bc61e[_0x45d5('0x37')]=_[_0x45d5('0x35')](_0x421f83[_0x45d5('0x32')],qs[_0x45d5('0x38')](_0x593f72[_0x45d5('0x36')][_0x45d5('0x38')]));_0x4bc61e[_0x45d5('0x37')]=_0x4bc61e[_0x45d5('0x37')][_0x45d5('0x39')]?_0x4bc61e[_0x45d5('0x37')]:_0x421f83[_0x45d5('0x32')];if(!_0x593f72[_0x45d5('0x36')][_0x45d5('0x3a')](_0x45d5('0x3b'))){_0x4bc61e[_0x45d5('0x1d')]=qs[_0x45d5('0x1d')](_0x593f72[_0x45d5('0x36')][_0x45d5('0x1d')]);_0x4bc61e[_0x45d5('0x1b')]=qs[_0x45d5('0x1b')](_0x593f72[_0x45d5('0x36')][_0x45d5('0x1b')]);}_0x4bc61e['order']=qs[_0x45d5('0x3c')](_0x593f72[_0x45d5('0x36')][_0x45d5('0x3c')]);_0x4bc61e[_0x45d5('0x3d')]=qs[_0x45d5('0x34')](_[_0x45d5('0x3e')](_0x593f72[_0x45d5('0x36')],_0x421f83[_0x45d5('0x34')]),_0x49f958);if(_0x593f72[_0x45d5('0x36')][_0x45d5('0x3f')]){_0x4bc61e[_0x45d5('0x3d')]=_['merge'](_0x4bc61e[_0x45d5('0x3d')],{'$or':_['map'](_0x49f958,function(_0x27547d){if(_0x27547d[_0x45d5('0x30')]!=='VIRTUAL'){var _0x1375ec={};_0x1375ec[_0x27547d['name']]={'$like':'%'+_0x593f72['query'][_0x45d5('0x3f')]+'%'};return _0x1375ec;}})});}_0x4bc61e=_[_0x45d5('0x40')]({},_0x4bc61e,_0x593f72['options']);var _0x1dbe6f={'where':_0x4bc61e['where']};return db['CmHopperAdditionalPhone'][_0x45d5('0x1e')](_0x1dbe6f)[_0x45d5('0x25')](function(_0x521272){_0x342fd7[_0x45d5('0x1e')]=_0x521272;if(_0x593f72[_0x45d5('0x36')][_0x45d5('0x41')]){_0x4bc61e[_0x45d5('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x45d5('0x43')](_0x4bc61e);})[_0x45d5('0x25')](function(_0xedac3){_0x342fd7['rows']=_0xedac3;return _0x342fd7;})['then'](respondWithFilteredResult(_0x329d60,_0x4bc61e))['catch'](handleError(_0x329d60,null));};exports['show']=function(_0x1ef453,_0x573725){var _0x5d2787={'raw':!![],'where':{'id':_0x1ef453[_0x45d5('0x44')]['id']}},_0x16c5f1={};_0x16c5f1[_0x45d5('0x32')]=_[_0x45d5('0x45')](db[_0x45d5('0x2e')][_0x45d5('0x2f')]);_0x16c5f1[_0x45d5('0x36')]=_[_0x45d5('0x45')](_0x1ef453[_0x45d5('0x36')]);_0x16c5f1[_0x45d5('0x34')]=_['intersection'](_0x16c5f1[_0x45d5('0x32')],_0x16c5f1[_0x45d5('0x36')]);_0x5d2787['attributes']=_[_0x45d5('0x35')](_0x16c5f1['model'],qs[_0x45d5('0x38')](_0x1ef453[_0x45d5('0x36')]['fields']));_0x5d2787[_0x45d5('0x37')]=_0x5d2787[_0x45d5('0x37')][_0x45d5('0x39')]?_0x5d2787['attributes']:_0x16c5f1[_0x45d5('0x32')];if(_0x1ef453['query'][_0x45d5('0x41')]){_0x5d2787['include']=[{'all':!![]}];}_0x5d2787=_[_0x45d5('0x40')]({},_0x5d2787,_0x1ef453['options']);return db['CmHopperAdditionalPhone']['find'](_0x5d2787)[_0x45d5('0x25')](handleEntityNotFound(_0x573725,null))[_0x45d5('0x25')](respondWithResult(_0x573725,null))[_0x45d5('0x46')](handleError(_0x573725,null));};exports['create']=function(_0x5896ae,_0x348fd6){return db[_0x45d5('0x2e')][_0x45d5('0x47')](_0x5896ae['body'],{})['then'](function(_0x63fb66){var _0x4979fa=_0x5896ae['user'][_0x45d5('0x26')]({'plain':!![]});if(!_0x4979fa)throw new Error(_0x45d5('0x48'));if(_0x4979fa[_0x45d5('0x49')]===_0x45d5('0x4a')){var _0x542b3b=_0x63fb66[_0x45d5('0x26')]({'plain':!![]});var _0x563401='CmHopperAdditionalPhones';return db[_0x45d5('0x4b')]['find']({'where':{'name':_0x563401,'userProfileId':_0x4979fa[_0x45d5('0x4c')]},'raw':!![]})[_0x45d5('0x25')](function(_0x262006){if(_0x262006&&_0x262006['autoAssociation']===0x0){return db['UserProfileResource'][_0x45d5('0x47')]({'name':_0x542b3b[_0x45d5('0x2c')],'resourceId':_0x542b3b['id'],'type':_0x262006[_0x45d5('0x2c')],'sectionId':_0x262006['id']},{})[_0x45d5('0x25')](function(){return _0x63fb66;});}else{return _0x63fb66;}})[_0x45d5('0x46')](function(_0x5413ab){logger[_0x45d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5413ab);throw _0x5413ab;});}return _0x63fb66;})[_0x45d5('0x25')](respondWithResult(_0x348fd6,0xc9))[_0x45d5('0x46')](handleError(_0x348fd6,null));};exports[_0x45d5('0x4d')]=function(_0x539f00,_0x4fc288){if(_0x539f00['body']['id']){delete _0x539f00[_0x45d5('0x4e')]['id'];}return db[_0x45d5('0x2e')][_0x45d5('0x4f')]({'where':{'id':_0x539f00[_0x45d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fc288,null))[_0x45d5('0x25')](saveUpdates(_0x539f00['body'],null))[_0x45d5('0x25')](respondWithResult(_0x4fc288,null))[_0x45d5('0x46')](handleError(_0x4fc288,null));};exports[_0x45d5('0x24')]=function(_0x282390,_0x9efbe8){return db[_0x45d5('0x2e')][_0x45d5('0x4f')]({'where':{'id':_0x282390[_0x45d5('0x44')]['id']}})[_0x45d5('0x25')](handleEntityNotFound(_0x9efbe8,null))['then'](removeEntity(_0x9efbe8,null))[_0x45d5('0x46')](handleError(_0x9efbe8,null));}; \ No newline at end of file +var _0x0a19=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','CmHopperAdditionalPhones','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x1062e1,_0x1eaca6){var _0x39f989=function(_0x36c0d3){while(--_0x36c0d3){_0x1062e1['push'](_0x1062e1['shift']());}};_0x39f989(++_0x1eaca6);}(_0x0a19,0x1f3));var _0x90a1=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x0a19[_0x24f31b];return _0x488401;};'use strict';var emlformat=require(_0x90a1('0x0'));var rimraf=require(_0x90a1('0x1'));var zipdir=require(_0x90a1('0x2'));var jsonpatch=require(_0x90a1('0x3'));var rp=require(_0x90a1('0x4'));var moment=require(_0x90a1('0x5'));var BPromise=require(_0x90a1('0x6'));var Mustache=require(_0x90a1('0x7'));var util=require(_0x90a1('0x8'));var path=require('path');var sox=require(_0x90a1('0x9'));var csv=require(_0x90a1('0xa'));var ejs=require(_0x90a1('0xb'));var fs=require('fs');var fs_extra=require(_0x90a1('0xc'));var _=require(_0x90a1('0xd'));var squel=require('squel');var crypto=require(_0x90a1('0xe'));var jsforce=require(_0x90a1('0xf'));var deskjs=require(_0x90a1('0x10'));var toCsv=require(_0x90a1('0xa'));var querystring=require(_0x90a1('0x11'));var Papa=require(_0x90a1('0x12'));var Redis=require(_0x90a1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x90a1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90a1('0x15'));var logger=require('../../config/logger')(_0x90a1('0x16'));var utils=require(_0x90a1('0x17'));var config=require(_0x90a1('0x18'));var licenseUtil=require(_0x90a1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530eb1,_0x2781c8){_0x2781c8=_0x2781c8||0xcc;return function(_0x44ad74){if(_0x44ad74){return _0x530eb1[_0x90a1('0x1a')](_0x2781c8);}return _0x530eb1[_0x90a1('0x1b')](_0x2781c8)[_0x90a1('0x1c')]();};}function respondWithResult(_0x373dc8,_0x50aa04){_0x50aa04=_0x50aa04||0xc8;return function(_0x1309c0){if(_0x1309c0){return _0x373dc8[_0x90a1('0x1b')](_0x50aa04)[_0x90a1('0x1d')](_0x1309c0);}};}function respondWithFilteredResult(_0x4ec859,_0x4919cb){return function(_0x3febb0){if(_0x3febb0){var _0x1286f9=typeof _0x4919cb[_0x90a1('0x1e')]==='undefined'&&typeof _0x4919cb[_0x90a1('0x1f')]===_0x90a1('0x20');var _0x1bd16b=_0x3febb0[_0x90a1('0x21')];var _0x3df0df=_0x1286f9?0x0:_0x4919cb[_0x90a1('0x1e')];var _0x433d73=_0x1286f9?_0x3febb0[_0x90a1('0x21')]:_0x4919cb[_0x90a1('0x1e')]+_0x4919cb[_0x90a1('0x1f')];var _0x44e2b6;if(_0x433d73>=_0x1bd16b){_0x433d73=_0x1bd16b;_0x44e2b6=0xc8;}else{_0x44e2b6=0xce;}_0x4ec859[_0x90a1('0x1b')](_0x44e2b6);return _0x4ec859[_0x90a1('0x22')](_0x90a1('0x23'),_0x3df0df+'-'+_0x433d73+'/'+_0x1bd16b)[_0x90a1('0x1d')](_0x3febb0);}return null;};}function patchUpdates(_0x3d28a9){return function(_0x4b7db2){try{jsonpatch['apply'](_0x4b7db2,_0x3d28a9,!![]);}catch(_0x5ae7a5){return BPromise[_0x90a1('0x24')](_0x5ae7a5);}return _0x4b7db2['save']();};}function saveUpdates(_0x5e2ee9,_0x71903d){return function(_0xc1ca0b){if(_0xc1ca0b){return _0xc1ca0b[_0x90a1('0x25')](_0x5e2ee9)[_0x90a1('0x26')](function(_0x51f228){return _0x51f228;});}return null;};}function removeEntity(_0x53f92f,_0x16ca62){return function(_0x42958f){if(_0x42958f){return _0x42958f[_0x90a1('0x27')]()[_0x90a1('0x26')](function(){var _0x387900=_0x42958f[_0x90a1('0x28')]({'plain':!![]});var _0x86902=_0x90a1('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x86902,'resourceId':_0x387900['id']}})[_0x90a1('0x26')](function(){return _0x42958f;});})[_0x90a1('0x26')](function(){_0x53f92f[_0x90a1('0x1b')](0xcc)[_0x90a1('0x1c')]();});}};}function handleEntityNotFound(_0x648c17,_0x1ff70e){return function(_0x47e6e3){if(!_0x47e6e3){_0x648c17[_0x90a1('0x1a')](0x194);}return _0x47e6e3;};}function handleError(_0x4c18e3,_0x45128a){_0x45128a=_0x45128a||0x1f4;return function(_0x42b716){logger['error'](_0x42b716[_0x90a1('0x2a')]);if(_0x42b716[_0x90a1('0x2b')]){delete _0x42b716[_0x90a1('0x2b')];}_0x4c18e3['status'](_0x45128a)['send'](_0x42b716);};}exports[_0x90a1('0x2c')]=function(_0x112691,_0x4d5a4d){var _0x5e529a={},_0x3d3910={},_0x162fa6={'count':0x0,'rows':[]};var _0x5ea88a=_[_0x90a1('0x2d')](db[_0x90a1('0x2e')][_0x90a1('0x2f')],function(_0x1fd2ca){return{'name':_0x1fd2ca[_0x90a1('0x30')],'type':_0x1fd2ca[_0x90a1('0x31')][_0x90a1('0x32')]};});_0x3d3910['model']=_[_0x90a1('0x2d')](_0x5ea88a,_0x90a1('0x2b'));_0x3d3910[_0x90a1('0x33')]=_[_0x90a1('0x34')](_0x112691['query']);_0x3d3910[_0x90a1('0x35')]=_['intersection'](_0x3d3910[_0x90a1('0x36')],_0x3d3910['query']);_0x5e529a['attributes']=_[_0x90a1('0x37')](_0x3d3910[_0x90a1('0x36')],qs[_0x90a1('0x38')](_0x112691[_0x90a1('0x33')][_0x90a1('0x38')]));_0x5e529a[_0x90a1('0x39')]=_0x5e529a[_0x90a1('0x39')][_0x90a1('0x3a')]?_0x5e529a[_0x90a1('0x39')]:_0x3d3910[_0x90a1('0x36')];if(!_0x112691[_0x90a1('0x33')][_0x90a1('0x3b')](_0x90a1('0x3c'))){_0x5e529a[_0x90a1('0x1f')]=qs[_0x90a1('0x1f')](_0x112691['query'][_0x90a1('0x1f')]);_0x5e529a[_0x90a1('0x1e')]=qs[_0x90a1('0x1e')](_0x112691['query'][_0x90a1('0x1e')]);}_0x5e529a[_0x90a1('0x3d')]=qs[_0x90a1('0x3e')](_0x112691[_0x90a1('0x33')]['sort']);_0x5e529a[_0x90a1('0x3f')]=qs[_0x90a1('0x35')](_[_0x90a1('0x40')](_0x112691[_0x90a1('0x33')],_0x3d3910['filters']),_0x5ea88a);if(_0x112691[_0x90a1('0x33')][_0x90a1('0x41')]){_0x5e529a['where']=_[_0x90a1('0x42')](_0x5e529a['where'],{'$or':_[_0x90a1('0x2d')](_0x5ea88a,function(_0x26d4b5){if(_0x26d4b5[_0x90a1('0x31')]!==_0x90a1('0x43')){var _0xa95f9={};_0xa95f9[_0x26d4b5[_0x90a1('0x2b')]]={'$like':'%'+_0x112691[_0x90a1('0x33')][_0x90a1('0x41')]+'%'};return _0xa95f9;}})});}_0x5e529a=_['merge']({},_0x5e529a,_0x112691[_0x90a1('0x44')]);var _0x1a8945={'where':_0x5e529a['where']};return db['CmHopperAdditionalPhone']['count'](_0x1a8945)[_0x90a1('0x26')](function(_0x5620fa){_0x162fa6['count']=_0x5620fa;if(_0x112691['query'][_0x90a1('0x45')]){_0x5e529a[_0x90a1('0x46')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x5e529a);})[_0x90a1('0x26')](function(_0x286e72){_0x162fa6[_0x90a1('0x47')]=_0x286e72;return _0x162fa6;})['then'](respondWithFilteredResult(_0x4d5a4d,_0x5e529a))['catch'](handleError(_0x4d5a4d,null));};exports[_0x90a1('0x48')]=function(_0x2cdd8c,_0x4d7291){var _0x1be34c={'raw':!![],'where':{'id':_0x2cdd8c[_0x90a1('0x49')]['id']}},_0x3c7d7e={};_0x3c7d7e['model']=_[_0x90a1('0x34')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x3c7d7e[_0x90a1('0x33')]=_[_0x90a1('0x34')](_0x2cdd8c[_0x90a1('0x33')]);_0x3c7d7e[_0x90a1('0x35')]=_['intersection'](_0x3c7d7e['model'],_0x3c7d7e['query']);_0x1be34c[_0x90a1('0x39')]=_[_0x90a1('0x37')](_0x3c7d7e[_0x90a1('0x36')],qs[_0x90a1('0x38')](_0x2cdd8c['query']['fields']));_0x1be34c['attributes']=_0x1be34c[_0x90a1('0x39')][_0x90a1('0x3a')]?_0x1be34c[_0x90a1('0x39')]:_0x3c7d7e[_0x90a1('0x36')];if(_0x2cdd8c[_0x90a1('0x33')][_0x90a1('0x45')]){_0x1be34c['include']=[{'all':!![]}];}_0x1be34c=_[_0x90a1('0x42')]({},_0x1be34c,_0x2cdd8c[_0x90a1('0x44')]);return db[_0x90a1('0x2e')][_0x90a1('0x4a')](_0x1be34c)[_0x90a1('0x26')](handleEntityNotFound(_0x4d7291,null))[_0x90a1('0x26')](respondWithResult(_0x4d7291,null))[_0x90a1('0x4b')](handleError(_0x4d7291,null));};exports[_0x90a1('0x4c')]=function(_0xf65e0d,_0x5a1499){return db[_0x90a1('0x2e')][_0x90a1('0x4c')](_0xf65e0d[_0x90a1('0x4d')],{})[_0x90a1('0x26')](function(_0x2e5a86){var _0x2d7d05=_0xf65e0d[_0x90a1('0x4e')]['get']({'plain':!![]});if(!_0x2d7d05)throw new Error(_0x90a1('0x4f'));if(_0x2d7d05[_0x90a1('0x50')]===_0x90a1('0x4e')){var _0x9412f4=_0x2e5a86[_0x90a1('0x28')]({'plain':!![]});var _0x972b69=_0x90a1('0x29');return db[_0x90a1('0x51')][_0x90a1('0x4a')]({'where':{'name':_0x972b69,'userProfileId':_0x2d7d05[_0x90a1('0x52')]},'raw':!![]})[_0x90a1('0x26')](function(_0x4860fc){if(_0x4860fc&&_0x4860fc[_0x90a1('0x53')]===0x0){return db['UserProfileResource'][_0x90a1('0x4c')]({'name':_0x9412f4[_0x90a1('0x2b')],'resourceId':_0x9412f4['id'],'type':_0x4860fc[_0x90a1('0x2b')],'sectionId':_0x4860fc['id']},{})['then'](function(){return _0x2e5a86;});}else{return _0x2e5a86;}})[_0x90a1('0x4b')](function(_0x44dd28){logger[_0x90a1('0x54')](_0x90a1('0x55'),_0x44dd28);throw _0x44dd28;});}return _0x2e5a86;})[_0x90a1('0x26')](respondWithResult(_0x5a1499,0xc9))[_0x90a1('0x4b')](handleError(_0x5a1499,null));};exports[_0x90a1('0x25')]=function(_0x4ecf85,_0x7e5cd9){if(_0x4ecf85[_0x90a1('0x4d')]['id']){delete _0x4ecf85[_0x90a1('0x4d')]['id'];}return db[_0x90a1('0x2e')][_0x90a1('0x4a')]({'where':{'id':_0x4ecf85[_0x90a1('0x49')]['id']}})[_0x90a1('0x26')](handleEntityNotFound(_0x7e5cd9,null))[_0x90a1('0x26')](saveUpdates(_0x4ecf85[_0x90a1('0x4d')],null))[_0x90a1('0x26')](respondWithResult(_0x7e5cd9,null))[_0x90a1('0x4b')](handleError(_0x7e5cd9,null));};exports[_0x90a1('0x27')]=function(_0x52ba9e,_0x3f6187){return db[_0x90a1('0x2e')]['find']({'where':{'id':_0x52ba9e['params']['id']}})[_0x90a1('0x26')](handleEntityNotFound(_0x3f6187,null))[_0x90a1('0x26')](removeEntity(_0x3f6187,null))['catch'](handleError(_0x3f6187,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 302ee09..47117b5 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca9d=['moment','../../config/environment','./cmHopperAdditionalPhone.attributes','define','lodash','util','../../config/logger','api'];(function(_0x14261d,_0x4a2ecc){var _0x37202c=function(_0x6f5de2){while(--_0x6f5de2){_0x14261d['push'](_0x14261d['shift']());}};_0x37202c(++_0x4a2ecc);}(_0xca9d,0x15c));var _0xdca9=function(_0x45d520,_0x271cca){_0x45d520=_0x45d520-0x0;var _0xb6f110=_0xca9d[_0x45d520];return _0xb6f110;};'use strict';var _=require(_0xdca9('0x0'));var util=require(_0xdca9('0x1'));var logger=require(_0xdca9('0x2'))(_0xdca9('0x3'));var moment=require(_0xdca9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdca9('0x5'));var attributes=require(_0xdca9('0x6'));module['exports']=function(_0x1fc077,_0x58ce22){return _0x1fc077[_0xdca9('0x7')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bf8=['request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4ea728,_0x3ba8a8){var _0x290764=function(_0x35f0e0){while(--_0x35f0e0){_0x4ea728['push'](_0x4ea728['shift']());}};_0x290764(++_0x3ba8a8);}(_0x8bf8,0x126));var _0x88bf=function(_0x469d98,_0x2a4896){_0x469d98=_0x469d98-0x0;var _0x1a53e0=_0x8bf8[_0x469d98];return _0x1a53e0;};'use strict';var _=require(_0x88bf('0x0'));var util=require(_0x88bf('0x1'));var logger=require(_0x88bf('0x2'))(_0x88bf('0x3'));var moment=require(_0x88bf('0x4'));var BPromise=require(_0x88bf('0x5'));var rp=require(_0x88bf('0x6'));var fs=require('fs');var path=require(_0x88bf('0x7'));var rimraf=require(_0x88bf('0x8'));var config=require(_0x88bf('0x9'));var attributes=require(_0x88bf('0xa'));module[_0x88bf('0xb')]=function(_0x5bd512,_0x454378){return _0x5bd512[_0x88bf('0xc')](_0x88bf('0xd'),attributes,{'tableName':_0x88bf('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index c3545af..f149321 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0301=['entity','ASC','countcongestionretry','countnoanswerretry','countmachineretry','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','phone','isNil','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x510bd8,_0x46c1e6){var _0xcd6e09=function(_0x4adabe){while(--_0x4adabe){_0x510bd8['push'](_0x510bd8['shift']());}};_0xcd6e09(++_0x46c1e6);}(_0x0301,0x157));var _0x1030=function(_0x372400,_0xdaeb10){_0x372400=_0x372400-0x0;var _0x4cd28c=_0x0301[_0x372400];return _0x4cd28c;};'use strict';var _=require('lodash');var util=require(_0x1030('0x0'));var moment=require(_0x1030('0x1'));var BPromise=require(_0x1030('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1030('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1030('0x4'))(_0x1030('0x5'));var config=require(_0x1030('0x6'));var jayson=require(_0x1030('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3f19,_0x36be0d,_0x4826e0){return new BPromise(function(_0xd99d7d,_0x220022){return client[_0x1030('0x8')](_0x1d3f19,_0x4826e0)['then'](function(_0x200c00){logger[_0x1030('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x36be0d,_0x1030('0xa'));logger[_0x1030('0xb')](_0x1030('0xc'),_0x36be0d,_0x1030('0xa'),JSON[_0x1030('0xd')](_0x200c00));if(_0x200c00[_0x1030('0xe')]){if(_0x200c00['error']['code']===0x1f4){logger[_0x1030('0xe')](_0x1030('0xf'),_0x36be0d,_0x200c00['error'][_0x1030('0x10')]);return _0x220022(_0x200c00['error'][_0x1030('0x10')]);}logger[_0x1030('0xe')](_0x1030('0xf'),_0x36be0d,_0x200c00['error'][_0x1030('0x10')]);return _0xd99d7d(_0x200c00[_0x1030('0xe')][_0x1030('0x10')]);}else{logger[_0x1030('0x9')](_0x1030('0xf'),_0x36be0d,_0x1030('0xa'));_0xd99d7d(_0x200c00[_0x1030('0x11')]['message']);}})[_0x1030('0x12')](function(_0x320f7b){logger[_0x1030('0xe')](_0x1030('0xf'),_0x36be0d,_0x320f7b);_0x220022(_0x320f7b);});});}exports[_0x1030('0x13')]=function(_0x105b48){var _0x4374b3=this;return new Promise(function(_0xda922c,_0x573ddb){return db[_0x1030('0x14')][_0x1030('0x15')]({'raw':!![],'where':{'ContactId':_0x105b48[_0x1030('0x16')][_0x1030('0x17')],'ListId':_0x105b48[_0x1030('0x16')][_0x1030('0x18')],'VoiceQueueId':_0x105b48[_0x1030('0x16')][_0x1030('0x19')]===undefined?null:_0x105b48[_0x1030('0x16')][_0x1030('0x19')],'CampaignId':_0x105b48[_0x1030('0x16')][_0x1030('0x1a')]===undefined?null:_0x105b48[_0x1030('0x16')]['CampaignId']}})[_0x1030('0x1b')](function(_0x204b54){if(_0x204b54!=null){return db[_0x1030('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x204b54['id'],'OrderBy':{'$gt':_0x204b54[_0x1030('0x1d')]}},'order':[[_0x1030('0x1d'),'ASC']]})[_0x1030('0x1b')](function(_0x220992){var _0x5642ab=0x0;if(_0x220992){if(_0x220992[_0x1030('0x1e')]+_0x220992['countcongestionretry']+_0x220992['countnoanswerretry']+_0x220992[_0x1030('0x1f')]+_0x220992[_0x1030('0x20')]+_0x220992[_0x1030('0x21')]+_0x220992['countmachineretry']+_0x220992[_0x1030('0x22')]<_0x105b48[_0x1030('0x23')]['dialGlobalMaxRetry'])_0x5642ab=0x1;_0xda922c({'additional':_0x5642ab});}else{return db[_0x1030('0x1c')][_0x1030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x204b54['id']},'order':[[_0x1030('0x1d'),_0x1030('0x24')]]})[_0x1030('0x1b')](function(_0x550f1c){var _0x52cd11=0x0;if(_0x550f1c){if(_0x550f1c[_0x1030('0x1e')]+_0x550f1c[_0x1030('0x25')]+_0x550f1c[_0x1030('0x26')]+_0x550f1c[_0x1030('0x1f')]+_0x550f1c[_0x1030('0x20')]+_0x550f1c[_0x1030('0x21')]+_0x550f1c[_0x1030('0x27')]+_0x550f1c[_0x1030('0x22')]<_0x105b48[_0x1030('0x23')]['dialGlobalMaxRetry'])_0x52cd11=0x1;_0xda922c({'additional':_0x52cd11});}else{_0xda922c({'additional':0x0});}})[_0x1030('0x12')](function(_0xa439c8){logger[_0x1030('0xe')](_0x1030('0x13'),_0xa439c8[_0x1030('0x10')]);_0x573ddb(_0x4374b3[_0x1030('0xe')](0x1f4,_0xa439c8[_0x1030('0x10')]));});}})[_0x1030('0x12')](function(_0x4e6856){logger['error']('VerifyAdditionalPhones',_0x4e6856['message']);_0x573ddb(_0x4374b3['error'](0x1f4,_0x4e6856[_0x1030('0x10')]));});}else _0xda922c({'additional':0x0});});});};exports[_0x1030('0x28')]=function(_0x503405){var _0x47fb8d=this;return new Promise(function(_0x257223,_0x28e49a){return db[_0x1030('0x14')][_0x1030('0x15')]({'raw':!![],'where':{'ContactId':_0x503405[_0x1030('0x16')]['ContactId'],'ListId':_0x503405[_0x1030('0x16')][_0x1030('0x18')],'VoiceQueueId':_0x503405[_0x1030('0x16')][_0x1030('0x19')]===undefined?null:_0x503405['body'][_0x1030('0x19')],'CampaignId':_0x503405[_0x1030('0x16')][_0x1030('0x1a')]===undefined?null:_0x503405[_0x1030('0x16')][_0x1030('0x1a')]}})[_0x1030('0x1b')](function(_0x2c596b){if(_0x2c596b!=null){return db['CmHopperAdditionalPhone'][_0x1030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2c596b['id'],'OrderBy':{'$gte':_0x2c596b[_0x1030('0x1d')]}},'order':[[_0x1030('0x1d'),_0x1030('0x24')]]})[_0x1030('0x1b')](function(_0x527813){if(_0x527813)return activateAdditionalPhone(_0x2c596b,_0x503405['body'],_0x527813,_0x503405[_0x1030('0x29')],_0x503405[_0x1030('0x2a')])['then'](function(_0x47c10c){_0x257223(_0x47c10c);});else{return db['CmHopperAdditionalPhone'][_0x1030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2c596b['id']},'order':[[_0x1030('0x1d'),_0x1030('0x24')]]})[_0x1030('0x1b')](function(_0x5520ff){if(_0x5520ff)return activateAdditionalPhone(_0x2c596b,_0x503405['body'],_0x5520ff,_0x503405[_0x1030('0x29')],_0x503405[_0x1030('0x2a')])[_0x1030('0x1b')](function(_0x113d92){_0x257223(_0x113d92);});else{_0x257223({'id':_0x2c596b['id'],'phone':''});}})[_0x1030('0x12')](function(_0x57084e){logger[_0x1030('0xe')]('VerifyAdditionalPhones',_0x57084e[_0x1030('0x10')]);_0x28e49a(_0x47fb8d[_0x1030('0xe')](0x1f4,_0x57084e[_0x1030('0x10')]));});}})[_0x1030('0x12')](function(_0x1be0ef){logger[_0x1030('0xe')](_0x1030('0x13'),_0x1be0ef['message']);_0x28e49a(_0x47fb8d['error'](0x1f4,_0x1be0ef[_0x1030('0x10')]));});}else _0x257223(0x1);});});};function activateAdditionalPhone(_0x4c3480,_0x2ec3ae,_0x2db967,_0x48ff89,_0x1e5372){return new Promise(function(_0x241c97,_0x2c077f){var _0x2c5285;if(_['isNil'](_0x2db967[_0x1030('0x2b')])){_0x2db967[_0x1030('0x2b')]=moment();}if(moment()>moment(_0x2db967[_0x1030('0x2b')])){_0x2c5285=moment()['add'](_0x1e5372||0x3,_0x1030('0x2c'));}else{if(_0x2db967['OrderBy']==0x0){_0x2c5285=moment(_0x2db967[_0x1030('0x2b')]);}else{_0x2c5285=moment()['add'](_0x1e5372||0x3,_0x1030('0x2c'));}}if(_['isNil'](_0x2c5285)){_0x2c5285=moment()[_0x1030('0x2d')](_0x1e5372||0x3,_0x1030('0x2c'));}var _0x180651={'phone':_0x4c3480[_0x1030('0x2e')],'active':0x0,'OrderBy':_[_0x1030('0x2f')](_0x4c3480['OrderBy'])?0x0:_0x4c3480[_0x1030('0x1d')],'scheduledat':moment()[_0x1030('0x2d')](_0x48ff89||0x1,_0x1030('0x2c')),'countbusyretry':_0x2ec3ae['countbusyretry'],'countcongestionretry':_0x2ec3ae[_0x1030('0x25')],'countnoanswerretry':_0x2ec3ae['countnoanswerretry'],'countnosuchnumberretry':_0x2ec3ae['countnosuchnumberretry'],'countdropretry':_0x2ec3ae[_0x1030('0x20')],'countabandonedretry':_0x2ec3ae[_0x1030('0x21')],'countmachineretry':_0x2ec3ae['countmachineretry'],'countagentrejectretry':_0x2ec3ae[_0x1030('0x22')],'createdAt':_0x2ec3ae[_0x1030('0x30')],'updatedAt':_0x2ec3ae[_0x1030('0x31')]};var _0x190fe2={'CmHopperId':_0x4c3480['id'],'phone':_0x2db967['phone'],'active':0x0,'OrderBy':_[_0x1030('0x2f')](_0x2db967[_0x1030('0x1d')])?0x0:_0x2db967[_0x1030('0x1d')],'scheduledat':_0x2c5285,'countbusyretry':_0x2db967[_0x1030('0x1e')],'countcongestionretry':_0x2db967['countcongestionretry'],'countnoanswerretry':_0x2db967[_0x1030('0x26')],'countnosuchnumberretry':_0x2db967['countnosuchnumberretry'],'countdropretry':_0x2db967[_0x1030('0x20')],'countabandonedretry':_0x2db967[_0x1030('0x21')],'countmachineretry':_0x2db967[_0x1030('0x27')],'countagentrejectretry':_0x2db967['countagentrejectretry'],'createdAt':_0x2db967[_0x1030('0x30')],'updatedAt':_0x2db967['updatedAt']};return db[_0x1030('0x32')]['transaction'](function(_0x57803a){return db[_0x1030('0x1c')][_0x1030('0x33')](_0x180651,{'where':{'id':_0x2db967['id']}},{'transaction':_0x57803a})[_0x1030('0x1b')](function(){return db[_0x1030('0x14')]['update'](_0x190fe2,{'where':{'id':_0x4c3480['id']}},{'transaction':_0x57803a});});})[_0x1030('0x1b')](function(_0x39951a){_0x241c97({'id':_0x4c3480['id'],'phone':_0x2db967[_0x1030('0x2e')]});})[_0x1030('0x12')](function(_0x29c808){logger[_0x1030('0xe')](_0x1030('0x34'),_0x29c808[_0x1030('0x10')]);_0x2c077f({'error':_0x29c808[_0x1030('0x10')]});});});}exports[_0x1030('0x35')]=function(_0x1a551d){var _0x19f825=this;return new Promise(function(_0x152a17,_0x4e946c){return db[_0x1030('0x14')][_0x1030('0x33')](_0x1a551d[_0x1030('0x16')]['field'],{'where':{'id':_0x1a551d[_0x1030('0x16')]['id']}})[_0x1030('0x1b')](function(_0x151b4){_0x152a17(_0x151b4);})[_0x1030('0x12')](function(_0x2d41db){logger[_0x1030('0xe')](_0x1030('0x35'),_0x2d41db['message']);_0x4e946c(_0x19f825[_0x1030('0xe')](0x1f4,_0x2d41db[_0x1030('0x10')]));});});}; \ No newline at end of file +var _0xcca7=['dialGlobalMaxRetry','ASC','duration','waitTime','isNil','scheduledat','add','minutes','updatedAt','phone','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity'];(function(_0x3bf0f6,_0xdbd0e){var _0x42e44b=function(_0x393db9){while(--_0x393db9){_0x3bf0f6['push'](_0x3bf0f6['shift']());}};_0x42e44b(++_0xdbd0e);}(_0xcca7,0x133));var _0x7cca=function(_0x543a5e,_0x33dd65){_0x543a5e=_0x543a5e-0x0;var _0x29afa6=_0xcca7[_0x543a5e];return _0x29afa6;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));var BPromise=require('bluebird');var rs=require(_0x7cca('0x3'));var fs=require('fs');var Redis=require(_0x7cca('0x4'));var db=require(_0x7cca('0x5'))['db'];var utils=require(_0x7cca('0x6'));var logger=require(_0x7cca('0x7'))(_0x7cca('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7cca('0x9')][_0x7cca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9f049d,_0x6a2caf,_0x1bd718){return new BPromise(function(_0x2c9e7f,_0x50f20c){return client[_0x7cca('0xb')](_0x9f049d,_0x1bd718)[_0x7cca('0xc')](function(_0x53d555){logger['info'](_0x7cca('0xd'),_0x6a2caf,_0x7cca('0xe'));logger[_0x7cca('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x6a2caf,_0x7cca('0xe'),JSON['stringify'](_0x53d555));if(_0x53d555['error']){if(_0x53d555[_0x7cca('0x10')][_0x7cca('0x11')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x6a2caf,_0x53d555[_0x7cca('0x10')][_0x7cca('0x12')]);return _0x50f20c(_0x53d555[_0x7cca('0x10')]['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x6a2caf,_0x53d555[_0x7cca('0x10')][_0x7cca('0x12')]);return _0x2c9e7f(_0x53d555[_0x7cca('0x10')][_0x7cca('0x12')]);}else{logger[_0x7cca('0x13')](_0x7cca('0xd'),_0x6a2caf,_0x7cca('0xe'));_0x2c9e7f(_0x53d555[_0x7cca('0x14')][_0x7cca('0x12')]);}})[_0x7cca('0x15')](function(_0x53ecbc){logger[_0x7cca('0x10')](_0x7cca('0xd'),_0x6a2caf,_0x53ecbc);_0x50f20c(_0x53ecbc);});});}exports[_0x7cca('0x16')]=function(_0x2234ec){var _0x10e3f0=this;return new Promise(function(_0x450fc7,_0x36e202){return db[_0x7cca('0x17')][_0x7cca('0x18')]({'raw':!![],'where':{'ContactId':_0x2234ec[_0x7cca('0x19')][_0x7cca('0x1a')],'ListId':_0x2234ec[_0x7cca('0x19')][_0x7cca('0x1b')],'VoiceQueueId':_0x2234ec['body'][_0x7cca('0x1c')]===undefined?null:_0x2234ec['body'][_0x7cca('0x1c')],'CampaignId':_0x2234ec[_0x7cca('0x19')]['CampaignId']===undefined?null:_0x2234ec[_0x7cca('0x19')][_0x7cca('0x1d')]}})[_0x7cca('0xc')](function(_0x295103){if(_0x295103!=null){return db[_0x7cca('0x1e')][_0x7cca('0x18')]({'raw':!![],'where':{'CmHopperId':_0x295103['id'],'OrderBy':{'$gt':_0x295103[_0x7cca('0x1f')]}},'order':[['OrderBy','ASC']]})[_0x7cca('0xc')](function(_0x592db3){var _0x57dfec=0x0;if(_0x592db3){if(_0x592db3[_0x7cca('0x20')]+_0x592db3[_0x7cca('0x21')]+_0x592db3[_0x7cca('0x22')]+_0x592db3[_0x7cca('0x23')]+_0x592db3[_0x7cca('0x24')]+_0x592db3[_0x7cca('0x25')]+_0x592db3[_0x7cca('0x26')]+_0x592db3[_0x7cca('0x27')]<_0x2234ec[_0x7cca('0x28')][_0x7cca('0x29')])_0x57dfec=0x1;_0x450fc7({'additional':_0x57dfec});}else{return db[_0x7cca('0x1e')][_0x7cca('0x18')]({'raw':!![],'where':{'CmHopperId':_0x295103['id']},'order':[[_0x7cca('0x1f'),_0x7cca('0x2a')]]})[_0x7cca('0xc')](function(_0x389ef8){var _0x59b494=0x0;if(_0x389ef8){if(_0x389ef8[_0x7cca('0x20')]+_0x389ef8[_0x7cca('0x21')]+_0x389ef8[_0x7cca('0x22')]+_0x389ef8[_0x7cca('0x23')]+_0x389ef8[_0x7cca('0x24')]+_0x389ef8[_0x7cca('0x25')]+_0x389ef8['countmachineretry']+_0x389ef8[_0x7cca('0x27')]<_0x2234ec[_0x7cca('0x28')][_0x7cca('0x29')])_0x59b494=0x1;_0x450fc7({'additional':_0x59b494});}else{_0x450fc7({'additional':0x0});}})[_0x7cca('0x15')](function(_0x29bb22){logger[_0x7cca('0x10')](_0x7cca('0x16'),_0x29bb22[_0x7cca('0x12')]);_0x36e202(_0x10e3f0[_0x7cca('0x10')](0x1f4,_0x29bb22['message']));});}})[_0x7cca('0x15')](function(_0x2fbfd3){logger['error']('VerifyAdditionalPhones',_0x2fbfd3[_0x7cca('0x12')]);_0x36e202(_0x10e3f0[_0x7cca('0x10')](0x1f4,_0x2fbfd3[_0x7cca('0x12')]));});}else _0x450fc7({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x4be732){var _0x2cbf40=this;return new Promise(function(_0x300e33,_0x5c0535){return db['CmHopper'][_0x7cca('0x18')]({'raw':!![],'where':{'ContactId':_0x4be732[_0x7cca('0x19')][_0x7cca('0x1a')],'ListId':_0x4be732['body'][_0x7cca('0x1b')],'VoiceQueueId':_0x4be732[_0x7cca('0x19')][_0x7cca('0x1c')]===undefined?null:_0x4be732[_0x7cca('0x19')][_0x7cca('0x1c')],'CampaignId':_0x4be732['body'][_0x7cca('0x1d')]===undefined?null:_0x4be732[_0x7cca('0x19')][_0x7cca('0x1d')]}})['then'](function(_0x421f66){if(_0x421f66!=null){return db[_0x7cca('0x1e')][_0x7cca('0x18')]({'raw':!![],'where':{'CmHopperId':_0x421f66['id'],'OrderBy':{'$gte':_0x421f66[_0x7cca('0x1f')]}},'order':[[_0x7cca('0x1f'),_0x7cca('0x2a')]]})['then'](function(_0xd015d){if(_0xd015d)return activateAdditionalPhone(_0x421f66,_0x4be732[_0x7cca('0x19')],_0xd015d,_0x4be732[_0x7cca('0x2b')],_0x4be732[_0x7cca('0x2c')])[_0x7cca('0xc')](function(_0x3875b4){_0x300e33(_0x3875b4);});else{return db[_0x7cca('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x421f66['id']},'order':[['OrderBy',_0x7cca('0x2a')]]})[_0x7cca('0xc')](function(_0x336607){if(_0x336607)return activateAdditionalPhone(_0x421f66,_0x4be732[_0x7cca('0x19')],_0x336607,_0x4be732['duration'],_0x4be732[_0x7cca('0x2c')])['then'](function(_0x49f2b3){_0x300e33(_0x49f2b3);});else{_0x300e33({'id':_0x421f66['id'],'phone':''});}})[_0x7cca('0x15')](function(_0x1a13d6){logger[_0x7cca('0x10')](_0x7cca('0x16'),_0x1a13d6[_0x7cca('0x12')]);_0x5c0535(_0x2cbf40['error'](0x1f4,_0x1a13d6[_0x7cca('0x12')]));});}})['catch'](function(_0x29b675){logger[_0x7cca('0x10')](_0x7cca('0x16'),_0x29b675[_0x7cca('0x12')]);_0x5c0535(_0x2cbf40[_0x7cca('0x10')](0x1f4,_0x29b675[_0x7cca('0x12')]));});}else _0x300e33(0x1);});});};function activateAdditionalPhone(_0x3d833f,_0x347dba,_0xd3dd6a,_0x300d6c,_0x18d6e2){return new Promise(function(_0x3aca3d,_0x451a9c){var _0xb0e1ef;if(_[_0x7cca('0x2d')](_0xd3dd6a[_0x7cca('0x2e')])){_0xd3dd6a[_0x7cca('0x2e')]=moment();}if(moment()>moment(_0xd3dd6a[_0x7cca('0x2e')])){_0xb0e1ef=moment()[_0x7cca('0x2f')](_0x18d6e2||0x3,_0x7cca('0x30'));}else{if(_0xd3dd6a[_0x7cca('0x1f')]==0x0){_0xb0e1ef=moment(_0xd3dd6a[_0x7cca('0x2e')]);}else{_0xb0e1ef=moment()['add'](_0x18d6e2||0x3,'minutes');}}if(_['isNil'](_0xb0e1ef)){_0xb0e1ef=moment()[_0x7cca('0x2f')](_0x18d6e2||0x3,_0x7cca('0x30'));}var _0x5085d1={'phone':_0x3d833f['phone'],'active':0x0,'OrderBy':_[_0x7cca('0x2d')](_0x3d833f['OrderBy'])?0x0:_0x3d833f[_0x7cca('0x1f')],'scheduledat':moment()[_0x7cca('0x2f')](_0x300d6c||0x1,_0x7cca('0x30')),'countbusyretry':_0x347dba[_0x7cca('0x20')],'countcongestionretry':_0x347dba[_0x7cca('0x21')],'countnoanswerretry':_0x347dba['countnoanswerretry'],'countnosuchnumberretry':_0x347dba['countnosuchnumberretry'],'countdropretry':_0x347dba['countdropretry'],'countabandonedretry':_0x347dba[_0x7cca('0x25')],'countmachineretry':_0x347dba[_0x7cca('0x26')],'countagentrejectretry':_0x347dba[_0x7cca('0x27')],'createdAt':_0x347dba['createdAt'],'updatedAt':_0x347dba[_0x7cca('0x31')]};var _0x15488c={'CmHopperId':_0x3d833f['id'],'phone':_0xd3dd6a[_0x7cca('0x32')],'active':0x0,'OrderBy':_[_0x7cca('0x2d')](_0xd3dd6a[_0x7cca('0x1f')])?0x0:_0xd3dd6a[_0x7cca('0x1f')],'scheduledat':_0xb0e1ef,'countbusyretry':_0xd3dd6a['countbusyretry'],'countcongestionretry':_0xd3dd6a['countcongestionretry'],'countnoanswerretry':_0xd3dd6a[_0x7cca('0x22')],'countnosuchnumberretry':_0xd3dd6a[_0x7cca('0x23')],'countdropretry':_0xd3dd6a['countdropretry'],'countabandonedretry':_0xd3dd6a['countabandonedretry'],'countmachineretry':_0xd3dd6a['countmachineretry'],'countagentrejectretry':_0xd3dd6a[_0x7cca('0x27')],'createdAt':_0xd3dd6a[_0x7cca('0x33')],'updatedAt':_0xd3dd6a['updatedAt']};return db[_0x7cca('0x34')][_0x7cca('0x35')](function(_0x136d18){return db['CmHopperAdditionalPhone'][_0x7cca('0x36')](_0x5085d1,{'where':{'id':_0xd3dd6a['id']}},{'transaction':_0x136d18})[_0x7cca('0xc')](function(){return db[_0x7cca('0x17')][_0x7cca('0x36')](_0x15488c,{'where':{'id':_0x3d833f['id']}},{'transaction':_0x136d18});});})[_0x7cca('0xc')](function(_0x39f5e4){_0x3aca3d({'id':_0x3d833f['id'],'phone':_0xd3dd6a[_0x7cca('0x32')]});})[_0x7cca('0x15')](function(_0x56915b){logger['error'](_0x7cca('0x37'),_0x56915b[_0x7cca('0x12')]);_0x451a9c({'error':_0x56915b[_0x7cca('0x12')]});});});}exports[_0x7cca('0x38')]=function(_0x212c21){var _0x26dc59=this;return new Promise(function(_0x28d4aa,_0x725018){return db[_0x7cca('0x17')][_0x7cca('0x36')](_0x212c21[_0x7cca('0x19')][_0x7cca('0x39')],{'where':{'id':_0x212c21[_0x7cca('0x19')]['id']}})[_0x7cca('0xc')](function(_0x2df2f1){_0x28d4aa(_0x2df2f1);})[_0x7cca('0x15')](function(_0x5e5a35){logger['error'](_0x7cca('0x38'),_0x5e5a35[_0x7cca('0x12')]);_0x725018(_0x26dc59[_0x7cca('0x10')](0x1f4,_0x5e5a35[_0x7cca('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 9998e6a..2e7d7c6 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb264=['get','isAuthenticated','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x13385c,_0x5ec81c){var _0x15b1ab=function(_0xc71c8){while(--_0xc71c8){_0x13385c['push'](_0x13385c['shift']());}};_0x15b1ab(++_0x5ec81c);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4b26('0x0'));var util=require(_0x4b26('0x1'));var path=require('path');var timeout=require(_0x4b26('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4b26('0x3'));var auth=require(_0x4b26('0x4'));var interaction=require(_0x4b26('0x5'));var config=require(_0x4b26('0x6'));var controller=require(_0x4b26('0x7'));router[_0x4b26('0x8')]('/',auth[_0x4b26('0x9')](),controller['index']);router[_0x4b26('0x8')](_0x4b26('0xa'),auth['isAuthenticated'](),controller[_0x4b26('0xb')]);router[_0x4b26('0xc')]('/',auth[_0x4b26('0x9')](),controller['create']);router[_0x4b26('0xd')](_0x4b26('0xa'),auth[_0x4b26('0x9')](),controller[_0x4b26('0xe')]);router[_0x4b26('0xf')]('/:id',auth[_0x4b26('0x9')](),controller['destroy']);module[_0x4b26('0x10')]=router; \ No newline at end of file +var _0xe68c=['../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xe68c,0xfd));var _0xce68=function(_0x150c65,_0x303f38){_0x150c65=_0x150c65-0x0;var _0x4ca489=_0xe68c[_0x150c65];return _0x4ca489;};'use strict';var multer=require(_0xce68('0x0'));var util=require(_0xce68('0x1'));var path=require('path');var timeout=require(_0xce68('0x2'));var express=require('express');var router=express[_0xce68('0x3')]();var fs_extra=require(_0xce68('0x4'));var auth=require(_0xce68('0x5'));var interaction=require(_0xce68('0x6'));var config=require(_0xce68('0x7'));var controller=require(_0xce68('0x8'));router['get']('/',auth[_0xce68('0x9')](),controller[_0xce68('0xa')]);router[_0xce68('0xb')](_0xce68('0xc'),auth[_0xce68('0x9')](),controller[_0xce68('0xd')]);router[_0xce68('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xce68('0xf')]('/:id',auth[_0xce68('0x9')](),controller[_0xce68('0x10')]);router[_0xce68('0x11')](_0xce68('0xc'),auth[_0xce68('0x9')](),controller[_0xce68('0x12')]);module[_0xce68('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 1a36914..1ff6568 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 _0x21cd=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x210e7e,_0x230a6b){var _0x21d8bd=function(_0xba9d44){while(--_0xba9d44){_0x210e7e['push'](_0x210e7e['shift']());}};_0x21d8bd(++_0x230a6b);}(_0x21cd,0x6a));var _0xd21c=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x21cd[_0x2adbeb];return _0x5e18a6;};'use strict';var moment=require(_0xd21c('0x0'));var Sequelize=require(_0xd21c('0x1'));module[_0xd21c('0x2')]={'phone':{'type':Sequelize[_0xd21c('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd21c('0x4')],'unique':_0xd21c('0x5')},'ListId':{'type':Sequelize[_0xd21c('0x4')],'unique':_0xd21c('0x5')},'VoiceQueueId':{'type':Sequelize[_0xd21c('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x5d58=['INTEGER','contactListQueue'];(function(_0x4ca29d,_0x4589be){var _0x497c84=function(_0x34ca08){while(--_0x34ca08){_0x4ca29d['push'](_0x4ca29d['shift']());}};_0x497c84(++_0x4589be);}(_0x5d58,0x187));var _0x85d5=function(_0x2d982d,_0x405ac0){_0x2d982d=_0x2d982d-0x0;var _0x4585f3=_0x5d58[_0x2d982d];return _0x4585f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x85d5('0x0')},'ListId':{'type':Sequelize[_0x85d5('0x1')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x85d5('0x1')],'unique':_0x85d5('0x0')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 3f23f70..6b53a70 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 _0xbcf8=['path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','body','params','destroy','describe','eml-format','zip-dir','request-promise','moment','mustache','util'];(function(_0x59aebd,_0x4495f3){var _0x38a859=function(_0x2c61e8){while(--_0x2c61e8){_0x59aebd['push'](_0x59aebd['shift']());}};_0x38a859(++_0x4495f3);}(_0xbcf8,0x15d));var _0x8bcf=function(_0x418104,_0x1830e4){_0x418104=_0x418104-0x0;var _0x56545b=_0xbcf8[_0x418104];return _0x56545b;};'use strict';var emlformat=require(_0x8bcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8bcf('0x2'));var moment=require(_0x8bcf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8bcf('0x4'));var util=require(_0x8bcf('0x5'));var path=require(_0x8bcf('0x6'));var sox=require(_0x8bcf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bcf('0x8'));var squel=require(_0x8bcf('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8bcf('0xa'));var toCsv=require(_0x8bcf('0xb'));var querystring=require(_0x8bcf('0xc'));var Papa=require(_0x8bcf('0xd'));var Redis=require(_0x8bcf('0xe'));var authService=require(_0x8bcf('0xf'));var qs=require(_0x8bcf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bcf('0x11'))(_0x8bcf('0x12'));var utils=require(_0x8bcf('0x13'));var config=require(_0x8bcf('0x14'));var licenseUtil=require(_0x8bcf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x177168,_0x2acbaf){_0x2acbaf=_0x2acbaf||0xcc;return function(_0x33c1df){if(_0x33c1df){return _0x177168[_0x8bcf('0x16')](_0x2acbaf);}return _0x177168['status'](_0x2acbaf)['end']();};}function respondWithResult(_0x145529,_0x230de2){_0x230de2=_0x230de2||0xc8;return function(_0x1afa38){if(_0x1afa38){return _0x145529[_0x8bcf('0x17')](_0x230de2)[_0x8bcf('0x18')](_0x1afa38);}};}function respondWithFilteredResult(_0x593b2b,_0x8b557){return function(_0x2fe3d0){if(_0x2fe3d0){var _0x8e9712=typeof _0x8b557[_0x8bcf('0x19')]===_0x8bcf('0x1a')&&typeof _0x8b557[_0x8bcf('0x1b')]==='undefined';var _0x3d0261=_0x2fe3d0['count'];var _0x1ce45b=_0x8e9712?0x0:_0x8b557['offset'];var _0x1c5c1f=_0x8e9712?_0x2fe3d0[_0x8bcf('0x1c')]:_0x8b557[_0x8bcf('0x19')]+_0x8b557[_0x8bcf('0x1b')];var _0x5c50b0;if(_0x1c5c1f>=_0x3d0261){_0x1c5c1f=_0x3d0261;_0x5c50b0=0xc8;}else{_0x5c50b0=0xce;}_0x593b2b[_0x8bcf('0x17')](_0x5c50b0);return _0x593b2b['set'](_0x8bcf('0x1d'),_0x1ce45b+'-'+_0x1c5c1f+'/'+_0x3d0261)['json'](_0x2fe3d0);}return null;};}function patchUpdates(_0x4c90e){return function(_0x2ec010){try{jsonpatch[_0x8bcf('0x1e')](_0x2ec010,_0x4c90e,!![]);}catch(_0x31b882){return BPromise[_0x8bcf('0x1f')](_0x31b882);}return _0x2ec010['save']();};}function saveUpdates(_0x25439b,_0x21220b){return function(_0x17a7d6){if(_0x17a7d6){return _0x17a7d6[_0x8bcf('0x20')](_0x25439b)['then'](function(_0x5253a9){return _0x5253a9;});}return null;};}function removeEntity(_0x37d21d,_0x182f5e){return function(_0x4bfffe){if(_0x4bfffe){return _0x4bfffe['destroy']()[_0x8bcf('0x21')](function(){_0x37d21d[_0x8bcf('0x17')](0xcc)[_0x8bcf('0x22')]();});}};}function handleEntityNotFound(_0x4db62b,_0x4dd439){return function(_0x3fd676){if(!_0x3fd676){_0x4db62b[_0x8bcf('0x16')](0x194);}return _0x3fd676;};}function handleError(_0x3ea5fb,_0x3abbe6){_0x3abbe6=_0x3abbe6||0x1f4;return function(_0x5b1302){logger[_0x8bcf('0x23')](_0x5b1302[_0x8bcf('0x24')]);if(_0x5b1302['name']){delete _0x5b1302[_0x8bcf('0x25')];}_0x3ea5fb[_0x8bcf('0x17')](_0x3abbe6)[_0x8bcf('0x26')](_0x5b1302);};}exports['index']=function(_0x24d607,_0xb54c20){var _0x5cfaed={},_0x3bf001={},_0x1382a6={'count':0x0,'rows':[]};var _0x1d7d22=_[_0x8bcf('0x27')](db[_0x8bcf('0x28')][_0x8bcf('0x29')],function(_0x138cce){return{'name':_0x138cce[_0x8bcf('0x2a')],'type':_0x138cce['type']['key']};});_0x3bf001[_0x8bcf('0x2b')]=_[_0x8bcf('0x27')](_0x1d7d22,_0x8bcf('0x25'));_0x3bf001[_0x8bcf('0x2c')]=_[_0x8bcf('0x2d')](_0x24d607[_0x8bcf('0x2c')]);_0x3bf001[_0x8bcf('0x2e')]=_['intersection'](_0x3bf001[_0x8bcf('0x2b')],_0x3bf001[_0x8bcf('0x2c')]);_0x5cfaed['attributes']=_[_0x8bcf('0x2f')](_0x3bf001[_0x8bcf('0x2b')],qs[_0x8bcf('0x30')](_0x24d607['query']['fields']));_0x5cfaed[_0x8bcf('0x31')]=_0x5cfaed[_0x8bcf('0x31')][_0x8bcf('0x32')]?_0x5cfaed['attributes']:_0x3bf001[_0x8bcf('0x2b')];if(!_0x24d607['query'][_0x8bcf('0x33')](_0x8bcf('0x34'))){_0x5cfaed[_0x8bcf('0x1b')]=qs[_0x8bcf('0x1b')](_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x1b')]);_0x5cfaed[_0x8bcf('0x19')]=qs[_0x8bcf('0x19')](_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x19')]);}_0x5cfaed[_0x8bcf('0x35')]=qs[_0x8bcf('0x36')](_0x24d607[_0x8bcf('0x2c')]['sort']);_0x5cfaed[_0x8bcf('0x37')]=qs[_0x8bcf('0x2e')](_[_0x8bcf('0x38')](_0x24d607['query'],_0x3bf001[_0x8bcf('0x2e')]),_0x1d7d22);if(_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x39')]){_0x5cfaed[_0x8bcf('0x37')]=_[_0x8bcf('0x3a')](_0x5cfaed[_0x8bcf('0x37')],{'$or':_[_0x8bcf('0x27')](_0x1d7d22,function(_0x3435b1){if(_0x3435b1['type']!==_0x8bcf('0x3b')){var _0x49043d={};_0x49043d[_0x3435b1[_0x8bcf('0x25')]]={'$like':'%'+_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x39')]+'%'};return _0x49043d;}})});}_0x5cfaed=_['merge']({},_0x5cfaed,_0x24d607[_0x8bcf('0x3c')]);var _0x1c47e2={'where':_0x5cfaed[_0x8bcf('0x37')]};return db[_0x8bcf('0x28')][_0x8bcf('0x1c')](_0x1c47e2)[_0x8bcf('0x21')](function(_0x32c10f){_0x1382a6[_0x8bcf('0x1c')]=_0x32c10f;if(_0x24d607[_0x8bcf('0x2c')][_0x8bcf('0x3d')]){_0x5cfaed[_0x8bcf('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8bcf('0x3f')](_0x5cfaed);})['then'](function(_0x4c986b){_0x1382a6['rows']=_0x4c986b;return _0x1382a6;})['then'](respondWithFilteredResult(_0xb54c20,_0x5cfaed))[_0x8bcf('0x40')](handleError(_0xb54c20,null));};exports[_0x8bcf('0x41')]=function(_0x5c464e,_0x501cba){var _0x22b023={'raw':!![],'where':{'id':_0x5c464e['params']['id']}},_0x435789={};_0x435789[_0x8bcf('0x2b')]=_[_0x8bcf('0x2d')](db[_0x8bcf('0x28')][_0x8bcf('0x29')]);_0x435789[_0x8bcf('0x2c')]=_[_0x8bcf('0x2d')](_0x5c464e[_0x8bcf('0x2c')]);_0x435789['filters']=_['intersection'](_0x435789[_0x8bcf('0x2b')],_0x435789['query']);_0x22b023['attributes']=_[_0x8bcf('0x2f')](_0x435789[_0x8bcf('0x2b')],qs[_0x8bcf('0x30')](_0x5c464e['query'][_0x8bcf('0x30')]));_0x22b023[_0x8bcf('0x31')]=_0x22b023[_0x8bcf('0x31')][_0x8bcf('0x32')]?_0x22b023['attributes']:_0x435789['model'];if(_0x5c464e[_0x8bcf('0x2c')]['includeAll']){_0x22b023[_0x8bcf('0x3e')]=[{'all':!![]}];}_0x22b023=_['merge']({},_0x22b023,_0x5c464e['options']);return db['CmHopperBlack'][_0x8bcf('0x42')](_0x22b023)[_0x8bcf('0x21')](handleEntityNotFound(_0x501cba,null))[_0x8bcf('0x21')](respondWithResult(_0x501cba,null))['catch'](handleError(_0x501cba,null));};exports[_0x8bcf('0x20')]=function(_0x5acab7,_0x52406b){if(_0x5acab7[_0x8bcf('0x43')]['id']){delete _0x5acab7[_0x8bcf('0x43')]['id'];}return db[_0x8bcf('0x28')][_0x8bcf('0x42')]({'where':{'id':_0x5acab7[_0x8bcf('0x44')]['id']}})[_0x8bcf('0x21')](handleEntityNotFound(_0x52406b,null))[_0x8bcf('0x21')](saveUpdates(_0x5acab7['body'],null))[_0x8bcf('0x21')](respondWithResult(_0x52406b,null))[_0x8bcf('0x40')](handleError(_0x52406b,null));};exports[_0x8bcf('0x45')]=function(_0x25c4bc,_0x2f5947){return db[_0x8bcf('0x28')][_0x8bcf('0x42')]({'where':{'id':_0x25c4bc[_0x8bcf('0x44')]['id']}})[_0x8bcf('0x21')](handleEntityNotFound(_0x2f5947,null))['then'](removeEntity(_0x2f5947,null))['catch'](handleError(_0x2f5947,null));};exports[_0x8bcf('0x46')]=function(_0x483f1a,_0x2fb5c1){return db['CmHopperBlack'][_0x8bcf('0x46')]()['then'](respondWithResult(_0x2fb5c1,null))[_0x8bcf('0x40')](handleError(_0x2fb5c1,null));}; \ No newline at end of file +var _0xc627=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc627,0x12b));var _0x7c62=function(_0x753a56,_0x23e5fa){_0x753a56=_0x753a56-0x0;var _0x4ca87b=_0xc627[_0x753a56];return _0x4ca87b;};'use strict';var emlformat=require(_0x7c62('0x0'));var rimraf=require(_0x7c62('0x1'));var zipdir=require(_0x7c62('0x2'));var jsonpatch=require(_0x7c62('0x3'));var rp=require(_0x7c62('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7c62('0x5'));var sox=require(_0x7c62('0x6'));var csv=require('to-csv');var ejs=require(_0x7c62('0x7'));var fs=require('fs');var fs_extra=require(_0x7c62('0x8'));var _=require(_0x7c62('0x9'));var squel=require(_0x7c62('0xa'));var crypto=require(_0x7c62('0xb'));var jsforce=require(_0x7c62('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c62('0xd'));var Papa=require('papaparse');var Redis=require(_0x7c62('0xe'));var authService=require(_0x7c62('0xf'));var qs=require(_0x7c62('0x10'));var as=require(_0x7c62('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c62('0x12'))(_0x7c62('0x13'));var utils=require(_0x7c62('0x14'));var config=require(_0x7c62('0x15'));var licenseUtil=require(_0x7c62('0x16'));var db=require(_0x7c62('0x17'))['db'];function respondWithStatusCode(_0x28aa1d,_0x3e8160){_0x3e8160=_0x3e8160||0xcc;return function(_0x51b2b1){if(_0x51b2b1){return _0x28aa1d[_0x7c62('0x18')](_0x3e8160);}return _0x28aa1d[_0x7c62('0x19')](_0x3e8160)[_0x7c62('0x1a')]();};}function respondWithResult(_0x4114d4,_0x1b53a5){_0x1b53a5=_0x1b53a5||0xc8;return function(_0x5cd1c1){if(_0x5cd1c1){return _0x4114d4[_0x7c62('0x19')](_0x1b53a5)['json'](_0x5cd1c1);}};}function respondWithFilteredResult(_0x4b0ef0,_0x325a98){return function(_0x380e18){if(_0x380e18){var _0x12c786=typeof _0x325a98[_0x7c62('0x1b')]===_0x7c62('0x1c')&&typeof _0x325a98[_0x7c62('0x1d')]==='undefined';var _0x59e33b=_0x380e18[_0x7c62('0x1e')];var _0x268860=_0x12c786?0x0:_0x325a98[_0x7c62('0x1b')];var _0x1c776f=_0x12c786?_0x380e18[_0x7c62('0x1e')]:_0x325a98[_0x7c62('0x1b')]+_0x325a98[_0x7c62('0x1d')];var _0x4bdc63;if(_0x1c776f>=_0x59e33b){_0x1c776f=_0x59e33b;_0x4bdc63=0xc8;}else{_0x4bdc63=0xce;}_0x4b0ef0[_0x7c62('0x19')](_0x4bdc63);return _0x4b0ef0[_0x7c62('0x1f')](_0x7c62('0x20'),_0x268860+'-'+_0x1c776f+'/'+_0x59e33b)['json'](_0x380e18);}return null;};}function patchUpdates(_0x45a85b){return function(_0x45ee55){try{jsonpatch['apply'](_0x45ee55,_0x45a85b,!![]);}catch(_0x45ca54){return BPromise[_0x7c62('0x21')](_0x45ca54);}return _0x45ee55[_0x7c62('0x22')]();};}function saveUpdates(_0x221173,_0x396afc){return function(_0xebdc15){if(_0xebdc15){return _0xebdc15[_0x7c62('0x23')](_0x221173)[_0x7c62('0x24')](function(_0x293b65){return _0x293b65;});}return null;};}function removeEntity(_0x30b2c4,_0x34e2ea){return function(_0x406080){if(_0x406080){return _0x406080[_0x7c62('0x25')]()['then'](function(){_0x30b2c4[_0x7c62('0x19')](0xcc)[_0x7c62('0x1a')]();});}};}function handleEntityNotFound(_0x1a7ad6,_0x4bc21d){return function(_0x108cec){if(!_0x108cec){_0x1a7ad6[_0x7c62('0x18')](0x194);}return _0x108cec;};}function handleError(_0x3f8d6f,_0x5af0bb){_0x5af0bb=_0x5af0bb||0x1f4;return function(_0x308024){logger['error'](_0x308024[_0x7c62('0x26')]);if(_0x308024['name']){delete _0x308024[_0x7c62('0x27')];}_0x3f8d6f[_0x7c62('0x19')](_0x5af0bb)[_0x7c62('0x28')](_0x308024);};}exports[_0x7c62('0x29')]=function(_0x4aa8bb,_0x461731){var _0x1a26bb={},_0x48cad0={},_0x5f04ea={'count':0x0,'rows':[]};var _0x936935=_[_0x7c62('0x2a')](db[_0x7c62('0x2b')][_0x7c62('0x2c')],function(_0xe928b){return{'name':_0xe928b[_0x7c62('0x2d')],'type':_0xe928b[_0x7c62('0x2e')][_0x7c62('0x2f')]};});_0x48cad0[_0x7c62('0x30')]=_['map'](_0x936935,'name');_0x48cad0[_0x7c62('0x31')]=_[_0x7c62('0x32')](_0x4aa8bb[_0x7c62('0x31')]);_0x48cad0[_0x7c62('0x33')]=_[_0x7c62('0x34')](_0x48cad0[_0x7c62('0x30')],_0x48cad0[_0x7c62('0x31')]);_0x1a26bb[_0x7c62('0x35')]=_['intersection'](_0x48cad0[_0x7c62('0x30')],qs[_0x7c62('0x36')](_0x4aa8bb[_0x7c62('0x31')][_0x7c62('0x36')]));_0x1a26bb['attributes']=_0x1a26bb['attributes'][_0x7c62('0x37')]?_0x1a26bb['attributes']:_0x48cad0[_0x7c62('0x30')];if(!_0x4aa8bb[_0x7c62('0x31')][_0x7c62('0x38')](_0x7c62('0x39'))){_0x1a26bb[_0x7c62('0x1d')]=qs[_0x7c62('0x1d')](_0x4aa8bb['query'][_0x7c62('0x1d')]);_0x1a26bb[_0x7c62('0x1b')]=qs['offset'](_0x4aa8bb[_0x7c62('0x31')]['offset']);}_0x1a26bb[_0x7c62('0x3a')]=qs['sort'](_0x4aa8bb[_0x7c62('0x31')][_0x7c62('0x3b')]);_0x1a26bb[_0x7c62('0x3c')]=qs[_0x7c62('0x33')](_[_0x7c62('0x3d')](_0x4aa8bb[_0x7c62('0x31')],_0x48cad0[_0x7c62('0x33')]),_0x936935);if(_0x4aa8bb[_0x7c62('0x31')][_0x7c62('0x3e')]){_0x1a26bb['where']=_[_0x7c62('0x3f')](_0x1a26bb['where'],{'$or':_[_0x7c62('0x2a')](_0x936935,function(_0xf09708){if(_0xf09708[_0x7c62('0x2e')]!==_0x7c62('0x40')){var _0x55f659={};_0x55f659[_0xf09708[_0x7c62('0x27')]]={'$like':'%'+_0x4aa8bb[_0x7c62('0x31')]['filter']+'%'};return _0x55f659;}})});}_0x1a26bb=_[_0x7c62('0x3f')]({},_0x1a26bb,_0x4aa8bb['options']);var _0x5eca92={'where':_0x1a26bb[_0x7c62('0x3c')]};return db[_0x7c62('0x2b')]['count'](_0x5eca92)[_0x7c62('0x24')](function(_0x2410fd){_0x5f04ea[_0x7c62('0x1e')]=_0x2410fd;if(_0x4aa8bb[_0x7c62('0x31')][_0x7c62('0x41')]){_0x1a26bb[_0x7c62('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7c62('0x43')](_0x1a26bb);})[_0x7c62('0x24')](function(_0x10bf6c){_0x5f04ea[_0x7c62('0x44')]=_0x10bf6c;return _0x5f04ea;})[_0x7c62('0x24')](respondWithFilteredResult(_0x461731,_0x1a26bb))[_0x7c62('0x45')](handleError(_0x461731,null));};exports[_0x7c62('0x46')]=function(_0x58a7d5,_0x39b563){var _0x44a332={'raw':!![],'where':{'id':_0x58a7d5[_0x7c62('0x47')]['id']}},_0xa8e248={};_0xa8e248[_0x7c62('0x30')]=_[_0x7c62('0x32')](db[_0x7c62('0x2b')][_0x7c62('0x2c')]);_0xa8e248[_0x7c62('0x31')]=_[_0x7c62('0x32')](_0x58a7d5[_0x7c62('0x31')]);_0xa8e248['filters']=_[_0x7c62('0x34')](_0xa8e248[_0x7c62('0x30')],_0xa8e248[_0x7c62('0x31')]);_0x44a332['attributes']=_['intersection'](_0xa8e248[_0x7c62('0x30')],qs[_0x7c62('0x36')](_0x58a7d5[_0x7c62('0x31')][_0x7c62('0x36')]));_0x44a332[_0x7c62('0x35')]=_0x44a332[_0x7c62('0x35')][_0x7c62('0x37')]?_0x44a332[_0x7c62('0x35')]:_0xa8e248[_0x7c62('0x30')];if(_0x58a7d5['query'][_0x7c62('0x41')]){_0x44a332['include']=[{'all':!![]}];}_0x44a332=_['merge']({},_0x44a332,_0x58a7d5[_0x7c62('0x48')]);return db[_0x7c62('0x2b')][_0x7c62('0x49')](_0x44a332)[_0x7c62('0x24')](handleEntityNotFound(_0x39b563,null))[_0x7c62('0x24')](respondWithResult(_0x39b563,null))[_0x7c62('0x45')](handleError(_0x39b563,null));};exports[_0x7c62('0x23')]=function(_0xd97abb,_0x214d79){if(_0xd97abb[_0x7c62('0x4a')]['id']){delete _0xd97abb['body']['id'];}return db[_0x7c62('0x2b')]['find']({'where':{'id':_0xd97abb['params']['id']}})[_0x7c62('0x24')](handleEntityNotFound(_0x214d79,null))['then'](saveUpdates(_0xd97abb[_0x7c62('0x4a')],null))[_0x7c62('0x24')](respondWithResult(_0x214d79,null))[_0x7c62('0x45')](handleError(_0x214d79,null));};exports['destroy']=function(_0x2d20b3,_0x108d5a){return db[_0x7c62('0x2b')][_0x7c62('0x49')]({'where':{'id':_0x2d20b3[_0x7c62('0x47')]['id']}})[_0x7c62('0x24')](handleEntityNotFound(_0x108d5a,null))['then'](removeEntity(_0x108d5a,null))[_0x7c62('0x45')](handleError(_0x108d5a,null));};exports['describe']=function(_0x59684f,_0x581e13){return db['CmHopperBlack'][_0x7c62('0x4b')]()[_0x7c62('0x24')](respondWithResult(_0x581e13,null))['catch'](handleError(_0x581e13,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b162118..a4578bf 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 _0x63aa=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','cm_hopper_black','lodash','util','api'];(function(_0x27fe7f,_0x1a3bcd){var _0x432d89=function(_0x34bc29){while(--_0x34bc29){_0x27fe7f['push'](_0x27fe7f['shift']());}};_0x432d89(++_0x1a3bcd);}(_0x63aa,0x1b5));var _0xa63a=function(_0xf06bfa,_0x264ac0){_0xf06bfa=_0xf06bfa-0x0;var _0x535005=_0x63aa[_0xf06bfa];return _0x535005;};'use strict';var _=require(_0xa63a('0x0'));var util=require(_0xa63a('0x1'));var logger=require('../../config/logger')(_0xa63a('0x2'));var moment=require('moment');var BPromise=require(_0xa63a('0x3'));var rp=require(_0xa63a('0x4'));var fs=require('fs');var path=require(_0xa63a('0x5'));var rimraf=require(_0xa63a('0x6'));var config=require(_0xa63a('0x7'));var attributes=require(_0xa63a('0x8'));module['exports']=function(_0x479939,_0x233b90){return _0x479939[_0xa63a('0x9')]('CmHopperBlack',attributes,{'tableName':_0xa63a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1469=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','util','../../config/logger','api','moment','path'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x1469,0x1a9));var _0x9146=function(_0x1e79c0,_0x25cc74){_0x1e79c0=_0x1e79c0-0x0;var _0x31bfb5=_0x1469[_0x1e79c0];return _0x31bfb5;};'use strict';var _=require('lodash');var util=require(_0x9146('0x0'));var logger=require(_0x9146('0x1'))(_0x9146('0x2'));var moment=require(_0x9146('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9146('0x4'));var rimraf=require(_0x9146('0x5'));var config=require(_0x9146('0x6'));var attributes=require(_0x9146('0x7'));module[_0x9146('0x8')]=function(_0x42815f,_0x191828){return _0x42815f[_0x9146('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 266bf33..e7631c1 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 _0xb726=['stringify','error','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','UpdateCmHopperBlack','body','CmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x2ce8e2,_0x43716f){var _0x369539=function(_0x4168e9){while(--_0x4168e9){_0x2ce8e2['push'](_0x2ce8e2['shift']());}};_0x369539(++_0x43716f);}(_0xb726,0x1cc));var _0x6b72=function(_0x3e1983,_0x293002){_0x3e1983=_0x3e1983-0x0;var _0x283e83=_0xb726[_0x3e1983];return _0x283e83;};'use strict';var _=require(_0x6b72('0x0'));var util=require(_0x6b72('0x1'));var moment=require(_0x6b72('0x2'));var BPromise=require(_0x6b72('0x3'));var rs=require(_0x6b72('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b72('0x5'))['db'];var utils=require(_0x6b72('0x6'));var logger=require(_0x6b72('0x7'))(_0x6b72('0x8'));var config=require(_0x6b72('0x9'));var jayson=require(_0x6b72('0xa'));var client=jayson[_0x6b72('0xb')][_0x6b72('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48526a,_0x53d135,_0x4b596b){return new BPromise(function(_0x865e4f,_0xe8c069){return client[_0x6b72('0xd')](_0x48526a,_0x4b596b)[_0x6b72('0xe')](function(_0x46fb1d){logger[_0x6b72('0xf')](_0x6b72('0x10'),_0x53d135,_0x6b72('0x11'));logger[_0x6b72('0x12')](_0x6b72('0x13'),_0x53d135,_0x6b72('0x11'),JSON[_0x6b72('0x14')](_0x46fb1d));if(_0x46fb1d[_0x6b72('0x15')]){if(_0x46fb1d[_0x6b72('0x15')]['code']===0x1f4){logger[_0x6b72('0x15')](_0x6b72('0x10'),_0x53d135,_0x46fb1d[_0x6b72('0x15')][_0x6b72('0x16')]);return _0xe8c069(_0x46fb1d[_0x6b72('0x15')][_0x6b72('0x16')]);}logger[_0x6b72('0x15')](_0x6b72('0x10'),_0x53d135,_0x46fb1d['error']['message']);return _0x865e4f(_0x46fb1d[_0x6b72('0x15')][_0x6b72('0x16')]);}else{logger[_0x6b72('0xf')](_0x6b72('0x10'),_0x53d135,_0x6b72('0x11'));_0x865e4f(_0x46fb1d[_0x6b72('0x17')][_0x6b72('0x16')]);}})[_0x6b72('0x18')](function(_0x526cab){logger[_0x6b72('0x15')](_0x6b72('0x10'),_0x53d135,_0x526cab);_0xe8c069(_0x526cab);});});}exports[_0x6b72('0x19')]=function(_0x2133bf){var _0xd78e6=this;return new Promise(function(_0x95c781,_0x3f44c5){return db['CmHopperBlack'][_0x6b72('0x1a')]({'raw':_0x2133bf['options']?_0x2133bf[_0x6b72('0x1b')][_0x6b72('0x1c')]===undefined?!![]:![]:!![],'where':_0x2133bf[_0x6b72('0x1b')]?_0x2133bf[_0x6b72('0x1b')][_0x6b72('0x1d')]||null:null,'attributes':_0x2133bf['options']?_0x2133bf['options']['attributes']||null:null,'limit':_0x2133bf[_0x6b72('0x1b')]?_0x2133bf['options'][_0x6b72('0x1e')]||null:null,'include':_0x2133bf['options']?_0x2133bf['options'][_0x6b72('0x1f')]?_[_0x6b72('0x20')](_0x2133bf[_0x6b72('0x1b')][_0x6b72('0x1f')],function(_0xa47055){return{'model':db[_0xa47055[_0x6b72('0x21')]],'as':_0xa47055['as'],'attributes':_0xa47055[_0x6b72('0x22')],'include':_0xa47055['include']?_[_0x6b72('0x20')](_0xa47055['include'],function(_0x19f968){return{'model':db[_0x19f968['model']],'as':_0x19f968['as'],'attributes':_0x19f968['attributes'],'include':_0x19f968['include']?_[_0x6b72('0x20')](_0x19f968[_0x6b72('0x1f')],function(_0x291711){return{'model':db[_0x291711['model']],'as':_0x291711['as'],'attributes':_0x291711[_0x6b72('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6b72('0xe')](function(_0x38017d){logger[_0x6b72('0xf')]('GetCmHopperBlack',_0x2133bf);logger['debug']('GetCmHopperBlack',_0x2133bf,JSON[_0x6b72('0x14')](_0x38017d));_0x95c781(_0x38017d);})[_0x6b72('0x18')](function(_0x8e7d4b){logger[_0x6b72('0x15')](_0x6b72('0x19'),_0x8e7d4b[_0x6b72('0x16')],_0x2133bf);_0x3f44c5(_0xd78e6['error'](0x1f4,_0x8e7d4b[_0x6b72('0x16')]));});});};exports[_0x6b72('0x23')]=function(_0x3451fa){var _0x33d04b=this;return new Promise(function(_0xd3b76,_0x1b5465){return db['CmHopperBlack']['update'](_0x3451fa[_0x6b72('0x24')],{'raw':_0x3451fa['options']?_0x3451fa[_0x6b72('0x1b')][_0x6b72('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3451fa[_0x6b72('0x1b')]?_0x3451fa[_0x6b72('0x1b')]['where']||null:null,'attributes':_0x3451fa[_0x6b72('0x1b')]?_0x3451fa[_0x6b72('0x1b')][_0x6b72('0x22')]||null:null,'limit':_0x3451fa[_0x6b72('0x1b')]?_0x3451fa[_0x6b72('0x1b')][_0x6b72('0x1e')]||null:null})[_0x6b72('0xe')](function(_0x5a5bc3){logger[_0x6b72('0xf')](_0x6b72('0x23'),_0x3451fa);logger[_0x6b72('0x12')]('UpdateCmHopperBlack',_0x3451fa,JSON[_0x6b72('0x14')](_0x5a5bc3));_0xd3b76(_0x5a5bc3);})[_0x6b72('0x18')](function(_0x445e7f){logger[_0x6b72('0x15')]('UpdateCmHopperBlack',_0x445e7f['message'],_0x3451fa);_0x1b5465(_0x33d04b['error'](0x1f4,_0x445e7f['message']));});});};exports['DestroyCmHopperBlack']=function(_0x564b3e){var _0x4f4482=this;return new Promise(function(_0x19009b,_0x4a8786){return db[_0x6b72('0x25')][_0x6b72('0x26')]({'where':_0x564b3e[_0x6b72('0x1b')]?_0x564b3e['options'][_0x6b72('0x1d')]||null:null})['then'](function(_0x20ddeb){logger[_0x6b72('0xf')](_0x6b72('0x27'),_0x564b3e);logger[_0x6b72('0x12')]('DestroyCmHopperBlack',_0x564b3e,JSON[_0x6b72('0x14')](_0x20ddeb));_0x19009b(_0x20ddeb);})['catch'](function(_0x4d673d){logger['error'](_0x6b72('0x27'),_0x4d673d[_0x6b72('0x16')],_0x564b3e);_0x4a8786(_0x4f4482[_0x6b72('0x15')](0x1f4,_0x4d673d['message']));});});}; \ No newline at end of file +var _0xf468=['GetCmHopperBlack','CmHopperBlack','options','where','attributes','include','map','model','update','body','raw','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5a24c8,_0x630a9a){var _0x4cd1fe=function(_0x285e4a){while(--_0x285e4a){_0x5a24c8['push'](_0x5a24c8['shift']());}};_0x4cd1fe(++_0x630a9a);}(_0xf468,0xd2));var _0x8f46=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xf468[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8f46('0x0'));var BPromise=require(_0x8f46('0x1'));var rs=require(_0x8f46('0x2'));var fs=require('fs');var Redis=require(_0x8f46('0x3'));var db=require(_0x8f46('0x4'))['db'];var utils=require(_0x8f46('0x5'));var logger=require(_0x8f46('0x6'))(_0x8f46('0x7'));var config=require(_0x8f46('0x8'));var jayson=require(_0x8f46('0x9'));var client=jayson['client'][_0x8f46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f7aac,_0x4fe9dd,_0x6bd627){return new BPromise(function(_0x4cb8f0,_0x2d7521){return client[_0x8f46('0xb')](_0x2f7aac,_0x6bd627)[_0x8f46('0xc')](function(_0x3fdf2b){logger[_0x8f46('0xd')](_0x8f46('0xe'),_0x4fe9dd,_0x8f46('0xf'));logger[_0x8f46('0x10')](_0x8f46('0x11'),_0x4fe9dd,'request\x20sent',JSON[_0x8f46('0x12')](_0x3fdf2b));if(_0x3fdf2b[_0x8f46('0x13')]){if(_0x3fdf2b['error'][_0x8f46('0x14')]===0x1f4){logger['error'](_0x8f46('0xe'),_0x4fe9dd,_0x3fdf2b[_0x8f46('0x13')][_0x8f46('0x15')]);return _0x2d7521(_0x3fdf2b[_0x8f46('0x13')]['message']);}logger[_0x8f46('0x13')](_0x8f46('0xe'),_0x4fe9dd,_0x3fdf2b[_0x8f46('0x13')]['message']);return _0x4cb8f0(_0x3fdf2b['error']['message']);}else{logger[_0x8f46('0xd')](_0x8f46('0xe'),_0x4fe9dd,_0x8f46('0xf'));_0x4cb8f0(_0x3fdf2b[_0x8f46('0x16')]['message']);}})[_0x8f46('0x17')](function(_0x11ddb3){logger[_0x8f46('0x13')](_0x8f46('0xe'),_0x4fe9dd,_0x11ddb3);_0x2d7521(_0x11ddb3);});});}exports[_0x8f46('0x18')]=function(_0x105868){var _0x4db23a=this;return new Promise(function(_0x5b269d,_0x58771c){return db[_0x8f46('0x19')]['findAll']({'raw':_0x105868[_0x8f46('0x1a')]?_0x105868[_0x8f46('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x105868[_0x8f46('0x1a')]?_0x105868[_0x8f46('0x1a')][_0x8f46('0x1b')]||null:null,'attributes':_0x105868['options']?_0x105868[_0x8f46('0x1a')][_0x8f46('0x1c')]||null:null,'limit':_0x105868['options']?_0x105868[_0x8f46('0x1a')]['limit']||null:null,'include':_0x105868[_0x8f46('0x1a')]?_0x105868[_0x8f46('0x1a')][_0x8f46('0x1d')]?_[_0x8f46('0x1e')](_0x105868[_0x8f46('0x1a')][_0x8f46('0x1d')],function(_0x46a9d){return{'model':db[_0x46a9d[_0x8f46('0x1f')]],'as':_0x46a9d['as'],'attributes':_0x46a9d[_0x8f46('0x1c')],'include':_0x46a9d[_0x8f46('0x1d')]?_[_0x8f46('0x1e')](_0x46a9d[_0x8f46('0x1d')],function(_0x580908){return{'model':db[_0x580908[_0x8f46('0x1f')]],'as':_0x580908['as'],'attributes':_0x580908[_0x8f46('0x1c')],'include':_0x580908['include']?_[_0x8f46('0x1e')](_0x580908[_0x8f46('0x1d')],function(_0x5b6a5b){return{'model':db[_0x5b6a5b['model']],'as':_0x5b6a5b['as'],'attributes':_0x5b6a5b[_0x8f46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8f46('0xc')](function(_0x16dba9){logger[_0x8f46('0xd')]('GetCmHopperBlack',_0x105868);logger[_0x8f46('0x10')](_0x8f46('0x18'),_0x105868,JSON[_0x8f46('0x12')](_0x16dba9));_0x5b269d(_0x16dba9);})['catch'](function(_0x4ca7f1){logger['error'](_0x8f46('0x18'),_0x4ca7f1['message'],_0x105868);_0x58771c(_0x4db23a[_0x8f46('0x13')](0x1f4,_0x4ca7f1['message']));});});};exports['UpdateCmHopperBlack']=function(_0x3605a6){var _0x194e43=this;return new Promise(function(_0x14e252,_0x3b9435){return db[_0x8f46('0x19')][_0x8f46('0x20')](_0x3605a6[_0x8f46('0x21')],{'raw':_0x3605a6[_0x8f46('0x1a')]?_0x3605a6[_0x8f46('0x1a')][_0x8f46('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3605a6[_0x8f46('0x1a')]?_0x3605a6[_0x8f46('0x1a')][_0x8f46('0x1b')]||null:null,'attributes':_0x3605a6['options']?_0x3605a6[_0x8f46('0x1a')][_0x8f46('0x1c')]||null:null,'limit':_0x3605a6[_0x8f46('0x1a')]?_0x3605a6[_0x8f46('0x1a')][_0x8f46('0x23')]||null:null})[_0x8f46('0xc')](function(_0x487d88){logger['info']('UpdateCmHopperBlack',_0x3605a6);logger[_0x8f46('0x10')](_0x8f46('0x24'),_0x3605a6,JSON[_0x8f46('0x12')](_0x487d88));_0x14e252(_0x487d88);})[_0x8f46('0x17')](function(_0x291c6e){logger[_0x8f46('0x13')](_0x8f46('0x24'),_0x291c6e['message'],_0x3605a6);_0x3b9435(_0x194e43[_0x8f46('0x13')](0x1f4,_0x291c6e['message']));});});};exports[_0x8f46('0x25')]=function(_0x54858e){var _0x24504c=this;return new Promise(function(_0x30394c,_0x16e476){return db[_0x8f46('0x19')][_0x8f46('0x26')]({'where':_0x54858e[_0x8f46('0x1a')]?_0x54858e[_0x8f46('0x1a')][_0x8f46('0x1b')]||null:null})[_0x8f46('0xc')](function(_0x4830a7){logger['info'](_0x8f46('0x25'),_0x54858e);logger[_0x8f46('0x10')](_0x8f46('0x25'),_0x54858e,JSON[_0x8f46('0x12')](_0x4830a7));_0x30394c(_0x4830a7);})['catch'](function(_0x12bdc6){logger['error'](_0x8f46('0x25'),_0x12bdc6['message'],_0x54858e);_0x16e476(_0x24504c[_0x8f46('0x13')](0x1f4,_0x12bdc6[_0x8f46('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d2eeb52..ba77bf2 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 _0x687b=['isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x99c991,_0x439ce7){var _0x3e2061=function(_0x15bf1b){while(--_0x15bf1b){_0x99c991['push'](_0x99c991['shift']());}};_0x3e2061(++_0x439ce7);}(_0x687b,0x14a));var _0xb687=function(_0x2107a6,_0xe8360d){_0x2107a6=_0x2107a6-0x0;var _0x2f09ef=_0x687b[_0x2107a6];return _0x2f09ef;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller['destroy']);module[_0xb687('0x13')]=router; \ No newline at end of file +var _0x1883=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x37f249,_0x1fd572){var _0x41c9d5=function(_0x22c7f9){while(--_0x22c7f9){_0x37f249['push'](_0x37f249['shift']());}};_0x41c9d5(++_0x1fd572);}(_0x1883,0xab));var _0x3188=function(_0x3b1b93,_0x5cfce0){_0x3b1b93=_0x3b1b93-0x0;var _0x5d8fb9=_0x1883[_0x3b1b93];return _0x5d8fb9;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['describe']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['put'](_0x3188('0xf'),auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')]('/:id',auth[_0x3188('0xc')](),controller[_0x3188('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 0345b3b..691f626 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 _0xa87b=['seconds','BOOLEAN','sequelize','moment','STRING','DATE','INTEGER','getDataValue','endtime','followuptime'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa87b,0x1e2));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xba87('0x0'));var moment=require(_0xba87('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xba87('0x2')]},'scheduledat':{'type':Sequelize[_0xba87('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xba87('0x2')]},'originatecalleridname':{'type':Sequelize[_0xba87('0x2')]},'calleridnum':{'type':Sequelize[_0xba87('0x2')]},'calleridname':{'type':Sequelize[_0xba87('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xba87('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xba87('0x3')]},'ringtime':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xba87('0x2')]},'campaign':{'type':Sequelize[_0xba87('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xba87('0x2')]},'disposition':{'type':Sequelize[_0xba87('0x2')]},'secondDisposition':{'type':Sequelize[_0xba87('0x2')]},'thirdDisposition':{'type':Sequelize[_0xba87('0x2')]},'dispositionat':{'type':Sequelize[_0xba87('0x3')],'set':function(_0x21d157){var _0x21e47c=this[_0xba87('0x5')](_0xba87('0x6'));if(_0x21e47c&&_0x21d157){this['setDataValue'](_0xba87('0x7'),moment(_0x21d157)['diff'](moment(_0x21e47c),_0xba87('0x8')));}}},'amd':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xba87('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xba87('0x3')]},'deleted':{'type':Sequelize[_0xba87('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xba87('0x3')]},'recallme':{'type':Sequelize[_0xba87('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xba87('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xba87('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb0ab=['DATE','getDataValue','endtime','setDataValue','diff','BOOLEAN','sequelize','moment','STRING','INTEGER'];(function(_0x253e47,_0x217d21){var _0x179d19=function(_0x130541){while(--_0x130541){_0x253e47['push'](_0x253e47['shift']());}};_0x179d19(++_0x217d21);}(_0xb0ab,0x1c8));var _0xbb0a=function(_0x5b8bbc,_0x121ff2){_0x5b8bbc=_0x5b8bbc-0x0;var _0x4cba57=_0xb0ab[_0x5b8bbc];return _0x4cba57;};'use strict';var Sequelize=require(_0xbb0a('0x0'));var moment=require(_0xbb0a('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xbb0a('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbb0a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbb0a('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbb0a('0x2')]},'calleridname':{'type':Sequelize[_0xbb0a('0x2')]},'starttime':{'type':Sequelize[_0xbb0a('0x4')]},'responsetime':{'type':Sequelize[_0xbb0a('0x4')]},'answertime':{'type':Sequelize[_0xbb0a('0x4')]},'droptime':{'type':Sequelize[_0xbb0a('0x4')]},'endtime':{'type':Sequelize[_0xbb0a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbb0a('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbb0a('0x2')]},'membername':{'type':Sequelize[_0xbb0a('0x2')]},'reason':{'type':Sequelize[_0xbb0a('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbb0a('0x2')]},'thirdDisposition':{'type':Sequelize[_0xbb0a('0x2')]},'dispositionat':{'type':Sequelize[_0xbb0a('0x4')],'set':function(_0x46ac10){var _0x3f2c73=this[_0xbb0a('0x5')](_0xbb0a('0x6'));if(_0x3f2c73&&_0x46ac10){this[_0xbb0a('0x7')]('followuptime',moment(_0x46ac10)[_0xbb0a('0x8')](moment(_0x3f2c73),'seconds'));}}},'amd':{'type':Sequelize[_0xbb0a('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbb0a('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbb0a('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbb0a('0x4')]},'callback':{'type':Sequelize[_0xbb0a('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbb0a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbb0a('0x4')]},'deleted':{'type':Sequelize[_0xbb0a('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbb0a('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbb0a('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbb0a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbb0a('0x3')],'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 d9a34ff..7604faa 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 _0x2a07=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','toString','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x100f8a,_0x42db63){var _0x5671f2=function(_0x27ef4f){while(--_0x27ef4f){_0x100f8a['push'](_0x100f8a['shift']());}};_0x5671f2(++_0x42db63);}(_0x2a07,0x74));var _0x72a0=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0x2a07[_0x32665e];return _0x10be45;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['CmHopperFinal'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0x304400,null))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0xe38fb3,_0x3cab6a){if(_0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')]){delete _0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')];}return db[_0x72a0('0x2e')][_0x72a0('0x4e')]({'where':{'uniqueid':_0xe38fb3['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3cab6a,null))[_0x72a0('0x28')](saveUpdates(_0xe38fb3[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x3cab6a,null))[_0x72a0('0x46')](handleError(_0x3cab6a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x143410,_0x595243,_0x4d712b){return db[_0x72a0('0x2e')][_0x72a0('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x143410[_0x72a0('0x48')]['id']},'attributes':[[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x72a0('0x55')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72a0('0x57')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x595243,null))['then'](respondWithResult(_0x595243,null))['catch'](handleError(_0x595243,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x522ee2,_0x237025,_0x4e5d05){return db[_0x72a0('0x2e')]['findAll']({'raw':![],'where':{'CampaignId':_0x522ee2[_0x72a0('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x5b')))),_0x72a0('0x5c')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5d')))),'busyContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x5e')))),_0x72a0('0x5f')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x237025,null))[_0x72a0('0x28')](respondWithResult(_0x237025,null))[_0x72a0('0x46')](handleError(_0x237025,null));};exports[_0x72a0('0x60')]=function(_0x4f0944,_0x3dd25d,_0x647e75){return db['VoiceQueue'][_0x72a0('0x4e')]({'where':{'id':_0x4f0944['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3dd25d,null))[_0x72a0('0x28')](function(_0xb17e09){var _0x1238a3;if(_0xb17e09){_0x1238a3=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery'](['phone','scheduledAt',_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x66'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6a'),_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')](_0x72a0('0x6f'),'ContactId')[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))[_0x72a0('0x6c')](_0x72a0('0x71'),_0x72a0('0x66'))['field'](_0x72a0('0x6d'),'createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where'](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']())[_0x72a0('0x3e')](_0x72a0('0x75'),_0x4f0944[_0x72a0('0x4c')][_0x72a0('0x76')]['toString']())[_0x72a0('0x3e')](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x6b'))[_0x72a0('0x72')](_0x72a0('0x63'))[_0x72a0('0x3e')](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x79'))[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')]('VoiceQueueId\x20=\x20?',_0x4f0944[_0x72a0('0x48')]['id']['toString']())['where'](_0x72a0('0x7a')))['group']('ContactId'))[_0x72a0('0x7b')]();return db['sequelize'][_0x72a0('0x33')](_0x1238a3);}return[];})[_0x72a0('0x28')](respondWithResult(_0x3dd25d,null))[_0x72a0('0x46')](handleError(_0x3dd25d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x344a69,_0x179ca2,_0x3832d7){return db[_0x72a0('0x7c')][_0x72a0('0x4e')]({'where':{'id':_0x344a69['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x179ca2,null))[_0x72a0('0x28')](function(_0x38736e){var _0x4f421f;if(_0x38736e){_0x4f421f=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery']([_0x72a0('0x6b'),_0x72a0('0x6e'),_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x7d'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()[_0x72a0('0x6c')]('ANY_VALUE(calleridnum)',_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')]('ANY_VALUE(ContactId)',_0x72a0('0x64'))[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))['field'](_0x72a0('0x7e'),_0x72a0('0x7d'))[_0x72a0('0x6c')]('NOW()','createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where']('CampaignId\x20=\x20?',_0x344a69['params']['id'][_0x72a0('0x7b')]())['where'](_0x72a0('0x75'),_0x344a69['body']['state']['toString']())['where'](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6b'))[_0x72a0('0x72')]('cm_hopper')[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69['params']['id'][_0x72a0('0x7b')]()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field']('calleridnum')[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69[_0x72a0('0x48')]['id'][_0x72a0('0x7b')]())['where']('state\x20=\x204'))[_0x72a0('0x80')](_0x72a0('0x64')))['toString']();return db[_0x72a0('0x50')][_0x72a0('0x33')](_0x4f421f);}return[];})[_0x72a0('0x28')](respondWithResult(_0x179ca2,null))[_0x72a0('0x46')](handleError(_0x179ca2,null));};exports[_0x72a0('0x81')]=function(_0x167a80,_0x7533ea,_0x56bdf5){return db[_0x72a0('0x82')][_0x72a0('0x83')]({'where':{'VoiceQueueId':_0x167a80[_0x72a0('0x4c')]['VoiceQueueId'],'CampaignId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x7d')],'ContactId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x64')]}})[_0x72a0('0x28')](handleEntityNotFound(_0x7533ea,null))['then'](function(_0xc16765){if(_0xc16765){return _0xc16765;}return null;})[_0x72a0('0x28')](respondWithResult(_0x7533ea,null))[_0x72a0('0x46')](handleError(_0x7533ea,null));}; \ No newline at end of file +var _0x687b=['filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper_final','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0x687b,0x14a));var _0xb687=function(_0x4e9861,_0x25fe5f){_0x4e9861=_0x4e9861-0x0;var _0x49802f=_0x687b[_0x4e9861];return _0x49802f;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':!![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['CmHopperFinal'][_0xb687('0x4b')]()[_0xb687('0x26')](respondWithResult(_0x4f3069,null))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports[_0xb687('0x25')]=function(_0x535c00,_0x33a0b0){if(_0x535c00[_0xb687('0x4c')][_0xb687('0x4d')]){delete _0x535c00[_0xb687('0x4c')]['uniqueid'];}return db['CmHopperFinal'][_0xb687('0x49')]({'where':{'uniqueid':_0x535c00[_0xb687('0x4e')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x33a0b0,null))['then'](saveUpdates(_0x535c00['body'],null))[_0xb687('0x26')](respondWithResult(_0x33a0b0,null))[_0xb687('0x4a')](handleError(_0x33a0b0,null));};exports[_0xb687('0x4f')]=function(_0x22e618,_0x34205d,_0x1fb31a){return db[_0xb687('0x2f')][_0xb687('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x22e618['params']['id']},'attributes':[[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x53')))),_0xb687('0x54')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x55')))),_0xb687('0x56')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb687('0x57')))),_0xb687('0x58')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb687('0x59')],[db['sequelize']['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb687('0x5a')))),_0xb687('0x5b')],[db['sequelize']['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')]['literal'](_0xb687('0x5c')))),'reCallContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xb687('0x26')](handleEntityNotFound(_0x34205d,null))['then'](respondWithResult(_0x34205d,null))['catch'](handleError(_0x34205d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5d266c,_0x1cc507,_0x1db4ca){return db[_0xb687('0x2f')][_0xb687('0x43')]({'raw':![],'where':{'CampaignId':_0x5d266c[_0xb687('0x4e')]['id']},'attributes':[[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5d')))),'noSuchContacts'],[db['sequelize']['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x53')))),_0xb687('0x54')],[db[_0xb687('0x50')]['fn']('COUNT',db[_0xb687('0x50')]['fn']('IF',db['sequelize'][_0xb687('0x52')](_0xb687('0x55')))),_0xb687('0x56')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')]['literal'](_0xb687('0x57')))),_0xb687('0x58')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize'][_0xb687('0x52')](_0xb687('0x5e')))),_0xb687('0x59')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5a')))),_0xb687('0x5b')],[db[_0xb687('0x50')]['fn']('COUNT',db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5c')))),'reCallContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5f')))),'answeringMachine']]})[_0xb687('0x26')](handleEntityNotFound(_0x1cc507,null))[_0xb687('0x26')](respondWithResult(_0x1cc507,null))['catch'](handleError(_0x1cc507,null));};exports[_0xb687('0x60')]=function(_0x5449c4,_0x2c2add,_0x431cc5){return db['VoiceQueue'][_0xb687('0x49')]({'where':{'id':_0x5449c4[_0xb687('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c2add,null))[_0xb687('0x26')](function(_0x1736ef){var _0x52285e;if(_0x1736ef){_0x52285e=squel['insert']()[_0xb687('0x61')]('cm_hopper')[_0xb687('0x62')]([_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65'),_0xb687('0x66'),_0xb687('0x67'),_0xb687('0x68'),_0xb687('0x69')],squel['select']()[_0xb687('0x6a')](_0xb687('0x6b'),_0xb687('0x63'))[_0xb687('0x6a')](_0xb687('0x6c'),_0xb687('0x64'))['field'](_0xb687('0x6d'),_0xb687('0x65'))['field'](_0xb687('0x6e'),_0xb687('0x66'))[_0xb687('0x6a')](_0xb687('0x6f'),'VoiceQueueId')[_0xb687('0x6a')]('NOW()','createdAt')[_0xb687('0x6a')]('NOW()','updatedAt')[_0xb687('0x70')]('cm_hopper_final')[_0xb687('0x3e')](_0xb687('0x71'),_0x5449c4['params']['id'][_0xb687('0x72')]())[_0xb687('0x3e')]('state\x20=\x20?',_0x5449c4[_0xb687('0x4c')][_0xb687('0x73')][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x74'))[_0xb687('0x3e')](_0xb687('0x75'),squel[_0xb687('0x76')]()[_0xb687('0x6a')](_0xb687('0x63'))[_0xb687('0x70')]('cm_hopper')[_0xb687('0x3e')]('VoiceQueueId\x20=\x20?',_0x5449c4['params']['id'][_0xb687('0x72')]()))[_0xb687('0x3e')](_0xb687('0x75'),squel[_0xb687('0x76')]()[_0xb687('0x6a')]('calleridnum')['from'](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x71'),_0x5449c4[_0xb687('0x4e')]['id']['toString']())[_0xb687('0x3e')](_0xb687('0x78')))[_0xb687('0x79')](_0xb687('0x65')))[_0xb687('0x72')]();return db[_0xb687('0x50')][_0xb687('0x34')](_0x52285e);}return[];})[_0xb687('0x26')](respondWithResult(_0x2c2add,null))[_0xb687('0x4a')](handleError(_0x2c2add,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x25f5c3,_0x33d1fc,_0x207953){return db[_0xb687('0x7a')][_0xb687('0x49')]({'where':{'id':_0x25f5c3['params']['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x33d1fc,null))[_0xb687('0x26')](function(_0x48bbee){var _0x19ac6d;if(_0x48bbee){_0x19ac6d=squel['insert']()[_0xb687('0x61')](_0xb687('0x7b'))['fromQuery']([_0xb687('0x63'),_0xb687('0x64'),'ContactId',_0xb687('0x66'),_0xb687('0x7c'),_0xb687('0x68'),_0xb687('0x69')],squel[_0xb687('0x76')]()[_0xb687('0x6a')]('ANY_VALUE(calleridnum)',_0xb687('0x63'))[_0xb687('0x6a')](_0xb687('0x6c'),_0xb687('0x64'))[_0xb687('0x6a')](_0xb687('0x6d'),_0xb687('0x65'))[_0xb687('0x6a')](_0xb687('0x6e'),_0xb687('0x66'))[_0xb687('0x6a')]('ANY_VALUE(CampaignId)',_0xb687('0x7c'))['field'](_0xb687('0x6c'),_0xb687('0x68'))['field']('NOW()',_0xb687('0x69'))[_0xb687('0x70')](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3[_0xb687('0x4e')]['id'][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x7e'),_0x25f5c3[_0xb687('0x4c')][_0xb687('0x73')][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x74'))[_0xb687('0x3e')](_0xb687('0x75'),squel['select']()['field'](_0xb687('0x63'))['from']('cm_hopper')[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3['params']['id'][_0xb687('0x72')]()))[_0xb687('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb687('0x76')]()[_0xb687('0x6a')](_0xb687('0x7f'))[_0xb687('0x70')](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3[_0xb687('0x4e')]['id'][_0xb687('0x72')]())['where'](_0xb687('0x78')))[_0xb687('0x79')]('ContactId'))[_0xb687('0x72')]();return db['sequelize'][_0xb687('0x34')](_0x19ac6d);}return[];})[_0xb687('0x26')](respondWithResult(_0x33d1fc,null))['catch'](handleError(_0x33d1fc,null));};exports[_0xb687('0x80')]=function(_0x20e46a,_0x1c389f,_0x45d0ab){return db[_0xb687('0x81')][_0xb687('0x82')]({'where':{'VoiceQueueId':_0x20e46a[_0xb687('0x4c')]['VoiceQueueId'],'CampaignId':_0x20e46a['body'][_0xb687('0x7c')],'ContactId':_0x20e46a['body'][_0xb687('0x65')]}})[_0xb687('0x26')](handleEntityNotFound(_0x1c389f,null))[_0xb687('0x26')](function(_0x312529){if(_0x312529){return _0x312529;}return null;})['then'](respondWithResult(_0x1c389f,null))[_0xb687('0x4a')](handleError(_0x1c389f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 40da8e8..d508faa 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 _0x535c=['../../config/logger','moment','request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x2949cf,_0x548962){var _0x57d596=function(_0x4c6bea){while(--_0x4c6bea){_0x2949cf['push'](_0x2949cf['shift']());}};_0x57d596(++_0x548962);}(_0x535c,0x16a));var _0xc535=function(_0x3b95e2,_0x3d2dfb){_0x3b95e2=_0x3b95e2-0x0;var _0x1191c4=_0x535c[_0x3b95e2];return _0x1191c4;};'use strict';var _=require(_0xc535('0x0'));var util=require('util');var logger=require(_0xc535('0x1'))('api');var moment=require(_0xc535('0x2'));var BPromise=require('bluebird');var rp=require(_0xc535('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc535('0x4'));module[_0xc535('0x5')]=function(_0x317f06,_0x55d00b){return _0x317f06[_0xc535('0x6')](_0xc535('0x7'),attributes,{'tableName':_0xc535('0x8'),'paranoid':![],'indexes':[{'name':_0xc535('0x9'),'fields':[_0xc535('0x9')]},{'name':_0xc535('0xa'),'fields':[_0xc535('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4516=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4516,0x13e));var _0x6451=function(_0x34ddb2,_0x24ea5e){_0x34ddb2=_0x34ddb2-0x0;var _0x50e789=_0x4516[_0x34ddb2];return _0x50e789;};'use strict';var _=require(_0x6451('0x0'));var util=require(_0x6451('0x1'));var logger=require('../../config/logger')(_0x6451('0x2'));var moment=require(_0x6451('0x3'));var BPromise=require(_0x6451('0x4'));var rp=require(_0x6451('0x5'));var fs=require('fs');var path=require(_0x6451('0x6'));var rimraf=require(_0x6451('0x7'));var config=require(_0x6451('0x8'));var attributes=require(_0x6451('0x9'));module[_0x6451('0xa')]=function(_0x10643d,_0xe454bc){return _0x10643d[_0x6451('0xb')](_0x6451('0xc'),attributes,{'tableName':_0x6451('0xd'),'paranoid':![],'indexes':[{'name':_0x6451('0xe'),'fields':[_0x6451('0xe')]},{'name':_0x6451('0xf'),'fields':[_0x6451('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index fd25c3f..1aad2aa 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x28eb1a,_0x54d12f){var _0x56f48d=function(_0x5053db){while(--_0x5053db){_0x28eb1a['push'](_0x28eb1a['shift']());}};_0x56f48d(++_0x54d12f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0xb10b[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x872b66,_0x3d0ae8){var _0x1e076c=function(_0x47753a){while(--_0x47753a){_0x872b66['push'](_0x872b66['shift']());}};_0x1e076c(++_0x3d0ae8);}(_0xb10b,0x12a));var _0xbb10=function(_0x376de5,_0x1b44a9){_0x376de5=_0x376de5-0x0;var _0x58d8f7=_0xb10b[_0x376de5];return _0x58d8f7;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 46fb4b1..27f94b9 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 _0x61c2=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x61c2,0x11f));var _0x261c=function(_0x3ce8a9,_0x4612d6){_0x3ce8a9=_0x3ce8a9-0x0;var _0x159582=_0x61c2[_0x3ce8a9];return _0x159582;};'use strict';var multer=require(_0x261c('0x0'));var util=require(_0x261c('0x1'));var path=require(_0x261c('0x2'));var timeout=require(_0x261c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x261c('0x4'));var auth=require(_0x261c('0x5'));var interaction=require(_0x261c('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x261c('0x7')]('/',auth['isAuthenticated'](),controller[_0x261c('0x8')]);router['get']('/describe',auth[_0x261c('0x9')](),controller[_0x261c('0xa')]);router[_0x261c('0x7')](_0x261c('0xb'),auth[_0x261c('0x9')](),controller[_0x261c('0xc')]);router[_0x261c('0x7')](_0x261c('0xd'),auth['isAuthenticated'](),controller[_0x261c('0xe')]);router[_0x261c('0x7')](_0x261c('0xf'),auth['isAuthenticated'](),controller[_0x261c('0x10')]);router[_0x261c('0x11')](_0x261c('0x12'),auth[_0x261c('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x261c('0x11')](_0x261c('0x13'),auth['isAuthenticated'](),controller[_0x261c('0x14')]);router[_0x261c('0x11')]('/checkContactHopper',auth[_0x261c('0x9')](),controller[_0x261c('0x15')]);router[_0x261c('0x16')](_0x261c('0xb'),auth['isAuthenticated'](),controller[_0x261c('0x17')]);module[_0x261c('0x18')]=router; \ No newline at end of file +var _0x3014=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','connect-timeout','express'];(function(_0x4422d4,_0x3a8528){var _0x22c613=function(_0x4fca92){while(--_0x4fca92){_0x4422d4['push'](_0x4422d4['shift']());}};_0x22c613(++_0x3a8528);}(_0x3014,0x1d7));var _0x4301=function(_0x5b26ce,_0x8078cf){_0x5b26ce=_0x5b26ce-0x0;var _0x401dd3=_0x3014[_0x5b26ce];return _0x401dd3;};'use strict';var multer=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var path=require('path');var timeout=require(_0x4301('0x2'));var express=require(_0x4301('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4301('0x4'));var interaction=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var controller=require(_0x4301('0x7'));router[_0x4301('0x8')]('/',auth[_0x4301('0x9')](),controller[_0x4301('0xa')]);router[_0x4301('0x8')](_0x4301('0xb'),auth[_0x4301('0x9')](),controller[_0x4301('0xc')]);router['get']('/:id',auth[_0x4301('0x9')](),controller[_0x4301('0xd')]);router['get'](_0x4301('0xe'),auth[_0x4301('0x9')](),controller[_0x4301('0xf')]);router[_0x4301('0x8')]('/campaign/countAttributes/:id',auth[_0x4301('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x4301('0x10')](_0x4301('0x11'),auth[_0x4301('0x9')](),controller[_0x4301('0x12')]);router[_0x4301('0x10')](_0x4301('0x13'),auth[_0x4301('0x9')](),controller[_0x4301('0x14')]);router[_0x4301('0x10')](_0x4301('0x15'),auth[_0x4301('0x9')](),controller[_0x4301('0x16')]);router[_0x4301('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x4301('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 2d8856c..24b67a1 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 _0xd325=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xd325,0x1f3));var _0x5d32=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xd325[_0x421e36];return _0x20b3e3;};'use strict';var Sequelize=require(_0x5d32('0x0'));module[_0x5d32('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5d32('0x2')]},'scheduledat':{'type':Sequelize[_0x5d32('0x3')]},'countbusyretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d32('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5d32('0x2')]},'calleridname':{'type':Sequelize[_0x5d32('0x2')]},'starttime':{'type':Sequelize[_0x5d32('0x3')]},'responsetime':{'type':Sequelize[_0x5d32('0x3')]},'answertime':{'type':Sequelize[_0x5d32('0x3')]},'droptime':{'type':Sequelize[_0x5d32('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5d32('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5d32('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5d32('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d32('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5d32('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5d32('0x3')]},'edited':{'type':Sequelize[_0x5d32('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5d32('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5d32('0x2')]}}; \ No newline at end of file +var _0x4711=['BOOLEAN','sequelize','exports','DATE','INTEGER','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4711,0x10f));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1471('0x0'));module[_0x1471('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1471('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1471('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x1471('0x4')]},'originatecalleridname':{'type':Sequelize[_0x1471('0x4')]},'calleridnum':{'type':Sequelize[_0x1471('0x4')]},'calleridname':{'type':Sequelize[_0x1471('0x4')]},'starttime':{'type':Sequelize[_0x1471('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1471('0x2')]},'droptime':{'type':Sequelize[_0x1471('0x2')]},'endtime':{'type':Sequelize[_0x1471('0x2')]},'ringtime':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1471('0x4')]},'campaign':{'type':Sequelize[_0x1471('0x4')]},'campaigntype':{'type':Sequelize[_0x1471('0x4')]},'membername':{'type':Sequelize[_0x1471('0x4')]},'reason':{'type':Sequelize[_0x1471('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x1471('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1471('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1471('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1471('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1471('0x2')]},'edited':{'type':Sequelize[_0x1471('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1471('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 14e19b6..d248a7f 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 _0xf210=['attributes','intersection','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','then','include','catch','show','params','includeAll','options','find','create','body','describe','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status','json','offset','undefined','count','set','apply','reject','end','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','filters','query'];(function(_0x1eb127,_0x46958c){var _0x3c30c7=function(_0x4244cb){while(--_0x4244cb){_0x1eb127['push'](_0x1eb127['shift']());}};_0x3c30c7(++_0x46958c);}(_0xf210,0xd6));var _0x0f21=function(_0x4547e6,_0x29fcc7){_0x4547e6=_0x4547e6-0x0;var _0x42b412=_0xf210[_0x4547e6];return _0x42b412;};'use strict';var emlformat=require(_0x0f21('0x0'));var rimraf=require(_0x0f21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0f21('0x2'));var moment=require(_0x0f21('0x3'));var BPromise=require(_0x0f21('0x4'));var Mustache=require(_0x0f21('0x5'));var util=require(_0x0f21('0x6'));var path=require(_0x0f21('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f21('0x8'));var _=require('lodash');var squel=require(_0x0f21('0x9'));var crypto=require(_0x0f21('0xa'));var jsforce=require(_0x0f21('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0f21('0xc'));var querystring=require(_0x0f21('0xd'));var Papa=require('papaparse');var Redis=require(_0x0f21('0xe'));var authService=require(_0x0f21('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0f21('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0f21('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xabe9bd,_0x3f4eb1){_0x3f4eb1=_0x3f4eb1||0xcc;return function(_0x4c51cd){if(_0x4c51cd){return _0xabe9bd[_0x0f21('0x12')](_0x3f4eb1);}return _0xabe9bd[_0x0f21('0x13')](_0x3f4eb1)['end']();};}function respondWithResult(_0x5bc661,_0x51eef3){_0x51eef3=_0x51eef3||0xc8;return function(_0x5da397){if(_0x5da397){return _0x5bc661[_0x0f21('0x13')](_0x51eef3)[_0x0f21('0x14')](_0x5da397);}};}function respondWithFilteredResult(_0x1c8b64,_0x5afcd9){return function(_0x346660){if(_0x346660){var _0x591a1f=typeof _0x5afcd9[_0x0f21('0x15')]===_0x0f21('0x16')&&typeof _0x5afcd9['limit']==='undefined';var _0x2bb6de=_0x346660[_0x0f21('0x17')];var _0x3b1562=_0x591a1f?0x0:_0x5afcd9[_0x0f21('0x15')];var _0x181531=_0x591a1f?_0x346660[_0x0f21('0x17')]:_0x5afcd9[_0x0f21('0x15')]+_0x5afcd9['limit'];var _0x321f97;if(_0x181531>=_0x2bb6de){_0x181531=_0x2bb6de;_0x321f97=0xc8;}else{_0x321f97=0xce;}_0x1c8b64['status'](_0x321f97);return _0x1c8b64[_0x0f21('0x18')]('Content-Range',_0x3b1562+'-'+_0x181531+'/'+_0x2bb6de)[_0x0f21('0x14')](_0x346660);}return null;};}function patchUpdates(_0x5bcf7b){return function(_0x5d455b){try{jsonpatch[_0x0f21('0x19')](_0x5d455b,_0x5bcf7b,!![]);}catch(_0x2aafe7){return BPromise[_0x0f21('0x1a')](_0x2aafe7);}return _0x5d455b['save']();};}function saveUpdates(_0x454123,_0x54db2d){return function(_0x714edc){if(_0x714edc){return _0x714edc['update'](_0x454123)['then'](function(_0x47cde0){return _0x47cde0;});}return null;};}function removeEntity(_0x5bbe7d,_0x1f8081){return function(_0x65a158){if(_0x65a158){return _0x65a158['destroy']()['then'](function(){_0x5bbe7d['status'](0xcc)[_0x0f21('0x1b')]();});}};}function handleEntityNotFound(_0x5e00bf,_0x50edf4){return function(_0x3933e8){if(!_0x3933e8){_0x5e00bf[_0x0f21('0x12')](0x194);}return _0x3933e8;};}function handleError(_0x4fad42,_0x6b9a0f){_0x6b9a0f=_0x6b9a0f||0x1f4;return function(_0x557dcd){logger[_0x0f21('0x1c')](_0x557dcd[_0x0f21('0x1d')]);if(_0x557dcd[_0x0f21('0x1e')]){delete _0x557dcd[_0x0f21('0x1e')];}_0x4fad42['status'](_0x6b9a0f)['send'](_0x557dcd);};}exports[_0x0f21('0x1f')]=function(_0x176965,_0x1ffdc9){var _0x2bffcf={},_0x5536e6={},_0x273607={'count':0x0,'rows':[]};var _0x614c7d=_[_0x0f21('0x20')](db[_0x0f21('0x21')][_0x0f21('0x22')],function(_0x15eed2){return{'name':_0x15eed2[_0x0f21('0x23')],'type':_0x15eed2[_0x0f21('0x24')][_0x0f21('0x25')]};});_0x5536e6[_0x0f21('0x26')]=_[_0x0f21('0x20')](_0x614c7d,'name');_0x5536e6['query']=_[_0x0f21('0x27')](_0x176965['query']);_0x5536e6[_0x0f21('0x28')]=_['intersection'](_0x5536e6[_0x0f21('0x26')],_0x5536e6[_0x0f21('0x29')]);_0x2bffcf[_0x0f21('0x2a')]=_[_0x0f21('0x2b')](_0x5536e6[_0x0f21('0x26')],qs[_0x0f21('0x2c')](_0x176965[_0x0f21('0x29')][_0x0f21('0x2c')]));_0x2bffcf[_0x0f21('0x2a')]=_0x2bffcf[_0x0f21('0x2a')][_0x0f21('0x2d')]?_0x2bffcf[_0x0f21('0x2a')]:_0x5536e6[_0x0f21('0x26')];if(!_0x176965[_0x0f21('0x29')]['hasOwnProperty'](_0x0f21('0x2e'))){_0x2bffcf['limit']=qs['limit'](_0x176965[_0x0f21('0x29')]['limit']);_0x2bffcf[_0x0f21('0x15')]=qs[_0x0f21('0x15')](_0x176965[_0x0f21('0x29')]['offset']);}_0x2bffcf['order']=qs[_0x0f21('0x2f')](_0x176965[_0x0f21('0x29')][_0x0f21('0x2f')]);_0x2bffcf['where']=qs[_0x0f21('0x28')](_['pick'](_0x176965[_0x0f21('0x29')],_0x5536e6['filters']),_0x614c7d);if(_0x176965['query'][_0x0f21('0x30')]){_0x2bffcf[_0x0f21('0x31')]=_[_0x0f21('0x32')](_0x2bffcf[_0x0f21('0x31')],{'$or':_[_0x0f21('0x20')](_0x614c7d,function(_0x227e55){if(_0x227e55['type']!==_0x0f21('0x33')){var _0x47a074={};_0x47a074[_0x227e55['name']]={'$like':'%'+_0x176965[_0x0f21('0x29')][_0x0f21('0x30')]+'%'};return _0x47a074;}})});}_0x2bffcf=_['merge']({},_0x2bffcf,_0x176965['options']);var _0x727e84={'where':_0x2bffcf['where']};return db[_0x0f21('0x21')]['count'](_0x727e84)[_0x0f21('0x34')](function(_0x38f16e){_0x273607[_0x0f21('0x17')]=_0x38f16e;if(_0x176965[_0x0f21('0x29')]['includeAll']){_0x2bffcf[_0x0f21('0x35')]=[{'all':!![]}];}return db[_0x0f21('0x21')]['findAll'](_0x2bffcf);})[_0x0f21('0x34')](function(_0x5beeb7){_0x273607['rows']=_0x5beeb7;return _0x273607;})[_0x0f21('0x34')](respondWithFilteredResult(_0x1ffdc9,_0x2bffcf))[_0x0f21('0x36')](handleError(_0x1ffdc9,null));};exports[_0x0f21('0x37')]=function(_0x15d676,_0x507490){var _0x7f2361={'raw':!![],'where':{'id':_0x15d676[_0x0f21('0x38')]['id']}},_0x598521={};_0x598521[_0x0f21('0x26')]=_[_0x0f21('0x27')](db[_0x0f21('0x21')]['rawAttributes']);_0x598521[_0x0f21('0x29')]=_[_0x0f21('0x27')](_0x15d676[_0x0f21('0x29')]);_0x598521[_0x0f21('0x28')]=_[_0x0f21('0x2b')](_0x598521['model'],_0x598521[_0x0f21('0x29')]);_0x7f2361[_0x0f21('0x2a')]=_[_0x0f21('0x2b')](_0x598521['model'],qs[_0x0f21('0x2c')](_0x15d676[_0x0f21('0x29')]['fields']));_0x7f2361[_0x0f21('0x2a')]=_0x7f2361[_0x0f21('0x2a')]['length']?_0x7f2361[_0x0f21('0x2a')]:_0x598521['model'];if(_0x15d676[_0x0f21('0x29')][_0x0f21('0x39')]){_0x7f2361['include']=[{'all':!![]}];}_0x7f2361=_[_0x0f21('0x32')]({},_0x7f2361,_0x15d676[_0x0f21('0x3a')]);return db[_0x0f21('0x21')][_0x0f21('0x3b')](_0x7f2361)[_0x0f21('0x34')](handleEntityNotFound(_0x507490,null))['then'](respondWithResult(_0x507490,null))[_0x0f21('0x36')](handleError(_0x507490,null));};exports[_0x0f21('0x3c')]=function(_0x3c5223,_0x471156){return db['CmHopperHistory'][_0x0f21('0x3c')](_0x3c5223[_0x0f21('0x3d')],{})[_0x0f21('0x34')](respondWithResult(_0x471156,0xc9))[_0x0f21('0x36')](handleError(_0x471156,null));};exports[_0x0f21('0x3e')]=function(_0x482712,_0x33496d){return db[_0x0f21('0x21')][_0x0f21('0x3e')]()[_0x0f21('0x34')](respondWithResult(_0x33496d,null))[_0x0f21('0x36')](handleError(_0x33496d,null));};exports['update']=function(_0xec825d,_0x21fdcc){if(_0xec825d['body']['uniqueid']){delete _0xec825d[_0x0f21('0x3d')][_0x0f21('0x3f')];}return db[_0x0f21('0x21')]['find']({'where':{'uniqueid':_0xec825d[_0x0f21('0x38')]['id']}})[_0x0f21('0x34')](handleEntityNotFound(_0x21fdcc,null))['then'](saveUpdates(_0xec825d[_0x0f21('0x3d')],null))[_0x0f21('0x34')](respondWithResult(_0x21fdcc,null))[_0x0f21('0x36')](handleError(_0x21fdcc,null));}; \ No newline at end of file +var _0xa6c5=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','limit','undefined','count','offset','apply','reject','update','then','end','sendStatus','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','create','body','describe','uniqueid','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x50e189,_0x5dac01){var _0x2b9871=function(_0x171683){while(--_0x171683){_0x50e189['push'](_0x50e189['shift']());}};_0x2b9871(++_0x5dac01);}(_0xa6c5,0x1ec));var _0x5a6c=function(_0x58dbb8,_0x43ff61){_0x58dbb8=_0x58dbb8-0x0;var _0x1e83c5=_0xa6c5[_0x58dbb8];return _0x1e83c5;};'use strict';var emlformat=require(_0x5a6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a6c('0x2'));var moment=require(_0x5a6c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5a6c('0x4'));var util=require(_0x5a6c('0x5'));var path=require(_0x5a6c('0x6'));var sox=require('sox');var csv=require(_0x5a6c('0x7'));var ejs=require(_0x5a6c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a6c('0x9'));var squel=require(_0x5a6c('0xa'));var crypto=require(_0x5a6c('0xb'));var jsforce=require(_0x5a6c('0xc'));var deskjs=require(_0x5a6c('0xd'));var toCsv=require(_0x5a6c('0x7'));var querystring=require(_0x5a6c('0xe'));var Papa=require(_0x5a6c('0xf'));var Redis=require(_0x5a6c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5a6c('0x11'));var as=require(_0x5a6c('0x12'));var hardwareService=require(_0x5a6c('0x13'));var logger=require(_0x5a6c('0x14'))('api');var utils=require(_0x5a6c('0x15'));var config=require(_0x5a6c('0x16'));var licenseUtil=require(_0x5a6c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b7fc3,_0x55548a){_0x55548a=_0x55548a||0xcc;return function(_0x1f7765){if(_0x1f7765){return _0x3b7fc3['sendStatus'](_0x55548a);}return _0x3b7fc3[_0x5a6c('0x18')](_0x55548a)['end']();};}function respondWithResult(_0x11cc09,_0x56f799){_0x56f799=_0x56f799||0xc8;return function(_0x5577c2){if(_0x5577c2){return _0x11cc09['status'](_0x56f799)[_0x5a6c('0x19')](_0x5577c2);}};}function respondWithFilteredResult(_0x45143b,_0x449fdb){return function(_0x31cdc5){if(_0x31cdc5){var _0x5e90ef=typeof _0x449fdb['offset']==='undefined'&&typeof _0x449fdb[_0x5a6c('0x1a')]===_0x5a6c('0x1b');var _0x797020=_0x31cdc5[_0x5a6c('0x1c')];var _0x4ef6d1=_0x5e90ef?0x0:_0x449fdb[_0x5a6c('0x1d')];var _0xc1f097=_0x5e90ef?_0x31cdc5[_0x5a6c('0x1c')]:_0x449fdb['offset']+_0x449fdb[_0x5a6c('0x1a')];var _0x179110;if(_0xc1f097>=_0x797020){_0xc1f097=_0x797020;_0x179110=0xc8;}else{_0x179110=0xce;}_0x45143b[_0x5a6c('0x18')](_0x179110);return _0x45143b['set']('Content-Range',_0x4ef6d1+'-'+_0xc1f097+'/'+_0x797020)[_0x5a6c('0x19')](_0x31cdc5);}return null;};}function patchUpdates(_0x538c7e){return function(_0x472798){try{jsonpatch[_0x5a6c('0x1e')](_0x472798,_0x538c7e,!![]);}catch(_0x3ac9cb){return BPromise[_0x5a6c('0x1f')](_0x3ac9cb);}return _0x472798['save']();};}function saveUpdates(_0x1b43b8,_0x22f55d){return function(_0x2834f3){if(_0x2834f3){return _0x2834f3[_0x5a6c('0x20')](_0x1b43b8)['then'](function(_0x152c46){return _0x152c46;});}return null;};}function removeEntity(_0x12c84b,_0x3775b3){return function(_0x589597){if(_0x589597){return _0x589597['destroy']()[_0x5a6c('0x21')](function(){_0x12c84b[_0x5a6c('0x18')](0xcc)[_0x5a6c('0x22')]();});}};}function handleEntityNotFound(_0x6f3449,_0x1561eb){return function(_0x8625d0){if(!_0x8625d0){_0x6f3449[_0x5a6c('0x23')](0x194);}return _0x8625d0;};}function handleError(_0x3ca602,_0xda9865){_0xda9865=_0xda9865||0x1f4;return function(_0xba969d){logger['error'](_0xba969d[_0x5a6c('0x24')]);if(_0xba969d[_0x5a6c('0x25')]){delete _0xba969d['name'];}_0x3ca602[_0x5a6c('0x18')](_0xda9865)[_0x5a6c('0x26')](_0xba969d);};}exports[_0x5a6c('0x27')]=function(_0x90b8e5,_0x24786c){var _0x11d8fc={},_0x5d0c6a={},_0x4245be={'count':0x0,'rows':[]};var _0x459930=_[_0x5a6c('0x28')](db[_0x5a6c('0x29')][_0x5a6c('0x2a')],function(_0x15afd4){return{'name':_0x15afd4[_0x5a6c('0x2b')],'type':_0x15afd4['type'][_0x5a6c('0x2c')]};});_0x5d0c6a[_0x5a6c('0x2d')]=_[_0x5a6c('0x28')](_0x459930,'name');_0x5d0c6a['query']=_['keys'](_0x90b8e5['query']);_0x5d0c6a[_0x5a6c('0x2e')]=_[_0x5a6c('0x2f')](_0x5d0c6a['model'],_0x5d0c6a[_0x5a6c('0x30')]);_0x11d8fc[_0x5a6c('0x31')]=_['intersection'](_0x5d0c6a[_0x5a6c('0x2d')],qs[_0x5a6c('0x32')](_0x90b8e5[_0x5a6c('0x30')][_0x5a6c('0x32')]));_0x11d8fc[_0x5a6c('0x31')]=_0x11d8fc[_0x5a6c('0x31')][_0x5a6c('0x33')]?_0x11d8fc[_0x5a6c('0x31')]:_0x5d0c6a[_0x5a6c('0x2d')];if(!_0x90b8e5[_0x5a6c('0x30')][_0x5a6c('0x34')]('nolimit')){_0x11d8fc[_0x5a6c('0x1a')]=qs[_0x5a6c('0x1a')](_0x90b8e5[_0x5a6c('0x30')][_0x5a6c('0x1a')]);_0x11d8fc['offset']=qs[_0x5a6c('0x1d')](_0x90b8e5[_0x5a6c('0x30')][_0x5a6c('0x1d')]);}_0x11d8fc[_0x5a6c('0x35')]=qs[_0x5a6c('0x36')](_0x90b8e5['query'][_0x5a6c('0x36')]);_0x11d8fc[_0x5a6c('0x37')]=qs[_0x5a6c('0x2e')](_[_0x5a6c('0x38')](_0x90b8e5[_0x5a6c('0x30')],_0x5d0c6a[_0x5a6c('0x2e')]),_0x459930);if(_0x90b8e5[_0x5a6c('0x30')][_0x5a6c('0x39')]){_0x11d8fc['where']=_['merge'](_0x11d8fc[_0x5a6c('0x37')],{'$or':_['map'](_0x459930,function(_0x2d2a2d){if(_0x2d2a2d[_0x5a6c('0x3a')]!==_0x5a6c('0x3b')){var _0xd5db71={};_0xd5db71[_0x2d2a2d[_0x5a6c('0x25')]]={'$like':'%'+_0x90b8e5[_0x5a6c('0x30')]['filter']+'%'};return _0xd5db71;}})});}_0x11d8fc=_[_0x5a6c('0x3c')]({},_0x11d8fc,_0x90b8e5[_0x5a6c('0x3d')]);var _0x347abd={'where':_0x11d8fc['where']};return db[_0x5a6c('0x29')][_0x5a6c('0x1c')](_0x347abd)[_0x5a6c('0x21')](function(_0x2c0c95){_0x4245be['count']=_0x2c0c95;if(_0x90b8e5[_0x5a6c('0x30')][_0x5a6c('0x3e')]){_0x11d8fc['include']=[{'all':!![]}];}return db[_0x5a6c('0x29')]['findAll'](_0x11d8fc);})[_0x5a6c('0x21')](function(_0x1245d2){_0x4245be[_0x5a6c('0x3f')]=_0x1245d2;return _0x4245be;})[_0x5a6c('0x21')](respondWithFilteredResult(_0x24786c,_0x11d8fc))[_0x5a6c('0x40')](handleError(_0x24786c,null));};exports[_0x5a6c('0x41')]=function(_0x2b09d2,_0x3a8dd8){var _0x51c8d1={'raw':!![],'where':{'id':_0x2b09d2[_0x5a6c('0x42')]['id']}},_0x5c5514={};_0x5c5514[_0x5a6c('0x2d')]=_['keys'](db['CmHopperHistory'][_0x5a6c('0x2a')]);_0x5c5514['query']=_['keys'](_0x2b09d2[_0x5a6c('0x30')]);_0x5c5514[_0x5a6c('0x2e')]=_[_0x5a6c('0x2f')](_0x5c5514['model'],_0x5c5514[_0x5a6c('0x30')]);_0x51c8d1[_0x5a6c('0x31')]=_[_0x5a6c('0x2f')](_0x5c5514[_0x5a6c('0x2d')],qs[_0x5a6c('0x32')](_0x2b09d2[_0x5a6c('0x30')][_0x5a6c('0x32')]));_0x51c8d1[_0x5a6c('0x31')]=_0x51c8d1[_0x5a6c('0x31')]['length']?_0x51c8d1[_0x5a6c('0x31')]:_0x5c5514['model'];if(_0x2b09d2[_0x5a6c('0x30')]['includeAll']){_0x51c8d1[_0x5a6c('0x43')]=[{'all':!![]}];}_0x51c8d1=_[_0x5a6c('0x3c')]({},_0x51c8d1,_0x2b09d2['options']);return db[_0x5a6c('0x29')][_0x5a6c('0x44')](_0x51c8d1)[_0x5a6c('0x21')](handleEntityNotFound(_0x3a8dd8,null))[_0x5a6c('0x21')](respondWithResult(_0x3a8dd8,null))['catch'](handleError(_0x3a8dd8,null));};exports['create']=function(_0x1bf489,_0xc13e1d){return db['CmHopperHistory'][_0x5a6c('0x45')](_0x1bf489[_0x5a6c('0x46')],{})[_0x5a6c('0x21')](respondWithResult(_0xc13e1d,0xc9))['catch'](handleError(_0xc13e1d,null));};exports[_0x5a6c('0x47')]=function(_0x563737,_0x27310b){return db['CmHopperHistory'][_0x5a6c('0x47')]()[_0x5a6c('0x21')](respondWithResult(_0x27310b,null))[_0x5a6c('0x40')](handleError(_0x27310b,null));};exports[_0x5a6c('0x20')]=function(_0x1345d2,_0x344b3a){if(_0x1345d2['body']['uniqueid']){delete _0x1345d2['body'][_0x5a6c('0x48')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x1345d2[_0x5a6c('0x42')]['id']}})[_0x5a6c('0x21')](handleEntityNotFound(_0x344b3a,null))[_0x5a6c('0x21')](saveUpdates(_0x1345d2[_0x5a6c('0x46')],null))[_0x5a6c('0x21')](respondWithResult(_0x344b3a,null))['catch'](handleError(_0x344b3a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 6679f2d..6237de7 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 _0x3fce=['../../config/logger','api','moment','bluebird','request-promise','path','CmHopperHistory','endtime','uniqueid','util'];(function(_0x3a41be,_0x51ff6a){var _0x5d4b86=function(_0x3687d7){while(--_0x3687d7){_0x3a41be['push'](_0x3a41be['shift']());}};_0x5d4b86(++_0x51ff6a);}(_0x3fce,0x121));var _0xe3fc=function(_0x53ba51,_0x2f2321){_0x53ba51=_0x53ba51-0x0;var _0x2e776e=_0x3fce[_0x53ba51];return _0x2e776e;};'use strict';var _=require('lodash');var util=require(_0xe3fc('0x0'));var logger=require(_0xe3fc('0x1'))(_0xe3fc('0x2'));var moment=require(_0xe3fc('0x3'));var BPromise=require(_0xe3fc('0x4'));var rp=require(_0xe3fc('0x5'));var fs=require('fs');var path=require(_0xe3fc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x36eff8,_0x2dc84d){return _0x36eff8['define'](_0xe3fc('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xe3fc('0x8'),'fields':['endtime']},{'name':_0xe3fc('0x9'),'fields':[_0xe3fc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac41=['api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x427091,_0x39ae17){var _0xe0abc8=function(_0xdf4c49){while(--_0xdf4c49){_0x427091['push'](_0x427091['shift']());}};_0xe0abc8(++_0x39ae17);}(_0xac41,0xdd));var _0x1ac4=function(_0x2241c9,_0x299b5a){_0x2241c9=_0x2241c9-0x0;var _0x22fd65=_0xac41[_0x2241c9];return _0x22fd65;};'use strict';var _=require(_0x1ac4('0x0'));var util=require(_0x1ac4('0x1'));var logger=require(_0x1ac4('0x2'))(_0x1ac4('0x3'));var moment=require(_0x1ac4('0x4'));var BPromise=require(_0x1ac4('0x5'));var rp=require(_0x1ac4('0x6'));var fs=require('fs');var path=require(_0x1ac4('0x7'));var rimraf=require('rimraf');var config=require(_0x1ac4('0x8'));var attributes=require(_0x1ac4('0x9'));module[_0x1ac4('0xa')]=function(_0x1c11a1,_0x325138){return _0x1c11a1[_0x1ac4('0xb')](_0x1ac4('0xc'),attributes,{'tableName':_0x1ac4('0xd'),'paranoid':![],'indexes':[{'name':_0x1ac4('0xe'),'fields':[_0x1ac4('0xe')]},{'name':_0x1ac4('0xf'),'fields':[_0x1ac4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 61dbf25..4545e10 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 _0x43fd=['jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','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','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x35c2ab,_0xc7661b){var _0x528f69=function(_0x26c6f5){while(--_0x26c6f5){_0x35c2ab['push'](_0x35c2ab['shift']());}};_0x528f69(++_0xc7661b);}(_0x43fd,0x150));var _0xd43f=function(_0x5c7b0b,_0x3dda71){_0x5c7b0b=_0x5c7b0b-0x0;var _0x4d68d9=_0x43fd[_0x5c7b0b];return _0x4d68d9;};'use strict';var _=require(_0xd43f('0x0'));var util=require(_0xd43f('0x1'));var moment=require('moment');var BPromise=require(_0xd43f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd43f('0x3'));var db=require(_0xd43f('0x4'))['db'];var utils=require(_0xd43f('0x5'));var logger=require(_0xd43f('0x6'))(_0xd43f('0x7'));var config=require(_0xd43f('0x8'));var jayson=require(_0xd43f('0x9'));var client=jayson[_0xd43f('0xa')][_0xd43f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2296e1,_0x907208,_0x2516ee){return new BPromise(function(_0x39a819,_0x44b1bf){return client['request'](_0x2296e1,_0x2516ee)[_0xd43f('0xc')](function(_0x43b9db){logger[_0xd43f('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x907208,_0xd43f('0xe'));logger[_0xd43f('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x907208,_0xd43f('0xe'),JSON[_0xd43f('0x10')](_0x43b9db));if(_0x43b9db[_0xd43f('0x11')]){if(_0x43b9db[_0xd43f('0x11')]['code']===0x1f4){logger['error'](_0xd43f('0x12'),_0x907208,_0x43b9db[_0xd43f('0x11')]['message']);return _0x44b1bf(_0x43b9db[_0xd43f('0x11')]['message']);}logger['error'](_0xd43f('0x12'),_0x907208,_0x43b9db[_0xd43f('0x11')]['message']);return _0x39a819(_0x43b9db[_0xd43f('0x11')][_0xd43f('0x13')]);}else{logger['info'](_0xd43f('0x12'),_0x907208,_0xd43f('0xe'));_0x39a819(_0x43b9db[_0xd43f('0x14')][_0xd43f('0x13')]);}})[_0xd43f('0x15')](function(_0x5d2f85){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x907208,_0x5d2f85);_0x44b1bf(_0x5d2f85);});});}exports[_0xd43f('0x16')]=function(_0x22d86f){var _0xda0dcc=this;return new Promise(function(_0x2e2396,_0x57931d){return db[_0xd43f('0x17')][_0xd43f('0x18')](_0x22d86f[_0xd43f('0x19')],{'raw':_0x22d86f[_0xd43f('0x1a')]?_0x22d86f[_0xd43f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd43f('0xc')](function(_0x5bae9e){logger[_0xd43f('0xd')]('CreateCmHopperHistory',_0x22d86f);logger[_0xd43f('0xf')](_0xd43f('0x16'),_0x22d86f,JSON['stringify'](_0x5bae9e));_0x2e2396(_0x5bae9e);})[_0xd43f('0x15')](function(_0x1c79b8){logger[_0xd43f('0x11')]('CreateCmHopperHistory',_0x1c79b8[_0xd43f('0x13')],_0x22d86f);_0x57931d(_0xda0dcc['error'](0x1f4,_0x1c79b8[_0xd43f('0x13')]));});});};exports[_0xd43f('0x1b')]=function(_0x1bf18d){var _0xa7858f=this;return new Promise(function(_0x38928a,_0x364d67){return db['CmHopperHistory'][_0xd43f('0x1c')]({'raw':_0x1bf18d[_0xd43f('0x1a')]?_0x1bf18d[_0xd43f('0x1a')][_0xd43f('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bf18d[_0xd43f('0x1a')]?_0x1bf18d[_0xd43f('0x1a')][_0xd43f('0x1e')]||null:null,'attributes':[[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['col']('id')),_0xd43f('0x21')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x23')))),_0xd43f('0x24')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x25')))),_0xd43f('0x26')],[db[_0xd43f('0x1f')]['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xd43f('0x1f')]['fn']('AVG',db[_0xd43f('0x1f')]['fn']('IF',db['sequelize'][_0xd43f('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xd43f('0x28')],[db[_0xd43f('0x1f')]['fn']('AVG',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x29')))),_0xd43f('0x2a')]]})[_0xd43f('0xc')](function(_0x4b15a9){logger[_0xd43f('0xd')](_0xd43f('0x1b'),_0x1bf18d);logger['debug'](_0xd43f('0x1b'),_0x1bf18d,JSON[_0xd43f('0x10')](_0x4b15a9));_0x38928a(_0x4b15a9);})[_0xd43f('0x15')](function(_0x345f14){logger[_0xd43f('0x11')]('AvgHandleTime',_0x345f14[_0xd43f('0x13')],_0x1bf18d);_0x364d67(_0xa7858f['error'](0x1f4,_0x345f14[_0xd43f('0x13')]));});});};exports[_0xd43f('0x2b')]=function(_0xe8093f){var _0x1fa248=this;return new Promise(function(_0x2d8359,_0x400fa5){return db['CmHopperHistory'][_0xd43f('0x1c')]({'raw':_0xe8093f[_0xd43f('0x1a')]?_0xe8093f['options'][_0xd43f('0x1d')]===undefined?!![]:![]:!![],'where':_0xe8093f[_0xd43f('0x1a')]?_0xe8093f[_0xd43f('0x1a')]['where']||null:null,'attributes':[[_0xd43f('0x2c'),'name'],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x2d')))),_0xd43f('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xd43f('0x22')](_0xd43f('0x2f')))),_0xd43f('0x30')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x31')))),_0xd43f('0x32')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x33')))),_0xd43f('0x34')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x35')))),'outboundDropCallsDayTimeout'],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xd43f('0x36')))),'outboundDropCallsDayCallersExit'],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x37')))),_0xd43f('0x38')],[db[_0xd43f('0x1f')]['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0xd43f('0x39')],[db[_0xd43f('0x1f')]['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')][_0xd43f('0x22')](_0xd43f('0x3a')))),_0xd43f('0x3b')],[db['sequelize']['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x3c')))),_0xd43f('0x3d')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db[_0xd43f('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0xd43f('0x3e')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['fn']('IF',db[_0xd43f('0x1f')]['literal'](_0xd43f('0x3f')))),'outboundRejectCallsDay'],[db[_0xd43f('0x1f')]['fn']('COUNT',db[_0xd43f('0x1f')]['fn']('IF',db['sequelize'][_0xd43f('0x22')](_0xd43f('0x40')))),'outboundReCallsDay']],'group':[_0xd43f('0x2c')]})['then'](function(_0x453e45){logger[_0xd43f('0xd')](_0xd43f('0x2b'),_0xe8093f);logger['debug'](_0xd43f('0x2b'),_0xe8093f,JSON[_0xd43f('0x10')](_0x453e45));_0x2d8359(_0x453e45);})[_0xd43f('0x15')](function(_0x2860da){logger[_0xd43f('0x11')](_0xd43f('0x2b'),_0x2860da[_0xd43f('0x13')],_0xe8093f);_0x400fa5(_0x1fa248[_0xd43f('0x11')](0x1f4,_0x2860da[_0xd43f('0x13')]));});});};exports[_0xd43f('0x41')]=function(_0x573389){var _0x56b09c=this;return new Promise(function(_0xc6480d,_0x588426){return db[_0xd43f('0x17')][_0xd43f('0x1c')]({'raw':_0x573389['options']?_0x573389[_0xd43f('0x1a')][_0xd43f('0x1d')]===undefined?!![]:![]:!![],'where':_0x573389[_0xd43f('0x1a')]?_0x573389[_0xd43f('0x1a')][_0xd43f('0x1e')]||null:null,'attributes':[[_0xd43f('0x2c'),_0xd43f('0x42')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db['sequelize']['col']('id')),_0xd43f('0x43')],[db[_0xd43f('0x1f')]['fn'](_0xd43f('0x20'),db[_0xd43f('0x1f')]['fn']('IF',db['sequelize'][_0xd43f('0x22')](_0xd43f('0x23')))),_0xd43f('0x44')]],'group':['campaign']})['then'](function(_0x3c87af){logger[_0xd43f('0xd')]('GetCampaignHopperHistory',_0x573389);logger[_0xd43f('0xf')](_0xd43f('0x41'),_0x573389,JSON['stringify'](_0x3c87af));_0xc6480d(_0x3c87af);})['catch'](function(_0x4964ba){logger[_0xd43f('0x11')](_0xd43f('0x41'),_0x4964ba[_0xd43f('0x13')],_0x573389);_0x588426(_0x56b09c['error'](0x1f4,_0x4964ba[_0xd43f('0x13')]));});});}; \ No newline at end of file +var _0x6482=['CreateCmHopperHistory','create','body','options','raw','catch','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','col','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','campaign','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0x6482,0xb0));var _0x2648=function(_0xc8e545,_0x38eb7e){_0xc8e545=_0xc8e545-0x0;var _0x22c48d=_0x6482[_0xc8e545];return _0x22c48d;};'use strict';var _=require('lodash');var util=require(_0x2648('0x0'));var moment=require(_0x2648('0x1'));var BPromise=require(_0x2648('0x2'));var rs=require(_0x2648('0x3'));var fs=require('fs');var Redis=require(_0x2648('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2648('0x5'))(_0x2648('0x6'));var config=require(_0x2648('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2648('0x8')][_0x2648('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3afb7b,_0x52a37b,_0x5d4ac2){return new BPromise(function(_0xdccbef,_0x3a0ee6){return client[_0x2648('0xa')](_0x3afb7b,_0x5d4ac2)[_0x2648('0xb')](function(_0x2a35d7){logger[_0x2648('0xc')](_0x2648('0xd'),_0x52a37b,_0x2648('0xe'));logger[_0x2648('0xf')](_0x2648('0x10'),_0x52a37b,_0x2648('0xe'),JSON[_0x2648('0x11')](_0x2a35d7));if(_0x2a35d7[_0x2648('0x12')]){if(_0x2a35d7[_0x2648('0x12')][_0x2648('0x13')]===0x1f4){logger['error'](_0x2648('0xd'),_0x52a37b,_0x2a35d7[_0x2648('0x12')][_0x2648('0x14')]);return _0x3a0ee6(_0x2a35d7[_0x2648('0x12')][_0x2648('0x14')]);}logger[_0x2648('0x12')](_0x2648('0xd'),_0x52a37b,_0x2a35d7[_0x2648('0x12')][_0x2648('0x14')]);return _0xdccbef(_0x2a35d7['error'][_0x2648('0x14')]);}else{logger[_0x2648('0xc')](_0x2648('0xd'),_0x52a37b,'request\x20sent');_0xdccbef(_0x2a35d7[_0x2648('0x15')][_0x2648('0x14')]);}})['catch'](function(_0x2792ff){logger['error'](_0x2648('0xd'),_0x52a37b,_0x2792ff);_0x3a0ee6(_0x2792ff);});});}exports[_0x2648('0x16')]=function(_0x18d5cd){var _0x2c2a0b=this;return new Promise(function(_0x12ad2c,_0x22d126){return db['CmHopperHistory'][_0x2648('0x17')](_0x18d5cd[_0x2648('0x18')],{'raw':_0x18d5cd['options']?_0x18d5cd[_0x2648('0x19')][_0x2648('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x375c5c){logger['info'](_0x2648('0x16'),_0x18d5cd);logger[_0x2648('0xf')](_0x2648('0x16'),_0x18d5cd,JSON[_0x2648('0x11')](_0x375c5c));_0x12ad2c(_0x375c5c);})[_0x2648('0x1b')](function(_0x16d403){logger[_0x2648('0x12')](_0x2648('0x16'),_0x16d403[_0x2648('0x14')],_0x18d5cd);_0x22d126(_0x2c2a0b[_0x2648('0x12')](0x1f4,_0x16d403['message']));});});};exports[_0x2648('0x1c')]=function(_0x4765cf){var _0x50374f=this;return new Promise(function(_0x3f5c9b,_0x30323a){return db[_0x2648('0x1d')][_0x2648('0x1e')]({'raw':_0x4765cf['options']?_0x4765cf[_0x2648('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4765cf['options']?_0x4765cf[_0x2648('0x19')][_0x2648('0x1f')]||null:null,'attributes':[[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')][_0x2648('0x22')]('id')),'predictiveIntervalTotalCalls'],[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')]['literal'](_0x2648('0x23')))),_0x2648('0x24')],[db['sequelize']['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db['sequelize']['literal'](_0x2648('0x25')))),_0x2648('0x26')],[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db['sequelize'][_0x2648('0x27')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x2648('0x20')]['fn'](_0x2648('0x28'),db[_0x2648('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x2648('0x29')],[db['sequelize']['fn'](_0x2648('0x28'),db[_0x2648('0x20')]['fn']('IF',db['sequelize']['literal'](_0x2648('0x2a')))),_0x2648('0x2b')]]})['then'](function(_0x298275){logger['info'](_0x2648('0x1c'),_0x4765cf);logger[_0x2648('0xf')](_0x2648('0x1c'),_0x4765cf,JSON[_0x2648('0x11')](_0x298275));_0x3f5c9b(_0x298275);})[_0x2648('0x1b')](function(_0x4dcb36){logger[_0x2648('0x12')](_0x2648('0x1c'),_0x4dcb36[_0x2648('0x14')],_0x4765cf);_0x30323a(_0x50374f[_0x2648('0x12')](0x1f4,_0x4dcb36[_0x2648('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x5d1d4c){var _0x1fd7f8=this;return new Promise(function(_0x81f176,_0x162943){return db[_0x2648('0x1d')][_0x2648('0x1e')]({'raw':_0x5d1d4c['options']?_0x5d1d4c[_0x2648('0x19')][_0x2648('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d1d4c[_0x2648('0x19')]?_0x5d1d4c[_0x2648('0x19')][_0x2648('0x1f')]||null:null,'attributes':[['campaign','name'],[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')][_0x2648('0x27')]('`state`\x20=\x200,\x201,\x20null'))),_0x2648('0x2c')],[db['sequelize']['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')][_0x2648('0x27')](_0x2648('0x2d')))),_0x2648('0x2e')],[db[_0x2648('0x20')]['fn']('COUNT',db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')][_0x2648('0x27')]('`state`\x20=\x204,\x201,\x20null'))),_0x2648('0x2f')],[db[_0x2648('0x20')]['fn']('COUNT',db[_0x2648('0x20')]['fn']('IF',db['sequelize']['literal'](_0x2648('0x30')))),_0x2648('0x31')],[db['sequelize']['fn'](_0x2648('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x2648('0x27')]('`state`\x20=\x208,\x201,\x20null'))),_0x2648('0x32')],[db[_0x2648('0x20')]['fn']('COUNT',db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')][_0x2648('0x27')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x2648('0x20')]['fn']('COUNT',db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')][_0x2648('0x27')](_0x2648('0x33')))),'outboundDropCallsDayCallersExit'],[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db['sequelize'][_0x2648('0x27')](_0x2648('0x34')))),_0x2648('0x35')],[db['sequelize']['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')][_0x2648('0x27')](_0x2648('0x36')))),'outboundBlacklistCallsDay'],[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db['sequelize'][_0x2648('0x27')](_0x2648('0x37')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')]['literal'](_0x2648('0x38')))),_0x2648('0x39')],[db['sequelize']['fn'](_0x2648('0x21'),db['sequelize']['fn']('IF',db[_0x2648('0x20')][_0x2648('0x27')](_0x2648('0x3a')))),_0x2648('0x3b')],[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')]['literal'](_0x2648('0x3c')))),_0x2648('0x3d')]],'group':['campaign']})['then'](function(_0x1adc37){logger['info']('GetVoiceQueueHopperHistory',_0x5d1d4c);logger[_0x2648('0xf')](_0x2648('0x3e'),_0x5d1d4c,JSON[_0x2648('0x11')](_0x1adc37));_0x81f176(_0x1adc37);})[_0x2648('0x1b')](function(_0x4dce8b){logger[_0x2648('0x12')]('GetVoiceQueueHopperHistory',_0x4dce8b['message'],_0x5d1d4c);_0x162943(_0x1fd7f8[_0x2648('0x12')](0x1f4,_0x4dce8b[_0x2648('0x14')]));});});};exports[_0x2648('0x3f')]=function(_0x3f7b23){var _0x3629ab=this;return new Promise(function(_0xdd324c,_0x426370){return db[_0x2648('0x1d')][_0x2648('0x1e')]({'raw':_0x3f7b23['options']?_0x3f7b23[_0x2648('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3f7b23['options']?_0x3f7b23[_0x2648('0x19')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x2648('0x20')]['fn'](_0x2648('0x21'),db[_0x2648('0x20')][_0x2648('0x22')]('id')),_0x2648('0x40')],[db['sequelize']['fn'](_0x2648('0x21'),db[_0x2648('0x20')]['fn']('IF',db[_0x2648('0x20')][_0x2648('0x27')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x2648('0x41')]})[_0x2648('0xb')](function(_0x44530d){logger[_0x2648('0xc')](_0x2648('0x3f'),_0x3f7b23);logger['debug']('GetCampaignHopperHistory',_0x3f7b23,JSON[_0x2648('0x11')](_0x44530d));_0xdd324c(_0x44530d);})[_0x2648('0x1b')](function(_0xeb53ec){logger['error'](_0x2648('0x3f'),_0xeb53ec['message'],_0x3f7b23);_0x426370(_0x3629ab[_0x2648('0x12')](0x1f4,_0xeb53ec[_0x2648('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7110c9b..1c9a870 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 _0x4598=['/:id','show','post','create','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xa14cf8,_0x1f2630){var _0x593535=function(_0x3832ad){while(--_0x3832ad){_0xa14cf8['push'](_0xa14cf8['shift']());}};_0x593535(++_0x1f2630);}(_0x4598,0x79));var _0x8459=function(_0x3f8631,_0x15fa06){_0x3f8631=_0x3f8631-0x0;var _0x4df996=_0x4598[_0x3f8631];return _0x4df996;};'use strict';var multer=require(_0x8459('0x0'));var util=require('util');var path=require(_0x8459('0x1'));var timeout=require('connect-timeout');var express=require(_0x8459('0x2'));var router=express[_0x8459('0x3')]();var fs_extra=require(_0x8459('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8459('0x5'));var config=require('../../config/environment');var controller=require(_0x8459('0x6'));router[_0x8459('0x7')]('/',auth[_0x8459('0x8')](),controller[_0x8459('0x9')]);router[_0x8459('0x7')](_0x8459('0xa'),auth[_0x8459('0x8')](),controller[_0x8459('0xb')]);router[_0x8459('0x7')](_0x8459('0xc'),auth[_0x8459('0x8')](),controller[_0x8459('0xd')]);router[_0x8459('0xe')]('/',auth[_0x8459('0x8')](),controller[_0x8459('0xf')]);router[_0x8459('0x10')](_0x8459('0xc'),auth['isAuthenticated'](),controller[_0x8459('0x11')]);module[_0x8459('0x12')]=router; \ No newline at end of file +var _0xc7b8=['describe','/:id','show','post','create','put','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xc7b8,0x16f));var _0x8c7b=function(_0x9a189e,_0x3f24a3){_0x9a189e=_0x9a189e-0x0;var _0x536f17=_0xc7b8[_0x9a189e];return _0x536f17;};'use strict';var multer=require(_0x8c7b('0x0'));var util=require(_0x8c7b('0x1'));var path=require(_0x8c7b('0x2'));var timeout=require(_0x8c7b('0x3'));var express=require('express');var router=express[_0x8c7b('0x4')]();var fs_extra=require(_0x8c7b('0x5'));var auth=require(_0x8c7b('0x6'));var interaction=require(_0x8c7b('0x7'));var config=require(_0x8c7b('0x8'));var controller=require('./cmHopperHistory.controller');router[_0x8c7b('0x9')]('/',auth[_0x8c7b('0xa')](),controller[_0x8c7b('0xb')]);router[_0x8c7b('0x9')](_0x8c7b('0xc'),auth[_0x8c7b('0xa')](),controller[_0x8c7b('0xd')]);router[_0x8c7b('0x9')](_0x8c7b('0xe'),auth['isAuthenticated'](),controller[_0x8c7b('0xf')]);router[_0x8c7b('0x10')]('/',auth[_0x8c7b('0xa')](),controller[_0x8c7b('0x11')]);router[_0x8c7b('0x12')](_0x8c7b('0xe'),auth[_0x8c7b('0xa')](),controller[_0x8c7b('0x13')]);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 3260b4a..d7f3889 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 _0x2cc1=['name','sequelize','exports','STRING'];(function(_0x8dfaf0,_0x3cff4f){var _0x3b69a8=function(_0x17ccff){while(--_0x17ccff){_0x8dfaf0['push'](_0x8dfaf0['shift']());}};_0x3b69a8(++_0x3cff4f);}(_0x2cc1,0x1bd));var _0x12cc=function(_0xb6c6f1,_0x12fa19){_0xb6c6f1=_0xb6c6f1-0x0;var _0xb8552f=_0x2cc1[_0xb6c6f1];return _0xb8552f;};'use strict';var Sequelize=require(_0x12cc('0x0'));module[_0x12cc('0x1')]={'name':{'type':Sequelize[_0x12cc('0x2')],'unique':_0x12cc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x12cc('0x2')]},'dialPrefix':{'type':Sequelize[_0x12cc('0x2')]}}; \ No newline at end of file +var _0x495e=['name','STRING','sequelize'];(function(_0x2cd061,_0x1fc30e){var _0x5425ec=function(_0x231e8c){while(--_0x231e8c){_0x2cd061['push'](_0x2cd061['shift']());}};_0x5425ec(++_0x1fc30e);}(_0x495e,0xfb));var _0xe495=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x495e[_0x5a7e3c];return _0x59252b;};'use strict';var Sequelize=require(_0xe495('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe495('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe495('0x2')]},'dialPrefix':{'type':Sequelize[_0xe495('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d0c6d35..0343539 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 _0x40c6=['text','Sequelize','switch','sequelize','addColumn','cm_contacts','cf_%s','getGlobalCustomFields','addAgents','ids','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','addContacts','CmContact','tags','isArray','push','each','omit','success','message','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','nolimit','getContacts','OrderBy','select','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','CmCustomField','addCustomFields','TEXT'];(function(_0x5dc087,_0x9d6e6e){var _0x24e72a=function(_0x5e1f66){while(--_0x5e1f66){_0x5dc087['push'](_0x5dc087['shift']());}};_0x24e72a(++_0x9d6e6e);}(_0x40c6,0x1f2));var _0x640c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x40c6[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x640c('0x0'));var zipdir=require(_0x640c('0x1'));var jsonpatch=require(_0x640c('0x2'));var rp=require(_0x640c('0x3'));var moment=require(_0x640c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x640c('0x5'));var path=require(_0x640c('0x6'));var sox=require(_0x640c('0x7'));var csv=require(_0x640c('0x8'));var ejs=require(_0x640c('0x9'));var fs=require('fs');var fs_extra=require(_0x640c('0xa'));var _=require('lodash');var squel=require(_0x640c('0xb'));var crypto=require('crypto');var jsforce=require(_0x640c('0xc'));var deskjs=require(_0x640c('0xd'));var toCsv=require(_0x640c('0x8'));var querystring=require(_0x640c('0xe'));var Papa=require('papaparse');var Redis=require(_0x640c('0xf'));var authService=require(_0x640c('0x10'));var qs=require(_0x640c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x640c('0x12'));var logger=require('../../config/logger')(_0x640c('0x13'));var utils=require(_0x640c('0x14'));var config=require(_0x640c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x640c('0x16'))['db'];var csv_results;config[_0x640c('0x17')]=_[_0x640c('0x18')](config[_0x640c('0x17')],{'host':_0x640c('0x19'),'port':0x18eb});var socket=require(_0x640c('0x1a'))(new Redis(config[_0x640c('0x17')]));require(_0x640c('0x1b'))[_0x640c('0x1c')](socket);function respondWithStatusCode(_0x275036,_0x5368b6){_0x5368b6=_0x5368b6||0xcc;return function(_0x16befa){if(_0x16befa){return _0x275036[_0x640c('0x1d')](_0x5368b6);}return _0x275036[_0x640c('0x1e')](_0x5368b6)['end']();};}function respondWithResult(_0x31b18a,_0x5a1545){_0x5a1545=_0x5a1545||0xc8;return function(_0x4cf0b9){if(_0x4cf0b9){return _0x31b18a[_0x640c('0x1e')](_0x5a1545)[_0x640c('0x1f')](_0x4cf0b9);}};}function respondWithFilteredResult(_0x33830b,_0x150898){return function(_0xef9eb0){if(_0xef9eb0){var _0x113136=typeof _0x150898['offset']==='undefined'&&typeof _0x150898[_0x640c('0x20')]==='undefined';var _0x5adc8c=_0xef9eb0[_0x640c('0x21')];var _0x59d979=_0x113136?0x0:_0x150898['offset'];var _0x9df4cc=_0x113136?_0xef9eb0[_0x640c('0x21')]:_0x150898[_0x640c('0x22')]+_0x150898['limit'];var _0x367c3c;if(_0x9df4cc>=_0x5adc8c){_0x9df4cc=_0x5adc8c;_0x367c3c=0xc8;}else{_0x367c3c=0xce;}_0x33830b[_0x640c('0x1e')](_0x367c3c);return _0x33830b[_0x640c('0x23')](_0x640c('0x24'),_0x59d979+'-'+_0x9df4cc+'/'+_0x5adc8c)[_0x640c('0x1f')](_0xef9eb0);}return null;};}function patchUpdates(_0x3cbf31){return function(_0x5ee714){try{jsonpatch[_0x640c('0x25')](_0x5ee714,_0x3cbf31,!![]);}catch(_0x10ec19){return BPromise['reject'](_0x10ec19);}return _0x5ee714[_0x640c('0x26')]();};}function saveUpdates(_0x48d7b4,_0x13e6c0){return function(_0x52458b){if(_0x52458b){return _0x52458b[_0x640c('0x27')](_0x48d7b4)[_0x640c('0x28')](function(_0x4debcd){return _0x4debcd;});}return null;};}function removeEntity(_0x14bae5,_0x514ab5){return function(_0x3319be){if(_0x3319be){return _0x3319be[_0x640c('0x29')]()[_0x640c('0x28')](function(){var _0x596458=_0x3319be[_0x640c('0x2a')]({'plain':!![]});var _0x4b5946='Lists';return db[_0x640c('0x2b')][_0x640c('0x29')]({'where':{'type':_0x4b5946,'resourceId':_0x596458['id']}})[_0x640c('0x28')](function(){return _0x3319be;});})['then'](function(){_0x14bae5[_0x640c('0x1e')](0xcc)[_0x640c('0x2c')]();});}};}function handleEntityNotFound(_0x165108,_0x8087){return function(_0x36350f){if(!_0x36350f){_0x165108['sendStatus'](0x194);}return _0x36350f;};}function handleError(_0x5de98f,_0x2c166b){_0x2c166b=_0x2c166b||0x1f4;return function(_0x35a93f){logger[_0x640c('0x2d')](_0x35a93f[_0x640c('0x2e')]);if(_0x35a93f[_0x640c('0x2f')]){delete _0x35a93f[_0x640c('0x2f')];}_0x5de98f[_0x640c('0x1e')](_0x2c166b)[_0x640c('0x30')](_0x35a93f);};}exports[_0x640c('0x31')]=function(_0x329b33,_0x23b968){var _0x4105c2={},_0x1aeeb0={},_0x310d8c={'count':0x0,'rows':[]};var _0x5c1d40=_[_0x640c('0x32')](db[_0x640c('0x33')][_0x640c('0x34')],function(_0x1c6872){return{'name':_0x1c6872[_0x640c('0x35')],'type':_0x1c6872[_0x640c('0x36')][_0x640c('0x37')]};});_0x1aeeb0[_0x640c('0x38')]=_[_0x640c('0x32')](_0x5c1d40,_0x640c('0x2f'));_0x1aeeb0[_0x640c('0x39')]=_[_0x640c('0x3a')](_0x329b33[_0x640c('0x39')]);_0x1aeeb0[_0x640c('0x3b')]=_[_0x640c('0x3c')](_0x1aeeb0['model'],_0x1aeeb0['query']);_0x4105c2[_0x640c('0x3d')]=_['intersection'](_0x1aeeb0['model'],qs[_0x640c('0x3e')](_0x329b33['query'][_0x640c('0x3e')]));_0x4105c2[_0x640c('0x3d')]=_0x4105c2[_0x640c('0x3d')]['length']?_0x4105c2[_0x640c('0x3d')]:_0x1aeeb0['model'];if(!_0x329b33[_0x640c('0x39')][_0x640c('0x3f')]('nolimit')){_0x4105c2['limit']=qs[_0x640c('0x20')](_0x329b33[_0x640c('0x39')][_0x640c('0x20')]);_0x4105c2['offset']=qs[_0x640c('0x22')](_0x329b33[_0x640c('0x39')][_0x640c('0x22')]);}_0x4105c2[_0x640c('0x40')]=qs['sort'](_0x329b33[_0x640c('0x39')][_0x640c('0x41')]);_0x4105c2[_0x640c('0x42')]=qs[_0x640c('0x3b')](_['pick'](_0x329b33[_0x640c('0x39')],_0x1aeeb0[_0x640c('0x3b')]),_0x5c1d40);if(_0x329b33[_0x640c('0x39')][_0x640c('0x43')]){_0x4105c2[_0x640c('0x42')]=_[_0x640c('0x44')](_0x4105c2[_0x640c('0x42')],{'$or':_[_0x640c('0x32')](_0x5c1d40,function(_0x561ab2){if(_0x561ab2['type']!==_0x640c('0x45')){var _0x44e3db={};_0x44e3db[_0x561ab2[_0x640c('0x2f')]]={'$like':'%'+_0x329b33[_0x640c('0x39')]['filter']+'%'};return _0x44e3db;}})});}_0x4105c2=_[_0x640c('0x44')]({},_0x4105c2,_0x329b33[_0x640c('0x46')]);var _0xd52642={'where':_0x4105c2[_0x640c('0x42')]};return db['CmList'][_0x640c('0x21')](_0xd52642)[_0x640c('0x28')](function(_0x5dc90e){_0x310d8c[_0x640c('0x21')]=_0x5dc90e;if(_0x329b33[_0x640c('0x39')][_0x640c('0x47')]){_0x4105c2[_0x640c('0x48')]=[{'all':!![]}];}return db[_0x640c('0x33')][_0x640c('0x49')](_0x4105c2);})[_0x640c('0x28')](function(_0x1be9f7){_0x310d8c['rows']=_0x1be9f7;return _0x310d8c;})['then'](respondWithFilteredResult(_0x23b968,_0x4105c2))[_0x640c('0x4a')](handleError(_0x23b968,null));};exports[_0x640c('0x4b')]=function(_0xc7cd52,_0x173eaf){var _0x41b2e7={'raw':![],'where':{'id':_0xc7cd52[_0x640c('0x4c')]['id']}},_0xb50366={};_0xb50366['model']=_[_0x640c('0x3a')](db[_0x640c('0x33')]['rawAttributes']);_0xb50366['query']=_['keys'](_0xc7cd52[_0x640c('0x39')]);_0xb50366['filters']=_[_0x640c('0x3c')](_0xb50366[_0x640c('0x38')],_0xb50366[_0x640c('0x39')]);_0x41b2e7[_0x640c('0x3d')]=_[_0x640c('0x3c')](_0xb50366['model'],qs[_0x640c('0x3e')](_0xc7cd52[_0x640c('0x39')][_0x640c('0x3e')]));_0x41b2e7[_0x640c('0x3d')]=_0x41b2e7[_0x640c('0x3d')][_0x640c('0x4d')]?_0x41b2e7['attributes']:_0xb50366[_0x640c('0x38')];if(_0xc7cd52[_0x640c('0x39')][_0x640c('0x47')]){_0x41b2e7[_0x640c('0x48')]=[{'all':!![]}];}_0x41b2e7=_[_0x640c('0x44')]({},_0x41b2e7,_0xc7cd52[_0x640c('0x46')]);return db[_0x640c('0x33')]['find'](_0x41b2e7)[_0x640c('0x28')](handleEntityNotFound(_0x173eaf,null))['then'](respondWithResult(_0x173eaf,null))[_0x640c('0x4a')](handleError(_0x173eaf,null));};exports[_0x640c('0x4e')]=function(_0x53bccc,_0x4d62c9){return db[_0x640c('0x33')][_0x640c('0x4e')](_0x53bccc[_0x640c('0x4f')],{})['then'](function(_0x270209){var _0x4732b2=_0x53bccc[_0x640c('0x50')][_0x640c('0x2a')]({'plain':!![]});if(!_0x4732b2)throw new Error(_0x640c('0x51'));if(_0x4732b2[_0x640c('0x52')]===_0x640c('0x50')){var _0x3e88e6=_0x270209[_0x640c('0x2a')]({'plain':!![]});var _0x31e946=_0x640c('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x31e946,'userProfileId':_0x4732b2[_0x640c('0x54')]},'raw':!![]})['then'](function(_0x141558){if(_0x141558&&_0x141558[_0x640c('0x55')]===0x0){return db['UserProfileResource'][_0x640c('0x4e')]({'name':_0x3e88e6[_0x640c('0x2f')],'resourceId':_0x3e88e6['id'],'type':_0x141558[_0x640c('0x2f')],'sectionId':_0x141558['id']},{})[_0x640c('0x28')](function(){return _0x270209;});}else{return _0x270209;}})[_0x640c('0x4a')](function(_0x468b9a){logger[_0x640c('0x2d')](_0x640c('0x56'),_0x468b9a);throw _0x468b9a;});}return _0x270209;})['then'](respondWithResult(_0x4d62c9,0xc9))[_0x640c('0x4a')](handleError(_0x4d62c9,null));};exports[_0x640c('0x27')]=function(_0x25e468,_0x22b276){if(_0x25e468['body']['id']){delete _0x25e468['body']['id'];}return db['CmList'][_0x640c('0x57')]({'where':{'id':_0x25e468[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x22b276,null))[_0x640c('0x28')](saveUpdates(_0x25e468['body'],null))[_0x640c('0x28')](respondWithResult(_0x22b276,null))[_0x640c('0x4a')](handleError(_0x22b276,null));};exports[_0x640c('0x29')]=function(_0x9a9122,_0x303f6c){return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0x9a9122['params']['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x303f6c,null))[_0x640c('0x28')](removeEntity(_0x303f6c,null))['catch'](handleError(_0x303f6c,null));};exports[_0x640c('0x58')]=function(_0x3873c5,_0x2b2318){return db[_0x640c('0x33')][_0x640c('0x58')]()[_0x640c('0x28')](respondWithResult(_0x2b2318,null))['catch'](handleError(_0x2b2318,null));};exports[_0x640c('0x59')]=function(_0x24fdf8,_0x2de7ac,_0x51b4f4){if(_0x24fdf8['body']['id']){delete _0x24fdf8[_0x640c('0x4f')]['id'];}return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0x24fdf8['params']['id']}})['then'](handleEntityNotFound(_0x2de7ac,null))[_0x640c('0x28')](function(_0x134c2f){if(_0x134c2f){_0x24fdf8[_0x640c('0x4f')][_0x640c('0x5a')]=_0x134c2f['id'];return db[_0x640c('0x5b')]['create'](_0x24fdf8['body']);}})['then'](respondWithResult(_0x2de7ac,null))[_0x640c('0x4a')](handleError(_0x2de7ac,null));};exports[_0x640c('0x5c')]=function(_0x5c2ad2,_0x234ac6,_0xa2435d){var _0x12dad0={'raw':![],'where':{}};var _0x15e4e3={};var _0x474315={'count':0x0,'rows':[]};return db['CmList'][_0x640c('0x5d')]({'where':{'id':_0x5c2ad2['params']['id']}})['then'](handleEntityNotFound(_0x234ac6,null))[_0x640c('0x28')](function(_0x1bfeed){if(_0x1bfeed){_0x15e4e3[_0x640c('0x38')]=_['keys'](db[_0x640c('0x5b')]['rawAttributes']);_0x15e4e3[_0x640c('0x39')]=_[_0x640c('0x3a')](_0x5c2ad2[_0x640c('0x39')]);_0x15e4e3[_0x640c('0x3b')]=_[_0x640c('0x3c')](_0x15e4e3['model'],_0x15e4e3[_0x640c('0x39')]);_0x12dad0[_0x640c('0x3d')]=_[_0x640c('0x3c')](_0x15e4e3[_0x640c('0x38')],qs['fields'](_0x5c2ad2[_0x640c('0x39')][_0x640c('0x3e')]));_0x12dad0['attributes']=_0x12dad0[_0x640c('0x3d')][_0x640c('0x4d')]?_0x12dad0[_0x640c('0x3d')]:_0x15e4e3[_0x640c('0x38')];if(!_0x5c2ad2[_0x640c('0x39')][_0x640c('0x3f')]('nolimit')){_0x12dad0[_0x640c('0x20')]=qs[_0x640c('0x20')](_0x5c2ad2[_0x640c('0x39')][_0x640c('0x20')]);_0x12dad0[_0x640c('0x22')]=qs[_0x640c('0x22')](_0x5c2ad2[_0x640c('0x39')][_0x640c('0x22')]);}_0x12dad0[_0x640c('0x40')]=qs[_0x640c('0x41')](_0x5c2ad2[_0x640c('0x39')][_0x640c('0x41')]);_0x12dad0[_0x640c('0x42')]=qs['filters'](_[_0x640c('0x5e')](_0x5c2ad2[_0x640c('0x39')],_0x15e4e3[_0x640c('0x3b')]));_0x12dad0['where'][_0x640c('0x5a')]=_0x1bfeed['id'];if(_0x5c2ad2['query'][_0x640c('0x43')]){_0x12dad0['where']=_[_0x640c('0x44')](_0x12dad0['where'],{'$or':_[_0x640c('0x32')](_0x12dad0[_0x640c('0x3d')],function(_0x28cd58){var _0x5ef1b4={};_0x5ef1b4[_0x28cd58]={'$like':'%'+_0x5c2ad2['query'][_0x640c('0x43')]+'%'};return _0x5ef1b4;})});}_0x12dad0=_[_0x640c('0x44')]({},_0x12dad0,_0x5c2ad2[_0x640c('0x46')]);return db[_0x640c('0x5b')][_0x640c('0x21')]({'where':_0x12dad0[_0x640c('0x42')]})[_0x640c('0x28')](function(_0x422bc1){_0x474315['count']=_0x422bc1;if(_0x5c2ad2[_0x640c('0x39')][_0x640c('0x47')]){_0x12dad0['include']=[{'all':!![]}];}return db[_0x640c('0x5b')][_0x640c('0x49')](_0x12dad0);})['then'](function(_0x4eea51){_0x474315[_0x640c('0x5f')]=_0x4eea51;return _0x474315;});}})['then'](respondWithFilteredResult(_0x234ac6,_0x12dad0))['catch'](handleError(_0x234ac6,null));};exports[_0x640c('0x60')]=function(_0x17fc8b,_0x946196,_0x427f97){return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0x17fc8b[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x946196,null))[_0x640c('0x28')](function(_0x34e887){if(_0x34e887){return _0x34e887[_0x640c('0x60')](_0x17fc8b[_0x640c('0x39')]['ids']);}})[_0x640c('0x28')](respondWithStatusCode(_0x946196,null))['catch'](handleError(_0x946196,null));};exports[_0x640c('0x61')]=function(_0x5ec07f,_0x5711d5,_0x3563ae){return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0x5ec07f['params']['id']}})['then'](handleEntityNotFound(_0x5711d5,null))[_0x640c('0x28')](function(_0x231d96){if(_0x231d96){var _0x205a0c=[];var _0x326c2f={'success':[],'errors':[]};return db[_0x640c('0x62')]['describe']()[_0x640c('0x28')](function(_0x5a0aed){if(_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')]&&_['isArray'](_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')])){if(_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')][_0x640c('0x4d')]){_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')]=_0x5ec07f['body'][_0x640c('0x63')]['join'](';')+';';}else{_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')]=null;}}else{_0x5ec07f[_0x640c('0x4f')][_0x640c('0x63')]=null;}if(_0x5ec07f['body']&&_[_0x640c('0x64')](_0x5ec07f[_0x640c('0x4f')])){for(var _0x43fd1b=0x0;_0x43fd1b<_0x5ec07f[_0x640c('0x4f')][_0x640c('0x4d')];_0x43fd1b+=0x1){_0x5ec07f[_0x640c('0x4f')][_0x43fd1b]['ListId']=_0x5ec07f[_0x640c('0x4c')]['id'];_0x205a0c[_0x640c('0x65')](_0x5ec07f[_0x640c('0x4f')][_0x43fd1b]);}return BPromise[_0x640c('0x66')](_0x205a0c,function(_0x473916){return db['CmContact'][_0x640c('0x4e')](_[_0x640c('0x67')](_0x473916,['ids','id'])||{},{'fields':_[_0x640c('0x3a')](_0x5a0aed),'raw':!![]})[_0x640c('0x28')](function(_0x4bf37a){_0x326c2f[_0x640c('0x68')][_0x640c('0x65')](_0x4bf37a['dataValues']);})[_0x640c('0x4a')](function(_0x44622b){_0x326c2f['errors']['push']({'data':_0x473916,'error':_0x44622b[_0x640c('0x69')]});});})[_0x640c('0x28')](function(_0x41415f){return _0x326c2f;})[_0x640c('0x4a')](function(_0x8fe5c0){return _0x8fe5c0;});}else{_0x5711d5[_0x640c('0x1e')](0x190)[_0x640c('0x1f')]({'message':_0x640c('0x6a')});}});}})[_0x640c('0x28')](respondWithResult(_0x5711d5,null))[_0x640c('0x4a')](handleError(_0x5711d5,null));};exports['getContacts']=function(_0x32e332,_0x291c59,_0x3a9bbe){var _0x21c73f;return db[_0x640c('0x33')]['find']({'where':{'id':_0x32e332[_0x640c('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x640c('0x6b')}]})['then'](handleEntityNotFound(_0x291c59,null))[_0x640c('0x28')](function(_0x4a6212){if(_0x4a6212){_0x21c73f=_0x4a6212;return db[_0x640c('0x62')][_0x640c('0x34')];}})['then'](function(_0x51fb88){if(_0x51fb88){var _0x2a874f={};var _0x32dab3={};_0x32dab3[_0x640c('0x38')]=_[_0x640c('0x6c')](_[_0x640c('0x3a')](_0x51fb88),_['map'](_0x21c73f[_0x640c('0x6b')],function(_0x27cae9){return util[_0x640c('0x6d')](_0x640c('0x6e'),_0x27cae9['id']);}));_0x32dab3[_0x640c('0x39')]=_[_0x640c('0x3a')](_0x32e332[_0x640c('0x39')]);_0x32dab3['filters']=_[_0x640c('0x3c')](_0x32dab3[_0x640c('0x38')],_0x32dab3[_0x640c('0x39')]);_0x2a874f[_0x640c('0x3d')]=_[_0x640c('0x3c')](_0x32dab3[_0x640c('0x38')],qs['fields'](_0x32e332['query'][_0x640c('0x3e')]));_0x2a874f[_0x640c('0x3d')]=_0x2a874f[_0x640c('0x3d')]['length']?_0x2a874f[_0x640c('0x3d')]:_0x32dab3[_0x640c('0x38')];if(!_0x32e332['query'][_0x640c('0x3f')](_0x640c('0x6f'))){_0x2a874f[_0x640c('0x20')]=qs['limit'](_0x32e332['query']['limit']);_0x2a874f[_0x640c('0x22')]=qs[_0x640c('0x22')](_0x32e332[_0x640c('0x39')][_0x640c('0x22')]);}_0x2a874f[_0x640c('0x40')]=qs[_0x640c('0x41')](_0x32e332['query']['sort']);_0x2a874f[_0x640c('0x42')]=qs[_0x640c('0x3b')](_[_0x640c('0x5e')](_0x32e332[_0x640c('0x39')],_0x32dab3[_0x640c('0x3b')]));_0x2a874f['raw']=!![];if(_0x32e332[_0x640c('0x39')]['filter']){_0x2a874f[_0x640c('0x42')]=_[_0x640c('0x44')](_0x2a874f[_0x640c('0x42')],{'$or':_['map'](_0x2a874f[_0x640c('0x3d')],function(_0x481d4d){var _0x2eef73={};_0x2eef73[_0x481d4d]={'$like':'%'+_0x32e332[_0x640c('0x39')][_0x640c('0x43')]+'%'};return _0x2eef73;})});}_0x2a874f=_[_0x640c('0x44')]({},_0x2a874f,_0x32e332[_0x640c('0x46')]);return _0x21c73f[_0x640c('0x70')](_0x2a874f);}})[_0x640c('0x28')](respondWithResult(_0x291c59,null))[_0x640c('0x4a')](handleError(_0x291c59,null));};exports['getContactsCsv']=function(_0x266f2a,_0x22a3f7,_0x484f89){var _0x148a92;var _0x1da114;var _0x4ba7a9;var _0x910e35=_0x266f2a['params']['id'];csv_results=[];return db['ContactItemType'][_0x640c('0x49')]({'attributes':['id',_0x640c('0x2f')],'raw':!![],'order':[_0x640c('0x71')]})[_0x640c('0x28')](function(_0x222eb7){_0x148a92=_0x222eb7;var _0xb24c3f=_[_0x640c('0x3a')](db[_0x640c('0x62')][_0x640c('0x34')]);return db['CmCustomField'][_0x640c('0x49')]({'raw':!![],'attributes':['id','alias']})[_0x640c('0x28')](function(_0x375348){_0x1da114=_0x375348;var _0x553349=squel[_0x640c('0x72')]()[_0x640c('0x3e')](_0xb24c3f)['from']('cm_contacts','c')[_0x640c('0x42')]('c.ListId\x20=\x20?',_0x910e35)[_0x640c('0x42')](_0x640c('0x73'))[_0x640c('0x74')]();for(var _0x39f8b7=0x0;_0x39f8b7<_0x1da114[_0x640c('0x4d')];_0x39f8b7++){_0x553349[_0x640c('0x75')](_0x640c('0x76')+_0x1da114[_0x39f8b7]['id'],_0x640c('0x77')+_0x1da114[_0x39f8b7][_0x640c('0x78')]);}for(var _0x39f8b7=0x0;_0x39f8b7<_0x148a92[_0x640c('0x4d')];_0x39f8b7++){_0x553349[_0x640c('0x75')](squel[_0x640c('0x72')]()['field']('item')[_0x640c('0x79')](_0x640c('0x7a'))[_0x640c('0x42')](_0x640c('0x7b'),_0x148a92[_0x39f8b7]['id'])[_0x640c('0x42')](_0x640c('0x7c')),_0x640c('0x7d')+_0x148a92[_0x39f8b7][_0x640c('0x2f')]);_0x553349[_0x640c('0x75')](squel['select']()[_0x640c('0x75')](_0x640c('0x7e'))[_0x640c('0x79')]('cm_contact_has_items')[_0x640c('0x42')]('ItemTypeId\x20=\x20?',_0x148a92[_0x39f8b7]['id'])[_0x640c('0x42')](_0x640c('0x7c')),'description_additionalPhone_'+_0x148a92[_0x39f8b7]['name']);}var _0x4b4a88=[];_0x4b4a88[_0x640c('0x65')](_0x553349['toString']());BPromise[_0x640c('0x66')](_0x4b4a88,handleQuery)['then'](function(_0x1bec37){handleQuery(_0x553349['toString']());var _0x36365a=csv_results[0x0];if(!_[_0x640c('0x7f')](_0x36365a)){var _0x12d3c6=toCsv(_0x36365a);var _0x4e67c3=Date[_0x640c('0x80')]();fs[_0x640c('0x81')](util['format']('/tmp/list_%d_%s.csv',_0x910e35,_0x4e67c3),_0x12d3c6);_0x22a3f7[_0x640c('0x82')](_0x640c('0x83'),_0x640c('0x84')+util[_0x640c('0x6d')](_0x640c('0x85'),_0x910e35,_0x4e67c3));_0x22a3f7['setHeader'](_0x640c('0x86'),_0x640c('0x87'));return _0x22a3f7[_0x640c('0x88')](util['format'](_0x640c('0x89'),_0x910e35,_0x4e67c3));}else{return _0x22a3f7['sendStatus'](0xcc);}});});});};exports[_0x640c('0x8a')]=function(_0x141368,_0x17bbf5,_0x5b455d){var _0x4ac4ff;delete _0x141368[_0x640c('0x4f')]['id'];return db['CmList'][_0x640c('0x5d')]({'where':{'id':_0x141368[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x17bbf5,null))[_0x640c('0x28')](function(_0x5794c1){if(_0x5794c1){return db['sequelize']['transaction'](function(_0x59ef5b){return db[_0x640c('0x8b')][_0x640c('0x4e')](_0x141368[_0x640c('0x4f')],{'transaction':_0x59ef5b})['then'](function(_0x8bab2d){_0x4ac4ff=_0x8bab2d;return _0x5794c1[_0x640c('0x8c')](_0x8bab2d,{'transaction':_0x59ef5b});})[_0x640c('0x28')](function(){var _0x4b1c13={'type':db['Sequelize'][_0x640c('0x8d')],'transaction':_0x59ef5b};switch(_0x141368[_0x640c('0x4f')]['type']){case _0x640c('0x8e'):_0x4b1c13[_0x640c('0x36')]=db[_0x640c('0x8f')][_0x640c('0x8d')];break;case'number':_0x4b1c13[_0x640c('0x36')]=db[_0x640c('0x8f')]['INTEGER'];break;case _0x640c('0x90'):_0x4b1c13[_0x640c('0x36')]=db[_0x640c('0x8f')]['BOOLEAN'];_0x4b1c13['defaultValue']=![];break;default:}return db[_0x640c('0x91')]['queryInterface'][_0x640c('0x92')](_0x640c('0x93'),util['format'](_0x640c('0x94'),_0x4ac4ff['id']),_0x4b1c13);})[_0x640c('0x28')](function(){return _0x4ac4ff;});});}})[_0x640c('0x28')](respondWithResult(_0x17bbf5,null))[_0x640c('0x4a')](handleError(_0x17bbf5,null));};exports['getCustomFields']=function(_0x557713,_0x2e0d4c,_0x4e4871){var _0x3780ad={};var _0x35ebb5={};var _0x449296;var _0x38c96a;return db['CmList'][_0x640c('0x5d')]({'where':{'id':_0x557713[_0x640c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e0d4c,null))[_0x640c('0x28')](function(_0x450c45){if(_0x450c45){_0x449296=_0x450c45;_0x35ebb5[_0x640c('0x38')]=_[_0x640c('0x3a')](db[_0x640c('0x8b')][_0x640c('0x34')]);_0x35ebb5['query']=_['keys'](_0x557713['query']);_0x35ebb5[_0x640c('0x3b')]=_['intersection'](_0x35ebb5['model'],_0x35ebb5[_0x640c('0x39')]);_0x3780ad[_0x640c('0x3d')]=_['intersection'](_0x35ebb5[_0x640c('0x38')],qs[_0x640c('0x3e')](_0x557713[_0x640c('0x39')]['fields']));_0x3780ad[_0x640c('0x3d')]=_0x3780ad['attributes'][_0x640c('0x4d')]?_0x3780ad[_0x640c('0x3d')]:_0x35ebb5[_0x640c('0x38')];_0x3780ad[_0x640c('0x40')]=qs[_0x640c('0x41')](_0x557713[_0x640c('0x39')][_0x640c('0x41')]);_0x3780ad['where']=qs[_0x640c('0x3b')](_[_0x640c('0x5e')](_0x557713[_0x640c('0x39')],_0x35ebb5['filters']));_0x3780ad[_0x640c('0x42')]=_[_0x640c('0x44')](_0x3780ad[_0x640c('0x42')],{'$or':[{'ListId':_0x450c45['id']},{'ListId':null}]});if(_0x557713[_0x640c('0x39')][_0x640c('0x43')]){_0x3780ad[_0x640c('0x42')]=_[_0x640c('0x44')](_0x3780ad[_0x640c('0x42')],{'$or':_[_0x640c('0x32')](_0x3780ad['attributes'],function(_0x448efd){var _0x1565f2={};_0x1565f2[_0x448efd]={'$like':'%'+_0x557713[_0x640c('0x39')]['filter']+'%'};return _0x1565f2;})});}_0x3780ad=_[_0x640c('0x44')]({},_0x3780ad,_0x557713[_0x640c('0x46')]);return db[_0x640c('0x8b')]['findAndCountAll'](_0x3780ad);}})[_0x640c('0x28')](respondWithResult(_0x2e0d4c,null))['catch'](handleError(_0x2e0d4c,null));};exports[_0x640c('0x95')]=function(_0x5f5249,_0x1632a6){return db[_0x640c('0x8b')]['findAndCountAll']({'where':{'ListId':null}})[_0x640c('0x28')](handleEntityNotFound(_0x1632a6,null))[_0x640c('0x28')](function(_0x2de780){return _0x2de780;})['then'](respondWithResult(_0x1632a6,null))[_0x640c('0x4a')](handleError(_0x1632a6,null));};exports[_0x640c('0x96')]=function(_0x141639,_0x4bf2d0,_0x2ee3e4){return db[_0x640c('0x33')]['find']({'where':{'id':_0x141639[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x4bf2d0,null))[_0x640c('0x28')](function(_0x2ab0ac){if(_0x2ab0ac){return _0x2ab0ac[_0x640c('0x96')](_0x141639['body']['ids'],_['omit'](_0x141639['body'],[_0x640c('0x97'),'id'])||{})[_0x640c('0x98')](function(_0x4bacf4){for(var _0x109484=0x0;_0x109484<_0x141639[_0x640c('0x4f')][_0x640c('0x97')][_0x640c('0x4d')];_0x109484+=0x1){socket[_0x640c('0x99')](_0x640c('0x9a'),{'UserId':Number(_0x141639[_0x640c('0x4f')][_0x640c('0x97')][_0x109484]),'CmListId':Number(_0x141639[_0x640c('0x4c')]['id'])});}return _0x4bacf4;});}})['then'](respondWithResult(_0x4bf2d0,null))[_0x640c('0x4a')](handleError(_0x4bf2d0,null));};exports['removeAgents']=function(_0xdc53fb,_0x56a777,_0x53fbac){return db[_0x640c('0x33')][_0x640c('0x57')]({'where':{'id':_0xdc53fb[_0x640c('0x4c')]['id']}})[_0x640c('0x28')](handleEntityNotFound(_0x56a777,null))[_0x640c('0x28')](function(_0x12285a){if(_0x12285a){return _0x12285a[_0x640c('0x9b')](_0xdc53fb[_0x640c('0x39')]['ids'])[_0x640c('0x28')](function(){if(_[_0x640c('0x64')](_0xdc53fb[_0x640c('0x39')]['ids'])){for(var _0x2e08ee=0x0;_0x2e08ee<_0xdc53fb['query'][_0x640c('0x97')][_0x640c('0x4d')];_0x2e08ee+=0x1){socket[_0x640c('0x99')]('userCmList:remove',{'UserId':Number(_0xdc53fb['query'][_0x640c('0x97')][_0x2e08ee]),'CmListId':Number(_0xdc53fb[_0x640c('0x4c')]['id'])});}}else{socket[_0x640c('0x99')](_0x640c('0x9c'),{'UserId':Number(_0xdc53fb[_0x640c('0x39')]['ids']),'CmListId':Number(_0xdc53fb['params']['id'])});}});}})[_0x640c('0x28')](respondWithStatusCode(_0x56a777,null))[_0x640c('0x4a')](handleError(_0x56a777,null));};exports[_0x640c('0x9d')]=function(_0x5da384,_0x1b9ff2,_0x1ea3d3){var _0xd761c1={};var _0x28775f={};var _0x56f514;var _0x23ec61;return db['CmList'][_0x640c('0x5d')]({'where':{'id':_0x5da384[_0x640c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b9ff2,null))['then'](function(_0x194de8){if(_0x194de8){_0x56f514=_0x194de8;_0x28775f[_0x640c('0x38')]=_[_0x640c('0x3a')](db[_0x640c('0x9e')][_0x640c('0x34')]);_0x28775f[_0x640c('0x39')]=_[_0x640c('0x3a')](_0x5da384[_0x640c('0x39')]);_0x28775f[_0x640c('0x3b')]=_[_0x640c('0x3c')](_0x28775f['model'],_0x28775f[_0x640c('0x39')]);_0xd761c1[_0x640c('0x3d')]=_['intersection'](_0x28775f[_0x640c('0x38')],qs[_0x640c('0x3e')](_0x5da384['query'][_0x640c('0x3e')]));_0xd761c1[_0x640c('0x3d')]=_0xd761c1[_0x640c('0x3d')]['length']?_0xd761c1[_0x640c('0x3d')]:_0x28775f[_0x640c('0x38')];_0xd761c1[_0x640c('0x40')]=qs[_0x640c('0x41')](_0x5da384[_0x640c('0x39')][_0x640c('0x41')]);_0xd761c1[_0x640c('0x42')]=qs['filters'](_[_0x640c('0x5e')](_0x5da384[_0x640c('0x39')],_0x28775f[_0x640c('0x3b')]));if(_0x5da384[_0x640c('0x39')][_0x640c('0x43')]){_0xd761c1['where']=_[_0x640c('0x44')](_0xd761c1[_0x640c('0x42')],{'$or':_['map'](_0xd761c1[_0x640c('0x3d')],function(_0x21bfa8){var _0x4c1b8a={};_0x4c1b8a[_0x21bfa8]={'$like':'%'+_0x5da384['query']['filter']+'%'};return _0x4c1b8a;})});}_0xd761c1=_[_0x640c('0x44')]({},_0xd761c1,_0x5da384[_0x640c('0x46')]);return _0x56f514['getAgents'](_0xd761c1);}})[_0x640c('0x28')](function(_0x554607){if(_0x554607){_0x23ec61=_0x554607[_0x640c('0x4d')];if(!_0x5da384[_0x640c('0x39')]['hasOwnProperty'](_0x640c('0x6f'))){_0xd761c1['limit']=qs['limit'](_0x5da384['query']['limit']);_0xd761c1[_0x640c('0x22')]=qs[_0x640c('0x22')](_0x5da384['query'][_0x640c('0x22')]);}return _0x56f514[_0x640c('0x9d')](_0xd761c1);}})['then'](function(_0xfccbdd){if(_0xfccbdd){return _0xfccbdd?{'count':_0x23ec61,'rows':_0xfccbdd}:null;}})[_0x640c('0x28')](respondWithResult(_0x1b9ff2,null))[_0x640c('0x4a')](handleError(_0x1b9ff2,null));};function handleQuery(_0x9d683c){logger[_0x640c('0x9f')](_0x9d683c);return db[_0x640c('0x91')][_0x640c('0x39')](_0x9d683c)[_0x640c('0x98')](function(_0x3fe76b){csv_results[_0x640c('0x65')](_0x3fe76b);})[_0x640c('0x4a')](function(_0x52450a){logger[_0x640c('0x2d')](_0x52450a['message']);});} \ No newline at end of file +var _0x2a9f=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','order','pick','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','each','success','push','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','ContactItemType','OrderBy','select','from','field','customField_','alias','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','isEmpty','now','setHeader','Content-disposition','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','message','eml-format','rimraf','zip-dir','moment','bluebird','util','path','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/environment','../../config/license/util','../../mysqldb','redis','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','error','stack','name','send','map','CmList','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x4285a7,_0x48e566){var _0x21d936=function(_0x498520){while(--_0x498520){_0x4285a7['push'](_0x4285a7['shift']());}};_0x21d936(++_0x48e566);}(_0x2a9f,0xf5));var _0xf2a9=function(_0x38ccd3,_0x5e56ec){_0x38ccd3=_0x38ccd3-0x0;var _0x2dbca4=_0x2a9f[_0x38ccd3];return _0x2dbca4;};'use strict';var emlformat=require(_0xf2a9('0x0'));var rimraf=require(_0xf2a9('0x1'));var zipdir=require(_0xf2a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2a9('0x3'));var BPromise=require(_0xf2a9('0x4'));var Mustache=require('mustache');var util=require(_0xf2a9('0x5'));var path=require(_0xf2a9('0x6'));var sox=require(_0xf2a9('0x7'));var csv=require(_0xf2a9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2a9('0x9'));var _=require(_0xf2a9('0xa'));var squel=require(_0xf2a9('0xb'));var crypto=require(_0xf2a9('0xc'));var jsforce=require(_0xf2a9('0xd'));var deskjs=require(_0xf2a9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf2a9('0xf'));var Papa=require(_0xf2a9('0x10'));var Redis=require('ioredis');var authService=require(_0xf2a9('0x11'));var qs=require(_0xf2a9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2a9('0x13'));var logger=require(_0xf2a9('0x14'))(_0xf2a9('0x15'));var utils=require(_0xf2a9('0x16'));var config=require(_0xf2a9('0x17'));var licenseUtil=require(_0xf2a9('0x18'));var db=require(_0xf2a9('0x19'))['db'];var csv_results;config[_0xf2a9('0x1a')]=_['defaults'](config[_0xf2a9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf2a9('0x1a')]));require(_0xf2a9('0x1b'))[_0xf2a9('0x1c')](socket);function respondWithStatusCode(_0x286774,_0x25d364){_0x25d364=_0x25d364||0xcc;return function(_0x3e7ef7){if(_0x3e7ef7){return _0x286774[_0xf2a9('0x1d')](_0x25d364);}return _0x286774[_0xf2a9('0x1e')](_0x25d364)['end']();};}function respondWithResult(_0x40c487,_0x3415f7){_0x3415f7=_0x3415f7||0xc8;return function(_0x55fe7f){if(_0x55fe7f){return _0x40c487['status'](_0x3415f7)[_0xf2a9('0x1f')](_0x55fe7f);}};}function respondWithFilteredResult(_0xdc8e31,_0x422c2f){return function(_0x5b51e5){if(_0x5b51e5){var _0x5efd47=typeof _0x422c2f[_0xf2a9('0x20')]===_0xf2a9('0x21')&&typeof _0x422c2f[_0xf2a9('0x22')]==='undefined';var _0x2ead52=_0x5b51e5['count'];var _0x1f47a6=_0x5efd47?0x0:_0x422c2f[_0xf2a9('0x20')];var _0x1b8740=_0x5efd47?_0x5b51e5[_0xf2a9('0x23')]:_0x422c2f[_0xf2a9('0x20')]+_0x422c2f[_0xf2a9('0x22')];var _0x3157bb;if(_0x1b8740>=_0x2ead52){_0x1b8740=_0x2ead52;_0x3157bb=0xc8;}else{_0x3157bb=0xce;}_0xdc8e31[_0xf2a9('0x1e')](_0x3157bb);return _0xdc8e31[_0xf2a9('0x24')](_0xf2a9('0x25'),_0x1f47a6+'-'+_0x1b8740+'/'+_0x2ead52)['json'](_0x5b51e5);}return null;};}function patchUpdates(_0x3a7246){return function(_0x44050e){try{jsonpatch[_0xf2a9('0x26')](_0x44050e,_0x3a7246,!![]);}catch(_0xe02001){return BPromise[_0xf2a9('0x27')](_0xe02001);}return _0x44050e[_0xf2a9('0x28')]();};}function saveUpdates(_0x14fa94,_0x4daeec){return function(_0xf6fd69){if(_0xf6fd69){return _0xf6fd69[_0xf2a9('0x29')](_0x14fa94)[_0xf2a9('0x2a')](function(_0x2e3ba0){return _0x2e3ba0;});}return null;};}function removeEntity(_0x591f39,_0x4bac39){return function(_0x3c9935){if(_0x3c9935){return _0x3c9935[_0xf2a9('0x2b')]()[_0xf2a9('0x2a')](function(){var _0x20a007=_0x3c9935[_0xf2a9('0x2c')]({'plain':!![]});var _0x46e26e=_0xf2a9('0x2d');return db[_0xf2a9('0x2e')][_0xf2a9('0x2b')]({'where':{'type':_0x46e26e,'resourceId':_0x20a007['id']}})[_0xf2a9('0x2a')](function(){return _0x3c9935;});})[_0xf2a9('0x2a')](function(){_0x591f39[_0xf2a9('0x1e')](0xcc)[_0xf2a9('0x2f')]();});}};}function handleEntityNotFound(_0x1482b3,_0x2b2cbf){return function(_0x4e68a3){if(!_0x4e68a3){_0x1482b3[_0xf2a9('0x1d')](0x194);}return _0x4e68a3;};}function handleError(_0x456869,_0x30b5cc){_0x30b5cc=_0x30b5cc||0x1f4;return function(_0x132482){logger[_0xf2a9('0x30')](_0x132482[_0xf2a9('0x31')]);if(_0x132482['name']){delete _0x132482[_0xf2a9('0x32')];}_0x456869[_0xf2a9('0x1e')](_0x30b5cc)[_0xf2a9('0x33')](_0x132482);};}exports['index']=function(_0x380cfc,_0x5c23f1){var _0x4ba727={},_0x2b6b78={},_0x337543={'count':0x0,'rows':[]};var _0x3ff81d=_[_0xf2a9('0x34')](db[_0xf2a9('0x35')][_0xf2a9('0x36')],function(_0x59219f){return{'name':_0x59219f['fieldName'],'type':_0x59219f[_0xf2a9('0x37')][_0xf2a9('0x38')]};});_0x2b6b78[_0xf2a9('0x39')]=_[_0xf2a9('0x34')](_0x3ff81d,_0xf2a9('0x32'));_0x2b6b78[_0xf2a9('0x3a')]=_['keys'](_0x380cfc['query']);_0x2b6b78[_0xf2a9('0x3b')]=_[_0xf2a9('0x3c')](_0x2b6b78[_0xf2a9('0x39')],_0x2b6b78[_0xf2a9('0x3a')]);_0x4ba727[_0xf2a9('0x3d')]=_[_0xf2a9('0x3c')](_0x2b6b78[_0xf2a9('0x39')],qs[_0xf2a9('0x3e')](_0x380cfc['query']['fields']));_0x4ba727[_0xf2a9('0x3d')]=_0x4ba727[_0xf2a9('0x3d')][_0xf2a9('0x3f')]?_0x4ba727[_0xf2a9('0x3d')]:_0x2b6b78[_0xf2a9('0x39')];if(!_0x380cfc['query']['hasOwnProperty']('nolimit')){_0x4ba727[_0xf2a9('0x22')]=qs[_0xf2a9('0x22')](_0x380cfc[_0xf2a9('0x3a')][_0xf2a9('0x22')]);_0x4ba727[_0xf2a9('0x20')]=qs[_0xf2a9('0x20')](_0x380cfc[_0xf2a9('0x3a')][_0xf2a9('0x20')]);}_0x4ba727['order']=qs[_0xf2a9('0x40')](_0x380cfc['query'][_0xf2a9('0x40')]);_0x4ba727[_0xf2a9('0x41')]=qs[_0xf2a9('0x3b')](_['pick'](_0x380cfc['query'],_0x2b6b78[_0xf2a9('0x3b')]),_0x3ff81d);if(_0x380cfc['query'][_0xf2a9('0x42')]){_0x4ba727[_0xf2a9('0x41')]=_['merge'](_0x4ba727[_0xf2a9('0x41')],{'$or':_[_0xf2a9('0x34')](_0x3ff81d,function(_0x307796){if(_0x307796[_0xf2a9('0x37')]!==_0xf2a9('0x43')){var _0x5d212d={};_0x5d212d[_0x307796[_0xf2a9('0x32')]]={'$like':'%'+_0x380cfc[_0xf2a9('0x3a')][_0xf2a9('0x42')]+'%'};return _0x5d212d;}})});}_0x4ba727=_[_0xf2a9('0x44')]({},_0x4ba727,_0x380cfc[_0xf2a9('0x45')]);var _0x578631={'where':_0x4ba727[_0xf2a9('0x41')]};return db['CmList'][_0xf2a9('0x23')](_0x578631)[_0xf2a9('0x2a')](function(_0xfb6c15){_0x337543[_0xf2a9('0x23')]=_0xfb6c15;if(_0x380cfc[_0xf2a9('0x3a')][_0xf2a9('0x46')]){_0x4ba727[_0xf2a9('0x47')]=[{'all':!![]}];}return db[_0xf2a9('0x35')][_0xf2a9('0x48')](_0x4ba727);})['then'](function(_0x24d162){_0x337543[_0xf2a9('0x49')]=_0x24d162;return _0x337543;})['then'](respondWithFilteredResult(_0x5c23f1,_0x4ba727))[_0xf2a9('0x4a')](handleError(_0x5c23f1,null));};exports[_0xf2a9('0x4b')]=function(_0xdd66bf,_0x5d47b6){var _0x4ce753={'raw':![],'where':{'id':_0xdd66bf['params']['id']}},_0x3110a4={};_0x3110a4[_0xf2a9('0x39')]=_[_0xf2a9('0x4c')](db[_0xf2a9('0x35')][_0xf2a9('0x36')]);_0x3110a4['query']=_['keys'](_0xdd66bf['query']);_0x3110a4[_0xf2a9('0x3b')]=_[_0xf2a9('0x3c')](_0x3110a4['model'],_0x3110a4[_0xf2a9('0x3a')]);_0x4ce753[_0xf2a9('0x3d')]=_['intersection'](_0x3110a4[_0xf2a9('0x39')],qs[_0xf2a9('0x3e')](_0xdd66bf[_0xf2a9('0x3a')][_0xf2a9('0x3e')]));_0x4ce753[_0xf2a9('0x3d')]=_0x4ce753[_0xf2a9('0x3d')][_0xf2a9('0x3f')]?_0x4ce753['attributes']:_0x3110a4[_0xf2a9('0x39')];if(_0xdd66bf[_0xf2a9('0x3a')]['includeAll']){_0x4ce753[_0xf2a9('0x47')]=[{'all':!![]}];}_0x4ce753=_[_0xf2a9('0x44')]({},_0x4ce753,_0xdd66bf[_0xf2a9('0x45')]);return db[_0xf2a9('0x35')]['find'](_0x4ce753)[_0xf2a9('0x2a')](handleEntityNotFound(_0x5d47b6,null))[_0xf2a9('0x2a')](respondWithResult(_0x5d47b6,null))[_0xf2a9('0x4a')](handleError(_0x5d47b6,null));};exports[_0xf2a9('0x4d')]=function(_0x482f70,_0x18cfc1){return db[_0xf2a9('0x35')][_0xf2a9('0x4d')](_0x482f70[_0xf2a9('0x4e')],{})[_0xf2a9('0x2a')](function(_0xb215b6){var _0x1a49ff=_0x482f70[_0xf2a9('0x4f')][_0xf2a9('0x2c')]({'plain':!![]});if(!_0x1a49ff)throw new Error(_0xf2a9('0x50'));if(_0x1a49ff[_0xf2a9('0x51')]==='user'){var _0x71c2fb=_0xb215b6[_0xf2a9('0x2c')]({'plain':!![]});var _0x3cb649='Lists';return db[_0xf2a9('0x52')][_0xf2a9('0x53')]({'where':{'name':_0x3cb649,'userProfileId':_0x1a49ff[_0xf2a9('0x54')]},'raw':!![]})[_0xf2a9('0x2a')](function(_0x565b24){if(_0x565b24&&_0x565b24[_0xf2a9('0x55')]===0x0){return db[_0xf2a9('0x2e')]['create']({'name':_0x71c2fb[_0xf2a9('0x32')],'resourceId':_0x71c2fb['id'],'type':_0x565b24[_0xf2a9('0x32')],'sectionId':_0x565b24['id']},{})[_0xf2a9('0x2a')](function(){return _0xb215b6;});}else{return _0xb215b6;}})[_0xf2a9('0x4a')](function(_0x539507){logger[_0xf2a9('0x30')](_0xf2a9('0x56'),_0x539507);throw _0x539507;});}return _0xb215b6;})['then'](respondWithResult(_0x18cfc1,0xc9))[_0xf2a9('0x4a')](handleError(_0x18cfc1,null));};exports['update']=function(_0x5aeb86,_0x10f407){if(_0x5aeb86['body']['id']){delete _0x5aeb86['body']['id'];}return db['CmList'][_0xf2a9('0x53')]({'where':{'id':_0x5aeb86['params']['id']}})['then'](handleEntityNotFound(_0x10f407,null))[_0xf2a9('0x2a')](saveUpdates(_0x5aeb86[_0xf2a9('0x4e')],null))[_0xf2a9('0x2a')](respondWithResult(_0x10f407,null))[_0xf2a9('0x4a')](handleError(_0x10f407,null));};exports[_0xf2a9('0x2b')]=function(_0x33d0ca,_0x22825e){return db[_0xf2a9('0x35')][_0xf2a9('0x53')]({'where':{'id':_0x33d0ca[_0xf2a9('0x57')]['id']}})[_0xf2a9('0x2a')](handleEntityNotFound(_0x22825e,null))[_0xf2a9('0x2a')](removeEntity(_0x22825e,null))[_0xf2a9('0x4a')](handleError(_0x22825e,null));};exports[_0xf2a9('0x58')]=function(_0x30eb3e,_0x562b67){return db[_0xf2a9('0x35')][_0xf2a9('0x58')]()['then'](respondWithResult(_0x562b67,null))['catch'](handleError(_0x562b67,null));};exports[_0xf2a9('0x59')]=function(_0x4408f7,_0x2813db,_0x2fc646){if(_0x4408f7[_0xf2a9('0x4e')]['id']){delete _0x4408f7['body']['id'];}return db[_0xf2a9('0x35')][_0xf2a9('0x53')]({'where':{'id':_0x4408f7['params']['id']}})['then'](handleEntityNotFound(_0x2813db,null))[_0xf2a9('0x2a')](function(_0x4c1a45){if(_0x4c1a45){_0x4408f7[_0xf2a9('0x4e')][_0xf2a9('0x5a')]=_0x4c1a45['id'];return db[_0xf2a9('0x5b')]['create'](_0x4408f7[_0xf2a9('0x4e')]);}})[_0xf2a9('0x2a')](respondWithResult(_0x2813db,null))[_0xf2a9('0x4a')](handleError(_0x2813db,null));};exports[_0xf2a9('0x5c')]=function(_0x29e82d,_0x5b2690,_0x47061f){var _0x4f3168={'raw':![],'where':{}};var _0x3d544f={};var _0x296d4a={'count':0x0,'rows':[]};return db[_0xf2a9('0x35')][_0xf2a9('0x5d')]({'where':{'id':_0x29e82d[_0xf2a9('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b2690,null))['then'](function(_0x3a4631){if(_0x3a4631){_0x3d544f[_0xf2a9('0x39')]=_[_0xf2a9('0x4c')](db[_0xf2a9('0x5b')][_0xf2a9('0x36')]);_0x3d544f['query']=_[_0xf2a9('0x4c')](_0x29e82d[_0xf2a9('0x3a')]);_0x3d544f[_0xf2a9('0x3b')]=_[_0xf2a9('0x3c')](_0x3d544f[_0xf2a9('0x39')],_0x3d544f[_0xf2a9('0x3a')]);_0x4f3168[_0xf2a9('0x3d')]=_[_0xf2a9('0x3c')](_0x3d544f[_0xf2a9('0x39')],qs['fields'](_0x29e82d[_0xf2a9('0x3a')][_0xf2a9('0x3e')]));_0x4f3168[_0xf2a9('0x3d')]=_0x4f3168[_0xf2a9('0x3d')][_0xf2a9('0x3f')]?_0x4f3168[_0xf2a9('0x3d')]:_0x3d544f[_0xf2a9('0x39')];if(!_0x29e82d[_0xf2a9('0x3a')][_0xf2a9('0x5e')](_0xf2a9('0x5f'))){_0x4f3168[_0xf2a9('0x22')]=qs[_0xf2a9('0x22')](_0x29e82d[_0xf2a9('0x3a')][_0xf2a9('0x22')]);_0x4f3168[_0xf2a9('0x20')]=qs[_0xf2a9('0x20')](_0x29e82d[_0xf2a9('0x3a')][_0xf2a9('0x20')]);}_0x4f3168[_0xf2a9('0x60')]=qs[_0xf2a9('0x40')](_0x29e82d[_0xf2a9('0x3a')]['sort']);_0x4f3168[_0xf2a9('0x41')]=qs[_0xf2a9('0x3b')](_[_0xf2a9('0x61')](_0x29e82d[_0xf2a9('0x3a')],_0x3d544f[_0xf2a9('0x3b')]));_0x4f3168[_0xf2a9('0x41')][_0xf2a9('0x5a')]=_0x3a4631['id'];if(_0x29e82d[_0xf2a9('0x3a')][_0xf2a9('0x42')]){_0x4f3168[_0xf2a9('0x41')]=_['merge'](_0x4f3168[_0xf2a9('0x41')],{'$or':_[_0xf2a9('0x34')](_0x4f3168[_0xf2a9('0x3d')],function(_0x105875){var _0x9ded3d={};_0x9ded3d[_0x105875]={'$like':'%'+_0x29e82d[_0xf2a9('0x3a')][_0xf2a9('0x42')]+'%'};return _0x9ded3d;})});}_0x4f3168=_[_0xf2a9('0x44')]({},_0x4f3168,_0x29e82d[_0xf2a9('0x45')]);return db[_0xf2a9('0x5b')][_0xf2a9('0x23')]({'where':_0x4f3168[_0xf2a9('0x41')]})[_0xf2a9('0x2a')](function(_0x362399){_0x296d4a[_0xf2a9('0x23')]=_0x362399;if(_0x29e82d[_0xf2a9('0x3a')][_0xf2a9('0x46')]){_0x4f3168['include']=[{'all':!![]}];}return db[_0xf2a9('0x5b')]['findAll'](_0x4f3168);})[_0xf2a9('0x2a')](function(_0x5cd16d){_0x296d4a[_0xf2a9('0x49')]=_0x5cd16d;return _0x296d4a;});}})[_0xf2a9('0x2a')](respondWithFilteredResult(_0x5b2690,_0x4f3168))[_0xf2a9('0x4a')](handleError(_0x5b2690,null));};exports[_0xf2a9('0x62')]=function(_0x247140,_0x49e72d,_0x5f5327){return db[_0xf2a9('0x35')]['find']({'where':{'id':_0x247140[_0xf2a9('0x57')]['id']}})['then'](handleEntityNotFound(_0x49e72d,null))[_0xf2a9('0x2a')](function(_0xc993ce){if(_0xc993ce){return _0xc993ce[_0xf2a9('0x62')](_0x247140[_0xf2a9('0x3a')][_0xf2a9('0x63')]);}})['then'](respondWithStatusCode(_0x49e72d,null))[_0xf2a9('0x4a')](handleError(_0x49e72d,null));};exports[_0xf2a9('0x64')]=function(_0x4d7188,_0x361635,_0x19a196){return db[_0xf2a9('0x35')][_0xf2a9('0x53')]({'where':{'id':_0x4d7188[_0xf2a9('0x57')]['id']}})['then'](handleEntityNotFound(_0x361635,null))[_0xf2a9('0x2a')](function(_0x39dbe7){if(_0x39dbe7){var _0x1b7786=[];var _0x3719bb={'success':[],'errors':[]};return db[_0xf2a9('0x65')][_0xf2a9('0x58')]()[_0xf2a9('0x2a')](function(_0x13dbc7){if(_0x4d7188[_0xf2a9('0x4e')][_0xf2a9('0x66')]&&_['isArray'](_0x4d7188[_0xf2a9('0x4e')][_0xf2a9('0x66')])){if(_0x4d7188[_0xf2a9('0x4e')][_0xf2a9('0x66')][_0xf2a9('0x3f')]){_0x4d7188[_0xf2a9('0x4e')]['tags']=_0x4d7188['body'][_0xf2a9('0x66')][_0xf2a9('0x67')](';')+';';}else{_0x4d7188[_0xf2a9('0x4e')][_0xf2a9('0x66')]=null;}}else{_0x4d7188['body'][_0xf2a9('0x66')]=null;}if(_0x4d7188['body']&&_[_0xf2a9('0x68')](_0x4d7188[_0xf2a9('0x4e')])){for(var _0x3ceb27=0x0;_0x3ceb27<_0x4d7188['body'][_0xf2a9('0x3f')];_0x3ceb27+=0x1){_0x4d7188['body'][_0x3ceb27]['ListId']=_0x4d7188['params']['id'];_0x1b7786['push'](_0x4d7188[_0xf2a9('0x4e')][_0x3ceb27]);}return BPromise[_0xf2a9('0x69')](_0x1b7786,function(_0x13375d){return db[_0xf2a9('0x65')][_0xf2a9('0x4d')](_['omit'](_0x13375d,['ids','id'])||{},{'fields':_[_0xf2a9('0x4c')](_0x13dbc7),'raw':!![]})[_0xf2a9('0x2a')](function(_0x4f13a7){_0x3719bb[_0xf2a9('0x6a')][_0xf2a9('0x6b')](_0x4f13a7['dataValues']);})[_0xf2a9('0x4a')](function(_0x4f001c){_0x3719bb[_0xf2a9('0x6c')][_0xf2a9('0x6b')]({'data':_0x13375d,'error':_0x4f001c['message']});});})[_0xf2a9('0x2a')](function(_0x5de192){return _0x3719bb;})[_0xf2a9('0x4a')](function(_0x7695ae){return _0x7695ae;});}else{_0x361635[_0xf2a9('0x1e')](0x190)[_0xf2a9('0x1f')]({'message':_0xf2a9('0x6d')});}});}})[_0xf2a9('0x2a')](respondWithResult(_0x361635,null))[_0xf2a9('0x4a')](handleError(_0x361635,null));};exports[_0xf2a9('0x6e')]=function(_0x3b27c5,_0x581dc0,_0x2bed81){var _0x19af21;return db[_0xf2a9('0x35')]['find']({'where':{'id':_0x3b27c5['params']['id']},'include':[{'model':db[_0xf2a9('0x6f')],'as':_0xf2a9('0x70')}]})[_0xf2a9('0x2a')](handleEntityNotFound(_0x581dc0,null))[_0xf2a9('0x2a')](function(_0x1c7bf4){if(_0x1c7bf4){_0x19af21=_0x1c7bf4;return db[_0xf2a9('0x65')][_0xf2a9('0x36')];}})['then'](function(_0x555524){if(_0x555524){var _0x47762f={};var _0xe9cc17={};_0xe9cc17[_0xf2a9('0x39')]=_[_0xf2a9('0x71')](_[_0xf2a9('0x4c')](_0x555524),_[_0xf2a9('0x34')](_0x19af21[_0xf2a9('0x70')],function(_0x43e644){return util[_0xf2a9('0x72')]('cf_%d',_0x43e644['id']);}));_0xe9cc17[_0xf2a9('0x3a')]=_[_0xf2a9('0x4c')](_0x3b27c5[_0xf2a9('0x3a')]);_0xe9cc17[_0xf2a9('0x3b')]=_['intersection'](_0xe9cc17[_0xf2a9('0x39')],_0xe9cc17['query']);_0x47762f[_0xf2a9('0x3d')]=_[_0xf2a9('0x3c')](_0xe9cc17['model'],qs['fields'](_0x3b27c5['query'][_0xf2a9('0x3e')]));_0x47762f[_0xf2a9('0x3d')]=_0x47762f[_0xf2a9('0x3d')][_0xf2a9('0x3f')]?_0x47762f[_0xf2a9('0x3d')]:_0xe9cc17[_0xf2a9('0x39')];if(!_0x3b27c5['query'][_0xf2a9('0x5e')]('nolimit')){_0x47762f[_0xf2a9('0x22')]=qs[_0xf2a9('0x22')](_0x3b27c5['query'][_0xf2a9('0x22')]);_0x47762f['offset']=qs[_0xf2a9('0x20')](_0x3b27c5[_0xf2a9('0x3a')]['offset']);}_0x47762f[_0xf2a9('0x60')]=qs['sort'](_0x3b27c5[_0xf2a9('0x3a')][_0xf2a9('0x40')]);_0x47762f[_0xf2a9('0x41')]=qs[_0xf2a9('0x3b')](_[_0xf2a9('0x61')](_0x3b27c5[_0xf2a9('0x3a')],_0xe9cc17[_0xf2a9('0x3b')]));_0x47762f[_0xf2a9('0x73')]=!![];if(_0x3b27c5[_0xf2a9('0x3a')][_0xf2a9('0x42')]){_0x47762f['where']=_[_0xf2a9('0x44')](_0x47762f[_0xf2a9('0x41')],{'$or':_[_0xf2a9('0x34')](_0x47762f[_0xf2a9('0x3d')],function(_0x1973c0){var _0xccfb7f={};_0xccfb7f[_0x1973c0]={'$like':'%'+_0x3b27c5['query'][_0xf2a9('0x42')]+'%'};return _0xccfb7f;})});}_0x47762f=_['merge']({},_0x47762f,_0x3b27c5[_0xf2a9('0x45')]);return _0x19af21[_0xf2a9('0x6e')](_0x47762f);}})[_0xf2a9('0x2a')](respondWithResult(_0x581dc0,null))['catch'](handleError(_0x581dc0,null));};exports[_0xf2a9('0x74')]=function(_0x4b1d49,_0x564eda,_0x5819e4){var _0x44a5ea;var _0x13df34;var _0x58308b;var _0x3790df=_0x4b1d49['params']['id'];csv_results=[];return db[_0xf2a9('0x75')][_0xf2a9('0x48')]({'attributes':['id',_0xf2a9('0x32')],'raw':!![],'order':[_0xf2a9('0x76')]})[_0xf2a9('0x2a')](function(_0x57e25d){_0x44a5ea=_0x57e25d;var _0x368cb5=_[_0xf2a9('0x4c')](db['CmContact'][_0xf2a9('0x36')]);return db['CmCustomField'][_0xf2a9('0x48')]({'raw':!![],'attributes':['id','alias']})[_0xf2a9('0x2a')](function(_0x4dbef4){_0x13df34=_0x4dbef4;var _0xdee707=squel[_0xf2a9('0x77')]()['fields'](_0x368cb5)[_0xf2a9('0x78')]('cm_contacts','c')[_0xf2a9('0x41')]('c.ListId\x20=\x20?',_0x3790df)[_0xf2a9('0x41')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x3f7378=0x0;_0x3f7378<_0x13df34['length'];_0x3f7378++){_0xdee707[_0xf2a9('0x79')]('c.cf_'+_0x13df34[_0x3f7378]['id'],_0xf2a9('0x7a')+_0x13df34[_0x3f7378][_0xf2a9('0x7b')]);}for(var _0x3f7378=0x0;_0x3f7378<_0x44a5ea[_0xf2a9('0x3f')];_0x3f7378++){_0xdee707['field'](squel['select']()['field'](_0xf2a9('0x7c'))[_0xf2a9('0x78')](_0xf2a9('0x7d'))['where'](_0xf2a9('0x7e'),_0x44a5ea[_0x3f7378]['id'])[_0xf2a9('0x41')](_0xf2a9('0x7f')),_0xf2a9('0x80')+_0x44a5ea[_0x3f7378][_0xf2a9('0x32')]);_0xdee707[_0xf2a9('0x79')](squel[_0xf2a9('0x77')]()[_0xf2a9('0x79')](_0xf2a9('0x81'))[_0xf2a9('0x78')](_0xf2a9('0x7d'))[_0xf2a9('0x41')](_0xf2a9('0x7e'),_0x44a5ea[_0x3f7378]['id'])[_0xf2a9('0x41')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x44a5ea[_0x3f7378][_0xf2a9('0x32')]);}var _0x1dbf85=[];_0x1dbf85['push'](_0xdee707['toString']());BPromise[_0xf2a9('0x69')](_0x1dbf85,handleQuery)[_0xf2a9('0x2a')](function(_0x5d691b){handleQuery(_0xdee707['toString']());var _0x3944d3=csv_results[0x0];if(!_[_0xf2a9('0x82')](_0x3944d3)){var _0x36d019=toCsv(_0x3944d3);var _0x1f33b6=Date[_0xf2a9('0x83')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x3790df,_0x1f33b6),_0x36d019);_0x564eda[_0xf2a9('0x84')](_0xf2a9('0x85'),'attachment;\x20filename='+util[_0xf2a9('0x72')](_0xf2a9('0x86'),_0x3790df,_0x1f33b6));_0x564eda[_0xf2a9('0x84')]('Content-type',_0xf2a9('0x87'));return _0x564eda[_0xf2a9('0x88')](util['format']('/tmp/list_%d_%s.csv',_0x3790df,_0x1f33b6));}else{return _0x564eda[_0xf2a9('0x1d')](0xcc);}});});});};exports[_0xf2a9('0x89')]=function(_0x35eb71,_0xe33cbf,_0x3c77fa){var _0x2d9b20;delete _0x35eb71['body']['id'];return db[_0xf2a9('0x35')][_0xf2a9('0x5d')]({'where':{'id':_0x35eb71[_0xf2a9('0x57')]['id']}})[_0xf2a9('0x2a')](handleEntityNotFound(_0xe33cbf,null))[_0xf2a9('0x2a')](function(_0x34deda){if(_0x34deda){return db[_0xf2a9('0x8a')][_0xf2a9('0x8b')](function(_0x5d3a68){return db['CmCustomField'][_0xf2a9('0x4d')](_0x35eb71['body'],{'transaction':_0x5d3a68})[_0xf2a9('0x2a')](function(_0x1a27b1){_0x2d9b20=_0x1a27b1;return _0x34deda['addCustomFields'](_0x1a27b1,{'transaction':_0x5d3a68});})[_0xf2a9('0x2a')](function(){var _0x4a6a91={'type':db[_0xf2a9('0x8c')][_0xf2a9('0x8d')],'transaction':_0x5d3a68};switch(_0x35eb71[_0xf2a9('0x4e')][_0xf2a9('0x37')]){case _0xf2a9('0x8e'):_0x4a6a91[_0xf2a9('0x37')]=db[_0xf2a9('0x8c')][_0xf2a9('0x8d')];break;case _0xf2a9('0x8f'):_0x4a6a91[_0xf2a9('0x37')]=db[_0xf2a9('0x8c')][_0xf2a9('0x90')];break;case _0xf2a9('0x91'):_0x4a6a91[_0xf2a9('0x37')]=db[_0xf2a9('0x8c')]['BOOLEAN'];_0x4a6a91[_0xf2a9('0x92')]=![];break;default:}return db[_0xf2a9('0x8a')]['queryInterface'][_0xf2a9('0x93')](_0xf2a9('0x94'),util[_0xf2a9('0x72')](_0xf2a9('0x95'),_0x2d9b20['id']),_0x4a6a91);})[_0xf2a9('0x2a')](function(){return _0x2d9b20;});});}})[_0xf2a9('0x2a')](respondWithResult(_0xe33cbf,null))['catch'](handleError(_0xe33cbf,null));};exports[_0xf2a9('0x96')]=function(_0x165c27,_0x4abc8a,_0x1f6727){var _0x1b1e8c={};var _0x3973ac={};var _0x289fde;var _0x3f1cdd;return db['CmList'][_0xf2a9('0x5d')]({'where':{'id':_0x165c27[_0xf2a9('0x57')]['id']}})[_0xf2a9('0x2a')](handleEntityNotFound(_0x4abc8a,null))['then'](function(_0x24c522){if(_0x24c522){_0x289fde=_0x24c522;_0x3973ac[_0xf2a9('0x39')]=_[_0xf2a9('0x4c')](db[_0xf2a9('0x6f')][_0xf2a9('0x36')]);_0x3973ac['query']=_['keys'](_0x165c27[_0xf2a9('0x3a')]);_0x3973ac[_0xf2a9('0x3b')]=_[_0xf2a9('0x3c')](_0x3973ac[_0xf2a9('0x39')],_0x3973ac[_0xf2a9('0x3a')]);_0x1b1e8c[_0xf2a9('0x3d')]=_['intersection'](_0x3973ac[_0xf2a9('0x39')],qs['fields'](_0x165c27[_0xf2a9('0x3a')]['fields']));_0x1b1e8c[_0xf2a9('0x3d')]=_0x1b1e8c[_0xf2a9('0x3d')]['length']?_0x1b1e8c['attributes']:_0x3973ac[_0xf2a9('0x39')];_0x1b1e8c[_0xf2a9('0x60')]=qs['sort'](_0x165c27[_0xf2a9('0x3a')][_0xf2a9('0x40')]);_0x1b1e8c['where']=qs['filters'](_[_0xf2a9('0x61')](_0x165c27[_0xf2a9('0x3a')],_0x3973ac['filters']));_0x1b1e8c[_0xf2a9('0x41')]=_[_0xf2a9('0x44')](_0x1b1e8c['where'],{'$or':[{'ListId':_0x24c522['id']},{'ListId':null}]});if(_0x165c27[_0xf2a9('0x3a')][_0xf2a9('0x42')]){_0x1b1e8c[_0xf2a9('0x41')]=_['merge'](_0x1b1e8c[_0xf2a9('0x41')],{'$or':_[_0xf2a9('0x34')](_0x1b1e8c[_0xf2a9('0x3d')],function(_0x51e3b2){var _0x35b0f1={};_0x35b0f1[_0x51e3b2]={'$like':'%'+_0x165c27[_0xf2a9('0x3a')]['filter']+'%'};return _0x35b0f1;})});}_0x1b1e8c=_['merge']({},_0x1b1e8c,_0x165c27[_0xf2a9('0x45')]);return db[_0xf2a9('0x6f')]['findAndCountAll'](_0x1b1e8c);}})['then'](respondWithResult(_0x4abc8a,null))[_0xf2a9('0x4a')](handleError(_0x4abc8a,null));};exports[_0xf2a9('0x97')]=function(_0x30ef78,_0x21bba5){return db[_0xf2a9('0x6f')][_0xf2a9('0x98')]({'where':{'ListId':null}})[_0xf2a9('0x2a')](handleEntityNotFound(_0x21bba5,null))[_0xf2a9('0x2a')](function(_0x4d0f17){return _0x4d0f17;})[_0xf2a9('0x2a')](respondWithResult(_0x21bba5,null))[_0xf2a9('0x4a')](handleError(_0x21bba5,null));};exports['addAgents']=function(_0x55d319,_0x4a07f2,_0x24b401){return db['CmList'][_0xf2a9('0x53')]({'where':{'id':_0x55d319[_0xf2a9('0x57')]['id']}})[_0xf2a9('0x2a')](handleEntityNotFound(_0x4a07f2,null))[_0xf2a9('0x2a')](function(_0x16355f){if(_0x16355f){return _0x16355f[_0xf2a9('0x99')](_0x55d319['body']['ids'],_[_0xf2a9('0x9a')](_0x55d319[_0xf2a9('0x4e')],[_0xf2a9('0x63'),'id'])||{})[_0xf2a9('0x9b')](function(_0xd288ff){for(var _0x1ddce4=0x0;_0x1ddce4<_0x55d319[_0xf2a9('0x4e')]['ids']['length'];_0x1ddce4+=0x1){socket['emit'](_0xf2a9('0x9c'),{'UserId':Number(_0x55d319['body'][_0xf2a9('0x63')][_0x1ddce4]),'CmListId':Number(_0x55d319[_0xf2a9('0x57')]['id'])});}return _0xd288ff;});}})[_0xf2a9('0x2a')](respondWithResult(_0x4a07f2,null))['catch'](handleError(_0x4a07f2,null));};exports['removeAgents']=function(_0x8b8b02,_0x164c8a,_0x5dbde5){return db[_0xf2a9('0x35')][_0xf2a9('0x53')]({'where':{'id':_0x8b8b02[_0xf2a9('0x57')]['id']}})[_0xf2a9('0x2a')](handleEntityNotFound(_0x164c8a,null))[_0xf2a9('0x2a')](function(_0x3fe8ec){if(_0x3fe8ec){return _0x3fe8ec[_0xf2a9('0x9d')](_0x8b8b02[_0xf2a9('0x3a')][_0xf2a9('0x63')])[_0xf2a9('0x2a')](function(){if(_[_0xf2a9('0x68')](_0x8b8b02[_0xf2a9('0x3a')][_0xf2a9('0x63')])){for(var _0x265251=0x0;_0x265251<_0x8b8b02[_0xf2a9('0x3a')]['ids'][_0xf2a9('0x3f')];_0x265251+=0x1){socket[_0xf2a9('0x9e')]('userCmList:remove',{'UserId':Number(_0x8b8b02[_0xf2a9('0x3a')][_0xf2a9('0x63')][_0x265251]),'CmListId':Number(_0x8b8b02[_0xf2a9('0x57')]['id'])});}}else{socket[_0xf2a9('0x9e')](_0xf2a9('0x9f'),{'UserId':Number(_0x8b8b02[_0xf2a9('0x3a')][_0xf2a9('0x63')]),'CmListId':Number(_0x8b8b02['params']['id'])});}});}})[_0xf2a9('0x2a')](respondWithStatusCode(_0x164c8a,null))['catch'](handleError(_0x164c8a,null));};exports[_0xf2a9('0xa0')]=function(_0x1fc963,_0x1c8c9d,_0x1d3896){var _0x58099e={};var _0x2cb2b8={};var _0x1430e8;var _0x4665c4;return db[_0xf2a9('0x35')][_0xf2a9('0x5d')]({'where':{'id':_0x1fc963[_0xf2a9('0x57')]['id']}})[_0xf2a9('0x2a')](handleEntityNotFound(_0x1c8c9d,null))[_0xf2a9('0x2a')](function(_0xc23cb8){if(_0xc23cb8){_0x1430e8=_0xc23cb8;_0x2cb2b8['model']=_['keys'](db[_0xf2a9('0xa1')][_0xf2a9('0x36')]);_0x2cb2b8[_0xf2a9('0x3a')]=_[_0xf2a9('0x4c')](_0x1fc963[_0xf2a9('0x3a')]);_0x2cb2b8['filters']=_[_0xf2a9('0x3c')](_0x2cb2b8[_0xf2a9('0x39')],_0x2cb2b8['query']);_0x58099e[_0xf2a9('0x3d')]=_[_0xf2a9('0x3c')](_0x2cb2b8['model'],qs[_0xf2a9('0x3e')](_0x1fc963[_0xf2a9('0x3a')][_0xf2a9('0x3e')]));_0x58099e[_0xf2a9('0x3d')]=_0x58099e[_0xf2a9('0x3d')][_0xf2a9('0x3f')]?_0x58099e['attributes']:_0x2cb2b8[_0xf2a9('0x39')];_0x58099e[_0xf2a9('0x60')]=qs['sort'](_0x1fc963['query'][_0xf2a9('0x40')]);_0x58099e[_0xf2a9('0x41')]=qs[_0xf2a9('0x3b')](_[_0xf2a9('0x61')](_0x1fc963[_0xf2a9('0x3a')],_0x2cb2b8[_0xf2a9('0x3b')]));if(_0x1fc963['query'][_0xf2a9('0x42')]){_0x58099e[_0xf2a9('0x41')]=_[_0xf2a9('0x44')](_0x58099e[_0xf2a9('0x41')],{'$or':_[_0xf2a9('0x34')](_0x58099e[_0xf2a9('0x3d')],function(_0x58bf16){var _0x3a30c5={};_0x3a30c5[_0x58bf16]={'$like':'%'+_0x1fc963[_0xf2a9('0x3a')][_0xf2a9('0x42')]+'%'};return _0x3a30c5;})});}_0x58099e=_['merge']({},_0x58099e,_0x1fc963[_0xf2a9('0x45')]);return _0x1430e8[_0xf2a9('0xa0')](_0x58099e);}})[_0xf2a9('0x2a')](function(_0x2b7f6b){if(_0x2b7f6b){_0x4665c4=_0x2b7f6b[_0xf2a9('0x3f')];if(!_0x1fc963[_0xf2a9('0x3a')][_0xf2a9('0x5e')](_0xf2a9('0x5f'))){_0x58099e[_0xf2a9('0x22')]=qs[_0xf2a9('0x22')](_0x1fc963['query'][_0xf2a9('0x22')]);_0x58099e[_0xf2a9('0x20')]=qs[_0xf2a9('0x20')](_0x1fc963[_0xf2a9('0x3a')][_0xf2a9('0x20')]);}return _0x1430e8['getAgents'](_0x58099e);}})[_0xf2a9('0x2a')](function(_0x4674b5){if(_0x4674b5){return _0x4674b5?{'count':_0x4665c4,'rows':_0x4674b5}:null;}})[_0xf2a9('0x2a')](respondWithResult(_0x1c8c9d,null))[_0xf2a9('0x4a')](handleError(_0x1c8c9d,null));};function handleQuery(_0xbedc0b){logger[_0xf2a9('0xa2')](_0xbedc0b);return db[_0xf2a9('0x8a')]['query'](_0xbedc0b)[_0xf2a9('0x9b')](function(_0x4c2778){csv_results['push'](_0x4c2778);})[_0xf2a9('0x4a')](function(_0x19670f){logger[_0xf2a9('0x30')](_0x19670f[_0xf2a9('0xa3')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 68bb52f..b272bfb 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2fc2e4,_0xf15e31){var _0x21d7b3=function(_0xa09ad0){while(--_0xa09ad0){_0x2fc2e4['push'](_0x2fc2e4['shift']());}};_0x21d7b3(++_0xf15e31);}(_0x814b,0x1a2));var _0xb814=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0x814b[_0x270dba];return _0x36b83b;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x335bf7,_0x5a8ae0){_0x335bf7=_0x335bf7-0x0;var _0x3512e5=_0xe14b[_0x335bf7];return _0x3512e5;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b6173a5..bd18ddd 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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xe14d,0x1ee));var _0xde14=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xe14d[_0x18ab2a];return _0x16dcee;};'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 +var _0xfd28=['rimraf','./cmList.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x509ce1,_0x2d4c22){var _0x532621=function(_0x3db21b){while(--_0x3db21b){_0x509ce1['push'](_0x509ce1['shift']());}};_0x532621(++_0x2d4c22);}(_0xfd28,0x148));var _0x8fd2=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xfd28[_0x15ea09];return _0x3e9c78;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2e22a0c..eca7ca4 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 _0xd82f=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2c1d3a,_0x43cdf5){var _0x1f93c4=function(_0x19ae7e){while(--_0x19ae7e){_0x2c1d3a['push'](_0x2c1d3a['shift']());}};_0x1f93c4(++_0x43cdf5);}(_0xd82f,0x121));var _0xfd82=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xd82f[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xfd82('0x0'));var util=require(_0xfd82('0x1'));var moment=require(_0xfd82('0x2'));var BPromise=require(_0xfd82('0x3'));var rs=require(_0xfd82('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd82('0x5'))['db'];var utils=require(_0xfd82('0x6'));var logger=require(_0xfd82('0x7'))(_0xfd82('0x8'));var config=require(_0xfd82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfd82('0xa')][_0xfd82('0xb')]({'port':0x232a});config[_0xfd82('0xc')]=_[_0xfd82('0xd')](config[_0xfd82('0xc')],{'host':_0xfd82('0xe'),'port':0x18eb});var socket=require(_0xfd82('0xf'))(new Redis(config[_0xfd82('0xc')]));require(_0xfd82('0x10'))[_0xfd82('0x11')](socket);function respondWithRpcPromise(_0x6e8740,_0x31295f,_0x497d9b){return new BPromise(function(_0x5c9a16,_0x2179e8){return client['request'](_0x6e8740,_0x497d9b)[_0xfd82('0x12')](function(_0x18731b){logger[_0xfd82('0x13')](_0xfd82('0x14'),_0x31295f,_0xfd82('0x15'));logger[_0xfd82('0x16')](_0xfd82('0x17'),_0x31295f,_0xfd82('0x15'),JSON[_0xfd82('0x18')](_0x18731b));if(_0x18731b[_0xfd82('0x19')]){if(_0x18731b['error'][_0xfd82('0x1a')]===0x1f4){logger[_0xfd82('0x19')]('CmList,\x20%s,\x20%s',_0x31295f,_0x18731b[_0xfd82('0x19')][_0xfd82('0x1b')]);return _0x2179e8(_0x18731b['error'][_0xfd82('0x1b')]);}logger[_0xfd82('0x19')](_0xfd82('0x14'),_0x31295f,_0x18731b['error'][_0xfd82('0x1b')]);return _0x5c9a16(_0x18731b[_0xfd82('0x19')][_0xfd82('0x1b')]);}else{logger[_0xfd82('0x13')](_0xfd82('0x14'),_0x31295f,_0xfd82('0x15'));_0x5c9a16(_0x18731b[_0xfd82('0x1c')]['message']);}})['catch'](function(_0x5a8fdb){logger[_0xfd82('0x19')](_0xfd82('0x14'),_0x31295f,_0x5a8fdb);_0x2179e8(_0x5a8fdb);});});} \ No newline at end of file +var _0x1cf6=['code','CmList,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','request','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error'];(function(_0x10e136,_0x377e72){var _0x2efa12=function(_0x488f19){while(--_0x488f19){_0x10e136['push'](_0x10e136['shift']());}};_0x2efa12(++_0x377e72);}(_0x1cf6,0xd4));var _0x61cf=function(_0x31857e,_0x2df1f2){_0x31857e=_0x31857e-0x0;var _0xe12b47=_0x1cf6[_0x31857e];return _0xe12b47;};'use strict';var _=require('lodash');var util=require(_0x61cf('0x0'));var moment=require(_0x61cf('0x1'));var BPromise=require(_0x61cf('0x2'));var rs=require(_0x61cf('0x3'));var fs=require('fs');var Redis=require(_0x61cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x61cf('0x5'));var config=require(_0x61cf('0x6'));var jayson=require(_0x61cf('0x7'));var client=jayson[_0x61cf('0x8')][_0x61cf('0x9')]({'port':0x232a});config[_0x61cf('0xa')]=_[_0x61cf('0xb')](config[_0x61cf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x61cf('0xc'))(new Redis(config[_0x61cf('0xa')]));require(_0x61cf('0xd'))['register'](socket);function respondWithRpcPromise(_0x1f8abd,_0x584ddb,_0x4437b5){return new BPromise(function(_0x594ee8,_0x1791c5){return client[_0x61cf('0xe')](_0x1f8abd,_0x4437b5)['then'](function(_0x102c15){logger['info']('CmList,\x20%s,\x20%s',_0x584ddb,_0x61cf('0xf'));logger['debug'](_0x61cf('0x10'),_0x584ddb,'request\x20sent',JSON['stringify'](_0x102c15));if(_0x102c15['error']){if(_0x102c15[_0x61cf('0x11')][_0x61cf('0x12')]===0x1f4){logger[_0x61cf('0x11')](_0x61cf('0x13'),_0x584ddb,_0x102c15['error'][_0x61cf('0x14')]);return _0x1791c5(_0x102c15[_0x61cf('0x11')][_0x61cf('0x14')]);}logger[_0x61cf('0x11')](_0x61cf('0x13'),_0x584ddb,_0x102c15['error'][_0x61cf('0x14')]);return _0x594ee8(_0x102c15[_0x61cf('0x11')]['message']);}else{logger[_0x61cf('0x15')](_0x61cf('0x13'),_0x584ddb,_0x61cf('0xf'));_0x594ee8(_0x102c15['result'][_0x61cf('0x14')]);}})[_0x61cf('0x16')](function(_0x215e5d){logger[_0x61cf('0x11')]('CmList,\x20%s,\x20%s',_0x584ddb,_0x215e5d);_0x1791c5(_0x215e5d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d42a671..097b096 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 _0xc84b=['length','cmList:','./cmList.events','save','remove','update','emit','removeListener','register'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc84b,0x173));var _0xbc84=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xc84b[_0x2aea9e];return _0x430b92;};'use strict';var CmListEvents=require(_0xbc84('0x0'));var events=[_0xbc84('0x1'),_0xbc84('0x2'),_0xbc84('0x3')];function createListener(_0xf6af18,_0x52d33c){return function(_0x4ef69f){_0x52d33c[_0xbc84('0x4')](_0xf6af18,_0x4ef69f);};}function removeListener(_0x4ef3a8,_0x12c5d2){return function(){CmListEvents[_0xbc84('0x5')](_0x4ef3a8,_0x12c5d2);};}exports[_0xbc84('0x6')]=function(_0xe010fb){for(var _0x2f22d7=0x0,_0x2c10d1=events[_0xbc84('0x7')];_0x2f22d7<_0x2c10d1;_0x2f22d7++){var _0x385cab=events[_0x2f22d7];var _0x5f4e35=createListener(_0xbc84('0x8')+_0x385cab,_0xe010fb);CmListEvents['on'](_0x385cab,_0x5f4e35);}}; \ No newline at end of file +var _0xb769=['remove','update','emit','register','./cmList.events'];(function(_0x1b1516,_0x17a510){var _0x14902e=function(_0x573007){while(--_0x573007){_0x1b1516['push'](_0x1b1516['shift']());}};_0x14902e(++_0x17a510);}(_0xb769,0x19e));var _0x9b76=function(_0x4fe24d,_0x1a7f98){_0x4fe24d=_0x4fe24d-0x0;var _0x481987=_0xb769[_0x4fe24d];return _0x481987;};'use strict';var CmListEvents=require(_0x9b76('0x0'));var events=['save',_0x9b76('0x1'),_0x9b76('0x2')];function createListener(_0x49231b,_0x4cb518){return function(_0x238055){_0x4cb518[_0x9b76('0x3')](_0x49231b,_0x238055);};}function removeListener(_0x2e0f1d,_0x3bfe40){return function(){CmListEvents['removeListener'](_0x2e0f1d,_0x3bfe40);};}exports[_0x9b76('0x4')]=function(_0x18f154){for(var _0x5706b0=0x0,_0x4af80b=events['length'];_0x5706b0<_0x4af80b;_0x5706b0++){var _0x2a14e4=events[_0x5706b0];var _0x4a5c45=createListener('cmList:'+_0x2a14e4,_0x18f154);CmListEvents['on'](_0x2a14e4,_0x4a5c45);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 6152ffc..321eefa 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 _0x2875=['/:id/fields','getCustomFields','post','addDisposition','/:id/contacts','addAgents','delete','removeDispositions','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','getContactsCsv'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2875,0x14b));var _0x5287=function(_0x389a61,_0x20216c){_0x389a61=_0x389a61-0x0;var _0x1acde9=_0x2875[_0x389a61];return _0x1acde9;};'use strict';var multer=require(_0x5287('0x0'));var util=require(_0x5287('0x1'));var path=require(_0x5287('0x2'));var timeout=require(_0x5287('0x3'));var express=require(_0x5287('0x4'));var router=express[_0x5287('0x5')]();var fs_extra=require(_0x5287('0x6'));var auth=require(_0x5287('0x7'));var interaction=require(_0x5287('0x8'));var config=require(_0x5287('0x9'));var controller=require('./cmList.controller');router[_0x5287('0xa')]('/',auth[_0x5287('0xb')](),controller[_0x5287('0xc')]);router[_0x5287('0xa')](_0x5287('0xd'),auth[_0x5287('0xb')](),controller[_0x5287('0xe')]);router['get'](_0x5287('0xf'),auth[_0x5287('0xb')](),controller[_0x5287('0x10')]);router[_0x5287('0xa')](_0x5287('0x11'),auth[_0x5287('0xb')](),controller['show']);router[_0x5287('0xa')](_0x5287('0x12'),auth[_0x5287('0xb')](),controller[_0x5287('0x13')]);router[_0x5287('0xa')]('/:id/contacts',auth[_0x5287('0xb')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x5287('0x14')]);router['get'](_0x5287('0x15'),auth[_0x5287('0xb')](),controller[_0x5287('0x16')]);router[_0x5287('0xa')]('/:id/users',auth[_0x5287('0xb')](),controller['getAgents']);router[_0x5287('0x17')]('/',auth[_0x5287('0xb')](),controller['create']);router[_0x5287('0x17')]('/:id/dispositions',auth[_0x5287('0xb')](),controller[_0x5287('0x18')]);router[_0x5287('0x17')](_0x5287('0x19'),auth[_0x5287('0xb')](),controller['addContacts']);router[_0x5287('0x17')](_0x5287('0x15'),auth[_0x5287('0xb')](),controller['addCustomField']);router['post']('/:id/users',auth[_0x5287('0xb')](),controller[_0x5287('0x1a')]);router['put'](_0x5287('0x11'),auth[_0x5287('0xb')](),controller['update']);router['delete'](_0x5287('0x11'),auth[_0x5287('0xb')](),controller['destroy']);router[_0x5287('0x1b')](_0x5287('0x12'),auth[_0x5287('0xb')](),controller[_0x5287('0x1c')]);router[_0x5287('0x1b')](_0x5287('0x1d'),auth[_0x5287('0xb')](),controller[_0x5287('0x1e')]);module[_0x5287('0x1f')]=router; \ No newline at end of file +var _0x4a52=['addCustomField','addAgents','put','/:id','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/fields'];(function(_0x46131c,_0x2bbce0){var _0x3785e1=function(_0x5c5ac3){while(--_0x5c5ac3){_0x46131c['push'](_0x46131c['shift']());}};_0x3785e1(++_0x2bbce0);}(_0x4a52,0x15e));var _0x24a5=function(_0x2b38d9,_0x15873d){_0x2b38d9=_0x2b38d9-0x0;var _0x30e644=_0x4a52[_0x2b38d9];return _0x30e644;};'use strict';var multer=require(_0x24a5('0x0'));var util=require(_0x24a5('0x1'));var path=require(_0x24a5('0x2'));var timeout=require(_0x24a5('0x3'));var express=require(_0x24a5('0x4'));var router=express['Router']();var fs_extra=require(_0x24a5('0x5'));var auth=require(_0x24a5('0x6'));var interaction=require(_0x24a5('0x7'));var config=require(_0x24a5('0x8'));var controller=require(_0x24a5('0x9'));router[_0x24a5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x24a5('0xa')](_0x24a5('0xb'),auth[_0x24a5('0xc')](),controller[_0x24a5('0xd')]);router['get'](_0x24a5('0xe'),auth[_0x24a5('0xc')](),controller[_0x24a5('0xf')]);router[_0x24a5('0xa')]('/:id',auth[_0x24a5('0xc')](),controller[_0x24a5('0x10')]);router[_0x24a5('0xa')](_0x24a5('0x11'),auth[_0x24a5('0xc')](),controller[_0x24a5('0x12')]);router['get'](_0x24a5('0x13'),auth[_0x24a5('0xc')](),controller[_0x24a5('0x14')]);router['get'](_0x24a5('0x15'),auth[_0x24a5('0xc')](),controller[_0x24a5('0x16')]);router['get']('/:id/fields',auth[_0x24a5('0xc')](),controller[_0x24a5('0x17')]);router[_0x24a5('0xa')](_0x24a5('0x18'),auth[_0x24a5('0xc')](),controller[_0x24a5('0x19')]);router[_0x24a5('0x1a')]('/',auth[_0x24a5('0xc')](),controller[_0x24a5('0x1b')]);router['post'](_0x24a5('0x11'),auth[_0x24a5('0xc')](),controller[_0x24a5('0x1c')]);router[_0x24a5('0x1a')](_0x24a5('0x13'),auth['isAuthenticated'](),controller['addContacts']);router[_0x24a5('0x1a')](_0x24a5('0x1d'),auth[_0x24a5('0xc')](),controller[_0x24a5('0x1e')]);router[_0x24a5('0x1a')](_0x24a5('0x18'),auth[_0x24a5('0xc')](),controller[_0x24a5('0x1f')]);router[_0x24a5('0x20')](_0x24a5('0x21'),auth[_0x24a5('0xc')](),controller['update']);router[_0x24a5('0x22')](_0x24a5('0x21'),auth[_0x24a5('0xc')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x24a5('0xc')](),controller[_0x24a5('0x23')]);router['delete'](_0x24a5('0x18'),auth['isAuthenticated'](),controller[_0x24a5('0x24')]);module[_0x24a5('0x25')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 8e9921d..12e80b5 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 _0x5ebb=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5ebb,0x1c7));var _0xb5eb=function(_0x3db5a3,_0x55994c){_0x3db5a3=_0x3db5a3-0x0;var _0x1afffe=_0x5ebb[_0x3db5a3];return _0x1afffe;};'use strict';var Sequelize=require(_0xb5eb('0x0'));module[_0xb5eb('0x1')]={'name':{'type':Sequelize[_0xb5eb('0x2')],'get':function(_0x2d610c){return this[_0xb5eb('0x3')](_0xb5eb('0x4'));}},'field':{'type':Sequelize[_0xb5eb('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xb5eb('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x4fc5=['exports','VIRTUAL','STRING','sequelize'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x4fc5,0x1ab));var _0x54fc=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0x4fc5[_0x18546c];return _0x46ef43;};'use strict';var Sequelize=require(_0x54fc('0x0'));module[_0x54fc('0x1')]={'name':{'type':Sequelize[_0x54fc('0x2')],'get':function(_0xfea04c){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x54fc('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x54fc('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x54fc('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 793f458..a29b135 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1f67f4,_0x1731db){var _0x2ac8d0=function(_0x898b1d){while(--_0x898b1d){_0x1f67f4['push'](_0x1f67f4['shift']());}};_0x2ac8d0(++_0x1731db);}(_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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x180261,_0x30ae35){var _0x287fa0=function(_0x261004){while(--_0x261004){_0x180261['push'](_0x180261['shift']());}};_0x287fa0(++_0x30ae35);}(_0x7a54,0x106));var _0x47a5=function(_0x3ad6b0,_0x231f36){_0x3ad6b0=_0x3ad6b0-0x0;var _0x59df0e=_0x7a54[_0x3ad6b0];return _0x59df0e;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0a492fa..e5bee75 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 _0x2651=['define','Condition','tools_conditions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2651,0x16f));var _0x1265=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x2651[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x1265('0x0'));var util=require(_0x1265('0x1'));var logger=require(_0x1265('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1265('0x3'));var rp=require(_0x1265('0x4'));var fs=require('fs');var path=require(_0x1265('0x5'));var rimraf=require(_0x1265('0x6'));var config=require(_0x1265('0x7'));var attributes=require(_0x1265('0x8'));module[_0x1265('0x9')]=function(_0x3fad58,_0x124c8d){return _0x3fad58[_0x1265('0xa')](_0x1265('0xb'),attributes,{'tableName':_0x1265('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb004=['define','Condition','tools_conditions','lodash','api','moment','bluebird','request-promise','path','exports'];(function(_0x24e2a9,_0x1f6092){var _0x165cb4=function(_0x38ba36){while(--_0x38ba36){_0x24e2a9['push'](_0x24e2a9['shift']());}};_0x165cb4(++_0x1f6092);}(_0xb004,0xb7));var _0x4b00=function(_0x2edefe,_0x43bc02){_0x2edefe=_0x2edefe-0x0;var _0x439ab8=_0xb004[_0x2edefe];return _0x439ab8;};'use strict';var _=require(_0x4b00('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4b00('0x1'));var moment=require(_0x4b00('0x2'));var BPromise=require(_0x4b00('0x3'));var rp=require(_0x4b00('0x4'));var fs=require('fs');var path=require(_0x4b00('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x4b00('0x6')]=function(_0x5cbc6a,_0x51c2d7){return _0x5cbc6a[_0x4b00('0x7')](_0x4b00('0x8'),attributes,{'tableName':_0x4b00('0x9'),'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 1d1960f..b6b2394 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 _0x16d6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x1db562,_0x290e26){var _0xa58473=function(_0x2e0afd){while(--_0x2e0afd){_0x1db562['push'](_0x1db562['shift']());}};_0xa58473(++_0x290e26);}(_0x16d6,0xae));var _0x616d=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x16d6[_0xaa6a4];return _0xdc31a4;};'use strict';var _=require(_0x616d('0x0'));var util=require(_0x616d('0x1'));var moment=require(_0x616d('0x2'));var BPromise=require(_0x616d('0x3'));var rs=require(_0x616d('0x4'));var fs=require('fs');var Redis=require(_0x616d('0x5'));var db=require(_0x616d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x616d('0x7'))(_0x616d('0x8'));var config=require('../../config/environment');var jayson=require(_0x616d('0x9'));var client=jayson['client'][_0x616d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eca6a,_0x18e341,_0x16304b){return new BPromise(function(_0x2e169b,_0x342e52){return client['request'](_0x3eca6a,_0x16304b)[_0x616d('0xb')](function(_0x3315c0){logger[_0x616d('0xc')](_0x616d('0xd'),_0x18e341,_0x616d('0xe'));logger[_0x616d('0xf')](_0x616d('0x10'),_0x18e341,_0x616d('0xe'),JSON[_0x616d('0x11')](_0x3315c0));if(_0x3315c0[_0x616d('0x12')]){if(_0x3315c0['error'][_0x616d('0x13')]===0x1f4){logger['error'](_0x616d('0xd'),_0x18e341,_0x3315c0['error'][_0x616d('0x14')]);return _0x342e52(_0x3315c0[_0x616d('0x12')]['message']);}logger[_0x616d('0x12')]('Condition,\x20%s,\x20%s',_0x18e341,_0x3315c0[_0x616d('0x12')][_0x616d('0x14')]);return _0x2e169b(_0x3315c0[_0x616d('0x12')][_0x616d('0x14')]);}else{logger[_0x616d('0xc')](_0x616d('0xd'),_0x18e341,_0x616d('0xe'));_0x2e169b(_0x3315c0[_0x616d('0x15')]['message']);}})['catch'](function(_0x2f76a3){logger[_0x616d('0x12')]('Condition,\x20%s,\x20%s',_0x18e341,_0x2f76a3);_0x342e52(_0x2f76a3);});});} \ No newline at end of file +var _0x1f0b=['../../config/logger','rpc','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x228c92,_0xa15a7e){var _0x66925b=function(_0xe0e236){while(--_0xe0e236){_0x228c92['push'](_0x228c92['shift']());}};_0x66925b(++_0xa15a7e);}(_0x1f0b,0xf5));var _0xb1f0=function(_0xc989a3,_0x2ad1b0){_0xc989a3=_0xc989a3-0x0;var _0x24de1a=_0x1f0b[_0xc989a3];return _0x24de1a;};'use strict';var _=require('lodash');var util=require(_0xb1f0('0x0'));var moment=require(_0xb1f0('0x1'));var BPromise=require(_0xb1f0('0x2'));var rs=require(_0xb1f0('0x3'));var fs=require('fs');var Redis=require(_0xb1f0('0x4'));var db=require(_0xb1f0('0x5'))['db'];var utils=require(_0xb1f0('0x6'));var logger=require(_0xb1f0('0x7'))(_0xb1f0('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1f0('0x9'));var client=jayson['client'][_0xb1f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b02d6,_0x4b0a9c,_0x11b65b){return new BPromise(function(_0x57a0d8,_0x455777){return client[_0xb1f0('0xb')](_0x3b02d6,_0x11b65b)[_0xb1f0('0xc')](function(_0x6f92f1){logger[_0xb1f0('0xd')](_0xb1f0('0xe'),_0x4b0a9c,_0xb1f0('0xf'));logger[_0xb1f0('0x10')](_0xb1f0('0x11'),_0x4b0a9c,'request\x20sent',JSON['stringify'](_0x6f92f1));if(_0x6f92f1[_0xb1f0('0x12')]){if(_0x6f92f1[_0xb1f0('0x12')][_0xb1f0('0x13')]===0x1f4){logger['error'](_0xb1f0('0xe'),_0x4b0a9c,_0x6f92f1[_0xb1f0('0x12')][_0xb1f0('0x14')]);return _0x455777(_0x6f92f1[_0xb1f0('0x12')][_0xb1f0('0x14')]);}logger['error'](_0xb1f0('0xe'),_0x4b0a9c,_0x6f92f1['error'][_0xb1f0('0x14')]);return _0x57a0d8(_0x6f92f1[_0xb1f0('0x12')][_0xb1f0('0x14')]);}else{logger[_0xb1f0('0xd')](_0xb1f0('0xe'),_0x4b0a9c,_0xb1f0('0xf'));_0x57a0d8(_0x6f92f1['result'][_0xb1f0('0x14')]);}})['catch'](function(_0x36701f){logger[_0xb1f0('0x12')](_0xb1f0('0xe'),_0x4b0a9c,_0x36701f);_0x455777(_0x36701f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2377dca..c72444f 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 _0xf567=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','destroy','exports'];(function(_0x54f11e,_0x2b3226){var _0x15e017=function(_0x49c028){while(--_0x49c028){_0x54f11e['push'](_0x54f11e['shift']());}};_0x15e017(++_0x2b3226);}(_0xf567,0x118));var _0x7f56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf567[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var path=require(_0x7f56('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f56('0x3'));var router=express[_0x7f56('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f56('0x5'));var interaction=require(_0x7f56('0x6'));var config=require(_0x7f56('0x7'));var controller=require(_0x7f56('0x8'));router['put'](_0x7f56('0x9'),auth[_0x7f56('0xa')](),controller[_0x7f56('0xb')]);router['delete'](_0x7f56('0x9'),auth[_0x7f56('0xa')](),controller[_0x7f56('0xc')]);module[_0x7f56('0xd')]=router; \ No newline at end of file +var _0x4963=['/:id','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','isAuthenticated','update','delete'];(function(_0x3e08bb,_0x339b65){var _0x292dc7=function(_0xaec5ed){while(--_0xaec5ed){_0x3e08bb['push'](_0x3e08bb['shift']());}};_0x292dc7(++_0x339b65);}(_0x4963,0xff));var _0x3496=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4963[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3496('0x0'));var util=require(_0x3496('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3496('0x2'));var router=express[_0x3496('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3496('0x4'));var interaction=require(_0x3496('0x5'));var config=require(_0x3496('0x6'));var controller=require(_0x3496('0x7'));router['put']('/:id',auth[_0x3496('0x8')](),controller[_0x3496('0x9')]);router[_0x3496('0xa')](_0x3496('0xb'),auth['isAuthenticated'](),controller[_0x3496('0xc')]);module[_0x3496('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1acb40d..8c1b88a 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaeaa=['STRING','name','INTEGER','exports'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xaeaa,0xf3));var _0xaaea=function(_0x23f69e,_0x753e91){_0x23f69e=_0x23f69e-0x0;var _0x1b2a46=_0xaeaa[_0x23f69e];return _0x1b2a46;};'use strict';var Sequelize=require('sequelize');module[_0xaaea('0x0')]={'name':{'type':Sequelize[_0xaaea('0x1')],'allowNull':![],'unique':_0xaaea('0x2')},'OrderBy':{'type':Sequelize[_0xaaea('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xaaea('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x3ce7=['INTEGER','STRING','name'];(function(_0x31919b,_0x41056d){var _0x29e2f1=function(_0x2f6f01){while(--_0x2f6f01){_0x31919b['push'](_0x31919b['shift']());}};_0x29e2f1(++_0x41056d);}(_0x3ce7,0xec));var _0x73ce=function(_0x40fa47,_0x2085d8){_0x40fa47=_0x40fa47-0x0;var _0x5ea1c6=_0x3ce7[_0x40fa47];return _0x5ea1c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x73ce('0x0')},'OrderBy':{'type':Sequelize[_0x73ce('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x73ce('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index b124b66..36a3bdc 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','send','index','map','ContactItemType','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x7708,0x188));var _0x8770=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0x7708[_0x1ee9a1];return _0x21270f;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){var _0x460474=_0x4274dd['get']({'plain':!![]});var _0x7b4755=_0x8770('0x23');return db[_0x8770('0x24')][_0x8770('0x22')]({'where':{'type':_0x7b4755,'resourceId':_0x460474['id']}})[_0x8770('0x21')](function(){return _0x4274dd;});})[_0x8770('0x21')](function(){_0x468fc0[_0x8770('0x17')](0xcc)[_0x8770('0x18')]();});}};}function handleEntityNotFound(_0xb3f4aa,_0xa480){return function(_0x5f4973){if(!_0x5f4973){_0xb3f4aa[_0x8770('0x16')](0x194);}return _0x5f4973;};}function handleError(_0x199b96,_0x1df627){_0x1df627=_0x1df627||0x1f4;return function(_0x5c7bd){logger[_0x8770('0x25')](_0x5c7bd[_0x8770('0x26')]);if(_0x5c7bd['name']){delete _0x5c7bd['name'];}_0x199b96[_0x8770('0x17')](_0x1df627)[_0x8770('0x27')](_0x5c7bd);};}exports[_0x8770('0x28')]=function(_0x365080,_0x23f4b0){var _0x4bc072={},_0x5282dd={},_0x45fff4={'count':0x0,'rows':[]};var _0x144c24=_[_0x8770('0x29')](db[_0x8770('0x2a')]['rawAttributes'],function(_0x2f4e44){return{'name':_0x2f4e44['fieldName'],'type':_0x2f4e44['type'][_0x8770('0x2b')]};});_0x5282dd['model']=_[_0x8770('0x29')](_0x144c24,_0x8770('0x2c'));_0x5282dd[_0x8770('0x2d')]=_[_0x8770('0x2e')](_0x365080[_0x8770('0x2d')]);_0x5282dd[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],_0x5282dd[_0x8770('0x2d')]);_0x4bc072['attributes']=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],qs[_0x8770('0x32')](_0x365080['query']['fields']));_0x4bc072[_0x8770('0x33')]=_0x4bc072[_0x8770('0x33')][_0x8770('0x34')]?_0x4bc072['attributes']:_0x5282dd[_0x8770('0x31')];if(!_0x365080['query'][_0x8770('0x35')](_0x8770('0x36'))){_0x4bc072[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x365080[_0x8770('0x2d')][_0x8770('0x1c')]);_0x4bc072[_0x8770('0x1a')]=qs[_0x8770('0x1a')](_0x365080[_0x8770('0x2d')][_0x8770('0x1a')]);}_0x4bc072['order']=qs[_0x8770('0x37')](_0x365080[_0x8770('0x2d')][_0x8770('0x37')]);_0x4bc072['where']=qs[_0x8770('0x2f')](_[_0x8770('0x38')](_0x365080[_0x8770('0x2d')],_0x5282dd[_0x8770('0x2f')]),_0x144c24);if(_0x365080[_0x8770('0x2d')][_0x8770('0x39')]){_0x4bc072['where']=_[_0x8770('0x3a')](_0x4bc072['where'],{'$or':_[_0x8770('0x29')](_0x144c24,function(_0x57f52e){if(_0x57f52e[_0x8770('0x3b')]!==_0x8770('0x3c')){var _0x306142={};_0x306142[_0x57f52e['name']]={'$like':'%'+_0x365080[_0x8770('0x2d')][_0x8770('0x39')]+'%'};return _0x306142;}})});}_0x4bc072=_[_0x8770('0x3a')]({},_0x4bc072,_0x365080[_0x8770('0x3d')]);var _0x408e86={'where':_0x4bc072[_0x8770('0x3e')]};return db['ContactItemType'][_0x8770('0x1b')](_0x408e86)['then'](function(_0x4bcfc7){_0x45fff4[_0x8770('0x1b')]=_0x4bcfc7;if(_0x365080[_0x8770('0x2d')][_0x8770('0x3f')]){_0x4bc072[_0x8770('0x40')]=[{'all':!![]}];}return db[_0x8770('0x2a')]['findAll'](_0x4bc072);})[_0x8770('0x21')](function(_0x26ae1b){_0x45fff4['rows']=_0x26ae1b;return _0x45fff4;})[_0x8770('0x21')](respondWithFilteredResult(_0x23f4b0,_0x4bc072))['catch'](handleError(_0x23f4b0,null));};exports[_0x8770('0x41')]=function(_0x6bfa55,_0xc29c65){var _0x39c0d3={'raw':!![],'where':{'id':_0x6bfa55[_0x8770('0x42')]['id']}},_0x29dae5={};_0x29dae5[_0x8770('0x31')]=_[_0x8770('0x2e')](db[_0x8770('0x2a')][_0x8770('0x43')]);_0x29dae5[_0x8770('0x2d')]=_['keys'](_0x6bfa55[_0x8770('0x2d')]);_0x29dae5[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x29dae5[_0x8770('0x31')],_0x29dae5[_0x8770('0x2d')]);_0x39c0d3[_0x8770('0x33')]=_['intersection'](_0x29dae5[_0x8770('0x31')],qs[_0x8770('0x32')](_0x6bfa55[_0x8770('0x2d')][_0x8770('0x32')]));_0x39c0d3[_0x8770('0x33')]=_0x39c0d3[_0x8770('0x33')][_0x8770('0x34')]?_0x39c0d3[_0x8770('0x33')]:_0x29dae5['model'];if(_0x6bfa55[_0x8770('0x2d')][_0x8770('0x3f')]){_0x39c0d3[_0x8770('0x40')]=[{'all':!![]}];}_0x39c0d3=_[_0x8770('0x3a')]({},_0x39c0d3,_0x6bfa55[_0x8770('0x3d')]);return db['ContactItemType']['find'](_0x39c0d3)[_0x8770('0x21')](handleEntityNotFound(_0xc29c65,null))['then'](respondWithResult(_0xc29c65,null))[_0x8770('0x44')](handleError(_0xc29c65,null));};exports['create']=function(_0x4f9e0b,_0x3805d8){return db[_0x8770('0x2a')][_0x8770('0x45')](_0x4f9e0b[_0x8770('0x46')],{})['then'](function(_0x136cc1){var _0x48dea0=_0x4f9e0b['user']['get']({'plain':!![]});if(!_0x48dea0)throw new Error(_0x8770('0x47'));if(_0x48dea0[_0x8770('0x48')]===_0x8770('0x49')){var _0x4f5cb8=_0x136cc1[_0x8770('0x4a')]({'plain':!![]});var _0x5b6638=_0x8770('0x23');return db[_0x8770('0x4b')][_0x8770('0x4c')]({'where':{'name':_0x5b6638,'userProfileId':_0x48dea0['userProfileId']},'raw':!![]})[_0x8770('0x21')](function(_0x5de11e){if(_0x5de11e&&_0x5de11e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8770('0x45')]({'name':_0x4f5cb8[_0x8770('0x2c')],'resourceId':_0x4f5cb8['id'],'type':_0x5de11e[_0x8770('0x2c')],'sectionId':_0x5de11e['id']},{})[_0x8770('0x21')](function(){return _0x136cc1;});}else{return _0x136cc1;}})[_0x8770('0x44')](function(_0x1df5cd){logger['error'](_0x8770('0x4d'),_0x1df5cd);throw _0x1df5cd;});}return _0x136cc1;})['then'](respondWithResult(_0x3805d8,0xc9))[_0x8770('0x44')](handleError(_0x3805d8,null));};exports[_0x8770('0x20')]=function(_0x475e9d,_0x3e4f77){if(_0x475e9d['body']['id']){delete _0x475e9d[_0x8770('0x46')]['id'];}return db[_0x8770('0x2a')]['find']({'where':{'id':_0x475e9d['params']['id']}})['then'](handleEntityNotFound(_0x3e4f77,null))['then'](saveUpdates(_0x475e9d[_0x8770('0x46')],null))[_0x8770('0x21')](respondWithResult(_0x3e4f77,null))['catch'](handleError(_0x3e4f77,null));};exports[_0x8770('0x22')]=function(_0x38b68f,_0x435c23){return db[_0x8770('0x2a')][_0x8770('0x4c')]({'where':{'id':_0x38b68f[_0x8770('0x42')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x435c23,null))[_0x8770('0x21')](db[_0x8770('0x4e')][_0x8770('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x38b68f[_0x8770('0x42')]['id']}}))['then'](removeEntity(_0x435c23,null))[_0x8770('0x44')](handleError(_0x435c23,null));}; \ No newline at end of file +var _0x32b6=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2c8d32,_0x4635ce){var _0x339504=function(_0x2eff7a){while(--_0x2eff7a){_0x2c8d32['push'](_0x2c8d32['shift']());}};_0x339504(++_0x4635ce);}(_0x32b6,0x1d1));var _0x632b=function(_0x419f14,_0x524c03){_0x419f14=_0x419f14-0x0;var _0x10cbb0=_0x32b6[_0x419f14];return _0x10cbb0;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];function respondWithStatusCode(_0xe81378,_0x3d8bed){_0x3d8bed=_0x3d8bed||0xcc;return function(_0x22c182){if(_0x22c182){return _0xe81378['sendStatus'](_0x3d8bed);}return _0xe81378[_0x632b('0x18')](_0x3d8bed)[_0x632b('0x19')]();};}function respondWithResult(_0x9246a6,_0x5a97da){_0x5a97da=_0x5a97da||0xc8;return function(_0x721883){if(_0x721883){return _0x9246a6[_0x632b('0x18')](_0x5a97da)[_0x632b('0x1a')](_0x721883);}};}function respondWithFilteredResult(_0x17ff9b,_0x40d410){return function(_0x21cdd3){if(_0x21cdd3){var _0x4efe39=typeof _0x40d410[_0x632b('0x1b')]==='undefined'&&typeof _0x40d410['limit']===_0x632b('0x1c');var _0x5afa1e=_0x21cdd3[_0x632b('0x1d')];var _0x3bb27f=_0x4efe39?0x0:_0x40d410[_0x632b('0x1b')];var _0x51c894=_0x4efe39?_0x21cdd3[_0x632b('0x1d')]:_0x40d410[_0x632b('0x1b')]+_0x40d410[_0x632b('0x1e')];var _0x3683e4;if(_0x51c894>=_0x5afa1e){_0x51c894=_0x5afa1e;_0x3683e4=0xc8;}else{_0x3683e4=0xce;}_0x17ff9b['status'](_0x3683e4);return _0x17ff9b[_0x632b('0x1f')](_0x632b('0x20'),_0x3bb27f+'-'+_0x51c894+'/'+_0x5afa1e)['json'](_0x21cdd3);}return null;};}function patchUpdates(_0x116f62){return function(_0x50b930){try{jsonpatch['apply'](_0x50b930,_0x116f62,!![]);}catch(_0x1b1092){return BPromise['reject'](_0x1b1092);}return _0x50b930[_0x632b('0x21')]();};}function saveUpdates(_0x1c4530,_0x2a6833){return function(_0x540bfb){if(_0x540bfb){return _0x540bfb[_0x632b('0x22')](_0x1c4530)[_0x632b('0x23')](function(_0x59d83a){return _0x59d83a;});}return null;};}function removeEntity(_0x1db8f5,_0x379dc2){return function(_0x30ffb9){if(_0x30ffb9){return _0x30ffb9[_0x632b('0x24')]()[_0x632b('0x23')](function(){var _0x183c5c=_0x30ffb9['get']({'plain':!![]});var _0x5e7b20=_0x632b('0x25');return db['UserProfileResource'][_0x632b('0x24')]({'where':{'type':_0x5e7b20,'resourceId':_0x183c5c['id']}})[_0x632b('0x23')](function(){return _0x30ffb9;});})['then'](function(){_0x1db8f5[_0x632b('0x18')](0xcc)[_0x632b('0x19')]();});}};}function handleEntityNotFound(_0x29d9aa,_0x18dc8c){return function(_0x4728a8){if(!_0x4728a8){_0x29d9aa[_0x632b('0x26')](0x194);}return _0x4728a8;};}function handleError(_0xe9d530,_0x1975ac){_0x1975ac=_0x1975ac||0x1f4;return function(_0x33a625){logger['error'](_0x33a625[_0x632b('0x27')]);if(_0x33a625[_0x632b('0x28')]){delete _0x33a625[_0x632b('0x28')];}_0xe9d530[_0x632b('0x18')](_0x1975ac)[_0x632b('0x29')](_0x33a625);};}exports[_0x632b('0x2a')]=function(_0x3c5dc9,_0x417d62){var _0x1ace1b={},_0x319df3={},_0x417793={'count':0x0,'rows':[]};var _0x35584f=_[_0x632b('0x2b')](db[_0x632b('0x2c')][_0x632b('0x2d')],function(_0x3dff99){return{'name':_0x3dff99[_0x632b('0x2e')],'type':_0x3dff99[_0x632b('0x2f')][_0x632b('0x30')]};});_0x319df3[_0x632b('0x31')]=_['map'](_0x35584f,_0x632b('0x28'));_0x319df3[_0x632b('0x32')]=_[_0x632b('0x33')](_0x3c5dc9[_0x632b('0x32')]);_0x319df3['filters']=_[_0x632b('0x34')](_0x319df3['model'],_0x319df3[_0x632b('0x32')]);_0x1ace1b[_0x632b('0x35')]=_['intersection'](_0x319df3[_0x632b('0x31')],qs[_0x632b('0x36')](_0x3c5dc9[_0x632b('0x32')][_0x632b('0x36')]));_0x1ace1b[_0x632b('0x35')]=_0x1ace1b[_0x632b('0x35')][_0x632b('0x37')]?_0x1ace1b[_0x632b('0x35')]:_0x319df3['model'];if(!_0x3c5dc9['query'][_0x632b('0x38')](_0x632b('0x39'))){_0x1ace1b[_0x632b('0x1e')]=qs[_0x632b('0x1e')](_0x3c5dc9[_0x632b('0x32')][_0x632b('0x1e')]);_0x1ace1b[_0x632b('0x1b')]=qs[_0x632b('0x1b')](_0x3c5dc9['query']['offset']);}_0x1ace1b[_0x632b('0x3a')]=qs['sort'](_0x3c5dc9[_0x632b('0x32')][_0x632b('0x3b')]);_0x1ace1b[_0x632b('0x3c')]=qs[_0x632b('0x3d')](_[_0x632b('0x3e')](_0x3c5dc9[_0x632b('0x32')],_0x319df3[_0x632b('0x3d')]),_0x35584f);if(_0x3c5dc9[_0x632b('0x32')][_0x632b('0x3f')]){_0x1ace1b[_0x632b('0x3c')]=_[_0x632b('0x40')](_0x1ace1b[_0x632b('0x3c')],{'$or':_[_0x632b('0x2b')](_0x35584f,function(_0x1c348e){if(_0x1c348e[_0x632b('0x2f')]!==_0x632b('0x41')){var _0x3d4095={};_0x3d4095[_0x1c348e['name']]={'$like':'%'+_0x3c5dc9['query']['filter']+'%'};return _0x3d4095;}})});}_0x1ace1b=_['merge']({},_0x1ace1b,_0x3c5dc9['options']);var _0x361cf6={'where':_0x1ace1b['where']};return db['ContactItemType']['count'](_0x361cf6)[_0x632b('0x23')](function(_0x4490d4){_0x417793[_0x632b('0x1d')]=_0x4490d4;if(_0x3c5dc9[_0x632b('0x32')]['includeAll']){_0x1ace1b[_0x632b('0x42')]=[{'all':!![]}];}return db[_0x632b('0x2c')][_0x632b('0x43')](_0x1ace1b);})['then'](function(_0x15bb30){_0x417793[_0x632b('0x44')]=_0x15bb30;return _0x417793;})[_0x632b('0x23')](respondWithFilteredResult(_0x417d62,_0x1ace1b))[_0x632b('0x45')](handleError(_0x417d62,null));};exports[_0x632b('0x46')]=function(_0xd006b4,_0x5b510a){var _0x3106c1={'raw':!![],'where':{'id':_0xd006b4[_0x632b('0x47')]['id']}},_0x2b90c8={};_0x2b90c8[_0x632b('0x31')]=_['keys'](db['ContactItemType'][_0x632b('0x2d')]);_0x2b90c8[_0x632b('0x32')]=_[_0x632b('0x33')](_0xd006b4[_0x632b('0x32')]);_0x2b90c8[_0x632b('0x3d')]=_[_0x632b('0x34')](_0x2b90c8['model'],_0x2b90c8[_0x632b('0x32')]);_0x3106c1[_0x632b('0x35')]=_[_0x632b('0x34')](_0x2b90c8[_0x632b('0x31')],qs[_0x632b('0x36')](_0xd006b4[_0x632b('0x32')][_0x632b('0x36')]));_0x3106c1[_0x632b('0x35')]=_0x3106c1['attributes'][_0x632b('0x37')]?_0x3106c1['attributes']:_0x2b90c8[_0x632b('0x31')];if(_0xd006b4['query'][_0x632b('0x48')]){_0x3106c1[_0x632b('0x42')]=[{'all':!![]}];}_0x3106c1=_[_0x632b('0x40')]({},_0x3106c1,_0xd006b4[_0x632b('0x49')]);return db[_0x632b('0x2c')]['find'](_0x3106c1)[_0x632b('0x23')](handleEntityNotFound(_0x5b510a,null))[_0x632b('0x23')](respondWithResult(_0x5b510a,null))[_0x632b('0x45')](handleError(_0x5b510a,null));};exports['create']=function(_0x253aec,_0x16eb80){return db[_0x632b('0x2c')][_0x632b('0x4a')](_0x253aec[_0x632b('0x4b')],{})['then'](function(_0xe51b4f){var _0x50adc4=_0x253aec[_0x632b('0x4c')][_0x632b('0x4d')]({'plain':!![]});if(!_0x50adc4)throw new Error(_0x632b('0x4e'));if(_0x50adc4[_0x632b('0x4f')]===_0x632b('0x4c')){var _0x52785a=_0xe51b4f['get']({'plain':!![]});var _0x3726b6=_0x632b('0x25');return db[_0x632b('0x50')][_0x632b('0x51')]({'where':{'name':_0x3726b6,'userProfileId':_0x50adc4[_0x632b('0x52')]},'raw':!![]})[_0x632b('0x23')](function(_0x509bf7){if(_0x509bf7&&_0x509bf7[_0x632b('0x53')]===0x0){return db[_0x632b('0x54')][_0x632b('0x4a')]({'name':_0x52785a['name'],'resourceId':_0x52785a['id'],'type':_0x509bf7[_0x632b('0x28')],'sectionId':_0x509bf7['id']},{})[_0x632b('0x23')](function(){return _0xe51b4f;});}else{return _0xe51b4f;}})[_0x632b('0x45')](function(_0x1a79fa){logger['error'](_0x632b('0x55'),_0x1a79fa);throw _0x1a79fa;});}return _0xe51b4f;})[_0x632b('0x23')](respondWithResult(_0x16eb80,0xc9))[_0x632b('0x45')](handleError(_0x16eb80,null));};exports[_0x632b('0x22')]=function(_0x279228,_0x4df503){if(_0x279228[_0x632b('0x4b')]['id']){delete _0x279228[_0x632b('0x4b')]['id'];}return db[_0x632b('0x2c')][_0x632b('0x51')]({'where':{'id':_0x279228[_0x632b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4df503,null))[_0x632b('0x23')](saveUpdates(_0x279228[_0x632b('0x4b')],null))[_0x632b('0x23')](respondWithResult(_0x4df503,null))[_0x632b('0x45')](handleError(_0x4df503,null));};exports[_0x632b('0x24')]=function(_0x9accea,_0x70bba4){return db[_0x632b('0x2c')][_0x632b('0x51')]({'where':{'id':_0x9accea[_0x632b('0x47')]['id']}})[_0x632b('0x23')](handleEntityNotFound(_0x70bba4,null))['then'](db[_0x632b('0x56')][_0x632b('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x9accea[_0x632b('0x47')]['id']}}))[_0x632b('0x23')](removeEntity(_0x70bba4,null))[_0x632b('0x45')](handleError(_0x70bba4,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1d8c007..aed2262 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36cb=['path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x36cb,0x17b));var _0xb36c=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x36cb[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xb36c('0x0'));var util=require('util');var logger=require(_0xb36c('0x1'))(_0xb36c('0x2'));var moment=require(_0xb36c('0x3'));var BPromise=require(_0xb36c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb36c('0x5'));var rimraf=require(_0xb36c('0x6'));var config=require('../../config/environment');var attributes=require(_0xb36c('0x7'));module[_0xb36c('0x8')]=function(_0x1abf5d,_0x109e83){return _0x1abf5d[_0xb36c('0x9')](_0xb36c('0xa'),attributes,{'tableName':_0xb36c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b4d=['./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','util','../../config/logger','moment','bluebird','rimraf'];(function(_0xed4e3c,_0x39e976){var _0x4297cc=function(_0x5a0cb8){while(--_0x5a0cb8){_0xed4e3c['push'](_0xed4e3c['shift']());}};_0x4297cc(++_0x39e976);}(_0x5b4d,0xb9));var _0xd5b4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5b4d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xd5b4('0x0'));var logger=require(_0xd5b4('0x1'))('api');var moment=require(_0xd5b4('0x2'));var BPromise=require(_0xd5b4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd5b4('0x4'));var config=require('../../config/environment');var attributes=require(_0xd5b4('0x5'));module[_0xd5b4('0x6')]=function(_0x1c12ef,_0x1429ba){return _0x1c12ef[_0xd5b4('0x7')](_0xd5b4('0x8'),attributes,{'tableName':_0xd5b4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 6d008d7..4a8851d 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8443=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','ContactItemType,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8443,0x101));var _0x3844=function(_0xcc47fd,_0x3f5165){_0xcc47fd=_0xcc47fd-0x0;var _0x5e952d=_0x8443[_0xcc47fd];return _0x5e952d;};'use strict';var _=require(_0x3844('0x0'));var util=require(_0x3844('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3844('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3844('0x3'))['db'];var utils=require(_0x3844('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3844('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3844('0x6')][_0x3844('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x365778,_0x18c10b,_0x1910e8){return new BPromise(function(_0xcfecf9,_0x567467){return client[_0x3844('0x8')](_0x365778,_0x1910e8)[_0x3844('0x9')](function(_0x21a8c4){logger['info']('ContactItemType,\x20%s,\x20%s',_0x18c10b,'request\x20sent');logger[_0x3844('0xa')](_0x3844('0xb'),_0x18c10b,'request\x20sent',JSON[_0x3844('0xc')](_0x21a8c4));if(_0x21a8c4[_0x3844('0xd')]){if(_0x21a8c4[_0x3844('0xd')]['code']===0x1f4){logger[_0x3844('0xd')]('ContactItemType,\x20%s,\x20%s',_0x18c10b,_0x21a8c4[_0x3844('0xd')][_0x3844('0xe')]);return _0x567467(_0x21a8c4[_0x3844('0xd')][_0x3844('0xe')]);}logger[_0x3844('0xd')](_0x3844('0xf'),_0x18c10b,_0x21a8c4[_0x3844('0xd')][_0x3844('0xe')]);return _0xcfecf9(_0x21a8c4[_0x3844('0xd')][_0x3844('0xe')]);}else{logger[_0x3844('0x10')](_0x3844('0xf'),_0x18c10b,_0x3844('0x11'));_0xcfecf9(_0x21a8c4[_0x3844('0x12')]['message']);}})[_0x3844('0x13')](function(_0x599395){logger[_0x3844('0xd')]('ContactItemType,\x20%s,\x20%s',_0x18c10b,_0x599395);_0x567467(_0x599395);});});} \ No newline at end of file +var _0x7fce=['ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error'];(function(_0x47b038,_0x1b0295){var _0xf5a7f1=function(_0x4bdc6b){while(--_0x4bdc6b){_0x47b038['push'](_0x47b038['shift']());}};_0xf5a7f1(++_0x1b0295);}(_0x7fce,0xdc));var _0xe7fc=function(_0x23ead1,_0x4f12ee){_0x23ead1=_0x23ead1-0x0;var _0x38a873=_0x7fce[_0x23ead1];return _0x38a873;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var moment=require(_0xe7fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7fc('0x5'))(_0xe7fc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4665f6,_0x161dca,_0x296b2e){return new BPromise(function(_0x19eeef,_0x22fabf){return client['request'](_0x4665f6,_0x296b2e)[_0xe7fc('0x8')](function(_0x4a1209){logger[_0xe7fc('0x9')]('ContactItemType,\x20%s,\x20%s',_0x161dca,_0xe7fc('0xa'));logger[_0xe7fc('0xb')](_0xe7fc('0xc'),_0x161dca,_0xe7fc('0xa'),JSON['stringify'](_0x4a1209));if(_0x4a1209[_0xe7fc('0xd')]){if(_0x4a1209[_0xe7fc('0xd')]['code']===0x1f4){logger['error'](_0xe7fc('0xe'),_0x161dca,_0x4a1209['error'][_0xe7fc('0xf')]);return _0x22fabf(_0x4a1209['error']['message']);}logger[_0xe7fc('0xd')](_0xe7fc('0xe'),_0x161dca,_0x4a1209[_0xe7fc('0xd')][_0xe7fc('0xf')]);return _0x19eeef(_0x4a1209[_0xe7fc('0xd')]['message']);}else{logger[_0xe7fc('0x9')]('ContactItemType,\x20%s,\x20%s',_0x161dca,'request\x20sent');_0x19eeef(_0x4a1209[_0xe7fc('0x10')][_0xe7fc('0xf')]);}})[_0xe7fc('0x11')](function(_0x3a44a6){logger['error']('ContactItemType,\x20%s,\x20%s',_0x161dca,_0x3a44a6);_0x22fabf(_0x3a44a6);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 8b00d84..fb227f4 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75ff=['create','put','update','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post'];(function(_0x9388c8,_0x2cdf84){var _0x6f1d3a=function(_0x6a3073){while(--_0x6a3073){_0x9388c8['push'](_0x9388c8['shift']());}};_0x6f1d3a(++_0x2cdf84);}(_0x75ff,0x1e1));var _0xf75f=function(_0x3efcd5,_0x9bbba3){_0x3efcd5=_0x3efcd5-0x0;var _0x54e50a=_0x75ff[_0x3efcd5];return _0x54e50a;};'use strict';var multer=require(_0xf75f('0x0'));var util=require('util');var path=require(_0xf75f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf75f('0x2'));var router=express['Router']();var fs_extra=require(_0xf75f('0x3'));var auth=require(_0xf75f('0x4'));var interaction=require(_0xf75f('0x5'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router['get']('/',auth[_0xf75f('0x6')](),controller[_0xf75f('0x7')]);router[_0xf75f('0x8')](_0xf75f('0x9'),auth[_0xf75f('0x6')](),controller[_0xf75f('0xa')]);router[_0xf75f('0xb')]('/',auth[_0xf75f('0x6')](),controller[_0xf75f('0xc')]);router[_0xf75f('0xd')](_0xf75f('0x9'),auth['isAuthenticated'](),controller[_0xf75f('0xe')]);router['delete']('/:id',auth[_0xf75f('0x6')](),controller[_0xf75f('0xf')]);module[_0xf75f('0x10')]=router; \ No newline at end of file +var _0x57f2=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x7a6b99,_0x2fb019){var _0x2b430f=function(_0xca8d95){while(--_0xca8d95){_0x7a6b99['push'](_0x7a6b99['shift']());}};_0x2b430f(++_0x2fb019);}(_0x57f2,0x64));var _0x257f=function(_0x5b67e0,_0x1b0115){_0x5b67e0=_0x5b67e0-0x0;var _0x3cae64=_0x57f2[_0x5b67e0];return _0x3cae64;};'use strict';var multer=require(_0x257f('0x0'));var util=require(_0x257f('0x1'));var path=require(_0x257f('0x2'));var timeout=require('connect-timeout');var express=require(_0x257f('0x3'));var router=express['Router']();var fs_extra=require(_0x257f('0x4'));var auth=require(_0x257f('0x5'));var interaction=require(_0x257f('0x6'));var config=require(_0x257f('0x7'));var controller=require(_0x257f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x257f('0x9')]);router['get']('/:id',auth[_0x257f('0xa')](),controller[_0x257f('0xb')]);router[_0x257f('0xc')]('/',auth[_0x257f('0xa')](),controller[_0x257f('0xd')]);router[_0x257f('0xe')]('/:id',auth[_0x257f('0xa')](),controller[_0x257f('0xf')]);router[_0x257f('0x10')](_0x257f('0x11'),auth[_0x257f('0xa')](),controller[_0x257f('0x12')]);module[_0x257f('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index da72b80..ce95074 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x2b062d,_0x39488e){var _0x51ddfd=function(_0x412ab6){while(--_0x412ab6){_0x2b062d['push'](_0x2b062d['shift']());}};_0x51ddfd(++_0x39488e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xb10b[_0x4b4f24];return _0x1c13d4;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x3efe7a,_0x30aba7){var _0x121ad6=function(_0x1f0139){while(--_0x1f0139){_0x3efe7a['push'](_0x3efe7a['shift']());}};_0x121ad6(++_0x30aba7);}(_0x757a,0xde));var _0xa757=function(_0x20c724,_0x19725e){_0x20c724=_0x20c724-0x0;var _0x28a6cb=_0x757a[_0x20c724];return _0x28a6cb;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 7857fce..afbdbef 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 _0xc487=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','error','name','index','map','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','Dashboard','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','userProfileId','UserProfileResource','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','web-report','reportType','attrRefresh','stringify','addItem','DashboardId','getItems','findOne','order','options','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end'];(function(_0x230b8d,_0xc7bd){var _0x499932=function(_0x3aec13){while(--_0x3aec13){_0x230b8d['push'](_0x230b8d['shift']());}};_0x499932(++_0xc7bd);}(_0xc487,0xe2));var _0x7c48=function(_0x2c9673,_0x296ba0){_0x2c9673=_0x2c9673-0x0;var _0x49c8b0=_0xc487[_0x2c9673];return _0x49c8b0;};'use strict';var emlformat=require(_0x7c48('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c48('0x1'));var rp=require(_0x7c48('0x2'));var moment=require(_0x7c48('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7c48('0x4'));var util=require(_0x7c48('0x5'));var path=require(_0x7c48('0x6'));var sox=require('sox');var csv=require(_0x7c48('0x7'));var ejs=require(_0x7c48('0x8'));var fs=require('fs');var fs_extra=require(_0x7c48('0x9'));var _=require('lodash');var squel=require(_0x7c48('0xa'));var crypto=require(_0x7c48('0xb'));var jsforce=require(_0x7c48('0xc'));var deskjs=require(_0x7c48('0xd'));var toCsv=require(_0x7c48('0x7'));var querystring=require(_0x7c48('0xe'));var Papa=require(_0x7c48('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c48('0x10'));var as=require(_0x7c48('0x11'));var hardwareService=require(_0x7c48('0x12'));var logger=require('../../config/logger')(_0x7c48('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7c48('0x14'));var db=require(_0x7c48('0x15'))['db'];config[_0x7c48('0x16')]=_[_0x7c48('0x17')](config[_0x7c48('0x16')],{'host':_0x7c48('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c48('0x16')]));require(_0x7c48('0x19'))[_0x7c48('0x1a')](socket);function respondWithStatusCode(_0x3d212d,_0xadcccc){_0xadcccc=_0xadcccc||0xcc;return function(_0x4a3d04){if(_0x4a3d04){return _0x3d212d[_0x7c48('0x1b')](_0xadcccc);}return _0x3d212d[_0x7c48('0x1c')](_0xadcccc)[_0x7c48('0x1d')]();};}function respondWithResult(_0x555d24,_0x44d293){_0x44d293=_0x44d293||0xc8;return function(_0x174cb0){if(_0x174cb0){return _0x555d24[_0x7c48('0x1c')](_0x44d293)[_0x7c48('0x1e')](_0x174cb0);}};}function respondWithFilteredResult(_0x4dac0e,_0xa259b8){return function(_0x2aeea7){if(_0x2aeea7){var _0x109a5e=typeof _0xa259b8[_0x7c48('0x1f')]===_0x7c48('0x20')&&typeof _0xa259b8[_0x7c48('0x21')]===_0x7c48('0x20');var _0x365674=_0x2aeea7['count'];var _0x1b9165=_0x109a5e?0x0:_0xa259b8[_0x7c48('0x1f')];var _0x3a2a10=_0x109a5e?_0x2aeea7[_0x7c48('0x22')]:_0xa259b8[_0x7c48('0x1f')]+_0xa259b8[_0x7c48('0x21')];var _0xaa0d98;if(_0x3a2a10>=_0x365674){_0x3a2a10=_0x365674;_0xaa0d98=0xc8;}else{_0xaa0d98=0xce;}_0x4dac0e[_0x7c48('0x1c')](_0xaa0d98);return _0x4dac0e[_0x7c48('0x23')](_0x7c48('0x24'),_0x1b9165+'-'+_0x3a2a10+'/'+_0x365674)[_0x7c48('0x1e')](_0x2aeea7);}return null;};}function patchUpdates(_0x291e0f){return function(_0x14aad0){try{jsonpatch['apply'](_0x14aad0,_0x291e0f,!![]);}catch(_0x4e2e7e){return BPromise[_0x7c48('0x25')](_0x4e2e7e);}return _0x14aad0[_0x7c48('0x26')]();};}function saveUpdates(_0x498467,_0x4f68cb){return function(_0x4b87ae){if(_0x4b87ae){return _0x4b87ae[_0x7c48('0x27')](_0x498467)['then'](function(_0x1bd8d5){return _0x1bd8d5;});}return null;};}function removeEntity(_0x3fe201,_0x3a3490){return function(_0x352195){if(_0x352195){return _0x352195[_0x7c48('0x28')]()[_0x7c48('0x29')](function(){var _0x375f73=_0x352195[_0x7c48('0x2a')]({'plain':!![]});var _0x8dbe20='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x8dbe20,'resourceId':_0x375f73['id']}})['then'](function(){return _0x352195;});})[_0x7c48('0x29')](function(){_0x3fe201['status'](0xcc)[_0x7c48('0x1d')]();});}};}function handleEntityNotFound(_0x42696d,_0x47b368){return function(_0x1f02db){if(!_0x1f02db){_0x42696d['sendStatus'](0x194);}return _0x1f02db;};}function handleError(_0x400cbb,_0x2df3a4){_0x2df3a4=_0x2df3a4||0x1f4;return function(_0x5d4f92){logger[_0x7c48('0x2b')](_0x5d4f92['stack']);if(_0x5d4f92['name']){delete _0x5d4f92[_0x7c48('0x2c')];}_0x400cbb['status'](_0x2df3a4)['send'](_0x5d4f92);};}exports[_0x7c48('0x2d')]=function(_0x3aed6d,_0x5ecb96){var _0x5a76ed={},_0x27b729={},_0x5a559a={'count':0x0,'rows':[]};var _0x193695=_[_0x7c48('0x2e')](db['Dashboard']['rawAttributes'],function(_0x423190){return{'name':_0x423190[_0x7c48('0x2f')],'type':_0x423190[_0x7c48('0x30')][_0x7c48('0x31')]};});_0x27b729[_0x7c48('0x32')]=_['map'](_0x193695,_0x7c48('0x2c'));_0x27b729[_0x7c48('0x33')]=_['keys'](_0x3aed6d[_0x7c48('0x33')]);_0x27b729[_0x7c48('0x34')]=_['intersection'](_0x27b729[_0x7c48('0x32')],_0x27b729['query']);_0x5a76ed[_0x7c48('0x35')]=_['intersection'](_0x27b729['model'],qs[_0x7c48('0x36')](_0x3aed6d[_0x7c48('0x33')]['fields']));_0x5a76ed['attributes']=_0x5a76ed[_0x7c48('0x35')][_0x7c48('0x37')]?_0x5a76ed[_0x7c48('0x35')]:_0x27b729[_0x7c48('0x32')];if(!_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x38')](_0x7c48('0x39'))){_0x5a76ed[_0x7c48('0x21')]=qs[_0x7c48('0x21')](_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x21')]);_0x5a76ed['offset']=qs['offset'](_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x1f')]);}_0x5a76ed['order']=qs[_0x7c48('0x3a')](_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x3a')]);_0x5a76ed['where']=qs['filters'](_[_0x7c48('0x3b')](_0x3aed6d[_0x7c48('0x33')],_0x27b729['filters']),_0x193695);if(_0x3aed6d['query'][_0x7c48('0x3c')]){_0x5a76ed[_0x7c48('0x3d')]=_[_0x7c48('0x3e')](_0x5a76ed['where'],{'$or':_[_0x7c48('0x2e')](_0x193695,function(_0xee0241){if(_0xee0241[_0x7c48('0x30')]!==_0x7c48('0x3f')){var _0x1fc744={};_0x1fc744[_0xee0241[_0x7c48('0x2c')]]={'$like':'%'+_0x3aed6d[_0x7c48('0x33')][_0x7c48('0x3c')]+'%'};return _0x1fc744;}})});}_0x5a76ed=_[_0x7c48('0x3e')]({},_0x5a76ed,_0x3aed6d['options']);var _0x5da741={'where':_0x5a76ed[_0x7c48('0x3d')]};return db[_0x7c48('0x40')][_0x7c48('0x22')](_0x5da741)[_0x7c48('0x29')](function(_0x175909){_0x5a559a[_0x7c48('0x22')]=_0x175909;if(_0x3aed6d['query']['includeAll']){_0x5a76ed[_0x7c48('0x41')]=[{'all':!![]}];}return db[_0x7c48('0x40')][_0x7c48('0x42')](_0x5a76ed);})[_0x7c48('0x29')](function(_0x59e197){_0x5a559a[_0x7c48('0x43')]=_0x59e197;return _0x5a559a;})[_0x7c48('0x29')](respondWithFilteredResult(_0x5ecb96,_0x5a76ed))[_0x7c48('0x44')](handleError(_0x5ecb96,null));};exports[_0x7c48('0x45')]=function(_0x6ba6bc,_0x1a4d26){var _0x5d09e0={'raw':![],'where':{'id':_0x6ba6bc[_0x7c48('0x46')]['id']}},_0xf61b9f={};_0xf61b9f[_0x7c48('0x32')]=_[_0x7c48('0x47')](db['Dashboard'][_0x7c48('0x48')]);_0xf61b9f[_0x7c48('0x33')]=_[_0x7c48('0x47')](_0x6ba6bc[_0x7c48('0x33')]);_0xf61b9f[_0x7c48('0x34')]=_[_0x7c48('0x49')](_0xf61b9f[_0x7c48('0x32')],_0xf61b9f[_0x7c48('0x33')]);_0x5d09e0[_0x7c48('0x35')]=_[_0x7c48('0x49')](_0xf61b9f['model'],qs['fields'](_0x6ba6bc[_0x7c48('0x33')][_0x7c48('0x36')]));_0x5d09e0[_0x7c48('0x35')]=_0x5d09e0[_0x7c48('0x35')][_0x7c48('0x37')]?_0x5d09e0[_0x7c48('0x35')]:_0xf61b9f[_0x7c48('0x32')];if(_0x6ba6bc[_0x7c48('0x33')][_0x7c48('0x4a')]){_0x5d09e0['include']=[{'all':!![]}];}_0x5d09e0=_[_0x7c48('0x3e')]({},_0x5d09e0,_0x6ba6bc['options']);return db[_0x7c48('0x40')]['find'](_0x5d09e0)[_0x7c48('0x29')](handleEntityNotFound(_0x1a4d26,null))[_0x7c48('0x29')](respondWithResult(_0x1a4d26,null))[_0x7c48('0x44')](handleError(_0x1a4d26,null));};exports[_0x7c48('0x4b')]=function(_0x367e62,_0x36ce04){return db[_0x7c48('0x40')][_0x7c48('0x4b')](_0x367e62[_0x7c48('0x4c')],{})[_0x7c48('0x29')](function(_0x19b21e){var _0x3299fa=_0x367e62[_0x7c48('0x4d')]['get']({'plain':!![]});if(!_0x3299fa)throw new Error(_0x7c48('0x4e'));if(_0x3299fa[_0x7c48('0x4f')]===_0x7c48('0x4d')){var _0x17b91a=_0x19b21e['get']({'plain':!![]});var _0x505336=_0x7c48('0x50');return db[_0x7c48('0x51')][_0x7c48('0x52')]({'where':{'name':_0x505336,'userProfileId':_0x3299fa[_0x7c48('0x53')]},'raw':!![]})[_0x7c48('0x29')](function(_0xeb19b4){if(_0xeb19b4&&_0xeb19b4['autoAssociation']===0x0){return db[_0x7c48('0x54')][_0x7c48('0x4b')]({'name':_0x17b91a[_0x7c48('0x2c')],'resourceId':_0x17b91a['id'],'type':_0xeb19b4[_0x7c48('0x2c')],'sectionId':_0xeb19b4['id']},{})[_0x7c48('0x29')](function(){return _0x19b21e;});}else{return _0x19b21e;}})[_0x7c48('0x44')](function(_0x3bed84){logger[_0x7c48('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bed84);throw _0x3bed84;});}return _0x19b21e;})[_0x7c48('0x29')](respondWithResult(_0x36ce04,0xc9))[_0x7c48('0x44')](handleError(_0x36ce04,null));};exports[_0x7c48('0x55')]=function(_0x151cee,_0x4f0570){var _0x3e6368={'where':{'id':_0x151cee[_0x7c48('0x46')]['id']}},_0x244feb={};_0x244feb[_0x7c48('0x32')]=_['keys'](db[_0x7c48('0x40')][_0x7c48('0x48')]);_0x3e6368[_0x7c48('0x35')]=_[_0x7c48('0x49')](_0x244feb[_0x7c48('0x32')],qs[_0x7c48('0x36')](_0x151cee[_0x7c48('0x33')][_0x7c48('0x36')]));_0x3e6368[_0x7c48('0x35')]=_0x3e6368[_0x7c48('0x35')]['length']?_0x3e6368[_0x7c48('0x35')]:_0x244feb[_0x7c48('0x32')];if(_0x151cee[_0x7c48('0x33')][_0x7c48('0x4a')]){_0x3e6368['include']=[{'all':!![]}];}_0x3e6368=_[_0x7c48('0x3e')]({},_0x3e6368,_0x151cee['options']);return db[_0x7c48('0x40')]['find'](_0x3e6368)[_0x7c48('0x29')](handleEntityNotFound(_0x4f0570,null))['then'](function(_0x4178c3){if(_0x4178c3){var _0x312c3f=_0x4178c3['get']({'plain':!![]});_0x312c3f=qs[_0x7c48('0x56')](_0x312c3f,['id',_0x7c48('0x57'),_0x7c48('0x58')]);_0x151cee['body']=_['omit'](_0x151cee['body'],['id',_0x7c48('0x57'),'updatedAt']);return db[_0x7c48('0x40')][_0x7c48('0x4b')](_['merge'](_0x312c3f,_0x151cee[_0x7c48('0x4c')]),{'include':_0x151cee[_0x7c48('0x33')][_0x7c48('0x4a')]?[{'all':!![]}]:undefined})[_0x7c48('0x29')](function(_0x14eaac){var _0x577123=_0x151cee[_0x7c48('0x4d')][_0x7c48('0x2a')]({'plain':!![]});if(!_0x577123)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x577123[_0x7c48('0x4f')]===_0x7c48('0x4d')){var _0x147352=_0x14eaac['get']({'plain':!![]});var _0x4ba0d6=_0x7c48('0x50');return db[_0x7c48('0x51')][_0x7c48('0x52')]({'where':{'name':_0x4ba0d6,'userProfileId':_0x577123['userProfileId']},'raw':!![]})[_0x7c48('0x29')](function(_0xaba8a2){if(_0xaba8a2&&_0xaba8a2['autoAssociation']===0x0){return db[_0x7c48('0x54')][_0x7c48('0x4b')]({'name':_0x147352[_0x7c48('0x2c')],'resourceId':_0x147352['id'],'type':_0xaba8a2[_0x7c48('0x2c')],'sectionId':_0xaba8a2['id']},{})[_0x7c48('0x29')](function(){return _0x14eaac;});}else{return _0x14eaac;}})[_0x7c48('0x44')](function(_0xa47ef3){logger[_0x7c48('0x2b')](_0x7c48('0x59'),_0xa47ef3);throw _0xa47ef3;});}return _0x14eaac;});}})[_0x7c48('0x29')](respondWithResult(_0x4f0570,0xc9))[_0x7c48('0x44')](handleError(_0x4f0570,null));};exports[_0x7c48('0x27')]=function(_0x2e6255,_0x366498){if(_0x2e6255[_0x7c48('0x4c')]['id']){delete _0x2e6255[_0x7c48('0x4c')]['id'];}return db[_0x7c48('0x40')][_0x7c48('0x52')]({'where':{'id':_0x2e6255[_0x7c48('0x46')]['id']}})[_0x7c48('0x29')](handleEntityNotFound(_0x366498,null))[_0x7c48('0x29')](saveUpdates(_0x2e6255[_0x7c48('0x4c')],null))[_0x7c48('0x29')](respondWithResult(_0x366498,null))[_0x7c48('0x44')](handleError(_0x366498,null));};exports[_0x7c48('0x28')]=function(_0x56bb90,_0xbc51f8){return db[_0x7c48('0x40')][_0x7c48('0x52')]({'where':{'id':_0x56bb90[_0x7c48('0x46')]['id']}})[_0x7c48('0x29')](handleEntityNotFound(_0xbc51f8,null))[_0x7c48('0x29')](removeEntity(_0xbc51f8,null))[_0x7c48('0x44')](handleError(_0xbc51f8,null));};function widgetAttributes(_0x29899c){try{switch(_0x29899c[_0x7c48('0x30')]){case _0x7c48('0x5a'):return[{'name':_0x7c48('0x5b'),'value':_0x29899c['attrUrl']||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||'https://'}];case _0x7c48('0x5e'):return[{'name':_0x7c48('0x5f'),'value':_0x29899c['attrPath']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c['attrs'][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||''}];case _0x7c48('0x60'):return[{'name':_0x7c48('0x61'),'value':_0x29899c[_0x7c48('0x61')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||_0x7c48('0x62')},{'name':'attrTimezone','value':_0x29899c[_0x7c48('0x63')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x1]?_0x29899c[_0x7c48('0x5c')][0x1][_0x7c48('0x5d')]:undefined)||_0x7c48('0x64')},{'name':_0x7c48('0x65'),'value':_0x29899c['attrFontSize']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x2]?_0x29899c[_0x7c48('0x5c')][0x2][_0x7c48('0x5d')]:undefined)||0xc}];case _0x7c48('0x66'):return[{'name':_0x7c48('0x67'),'value':_0x29899c[_0x7c48('0x67')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||_0x7c48('0x68')},{'name':_0x7c48('0x69'),'value':_0x29899c[_0x7c48('0x69')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x1]?_0x29899c[_0x7c48('0x5c')][0x1][_0x7c48('0x5d')]:undefined)||[]},{'name':_0x7c48('0x65'),'value':_0x29899c[_0x7c48('0x65')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x2]?_0x29899c['attrs'][0x2][_0x7c48('0x5d')]:undefined)||0x14},{'name':_0x7c48('0x6a'),'value':_0x29899c[_0x7c48('0x6a')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x3]?_0x29899c['attrs'][0x3][_0x7c48('0x5d')]:undefined)||_0x7c48('0x6b')},{'name':'attrEmailAccounts','value':_0x29899c[_0x7c48('0x6c')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x4]?_0x29899c['attrs'][0x4][_0x7c48('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x29899c['attrFaxAccounts']||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x5]?_0x29899c[_0x7c48('0x5c')][0x5]['value']:undefined)||''},{'name':_0x7c48('0x6d'),'value':_0x29899c[_0x7c48('0x6d')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x6]?_0x29899c['attrs'][0x6][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x6e'),'value':_0x29899c[_0x7c48('0x6e')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c['attrs'][0x7]?_0x29899c[_0x7c48('0x5c')][0x7][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x6f'),'value':_0x29899c['attrWhatsappAccounts']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x8]?_0x29899c[_0x7c48('0x5c')][0x8][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x70'),'value':_0x29899c[_0x7c48('0x70')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x9]?_0x29899c[_0x7c48('0x5c')][0x9][_0x7c48('0x5d')]:undefined)||''}];case'multibar-chart':case _0x7c48('0x71'):return[{'name':_0x7c48('0x72'),'value':_0x29899c[_0x7c48('0x72')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||_0x7c48('0x68')},{'name':_0x7c48('0x73'),'value':_0x29899c['attrSerie2']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x1]?_0x29899c[_0x7c48('0x5c')][0x1]['value']:undefined)||null},{'name':_0x7c48('0x74'),'value':_0x29899c[_0x7c48('0x74')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x2]?_0x29899c[_0x7c48('0x5c')][0x2][_0x7c48('0x5d')]:undefined)||null},{'name':_0x7c48('0x69'),'value':_0x29899c[_0x7c48('0x69')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x3]?_0x29899c[_0x7c48('0x5c')][0x3]['value']:undefined)||[]},{'name':_0x7c48('0x6a'),'value':_0x29899c[_0x7c48('0x6a')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x4]?_0x29899c[_0x7c48('0x5c')][0x4]['value']:undefined)||_0x7c48('0x6b')},{'name':_0x7c48('0x6c'),'value':_0x29899c['attrEmailAccounts']||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x5]?_0x29899c[_0x7c48('0x5c')][0x5][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x75'),'value':_0x29899c[_0x7c48('0x75')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c['attrs'][0x6]?_0x29899c[_0x7c48('0x5c')][0x6][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x6d'),'value':_0x29899c['attrSmsAccounts']||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x7]?_0x29899c['attrs'][0x7][_0x7c48('0x5d')]:undefined)||''},{'name':_0x7c48('0x6e'),'value':_0x29899c[_0x7c48('0x6e')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x8]?_0x29899c['attrs'][0x8]['value']:undefined)||''},{'name':_0x7c48('0x6f'),'value':_0x29899c[_0x7c48('0x6f')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x9]?_0x29899c[_0x7c48('0x5c')][0x9]['value']:undefined)||''},{'name':_0x7c48('0x70'),'value':_0x29899c[_0x7c48('0x70')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0xa]?_0x29899c[_0x7c48('0x5c')][0xa]['value']:undefined)||''}];case _0x7c48('0x76'):return[{'name':'attrReport','type':_0x29899c[_0x7c48('0x77')]||(_0x29899c['attrs']&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0]['type']:undefined)||null,'value':_0x29899c['attrReport']||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x0]?_0x29899c[_0x7c48('0x5c')][0x0][_0x7c48('0x5d')]:undefined)||null},{'name':_0x7c48('0x78'),'value':_0x29899c[_0x7c48('0x78')]||(_0x29899c[_0x7c48('0x5c')]&&_0x29899c[_0x7c48('0x5c')][0x1]?_0x29899c[_0x7c48('0x5c')][0x1][_0x7c48('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0xf24063){logger[_0x7c48('0x2b')]('widgetAttributes:\x20%s',JSON[_0x7c48('0x79')](_0xf24063));return[];}}exports[_0x7c48('0x7a')]=function(_0x573e50,_0x994674,_0x574f96){if(_0x573e50['body']['id']){delete _0x573e50[_0x7c48('0x4c')]['id'];}return db[_0x7c48('0x40')]['find']({'where':{'id':_0x573e50['params']['id']}})[_0x7c48('0x29')](handleEntityNotFound(_0x994674,null))['then'](function(_0x244cae){if(_0x244cae){_0x573e50[_0x7c48('0x4c')][_0x7c48('0x7b')]=_0x244cae['id'];_0x573e50[_0x7c48('0x4c')][_0x7c48('0x5c')]=widgetAttributes(_0x573e50['body']);return db['DashboardItem'][_0x7c48('0x4b')](_0x573e50[_0x7c48('0x4c')]);}})['then'](respondWithResult(_0x994674,null))['catch'](handleError(_0x994674,null));};exports[_0x7c48('0x7c')]=function(_0x58d218,_0x30cc1f,_0x3361ee){var _0x42a8b7={};var _0x4e0404={};var _0x4abe87;var _0x4b03ad;return db['Dashboard'][_0x7c48('0x7d')]({'where':{'id':_0x58d218[_0x7c48('0x46')]['id']}})[_0x7c48('0x29')](handleEntityNotFound(_0x30cc1f,null))[_0x7c48('0x29')](function(_0x380f3a){if(_0x380f3a){_0x4abe87=_0x380f3a;_0x4e0404['model']=_[_0x7c48('0x47')](db['DashboardItem']['rawAttributes']);_0x4e0404[_0x7c48('0x33')]=_[_0x7c48('0x47')](_0x58d218[_0x7c48('0x33')]);_0x4e0404[_0x7c48('0x34')]=_['intersection'](_0x4e0404[_0x7c48('0x32')],_0x4e0404[_0x7c48('0x33')]);_0x42a8b7[_0x7c48('0x35')]=_[_0x7c48('0x49')](_0x4e0404[_0x7c48('0x32')],qs[_0x7c48('0x36')](_0x58d218['query'][_0x7c48('0x36')]));_0x42a8b7[_0x7c48('0x35')]=_0x42a8b7[_0x7c48('0x35')][_0x7c48('0x37')]?_0x42a8b7[_0x7c48('0x35')]:_0x4e0404[_0x7c48('0x32')];_0x42a8b7[_0x7c48('0x7e')]=qs['sort'](_0x58d218[_0x7c48('0x33')][_0x7c48('0x3a')]);_0x42a8b7[_0x7c48('0x3d')]=qs[_0x7c48('0x34')](_['pick'](_0x58d218[_0x7c48('0x33')],_0x4e0404[_0x7c48('0x34')]));if(_0x58d218[_0x7c48('0x33')][_0x7c48('0x3c')]){_0x42a8b7['where']=_[_0x7c48('0x3e')](_0x42a8b7['where'],{'$or':_['map'](_0x42a8b7[_0x7c48('0x35')],function(_0x20fdcf){var _0x2fb089={};_0x2fb089[_0x20fdcf]={'$like':'%'+_0x58d218[_0x7c48('0x33')][_0x7c48('0x3c')]+'%'};return _0x2fb089;})});}_0x42a8b7=_[_0x7c48('0x3e')]({},_0x42a8b7,_0x58d218[_0x7c48('0x7f')]);return _0x4abe87[_0x7c48('0x7c')](_0x42a8b7);}})[_0x7c48('0x29')](function(_0x56583d){if(_0x56583d){_0x4b03ad=_0x56583d[_0x7c48('0x37')];if(!_0x58d218[_0x7c48('0x33')][_0x7c48('0x38')](_0x7c48('0x39'))){_0x42a8b7[_0x7c48('0x21')]=qs[_0x7c48('0x21')](_0x58d218[_0x7c48('0x33')][_0x7c48('0x21')]);_0x42a8b7['offset']=qs['offset'](_0x58d218[_0x7c48('0x33')][_0x7c48('0x1f')]);}return _0x4abe87[_0x7c48('0x7c')](_0x42a8b7);}})[_0x7c48('0x29')](function(_0x3e0939){if(_0x3e0939){return _0x3e0939?{'count':_0x4b03ad,'rows':_0x3e0939}:null;}})['then'](respondWithResult(_0x30cc1f,null))[_0x7c48('0x44')](handleError(_0x30cc1f,null));}; \ No newline at end of file +var _0x455f=['save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','send','Dashboard','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','fields','options','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','map','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x5afff6,_0x3c2363){var _0x39adb1=function(_0x3768ef){while(--_0x3768ef){_0x5afff6['push'](_0x5afff6['shift']());}};_0x39adb1(++_0x3c2363);}(_0x455f,0x163));var _0xf455=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x455f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf455('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf455('0x1'));var jsonpatch=require(_0xf455('0x2'));var rp=require(_0xf455('0x3'));var moment=require(_0xf455('0x4'));var BPromise=require(_0xf455('0x5'));var Mustache=require(_0xf455('0x6'));var util=require('util');var path=require(_0xf455('0x7'));var sox=require('sox');var csv=require(_0xf455('0x8'));var ejs=require(_0xf455('0x9'));var fs=require('fs');var fs_extra=require(_0xf455('0xa'));var _=require('lodash');var squel=require(_0xf455('0xb'));var crypto=require(_0xf455('0xc'));var jsforce=require(_0xf455('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf455('0x8'));var querystring=require(_0xf455('0xe'));var Papa=require('papaparse');var Redis=require(_0xf455('0xf'));var authService=require(_0xf455('0x10'));var qs=require(_0xf455('0x11'));var as=require(_0xf455('0x12'));var hardwareService=require(_0xf455('0x13'));var logger=require(_0xf455('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf455('0x15'));var licenseUtil=require(_0xf455('0x16'));var db=require('../../mysqldb')['db'];config[_0xf455('0x17')]=_['defaults'](config[_0xf455('0x17')],{'host':_0xf455('0x18'),'port':0x18eb});var socket=require(_0xf455('0x19'))(new Redis(config[_0xf455('0x17')]));require(_0xf455('0x1a'))[_0xf455('0x1b')](socket);function respondWithStatusCode(_0x528c2b,_0x180aff){_0x180aff=_0x180aff||0xcc;return function(_0x47f17e){if(_0x47f17e){return _0x528c2b[_0xf455('0x1c')](_0x180aff);}return _0x528c2b[_0xf455('0x1d')](_0x180aff)[_0xf455('0x1e')]();};}function respondWithResult(_0x3ba692,_0x3ca505){_0x3ca505=_0x3ca505||0xc8;return function(_0x7e63ae){if(_0x7e63ae){return _0x3ba692[_0xf455('0x1d')](_0x3ca505)['json'](_0x7e63ae);}};}function respondWithFilteredResult(_0x16391e,_0x2dc6a8){return function(_0x27244d){if(_0x27244d){var _0x3f95b9=typeof _0x2dc6a8[_0xf455('0x1f')]===_0xf455('0x20')&&typeof _0x2dc6a8[_0xf455('0x21')]===_0xf455('0x20');var _0x4bbe49=_0x27244d[_0xf455('0x22')];var _0x320611=_0x3f95b9?0x0:_0x2dc6a8['offset'];var _0x421355=_0x3f95b9?_0x27244d['count']:_0x2dc6a8['offset']+_0x2dc6a8['limit'];var _0x139510;if(_0x421355>=_0x4bbe49){_0x421355=_0x4bbe49;_0x139510=0xc8;}else{_0x139510=0xce;}_0x16391e[_0xf455('0x1d')](_0x139510);return _0x16391e[_0xf455('0x23')](_0xf455('0x24'),_0x320611+'-'+_0x421355+'/'+_0x4bbe49)[_0xf455('0x25')](_0x27244d);}return null;};}function patchUpdates(_0x20a981){return function(_0x7e399e){try{jsonpatch['apply'](_0x7e399e,_0x20a981,!![]);}catch(_0x2c8bdc){return BPromise['reject'](_0x2c8bdc);}return _0x7e399e[_0xf455('0x26')]();};}function saveUpdates(_0x36001e,_0x5528b6){return function(_0x50ceef){if(_0x50ceef){return _0x50ceef[_0xf455('0x27')](_0x36001e)['then'](function(_0x21f642){return _0x21f642;});}return null;};}function removeEntity(_0x28a563,_0x790a2f){return function(_0x254df6){if(_0x254df6){return _0x254df6[_0xf455('0x28')]()[_0xf455('0x29')](function(){var _0x55b3cf=_0x254df6[_0xf455('0x2a')]({'plain':!![]});var _0x57625b=_0xf455('0x2b');return db[_0xf455('0x2c')][_0xf455('0x28')]({'where':{'type':_0x57625b,'resourceId':_0x55b3cf['id']}})['then'](function(){return _0x254df6;});})[_0xf455('0x29')](function(){_0x28a563['status'](0xcc)[_0xf455('0x1e')]();});}};}function handleEntityNotFound(_0x3fc41a,_0x22777b){return function(_0x2f4a69){if(!_0x2f4a69){_0x3fc41a[_0xf455('0x1c')](0x194);}return _0x2f4a69;};}function handleError(_0x341287,_0x18f58e){_0x18f58e=_0x18f58e||0x1f4;return function(_0x3d7cdb){logger[_0xf455('0x2d')](_0x3d7cdb[_0xf455('0x2e')]);if(_0x3d7cdb[_0xf455('0x2f')]){delete _0x3d7cdb['name'];}_0x341287[_0xf455('0x1d')](_0x18f58e)[_0xf455('0x30')](_0x3d7cdb);};}exports['index']=function(_0x16feaf,_0x1b256e){var _0x18663e={},_0x568dda={},_0x1a0ff2={'count':0x0,'rows':[]};var _0x207396=_['map'](db[_0xf455('0x31')][_0xf455('0x32')],function(_0x1c4597){return{'name':_0x1c4597[_0xf455('0x33')],'type':_0x1c4597['type']['key']};});_0x568dda[_0xf455('0x34')]=_['map'](_0x207396,_0xf455('0x2f'));_0x568dda[_0xf455('0x35')]=_[_0xf455('0x36')](_0x16feaf[_0xf455('0x35')]);_0x568dda[_0xf455('0x37')]=_[_0xf455('0x38')](_0x568dda['model'],_0x568dda['query']);_0x18663e[_0xf455('0x39')]=_[_0xf455('0x38')](_0x568dda[_0xf455('0x34')],qs['fields'](_0x16feaf[_0xf455('0x35')]['fields']));_0x18663e[_0xf455('0x39')]=_0x18663e[_0xf455('0x39')][_0xf455('0x3a')]?_0x18663e['attributes']:_0x568dda[_0xf455('0x34')];if(!_0x16feaf[_0xf455('0x35')][_0xf455('0x3b')]('nolimit')){_0x18663e[_0xf455('0x21')]=qs['limit'](_0x16feaf['query']['limit']);_0x18663e['offset']=qs['offset'](_0x16feaf[_0xf455('0x35')][_0xf455('0x1f')]);}_0x18663e['order']=qs[_0xf455('0x3c')](_0x16feaf[_0xf455('0x35')][_0xf455('0x3c')]);_0x18663e[_0xf455('0x3d')]=qs[_0xf455('0x37')](_[_0xf455('0x3e')](_0x16feaf[_0xf455('0x35')],_0x568dda[_0xf455('0x37')]),_0x207396);if(_0x16feaf[_0xf455('0x35')][_0xf455('0x3f')]){_0x18663e['where']=_['merge'](_0x18663e['where'],{'$or':_['map'](_0x207396,function(_0x26a694){if(_0x26a694[_0xf455('0x40')]!==_0xf455('0x41')){var _0x37b3c7={};_0x37b3c7[_0x26a694[_0xf455('0x2f')]]={'$like':'%'+_0x16feaf[_0xf455('0x35')][_0xf455('0x3f')]+'%'};return _0x37b3c7;}})});}_0x18663e=_[_0xf455('0x42')]({},_0x18663e,_0x16feaf['options']);var _0x41c3eb={'where':_0x18663e[_0xf455('0x3d')]};return db[_0xf455('0x31')][_0xf455('0x22')](_0x41c3eb)[_0xf455('0x29')](function(_0x4fff8b){_0x1a0ff2[_0xf455('0x22')]=_0x4fff8b;if(_0x16feaf['query'][_0xf455('0x43')]){_0x18663e[_0xf455('0x44')]=[{'all':!![]}];}return db[_0xf455('0x31')][_0xf455('0x45')](_0x18663e);})['then'](function(_0x15a5b6){_0x1a0ff2[_0xf455('0x46')]=_0x15a5b6;return _0x1a0ff2;})[_0xf455('0x29')](respondWithFilteredResult(_0x1b256e,_0x18663e))['catch'](handleError(_0x1b256e,null));};exports[_0xf455('0x47')]=function(_0xeb97ac,_0x2b7627){var _0x4ceaa7={'raw':![],'where':{'id':_0xeb97ac[_0xf455('0x48')]['id']}},_0x4583df={};_0x4583df[_0xf455('0x34')]=_['keys'](db['Dashboard'][_0xf455('0x32')]);_0x4583df['query']=_[_0xf455('0x36')](_0xeb97ac[_0xf455('0x35')]);_0x4583df['filters']=_[_0xf455('0x38')](_0x4583df[_0xf455('0x34')],_0x4583df[_0xf455('0x35')]);_0x4ceaa7[_0xf455('0x39')]=_[_0xf455('0x38')](_0x4583df[_0xf455('0x34')],qs['fields'](_0xeb97ac['query']['fields']));_0x4ceaa7['attributes']=_0x4ceaa7['attributes'][_0xf455('0x3a')]?_0x4ceaa7[_0xf455('0x39')]:_0x4583df['model'];if(_0xeb97ac[_0xf455('0x35')][_0xf455('0x43')]){_0x4ceaa7[_0xf455('0x44')]=[{'all':!![]}];}_0x4ceaa7=_[_0xf455('0x42')]({},_0x4ceaa7,_0xeb97ac['options']);return db['Dashboard'][_0xf455('0x49')](_0x4ceaa7)[_0xf455('0x29')](handleEntityNotFound(_0x2b7627,null))[_0xf455('0x29')](respondWithResult(_0x2b7627,null))[_0xf455('0x4a')](handleError(_0x2b7627,null));};exports[_0xf455('0x4b')]=function(_0x5d6a55,_0xa3af80){return db['Dashboard'][_0xf455('0x4b')](_0x5d6a55[_0xf455('0x4c')],{})['then'](function(_0x238ade){var _0x182f7a=_0x5d6a55['user']['get']({'plain':!![]});if(!_0x182f7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x182f7a[_0xf455('0x4d')]===_0xf455('0x4e')){var _0x3e505a=_0x238ade[_0xf455('0x2a')]({'plain':!![]});var _0x48bd18=_0xf455('0x2b');return db[_0xf455('0x4f')][_0xf455('0x49')]({'where':{'name':_0x48bd18,'userProfileId':_0x182f7a[_0xf455('0x50')]},'raw':!![]})[_0xf455('0x29')](function(_0x3cbf89){if(_0x3cbf89&&_0x3cbf89[_0xf455('0x51')]===0x0){return db[_0xf455('0x2c')][_0xf455('0x4b')]({'name':_0x3e505a[_0xf455('0x2f')],'resourceId':_0x3e505a['id'],'type':_0x3cbf89['name'],'sectionId':_0x3cbf89['id']},{})[_0xf455('0x29')](function(){return _0x238ade;});}else{return _0x238ade;}})[_0xf455('0x4a')](function(_0x1fd11f){logger['error'](_0xf455('0x52'),_0x1fd11f);throw _0x1fd11f;});}return _0x238ade;})[_0xf455('0x29')](respondWithResult(_0xa3af80,0xc9))[_0xf455('0x4a')](handleError(_0xa3af80,null));};exports[_0xf455('0x53')]=function(_0x38fa60,_0x2a15f2){var _0x595cb9={'where':{'id':_0x38fa60[_0xf455('0x48')]['id']}},_0x3f5f3c={};_0x3f5f3c['model']=_[_0xf455('0x36')](db[_0xf455('0x31')]['rawAttributes']);_0x595cb9['attributes']=_[_0xf455('0x38')](_0x3f5f3c['model'],qs[_0xf455('0x54')](_0x38fa60[_0xf455('0x35')][_0xf455('0x54')]));_0x595cb9['attributes']=_0x595cb9[_0xf455('0x39')][_0xf455('0x3a')]?_0x595cb9[_0xf455('0x39')]:_0x3f5f3c[_0xf455('0x34')];if(_0x38fa60[_0xf455('0x35')]['includeAll']){_0x595cb9[_0xf455('0x44')]=[{'all':!![]}];}_0x595cb9=_[_0xf455('0x42')]({},_0x595cb9,_0x38fa60[_0xf455('0x55')]);return db[_0xf455('0x31')][_0xf455('0x49')](_0x595cb9)[_0xf455('0x29')](handleEntityNotFound(_0x2a15f2,null))['then'](function(_0x5c79c3){if(_0x5c79c3){var _0xc45689=_0x5c79c3[_0xf455('0x2a')]({'plain':!![]});_0xc45689=qs[_0xf455('0x56')](_0xc45689,['id',_0xf455('0x57'),'updatedAt']);_0x38fa60[_0xf455('0x4c')]=_[_0xf455('0x56')](_0x38fa60[_0xf455('0x4c')],['id',_0xf455('0x57'),'updatedAt']);return db[_0xf455('0x31')][_0xf455('0x4b')](_[_0xf455('0x42')](_0xc45689,_0x38fa60[_0xf455('0x4c')]),{'include':_0x38fa60[_0xf455('0x35')][_0xf455('0x43')]?[{'all':!![]}]:undefined})[_0xf455('0x29')](function(_0x386eb5){var _0x2d77bf=_0x38fa60[_0xf455('0x4e')][_0xf455('0x2a')]({'plain':!![]});if(!_0x2d77bf)throw new Error(_0xf455('0x58'));if(_0x2d77bf[_0xf455('0x4d')]===_0xf455('0x4e')){var _0x1fd5bf=_0x386eb5['get']({'plain':!![]});var _0x518bac=_0xf455('0x2b');return db[_0xf455('0x4f')]['find']({'where':{'name':_0x518bac,'userProfileId':_0x2d77bf[_0xf455('0x50')]},'raw':!![]})[_0xf455('0x29')](function(_0x17e1e8){if(_0x17e1e8&&_0x17e1e8[_0xf455('0x51')]===0x0){return db[_0xf455('0x2c')][_0xf455('0x4b')]({'name':_0x1fd5bf[_0xf455('0x2f')],'resourceId':_0x1fd5bf['id'],'type':_0x17e1e8['name'],'sectionId':_0x17e1e8['id']},{})[_0xf455('0x29')](function(){return _0x386eb5;});}else{return _0x386eb5;}})['catch'](function(_0x143685){logger[_0xf455('0x2d')](_0xf455('0x52'),_0x143685);throw _0x143685;});}return _0x386eb5;});}})[_0xf455('0x29')](respondWithResult(_0x2a15f2,0xc9))[_0xf455('0x4a')](handleError(_0x2a15f2,null));};exports['update']=function(_0x35974f,_0x3a1ab2){if(_0x35974f[_0xf455('0x4c')]['id']){delete _0x35974f[_0xf455('0x4c')]['id'];}return db['Dashboard'][_0xf455('0x49')]({'where':{'id':_0x35974f[_0xf455('0x48')]['id']}})[_0xf455('0x29')](handleEntityNotFound(_0x3a1ab2,null))[_0xf455('0x29')](saveUpdates(_0x35974f[_0xf455('0x4c')],null))[_0xf455('0x29')](respondWithResult(_0x3a1ab2,null))[_0xf455('0x4a')](handleError(_0x3a1ab2,null));};exports[_0xf455('0x28')]=function(_0x35dcda,_0x503a34){return db[_0xf455('0x31')][_0xf455('0x49')]({'where':{'id':_0x35dcda[_0xf455('0x48')]['id']}})[_0xf455('0x29')](handleEntityNotFound(_0x503a34,null))['then'](removeEntity(_0x503a34,null))['catch'](handleError(_0x503a34,null));};function widgetAttributes(_0x58a5b8){try{switch(_0x58a5b8['type']){case _0xf455('0x59'):return[{'name':_0xf455('0x5a'),'value':_0x58a5b8[_0xf455('0x5a')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x0]?_0x58a5b8['attrs'][0x0][_0xf455('0x5c')]:undefined)||_0xf455('0x5d')}];case _0xf455('0x5e'):return[{'name':'attrPath','value':_0x58a5b8[_0xf455('0x5f')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8['attrs'][0x0]?_0x58a5b8[_0xf455('0x5b')][0x0][_0xf455('0x5c')]:undefined)||''}];case _0xf455('0x60'):return[{'name':_0xf455('0x61'),'value':_0x58a5b8[_0xf455('0x61')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x0]?_0x58a5b8[_0xf455('0x5b')][0x0][_0xf455('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0xf455('0x62'),'value':_0x58a5b8[_0xf455('0x62')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x1]?_0x58a5b8[_0xf455('0x5b')][0x1][_0xf455('0x5c')]:undefined)||_0xf455('0x63')},{'name':_0xf455('0x64'),'value':_0x58a5b8[_0xf455('0x64')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x2]?_0x58a5b8[_0xf455('0x5b')][0x2][_0xf455('0x5c')]:undefined)||0xc}];case _0xf455('0x65'):return[{'name':_0xf455('0x66'),'value':_0x58a5b8[_0xf455('0x66')]||(_0x58a5b8['attrs']&&_0x58a5b8[_0xf455('0x5b')][0x0]?_0x58a5b8[_0xf455('0x5b')][0x0][_0xf455('0x5c')]:undefined)||_0xf455('0x67')},{'name':'attrVoiceQueues','value':_0x58a5b8[_0xf455('0x68')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x1]?_0x58a5b8[_0xf455('0x5b')][0x1]['value']:undefined)||[]},{'name':_0xf455('0x64'),'value':_0x58a5b8[_0xf455('0x64')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x2]?_0x58a5b8['attrs'][0x2][_0xf455('0x5c')]:undefined)||0x14},{'name':_0xf455('0x69'),'value':_0x58a5b8[_0xf455('0x69')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8['attrs'][0x3]?_0x58a5b8['attrs'][0x3][_0xf455('0x5c')]:undefined)||_0xf455('0x6a')},{'name':'attrEmailAccounts','value':_0x58a5b8[_0xf455('0x6b')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x4]?_0x58a5b8[_0xf455('0x5b')][0x4][_0xf455('0x5c')]:undefined)||''},{'name':_0xf455('0x6c'),'value':_0x58a5b8[_0xf455('0x6c')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8['attrs'][0x5]?_0x58a5b8[_0xf455('0x5b')][0x5]['value']:undefined)||''},{'name':_0xf455('0x6d'),'value':_0x58a5b8[_0xf455('0x6d')]||(_0x58a5b8['attrs']&&_0x58a5b8[_0xf455('0x5b')][0x6]?_0x58a5b8[_0xf455('0x5b')][0x6][_0xf455('0x5c')]:undefined)||''},{'name':_0xf455('0x6e'),'value':_0x58a5b8[_0xf455('0x6e')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x7]?_0x58a5b8[_0xf455('0x5b')][0x7][_0xf455('0x5c')]:undefined)||''},{'name':_0xf455('0x6f'),'value':_0x58a5b8['attrWhatsappAccounts']||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8['attrs'][0x8]?_0x58a5b8['attrs'][0x8][_0xf455('0x5c')]:undefined)||''},{'name':_0xf455('0x70'),'value':_0x58a5b8[_0xf455('0x70')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x9]?_0x58a5b8[_0xf455('0x5b')][0x9][_0xf455('0x5c')]:undefined)||''}];case _0xf455('0x71'):case _0xf455('0x72'):return[{'name':_0xf455('0x73'),'value':_0x58a5b8[_0xf455('0x73')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x0]?_0x58a5b8[_0xf455('0x5b')][0x0][_0xf455('0x5c')]:undefined)||_0xf455('0x67')},{'name':'attrSerie2','value':_0x58a5b8[_0xf455('0x74')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x1]?_0x58a5b8['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x58a5b8[_0xf455('0x75')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x2]?_0x58a5b8['attrs'][0x2][_0xf455('0x5c')]:undefined)||null},{'name':_0xf455('0x68'),'value':_0x58a5b8['attrVoiceQueues']||(_0x58a5b8['attrs']&&_0x58a5b8['attrs'][0x3]?_0x58a5b8[_0xf455('0x5b')][0x3][_0xf455('0x5c')]:undefined)||[]},{'name':_0xf455('0x69'),'value':_0x58a5b8['attrChannel']||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8['attrs'][0x4]?_0x58a5b8[_0xf455('0x5b')][0x4]['value']:undefined)||_0xf455('0x6a')},{'name':_0xf455('0x6b'),'value':_0x58a5b8[_0xf455('0x6b')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x5]?_0x58a5b8['attrs'][0x5][_0xf455('0x5c')]:undefined)||''},{'name':_0xf455('0x6c'),'value':_0x58a5b8[_0xf455('0x6c')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8['attrs'][0x6]?_0x58a5b8['attrs'][0x6][_0xf455('0x5c')]:undefined)||''},{'name':_0xf455('0x6d'),'value':_0x58a5b8[_0xf455('0x6d')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8['attrs'][0x7]?_0x58a5b8[_0xf455('0x5b')][0x7]['value']:undefined)||''},{'name':_0xf455('0x6e'),'value':_0x58a5b8[_0xf455('0x6e')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8['attrs'][0x8]?_0x58a5b8[_0xf455('0x5b')][0x8][_0xf455('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x58a5b8[_0xf455('0x6f')]||(_0x58a5b8['attrs']&&_0x58a5b8[_0xf455('0x5b')][0x9]?_0x58a5b8[_0xf455('0x5b')][0x9][_0xf455('0x5c')]:undefined)||''},{'name':_0xf455('0x70'),'value':_0x58a5b8[_0xf455('0x70')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0xa]?_0x58a5b8[_0xf455('0x5b')][0xa]['value']:undefined)||''}];case _0xf455('0x76'):return[{'name':_0xf455('0x77'),'type':_0x58a5b8[_0xf455('0x78')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x0]?_0x58a5b8['attrs'][0x0]['type']:undefined)||null,'value':_0x58a5b8['attrReport']||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x0]?_0x58a5b8[_0xf455('0x5b')][0x0][_0xf455('0x5c')]:undefined)||null},{'name':_0xf455('0x79'),'value':_0x58a5b8[_0xf455('0x79')]||(_0x58a5b8[_0xf455('0x5b')]&&_0x58a5b8[_0xf455('0x5b')][0x1]?_0x58a5b8[_0xf455('0x5b')][0x1][_0xf455('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x5065c9){logger['error']('widgetAttributes:\x20%s',JSON[_0xf455('0x7a')](_0x5065c9));return[];}}exports[_0xf455('0x7b')]=function(_0x298894,_0x4cf990,_0x59b397){if(_0x298894['body']['id']){delete _0x298894[_0xf455('0x4c')]['id'];}return db[_0xf455('0x31')][_0xf455('0x49')]({'where':{'id':_0x298894[_0xf455('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cf990,null))[_0xf455('0x29')](function(_0x2a460e){if(_0x2a460e){_0x298894[_0xf455('0x4c')][_0xf455('0x7c')]=_0x2a460e['id'];_0x298894[_0xf455('0x4c')]['attrs']=widgetAttributes(_0x298894[_0xf455('0x4c')]);return db[_0xf455('0x7d')][_0xf455('0x4b')](_0x298894[_0xf455('0x4c')]);}})[_0xf455('0x29')](respondWithResult(_0x4cf990,null))[_0xf455('0x4a')](handleError(_0x4cf990,null));};exports[_0xf455('0x7e')]=function(_0x45f48e,_0x26aca6,_0x73dd7f){var _0x2526a6={};var _0x301aaa={};var _0x182a00;var _0x171c51;return db[_0xf455('0x31')][_0xf455('0x7f')]({'where':{'id':_0x45f48e[_0xf455('0x48')]['id']}})[_0xf455('0x29')](handleEntityNotFound(_0x26aca6,null))[_0xf455('0x29')](function(_0xed1cb8){if(_0xed1cb8){_0x182a00=_0xed1cb8;_0x301aaa['model']=_[_0xf455('0x36')](db[_0xf455('0x7d')][_0xf455('0x32')]);_0x301aaa[_0xf455('0x35')]=_[_0xf455('0x36')](_0x45f48e[_0xf455('0x35')]);_0x301aaa[_0xf455('0x37')]=_['intersection'](_0x301aaa[_0xf455('0x34')],_0x301aaa[_0xf455('0x35')]);_0x2526a6[_0xf455('0x39')]=_[_0xf455('0x38')](_0x301aaa[_0xf455('0x34')],qs[_0xf455('0x54')](_0x45f48e[_0xf455('0x35')][_0xf455('0x54')]));_0x2526a6[_0xf455('0x39')]=_0x2526a6[_0xf455('0x39')][_0xf455('0x3a')]?_0x2526a6[_0xf455('0x39')]:_0x301aaa[_0xf455('0x34')];_0x2526a6[_0xf455('0x80')]=qs['sort'](_0x45f48e[_0xf455('0x35')][_0xf455('0x3c')]);_0x2526a6[_0xf455('0x3d')]=qs[_0xf455('0x37')](_['pick'](_0x45f48e['query'],_0x301aaa[_0xf455('0x37')]));if(_0x45f48e[_0xf455('0x35')][_0xf455('0x3f')]){_0x2526a6[_0xf455('0x3d')]=_[_0xf455('0x42')](_0x2526a6[_0xf455('0x3d')],{'$or':_[_0xf455('0x81')](_0x2526a6[_0xf455('0x39')],function(_0x1b8547){var _0x2c6741={};_0x2c6741[_0x1b8547]={'$like':'%'+_0x45f48e[_0xf455('0x35')][_0xf455('0x3f')]+'%'};return _0x2c6741;})});}_0x2526a6=_['merge']({},_0x2526a6,_0x45f48e[_0xf455('0x55')]);return _0x182a00[_0xf455('0x7e')](_0x2526a6);}})['then'](function(_0x5d9cac){if(_0x5d9cac){_0x171c51=_0x5d9cac['length'];if(!_0x45f48e[_0xf455('0x35')][_0xf455('0x3b')](_0xf455('0x82'))){_0x2526a6['limit']=qs[_0xf455('0x21')](_0x45f48e[_0xf455('0x35')][_0xf455('0x21')]);_0x2526a6['offset']=qs[_0xf455('0x1f')](_0x45f48e[_0xf455('0x35')]['offset']);}return _0x182a00['getItems'](_0x2526a6);}})[_0xf455('0x29')](function(_0x3d30f2){if(_0x3d30f2){return _0x3d30f2?{'count':_0x171c51,'rows':_0x3d30f2}:null;}})[_0xf455('0x29')](respondWithResult(_0x26aca6,null))[_0xf455('0x4a')](handleError(_0x26aca6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 9839ae3..a7a40e0 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 _0x8d7b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','Dashboard'];(function(_0x3df93e,_0x5af13a){var _0x2d4f2a=function(_0x14c85c){while(--_0x14c85c){_0x3df93e['push'](_0x3df93e['shift']());}};_0x2d4f2a(++_0x5af13a);}(_0x8d7b,0x1e8));var _0xb8d7=function(_0x41f8ab,_0x4d1c3b){_0x41f8ab=_0x41f8ab-0x0;var _0x49602a=_0x8d7b[_0x41f8ab];return _0x49602a;};'use strict';var EventEmitter=require(_0xb8d7('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xb8d7('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb8d7('0x2')](0x0);var events={'afterCreate':_0xb8d7('0x3'),'afterUpdate':_0xb8d7('0x4'),'afterDestroy':_0xb8d7('0x5')};function emitEvent(_0x47cc97){return function(_0x41da30,_0x1191b8,_0x1cfa7b){DashboardEvents[_0xb8d7('0x6')](_0x47cc97+':'+_0x41da30['id'],_0x41da30);DashboardEvents[_0xb8d7('0x6')](_0x47cc97,_0x41da30);_0x1cfa7b(null);};}for(var e in events){if(events[_0xb8d7('0x7')](e)){var event=events[e];Dashboard[_0xb8d7('0x8')](e,emitEvent(event));}}module[_0xb8d7('0x9')]=DashboardEvents; \ No newline at end of file +var _0xf51f=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x1153fc,_0x358dec){var _0x2348b5=function(_0x1ec664){while(--_0x1ec664){_0x1153fc['push'](_0x1153fc['shift']());}};_0x2348b5(++_0x358dec);}(_0xf51f,0x19f));var _0xff51=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xf51f[_0x272638];return _0x19d027;};'use strict';var EventEmitter=require(_0xff51('0x0'));var Dashboard=require(_0xff51('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xff51('0x2')](0x0);var events={'afterCreate':_0xff51('0x3'),'afterUpdate':'update','afterDestroy':_0xff51('0x4')};function emitEvent(_0x136229){return function(_0x1a8ecb,_0x1b0cb9,_0x43dd1f){DashboardEvents[_0xff51('0x5')](_0x136229+':'+_0x1a8ecb['id'],_0x1a8ecb);DashboardEvents[_0xff51('0x5')](_0x136229,_0x1a8ecb);_0x43dd1f(null);};}for(var e in events){if(events[_0xff51('0x6')](e)){var event=events[e];Dashboard[_0xff51('0x7')](e,emitEvent(event));}}module[_0xff51('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 8639acc..d20e6bb 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 _0xf26a=['exports','define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./dashboard.attributes'];(function(_0x29872b,_0xacb79){var _0x35d599=function(_0x5bcb13){while(--_0x5bcb13){_0x29872b['push'](_0x29872b['shift']());}};_0x35d599(++_0xacb79);}(_0xf26a,0xbe));var _0xaf26=function(_0x4fc5c1,_0x496c84){_0x4fc5c1=_0x4fc5c1-0x0;var _0x3a4f09=_0xf26a[_0x4fc5c1];return _0x3a4f09;};'use strict';var _=require(_0xaf26('0x0'));var util=require(_0xaf26('0x1'));var logger=require(_0xaf26('0x2'))(_0xaf26('0x3'));var moment=require(_0xaf26('0x4'));var BPromise=require(_0xaf26('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaf26('0x6'));var attributes=require(_0xaf26('0x7'));module[_0xaf26('0x8')]=function(_0x21fe83,_0x441e9b){return _0x21fe83[_0xaf26('0x9')](_0xaf26('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cfe=['moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','util'];(function(_0x30fcd6,_0x290a7e){var _0x25531d=function(_0x30fe4f){while(--_0x30fe4f){_0x30fcd6['push'](_0x30fcd6['shift']());}};_0x25531d(++_0x290a7e);}(_0x2cfe,0x1e3));var _0xe2cf=function(_0x2d1f3d,_0x4f80d7){_0x2d1f3d=_0x2d1f3d-0x0;var _0x5bf52c=_0x2cfe[_0x2d1f3d];return _0x5bf52c;};'use strict';var _=require('lodash');var util=require(_0xe2cf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe2cf('0x1'));var BPromise=require(_0xe2cf('0x2'));var rp=require(_0xe2cf('0x3'));var fs=require('fs');var path=require(_0xe2cf('0x4'));var rimraf=require(_0xe2cf('0x5'));var config=require('../../config/environment');var attributes=require(_0xe2cf('0x6'));module[_0xe2cf('0x7')]=function(_0x4ab529,_0x76a127){return _0x4ab529[_0xe2cf('0x8')](_0xe2cf('0x9'),attributes,{'tableName':_0xe2cf('0xa'),'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 f2f59e0..8cbd172 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 _0xb23c=['defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x9489b8,_0x5293b3){var _0x372964=function(_0x41616f){while(--_0x41616f){_0x9489b8['push'](_0x9489b8['shift']());}};_0x372964(++_0x5293b3);}(_0xb23c,0xd4));var _0xcb23=function(_0x3e4f2b,_0x3a66b2){_0x3e4f2b=_0x3e4f2b-0x0;var _0x21808f=_0xb23c[_0x3e4f2b];return _0x21808f;};'use strict';var _=require(_0xcb23('0x0'));var util=require(_0xcb23('0x1'));var moment=require('moment');var BPromise=require(_0xcb23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb23('0x3'))['db'];var utils=require(_0xcb23('0x4'));var logger=require(_0xcb23('0x5'))(_0xcb23('0x6'));var config=require(_0xcb23('0x7'));var jayson=require(_0xcb23('0x8'));var client=jayson[_0xcb23('0x9')][_0xcb23('0xa')]({'port':0x232a});config[_0xcb23('0xb')]=_[_0xcb23('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcb23('0xd'))(new Redis(config[_0xcb23('0xb')]));require(_0xcb23('0xe'))[_0xcb23('0xf')](socket);function respondWithRpcPromise(_0x3e192d,_0x3d4fdf,_0x24681c){return new BPromise(function(_0x380f04,_0x88affe){return client[_0xcb23('0x10')](_0x3e192d,_0x24681c)[_0xcb23('0x11')](function(_0x289a15){logger[_0xcb23('0x12')](_0xcb23('0x13'),_0x3d4fdf,_0xcb23('0x14'));logger['debug'](_0xcb23('0x15'),_0x3d4fdf,_0xcb23('0x14'),JSON[_0xcb23('0x16')](_0x289a15));if(_0x289a15['error']){if(_0x289a15[_0xcb23('0x17')][_0xcb23('0x18')]===0x1f4){logger[_0xcb23('0x17')](_0xcb23('0x13'),_0x3d4fdf,_0x289a15[_0xcb23('0x17')][_0xcb23('0x19')]);return _0x88affe(_0x289a15['error'][_0xcb23('0x19')]);}logger[_0xcb23('0x17')](_0xcb23('0x13'),_0x3d4fdf,_0x289a15['error'][_0xcb23('0x19')]);return _0x380f04(_0x289a15[_0xcb23('0x17')][_0xcb23('0x19')]);}else{logger[_0xcb23('0x12')](_0xcb23('0x13'),_0x3d4fdf,'request\x20sent');_0x380f04(_0x289a15[_0xcb23('0x1a')][_0xcb23('0x19')]);}})[_0xcb23('0x1b')](function(_0x19712e){logger[_0xcb23('0x17')](_0xcb23('0x13'),_0x3d4fdf,_0x19712e);_0x88affe(_0x19712e);});});} \ No newline at end of file +var _0xcbba=['util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch'];(function(_0x239992,_0x35f5ac){var _0x2da54e=function(_0x217821){while(--_0x217821){_0x239992['push'](_0x239992['shift']());}};_0x2da54e(++_0x35f5ac);}(_0xcbba,0xd8));var _0xacbb=function(_0x2e7009,_0x366cbf){_0x2e7009=_0x2e7009-0x0;var _0x176595=_0xcbba[_0x2e7009];return _0x176595;};'use strict';var _=require('lodash');var util=require(_0xacbb('0x0'));var moment=require(_0xacbb('0x1'));var BPromise=require('bluebird');var rs=require(_0xacbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacbb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xacbb('0x4'))(_0xacbb('0x5'));var config=require(_0xacbb('0x6'));var jayson=require(_0xacbb('0x7'));var client=jayson[_0xacbb('0x8')][_0xacbb('0x9')]({'port':0x232a});config[_0xacbb('0xa')]=_[_0xacbb('0xb')](config[_0xacbb('0xa')],{'host':_0xacbb('0xc'),'port':0x18eb});var socket=require(_0xacbb('0xd'))(new Redis(config['redis']));require(_0xacbb('0xe'))[_0xacbb('0xf')](socket);function respondWithRpcPromise(_0x2adaee,_0xa51b8c,_0x5b3e0a){return new BPromise(function(_0x519966,_0xf0f1b9){return client[_0xacbb('0x10')](_0x2adaee,_0x5b3e0a)[_0xacbb('0x11')](function(_0x3d5e34){logger[_0xacbb('0x12')](_0xacbb('0x13'),_0xa51b8c,'request\x20sent');logger[_0xacbb('0x14')](_0xacbb('0x15'),_0xa51b8c,_0xacbb('0x16'),JSON[_0xacbb('0x17')](_0x3d5e34));if(_0x3d5e34['error']){if(_0x3d5e34['error']['code']===0x1f4){logger[_0xacbb('0x18')](_0xacbb('0x13'),_0xa51b8c,_0x3d5e34[_0xacbb('0x18')][_0xacbb('0x19')]);return _0xf0f1b9(_0x3d5e34[_0xacbb('0x18')][_0xacbb('0x19')]);}logger[_0xacbb('0x18')]('Dashboard,\x20%s,\x20%s',_0xa51b8c,_0x3d5e34[_0xacbb('0x18')][_0xacbb('0x19')]);return _0x519966(_0x3d5e34['error'][_0xacbb('0x19')]);}else{logger[_0xacbb('0x12')](_0xacbb('0x13'),_0xa51b8c,_0xacbb('0x16'));_0x519966(_0x3d5e34['result']['message']);}})[_0xacbb('0x1a')](function(_0x531c76){logger[_0xacbb('0x18')](_0xacbb('0x13'),_0xa51b8c,_0x531c76);_0xf0f1b9(_0x531c76);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index eb38f20..1288bd9 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 _0xd14e=['remove','update','emit','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x18e001,_0x174788){var _0x3fd04f=function(_0x15426d){while(--_0x15426d){_0x18e001['push'](_0x18e001['shift']());}};_0x3fd04f(++_0x174788);}(_0xd14e,0xc6));var _0xed14=function(_0x57ef17,_0x5dcab0){_0x57ef17=_0x57ef17-0x0;var _0x303547=_0xd14e[_0x57ef17];return _0x303547;};'use strict';var DashboardEvents=require(_0xed14('0x0'));var events=[_0xed14('0x1'),_0xed14('0x2'),_0xed14('0x3')];function createListener(_0x16808b,_0x5f4244){return function(_0x424f52){_0x5f4244[_0xed14('0x4')](_0x16808b,_0x424f52);};}function removeListener(_0x5872f9,_0x53e6ae){return function(){DashboardEvents[_0xed14('0x5')](_0x5872f9,_0x53e6ae);};}exports[_0xed14('0x6')]=function(_0x235766){for(var _0x5979ac=0x0,_0x7aaf53=events['length'];_0x5979ac<_0x7aaf53;_0x5979ac++){var _0x26ac11=events[_0x5979ac];var _0x397191=createListener(_0xed14('0x7')+_0x26ac11,_0x235766);DashboardEvents['on'](_0x26ac11,_0x397191);}}; \ No newline at end of file +var _0xbbf0=['length','./dashboard.events','save','remove','update','emit','register'];(function(_0x4a7a05,_0x127691){var _0xd1cc13=function(_0x2206ee){while(--_0x2206ee){_0x4a7a05['push'](_0x4a7a05['shift']());}};_0xd1cc13(++_0x127691);}(_0xbbf0,0xc5));var _0x0bbf=function(_0x40c0b0,_0x128b65){_0x40c0b0=_0x40c0b0-0x0;var _0x28aefa=_0xbbf0[_0x40c0b0];return _0x28aefa;};'use strict';var DashboardEvents=require(_0x0bbf('0x0'));var events=[_0x0bbf('0x1'),_0x0bbf('0x2'),_0x0bbf('0x3')];function createListener(_0x436b3f,_0x131946){return function(_0x4ff35a){_0x131946[_0x0bbf('0x4')](_0x436b3f,_0x4ff35a);};}function removeListener(_0x378a82,_0x39874a){return function(){DashboardEvents['removeListener'](_0x378a82,_0x39874a);};}exports[_0x0bbf('0x5')]=function(_0x52cd17){for(var _0xba10ca=0x0,_0x7c04ea=events[_0x0bbf('0x6')];_0xba10ca<_0x7c04ea;_0xba10ca++){var _0x13c95c=events[_0xba10ca];var _0x2e8f11=createListener('dashboard:'+_0x13c95c,_0x52cd17);DashboardEvents['on'](_0x13c95c,_0x2e8f11);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 4957513..ff8549c 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 _0x2963=['/:id/clone','clone','/:id','update','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','create'];(function(_0x550221,_0x14d658){var _0xc16276=function(_0x3e6c02){while(--_0x3e6c02){_0x550221['push'](_0x550221['shift']());}};_0xc16276(++_0x14d658);}(_0x2963,0xf5));var _0x3296=function(_0x6cf18,_0x27430f){_0x6cf18=_0x6cf18-0x0;var _0x5f2a77=_0x2963[_0x6cf18];return _0x5f2a77;};'use strict';var multer=require('multer');var util=require(_0x3296('0x0'));var path=require('path');var timeout=require(_0x3296('0x1'));var express=require(_0x3296('0x2'));var router=express[_0x3296('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3296('0x4'));var config=require(_0x3296('0x5'));var controller=require(_0x3296('0x6'));router[_0x3296('0x7')]('/',auth[_0x3296('0x8')](),controller[_0x3296('0x9')]);router['get']('/:id',auth[_0x3296('0x8')](),controller[_0x3296('0xa')]);router[_0x3296('0x7')](_0x3296('0xb'),auth[_0x3296('0x8')](),controller[_0x3296('0xc')]);router[_0x3296('0xd')]('/',auth[_0x3296('0x8')](),controller[_0x3296('0xe')]);router['post'](_0x3296('0xf'),auth['isAuthenticated'](),controller[_0x3296('0x10')]);router[_0x3296('0xd')](_0x3296('0xb'),auth[_0x3296('0x8')](),controller['addItem']);router['put'](_0x3296('0x11'),auth[_0x3296('0x8')](),controller[_0x3296('0x12')]);router['delete'](_0x3296('0x11'),auth[_0x3296('0x8')](),controller['destroy']);module[_0x3296('0x13')]=router; \ No newline at end of file +var _0xcdb2=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','clone','put','delete','destroy','multer'];(function(_0x4de698,_0x47f804){var _0x1dd2eb=function(_0x149f4c){while(--_0x149f4c){_0x4de698['push'](_0x4de698['shift']());}};_0x1dd2eb(++_0x47f804);}(_0xcdb2,0x117));var _0x2cdb=function(_0x4c0e18,_0x4053cf){_0x4c0e18=_0x4c0e18-0x0;var _0x2c3c5a=_0xcdb2[_0x4c0e18];return _0x2c3c5a;};'use strict';var multer=require(_0x2cdb('0x0'));var util=require(_0x2cdb('0x1'));var path=require(_0x2cdb('0x2'));var timeout=require(_0x2cdb('0x3'));var express=require(_0x2cdb('0x4'));var router=express[_0x2cdb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2cdb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2cdb('0x7'));var controller=require(_0x2cdb('0x8'));router[_0x2cdb('0x9')]('/',auth[_0x2cdb('0xa')](),controller[_0x2cdb('0xb')]);router[_0x2cdb('0x9')](_0x2cdb('0xc'),auth['isAuthenticated'](),controller[_0x2cdb('0xd')]);router[_0x2cdb('0x9')]('/:id/items',auth[_0x2cdb('0xa')](),controller[_0x2cdb('0xe')]);router['post']('/',auth[_0x2cdb('0xa')](),controller['create']);router[_0x2cdb('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0x2cdb('0x10')]);router[_0x2cdb('0xf')]('/:id/items',auth[_0x2cdb('0xa')](),controller['addItem']);router[_0x2cdb('0x11')](_0x2cdb('0xc'),auth[_0x2cdb('0xa')](),controller['update']);router[_0x2cdb('0x12')](_0x2cdb('0xc'),auth[_0x2cdb('0xa')](),controller[_0x2cdb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index dd45411..546e3c6 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 _0x524e=['exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash'];(function(_0xe91a23,_0x27f043){var _0x4d0207=function(_0x1fdb59){while(--_0x1fdb59){_0xe91a23['push'](_0xe91a23['shift']());}};_0x4d0207(++_0x27f043);}(_0x524e,0x15e));var _0xe524=function(_0x2954b3,_0x1024b7){_0x2954b3=_0x2954b3-0x0;var _0x1db341=_0x524e[_0x2954b3];return _0x1db341;};'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 +var _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x1261,0x144));var _0x1126=function(_0x4e0964,_0x4c179b){_0x4e0964=_0x4e0964-0x0;var _0x34eadf=_0x1261[_0x4e0964];return _0x34eadf;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 7c4df29..550c886 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 _0x2ef3=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./dashboardItem.socket','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','update','destroy','then','end','error','name','send','params','model','keys','rawAttributes','query','intersection','attributes','length','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body'];(function(_0x30dc1c,_0x581ecb){var _0x37099e=function(_0x28ac6c){while(--_0x28ac6c){_0x30dc1c['push'](_0x30dc1c['shift']());}};_0x37099e(++_0x581ecb);}(_0x2ef3,0xba));var _0x32ef=function(_0x14d424,_0x2ad3e4){_0x14d424=_0x14d424-0x0;var _0x329bc9=_0x2ef3[_0x14d424];return _0x329bc9;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x18')]=_['defaults'](config[_0x32ef('0x18')],{'host':_0x32ef('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x32ef('0x1a'))['register'](socket);function respondWithStatusCode(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xcc;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x1b')](_0x40a6e6);}return _0x326fce['status'](_0x40a6e6)['end']();};}function respondWithResult(_0x531e30,_0x13db1a){_0x13db1a=_0x13db1a||0xc8;return function(_0x3950e6){if(_0x3950e6){return _0x531e30[_0x32ef('0x1c')](_0x13db1a)['json'](_0x3950e6);}};}function respondWithFilteredResult(_0x5d559b,_0x1eb468){return function(_0x1a9476){if(_0x1a9476){var _0x286bfb=typeof _0x1eb468['offset']===_0x32ef('0x1d')&&typeof _0x1eb468[_0x32ef('0x1e')]==='undefined';var _0x304505=_0x1a9476[_0x32ef('0x1f')];var _0x26aff3=_0x286bfb?0x0:_0x1eb468[_0x32ef('0x20')];var _0x445cda=_0x286bfb?_0x1a9476[_0x32ef('0x1f')]:_0x1eb468['offset']+_0x1eb468[_0x32ef('0x1e')];var _0x5cc3ef;if(_0x445cda>=_0x304505){_0x445cda=_0x304505;_0x5cc3ef=0xc8;}else{_0x5cc3ef=0xce;}_0x5d559b[_0x32ef('0x1c')](_0x5cc3ef);return _0x5d559b[_0x32ef('0x21')]('Content-Range',_0x26aff3+'-'+_0x445cda+'/'+_0x304505)[_0x32ef('0x22')](_0x1a9476);}return null;};}function patchUpdates(_0x97780){return function(_0x5e8898){try{jsonpatch['apply'](_0x5e8898,_0x97780,!![]);}catch(_0x57f5e5){return BPromise[_0x32ef('0x23')](_0x57f5e5);}return _0x5e8898[_0x32ef('0x24')]();};}function saveUpdates(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x25')](_0x225feb)['then'](function(_0x51a412){return _0x51a412;});}return null;};}function removeEntity(_0x278495,_0x14d4b3){return function(_0x371540){if(_0x371540){return _0x371540[_0x32ef('0x26')]()[_0x32ef('0x27')](function(){_0x278495[_0x32ef('0x1c')](0xcc)[_0x32ef('0x28')]();});}};}function handleEntityNotFound(_0x38aed5,_0x338f19){return function(_0x2f52d7){if(!_0x2f52d7){_0x38aed5[_0x32ef('0x1b')](0x194);}return _0x2f52d7;};}function handleError(_0xba4b3f,_0x5a88a5){_0x5a88a5=_0x5a88a5||0x1f4;return function(_0xd65fde){logger[_0x32ef('0x29')](_0xd65fde['stack']);if(_0xd65fde[_0x32ef('0x2a')]){delete _0xd65fde[_0x32ef('0x2a')];}_0xba4b3f[_0x32ef('0x1c')](_0x5a88a5)[_0x32ef('0x2b')](_0xd65fde);};}exports['show']=function(_0x10e38c,_0x22bf86){var _0x31dbc3={'raw':![],'where':{'id':_0x10e38c[_0x32ef('0x2c')]['id']}},_0x2ac686={};_0x2ac686[_0x32ef('0x2d')]=_[_0x32ef('0x2e')](db['DashboardItem'][_0x32ef('0x2f')]);_0x2ac686['query']=_[_0x32ef('0x2e')](_0x10e38c[_0x32ef('0x30')]);_0x2ac686['filters']=_[_0x32ef('0x31')](_0x2ac686[_0x32ef('0x2d')],_0x2ac686[_0x32ef('0x30')]);_0x31dbc3[_0x32ef('0x32')]=_[_0x32ef('0x31')](_0x2ac686['model'],qs['fields'](_0x10e38c[_0x32ef('0x30')]['fields']));_0x31dbc3[_0x32ef('0x32')]=_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x33')]?_0x31dbc3[_0x32ef('0x32')]:_0x2ac686[_0x32ef('0x2d')];if(_0x10e38c[_0x32ef('0x30')]['includeAll']){_0x31dbc3['include']=[{'all':!![]}];}_0x31dbc3=_['merge']({},_0x31dbc3,_0x10e38c[_0x32ef('0x34')]);return db[_0x32ef('0x35')][_0x32ef('0x36')](_0x31dbc3)['then'](handleEntityNotFound(_0x22bf86,null))['then'](respondWithResult(_0x22bf86,null))[_0x32ef('0x37')](handleError(_0x22bf86,null));};exports[_0x32ef('0x26')]=function(_0x410334,_0x480348){return db['DashboardItem'][_0x32ef('0x36')]({'where':{'id':_0x410334[_0x32ef('0x2c')]['id']}})[_0x32ef('0x27')](handleEntityNotFound(_0x480348,null))[_0x32ef('0x27')](removeEntity(_0x480348,null))[_0x32ef('0x37')](handleError(_0x480348,null));};function widgetAttributes(_0x211c79){try{switch(_0x211c79[_0x32ef('0x38')]){case _0x32ef('0x39'):return[{'name':_0x32ef('0x3a'),'value':_0x211c79['attrUrl']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0]['value']:undefined)||_0x32ef('0x3c')}];case _0x32ef('0x3d'):return[{'name':_0x32ef('0x3e'),'value':_0x211c79[_0x32ef('0x3e')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||''}];case _0x32ef('0x40'):return[{'name':_0x32ef('0x41'),'value':_0x211c79[_0x32ef('0x41')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x42')},{'name':_0x32ef('0x43'),'value':_0x211c79[_0x32ef('0x43')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79['attrs'][0x1]['value']:undefined)||_0x32ef('0x44')},{'name':_0x32ef('0x45'),'value':_0x211c79[_0x32ef('0x45')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x2]?_0x211c79[_0x32ef('0x3b')][0x2][_0x32ef('0x3f')]:undefined)||0xc}];case'counter':return[{'name':_0x32ef('0x46'),'value':_0x211c79['attrMetric']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x47')},{'name':_0x32ef('0x48'),'value':_0x211c79[_0x32ef('0x48')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1]['value']:undefined)||[]},{'name':_0x32ef('0x45'),'value':_0x211c79['attrFontSize']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x2]?_0x211c79[_0x32ef('0x3b')][0x2]['value']:undefined)||0x14},{'name':_0x32ef('0x49'),'value':_0x211c79[_0x32ef('0x49')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x3]?_0x211c79[_0x32ef('0x3b')][0x3][_0x32ef('0x3f')]:undefined)||_0x32ef('0x4a')},{'name':'attrEmailAccounts','value':_0x211c79['attrEmailAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x4]?_0x211c79[_0x32ef('0x3b')][0x4][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4b'),'value':_0x211c79[_0x32ef('0x4b')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x5]?_0x211c79[_0x32ef('0x3b')][0x5][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4c'),'value':_0x211c79[_0x32ef('0x4c')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x6]?_0x211c79[_0x32ef('0x3b')][0x6][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4d'),'value':_0x211c79[_0x32ef('0x4d')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x7]?_0x211c79[_0x32ef('0x3b')][0x7][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4e'),'value':_0x211c79[_0x32ef('0x4e')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x8]?_0x211c79[_0x32ef('0x3b')][0x8][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4f'),'value':_0x211c79[_0x32ef('0x4f')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x9]?_0x211c79['attrs'][0x9]['value']:undefined)||''}];case _0x32ef('0x50'):case _0x32ef('0x51'):return[{'name':_0x32ef('0x52'),'value':_0x211c79[_0x32ef('0x52')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x47')},{'name':_0x32ef('0x53'),'value':_0x211c79[_0x32ef('0x53')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1][_0x32ef('0x3f')]:undefined)||null},{'name':_0x32ef('0x54'),'value':_0x211c79[_0x32ef('0x54')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x2]?_0x211c79[_0x32ef('0x3b')][0x2][_0x32ef('0x3f')]:undefined)||null},{'name':_0x32ef('0x48'),'value':_0x211c79['attrVoiceQueues']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x3]?_0x211c79[_0x32ef('0x3b')][0x3][_0x32ef('0x3f')]:undefined)||[]},{'name':'attrChannel','value':_0x211c79[_0x32ef('0x49')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x4]?_0x211c79[_0x32ef('0x3b')][0x4][_0x32ef('0x3f')]:undefined)||_0x32ef('0x4a')},{'name':_0x32ef('0x55'),'value':_0x211c79[_0x32ef('0x55')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x5]?_0x211c79['attrs'][0x5][_0x32ef('0x3f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x211c79['attrFaxAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x6]?_0x211c79[_0x32ef('0x3b')][0x6][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4c'),'value':_0x211c79[_0x32ef('0x4c')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x7]?_0x211c79[_0x32ef('0x3b')][0x7][_0x32ef('0x3f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x211c79['attrOpenchannelAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x8]?_0x211c79['attrs'][0x8][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4e'),'value':_0x211c79[_0x32ef('0x4e')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x9]?_0x211c79[_0x32ef('0x3b')][0x9][_0x32ef('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x211c79['attrChatWebsites']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0xa]?_0x211c79[_0x32ef('0x3b')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x32ef('0x56'),'type':_0x211c79[_0x32ef('0x57')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x38')]:undefined)||null,'value':_0x211c79[_0x32ef('0x56')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x211c79[_0x32ef('0x58')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1][_0x32ef('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x40700e){logger['error'](_0x32ef('0x59'),JSON[_0x32ef('0x5a')](_0x40700e));return[];}}exports[_0x32ef('0x5b')]=function(_0x36ed97,_0x21e930){if(_0x36ed97[_0x32ef('0x5c')]){_0x36ed97[_0x32ef('0x5c')][_0x32ef('0x3b')]=widgetAttributes(_0x36ed97[_0x32ef('0x5c')]);}return db['DashboardItem'][_0x32ef('0x5b')](_0x36ed97[_0x32ef('0x5c')],{})[_0x32ef('0x27')](respondWithResult(_0x21e930,0xc9))[_0x32ef('0x37')](handleError(_0x21e930,null));};exports[_0x32ef('0x25')]=function(_0x5ad75c,_0x47c0ed){if(_0x5ad75c[_0x32ef('0x5c')]['id']){delete _0x5ad75c[_0x32ef('0x5c')]['id'];}_0x5ad75c[_0x32ef('0x5c')][_0x32ef('0x3b')]=widgetAttributes(_0x5ad75c[_0x32ef('0x5c')]);return db['DashboardItem'][_0x32ef('0x36')]({'where':{'id':_0x5ad75c['params']['id']}})[_0x32ef('0x27')](handleEntityNotFound(_0x47c0ed,null))[_0x32ef('0x27')](saveUpdates(_0x5ad75c['body'],null))['then'](respondWithResult(_0x47c0ed,null))[_0x32ef('0x37')](handleError(_0x47c0ed,null));}; \ No newline at end of file +var _0x9c50=['params','keys','DashboardItem','rawAttributes','query','intersection','model','attributes','fields','includeAll','include','merge','options','find','type','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','value','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','stringify','create','body','catch','fast-json-patch','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name'];(function(_0xb9b453,_0x52b099){var _0x5c9dfd=function(_0x24240a){while(--_0x24240a){_0xb9b453['push'](_0xb9b453['shift']());}};_0x5c9dfd(++_0x52b099);}(_0x9c50,0xec));var _0x09c5=function(_0x31b746,_0x4d62b2){_0x31b746=_0x31b746-0x0;var _0x19d527=_0x9c50[_0x31b746];return _0x19d527;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09c5('0x0'));var rp=require('request-promise');var moment=require(_0x09c5('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x09c5('0x2'));var path=require(_0x09c5('0x3'));var sox=require('sox');var csv=require(_0x09c5('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09c5('0x5'));var _=require(_0x09c5('0x6'));var squel=require(_0x09c5('0x7'));var crypto=require('crypto');var jsforce=require(_0x09c5('0x8'));var deskjs=require(_0x09c5('0x9'));var toCsv=require(_0x09c5('0x4'));var querystring=require(_0x09c5('0xa'));var Papa=require('papaparse');var Redis=require(_0x09c5('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x09c5('0xc'));var hardwareService=require(_0x09c5('0xd'));var logger=require(_0x09c5('0xe'))(_0x09c5('0xf'));var utils=require('../../config/utils');var config=require(_0x09c5('0x10'));var licenseUtil=require(_0x09c5('0x11'));var db=require(_0x09c5('0x12'))['db'];config[_0x09c5('0x13')]=_[_0x09c5('0x14')](config[_0x09c5('0x13')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x09c5('0x13')]));require(_0x09c5('0x15'))[_0x09c5('0x16')](socket);function respondWithStatusCode(_0x380922,_0x5ac598){_0x5ac598=_0x5ac598||0xcc;return function(_0x511a4a){if(_0x511a4a){return _0x380922[_0x09c5('0x17')](_0x5ac598);}return _0x380922['status'](_0x5ac598)['end']();};}function respondWithResult(_0x5cb726,_0x2e2493){_0x2e2493=_0x2e2493||0xc8;return function(_0x41591b){if(_0x41591b){return _0x5cb726[_0x09c5('0x18')](_0x2e2493)[_0x09c5('0x19')](_0x41591b);}};}function respondWithFilteredResult(_0x2891fb,_0x34258c){return function(_0x1040b1){if(_0x1040b1){var _0x3207f2=typeof _0x34258c[_0x09c5('0x1a')]===_0x09c5('0x1b')&&typeof _0x34258c['limit']===_0x09c5('0x1b');var _0x3e6f5f=_0x1040b1[_0x09c5('0x1c')];var _0x2336fb=_0x3207f2?0x0:_0x34258c[_0x09c5('0x1a')];var _0x534abd=_0x3207f2?_0x1040b1[_0x09c5('0x1c')]:_0x34258c[_0x09c5('0x1a')]+_0x34258c[_0x09c5('0x1d')];var _0x159c94;if(_0x534abd>=_0x3e6f5f){_0x534abd=_0x3e6f5f;_0x159c94=0xc8;}else{_0x159c94=0xce;}_0x2891fb['status'](_0x159c94);return _0x2891fb['set'](_0x09c5('0x1e'),_0x2336fb+'-'+_0x534abd+'/'+_0x3e6f5f)[_0x09c5('0x19')](_0x1040b1);}return null;};}function patchUpdates(_0x32fe62){return function(_0x4afc49){try{jsonpatch[_0x09c5('0x1f')](_0x4afc49,_0x32fe62,!![]);}catch(_0xa687ac){return BPromise[_0x09c5('0x20')](_0xa687ac);}return _0x4afc49[_0x09c5('0x21')]();};}function saveUpdates(_0x5cdc52,_0x1e128e){return function(_0x47e704){if(_0x47e704){return _0x47e704[_0x09c5('0x22')](_0x5cdc52)[_0x09c5('0x23')](function(_0x356001){return _0x356001;});}return null;};}function removeEntity(_0x47430c,_0x49db0c){return function(_0x72d9be){if(_0x72d9be){return _0x72d9be[_0x09c5('0x24')]()[_0x09c5('0x23')](function(){_0x47430c['status'](0xcc)[_0x09c5('0x25')]();});}};}function handleEntityNotFound(_0x2d3f1f,_0x3aa452){return function(_0x416881){if(!_0x416881){_0x2d3f1f[_0x09c5('0x17')](0x194);}return _0x416881;};}function handleError(_0x406f32,_0x159652){_0x159652=_0x159652||0x1f4;return function(_0x53e126){logger['error'](_0x53e126[_0x09c5('0x26')]);if(_0x53e126['name']){delete _0x53e126[_0x09c5('0x27')];}_0x406f32[_0x09c5('0x18')](_0x159652)['send'](_0x53e126);};}exports['show']=function(_0x2ca501,_0x52ef10){var _0x33ab28={'raw':![],'where':{'id':_0x2ca501[_0x09c5('0x28')]['id']}},_0x172fc0={};_0x172fc0['model']=_[_0x09c5('0x29')](db[_0x09c5('0x2a')][_0x09c5('0x2b')]);_0x172fc0['query']=_['keys'](_0x2ca501[_0x09c5('0x2c')]);_0x172fc0['filters']=_[_0x09c5('0x2d')](_0x172fc0[_0x09c5('0x2e')],_0x172fc0[_0x09c5('0x2c')]);_0x33ab28[_0x09c5('0x2f')]=_[_0x09c5('0x2d')](_0x172fc0[_0x09c5('0x2e')],qs['fields'](_0x2ca501['query'][_0x09c5('0x30')]));_0x33ab28[_0x09c5('0x2f')]=_0x33ab28[_0x09c5('0x2f')]['length']?_0x33ab28[_0x09c5('0x2f')]:_0x172fc0[_0x09c5('0x2e')];if(_0x2ca501[_0x09c5('0x2c')][_0x09c5('0x31')]){_0x33ab28[_0x09c5('0x32')]=[{'all':!![]}];}_0x33ab28=_[_0x09c5('0x33')]({},_0x33ab28,_0x2ca501[_0x09c5('0x34')]);return db[_0x09c5('0x2a')][_0x09c5('0x35')](_0x33ab28)[_0x09c5('0x23')](handleEntityNotFound(_0x52ef10,null))[_0x09c5('0x23')](respondWithResult(_0x52ef10,null))['catch'](handleError(_0x52ef10,null));};exports[_0x09c5('0x24')]=function(_0x247c02,_0x3c0b1c){return db[_0x09c5('0x2a')]['find']({'where':{'id':_0x247c02[_0x09c5('0x28')]['id']}})[_0x09c5('0x23')](handleEntityNotFound(_0x3c0b1c,null))[_0x09c5('0x23')](removeEntity(_0x3c0b1c,null))['catch'](handleError(_0x3c0b1c,null));};function widgetAttributes(_0x388c3f){try{switch(_0x388c3f[_0x09c5('0x36')]){case _0x09c5('0x37'):return[{'name':_0x09c5('0x38'),'value':_0x388c3f[_0x09c5('0x38')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x0]?_0x388c3f[_0x09c5('0x39')][0x0]['value']:undefined)||_0x09c5('0x3a')}];case _0x09c5('0x3b'):return[{'name':_0x09c5('0x3c'),'value':_0x388c3f[_0x09c5('0x3c')]||(_0x388c3f['attrs']&&_0x388c3f[_0x09c5('0x39')][0x0]?_0x388c3f['attrs'][0x0]['value']:undefined)||''}];case _0x09c5('0x3d'):return[{'name':_0x09c5('0x3e'),'value':_0x388c3f['attrHourFormat']||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x0]?_0x388c3f[_0x09c5('0x39')][0x0]['value']:undefined)||_0x09c5('0x3f')},{'name':_0x09c5('0x40'),'value':_0x388c3f[_0x09c5('0x40')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x1]?_0x388c3f[_0x09c5('0x39')][0x1]['value']:undefined)||_0x09c5('0x41')},{'name':'attrFontSize','value':_0x388c3f[_0x09c5('0x42')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x2]?_0x388c3f[_0x09c5('0x39')][0x2]['value']:undefined)||0xc}];case _0x09c5('0x43'):return[{'name':_0x09c5('0x44'),'value':_0x388c3f[_0x09c5('0x44')]||(_0x388c3f['attrs']&&_0x388c3f[_0x09c5('0x39')][0x0]?_0x388c3f[_0x09c5('0x39')][0x0]['value']:undefined)||_0x09c5('0x45')},{'name':_0x09c5('0x46'),'value':_0x388c3f[_0x09c5('0x46')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f['attrs'][0x1]?_0x388c3f[_0x09c5('0x39')][0x1]['value']:undefined)||[]},{'name':_0x09c5('0x42'),'value':_0x388c3f[_0x09c5('0x42')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f['attrs'][0x2]?_0x388c3f[_0x09c5('0x39')][0x2][_0x09c5('0x47')]:undefined)||0x14},{'name':_0x09c5('0x48'),'value':_0x388c3f[_0x09c5('0x48')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f['attrs'][0x3]?_0x388c3f[_0x09c5('0x39')][0x3][_0x09c5('0x47')]:undefined)||_0x09c5('0x49')},{'name':_0x09c5('0x4a'),'value':_0x388c3f[_0x09c5('0x4a')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x4]?_0x388c3f[_0x09c5('0x39')][0x4]['value']:undefined)||''},{'name':_0x09c5('0x4b'),'value':_0x388c3f[_0x09c5('0x4b')]||(_0x388c3f['attrs']&&_0x388c3f[_0x09c5('0x39')][0x5]?_0x388c3f[_0x09c5('0x39')][0x5][_0x09c5('0x47')]:undefined)||''},{'name':_0x09c5('0x4c'),'value':_0x388c3f['attrSmsAccounts']||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x6]?_0x388c3f['attrs'][0x6][_0x09c5('0x47')]:undefined)||''},{'name':_0x09c5('0x4d'),'value':_0x388c3f[_0x09c5('0x4d')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f['attrs'][0x7]?_0x388c3f[_0x09c5('0x39')][0x7]['value']:undefined)||''},{'name':_0x09c5('0x4e'),'value':_0x388c3f[_0x09c5('0x4e')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x8]?_0x388c3f[_0x09c5('0x39')][0x8][_0x09c5('0x47')]:undefined)||''},{'name':_0x09c5('0x4f'),'value':_0x388c3f['attrChatWebsites']||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x9]?_0x388c3f[_0x09c5('0x39')][0x9][_0x09c5('0x47')]:undefined)||''}];case _0x09c5('0x50'):case'pie-chart':return[{'name':_0x09c5('0x51'),'value':_0x388c3f[_0x09c5('0x51')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x0]?_0x388c3f['attrs'][0x0][_0x09c5('0x47')]:undefined)||'total'},{'name':'attrSerie2','value':_0x388c3f[_0x09c5('0x52')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f['attrs'][0x1]?_0x388c3f[_0x09c5('0x39')][0x1][_0x09c5('0x47')]:undefined)||null},{'name':_0x09c5('0x53'),'value':_0x388c3f['attrSerie3']||(_0x388c3f['attrs']&&_0x388c3f[_0x09c5('0x39')][0x2]?_0x388c3f[_0x09c5('0x39')][0x2][_0x09c5('0x47')]:undefined)||null},{'name':_0x09c5('0x46'),'value':_0x388c3f[_0x09c5('0x46')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x3]?_0x388c3f[_0x09c5('0x39')][0x3][_0x09c5('0x47')]:undefined)||[]},{'name':'attrChannel','value':_0x388c3f['attrChannel']||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x4]?_0x388c3f[_0x09c5('0x39')][0x4][_0x09c5('0x47')]:undefined)||_0x09c5('0x49')},{'name':_0x09c5('0x4a'),'value':_0x388c3f[_0x09c5('0x4a')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x5]?_0x388c3f['attrs'][0x5][_0x09c5('0x47')]:undefined)||''},{'name':_0x09c5('0x4b'),'value':_0x388c3f[_0x09c5('0x4b')]||(_0x388c3f['attrs']&&_0x388c3f[_0x09c5('0x39')][0x6]?_0x388c3f['attrs'][0x6][_0x09c5('0x47')]:undefined)||''},{'name':_0x09c5('0x4c'),'value':_0x388c3f['attrSmsAccounts']||(_0x388c3f['attrs']&&_0x388c3f['attrs'][0x7]?_0x388c3f[_0x09c5('0x39')][0x7][_0x09c5('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x388c3f[_0x09c5('0x4d')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f['attrs'][0x8]?_0x388c3f[_0x09c5('0x39')][0x8]['value']:undefined)||''},{'name':_0x09c5('0x4e'),'value':_0x388c3f[_0x09c5('0x4e')]||(_0x388c3f['attrs']&&_0x388c3f[_0x09c5('0x39')][0x9]?_0x388c3f[_0x09c5('0x39')][0x9][_0x09c5('0x47')]:undefined)||''},{'name':_0x09c5('0x4f'),'value':_0x388c3f[_0x09c5('0x4f')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0xa]?_0x388c3f['attrs'][0xa][_0x09c5('0x47')]:undefined)||''}];case _0x09c5('0x54'):return[{'name':_0x09c5('0x55'),'type':_0x388c3f['reportType']||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x0]?_0x388c3f[_0x09c5('0x39')][0x0]['type']:undefined)||null,'value':_0x388c3f[_0x09c5('0x55')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x0]?_0x388c3f[_0x09c5('0x39')][0x0][_0x09c5('0x47')]:undefined)||null},{'name':'attrRefresh','value':_0x388c3f[_0x09c5('0x56')]||(_0x388c3f[_0x09c5('0x39')]&&_0x388c3f[_0x09c5('0x39')][0x1]?_0x388c3f[_0x09c5('0x39')][0x1][_0x09c5('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x5a79a8){logger[_0x09c5('0x57')]('widgetAttributes:\x20%s',JSON[_0x09c5('0x58')](_0x5a79a8));return[];}}exports[_0x09c5('0x59')]=function(_0x15a1d2,_0x3f7944){if(_0x15a1d2[_0x09c5('0x5a')]){_0x15a1d2[_0x09c5('0x5a')]['attrs']=widgetAttributes(_0x15a1d2[_0x09c5('0x5a')]);}return db[_0x09c5('0x2a')][_0x09c5('0x59')](_0x15a1d2['body'],{})['then'](respondWithResult(_0x3f7944,0xc9))[_0x09c5('0x5b')](handleError(_0x3f7944,null));};exports[_0x09c5('0x22')]=function(_0x49148e,_0x5e6b45){if(_0x49148e[_0x09c5('0x5a')]['id']){delete _0x49148e[_0x09c5('0x5a')]['id'];}_0x49148e[_0x09c5('0x5a')][_0x09c5('0x39')]=widgetAttributes(_0x49148e['body']);return db[_0x09c5('0x2a')]['find']({'where':{'id':_0x49148e[_0x09c5('0x28')]['id']}})['then'](handleEntityNotFound(_0x5e6b45,null))['then'](saveUpdates(_0x49148e[_0x09c5('0x5a')],null))[_0x09c5('0x23')](respondWithResult(_0x5e6b45,null))[_0x09c5('0x5b')](handleError(_0x5e6b45,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index c9eefa6..0913c7c 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 _0x554e=['hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x1092be,_0x2e846c){var _0x55a287=function(_0x29d4b4){while(--_0x29d4b4){_0x1092be['push'](_0x1092be['shift']());}};_0x55a287(++_0x2e846c);}(_0x554e,0xb6));var _0xe554=function(_0x590649,_0x28f93d){_0x590649=_0x590649-0x0;var _0x4e1806=_0x554e[_0x590649];return _0x4e1806;};'use strict';var EventEmitter=require(_0xe554('0x0'));var DashboardItem=require(_0xe554('0x1'))['db'][_0xe554('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe554('0x3')](0x0);var events={'afterCreate':_0xe554('0x4'),'afterUpdate':_0xe554('0x5'),'afterDestroy':_0xe554('0x6')};function emitEvent(_0xe1c760){return function(_0x1d2962,_0xf9d08c,_0x5075f4){DashboardItemEvents[_0xe554('0x7')](_0xe1c760+':'+_0x1d2962['id'],_0x1d2962);DashboardItemEvents[_0xe554('0x7')](_0xe1c760,_0x1d2962);_0x5075f4(null);};}for(var e in events){if(events[_0xe554('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xe554('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xe23a=['DashboardItem','save','update','emit','exports','events','../../mysqldb'];(function(_0x1bbead,_0x459bd6){var _0x1ff51f=function(_0x115fb1){while(--_0x115fb1){_0x1bbead['push'](_0x1bbead['shift']());}};_0x1ff51f(++_0x459bd6);}(_0xe23a,0xf3));var _0xae23=function(_0x4b3e49,_0x9e566c){_0x4b3e49=_0x4b3e49-0x0;var _0x57e339=_0xe23a[_0x4b3e49];return _0x57e339;};'use strict';var EventEmitter=require(_0xae23('0x0'));var DashboardItem=require(_0xae23('0x1'))['db'][_0xae23('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae23('0x3'),'afterUpdate':_0xae23('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ef955){return function(_0x568de8,_0x345445,_0x54ae3c){DashboardItemEvents[_0xae23('0x5')](_0x4ef955+':'+_0x568de8['id'],_0x568de8);DashboardItemEvents[_0xae23('0x5')](_0x4ef955,_0x568de8);_0x54ae3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xae23('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 49cb52b..b3c3978 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 _0xf21d=['path','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2628de,_0x1380a5){var _0x2c11de=function(_0x56e382){while(--_0x56e382){_0x2628de['push'](_0x2628de['shift']());}};_0x2c11de(++_0x1380a5);}(_0xf21d,0xe1));var _0xdf21=function(_0x36c650,_0x89f2ca){_0x36c650=_0x36c650-0x0;var _0x2e5aa4=_0xf21d[_0x36c650];return _0x2e5aa4;};'use strict';var _=require(_0xdf21('0x0'));var util=require('util');var logger=require(_0xdf21('0x1'))(_0xdf21('0x2'));var moment=require(_0xdf21('0x3'));var BPromise=require(_0xdf21('0x4'));var rp=require(_0xdf21('0x5'));var fs=require('fs');var path=require(_0xdf21('0x6'));var rimraf=require('rimraf');var config=require(_0xdf21('0x7'));var attributes=require(_0xdf21('0x8'));module['exports']=function(_0x53fa12,_0x520b85){return _0x53fa12[_0xdf21('0x9')](_0xdf21('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c60=['moment','bluebird','request-promise','path','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x591621,_0x119ddb){var _0x156a27=function(_0x40292a){while(--_0x40292a){_0x591621['push'](_0x591621['shift']());}};_0x156a27(++_0x119ddb);}(_0x7c60,0xad));var _0x07c6=function(_0x6ab9a,_0x2ffdcc){_0x6ab9a=_0x6ab9a-0x0;var _0x4fd80f=_0x7c60[_0x6ab9a];return _0x4fd80f;};'use strict';var _=require(_0x07c6('0x0'));var util=require(_0x07c6('0x1'));var logger=require(_0x07c6('0x2'))('api');var moment=require(_0x07c6('0x3'));var BPromise=require(_0x07c6('0x4'));var rp=require(_0x07c6('0x5'));var fs=require('fs');var path=require(_0x07c6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x07c6('0x7')]=function(_0x17e0b3,_0x517f2b){return _0x17e0b3[_0x07c6('0x8')](_0x07c6('0x9'),attributes,{'tableName':_0x07c6('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 3365c88..8b7fe96 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 _0x90e5=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','client','http','redis','localhost','register','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x90e5,0x86));var _0x590e=function(_0xd53fe6,_0x418e66){_0xd53fe6=_0xd53fe6-0x0;var _0x2a581b=_0x90e5[_0xd53fe6];return _0x2a581b;};'use strict';var _=require(_0x590e('0x0'));var util=require(_0x590e('0x1'));var moment=require(_0x590e('0x2'));var BPromise=require(_0x590e('0x3'));var rs=require(_0x590e('0x4'));var fs=require('fs');var Redis=require(_0x590e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x590e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x590e('0x7')][_0x590e('0x8')]({'port':0x232a});config[_0x590e('0x9')]=_['defaults'](config[_0x590e('0x9')],{'host':_0x590e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x590e('0x9')]));require('./dashboardItem.socket')[_0x590e('0xb')](socket);function respondWithRpcPromise(_0x383f74,_0x481ff3,_0x3d4ad5){return new BPromise(function(_0x615619,_0x58abed){return client[_0x590e('0xc')](_0x383f74,_0x3d4ad5)[_0x590e('0xd')](function(_0x2bdc28){logger[_0x590e('0xe')](_0x590e('0xf'),_0x481ff3,'request\x20sent');logger[_0x590e('0x10')](_0x590e('0x11'),_0x481ff3,_0x590e('0x12'),JSON[_0x590e('0x13')](_0x2bdc28));if(_0x2bdc28['error']){if(_0x2bdc28[_0x590e('0x14')][_0x590e('0x15')]===0x1f4){logger[_0x590e('0x14')](_0x590e('0xf'),_0x481ff3,_0x2bdc28[_0x590e('0x14')][_0x590e('0x16')]);return _0x58abed(_0x2bdc28[_0x590e('0x14')][_0x590e('0x16')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x481ff3,_0x2bdc28[_0x590e('0x14')][_0x590e('0x16')]);return _0x615619(_0x2bdc28[_0x590e('0x14')][_0x590e('0x16')]);}else{logger[_0x590e('0xe')](_0x590e('0xf'),_0x481ff3,_0x590e('0x12'));_0x615619(_0x2bdc28[_0x590e('0x17')][_0x590e('0x16')]);}})[_0x590e('0x18')](function(_0x4bf3f9){logger[_0x590e('0x14')](_0x590e('0xf'),_0x481ff3,_0x4bf3f9);_0x58abed(_0x4bf3f9);});});} \ No newline at end of file +var _0x9ceb=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','info','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x32565f,_0x24510b){var _0x23a966=function(_0x1006bc){while(--_0x1006bc){_0x32565f['push'](_0x32565f['shift']());}};_0x23a966(++_0x24510b);}(_0x9ceb,0x117));var _0xb9ce=function(_0x5803e8,_0x5dddc8){_0x5803e8=_0x5803e8-0x0;var _0x2d8f16=_0x9ceb[_0x5803e8];return _0x2d8f16;};'use strict';var _=require(_0xb9ce('0x0'));var util=require(_0xb9ce('0x1'));var moment=require(_0xb9ce('0x2'));var BPromise=require(_0xb9ce('0x3'));var rs=require(_0xb9ce('0x4'));var fs=require('fs');var Redis=require(_0xb9ce('0x5'));var db=require(_0xb9ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9ce('0x7'))(_0xb9ce('0x8'));var config=require(_0xb9ce('0x9'));var jayson=require(_0xb9ce('0xa'));var client=jayson[_0xb9ce('0xb')]['http']({'port':0x232a});config[_0xb9ce('0xc')]=_['defaults'](config[_0xb9ce('0xc')],{'host':_0xb9ce('0xd'),'port':0x18eb});var socket=require(_0xb9ce('0xe'))(new Redis(config[_0xb9ce('0xc')]));require(_0xb9ce('0xf'))['register'](socket);function respondWithRpcPromise(_0x5e5a6a,_0x47bffa,_0x2dab1c){return new BPromise(function(_0x2d4023,_0x599cec){return client[_0xb9ce('0x10')](_0x5e5a6a,_0x2dab1c)['then'](function(_0x2ed2aa){logger[_0xb9ce('0x11')]('DashboardItem,\x20%s,\x20%s',_0x47bffa,_0xb9ce('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x47bffa,_0xb9ce('0x12'),JSON[_0xb9ce('0x13')](_0x2ed2aa));if(_0x2ed2aa['error']){if(_0x2ed2aa[_0xb9ce('0x14')][_0xb9ce('0x15')]===0x1f4){logger[_0xb9ce('0x14')](_0xb9ce('0x16'),_0x47bffa,_0x2ed2aa[_0xb9ce('0x14')]['message']);return _0x599cec(_0x2ed2aa['error']['message']);}logger[_0xb9ce('0x14')](_0xb9ce('0x16'),_0x47bffa,_0x2ed2aa[_0xb9ce('0x14')][_0xb9ce('0x17')]);return _0x2d4023(_0x2ed2aa[_0xb9ce('0x14')][_0xb9ce('0x17')]);}else{logger[_0xb9ce('0x11')](_0xb9ce('0x16'),_0x47bffa,_0xb9ce('0x12'));_0x2d4023(_0x2ed2aa[_0xb9ce('0x18')][_0xb9ce('0x17')]);}})[_0xb9ce('0x19')](function(_0x4b5fd2){logger[_0xb9ce('0x14')]('DashboardItem,\x20%s,\x20%s',_0x47bffa,_0x4b5fd2);_0x599cec(_0x4b5fd2);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4ef6ca0..23325d5 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 _0x8a55=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x23f063,_0x40bc29){var _0xf633b3=function(_0x3cd66f){while(--_0x3cd66f){_0x23f063['push'](_0x23f063['shift']());}};_0xf633b3(++_0x40bc29);}(_0x8a55,0x1a8));var _0x58a5=function(_0x4c54a1,_0x752170){_0x4c54a1=_0x4c54a1-0x0;var _0x59115a=_0x8a55[_0x4c54a1];return _0x59115a;};'use strict';var DashboardItemEvents=require(_0x58a5('0x0'));var events=[_0x58a5('0x1'),'remove',_0x58a5('0x2')];function createListener(_0x48210e,_0x2bd1f4){return function(_0x23c498){_0x2bd1f4['emit'](_0x48210e,_0x23c498);};}function removeListener(_0x3361cf,_0x197d18){return function(){DashboardItemEvents[_0x58a5('0x3')](_0x3361cf,_0x197d18);};}exports[_0x58a5('0x4')]=function(_0x992ff2){for(var _0x2fc88f=0x0,_0x8a0a50=events[_0x58a5('0x5')];_0x2fc88f<_0x8a0a50;_0x2fc88f++){var _0x2b1238=events[_0x2fc88f];var _0x4e1c23=createListener(_0x58a5('0x6')+_0x2b1238,_0x992ff2);DashboardItemEvents['on'](_0x2b1238,_0x4e1c23);}}; \ No newline at end of file +var _0xb8f8=['remove','update','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8f8,0x94));var _0x8b8f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb8f8[_0x1cc8fe];return _0x230054;};'use strict';var DashboardItemEvents=require(_0x8b8f('0x0'));var events=[_0x8b8f('0x1'),_0x8b8f('0x2'),_0x8b8f('0x3')];function createListener(_0x5e35d3,_0x5810d9){return function(_0x4ee326){_0x5810d9['emit'](_0x5e35d3,_0x4ee326);};}function removeListener(_0x496580,_0x4947b1){return function(){DashboardItemEvents['removeListener'](_0x496580,_0x4947b1);};}exports['register']=function(_0x2d7d88){for(var _0x510ccd=0x0,_0x4752e3=events[_0x8b8f('0x4')];_0x510ccd<_0x4752e3;_0x510ccd++){var _0x5e4ed2=events[_0x510ccd];var _0x280bd6=createListener(_0x8b8f('0x5')+_0x5e4ed2,_0x2d7d88);DashboardItemEvents['on'](_0x5e4ed2,_0x280bd6);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 2cb846e..fc13ff7 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 _0x5f80=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util'];(function(_0x44a76f,_0x367226){var _0x3325df=function(_0x36239c){while(--_0x36239c){_0x44a76f['push'](_0x44a76f['shift']());}};_0x3325df(++_0x367226);}(_0x5f80,0x168));var _0x05f8=function(_0x59b2b5,_0x55c20a){_0x59b2b5=_0x59b2b5-0x0;var _0x658e36=_0x5f80[_0x59b2b5];return _0x658e36;};'use strict';var multer=require('multer');var util=require(_0x05f8('0x0'));var path=require(_0x05f8('0x1'));var timeout=require(_0x05f8('0x2'));var express=require(_0x05f8('0x3'));var router=express[_0x05f8('0x4')]();var fs_extra=require(_0x05f8('0x5'));var auth=require(_0x05f8('0x6'));var interaction=require(_0x05f8('0x7'));var config=require(_0x05f8('0x8'));var controller=require('./dashboardItem.controller');router[_0x05f8('0x9')](_0x05f8('0xa'),auth[_0x05f8('0xb')](),controller[_0x05f8('0xc')]);router[_0x05f8('0xd')]('/',auth[_0x05f8('0xb')](),controller[_0x05f8('0xe')]);router[_0x05f8('0xf')](_0x05f8('0xa'),auth[_0x05f8('0xb')](),controller[_0x05f8('0x10')]);router[_0x05f8('0x11')](_0x05f8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x05f8('0x12')]=router; \ No newline at end of file +var _0x17ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x5265fa,_0x7bb4d5){var _0x529a5d=function(_0x315611){while(--_0x315611){_0x5265fa['push'](_0x5265fa['shift']());}};_0x529a5d(++_0x7bb4d5);}(_0x17ab,0xbf));var _0xb17a=function(_0x46a354,_0x5d55de){_0x46a354=_0x46a354-0x0;var _0x5e4d0c=_0x17ab[_0x46a354];return _0x5e4d0c;};'use strict';var multer=require(_0xb17a('0x0'));var util=require('util');var path=require(_0xb17a('0x1'));var timeout=require(_0xb17a('0x2'));var express=require(_0xb17a('0x3'));var router=express[_0xb17a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb17a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb17a('0x6'));var controller=require('./dashboardItem.controller');router[_0xb17a('0x7')](_0xb17a('0x8'),auth[_0xb17a('0x9')](),controller[_0xb17a('0xa')]);router[_0xb17a('0xb')]('/',auth[_0xb17a('0x9')](),controller[_0xb17a('0xc')]);router[_0xb17a('0xd')](_0xb17a('0x8'),auth['isAuthenticated'](),controller[_0xb17a('0xe')]);router[_0xb17a('0xf')](_0xb17a('0x8'),auth[_0xb17a('0x9')](),controller[_0xb17a('0x10')]);module[_0xb17a('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 6a8a608..df03fd6 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 _0x041c=['third','sequelize','exports','STRING','ENUM','first'];(function(_0x254c9e,_0x20ae9b){var _0x112ff6=function(_0x34005b){while(--_0x34005b){_0x254c9e['push'](_0x254c9e['shift']());}};_0x112ff6(++_0x20ae9b);}(_0x041c,0x139));var _0xc041=function(_0x46d4a8,_0x292d53){_0x46d4a8=_0x46d4a8-0x0;var _0x1e323f=_0x041c[_0x46d4a8];return _0x1e323f;};'use strict';var Sequelize=require(_0xc041('0x0'));module[_0xc041('0x1')]={'name':{'type':Sequelize[_0xc041('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc041('0x3')](_0xc041('0x4'),'second',_0xc041('0x5')),'allowNull':![],'defaultValue':_0xc041('0x4')},'description':{'type':Sequelize[_0xc041('0x2')]}}; \ No newline at end of file +var _0x63fc=['second','third','sequelize','exports','STRING','first'];(function(_0x556a58,_0x3d3f1b){var _0x3d8ffa=function(_0x1aa0b4){while(--_0x1aa0b4){_0x556a58['push'](_0x556a58['shift']());}};_0x3d8ffa(++_0x3d3f1b);}(_0x63fc,0x1d0));var _0xc63f=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x63fc[_0x1a9204];return _0x17ca68;};'use strict';var Sequelize=require(_0xc63f('0x0'));module[_0xc63f('0x1')]={'name':{'type':Sequelize[_0xc63f('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xc63f('0x3'),_0xc63f('0x4'),_0xc63f('0x5')),'allowNull':![],'defaultValue':_0xc63f('0x3')},'description':{'type':Sequelize[_0xc63f('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 0928958..101a63f 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 _0x92f4=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','name','index','map','Disposition','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','catch','params','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x423f5b,_0x14717b){var _0x12ddc5=function(_0x5d0ed9){while(--_0x5d0ed9){_0x423f5b['push'](_0x423f5b['shift']());}};_0x12ddc5(++_0x14717b);}(_0x92f4,0x10f));var _0x492f=function(_0x1e744a,_0xa8fdb1){_0x1e744a=_0x1e744a-0x0;var _0x1ac4d0=_0x92f4[_0x1e744a];return _0x1ac4d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x492f('0x0'));var zipdir=require(_0x492f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x492f('0x2'));var moment=require(_0x492f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x492f('0x4'));var util=require('util');var path=require(_0x492f('0x5'));var sox=require(_0x492f('0x6'));var csv=require(_0x492f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x492f('0x8'));var squel=require(_0x492f('0x9'));var crypto=require(_0x492f('0xa'));var jsforce=require(_0x492f('0xb'));var deskjs=require(_0x492f('0xc'));var toCsv=require(_0x492f('0x7'));var querystring=require(_0x492f('0xd'));var Papa=require(_0x492f('0xe'));var Redis=require('ioredis');var authService=require(_0x492f('0xf'));var qs=require(_0x492f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x492f('0x11'))(_0x492f('0x12'));var utils=require('../../config/utils');var config=require(_0x492f('0x13'));var licenseUtil=require(_0x492f('0x14'));var db=require(_0x492f('0x15'))['db'];function respondWithStatusCode(_0x3ef643,_0x40390d){_0x40390d=_0x40390d||0xcc;return function(_0x17f9a5){if(_0x17f9a5){return _0x3ef643[_0x492f('0x16')](_0x40390d);}return _0x3ef643[_0x492f('0x17')](_0x40390d)['end']();};}function respondWithResult(_0x5beeac,_0x183521){_0x183521=_0x183521||0xc8;return function(_0x5464db){if(_0x5464db){return _0x5beeac[_0x492f('0x17')](_0x183521)['json'](_0x5464db);}};}function respondWithFilteredResult(_0x2e4981,_0x5c13b9){return function(_0x11edc7){if(_0x11edc7){var _0xa52f71=typeof _0x5c13b9[_0x492f('0x18')]===_0x492f('0x19')&&typeof _0x5c13b9[_0x492f('0x1a')]===_0x492f('0x19');var _0x2a067e=_0x11edc7[_0x492f('0x1b')];var _0x185457=_0xa52f71?0x0:_0x5c13b9[_0x492f('0x18')];var _0x19804d=_0xa52f71?_0x11edc7[_0x492f('0x1b')]:_0x5c13b9[_0x492f('0x18')]+_0x5c13b9[_0x492f('0x1a')];var _0x21b8fa;if(_0x19804d>=_0x2a067e){_0x19804d=_0x2a067e;_0x21b8fa=0xc8;}else{_0x21b8fa=0xce;}_0x2e4981[_0x492f('0x17')](_0x21b8fa);return _0x2e4981[_0x492f('0x1c')](_0x492f('0x1d'),_0x185457+'-'+_0x19804d+'/'+_0x2a067e)[_0x492f('0x1e')](_0x11edc7);}return null;};}function patchUpdates(_0x1cc6cf){return function(_0x1e78b4){try{jsonpatch[_0x492f('0x1f')](_0x1e78b4,_0x1cc6cf,!![]);}catch(_0x214367){return BPromise[_0x492f('0x20')](_0x214367);}return _0x1e78b4['save']();};}function saveUpdates(_0xdd5579,_0x3f505e){return function(_0x1a1b87){if(_0x1a1b87){return _0x1a1b87[_0x492f('0x21')](_0xdd5579)[_0x492f('0x22')](function(_0xfb5c6e){return _0xfb5c6e;});}return null;};}function removeEntity(_0x467a00,_0x3d7f80){return function(_0x19fbf3){if(_0x19fbf3){return _0x19fbf3[_0x492f('0x23')]()[_0x492f('0x22')](function(){var _0x181763=_0x19fbf3[_0x492f('0x24')]({'plain':!![]});var _0x42af7a='Dispositions';return db[_0x492f('0x25')]['destroy']({'where':{'type':_0x42af7a,'resourceId':_0x181763['id']}})[_0x492f('0x22')](function(){return _0x19fbf3;});})['then'](function(){_0x467a00[_0x492f('0x17')](0xcc)[_0x492f('0x26')]();});}};}function handleEntityNotFound(_0x2a4f07,_0x2dcef5){return function(_0x1539fa){if(!_0x1539fa){_0x2a4f07['sendStatus'](0x194);}return _0x1539fa;};}function handleError(_0xc51d6d,_0x3b0abb){_0x3b0abb=_0x3b0abb||0x1f4;return function(_0x269842){logger[_0x492f('0x27')](_0x269842['stack']);if(_0x269842[_0x492f('0x28')]){delete _0x269842[_0x492f('0x28')];}_0xc51d6d['status'](_0x3b0abb)['send'](_0x269842);};}exports[_0x492f('0x29')]=function(_0x53856c,_0x5bd1bc){var _0x2ec2be={},_0x66f0a0={},_0x58872a={'count':0x0,'rows':[]};var _0x199753=_[_0x492f('0x2a')](db[_0x492f('0x2b')][_0x492f('0x2c')],function(_0xba5bb2){return{'name':_0xba5bb2['fieldName'],'type':_0xba5bb2[_0x492f('0x2d')]['key']};});_0x66f0a0[_0x492f('0x2e')]=_[_0x492f('0x2a')](_0x199753,_0x492f('0x28'));_0x66f0a0[_0x492f('0x2f')]=_[_0x492f('0x30')](_0x53856c[_0x492f('0x2f')]);_0x66f0a0[_0x492f('0x31')]=_[_0x492f('0x32')](_0x66f0a0[_0x492f('0x2e')],_0x66f0a0[_0x492f('0x2f')]);_0x2ec2be[_0x492f('0x33')]=_[_0x492f('0x32')](_0x66f0a0['model'],qs[_0x492f('0x34')](_0x53856c['query'][_0x492f('0x34')]));_0x2ec2be[_0x492f('0x33')]=_0x2ec2be['attributes']['length']?_0x2ec2be[_0x492f('0x33')]:_0x66f0a0[_0x492f('0x2e')];if(!_0x53856c['query'][_0x492f('0x35')](_0x492f('0x36'))){_0x2ec2be[_0x492f('0x1a')]=qs['limit'](_0x53856c[_0x492f('0x2f')][_0x492f('0x1a')]);_0x2ec2be[_0x492f('0x18')]=qs['offset'](_0x53856c[_0x492f('0x2f')][_0x492f('0x18')]);}_0x2ec2be['order']=qs[_0x492f('0x37')](_0x53856c['query'][_0x492f('0x37')]);_0x2ec2be[_0x492f('0x38')]=qs['filters'](_[_0x492f('0x39')](_0x53856c[_0x492f('0x2f')],_0x66f0a0[_0x492f('0x31')]),_0x199753);if(_0x53856c[_0x492f('0x2f')][_0x492f('0x3a')]){_0x2ec2be[_0x492f('0x38')]=_[_0x492f('0x3b')](_0x2ec2be[_0x492f('0x38')],{'$or':_[_0x492f('0x2a')](_0x199753,function(_0x5989ab){if(_0x5989ab[_0x492f('0x2d')]!=='VIRTUAL'){var _0x3e0bab={};_0x3e0bab[_0x5989ab[_0x492f('0x28')]]={'$like':'%'+_0x53856c[_0x492f('0x2f')][_0x492f('0x3a')]+'%'};return _0x3e0bab;}})});}_0x2ec2be=_[_0x492f('0x3b')]({},_0x2ec2be,_0x53856c[_0x492f('0x3c')]);var _0x86dc9e={'where':_0x2ec2be['where']};return db[_0x492f('0x2b')]['count'](_0x86dc9e)[_0x492f('0x22')](function(_0x4632d3){_0x58872a['count']=_0x4632d3;if(_0x53856c[_0x492f('0x2f')]['includeAll']){_0x2ec2be['include']=[{'all':!![]}];}return db[_0x492f('0x2b')]['findAll'](_0x2ec2be);})[_0x492f('0x22')](function(_0x5d8418){_0x58872a['rows']=_0x5d8418;return _0x58872a;})['then'](respondWithFilteredResult(_0x5bd1bc,_0x2ec2be))['catch'](handleError(_0x5bd1bc,null));};exports['show']=function(_0x54e597,_0xdf8c7b){var _0xc030ea={'raw':!![],'where':{'id':_0x54e597['params']['id']}},_0x4acdd2={};_0x4acdd2[_0x492f('0x2e')]=_[_0x492f('0x30')](db[_0x492f('0x2b')][_0x492f('0x2c')]);_0x4acdd2[_0x492f('0x2f')]=_[_0x492f('0x30')](_0x54e597[_0x492f('0x2f')]);_0x4acdd2[_0x492f('0x31')]=_[_0x492f('0x32')](_0x4acdd2['model'],_0x4acdd2[_0x492f('0x2f')]);_0xc030ea[_0x492f('0x33')]=_[_0x492f('0x32')](_0x4acdd2['model'],qs[_0x492f('0x34')](_0x54e597['query']['fields']));_0xc030ea[_0x492f('0x33')]=_0xc030ea[_0x492f('0x33')]['length']?_0xc030ea[_0x492f('0x33')]:_0x4acdd2[_0x492f('0x2e')];if(_0x54e597[_0x492f('0x2f')][_0x492f('0x3d')]){_0xc030ea[_0x492f('0x3e')]=[{'all':!![]}];}_0xc030ea=_['merge']({},_0xc030ea,_0x54e597['options']);return db['Disposition'][_0x492f('0x3f')](_0xc030ea)['then'](handleEntityNotFound(_0xdf8c7b,null))[_0x492f('0x22')](respondWithResult(_0xdf8c7b,null))['catch'](handleError(_0xdf8c7b,null));};exports['create']=function(_0x5a90ad,_0x1bb9ed){return db[_0x492f('0x2b')][_0x492f('0x40')](_0x5a90ad[_0x492f('0x41')],{})[_0x492f('0x22')](function(_0x45ffaa){var _0x119a3c=_0x5a90ad[_0x492f('0x42')][_0x492f('0x24')]({'plain':!![]});if(!_0x119a3c)throw new Error(_0x492f('0x43'));if(_0x119a3c[_0x492f('0x44')]==='user'){var _0x571b28=_0x45ffaa[_0x492f('0x24')]({'plain':!![]});var _0x428d4e='Dispositions';return db['UserProfileSection'][_0x492f('0x3f')]({'where':{'name':_0x428d4e,'userProfileId':_0x119a3c[_0x492f('0x45')]},'raw':!![]})[_0x492f('0x22')](function(_0x3e073d){if(_0x3e073d&&_0x3e073d['autoAssociation']===0x0){return db[_0x492f('0x25')][_0x492f('0x40')]({'name':_0x571b28[_0x492f('0x28')],'resourceId':_0x571b28['id'],'type':_0x3e073d[_0x492f('0x28')],'sectionId':_0x3e073d['id']},{})[_0x492f('0x22')](function(){return _0x45ffaa;});}else{return _0x45ffaa;}})[_0x492f('0x46')](function(_0x373c9e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x373c9e);throw _0x373c9e;});}return _0x45ffaa;})[_0x492f('0x22')](respondWithResult(_0x1bb9ed,0xc9))['catch'](handleError(_0x1bb9ed,null));};exports[_0x492f('0x21')]=function(_0x23e863,_0xdd38b2){if(_0x23e863[_0x492f('0x41')]['id']){delete _0x23e863[_0x492f('0x41')]['id'];}return db[_0x492f('0x2b')][_0x492f('0x3f')]({'where':{'id':_0x23e863[_0x492f('0x47')]['id']}})['then'](handleEntityNotFound(_0xdd38b2,null))[_0x492f('0x22')](saveUpdates(_0x23e863[_0x492f('0x41')],null))[_0x492f('0x22')](respondWithResult(_0xdd38b2,null))[_0x492f('0x46')](handleError(_0xdd38b2,null));};exports[_0x492f('0x23')]=function(_0x1c39f0,_0x4613c9){return db[_0x492f('0x2b')][_0x492f('0x3f')]({'where':{'id':_0x1c39f0[_0x492f('0x47')]['id']}})[_0x492f('0x22')](handleEntityNotFound(_0x4613c9,null))[_0x492f('0x22')](removeEntity(_0x4613c9,null))[_0x492f('0x46')](handleError(_0x4613c9,null));}; \ No newline at end of file +var _0xeedb=['send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','nolimit','order','where','pick','filter','merge','options','Disposition','includeAll','include','catch','show','length','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','name'];(function(_0x43b3ff,_0x5a0dfe){var _0x40a394=function(_0x2e43d7){while(--_0x2e43d7){_0x43b3ff['push'](_0x43b3ff['shift']());}};_0x40a394(++_0x5a0dfe);}(_0xeedb,0x159));var _0xbeed=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xeedb[_0x433a86];return _0x23000c;};'use strict';var emlformat=require(_0xbeed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbeed('0x1'));var jsonpatch=require(_0xbeed('0x2'));var rp=require(_0xbeed('0x3'));var moment=require(_0xbeed('0x4'));var BPromise=require(_0xbeed('0x5'));var Mustache=require(_0xbeed('0x6'));var util=require('util');var path=require(_0xbeed('0x7'));var sox=require(_0xbeed('0x8'));var csv=require(_0xbeed('0x9'));var ejs=require(_0xbeed('0xa'));var fs=require('fs');var fs_extra=require(_0xbeed('0xb'));var _=require('lodash');var squel=require(_0xbeed('0xc'));var crypto=require(_0xbeed('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbeed('0x9'));var querystring=require(_0xbeed('0xe'));var Papa=require(_0xbeed('0xf'));var Redis=require('ioredis');var authService=require(_0xbeed('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbeed('0x11'));var hardwareService=require(_0xbeed('0x12'));var logger=require(_0xbeed('0x13'))('api');var utils=require(_0xbeed('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34d612,_0x1ab954){_0x1ab954=_0x1ab954||0xcc;return function(_0x46a4c0){if(_0x46a4c0){return _0x34d612[_0xbeed('0x15')](_0x1ab954);}return _0x34d612[_0xbeed('0x16')](_0x1ab954)[_0xbeed('0x17')]();};}function respondWithResult(_0x2672eb,_0x151d76){_0x151d76=_0x151d76||0xc8;return function(_0x365817){if(_0x365817){return _0x2672eb[_0xbeed('0x16')](_0x151d76)[_0xbeed('0x18')](_0x365817);}};}function respondWithFilteredResult(_0xe760f3,_0x47be01){return function(_0x4a1649){if(_0x4a1649){var _0x258de0=typeof _0x47be01[_0xbeed('0x19')]==='undefined'&&typeof _0x47be01[_0xbeed('0x1a')]===_0xbeed('0x1b');var _0x16c684=_0x4a1649[_0xbeed('0x1c')];var _0x503dd8=_0x258de0?0x0:_0x47be01['offset'];var _0x4007ac=_0x258de0?_0x4a1649[_0xbeed('0x1c')]:_0x47be01['offset']+_0x47be01[_0xbeed('0x1a')];var _0x2d4123;if(_0x4007ac>=_0x16c684){_0x4007ac=_0x16c684;_0x2d4123=0xc8;}else{_0x2d4123=0xce;}_0xe760f3[_0xbeed('0x16')](_0x2d4123);return _0xe760f3['set'](_0xbeed('0x1d'),_0x503dd8+'-'+_0x4007ac+'/'+_0x16c684)[_0xbeed('0x18')](_0x4a1649);}return null;};}function patchUpdates(_0x2ccd9a){return function(_0x10a52c){try{jsonpatch[_0xbeed('0x1e')](_0x10a52c,_0x2ccd9a,!![]);}catch(_0x4fb196){return BPromise[_0xbeed('0x1f')](_0x4fb196);}return _0x10a52c[_0xbeed('0x20')]();};}function saveUpdates(_0x2d7f7e,_0x554424){return function(_0x4f0ffb){if(_0x4f0ffb){return _0x4f0ffb[_0xbeed('0x21')](_0x2d7f7e)[_0xbeed('0x22')](function(_0x20c299){return _0x20c299;});}return null;};}function removeEntity(_0x3154f8,_0x5d2129){return function(_0x2e1806){if(_0x2e1806){return _0x2e1806[_0xbeed('0x23')]()['then'](function(){var _0xcf0585=_0x2e1806[_0xbeed('0x24')]({'plain':!![]});var _0x1fb547=_0xbeed('0x25');return db[_0xbeed('0x26')][_0xbeed('0x23')]({'where':{'type':_0x1fb547,'resourceId':_0xcf0585['id']}})[_0xbeed('0x22')](function(){return _0x2e1806;});})[_0xbeed('0x22')](function(){_0x3154f8[_0xbeed('0x16')](0xcc)[_0xbeed('0x17')]();});}};}function handleEntityNotFound(_0x209216,_0x17870e){return function(_0x1ed181){if(!_0x1ed181){_0x209216[_0xbeed('0x15')](0x194);}return _0x1ed181;};}function handleError(_0x34483d,_0x4428b4){_0x4428b4=_0x4428b4||0x1f4;return function(_0x13257f){logger['error'](_0x13257f['stack']);if(_0x13257f[_0xbeed('0x27')]){delete _0x13257f[_0xbeed('0x27')];}_0x34483d[_0xbeed('0x16')](_0x4428b4)[_0xbeed('0x28')](_0x13257f);};}exports[_0xbeed('0x29')]=function(_0x1b0d9b,_0x416420){var _0x59d36e={},_0x22b952={},_0xa9c1b3={'count':0x0,'rows':[]};var _0x23055e=_[_0xbeed('0x2a')](db['Disposition'][_0xbeed('0x2b')],function(_0xfacb84){return{'name':_0xfacb84[_0xbeed('0x2c')],'type':_0xfacb84[_0xbeed('0x2d')][_0xbeed('0x2e')]};});_0x22b952[_0xbeed('0x2f')]=_['map'](_0x23055e,'name');_0x22b952['query']=_[_0xbeed('0x30')](_0x1b0d9b[_0xbeed('0x31')]);_0x22b952[_0xbeed('0x32')]=_['intersection'](_0x22b952[_0xbeed('0x2f')],_0x22b952[_0xbeed('0x31')]);_0x59d36e[_0xbeed('0x33')]=_[_0xbeed('0x34')](_0x22b952[_0xbeed('0x2f')],qs['fields'](_0x1b0d9b['query'][_0xbeed('0x35')]));_0x59d36e[_0xbeed('0x33')]=_0x59d36e[_0xbeed('0x33')]['length']?_0x59d36e[_0xbeed('0x33')]:_0x22b952[_0xbeed('0x2f')];if(!_0x1b0d9b[_0xbeed('0x31')]['hasOwnProperty'](_0xbeed('0x36'))){_0x59d36e[_0xbeed('0x1a')]=qs[_0xbeed('0x1a')](_0x1b0d9b[_0xbeed('0x31')][_0xbeed('0x1a')]);_0x59d36e[_0xbeed('0x19')]=qs[_0xbeed('0x19')](_0x1b0d9b['query']['offset']);}_0x59d36e[_0xbeed('0x37')]=qs['sort'](_0x1b0d9b['query']['sort']);_0x59d36e[_0xbeed('0x38')]=qs[_0xbeed('0x32')](_[_0xbeed('0x39')](_0x1b0d9b[_0xbeed('0x31')],_0x22b952[_0xbeed('0x32')]),_0x23055e);if(_0x1b0d9b[_0xbeed('0x31')][_0xbeed('0x3a')]){_0x59d36e[_0xbeed('0x38')]=_[_0xbeed('0x3b')](_0x59d36e[_0xbeed('0x38')],{'$or':_[_0xbeed('0x2a')](_0x23055e,function(_0x26d44e){if(_0x26d44e['type']!=='VIRTUAL'){var _0x456f7d={};_0x456f7d[_0x26d44e[_0xbeed('0x27')]]={'$like':'%'+_0x1b0d9b['query'][_0xbeed('0x3a')]+'%'};return _0x456f7d;}})});}_0x59d36e=_[_0xbeed('0x3b')]({},_0x59d36e,_0x1b0d9b[_0xbeed('0x3c')]);var _0x4ccb58={'where':_0x59d36e[_0xbeed('0x38')]};return db[_0xbeed('0x3d')][_0xbeed('0x1c')](_0x4ccb58)[_0xbeed('0x22')](function(_0x35e865){_0xa9c1b3['count']=_0x35e865;if(_0x1b0d9b['query'][_0xbeed('0x3e')]){_0x59d36e[_0xbeed('0x3f')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x59d36e);})[_0xbeed('0x22')](function(_0x3d86e2){_0xa9c1b3['rows']=_0x3d86e2;return _0xa9c1b3;})['then'](respondWithFilteredResult(_0x416420,_0x59d36e))[_0xbeed('0x40')](handleError(_0x416420,null));};exports[_0xbeed('0x41')]=function(_0x711a9e,_0x12ce82){var _0x4fdab7={'raw':!![],'where':{'id':_0x711a9e['params']['id']}},_0x3a920c={};_0x3a920c[_0xbeed('0x2f')]=_[_0xbeed('0x30')](db[_0xbeed('0x3d')][_0xbeed('0x2b')]);_0x3a920c['query']=_['keys'](_0x711a9e[_0xbeed('0x31')]);_0x3a920c[_0xbeed('0x32')]=_['intersection'](_0x3a920c['model'],_0x3a920c[_0xbeed('0x31')]);_0x4fdab7[_0xbeed('0x33')]=_['intersection'](_0x3a920c[_0xbeed('0x2f')],qs[_0xbeed('0x35')](_0x711a9e[_0xbeed('0x31')][_0xbeed('0x35')]));_0x4fdab7[_0xbeed('0x33')]=_0x4fdab7[_0xbeed('0x33')][_0xbeed('0x42')]?_0x4fdab7[_0xbeed('0x33')]:_0x3a920c['model'];if(_0x711a9e[_0xbeed('0x31')]['includeAll']){_0x4fdab7[_0xbeed('0x3f')]=[{'all':!![]}];}_0x4fdab7=_[_0xbeed('0x3b')]({},_0x4fdab7,_0x711a9e[_0xbeed('0x3c')]);return db['Disposition'][_0xbeed('0x43')](_0x4fdab7)[_0xbeed('0x22')](handleEntityNotFound(_0x12ce82,null))[_0xbeed('0x22')](respondWithResult(_0x12ce82,null))['catch'](handleError(_0x12ce82,null));};exports[_0xbeed('0x44')]=function(_0x20ab96,_0x2f750f){return db[_0xbeed('0x3d')][_0xbeed('0x44')](_0x20ab96[_0xbeed('0x45')],{})['then'](function(_0x27204a){var _0x156f83=_0x20ab96['user'][_0xbeed('0x24')]({'plain':!![]});if(!_0x156f83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x156f83[_0xbeed('0x46')]===_0xbeed('0x47')){var _0x1bffeb=_0x27204a['get']({'plain':!![]});var _0x4d3969='Dispositions';return db[_0xbeed('0x48')][_0xbeed('0x43')]({'where':{'name':_0x4d3969,'userProfileId':_0x156f83[_0xbeed('0x49')]},'raw':!![]})['then'](function(_0x183bd6){if(_0x183bd6&&_0x183bd6[_0xbeed('0x4a')]===0x0){return db[_0xbeed('0x26')]['create']({'name':_0x1bffeb[_0xbeed('0x27')],'resourceId':_0x1bffeb['id'],'type':_0x183bd6[_0xbeed('0x27')],'sectionId':_0x183bd6['id']},{})[_0xbeed('0x22')](function(){return _0x27204a;});}else{return _0x27204a;}})[_0xbeed('0x40')](function(_0x57162f){logger[_0xbeed('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57162f);throw _0x57162f;});}return _0x27204a;})[_0xbeed('0x22')](respondWithResult(_0x2f750f,0xc9))['catch'](handleError(_0x2f750f,null));};exports[_0xbeed('0x21')]=function(_0x40cbe6,_0x1417b2){if(_0x40cbe6[_0xbeed('0x45')]['id']){delete _0x40cbe6[_0xbeed('0x45')]['id'];}return db['Disposition'][_0xbeed('0x43')]({'where':{'id':_0x40cbe6[_0xbeed('0x4c')]['id']}})[_0xbeed('0x22')](handleEntityNotFound(_0x1417b2,null))['then'](saveUpdates(_0x40cbe6[_0xbeed('0x45')],null))[_0xbeed('0x22')](respondWithResult(_0x1417b2,null))['catch'](handleError(_0x1417b2,null));};exports[_0xbeed('0x23')]=function(_0x5a958f,_0x5dc1f4){return db[_0xbeed('0x3d')]['find']({'where':{'id':_0x5a958f[_0xbeed('0x4c')]['id']}})[_0xbeed('0x22')](handleEntityNotFound(_0x5dc1f4,null))['then'](removeEntity(_0x5dc1f4,null))['catch'](handleError(_0x5dc1f4,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4260d64..c97bf2d 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 _0x1a1a=['name_voice','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_dispositions'];(function(_0x405d40,_0xc57994){var _0x576905=function(_0x4f58da){while(--_0x4f58da){_0x405d40['push'](_0x405d40['shift']());}};_0x576905(++_0xc57994);}(_0x1a1a,0xbb));var _0xa1a1=function(_0x4ede94,_0x4d346a){_0x4ede94=_0x4ede94-0x0;var _0x8c2fbb=_0x1a1a[_0x4ede94];return _0x8c2fbb;};'use strict';var _=require(_0xa1a1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa1a1('0x1'));var moment=require(_0xa1a1('0x2'));var BPromise=require(_0xa1a1('0x3'));var rp=require(_0xa1a1('0x4'));var fs=require('fs');var path=require(_0xa1a1('0x5'));var rimraf=require(_0xa1a1('0x6'));var config=require(_0xa1a1('0x7'));var attributes=require('./disposition.attributes');module[_0xa1a1('0x8')]=function(_0x5de3c2,_0x13562b){return _0x5de3c2[_0xa1a1('0x9')]('Disposition',attributes,{'tableName':_0xa1a1('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa1a1('0xb'),'fields':[_0xa1a1('0xc'),_0xa1a1('0xd')]},{'unique':!![],'name':_0xa1a1('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xa1a1('0xf'),'fields':[_0xa1a1('0xc'),_0xa1a1('0x10')]},{'unique':!![],'name':_0xa1a1('0x11'),'fields':[_0xa1a1('0xc'),_0xa1a1('0x12')]},{'unique':!![],'name':'name_fax','fields':['name',_0xa1a1('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0xa1a1('0xc'),_0xa1a1('0x14')]},{'unique':!![],'name':_0xa1a1('0x15'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ce5=['Disposition','tools_dispositions','name_voice','ListId','name_chat','ChatWebsiteId','name','MailAccountId','name_sms','FaxAccountId','name_openchannel','name_whatsapp','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./disposition.attributes','define'];(function(_0x2de51f,_0x4d291f){var _0x698b40=function(_0x311ff0){while(--_0x311ff0){_0x2de51f['push'](_0x2de51f['shift']());}};_0x698b40(++_0x4d291f);}(_0x0ce5,0xc9));var _0x50ce=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x0ce5[_0x2becba];return _0x90b5dd;};'use strict';var _=require(_0x50ce('0x0'));var util=require(_0x50ce('0x1'));var logger=require(_0x50ce('0x2'))(_0x50ce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x50ce('0x4'));var rimraf=require(_0x50ce('0x5'));var config=require(_0x50ce('0x6'));var attributes=require(_0x50ce('0x7'));module['exports']=function(_0x15969e,_0xd1e545){return _0x15969e[_0x50ce('0x8')](_0x50ce('0x9'),attributes,{'tableName':_0x50ce('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x50ce('0xb'),'fields':['name',_0x50ce('0xc')]},{'unique':!![],'name':_0x50ce('0xd'),'fields':['name',_0x50ce('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x50ce('0xf'),_0x50ce('0x10')]},{'unique':!![],'name':_0x50ce('0x11'),'fields':[_0x50ce('0xf'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0x50ce('0x12')]},{'unique':!![],'name':_0x50ce('0x13'),'fields':[_0x50ce('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':_0x50ce('0x14'),'fields':[_0x50ce('0xf'),'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 0ec7770..9dc39bd 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(_0x2429fd,_0x10b4f6){var _0xff9b12=function(_0x159912){while(--_0x159912){_0x2429fd['push'](_0x2429fd['shift']());}};_0xff9b12(++_0x10b4f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x1edb31,_0x5ab046){var _0xf49b15=function(_0x48cd90){while(--_0x48cd90){_0x1edb31['push'](_0x1edb31['shift']());}};_0xf49b15(++_0x5ab046);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 7deab6d..965fec0 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 _0xb99c=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x343cc4,_0x5ba0f7){var _0x5dc8ce=function(_0x5dacc8){while(--_0x5dacc8){_0x343cc4['push'](_0x343cc4['shift']());}};_0x5dc8ce(++_0x5ba0f7);}(_0xb99c,0x153));var _0xcb99=function(_0x18cf5e,_0x579100){_0x18cf5e=_0x18cf5e-0x0;var _0x2d4a88=_0xb99c[_0x18cf5e];return _0x2d4a88;};'use strict';var multer=require(_0xcb99('0x0'));var util=require(_0xcb99('0x1'));var path=require(_0xcb99('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb99('0x3'));var router=express[_0xcb99('0x4')]();var fs_extra=require(_0xcb99('0x5'));var auth=require(_0xcb99('0x6'));var interaction=require(_0xcb99('0x7'));var config=require(_0xcb99('0x8'));var controller=require(_0xcb99('0x9'));router[_0xcb99('0xa')]('/',auth[_0xcb99('0xb')](),controller[_0xcb99('0xc')]);router[_0xcb99('0xa')](_0xcb99('0xd'),auth[_0xcb99('0xb')](),controller[_0xcb99('0xe')]);router[_0xcb99('0xf')]('/',auth[_0xcb99('0xb')](),controller['create']);router[_0xcb99('0x10')]('/:id',auth[_0xcb99('0xb')](),controller[_0xcb99('0x11')]);router[_0xcb99('0x12')](_0xcb99('0xd'),auth[_0xcb99('0xb')](),controller[_0xcb99('0x13')]);module[_0xcb99('0x14')]=router; \ No newline at end of file +var _0xc87d=['post','create','put','update','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc87d,0xc0));var _0xdc87=function(_0x278d10,_0x5bf8aa){_0x278d10=_0x278d10-0x0;var _0x252c0c=_0xc87d[_0x278d10];return _0x252c0c;};'use strict';var multer=require(_0xdc87('0x0'));var util=require(_0xdc87('0x1'));var path=require(_0xdc87('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc87('0x3'));var router=express['Router']();var fs_extra=require(_0xdc87('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdc87('0x5'));var config=require(_0xdc87('0x6'));var controller=require(_0xdc87('0x7'));router[_0xdc87('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc87('0x8')](_0xdc87('0x9'),auth[_0xdc87('0xa')](),controller[_0xdc87('0xb')]);router[_0xdc87('0xc')]('/',auth[_0xdc87('0xa')](),controller[_0xdc87('0xd')]);router[_0xdc87('0xe')](_0xdc87('0x9'),auth[_0xdc87('0xa')](),controller[_0xdc87('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdc87('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index fc3bba1..5ed6d1b 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 _0xaf1b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','12000','v17,v27,v29','INTEGER','SIP','KHOMP','TEXT'];(function(_0x2cf81a,_0x1f8e73){var _0x27daa4=function(_0x504aac){while(--_0x504aac){_0x2cf81a['push'](_0x2cf81a['shift']());}};_0x27daa4(++_0x1f8e73);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x331581,_0x1b378e){_0x331581=_0x331581-0x0;var _0x2505d2=_0xaf1b[_0x331581];return _0x2505d2;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'name':{'type':Sequelize[_0xbaf1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbaf1('0x2')]},'ecm':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0x4'),'no'),'defaultValue':_0xbaf1('0x4')},'headerinfo':{'type':Sequelize[_0xbaf1('0x2')],'defaultValue':_0xbaf1('0x5')},'localstationid':{'type':Sequelize[_0xbaf1('0x2')],'unique':_0xbaf1('0x6')},'minrate':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0x7'),_0xbaf1('0x8'),'7200',_0xbaf1('0x9'),'12000',_0xbaf1('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0x7'),_0xbaf1('0x8'),'7200',_0xbaf1('0x9'),_0xbaf1('0xb'),'14400'),'defaultValue':_0xbaf1('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xbaf1('0xc')},'gateway':{'type':Sequelize[_0xbaf1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbaf1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbaf1('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0xe'),'IAX','DADHI',_0xbaf1('0xf')),'defaultValue':_0xbaf1('0xe')},'key':{'type':Sequelize[_0xbaf1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbaf1('0x10')],'defaultValue':function(){return _0xbaf1('0x11');}},'notificationSound':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbaf1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbaf1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbaf1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbaf1('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xbaf1('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xbaf1('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33c23b){if(!_0x33c23b)this['setDataValue'](_0xbaf1('0x14'),null);this[_0xbaf1('0x15')](_0xbaf1('0x16'),_0x33c23b);}}}; \ No newline at end of file +var _0x0309=['7200','12000','2400','9600','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800'];(function(_0x4a849f,_0x527945){var _0x20a667=function(_0x4fcfa8){while(--_0x4fcfa8){_0x4a849f['push'](_0x4a849f['shift']());}};_0x20a667(++_0x527945);}(_0x0309,0x165));var _0x9030=function(_0x18cd04,_0x1dba1d){_0x18cd04=_0x18cd04-0x0;var _0x938f07=_0x0309[_0x18cd04];return _0x938f07;};'use strict';var Sequelize=require(_0x9030('0x0'));module['exports']={'name':{'type':Sequelize[_0x9030('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x9030('0x2')](_0x9030('0x3'),'no'),'defaultValue':_0x9030('0x3')},'headerinfo':{'type':Sequelize[_0x9030('0x1')],'defaultValue':_0x9030('0x4')},'localstationid':{'type':Sequelize[_0x9030('0x1')],'unique':_0x9030('0x5')},'minrate':{'type':Sequelize['ENUM']('2400',_0x9030('0x6'),_0x9030('0x7'),'9600',_0x9030('0x8'),'14400'),'defaultValue':_0x9030('0x6')},'maxrate':{'type':Sequelize[_0x9030('0x2')](_0x9030('0x9'),'4800',_0x9030('0x7'),_0x9030('0xa'),_0x9030('0x8'),'14400'),'defaultValue':_0x9030('0xb')},'modem':{'type':Sequelize[_0x9030('0x1')],'defaultValue':_0x9030('0xc')},'gateway':{'type':Sequelize[_0x9030('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9030('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9030('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9030('0x2')]('SIP',_0x9030('0xe'),_0x9030('0xf'),_0x9030('0x10')),'defaultValue':_0x9030('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9030('0x12')],'defaultValue':function(){return _0x9030('0x13');}},'notificationSound':{'type':Sequelize[_0x9030('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9030('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9030('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9030('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9030('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9030('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9030('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9030('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x9030('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x9030('0x14')],'defaultValue':![],'comment':_0x9030('0x16'),'set':function(_0x319db3){if(!_0x319db3)this[_0x9030('0x17')](_0x9030('0x18'),null);this[_0x9030('0x17')](_0x9030('0x19'),_0x319db3);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e390261..247f422 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 _0x0d46=['push','CDR(type)=inbound-fax','Set','ecm','localstationid','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','key','createdAt','updatedAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','dataValues','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','end','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','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','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','system','description'];(function(_0x2b3278,_0xa6d2c5){var _0x2c66dc=function(_0x3da215){while(--_0x3da215){_0x2b3278['push'](_0x2b3278['shift']());}};_0x2c66dc(++_0xa6d2c5);}(_0x0d46,0xfb));var _0x60d4=function(_0x2c665a,_0x330ba9){_0x2c665a=_0x2c665a-0x0;var _0x5d9f89=_0x0d46[_0x2c665a];return _0x5d9f89;};'use strict';var emlformat=require(_0x60d4('0x0'));var rimraf=require(_0x60d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x60d4('0x2'));var moment=require(_0x60d4('0x3'));var BPromise=require(_0x60d4('0x4'));var Mustache=require(_0x60d4('0x5'));var util=require(_0x60d4('0x6'));var path=require(_0x60d4('0x7'));var sox=require(_0x60d4('0x8'));var csv=require(_0x60d4('0x9'));var ejs=require(_0x60d4('0xa'));var fs=require('fs');var fs_extra=require(_0x60d4('0xb'));var _=require('lodash');var squel=require(_0x60d4('0xc'));var crypto=require('crypto');var jsforce=require(_0x60d4('0xd'));var deskjs=require(_0x60d4('0xe'));var toCsv=require(_0x60d4('0x9'));var querystring=require(_0x60d4('0xf'));var Papa=require(_0x60d4('0x10'));var Redis=require(_0x60d4('0x11'));var authService=require(_0x60d4('0x12'));var qs=require(_0x60d4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60d4('0x14'));var logger=require(_0x60d4('0x15'))(_0x60d4('0x16'));var utils=require('../../config/utils');var config=require(_0x60d4('0x17'));var licenseUtil=require(_0x60d4('0x18'));var db=require(_0x60d4('0x19'))['db'];config['redis']=_[_0x60d4('0x1a')](config['redis'],{'host':_0x60d4('0x1b'),'port':0x18eb});var socket=require(_0x60d4('0x1c'))(new Redis(config['redis']));require(_0x60d4('0x1d'))[_0x60d4('0x1e')](socket);var jayson=require(_0x60d4('0x1f'));var client=jayson[_0x60d4('0x20')][_0x60d4('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x60d4('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x402ce5,_0x57126e,_0x20c6dd,_0x4d1105){return new BPromise(function(_0x494dcc,_0xaa1d8f){var _0x708b00=_0x4d1105||client;return _0x708b00[_0x60d4('0x22')](_0x402ce5,_0x20c6dd)[_0x60d4('0x23')](function(_0x5aed19){logger[_0x60d4('0x24')](_0x60d4('0x25'),_0x57126e,_0x60d4('0x26'));logger[_0x60d4('0x27')](_0x60d4('0x28'),_0x57126e,_0x60d4('0x26'),JSON[_0x60d4('0x29')](_0x5aed19));if(_0x5aed19[_0x60d4('0x2a')]){if(_0x5aed19[_0x60d4('0x2a')][_0x60d4('0x2b')]===0x1f4){logger[_0x60d4('0x2a')](_0x60d4('0x25'),_0x57126e,_0x5aed19[_0x60d4('0x2a')][_0x60d4('0x2c')]);return _0xaa1d8f(_0x5aed19[_0x60d4('0x2a')][_0x60d4('0x2c')]);}logger[_0x60d4('0x2a')](_0x60d4('0x25'),_0x57126e,_0x5aed19[_0x60d4('0x2a')]['message']);return _0x494dcc(_0x5aed19[_0x60d4('0x2a')]['message']);}else{logger['info'](_0x60d4('0x25'),_0x57126e,_0x60d4('0x26'));_0x494dcc(_0x5aed19['result'][_0x60d4('0x2c')]);}})[_0x60d4('0x2d')](function(_0x513206){logger[_0x60d4('0x2a')](_0x60d4('0x25'),_0x57126e,_0x513206);_0xaa1d8f(_0x513206);});});}function respondWithStatusCode(_0x2ebfd1,_0x5ad612){_0x5ad612=_0x5ad612||0xcc;return function(_0x1fe091){if(_0x1fe091){return _0x2ebfd1[_0x60d4('0x2e')](_0x5ad612);}return _0x2ebfd1[_0x60d4('0x2f')](_0x5ad612)['end']();};}function respondWithResult(_0x534111,_0x33a4e8){_0x33a4e8=_0x33a4e8||0xc8;return function(_0x4399fd){if(_0x4399fd){return _0x534111[_0x60d4('0x2f')](_0x33a4e8)[_0x60d4('0x30')](_0x4399fd);}};}function respondWithFilteredResult(_0x3a1589,_0x49aa88){return function(_0x58628f){if(_0x58628f){var _0x34cfef=typeof _0x49aa88['offset']===_0x60d4('0x31')&&typeof _0x49aa88[_0x60d4('0x32')]===_0x60d4('0x31');var _0x83be69=_0x58628f['count'];var _0x4c03dc=_0x34cfef?0x0:_0x49aa88[_0x60d4('0x33')];var _0x520975=_0x34cfef?_0x58628f['count']:_0x49aa88[_0x60d4('0x33')]+_0x49aa88[_0x60d4('0x32')];var _0x23aa48;if(_0x520975>=_0x83be69){_0x520975=_0x83be69;_0x23aa48=0xc8;}else{_0x23aa48=0xce;}_0x3a1589[_0x60d4('0x2f')](_0x23aa48);return _0x3a1589[_0x60d4('0x34')](_0x60d4('0x35'),_0x4c03dc+'-'+_0x520975+'/'+_0x83be69)[_0x60d4('0x30')](_0x58628f);}return null;};}function patchUpdates(_0x411dbd){return function(_0x1632b1){try{jsonpatch[_0x60d4('0x36')](_0x1632b1,_0x411dbd,!![]);}catch(_0x9acd24){return BPromise[_0x60d4('0x37')](_0x9acd24);}return _0x1632b1['save']();};}function saveUpdates(_0x591417,_0xf01d3a){return function(_0x467350){if(_0x467350){return _0x467350[_0x60d4('0x38')](_0x591417)[_0x60d4('0x23')](function(_0x22328d){return _0x22328d;});}return null;};}function removeEntity(_0x29e05e,_0x2b5499){return function(_0x16acad){if(_0x16acad){return _0x16acad[_0x60d4('0x39')]()[_0x60d4('0x23')](function(){var _0x30d772=_0x16acad[_0x60d4('0x3a')]({'plain':!![]});var _0x9ee9e7=_0x60d4('0x3b');return db[_0x60d4('0x3c')][_0x60d4('0x39')]({'where':{'type':_0x9ee9e7,'resourceId':_0x30d772['id']}})[_0x60d4('0x23')](function(){return _0x16acad;});})['then'](function(){_0x29e05e['status'](0xcc)[_0x60d4('0x3d')]();});}};}function handleEntityNotFound(_0x40c8fa,_0x2f50ca){return function(_0x4fea54){if(!_0x4fea54){_0x40c8fa['sendStatus'](0x194);}return _0x4fea54;};}function handleError(_0x11a17f,_0x306c56){_0x306c56=_0x306c56||0x1f4;return function(_0x2f768c){logger[_0x60d4('0x2a')](_0x2f768c['stack']);if(_0x2f768c['name']){delete _0x2f768c['name'];}_0x11a17f[_0x60d4('0x2f')](_0x306c56)[_0x60d4('0x3e')](_0x2f768c);};}exports[_0x60d4('0x3f')]=function(_0x58b487,_0x1cb3e7){var _0x5a6eeb={'include':[{'model':db['Pause'],'as':_0x60d4('0x40')}]},_0x1d4125={},_0x3cbf23={'count':0x0,'rows':[]};var _0xbe368a=_[_0x60d4('0x41')](db[_0x60d4('0x42')][_0x60d4('0x43')],function(_0x44441b){return{'name':_0x44441b[_0x60d4('0x44')],'type':_0x44441b[_0x60d4('0x45')]['key']};});_0x1d4125[_0x60d4('0x46')]=_[_0x60d4('0x41')](_0xbe368a,_0x60d4('0x47'));_0x1d4125[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x58b487['query']);_0x1d4125[_0x60d4('0x4a')]=_[_0x60d4('0x4b')](_0x1d4125[_0x60d4('0x46')],_0x1d4125[_0x60d4('0x48')]);_0x5a6eeb['attributes']=_[_0x60d4('0x4b')](_0x1d4125[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x58b487['query'][_0x60d4('0x4c')]));_0x5a6eeb['attributes']=_0x5a6eeb[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x5a6eeb[_0x60d4('0x4d')]:_0x1d4125[_0x60d4('0x46')];if(!_0x58b487['query'][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x5a6eeb[_0x60d4('0x32')]=qs[_0x60d4('0x32')](_0x58b487['query']['limit']);_0x5a6eeb[_0x60d4('0x33')]=qs[_0x60d4('0x33')](_0x58b487[_0x60d4('0x48')][_0x60d4('0x33')]);}_0x5a6eeb[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x58b487['query']['sort']);_0x5a6eeb[_0x60d4('0x53')]=qs['filters'](_[_0x60d4('0x54')](_0x58b487[_0x60d4('0x48')],_0x1d4125[_0x60d4('0x4a')]),_0xbe368a);if(_0x58b487[_0x60d4('0x48')][_0x60d4('0x55')]){_0x5a6eeb[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x5a6eeb[_0x60d4('0x53')],{'$or':_['map'](_0xbe368a,function(_0x2ee3e9){if(_0x2ee3e9[_0x60d4('0x45')]!==_0x60d4('0x57')){var _0x5d43c2={};_0x5d43c2[_0x2ee3e9[_0x60d4('0x47')]]={'$like':'%'+_0x58b487['query'][_0x60d4('0x55')]+'%'};return _0x5d43c2;}})});}_0x5a6eeb=_[_0x60d4('0x56')]({},_0x5a6eeb,_0x58b487[_0x60d4('0x58')]);var _0x282a83={'where':_0x5a6eeb[_0x60d4('0x53')]};return db['FaxAccount'][_0x60d4('0x59')](_0x282a83)[_0x60d4('0x23')](function(_0x691795){_0x3cbf23['count']=_0x691795;if(_0x58b487[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x5a6eeb[_0x60d4('0x5b')]=[{'all':!![]}];}return db[_0x60d4('0x42')][_0x60d4('0x5c')](_0x5a6eeb);})[_0x60d4('0x23')](function(_0x42667b){_0x3cbf23[_0x60d4('0x5d')]=_0x42667b;return _0x3cbf23;})[_0x60d4('0x23')](respondWithFilteredResult(_0x1cb3e7,_0x5a6eeb))[_0x60d4('0x2d')](handleError(_0x1cb3e7,null));};exports[_0x60d4('0x5e')]=function(_0x53f0eb,_0x480e4c){var _0x21dd3b={'raw':![],'where':{'id':_0x53f0eb[_0x60d4('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x60d4('0x40')}]},_0x211ddb={};_0x211ddb[_0x60d4('0x46')]=_['keys'](db[_0x60d4('0x42')][_0x60d4('0x43')]);_0x211ddb[_0x60d4('0x48')]=_['keys'](_0x53f0eb[_0x60d4('0x48')]);_0x211ddb['filters']=_['intersection'](_0x211ddb[_0x60d4('0x46')],_0x211ddb['query']);_0x21dd3b['attributes']=_[_0x60d4('0x4b')](_0x211ddb['model'],qs['fields'](_0x53f0eb[_0x60d4('0x48')][_0x60d4('0x4c')]));_0x21dd3b[_0x60d4('0x4d')]=_0x21dd3b['attributes'][_0x60d4('0x4e')]?_0x21dd3b['attributes']:_0x211ddb[_0x60d4('0x46')];if(_0x53f0eb[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x21dd3b[_0x60d4('0x5b')]=[{'all':!![]}];}_0x21dd3b=_[_0x60d4('0x56')]({},_0x21dd3b,_0x53f0eb[_0x60d4('0x58')]);return db['FaxAccount'][_0x60d4('0x60')](_0x21dd3b)[_0x60d4('0x23')](handleEntityNotFound(_0x480e4c,null))['then'](respondWithResult(_0x480e4c,null))[_0x60d4('0x2d')](handleError(_0x480e4c,null));};exports[_0x60d4('0x61')]=function(_0x4dc2d9,_0x173496){return db['FaxAccount'][_0x60d4('0x61')](_0x4dc2d9[_0x60d4('0x62')],{})['then'](function(_0x21c78c){var _0x262ad1=_0x4dc2d9[_0x60d4('0x63')][_0x60d4('0x3a')]({'plain':!![]});if(!_0x262ad1)throw new Error(_0x60d4('0x64'));if(_0x262ad1[_0x60d4('0x65')]==='user'){var _0x17ea01=_0x21c78c[_0x60d4('0x3a')]({'plain':!![]});var _0x3cb1f8='FaxAccounts';return db[_0x60d4('0x66')][_0x60d4('0x60')]({'where':{'name':_0x3cb1f8,'userProfileId':_0x262ad1['userProfileId']},'raw':!![]})[_0x60d4('0x23')](function(_0x154c8a){if(_0x154c8a&&_0x154c8a[_0x60d4('0x67')]===0x0){return db[_0x60d4('0x3c')][_0x60d4('0x61')]({'name':_0x17ea01[_0x60d4('0x47')],'resourceId':_0x17ea01['id'],'type':_0x154c8a[_0x60d4('0x47')],'sectionId':_0x154c8a['id']},{})[_0x60d4('0x23')](function(){return _0x21c78c;});}else{return _0x21c78c;}})[_0x60d4('0x2d')](function(_0x466032){logger['error'](_0x60d4('0x68'),_0x466032);throw _0x466032;});}return _0x21c78c;})[_0x60d4('0x23')](respondWithResult(_0x173496,0xc9))[_0x60d4('0x2d')](handleError(_0x173496,null));};exports[_0x60d4('0x38')]=function(_0x19b643,_0x5657e2){if(_0x19b643[_0x60d4('0x62')]['id']){delete _0x19b643[_0x60d4('0x62')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x19b643['params']['id']},'include':[{'model':db[_0x60d4('0x69')],'as':_0x60d4('0x40')}]})[_0x60d4('0x23')](handleEntityNotFound(_0x5657e2,null))['then'](saveUpdates(_0x19b643[_0x60d4('0x62')],null))[_0x60d4('0x23')](respondWithResult(_0x5657e2,null))[_0x60d4('0x2d')](handleError(_0x5657e2,null));};exports['destroy']=function(_0xab6262,_0x20d4c4){return db['FaxAccount'][_0x60d4('0x60')]({'where':{'id':_0xab6262[_0x60d4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x20d4c4,null))[_0x60d4('0x23')](removeEntity(_0x20d4c4,null))['catch'](handleError(_0x20d4c4,null));};exports[_0x60d4('0x6a')]=function(_0x9c0a1f,_0x316989){return db[_0x60d4('0x42')][_0x60d4('0x6a')]()['then'](respondWithResult(_0x316989,null))['catch'](handleError(_0x316989,null));};exports[_0x60d4('0x6b')]=function(_0x3902b0,_0x3b556f,_0x86ccc7){if(_0x3902b0[_0x60d4('0x62')]['id']){delete _0x3902b0[_0x60d4('0x62')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3902b0['params']['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x3b556f,null))[_0x60d4('0x23')](function(_0x322cc4){if(_0x322cc4){_0x3902b0[_0x60d4('0x62')][_0x60d4('0x6c')]=_0x322cc4['id'];return db[_0x60d4('0x6d')][_0x60d4('0x61')](_0x3902b0[_0x60d4('0x62')]);}})[_0x60d4('0x23')](respondWithResult(_0x3b556f,null))[_0x60d4('0x2d')](handleError(_0x3b556f,null));};exports[_0x60d4('0x6e')]=function(_0x8bfa14,_0x2271c7,_0x1f6d60){var _0x1c4c74={'raw':![],'where':{}};var _0x20bf3f={};var _0x48dd52={'count':0x0,'rows':[]};return db[_0x60d4('0x42')]['findOne']({'where':{'id':_0x8bfa14[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x2271c7,null))[_0x60d4('0x23')](function(_0x43e547){if(_0x43e547){_0x20bf3f[_0x60d4('0x46')]=_[_0x60d4('0x49')](db[_0x60d4('0x6d')][_0x60d4('0x43')]);_0x20bf3f['query']=_[_0x60d4('0x49')](_0x8bfa14[_0x60d4('0x48')]);_0x20bf3f['filters']=_['intersection'](_0x20bf3f[_0x60d4('0x46')],_0x20bf3f[_0x60d4('0x48')]);_0x1c4c74[_0x60d4('0x4d')]=_['intersection'](_0x20bf3f[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x8bfa14[_0x60d4('0x48')][_0x60d4('0x4c')]));_0x1c4c74['attributes']=_0x1c4c74[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x1c4c74['attributes']:_0x20bf3f[_0x60d4('0x46')];if(!_0x8bfa14[_0x60d4('0x48')]['hasOwnProperty'](_0x60d4('0x50'))){_0x1c4c74[_0x60d4('0x32')]=qs[_0x60d4('0x32')](_0x8bfa14[_0x60d4('0x48')]['limit']);_0x1c4c74[_0x60d4('0x33')]=qs[_0x60d4('0x33')](_0x8bfa14[_0x60d4('0x48')][_0x60d4('0x33')]);}_0x1c4c74[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x8bfa14['query']['sort']);_0x1c4c74['where']=qs[_0x60d4('0x4a')](_['pick'](_0x8bfa14['query'],_0x20bf3f[_0x60d4('0x4a')]));_0x1c4c74[_0x60d4('0x53')][_0x60d4('0x6c')]=_0x43e547['id'];if(_0x8bfa14[_0x60d4('0x48')]['filter']){_0x1c4c74[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x1c4c74[_0x60d4('0x53')],{'$or':_[_0x60d4('0x41')](_0x1c4c74[_0x60d4('0x4d')],function(_0x36b6c6){var _0x147623={};_0x147623[_0x36b6c6]={'$like':'%'+_0x8bfa14[_0x60d4('0x48')]['filter']+'%'};return _0x147623;})});}_0x1c4c74=_[_0x60d4('0x56')]({},_0x1c4c74,_0x8bfa14[_0x60d4('0x58')]);return db[_0x60d4('0x6d')][_0x60d4('0x59')]({'where':_0x1c4c74[_0x60d4('0x53')]})[_0x60d4('0x23')](function(_0x266ec3){_0x48dd52[_0x60d4('0x59')]=_0x266ec3;if(_0x8bfa14[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x1c4c74[_0x60d4('0x5b')]=[{'all':!![]}];}return db[_0x60d4('0x6d')][_0x60d4('0x5c')](_0x1c4c74);})[_0x60d4('0x23')](function(_0x3e8867){_0x48dd52[_0x60d4('0x5d')]=_0x3e8867;return _0x48dd52;});}})[_0x60d4('0x23')](respondWithFilteredResult(_0x2271c7,_0x1c4c74))[_0x60d4('0x2d')](handleError(_0x2271c7,null));};exports[_0x60d4('0x6f')]=function(_0x3813a9,_0x2dcda1,_0x286f97){return db[_0x60d4('0x42')][_0x60d4('0x60')]({'where':{'id':_0x3813a9[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x2dcda1,null))[_0x60d4('0x23')](function(_0x4db2a6){if(_0x4db2a6){return _0x4db2a6[_0x60d4('0x6f')](_0x3813a9[_0x60d4('0x48')][_0x60d4('0x70')]);}})[_0x60d4('0x23')](respondWithStatusCode(_0x2dcda1,null))[_0x60d4('0x2d')](handleError(_0x2dcda1,null));};exports[_0x60d4('0x71')]=function(_0x48a188,_0x1e4a30,_0x3c2c9c){if(_0x48a188[_0x60d4('0x62')]['id']){delete _0x48a188[_0x60d4('0x62')]['id'];}return db[_0x60d4('0x42')]['find']({'where':{'id':_0x48a188['params']['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x1e4a30,null))[_0x60d4('0x23')](function(_0x36000b){if(_0x36000b){_0x48a188[_0x60d4('0x62')][_0x60d4('0x6c')]=_0x36000b['id'];return db['CannedAnswer'][_0x60d4('0x61')](_0x48a188[_0x60d4('0x62')]);}})[_0x60d4('0x23')](respondWithResult(_0x1e4a30,null))['catch'](handleError(_0x1e4a30,null));};exports['getAnswers']=function(_0x1af723,_0x101c23,_0x4bfce7){var _0x41c9d5={'raw':![],'where':{}};var _0x1c94ed={};var _0x4041cf={'count':0x0,'rows':[]};return db[_0x60d4('0x42')]['findOne']({'where':{'id':_0x1af723[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x101c23,null))[_0x60d4('0x23')](function(_0x5688c0){if(_0x5688c0){_0x1c94ed[_0x60d4('0x46')]=_[_0x60d4('0x49')](db[_0x60d4('0x72')]['rawAttributes']);_0x1c94ed[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x1af723[_0x60d4('0x48')]);_0x1c94ed[_0x60d4('0x4a')]=_[_0x60d4('0x4b')](_0x1c94ed[_0x60d4('0x46')],_0x1c94ed[_0x60d4('0x48')]);_0x41c9d5[_0x60d4('0x4d')]=_[_0x60d4('0x4b')](_0x1c94ed[_0x60d4('0x46')],qs['fields'](_0x1af723['query'][_0x60d4('0x4c')]));_0x41c9d5[_0x60d4('0x4d')]=_0x41c9d5['attributes'][_0x60d4('0x4e')]?_0x41c9d5[_0x60d4('0x4d')]:_0x1c94ed['model'];if(!_0x1af723[_0x60d4('0x48')][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x41c9d5['limit']=qs['limit'](_0x1af723[_0x60d4('0x48')][_0x60d4('0x32')]);_0x41c9d5['offset']=qs['offset'](_0x1af723[_0x60d4('0x48')][_0x60d4('0x33')]);}_0x41c9d5['order']=qs[_0x60d4('0x52')](_0x1af723[_0x60d4('0x48')][_0x60d4('0x52')]);_0x41c9d5[_0x60d4('0x53')]=qs[_0x60d4('0x4a')](_[_0x60d4('0x54')](_0x1af723[_0x60d4('0x48')],_0x1c94ed['filters']));_0x41c9d5[_0x60d4('0x53')]['FaxAccountId']=_0x5688c0['id'];if(_0x1af723[_0x60d4('0x48')][_0x60d4('0x55')]){_0x41c9d5['where']=_[_0x60d4('0x56')](_0x41c9d5[_0x60d4('0x53')],{'$or':_[_0x60d4('0x41')](_0x41c9d5[_0x60d4('0x4d')],function(_0x174d8e){var _0x83bd06={};_0x83bd06[_0x174d8e]={'$like':'%'+_0x1af723[_0x60d4('0x48')][_0x60d4('0x55')]+'%'};return _0x83bd06;})});}_0x41c9d5=_[_0x60d4('0x56')]({},_0x41c9d5,_0x1af723[_0x60d4('0x58')]);return db['CannedAnswer'][_0x60d4('0x59')]({'where':_0x41c9d5['where']})['then'](function(_0x5b04c5){_0x4041cf[_0x60d4('0x59')]=_0x5b04c5;if(_0x1af723[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x41c9d5[_0x60d4('0x5b')]=[{'all':!![]}];}return db[_0x60d4('0x72')][_0x60d4('0x5c')](_0x41c9d5);})[_0x60d4('0x23')](function(_0x31260c){_0x4041cf[_0x60d4('0x5d')]=_0x31260c;return _0x4041cf;});}})['then'](respondWithFilteredResult(_0x101c23,_0x41c9d5))['catch'](handleError(_0x101c23,null));};exports[_0x60d4('0x73')]=function(_0x349788,_0x54f06e,_0x5c7902){return db[_0x60d4('0x42')]['find']({'where':{'id':_0x349788[_0x60d4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x54f06e,null))['then'](function(_0x922eb4){if(_0x922eb4){return _0x922eb4['removeAnswers'](_0x349788[_0x60d4('0x48')][_0x60d4('0x70')]);}})[_0x60d4('0x23')](respondWithStatusCode(_0x54f06e,null))[_0x60d4('0x2d')](handleError(_0x54f06e,null));};exports[_0x60d4('0x74')]=function(_0x33e2dd,_0x2783ed,_0x11dc18){return db[_0x60d4('0x75')][_0x60d4('0x60')]({'where':{'id':_0x33e2dd['params']['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x2783ed,null))[_0x60d4('0x23')](function(_0x3c947a){if(_0x3c947a){return _0x3c947a[_0x60d4('0x74')](_0x33e2dd[_0x60d4('0x62')][_0x60d4('0x70')],_[_0x60d4('0x76')](_0x33e2dd[_0x60d4('0x62')],[_0x60d4('0x70'),'id'])||{});}})[_0x60d4('0x23')](respondWithResult(_0x2783ed,null))['catch'](handleError(_0x2783ed,null));};exports[_0x60d4('0x77')]=function(_0x309659,_0x31fc82,_0x2a8b13){var _0x166365={'raw':![],'where':{}};var _0x519d78={};var _0x3c8923={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x309659[_0x60d4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x31fc82,null))[_0x60d4('0x23')](function(_0x14cbe3){if(_0x14cbe3){_0x519d78[_0x60d4('0x46')]=_[_0x60d4('0x49')](db['FaxInteraction']['rawAttributes']);_0x519d78[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x309659[_0x60d4('0x48')]);_0x519d78['filters']=_['intersection'](_0x519d78['model'],_0x519d78[_0x60d4('0x48')]);_0x166365[_0x60d4('0x4d')]=_['intersection'](_0x519d78[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x309659[_0x60d4('0x48')][_0x60d4('0x4c')]));_0x166365['attributes']=_0x166365[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x166365['attributes']:_0x519d78[_0x60d4('0x46')];if(!_0x309659['query']['hasOwnProperty'](_0x60d4('0x50'))){_0x166365[_0x60d4('0x32')]=qs[_0x60d4('0x32')](_0x309659[_0x60d4('0x48')]['limit']);_0x166365[_0x60d4('0x33')]=qs['offset'](_0x309659[_0x60d4('0x48')][_0x60d4('0x33')]);}_0x166365[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x309659[_0x60d4('0x48')]['sort']);_0x166365[_0x60d4('0x53')]=qs[_0x60d4('0x4a')](_[_0x60d4('0x54')](_0x309659[_0x60d4('0x48')],_0x519d78['filters']));_0x166365[_0x60d4('0x53')]['FaxAccountId']=_0x14cbe3['id'];if(_0x309659['query']['filter']){_0x166365[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x166365[_0x60d4('0x53')],{'$or':_[_0x60d4('0x41')](_0x166365[_0x60d4('0x4d')],function(_0x3762fc){var _0x2560a3={};_0x2560a3[_0x3762fc]={'$like':'%'+_0x309659['query'][_0x60d4('0x55')]+'%'};return _0x2560a3;})});}_0x166365=_[_0x60d4('0x56')]({},_0x166365,_0x309659[_0x60d4('0x58')]);return db[_0x60d4('0x75')][_0x60d4('0x59')]({'where':_0x166365[_0x60d4('0x53')]})[_0x60d4('0x23')](function(_0x3bdf84){_0x3c8923[_0x60d4('0x59')]=_0x3bdf84;if(_0x309659[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x166365['include']=[{'model':db[_0x60d4('0x78')],'as':_0x60d4('0x79'),'required':![]},{'model':db[_0x60d4('0x7a')],'as':'Owner','attributes':[_0x60d4('0x47'),'fullname',_0x60d4('0x7b')],'required':![]},{'model':db[_0x60d4('0x7c')],'as':_0x60d4('0x7d'),'attributes':['id',_0x60d4('0x47'),_0x60d4('0x7e')],'where':_0x309659[_0x60d4('0x48')][_0x60d4('0x7f')]?{'id':_0x309659[_0x60d4('0x48')][_0x60d4('0x7f')]}:undefined,'required':_0x309659['query'][_0x60d4('0x7f')]?!![]:![]}];}return db[_0x60d4('0x75')][_0x60d4('0x5c')](_0x166365);})['then'](function(_0x25245a){_0x3c8923[_0x60d4('0x5d')]=_0x25245a;return _0x3c8923;});}})[_0x60d4('0x23')](respondWithFilteredResult(_0x31fc82,_0x166365))[_0x60d4('0x2d')](handleError(_0x31fc82,null));};exports[_0x60d4('0x80')]=function(_0x1de918,_0x62df4){var _0x122fdc=_0x1de918[_0x60d4('0x5f')]['id'];var _0x558e6d=_0x1de918['body'];var _0x4a6ac4=0xc8;var _0x25ddf4=null;return db[_0x60d4('0x81')]['transaction']({'isolationLevel':db[_0x60d4('0x81')][_0x60d4('0x82')][_0x60d4('0x83')]['READ_COMMITTED']},function(_0x5bab58){return db[_0x60d4('0x42')][_0x60d4('0x84')]({'where':{'id':_0x122fdc},'transaction':_0x5bab58})[_0x60d4('0x23')](function(_0x3159a7){if(_0x3159a7){return db[_0x60d4('0x85')][_0x60d4('0x39')]({'where':{'FaxAccountId':_0x122fdc},'transaction':_0x5bab58})[_0x60d4('0x23')](function(){var _0x2b7a1e=_[_0x60d4('0x41')](_0x558e6d,function(_0x30d355){_0x30d355[_0x60d4('0x6c')]=_0x122fdc;return _0x30d355;});return db['FaxApplication'][_0x60d4('0x86')](_0x2b7a1e,{'transaction':_0x5bab58});});}else{_0x4a6ac4=0x194;_0x25ddf4=[];}});})[_0x60d4('0x23')](function(){if(_0x4a6ac4!==0x194){return db[_0x60d4('0x85')][_0x60d4('0x87')]({'where':{'FaxAccountId':_0x122fdc},'order':_0x60d4('0x88')})['then'](function(_0x1f2508){_0x25ddf4=_0x1f2508;});}})[_0x60d4('0x2d')](function(_0x4b2d23){_0x4a6ac4=0x1f4;logger['error'](_0x4b2d23['stack']);if(_0x4b2d23['name']){delete _0x4b2d23[_0x60d4('0x47')];}_0x25ddf4=_0x4b2d23;})['finally'](function(){if(_0x25ddf4===null){_0x62df4[_0x60d4('0x2e')](_0x4a6ac4);}else{if(_0x4a6ac4===0x1f4){_0x62df4[_0x60d4('0x2f')](_0x4a6ac4)[_0x60d4('0x3e')](_0x25ddf4);}else{_0x62df4[_0x60d4('0x2f')](_0x4a6ac4)[_0x60d4('0x30')](_0x25ddf4);}}});};exports[_0x60d4('0x89')]=function(_0x14eda4,_0x50a8cc,_0x2802e8){var _0x3cee3c={};var _0xd6069c={};var _0x4d6874;var _0x4dc7a4;return db[_0x60d4('0x42')][_0x60d4('0x84')]({'where':{'id':_0x14eda4[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x50a8cc,null))[_0x60d4('0x23')](function(_0x26b6f5){if(_0x26b6f5){_0x4d6874=_0x26b6f5;_0xd6069c['model']=_[_0x60d4('0x49')](db['FaxApplication']['rawAttributes']);_0xd6069c[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x14eda4[_0x60d4('0x48')]);_0xd6069c['filters']=_['intersection'](_0xd6069c[_0x60d4('0x46')],_0xd6069c['query']);_0x3cee3c[_0x60d4('0x4d')]=_[_0x60d4('0x4b')](_0xd6069c[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x14eda4['query'][_0x60d4('0x4c')]));_0x3cee3c[_0x60d4('0x4d')]=_0x3cee3c[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x3cee3c[_0x60d4('0x4d')]:_0xd6069c[_0x60d4('0x46')];_0x3cee3c[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x14eda4[_0x60d4('0x48')][_0x60d4('0x52')]);_0x3cee3c[_0x60d4('0x53')]=qs[_0x60d4('0x4a')](_['pick'](_0x14eda4[_0x60d4('0x48')],_0xd6069c[_0x60d4('0x4a')]));if(_0x14eda4[_0x60d4('0x48')]['filter']){_0x3cee3c[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x3cee3c[_0x60d4('0x53')],{'$or':_['map'](_0x3cee3c[_0x60d4('0x4d')],function(_0x2a7abd){var _0x1d9a14={};_0x1d9a14[_0x2a7abd]={'$like':'%'+_0x14eda4[_0x60d4('0x48')][_0x60d4('0x55')]+'%'};return _0x1d9a14;})});}_0x3cee3c=_[_0x60d4('0x56')]({},_0x3cee3c,_0x14eda4[_0x60d4('0x58')]);return _0x4d6874[_0x60d4('0x89')](_0x3cee3c);}})[_0x60d4('0x23')](function(_0x94f09){if(_0x94f09){_0x4dc7a4=_0x94f09[_0x60d4('0x4e')];if(!_0x14eda4[_0x60d4('0x48')][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x3cee3c[_0x60d4('0x32')]=qs['limit'](_0x14eda4[_0x60d4('0x48')][_0x60d4('0x32')]);_0x3cee3c[_0x60d4('0x33')]=qs['offset'](_0x14eda4[_0x60d4('0x48')][_0x60d4('0x33')]);}return _0x4d6874[_0x60d4('0x89')](_0x3cee3c);}})[_0x60d4('0x23')](function(_0x5d1835){if(_0x5d1835){return _0x5d1835?{'count':_0x4dc7a4,'rows':_0x5d1835}:null;}})[_0x60d4('0x23')](respondWithResult(_0x50a8cc,null))['catch'](handleError(_0x50a8cc,null));};function Extension(_0x404613,_0x2d17cd,_0x13f814,_0x38a2f5){this[_0x60d4('0x8a')]=_0x60d4('0x8b');this[_0x60d4('0x8c')]=_0x404613['localstationid'];this['app']=_0x38a2f5;this[_0x60d4('0x45')]=_0x60d4('0x8d');this[_0x60d4('0x8e')]='Fax\x20Extension';this[_0x60d4('0x6c')]=_0x404613['id'];this[_0x60d4('0x88')]=_0x2d17cd;this['appdata']=_0x13f814;}function createExtensionsReciveFax(_0x488ae0){var _0xe7dba2=0x1;var _0x19e23e=[];_0x19e23e['push'](new Extension(_0x488ae0,_0xe7dba2,'','Answer'));_0xe7dba2+=0x1;_0x19e23e[_0x60d4('0x8f')](new Extension(_0x488ae0,_0xe7dba2,_0x60d4('0x90'),_0x60d4('0x91')));_0xe7dba2+=0x1;for(var _0x36856e in _0x488ae0){if(_0x488ae0[_0x60d4('0x4f')](_0x36856e)&&(_0x36856e===_0x60d4('0x92')||_0x36856e===_0x60d4('0x93')||_0x36856e==='gateway'||_0x36856e==='faxdetect'||_0x36856e===_0x60d4('0x94')||_0x36856e===_0x60d4('0x95')||_0x36856e===_0x60d4('0x96')||_0x36856e==='modem'||_0x36856e===_0x60d4('0x97'))){_0x19e23e['push'](new Extension(_0x488ae0,_0xe7dba2,_0x60d4('0x98')+_0x36856e+')='+_0x488ae0[_0x36856e],_0x60d4('0x91')));_0xe7dba2+=0x1;}}_0x19e23e[_0x60d4('0x8f')](new Extension(_0x488ae0,_0xe7dba2,'6',_0x60d4('0x99')));_0xe7dba2+=0x1;_0x19e23e['push'](new Extension(_0x488ae0,_0xe7dba2,'/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',_0x60d4('0x9a')));_0xe7dba2=0x0;return _0x19e23e;}exports[_0x60d4('0x9b')]=function(_0x54d03a,_0x139ada,_0x41a2d7){var _0x2b513e;return db[_0x60d4('0x81')][_0x60d4('0x9c')](function(_0x302a61){return db[_0x60d4('0x42')][_0x60d4('0x61')](_0x54d03a['body'],{'transaction':_0x302a61})[_0x60d4('0x23')](function(_0x38467e){_0x2b513e=_0x38467e[_0x60d4('0x3a')]({'plain':!![]});return db[_0x60d4('0x9d')][_0x60d4('0x86')](createExtensionsReciveFax(_0x2b513e),{'transaction':_0x302a61});});})[_0x60d4('0x23')](function(){return _0x2b513e;})[_0x60d4('0x23')](respondWithResult(_0x139ada,null))['catch'](handleError(_0x139ada,null));};exports[_0x60d4('0x9e')]=function(_0x594c8b,_0x110700,_0x4848d8){var _0x1af6e8;return db['sequelize'][_0x60d4('0x9c')](function(_0x1e74b0){return db[_0x60d4('0x42')][_0x60d4('0x38')](_0x594c8b[_0x60d4('0x62')],{'where':{'id':_0x594c8b[_0x60d4('0x62')]['id']},'transaction':_0x1e74b0})[_0x60d4('0x23')](function(_0x4b139a){return db[_0x60d4('0x9d')]['destroy']({'where':{'FaxAccountId':_0x594c8b[_0x60d4('0x62')]['id']},'transaction':_0x1e74b0})[_0x60d4('0x23')](function(_0x3cd66b){return db[_0x60d4('0x9d')][_0x60d4('0x86')](createExtensionsReciveFax(_[_0x60d4('0x76')](_0x594c8b[_0x60d4('0x62')],['tech',_0x60d4('0x9f'),_0x60d4('0xa0'),_0x60d4('0xa1'),'TrunkId',_0x60d4('0xa2')])),{'transaction':_0x1e74b0});});});})['then'](function(){return db[_0x60d4('0x42')][_0x60d4('0xa3')](_0x594c8b['body']['id']);})[_0x60d4('0x23')](respondWithResult(_0x110700,null))['catch'](handleError(_0x110700,null));};exports[_0x60d4('0xa4')]=function(_0xf10794,_0x1a45b9,_0x465778){var _0x57861f={'raw':!![],'where':{}};var _0x2aadcc={};var _0x40dd97={'count':0x0,'rows':[]};return db[_0x60d4('0x42')][_0x60d4('0x84')]({'where':{'id':_0xf10794[_0x60d4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1a45b9,null))['then'](function(_0x1c7763){if(_0x1c7763){_0x2aadcc[_0x60d4('0x46')]=_[_0x60d4('0x49')](db['FaxMessage']['rawAttributes']);_0x2aadcc[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0xf10794[_0x60d4('0x48')]);_0x2aadcc[_0x60d4('0x4a')]=_[_0x60d4('0x4b')](_0x2aadcc[_0x60d4('0x46')],_0x2aadcc[_0x60d4('0x48')]);_0x57861f[_0x60d4('0x4d')]=_['intersection'](_0x2aadcc['model'],qs[_0x60d4('0x4c')](_0xf10794['query'][_0x60d4('0x4c')]));_0x57861f[_0x60d4('0x4d')]=_0x57861f[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x57861f[_0x60d4('0x4d')]:_0x2aadcc['model'];if(!_0xf10794[_0x60d4('0x48')][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x57861f['limit']=qs[_0x60d4('0x32')](_0xf10794[_0x60d4('0x48')][_0x60d4('0x32')]);_0x57861f[_0x60d4('0x33')]=qs[_0x60d4('0x33')](_0xf10794['query'][_0x60d4('0x33')]);}_0x57861f[_0x60d4('0x51')]=qs['sort'](_0xf10794[_0x60d4('0x48')]['sort']);_0x57861f[_0x60d4('0x53')]=qs['filters'](_[_0x60d4('0x54')](_0xf10794['query'],_0x2aadcc[_0x60d4('0x4a')]));_0x57861f['where'][_0x60d4('0x6c')]=_0x1c7763['id'];if(_0xf10794[_0x60d4('0x48')][_0x60d4('0x55')]){_0x57861f[_0x60d4('0x53')]=_[_0x60d4('0x56')](_0x57861f[_0x60d4('0x53')],{'$or':_['map'](_0x57861f['attributes'],function(_0x11b58c){var _0x1ba1f4={};_0x1ba1f4[_0x11b58c]={'$like':'%'+_0xf10794[_0x60d4('0x48')][_0x60d4('0x55')]+'%'};return _0x1ba1f4;})});}if(_0xf10794[_0x60d4('0x48')][_0x60d4('0xa5')]){var _0x24b9ef=_0xf10794[_0x60d4('0x48')][_0x60d4('0xa5')][_0x60d4('0xa6')](',');var _0x2ab635={};_0x2ab635[_0x24b9ef[0x0]]={'$gte':moment(_0x24b9ef[0x1])[_0x60d4('0xa7')](_0x60d4('0xa8'))};_0x57861f['where']=_[_0x60d4('0x56')](_0x57861f['where'],_0x2ab635);}_0x57861f=_['merge']({},_0x57861f,_0xf10794[_0x60d4('0x58')]);return db[_0x60d4('0xa9')][_0x60d4('0x59')]({'where':_0x57861f[_0x60d4('0x53')]})['then'](function(_0xa7ec22){_0x40dd97[_0x60d4('0x59')]=_0xa7ec22;if(_0xf10794[_0x60d4('0x48')][_0x60d4('0x5a')]){_0x57861f[_0x60d4('0x5b')]=[{'all':!![]}];}return db['FaxMessage'][_0x60d4('0x5c')](_0x57861f);})[_0x60d4('0x23')](function(_0x13b65c){_0x40dd97[_0x60d4('0x5d')]=_0x13b65c;return _0x40dd97;});}})[_0x60d4('0x23')](respondWithFilteredResult(_0x1a45b9,_0x57861f))['catch'](handleError(_0x1a45b9,null));};exports[_0x60d4('0x3e')]=function(_0x3fad71,_0x698caa,_0x531202){var _0x177e7c,_0x34857a={},_0x2d9ebc;if(_0x3fad71[_0x60d4('0x62')]['to']){_0x2d9ebc=_0x3fad71[_0x60d4('0x62')]['to'][0x0];}return db['FaxAccount'][_0x60d4('0x60')]({'where':{'id':_0x3fad71['params']['id']},'include':[{'model':db[_0x60d4('0xaa')],'as':_0x60d4('0xab'),'include':[{'model':db[_0x60d4('0x78')],'as':_0x60d4('0xac'),'where':{'fax':_0x2d9ebc},'limit':0x1,'order':[[_0x60d4('0xa1'),_0x60d4('0xad')]]}]}]})[_0x60d4('0x23')](handleEntityNotFound(_0x698caa,null))[_0x60d4('0x23')](function(_0x38469a){_0x177e7c=_0x38469a;if(_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')]&&_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x60d4('0x4e')]){for(var _0x50055f=0x0;_0x50055f<_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x60d4('0x4e')];_0x50055f+=0x1){_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x50055f]={'filename':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x50055f][_0x60d4('0x47')],'id':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][_0x50055f]['id'],'path':path[_0x60d4('0xaf')](config[_0x60d4('0xb0')],_0x60d4('0xb1'),_0x3fad71['body']['attachments'][_0x50055f]['basename'])};}}return respondWithRpcPromise(_0x60d4('0xb2'),_0x60d4('0xb2'),{'FaxAccountId':_['isNil'](_0x3fad71[_0x60d4('0x5f')]['id'])?undefined:_0x3fad71[_0x60d4('0x5f')]['id'],'path':_['isNil'](_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0][_0x60d4('0x7')])?undefined:_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0][_0x60d4('0x7')],'fax':_[_0x60d4('0xb3')](_0x3fad71[_0x60d4('0x62')]['to'][0x0])?undefined:_0x3fad71['body']['to'][0x0]},client9002);})[_0x60d4('0x23')](function(){if(_0x177e7c){if(_[_0x60d4('0xb3')](_0x3fad71[_0x60d4('0x62')][_0x60d4('0xb4')])){_0x3fad71[_0x60d4('0x62')][_0x60d4('0xb4')]=util['format']('\x22%s\x22\x20<%s>',_0x177e7c[_0x60d4('0x47')],_0x177e7c[_0x60d4('0xb5')]);}if(_0x177e7c[_0x60d4('0xab')]){if(_0x177e7c[_0x60d4('0xab')]['Contacts']['length']){return _0x177e7c[_0x60d4('0xab')]['Contacts'][0x0];}else{return db['CmContact'][_0x60d4('0x61')](_[_0x60d4('0x1a')](_0x3fad71['body'],{'firstName':_0x3fad71[_0x60d4('0x62')]['to'][0x0],'phone':_0x3fad71['body']['to'][0x0],'fax':_0x3fad71[_0x60d4('0x62')]['to'][0x0],'ListId':_0x177e7c[_0x60d4('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x60d4('0xb6'));}})['then'](function(_0x498620){if(_0x498620){return db[_0x60d4('0x75')][_0x60d4('0x60')]({'where':{'ContactId':_0x498620['id'],'closed':![],'FaxAccountId':_0x177e7c['id']}})['then'](function(_0x352424){if(_0x352424){return[_0x352424,![]];}return db['FaxInteraction']['create']({'UserId':_0x3fad71[_0x60d4('0x63')]['id'],'ContactId':_0x498620['id'],'FaxAccountId':_0x177e7c['id'],'fax':_0x3fad71[_0x60d4('0x62')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x60d4('0x56')](_0x3fad71['body'],{'read':![],'body':_0x3fad71['body'][_0x60d4('0xae')][0x0][_0x60d4('0xb7')],'FaxAccountId':_0x177e7c['id'],'UserId':_0x3fad71[_0x60d4('0x63')]['id'],'ContactId':_0x498620['id'],'AttachmentId':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x60d4('0xa9')],'as':_0x60d4('0xb8')}]})['then'](function(_0x3bd029){return[_0x3bd029,!![]];});});}else{throw new Error(_0x60d4('0xb9'));}})['spread'](function(_0x2d05e0,_0xdbe44c){if(_0xdbe44c){return _0x2d05e0;}return db['FaxMessage'][_0x60d4('0x61')]({'direction':_0x60d4('0xba'),'read':![],'body':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0][_0x60d4('0xb7')],'FaxAccountId':_0x177e7c['id'],'FaxInteractionId':_0x2d05e0['id'],'UserId':_0x3fad71[_0x60d4('0x63')]['id'],'ContactId':_0x2d05e0['ContactId'],'AttachmentId':_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0]['id']})[_0x60d4('0x23')](function(_0xa31763){_0x2d05e0['dataValues']['Messages']=[];_0x2d05e0[_0x60d4('0xbb')][_0x60d4('0xb8')][_0x60d4('0x8f')](_0xa31763[_0x60d4('0xbb')]);return _0x2d05e0;});})['then'](function(_0x6fbfe4){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x3fad71[_0x60d4('0x5f')]['id'])?undefined:_0x3fad71[_0x60d4('0x5f')]['id'],'path':_[_0x60d4('0xb3')](_0x3fad71[_0x60d4('0x62')][_0x60d4('0xae')][0x0][_0x60d4('0x7')])?undefined:_0x3fad71['body']['attachments'][0x0][_0x60d4('0x7')],'fax':_[_0x60d4('0xb3')](_0x3fad71[_0x60d4('0x62')]['to'][0x0])?undefined:_0x3fad71[_0x60d4('0x62')]['to'][0x0],'AttachmentId':_0x3fad71[_0x60d4('0x62')]['attachments'][0x0]['id']},client9002)[_0x60d4('0x23')](function(_0x2f05cf){logger[_0x60d4('0x24')](_0x60d4('0xbc'),_0x2f05cf);})[_0x60d4('0x2d')](function(_0x19ef1a){logger[_0x60d4('0x24')](_0x60d4('0xbc'),_0x19ef1a);});return _0x6fbfe4;})['then'](respondWithResult(_0x698caa,null))[_0x60d4('0x2d')](handleError(_0x698caa,null));};exports[_0x60d4('0xbd')]=function(_0x3787b3,_0x3514d6,_0x334087){return db[_0x60d4('0x42')][_0x60d4('0x60')]({'where':{'id':_0x3787b3[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x3514d6,null))[_0x60d4('0x23')](function(_0x54b327){if(_0x54b327){return _0x54b327[_0x60d4('0xbd')](_0x3787b3[_0x60d4('0x62')]['ids'],_['omit'](_0x3787b3[_0x60d4('0x62')],[_0x60d4('0x70'),'id'])||{})[_0x60d4('0xbe')](function(_0x10724d){for(var _0x550549=0x0;_0x550549<_0x3787b3[_0x60d4('0x62')]['ids'][_0x60d4('0x4e')];_0x550549+=0x1){socket[_0x60d4('0xbf')](_0x60d4('0xc0'),{'UserId':Number(_0x3787b3[_0x60d4('0x62')][_0x60d4('0x70')][_0x550549]),'FaxAccountId':Number(_0x3787b3[_0x60d4('0x5f')]['id'])});}return _0x10724d;});}})[_0x60d4('0x23')](respondWithResult(_0x3514d6,null))[_0x60d4('0x2d')](handleError(_0x3514d6,null));};exports[_0x60d4('0xc1')]=function(_0x5eaa6e,_0x57d8a9,_0x5a9eb5){return db[_0x60d4('0x42')][_0x60d4('0x60')]({'where':{'id':_0x5eaa6e[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x57d8a9,null))['then'](function(_0x47fcbd){if(_0x47fcbd){return _0x47fcbd[_0x60d4('0xc1')](_0x5eaa6e['query'][_0x60d4('0x70')])[_0x60d4('0x23')](function(){if(_[_0x60d4('0xc2')](_0x5eaa6e[_0x60d4('0x48')][_0x60d4('0x70')])){for(var _0xcd715e=0x0;_0xcd715e<_0x5eaa6e[_0x60d4('0x48')][_0x60d4('0x70')]['length'];_0xcd715e+=0x1){socket['emit'](_0x60d4('0xc3'),{'UserId':Number(_0x5eaa6e['query'][_0x60d4('0x70')][_0xcd715e]),'FaxAccountId':Number(_0x5eaa6e[_0x60d4('0x5f')]['id'])});}}else{socket[_0x60d4('0xbf')](_0x60d4('0xc3'),{'UserId':Number(_0x5eaa6e['query'][_0x60d4('0x70')]),'FaxAccountId':Number(_0x5eaa6e[_0x60d4('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x57d8a9,null))[_0x60d4('0x2d')](handleError(_0x57d8a9,null));};exports[_0x60d4('0xc4')]=function(_0x1a9341,_0x45de3b,_0x2b4d15){var _0x1d4c3a={};var _0x11872c={};var _0x5660f5;var _0x5f463b;return db[_0x60d4('0x42')][_0x60d4('0x84')]({'where':{'id':_0x1a9341[_0x60d4('0x5f')]['id']}})[_0x60d4('0x23')](handleEntityNotFound(_0x45de3b,null))[_0x60d4('0x23')](function(_0x4306c7){if(_0x4306c7){_0x5660f5=_0x4306c7;_0x11872c[_0x60d4('0x46')]=_[_0x60d4('0x49')](db[_0x60d4('0x7a')][_0x60d4('0x43')]);_0x11872c[_0x60d4('0x48')]=_[_0x60d4('0x49')](_0x1a9341['query']);_0x11872c[_0x60d4('0x4a')]=_['intersection'](_0x11872c[_0x60d4('0x46')],_0x11872c[_0x60d4('0x48')]);_0x1d4c3a['attributes']=_[_0x60d4('0x4b')](_0x11872c[_0x60d4('0x46')],qs[_0x60d4('0x4c')](_0x1a9341[_0x60d4('0x48')][_0x60d4('0x4c')]));_0x1d4c3a[_0x60d4('0x4d')]=_0x1d4c3a[_0x60d4('0x4d')][_0x60d4('0x4e')]?_0x1d4c3a[_0x60d4('0x4d')]:_0x11872c[_0x60d4('0x46')];_0x1d4c3a[_0x60d4('0x51')]=qs[_0x60d4('0x52')](_0x1a9341['query'][_0x60d4('0x52')]);_0x1d4c3a['where']=qs[_0x60d4('0x4a')](_[_0x60d4('0x54')](_0x1a9341[_0x60d4('0x48')],_0x11872c[_0x60d4('0x4a')]));if(_0x1a9341[_0x60d4('0x48')][_0x60d4('0x55')]){_0x1d4c3a[_0x60d4('0x53')]=_['merge'](_0x1d4c3a[_0x60d4('0x53')],{'$or':_[_0x60d4('0x41')](_0x1d4c3a[_0x60d4('0x4d')],function(_0x42b8c3){var _0x41bc00={};_0x41bc00[_0x42b8c3]={'$like':'%'+_0x1a9341[_0x60d4('0x48')]['filter']+'%'};return _0x41bc00;})});}_0x1d4c3a=_['merge']({},_0x1d4c3a,_0x1a9341['options']);return _0x5660f5[_0x60d4('0xc4')](_0x1d4c3a);}})[_0x60d4('0x23')](function(_0x55556){if(_0x55556){_0x5f463b=_0x55556['length'];if(!_0x1a9341['query'][_0x60d4('0x4f')](_0x60d4('0x50'))){_0x1d4c3a['limit']=qs[_0x60d4('0x32')](_0x1a9341[_0x60d4('0x48')]['limit']);_0x1d4c3a['offset']=qs[_0x60d4('0x33')](_0x1a9341[_0x60d4('0x48')]['offset']);}return _0x5660f5[_0x60d4('0xc4')](_0x1d4c3a);}})[_0x60d4('0x23')](function(_0xdaceaa){if(_0xdaceaa){return _0xdaceaa?{'count':_0x5f463b,'rows':_0xdaceaa}:null;}})[_0x60d4('0x23')](respondWithResult(_0x45de3b,null))['catch'](handleError(_0x45de3b,null));}; \ No newline at end of file +var _0xbcd8=['priority','json','getApplications','context','from-voip-provider','exten','localstationid','system','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','minrate','modem','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','updatedAt','attachments','join','root','basename','isNil','from','\x22%s\x22\x20<%s>','defaults','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','findAll','rows','show','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','mandatoryDispositionPause','describe','FaxAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','findOne','CmContact','Contact','User','internal','Tag','Tags','color','tag','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate'];(function(_0x29da5a,_0xcd28eb){var _0x5deac7=function(_0x50986b){while(--_0x50986b){_0x29da5a['push'](_0x29da5a['shift']());}};_0x5deac7(++_0xcd28eb);}(_0xbcd8,0x106));var _0x8bcd=function(_0x92116d,_0xa6ee1b){_0x92116d=_0x92116d-0x0;var _0xfe4f60=_0xbcd8[_0x92116d];return _0xfe4f60;};'use strict';var emlformat=require(_0x8bcd('0x0'));var rimraf=require(_0x8bcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bcd('0x2'));var rp=require(_0x8bcd('0x3'));var moment=require(_0x8bcd('0x4'));var BPromise=require(_0x8bcd('0x5'));var Mustache=require(_0x8bcd('0x6'));var util=require(_0x8bcd('0x7'));var path=require(_0x8bcd('0x8'));var sox=require(_0x8bcd('0x9'));var csv=require(_0x8bcd('0xa'));var ejs=require(_0x8bcd('0xb'));var fs=require('fs');var fs_extra=require(_0x8bcd('0xc'));var _=require(_0x8bcd('0xd'));var squel=require('squel');var crypto=require(_0x8bcd('0xe'));var jsforce=require(_0x8bcd('0xf'));var deskjs=require(_0x8bcd('0x10'));var toCsv=require(_0x8bcd('0xa'));var querystring=require(_0x8bcd('0x11'));var Papa=require(_0x8bcd('0x12'));var Redis=require(_0x8bcd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8bcd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bcd('0x15'));var logger=require(_0x8bcd('0x16'))('api');var utils=require(_0x8bcd('0x17'));var config=require(_0x8bcd('0x18'));var licenseUtil=require(_0x8bcd('0x19'));var db=require(_0x8bcd('0x1a'))['db'];config[_0x8bcd('0x1b')]=_['defaults'](config['redis'],{'host':_0x8bcd('0x1c'),'port':0x18eb});var socket=require(_0x8bcd('0x1d'))(new Redis(config[_0x8bcd('0x1b')]));require(_0x8bcd('0x1e'))[_0x8bcd('0x1f')](socket);var jayson=require(_0x8bcd('0x20'));var client=jayson[_0x8bcd('0x21')][_0x8bcd('0x22')]({'port':0x232c});var client9002=jayson[_0x8bcd('0x21')][_0x8bcd('0x22')]({'port':0x232a});function respondWithRpcPromise(_0xc6c64a,_0x31d772,_0x3edb3c,_0x5d62fe){return new BPromise(function(_0x3da1f9,_0x4d3d7c){var _0x3d9b68=_0x5d62fe||client;return _0x3d9b68[_0x8bcd('0x23')](_0xc6c64a,_0x3edb3c)[_0x8bcd('0x24')](function(_0x2a7dd4){logger[_0x8bcd('0x25')](_0x8bcd('0x26'),_0x31d772,_0x8bcd('0x27'));logger['debug'](_0x8bcd('0x28'),_0x31d772,_0x8bcd('0x27'),JSON[_0x8bcd('0x29')](_0x2a7dd4));if(_0x2a7dd4[_0x8bcd('0x2a')]){if(_0x2a7dd4[_0x8bcd('0x2a')][_0x8bcd('0x2b')]===0x1f4){logger[_0x8bcd('0x2a')](_0x8bcd('0x26'),_0x31d772,_0x2a7dd4[_0x8bcd('0x2a')][_0x8bcd('0x2c')]);return _0x4d3d7c(_0x2a7dd4[_0x8bcd('0x2a')][_0x8bcd('0x2c')]);}logger[_0x8bcd('0x2a')](_0x8bcd('0x26'),_0x31d772,_0x2a7dd4[_0x8bcd('0x2a')]['message']);return _0x3da1f9(_0x2a7dd4[_0x8bcd('0x2a')][_0x8bcd('0x2c')]);}else{logger[_0x8bcd('0x25')](_0x8bcd('0x26'),_0x31d772,'request\x20sent');_0x3da1f9(_0x2a7dd4[_0x8bcd('0x2d')][_0x8bcd('0x2c')]);}})[_0x8bcd('0x2e')](function(_0x3feff0){logger[_0x8bcd('0x2a')](_0x8bcd('0x26'),_0x31d772,_0x3feff0);_0x4d3d7c(_0x3feff0);});});}function respondWithStatusCode(_0x2b0bee,_0x7fc3e0){_0x7fc3e0=_0x7fc3e0||0xcc;return function(_0x2f1896){if(_0x2f1896){return _0x2b0bee[_0x8bcd('0x2f')](_0x7fc3e0);}return _0x2b0bee[_0x8bcd('0x30')](_0x7fc3e0)[_0x8bcd('0x31')]();};}function respondWithResult(_0xe06794,_0x58d3b1){_0x58d3b1=_0x58d3b1||0xc8;return function(_0x5699ea){if(_0x5699ea){return _0xe06794[_0x8bcd('0x30')](_0x58d3b1)['json'](_0x5699ea);}};}function respondWithFilteredResult(_0x2ed04d,_0x5ede4f){return function(_0x248b9d){if(_0x248b9d){var _0xe0c4a2=typeof _0x5ede4f[_0x8bcd('0x32')]===_0x8bcd('0x33')&&typeof _0x5ede4f[_0x8bcd('0x34')]===_0x8bcd('0x33');var _0x2723b6=_0x248b9d['count'];var _0x12ba38=_0xe0c4a2?0x0:_0x5ede4f[_0x8bcd('0x32')];var _0x5ab72a=_0xe0c4a2?_0x248b9d[_0x8bcd('0x35')]:_0x5ede4f[_0x8bcd('0x32')]+_0x5ede4f[_0x8bcd('0x34')];var _0x42c872;if(_0x5ab72a>=_0x2723b6){_0x5ab72a=_0x2723b6;_0x42c872=0xc8;}else{_0x42c872=0xce;}_0x2ed04d[_0x8bcd('0x30')](_0x42c872);return _0x2ed04d['set']('Content-Range',_0x12ba38+'-'+_0x5ab72a+'/'+_0x2723b6)['json'](_0x248b9d);}return null;};}function patchUpdates(_0x100f90){return function(_0x523a80){try{jsonpatch[_0x8bcd('0x36')](_0x523a80,_0x100f90,!![]);}catch(_0x296801){return BPromise[_0x8bcd('0x37')](_0x296801);}return _0x523a80[_0x8bcd('0x38')]();};}function saveUpdates(_0x2f375c,_0x14e0ba){return function(_0x5e6241){if(_0x5e6241){return _0x5e6241[_0x8bcd('0x39')](_0x2f375c)[_0x8bcd('0x24')](function(_0x49094c){return _0x49094c;});}return null;};}function removeEntity(_0x55c6fd,_0xa52603){return function(_0x11ff1c){if(_0x11ff1c){return _0x11ff1c[_0x8bcd('0x3a')]()[_0x8bcd('0x24')](function(){var _0x833b4b=_0x11ff1c[_0x8bcd('0x3b')]({'plain':!![]});var _0x20bfee=_0x8bcd('0x3c');return db[_0x8bcd('0x3d')][_0x8bcd('0x3a')]({'where':{'type':_0x20bfee,'resourceId':_0x833b4b['id']}})[_0x8bcd('0x24')](function(){return _0x11ff1c;});})[_0x8bcd('0x24')](function(){_0x55c6fd[_0x8bcd('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10d3aa,_0x189a1f){return function(_0x4ccc0e){if(!_0x4ccc0e){_0x10d3aa[_0x8bcd('0x2f')](0x194);}return _0x4ccc0e;};}function handleError(_0x4a1640,_0x10c519){_0x10c519=_0x10c519||0x1f4;return function(_0x56f464){logger[_0x8bcd('0x2a')](_0x56f464[_0x8bcd('0x3e')]);if(_0x56f464[_0x8bcd('0x3f')]){delete _0x56f464[_0x8bcd('0x3f')];}_0x4a1640[_0x8bcd('0x30')](_0x10c519)[_0x8bcd('0x40')](_0x56f464);};}exports['index']=function(_0x18c84e,_0x142026){var _0x2c3f4b={'include':[{'model':db[_0x8bcd('0x41')],'as':'mandatoryDispositionPause'}]},_0x114277={},_0x576643={'count':0x0,'rows':[]};var _0xa242ca=_[_0x8bcd('0x42')](db['FaxAccount'][_0x8bcd('0x43')],function(_0x2fd9d4){return{'name':_0x2fd9d4[_0x8bcd('0x44')],'type':_0x2fd9d4[_0x8bcd('0x45')][_0x8bcd('0x46')]};});_0x114277[_0x8bcd('0x47')]=_[_0x8bcd('0x42')](_0xa242ca,_0x8bcd('0x3f'));_0x114277[_0x8bcd('0x48')]=_[_0x8bcd('0x49')](_0x18c84e[_0x8bcd('0x48')]);_0x114277[_0x8bcd('0x4a')]=_[_0x8bcd('0x4b')](_0x114277[_0x8bcd('0x47')],_0x114277['query']);_0x2c3f4b[_0x8bcd('0x4c')]=_[_0x8bcd('0x4b')](_0x114277[_0x8bcd('0x47')],qs[_0x8bcd('0x4d')](_0x18c84e[_0x8bcd('0x48')][_0x8bcd('0x4d')]));_0x2c3f4b[_0x8bcd('0x4c')]=_0x2c3f4b['attributes']['length']?_0x2c3f4b[_0x8bcd('0x4c')]:_0x114277['model'];if(!_0x18c84e[_0x8bcd('0x48')][_0x8bcd('0x4e')](_0x8bcd('0x4f'))){_0x2c3f4b[_0x8bcd('0x34')]=qs[_0x8bcd('0x34')](_0x18c84e[_0x8bcd('0x48')][_0x8bcd('0x34')]);_0x2c3f4b[_0x8bcd('0x32')]=qs[_0x8bcd('0x32')](_0x18c84e[_0x8bcd('0x48')][_0x8bcd('0x32')]);}_0x2c3f4b['order']=qs[_0x8bcd('0x50')](_0x18c84e[_0x8bcd('0x48')][_0x8bcd('0x50')]);_0x2c3f4b[_0x8bcd('0x51')]=qs[_0x8bcd('0x4a')](_[_0x8bcd('0x52')](_0x18c84e[_0x8bcd('0x48')],_0x114277[_0x8bcd('0x4a')]),_0xa242ca);if(_0x18c84e[_0x8bcd('0x48')][_0x8bcd('0x53')]){_0x2c3f4b[_0x8bcd('0x51')]=_[_0x8bcd('0x54')](_0x2c3f4b[_0x8bcd('0x51')],{'$or':_[_0x8bcd('0x42')](_0xa242ca,function(_0x303784){if(_0x303784[_0x8bcd('0x45')]!==_0x8bcd('0x55')){var _0x4dab8a={};_0x4dab8a[_0x303784['name']]={'$like':'%'+_0x18c84e[_0x8bcd('0x48')][_0x8bcd('0x53')]+'%'};return _0x4dab8a;}})});}_0x2c3f4b=_[_0x8bcd('0x54')]({},_0x2c3f4b,_0x18c84e[_0x8bcd('0x56')]);var _0x7770d9={'where':_0x2c3f4b[_0x8bcd('0x51')]};return db[_0x8bcd('0x57')][_0x8bcd('0x35')](_0x7770d9)[_0x8bcd('0x24')](function(_0x1a56b4){_0x576643[_0x8bcd('0x35')]=_0x1a56b4;if(_0x18c84e[_0x8bcd('0x48')][_0x8bcd('0x58')]){_0x2c3f4b['include']=[{'all':!![]}];}return db['FaxAccount'][_0x8bcd('0x59')](_0x2c3f4b);})[_0x8bcd('0x24')](function(_0x552b9b){_0x576643[_0x8bcd('0x5a')]=_0x552b9b;return _0x576643;})['then'](respondWithFilteredResult(_0x142026,_0x2c3f4b))[_0x8bcd('0x2e')](handleError(_0x142026,null));};exports[_0x8bcd('0x5b')]=function(_0x4e64a3,_0x828a9c){var _0x1c1a06={'raw':![],'where':{'id':_0x4e64a3['params']['id']},'include':[{'model':db[_0x8bcd('0x41')],'as':'mandatoryDispositionPause'}]},_0x3c4314={};_0x3c4314[_0x8bcd('0x47')]=_[_0x8bcd('0x49')](db[_0x8bcd('0x57')][_0x8bcd('0x43')]);_0x3c4314[_0x8bcd('0x48')]=_[_0x8bcd('0x49')](_0x4e64a3['query']);_0x3c4314['filters']=_[_0x8bcd('0x4b')](_0x3c4314[_0x8bcd('0x47')],_0x3c4314[_0x8bcd('0x48')]);_0x1c1a06[_0x8bcd('0x4c')]=_[_0x8bcd('0x4b')](_0x3c4314[_0x8bcd('0x47')],qs['fields'](_0x4e64a3['query']['fields']));_0x1c1a06['attributes']=_0x1c1a06['attributes'][_0x8bcd('0x5c')]?_0x1c1a06[_0x8bcd('0x4c')]:_0x3c4314['model'];if(_0x4e64a3[_0x8bcd('0x48')]['includeAll']){_0x1c1a06[_0x8bcd('0x5d')]=[{'all':!![]}];}_0x1c1a06=_['merge']({},_0x1c1a06,_0x4e64a3[_0x8bcd('0x56')]);return db[_0x8bcd('0x57')]['find'](_0x1c1a06)[_0x8bcd('0x24')](handleEntityNotFound(_0x828a9c,null))['then'](respondWithResult(_0x828a9c,null))['catch'](handleError(_0x828a9c,null));};exports['create']=function(_0x2c6f5a,_0x31a2e8){return db[_0x8bcd('0x57')][_0x8bcd('0x5e')](_0x2c6f5a['body'],{})[_0x8bcd('0x24')](function(_0x11608b){var _0x225769=_0x2c6f5a[_0x8bcd('0x5f')]['get']({'plain':!![]});if(!_0x225769)throw new Error(_0x8bcd('0x60'));if(_0x225769['role']==='user'){var _0x50874d=_0x11608b[_0x8bcd('0x3b')]({'plain':!![]});var _0x269026=_0x8bcd('0x3c');return db[_0x8bcd('0x61')][_0x8bcd('0x62')]({'where':{'name':_0x269026,'userProfileId':_0x225769[_0x8bcd('0x63')]},'raw':!![]})[_0x8bcd('0x24')](function(_0x287e36){if(_0x287e36&&_0x287e36[_0x8bcd('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x50874d[_0x8bcd('0x3f')],'resourceId':_0x50874d['id'],'type':_0x287e36[_0x8bcd('0x3f')],'sectionId':_0x287e36['id']},{})[_0x8bcd('0x24')](function(){return _0x11608b;});}else{return _0x11608b;}})[_0x8bcd('0x2e')](function(_0x71dddd){logger[_0x8bcd('0x2a')](_0x8bcd('0x65'),_0x71dddd);throw _0x71dddd;});}return _0x11608b;})['then'](respondWithResult(_0x31a2e8,0xc9))['catch'](handleError(_0x31a2e8,null));};exports[_0x8bcd('0x39')]=function(_0x542de7,_0x1f525e){if(_0x542de7[_0x8bcd('0x66')]['id']){delete _0x542de7[_0x8bcd('0x66')]['id'];}return db[_0x8bcd('0x57')]['find']({'where':{'id':_0x542de7[_0x8bcd('0x67')]['id']},'include':[{'model':db[_0x8bcd('0x41')],'as':_0x8bcd('0x68')}]})[_0x8bcd('0x24')](handleEntityNotFound(_0x1f525e,null))['then'](saveUpdates(_0x542de7[_0x8bcd('0x66')],null))[_0x8bcd('0x24')](respondWithResult(_0x1f525e,null))[_0x8bcd('0x2e')](handleError(_0x1f525e,null));};exports[_0x8bcd('0x3a')]=function(_0x200c62,_0x40118a){return db['FaxAccount'][_0x8bcd('0x62')]({'where':{'id':_0x200c62[_0x8bcd('0x67')]['id']}})['then'](handleEntityNotFound(_0x40118a,null))[_0x8bcd('0x24')](removeEntity(_0x40118a,null))[_0x8bcd('0x2e')](handleError(_0x40118a,null));};exports[_0x8bcd('0x69')]=function(_0x55607f,_0x19acfc){return db[_0x8bcd('0x57')][_0x8bcd('0x69')]()[_0x8bcd('0x24')](respondWithResult(_0x19acfc,null))['catch'](handleError(_0x19acfc,null));};exports['addDisposition']=function(_0x3b3a51,_0x3bc814,_0xd7d177){if(_0x3b3a51[_0x8bcd('0x66')]['id']){delete _0x3b3a51[_0x8bcd('0x66')]['id'];}return db[_0x8bcd('0x57')][_0x8bcd('0x62')]({'where':{'id':_0x3b3a51['params']['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x3bc814,null))[_0x8bcd('0x24')](function(_0x5e0482){if(_0x5e0482){_0x3b3a51[_0x8bcd('0x66')][_0x8bcd('0x6a')]=_0x5e0482['id'];return db[_0x8bcd('0x6b')]['create'](_0x3b3a51['body']);}})[_0x8bcd('0x24')](respondWithResult(_0x3bc814,null))['catch'](handleError(_0x3bc814,null));};exports[_0x8bcd('0x6c')]=function(_0x4727b5,_0x32a85f,_0x2bdc39){var _0xf367d8={'raw':![],'where':{}};var _0x4a5ead={};var _0x7e70f6={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4727b5[_0x8bcd('0x67')]['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x32a85f,null))[_0x8bcd('0x24')](function(_0x232edc){if(_0x232edc){_0x4a5ead[_0x8bcd('0x47')]=_[_0x8bcd('0x49')](db[_0x8bcd('0x6b')]['rawAttributes']);_0x4a5ead[_0x8bcd('0x48')]=_[_0x8bcd('0x49')](_0x4727b5['query']);_0x4a5ead['filters']=_['intersection'](_0x4a5ead['model'],_0x4a5ead['query']);_0xf367d8[_0x8bcd('0x4c')]=_[_0x8bcd('0x4b')](_0x4a5ead['model'],qs[_0x8bcd('0x4d')](_0x4727b5[_0x8bcd('0x48')]['fields']));_0xf367d8[_0x8bcd('0x4c')]=_0xf367d8[_0x8bcd('0x4c')][_0x8bcd('0x5c')]?_0xf367d8[_0x8bcd('0x4c')]:_0x4a5ead[_0x8bcd('0x47')];if(!_0x4727b5[_0x8bcd('0x48')][_0x8bcd('0x4e')](_0x8bcd('0x4f'))){_0xf367d8[_0x8bcd('0x34')]=qs[_0x8bcd('0x34')](_0x4727b5['query'][_0x8bcd('0x34')]);_0xf367d8[_0x8bcd('0x32')]=qs[_0x8bcd('0x32')](_0x4727b5[_0x8bcd('0x48')]['offset']);}_0xf367d8[_0x8bcd('0x6d')]=qs[_0x8bcd('0x50')](_0x4727b5[_0x8bcd('0x48')]['sort']);_0xf367d8['where']=qs[_0x8bcd('0x4a')](_['pick'](_0x4727b5[_0x8bcd('0x48')],_0x4a5ead[_0x8bcd('0x4a')]));_0xf367d8[_0x8bcd('0x51')][_0x8bcd('0x6a')]=_0x232edc['id'];if(_0x4727b5['query'][_0x8bcd('0x53')]){_0xf367d8[_0x8bcd('0x51')]=_[_0x8bcd('0x54')](_0xf367d8[_0x8bcd('0x51')],{'$or':_[_0x8bcd('0x42')](_0xf367d8[_0x8bcd('0x4c')],function(_0x3912f3){var _0x25953a={};_0x25953a[_0x3912f3]={'$like':'%'+_0x4727b5['query'][_0x8bcd('0x53')]+'%'};return _0x25953a;})});}_0xf367d8=_[_0x8bcd('0x54')]({},_0xf367d8,_0x4727b5[_0x8bcd('0x56')]);return db['Disposition']['count']({'where':_0xf367d8[_0x8bcd('0x51')]})[_0x8bcd('0x24')](function(_0xf8319e){_0x7e70f6['count']=_0xf8319e;if(_0x4727b5[_0x8bcd('0x48')][_0x8bcd('0x58')]){_0xf367d8['include']=[{'all':!![]}];}return db[_0x8bcd('0x6b')][_0x8bcd('0x59')](_0xf367d8);})[_0x8bcd('0x24')](function(_0x1d2476){_0x7e70f6[_0x8bcd('0x5a')]=_0x1d2476;return _0x7e70f6;});}})[_0x8bcd('0x24')](respondWithFilteredResult(_0x32a85f,_0xf367d8))['catch'](handleError(_0x32a85f,null));};exports[_0x8bcd('0x6e')]=function(_0x1c87f2,_0x1624a8,_0x1508bd){return db['FaxAccount']['find']({'where':{'id':_0x1c87f2[_0x8bcd('0x67')]['id']}})['then'](handleEntityNotFound(_0x1624a8,null))['then'](function(_0x2a648d){if(_0x2a648d){return _0x2a648d[_0x8bcd('0x6e')](_0x1c87f2[_0x8bcd('0x48')][_0x8bcd('0x6f')]);}})[_0x8bcd('0x24')](respondWithStatusCode(_0x1624a8,null))[_0x8bcd('0x2e')](handleError(_0x1624a8,null));};exports[_0x8bcd('0x70')]=function(_0x5946a4,_0x1f6dbc,_0x10847d){if(_0x5946a4[_0x8bcd('0x66')]['id']){delete _0x5946a4[_0x8bcd('0x66')]['id'];}return db[_0x8bcd('0x57')][_0x8bcd('0x62')]({'where':{'id':_0x5946a4[_0x8bcd('0x67')]['id']}})['then'](handleEntityNotFound(_0x1f6dbc,null))[_0x8bcd('0x24')](function(_0xc40129){if(_0xc40129){_0x5946a4['body'][_0x8bcd('0x6a')]=_0xc40129['id'];return db['CannedAnswer'][_0x8bcd('0x5e')](_0x5946a4[_0x8bcd('0x66')]);}})[_0x8bcd('0x24')](respondWithResult(_0x1f6dbc,null))[_0x8bcd('0x2e')](handleError(_0x1f6dbc,null));};exports[_0x8bcd('0x71')]=function(_0x5f32b5,_0x5a728b,_0x29cdd2){var _0x4c6013={'raw':![],'where':{}};var _0x35cb14={};var _0x1d1aea={'count':0x0,'rows':[]};return db[_0x8bcd('0x57')]['findOne']({'where':{'id':_0x5f32b5[_0x8bcd('0x67')]['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x5a728b,null))[_0x8bcd('0x24')](function(_0x12e147){if(_0x12e147){_0x35cb14[_0x8bcd('0x47')]=_[_0x8bcd('0x49')](db[_0x8bcd('0x72')][_0x8bcd('0x43')]);_0x35cb14['query']=_['keys'](_0x5f32b5[_0x8bcd('0x48')]);_0x35cb14[_0x8bcd('0x4a')]=_[_0x8bcd('0x4b')](_0x35cb14[_0x8bcd('0x47')],_0x35cb14[_0x8bcd('0x48')]);_0x4c6013['attributes']=_[_0x8bcd('0x4b')](_0x35cb14[_0x8bcd('0x47')],qs[_0x8bcd('0x4d')](_0x5f32b5['query'][_0x8bcd('0x4d')]));_0x4c6013['attributes']=_0x4c6013['attributes'][_0x8bcd('0x5c')]?_0x4c6013['attributes']:_0x35cb14['model'];if(!_0x5f32b5[_0x8bcd('0x48')][_0x8bcd('0x4e')](_0x8bcd('0x4f'))){_0x4c6013[_0x8bcd('0x34')]=qs[_0x8bcd('0x34')](_0x5f32b5[_0x8bcd('0x48')][_0x8bcd('0x34')]);_0x4c6013[_0x8bcd('0x32')]=qs[_0x8bcd('0x32')](_0x5f32b5['query'][_0x8bcd('0x32')]);}_0x4c6013[_0x8bcd('0x6d')]=qs[_0x8bcd('0x50')](_0x5f32b5[_0x8bcd('0x48')][_0x8bcd('0x50')]);_0x4c6013[_0x8bcd('0x51')]=qs[_0x8bcd('0x4a')](_[_0x8bcd('0x52')](_0x5f32b5[_0x8bcd('0x48')],_0x35cb14[_0x8bcd('0x4a')]));_0x4c6013[_0x8bcd('0x51')][_0x8bcd('0x6a')]=_0x12e147['id'];if(_0x5f32b5[_0x8bcd('0x48')][_0x8bcd('0x53')]){_0x4c6013['where']=_[_0x8bcd('0x54')](_0x4c6013[_0x8bcd('0x51')],{'$or':_['map'](_0x4c6013['attributes'],function(_0x56feaf){var _0x26bd9d={};_0x26bd9d[_0x56feaf]={'$like':'%'+_0x5f32b5[_0x8bcd('0x48')]['filter']+'%'};return _0x26bd9d;})});}_0x4c6013=_[_0x8bcd('0x54')]({},_0x4c6013,_0x5f32b5[_0x8bcd('0x56')]);return db[_0x8bcd('0x72')][_0x8bcd('0x35')]({'where':_0x4c6013[_0x8bcd('0x51')]})[_0x8bcd('0x24')](function(_0x4bcbbd){_0x1d1aea[_0x8bcd('0x35')]=_0x4bcbbd;if(_0x5f32b5[_0x8bcd('0x48')][_0x8bcd('0x58')]){_0x4c6013[_0x8bcd('0x5d')]=[{'all':!![]}];}return db[_0x8bcd('0x72')]['findAll'](_0x4c6013);})[_0x8bcd('0x24')](function(_0x460562){_0x1d1aea[_0x8bcd('0x5a')]=_0x460562;return _0x1d1aea;});}})[_0x8bcd('0x24')](respondWithFilteredResult(_0x5a728b,_0x4c6013))[_0x8bcd('0x2e')](handleError(_0x5a728b,null));};exports[_0x8bcd('0x73')]=function(_0x50ef64,_0x32f9e0,_0x3afc50){return db[_0x8bcd('0x57')][_0x8bcd('0x62')]({'where':{'id':_0x50ef64[_0x8bcd('0x67')]['id']}})['then'](handleEntityNotFound(_0x32f9e0,null))[_0x8bcd('0x24')](function(_0x15336c){if(_0x15336c){return _0x15336c['removeAnswers'](_0x50ef64[_0x8bcd('0x48')][_0x8bcd('0x6f')]);}})['then'](respondWithStatusCode(_0x32f9e0,null))[_0x8bcd('0x2e')](handleError(_0x32f9e0,null));};exports[_0x8bcd('0x74')]=function(_0x3eaa60,_0x4023e2,_0x24aaa3){return db[_0x8bcd('0x75')][_0x8bcd('0x62')]({'where':{'id':_0x3eaa60[_0x8bcd('0x67')]['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x4023e2,null))[_0x8bcd('0x24')](function(_0x2a99e0){if(_0x2a99e0){return _0x2a99e0[_0x8bcd('0x74')](_0x3eaa60[_0x8bcd('0x66')]['ids'],_[_0x8bcd('0x76')](_0x3eaa60[_0x8bcd('0x66')],[_0x8bcd('0x6f'),'id'])||{});}})[_0x8bcd('0x24')](respondWithResult(_0x4023e2,null))[_0x8bcd('0x2e')](handleError(_0x4023e2,null));};exports[_0x8bcd('0x77')]=function(_0x6209c0,_0x53160b,_0xc557df){var _0x1c7d46={'raw':![],'where':{}};var _0xca6156={};var _0x14cfaa={'count':0x0,'rows':[]};return db[_0x8bcd('0x57')][_0x8bcd('0x78')]({'where':{'id':_0x6209c0[_0x8bcd('0x67')]['id']}})['then'](handleEntityNotFound(_0x53160b,null))[_0x8bcd('0x24')](function(_0x292dd5){if(_0x292dd5){_0xca6156[_0x8bcd('0x47')]=_['keys'](db['FaxInteraction'][_0x8bcd('0x43')]);_0xca6156[_0x8bcd('0x48')]=_[_0x8bcd('0x49')](_0x6209c0['query']);_0xca6156[_0x8bcd('0x4a')]=_[_0x8bcd('0x4b')](_0xca6156[_0x8bcd('0x47')],_0xca6156['query']);_0x1c7d46[_0x8bcd('0x4c')]=_[_0x8bcd('0x4b')](_0xca6156[_0x8bcd('0x47')],qs[_0x8bcd('0x4d')](_0x6209c0[_0x8bcd('0x48')][_0x8bcd('0x4d')]));_0x1c7d46[_0x8bcd('0x4c')]=_0x1c7d46['attributes'][_0x8bcd('0x5c')]?_0x1c7d46['attributes']:_0xca6156[_0x8bcd('0x47')];if(!_0x6209c0['query'][_0x8bcd('0x4e')](_0x8bcd('0x4f'))){_0x1c7d46['limit']=qs[_0x8bcd('0x34')](_0x6209c0[_0x8bcd('0x48')][_0x8bcd('0x34')]);_0x1c7d46[_0x8bcd('0x32')]=qs['offset'](_0x6209c0['query']['offset']);}_0x1c7d46[_0x8bcd('0x6d')]=qs[_0x8bcd('0x50')](_0x6209c0[_0x8bcd('0x48')]['sort']);_0x1c7d46['where']=qs['filters'](_[_0x8bcd('0x52')](_0x6209c0['query'],_0xca6156[_0x8bcd('0x4a')]));_0x1c7d46[_0x8bcd('0x51')]['FaxAccountId']=_0x292dd5['id'];if(_0x6209c0['query'][_0x8bcd('0x53')]){_0x1c7d46[_0x8bcd('0x51')]=_[_0x8bcd('0x54')](_0x1c7d46[_0x8bcd('0x51')],{'$or':_['map'](_0x1c7d46[_0x8bcd('0x4c')],function(_0x5b437a){var _0x402039={};_0x402039[_0x5b437a]={'$like':'%'+_0x6209c0[_0x8bcd('0x48')][_0x8bcd('0x53')]+'%'};return _0x402039;})});}_0x1c7d46=_[_0x8bcd('0x54')]({},_0x1c7d46,_0x6209c0[_0x8bcd('0x56')]);return db[_0x8bcd('0x75')][_0x8bcd('0x35')]({'where':_0x1c7d46['where']})['then'](function(_0x5b1051){_0x14cfaa[_0x8bcd('0x35')]=_0x5b1051;if(_0x6209c0[_0x8bcd('0x48')][_0x8bcd('0x58')]){_0x1c7d46['include']=[{'model':db[_0x8bcd('0x79')],'as':_0x8bcd('0x7a'),'required':![]},{'model':db[_0x8bcd('0x7b')],'as':'Owner','attributes':[_0x8bcd('0x3f'),'fullname',_0x8bcd('0x7c')],'required':![]},{'model':db[_0x8bcd('0x7d')],'as':_0x8bcd('0x7e'),'attributes':['id',_0x8bcd('0x3f'),_0x8bcd('0x7f')],'where':_0x6209c0[_0x8bcd('0x48')][_0x8bcd('0x80')]?{'id':_0x6209c0['query'][_0x8bcd('0x80')]}:undefined,'required':_0x6209c0['query'][_0x8bcd('0x80')]?!![]:![]}];}return db['FaxInteraction'][_0x8bcd('0x59')](_0x1c7d46);})['then'](function(_0x52c793){_0x14cfaa[_0x8bcd('0x5a')]=_0x52c793;return _0x14cfaa;});}})['then'](respondWithFilteredResult(_0x53160b,_0x1c7d46))[_0x8bcd('0x2e')](handleError(_0x53160b,null));};exports['addApplications']=function(_0x4edabc,_0x58f194){var _0x311c03=_0x4edabc[_0x8bcd('0x67')]['id'];var _0x329230=_0x4edabc[_0x8bcd('0x66')];var _0x26ed13=0xc8;var _0x32336f=null;return db[_0x8bcd('0x81')]['transaction']({'isolationLevel':db['sequelize'][_0x8bcd('0x82')]['ISOLATION_LEVELS'][_0x8bcd('0x83')]},function(_0x1a47bb){return db[_0x8bcd('0x57')][_0x8bcd('0x78')]({'where':{'id':_0x311c03},'transaction':_0x1a47bb})['then'](function(_0x1a1124){if(_0x1a1124){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x311c03},'transaction':_0x1a47bb})[_0x8bcd('0x24')](function(){var _0x30345a=_[_0x8bcd('0x42')](_0x329230,function(_0x31ae82){_0x31ae82['FaxAccountId']=_0x311c03;return _0x31ae82;});return db[_0x8bcd('0x84')][_0x8bcd('0x85')](_0x30345a,{'transaction':_0x1a47bb});});}else{_0x26ed13=0x194;_0x32336f=[];}});})[_0x8bcd('0x24')](function(){if(_0x26ed13!==0x194){return db[_0x8bcd('0x84')]['findAndCountAll']({'where':{'FaxAccountId':_0x311c03},'order':_0x8bcd('0x86')})[_0x8bcd('0x24')](function(_0x1d10f1){_0x32336f=_0x1d10f1;});}})[_0x8bcd('0x2e')](function(_0x1faf6a){_0x26ed13=0x1f4;logger[_0x8bcd('0x2a')](_0x1faf6a[_0x8bcd('0x3e')]);if(_0x1faf6a[_0x8bcd('0x3f')]){delete _0x1faf6a[_0x8bcd('0x3f')];}_0x32336f=_0x1faf6a;})['finally'](function(){if(_0x32336f===null){_0x58f194['sendStatus'](_0x26ed13);}else{if(_0x26ed13===0x1f4){_0x58f194[_0x8bcd('0x30')](_0x26ed13)[_0x8bcd('0x40')](_0x32336f);}else{_0x58f194['status'](_0x26ed13)[_0x8bcd('0x87')](_0x32336f);}}});};exports[_0x8bcd('0x88')]=function(_0x24868e,_0x369b53,_0x39a1c7){var _0x5e33b0={};var _0x3ae5f2={};var _0x4f7f4c;var _0x4211b1;return db[_0x8bcd('0x57')]['findOne']({'where':{'id':_0x24868e[_0x8bcd('0x67')]['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x369b53,null))[_0x8bcd('0x24')](function(_0x3772a5){if(_0x3772a5){_0x4f7f4c=_0x3772a5;_0x3ae5f2['model']=_[_0x8bcd('0x49')](db['FaxApplication'][_0x8bcd('0x43')]);_0x3ae5f2[_0x8bcd('0x48')]=_[_0x8bcd('0x49')](_0x24868e[_0x8bcd('0x48')]);_0x3ae5f2[_0x8bcd('0x4a')]=_[_0x8bcd('0x4b')](_0x3ae5f2['model'],_0x3ae5f2[_0x8bcd('0x48')]);_0x5e33b0[_0x8bcd('0x4c')]=_[_0x8bcd('0x4b')](_0x3ae5f2['model'],qs[_0x8bcd('0x4d')](_0x24868e[_0x8bcd('0x48')][_0x8bcd('0x4d')]));_0x5e33b0[_0x8bcd('0x4c')]=_0x5e33b0['attributes'][_0x8bcd('0x5c')]?_0x5e33b0['attributes']:_0x3ae5f2[_0x8bcd('0x47')];_0x5e33b0['order']=qs[_0x8bcd('0x50')](_0x24868e['query'][_0x8bcd('0x50')]);_0x5e33b0[_0x8bcd('0x51')]=qs[_0x8bcd('0x4a')](_[_0x8bcd('0x52')](_0x24868e['query'],_0x3ae5f2[_0x8bcd('0x4a')]));if(_0x24868e['query'][_0x8bcd('0x53')]){_0x5e33b0[_0x8bcd('0x51')]=_[_0x8bcd('0x54')](_0x5e33b0[_0x8bcd('0x51')],{'$or':_['map'](_0x5e33b0['attributes'],function(_0x2478b5){var _0x141736={};_0x141736[_0x2478b5]={'$like':'%'+_0x24868e[_0x8bcd('0x48')][_0x8bcd('0x53')]+'%'};return _0x141736;})});}_0x5e33b0=_[_0x8bcd('0x54')]({},_0x5e33b0,_0x24868e[_0x8bcd('0x56')]);return _0x4f7f4c['getApplications'](_0x5e33b0);}})[_0x8bcd('0x24')](function(_0x345c3f){if(_0x345c3f){_0x4211b1=_0x345c3f[_0x8bcd('0x5c')];if(!_0x24868e[_0x8bcd('0x48')][_0x8bcd('0x4e')]('nolimit')){_0x5e33b0[_0x8bcd('0x34')]=qs[_0x8bcd('0x34')](_0x24868e['query'][_0x8bcd('0x34')]);_0x5e33b0[_0x8bcd('0x32')]=qs[_0x8bcd('0x32')](_0x24868e[_0x8bcd('0x48')][_0x8bcd('0x32')]);}return _0x4f7f4c[_0x8bcd('0x88')](_0x5e33b0);}})[_0x8bcd('0x24')](function(_0x310a92){if(_0x310a92){return _0x310a92?{'count':_0x4211b1,'rows':_0x310a92}:null;}})[_0x8bcd('0x24')](respondWithResult(_0x369b53,null))['catch'](handleError(_0x369b53,null));};function Extension(_0x3d0865,_0x19dd5a,_0x44119a,_0x96b6b9){this[_0x8bcd('0x89')]=_0x8bcd('0x8a');this[_0x8bcd('0x8b')]=_0x3d0865[_0x8bcd('0x8c')];this['app']=_0x96b6b9;this['type']=_0x8bcd('0x8d');this['description']=_0x8bcd('0x8e');this[_0x8bcd('0x6a')]=_0x3d0865['id'];this['priority']=_0x19dd5a;this[_0x8bcd('0x8f')]=_0x44119a;}function createExtensionsReciveFax(_0x573734){var _0xa280f0=0x1;var _0x5dda85=[];_0x5dda85[_0x8bcd('0x90')](new Extension(_0x573734,_0xa280f0,'','Answer'));_0xa280f0+=0x1;_0x5dda85[_0x8bcd('0x90')](new Extension(_0x573734,_0xa280f0,_0x8bcd('0x91'),'Set'));_0xa280f0+=0x1;for(var _0x22c0a6 in _0x573734){if(_0x573734[_0x8bcd('0x4e')](_0x22c0a6)&&(_0x22c0a6===_0x8bcd('0x92')||_0x22c0a6==='localstationid'||_0x22c0a6===_0x8bcd('0x93')||_0x22c0a6===_0x8bcd('0x94')||_0x22c0a6==='headerinfo'||_0x22c0a6===_0x8bcd('0x95')||_0x22c0a6===_0x8bcd('0x96')||_0x22c0a6===_0x8bcd('0x97')||_0x22c0a6==='t38timeout')){_0x5dda85[_0x8bcd('0x90')](new Extension(_0x573734,_0xa280f0,_0x8bcd('0x98')+_0x22c0a6+')='+_0x573734[_0x22c0a6],_0x8bcd('0x99')));_0xa280f0+=0x1;}}_0x5dda85[_0x8bcd('0x90')](new Extension(_0x573734,_0xa280f0,'6',_0x8bcd('0x9a')));_0xa280f0+=0x1;_0x5dda85[_0x8bcd('0x90')](new Extension(_0x573734,_0xa280f0,_0x8bcd('0x9b'),_0x8bcd('0x9c')));_0xa280f0=0x0;return _0x5dda85;}exports[_0x8bcd('0x9d')]=function(_0x5102ae,_0x4d6820,_0x3b771a){var _0x3180aa;return db[_0x8bcd('0x81')][_0x8bcd('0x9e')](function(_0x13b1bf){return db[_0x8bcd('0x57')][_0x8bcd('0x5e')](_0x5102ae[_0x8bcd('0x66')],{'transaction':_0x13b1bf})[_0x8bcd('0x24')](function(_0xfa0c83){_0x3180aa=_0xfa0c83[_0x8bcd('0x3b')]({'plain':!![]});return db[_0x8bcd('0x9f')][_0x8bcd('0x85')](createExtensionsReciveFax(_0x3180aa),{'transaction':_0x13b1bf});});})[_0x8bcd('0x24')](function(){return _0x3180aa;})[_0x8bcd('0x24')](respondWithResult(_0x4d6820,null))[_0x8bcd('0x2e')](handleError(_0x4d6820,null));};exports['updateAccountApplications']=function(_0x3dd495,_0x1f6fc2,_0x2f5dd5){var _0x529365;return db[_0x8bcd('0x81')]['transaction'](function(_0x2368b5){return db[_0x8bcd('0x57')]['update'](_0x3dd495[_0x8bcd('0x66')],{'where':{'id':_0x3dd495['body']['id']},'transaction':_0x2368b5})[_0x8bcd('0x24')](function(_0x3e6e59){return db[_0x8bcd('0x9f')]['destroy']({'where':{'FaxAccountId':_0x3dd495['body']['id']},'transaction':_0x2368b5})[_0x8bcd('0x24')](function(_0x3b7341){return db[_0x8bcd('0x9f')][_0x8bcd('0x85')](createExtensionsReciveFax(_[_0x8bcd('0x76')](_0x3dd495[_0x8bcd('0x66')],[_0x8bcd('0xa0'),_0x8bcd('0x46'),_0x8bcd('0xa1'),'updatedAt',_0x8bcd('0xa2'),_0x8bcd('0xa3')])),{'transaction':_0x2368b5});});});})['then'](function(){return db[_0x8bcd('0x57')][_0x8bcd('0xa4')](_0x3dd495[_0x8bcd('0x66')]['id']);})[_0x8bcd('0x24')](respondWithResult(_0x1f6fc2,null))[_0x8bcd('0x2e')](handleError(_0x1f6fc2,null));};exports[_0x8bcd('0xa5')]=function(_0x181188,_0x3be184,_0x3ae9a4){var _0x15bf57={'raw':!![],'where':{}};var _0x154b33={};var _0x11ac02={'count':0x0,'rows':[]};return db[_0x8bcd('0x57')][_0x8bcd('0x78')]({'where':{'id':_0x181188[_0x8bcd('0x67')]['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x3be184,null))[_0x8bcd('0x24')](function(_0x348d4e){if(_0x348d4e){_0x154b33[_0x8bcd('0x47')]=_['keys'](db[_0x8bcd('0xa6')][_0x8bcd('0x43')]);_0x154b33[_0x8bcd('0x48')]=_[_0x8bcd('0x49')](_0x181188[_0x8bcd('0x48')]);_0x154b33[_0x8bcd('0x4a')]=_[_0x8bcd('0x4b')](_0x154b33[_0x8bcd('0x47')],_0x154b33[_0x8bcd('0x48')]);_0x15bf57[_0x8bcd('0x4c')]=_[_0x8bcd('0x4b')](_0x154b33[_0x8bcd('0x47')],qs[_0x8bcd('0x4d')](_0x181188[_0x8bcd('0x48')]['fields']));_0x15bf57[_0x8bcd('0x4c')]=_0x15bf57[_0x8bcd('0x4c')]['length']?_0x15bf57['attributes']:_0x154b33['model'];if(!_0x181188[_0x8bcd('0x48')][_0x8bcd('0x4e')](_0x8bcd('0x4f'))){_0x15bf57['limit']=qs[_0x8bcd('0x34')](_0x181188[_0x8bcd('0x48')]['limit']);_0x15bf57[_0x8bcd('0x32')]=qs[_0x8bcd('0x32')](_0x181188[_0x8bcd('0x48')]['offset']);}_0x15bf57['order']=qs['sort'](_0x181188[_0x8bcd('0x48')][_0x8bcd('0x50')]);_0x15bf57['where']=qs['filters'](_['pick'](_0x181188[_0x8bcd('0x48')],_0x154b33[_0x8bcd('0x4a')]));_0x15bf57[_0x8bcd('0x51')]['FaxAccountId']=_0x348d4e['id'];if(_0x181188[_0x8bcd('0x48')][_0x8bcd('0x53')]){_0x15bf57['where']=_[_0x8bcd('0x54')](_0x15bf57[_0x8bcd('0x51')],{'$or':_[_0x8bcd('0x42')](_0x15bf57['attributes'],function(_0x1f39ef){var _0x5474d2={};_0x5474d2[_0x1f39ef]={'$like':'%'+_0x181188[_0x8bcd('0x48')][_0x8bcd('0x53')]+'%'};return _0x5474d2;})});}if(_0x181188['query'][_0x8bcd('0xa7')]){var _0x5f506d=_0x181188[_0x8bcd('0x48')][_0x8bcd('0xa7')][_0x8bcd('0xa8')](',');var _0x5ef246={};_0x5ef246[_0x5f506d[0x0]]={'$gte':moment(_0x5f506d[0x1])[_0x8bcd('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15bf57['where']=_[_0x8bcd('0x54')](_0x15bf57['where'],_0x5ef246);}_0x15bf57=_[_0x8bcd('0x54')]({},_0x15bf57,_0x181188[_0x8bcd('0x56')]);return db['FaxMessage'][_0x8bcd('0x35')]({'where':_0x15bf57[_0x8bcd('0x51')]})[_0x8bcd('0x24')](function(_0x3ba72e){_0x11ac02[_0x8bcd('0x35')]=_0x3ba72e;if(_0x181188[_0x8bcd('0x48')][_0x8bcd('0x58')]){_0x15bf57[_0x8bcd('0x5d')]=[{'all':!![]}];}return db[_0x8bcd('0xa6')][_0x8bcd('0x59')](_0x15bf57);})[_0x8bcd('0x24')](function(_0x1c6b36){_0x11ac02[_0x8bcd('0x5a')]=_0x1c6b36;return _0x11ac02;});}})[_0x8bcd('0x24')](respondWithFilteredResult(_0x3be184,_0x15bf57))['catch'](handleError(_0x3be184,null));};exports[_0x8bcd('0x40')]=function(_0x24a098,_0x5741d4,_0x1dc589){var _0x2c86f1,_0x1bba34={},_0x1a290d;if(_0x24a098['body']['to']){_0x1a290d=_0x24a098['body']['to'][0x0];}return db[_0x8bcd('0x57')]['find']({'where':{'id':_0x24a098[_0x8bcd('0x67')]['id']},'include':[{'model':db[_0x8bcd('0xaa')],'as':_0x8bcd('0xab'),'include':[{'model':db['CmContact'],'as':_0x8bcd('0xac'),'where':{'fax':_0x1a290d},'limit':0x1,'order':[[_0x8bcd('0xad'),'DESC']]}]}]})[_0x8bcd('0x24')](handleEntityNotFound(_0x5741d4,null))[_0x8bcd('0x24')](function(_0x594c5c){_0x2c86f1=_0x594c5c;if(_0x24a098[_0x8bcd('0x66')][_0x8bcd('0xae')]&&_0x24a098['body']['attachments']['length']){for(var _0x4b3ac8=0x0;_0x4b3ac8<_0x24a098['body']['attachments'][_0x8bcd('0x5c')];_0x4b3ac8+=0x1){_0x24a098['body'][_0x8bcd('0xae')][_0x4b3ac8]={'filename':_0x24a098[_0x8bcd('0x66')][_0x8bcd('0xae')][_0x4b3ac8][_0x8bcd('0x3f')],'id':_0x24a098[_0x8bcd('0x66')]['attachments'][_0x4b3ac8]['id'],'path':path[_0x8bcd('0xaf')](config[_0x8bcd('0xb0')],'server/files/attachments',_0x24a098[_0x8bcd('0x66')][_0x8bcd('0xae')][_0x4b3ac8][_0x8bcd('0xb1')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x8bcd('0xb2')](_0x24a098[_0x8bcd('0x67')]['id'])?undefined:_0x24a098['params']['id'],'path':_[_0x8bcd('0xb2')](_0x24a098['body'][_0x8bcd('0xae')][0x0][_0x8bcd('0x8')])?undefined:_0x24a098['body'][_0x8bcd('0xae')][0x0]['path'],'fax':_[_0x8bcd('0xb2')](_0x24a098[_0x8bcd('0x66')]['to'][0x0])?undefined:_0x24a098[_0x8bcd('0x66')]['to'][0x0]},client9002);})[_0x8bcd('0x24')](function(){if(_0x2c86f1){if(_[_0x8bcd('0xb2')](_0x24a098[_0x8bcd('0x66')][_0x8bcd('0xb3')])){_0x24a098[_0x8bcd('0x66')]['from']=util[_0x8bcd('0xa9')](_0x8bcd('0xb4'),_0x2c86f1[_0x8bcd('0x3f')],_0x2c86f1['fax']);}if(_0x2c86f1[_0x8bcd('0xab')]){if(_0x2c86f1['List'][_0x8bcd('0xac')][_0x8bcd('0x5c')]){return _0x2c86f1[_0x8bcd('0xab')]['Contacts'][0x0];}else{return db[_0x8bcd('0x79')][_0x8bcd('0x5e')](_[_0x8bcd('0xb5')](_0x24a098[_0x8bcd('0x66')],{'firstName':_0x24a098[_0x8bcd('0x66')]['to'][0x0],'phone':_0x24a098['body']['to'][0x0],'fax':_0x24a098[_0x8bcd('0x66')]['to'][0x0],'ListId':_0x2c86f1[_0x8bcd('0xa3')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x8bcd('0xb6'));}})['then'](function(_0x5e2f39){if(_0x5e2f39){return db[_0x8bcd('0x75')]['find']({'where':{'ContactId':_0x5e2f39['id'],'closed':![],'FaxAccountId':_0x2c86f1['id']}})[_0x8bcd('0x24')](function(_0x2fadde){if(_0x2fadde){return[_0x2fadde,![]];}return db['FaxInteraction'][_0x8bcd('0x5e')]({'UserId':_0x24a098['user']['id'],'ContactId':_0x5e2f39['id'],'FaxAccountId':_0x2c86f1['id'],'fax':_0x24a098[_0x8bcd('0x66')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x8bcd('0x54')](_0x24a098[_0x8bcd('0x66')],{'read':![],'body':_0x24a098[_0x8bcd('0x66')][_0x8bcd('0xae')][0x0]['filename'],'FaxAccountId':_0x2c86f1['id'],'UserId':_0x24a098[_0x8bcd('0x5f')]['id'],'ContactId':_0x5e2f39['id'],'AttachmentId':_0x24a098[_0x8bcd('0x66')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x8bcd('0xa6')],'as':_0x8bcd('0xb7')}]})['then'](function(_0x26525e){return[_0x26525e,!![]];});});}else{throw new Error(_0x8bcd('0xb8'));}})[_0x8bcd('0xb9')](function(_0xbe5fb1,_0x43cb00){if(_0x43cb00){return _0xbe5fb1;}return db['FaxMessage'][_0x8bcd('0x5e')]({'direction':'out','read':![],'body':_0x24a098['body'][_0x8bcd('0xae')][0x0][_0x8bcd('0xba')],'FaxAccountId':_0x2c86f1['id'],'FaxInteractionId':_0xbe5fb1['id'],'UserId':_0x24a098['user']['id'],'ContactId':_0xbe5fb1[_0x8bcd('0xbb')],'AttachmentId':_0x24a098['body']['attachments'][0x0]['id']})[_0x8bcd('0x24')](function(_0x338242){_0xbe5fb1[_0x8bcd('0xbc')][_0x8bcd('0xb7')]=[];_0xbe5fb1['dataValues'][_0x8bcd('0xb7')][_0x8bcd('0x90')](_0x338242['dataValues']);return _0xbe5fb1;});})[_0x8bcd('0x24')](function(_0x304560){respondWithRpcPromise('SendFax',_0x8bcd('0xbd'),{'FaxAccountId':_[_0x8bcd('0xb2')](_0x24a098[_0x8bcd('0x67')]['id'])?undefined:_0x24a098[_0x8bcd('0x67')]['id'],'path':_[_0x8bcd('0xb2')](_0x24a098[_0x8bcd('0x66')]['attachments'][0x0][_0x8bcd('0x8')])?undefined:_0x24a098[_0x8bcd('0x66')][_0x8bcd('0xae')][0x0]['path'],'fax':_[_0x8bcd('0xb2')](_0x24a098[_0x8bcd('0x66')]['to'][0x0])?undefined:_0x24a098[_0x8bcd('0x66')]['to'][0x0],'AttachmentId':_0x24a098['body']['attachments'][0x0]['id']},client9002)[_0x8bcd('0x24')](function(_0x17a353){logger[_0x8bcd('0x25')]('SendFaxRpc,\x20%s',_0x17a353);})['catch'](function(_0x3398e4){logger['info'](_0x8bcd('0xbe'),_0x3398e4);});return _0x304560;})[_0x8bcd('0x24')](respondWithResult(_0x5741d4,null))[_0x8bcd('0x2e')](handleError(_0x5741d4,null));};exports[_0x8bcd('0xbf')]=function(_0x1e920d,_0x500411,_0x461a09){return db['FaxAccount']['find']({'where':{'id':_0x1e920d[_0x8bcd('0x67')]['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x500411,null))[_0x8bcd('0x24')](function(_0x426941){if(_0x426941){return _0x426941[_0x8bcd('0xbf')](_0x1e920d[_0x8bcd('0x66')][_0x8bcd('0x6f')],_[_0x8bcd('0x76')](_0x1e920d['body'],[_0x8bcd('0x6f'),'id'])||{})['spread'](function(_0x182952){for(var _0x3cbb0c=0x0;_0x3cbb0c<_0x1e920d[_0x8bcd('0x66')][_0x8bcd('0x6f')][_0x8bcd('0x5c')];_0x3cbb0c+=0x1){socket[_0x8bcd('0xc0')](_0x8bcd('0xc1'),{'UserId':Number(_0x1e920d['body'][_0x8bcd('0x6f')][_0x3cbb0c]),'FaxAccountId':Number(_0x1e920d[_0x8bcd('0x67')]['id'])});}return _0x182952;});}})[_0x8bcd('0x24')](respondWithResult(_0x500411,null))['catch'](handleError(_0x500411,null));};exports['removeAgents']=function(_0x45ae7a,_0x403882,_0xc2ae04){return db[_0x8bcd('0x57')][_0x8bcd('0x62')]({'where':{'id':_0x45ae7a['params']['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x403882,null))['then'](function(_0x205f5f){if(_0x205f5f){return _0x205f5f[_0x8bcd('0xc2')](_0x45ae7a['query'][_0x8bcd('0x6f')])['then'](function(){if(_[_0x8bcd('0xc3')](_0x45ae7a['query'][_0x8bcd('0x6f')])){for(var _0x965566=0x0;_0x965566<_0x45ae7a['query'][_0x8bcd('0x6f')][_0x8bcd('0x5c')];_0x965566+=0x1){socket[_0x8bcd('0xc0')](_0x8bcd('0xc4'),{'UserId':Number(_0x45ae7a[_0x8bcd('0x48')][_0x8bcd('0x6f')][_0x965566]),'FaxAccountId':Number(_0x45ae7a[_0x8bcd('0x67')]['id'])});}}else{socket[_0x8bcd('0xc0')](_0x8bcd('0xc4'),{'UserId':Number(_0x45ae7a['query'][_0x8bcd('0x6f')]),'FaxAccountId':Number(_0x45ae7a[_0x8bcd('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x403882,null))['catch'](handleError(_0x403882,null));};exports[_0x8bcd('0xc5')]=function(_0x42edff,_0x161788,_0x509a4b){var _0xdde6a4={};var _0x42baa8={};var _0x1e09ab;var _0x4ff865;return db['FaxAccount'][_0x8bcd('0x78')]({'where':{'id':_0x42edff[_0x8bcd('0x67')]['id']}})[_0x8bcd('0x24')](handleEntityNotFound(_0x161788,null))[_0x8bcd('0x24')](function(_0x4ce7a3){if(_0x4ce7a3){_0x1e09ab=_0x4ce7a3;_0x42baa8['model']=_[_0x8bcd('0x49')](db['User'][_0x8bcd('0x43')]);_0x42baa8[_0x8bcd('0x48')]=_[_0x8bcd('0x49')](_0x42edff[_0x8bcd('0x48')]);_0x42baa8[_0x8bcd('0x4a')]=_[_0x8bcd('0x4b')](_0x42baa8['model'],_0x42baa8[_0x8bcd('0x48')]);_0xdde6a4[_0x8bcd('0x4c')]=_[_0x8bcd('0x4b')](_0x42baa8[_0x8bcd('0x47')],qs[_0x8bcd('0x4d')](_0x42edff[_0x8bcd('0x48')][_0x8bcd('0x4d')]));_0xdde6a4[_0x8bcd('0x4c')]=_0xdde6a4[_0x8bcd('0x4c')][_0x8bcd('0x5c')]?_0xdde6a4[_0x8bcd('0x4c')]:_0x42baa8['model'];_0xdde6a4[_0x8bcd('0x6d')]=qs['sort'](_0x42edff[_0x8bcd('0x48')][_0x8bcd('0x50')]);_0xdde6a4['where']=qs['filters'](_[_0x8bcd('0x52')](_0x42edff['query'],_0x42baa8[_0x8bcd('0x4a')]));if(_0x42edff[_0x8bcd('0x48')][_0x8bcd('0x53')]){_0xdde6a4[_0x8bcd('0x51')]=_[_0x8bcd('0x54')](_0xdde6a4[_0x8bcd('0x51')],{'$or':_[_0x8bcd('0x42')](_0xdde6a4[_0x8bcd('0x4c')],function(_0x158c65){var _0x450473={};_0x450473[_0x158c65]={'$like':'%'+_0x42edff[_0x8bcd('0x48')][_0x8bcd('0x53')]+'%'};return _0x450473;})});}_0xdde6a4=_[_0x8bcd('0x54')]({},_0xdde6a4,_0x42edff[_0x8bcd('0x56')]);return _0x1e09ab[_0x8bcd('0xc5')](_0xdde6a4);}})['then'](function(_0x287b28){if(_0x287b28){_0x4ff865=_0x287b28[_0x8bcd('0x5c')];if(!_0x42edff[_0x8bcd('0x48')][_0x8bcd('0x4e')](_0x8bcd('0x4f'))){_0xdde6a4[_0x8bcd('0x34')]=qs[_0x8bcd('0x34')](_0x42edff['query'][_0x8bcd('0x34')]);_0xdde6a4['offset']=qs[_0x8bcd('0x32')](_0x42edff['query'][_0x8bcd('0x32')]);}return _0x1e09ab['getAgents'](_0xdde6a4);}})[_0x8bcd('0x24')](function(_0xd5b76c){if(_0xd5b76c){return _0xd5b76c?{'count':_0x4ff865,'rows':_0xd5b76c}:null;}})[_0x8bcd('0x24')](respondWithResult(_0x161788,null))[_0x8bcd('0x2e')](handleError(_0x161788,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7a43054..4688df1 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 _0x1472=['FaxAccount','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x2dbe1e,_0x20a042){var _0x35a6eb=function(_0x4ed7b6){while(--_0x4ed7b6){_0x2dbe1e['push'](_0x2dbe1e['shift']());}};_0x35a6eb(++_0x20a042);}(_0x1472,0x166));var _0x2147=function(_0x250ce7,_0x502ad3){_0x250ce7=_0x250ce7-0x0;var _0x416428=_0x1472[_0x250ce7];return _0x416428;};'use strict';var EventEmitter=require(_0x2147('0x0'));var FaxAccount=require(_0x2147('0x1'))['db'][_0x2147('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2147('0x3')](0x0);var events={'afterCreate':_0x2147('0x4'),'afterUpdate':_0x2147('0x5'),'afterDestroy':_0x2147('0x6')};function emitEvent(_0x803a6b){return function(_0x4de048,_0x516ff5,_0x1f5727){FaxAccountEvents[_0x2147('0x7')](_0x803a6b+':'+_0x4de048['id'],_0x4de048);FaxAccountEvents[_0x2147('0x7')](_0x803a6b,_0x4de048);_0x1f5727(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x2147('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xb36b=['hook','exports','events','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4d60b8,_0x59a4a){var _0x2e5aa1=function(_0x2cbf16){while(--_0x2cbf16){_0x4d60b8['push'](_0x4d60b8['shift']());}};_0x2e5aa1(++_0x59a4a);}(_0xb36b,0xac));var _0xbb36=function(_0x2bc005,_0x4528cd){_0x2bc005=_0x2bc005-0x0;var _0x94c8d6=_0xb36b[_0x2bc005];return _0x94c8d6;};'use strict';var EventEmitter=require(_0xbb36('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xbb36('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xbb36('0x2')](0x0);var events={'afterCreate':_0xbb36('0x3'),'afterUpdate':_0xbb36('0x4'),'afterDestroy':_0xbb36('0x5')};function emitEvent(_0x574800){return function(_0x372e3d,_0x26726f,_0x32e73a){FaxAccountEvents[_0xbb36('0x6')](_0x574800+':'+_0x372e3d['id'],_0x372e3d);FaxAccountEvents[_0xbb36('0x6')](_0x574800,_0x372e3d);_0x32e73a(null);};}for(var e in events){if(events[_0xbb36('0x7')](e)){var event=events[e];FaxAccount[_0xbb36('0x8')](e,emitEvent(event));}}module[_0xbb36('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 96059fa..38b352d 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 _0xc5de=['../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xc5de,0xd6));var _0xec5d=function(_0x336cb2,_0x436438){_0x336cb2=_0x336cb2-0x0;var _0x1eaadb=_0xc5de[_0x336cb2];return _0x1eaadb;};'use strict';var _=require(_0xec5d('0x0'));var util=require('util');var logger=require(_0xec5d('0x1'))(_0xec5d('0x2'));var moment=require(_0xec5d('0x3'));var BPromise=require(_0xec5d('0x4'));var rp=require(_0xec5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec5d('0x6'));var attributes=require(_0xec5d('0x7'));module[_0xec5d('0x8')]=function(_0x1a39f1,_0x5e9127){return _0x1a39f1[_0xec5d('0x9')]('FaxAccount',attributes,{'tableName':_0xec5d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2971=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x3690fe,_0x3ddf09){var _0x3ff4ab=function(_0x5b77f4){while(--_0x5b77f4){_0x3690fe['push'](_0x3690fe['shift']());}};_0x3ff4ab(++_0x3ddf09);}(_0x2971,0x136));var _0x1297=function(_0x574a80,_0x4b6cb5){_0x574a80=_0x574a80-0x0;var _0x243fcd=_0x2971[_0x574a80];return _0x243fcd;};'use strict';var _=require(_0x1297('0x0'));var util=require(_0x1297('0x1'));var logger=require(_0x1297('0x2'))(_0x1297('0x3'));var moment=require(_0x1297('0x4'));var BPromise=require(_0x1297('0x5'));var rp=require(_0x1297('0x6'));var fs=require('fs');var path=require(_0x1297('0x7'));var rimraf=require(_0x1297('0x8'));var config=require(_0x1297('0x9'));var attributes=require(_0x1297('0xa'));module[_0x1297('0xb')]=function(_0x5b8998,_0x4b1d2b){return _0x5b8998[_0x1297('0xc')](_0x1297('0xd'),attributes,{'tableName':_0x1297('0xe'),'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 dc7e67e..815355c 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 _0xae57=['body','fax','CmContact','describe','Sequelize','ValidationError','keys','createdAt','updatedAt','difference','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','asc','defaults','ListId','contact','FaxInteraction','create','spread','autoclose','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','find','name','waitForTheAssignedAgent','queueId','FaxQueue','unshift','queue','Start','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','register','request','then','info','request\x20sent','debug','stringify','error','message','FaxAccount,\x20%s,\x20%s','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xae57,0xe3));var _0x7ae5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xae57[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x7ae5('0x0'));var moment=require('moment');var BPromise=require(_0x7ae5('0x1'));var rs=require(_0x7ae5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ae5('0x3'))['db'];var utils=require(_0x7ae5('0x4'));var logger=require(_0x7ae5('0x5'))('rpc');var config=require(_0x7ae5('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7ae5('0x7')]({'port':0x232c});config['redis']=_['defaults'](config[_0x7ae5('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ae5('0x8')]));require('./faxAccount.socket')[_0x7ae5('0x9')](socket);function respondWithRpcPromise(_0x59d811,_0x2dad1b,_0x4f81eb){return new BPromise(function(_0x5a4bd2,_0x273e67){return client[_0x7ae5('0xa')](_0x59d811,_0x4f81eb)[_0x7ae5('0xb')](function(_0x27eadd){logger[_0x7ae5('0xc')]('FaxAccount,\x20%s,\x20%s',_0x2dad1b,_0x7ae5('0xd'));logger[_0x7ae5('0xe')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2dad1b,_0x7ae5('0xd'),JSON[_0x7ae5('0xf')](_0x27eadd));if(_0x27eadd[_0x7ae5('0x10')]){if(_0x27eadd[_0x7ae5('0x10')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2dad1b,_0x27eadd['error']['message']);return _0x273e67(_0x27eadd[_0x7ae5('0x10')]['message']);}logger[_0x7ae5('0x10')]('FaxAccount,\x20%s,\x20%s',_0x2dad1b,_0x27eadd[_0x7ae5('0x10')][_0x7ae5('0x11')]);return _0x5a4bd2(_0x27eadd[_0x7ae5('0x10')]['message']);}else{logger[_0x7ae5('0xc')](_0x7ae5('0x12'),_0x2dad1b,_0x7ae5('0xd'));_0x5a4bd2(_0x27eadd['result']['message']);}})['catch'](function(_0x13c50a){logger[_0x7ae5('0x10')](_0x7ae5('0x12'),_0x2dad1b,_0x13c50a);_0x273e67(_0x13c50a);});});}exports[_0x7ae5('0x13')]=function(_0x337842){var _0x59786e=this;return new Promise(function(_0x397da5,_0xddaf14){return db[_0x7ae5('0x14')][_0x7ae5('0x15')]({'raw':_0x337842[_0x7ae5('0x16')]?_0x337842['options'][_0x7ae5('0x17')]===undefined?!![]:![]:!![],'where':_0x337842['options']?_0x337842[_0x7ae5('0x16')][_0x7ae5('0x18')]||null:null,'attributes':_0x337842[_0x7ae5('0x16')]?_0x337842[_0x7ae5('0x16')][_0x7ae5('0x19')]||null:null,'limit':_0x337842[_0x7ae5('0x16')]?_0x337842['options'][_0x7ae5('0x1a')]||null:null,'include':_0x337842[_0x7ae5('0x16')]?_0x337842[_0x7ae5('0x16')][_0x7ae5('0x1b')]?_[_0x7ae5('0x1c')](_0x337842[_0x7ae5('0x16')][_0x7ae5('0x1b')],function(_0x12920c){return{'model':db[_0x12920c[_0x7ae5('0x1d')]],'as':_0x12920c['as'],'attributes':_0x12920c['attributes'],'include':_0x12920c[_0x7ae5('0x1b')]?_[_0x7ae5('0x1c')](_0x12920c[_0x7ae5('0x1b')],function(_0x1a77c9){return{'model':db[_0x1a77c9[_0x7ae5('0x1d')]],'as':_0x1a77c9['as'],'attributes':_0x1a77c9[_0x7ae5('0x19')],'include':_0x1a77c9[_0x7ae5('0x1b')]?_[_0x7ae5('0x1c')](_0x1a77c9[_0x7ae5('0x1b')],function(_0x1ea2fe){return{'model':db[_0x1ea2fe[_0x7ae5('0x1d')]],'as':_0x1ea2fe['as'],'attributes':_0x1ea2fe[_0x7ae5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7ae5('0xb')](function(_0x4ee259){logger[_0x7ae5('0xc')](_0x7ae5('0x13'),_0x337842);logger[_0x7ae5('0xe')](_0x7ae5('0x13'),_0x337842,JSON[_0x7ae5('0xf')](_0x4ee259));_0x397da5(_0x4ee259);})['catch'](function(_0x1b565c){logger[_0x7ae5('0x10')]('GetFaxAccount',_0x1b565c['message'],_0x337842);_0xddaf14(_0x59786e[_0x7ae5('0x10')](0x1f4,_0x1b565c['message']));});});};exports[_0x7ae5('0x1e')]=function(_0x574aaa,_0x36fb68,_0x25b0a0){var _0x29314d=this;return new Promise(function(_0x4ffeab,_0x49b0d9){var _0x5de21c={'body':_0x574aaa[_0x7ae5('0x1f')],'channel':_0x7ae5('0x20')};var _0x3e7217=[];var _0x437db2=[];var _0x4675bc={};return db[_0x7ae5('0x21')][_0x7ae5('0x22')]()['then'](function(_0x7f41f){if(!_0x7f41f){throw new db[(_0x7ae5('0x23'))][(_0x7ae5('0x24'))]('no\x20available\x20attributes');}_0x3e7217=_['difference'](_[_0x7ae5('0x25')](_0x7f41f),[_0x7ae5('0x26'),_0x7ae5('0x27')]);_0x437db2=_[_0x7ae5('0x28')](_[_0x7ae5('0x25')](_0x7f41f),[_0x7ae5('0x26'),_0x7ae5('0x27'),_0x7ae5('0x29'),'ListId']);if(_0x574aaa[_0x7ae5('0x1f')]['id']){delete _0x574aaa[_0x7ae5('0x1f')]['id'];}if(_[_0x7ae5('0x2a')](_0x574aaa['body'][_0x7ae5('0x2b')])){throw new db['Sequelize'][(_0x7ae5('0x24'))]('from\x20is\x20mandatory');}if(_[_0x7ae5('0x2a')](_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x1f')])||_0x574aaa[_0x7ae5('0x1f')]['body']===''){throw new db[(_0x7ae5('0x23'))][(_0x7ae5('0x24'))](_0x7ae5('0x2c'));}if(_[_0x7ae5('0x2a')](_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x2d')])){throw new db['Sequelize'][(_0x7ae5('0x24'))](_0x7ae5('0x2e')+_0x437db2);}if(!_['includes'](_0x437db2,_0x574aaa[_0x7ae5('0x1f')]['mapKey'])){throw new db[(_0x7ae5('0x23'))]['ValidationError'](_0x7ae5('0x2f')+_0x437db2);}_0x4675bc[_0x574aaa[_0x7ae5('0x1f')]['mapKey']]=_0x574aaa['body']['from'];})[_0x7ae5('0xb')](function(){return db[_0x7ae5('0x14')]['find']({'where':{'id':_0x574aaa[_0x7ae5('0x30')]['id']},'include':[{'model':db['CmList'],'as':_0x7ae5('0x31'),'include':[{'model':db[_0x7ae5('0x21')],'as':_0x7ae5('0x32'),'where':_0x4675bc,'limit':0x1,'order':[[_0x7ae5('0x27'),_0x7ae5('0x33')]]}]},{'model':db[_0x7ae5('0x34')],'as':'Applications'}]});})[_0x7ae5('0xb')](function(_0x277006){if(_0x277006&&_0x277006[_0x7ae5('0x31')]){var _0x8cf322=_0x277006[_0x7ae5('0x35')]({'plain':!![]});_0x5de21c[_0x7ae5('0x30')]=_0x8cf322;_0x5de21c[_0x7ae5('0x36')]=_0x8cf322[_0x7ae5('0x37')];_0x5de21c[_0x7ae5('0x38')]=_0x8cf322[_0x7ae5('0x31')];_0x5de21c[_0x7ae5('0x36')]=_[_0x7ae5('0x39')](_0x5de21c[_0x7ae5('0x36')],[_0x7ae5('0x3a')],[_0x7ae5('0x3b')]);if(_0x5de21c[_0x7ae5('0x30')][_0x7ae5('0x37')]){delete _0x5de21c[_0x7ae5('0x30')]['Applications'];}if(_0x5de21c['account'][_0x7ae5('0x31')]&&_0x5de21c['account'][_0x7ae5('0x31')]['Contacts']['length']){return _0x5de21c['account'][_0x7ae5('0x31')][_0x7ae5('0x32')][0x0];}var _0x3eeeb7=_[_0x7ae5('0x3c')](_0x574aaa[_0x7ae5('0x1f')],{'firstName':_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x2b')],'ListId':_0x8cf322[_0x7ae5('0x3d')]});_0x3eeeb7[_0x574aaa[_0x7ae5('0x1f')]['mapKey']]=_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x2b')];return db[_0x7ae5('0x21')]['create'](_0x3eeeb7,{'fields':_0x3e7217,'raw':!![]});}})[_0x7ae5('0xb')](function(_0x11a255){_0x5de21c[_0x7ae5('0x3e')]=_0x11a255;if(_0x11a255){var _0x12e1d2={'ContactId':_0x11a255['id'],'FaxAccountId':_0x574aaa[_0x7ae5('0x30')]['id'],'fax':_0x11a255['fax']};return db[_0x7ae5('0x3f')]['find']({'where':{'ContactId':_0x11a255['id'],'closed':![],'FaxAccountId':_0x574aaa[_0x7ae5('0x30')]['id']}})[_0x7ae5('0xb')](function(_0x4ec23d){if(_0x4ec23d){return[_0x4ec23d,![]];}return db[_0x7ae5('0x3f')][_0x7ae5('0x40')](_0x12e1d2)['then'](function(_0x29b452){return[_0x29b452,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7ae5('0x41')](function(_0x35c723,_0x54dfe0){var _0x4ed314=_0x35c723[_0x7ae5('0x35')]({'plain':!![]});if(_0x54dfe0){if(_0x5de21c[_0x7ae5('0x30')][_0x7ae5('0x42')]){_0x5de21c['applications']['push']({'id':0x0,'priority':_0x5de21c[_0x7ae5('0x36')][_0x7ae5('0x43')]+0x1,'app':_0x7ae5('0x44'),'appdata':_0x7ae5('0x45'),'interval':_0x7ae5('0x46')});}_0x4ed314[_0x7ae5('0x47')]=!![];}else{_0x4ed314['created']=![];}_0x5de21c[_0x7ae5('0x48')]=_0x4ed314;return db[_0x7ae5('0x49')][_0x7ae5('0x40')]({'body':_0x574aaa[_0x7ae5('0x1f')][_0x7ae5('0x1f')],'FaxAccountId':_0x574aaa[_0x7ae5('0x30')]['id'],'FaxInteractionId':_0x35c723['id'],'direction':'in','ContactId':_0x35c723[_0x7ae5('0x4a')],'AttachmentId':_0x574aaa['body'][_0x7ae5('0x4b')]});})[_0x7ae5('0xb')](function(_0xc81d3b){_0x5de21c['message']=_0xc81d3b;if(!_0x5de21c['interaction'][_0x7ae5('0x4c')])return;return db['User'][_0x7ae5('0x4d')]({'attributes':['id','name'],'where':{'id':_0x5de21c[_0x7ae5('0x48')][_0x7ae5('0x4c')]}});})[_0x7ae5('0xb')](function(_0x52bca1){if(_0x52bca1){_0x5de21c[_0x7ae5('0x36')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x52bca1[_0x7ae5('0x4e')]+','+(_0x5de21c[_0x7ae5('0x30')][_0x7ae5('0x4f')]||0xa),'interval':_0x7ae5('0x46')});}if(!_0x5de21c[_0x7ae5('0x48')][_0x7ae5('0x50')])return;return db[_0x7ae5('0x51')][_0x7ae5('0x4d')]({'attributes':['id','name'],'where':{'id':_0x5de21c[_0x7ae5('0x48')]['queueId']}});})[_0x7ae5('0xb')](function(_0x387b69){if(_0x387b69){_0x5de21c['applications'][_0x7ae5('0x52')]({'id':0x0,'priority':0x1,'app':_0x7ae5('0x53'),'appdata':_0x387b69[_0x7ae5('0x4e')]+','+(_0x5de21c[_0x7ae5('0x30')]['waitForTheAssignedQueue']||0x12c),'interval':_0x7ae5('0x46')});}return respondWithRpcPromise(_0x7ae5('0x54'),'startRouting',_0x5de21c);})['then'](function(_0x1a7280){_0x4ffeab(_0x1a7280);})[_0x7ae5('0x55')](function(_0x1d0a63){_0x49b0d9(_0x29314d[_0x7ae5('0x10')](0x1f4,_0x1d0a63[_0x7ae5('0x11')]));});});}; \ No newline at end of file +var _0xf155=['autoclose','push','close','unmanaged','created','ContactId','AttachmentId','interaction','UserId','agent','name','waitForTheAssignedAgent','*,*,*,*','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./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','findAll','options','raw','limit','include','map','model','attributes','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','account','CmList','List','DESC','get','applications','Applications','list','orderBy','priority','asc','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xf155,0x73));var _0x5f15=function(_0x45ec0b,_0x260c5d){_0x45ec0b=_0x45ec0b-0x0;var _0x99a3d8=_0xf155[_0x45ec0b];return _0x99a3d8;};'use strict';var _=require(_0x5f15('0x0'));var util=require('util');var moment=require(_0x5f15('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f15('0x2'));var fs=require('fs');var Redis=require(_0x5f15('0x3'));var db=require(_0x5f15('0x4'))['db'];var utils=require(_0x5f15('0x5'));var logger=require(_0x5f15('0x6'))(_0x5f15('0x7'));var config=require(_0x5f15('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5f15('0x9')]({'port':0x232c});config[_0x5f15('0xa')]=_['defaults'](config['redis'],{'host':_0x5f15('0xb'),'port':0x18eb});var socket=require(_0x5f15('0xc'))(new Redis(config[_0x5f15('0xa')]));require(_0x5f15('0xd'))[_0x5f15('0xe')](socket);function respondWithRpcPromise(_0x466fa7,_0xa90964,_0x5ed68f){return new BPromise(function(_0x153eb5,_0x50fdd9){return client[_0x5f15('0xf')](_0x466fa7,_0x5ed68f)[_0x5f15('0x10')](function(_0x4be227){logger[_0x5f15('0x11')](_0x5f15('0x12'),_0xa90964,_0x5f15('0x13'));logger[_0x5f15('0x14')](_0x5f15('0x15'),_0xa90964,_0x5f15('0x13'),JSON[_0x5f15('0x16')](_0x4be227));if(_0x4be227[_0x5f15('0x17')]){if(_0x4be227[_0x5f15('0x17')][_0x5f15('0x18')]===0x1f4){logger[_0x5f15('0x17')](_0x5f15('0x12'),_0xa90964,_0x4be227[_0x5f15('0x17')]['message']);return _0x50fdd9(_0x4be227[_0x5f15('0x17')][_0x5f15('0x19')]);}logger[_0x5f15('0x17')](_0x5f15('0x12'),_0xa90964,_0x4be227[_0x5f15('0x17')][_0x5f15('0x19')]);return _0x153eb5(_0x4be227['error'][_0x5f15('0x19')]);}else{logger[_0x5f15('0x11')](_0x5f15('0x12'),_0xa90964,'request\x20sent');_0x153eb5(_0x4be227[_0x5f15('0x1a')][_0x5f15('0x19')]);}})[_0x5f15('0x1b')](function(_0x1b611d){logger[_0x5f15('0x17')](_0x5f15('0x12'),_0xa90964,_0x1b611d);_0x50fdd9(_0x1b611d);});});}exports['GetFaxAccount']=function(_0x5c197c){var _0x1ee2c4=this;return new Promise(function(_0x1e7911,_0x26751c){return db['FaxAccount'][_0x5f15('0x1c')]({'raw':_0x5c197c[_0x5f15('0x1d')]?_0x5c197c[_0x5f15('0x1d')][_0x5f15('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c197c['options']?_0x5c197c[_0x5f15('0x1d')]['where']||null:null,'attributes':_0x5c197c[_0x5f15('0x1d')]?_0x5c197c['options']['attributes']||null:null,'limit':_0x5c197c[_0x5f15('0x1d')]?_0x5c197c['options'][_0x5f15('0x1f')]||null:null,'include':_0x5c197c[_0x5f15('0x1d')]?_0x5c197c[_0x5f15('0x1d')][_0x5f15('0x20')]?_[_0x5f15('0x21')](_0x5c197c[_0x5f15('0x1d')][_0x5f15('0x20')],function(_0x3d0459){return{'model':db[_0x3d0459[_0x5f15('0x22')]],'as':_0x3d0459['as'],'attributes':_0x3d0459[_0x5f15('0x23')],'include':_0x3d0459[_0x5f15('0x20')]?_[_0x5f15('0x21')](_0x3d0459[_0x5f15('0x20')],function(_0x4e8583){return{'model':db[_0x4e8583[_0x5f15('0x22')]],'as':_0x4e8583['as'],'attributes':_0x4e8583[_0x5f15('0x23')],'include':_0x4e8583[_0x5f15('0x20')]?_[_0x5f15('0x21')](_0x4e8583[_0x5f15('0x20')],function(_0x49d476){return{'model':db[_0x49d476[_0x5f15('0x22')]],'as':_0x49d476['as'],'attributes':_0x49d476[_0x5f15('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x258864){logger['info']('GetFaxAccount',_0x5c197c);logger[_0x5f15('0x14')](_0x5f15('0x24'),_0x5c197c,JSON[_0x5f15('0x16')](_0x258864));_0x1e7911(_0x258864);})[_0x5f15('0x1b')](function(_0x42df66){logger[_0x5f15('0x17')](_0x5f15('0x24'),_0x42df66[_0x5f15('0x19')],_0x5c197c);_0x26751c(_0x1ee2c4[_0x5f15('0x17')](0x1f4,_0x42df66[_0x5f15('0x19')]));});});};exports[_0x5f15('0x25')]=function(_0x2db13a,_0x3000cd,_0x2bc15d){var _0xada4ec=this;return new Promise(function(_0x418571,_0x381882){var _0xf62c4c={'body':_0x2db13a[_0x5f15('0x26')],'channel':_0x5f15('0x27')};var _0x54c589=[];var _0x56c3ec=[];var _0xbf1449={};return db[_0x5f15('0x28')][_0x5f15('0x29')]()['then'](function(_0x515703){if(!_0x515703){throw new db['Sequelize']['ValidationError'](_0x5f15('0x2a'));}_0x54c589=_['difference'](_[_0x5f15('0x2b')](_0x515703),[_0x5f15('0x2c'),_0x5f15('0x2d')]);_0x56c3ec=_[_0x5f15('0x2e')](_[_0x5f15('0x2b')](_0x515703),[_0x5f15('0x2c'),_0x5f15('0x2d'),_0x5f15('0x2f'),_0x5f15('0x30')]);if(_0x2db13a[_0x5f15('0x26')]['id']){delete _0x2db13a[_0x5f15('0x26')]['id'];}if(_[_0x5f15('0x31')](_0x2db13a[_0x5f15('0x26')]['from'])){throw new db[(_0x5f15('0x32'))][(_0x5f15('0x33'))](_0x5f15('0x34'));}if(_[_0x5f15('0x31')](_0x2db13a[_0x5f15('0x26')][_0x5f15('0x26')])||_0x2db13a[_0x5f15('0x26')][_0x5f15('0x26')]===''){throw new db['Sequelize'][(_0x5f15('0x33'))](_0x5f15('0x35'));}if(_[_0x5f15('0x31')](_0x2db13a['body'][_0x5f15('0x36')])){throw new db[(_0x5f15('0x32'))][(_0x5f15('0x33'))](_0x5f15('0x37')+_0x56c3ec);}if(!_[_0x5f15('0x38')](_0x56c3ec,_0x2db13a['body'][_0x5f15('0x36')])){throw new db[(_0x5f15('0x32'))][(_0x5f15('0x33'))](_0x5f15('0x39')+_0x56c3ec);}_0xbf1449[_0x2db13a[_0x5f15('0x26')]['mapKey']]=_0x2db13a[_0x5f15('0x26')][_0x5f15('0x3a')];})['then'](function(){return db[_0x5f15('0x3b')][_0x5f15('0x3c')]({'where':{'id':_0x2db13a[_0x5f15('0x3d')]['id']},'include':[{'model':db[_0x5f15('0x3e')],'as':_0x5f15('0x3f'),'include':[{'model':db[_0x5f15('0x28')],'as':'Contacts','where':_0xbf1449,'limit':0x1,'order':[['updatedAt',_0x5f15('0x40')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x5f15('0x10')](function(_0x279c49){if(_0x279c49&&_0x279c49[_0x5f15('0x3f')]){var _0x518a3e=_0x279c49[_0x5f15('0x41')]({'plain':!![]});_0xf62c4c['account']=_0x518a3e;_0xf62c4c[_0x5f15('0x42')]=_0x518a3e[_0x5f15('0x43')];_0xf62c4c[_0x5f15('0x44')]=_0x518a3e[_0x5f15('0x3f')];_0xf62c4c[_0x5f15('0x42')]=_[_0x5f15('0x45')](_0xf62c4c[_0x5f15('0x42')],[_0x5f15('0x46')],[_0x5f15('0x47')]);if(_0xf62c4c[_0x5f15('0x3d')][_0x5f15('0x43')]){delete _0xf62c4c['account'][_0x5f15('0x43')];}if(_0xf62c4c['account'][_0x5f15('0x3f')]&&_0xf62c4c[_0x5f15('0x3d')][_0x5f15('0x3f')][_0x5f15('0x48')][_0x5f15('0x49')]){return _0xf62c4c[_0x5f15('0x3d')]['List'][_0x5f15('0x48')][0x0];}var _0x43c9ed=_['defaults'](_0x2db13a[_0x5f15('0x26')],{'firstName':_0x2db13a['body'][_0x5f15('0x3a')],'ListId':_0x518a3e[_0x5f15('0x30')]});_0x43c9ed[_0x2db13a['body']['mapKey']]=_0x2db13a['body'][_0x5f15('0x3a')];return db['CmContact'][_0x5f15('0x4a')](_0x43c9ed,{'fields':_0x54c589,'raw':!![]});}})[_0x5f15('0x10')](function(_0x57e255){_0xf62c4c[_0x5f15('0x4b')]=_0x57e255;if(_0x57e255){var _0x83cd3e={'ContactId':_0x57e255['id'],'FaxAccountId':_0x2db13a[_0x5f15('0x3d')]['id'],'fax':_0x57e255[_0x5f15('0x27')]};return db[_0x5f15('0x4c')][_0x5f15('0x3c')]({'where':{'ContactId':_0x57e255['id'],'closed':![],'FaxAccountId':_0x2db13a[_0x5f15('0x3d')]['id']}})['then'](function(_0x127a27){if(_0x127a27){return[_0x127a27,![]];}return db[_0x5f15('0x4c')][_0x5f15('0x4a')](_0x83cd3e)['then'](function(_0x56a323){return[_0x56a323,!![]];});});}else{throw new Error(_0x5f15('0x4d'));}})[_0x5f15('0x4e')](function(_0x4ed30a,_0x6eb18b){var _0x785710=_0x4ed30a[_0x5f15('0x41')]({'plain':!![]});if(_0x6eb18b){if(_0xf62c4c[_0x5f15('0x3d')][_0x5f15('0x4f')]){_0xf62c4c['applications'][_0x5f15('0x50')]({'id':0x0,'priority':_0xf62c4c['applications'][_0x5f15('0x49')]+0x1,'app':_0x5f15('0x51'),'appdata':_0x5f15('0x52'),'interval':'*,*,*,*'});}_0x785710[_0x5f15('0x53')]=!![];}else{_0x785710[_0x5f15('0x53')]=![];}_0xf62c4c['interaction']=_0x785710;return db['FaxMessage'][_0x5f15('0x4a')]({'body':_0x2db13a[_0x5f15('0x26')][_0x5f15('0x26')],'FaxAccountId':_0x2db13a[_0x5f15('0x3d')]['id'],'FaxInteractionId':_0x4ed30a['id'],'direction':'in','ContactId':_0x4ed30a[_0x5f15('0x54')],'AttachmentId':_0x2db13a['body'][_0x5f15('0x55')]});})['then'](function(_0x56f9e6){_0xf62c4c['message']=_0x56f9e6;if(!_0xf62c4c[_0x5f15('0x56')][_0x5f15('0x57')])return;return db['User'][_0x5f15('0x3c')]({'attributes':['id','name'],'where':{'id':_0xf62c4c['interaction']['UserId']}});})[_0x5f15('0x10')](function(_0x5da4d0){if(_0x5da4d0){_0xf62c4c[_0x5f15('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5f15('0x58'),'appdata':_0x5da4d0[_0x5f15('0x59')]+','+(_0xf62c4c[_0x5f15('0x3d')][_0x5f15('0x5a')]||0xa),'interval':_0x5f15('0x5b')});}if(!_0xf62c4c[_0x5f15('0x56')][_0x5f15('0x5c')])return;return db['FaxQueue'][_0x5f15('0x3c')]({'attributes':['id',_0x5f15('0x59')],'where':{'id':_0xf62c4c['interaction'][_0x5f15('0x5c')]}});})[_0x5f15('0x10')](function(_0x62a052){if(_0x62a052){_0xf62c4c[_0x5f15('0x42')]['unshift']({'id':0x0,'priority':0x1,'app':_0x5f15('0x5d'),'appdata':_0x62a052[_0x5f15('0x59')]+','+(_0xf62c4c[_0x5f15('0x3d')][_0x5f15('0x5e')]||0x12c),'interval':_0x5f15('0x5b')});}return respondWithRpcPromise(_0x5f15('0x5f'),_0x5f15('0x60'),_0xf62c4c);})[_0x5f15('0x10')](function(_0x3d9d85){_0x418571(_0x3d9d85);})['catch'](function(_0x33691e){_0x381882(_0xada4ec[_0x5f15('0x17')](0x1f4,_0x33691e[_0x5f15('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e14296d..f2e146a 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 _0xacfd=['register','length','./faxAccount.events','save','update','emit','removeListener'];(function(_0x4022ca,_0x2486c8){var _0x5cb8a9=function(_0x3bfde6){while(--_0x3bfde6){_0x4022ca['push'](_0x4022ca['shift']());}};_0x5cb8a9(++_0x2486c8);}(_0xacfd,0x64));var _0xdacf=function(_0x132c3d,_0x1d1906){_0x132c3d=_0x132c3d-0x0;var _0x2c98f7=_0xacfd[_0x132c3d];return _0x2c98f7;};'use strict';var FaxAccountEvents=require(_0xdacf('0x0'));var events=[_0xdacf('0x1'),'remove',_0xdacf('0x2')];function createListener(_0xe5f983,_0x4531cf){return function(_0x20217b){_0x4531cf[_0xdacf('0x3')](_0xe5f983,_0x20217b);};}function removeListener(_0x22c4fd,_0xbb5090){return function(){FaxAccountEvents[_0xdacf('0x4')](_0x22c4fd,_0xbb5090);};}exports[_0xdacf('0x5')]=function(_0x5a669b){for(var _0x173591=0x0,_0x171caa=events[_0xdacf('0x6')];_0x173591<_0x171caa;_0x173591++){var _0x133d3a=events[_0x173591];var _0x40f2a7=createListener('faxAccount:'+_0x133d3a,_0x5a669b);FaxAccountEvents['on'](_0x133d3a,_0x40f2a7);}}; \ No newline at end of file +var _0xed85=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x40875a,_0x1d672d){var _0x2b6730=function(_0x8e6460){while(--_0x8e6460){_0x40875a['push'](_0x40875a['shift']());}};_0x2b6730(++_0x1d672d);}(_0xed85,0xce));var _0x5ed8=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xed85[_0x2b4411];return _0x8e41ef;};'use strict';var FaxAccountEvents=require(_0x5ed8('0x0'));var events=[_0x5ed8('0x1'),'remove',_0x5ed8('0x2')];function createListener(_0x24d732,_0x175701){return function(_0x44c79e){_0x175701[_0x5ed8('0x3')](_0x24d732,_0x44c79e);};}function removeListener(_0x38d078,_0x1b1a9b){return function(){FaxAccountEvents[_0x5ed8('0x4')](_0x38d078,_0x1b1a9b);};}exports[_0x5ed8('0x5')]=function(_0x5dc29d){for(var _0x40613a=0x0,_0x507942=events[_0x5ed8('0x6')];_0x40613a<_0x507942;_0x40613a++){var _0x727a4e=events[_0x40613a];var _0x36f54c=createListener(_0x5ed8('0x7')+_0x727a4e,_0x5dc29d);FaxAccountEvents['on'](_0x727a4e,_0x36f54c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7766c8d..37e6fe2 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 _0x06d2=['getDispositions','/:id/canned_answers','getAnswers','getApplications','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/dispositions'];(function(_0x370e93,_0x134964){var _0x3e09de=function(_0x2f4bb8){while(--_0x2f4bb8){_0x370e93['push'](_0x370e93['shift']());}};_0x3e09de(++_0x134964);}(_0x06d2,0x194));var _0x206d=function(_0x2d1400,_0x38b458){_0x2d1400=_0x2d1400-0x0;var _0x429d74=_0x06d2[_0x2d1400];return _0x429d74;};'use strict';var multer=require(_0x206d('0x0'));var util=require(_0x206d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x206d('0x2'));var router=express[_0x206d('0x3')]();var fs_extra=require(_0x206d('0x4'));var auth=require(_0x206d('0x5'));var interaction=require(_0x206d('0x6'));var config=require(_0x206d('0x7'));var controller=require('./faxAccount.controller');router[_0x206d('0x8')]('/',auth[_0x206d('0x9')](),controller[_0x206d('0xa')]);router[_0x206d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x206d('0xb')]);router[_0x206d('0x8')](_0x206d('0xc'),auth[_0x206d('0x9')](),controller['show']);router[_0x206d('0x8')](_0x206d('0xd'),auth['isAuthenticated'](),controller[_0x206d('0xe')]);router['get'](_0x206d('0xf'),auth[_0x206d('0x9')](),controller[_0x206d('0x10')]);router['get']('/:id/interactions',auth[_0x206d('0x9')](),controller['getInteractions']);router[_0x206d('0x8')]('/:id/applications',auth[_0x206d('0x9')](),controller[_0x206d('0x11')]);router[_0x206d('0x8')]('/:id/messages',auth[_0x206d('0x9')](),controller[_0x206d('0x12')]);router['get'](_0x206d('0x13'),auth[_0x206d('0x9')](),controller[_0x206d('0x14')]);router[_0x206d('0x15')]('/',auth[_0x206d('0x9')](),controller[_0x206d('0x16')]);router[_0x206d('0x15')](_0x206d('0xd'),auth[_0x206d('0x9')](),controller[_0x206d('0x17')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x206d('0x18')]);router[_0x206d('0x15')]('/:id/interactions',auth[_0x206d('0x9')](),controller[_0x206d('0x19')]);router[_0x206d('0x15')]('/:id/applications',auth[_0x206d('0x9')](),controller[_0x206d('0x1a')]);router[_0x206d('0x15')](_0x206d('0x1b'),auth[_0x206d('0x9')](),controller[_0x206d('0x1c')]);router['post']('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x206d('0x1d')]);router[_0x206d('0x15')]('/:id/send',auth[_0x206d('0x9')](),controller[_0x206d('0x1e')]);router[_0x206d('0x15')](_0x206d('0x13'),auth[_0x206d('0x9')](),controller[_0x206d('0x1f')]);router['put']('/:id',auth[_0x206d('0x9')](),controller[_0x206d('0x20')]);router[_0x206d('0x21')]('/:id',auth[_0x206d('0x9')](),controller[_0x206d('0x22')]);router[_0x206d('0x21')](_0x206d('0xd'),auth['isAuthenticated'](),controller[_0x206d('0x23')]);router['delete']('/:id/canned_answers',auth[_0x206d('0x9')](),controller[_0x206d('0x24')]);router[_0x206d('0x21')](_0x206d('0x13'),auth[_0x206d('0x9')](),controller[_0x206d('0x25')]);module['exports']=router; \ No newline at end of file +var _0xe38f=['/:id/messages','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','index','get','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getApplications'];(function(_0x4f1ecf,_0xcf2a78){var _0x5e4fd1=function(_0x1a2653){while(--_0x1a2653){_0x4f1ecf['push'](_0x4f1ecf['shift']());}};_0x5e4fd1(++_0xcf2a78);}(_0xe38f,0xb5));var _0xfe38=function(_0x255957,_0x13b623){_0x255957=_0x255957-0x0;var _0x51252e=_0xe38f[_0x255957];return _0x51252e;};'use strict';var multer=require(_0xfe38('0x0'));var util=require(_0xfe38('0x1'));var path=require(_0xfe38('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe38('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe38('0x4'));var interaction=require(_0xfe38('0x5'));var config=require(_0xfe38('0x6'));var controller=require(_0xfe38('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfe38('0x8')]);router[_0xfe38('0x9')]('/describe',auth[_0xfe38('0xa')](),controller[_0xfe38('0xb')]);router[_0xfe38('0x9')](_0xfe38('0xc'),auth[_0xfe38('0xa')](),controller[_0xfe38('0xd')]);router['get'](_0xfe38('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xfe38('0xf'),auth[_0xfe38('0xa')](),controller[_0xfe38('0x10')]);router[_0xfe38('0x9')](_0xfe38('0x11'),auth[_0xfe38('0xa')](),controller['getInteractions']);router['get']('/:id/applications',auth[_0xfe38('0xa')](),controller[_0xfe38('0x12')]);router[_0xfe38('0x9')](_0xfe38('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0xfe38('0x9')](_0xfe38('0x14'),auth[_0xfe38('0xa')](),controller[_0xfe38('0x15')]);router['post']('/',auth[_0xfe38('0xa')](),controller[_0xfe38('0x16')]);router[_0xfe38('0x17')](_0xfe38('0xe'),auth[_0xfe38('0xa')](),controller[_0xfe38('0x18')]);router[_0xfe38('0x17')]('/:id/canned_answers',auth[_0xfe38('0xa')](),controller[_0xfe38('0x19')]);router['post'](_0xfe38('0x11'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xfe38('0x17')](_0xfe38('0x1a'),auth[_0xfe38('0xa')](),controller[_0xfe38('0x1b')]);router[_0xfe38('0x17')](_0xfe38('0x1c'),auth['isAuthenticated'](),controller[_0xfe38('0x1d')]);router['post'](_0xfe38('0x1e'),auth['isAuthenticated'](),controller[_0xfe38('0x1f')]);router[_0xfe38('0x17')](_0xfe38('0x20'),auth[_0xfe38('0xa')](),controller['send']);router[_0xfe38('0x17')](_0xfe38('0x14'),auth['isAuthenticated'](),controller[_0xfe38('0x21')]);router[_0xfe38('0x22')]('/:id',auth[_0xfe38('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfe38('0x23')]);router['delete'](_0xfe38('0xe'),auth['isAuthenticated'](),controller[_0xfe38('0x24')]);router['delete'](_0xfe38('0xf'),auth[_0xfe38('0xa')](),controller[_0xfe38('0x25')]);router['delete'](_0xfe38('0x14'),auth[_0xfe38('0xa')](),controller[_0xfe38('0x26')]);module[_0xfe38('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 166e45a..3996ba5 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 _0x79ea=['TEXT','sequelize','STRING'];(function(_0x5a5038,_0x5044c0){var _0x42cc9e=function(_0x4de4b2){while(--_0x4de4b2){_0x5a5038['push'](_0x5a5038['shift']());}};_0x42cc9e(++_0x5044c0);}(_0x79ea,0x8b));var _0xa79e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x79ea[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xa79e('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa79e('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa79e('0x2')]()},'description':{'type':Sequelize[_0xa79e('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8326=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3097c3,_0x237e3e){var _0x3657d5=function(_0x5a414d){while(--_0x5a414d){_0x3097c3['push'](_0x3097c3['shift']());}};_0x3657d5(++_0x237e3e);}(_0x8326,0x14e));var _0x6832=function(_0x4303c3,_0x774599){_0x4303c3=_0x4303c3-0x0;var _0x16422c=_0x8326[_0x4303c3];return _0x16422c;};'use strict';var Sequelize=require(_0x6832('0x0'));module[_0x6832('0x1')]={'priority':{'type':Sequelize[_0x6832('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6832('0x3')],'allowNull':![],'defaultValue':_0x6832('0x4')},'appdata':{'type':Sequelize[_0x6832('0x5')]()},'description':{'type':Sequelize[_0x6832('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6832('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ac59858..7f6c987 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 _0xa2e7=['keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','type','filter','merge','FaxApplication','includeAll','include','findAll','rows','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query'];(function(_0x23e39d,_0xc9afc4){var _0x41c9a6=function(_0x4c784a){while(--_0x4c784a){_0x23e39d['push'](_0x23e39d['shift']());}};_0x41c9a6(++_0xc9afc4);}(_0xa2e7,0xac));var _0x7a2e=function(_0x21a6b6,_0x56a097){_0x21a6b6=_0x21a6b6-0x0;var _0x2fe250=_0xa2e7[_0x21a6b6];return _0x2fe250;};'use strict';var emlformat=require(_0x7a2e('0x0'));var rimraf=require(_0x7a2e('0x1'));var zipdir=require(_0x7a2e('0x2'));var jsonpatch=require(_0x7a2e('0x3'));var rp=require(_0x7a2e('0x4'));var moment=require(_0x7a2e('0x5'));var BPromise=require(_0x7a2e('0x6'));var Mustache=require(_0x7a2e('0x7'));var util=require('util');var path=require(_0x7a2e('0x8'));var sox=require(_0x7a2e('0x9'));var csv=require(_0x7a2e('0xa'));var ejs=require(_0x7a2e('0xb'));var fs=require('fs');var fs_extra=require(_0x7a2e('0xc'));var _=require(_0x7a2e('0xd'));var squel=require('squel');var crypto=require(_0x7a2e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a2e('0xa'));var querystring=require(_0x7a2e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a2e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a2e('0x11'))(_0x7a2e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7a2e('0x13'))['db'];function respondWithStatusCode(_0x3bcae0,_0x19fe7a){_0x19fe7a=_0x19fe7a||0xcc;return function(_0x5943fa){if(_0x5943fa){return _0x3bcae0['sendStatus'](_0x19fe7a);}return _0x3bcae0[_0x7a2e('0x14')](_0x19fe7a)[_0x7a2e('0x15')]();};}function respondWithResult(_0x211614,_0x26cc21){_0x26cc21=_0x26cc21||0xc8;return function(_0x560bee){if(_0x560bee){return _0x211614[_0x7a2e('0x14')](_0x26cc21)[_0x7a2e('0x16')](_0x560bee);}};}function respondWithFilteredResult(_0x16b5f2,_0x78bcc6){return function(_0x5a6f53){if(_0x5a6f53){var _0x196480=typeof _0x78bcc6[_0x7a2e('0x17')]===_0x7a2e('0x18')&&typeof _0x78bcc6['limit']===_0x7a2e('0x18');var _0x44a3f9=_0x5a6f53[_0x7a2e('0x19')];var _0x44e400=_0x196480?0x0:_0x78bcc6[_0x7a2e('0x17')];var _0x284caf=_0x196480?_0x5a6f53[_0x7a2e('0x19')]:_0x78bcc6[_0x7a2e('0x17')]+_0x78bcc6['limit'];var _0x116321;if(_0x284caf>=_0x44a3f9){_0x284caf=_0x44a3f9;_0x116321=0xc8;}else{_0x116321=0xce;}_0x16b5f2[_0x7a2e('0x14')](_0x116321);return _0x16b5f2[_0x7a2e('0x1a')](_0x7a2e('0x1b'),_0x44e400+'-'+_0x284caf+'/'+_0x44a3f9)['json'](_0x5a6f53);}return null;};}function patchUpdates(_0x59eb92){return function(_0x25fd2c){try{jsonpatch[_0x7a2e('0x1c')](_0x25fd2c,_0x59eb92,!![]);}catch(_0x552af8){return BPromise[_0x7a2e('0x1d')](_0x552af8);}return _0x25fd2c['save']();};}function saveUpdates(_0x13c982,_0x1e28b7){return function(_0x4ef048){if(_0x4ef048){return _0x4ef048[_0x7a2e('0x1e')](_0x13c982)[_0x7a2e('0x1f')](function(_0x59157e){return _0x59157e;});}return null;};}function removeEntity(_0x2be93c,_0x297db1){return function(_0x514e1d){if(_0x514e1d){return _0x514e1d[_0x7a2e('0x20')]()['then'](function(){_0x2be93c[_0x7a2e('0x14')](0xcc)[_0x7a2e('0x15')]();});}};}function handleEntityNotFound(_0x5ca979,_0x7df8d8){return function(_0x50e633){if(!_0x50e633){_0x5ca979[_0x7a2e('0x21')](0x194);}return _0x50e633;};}function handleError(_0x457836,_0x1730df){_0x1730df=_0x1730df||0x1f4;return function(_0x4d5f00){logger[_0x7a2e('0x22')](_0x4d5f00[_0x7a2e('0x23')]);if(_0x4d5f00[_0x7a2e('0x24')]){delete _0x4d5f00[_0x7a2e('0x24')];}_0x457836['status'](_0x1730df)[_0x7a2e('0x25')](_0x4d5f00);};}exports[_0x7a2e('0x26')]=function(_0x2dd147,_0x2252dd){var _0x43d885={},_0x52579c={},_0x3b2b95={'count':0x0,'rows':[]};var _0x97c2a9=_[_0x7a2e('0x27')](db['FaxApplication'][_0x7a2e('0x28')],function(_0x44fac6){return{'name':_0x44fac6[_0x7a2e('0x29')],'type':_0x44fac6['type'][_0x7a2e('0x2a')]};});_0x52579c['model']=_['map'](_0x97c2a9,_0x7a2e('0x24'));_0x52579c[_0x7a2e('0x2b')]=_[_0x7a2e('0x2c')](_0x2dd147[_0x7a2e('0x2b')]);_0x52579c['filters']=_[_0x7a2e('0x2d')](_0x52579c[_0x7a2e('0x2e')],_0x52579c['query']);_0x43d885[_0x7a2e('0x2f')]=_[_0x7a2e('0x2d')](_0x52579c[_0x7a2e('0x2e')],qs['fields'](_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x30')]));_0x43d885['attributes']=_0x43d885[_0x7a2e('0x2f')][_0x7a2e('0x31')]?_0x43d885['attributes']:_0x52579c[_0x7a2e('0x2e')];if(!_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x32')](_0x7a2e('0x33'))){_0x43d885[_0x7a2e('0x34')]=qs[_0x7a2e('0x34')](_0x2dd147[_0x7a2e('0x2b')]['limit']);_0x43d885[_0x7a2e('0x17')]=qs[_0x7a2e('0x17')](_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x17')]);}_0x43d885[_0x7a2e('0x35')]=qs[_0x7a2e('0x36')](_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x36')]);_0x43d885['where']=qs[_0x7a2e('0x37')](_[_0x7a2e('0x38')](_0x2dd147[_0x7a2e('0x2b')],_0x52579c[_0x7a2e('0x37')]),_0x97c2a9);if(_0x2dd147[_0x7a2e('0x2b')]['filter']){_0x43d885[_0x7a2e('0x39')]=_['merge'](_0x43d885[_0x7a2e('0x39')],{'$or':_[_0x7a2e('0x27')](_0x97c2a9,function(_0x3b56dc){if(_0x3b56dc[_0x7a2e('0x3a')]!=='VIRTUAL'){var _0x55b017={};_0x55b017[_0x3b56dc['name']]={'$like':'%'+_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x3b')]+'%'};return _0x55b017;}})});}_0x43d885=_[_0x7a2e('0x3c')]({},_0x43d885,_0x2dd147['options']);var _0x58f079={'where':_0x43d885[_0x7a2e('0x39')]};return db[_0x7a2e('0x3d')][_0x7a2e('0x19')](_0x58f079)[_0x7a2e('0x1f')](function(_0x5db844){_0x3b2b95['count']=_0x5db844;if(_0x2dd147[_0x7a2e('0x2b')][_0x7a2e('0x3e')]){_0x43d885[_0x7a2e('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x7a2e('0x40')](_0x43d885);})['then'](function(_0x2aeb6e){_0x3b2b95[_0x7a2e('0x41')]=_0x2aeb6e;return _0x3b2b95;})['then'](respondWithFilteredResult(_0x2252dd,_0x43d885))[_0x7a2e('0x42')](handleError(_0x2252dd,null));};exports['show']=function(_0x54bc12,_0x29a9ba){var _0x3749d8={'raw':!![],'where':{'id':_0x54bc12['params']['id']}},_0x51d8fd={};_0x51d8fd['model']=_['keys'](db[_0x7a2e('0x3d')]['rawAttributes']);_0x51d8fd[_0x7a2e('0x2b')]=_[_0x7a2e('0x2c')](_0x54bc12[_0x7a2e('0x2b')]);_0x51d8fd['filters']=_[_0x7a2e('0x2d')](_0x51d8fd[_0x7a2e('0x2e')],_0x51d8fd[_0x7a2e('0x2b')]);_0x3749d8['attributes']=_[_0x7a2e('0x2d')](_0x51d8fd[_0x7a2e('0x2e')],qs[_0x7a2e('0x30')](_0x54bc12[_0x7a2e('0x2b')][_0x7a2e('0x30')]));_0x3749d8[_0x7a2e('0x2f')]=_0x3749d8['attributes'][_0x7a2e('0x31')]?_0x3749d8[_0x7a2e('0x2f')]:_0x51d8fd[_0x7a2e('0x2e')];if(_0x54bc12[_0x7a2e('0x2b')][_0x7a2e('0x3e')]){_0x3749d8[_0x7a2e('0x3f')]=[{'all':!![]}];}_0x3749d8=_[_0x7a2e('0x3c')]({},_0x3749d8,_0x54bc12[_0x7a2e('0x43')]);return db[_0x7a2e('0x3d')][_0x7a2e('0x44')](_0x3749d8)[_0x7a2e('0x1f')](handleEntityNotFound(_0x29a9ba,null))['then'](respondWithResult(_0x29a9ba,null))[_0x7a2e('0x42')](handleError(_0x29a9ba,null));};exports[_0x7a2e('0x45')]=function(_0x2c6a20,_0x53a889){return db[_0x7a2e('0x3d')][_0x7a2e('0x45')](_0x2c6a20[_0x7a2e('0x46')],{})[_0x7a2e('0x1f')](respondWithResult(_0x53a889,0xc9))[_0x7a2e('0x42')](handleError(_0x53a889,null));};exports['update']=function(_0x2d3f81,_0x1badaa){if(_0x2d3f81['body']['id']){delete _0x2d3f81[_0x7a2e('0x46')]['id'];}return db[_0x7a2e('0x3d')][_0x7a2e('0x44')]({'where':{'id':_0x2d3f81['params']['id']}})[_0x7a2e('0x1f')](handleEntityNotFound(_0x1badaa,null))[_0x7a2e('0x1f')](saveUpdates(_0x2d3f81[_0x7a2e('0x46')],null))[_0x7a2e('0x1f')](respondWithResult(_0x1badaa,null))[_0x7a2e('0x42')](handleError(_0x1badaa,null));};exports[_0x7a2e('0x20')]=function(_0x1edcfb,_0x135c62){return db['FaxApplication']['find']({'where':{'id':_0x1edcfb[_0x7a2e('0x47')]['id']}})[_0x7a2e('0x1f')](handleEntityNotFound(_0x135c62,null))[_0x7a2e('0x1f')](removeEntity(_0x135c62,null))['catch'](handleError(_0x135c62,null));}; \ No newline at end of file +var _0xa591=['set','Content-Range','apply','destroy','then','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xa591,0x18d));var _0x1a59=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa591[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a59('0x0'));var zipdir=require(_0x1a59('0x1'));var jsonpatch=require(_0x1a59('0x2'));var rp=require('request-promise');var moment=require(_0x1a59('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1a59('0x4'));var util=require('util');var path=require(_0x1a59('0x5'));var sox=require(_0x1a59('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a59('0x7'));var _=require(_0x1a59('0x8'));var squel=require('squel');var crypto=require(_0x1a59('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1a59('0xa'));var querystring=require(_0x1a59('0xb'));var Papa=require(_0x1a59('0xc'));var Redis=require(_0x1a59('0xd'));var authService=require(_0x1a59('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1a59('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a59('0x10'))(_0x1a59('0x11'));var utils=require(_0x1a59('0x12'));var config=require(_0x1a59('0x13'));var licenseUtil=require(_0x1a59('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b128,_0x13ec50){_0x13ec50=_0x13ec50||0xcc;return function(_0x475446){if(_0x475446){return _0x43b128[_0x1a59('0x15')](_0x13ec50);}return _0x43b128['status'](_0x13ec50)[_0x1a59('0x16')]();};}function respondWithResult(_0x5041f5,_0x8a55f1){_0x8a55f1=_0x8a55f1||0xc8;return function(_0x4bcec8){if(_0x4bcec8){return _0x5041f5[_0x1a59('0x17')](_0x8a55f1)[_0x1a59('0x18')](_0x4bcec8);}};}function respondWithFilteredResult(_0x3b926c,_0x2f6256){return function(_0x596c74){if(_0x596c74){var _0x3bdf47=typeof _0x2f6256['offset']===_0x1a59('0x19')&&typeof _0x2f6256[_0x1a59('0x1a')]===_0x1a59('0x19');var _0x17197a=_0x596c74[_0x1a59('0x1b')];var _0x1c5cbe=_0x3bdf47?0x0:_0x2f6256['offset'];var _0x419078=_0x3bdf47?_0x596c74[_0x1a59('0x1b')]:_0x2f6256[_0x1a59('0x1c')]+_0x2f6256[_0x1a59('0x1a')];var _0x265f9c;if(_0x419078>=_0x17197a){_0x419078=_0x17197a;_0x265f9c=0xc8;}else{_0x265f9c=0xce;}_0x3b926c['status'](_0x265f9c);return _0x3b926c[_0x1a59('0x1d')](_0x1a59('0x1e'),_0x1c5cbe+'-'+_0x419078+'/'+_0x17197a)[_0x1a59('0x18')](_0x596c74);}return null;};}function patchUpdates(_0x1ccc71){return function(_0x9c48cd){try{jsonpatch[_0x1a59('0x1f')](_0x9c48cd,_0x1ccc71,!![]);}catch(_0x127097){return BPromise['reject'](_0x127097);}return _0x9c48cd['save']();};}function saveUpdates(_0x2c820d,_0x3bb3c8){return function(_0x43b990){if(_0x43b990){return _0x43b990['update'](_0x2c820d)['then'](function(_0x32fa04){return _0x32fa04;});}return null;};}function removeEntity(_0x3213e7,_0x27e626){return function(_0x236f6a){if(_0x236f6a){return _0x236f6a[_0x1a59('0x20')]()[_0x1a59('0x21')](function(){_0x3213e7[_0x1a59('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15c9f2,_0x3efe34){return function(_0x34bce5){if(!_0x34bce5){_0x15c9f2[_0x1a59('0x15')](0x194);}return _0x34bce5;};}function handleError(_0xbfd510,_0x2562de){_0x2562de=_0x2562de||0x1f4;return function(_0x51dbc8){logger[_0x1a59('0x22')](_0x51dbc8[_0x1a59('0x23')]);if(_0x51dbc8[_0x1a59('0x24')]){delete _0x51dbc8[_0x1a59('0x24')];}_0xbfd510[_0x1a59('0x17')](_0x2562de)[_0x1a59('0x25')](_0x51dbc8);};}exports['index']=function(_0x20f178,_0x39d18e){var _0x398333={},_0x2931e5={},_0x5091c3={'count':0x0,'rows':[]};var _0x4790ad=_[_0x1a59('0x26')](db[_0x1a59('0x27')][_0x1a59('0x28')],function(_0x444cee){return{'name':_0x444cee[_0x1a59('0x29')],'type':_0x444cee[_0x1a59('0x2a')][_0x1a59('0x2b')]};});_0x2931e5[_0x1a59('0x2c')]=_['map'](_0x4790ad,_0x1a59('0x24'));_0x2931e5['query']=_[_0x1a59('0x2d')](_0x20f178[_0x1a59('0x2e')]);_0x2931e5[_0x1a59('0x2f')]=_[_0x1a59('0x30')](_0x2931e5[_0x1a59('0x2c')],_0x2931e5['query']);_0x398333['attributes']=_[_0x1a59('0x30')](_0x2931e5['model'],qs[_0x1a59('0x31')](_0x20f178[_0x1a59('0x2e')][_0x1a59('0x31')]));_0x398333[_0x1a59('0x32')]=_0x398333[_0x1a59('0x32')][_0x1a59('0x33')]?_0x398333[_0x1a59('0x32')]:_0x2931e5['model'];if(!_0x20f178[_0x1a59('0x2e')][_0x1a59('0x34')]('nolimit')){_0x398333[_0x1a59('0x1a')]=qs[_0x1a59('0x1a')](_0x20f178[_0x1a59('0x2e')][_0x1a59('0x1a')]);_0x398333[_0x1a59('0x1c')]=qs['offset'](_0x20f178[_0x1a59('0x2e')]['offset']);}_0x398333[_0x1a59('0x35')]=qs['sort'](_0x20f178[_0x1a59('0x2e')][_0x1a59('0x36')]);_0x398333['where']=qs[_0x1a59('0x2f')](_[_0x1a59('0x37')](_0x20f178[_0x1a59('0x2e')],_0x2931e5[_0x1a59('0x2f')]),_0x4790ad);if(_0x20f178[_0x1a59('0x2e')]['filter']){_0x398333[_0x1a59('0x38')]=_[_0x1a59('0x39')](_0x398333['where'],{'$or':_[_0x1a59('0x26')](_0x4790ad,function(_0xf77fa9){if(_0xf77fa9[_0x1a59('0x2a')]!==_0x1a59('0x3a')){var _0x26ff55={};_0x26ff55[_0xf77fa9['name']]={'$like':'%'+_0x20f178[_0x1a59('0x2e')][_0x1a59('0x3b')]+'%'};return _0x26ff55;}})});}_0x398333=_[_0x1a59('0x39')]({},_0x398333,_0x20f178['options']);var _0x4f8f1b={'where':_0x398333[_0x1a59('0x38')]};return db[_0x1a59('0x27')][_0x1a59('0x1b')](_0x4f8f1b)['then'](function(_0xc9ca34){_0x5091c3[_0x1a59('0x1b')]=_0xc9ca34;if(_0x20f178[_0x1a59('0x2e')][_0x1a59('0x3c')]){_0x398333[_0x1a59('0x3d')]=[{'all':!![]}];}return db[_0x1a59('0x27')][_0x1a59('0x3e')](_0x398333);})[_0x1a59('0x21')](function(_0x1f2324){_0x5091c3[_0x1a59('0x3f')]=_0x1f2324;return _0x5091c3;})[_0x1a59('0x21')](respondWithFilteredResult(_0x39d18e,_0x398333))[_0x1a59('0x40')](handleError(_0x39d18e,null));};exports['show']=function(_0x2c29f3,_0x1d06f4){var _0xc62f06={'raw':!![],'where':{'id':_0x2c29f3[_0x1a59('0x41')]['id']}},_0x388bdb={};_0x388bdb[_0x1a59('0x2c')]=_[_0x1a59('0x2d')](db[_0x1a59('0x27')][_0x1a59('0x28')]);_0x388bdb['query']=_[_0x1a59('0x2d')](_0x2c29f3[_0x1a59('0x2e')]);_0x388bdb['filters']=_[_0x1a59('0x30')](_0x388bdb[_0x1a59('0x2c')],_0x388bdb['query']);_0xc62f06[_0x1a59('0x32')]=_[_0x1a59('0x30')](_0x388bdb[_0x1a59('0x2c')],qs[_0x1a59('0x31')](_0x2c29f3[_0x1a59('0x2e')][_0x1a59('0x31')]));_0xc62f06[_0x1a59('0x32')]=_0xc62f06[_0x1a59('0x32')][_0x1a59('0x33')]?_0xc62f06[_0x1a59('0x32')]:_0x388bdb['model'];if(_0x2c29f3[_0x1a59('0x2e')][_0x1a59('0x3c')]){_0xc62f06['include']=[{'all':!![]}];}_0xc62f06=_[_0x1a59('0x39')]({},_0xc62f06,_0x2c29f3[_0x1a59('0x42')]);return db[_0x1a59('0x27')][_0x1a59('0x43')](_0xc62f06)[_0x1a59('0x21')](handleEntityNotFound(_0x1d06f4,null))[_0x1a59('0x21')](respondWithResult(_0x1d06f4,null))['catch'](handleError(_0x1d06f4,null));};exports[_0x1a59('0x44')]=function(_0x57b778,_0x5987c8){return db[_0x1a59('0x27')][_0x1a59('0x44')](_0x57b778[_0x1a59('0x45')],{})[_0x1a59('0x21')](respondWithResult(_0x5987c8,0xc9))[_0x1a59('0x40')](handleError(_0x5987c8,null));};exports[_0x1a59('0x46')]=function(_0x4dd6aa,_0x5d0ed3){if(_0x4dd6aa['body']['id']){delete _0x4dd6aa['body']['id'];}return db[_0x1a59('0x27')][_0x1a59('0x43')]({'where':{'id':_0x4dd6aa[_0x1a59('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d0ed3,null))['then'](saveUpdates(_0x4dd6aa[_0x1a59('0x45')],null))[_0x1a59('0x21')](respondWithResult(_0x5d0ed3,null))[_0x1a59('0x40')](handleError(_0x5d0ed3,null));};exports['destroy']=function(_0x1ac7d9,_0xdd8305){return db[_0x1a59('0x27')]['find']({'where':{'id':_0x1ac7d9['params']['id']}})[_0x1a59('0x21')](handleEntityNotFound(_0xdd8305,null))[_0x1a59('0x21')](removeEntity(_0xdd8305,null))[_0x1a59('0x40')](handleError(_0xdd8305,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 02a6315..4c466d0 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 _0x669e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4','../../config/logger'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x669e,0x1bb));var _0xe669=function(_0x10e98b,_0x407343){_0x10e98b=_0x10e98b-0x0;var _0x5cc787=_0x669e[_0x10e98b];return _0x5cc787;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe669('0x0'))(_0xe669('0x1'));var moment=require(_0xe669('0x2'));var BPromise=require(_0xe669('0x3'));var rp=require(_0xe669('0x4'));var fs=require('fs');var path=require(_0xe669('0x5'));var rimraf=require(_0xe669('0x6'));var config=require(_0xe669('0x7'));var attributes=require('./faxApplication.attributes');module[_0xe669('0x8')]=function(_0x83442b,_0x3ed3e2){return _0x83442b[_0xe669('0x9')]('FaxApplication',attributes,{'tableName':_0xe669('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe669('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd09e=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd09e,0x175));var _0xed09=function(_0x21d9f1,_0x220538){_0x21d9f1=_0x21d9f1-0x0;var _0x333dcf=_0xd09e[_0x21d9f1];return _0x333dcf;};'use strict';var _=require(_0xed09('0x0'));var util=require('util');var logger=require(_0xed09('0x1'))(_0xed09('0x2'));var moment=require('moment');var BPromise=require(_0xed09('0x3'));var rp=require(_0xed09('0x4'));var fs=require('fs');var path=require(_0xed09('0x5'));var rimraf=require(_0xed09('0x6'));var config=require(_0xed09('0x7'));var attributes=require(_0xed09('0x8'));module[_0xed09('0x9')]=function(_0x39fdc6,_0x24ec65){return _0x39fdc6[_0xed09('0xa')](_0xed09('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed09('0xc'),'collate':_0xed09('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ee21d96..cc3d78d 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 _0xdc02=['http','request','then','info','FaxApplication,\x20%s,\x20%s','stringify','error','request\x20sent','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','debug','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xdc02,0x1d3));var _0x2dc0=function(_0xb8d37c,_0x10a6a4){_0xb8d37c=_0xb8d37c-0x0;var _0x400f4b=_0xdc02[_0xb8d37c];return _0x400f4b;};'use strict';var _=require(_0x2dc0('0x0'));var util=require(_0x2dc0('0x1'));var moment=require(_0x2dc0('0x2'));var BPromise=require(_0x2dc0('0x3'));var rs=require(_0x2dc0('0x4'));var fs=require('fs');var Redis=require(_0x2dc0('0x5'));var db=require(_0x2dc0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2dc0('0x7'));var jayson=require(_0x2dc0('0x8'));var client=jayson['client'][_0x2dc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcab9b7,_0x36838a,_0x53060d){return new BPromise(function(_0x4fb2f3,_0x4b6bba){return client[_0x2dc0('0xa')](_0xcab9b7,_0x53060d)[_0x2dc0('0xb')](function(_0x28625b){logger[_0x2dc0('0xc')](_0x2dc0('0xd'),_0x36838a,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x36838a,'request\x20sent',JSON[_0x2dc0('0xe')](_0x28625b));if(_0x28625b[_0x2dc0('0xf')]){if(_0x28625b[_0x2dc0('0xf')]['code']===0x1f4){logger[_0x2dc0('0xf')](_0x2dc0('0xd'),_0x36838a,_0x28625b[_0x2dc0('0xf')]['message']);return _0x4b6bba(_0x28625b[_0x2dc0('0xf')]['message']);}logger[_0x2dc0('0xf')](_0x2dc0('0xd'),_0x36838a,_0x28625b[_0x2dc0('0xf')]['message']);return _0x4fb2f3(_0x28625b['error']['message']);}else{logger[_0x2dc0('0xc')]('FaxApplication,\x20%s,\x20%s',_0x36838a,_0x2dc0('0x10'));_0x4fb2f3(_0x28625b[_0x2dc0('0x11')]['message']);}})[_0x2dc0('0x12')](function(_0x487136){logger['error']('FaxApplication,\x20%s,\x20%s',_0x36838a,_0x487136);_0x4b6bba(_0x487136);});});}exports[_0x2dc0('0x13')]=function(_0x20ed2c){var _0x2af446=this;return new Promise(function(_0x25c40d,_0x2b20ec){return db[_0x2dc0('0x14')][_0x2dc0('0x15')](_0x20ed2c[_0x2dc0('0x16')],{'raw':_0x20ed2c[_0x2dc0('0x17')]?_0x20ed2c[_0x2dc0('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ed2c[_0x2dc0('0x17')]?_0x20ed2c[_0x2dc0('0x17')][_0x2dc0('0x18')]||null:null,'attributes':_0x20ed2c[_0x2dc0('0x17')]?_0x20ed2c[_0x2dc0('0x17')][_0x2dc0('0x19')]||null:null,'limit':_0x20ed2c[_0x2dc0('0x17')]?_0x20ed2c['options']['limit']||null:null})[_0x2dc0('0xb')](function(_0x40b8f2){logger[_0x2dc0('0xc')](_0x2dc0('0x13'),_0x20ed2c);logger[_0x2dc0('0x1a')](_0x2dc0('0x13'),_0x20ed2c,JSON['stringify'](_0x40b8f2));_0x25c40d(_0x40b8f2);})[_0x2dc0('0x12')](function(_0x3945c9){logger[_0x2dc0('0xf')](_0x2dc0('0x13'),_0x3945c9[_0x2dc0('0x1b')],_0x20ed2c);_0x2b20ec(_0x2af446['error'](0x1f4,_0x3945c9[_0x2dc0('0x1b')]));});});}; \ No newline at end of file +var _0x4cf8=['error','FaxApplication,\x20%s,\x20%s','message','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e3b25,_0x2e72ae){var _0x2f16b5=function(_0x53ef5b){while(--_0x53ef5b){_0x1e3b25['push'](_0x1e3b25['shift']());}};_0x2f16b5(++_0x2e72ae);}(_0x4cf8,0xfe));var _0x84cf=function(_0xa46b86,_0x5c1465){_0xa46b86=_0xa46b86-0x0;var _0x417360=_0x4cf8[_0xa46b86];return _0x417360;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x84cf('0x7'));var config=require('../../config/environment');var jayson=require(_0x84cf('0x8'));var client=jayson[_0x84cf('0x9')][_0x84cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x306782,_0x4b4dbb,_0x5e5602){return new BPromise(function(_0x1ce578,_0x20030a){return client['request'](_0x306782,_0x5e5602)[_0x84cf('0xb')](function(_0x119e2c){logger['info']('FaxApplication,\x20%s,\x20%s',_0x4b4dbb,_0x84cf('0xc'));logger[_0x84cf('0xd')](_0x84cf('0xe'),_0x4b4dbb,_0x84cf('0xc'),JSON[_0x84cf('0xf')](_0x119e2c));if(_0x119e2c[_0x84cf('0x10')]){if(_0x119e2c[_0x84cf('0x10')]['code']===0x1f4){logger[_0x84cf('0x10')](_0x84cf('0x11'),_0x4b4dbb,_0x119e2c[_0x84cf('0x10')][_0x84cf('0x12')]);return _0x20030a(_0x119e2c['error']['message']);}logger[_0x84cf('0x10')](_0x84cf('0x11'),_0x4b4dbb,_0x119e2c[_0x84cf('0x10')][_0x84cf('0x12')]);return _0x1ce578(_0x119e2c[_0x84cf('0x10')]['message']);}else{logger['info'](_0x84cf('0x11'),_0x4b4dbb,_0x84cf('0xc'));_0x1ce578(_0x119e2c['result'][_0x84cf('0x12')]);}})['catch'](function(_0x7ee4a9){logger[_0x84cf('0x10')](_0x84cf('0x11'),_0x4b4dbb,_0x7ee4a9);_0x20030a(_0x7ee4a9);});});}exports[_0x84cf('0x13')]=function(_0x3abf62){var _0x54c05c=this;return new Promise(function(_0x2f2021,_0x32bca6){return db[_0x84cf('0x14')][_0x84cf('0x15')](_0x3abf62[_0x84cf('0x16')],{'raw':_0x3abf62[_0x84cf('0x17')]?_0x3abf62[_0x84cf('0x17')][_0x84cf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3abf62[_0x84cf('0x17')]?_0x3abf62[_0x84cf('0x17')][_0x84cf('0x19')]||null:null,'attributes':_0x3abf62[_0x84cf('0x17')]?_0x3abf62[_0x84cf('0x17')][_0x84cf('0x1a')]||null:null,'limit':_0x3abf62[_0x84cf('0x17')]?_0x3abf62[_0x84cf('0x17')][_0x84cf('0x1b')]||null:null})[_0x84cf('0xb')](function(_0x5a897c){logger[_0x84cf('0x1c')](_0x84cf('0x13'),_0x3abf62);logger[_0x84cf('0xd')]('UpdateFaxApplication',_0x3abf62,JSON[_0x84cf('0xf')](_0x5a897c));_0x2f2021(_0x5a897c);})[_0x84cf('0x1d')](function(_0x3a6c82){logger[_0x84cf('0x10')](_0x84cf('0x13'),_0x3a6c82['message'],_0x3abf62);_0x32bca6(_0x54c05c[_0x84cf('0x10')](0x1f4,_0x3a6c82[_0x84cf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 188cd6a..1bd2b89 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x31e1a5,_0x24a0d5){var _0x1d74f3=function(_0x3f5424){while(--_0x3f5424){_0x31e1a5['push'](_0x31e1a5['shift']());}};_0x1d74f3(++_0x24a0d5);}(_0x9354,0x96));var _0x4935=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x9354[_0x8b0f43];return _0x3f4425;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file +var _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x1754db,_0x228ab6){var _0x27a110=function(_0x669cb1){while(--_0x669cb1){_0x1754db['push'](_0x1754db['shift']());}};_0x27a110(++_0x228ab6);}(_0x9354,0x96));var _0x4935=function(_0x10d341,_0x57ff35){_0x10d341=_0x10d341-0x0;var _0xddc36d=_0x9354[_0x10d341];return _0xddc36d;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b01ed30..4d43b13 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 _0x958a=['ENUM','INTEGER','sequelize','exports','DATE','STRING','out'];(function(_0x2730ad,_0x4d247d){var _0x1d4363=function(_0x17c180){while(--_0x17c180){_0x2730ad['push'](_0x2730ad['shift']());}};_0x1d4363(++_0x4d247d);}(_0x958a,0x128));var _0xa958=function(_0x4ccd84,_0x147a41){_0x4ccd84=_0x4ccd84-0x0;var _0x1d7fc7=_0x958a[_0x4ccd84];return _0x1d7fc7;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa958('0x2')]},'disposition':{'type':Sequelize[_0xa958('0x3')]},'secondDisposition':{'type':Sequelize[_0xa958('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa958('0x3')]},'note':{'type':Sequelize[_0xa958('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xa958('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa958('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa958('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa958('0x5')]('in',_0xa958('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xa958('0x6')]}}; \ No newline at end of file +var _0xadb5=['DATE','STRING','out','ENUM','INTEGER','exports'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0xadb5,0xad));var _0x5adb=function(_0x3c8864,_0x1c496d){_0x3c8864=_0x3c8864-0x0;var _0x5656d9=_0xadb5[_0x3c8864];return _0x5656d9;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5adb('0x1')]},'disposition':{'type':Sequelize[_0x5adb('0x2')]},'secondDisposition':{'type':Sequelize[_0x5adb('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5adb('0x2')]},'read1stAt':{'type':Sequelize[_0x5adb('0x1')]},'fax':{'type':Sequelize[_0x5adb('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5adb('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5adb('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x5adb('0x4')]('in',_0x5adb('0x3')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x5adb('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 266c002..8460bf5 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 _0x8e05=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','root','server','files','tmp','attachments','transcript-%d-%s.zip','join','push','Attachment','Messages','createdAt','get','mkdirSync','basename','createReadStream','createWriteStream','resolve','log','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','offset','count','set','json','update','then','destroy','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','fax','query','user','show','model','keys','attributes','intersection','includeAll','merge','options','find','catch','create','body','params','describe','addMessage','FaxMessage','ids','omit','findOne','filters','fields'];(function(_0xbb122b,_0x4c42d6){var _0xd61670=function(_0x11b1aa){while(--_0x11b1aa){_0xbb122b['push'](_0xbb122b['shift']());}};_0xd61670(++_0x4c42d6);}(_0x8e05,0xf7));var _0x58e0=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x8e05[_0x43d11d];return _0x38cd08;};'use strict';var rimraf=require(_0x58e0('0x0'));var zipdir=require(_0x58e0('0x1'));var moment=require('moment');var BPromise=require(_0x58e0('0x2'));var util=require(_0x58e0('0x3'));var path=require(_0x58e0('0x4'));var fs=require('fs');var _=require(_0x58e0('0x5'));var Redis=require(_0x58e0('0x6'));var interaction=require(_0x58e0('0x7'));var qs=require(_0x58e0('0x8'));var logger=require(_0x58e0('0x9'))(_0x58e0('0xa'));var config=require(_0x58e0('0xb'));var db=require(_0x58e0('0xc'))['db'];config[_0x58e0('0xd')]=_[_0x58e0('0xe')](config[_0x58e0('0xd')],{'host':_0x58e0('0xf'),'port':0x18eb});var socket=require(_0x58e0('0x10'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x58e0('0x11')](socket);function respondWithStatusCode(_0x3efa63,_0x40a053){_0x40a053=_0x40a053||0xcc;return function(_0x48eae1){if(_0x48eae1){return _0x3efa63[_0x58e0('0x12')](_0x40a053);}return _0x3efa63[_0x58e0('0x13')](_0x40a053)[_0x58e0('0x14')]();};}function respondWithResult(_0x56efb8,_0x2159e6){_0x2159e6=_0x2159e6||0xc8;return function(_0x499158){if(_0x499158){return _0x56efb8['status'](_0x2159e6)['json'](_0x499158);}};}function respondWithFilteredResult(_0x45c1e7,_0x3ca600){return function(_0x5e2dbe){if(_0x5e2dbe){var _0x55a278=typeof _0x3ca600['offset']==='undefined'&&typeof _0x3ca600['limit']===_0x58e0('0x15');var _0xf04039=_0x5e2dbe['count'];var _0x611b2=_0x55a278?0x0:_0x3ca600[_0x58e0('0x16')];var _0x534a5e=_0x55a278?_0x5e2dbe[_0x58e0('0x17')]:_0x3ca600['offset']+_0x3ca600['limit'];var _0x1c2b39;if(_0x534a5e>=_0xf04039){_0x534a5e=_0xf04039;_0x1c2b39=0xc8;}else{_0x1c2b39=0xce;}_0x45c1e7[_0x58e0('0x13')](_0x1c2b39);return _0x45c1e7[_0x58e0('0x18')]('Content-Range',_0x611b2+'-'+_0x534a5e+'/'+_0xf04039)[_0x58e0('0x19')](_0x5e2dbe);}return null;};}function saveUpdates(_0x123ebe){return function(_0x353a31){if(_0x353a31){return _0x353a31[_0x58e0('0x1a')](_0x123ebe)[_0x58e0('0x1b')](function(_0x234a92){return _0x234a92;});}return null;};}function removeEntity(_0x35d330){return function(_0x328075){if(_0x328075){return _0x328075[_0x58e0('0x1c')]()['then'](function(){_0x35d330['status'](0xcc)[_0x58e0('0x14')]();});}};}function handleEntityNotFound(_0x4345ce){return function(_0x212511){if(!_0x212511){_0x4345ce[_0x58e0('0x12')](0x194);}return _0x212511;};}function handleError(_0x1658a1,_0x3b318e){_0x3b318e=_0x3b318e||0x1f4;return function(_0x5e431c){logger[_0x58e0('0x1d')](_0x5e431c['stack']);if(_0x5e431c[_0x58e0('0x1e')]){delete _0x5e431c['name'];}_0x1658a1[_0x58e0('0x13')](_0x3b318e)[_0x58e0('0x1f')](_0x5e431c);};}exports[_0x58e0('0x20')]=function(_0x50afd9,_0x169d24){var _0x18b48b={};var _0x4a7775=_[_0x58e0('0x21')](db[_0x58e0('0x22')][_0x58e0('0x23')],function(_0x6682f4){return{'name':_0x6682f4[_0x58e0('0x24')],'type':_0x6682f4['type'][_0x58e0('0x25')]};});_0x18b48b=qs['getOptions'](_0x4a7775,_0x50afd9);return interaction['findAll'](_0x58e0('0x26'),_0x50afd9[_0x58e0('0x27')],_0x50afd9[_0x58e0('0x28')],_0x18b48b,_0x4a7775)['then'](respondWithFilteredResult(_0x169d24,_0x18b48b))['catch'](handleError(_0x169d24,null));};exports[_0x58e0('0x29')]=function(_0x2da8be,_0x4743b8){var _0x155882={'raw':![],'where':{'id':_0x2da8be['params']['id']}},_0x292a7b={};_0x292a7b[_0x58e0('0x2a')]=_[_0x58e0('0x2b')](db[_0x58e0('0x22')][_0x58e0('0x23')]);_0x292a7b[_0x58e0('0x27')]=_[_0x58e0('0x2b')](_0x2da8be[_0x58e0('0x27')]);_0x292a7b['filters']=_['intersection'](_0x292a7b[_0x58e0('0x2a')],_0x292a7b[_0x58e0('0x27')]);_0x155882[_0x58e0('0x2c')]=_[_0x58e0('0x2d')](_0x292a7b[_0x58e0('0x2a')],qs['fields'](_0x2da8be[_0x58e0('0x27')]['fields']));_0x155882[_0x58e0('0x2c')]=_0x155882[_0x58e0('0x2c')]['length']?_0x155882[_0x58e0('0x2c')]:_0x292a7b[_0x58e0('0x2a')];if(_0x2da8be[_0x58e0('0x27')][_0x58e0('0x2e')]){_0x155882['include']=[{'all':!![]}];}_0x155882=_[_0x58e0('0x2f')]({},_0x155882,_0x2da8be[_0x58e0('0x30')]);return db[_0x58e0('0x22')][_0x58e0('0x31')](_0x155882)[_0x58e0('0x1b')](handleEntityNotFound(_0x4743b8,null))[_0x58e0('0x1b')](respondWithResult(_0x4743b8,null))[_0x58e0('0x32')](handleError(_0x4743b8,null));};exports['create']=function(_0x2e87a7,_0x2a86d4){return db[_0x58e0('0x22')][_0x58e0('0x33')](_0x2e87a7['body'],{})[_0x58e0('0x1b')](respondWithResult(_0x2a86d4,0xc9))[_0x58e0('0x32')](handleError(_0x2a86d4,null));};exports[_0x58e0('0x1a')]=function(_0x1a3143,_0x1a30ca){if(_0x1a3143[_0x58e0('0x34')]['id']){delete _0x1a3143[_0x58e0('0x34')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x1a3143[_0x58e0('0x35')]['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x1a30ca,null))['then'](saveUpdates(_0x1a3143[_0x58e0('0x34')],null))['then'](respondWithResult(_0x1a30ca,null))[_0x58e0('0x32')](handleError(_0x1a30ca,null));};exports[_0x58e0('0x1c')]=function(_0x160dd9,_0x546e80){return db[_0x58e0('0x22')][_0x58e0('0x31')]({'where':{'id':_0x160dd9[_0x58e0('0x35')]['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x546e80,null))[_0x58e0('0x1b')](removeEntity(_0x546e80,null))[_0x58e0('0x32')](handleError(_0x546e80,null));};exports[_0x58e0('0x36')]=function(_0x58927b,_0x2a96ea){return db[_0x58e0('0x22')][_0x58e0('0x36')]()[_0x58e0('0x1b')](respondWithResult(_0x2a96ea,null))[_0x58e0('0x32')](handleError(_0x2a96ea,null));};exports[_0x58e0('0x37')]=function(_0x37bed1,_0x362895){return db[_0x58e0('0x38')][_0x58e0('0x31')]({'where':{'id':_0x37bed1[_0x58e0('0x35')]['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x362895,null))['then'](function(_0x139178){if(_0x139178){return _0x139178[_0x58e0('0x37')](_0x37bed1[_0x58e0('0x34')][_0x58e0('0x39')],_[_0x58e0('0x3a')](_0x37bed1['body'],[_0x58e0('0x39'),'id'])||{});}})[_0x58e0('0x1b')](respondWithResult(_0x362895,null))['catch'](handleError(_0x362895,null));};exports['getMessages']=function(_0x47a1a4,_0x272cec){var _0x113fd6={'raw':![],'where':{}};var _0x48836b={};var _0x359fc4={'count':0x0,'rows':[]};return db[_0x58e0('0x22')][_0x58e0('0x3b')]({'where':{'id':_0x47a1a4[_0x58e0('0x35')]['id']}})['then'](handleEntityNotFound(_0x272cec,null))[_0x58e0('0x1b')](function(_0x586b24){if(_0x586b24){_0x48836b['model']=_['keys'](db[_0x58e0('0x38')][_0x58e0('0x23')]);_0x48836b[_0x58e0('0x27')]=_[_0x58e0('0x2b')](_0x47a1a4[_0x58e0('0x27')]);_0x48836b[_0x58e0('0x3c')]=_[_0x58e0('0x2d')](_0x48836b[_0x58e0('0x2a')],_0x48836b[_0x58e0('0x27')]);_0x113fd6[_0x58e0('0x2c')]=_[_0x58e0('0x2d')](_0x48836b['model'],qs[_0x58e0('0x3d')](_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x3d')]));_0x113fd6['attributes']=_0x113fd6[_0x58e0('0x2c')][_0x58e0('0x3e')]?_0x113fd6[_0x58e0('0x2c')]:_0x48836b[_0x58e0('0x2a')];if(!_0x47a1a4['query'][_0x58e0('0x3f')](_0x58e0('0x40'))){_0x113fd6[_0x58e0('0x41')]=qs['limit'](_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x41')]);_0x113fd6[_0x58e0('0x16')]=qs[_0x58e0('0x16')](_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x16')]);}_0x113fd6[_0x58e0('0x42')]=qs[_0x58e0('0x43')](_0x47a1a4['query'][_0x58e0('0x43')]);_0x113fd6[_0x58e0('0x44')]=qs['filters'](_[_0x58e0('0x45')](_0x47a1a4[_0x58e0('0x27')],_0x48836b[_0x58e0('0x3c')]));_0x113fd6['where'][_0x58e0('0x46')]=_0x586b24['id'];if(_0x47a1a4[_0x58e0('0x27')]['filter']){_0x113fd6[_0x58e0('0x44')]=_[_0x58e0('0x2f')](_0x113fd6[_0x58e0('0x44')],{'$or':_['map'](_0x113fd6[_0x58e0('0x2c')],function(_0x33dc6c){var _0x3cdce5={};_0x3cdce5[_0x33dc6c]={'$like':'%'+_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x47')]+'%'};return _0x3cdce5;})});}if(_0x47a1a4['query'][_0x58e0('0x48')]){var _0x20e3b7=_0x47a1a4[_0x58e0('0x27')][_0x58e0('0x48')]['split'](',');var _0x7f754b={};_0x7f754b[_0x20e3b7[0x0]]={'$gte':moment(_0x20e3b7[0x1])[_0x58e0('0x49')](_0x58e0('0x4a'))};_0x113fd6['where']=_[_0x58e0('0x2f')](_0x113fd6[_0x58e0('0x44')],_0x7f754b);}_0x113fd6=_[_0x58e0('0x2f')]({},_0x113fd6,_0x47a1a4['options']);return db[_0x58e0('0x38')][_0x58e0('0x17')]({'where':_0x113fd6[_0x58e0('0x44')]})['then'](function(_0x26d816){_0x359fc4[_0x58e0('0x17')]=_0x26d816;if(_0x47a1a4['query']['includeAll']){_0x113fd6['include']=[{'all':!![]}];}return db[_0x58e0('0x38')][_0x58e0('0x4b')](_0x113fd6);})[_0x58e0('0x1b')](function(_0x1bd246){_0x359fc4[_0x58e0('0x4c')]=_0x1bd246;return _0x359fc4;});}})['then'](respondWithFilteredResult(_0x272cec,_0x113fd6))[_0x58e0('0x32')](handleError(_0x272cec,null));};exports[_0x58e0('0x4d')]=function(_0x43481e,_0x2dd136){return db[_0x58e0('0x22')][_0x58e0('0x31')]({'where':{'id':_0x43481e['params']['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x2dd136,null))[_0x58e0('0x1b')](function(_0x2064fd){if(_0x2064fd){return _0x2064fd[_0x58e0('0x4e')](_0x43481e['body'][_0x58e0('0x39')],_[_0x58e0('0x3a')](_0x43481e[_0x58e0('0x34')],[_0x58e0('0x39'),'id'])||{})[_0x58e0('0x4f')](function(){return db[_0x58e0('0x50')][_0x58e0('0x4b')]({'attributes':['id',_0x58e0('0x1e'),_0x58e0('0x51')],'where':{'id':_0x43481e[_0x58e0('0x34')][_0x58e0('0x39')]}});})[_0x58e0('0x1b')](function(_0x2a0602){socket[_0x58e0('0x52')]('faxInteractionTags:save',{'id':Number(_0x43481e['params']['id']),'tags':_0x2a0602||[]});return{'id':Number(_0x43481e[_0x58e0('0x35')]['id']),'tags':_0x2a0602||[]};});}})[_0x58e0('0x1b')](respondWithResult(_0x2dd136,null))['catch'](handleError(_0x2dd136,null));};exports[_0x58e0('0x53')]=function(_0x36ede2,_0x552992){return db['FaxInteraction'][_0x58e0('0x31')]({'where':{'id':_0x36ede2[_0x58e0('0x35')]['id']}})[_0x58e0('0x1b')](handleEntityNotFound(_0x552992,null))[_0x58e0('0x1b')](function(_0x5142c9){if(_0x5142c9){return _0x5142c9[_0x58e0('0x53')](_0x36ede2[_0x58e0('0x27')][_0x58e0('0x39')]);}})[_0x58e0('0x1b')](respondWithStatusCode(_0x552992,null))['catch'](handleError(_0x552992,null));};exports[_0x58e0('0x54')]=function(_0x819408,_0x39a9e9){var _0x3475fd=moment()['unix']()['toString']();var _0x1995b2=path['join'](config[_0x58e0('0x55')],_0x58e0('0x56'),_0x58e0('0x57'),_0x58e0('0x58'));var _0x1ef4b9=path['join'](config[_0x58e0('0x55')],_0x58e0('0x56'),_0x58e0('0x57'),_0x58e0('0x59'));var _0x419cf3=path['join'](_0x1995b2,_0x3475fd);var _0x7897d9=util[_0x58e0('0x49')](_0x58e0('0x5a'),_0x819408[_0x58e0('0x35')]['id'],_0x3475fd);var _0x42f8c3=path[_0x58e0('0x5b')](_0x1995b2,_0x7897d9);var _0x5301b7=[];_0x5301b7[_0x58e0('0x5c')]({'model':db[_0x58e0('0x5d')],'as':_0x58e0('0x5d'),'raw':!![]});var _0x23d9d1=[{'model':db[_0x58e0('0x38')],'as':_0x58e0('0x5e'),'attributes':['id',_0x58e0('0x34'),_0x58e0('0x5f')],'include':_0x5301b7}];return db['FaxInteraction']['find']({'where':{'id':_0x819408['params']['id']},'include':_0x23d9d1})[_0x58e0('0x1b')](handleEntityNotFound(_0x39a9e9,null))[_0x58e0('0x1b')](function(_0x32135a){if(_0x32135a&&_0x32135a[_0x58e0('0x5e')]){var _0x2af288=_0x32135a[_0x58e0('0x60')]({'plain':!![]});fs[_0x58e0('0x61')](_0x419cf3);for(var _0x195d24=0x0;_0x195d24<_0x2af288[_0x58e0('0x5e')][_0x58e0('0x3e')];_0x195d24++){var _0x789bd=_0x2af288[_0x58e0('0x5e')][_0x195d24][_0x58e0('0x5d')];if(_0x789bd){var _0x34e414=path[_0x58e0('0x5b')](_0x1ef4b9,_0x789bd[_0x58e0('0x62')]);if(fs['existsSync'](_0x34e414)){fs[_0x58e0('0x63')](_0x34e414)['pipe'](fs[_0x58e0('0x64')](path[_0x58e0('0x5b')](_0x419cf3,_0x789bd['basename'])));}}}return BPromise[_0x58e0('0x65')]()['then'](function(){return new BPromise(function(_0x532b85,_0x1d71ef){zipdir(_0x419cf3,{'saveTo':_0x42f8c3},function(_0x156201,_0x2558df){if(_0x156201)return _0x1d71ef(_0x156201);return _0x532b85(_0x2558df);});})[_0x58e0('0x1b')](function(){return new BPromise(function(_0x233aef,_0x55242b){rimraf(_0x419cf3,function(_0x15b48a){if(_0x15b48a)_0x55242b(_0x15b48a);return _0x233aef();});});})['then'](function(){return _0x39a9e9[_0x58e0('0x54')](_0x42f8c3,_0x7897d9,function(_0x463911){if(_0x463911){console[_0x58e0('0x66')]('err',_0x463911);}else{fs['unlinkSync'](_0x42f8c3);}});});});}else{return _0x39a9e9['sendStatus'](0xc8);}})['catch'](handleError(_0x39a9e9,null));}; \ No newline at end of file +var _0xf62e=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','Tag','color','emit','removeTags','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','pipe','download','log','err','unlinkSync','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','update','destroy','then','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','sort','where','pick','filter'];(function(_0xd74f2a,_0x1595c1){var _0x4291da=function(_0x370ca0){while(--_0x370ca0){_0xd74f2a['push'](_0xd74f2a['shift']());}};_0x4291da(++_0x1595c1);}(_0xf62e,0x1b3));var _0xef62=function(_0x5018a9,_0x2bc528){_0x5018a9=_0x5018a9-0x0;var _0x278067=_0xf62e[_0x5018a9];return _0x278067;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xef62('0x0'));var moment=require('moment');var BPromise=require(_0xef62('0x1'));var util=require(_0xef62('0x2'));var path=require(_0xef62('0x3'));var fs=require('fs');var _=require(_0xef62('0x4'));var Redis=require(_0xef62('0x5'));var interaction=require(_0xef62('0x6'));var qs=require(_0xef62('0x7'));var logger=require('../../config/logger')('api');var config=require(_0xef62('0x8'));var db=require('../../mysqldb')['db'];config[_0xef62('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xef62('0xa'))(new Redis(config['redis']));require(_0xef62('0xb'))[_0xef62('0xc')](socket);function respondWithStatusCode(_0x2a1818,_0x2ae8d9){_0x2ae8d9=_0x2ae8d9||0xcc;return function(_0x512753){if(_0x512753){return _0x2a1818[_0xef62('0xd')](_0x2ae8d9);}return _0x2a1818['status'](_0x2ae8d9)[_0xef62('0xe')]();};}function respondWithResult(_0x30ce71,_0x3a4854){_0x3a4854=_0x3a4854||0xc8;return function(_0x4d6866){if(_0x4d6866){return _0x30ce71[_0xef62('0xf')](_0x3a4854)['json'](_0x4d6866);}};}function respondWithFilteredResult(_0x1cd15f,_0x2ee7c1){return function(_0x2a1896){if(_0x2a1896){var _0x4bca98=typeof _0x2ee7c1['offset']===_0xef62('0x10')&&typeof _0x2ee7c1[_0xef62('0x11')]===_0xef62('0x10');var _0x38a38d=_0x2a1896['count'];var _0x37f30f=_0x4bca98?0x0:_0x2ee7c1[_0xef62('0x12')];var _0x318013=_0x4bca98?_0x2a1896[_0xef62('0x13')]:_0x2ee7c1[_0xef62('0x12')]+_0x2ee7c1[_0xef62('0x11')];var _0x237415;if(_0x318013>=_0x38a38d){_0x318013=_0x38a38d;_0x237415=0xc8;}else{_0x237415=0xce;}_0x1cd15f[_0xef62('0xf')](_0x237415);return _0x1cd15f[_0xef62('0x14')](_0xef62('0x15'),_0x37f30f+'-'+_0x318013+'/'+_0x38a38d)[_0xef62('0x16')](_0x2a1896);}return null;};}function saveUpdates(_0x4a516c){return function(_0x19966a){if(_0x19966a){return _0x19966a[_0xef62('0x17')](_0x4a516c)['then'](function(_0x4e4c6f){return _0x4e4c6f;});}return null;};}function removeEntity(_0x21b101){return function(_0xc01da6){if(_0xc01da6){return _0xc01da6[_0xef62('0x18')]()[_0xef62('0x19')](function(){_0x21b101[_0xef62('0xf')](0xcc)[_0xef62('0xe')]();});}};}function handleEntityNotFound(_0x576b30){return function(_0x487639){if(!_0x487639){_0x576b30[_0xef62('0xd')](0x194);}return _0x487639;};}function handleError(_0x4ddafc,_0x57d24b){_0x57d24b=_0x57d24b||0x1f4;return function(_0x55df6e){logger[_0xef62('0x1a')](_0x55df6e[_0xef62('0x1b')]);if(_0x55df6e[_0xef62('0x1c')]){delete _0x55df6e[_0xef62('0x1c')];}_0x4ddafc[_0xef62('0xf')](_0x57d24b)['send'](_0x55df6e);};}exports[_0xef62('0x1d')]=function(_0x25a593,_0x2584be){var _0x20438e={};var _0x16c3ac=_[_0xef62('0x1e')](db[_0xef62('0x1f')][_0xef62('0x20')],function(_0x9320b3){return{'name':_0x9320b3[_0xef62('0x21')],'type':_0x9320b3[_0xef62('0x22')][_0xef62('0x23')]};});_0x20438e=qs[_0xef62('0x24')](_0x16c3ac,_0x25a593);return interaction[_0xef62('0x25')](_0xef62('0x26'),_0x25a593[_0xef62('0x27')],_0x25a593[_0xef62('0x28')],_0x20438e,_0x16c3ac)['then'](respondWithFilteredResult(_0x2584be,_0x20438e))[_0xef62('0x29')](handleError(_0x2584be,null));};exports[_0xef62('0x2a')]=function(_0x13f122,_0x553b58){var _0x1faa8d={'raw':![],'where':{'id':_0x13f122[_0xef62('0x2b')]['id']}},_0x241bb6={};_0x241bb6[_0xef62('0x2c')]=_[_0xef62('0x2d')](db[_0xef62('0x1f')]['rawAttributes']);_0x241bb6[_0xef62('0x27')]=_[_0xef62('0x2d')](_0x13f122[_0xef62('0x27')]);_0x241bb6[_0xef62('0x2e')]=_[_0xef62('0x2f')](_0x241bb6[_0xef62('0x2c')],_0x241bb6[_0xef62('0x27')]);_0x1faa8d[_0xef62('0x30')]=_[_0xef62('0x2f')](_0x241bb6['model'],qs[_0xef62('0x31')](_0x13f122['query'][_0xef62('0x31')]));_0x1faa8d[_0xef62('0x30')]=_0x1faa8d[_0xef62('0x30')][_0xef62('0x32')]?_0x1faa8d[_0xef62('0x30')]:_0x241bb6[_0xef62('0x2c')];if(_0x13f122[_0xef62('0x27')][_0xef62('0x33')]){_0x1faa8d[_0xef62('0x34')]=[{'all':!![]}];}_0x1faa8d=_[_0xef62('0x35')]({},_0x1faa8d,_0x13f122[_0xef62('0x36')]);return db['FaxInteraction']['find'](_0x1faa8d)[_0xef62('0x19')](handleEntityNotFound(_0x553b58,null))[_0xef62('0x19')](respondWithResult(_0x553b58,null))[_0xef62('0x29')](handleError(_0x553b58,null));};exports[_0xef62('0x37')]=function(_0x29ad38,_0x2994a4){return db[_0xef62('0x1f')][_0xef62('0x37')](_0x29ad38[_0xef62('0x38')],{})[_0xef62('0x19')](respondWithResult(_0x2994a4,0xc9))[_0xef62('0x29')](handleError(_0x2994a4,null));};exports[_0xef62('0x17')]=function(_0xc68243,_0x5caed9){if(_0xc68243[_0xef62('0x38')]['id']){delete _0xc68243[_0xef62('0x38')]['id'];}return db['FaxInteraction'][_0xef62('0x39')]({'where':{'id':_0xc68243[_0xef62('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5caed9,null))[_0xef62('0x19')](saveUpdates(_0xc68243['body'],null))[_0xef62('0x19')](respondWithResult(_0x5caed9,null))[_0xef62('0x29')](handleError(_0x5caed9,null));};exports[_0xef62('0x18')]=function(_0x4cd93a,_0x15baa5){return db[_0xef62('0x1f')][_0xef62('0x39')]({'where':{'id':_0x4cd93a[_0xef62('0x2b')]['id']}})[_0xef62('0x19')](handleEntityNotFound(_0x15baa5,null))[_0xef62('0x19')](removeEntity(_0x15baa5,null))[_0xef62('0x29')](handleError(_0x15baa5,null));};exports[_0xef62('0x3a')]=function(_0x3130d1,_0x5d0093){return db['FaxInteraction'][_0xef62('0x3a')]()[_0xef62('0x19')](respondWithResult(_0x5d0093,null))[_0xef62('0x29')](handleError(_0x5d0093,null));};exports[_0xef62('0x3b')]=function(_0x573b80,_0x40f52){return db[_0xef62('0x3c')][_0xef62('0x39')]({'where':{'id':_0x573b80[_0xef62('0x2b')]['id']}})[_0xef62('0x19')](handleEntityNotFound(_0x40f52,null))[_0xef62('0x19')](function(_0x4fd524){if(_0x4fd524){return _0x4fd524[_0xef62('0x3b')](_0x573b80['body'][_0xef62('0x3d')],_[_0xef62('0x3e')](_0x573b80[_0xef62('0x38')],[_0xef62('0x3d'),'id'])||{});}})[_0xef62('0x19')](respondWithResult(_0x40f52,null))['catch'](handleError(_0x40f52,null));};exports[_0xef62('0x3f')]=function(_0x35849a,_0x186786){var _0x39a983={'raw':![],'where':{}};var _0x13c49f={};var _0x39f01a={'count':0x0,'rows':[]};return db[_0xef62('0x1f')][_0xef62('0x40')]({'where':{'id':_0x35849a[_0xef62('0x2b')]['id']}})[_0xef62('0x19')](handleEntityNotFound(_0x186786,null))[_0xef62('0x19')](function(_0x23bf6f){if(_0x23bf6f){_0x13c49f['model']=_['keys'](db['FaxMessage'][_0xef62('0x20')]);_0x13c49f[_0xef62('0x27')]=_['keys'](_0x35849a[_0xef62('0x27')]);_0x13c49f[_0xef62('0x2e')]=_[_0xef62('0x2f')](_0x13c49f[_0xef62('0x2c')],_0x13c49f[_0xef62('0x27')]);_0x39a983[_0xef62('0x30')]=_[_0xef62('0x2f')](_0x13c49f['model'],qs['fields'](_0x35849a['query']['fields']));_0x39a983[_0xef62('0x30')]=_0x39a983[_0xef62('0x30')]['length']?_0x39a983['attributes']:_0x13c49f[_0xef62('0x2c')];if(!_0x35849a[_0xef62('0x27')][_0xef62('0x41')]('nolimit')){_0x39a983[_0xef62('0x11')]=qs[_0xef62('0x11')](_0x35849a['query']['limit']);_0x39a983[_0xef62('0x12')]=qs[_0xef62('0x12')](_0x35849a[_0xef62('0x27')][_0xef62('0x12')]);}_0x39a983['order']=qs[_0xef62('0x42')](_0x35849a[_0xef62('0x27')][_0xef62('0x42')]);_0x39a983[_0xef62('0x43')]=qs[_0xef62('0x2e')](_[_0xef62('0x44')](_0x35849a[_0xef62('0x27')],_0x13c49f[_0xef62('0x2e')]));_0x39a983['where']['FaxInteractionId']=_0x23bf6f['id'];if(_0x35849a[_0xef62('0x27')][_0xef62('0x45')]){_0x39a983[_0xef62('0x43')]=_[_0xef62('0x35')](_0x39a983[_0xef62('0x43')],{'$or':_['map'](_0x39a983[_0xef62('0x30')],function(_0x1e53b2){var _0x9fac0b={};_0x9fac0b[_0x1e53b2]={'$like':'%'+_0x35849a[_0xef62('0x27')]['filter']+'%'};return _0x9fac0b;})});}if(_0x35849a[_0xef62('0x27')][_0xef62('0x46')]){var _0x5b1856=_0x35849a[_0xef62('0x27')][_0xef62('0x46')][_0xef62('0x47')](',');var _0x7bf91f={};_0x7bf91f[_0x5b1856[0x0]]={'$gte':moment(_0x5b1856[0x1])[_0xef62('0x48')](_0xef62('0x49'))};_0x39a983[_0xef62('0x43')]=_[_0xef62('0x35')](_0x39a983[_0xef62('0x43')],_0x7bf91f);}_0x39a983=_[_0xef62('0x35')]({},_0x39a983,_0x35849a[_0xef62('0x36')]);return db[_0xef62('0x3c')]['count']({'where':_0x39a983[_0xef62('0x43')]})['then'](function(_0x25875c){_0x39f01a[_0xef62('0x13')]=_0x25875c;if(_0x35849a[_0xef62('0x27')][_0xef62('0x33')]){_0x39a983[_0xef62('0x34')]=[{'all':!![]}];}return db[_0xef62('0x3c')][_0xef62('0x25')](_0x39a983);})[_0xef62('0x19')](function(_0x473f58){_0x39f01a[_0xef62('0x4a')]=_0x473f58;return _0x39f01a;});}})['then'](respondWithFilteredResult(_0x186786,_0x39a983))['catch'](handleError(_0x186786,null));};exports['addTags']=function(_0x36f165,_0x12cf9e){return db[_0xef62('0x1f')][_0xef62('0x39')]({'where':{'id':_0x36f165[_0xef62('0x2b')]['id']}})[_0xef62('0x19')](handleEntityNotFound(_0x12cf9e,null))[_0xef62('0x19')](function(_0x5f0c09){if(_0x5f0c09){return _0x5f0c09[_0xef62('0x4b')](_0x36f165['body'][_0xef62('0x3d')],_['omit'](_0x36f165[_0xef62('0x38')],[_0xef62('0x3d'),'id'])||{})['spread'](function(){return db[_0xef62('0x4c')][_0xef62('0x25')]({'attributes':['id','name',_0xef62('0x4d')],'where':{'id':_0x36f165[_0xef62('0x38')][_0xef62('0x3d')]}});})['then'](function(_0x42c5af){socket[_0xef62('0x4e')]('faxInteractionTags:save',{'id':Number(_0x36f165[_0xef62('0x2b')]['id']),'tags':_0x42c5af||[]});return{'id':Number(_0x36f165[_0xef62('0x2b')]['id']),'tags':_0x42c5af||[]};});}})[_0xef62('0x19')](respondWithResult(_0x12cf9e,null))[_0xef62('0x29')](handleError(_0x12cf9e,null));};exports[_0xef62('0x4f')]=function(_0xf2fe34,_0x5c2b12){return db['FaxInteraction']['find']({'where':{'id':_0xf2fe34[_0xef62('0x2b')]['id']}})[_0xef62('0x19')](handleEntityNotFound(_0x5c2b12,null))[_0xef62('0x19')](function(_0x481bff){if(_0x481bff){return _0x481bff['removeTags'](_0xf2fe34[_0xef62('0x27')][_0xef62('0x3d')]);}})['then'](respondWithStatusCode(_0x5c2b12,null))[_0xef62('0x29')](handleError(_0x5c2b12,null));};exports['download']=function(_0x5b7fb1,_0x456623){var _0x26c811=moment()[_0xef62('0x50')]()['toString']();var _0xb499bf=path['join'](config['root'],_0xef62('0x51'),_0xef62('0x52'),_0xef62('0x53'));var _0x4bcf59=path[_0xef62('0x54')](config[_0xef62('0x55')],_0xef62('0x51'),'files',_0xef62('0x56'));var _0x15dfeb=path[_0xef62('0x54')](_0xb499bf,_0x26c811);var _0x2dfadc=util['format'](_0xef62('0x57'),_0x5b7fb1[_0xef62('0x2b')]['id'],_0x26c811);var _0x1d18c7=path[_0xef62('0x54')](_0xb499bf,_0x2dfadc);var _0x4cab34=[];_0x4cab34[_0xef62('0x58')]({'model':db['Attachment'],'as':_0xef62('0x59'),'raw':!![]});var _0x2e13ee=[{'model':db[_0xef62('0x3c')],'as':_0xef62('0x5a'),'attributes':['id',_0xef62('0x38'),_0xef62('0x5b')],'include':_0x4cab34}];return db[_0xef62('0x1f')][_0xef62('0x39')]({'where':{'id':_0x5b7fb1[_0xef62('0x2b')]['id']},'include':_0x2e13ee})[_0xef62('0x19')](handleEntityNotFound(_0x456623,null))[_0xef62('0x19')](function(_0x4d2e2a){if(_0x4d2e2a&&_0x4d2e2a['Messages']){var _0x2b9d8d=_0x4d2e2a[_0xef62('0x5c')]({'plain':!![]});fs[_0xef62('0x5d')](_0x15dfeb);for(var _0x322434=0x0;_0x322434<_0x2b9d8d[_0xef62('0x5a')][_0xef62('0x32')];_0x322434++){var _0x4ab96f=_0x2b9d8d['Messages'][_0x322434][_0xef62('0x59')];if(_0x4ab96f){var _0x219eba=path[_0xef62('0x54')](_0x4bcf59,_0x4ab96f['basename']);if(fs[_0xef62('0x5e')](_0x219eba)){fs[_0xef62('0x5f')](_0x219eba)[_0xef62('0x60')](fs['createWriteStream'](path[_0xef62('0x54')](_0x15dfeb,_0x4ab96f['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x2e02df,_0x2b2301){zipdir(_0x15dfeb,{'saveTo':_0x1d18c7},function(_0x186166,_0x5b86a1){if(_0x186166)return _0x2b2301(_0x186166);return _0x2e02df(_0x5b86a1);});})['then'](function(){return new BPromise(function(_0x4212dd,_0x294176){rimraf(_0x15dfeb,function(_0x569d3c){if(_0x569d3c)_0x294176(_0x569d3c);return _0x4212dd();});});})['then'](function(){return _0x456623[_0xef62('0x61')](_0x1d18c7,_0x2dfadc,function(_0x3cd9ec){if(_0x3cd9ec){console[_0xef62('0x62')](_0xef62('0x63'),_0x3cd9ec);}else{fs[_0xef62('0x64')](_0x1d18c7);}});});});}else{return _0x456623[_0xef62('0xd')](0xc8);}})['catch'](handleError(_0x456623,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3046994..f335693 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 _0xa9da=['../../mysqldb','FaxInteraction','setMaxListeners','update','getUsers','then','setDataValue','map','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0xa9da,0x1cd));var _0xaa9d=function(_0x101d19,_0xc0e538){_0x101d19=_0x101d19-0x0;var _0x24c472=_0xa9da[_0x101d19];return _0x24c472;};'use strict';var EventEmitter=require(_0xaa9d('0x0'));var FaxInteraction=require(_0xaa9d('0x1'))['db'][_0xaa9d('0x2')];var FaxMessage=require(_0xaa9d('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xaa9d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa9d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3757cd){return function(_0x398955,_0x29cca2,_0x5d658d){_0x398955[_0xaa9d('0x5')]({'attributes':['id'],'raw':!![]})[_0xaa9d('0x6')](function(_0x488618){_0x398955[_0xaa9d('0x7')]('Users',_0x488618[_0xaa9d('0x8')](function(_0x5102d6){return{'id':_0x5102d6['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x398955['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa9d('0x6')](function(_0x58455c){_0x398955[_0xaa9d('0x7')]('unreadMessages',_0x58455c[_0xaa9d('0x9')]);FaxInteractionEvents[_0xaa9d('0xa')](_0x3757cd+':'+_0x398955['id'],_0x398955);FaxInteractionEvents[_0xaa9d('0xa')](_0x3757cd,_0x398955);_0x5d658d(null);})[_0xaa9d('0xb')](_0x5d658d(null));};}for(var e in events){if(events[_0xaa9d('0xc')](e)){var event=events[e];FaxInteraction[_0xaa9d('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x14fb=['hasOwnProperty','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','length','emit','catch'];(function(_0x3cbbf0,_0x1b630f){var _0x557d5d=function(_0x4f17fb){while(--_0x4f17fb){_0x3cbbf0['push'](_0x3cbbf0['shift']());}};_0x557d5d(++_0x1b630f);}(_0x14fb,0x151));var _0xb14f=function(_0x34b5fd,_0x2d6b7b){_0x34b5fd=_0x34b5fd-0x0;var _0x302e6f=_0x14fb[_0x34b5fd];return _0x302e6f;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xb14f('0x0'))['db'][_0xb14f('0x1')];var FaxMessage=require(_0xb14f('0x0'))['db'][_0xb14f('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb14f('0x3')](0x0);var events={'afterCreate':_0xb14f('0x4'),'afterUpdate':'update','afterDestroy':_0xb14f('0x5')};function emitEvent(_0x733327){return function(_0x274d48,_0x18e9dd,_0x377e9b){_0x274d48['getUsers']({'attributes':['id'],'raw':!![]})[_0xb14f('0x6')](function(_0x4e8a84){_0x274d48[_0xb14f('0x7')](_0xb14f('0x8'),_0x4e8a84[_0xb14f('0x9')](function(_0x49995e){return{'id':_0x49995e['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x274d48['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb14f('0x6')](function(_0x183725){_0x274d48[_0xb14f('0x7')]('unreadMessages',_0x183725[_0xb14f('0xa')]);FaxInteractionEvents[_0xb14f('0xb')](_0x733327+':'+_0x274d48['id'],_0x274d48);FaxInteractionEvents['emit'](_0x733327,_0x274d48);_0x377e9b(null);})[_0xb14f('0xc')](_0x377e9b(null));};}for(var e in events){if(events[_0xb14f('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7aeaadf..56559d2 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 _0xc125=['define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x1f8eb8,_0x569d29){var _0x415ba5=function(_0x875e22){while(--_0x875e22){_0x1f8eb8['push'](_0x1f8eb8['shift']());}};_0x415ba5(++_0x569d29);}(_0xc125,0x139));var _0x5c12=function(_0x2e876e,_0x4f6a89){_0x2e876e=_0x2e876e-0x0;var _0x48b463=_0xc125[_0x2e876e];return _0x48b463;};'use strict';var _=require(_0x5c12('0x0'));var util=require('util');var logger=require(_0x5c12('0x1'))(_0x5c12('0x2'));var moment=require(_0x5c12('0x3'));var BPromise=require(_0x5c12('0x4'));var rp=require(_0x5c12('0x5'));var fs=require('fs');var path=require(_0x5c12('0x6'));var rimraf=require(_0x5c12('0x7'));var config=require(_0x5c12('0x8'));var attributes=require(_0x5c12('0x9'));module[_0x5c12('0xa')]=function(_0x284967,_0x32be5b){return _0x284967[_0x5c12('0xb')](_0x5c12('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xaeeab,_0x23b414,_0x5b20a7){if(_0xaeeab[_0x5c12('0xd')](_0x5c12('0xe'))){_0xaeeab[_0x5c12('0xf')]=moment()[_0x5c12('0x10')](_0x5c12('0x11'));}_0x5b20a7(null,_0xaeeab);}}});}; \ No newline at end of file +var _0xe451=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closedAt','format','util','../../config/logger'];(function(_0x3ebc12,_0x452ceb){var _0x4c5649=function(_0x32a1e3){while(--_0x32a1e3){_0x3ebc12['push'](_0x3ebc12['shift']());}};_0x4c5649(++_0x452ceb);}(_0xe451,0x94));var _0x1e45=function(_0x3287d8,_0x153112){_0x3287d8=_0x3287d8-0x0;var _0x492056=_0xe451[_0x3287d8];return _0x492056;};'use strict';var _=require('lodash');var util=require(_0x1e45('0x0'));var logger=require(_0x1e45('0x1'))(_0x1e45('0x2'));var moment=require(_0x1e45('0x3'));var BPromise=require(_0x1e45('0x4'));var rp=require(_0x1e45('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e45('0x6'));var config=require(_0x1e45('0x7'));var attributes=require(_0x1e45('0x8'));module['exports']=function(_0xde07fd,_0x19b2b8){return _0xde07fd[_0x1e45('0x9')](_0x1e45('0xa'),attributes,{'tableName':_0x1e45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x588dbc,_0x554fa1,_0x3e735f){if(_0x588dbc[_0x1e45('0xc')]('closed')){_0x588dbc[_0x1e45('0xd')]=moment()[_0x1e45('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3e735f(null,_0x588dbc);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d98058d..2947e78 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 _0x7b7d=['http','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','FaxInteraction,\x20%s,\x20%s','info','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7b7d,0x10e));var _0xd7b7=function(_0x3a0674,_0x1c81fe){_0x3a0674=_0x3a0674-0x0;var _0x3437d7=_0x7b7d[_0x3a0674];return _0x3437d7;};'use strict';var _=require(_0xd7b7('0x0'));var util=require(_0xd7b7('0x1'));var moment=require(_0xd7b7('0x2'));var BPromise=require(_0xd7b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7b7('0x4'));var db=require(_0xd7b7('0x5'))['db'];var utils=require(_0xd7b7('0x6'));var logger=require('../../config/logger')(_0xd7b7('0x7'));var config=require('../../config/environment');var jayson=require(_0xd7b7('0x8'));var client=jayson[_0xd7b7('0x9')][_0xd7b7('0xa')]({'port':0x232a});config['redis']=_[_0xd7b7('0xb')](config[_0xd7b7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7b7('0xd'))(new Redis(config[_0xd7b7('0xc')]));require(_0xd7b7('0xe'))[_0xd7b7('0xf')](socket);function respondWithRpcPromise(_0x3582f6,_0x5f1566,_0x27ec44){return new BPromise(function(_0x4da846,_0x5c234c){return client['request'](_0x3582f6,_0x27ec44)[_0xd7b7('0x10')](function(_0x54ea0a){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5f1566,_0xd7b7('0x11'));logger[_0xd7b7('0x12')](_0xd7b7('0x13'),_0x5f1566,_0xd7b7('0x11'),JSON['stringify'](_0x54ea0a));if(_0x54ea0a[_0xd7b7('0x14')]){if(_0x54ea0a[_0xd7b7('0x14')][_0xd7b7('0x15')]===0x1f4){logger[_0xd7b7('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x5f1566,_0x54ea0a[_0xd7b7('0x14')][_0xd7b7('0x16')]);return _0x5c234c(_0x54ea0a[_0xd7b7('0x14')][_0xd7b7('0x16')]);}logger[_0xd7b7('0x14')](_0xd7b7('0x17'),_0x5f1566,_0x54ea0a['error'][_0xd7b7('0x16')]);return _0x4da846(_0x54ea0a[_0xd7b7('0x14')][_0xd7b7('0x16')]);}else{logger[_0xd7b7('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x5f1566,'request\x20sent');_0x4da846(_0x54ea0a['result'][_0xd7b7('0x16')]);}})[_0xd7b7('0x19')](function(_0x3b52a9){logger[_0xd7b7('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x5f1566,_0x3b52a9);_0x5c234c(_0x3b52a9);});});}exports[_0xd7b7('0x1a')]=function(_0x37b78a){var _0x2edb13=this;return new Promise(function(_0x54781d,_0x35efee){return db['FaxInteraction'][_0xd7b7('0x1b')](_0x37b78a[_0xd7b7('0x1c')],{'raw':_0x37b78a[_0xd7b7('0x1d')]?_0x37b78a[_0xd7b7('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37b78a['options']?_0x37b78a[_0xd7b7('0x1d')][_0xd7b7('0x1e')]||null:null,'attributes':_0x37b78a[_0xd7b7('0x1d')]?_0x37b78a[_0xd7b7('0x1d')][_0xd7b7('0x1f')]||null:null,'limit':_0x37b78a['options']?_0x37b78a[_0xd7b7('0x1d')][_0xd7b7('0x20')]||null:null})[_0xd7b7('0x10')](function(_0x59025a){logger[_0xd7b7('0x18')](_0xd7b7('0x1a'),_0x37b78a);logger['debug']('UpdateFaxInteraction',_0x37b78a,JSON['stringify'](_0x59025a));_0x54781d(_0x59025a);})['catch'](function(_0x36995e){logger['error'](_0xd7b7('0x1a'),_0x36995e[_0xd7b7('0x16')],_0x37b78a);_0x35efee(_0x2edb13['error'](0x1f4,_0x36995e[_0xd7b7('0x16')]));});});};exports[_0xd7b7('0x21')]=function(_0x26d792){return new Promise(function(_0x3ca453,_0x53bd96){return db[_0xd7b7('0x22')][_0xd7b7('0x23')]({'where':_0x26d792['options']?_0x26d792[_0xd7b7('0x1d')][_0xd7b7('0x1e')]||null:null})[_0xd7b7('0x10')](function(_0x30e08c){if(_0x30e08c){return _0x30e08c[_0xd7b7('0x24')](_0x26d792['body'][_0xd7b7('0x25')],_['omit'](_0x26d792[_0xd7b7('0x1c')],['ids','id'])||{});}})[_0xd7b7('0x26')](function(_0x2ecdb0){logger[_0xd7b7('0x18')](_0xd7b7('0x27'),_0x26d792);logger[_0xd7b7('0x12')](_0xd7b7('0x27'),_0x26d792,JSON['stringify'](_0x2ecdb0));_0x3ca453(_0x2ecdb0);})[_0xd7b7('0x19')](function(_0x3bd4d3){logger[_0xd7b7('0x14')]('AddTags',_0x3bd4d3[_0xd7b7('0x16')],_0x26d792);_0x53bd96(_this[_0xd7b7('0x14')](0x1f4,_0x3bd4d3['message']));});});}; \ No newline at end of file +var _0x0074=['util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','attributes','then','debug','AddTagsToFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x55eb3f,_0x17bff0){var _0x4ad44d=function(_0x3eb5d4){while(--_0x3eb5d4){_0x55eb3f['push'](_0x55eb3f['shift']());}};_0x4ad44d(++_0x17bff0);}(_0x0074,0x137));var _0x4007=function(_0xc99f37,_0x32c2a7){_0xc99f37=_0xc99f37-0x0;var _0x1a4999=_0x0074[_0xc99f37];return _0x1a4999;};'use strict';var _=require(_0x4007('0x0'));var util=require(_0x4007('0x1'));var moment=require(_0x4007('0x2'));var BPromise=require(_0x4007('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4007('0x4'))['db'];var utils=require(_0x4007('0x5'));var logger=require('../../config/logger')(_0x4007('0x6'));var config=require('../../config/environment');var jayson=require(_0x4007('0x7'));var client=jayson[_0x4007('0x8')][_0x4007('0x9')]({'port':0x232a});config[_0x4007('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4007('0xb'))(new Redis(config[_0x4007('0xa')]));require(_0x4007('0xc'))[_0x4007('0xd')](socket);function respondWithRpcPromise(_0x23d41d,_0x1ae6ee,_0x103c06){return new BPromise(function(_0x5bd88b,_0x47d963){return client[_0x4007('0xe')](_0x23d41d,_0x103c06)['then'](function(_0x2f8a40){logger[_0x4007('0xf')](_0x4007('0x10'),_0x1ae6ee,_0x4007('0x11'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1ae6ee,_0x4007('0x11'),JSON[_0x4007('0x12')](_0x2f8a40));if(_0x2f8a40[_0x4007('0x13')]){if(_0x2f8a40['error'][_0x4007('0x14')]===0x1f4){logger[_0x4007('0x13')](_0x4007('0x10'),_0x1ae6ee,_0x2f8a40['error']['message']);return _0x47d963(_0x2f8a40[_0x4007('0x13')][_0x4007('0x15')]);}logger['error'](_0x4007('0x10'),_0x1ae6ee,_0x2f8a40[_0x4007('0x13')][_0x4007('0x15')]);return _0x5bd88b(_0x2f8a40['error'][_0x4007('0x15')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x1ae6ee,_0x4007('0x11'));_0x5bd88b(_0x2f8a40[_0x4007('0x16')]['message']);}})[_0x4007('0x17')](function(_0x31f322){logger[_0x4007('0x13')](_0x4007('0x10'),_0x1ae6ee,_0x31f322);_0x47d963(_0x31f322);});});}exports[_0x4007('0x18')]=function(_0x3db315){var _0x253a78=this;return new Promise(function(_0xc3b9ac,_0x49b2a6){return db[_0x4007('0x19')]['update'](_0x3db315[_0x4007('0x1a')],{'raw':_0x3db315[_0x4007('0x1b')]?_0x3db315[_0x4007('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3db315[_0x4007('0x1b')]?_0x3db315[_0x4007('0x1b')]['where']||null:null,'attributes':_0x3db315['options']?_0x3db315[_0x4007('0x1b')][_0x4007('0x1c')]||null:null,'limit':_0x3db315['options']?_0x3db315[_0x4007('0x1b')]['limit']||null:null})[_0x4007('0x1d')](function(_0x3336ad){logger[_0x4007('0xf')](_0x4007('0x18'),_0x3db315);logger[_0x4007('0x1e')](_0x4007('0x18'),_0x3db315,JSON[_0x4007('0x12')](_0x3336ad));_0xc3b9ac(_0x3336ad);})[_0x4007('0x17')](function(_0x2cbdc2){logger[_0x4007('0x13')]('UpdateFaxInteraction',_0x2cbdc2[_0x4007('0x15')],_0x3db315);_0x49b2a6(_0x253a78[_0x4007('0x13')](0x1f4,_0x2cbdc2[_0x4007('0x15')]));});});};exports[_0x4007('0x1f')]=function(_0x52990c){return new Promise(function(_0x283c9f,_0x4b6462){return db[_0x4007('0x19')][_0x4007('0x20')]({'where':_0x52990c[_0x4007('0x1b')]?_0x52990c['options'][_0x4007('0x21')]||null:null})[_0x4007('0x1d')](function(_0x61d464){if(_0x61d464){return _0x61d464[_0x4007('0x22')](_0x52990c['body'][_0x4007('0x23')],_[_0x4007('0x24')](_0x52990c[_0x4007('0x1a')],[_0x4007('0x23'),'id'])||{});}})[_0x4007('0x25')](function(_0x533f00){logger[_0x4007('0xf')](_0x4007('0x26'),_0x52990c);logger['debug']('AddTags',_0x52990c,JSON[_0x4007('0x12')](_0x533f00));_0x283c9f(_0x533f00);})[_0x4007('0x17')](function(_0x4b9091){logger[_0x4007('0x13')](_0x4007('0x26'),_0x4b9091[_0x4007('0x15')],_0x52990c);_0x4b6462(_this[_0x4007('0x13')](0x1f4,_0x4b9091[_0x4007('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 360b175..9098322 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 _0xe7d6=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x2aeba4,_0x47184c){var _0x3db727=function(_0x4b5056){while(--_0x4b5056){_0x2aeba4['push'](_0x2aeba4['shift']());}};_0x3db727(++_0x47184c);}(_0xe7d6,0x135));var _0x6e7d=function(_0xeab168,_0x30d561){_0xeab168=_0xeab168-0x0;var _0xbbf818=_0xe7d6[_0xeab168];return _0xbbf818;};'use strict';var FaxInteractionEvents=require(_0x6e7d('0x0'));var events=[_0x6e7d('0x1'),_0x6e7d('0x2'),_0x6e7d('0x3')];function createListener(_0x460cd0,_0x3c7aa7){return function(_0x2ce05c){_0x3c7aa7[_0x6e7d('0x4')](_0x460cd0,_0x2ce05c);};}function removeListener(_0x37493e,_0x2f9b6f){return function(){FaxInteractionEvents[_0x6e7d('0x5')](_0x37493e,_0x2f9b6f);};}exports[_0x6e7d('0x6')]=function(_0x53cdfa){for(var _0x5159be=0x0,_0x3b49a0=events[_0x6e7d('0x7')];_0x5159be<_0x3b49a0;_0x5159be++){var _0xcb273=events[_0x5159be];var _0xd49299=createListener(_0x6e7d('0x8')+_0xcb273,_0x53cdfa);FaxInteractionEvents['on'](_0xcb273,_0xd49299);}}; \ No newline at end of file +var _0xb3c6=['./faxInteraction.events','remove','removeListener'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xb3c6,0x90));var _0x6b3c=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0xb3c6[_0x10f6e8];return _0x35bb3c;};'use strict';var FaxInteractionEvents=require(_0x6b3c('0x0'));var events=['save',_0x6b3c('0x1'),'update'];function createListener(_0x5d439f,_0x539c76){return function(_0x155055){_0x539c76['emit'](_0x5d439f,_0x155055);};}function removeListener(_0x42843a,_0x230772){return function(){FaxInteractionEvents[_0x6b3c('0x2')](_0x42843a,_0x230772);};}exports['register']=function(_0x28984b){for(var _0x35ef13=0x0,_0x4f2241=events['length'];_0x35ef13<_0x4f2241;_0x35ef13++){var _0x3c25dc=events[_0x35ef13];var _0x459d88=createListener('faxInteraction:'+_0x3c25dc,_0x28984b);FaxInteractionEvents['on'](_0x3c25dc,_0x459d88);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index f85e091..94cfde9 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 _0x552e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','faxinteraction:destroy','delete','/:id/tags','removeTags','exports','multer','util','path'];(function(_0x3aa091,_0x34c349){var _0x43f9d8=function(_0x304cea){while(--_0x304cea){_0x3aa091['push'](_0x3aa091['shift']());}};_0x43f9d8(++_0x34c349);}(_0x552e,0x138));var _0xe552=function(_0x24c852,_0x4ffff0){_0x24c852=_0x24c852-0x0;var _0x144286=_0x552e[_0x24c852];return _0x144286;};'use strict';var multer=require(_0xe552('0x0'));var util=require(_0xe552('0x1'));var path=require(_0xe552('0x2'));var timeout=require(_0xe552('0x3'));var express=require(_0xe552('0x4'));var router=express[_0xe552('0x5')]();var fs_extra=require(_0xe552('0x6'));var auth=require(_0xe552('0x7'));var interaction=require(_0xe552('0x8'));var config=require(_0xe552('0x9'));var controller=require('./faxInteraction.controller');router[_0xe552('0xa')]('/',auth[_0xe552('0xb')](),controller[_0xe552('0xc')]);router[_0xe552('0xa')](_0xe552('0xd'),auth['isAuthenticated'](),controller[_0xe552('0xe')]);router['get'](_0xe552('0xf'),auth[_0xe552('0xb')](),controller[_0xe552('0x10')]);router[_0xe552('0xa')](_0xe552('0x11'),auth[_0xe552('0xb')](),controller[_0xe552('0x12')]);router[_0xe552('0xa')](_0xe552('0x13'),auth[_0xe552('0xb')](),controller[_0xe552('0x14')]);router[_0xe552('0x15')]('/',auth[_0xe552('0xb')](),controller[_0xe552('0x16')]);router[_0xe552('0x15')](_0xe552('0x11'),auth[_0xe552('0xb')](),controller[_0xe552('0x17')]);router['post']('/:id/tags',auth[_0xe552('0xb')](),interaction[_0xe552('0x18')](_0xe552('0x19'),_0xe552('0x1a')),controller[_0xe552('0x1b')]);router[_0xe552('0x1c')](_0xe552('0xf'),auth['isAuthenticated'](),interaction[_0xe552('0x18')](_0xe552('0x19'),'faxinteraction:update'),controller[_0xe552('0x1d')]);router['delete'](_0xe552('0xf'),auth[_0xe552('0xb')](),interaction[_0xe552('0x18')](_0xe552('0x19'),_0xe552('0x1e')),controller['destroy']);router[_0xe552('0x1f')](_0xe552('0x20'),auth[_0xe552('0xb')](),controller[_0xe552('0x21')]);module[_0xe552('0x22')]=router; \ No newline at end of file +var _0xd2e6=['/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','delete','faxinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd2e6,0x195));var _0x6d2e=function(_0x35a9aa,_0x4fa713){_0x35a9aa=_0x35a9aa-0x0;var _0x249f21=_0xd2e6[_0x35a9aa];return _0x249f21;};'use strict';var multer=require(_0x6d2e('0x0'));var util=require('util');var path=require(_0x6d2e('0x1'));var timeout=require(_0x6d2e('0x2'));var express=require('express');var router=express[_0x6d2e('0x3')]();var fs_extra=require(_0x6d2e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d2e('0x5'));var controller=require(_0x6d2e('0x6'));router[_0x6d2e('0x7')]('/',auth['isAuthenticated'](),controller[_0x6d2e('0x8')]);router['get'](_0x6d2e('0x9'),auth[_0x6d2e('0xa')](),controller[_0x6d2e('0xb')]);router[_0x6d2e('0x7')](_0x6d2e('0xc'),auth[_0x6d2e('0xa')](),controller['show']);router[_0x6d2e('0x7')](_0x6d2e('0xd'),auth[_0x6d2e('0xa')](),controller[_0x6d2e('0xe')]);router[_0x6d2e('0x7')](_0x6d2e('0xf'),auth[_0x6d2e('0xa')](),controller[_0x6d2e('0x10')]);router[_0x6d2e('0x11')]('/',auth[_0x6d2e('0xa')](),controller[_0x6d2e('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x6d2e('0x13')]);router['post'](_0x6d2e('0x14'),auth[_0x6d2e('0xa')](),interaction[_0x6d2e('0x15')](_0x6d2e('0x16'),_0x6d2e('0x17')),controller[_0x6d2e('0x18')]);router[_0x6d2e('0x19')]('/:id',auth[_0x6d2e('0xa')](),interaction[_0x6d2e('0x15')]('fax','faxinteraction:update'),controller['update']);router[_0x6d2e('0x1a')](_0x6d2e('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x6d2e('0x16'),_0x6d2e('0x1b')),controller[_0x6d2e('0x1c')]);router[_0x6d2e('0x1a')](_0x6d2e('0x14'),auth['isAuthenticated'](),controller[_0x6d2e('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3b3d1bf..b361536 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 _0x4d9e=['TEXT','sequelize','medium','ENUM','out'];(function(_0x37cba1,_0x14e01a){var _0xe06895=function(_0x5ae028){while(--_0x5ae028){_0x37cba1['push'](_0x37cba1['shift']());}};_0xe06895(++_0x14e01a);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x2fe90d,_0x4595aa){_0x2fe90d=_0x2fe90d-0x0;var _0x2ce879=_0x4d9e[_0x2fe90d];return _0x2ce879;};'use strict';var Sequelize=require(_0xe4d9('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xe4d9('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe4d9('0x2')]('in','out'),'defaultValue':_0xe4d9('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe4d9('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xe64a=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x1a6920,_0x1377f5){var _0x62940e=function(_0xaddb99){while(--_0xaddb99){_0x1a6920['push'](_0x1a6920['shift']());}};_0x62940e(++_0x1377f5);}(_0xe64a,0x1e0));var _0xae64=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe64a[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xae64('0x0'));module[_0xae64('0x1')]={'body':{'type':Sequelize[_0xae64('0x2')](_0xae64('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xae64('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xae64('0x5')]('in',_0xae64('0x6')),'defaultValue':_0xae64('0x6'),'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 91e9c2a..c26f229 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 _0xf418=['acceptMessage','fax','reject','body','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','rejectmessage','create','CmContact','findOne','isNil','Attachment','SendFax','format','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','fax-interactions','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','status','json','undefined','limit','count','offset','set','end','sendStatus','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','show','params','keys','fields','includeAll','update','find','describe','accept','sms'];(function(_0x2fa715,_0x249c05){var _0x91bbbe=function(_0x299934){while(--_0x299934){_0x2fa715['push'](_0x2fa715['shift']());}};_0x91bbbe(++_0x249c05);}(_0xf418,0x18e));var _0x8f41=function(_0x2745aa,_0x1e248e){_0x2745aa=_0x2745aa-0x0;var _0x3ed770=_0xf418[_0x2745aa];return _0x3ed770;};'use strict';var util=require('util');var path=require(_0x8f41('0x0'));var _=require('lodash');var Redis=require(_0x8f41('0x1'));var interactionService=require(_0x8f41('0x2'));var qs=require(_0x8f41('0x3'));var logger=require(_0x8f41('0x4'))(_0x8f41('0x5'));var config=require(_0x8f41('0x6'));var db=require('../../mysqldb')['db'];config[_0x8f41('0x7')]=_[_0x8f41('0x8')](config['redis'],{'host':_0x8f41('0x9'),'port':0x18eb});var socket=require(_0x8f41('0xa'))(new Redis(config[_0x8f41('0x7')]));require(_0x8f41('0xb'))[_0x8f41('0xc')](socket);var jayson=require(_0x8f41('0xd'));var client=jayson['client'][_0x8f41('0xe')]({'port':0x232c});var client9002=jayson[_0x8f41('0xf')][_0x8f41('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x8f41('0x10'));function respondWithRpcPromise(_0x27db92,_0x10093f,_0x458eb6,_0x2f66e4){return new Promise(function(_0x5dccc7,_0x38666c){var _0x101e00=_0x2f66e4||client;return _0x101e00[_0x8f41('0x11')](_0x27db92,_0x458eb6)[_0x8f41('0x12')](function(_0x3a4633){logger[_0x8f41('0x13')](_0x8f41('0x14'),_0x10093f,_0x8f41('0x15'));logger[_0x8f41('0x16')](_0x8f41('0x17'),_0x10093f,_0x8f41('0x15'),JSON[_0x8f41('0x18')](_0x3a4633));if(_0x3a4633['error']){if(_0x3a4633['error'][_0x8f41('0x19')]===0x1f4){logger[_0x8f41('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x10093f,_0x3a4633[_0x8f41('0x1a')][_0x8f41('0x1b')]);return _0x38666c(_0x3a4633['error']['message']);}logger['error'](_0x8f41('0x14'),_0x10093f,_0x3a4633['error'][_0x8f41('0x1b')]);return _0x5dccc7(_0x3a4633['error'][_0x8f41('0x1b')]);}else{logger[_0x8f41('0x13')](_0x8f41('0x14'),_0x10093f,_0x8f41('0x15'));_0x5dccc7(_0x3a4633['result']['message']);}})[_0x8f41('0x1c')](function(_0x3011e3){logger['error'](_0x8f41('0x14'),_0x10093f,_0x3011e3);_0x38666c(_0x3011e3);});});}function respondWithResult(_0x3b0a49,_0x57bba2){_0x57bba2=_0x57bba2||0xc8;return function(_0x27808f){if(_0x27808f){return _0x3b0a49[_0x8f41('0x1d')](_0x57bba2)[_0x8f41('0x1e')](_0x27808f);}};}function respondWithFilteredResult(_0x8e1c11,_0x24b89b){return function(_0x442c94){if(_0x442c94){var _0xe25900=typeof _0x24b89b['offset']===_0x8f41('0x1f')&&typeof _0x24b89b[_0x8f41('0x20')]===_0x8f41('0x1f');var _0x40807a=_0x442c94[_0x8f41('0x21')];var _0x271b96=_0xe25900?0x0:_0x24b89b[_0x8f41('0x22')];var _0x4cfc00=_0xe25900?_0x442c94[_0x8f41('0x21')]:_0x24b89b[_0x8f41('0x22')]+_0x24b89b[_0x8f41('0x20')];var _0x1aacc4;if(_0x4cfc00>=_0x40807a){_0x4cfc00=_0x40807a;_0x1aacc4=0xc8;}else{_0x1aacc4=0xce;}_0x8e1c11[_0x8f41('0x1d')](_0x1aacc4);return _0x8e1c11[_0x8f41('0x23')]('Content-Range',_0x271b96+'-'+_0x4cfc00+'/'+_0x40807a)[_0x8f41('0x1e')](_0x442c94);}return null;};}function saveUpdates(_0x4c82d6){return function(_0x9a6f1a){if(_0x9a6f1a){return _0x9a6f1a['update'](_0x4c82d6)[_0x8f41('0x12')](function(_0x1afa08){return _0x1afa08;});}return null;};}function removeEntity(_0x2f0713){return function(_0x5617c4){if(_0x5617c4){return _0x5617c4['destroy']()['then'](function(){_0x2f0713[_0x8f41('0x1d')](0xcc)[_0x8f41('0x24')]();});}};}function handleEntityNotFound(_0x1503c2){return function(_0x3ee268){if(!_0x3ee268){_0x1503c2[_0x8f41('0x25')](0x194);}return _0x3ee268;};}function handleError(_0x2dc08c,_0x2bddb6){_0x2bddb6=_0x2bddb6||0x1f4;return function(_0x32c72c){logger['error'](_0x32c72c['stack']);if(_0x32c72c[_0x8f41('0x26')]){delete _0x32c72c['name'];}_0x2dc08c[_0x8f41('0x1d')](_0x2bddb6)[_0x8f41('0x27')](_0x32c72c);};}exports[_0x8f41('0x28')]=function(_0x220491,_0x114714){var _0x1cd4c7={},_0x3ced9a={},_0x2be5a8={'count':0x0,'rows':[]};var _0x11c5d7=_[_0x8f41('0x29')](db[_0x8f41('0x2a')][_0x8f41('0x2b')],function(_0xc8df50){return{'name':_0xc8df50[_0x8f41('0x2c')],'type':_0xc8df50['type'][_0x8f41('0x2d')]};});_0x3ced9a[_0x8f41('0x2e')]=_[_0x8f41('0x29')](_0x11c5d7,'name');_0x3ced9a[_0x8f41('0x2f')]=_['keys'](_0x220491[_0x8f41('0x2f')]);_0x3ced9a[_0x8f41('0x30')]=_[_0x8f41('0x31')](_0x3ced9a[_0x8f41('0x2e')],_0x3ced9a[_0x8f41('0x2f')]);_0x1cd4c7['attributes']=_[_0x8f41('0x31')](_0x3ced9a['model'],qs['fields'](_0x220491[_0x8f41('0x2f')]['fields']));_0x1cd4c7[_0x8f41('0x32')]=_0x1cd4c7[_0x8f41('0x32')][_0x8f41('0x33')]?_0x1cd4c7[_0x8f41('0x32')]:_0x3ced9a[_0x8f41('0x2e')];if(!_0x220491[_0x8f41('0x2f')][_0x8f41('0x34')](_0x8f41('0x35'))){_0x1cd4c7[_0x8f41('0x20')]=qs['limit'](_0x220491['query'][_0x8f41('0x20')]);_0x1cd4c7[_0x8f41('0x22')]=qs[_0x8f41('0x22')](_0x220491[_0x8f41('0x2f')][_0x8f41('0x22')]);}_0x1cd4c7[_0x8f41('0x36')]=qs[_0x8f41('0x37')](_0x220491[_0x8f41('0x2f')][_0x8f41('0x37')]);_0x1cd4c7[_0x8f41('0x38')]=qs[_0x8f41('0x30')](_[_0x8f41('0x39')](_0x220491[_0x8f41('0x2f')],_0x3ced9a['filters']),_0x11c5d7);if(_0x220491['query'][_0x8f41('0x3a')]){_0x1cd4c7[_0x8f41('0x38')]=_[_0x8f41('0x3b')](_0x1cd4c7[_0x8f41('0x38')],{'$or':_[_0x8f41('0x29')](_0x11c5d7,function(_0x199c3b){if(_0x199c3b[_0x8f41('0x3c')]!=='VIRTUAL'){var _0x27dd40={};_0x27dd40[_0x199c3b[_0x8f41('0x26')]]={'$like':'%'+_0x220491[_0x8f41('0x2f')]['filter']+'%'};return _0x27dd40;}})});}_0x1cd4c7=_['merge']({},_0x1cd4c7,_0x220491[_0x8f41('0x3d')]);var _0x488367={'where':_0x1cd4c7[_0x8f41('0x38')]};return db[_0x8f41('0x2a')][_0x8f41('0x21')](_0x488367)['then'](function(_0x2471e4){_0x2be5a8[_0x8f41('0x21')]=_0x2471e4;if(_0x220491[_0x8f41('0x2f')]['includeAll']){_0x1cd4c7[_0x8f41('0x3e')]=[{'all':!![]}];}return db[_0x8f41('0x2a')][_0x8f41('0x3f')](_0x1cd4c7);})[_0x8f41('0x12')](function(_0x1efc09){_0x2be5a8['rows']=_0x1efc09;return _0x2be5a8;})[_0x8f41('0x12')](respondWithFilteredResult(_0x114714,_0x1cd4c7))[_0x8f41('0x1c')](handleError(_0x114714,null));};exports[_0x8f41('0x40')]=function(_0x14c416,_0x5575db){var _0x28ea43={'raw':!![],'where':{'id':_0x14c416[_0x8f41('0x41')]['id']}},_0x2f9fbc={};_0x2f9fbc[_0x8f41('0x2e')]=_['keys'](db[_0x8f41('0x2a')][_0x8f41('0x2b')]);_0x2f9fbc[_0x8f41('0x2f')]=_[_0x8f41('0x42')](_0x14c416[_0x8f41('0x2f')]);_0x2f9fbc[_0x8f41('0x30')]=_[_0x8f41('0x31')](_0x2f9fbc[_0x8f41('0x2e')],_0x2f9fbc[_0x8f41('0x2f')]);_0x28ea43[_0x8f41('0x32')]=_[_0x8f41('0x31')](_0x2f9fbc[_0x8f41('0x2e')],qs[_0x8f41('0x43')](_0x14c416[_0x8f41('0x2f')][_0x8f41('0x43')]));_0x28ea43[_0x8f41('0x32')]=_0x28ea43[_0x8f41('0x32')][_0x8f41('0x33')]?_0x28ea43[_0x8f41('0x32')]:_0x2f9fbc[_0x8f41('0x2e')];if(_0x14c416[_0x8f41('0x2f')][_0x8f41('0x44')]){_0x28ea43[_0x8f41('0x3e')]=[{'all':!![]}];}_0x28ea43=_[_0x8f41('0x3b')]({},_0x28ea43,_0x14c416[_0x8f41('0x3d')]);return db[_0x8f41('0x2a')]['find'](_0x28ea43)['then'](handleEntityNotFound(_0x5575db,null))[_0x8f41('0x12')](respondWithResult(_0x5575db,null))[_0x8f41('0x1c')](handleError(_0x5575db,null));};exports[_0x8f41('0x45')]=function(_0x4e7e04,_0x20014c){if(_0x4e7e04['body']['id']){delete _0x4e7e04['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x4e7e04[_0x8f41('0x41')]['id']}})[_0x8f41('0x12')](handleEntityNotFound(_0x20014c,null))[_0x8f41('0x12')](saveUpdates(_0x4e7e04['body'],null))[_0x8f41('0x12')](respondWithResult(_0x20014c,null))[_0x8f41('0x1c')](handleError(_0x20014c,null));};exports['destroy']=function(_0x36985a,_0x47fe34){return db['FaxMessage'][_0x8f41('0x46')]({'where':{'id':_0x36985a['params']['id']}})[_0x8f41('0x12')](handleEntityNotFound(_0x47fe34,null))[_0x8f41('0x12')](removeEntity(_0x47fe34,null))[_0x8f41('0x1c')](handleError(_0x47fe34,null));};exports[_0x8f41('0x47')]=function(_0x5b71c6,_0x433e31){return db[_0x8f41('0x2a')][_0x8f41('0x47')]()[_0x8f41('0x12')](respondWithResult(_0x433e31,null))[_0x8f41('0x1c')](handleError(_0x433e31,null));};exports[_0x8f41('0x48')]=function(_0x2432e6,_0x258e56){var _0x96e370=_0x8f41('0x49');return interactionService[_0x8f41('0x4a')](_0x2432e6,_0x96e370)['then'](respondWithResult(_0x258e56,null))['catch'](handleError(_0x258e56,null));};exports['accept']=function(_0x219cec,_0x16614b){var _0x346068=_0x8f41('0x4b');return interactionService[_0x8f41('0x4a')](_0x219cec,_0x346068)[_0x8f41('0x12')](respondWithResult(_0x16614b,null))[_0x8f41('0x1c')](handleError(_0x16614b,null));};exports[_0x8f41('0x4c')]=function(_0x154037,_0x3f106b){var _0xd9b903={'agent':{},'channel':_0x8f41('0x4b')};if(_0x154037[_0x8f41('0x4d')]['id']){delete _0x154037['body']['id'];}_0x154037['body'][_0x8f41('0x4e')]=_0x154037[_0x8f41('0x4d')][_0x8f41('0x4e')]||_0x154037[_0x8f41('0x4f')]['id'];_0xd9b903[_0x8f41('0x50')]['id']=_0x154037[_0x8f41('0x4d')][_0x8f41('0x4e')];return db[_0x8f41('0x2a')][_0x8f41('0x46')]({'where':{'id':_0x154037[_0x8f41('0x41')]['id'],'UserId':null}})[_0x8f41('0x12')](handleEntityNotFound(_0x3f106b,null))[_0x8f41('0x12')](function(_0x1572c0){if(_0x1572c0){_0xd9b903[_0x8f41('0x1b')]=_0x1572c0['get']({'plain':!![]});return db[_0x8f41('0x51')]['find']({'where':{'id':_0x1572c0[_0x8f41('0x52')]}});}return null;})['then'](handleEntityNotFound(_0x3f106b,null))[_0x8f41('0x12')](function(_0x342bb2){if(_0x342bb2){_0xd9b903[_0x8f41('0x53')]=_0x342bb2[_0x8f41('0x54')]({'plain':!![]});interaction_log[_0x8f41('0x13')](_0x8f41('0x55'),_0x154037[_0x8f41('0x4f')]['id'],_0x154037[_0x8f41('0x4f')][_0x8f41('0x26')],_0x154037[_0x8f41('0x4f')][_0x8f41('0x56')],_0xd9b903[_0x8f41('0x53')]['id'],_0x154037[_0x8f41('0x4d')]?JSON[_0x8f41('0x18')](_0x154037[_0x8f41('0x4d')]):_0x8f41('0x57'));return respondWithRpcPromise('RejectMessage',_0x8f41('0x58'),_0xd9b903);}return null;})['then'](function(_0x278a5b){var _0x49d0ee=_0x8f41('0x59')+_0x278a5b[_0x8f41('0x1b')][_0x8f41('0x5a')];return db[_0x8f41('0x5b')]['query'](_0x49d0ee,{'type':db['Sequelize']['QueryTypes'][_0x8f41('0x5c')],'raw':!![]})['then'](function(_0x4c5de4){return _0x4c5de4;});})[_0x8f41('0x12')](function(_0x4fba45){if(_0x4fba45){_0xd9b903['message'][_0x8f41('0x5d')]=_0x4fba45[0x0];if(!_0x154037[_0x8f41('0x4d')][_0x8f41('0x4e')])return;return db['User'][_0x8f41('0x46')]({'where':{'id':_0x154037[_0x8f41('0x4d')][_0x8f41('0x4e')],'role':'agent'},'attributes':['id',_0x8f41('0x26'),'fullname',_0x8f41('0x5e'),_0x8f41('0x5f')],'raw':!![]});}return null;})[_0x8f41('0x12')](function(_0x2dfd24){if(!_0x2dfd24)return null;_0xd9b903[_0x8f41('0x1b')][_0x8f41('0x50')]=_0x2dfd24;return _0xd9b903;})[_0x8f41('0x12')](function(_0xca04a6){if(_0xca04a6){_0xca04a6[_0x8f41('0x1b')][_0x8f41('0x60')]=util['format'](_0x8f41('0x61'),_0x154037[_0x8f41('0x4f')]['name']);_0xca04a6['message'][_0x8f41('0x62')]=_0xd9b903[_0x8f41('0x62')];_0xca04a6['message'][_0x8f41('0x63')]=_0xd9b903[_0x8f41('0x62')];_0xca04a6[_0x8f41('0x1b')]['event']=_0x8f41('0x4c');respondWithRpcPromise(_0x8f41('0x64'),'EventManager',{'event':_0x8f41('0x65'),'message':_0xca04a6[_0x8f41('0x1b')]},client9002);return _0xd9b903;}return null;})[_0x8f41('0x12')](respondWithResult(_0x3f106b,null))['catch'](handleError(_0x3f106b,null));};exports['create']=function(_0xff008b,_0x1b9578){var _0x1428a9;return db[_0x8f41('0x2a')][_0x8f41('0x66')](_0xff008b['body'],{})[_0x8f41('0x12')](function(_0x502d58){_0x1428a9=_0x502d58;return db[_0x8f41('0x67')][_0x8f41('0x68')]({'where':{'id':_0x1428a9['ContactId']}});})['then'](function(_0x4d42ba){if(_[_0x8f41('0x69')](_0x4d42ba)){return;}else{_0x1428a9[_0x8f41('0x4b')]=_0x4d42ba[_0x8f41('0x4b')];return db[_0x8f41('0x6a')]['findOne']({'where':{'id':_0x1428a9['AttachmentId']}});}})[_0x8f41('0x12')](function(_0x5ad31b){return respondWithRpcPromise(_0x8f41('0x6b'),_0x8f41('0x6b'),{'FaxAccountId':_[_0x8f41('0x69')](_0xff008b[_0x8f41('0x4d')])?undefined:_0xff008b['body']['FaxAccountId'],'path':_[_0x8f41('0x69')](_0x5ad31b)?undefined:util[_0x8f41('0x6c')](_0x8f41('0x6d'),_0x5ad31b[_0x8f41('0x6e')]),'fax':_[_0x8f41('0x69')](_0x1428a9['fax'])?undefined:_0x1428a9[_0x8f41('0x4b')],'AttachmentId':_0x1428a9[_0x8f41('0x6f')]},client9002);})['then'](respondWithResult(_0x1b9578,0xc9))[_0x8f41('0x1c')](handleError(_0x1b9578,null));};exports[_0x8f41('0x70')]=function(_0x18405d,_0x3a7fb3){var _0x29561d=path[_0x8f41('0x71')](config[_0x8f41('0x72')],_0x8f41('0x73'),_0x8f41('0x74'),_0x8f41('0x75'));return db[_0x8f41('0x2a')][_0x8f41('0x46')]({'where':{'id':_0x18405d[_0x8f41('0x41')]['id']},'include':[{'model':db[_0x8f41('0x6a')],'as':'Attachment'}]})[_0x8f41('0x12')](handleEntityNotFound(_0x3a7fb3,null))[_0x8f41('0x12')](function(_0x4033cd){if(_0x4033cd){return _0x3a7fb3[_0x8f41('0x70')](path[_0x8f41('0x71')](_0x29561d,_0x4033cd[_0x8f41('0x6a')][_0x8f41('0x6e')]));}})['catch'](handleError(_0x3a7fb3,null));}; \ No newline at end of file +var _0x7728=['api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','client','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','Content-Range','destroy','end','sendStatus','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','FaxMessage','rows','show','params','rawAttributes','include','find','update','body','describe','accept','acceptMessage','fax','UserId','user','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','email','internal','format','SIP/%s','channel','motionChannel','event','reject','rejectmessage','create','CmContact','isNil','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','Attachment','join','util','lodash','../../config/logger'];(function(_0x41e9eb,_0x17c5ac){var _0xf76a91=function(_0x40feef){while(--_0x40feef){_0x41e9eb['push'](_0x41e9eb['shift']());}};_0xf76a91(++_0x17c5ac);}(_0x7728,0x1bd));var _0x8772=function(_0x28a59c,_0x37bd9f){_0x28a59c=_0x28a59c-0x0;var _0x14cbba=_0x7728[_0x28a59c];return _0x14cbba;};'use strict';var util=require(_0x8772('0x0'));var path=require('path');var _=require(_0x8772('0x1'));var Redis=require('ioredis');var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x8772('0x2'))(_0x8772('0x3'));var config=require('../../config/environment');var db=require(_0x8772('0x4'))['db'];config[_0x8772('0x5')]=_[_0x8772('0x6')](config[_0x8772('0x5')],{'host':_0x8772('0x7'),'port':0x18eb});var socket=require(_0x8772('0x8'))(new Redis(config[_0x8772('0x5')]));require('./faxMessage.socket')[_0x8772('0x9')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8772('0xa')]({'port':0x232c});var client9002=jayson[_0x8772('0xb')][_0x8772('0xa')]({'port':0x232a});var interaction_log=require(_0x8772('0x2'))('fax-interactions');function respondWithRpcPromise(_0x1f2c83,_0x56a5ea,_0xce357b,_0xec9cc7){return new Promise(function(_0x6b17e4,_0x27bf67){var _0x452e77=_0xec9cc7||client;return _0x452e77[_0x8772('0xc')](_0x1f2c83,_0xce357b)[_0x8772('0xd')](function(_0x2d1ecb){logger['info'](_0x8772('0xe'),_0x56a5ea,_0x8772('0xf'));logger[_0x8772('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x56a5ea,_0x8772('0xf'),JSON['stringify'](_0x2d1ecb));if(_0x2d1ecb[_0x8772('0x11')]){if(_0x2d1ecb[_0x8772('0x11')][_0x8772('0x12')]===0x1f4){logger[_0x8772('0x11')](_0x8772('0xe'),_0x56a5ea,_0x2d1ecb[_0x8772('0x11')][_0x8772('0x13')]);return _0x27bf67(_0x2d1ecb['error'][_0x8772('0x13')]);}logger[_0x8772('0x11')](_0x8772('0xe'),_0x56a5ea,_0x2d1ecb[_0x8772('0x11')][_0x8772('0x13')]);return _0x6b17e4(_0x2d1ecb[_0x8772('0x11')][_0x8772('0x13')]);}else{logger[_0x8772('0x14')](_0x8772('0xe'),_0x56a5ea,'request\x20sent');_0x6b17e4(_0x2d1ecb[_0x8772('0x15')][_0x8772('0x13')]);}})[_0x8772('0x16')](function(_0x2c52f3){logger[_0x8772('0x11')](_0x8772('0xe'),_0x56a5ea,_0x2c52f3);_0x27bf67(_0x2c52f3);});});}function respondWithResult(_0x43cb47,_0x521bc7){_0x521bc7=_0x521bc7||0xc8;return function(_0x51cee3){if(_0x51cee3){return _0x43cb47[_0x8772('0x17')](_0x521bc7)[_0x8772('0x18')](_0x51cee3);}};}function respondWithFilteredResult(_0x3e13c5,_0x11fbad){return function(_0x1bb82d){if(_0x1bb82d){var _0x375115=typeof _0x11fbad[_0x8772('0x19')]===_0x8772('0x1a')&&typeof _0x11fbad[_0x8772('0x1b')]===_0x8772('0x1a');var _0x4a3af5=_0x1bb82d[_0x8772('0x1c')];var _0x43b758=_0x375115?0x0:_0x11fbad['offset'];var _0x38a42e=_0x375115?_0x1bb82d[_0x8772('0x1c')]:_0x11fbad[_0x8772('0x19')]+_0x11fbad[_0x8772('0x1b')];var _0x346b6a;if(_0x38a42e>=_0x4a3af5){_0x38a42e=_0x4a3af5;_0x346b6a=0xc8;}else{_0x346b6a=0xce;}_0x3e13c5['status'](_0x346b6a);return _0x3e13c5['set'](_0x8772('0x1d'),_0x43b758+'-'+_0x38a42e+'/'+_0x4a3af5)[_0x8772('0x18')](_0x1bb82d);}return null;};}function saveUpdates(_0x2b24e1){return function(_0x3ffe88){if(_0x3ffe88){return _0x3ffe88['update'](_0x2b24e1)['then'](function(_0x5085b4){return _0x5085b4;});}return null;};}function removeEntity(_0x541ab9){return function(_0xf74dd){if(_0xf74dd){return _0xf74dd[_0x8772('0x1e')]()[_0x8772('0xd')](function(){_0x541ab9[_0x8772('0x17')](0xcc)[_0x8772('0x1f')]();});}};}function handleEntityNotFound(_0x57e881){return function(_0x33cc0a){if(!_0x33cc0a){_0x57e881[_0x8772('0x20')](0x194);}return _0x33cc0a;};}function handleError(_0x964702,_0x3511a2){_0x3511a2=_0x3511a2||0x1f4;return function(_0x5ef353){logger['error'](_0x5ef353['stack']);if(_0x5ef353[_0x8772('0x21')]){delete _0x5ef353[_0x8772('0x21')];}_0x964702[_0x8772('0x17')](_0x3511a2)[_0x8772('0x22')](_0x5ef353);};}exports['index']=function(_0x4358b3,_0x2d9bad){var _0x13f5ec={},_0x22cc4e={},_0x487b64={'count':0x0,'rows':[]};var _0x27e38a=_[_0x8772('0x23')](db['FaxMessage']['rawAttributes'],function(_0x5dee0b){return{'name':_0x5dee0b[_0x8772('0x24')],'type':_0x5dee0b[_0x8772('0x25')][_0x8772('0x26')]};});_0x22cc4e[_0x8772('0x27')]=_[_0x8772('0x23')](_0x27e38a,_0x8772('0x21'));_0x22cc4e[_0x8772('0x28')]=_[_0x8772('0x29')](_0x4358b3[_0x8772('0x28')]);_0x22cc4e[_0x8772('0x2a')]=_[_0x8772('0x2b')](_0x22cc4e[_0x8772('0x27')],_0x22cc4e[_0x8772('0x28')]);_0x13f5ec[_0x8772('0x2c')]=_[_0x8772('0x2b')](_0x22cc4e[_0x8772('0x27')],qs[_0x8772('0x2d')](_0x4358b3[_0x8772('0x28')][_0x8772('0x2d')]));_0x13f5ec['attributes']=_0x13f5ec[_0x8772('0x2c')][_0x8772('0x2e')]?_0x13f5ec[_0x8772('0x2c')]:_0x22cc4e[_0x8772('0x27')];if(!_0x4358b3['query'][_0x8772('0x2f')](_0x8772('0x30'))){_0x13f5ec[_0x8772('0x1b')]=qs[_0x8772('0x1b')](_0x4358b3[_0x8772('0x28')]['limit']);_0x13f5ec[_0x8772('0x19')]=qs['offset'](_0x4358b3[_0x8772('0x28')][_0x8772('0x19')]);}_0x13f5ec['order']=qs[_0x8772('0x31')](_0x4358b3[_0x8772('0x28')][_0x8772('0x31')]);_0x13f5ec['where']=qs[_0x8772('0x2a')](_[_0x8772('0x32')](_0x4358b3[_0x8772('0x28')],_0x22cc4e['filters']),_0x27e38a);if(_0x4358b3[_0x8772('0x28')][_0x8772('0x33')]){_0x13f5ec[_0x8772('0x34')]=_[_0x8772('0x35')](_0x13f5ec['where'],{'$or':_[_0x8772('0x23')](_0x27e38a,function(_0x2138f6){if(_0x2138f6[_0x8772('0x25')]!==_0x8772('0x36')){var _0x44087b={};_0x44087b[_0x2138f6[_0x8772('0x21')]]={'$like':'%'+_0x4358b3[_0x8772('0x28')][_0x8772('0x33')]+'%'};return _0x44087b;}})});}_0x13f5ec=_[_0x8772('0x35')]({},_0x13f5ec,_0x4358b3[_0x8772('0x37')]);var _0xa81cce={'where':_0x13f5ec[_0x8772('0x34')]};return db['FaxMessage'][_0x8772('0x1c')](_0xa81cce)[_0x8772('0xd')](function(_0x48f3b2){_0x487b64[_0x8772('0x1c')]=_0x48f3b2;if(_0x4358b3[_0x8772('0x28')][_0x8772('0x38')]){_0x13f5ec['include']=[{'all':!![]}];}return db[_0x8772('0x39')]['findAll'](_0x13f5ec);})[_0x8772('0xd')](function(_0x299aef){_0x487b64[_0x8772('0x3a')]=_0x299aef;return _0x487b64;})['then'](respondWithFilteredResult(_0x2d9bad,_0x13f5ec))[_0x8772('0x16')](handleError(_0x2d9bad,null));};exports[_0x8772('0x3b')]=function(_0x4365dc,_0x5f102e){var _0x436ea0={'raw':!![],'where':{'id':_0x4365dc[_0x8772('0x3c')]['id']}},_0x171f3d={};_0x171f3d[_0x8772('0x27')]=_[_0x8772('0x29')](db[_0x8772('0x39')][_0x8772('0x3d')]);_0x171f3d['query']=_['keys'](_0x4365dc['query']);_0x171f3d[_0x8772('0x2a')]=_[_0x8772('0x2b')](_0x171f3d['model'],_0x171f3d[_0x8772('0x28')]);_0x436ea0[_0x8772('0x2c')]=_['intersection'](_0x171f3d[_0x8772('0x27')],qs['fields'](_0x4365dc[_0x8772('0x28')][_0x8772('0x2d')]));_0x436ea0['attributes']=_0x436ea0['attributes'][_0x8772('0x2e')]?_0x436ea0[_0x8772('0x2c')]:_0x171f3d[_0x8772('0x27')];if(_0x4365dc[_0x8772('0x28')][_0x8772('0x38')]){_0x436ea0[_0x8772('0x3e')]=[{'all':!![]}];}_0x436ea0=_[_0x8772('0x35')]({},_0x436ea0,_0x4365dc[_0x8772('0x37')]);return db['FaxMessage'][_0x8772('0x3f')](_0x436ea0)[_0x8772('0xd')](handleEntityNotFound(_0x5f102e,null))[_0x8772('0xd')](respondWithResult(_0x5f102e,null))[_0x8772('0x16')](handleError(_0x5f102e,null));};exports[_0x8772('0x40')]=function(_0x31d09b,_0x3208ad){if(_0x31d09b[_0x8772('0x41')]['id']){delete _0x31d09b[_0x8772('0x41')]['id'];}return db[_0x8772('0x39')]['find']({'where':{'id':_0x31d09b[_0x8772('0x3c')]['id']}})[_0x8772('0xd')](handleEntityNotFound(_0x3208ad,null))[_0x8772('0xd')](saveUpdates(_0x31d09b[_0x8772('0x41')],null))[_0x8772('0xd')](respondWithResult(_0x3208ad,null))['catch'](handleError(_0x3208ad,null));};exports['destroy']=function(_0x1b0568,_0x54ddd3){return db[_0x8772('0x39')][_0x8772('0x3f')]({'where':{'id':_0x1b0568[_0x8772('0x3c')]['id']}})[_0x8772('0xd')](handleEntityNotFound(_0x54ddd3,null))[_0x8772('0xd')](removeEntity(_0x54ddd3,null))['catch'](handleError(_0x54ddd3,null));};exports[_0x8772('0x42')]=function(_0x4ed05b,_0x1a4b52){return db['FaxMessage']['describe']()[_0x8772('0xd')](respondWithResult(_0x1a4b52,null))[_0x8772('0x16')](handleError(_0x1a4b52,null));};exports[_0x8772('0x43')]=function(_0x4911a7,_0x4cb7b4){var _0x4a48c7='sms';return interactionService[_0x8772('0x44')](_0x4911a7,_0x4a48c7)[_0x8772('0xd')](respondWithResult(_0x4cb7b4,null))[_0x8772('0x16')](handleError(_0x4cb7b4,null));};exports['accept']=function(_0xb4a4b,_0x2587e3){var _0x1cfc02='fax';return interactionService[_0x8772('0x44')](_0xb4a4b,_0x1cfc02)[_0x8772('0xd')](respondWithResult(_0x2587e3,null))[_0x8772('0x16')](handleError(_0x2587e3,null));};exports['reject']=function(_0x541d7c,_0x4b2736){var _0x8f3b15={'agent':{},'channel':_0x8772('0x45')};if(_0x541d7c[_0x8772('0x41')]['id']){delete _0x541d7c[_0x8772('0x41')]['id'];}_0x541d7c['body'][_0x8772('0x46')]=_0x541d7c[_0x8772('0x41')][_0x8772('0x46')]||_0x541d7c[_0x8772('0x47')]['id'];_0x8f3b15[_0x8772('0x48')]['id']=_0x541d7c[_0x8772('0x41')][_0x8772('0x46')];return db['FaxMessage']['find']({'where':{'id':_0x541d7c[_0x8772('0x3c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b2736,null))[_0x8772('0xd')](function(_0x5a12e0){if(_0x5a12e0){_0x8f3b15[_0x8772('0x13')]=_0x5a12e0[_0x8772('0x49')]({'plain':!![]});return db[_0x8772('0x4a')][_0x8772('0x3f')]({'where':{'id':_0x5a12e0[_0x8772('0x4b')]}});}return null;})[_0x8772('0xd')](handleEntityNotFound(_0x4b2736,null))[_0x8772('0xd')](function(_0x41c96f){if(_0x41c96f){_0x8f3b15[_0x8772('0x4c')]=_0x41c96f[_0x8772('0x49')]({'plain':!![]});interaction_log[_0x8772('0x14')](_0x8772('0x4d'),_0x541d7c[_0x8772('0x47')]['id'],_0x541d7c[_0x8772('0x47')][_0x8772('0x21')],_0x541d7c['user'][_0x8772('0x4e')],_0x8f3b15[_0x8772('0x4c')]['id'],_0x541d7c[_0x8772('0x41')]?JSON[_0x8772('0x4f')](_0x541d7c[_0x8772('0x41')]):_0x8772('0x50'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x8f3b15);}return null;})[_0x8772('0xd')](function(_0x114fd8){var _0x1ee515=_0x8772('0x51')+_0x114fd8['message'][_0x8772('0x52')];return db[_0x8772('0x53')][_0x8772('0x28')](_0x1ee515,{'type':db[_0x8772('0x54')]['QueryTypes']['SELECT'],'raw':!![]})[_0x8772('0xd')](function(_0x39da20){return _0x39da20;});})[_0x8772('0xd')](function(_0x47960f){if(_0x47960f){_0x8f3b15['message'][_0x8772('0x55')]=_0x47960f[0x0];if(!_0x541d7c['body'][_0x8772('0x46')])return;return db[_0x8772('0x56')][_0x8772('0x3f')]({'where':{'id':_0x541d7c['body'][_0x8772('0x46')],'role':_0x8772('0x48')},'attributes':['id',_0x8772('0x21'),'fullname',_0x8772('0x57'),_0x8772('0x58')],'raw':!![]});}return null;})['then'](function(_0x4e6dc2){if(!_0x4e6dc2)return null;_0x8f3b15[_0x8772('0x13')][_0x8772('0x48')]=_0x4e6dc2;return _0x8f3b15;})['then'](function(_0x1b5ae4){if(_0x1b5ae4){_0x1b5ae4[_0x8772('0x13')]['interface']=util[_0x8772('0x59')](_0x8772('0x5a'),_0x541d7c[_0x8772('0x47')][_0x8772('0x21')]);_0x1b5ae4['message']['channel']=_0x8f3b15[_0x8772('0x5b')];_0x1b5ae4[_0x8772('0x13')][_0x8772('0x5c')]=_0x8f3b15[_0x8772('0x5b')];_0x1b5ae4[_0x8772('0x13')][_0x8772('0x5d')]=_0x8772('0x5e');respondWithRpcPromise('EventManager','EventManager',{'event':_0x8772('0x5f'),'message':_0x1b5ae4[_0x8772('0x13')]},client9002);return _0x8f3b15;}return null;})['then'](respondWithResult(_0x4b2736,null))[_0x8772('0x16')](handleError(_0x4b2736,null));};exports[_0x8772('0x60')]=function(_0x2b7bde,_0x4162f1){var _0x279523;return db['FaxMessage'][_0x8772('0x60')](_0x2b7bde[_0x8772('0x41')],{})[_0x8772('0xd')](function(_0x128d14){_0x279523=_0x128d14;return db[_0x8772('0x61')]['findOne']({'where':{'id':_0x279523[_0x8772('0x52')]}});})[_0x8772('0xd')](function(_0x54896d){if(_[_0x8772('0x62')](_0x54896d)){return;}else{_0x279523['fax']=_0x54896d['fax'];return db['Attachment'][_0x8772('0x63')]({'where':{'id':_0x279523[_0x8772('0x64')]}});}})[_0x8772('0xd')](function(_0x4a6866){return respondWithRpcPromise('SendFax',_0x8772('0x65'),{'FaxAccountId':_[_0x8772('0x62')](_0x2b7bde[_0x8772('0x41')])?undefined:_0x2b7bde[_0x8772('0x41')][_0x8772('0x66')],'path':_[_0x8772('0x62')](_0x4a6866)?undefined:util[_0x8772('0x59')](_0x8772('0x67'),_0x4a6866[_0x8772('0x68')]),'fax':_[_0x8772('0x62')](_0x279523[_0x8772('0x45')])?undefined:_0x279523['fax'],'AttachmentId':_0x279523[_0x8772('0x64')]},client9002);})['then'](respondWithResult(_0x4162f1,0xc9))[_0x8772('0x16')](handleError(_0x4162f1,null));};exports[_0x8772('0x69')]=function(_0x10c1dd,_0x57d265){var _0x1b8751=path['join'](config[_0x8772('0x6a')],_0x8772('0x6b'),_0x8772('0x6c'),_0x8772('0x6d'));return db[_0x8772('0x39')][_0x8772('0x3f')]({'where':{'id':_0x10c1dd[_0x8772('0x3c')]['id']},'include':[{'model':db['Attachment'],'as':_0x8772('0x6e')}]})[_0x8772('0xd')](handleEntityNotFound(_0x57d265,null))[_0x8772('0xd')](function(_0x1ed2b2){if(_0x1ed2b2){return _0x57d265[_0x8772('0x69')](path[_0x8772('0x6f')](_0x1b8751,_0x1ed2b2[_0x8772('0x6e')][_0x8772('0x68')]));}})[_0x8772('0x16')](handleError(_0x57d265,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 00c6cd4..b12beba 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 _0x3641=['../../mysqldb','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x16b172,_0x245b65){var _0x1cfab5=function(_0x4ccda5){while(--_0x4ccda5){_0x16b172['push'](_0x16b172['shift']());}};_0x1cfab5(++_0x245b65);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x1364('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1364('0x1'),'afterUpdate':_0x1364('0x2'),'afterDestroy':'remove'};function emitEvent(_0x435684){return function(_0x4a9034,_0x3d14e0,_0x4e41b7){FaxMessageEvents[_0x1364('0x3')](_0x435684+':'+_0x4a9034['id'],_0x4a9034);FaxMessageEvents['emit'](_0x435684,_0x4a9034);_0x4e41b7(null);};}for(var e in events){if(events[_0x1364('0x4')](e)){var event=events[e];FaxMessage[_0x1364('0x5')](e,emitEvent(event));}}module[_0x1364('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0xa6b0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x3ad806,_0x5e7e03){_0x3ad806=_0x3ad806-0x0;var _0x2c715e=_0xa6b0[_0x3ad806];return _0x2c715e;};'use strict';var EventEmitter=require(_0x0a6b('0x0'));var FaxMessage=require(_0x0a6b('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0a6b('0x2'),'afterUpdate':_0x0a6b('0x3'),'afterDestroy':_0x0a6b('0x4')};function emitEvent(_0x4c9a84){return function(_0x29ff80,_0x33e8c3,_0x195697){FaxMessageEvents[_0x0a6b('0x5')](_0x4c9a84+':'+_0x29ff80['id'],_0x29ff80);FaxMessageEvents[_0x0a6b('0x5')](_0x4c9a84,_0x29ff80);_0x195697(null);};}for(var e in events){if(events[_0x0a6b('0x6')](e)){var event=events[e];FaxMessage[_0x0a6b('0x7')](e,emitEvent(event));}}module[_0x0a6b('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e500ccb..6ccf8fa 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 _0xaf55=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0x754f7f,_0x5a0753){var _0x20d21b=function(_0x36594e){while(--_0x36594e){_0x754f7f['push'](_0x754f7f['shift']());}};_0x20d21b(++_0x5a0753);}(_0xaf55,0x13e));var _0x5af5=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xaf55[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5af5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5af5('0x1'));var moment=require(_0x5af5('0x2'));var BPromise=require(_0x5af5('0x3'));var rp=require(_0x5af5('0x4'));var fs=require('fs');var path=require(_0x5af5('0x5'));var rimraf=require(_0x5af5('0x6'));var config=require(_0x5af5('0x7'));var attributes=require('./faxMessage.attributes');module[_0x5af5('0x8')]=function(_0x30e62d,_0x427226){return _0x30e62d[_0x5af5('0x9')](_0x5af5('0xa'),attributes,{'tableName':_0x5af5('0xb'),'paranoid':![],'indexes':[{'name':_0x5af5('0xc'),'fields':[_0x5af5('0xd')],'type':_0x5af5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b6744,_0x9fc7a7,_0x23c1f2){var _0x4c2337=_0x30e62d[_0x5af5('0xf')];var _0x33a8a5=_0x4b6744[_0x5af5('0x10')]({'plain':!![]});if(_0x33a8a5['direction'][_0x5af5('0x11')]()==='in'||_0x33a8a5[_0x5af5('0x12')][_0x5af5('0x11')]()===_0x5af5('0x13')&&!_0x33a8a5[_0x5af5('0x14')]&&!_[_0x5af5('0x15')](_0x33a8a5[_0x5af5('0x16')])){_0x4c2337['FaxInteraction'][_0x5af5('0x17')]({'where':{'id':_0x33a8a5[_0x5af5('0x18')]}})[_0x5af5('0x19')](function(_0x351461){if(_0x351461){_0x351461[_0x5af5('0x1a')]({'lastMsgAt':_0x33a8a5[_0x5af5('0x1b')],'lastMsgDirection':_0x33a8a5[_0x5af5('0x12')][_0x5af5('0x11')]()});}})[_0x5af5('0x1c')](function(_0x2ec76e){console[_0x5af5('0x1d')](_0x2ec76e);});}_0x23c1f2();}},'charset':_0x5af5('0x1e'),'collate':_0x5af5('0x1f')});}; \ No newline at end of file +var _0xe803=['path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe803,0xe7));var _0x3e80=function(_0x419510,_0x39d91a){_0x419510=_0x419510-0x0;var _0x4469dd=_0xe803[_0x419510];return _0x4469dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e80('0x0'))(_0x3e80('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e80('0x2'));var fs=require('fs');var path=require(_0x3e80('0x3'));var rimraf=require(_0x3e80('0x4'));var config=require(_0x3e80('0x5'));var attributes=require(_0x3e80('0x6'));module[_0x3e80('0x7')]=function(_0x5da6e1,_0x37e2d2){return _0x5da6e1['define'](_0x3e80('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x3e80('0x9'),'fields':[_0x3e80('0xa')],'type':_0x3e80('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26acf1,_0x3b0390,_0x562b2b){var _0x1eb782=_0x5da6e1[_0x3e80('0xc')];var _0x18e0e2=_0x26acf1[_0x3e80('0xd')]({'plain':!![]});if(_0x18e0e2['direction'][_0x3e80('0xe')]()==='in'||_0x18e0e2[_0x3e80('0xf')]['toLowerCase']()===_0x3e80('0x10')&&!_0x18e0e2['secret']&&!_[_0x3e80('0x11')](_0x18e0e2['UserId'])){_0x1eb782['FaxInteraction'][_0x3e80('0x12')]({'where':{'id':_0x18e0e2[_0x3e80('0x13')]}})[_0x3e80('0x14')](function(_0x289037){if(_0x289037){_0x289037['update']({'lastMsgAt':_0x18e0e2[_0x3e80('0x15')],'lastMsgDirection':_0x18e0e2[_0x3e80('0xf')][_0x3e80('0xe')]()});}})[_0x3e80('0x16')](function(_0x50a866){console[_0x3e80('0x17')](_0x50a866);});}_0x562b2b();}},'charset':_0x3e80('0x18'),'collate':_0x3e80('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index cc9fddd..bfa9885 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 _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a53c2,_0x2e768b){var _0x189ef4=function(_0x405d7e){while(--_0x405d7e){_0x5a53c2['push'](_0x5a53c2['shift']());}};_0x189ef4(++_0x2e768b);}(_0xe14d,0x1ee));var _0xde14=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe14d[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file +var _0x6aa7=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','options','raw','catch','update','body','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x276888,_0xa18b76){var _0x48084d=function(_0x248859){while(--_0x248859){_0x276888['push'](_0x276888['shift']());}};_0x48084d(++_0xa18b76);}(_0x6aa7,0x178));var _0x76aa=function(_0x24d15f,_0x4ecbcf){_0x24d15f=_0x24d15f-0x0;var _0x234339=_0x6aa7[_0x24d15f];return _0x234339;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});}exports[_0x76aa('0x18')]=function(_0x15b931){var _0x15109b=this;return new Promise(function(_0x191560,_0x19af92){return db[_0x76aa('0x19')][_0x76aa('0x1a')](_0x15b931['body'],{'raw':_0x15b931[_0x76aa('0x1b')]?_0x15b931[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x41463a){logger[_0x76aa('0xf')](_0x76aa('0x18'),_0x15b931);logger[_0x76aa('0x11')](_0x76aa('0x18'),_0x15b931,JSON[_0x76aa('0x13')](_0x41463a));_0x191560(_0x41463a);})[_0x76aa('0x1d')](function(_0x3363b3){logger[_0x76aa('0x14')](_0x76aa('0x18'),_0x3363b3[_0x76aa('0x16')],_0x15b931);_0x19af92(_0x15109b[_0x76aa('0x14')](0x1f4,_0x3363b3[_0x76aa('0x16')]));});});};exports['UpdateFaxMessage']=function(_0xb5e8a9){var _0x1d6d15=this;return new Promise(function(_0x25c614,_0x2e7ab4){return db[_0x76aa('0x19')][_0x76aa('0x1e')](_0xb5e8a9[_0x76aa('0x1f')],{'raw':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5e8a9['options']?_0xb5e8a9[_0x76aa('0x1b')]['where']||null:null,'attributes':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x20')]||null:null,'limit':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x21')]||null:null})[_0x76aa('0xe')](function(_0x3827ec){logger[_0x76aa('0xf')](_0x76aa('0x22'),_0xb5e8a9);logger['debug'](_0x76aa('0x22'),_0xb5e8a9,JSON[_0x76aa('0x13')](_0x3827ec));_0x25c614(_0x3827ec);})[_0x76aa('0x1d')](function(_0x928ccf){logger[_0x76aa('0x14')](_0x76aa('0x22'),_0x928ccf[_0x76aa('0x16')],_0xb5e8a9);_0x2e7ab4(_0x1d6d15['error'](0x1f4,_0x928ccf[_0x76aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 6e634a3..38c3514 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 _0x9676=['remove','update','emit','removeListener','register','length','faxMessage:','save'];(function(_0x29e595,_0x4b9838){var _0xc4e3f1=function(_0x9a3b2d){while(--_0x9a3b2d){_0x29e595['push'](_0x29e595['shift']());}};_0xc4e3f1(++_0x4b9838);}(_0x9676,0x7f));var _0x6967=function(_0x54e698,_0x4c6d5c){_0x54e698=_0x54e698-0x0;var _0x1eb4a6=_0x9676[_0x54e698];return _0x1eb4a6;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x6967('0x0'),_0x6967('0x1'),_0x6967('0x2')];function createListener(_0x57e7b4,_0x1df47c){return function(_0x1191f4){_0x1df47c[_0x6967('0x3')](_0x57e7b4,_0x1191f4);};}function removeListener(_0x42a193,_0x24513d){return function(){FaxMessageEvents[_0x6967('0x4')](_0x42a193,_0x24513d);};}exports[_0x6967('0x5')]=function(_0x572bbd){for(var _0x4e6fb5=0x0,_0x1b3476=events[_0x6967('0x6')];_0x4e6fb5<_0x1b3476;_0x4e6fb5++){var _0x43d0f3=events[_0x4e6fb5];var _0x47ba16=createListener(_0x6967('0x7')+_0x43d0f3,_0x572bbd);FaxMessageEvents['on'](_0x43d0f3,_0x47ba16);}}; \ No newline at end of file +var _0x0c9e=['faxMessage:','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c9e,0x1d1));var _0xe0c9=function(_0x222f33,_0x142ff2){_0x222f33=_0x222f33-0x0;var _0x52a205=_0x0c9e[_0x222f33];return _0x52a205;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save','remove',_0xe0c9('0x0')];function createListener(_0x21c86f,_0x37b4d5){return function(_0x2135e8){_0x37b4d5[_0xe0c9('0x1')](_0x21c86f,_0x2135e8);};}function removeListener(_0x45ded9,_0x2228eb){return function(){FaxMessageEvents['removeListener'](_0x45ded9,_0x2228eb);};}exports[_0xe0c9('0x2')]=function(_0x1b46a0){for(var _0x3e4a1a=0x0,_0x160115=events['length'];_0x3e4a1a<_0x160115;_0x3e4a1a++){var _0x2b1f34=events[_0x3e4a1a];var _0x355413=createListener(_0xe0c9('0x3')+_0x2b1f34,_0x1b46a0);FaxMessageEvents['on'](_0x2b1f34,_0x355413);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 1972f1c..2cfc9ba 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 _0xb7e7=['get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','delete','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'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('0x10')]('/',auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x11')](_0x7b7e('0x12'),_0x7b7e('0x13')),controller[_0x7b7e('0x14')]);router[_0x7b7e('0x15')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x15')]('/:id/accept',auth[_0x7b7e('0xc')](),controller['accept']);router['put'](_0x7b7e('0x17'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b7e('0x1a')]=router; \ No newline at end of file +var _0x6f0d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','show','/:id/download','post','tracked','fax','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x222d3e,_0x2f71aa){_0x222d3e=_0x222d3e-0x0;var _0x142525=_0x6f0d[_0x222d3e];return _0x142525;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller['download']);router[_0xd6f0('0xf')]('/',auth[_0xd6f0('0x9')](),interaction[_0xd6f0('0x10')](_0xd6f0('0x11'),'faxmessage:create'),controller[_0xd6f0('0x12')]);router[_0xd6f0('0x13')](_0xd6f0('0x14'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x15')]);router[_0xd6f0('0x13')](_0xd6f0('0x16'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x17')]);router['put'](_0xd6f0('0x18'),auth[_0xd6f0('0x9')](),controller['reject']);router[_0xd6f0('0x19')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1a')]);module[_0xd6f0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 599ce5b..ce5a7f0 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 _0xe495=['roundrobin','INTEGER','sequelize','STRING','name','ENUM','beepall'];(function(_0x512d6a,_0x5c514b){var _0x38513d=function(_0x9841cf){while(--_0x9841cf){_0x512d6a['push'](_0x512d6a['shift']());}};_0x38513d(++_0x5c514b);}(_0xe495,0x12f));var _0x5e49=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe495[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0x5e49('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e49('0x1')],'unique':_0x5e49('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e49('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e49('0x3')]('rrmemory',_0x5e49('0x4'),_0x5e49('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5e49('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x38fc=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x38fc,0x8c));var _0xc38f=function(_0x451dc9,_0x54e33a){_0x451dc9=_0x451dc9-0x0;var _0x5c8217=_0x38fc[_0x451dc9];return _0x5c8217;};'use strict';var Sequelize=require(_0xc38f('0x0'));module[_0xc38f('0x1')]={'name':{'type':Sequelize[_0xc38f('0x2')],'unique':_0xc38f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc38f('0x2')]},'timeout':{'type':Sequelize[_0xc38f('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc38f('0x5')](_0xc38f('0x6'),_0xc38f('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc38f('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index c98718f..e7fd9a2 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 _0xc6c0=['hasOwnProperty','nolimit','sort','pick','where','FaxQueueId','filter','options','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','interface','flatMap','sequelize','each','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','order','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','map','FaxQueue','rawAttributes','fieldName','key','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne'];(function(_0x1579e4,_0x49f202){var _0x1f6683=function(_0xd68516){while(--_0xd68516){_0x1579e4['push'](_0x1579e4['shift']());}};_0x1f6683(++_0x49f202);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xc6c0[_0x51fe5f];return _0x4abce9;};'use strict';var BPromise=require(_0x0c6c('0x0'));var util=require('util');var _=require(_0x0c6c('0x1'));var squel=require(_0x0c6c('0x2'));var Redis=require(_0x0c6c('0x3'));var qs=require(_0x0c6c('0x4'));var logger=require(_0x0c6c('0x5'))(_0x0c6c('0x6'));var config=require(_0x0c6c('0x7'));var db=require(_0x0c6c('0x8'))['db'];config[_0x0c6c('0x9')]=_[_0x0c6c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0c6c('0xb'))(new Redis(config[_0x0c6c('0x9')]));require(_0x0c6c('0xc'))[_0x0c6c('0xd')](socket);function respondWithStatusCode(_0x15c862,_0x30ae87){_0x30ae87=_0x30ae87||0xcc;return function(_0x289309){if(_0x289309){return _0x15c862[_0x0c6c('0xe')](_0x30ae87);}return _0x15c862[_0x0c6c('0xf')](_0x30ae87)[_0x0c6c('0x10')]();};}function respondWithResult(_0x4286b0,_0x3769c2){_0x3769c2=_0x3769c2||0xc8;return function(_0x238229){if(_0x238229){return _0x4286b0[_0x0c6c('0xf')](_0x3769c2)[_0x0c6c('0x11')](_0x238229);}};}function respondWithFilteredResult(_0x5c9d9a,_0x1556e8){return function(_0x5f4cd7){if(_0x5f4cd7){var _0x1dfc49=typeof _0x1556e8[_0x0c6c('0x12')]==='undefined'&&typeof _0x1556e8[_0x0c6c('0x13')]===_0x0c6c('0x14');var _0x44c500=_0x5f4cd7[_0x0c6c('0x15')];var _0x33d675=_0x1dfc49?0x0:_0x1556e8['offset'];var _0xcbf4a9=_0x1dfc49?_0x5f4cd7[_0x0c6c('0x15')]:_0x1556e8[_0x0c6c('0x12')]+_0x1556e8[_0x0c6c('0x13')];var _0x5051c2;if(_0xcbf4a9>=_0x44c500){_0xcbf4a9=_0x44c500;_0x5051c2=0xc8;}else{_0x5051c2=0xce;}_0x5c9d9a[_0x0c6c('0xf')](_0x5051c2);return _0x5c9d9a[_0x0c6c('0x16')]('Content-Range',_0x33d675+'-'+_0xcbf4a9+'/'+_0x44c500)[_0x0c6c('0x11')](_0x5f4cd7);}return null;};}function saveUpdates(_0x527ade){return function(_0x5300a7){if(_0x5300a7){return _0x5300a7['update'](_0x527ade)[_0x0c6c('0x17')](function(_0x530333){return _0x530333;});}return null;};}function removeEntity(_0x9463e8){return function(_0x50be43){if(_0x50be43){return _0x50be43[_0x0c6c('0x18')]()[_0x0c6c('0x17')](function(){var _0x9ebbd8=_0x50be43[_0x0c6c('0x19')]({'plain':!![]});var _0x4ff711=_0x0c6c('0x1a');return db[_0x0c6c('0x1b')][_0x0c6c('0x18')]({'where':{'type':_0x4ff711,'resourceId':_0x9ebbd8['id']}})[_0x0c6c('0x17')](function(){return _0x50be43;});})[_0x0c6c('0x17')](function(){_0x9463e8[_0x0c6c('0xf')](0xcc)[_0x0c6c('0x10')]();});}};}function handleEntityNotFound(_0x8e8179){return function(_0x1be835){if(!_0x1be835){_0x8e8179['sendStatus'](0x194);}return _0x1be835;};}function handleError(_0x323854,_0xc33069){_0xc33069=_0xc33069||0x1f4;return function(_0x6d291f){logger['error'](_0x6d291f[_0x0c6c('0x1c')]);if(_0x6d291f['name']){delete _0x6d291f[_0x0c6c('0x1d')];}_0x323854[_0x0c6c('0xf')](_0xc33069)[_0x0c6c('0x1e')](_0x6d291f);};}exports['index']=function(_0x3fb7a0,_0x63784f){var _0x200a47={};var _0x99b725={'count':0x0,'rows':[]};var _0xb46694=_[_0x0c6c('0x1f')](db[_0x0c6c('0x20')][_0x0c6c('0x21')],function(_0x194637){return{'name':_0x194637[_0x0c6c('0x22')],'type':_0x194637['type'][_0x0c6c('0x23')]};});_0x200a47=qs['getOptions'](_0xb46694,_0x3fb7a0);var _0x29ec5d={'where':_0x200a47['where']};return db[_0x0c6c('0x20')][_0x0c6c('0x15')](_0x29ec5d)[_0x0c6c('0x17')](function(_0xba7b3){_0x99b725[_0x0c6c('0x15')]=_0xba7b3;_0x200a47[_0x0c6c('0x24')]=qs[_0x0c6c('0x24')](_0x3fb7a0[_0x0c6c('0x25')]);return db['FaxQueue'][_0x0c6c('0x26')](_0x200a47);})[_0x0c6c('0x17')](function(_0x5ec5bc){_0x99b725[_0x0c6c('0x27')]=_0x5ec5bc;return _0x99b725;})['then'](respondWithFilteredResult(_0x63784f,_0x200a47))[_0x0c6c('0x28')](handleError(_0x63784f,null));};exports[_0x0c6c('0x29')]=function(_0x1240d5,_0xb2a3a2){var _0x368725={'raw':!![],'where':{'id':_0x1240d5[_0x0c6c('0x2a')]['id']}},_0x133670={};_0x133670[_0x0c6c('0x2b')]=_[_0x0c6c('0x2c')](db['FaxQueue']['rawAttributes']);_0x133670[_0x0c6c('0x25')]=_[_0x0c6c('0x2c')](_0x1240d5[_0x0c6c('0x25')]);_0x133670[_0x0c6c('0x2d')]=_[_0x0c6c('0x2e')](_0x133670[_0x0c6c('0x2b')],_0x133670['query']);_0x368725[_0x0c6c('0x2f')]=_['intersection'](_0x133670[_0x0c6c('0x2b')],qs['fields'](_0x1240d5[_0x0c6c('0x25')][_0x0c6c('0x30')]));_0x368725['attributes']=_0x368725['attributes'][_0x0c6c('0x31')]?_0x368725[_0x0c6c('0x2f')]:_0x133670[_0x0c6c('0x2b')];if(_0x1240d5[_0x0c6c('0x25')]['includeAll']){_0x368725[_0x0c6c('0x24')]=[{'all':!![]}];}_0x368725=_[_0x0c6c('0x32')]({},_0x368725,_0x1240d5['options']);return db[_0x0c6c('0x20')][_0x0c6c('0x33')](_0x368725)[_0x0c6c('0x17')](handleEntityNotFound(_0xb2a3a2,null))['then'](respondWithResult(_0xb2a3a2,null))[_0x0c6c('0x28')](handleError(_0xb2a3a2,null));};exports[_0x0c6c('0x34')]=function(_0xbf1a35,_0x93e98a){return db[_0x0c6c('0x20')][_0x0c6c('0x34')](_0xbf1a35[_0x0c6c('0x35')],{})[_0x0c6c('0x17')](function(_0x3b5cc1){var _0x371c0b=_0xbf1a35[_0x0c6c('0x36')][_0x0c6c('0x19')]({'plain':!![]});if(!_0x371c0b)throw new Error(_0x0c6c('0x37'));if(_0x371c0b[_0x0c6c('0x38')]===_0x0c6c('0x36')){var _0x1c70d8=_0x3b5cc1[_0x0c6c('0x19')]({'plain':!![]});var _0x3bf947=_0x0c6c('0x1a');return db[_0x0c6c('0x39')][_0x0c6c('0x33')]({'where':{'name':_0x3bf947,'userProfileId':_0x371c0b[_0x0c6c('0x3a')]},'raw':!![]})[_0x0c6c('0x17')](function(_0x39b640){if(_0x39b640&&_0x39b640[_0x0c6c('0x3b')]===0x0){return db[_0x0c6c('0x1b')]['create']({'name':_0x1c70d8[_0x0c6c('0x1d')],'resourceId':_0x1c70d8['id'],'type':_0x39b640[_0x0c6c('0x1d')],'sectionId':_0x39b640['id']},{})['then'](function(){return _0x3b5cc1;});}else{return _0x3b5cc1;}})[_0x0c6c('0x28')](function(_0x12278f){logger[_0x0c6c('0x3c')](_0x0c6c('0x3d'),_0x12278f);throw _0x12278f;});}return _0x3b5cc1;})[_0x0c6c('0x17')](respondWithResult(_0x93e98a,0xc9))[_0x0c6c('0x28')](handleError(_0x93e98a,null));};exports[_0x0c6c('0x3e')]=function(_0x485c32,_0x5cda22){if(_0x485c32[_0x0c6c('0x35')]['id']){delete _0x485c32[_0x0c6c('0x35')]['id'];}return db[_0x0c6c('0x20')][_0x0c6c('0x33')]({'where':{'id':_0x485c32[_0x0c6c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5cda22,null))[_0x0c6c('0x17')](saveUpdates(_0x485c32[_0x0c6c('0x35')],null))[_0x0c6c('0x17')](respondWithResult(_0x5cda22,null))[_0x0c6c('0x28')](handleError(_0x5cda22,null));};exports[_0x0c6c('0x18')]=function(_0x363b31,_0x1b8e62){return db['FaxQueue'][_0x0c6c('0x33')]({'where':{'id':_0x363b31[_0x0c6c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1b8e62,null))[_0x0c6c('0x17')](removeEntity(_0x1b8e62,null))['catch'](handleError(_0x1b8e62,null));};exports[_0x0c6c('0x3f')]=function(_0x2fcbca,_0x5aa32e){return db[_0x0c6c('0x20')][_0x0c6c('0x3f')]()[_0x0c6c('0x17')](respondWithResult(_0x5aa32e,null))['catch'](handleError(_0x5aa32e,null));};exports[_0x0c6c('0x40')]=function(_0x11c599,_0x22ddb0){var _0x1d7373={'raw':!![],'where':{}},_0x4ccf3a={},_0x5a7ceb;return db[_0x0c6c('0x20')][_0x0c6c('0x41')]({'where':{'id':_0x11c599[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x22ddb0,null))[_0x0c6c('0x17')](function(_0x29328c){if(_0x29328c){_0x5a7ceb=_0x29328c[_0x0c6c('0x19')]({'plain':!![]});_0x4ccf3a[_0x0c6c('0x2b')]=_[_0x0c6c('0x2c')](db['UserFaxQueue'][_0x0c6c('0x21')]);_0x4ccf3a[_0x0c6c('0x25')]=_[_0x0c6c('0x2c')](_0x11c599[_0x0c6c('0x25')]);_0x4ccf3a[_0x0c6c('0x2d')]=_[_0x0c6c('0x2e')](_0x4ccf3a[_0x0c6c('0x2b')],_0x4ccf3a[_0x0c6c('0x25')]);_0x1d7373[_0x0c6c('0x2f')]=_[_0x0c6c('0x2e')](_0x4ccf3a[_0x0c6c('0x2b')],qs[_0x0c6c('0x30')](_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x30')]));_0x1d7373['attributes']=_0x1d7373[_0x0c6c('0x2f')][_0x0c6c('0x31')]?_0x1d7373[_0x0c6c('0x2f')]:_0x4ccf3a['model'];if(!_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x42')](_0x0c6c('0x43'))){_0x1d7373[_0x0c6c('0x13')]=qs['limit'](_0x11c599[_0x0c6c('0x25')]['limit']);_0x1d7373[_0x0c6c('0x12')]=qs[_0x0c6c('0x12')](_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x12')]);}_0x1d7373['order']=qs[_0x0c6c('0x44')](_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x44')]);_0x1d7373['where']=qs[_0x0c6c('0x2d')](_[_0x0c6c('0x45')](_0x11c599[_0x0c6c('0x25')],_0x4ccf3a['filters']));_0x1d7373[_0x0c6c('0x46')][_0x0c6c('0x47')]=_0x29328c['id'];if(_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x48')]){_0x1d7373[_0x0c6c('0x46')]=_[_0x0c6c('0x32')](_0x1d7373[_0x0c6c('0x46')],{'$or':_[_0x0c6c('0x1f')](_0x1d7373['attributes'],function(_0x15ffbc){var _0x15a031={};_0x15a031[_0x15ffbc]={'$like':'%'+_0x11c599[_0x0c6c('0x25')][_0x0c6c('0x48')]+'%'};return _0x15a031;})});}_0x1d7373=_['merge']({},_0x1d7373,_0x11c599[_0x0c6c('0x49')]);return db[_0x0c6c('0x4a')][_0x0c6c('0x26')](_0x1d7373);}})[_0x0c6c('0x17')](function(_0x4fc0c6){if(_0x4fc0c6){return db[_0x0c6c('0x4b')][_0x0c6c('0x4c')]({'where':{'id':_['map'](_0x4fc0c6,_0x0c6c('0x4d')),'role':_0x0c6c('0x4e')},'attributes':['id',_0x0c6c('0x1d'),_0x0c6c('0x4f'),_0x0c6c('0x50'),_0x0c6c('0x51')]});}})['then'](function(_0x305462){if(_0x305462){return{'count':_0x305462[_0x0c6c('0x15')],'rows':_[_0x0c6c('0x1f')](_0x305462[_0x0c6c('0x27')],function(_0x2b10d0){return{'membername':_0x2b10d0[_0x0c6c('0x1d')],'UserId':_0x2b10d0['id'],'queue_name':_0x5a7ceb[_0x0c6c('0x1d')],'FaxQueueId':_0x5a7ceb['id'],'interface':util[_0x0c6c('0x52')](_0x0c6c('0x53'),_0x0c6c('0x54'),_0x2b10d0[_0x0c6c('0x1d')]),'penalty':0x0,'paused':_0x2b10d0[_0x0c6c('0x4f')],'createdAt':_0x2b10d0[_0x0c6c('0x51')],'updatedAt':_0x2b10d0[_0x0c6c('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0c6c('0x17')](respondWithFilteredResult(_0x22ddb0,_0x1d7373))['catch'](handleError(_0x22ddb0,null));};exports[_0x0c6c('0x55')]=function(_0x5ea10b,_0x420d8e){var _0x45e962={};var _0x4dfea9={};var _0x3ceed1;var _0x496670;return db[_0x0c6c('0x20')][_0x0c6c('0x41')]({'where':{'id':_0x5ea10b[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x420d8e,null))[_0x0c6c('0x17')](function(_0x409ce0){if(_0x409ce0){_0x3ceed1=_0x409ce0;_0x4dfea9[_0x0c6c('0x2b')]=_[_0x0c6c('0x2c')](db[_0x0c6c('0x56')]['rawAttributes']);_0x4dfea9[_0x0c6c('0x25')]=_[_0x0c6c('0x2c')](_0x5ea10b['query']);_0x4dfea9[_0x0c6c('0x2d')]=_[_0x0c6c('0x2e')](_0x4dfea9[_0x0c6c('0x2b')],_0x4dfea9[_0x0c6c('0x25')]);_0x45e962[_0x0c6c('0x2f')]=_['intersection'](_0x4dfea9[_0x0c6c('0x2b')],qs['fields'](_0x5ea10b[_0x0c6c('0x25')][_0x0c6c('0x30')]));_0x45e962[_0x0c6c('0x2f')]=_0x45e962[_0x0c6c('0x2f')]['length']?_0x45e962[_0x0c6c('0x2f')]:_0x4dfea9[_0x0c6c('0x2b')];_0x45e962['order']=qs[_0x0c6c('0x44')](_0x5ea10b[_0x0c6c('0x25')]['sort']);_0x45e962[_0x0c6c('0x46')]=qs[_0x0c6c('0x2d')](_[_0x0c6c('0x45')](_0x5ea10b['query'],_0x4dfea9['filters']));if(_0x5ea10b[_0x0c6c('0x25')][_0x0c6c('0x48')]){_0x45e962[_0x0c6c('0x46')]=_['merge'](_0x45e962['where'],{'$or':_[_0x0c6c('0x1f')](_0x45e962['attributes'],function(_0x1d2d2f){var _0x3a0934={};_0x3a0934[_0x1d2d2f]={'$like':'%'+_0x5ea10b[_0x0c6c('0x25')][_0x0c6c('0x48')]+'%'};return _0x3a0934;})});}_0x45e962=_[_0x0c6c('0x32')]({},_0x45e962,_0x5ea10b['options']);return _0x3ceed1['getTeams'](_0x45e962);}})[_0x0c6c('0x17')](function(_0x104b50){if(_0x104b50){_0x496670=_0x104b50[_0x0c6c('0x31')];if(!_0x5ea10b['query'][_0x0c6c('0x42')](_0x0c6c('0x43'))){_0x45e962[_0x0c6c('0x13')]=qs[_0x0c6c('0x13')](_0x5ea10b[_0x0c6c('0x25')]['limit']);_0x45e962[_0x0c6c('0x12')]=qs[_0x0c6c('0x12')](_0x5ea10b[_0x0c6c('0x25')][_0x0c6c('0x12')]);}return _0x3ceed1[_0x0c6c('0x55')](_0x45e962);}})[_0x0c6c('0x17')](function(_0x573870){if(_0x573870){return _0x573870?{'count':_0x496670,'rows':_0x573870}:null;}})['then'](respondWithResult(_0x420d8e,null))[_0x0c6c('0x28')](handleError(_0x420d8e,null));};exports[_0x0c6c('0x57')]=function(_0x14a61f,_0x272f0e){var _0x3eae02=_0x14a61f[_0x0c6c('0x35')]['ids'];return db[_0x0c6c('0x56')][_0x0c6c('0x26')]({'where':{'id':_0x3eae02},'attributes':['id'],'include':[{'model':db[_0x0c6c('0x4b')],'as':_0x0c6c('0x58'),'attributes':['id',_0x0c6c('0x1d'),'online','voicePause',_0x0c6c('0x59')],'raw':!![]}]})[_0x0c6c('0x17')](function(_0x3e13e5){if(_0x3e13e5){var _0x4b454c=_[_0x0c6c('0x5a')](_0x3e13e5,function(_0x936de4){var _0x22916a=_0x936de4[_0x0c6c('0x19')]({'plain':!![]});return _0x22916a[_0x0c6c('0x58')];});return db[_0x0c6c('0x20')][_0x0c6c('0x33')]({'where':{'id':_0x14a61f[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](function(_0x552c19){return db[_0x0c6c('0x5b')]['transaction'](function(_0x559ad0){return _0x552c19['addTeams'](_0x3eae02,{'transaction':_0x559ad0})[_0x0c6c('0x17')](function(){return BPromise[_0x0c6c('0x5c')](_0x4b454c,function(_0x354ca7){return db['UserFaxQueue'][_0x0c6c('0x5d')]({'where':{'UserId':_0x354ca7['id'],'FaxQueueId':_0x14a61f[_0x0c6c('0x2a')]['id']},'transaction':_0x559ad0});});})['then'](function(){_0x4b454c['forEach'](function(_0x3eb3e3){socket[_0x0c6c('0x5e')](_0x0c6c('0x5f'),{'UserId':_0x3eb3e3['id'],'FaxQueueId':_0x552c19['id']});});});});});}})['then'](respondWithStatusCode(_0x272f0e,null))[_0x0c6c('0x28')](handleError(_0x272f0e,null));};exports[_0x0c6c('0x60')]=function(_0x7481f0,_0x43e2c3){return db['Team']['findAll']({'where':{'id':_0x7481f0[_0x0c6c('0x25')][_0x0c6c('0x61')]},'attributes':['id'],'include':[{'model':db[_0x0c6c('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x43e2c3,null))[_0x0c6c('0x17')](function(_0x4c915d){var _0x42d681=_[_0x0c6c('0x1f')](_0x4c915d,'id');var _0x360f3c=[];var _0x43c18d=[];var _0x3178ac=squel[_0x0c6c('0x62')]();_0x3178ac[_0x0c6c('0x63')](_0x0c6c('0x64'))[_0x0c6c('0x65')]('team_has_fax_queues','tq')[_0x0c6c('0x66')](_0x0c6c('0x67'),'ut',_0x0c6c('0x68'))[_0x0c6c('0x46')](_0x0c6c('0x69'),_0x7481f0[_0x0c6c('0x2a')]['id']);for(var _0xb57dd2=0x0;_0xb57dd2<_0x4c915d[_0x0c6c('0x31')];_0xb57dd2+=0x1){let _0xba15f=_0x4c915d[_0xb57dd2];for(var _0x371550=0x0;_0x371550<_0xba15f[_0x0c6c('0x58')][_0x0c6c('0x31')];_0x371550+=0x1){let _0x3d10cf=_0xba15f[_0x0c6c('0x58')][_0x371550];var _0x1c6a4c=_0x3178ac[_0x0c6c('0x6a')]();_0x1c6a4c['where'](_0x0c6c('0x6b'),_0x3d10cf['id']);_0x43c18d[_0x0c6c('0x6c')](db['sequelize'][_0x0c6c('0x25')](_0x1c6a4c[_0x0c6c('0x6d')](),{'type':db[_0x0c6c('0x5b')][_0x0c6c('0x6e')][_0x0c6c('0x6f')]})[_0x0c6c('0x17')](function(_0x4dc47e){if(_0x4dc47e['length']===0x1){return _0x3d10cf['id'];}else{var _0x3492d5=_[_0x0c6c('0x70')](_[_0x0c6c('0x1f')](_0x4dc47e,_0x0c6c('0x71')),function(_0x5eea03){return _[_0x0c6c('0x72')](_0x42d681,_0x5eea03);});if(_0x3492d5){return _0x3d10cf['id'];}}}));}}return BPromise[_0x0c6c('0x73')](_0x43c18d)[_0x0c6c('0x17')](function(_0xd2cab6){_0x360f3c=_(_0x360f3c)['union'](_0xd2cab6)[_0x0c6c('0x74')]()[_0x0c6c('0x75')]();return db[_0x0c6c('0x20')]['find']({'where':{'id':_0x7481f0['params']['id']}})[_0x0c6c('0x17')](function(_0x31a33b){return db[_0x0c6c('0x5b')][_0x0c6c('0x76')](function(_0x1305e2){return _0x31a33b[_0x0c6c('0x60')](_0x7481f0[_0x0c6c('0x25')]['ids'],{'transaction':_0x1305e2})[_0x0c6c('0x17')](function(){if(!_['isEmpty'](_0x360f3c)){return _0x31a33b[_0x0c6c('0x77')](_0x360f3c,{'transaction':_0x1305e2});}})[_0x0c6c('0x17')](function(){_0x360f3c[_0x0c6c('0x78')](function(_0x45e0ef){socket[_0x0c6c('0x5e')](_0x0c6c('0x79'),{'UserId':_0x45e0ef,'FaxQueueId':_0x31a33b['id']});});});});});});})[_0x0c6c('0x17')](respondWithStatusCode(_0x43e2c3,null))['catch'](handleError(_0x43e2c3,null));};exports['addAgents']=function(_0x408737,_0x1eb534){return db['FaxQueue'][_0x0c6c('0x33')]({'where':{'id':_0x408737[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x1eb534,null))[_0x0c6c('0x17')](function(_0x48391b){if(_0x48391b){return _0x48391b[_0x0c6c('0x7a')](_0x408737['body'][_0x0c6c('0x61')],_[_0x0c6c('0x7b')](_0x408737[_0x0c6c('0x35')],[_0x0c6c('0x61'),'id'])||{})[_0x0c6c('0x7c')](function(_0x67e9d9){for(var _0x28b3e8=0x0;_0x28b3e8<_0x408737[_0x0c6c('0x35')][_0x0c6c('0x61')][_0x0c6c('0x31')];_0x28b3e8+=0x1){socket[_0x0c6c('0x5e')](_0x0c6c('0x5f'),{'UserId':Number(_0x408737[_0x0c6c('0x35')][_0x0c6c('0x61')][_0x28b3e8]),'FaxQueueId':Number(_0x408737[_0x0c6c('0x2a')]['id'])});}return _0x67e9d9;});}})[_0x0c6c('0x17')](respondWithResult(_0x1eb534,null))[_0x0c6c('0x28')](handleError(_0x1eb534,null));};exports[_0x0c6c('0x77')]=function(_0x5928a4,_0x4e4472){return db[_0x0c6c('0x20')]['find']({'where':{'id':_0x5928a4[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x4e4472,null))[_0x0c6c('0x17')](function(_0x474704){if(_0x474704){return _0x474704['removeAgents'](_0x5928a4[_0x0c6c('0x25')][_0x0c6c('0x61')])[_0x0c6c('0x17')](function(){if(_[_0x0c6c('0x7d')](_0x5928a4['query'][_0x0c6c('0x61')])){for(var _0x4b6cbb=0x0;_0x4b6cbb<_0x5928a4[_0x0c6c('0x25')]['ids'][_0x0c6c('0x31')];_0x4b6cbb+=0x1){socket[_0x0c6c('0x5e')](_0x0c6c('0x79'),{'UserId':Number(_0x5928a4[_0x0c6c('0x25')][_0x0c6c('0x61')][_0x4b6cbb]),'FaxQueueId':Number(_0x5928a4[_0x0c6c('0x2a')]['id'])});}}else{socket[_0x0c6c('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x5928a4[_0x0c6c('0x25')][_0x0c6c('0x61')]),'FaxQueueId':Number(_0x5928a4[_0x0c6c('0x2a')]['id'])});}});}})[_0x0c6c('0x17')](respondWithStatusCode(_0x4e4472,null))[_0x0c6c('0x28')](handleError(_0x4e4472,null));};exports['getAgents']=function(_0x692cc4,_0x1e325f){var _0x595c75={};var _0x133418={};var _0x4756f0;var _0x2a4fce;return db[_0x0c6c('0x20')][_0x0c6c('0x41')]({'where':{'id':_0x692cc4[_0x0c6c('0x2a')]['id']}})[_0x0c6c('0x17')](handleEntityNotFound(_0x1e325f,null))[_0x0c6c('0x17')](function(_0x3d4956){if(_0x3d4956){_0x4756f0=_0x3d4956;_0x133418[_0x0c6c('0x2b')]=_[_0x0c6c('0x2c')](db['User'][_0x0c6c('0x21')]);_0x133418[_0x0c6c('0x25')]=_[_0x0c6c('0x2c')](_0x692cc4['query']);_0x133418[_0x0c6c('0x2d')]=_[_0x0c6c('0x2e')](_0x133418[_0x0c6c('0x2b')],_0x133418['query']);_0x595c75['attributes']=_['intersection'](_0x133418[_0x0c6c('0x2b')],qs[_0x0c6c('0x30')](_0x692cc4[_0x0c6c('0x25')][_0x0c6c('0x30')]));_0x595c75['attributes']=_0x595c75[_0x0c6c('0x2f')]['length']?_0x595c75[_0x0c6c('0x2f')]:_0x133418['model'];_0x595c75[_0x0c6c('0x7e')]=qs[_0x0c6c('0x44')](_0x692cc4['query'][_0x0c6c('0x44')]);_0x595c75[_0x0c6c('0x46')]=qs[_0x0c6c('0x2d')](_[_0x0c6c('0x45')](_0x692cc4[_0x0c6c('0x25')],_0x133418['filters']));if(_0x692cc4['query']['filter']){_0x595c75['where']=_[_0x0c6c('0x32')](_0x595c75[_0x0c6c('0x46')],{'$or':_[_0x0c6c('0x1f')](_0x595c75['attributes'],function(_0x2778a9){var _0x2e47b2={};_0x2e47b2[_0x2778a9]={'$like':'%'+_0x692cc4[_0x0c6c('0x25')]['filter']+'%'};return _0x2e47b2;})});}_0x595c75=_[_0x0c6c('0x32')]({},_0x595c75,_0x692cc4['options']);return _0x4756f0[_0x0c6c('0x7f')](_0x595c75);}})[_0x0c6c('0x17')](function(_0x492e2c){if(_0x492e2c){_0x2a4fce=_0x492e2c['length'];if(!_0x692cc4[_0x0c6c('0x25')][_0x0c6c('0x42')](_0x0c6c('0x43'))){_0x595c75[_0x0c6c('0x13')]=qs['limit'](_0x692cc4[_0x0c6c('0x25')][_0x0c6c('0x13')]);_0x595c75[_0x0c6c('0x12')]=qs[_0x0c6c('0x12')](_0x692cc4[_0x0c6c('0x25')]['offset']);}return _0x4756f0[_0x0c6c('0x7f')](_0x595c75);}})['then'](function(_0x59f1de){if(_0x59f1de){return _0x59f1de?{'count':_0x2a4fce,'rows':_0x59f1de}:null;}})['then'](respondWithResult(_0x1e325f,null))['catch'](handleError(_0x1e325f,null));}; \ No newline at end of file +var _0xc9c3=['filter','Agents','online','voicePause','interface','sequelize','addTeams','each','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','all','union','transaction','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','update','then','destroy','get','FaxQueues','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','getOptions','count','include','findAll','catch','show','params','keys','query','filters','intersection','model','attributes','fields','includeAll','options','find','create','role','user','userProfileId','UserProfileResource','body','describe','findOne','UserFaxQueue','length','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','merge','User','findAndCountAll','UserId','agent','faxPause','updatedAt','rows','SIP','createdAt','getTeams','Team'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xc9c3,0x96));var _0x3c9c=function(_0x444dcf,_0x2f3d47){_0x444dcf=_0x444dcf-0x0;var _0x151bdf=_0xc9c3[_0x444dcf];return _0x151bdf;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3c9c('0x0'));var squel=require('squel');var Redis=require(_0x3c9c('0x1'));var qs=require(_0x3c9c('0x2'));var logger=require(_0x3c9c('0x3'))(_0x3c9c('0x4'));var config=require(_0x3c9c('0x5'));var db=require(_0x3c9c('0x6'))['db'];config[_0x3c9c('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3c9c('0x8'))(new Redis(config[_0x3c9c('0x7')]));require(_0x3c9c('0x9'))[_0x3c9c('0xa')](socket);function respondWithStatusCode(_0x3e5ccb,_0x355ef3){_0x355ef3=_0x355ef3||0xcc;return function(_0x33bf5b){if(_0x33bf5b){return _0x3e5ccb[_0x3c9c('0xb')](_0x355ef3);}return _0x3e5ccb[_0x3c9c('0xc')](_0x355ef3)[_0x3c9c('0xd')]();};}function respondWithResult(_0x50bdd1,_0x20ed5c){_0x20ed5c=_0x20ed5c||0xc8;return function(_0xc45f8b){if(_0xc45f8b){return _0x50bdd1['status'](_0x20ed5c)[_0x3c9c('0xe')](_0xc45f8b);}};}function respondWithFilteredResult(_0x4c6969,_0x12f832){return function(_0xff516c){if(_0xff516c){var _0x157c6c=typeof _0x12f832[_0x3c9c('0xf')]==='undefined'&&typeof _0x12f832['limit']==='undefined';var _0x857b1f=_0xff516c['count'];var _0x5e8c0e=_0x157c6c?0x0:_0x12f832['offset'];var _0x22c495=_0x157c6c?_0xff516c['count']:_0x12f832[_0x3c9c('0xf')]+_0x12f832[_0x3c9c('0x10')];var _0x1f725b;if(_0x22c495>=_0x857b1f){_0x22c495=_0x857b1f;_0x1f725b=0xc8;}else{_0x1f725b=0xce;}_0x4c6969[_0x3c9c('0xc')](_0x1f725b);return _0x4c6969['set'](_0x3c9c('0x11'),_0x5e8c0e+'-'+_0x22c495+'/'+_0x857b1f)['json'](_0xff516c);}return null;};}function saveUpdates(_0x558101){return function(_0x5a6b8a){if(_0x5a6b8a){return _0x5a6b8a[_0x3c9c('0x12')](_0x558101)[_0x3c9c('0x13')](function(_0x216fd8){return _0x216fd8;});}return null;};}function removeEntity(_0x3eee19){return function(_0x3e63e0){if(_0x3e63e0){return _0x3e63e0[_0x3c9c('0x14')]()[_0x3c9c('0x13')](function(){var _0x56fa79=_0x3e63e0[_0x3c9c('0x15')]({'plain':!![]});var _0x4c7122=_0x3c9c('0x16');return db['UserProfileResource'][_0x3c9c('0x14')]({'where':{'type':_0x4c7122,'resourceId':_0x56fa79['id']}})[_0x3c9c('0x13')](function(){return _0x3e63e0;});})['then'](function(){_0x3eee19[_0x3c9c('0xc')](0xcc)[_0x3c9c('0xd')]();});}};}function handleEntityNotFound(_0x1e52a4){return function(_0x50359a){if(!_0x50359a){_0x1e52a4[_0x3c9c('0xb')](0x194);}return _0x50359a;};}function handleError(_0x249747,_0x2d5ffc){_0x2d5ffc=_0x2d5ffc||0x1f4;return function(_0x937abf){logger[_0x3c9c('0x17')](_0x937abf[_0x3c9c('0x18')]);if(_0x937abf[_0x3c9c('0x19')]){delete _0x937abf[_0x3c9c('0x19')];}_0x249747['status'](_0x2d5ffc)[_0x3c9c('0x1a')](_0x937abf);};}exports['index']=function(_0x497145,_0xe04fca){var _0x4ca078={};var _0x527bb9={'count':0x0,'rows':[]};var _0x379880=_[_0x3c9c('0x1b')](db[_0x3c9c('0x1c')][_0x3c9c('0x1d')],function(_0x4c283d){return{'name':_0x4c283d[_0x3c9c('0x1e')],'type':_0x4c283d[_0x3c9c('0x1f')]['key']};});_0x4ca078=qs[_0x3c9c('0x20')](_0x379880,_0x497145);var _0x4c97a3={'where':_0x4ca078['where']};return db[_0x3c9c('0x1c')][_0x3c9c('0x21')](_0x4c97a3)[_0x3c9c('0x13')](function(_0x248de1){_0x527bb9[_0x3c9c('0x21')]=_0x248de1;_0x4ca078['include']=qs[_0x3c9c('0x22')](_0x497145['query']);return db[_0x3c9c('0x1c')][_0x3c9c('0x23')](_0x4ca078);})[_0x3c9c('0x13')](function(_0x10f439){_0x527bb9['rows']=_0x10f439;return _0x527bb9;})[_0x3c9c('0x13')](respondWithFilteredResult(_0xe04fca,_0x4ca078))[_0x3c9c('0x24')](handleError(_0xe04fca,null));};exports[_0x3c9c('0x25')]=function(_0x105e75,_0x7a3f45){var _0x2bb36e={'raw':!![],'where':{'id':_0x105e75[_0x3c9c('0x26')]['id']}},_0x314403={};_0x314403['model']=_[_0x3c9c('0x27')](db[_0x3c9c('0x1c')][_0x3c9c('0x1d')]);_0x314403[_0x3c9c('0x28')]=_[_0x3c9c('0x27')](_0x105e75[_0x3c9c('0x28')]);_0x314403[_0x3c9c('0x29')]=_[_0x3c9c('0x2a')](_0x314403[_0x3c9c('0x2b')],_0x314403[_0x3c9c('0x28')]);_0x2bb36e[_0x3c9c('0x2c')]=_[_0x3c9c('0x2a')](_0x314403[_0x3c9c('0x2b')],qs[_0x3c9c('0x2d')](_0x105e75['query'][_0x3c9c('0x2d')]));_0x2bb36e[_0x3c9c('0x2c')]=_0x2bb36e[_0x3c9c('0x2c')]['length']?_0x2bb36e[_0x3c9c('0x2c')]:_0x314403[_0x3c9c('0x2b')];if(_0x105e75[_0x3c9c('0x28')][_0x3c9c('0x2e')]){_0x2bb36e['include']=[{'all':!![]}];}_0x2bb36e=_['merge']({},_0x2bb36e,_0x105e75[_0x3c9c('0x2f')]);return db[_0x3c9c('0x1c')][_0x3c9c('0x30')](_0x2bb36e)['then'](handleEntityNotFound(_0x7a3f45,null))['then'](respondWithResult(_0x7a3f45,null))[_0x3c9c('0x24')](handleError(_0x7a3f45,null));};exports['create']=function(_0x5ace8e,_0x286d90){return db[_0x3c9c('0x1c')][_0x3c9c('0x31')](_0x5ace8e['body'],{})[_0x3c9c('0x13')](function(_0xe66d35){var _0x4024aa=_0x5ace8e['user']['get']({'plain':!![]});if(!_0x4024aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4024aa[_0x3c9c('0x32')]===_0x3c9c('0x33')){var _0xcb0d6f=_0xe66d35[_0x3c9c('0x15')]({'plain':!![]});var _0x1a2d31=_0x3c9c('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x1a2d31,'userProfileId':_0x4024aa[_0x3c9c('0x34')]},'raw':!![]})[_0x3c9c('0x13')](function(_0xe23844){if(_0xe23844&&_0xe23844['autoAssociation']===0x0){return db[_0x3c9c('0x35')][_0x3c9c('0x31')]({'name':_0xcb0d6f[_0x3c9c('0x19')],'resourceId':_0xcb0d6f['id'],'type':_0xe23844['name'],'sectionId':_0xe23844['id']},{})['then'](function(){return _0xe66d35;});}else{return _0xe66d35;}})[_0x3c9c('0x24')](function(_0xdbac2a){logger[_0x3c9c('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdbac2a);throw _0xdbac2a;});}return _0xe66d35;})[_0x3c9c('0x13')](respondWithResult(_0x286d90,0xc9))[_0x3c9c('0x24')](handleError(_0x286d90,null));};exports[_0x3c9c('0x12')]=function(_0x3dbfc7,_0x5be9a3){if(_0x3dbfc7[_0x3c9c('0x36')]['id']){delete _0x3dbfc7[_0x3c9c('0x36')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x3dbfc7[_0x3c9c('0x26')]['id']}})[_0x3c9c('0x13')](handleEntityNotFound(_0x5be9a3,null))['then'](saveUpdates(_0x3dbfc7[_0x3c9c('0x36')],null))[_0x3c9c('0x13')](respondWithResult(_0x5be9a3,null))[_0x3c9c('0x24')](handleError(_0x5be9a3,null));};exports[_0x3c9c('0x14')]=function(_0x40b45c,_0x45814d){return db['FaxQueue'][_0x3c9c('0x30')]({'where':{'id':_0x40b45c[_0x3c9c('0x26')]['id']}})[_0x3c9c('0x13')](handleEntityNotFound(_0x45814d,null))[_0x3c9c('0x13')](removeEntity(_0x45814d,null))[_0x3c9c('0x24')](handleError(_0x45814d,null));};exports['describe']=function(_0x5ef2be,_0x55a6ba){return db[_0x3c9c('0x1c')][_0x3c9c('0x37')]()[_0x3c9c('0x13')](respondWithResult(_0x55a6ba,null))[_0x3c9c('0x24')](handleError(_0x55a6ba,null));};exports['getMembers']=function(_0x798651,_0x1471c2){var _0x27a013={'raw':!![],'where':{}},_0x222ffa={},_0xcd7ebc;return db['FaxQueue'][_0x3c9c('0x38')]({'where':{'id':_0x798651[_0x3c9c('0x26')]['id']}})[_0x3c9c('0x13')](handleEntityNotFound(_0x1471c2,null))[_0x3c9c('0x13')](function(_0x55828d){if(_0x55828d){_0xcd7ebc=_0x55828d[_0x3c9c('0x15')]({'plain':!![]});_0x222ffa[_0x3c9c('0x2b')]=_['keys'](db[_0x3c9c('0x39')][_0x3c9c('0x1d')]);_0x222ffa[_0x3c9c('0x28')]=_[_0x3c9c('0x27')](_0x798651[_0x3c9c('0x28')]);_0x222ffa[_0x3c9c('0x29')]=_['intersection'](_0x222ffa[_0x3c9c('0x2b')],_0x222ffa[_0x3c9c('0x28')]);_0x27a013[_0x3c9c('0x2c')]=_[_0x3c9c('0x2a')](_0x222ffa[_0x3c9c('0x2b')],qs[_0x3c9c('0x2d')](_0x798651[_0x3c9c('0x28')][_0x3c9c('0x2d')]));_0x27a013[_0x3c9c('0x2c')]=_0x27a013[_0x3c9c('0x2c')][_0x3c9c('0x3a')]?_0x27a013[_0x3c9c('0x2c')]:_0x222ffa[_0x3c9c('0x2b')];if(!_0x798651[_0x3c9c('0x28')][_0x3c9c('0x3b')](_0x3c9c('0x3c'))){_0x27a013['limit']=qs['limit'](_0x798651['query'][_0x3c9c('0x10')]);_0x27a013[_0x3c9c('0xf')]=qs[_0x3c9c('0xf')](_0x798651[_0x3c9c('0x28')]['offset']);}_0x27a013[_0x3c9c('0x3d')]=qs['sort'](_0x798651['query'][_0x3c9c('0x3e')]);_0x27a013[_0x3c9c('0x3f')]=qs[_0x3c9c('0x29')](_[_0x3c9c('0x40')](_0x798651[_0x3c9c('0x28')],_0x222ffa[_0x3c9c('0x29')]));_0x27a013[_0x3c9c('0x3f')][_0x3c9c('0x41')]=_0x55828d['id'];if(_0x798651[_0x3c9c('0x28')]['filter']){_0x27a013[_0x3c9c('0x3f')]=_[_0x3c9c('0x42')](_0x27a013[_0x3c9c('0x3f')],{'$or':_[_0x3c9c('0x1b')](_0x27a013[_0x3c9c('0x2c')],function(_0x33bb86){var _0x356e9d={};_0x356e9d[_0x33bb86]={'$like':'%'+_0x798651['query']['filter']+'%'};return _0x356e9d;})});}_0x27a013=_[_0x3c9c('0x42')]({},_0x27a013,_0x798651[_0x3c9c('0x2f')]);return db[_0x3c9c('0x39')][_0x3c9c('0x23')](_0x27a013);}})[_0x3c9c('0x13')](function(_0x3fa4af){if(_0x3fa4af){return db[_0x3c9c('0x43')][_0x3c9c('0x44')]({'where':{'id':_[_0x3c9c('0x1b')](_0x3fa4af,_0x3c9c('0x45')),'role':_0x3c9c('0x46')},'attributes':['id',_0x3c9c('0x19'),_0x3c9c('0x47'),_0x3c9c('0x48'),'createdAt']});}})[_0x3c9c('0x13')](function(_0x4306fe){if(_0x4306fe){return{'count':_0x4306fe[_0x3c9c('0x21')],'rows':_[_0x3c9c('0x1b')](_0x4306fe[_0x3c9c('0x49')],function(_0x49c65d){return{'membername':_0x49c65d[_0x3c9c('0x19')],'UserId':_0x49c65d['id'],'queue_name':_0xcd7ebc[_0x3c9c('0x19')],'FaxQueueId':_0xcd7ebc['id'],'interface':util['format']('%s/%s',_0x3c9c('0x4a'),_0x49c65d[_0x3c9c('0x19')]),'penalty':0x0,'paused':_0x49c65d['faxPause'],'createdAt':_0x49c65d[_0x3c9c('0x4b')],'updatedAt':_0x49c65d[_0x3c9c('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3c9c('0x13')](respondWithFilteredResult(_0x1471c2,_0x27a013))[_0x3c9c('0x24')](handleError(_0x1471c2,null));};exports[_0x3c9c('0x4c')]=function(_0x2264b7,_0x2085a7){var _0x15bdd2={};var _0x114598={};var _0x142cef;var _0x249fb5;return db['FaxQueue'][_0x3c9c('0x38')]({'where':{'id':_0x2264b7['params']['id']}})['then'](handleEntityNotFound(_0x2085a7,null))[_0x3c9c('0x13')](function(_0x29b644){if(_0x29b644){_0x142cef=_0x29b644;_0x114598[_0x3c9c('0x2b')]=_[_0x3c9c('0x27')](db[_0x3c9c('0x4d')][_0x3c9c('0x1d')]);_0x114598[_0x3c9c('0x28')]=_['keys'](_0x2264b7[_0x3c9c('0x28')]);_0x114598[_0x3c9c('0x29')]=_[_0x3c9c('0x2a')](_0x114598[_0x3c9c('0x2b')],_0x114598[_0x3c9c('0x28')]);_0x15bdd2['attributes']=_['intersection'](_0x114598[_0x3c9c('0x2b')],qs[_0x3c9c('0x2d')](_0x2264b7[_0x3c9c('0x28')][_0x3c9c('0x2d')]));_0x15bdd2[_0x3c9c('0x2c')]=_0x15bdd2[_0x3c9c('0x2c')][_0x3c9c('0x3a')]?_0x15bdd2[_0x3c9c('0x2c')]:_0x114598[_0x3c9c('0x2b')];_0x15bdd2[_0x3c9c('0x3d')]=qs[_0x3c9c('0x3e')](_0x2264b7[_0x3c9c('0x28')][_0x3c9c('0x3e')]);_0x15bdd2[_0x3c9c('0x3f')]=qs[_0x3c9c('0x29')](_[_0x3c9c('0x40')](_0x2264b7[_0x3c9c('0x28')],_0x114598['filters']));if(_0x2264b7[_0x3c9c('0x28')]['filter']){_0x15bdd2['where']=_[_0x3c9c('0x42')](_0x15bdd2[_0x3c9c('0x3f')],{'$or':_[_0x3c9c('0x1b')](_0x15bdd2['attributes'],function(_0x16fb96){var _0x237c12={};_0x237c12[_0x16fb96]={'$like':'%'+_0x2264b7['query'][_0x3c9c('0x4e')]+'%'};return _0x237c12;})});}_0x15bdd2=_[_0x3c9c('0x42')]({},_0x15bdd2,_0x2264b7['options']);return _0x142cef['getTeams'](_0x15bdd2);}})['then'](function(_0x1e93d7){if(_0x1e93d7){_0x249fb5=_0x1e93d7[_0x3c9c('0x3a')];if(!_0x2264b7[_0x3c9c('0x28')][_0x3c9c('0x3b')]('nolimit')){_0x15bdd2['limit']=qs[_0x3c9c('0x10')](_0x2264b7[_0x3c9c('0x28')][_0x3c9c('0x10')]);_0x15bdd2[_0x3c9c('0xf')]=qs[_0x3c9c('0xf')](_0x2264b7[_0x3c9c('0x28')][_0x3c9c('0xf')]);}return _0x142cef[_0x3c9c('0x4c')](_0x15bdd2);}})[_0x3c9c('0x13')](function(_0x5ea67c){if(_0x5ea67c){return _0x5ea67c?{'count':_0x249fb5,'rows':_0x5ea67c}:null;}})['then'](respondWithResult(_0x2085a7,null))[_0x3c9c('0x24')](handleError(_0x2085a7,null));};exports['addTeams']=function(_0x52ca43,_0x4decf3){var _0x20b361=_0x52ca43[_0x3c9c('0x36')]['ids'];return db['Team'][_0x3c9c('0x23')]({'where':{'id':_0x20b361},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3c9c('0x4f'),'attributes':['id','name',_0x3c9c('0x50'),_0x3c9c('0x51'),_0x3c9c('0x52')],'raw':!![]}]})['then'](function(_0x4c0093){if(_0x4c0093){var _0x27c3f9=_['flatMap'](_0x4c0093,function(_0x1d2c9d){var _0x369025=_0x1d2c9d[_0x3c9c('0x15')]({'plain':!![]});return _0x369025[_0x3c9c('0x4f')];});return db['FaxQueue'][_0x3c9c('0x30')]({'where':{'id':_0x52ca43[_0x3c9c('0x26')]['id']}})['then'](function(_0xb0690f){return db[_0x3c9c('0x53')]['transaction'](function(_0x126cd8){return _0xb0690f[_0x3c9c('0x54')](_0x20b361,{'transaction':_0x126cd8})['then'](function(){return BPromise[_0x3c9c('0x55')](_0x27c3f9,function(_0x34b122){return db[_0x3c9c('0x39')]['findOrCreate']({'where':{'UserId':_0x34b122['id'],'FaxQueueId':_0x52ca43['params']['id']},'transaction':_0x126cd8});});})[_0x3c9c('0x13')](function(){_0x27c3f9[_0x3c9c('0x56')](function(_0x47fb30){socket[_0x3c9c('0x57')](_0x3c9c('0x58'),{'UserId':_0x47fb30['id'],'FaxQueueId':_0xb0690f['id']});});});});});}})[_0x3c9c('0x13')](respondWithStatusCode(_0x4decf3,null))['catch'](handleError(_0x4decf3,null));};exports[_0x3c9c('0x59')]=function(_0xbc89d0,_0x51b640){return db[_0x3c9c('0x4d')][_0x3c9c('0x23')]({'where':{'id':_0xbc89d0[_0x3c9c('0x28')][_0x3c9c('0x5a')]},'attributes':['id'],'include':[{'model':db[_0x3c9c('0x43')],'as':_0x3c9c('0x4f'),'attributes':['id'],'raw':!![]}]})[_0x3c9c('0x13')](handleEntityNotFound(_0x51b640,null))[_0x3c9c('0x13')](function(_0x2511dc){var _0x167884=_['map'](_0x2511dc,'id');var _0xfbf00e=[];var _0x150a27=[];var _0x5e7d7c=squel[_0x3c9c('0x5b')]();_0x5e7d7c[_0x3c9c('0x5c')]('tq.TeamId')[_0x3c9c('0x5d')](_0x3c9c('0x5e'),'tq')[_0x3c9c('0x5f')](_0x3c9c('0x60'),'ut',_0x3c9c('0x61'))['where'](_0x3c9c('0x62'),_0xbc89d0[_0x3c9c('0x26')]['id']);for(var _0x3beed2=0x0;_0x3beed2<_0x2511dc[_0x3c9c('0x3a')];_0x3beed2+=0x1){let _0x186151=_0x2511dc[_0x3beed2];for(var _0x44a7fe=0x0;_0x44a7fe<_0x186151[_0x3c9c('0x4f')][_0x3c9c('0x3a')];_0x44a7fe+=0x1){let _0xd04930=_0x186151[_0x3c9c('0x4f')][_0x44a7fe];var _0x2f5cdc=_0x5e7d7c[_0x3c9c('0x63')]();_0x2f5cdc[_0x3c9c('0x3f')]('ut.UserId\x20=\x20?',_0xd04930['id']);_0x150a27[_0x3c9c('0x64')](db[_0x3c9c('0x53')]['query'](_0x2f5cdc[_0x3c9c('0x65')](),{'type':db[_0x3c9c('0x53')][_0x3c9c('0x66')]['SELECT']})[_0x3c9c('0x13')](function(_0x9ba6d){if(_0x9ba6d[_0x3c9c('0x3a')]===0x1){return _0xd04930['id'];}else{var _0x285ebc=_[_0x3c9c('0x67')](_[_0x3c9c('0x1b')](_0x9ba6d,'TeamId'),function(_0x3d5054){return _['includes'](_0x167884,_0x3d5054);});if(_0x285ebc){return _0xd04930['id'];}}}));}}return BPromise[_0x3c9c('0x68')](_0x150a27)['then'](function(_0x4950c3){_0xfbf00e=_(_0xfbf00e)[_0x3c9c('0x69')](_0x4950c3)['compact']()['value']();return db[_0x3c9c('0x1c')][_0x3c9c('0x30')]({'where':{'id':_0xbc89d0[_0x3c9c('0x26')]['id']}})[_0x3c9c('0x13')](function(_0x2f4e79){return db[_0x3c9c('0x53')][_0x3c9c('0x6a')](function(_0x4611a8){return _0x2f4e79[_0x3c9c('0x59')](_0xbc89d0[_0x3c9c('0x28')][_0x3c9c('0x5a')],{'transaction':_0x4611a8})['then'](function(){if(!_['isEmpty'](_0xfbf00e)){return _0x2f4e79[_0x3c9c('0x6b')](_0xfbf00e,{'transaction':_0x4611a8});}})['then'](function(){_0xfbf00e['forEach'](function(_0x3bb0c1){socket[_0x3c9c('0x57')](_0x3c9c('0x6c'),{'UserId':_0x3bb0c1,'FaxQueueId':_0x2f4e79['id']});});});});});});})[_0x3c9c('0x13')](respondWithStatusCode(_0x51b640,null))[_0x3c9c('0x24')](handleError(_0x51b640,null));};exports['addAgents']=function(_0x105e67,_0x36d4da){return db['FaxQueue']['find']({'where':{'id':_0x105e67[_0x3c9c('0x26')]['id']}})['then'](handleEntityNotFound(_0x36d4da,null))[_0x3c9c('0x13')](function(_0x1ceaa3){if(_0x1ceaa3){return _0x1ceaa3[_0x3c9c('0x6d')](_0x105e67[_0x3c9c('0x36')][_0x3c9c('0x5a')],_[_0x3c9c('0x6e')](_0x105e67[_0x3c9c('0x36')],[_0x3c9c('0x5a'),'id'])||{})[_0x3c9c('0x6f')](function(_0x316f0c){for(var _0x52af3a=0x0;_0x52af3a<_0x105e67[_0x3c9c('0x36')][_0x3c9c('0x5a')][_0x3c9c('0x3a')];_0x52af3a+=0x1){socket[_0x3c9c('0x57')]('userFaxQueue:save',{'UserId':Number(_0x105e67[_0x3c9c('0x36')]['ids'][_0x52af3a]),'FaxQueueId':Number(_0x105e67[_0x3c9c('0x26')]['id'])});}return _0x316f0c;});}})[_0x3c9c('0x13')](respondWithResult(_0x36d4da,null))['catch'](handleError(_0x36d4da,null));};exports[_0x3c9c('0x6b')]=function(_0x4cd7b9,_0x49559f){return db[_0x3c9c('0x1c')][_0x3c9c('0x30')]({'where':{'id':_0x4cd7b9[_0x3c9c('0x26')]['id']}})[_0x3c9c('0x13')](handleEntityNotFound(_0x49559f,null))[_0x3c9c('0x13')](function(_0x5c96ad){if(_0x5c96ad){return _0x5c96ad[_0x3c9c('0x6b')](_0x4cd7b9['query'][_0x3c9c('0x5a')])['then'](function(){if(_[_0x3c9c('0x70')](_0x4cd7b9[_0x3c9c('0x28')][_0x3c9c('0x5a')])){for(var _0x19db8a=0x0;_0x19db8a<_0x4cd7b9[_0x3c9c('0x28')][_0x3c9c('0x5a')][_0x3c9c('0x3a')];_0x19db8a+=0x1){socket[_0x3c9c('0x57')]('userFaxQueue:remove',{'UserId':Number(_0x4cd7b9[_0x3c9c('0x28')][_0x3c9c('0x5a')][_0x19db8a]),'FaxQueueId':Number(_0x4cd7b9[_0x3c9c('0x26')]['id'])});}}else{socket['emit'](_0x3c9c('0x6c'),{'UserId':Number(_0x4cd7b9[_0x3c9c('0x28')][_0x3c9c('0x5a')]),'FaxQueueId':Number(_0x4cd7b9[_0x3c9c('0x26')]['id'])});}});}})[_0x3c9c('0x13')](respondWithStatusCode(_0x49559f,null))[_0x3c9c('0x24')](handleError(_0x49559f,null));};exports['getAgents']=function(_0x10b6b9,_0x2ba1f1){var _0x2e158c={};var _0x368c7e={};var _0x570fcc;var _0x39e04c;return db[_0x3c9c('0x1c')][_0x3c9c('0x38')]({'where':{'id':_0x10b6b9['params']['id']}})['then'](handleEntityNotFound(_0x2ba1f1,null))[_0x3c9c('0x13')](function(_0x3add11){if(_0x3add11){_0x570fcc=_0x3add11;_0x368c7e[_0x3c9c('0x2b')]=_[_0x3c9c('0x27')](db[_0x3c9c('0x43')][_0x3c9c('0x1d')]);_0x368c7e[_0x3c9c('0x28')]=_[_0x3c9c('0x27')](_0x10b6b9[_0x3c9c('0x28')]);_0x368c7e[_0x3c9c('0x29')]=_[_0x3c9c('0x2a')](_0x368c7e[_0x3c9c('0x2b')],_0x368c7e['query']);_0x2e158c['attributes']=_[_0x3c9c('0x2a')](_0x368c7e[_0x3c9c('0x2b')],qs[_0x3c9c('0x2d')](_0x10b6b9[_0x3c9c('0x28')][_0x3c9c('0x2d')]));_0x2e158c[_0x3c9c('0x2c')]=_0x2e158c[_0x3c9c('0x2c')]['length']?_0x2e158c['attributes']:_0x368c7e[_0x3c9c('0x2b')];_0x2e158c['order']=qs[_0x3c9c('0x3e')](_0x10b6b9[_0x3c9c('0x28')][_0x3c9c('0x3e')]);_0x2e158c[_0x3c9c('0x3f')]=qs['filters'](_[_0x3c9c('0x40')](_0x10b6b9[_0x3c9c('0x28')],_0x368c7e[_0x3c9c('0x29')]));if(_0x10b6b9[_0x3c9c('0x28')][_0x3c9c('0x4e')]){_0x2e158c[_0x3c9c('0x3f')]=_['merge'](_0x2e158c['where'],{'$or':_[_0x3c9c('0x1b')](_0x2e158c[_0x3c9c('0x2c')],function(_0x14ad48){var _0x11653b={};_0x11653b[_0x14ad48]={'$like':'%'+_0x10b6b9[_0x3c9c('0x28')][_0x3c9c('0x4e')]+'%'};return _0x11653b;})});}_0x2e158c=_['merge']({},_0x2e158c,_0x10b6b9[_0x3c9c('0x2f')]);return _0x570fcc[_0x3c9c('0x71')](_0x2e158c);}})[_0x3c9c('0x13')](function(_0x3f9856){if(_0x3f9856){_0x39e04c=_0x3f9856['length'];if(!_0x10b6b9[_0x3c9c('0x28')]['hasOwnProperty']('nolimit')){_0x2e158c[_0x3c9c('0x10')]=qs['limit'](_0x10b6b9[_0x3c9c('0x28')][_0x3c9c('0x10')]);_0x2e158c['offset']=qs[_0x3c9c('0xf')](_0x10b6b9[_0x3c9c('0x28')][_0x3c9c('0xf')]);}return _0x570fcc[_0x3c9c('0x71')](_0x2e158c);}})[_0x3c9c('0x13')](function(_0x4bd1fe){if(_0x4bd1fe){return _0x4bd1fe?{'count':_0x39e04c,'rows':_0x4bd1fe}:null;}})['then'](respondWithResult(_0x2ba1f1,null))[_0x3c9c('0x24')](handleError(_0x2ba1f1,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9d61559..97c1977 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 _0x591f=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x591f,0x167));var _0xf591=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x591f[_0x49d19d];return _0x4ebef1;};'use strict';var EventEmitter=require(_0xf591('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf591('0x1')](0x0);var events={'afterCreate':_0xf591('0x2'),'afterUpdate':'update','afterDestroy':_0xf591('0x3')};function emitEvent(_0x1da401){return function(_0x2ec790,_0xe5d14a,_0x43e7af){FaxQueueEvents[_0xf591('0x4')](_0x1da401+':'+_0x2ec790['id'],_0x2ec790);FaxQueueEvents[_0xf591('0x4')](_0x1da401,_0x2ec790);_0x43e7af(null);};}for(var e in events){if(events[_0xf591('0x5')](e)){var event=events[e];FaxQueue[_0xf591('0x6')](e,emitEvent(event));}}module[_0xf591('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xf310=['hook','exports','events','setMaxListeners','update','emit'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xf310,0xe6));var _0x0f31=function(_0x1ddec2,_0x140438){_0x1ddec2=_0x1ddec2-0x0;var _0x439471=_0xf310[_0x1ddec2];return _0x439471;};'use strict';var EventEmitter=require(_0x0f31('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0f31('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f31('0x2'),'afterDestroy':'remove'};function emitEvent(_0x525dc9){return function(_0x4bb93c,_0x1fdd54,_0x1087b5){FaxQueueEvents[_0x0f31('0x3')](_0x525dc9+':'+_0x4bb93c['id'],_0x4bb93c);FaxQueueEvents[_0x0f31('0x3')](_0x525dc9,_0x4bb93c);_0x1087b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x0f31('0x4')](e,emitEvent(event));}}module[_0x0f31('0x5')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index b821106..2b010b0 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 _0xa2f4=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x4b02d0,_0x5b1795){var _0x2ec3cc=function(_0xad8930){while(--_0xad8930){_0x4b02d0['push'](_0x4b02d0['shift']());}};_0x2ec3cc(++_0x5b1795);}(_0xa2f4,0x15d));var _0x4a2f=function(_0xb49cb8,_0x39474b){_0xb49cb8=_0xb49cb8-0x0;var _0x879ead=_0xa2f4[_0xb49cb8];return _0x879ead;};'use strict';var _=require(_0x4a2f('0x0'));var util=require(_0x4a2f('0x1'));var logger=require(_0x4a2f('0x2'))(_0x4a2f('0x3'));var moment=require(_0x4a2f('0x4'));var BPromise=require(_0x4a2f('0x5'));var rp=require(_0x4a2f('0x6'));var fs=require('fs');var path=require(_0x4a2f('0x7'));var rimraf=require(_0x4a2f('0x8'));var config=require(_0x4a2f('0x9'));var attributes=require(_0x4a2f('0xa'));module[_0x4a2f('0xb')]=function(_0x580082,_0x2f7d09){return _0x580082[_0x4a2f('0xc')](_0x4a2f('0xd'),attributes,{'tableName':_0x4a2f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd452=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxQueue','fax_queues'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0xd452,0x1ec));var _0x2d45=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xd452[_0xc69f39];return _0x93be41;};'use strict';var _=require(_0x2d45('0x0'));var util=require(_0x2d45('0x1'));var logger=require(_0x2d45('0x2'))('api');var moment=require(_0x2d45('0x3'));var BPromise=require(_0x2d45('0x4'));var rp=require(_0x2d45('0x5'));var fs=require('fs');var path=require(_0x2d45('0x6'));var rimraf=require(_0x2d45('0x7'));var config=require(_0x2d45('0x8'));var attributes=require('./faxQueue.attributes');module[_0x2d45('0x9')]=function(_0x501ecc,_0x36269c){return _0x501ecc['define'](_0x2d45('0xa'),attributes,{'tableName':_0x2d45('0xb'),'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 25a8897..2afce16 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 _0xd6d8=['catch','FaxQueue','findAll','options','raw','attributes','limit','map','include','model','then','GetFaxQueue','stringify','ShowFaxQueue','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','request','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxQueue,\x20%s,\x20%s','message','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6d8,0x1f0));var _0x8d6d=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0xd6d8[_0x1ee5be];return _0x177140;};'use strict';var _=require(_0x8d6d('0x0'));var util=require('util');var moment=require(_0x8d6d('0x1'));var BPromise=require(_0x8d6d('0x2'));var rs=require(_0x8d6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d6d('0x4'))['db'];var utils=require(_0x8d6d('0x5'));var logger=require(_0x8d6d('0x6'))('rpc');var config=require(_0x8d6d('0x7'));var jayson=require(_0x8d6d('0x8'));var client=jayson['client'][_0x8d6d('0x9')]({'port':0x232a});config[_0x8d6d('0xa')]=_['defaults'](config[_0x8d6d('0xa')],{'host':_0x8d6d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1607af,_0x39d67b,_0x1d9ce7){return new BPromise(function(_0x35a0cd,_0x19f174){return client[_0x8d6d('0xc')](_0x1607af,_0x1d9ce7)['then'](function(_0x224bf0){logger[_0x8d6d('0xd')]('FaxQueue,\x20%s,\x20%s',_0x39d67b,'request\x20sent');logger[_0x8d6d('0xe')](_0x8d6d('0xf'),_0x39d67b,_0x8d6d('0x10'),JSON['stringify'](_0x224bf0));if(_0x224bf0['error']){if(_0x224bf0[_0x8d6d('0x11')][_0x8d6d('0x12')]===0x1f4){logger[_0x8d6d('0x11')](_0x8d6d('0x13'),_0x39d67b,_0x224bf0['error'][_0x8d6d('0x14')]);return _0x19f174(_0x224bf0[_0x8d6d('0x11')]['message']);}logger[_0x8d6d('0x11')](_0x8d6d('0x13'),_0x39d67b,_0x224bf0[_0x8d6d('0x11')][_0x8d6d('0x14')]);return _0x35a0cd(_0x224bf0[_0x8d6d('0x11')][_0x8d6d('0x14')]);}else{logger[_0x8d6d('0xd')](_0x8d6d('0x13'),_0x39d67b,'request\x20sent');_0x35a0cd(_0x224bf0[_0x8d6d('0x15')][_0x8d6d('0x14')]);}})[_0x8d6d('0x16')](function(_0x240d89){logger[_0x8d6d('0x11')](_0x8d6d('0x13'),_0x39d67b,_0x240d89);_0x19f174(_0x240d89);});});}exports['GetFaxQueue']=function(_0x26cecd){var _0x595114=this;return new Promise(function(_0x541ebc,_0x282a62){return db[_0x8d6d('0x17')][_0x8d6d('0x18')]({'raw':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd[_0x8d6d('0x19')][_0x8d6d('0x1a')]===undefined?!![]:![]:!![],'where':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd[_0x8d6d('0x19')]['where']||null:null,'attributes':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd['options'][_0x8d6d('0x1b')]||null:null,'limit':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd[_0x8d6d('0x19')][_0x8d6d('0x1c')]||null:null,'include':_0x26cecd[_0x8d6d('0x19')]?_0x26cecd[_0x8d6d('0x19')]['include']?_[_0x8d6d('0x1d')](_0x26cecd[_0x8d6d('0x19')][_0x8d6d('0x1e')],function(_0x3e6fbe){return{'model':db[_0x3e6fbe[_0x8d6d('0x1f')]],'as':_0x3e6fbe['as'],'attributes':_0x3e6fbe[_0x8d6d('0x1b')],'include':_0x3e6fbe['include']?_[_0x8d6d('0x1d')](_0x3e6fbe[_0x8d6d('0x1e')],function(_0x24a447){return{'model':db[_0x24a447[_0x8d6d('0x1f')]],'as':_0x24a447['as'],'attributes':_0x24a447[_0x8d6d('0x1b')],'include':_0x24a447['include']?_['map'](_0x24a447[_0x8d6d('0x1e')],function(_0x162492){return{'model':db[_0x162492[_0x8d6d('0x1f')]],'as':_0x162492['as'],'attributes':_0x162492[_0x8d6d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8d6d('0x20')](function(_0x35e8dc){logger[_0x8d6d('0xd')](_0x8d6d('0x21'),_0x26cecd);logger[_0x8d6d('0xe')](_0x8d6d('0x21'),_0x26cecd,JSON[_0x8d6d('0x22')](_0x35e8dc));_0x541ebc(_0x35e8dc);})['catch'](function(_0x4cc94f){logger['error'](_0x8d6d('0x21'),_0x4cc94f[_0x8d6d('0x14')],_0x26cecd);_0x282a62(_0x595114[_0x8d6d('0x11')](0x1f4,_0x4cc94f['message']));});});};exports[_0x8d6d('0x23')]=function(_0x2e3248){var _0x46b248=this;return new Promise(function(_0xecff29,_0x3dfe8f){return db[_0x8d6d('0x17')]['find']({'raw':_0x2e3248['options']?_0x2e3248['options'][_0x8d6d('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e3248[_0x8d6d('0x19')]?_0x2e3248['options'][_0x8d6d('0x24')]||null:null,'attributes':_0x2e3248['options']?_0x2e3248[_0x8d6d('0x19')][_0x8d6d('0x1b')]||null:null,'include':_0x2e3248[_0x8d6d('0x19')]?_0x2e3248[_0x8d6d('0x19')][_0x8d6d('0x1e')]?_[_0x8d6d('0x1d')](_0x2e3248[_0x8d6d('0x19')][_0x8d6d('0x1e')],function(_0x126240){return{'model':db[_0x126240[_0x8d6d('0x1f')]],'as':_0x126240['as'],'attributes':_0x126240[_0x8d6d('0x1b')],'include':_0x126240['include']?_[_0x8d6d('0x1d')](_0x126240[_0x8d6d('0x1e')],function(_0x120cca){return{'model':db[_0x120cca[_0x8d6d('0x1f')]],'as':_0x120cca['as'],'attributes':_0x120cca[_0x8d6d('0x1b')],'include':_0x120cca['include']?_[_0x8d6d('0x1d')](_0x120cca[_0x8d6d('0x1e')],function(_0x2924c5){return{'model':db[_0x2924c5[_0x8d6d('0x1f')]],'as':_0x2924c5['as'],'attributes':_0x2924c5[_0x8d6d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8d6d('0x20')](function(_0x3ebc36){logger[_0x8d6d('0xd')](_0x8d6d('0x23'),_0x2e3248);logger[_0x8d6d('0xe')](_0x8d6d('0x23'),_0x2e3248,JSON['stringify'](_0x3ebc36));_0xecff29(_0x3ebc36);})['catch'](function(_0x4f5502){logger['error'](_0x8d6d('0x23'),_0x4f5502[_0x8d6d('0x14')],_0x2e3248);_0x3dfe8f(_0x46b248[_0x8d6d('0x11')](0x1f4,_0x4f5502[_0x8d6d('0x14')]));});});}; \ No newline at end of file +var _0xdadb=['../../config/environment','client','http','redis','defaults','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowFaxQueue','util','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x3162c4,_0x205a75){var _0x48f5a9=function(_0x3ba125){while(--_0x3ba125){_0x3162c4['push'](_0x3162c4['shift']());}};_0x48f5a9(++_0x205a75);}(_0xdadb,0x10b));var _0xbdad=function(_0x3e7e54,_0x2c282b){_0x3e7e54=_0x3e7e54-0x0;var _0x225b8e=_0xdadb[_0x3e7e54];return _0x225b8e;};'use strict';var _=require('lodash');var util=require(_0xbdad('0x0'));var moment=require('moment');var BPromise=require(_0xbdad('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdad('0x2'));var db=require(_0xbdad('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbdad('0x4'));var config=require(_0xbdad('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xbdad('0x6')][_0xbdad('0x7')]({'port':0x232a});config[_0xbdad('0x8')]=_[_0xbdad('0x9')](config[_0xbdad('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdad('0x8')]));require(_0xbdad('0xa'))['register'](socket);function respondWithRpcPromise(_0x4d7b02,_0x2ac568,_0x10a850){return new BPromise(function(_0x110843,_0x28dda7){return client[_0xbdad('0xb')](_0x4d7b02,_0x10a850)[_0xbdad('0xc')](function(_0x1194eb){logger['info'](_0xbdad('0xd'),_0x2ac568,_0xbdad('0xe'));logger[_0xbdad('0xf')](_0xbdad('0x10'),_0x2ac568,'request\x20sent',JSON['stringify'](_0x1194eb));if(_0x1194eb['error']){if(_0x1194eb[_0xbdad('0x11')][_0xbdad('0x12')]===0x1f4){logger[_0xbdad('0x11')]('FaxQueue,\x20%s,\x20%s',_0x2ac568,_0x1194eb[_0xbdad('0x11')]['message']);return _0x28dda7(_0x1194eb['error'][_0xbdad('0x13')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x2ac568,_0x1194eb[_0xbdad('0x11')][_0xbdad('0x13')]);return _0x110843(_0x1194eb['error'][_0xbdad('0x13')]);}else{logger[_0xbdad('0x14')]('FaxQueue,\x20%s,\x20%s',_0x2ac568,_0xbdad('0xe'));_0x110843(_0x1194eb['result']['message']);}})[_0xbdad('0x15')](function(_0x2215a5){logger[_0xbdad('0x11')](_0xbdad('0xd'),_0x2ac568,_0x2215a5);_0x28dda7(_0x2215a5);});});}exports[_0xbdad('0x16')]=function(_0x9d9657){var _0x1c3c3d=this;return new Promise(function(_0x4def11,_0x522d4a){return db[_0xbdad('0x17')][_0xbdad('0x18')]({'raw':_0x9d9657[_0xbdad('0x19')]?_0x9d9657[_0xbdad('0x19')][_0xbdad('0x1a')]===undefined?!![]:![]:!![],'where':_0x9d9657[_0xbdad('0x19')]?_0x9d9657[_0xbdad('0x19')]['where']||null:null,'attributes':_0x9d9657[_0xbdad('0x19')]?_0x9d9657[_0xbdad('0x19')][_0xbdad('0x1b')]||null:null,'limit':_0x9d9657['options']?_0x9d9657[_0xbdad('0x19')][_0xbdad('0x1c')]||null:null,'include':_0x9d9657[_0xbdad('0x19')]?_0x9d9657[_0xbdad('0x19')][_0xbdad('0x1d')]?_[_0xbdad('0x1e')](_0x9d9657['options']['include'],function(_0x5d961f){return{'model':db[_0x5d961f[_0xbdad('0x1f')]],'as':_0x5d961f['as'],'attributes':_0x5d961f['attributes'],'include':_0x5d961f[_0xbdad('0x1d')]?_['map'](_0x5d961f[_0xbdad('0x1d')],function(_0x41a9ec){return{'model':db[_0x41a9ec[_0xbdad('0x1f')]],'as':_0x41a9ec['as'],'attributes':_0x41a9ec['attributes'],'include':_0x41a9ec[_0xbdad('0x1d')]?_[_0xbdad('0x1e')](_0x41a9ec[_0xbdad('0x1d')],function(_0x37738c){return{'model':db[_0x37738c[_0xbdad('0x1f')]],'as':_0x37738c['as'],'attributes':_0x37738c['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdad('0xc')](function(_0x49cc67){logger['info'](_0xbdad('0x16'),_0x9d9657);logger[_0xbdad('0xf')]('GetFaxQueue',_0x9d9657,JSON[_0xbdad('0x20')](_0x49cc67));_0x4def11(_0x49cc67);})['catch'](function(_0xd17216){logger[_0xbdad('0x11')](_0xbdad('0x16'),_0xd17216[_0xbdad('0x13')],_0x9d9657);_0x522d4a(_0x1c3c3d[_0xbdad('0x11')](0x1f4,_0xd17216['message']));});});};exports[_0xbdad('0x21')]=function(_0x39c550){var _0x4ff0fe=this;return new Promise(function(_0x25af84,_0x23cbe6){return db[_0xbdad('0x17')]['find']({'raw':_0x39c550['options']?_0x39c550[_0xbdad('0x19')][_0xbdad('0x1a')]===undefined?!![]:![]:!![],'where':_0x39c550[_0xbdad('0x19')]?_0x39c550[_0xbdad('0x19')]['where']||null:null,'attributes':_0x39c550[_0xbdad('0x19')]?_0x39c550[_0xbdad('0x19')][_0xbdad('0x1b')]||null:null,'include':_0x39c550[_0xbdad('0x19')]?_0x39c550[_0xbdad('0x19')][_0xbdad('0x1d')]?_[_0xbdad('0x1e')](_0x39c550['options'][_0xbdad('0x1d')],function(_0x5d9d68){return{'model':db[_0x5d9d68[_0xbdad('0x1f')]],'as':_0x5d9d68['as'],'attributes':_0x5d9d68[_0xbdad('0x1b')],'include':_0x5d9d68[_0xbdad('0x1d')]?_['map'](_0x5d9d68[_0xbdad('0x1d')],function(_0x11e0a8){return{'model':db[_0x11e0a8['model']],'as':_0x11e0a8['as'],'attributes':_0x11e0a8[_0xbdad('0x1b')],'include':_0x11e0a8[_0xbdad('0x1d')]?_['map'](_0x11e0a8['include'],function(_0x39aaa6){return{'model':db[_0x39aaa6[_0xbdad('0x1f')]],'as':_0x39aaa6['as'],'attributes':_0x39aaa6[_0xbdad('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbdad('0xc')](function(_0x473b91){logger[_0xbdad('0x14')](_0xbdad('0x21'),_0x39c550);logger[_0xbdad('0xf')](_0xbdad('0x21'),_0x39c550,JSON[_0xbdad('0x20')](_0x473b91));_0x25af84(_0x473b91);})['catch'](function(_0x586553){logger['error'](_0xbdad('0x21'),_0x586553[_0xbdad('0x13')],_0x39c550);_0x23cbe6(_0x4ff0fe[_0xbdad('0x11')](0x1f4,_0x586553[_0xbdad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 697225c..bc7f93a 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 _0xa1f6=['save','remove','update','register','length','./faxQueue.events'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xa1f6[_0x305c31];return _0x17f39f;};'use strict';var FaxQueueEvents=require(_0x6a1f('0x0'));var events=[_0x6a1f('0x1'),_0x6a1f('0x2'),_0x6a1f('0x3')];function createListener(_0x198e14,_0x123ad4){return function(_0x5cf561){_0x123ad4['emit'](_0x198e14,_0x5cf561);};}function removeListener(_0x521944,_0x5d4ad7){return function(){FaxQueueEvents['removeListener'](_0x521944,_0x5d4ad7);};}exports[_0x6a1f('0x4')]=function(_0x426ae1){for(var _0xa1c928=0x0,_0x3a772b=events[_0x6a1f('0x5')];_0xa1c928<_0x3a772b;_0xa1c928++){var _0x3ecd63=events[_0xa1c928];var _0x36c00b=createListener('faxQueue:'+_0x3ecd63,_0x426ae1);FaxQueueEvents['on'](_0x3ecd63,_0x36c00b);}}; \ No newline at end of file +var _0x4939=['update','emit','removeListener','register','length','./faxQueue.events','save'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0x4939,0x1a9));var _0x9493=function(_0x3288ed,_0x5759a7){_0x3288ed=_0x3288ed-0x0;var _0x49f1e4=_0x4939[_0x3288ed];return _0x49f1e4;};'use strict';var FaxQueueEvents=require(_0x9493('0x0'));var events=[_0x9493('0x1'),'remove',_0x9493('0x2')];function createListener(_0x572cf0,_0x40a46e){return function(_0x7822c7){_0x40a46e[_0x9493('0x3')](_0x572cf0,_0x7822c7);};}function removeListener(_0x151fd2,_0x77b9e5){return function(){FaxQueueEvents[_0x9493('0x4')](_0x151fd2,_0x77b9e5);};}exports[_0x9493('0x5')]=function(_0x2acd57){for(var _0x35a176=0x0,_0x36c07f=events[_0x9493('0x6')];_0x35a176<_0x36c07f;_0x35a176++){var _0x4518b0=events[_0x35a176];var _0x33fa4a=createListener('faxQueue:'+_0x4518b0,_0x2acd57);FaxQueueEvents['on'](_0x4518b0,_0x33fa4a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 81356bb..47b3299 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 _0x5d17=['addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x5d17,0x114));var _0x75d1=function(_0x38cb7c,_0xf33f42){_0x38cb7c=_0x38cb7c-0x0;var _0x2a5f5e=_0x5d17[_0x38cb7c];return _0x2a5f5e;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x75d1('0xe')]);router[_0x75d1('0x8')]('/:id/teams',auth[_0x75d1('0xb')](),controller[_0x75d1('0xf')]);router[_0x75d1('0x8')](_0x75d1('0x10'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);router['post']('/',auth[_0x75d1('0xb')](),controller[_0x75d1('0x12')]);router[_0x75d1('0x13')](_0x75d1('0x14'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x75d1('0x10'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x15')]);router['put'](_0x75d1('0xd'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x16')]);router[_0x75d1('0x17')](_0x75d1('0xd'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x18')]);router[_0x75d1('0x17')](_0x75d1('0x14'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x19')]);router['delete']('/:id/users',auth[_0x75d1('0xb')](),controller[_0x75d1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xacf4=['describe','/:id/members','/:id/teams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','index','/describe','isAuthenticated'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xacf4,0xe7));var _0x4acf=function(_0x498f93,_0x255d50){_0x498f93=_0x498f93-0x0;var _0x4a2395=_0xacf4[_0x498f93];return _0x4a2395;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0x8')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['getMembers']);router[_0x4acf('0x8')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x4acf('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0xf')]);router[_0x4acf('0x10')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0x11')]);router[_0x4acf('0x10')](_0x4acf('0xe'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x12')]);router[_0x4acf('0x10')](_0x4acf('0x13'),auth[_0x4acf('0xb')](),controller['addAgents']);router[_0x4acf('0x14')]('/:id',auth[_0x4acf('0xb')](),controller[_0x4acf('0x15')]);router[_0x4acf('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4acf('0x17')]);router[_0x4acf('0x16')](_0x4acf('0xe'),auth['isAuthenticated'](),controller[_0x4acf('0x18')]);router[_0x4acf('0x16')](_0x4acf('0x13'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x19')]);module[_0x4acf('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5a0029a..224694c 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 _0xc677=['sequelize','exports','STRING','DATE','moment'];(function(_0x14a4f7,_0x3782c2){var _0x350768=function(_0x33b25f){while(--_0x33b25f){_0x14a4f7['push'](_0x14a4f7['shift']());}};_0x350768(++_0x3782c2);}(_0xc677,0x18a));var _0x7c67=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc677[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0x7c67('0x0'));var Sequelize=require(_0x7c67('0x1'));module[_0x7c67('0x2')]={'uniqueid':{'type':Sequelize[_0x7c67('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7c67('0x3')]},'joinAt':{'type':Sequelize[_0x7c67('0x4')]},'leaveAt':{'type':Sequelize[_0x7c67('0x4')]},'acceptAt':{'type':Sequelize[_0x7c67('0x4')]},'exitAt':{'type':Sequelize[_0x7c67('0x4')]},'reason':{'type':Sequelize[_0x7c67('0x3')]}}; \ No newline at end of file +var _0x91a6=['DATE','moment','sequelize','exports','STRING'];(function(_0x3a608c,_0x160c11){var _0x1131f6=function(_0x596020){while(--_0x596020){_0x3a608c['push'](_0x3a608c['shift']());}};_0x1131f6(++_0x160c11);}(_0x91a6,0x12d));var _0x691a=function(_0x2ed722,_0x1dca04){_0x2ed722=_0x2ed722-0x0;var _0x1cf828=_0x91a6[_0x2ed722];return _0x1cf828;};'use strict';var moment=require(_0x691a('0x0'));var Sequelize=require(_0x691a('0x1'));module[_0x691a('0x2')]={'uniqueid':{'type':Sequelize[_0x691a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x691a('0x4')]},'leaveAt':{'type':Sequelize[_0x691a('0x4')]},'acceptAt':{'type':Sequelize[_0x691a('0x4')]},'exitAt':{'type':Sequelize[_0x691a('0x4')]},'reason':{'type':Sequelize[_0x691a('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e28c152..97f5849 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 _0xb43b=['moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','name','status','send','index','map','FaxQueueReport','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','then','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2f8e01,_0x278674){var _0x5333e9=function(_0x1abd14){while(--_0x1abd14){_0x2f8e01['push'](_0x2f8e01['shift']());}};_0x5333e9(++_0x278674);}(_0xb43b,0x1b2));var _0xbb43=function(_0x373ec1,_0x59037b){_0x373ec1=_0x373ec1-0x0;var _0xec42f5=_0xb43b[_0x373ec1];return _0xec42f5;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={},_0x539730={},_0x2ad6da={'count':0x0,'rows':[]};var _0x56fe33=_[_0xbb43('0x2a')](db[_0xbb43('0x2b')][_0xbb43('0x2c')],function(_0x1880cd){return{'name':_0x1880cd['fieldName'],'type':_0x1880cd[_0xbb43('0x2d')]['key']};});_0x539730['model']=_['map'](_0x56fe33,_0xbb43('0x26'));_0x539730['query']=_[_0xbb43('0x2e')](_0x40b04b[_0xbb43('0x2f')]);_0x539730[_0xbb43('0x30')]=_['intersection'](_0x539730[_0xbb43('0x31')],_0x539730[_0xbb43('0x2f')]);_0x473828[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x539730[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x473828['attributes']=_0x473828[_0xbb43('0x32')][_0xbb43('0x35')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x31')];if(!_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x36')](_0xbb43('0x37'))){_0x473828[_0xbb43('0x1d')]=qs[_0xbb43('0x1d')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1d')]);_0x473828[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1c')]);}_0x473828[_0xbb43('0x38')]=qs['sort'](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x39')]);_0x473828['where']=qs[_0xbb43('0x30')](_[_0xbb43('0x3a')](_0x40b04b[_0xbb43('0x2f')],_0x539730['filters']),_0x56fe33);if(_0x40b04b['query']['filter']){_0x473828[_0xbb43('0x3b')]=_[_0xbb43('0x3c')](_0x473828['where'],{'$or':_['map'](_0x56fe33,function(_0x2aa381){if(_0x2aa381[_0xbb43('0x2d')]!==_0xbb43('0x3d')){var _0x37afbb={};_0x37afbb[_0x2aa381[_0xbb43('0x26')]]={'$like':'%'+_0x40b04b['query'][_0xbb43('0x3e')]+'%'};return _0x37afbb;}})});}_0x473828=_[_0xbb43('0x3c')]({},_0x473828,_0x40b04b[_0xbb43('0x3f')]);var _0x3340aa={'where':_0x473828[_0xbb43('0x3b')]};return db['FaxQueueReport'][_0xbb43('0x1b')](_0x3340aa)['then'](function(_0x1c076f){_0x2ad6da[_0xbb43('0x1b')]=_0x1c076f;if(_0x40b04b['query'][_0xbb43('0x40')]){_0x473828['include']=[{'all':!![]}];}return db[_0xbb43('0x2b')][_0xbb43('0x41')](_0x473828);})[_0xbb43('0x42')](function(_0xb84ece){_0x2ad6da['rows']=_0xb84ece;return _0x2ad6da;})[_0xbb43('0x42')](respondWithFilteredResult(_0x21d386,_0x473828))[_0xbb43('0x43')](handleError(_0x21d386,null));};exports['show']=function(_0x3443f8,_0x5198a2){var _0x42b965={'raw':!![],'where':{'id':_0x3443f8[_0xbb43('0x44')]['id']}},_0x14285d={};_0x14285d[_0xbb43('0x31')]=_[_0xbb43('0x2e')](db[_0xbb43('0x2b')]['rawAttributes']);_0x14285d[_0xbb43('0x2f')]=_['keys'](_0x3443f8[_0xbb43('0x2f')]);_0x14285d[_0xbb43('0x30')]=_[_0xbb43('0x33')](_0x14285d[_0xbb43('0x31')],_0x14285d['query']);_0x42b965[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x14285d[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x3443f8[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x42b965[_0xbb43('0x32')]=_0x42b965[_0xbb43('0x32')]['length']?_0x42b965[_0xbb43('0x32')]:_0x14285d[_0xbb43('0x31')];if(_0x3443f8['query'][_0xbb43('0x40')]){_0x42b965['include']=[{'all':!![]}];}_0x42b965=_['merge']({},_0x42b965,_0x3443f8['options']);return db['FaxQueueReport'][_0xbb43('0x45')](_0x42b965)['then'](handleEntityNotFound(_0x5198a2,null))[_0xbb43('0x42')](respondWithResult(_0x5198a2,null))['catch'](handleError(_0x5198a2,null));};exports[_0xbb43('0x46')]=function(_0x39b6ae,_0x1f3fb4){return db['FaxQueueReport'][_0xbb43('0x46')](_0x39b6ae['body'],{})[_0xbb43('0x42')](respondWithResult(_0x1f3fb4,0xc9))[_0xbb43('0x43')](handleError(_0x1f3fb4,null));};exports[_0xbb43('0x23')]=function(_0x29840e,_0x417ad9){if(_0x29840e[_0xbb43('0x47')]['id']){delete _0x29840e[_0xbb43('0x47')]['id'];}return db['FaxQueueReport'][_0xbb43('0x45')]({'where':{'id':_0x29840e[_0xbb43('0x44')]['id']}})[_0xbb43('0x42')](handleEntityNotFound(_0x417ad9,null))[_0xbb43('0x42')](saveUpdates(_0x29840e['body'],null))[_0xbb43('0x42')](respondWithResult(_0x417ad9,null))[_0xbb43('0x43')](handleError(_0x417ad9,null));};exports[_0xbb43('0x24')]=function(_0xb1883e,_0x4b7712){return db[_0xbb43('0x2b')][_0xbb43('0x45')]({'where':{'id':_0xb1883e[_0xbb43('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b7712,null))[_0xbb43('0x42')](removeEntity(_0x4b7712,null))[_0xbb43('0x43')](handleError(_0x4b7712,null));};exports[_0xbb43('0x48')]=function(_0x1dc40a,_0x3402f2){return db['FaxQueueReport']['describe']()[_0xbb43('0x42')](respondWithResult(_0x3402f2,null))['catch'](handleError(_0x3402f2,null));}; \ No newline at end of file +var _0x8b29=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','limit','undefined','count','offset','status','set','json','reject','then','error','name','index','FaxQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x8b29,0xbe));var _0x98b2=function(_0x53c297,_0x1da197){_0x53c297=_0x53c297-0x0;var _0x29176a=_0x8b29[_0x53c297];return _0x29176a;};'use strict';var emlformat=require(_0x98b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98b2('0x1'));var jsonpatch=require(_0x98b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98b2('0x3'));var Mustache=require(_0x98b2('0x4'));var util=require('util');var path=require(_0x98b2('0x5'));var sox=require('sox');var csv=require(_0x98b2('0x6'));var ejs=require(_0x98b2('0x7'));var fs=require('fs');var fs_extra=require(_0x98b2('0x8'));var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require(_0x98b2('0xb'));var jsforce=require(_0x98b2('0xc'));var deskjs=require(_0x98b2('0xd'));var toCsv=require(_0x98b2('0x6'));var querystring=require(_0x98b2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require(_0x98b2('0x11'));var hardwareService=require(_0x98b2('0x12'));var logger=require(_0x98b2('0x13'))(_0x98b2('0x14'));var utils=require('../../config/utils');var config=require(_0x98b2('0x15'));var licenseUtil=require(_0x98b2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27865e,_0x1180fe){_0x1180fe=_0x1180fe||0xcc;return function(_0x2a6337){if(_0x2a6337){return _0x27865e['sendStatus'](_0x1180fe);}return _0x27865e['status'](_0x1180fe)[_0x98b2('0x17')]();};}function respondWithResult(_0x56bcbd,_0x2966e2){_0x2966e2=_0x2966e2||0xc8;return function(_0x49b151){if(_0x49b151){return _0x56bcbd['status'](_0x2966e2)['json'](_0x49b151);}};}function respondWithFilteredResult(_0x831ee8,_0x413464){return function(_0xe49e9a){if(_0xe49e9a){var _0x5ecea1=typeof _0x413464['offset']==='undefined'&&typeof _0x413464[_0x98b2('0x18')]===_0x98b2('0x19');var _0x145d65=_0xe49e9a[_0x98b2('0x1a')];var _0x4b9f2c=_0x5ecea1?0x0:_0x413464[_0x98b2('0x1b')];var _0x588837=_0x5ecea1?_0xe49e9a[_0x98b2('0x1a')]:_0x413464['offset']+_0x413464[_0x98b2('0x18')];var _0x1dfc04;if(_0x588837>=_0x145d65){_0x588837=_0x145d65;_0x1dfc04=0xc8;}else{_0x1dfc04=0xce;}_0x831ee8[_0x98b2('0x1c')](_0x1dfc04);return _0x831ee8[_0x98b2('0x1d')]('Content-Range',_0x4b9f2c+'-'+_0x588837+'/'+_0x145d65)[_0x98b2('0x1e')](_0xe49e9a);}return null;};}function patchUpdates(_0x242cbd){return function(_0x5dfdf7){try{jsonpatch['apply'](_0x5dfdf7,_0x242cbd,!![]);}catch(_0x5d6b38){return BPromise[_0x98b2('0x1f')](_0x5d6b38);}return _0x5dfdf7['save']();};}function saveUpdates(_0x4ddded,_0x3796c0){return function(_0x37fc18){if(_0x37fc18){return _0x37fc18['update'](_0x4ddded)[_0x98b2('0x20')](function(_0x13d149){return _0x13d149;});}return null;};}function removeEntity(_0xfae112,_0x4f33d8){return function(_0x2a5587){if(_0x2a5587){return _0x2a5587['destroy']()[_0x98b2('0x20')](function(){_0xfae112['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b6ebc,_0xe99d27){return function(_0x5fcd00){if(!_0x5fcd00){_0x7b6ebc['sendStatus'](0x194);}return _0x5fcd00;};}function handleError(_0x4f1e1b,_0x50c699){_0x50c699=_0x50c699||0x1f4;return function(_0x11c6aa){logger[_0x98b2('0x21')](_0x11c6aa['stack']);if(_0x11c6aa[_0x98b2('0x22')]){delete _0x11c6aa[_0x98b2('0x22')];}_0x4f1e1b[_0x98b2('0x1c')](_0x50c699)['send'](_0x11c6aa);};}exports[_0x98b2('0x23')]=function(_0x1dee11,_0x1f1c55){var _0xb4c6c4={},_0x25393d={},_0x5dd95f={'count':0x0,'rows':[]};var _0x23883f=_['map'](db[_0x98b2('0x24')][_0x98b2('0x25')],function(_0x4d197c){return{'name':_0x4d197c[_0x98b2('0x26')],'type':_0x4d197c[_0x98b2('0x27')]['key']};});_0x25393d[_0x98b2('0x28')]=_[_0x98b2('0x29')](_0x23883f,_0x98b2('0x22'));_0x25393d[_0x98b2('0x2a')]=_['keys'](_0x1dee11['query']);_0x25393d[_0x98b2('0x2b')]=_[_0x98b2('0x2c')](_0x25393d[_0x98b2('0x28')],_0x25393d[_0x98b2('0x2a')]);_0xb4c6c4[_0x98b2('0x2d')]=_[_0x98b2('0x2c')](_0x25393d['model'],qs[_0x98b2('0x2e')](_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x2e')]));_0xb4c6c4[_0x98b2('0x2d')]=_0xb4c6c4[_0x98b2('0x2d')][_0x98b2('0x2f')]?_0xb4c6c4[_0x98b2('0x2d')]:_0x25393d[_0x98b2('0x28')];if(!_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x30')](_0x98b2('0x31'))){_0xb4c6c4[_0x98b2('0x18')]=qs[_0x98b2('0x18')](_0x1dee11['query']['limit']);_0xb4c6c4[_0x98b2('0x1b')]=qs[_0x98b2('0x1b')](_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x1b')]);}_0xb4c6c4[_0x98b2('0x32')]=qs[_0x98b2('0x33')](_0x1dee11['query'][_0x98b2('0x33')]);_0xb4c6c4[_0x98b2('0x34')]=qs[_0x98b2('0x2b')](_[_0x98b2('0x35')](_0x1dee11['query'],_0x25393d[_0x98b2('0x2b')]),_0x23883f);if(_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x36')]){_0xb4c6c4[_0x98b2('0x34')]=_[_0x98b2('0x37')](_0xb4c6c4[_0x98b2('0x34')],{'$or':_[_0x98b2('0x29')](_0x23883f,function(_0x591ad2){if(_0x591ad2[_0x98b2('0x27')]!=='VIRTUAL'){var _0x18e14e={};_0x18e14e[_0x591ad2[_0x98b2('0x22')]]={'$like':'%'+_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x36')]+'%'};return _0x18e14e;}})});}_0xb4c6c4=_['merge']({},_0xb4c6c4,_0x1dee11['options']);var _0x3d8bc7={'where':_0xb4c6c4[_0x98b2('0x34')]};return db[_0x98b2('0x24')]['count'](_0x3d8bc7)[_0x98b2('0x20')](function(_0x542a29){_0x5dd95f[_0x98b2('0x1a')]=_0x542a29;if(_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x38')]){_0xb4c6c4[_0x98b2('0x39')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x98b2('0x3a')](_0xb4c6c4);})[_0x98b2('0x20')](function(_0x197749){_0x5dd95f['rows']=_0x197749;return _0x5dd95f;})[_0x98b2('0x20')](respondWithFilteredResult(_0x1f1c55,_0xb4c6c4))[_0x98b2('0x3b')](handleError(_0x1f1c55,null));};exports[_0x98b2('0x3c')]=function(_0x97f0dd,_0xbf3665){var _0x3415e9={'raw':!![],'where':{'id':_0x97f0dd[_0x98b2('0x3d')]['id']}},_0x4a6c03={};_0x4a6c03['model']=_[_0x98b2('0x3e')](db[_0x98b2('0x24')][_0x98b2('0x25')]);_0x4a6c03[_0x98b2('0x2a')]=_[_0x98b2('0x3e')](_0x97f0dd[_0x98b2('0x2a')]);_0x4a6c03[_0x98b2('0x2b')]=_[_0x98b2('0x2c')](_0x4a6c03[_0x98b2('0x28')],_0x4a6c03['query']);_0x3415e9[_0x98b2('0x2d')]=_['intersection'](_0x4a6c03[_0x98b2('0x28')],qs[_0x98b2('0x2e')](_0x97f0dd[_0x98b2('0x2a')][_0x98b2('0x2e')]));_0x3415e9[_0x98b2('0x2d')]=_0x3415e9[_0x98b2('0x2d')]['length']?_0x3415e9[_0x98b2('0x2d')]:_0x4a6c03[_0x98b2('0x28')];if(_0x97f0dd[_0x98b2('0x2a')][_0x98b2('0x38')]){_0x3415e9[_0x98b2('0x39')]=[{'all':!![]}];}_0x3415e9=_['merge']({},_0x3415e9,_0x97f0dd['options']);return db[_0x98b2('0x24')][_0x98b2('0x3f')](_0x3415e9)[_0x98b2('0x20')](handleEntityNotFound(_0xbf3665,null))[_0x98b2('0x20')](respondWithResult(_0xbf3665,null))['catch'](handleError(_0xbf3665,null));};exports['create']=function(_0x4d53c4,_0xea5f5d){return db[_0x98b2('0x24')][_0x98b2('0x40')](_0x4d53c4[_0x98b2('0x41')],{})[_0x98b2('0x20')](respondWithResult(_0xea5f5d,0xc9))[_0x98b2('0x3b')](handleError(_0xea5f5d,null));};exports[_0x98b2('0x42')]=function(_0x2b08ed,_0x3c2477){if(_0x2b08ed['body']['id']){delete _0x2b08ed[_0x98b2('0x41')]['id'];}return db['FaxQueueReport'][_0x98b2('0x3f')]({'where':{'id':_0x2b08ed[_0x98b2('0x3d')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x3c2477,null))[_0x98b2('0x20')](saveUpdates(_0x2b08ed['body'],null))[_0x98b2('0x20')](respondWithResult(_0x3c2477,null))[_0x98b2('0x3b')](handleError(_0x3c2477,null));};exports[_0x98b2('0x43')]=function(_0x1e13b8,_0x6ce50d){return db['FaxQueueReport'][_0x98b2('0x3f')]({'where':{'id':_0x1e13b8[_0x98b2('0x3d')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x6ce50d,null))[_0x98b2('0x20')](removeEntity(_0x6ce50d,null))[_0x98b2('0x3b')](handleError(_0x6ce50d,null));};exports[_0x98b2('0x44')]=function(_0x3e4b54,_0x144b62){return db[_0x98b2('0x24')][_0x98b2('0x44')]()[_0x98b2('0x20')](respondWithResult(_0x144b62,null))[_0x98b2('0x3b')](handleError(_0x144b62,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c11dac3..98f0e69 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0xaccfa5,_0x4eec88){var _0x16580c=function(_0x1ab9c8){while(--_0x1ab9c8){_0xaccfa5['push'](_0xaccfa5['shift']());}};_0x16580c(++_0x4eec88);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x4da885,_0x291e32){var _0x461258=function(_0xa79467){while(--_0xa79467){_0x4da885['push'](_0x4da885['shift']());}};_0x461258(++_0x291e32);}(_0xf494,0x1c6));var _0x4f49=function(_0x40b506,_0x11141e){_0x40b506=_0x40b506-0x0;var _0x3333a0=_0xf494[_0x40b506];return _0x3333a0;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 85ce950..5f23662 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 _0x4918=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x48b02c,_0x20e1ef){var _0x5d8dae=function(_0x46c476){while(--_0x46c476){_0x48b02c['push'](_0x48b02c['shift']());}};_0x5d8dae(++_0x20e1ef);}(_0x4918,0x1ab));var _0x8491=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x4918[_0x4b0290];return _0x4bd9f4;};'use strict';var _=require(_0x8491('0x0'));var util=require(_0x8491('0x1'));var moment=require(_0x8491('0x2'));var BPromise=require(_0x8491('0x3'));var rs=require(_0x8491('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8491('0x5'))['db'];var utils=require(_0x8491('0x6'));var logger=require(_0x8491('0x7'))(_0x8491('0x8'));var config=require(_0x8491('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8491('0xa')][_0x8491('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e98b0,_0x4941f9,_0x22213f){return new BPromise(function(_0x1d58f3,_0x286e72){return client[_0x8491('0xc')](_0x1e98b0,_0x22213f)[_0x8491('0xd')](function(_0x254e40){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4941f9,_0x8491('0xe'));logger[_0x8491('0xf')](_0x8491('0x10'),_0x4941f9,'request\x20sent',JSON[_0x8491('0x11')](_0x254e40));if(_0x254e40[_0x8491('0x12')]){if(_0x254e40['error'][_0x8491('0x13')]===0x1f4){logger[_0x8491('0x12')](_0x8491('0x14'),_0x4941f9,_0x254e40[_0x8491('0x12')][_0x8491('0x15')]);return _0x286e72(_0x254e40[_0x8491('0x12')][_0x8491('0x15')]);}logger['error'](_0x8491('0x14'),_0x4941f9,_0x254e40[_0x8491('0x12')][_0x8491('0x15')]);return _0x1d58f3(_0x254e40[_0x8491('0x12')][_0x8491('0x15')]);}else{logger[_0x8491('0x16')]('FaxQueueReport,\x20%s,\x20%s',_0x4941f9,_0x8491('0xe'));_0x1d58f3(_0x254e40['result'][_0x8491('0x15')]);}})[_0x8491('0x17')](function(_0x44b987){logger[_0x8491('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x4941f9,_0x44b987);_0x286e72(_0x44b987);});});}exports[_0x8491('0x18')]=function(_0x2d531a){var _0x1a3ffe=this;return new Promise(function(_0x1e0343,_0x13064e){return db[_0x8491('0x19')][_0x8491('0x1a')](_0x2d531a['body'],{'raw':_0x2d531a[_0x8491('0x1b')]?_0x2d531a[_0x8491('0x1b')][_0x8491('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5bfcd2){logger[_0x8491('0x16')](_0x8491('0x18'),_0x2d531a);logger[_0x8491('0xf')](_0x8491('0x18'),_0x2d531a,JSON[_0x8491('0x11')](_0x5bfcd2));_0x1e0343(_0x5bfcd2);})['catch'](function(_0x289fe3){logger[_0x8491('0x12')]('CreateFaxQueueReport',_0x289fe3['message'],_0x2d531a);_0x13064e(_0x1a3ffe['error'](0x1f4,_0x289fe3['message']));});});};exports[_0x8491('0x1d')]=function(_0x49fcf7){var _0x3e4412=this;return new Promise(function(_0x4e1f33,_0x1fd465){return db[_0x8491('0x19')][_0x8491('0x1e')](_0x49fcf7[_0x8491('0x1f')],{'raw':_0x49fcf7[_0x8491('0x1b')]?_0x49fcf7[_0x8491('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49fcf7[_0x8491('0x1b')]?_0x49fcf7[_0x8491('0x1b')]['where']||null:null,'attributes':_0x49fcf7[_0x8491('0x1b')]?_0x49fcf7[_0x8491('0x1b')][_0x8491('0x20')]||null:null,'limit':_0x49fcf7[_0x8491('0x1b')]?_0x49fcf7[_0x8491('0x1b')][_0x8491('0x21')]||null:null})['then'](function(_0x3611a7){logger['info']('UpdateFaxQueueReport',_0x49fcf7);logger[_0x8491('0xf')](_0x8491('0x1d'),_0x49fcf7,JSON[_0x8491('0x11')](_0x3611a7));_0x4e1f33(_0x3611a7);})[_0x8491('0x17')](function(_0x459f7e){logger[_0x8491('0x12')](_0x8491('0x1d'),_0x459f7e['message'],_0x49fcf7);_0x1fd465(_0x3e4412['error'](0x1f4,_0x459f7e['message']));});});}; \ No newline at end of file +var _0x601b=['message','result','CreateFaxQueueReport','create','body','options','catch','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xf97eb0,_0x1578b7){var _0xea70f4=function(_0x574c8d){while(--_0x574c8d){_0xf97eb0['push'](_0xf97eb0['shift']());}};_0xea70f4(++_0x1578b7);}(_0x601b,0x98));var _0xb601=function(_0x10b4ce,_0x110e96){_0x10b4ce=_0x10b4ce-0x0;var _0x5da59b=_0x601b[_0x10b4ce];return _0x5da59b;};'use strict';var _=require(_0xb601('0x0'));var util=require(_0xb601('0x1'));var moment=require(_0xb601('0x2'));var BPromise=require(_0xb601('0x3'));var rs=require(_0xb601('0x4'));var fs=require('fs');var Redis=require(_0xb601('0x5'));var db=require(_0xb601('0x6'))['db'];var utils=require(_0xb601('0x7'));var logger=require(_0xb601('0x8'))(_0xb601('0x9'));var config=require(_0xb601('0xa'));var jayson=require(_0xb601('0xb'));var client=jayson[_0xb601('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1e73,_0x5e280f,_0x4356ca){return new BPromise(function(_0x30f439,_0x424447){return client[_0xb601('0xd')](_0x1a1e73,_0x4356ca)[_0xb601('0xe')](function(_0x15b831){logger[_0xb601('0xf')](_0xb601('0x10'),_0x5e280f,_0xb601('0x11'));logger[_0xb601('0x12')](_0xb601('0x13'),_0x5e280f,_0xb601('0x11'),JSON[_0xb601('0x14')](_0x15b831));if(_0x15b831[_0xb601('0x15')]){if(_0x15b831[_0xb601('0x15')][_0xb601('0x16')]===0x1f4){logger[_0xb601('0x15')](_0xb601('0x10'),_0x5e280f,_0x15b831[_0xb601('0x15')][_0xb601('0x17')]);return _0x424447(_0x15b831['error'][_0xb601('0x17')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5e280f,_0x15b831['error']['message']);return _0x30f439(_0x15b831['error'][_0xb601('0x17')]);}else{logger[_0xb601('0xf')](_0xb601('0x10'),_0x5e280f,_0xb601('0x11'));_0x30f439(_0x15b831[_0xb601('0x18')][_0xb601('0x17')]);}})['catch'](function(_0x2cb9be){logger[_0xb601('0x15')](_0xb601('0x10'),_0x5e280f,_0x2cb9be);_0x424447(_0x2cb9be);});});}exports[_0xb601('0x19')]=function(_0x389d15){var _0x58664b=this;return new Promise(function(_0x445dc7,_0x229e05){return db['FaxQueueReport'][_0xb601('0x1a')](_0x389d15[_0xb601('0x1b')],{'raw':_0x389d15['options']?_0x389d15[_0xb601('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xb601('0xe')](function(_0x4ece80){logger[_0xb601('0xf')](_0xb601('0x19'),_0x389d15);logger[_0xb601('0x12')](_0xb601('0x19'),_0x389d15,JSON[_0xb601('0x14')](_0x4ece80));_0x445dc7(_0x4ece80);})[_0xb601('0x1d')](function(_0x19a780){logger['error'](_0xb601('0x19'),_0x19a780[_0xb601('0x17')],_0x389d15);_0x229e05(_0x58664b['error'](0x1f4,_0x19a780['message']));});});};exports['UpdateFaxQueueReport']=function(_0x2e6ca0){var _0x2afd4d=this;return new Promise(function(_0x5c7ee5,_0x198bba){return db['FaxQueueReport']['update'](_0x2e6ca0[_0xb601('0x1b')],{'raw':_0x2e6ca0[_0xb601('0x1c')]?_0x2e6ca0[_0xb601('0x1c')][_0xb601('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6ca0[_0xb601('0x1c')]?_0x2e6ca0[_0xb601('0x1c')][_0xb601('0x1f')]||null:null,'attributes':_0x2e6ca0[_0xb601('0x1c')]?_0x2e6ca0[_0xb601('0x1c')][_0xb601('0x20')]||null:null,'limit':_0x2e6ca0[_0xb601('0x1c')]?_0x2e6ca0[_0xb601('0x1c')][_0xb601('0x21')]||null:null})[_0xb601('0xe')](function(_0x4fc550){logger['info'](_0xb601('0x22'),_0x2e6ca0);logger[_0xb601('0x12')](_0xb601('0x22'),_0x2e6ca0,JSON[_0xb601('0x14')](_0x4fc550));_0x5c7ee5(_0x4fc550);})[_0xb601('0x1d')](function(_0x49a69b){logger[_0xb601('0x15')](_0xb601('0x22'),_0x49a69b[_0xb601('0x17')],_0x2e6ca0);_0x198bba(_0x2afd4d[_0xb601('0x15')](0x1f4,_0x49a69b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8079c16..e82a6f0 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 _0xd667=['get','/describe','describe','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','index'];(function(_0x556f5e,_0x3ade74){var _0x5b6ce2=function(_0x59c35f){while(--_0x59c35f){_0x556f5e['push'](_0x556f5e['shift']());}};_0x5b6ce2(++_0x3ade74);}(_0xd667,0xc8));var _0x7d66=function(_0x3385e7,_0x3d67a9){_0x3385e7=_0x3385e7-0x0;var _0x3d4490=_0xd667[_0x3385e7];return _0x3d4490;};'use strict';var multer=require(_0x7d66('0x0'));var util=require(_0x7d66('0x1'));var path=require('path');var timeout=require(_0x7d66('0x2'));var express=require(_0x7d66('0x3'));var router=express[_0x7d66('0x4')]();var fs_extra=require(_0x7d66('0x5'));var auth=require(_0x7d66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7d66('0x7'));var controller=require(_0x7d66('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7d66('0x9')]);router[_0x7d66('0xa')](_0x7d66('0xb'),auth['isAuthenticated'](),controller[_0x7d66('0xc')]);router[_0x7d66('0xa')](_0x7d66('0xd'),auth[_0x7d66('0xe')](),controller['show']);router[_0x7d66('0xf')]('/',auth[_0x7d66('0xe')](),controller['create']);router[_0x7d66('0x10')](_0x7d66('0xd'),auth['isAuthenticated'](),controller[_0x7d66('0x11')]);router[_0x7d66('0x12')]('/:id',auth[_0x7d66('0xe')](),controller[_0x7d66('0x13')]);module[_0x7d66('0x14')]=router; \ No newline at end of file +var _0x12ff=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x12ff,0xdd));var _0xf12f=function(_0x1a8ba1,_0x44cc41){_0x1a8ba1=_0x1a8ba1-0x0;var _0x40af48=_0x12ff[_0x1a8ba1];return _0x40af48;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf12f('0x0'));var timeout=require(_0xf12f('0x1'));var express=require(_0xf12f('0x2'));var router=express[_0xf12f('0x3')]();var fs_extra=require(_0xf12f('0x4'));var auth=require(_0xf12f('0x5'));var interaction=require(_0xf12f('0x6'));var config=require(_0xf12f('0x7'));var controller=require(_0xf12f('0x8'));router[_0xf12f('0x9')]('/',auth[_0xf12f('0xa')](),controller[_0xf12f('0xb')]);router['get'](_0xf12f('0xc'),auth['isAuthenticated'](),controller[_0xf12f('0xd')]);router['get'](_0xf12f('0xe'),auth['isAuthenticated'](),controller[_0xf12f('0xf')]);router[_0xf12f('0x10')]('/',auth[_0xf12f('0xa')](),controller[_0xf12f('0x11')]);router[_0xf12f('0x12')](_0xf12f('0xe'),auth[_0xf12f('0xa')](),controller[_0xf12f('0x13')]);router[_0xf12f('0x14')](_0xf12f('0xe'),auth[_0xf12f('0xa')](),controller['destroy']);module[_0xf12f('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index ebe762c..69694fe 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x289937,_0x540a1a){var _0x51a4fc=function(_0x2003bd){while(--_0x2003bd){_0x289937['push'](_0x289937['shift']());}};_0x51a4fc(++_0x540a1a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3cc7db,_0x36b9a5){var _0x3a9d0d=function(_0xbe0ce6){while(--_0xbe0ce6){_0x3cc7db['push'](_0x3cc7db['shift']());}};_0x3a9d0d(++_0x36b9a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6e03c40..3f36f4b 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 _0x3ca9=['params','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','update','destroy','then','end','name','index','map','FaxTransferReport','fieldName','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','keys','find','create','body'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x3ca9,0x10a));var _0x93ca=function(_0x2c328f,_0x360eb9){_0x2c328f=_0x2c328f-0x0;var _0x4db412=_0x3ca9[_0x2c328f];return _0x4db412;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93ca('0x0'));var jsonpatch=require(_0x93ca('0x1'));var rp=require('request-promise');var moment=require(_0x93ca('0x2'));var BPromise=require(_0x93ca('0x3'));var Mustache=require(_0x93ca('0x4'));var util=require(_0x93ca('0x5'));var path=require('path');var sox=require(_0x93ca('0x6'));var csv=require(_0x93ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93ca('0x8'));var _=require(_0x93ca('0x9'));var squel=require('squel');var crypto=require(_0x93ca('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x93ca('0xb'));var toCsv=require(_0x93ca('0x7'));var querystring=require(_0x93ca('0xc'));var Papa=require(_0x93ca('0xd'));var Redis=require('ioredis');var authService=require(_0x93ca('0xe'));var qs=require(_0x93ca('0xf'));var as=require(_0x93ca('0x10'));var hardwareService=require(_0x93ca('0x11'));var logger=require(_0x93ca('0x12'))('api');var utils=require(_0x93ca('0x13'));var config=require(_0x93ca('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x93ca('0x15'))['db'];function respondWithStatusCode(_0x4aba6c,_0xbba138){_0xbba138=_0xbba138||0xcc;return function(_0x4304b9){if(_0x4304b9){return _0x4aba6c[_0x93ca('0x16')](_0xbba138);}return _0x4aba6c[_0x93ca('0x17')](_0xbba138)['end']();};}function respondWithResult(_0x279216,_0x5cb66b){_0x5cb66b=_0x5cb66b||0xc8;return function(_0x2c5a00){if(_0x2c5a00){return _0x279216[_0x93ca('0x17')](_0x5cb66b)[_0x93ca('0x18')](_0x2c5a00);}};}function respondWithFilteredResult(_0x165aa9,_0x299efc){return function(_0x4ae9d4){if(_0x4ae9d4){var _0x3f5919=typeof _0x299efc[_0x93ca('0x19')]===_0x93ca('0x1a')&&typeof _0x299efc['limit']===_0x93ca('0x1a');var _0x3e4974=_0x4ae9d4[_0x93ca('0x1b')];var _0x4f7148=_0x3f5919?0x0:_0x299efc['offset'];var _0x3bc7fb=_0x3f5919?_0x4ae9d4[_0x93ca('0x1b')]:_0x299efc['offset']+_0x299efc[_0x93ca('0x1c')];var _0x5b539d;if(_0x3bc7fb>=_0x3e4974){_0x3bc7fb=_0x3e4974;_0x5b539d=0xc8;}else{_0x5b539d=0xce;}_0x165aa9[_0x93ca('0x17')](_0x5b539d);return _0x165aa9['set'](_0x93ca('0x1d'),_0x4f7148+'-'+_0x3bc7fb+'/'+_0x3e4974)[_0x93ca('0x18')](_0x4ae9d4);}return null;};}function patchUpdates(_0xc1fcf3){return function(_0x17a6b4){try{jsonpatch['apply'](_0x17a6b4,_0xc1fcf3,!![]);}catch(_0x419614){return BPromise[_0x93ca('0x1e')](_0x419614);}return _0x17a6b4['save']();};}function saveUpdates(_0x239ff2,_0x5b3bbb){return function(_0x34a607){if(_0x34a607){return _0x34a607[_0x93ca('0x1f')](_0x239ff2)['then'](function(_0x37a6c7){return _0x37a6c7;});}return null;};}function removeEntity(_0x59cd21,_0x3bfb3c){return function(_0x3db574){if(_0x3db574){return _0x3db574[_0x93ca('0x20')]()[_0x93ca('0x21')](function(){_0x59cd21[_0x93ca('0x17')](0xcc)[_0x93ca('0x22')]();});}};}function handleEntityNotFound(_0x173d43,_0x4d981f){return function(_0x1726da){if(!_0x1726da){_0x173d43[_0x93ca('0x16')](0x194);}return _0x1726da;};}function handleError(_0x136c68,_0x59a6e5){_0x59a6e5=_0x59a6e5||0x1f4;return function(_0x5b42f0){logger['error'](_0x5b42f0['stack']);if(_0x5b42f0[_0x93ca('0x23')]){delete _0x5b42f0['name'];}_0x136c68[_0x93ca('0x17')](_0x59a6e5)['send'](_0x5b42f0);};}exports[_0x93ca('0x24')]=function(_0x2bb786,_0x35146e){var _0x92692e={},_0x9cc1bf={},_0x474bc0={'count':0x0,'rows':[]};var _0x50047c=_[_0x93ca('0x25')](db[_0x93ca('0x26')]['rawAttributes'],function(_0x2f45b6){return{'name':_0x2f45b6[_0x93ca('0x27')],'type':_0x2f45b6[_0x93ca('0x28')][_0x93ca('0x29')]};});_0x9cc1bf[_0x93ca('0x2a')]=_[_0x93ca('0x25')](_0x50047c,_0x93ca('0x23'));_0x9cc1bf['query']=_['keys'](_0x2bb786['query']);_0x9cc1bf[_0x93ca('0x2b')]=_['intersection'](_0x9cc1bf[_0x93ca('0x2a')],_0x9cc1bf[_0x93ca('0x2c')]);_0x92692e[_0x93ca('0x2d')]=_[_0x93ca('0x2e')](_0x9cc1bf[_0x93ca('0x2a')],qs['fields'](_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x2f')]));_0x92692e['attributes']=_0x92692e[_0x93ca('0x2d')][_0x93ca('0x30')]?_0x92692e['attributes']:_0x9cc1bf[_0x93ca('0x2a')];if(!_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x31')]('nolimit')){_0x92692e[_0x93ca('0x1c')]=qs[_0x93ca('0x1c')](_0x2bb786['query']['limit']);_0x92692e[_0x93ca('0x19')]=qs[_0x93ca('0x19')](_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x19')]);}_0x92692e[_0x93ca('0x32')]=qs[_0x93ca('0x33')](_0x2bb786['query'][_0x93ca('0x33')]);_0x92692e[_0x93ca('0x34')]=qs['filters'](_['pick'](_0x2bb786[_0x93ca('0x2c')],_0x9cc1bf[_0x93ca('0x2b')]),_0x50047c);if(_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x35')]){_0x92692e[_0x93ca('0x34')]=_[_0x93ca('0x36')](_0x92692e[_0x93ca('0x34')],{'$or':_[_0x93ca('0x25')](_0x50047c,function(_0x3d46b7){if(_0x3d46b7[_0x93ca('0x28')]!=='VIRTUAL'){var _0x31dc3e={};_0x31dc3e[_0x3d46b7['name']]={'$like':'%'+_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x35')]+'%'};return _0x31dc3e;}})});}_0x92692e=_['merge']({},_0x92692e,_0x2bb786['options']);var _0x3e7104={'where':_0x92692e[_0x93ca('0x34')]};return db[_0x93ca('0x26')][_0x93ca('0x1b')](_0x3e7104)[_0x93ca('0x21')](function(_0x4e087f){_0x474bc0[_0x93ca('0x1b')]=_0x4e087f;if(_0x2bb786[_0x93ca('0x2c')][_0x93ca('0x37')]){_0x92692e[_0x93ca('0x38')]=[{'all':!![]}];}return db[_0x93ca('0x26')][_0x93ca('0x39')](_0x92692e);})[_0x93ca('0x21')](function(_0x1573e7){_0x474bc0[_0x93ca('0x3a')]=_0x1573e7;return _0x474bc0;})[_0x93ca('0x21')](respondWithFilteredResult(_0x35146e,_0x92692e))[_0x93ca('0x3b')](handleError(_0x35146e,null));};exports['show']=function(_0x449aa0,_0x4ebcc2){var _0x4fdc72={'raw':!![],'where':{'id':_0x449aa0['params']['id']}},_0xecba92={};_0xecba92['model']=_[_0x93ca('0x3c')](db['FaxTransferReport']['rawAttributes']);_0xecba92['query']=_['keys'](_0x449aa0[_0x93ca('0x2c')]);_0xecba92[_0x93ca('0x2b')]=_[_0x93ca('0x2e')](_0xecba92[_0x93ca('0x2a')],_0xecba92[_0x93ca('0x2c')]);_0x4fdc72[_0x93ca('0x2d')]=_['intersection'](_0xecba92[_0x93ca('0x2a')],qs[_0x93ca('0x2f')](_0x449aa0[_0x93ca('0x2c')]['fields']));_0x4fdc72[_0x93ca('0x2d')]=_0x4fdc72[_0x93ca('0x2d')][_0x93ca('0x30')]?_0x4fdc72[_0x93ca('0x2d')]:_0xecba92['model'];if(_0x449aa0['query'][_0x93ca('0x37')]){_0x4fdc72[_0x93ca('0x38')]=[{'all':!![]}];}_0x4fdc72=_[_0x93ca('0x36')]({},_0x4fdc72,_0x449aa0['options']);return db[_0x93ca('0x26')][_0x93ca('0x3d')](_0x4fdc72)[_0x93ca('0x21')](handleEntityNotFound(_0x4ebcc2,null))[_0x93ca('0x21')](respondWithResult(_0x4ebcc2,null))[_0x93ca('0x3b')](handleError(_0x4ebcc2,null));};exports[_0x93ca('0x3e')]=function(_0x176ab0,_0x138cd1){return db['FaxTransferReport'][_0x93ca('0x3e')](_0x176ab0[_0x93ca('0x3f')],{})['then'](respondWithResult(_0x138cd1,0xc9))['catch'](handleError(_0x138cd1,null));};exports[_0x93ca('0x1f')]=function(_0x7ec27b,_0x54c3be){if(_0x7ec27b[_0x93ca('0x3f')]['id']){delete _0x7ec27b[_0x93ca('0x3f')]['id'];}return db[_0x93ca('0x26')]['find']({'where':{'id':_0x7ec27b[_0x93ca('0x40')]['id']}})[_0x93ca('0x21')](handleEntityNotFound(_0x54c3be,null))['then'](saveUpdates(_0x7ec27b[_0x93ca('0x3f')],null))[_0x93ca('0x21')](respondWithResult(_0x54c3be,null))[_0x93ca('0x3b')](handleError(_0x54c3be,null));};exports['destroy']=function(_0x23331f,_0x1f9ec5){return db[_0x93ca('0x26')][_0x93ca('0x3d')]({'where':{'id':_0x23331f['params']['id']}})[_0x93ca('0x21')](handleEntityNotFound(_0x1f9ec5,null))[_0x93ca('0x21')](removeEntity(_0x1f9ec5,null))[_0x93ca('0x3b')](handleError(_0x1f9ec5,null));};exports[_0x93ca('0x41')]=function(_0x4f153c,_0x512ec0){return db[_0x93ca('0x26')][_0x93ca('0x41')]()[_0x93ca('0x21')](respondWithResult(_0x512ec0,null))['catch'](handleError(_0x512ec0,null));}; \ No newline at end of file +var _0xa08e=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','FaxTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','findAll','rows','catch','show','length','includeAll','options','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x118d61,_0x2410d8){var _0x45c03c=function(_0x988f18){while(--_0x988f18){_0x118d61['push'](_0x118d61['shift']());}};_0x45c03c(++_0x2410d8);}(_0xa08e,0xcd));var _0xea08=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0xa08e[_0x3f8743];return _0x1f844c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea08('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea08('0x1'));var rp=require(_0xea08('0x2'));var moment=require(_0xea08('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea08('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xea08('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea08('0x6'));var _=require(_0xea08('0x7'));var squel=require(_0xea08('0x8'));var crypto=require(_0xea08('0x9'));var jsforce=require(_0xea08('0xa'));var deskjs=require(_0xea08('0xb'));var toCsv=require(_0xea08('0x5'));var querystring=require(_0xea08('0xc'));var Papa=require(_0xea08('0xd'));var Redis=require(_0xea08('0xe'));var authService=require(_0xea08('0xf'));var qs=require(_0xea08('0x10'));var as=require(_0xea08('0x11'));var hardwareService=require(_0xea08('0x12'));var logger=require(_0xea08('0x13'))(_0xea08('0x14'));var utils=require(_0xea08('0x15'));var config=require(_0xea08('0x16'));var licenseUtil=require(_0xea08('0x17'));var db=require(_0xea08('0x18'))['db'];function respondWithStatusCode(_0x3c283a,_0x9fbce3){_0x9fbce3=_0x9fbce3||0xcc;return function(_0x35e273){if(_0x35e273){return _0x3c283a[_0xea08('0x19')](_0x9fbce3);}return _0x3c283a[_0xea08('0x1a')](_0x9fbce3)[_0xea08('0x1b')]();};}function respondWithResult(_0x20ffa6,_0x52010c){_0x52010c=_0x52010c||0xc8;return function(_0x727058){if(_0x727058){return _0x20ffa6['status'](_0x52010c)[_0xea08('0x1c')](_0x727058);}};}function respondWithFilteredResult(_0x308b01,_0x1d2987){return function(_0x3c9b52){if(_0x3c9b52){var _0x47ebc0=typeof _0x1d2987[_0xea08('0x1d')]===_0xea08('0x1e')&&typeof _0x1d2987[_0xea08('0x1f')]===_0xea08('0x1e');var _0x49c865=_0x3c9b52[_0xea08('0x20')];var _0x24141e=_0x47ebc0?0x0:_0x1d2987[_0xea08('0x1d')];var _0x599582=_0x47ebc0?_0x3c9b52[_0xea08('0x20')]:_0x1d2987[_0xea08('0x1d')]+_0x1d2987[_0xea08('0x1f')];var _0xc50bd7;if(_0x599582>=_0x49c865){_0x599582=_0x49c865;_0xc50bd7=0xc8;}else{_0xc50bd7=0xce;}_0x308b01[_0xea08('0x1a')](_0xc50bd7);return _0x308b01[_0xea08('0x21')](_0xea08('0x22'),_0x24141e+'-'+_0x599582+'/'+_0x49c865)[_0xea08('0x1c')](_0x3c9b52);}return null;};}function patchUpdates(_0x5e8815){return function(_0x312f6b){try{jsonpatch[_0xea08('0x23')](_0x312f6b,_0x5e8815,!![]);}catch(_0x141b75){return BPromise['reject'](_0x141b75);}return _0x312f6b['save']();};}function saveUpdates(_0x40e9d5,_0x23e190){return function(_0x5852d9){if(_0x5852d9){return _0x5852d9[_0xea08('0x24')](_0x40e9d5)[_0xea08('0x25')](function(_0x221bdf){return _0x221bdf;});}return null;};}function removeEntity(_0x2f0763,_0x3ad63b){return function(_0x13523b){if(_0x13523b){return _0x13523b[_0xea08('0x26')]()[_0xea08('0x25')](function(){_0x2f0763[_0xea08('0x1a')](0xcc)[_0xea08('0x1b')]();});}};}function handleEntityNotFound(_0x3b1371,_0x3ae4a0){return function(_0x3ab7d8){if(!_0x3ab7d8){_0x3b1371['sendStatus'](0x194);}return _0x3ab7d8;};}function handleError(_0x4fe20c,_0x4019fa){_0x4019fa=_0x4019fa||0x1f4;return function(_0x270363){logger[_0xea08('0x27')](_0x270363[_0xea08('0x28')]);if(_0x270363[_0xea08('0x29')]){delete _0x270363[_0xea08('0x29')];}_0x4fe20c[_0xea08('0x1a')](_0x4019fa)[_0xea08('0x2a')](_0x270363);};}exports['index']=function(_0x32a704,_0x4b61d5){var _0x5db743={},_0x358635={},_0x5903bc={'count':0x0,'rows':[]};var _0x54719c=_['map'](db[_0xea08('0x2b')][_0xea08('0x2c')],function(_0x52e7e8){return{'name':_0x52e7e8[_0xea08('0x2d')],'type':_0x52e7e8['type'][_0xea08('0x2e')]};});_0x358635[_0xea08('0x2f')]=_[_0xea08('0x30')](_0x54719c,'name');_0x358635[_0xea08('0x31')]=_[_0xea08('0x32')](_0x32a704[_0xea08('0x31')]);_0x358635[_0xea08('0x33')]=_[_0xea08('0x34')](_0x358635[_0xea08('0x2f')],_0x358635[_0xea08('0x31')]);_0x5db743['attributes']=_[_0xea08('0x34')](_0x358635[_0xea08('0x2f')],qs[_0xea08('0x35')](_0x32a704[_0xea08('0x31')][_0xea08('0x35')]));_0x5db743['attributes']=_0x5db743[_0xea08('0x36')]['length']?_0x5db743[_0xea08('0x36')]:_0x358635[_0xea08('0x2f')];if(!_0x32a704[_0xea08('0x31')][_0xea08('0x37')](_0xea08('0x38'))){_0x5db743['limit']=qs[_0xea08('0x1f')](_0x32a704[_0xea08('0x31')][_0xea08('0x1f')]);_0x5db743[_0xea08('0x1d')]=qs[_0xea08('0x1d')](_0x32a704[_0xea08('0x31')][_0xea08('0x1d')]);}_0x5db743['order']=qs[_0xea08('0x39')](_0x32a704[_0xea08('0x31')][_0xea08('0x39')]);_0x5db743[_0xea08('0x3a')]=qs[_0xea08('0x33')](_['pick'](_0x32a704[_0xea08('0x31')],_0x358635[_0xea08('0x33')]),_0x54719c);if(_0x32a704[_0xea08('0x31')][_0xea08('0x3b')]){_0x5db743[_0xea08('0x3a')]=_[_0xea08('0x3c')](_0x5db743['where'],{'$or':_[_0xea08('0x30')](_0x54719c,function(_0x25a151){if(_0x25a151[_0xea08('0x3d')]!==_0xea08('0x3e')){var _0x23c36f={};_0x23c36f[_0x25a151[_0xea08('0x29')]]={'$like':'%'+_0x32a704['query'][_0xea08('0x3b')]+'%'};return _0x23c36f;}})});}_0x5db743=_[_0xea08('0x3c')]({},_0x5db743,_0x32a704['options']);var _0x36bb82={'where':_0x5db743[_0xea08('0x3a')]};return db[_0xea08('0x2b')]['count'](_0x36bb82)[_0xea08('0x25')](function(_0x2d1c15){_0x5903bc[_0xea08('0x20')]=_0x2d1c15;if(_0x32a704[_0xea08('0x31')]['includeAll']){_0x5db743['include']=[{'all':!![]}];}return db[_0xea08('0x2b')][_0xea08('0x3f')](_0x5db743);})[_0xea08('0x25')](function(_0x55815f){_0x5903bc[_0xea08('0x40')]=_0x55815f;return _0x5903bc;})[_0xea08('0x25')](respondWithFilteredResult(_0x4b61d5,_0x5db743))[_0xea08('0x41')](handleError(_0x4b61d5,null));};exports[_0xea08('0x42')]=function(_0x24731a,_0x4f5a1a){var _0x4d50be={'raw':!![],'where':{'id':_0x24731a['params']['id']}},_0x2685b7={};_0x2685b7[_0xea08('0x2f')]=_[_0xea08('0x32')](db[_0xea08('0x2b')][_0xea08('0x2c')]);_0x2685b7['query']=_['keys'](_0x24731a[_0xea08('0x31')]);_0x2685b7[_0xea08('0x33')]=_[_0xea08('0x34')](_0x2685b7['model'],_0x2685b7[_0xea08('0x31')]);_0x4d50be[_0xea08('0x36')]=_['intersection'](_0x2685b7[_0xea08('0x2f')],qs[_0xea08('0x35')](_0x24731a[_0xea08('0x31')][_0xea08('0x35')]));_0x4d50be['attributes']=_0x4d50be['attributes'][_0xea08('0x43')]?_0x4d50be['attributes']:_0x2685b7[_0xea08('0x2f')];if(_0x24731a[_0xea08('0x31')][_0xea08('0x44')]){_0x4d50be['include']=[{'all':!![]}];}_0x4d50be=_[_0xea08('0x3c')]({},_0x4d50be,_0x24731a[_0xea08('0x45')]);return db[_0xea08('0x2b')][_0xea08('0x46')](_0x4d50be)[_0xea08('0x25')](handleEntityNotFound(_0x4f5a1a,null))[_0xea08('0x25')](respondWithResult(_0x4f5a1a,null))[_0xea08('0x41')](handleError(_0x4f5a1a,null));};exports['create']=function(_0x3ae410,_0x1ab087){return db['FaxTransferReport'][_0xea08('0x47')](_0x3ae410[_0xea08('0x48')],{})[_0xea08('0x25')](respondWithResult(_0x1ab087,0xc9))[_0xea08('0x41')](handleError(_0x1ab087,null));};exports['update']=function(_0x5cfc07,_0x42d504){if(_0x5cfc07[_0xea08('0x48')]['id']){delete _0x5cfc07[_0xea08('0x48')]['id'];}return db[_0xea08('0x2b')][_0xea08('0x46')]({'where':{'id':_0x5cfc07[_0xea08('0x49')]['id']}})[_0xea08('0x25')](handleEntityNotFound(_0x42d504,null))[_0xea08('0x25')](saveUpdates(_0x5cfc07[_0xea08('0x48')],null))[_0xea08('0x25')](respondWithResult(_0x42d504,null))['catch'](handleError(_0x42d504,null));};exports[_0xea08('0x26')]=function(_0x518a64,_0x2284ff){return db['FaxTransferReport'][_0xea08('0x46')]({'where':{'id':_0x518a64['params']['id']}})[_0xea08('0x25')](handleEntityNotFound(_0x2284ff,null))[_0xea08('0x25')](removeEntity(_0x2284ff,null))[_0xea08('0x41')](handleError(_0x2284ff,null));};exports[_0xea08('0x4a')]=function(_0x1520a3,_0x5536c1){return db[_0xea08('0x2b')][_0xea08('0x4a')]()[_0xea08('0x25')](respondWithResult(_0x5536c1,null))['catch'](handleError(_0x5536c1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 711ecc6..3b7e0a4 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 _0xfd46=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','report_fax_transfer','uniqueid'];(function(_0x278603,_0xc8cc1b){var _0x3a375f=function(_0x40b59c){while(--_0x40b59c){_0x278603['push'](_0x278603['shift']());}};_0x3a375f(++_0xc8cc1b);}(_0xfd46,0x176));var _0x6fd4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xfd46[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x6fd4('0x0'));var util=require('util');var logger=require(_0x6fd4('0x1'))(_0x6fd4('0x2'));var moment=require(_0x6fd4('0x3'));var BPromise=require(_0x6fd4('0x4'));var rp=require(_0x6fd4('0x5'));var fs=require('fs');var path=require(_0x6fd4('0x6'));var rimraf=require(_0x6fd4('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x127aaa,_0x21c88d){return _0x127aaa[_0x6fd4('0x8')]('FaxTransferReport',attributes,{'tableName':_0x6fd4('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6fd4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x256e=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','moment','bluebird'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x256e,0x176));var _0xe256=function(_0x4a1bdf,_0x33f0eb){_0x4a1bdf=_0x4a1bdf-0x0;var _0x5d4d7c=_0x256e[_0x4a1bdf];return _0x5d4d7c;};'use strict';var _=require(_0xe256('0x0'));var util=require(_0xe256('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe256('0x2'));var BPromise=require(_0xe256('0x3'));var rp=require(_0xe256('0x4'));var fs=require('fs');var path=require(_0xe256('0x5'));var rimraf=require(_0xe256('0x6'));var config=require(_0xe256('0x7'));var attributes=require(_0xe256('0x8'));module[_0xe256('0x9')]=function(_0x476113,_0xc9ebcc){return _0x476113[_0xe256('0xa')](_0xe256('0xb'),attributes,{'tableName':_0xe256('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe256('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index b3b916e..d52d6f9 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 _0x4116=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','FaxTransferReport,\x20%s,\x20%s','message'];(function(_0x1911a1,_0x107c16){var _0x33926f=function(_0x3d2ff5){while(--_0x3d2ff5){_0x1911a1['push'](_0x1911a1['shift']());}};_0x33926f(++_0x107c16);}(_0x4116,0x95));var _0x6411=function(_0x4a5f95,_0x1553d3){_0x4a5f95=_0x4a5f95-0x0;var _0x4dcfa5=_0x4116[_0x4a5f95];return _0x4dcfa5;};'use strict';var _=require(_0x6411('0x0'));var util=require(_0x6411('0x1'));var moment=require('moment');var BPromise=require(_0x6411('0x2'));var rs=require(_0x6411('0x3'));var fs=require('fs');var Redis=require(_0x6411('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6411('0x5'));var logger=require(_0x6411('0x6'))(_0x6411('0x7'));var config=require(_0x6411('0x8'));var jayson=require(_0x6411('0x9'));var client=jayson['client'][_0x6411('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f43bc,_0x56c88e,_0x315211){return new BPromise(function(_0x3143ce,_0x59c456){return client['request'](_0x4f43bc,_0x315211)[_0x6411('0xb')](function(_0x2c69ba){logger[_0x6411('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x56c88e,_0x6411('0xd'));logger[_0x6411('0xe')](_0x6411('0xf'),_0x56c88e,'request\x20sent',JSON['stringify'](_0x2c69ba));if(_0x2c69ba[_0x6411('0x10')]){if(_0x2c69ba[_0x6411('0x10')]['code']===0x1f4){logger[_0x6411('0x10')](_0x6411('0x11'),_0x56c88e,_0x2c69ba['error'][_0x6411('0x12')]);return _0x59c456(_0x2c69ba[_0x6411('0x10')][_0x6411('0x12')]);}logger[_0x6411('0x10')](_0x6411('0x11'),_0x56c88e,_0x2c69ba['error']['message']);return _0x3143ce(_0x2c69ba['error'][_0x6411('0x12')]);}else{logger[_0x6411('0xc')](_0x6411('0x11'),_0x56c88e,_0x6411('0xd'));_0x3143ce(_0x2c69ba[_0x6411('0x13')][_0x6411('0x12')]);}})[_0x6411('0x14')](function(_0x26399f){logger[_0x6411('0x10')](_0x6411('0x11'),_0x56c88e,_0x26399f);_0x59c456(_0x26399f);});});} \ No newline at end of file +var _0xfbbb=['lodash','bluebird','ioredis','../../config/logger','../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3a7b78,_0x585543){var _0xa36bdd=function(_0xdf3aa1){while(--_0xdf3aa1){_0x3a7b78['push'](_0x3a7b78['shift']());}};_0xa36bdd(++_0x585543);}(_0xfbbb,0x10e));var _0xbfbb=function(_0x2b03c2,_0x1e21dc){_0x2b03c2=_0x2b03c2-0x0;var _0x160b8e=_0xfbbb[_0x2b03c2];return _0x160b8e;};'use strict';var _=require(_0xbfbb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbfbb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfbb('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbfbb('0x3'))('rpc');var config=require(_0xbfbb('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xbfbb('0x5')][_0xbfbb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1492ec,_0x2a748b,_0x3a4b01){return new BPromise(function(_0xe51ed4,_0x422168){return client[_0xbfbb('0x7')](_0x1492ec,_0x3a4b01)[_0xbfbb('0x8')](function(_0x58ba16){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2a748b,'request\x20sent');logger[_0xbfbb('0x9')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2a748b,_0xbfbb('0xa'),JSON[_0xbfbb('0xb')](_0x58ba16));if(_0x58ba16[_0xbfbb('0xc')]){if(_0x58ba16['error']['code']===0x1f4){logger[_0xbfbb('0xc')](_0xbfbb('0xd'),_0x2a748b,_0x58ba16[_0xbfbb('0xc')][_0xbfbb('0xe')]);return _0x422168(_0x58ba16[_0xbfbb('0xc')][_0xbfbb('0xe')]);}logger[_0xbfbb('0xc')](_0xbfbb('0xd'),_0x2a748b,_0x58ba16[_0xbfbb('0xc')][_0xbfbb('0xe')]);return _0xe51ed4(_0x58ba16[_0xbfbb('0xc')][_0xbfbb('0xe')]);}else{logger[_0xbfbb('0xf')](_0xbfbb('0xd'),_0x2a748b,_0xbfbb('0xa'));_0xe51ed4(_0x58ba16[_0xbfbb('0x10')]['message']);}})[_0xbfbb('0x11')](function(_0x5ea1d4){logger[_0xbfbb('0xc')](_0xbfbb('0xd'),_0x2a748b,_0x5ea1d4);_0x422168(_0x5ea1d4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index f79765c..a1ca672 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 _0x64ec=['../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x532972,_0x23f2da){var _0x308435=function(_0x4d0ebc){while(--_0x4d0ebc){_0x532972['push'](_0x532972['shift']());}};_0x308435(++_0x23f2da);}(_0x64ec,0x72));var _0xc64e=function(_0xb4cb9,_0x3095f4){_0xb4cb9=_0xb4cb9-0x0;var _0x5afb94=_0x64ec[_0xb4cb9];return _0x5afb94;};'use strict';var multer=require(_0xc64e('0x0'));var util=require(_0xc64e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc64e('0x2'));var router=express[_0xc64e('0x3')]();var fs_extra=require(_0xc64e('0x4'));var auth=require(_0xc64e('0x5'));var interaction=require(_0xc64e('0x6'));var config=require('../../config/environment');var controller=require(_0xc64e('0x7'));router[_0xc64e('0x8')]('/',auth[_0xc64e('0x9')](),controller[_0xc64e('0xa')]);router[_0xc64e('0x8')](_0xc64e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xc64e('0x8')](_0xc64e('0xc'),auth[_0xc64e('0x9')](),controller[_0xc64e('0xd')]);router[_0xc64e('0xe')]('/',auth[_0xc64e('0x9')](),controller[_0xc64e('0xf')]);router[_0xc64e('0x10')](_0xc64e('0xc'),auth[_0xc64e('0x9')](),controller[_0xc64e('0x11')]);router[_0xc64e('0x12')]('/:id',auth[_0xc64e('0x9')](),controller['destroy']);module[_0xc64e('0x13')]=router; \ No newline at end of file +var _0x06a6=['show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id'];(function(_0x42f50b,_0x3d5fa7){var _0x454ece=function(_0x34e2a6){while(--_0x34e2a6){_0x42f50b['push'](_0x42f50b['shift']());}};_0x454ece(++_0x3d5fa7);}(_0x06a6,0xc5));var _0x606a=function(_0x428774,_0x383962){_0x428774=_0x428774-0x0;var _0x53a01c=_0x06a6[_0x428774];return _0x53a01c;};'use strict';var multer=require(_0x606a('0x0'));var util=require('util');var path=require(_0x606a('0x1'));var timeout=require(_0x606a('0x2'));var express=require(_0x606a('0x3'));var router=express['Router']();var fs_extra=require(_0x606a('0x4'));var auth=require(_0x606a('0x5'));var interaction=require(_0x606a('0x6'));var config=require(_0x606a('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x606a('0x8')]);router[_0x606a('0x9')]('/describe',auth[_0x606a('0xa')](),controller['describe']);router[_0x606a('0x9')](_0x606a('0xb'),auth[_0x606a('0xa')](),controller[_0x606a('0xc')]);router[_0x606a('0xd')]('/',auth['isAuthenticated'](),controller[_0x606a('0xe')]);router['put'](_0x606a('0xb'),auth[_0x606a('0xa')](),controller[_0x606a('0xf')]);router[_0x606a('0x10')](_0x606a('0xb'),auth[_0x606a('0xa')](),controller[_0x606a('0x11')]);module[_0x606a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 8a864d3..69a5591 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 _0x1f9b=['./intDeskAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa4f456,_0x22afbd){var _0x3797d7=function(_0x1a8bb1){while(--_0x1a8bb1){_0xa4f456['push'](_0xa4f456['shift']());}};_0x3797d7(++_0x22afbd);}(_0x1f9b,0xd4));var _0xb1f9=function(_0x3e6497,_0x26c5ab){_0x3e6497=_0x3e6497-0x0;var _0x2ae688=_0x1f9b[_0x3e6497];return _0x2ae688;};'use strict';var multer=require(_0xb1f9('0x0'));var util=require(_0xb1f9('0x1'));var path=require(_0xb1f9('0x2'));var timeout=require(_0xb1f9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb1f9('0x4'));var auth=require(_0xb1f9('0x5'));var interaction=require(_0xb1f9('0x6'));var config=require(_0xb1f9('0x7'));var controller=require(_0xb1f9('0x8'));router['get']('/',auth[_0xb1f9('0x9')](),controller[_0xb1f9('0xa')]);router['get']('/:id',auth[_0xb1f9('0x9')](),controller['show']);router[_0xb1f9('0xb')](_0xb1f9('0xc'),auth['isAuthenticated'](),controller[_0xb1f9('0xd')]);router[_0xb1f9('0xb')](_0xb1f9('0xe'),auth[_0xb1f9('0x9')](),controller[_0xb1f9('0xf')]);router[_0xb1f9('0x10')]('/',auth[_0xb1f9('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0xb1f9('0x9')](),controller[_0xb1f9('0x11')]);router['put'](_0xb1f9('0x12'),auth[_0xb1f9('0x9')](),controller[_0xb1f9('0x13')]);router[_0xb1f9('0x14')]('/:id',auth[_0xb1f9('0x9')](),controller['destroy']);module[_0xb1f9('0x15')]=router; \ No newline at end of file +var _0x0e2a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x48d9e5,_0x42f22f){var _0x4d9d3a=function(_0x145d65){while(--_0x145d65){_0x48d9e5['push'](_0x48d9e5['shift']());}};_0x4d9d3a(++_0x42f22f);}(_0x0e2a,0x19c));var _0xa0e2=function(_0x4697fa,_0x21c841){_0x4697fa=_0x4697fa-0x0;var _0x390950=_0x0e2a[_0x4697fa];return _0x390950;};'use strict';var multer=require(_0xa0e2('0x0'));var util=require(_0xa0e2('0x1'));var path=require('path');var timeout=require(_0xa0e2('0x2'));var express=require('express');var router=express[_0xa0e2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa0e2('0x4'));var interaction=require(_0xa0e2('0x5'));var config=require(_0xa0e2('0x6'));var controller=require(_0xa0e2('0x7'));router[_0xa0e2('0x8')]('/',auth['isAuthenticated'](),controller[_0xa0e2('0x9')]);router[_0xa0e2('0x8')](_0xa0e2('0xa'),auth[_0xa0e2('0xb')](),controller[_0xa0e2('0xc')]);router[_0xa0e2('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa0e2('0xd')]);router[_0xa0e2('0x8')](_0xa0e2('0xe'),auth['isAuthenticated'](),controller[_0xa0e2('0xf')]);router[_0xa0e2('0x10')]('/',auth[_0xa0e2('0xb')](),controller[_0xa0e2('0x11')]);router['post']('/:id/configurations',auth[_0xa0e2('0xb')](),controller[_0xa0e2('0x12')]);router[_0xa0e2('0x13')](_0xa0e2('0xa'),auth[_0xa0e2('0xb')](),controller[_0xa0e2('0x14')]);router[_0xa0e2('0x15')]('/:id',auth[_0xa0e2('0xb')](),controller[_0xa0e2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 6b51750..56662ef 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 _0x7f9f=['basic','integrationTab','newTab','exports','STRING','ENUM'];(function(_0x3f2223,_0x1ca79a){var _0x1bcc92=function(_0x78134){while(--_0x78134){_0x3f2223['push'](_0x3f2223['shift']());}};_0x1bcc92(++_0x1ca79a);}(_0x7f9f,0x1d1));var _0xf7f9=function(_0x12270c,_0x55ed05){_0x12270c=_0x12270c-0x0;var _0xf37079=_0x7f9f[_0x12270c];return _0xf37079;};'use strict';var Sequelize=require('sequelize');module[_0xf7f9('0x0')]={'name':{'type':Sequelize[_0xf7f9('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf7f9('0x1')]},'remoteUri':{'type':Sequelize[_0xf7f9('0x1')]},'authType':{'type':Sequelize[_0xf7f9('0x2')](_0xf7f9('0x3')),'defaultValue':_0xf7f9('0x3')},'password':{'type':Sequelize[_0xf7f9('0x1')]},'consumerKey':{'type':Sequelize[_0xf7f9('0x1')]},'consumerSecret':{'type':Sequelize[_0xf7f9('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xf7f9('0x1')]},'serverUrl':{'type':Sequelize[_0xf7f9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf7f9('0x2')](_0xf7f9('0x4'),_0xf7f9('0x5')),'defaultValue':_0xf7f9('0x4')}}; \ No newline at end of file +var _0x61f1=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x61f1,0xf9));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x161f('0x0'));module[_0x161f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x161f('0x2')]},'username':{'type':Sequelize[_0x161f('0x2')]},'remoteUri':{'type':Sequelize[_0x161f('0x2')]},'authType':{'type':Sequelize[_0x161f('0x3')](_0x161f('0x4')),'defaultValue':_0x161f('0x4')},'password':{'type':Sequelize[_0x161f('0x2')]},'consumerKey':{'type':Sequelize[_0x161f('0x2')]},'consumerSecret':{'type':Sequelize[_0x161f('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x161f('0x2')]},'serverUrl':{'type':Sequelize[_0x161f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x161f('0x3')](_0x161f('0x5'),_0x161f('0x6')),'defaultValue':_0x161f('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a6ae9d1..566fb6f 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 _0xc02f=['sort','where','filters','filter','type','VIRTUAL','merge','options','count','include','DeskAccount','findAll','rows','catch','params','includeAll','find','create','body','getConfigurations','DeskConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','base64','concat','_embedded','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xc02f,0x120));var _0xfc02=function(_0x54614e,_0x23ee3d){_0x54614e=_0x54614e-0x0;var _0x13ba26=_0xc02f[_0x54614e];return _0x13ba26;};'use strict';var emlformat=require(_0xfc02('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc02('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc02('0x2'));var Mustache=require(_0xfc02('0x3'));var util=require(_0xfc02('0x4'));var path=require(_0xfc02('0x5'));var sox=require(_0xfc02('0x6'));var csv=require(_0xfc02('0x7'));var ejs=require(_0xfc02('0x8'));var fs=require('fs');var fs_extra=require(_0xfc02('0x9'));var _=require('lodash');var squel=require(_0xfc02('0xa'));var crypto=require(_0xfc02('0xb'));var jsforce=require(_0xfc02('0xc'));var deskjs=require(_0xfc02('0xd'));var toCsv=require(_0xfc02('0x7'));var querystring=require(_0xfc02('0xe'));var Papa=require(_0xfc02('0xf'));var Redis=require(_0xfc02('0x10'));var authService=require(_0xfc02('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfc02('0x12'));var config=require(_0xfc02('0x13'));var licenseUtil=require(_0xfc02('0x14'));var db=require(_0xfc02('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x175eb7,_0xbca460){_0xbca460=_0xbca460||0xcc;return function(_0x20cd0e){if(_0x20cd0e){return _0x175eb7[_0xfc02('0x16')](_0xbca460);}return _0x175eb7['status'](_0xbca460)[_0xfc02('0x17')]();};}function respondWithResult(_0x401efe,_0x5b9653){_0x5b9653=_0x5b9653||0xc8;return function(_0x57f28d){if(_0x57f28d){return _0x401efe[_0xfc02('0x18')](_0x5b9653)[_0xfc02('0x19')](_0x57f28d);}};}function respondWithFilteredResult(_0x5be8ac,_0x3d095c){return function(_0x239aba){if(_0x239aba){var _0x2d24b2=typeof _0x3d095c[_0xfc02('0x1a')]===_0xfc02('0x1b')&&typeof _0x3d095c[_0xfc02('0x1c')]==='undefined';var _0x2da775=_0x239aba['count'];var _0xcc1d90=_0x2d24b2?0x0:_0x3d095c[_0xfc02('0x1a')];var _0x51c9fe=_0x2d24b2?_0x239aba['count']:_0x3d095c['offset']+_0x3d095c[_0xfc02('0x1c')];var _0x5ba172;if(_0x51c9fe>=_0x2da775){_0x51c9fe=_0x2da775;_0x5ba172=0xc8;}else{_0x5ba172=0xce;}_0x5be8ac[_0xfc02('0x18')](_0x5ba172);return _0x5be8ac['set'](_0xfc02('0x1d'),_0xcc1d90+'-'+_0x51c9fe+'/'+_0x2da775)[_0xfc02('0x19')](_0x239aba);}return null;};}function patchUpdates(_0x2bcb27){return function(_0x27a390){try{jsonpatch[_0xfc02('0x1e')](_0x27a390,_0x2bcb27,!![]);}catch(_0xeebdba){return BPromise[_0xfc02('0x1f')](_0xeebdba);}return _0x27a390[_0xfc02('0x20')]();};}function saveUpdates(_0x5c8b6a,_0x19a762){return function(_0x1ff477){if(_0x1ff477){return _0x1ff477[_0xfc02('0x21')](_0x5c8b6a)[_0xfc02('0x22')](function(_0x22f55e){return _0x22f55e;});}return null;};}function removeEntity(_0x3e14ba,_0x586a6d){return function(_0x54d0dd){if(_0x54d0dd){return _0x54d0dd[_0xfc02('0x23')]()[_0xfc02('0x22')](function(){_0x3e14ba[_0xfc02('0x18')](0xcc)[_0xfc02('0x17')]();});}};}function handleEntityNotFound(_0x5599c7,_0x566679){return function(_0x1ba8cb){if(!_0x1ba8cb){_0x5599c7[_0xfc02('0x16')](0x194);}return _0x1ba8cb;};}function handleError(_0x20851e,_0x5f5a95){_0x5f5a95=_0x5f5a95||0x1f4;return function(_0x368d6c){logger[_0xfc02('0x24')](_0x368d6c[_0xfc02('0x25')]);if(_0x368d6c[_0xfc02('0x26')]){delete _0x368d6c[_0xfc02('0x26')];}_0x20851e[_0xfc02('0x18')](_0x5f5a95)[_0xfc02('0x27')](_0x368d6c);};}exports['index']=function(_0x5f2dda,_0x587440){var _0x10ada2={},_0x4d627a={},_0x4ff374={'count':0x0,'rows':[]};var _0x2f9fc1=_[_0xfc02('0x28')](db['DeskAccount'][_0xfc02('0x29')],function(_0x9f1719){return{'name':_0x9f1719[_0xfc02('0x2a')],'type':_0x9f1719['type'][_0xfc02('0x2b')]};});_0x4d627a[_0xfc02('0x2c')]=_['map'](_0x2f9fc1,_0xfc02('0x26'));_0x4d627a[_0xfc02('0x2d')]=_[_0xfc02('0x2e')](_0x5f2dda[_0xfc02('0x2d')]);_0x4d627a['filters']=_[_0xfc02('0x2f')](_0x4d627a[_0xfc02('0x2c')],_0x4d627a[_0xfc02('0x2d')]);_0x10ada2['attributes']=_[_0xfc02('0x2f')](_0x4d627a[_0xfc02('0x2c')],qs['fields'](_0x5f2dda[_0xfc02('0x2d')][_0xfc02('0x30')]));_0x10ada2[_0xfc02('0x31')]=_0x10ada2[_0xfc02('0x31')][_0xfc02('0x32')]?_0x10ada2['attributes']:_0x4d627a[_0xfc02('0x2c')];if(!_0x5f2dda[_0xfc02('0x2d')][_0xfc02('0x33')](_0xfc02('0x34'))){_0x10ada2[_0xfc02('0x1c')]=qs[_0xfc02('0x1c')](_0x5f2dda['query']['limit']);_0x10ada2[_0xfc02('0x1a')]=qs[_0xfc02('0x1a')](_0x5f2dda[_0xfc02('0x2d')][_0xfc02('0x1a')]);}_0x10ada2[_0xfc02('0x35')]=qs[_0xfc02('0x36')](_0x5f2dda['query']['sort']);_0x10ada2[_0xfc02('0x37')]=qs[_0xfc02('0x38')](_['pick'](_0x5f2dda[_0xfc02('0x2d')],_0x4d627a['filters']),_0x2f9fc1);if(_0x5f2dda[_0xfc02('0x2d')][_0xfc02('0x39')]){_0x10ada2[_0xfc02('0x37')]=_['merge'](_0x10ada2[_0xfc02('0x37')],{'$or':_[_0xfc02('0x28')](_0x2f9fc1,function(_0x208bf9){if(_0x208bf9[_0xfc02('0x3a')]!==_0xfc02('0x3b')){var _0x524bfd={};_0x524bfd[_0x208bf9[_0xfc02('0x26')]]={'$like':'%'+_0x5f2dda['query'][_0xfc02('0x39')]+'%'};return _0x524bfd;}})});}_0x10ada2=_[_0xfc02('0x3c')]({},_0x10ada2,_0x5f2dda[_0xfc02('0x3d')]);var _0x4d63ac={'where':_0x10ada2[_0xfc02('0x37')]};return db['DeskAccount'][_0xfc02('0x3e')](_0x4d63ac)[_0xfc02('0x22')](function(_0x2a754c){_0x4ff374[_0xfc02('0x3e')]=_0x2a754c;if(_0x5f2dda['query']['includeAll']){_0x10ada2[_0xfc02('0x3f')]=[{'all':!![]}];}return db[_0xfc02('0x40')][_0xfc02('0x41')](_0x10ada2);})[_0xfc02('0x22')](function(_0x4d64c9){_0x4ff374[_0xfc02('0x42')]=_0x4d64c9;return _0x4ff374;})[_0xfc02('0x22')](respondWithFilteredResult(_0x587440,_0x10ada2))[_0xfc02('0x43')](handleError(_0x587440,null));};exports['show']=function(_0x4a90bf,_0x30f943){var _0x61ff3c={'raw':![],'where':{'id':_0x4a90bf[_0xfc02('0x44')]['id']}},_0x392e99={};_0x392e99[_0xfc02('0x2c')]=_[_0xfc02('0x2e')](db[_0xfc02('0x40')][_0xfc02('0x29')]);_0x392e99[_0xfc02('0x2d')]=_[_0xfc02('0x2e')](_0x4a90bf[_0xfc02('0x2d')]);_0x392e99[_0xfc02('0x38')]=_[_0xfc02('0x2f')](_0x392e99['model'],_0x392e99[_0xfc02('0x2d')]);_0x61ff3c[_0xfc02('0x31')]=_['intersection'](_0x392e99[_0xfc02('0x2c')],qs[_0xfc02('0x30')](_0x4a90bf[_0xfc02('0x2d')][_0xfc02('0x30')]));_0x61ff3c['attributes']=_0x61ff3c[_0xfc02('0x31')]['length']?_0x61ff3c['attributes']:_0x392e99['model'];if(_0x4a90bf[_0xfc02('0x2d')][_0xfc02('0x45')]){_0x61ff3c[_0xfc02('0x3f')]=[{'all':!![]}];}_0x61ff3c=_[_0xfc02('0x3c')]({},_0x61ff3c,_0x4a90bf['options']);return db['DeskAccount'][_0xfc02('0x46')](_0x61ff3c)[_0xfc02('0x22')](handleEntityNotFound(_0x30f943,null))[_0xfc02('0x22')](respondWithResult(_0x30f943,null))['catch'](handleError(_0x30f943,null));};exports[_0xfc02('0x47')]=function(_0x26df97,_0x126113){return db['DeskAccount'][_0xfc02('0x47')](_0x26df97[_0xfc02('0x48')],{})[_0xfc02('0x22')](respondWithResult(_0x126113,0xc9))[_0xfc02('0x43')](handleError(_0x126113,null));};exports[_0xfc02('0x21')]=function(_0x2a17d6,_0x506fdc){if(_0x2a17d6[_0xfc02('0x48')]['id']){delete _0x2a17d6[_0xfc02('0x48')]['id'];}return db[_0xfc02('0x40')]['find']({'where':{'id':_0x2a17d6[_0xfc02('0x44')]['id']}})[_0xfc02('0x22')](handleEntityNotFound(_0x506fdc,null))['then'](saveUpdates(_0x2a17d6[_0xfc02('0x48')],null))[_0xfc02('0x22')](respondWithResult(_0x506fdc,null))[_0xfc02('0x43')](handleError(_0x506fdc,null));};exports['destroy']=function(_0x3c15c4,_0x4783bf){return db['DeskAccount'][_0xfc02('0x46')]({'where':{'id':_0x3c15c4['params']['id']}})[_0xfc02('0x22')](handleEntityNotFound(_0x4783bf,null))[_0xfc02('0x22')](removeEntity(_0x4783bf,null))[_0xfc02('0x43')](handleError(_0x4783bf,null));};exports[_0xfc02('0x49')]=function(_0x15aafd,_0x3432ab,_0x57ce35){var _0x4b3258={};var _0x394a10={};var _0x4722d4;var _0x16d3d3;return db[_0xfc02('0x40')]['findOne']({'where':{'id':_0x15aafd[_0xfc02('0x44')]['id']}})[_0xfc02('0x22')](handleEntityNotFound(_0x3432ab,null))[_0xfc02('0x22')](function(_0x2f4ee6){if(_0x2f4ee6){_0x4722d4=_0x2f4ee6;_0x394a10[_0xfc02('0x2c')]=_[_0xfc02('0x2e')](db[_0xfc02('0x4a')][_0xfc02('0x29')]);_0x394a10[_0xfc02('0x2d')]=_['keys'](_0x15aafd[_0xfc02('0x2d')]);_0x394a10[_0xfc02('0x38')]=_[_0xfc02('0x2f')](_0x394a10['model'],_0x394a10[_0xfc02('0x2d')]);_0x4b3258['attributes']=_[_0xfc02('0x2f')](_0x394a10[_0xfc02('0x2c')],qs[_0xfc02('0x30')](_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x30')]));_0x4b3258[_0xfc02('0x31')]=_0x4b3258['attributes']['length']?_0x4b3258[_0xfc02('0x31')]:_0x394a10['model'];_0x4b3258[_0xfc02('0x35')]=qs[_0xfc02('0x36')](_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x36')]);_0x4b3258[_0xfc02('0x37')]=qs[_0xfc02('0x38')](_[_0xfc02('0x4b')](_0x15aafd[_0xfc02('0x2d')],_0x394a10[_0xfc02('0x38')]));if(_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x39')]){_0x4b3258['where']=_[_0xfc02('0x3c')](_0x4b3258[_0xfc02('0x37')],{'$or':_[_0xfc02('0x28')](_0x4b3258['attributes'],function(_0x626816){var _0x597f95={};_0x597f95[_0x626816]={'$like':'%'+_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x39')]+'%'};return _0x597f95;})});}_0x4b3258=_[_0xfc02('0x3c')]({},_0x4b3258,_0x15aafd[_0xfc02('0x3d')]);return _0x4722d4[_0xfc02('0x49')](_0x4b3258);}})[_0xfc02('0x22')](function(_0x227a2b){if(_0x227a2b){_0x16d3d3=_0x227a2b[_0xfc02('0x32')];if(!_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x33')](_0xfc02('0x34'))){_0x4b3258[_0xfc02('0x1c')]=qs[_0xfc02('0x1c')](_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x1c')]);_0x4b3258[_0xfc02('0x1a')]=qs['offset'](_0x15aafd[_0xfc02('0x2d')][_0xfc02('0x1a')]);}return _0x4722d4[_0xfc02('0x49')](_0x4b3258);}})['then'](function(_0xb1c69f){if(_0xb1c69f){return _0xb1c69f?{'count':_0x16d3d3,'rows':_0xb1c69f}:null;}})[_0xfc02('0x22')](respondWithResult(_0x3432ab,null))['catch'](handleError(_0x3432ab,null));};exports[_0xfc02('0x4c')]=function(_0x475e4e,_0x588fc,_0x2d9f94){if(_0x475e4e[_0xfc02('0x48')]['id']){delete _0x475e4e[_0xfc02('0x48')]['id'];}return db[_0xfc02('0x40')][_0xfc02('0x4d')]({'where':{'id':_0x475e4e['params']['id']}})[_0xfc02('0x22')](handleEntityNotFound(_0x588fc,null))[_0xfc02('0x22')](function(_0x20404a){if(_0x20404a){_0x475e4e[_0xfc02('0x48')][_0xfc02('0x4e')]=_0x20404a['id'];_0x475e4e[_0xfc02('0x48')][_0xfc02('0x4f')]=integrations[_0xfc02('0x50')](_0x475e4e[_0xfc02('0x48')][_0xfc02('0x51')],_0x475e4e[_0xfc02('0x48')]['type']);_0x475e4e[_0xfc02('0x48')][_0xfc02('0x52')]=integrations['getDescriptions'](_0x475e4e[_0xfc02('0x48')][_0xfc02('0x51')],_0x475e4e[_0xfc02('0x48')]['type']);return db[_0xfc02('0x4a')]['create'](_0x475e4e['body'],{'include':[{'model':db[_0xfc02('0x53')],'as':_0xfc02('0x4f')},{'model':db[_0xfc02('0x53')],'as':'Descriptions'}]});}return null;})[_0xfc02('0x22')](respondWithResult(_0x588fc,null))[_0xfc02('0x43')](handleError(_0x588fc,null));};exports[_0xfc02('0x54')]=function(_0x46cca7,_0x11fb1c,_0x23cd06){var _0x1f1c77=[{'name':_0xfc02('0x55'),'label':_0xfc02('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 _0x1aa64d='';return db[_0xfc02('0x40')][_0xfc02('0x4d')]({'where':{'id':_0x46cca7[_0xfc02('0x44')]['id']},'attributes':['id',_0xfc02('0x56'),_0xfc02('0x57'),_0xfc02('0x58'),_0xfc02('0x59'),_0xfc02('0x5a'),_0xfc02('0x5b'),_0xfc02('0x5c'),_0xfc02('0x5d')]})['then'](handleEntityNotFound(_0x11fb1c,null))[_0xfc02('0x22')](function(_0x1107a4){if(_0x1107a4){_0x1aa64d=_0x1107a4['remoteUri'];var _0x32577f=_0x1aa64d[_0xfc02('0x5e')](-0x1);if(_0x32577f==='/'){_0x1aa64d=_0x1aa64d[_0xfc02('0x5f')](0x0,_0x1aa64d[_0xfc02('0x60')](_0x32577f));}var _0x48206d={'method':_0xfc02('0x61'),'uri':util[_0xfc02('0x62')](_0xfc02('0x63'),_0x1aa64d),'headers':{'Content-Type':_0xfc02('0x64'),'Accept':'application/json'},'json':!![]};if(_0x1107a4[_0xfc02('0x57')]==='basic'){_0x48206d[_0xfc02('0x65')][_0xfc02('0x66')]=util[_0xfc02('0x62')](_0xfc02('0x67'),new Buffer(util[_0xfc02('0x62')]('%s:%s',_0x1107a4[_0xfc02('0x58')],_0x1107a4[_0xfc02('0x59')]))['toString'](_0xfc02('0x68')));}return rp(_0x48206d)['then'](function(_0x4753c7){return _0x1f1c77[_0xfc02('0x69')](_[_0xfc02('0x28')](_0x4753c7[_0xfc02('0x6a')][_0xfc02('0x6b')],function(_0x19c4b5){return{'id':_0x19c4b5[_0xfc02('0x26')],'name':_0x19c4b5[_0xfc02('0x26')],'type':_0x19c4b5['type'],'active':_0x19c4b5[_0xfc02('0x6c')],'label':_0x19c4b5[_0xfc02('0x6d')],'custom':!![]};}));});}})[_0xfc02('0x22')](function(_0x357c4c){return{'count':_0x357c4c[_0xfc02('0x32')],'rows':_0x357c4c};})[_0xfc02('0x22')](respondWithResult(_0x11fb1c,null))[_0xfc02('0x43')](function(_0x304375){var _0x2fb137=_0x46cca7[_0xfc02('0x2d')][_0xfc02('0x6e')]?0x1f4:_0x304375[_0xfc02('0x6f')]||0x1f4;logger[_0xfc02('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xfc02('0x54'),_0x2fb137,JSON[_0xfc02('0x70')](_0x304375));delete _0x304375[_0xfc02('0x26')];if(_0x2fb137===0x191){_0x2fb137=0x190;}_0x11fb1c[_0xfc02('0x18')](_0x2fb137)[_0xfc02('0x27')](_0x46cca7[_0xfc02('0x2d')][_0xfc02('0x6e')]?{'message':_0xfc02('0x71'),'statusCode':_0x304375[_0xfc02('0x6f')]}:_0x304375);});}; \ No newline at end of file +var _0xa8c8=['order','sort','where','filter','merge','type','VIRTUAL','options','DeskAccount','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','DeskConfiguration','pick','addConfiguration','Subjects','channel','Descriptions','getFields','priority','findOne','remoteUri','authType','username','consumerKey','consumerSecret','substring','GET','format','application/json','headers','Authorization','Basic\x20%s','password','toString','concat','entries','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x27d59c,_0x4964e9){var _0x5986c4=function(_0x1514f3){while(--_0x1514f3){_0x27d59c['push'](_0x27d59c['shift']());}};_0x5986c4(++_0x4964e9);}(_0xa8c8,0x1c9));var _0x8a8c=function(_0x1d2dcb,_0x5f0d44){_0x1d2dcb=_0x1d2dcb-0x0;var _0x3a77ad=_0xa8c8[_0x1d2dcb];return _0x3a77ad;};'use strict';var emlformat=require(_0x8a8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a8c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a8c('0x2'));var moment=require(_0x8a8c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8a8c('0x4'));var util=require(_0x8a8c('0x5'));var path=require(_0x8a8c('0x6'));var sox=require(_0x8a8c('0x7'));var csv=require(_0x8a8c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a8c('0x9'));var _=require(_0x8a8c('0xa'));var squel=require(_0x8a8c('0xb'));var crypto=require('crypto');var jsforce=require(_0x8a8c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8a8c('0x8'));var querystring=require(_0x8a8c('0xd'));var Papa=require(_0x8a8c('0xe'));var Redis=require(_0x8a8c('0xf'));var authService=require(_0x8a8c('0x10'));var qs=require(_0x8a8c('0x11'));var as=require(_0x8a8c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a8c('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8a8c('0x14'));var db=require(_0x8a8c('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4b4b7a,_0x3d4190){_0x3d4190=_0x3d4190||0xcc;return function(_0x76bd9e){if(_0x76bd9e){return _0x4b4b7a['sendStatus'](_0x3d4190);}return _0x4b4b7a[_0x8a8c('0x16')](_0x3d4190)[_0x8a8c('0x17')]();};}function respondWithResult(_0x50e3a1,_0x207c1a){_0x207c1a=_0x207c1a||0xc8;return function(_0x26fc1c){if(_0x26fc1c){return _0x50e3a1[_0x8a8c('0x16')](_0x207c1a)[_0x8a8c('0x18')](_0x26fc1c);}};}function respondWithFilteredResult(_0x773e81,_0x13f4e2){return function(_0x148c9c){if(_0x148c9c){var _0x17b3b1=typeof _0x13f4e2[_0x8a8c('0x19')]===_0x8a8c('0x1a')&&typeof _0x13f4e2[_0x8a8c('0x1b')]===_0x8a8c('0x1a');var _0xcd2979=_0x148c9c[_0x8a8c('0x1c')];var _0x50f2d3=_0x17b3b1?0x0:_0x13f4e2[_0x8a8c('0x19')];var _0x51c6ea=_0x17b3b1?_0x148c9c['count']:_0x13f4e2[_0x8a8c('0x19')]+_0x13f4e2[_0x8a8c('0x1b')];var _0x12d9e2;if(_0x51c6ea>=_0xcd2979){_0x51c6ea=_0xcd2979;_0x12d9e2=0xc8;}else{_0x12d9e2=0xce;}_0x773e81[_0x8a8c('0x16')](_0x12d9e2);return _0x773e81['set'](_0x8a8c('0x1d'),_0x50f2d3+'-'+_0x51c6ea+'/'+_0xcd2979)[_0x8a8c('0x18')](_0x148c9c);}return null;};}function patchUpdates(_0x1aae14){return function(_0x4c9843){try{jsonpatch[_0x8a8c('0x1e')](_0x4c9843,_0x1aae14,!![]);}catch(_0x272235){return BPromise['reject'](_0x272235);}return _0x4c9843[_0x8a8c('0x1f')]();};}function saveUpdates(_0x11e66b,_0x5343ac){return function(_0x46d6bd){if(_0x46d6bd){return _0x46d6bd[_0x8a8c('0x20')](_0x11e66b)['then'](function(_0x30a523){return _0x30a523;});}return null;};}function removeEntity(_0x393408,_0x3efcca){return function(_0x413fa9){if(_0x413fa9){return _0x413fa9[_0x8a8c('0x21')]()[_0x8a8c('0x22')](function(){_0x393408[_0x8a8c('0x16')](0xcc)[_0x8a8c('0x17')]();});}};}function handleEntityNotFound(_0x1e5309,_0xe1bab3){return function(_0x55d182){if(!_0x55d182){_0x1e5309[_0x8a8c('0x23')](0x194);}return _0x55d182;};}function handleError(_0xaaa5c5,_0x567847){_0x567847=_0x567847||0x1f4;return function(_0x198755){logger['error'](_0x198755[_0x8a8c('0x24')]);if(_0x198755[_0x8a8c('0x25')]){delete _0x198755['name'];}_0xaaa5c5['status'](_0x567847)[_0x8a8c('0x26')](_0x198755);};}exports[_0x8a8c('0x27')]=function(_0x622a47,_0x240f43){var _0x19384e={},_0x377247={},_0x5d2204={'count':0x0,'rows':[]};var _0x350f90=_[_0x8a8c('0x28')](db['DeskAccount'][_0x8a8c('0x29')],function(_0x16ed62){return{'name':_0x16ed62['fieldName'],'type':_0x16ed62['type'][_0x8a8c('0x2a')]};});_0x377247[_0x8a8c('0x2b')]=_['map'](_0x350f90,_0x8a8c('0x25'));_0x377247[_0x8a8c('0x2c')]=_[_0x8a8c('0x2d')](_0x622a47[_0x8a8c('0x2c')]);_0x377247[_0x8a8c('0x2e')]=_[_0x8a8c('0x2f')](_0x377247[_0x8a8c('0x2b')],_0x377247[_0x8a8c('0x2c')]);_0x19384e['attributes']=_[_0x8a8c('0x2f')](_0x377247[_0x8a8c('0x2b')],qs[_0x8a8c('0x30')](_0x622a47[_0x8a8c('0x2c')]['fields']));_0x19384e[_0x8a8c('0x31')]=_0x19384e[_0x8a8c('0x31')][_0x8a8c('0x32')]?_0x19384e[_0x8a8c('0x31')]:_0x377247['model'];if(!_0x622a47[_0x8a8c('0x2c')][_0x8a8c('0x33')](_0x8a8c('0x34'))){_0x19384e[_0x8a8c('0x1b')]=qs['limit'](_0x622a47['query'][_0x8a8c('0x1b')]);_0x19384e['offset']=qs[_0x8a8c('0x19')](_0x622a47[_0x8a8c('0x2c')][_0x8a8c('0x19')]);}_0x19384e[_0x8a8c('0x35')]=qs['sort'](_0x622a47[_0x8a8c('0x2c')][_0x8a8c('0x36')]);_0x19384e[_0x8a8c('0x37')]=qs[_0x8a8c('0x2e')](_['pick'](_0x622a47[_0x8a8c('0x2c')],_0x377247[_0x8a8c('0x2e')]),_0x350f90);if(_0x622a47[_0x8a8c('0x2c')][_0x8a8c('0x38')]){_0x19384e[_0x8a8c('0x37')]=_[_0x8a8c('0x39')](_0x19384e['where'],{'$or':_[_0x8a8c('0x28')](_0x350f90,function(_0xdb0a43){if(_0xdb0a43[_0x8a8c('0x3a')]!==_0x8a8c('0x3b')){var _0x473bcb={};_0x473bcb[_0xdb0a43['name']]={'$like':'%'+_0x622a47[_0x8a8c('0x2c')][_0x8a8c('0x38')]+'%'};return _0x473bcb;}})});}_0x19384e=_[_0x8a8c('0x39')]({},_0x19384e,_0x622a47[_0x8a8c('0x3c')]);var _0x595369={'where':_0x19384e[_0x8a8c('0x37')]};return db[_0x8a8c('0x3d')][_0x8a8c('0x1c')](_0x595369)[_0x8a8c('0x22')](function(_0x299d73){_0x5d2204['count']=_0x299d73;if(_0x622a47[_0x8a8c('0x2c')][_0x8a8c('0x3e')]){_0x19384e[_0x8a8c('0x3f')]=[{'all':!![]}];}return db[_0x8a8c('0x3d')][_0x8a8c('0x40')](_0x19384e);})[_0x8a8c('0x22')](function(_0x1d7132){_0x5d2204[_0x8a8c('0x41')]=_0x1d7132;return _0x5d2204;})['then'](respondWithFilteredResult(_0x240f43,_0x19384e))['catch'](handleError(_0x240f43,null));};exports['show']=function(_0x14544d,_0x26f501){var _0x16bfb1={'raw':![],'where':{'id':_0x14544d[_0x8a8c('0x42')]['id']}},_0x300ce6={};_0x300ce6[_0x8a8c('0x2b')]=_['keys'](db[_0x8a8c('0x3d')][_0x8a8c('0x29')]);_0x300ce6['query']=_[_0x8a8c('0x2d')](_0x14544d[_0x8a8c('0x2c')]);_0x300ce6[_0x8a8c('0x2e')]=_['intersection'](_0x300ce6[_0x8a8c('0x2b')],_0x300ce6['query']);_0x16bfb1[_0x8a8c('0x31')]=_[_0x8a8c('0x2f')](_0x300ce6['model'],qs['fields'](_0x14544d[_0x8a8c('0x2c')][_0x8a8c('0x30')]));_0x16bfb1[_0x8a8c('0x31')]=_0x16bfb1[_0x8a8c('0x31')][_0x8a8c('0x32')]?_0x16bfb1[_0x8a8c('0x31')]:_0x300ce6[_0x8a8c('0x2b')];if(_0x14544d[_0x8a8c('0x2c')][_0x8a8c('0x3e')]){_0x16bfb1[_0x8a8c('0x3f')]=[{'all':!![]}];}_0x16bfb1=_[_0x8a8c('0x39')]({},_0x16bfb1,_0x14544d[_0x8a8c('0x3c')]);return db[_0x8a8c('0x3d')][_0x8a8c('0x43')](_0x16bfb1)[_0x8a8c('0x22')](handleEntityNotFound(_0x26f501,null))[_0x8a8c('0x22')](respondWithResult(_0x26f501,null))[_0x8a8c('0x44')](handleError(_0x26f501,null));};exports[_0x8a8c('0x45')]=function(_0xab9f0f,_0x500f5d){return db['DeskAccount'][_0x8a8c('0x45')](_0xab9f0f['body'],{})[_0x8a8c('0x22')](respondWithResult(_0x500f5d,0xc9))[_0x8a8c('0x44')](handleError(_0x500f5d,null));};exports[_0x8a8c('0x20')]=function(_0x27dfc7,_0x5d1b56){if(_0x27dfc7[_0x8a8c('0x46')]['id']){delete _0x27dfc7[_0x8a8c('0x46')]['id'];}return db['DeskAccount'][_0x8a8c('0x43')]({'where':{'id':_0x27dfc7[_0x8a8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d1b56,null))['then'](saveUpdates(_0x27dfc7['body'],null))[_0x8a8c('0x22')](respondWithResult(_0x5d1b56,null))['catch'](handleError(_0x5d1b56,null));};exports[_0x8a8c('0x21')]=function(_0x1535d0,_0x55d76a){return db['DeskAccount'][_0x8a8c('0x43')]({'where':{'id':_0x1535d0[_0x8a8c('0x42')]['id']}})[_0x8a8c('0x22')](handleEntityNotFound(_0x55d76a,null))[_0x8a8c('0x22')](removeEntity(_0x55d76a,null))[_0x8a8c('0x44')](handleError(_0x55d76a,null));};exports[_0x8a8c('0x47')]=function(_0xf10cf1,_0x2ebe37,_0x2ef046){var _0x33b3b5={};var _0x4a2968={};var _0x52ce86;var _0x2f4691;return db['DeskAccount']['findOne']({'where':{'id':_0xf10cf1[_0x8a8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ebe37,null))['then'](function(_0x4cbb16){if(_0x4cbb16){_0x52ce86=_0x4cbb16;_0x4a2968[_0x8a8c('0x2b')]=_[_0x8a8c('0x2d')](db[_0x8a8c('0x48')]['rawAttributes']);_0x4a2968['query']=_[_0x8a8c('0x2d')](_0xf10cf1[_0x8a8c('0x2c')]);_0x4a2968[_0x8a8c('0x2e')]=_[_0x8a8c('0x2f')](_0x4a2968[_0x8a8c('0x2b')],_0x4a2968[_0x8a8c('0x2c')]);_0x33b3b5[_0x8a8c('0x31')]=_[_0x8a8c('0x2f')](_0x4a2968['model'],qs['fields'](_0xf10cf1['query'][_0x8a8c('0x30')]));_0x33b3b5[_0x8a8c('0x31')]=_0x33b3b5[_0x8a8c('0x31')][_0x8a8c('0x32')]?_0x33b3b5['attributes']:_0x4a2968[_0x8a8c('0x2b')];_0x33b3b5[_0x8a8c('0x35')]=qs['sort'](_0xf10cf1['query'][_0x8a8c('0x36')]);_0x33b3b5[_0x8a8c('0x37')]=qs['filters'](_[_0x8a8c('0x49')](_0xf10cf1[_0x8a8c('0x2c')],_0x4a2968[_0x8a8c('0x2e')]));if(_0xf10cf1[_0x8a8c('0x2c')][_0x8a8c('0x38')]){_0x33b3b5[_0x8a8c('0x37')]=_[_0x8a8c('0x39')](_0x33b3b5[_0x8a8c('0x37')],{'$or':_[_0x8a8c('0x28')](_0x33b3b5[_0x8a8c('0x31')],function(_0x513736){var _0x573098={};_0x573098[_0x513736]={'$like':'%'+_0xf10cf1[_0x8a8c('0x2c')][_0x8a8c('0x38')]+'%'};return _0x573098;})});}_0x33b3b5=_[_0x8a8c('0x39')]({},_0x33b3b5,_0xf10cf1[_0x8a8c('0x3c')]);return _0x52ce86[_0x8a8c('0x47')](_0x33b3b5);}})[_0x8a8c('0x22')](function(_0x46d583){if(_0x46d583){_0x2f4691=_0x46d583[_0x8a8c('0x32')];if(!_0xf10cf1[_0x8a8c('0x2c')][_0x8a8c('0x33')](_0x8a8c('0x34'))){_0x33b3b5[_0x8a8c('0x1b')]=qs[_0x8a8c('0x1b')](_0xf10cf1[_0x8a8c('0x2c')][_0x8a8c('0x1b')]);_0x33b3b5[_0x8a8c('0x19')]=qs['offset'](_0xf10cf1[_0x8a8c('0x2c')][_0x8a8c('0x19')]);}return _0x52ce86[_0x8a8c('0x47')](_0x33b3b5);}})['then'](function(_0x209f5b){if(_0x209f5b){return _0x209f5b?{'count':_0x2f4691,'rows':_0x209f5b}:null;}})['then'](respondWithResult(_0x2ebe37,null))['catch'](handleError(_0x2ebe37,null));};exports[_0x8a8c('0x4a')]=function(_0x2f2f6d,_0x17eca5,_0x21c84b){if(_0x2f2f6d[_0x8a8c('0x46')]['id']){delete _0x2f2f6d['body']['id'];}return db[_0x8a8c('0x3d')]['findOne']({'where':{'id':_0x2f2f6d[_0x8a8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x17eca5,null))[_0x8a8c('0x22')](function(_0x1db82a){if(_0x1db82a){_0x2f2f6d[_0x8a8c('0x46')]['AccountId']=_0x1db82a['id'];_0x2f2f6d['body'][_0x8a8c('0x4b')]=integrations['getSubjects'](_0x2f2f6d['body'][_0x8a8c('0x4c')],_0x2f2f6d[_0x8a8c('0x46')]['type']);_0x2f2f6d['body']['Descriptions']=integrations['getDescriptions'](_0x2f2f6d[_0x8a8c('0x46')][_0x8a8c('0x4c')],_0x2f2f6d[_0x8a8c('0x46')]['type']);return db[_0x8a8c('0x48')][_0x8a8c('0x45')](_0x2f2f6d['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x8a8c('0x4d')}]});}return null;})[_0x8a8c('0x22')](respondWithResult(_0x17eca5,null))[_0x8a8c('0x44')](handleError(_0x17eca5,null));};exports[_0x8a8c('0x4e')]=function(_0x5acd89,_0x3fa6f3,_0x77475a){var _0x203a7f=[{'name':_0x8a8c('0x4f'),'label':_0x8a8c('0x4f'),'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 _0x19ebf0='';return db[_0x8a8c('0x3d')][_0x8a8c('0x50')]({'where':{'id':_0x5acd89[_0x8a8c('0x42')]['id']},'attributes':['id',_0x8a8c('0x51'),_0x8a8c('0x52'),_0x8a8c('0x53'),'password',_0x8a8c('0x54'),_0x8a8c('0x55'),'token','tokenSecret']})[_0x8a8c('0x22')](handleEntityNotFound(_0x3fa6f3,null))[_0x8a8c('0x22')](function(_0x413d2d){if(_0x413d2d){_0x19ebf0=_0x413d2d['remoteUri'];var _0x426282=_0x19ebf0['slice'](-0x1);if(_0x426282==='/'){_0x19ebf0=_0x19ebf0[_0x8a8c('0x56')](0x0,_0x19ebf0['lastIndexOf'](_0x426282));}var _0x295478={'method':_0x8a8c('0x57'),'uri':util[_0x8a8c('0x58')]('%s/custom_fields',_0x19ebf0),'headers':{'Content-Type':'application/json','Accept':_0x8a8c('0x59')},'json':!![]};if(_0x413d2d[_0x8a8c('0x52')]==='basic'){_0x295478[_0x8a8c('0x5a')][_0x8a8c('0x5b')]=util[_0x8a8c('0x58')](_0x8a8c('0x5c'),new Buffer(util['format']('%s:%s',_0x413d2d[_0x8a8c('0x53')],_0x413d2d[_0x8a8c('0x5d')]))[_0x8a8c('0x5e')]('base64'));}return rp(_0x295478)[_0x8a8c('0x22')](function(_0x2187c1){return _0x203a7f[_0x8a8c('0x5f')](_[_0x8a8c('0x28')](_0x2187c1['_embedded'][_0x8a8c('0x60')],function(_0x5d8f0e){return{'id':_0x5d8f0e[_0x8a8c('0x25')],'name':_0x5d8f0e[_0x8a8c('0x25')],'type':_0x5d8f0e[_0x8a8c('0x3a')],'active':_0x5d8f0e[_0x8a8c('0x61')],'label':_0x5d8f0e['label'],'custom':!![]};}));});}})[_0x8a8c('0x22')](function(_0x3c065e){return{'count':_0x3c065e[_0x8a8c('0x32')],'rows':_0x3c065e};})[_0x8a8c('0x22')](respondWithResult(_0x3fa6f3,null))[_0x8a8c('0x44')](function(_0x5ebf5c){var _0x4b895d=_0x5acd89['query']['test']?0x1f4:_0x5ebf5c[_0x8a8c('0x62')]||0x1f4;logger['error'](_0x8a8c('0x63'),'getFields',_0x4b895d,JSON[_0x8a8c('0x64')](_0x5ebf5c));delete _0x5ebf5c['name'];if(_0x4b895d===0x191){_0x4b895d=0x190;}_0x3fa6f3[_0x8a8c('0x16')](_0x4b895d)[_0x8a8c('0x26')](_0x5acd89[_0x8a8c('0x2c')]['test']?{'message':_0x8a8c('0x65'),'statusCode':_0x5ebf5c[_0x8a8c('0x62')]}:_0x5ebf5c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f816134..9d40046 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 _0x5c5e=['request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','api','bluebird'];(function(_0x2943fe,_0x3c7335){var _0x43db96=function(_0x3d436a){while(--_0x3d436a){_0x2943fe['push'](_0x2943fe['shift']());}};_0x43db96(++_0x3c7335);}(_0x5c5e,0xc8));var _0xe5c5=function(_0xf8abbb,_0x3a0919){_0xf8abbb=_0xf8abbb-0x0;var _0x4e45d0=_0x5c5e[_0xf8abbb];return _0x4e45d0;};'use strict';var _=require(_0xe5c5('0x0'));var util=require(_0xe5c5('0x1'));var logger=require('../../config/logger')(_0xe5c5('0x2'));var moment=require('moment');var BPromise=require(_0xe5c5('0x3'));var rp=require(_0xe5c5('0x4'));var fs=require('fs');var path=require(_0xe5c5('0x5'));var rimraf=require(_0xe5c5('0x6'));var config=require('../../config/environment');var attributes=require(_0xe5c5('0x7'));var integrations=require(_0xe5c5('0x8'));module['exports']=function(_0x5c81d2,_0x37e570){return _0x5c81d2[_0xe5c5('0x9')](_0xe5c5('0xa'),attributes,{'tableName':_0xe5c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x481a=['./intDeskAccount.attributes','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2e5bd2,_0x415ae1){var _0x21fd52=function(_0x20bc27){while(--_0x20bc27){_0x2e5bd2['push'](_0x2e5bd2['shift']());}};_0x21fd52(++_0x415ae1);}(_0x481a,0x1be));var _0xa481=function(_0x22ce3a,_0xf4a6d4){_0x22ce3a=_0x22ce3a-0x0;var _0x4be173=_0x481a[_0x22ce3a];return _0x4be173;};'use strict';var _=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var logger=require(_0xa481('0x2'))(_0xa481('0x3'));var moment=require(_0xa481('0x4'));var BPromise=require(_0xa481('0x5'));var rp=require(_0xa481('0x6'));var fs=require('fs');var path=require(_0xa481('0x7'));var rimraf=require('rimraf');var config=require(_0xa481('0x8'));var attributes=require(_0xa481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xa481('0xa')]=function(_0x48b88c,_0x1dba7d){return _0x48b88c['define'](_0xa481('0xb'),attributes,{'tableName':_0xa481('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index cf1c3fc..5633bf9 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 _0xaf70=['code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','include','map','then','debug','ShowDeskAccount','find','model','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x45c0f7,_0x3b1c07){var _0x56cb13=function(_0x3434f6){while(--_0x3434f6){_0x45c0f7['push'](_0x45c0f7['shift']());}};_0x56cb13(++_0x3b1c07);}(_0xaf70,0xd8));var _0x0af7=function(_0x47d01f,_0xd1aa50){_0x47d01f=_0x47d01f-0x0;var _0x4701c7=_0xaf70[_0x47d01f];return _0x4701c7;};'use strict';var _=require(_0x0af7('0x0'));var util=require(_0x0af7('0x1'));var moment=require(_0x0af7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0af7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af7('0x4'));var logger=require(_0x0af7('0x5'))(_0x0af7('0x6'));var config=require(_0x0af7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0af7('0x8')][_0x0af7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178e78,_0x356fcd,_0x3eb193){return new BPromise(function(_0x216af0,_0x729bf8){return client['request'](_0x178e78,_0x3eb193)['then'](function(_0x501568){logger[_0x0af7('0xa')](_0x0af7('0xb'),_0x356fcd,_0x0af7('0xc'));logger['debug'](_0x0af7('0xd'),_0x356fcd,_0x0af7('0xc'),JSON['stringify'](_0x501568));if(_0x501568[_0x0af7('0xe')]){if(_0x501568[_0x0af7('0xe')][_0x0af7('0xf')]===0x1f4){logger[_0x0af7('0xe')]('DeskAccount,\x20%s,\x20%s',_0x356fcd,_0x501568[_0x0af7('0xe')][_0x0af7('0x10')]);return _0x729bf8(_0x501568[_0x0af7('0xe')][_0x0af7('0x10')]);}logger[_0x0af7('0xe')]('DeskAccount,\x20%s,\x20%s',_0x356fcd,_0x501568['error'][_0x0af7('0x10')]);return _0x216af0(_0x501568[_0x0af7('0xe')][_0x0af7('0x10')]);}else{logger['info'](_0x0af7('0xb'),_0x356fcd,_0x0af7('0xc'));_0x216af0(_0x501568[_0x0af7('0x11')][_0x0af7('0x10')]);}})[_0x0af7('0x12')](function(_0x33956b){logger[_0x0af7('0xe')](_0x0af7('0xb'),_0x356fcd,_0x33956b);_0x729bf8(_0x33956b);});});}exports[_0x0af7('0x13')]=function(_0x18ee6b){var _0x4a3aa1=this;return new Promise(function(_0x17a653,_0x3948e4){return db[_0x0af7('0x14')][_0x0af7('0x15')]({'raw':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')][_0x0af7('0x17')]||null:null,'attributes':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')][_0x0af7('0x18')]||null:null,'limit':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')]['limit']||null:null,'include':_0x18ee6b[_0x0af7('0x16')]?_0x18ee6b[_0x0af7('0x16')][_0x0af7('0x19')]?_[_0x0af7('0x1a')](_0x18ee6b['options'][_0x0af7('0x19')],function(_0x9cc3d6){return{'model':db[_0x9cc3d6['model']],'as':_0x9cc3d6['as'],'attributes':_0x9cc3d6[_0x0af7('0x18')],'include':_0x9cc3d6[_0x0af7('0x19')]?_[_0x0af7('0x1a')](_0x9cc3d6[_0x0af7('0x19')],function(_0x1f5f6b){return{'model':db[_0x1f5f6b['model']],'as':_0x1f5f6b['as'],'attributes':_0x1f5f6b['attributes'],'include':_0x1f5f6b[_0x0af7('0x19')]?_[_0x0af7('0x1a')](_0x1f5f6b[_0x0af7('0x19')],function(_0x48e792){return{'model':db[_0x48e792['model']],'as':_0x48e792['as'],'attributes':_0x48e792[_0x0af7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0af7('0x1b')](function(_0x435591){logger[_0x0af7('0xa')](_0x0af7('0x13'),_0x18ee6b);logger[_0x0af7('0x1c')](_0x0af7('0x13'),_0x18ee6b,JSON['stringify'](_0x435591));_0x17a653(_0x435591);})[_0x0af7('0x12')](function(_0x570431){logger[_0x0af7('0xe')](_0x0af7('0x13'),_0x570431[_0x0af7('0x10')],_0x18ee6b);_0x3948e4(_0x4a3aa1['error'](0x1f4,_0x570431['message']));});});};exports[_0x0af7('0x1d')]=function(_0x4ba6c8){var _0x434912=this;return new Promise(function(_0x13ddc6,_0x9476ba){return db['DeskAccount'][_0x0af7('0x1e')]({'raw':_0x4ba6c8[_0x0af7('0x16')]?_0x4ba6c8['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ba6c8[_0x0af7('0x16')]?_0x4ba6c8[_0x0af7('0x16')][_0x0af7('0x17')]||null:null,'attributes':_0x4ba6c8[_0x0af7('0x16')]?_0x4ba6c8['options'][_0x0af7('0x18')]||null:null,'include':_0x4ba6c8['options']?_0x4ba6c8[_0x0af7('0x16')]['include']?_[_0x0af7('0x1a')](_0x4ba6c8[_0x0af7('0x16')]['include'],function(_0x5e45e1){return{'model':db[_0x5e45e1[_0x0af7('0x1f')]],'as':_0x5e45e1['as'],'attributes':_0x5e45e1[_0x0af7('0x18')],'include':_0x5e45e1[_0x0af7('0x19')]?_['map'](_0x5e45e1[_0x0af7('0x19')],function(_0x5da7e8){return{'model':db[_0x5da7e8[_0x0af7('0x1f')]],'as':_0x5da7e8['as'],'attributes':_0x5da7e8['attributes'],'include':_0x5da7e8[_0x0af7('0x19')]?_['map'](_0x5da7e8[_0x0af7('0x19')],function(_0x123b8b){return{'model':db[_0x123b8b['model']],'as':_0x123b8b['as'],'attributes':_0x123b8b[_0x0af7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0af7('0x1b')](function(_0x51ff8d){logger[_0x0af7('0xa')](_0x0af7('0x1d'),_0x4ba6c8);logger['debug']('ShowDeskAccount',_0x4ba6c8,JSON[_0x0af7('0x20')](_0x51ff8d));_0x13ddc6(_0x51ff8d);})[_0x0af7('0x12')](function(_0x4fca63){logger['error'](_0x0af7('0x1d'),_0x4fca63[_0x0af7('0x10')],_0x4ba6c8);_0x9476ba(_0x434912[_0x0af7('0xe')](0x1f4,_0x4fca63[_0x0af7('0x10')]));});});}; \ No newline at end of file +var _0x6fb6=['http','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','info','stringify','ShowDeskAccount','find','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x9c8378,_0x5b5fee){var _0x5bc86f=function(_0x3ca2cb){while(--_0x3ca2cb){_0x9c8378['push'](_0x9c8378['shift']());}};_0x5bc86f(++_0x5b5fee);}(_0x6fb6,0x9d));var _0x66fb=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x6fb6[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x66fb('0x0'));var util=require(_0x66fb('0x1'));var moment=require('moment');var BPromise=require(_0x66fb('0x2'));var rs=require(_0x66fb('0x3'));var fs=require('fs');var Redis=require(_0x66fb('0x4'));var db=require(_0x66fb('0x5'))['db'];var utils=require(_0x66fb('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x66fb('0x7'));var client=jayson['client'][_0x66fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x431145,_0x57aec9,_0xea8df2){return new BPromise(function(_0x485568,_0x57013b){return client['request'](_0x431145,_0xea8df2)[_0x66fb('0x9')](function(_0x1726eb){logger['info'](_0x66fb('0xa'),_0x57aec9,_0x66fb('0xb'));logger[_0x66fb('0xc')](_0x66fb('0xd'),_0x57aec9,_0x66fb('0xb'),JSON['stringify'](_0x1726eb));if(_0x1726eb['error']){if(_0x1726eb['error'][_0x66fb('0xe')]===0x1f4){logger[_0x66fb('0xf')](_0x66fb('0xa'),_0x57aec9,_0x1726eb[_0x66fb('0xf')][_0x66fb('0x10')]);return _0x57013b(_0x1726eb['error'][_0x66fb('0x10')]);}logger[_0x66fb('0xf')](_0x66fb('0xa'),_0x57aec9,_0x1726eb['error'][_0x66fb('0x10')]);return _0x485568(_0x1726eb[_0x66fb('0xf')][_0x66fb('0x10')]);}else{logger['info'](_0x66fb('0xa'),_0x57aec9,'request\x20sent');_0x485568(_0x1726eb['result'][_0x66fb('0x10')]);}})['catch'](function(_0x3923e3){logger[_0x66fb('0xf')]('DeskAccount,\x20%s,\x20%s',_0x57aec9,_0x3923e3);_0x57013b(_0x3923e3);});});}exports[_0x66fb('0x11')]=function(_0x18e005){var _0x4b686c=this;return new Promise(function(_0x5db32b,_0x15e3dc){return db[_0x66fb('0x12')][_0x66fb('0x13')]({'raw':_0x18e005['options']?_0x18e005[_0x66fb('0x14')][_0x66fb('0x15')]===undefined?!![]:![]:!![],'where':_0x18e005[_0x66fb('0x14')]?_0x18e005[_0x66fb('0x14')][_0x66fb('0x16')]||null:null,'attributes':_0x18e005[_0x66fb('0x14')]?_0x18e005[_0x66fb('0x14')][_0x66fb('0x17')]||null:null,'limit':_0x18e005['options']?_0x18e005[_0x66fb('0x14')][_0x66fb('0x18')]||null:null,'include':_0x18e005[_0x66fb('0x14')]?_0x18e005[_0x66fb('0x14')][_0x66fb('0x19')]?_['map'](_0x18e005[_0x66fb('0x14')][_0x66fb('0x19')],function(_0x196b7b){return{'model':db[_0x196b7b[_0x66fb('0x1a')]],'as':_0x196b7b['as'],'attributes':_0x196b7b[_0x66fb('0x17')],'include':_0x196b7b[_0x66fb('0x19')]?_[_0x66fb('0x1b')](_0x196b7b['include'],function(_0x569518){return{'model':db[_0x569518[_0x66fb('0x1a')]],'as':_0x569518['as'],'attributes':_0x569518[_0x66fb('0x17')],'include':_0x569518['include']?_[_0x66fb('0x1b')](_0x569518['include'],function(_0x2a8de4){return{'model':db[_0x2a8de4[_0x66fb('0x1a')]],'as':_0x2a8de4['as'],'attributes':_0x2a8de4[_0x66fb('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ea636){logger[_0x66fb('0x1c')]('GetDeskAccount',_0x18e005);logger['debug'](_0x66fb('0x11'),_0x18e005,JSON[_0x66fb('0x1d')](_0x1ea636));_0x5db32b(_0x1ea636);})['catch'](function(_0x7a7af3){logger[_0x66fb('0xf')](_0x66fb('0x11'),_0x7a7af3['message'],_0x18e005);_0x15e3dc(_0x4b686c[_0x66fb('0xf')](0x1f4,_0x7a7af3['message']));});});};exports[_0x66fb('0x1e')]=function(_0x538c8b){var _0x350fde=this;return new Promise(function(_0x174cf5,_0x5591ca){return db[_0x66fb('0x12')][_0x66fb('0x1f')]({'raw':_0x538c8b[_0x66fb('0x14')]?_0x538c8b[_0x66fb('0x14')][_0x66fb('0x15')]===undefined?!![]:![]:!![],'where':_0x538c8b[_0x66fb('0x14')]?_0x538c8b[_0x66fb('0x14')][_0x66fb('0x16')]||null:null,'attributes':_0x538c8b['options']?_0x538c8b[_0x66fb('0x14')][_0x66fb('0x17')]||null:null,'include':_0x538c8b[_0x66fb('0x14')]?_0x538c8b['options']['include']?_['map'](_0x538c8b['options'][_0x66fb('0x19')],function(_0x23304c){return{'model':db[_0x23304c[_0x66fb('0x1a')]],'as':_0x23304c['as'],'attributes':_0x23304c[_0x66fb('0x17')],'include':_0x23304c[_0x66fb('0x19')]?_[_0x66fb('0x1b')](_0x23304c[_0x66fb('0x19')],function(_0x233eea){return{'model':db[_0x233eea['model']],'as':_0x233eea['as'],'attributes':_0x233eea[_0x66fb('0x17')],'include':_0x233eea[_0x66fb('0x19')]?_['map'](_0x233eea[_0x66fb('0x19')],function(_0x1a4ecf){return{'model':db[_0x1a4ecf[_0x66fb('0x1a')]],'as':_0x1a4ecf['as'],'attributes':_0x1a4ecf[_0x66fb('0x17')]};}):[]};}):[]};}):[]:[]})[_0x66fb('0x9')](function(_0x2e675d){logger[_0x66fb('0x1c')](_0x66fb('0x1e'),_0x538c8b);logger[_0x66fb('0xc')]('ShowDeskAccount',_0x538c8b,JSON[_0x66fb('0x1d')](_0x2e675d));_0x174cf5(_0x2e675d);})[_0x66fb('0x20')](function(_0x31e898){logger[_0x66fb('0xf')](_0x66fb('0x1e'),_0x31e898[_0x66fb('0x10')],_0x538c8b);_0x5591ca(_0x350fde[_0x66fb('0xf')](0x1f4,_0x31e898['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 77d8c84..756ff6c 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x55ca,0x126));var _0xa55c=function(_0x190c49,_0x103457){_0x190c49=_0x190c49-0x0;var _0x475b9a=_0x55ca[_0x190c49];return _0x475b9a;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1bb93d,_0x160ae9){var _0xde6852=function(_0x103820){while(--_0x103820){_0x1bb93d['push'](_0x1bb93d['shift']());}};_0xde6852(++_0x160ae9);}(_0x008c,0x188));var _0xc008=function(_0x339ded,_0xb38a57){_0x339ded=_0x339ded-0x0;var _0x37f8dc=_0x008c[_0x339ded];return _0x37f8dc;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 4deecbd..eaea3c6 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 _0x4c53=['STRING','exports'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x4c53,0x181));var _0x34c5=function(_0x315b3e,_0x12d46b){_0x315b3e=_0x315b3e-0x0;var _0x1efd1d=_0x4c53[_0x315b3e];return _0x1efd1d;};'use strict';var Sequelize=require('sequelize');module[_0x34c5('0x0')]={'name':{'type':Sequelize[_0x34c5('0x1')]},'description':{'type':Sequelize[_0x34c5('0x1')]}}; \ No newline at end of file +var _0x19de=['STRING'];(function(_0x53b68e,_0x39e2e7){var _0x5dbf7e=function(_0x242609){while(--_0x242609){_0x53b68e['push'](_0x53b68e['shift']());}};_0x5dbf7e(++_0x39e2e7);}(_0x19de,0x121));var _0xe19d=function(_0x314444,_0x569ae2){_0x314444=_0x314444-0x0;var _0x48d2d2=_0x19de[_0x314444];return _0x48d2d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe19d('0x0')]},'description':{'type':Sequelize[_0xe19d('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 287d30b..1b13e9a 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 _0x6358=['intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','then','rows','catch','show','params','create','body','getFields','findOne','keys','DeskField','nolimit','getSubjects','getDescriptions','getTags','order','setTags','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x5ebc8f,_0x2eb237){var _0x573495=function(_0x41aa85){while(--_0x41aa85){_0x5ebc8f['push'](_0x5ebc8f['shift']());}};_0x573495(++_0x2eb237);}(_0x6358,0x73));var _0x8635=function(_0x430a85,_0x4ce7ef){_0x430a85=_0x430a85-0x0;var _0x5e026b=_0x6358[_0x430a85];return _0x5e026b;};'use strict';var emlformat=require(_0x8635('0x0'));var rimraf=require(_0x8635('0x1'));var zipdir=require(_0x8635('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8635('0x3'));var moment=require('moment');var BPromise=require(_0x8635('0x4'));var Mustache=require(_0x8635('0x5'));var util=require(_0x8635('0x6'));var path=require(_0x8635('0x7'));var sox=require(_0x8635('0x8'));var csv=require('to-csv');var ejs=require(_0x8635('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8635('0xa'));var squel=require(_0x8635('0xb'));var crypto=require(_0x8635('0xc'));var jsforce=require(_0x8635('0xd'));var deskjs=require(_0x8635('0xe'));var toCsv=require(_0x8635('0xf'));var querystring=require(_0x8635('0x10'));var Papa=require(_0x8635('0x11'));var Redis=require(_0x8635('0x12'));var authService=require(_0x8635('0x13'));var qs=require(_0x8635('0x14'));var as=require(_0x8635('0x15'));var hardwareService=require(_0x8635('0x16'));var logger=require(_0x8635('0x17'))('api');var utils=require(_0x8635('0x18'));var config=require(_0x8635('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8635('0x1a'))['db'];function respondWithStatusCode(_0x19146d,_0xdbca41){_0xdbca41=_0xdbca41||0xcc;return function(_0x108878){if(_0x108878){return _0x19146d['sendStatus'](_0xdbca41);}return _0x19146d['status'](_0xdbca41)[_0x8635('0x1b')]();};}function respondWithResult(_0x2d31f9,_0x249e97){_0x249e97=_0x249e97||0xc8;return function(_0x5cb1f6){if(_0x5cb1f6){return _0x2d31f9['status'](_0x249e97)[_0x8635('0x1c')](_0x5cb1f6);}};}function respondWithFilteredResult(_0x571691,_0x18605e){return function(_0x23886c){if(_0x23886c){var _0x3b7407=typeof _0x18605e['offset']===_0x8635('0x1d')&&typeof _0x18605e[_0x8635('0x1e')]===_0x8635('0x1d');var _0x533dc3=_0x23886c[_0x8635('0x1f')];var _0x233a17=_0x3b7407?0x0:_0x18605e[_0x8635('0x20')];var _0x477cd4=_0x3b7407?_0x23886c['count']:_0x18605e[_0x8635('0x20')]+_0x18605e['limit'];var _0x5c4af8;if(_0x477cd4>=_0x533dc3){_0x477cd4=_0x533dc3;_0x5c4af8=0xc8;}else{_0x5c4af8=0xce;}_0x571691[_0x8635('0x21')](_0x5c4af8);return _0x571691[_0x8635('0x22')](_0x8635('0x23'),_0x233a17+'-'+_0x477cd4+'/'+_0x533dc3)[_0x8635('0x1c')](_0x23886c);}return null;};}function patchUpdates(_0x425508){return function(_0x4349dd){try{jsonpatch['apply'](_0x4349dd,_0x425508,!![]);}catch(_0x1395c0){return BPromise[_0x8635('0x24')](_0x1395c0);}return _0x4349dd[_0x8635('0x25')]();};}function saveUpdates(_0x3c9a76,_0x20b503){return function(_0x75620c){if(_0x75620c){return _0x75620c[_0x8635('0x26')](_0x3c9a76)['then'](function(_0x14cde4){return _0x14cde4;});}return null;};}function removeEntity(_0x141c2a,_0x55c4e2){return function(_0xad1af){if(_0xad1af){return _0xad1af[_0x8635('0x27')]()['then'](function(){_0x141c2a[_0x8635('0x21')](0xcc)[_0x8635('0x1b')]();});}};}function handleEntityNotFound(_0x45bfd0,_0xc09039){return function(_0x5d5daa){if(!_0x5d5daa){_0x45bfd0[_0x8635('0x28')](0x194);}return _0x5d5daa;};}function handleError(_0x25d832,_0x23b124){_0x23b124=_0x23b124||0x1f4;return function(_0x1edaa5){logger['error'](_0x1edaa5['stack']);if(_0x1edaa5[_0x8635('0x29')]){delete _0x1edaa5[_0x8635('0x29')];}_0x25d832[_0x8635('0x21')](_0x23b124)[_0x8635('0x2a')](_0x1edaa5);};}exports[_0x8635('0x2b')]=function(_0x191913,_0x460684){var _0x1ce1fa={},_0x453fbf={},_0x42d824={'count':0x0,'rows':[]};var _0x5e940c=_[_0x8635('0x2c')](db[_0x8635('0x2d')][_0x8635('0x2e')],function(_0x35ed5a){return{'name':_0x35ed5a[_0x8635('0x2f')],'type':_0x35ed5a[_0x8635('0x30')][_0x8635('0x31')]};});_0x453fbf[_0x8635('0x32')]=_[_0x8635('0x2c')](_0x5e940c,_0x8635('0x29'));_0x453fbf['query']=_['keys'](_0x191913[_0x8635('0x33')]);_0x453fbf[_0x8635('0x34')]=_[_0x8635('0x35')](_0x453fbf['model'],_0x453fbf['query']);_0x1ce1fa[_0x8635('0x36')]=_['intersection'](_0x453fbf[_0x8635('0x32')],qs[_0x8635('0x37')](_0x191913[_0x8635('0x33')][_0x8635('0x37')]));_0x1ce1fa[_0x8635('0x36')]=_0x1ce1fa[_0x8635('0x36')][_0x8635('0x38')]?_0x1ce1fa[_0x8635('0x36')]:_0x453fbf[_0x8635('0x32')];if(!_0x191913[_0x8635('0x33')][_0x8635('0x39')]('nolimit')){_0x1ce1fa[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x191913['query'][_0x8635('0x1e')]);_0x1ce1fa[_0x8635('0x20')]=qs[_0x8635('0x20')](_0x191913['query'][_0x8635('0x20')]);}_0x1ce1fa['order']=qs[_0x8635('0x3a')](_0x191913[_0x8635('0x33')][_0x8635('0x3a')]);_0x1ce1fa[_0x8635('0x3b')]=qs[_0x8635('0x34')](_[_0x8635('0x3c')](_0x191913['query'],_0x453fbf[_0x8635('0x34')]),_0x5e940c);if(_0x191913[_0x8635('0x33')][_0x8635('0x3d')]){_0x1ce1fa[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x1ce1fa[_0x8635('0x3b')],{'$or':_[_0x8635('0x2c')](_0x5e940c,function(_0x5286f7){if(_0x5286f7[_0x8635('0x30')]!==_0x8635('0x3f')){var _0x2cbb28={};_0x2cbb28[_0x5286f7[_0x8635('0x29')]]={'$like':'%'+_0x191913['query'][_0x8635('0x3d')]+'%'};return _0x2cbb28;}})});}_0x1ce1fa=_[_0x8635('0x3e')]({},_0x1ce1fa,_0x191913[_0x8635('0x40')]);var _0x34abf8={'where':_0x1ce1fa[_0x8635('0x3b')]};return db['DeskConfiguration'][_0x8635('0x1f')](_0x34abf8)['then'](function(_0x1b34d6){_0x42d824[_0x8635('0x1f')]=_0x1b34d6;if(_0x191913[_0x8635('0x33')][_0x8635('0x41')]){_0x1ce1fa[_0x8635('0x42')]=[{'all':!![]}];}return db[_0x8635('0x2d')]['findAll'](_0x1ce1fa);})[_0x8635('0x43')](function(_0x259982){_0x42d824[_0x8635('0x44')]=_0x259982;return _0x42d824;})['then'](respondWithFilteredResult(_0x460684,_0x1ce1fa))[_0x8635('0x45')](handleError(_0x460684,null));};exports[_0x8635('0x46')]=function(_0x565783,_0x239ab3){var _0x137ac2={'raw':![],'where':{'id':_0x565783[_0x8635('0x47')]['id']}},_0x5f0314={};_0x5f0314[_0x8635('0x32')]=_['keys'](db[_0x8635('0x2d')]['rawAttributes']);_0x5f0314[_0x8635('0x33')]=_['keys'](_0x565783['query']);_0x5f0314[_0x8635('0x34')]=_[_0x8635('0x35')](_0x5f0314[_0x8635('0x32')],_0x5f0314[_0x8635('0x33')]);_0x137ac2[_0x8635('0x36')]=_[_0x8635('0x35')](_0x5f0314[_0x8635('0x32')],qs[_0x8635('0x37')](_0x565783['query'][_0x8635('0x37')]));_0x137ac2['attributes']=_0x137ac2[_0x8635('0x36')]['length']?_0x137ac2[_0x8635('0x36')]:_0x5f0314['model'];if(_0x565783[_0x8635('0x33')][_0x8635('0x41')]){_0x137ac2[_0x8635('0x42')]=[{'all':!![]}];}_0x137ac2=_[_0x8635('0x3e')]({},_0x137ac2,_0x565783[_0x8635('0x40')]);return db['DeskConfiguration']['find'](_0x137ac2)[_0x8635('0x43')](handleEntityNotFound(_0x239ab3,null))[_0x8635('0x43')](respondWithResult(_0x239ab3,null))[_0x8635('0x45')](handleError(_0x239ab3,null));};exports[_0x8635('0x48')]=function(_0x2570d5,_0x1cd270){return db[_0x8635('0x2d')][_0x8635('0x48')](_0x2570d5[_0x8635('0x49')],{})[_0x8635('0x43')](respondWithResult(_0x1cd270,0xc9))[_0x8635('0x45')](handleError(_0x1cd270,null));};exports[_0x8635('0x26')]=function(_0x186b02,_0x55ceef){if(_0x186b02[_0x8635('0x49')]['id']){delete _0x186b02[_0x8635('0x49')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x186b02[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x55ceef,null))[_0x8635('0x43')](saveUpdates(_0x186b02[_0x8635('0x49')],null))['then'](respondWithResult(_0x55ceef,null))[_0x8635('0x45')](handleError(_0x55ceef,null));};exports['destroy']=function(_0x658883,_0x1edbf7){return db[_0x8635('0x2d')]['find']({'where':{'id':_0x658883[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x1edbf7,null))['then'](removeEntity(_0x1edbf7,null))['catch'](handleError(_0x1edbf7,null));};exports[_0x8635('0x4a')]=function(_0x1d3393,_0x1a1e6d,_0x15419b){var _0x4c289a={};var _0x3be1f3={};var _0x582225;var _0x2ae94e;return db[_0x8635('0x2d')][_0x8635('0x4b')]({'where':{'id':_0x1d3393['params']['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x1a1e6d,null))['then'](function(_0x458650){if(_0x458650){_0x582225=_0x458650;_0x3be1f3[_0x8635('0x32')]=_[_0x8635('0x4c')](db[_0x8635('0x4d')]['rawAttributes']);_0x3be1f3[_0x8635('0x33')]=_[_0x8635('0x4c')](_0x1d3393[_0x8635('0x33')]);_0x3be1f3[_0x8635('0x34')]=_['intersection'](_0x3be1f3[_0x8635('0x32')],_0x3be1f3['query']);_0x4c289a[_0x8635('0x36')]=_[_0x8635('0x35')](_0x3be1f3['model'],qs[_0x8635('0x37')](_0x1d3393['query'][_0x8635('0x37')]));_0x4c289a[_0x8635('0x36')]=_0x4c289a[_0x8635('0x36')][_0x8635('0x38')]?_0x4c289a[_0x8635('0x36')]:_0x3be1f3[_0x8635('0x32')];_0x4c289a['order']=qs[_0x8635('0x3a')](_0x1d3393['query'][_0x8635('0x3a')]);_0x4c289a['where']=qs[_0x8635('0x34')](_[_0x8635('0x3c')](_0x1d3393[_0x8635('0x33')],_0x3be1f3[_0x8635('0x34')]));if(_0x1d3393[_0x8635('0x33')][_0x8635('0x3d')]){_0x4c289a[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x4c289a[_0x8635('0x3b')],{'$or':_[_0x8635('0x2c')](_0x4c289a[_0x8635('0x36')],function(_0xd3bc0d){var _0x23b2df={};_0x23b2df[_0xd3bc0d]={'$like':'%'+_0x1d3393[_0x8635('0x33')][_0x8635('0x3d')]+'%'};return _0x23b2df;})});}_0x4c289a=_[_0x8635('0x3e')]({},_0x4c289a,_0x1d3393[_0x8635('0x40')]);return _0x582225[_0x8635('0x4a')](_0x4c289a);}})['then'](function(_0x1316e9){if(_0x1316e9){_0x2ae94e=_0x1316e9['length'];if(!_0x1d3393['query'][_0x8635('0x39')](_0x8635('0x4e'))){_0x4c289a[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x1d3393['query']['limit']);_0x4c289a['offset']=qs[_0x8635('0x20')](_0x1d3393[_0x8635('0x33')][_0x8635('0x20')]);}return _0x582225[_0x8635('0x4a')](_0x4c289a);}})['then'](function(_0x1dbcab){if(_0x1dbcab){return _0x1dbcab?{'count':_0x2ae94e,'rows':_0x1dbcab}:null;}})['then'](respondWithResult(_0x1a1e6d,null))[_0x8635('0x45')](handleError(_0x1a1e6d,null));};exports[_0x8635('0x4f')]=function(_0x489b49,_0x522c04,_0x1a0aac){var _0x1bb547={};var _0xe045fc={};var _0x52bef2;var _0x8ce346;return db[_0x8635('0x2d')]['findOne']({'where':{'id':_0x489b49[_0x8635('0x47')]['id']}})['then'](handleEntityNotFound(_0x522c04,null))[_0x8635('0x43')](function(_0x28e35a){if(_0x28e35a){_0x52bef2=_0x28e35a;_0xe045fc[_0x8635('0x32')]=_[_0x8635('0x4c')](db[_0x8635('0x4d')][_0x8635('0x2e')]);_0xe045fc[_0x8635('0x33')]=_['keys'](_0x489b49[_0x8635('0x33')]);_0xe045fc[_0x8635('0x34')]=_[_0x8635('0x35')](_0xe045fc[_0x8635('0x32')],_0xe045fc[_0x8635('0x33')]);_0x1bb547[_0x8635('0x36')]=_['intersection'](_0xe045fc[_0x8635('0x32')],qs['fields'](_0x489b49[_0x8635('0x33')][_0x8635('0x37')]));_0x1bb547[_0x8635('0x36')]=_0x1bb547['attributes']['length']?_0x1bb547[_0x8635('0x36')]:_0xe045fc[_0x8635('0x32')];_0x1bb547['order']=qs[_0x8635('0x3a')](_0x489b49[_0x8635('0x33')][_0x8635('0x3a')]);_0x1bb547[_0x8635('0x3b')]=qs['filters'](_[_0x8635('0x3c')](_0x489b49[_0x8635('0x33')],_0xe045fc['filters']));if(_0x489b49['query']['filter']){_0x1bb547[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x1bb547['where'],{'$or':_[_0x8635('0x2c')](_0x1bb547['attributes'],function(_0x31193c){var _0x46a0f1={};_0x46a0f1[_0x31193c]={'$like':'%'+_0x489b49[_0x8635('0x33')][_0x8635('0x3d')]+'%'};return _0x46a0f1;})});}_0x1bb547=_[_0x8635('0x3e')]({},_0x1bb547,_0x489b49[_0x8635('0x40')]);return _0x52bef2[_0x8635('0x4f')](_0x1bb547);}})['then'](function(_0x42e960){if(_0x42e960){_0x8ce346=_0x42e960['length'];if(!_0x489b49[_0x8635('0x33')][_0x8635('0x39')]('nolimit')){_0x1bb547[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x489b49[_0x8635('0x33')][_0x8635('0x1e')]);_0x1bb547[_0x8635('0x20')]=qs[_0x8635('0x20')](_0x489b49[_0x8635('0x33')][_0x8635('0x20')]);}return _0x52bef2[_0x8635('0x4f')](_0x1bb547);}})['then'](function(_0x5c304d){if(_0x5c304d){return _0x5c304d?{'count':_0x8ce346,'rows':_0x5c304d}:null;}})['then'](respondWithResult(_0x522c04,null))[_0x8635('0x45')](handleError(_0x522c04,null));};exports[_0x8635('0x50')]=function(_0x31d62f,_0x4ffa27,_0x424c85){var _0x4f8ba9={};var _0x1f5a61={};var _0x5d1466;var _0x181327;return db[_0x8635('0x2d')][_0x8635('0x4b')]({'where':{'id':_0x31d62f[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x4ffa27,null))[_0x8635('0x43')](function(_0x25388c){if(_0x25388c){_0x5d1466=_0x25388c;_0x1f5a61[_0x8635('0x32')]=_['keys'](db[_0x8635('0x4d')][_0x8635('0x2e')]);_0x1f5a61['query']=_[_0x8635('0x4c')](_0x31d62f[_0x8635('0x33')]);_0x1f5a61['filters']=_[_0x8635('0x35')](_0x1f5a61[_0x8635('0x32')],_0x1f5a61[_0x8635('0x33')]);_0x4f8ba9[_0x8635('0x36')]=_[_0x8635('0x35')](_0x1f5a61[_0x8635('0x32')],qs[_0x8635('0x37')](_0x31d62f[_0x8635('0x33')][_0x8635('0x37')]));_0x4f8ba9[_0x8635('0x36')]=_0x4f8ba9[_0x8635('0x36')][_0x8635('0x38')]?_0x4f8ba9[_0x8635('0x36')]:_0x1f5a61['model'];_0x4f8ba9['order']=qs[_0x8635('0x3a')](_0x31d62f[_0x8635('0x33')]['sort']);_0x4f8ba9[_0x8635('0x3b')]=qs[_0x8635('0x34')](_[_0x8635('0x3c')](_0x31d62f[_0x8635('0x33')],_0x1f5a61[_0x8635('0x34')]));if(_0x31d62f[_0x8635('0x33')][_0x8635('0x3d')]){_0x4f8ba9[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x4f8ba9[_0x8635('0x3b')],{'$or':_['map'](_0x4f8ba9[_0x8635('0x36')],function(_0x41ce5a){var _0x5d0552={};_0x5d0552[_0x41ce5a]={'$like':'%'+_0x31d62f[_0x8635('0x33')][_0x8635('0x3d')]+'%'};return _0x5d0552;})});}_0x4f8ba9=_[_0x8635('0x3e')]({},_0x4f8ba9,_0x31d62f[_0x8635('0x40')]);return _0x5d1466[_0x8635('0x50')](_0x4f8ba9);}})[_0x8635('0x43')](function(_0x1f4bb9){if(_0x1f4bb9){_0x181327=_0x1f4bb9[_0x8635('0x38')];if(!_0x31d62f[_0x8635('0x33')][_0x8635('0x39')](_0x8635('0x4e'))){_0x4f8ba9[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x31d62f[_0x8635('0x33')][_0x8635('0x1e')]);_0x4f8ba9[_0x8635('0x20')]=qs['offset'](_0x31d62f[_0x8635('0x33')][_0x8635('0x20')]);}return _0x5d1466[_0x8635('0x50')](_0x4f8ba9);}})['then'](function(_0xb416af){if(_0xb416af){return _0xb416af?{'count':_0x181327,'rows':_0xb416af}:null;}})[_0x8635('0x43')](respondWithResult(_0x4ffa27,null))['catch'](handleError(_0x4ffa27,null));};exports[_0x8635('0x51')]=function(_0x99b5d4,_0x176f61,_0x5cd66c){var _0x31c09a={};var _0xddc5b8={};var _0x341f2c;var _0x52866e;return db['DeskConfiguration'][_0x8635('0x4b')]({'where':{'id':_0x99b5d4[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x176f61,null))[_0x8635('0x43')](function(_0x31c674){if(_0x31c674){_0x341f2c=_0x31c674;_0xddc5b8[_0x8635('0x32')]=_[_0x8635('0x4c')](db['Tag'][_0x8635('0x2e')]);_0xddc5b8[_0x8635('0x33')]=_[_0x8635('0x4c')](_0x99b5d4[_0x8635('0x33')]);_0xddc5b8['filters']=_[_0x8635('0x35')](_0xddc5b8[_0x8635('0x32')],_0xddc5b8[_0x8635('0x33')]);_0x31c09a[_0x8635('0x36')]=_[_0x8635('0x35')](_0xddc5b8[_0x8635('0x32')],qs[_0x8635('0x37')](_0x99b5d4[_0x8635('0x33')][_0x8635('0x37')]));_0x31c09a[_0x8635('0x36')]=_0x31c09a[_0x8635('0x36')][_0x8635('0x38')]?_0x31c09a[_0x8635('0x36')]:_0xddc5b8[_0x8635('0x32')];_0x31c09a[_0x8635('0x52')]=qs[_0x8635('0x3a')](_0x99b5d4[_0x8635('0x33')][_0x8635('0x3a')]);_0x31c09a[_0x8635('0x3b')]=qs['filters'](_['pick'](_0x99b5d4[_0x8635('0x33')],_0xddc5b8[_0x8635('0x34')]));if(_0x99b5d4[_0x8635('0x33')][_0x8635('0x3d')]){_0x31c09a[_0x8635('0x3b')]=_[_0x8635('0x3e')](_0x31c09a[_0x8635('0x3b')],{'$or':_[_0x8635('0x2c')](_0x31c09a[_0x8635('0x36')],function(_0x5cc700){var _0x66f862={};_0x66f862[_0x5cc700]={'$like':'%'+_0x99b5d4[_0x8635('0x33')][_0x8635('0x3d')]+'%'};return _0x66f862;})});}_0x31c09a=_['merge']({},_0x31c09a,_0x99b5d4['options']);return _0x341f2c['getTags'](_0x31c09a);}})[_0x8635('0x43')](function(_0x5e1aa9){if(_0x5e1aa9){_0x52866e=_0x5e1aa9['length'];if(!_0x99b5d4[_0x8635('0x33')][_0x8635('0x39')](_0x8635('0x4e'))){_0x31c09a[_0x8635('0x1e')]=qs[_0x8635('0x1e')](_0x99b5d4[_0x8635('0x33')]['limit']);_0x31c09a['offset']=qs[_0x8635('0x20')](_0x99b5d4['query'][_0x8635('0x20')]);}return _0x341f2c[_0x8635('0x51')](_0x31c09a);}})['then'](function(_0xf6a11f){if(_0xf6a11f){return _0xf6a11f?{'count':_0x52866e,'rows':_0xf6a11f}:null;}})[_0x8635('0x43')](respondWithResult(_0x176f61,null))[_0x8635('0x45')](handleError(_0x176f61,null));};exports[_0x8635('0x53')]=function(_0x36e6d6,_0x5634f0,_0x10c459){if(_0x36e6d6['body']['id']){delete _0x36e6d6['body']['id'];}return db[_0x8635('0x2d')][_0x8635('0x4b')]({'where':{'id':_0x36e6d6[_0x8635('0x47')]['id']}})[_0x8635('0x43')](handleEntityNotFound(_0x5634f0,null))[_0x8635('0x43')](function(_0x1f31c0){if(_0x1f31c0){return _0x1f31c0['setTags'](_0x36e6d6[_0x8635('0x49')]['ids']||[]);}return null;})['then'](respondWithResult(_0x5634f0,null))[_0x8635('0x45')](handleError(_0x5634f0,null));}; \ No newline at end of file +var _0x8648=['send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','show','params','include','options','find','catch','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x5aed73,_0x1bf4da){var _0x27df73=function(_0x290935){while(--_0x290935){_0x5aed73['push'](_0x5aed73['shift']());}};_0x27df73(++_0x1bf4da);}(_0x8648,0xca));var _0x8864=function(_0x2a4e36,_0x53ba28){_0x2a4e36=_0x2a4e36-0x0;var _0xb8c025=_0x8648[_0x2a4e36];return _0xb8c025;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8864('0x0'));var jsonpatch=require(_0x8864('0x1'));var rp=require('request-promise');var moment=require(_0x8864('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8864('0x3'));var util=require('util');var path=require(_0x8864('0x4'));var sox=require(_0x8864('0x5'));var csv=require(_0x8864('0x6'));var ejs=require(_0x8864('0x7'));var fs=require('fs');var fs_extra=require(_0x8864('0x8'));var _=require('lodash');var squel=require(_0x8864('0x9'));var crypto=require('crypto');var jsforce=require(_0x8864('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8864('0x6'));var querystring=require(_0x8864('0xb'));var Papa=require(_0x8864('0xc'));var Redis=require('ioredis');var authService=require(_0x8864('0xd'));var qs=require(_0x8864('0xe'));var as=require(_0x8864('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8864('0x10'))(_0x8864('0x11'));var utils=require(_0x8864('0x12'));var config=require(_0x8864('0x13'));var licenseUtil=require(_0x8864('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22bbac,_0x45dd0e){_0x45dd0e=_0x45dd0e||0xcc;return function(_0x4e697b){if(_0x4e697b){return _0x22bbac[_0x8864('0x15')](_0x45dd0e);}return _0x22bbac[_0x8864('0x16')](_0x45dd0e)[_0x8864('0x17')]();};}function respondWithResult(_0x418dda,_0x1d94ab){_0x1d94ab=_0x1d94ab||0xc8;return function(_0x4947d9){if(_0x4947d9){return _0x418dda[_0x8864('0x16')](_0x1d94ab)[_0x8864('0x18')](_0x4947d9);}};}function respondWithFilteredResult(_0x114104,_0x175bb3){return function(_0x91c66){if(_0x91c66){var _0x130686=typeof _0x175bb3[_0x8864('0x19')]===_0x8864('0x1a')&&typeof _0x175bb3[_0x8864('0x1b')]==='undefined';var _0x3ddea8=_0x91c66[_0x8864('0x1c')];var _0x295cbf=_0x130686?0x0:_0x175bb3[_0x8864('0x19')];var _0x5f2f1a=_0x130686?_0x91c66[_0x8864('0x1c')]:_0x175bb3[_0x8864('0x19')]+_0x175bb3[_0x8864('0x1b')];var _0x4f4346;if(_0x5f2f1a>=_0x3ddea8){_0x5f2f1a=_0x3ddea8;_0x4f4346=0xc8;}else{_0x4f4346=0xce;}_0x114104[_0x8864('0x16')](_0x4f4346);return _0x114104['set']('Content-Range',_0x295cbf+'-'+_0x5f2f1a+'/'+_0x3ddea8)['json'](_0x91c66);}return null;};}function patchUpdates(_0xaf8140){return function(_0x8f9753){try{jsonpatch[_0x8864('0x1d')](_0x8f9753,_0xaf8140,!![]);}catch(_0x41d534){return BPromise[_0x8864('0x1e')](_0x41d534);}return _0x8f9753[_0x8864('0x1f')]();};}function saveUpdates(_0x85ef51,_0x3f3117){return function(_0x5e6757){if(_0x5e6757){return _0x5e6757[_0x8864('0x20')](_0x85ef51)[_0x8864('0x21')](function(_0xaa222c){return _0xaa222c;});}return null;};}function removeEntity(_0x173f12,_0x3936c3){return function(_0x497f3d){if(_0x497f3d){return _0x497f3d[_0x8864('0x22')]()['then'](function(){_0x173f12[_0x8864('0x16')](0xcc)[_0x8864('0x17')]();});}};}function handleEntityNotFound(_0x374f51,_0x51ba59){return function(_0x340485){if(!_0x340485){_0x374f51[_0x8864('0x15')](0x194);}return _0x340485;};}function handleError(_0x543bfe,_0x71f1ba){_0x71f1ba=_0x71f1ba||0x1f4;return function(_0xc0d5d1){logger[_0x8864('0x23')](_0xc0d5d1[_0x8864('0x24')]);if(_0xc0d5d1[_0x8864('0x25')]){delete _0xc0d5d1['name'];}_0x543bfe[_0x8864('0x16')](_0x71f1ba)[_0x8864('0x26')](_0xc0d5d1);};}exports[_0x8864('0x27')]=function(_0x3f36a6,_0x20e01d){var _0x415b5d={},_0x245a66={},_0xf4b605={'count':0x0,'rows':[]};var _0x40a31c=_[_0x8864('0x28')](db[_0x8864('0x29')][_0x8864('0x2a')],function(_0x55cb9d){return{'name':_0x55cb9d[_0x8864('0x2b')],'type':_0x55cb9d[_0x8864('0x2c')][_0x8864('0x2d')]};});_0x245a66['model']=_['map'](_0x40a31c,_0x8864('0x25'));_0x245a66['query']=_[_0x8864('0x2e')](_0x3f36a6[_0x8864('0x2f')]);_0x245a66[_0x8864('0x30')]=_[_0x8864('0x31')](_0x245a66['model'],_0x245a66['query']);_0x415b5d[_0x8864('0x32')]=_['intersection'](_0x245a66[_0x8864('0x33')],qs[_0x8864('0x34')](_0x3f36a6['query'][_0x8864('0x34')]));_0x415b5d[_0x8864('0x32')]=_0x415b5d[_0x8864('0x32')][_0x8864('0x35')]?_0x415b5d[_0x8864('0x32')]:_0x245a66[_0x8864('0x33')];if(!_0x3f36a6[_0x8864('0x2f')][_0x8864('0x36')](_0x8864('0x37'))){_0x415b5d[_0x8864('0x1b')]=qs[_0x8864('0x1b')](_0x3f36a6[_0x8864('0x2f')]['limit']);_0x415b5d['offset']=qs[_0x8864('0x19')](_0x3f36a6[_0x8864('0x2f')][_0x8864('0x19')]);}_0x415b5d[_0x8864('0x38')]=qs['sort'](_0x3f36a6['query'][_0x8864('0x39')]);_0x415b5d['where']=qs[_0x8864('0x30')](_[_0x8864('0x3a')](_0x3f36a6[_0x8864('0x2f')],_0x245a66[_0x8864('0x30')]),_0x40a31c);if(_0x3f36a6[_0x8864('0x2f')][_0x8864('0x3b')]){_0x415b5d[_0x8864('0x3c')]=_['merge'](_0x415b5d[_0x8864('0x3c')],{'$or':_[_0x8864('0x28')](_0x40a31c,function(_0x61175a){if(_0x61175a['type']!==_0x8864('0x3d')){var _0x378883={};_0x378883[_0x61175a[_0x8864('0x25')]]={'$like':'%'+_0x3f36a6[_0x8864('0x2f')]['filter']+'%'};return _0x378883;}})});}_0x415b5d=_[_0x8864('0x3e')]({},_0x415b5d,_0x3f36a6['options']);var _0x14441a={'where':_0x415b5d['where']};return db[_0x8864('0x29')][_0x8864('0x1c')](_0x14441a)['then'](function(_0x18303f){_0xf4b605[_0x8864('0x1c')]=_0x18303f;if(_0x3f36a6['query'][_0x8864('0x3f')]){_0x415b5d['include']=[{'all':!![]}];}return db[_0x8864('0x29')]['findAll'](_0x415b5d);})[_0x8864('0x21')](function(_0x49e21){_0xf4b605['rows']=_0x49e21;return _0xf4b605;})['then'](respondWithFilteredResult(_0x20e01d,_0x415b5d))['catch'](handleError(_0x20e01d,null));};exports[_0x8864('0x40')]=function(_0xdd14c0,_0x528f59){var _0x4aae26={'raw':![],'where':{'id':_0xdd14c0[_0x8864('0x41')]['id']}},_0x17bf73={};_0x17bf73['model']=_[_0x8864('0x2e')](db[_0x8864('0x29')][_0x8864('0x2a')]);_0x17bf73[_0x8864('0x2f')]=_[_0x8864('0x2e')](_0xdd14c0[_0x8864('0x2f')]);_0x17bf73[_0x8864('0x30')]=_[_0x8864('0x31')](_0x17bf73[_0x8864('0x33')],_0x17bf73[_0x8864('0x2f')]);_0x4aae26[_0x8864('0x32')]=_[_0x8864('0x31')](_0x17bf73['model'],qs['fields'](_0xdd14c0['query'][_0x8864('0x34')]));_0x4aae26[_0x8864('0x32')]=_0x4aae26[_0x8864('0x32')][_0x8864('0x35')]?_0x4aae26[_0x8864('0x32')]:_0x17bf73['model'];if(_0xdd14c0['query'][_0x8864('0x3f')]){_0x4aae26[_0x8864('0x42')]=[{'all':!![]}];}_0x4aae26=_['merge']({},_0x4aae26,_0xdd14c0[_0x8864('0x43')]);return db[_0x8864('0x29')][_0x8864('0x44')](_0x4aae26)['then'](handleEntityNotFound(_0x528f59,null))['then'](respondWithResult(_0x528f59,null))[_0x8864('0x45')](handleError(_0x528f59,null));};exports[_0x8864('0x46')]=function(_0x49a880,_0x175db9){return db[_0x8864('0x29')][_0x8864('0x46')](_0x49a880[_0x8864('0x47')],{})[_0x8864('0x21')](respondWithResult(_0x175db9,0xc9))['catch'](handleError(_0x175db9,null));};exports[_0x8864('0x20')]=function(_0x13d736,_0x2afc1d){if(_0x13d736['body']['id']){delete _0x13d736['body']['id'];}return db[_0x8864('0x29')][_0x8864('0x44')]({'where':{'id':_0x13d736[_0x8864('0x41')]['id']}})[_0x8864('0x21')](handleEntityNotFound(_0x2afc1d,null))[_0x8864('0x21')](saveUpdates(_0x13d736[_0x8864('0x47')],null))[_0x8864('0x21')](respondWithResult(_0x2afc1d,null))[_0x8864('0x45')](handleError(_0x2afc1d,null));};exports[_0x8864('0x22')]=function(_0x520d63,_0x4f66ff){return db[_0x8864('0x29')][_0x8864('0x44')]({'where':{'id':_0x520d63['params']['id']}})[_0x8864('0x21')](handleEntityNotFound(_0x4f66ff,null))[_0x8864('0x21')](removeEntity(_0x4f66ff,null))[_0x8864('0x45')](handleError(_0x4f66ff,null));};exports[_0x8864('0x48')]=function(_0x2573ab,_0x20050e,_0x584b0a){var _0xb7bf17={};var _0x165e60={};var _0x172cc7;var _0x140525;return db[_0x8864('0x29')][_0x8864('0x49')]({'where':{'id':_0x2573ab[_0x8864('0x41')]['id']}})[_0x8864('0x21')](handleEntityNotFound(_0x20050e,null))['then'](function(_0x5b6f5a){if(_0x5b6f5a){_0x172cc7=_0x5b6f5a;_0x165e60[_0x8864('0x33')]=_[_0x8864('0x2e')](db[_0x8864('0x4a')]['rawAttributes']);_0x165e60[_0x8864('0x2f')]=_['keys'](_0x2573ab[_0x8864('0x2f')]);_0x165e60[_0x8864('0x30')]=_['intersection'](_0x165e60['model'],_0x165e60[_0x8864('0x2f')]);_0xb7bf17[_0x8864('0x32')]=_['intersection'](_0x165e60[_0x8864('0x33')],qs['fields'](_0x2573ab['query'][_0x8864('0x34')]));_0xb7bf17[_0x8864('0x32')]=_0xb7bf17[_0x8864('0x32')]['length']?_0xb7bf17['attributes']:_0x165e60[_0x8864('0x33')];_0xb7bf17['order']=qs[_0x8864('0x39')](_0x2573ab[_0x8864('0x2f')][_0x8864('0x39')]);_0xb7bf17['where']=qs['filters'](_['pick'](_0x2573ab[_0x8864('0x2f')],_0x165e60[_0x8864('0x30')]));if(_0x2573ab['query'][_0x8864('0x3b')]){_0xb7bf17['where']=_[_0x8864('0x3e')](_0xb7bf17[_0x8864('0x3c')],{'$or':_[_0x8864('0x28')](_0xb7bf17[_0x8864('0x32')],function(_0x397c09){var _0x481226={};_0x481226[_0x397c09]={'$like':'%'+_0x2573ab[_0x8864('0x2f')][_0x8864('0x3b')]+'%'};return _0x481226;})});}_0xb7bf17=_[_0x8864('0x3e')]({},_0xb7bf17,_0x2573ab[_0x8864('0x43')]);return _0x172cc7[_0x8864('0x48')](_0xb7bf17);}})[_0x8864('0x21')](function(_0x285642){if(_0x285642){_0x140525=_0x285642[_0x8864('0x35')];if(!_0x2573ab[_0x8864('0x2f')][_0x8864('0x36')](_0x8864('0x37'))){_0xb7bf17[_0x8864('0x1b')]=qs['limit'](_0x2573ab['query']['limit']);_0xb7bf17['offset']=qs[_0x8864('0x19')](_0x2573ab[_0x8864('0x2f')][_0x8864('0x19')]);}return _0x172cc7['getFields'](_0xb7bf17);}})[_0x8864('0x21')](function(_0x6e610d){if(_0x6e610d){return _0x6e610d?{'count':_0x140525,'rows':_0x6e610d}:null;}})[_0x8864('0x21')](respondWithResult(_0x20050e,null))[_0x8864('0x45')](handleError(_0x20050e,null));};exports[_0x8864('0x4b')]=function(_0x5a0ac6,_0x3f1378,_0x3a4dae){var _0x1acd1c={};var _0x558d00={};var _0x4795eb;var _0x39e7a1;return db[_0x8864('0x29')]['findOne']({'where':{'id':_0x5a0ac6['params']['id']}})[_0x8864('0x21')](handleEntityNotFound(_0x3f1378,null))['then'](function(_0x576b66){if(_0x576b66){_0x4795eb=_0x576b66;_0x558d00[_0x8864('0x33')]=_[_0x8864('0x2e')](db[_0x8864('0x4a')][_0x8864('0x2a')]);_0x558d00[_0x8864('0x2f')]=_[_0x8864('0x2e')](_0x5a0ac6['query']);_0x558d00[_0x8864('0x30')]=_['intersection'](_0x558d00['model'],_0x558d00[_0x8864('0x2f')]);_0x1acd1c[_0x8864('0x32')]=_[_0x8864('0x31')](_0x558d00['model'],qs[_0x8864('0x34')](_0x5a0ac6[_0x8864('0x2f')][_0x8864('0x34')]));_0x1acd1c[_0x8864('0x32')]=_0x1acd1c[_0x8864('0x32')][_0x8864('0x35')]?_0x1acd1c[_0x8864('0x32')]:_0x558d00[_0x8864('0x33')];_0x1acd1c[_0x8864('0x38')]=qs[_0x8864('0x39')](_0x5a0ac6[_0x8864('0x2f')][_0x8864('0x39')]);_0x1acd1c[_0x8864('0x3c')]=qs[_0x8864('0x30')](_[_0x8864('0x3a')](_0x5a0ac6[_0x8864('0x2f')],_0x558d00[_0x8864('0x30')]));if(_0x5a0ac6[_0x8864('0x2f')][_0x8864('0x3b')]){_0x1acd1c[_0x8864('0x3c')]=_[_0x8864('0x3e')](_0x1acd1c[_0x8864('0x3c')],{'$or':_[_0x8864('0x28')](_0x1acd1c[_0x8864('0x32')],function(_0x3d089a){var _0x289670={};_0x289670[_0x3d089a]={'$like':'%'+_0x5a0ac6[_0x8864('0x2f')][_0x8864('0x3b')]+'%'};return _0x289670;})});}_0x1acd1c=_[_0x8864('0x3e')]({},_0x1acd1c,_0x5a0ac6['options']);return _0x4795eb[_0x8864('0x4b')](_0x1acd1c);}})['then'](function(_0xa91ebd){if(_0xa91ebd){_0x39e7a1=_0xa91ebd[_0x8864('0x35')];if(!_0x5a0ac6['query'][_0x8864('0x36')](_0x8864('0x37'))){_0x1acd1c['limit']=qs[_0x8864('0x1b')](_0x5a0ac6[_0x8864('0x2f')]['limit']);_0x1acd1c[_0x8864('0x19')]=qs[_0x8864('0x19')](_0x5a0ac6[_0x8864('0x2f')]['offset']);}return _0x4795eb[_0x8864('0x4b')](_0x1acd1c);}})[_0x8864('0x21')](function(_0xfc86c0){if(_0xfc86c0){return _0xfc86c0?{'count':_0x39e7a1,'rows':_0xfc86c0}:null;}})[_0x8864('0x21')](respondWithResult(_0x3f1378,null))['catch'](handleError(_0x3f1378,null));};exports[_0x8864('0x4c')]=function(_0x32078b,_0x35a6ea,_0xa66f87){var _0x10acd3={};var _0x5dfa00={};var _0x40f102;var _0x2c5475;return db[_0x8864('0x29')][_0x8864('0x49')]({'where':{'id':_0x32078b[_0x8864('0x41')]['id']}})['then'](handleEntityNotFound(_0x35a6ea,null))[_0x8864('0x21')](function(_0x26ea3a){if(_0x26ea3a){_0x40f102=_0x26ea3a;_0x5dfa00['model']=_[_0x8864('0x2e')](db['DeskField'][_0x8864('0x2a')]);_0x5dfa00['query']=_[_0x8864('0x2e')](_0x32078b[_0x8864('0x2f')]);_0x5dfa00[_0x8864('0x30')]=_[_0x8864('0x31')](_0x5dfa00[_0x8864('0x33')],_0x5dfa00[_0x8864('0x2f')]);_0x10acd3['attributes']=_[_0x8864('0x31')](_0x5dfa00[_0x8864('0x33')],qs[_0x8864('0x34')](_0x32078b['query'][_0x8864('0x34')]));_0x10acd3['attributes']=_0x10acd3[_0x8864('0x32')][_0x8864('0x35')]?_0x10acd3[_0x8864('0x32')]:_0x5dfa00['model'];_0x10acd3[_0x8864('0x38')]=qs['sort'](_0x32078b[_0x8864('0x2f')][_0x8864('0x39')]);_0x10acd3['where']=qs[_0x8864('0x30')](_[_0x8864('0x3a')](_0x32078b[_0x8864('0x2f')],_0x5dfa00[_0x8864('0x30')]));if(_0x32078b[_0x8864('0x2f')][_0x8864('0x3b')]){_0x10acd3[_0x8864('0x3c')]=_[_0x8864('0x3e')](_0x10acd3[_0x8864('0x3c')],{'$or':_[_0x8864('0x28')](_0x10acd3['attributes'],function(_0x24216b){var _0x1ab495={};_0x1ab495[_0x24216b]={'$like':'%'+_0x32078b[_0x8864('0x2f')]['filter']+'%'};return _0x1ab495;})});}_0x10acd3=_[_0x8864('0x3e')]({},_0x10acd3,_0x32078b['options']);return _0x40f102[_0x8864('0x4c')](_0x10acd3);}})[_0x8864('0x21')](function(_0x3d53a1){if(_0x3d53a1){_0x2c5475=_0x3d53a1['length'];if(!_0x32078b[_0x8864('0x2f')][_0x8864('0x36')](_0x8864('0x37'))){_0x10acd3[_0x8864('0x1b')]=qs[_0x8864('0x1b')](_0x32078b['query'][_0x8864('0x1b')]);_0x10acd3[_0x8864('0x19')]=qs['offset'](_0x32078b['query'][_0x8864('0x19')]);}return _0x40f102['getDescriptions'](_0x10acd3);}})[_0x8864('0x21')](function(_0x18dd77){if(_0x18dd77){return _0x18dd77?{'count':_0x2c5475,'rows':_0x18dd77}:null;}})[_0x8864('0x21')](respondWithResult(_0x35a6ea,null))[_0x8864('0x45')](handleError(_0x35a6ea,null));};exports[_0x8864('0x4d')]=function(_0x31e13f,_0x14c827,_0x457737){var _0x4ee4bb={};var _0x4317c1={};var _0x307713;var _0x23d4c9;return db[_0x8864('0x29')][_0x8864('0x49')]({'where':{'id':_0x31e13f[_0x8864('0x41')]['id']}})[_0x8864('0x21')](handleEntityNotFound(_0x14c827,null))[_0x8864('0x21')](function(_0x9cdf24){if(_0x9cdf24){_0x307713=_0x9cdf24;_0x4317c1[_0x8864('0x33')]=_[_0x8864('0x2e')](db[_0x8864('0x4e')][_0x8864('0x2a')]);_0x4317c1[_0x8864('0x2f')]=_[_0x8864('0x2e')](_0x31e13f[_0x8864('0x2f')]);_0x4317c1[_0x8864('0x30')]=_[_0x8864('0x31')](_0x4317c1[_0x8864('0x33')],_0x4317c1[_0x8864('0x2f')]);_0x4ee4bb[_0x8864('0x32')]=_[_0x8864('0x31')](_0x4317c1[_0x8864('0x33')],qs[_0x8864('0x34')](_0x31e13f['query'][_0x8864('0x34')]));_0x4ee4bb[_0x8864('0x32')]=_0x4ee4bb[_0x8864('0x32')][_0x8864('0x35')]?_0x4ee4bb[_0x8864('0x32')]:_0x4317c1[_0x8864('0x33')];_0x4ee4bb[_0x8864('0x38')]=qs['sort'](_0x31e13f[_0x8864('0x2f')][_0x8864('0x39')]);_0x4ee4bb[_0x8864('0x3c')]=qs['filters'](_[_0x8864('0x3a')](_0x31e13f[_0x8864('0x2f')],_0x4317c1[_0x8864('0x30')]));if(_0x31e13f[_0x8864('0x2f')]['filter']){_0x4ee4bb['where']=_[_0x8864('0x3e')](_0x4ee4bb[_0x8864('0x3c')],{'$or':_[_0x8864('0x28')](_0x4ee4bb[_0x8864('0x32')],function(_0x104259){var _0x5a2f54={};_0x5a2f54[_0x104259]={'$like':'%'+_0x31e13f[_0x8864('0x2f')][_0x8864('0x3b')]+'%'};return _0x5a2f54;})});}_0x4ee4bb=_[_0x8864('0x3e')]({},_0x4ee4bb,_0x31e13f['options']);return _0x307713['getTags'](_0x4ee4bb);}})[_0x8864('0x21')](function(_0x52d698){if(_0x52d698){_0x23d4c9=_0x52d698[_0x8864('0x35')];if(!_0x31e13f['query'][_0x8864('0x36')](_0x8864('0x37'))){_0x4ee4bb[_0x8864('0x1b')]=qs[_0x8864('0x1b')](_0x31e13f[_0x8864('0x2f')][_0x8864('0x1b')]);_0x4ee4bb[_0x8864('0x19')]=qs[_0x8864('0x19')](_0x31e13f[_0x8864('0x2f')][_0x8864('0x19')]);}return _0x307713[_0x8864('0x4d')](_0x4ee4bb);}})['then'](function(_0x1eced4){if(_0x1eced4){return _0x1eced4?{'count':_0x23d4c9,'rows':_0x1eced4}:null;}})[_0x8864('0x21')](respondWithResult(_0x14c827,null))[_0x8864('0x45')](handleError(_0x14c827,null));};exports[_0x8864('0x4f')]=function(_0x3efde0,_0x290c0e,_0x50183f){if(_0x3efde0[_0x8864('0x47')]['id']){delete _0x3efde0[_0x8864('0x47')]['id'];}return db[_0x8864('0x29')][_0x8864('0x49')]({'where':{'id':_0x3efde0['params']['id']}})[_0x8864('0x21')](handleEntityNotFound(_0x290c0e,null))['then'](function(_0x319979){if(_0x319979){return _0x319979['setTags'](_0x3efde0['body']['ids']||[]);}return null;})[_0x8864('0x21')](respondWithResult(_0x290c0e,null))[_0x8864('0x45')](handleError(_0x290c0e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3749375..9176aef 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 _0x6ece=['exports','DeskConfiguration','int_desk_configurations','lodash','moment','bluebird','./intDeskConfiguration.attributes'];(function(_0x1835f9,_0x21578d){var _0x41b028=function(_0x458ba8){while(--_0x458ba8){_0x1835f9['push'](_0x1835f9['shift']());}};_0x41b028(++_0x21578d);}(_0x6ece,0x8f));var _0xe6ec=function(_0x45291a,_0x2e9d88){_0x45291a=_0x45291a-0x0;var _0x333f33=_0x6ece[_0x45291a];return _0x333f33;};'use strict';var _=require(_0xe6ec('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe6ec('0x1'));var BPromise=require(_0xe6ec('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(_0xe6ec('0x3'));module[_0xe6ec('0x4')]=function(_0x1af473,_0x29e205){return _0x1af473['define'](_0xe6ec('0x5'),attributes,{'tableName':_0xe6ec('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1e1=['api','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','util'];(function(_0x301148,_0x25b884){var _0x42ce24=function(_0x44ba51){while(--_0x44ba51){_0x301148['push'](_0x301148['shift']());}};_0x42ce24(++_0x25b884);}(_0xa1e1,0x1d5));var _0x1a1e=function(_0x5273a1,_0x29b9b4){_0x5273a1=_0x5273a1-0x0;var _0x3b5723=_0xa1e1[_0x5273a1];return _0x3b5723;};'use strict';var _=require('lodash');var util=require(_0x1a1e('0x0'));var logger=require('../../config/logger')(_0x1a1e('0x1'));var moment=require('moment');var BPromise=require(_0x1a1e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a1e('0x3'));var rimraf=require(_0x1a1e('0x4'));var config=require(_0x1a1e('0x5'));var attributes=require(_0x1a1e('0x6'));module['exports']=function(_0x167dcb,_0x1bc428){return _0x167dcb[_0x1a1e('0x7')](_0x1a1e('0x8'),attributes,{'tableName':_0x1a1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 002b2d2..67c7320 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 _0xc025=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','code','error','message','request\x20sent','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc025,0x169));var _0x5c02=function(_0x3c1e89,_0x260d60){_0x3c1e89=_0x3c1e89-0x0;var _0x39211e=_0xc025[_0x3c1e89];return _0x39211e;};'use strict';var _=require(_0x5c02('0x0'));var util=require('util');var moment=require(_0x5c02('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c02('0x2'));var fs=require('fs');var Redis=require(_0x5c02('0x3'));var db=require(_0x5c02('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c02('0x5'));var config=require(_0x5c02('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5c02('0x7')][_0x5c02('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36934d,_0x1adc51,_0x1d5c2d){return new BPromise(function(_0x3adf86,_0x5a1363){return client[_0x5c02('0x9')](_0x36934d,_0x1d5c2d)[_0x5c02('0xa')](function(_0x594af5){logger[_0x5c02('0xb')](_0x5c02('0xc'),_0x1adc51,'request\x20sent');logger[_0x5c02('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1adc51,'request\x20sent',JSON['stringify'](_0x594af5));if(_0x594af5['error']){if(_0x594af5['error'][_0x5c02('0xe')]===0x1f4){logger[_0x5c02('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x1adc51,_0x594af5['error'][_0x5c02('0x10')]);return _0x5a1363(_0x594af5[_0x5c02('0xf')][_0x5c02('0x10')]);}logger[_0x5c02('0xf')](_0x5c02('0xc'),_0x1adc51,_0x594af5[_0x5c02('0xf')]['message']);return _0x3adf86(_0x594af5[_0x5c02('0xf')][_0x5c02('0x10')]);}else{logger[_0x5c02('0xb')](_0x5c02('0xc'),_0x1adc51,_0x5c02('0x11'));_0x3adf86(_0x594af5[_0x5c02('0x12')][_0x5c02('0x10')]);}})[_0x5c02('0x13')](function(_0xfd3cf4){logger['error'](_0x5c02('0xc'),_0x1adc51,_0xfd3cf4);_0x5a1363(_0xfd3cf4);});});} \ No newline at end of file +var _0xb515=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x544f53,_0xed5969){var _0x211799=function(_0x221073){while(--_0x221073){_0x544f53['push'](_0x544f53['shift']());}};_0x211799(++_0xed5969);}(_0xb515,0x1b8));var _0x5b51=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0xb515[_0x57fa7e];return _0x320671;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var moment=require(_0x5b51('0x1'));var BPromise=require(_0x5b51('0x2'));var rs=require(_0x5b51('0x3'));var fs=require('fs');var Redis=require(_0x5b51('0x4'));var db=require(_0x5b51('0x5'))['db'];var utils=require(_0x5b51('0x6'));var logger=require(_0x5b51('0x7'))(_0x5b51('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b51('0x9'));var client=jayson[_0x5b51('0xa')][_0x5b51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x293d82,_0x396b3f,_0x2c6d86){return new BPromise(function(_0x1d5082,_0x226e9c){return client[_0x5b51('0xc')](_0x293d82,_0x2c6d86)[_0x5b51('0xd')](function(_0x1085e6){logger[_0x5b51('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x396b3f,_0x5b51('0xf'));logger[_0x5b51('0x10')](_0x5b51('0x11'),_0x396b3f,_0x5b51('0xf'),JSON[_0x5b51('0x12')](_0x1085e6));if(_0x1085e6[_0x5b51('0x13')]){if(_0x1085e6['error']['code']===0x1f4){logger['error'](_0x5b51('0x14'),_0x396b3f,_0x1085e6[_0x5b51('0x13')][_0x5b51('0x15')]);return _0x226e9c(_0x1085e6[_0x5b51('0x13')]['message']);}logger[_0x5b51('0x13')](_0x5b51('0x14'),_0x396b3f,_0x1085e6[_0x5b51('0x13')][_0x5b51('0x15')]);return _0x1d5082(_0x1085e6[_0x5b51('0x13')][_0x5b51('0x15')]);}else{logger[_0x5b51('0xe')](_0x5b51('0x14'),_0x396b3f,_0x5b51('0xf'));_0x1d5082(_0x1085e6[_0x5b51('0x16')][_0x5b51('0x15')]);}})[_0x5b51('0x17')](function(_0x520686){logger[_0x5b51('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x396b3f,_0x520686);_0x226e9c(_0x520686);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 68faeca..70c4634 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 _0x299a=['post','create','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x4491d9,_0x5856ec){var _0x3e9dba=function(_0x2a6302){while(--_0x2a6302){_0x4491d9['push'](_0x4491d9['shift']());}};_0x3e9dba(++_0x5856ec);}(_0x299a,0x182));var _0xa299=function(_0x487b7b,_0x1844af){_0x487b7b=_0x487b7b-0x0;var _0x452a2d=_0x299a[_0x487b7b];return _0x452a2d;};'use strict';var multer=require('multer');var util=require(_0xa299('0x0'));var path=require(_0xa299('0x1'));var timeout=require(_0xa299('0x2'));var express=require(_0xa299('0x3'));var router=express['Router']();var fs_extra=require(_0xa299('0x4'));var auth=require(_0xa299('0x5'));var interaction=require(_0xa299('0x6'));var config=require(_0xa299('0x7'));var controller=require(_0xa299('0x8'));router[_0xa299('0x9')]('/',auth[_0xa299('0xa')](),controller[_0xa299('0xb')]);router[_0xa299('0x9')](_0xa299('0xc'),auth[_0xa299('0xa')](),controller['show']);router[_0xa299('0xd')]('/',auth[_0xa299('0xa')](),controller[_0xa299('0xe')]);router[_0xa299('0xf')](_0xa299('0xc'),auth[_0xa299('0xa')](),controller[_0xa299('0x10')]);router['delete'](_0xa299('0xc'),auth[_0xa299('0xa')](),controller[_0xa299('0x11')]);module[_0xa299('0x12')]=router; \ No newline at end of file +var _0x98f0=['util','express','Router','fs-extra','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x98f0,0xdd));var _0x098f=function(_0x8ec166,_0x4c44f2){_0x8ec166=_0x8ec166-0x0;var _0x1eb637=_0x98f0[_0x8ec166];return _0x1eb637;};'use strict';var multer=require('multer');var util=require(_0x098f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x098f('0x1'));var router=express[_0x098f('0x2')]();var fs_extra=require(_0x098f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x098f('0x4'));var config=require('../../config/environment');var controller=require(_0x098f('0x5'));router['get']('/',auth[_0x098f('0x6')](),controller[_0x098f('0x7')]);router['get'](_0x098f('0x8'),auth[_0x098f('0x6')](),controller['show']);router[_0x098f('0x9')]('/',auth['isAuthenticated'](),controller[_0x098f('0xa')]);router[_0x098f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x098f('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f8ded51..c691a9f 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 _0x9a45=['STRING','ENUM','variable','customVariable','sequelize','exports','string'];(function(_0x52398e,_0x2ad8c2){var _0x454d0f=function(_0x12e20c){while(--_0x12e20c){_0x52398e['push'](_0x52398e['shift']());}};_0x454d0f(++_0x2ad8c2);}(_0x9a45,0x11c));var _0x59a4=function(_0x79654c,_0x1fdcc2){_0x79654c=_0x79654c-0x0;var _0x4d5811=_0x9a45[_0x79654c];return _0x4d5811;};'use strict';var Sequelize=require(_0x59a4('0x0'));module[_0x59a4('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue','picklist'),'defaultValue':_0x59a4('0x2')},'content':{'type':Sequelize[_0x59a4('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x59a4('0x4')](_0x59a4('0x2'),_0x59a4('0x5'),_0x59a4('0x6'))},'keyContent':{'type':Sequelize[_0x59a4('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41f7=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x41f7,0x12d));var _0x741f=function(_0xac89d2,_0x5c34c1){_0xac89d2=_0xac89d2-0x0;var _0x13c681=_0x41f7[_0xac89d2];return _0x13c681;};'use strict';var Sequelize=require(_0x741f('0x0'));module[_0x741f('0x1')]={'type':{'type':Sequelize[_0x741f('0x2')](_0x741f('0x3'),_0x741f('0x4'),_0x741f('0x5'),_0x741f('0x6'),_0x741f('0x7')),'defaultValue':_0x741f('0x3')},'content':{'type':Sequelize[_0x741f('0x8')]},'key':{'type':Sequelize[_0x741f('0x8')]},'keyType':{'type':Sequelize[_0x741f('0x2')](_0x741f('0x3'),_0x741f('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x741f('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x741f('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x741f('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 520a332..b70c32c 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 _0xdedd=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','model'];(function(_0x3df60c,_0x573229){var _0x50202b=function(_0x17ba76){while(--_0x17ba76){_0x3df60c['push'](_0x3df60c['shift']());}};_0x50202b(++_0x573229);}(_0xdedd,0x197));var _0xdded=function(_0x338802,_0x1a3dd0){_0x338802=_0x338802-0x0;var _0x3cf257=_0xdedd[_0x338802];return _0x3cf257;};'use strict';var emlformat=require(_0xdded('0x0'));var rimraf=require(_0xdded('0x1'));var zipdir=require(_0xdded('0x2'));var jsonpatch=require(_0xdded('0x3'));var rp=require(_0xdded('0x4'));var moment=require('moment');var BPromise=require(_0xdded('0x5'));var Mustache=require(_0xdded('0x6'));var util=require(_0xdded('0x7'));var path=require(_0xdded('0x8'));var sox=require(_0xdded('0x9'));var csv=require(_0xdded('0xa'));var ejs=require(_0xdded('0xb'));var fs=require('fs');var fs_extra=require(_0xdded('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdded('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdded('0xe'));var Papa=require(_0xdded('0xf'));var Redis=require(_0xdded('0x10'));var authService=require(_0xdded('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdded('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdded('0x13'))(_0xdded('0x14'));var utils=require(_0xdded('0x15'));var config=require(_0xdded('0x16'));var licenseUtil=require(_0xdded('0x17'));var db=require(_0xdded('0x18'))['db'];function respondWithStatusCode(_0x233f97,_0x2c110e){_0x2c110e=_0x2c110e||0xcc;return function(_0x1e122c){if(_0x1e122c){return _0x233f97['sendStatus'](_0x2c110e);}return _0x233f97[_0xdded('0x19')](_0x2c110e)[_0xdded('0x1a')]();};}function respondWithResult(_0x4a48ca,_0x31cdbe){_0x31cdbe=_0x31cdbe||0xc8;return function(_0x5256e7){if(_0x5256e7){return _0x4a48ca[_0xdded('0x19')](_0x31cdbe)['json'](_0x5256e7);}};}function respondWithFilteredResult(_0x5e69e9,_0x140bc3){return function(_0x22ca73){if(_0x22ca73){var _0x481ae4=typeof _0x140bc3[_0xdded('0x1b')]===_0xdded('0x1c')&&typeof _0x140bc3[_0xdded('0x1d')]===_0xdded('0x1c');var _0x1454e4=_0x22ca73[_0xdded('0x1e')];var _0x323c30=_0x481ae4?0x0:_0x140bc3[_0xdded('0x1b')];var _0x4f249e=_0x481ae4?_0x22ca73[_0xdded('0x1e')]:_0x140bc3[_0xdded('0x1b')]+_0x140bc3[_0xdded('0x1d')];var _0x153686;if(_0x4f249e>=_0x1454e4){_0x4f249e=_0x1454e4;_0x153686=0xc8;}else{_0x153686=0xce;}_0x5e69e9[_0xdded('0x19')](_0x153686);return _0x5e69e9[_0xdded('0x1f')](_0xdded('0x20'),_0x323c30+'-'+_0x4f249e+'/'+_0x1454e4)[_0xdded('0x21')](_0x22ca73);}return null;};}function patchUpdates(_0x415b38){return function(_0x17be0a){try{jsonpatch[_0xdded('0x22')](_0x17be0a,_0x415b38,!![]);}catch(_0x35000a){return BPromise[_0xdded('0x23')](_0x35000a);}return _0x17be0a['save']();};}function saveUpdates(_0x417e8b,_0x4db31b){return function(_0x233776){if(_0x233776){return _0x233776[_0xdded('0x24')](_0x417e8b)['then'](function(_0xa0c790){return _0xa0c790;});}return null;};}function removeEntity(_0x5d68ed,_0x223048){return function(_0x1c1473){if(_0x1c1473){return _0x1c1473[_0xdded('0x25')]()[_0xdded('0x26')](function(){_0x5d68ed[_0xdded('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5025,_0xb6f82e){return function(_0x2b66b3){if(!_0x2b66b3){_0x1c5025[_0xdded('0x27')](0x194);}return _0x2b66b3;};}function handleError(_0x478235,_0x4bd5c9){_0x4bd5c9=_0x4bd5c9||0x1f4;return function(_0x5e2dfb){logger[_0xdded('0x28')](_0x5e2dfb[_0xdded('0x29')]);if(_0x5e2dfb[_0xdded('0x2a')]){delete _0x5e2dfb[_0xdded('0x2a')];}_0x478235[_0xdded('0x19')](_0x4bd5c9)['send'](_0x5e2dfb);};}exports[_0xdded('0x2b')]=function(_0x10c128,_0x154a55){var _0x11e13a={},_0x560dca={},_0x415158={'count':0x0,'rows':[]};var _0x5f3637=_[_0xdded('0x2c')](db[_0xdded('0x2d')][_0xdded('0x2e')],function(_0x36880e){return{'name':_0x36880e[_0xdded('0x2f')],'type':_0x36880e[_0xdded('0x30')][_0xdded('0x31')]};});_0x560dca['model']=_[_0xdded('0x2c')](_0x5f3637,_0xdded('0x2a'));_0x560dca['query']=_[_0xdded('0x32')](_0x10c128[_0xdded('0x33')]);_0x560dca['filters']=_['intersection'](_0x560dca['model'],_0x560dca['query']);_0x11e13a[_0xdded('0x34')]=_[_0xdded('0x35')](_0x560dca[_0xdded('0x36')],qs[_0xdded('0x37')](_0x10c128[_0xdded('0x33')][_0xdded('0x37')]));_0x11e13a[_0xdded('0x34')]=_0x11e13a['attributes'][_0xdded('0x38')]?_0x11e13a[_0xdded('0x34')]:_0x560dca[_0xdded('0x36')];if(!_0x10c128[_0xdded('0x33')][_0xdded('0x39')](_0xdded('0x3a'))){_0x11e13a['limit']=qs[_0xdded('0x1d')](_0x10c128[_0xdded('0x33')][_0xdded('0x1d')]);_0x11e13a['offset']=qs[_0xdded('0x1b')](_0x10c128[_0xdded('0x33')]['offset']);}_0x11e13a[_0xdded('0x3b')]=qs[_0xdded('0x3c')](_0x10c128[_0xdded('0x33')][_0xdded('0x3c')]);_0x11e13a[_0xdded('0x3d')]=qs[_0xdded('0x3e')](_[_0xdded('0x3f')](_0x10c128[_0xdded('0x33')],_0x560dca[_0xdded('0x3e')]),_0x5f3637);if(_0x10c128[_0xdded('0x33')][_0xdded('0x40')]){_0x11e13a[_0xdded('0x3d')]=_['merge'](_0x11e13a['where'],{'$or':_[_0xdded('0x2c')](_0x5f3637,function(_0xcf99aa){if(_0xcf99aa[_0xdded('0x30')]!==_0xdded('0x41')){var _0x1e849a={};_0x1e849a[_0xcf99aa[_0xdded('0x2a')]]={'$like':'%'+_0x10c128[_0xdded('0x33')][_0xdded('0x40')]+'%'};return _0x1e849a;}})});}_0x11e13a=_[_0xdded('0x42')]({},_0x11e13a,_0x10c128[_0xdded('0x43')]);var _0x398504={'where':_0x11e13a[_0xdded('0x3d')]};return db['DeskField'][_0xdded('0x1e')](_0x398504)['then'](function(_0x128e62){_0x415158['count']=_0x128e62;if(_0x10c128[_0xdded('0x33')][_0xdded('0x44')]){_0x11e13a['include']=[{'all':!![]}];}return db[_0xdded('0x2d')]['findAll'](_0x11e13a);})[_0xdded('0x26')](function(_0x43ed5e){_0x415158[_0xdded('0x45')]=_0x43ed5e;return _0x415158;})[_0xdded('0x26')](respondWithFilteredResult(_0x154a55,_0x11e13a))[_0xdded('0x46')](handleError(_0x154a55,null));};exports[_0xdded('0x47')]=function(_0x438c37,_0x43055e){var _0x47ca13={'raw':!![],'where':{'id':_0x438c37['params']['id']}},_0x2f3887={};_0x2f3887['model']=_[_0xdded('0x32')](db[_0xdded('0x2d')]['rawAttributes']);_0x2f3887[_0xdded('0x33')]=_[_0xdded('0x32')](_0x438c37[_0xdded('0x33')]);_0x2f3887[_0xdded('0x3e')]=_[_0xdded('0x35')](_0x2f3887[_0xdded('0x36')],_0x2f3887[_0xdded('0x33')]);_0x47ca13[_0xdded('0x34')]=_[_0xdded('0x35')](_0x2f3887[_0xdded('0x36')],qs[_0xdded('0x37')](_0x438c37['query'][_0xdded('0x37')]));_0x47ca13['attributes']=_0x47ca13[_0xdded('0x34')][_0xdded('0x38')]?_0x47ca13[_0xdded('0x34')]:_0x2f3887[_0xdded('0x36')];if(_0x438c37[_0xdded('0x33')][_0xdded('0x44')]){_0x47ca13[_0xdded('0x48')]=[{'all':!![]}];}_0x47ca13=_[_0xdded('0x42')]({},_0x47ca13,_0x438c37['options']);return db['DeskField'][_0xdded('0x49')](_0x47ca13)[_0xdded('0x26')](handleEntityNotFound(_0x43055e,null))[_0xdded('0x26')](respondWithResult(_0x43055e,null))[_0xdded('0x46')](handleError(_0x43055e,null));};exports['create']=function(_0x16d647,_0x5d4043){return db[_0xdded('0x2d')][_0xdded('0x4a')](_0x16d647[_0xdded('0x4b')],{})['then'](respondWithResult(_0x5d4043,0xc9))['catch'](handleError(_0x5d4043,null));};exports[_0xdded('0x24')]=function(_0x2b7e8c,_0x2beec5){if(_0x2b7e8c['body']['id']){delete _0x2b7e8c[_0xdded('0x4b')]['id'];}return db['DeskField'][_0xdded('0x49')]({'where':{'id':_0x2b7e8c[_0xdded('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2beec5,null))[_0xdded('0x26')](saveUpdates(_0x2b7e8c[_0xdded('0x4b')],null))[_0xdded('0x26')](respondWithResult(_0x2beec5,null))[_0xdded('0x46')](handleError(_0x2beec5,null));};exports['destroy']=function(_0x262d97,_0x35abc6){return db[_0xdded('0x2d')][_0xdded('0x49')]({'where':{'id':_0x262d97[_0xdded('0x4c')]['id']}})[_0xdded('0x26')](handleEntityNotFound(_0x35abc6,null))['then'](removeEntity(_0x35abc6,null))[_0xdded('0x46')](handleError(_0x35abc6,null));}; \ No newline at end of file +var _0x0b78=['DeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x0b78,0x1d6));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80b7('0x0'));var zipdir=require(_0x80b7('0x1'));var jsonpatch=require(_0x80b7('0x2'));var rp=require('request-promise');var moment=require(_0x80b7('0x3'));var BPromise=require(_0x80b7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x80b7('0x5'));var csv=require(_0x80b7('0x6'));var ejs=require(_0x80b7('0x7'));var fs=require('fs');var fs_extra=require(_0x80b7('0x8'));var _=require(_0x80b7('0x9'));var squel=require(_0x80b7('0xa'));var crypto=require('crypto');var jsforce=require(_0x80b7('0xb'));var deskjs=require(_0x80b7('0xc'));var toCsv=require(_0x80b7('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x80b7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x80b7('0xe'));var as=require(_0x80b7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80b7('0x10'))(_0x80b7('0x11'));var utils=require(_0x80b7('0x12'));var config=require(_0x80b7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ac007,_0x1bbe9f){_0x1bbe9f=_0x1bbe9f||0xcc;return function(_0x16976c){if(_0x16976c){return _0x3ac007[_0x80b7('0x14')](_0x1bbe9f);}return _0x3ac007[_0x80b7('0x15')](_0x1bbe9f)[_0x80b7('0x16')]();};}function respondWithResult(_0x3d71a0,_0x32cecc){_0x32cecc=_0x32cecc||0xc8;return function(_0x416d32){if(_0x416d32){return _0x3d71a0['status'](_0x32cecc)['json'](_0x416d32);}};}function respondWithFilteredResult(_0x5c64df,_0x57e428){return function(_0x2c6bff){if(_0x2c6bff){var _0x459f67=typeof _0x57e428[_0x80b7('0x17')]===_0x80b7('0x18')&&typeof _0x57e428[_0x80b7('0x19')]===_0x80b7('0x18');var _0x262cd5=_0x2c6bff[_0x80b7('0x1a')];var _0x22abaa=_0x459f67?0x0:_0x57e428[_0x80b7('0x17')];var _0x25b5e9=_0x459f67?_0x2c6bff[_0x80b7('0x1a')]:_0x57e428[_0x80b7('0x17')]+_0x57e428['limit'];var _0x2165df;if(_0x25b5e9>=_0x262cd5){_0x25b5e9=_0x262cd5;_0x2165df=0xc8;}else{_0x2165df=0xce;}_0x5c64df[_0x80b7('0x15')](_0x2165df);return _0x5c64df[_0x80b7('0x1b')](_0x80b7('0x1c'),_0x22abaa+'-'+_0x25b5e9+'/'+_0x262cd5)[_0x80b7('0x1d')](_0x2c6bff);}return null;};}function patchUpdates(_0x3ebdd6){return function(_0x220133){try{jsonpatch[_0x80b7('0x1e')](_0x220133,_0x3ebdd6,!![]);}catch(_0x3da240){return BPromise[_0x80b7('0x1f')](_0x3da240);}return _0x220133[_0x80b7('0x20')]();};}function saveUpdates(_0x1ef249,_0x53046f){return function(_0x55bf6e){if(_0x55bf6e){return _0x55bf6e[_0x80b7('0x21')](_0x1ef249)[_0x80b7('0x22')](function(_0x158b65){return _0x158b65;});}return null;};}function removeEntity(_0x5e8093,_0x9fccdc){return function(_0x390d8a){if(_0x390d8a){return _0x390d8a[_0x80b7('0x23')]()[_0x80b7('0x22')](function(){_0x5e8093[_0x80b7('0x15')](0xcc)[_0x80b7('0x16')]();});}};}function handleEntityNotFound(_0x44ab49,_0xea1ea0){return function(_0x23a876){if(!_0x23a876){_0x44ab49[_0x80b7('0x14')](0x194);}return _0x23a876;};}function handleError(_0x1221c7,_0x4cb8c9){_0x4cb8c9=_0x4cb8c9||0x1f4;return function(_0x328c15){logger[_0x80b7('0x24')](_0x328c15[_0x80b7('0x25')]);if(_0x328c15[_0x80b7('0x26')]){delete _0x328c15[_0x80b7('0x26')];}_0x1221c7[_0x80b7('0x15')](_0x4cb8c9)[_0x80b7('0x27')](_0x328c15);};}exports[_0x80b7('0x28')]=function(_0x479335,_0x42e7a6){var _0x23958b={},_0x1dc2df={},_0x396144={'count':0x0,'rows':[]};var _0x46b76b=_['map'](db[_0x80b7('0x29')][_0x80b7('0x2a')],function(_0x2cc6f7){return{'name':_0x2cc6f7[_0x80b7('0x2b')],'type':_0x2cc6f7[_0x80b7('0x2c')][_0x80b7('0x2d')]};});_0x1dc2df[_0x80b7('0x2e')]=_['map'](_0x46b76b,_0x80b7('0x26'));_0x1dc2df[_0x80b7('0x2f')]=_['keys'](_0x479335[_0x80b7('0x2f')]);_0x1dc2df[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x1dc2df[_0x80b7('0x2e')],_0x1dc2df[_0x80b7('0x2f')]);_0x23958b[_0x80b7('0x32')]=_['intersection'](_0x1dc2df[_0x80b7('0x2e')],qs[_0x80b7('0x33')](_0x479335[_0x80b7('0x2f')]['fields']));_0x23958b[_0x80b7('0x32')]=_0x23958b[_0x80b7('0x32')][_0x80b7('0x34')]?_0x23958b['attributes']:_0x1dc2df[_0x80b7('0x2e')];if(!_0x479335[_0x80b7('0x2f')][_0x80b7('0x35')](_0x80b7('0x36'))){_0x23958b[_0x80b7('0x19')]=qs[_0x80b7('0x19')](_0x479335[_0x80b7('0x2f')][_0x80b7('0x19')]);_0x23958b['offset']=qs['offset'](_0x479335[_0x80b7('0x2f')][_0x80b7('0x17')]);}_0x23958b[_0x80b7('0x37')]=qs[_0x80b7('0x38')](_0x479335['query']['sort']);_0x23958b[_0x80b7('0x39')]=qs[_0x80b7('0x30')](_[_0x80b7('0x3a')](_0x479335[_0x80b7('0x2f')],_0x1dc2df['filters']),_0x46b76b);if(_0x479335[_0x80b7('0x2f')][_0x80b7('0x3b')]){_0x23958b['where']=_[_0x80b7('0x3c')](_0x23958b['where'],{'$or':_[_0x80b7('0x3d')](_0x46b76b,function(_0x490b91){if(_0x490b91['type']!==_0x80b7('0x3e')){var _0x76ffba={};_0x76ffba[_0x490b91[_0x80b7('0x26')]]={'$like':'%'+_0x479335[_0x80b7('0x2f')]['filter']+'%'};return _0x76ffba;}})});}_0x23958b=_['merge']({},_0x23958b,_0x479335[_0x80b7('0x3f')]);var _0x4f50ca={'where':_0x23958b[_0x80b7('0x39')]};return db[_0x80b7('0x29')]['count'](_0x4f50ca)['then'](function(_0x15fe0d){_0x396144[_0x80b7('0x1a')]=_0x15fe0d;if(_0x479335[_0x80b7('0x2f')]['includeAll']){_0x23958b[_0x80b7('0x40')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x23958b);})[_0x80b7('0x22')](function(_0x1b2fda){_0x396144[_0x80b7('0x41')]=_0x1b2fda;return _0x396144;})[_0x80b7('0x22')](respondWithFilteredResult(_0x42e7a6,_0x23958b))[_0x80b7('0x42')](handleError(_0x42e7a6,null));};exports[_0x80b7('0x43')]=function(_0xa12f05,_0x2070fc){var _0xa5d1bf={'raw':!![],'where':{'id':_0xa12f05[_0x80b7('0x44')]['id']}},_0x190d41={};_0x190d41[_0x80b7('0x2e')]=_['keys'](db[_0x80b7('0x29')][_0x80b7('0x2a')]);_0x190d41[_0x80b7('0x2f')]=_[_0x80b7('0x45')](_0xa12f05[_0x80b7('0x2f')]);_0x190d41[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x190d41[_0x80b7('0x2e')],_0x190d41[_0x80b7('0x2f')]);_0xa5d1bf[_0x80b7('0x32')]=_[_0x80b7('0x31')](_0x190d41['model'],qs[_0x80b7('0x33')](_0xa12f05['query'][_0x80b7('0x33')]));_0xa5d1bf[_0x80b7('0x32')]=_0xa5d1bf[_0x80b7('0x32')][_0x80b7('0x34')]?_0xa5d1bf['attributes']:_0x190d41[_0x80b7('0x2e')];if(_0xa12f05[_0x80b7('0x2f')]['includeAll']){_0xa5d1bf[_0x80b7('0x40')]=[{'all':!![]}];}_0xa5d1bf=_[_0x80b7('0x3c')]({},_0xa5d1bf,_0xa12f05['options']);return db[_0x80b7('0x29')][_0x80b7('0x46')](_0xa5d1bf)['then'](handleEntityNotFound(_0x2070fc,null))['then'](respondWithResult(_0x2070fc,null))[_0x80b7('0x42')](handleError(_0x2070fc,null));};exports[_0x80b7('0x47')]=function(_0xb75a61,_0x29bee7){return db[_0x80b7('0x29')][_0x80b7('0x47')](_0xb75a61[_0x80b7('0x48')],{})['then'](respondWithResult(_0x29bee7,0xc9))['catch'](handleError(_0x29bee7,null));};exports['update']=function(_0x599205,_0x52fd0b){if(_0x599205['body']['id']){delete _0x599205[_0x80b7('0x48')]['id'];}return db[_0x80b7('0x29')][_0x80b7('0x46')]({'where':{'id':_0x599205['params']['id']}})[_0x80b7('0x22')](handleEntityNotFound(_0x52fd0b,null))[_0x80b7('0x22')](saveUpdates(_0x599205[_0x80b7('0x48')],null))['then'](respondWithResult(_0x52fd0b,null))[_0x80b7('0x42')](handleError(_0x52fd0b,null));};exports['destroy']=function(_0x1e7536,_0x2a642e){return db[_0x80b7('0x29')]['find']({'where':{'id':_0x1e7536[_0x80b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a642e,null))['then'](removeEntity(_0x2a642e,null))[_0x80b7('0x42')](handleError(_0x2a642e,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 47c29a3..b8f99e4 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 _0xaf89=['desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_desk_fields'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaf89,0xd5));var _0x9af8=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xaf89[_0x202c61];return _0x540691;};'use strict';var _=require(_0x9af8('0x0'));var util=require('util');var logger=require(_0x9af8('0x1'))(_0x9af8('0x2'));var moment=require(_0x9af8('0x3'));var BPromise=require(_0x9af8('0x4'));var rp=require(_0x9af8('0x5'));var fs=require('fs');var path=require(_0x9af8('0x6'));var rimraf=require(_0x9af8('0x7'));var config=require(_0x9af8('0x8'));var attributes=require('./intDeskField.attributes');module[_0x9af8('0x9')]=function(_0xf5e8bc,_0x22edf0){return _0xf5e8bc[_0x9af8('0xa')]('DeskField',attributes,{'tableName':_0x9af8('0xb'),'paranoid':![],'indexes':[{'name':_0x9af8('0xc'),'fields':[_0x9af8('0xd'),_0x9af8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbcd=['DeskField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2ee11d,_0x3afc4b){var _0x2ee7a9=function(_0x19a8fb){while(--_0x19a8fb){_0x2ee11d['push'](_0x2ee11d['shift']());}};_0x2ee7a9(++_0x3afc4b);}(_0xdbcd,0x135));var _0xddbc=function(_0x1b878a,_0x52e034){_0x1b878a=_0x1b878a-0x0;var _0x418e7d=_0xdbcd[_0x1b878a];return _0x418e7d;};'use strict';var _=require(_0xddbc('0x0'));var util=require(_0xddbc('0x1'));var logger=require(_0xddbc('0x2'))(_0xddbc('0x3'));var moment=require('moment');var BPromise=require(_0xddbc('0x4'));var rp=require(_0xddbc('0x5'));var fs=require('fs');var path=require(_0xddbc('0x6'));var rimraf=require(_0xddbc('0x7'));var config=require(_0xddbc('0x8'));var attributes=require('./intDeskField.attributes');module[_0xddbc('0x9')]=function(_0x21e721,_0x4d6647){return _0x21e721['define'](_0xddbc('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index ac94060..e8d9144 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 _0x247c=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x247c,0xbf));var _0xc247=function(_0x39edf1,_0x3616a9){_0x39edf1=_0x39edf1-0x0;var _0x348891=_0x247c[_0x39edf1];return _0x348891;};'use strict';var _=require(_0xc247('0x0'));var util=require(_0xc247('0x1'));var moment=require(_0xc247('0x2'));var BPromise=require(_0xc247('0x3'));var rs=require(_0xc247('0x4'));var fs=require('fs');var Redis=require(_0xc247('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc247('0x6'));var logger=require(_0xc247('0x7'))(_0xc247('0x8'));var config=require(_0xc247('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc247('0xa')][_0xc247('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbfb70f,_0x2826dd,_0x1db307){return new BPromise(function(_0x58608a,_0x39d6c4){return client[_0xc247('0xc')](_0xbfb70f,_0x1db307)[_0xc247('0xd')](function(_0x339de3){logger[_0xc247('0xe')](_0xc247('0xf'),_0x2826dd,_0xc247('0x10'));logger[_0xc247('0x11')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2826dd,'request\x20sent',JSON[_0xc247('0x12')](_0x339de3));if(_0x339de3['error']){if(_0x339de3[_0xc247('0x13')][_0xc247('0x14')]===0x1f4){logger[_0xc247('0x13')](_0xc247('0xf'),_0x2826dd,_0x339de3[_0xc247('0x13')]['message']);return _0x39d6c4(_0x339de3[_0xc247('0x13')][_0xc247('0x15')]);}logger[_0xc247('0x13')](_0xc247('0xf'),_0x2826dd,_0x339de3[_0xc247('0x13')][_0xc247('0x15')]);return _0x58608a(_0x339de3[_0xc247('0x13')][_0xc247('0x15')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x2826dd,'request\x20sent');_0x58608a(_0x339de3[_0xc247('0x16')]['message']);}})['catch'](function(_0x49f1d7){logger['error'](_0xc247('0xf'),_0x2826dd,_0x49f1d7);_0x39d6c4(_0x49f1d7);});});} \ No newline at end of file +var _0x20c5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','error','code','message','DeskField,\x20%s,\x20%s','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x28b7ab,_0x16a764){var _0x56791b=function(_0x25d20d){while(--_0x25d20d){_0x28b7ab['push'](_0x28b7ab['shift']());}};_0x56791b(++_0x16a764);}(_0x20c5,0xa2));var _0x520c=function(_0x1d8e01,_0x482d5b){_0x1d8e01=_0x1d8e01-0x0;var _0x2753ea=_0x20c5[_0x1d8e01];return _0x2753ea;};'use strict';var _=require('lodash');var util=require(_0x520c('0x0'));var moment=require(_0x520c('0x1'));var BPromise=require(_0x520c('0x2'));var rs=require(_0x520c('0x3'));var fs=require('fs');var Redis=require(_0x520c('0x4'));var db=require(_0x520c('0x5'))['db'];var utils=require(_0x520c('0x6'));var logger=require(_0x520c('0x7'))(_0x520c('0x8'));var config=require(_0x520c('0x9'));var jayson=require(_0x520c('0xa'));var client=jayson[_0x520c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bd533,_0x2bc0d4,_0xf91aac){return new BPromise(function(_0x199883,_0x2216a1){return client[_0x520c('0xc')](_0x5bd533,_0xf91aac)[_0x520c('0xd')](function(_0x3036ad){logger[_0x520c('0xe')]('DeskField,\x20%s,\x20%s',_0x2bc0d4,_0x520c('0xf'));logger[_0x520c('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2bc0d4,_0x520c('0xf'),JSON['stringify'](_0x3036ad));if(_0x3036ad['error']){if(_0x3036ad[_0x520c('0x11')][_0x520c('0x12')]===0x1f4){logger[_0x520c('0x11')]('DeskField,\x20%s,\x20%s',_0x2bc0d4,_0x3036ad[_0x520c('0x11')][_0x520c('0x13')]);return _0x2216a1(_0x3036ad[_0x520c('0x11')][_0x520c('0x13')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x2bc0d4,_0x3036ad['error'][_0x520c('0x13')]);return _0x199883(_0x3036ad[_0x520c('0x11')][_0x520c('0x13')]);}else{logger[_0x520c('0xe')](_0x520c('0x14'),_0x2bc0d4,_0x520c('0xf'));_0x199883(_0x3036ad['result']['message']);}})['catch'](function(_0x35a11a){logger[_0x520c('0x11')](_0x520c('0x14'),_0x2bc0d4,_0x35a11a);_0x2216a1(_0x35a11a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4a817c3..e434a04 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 _0xb090=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0xb090,0x13c));var _0x0b09=function(_0x304641,_0x55ebd8){_0x304641=_0x304641-0x0;var _0x221f56=_0xb090[_0x304641];return _0x221f56;};'use strict';var multer=require(_0x0b09('0x0'));var util=require(_0x0b09('0x1'));var path=require(_0x0b09('0x2'));var timeout=require(_0x0b09('0x3'));var express=require(_0x0b09('0x4'));var router=express[_0x0b09('0x5')]();var fs_extra=require(_0x0b09('0x6'));var auth=require(_0x0b09('0x7'));var interaction=require(_0x0b09('0x8'));var config=require(_0x0b09('0x9'));var controller=require(_0x0b09('0xa'));router[_0x0b09('0xb')]('/',auth[_0x0b09('0xc')](),controller['index']);router[_0x0b09('0xb')](_0x0b09('0xd'),auth[_0x0b09('0xc')](),controller['show']);router[_0x0b09('0xb')](_0x0b09('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x0b09('0xc')](),controller[_0x0b09('0xf')]);router[_0x0b09('0x10')]('/',auth[_0x0b09('0xc')](),controller[_0x0b09('0x11')]);router[_0x0b09('0x10')](_0x0b09('0xe'),auth[_0x0b09('0xc')](),controller[_0x0b09('0x12')]);router[_0x0b09('0x13')]('/:id',auth[_0x0b09('0xc')](),controller['update']);router[_0x0b09('0x14')](_0x0b09('0xd'),auth[_0x0b09('0xc')](),controller[_0x0b09('0x15')]);module[_0x0b09('0x16')]=router; \ No newline at end of file +var _0x8313=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x55e285,_0x2e21f2){var _0xb51743=function(_0x1f0327){while(--_0x1f0327){_0x55e285['push'](_0x55e285['shift']());}};_0xb51743(++_0x2e21f2);}(_0x8313,0xab));var _0x3831=function(_0x22d97d,_0xf7366c){_0x22d97d=_0x22d97d-0x0;var _0x365a3e=_0x8313[_0x22d97d];return _0x365a3e;};'use strict';var multer=require(_0x3831('0x0'));var util=require(_0x3831('0x1'));var path=require('path');var timeout=require(_0x3831('0x2'));var express=require(_0x3831('0x3'));var router=express[_0x3831('0x4')]();var fs_extra=require(_0x3831('0x5'));var auth=require(_0x3831('0x6'));var interaction=require(_0x3831('0x7'));var config=require(_0x3831('0x8'));var controller=require(_0x3831('0x9'));router[_0x3831('0xa')]('/',auth['isAuthenticated'](),controller[_0x3831('0xb')]);router['get'](_0x3831('0xc'),auth['isAuthenticated'](),controller[_0x3831('0xd')]);router['get'](_0x3831('0xe'),auth[_0x3831('0xf')](),controller[_0x3831('0x10')]);router[_0x3831('0xa')](_0x3831('0x11'),auth[_0x3831('0xf')](),controller[_0x3831('0x12')]);router[_0x3831('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3831('0x13')]('/:id/configurations',auth[_0x3831('0xf')](),controller[_0x3831('0x14')]);router['put'](_0x3831('0xc'),auth['isAuthenticated'](),controller[_0x3831('0x15')]);router[_0x3831('0x16')](_0x3831('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3831('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 981f6b7..87f42f2 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 _0x873a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1c1eb0,_0x5e6aaf){var _0x4e12d7=function(_0x591be9){while(--_0x591be9){_0x1c1eb0['push'](_0x1c1eb0['shift']());}};_0x4e12d7(++_0x5e6aaf);}(_0x873a,0x1c2));var _0xa873=function(_0x2a7873,_0xe7a2b8){_0x2a7873=_0x2a7873-0x0;var _0x436bf4=_0x873a[_0x2a7873];return _0x436bf4;};'use strict';var Sequelize=require(_0xa873('0x0'));module[_0xa873('0x1')]={'name':{'type':Sequelize[_0xa873('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa873('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa873('0x2')]},'clientSecret':{'type':Sequelize[_0xa873('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa873('0x2')]},'modernAuthentication':{'type':Sequelize[_0xa873('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xec39=['STRING','sequelize','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xec39,0x19f));var _0x9ec3=function(_0xdb76ef,_0x27656f){_0xdb76ef=_0xdb76ef-0x0;var _0x4ad7b4=_0xec39[_0xdb76ef];return _0x4ad7b4;};'use strict';var Sequelize=require(_0x9ec3('0x0'));module[_0x9ec3('0x1')]={'name':{'type':Sequelize[_0x9ec3('0x2')]},'username':{'type':Sequelize[_0x9ec3('0x2')]},'password':{'type':Sequelize[_0x9ec3('0x2')]},'remoteUri':{'type':Sequelize[_0x9ec3('0x2')]},'tenantId':{'type':Sequelize[_0x9ec3('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x9ec3('0x2')]},'serverUrl':{'type':Sequelize[_0x9ec3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9ec3('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 7f9b30a..69baa2e 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 _0xc882=['modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','/oauth2/token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','remove','includes','LogicalName','forEach','@odata.type','all','isNil','BooleanAttributeMetadata','push','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','error','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','update','then','end','sendStatus','name','send','index','Dynamics365Account','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname'];(function(_0x530db1,_0x2b9531){var _0x31c1f2=function(_0x1c77b3){while(--_0x1c77b3){_0x530db1['push'](_0x530db1['shift']());}};_0x31c1f2(++_0x2b9531);}(_0xc882,0xff));var _0x2c88=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc882[_0x17d9e3];return _0x14192d;};'use strict';var rp=require(_0x2c88('0x0'));var util=require(_0x2c88('0x1'));var _=require(_0x2c88('0x2'));var qs=require(_0x2c88('0x3'));var logger=require(_0x2c88('0x4'))(_0x2c88('0x5'));var db=require(_0x2c88('0x6'))['db'];var integrations=require(_0x2c88('0x7'));function respondWithResult(_0x23e92c,_0x359f11){_0x359f11=_0x359f11||0xc8;return function(_0x32d31e){if(_0x32d31e){return _0x23e92c[_0x2c88('0x8')](_0x359f11)[_0x2c88('0x9')](_0x32d31e);}};}function respondWithFilteredResult(_0x15eadc,_0x26bfea){return function(_0x4da29d){if(_0x4da29d){var _0x5e2f93=typeof _0x26bfea['offset']===_0x2c88('0xa')&&typeof _0x26bfea[_0x2c88('0xb')]==='undefined';var _0x1ee743=_0x4da29d[_0x2c88('0xc')];var _0x5df60c=_0x5e2f93?0x0:_0x26bfea[_0x2c88('0xd')];var _0x183b3b=_0x5e2f93?_0x4da29d[_0x2c88('0xc')]:_0x26bfea['offset']+_0x26bfea[_0x2c88('0xb')];var _0x259e9f;if(_0x183b3b>=_0x1ee743){_0x183b3b=_0x1ee743;_0x259e9f=0xc8;}else{_0x259e9f=0xce;}_0x15eadc['status'](_0x259e9f);return _0x15eadc[_0x2c88('0xe')](_0x2c88('0xf'),_0x5df60c+'-'+_0x183b3b+'/'+_0x1ee743)['json'](_0x4da29d);}return null;};}function saveUpdates(_0x52d5f4){return function(_0x16e9a9){if(_0x16e9a9){return _0x16e9a9[_0x2c88('0x10')](_0x52d5f4)[_0x2c88('0x11')](function(_0x5e099f){return _0x5e099f;});}return null;};}function removeEntity(_0x582300){return function(_0x3e3729){if(_0x3e3729){return _0x3e3729['destroy']()[_0x2c88('0x11')](function(){_0x582300[_0x2c88('0x8')](0xcc)[_0x2c88('0x12')]();});}};}function handleEntityNotFound(_0x45a679){return function(_0x3fb359){if(!_0x3fb359){_0x45a679[_0x2c88('0x13')](0x194);}return _0x3fb359;};}function handleError(_0x5039d8,_0x4e13dc){_0x4e13dc=_0x4e13dc||0x1f4;return function(_0x37b8fe){logger['error'](_0x37b8fe['stack']);if(_0x37b8fe[_0x2c88('0x14')]){delete _0x37b8fe[_0x2c88('0x14')];}_0x5039d8[_0x2c88('0x8')](_0x4e13dc)[_0x2c88('0x15')](_0x37b8fe);};}exports[_0x2c88('0x16')]=function(_0x26a9b5,_0x4a81e5){var _0x1125ef={},_0x1ca00f={},_0x23e02a={'count':0x0,'rows':[]};var _0x322d5c=_['map'](db[_0x2c88('0x17')][_0x2c88('0x18')],function(_0x201cb6){return{'name':_0x201cb6[_0x2c88('0x19')],'type':_0x201cb6['type'][_0x2c88('0x1a')]};});_0x1ca00f['model']=_[_0x2c88('0x1b')](_0x322d5c,'name');_0x1ca00f[_0x2c88('0x1c')]=_[_0x2c88('0x1d')](_0x26a9b5[_0x2c88('0x1c')]);_0x1ca00f[_0x2c88('0x1e')]=_[_0x2c88('0x1f')](_0x1ca00f['model'],_0x1ca00f['query']);_0x1125ef[_0x2c88('0x20')]=_[_0x2c88('0x1f')](_0x1ca00f['model'],qs['fields'](_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0x21')]));_0x1125ef[_0x2c88('0x20')]=_0x1125ef[_0x2c88('0x20')][_0x2c88('0x22')]?_0x1125ef[_0x2c88('0x20')]:_0x1ca00f[_0x2c88('0x23')];if(!_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0x24')]('nolimit')){_0x1125ef['limit']=qs['limit'](_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0xb')]);_0x1125ef[_0x2c88('0xd')]=qs['offset'](_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0xd')]);}_0x1125ef[_0x2c88('0x25')]=qs[_0x2c88('0x26')](_0x26a9b5[_0x2c88('0x1c')]['sort']);_0x1125ef['where']=qs['filters'](_[_0x2c88('0x27')](_0x26a9b5[_0x2c88('0x1c')],_0x1ca00f[_0x2c88('0x1e')]),_0x322d5c);if(_0x26a9b5[_0x2c88('0x1c')][_0x2c88('0x28')]){_0x1125ef[_0x2c88('0x29')]=_[_0x2c88('0x2a')](_0x1125ef[_0x2c88('0x29')],{'$or':_[_0x2c88('0x1b')](_0x322d5c,function(_0x1bde07){if(_0x1bde07[_0x2c88('0x2b')]!=='VIRTUAL'){var _0x57f58e={};_0x57f58e[_0x1bde07['name']]={'$like':'%'+_0x26a9b5[_0x2c88('0x1c')]['filter']+'%'};return _0x57f58e;}})});}_0x1125ef=_['merge']({},_0x1125ef,_0x26a9b5[_0x2c88('0x2c')]);var _0x44867e={'where':_0x1125ef[_0x2c88('0x29')]};return db[_0x2c88('0x17')]['count'](_0x44867e)['then'](function(_0x633639){_0x23e02a['count']=_0x633639;if(_0x26a9b5['query'][_0x2c88('0x2d')]){_0x1125ef[_0x2c88('0x2e')]=[{'all':!![]}];}return db[_0x2c88('0x17')][_0x2c88('0x2f')](_0x1125ef);})[_0x2c88('0x11')](function(_0x5d5911){_0x23e02a[_0x2c88('0x30')]=_0x5d5911;return _0x23e02a;})['then'](respondWithFilteredResult(_0x4a81e5,_0x1125ef))['catch'](handleError(_0x4a81e5,null));};exports[_0x2c88('0x31')]=function(_0x3e0bf0,_0x27db55){var _0x46be58={'raw':![],'where':{'id':_0x3e0bf0[_0x2c88('0x32')]['id']}},_0x409171={};_0x409171[_0x2c88('0x23')]=_[_0x2c88('0x1d')](db[_0x2c88('0x17')]['rawAttributes']);_0x409171[_0x2c88('0x1c')]=_[_0x2c88('0x1d')](_0x3e0bf0[_0x2c88('0x1c')]);_0x409171[_0x2c88('0x1e')]=_[_0x2c88('0x1f')](_0x409171['model'],_0x409171['query']);_0x46be58[_0x2c88('0x20')]=_[_0x2c88('0x1f')](_0x409171[_0x2c88('0x23')],qs[_0x2c88('0x21')](_0x3e0bf0['query'][_0x2c88('0x21')]));_0x46be58[_0x2c88('0x20')]=_0x46be58[_0x2c88('0x20')][_0x2c88('0x22')]?_0x46be58[_0x2c88('0x20')]:_0x409171[_0x2c88('0x23')];if(_0x3e0bf0[_0x2c88('0x1c')][_0x2c88('0x2d')]){_0x46be58[_0x2c88('0x2e')]=[{'all':!![]}];}_0x46be58=_[_0x2c88('0x2a')]({},_0x46be58,_0x3e0bf0[_0x2c88('0x2c')]);return db[_0x2c88('0x17')][_0x2c88('0x33')](_0x46be58)['then'](handleEntityNotFound(_0x27db55,null))[_0x2c88('0x11')](respondWithResult(_0x27db55,null))[_0x2c88('0x34')](handleError(_0x27db55,null));};exports[_0x2c88('0x35')]=function(_0x4d8cc7,_0x10d1eb){return db[_0x2c88('0x17')][_0x2c88('0x35')](_0x4d8cc7[_0x2c88('0x36')],{})[_0x2c88('0x11')](respondWithResult(_0x10d1eb,0xc9))[_0x2c88('0x34')](handleError(_0x10d1eb,null));};exports[_0x2c88('0x10')]=function(_0x5af77f,_0x12dfc5){if(_0x5af77f[_0x2c88('0x36')]['id']){delete _0x5af77f['body']['id'];}return db['Dynamics365Account'][_0x2c88('0x33')]({'where':{'id':_0x5af77f[_0x2c88('0x32')]['id']}})['then'](handleEntityNotFound(_0x12dfc5,null))[_0x2c88('0x11')](saveUpdates(_0x5af77f[_0x2c88('0x36')],null))['then'](respondWithResult(_0x12dfc5,null))['catch'](handleError(_0x12dfc5,null));};exports[_0x2c88('0x37')]=function(_0x163ee0,_0x425460){return db['Dynamics365Account'][_0x2c88('0x33')]({'where':{'id':_0x163ee0['params']['id']}})[_0x2c88('0x11')](handleEntityNotFound(_0x425460,null))[_0x2c88('0x11')](removeEntity(_0x425460,null))[_0x2c88('0x34')](handleError(_0x425460,null));};exports[_0x2c88('0x38')]=function(_0x4d6c64,_0x259718){var _0x4618a9={};var _0xdc614b={};var _0x452f77;var _0x27bd1d;return db[_0x2c88('0x17')][_0x2c88('0x39')]({'where':{'id':_0x4d6c64[_0x2c88('0x32')]['id']}})[_0x2c88('0x11')](handleEntityNotFound(_0x259718,null))[_0x2c88('0x11')](function(_0x20dd2b){if(_0x20dd2b){_0x452f77=_0x20dd2b;_0xdc614b[_0x2c88('0x23')]=_[_0x2c88('0x1d')](db[_0x2c88('0x3a')][_0x2c88('0x18')]);_0xdc614b[_0x2c88('0x1c')]=_[_0x2c88('0x1d')](_0x4d6c64['query']);_0xdc614b[_0x2c88('0x1e')]=_[_0x2c88('0x1f')](_0xdc614b['model'],_0xdc614b[_0x2c88('0x1c')]);_0x4618a9[_0x2c88('0x20')]=_[_0x2c88('0x1f')](_0xdc614b[_0x2c88('0x23')],qs['fields'](_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0x21')]));_0x4618a9[_0x2c88('0x20')]=_0x4618a9[_0x2c88('0x20')][_0x2c88('0x22')]?_0x4618a9[_0x2c88('0x20')]:_0xdc614b['model'];_0x4618a9['order']=qs[_0x2c88('0x26')](_0x4d6c64[_0x2c88('0x1c')]['sort']);_0x4618a9['where']=qs['filters'](_['pick'](_0x4d6c64['query'],_0xdc614b[_0x2c88('0x1e')]));if(_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0x28')]){_0x4618a9['where']=_[_0x2c88('0x2a')](_0x4618a9['where'],{'$or':_[_0x2c88('0x1b')](_0x4618a9[_0x2c88('0x20')],function(_0x47abdb){var _0x5c1204={};_0x5c1204[_0x47abdb]={'$like':'%'+_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0x28')]+'%'};return _0x5c1204;})});}_0x4618a9=_[_0x2c88('0x2a')]({},_0x4618a9,_0x4d6c64['options']);return _0x452f77['getConfigurations'](_0x4618a9);}})[_0x2c88('0x11')](function(_0x5516c9){if(_0x5516c9){_0x27bd1d=_0x5516c9[_0x2c88('0x22')];if(!_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0x24')]('nolimit')){_0x4618a9[_0x2c88('0xb')]=qs[_0x2c88('0xb')](_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0xb')]);_0x4618a9[_0x2c88('0xd')]=qs[_0x2c88('0xd')](_0x4d6c64[_0x2c88('0x1c')][_0x2c88('0xd')]);}return _0x452f77[_0x2c88('0x38')](_0x4618a9);}})['then'](function(_0x1361ce){if(_0x1361ce){return _0x1361ce?{'count':_0x27bd1d,'rows':_0x1361ce}:null;}})[_0x2c88('0x11')](respondWithResult(_0x259718,null))[_0x2c88('0x34')](handleError(_0x259718,null));};exports[_0x2c88('0x3b')]=function(_0xb132f2,_0x1fc3e9){if(_0xb132f2[_0x2c88('0x36')]['id']){delete _0xb132f2['body']['id'];}return db[_0x2c88('0x17')][_0x2c88('0x39')]({'where':{'id':_0xb132f2[_0x2c88('0x32')]['id']}})[_0x2c88('0x11')](handleEntityNotFound(_0x1fc3e9,null))[_0x2c88('0x11')](function(_0x555db9){if(_0x555db9){_0xb132f2[_0x2c88('0x36')][_0x2c88('0x3c')]=_0x555db9['id'];_0xb132f2[_0x2c88('0x36')][_0x2c88('0x3d')]=integrations[_0x2c88('0x3e')](_0xb132f2[_0x2c88('0x36')][_0x2c88('0x3f')],_0xb132f2[_0x2c88('0x36')][_0x2c88('0x2b')]);_0xb132f2[_0x2c88('0x36')][_0x2c88('0x40')]=integrations['getDescriptions'](_0xb132f2[_0x2c88('0x36')]['channel'],_0xb132f2['body'][_0x2c88('0x2b')]);return db[_0x2c88('0x3a')][_0x2c88('0x35')](_0xb132f2[_0x2c88('0x36')],{'include':[{'model':db[_0x2c88('0x41')],'as':_0x2c88('0x3d')},{'model':db['Dynamics365Field'],'as':_0x2c88('0x40')}]});}return null;})['then'](respondWithResult(_0x1fc3e9,null))['catch'](handleError(_0x1fc3e9,null));};function sanitizeRemoteUri(_0x1d396e){var _0xf36221=_0x1d396e[_0x2c88('0x42')](-0x1);if(_0xf36221==='/')return _0x1d396e[_0x2c88('0x43')](0x0,_0x1d396e[_0x2c88('0x44')](_0xf36221));return _0x1d396e;}function getWebApiUrl(_0x5e0e2f){return util[_0x2c88('0x45')]('%s/api/data/v9.0/',_0x5e0e2f);}exports[_0x2c88('0x46')]=function(_0x2638f3,_0x48d1d8){var _0x343311=_0x2638f3[_0x2c88('0x1c')][_0x2c88('0x47')];var _0x69d747=_0x343311==='incident'?_0x2c88('0x48'):_0x2c88('0x49');var _0x3ea3b1='';var _0x10c8d8='';var _0x375de0='';var _0x166e94='';var _0x5dce1a='';var _0x1df0b0='';var _0xbc1289='';var _0x24e091='';var _0x3e2641=[_0x2c88('0x4a'),'description',_0x2c88('0x4b'),_0x2c88('0x4c'),_0x2c88('0x4d'),_0x2c88('0x4e'),'phonenumber',_0x2c88('0x4f'),'directioncode',_0x2c88('0x50')];var _0x3ea7d4=[_0x2c88('0x51'),_0x2c88('0x52'),'actualserviceunits',_0x2c88('0x53'),_0x2c88('0x54'),'contactidyominame',_0x2c88('0x55'),_0x2c88('0x56'),'createdbyexternalpartyname',_0x2c88('0x57'),_0x2c88('0x58'),_0x2c88('0x59'),_0x2c88('0x5a'),_0x2c88('0x5b'),'createdonbehalfbyyominame','customeridname',_0x2c88('0x5c'),_0x2c88('0x5d'),'emailaddress',_0x2c88('0x5e'),_0x2c88('0x5f'),_0x2c88('0x60'),'escalatedon',_0x2c88('0x61'),'firstresponsebykpiidname',_0x2c88('0x62'),'importsequencenumber',_0x2c88('0x63'),_0x2c88('0x64'),_0x2c88('0x65'),_0x2c88('0x66'),_0x2c88('0x67'),_0x2c88('0x68'),_0x2c88('0x69'),_0x2c88('0x6a'),_0x2c88('0x6b'),_0x2c88('0x6c'),_0x2c88('0x6d'),_0x2c88('0x6e'),'msdyn_iotalertname',_0x2c88('0x6f'),_0x2c88('0x70'),'overriddencreatedon','owneridname',_0x2c88('0x71'),_0x2c88('0x72'),_0x2c88('0x73'),_0x2c88('0x74'),'primarycontactidyominame',_0x2c88('0x75'),_0x2c88('0x76'),'productserialnumber','resolveby',_0x2c88('0x77'),'responseby',_0x2c88('0x78'),_0x2c88('0x79'),_0x2c88('0x7a'),_0x2c88('0x7b'),_0x2c88('0x7c'),_0x2c88('0x7d'),_0x2c88('0x7e'),_0x2c88('0x7f'),'subjectidname','ticketnumber',_0x2c88('0x80'),_0x2c88('0x81'),_0x2c88('0x82'),_0x2c88('0x83'),_0x2c88('0x84')];var _0x129715=_0x3e2641[_0x2c88('0x85')](_0x3ea7d4);return db['Dynamics365Account'][_0x2c88('0x39')]({'where':{'id':_0x2638f3[_0x2c88('0x32')]['id']},'attributes':['id','username',_0x2c88('0x86'),_0x2c88('0x87'),_0x2c88('0x88'),_0x2c88('0x89'),_0x2c88('0x8a'),_0x2c88('0x8b')],'include':[{'model':db[_0x2c88('0x8c')],'as':_0x2c88('0x8c'),'attributes':['id',_0x2c88('0x8d'),_0x2c88('0x8e')]}]})[_0x2c88('0x11')](handleEntityNotFound(_0x48d1d8,null))[_0x2c88('0x11')](function(_0x4280f0){if(_0x4280f0){if(_0x4280f0[_0x2c88('0x8b')]){_0x4280f0['access_token']=_0x4280f0[_0x2c88('0x8c')][_0x2c88('0x8d')];_0x24e091=sanitizeRemoteUri(_0x4280f0[_0x2c88('0x8c')][_0x2c88('0x8e')]);_0xbc1289=getWebApiUrl(_0x24e091);return _0x4280f0;}_0x24e091=sanitizeRemoteUri(_0x4280f0['remoteUri']);_0xbc1289=getWebApiUrl(_0x24e091);var _0x31b1fd={'method':_0x2c88('0x8f'),'uri':'https://login.microsoftonline.com/'+_0x4280f0[_0x2c88('0x88')]+_0x2c88('0x90'),'form':{'client_id':_0x4280f0[_0x2c88('0x89')],'resource':_0x24e091,'username':_0x4280f0['username'],'password':_0x4280f0[_0x2c88('0x86')],'grant_type':_0x2c88('0x86'),'client_secret':_0x4280f0[_0x2c88('0x8a')]},'json':!![]};return rp(_0x31b1fd);}})[_0x2c88('0x11')](function(_0x74502f){_0x1df0b0=_0x74502f['access_token'];var _0x561dd9={'method':_0x2c88('0x91'),'uri':encodeURI(_0xbc1289+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x69d747+'\x27'),'headers':{'Authorization':_0x2c88('0x92')+_0x1df0b0,'If-None-Match':null,'OData-Version':_0x2c88('0x93')},'json':!![]};return rp(_0x561dd9);})['then'](function(_0x3ef4ee){var _0xfa4cba=_0x3ef4ee[_0x2c88('0x94')][0x0];var _0x3832ca=_0xfa4cba[_0x2c88('0x95')];var _0x415de5={'method':_0x2c88('0x91'),'uri':_0xbc1289+_0x2c88('0x96')+_0x3832ca+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x2c88('0x92')+_0x1df0b0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x415de5);})[_0x2c88('0x11')](function(_0x2b833b){_0x3ea3b1=_0x2b833b;_0x10c8d8=_0x3ea3b1['Attributes'];_0x10c8d8=_[_0x2c88('0x97')](_0x10c8d8,function(_0x1ac309){return!_0x129715[_0x2c88('0x98')](_0x1ac309[_0x2c88('0x99')]);});var _0x42e0cc=[];var _0x5e2de6=[];_0x10c8d8[_0x2c88('0x9a')](function(_0x1a1220){if(_0x1a1220[_0x2c88('0x9b')]){var _0x55d38d=_0x1a1220[_0x2c88('0x9b')][_0x2c88('0x43')](_0x1a1220['@odata.type'][_0x2c88('0x44')]('.')+0x1);if(_0x55d38d==='PicklistAttributeMetadata'){_0x42e0cc['push'](getSelectList(_0xbc1289,_0x343311,_0x5e2de6,_0x3ea3b1[_0x2c88('0x95')],_0x1a1220['MetadataId'],_0x1df0b0));}}});return Promise[_0x2c88('0x9c')](_0x42e0cc);})[_0x2c88('0x11')](function(_0x42e69e){_0x375de0=_0x42e69e[0x0];var _0x2116ce=[];var _0xeafebd=[];_0x10c8d8['forEach'](function(_0x401dd6){if(!_[_0x2c88('0x9d')](_0x401dd6['@odata.type'])){var _0x55c537=_0x401dd6[_0x2c88('0x9b')][_0x2c88('0x43')](_0x401dd6[_0x2c88('0x9b')][_0x2c88('0x44')]('.')+0x1);if(_0x55c537===_0x2c88('0x9e')){_0x2116ce[_0x2c88('0x9f')](getBooleanList(_0xbc1289,_0x343311,_0xeafebd,_0x3ea3b1['MetadataId'],_0x401dd6[_0x2c88('0x95')],_0x1df0b0));}}});return Promise[_0x2c88('0x9c')](_0x2116ce);})[_0x2c88('0x11')](function(_0x41f6ab){_0x166e94=_0x41f6ab[0x0];var _0x2e55e8=[];var _0x35b531=[];_0x10c8d8[_0x2c88('0x9a')](function(_0x1ccca3){if(_0x1ccca3['@odata.type']){var _0x1689c2=_0x1ccca3[_0x2c88('0x9b')][_0x2c88('0x43')](_0x1ccca3[_0x2c88('0x9b')][_0x2c88('0x44')]('.')+0x1);if(_0x1689c2==='StringAttributeMetadata'||_0x1689c2==='DoubleAttributeMetadata'||_0x1689c2===_0x2c88('0xa0')||_0x1689c2===_0x2c88('0xa1')||_0x1689c2===_0x2c88('0xa2')||_0x1689c2===_0x2c88('0xa3')||_0x1689c2===_0x2c88('0xa4')||_0x1689c2===_0x2c88('0xa5')||_0x1689c2===_0x2c88('0xa6')||_0x1689c2==='DecimalAttributeMetadata'){_0x2e55e8[_0x2c88('0x9f')](getInputList(_0xbc1289,_0x343311,_0x1689c2,_0x35b531,_0x3ea3b1[_0x2c88('0x95')],_0x1ccca3['MetadataId'],_0x1df0b0));}}});return Promise['all'](_0x2e55e8);})['then'](function(_0x15f01c){_0x5dce1a=_0x15f01c[0x0];var _0x25097a=_0x375de0['concat'](_0x166e94)[_0x2c88('0x85')](_0x5dce1a);var _0x507d6a={'count':_0x25097a['length'],'rows':_0x25097a};return _0x507d6a;})[_0x2c88('0x11')](respondWithResult(_0x48d1d8,null))[_0x2c88('0x34')](function(_0x6684e1){var _0x15dab7=_0x2638f3[_0x2c88('0x1c')]['test']?0x1f4:_0x6684e1[_0x2c88('0xa7')]||0x1f4;logger[_0x2c88('0xa8')](_0x6684e1['stack']);delete _0x6684e1[_0x2c88('0x14')];if(_0x15dab7===0x191){_0x15dab7=0x190;}_0x48d1d8[_0x2c88('0x8')](_0x15dab7)[_0x2c88('0x15')](_0x2638f3[_0x2c88('0x1c')]['test']?{'message':_0x2c88('0xa9'),'statusCode':_0x6684e1[_0x2c88('0xa7')]}:_0x6684e1);});};function getSelectList(_0x34fdc3,_0x2dc4a6,_0x4b4dba,_0x25a882,_0x4be5c5,_0x713797){var _0x236b17={'method':_0x2c88('0x91'),'uri':_0x34fdc3+_0x2c88('0x96')+_0x25a882+_0x2c88('0xaa')+_0x4be5c5+_0x2c88('0xab')+_0x2c88('0xac'),'headers':{'Authorization':_0x2c88('0x92')+_0x713797,'If-None-Match':null,'OData-Version':_0x2c88('0x93')},'json':!![]};return rp(_0x236b17)[_0x2c88('0x11')](function(_0x32bdcd){var _0x1fb40b=[];var _0x53beae=_0x32bdcd[_0x2c88('0xad')][_0x2c88('0xae')];_0x53beae[_0x2c88('0x9a')](function(_0x3e02ee){_0x1fb40b[_0x2c88('0x9f')]({'name':_0x3e02ee[_0x2c88('0xaf')][_0x2c88('0xb0')][_0x2c88('0xaf')],'value':String(_0x3e02ee[_0x2c88('0xb1')])});});var _0x3ac423={'id':_0x2dc4a6+'_'+_0x32bdcd[_0x2c88('0x99')],'name':_0x32bdcd[_0x2c88('0xb2')][_0x2c88('0xb0')][_0x2c88('0xaf')],'custom':![],'options':_0x1fb40b};_0x4b4dba[_0x2c88('0x9f')](_0x3ac423);return _0x4b4dba;});}function getBooleanList(_0x17305e,_0x4eea47,_0x59456d,_0x5bcd65,_0x3a9ca7,_0x338180){var _0x35ef52={'method':_0x2c88('0x91'),'uri':_0x17305e+_0x2c88('0x96')+_0x5bcd65+_0x2c88('0xaa')+_0x3a9ca7+_0x2c88('0xb3'),'headers':{'Authorization':_0x2c88('0x92')+_0x338180,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x35ef52)[_0x2c88('0x11')](function(_0x11122b){var _0x4389cf=[];_0x4389cf[_0x2c88('0x9f')]({'name':_0x11122b['OptionSet']['TrueOption'][_0x2c88('0xaf')]['UserLocalizedLabel'][_0x2c88('0xaf')],'value':'true'},{'name':_0x11122b[_0x2c88('0xad')]['FalseOption']['Label'][_0x2c88('0xb0')][_0x2c88('0xaf')],'value':_0x2c88('0xb4')});var _0x4649a6={'id':_0x4eea47+'_'+_0x11122b[_0x2c88('0x99')],'name':_0x11122b[_0x2c88('0xb2')][_0x2c88('0xb0')][_0x2c88('0xaf')],'custom':![],'options':_0x4389cf};_0x59456d[_0x2c88('0x9f')](_0x4649a6);return _0x59456d;});}function getInputList(_0x14169e,_0x54a87c,_0x14bc7b,_0x3dd5ea,_0x3a35b7,_0x5885ac,_0x45fc52){var _0x277397={'method':_0x2c88('0x91'),'uri':_0x14169e+'EntityDefinitions('+_0x3a35b7+')/Attributes('+_0x5885ac+')/Microsoft.Dynamics.CRM.'+_0x14bc7b+_0x2c88('0xb5'),'headers':{'Authorization':_0x2c88('0x92')+_0x45fc52,'If-None-Match':null,'OData-Version':_0x2c88('0x93')},'json':!![]};return rp(_0x277397)[_0x2c88('0x11')](function(_0x11dabb){var _0x58167b={'id':_0x54a87c+'_'+_0x11dabb['LogicalName'],'name':_0x11dabb['DisplayName'][_0x2c88('0xb0')]?_0x11dabb[_0x2c88('0xb2')][_0x2c88('0xb0')][_0x2c88('0xaf')]:_0x11dabb[_0x2c88('0x99')],'custom':![],'options':[]};_0x3dd5ea['push'](_0x58167b);return _0x3dd5ea;});} \ No newline at end of file +var _0x2bc1=['contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','influencescore','kbarticleidname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','data5','data7','access_token','CloudProvider','POST','tenantId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','forEach','@odata.type','push','MetadataId','all','isNil','lastIndexOf','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','stack','test','Wrong\x20credentials','GET',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','sendStatus','name','send','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','catch','params','include','find','create','body','findOne','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits'];(function(_0x5d8542,_0x31a3b8){var _0x500853=function(_0x3329e0){while(--_0x3329e0){_0x5d8542['push'](_0x5d8542['shift']());}};_0x500853(++_0x31a3b8);}(_0x2bc1,0x11e));var _0x12bc=function(_0x118c0d,_0x3d8aa7){_0x118c0d=_0x118c0d-0x0;var _0x5c723e=_0x2bc1[_0x118c0d];return _0x5c723e;};'use strict';var rp=require('request-promise');var util=require(_0x12bc('0x0'));var _=require(_0x12bc('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x12bc('0x2'))('api');var db=require(_0x12bc('0x3'))['db'];var integrations=require(_0x12bc('0x4'));function respondWithResult(_0x30c854,_0x14a764){_0x14a764=_0x14a764||0xc8;return function(_0x4fcc0d){if(_0x4fcc0d){return _0x30c854['status'](_0x14a764)[_0x12bc('0x5')](_0x4fcc0d);}};}function respondWithFilteredResult(_0x28b14e,_0x31f56e){return function(_0x2b5b68){if(_0x2b5b68){var _0xd60229=typeof _0x31f56e[_0x12bc('0x6')]===_0x12bc('0x7')&&typeof _0x31f56e[_0x12bc('0x8')]===_0x12bc('0x7');var _0x327643=_0x2b5b68[_0x12bc('0x9')];var _0x5a3828=_0xd60229?0x0:_0x31f56e[_0x12bc('0x6')];var _0x38ee4a=_0xd60229?_0x2b5b68[_0x12bc('0x9')]:_0x31f56e[_0x12bc('0x6')]+_0x31f56e[_0x12bc('0x8')];var _0x479a99;if(_0x38ee4a>=_0x327643){_0x38ee4a=_0x327643;_0x479a99=0xc8;}else{_0x479a99=0xce;}_0x28b14e['status'](_0x479a99);return _0x28b14e[_0x12bc('0xa')](_0x12bc('0xb'),_0x5a3828+'-'+_0x38ee4a+'/'+_0x327643)[_0x12bc('0x5')](_0x2b5b68);}return null;};}function saveUpdates(_0x3da572){return function(_0x5a7c4d){if(_0x5a7c4d){return _0x5a7c4d[_0x12bc('0xc')](_0x3da572)[_0x12bc('0xd')](function(_0x5d09ed){return _0x5d09ed;});}return null;};}function removeEntity(_0x4003dc){return function(_0x4ba81b){if(_0x4ba81b){return _0x4ba81b[_0x12bc('0xe')]()['then'](function(){_0x4003dc[_0x12bc('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30e10d){return function(_0x3ebe68){if(!_0x3ebe68){_0x30e10d[_0x12bc('0x10')](0x194);}return _0x3ebe68;};}function handleError(_0x5ab9e7,_0x417a61){_0x417a61=_0x417a61||0x1f4;return function(_0x58ab55){logger['error'](_0x58ab55['stack']);if(_0x58ab55[_0x12bc('0x11')]){delete _0x58ab55[_0x12bc('0x11')];}_0x5ab9e7['status'](_0x417a61)[_0x12bc('0x12')](_0x58ab55);};}exports['index']=function(_0x4cee78,_0xea63e6){var _0x4cb3f0={},_0x43454f={},_0x29f940={'count':0x0,'rows':[]};var _0xa20c5e=_[_0x12bc('0x13')](db[_0x12bc('0x14')][_0x12bc('0x15')],function(_0x3086bf){return{'name':_0x3086bf[_0x12bc('0x16')],'type':_0x3086bf['type'][_0x12bc('0x17')]};});_0x43454f[_0x12bc('0x18')]=_['map'](_0xa20c5e,_0x12bc('0x11'));_0x43454f[_0x12bc('0x19')]=_[_0x12bc('0x1a')](_0x4cee78[_0x12bc('0x19')]);_0x43454f[_0x12bc('0x1b')]=_[_0x12bc('0x1c')](_0x43454f[_0x12bc('0x18')],_0x43454f[_0x12bc('0x19')]);_0x4cb3f0[_0x12bc('0x1d')]=_[_0x12bc('0x1c')](_0x43454f['model'],qs[_0x12bc('0x1e')](_0x4cee78['query'][_0x12bc('0x1e')]));_0x4cb3f0[_0x12bc('0x1d')]=_0x4cb3f0[_0x12bc('0x1d')][_0x12bc('0x1f')]?_0x4cb3f0['attributes']:_0x43454f['model'];if(!_0x4cee78[_0x12bc('0x19')]['hasOwnProperty'](_0x12bc('0x20'))){_0x4cb3f0[_0x12bc('0x8')]=qs[_0x12bc('0x8')](_0x4cee78['query'][_0x12bc('0x8')]);_0x4cb3f0[_0x12bc('0x6')]=qs[_0x12bc('0x6')](_0x4cee78[_0x12bc('0x19')]['offset']);}_0x4cb3f0[_0x12bc('0x21')]=qs[_0x12bc('0x22')](_0x4cee78[_0x12bc('0x19')][_0x12bc('0x22')]);_0x4cb3f0['where']=qs['filters'](_[_0x12bc('0x23')](_0x4cee78[_0x12bc('0x19')],_0x43454f['filters']),_0xa20c5e);if(_0x4cee78[_0x12bc('0x19')][_0x12bc('0x24')]){_0x4cb3f0[_0x12bc('0x25')]=_[_0x12bc('0x26')](_0x4cb3f0[_0x12bc('0x25')],{'$or':_[_0x12bc('0x13')](_0xa20c5e,function(_0x3d5e84){if(_0x3d5e84[_0x12bc('0x27')]!==_0x12bc('0x28')){var _0x38a5ad={};_0x38a5ad[_0x3d5e84[_0x12bc('0x11')]]={'$like':'%'+_0x4cee78[_0x12bc('0x19')][_0x12bc('0x24')]+'%'};return _0x38a5ad;}})});}_0x4cb3f0=_[_0x12bc('0x26')]({},_0x4cb3f0,_0x4cee78[_0x12bc('0x29')]);var _0x353db7={'where':_0x4cb3f0[_0x12bc('0x25')]};return db[_0x12bc('0x14')][_0x12bc('0x9')](_0x353db7)[_0x12bc('0xd')](function(_0x4f85cb){_0x29f940[_0x12bc('0x9')]=_0x4f85cb;if(_0x4cee78[_0x12bc('0x19')][_0x12bc('0x2a')]){_0x4cb3f0['include']=[{'all':!![]}];}return db[_0x12bc('0x14')]['findAll'](_0x4cb3f0);})[_0x12bc('0xd')](function(_0x3fe4d2){_0x29f940['rows']=_0x3fe4d2;return _0x29f940;})[_0x12bc('0xd')](respondWithFilteredResult(_0xea63e6,_0x4cb3f0))[_0x12bc('0x2b')](handleError(_0xea63e6,null));};exports['show']=function(_0x2bb88d,_0x4e4d10){var _0xe3b1ba={'raw':![],'where':{'id':_0x2bb88d[_0x12bc('0x2c')]['id']}},_0x5c3c8a={};_0x5c3c8a[_0x12bc('0x18')]=_[_0x12bc('0x1a')](db[_0x12bc('0x14')][_0x12bc('0x15')]);_0x5c3c8a['query']=_[_0x12bc('0x1a')](_0x2bb88d[_0x12bc('0x19')]);_0x5c3c8a[_0x12bc('0x1b')]=_[_0x12bc('0x1c')](_0x5c3c8a['model'],_0x5c3c8a['query']);_0xe3b1ba[_0x12bc('0x1d')]=_[_0x12bc('0x1c')](_0x5c3c8a['model'],qs[_0x12bc('0x1e')](_0x2bb88d['query'][_0x12bc('0x1e')]));_0xe3b1ba['attributes']=_0xe3b1ba[_0x12bc('0x1d')]['length']?_0xe3b1ba[_0x12bc('0x1d')]:_0x5c3c8a[_0x12bc('0x18')];if(_0x2bb88d[_0x12bc('0x19')]['includeAll']){_0xe3b1ba[_0x12bc('0x2d')]=[{'all':!![]}];}_0xe3b1ba=_[_0x12bc('0x26')]({},_0xe3b1ba,_0x2bb88d[_0x12bc('0x29')]);return db[_0x12bc('0x14')][_0x12bc('0x2e')](_0xe3b1ba)['then'](handleEntityNotFound(_0x4e4d10,null))[_0x12bc('0xd')](respondWithResult(_0x4e4d10,null))[_0x12bc('0x2b')](handleError(_0x4e4d10,null));};exports['create']=function(_0x18d85c,_0x17c56b){return db[_0x12bc('0x14')][_0x12bc('0x2f')](_0x18d85c[_0x12bc('0x30')],{})[_0x12bc('0xd')](respondWithResult(_0x17c56b,0xc9))[_0x12bc('0x2b')](handleError(_0x17c56b,null));};exports[_0x12bc('0xc')]=function(_0x4b4c8,_0x1d7133){if(_0x4b4c8[_0x12bc('0x30')]['id']){delete _0x4b4c8[_0x12bc('0x30')]['id'];}return db[_0x12bc('0x14')]['find']({'where':{'id':_0x4b4c8[_0x12bc('0x2c')]['id']}})[_0x12bc('0xd')](handleEntityNotFound(_0x1d7133,null))[_0x12bc('0xd')](saveUpdates(_0x4b4c8['body'],null))['then'](respondWithResult(_0x1d7133,null))[_0x12bc('0x2b')](handleError(_0x1d7133,null));};exports[_0x12bc('0xe')]=function(_0x162309,_0xc2a1c8){return db[_0x12bc('0x14')]['find']({'where':{'id':_0x162309[_0x12bc('0x2c')]['id']}})[_0x12bc('0xd')](handleEntityNotFound(_0xc2a1c8,null))['then'](removeEntity(_0xc2a1c8,null))[_0x12bc('0x2b')](handleError(_0xc2a1c8,null));};exports['getConfigurations']=function(_0x431e0d,_0x4c2718){var _0x509bd3={};var _0x2aa71c={};var _0x23fce3;var _0x12e67a;return db['Dynamics365Account'][_0x12bc('0x31')]({'where':{'id':_0x431e0d['params']['id']}})[_0x12bc('0xd')](handleEntityNotFound(_0x4c2718,null))[_0x12bc('0xd')](function(_0x6ba7f3){if(_0x6ba7f3){_0x23fce3=_0x6ba7f3;_0x2aa71c[_0x12bc('0x18')]=_['keys'](db['Dynamics365Configuration'][_0x12bc('0x15')]);_0x2aa71c[_0x12bc('0x19')]=_['keys'](_0x431e0d[_0x12bc('0x19')]);_0x2aa71c[_0x12bc('0x1b')]=_[_0x12bc('0x1c')](_0x2aa71c['model'],_0x2aa71c['query']);_0x509bd3[_0x12bc('0x1d')]=_[_0x12bc('0x1c')](_0x2aa71c[_0x12bc('0x18')],qs[_0x12bc('0x1e')](_0x431e0d[_0x12bc('0x19')]['fields']));_0x509bd3[_0x12bc('0x1d')]=_0x509bd3[_0x12bc('0x1d')][_0x12bc('0x1f')]?_0x509bd3[_0x12bc('0x1d')]:_0x2aa71c[_0x12bc('0x18')];_0x509bd3['order']=qs['sort'](_0x431e0d[_0x12bc('0x19')]['sort']);_0x509bd3[_0x12bc('0x25')]=qs[_0x12bc('0x1b')](_['pick'](_0x431e0d[_0x12bc('0x19')],_0x2aa71c[_0x12bc('0x1b')]));if(_0x431e0d[_0x12bc('0x19')][_0x12bc('0x24')]){_0x509bd3['where']=_[_0x12bc('0x26')](_0x509bd3[_0x12bc('0x25')],{'$or':_[_0x12bc('0x13')](_0x509bd3[_0x12bc('0x1d')],function(_0x4d3c3d){var _0x1945e4={};_0x1945e4[_0x4d3c3d]={'$like':'%'+_0x431e0d[_0x12bc('0x19')]['filter']+'%'};return _0x1945e4;})});}_0x509bd3=_[_0x12bc('0x26')]({},_0x509bd3,_0x431e0d[_0x12bc('0x29')]);return _0x23fce3[_0x12bc('0x32')](_0x509bd3);}})[_0x12bc('0xd')](function(_0x5d5c23){if(_0x5d5c23){_0x12e67a=_0x5d5c23[_0x12bc('0x1f')];if(!_0x431e0d[_0x12bc('0x19')][_0x12bc('0x33')]('nolimit')){_0x509bd3[_0x12bc('0x8')]=qs[_0x12bc('0x8')](_0x431e0d[_0x12bc('0x19')][_0x12bc('0x8')]);_0x509bd3[_0x12bc('0x6')]=qs[_0x12bc('0x6')](_0x431e0d[_0x12bc('0x19')][_0x12bc('0x6')]);}return _0x23fce3[_0x12bc('0x32')](_0x509bd3);}})[_0x12bc('0xd')](function(_0x41ed75){if(_0x41ed75){return _0x41ed75?{'count':_0x12e67a,'rows':_0x41ed75}:null;}})['then'](respondWithResult(_0x4c2718,null))[_0x12bc('0x2b')](handleError(_0x4c2718,null));};exports['addConfiguration']=function(_0x55c6f0,_0x422cf8){if(_0x55c6f0[_0x12bc('0x30')]['id']){delete _0x55c6f0[_0x12bc('0x30')]['id'];}return db[_0x12bc('0x14')][_0x12bc('0x31')]({'where':{'id':_0x55c6f0[_0x12bc('0x2c')]['id']}})['then'](handleEntityNotFound(_0x422cf8,null))[_0x12bc('0xd')](function(_0x354cea){if(_0x354cea){_0x55c6f0['body'][_0x12bc('0x34')]=_0x354cea['id'];_0x55c6f0['body'][_0x12bc('0x35')]=integrations[_0x12bc('0x36')](_0x55c6f0[_0x12bc('0x30')][_0x12bc('0x37')],_0x55c6f0['body'][_0x12bc('0x27')]);_0x55c6f0[_0x12bc('0x30')][_0x12bc('0x38')]=integrations[_0x12bc('0x39')](_0x55c6f0[_0x12bc('0x30')][_0x12bc('0x37')],_0x55c6f0[_0x12bc('0x30')]['type']);return db[_0x12bc('0x3a')][_0x12bc('0x2f')](_0x55c6f0['body'],{'include':[{'model':db[_0x12bc('0x3b')],'as':_0x12bc('0x35')},{'model':db[_0x12bc('0x3b')],'as':_0x12bc('0x38')}]});}return null;})[_0x12bc('0xd')](respondWithResult(_0x422cf8,null))[_0x12bc('0x2b')](handleError(_0x422cf8,null));};function sanitizeRemoteUri(_0x4916b4){var _0x24d36e=_0x4916b4[_0x12bc('0x3c')](-0x1);if(_0x24d36e==='/')return _0x4916b4[_0x12bc('0x3d')](0x0,_0x4916b4['lastIndexOf'](_0x24d36e));return _0x4916b4;}function getWebApiUrl(_0x528f48){return util[_0x12bc('0x3e')](_0x12bc('0x3f'),_0x528f48);}exports[_0x12bc('0x40')]=function(_0x2107d6,_0x49ab7a){var _0x1e1001=_0x2107d6['query']['ticketType'];var _0x552b3d=_0x1e1001===_0x12bc('0x41')?_0x12bc('0x42'):_0x12bc('0x43');var _0x50d90d='';var _0x42a2c2='';var _0x1ff35e='';var _0x26b32a='';var _0x1d40c1='';var _0x3a6be1='';var _0x358cad='';var _0x5ae7c1='';var _0x5bab9d=[_0x12bc('0x44'),'description','customerid','ownerid','caseorigincode',_0x12bc('0x45'),_0x12bc('0x46'),_0x12bc('0x47'),'directioncode',_0x12bc('0x48')];var _0xd002ed=[_0x12bc('0x49'),_0x12bc('0x4a'),'actualserviceunits',_0x12bc('0x4b'),_0x12bc('0x4c'),_0x12bc('0x4d'),_0x12bc('0x4e'),_0x12bc('0x4f'),_0x12bc('0x50'),_0x12bc('0x51'),_0x12bc('0x52'),'createdbyyominame',_0x12bc('0x53'),_0x12bc('0x54'),_0x12bc('0x55'),_0x12bc('0x56'),_0x12bc('0x57'),'customeridyominame','emailaddress','entitlementidname',_0x12bc('0x58'),_0x12bc('0x59'),_0x12bc('0x5a'),'exchangerate',_0x12bc('0x5b'),'followupby','importsequencenumber',_0x12bc('0x5c'),_0x12bc('0x5d'),'lastonholdtime','masteridname','modifiedbyexternalpartyname',_0x12bc('0x5e'),_0x12bc('0x5f'),_0x12bc('0x60'),'modifiedon',_0x12bc('0x61'),_0x12bc('0x62'),_0x12bc('0x63'),'msdyn_iotalertname',_0x12bc('0x64'),'onholdtime',_0x12bc('0x65'),_0x12bc('0x66'),'owneridtype',_0x12bc('0x67'),_0x12bc('0x68'),_0x12bc('0x69'),_0x12bc('0x6a'),_0x12bc('0x6b'),_0x12bc('0x6c'),_0x12bc('0x6d'),_0x12bc('0x6e'),_0x12bc('0x6f'),_0x12bc('0x70'),_0x12bc('0x71'),'responsiblecontactidyominame',_0x12bc('0x72'),_0x12bc('0x73'),_0x12bc('0x74'),_0x12bc('0x75'),'statecode','statuscode',_0x12bc('0x76'),_0x12bc('0x77'),_0x12bc('0x78'),_0x12bc('0x79'),_0x12bc('0x7a'),_0x12bc('0x7b'),'versionnumber'];var _0x5d7a20=_0x5bab9d[_0x12bc('0x7c')](_0xd002ed);return db['Dynamics365Account'][_0x12bc('0x31')]({'where':{'id':_0x2107d6[_0x12bc('0x2c')]['id']},'attributes':['id',_0x12bc('0x7d'),_0x12bc('0x7e'),_0x12bc('0x7f'),'tenantId',_0x12bc('0x80'),_0x12bc('0x81'),_0x12bc('0x82')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x12bc('0x83'),_0x12bc('0x84')]}]})['then'](handleEntityNotFound(_0x49ab7a,null))[_0x12bc('0xd')](function(_0x1e1cf7){if(_0x1e1cf7){if(_0x1e1cf7[_0x12bc('0x82')]){_0x1e1cf7[_0x12bc('0x85')]=_0x1e1cf7[_0x12bc('0x86')][_0x12bc('0x83')];_0x5ae7c1=sanitizeRemoteUri(_0x1e1cf7[_0x12bc('0x86')][_0x12bc('0x84')]);_0x358cad=getWebApiUrl(_0x5ae7c1);return _0x1e1cf7;}_0x5ae7c1=sanitizeRemoteUri(_0x1e1cf7[_0x12bc('0x7f')]);_0x358cad=getWebApiUrl(_0x5ae7c1);var _0x3b65d6={'method':_0x12bc('0x87'),'uri':'https://login.microsoftonline.com/'+_0x1e1cf7[_0x12bc('0x88')]+'/oauth2/token','form':{'client_id':_0x1e1cf7[_0x12bc('0x80')],'resource':_0x5ae7c1,'username':_0x1e1cf7[_0x12bc('0x7d')],'password':_0x1e1cf7[_0x12bc('0x7e')],'grant_type':_0x12bc('0x7e'),'client_secret':_0x1e1cf7['clientSecret']},'json':!![]};return rp(_0x3b65d6);}})[_0x12bc('0xd')](function(_0x5d73c9){_0x3a6be1=_0x5d73c9[_0x12bc('0x85')];var _0x1c2cb8={'method':'GET','uri':encodeURI(_0x358cad+_0x12bc('0x89')+_0x552b3d+'\x27'),'headers':{'Authorization':_0x12bc('0x8a')+_0x3a6be1,'If-None-Match':null,'OData-Version':_0x12bc('0x8b')},'json':!![]};return rp(_0x1c2cb8);})[_0x12bc('0xd')](function(_0x48cae4){var _0x1a3bb0=_0x48cae4[_0x12bc('0x8c')][0x0];var _0xabd9a3=_0x1a3bb0['MetadataId'];var _0x35328a={'method':'GET','uri':_0x358cad+_0x12bc('0x8d')+_0xabd9a3+_0x12bc('0x8e'),'headers':{'Authorization':_0x12bc('0x8a')+_0x3a6be1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x35328a);})[_0x12bc('0xd')](function(_0x2e58c0){_0x50d90d=_0x2e58c0;_0x42a2c2=_0x50d90d[_0x12bc('0x8f')];_0x42a2c2=_['remove'](_0x42a2c2,function(_0x490c60){return!_0x5d7a20[_0x12bc('0x90')](_0x490c60['LogicalName']);});var _0x3313f1=[];var _0x5ac721=[];_0x42a2c2[_0x12bc('0x91')](function(_0x26ad23){if(_0x26ad23[_0x12bc('0x92')]){var _0x5e2855=_0x26ad23['@odata.type'][_0x12bc('0x3d')](_0x26ad23[_0x12bc('0x92')]['lastIndexOf']('.')+0x1);if(_0x5e2855==='PicklistAttributeMetadata'){_0x3313f1[_0x12bc('0x93')](getSelectList(_0x358cad,_0x1e1001,_0x5ac721,_0x50d90d[_0x12bc('0x94')],_0x26ad23[_0x12bc('0x94')],_0x3a6be1));}}});return Promise[_0x12bc('0x95')](_0x3313f1);})[_0x12bc('0xd')](function(_0x2d14ab){_0x1ff35e=_0x2d14ab[0x0];var _0x2076c0=[];var _0x4c931b=[];_0x42a2c2['forEach'](function(_0x4209c6){if(!_[_0x12bc('0x96')](_0x4209c6['@odata.type'])){var _0xac794d=_0x4209c6[_0x12bc('0x92')]['substring'](_0x4209c6[_0x12bc('0x92')][_0x12bc('0x97')]('.')+0x1);if(_0xac794d===_0x12bc('0x98')){_0x2076c0[_0x12bc('0x93')](getBooleanList(_0x358cad,_0x1e1001,_0x4c931b,_0x50d90d[_0x12bc('0x94')],_0x4209c6[_0x12bc('0x94')],_0x3a6be1));}}});return Promise['all'](_0x2076c0);})[_0x12bc('0xd')](function(_0x510ddb){_0x26b32a=_0x510ddb[0x0];var _0x5043d3=[];var _0x5a9e49=[];_0x42a2c2[_0x12bc('0x91')](function(_0x552dd2){if(_0x552dd2['@odata.type']){var _0x1adca1=_0x552dd2['@odata.type']['substring'](_0x552dd2[_0x12bc('0x92')][_0x12bc('0x97')]('.')+0x1);if(_0x1adca1===_0x12bc('0x99')||_0x1adca1==='DoubleAttributeMetadata'||_0x1adca1===_0x12bc('0x9a')||_0x1adca1===_0x12bc('0x9b')||_0x1adca1===_0x12bc('0x9c')||_0x1adca1===_0x12bc('0x9d')||_0x1adca1===_0x12bc('0x9e')||_0x1adca1===_0x12bc('0x9f')||_0x1adca1===_0x12bc('0xa0')||_0x1adca1===_0x12bc('0xa1')){_0x5043d3['push'](getInputList(_0x358cad,_0x1e1001,_0x1adca1,_0x5a9e49,_0x50d90d[_0x12bc('0x94')],_0x552dd2[_0x12bc('0x94')],_0x3a6be1));}}});return Promise[_0x12bc('0x95')](_0x5043d3);})[_0x12bc('0xd')](function(_0x36af9a){_0x1d40c1=_0x36af9a[0x0];var _0x325124=_0x1ff35e['concat'](_0x26b32a)[_0x12bc('0x7c')](_0x1d40c1);var _0x599712={'count':_0x325124['length'],'rows':_0x325124};return _0x599712;})[_0x12bc('0xd')](respondWithResult(_0x49ab7a,null))[_0x12bc('0x2b')](function(_0x599e07){var _0x55a29a=_0x2107d6[_0x12bc('0x19')]['test']?0x1f4:_0x599e07[_0x12bc('0xa2')]||0x1f4;logger[_0x12bc('0xa3')](_0x599e07[_0x12bc('0xa4')]);delete _0x599e07['name'];if(_0x55a29a===0x191){_0x55a29a=0x190;}_0x49ab7a[_0x12bc('0xf')](_0x55a29a)['send'](_0x2107d6[_0x12bc('0x19')][_0x12bc('0xa5')]?{'message':_0x12bc('0xa6'),'statusCode':_0x599e07[_0x12bc('0xa2')]}:_0x599e07);});};function getSelectList(_0x520091,_0x1bc47f,_0x483c6e,_0x342d1e,_0x3e89ac,_0x3074d5){var _0x4d04d5={'method':_0x12bc('0xa7'),'uri':_0x520091+'EntityDefinitions('+_0x342d1e+_0x12bc('0xa8')+_0x3e89ac+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x12bc('0xa9'),'headers':{'Authorization':_0x12bc('0x8a')+_0x3074d5,'If-None-Match':null,'OData-Version':_0x12bc('0x8b')},'json':!![]};return rp(_0x4d04d5)[_0x12bc('0xd')](function(_0x35f394){var _0x375545=[];var _0xde26d8=_0x35f394[_0x12bc('0xaa')][_0x12bc('0xab')];_0xde26d8[_0x12bc('0x91')](function(_0x390a52){_0x375545[_0x12bc('0x93')]({'name':_0x390a52['Label'][_0x12bc('0xac')][_0x12bc('0xad')],'value':String(_0x390a52['Value'])});});var _0x4d9cd3={'id':_0x1bc47f+'_'+_0x35f394[_0x12bc('0xae')],'name':_0x35f394[_0x12bc('0xaf')][_0x12bc('0xac')][_0x12bc('0xad')],'custom':![],'options':_0x375545};_0x483c6e[_0x12bc('0x93')](_0x4d9cd3);return _0x483c6e;});}function getBooleanList(_0x24c832,_0x4847df,_0x569933,_0x3a7d20,_0x31a0fc,_0x4a58f9){var _0x811911={'method':_0x12bc('0xa7'),'uri':_0x24c832+_0x12bc('0x8d')+_0x3a7d20+_0x12bc('0xa8')+_0x31a0fc+_0x12bc('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x4a58f9,'If-None-Match':null,'OData-Version':_0x12bc('0x8b')},'json':!![]};return rp(_0x811911)['then'](function(_0x40b947){var _0x209ac8=[];_0x209ac8[_0x12bc('0x93')]({'name':_0x40b947[_0x12bc('0xaa')][_0x12bc('0xb1')][_0x12bc('0xad')][_0x12bc('0xac')][_0x12bc('0xad')],'value':'true'},{'name':_0x40b947[_0x12bc('0xaa')][_0x12bc('0xb2')][_0x12bc('0xad')][_0x12bc('0xac')][_0x12bc('0xad')],'value':'false'});var _0x45356f={'id':_0x4847df+'_'+_0x40b947[_0x12bc('0xae')],'name':_0x40b947[_0x12bc('0xaf')]['UserLocalizedLabel'][_0x12bc('0xad')],'custom':![],'options':_0x209ac8};_0x569933[_0x12bc('0x93')](_0x45356f);return _0x569933;});}function getInputList(_0x3c32f5,_0x14471d,_0x42acde,_0x56a685,_0x1781a6,_0x5b33fc,_0x308cc6){var _0x4cbf3a={'method':'GET','uri':_0x3c32f5+_0x12bc('0x8d')+_0x1781a6+_0x12bc('0xa8')+_0x5b33fc+_0x12bc('0xb3')+_0x42acde+_0x12bc('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x308cc6,'If-None-Match':null,'OData-Version':_0x12bc('0x8b')},'json':!![]};return rp(_0x4cbf3a)[_0x12bc('0xd')](function(_0x3e58a6){var _0x38678e={'id':_0x14471d+'_'+_0x3e58a6[_0x12bc('0xae')],'name':_0x3e58a6[_0x12bc('0xaf')][_0x12bc('0xac')]?_0x3e58a6[_0x12bc('0xaf')][_0x12bc('0xac')]['Label']:_0x3e58a6[_0x12bc('0xae')],'custom':![],'options':[]};_0x56a685['push'](_0x38678e);return _0x56a685;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 874ee3a..cab4440 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x3805eb,_0x380033){var _0x565582=function(_0x106a85){while(--_0x106a85){_0x3805eb['push'](_0x3805eb['shift']());}};_0x565582(++_0x380033);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb7e7[_0x1beef3];return _0x5af964;};'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 +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x3106bf,_0x30e6ca){var _0x4071a4=function(_0x51aecd){while(--_0x51aecd){_0x3106bf['push'](_0x3106bf['shift']());}};_0x4071a4(++_0x30e6ca);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xcb91[_0x1064bc];return _0x5edc45;};'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'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 2c1bb01..69384db 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 _0xa346=['../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','GetDynamics365Account','find','ShowDynamics365Account','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x21ceee,_0x44fb20){var _0x33add3=function(_0x2c7dfb){while(--_0x2c7dfb){_0x21ceee['push'](_0x21ceee['shift']());}};_0x33add3(++_0x44fb20);}(_0xa346,0xe1));var _0x6a34=function(_0x9a98d9,_0x2dd2c7){_0x9a98d9=_0x9a98d9-0x0;var _0x5da06b=_0xa346[_0x9a98d9];return _0x5da06b;};'use strict';var _=require(_0x6a34('0x0'));var util=require(_0x6a34('0x1'));var moment=require(_0x6a34('0x2'));var BPromise=require(_0x6a34('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a34('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a34('0x5'))('rpc');var config=require(_0x6a34('0x6'));var jayson=require(_0x6a34('0x7'));var client=jayson['client'][_0x6a34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbbcfd0,_0x383151,_0x2a7adc){return new BPromise(function(_0x501093,_0x5903ed){return client['request'](_0xbbcfd0,_0x2a7adc)[_0x6a34('0x9')](function(_0x5a2b3c){logger[_0x6a34('0xa')](_0x6a34('0xb'),_0x383151,_0x6a34('0xc'));logger[_0x6a34('0xd')](_0x6a34('0xe'),_0x383151,_0x6a34('0xc'),JSON[_0x6a34('0xf')](_0x5a2b3c));if(_0x5a2b3c[_0x6a34('0x10')]){if(_0x5a2b3c[_0x6a34('0x10')][_0x6a34('0x11')]===0x1f4){logger[_0x6a34('0x10')](_0x6a34('0xb'),_0x383151,_0x5a2b3c[_0x6a34('0x10')][_0x6a34('0x12')]);return _0x5903ed(_0x5a2b3c[_0x6a34('0x10')][_0x6a34('0x12')]);}logger['error'](_0x6a34('0xb'),_0x383151,_0x5a2b3c['error']['message']);return _0x501093(_0x5a2b3c[_0x6a34('0x10')]['message']);}else{logger['info'](_0x6a34('0xb'),_0x383151,_0x6a34('0xc'));_0x501093(_0x5a2b3c['result'][_0x6a34('0x12')]);}})[_0x6a34('0x13')](function(_0x516ccb){logger[_0x6a34('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x383151,_0x516ccb);_0x5903ed(_0x516ccb);});});}exports['GetDynamics365Account']=function(_0x177ca3){var _0x3cc514=this;return new Promise(function(_0x3fc16b,_0x3336e6){return db[_0x6a34('0x14')][_0x6a34('0x15')]({'raw':_0x177ca3[_0x6a34('0x16')]?_0x177ca3[_0x6a34('0x16')][_0x6a34('0x17')]===undefined?!![]:![]:!![],'where':_0x177ca3['options']?_0x177ca3[_0x6a34('0x16')][_0x6a34('0x18')]||null:null,'attributes':_0x177ca3[_0x6a34('0x16')]?_0x177ca3['options'][_0x6a34('0x19')]||null:null,'limit':_0x177ca3[_0x6a34('0x16')]?_0x177ca3['options'][_0x6a34('0x1a')]||null:null,'include':_0x177ca3[_0x6a34('0x16')]?_0x177ca3['options'][_0x6a34('0x1b')]?_['map'](_0x177ca3[_0x6a34('0x16')][_0x6a34('0x1b')],function(_0x2305ee){return{'model':db[_0x2305ee[_0x6a34('0x1c')]],'as':_0x2305ee['as'],'attributes':_0x2305ee[_0x6a34('0x19')],'include':_0x2305ee[_0x6a34('0x1b')]?_['map'](_0x2305ee[_0x6a34('0x1b')],function(_0x47bc55){return{'model':db[_0x47bc55[_0x6a34('0x1c')]],'as':_0x47bc55['as'],'attributes':_0x47bc55[_0x6a34('0x19')],'include':_0x47bc55[_0x6a34('0x1b')]?_[_0x6a34('0x1d')](_0x47bc55[_0x6a34('0x1b')],function(_0x3ce7cf){return{'model':db[_0x3ce7cf[_0x6a34('0x1c')]],'as':_0x3ce7cf['as'],'attributes':_0x3ce7cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x6a34('0x9')](function(_0x27fa8d){logger['info'](_0x6a34('0x1e'),_0x177ca3);logger['debug'](_0x6a34('0x1e'),_0x177ca3,JSON[_0x6a34('0xf')](_0x27fa8d));_0x3fc16b(_0x27fa8d);})['catch'](function(_0x23ac0d){logger[_0x6a34('0x10')](_0x6a34('0x1e'),_0x23ac0d[_0x6a34('0x12')],_0x177ca3);_0x3336e6(_0x3cc514[_0x6a34('0x10')](0x1f4,_0x23ac0d[_0x6a34('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x57f499){var _0x5ad2aa=this;return new Promise(function(_0x46514c,_0x403497){return db[_0x6a34('0x14')][_0x6a34('0x1f')]({'raw':_0x57f499[_0x6a34('0x16')]?_0x57f499[_0x6a34('0x16')][_0x6a34('0x17')]===undefined?!![]:![]:!![],'where':_0x57f499['options']?_0x57f499[_0x6a34('0x16')][_0x6a34('0x18')]||null:null,'attributes':_0x57f499[_0x6a34('0x16')]?_0x57f499[_0x6a34('0x16')][_0x6a34('0x19')]||null:null,'include':_0x57f499[_0x6a34('0x16')]?_0x57f499[_0x6a34('0x16')][_0x6a34('0x1b')]?_[_0x6a34('0x1d')](_0x57f499['options'][_0x6a34('0x1b')],function(_0x2e277d){return{'model':db[_0x2e277d[_0x6a34('0x1c')]],'as':_0x2e277d['as'],'attributes':_0x2e277d[_0x6a34('0x19')],'include':_0x2e277d['include']?_['map'](_0x2e277d[_0x6a34('0x1b')],function(_0x3a5c78){return{'model':db[_0x3a5c78[_0x6a34('0x1c')]],'as':_0x3a5c78['as'],'attributes':_0x3a5c78[_0x6a34('0x19')],'include':_0x3a5c78['include']?_[_0x6a34('0x1d')](_0x3a5c78[_0x6a34('0x1b')],function(_0x4bf84e){return{'model':db[_0x4bf84e[_0x6a34('0x1c')]],'as':_0x4bf84e['as'],'attributes':_0x4bf84e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6a34('0x9')](function(_0x8c3778){logger[_0x6a34('0xa')](_0x6a34('0x20'),_0x57f499);logger[_0x6a34('0xd')](_0x6a34('0x20'),_0x57f499,JSON['stringify'](_0x8c3778));_0x46514c(_0x8c3778);})[_0x6a34('0x13')](function(_0x1501e5){logger[_0x6a34('0x10')](_0x6a34('0x20'),_0x1501e5[_0x6a34('0x12')],_0x57f499);_0x403497(_0x5ad2aa['error'](0x1f4,_0x1501e5[_0x6a34('0x12')]));});});}; \ No newline at end of file +var _0xdfba=['message','result','catch','GetDynamics365Account','options','raw','where','attributes','limit','include','model','map','info','Dynamics365Account','ShowDynamics365Account','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xdfba,0x16d));var _0xadfb=function(_0x39def1,_0xe38627){_0x39def1=_0x39def1-0x0;var _0x40ad14=_0xdfba[_0x39def1];return _0x40ad14;};'use strict';var _=require(_0xadfb('0x0'));var util=require('util');var moment=require(_0xadfb('0x1'));var BPromise=require(_0xadfb('0x2'));var rs=require(_0xadfb('0x3'));var fs=require('fs');var Redis=require(_0xadfb('0x4'));var db=require(_0xadfb('0x5'))['db'];var utils=require(_0xadfb('0x6'));var logger=require('../../config/logger')(_0xadfb('0x7'));var config=require(_0xadfb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xadfb('0x9')][_0xadfb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x229d91,_0x34cf79,_0x47b48){return new BPromise(function(_0x537130,_0x3e08d4){return client[_0xadfb('0xb')](_0x229d91,_0x47b48)[_0xadfb('0xc')](function(_0x150cb4){logger['info'](_0xadfb('0xd'),_0x34cf79,_0xadfb('0xe'));logger[_0xadfb('0xf')](_0xadfb('0x10'),_0x34cf79,_0xadfb('0xe'),JSON[_0xadfb('0x11')](_0x150cb4));if(_0x150cb4['error']){if(_0x150cb4[_0xadfb('0x12')][_0xadfb('0x13')]===0x1f4){logger['error'](_0xadfb('0xd'),_0x34cf79,_0x150cb4[_0xadfb('0x12')][_0xadfb('0x14')]);return _0x3e08d4(_0x150cb4[_0xadfb('0x12')][_0xadfb('0x14')]);}logger['error'](_0xadfb('0xd'),_0x34cf79,_0x150cb4['error'][_0xadfb('0x14')]);return _0x537130(_0x150cb4[_0xadfb('0x12')][_0xadfb('0x14')]);}else{logger['info'](_0xadfb('0xd'),_0x34cf79,_0xadfb('0xe'));_0x537130(_0x150cb4[_0xadfb('0x15')][_0xadfb('0x14')]);}})[_0xadfb('0x16')](function(_0x5b8614){logger[_0xadfb('0x12')](_0xadfb('0xd'),_0x34cf79,_0x5b8614);_0x3e08d4(_0x5b8614);});});}exports[_0xadfb('0x17')]=function(_0xc8eaf4){var _0x343b7f=this;return new Promise(function(_0x4a484d,_0x5df14a){return db['Dynamics365Account']['findAll']({'raw':_0xc8eaf4[_0xadfb('0x18')]?_0xc8eaf4['options'][_0xadfb('0x19')]===undefined?!![]:![]:!![],'where':_0xc8eaf4['options']?_0xc8eaf4[_0xadfb('0x18')][_0xadfb('0x1a')]||null:null,'attributes':_0xc8eaf4['options']?_0xc8eaf4[_0xadfb('0x18')][_0xadfb('0x1b')]||null:null,'limit':_0xc8eaf4['options']?_0xc8eaf4[_0xadfb('0x18')][_0xadfb('0x1c')]||null:null,'include':_0xc8eaf4['options']?_0xc8eaf4[_0xadfb('0x18')][_0xadfb('0x1d')]?_['map'](_0xc8eaf4[_0xadfb('0x18')][_0xadfb('0x1d')],function(_0x3e8996){return{'model':db[_0x3e8996[_0xadfb('0x1e')]],'as':_0x3e8996['as'],'attributes':_0x3e8996[_0xadfb('0x1b')],'include':_0x3e8996[_0xadfb('0x1d')]?_[_0xadfb('0x1f')](_0x3e8996['include'],function(_0x35334c){return{'model':db[_0x35334c[_0xadfb('0x1e')]],'as':_0x35334c['as'],'attributes':_0x35334c[_0xadfb('0x1b')],'include':_0x35334c[_0xadfb('0x1d')]?_[_0xadfb('0x1f')](_0x35334c[_0xadfb('0x1d')],function(_0x298b29){return{'model':db[_0x298b29['model']],'as':_0x298b29['as'],'attributes':_0x298b29['attributes']};}):[]};}):[]};}):[]:[]})[_0xadfb('0xc')](function(_0x18d7cc){logger[_0xadfb('0x20')](_0xadfb('0x17'),_0xc8eaf4);logger[_0xadfb('0xf')](_0xadfb('0x17'),_0xc8eaf4,JSON['stringify'](_0x18d7cc));_0x4a484d(_0x18d7cc);})[_0xadfb('0x16')](function(_0x2e8dd7){logger[_0xadfb('0x12')](_0xadfb('0x17'),_0x2e8dd7[_0xadfb('0x14')],_0xc8eaf4);_0x5df14a(_0x343b7f[_0xadfb('0x12')](0x1f4,_0x2e8dd7[_0xadfb('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x38219e){var _0x2309ee=this;return new Promise(function(_0x38a1ab,_0x5422de){return db[_0xadfb('0x21')]['find']({'raw':_0x38219e[_0xadfb('0x18')]?_0x38219e[_0xadfb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x38219e[_0xadfb('0x18')]?_0x38219e[_0xadfb('0x18')][_0xadfb('0x1a')]||null:null,'attributes':_0x38219e[_0xadfb('0x18')]?_0x38219e[_0xadfb('0x18')]['attributes']||null:null,'include':_0x38219e[_0xadfb('0x18')]?_0x38219e['options']['include']?_[_0xadfb('0x1f')](_0x38219e[_0xadfb('0x18')][_0xadfb('0x1d')],function(_0x8d2e10){return{'model':db[_0x8d2e10[_0xadfb('0x1e')]],'as':_0x8d2e10['as'],'attributes':_0x8d2e10[_0xadfb('0x1b')],'include':_0x8d2e10[_0xadfb('0x1d')]?_[_0xadfb('0x1f')](_0x8d2e10['include'],function(_0x19496e){return{'model':db[_0x19496e[_0xadfb('0x1e')]],'as':_0x19496e['as'],'attributes':_0x19496e[_0xadfb('0x1b')],'include':_0x19496e[_0xadfb('0x1d')]?_['map'](_0x19496e['include'],function(_0x20df17){return{'model':db[_0x20df17[_0xadfb('0x1e')]],'as':_0x20df17['as'],'attributes':_0x20df17[_0xadfb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xadfb('0xc')](function(_0x1837f8){logger[_0xadfb('0x20')](_0xadfb('0x22'),_0x38219e);logger['debug'](_0xadfb('0x22'),_0x38219e,JSON[_0xadfb('0x11')](_0x1837f8));_0x38a1ab(_0x1837f8);})[_0xadfb('0x16')](function(_0x2db09b){logger[_0xadfb('0x12')](_0xadfb('0x22'),_0x2db09b[_0xadfb('0x14')],_0x38219e);_0x5422de(_0x2309ee['error'](0x1f4,_0x2db09b[_0xadfb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a13b7a7..c3d3ca0 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 _0x7932=['/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5ae8c0,_0x50ccd0){var _0x48716e=function(_0x123cee){while(--_0x123cee){_0x5ae8c0['push'](_0x5ae8c0['shift']());}};_0x48716e(++_0x50ccd0);}(_0x7932,0xf0));var _0x2793=function(_0x41c826,_0x3fd04f){_0x41c826=_0x41c826-0x0;var _0x5adb33=_0x7932[_0x41c826];return _0x5adb33;};'use strict';var multer=require(_0x2793('0x0'));var util=require(_0x2793('0x1'));var path=require('path');var timeout=require(_0x2793('0x2'));var express=require(_0x2793('0x3'));var router=express[_0x2793('0x4')]();var fs_extra=require(_0x2793('0x5'));var auth=require(_0x2793('0x6'));var interaction=require(_0x2793('0x7'));var config=require(_0x2793('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0x2793('0x9')]('/',auth[_0x2793('0xa')](),controller[_0x2793('0xb')]);router[_0x2793('0x9')](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['show']);router['get'](_0x2793('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x2793('0x9')](_0x2793('0xe'),auth['isAuthenticated'](),controller[_0x2793('0xf')]);router[_0x2793('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2793('0x10')]);router[_0x2793('0x11')]('/',auth[_0x2793('0xa')](),controller[_0x2793('0x12')]);router['put'](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['update']);router[_0x2793('0x13')](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['destroy']);module[_0x2793('0x14')]=router; \ No newline at end of file +var _0x8ce8=['./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e0d13,_0xecb0cf){var _0x49ac43=function(_0x321784){while(--_0x321784){_0x2e0d13['push'](_0x2e0d13['shift']());}};_0x49ac43(++_0xecb0cf);}(_0x8ce8,0xd3));var _0x88ce=function(_0x3e0d07,_0x4645f2){_0x3e0d07=_0x3e0d07-0x0;var _0x4a6941=_0x8ce8[_0x3e0d07];return _0x4a6941;};'use strict';var multer=require(_0x88ce('0x0'));var util=require('util');var path=require(_0x88ce('0x1'));var timeout=require(_0x88ce('0x2'));var express=require(_0x88ce('0x3'));var router=express[_0x88ce('0x4')]();var fs_extra=require(_0x88ce('0x5'));var auth=require(_0x88ce('0x6'));var interaction=require(_0x88ce('0x7'));var config=require(_0x88ce('0x8'));var controller=require(_0x88ce('0x9'));router[_0x88ce('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88ce('0xa')](_0x88ce('0xb'),auth[_0x88ce('0xc')](),controller[_0x88ce('0xd')]);router[_0x88ce('0xa')]('/:id/fields',auth[_0x88ce('0xc')](),controller['getFields']);router[_0x88ce('0xa')](_0x88ce('0xe'),auth[_0x88ce('0xc')](),controller[_0x88ce('0xf')]);router[_0x88ce('0xa')](_0x88ce('0x10'),auth[_0x88ce('0xc')](),controller[_0x88ce('0x11')]);router['post']('/',auth[_0x88ce('0xc')](),controller['create']);router[_0x88ce('0x12')](_0x88ce('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x88ce('0x13')](_0x88ce('0xb'),auth[_0x88ce('0xc')](),controller[_0x88ce('0x14')]);module[_0x88ce('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index ea189af..a2d393d 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 _0xbd85=['sequelize','exports','ENUM','incident','phonecall','contact','nothing','STRING'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xbd85,0x190));var _0x5bd8=function(_0x41d902,_0x29d0b){_0x41d902=_0x41d902-0x0;var _0x360fb1=_0xbd85[_0x41d902];return _0x360fb1;};'use strict';var Sequelize=require(_0x5bd8('0x0'));module[_0x5bd8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5bd8('0x2')](_0x5bd8('0x3'),_0x5bd8('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x5bd8('0x5'),_0x5bd8('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5bd8('0x7')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb9a7=['BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact','nothing'];(function(_0x2b57fc,_0x4b3658){var _0x5bf238=function(_0x21661a){while(--_0x21661a){_0x2b57fc['push'](_0x2b57fc['shift']());}};_0x5bf238(++_0x4b3658);}(_0xb9a7,0x1ba));var _0x7b9a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xb9a7[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x7b9a('0x0'));module[_0x7b9a('0x1')]={'name':{'type':Sequelize[_0x7b9a('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x7b9a('0x3'),_0x7b9a('0x4')),'defaultValue':_0x7b9a('0x3')},'moduleCreate':{'type':Sequelize[_0x7b9a('0x5')](_0x7b9a('0x6'),_0x7b9a('0x7')),'defaultValue':_0x7b9a('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7b9a('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7b9a('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e7cc15e..a46461f 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 _0x50ad=['send','index','Dynamics365Configuration','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','body','destroy','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name'];(function(_0x4851ff,_0x1c9a8d){var _0x26773b=function(_0x26c33e){while(--_0x26c33e){_0x4851ff['push'](_0x4851ff['shift']());}};_0x26773b(++_0x1c9a8d);}(_0x50ad,0x16c));var _0xd50a=function(_0x1c1bf5,_0x4fc8e6){_0x1c1bf5=_0x1c1bf5-0x0;var _0xa3389=_0x50ad[_0x1c1bf5];return _0xa3389;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd50a('0x0'));var zipdir=require(_0xd50a('0x1'));var jsonpatch=require(_0xd50a('0x2'));var rp=require(_0xd50a('0x3'));var moment=require(_0xd50a('0x4'));var BPromise=require(_0xd50a('0x5'));var Mustache=require(_0xd50a('0x6'));var util=require(_0xd50a('0x7'));var path=require(_0xd50a('0x8'));var sox=require(_0xd50a('0x9'));var csv=require('to-csv');var ejs=require(_0xd50a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd50a('0xb'));var squel=require(_0xd50a('0xc'));var crypto=require(_0xd50a('0xd'));var jsforce=require(_0xd50a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd50a('0xf'));var Redis=require('ioredis');var authService=require(_0xd50a('0x10'));var qs=require(_0xd50a('0x11'));var as=require(_0xd50a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd50a('0x13'));var utils=require(_0xd50a('0x14'));var config=require(_0xd50a('0x15'));var licenseUtil=require(_0xd50a('0x16'));var db=require(_0xd50a('0x17'))['db'];function respondWithStatusCode(_0x2d2d1f,_0x4945ff){_0x4945ff=_0x4945ff||0xcc;return function(_0x2aa98c){if(_0x2aa98c){return _0x2d2d1f['sendStatus'](_0x4945ff);}return _0x2d2d1f[_0xd50a('0x18')](_0x4945ff)[_0xd50a('0x19')]();};}function respondWithResult(_0x552f10,_0x2c40a6){_0x2c40a6=_0x2c40a6||0xc8;return function(_0x3ef4da){if(_0x3ef4da){return _0x552f10['status'](_0x2c40a6)[_0xd50a('0x1a')](_0x3ef4da);}};}function respondWithFilteredResult(_0x20ad9e,_0x51721d){return function(_0x596dda){if(_0x596dda){var _0x4e2c91=typeof _0x51721d['offset']===_0xd50a('0x1b')&&typeof _0x51721d[_0xd50a('0x1c')]===_0xd50a('0x1b');var _0x2fcbaa=_0x596dda[_0xd50a('0x1d')];var _0xe4902=_0x4e2c91?0x0:_0x51721d['offset'];var _0x2427f0=_0x4e2c91?_0x596dda[_0xd50a('0x1d')]:_0x51721d[_0xd50a('0x1e')]+_0x51721d[_0xd50a('0x1c')];var _0x2742aa;if(_0x2427f0>=_0x2fcbaa){_0x2427f0=_0x2fcbaa;_0x2742aa=0xc8;}else{_0x2742aa=0xce;}_0x20ad9e[_0xd50a('0x18')](_0x2742aa);return _0x20ad9e[_0xd50a('0x1f')](_0xd50a('0x20'),_0xe4902+'-'+_0x2427f0+'/'+_0x2fcbaa)[_0xd50a('0x1a')](_0x596dda);}return null;};}function patchUpdates(_0x13a48c){return function(_0xb598a4){try{jsonpatch[_0xd50a('0x21')](_0xb598a4,_0x13a48c,!![]);}catch(_0x5d624f){return BPromise[_0xd50a('0x22')](_0x5d624f);}return _0xb598a4[_0xd50a('0x23')]();};}function saveUpdates(_0xf6ea3,_0x25e996){return function(_0x40a0ef){if(_0x40a0ef){return _0x40a0ef[_0xd50a('0x24')](_0xf6ea3)[_0xd50a('0x25')](function(_0x4f3583){return _0x4f3583;});}return null;};}function removeEntity(_0x5abb6b,_0x4ae822){return function(_0xfa0858){if(_0xfa0858){return _0xfa0858['destroy']()['then'](function(){_0x5abb6b[_0xd50a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x480dcf,_0x2ade61){return function(_0x50f5fa){if(!_0x50f5fa){_0x480dcf[_0xd50a('0x26')](0x194);}return _0x50f5fa;};}function handleError(_0xc03856,_0x46aafb){_0x46aafb=_0x46aafb||0x1f4;return function(_0x4907bc){logger[_0xd50a('0x27')](_0x4907bc['stack']);if(_0x4907bc[_0xd50a('0x28')]){delete _0x4907bc[_0xd50a('0x28')];}_0xc03856[_0xd50a('0x18')](_0x46aafb)[_0xd50a('0x29')](_0x4907bc);};}exports[_0xd50a('0x2a')]=function(_0x2e99c6,_0x350307){var _0x2bc68d={},_0x3bfe68={},_0x3548f7={'count':0x0,'rows':[]};var _0x58e089=_['map'](db[_0xd50a('0x2b')][_0xd50a('0x2c')],function(_0x3be117){return{'name':_0x3be117[_0xd50a('0x2d')],'type':_0x3be117['type'][_0xd50a('0x2e')]};});_0x3bfe68[_0xd50a('0x2f')]=_[_0xd50a('0x30')](_0x58e089,_0xd50a('0x28'));_0x3bfe68[_0xd50a('0x31')]=_[_0xd50a('0x32')](_0x2e99c6[_0xd50a('0x31')]);_0x3bfe68['filters']=_[_0xd50a('0x33')](_0x3bfe68['model'],_0x3bfe68[_0xd50a('0x31')]);_0x2bc68d[_0xd50a('0x34')]=_[_0xd50a('0x33')](_0x3bfe68[_0xd50a('0x2f')],qs[_0xd50a('0x35')](_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x35')]));_0x2bc68d[_0xd50a('0x34')]=_0x2bc68d[_0xd50a('0x34')][_0xd50a('0x36')]?_0x2bc68d[_0xd50a('0x34')]:_0x3bfe68['model'];if(!_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x37')](_0xd50a('0x38'))){_0x2bc68d['limit']=qs[_0xd50a('0x1c')](_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x1c')]);_0x2bc68d['offset']=qs['offset'](_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x1e')]);}_0x2bc68d[_0xd50a('0x39')]=qs[_0xd50a('0x3a')](_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x3a')]);_0x2bc68d['where']=qs[_0xd50a('0x3b')](_[_0xd50a('0x3c')](_0x2e99c6[_0xd50a('0x31')],_0x3bfe68[_0xd50a('0x3b')]),_0x58e089);if(_0x2e99c6[_0xd50a('0x31')]['filter']){_0x2bc68d[_0xd50a('0x3d')]=_[_0xd50a('0x3e')](_0x2bc68d[_0xd50a('0x3d')],{'$or':_[_0xd50a('0x30')](_0x58e089,function(_0x19afd8){if(_0x19afd8[_0xd50a('0x3f')]!==_0xd50a('0x40')){var _0x4933b0={};_0x4933b0[_0x19afd8['name']]={'$like':'%'+_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x41')]+'%'};return _0x4933b0;}})});}_0x2bc68d=_[_0xd50a('0x3e')]({},_0x2bc68d,_0x2e99c6[_0xd50a('0x42')]);var _0x3b97d7={'where':_0x2bc68d[_0xd50a('0x3d')]};return db['Dynamics365Configuration'][_0xd50a('0x1d')](_0x3b97d7)['then'](function(_0x3ff88b){_0x3548f7['count']=_0x3ff88b;if(_0x2e99c6[_0xd50a('0x31')][_0xd50a('0x43')]){_0x2bc68d['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xd50a('0x44')](_0x2bc68d);})[_0xd50a('0x25')](function(_0x21a4ec){_0x3548f7[_0xd50a('0x45')]=_0x21a4ec;return _0x3548f7;})[_0xd50a('0x25')](respondWithFilteredResult(_0x350307,_0x2bc68d))[_0xd50a('0x46')](handleError(_0x350307,null));};exports['show']=function(_0xe6946c,_0x2d1fbe){var _0x50615a={'raw':![],'where':{'id':_0xe6946c[_0xd50a('0x47')]['id']}},_0xdf9556={};_0xdf9556['model']=_[_0xd50a('0x32')](db['Dynamics365Configuration'][_0xd50a('0x2c')]);_0xdf9556['query']=_[_0xd50a('0x32')](_0xe6946c[_0xd50a('0x31')]);_0xdf9556[_0xd50a('0x3b')]=_['intersection'](_0xdf9556['model'],_0xdf9556['query']);_0x50615a[_0xd50a('0x34')]=_['intersection'](_0xdf9556[_0xd50a('0x2f')],qs['fields'](_0xe6946c[_0xd50a('0x31')][_0xd50a('0x35')]));_0x50615a[_0xd50a('0x34')]=_0x50615a['attributes']['length']?_0x50615a[_0xd50a('0x34')]:_0xdf9556['model'];if(_0xe6946c['query']['includeAll']){_0x50615a[_0xd50a('0x48')]=[{'all':!![]}];}_0x50615a=_['merge']({},_0x50615a,_0xe6946c[_0xd50a('0x42')]);return db['Dynamics365Configuration'][_0xd50a('0x49')](_0x50615a)[_0xd50a('0x25')](handleEntityNotFound(_0x2d1fbe,null))[_0xd50a('0x25')](respondWithResult(_0x2d1fbe,null))[_0xd50a('0x46')](handleError(_0x2d1fbe,null));};exports['create']=function(_0x33197c,_0x2cbb37){return db['Dynamics365Configuration']['create'](_0x33197c[_0xd50a('0x4a')],{})[_0xd50a('0x25')](respondWithResult(_0x2cbb37,0xc9))['catch'](handleError(_0x2cbb37,null));};exports[_0xd50a('0x24')]=function(_0x128f3d,_0xdeb8e){if(_0x128f3d[_0xd50a('0x4a')]['id']){delete _0x128f3d[_0xd50a('0x4a')]['id'];}return db[_0xd50a('0x2b')][_0xd50a('0x49')]({'where':{'id':_0x128f3d[_0xd50a('0x47')]['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0xdeb8e,null))[_0xd50a('0x25')](saveUpdates(_0x128f3d['body'],null))[_0xd50a('0x25')](respondWithResult(_0xdeb8e,null))[_0xd50a('0x46')](handleError(_0xdeb8e,null));};exports[_0xd50a('0x4b')]=function(_0x4fea4b,_0x441887){return db[_0xd50a('0x2b')][_0xd50a('0x49')]({'where':{'id':_0x4fea4b[_0xd50a('0x47')]['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0x441887,null))['then'](removeEntity(_0x441887,null))[_0xd50a('0x46')](handleError(_0x441887,null));};exports[_0xd50a('0x4c')]=function(_0x55f3ab,_0x232d97,_0x4abe28){var _0x1ff68e={};var _0x3fb2b8={};var _0x448215;var _0x14a7d4;return db[_0xd50a('0x2b')]['findOne']({'where':{'id':_0x55f3ab[_0xd50a('0x47')]['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0x232d97,null))[_0xd50a('0x25')](function(_0x4f9781){if(_0x4f9781){_0x448215=_0x4f9781;_0x3fb2b8[_0xd50a('0x2f')]=_['keys'](db[_0xd50a('0x4d')][_0xd50a('0x2c')]);_0x3fb2b8[_0xd50a('0x31')]=_[_0xd50a('0x32')](_0x55f3ab[_0xd50a('0x31')]);_0x3fb2b8['filters']=_[_0xd50a('0x33')](_0x3fb2b8[_0xd50a('0x2f')],_0x3fb2b8['query']);_0x1ff68e[_0xd50a('0x34')]=_[_0xd50a('0x33')](_0x3fb2b8['model'],qs[_0xd50a('0x35')](_0x55f3ab[_0xd50a('0x31')][_0xd50a('0x35')]));_0x1ff68e[_0xd50a('0x34')]=_0x1ff68e[_0xd50a('0x34')]['length']?_0x1ff68e[_0xd50a('0x34')]:_0x3fb2b8[_0xd50a('0x2f')];_0x1ff68e[_0xd50a('0x39')]=qs['sort'](_0x55f3ab['query']['sort']);_0x1ff68e[_0xd50a('0x3d')]=qs['filters'](_[_0xd50a('0x3c')](_0x55f3ab['query'],_0x3fb2b8['filters']));if(_0x55f3ab[_0xd50a('0x31')]['filter']){_0x1ff68e[_0xd50a('0x3d')]=_[_0xd50a('0x3e')](_0x1ff68e[_0xd50a('0x3d')],{'$or':_[_0xd50a('0x30')](_0x1ff68e['attributes'],function(_0x5a27b7){var _0x204d60={};_0x204d60[_0x5a27b7]={'$like':'%'+_0x55f3ab[_0xd50a('0x31')][_0xd50a('0x41')]+'%'};return _0x204d60;})});}_0x1ff68e=_['merge']({},_0x1ff68e,_0x55f3ab[_0xd50a('0x42')]);return _0x448215[_0xd50a('0x4c')](_0x1ff68e);}})[_0xd50a('0x25')](function(_0x401da2){if(_0x401da2){_0x14a7d4=_0x401da2[_0xd50a('0x36')];if(!_0x55f3ab['query'][_0xd50a('0x37')](_0xd50a('0x38'))){_0x1ff68e[_0xd50a('0x1c')]=qs[_0xd50a('0x1c')](_0x55f3ab[_0xd50a('0x31')][_0xd50a('0x1c')]);_0x1ff68e['offset']=qs[_0xd50a('0x1e')](_0x55f3ab[_0xd50a('0x31')][_0xd50a('0x1e')]);}return _0x448215['getFields'](_0x1ff68e);}})[_0xd50a('0x25')](function(_0x1759b3){if(_0x1759b3){return _0x1759b3?{'count':_0x14a7d4,'rows':_0x1759b3}:null;}})['then'](respondWithResult(_0x232d97,null))[_0xd50a('0x46')](handleError(_0x232d97,null));};exports[_0xd50a('0x4e')]=function(_0x4e6c83,_0x267cda,_0x1bd272){var _0x2df7a0={};var _0x2e8fdf={};var _0x22cbc9;var _0x53926d;return db['Dynamics365Configuration'][_0xd50a('0x4f')]({'where':{'id':_0x4e6c83['params']['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0x267cda,null))['then'](function(_0x266ac2){if(_0x266ac2){_0x22cbc9=_0x266ac2;_0x2e8fdf[_0xd50a('0x2f')]=_[_0xd50a('0x32')](db['Dynamics365Field'][_0xd50a('0x2c')]);_0x2e8fdf['query']=_['keys'](_0x4e6c83[_0xd50a('0x31')]);_0x2e8fdf[_0xd50a('0x3b')]=_[_0xd50a('0x33')](_0x2e8fdf[_0xd50a('0x2f')],_0x2e8fdf[_0xd50a('0x31')]);_0x2df7a0[_0xd50a('0x34')]=_[_0xd50a('0x33')](_0x2e8fdf[_0xd50a('0x2f')],qs[_0xd50a('0x35')](_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x35')]));_0x2df7a0[_0xd50a('0x34')]=_0x2df7a0['attributes'][_0xd50a('0x36')]?_0x2df7a0[_0xd50a('0x34')]:_0x2e8fdf['model'];_0x2df7a0[_0xd50a('0x39')]=qs[_0xd50a('0x3a')](_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x3a')]);_0x2df7a0['where']=qs[_0xd50a('0x3b')](_['pick'](_0x4e6c83['query'],_0x2e8fdf[_0xd50a('0x3b')]));if(_0x4e6c83[_0xd50a('0x31')]['filter']){_0x2df7a0[_0xd50a('0x3d')]=_['merge'](_0x2df7a0['where'],{'$or':_[_0xd50a('0x30')](_0x2df7a0[_0xd50a('0x34')],function(_0x5d23d6){var _0x1293e3={};_0x1293e3[_0x5d23d6]={'$like':'%'+_0x4e6c83[_0xd50a('0x31')]['filter']+'%'};return _0x1293e3;})});}_0x2df7a0=_[_0xd50a('0x3e')]({},_0x2df7a0,_0x4e6c83[_0xd50a('0x42')]);return _0x22cbc9[_0xd50a('0x4e')](_0x2df7a0);}})[_0xd50a('0x25')](function(_0xb08b4){if(_0xb08b4){_0x53926d=_0xb08b4[_0xd50a('0x36')];if(!_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x37')]('nolimit')){_0x2df7a0[_0xd50a('0x1c')]=qs[_0xd50a('0x1c')](_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x1c')]);_0x2df7a0[_0xd50a('0x1e')]=qs[_0xd50a('0x1e')](_0x4e6c83[_0xd50a('0x31')][_0xd50a('0x1e')]);}return _0x22cbc9[_0xd50a('0x4e')](_0x2df7a0);}})['then'](function(_0x31038a){if(_0x31038a){return _0x31038a?{'count':_0x53926d,'rows':_0x31038a}:null;}})[_0xd50a('0x25')](respondWithResult(_0x267cda,null))[_0xd50a('0x46')](handleError(_0x267cda,null));};exports[_0xd50a('0x50')]=function(_0x4dceeb,_0x2e011c,_0x16c880){var _0x428d42={};var _0x4e40e0={};var _0x5c3276;var _0x586408;return db[_0xd50a('0x2b')][_0xd50a('0x4f')]({'where':{'id':_0x4dceeb[_0xd50a('0x47')]['id']}})[_0xd50a('0x25')](handleEntityNotFound(_0x2e011c,null))['then'](function(_0x24f1d3){if(_0x24f1d3){_0x5c3276=_0x24f1d3;_0x4e40e0[_0xd50a('0x2f')]=_[_0xd50a('0x32')](db[_0xd50a('0x4d')][_0xd50a('0x2c')]);_0x4e40e0['query']=_[_0xd50a('0x32')](_0x4dceeb[_0xd50a('0x31')]);_0x4e40e0[_0xd50a('0x3b')]=_[_0xd50a('0x33')](_0x4e40e0[_0xd50a('0x2f')],_0x4e40e0[_0xd50a('0x31')]);_0x428d42['attributes']=_['intersection'](_0x4e40e0[_0xd50a('0x2f')],qs[_0xd50a('0x35')](_0x4dceeb[_0xd50a('0x31')][_0xd50a('0x35')]));_0x428d42['attributes']=_0x428d42['attributes'][_0xd50a('0x36')]?_0x428d42['attributes']:_0x4e40e0['model'];_0x428d42[_0xd50a('0x39')]=qs['sort'](_0x4dceeb[_0xd50a('0x31')][_0xd50a('0x3a')]);_0x428d42['where']=qs[_0xd50a('0x3b')](_['pick'](_0x4dceeb[_0xd50a('0x31')],_0x4e40e0[_0xd50a('0x3b')]));if(_0x4dceeb[_0xd50a('0x31')][_0xd50a('0x41')]){_0x428d42['where']=_[_0xd50a('0x3e')](_0x428d42[_0xd50a('0x3d')],{'$or':_[_0xd50a('0x30')](_0x428d42['attributes'],function(_0xa494c2){var _0x236683={};_0x236683[_0xa494c2]={'$like':'%'+_0x4dceeb['query']['filter']+'%'};return _0x236683;})});}_0x428d42=_[_0xd50a('0x3e')]({},_0x428d42,_0x4dceeb['options']);return _0x5c3276[_0xd50a('0x50')](_0x428d42);}})[_0xd50a('0x25')](function(_0x47606e){if(_0x47606e){_0x586408=_0x47606e[_0xd50a('0x36')];if(!_0x4dceeb[_0xd50a('0x31')][_0xd50a('0x37')](_0xd50a('0x38'))){_0x428d42[_0xd50a('0x1c')]=qs[_0xd50a('0x1c')](_0x4dceeb['query'][_0xd50a('0x1c')]);_0x428d42['offset']=qs[_0xd50a('0x1e')](_0x4dceeb['query'][_0xd50a('0x1e')]);}return _0x5c3276[_0xd50a('0x50')](_0x428d42);}})[_0xd50a('0x25')](function(_0x4c3ed9){if(_0x4c3ed9){return _0x4c3ed9?{'count':_0x586408,'rows':_0x4c3ed9}:null;}})['then'](respondWithResult(_0x2e011c,null))['catch'](handleError(_0x2e011c,null));}; \ No newline at end of file +var _0x3617=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','Dynamics365Configuration','include','findAll','rows','catch','show','rawAttributes','includeAll','options','body','find','params','findOne','Dynamics365Field','filter','getFields','length','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','stack','name','index','map','fieldName','type','model','query','keys'];(function(_0x4c8fd7,_0x5ac749){var _0xd77a98=function(_0x3a5f2a){while(--_0x3a5f2a){_0x4c8fd7['push'](_0x4c8fd7['shift']());}};_0xd77a98(++_0x5ac749);}(_0x3617,0xc3));var _0x7361=function(_0x43059c,_0x202a3d){_0x43059c=_0x43059c-0x0;var _0xd1e9dd=_0x3617[_0x43059c];return _0xd1e9dd;};'use strict';var emlformat=require(_0x7361('0x0'));var rimraf=require(_0x7361('0x1'));var zipdir=require(_0x7361('0x2'));var jsonpatch=require(_0x7361('0x3'));var rp=require(_0x7361('0x4'));var moment=require(_0x7361('0x5'));var BPromise=require(_0x7361('0x6'));var Mustache=require('mustache');var util=require(_0x7361('0x7'));var path=require(_0x7361('0x8'));var sox=require(_0x7361('0x9'));var csv=require('to-csv');var ejs=require(_0x7361('0xa'));var fs=require('fs');var fs_extra=require(_0x7361('0xb'));var _=require(_0x7361('0xc'));var squel=require(_0x7361('0xd'));var crypto=require(_0x7361('0xe'));var jsforce=require(_0x7361('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7361('0x10'));var querystring=require(_0x7361('0x11'));var Papa=require(_0x7361('0x12'));var Redis=require(_0x7361('0x13'));var authService=require(_0x7361('0x14'));var qs=require(_0x7361('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7361('0x16'));var logger=require(_0x7361('0x17'))(_0x7361('0x18'));var utils=require(_0x7361('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7361('0x1a'));var db=require(_0x7361('0x1b'))['db'];function respondWithStatusCode(_0x552342,_0x3ff313){_0x3ff313=_0x3ff313||0xcc;return function(_0xadffa7){if(_0xadffa7){return _0x552342[_0x7361('0x1c')](_0x3ff313);}return _0x552342[_0x7361('0x1d')](_0x3ff313)['end']();};}function respondWithResult(_0x409ceb,_0x1545b5){_0x1545b5=_0x1545b5||0xc8;return function(_0x339b04){if(_0x339b04){return _0x409ceb['status'](_0x1545b5)[_0x7361('0x1e')](_0x339b04);}};}function respondWithFilteredResult(_0x41a67b,_0x1504d7){return function(_0x3e44eb){if(_0x3e44eb){var _0x544252=typeof _0x1504d7[_0x7361('0x1f')]===_0x7361('0x20')&&typeof _0x1504d7[_0x7361('0x21')]===_0x7361('0x20');var _0x4e03f2=_0x3e44eb[_0x7361('0x22')];var _0x4c0db8=_0x544252?0x0:_0x1504d7[_0x7361('0x1f')];var _0x5b3694=_0x544252?_0x3e44eb[_0x7361('0x22')]:_0x1504d7[_0x7361('0x1f')]+_0x1504d7['limit'];var _0x3bc951;if(_0x5b3694>=_0x4e03f2){_0x5b3694=_0x4e03f2;_0x3bc951=0xc8;}else{_0x3bc951=0xce;}_0x41a67b[_0x7361('0x1d')](_0x3bc951);return _0x41a67b['set'](_0x7361('0x23'),_0x4c0db8+'-'+_0x5b3694+'/'+_0x4e03f2)['json'](_0x3e44eb);}return null;};}function patchUpdates(_0x49ddf2){return function(_0x2c6d58){try{jsonpatch[_0x7361('0x24')](_0x2c6d58,_0x49ddf2,!![]);}catch(_0x21862b){return BPromise[_0x7361('0x25')](_0x21862b);}return _0x2c6d58['save']();};}function saveUpdates(_0x5ae9cc,_0x1a2635){return function(_0xd0c7){if(_0xd0c7){return _0xd0c7[_0x7361('0x26')](_0x5ae9cc)[_0x7361('0x27')](function(_0x36f189){return _0x36f189;});}return null;};}function removeEntity(_0x219b7a,_0x5ee2fb){return function(_0x1f19d6){if(_0x1f19d6){return _0x1f19d6[_0x7361('0x28')]()[_0x7361('0x27')](function(){_0x219b7a[_0x7361('0x1d')](0xcc)[_0x7361('0x29')]();});}};}function handleEntityNotFound(_0x5d69c7,_0x2ad07c){return function(_0x185090){if(!_0x185090){_0x5d69c7[_0x7361('0x1c')](0x194);}return _0x185090;};}function handleError(_0x68aa0a,_0xd83497){_0xd83497=_0xd83497||0x1f4;return function(_0x18a8f6){logger['error'](_0x18a8f6[_0x7361('0x2a')]);if(_0x18a8f6[_0x7361('0x2b')]){delete _0x18a8f6['name'];}_0x68aa0a[_0x7361('0x1d')](_0xd83497)['send'](_0x18a8f6);};}exports[_0x7361('0x2c')]=function(_0x5447a3,_0x394af3){var _0x5b1f47={},_0x41e183={},_0x460cd8={'count':0x0,'rows':[]};var _0x5a8595=_[_0x7361('0x2d')](db['Dynamics365Configuration']['rawAttributes'],function(_0x330da0){return{'name':_0x330da0[_0x7361('0x2e')],'type':_0x330da0[_0x7361('0x2f')]['key']};});_0x41e183[_0x7361('0x30')]=_['map'](_0x5a8595,_0x7361('0x2b'));_0x41e183[_0x7361('0x31')]=_[_0x7361('0x32')](_0x5447a3[_0x7361('0x31')]);_0x41e183[_0x7361('0x33')]=_[_0x7361('0x34')](_0x41e183[_0x7361('0x30')],_0x41e183[_0x7361('0x31')]);_0x5b1f47['attributes']=_[_0x7361('0x34')](_0x41e183[_0x7361('0x30')],qs[_0x7361('0x35')](_0x5447a3[_0x7361('0x31')]['fields']));_0x5b1f47[_0x7361('0x36')]=_0x5b1f47[_0x7361('0x36')]['length']?_0x5b1f47[_0x7361('0x36')]:_0x41e183[_0x7361('0x30')];if(!_0x5447a3[_0x7361('0x31')][_0x7361('0x37')](_0x7361('0x38'))){_0x5b1f47[_0x7361('0x21')]=qs[_0x7361('0x21')](_0x5447a3[_0x7361('0x31')][_0x7361('0x21')]);_0x5b1f47['offset']=qs[_0x7361('0x1f')](_0x5447a3[_0x7361('0x31')][_0x7361('0x1f')]);}_0x5b1f47[_0x7361('0x39')]=qs[_0x7361('0x3a')](_0x5447a3[_0x7361('0x31')][_0x7361('0x3a')]);_0x5b1f47['where']=qs[_0x7361('0x33')](_[_0x7361('0x3b')](_0x5447a3[_0x7361('0x31')],_0x41e183[_0x7361('0x33')]),_0x5a8595);if(_0x5447a3['query']['filter']){_0x5b1f47[_0x7361('0x3c')]=_[_0x7361('0x3d')](_0x5b1f47['where'],{'$or':_[_0x7361('0x2d')](_0x5a8595,function(_0x4b4409){if(_0x4b4409[_0x7361('0x2f')]!==_0x7361('0x3e')){var _0x4c84d2={};_0x4c84d2[_0x4b4409[_0x7361('0x2b')]]={'$like':'%'+_0x5447a3['query']['filter']+'%'};return _0x4c84d2;}})});}_0x5b1f47=_[_0x7361('0x3d')]({},_0x5b1f47,_0x5447a3['options']);var _0x363397={'where':_0x5b1f47[_0x7361('0x3c')]};return db[_0x7361('0x3f')][_0x7361('0x22')](_0x363397)[_0x7361('0x27')](function(_0x1ccb7f){_0x460cd8[_0x7361('0x22')]=_0x1ccb7f;if(_0x5447a3[_0x7361('0x31')]['includeAll']){_0x5b1f47[_0x7361('0x40')]=[{'all':!![]}];}return db[_0x7361('0x3f')][_0x7361('0x41')](_0x5b1f47);})['then'](function(_0x29e87e){_0x460cd8[_0x7361('0x42')]=_0x29e87e;return _0x460cd8;})[_0x7361('0x27')](respondWithFilteredResult(_0x394af3,_0x5b1f47))[_0x7361('0x43')](handleError(_0x394af3,null));};exports[_0x7361('0x44')]=function(_0x3775c0,_0x39924b){var _0x4b0588={'raw':![],'where':{'id':_0x3775c0['params']['id']}},_0x1e2cf1={};_0x1e2cf1[_0x7361('0x30')]=_[_0x7361('0x32')](db['Dynamics365Configuration'][_0x7361('0x45')]);_0x1e2cf1['query']=_[_0x7361('0x32')](_0x3775c0['query']);_0x1e2cf1[_0x7361('0x33')]=_[_0x7361('0x34')](_0x1e2cf1[_0x7361('0x30')],_0x1e2cf1[_0x7361('0x31')]);_0x4b0588['attributes']=_[_0x7361('0x34')](_0x1e2cf1[_0x7361('0x30')],qs['fields'](_0x3775c0[_0x7361('0x31')][_0x7361('0x35')]));_0x4b0588[_0x7361('0x36')]=_0x4b0588[_0x7361('0x36')]['length']?_0x4b0588[_0x7361('0x36')]:_0x1e2cf1[_0x7361('0x30')];if(_0x3775c0[_0x7361('0x31')][_0x7361('0x46')]){_0x4b0588[_0x7361('0x40')]=[{'all':!![]}];}_0x4b0588=_[_0x7361('0x3d')]({},_0x4b0588,_0x3775c0[_0x7361('0x47')]);return db[_0x7361('0x3f')]['find'](_0x4b0588)['then'](handleEntityNotFound(_0x39924b,null))[_0x7361('0x27')](respondWithResult(_0x39924b,null))[_0x7361('0x43')](handleError(_0x39924b,null));};exports['create']=function(_0x522199,_0x210a20){return db['Dynamics365Configuration']['create'](_0x522199['body'],{})[_0x7361('0x27')](respondWithResult(_0x210a20,0xc9))[_0x7361('0x43')](handleError(_0x210a20,null));};exports[_0x7361('0x26')]=function(_0x17c79a,_0x55ae0f){if(_0x17c79a[_0x7361('0x48')]['id']){delete _0x17c79a['body']['id'];}return db[_0x7361('0x3f')][_0x7361('0x49')]({'where':{'id':_0x17c79a[_0x7361('0x4a')]['id']}})['then'](handleEntityNotFound(_0x55ae0f,null))[_0x7361('0x27')](saveUpdates(_0x17c79a[_0x7361('0x48')],null))['then'](respondWithResult(_0x55ae0f,null))[_0x7361('0x43')](handleError(_0x55ae0f,null));};exports[_0x7361('0x28')]=function(_0x3c7025,_0x1d56d1){return db[_0x7361('0x3f')]['find']({'where':{'id':_0x3c7025[_0x7361('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d56d1,null))[_0x7361('0x27')](removeEntity(_0x1d56d1,null))['catch'](handleError(_0x1d56d1,null));};exports['getFields']=function(_0x1da611,_0x3db363,_0x17182f){var _0x22aacf={};var _0x53fe0b={};var _0x195558;var _0x59e4ae;return db[_0x7361('0x3f')][_0x7361('0x4b')]({'where':{'id':_0x1da611['params']['id']}})[_0x7361('0x27')](handleEntityNotFound(_0x3db363,null))['then'](function(_0x1a5bec){if(_0x1a5bec){_0x195558=_0x1a5bec;_0x53fe0b[_0x7361('0x30')]=_[_0x7361('0x32')](db[_0x7361('0x4c')]['rawAttributes']);_0x53fe0b['query']=_[_0x7361('0x32')](_0x1da611[_0x7361('0x31')]);_0x53fe0b['filters']=_['intersection'](_0x53fe0b[_0x7361('0x30')],_0x53fe0b['query']);_0x22aacf[_0x7361('0x36')]=_[_0x7361('0x34')](_0x53fe0b[_0x7361('0x30')],qs[_0x7361('0x35')](_0x1da611[_0x7361('0x31')][_0x7361('0x35')]));_0x22aacf[_0x7361('0x36')]=_0x22aacf['attributes']['length']?_0x22aacf[_0x7361('0x36')]:_0x53fe0b[_0x7361('0x30')];_0x22aacf[_0x7361('0x39')]=qs[_0x7361('0x3a')](_0x1da611[_0x7361('0x31')][_0x7361('0x3a')]);_0x22aacf[_0x7361('0x3c')]=qs[_0x7361('0x33')](_[_0x7361('0x3b')](_0x1da611[_0x7361('0x31')],_0x53fe0b[_0x7361('0x33')]));if(_0x1da611[_0x7361('0x31')][_0x7361('0x4d')]){_0x22aacf[_0x7361('0x3c')]=_[_0x7361('0x3d')](_0x22aacf['where'],{'$or':_['map'](_0x22aacf[_0x7361('0x36')],function(_0x342a6a){var _0x17fd51={};_0x17fd51[_0x342a6a]={'$like':'%'+_0x1da611[_0x7361('0x31')][_0x7361('0x4d')]+'%'};return _0x17fd51;})});}_0x22aacf=_[_0x7361('0x3d')]({},_0x22aacf,_0x1da611['options']);return _0x195558[_0x7361('0x4e')](_0x22aacf);}})[_0x7361('0x27')](function(_0x1fb751){if(_0x1fb751){_0x59e4ae=_0x1fb751['length'];if(!_0x1da611['query'][_0x7361('0x37')]('nolimit')){_0x22aacf[_0x7361('0x21')]=qs[_0x7361('0x21')](_0x1da611[_0x7361('0x31')][_0x7361('0x21')]);_0x22aacf['offset']=qs[_0x7361('0x1f')](_0x1da611[_0x7361('0x31')][_0x7361('0x1f')]);}return _0x195558[_0x7361('0x4e')](_0x22aacf);}})[_0x7361('0x27')](function(_0x47187d){if(_0x47187d){return _0x47187d?{'count':_0x59e4ae,'rows':_0x47187d}:null;}})[_0x7361('0x27')](respondWithResult(_0x3db363,null))[_0x7361('0x43')](handleError(_0x3db363,null));};exports['getSubjects']=function(_0x12e6cd,_0x17627c,_0x3acaae){var _0x405ca6={};var _0x1a74ca={};var _0x18ba61;var _0x17a119;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x12e6cd[_0x7361('0x4a')]['id']}})[_0x7361('0x27')](handleEntityNotFound(_0x17627c,null))[_0x7361('0x27')](function(_0x10911a){if(_0x10911a){_0x18ba61=_0x10911a;_0x1a74ca[_0x7361('0x30')]=_[_0x7361('0x32')](db['Dynamics365Field']['rawAttributes']);_0x1a74ca[_0x7361('0x31')]=_[_0x7361('0x32')](_0x12e6cd[_0x7361('0x31')]);_0x1a74ca['filters']=_[_0x7361('0x34')](_0x1a74ca[_0x7361('0x30')],_0x1a74ca[_0x7361('0x31')]);_0x405ca6[_0x7361('0x36')]=_[_0x7361('0x34')](_0x1a74ca[_0x7361('0x30')],qs[_0x7361('0x35')](_0x12e6cd[_0x7361('0x31')][_0x7361('0x35')]));_0x405ca6[_0x7361('0x36')]=_0x405ca6['attributes'][_0x7361('0x4f')]?_0x405ca6[_0x7361('0x36')]:_0x1a74ca[_0x7361('0x30')];_0x405ca6['order']=qs[_0x7361('0x3a')](_0x12e6cd[_0x7361('0x31')][_0x7361('0x3a')]);_0x405ca6['where']=qs['filters'](_['pick'](_0x12e6cd[_0x7361('0x31')],_0x1a74ca[_0x7361('0x33')]));if(_0x12e6cd[_0x7361('0x31')]['filter']){_0x405ca6['where']=_[_0x7361('0x3d')](_0x405ca6[_0x7361('0x3c')],{'$or':_[_0x7361('0x2d')](_0x405ca6[_0x7361('0x36')],function(_0x28c95d){var _0x40dba3={};_0x40dba3[_0x28c95d]={'$like':'%'+_0x12e6cd[_0x7361('0x31')][_0x7361('0x4d')]+'%'};return _0x40dba3;})});}_0x405ca6=_['merge']({},_0x405ca6,_0x12e6cd['options']);return _0x18ba61[_0x7361('0x50')](_0x405ca6);}})[_0x7361('0x27')](function(_0x419de6){if(_0x419de6){_0x17a119=_0x419de6[_0x7361('0x4f')];if(!_0x12e6cd[_0x7361('0x31')]['hasOwnProperty']('nolimit')){_0x405ca6[_0x7361('0x21')]=qs[_0x7361('0x21')](_0x12e6cd[_0x7361('0x31')]['limit']);_0x405ca6[_0x7361('0x1f')]=qs[_0x7361('0x1f')](_0x12e6cd['query']['offset']);}return _0x18ba61[_0x7361('0x50')](_0x405ca6);}})[_0x7361('0x27')](function(_0x1e61a2){if(_0x1e61a2){return _0x1e61a2?{'count':_0x17a119,'rows':_0x1e61a2}:null;}})['then'](respondWithResult(_0x17627c,null))[_0x7361('0x43')](handleError(_0x17627c,null));};exports[_0x7361('0x51')]=function(_0x45ab26,_0x99e7fa,_0x299ce9){var _0x671a95={};var _0x4ff853={};var _0xbd7d4c;var _0x12bc87;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x45ab26[_0x7361('0x4a')]['id']}})[_0x7361('0x27')](handleEntityNotFound(_0x99e7fa,null))[_0x7361('0x27')](function(_0x569fd2){if(_0x569fd2){_0xbd7d4c=_0x569fd2;_0x4ff853[_0x7361('0x30')]=_[_0x7361('0x32')](db[_0x7361('0x4c')][_0x7361('0x45')]);_0x4ff853['query']=_[_0x7361('0x32')](_0x45ab26[_0x7361('0x31')]);_0x4ff853['filters']=_['intersection'](_0x4ff853[_0x7361('0x30')],_0x4ff853[_0x7361('0x31')]);_0x671a95[_0x7361('0x36')]=_[_0x7361('0x34')](_0x4ff853[_0x7361('0x30')],qs['fields'](_0x45ab26['query'][_0x7361('0x35')]));_0x671a95[_0x7361('0x36')]=_0x671a95[_0x7361('0x36')][_0x7361('0x4f')]?_0x671a95[_0x7361('0x36')]:_0x4ff853[_0x7361('0x30')];_0x671a95['order']=qs['sort'](_0x45ab26['query'][_0x7361('0x3a')]);_0x671a95[_0x7361('0x3c')]=qs['filters'](_['pick'](_0x45ab26[_0x7361('0x31')],_0x4ff853[_0x7361('0x33')]));if(_0x45ab26[_0x7361('0x31')][_0x7361('0x4d')]){_0x671a95['where']=_[_0x7361('0x3d')](_0x671a95[_0x7361('0x3c')],{'$or':_[_0x7361('0x2d')](_0x671a95[_0x7361('0x36')],function(_0x3178c9){var _0x4558f4={};_0x4558f4[_0x3178c9]={'$like':'%'+_0x45ab26[_0x7361('0x31')][_0x7361('0x4d')]+'%'};return _0x4558f4;})});}_0x671a95=_[_0x7361('0x3d')]({},_0x671a95,_0x45ab26['options']);return _0xbd7d4c['getDescriptions'](_0x671a95);}})[_0x7361('0x27')](function(_0x38fca8){if(_0x38fca8){_0x12bc87=_0x38fca8[_0x7361('0x4f')];if(!_0x45ab26[_0x7361('0x31')][_0x7361('0x37')](_0x7361('0x38'))){_0x671a95['limit']=qs[_0x7361('0x21')](_0x45ab26[_0x7361('0x31')][_0x7361('0x21')]);_0x671a95[_0x7361('0x1f')]=qs[_0x7361('0x1f')](_0x45ab26['query'][_0x7361('0x1f')]);}return _0xbd7d4c[_0x7361('0x51')](_0x671a95);}})[_0x7361('0x27')](function(_0x3b0774){if(_0x3b0774){return _0x3b0774?{'count':_0x12bc87,'rows':_0x3b0774}:null;}})[_0x7361('0x27')](respondWithResult(_0x99e7fa,null))['catch'](handleError(_0x99e7fa,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index d056a0b..be6299a 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5e8063,_0x25dc8c){var _0x1aa9ec=function(_0x962a4c){while(--_0x962a4c){_0x5e8063['push'](_0x5e8063['shift']());}};_0x1aa9ec(++_0x25dc8c);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xb4e6[_0x237da8];return _0x558825;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x3419e5,_0xdc2888){var _0x1db2df=function(_0x3bfbcb){while(--_0x3bfbcb){_0x3419e5['push'](_0x3419e5['shift']());}};_0x1db2df(++_0xdc2888);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x00bb[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 575f69e..4efef2c 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 _0xb4a3=['message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b4716,_0x462a64){var _0x4cc549=function(_0x5aef7e){while(--_0x5aef7e){_0x2b4716['push'](_0x2b4716['shift']());}};_0x4cc549(++_0x462a64);}(_0xb4a3,0xa4));var _0x3b4a=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0xb4a3[_0x257017];return _0x38536d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3b4a('0x0'));var rs=require(_0x3b4a('0x1'));var fs=require('fs');var Redis=require(_0x3b4a('0x2'));var db=require(_0x3b4a('0x3'))['db'];var utils=require(_0x3b4a('0x4'));var logger=require(_0x3b4a('0x5'))(_0x3b4a('0x6'));var config=require(_0x3b4a('0x7'));var jayson=require(_0x3b4a('0x8'));var client=jayson[_0x3b4a('0x9')][_0x3b4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5b36,_0x20c694,_0x49623c){return new BPromise(function(_0xe64c26,_0x4191a8){return client['request'](_0x4c5b36,_0x49623c)[_0x3b4a('0xb')](function(_0x23db29){logger[_0x3b4a('0xc')](_0x3b4a('0xd'),_0x20c694,_0x3b4a('0xe'));logger[_0x3b4a('0xf')](_0x3b4a('0x10'),_0x20c694,'request\x20sent',JSON[_0x3b4a('0x11')](_0x23db29));if(_0x23db29[_0x3b4a('0x12')]){if(_0x23db29[_0x3b4a('0x12')][_0x3b4a('0x13')]===0x1f4){logger[_0x3b4a('0x12')](_0x3b4a('0xd'),_0x20c694,_0x23db29['error']['message']);return _0x4191a8(_0x23db29[_0x3b4a('0x12')][_0x3b4a('0x14')]);}logger[_0x3b4a('0x12')](_0x3b4a('0xd'),_0x20c694,_0x23db29[_0x3b4a('0x12')][_0x3b4a('0x14')]);return _0xe64c26(_0x23db29[_0x3b4a('0x12')][_0x3b4a('0x14')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x20c694,_0x3b4a('0xe'));_0xe64c26(_0x23db29[_0x3b4a('0x15')]['message']);}})[_0x3b4a('0x16')](function(_0xdb4094){logger[_0x3b4a('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x20c694,_0xdb4094);_0x4191a8(_0xdb4094);});});} \ No newline at end of file +var _0x2842=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x22a45c,_0x2b6afe){var _0x142054=function(_0x1c8a7e){while(--_0x1c8a7e){_0x22a45c['push'](_0x22a45c['shift']());}};_0x142054(++_0x2b6afe);}(_0x2842,0x1b7));var _0x2284=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2842[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2284('0x0'));var util=require(_0x2284('0x1'));var moment=require('moment');var BPromise=require(_0x2284('0x2'));var rs=require(_0x2284('0x3'));var fs=require('fs');var Redis=require(_0x2284('0x4'));var db=require(_0x2284('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2284('0x6'))(_0x2284('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2284('0x8')][_0x2284('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cd5be,_0x139ab7,_0x442144){return new BPromise(function(_0x1aeca3,_0x5745b8){return client['request'](_0x3cd5be,_0x442144)[_0x2284('0xa')](function(_0x4450cc){logger[_0x2284('0xb')](_0x2284('0xc'),_0x139ab7,_0x2284('0xd'));logger[_0x2284('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x139ab7,_0x2284('0xd'),JSON[_0x2284('0xf')](_0x4450cc));if(_0x4450cc[_0x2284('0x10')]){if(_0x4450cc['error'][_0x2284('0x11')]===0x1f4){logger[_0x2284('0x10')](_0x2284('0xc'),_0x139ab7,_0x4450cc[_0x2284('0x10')][_0x2284('0x12')]);return _0x5745b8(_0x4450cc['error'][_0x2284('0x12')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x139ab7,_0x4450cc['error'][_0x2284('0x12')]);return _0x1aeca3(_0x4450cc['error']['message']);}else{logger[_0x2284('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x139ab7,_0x2284('0xd'));_0x1aeca3(_0x4450cc[_0x2284('0x13')][_0x2284('0x12')]);}})['catch'](function(_0x265f56){logger[_0x2284('0x10')](_0x2284('0xc'),_0x139ab7,_0x265f56);_0x5745b8(_0x265f56);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3a5a3eb..278353c 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 _0xae75=['../../components/interaction/service','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xae75,0x94));var _0x5ae7=function(_0xa4fc15,_0x38c4ab){_0xa4fc15=_0xa4fc15-0x0;var _0x2730fc=_0xae75[_0xa4fc15];return _0x2730fc;};'use strict';var multer=require(_0x5ae7('0x0'));var util=require(_0x5ae7('0x1'));var path=require('path');var timeout=require(_0x5ae7('0x2'));var express=require(_0x5ae7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5ae7('0x4'));var interaction=require(_0x5ae7('0x5'));var config=require('../../config/environment');var controller=require(_0x5ae7('0x6'));router['get']('/',auth[_0x5ae7('0x7')](),controller[_0x5ae7('0x8')]);router[_0x5ae7('0x9')](_0x5ae7('0xa'),auth[_0x5ae7('0x7')](),controller[_0x5ae7('0xb')]);router[_0x5ae7('0xc')]('/',auth[_0x5ae7('0x7')](),controller['create']);router[_0x5ae7('0xd')](_0x5ae7('0xa'),auth[_0x5ae7('0x7')](),controller[_0x5ae7('0xe')]);router[_0x5ae7('0xf')](_0x5ae7('0xa'),auth[_0x5ae7('0x7')](),controller[_0x5ae7('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb343=['../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3420bd,_0x34703d){var _0x5c7793=function(_0x64fe96){while(--_0x64fe96){_0x3420bd['push'](_0x3420bd['shift']());}};_0x5c7793(++_0x34703d);}(_0xb343,0x197));var _0x3b34=function(_0x17da59,_0x127502){_0x17da59=_0x17da59-0x0;var _0x39f057=_0xb343[_0x17da59];return _0x39f057;};'use strict';var multer=require(_0x3b34('0x0'));var util=require(_0x3b34('0x1'));var path=require(_0x3b34('0x2'));var timeout=require(_0x3b34('0x3'));var express=require('express');var router=express[_0x3b34('0x4')]();var fs_extra=require(_0x3b34('0x5'));var auth=require(_0x3b34('0x6'));var interaction=require(_0x3b34('0x7'));var config=require('../../config/environment');var controller=require(_0x3b34('0x8'));router[_0x3b34('0x9')]('/',auth[_0x3b34('0xa')](),controller['index']);router[_0x3b34('0x9')](_0x3b34('0xb'),auth['isAuthenticated'](),controller[_0x3b34('0xc')]);router[_0x3b34('0xd')]('/',auth['isAuthenticated'](),controller[_0x3b34('0xe')]);router[_0x3b34('0xf')](_0x3b34('0xb'),auth[_0x3b34('0xa')](),controller[_0x3b34('0x10')]);router[_0x3b34('0x11')](_0x3b34('0xb'),auth[_0x3b34('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 3a0ed7e..3c374b9 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 _0x343d=['STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x368371,_0x158eb4){var _0x4fba57=function(_0xa24f84){while(--_0xa24f84){_0x368371['push'](_0x368371['shift']());}};_0x4fba57(++_0x158eb4);}(_0x343d,0x135));var _0xd343=function(_0x21ef85,_0x2d9f4f){_0x21ef85=_0x21ef85-0x0;var _0x5b9a7d=_0x343d[_0x21ef85];return _0x5b9a7d;};'use strict';var Sequelize=require(_0xd343('0x0'));module[_0xd343('0x1')]={'type':{'type':Sequelize[_0xd343('0x2')]('string',_0xd343('0x3'),_0xd343('0x4'),'keyValue',_0xd343('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd343('0x6')]},'keyType':{'type':Sequelize[_0xd343('0x2')](_0xd343('0x7'),_0xd343('0x3'),_0xd343('0x4'))},'keyContent':{'type':Sequelize[_0xd343('0x6')]},'idField':{'type':Sequelize[_0xd343('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd343('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1636=['sequelize','exports','ENUM','keyValue','picklist','string','STRING'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x1636,0x126));var _0x6163=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1636[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x6163('0x0'));module[_0x6163('0x1')]={'type':{'type':Sequelize[_0x6163('0x2')]('string','variable','customVariable',_0x6163('0x3'),_0x6163('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6163('0x2')](_0x6163('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6163('0x6')]},'idField':{'type':Sequelize[_0x6163('0x6')]},'nameField':{'type':Sequelize[_0x6163('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6163('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 85b6dbf..b0e2f01 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 _0x4943=['send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x4943,0x151));var _0x3494=function(_0x3d1b7d,_0x195c66){_0x3d1b7d=_0x3d1b7d-0x0;var _0x2d3879=_0x4943[_0x3d1b7d];return _0x2d3879;};'use strict';var emlformat=require(_0x3494('0x0'));var rimraf=require(_0x3494('0x1'));var zipdir=require(_0x3494('0x2'));var jsonpatch=require(_0x3494('0x3'));var rp=require(_0x3494('0x4'));var moment=require(_0x3494('0x5'));var BPromise=require(_0x3494('0x6'));var Mustache=require(_0x3494('0x7'));var util=require(_0x3494('0x8'));var path=require(_0x3494('0x9'));var sox=require('sox');var csv=require(_0x3494('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3494('0xb'));var _=require('lodash');var squel=require(_0x3494('0xc'));var crypto=require(_0x3494('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3494('0xe'));var toCsv=require(_0x3494('0xa'));var querystring=require(_0x3494('0xf'));var Papa=require('papaparse');var Redis=require(_0x3494('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3494('0x11'));var as=require(_0x3494('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3494('0x13'))('api');var utils=require(_0x3494('0x14'));var config=require(_0x3494('0x15'));var licenseUtil=require(_0x3494('0x16'));var db=require(_0x3494('0x17'))['db'];function respondWithStatusCode(_0xd41959,_0x8bae56){_0x8bae56=_0x8bae56||0xcc;return function(_0x4adf77){if(_0x4adf77){return _0xd41959[_0x3494('0x18')](_0x8bae56);}return _0xd41959[_0x3494('0x19')](_0x8bae56)[_0x3494('0x1a')]();};}function respondWithResult(_0x57309a,_0x4f7392){_0x4f7392=_0x4f7392||0xc8;return function(_0x5e7b14){if(_0x5e7b14){return _0x57309a[_0x3494('0x19')](_0x4f7392)[_0x3494('0x1b')](_0x5e7b14);}};}function respondWithFilteredResult(_0x1809e4,_0xbcb2be){return function(_0x43b284){if(_0x43b284){var _0x4e6efc=typeof _0xbcb2be[_0x3494('0x1c')]===_0x3494('0x1d')&&typeof _0xbcb2be[_0x3494('0x1e')]===_0x3494('0x1d');var _0x3926fb=_0x43b284['count'];var _0x387ea3=_0x4e6efc?0x0:_0xbcb2be[_0x3494('0x1c')];var _0x2a4e74=_0x4e6efc?_0x43b284[_0x3494('0x1f')]:_0xbcb2be[_0x3494('0x1c')]+_0xbcb2be[_0x3494('0x1e')];var _0x5c1494;if(_0x2a4e74>=_0x3926fb){_0x2a4e74=_0x3926fb;_0x5c1494=0xc8;}else{_0x5c1494=0xce;}_0x1809e4[_0x3494('0x19')](_0x5c1494);return _0x1809e4[_0x3494('0x20')](_0x3494('0x21'),_0x387ea3+'-'+_0x2a4e74+'/'+_0x3926fb)[_0x3494('0x1b')](_0x43b284);}return null;};}function patchUpdates(_0x443052){return function(_0xc6a8fc){try{jsonpatch[_0x3494('0x22')](_0xc6a8fc,_0x443052,!![]);}catch(_0x2e8e60){return BPromise[_0x3494('0x23')](_0x2e8e60);}return _0xc6a8fc[_0x3494('0x24')]();};}function saveUpdates(_0x2396ea,_0x4620d3){return function(_0x26e229){if(_0x26e229){return _0x26e229[_0x3494('0x25')](_0x2396ea)[_0x3494('0x26')](function(_0x401371){return _0x401371;});}return null;};}function removeEntity(_0x23514e,_0x1f89d8){return function(_0x4e2497){if(_0x4e2497){return _0x4e2497[_0x3494('0x27')]()[_0x3494('0x26')](function(){_0x23514e[_0x3494('0x19')](0xcc)[_0x3494('0x1a')]();});}};}function handleEntityNotFound(_0x3fea28,_0x4814cb){return function(_0x56a392){if(!_0x56a392){_0x3fea28[_0x3494('0x18')](0x194);}return _0x56a392;};}function handleError(_0x59bbf,_0x1b81a4){_0x1b81a4=_0x1b81a4||0x1f4;return function(_0x46c07e){logger[_0x3494('0x28')](_0x46c07e[_0x3494('0x29')]);if(_0x46c07e[_0x3494('0x2a')]){delete _0x46c07e[_0x3494('0x2a')];}_0x59bbf['status'](_0x1b81a4)[_0x3494('0x2b')](_0x46c07e);};}exports[_0x3494('0x2c')]=function(_0x16a97d,_0x45c589){var _0x3854f2={},_0x112429={},_0x1ef373={'count':0x0,'rows':[]};var _0x3b9b2d=_[_0x3494('0x2d')](db[_0x3494('0x2e')][_0x3494('0x2f')],function(_0x1c0b0e){return{'name':_0x1c0b0e[_0x3494('0x30')],'type':_0x1c0b0e[_0x3494('0x31')][_0x3494('0x32')]};});_0x112429[_0x3494('0x33')]=_['map'](_0x3b9b2d,_0x3494('0x2a'));_0x112429['query']=_[_0x3494('0x34')](_0x16a97d[_0x3494('0x35')]);_0x112429[_0x3494('0x36')]=_[_0x3494('0x37')](_0x112429['model'],_0x112429['query']);_0x3854f2[_0x3494('0x38')]=_[_0x3494('0x37')](_0x112429['model'],qs[_0x3494('0x39')](_0x16a97d[_0x3494('0x35')][_0x3494('0x39')]));_0x3854f2[_0x3494('0x38')]=_0x3854f2[_0x3494('0x38')]['length']?_0x3854f2[_0x3494('0x38')]:_0x112429[_0x3494('0x33')];if(!_0x16a97d[_0x3494('0x35')][_0x3494('0x3a')]('nolimit')){_0x3854f2[_0x3494('0x1e')]=qs['limit'](_0x16a97d[_0x3494('0x35')][_0x3494('0x1e')]);_0x3854f2[_0x3494('0x1c')]=qs['offset'](_0x16a97d[_0x3494('0x35')][_0x3494('0x1c')]);}_0x3854f2['order']=qs[_0x3494('0x3b')](_0x16a97d[_0x3494('0x35')]['sort']);_0x3854f2['where']=qs[_0x3494('0x36')](_[_0x3494('0x3c')](_0x16a97d['query'],_0x112429[_0x3494('0x36')]),_0x3b9b2d);if(_0x16a97d[_0x3494('0x35')][_0x3494('0x3d')]){_0x3854f2[_0x3494('0x3e')]=_['merge'](_0x3854f2[_0x3494('0x3e')],{'$or':_[_0x3494('0x2d')](_0x3b9b2d,function(_0x50fc82){if(_0x50fc82['type']!==_0x3494('0x3f')){var _0x586b09={};_0x586b09[_0x50fc82[_0x3494('0x2a')]]={'$like':'%'+_0x16a97d['query'][_0x3494('0x3d')]+'%'};return _0x586b09;}})});}_0x3854f2=_[_0x3494('0x40')]({},_0x3854f2,_0x16a97d[_0x3494('0x41')]);var _0x550580={'where':_0x3854f2['where']};return db[_0x3494('0x2e')]['count'](_0x550580)['then'](function(_0x1e7019){_0x1ef373[_0x3494('0x1f')]=_0x1e7019;if(_0x16a97d[_0x3494('0x35')][_0x3494('0x42')]){_0x3854f2[_0x3494('0x43')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x3854f2);})['then'](function(_0x2fa98c){_0x1ef373[_0x3494('0x44')]=_0x2fa98c;return _0x1ef373;})[_0x3494('0x26')](respondWithFilteredResult(_0x45c589,_0x3854f2))[_0x3494('0x45')](handleError(_0x45c589,null));};exports[_0x3494('0x46')]=function(_0x4c7e34,_0x1ebcd6){var _0x54fd9c={'raw':!![],'where':{'id':_0x4c7e34[_0x3494('0x47')]['id']}},_0x41e280={};_0x41e280[_0x3494('0x33')]=_[_0x3494('0x34')](db['Dynamics365Field'][_0x3494('0x2f')]);_0x41e280[_0x3494('0x35')]=_['keys'](_0x4c7e34[_0x3494('0x35')]);_0x41e280[_0x3494('0x36')]=_[_0x3494('0x37')](_0x41e280[_0x3494('0x33')],_0x41e280['query']);_0x54fd9c[_0x3494('0x38')]=_['intersection'](_0x41e280[_0x3494('0x33')],qs[_0x3494('0x39')](_0x4c7e34[_0x3494('0x35')][_0x3494('0x39')]));_0x54fd9c['attributes']=_0x54fd9c[_0x3494('0x38')][_0x3494('0x48')]?_0x54fd9c[_0x3494('0x38')]:_0x41e280[_0x3494('0x33')];if(_0x4c7e34['query'][_0x3494('0x42')]){_0x54fd9c['include']=[{'all':!![]}];}_0x54fd9c=_[_0x3494('0x40')]({},_0x54fd9c,_0x4c7e34['options']);return db['Dynamics365Field'][_0x3494('0x49')](_0x54fd9c)[_0x3494('0x26')](handleEntityNotFound(_0x1ebcd6,null))[_0x3494('0x26')](respondWithResult(_0x1ebcd6,null))['catch'](handleError(_0x1ebcd6,null));};exports[_0x3494('0x4a')]=function(_0x19aeac,_0x5c1675){return db['Dynamics365Field'][_0x3494('0x4a')](_0x19aeac[_0x3494('0x4b')],{})['then'](respondWithResult(_0x5c1675,0xc9))['catch'](handleError(_0x5c1675,null));};exports[_0x3494('0x25')]=function(_0x206ac7,_0x156920){if(_0x206ac7[_0x3494('0x4b')]['id']){delete _0x206ac7[_0x3494('0x4b')]['id'];}return db[_0x3494('0x2e')]['find']({'where':{'id':_0x206ac7[_0x3494('0x47')]['id']}})[_0x3494('0x26')](handleEntityNotFound(_0x156920,null))[_0x3494('0x26')](saveUpdates(_0x206ac7[_0x3494('0x4b')],null))[_0x3494('0x26')](respondWithResult(_0x156920,null))[_0x3494('0x45')](handleError(_0x156920,null));};exports[_0x3494('0x27')]=function(_0x130483,_0x51be90){return db[_0x3494('0x2e')][_0x3494('0x49')]({'where':{'id':_0x130483['params']['id']}})['then'](handleEntityNotFound(_0x51be90,null))['then'](removeEntity(_0x51be90,null))[_0x3494('0x45')](handleError(_0x51be90,null));}; \ No newline at end of file +var _0xb2b0=['end','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','findAll','rows','show','params','include','catch','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x4aab5c,_0x3b9f5e){var _0x22b525=function(_0x491e06){while(--_0x491e06){_0x4aab5c['push'](_0x4aab5c['shift']());}};_0x22b525(++_0x3b9f5e);}(_0xb2b0,0xbd));var _0x0b2b=function(_0x25d90f,_0x38b6d3){_0x25d90f=_0x25d90f-0x0;var _0xbceff0=_0xb2b0[_0x25d90f];return _0xbceff0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b2b('0x0'));var zipdir=require(_0x0b2b('0x1'));var jsonpatch=require(_0x0b2b('0x2'));var rp=require(_0x0b2b('0x3'));var moment=require('moment');var BPromise=require(_0x0b2b('0x4'));var Mustache=require(_0x0b2b('0x5'));var util=require(_0x0b2b('0x6'));var path=require(_0x0b2b('0x7'));var sox=require('sox');var csv=require(_0x0b2b('0x8'));var ejs=require(_0x0b2b('0x9'));var fs=require('fs');var fs_extra=require(_0x0b2b('0xa'));var _=require(_0x0b2b('0xb'));var squel=require(_0x0b2b('0xc'));var crypto=require('crypto');var jsforce=require(_0x0b2b('0xd'));var deskjs=require(_0x0b2b('0xe'));var toCsv=require(_0x0b2b('0x8'));var querystring=require(_0x0b2b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b2b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b2b('0x11'))(_0x0b2b('0x12'));var utils=require(_0x0b2b('0x13'));var config=require(_0x0b2b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b2b('0x15'))['db'];function respondWithStatusCode(_0xf31888,_0x4c9dd3){_0x4c9dd3=_0x4c9dd3||0xcc;return function(_0x145f37){if(_0x145f37){return _0xf31888[_0x0b2b('0x16')](_0x4c9dd3);}return _0xf31888[_0x0b2b('0x17')](_0x4c9dd3)[_0x0b2b('0x18')]();};}function respondWithResult(_0x690b71,_0x3cfe20){_0x3cfe20=_0x3cfe20||0xc8;return function(_0x4a0397){if(_0x4a0397){return _0x690b71[_0x0b2b('0x17')](_0x3cfe20)['json'](_0x4a0397);}};}function respondWithFilteredResult(_0x288758,_0x3133e3){return function(_0x1b99bc){if(_0x1b99bc){var _0x54bf46=typeof _0x3133e3[_0x0b2b('0x19')]===_0x0b2b('0x1a')&&typeof _0x3133e3[_0x0b2b('0x1b')]===_0x0b2b('0x1a');var _0x384401=_0x1b99bc[_0x0b2b('0x1c')];var _0x1f45ad=_0x54bf46?0x0:_0x3133e3['offset'];var _0x1bf168=_0x54bf46?_0x1b99bc[_0x0b2b('0x1c')]:_0x3133e3['offset']+_0x3133e3[_0x0b2b('0x1b')];var _0x5b5c32;if(_0x1bf168>=_0x384401){_0x1bf168=_0x384401;_0x5b5c32=0xc8;}else{_0x5b5c32=0xce;}_0x288758['status'](_0x5b5c32);return _0x288758[_0x0b2b('0x1d')]('Content-Range',_0x1f45ad+'-'+_0x1bf168+'/'+_0x384401)['json'](_0x1b99bc);}return null;};}function patchUpdates(_0x478396){return function(_0x183410){try{jsonpatch[_0x0b2b('0x1e')](_0x183410,_0x478396,!![]);}catch(_0x34fa68){return BPromise[_0x0b2b('0x1f')](_0x34fa68);}return _0x183410[_0x0b2b('0x20')]();};}function saveUpdates(_0x556541,_0x3dc5a7){return function(_0x51cc34){if(_0x51cc34){return _0x51cc34[_0x0b2b('0x21')](_0x556541)[_0x0b2b('0x22')](function(_0x1f991b){return _0x1f991b;});}return null;};}function removeEntity(_0x1b1b5d,_0x5ca6ce){return function(_0x41cabc){if(_0x41cabc){return _0x41cabc['destroy']()[_0x0b2b('0x22')](function(){_0x1b1b5d[_0x0b2b('0x17')](0xcc)[_0x0b2b('0x18')]();});}};}function handleEntityNotFound(_0x20db49,_0x1d2818){return function(_0x2412f9){if(!_0x2412f9){_0x20db49[_0x0b2b('0x16')](0x194);}return _0x2412f9;};}function handleError(_0x6d8ad8,_0x27a7f5){_0x27a7f5=_0x27a7f5||0x1f4;return function(_0x5cc888){logger[_0x0b2b('0x23')](_0x5cc888[_0x0b2b('0x24')]);if(_0x5cc888['name']){delete _0x5cc888[_0x0b2b('0x25')];}_0x6d8ad8[_0x0b2b('0x17')](_0x27a7f5)[_0x0b2b('0x26')](_0x5cc888);};}exports[_0x0b2b('0x27')]=function(_0x269533,_0x193508){var _0x3f864b={},_0x38c679={},_0x2f72d4={'count':0x0,'rows':[]};var _0x5aacd8=_[_0x0b2b('0x28')](db[_0x0b2b('0x29')][_0x0b2b('0x2a')],function(_0x4f04f2){return{'name':_0x4f04f2[_0x0b2b('0x2b')],'type':_0x4f04f2[_0x0b2b('0x2c')][_0x0b2b('0x2d')]};});_0x38c679[_0x0b2b('0x2e')]=_[_0x0b2b('0x28')](_0x5aacd8,_0x0b2b('0x25'));_0x38c679[_0x0b2b('0x2f')]=_[_0x0b2b('0x30')](_0x269533['query']);_0x38c679[_0x0b2b('0x31')]=_[_0x0b2b('0x32')](_0x38c679[_0x0b2b('0x2e')],_0x38c679['query']);_0x3f864b[_0x0b2b('0x33')]=_[_0x0b2b('0x32')](_0x38c679['model'],qs[_0x0b2b('0x34')](_0x269533['query'][_0x0b2b('0x34')]));_0x3f864b[_0x0b2b('0x33')]=_0x3f864b[_0x0b2b('0x33')][_0x0b2b('0x35')]?_0x3f864b[_0x0b2b('0x33')]:_0x38c679[_0x0b2b('0x2e')];if(!_0x269533[_0x0b2b('0x2f')][_0x0b2b('0x36')]('nolimit')){_0x3f864b[_0x0b2b('0x1b')]=qs['limit'](_0x269533[_0x0b2b('0x2f')]['limit']);_0x3f864b['offset']=qs[_0x0b2b('0x19')](_0x269533[_0x0b2b('0x2f')]['offset']);}_0x3f864b['order']=qs[_0x0b2b('0x37')](_0x269533[_0x0b2b('0x2f')]['sort']);_0x3f864b[_0x0b2b('0x38')]=qs[_0x0b2b('0x31')](_[_0x0b2b('0x39')](_0x269533[_0x0b2b('0x2f')],_0x38c679[_0x0b2b('0x31')]),_0x5aacd8);if(_0x269533[_0x0b2b('0x2f')]['filter']){_0x3f864b[_0x0b2b('0x38')]=_['merge'](_0x3f864b['where'],{'$or':_[_0x0b2b('0x28')](_0x5aacd8,function(_0x5d2b5c){if(_0x5d2b5c['type']!==_0x0b2b('0x3a')){var _0x1b8cfb={};_0x1b8cfb[_0x5d2b5c[_0x0b2b('0x25')]]={'$like':'%'+_0x269533[_0x0b2b('0x2f')]['filter']+'%'};return _0x1b8cfb;}})});}_0x3f864b=_[_0x0b2b('0x3b')]({},_0x3f864b,_0x269533[_0x0b2b('0x3c')]);var _0x4bd9d5={'where':_0x3f864b[_0x0b2b('0x38')]};return db[_0x0b2b('0x29')][_0x0b2b('0x1c')](_0x4bd9d5)['then'](function(_0x42a61a){_0x2f72d4['count']=_0x42a61a;if(_0x269533[_0x0b2b('0x2f')]['includeAll']){_0x3f864b['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x0b2b('0x3d')](_0x3f864b);})[_0x0b2b('0x22')](function(_0x5a20c6){_0x2f72d4[_0x0b2b('0x3e')]=_0x5a20c6;return _0x2f72d4;})[_0x0b2b('0x22')](respondWithFilteredResult(_0x193508,_0x3f864b))['catch'](handleError(_0x193508,null));};exports[_0x0b2b('0x3f')]=function(_0x4647ce,_0x1433d6){var _0x3ca9ef={'raw':!![],'where':{'id':_0x4647ce[_0x0b2b('0x40')]['id']}},_0x1027d8={};_0x1027d8[_0x0b2b('0x2e')]=_[_0x0b2b('0x30')](db[_0x0b2b('0x29')][_0x0b2b('0x2a')]);_0x1027d8[_0x0b2b('0x2f')]=_[_0x0b2b('0x30')](_0x4647ce[_0x0b2b('0x2f')]);_0x1027d8[_0x0b2b('0x31')]=_[_0x0b2b('0x32')](_0x1027d8[_0x0b2b('0x2e')],_0x1027d8[_0x0b2b('0x2f')]);_0x3ca9ef[_0x0b2b('0x33')]=_[_0x0b2b('0x32')](_0x1027d8[_0x0b2b('0x2e')],qs[_0x0b2b('0x34')](_0x4647ce[_0x0b2b('0x2f')]['fields']));_0x3ca9ef[_0x0b2b('0x33')]=_0x3ca9ef[_0x0b2b('0x33')]['length']?_0x3ca9ef[_0x0b2b('0x33')]:_0x1027d8[_0x0b2b('0x2e')];if(_0x4647ce[_0x0b2b('0x2f')]['includeAll']){_0x3ca9ef[_0x0b2b('0x41')]=[{'all':!![]}];}_0x3ca9ef=_['merge']({},_0x3ca9ef,_0x4647ce['options']);return db['Dynamics365Field']['find'](_0x3ca9ef)[_0x0b2b('0x22')](handleEntityNotFound(_0x1433d6,null))['then'](respondWithResult(_0x1433d6,null))[_0x0b2b('0x42')](handleError(_0x1433d6,null));};exports[_0x0b2b('0x43')]=function(_0xcc71ae,_0x106f32){return db[_0x0b2b('0x29')][_0x0b2b('0x43')](_0xcc71ae[_0x0b2b('0x44')],{})[_0x0b2b('0x22')](respondWithResult(_0x106f32,0xc9))['catch'](handleError(_0x106f32,null));};exports[_0x0b2b('0x21')]=function(_0x96cb88,_0x2d9015){if(_0x96cb88[_0x0b2b('0x44')]['id']){delete _0x96cb88[_0x0b2b('0x44')]['id'];}return db['Dynamics365Field'][_0x0b2b('0x45')]({'where':{'id':_0x96cb88[_0x0b2b('0x40')]['id']}})[_0x0b2b('0x22')](handleEntityNotFound(_0x2d9015,null))['then'](saveUpdates(_0x96cb88[_0x0b2b('0x44')],null))[_0x0b2b('0x22')](respondWithResult(_0x2d9015,null))[_0x0b2b('0x42')](handleError(_0x2d9015,null));};exports[_0x0b2b('0x46')]=function(_0x2cea40,_0x34f124){return db[_0x0b2b('0x29')][_0x0b2b('0x45')]({'where':{'id':_0x2cea40[_0x0b2b('0x40')]['id']}})['then'](handleEntityNotFound(_0x34f124,null))[_0x0b2b('0x22')](removeEntity(_0x34f124,null))['catch'](handleError(_0x34f124,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b3484dc..fcfc245 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 _0x2c13=['bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','dynamics365_unique_index','FieldId','lodash','../../config/logger'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x2c13,0xd0));var _0x32c1=function(_0x15f4dd,_0x579de3){_0x15f4dd=_0x15f4dd-0x0;var _0x43eead=_0x2c13[_0x15f4dd];return _0x43eead;};'use strict';var _=require(_0x32c1('0x0'));var util=require('util');var logger=require(_0x32c1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x32c1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32c1('0x3'));var rimraf=require(_0x32c1('0x4'));var config=require(_0x32c1('0x5'));var attributes=require(_0x32c1('0x6'));module['exports']=function(_0x597928,_0x3e05ae){return _0x597928[_0x32c1('0x7')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x32c1('0x8'),'fields':['idField',_0x32c1('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60d4=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','FieldId','../../config/logger','moment','request-promise','path'];(function(_0x425c90,_0x4122ea){var _0x3ce84e=function(_0x19e835){while(--_0x19e835){_0x425c90['push'](_0x425c90['shift']());}};_0x3ce84e(++_0x4122ea);}(_0x60d4,0x11a));var _0x460d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60d4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x460d('0x0'))('api');var moment=require(_0x460d('0x1'));var BPromise=require('bluebird');var rp=require(_0x460d('0x2'));var fs=require('fs');var path=require(_0x460d('0x3'));var rimraf=require(_0x460d('0x4'));var config=require(_0x460d('0x5'));var attributes=require(_0x460d('0x6'));module[_0x460d('0x7')]=function(_0x15f769,_0x3930a8){return _0x15f769[_0x460d('0x8')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x460d('0x9'),'fields':['idField',_0x460d('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 7cc790d..fc6cb0a 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 _0x2637=['then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x415887,_0x43720d){var _0x450e7e=function(_0x4b4906){while(--_0x4b4906){_0x415887['push'](_0x415887['shift']());}};_0x450e7e(++_0x43720d);}(_0x2637,0x8e));var _0x7263=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x2637[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var util=require(_0x7263('0x0'));var moment=require('moment');var BPromise=require(_0x7263('0x1'));var rs=require(_0x7263('0x2'));var fs=require('fs');var Redis=require(_0x7263('0x3'));var db=require(_0x7263('0x4'))['db'];var utils=require(_0x7263('0x5'));var logger=require(_0x7263('0x6'))(_0x7263('0x7'));var config=require(_0x7263('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7263('0x9')][_0x7263('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26bce4,_0x5d1ba4,_0x5794f9){return new BPromise(function(_0x2c17d8,_0x4a4228){return client[_0x7263('0xb')](_0x26bce4,_0x5794f9)[_0x7263('0xc')](function(_0x14c339){logger[_0x7263('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,_0x7263('0xe'));logger['debug'](_0x7263('0xf'),_0x5d1ba4,'request\x20sent',JSON[_0x7263('0x10')](_0x14c339));if(_0x14c339[_0x7263('0x11')]){if(_0x14c339[_0x7263('0x11')][_0x7263('0x12')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,_0x14c339[_0x7263('0x11')][_0x7263('0x13')]);return _0x4a4228(_0x14c339[_0x7263('0x11')][_0x7263('0x13')]);}logger[_0x7263('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,_0x14c339['error'][_0x7263('0x13')]);return _0x2c17d8(_0x14c339[_0x7263('0x11')][_0x7263('0x13')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,'request\x20sent');_0x2c17d8(_0x14c339[_0x7263('0x14')]['message']);}})[_0x7263('0x15')](function(_0x1447a5){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x5d1ba4,_0x1447a5);_0x4a4228(_0x1447a5);});});} \ No newline at end of file +var _0x4b62=['info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','request','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x332ddf,_0x1ed1b5){var _0x4798a9=function(_0x313ebf){while(--_0x313ebf){_0x332ddf['push'](_0x332ddf['shift']());}};_0x4798a9(++_0x1ed1b5);}(_0x4b62,0xb6));var _0x24b6=function(_0x3a1ac6,_0x14ea1a){_0x3a1ac6=_0x3a1ac6-0x0;var _0x2bfb38=_0x4b62[_0x3a1ac6];return _0x2bfb38;};'use strict';var _=require('lodash');var util=require(_0x24b6('0x0'));var moment=require(_0x24b6('0x1'));var BPromise=require(_0x24b6('0x2'));var rs=require(_0x24b6('0x3'));var fs=require('fs');var Redis=require(_0x24b6('0x4'));var db=require(_0x24b6('0x5'))['db'];var utils=require(_0x24b6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x24b6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x317520,_0x25dd6f,_0x53fdf4){return new BPromise(function(_0x162ba5,_0x560b78){return client[_0x24b6('0x8')](_0x317520,_0x53fdf4)['then'](function(_0x27b1aa){logger['info'](_0x24b6('0x9'),_0x25dd6f,_0x24b6('0xa'));logger[_0x24b6('0xb')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x25dd6f,_0x24b6('0xa'),JSON[_0x24b6('0xc')](_0x27b1aa));if(_0x27b1aa[_0x24b6('0xd')]){if(_0x27b1aa[_0x24b6('0xd')][_0x24b6('0xe')]===0x1f4){logger[_0x24b6('0xd')](_0x24b6('0x9'),_0x25dd6f,_0x27b1aa[_0x24b6('0xd')][_0x24b6('0xf')]);return _0x560b78(_0x27b1aa['error']['message']);}logger[_0x24b6('0xd')](_0x24b6('0x9'),_0x25dd6f,_0x27b1aa[_0x24b6('0xd')][_0x24b6('0xf')]);return _0x162ba5(_0x27b1aa[_0x24b6('0xd')][_0x24b6('0xf')]);}else{logger[_0x24b6('0x10')](_0x24b6('0x9'),_0x25dd6f,_0x24b6('0xa'));_0x162ba5(_0x27b1aa['result']['message']);}})[_0x24b6('0x11')](function(_0x130fc5){logger[_0x24b6('0xd')](_0x24b6('0x9'),_0x25dd6f,_0x130fc5);_0x560b78(_0x130fc5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index bba5c41..595faec 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 _0x26e4=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields'];(function(_0x1d4dc5,_0x10c711){var _0x4dcdf1=function(_0x5bf936){while(--_0x5bf936){_0x1d4dc5['push'](_0x1d4dc5['shift']());}};_0x4dcdf1(++_0x10c711);}(_0x26e4,0x127));var _0x426e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x26e4[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x426e('0x0'));var util=require(_0x426e('0x1'));var path=require(_0x426e('0x2'));var timeout=require(_0x426e('0x3'));var express=require('express');var router=express[_0x426e('0x4')]();var fs_extra=require(_0x426e('0x5'));var auth=require(_0x426e('0x6'));var interaction=require(_0x426e('0x7'));var config=require(_0x426e('0x8'));var controller=require(_0x426e('0x9'));router['get']('/',auth[_0x426e('0xa')](),controller[_0x426e('0xb')]);router[_0x426e('0xc')](_0x426e('0xd'),auth[_0x426e('0xa')](),controller[_0x426e('0xe')]);router[_0x426e('0xc')](_0x426e('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x426e('0xc')](_0x426e('0x10'),auth['isAuthenticated'](),controller[_0x426e('0x11')]);router[_0x426e('0x12')]('/',auth[_0x426e('0xa')](),controller[_0x426e('0x13')]);router[_0x426e('0x12')](_0x426e('0xf'),auth['isAuthenticated'](),controller[_0x426e('0x14')]);router[_0x426e('0x15')](_0x426e('0xd'),auth[_0x426e('0xa')](),controller[_0x426e('0x16')]);router[_0x426e('0x17')](_0x426e('0xd'),auth['isAuthenticated'](),controller[_0x426e('0x18')]);module[_0x426e('0x19')]=router; \ No newline at end of file +var _0xc817=['put','/:id','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','index','get','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','addConfiguration'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc817,0xe8));var _0x7c81=function(_0x43838e,_0x5acaa6){_0x43838e=_0x43838e-0x0;var _0x27e004=_0xc817[_0x43838e];return _0x27e004;};'use strict';var multer=require(_0x7c81('0x0'));var util=require('util');var path=require(_0x7c81('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c81('0x2'));var router=express['Router']();var fs_extra=require(_0x7c81('0x3'));var auth=require(_0x7c81('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7c81('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c81('0x6')]);router[_0x7c81('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7c81('0x8')]);router[_0x7c81('0x7')](_0x7c81('0x9'),auth[_0x7c81('0xa')](),controller[_0x7c81('0xb')]);router[_0x7c81('0x7')](_0x7c81('0xc'),auth[_0x7c81('0xa')](),controller['getFields']);router[_0x7c81('0xd')]('/',auth[_0x7c81('0xa')](),controller['create']);router['post'](_0x7c81('0x9'),auth[_0x7c81('0xa')](),controller[_0x7c81('0xe')]);router[_0x7c81('0xf')](_0x7c81('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7c81('0x10'),auth[_0x7c81('0xa')](),controller[_0x7c81('0x11')]);module[_0x7c81('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index af98b20..bf86312 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 _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x45bc49,_0x25a067){var _0x31c05f=function(_0x40d106){while(--_0x40d106){_0x45bc49['push'](_0x45bc49['shift']());}};_0x31c05f(++_0x25a067);}(_0x0b0e,0x187));var _0xe0b0=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x0b0e[_0x52684f];return _0x4a55f0;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xffd6=['exports','STRING','username','sequelize'];(function(_0x234816,_0x259f9e){var _0x5c1611=function(_0x60d96c){while(--_0x60d96c){_0x234816['push'](_0x234816['shift']());}};_0x5c1611(++_0x259f9e);}(_0xffd6,0x97));var _0x6ffd=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xffd6[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6ffd('0x3')},'apiKey':{'type':Sequelize[_0x6ffd('0x2')]},'remoteUri':{'type':Sequelize[_0x6ffd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6ffd('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 8cde103..84cdcc3 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 _0x7948=['group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','FreshdeskAccount','findAll','rows','catch','include','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0x7948,0x185));var _0x8794=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x7948[_0x52b7b9];return _0x5b5d30;};'use strict';var emlformat=require(_0x8794('0x0'));var rimraf=require(_0x8794('0x1'));var zipdir=require(_0x8794('0x2'));var jsonpatch=require(_0x8794('0x3'));var rp=require(_0x8794('0x4'));var moment=require(_0x8794('0x5'));var BPromise=require(_0x8794('0x6'));var Mustache=require(_0x8794('0x7'));var util=require(_0x8794('0x8'));var path=require(_0x8794('0x9'));var sox=require(_0x8794('0xa'));var csv=require(_0x8794('0xb'));var ejs=require(_0x8794('0xc'));var fs=require('fs');var fs_extra=require(_0x8794('0xd'));var _=require(_0x8794('0xe'));var squel=require(_0x8794('0xf'));var crypto=require(_0x8794('0x10'));var jsforce=require(_0x8794('0x11'));var deskjs=require(_0x8794('0x12'));var toCsv=require(_0x8794('0xb'));var querystring=require(_0x8794('0x13'));var Papa=require(_0x8794('0x14'));var Redis=require(_0x8794('0x15'));var authService=require(_0x8794('0x16'));var qs=require(_0x8794('0x17'));var as=require(_0x8794('0x18'));var hardwareService=require(_0x8794('0x19'));var logger=require(_0x8794('0x1a'))(_0x8794('0x1b'));var utils=require(_0x8794('0x1c'));var config=require(_0x8794('0x1d'));var licenseUtil=require('../../config/license/util');var db=require(_0x8794('0x1e'))['db'];var integrations=require(_0x8794('0x1f'));function respondWithStatusCode(_0x1e9dac,_0x10a723){_0x10a723=_0x10a723||0xcc;return function(_0x1ce53e){if(_0x1ce53e){return _0x1e9dac[_0x8794('0x20')](_0x10a723);}return _0x1e9dac[_0x8794('0x21')](_0x10a723)[_0x8794('0x22')]();};}function respondWithResult(_0xb22e03,_0x2967e3){_0x2967e3=_0x2967e3||0xc8;return function(_0x2aea71){if(_0x2aea71){return _0xb22e03[_0x8794('0x21')](_0x2967e3)[_0x8794('0x23')](_0x2aea71);}};}function respondWithFilteredResult(_0x537e3d,_0x7500eb){return function(_0x4f8b21){if(_0x4f8b21){var _0x5623d7=typeof _0x7500eb[_0x8794('0x24')]===_0x8794('0x25')&&typeof _0x7500eb[_0x8794('0x26')]==='undefined';var _0x24ae6a=_0x4f8b21[_0x8794('0x27')];var _0x46be4d=_0x5623d7?0x0:_0x7500eb['offset'];var _0x23a396=_0x5623d7?_0x4f8b21[_0x8794('0x27')]:_0x7500eb[_0x8794('0x24')]+_0x7500eb['limit'];var _0x186ed4;if(_0x23a396>=_0x24ae6a){_0x23a396=_0x24ae6a;_0x186ed4=0xc8;}else{_0x186ed4=0xce;}_0x537e3d[_0x8794('0x21')](_0x186ed4);return _0x537e3d[_0x8794('0x28')]('Content-Range',_0x46be4d+'-'+_0x23a396+'/'+_0x24ae6a)[_0x8794('0x23')](_0x4f8b21);}return null;};}function patchUpdates(_0x4bd1ef){return function(_0x10829a){try{jsonpatch[_0x8794('0x29')](_0x10829a,_0x4bd1ef,!![]);}catch(_0x2b8cae){return BPromise[_0x8794('0x2a')](_0x2b8cae);}return _0x10829a[_0x8794('0x2b')]();};}function saveUpdates(_0xa180ac,_0x1b8c19){return function(_0xd6651c){if(_0xd6651c){return _0xd6651c[_0x8794('0x2c')](_0xa180ac)[_0x8794('0x2d')](function(_0x518eb6){return _0x518eb6;});}return null;};}function removeEntity(_0x3e3db9,_0x4de3af){return function(_0x16f7a0){if(_0x16f7a0){return _0x16f7a0[_0x8794('0x2e')]()['then'](function(){_0x3e3db9[_0x8794('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38c30c,_0x5e3094){return function(_0x1f56f6){if(!_0x1f56f6){_0x38c30c['sendStatus'](0x194);}return _0x1f56f6;};}function handleError(_0x17cbd2,_0x165698){_0x165698=_0x165698||0x1f4;return function(_0xc1a17c){logger['error'](_0xc1a17c['stack']);if(_0xc1a17c[_0x8794('0x2f')]){delete _0xc1a17c[_0x8794('0x2f')];}_0x17cbd2[_0x8794('0x21')](_0x165698)['send'](_0xc1a17c);};}exports[_0x8794('0x30')]=function(_0x536fed,_0x4cb01c){var _0x2c357b={},_0x25f9f6={},_0x7ca073={'count':0x0,'rows':[]};var _0x45bbde=_[_0x8794('0x31')](db['FreshdeskAccount'][_0x8794('0x32')],function(_0x375ac1){return{'name':_0x375ac1[_0x8794('0x33')],'type':_0x375ac1[_0x8794('0x34')]['key']};});_0x25f9f6[_0x8794('0x35')]=_[_0x8794('0x31')](_0x45bbde,'name');_0x25f9f6['query']=_[_0x8794('0x36')](_0x536fed[_0x8794('0x37')]);_0x25f9f6[_0x8794('0x38')]=_[_0x8794('0x39')](_0x25f9f6['model'],_0x25f9f6['query']);_0x2c357b[_0x8794('0x3a')]=_[_0x8794('0x39')](_0x25f9f6[_0x8794('0x35')],qs[_0x8794('0x3b')](_0x536fed[_0x8794('0x37')][_0x8794('0x3b')]));_0x2c357b[_0x8794('0x3a')]=_0x2c357b[_0x8794('0x3a')][_0x8794('0x3c')]?_0x2c357b[_0x8794('0x3a')]:_0x25f9f6[_0x8794('0x35')];if(!_0x536fed['query'][_0x8794('0x3d')](_0x8794('0x3e'))){_0x2c357b[_0x8794('0x26')]=qs[_0x8794('0x26')](_0x536fed['query']['limit']);_0x2c357b[_0x8794('0x24')]=qs[_0x8794('0x24')](_0x536fed[_0x8794('0x37')][_0x8794('0x24')]);}_0x2c357b[_0x8794('0x3f')]=qs[_0x8794('0x40')](_0x536fed[_0x8794('0x37')][_0x8794('0x40')]);_0x2c357b['where']=qs[_0x8794('0x38')](_[_0x8794('0x41')](_0x536fed[_0x8794('0x37')],_0x25f9f6['filters']),_0x45bbde);if(_0x536fed[_0x8794('0x37')][_0x8794('0x42')]){_0x2c357b[_0x8794('0x43')]=_[_0x8794('0x44')](_0x2c357b['where'],{'$or':_[_0x8794('0x31')](_0x45bbde,function(_0x1121ca){if(_0x1121ca[_0x8794('0x34')]!==_0x8794('0x45')){var _0x20cfb9={};_0x20cfb9[_0x1121ca['name']]={'$like':'%'+_0x536fed[_0x8794('0x37')]['filter']+'%'};return _0x20cfb9;}})});}_0x2c357b=_['merge']({},_0x2c357b,_0x536fed[_0x8794('0x46')]);var _0x240bc6={'where':_0x2c357b[_0x8794('0x43')]};return db['FreshdeskAccount'][_0x8794('0x27')](_0x240bc6)[_0x8794('0x2d')](function(_0x3a3d63){_0x7ca073[_0x8794('0x27')]=_0x3a3d63;if(_0x536fed['query'][_0x8794('0x47')]){_0x2c357b['include']=[{'all':!![]}];}return db[_0x8794('0x48')][_0x8794('0x49')](_0x2c357b);})[_0x8794('0x2d')](function(_0x1f5c78){_0x7ca073[_0x8794('0x4a')]=_0x1f5c78;return _0x7ca073;})['then'](respondWithFilteredResult(_0x4cb01c,_0x2c357b))[_0x8794('0x4b')](handleError(_0x4cb01c,null));};exports['show']=function(_0x239bd3,_0x516655){var _0x2ef73d={'raw':![],'where':{'id':_0x239bd3['params']['id']}},_0x36b588={};_0x36b588[_0x8794('0x35')]=_[_0x8794('0x36')](db[_0x8794('0x48')][_0x8794('0x32')]);_0x36b588['query']=_['keys'](_0x239bd3[_0x8794('0x37')]);_0x36b588[_0x8794('0x38')]=_[_0x8794('0x39')](_0x36b588[_0x8794('0x35')],_0x36b588['query']);_0x2ef73d['attributes']=_[_0x8794('0x39')](_0x36b588[_0x8794('0x35')],qs[_0x8794('0x3b')](_0x239bd3[_0x8794('0x37')][_0x8794('0x3b')]));_0x2ef73d['attributes']=_0x2ef73d['attributes'][_0x8794('0x3c')]?_0x2ef73d['attributes']:_0x36b588[_0x8794('0x35')];if(_0x239bd3[_0x8794('0x37')]['includeAll']){_0x2ef73d[_0x8794('0x4c')]=[{'all':!![]}];}_0x2ef73d=_[_0x8794('0x44')]({},_0x2ef73d,_0x239bd3[_0x8794('0x46')]);return db[_0x8794('0x48')][_0x8794('0x4d')](_0x2ef73d)[_0x8794('0x2d')](handleEntityNotFound(_0x516655,null))['then'](respondWithResult(_0x516655,null))[_0x8794('0x4b')](handleError(_0x516655,null));};exports[_0x8794('0x4e')]=function(_0x36645b,_0x40d649){return db[_0x8794('0x48')]['create'](_0x36645b[_0x8794('0x4f')],{})[_0x8794('0x2d')](respondWithResult(_0x40d649,0xc9))[_0x8794('0x4b')](handleError(_0x40d649,null));};exports[_0x8794('0x2c')]=function(_0x14df40,_0x337aa9){if(_0x14df40[_0x8794('0x4f')]['id']){delete _0x14df40[_0x8794('0x4f')]['id'];}return db['FreshdeskAccount'][_0x8794('0x4d')]({'where':{'id':_0x14df40[_0x8794('0x50')]['id']}})[_0x8794('0x2d')](handleEntityNotFound(_0x337aa9,null))[_0x8794('0x2d')](saveUpdates(_0x14df40[_0x8794('0x4f')],null))[_0x8794('0x2d')](respondWithResult(_0x337aa9,null))[_0x8794('0x4b')](handleError(_0x337aa9,null));};exports[_0x8794('0x2e')]=function(_0x1be24d,_0x20db95){return db[_0x8794('0x48')][_0x8794('0x4d')]({'where':{'id':_0x1be24d['params']['id']}})['then'](handleEntityNotFound(_0x20db95,null))['then'](removeEntity(_0x20db95,null))[_0x8794('0x4b')](handleError(_0x20db95,null));};exports[_0x8794('0x51')]=function(_0x3bfb2d,_0x5627d0,_0x1bfb97){var _0x53ca6a={};var _0x342424={};var _0x4dbf82;var _0x449668;return db['FreshdeskAccount'][_0x8794('0x52')]({'where':{'id':_0x3bfb2d['params']['id']}})[_0x8794('0x2d')](handleEntityNotFound(_0x5627d0,null))[_0x8794('0x2d')](function(_0x1fe264){if(_0x1fe264){_0x4dbf82=_0x1fe264;_0x342424['model']=_['keys'](db[_0x8794('0x53')][_0x8794('0x32')]);_0x342424[_0x8794('0x37')]=_[_0x8794('0x36')](_0x3bfb2d[_0x8794('0x37')]);_0x342424[_0x8794('0x38')]=_['intersection'](_0x342424[_0x8794('0x35')],_0x342424[_0x8794('0x37')]);_0x53ca6a[_0x8794('0x3a')]=_[_0x8794('0x39')](_0x342424[_0x8794('0x35')],qs[_0x8794('0x3b')](_0x3bfb2d['query'][_0x8794('0x3b')]));_0x53ca6a[_0x8794('0x3a')]=_0x53ca6a[_0x8794('0x3a')][_0x8794('0x3c')]?_0x53ca6a['attributes']:_0x342424[_0x8794('0x35')];_0x53ca6a['order']=qs[_0x8794('0x40')](_0x3bfb2d[_0x8794('0x37')][_0x8794('0x40')]);_0x53ca6a[_0x8794('0x43')]=qs[_0x8794('0x38')](_[_0x8794('0x41')](_0x3bfb2d['query'],_0x342424[_0x8794('0x38')]));if(_0x3bfb2d[_0x8794('0x37')][_0x8794('0x42')]){_0x53ca6a[_0x8794('0x43')]=_['merge'](_0x53ca6a['where'],{'$or':_['map'](_0x53ca6a[_0x8794('0x3a')],function(_0x5676f0){var _0x2a29aa={};_0x2a29aa[_0x5676f0]={'$like':'%'+_0x3bfb2d[_0x8794('0x37')][_0x8794('0x42')]+'%'};return _0x2a29aa;})});}_0x53ca6a=_[_0x8794('0x44')]({},_0x53ca6a,_0x3bfb2d[_0x8794('0x46')]);return _0x4dbf82[_0x8794('0x51')](_0x53ca6a);}})[_0x8794('0x2d')](function(_0x4c9a59){if(_0x4c9a59){_0x449668=_0x4c9a59[_0x8794('0x3c')];if(!_0x3bfb2d[_0x8794('0x37')]['hasOwnProperty'](_0x8794('0x3e'))){_0x53ca6a[_0x8794('0x26')]=qs[_0x8794('0x26')](_0x3bfb2d[_0x8794('0x37')]['limit']);_0x53ca6a[_0x8794('0x24')]=qs[_0x8794('0x24')](_0x3bfb2d[_0x8794('0x37')][_0x8794('0x24')]);}return _0x4dbf82[_0x8794('0x51')](_0x53ca6a);}})[_0x8794('0x2d')](function(_0x420cf5){if(_0x420cf5){return _0x420cf5?{'count':_0x449668,'rows':_0x420cf5}:null;}})[_0x8794('0x2d')](respondWithResult(_0x5627d0,null))[_0x8794('0x4b')](handleError(_0x5627d0,null));};exports[_0x8794('0x54')]=function(_0x4554f3,_0x48eeff,_0x22f18c){if(_0x4554f3[_0x8794('0x4f')]['id']){delete _0x4554f3[_0x8794('0x4f')]['id'];}return db[_0x8794('0x48')][_0x8794('0x52')]({'where':{'id':_0x4554f3[_0x8794('0x50')]['id']}})['then'](handleEntityNotFound(_0x48eeff,null))['then'](function(_0x180b73){if(_0x180b73){_0x4554f3[_0x8794('0x4f')]['AccountId']=_0x180b73['id'];_0x4554f3[_0x8794('0x4f')][_0x8794('0x55')]=integrations[_0x8794('0x56')](_0x4554f3[_0x8794('0x4f')][_0x8794('0x57')],_0x4554f3['body'][_0x8794('0x34')]);_0x4554f3[_0x8794('0x4f')][_0x8794('0x58')]=integrations['getDescriptions'](_0x4554f3[_0x8794('0x4f')]['channel'],_0x4554f3[_0x8794('0x4f')][_0x8794('0x34')]);return db[_0x8794('0x53')][_0x8794('0x4e')](_0x4554f3[_0x8794('0x4f')],{'include':[{'model':db[_0x8794('0x59')],'as':_0x8794('0x55')},{'model':db[_0x8794('0x59')],'as':'Descriptions'}]});}return null;})[_0x8794('0x2d')](respondWithResult(_0x48eeff,null))['catch'](handleError(_0x48eeff,null));};exports[_0x8794('0x5a')]=function(_0x1ae06e,_0x528ebc,_0x1397f4){var _0x78df3b='';return db[_0x8794('0x48')][_0x8794('0x52')]({'where':{'id':_0x1ae06e[_0x8794('0x50')]['id']},'attributes':['id',_0x8794('0x5b'),_0x8794('0x5c')]})['then'](handleEntityNotFound(_0x528ebc,null))['then'](function(_0x4272d0){if(_0x4272d0){_0x78df3b=_0x4272d0['remoteUri'];var _0x5e640a=_0x78df3b[_0x8794('0x5d')](-0x1);if(_0x5e640a==='/'){_0x78df3b=_0x78df3b[_0x8794('0x5e')](0x0,_0x78df3b['lastIndexOf'](_0x5e640a));}return rp({'method':_0x8794('0x5f'),'uri':util[_0x8794('0x60')](_0x8794('0x61'),_0x78df3b,_0x8794('0x62')),'headers':{'Authorization':util['format'](_0x8794('0x63'),new Buffer(util[_0x8794('0x60')](_0x8794('0x64'),_0x4272d0[_0x8794('0x5c')]))[_0x8794('0x65')]('base64'))},'json':!![]});}})[_0x8794('0x2d')](function(_0x2186ea){if(_0x2186ea){var _0x2dd42e=[_0x8794('0x66'),_0x8794('0x67'),_0x8794('0x68'),_0x8794('0x69'),_0x8794('0x21'),_0x8794('0x6a'),_0x8794('0x6b'),_0x8794('0x6c'),_0x8794('0x6d'),_0x8794('0x6b'),_0x8794('0x6e')];_[_0x8794('0x6f')](_0x2186ea,function(_0x2b0825){return _0x2dd42e[_0x8794('0x70')](_0x2b0825[_0x8794('0x2f')])||!_0x2b0825[_0x8794('0x71')]&&_0x2b0825[_0x8794('0x34')]!==_0x8794('0x72')&&_0x2b0825[_0x8794('0x34')]!==_0x8794('0x73');});return{'count':_0x2186ea[_0x8794('0x3c')],'rows':_['map'](_0x2186ea,function(_0x4a349e){return{'id':_0x4a349e[_0x8794('0x2f')],'name':_0x4a349e[_0x8794('0x74')],'custom':!_0x4a349e[_0x8794('0x71')],'options':_0x4a349e['choices']?_['map'](_0x4a349e[_0x8794('0x75')],function(_0x273061){return{'name':_[_0x8794('0x76')](_0x273061),'value':_0x273061};}):[]};})};}})[_0x8794('0x2d')](respondWithResult(_0x528ebc,null))[_0x8794('0x4b')](function(_0x47b2e8){var _0x4abba7=_0x1ae06e[_0x8794('0x37')][_0x8794('0x77')]?0x1f4:_0x47b2e8[_0x8794('0x78')]||0x1f4;logger['error'](_0x8794('0x79'),_0x8794('0x5a'),_0x4abba7,JSON[_0x8794('0x7a')](_0x47b2e8));delete _0x47b2e8[_0x8794('0x2f')];if(_0x4abba7===0x191){_0x4abba7=0x190;}_0x528ebc[_0x8794('0x21')](_0x4abba7)['send'](_0x1ae06e[_0x8794('0x37')]['test']?{'message':_0x8794('0x7b'),'statusCode':_0x47b2e8[_0x8794('0x78')]}:_0x47b2e8);});}; \ No newline at end of file +var _0x61a5=['index','map','FreshdeskAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','length','include','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','pick','addConfiguration','AccountId','Subjects','getDescriptions','channel','FreshdeskField','Descriptions','remoteUri','apiKey','substring','GET','format','%s/%s','Basic\x20%s','%s:X','base64','subject','description','priority','group','source','ticket_type','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send'];(function(_0x363150,_0x1d1aac){var _0x546cef=function(_0x43cdbf){while(--_0x43cdbf){_0x363150['push'](_0x363150['shift']());}};_0x546cef(++_0x1d1aac);}(_0x61a5,0x19e));var _0x561a=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0x61a5[_0x459b74];return _0x46cb16;};'use strict';var emlformat=require(_0x561a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x561a('0x1'));var jsonpatch=require(_0x561a('0x2'));var rp=require('request-promise');var moment=require(_0x561a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x561a('0x4'));var util=require(_0x561a('0x5'));var path=require(_0x561a('0x6'));var sox=require(_0x561a('0x7'));var csv=require(_0x561a('0x8'));var ejs=require(_0x561a('0x9'));var fs=require('fs');var fs_extra=require(_0x561a('0xa'));var _=require(_0x561a('0xb'));var squel=require('squel');var crypto=require(_0x561a('0xc'));var jsforce=require(_0x561a('0xd'));var deskjs=require(_0x561a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x561a('0xf'));var Papa=require(_0x561a('0x10'));var Redis=require('ioredis');var authService=require(_0x561a('0x11'));var qs=require(_0x561a('0x12'));var as=require(_0x561a('0x13'));var hardwareService=require(_0x561a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x561a('0x15'));var config=require(_0x561a('0x16'));var licenseUtil=require(_0x561a('0x17'));var db=require(_0x561a('0x18'))['db'];var integrations=require(_0x561a('0x19'));function respondWithStatusCode(_0x256635,_0x6ab4df){_0x6ab4df=_0x6ab4df||0xcc;return function(_0x1dacd2){if(_0x1dacd2){return _0x256635['sendStatus'](_0x6ab4df);}return _0x256635[_0x561a('0x1a')](_0x6ab4df)[_0x561a('0x1b')]();};}function respondWithResult(_0x3ac3a4,_0x352b6f){_0x352b6f=_0x352b6f||0xc8;return function(_0x5a66c7){if(_0x5a66c7){return _0x3ac3a4[_0x561a('0x1a')](_0x352b6f)['json'](_0x5a66c7);}};}function respondWithFilteredResult(_0x4427c8,_0x3a06d3){return function(_0x85faed){if(_0x85faed){var _0x4172f8=typeof _0x3a06d3[_0x561a('0x1c')]===_0x561a('0x1d')&&typeof _0x3a06d3['limit']==='undefined';var _0x47a413=_0x85faed['count'];var _0xfff95c=_0x4172f8?0x0:_0x3a06d3[_0x561a('0x1c')];var _0x1f920e=_0x4172f8?_0x85faed['count']:_0x3a06d3['offset']+_0x3a06d3['limit'];var _0x4552c0;if(_0x1f920e>=_0x47a413){_0x1f920e=_0x47a413;_0x4552c0=0xc8;}else{_0x4552c0=0xce;}_0x4427c8[_0x561a('0x1a')](_0x4552c0);return _0x4427c8[_0x561a('0x1e')](_0x561a('0x1f'),_0xfff95c+'-'+_0x1f920e+'/'+_0x47a413)[_0x561a('0x20')](_0x85faed);}return null;};}function patchUpdates(_0x5529d9){return function(_0x1d8784){try{jsonpatch[_0x561a('0x21')](_0x1d8784,_0x5529d9,!![]);}catch(_0x5e45cd){return BPromise[_0x561a('0x22')](_0x5e45cd);}return _0x1d8784[_0x561a('0x23')]();};}function saveUpdates(_0x4a038b,_0x49c937){return function(_0xb88610){if(_0xb88610){return _0xb88610['update'](_0x4a038b)['then'](function(_0x562329){return _0x562329;});}return null;};}function removeEntity(_0x48c6e1,_0x22dfb4){return function(_0x5f28a6){if(_0x5f28a6){return _0x5f28a6['destroy']()[_0x561a('0x24')](function(){_0x48c6e1[_0x561a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2e07,_0x4bcf09){return function(_0x30657a){if(!_0x30657a){_0x5f2e07[_0x561a('0x25')](0x194);}return _0x30657a;};}function handleError(_0x4f25fb,_0x35a1f4){_0x35a1f4=_0x35a1f4||0x1f4;return function(_0x4de8ef){logger[_0x561a('0x26')](_0x4de8ef[_0x561a('0x27')]);if(_0x4de8ef[_0x561a('0x28')]){delete _0x4de8ef[_0x561a('0x28')];}_0x4f25fb[_0x561a('0x1a')](_0x35a1f4)[_0x561a('0x29')](_0x4de8ef);};}exports[_0x561a('0x2a')]=function(_0x310d40,_0x44fd4d){var _0x2293bf={},_0x1e9c37={},_0x1d8948={'count':0x0,'rows':[]};var _0x4d3b16=_[_0x561a('0x2b')](db[_0x561a('0x2c')][_0x561a('0x2d')],function(_0x39a7f6){return{'name':_0x39a7f6['fieldName'],'type':_0x39a7f6[_0x561a('0x2e')][_0x561a('0x2f')]};});_0x1e9c37[_0x561a('0x30')]=_[_0x561a('0x2b')](_0x4d3b16,_0x561a('0x28'));_0x1e9c37[_0x561a('0x31')]=_['keys'](_0x310d40[_0x561a('0x31')]);_0x1e9c37[_0x561a('0x32')]=_[_0x561a('0x33')](_0x1e9c37[_0x561a('0x30')],_0x1e9c37[_0x561a('0x31')]);_0x2293bf[_0x561a('0x34')]=_[_0x561a('0x33')](_0x1e9c37[_0x561a('0x30')],qs['fields'](_0x310d40[_0x561a('0x31')][_0x561a('0x35')]));_0x2293bf[_0x561a('0x34')]=_0x2293bf[_0x561a('0x34')]['length']?_0x2293bf['attributes']:_0x1e9c37[_0x561a('0x30')];if(!_0x310d40[_0x561a('0x31')]['hasOwnProperty'](_0x561a('0x36'))){_0x2293bf[_0x561a('0x37')]=qs[_0x561a('0x37')](_0x310d40[_0x561a('0x31')][_0x561a('0x37')]);_0x2293bf[_0x561a('0x1c')]=qs[_0x561a('0x1c')](_0x310d40[_0x561a('0x31')][_0x561a('0x1c')]);}_0x2293bf['order']=qs['sort'](_0x310d40['query'][_0x561a('0x38')]);_0x2293bf[_0x561a('0x39')]=qs[_0x561a('0x32')](_['pick'](_0x310d40[_0x561a('0x31')],_0x1e9c37[_0x561a('0x32')]),_0x4d3b16);if(_0x310d40[_0x561a('0x31')][_0x561a('0x3a')]){_0x2293bf[_0x561a('0x39')]=_[_0x561a('0x3b')](_0x2293bf['where'],{'$or':_[_0x561a('0x2b')](_0x4d3b16,function(_0x86be49){if(_0x86be49[_0x561a('0x2e')]!==_0x561a('0x3c')){var _0x40b916={};_0x40b916[_0x86be49[_0x561a('0x28')]]={'$like':'%'+_0x310d40[_0x561a('0x31')][_0x561a('0x3a')]+'%'};return _0x40b916;}})});}_0x2293bf=_['merge']({},_0x2293bf,_0x310d40[_0x561a('0x3d')]);var _0x4a54ad={'where':_0x2293bf[_0x561a('0x39')]};return db[_0x561a('0x2c')][_0x561a('0x3e')](_0x4a54ad)[_0x561a('0x24')](function(_0x3f28fb){_0x1d8948['count']=_0x3f28fb;if(_0x310d40[_0x561a('0x31')][_0x561a('0x3f')]){_0x2293bf['include']=[{'all':!![]}];}return db[_0x561a('0x2c')]['findAll'](_0x2293bf);})[_0x561a('0x24')](function(_0x3ebb45){_0x1d8948[_0x561a('0x40')]=_0x3ebb45;return _0x1d8948;})[_0x561a('0x24')](respondWithFilteredResult(_0x44fd4d,_0x2293bf))[_0x561a('0x41')](handleError(_0x44fd4d,null));};exports[_0x561a('0x42')]=function(_0x2d3743,_0x215f22){var _0x566cda={'raw':![],'where':{'id':_0x2d3743[_0x561a('0x43')]['id']}},_0x1ec09c={};_0x1ec09c[_0x561a('0x30')]=_[_0x561a('0x44')](db['FreshdeskAccount'][_0x561a('0x2d')]);_0x1ec09c[_0x561a('0x31')]=_[_0x561a('0x44')](_0x2d3743[_0x561a('0x31')]);_0x1ec09c['filters']=_[_0x561a('0x33')](_0x1ec09c['model'],_0x1ec09c[_0x561a('0x31')]);_0x566cda['attributes']=_[_0x561a('0x33')](_0x1ec09c[_0x561a('0x30')],qs[_0x561a('0x35')](_0x2d3743['query']['fields']));_0x566cda[_0x561a('0x34')]=_0x566cda[_0x561a('0x34')][_0x561a('0x45')]?_0x566cda[_0x561a('0x34')]:_0x1ec09c[_0x561a('0x30')];if(_0x2d3743[_0x561a('0x31')]['includeAll']){_0x566cda[_0x561a('0x46')]=[{'all':!![]}];}_0x566cda=_['merge']({},_0x566cda,_0x2d3743[_0x561a('0x3d')]);return db[_0x561a('0x2c')][_0x561a('0x47')](_0x566cda)[_0x561a('0x24')](handleEntityNotFound(_0x215f22,null))[_0x561a('0x24')](respondWithResult(_0x215f22,null))['catch'](handleError(_0x215f22,null));};exports[_0x561a('0x48')]=function(_0x464cce,_0x2b69bc){return db[_0x561a('0x2c')][_0x561a('0x48')](_0x464cce['body'],{})[_0x561a('0x24')](respondWithResult(_0x2b69bc,0xc9))[_0x561a('0x41')](handleError(_0x2b69bc,null));};exports['update']=function(_0x180b6b,_0x1b96dd){if(_0x180b6b['body']['id']){delete _0x180b6b[_0x561a('0x49')]['id'];}return db['FreshdeskAccount'][_0x561a('0x47')]({'where':{'id':_0x180b6b[_0x561a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b96dd,null))[_0x561a('0x24')](saveUpdates(_0x180b6b[_0x561a('0x49')],null))[_0x561a('0x24')](respondWithResult(_0x1b96dd,null))['catch'](handleError(_0x1b96dd,null));};exports[_0x561a('0x4a')]=function(_0x5f55ba,_0xaf4fbd){return db[_0x561a('0x2c')][_0x561a('0x47')]({'where':{'id':_0x5f55ba['params']['id']}})[_0x561a('0x24')](handleEntityNotFound(_0xaf4fbd,null))[_0x561a('0x24')](removeEntity(_0xaf4fbd,null))[_0x561a('0x41')](handleError(_0xaf4fbd,null));};exports[_0x561a('0x4b')]=function(_0x1f9ccb,_0x2a08fc,_0x39f0ce){var _0x1a266e={};var _0x497b59={};var _0x27d737;var _0x157ff8;return db['FreshdeskAccount'][_0x561a('0x4c')]({'where':{'id':_0x1f9ccb[_0x561a('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a08fc,null))[_0x561a('0x24')](function(_0x23c8f2){if(_0x23c8f2){_0x27d737=_0x23c8f2;_0x497b59[_0x561a('0x30')]=_[_0x561a('0x44')](db[_0x561a('0x4d')][_0x561a('0x2d')]);_0x497b59['query']=_[_0x561a('0x44')](_0x1f9ccb[_0x561a('0x31')]);_0x497b59[_0x561a('0x32')]=_[_0x561a('0x33')](_0x497b59['model'],_0x497b59[_0x561a('0x31')]);_0x1a266e[_0x561a('0x34')]=_[_0x561a('0x33')](_0x497b59[_0x561a('0x30')],qs[_0x561a('0x35')](_0x1f9ccb['query'][_0x561a('0x35')]));_0x1a266e[_0x561a('0x34')]=_0x1a266e['attributes'][_0x561a('0x45')]?_0x1a266e[_0x561a('0x34')]:_0x497b59[_0x561a('0x30')];_0x1a266e[_0x561a('0x4e')]=qs[_0x561a('0x38')](_0x1f9ccb[_0x561a('0x31')][_0x561a('0x38')]);_0x1a266e[_0x561a('0x39')]=qs[_0x561a('0x32')](_[_0x561a('0x4f')](_0x1f9ccb[_0x561a('0x31')],_0x497b59[_0x561a('0x32')]));if(_0x1f9ccb[_0x561a('0x31')]['filter']){_0x1a266e[_0x561a('0x39')]=_[_0x561a('0x3b')](_0x1a266e[_0x561a('0x39')],{'$or':_[_0x561a('0x2b')](_0x1a266e[_0x561a('0x34')],function(_0x35e11f){var _0x5f1992={};_0x5f1992[_0x35e11f]={'$like':'%'+_0x1f9ccb[_0x561a('0x31')][_0x561a('0x3a')]+'%'};return _0x5f1992;})});}_0x1a266e=_[_0x561a('0x3b')]({},_0x1a266e,_0x1f9ccb[_0x561a('0x3d')]);return _0x27d737[_0x561a('0x4b')](_0x1a266e);}})[_0x561a('0x24')](function(_0x278a47){if(_0x278a47){_0x157ff8=_0x278a47[_0x561a('0x45')];if(!_0x1f9ccb['query']['hasOwnProperty'](_0x561a('0x36'))){_0x1a266e[_0x561a('0x37')]=qs[_0x561a('0x37')](_0x1f9ccb[_0x561a('0x31')][_0x561a('0x37')]);_0x1a266e[_0x561a('0x1c')]=qs[_0x561a('0x1c')](_0x1f9ccb[_0x561a('0x31')]['offset']);}return _0x27d737['getConfigurations'](_0x1a266e);}})[_0x561a('0x24')](function(_0x30a1d9){if(_0x30a1d9){return _0x30a1d9?{'count':_0x157ff8,'rows':_0x30a1d9}:null;}})['then'](respondWithResult(_0x2a08fc,null))[_0x561a('0x41')](handleError(_0x2a08fc,null));};exports[_0x561a('0x50')]=function(_0x5842fd,_0x4c2753,_0xe8d377){if(_0x5842fd[_0x561a('0x49')]['id']){delete _0x5842fd['body']['id'];}return db[_0x561a('0x2c')][_0x561a('0x4c')]({'where':{'id':_0x5842fd['params']['id']}})['then'](handleEntityNotFound(_0x4c2753,null))[_0x561a('0x24')](function(_0x1c692c){if(_0x1c692c){_0x5842fd['body'][_0x561a('0x51')]=_0x1c692c['id'];_0x5842fd[_0x561a('0x49')][_0x561a('0x52')]=integrations['getSubjects'](_0x5842fd[_0x561a('0x49')]['channel'],_0x5842fd['body'][_0x561a('0x2e')]);_0x5842fd['body']['Descriptions']=integrations[_0x561a('0x53')](_0x5842fd[_0x561a('0x49')][_0x561a('0x54')],_0x5842fd[_0x561a('0x49')][_0x561a('0x2e')]);return db['FreshdeskConfiguration'][_0x561a('0x48')](_0x5842fd['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x561a('0x52')},{'model':db[_0x561a('0x55')],'as':_0x561a('0x56')}]});}return null;})['then'](respondWithResult(_0x4c2753,null))[_0x561a('0x41')](handleError(_0x4c2753,null));};exports['getFields']=function(_0x3e4f69,_0x24c819,_0x5bf6ee){var _0x1e029a='';return db[_0x561a('0x2c')][_0x561a('0x4c')]({'where':{'id':_0x3e4f69[_0x561a('0x43')]['id']},'attributes':['id',_0x561a('0x57'),_0x561a('0x58')]})[_0x561a('0x24')](handleEntityNotFound(_0x24c819,null))[_0x561a('0x24')](function(_0x28f36b){if(_0x28f36b){_0x1e029a=_0x28f36b[_0x561a('0x57')];var _0xc72933=_0x1e029a['slice'](-0x1);if(_0xc72933==='/'){_0x1e029a=_0x1e029a[_0x561a('0x59')](0x0,_0x1e029a['lastIndexOf'](_0xc72933));}return rp({'method':_0x561a('0x5a'),'uri':util[_0x561a('0x5b')](_0x561a('0x5c'),_0x1e029a,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x561a('0x5b')](_0x561a('0x5d'),new Buffer(util[_0x561a('0x5b')](_0x561a('0x5e'),_0x28f36b[_0x561a('0x58')]))['toString'](_0x561a('0x5f')))},'json':!![]});}})['then'](function(_0x19fdb5){if(_0x19fdb5){var _0x38856d=['requester',_0x561a('0x60'),'agent',_0x561a('0x61'),_0x561a('0x1a'),_0x561a('0x62'),_0x561a('0x63'),_0x561a('0x64'),_0x561a('0x65'),'group','company'];_[_0x561a('0x66')](_0x19fdb5,function(_0xe3a568){return _0x38856d['includes'](_0xe3a568[_0x561a('0x28')])||!_0xe3a568[_0x561a('0x67')]&&_0xe3a568[_0x561a('0x2e')]!==_0x561a('0x68')&&_0xe3a568['type']!==_0x561a('0x69');});return{'count':_0x19fdb5[_0x561a('0x45')],'rows':_[_0x561a('0x2b')](_0x19fdb5,function(_0x7a40c9){return{'id':_0x7a40c9[_0x561a('0x28')],'name':_0x7a40c9[_0x561a('0x6a')],'custom':!_0x7a40c9[_0x561a('0x67')],'options':_0x7a40c9[_0x561a('0x6b')]?_[_0x561a('0x2b')](_0x7a40c9[_0x561a('0x6b')],function(_0x55051c){return{'name':_[_0x561a('0x6c')](_0x55051c),'value':_0x55051c};}):[]};})};}})[_0x561a('0x24')](respondWithResult(_0x24c819,null))[_0x561a('0x41')](function(_0x28a280){var _0x4b31a0=_0x3e4f69[_0x561a('0x31')][_0x561a('0x6d')]?0x1f4:_0x28a280[_0x561a('0x6e')]||0x1f4;logger[_0x561a('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x561a('0x6f'),_0x4b31a0,JSON[_0x561a('0x70')](_0x28a280));delete _0x28a280[_0x561a('0x28')];if(_0x4b31a0===0x191){_0x4b31a0=0x190;}_0x24c819[_0x561a('0x1a')](_0x4b31a0)[_0x561a('0x29')](_0x3e4f69[_0x561a('0x31')][_0x561a('0x6d')]?{'message':_0x561a('0x71'),'statusCode':_0x28a280['statusCode']}:_0x28a280);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5d8f891..484a26f 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 _0xac57=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2a0134,_0x56a471){var _0x33a9f2=function(_0x1ff783){while(--_0x1ff783){_0x2a0134['push'](_0x2a0134['shift']());}};_0x33a9f2(++_0x56a471);}(_0xac57,0xbf));var _0x7ac5=function(_0x56e13e,_0x3754cd){_0x56e13e=_0x56e13e-0x0;var _0x148751=_0xac57[_0x56e13e];return _0x148751;};'use strict';var _=require(_0x7ac5('0x0'));var util=require('util');var logger=require(_0x7ac5('0x1'))(_0x7ac5('0x2'));var moment=require(_0x7ac5('0x3'));var BPromise=require('bluebird');var rp=require(_0x7ac5('0x4'));var fs=require('fs');var path=require(_0x7ac5('0x5'));var rimraf=require(_0x7ac5('0x6'));var config=require(_0x7ac5('0x7'));var attributes=require(_0x7ac5('0x8'));var integrations=require(_0x7ac5('0x9'));module[_0x7ac5('0xa')]=function(_0x2f65fc,_0x1f2bb6){return _0x2f65fc[_0x7ac5('0xb')](_0x7ac5('0xc'),attributes,{'tableName':_0x7ac5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc442=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x49ac58,_0x21ef23){var _0x4bf92b=function(_0x322de8){while(--_0x322de8){_0x49ac58['push'](_0x49ac58['shift']());}};_0x4bf92b(++_0x21ef23);}(_0xc442,0x155));var _0x2c44=function(_0x11b29c,_0x3623c2){_0x11b29c=_0x11b29c-0x0;var _0x44f46d=_0xc442[_0x11b29c];return _0x44f46d;};'use strict';var _=require(_0x2c44('0x0'));var util=require(_0x2c44('0x1'));var logger=require('../../config/logger')(_0x2c44('0x2'));var moment=require(_0x2c44('0x3'));var BPromise=require(_0x2c44('0x4'));var rp=require(_0x2c44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c44('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c44('0x7'));var integrations=require(_0x2c44('0x8'));module[_0x2c44('0x9')]=function(_0x2f456e,_0x8ceb11){return _0x2f456e[_0x2c44('0xa')](_0x2c44('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 19e6d50..64ff6fc 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 _0x80a5=['GetFreshdeskAccount','debug','catch','find','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','FreshdeskAccount','findAll','options','raw','where','include','map','model','attributes','then'];(function(_0x3151b9,_0x3c3057){var _0x354cce=function(_0x11e29d){while(--_0x11e29d){_0x3151b9['push'](_0x3151b9['shift']());}};_0x354cce(++_0x3c3057);}(_0x80a5,0xb4));var _0x580a=function(_0x4b6d28,_0x2c761b){_0x4b6d28=_0x4b6d28-0x0;var _0x46f15b=_0x80a5[_0x4b6d28];return _0x46f15b;};'use strict';var _=require(_0x580a('0x0'));var util=require(_0x580a('0x1'));var moment=require('moment');var BPromise=require(_0x580a('0x2'));var rs=require(_0x580a('0x3'));var fs=require('fs');var Redis=require(_0x580a('0x4'));var db=require(_0x580a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x580a('0x6'));var config=require(_0x580a('0x7'));var jayson=require(_0x580a('0x8'));var client=jayson[_0x580a('0x9')][_0x580a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fae02,_0x36a418,_0x260487){return new BPromise(function(_0x93ec2a,_0x3b8e38){return client[_0x580a('0xb')](_0x1fae02,_0x260487)['then'](function(_0x5f17cf){logger[_0x580a('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x36a418,_0x580a('0xd'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x36a418,_0x580a('0xd'),JSON[_0x580a('0xe')](_0x5f17cf));if(_0x5f17cf[_0x580a('0xf')]){if(_0x5f17cf[_0x580a('0xf')][_0x580a('0x10')]===0x1f4){logger[_0x580a('0xf')](_0x580a('0x11'),_0x36a418,_0x5f17cf[_0x580a('0xf')][_0x580a('0x12')]);return _0x3b8e38(_0x5f17cf[_0x580a('0xf')][_0x580a('0x12')]);}logger['error'](_0x580a('0x11'),_0x36a418,_0x5f17cf[_0x580a('0xf')][_0x580a('0x12')]);return _0x93ec2a(_0x5f17cf[_0x580a('0xf')][_0x580a('0x12')]);}else{logger[_0x580a('0xc')](_0x580a('0x11'),_0x36a418,_0x580a('0xd'));_0x93ec2a(_0x5f17cf[_0x580a('0x13')]['message']);}})['catch'](function(_0x50ad0c){logger[_0x580a('0xf')](_0x580a('0x11'),_0x36a418,_0x50ad0c);_0x3b8e38(_0x50ad0c);});});}exports['GetFreshdeskAccount']=function(_0x26c513){var _0x431086=this;return new Promise(function(_0x3ad6ca,_0x12af62){return db[_0x580a('0x14')][_0x580a('0x15')]({'raw':_0x26c513[_0x580a('0x16')]?_0x26c513[_0x580a('0x16')][_0x580a('0x17')]===undefined?!![]:![]:!![],'where':_0x26c513[_0x580a('0x16')]?_0x26c513[_0x580a('0x16')][_0x580a('0x18')]||null:null,'attributes':_0x26c513[_0x580a('0x16')]?_0x26c513[_0x580a('0x16')]['attributes']||null:null,'limit':_0x26c513[_0x580a('0x16')]?_0x26c513['options']['limit']||null:null,'include':_0x26c513[_0x580a('0x16')]?_0x26c513[_0x580a('0x16')][_0x580a('0x19')]?_[_0x580a('0x1a')](_0x26c513[_0x580a('0x16')][_0x580a('0x19')],function(_0x62e1cf){return{'model':db[_0x62e1cf[_0x580a('0x1b')]],'as':_0x62e1cf['as'],'attributes':_0x62e1cf[_0x580a('0x1c')],'include':_0x62e1cf[_0x580a('0x19')]?_[_0x580a('0x1a')](_0x62e1cf[_0x580a('0x19')],function(_0x50dfb4){return{'model':db[_0x50dfb4[_0x580a('0x1b')]],'as':_0x50dfb4['as'],'attributes':_0x50dfb4[_0x580a('0x1c')],'include':_0x50dfb4[_0x580a('0x19')]?_[_0x580a('0x1a')](_0x50dfb4[_0x580a('0x19')],function(_0x3aed9c){return{'model':db[_0x3aed9c[_0x580a('0x1b')]],'as':_0x3aed9c['as'],'attributes':_0x3aed9c[_0x580a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x580a('0x1d')](function(_0x10c2ce){logger[_0x580a('0xc')](_0x580a('0x1e'),_0x26c513);logger[_0x580a('0x1f')](_0x580a('0x1e'),_0x26c513,JSON['stringify'](_0x10c2ce));_0x3ad6ca(_0x10c2ce);})[_0x580a('0x20')](function(_0x835070){logger['error']('GetFreshdeskAccount',_0x835070['message'],_0x26c513);_0x12af62(_0x431086[_0x580a('0xf')](0x1f4,_0x835070[_0x580a('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x5a79dc){var _0x2ad243=this;return new Promise(function(_0x53444b,_0x320270){return db[_0x580a('0x14')][_0x580a('0x21')]({'raw':_0x5a79dc[_0x580a('0x16')]?_0x5a79dc[_0x580a('0x16')][_0x580a('0x17')]===undefined?!![]:![]:!![],'where':_0x5a79dc[_0x580a('0x16')]?_0x5a79dc[_0x580a('0x16')][_0x580a('0x18')]||null:null,'attributes':_0x5a79dc[_0x580a('0x16')]?_0x5a79dc[_0x580a('0x16')][_0x580a('0x1c')]||null:null,'include':_0x5a79dc[_0x580a('0x16')]?_0x5a79dc[_0x580a('0x16')]['include']?_[_0x580a('0x1a')](_0x5a79dc[_0x580a('0x16')][_0x580a('0x19')],function(_0x60d1c0){return{'model':db[_0x60d1c0['model']],'as':_0x60d1c0['as'],'attributes':_0x60d1c0[_0x580a('0x1c')],'include':_0x60d1c0['include']?_[_0x580a('0x1a')](_0x60d1c0[_0x580a('0x19')],function(_0x3c8a9d){return{'model':db[_0x3c8a9d['model']],'as':_0x3c8a9d['as'],'attributes':_0x3c8a9d[_0x580a('0x1c')],'include':_0x3c8a9d[_0x580a('0x19')]?_[_0x580a('0x1a')](_0x3c8a9d[_0x580a('0x19')],function(_0x56670f){return{'model':db[_0x56670f['model']],'as':_0x56670f['as'],'attributes':_0x56670f[_0x580a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x580a('0x1d')](function(_0x4e4cc1){logger['info'](_0x580a('0x22'),_0x5a79dc);logger[_0x580a('0x1f')](_0x580a('0x22'),_0x5a79dc,JSON[_0x580a('0xe')](_0x4e4cc1));_0x53444b(_0x4e4cc1);})[_0x580a('0x20')](function(_0x28a535){logger[_0x580a('0xf')]('ShowFreshdeskAccount',_0x28a535[_0x580a('0x12')],_0x5a79dc);_0x320270(_0x2ad243[_0x580a('0xf')](0x1f4,_0x28a535[_0x580a('0x12')]));});});}; \ No newline at end of file +var _0xaa85=['model','GetFreshdeskAccount','catch','ShowFreshdeskAccount','FreshdeskAccount','find','then','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','findAll','options','where','attributes','limit','map','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa85,0x70));var _0x5aa8=function(_0x109039,_0x36cf68){_0x109039=_0x109039-0x0;var _0x49478b=_0xaa85[_0x109039];return _0x49478b;};'use strict';var _=require(_0x5aa8('0x0'));var util=require('util');var moment=require(_0x5aa8('0x1'));var BPromise=require(_0x5aa8('0x2'));var rs=require(_0x5aa8('0x3'));var fs=require('fs');var Redis=require(_0x5aa8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5aa8('0x5'))(_0x5aa8('0x6'));var config=require('../../config/environment');var jayson=require(_0x5aa8('0x7'));var client=jayson[_0x5aa8('0x8')][_0x5aa8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1601be,_0x5ab1c8,_0x3a5ae0){return new BPromise(function(_0xda118,_0x528cf2){return client[_0x5aa8('0xa')](_0x1601be,_0x3a5ae0)['then'](function(_0x92272){logger[_0x5aa8('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ab1c8,_0x5aa8('0xc'));logger[_0x5aa8('0xd')](_0x5aa8('0xe'),_0x5ab1c8,_0x5aa8('0xc'),JSON[_0x5aa8('0xf')](_0x92272));if(_0x92272[_0x5aa8('0x10')]){if(_0x92272[_0x5aa8('0x10')][_0x5aa8('0x11')]===0x1f4){logger[_0x5aa8('0x10')](_0x5aa8('0x12'),_0x5ab1c8,_0x92272[_0x5aa8('0x10')][_0x5aa8('0x13')]);return _0x528cf2(_0x92272[_0x5aa8('0x10')][_0x5aa8('0x13')]);}logger[_0x5aa8('0x10')](_0x5aa8('0x12'),_0x5ab1c8,_0x92272[_0x5aa8('0x10')][_0x5aa8('0x13')]);return _0xda118(_0x92272['error'][_0x5aa8('0x13')]);}else{logger['info'](_0x5aa8('0x12'),_0x5ab1c8,'request\x20sent');_0xda118(_0x92272[_0x5aa8('0x14')][_0x5aa8('0x13')]);}})['catch'](function(_0x2abc27){logger[_0x5aa8('0x10')](_0x5aa8('0x12'),_0x5ab1c8,_0x2abc27);_0x528cf2(_0x2abc27);});});}exports['GetFreshdeskAccount']=function(_0x438cac){var _0x102e5f=this;return new Promise(function(_0x47baaa,_0x42ec05){return db['FreshdeskAccount'][_0x5aa8('0x15')]({'raw':_0x438cac[_0x5aa8('0x16')]?_0x438cac[_0x5aa8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x438cac['options']?_0x438cac['options'][_0x5aa8('0x17')]||null:null,'attributes':_0x438cac[_0x5aa8('0x16')]?_0x438cac[_0x5aa8('0x16')][_0x5aa8('0x18')]||null:null,'limit':_0x438cac[_0x5aa8('0x16')]?_0x438cac[_0x5aa8('0x16')][_0x5aa8('0x19')]||null:null,'include':_0x438cac[_0x5aa8('0x16')]?_0x438cac[_0x5aa8('0x16')]['include']?_[_0x5aa8('0x1a')](_0x438cac[_0x5aa8('0x16')][_0x5aa8('0x1b')],function(_0xd86a74){return{'model':db[_0xd86a74[_0x5aa8('0x1c')]],'as':_0xd86a74['as'],'attributes':_0xd86a74['attributes'],'include':_0xd86a74[_0x5aa8('0x1b')]?_['map'](_0xd86a74[_0x5aa8('0x1b')],function(_0x20d176){return{'model':db[_0x20d176[_0x5aa8('0x1c')]],'as':_0x20d176['as'],'attributes':_0x20d176[_0x5aa8('0x18')],'include':_0x20d176['include']?_[_0x5aa8('0x1a')](_0x20d176['include'],function(_0x30d168){return{'model':db[_0x30d168[_0x5aa8('0x1c')]],'as':_0x30d168['as'],'attributes':_0x30d168[_0x5aa8('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4699f4){logger[_0x5aa8('0xb')]('GetFreshdeskAccount',_0x438cac);logger[_0x5aa8('0xd')](_0x5aa8('0x1d'),_0x438cac,JSON['stringify'](_0x4699f4));_0x47baaa(_0x4699f4);})[_0x5aa8('0x1e')](function(_0x412452){logger[_0x5aa8('0x10')](_0x5aa8('0x1d'),_0x412452[_0x5aa8('0x13')],_0x438cac);_0x42ec05(_0x102e5f[_0x5aa8('0x10')](0x1f4,_0x412452['message']));});});};exports[_0x5aa8('0x1f')]=function(_0x4886e0){var _0x81506d=this;return new Promise(function(_0x18c90b,_0xc97a1e){return db[_0x5aa8('0x20')][_0x5aa8('0x21')]({'raw':_0x4886e0['options']?_0x4886e0[_0x5aa8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4886e0['options']?_0x4886e0['options']['where']||null:null,'attributes':_0x4886e0[_0x5aa8('0x16')]?_0x4886e0[_0x5aa8('0x16')]['attributes']||null:null,'include':_0x4886e0[_0x5aa8('0x16')]?_0x4886e0[_0x5aa8('0x16')]['include']?_[_0x5aa8('0x1a')](_0x4886e0[_0x5aa8('0x16')]['include'],function(_0x37218c){return{'model':db[_0x37218c[_0x5aa8('0x1c')]],'as':_0x37218c['as'],'attributes':_0x37218c[_0x5aa8('0x18')],'include':_0x37218c[_0x5aa8('0x1b')]?_['map'](_0x37218c[_0x5aa8('0x1b')],function(_0x5b0c74){return{'model':db[_0x5b0c74[_0x5aa8('0x1c')]],'as':_0x5b0c74['as'],'attributes':_0x5b0c74['attributes'],'include':_0x5b0c74[_0x5aa8('0x1b')]?_[_0x5aa8('0x1a')](_0x5b0c74[_0x5aa8('0x1b')],function(_0x179283){return{'model':db[_0x179283[_0x5aa8('0x1c')]],'as':_0x179283['as'],'attributes':_0x179283[_0x5aa8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5aa8('0x22')](function(_0x1ef1e1){logger[_0x5aa8('0xb')](_0x5aa8('0x1f'),_0x4886e0);logger[_0x5aa8('0xd')](_0x5aa8('0x1f'),_0x4886e0,JSON['stringify'](_0x1ef1e1));_0x18c90b(_0x1ef1e1);})[_0x5aa8('0x1e')](function(_0x1c03b1){logger[_0x5aa8('0x10')](_0x5aa8('0x1f'),_0x1c03b1[_0x5aa8('0x13')],_0x4886e0);_0xc97a1e(_0x81506d[_0x5aa8('0x10')](0x1f4,_0x1c03b1['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3086f83..d0e1623 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 _0x0fb8=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','delete','destroy','exports','multer','util'];(function(_0x4f8b2c,_0x237879){var _0x290f14=function(_0x2985b9){while(--_0x2985b9){_0x4f8b2c['push'](_0x4f8b2c['shift']());}};_0x290f14(++_0x237879);}(_0x0fb8,0xa6));var _0x80fb=function(_0x170a9f,_0x5ecb4a){_0x170a9f=_0x170a9f-0x0;var _0x9be5af=_0x0fb8[_0x170a9f];return _0x9be5af;};'use strict';var multer=require(_0x80fb('0x0'));var util=require(_0x80fb('0x1'));var path=require(_0x80fb('0x2'));var timeout=require(_0x80fb('0x3'));var express=require(_0x80fb('0x4'));var router=express[_0x80fb('0x5')]();var fs_extra=require(_0x80fb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x80fb('0x7'));var config=require(_0x80fb('0x8'));var controller=require(_0x80fb('0x9'));router[_0x80fb('0xa')]('/',auth[_0x80fb('0xb')](),controller[_0x80fb('0xc')]);router[_0x80fb('0xa')](_0x80fb('0xd'),auth[_0x80fb('0xb')](),controller[_0x80fb('0xe')]);router['get'](_0x80fb('0xf'),auth[_0x80fb('0xb')](),controller[_0x80fb('0x10')]);router[_0x80fb('0xa')](_0x80fb('0x11'),auth[_0x80fb('0xb')](),controller['getSubjects']);router[_0x80fb('0xa')](_0x80fb('0x12'),auth['isAuthenticated'](),controller[_0x80fb('0x13')]);router[_0x80fb('0xa')](_0x80fb('0x14'),auth[_0x80fb('0xb')](),controller['getTags']);router[_0x80fb('0x15')]('/',auth[_0x80fb('0xb')](),controller[_0x80fb('0x16')]);router[_0x80fb('0x15')](_0x80fb('0x14'),auth[_0x80fb('0xb')](),controller[_0x80fb('0x17')]);router[_0x80fb('0x18')](_0x80fb('0xd'),auth[_0x80fb('0xb')](),controller['update']);router[_0x80fb('0x19')](_0x80fb('0xd'),auth[_0x80fb('0xb')](),controller[_0x80fb('0x1a')]);module[_0x80fb('0x1b')]=router; \ No newline at end of file +var _0x8d47=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','/:id','update','destroy','exports','multer'];(function(_0x1fc331,_0x2f7678){var _0x35ece7=function(_0xc22e51){while(--_0xc22e51){_0x1fc331['push'](_0x1fc331['shift']());}};_0x35ece7(++_0x2f7678);}(_0x8d47,0x1a8));var _0x78d4=function(_0x3efcca,_0x4724fd){_0x3efcca=_0x3efcca-0x0;var _0x5043cc=_0x8d47[_0x3efcca];return _0x5043cc;};'use strict';var multer=require(_0x78d4('0x0'));var util=require(_0x78d4('0x1'));var path=require(_0x78d4('0x2'));var timeout=require(_0x78d4('0x3'));var express=require(_0x78d4('0x4'));var router=express['Router']();var fs_extra=require(_0x78d4('0x5'));var auth=require(_0x78d4('0x6'));var interaction=require(_0x78d4('0x7'));var config=require(_0x78d4('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x78d4('0x9')](),controller[_0x78d4('0xa')]);router[_0x78d4('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x78d4('0xc')]);router['get'](_0x78d4('0xd'),auth[_0x78d4('0x9')](),controller['getFields']);router[_0x78d4('0xb')](_0x78d4('0xe'),auth[_0x78d4('0x9')](),controller[_0x78d4('0xf')]);router[_0x78d4('0xb')](_0x78d4('0x10'),auth[_0x78d4('0x9')](),controller[_0x78d4('0x11')]);router['get'](_0x78d4('0x12'),auth[_0x78d4('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x78d4('0x13')]('/:id/tags',auth[_0x78d4('0x9')](),controller[_0x78d4('0x14')]);router['put'](_0x78d4('0x15'),auth['isAuthenticated'](),controller[_0x78d4('0x16')]);router['delete']('/:id',auth[_0x78d4('0x9')](),controller[_0x78d4('0x17')]);module[_0x78d4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 4e89b67..4a60f58 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 _0xd406=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd406,0x1a4));var _0x6d40=function(_0x10078d,_0x237968){_0x10078d=_0x10078d-0x0;var _0x39f417=_0xd406[_0x10078d];return _0x39f417;};'use strict';var Sequelize=require(_0x6d40('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d40('0x1')]}}; \ No newline at end of file +var _0x3886=['sequelize','exports','STRING'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x3886,0x78));var _0x6388=function(_0x1838e5,_0x2beed4){_0x1838e5=_0x1838e5-0x0;var _0x1a777f=_0x3886[_0x1838e5];return _0x1a777f;};'use strict';var Sequelize=require(_0x6388('0x0'));module[_0x6388('0x1')]={'name':{'type':Sequelize[_0x6388('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8a6feae..418a029 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 _0x88da=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','end','name','map','FreshdeskConfiguration','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','find','body','params','findOne','FreshdeskField','rawAttributes','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','path','sox','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x1924c3,_0x2f4a9a){var _0x56217a=function(_0x45f94c){while(--_0x45f94c){_0x1924c3['push'](_0x1924c3['shift']());}};_0x56217a(++_0x2f4a9a);}(_0x88da,0x129));var _0xa88d=function(_0x29b872,_0xd60230){_0x29b872=_0x29b872-0x0;var _0x14ba28=_0x88da[_0x29b872];return _0x14ba28;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa88d('0x0'));var jsonpatch=require(_0xa88d('0x1'));var rp=require(_0xa88d('0x2'));var moment=require(_0xa88d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa88d('0x4'));var sox=require(_0xa88d('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa88d('0x6'));var _=require('lodash');var squel=require(_0xa88d('0x7'));var crypto=require(_0xa88d('0x8'));var jsforce=require(_0xa88d('0x9'));var deskjs=require(_0xa88d('0xa'));var toCsv=require(_0xa88d('0xb'));var querystring=require(_0xa88d('0xc'));var Papa=require(_0xa88d('0xd'));var Redis=require(_0xa88d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa88d('0xf'));var as=require(_0xa88d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa88d('0x11'))(_0xa88d('0x12'));var utils=require(_0xa88d('0x13'));var config=require(_0xa88d('0x14'));var licenseUtil=require(_0xa88d('0x15'));var db=require(_0xa88d('0x16'))['db'];function respondWithStatusCode(_0x30af56,_0x497f78){_0x497f78=_0x497f78||0xcc;return function(_0x4a27d6){if(_0x4a27d6){return _0x30af56[_0xa88d('0x17')](_0x497f78);}return _0x30af56[_0xa88d('0x18')](_0x497f78)['end']();};}function respondWithResult(_0x4aa09b,_0x3bd427){_0x3bd427=_0x3bd427||0xc8;return function(_0x21116c){if(_0x21116c){return _0x4aa09b[_0xa88d('0x18')](_0x3bd427)[_0xa88d('0x19')](_0x21116c);}};}function respondWithFilteredResult(_0x2e786f,_0x167e34){return function(_0xe2eff4){if(_0xe2eff4){var _0x2a832e=typeof _0x167e34[_0xa88d('0x1a')]==='undefined'&&typeof _0x167e34[_0xa88d('0x1b')]===_0xa88d('0x1c');var _0x321358=_0xe2eff4[_0xa88d('0x1d')];var _0x129106=_0x2a832e?0x0:_0x167e34[_0xa88d('0x1a')];var _0xe8516=_0x2a832e?_0xe2eff4[_0xa88d('0x1d')]:_0x167e34[_0xa88d('0x1a')]+_0x167e34[_0xa88d('0x1b')];var _0x1daf07;if(_0xe8516>=_0x321358){_0xe8516=_0x321358;_0x1daf07=0xc8;}else{_0x1daf07=0xce;}_0x2e786f['status'](_0x1daf07);return _0x2e786f[_0xa88d('0x1e')]('Content-Range',_0x129106+'-'+_0xe8516+'/'+_0x321358)[_0xa88d('0x19')](_0xe2eff4);}return null;};}function patchUpdates(_0x231760){return function(_0x56182d){try{jsonpatch['apply'](_0x56182d,_0x231760,!![]);}catch(_0xfc3562){return BPromise[_0xa88d('0x1f')](_0xfc3562);}return _0x56182d[_0xa88d('0x20')]();};}function saveUpdates(_0x6b178c,_0x3db26c){return function(_0x32fdfa){if(_0x32fdfa){return _0x32fdfa[_0xa88d('0x21')](_0x6b178c)[_0xa88d('0x22')](function(_0x5342a9){return _0x5342a9;});}return null;};}function removeEntity(_0x4b8563,_0x5a229c){return function(_0x317e4a){if(_0x317e4a){return _0x317e4a[_0xa88d('0x23')]()['then'](function(){_0x4b8563[_0xa88d('0x18')](0xcc)[_0xa88d('0x24')]();});}};}function handleEntityNotFound(_0x556e29,_0x2259ad){return function(_0x393507){if(!_0x393507){_0x556e29[_0xa88d('0x17')](0x194);}return _0x393507;};}function handleError(_0x36882d,_0x270d85){_0x270d85=_0x270d85||0x1f4;return function(_0x15d364){logger['error'](_0x15d364['stack']);if(_0x15d364[_0xa88d('0x25')]){delete _0x15d364[_0xa88d('0x25')];}_0x36882d[_0xa88d('0x18')](_0x270d85)['send'](_0x15d364);};}exports['index']=function(_0x496a8d,_0x3b3f09){var _0x5b3da9={},_0x39c4d7={},_0x1077d8={'count':0x0,'rows':[]};var _0x3fa498=_[_0xa88d('0x26')](db[_0xa88d('0x27')]['rawAttributes'],function(_0x1598b0){return{'name':_0x1598b0[_0xa88d('0x28')],'type':_0x1598b0['type']['key']};});_0x39c4d7[_0xa88d('0x29')]=_[_0xa88d('0x26')](_0x3fa498,_0xa88d('0x25'));_0x39c4d7[_0xa88d('0x2a')]=_[_0xa88d('0x2b')](_0x496a8d['query']);_0x39c4d7[_0xa88d('0x2c')]=_['intersection'](_0x39c4d7[_0xa88d('0x29')],_0x39c4d7[_0xa88d('0x2a')]);_0x5b3da9[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0x39c4d7['model'],qs[_0xa88d('0x2f')](_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x5b3da9[_0xa88d('0x2d')]=_0x5b3da9['attributes'][_0xa88d('0x30')]?_0x5b3da9[_0xa88d('0x2d')]:_0x39c4d7[_0xa88d('0x29')];if(!_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x31')](_0xa88d('0x32'))){_0x5b3da9[_0xa88d('0x1b')]=qs['limit'](_0x496a8d['query']['limit']);_0x5b3da9['offset']=qs['offset'](_0x496a8d['query'][_0xa88d('0x1a')]);}_0x5b3da9['order']=qs[_0xa88d('0x33')](_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x5b3da9[_0xa88d('0x34')]=qs['filters'](_[_0xa88d('0x35')](_0x496a8d[_0xa88d('0x2a')],_0x39c4d7[_0xa88d('0x2c')]),_0x3fa498);if(_0x496a8d['query']['filter']){_0x5b3da9[_0xa88d('0x34')]=_[_0xa88d('0x36')](_0x5b3da9[_0xa88d('0x34')],{'$or':_[_0xa88d('0x26')](_0x3fa498,function(_0x163dff){if(_0x163dff[_0xa88d('0x37')]!==_0xa88d('0x38')){var _0x527a20={};_0x527a20[_0x163dff[_0xa88d('0x25')]]={'$like':'%'+_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x39')]+'%'};return _0x527a20;}})});}_0x5b3da9=_[_0xa88d('0x36')]({},_0x5b3da9,_0x496a8d[_0xa88d('0x3a')]);var _0x216d3a={'where':_0x5b3da9[_0xa88d('0x34')]};return db['FreshdeskConfiguration'][_0xa88d('0x1d')](_0x216d3a)[_0xa88d('0x22')](function(_0x2fa7bc){_0x1077d8[_0xa88d('0x1d')]=_0x2fa7bc;if(_0x496a8d[_0xa88d('0x2a')][_0xa88d('0x3b')]){_0x5b3da9[_0xa88d('0x3c')]=[{'all':!![]}];}return db[_0xa88d('0x27')][_0xa88d('0x3d')](_0x5b3da9);})[_0xa88d('0x22')](function(_0x1da355){_0x1077d8['rows']=_0x1da355;return _0x1077d8;})[_0xa88d('0x22')](respondWithFilteredResult(_0x3b3f09,_0x5b3da9))[_0xa88d('0x3e')](handleError(_0x3b3f09,null));};exports['show']=function(_0x479b0b,_0x354168){var _0x2c87ea={'raw':![],'where':{'id':_0x479b0b['params']['id']}},_0xccd6fb={};_0xccd6fb[_0xa88d('0x29')]=_[_0xa88d('0x2b')](db[_0xa88d('0x27')]['rawAttributes']);_0xccd6fb['query']=_[_0xa88d('0x2b')](_0x479b0b[_0xa88d('0x2a')]);_0xccd6fb[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0xccd6fb[_0xa88d('0x29')],_0xccd6fb[_0xa88d('0x2a')]);_0x2c87ea[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0xccd6fb['model'],qs[_0xa88d('0x2f')](_0x479b0b[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x2c87ea[_0xa88d('0x2d')]=_0x2c87ea[_0xa88d('0x2d')][_0xa88d('0x30')]?_0x2c87ea[_0xa88d('0x2d')]:_0xccd6fb[_0xa88d('0x29')];if(_0x479b0b[_0xa88d('0x2a')][_0xa88d('0x3b')]){_0x2c87ea[_0xa88d('0x3c')]=[{'all':!![]}];}_0x2c87ea=_['merge']({},_0x2c87ea,_0x479b0b[_0xa88d('0x3a')]);return db[_0xa88d('0x27')][_0xa88d('0x3f')](_0x2c87ea)[_0xa88d('0x22')](handleEntityNotFound(_0x354168,null))[_0xa88d('0x22')](respondWithResult(_0x354168,null))[_0xa88d('0x3e')](handleError(_0x354168,null));};exports['create']=function(_0x1d73ac,_0x349c7d){return db['FreshdeskConfiguration']['create'](_0x1d73ac[_0xa88d('0x40')],{})[_0xa88d('0x22')](respondWithResult(_0x349c7d,0xc9))[_0xa88d('0x3e')](handleError(_0x349c7d,null));};exports['update']=function(_0x599b8f,_0x448bcb){if(_0x599b8f[_0xa88d('0x40')]['id']){delete _0x599b8f[_0xa88d('0x40')]['id'];}return db[_0xa88d('0x27')][_0xa88d('0x3f')]({'where':{'id':_0x599b8f[_0xa88d('0x41')]['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0x448bcb,null))[_0xa88d('0x22')](saveUpdates(_0x599b8f[_0xa88d('0x40')],null))[_0xa88d('0x22')](respondWithResult(_0x448bcb,null))[_0xa88d('0x3e')](handleError(_0x448bcb,null));};exports[_0xa88d('0x23')]=function(_0x2fc9db,_0x5e57d4){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x2fc9db[_0xa88d('0x41')]['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0x5e57d4,null))[_0xa88d('0x22')](removeEntity(_0x5e57d4,null))[_0xa88d('0x3e')](handleError(_0x5e57d4,null));};exports['getFields']=function(_0xde7b93,_0x446194,_0x5818b2){var _0x28d099={};var _0x348dbc={};var _0x115368;var _0x313c26;return db[_0xa88d('0x27')][_0xa88d('0x42')]({'where':{'id':_0xde7b93[_0xa88d('0x41')]['id']}})['then'](handleEntityNotFound(_0x446194,null))['then'](function(_0x134150){if(_0x134150){_0x115368=_0x134150;_0x348dbc['model']=_[_0xa88d('0x2b')](db[_0xa88d('0x43')][_0xa88d('0x44')]);_0x348dbc[_0xa88d('0x2a')]=_[_0xa88d('0x2b')](_0xde7b93[_0xa88d('0x2a')]);_0x348dbc[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0x348dbc['model'],_0x348dbc[_0xa88d('0x2a')]);_0x28d099[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0x348dbc['model'],qs['fields'](_0xde7b93[_0xa88d('0x2a')]['fields']));_0x28d099[_0xa88d('0x2d')]=_0x28d099[_0xa88d('0x2d')][_0xa88d('0x30')]?_0x28d099[_0xa88d('0x2d')]:_0x348dbc[_0xa88d('0x29')];_0x28d099[_0xa88d('0x45')]=qs[_0xa88d('0x33')](_0xde7b93[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x28d099[_0xa88d('0x34')]=qs[_0xa88d('0x2c')](_[_0xa88d('0x35')](_0xde7b93[_0xa88d('0x2a')],_0x348dbc['filters']));if(_0xde7b93['query']['filter']){_0x28d099[_0xa88d('0x34')]=_[_0xa88d('0x36')](_0x28d099[_0xa88d('0x34')],{'$or':_[_0xa88d('0x26')](_0x28d099['attributes'],function(_0x4ae2c7){var _0x1b4797={};_0x1b4797[_0x4ae2c7]={'$like':'%'+_0xde7b93['query']['filter']+'%'};return _0x1b4797;})});}_0x28d099=_[_0xa88d('0x36')]({},_0x28d099,_0xde7b93[_0xa88d('0x3a')]);return _0x115368['getFields'](_0x28d099);}})[_0xa88d('0x22')](function(_0x575ad8){if(_0x575ad8){_0x313c26=_0x575ad8[_0xa88d('0x30')];if(!_0xde7b93[_0xa88d('0x2a')][_0xa88d('0x31')](_0xa88d('0x32'))){_0x28d099[_0xa88d('0x1b')]=qs[_0xa88d('0x1b')](_0xde7b93[_0xa88d('0x2a')]['limit']);_0x28d099[_0xa88d('0x1a')]=qs[_0xa88d('0x1a')](_0xde7b93[_0xa88d('0x2a')][_0xa88d('0x1a')]);}return _0x115368[_0xa88d('0x46')](_0x28d099);}})[_0xa88d('0x22')](function(_0x518ee3){if(_0x518ee3){return _0x518ee3?{'count':_0x313c26,'rows':_0x518ee3}:null;}})[_0xa88d('0x22')](respondWithResult(_0x446194,null))[_0xa88d('0x3e')](handleError(_0x446194,null));};exports['getSubjects']=function(_0x34a3aa,_0x2e0553,_0x2f4c2a){var _0x16585f={};var _0x7ef126={};var _0x4a3cc2;var _0x5d12a8;return db[_0xa88d('0x27')][_0xa88d('0x42')]({'where':{'id':_0x34a3aa['params']['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0x2e0553,null))[_0xa88d('0x22')](function(_0x244aa4){if(_0x244aa4){_0x4a3cc2=_0x244aa4;_0x7ef126[_0xa88d('0x29')]=_[_0xa88d('0x2b')](db[_0xa88d('0x43')][_0xa88d('0x44')]);_0x7ef126['query']=_[_0xa88d('0x2b')](_0x34a3aa[_0xa88d('0x2a')]);_0x7ef126[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0x7ef126['model'],_0x7ef126[_0xa88d('0x2a')]);_0x16585f[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0x7ef126[_0xa88d('0x29')],qs[_0xa88d('0x2f')](_0x34a3aa[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x16585f[_0xa88d('0x2d')]=_0x16585f[_0xa88d('0x2d')]['length']?_0x16585f[_0xa88d('0x2d')]:_0x7ef126[_0xa88d('0x29')];_0x16585f[_0xa88d('0x45')]=qs[_0xa88d('0x33')](_0x34a3aa[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x16585f[_0xa88d('0x34')]=qs[_0xa88d('0x2c')](_[_0xa88d('0x35')](_0x34a3aa['query'],_0x7ef126[_0xa88d('0x2c')]));if(_0x34a3aa[_0xa88d('0x2a')][_0xa88d('0x39')]){_0x16585f[_0xa88d('0x34')]=_[_0xa88d('0x36')](_0x16585f['where'],{'$or':_['map'](_0x16585f[_0xa88d('0x2d')],function(_0x3aea99){var _0x398fd3={};_0x398fd3[_0x3aea99]={'$like':'%'+_0x34a3aa['query'][_0xa88d('0x39')]+'%'};return _0x398fd3;})});}_0x16585f=_[_0xa88d('0x36')]({},_0x16585f,_0x34a3aa[_0xa88d('0x3a')]);return _0x4a3cc2[_0xa88d('0x47')](_0x16585f);}})[_0xa88d('0x22')](function(_0x7d6263){if(_0x7d6263){_0x5d12a8=_0x7d6263[_0xa88d('0x30')];if(!_0x34a3aa[_0xa88d('0x2a')]['hasOwnProperty'](_0xa88d('0x32'))){_0x16585f[_0xa88d('0x1b')]=qs[_0xa88d('0x1b')](_0x34a3aa[_0xa88d('0x2a')][_0xa88d('0x1b')]);_0x16585f['offset']=qs[_0xa88d('0x1a')](_0x34a3aa[_0xa88d('0x2a')]['offset']);}return _0x4a3cc2[_0xa88d('0x47')](_0x16585f);}})[_0xa88d('0x22')](function(_0x5bb43a){if(_0x5bb43a){return _0x5bb43a?{'count':_0x5d12a8,'rows':_0x5bb43a}:null;}})['then'](respondWithResult(_0x2e0553,null))[_0xa88d('0x3e')](handleError(_0x2e0553,null));};exports[_0xa88d('0x48')]=function(_0x15abfe,_0x1bb27c,_0x130843){var _0x4adb9b={};var _0x327de6={};var _0x29834d;var _0x32a18d;return db['FreshdeskConfiguration'][_0xa88d('0x42')]({'where':{'id':_0x15abfe['params']['id']}})['then'](handleEntityNotFound(_0x1bb27c,null))[_0xa88d('0x22')](function(_0x3948bf){if(_0x3948bf){_0x29834d=_0x3948bf;_0x327de6[_0xa88d('0x29')]=_[_0xa88d('0x2b')](db[_0xa88d('0x43')][_0xa88d('0x44')]);_0x327de6[_0xa88d('0x2a')]=_[_0xa88d('0x2b')](_0x15abfe['query']);_0x327de6[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0x327de6[_0xa88d('0x29')],_0x327de6[_0xa88d('0x2a')]);_0x4adb9b[_0xa88d('0x2d')]=_[_0xa88d('0x2e')](_0x327de6[_0xa88d('0x29')],qs['fields'](_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x4adb9b[_0xa88d('0x2d')]=_0x4adb9b[_0xa88d('0x2d')]['length']?_0x4adb9b[_0xa88d('0x2d')]:_0x327de6[_0xa88d('0x29')];_0x4adb9b[_0xa88d('0x45')]=qs[_0xa88d('0x33')](_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x4adb9b[_0xa88d('0x34')]=qs[_0xa88d('0x2c')](_['pick'](_0x15abfe[_0xa88d('0x2a')],_0x327de6['filters']));if(_0x15abfe['query'][_0xa88d('0x39')]){_0x4adb9b['where']=_[_0xa88d('0x36')](_0x4adb9b[_0xa88d('0x34')],{'$or':_[_0xa88d('0x26')](_0x4adb9b['attributes'],function(_0x4a6520){var _0x36477d={};_0x36477d[_0x4a6520]={'$like':'%'+_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x39')]+'%'};return _0x36477d;})});}_0x4adb9b=_[_0xa88d('0x36')]({},_0x4adb9b,_0x15abfe[_0xa88d('0x3a')]);return _0x29834d[_0xa88d('0x48')](_0x4adb9b);}})[_0xa88d('0x22')](function(_0x5530fd){if(_0x5530fd){_0x32a18d=_0x5530fd[_0xa88d('0x30')];if(!_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x31')](_0xa88d('0x32'))){_0x4adb9b[_0xa88d('0x1b')]=qs[_0xa88d('0x1b')](_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x1b')]);_0x4adb9b[_0xa88d('0x1a')]=qs['offset'](_0x15abfe[_0xa88d('0x2a')][_0xa88d('0x1a')]);}return _0x29834d[_0xa88d('0x48')](_0x4adb9b);}})[_0xa88d('0x22')](function(_0x36d18c){if(_0x36d18c){return _0x36d18c?{'count':_0x32a18d,'rows':_0x36d18c}:null;}})['then'](respondWithResult(_0x1bb27c,null))[_0xa88d('0x3e')](handleError(_0x1bb27c,null));};exports[_0xa88d('0x49')]=function(_0x23de05,_0x2c5d3f,_0x36c69e){var _0x1b165e={};var _0xa5cda={};var _0x443486;var _0x5f0a99;return db[_0xa88d('0x27')][_0xa88d('0x42')]({'where':{'id':_0x23de05[_0xa88d('0x41')]['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0x2c5d3f,null))[_0xa88d('0x22')](function(_0xe55123){if(_0xe55123){_0x443486=_0xe55123;_0xa5cda[_0xa88d('0x29')]=_[_0xa88d('0x2b')](db[_0xa88d('0x4a')]['rawAttributes']);_0xa5cda[_0xa88d('0x2a')]=_[_0xa88d('0x2b')](_0x23de05['query']);_0xa5cda[_0xa88d('0x2c')]=_[_0xa88d('0x2e')](_0xa5cda['model'],_0xa5cda[_0xa88d('0x2a')]);_0x1b165e['attributes']=_[_0xa88d('0x2e')](_0xa5cda['model'],qs[_0xa88d('0x2f')](_0x23de05[_0xa88d('0x2a')][_0xa88d('0x2f')]));_0x1b165e['attributes']=_0x1b165e[_0xa88d('0x2d')][_0xa88d('0x30')]?_0x1b165e[_0xa88d('0x2d')]:_0xa5cda[_0xa88d('0x29')];_0x1b165e[_0xa88d('0x45')]=qs[_0xa88d('0x33')](_0x23de05[_0xa88d('0x2a')][_0xa88d('0x33')]);_0x1b165e['where']=qs['filters'](_[_0xa88d('0x35')](_0x23de05['query'],_0xa5cda[_0xa88d('0x2c')]));if(_0x23de05[_0xa88d('0x2a')][_0xa88d('0x39')]){_0x1b165e['where']=_[_0xa88d('0x36')](_0x1b165e[_0xa88d('0x34')],{'$or':_[_0xa88d('0x26')](_0x1b165e['attributes'],function(_0x4f40f1){var _0x563b2e={};_0x563b2e[_0x4f40f1]={'$like':'%'+_0x23de05[_0xa88d('0x2a')]['filter']+'%'};return _0x563b2e;})});}_0x1b165e=_[_0xa88d('0x36')]({},_0x1b165e,_0x23de05['options']);return _0x443486[_0xa88d('0x49')](_0x1b165e);}})[_0xa88d('0x22')](function(_0x17805b){if(_0x17805b){_0x5f0a99=_0x17805b['length'];if(!_0x23de05['query'][_0xa88d('0x31')](_0xa88d('0x32'))){_0x1b165e[_0xa88d('0x1b')]=qs[_0xa88d('0x1b')](_0x23de05['query'][_0xa88d('0x1b')]);_0x1b165e[_0xa88d('0x1a')]=qs[_0xa88d('0x1a')](_0x23de05[_0xa88d('0x2a')][_0xa88d('0x1a')]);}return _0x443486[_0xa88d('0x49')](_0x1b165e);}})[_0xa88d('0x22')](function(_0x346170){if(_0x346170){return _0x346170?{'count':_0x5f0a99,'rows':_0x346170}:null;}})[_0xa88d('0x22')](respondWithResult(_0x2c5d3f,null))[_0xa88d('0x3e')](handleError(_0x2c5d3f,null));};exports[_0xa88d('0x4b')]=function(_0x2ef34f,_0xc7caf0,_0x5480dc){if(_0x2ef34f[_0xa88d('0x40')]['id']){delete _0x2ef34f['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2ef34f[_0xa88d('0x41')]['id']}})[_0xa88d('0x22')](handleEntityNotFound(_0xc7caf0,null))[_0xa88d('0x22')](function(_0x179b09){if(_0x179b09){return _0x179b09['setTags'](_0x2ef34f[_0xa88d('0x40')][_0xa88d('0x4c')]||[]);}return null;})[_0xa88d('0x22')](respondWithResult(_0xc7caf0,null))[_0xa88d('0x3e')](handleError(_0xc7caf0,null));}; \ No newline at end of file +var _0x12bb=['sort','where','merge','filter','options','FreshdeskConfiguration','includeAll','findAll','show','params','keys','intersection','length','include','catch','create','body','find','getFields','rawAttributes','pick','map','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','lodash','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/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x4504c7,_0x5bba16){var _0x158d46=function(_0x5dada5){while(--_0x5dada5){_0x4504c7['push'](_0x4504c7['shift']());}};_0x158d46(++_0x5bba16);}(_0x12bb,0x16a));var _0xb12b=function(_0x2dd55a,_0x40e93a){_0x2dd55a=_0x2dd55a-0x0;var _0x406532=_0x12bb[_0x2dd55a];return _0x406532;};'use strict';var emlformat=require(_0xb12b('0x0'));var rimraf=require(_0xb12b('0x1'));var zipdir=require(_0xb12b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb12b('0x3'));var moment=require(_0xb12b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb12b('0x5'));var path=require(_0xb12b('0x6'));var sox=require(_0xb12b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb12b('0x8'));var squel=require('squel');var crypto=require(_0xb12b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb12b('0xa'));var toCsv=require(_0xb12b('0xb'));var querystring=require(_0xb12b('0xc'));var Papa=require('papaparse');var Redis=require(_0xb12b('0xd'));var authService=require(_0xb12b('0xe'));var qs=require(_0xb12b('0xf'));var as=require(_0xb12b('0x10'));var hardwareService=require(_0xb12b('0x11'));var logger=require(_0xb12b('0x12'))(_0xb12b('0x13'));var utils=require(_0xb12b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb12b('0x15'));var db=require(_0xb12b('0x16'))['db'];function respondWithStatusCode(_0x523709,_0x553819){_0x553819=_0x553819||0xcc;return function(_0x1767cc){if(_0x1767cc){return _0x523709[_0xb12b('0x17')](_0x553819);}return _0x523709[_0xb12b('0x18')](_0x553819)[_0xb12b('0x19')]();};}function respondWithResult(_0x393036,_0x432bb1){_0x432bb1=_0x432bb1||0xc8;return function(_0x4498fe){if(_0x4498fe){return _0x393036[_0xb12b('0x18')](_0x432bb1)[_0xb12b('0x1a')](_0x4498fe);}};}function respondWithFilteredResult(_0x26d727,_0x13c5f0){return function(_0x3e7367){if(_0x3e7367){var _0x1ddfc5=typeof _0x13c5f0['offset']===_0xb12b('0x1b')&&typeof _0x13c5f0[_0xb12b('0x1c')]===_0xb12b('0x1b');var _0x2beb9d=_0x3e7367[_0xb12b('0x1d')];var _0x5e05be=_0x1ddfc5?0x0:_0x13c5f0[_0xb12b('0x1e')];var _0x582cba=_0x1ddfc5?_0x3e7367[_0xb12b('0x1d')]:_0x13c5f0[_0xb12b('0x1e')]+_0x13c5f0['limit'];var _0x4c73e9;if(_0x582cba>=_0x2beb9d){_0x582cba=_0x2beb9d;_0x4c73e9=0xc8;}else{_0x4c73e9=0xce;}_0x26d727[_0xb12b('0x18')](_0x4c73e9);return _0x26d727[_0xb12b('0x1f')](_0xb12b('0x20'),_0x5e05be+'-'+_0x582cba+'/'+_0x2beb9d)[_0xb12b('0x1a')](_0x3e7367);}return null;};}function patchUpdates(_0x2e8285){return function(_0x384966){try{jsonpatch['apply'](_0x384966,_0x2e8285,!![]);}catch(_0x1a84b7){return BPromise[_0xb12b('0x21')](_0x1a84b7);}return _0x384966[_0xb12b('0x22')]();};}function saveUpdates(_0x3f5aac,_0x481deb){return function(_0x2e24c2){if(_0x2e24c2){return _0x2e24c2[_0xb12b('0x23')](_0x3f5aac)[_0xb12b('0x24')](function(_0x301283){return _0x301283;});}return null;};}function removeEntity(_0xd4af0a,_0x3a7d91){return function(_0x5ab4a9){if(_0x5ab4a9){return _0x5ab4a9[_0xb12b('0x25')]()[_0xb12b('0x24')](function(){_0xd4af0a[_0xb12b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e480,_0x22c41a){return function(_0x4222b2){if(!_0x4222b2){_0x51e480[_0xb12b('0x17')](0x194);}return _0x4222b2;};}function handleError(_0x2a1827,_0x464fe8){_0x464fe8=_0x464fe8||0x1f4;return function(_0x55d7a3){logger[_0xb12b('0x26')](_0x55d7a3[_0xb12b('0x27')]);if(_0x55d7a3[_0xb12b('0x28')]){delete _0x55d7a3[_0xb12b('0x28')];}_0x2a1827[_0xb12b('0x18')](_0x464fe8)[_0xb12b('0x29')](_0x55d7a3);};}exports[_0xb12b('0x2a')]=function(_0x21f526,_0x35e6b8){var _0x338bd5={},_0x479dba={},_0x4059ea={'count':0x0,'rows':[]};var _0x5e675f=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x268fbb){return{'name':_0x268fbb['fieldName'],'type':_0x268fbb[_0xb12b('0x2b')][_0xb12b('0x2c')]};});_0x479dba[_0xb12b('0x2d')]=_['map'](_0x5e675f,_0xb12b('0x28'));_0x479dba[_0xb12b('0x2e')]=_['keys'](_0x21f526['query']);_0x479dba[_0xb12b('0x2f')]=_['intersection'](_0x479dba[_0xb12b('0x2d')],_0x479dba[_0xb12b('0x2e')]);_0x338bd5[_0xb12b('0x30')]=_['intersection'](_0x479dba[_0xb12b('0x2d')],qs[_0xb12b('0x31')](_0x21f526[_0xb12b('0x2e')][_0xb12b('0x31')]));_0x338bd5[_0xb12b('0x30')]=_0x338bd5[_0xb12b('0x30')]['length']?_0x338bd5[_0xb12b('0x30')]:_0x479dba[_0xb12b('0x2d')];if(!_0x21f526[_0xb12b('0x2e')][_0xb12b('0x32')](_0xb12b('0x33'))){_0x338bd5[_0xb12b('0x1c')]=qs[_0xb12b('0x1c')](_0x21f526[_0xb12b('0x2e')][_0xb12b('0x1c')]);_0x338bd5[_0xb12b('0x1e')]=qs['offset'](_0x21f526[_0xb12b('0x2e')]['offset']);}_0x338bd5[_0xb12b('0x34')]=qs[_0xb12b('0x35')](_0x21f526[_0xb12b('0x2e')][_0xb12b('0x35')]);_0x338bd5[_0xb12b('0x36')]=qs[_0xb12b('0x2f')](_['pick'](_0x21f526['query'],_0x479dba[_0xb12b('0x2f')]),_0x5e675f);if(_0x21f526['query']['filter']){_0x338bd5[_0xb12b('0x36')]=_[_0xb12b('0x37')](_0x338bd5[_0xb12b('0x36')],{'$or':_['map'](_0x5e675f,function(_0x539389){if(_0x539389[_0xb12b('0x2b')]!=='VIRTUAL'){var _0xff91de={};_0xff91de[_0x539389[_0xb12b('0x28')]]={'$like':'%'+_0x21f526[_0xb12b('0x2e')][_0xb12b('0x38')]+'%'};return _0xff91de;}})});}_0x338bd5=_[_0xb12b('0x37')]({},_0x338bd5,_0x21f526[_0xb12b('0x39')]);var _0x273270={'where':_0x338bd5[_0xb12b('0x36')]};return db[_0xb12b('0x3a')][_0xb12b('0x1d')](_0x273270)['then'](function(_0x2c4c3e){_0x4059ea[_0xb12b('0x1d')]=_0x2c4c3e;if(_0x21f526[_0xb12b('0x2e')][_0xb12b('0x3b')]){_0x338bd5['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xb12b('0x3c')](_0x338bd5);})[_0xb12b('0x24')](function(_0x1c4620){_0x4059ea['rows']=_0x1c4620;return _0x4059ea;})['then'](respondWithFilteredResult(_0x35e6b8,_0x338bd5))['catch'](handleError(_0x35e6b8,null));};exports[_0xb12b('0x3d')]=function(_0x53dce1,_0x3ca59a){var _0x4e2585={'raw':![],'where':{'id':_0x53dce1[_0xb12b('0x3e')]['id']}},_0x172acd={};_0x172acd[_0xb12b('0x2d')]=_[_0xb12b('0x3f')](db['FreshdeskConfiguration']['rawAttributes']);_0x172acd[_0xb12b('0x2e')]=_[_0xb12b('0x3f')](_0x53dce1[_0xb12b('0x2e')]);_0x172acd[_0xb12b('0x2f')]=_['intersection'](_0x172acd['model'],_0x172acd['query']);_0x4e2585[_0xb12b('0x30')]=_[_0xb12b('0x40')](_0x172acd[_0xb12b('0x2d')],qs['fields'](_0x53dce1[_0xb12b('0x2e')][_0xb12b('0x31')]));_0x4e2585[_0xb12b('0x30')]=_0x4e2585[_0xb12b('0x30')][_0xb12b('0x41')]?_0x4e2585[_0xb12b('0x30')]:_0x172acd[_0xb12b('0x2d')];if(_0x53dce1[_0xb12b('0x2e')]['includeAll']){_0x4e2585[_0xb12b('0x42')]=[{'all':!![]}];}_0x4e2585=_[_0xb12b('0x37')]({},_0x4e2585,_0x53dce1[_0xb12b('0x39')]);return db['FreshdeskConfiguration']['find'](_0x4e2585)[_0xb12b('0x24')](handleEntityNotFound(_0x3ca59a,null))[_0xb12b('0x24')](respondWithResult(_0x3ca59a,null))[_0xb12b('0x43')](handleError(_0x3ca59a,null));};exports[_0xb12b('0x44')]=function(_0x1a2f7c,_0x54e10e){return db[_0xb12b('0x3a')][_0xb12b('0x44')](_0x1a2f7c['body'],{})['then'](respondWithResult(_0x54e10e,0xc9))['catch'](handleError(_0x54e10e,null));};exports[_0xb12b('0x23')]=function(_0xa56ba3,_0x36c899){if(_0xa56ba3[_0xb12b('0x45')]['id']){delete _0xa56ba3[_0xb12b('0x45')]['id'];}return db[_0xb12b('0x3a')][_0xb12b('0x46')]({'where':{'id':_0xa56ba3['params']['id']}})[_0xb12b('0x24')](handleEntityNotFound(_0x36c899,null))['then'](saveUpdates(_0xa56ba3[_0xb12b('0x45')],null))[_0xb12b('0x24')](respondWithResult(_0x36c899,null))[_0xb12b('0x43')](handleError(_0x36c899,null));};exports[_0xb12b('0x25')]=function(_0x34f030,_0x39416b){return db[_0xb12b('0x3a')]['find']({'where':{'id':_0x34f030['params']['id']}})['then'](handleEntityNotFound(_0x39416b,null))[_0xb12b('0x24')](removeEntity(_0x39416b,null))['catch'](handleError(_0x39416b,null));};exports[_0xb12b('0x47')]=function(_0x257057,_0x51e8c0,_0x500066){var _0x5b01fd={};var _0x342fba={};var _0x707785;var _0x1fb1f6;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x257057[_0xb12b('0x3e')]['id']}})[_0xb12b('0x24')](handleEntityNotFound(_0x51e8c0,null))[_0xb12b('0x24')](function(_0x1d8f99){if(_0x1d8f99){_0x707785=_0x1d8f99;_0x342fba['model']=_[_0xb12b('0x3f')](db['FreshdeskField'][_0xb12b('0x48')]);_0x342fba['query']=_[_0xb12b('0x3f')](_0x257057[_0xb12b('0x2e')]);_0x342fba[_0xb12b('0x2f')]=_['intersection'](_0x342fba[_0xb12b('0x2d')],_0x342fba[_0xb12b('0x2e')]);_0x5b01fd['attributes']=_['intersection'](_0x342fba[_0xb12b('0x2d')],qs[_0xb12b('0x31')](_0x257057[_0xb12b('0x2e')][_0xb12b('0x31')]));_0x5b01fd[_0xb12b('0x30')]=_0x5b01fd[_0xb12b('0x30')][_0xb12b('0x41')]?_0x5b01fd[_0xb12b('0x30')]:_0x342fba['model'];_0x5b01fd['order']=qs[_0xb12b('0x35')](_0x257057[_0xb12b('0x2e')]['sort']);_0x5b01fd[_0xb12b('0x36')]=qs[_0xb12b('0x2f')](_[_0xb12b('0x49')](_0x257057['query'],_0x342fba[_0xb12b('0x2f')]));if(_0x257057[_0xb12b('0x2e')][_0xb12b('0x38')]){_0x5b01fd['where']=_[_0xb12b('0x37')](_0x5b01fd['where'],{'$or':_[_0xb12b('0x4a')](_0x5b01fd['attributes'],function(_0x3180db){var _0x231be9={};_0x231be9[_0x3180db]={'$like':'%'+_0x257057[_0xb12b('0x2e')][_0xb12b('0x38')]+'%'};return _0x231be9;})});}_0x5b01fd=_[_0xb12b('0x37')]({},_0x5b01fd,_0x257057[_0xb12b('0x39')]);return _0x707785[_0xb12b('0x47')](_0x5b01fd);}})[_0xb12b('0x24')](function(_0x55fb09){if(_0x55fb09){_0x1fb1f6=_0x55fb09[_0xb12b('0x41')];if(!_0x257057[_0xb12b('0x2e')][_0xb12b('0x32')]('nolimit')){_0x5b01fd[_0xb12b('0x1c')]=qs[_0xb12b('0x1c')](_0x257057[_0xb12b('0x2e')][_0xb12b('0x1c')]);_0x5b01fd['offset']=qs['offset'](_0x257057[_0xb12b('0x2e')][_0xb12b('0x1e')]);}return _0x707785['getFields'](_0x5b01fd);}})[_0xb12b('0x24')](function(_0x27f661){if(_0x27f661){return _0x27f661?{'count':_0x1fb1f6,'rows':_0x27f661}:null;}})[_0xb12b('0x24')](respondWithResult(_0x51e8c0,null))[_0xb12b('0x43')](handleError(_0x51e8c0,null));};exports['getSubjects']=function(_0x29c5f1,_0x26e288,_0x585e41){var _0x593117={};var _0x2e1d1d={};var _0x47eade;var _0x1dc606;return db[_0xb12b('0x3a')][_0xb12b('0x4b')]({'where':{'id':_0x29c5f1[_0xb12b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x26e288,null))['then'](function(_0x59ae4f){if(_0x59ae4f){_0x47eade=_0x59ae4f;_0x2e1d1d[_0xb12b('0x2d')]=_[_0xb12b('0x3f')](db[_0xb12b('0x4c')][_0xb12b('0x48')]);_0x2e1d1d[_0xb12b('0x2e')]=_['keys'](_0x29c5f1['query']);_0x2e1d1d['filters']=_['intersection'](_0x2e1d1d[_0xb12b('0x2d')],_0x2e1d1d[_0xb12b('0x2e')]);_0x593117['attributes']=_['intersection'](_0x2e1d1d[_0xb12b('0x2d')],qs[_0xb12b('0x31')](_0x29c5f1['query']['fields']));_0x593117[_0xb12b('0x30')]=_0x593117[_0xb12b('0x30')][_0xb12b('0x41')]?_0x593117[_0xb12b('0x30')]:_0x2e1d1d[_0xb12b('0x2d')];_0x593117[_0xb12b('0x34')]=qs['sort'](_0x29c5f1[_0xb12b('0x2e')][_0xb12b('0x35')]);_0x593117[_0xb12b('0x36')]=qs[_0xb12b('0x2f')](_[_0xb12b('0x49')](_0x29c5f1[_0xb12b('0x2e')],_0x2e1d1d[_0xb12b('0x2f')]));if(_0x29c5f1['query'][_0xb12b('0x38')]){_0x593117['where']=_[_0xb12b('0x37')](_0x593117[_0xb12b('0x36')],{'$or':_[_0xb12b('0x4a')](_0x593117[_0xb12b('0x30')],function(_0x1e46b6){var _0x4d656f={};_0x4d656f[_0x1e46b6]={'$like':'%'+_0x29c5f1['query'][_0xb12b('0x38')]+'%'};return _0x4d656f;})});}_0x593117=_[_0xb12b('0x37')]({},_0x593117,_0x29c5f1[_0xb12b('0x39')]);return _0x47eade[_0xb12b('0x4d')](_0x593117);}})[_0xb12b('0x24')](function(_0x127379){if(_0x127379){_0x1dc606=_0x127379[_0xb12b('0x41')];if(!_0x29c5f1[_0xb12b('0x2e')][_0xb12b('0x32')](_0xb12b('0x33'))){_0x593117[_0xb12b('0x1c')]=qs[_0xb12b('0x1c')](_0x29c5f1[_0xb12b('0x2e')]['limit']);_0x593117[_0xb12b('0x1e')]=qs[_0xb12b('0x1e')](_0x29c5f1['query'][_0xb12b('0x1e')]);}return _0x47eade[_0xb12b('0x4d')](_0x593117);}})[_0xb12b('0x24')](function(_0x287147){if(_0x287147){return _0x287147?{'count':_0x1dc606,'rows':_0x287147}:null;}})[_0xb12b('0x24')](respondWithResult(_0x26e288,null))[_0xb12b('0x43')](handleError(_0x26e288,null));};exports[_0xb12b('0x4e')]=function(_0x4d21a0,_0x4421c8,_0x3f79f4){var _0x512d47={};var _0x119aec={};var _0xedeec;var _0x25adc5;return db['FreshdeskConfiguration'][_0xb12b('0x4b')]({'where':{'id':_0x4d21a0['params']['id']}})[_0xb12b('0x24')](handleEntityNotFound(_0x4421c8,null))[_0xb12b('0x24')](function(_0x152e1d){if(_0x152e1d){_0xedeec=_0x152e1d;_0x119aec[_0xb12b('0x2d')]=_[_0xb12b('0x3f')](db[_0xb12b('0x4c')][_0xb12b('0x48')]);_0x119aec[_0xb12b('0x2e')]=_[_0xb12b('0x3f')](_0x4d21a0['query']);_0x119aec[_0xb12b('0x2f')]=_[_0xb12b('0x40')](_0x119aec['model'],_0x119aec[_0xb12b('0x2e')]);_0x512d47[_0xb12b('0x30')]=_['intersection'](_0x119aec['model'],qs[_0xb12b('0x31')](_0x4d21a0[_0xb12b('0x2e')][_0xb12b('0x31')]));_0x512d47[_0xb12b('0x30')]=_0x512d47[_0xb12b('0x30')][_0xb12b('0x41')]?_0x512d47[_0xb12b('0x30')]:_0x119aec[_0xb12b('0x2d')];_0x512d47['order']=qs['sort'](_0x4d21a0[_0xb12b('0x2e')][_0xb12b('0x35')]);_0x512d47[_0xb12b('0x36')]=qs['filters'](_[_0xb12b('0x49')](_0x4d21a0[_0xb12b('0x2e')],_0x119aec['filters']));if(_0x4d21a0['query']['filter']){_0x512d47['where']=_[_0xb12b('0x37')](_0x512d47['where'],{'$or':_[_0xb12b('0x4a')](_0x512d47[_0xb12b('0x30')],function(_0x52e02f){var _0x4261e0={};_0x4261e0[_0x52e02f]={'$like':'%'+_0x4d21a0[_0xb12b('0x2e')][_0xb12b('0x38')]+'%'};return _0x4261e0;})});}_0x512d47=_[_0xb12b('0x37')]({},_0x512d47,_0x4d21a0['options']);return _0xedeec['getDescriptions'](_0x512d47);}})[_0xb12b('0x24')](function(_0x56060e){if(_0x56060e){_0x25adc5=_0x56060e[_0xb12b('0x41')];if(!_0x4d21a0[_0xb12b('0x2e')][_0xb12b('0x32')](_0xb12b('0x33'))){_0x512d47[_0xb12b('0x1c')]=qs[_0xb12b('0x1c')](_0x4d21a0[_0xb12b('0x2e')][_0xb12b('0x1c')]);_0x512d47['offset']=qs['offset'](_0x4d21a0['query']['offset']);}return _0xedeec['getDescriptions'](_0x512d47);}})['then'](function(_0x18ed2d){if(_0x18ed2d){return _0x18ed2d?{'count':_0x25adc5,'rows':_0x18ed2d}:null;}})[_0xb12b('0x24')](respondWithResult(_0x4421c8,null))[_0xb12b('0x43')](handleError(_0x4421c8,null));};exports[_0xb12b('0x4f')]=function(_0x163582,_0x1ca682,_0x9f8a2a){var _0x20bfc6={};var _0x1aa90b={};var _0x4bd1c3;var _0x4e909d;return db[_0xb12b('0x3a')]['findOne']({'where':{'id':_0x163582[_0xb12b('0x3e')]['id']}})[_0xb12b('0x24')](handleEntityNotFound(_0x1ca682,null))[_0xb12b('0x24')](function(_0x3e2c39){if(_0x3e2c39){_0x4bd1c3=_0x3e2c39;_0x1aa90b[_0xb12b('0x2d')]=_[_0xb12b('0x3f')](db[_0xb12b('0x50')][_0xb12b('0x48')]);_0x1aa90b[_0xb12b('0x2e')]=_[_0xb12b('0x3f')](_0x163582[_0xb12b('0x2e')]);_0x1aa90b[_0xb12b('0x2f')]=_[_0xb12b('0x40')](_0x1aa90b['model'],_0x1aa90b[_0xb12b('0x2e')]);_0x20bfc6['attributes']=_[_0xb12b('0x40')](_0x1aa90b[_0xb12b('0x2d')],qs[_0xb12b('0x31')](_0x163582[_0xb12b('0x2e')][_0xb12b('0x31')]));_0x20bfc6[_0xb12b('0x30')]=_0x20bfc6[_0xb12b('0x30')][_0xb12b('0x41')]?_0x20bfc6['attributes']:_0x1aa90b['model'];_0x20bfc6[_0xb12b('0x34')]=qs['sort'](_0x163582[_0xb12b('0x2e')][_0xb12b('0x35')]);_0x20bfc6[_0xb12b('0x36')]=qs[_0xb12b('0x2f')](_['pick'](_0x163582[_0xb12b('0x2e')],_0x1aa90b['filters']));if(_0x163582[_0xb12b('0x2e')]['filter']){_0x20bfc6[_0xb12b('0x36')]=_[_0xb12b('0x37')](_0x20bfc6['where'],{'$or':_[_0xb12b('0x4a')](_0x20bfc6['attributes'],function(_0x5e8093){var _0x430e8f={};_0x430e8f[_0x5e8093]={'$like':'%'+_0x163582['query']['filter']+'%'};return _0x430e8f;})});}_0x20bfc6=_[_0xb12b('0x37')]({},_0x20bfc6,_0x163582[_0xb12b('0x39')]);return _0x4bd1c3[_0xb12b('0x4f')](_0x20bfc6);}})['then'](function(_0x29ca7d){if(_0x29ca7d){_0x4e909d=_0x29ca7d[_0xb12b('0x41')];if(!_0x163582[_0xb12b('0x2e')][_0xb12b('0x32')]('nolimit')){_0x20bfc6['limit']=qs[_0xb12b('0x1c')](_0x163582[_0xb12b('0x2e')][_0xb12b('0x1c')]);_0x20bfc6[_0xb12b('0x1e')]=qs[_0xb12b('0x1e')](_0x163582['query'][_0xb12b('0x1e')]);}return _0x4bd1c3[_0xb12b('0x4f')](_0x20bfc6);}})['then'](function(_0x5e5136){if(_0x5e5136){return _0x5e5136?{'count':_0x4e909d,'rows':_0x5e5136}:null;}})['then'](respondWithResult(_0x1ca682,null))[_0xb12b('0x43')](handleError(_0x1ca682,null));};exports[_0xb12b('0x51')]=function(_0x1aba31,_0x4ff241,_0x110a11){if(_0x1aba31[_0xb12b('0x45')]['id']){delete _0x1aba31[_0xb12b('0x45')]['id'];}return db[_0xb12b('0x3a')]['findOne']({'where':{'id':_0x1aba31[_0xb12b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4ff241,null))[_0xb12b('0x24')](function(_0x755159){if(_0x755159){return _0x755159['setTags'](_0x1aba31[_0xb12b('0x45')][_0xb12b('0x52')]||[]);}return null;})['then'](respondWithResult(_0x4ff241,null))[_0xb12b('0x43')](handleError(_0x4ff241,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 435cb32..cfd47a3 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 _0x8719=['./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8719,0x10c));var _0x9871=function(_0x58ed9a,_0x9e00e2){_0x58ed9a=_0x58ed9a-0x0;var _0x1a0ff2=_0x8719[_0x58ed9a];return _0x1a0ff2;};'use strict';var _=require(_0x9871('0x0'));var util=require('util');var logger=require(_0x9871('0x1'))(_0x9871('0x2'));var moment=require('moment');var BPromise=require(_0x9871('0x3'));var rp=require(_0x9871('0x4'));var fs=require('fs');var path=require(_0x9871('0x5'));var rimraf=require(_0x9871('0x6'));var config=require(_0x9871('0x7'));var attributes=require(_0x9871('0x8'));module[_0x9871('0x9')]=function(_0x5627b6,_0x3f2b87){return _0x5627b6[_0x9871('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x9871('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b4e=['api','bluebird','request-promise','path','rimraf','exports','define','FreshdeskConfiguration','lodash'];(function(_0x9a5c18,_0x1a1bd0){var _0x2ccdce=function(_0x491f09){while(--_0x491f09){_0x9a5c18['push'](_0x9a5c18['shift']());}};_0x2ccdce(++_0x1a1bd0);}(_0x5b4e,0xc5));var _0xe5b4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5b4e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe5b4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe5b4('0x1'));var moment=require('moment');var BPromise=require(_0xe5b4('0x2'));var rp=require(_0xe5b4('0x3'));var fs=require('fs');var path=require(_0xe5b4('0x4'));var rimraf=require(_0xe5b4('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xe5b4('0x6')]=function(_0x206d10,_0x6b25d1){return _0x206d10[_0xe5b4('0x7')](_0xe5b4('0x8'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 2d064aa..0769ecc 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 _0x48a0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48a0,0xdf));var _0x048a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x48a0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x048a('0x0'));var util=require(_0x048a('0x1'));var moment=require(_0x048a('0x2'));var BPromise=require(_0x048a('0x3'));var rs=require(_0x048a('0x4'));var fs=require('fs');var Redis=require(_0x048a('0x5'));var db=require(_0x048a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x048a('0x7'))(_0x048a('0x8'));var config=require(_0x048a('0x9'));var jayson=require(_0x048a('0xa'));var client=jayson[_0x048a('0xb')][_0x048a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x330126,_0x4fd54c,_0x49f8f8){return new BPromise(function(_0xc64f4d,_0x4fb3cd){return client['request'](_0x330126,_0x49f8f8)['then'](function(_0x4fb12b){logger[_0x048a('0xd')](_0x048a('0xe'),_0x4fd54c,_0x048a('0xf'));logger[_0x048a('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4fd54c,_0x048a('0xf'),JSON[_0x048a('0x11')](_0x4fb12b));if(_0x4fb12b[_0x048a('0x12')]){if(_0x4fb12b[_0x048a('0x12')][_0x048a('0x13')]===0x1f4){logger[_0x048a('0x12')](_0x048a('0xe'),_0x4fd54c,_0x4fb12b[_0x048a('0x12')][_0x048a('0x14')]);return _0x4fb3cd(_0x4fb12b[_0x048a('0x12')][_0x048a('0x14')]);}logger[_0x048a('0x12')](_0x048a('0xe'),_0x4fd54c,_0x4fb12b[_0x048a('0x12')][_0x048a('0x14')]);return _0xc64f4d(_0x4fb12b[_0x048a('0x12')]['message']);}else{logger[_0x048a('0xd')](_0x048a('0xe'),_0x4fd54c,_0x048a('0xf'));_0xc64f4d(_0x4fb12b[_0x048a('0x15')][_0x048a('0x14')]);}})[_0x048a('0x16')](function(_0x33b11a){logger[_0x048a('0x12')](_0x048a('0xe'),_0x4fd54c,_0x33b11a);_0x4fb3cd(_0x33b11a);});});} \ No newline at end of file +var _0x589e=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xbce250,_0x2b8cfc){var _0x4de646=function(_0x15cb76){while(--_0x15cb76){_0xbce250['push'](_0xbce250['shift']());}};_0x4de646(++_0x2b8cfc);}(_0x589e,0x1a5));var _0xe589=function(_0x1f8edb,_0x405ff8){_0x1f8edb=_0x1f8edb-0x0;var _0x2be790=_0x589e[_0x1f8edb];return _0x2be790;};'use strict';var _=require(_0xe589('0x0'));var util=require(_0xe589('0x1'));var moment=require(_0xe589('0x2'));var BPromise=require(_0xe589('0x3'));var rs=require(_0xe589('0x4'));var fs=require('fs');var Redis=require(_0xe589('0x5'));var db=require(_0xe589('0x6'))['db'];var utils=require(_0xe589('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe589('0x8'));var jayson=require(_0xe589('0x9'));var client=jayson['client'][_0xe589('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465862,_0x87595b,_0x40ccad){return new BPromise(function(_0x1d63e0,_0x498d68){return client['request'](_0x465862,_0x40ccad)[_0xe589('0xb')](function(_0x2de4e1){logger[_0xe589('0xc')](_0xe589('0xd'),_0x87595b,_0xe589('0xe'));logger[_0xe589('0xf')](_0xe589('0x10'),_0x87595b,'request\x20sent',JSON[_0xe589('0x11')](_0x2de4e1));if(_0x2de4e1[_0xe589('0x12')]){if(_0x2de4e1[_0xe589('0x12')][_0xe589('0x13')]===0x1f4){logger[_0xe589('0x12')](_0xe589('0xd'),_0x87595b,_0x2de4e1['error'][_0xe589('0x14')]);return _0x498d68(_0x2de4e1[_0xe589('0x12')]['message']);}logger[_0xe589('0x12')](_0xe589('0xd'),_0x87595b,_0x2de4e1[_0xe589('0x12')]['message']);return _0x1d63e0(_0x2de4e1[_0xe589('0x12')]['message']);}else{logger['info'](_0xe589('0xd'),_0x87595b,_0xe589('0xe'));_0x1d63e0(_0x2de4e1['result']['message']);}})[_0xe589('0x15')](function(_0x2cfab4){logger[_0xe589('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x87595b,_0x2cfab4);_0x498d68(_0x2cfab4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 49630ec..6c482d9 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 _0x7519=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','post','create','put','isAuthenticated','delete','destroy','exports','multer'];(function(_0xa95950,_0x107291){var _0x5ba827=function(_0x57ad98){while(--_0x57ad98){_0xa95950['push'](_0xa95950['shift']());}};_0x5ba827(++_0x107291);}(_0x7519,0xbd));var _0x9751=function(_0x5030f4,_0x558ca8){_0x5030f4=_0x5030f4-0x0;var _0x4cc195=_0x7519[_0x5030f4];return _0x4cc195;};'use strict';var multer=require(_0x9751('0x0'));var util=require(_0x9751('0x1'));var path=require('path');var timeout=require(_0x9751('0x2'));var express=require(_0x9751('0x3'));var router=express[_0x9751('0x4')]();var fs_extra=require(_0x9751('0x5'));var auth=require(_0x9751('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9751('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9751('0x8')]('/',auth['isAuthenticated'](),controller[_0x9751('0x9')]);router[_0x9751('0x8')](_0x9751('0xa'),auth['isAuthenticated'](),controller[_0x9751('0xb')]);router[_0x9751('0xc')]('/',auth['isAuthenticated'](),controller[_0x9751('0xd')]);router[_0x9751('0xe')](_0x9751('0xa'),auth[_0x9751('0xf')](),controller['update']);router[_0x9751('0x10')](_0x9751('0xa'),auth['isAuthenticated'](),controller[_0x9751('0x11')]);module[_0x9751('0x12')]=router; \ No newline at end of file +var _0x3e13=['index','get','show','post','put','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated'];(function(_0x3be94a,_0x3ecec2){var _0x20706b=function(_0x35f045){while(--_0x35f045){_0x3be94a['push'](_0x3be94a['shift']());}};_0x20706b(++_0x3ecec2);}(_0x3e13,0xb3));var _0x33e1=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3e13[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x33e1('0x0'));var util=require(_0x33e1('0x1'));var path=require(_0x33e1('0x2'));var timeout=require(_0x33e1('0x3'));var express=require('express');var router=express[_0x33e1('0x4')]();var fs_extra=require(_0x33e1('0x5'));var auth=require(_0x33e1('0x6'));var interaction=require(_0x33e1('0x7'));var config=require(_0x33e1('0x8'));var controller=require(_0x33e1('0x9'));router['get']('/',auth[_0x33e1('0xa')](),controller[_0x33e1('0xb')]);router[_0x33e1('0xc')]('/:id',auth[_0x33e1('0xa')](),controller[_0x33e1('0xd')]);router[_0x33e1('0xe')]('/',auth[_0x33e1('0xa')](),controller['create']);router[_0x33e1('0xf')](_0x33e1('0x10'),auth[_0x33e1('0xa')](),controller[_0x33e1('0x11')]);router['delete']('/:id',auth[_0x33e1('0xa')](),controller['destroy']);module[_0x33e1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 706d3e5..5653040 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 _0xebf5=['exports','ENUM','variable','picklist','string','STRING','customVariable','sequelize'];(function(_0x16a200,_0x414bbd){var _0x106a31=function(_0x3380ad){while(--_0x3380ad){_0x16a200['push'](_0x16a200['shift']());}};_0x106a31(++_0x414bbd);}(_0xebf5,0x177));var _0x5ebf=function(_0x2c823e,_0x1067c9){_0x2c823e=_0x2c823e-0x0;var _0x21b297=_0xebf5[_0x2c823e];return _0x21b297;};'use strict';var Sequelize=require(_0x5ebf('0x0'));module[_0x5ebf('0x1')]={'type':{'type':Sequelize[_0x5ebf('0x2')]('string',_0x5ebf('0x3'),'customVariable','keyValue',_0x5ebf('0x4')),'defaultValue':_0x5ebf('0x5')},'content':{'type':Sequelize[_0x5ebf('0x6')]},'key':{'type':Sequelize[_0x5ebf('0x6')]},'keyType':{'type':Sequelize[_0x5ebf('0x2')](_0x5ebf('0x5'),'variable',_0x5ebf('0x7'))},'keyContent':{'type':Sequelize[_0x5ebf('0x6')]},'idField':{'type':Sequelize[_0x5ebf('0x6')]},'nameField':{'type':Sequelize[_0x5ebf('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe9d1=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x35d7e6,_0x498591){var _0x26e8dc=function(_0x4494e4){while(--_0x4494e4){_0x35d7e6['push'](_0x35d7e6['shift']());}};_0x26e8dc(++_0x498591);}(_0xe9d1,0x10b));var _0x1e9d=function(_0xf738ad,_0x5e1d7f){_0xf738ad=_0xf738ad-0x0;var _0x598570=_0xe9d1[_0xf738ad];return _0x598570;};'use strict';var Sequelize=require(_0x1e9d('0x0'));module[_0x1e9d('0x1')]={'type':{'type':Sequelize[_0x1e9d('0x2')](_0x1e9d('0x3'),_0x1e9d('0x4'),_0x1e9d('0x5'),_0x1e9d('0x6'),_0x1e9d('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1e9d('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1e9d('0x2')](_0x1e9d('0x3'),_0x1e9d('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x1e9d('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1e9d('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'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 f6e2629..5c157af 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 _0xcffe=['apply','reject','save','then','error','name','send','FreshdeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range'];(function(_0x587ccb,_0x325edd){var _0x361336=function(_0x236204){while(--_0x236204){_0x587ccb['push'](_0x587ccb['shift']());}};_0x361336(++_0x325edd);}(_0xcffe,0x1a1));var _0xecff=function(_0x558414,_0x58ea6e){_0x558414=_0x558414-0x0;var _0x343829=_0xcffe[_0x558414];return _0x343829;};'use strict';var emlformat=require(_0xecff('0x0'));var rimraf=require(_0xecff('0x1'));var zipdir=require(_0xecff('0x2'));var jsonpatch=require(_0xecff('0x3'));var rp=require(_0xecff('0x4'));var moment=require(_0xecff('0x5'));var BPromise=require(_0xecff('0x6'));var Mustache=require(_0xecff('0x7'));var util=require(_0xecff('0x8'));var path=require(_0xecff('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xecff('0xa'));var fs=require('fs');var fs_extra=require(_0xecff('0xb'));var _=require(_0xecff('0xc'));var squel=require(_0xecff('0xd'));var crypto=require(_0xecff('0xe'));var jsforce=require(_0xecff('0xf'));var deskjs=require(_0xecff('0x10'));var toCsv=require('to-csv');var querystring=require(_0xecff('0x11'));var Papa=require(_0xecff('0x12'));var Redis=require(_0xecff('0x13'));var authService=require(_0xecff('0x14'));var qs=require(_0xecff('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecff('0x16'));var logger=require(_0xecff('0x17'))(_0xecff('0x18'));var utils=require(_0xecff('0x19'));var config=require(_0xecff('0x1a'));var licenseUtil=require(_0xecff('0x1b'));var db=require(_0xecff('0x1c'))['db'];function respondWithStatusCode(_0x32627c,_0x3e907d){_0x3e907d=_0x3e907d||0xcc;return function(_0x151a79){if(_0x151a79){return _0x32627c[_0xecff('0x1d')](_0x3e907d);}return _0x32627c[_0xecff('0x1e')](_0x3e907d)[_0xecff('0x1f')]();};}function respondWithResult(_0xb8745f,_0x5495f9){_0x5495f9=_0x5495f9||0xc8;return function(_0x4b1893){if(_0x4b1893){return _0xb8745f[_0xecff('0x1e')](_0x5495f9)[_0xecff('0x20')](_0x4b1893);}};}function respondWithFilteredResult(_0x558ecd,_0x35ce1f){return function(_0x362ed0){if(_0x362ed0){var _0x3a7623=typeof _0x35ce1f['offset']==='undefined'&&typeof _0x35ce1f[_0xecff('0x21')]===_0xecff('0x22');var _0x53ff8e=_0x362ed0[_0xecff('0x23')];var _0x3adc81=_0x3a7623?0x0:_0x35ce1f[_0xecff('0x24')];var _0x2393db=_0x3a7623?_0x362ed0[_0xecff('0x23')]:_0x35ce1f[_0xecff('0x24')]+_0x35ce1f['limit'];var _0x229728;if(_0x2393db>=_0x53ff8e){_0x2393db=_0x53ff8e;_0x229728=0xc8;}else{_0x229728=0xce;}_0x558ecd[_0xecff('0x1e')](_0x229728);return _0x558ecd[_0xecff('0x25')](_0xecff('0x26'),_0x3adc81+'-'+_0x2393db+'/'+_0x53ff8e)['json'](_0x362ed0);}return null;};}function patchUpdates(_0x4bb94e){return function(_0x2e2bdd){try{jsonpatch[_0xecff('0x27')](_0x2e2bdd,_0x4bb94e,!![]);}catch(_0x333eb7){return BPromise[_0xecff('0x28')](_0x333eb7);}return _0x2e2bdd[_0xecff('0x29')]();};}function saveUpdates(_0x494754,_0x14378d){return function(_0x520d6d){if(_0x520d6d){return _0x520d6d['update'](_0x494754)[_0xecff('0x2a')](function(_0x4fdc8e){return _0x4fdc8e;});}return null;};}function removeEntity(_0x2447da,_0x49c0cd){return function(_0x389281){if(_0x389281){return _0x389281['destroy']()[_0xecff('0x2a')](function(){_0x2447da[_0xecff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f173d,_0x18f4d4){return function(_0x393312){if(!_0x393312){_0x9f173d[_0xecff('0x1d')](0x194);}return _0x393312;};}function handleError(_0x19202e,_0x493465){_0x493465=_0x493465||0x1f4;return function(_0x4f987b){logger[_0xecff('0x2b')](_0x4f987b['stack']);if(_0x4f987b[_0xecff('0x2c')]){delete _0x4f987b[_0xecff('0x2c')];}_0x19202e[_0xecff('0x1e')](_0x493465)[_0xecff('0x2d')](_0x4f987b);};}exports['index']=function(_0x4e7afa,_0x55502f){var _0x202ee0={},_0xabe5da={},_0x230d04={'count':0x0,'rows':[]};var _0x1e3175=_['map'](db[_0xecff('0x2e')][_0xecff('0x2f')],function(_0x1926a5){return{'name':_0x1926a5['fieldName'],'type':_0x1926a5[_0xecff('0x30')][_0xecff('0x31')]};});_0xabe5da[_0xecff('0x32')]=_[_0xecff('0x33')](_0x1e3175,'name');_0xabe5da[_0xecff('0x34')]=_[_0xecff('0x35')](_0x4e7afa['query']);_0xabe5da[_0xecff('0x36')]=_[_0xecff('0x37')](_0xabe5da[_0xecff('0x32')],_0xabe5da[_0xecff('0x34')]);_0x202ee0['attributes']=_[_0xecff('0x37')](_0xabe5da[_0xecff('0x32')],qs[_0xecff('0x38')](_0x4e7afa['query'][_0xecff('0x38')]));_0x202ee0[_0xecff('0x39')]=_0x202ee0[_0xecff('0x39')][_0xecff('0x3a')]?_0x202ee0[_0xecff('0x39')]:_0xabe5da[_0xecff('0x32')];if(!_0x4e7afa['query']['hasOwnProperty']('nolimit')){_0x202ee0[_0xecff('0x21')]=qs['limit'](_0x4e7afa[_0xecff('0x34')][_0xecff('0x21')]);_0x202ee0['offset']=qs[_0xecff('0x24')](_0x4e7afa[_0xecff('0x34')][_0xecff('0x24')]);}_0x202ee0['order']=qs[_0xecff('0x3b')](_0x4e7afa[_0xecff('0x34')][_0xecff('0x3b')]);_0x202ee0['where']=qs[_0xecff('0x36')](_[_0xecff('0x3c')](_0x4e7afa[_0xecff('0x34')],_0xabe5da[_0xecff('0x36')]),_0x1e3175);if(_0x4e7afa[_0xecff('0x34')][_0xecff('0x3d')]){_0x202ee0[_0xecff('0x3e')]=_[_0xecff('0x3f')](_0x202ee0[_0xecff('0x3e')],{'$or':_[_0xecff('0x33')](_0x1e3175,function(_0xb9a367){if(_0xb9a367['type']!==_0xecff('0x40')){var _0x23c8f1={};_0x23c8f1[_0xb9a367[_0xecff('0x2c')]]={'$like':'%'+_0x4e7afa[_0xecff('0x34')][_0xecff('0x3d')]+'%'};return _0x23c8f1;}})});}_0x202ee0=_[_0xecff('0x3f')]({},_0x202ee0,_0x4e7afa[_0xecff('0x41')]);var _0x2ed2ab={'where':_0x202ee0['where']};return db[_0xecff('0x2e')]['count'](_0x2ed2ab)[_0xecff('0x2a')](function(_0x344108){_0x230d04[_0xecff('0x23')]=_0x344108;if(_0x4e7afa[_0xecff('0x34')][_0xecff('0x42')]){_0x202ee0[_0xecff('0x43')]=[{'all':!![]}];}return db[_0xecff('0x2e')]['findAll'](_0x202ee0);})[_0xecff('0x2a')](function(_0x3dc857){_0x230d04['rows']=_0x3dc857;return _0x230d04;})['then'](respondWithFilteredResult(_0x55502f,_0x202ee0))[_0xecff('0x44')](handleError(_0x55502f,null));};exports[_0xecff('0x45')]=function(_0x27f0dd,_0x1f095e){var _0x47084b={'raw':!![],'where':{'id':_0x27f0dd['params']['id']}},_0xb9117c={};_0xb9117c[_0xecff('0x32')]=_[_0xecff('0x35')](db['FreshdeskField'][_0xecff('0x2f')]);_0xb9117c[_0xecff('0x34')]=_[_0xecff('0x35')](_0x27f0dd[_0xecff('0x34')]);_0xb9117c[_0xecff('0x36')]=_[_0xecff('0x37')](_0xb9117c['model'],_0xb9117c[_0xecff('0x34')]);_0x47084b[_0xecff('0x39')]=_[_0xecff('0x37')](_0xb9117c['model'],qs[_0xecff('0x38')](_0x27f0dd[_0xecff('0x34')][_0xecff('0x38')]));_0x47084b[_0xecff('0x39')]=_0x47084b['attributes'][_0xecff('0x3a')]?_0x47084b[_0xecff('0x39')]:_0xb9117c['model'];if(_0x27f0dd[_0xecff('0x34')][_0xecff('0x42')]){_0x47084b['include']=[{'all':!![]}];}_0x47084b=_[_0xecff('0x3f')]({},_0x47084b,_0x27f0dd['options']);return db[_0xecff('0x2e')][_0xecff('0x46')](_0x47084b)[_0xecff('0x2a')](handleEntityNotFound(_0x1f095e,null))[_0xecff('0x2a')](respondWithResult(_0x1f095e,null))[_0xecff('0x44')](handleError(_0x1f095e,null));};exports[_0xecff('0x47')]=function(_0x563f68,_0x596eb8){return db[_0xecff('0x2e')][_0xecff('0x47')](_0x563f68[_0xecff('0x48')],{})[_0xecff('0x2a')](respondWithResult(_0x596eb8,0xc9))[_0xecff('0x44')](handleError(_0x596eb8,null));};exports[_0xecff('0x49')]=function(_0x36c50f,_0x3ac749){if(_0x36c50f['body']['id']){delete _0x36c50f[_0xecff('0x48')]['id'];}return db[_0xecff('0x2e')]['find']({'where':{'id':_0x36c50f[_0xecff('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ac749,null))[_0xecff('0x2a')](saveUpdates(_0x36c50f[_0xecff('0x48')],null))['then'](respondWithResult(_0x3ac749,null))[_0xecff('0x44')](handleError(_0x3ac749,null));};exports[_0xecff('0x4b')]=function(_0x3e79f9,_0x188d08){return db[_0xecff('0x2e')]['find']({'where':{'id':_0x3e79f9['params']['id']}})[_0xecff('0x2a')](handleEntityNotFound(_0x188d08,null))[_0xecff('0x2a')](removeEntity(_0x188d08,null))[_0xecff('0x44')](handleError(_0x188d08,null));}; \ No newline at end of file +var _0x80df=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x5bb3fb,_0x399b73){var _0x1e8324=function(_0x429677){while(--_0x429677){_0x5bb3fb['push'](_0x5bb3fb['shift']());}};_0x1e8324(++_0x399b73);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x29')]();});}};}function handleEntityNotFound(_0x323540,_0x947bb){return function(_0x4986ad){if(!_0x4986ad){_0x323540[_0xf80d('0x2a')](0x194);}return _0x4986ad;};}function handleError(_0x14399e,_0xf4c3af){_0xf4c3af=_0xf4c3af||0x1f4;return function(_0x2a4597){logger[_0xf80d('0x2b')](_0x2a4597[_0xf80d('0x2c')]);if(_0x2a4597[_0xf80d('0x2d')]){delete _0x2a4597[_0xf80d('0x2d')];}_0x14399e[_0xf80d('0x1c')](_0xf4c3af)['send'](_0x2a4597);};}exports[_0xf80d('0x2e')]=function(_0x1603a4,_0x3e2c8c){var _0x368865={},_0x3ce924={},_0x5eab42={'count':0x0,'rows':[]};var _0x401cfb=_['map'](db[_0xf80d('0x2f')][_0xf80d('0x30')],function(_0x214bff){return{'name':_0x214bff[_0xf80d('0x31')],'type':_0x214bff['type']['key']};});_0x3ce924[_0xf80d('0x32')]=_['map'](_0x401cfb,_0xf80d('0x2d'));_0x3ce924[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x1603a4['query']);_0x3ce924[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x3ce924['model'],_0x3ce924[_0xf80d('0x33')]);_0x368865[_0xf80d('0x37')]=_[_0xf80d('0x36')](_0x3ce924['model'],qs[_0xf80d('0x38')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x38')]));_0x368865[_0xf80d('0x37')]=_0x368865[_0xf80d('0x37')]['length']?_0x368865[_0xf80d('0x37')]:_0x3ce924['model'];if(!_0x1603a4[_0xf80d('0x33')][_0xf80d('0x39')](_0xf80d('0x3a'))){_0x368865[_0xf80d('0x20')]=qs['limit'](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x20')]);_0x368865[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x1603a4['query'][_0xf80d('0x1e')]);}_0x368865[_0xf80d('0x3b')]=qs[_0xf80d('0x3c')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3c')]);_0x368865[_0xf80d('0x3d')]=qs[_0xf80d('0x35')](_[_0xf80d('0x3e')](_0x1603a4['query'],_0x3ce924[_0xf80d('0x35')]),_0x401cfb);if(_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3f')]){_0x368865['where']=_[_0xf80d('0x40')](_0x368865['where'],{'$or':_[_0xf80d('0x41')](_0x401cfb,function(_0x1a4ab7){if(_0x1a4ab7[_0xf80d('0x42')]!==_0xf80d('0x43')){var _0x4a3c5e={};_0x4a3c5e[_0x1a4ab7['name']]={'$like':'%'+_0x1603a4['query'][_0xf80d('0x3f')]+'%'};return _0x4a3c5e;}})});}_0x368865=_[_0xf80d('0x40')]({},_0x368865,_0x1603a4[_0xf80d('0x44')]);var _0x4b9f1d={'where':_0x368865[_0xf80d('0x3d')]};return db[_0xf80d('0x2f')]['count'](_0x4b9f1d)[_0xf80d('0x27')](function(_0x511310){_0x5eab42[_0xf80d('0x21')]=_0x511310;if(_0x1603a4['query'][_0xf80d('0x45')]){_0x368865['include']=[{'all':!![]}];}return db[_0xf80d('0x2f')][_0xf80d('0x46')](_0x368865);})[_0xf80d('0x27')](function(_0x2cd371){_0x5eab42[_0xf80d('0x47')]=_0x2cd371;return _0x5eab42;})[_0xf80d('0x27')](respondWithFilteredResult(_0x3e2c8c,_0x368865))[_0xf80d('0x48')](handleError(_0x3e2c8c,null));};exports[_0xf80d('0x49')]=function(_0x99e531,_0x80f24a){var _0x1fcbad={'raw':!![],'where':{'id':_0x99e531[_0xf80d('0x4a')]['id']}},_0x437e44={};_0x437e44[_0xf80d('0x32')]=_[_0xf80d('0x34')](db[_0xf80d('0x2f')][_0xf80d('0x30')]);_0x437e44[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x99e531[_0xf80d('0x33')]);_0x437e44[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x437e44[_0xf80d('0x32')],_0x437e44[_0xf80d('0x33')]);_0x1fcbad[_0xf80d('0x37')]=_['intersection'](_0x437e44[_0xf80d('0x32')],qs[_0xf80d('0x38')](_0x99e531[_0xf80d('0x33')][_0xf80d('0x38')]));_0x1fcbad[_0xf80d('0x37')]=_0x1fcbad['attributes'][_0xf80d('0x4b')]?_0x1fcbad[_0xf80d('0x37')]:_0x437e44[_0xf80d('0x32')];if(_0x99e531[_0xf80d('0x33')][_0xf80d('0x45')]){_0x1fcbad[_0xf80d('0x4c')]=[{'all':!![]}];}_0x1fcbad=_[_0xf80d('0x40')]({},_0x1fcbad,_0x99e531[_0xf80d('0x44')]);return db[_0xf80d('0x2f')][_0xf80d('0x4d')](_0x1fcbad)[_0xf80d('0x27')](handleEntityNotFound(_0x80f24a,null))[_0xf80d('0x27')](respondWithResult(_0x80f24a,null))[_0xf80d('0x48')](handleError(_0x80f24a,null));};exports[_0xf80d('0x4e')]=function(_0x3a420d,_0x10d5b5){return db[_0xf80d('0x2f')]['create'](_0x3a420d[_0xf80d('0x4f')],{})[_0xf80d('0x27')](respondWithResult(_0x10d5b5,0xc9))[_0xf80d('0x48')](handleError(_0x10d5b5,null));};exports['update']=function(_0x3e5cf6,_0x1088ca){if(_0x3e5cf6['body']['id']){delete _0x3e5cf6['body']['id'];}return db[_0xf80d('0x2f')]['find']({'where':{'id':_0x3e5cf6[_0xf80d('0x4a')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1088ca,null))[_0xf80d('0x27')](saveUpdates(_0x3e5cf6[_0xf80d('0x4f')],null))[_0xf80d('0x27')](respondWithResult(_0x1088ca,null))[_0xf80d('0x48')](handleError(_0x1088ca,null));};exports[_0xf80d('0x28')]=function(_0x114132,_0x115d1f){return db[_0xf80d('0x2f')][_0xf80d('0x4d')]({'where':{'id':_0x114132[_0xf80d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x115d1f,null))[_0xf80d('0x27')](removeEntity(_0x115d1f,null))[_0xf80d('0x48')](handleError(_0x115d1f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index ee00760..0a47b4d 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 _0xee81=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash'];(function(_0x354c52,_0x29eb19){var _0x519bfe=function(_0x18bba0){while(--_0x18bba0){_0x354c52['push'](_0x354c52['shift']());}};_0x519bfe(++_0x29eb19);}(_0xee81,0x15e));var _0x1ee8=function(_0x65a1ee,_0x422702){_0x65a1ee=_0x65a1ee-0x0;var _0x252fcb=_0xee81[_0x65a1ee];return _0x252fcb;};'use strict';var _=require(_0x1ee8('0x0'));var util=require(_0x1ee8('0x1'));var logger=require(_0x1ee8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1ee8('0x3'));var rp=require(_0x1ee8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ee8('0x5'));var config=require(_0x1ee8('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x1ee8('0x7')]=function(_0xd6987,_0x1f303b){return _0xd6987[_0x1ee8('0x8')](_0x1ee8('0x9'),attributes,{'tableName':_0x1ee8('0xa'),'paranoid':![],'indexes':[{'name':_0x1ee8('0xb'),'fields':[_0x1ee8('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa232=['path','rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa232,0x141));var _0x2a23=function(_0x1869c1,_0x5f38af){_0x1869c1=_0x1869c1-0x0;var _0x5509f9=_0xa232[_0x1869c1];return _0x5509f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2a23('0x0'));var moment=require(_0x2a23('0x1'));var BPromise=require(_0x2a23('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a23('0x3'));var rimraf=require(_0x2a23('0x4'));var config=require('../../config/environment');var attributes=require(_0x2a23('0x5'));module[_0x2a23('0x6')]=function(_0x2e64a9,_0x4e805e){return _0x2e64a9['define'](_0x2a23('0x7'),attributes,{'tableName':_0x2a23('0x8'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField','FieldId'],'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 ad2e0ea..f076d27 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 _0xc3c7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0xc3c7,0x1b4));var _0x7c3c=function(_0x225bbd,_0x378910){_0x225bbd=_0x225bbd-0x0;var _0x44fd36=_0xc3c7[_0x225bbd];return _0x44fd36;};'use strict';var _=require(_0x7c3c('0x0'));var util=require('util');var moment=require(_0x7c3c('0x1'));var BPromise=require(_0x7c3c('0x2'));var rs=require(_0x7c3c('0x3'));var fs=require('fs');var Redis=require(_0x7c3c('0x4'));var db=require(_0x7c3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c3c('0x6'))(_0x7c3c('0x7'));var config=require(_0x7c3c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7c3c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d37b4,_0x5d4ac4,_0x228095){return new BPromise(function(_0x298530,_0x1cf605){return client[_0x7c3c('0xa')](_0x3d37b4,_0x228095)[_0x7c3c('0xb')](function(_0x5c6bf7){logger[_0x7c3c('0xc')](_0x7c3c('0xd'),_0x5d4ac4,_0x7c3c('0xe'));logger[_0x7c3c('0xf')](_0x7c3c('0x10'),_0x5d4ac4,_0x7c3c('0xe'),JSON[_0x7c3c('0x11')](_0x5c6bf7));if(_0x5c6bf7[_0x7c3c('0x12')]){if(_0x5c6bf7['error'][_0x7c3c('0x13')]===0x1f4){logger['error'](_0x7c3c('0xd'),_0x5d4ac4,_0x5c6bf7[_0x7c3c('0x12')][_0x7c3c('0x14')]);return _0x1cf605(_0x5c6bf7[_0x7c3c('0x12')][_0x7c3c('0x14')]);}logger[_0x7c3c('0x12')](_0x7c3c('0xd'),_0x5d4ac4,_0x5c6bf7[_0x7c3c('0x12')]['message']);return _0x298530(_0x5c6bf7['error'][_0x7c3c('0x14')]);}else{logger[_0x7c3c('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x5d4ac4,_0x7c3c('0xe'));_0x298530(_0x5c6bf7[_0x7c3c('0x15')][_0x7c3c('0x14')]);}})[_0x7c3c('0x16')](function(_0x2ad2dd){logger[_0x7c3c('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x5d4ac4,_0x2ad2dd);_0x1cf605(_0x2ad2dd);});});} \ No newline at end of file +var _0xe605=['rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43291c,_0x1c4b85){var _0x2189f9=function(_0x4dfc5d){while(--_0x4dfc5d){_0x43291c['push'](_0x43291c['shift']());}};_0x2189f9(++_0x1c4b85);}(_0xe605,0x92));var _0x5e60=function(_0x3f3359,_0x2949b0){_0x3f3359=_0x3f3359-0x0;var _0x5a89db=_0xe605[_0x3f3359];return _0x5a89db;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 769d333..7b0ca96 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(_0x29424e,_0x3d389c){var _0xf84acc=function(_0x2eac8c){while(--_0x2eac8c){_0x29424e['push'](_0x29424e['shift']());}};_0xf84acc(++_0x3d389c);}(_0x2e54,0x1dd));var _0x42e5=function(_0x3db0b6,_0x2d2c11){_0x3db0b6=_0x3db0b6-0x0;var _0x135c9a=_0x2e54[_0x3db0b6];return _0x135c9a;};'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 _0xb58b=['Router','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x39b337,_0x4d5edd){var _0x42b05d=function(_0xa1ed2d){while(--_0xa1ed2d){_0x39b337['push'](_0x39b337['shift']());}};_0x42b05d(++_0x4d5edd);}(_0xb58b,0x1f1));var _0xbb58=function(_0xbf75e7,_0x3b51af){_0xbf75e7=_0xbf75e7-0x0;var _0x4fc8e7=_0xb58b[_0xbf75e7];return _0x4fc8e7;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0x7')](_0xbb58('0xd'),auth[_0xbb58('0x8')](),controller['getFields']);router[_0xbb58('0xe')]('/',auth['isAuthenticated'](),controller[_0xbb58('0xf')]);router[_0xbb58('0xe')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['addConfiguration']);router[_0xbb58('0x10')](_0xbb58('0x9'),auth['isAuthenticated'](),controller[_0xbb58('0x11')]);router[_0xbb58('0x12')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0x13')]);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 d387b2a..a843d26 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 _0x28f2=['exports','STRING','remoteUri','sequelize'];(function(_0x49c4d1,_0x247d67){var _0xb7c65=function(_0xefd5c6){while(--_0xefd5c6){_0x49c4d1['push'](_0x49c4d1['shift']());}};_0xb7c65(++_0x247d67);}(_0x28f2,0x193));var _0x228f=function(_0x356b3d,_0x2a0716){_0x356b3d=_0x356b3d-0x0;var _0x542434=_0x28f2[_0x356b3d];return _0x542434;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')]},'description':{'type':Sequelize[_0x228f('0x2')]},'username':{'type':Sequelize[_0x228f('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x228f('0x2')]},'remoteUri':{'type':Sequelize[_0x228f('0x2')],'unique':_0x228f('0x3')},'serverUrl':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0424=['username','STRING'];(function(_0x9ae292,_0x130cef){var _0xadefdd=function(_0x4506a0){while(--_0x4506a0){_0x9ae292['push'](_0x9ae292['shift']());}};_0xadefdd(++_0x130cef);}(_0x0424,0x159));var _0x4042=function(_0x30780e,_0x537b34){_0x30780e=_0x30780e-0x0;var _0x5b9129=_0x0424[_0x30780e];return _0x5b9129;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index ca45e08..d30475c 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 _0xb17f=['Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','findOne','username','apiKey','remoteUri','slice','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','FreshsalesAccount','rawAttributes','type','key','model','query','attributes','fields','length','nolimit','sort','where','filters','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','create','body','find','getConfigurations','order','AccountId','Subjects'];(function(_0x53e09a,_0x220240){var _0x38183e=function(_0xba7f3a){while(--_0xba7f3a){_0x53e09a['push'](_0x53e09a['shift']());}};_0x38183e(++_0x220240);}(_0xb17f,0x19e));var _0xfb17=function(_0x4287a0,_0x2528fb){_0x4287a0=_0x4287a0-0x0;var _0x1663fe=_0xb17f[_0x4287a0];return _0x1663fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb17('0x0'));var zipdir=require(_0xfb17('0x1'));var jsonpatch=require(_0xfb17('0x2'));var rp=require('request-promise');var moment=require(_0xfb17('0x3'));var BPromise=require(_0xfb17('0x4'));var Mustache=require('mustache');var util=require(_0xfb17('0x5'));var path=require(_0xfb17('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfb17('0x7'));var fs=require('fs');var fs_extra=require(_0xfb17('0x8'));var _=require(_0xfb17('0x9'));var squel=require(_0xfb17('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb17('0xb'));var deskjs=require(_0xfb17('0xc'));var toCsv=require(_0xfb17('0xd'));var querystring=require(_0xfb17('0xe'));var Papa=require(_0xfb17('0xf'));var Redis=require(_0xfb17('0x10'));var authService=require(_0xfb17('0x11'));var qs=require(_0xfb17('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb17('0x13'))(_0xfb17('0x14'));var utils=require('../../config/utils');var config=require(_0xfb17('0x15'));var licenseUtil=require(_0xfb17('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfb17('0x17'));function respondWithStatusCode(_0x5d8a92,_0x2a81c1){_0x2a81c1=_0x2a81c1||0xcc;return function(_0x4f5146){if(_0x4f5146){return _0x5d8a92[_0xfb17('0x18')](_0x2a81c1);}return _0x5d8a92['status'](_0x2a81c1)['end']();};}function respondWithResult(_0x16a055,_0x3025e0){_0x3025e0=_0x3025e0||0xc8;return function(_0x5acfe5){if(_0x5acfe5){return _0x16a055['status'](_0x3025e0)[_0xfb17('0x19')](_0x5acfe5);}};}function respondWithFilteredResult(_0x2572d7,_0x5f55a2){return function(_0x1f9d29){if(_0x1f9d29){var _0x4ff78c=typeof _0x5f55a2[_0xfb17('0x1a')]===_0xfb17('0x1b')&&typeof _0x5f55a2[_0xfb17('0x1c')]===_0xfb17('0x1b');var _0x23946c=_0x1f9d29[_0xfb17('0x1d')];var _0x1d86c9=_0x4ff78c?0x0:_0x5f55a2[_0xfb17('0x1a')];var _0x3a5dc8=_0x4ff78c?_0x1f9d29[_0xfb17('0x1d')]:_0x5f55a2[_0xfb17('0x1a')]+_0x5f55a2[_0xfb17('0x1c')];var _0x104a68;if(_0x3a5dc8>=_0x23946c){_0x3a5dc8=_0x23946c;_0x104a68=0xc8;}else{_0x104a68=0xce;}_0x2572d7[_0xfb17('0x1e')](_0x104a68);return _0x2572d7[_0xfb17('0x1f')](_0xfb17('0x20'),_0x1d86c9+'-'+_0x3a5dc8+'/'+_0x23946c)[_0xfb17('0x19')](_0x1f9d29);}return null;};}function patchUpdates(_0x363b36){return function(_0x51b585){try{jsonpatch['apply'](_0x51b585,_0x363b36,!![]);}catch(_0xeb05e4){return BPromise[_0xfb17('0x21')](_0xeb05e4);}return _0x51b585[_0xfb17('0x22')]();};}function saveUpdates(_0x2089cb,_0x280860){return function(_0x48a7b6){if(_0x48a7b6){return _0x48a7b6[_0xfb17('0x23')](_0x2089cb)[_0xfb17('0x24')](function(_0x218509){return _0x218509;});}return null;};}function removeEntity(_0x2cf91a,_0x1bf639){return function(_0x99d34d){if(_0x99d34d){return _0x99d34d[_0xfb17('0x25')]()[_0xfb17('0x24')](function(){_0x2cf91a[_0xfb17('0x1e')](0xcc)[_0xfb17('0x26')]();});}};}function handleEntityNotFound(_0x130ea1,_0x422da5){return function(_0x21603d){if(!_0x21603d){_0x130ea1[_0xfb17('0x18')](0x194);}return _0x21603d;};}function handleError(_0x334698,_0x35827c){_0x35827c=_0x35827c||0x1f4;return function(_0x5da263){logger[_0xfb17('0x27')](_0x5da263[_0xfb17('0x28')]);if(_0x5da263[_0xfb17('0x29')]){delete _0x5da263[_0xfb17('0x29')];}_0x334698[_0xfb17('0x1e')](_0x35827c)[_0xfb17('0x2a')](_0x5da263);};}exports['index']=function(_0x13b308,_0xbaa670){var _0x164917={},_0x28141d={},_0x2daa9d={'count':0x0,'rows':[]};var _0x4ae81f=_[_0xfb17('0x2b')](db[_0xfb17('0x2c')][_0xfb17('0x2d')],function(_0x32f9e1){return{'name':_0x32f9e1['fieldName'],'type':_0x32f9e1[_0xfb17('0x2e')][_0xfb17('0x2f')]};});_0x28141d[_0xfb17('0x30')]=_[_0xfb17('0x2b')](_0x4ae81f,_0xfb17('0x29'));_0x28141d['query']=_['keys'](_0x13b308[_0xfb17('0x31')]);_0x28141d['filters']=_['intersection'](_0x28141d[_0xfb17('0x30')],_0x28141d['query']);_0x164917[_0xfb17('0x32')]=_['intersection'](_0x28141d[_0xfb17('0x30')],qs[_0xfb17('0x33')](_0x13b308['query']['fields']));_0x164917[_0xfb17('0x32')]=_0x164917[_0xfb17('0x32')][_0xfb17('0x34')]?_0x164917['attributes']:_0x28141d['model'];if(!_0x13b308['query']['hasOwnProperty'](_0xfb17('0x35'))){_0x164917[_0xfb17('0x1c')]=qs[_0xfb17('0x1c')](_0x13b308[_0xfb17('0x31')][_0xfb17('0x1c')]);_0x164917[_0xfb17('0x1a')]=qs[_0xfb17('0x1a')](_0x13b308[_0xfb17('0x31')][_0xfb17('0x1a')]);}_0x164917['order']=qs[_0xfb17('0x36')](_0x13b308[_0xfb17('0x31')][_0xfb17('0x36')]);_0x164917[_0xfb17('0x37')]=qs[_0xfb17('0x38')](_['pick'](_0x13b308['query'],_0x28141d[_0xfb17('0x38')]),_0x4ae81f);if(_0x13b308[_0xfb17('0x31')]['filter']){_0x164917[_0xfb17('0x37')]=_['merge'](_0x164917[_0xfb17('0x37')],{'$or':_[_0xfb17('0x2b')](_0x4ae81f,function(_0x1b90cb){if(_0x1b90cb['type']!==_0xfb17('0x39')){var _0xa76eb3={};_0xa76eb3[_0x1b90cb['name']]={'$like':'%'+_0x13b308[_0xfb17('0x31')][_0xfb17('0x3a')]+'%'};return _0xa76eb3;}})});}_0x164917=_['merge']({},_0x164917,_0x13b308['options']);var _0x33d051={'where':_0x164917[_0xfb17('0x37')]};return db[_0xfb17('0x2c')][_0xfb17('0x1d')](_0x33d051)[_0xfb17('0x24')](function(_0x219b59){_0x2daa9d[_0xfb17('0x1d')]=_0x219b59;if(_0x13b308[_0xfb17('0x31')][_0xfb17('0x3b')]){_0x164917['include']=[{'all':!![]}];}return db[_0xfb17('0x2c')][_0xfb17('0x3c')](_0x164917);})[_0xfb17('0x24')](function(_0x54ab6e){_0x2daa9d[_0xfb17('0x3d')]=_0x54ab6e;return _0x2daa9d;})[_0xfb17('0x24')](respondWithFilteredResult(_0xbaa670,_0x164917))[_0xfb17('0x3e')](handleError(_0xbaa670,null));};exports[_0xfb17('0x3f')]=function(_0x51b76f,_0x248b8b){var _0x56e2b7={'raw':![],'where':{'id':_0x51b76f[_0xfb17('0x40')]['id']}},_0x575c46={};_0x575c46[_0xfb17('0x30')]=_[_0xfb17('0x41')](db[_0xfb17('0x2c')][_0xfb17('0x2d')]);_0x575c46[_0xfb17('0x31')]=_[_0xfb17('0x41')](_0x51b76f[_0xfb17('0x31')]);_0x575c46[_0xfb17('0x38')]=_[_0xfb17('0x42')](_0x575c46['model'],_0x575c46[_0xfb17('0x31')]);_0x56e2b7[_0xfb17('0x32')]=_[_0xfb17('0x42')](_0x575c46[_0xfb17('0x30')],qs[_0xfb17('0x33')](_0x51b76f[_0xfb17('0x31')][_0xfb17('0x33')]));_0x56e2b7[_0xfb17('0x32')]=_0x56e2b7[_0xfb17('0x32')]['length']?_0x56e2b7[_0xfb17('0x32')]:_0x575c46['model'];if(_0x51b76f[_0xfb17('0x31')][_0xfb17('0x3b')]){_0x56e2b7[_0xfb17('0x43')]=[{'all':!![]}];}_0x56e2b7=_['merge']({},_0x56e2b7,_0x51b76f[_0xfb17('0x44')]);return db[_0xfb17('0x2c')]['find'](_0x56e2b7)[_0xfb17('0x24')](handleEntityNotFound(_0x248b8b,null))[_0xfb17('0x24')](respondWithResult(_0x248b8b,null))['catch'](handleError(_0x248b8b,null));};exports['create']=function(_0x2f39c2,_0x49f0a6){return db[_0xfb17('0x2c')][_0xfb17('0x45')](_0x2f39c2[_0xfb17('0x46')],{})['then'](respondWithResult(_0x49f0a6,0xc9))[_0xfb17('0x3e')](handleError(_0x49f0a6,null));};exports[_0xfb17('0x23')]=function(_0x2bd111,_0x5d3154){if(_0x2bd111['body']['id']){delete _0x2bd111[_0xfb17('0x46')]['id'];}return db[_0xfb17('0x2c')]['find']({'where':{'id':_0x2bd111[_0xfb17('0x40')]['id']}})[_0xfb17('0x24')](handleEntityNotFound(_0x5d3154,null))[_0xfb17('0x24')](saveUpdates(_0x2bd111['body'],null))['then'](respondWithResult(_0x5d3154,null))[_0xfb17('0x3e')](handleError(_0x5d3154,null));};exports['destroy']=function(_0x5102b0,_0x1badfe){return db[_0xfb17('0x2c')][_0xfb17('0x47')]({'where':{'id':_0x5102b0[_0xfb17('0x40')]['id']}})[_0xfb17('0x24')](handleEntityNotFound(_0x1badfe,null))[_0xfb17('0x24')](removeEntity(_0x1badfe,null))[_0xfb17('0x3e')](handleError(_0x1badfe,null));};exports[_0xfb17('0x48')]=function(_0x19fe28,_0x25d7cb,_0x1e41c1){var _0x5a5fe2={};var _0x1474aa={};var _0x508bbe;var _0x44b323;return db[_0xfb17('0x2c')]['findOne']({'where':{'id':_0x19fe28['params']['id']}})[_0xfb17('0x24')](handleEntityNotFound(_0x25d7cb,null))['then'](function(_0x18e87f){if(_0x18e87f){_0x508bbe=_0x18e87f;_0x1474aa[_0xfb17('0x30')]=_[_0xfb17('0x41')](db['FreshsalesConfiguration'][_0xfb17('0x2d')]);_0x1474aa[_0xfb17('0x31')]=_[_0xfb17('0x41')](_0x19fe28['query']);_0x1474aa[_0xfb17('0x38')]=_['intersection'](_0x1474aa[_0xfb17('0x30')],_0x1474aa[_0xfb17('0x31')]);_0x5a5fe2['attributes']=_[_0xfb17('0x42')](_0x1474aa[_0xfb17('0x30')],qs['fields'](_0x19fe28[_0xfb17('0x31')][_0xfb17('0x33')]));_0x5a5fe2[_0xfb17('0x32')]=_0x5a5fe2['attributes'][_0xfb17('0x34')]?_0x5a5fe2[_0xfb17('0x32')]:_0x1474aa[_0xfb17('0x30')];_0x5a5fe2[_0xfb17('0x49')]=qs[_0xfb17('0x36')](_0x19fe28[_0xfb17('0x31')][_0xfb17('0x36')]);_0x5a5fe2['where']=qs['filters'](_['pick'](_0x19fe28['query'],_0x1474aa['filters']));if(_0x19fe28[_0xfb17('0x31')][_0xfb17('0x3a')]){_0x5a5fe2[_0xfb17('0x37')]=_['merge'](_0x5a5fe2[_0xfb17('0x37')],{'$or':_[_0xfb17('0x2b')](_0x5a5fe2[_0xfb17('0x32')],function(_0x502917){var _0xe1f37e={};_0xe1f37e[_0x502917]={'$like':'%'+_0x19fe28['query'][_0xfb17('0x3a')]+'%'};return _0xe1f37e;})});}_0x5a5fe2=_['merge']({},_0x5a5fe2,_0x19fe28[_0xfb17('0x44')]);return _0x508bbe[_0xfb17('0x48')](_0x5a5fe2);}})['then'](function(_0x497b6e){if(_0x497b6e){_0x44b323=_0x497b6e[_0xfb17('0x34')];if(!_0x19fe28[_0xfb17('0x31')]['hasOwnProperty'](_0xfb17('0x35'))){_0x5a5fe2['limit']=qs[_0xfb17('0x1c')](_0x19fe28[_0xfb17('0x31')]['limit']);_0x5a5fe2['offset']=qs['offset'](_0x19fe28[_0xfb17('0x31')][_0xfb17('0x1a')]);}return _0x508bbe[_0xfb17('0x48')](_0x5a5fe2);}})['then'](function(_0x45ebdd){if(_0x45ebdd){return _0x45ebdd?{'count':_0x44b323,'rows':_0x45ebdd}:null;}})[_0xfb17('0x24')](respondWithResult(_0x25d7cb,null))[_0xfb17('0x3e')](handleError(_0x25d7cb,null));};exports['addConfiguration']=function(_0x248db2,_0x5cba9a,_0x4da882){if(_0x248db2[_0xfb17('0x46')]['id']){delete _0x248db2[_0xfb17('0x46')]['id'];}return db[_0xfb17('0x2c')]['findOne']({'where':{'id':_0x248db2[_0xfb17('0x40')]['id']}})[_0xfb17('0x24')](handleEntityNotFound(_0x5cba9a,null))['then'](function(_0x2ac2c9){if(_0x2ac2c9){_0x248db2[_0xfb17('0x46')][_0xfb17('0x4a')]=_0x2ac2c9['id'];_0x248db2[_0xfb17('0x46')][_0xfb17('0x4b')]=integrations['getSubjects'](_0x248db2[_0xfb17('0x46')]['channel'],_0x248db2[_0xfb17('0x46')]['type']);_0x248db2[_0xfb17('0x46')][_0xfb17('0x4c')]=integrations[_0xfb17('0x4d')](_0x248db2['body'][_0xfb17('0x4e')],_0x248db2[_0xfb17('0x46')][_0xfb17('0x2e')]);return db[_0xfb17('0x4f')][_0xfb17('0x45')](_0x248db2[_0xfb17('0x46')],{'include':[{'model':db[_0xfb17('0x50')],'as':_0xfb17('0x4b')},{'model':db[_0xfb17('0x50')],'as':_0xfb17('0x4c')}]});}return null;})[_0xfb17('0x24')](respondWithResult(_0x5cba9a,null))['catch'](handleError(_0x5cba9a,null));};exports[_0xfb17('0x51')]=function(_0x368f0f,_0x46b2fe,_0x58c8be){var _0x4fd045='';var _0x218ec0='';return db[_0xfb17('0x2c')][_0xfb17('0x52')]({'where':{'id':_0x368f0f[_0xfb17('0x40')]['id']},'attributes':['id',_0xfb17('0x53'),'remoteUri',_0xfb17('0x54')]})[_0xfb17('0x24')](handleEntityNotFound(_0x46b2fe,null))[_0xfb17('0x24')](function(_0x7ada6b){if(_0x7ada6b){_0x218ec0=_0x7ada6b['username'];_0x4fd045=_0x7ada6b['remoteUri'];var _0x405bc4=_0x7ada6b[_0xfb17('0x55')][_0xfb17('0x56')](-0x1);if(_0x405bc4==='/'){_0x4fd045=_0x4fd045['substring'](0x0,_0x4fd045[_0xfb17('0x57')](_0x405bc4));}return rp({'method':_0xfb17('0x58'),'uri':util['format']('%s%s',_0x4fd045,_0xfb17('0x59')),'headers':{'Authorization':_0xfb17('0x5a')+_0x7ada6b[_0xfb17('0x54')]},'json':!![]});}})['then'](function(_0x2a5ad6){if(_0x2a5ad6){var _0x12eb49=_0x2a5ad6[_0xfb17('0x5b')];var _0x49200c=![];var _0x15418c=null;for(_0x15418c=0x0;_0x15418c<_0x12eb49[_0xfb17('0x34')];_0x15418c++){if(_0x12eb49[_0x15418c][_0xfb17('0x5c')]===_0x218ec0){_0x49200c=!![];}}if(_0x49200c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xfb17('0x5d')});}}})['then'](respondWithResult(_0x46b2fe,null))[_0xfb17('0x3e')](function(_0x10b446){var _0x2b0e8c=_0x368f0f['query'][_0xfb17('0x5e')]?0x1f4:_0x10b446[_0xfb17('0x5f')]||0x1f4;logger[_0xfb17('0x27')](_0xfb17('0x60'),'getFields',_0x2b0e8c,JSON[_0xfb17('0x61')](_0x10b446));delete _0x10b446[_0xfb17('0x29')];if(_0x2b0e8c===0x191){_0x2b0e8c=0x190;}_0x46b2fe[_0xfb17('0x1e')](_0x2b0e8c)[_0xfb17('0x2a')](_0x368f0f[_0xfb17('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x10b446[_0xfb17('0x5f')]}:_0x10b446);});}; \ No newline at end of file +var _0x1758=['rows','params','include','find','catch','create','body','update','getConfigurations','FreshsalesConfiguration','nolimit','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','Subjects','remoteUri','apiKey','username','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x27133a,_0x4595ed){var _0x95aad9=function(_0x2d22a1){while(--_0x2d22a1){_0x27133a['push'](_0x27133a['shift']());}};_0x95aad9(++_0x4595ed);}(_0x1758,0x88));var _0x8175=function(_0x34311d,_0xc27673){_0x34311d=_0x34311d-0x0;var _0x2f2073=_0x1758[_0x34311d];return _0x2f2073;};'use strict';var emlformat=require(_0x8175('0x0'));var rimraf=require(_0x8175('0x1'));var zipdir=require(_0x8175('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8175('0x3'));var moment=require('moment');var BPromise=require(_0x8175('0x4'));var Mustache=require(_0x8175('0x5'));var util=require(_0x8175('0x6'));var path=require(_0x8175('0x7'));var sox=require(_0x8175('0x8'));var csv=require(_0x8175('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8175('0xa'));var _=require(_0x8175('0xb'));var squel=require(_0x8175('0xc'));var crypto=require('crypto');var jsforce=require(_0x8175('0xd'));var deskjs=require(_0x8175('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8175('0xf'));var Papa=require(_0x8175('0x10'));var Redis=require(_0x8175('0x11'));var authService=require(_0x8175('0x12'));var qs=require(_0x8175('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8175('0x14'));var logger=require('../../config/logger')(_0x8175('0x15'));var utils=require('../../config/utils');var config=require(_0x8175('0x16'));var licenseUtil=require(_0x8175('0x17'));var db=require(_0x8175('0x18'))['db'];var integrations=require(_0x8175('0x19'));function respondWithStatusCode(_0x34ea40,_0xaa6152){_0xaa6152=_0xaa6152||0xcc;return function(_0x315e2f){if(_0x315e2f){return _0x34ea40[_0x8175('0x1a')](_0xaa6152);}return _0x34ea40['status'](_0xaa6152)[_0x8175('0x1b')]();};}function respondWithResult(_0xde0b52,_0x1def9b){_0x1def9b=_0x1def9b||0xc8;return function(_0x297581){if(_0x297581){return _0xde0b52[_0x8175('0x1c')](_0x1def9b)['json'](_0x297581);}};}function respondWithFilteredResult(_0x96361f,_0x30ec19){return function(_0x4b1579){if(_0x4b1579){var _0x2d5f26=typeof _0x30ec19[_0x8175('0x1d')]===_0x8175('0x1e')&&typeof _0x30ec19[_0x8175('0x1f')]===_0x8175('0x1e');var _0x295657=_0x4b1579[_0x8175('0x20')];var _0x3b52e7=_0x2d5f26?0x0:_0x30ec19[_0x8175('0x1d')];var _0x1f3ca1=_0x2d5f26?_0x4b1579[_0x8175('0x20')]:_0x30ec19['offset']+_0x30ec19[_0x8175('0x1f')];var _0x5782c7;if(_0x1f3ca1>=_0x295657){_0x1f3ca1=_0x295657;_0x5782c7=0xc8;}else{_0x5782c7=0xce;}_0x96361f[_0x8175('0x1c')](_0x5782c7);return _0x96361f['set'](_0x8175('0x21'),_0x3b52e7+'-'+_0x1f3ca1+'/'+_0x295657)[_0x8175('0x22')](_0x4b1579);}return null;};}function patchUpdates(_0x450ca5){return function(_0x103412){try{jsonpatch[_0x8175('0x23')](_0x103412,_0x450ca5,!![]);}catch(_0x26e221){return BPromise[_0x8175('0x24')](_0x26e221);}return _0x103412[_0x8175('0x25')]();};}function saveUpdates(_0x18c351,_0x38c4db){return function(_0xa846ae){if(_0xa846ae){return _0xa846ae['update'](_0x18c351)[_0x8175('0x26')](function(_0x912cff){return _0x912cff;});}return null;};}function removeEntity(_0x2f6586,_0x243a74){return function(_0x4f09f3){if(_0x4f09f3){return _0x4f09f3[_0x8175('0x27')]()[_0x8175('0x26')](function(){_0x2f6586[_0x8175('0x1c')](0xcc)[_0x8175('0x1b')]();});}};}function handleEntityNotFound(_0x5a2a89,_0x40b53b){return function(_0x130472){if(!_0x130472){_0x5a2a89[_0x8175('0x1a')](0x194);}return _0x130472;};}function handleError(_0x403b31,_0x2f7c23){_0x2f7c23=_0x2f7c23||0x1f4;return function(_0x127eae){logger[_0x8175('0x28')](_0x127eae[_0x8175('0x29')]);if(_0x127eae[_0x8175('0x2a')]){delete _0x127eae[_0x8175('0x2a')];}_0x403b31[_0x8175('0x1c')](_0x2f7c23)['send'](_0x127eae);};}exports[_0x8175('0x2b')]=function(_0x59455a,_0x2483cc){var _0x10b4ba={},_0xcc5c94={},_0x19bc44={'count':0x0,'rows':[]};var _0x36af14=_['map'](db[_0x8175('0x2c')][_0x8175('0x2d')],function(_0x2392a5){return{'name':_0x2392a5[_0x8175('0x2e')],'type':_0x2392a5[_0x8175('0x2f')][_0x8175('0x30')]};});_0xcc5c94[_0x8175('0x31')]=_[_0x8175('0x32')](_0x36af14,'name');_0xcc5c94[_0x8175('0x33')]=_[_0x8175('0x34')](_0x59455a[_0x8175('0x33')]);_0xcc5c94[_0x8175('0x35')]=_[_0x8175('0x36')](_0xcc5c94[_0x8175('0x31')],_0xcc5c94[_0x8175('0x33')]);_0x10b4ba[_0x8175('0x37')]=_[_0x8175('0x36')](_0xcc5c94['model'],qs[_0x8175('0x38')](_0x59455a[_0x8175('0x33')]['fields']));_0x10b4ba[_0x8175('0x37')]=_0x10b4ba[_0x8175('0x37')][_0x8175('0x39')]?_0x10b4ba[_0x8175('0x37')]:_0xcc5c94[_0x8175('0x31')];if(!_0x59455a['query'][_0x8175('0x3a')]('nolimit')){_0x10b4ba[_0x8175('0x1f')]=qs[_0x8175('0x1f')](_0x59455a[_0x8175('0x33')][_0x8175('0x1f')]);_0x10b4ba['offset']=qs[_0x8175('0x1d')](_0x59455a[_0x8175('0x33')][_0x8175('0x1d')]);}_0x10b4ba[_0x8175('0x3b')]=qs[_0x8175('0x3c')](_0x59455a[_0x8175('0x33')][_0x8175('0x3c')]);_0x10b4ba[_0x8175('0x3d')]=qs[_0x8175('0x35')](_[_0x8175('0x3e')](_0x59455a[_0x8175('0x33')],_0xcc5c94[_0x8175('0x35')]),_0x36af14);if(_0x59455a[_0x8175('0x33')][_0x8175('0x3f')]){_0x10b4ba[_0x8175('0x3d')]=_[_0x8175('0x40')](_0x10b4ba[_0x8175('0x3d')],{'$or':_[_0x8175('0x32')](_0x36af14,function(_0xdc84a6){if(_0xdc84a6[_0x8175('0x2f')]!==_0x8175('0x41')){var _0x35a80e={};_0x35a80e[_0xdc84a6[_0x8175('0x2a')]]={'$like':'%'+_0x59455a[_0x8175('0x33')][_0x8175('0x3f')]+'%'};return _0x35a80e;}})});}_0x10b4ba=_[_0x8175('0x40')]({},_0x10b4ba,_0x59455a[_0x8175('0x42')]);var _0x20a7b6={'where':_0x10b4ba[_0x8175('0x3d')]};return db['FreshsalesAccount']['count'](_0x20a7b6)[_0x8175('0x26')](function(_0x567bb5){_0x19bc44['count']=_0x567bb5;if(_0x59455a[_0x8175('0x33')][_0x8175('0x43')]){_0x10b4ba['include']=[{'all':!![]}];}return db[_0x8175('0x2c')]['findAll'](_0x10b4ba);})[_0x8175('0x26')](function(_0x1f0bc0){_0x19bc44[_0x8175('0x44')]=_0x1f0bc0;return _0x19bc44;})[_0x8175('0x26')](respondWithFilteredResult(_0x2483cc,_0x10b4ba))['catch'](handleError(_0x2483cc,null));};exports['show']=function(_0x1afc1e,_0x17fcbe){var _0x6c6839={'raw':![],'where':{'id':_0x1afc1e[_0x8175('0x45')]['id']}},_0x24dba8={};_0x24dba8[_0x8175('0x31')]=_[_0x8175('0x34')](db['FreshsalesAccount'][_0x8175('0x2d')]);_0x24dba8[_0x8175('0x33')]=_[_0x8175('0x34')](_0x1afc1e[_0x8175('0x33')]);_0x24dba8[_0x8175('0x35')]=_[_0x8175('0x36')](_0x24dba8[_0x8175('0x31')],_0x24dba8[_0x8175('0x33')]);_0x6c6839['attributes']=_[_0x8175('0x36')](_0x24dba8[_0x8175('0x31')],qs[_0x8175('0x38')](_0x1afc1e[_0x8175('0x33')][_0x8175('0x38')]));_0x6c6839[_0x8175('0x37')]=_0x6c6839['attributes'][_0x8175('0x39')]?_0x6c6839['attributes']:_0x24dba8['model'];if(_0x1afc1e[_0x8175('0x33')][_0x8175('0x43')]){_0x6c6839[_0x8175('0x46')]=[{'all':!![]}];}_0x6c6839=_['merge']({},_0x6c6839,_0x1afc1e['options']);return db[_0x8175('0x2c')][_0x8175('0x47')](_0x6c6839)[_0x8175('0x26')](handleEntityNotFound(_0x17fcbe,null))[_0x8175('0x26')](respondWithResult(_0x17fcbe,null))[_0x8175('0x48')](handleError(_0x17fcbe,null));};exports[_0x8175('0x49')]=function(_0x446a03,_0x18c7b1){return db['FreshsalesAccount'][_0x8175('0x49')](_0x446a03[_0x8175('0x4a')],{})[_0x8175('0x26')](respondWithResult(_0x18c7b1,0xc9))[_0x8175('0x48')](handleError(_0x18c7b1,null));};exports[_0x8175('0x4b')]=function(_0x538f07,_0x2b8e3b){if(_0x538f07[_0x8175('0x4a')]['id']){delete _0x538f07[_0x8175('0x4a')]['id'];}return db[_0x8175('0x2c')][_0x8175('0x47')]({'where':{'id':_0x538f07[_0x8175('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b8e3b,null))[_0x8175('0x26')](saveUpdates(_0x538f07['body'],null))[_0x8175('0x26')](respondWithResult(_0x2b8e3b,null))[_0x8175('0x48')](handleError(_0x2b8e3b,null));};exports['destroy']=function(_0x3249e8,_0x5bd375){return db[_0x8175('0x2c')]['find']({'where':{'id':_0x3249e8[_0x8175('0x45')]['id']}})[_0x8175('0x26')](handleEntityNotFound(_0x5bd375,null))[_0x8175('0x26')](removeEntity(_0x5bd375,null))[_0x8175('0x48')](handleError(_0x5bd375,null));};exports[_0x8175('0x4c')]=function(_0x3c4008,_0x426072,_0x1606bc){var _0x287660={};var _0x37acf5={};var _0x49c44b;var _0x55a27c;return db[_0x8175('0x2c')]['findOne']({'where':{'id':_0x3c4008[_0x8175('0x45')]['id']}})[_0x8175('0x26')](handleEntityNotFound(_0x426072,null))[_0x8175('0x26')](function(_0x2a1715){if(_0x2a1715){_0x49c44b=_0x2a1715;_0x37acf5[_0x8175('0x31')]=_[_0x8175('0x34')](db[_0x8175('0x4d')]['rawAttributes']);_0x37acf5[_0x8175('0x33')]=_[_0x8175('0x34')](_0x3c4008['query']);_0x37acf5['filters']=_[_0x8175('0x36')](_0x37acf5[_0x8175('0x31')],_0x37acf5[_0x8175('0x33')]);_0x287660[_0x8175('0x37')]=_[_0x8175('0x36')](_0x37acf5[_0x8175('0x31')],qs[_0x8175('0x38')](_0x3c4008['query']['fields']));_0x287660[_0x8175('0x37')]=_0x287660['attributes']['length']?_0x287660['attributes']:_0x37acf5['model'];_0x287660[_0x8175('0x3b')]=qs['sort'](_0x3c4008[_0x8175('0x33')][_0x8175('0x3c')]);_0x287660[_0x8175('0x3d')]=qs['filters'](_['pick'](_0x3c4008[_0x8175('0x33')],_0x37acf5[_0x8175('0x35')]));if(_0x3c4008[_0x8175('0x33')]['filter']){_0x287660[_0x8175('0x3d')]=_['merge'](_0x287660[_0x8175('0x3d')],{'$or':_[_0x8175('0x32')](_0x287660['attributes'],function(_0x2ffd70){var _0xd34a08={};_0xd34a08[_0x2ffd70]={'$like':'%'+_0x3c4008['query'][_0x8175('0x3f')]+'%'};return _0xd34a08;})});}_0x287660=_[_0x8175('0x40')]({},_0x287660,_0x3c4008['options']);return _0x49c44b[_0x8175('0x4c')](_0x287660);}})[_0x8175('0x26')](function(_0x5b56e2){if(_0x5b56e2){_0x55a27c=_0x5b56e2[_0x8175('0x39')];if(!_0x3c4008[_0x8175('0x33')][_0x8175('0x3a')](_0x8175('0x4e'))){_0x287660[_0x8175('0x1f')]=qs['limit'](_0x3c4008['query']['limit']);_0x287660[_0x8175('0x1d')]=qs['offset'](_0x3c4008[_0x8175('0x33')][_0x8175('0x1d')]);}return _0x49c44b[_0x8175('0x4c')](_0x287660);}})[_0x8175('0x26')](function(_0x454f58){if(_0x454f58){return _0x454f58?{'count':_0x55a27c,'rows':_0x454f58}:null;}})['then'](respondWithResult(_0x426072,null))[_0x8175('0x48')](handleError(_0x426072,null));};exports['addConfiguration']=function(_0x2ee0b3,_0x37e48b,_0x284081){if(_0x2ee0b3[_0x8175('0x4a')]['id']){delete _0x2ee0b3[_0x8175('0x4a')]['id'];}return db[_0x8175('0x2c')][_0x8175('0x4f')]({'where':{'id':_0x2ee0b3[_0x8175('0x45')]['id']}})[_0x8175('0x26')](handleEntityNotFound(_0x37e48b,null))['then'](function(_0x37a68e){if(_0x37a68e){_0x2ee0b3[_0x8175('0x4a')][_0x8175('0x50')]=_0x37a68e['id'];_0x2ee0b3[_0x8175('0x4a')]['Subjects']=integrations[_0x8175('0x51')](_0x2ee0b3[_0x8175('0x4a')]['channel'],_0x2ee0b3[_0x8175('0x4a')]['type']);_0x2ee0b3['body'][_0x8175('0x52')]=integrations[_0x8175('0x53')](_0x2ee0b3['body'][_0x8175('0x54')],_0x2ee0b3['body'][_0x8175('0x2f')]);return db[_0x8175('0x4d')][_0x8175('0x49')](_0x2ee0b3[_0x8175('0x4a')],{'include':[{'model':db[_0x8175('0x55')],'as':_0x8175('0x56')},{'model':db[_0x8175('0x55')],'as':'Descriptions'}]});}return null;})[_0x8175('0x26')](respondWithResult(_0x37e48b,null))[_0x8175('0x48')](handleError(_0x37e48b,null));};exports['getFields']=function(_0x144bd3,_0x45a9b5,_0x2304bf){var _0x53e8ab='';var _0x3eb06b='';return db[_0x8175('0x2c')][_0x8175('0x4f')]({'where':{'id':_0x144bd3[_0x8175('0x45')]['id']},'attributes':['id','username',_0x8175('0x57'),_0x8175('0x58')]})[_0x8175('0x26')](handleEntityNotFound(_0x45a9b5,null))['then'](function(_0xf2b0d2){if(_0xf2b0d2){_0x3eb06b=_0xf2b0d2[_0x8175('0x59')];_0x53e8ab=_0xf2b0d2['remoteUri'];var _0x3c16ec=_0xf2b0d2[_0x8175('0x57')]['slice'](-0x1);if(_0x3c16ec==='/'){_0x53e8ab=_0x53e8ab['substring'](0x0,_0x53e8ab['lastIndexOf'](_0x3c16ec));}return rp({'method':_0x8175('0x5a'),'uri':util[_0x8175('0x5b')](_0x8175('0x5c'),_0x53e8ab,_0x8175('0x5d')),'headers':{'Authorization':_0x8175('0x5e')+_0xf2b0d2[_0x8175('0x58')]},'json':!![]});}})[_0x8175('0x26')](function(_0x4e539a){if(_0x4e539a){var _0x2d0ffb=_0x4e539a[_0x8175('0x5f')];var _0x20a690=![];var _0x11b128=null;for(_0x11b128=0x0;_0x11b128<_0x2d0ffb[_0x8175('0x39')];_0x11b128++){if(_0x2d0ffb[_0x11b128][_0x8175('0x60')]===_0x3eb06b){_0x20a690=!![];}}if(_0x20a690){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8175('0x61')});}}})[_0x8175('0x26')](respondWithResult(_0x45a9b5,null))[_0x8175('0x48')](function(_0x1aaea2){var _0x23119b=_0x144bd3[_0x8175('0x33')]['test']?0x1f4:_0x1aaea2[_0x8175('0x62')]||0x1f4;logger[_0x8175('0x28')](_0x8175('0x63'),'getFields',_0x23119b,JSON[_0x8175('0x64')](_0x1aaea2));delete _0x1aaea2[_0x8175('0x2a')];if(_0x23119b===0x191){_0x23119b=0x190;}_0x45a9b5[_0x8175('0x1c')](_0x23119b)[_0x8175('0x65')](_0x144bd3['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x1aaea2[_0x8175('0x62')]}:_0x1aaea2);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4dbf1e5..063f4d6 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 _0x4bd3=['define','int_freshsales_accounts','lodash','../../config/logger','api','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4bd3,0x174));var _0x34bd=function(_0x15b957,_0x51bce6){_0x15b957=_0x15b957-0x0;var _0x3fb192=_0x4bd3[_0x15b957];return _0x3fb192;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x34bd('0x6'));module[_0x34bd('0x7')]=function(_0x5c2a7a,_0x3e8744){return _0x5c2a7a[_0x34bd('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x34bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x90b1,0x1bb));var _0x190b=function(_0x13fc2a,_0x505a7d){_0x13fc2a=_0x13fc2a-0x0;var _0x3fb4d6=_0x90b1[_0x13fc2a];return _0x3fb4d6;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x27ff8c,_0x34a689){return _0x27ff8c[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'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 5637aef..e111ad9 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 _0x5496=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','FreshsalesAccount','find','ShowFreshsalesAccount','lodash'];(function(_0x25c082,_0x9411be){var _0x413283=function(_0xe59e84){while(--_0xe59e84){_0x25c082['push'](_0x25c082['shift']());}};_0x413283(++_0x9411be);}(_0x5496,0x175));var _0x6549=function(_0x477ce7,_0x5da1a4){_0x477ce7=_0x477ce7-0x0;var _0x23d8cb=_0x5496[_0x477ce7];return _0x23d8cb;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});}exports[_0x6549('0x15')]=function(_0x53b12b){var _0x5d61a0=this;return new Promise(function(_0x26a212,_0x48f037){return db['FreshsalesAccount'][_0x6549('0x16')]({'raw':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x18')]===undefined?!![]:![]:!![],'where':_0x53b12b[_0x6549('0x17')]?_0x53b12b['options'][_0x6549('0x19')]||null:null,'attributes':_0x53b12b['options']?_0x53b12b[_0x6549('0x17')][_0x6549('0x1a')]||null:null,'limit':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x1b')]||null:null,'include':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x53b12b[_0x6549('0x17')][_0x6549('0x1c')],function(_0x1fbfa4){return{'model':db[_0x1fbfa4[_0x6549('0x1e')]],'as':_0x1fbfa4['as'],'attributes':_0x1fbfa4['attributes'],'include':_0x1fbfa4[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x1fbfa4['include'],function(_0x126967){return{'model':db[_0x126967[_0x6549('0x1e')]],'as':_0x126967['as'],'attributes':_0x126967[_0x6549('0x1a')],'include':_0x126967['include']?_[_0x6549('0x1d')](_0x126967[_0x6549('0x1c')],function(_0x14de1f){return{'model':db[_0x14de1f[_0x6549('0x1e')]],'as':_0x14de1f['as'],'attributes':_0x14de1f[_0x6549('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6549('0xa')](function(_0x2f58f7){logger[_0x6549('0xb')]('GetFreshsalesAccount',_0x53b12b);logger[_0x6549('0xe')](_0x6549('0x15'),_0x53b12b,JSON[_0x6549('0xf')](_0x2f58f7));_0x26a212(_0x2f58f7);})['catch'](function(_0x3f1502){logger['error']('GetFreshsalesAccount',_0x3f1502['message'],_0x53b12b);_0x48f037(_0x5d61a0[_0x6549('0x10')](0x1f4,_0x3f1502[_0x6549('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x30aac6){var _0x194ae7=this;return new Promise(function(_0x2e481f,_0x102a21){return db[_0x6549('0x1f')][_0x6549('0x20')]({'raw':_0x30aac6[_0x6549('0x17')]?_0x30aac6['options'][_0x6549('0x18')]===undefined?!![]:![]:!![],'where':_0x30aac6[_0x6549('0x17')]?_0x30aac6[_0x6549('0x17')][_0x6549('0x19')]||null:null,'attributes':_0x30aac6[_0x6549('0x17')]?_0x30aac6[_0x6549('0x17')]['attributes']||null:null,'include':_0x30aac6[_0x6549('0x17')]?_0x30aac6['options'][_0x6549('0x1c')]?_['map'](_0x30aac6[_0x6549('0x17')][_0x6549('0x1c')],function(_0x3d9e9e){return{'model':db[_0x3d9e9e['model']],'as':_0x3d9e9e['as'],'attributes':_0x3d9e9e[_0x6549('0x1a')],'include':_0x3d9e9e[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x3d9e9e[_0x6549('0x1c')],function(_0x5b8624){return{'model':db[_0x5b8624['model']],'as':_0x5b8624['as'],'attributes':_0x5b8624['attributes'],'include':_0x5b8624[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x5b8624['include'],function(_0x43220f){return{'model':db[_0x43220f[_0x6549('0x1e')]],'as':_0x43220f['as'],'attributes':_0x43220f[_0x6549('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6549('0xa')](function(_0x3741f5){logger['info']('ShowFreshsalesAccount',_0x30aac6);logger[_0x6549('0xe')](_0x6549('0x21'),_0x30aac6,JSON[_0x6549('0xf')](_0x3741f5));_0x2e481f(_0x3741f5);})[_0x6549('0x14')](function(_0xa96598){logger[_0x6549('0x10')](_0x6549('0x21'),_0xa96598[_0x6549('0x12')],_0x30aac6);_0x102a21(_0x194ae7[_0x6549('0x10')](0x1f4,_0xa96598[_0x6549('0x12')]));});});}; \ No newline at end of file +var _0xe5af=['ShowFreshsalesAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','include','model','map','find','raw','debug'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xe5af,0x9c));var _0xfe5a=function(_0x4d7477,_0x36021c){_0x4d7477=_0x4d7477-0x0;var _0xf8ccd=_0xe5af[_0x4d7477];return _0xf8ccd;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}exports[_0xfe5a('0x12')]=function(_0x5bf597){var _0x20620b=this;return new Promise(function(_0x456707,_0x54d5fb){return db[_0xfe5a('0x13')][_0xfe5a('0x14')]({'raw':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x17')]||null:null,'limit':_0x5bf597['options']?_0x5bf597[_0xfe5a('0x15')]['limit']||null:null,'include':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x18')]?_['map'](_0x5bf597['options'][_0xfe5a('0x18')],function(_0x3e55fd){return{'model':db[_0x3e55fd['model']],'as':_0x3e55fd['as'],'attributes':_0x3e55fd[_0xfe5a('0x17')],'include':_0x3e55fd[_0xfe5a('0x18')]?_['map'](_0x3e55fd[_0xfe5a('0x18')],function(_0x3a4f3c){return{'model':db[_0x3a4f3c[_0xfe5a('0x19')]],'as':_0x3a4f3c['as'],'attributes':_0x3a4f3c[_0xfe5a('0x17')],'include':_0x3a4f3c['include']?_[_0xfe5a('0x1a')](_0x3a4f3c[_0xfe5a('0x18')],function(_0x24481f){return{'model':db[_0x24481f[_0xfe5a('0x19')]],'as':_0x24481f['as'],'attributes':_0x24481f[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0xdbf1e0){logger[_0xfe5a('0xf')]('GetFreshsalesAccount',_0x5bf597);logger['debug'](_0xfe5a('0x12'),_0x5bf597,JSON['stringify'](_0xdbf1e0));_0x456707(_0xdbf1e0);})[_0xfe5a('0x11')](function(_0xfcb05b){logger[_0xfe5a('0xd')]('GetFreshsalesAccount',_0xfcb05b['message'],_0x5bf597);_0x54d5fb(_0x20620b['error'](0x1f4,_0xfcb05b[_0xfe5a('0xe')]));});});};exports['ShowFreshsalesAccount']=function(_0x51d1f4){var _0x498b64=this;return new Promise(function(_0x3b6e4d,_0x14c66d){return db[_0xfe5a('0x13')][_0xfe5a('0x1b')]({'raw':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x1c')]===undefined?!![]:![]:!![],'where':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x17')]||null:null,'include':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x18')]?_[_0xfe5a('0x1a')](_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x18')],function(_0xe5a992){return{'model':db[_0xe5a992['model']],'as':_0xe5a992['as'],'attributes':_0xe5a992['attributes'],'include':_0xe5a992[_0xfe5a('0x18')]?_['map'](_0xe5a992[_0xfe5a('0x18')],function(_0xb31d0){return{'model':db[_0xb31d0[_0xfe5a('0x19')]],'as':_0xb31d0['as'],'attributes':_0xb31d0[_0xfe5a('0x17')],'include':_0xb31d0['include']?_[_0xfe5a('0x1a')](_0xb31d0[_0xfe5a('0x18')],function(_0x2e3a36){return{'model':db[_0x2e3a36['model']],'as':_0x2e3a36['as'],'attributes':_0x2e3a36[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0x4617f0){logger[_0xfe5a('0xf')]('ShowFreshsalesAccount',_0x51d1f4);logger[_0xfe5a('0x1d')]('ShowFreshsalesAccount',_0x51d1f4,JSON[_0xfe5a('0xc')](_0x4617f0));_0x3b6e4d(_0x4617f0);})[_0xfe5a('0x11')](function(_0x576189){logger[_0xfe5a('0xd')](_0xfe5a('0x1e'),_0x576189[_0xfe5a('0xe')],_0x51d1f4);_0x14c66d(_0x498b64[_0xfe5a('0xd')](0x1f4,_0x576189['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7bad4bf..bdf6215 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 _0x55d7=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','/:id/subjects','/:id/fields','getFields','create','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x16292c,_0x451724){var _0xfb49b3=function(_0x1adbe9){while(--_0x1adbe9){_0x16292c['push'](_0x16292c['shift']());}};_0xfb49b3(++_0x451724);}(_0x55d7,0x188));var _0x755d=function(_0x5d5d25,_0x3b8c9d){_0x5d5d25=_0x5d5d25-0x0;var _0x4b25ca=_0x55d7[_0x5d5d25];return _0x4b25ca;};'use strict';var multer=require('multer');var util=require(_0x755d('0x0'));var path=require(_0x755d('0x1'));var timeout=require(_0x755d('0x2'));var express=require(_0x755d('0x3'));var router=express[_0x755d('0x4')]();var fs_extra=require(_0x755d('0x5'));var auth=require(_0x755d('0x6'));var interaction=require(_0x755d('0x7'));var config=require(_0x755d('0x8'));var controller=require(_0x755d('0x9'));router['get']('/',auth[_0x755d('0xa')](),controller[_0x755d('0xb')]);router[_0x755d('0xc')](_0x755d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x755d('0xc')](_0x755d('0xe'),auth[_0x755d('0xa')](),controller['getSubjects']);router[_0x755d('0xc')]('/:id/descriptions',auth[_0x755d('0xa')](),controller['getDescriptions']);router[_0x755d('0xc')](_0x755d('0xf'),auth[_0x755d('0xa')](),controller[_0x755d('0x10')]);router['post']('/',auth[_0x755d('0xa')](),controller[_0x755d('0x11')]);router['put']('/:id',auth[_0x755d('0xa')](),controller['update']);router[_0x755d('0x12')](_0x755d('0xd'),auth[_0x755d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x455f=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x455f,0x1a8));var _0xf455=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x455f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf455('0x0'));var util=require(_0xf455('0x1'));var path=require(_0xf455('0x2'));var timeout=require(_0xf455('0x3'));var express=require('express');var router=express[_0xf455('0x4')]();var fs_extra=require(_0xf455('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf455('0x6'));var config=require(_0xf455('0x7'));var controller=require(_0xf455('0x8'));router[_0xf455('0x9')]('/',auth[_0xf455('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf455('0xb')]);router[_0xf455('0x9')](_0xf455('0xc'),auth[_0xf455('0xa')](),controller['getSubjects']);router[_0xf455('0x9')](_0xf455('0xd'),auth[_0xf455('0xa')](),controller[_0xf455('0xe')]);router[_0xf455('0x9')](_0xf455('0xf'),auth[_0xf455('0xa')](),controller[_0xf455('0x10')]);router[_0xf455('0x11')]('/',auth['isAuthenticated'](),controller[_0xf455('0x12')]);router[_0xf455('0x13')](_0xf455('0x14'),auth['isAuthenticated'](),controller[_0xf455('0x15')]);router['delete'](_0xf455('0x14'),auth[_0xf455('0xa')](),controller['destroy']);module[_0xf455('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 99bffdd..f9bae60 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 _0xcbf0=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbf0,0xe3));var _0x0cbf=function(_0x288b60,_0x11fa8e){_0x288b60=_0x288b60-0x0;var _0x174d7c=_0xcbf0[_0x288b60];return _0x174d7c;};'use strict';var Sequelize=require(_0x0cbf('0x0'));module['exports']={'name':{'type':Sequelize[_0x0cbf('0x1')]},'description':{'type':Sequelize[_0x0cbf('0x1')]}}; \ No newline at end of file +var _0xc98e=['STRING'];(function(_0x3d5db9,_0x2dbe0a){var _0x3c114c=function(_0x3e0239){while(--_0x3e0239){_0x3d5db9['push'](_0x3d5db9['shift']());}};_0x3c114c(++_0x2dbe0a);}(_0xc98e,0x11c));var _0xec98=function(_0x49433d,_0x131110){_0x49433d=_0x49433d-0x0;var _0x56e98f=_0xc98e[_0x49433d];return _0x56e98f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xec98('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index aea95cc..901683f 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 _0x243c=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','then','error','stack','name','index','map','FreshsalesConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','rawAttributes','options','find','create','body','destroy','getSubjects','FreshsalesField','hasOwnProperty','getDescriptions','getFields','findOne','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x140ac,_0x27e9b7){var _0x576afe=function(_0x301033){while(--_0x301033){_0x140ac['push'](_0x140ac['shift']());}};_0x576afe(++_0x27e9b7);}(_0x243c,0x86));var _0xc243=function(_0x4fcbee,_0x1a2466){_0x4fcbee=_0x4fcbee-0x0;var _0x5d171f=_0x243c[_0x4fcbee];return _0x5d171f;};'use strict';var emlformat=require(_0xc243('0x0'));var rimraf=require(_0xc243('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc243('0x2'));var rp=require(_0xc243('0x3'));var moment=require('moment');var BPromise=require(_0xc243('0x4'));var Mustache=require('mustache');var util=require(_0xc243('0x5'));var path=require(_0xc243('0x6'));var sox=require('sox');var csv=require(_0xc243('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc243('0x8'));var _=require('lodash');var squel=require(_0xc243('0x9'));var crypto=require(_0xc243('0xa'));var jsforce=require(_0xc243('0xb'));var deskjs=require(_0xc243('0xc'));var toCsv=require(_0xc243('0x7'));var querystring=require(_0xc243('0xd'));var Papa=require(_0xc243('0xe'));var Redis=require(_0xc243('0xf'));var authService=require(_0xc243('0x10'));var qs=require(_0xc243('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc243('0x12'));var logger=require(_0xc243('0x13'))('api');var utils=require(_0xc243('0x14'));var config=require(_0xc243('0x15'));var licenseUtil=require(_0xc243('0x16'));var db=require(_0xc243('0x17'))['db'];function respondWithStatusCode(_0x345ed3,_0x29ee33){_0x29ee33=_0x29ee33||0xcc;return function(_0x3f0cc1){if(_0x3f0cc1){return _0x345ed3[_0xc243('0x18')](_0x29ee33);}return _0x345ed3['status'](_0x29ee33)[_0xc243('0x19')]();};}function respondWithResult(_0x579ade,_0x467c77){_0x467c77=_0x467c77||0xc8;return function(_0xcc8a8a){if(_0xcc8a8a){return _0x579ade[_0xc243('0x1a')](_0x467c77)[_0xc243('0x1b')](_0xcc8a8a);}};}function respondWithFilteredResult(_0x606529,_0x3ac29e){return function(_0x199602){if(_0x199602){var _0x11ed9a=typeof _0x3ac29e[_0xc243('0x1c')]===_0xc243('0x1d')&&typeof _0x3ac29e[_0xc243('0x1e')]===_0xc243('0x1d');var _0x1ae6ce=_0x199602[_0xc243('0x1f')];var _0x336d2b=_0x11ed9a?0x0:_0x3ac29e[_0xc243('0x1c')];var _0x27672c=_0x11ed9a?_0x199602['count']:_0x3ac29e[_0xc243('0x1c')]+_0x3ac29e[_0xc243('0x1e')];var _0x48b4c4;if(_0x27672c>=_0x1ae6ce){_0x27672c=_0x1ae6ce;_0x48b4c4=0xc8;}else{_0x48b4c4=0xce;}_0x606529[_0xc243('0x1a')](_0x48b4c4);return _0x606529[_0xc243('0x20')]('Content-Range',_0x336d2b+'-'+_0x27672c+'/'+_0x1ae6ce)[_0xc243('0x1b')](_0x199602);}return null;};}function patchUpdates(_0x2d190a){return function(_0x74e4ce){try{jsonpatch[_0xc243('0x21')](_0x74e4ce,_0x2d190a,!![]);}catch(_0x520f29){return BPromise[_0xc243('0x22')](_0x520f29);}return _0x74e4ce['save']();};}function saveUpdates(_0x4d918b,_0x50f9d6){return function(_0x34c11d){if(_0x34c11d){return _0x34c11d['update'](_0x4d918b)['then'](function(_0x57fd13){return _0x57fd13;});}return null;};}function removeEntity(_0x3eee64,_0x4dad8f){return function(_0x42c724){if(_0x42c724){return _0x42c724['destroy']()[_0xc243('0x23')](function(){_0x3eee64['status'](0xcc)[_0xc243('0x19')]();});}};}function handleEntityNotFound(_0x33fabc,_0x441bc8){return function(_0x1130ad){if(!_0x1130ad){_0x33fabc[_0xc243('0x18')](0x194);}return _0x1130ad;};}function handleError(_0x5beb46,_0x265201){_0x265201=_0x265201||0x1f4;return function(_0x2e147f){logger[_0xc243('0x24')](_0x2e147f[_0xc243('0x25')]);if(_0x2e147f[_0xc243('0x26')]){delete _0x2e147f[_0xc243('0x26')];}_0x5beb46[_0xc243('0x1a')](_0x265201)['send'](_0x2e147f);};}exports[_0xc243('0x27')]=function(_0x18f9aa,_0x1eaa5a){var _0x43e473={},_0x5d3595={},_0x4a448b={'count':0x0,'rows':[]};var _0x30eab3=_[_0xc243('0x28')](db[_0xc243('0x29')]['rawAttributes'],function(_0x37d401){return{'name':_0x37d401['fieldName'],'type':_0x37d401[_0xc243('0x2a')][_0xc243('0x2b')]};});_0x5d3595[_0xc243('0x2c')]=_['map'](_0x30eab3,_0xc243('0x26'));_0x5d3595[_0xc243('0x2d')]=_['keys'](_0x18f9aa[_0xc243('0x2d')]);_0x5d3595[_0xc243('0x2e')]=_[_0xc243('0x2f')](_0x5d3595[_0xc243('0x2c')],_0x5d3595['query']);_0x43e473[_0xc243('0x30')]=_[_0xc243('0x2f')](_0x5d3595[_0xc243('0x2c')],qs['fields'](_0x18f9aa[_0xc243('0x2d')][_0xc243('0x31')]));_0x43e473['attributes']=_0x43e473[_0xc243('0x30')][_0xc243('0x32')]?_0x43e473[_0xc243('0x30')]:_0x5d3595['model'];if(!_0x18f9aa['query']['hasOwnProperty'](_0xc243('0x33'))){_0x43e473[_0xc243('0x1e')]=qs[_0xc243('0x1e')](_0x18f9aa[_0xc243('0x2d')][_0xc243('0x1e')]);_0x43e473[_0xc243('0x1c')]=qs[_0xc243('0x1c')](_0x18f9aa[_0xc243('0x2d')][_0xc243('0x1c')]);}_0x43e473[_0xc243('0x34')]=qs[_0xc243('0x35')](_0x18f9aa['query'][_0xc243('0x35')]);_0x43e473[_0xc243('0x36')]=qs[_0xc243('0x2e')](_[_0xc243('0x37')](_0x18f9aa['query'],_0x5d3595[_0xc243('0x2e')]),_0x30eab3);if(_0x18f9aa[_0xc243('0x2d')][_0xc243('0x38')]){_0x43e473['where']=_[_0xc243('0x39')](_0x43e473[_0xc243('0x36')],{'$or':_[_0xc243('0x28')](_0x30eab3,function(_0x2177d9){if(_0x2177d9[_0xc243('0x2a')]!==_0xc243('0x3a')){var _0x1cad64={};_0x1cad64[_0x2177d9[_0xc243('0x26')]]={'$like':'%'+_0x18f9aa['query'][_0xc243('0x38')]+'%'};return _0x1cad64;}})});}_0x43e473=_[_0xc243('0x39')]({},_0x43e473,_0x18f9aa['options']);var _0x29d489={'where':_0x43e473['where']};return db[_0xc243('0x29')][_0xc243('0x1f')](_0x29d489)[_0xc243('0x23')](function(_0x5e04ff){_0x4a448b[_0xc243('0x1f')]=_0x5e04ff;if(_0x18f9aa['query'][_0xc243('0x3b')]){_0x43e473[_0xc243('0x3c')]=[{'all':!![]}];}return db[_0xc243('0x29')]['findAll'](_0x43e473);})[_0xc243('0x23')](function(_0x41fb44){_0x4a448b['rows']=_0x41fb44;return _0x4a448b;})[_0xc243('0x23')](respondWithFilteredResult(_0x1eaa5a,_0x43e473))[_0xc243('0x3d')](handleError(_0x1eaa5a,null));};exports[_0xc243('0x3e')]=function(_0x547c2d,_0x16d54f){var _0x2a3a83={'raw':![],'where':{'id':_0x547c2d[_0xc243('0x3f')]['id']}},_0x3b00dc={};_0x3b00dc[_0xc243('0x2c')]=_[_0xc243('0x40')](db[_0xc243('0x29')][_0xc243('0x41')]);_0x3b00dc[_0xc243('0x2d')]=_[_0xc243('0x40')](_0x547c2d[_0xc243('0x2d')]);_0x3b00dc[_0xc243('0x2e')]=_[_0xc243('0x2f')](_0x3b00dc[_0xc243('0x2c')],_0x3b00dc['query']);_0x2a3a83[_0xc243('0x30')]=_[_0xc243('0x2f')](_0x3b00dc[_0xc243('0x2c')],qs[_0xc243('0x31')](_0x547c2d[_0xc243('0x2d')][_0xc243('0x31')]));_0x2a3a83[_0xc243('0x30')]=_0x2a3a83[_0xc243('0x30')][_0xc243('0x32')]?_0x2a3a83['attributes']:_0x3b00dc['model'];if(_0x547c2d[_0xc243('0x2d')]['includeAll']){_0x2a3a83[_0xc243('0x3c')]=[{'all':!![]}];}_0x2a3a83=_[_0xc243('0x39')]({},_0x2a3a83,_0x547c2d[_0xc243('0x42')]);return db[_0xc243('0x29')][_0xc243('0x43')](_0x2a3a83)[_0xc243('0x23')](handleEntityNotFound(_0x16d54f,null))[_0xc243('0x23')](respondWithResult(_0x16d54f,null))[_0xc243('0x3d')](handleError(_0x16d54f,null));};exports[_0xc243('0x44')]=function(_0x18bbb8,_0x28e54f){return db[_0xc243('0x29')]['create'](_0x18bbb8[_0xc243('0x45')],{})['then'](respondWithResult(_0x28e54f,0xc9))[_0xc243('0x3d')](handleError(_0x28e54f,null));};exports['update']=function(_0x4f6972,_0x4e84da){if(_0x4f6972[_0xc243('0x45')]['id']){delete _0x4f6972[_0xc243('0x45')]['id'];}return db[_0xc243('0x29')][_0xc243('0x43')]({'where':{'id':_0x4f6972[_0xc243('0x3f')]['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x4e84da,null))[_0xc243('0x23')](saveUpdates(_0x4f6972['body'],null))[_0xc243('0x23')](respondWithResult(_0x4e84da,null))['catch'](handleError(_0x4e84da,null));};exports[_0xc243('0x46')]=function(_0x2fd63e,_0x219c01){return db[_0xc243('0x29')][_0xc243('0x43')]({'where':{'id':_0x2fd63e['params']['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x219c01,null))[_0xc243('0x23')](removeEntity(_0x219c01,null))['catch'](handleError(_0x219c01,null));};exports[_0xc243('0x47')]=function(_0x16d110,_0x3616fe,_0x120a8f){var _0x25e45c={};var _0x5c6629={};var _0x4c7338;var _0x3767ee;return db[_0xc243('0x29')]['findOne']({'where':{'id':_0x16d110[_0xc243('0x3f')]['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x3616fe,null))[_0xc243('0x23')](function(_0x1a10ea){if(_0x1a10ea){_0x4c7338=_0x1a10ea;_0x5c6629['model']=_[_0xc243('0x40')](db[_0xc243('0x48')]['rawAttributes']);_0x5c6629[_0xc243('0x2d')]=_[_0xc243('0x40')](_0x16d110['query']);_0x5c6629[_0xc243('0x2e')]=_[_0xc243('0x2f')](_0x5c6629[_0xc243('0x2c')],_0x5c6629[_0xc243('0x2d')]);_0x25e45c[_0xc243('0x30')]=_[_0xc243('0x2f')](_0x5c6629['model'],qs[_0xc243('0x31')](_0x16d110[_0xc243('0x2d')]['fields']));_0x25e45c[_0xc243('0x30')]=_0x25e45c[_0xc243('0x30')]['length']?_0x25e45c['attributes']:_0x5c6629[_0xc243('0x2c')];_0x25e45c[_0xc243('0x34')]=qs[_0xc243('0x35')](_0x16d110[_0xc243('0x2d')]['sort']);_0x25e45c[_0xc243('0x36')]=qs['filters'](_[_0xc243('0x37')](_0x16d110['query'],_0x5c6629[_0xc243('0x2e')]));if(_0x16d110[_0xc243('0x2d')]['filter']){_0x25e45c['where']=_[_0xc243('0x39')](_0x25e45c[_0xc243('0x36')],{'$or':_['map'](_0x25e45c[_0xc243('0x30')],function(_0x325545){var _0x583e8c={};_0x583e8c[_0x325545]={'$like':'%'+_0x16d110[_0xc243('0x2d')][_0xc243('0x38')]+'%'};return _0x583e8c;})});}_0x25e45c=_[_0xc243('0x39')]({},_0x25e45c,_0x16d110[_0xc243('0x42')]);return _0x4c7338[_0xc243('0x47')](_0x25e45c);}})[_0xc243('0x23')](function(_0x4c86d2){if(_0x4c86d2){_0x3767ee=_0x4c86d2[_0xc243('0x32')];if(!_0x16d110['query'][_0xc243('0x49')](_0xc243('0x33'))){_0x25e45c[_0xc243('0x1e')]=qs[_0xc243('0x1e')](_0x16d110[_0xc243('0x2d')][_0xc243('0x1e')]);_0x25e45c[_0xc243('0x1c')]=qs[_0xc243('0x1c')](_0x16d110['query']['offset']);}return _0x4c7338['getSubjects'](_0x25e45c);}})[_0xc243('0x23')](function(_0x23bcf9){if(_0x23bcf9){return _0x23bcf9?{'count':_0x3767ee,'rows':_0x23bcf9}:null;}})[_0xc243('0x23')](respondWithResult(_0x3616fe,null))[_0xc243('0x3d')](handleError(_0x3616fe,null));};exports[_0xc243('0x4a')]=function(_0x573fdb,_0x11925e,_0x243ca6){var _0x5a27a9={};var _0x58bb1f={};var _0x2cce11;var _0x43ffbd;return db[_0xc243('0x29')]['findOne']({'where':{'id':_0x573fdb[_0xc243('0x3f')]['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x11925e,null))['then'](function(_0x290caa){if(_0x290caa){_0x2cce11=_0x290caa;_0x58bb1f['model']=_[_0xc243('0x40')](db[_0xc243('0x48')][_0xc243('0x41')]);_0x58bb1f['query']=_['keys'](_0x573fdb[_0xc243('0x2d')]);_0x58bb1f[_0xc243('0x2e')]=_[_0xc243('0x2f')](_0x58bb1f[_0xc243('0x2c')],_0x58bb1f[_0xc243('0x2d')]);_0x5a27a9[_0xc243('0x30')]=_[_0xc243('0x2f')](_0x58bb1f['model'],qs[_0xc243('0x31')](_0x573fdb[_0xc243('0x2d')][_0xc243('0x31')]));_0x5a27a9['attributes']=_0x5a27a9[_0xc243('0x30')][_0xc243('0x32')]?_0x5a27a9[_0xc243('0x30')]:_0x58bb1f['model'];_0x5a27a9[_0xc243('0x34')]=qs[_0xc243('0x35')](_0x573fdb['query'][_0xc243('0x35')]);_0x5a27a9['where']=qs['filters'](_['pick'](_0x573fdb[_0xc243('0x2d')],_0x58bb1f['filters']));if(_0x573fdb['query'][_0xc243('0x38')]){_0x5a27a9[_0xc243('0x36')]=_['merge'](_0x5a27a9[_0xc243('0x36')],{'$or':_[_0xc243('0x28')](_0x5a27a9[_0xc243('0x30')],function(_0x49c3f9){var _0x43fec9={};_0x43fec9[_0x49c3f9]={'$like':'%'+_0x573fdb[_0xc243('0x2d')][_0xc243('0x38')]+'%'};return _0x43fec9;})});}_0x5a27a9=_[_0xc243('0x39')]({},_0x5a27a9,_0x573fdb[_0xc243('0x42')]);return _0x2cce11[_0xc243('0x4a')](_0x5a27a9);}})[_0xc243('0x23')](function(_0x3a08d4){if(_0x3a08d4){_0x43ffbd=_0x3a08d4[_0xc243('0x32')];if(!_0x573fdb['query']['hasOwnProperty'](_0xc243('0x33'))){_0x5a27a9[_0xc243('0x1e')]=qs['limit'](_0x573fdb[_0xc243('0x2d')][_0xc243('0x1e')]);_0x5a27a9[_0xc243('0x1c')]=qs[_0xc243('0x1c')](_0x573fdb[_0xc243('0x2d')][_0xc243('0x1c')]);}return _0x2cce11[_0xc243('0x4a')](_0x5a27a9);}})[_0xc243('0x23')](function(_0x1cd38b){if(_0x1cd38b){return _0x1cd38b?{'count':_0x43ffbd,'rows':_0x1cd38b}:null;}})[_0xc243('0x23')](respondWithResult(_0x11925e,null))[_0xc243('0x3d')](handleError(_0x11925e,null));};exports[_0xc243('0x4b')]=function(_0x52f344,_0x548ba5,_0x5b4a27){var _0x3637fc={};var _0x20912f={};var _0x2cb872;var _0x14062d;return db['FreshsalesConfiguration'][_0xc243('0x4c')]({'where':{'id':_0x52f344[_0xc243('0x3f')]['id']}})[_0xc243('0x23')](handleEntityNotFound(_0x548ba5,null))[_0xc243('0x23')](function(_0x406d2b){if(_0x406d2b){_0x2cb872=_0x406d2b;_0x20912f['model']=_[_0xc243('0x40')](db[_0xc243('0x48')]['rawAttributes']);_0x20912f[_0xc243('0x2d')]=_[_0xc243('0x40')](_0x52f344[_0xc243('0x2d')]);_0x20912f['filters']=_['intersection'](_0x20912f[_0xc243('0x2c')],_0x20912f[_0xc243('0x2d')]);_0x3637fc['attributes']=_[_0xc243('0x2f')](_0x20912f[_0xc243('0x2c')],qs[_0xc243('0x31')](_0x52f344[_0xc243('0x2d')][_0xc243('0x31')]));_0x3637fc[_0xc243('0x30')]=_0x3637fc[_0xc243('0x30')][_0xc243('0x32')]?_0x3637fc['attributes']:_0x20912f[_0xc243('0x2c')];_0x3637fc[_0xc243('0x34')]=qs[_0xc243('0x35')](_0x52f344[_0xc243('0x2d')]['sort']);_0x3637fc[_0xc243('0x36')]=qs['filters'](_[_0xc243('0x37')](_0x52f344[_0xc243('0x2d')],_0x20912f[_0xc243('0x2e')]));if(_0x52f344[_0xc243('0x2d')][_0xc243('0x38')]){_0x3637fc[_0xc243('0x36')]=_['merge'](_0x3637fc[_0xc243('0x36')],{'$or':_[_0xc243('0x28')](_0x3637fc[_0xc243('0x30')],function(_0x2798f5){var _0x554c07={};_0x554c07[_0x2798f5]={'$like':'%'+_0x52f344[_0xc243('0x2d')][_0xc243('0x38')]+'%'};return _0x554c07;})});}_0x3637fc=_[_0xc243('0x39')]({},_0x3637fc,_0x52f344[_0xc243('0x42')]);return _0x2cb872[_0xc243('0x4b')](_0x3637fc);}})['then'](function(_0x4e5932){if(_0x4e5932){_0x14062d=_0x4e5932['length'];if(!_0x52f344['query'][_0xc243('0x49')](_0xc243('0x33'))){_0x3637fc[_0xc243('0x1e')]=qs[_0xc243('0x1e')](_0x52f344[_0xc243('0x2d')]['limit']);_0x3637fc[_0xc243('0x1c')]=qs[_0xc243('0x1c')](_0x52f344[_0xc243('0x2d')][_0xc243('0x1c')]);}return _0x2cb872[_0xc243('0x4b')](_0x3637fc);}})[_0xc243('0x23')](function(_0x316738){if(_0x316738){return _0x316738?{'count':_0x14062d,'rows':_0x316738}:null;}})[_0xc243('0x23')](respondWithResult(_0x548ba5,null))['catch'](handleError(_0x548ba5,null));}; \ No newline at end of file +var _0xd1fe=['filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','getSubjects','findOne','FreshsalesField','pick','getDescriptions','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys'];(function(_0x4ba576,_0x516264){var _0x60119a=function(_0x46bf76){while(--_0x46bf76){_0x4ba576['push'](_0x4ba576['shift']());}};_0x60119a(++_0x516264);}(_0xd1fe,0xb2));var _0xed1f=function(_0x1735c7,_0x14d35c){_0x1735c7=_0x1735c7-0x0;var _0x3a5d2c=_0xd1fe[_0x1735c7];return _0x3a5d2c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xed1f('0x0'));var jsonpatch=require(_0xed1f('0x1'));var rp=require(_0xed1f('0x2'));var moment=require(_0xed1f('0x3'));var BPromise=require(_0xed1f('0x4'));var Mustache=require(_0xed1f('0x5'));var util=require('util');var path=require(_0xed1f('0x6'));var sox=require(_0xed1f('0x7'));var csv=require(_0xed1f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed1f('0x9'));var crypto=require(_0xed1f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xed1f('0xb'));var toCsv=require(_0xed1f('0x8'));var querystring=require(_0xed1f('0xc'));var Papa=require(_0xed1f('0xd'));var Redis=require('ioredis');var authService=require(_0xed1f('0xe'));var qs=require(_0xed1f('0xf'));var as=require(_0xed1f('0x10'));var hardwareService=require(_0xed1f('0x11'));var logger=require(_0xed1f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xed1f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xed1f('0x14'))['db'];function respondWithStatusCode(_0x4c6f3b,_0x3678c1){_0x3678c1=_0x3678c1||0xcc;return function(_0x5265b8){if(_0x5265b8){return _0x4c6f3b[_0xed1f('0x15')](_0x3678c1);}return _0x4c6f3b[_0xed1f('0x16')](_0x3678c1)['end']();};}function respondWithResult(_0x1d524b,_0x5d25d8){_0x5d25d8=_0x5d25d8||0xc8;return function(_0x4a3b8f){if(_0x4a3b8f){return _0x1d524b[_0xed1f('0x16')](_0x5d25d8)[_0xed1f('0x17')](_0x4a3b8f);}};}function respondWithFilteredResult(_0x10e7c2,_0x49296d){return function(_0x6cd2bd){if(_0x6cd2bd){var _0x55579b=typeof _0x49296d['offset']===_0xed1f('0x18')&&typeof _0x49296d[_0xed1f('0x19')]===_0xed1f('0x18');var _0x487cef=_0x6cd2bd[_0xed1f('0x1a')];var _0x58dc28=_0x55579b?0x0:_0x49296d[_0xed1f('0x1b')];var _0x2081c4=_0x55579b?_0x6cd2bd[_0xed1f('0x1a')]:_0x49296d[_0xed1f('0x1b')]+_0x49296d[_0xed1f('0x19')];var _0x312a4c;if(_0x2081c4>=_0x487cef){_0x2081c4=_0x487cef;_0x312a4c=0xc8;}else{_0x312a4c=0xce;}_0x10e7c2[_0xed1f('0x16')](_0x312a4c);return _0x10e7c2['set'](_0xed1f('0x1c'),_0x58dc28+'-'+_0x2081c4+'/'+_0x487cef)['json'](_0x6cd2bd);}return null;};}function patchUpdates(_0x442021){return function(_0xd0baaf){try{jsonpatch['apply'](_0xd0baaf,_0x442021,!![]);}catch(_0x14e27f){return BPromise['reject'](_0x14e27f);}return _0xd0baaf[_0xed1f('0x1d')]();};}function saveUpdates(_0x247145,_0x57c627){return function(_0x49394d){if(_0x49394d){return _0x49394d[_0xed1f('0x1e')](_0x247145)[_0xed1f('0x1f')](function(_0x5bdc6b){return _0x5bdc6b;});}return null;};}function removeEntity(_0x5c5ba2,_0x45dbe2){return function(_0x402373){if(_0x402373){return _0x402373[_0xed1f('0x20')]()[_0xed1f('0x1f')](function(){_0x5c5ba2[_0xed1f('0x16')](0xcc)[_0xed1f('0x21')]();});}};}function handleEntityNotFound(_0x258dfd,_0x19eb52){return function(_0x48bca6){if(!_0x48bca6){_0x258dfd[_0xed1f('0x15')](0x194);}return _0x48bca6;};}function handleError(_0x3ee45a,_0x27ac75){_0x27ac75=_0x27ac75||0x1f4;return function(_0x4b0617){logger[_0xed1f('0x22')](_0x4b0617[_0xed1f('0x23')]);if(_0x4b0617[_0xed1f('0x24')]){delete _0x4b0617[_0xed1f('0x24')];}_0x3ee45a[_0xed1f('0x16')](_0x27ac75)[_0xed1f('0x25')](_0x4b0617);};}exports[_0xed1f('0x26')]=function(_0x30a95d,_0x4c5782){var _0x5654ba={},_0x1488ce={},_0x4148e7={'count':0x0,'rows':[]};var _0x479a9a=_[_0xed1f('0x27')](db[_0xed1f('0x28')][_0xed1f('0x29')],function(_0x2f6cc2){return{'name':_0x2f6cc2['fieldName'],'type':_0x2f6cc2[_0xed1f('0x2a')][_0xed1f('0x2b')]};});_0x1488ce[_0xed1f('0x2c')]=_[_0xed1f('0x27')](_0x479a9a,_0xed1f('0x24'));_0x1488ce[_0xed1f('0x2d')]=_[_0xed1f('0x2e')](_0x30a95d[_0xed1f('0x2d')]);_0x1488ce[_0xed1f('0x2f')]=_[_0xed1f('0x30')](_0x1488ce[_0xed1f('0x2c')],_0x1488ce[_0xed1f('0x2d')]);_0x5654ba[_0xed1f('0x31')]=_['intersection'](_0x1488ce[_0xed1f('0x2c')],qs[_0xed1f('0x32')](_0x30a95d[_0xed1f('0x2d')][_0xed1f('0x32')]));_0x5654ba['attributes']=_0x5654ba['attributes'][_0xed1f('0x33')]?_0x5654ba[_0xed1f('0x31')]:_0x1488ce[_0xed1f('0x2c')];if(!_0x30a95d['query']['hasOwnProperty'](_0xed1f('0x34'))){_0x5654ba[_0xed1f('0x19')]=qs[_0xed1f('0x19')](_0x30a95d[_0xed1f('0x2d')][_0xed1f('0x19')]);_0x5654ba[_0xed1f('0x1b')]=qs[_0xed1f('0x1b')](_0x30a95d[_0xed1f('0x2d')]['offset']);}_0x5654ba[_0xed1f('0x35')]=qs[_0xed1f('0x36')](_0x30a95d[_0xed1f('0x2d')][_0xed1f('0x36')]);_0x5654ba[_0xed1f('0x37')]=qs[_0xed1f('0x2f')](_['pick'](_0x30a95d[_0xed1f('0x2d')],_0x1488ce[_0xed1f('0x2f')]),_0x479a9a);if(_0x30a95d[_0xed1f('0x2d')][_0xed1f('0x38')]){_0x5654ba['where']=_[_0xed1f('0x39')](_0x5654ba[_0xed1f('0x37')],{'$or':_['map'](_0x479a9a,function(_0x3549f0){if(_0x3549f0['type']!==_0xed1f('0x3a')){var _0x840172={};_0x840172[_0x3549f0[_0xed1f('0x24')]]={'$like':'%'+_0x30a95d['query'][_0xed1f('0x38')]+'%'};return _0x840172;}})});}_0x5654ba=_[_0xed1f('0x39')]({},_0x5654ba,_0x30a95d[_0xed1f('0x3b')]);var _0x8cb4d0={'where':_0x5654ba[_0xed1f('0x37')]};return db[_0xed1f('0x28')][_0xed1f('0x1a')](_0x8cb4d0)[_0xed1f('0x1f')](function(_0x3e3ef9){_0x4148e7[_0xed1f('0x1a')]=_0x3e3ef9;if(_0x30a95d[_0xed1f('0x2d')][_0xed1f('0x3c')]){_0x5654ba[_0xed1f('0x3d')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x5654ba);})[_0xed1f('0x1f')](function(_0x5b6845){_0x4148e7[_0xed1f('0x3e')]=_0x5b6845;return _0x4148e7;})['then'](respondWithFilteredResult(_0x4c5782,_0x5654ba))[_0xed1f('0x3f')](handleError(_0x4c5782,null));};exports[_0xed1f('0x40')]=function(_0x3a179c,_0x50ec62){var _0x293ab5={'raw':![],'where':{'id':_0x3a179c[_0xed1f('0x41')]['id']}},_0xbbef66={};_0xbbef66[_0xed1f('0x2c')]=_[_0xed1f('0x2e')](db[_0xed1f('0x28')]['rawAttributes']);_0xbbef66[_0xed1f('0x2d')]=_[_0xed1f('0x2e')](_0x3a179c['query']);_0xbbef66[_0xed1f('0x2f')]=_['intersection'](_0xbbef66['model'],_0xbbef66['query']);_0x293ab5['attributes']=_[_0xed1f('0x30')](_0xbbef66[_0xed1f('0x2c')],qs[_0xed1f('0x32')](_0x3a179c[_0xed1f('0x2d')][_0xed1f('0x32')]));_0x293ab5[_0xed1f('0x31')]=_0x293ab5[_0xed1f('0x31')][_0xed1f('0x33')]?_0x293ab5[_0xed1f('0x31')]:_0xbbef66['model'];if(_0x3a179c[_0xed1f('0x2d')][_0xed1f('0x3c')]){_0x293ab5[_0xed1f('0x3d')]=[{'all':!![]}];}_0x293ab5=_[_0xed1f('0x39')]({},_0x293ab5,_0x3a179c[_0xed1f('0x3b')]);return db[_0xed1f('0x28')]['find'](_0x293ab5)['then'](handleEntityNotFound(_0x50ec62,null))[_0xed1f('0x1f')](respondWithResult(_0x50ec62,null))[_0xed1f('0x3f')](handleError(_0x50ec62,null));};exports[_0xed1f('0x42')]=function(_0x3b8a60,_0x1c6c42){return db['FreshsalesConfiguration']['create'](_0x3b8a60[_0xed1f('0x43')],{})[_0xed1f('0x1f')](respondWithResult(_0x1c6c42,0xc9))['catch'](handleError(_0x1c6c42,null));};exports[_0xed1f('0x1e')]=function(_0x2206d9,_0x2964c7){if(_0x2206d9[_0xed1f('0x43')]['id']){delete _0x2206d9[_0xed1f('0x43')]['id'];}return db[_0xed1f('0x28')][_0xed1f('0x44')]({'where':{'id':_0x2206d9[_0xed1f('0x41')]['id']}})[_0xed1f('0x1f')](handleEntityNotFound(_0x2964c7,null))['then'](saveUpdates(_0x2206d9['body'],null))['then'](respondWithResult(_0x2964c7,null))[_0xed1f('0x3f')](handleError(_0x2964c7,null));};exports[_0xed1f('0x20')]=function(_0x2a5ae8,_0x2184dc){return db['FreshsalesConfiguration'][_0xed1f('0x44')]({'where':{'id':_0x2a5ae8[_0xed1f('0x41')]['id']}})['then'](handleEntityNotFound(_0x2184dc,null))[_0xed1f('0x1f')](removeEntity(_0x2184dc,null))[_0xed1f('0x3f')](handleError(_0x2184dc,null));};exports[_0xed1f('0x45')]=function(_0x476e09,_0x131a3a,_0x3a088d){var _0x3eed1e={};var _0x3d74cb={};var _0xf03c6e;var _0x46daba;return db[_0xed1f('0x28')][_0xed1f('0x46')]({'where':{'id':_0x476e09[_0xed1f('0x41')]['id']}})['then'](handleEntityNotFound(_0x131a3a,null))[_0xed1f('0x1f')](function(_0x570aaf){if(_0x570aaf){_0xf03c6e=_0x570aaf;_0x3d74cb[_0xed1f('0x2c')]=_[_0xed1f('0x2e')](db[_0xed1f('0x47')][_0xed1f('0x29')]);_0x3d74cb['query']=_[_0xed1f('0x2e')](_0x476e09['query']);_0x3d74cb[_0xed1f('0x2f')]=_['intersection'](_0x3d74cb[_0xed1f('0x2c')],_0x3d74cb[_0xed1f('0x2d')]);_0x3eed1e[_0xed1f('0x31')]=_['intersection'](_0x3d74cb[_0xed1f('0x2c')],qs[_0xed1f('0x32')](_0x476e09[_0xed1f('0x2d')][_0xed1f('0x32')]));_0x3eed1e['attributes']=_0x3eed1e[_0xed1f('0x31')][_0xed1f('0x33')]?_0x3eed1e[_0xed1f('0x31')]:_0x3d74cb['model'];_0x3eed1e[_0xed1f('0x35')]=qs[_0xed1f('0x36')](_0x476e09[_0xed1f('0x2d')]['sort']);_0x3eed1e['where']=qs[_0xed1f('0x2f')](_[_0xed1f('0x48')](_0x476e09[_0xed1f('0x2d')],_0x3d74cb['filters']));if(_0x476e09['query'][_0xed1f('0x38')]){_0x3eed1e[_0xed1f('0x37')]=_[_0xed1f('0x39')](_0x3eed1e[_0xed1f('0x37')],{'$or':_['map'](_0x3eed1e[_0xed1f('0x31')],function(_0x50bea0){var _0x22c4dd={};_0x22c4dd[_0x50bea0]={'$like':'%'+_0x476e09['query'][_0xed1f('0x38')]+'%'};return _0x22c4dd;})});}_0x3eed1e=_[_0xed1f('0x39')]({},_0x3eed1e,_0x476e09[_0xed1f('0x3b')]);return _0xf03c6e[_0xed1f('0x45')](_0x3eed1e);}})[_0xed1f('0x1f')](function(_0x2f9110){if(_0x2f9110){_0x46daba=_0x2f9110['length'];if(!_0x476e09[_0xed1f('0x2d')]['hasOwnProperty'](_0xed1f('0x34'))){_0x3eed1e[_0xed1f('0x19')]=qs[_0xed1f('0x19')](_0x476e09[_0xed1f('0x2d')][_0xed1f('0x19')]);_0x3eed1e[_0xed1f('0x1b')]=qs['offset'](_0x476e09[_0xed1f('0x2d')][_0xed1f('0x1b')]);}return _0xf03c6e[_0xed1f('0x45')](_0x3eed1e);}})[_0xed1f('0x1f')](function(_0x5ef3cf){if(_0x5ef3cf){return _0x5ef3cf?{'count':_0x46daba,'rows':_0x5ef3cf}:null;}})[_0xed1f('0x1f')](respondWithResult(_0x131a3a,null))[_0xed1f('0x3f')](handleError(_0x131a3a,null));};exports[_0xed1f('0x49')]=function(_0x25825b,_0x3c80fd,_0x25407d){var _0x5eec80={};var _0x58827e={};var _0x3e2b5c;var _0x3045c4;return db[_0xed1f('0x28')][_0xed1f('0x46')]({'where':{'id':_0x25825b[_0xed1f('0x41')]['id']}})[_0xed1f('0x1f')](handleEntityNotFound(_0x3c80fd,null))[_0xed1f('0x1f')](function(_0x4919ac){if(_0x4919ac){_0x3e2b5c=_0x4919ac;_0x58827e['model']=_[_0xed1f('0x2e')](db[_0xed1f('0x47')][_0xed1f('0x29')]);_0x58827e['query']=_['keys'](_0x25825b['query']);_0x58827e['filters']=_[_0xed1f('0x30')](_0x58827e[_0xed1f('0x2c')],_0x58827e[_0xed1f('0x2d')]);_0x5eec80[_0xed1f('0x31')]=_[_0xed1f('0x30')](_0x58827e[_0xed1f('0x2c')],qs[_0xed1f('0x32')](_0x25825b['query'][_0xed1f('0x32')]));_0x5eec80[_0xed1f('0x31')]=_0x5eec80[_0xed1f('0x31')][_0xed1f('0x33')]?_0x5eec80[_0xed1f('0x31')]:_0x58827e[_0xed1f('0x2c')];_0x5eec80[_0xed1f('0x35')]=qs[_0xed1f('0x36')](_0x25825b[_0xed1f('0x2d')][_0xed1f('0x36')]);_0x5eec80['where']=qs['filters'](_[_0xed1f('0x48')](_0x25825b[_0xed1f('0x2d')],_0x58827e[_0xed1f('0x2f')]));if(_0x25825b[_0xed1f('0x2d')][_0xed1f('0x38')]){_0x5eec80['where']=_[_0xed1f('0x39')](_0x5eec80['where'],{'$or':_[_0xed1f('0x27')](_0x5eec80[_0xed1f('0x31')],function(_0x34cc25){var _0x5ae6dd={};_0x5ae6dd[_0x34cc25]={'$like':'%'+_0x25825b[_0xed1f('0x2d')][_0xed1f('0x38')]+'%'};return _0x5ae6dd;})});}_0x5eec80=_[_0xed1f('0x39')]({},_0x5eec80,_0x25825b[_0xed1f('0x3b')]);return _0x3e2b5c[_0xed1f('0x49')](_0x5eec80);}})[_0xed1f('0x1f')](function(_0x5cf1ef){if(_0x5cf1ef){_0x3045c4=_0x5cf1ef[_0xed1f('0x33')];if(!_0x25825b[_0xed1f('0x2d')][_0xed1f('0x4a')]('nolimit')){_0x5eec80[_0xed1f('0x19')]=qs[_0xed1f('0x19')](_0x25825b['query'][_0xed1f('0x19')]);_0x5eec80[_0xed1f('0x1b')]=qs[_0xed1f('0x1b')](_0x25825b[_0xed1f('0x2d')][_0xed1f('0x1b')]);}return _0x3e2b5c[_0xed1f('0x49')](_0x5eec80);}})[_0xed1f('0x1f')](function(_0x59231c){if(_0x59231c){return _0x59231c?{'count':_0x3045c4,'rows':_0x59231c}:null;}})['then'](respondWithResult(_0x3c80fd,null))['catch'](handleError(_0x3c80fd,null));};exports['getFields']=function(_0x110818,_0x46843f,_0x2a0ddd){var _0x12557a={};var _0x4c6cf3={};var _0xa32ef4;var _0x15319f;return db[_0xed1f('0x28')][_0xed1f('0x46')]({'where':{'id':_0x110818[_0xed1f('0x41')]['id']}})['then'](handleEntityNotFound(_0x46843f,null))['then'](function(_0x617564){if(_0x617564){_0xa32ef4=_0x617564;_0x4c6cf3[_0xed1f('0x2c')]=_[_0xed1f('0x2e')](db[_0xed1f('0x47')][_0xed1f('0x29')]);_0x4c6cf3[_0xed1f('0x2d')]=_['keys'](_0x110818[_0xed1f('0x2d')]);_0x4c6cf3[_0xed1f('0x2f')]=_[_0xed1f('0x30')](_0x4c6cf3[_0xed1f('0x2c')],_0x4c6cf3[_0xed1f('0x2d')]);_0x12557a['attributes']=_['intersection'](_0x4c6cf3['model'],qs[_0xed1f('0x32')](_0x110818[_0xed1f('0x2d')][_0xed1f('0x32')]));_0x12557a[_0xed1f('0x31')]=_0x12557a[_0xed1f('0x31')]['length']?_0x12557a['attributes']:_0x4c6cf3[_0xed1f('0x2c')];_0x12557a[_0xed1f('0x35')]=qs['sort'](_0x110818[_0xed1f('0x2d')][_0xed1f('0x36')]);_0x12557a[_0xed1f('0x37')]=qs[_0xed1f('0x2f')](_['pick'](_0x110818['query'],_0x4c6cf3[_0xed1f('0x2f')]));if(_0x110818['query'][_0xed1f('0x38')]){_0x12557a[_0xed1f('0x37')]=_[_0xed1f('0x39')](_0x12557a[_0xed1f('0x37')],{'$or':_[_0xed1f('0x27')](_0x12557a[_0xed1f('0x31')],function(_0x4fa3e6){var _0xe60f09={};_0xe60f09[_0x4fa3e6]={'$like':'%'+_0x110818['query'][_0xed1f('0x38')]+'%'};return _0xe60f09;})});}_0x12557a=_['merge']({},_0x12557a,_0x110818[_0xed1f('0x3b')]);return _0xa32ef4['getFields'](_0x12557a);}})['then'](function(_0x389717){if(_0x389717){_0x15319f=_0x389717[_0xed1f('0x33')];if(!_0x110818[_0xed1f('0x2d')][_0xed1f('0x4a')](_0xed1f('0x34'))){_0x12557a[_0xed1f('0x19')]=qs[_0xed1f('0x19')](_0x110818[_0xed1f('0x2d')]['limit']);_0x12557a[_0xed1f('0x1b')]=qs[_0xed1f('0x1b')](_0x110818['query'][_0xed1f('0x1b')]);}return _0xa32ef4['getFields'](_0x12557a);}})['then'](function(_0xdba6a9){if(_0xdba6a9){return _0xdba6a9?{'count':_0x15319f,'rows':_0xdba6a9}:null;}})[_0xed1f('0x1f')](respondWithResult(_0x46843f,null))[_0xed1f('0x3f')](handleError(_0x46843f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 33d7e7e..9cf40a6 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 _0xe0f9=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x3a84b9,_0x529c82){var _0x566814=function(_0x5f31d0){while(--_0x5f31d0){_0x3a84b9['push'](_0x3a84b9['shift']());}};_0x566814(++_0x529c82);}(_0xe0f9,0xb5));var _0x9e0f=function(_0xd326ae,_0x2ad48e){_0xd326ae=_0xd326ae-0x0;var _0xdc099d=_0xe0f9[_0xd326ae];return _0xdc099d;};'use strict';var _=require(_0x9e0f('0x0'));var util=require(_0x9e0f('0x1'));var logger=require(_0x9e0f('0x2'))(_0x9e0f('0x3'));var moment=require(_0x9e0f('0x4'));var BPromise=require(_0x9e0f('0x5'));var rp=require(_0x9e0f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e0f('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e0f('0x8'));module[_0x9e0f('0x9')]=function(_0xb60648,_0x4ab50a){return _0xb60648[_0x9e0f('0xa')](_0x9e0f('0xb'),attributes,{'tableName':_0x9e0f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70ff=['util','../../config/logger','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash'];(function(_0x2e05fe,_0x5cc74a){var _0x24fde0=function(_0x2553bd){while(--_0x2553bd){_0x2e05fe['push'](_0x2e05fe['shift']());}};_0x24fde0(++_0x5cc74a);}(_0x70ff,0xaf));var _0xf70f=function(_0xe3b7bb,_0x263836){_0xe3b7bb=_0xe3b7bb-0x0;var _0x2df486=_0x70ff[_0xe3b7bb];return _0x2df486;};'use strict';var _=require(_0xf70f('0x0'));var util=require(_0xf70f('0x1'));var logger=require(_0xf70f('0x2'))('api');var moment=require(_0xf70f('0x3'));var BPromise=require('bluebird');var rp=require(_0xf70f('0x4'));var fs=require('fs');var path=require(_0xf70f('0x5'));var rimraf=require(_0xf70f('0x6'));var config=require('../../config/environment');var attributes=require(_0xf70f('0x7'));module[_0xf70f('0x8')]=function(_0x5b0746,_0x590c09){return _0x5b0746[_0xf70f('0x9')](_0xf70f('0xa'),attributes,{'tableName':'int_freshsales_configurations','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 b96bd19..8f4b140 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 _0x6f7b=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','catch','util','moment'];(function(_0x92f9d5,_0x11a2fa){var _0xd4e98a=function(_0x12e3b6){while(--_0x12e3b6){_0x92f9d5['push'](_0x92f9d5['shift']());}};_0xd4e98a(++_0x11a2fa);}(_0x6f7b,0x11f));var _0xb6f7=function(_0x364b08,_0x1d35a0){_0x364b08=_0x364b08-0x0;var _0x17d900=_0x6f7b[_0x364b08];return _0x17d900;};'use strict';var _=require('lodash');var util=require(_0xb6f7('0x0'));var moment=require(_0xb6f7('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6f7('0x2'));var fs=require('fs');var Redis=require(_0xb6f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6f7('0x4'));var logger=require('../../config/logger')(_0xb6f7('0x5'));var config=require(_0xb6f7('0x6'));var jayson=require(_0xb6f7('0x7'));var client=jayson[_0xb6f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4672ce,_0x120edb,_0x3b5248){return new BPromise(function(_0x3fd281,_0x589234){return client['request'](_0x4672ce,_0x3b5248)['then'](function(_0x2db80c){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x120edb,_0xb6f7('0x9'));logger['debug'](_0xb6f7('0xa'),_0x120edb,_0xb6f7('0x9'),JSON['stringify'](_0x2db80c));if(_0x2db80c['error']){if(_0x2db80c[_0xb6f7('0xb')][_0xb6f7('0xc')]===0x1f4){logger[_0xb6f7('0xb')](_0xb6f7('0xd'),_0x120edb,_0x2db80c['error'][_0xb6f7('0xe')]);return _0x589234(_0x2db80c['error'][_0xb6f7('0xe')]);}logger[_0xb6f7('0xb')](_0xb6f7('0xd'),_0x120edb,_0x2db80c['error'][_0xb6f7('0xe')]);return _0x3fd281(_0x2db80c[_0xb6f7('0xb')][_0xb6f7('0xe')]);}else{logger[_0xb6f7('0xf')](_0xb6f7('0xd'),_0x120edb,_0xb6f7('0x9'));_0x3fd281(_0x2db80c['result'][_0xb6f7('0xe')]);}})[_0xb6f7('0x10')](function(_0xe0f0f6){logger[_0xb6f7('0xb')](_0xb6f7('0xd'),_0x120edb,_0xe0f0f6);_0x589234(_0xe0f0f6);});});} \ No newline at end of file +var _0xa98f=['code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa98f,0xd5));var _0xfa98=function(_0x3b7db2,_0x5edd58){_0x3b7db2=_0x3b7db2-0x0;var _0x3a819e=_0xa98f[_0x3b7db2];return _0x3a819e;};'use strict';var _=require(_0xfa98('0x0'));var util=require(_0xfa98('0x1'));var moment=require(_0xfa98('0x2'));var BPromise=require(_0xfa98('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa98('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa98('0x5'));var logger=require('../../config/logger')(_0xfa98('0x6'));var config=require(_0xfa98('0x7'));var jayson=require(_0xfa98('0x8'));var client=jayson['client'][_0xfa98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55126b,_0x53bec4,_0x4cb0fb){return new BPromise(function(_0x4c9cc8,_0x4a9988){return client[_0xfa98('0xa')](_0x55126b,_0x4cb0fb)[_0xfa98('0xb')](function(_0xf72354){logger['info'](_0xfa98('0xc'),_0x53bec4,'request\x20sent');logger[_0xfa98('0xd')](_0xfa98('0xe'),_0x53bec4,'request\x20sent',JSON[_0xfa98('0xf')](_0xf72354));if(_0xf72354[_0xfa98('0x10')]){if(_0xf72354['error'][_0xfa98('0x11')]===0x1f4){logger[_0xfa98('0x10')](_0xfa98('0xc'),_0x53bec4,_0xf72354[_0xfa98('0x10')][_0xfa98('0x12')]);return _0x4a9988(_0xf72354[_0xfa98('0x10')][_0xfa98('0x12')]);}logger[_0xfa98('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x53bec4,_0xf72354[_0xfa98('0x10')][_0xfa98('0x12')]);return _0x4c9cc8(_0xf72354[_0xfa98('0x10')][_0xfa98('0x12')]);}else{logger[_0xfa98('0x13')](_0xfa98('0xc'),_0x53bec4,_0xfa98('0x14'));_0x4c9cc8(_0xf72354[_0xfa98('0x15')][_0xfa98('0x12')]);}})[_0xfa98('0x16')](function(_0x5a4495){logger[_0xfa98('0x10')](_0xfa98('0xc'),_0x53bec4,_0x5a4495);_0x4a9988(_0x5a4495);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8c086df..f840229 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 _0x6c6f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x4e3596,_0x396b1c){_0x4e3596=_0x4e3596-0x0;var _0x1a2b21=_0x6c6f[_0x4e3596];return _0x1a2b21;};'use strict';var multer=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var path=require(_0xf6c6('0x2'));var timeout=require(_0xf6c6('0x3'));var express=require(_0xf6c6('0x4'));var router=express[_0xf6c6('0x5')]();var fs_extra=require(_0xf6c6('0x6'));var auth=require(_0xf6c6('0x7'));var interaction=require(_0xf6c6('0x8'));var config=require(_0xf6c6('0x9'));var controller=require(_0xf6c6('0xa'));router['get']('/',auth[_0xf6c6('0xb')](),controller['index']);router['get'](_0xf6c6('0xc'),auth['isAuthenticated'](),controller[_0xf6c6('0xd')]);router[_0xf6c6('0xe')]('/',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0xf')]);router[_0xf6c6('0x10')]('/:id',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x11')]);router['delete'](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2b84=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3e78ce,_0x3ead3c){var _0x1eaf5f=function(_0x268449){while(--_0x268449){_0x3e78ce['push'](_0x3e78ce['shift']());}};_0x1eaf5f(++_0x3ead3c);}(_0x2b84,0x105));var _0x42b8=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2b84[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x42b8('0x0'));var util=require('util');var path=require(_0x42b8('0x1'));var timeout=require(_0x42b8('0x2'));var express=require(_0x42b8('0x3'));var router=express[_0x42b8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x42b8('0x5'));var interaction=require(_0x42b8('0x6'));var config=require(_0x42b8('0x7'));var controller=require(_0x42b8('0x8'));router[_0x42b8('0x9')]('/',auth[_0x42b8('0xa')](),controller[_0x42b8('0xb')]);router[_0x42b8('0x9')]('/:id',auth[_0x42b8('0xa')](),controller['show']);router[_0x42b8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x42b8('0xd')](_0x42b8('0xe'),auth[_0x42b8('0xa')](),controller[_0x42b8('0xf')]);router[_0x42b8('0x10')]('/:id',auth[_0x42b8('0xa')](),controller[_0x42b8('0x11')]);module[_0x42b8('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6774b47..e80a457 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 _0xeeb5=['ENUM','variable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x42bfc9,_0x92ccf5){var _0x645e2b=function(_0x5d7d7d){while(--_0x5d7d7d){_0x42bfc9['push'](_0x42bfc9['shift']());}};_0x645e2b(++_0x92ccf5);}(_0xeeb5,0x6a));var _0x5eeb=function(_0x169ea9,_0xf9fc24){_0x169ea9=_0x169ea9-0x0;var _0x1ab3e3=_0xeeb5[_0x169ea9];return _0x1ab3e3;};'use strict';var Sequelize=require(_0x5eeb('0x0'));module[_0x5eeb('0x1')]={'type':{'type':Sequelize[_0x5eeb('0x2')]('string',_0x5eeb('0x3'),'customVariable',_0x5eeb('0x4'),_0x5eeb('0x5')),'defaultValue':_0x5eeb('0x6')},'content':{'type':Sequelize[_0x5eeb('0x7')]},'key':{'type':Sequelize[_0x5eeb('0x7')]},'keyType':{'type':Sequelize[_0x5eeb('0x2')](_0x5eeb('0x6'),_0x5eeb('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5eeb('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5eeb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5eeb('0x7')]}}; \ No newline at end of file +var _0x6908=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x4574b0,_0x3bd754){var _0x3d720c=function(_0x18a7da){while(--_0x18a7da){_0x4574b0['push'](_0x4574b0['shift']());}};_0x3d720c(++_0x3bd754);}(_0x6908,0xa0));var _0x8690=function(_0x114a18,_0x19ef32){_0x114a18=_0x114a18-0x0;var _0x17b4d3=_0x6908[_0x114a18];return _0x17b4d3;};'use strict';var Sequelize=require(_0x8690('0x0'));module[_0x8690('0x1')]={'type':{'type':Sequelize[_0x8690('0x2')](_0x8690('0x3'),_0x8690('0x4'),_0x8690('0x5'),_0x8690('0x6'),_0x8690('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8690('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8690('0x2')](_0x8690('0x3'),_0x8690('0x4'),_0x8690('0x5'))},'keyContent':{'type':Sequelize[_0x8690('0x8')]},'idField':{'type':Sequelize[_0x8690('0x8')]},'nameField':{'type':Sequelize[_0x8690('0x8')]},'customField':{'type':Sequelize[_0x8690('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a72b001..0183b1f 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 _0x7137=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','fieldName','type','key','keys','query','filters','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch','rawAttributes','intersection','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7137,0xd0));var _0x7713=function(_0x1460fd,_0x2c3e08){_0x1460fd=_0x1460fd-0x0;var _0x44f25c=_0x7137[_0x1460fd];return _0x44f25c;};'use strict';var emlformat=require(_0x7713('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7713('0x1'));var jsonpatch=require(_0x7713('0x2'));var rp=require(_0x7713('0x3'));var moment=require('moment');var BPromise=require(_0x7713('0x4'));var Mustache=require(_0x7713('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7713('0x6'));var ejs=require(_0x7713('0x7'));var fs=require('fs');var fs_extra=require(_0x7713('0x8'));var _=require('lodash');var squel=require(_0x7713('0x9'));var crypto=require(_0x7713('0xa'));var jsforce=require(_0x7713('0xb'));var deskjs=require(_0x7713('0xc'));var toCsv=require(_0x7713('0x6'));var querystring=require(_0x7713('0xd'));var Papa=require(_0x7713('0xe'));var Redis=require(_0x7713('0xf'));var authService=require(_0x7713('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7713('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7713('0x12'))(_0x7713('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7713('0x14'));var db=require(_0x7713('0x15'))['db'];function respondWithStatusCode(_0x5b48ca,_0x366a8c){_0x366a8c=_0x366a8c||0xcc;return function(_0x855aa7){if(_0x855aa7){return _0x5b48ca[_0x7713('0x16')](_0x366a8c);}return _0x5b48ca[_0x7713('0x17')](_0x366a8c)[_0x7713('0x18')]();};}function respondWithResult(_0x36470e,_0x2e3c37){_0x2e3c37=_0x2e3c37||0xc8;return function(_0xb7e965){if(_0xb7e965){return _0x36470e[_0x7713('0x17')](_0x2e3c37)[_0x7713('0x19')](_0xb7e965);}};}function respondWithFilteredResult(_0x3b06b9,_0x213e74){return function(_0x587b5c){if(_0x587b5c){var _0x3c4e72=typeof _0x213e74[_0x7713('0x1a')]===_0x7713('0x1b')&&typeof _0x213e74[_0x7713('0x1c')]==='undefined';var _0x1465f0=_0x587b5c['count'];var _0x101235=_0x3c4e72?0x0:_0x213e74[_0x7713('0x1a')];var _0x2b3870=_0x3c4e72?_0x587b5c[_0x7713('0x1d')]:_0x213e74['offset']+_0x213e74[_0x7713('0x1c')];var _0x46a8fa;if(_0x2b3870>=_0x1465f0){_0x2b3870=_0x1465f0;_0x46a8fa=0xc8;}else{_0x46a8fa=0xce;}_0x3b06b9[_0x7713('0x17')](_0x46a8fa);return _0x3b06b9[_0x7713('0x1e')](_0x7713('0x1f'),_0x101235+'-'+_0x2b3870+'/'+_0x1465f0)[_0x7713('0x19')](_0x587b5c);}return null;};}function patchUpdates(_0x2f3e6a){return function(_0x52c7c8){try{jsonpatch[_0x7713('0x20')](_0x52c7c8,_0x2f3e6a,!![]);}catch(_0x5281be){return BPromise[_0x7713('0x21')](_0x5281be);}return _0x52c7c8[_0x7713('0x22')]();};}function saveUpdates(_0x273dfa,_0x2e4458){return function(_0x2c7818){if(_0x2c7818){return _0x2c7818['update'](_0x273dfa)[_0x7713('0x23')](function(_0x33709d){return _0x33709d;});}return null;};}function removeEntity(_0x35a250,_0x5d609e){return function(_0x14ce1e){if(_0x14ce1e){return _0x14ce1e[_0x7713('0x24')]()[_0x7713('0x23')](function(){_0x35a250['status'](0xcc)[_0x7713('0x18')]();});}};}function handleEntityNotFound(_0x232c79,_0x32a1dc){return function(_0x36a8cb){if(!_0x36a8cb){_0x232c79['sendStatus'](0x194);}return _0x36a8cb;};}function handleError(_0x1f68bb,_0xdc0b41){_0xdc0b41=_0xdc0b41||0x1f4;return function(_0xcd6a35){logger[_0x7713('0x25')](_0xcd6a35[_0x7713('0x26')]);if(_0xcd6a35[_0x7713('0x27')]){delete _0xcd6a35[_0x7713('0x27')];}_0x1f68bb['status'](_0xdc0b41)[_0x7713('0x28')](_0xcd6a35);};}exports['index']=function(_0x2f3d0d,_0x2a1239){var _0x4f370d={},_0x537ba3={},_0x3299d3={'count':0x0,'rows':[]};var _0x1ee8a3=_[_0x7713('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x22cc72){return{'name':_0x22cc72[_0x7713('0x2a')],'type':_0x22cc72[_0x7713('0x2b')][_0x7713('0x2c')]};});_0x537ba3['model']=_['map'](_0x1ee8a3,_0x7713('0x27'));_0x537ba3['query']=_[_0x7713('0x2d')](_0x2f3d0d[_0x7713('0x2e')]);_0x537ba3[_0x7713('0x2f')]=_['intersection'](_0x537ba3['model'],_0x537ba3[_0x7713('0x2e')]);_0x4f370d[_0x7713('0x30')]=_['intersection'](_0x537ba3[_0x7713('0x31')],qs[_0x7713('0x32')](_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x32')]));_0x4f370d['attributes']=_0x4f370d[_0x7713('0x30')]['length']?_0x4f370d[_0x7713('0x30')]:_0x537ba3[_0x7713('0x31')];if(!_0x2f3d0d['query'][_0x7713('0x33')](_0x7713('0x34'))){_0x4f370d['limit']=qs[_0x7713('0x1c')](_0x2f3d0d['query'][_0x7713('0x1c')]);_0x4f370d[_0x7713('0x1a')]=qs['offset'](_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x1a')]);}_0x4f370d[_0x7713('0x35')]=qs[_0x7713('0x36')](_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x36')]);_0x4f370d[_0x7713('0x37')]=qs[_0x7713('0x2f')](_[_0x7713('0x38')](_0x2f3d0d[_0x7713('0x2e')],_0x537ba3['filters']),_0x1ee8a3);if(_0x2f3d0d[_0x7713('0x2e')]['filter']){_0x4f370d[_0x7713('0x37')]=_['merge'](_0x4f370d[_0x7713('0x37')],{'$or':_['map'](_0x1ee8a3,function(_0x13f5c6){if(_0x13f5c6[_0x7713('0x2b')]!=='VIRTUAL'){var _0x5e6940={};_0x5e6940[_0x13f5c6[_0x7713('0x27')]]={'$like':'%'+_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x39')]+'%'};return _0x5e6940;}})});}_0x4f370d=_[_0x7713('0x3a')]({},_0x4f370d,_0x2f3d0d[_0x7713('0x3b')]);var _0x284b3e={'where':_0x4f370d[_0x7713('0x37')]};return db[_0x7713('0x3c')][_0x7713('0x1d')](_0x284b3e)['then'](function(_0x54e901){_0x3299d3[_0x7713('0x1d')]=_0x54e901;if(_0x2f3d0d[_0x7713('0x2e')][_0x7713('0x3d')]){_0x4f370d[_0x7713('0x3e')]=[{'all':!![]}];}return db[_0x7713('0x3c')][_0x7713('0x3f')](_0x4f370d);})[_0x7713('0x23')](function(_0x5bfdde){_0x3299d3[_0x7713('0x40')]=_0x5bfdde;return _0x3299d3;})['then'](respondWithFilteredResult(_0x2a1239,_0x4f370d))[_0x7713('0x41')](handleError(_0x2a1239,null));};exports['show']=function(_0x12c2a0,_0x510231){var _0x4b8de7={'raw':!![],'where':{'id':_0x12c2a0['params']['id']}},_0x3c5d27={};_0x3c5d27[_0x7713('0x31')]=_[_0x7713('0x2d')](db['FreshsalesField'][_0x7713('0x42')]);_0x3c5d27[_0x7713('0x2e')]=_[_0x7713('0x2d')](_0x12c2a0['query']);_0x3c5d27[_0x7713('0x2f')]=_[_0x7713('0x43')](_0x3c5d27[_0x7713('0x31')],_0x3c5d27['query']);_0x4b8de7[_0x7713('0x30')]=_[_0x7713('0x43')](_0x3c5d27[_0x7713('0x31')],qs[_0x7713('0x32')](_0x12c2a0[_0x7713('0x2e')][_0x7713('0x32')]));_0x4b8de7[_0x7713('0x30')]=_0x4b8de7[_0x7713('0x30')][_0x7713('0x44')]?_0x4b8de7[_0x7713('0x30')]:_0x3c5d27[_0x7713('0x31')];if(_0x12c2a0[_0x7713('0x2e')][_0x7713('0x3d')]){_0x4b8de7[_0x7713('0x3e')]=[{'all':!![]}];}_0x4b8de7=_[_0x7713('0x3a')]({},_0x4b8de7,_0x12c2a0[_0x7713('0x3b')]);return db['FreshsalesField'][_0x7713('0x45')](_0x4b8de7)[_0x7713('0x23')](handleEntityNotFound(_0x510231,null))[_0x7713('0x23')](respondWithResult(_0x510231,null))['catch'](handleError(_0x510231,null));};exports[_0x7713('0x46')]=function(_0x5a5e45,_0x41eba1){return db[_0x7713('0x3c')][_0x7713('0x46')](_0x5a5e45[_0x7713('0x47')],{})[_0x7713('0x23')](respondWithResult(_0x41eba1,0xc9))[_0x7713('0x41')](handleError(_0x41eba1,null));};exports['update']=function(_0x4820c0,_0x24af69){if(_0x4820c0[_0x7713('0x47')]['id']){delete _0x4820c0[_0x7713('0x47')]['id'];}return db[_0x7713('0x3c')]['find']({'where':{'id':_0x4820c0[_0x7713('0x48')]['id']}})['then'](handleEntityNotFound(_0x24af69,null))[_0x7713('0x23')](saveUpdates(_0x4820c0[_0x7713('0x47')],null))[_0x7713('0x23')](respondWithResult(_0x24af69,null))['catch'](handleError(_0x24af69,null));};exports[_0x7713('0x24')]=function(_0x5b5e31,_0x20158e){return db['FreshsalesField'][_0x7713('0x45')]({'where':{'id':_0x5b5e31[_0x7713('0x48')]['id']}})[_0x7713('0x23')](handleEntityNotFound(_0x20158e,null))[_0x7713('0x23')](removeEntity(_0x20158e,null))[_0x7713('0x41')](handleError(_0x20158e,null));}; \ No newline at end of file +var _0xec4b=['then','destroy','end','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','pick','filter','where','type','options','include','findAll','catch','show','params','find','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','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','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec4b,0xf2));var _0xbec4=function(_0x500800,_0x2fc65b){_0x500800=_0x500800-0x0;var _0x37e92c=_0xec4b[_0x500800];return _0x37e92c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbec4('0x0'));var rp=require(_0xbec4('0x1'));var moment=require(_0xbec4('0x2'));var BPromise=require(_0xbec4('0x3'));var Mustache=require('mustache');var util=require(_0xbec4('0x4'));var path=require(_0xbec4('0x5'));var sox=require(_0xbec4('0x6'));var csv=require('to-csv');var ejs=require(_0xbec4('0x7'));var fs=require('fs');var fs_extra=require(_0xbec4('0x8'));var _=require(_0xbec4('0x9'));var squel=require(_0xbec4('0xa'));var crypto=require('crypto');var jsforce=require(_0xbec4('0xb'));var deskjs=require(_0xbec4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbec4('0xd'));var authService=require(_0xbec4('0xe'));var qs=require(_0xbec4('0xf'));var as=require(_0xbec4('0x10'));var hardwareService=require(_0xbec4('0x11'));var logger=require(_0xbec4('0x12'))('api');var utils=require(_0xbec4('0x13'));var config=require(_0xbec4('0x14'));var licenseUtil=require(_0xbec4('0x15'));var db=require(_0xbec4('0x16'))['db'];function respondWithStatusCode(_0x350a3d,_0x2b4266){_0x2b4266=_0x2b4266||0xcc;return function(_0x3cf57c){if(_0x3cf57c){return _0x350a3d[_0xbec4('0x17')](_0x2b4266);}return _0x350a3d['status'](_0x2b4266)['end']();};}function respondWithResult(_0x13886d,_0x33ac51){_0x33ac51=_0x33ac51||0xc8;return function(_0x1c0f63){if(_0x1c0f63){return _0x13886d[_0xbec4('0x18')](_0x33ac51)[_0xbec4('0x19')](_0x1c0f63);}};}function respondWithFilteredResult(_0x370071,_0x3e8682){return function(_0xcca6ac){if(_0xcca6ac){var _0x544bee=typeof _0x3e8682[_0xbec4('0x1a')]===_0xbec4('0x1b')&&typeof _0x3e8682['limit']===_0xbec4('0x1b');var _0xd08fef=_0xcca6ac[_0xbec4('0x1c')];var _0x3a2c6a=_0x544bee?0x0:_0x3e8682['offset'];var _0x3e04e5=_0x544bee?_0xcca6ac['count']:_0x3e8682['offset']+_0x3e8682[_0xbec4('0x1d')];var _0x2f6408;if(_0x3e04e5>=_0xd08fef){_0x3e04e5=_0xd08fef;_0x2f6408=0xc8;}else{_0x2f6408=0xce;}_0x370071[_0xbec4('0x18')](_0x2f6408);return _0x370071[_0xbec4('0x1e')](_0xbec4('0x1f'),_0x3a2c6a+'-'+_0x3e04e5+'/'+_0xd08fef)[_0xbec4('0x19')](_0xcca6ac);}return null;};}function patchUpdates(_0x11101d){return function(_0x4668a7){try{jsonpatch['apply'](_0x4668a7,_0x11101d,!![]);}catch(_0x494a7d){return BPromise[_0xbec4('0x20')](_0x494a7d);}return _0x4668a7['save']();};}function saveUpdates(_0x34d0f0,_0x42484b){return function(_0x457178){if(_0x457178){return _0x457178[_0xbec4('0x21')](_0x34d0f0)[_0xbec4('0x22')](function(_0x17b3e4){return _0x17b3e4;});}return null;};}function removeEntity(_0x2f9084,_0x3590c5){return function(_0x3ee0df){if(_0x3ee0df){return _0x3ee0df[_0xbec4('0x23')]()[_0xbec4('0x22')](function(){_0x2f9084[_0xbec4('0x18')](0xcc)[_0xbec4('0x24')]();});}};}function handleEntityNotFound(_0x3fa780,_0x8a23af){return function(_0x393072){if(!_0x393072){_0x3fa780[_0xbec4('0x17')](0x194);}return _0x393072;};}function handleError(_0x157483,_0x3a85cb){_0x3a85cb=_0x3a85cb||0x1f4;return function(_0x3a4477){logger['error'](_0x3a4477[_0xbec4('0x25')]);if(_0x3a4477['name']){delete _0x3a4477[_0xbec4('0x26')];}_0x157483[_0xbec4('0x18')](_0x3a85cb)[_0xbec4('0x27')](_0x3a4477);};}exports[_0xbec4('0x28')]=function(_0x1feeaa,_0x2146f5){var _0x29bffb={},_0x55202f={},_0x3688e1={'count':0x0,'rows':[]};var _0x57146b=_[_0xbec4('0x29')](db[_0xbec4('0x2a')][_0xbec4('0x2b')],function(_0x22bc38){return{'name':_0x22bc38[_0xbec4('0x2c')],'type':_0x22bc38['type'][_0xbec4('0x2d')]};});_0x55202f[_0xbec4('0x2e')]=_[_0xbec4('0x29')](_0x57146b,_0xbec4('0x26'));_0x55202f['query']=_[_0xbec4('0x2f')](_0x1feeaa['query']);_0x55202f[_0xbec4('0x30')]=_[_0xbec4('0x31')](_0x55202f[_0xbec4('0x2e')],_0x55202f[_0xbec4('0x32')]);_0x29bffb[_0xbec4('0x33')]=_[_0xbec4('0x31')](_0x55202f[_0xbec4('0x2e')],qs[_0xbec4('0x34')](_0x1feeaa['query'][_0xbec4('0x34')]));_0x29bffb[_0xbec4('0x33')]=_0x29bffb[_0xbec4('0x33')][_0xbec4('0x35')]?_0x29bffb[_0xbec4('0x33')]:_0x55202f[_0xbec4('0x2e')];if(!_0x1feeaa['query']['hasOwnProperty']('nolimit')){_0x29bffb[_0xbec4('0x1d')]=qs['limit'](_0x1feeaa[_0xbec4('0x32')]['limit']);_0x29bffb['offset']=qs[_0xbec4('0x1a')](_0x1feeaa['query']['offset']);}_0x29bffb[_0xbec4('0x36')]=qs[_0xbec4('0x37')](_0x1feeaa['query'][_0xbec4('0x37')]);_0x29bffb['where']=qs[_0xbec4('0x30')](_[_0xbec4('0x38')](_0x1feeaa[_0xbec4('0x32')],_0x55202f[_0xbec4('0x30')]),_0x57146b);if(_0x1feeaa[_0xbec4('0x32')][_0xbec4('0x39')]){_0x29bffb[_0xbec4('0x3a')]=_['merge'](_0x29bffb[_0xbec4('0x3a')],{'$or':_[_0xbec4('0x29')](_0x57146b,function(_0x1552c1){if(_0x1552c1[_0xbec4('0x3b')]!=='VIRTUAL'){var _0x2ac385={};_0x2ac385[_0x1552c1[_0xbec4('0x26')]]={'$like':'%'+_0x1feeaa[_0xbec4('0x32')][_0xbec4('0x39')]+'%'};return _0x2ac385;}})});}_0x29bffb=_['merge']({},_0x29bffb,_0x1feeaa[_0xbec4('0x3c')]);var _0x1d3d85={'where':_0x29bffb['where']};return db[_0xbec4('0x2a')]['count'](_0x1d3d85)['then'](function(_0x1251f3){_0x3688e1[_0xbec4('0x1c')]=_0x1251f3;if(_0x1feeaa[_0xbec4('0x32')]['includeAll']){_0x29bffb[_0xbec4('0x3d')]=[{'all':!![]}];}return db[_0xbec4('0x2a')][_0xbec4('0x3e')](_0x29bffb);})[_0xbec4('0x22')](function(_0x47682){_0x3688e1['rows']=_0x47682;return _0x3688e1;})[_0xbec4('0x22')](respondWithFilteredResult(_0x2146f5,_0x29bffb))[_0xbec4('0x3f')](handleError(_0x2146f5,null));};exports[_0xbec4('0x40')]=function(_0x54d681,_0x4ea8ce){var _0x3a8f64={'raw':!![],'where':{'id':_0x54d681[_0xbec4('0x41')]['id']}},_0x3d9a7e={};_0x3d9a7e[_0xbec4('0x2e')]=_[_0xbec4('0x2f')](db[_0xbec4('0x2a')]['rawAttributes']);_0x3d9a7e[_0xbec4('0x32')]=_['keys'](_0x54d681[_0xbec4('0x32')]);_0x3d9a7e[_0xbec4('0x30')]=_['intersection'](_0x3d9a7e[_0xbec4('0x2e')],_0x3d9a7e[_0xbec4('0x32')]);_0x3a8f64[_0xbec4('0x33')]=_[_0xbec4('0x31')](_0x3d9a7e[_0xbec4('0x2e')],qs['fields'](_0x54d681['query']['fields']));_0x3a8f64['attributes']=_0x3a8f64[_0xbec4('0x33')][_0xbec4('0x35')]?_0x3a8f64[_0xbec4('0x33')]:_0x3d9a7e[_0xbec4('0x2e')];if(_0x54d681[_0xbec4('0x32')]['includeAll']){_0x3a8f64[_0xbec4('0x3d')]=[{'all':!![]}];}_0x3a8f64=_['merge']({},_0x3a8f64,_0x54d681[_0xbec4('0x3c')]);return db[_0xbec4('0x2a')][_0xbec4('0x42')](_0x3a8f64)['then'](handleEntityNotFound(_0x4ea8ce,null))[_0xbec4('0x22')](respondWithResult(_0x4ea8ce,null))[_0xbec4('0x3f')](handleError(_0x4ea8ce,null));};exports[_0xbec4('0x43')]=function(_0x5edb43,_0x43ac6a){return db['FreshsalesField'][_0xbec4('0x43')](_0x5edb43[_0xbec4('0x44')],{})[_0xbec4('0x22')](respondWithResult(_0x43ac6a,0xc9))['catch'](handleError(_0x43ac6a,null));};exports[_0xbec4('0x21')]=function(_0x34e670,_0x1dca76){if(_0x34e670[_0xbec4('0x44')]['id']){delete _0x34e670['body']['id'];}return db[_0xbec4('0x2a')][_0xbec4('0x42')]({'where':{'id':_0x34e670[_0xbec4('0x41')]['id']}})[_0xbec4('0x22')](handleEntityNotFound(_0x1dca76,null))[_0xbec4('0x22')](saveUpdates(_0x34e670[_0xbec4('0x44')],null))[_0xbec4('0x22')](respondWithResult(_0x1dca76,null))['catch'](handleError(_0x1dca76,null));};exports[_0xbec4('0x23')]=function(_0x2183f0,_0x50120b){return db[_0xbec4('0x2a')]['find']({'where':{'id':_0x2183f0['params']['id']}})[_0xbec4('0x22')](handleEntityNotFound(_0x50120b,null))[_0xbec4('0x22')](removeEntity(_0x50120b,null))[_0xbec4('0x3f')](handleError(_0x50120b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 07fb09d..fb37219 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x37e4fb,_0x5be57d){var _0x30f3b3=function(_0x4c4f86){while(--_0x4c4f86){_0x37e4fb['push'](_0x37e4fb['shift']());}};_0x30f3b3(++_0x5be57d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3efdd8,_0x3728e3){_0x3efdd8=_0x3efdd8-0x0;var _0x395759=_0xb10b[_0x3efdd8];return _0x395759;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('FreshsalesField',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xd'),_0xbb10('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0833=['./intFreshsalesField.attributes','exports','define','FreshsalesField','FieldId','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x34bb68,_0x5b0079){var _0x3db9fb=function(_0x2c87bd){while(--_0x2c87bd){_0x34bb68['push'](_0x34bb68['shift']());}};_0x3db9fb(++_0x5b0079);}(_0x0833,0x1bd));var _0x3083=function(_0x53dbe0,_0x385889){_0x53dbe0=_0x53dbe0-0x0;var _0x347468=_0x0833[_0x53dbe0];return _0x347468;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var logger=require(_0x3083('0x2'))(_0x3083('0x3'));var moment=require(_0x3083('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3083('0x5'));var config=require('../../config/environment');var attributes=require(_0x3083('0x6'));module[_0x3083('0x7')]=function(_0x914cec,_0x58ed49){return _0x914cec[_0x3083('0x8')](_0x3083('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x3083('0xa')],'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 2bf9a0e..b1ae3e5 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 _0x7a54=['info','FreshsalesField,\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(_0x1119fa,_0x59f7d9){_0x1119fa=_0x1119fa-0x0;var _0x1a54d2=_0x7a54[_0x1119fa];return _0x1a54d2;};'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')]('FreshsalesField,\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 _0x46ed=['FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x46ed,0x168));var _0xd46e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x46ed[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9732e7a..35dc4f6 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(_0x35203f,_0x26b448){var _0x15e4d7=function(_0x480b8f){while(--_0x480b8f){_0x35203f['push'](_0x35203f['shift']());}};_0x15e4d7(++_0x26b448);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x2e8f2c,_0x57ea6b){var _0x238de0=function(_0x44fecd){while(--_0x44fecd){_0x2e8f2c['push'](_0x2e8f2c['shift']());}};_0x238de0(++_0x57ea6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 d700868..50fadeb 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 _0x8c7a=['integrationTab','newTab','sequelize','exports','STRING'];(function(_0x59b59d,_0x132d97){var _0x5a2f6f=function(_0x17d885){while(--_0x17d885){_0x59b59d['push'](_0x59b59d['shift']());}};_0x5a2f6f(++_0x132d97);}(_0x8c7a,0x197));var _0xa8c7=function(_0x2d6962,_0x46de87){_0x2d6962=_0x2d6962-0x0;var _0x3bcf12=_0x8c7a[_0x2d6962];return _0x3bcf12;};'use strict';var Sequelize=require(_0xa8c7('0x0'));module[_0xa8c7('0x1')]={'name':{'type':Sequelize[_0xa8c7('0x2')]},'description':{'type':Sequelize[_0xa8c7('0x2')]},'username':{'type':Sequelize[_0xa8c7('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa8c7('0x2')]},'clientSecret':{'type':Sequelize[_0xa8c7('0x2')]},'securityToken':{'type':Sequelize[_0xa8c7('0x2')]},'serverUrl':{'type':Sequelize[_0xa8c7('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa8c7('0x3'),_0xa8c7('0x4')),'defaultValue':_0xa8c7('0x3')}}; \ No newline at end of file +var _0xb0b3=['exports','STRING','integrationTab','sequelize'];(function(_0xe76370,_0x545817){var _0x5160b5=function(_0x4e8108){while(--_0x4e8108){_0xe76370['push'](_0xe76370['shift']());}};_0x5160b5(++_0x545817);}(_0xb0b3,0x1bf));var _0x3b0b=function(_0x116fe4,_0x3a71d7){_0x116fe4=_0x116fe4-0x0;var _0x26b378=_0xb0b3[_0x116fe4];return _0x26b378;};'use strict';var Sequelize=require(_0x3b0b('0x0'));module[_0x3b0b('0x1')]={'name':{'type':Sequelize[_0x3b0b('0x2')]},'description':{'type':Sequelize[_0x3b0b('0x2')]},'username':{'type':Sequelize[_0x3b0b('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x3b0b('0x2')]},'password':{'type':Sequelize[_0x3b0b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3b0b('0x2')]},'securityToken':{'type':Sequelize[_0x3b0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3b0b('0x3'),'newTab'),'defaultValue':_0x3b0b('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 61ad9c5..03fb61b 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 _0x3d44=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','order','filter','addConfiguration','AccountId','Descriptions','getDescriptions','channel','SalesforceField','Subjects','getFields','remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','True','False','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0x3d44,0xea));var _0x43d4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3d44[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x43d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43d4('0x2'));var moment=require(_0x43d4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43d4('0x4'));var util=require('util');var path=require(_0x43d4('0x5'));var sox=require(_0x43d4('0x6'));var csv=require('to-csv');var ejs=require(_0x43d4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43d4('0x8'));var squel=require(_0x43d4('0x9'));var crypto=require(_0x43d4('0xa'));var jsforce=require(_0x43d4('0xb'));var deskjs=require(_0x43d4('0xc'));var toCsv=require(_0x43d4('0xd'));var querystring=require(_0x43d4('0xe'));var Papa=require(_0x43d4('0xf'));var Redis=require('ioredis');var authService=require(_0x43d4('0x10'));var qs=require(_0x43d4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43d4('0x12'));var logger=require(_0x43d4('0x13'))(_0x43d4('0x14'));var utils=require(_0x43d4('0x15'));var config=require(_0x43d4('0x16'));var licenseUtil=require(_0x43d4('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x43d4('0x18'));function respondWithStatusCode(_0x385996,_0x25f124){_0x25f124=_0x25f124||0xcc;return function(_0x243050){if(_0x243050){return _0x385996[_0x43d4('0x19')](_0x25f124);}return _0x385996[_0x43d4('0x1a')](_0x25f124)[_0x43d4('0x1b')]();};}function respondWithResult(_0x5d38a3,_0x24d121){_0x24d121=_0x24d121||0xc8;return function(_0x542d29){if(_0x542d29){return _0x5d38a3[_0x43d4('0x1a')](_0x24d121)['json'](_0x542d29);}};}function respondWithFilteredResult(_0x4c7759,_0x1319fb){return function(_0xefe18c){if(_0xefe18c){var _0x5e06aa=typeof _0x1319fb[_0x43d4('0x1c')]==='undefined'&&typeof _0x1319fb[_0x43d4('0x1d')]==='undefined';var _0x2f32eb=_0xefe18c[_0x43d4('0x1e')];var _0x3af440=_0x5e06aa?0x0:_0x1319fb[_0x43d4('0x1c')];var _0x35606f=_0x5e06aa?_0xefe18c['count']:_0x1319fb[_0x43d4('0x1c')]+_0x1319fb[_0x43d4('0x1d')];var _0x3e3995;if(_0x35606f>=_0x2f32eb){_0x35606f=_0x2f32eb;_0x3e3995=0xc8;}else{_0x3e3995=0xce;}_0x4c7759[_0x43d4('0x1a')](_0x3e3995);return _0x4c7759[_0x43d4('0x1f')](_0x43d4('0x20'),_0x3af440+'-'+_0x35606f+'/'+_0x2f32eb)['json'](_0xefe18c);}return null;};}function patchUpdates(_0x709a6){return function(_0x38605c){try{jsonpatch[_0x43d4('0x21')](_0x38605c,_0x709a6,!![]);}catch(_0x2e7a03){return BPromise['reject'](_0x2e7a03);}return _0x38605c[_0x43d4('0x22')]();};}function saveUpdates(_0x2d7c21,_0x5a6eee){return function(_0x17cb6b){if(_0x17cb6b){return _0x17cb6b[_0x43d4('0x23')](_0x2d7c21)[_0x43d4('0x24')](function(_0x4a8240){return _0x4a8240;});}return null;};}function removeEntity(_0x194c06,_0x2e4dae){return function(_0x3587b6){if(_0x3587b6){return _0x3587b6[_0x43d4('0x25')]()['then'](function(){_0x194c06[_0x43d4('0x1a')](0xcc)[_0x43d4('0x1b')]();});}};}function handleEntityNotFound(_0x8be6be,_0x280c49){return function(_0x393024){if(!_0x393024){_0x8be6be['sendStatus'](0x194);}return _0x393024;};}function handleError(_0x503584,_0xe9c254){_0xe9c254=_0xe9c254||0x1f4;return function(_0x4e2031){logger[_0x43d4('0x26')](_0x4e2031[_0x43d4('0x27')]);if(_0x4e2031[_0x43d4('0x28')]){delete _0x4e2031[_0x43d4('0x28')];}_0x503584[_0x43d4('0x1a')](_0xe9c254)[_0x43d4('0x29')](_0x4e2031);};}exports[_0x43d4('0x2a')]=function(_0x29f84c,_0x4c61f1){var _0x3286f1={},_0x4225ba={},_0x554749={'count':0x0,'rows':[]};var _0x1ac2d5=_['map'](db[_0x43d4('0x2b')][_0x43d4('0x2c')],function(_0x43bc02){return{'name':_0x43bc02[_0x43d4('0x2d')],'type':_0x43bc02[_0x43d4('0x2e')][_0x43d4('0x2f')]};});_0x4225ba[_0x43d4('0x30')]=_['map'](_0x1ac2d5,_0x43d4('0x28'));_0x4225ba['query']=_[_0x43d4('0x31')](_0x29f84c[_0x43d4('0x32')]);_0x4225ba[_0x43d4('0x33')]=_[_0x43d4('0x34')](_0x4225ba[_0x43d4('0x30')],_0x4225ba[_0x43d4('0x32')]);_0x3286f1[_0x43d4('0x35')]=_[_0x43d4('0x34')](_0x4225ba[_0x43d4('0x30')],qs[_0x43d4('0x36')](_0x29f84c[_0x43d4('0x32')][_0x43d4('0x36')]));_0x3286f1[_0x43d4('0x35')]=_0x3286f1[_0x43d4('0x35')][_0x43d4('0x37')]?_0x3286f1[_0x43d4('0x35')]:_0x4225ba[_0x43d4('0x30')];if(!_0x29f84c[_0x43d4('0x32')][_0x43d4('0x38')](_0x43d4('0x39'))){_0x3286f1[_0x43d4('0x1d')]=qs[_0x43d4('0x1d')](_0x29f84c[_0x43d4('0x32')][_0x43d4('0x1d')]);_0x3286f1[_0x43d4('0x1c')]=qs[_0x43d4('0x1c')](_0x29f84c[_0x43d4('0x32')][_0x43d4('0x1c')]);}_0x3286f1['order']=qs[_0x43d4('0x3a')](_0x29f84c[_0x43d4('0x32')][_0x43d4('0x3a')]);_0x3286f1[_0x43d4('0x3b')]=qs[_0x43d4('0x33')](_[_0x43d4('0x3c')](_0x29f84c[_0x43d4('0x32')],_0x4225ba['filters']),_0x1ac2d5);if(_0x29f84c[_0x43d4('0x32')]['filter']){_0x3286f1[_0x43d4('0x3b')]=_['merge'](_0x3286f1['where'],{'$or':_[_0x43d4('0x3d')](_0x1ac2d5,function(_0x55afca){if(_0x55afca['type']!==_0x43d4('0x3e')){var _0x487802={};_0x487802[_0x55afca[_0x43d4('0x28')]]={'$like':'%'+_0x29f84c[_0x43d4('0x32')]['filter']+'%'};return _0x487802;}})});}_0x3286f1=_[_0x43d4('0x3f')]({},_0x3286f1,_0x29f84c[_0x43d4('0x40')]);var _0x4b36f4={'where':_0x3286f1[_0x43d4('0x3b')]};return db[_0x43d4('0x2b')][_0x43d4('0x1e')](_0x4b36f4)[_0x43d4('0x24')](function(_0x48d15a){_0x554749[_0x43d4('0x1e')]=_0x48d15a;if(_0x29f84c['query'][_0x43d4('0x41')]){_0x3286f1[_0x43d4('0x42')]=[{'all':!![]}];}return db[_0x43d4('0x2b')][_0x43d4('0x43')](_0x3286f1);})['then'](function(_0x13b714){_0x554749[_0x43d4('0x44')]=_0x13b714;return _0x554749;})[_0x43d4('0x24')](respondWithFilteredResult(_0x4c61f1,_0x3286f1))['catch'](handleError(_0x4c61f1,null));};exports['show']=function(_0x3f38e9,_0x899e09){var _0x301d52={'raw':![],'where':{'id':_0x3f38e9[_0x43d4('0x45')]['id']}},_0x118df5={};_0x118df5[_0x43d4('0x30')]=_['keys'](db[_0x43d4('0x2b')][_0x43d4('0x2c')]);_0x118df5[_0x43d4('0x32')]=_[_0x43d4('0x31')](_0x3f38e9[_0x43d4('0x32')]);_0x118df5[_0x43d4('0x33')]=_['intersection'](_0x118df5[_0x43d4('0x30')],_0x118df5[_0x43d4('0x32')]);_0x301d52[_0x43d4('0x35')]=_[_0x43d4('0x34')](_0x118df5[_0x43d4('0x30')],qs[_0x43d4('0x36')](_0x3f38e9['query'][_0x43d4('0x36')]));_0x301d52[_0x43d4('0x35')]=_0x301d52[_0x43d4('0x35')][_0x43d4('0x37')]?_0x301d52[_0x43d4('0x35')]:_0x118df5[_0x43d4('0x30')];if(_0x3f38e9[_0x43d4('0x32')][_0x43d4('0x41')]){_0x301d52[_0x43d4('0x42')]=[{'all':!![]}];}_0x301d52=_['merge']({},_0x301d52,_0x3f38e9[_0x43d4('0x40')]);return db[_0x43d4('0x2b')][_0x43d4('0x46')](_0x301d52)[_0x43d4('0x24')](handleEntityNotFound(_0x899e09,null))[_0x43d4('0x24')](respondWithResult(_0x899e09,null))[_0x43d4('0x47')](handleError(_0x899e09,null));};exports[_0x43d4('0x48')]=function(_0x4369ad,_0xc6309){return db[_0x43d4('0x2b')][_0x43d4('0x48')](_0x4369ad[_0x43d4('0x49')],{})['then'](respondWithResult(_0xc6309,0xc9))[_0x43d4('0x47')](handleError(_0xc6309,null));};exports[_0x43d4('0x23')]=function(_0x46974a,_0x24014b){if(_0x46974a[_0x43d4('0x49')]['id']){delete _0x46974a[_0x43d4('0x49')]['id'];}return db[_0x43d4('0x2b')][_0x43d4('0x46')]({'where':{'id':_0x46974a[_0x43d4('0x45')]['id']}})[_0x43d4('0x24')](handleEntityNotFound(_0x24014b,null))[_0x43d4('0x24')](saveUpdates(_0x46974a[_0x43d4('0x49')],null))[_0x43d4('0x24')](respondWithResult(_0x24014b,null))[_0x43d4('0x47')](handleError(_0x24014b,null));};exports[_0x43d4('0x25')]=function(_0x4b31d3,_0x22f9c6){return db['SalesforceAccount']['find']({'where':{'id':_0x4b31d3[_0x43d4('0x45')]['id']}})[_0x43d4('0x24')](handleEntityNotFound(_0x22f9c6,null))['then'](removeEntity(_0x22f9c6,null))[_0x43d4('0x47')](handleError(_0x22f9c6,null));};exports[_0x43d4('0x4a')]=function(_0x4f6f00,_0x2b2eee,_0x138a46){var _0x1ff498={};var _0x397904={};var _0xc85f99;var _0x2bf7cd;return db[_0x43d4('0x2b')][_0x43d4('0x4b')]({'where':{'id':_0x4f6f00[_0x43d4('0x45')]['id']}})[_0x43d4('0x24')](handleEntityNotFound(_0x2b2eee,null))[_0x43d4('0x24')](function(_0x285edf){if(_0x285edf){_0xc85f99=_0x285edf;_0x397904[_0x43d4('0x30')]=_['keys'](db[_0x43d4('0x4c')][_0x43d4('0x2c')]);_0x397904[_0x43d4('0x32')]=_['keys'](_0x4f6f00[_0x43d4('0x32')]);_0x397904[_0x43d4('0x33')]=_[_0x43d4('0x34')](_0x397904['model'],_0x397904[_0x43d4('0x32')]);_0x1ff498['attributes']=_['intersection'](_0x397904[_0x43d4('0x30')],qs['fields'](_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x36')]));_0x1ff498['attributes']=_0x1ff498[_0x43d4('0x35')][_0x43d4('0x37')]?_0x1ff498[_0x43d4('0x35')]:_0x397904[_0x43d4('0x30')];_0x1ff498[_0x43d4('0x4d')]=qs['sort'](_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x3a')]);_0x1ff498[_0x43d4('0x3b')]=qs[_0x43d4('0x33')](_['pick'](_0x4f6f00['query'],_0x397904['filters']));if(_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x4e')]){_0x1ff498[_0x43d4('0x3b')]=_['merge'](_0x1ff498[_0x43d4('0x3b')],{'$or':_[_0x43d4('0x3d')](_0x1ff498[_0x43d4('0x35')],function(_0x105eda){var _0x3c6286={};_0x3c6286[_0x105eda]={'$like':'%'+_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x4e')]+'%'};return _0x3c6286;})});}_0x1ff498=_[_0x43d4('0x3f')]({},_0x1ff498,_0x4f6f00[_0x43d4('0x40')]);return _0xc85f99[_0x43d4('0x4a')](_0x1ff498);}})[_0x43d4('0x24')](function(_0x38a71c){if(_0x38a71c){_0x2bf7cd=_0x38a71c['length'];if(!_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x38')]('nolimit')){_0x1ff498[_0x43d4('0x1d')]=qs[_0x43d4('0x1d')](_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x1d')]);_0x1ff498[_0x43d4('0x1c')]=qs[_0x43d4('0x1c')](_0x4f6f00[_0x43d4('0x32')][_0x43d4('0x1c')]);}return _0xc85f99[_0x43d4('0x4a')](_0x1ff498);}})[_0x43d4('0x24')](function(_0x398f63){if(_0x398f63){return _0x398f63?{'count':_0x2bf7cd,'rows':_0x398f63}:null;}})[_0x43d4('0x24')](respondWithResult(_0x2b2eee,null))[_0x43d4('0x47')](handleError(_0x2b2eee,null));};exports[_0x43d4('0x4f')]=function(_0x5eed91,_0x1ccdc5,_0x3cc02d){if(_0x5eed91['body']['id']){delete _0x5eed91[_0x43d4('0x49')]['id'];}return db['SalesforceAccount'][_0x43d4('0x4b')]({'where':{'id':_0x5eed91[_0x43d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ccdc5,null))[_0x43d4('0x24')](function(_0x37c96c){if(_0x37c96c){_0x5eed91['body'][_0x43d4('0x50')]=_0x37c96c['id'];_0x5eed91[_0x43d4('0x49')]['Subjects']=integrations['getSubjects'](_0x5eed91[_0x43d4('0x49')]['channel'],_0x5eed91[_0x43d4('0x49')][_0x43d4('0x2e')]);_0x5eed91['body'][_0x43d4('0x51')]=integrations[_0x43d4('0x52')](_0x5eed91[_0x43d4('0x49')][_0x43d4('0x53')],_0x5eed91[_0x43d4('0x49')][_0x43d4('0x2e')]);return db['SalesforceConfiguration']['create'](_0x5eed91['body'],{'include':[{'model':db[_0x43d4('0x54')],'as':_0x43d4('0x55')},{'model':db[_0x43d4('0x54')],'as':_0x43d4('0x51')}]});}return null;})[_0x43d4('0x24')](respondWithResult(_0x1ccdc5,null))[_0x43d4('0x47')](handleError(_0x1ccdc5,null));};exports[_0x43d4('0x56')]=function(_0x36849c,_0x5cd405,_0x59ab40){var _0x409aa8;var _0x35c073='';var _0x351b56='Task';return db[_0x43d4('0x2b')]['findOne']({'where':{'id':_0x36849c[_0x43d4('0x45')]['id']},'attributes':['id',_0x43d4('0x57'),_0x43d4('0x58'),'clientSecret',_0x43d4('0x59'),_0x43d4('0x5a'),_0x43d4('0x5b')]})['then'](handleEntityNotFound(_0x5cd405,null))[_0x43d4('0x24')](function(_0x15bd45){if(_0x15bd45){_0x35c073=_0x15bd45[_0x43d4('0x57')];var _0x4b8e07=_0x35c073[_0x43d4('0x5c')](-0x1);if(_0x4b8e07==='/'){_0x35c073=_0x35c073[_0x43d4('0x5d')](0x0,_0x35c073[_0x43d4('0x5e')](_0x4b8e07));}_0x409aa8=new jsforce[(_0x43d4('0x5f'))]({'oauth2':{'loginUrl':_0x35c073,'clientId':_0x15bd45[_0x43d4('0x58')],'clientSecret':_0x15bd45[_0x43d4('0x60')]}});return _0x409aa8['login'](_0x15bd45[_0x43d4('0x59')],_0x15bd45[_0x43d4('0x5a')][_0x43d4('0x61')](_0x15bd45['securityToken']));}})['then'](function(_0x467ad9){if(_0x467ad9){if(!_[_0x43d4('0x62')](_0x36849c[_0x43d4('0x32')][_0x43d4('0x63')])){_0x351b56=_0x36849c[_0x43d4('0x32')][_0x43d4('0x63')];}return _0x409aa8[_0x43d4('0x64')](_0x351b56)[_0x43d4('0x65')]();}})['then'](function(_0x369ff3){var _0x309211=['OwnerId',_0x43d4('0x66'),_0x43d4('0x67'),_0x43d4('0x68'),_0x43d4('0x69'),_0x43d4('0x6a')];var _0x534357=[_0x43d4('0x6b'),'int',_0x43d4('0x6c'),'boolean',_0x43d4('0x6d'),_0x43d4('0x6e'),_0x43d4('0x6f')];if(_0x369ff3){_[_0x43d4('0x70')](_0x369ff3[_0x43d4('0x36')],function(_0x1b8591){return _0x309211[_0x43d4('0x71')](_0x1b8591[_0x43d4('0x28')])||!_0x534357[_0x43d4('0x71')](_0x1b8591[_0x43d4('0x2e')]);});return{'count':_0x369ff3['fields'][_0x43d4('0x37')],'rows':_[_0x43d4('0x3d')](_0x369ff3[_0x43d4('0x36')],function(_0x3cc82f){return{'id':_0x3cc82f[_0x43d4('0x28')],'name':_0x3cc82f[_0x43d4('0x72')],'custom':_0x3cc82f[_0x43d4('0x73')],'options':_0x3cc82f['picklistValues']['length']>0x0?_[_0x43d4('0x3d')](_0x3cc82f[_0x43d4('0x74')],function(_0x277c7c){return{'name':_0x277c7c[_0x43d4('0x72')],'value':_0x277c7c[_0x43d4('0x75')]};}):_0x3cc82f[_0x43d4('0x2e')]==_0x43d4('0x76')?[{'name':_0x43d4('0x77'),'value':'true'},{'name':_0x43d4('0x78'),'value':'false'}]:[]};})};}})[_0x43d4('0x24')](respondWithResult(_0x5cd405,null))[_0x43d4('0x47')](function(_0x1c42b6){var _0x38981f=_0x36849c[_0x43d4('0x32')][_0x43d4('0x79')]?0x1f4:_0x1c42b6[_0x43d4('0x7a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x43d4('0x56'),_0x38981f,JSON['stringify'](_0x1c42b6));delete _0x1c42b6[_0x43d4('0x28')];if(_0x38981f===0x191){_0x38981f=0x190;}_0x5cd405['status'](_0x38981f)[_0x43d4('0x29')](_0x36849c[_0x43d4('0x32')][_0x43d4('0x79')]?{'message':_0x43d4('0x7b'),'statusCode':_0x1c42b6[_0x43d4('0x7a')]}:_0x1c42b6);});}; \ No newline at end of file +var _0xedc8=['describe','OwnerId','IsReminderSet','Description','string','picklist','email','textarea','phone','includes','picklistValues','label','value','boolean','True','true','False','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','save','update','destroy','then','stack','name','send','type','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SalesforceAccount','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','rawAttributes','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientSecret','username','substring','lastIndexOf','clientId','login','concat','securityToken','isNil','ticketType','sobject'];(function(_0x1f9d87,_0x10ca0f){var _0x2384a6=function(_0x35dd9c){while(--_0x35dd9c){_0x1f9d87['push'](_0x1f9d87['shift']());}};_0x2384a6(++_0x10ca0f);}(_0xedc8,0x17f));var _0x8edc=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xedc8[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8edc('0x0'));var BPromise=require(_0x8edc('0x1'));var Mustache=require(_0x8edc('0x2'));var util=require(_0x8edc('0x3'));var path=require(_0x8edc('0x4'));var sox=require(_0x8edc('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8edc('0x6'));var squel=require(_0x8edc('0x7'));var crypto=require(_0x8edc('0x8'));var jsforce=require(_0x8edc('0x9'));var deskjs=require(_0x8edc('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8edc('0xb'));var Papa=require(_0x8edc('0xc'));var Redis=require(_0x8edc('0xd'));var authService=require(_0x8edc('0xe'));var qs=require(_0x8edc('0xf'));var as=require(_0x8edc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8edc('0x11'))(_0x8edc('0x12'));var utils=require(_0x8edc('0x13'));var config=require(_0x8edc('0x14'));var licenseUtil=require(_0x8edc('0x15'));var db=require(_0x8edc('0x16'))['db'];var integrations=require(_0x8edc('0x17'));function respondWithStatusCode(_0x259903,_0x11056d){_0x11056d=_0x11056d||0xcc;return function(_0x9485fb){if(_0x9485fb){return _0x259903[_0x8edc('0x18')](_0x11056d);}return _0x259903[_0x8edc('0x19')](_0x11056d)[_0x8edc('0x1a')]();};}function respondWithResult(_0x1936f3,_0x12c08b){_0x12c08b=_0x12c08b||0xc8;return function(_0x7f7616){if(_0x7f7616){return _0x1936f3['status'](_0x12c08b)['json'](_0x7f7616);}};}function respondWithFilteredResult(_0x596a61,_0x1e0ac5){return function(_0x5f3f3f){if(_0x5f3f3f){var _0x2e7bce=typeof _0x1e0ac5['offset']==='undefined'&&typeof _0x1e0ac5[_0x8edc('0x1b')]===_0x8edc('0x1c');var _0x484384=_0x5f3f3f[_0x8edc('0x1d')];var _0x24962d=_0x2e7bce?0x0:_0x1e0ac5[_0x8edc('0x1e')];var _0x2bac33=_0x2e7bce?_0x5f3f3f[_0x8edc('0x1d')]:_0x1e0ac5[_0x8edc('0x1e')]+_0x1e0ac5[_0x8edc('0x1b')];var _0x199026;if(_0x2bac33>=_0x484384){_0x2bac33=_0x484384;_0x199026=0xc8;}else{_0x199026=0xce;}_0x596a61['status'](_0x199026);return _0x596a61['set'](_0x8edc('0x1f'),_0x24962d+'-'+_0x2bac33+'/'+_0x484384)[_0x8edc('0x20')](_0x5f3f3f);}return null;};}function patchUpdates(_0x3342f2){return function(_0x5418e3){try{jsonpatch[_0x8edc('0x21')](_0x5418e3,_0x3342f2,!![]);}catch(_0x543c7d){return BPromise['reject'](_0x543c7d);}return _0x5418e3[_0x8edc('0x22')]();};}function saveUpdates(_0x346674,_0xb0c746){return function(_0x3928c7){if(_0x3928c7){return _0x3928c7[_0x8edc('0x23')](_0x346674)['then'](function(_0x3bd2be){return _0x3bd2be;});}return null;};}function removeEntity(_0x3fa753,_0x165675){return function(_0x324f1b){if(_0x324f1b){return _0x324f1b[_0x8edc('0x24')]()[_0x8edc('0x25')](function(){_0x3fa753[_0x8edc('0x19')](0xcc)[_0x8edc('0x1a')]();});}};}function handleEntityNotFound(_0x4a7a6f,_0x20a11e){return function(_0x19fa79){if(!_0x19fa79){_0x4a7a6f[_0x8edc('0x18')](0x194);}return _0x19fa79;};}function handleError(_0x3c587b,_0x2f57fb){_0x2f57fb=_0x2f57fb||0x1f4;return function(_0xc14e95){logger['error'](_0xc14e95[_0x8edc('0x26')]);if(_0xc14e95[_0x8edc('0x27')]){delete _0xc14e95[_0x8edc('0x27')];}_0x3c587b[_0x8edc('0x19')](_0x2f57fb)[_0x8edc('0x28')](_0xc14e95);};}exports['index']=function(_0x85d04c,_0x3ac4e4){var _0x10e75a={},_0x245912={},_0xda2ae8={'count':0x0,'rows':[]};var _0xde5783=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x357190){return{'name':_0x357190['fieldName'],'type':_0x357190[_0x8edc('0x29')]['key']};});_0x245912['model']=_[_0x8edc('0x2a')](_0xde5783,_0x8edc('0x27'));_0x245912[_0x8edc('0x2b')]=_[_0x8edc('0x2c')](_0x85d04c['query']);_0x245912['filters']=_[_0x8edc('0x2d')](_0x245912[_0x8edc('0x2e')],_0x245912['query']);_0x10e75a['attributes']=_['intersection'](_0x245912[_0x8edc('0x2e')],qs[_0x8edc('0x2f')](_0x85d04c[_0x8edc('0x2b')][_0x8edc('0x2f')]));_0x10e75a[_0x8edc('0x30')]=_0x10e75a[_0x8edc('0x30')]['length']?_0x10e75a['attributes']:_0x245912[_0x8edc('0x2e')];if(!_0x85d04c['query'][_0x8edc('0x31')](_0x8edc('0x32'))){_0x10e75a[_0x8edc('0x1b')]=qs[_0x8edc('0x1b')](_0x85d04c[_0x8edc('0x2b')][_0x8edc('0x1b')]);_0x10e75a[_0x8edc('0x1e')]=qs[_0x8edc('0x1e')](_0x85d04c['query'][_0x8edc('0x1e')]);}_0x10e75a[_0x8edc('0x33')]=qs[_0x8edc('0x34')](_0x85d04c[_0x8edc('0x2b')][_0x8edc('0x34')]);_0x10e75a[_0x8edc('0x35')]=qs[_0x8edc('0x36')](_[_0x8edc('0x37')](_0x85d04c['query'],_0x245912[_0x8edc('0x36')]),_0xde5783);if(_0x85d04c['query'][_0x8edc('0x38')]){_0x10e75a[_0x8edc('0x35')]=_['merge'](_0x10e75a['where'],{'$or':_[_0x8edc('0x2a')](_0xde5783,function(_0x59ea2a){if(_0x59ea2a['type']!==_0x8edc('0x39')){var _0x516896={};_0x516896[_0x59ea2a[_0x8edc('0x27')]]={'$like':'%'+_0x85d04c[_0x8edc('0x2b')]['filter']+'%'};return _0x516896;}})});}_0x10e75a=_[_0x8edc('0x3a')]({},_0x10e75a,_0x85d04c[_0x8edc('0x3b')]);var _0x46d806={'where':_0x10e75a[_0x8edc('0x35')]};return db[_0x8edc('0x3c')][_0x8edc('0x1d')](_0x46d806)[_0x8edc('0x25')](function(_0x4dd4da){_0xda2ae8[_0x8edc('0x1d')]=_0x4dd4da;if(_0x85d04c[_0x8edc('0x2b')]['includeAll']){_0x10e75a[_0x8edc('0x3d')]=[{'all':!![]}];}return db[_0x8edc('0x3c')][_0x8edc('0x3e')](_0x10e75a);})['then'](function(_0x119762){_0xda2ae8[_0x8edc('0x3f')]=_0x119762;return _0xda2ae8;})[_0x8edc('0x25')](respondWithFilteredResult(_0x3ac4e4,_0x10e75a))[_0x8edc('0x40')](handleError(_0x3ac4e4,null));};exports[_0x8edc('0x41')]=function(_0x58e0cc,_0x1ed382){var _0x1cfe9e={'raw':![],'where':{'id':_0x58e0cc[_0x8edc('0x42')]['id']}},_0x1fe1f8={};_0x1fe1f8[_0x8edc('0x2e')]=_[_0x8edc('0x2c')](db[_0x8edc('0x3c')]['rawAttributes']);_0x1fe1f8[_0x8edc('0x2b')]=_[_0x8edc('0x2c')](_0x58e0cc[_0x8edc('0x2b')]);_0x1fe1f8[_0x8edc('0x36')]=_[_0x8edc('0x2d')](_0x1fe1f8[_0x8edc('0x2e')],_0x1fe1f8[_0x8edc('0x2b')]);_0x1cfe9e[_0x8edc('0x30')]=_[_0x8edc('0x2d')](_0x1fe1f8[_0x8edc('0x2e')],qs[_0x8edc('0x2f')](_0x58e0cc[_0x8edc('0x2b')][_0x8edc('0x2f')]));_0x1cfe9e[_0x8edc('0x30')]=_0x1cfe9e[_0x8edc('0x30')][_0x8edc('0x43')]?_0x1cfe9e[_0x8edc('0x30')]:_0x1fe1f8[_0x8edc('0x2e')];if(_0x58e0cc[_0x8edc('0x2b')]['includeAll']){_0x1cfe9e[_0x8edc('0x3d')]=[{'all':!![]}];}_0x1cfe9e=_[_0x8edc('0x3a')]({},_0x1cfe9e,_0x58e0cc[_0x8edc('0x3b')]);return db[_0x8edc('0x3c')][_0x8edc('0x44')](_0x1cfe9e)['then'](handleEntityNotFound(_0x1ed382,null))['then'](respondWithResult(_0x1ed382,null))['catch'](handleError(_0x1ed382,null));};exports[_0x8edc('0x45')]=function(_0x465cbc,_0x11c867){return db[_0x8edc('0x3c')]['create'](_0x465cbc[_0x8edc('0x46')],{})[_0x8edc('0x25')](respondWithResult(_0x11c867,0xc9))['catch'](handleError(_0x11c867,null));};exports[_0x8edc('0x23')]=function(_0x50e4c9,_0x42d269){if(_0x50e4c9['body']['id']){delete _0x50e4c9['body']['id'];}return db[_0x8edc('0x3c')]['find']({'where':{'id':_0x50e4c9[_0x8edc('0x42')]['id']}})[_0x8edc('0x25')](handleEntityNotFound(_0x42d269,null))[_0x8edc('0x25')](saveUpdates(_0x50e4c9['body'],null))[_0x8edc('0x25')](respondWithResult(_0x42d269,null))['catch'](handleError(_0x42d269,null));};exports[_0x8edc('0x24')]=function(_0x56a11e,_0x4be9de){return db[_0x8edc('0x3c')][_0x8edc('0x44')]({'where':{'id':_0x56a11e[_0x8edc('0x42')]['id']}})[_0x8edc('0x25')](handleEntityNotFound(_0x4be9de,null))[_0x8edc('0x25')](removeEntity(_0x4be9de,null))[_0x8edc('0x40')](handleError(_0x4be9de,null));};exports[_0x8edc('0x47')]=function(_0x22d8de,_0x5f03e5,_0x1330b1){var _0x30b1d0={};var _0x3139ab={};var _0x60d4dc;var _0x54b2a9;return db[_0x8edc('0x3c')]['findOne']({'where':{'id':_0x22d8de['params']['id']}})[_0x8edc('0x25')](handleEntityNotFound(_0x5f03e5,null))[_0x8edc('0x25')](function(_0x46f95f){if(_0x46f95f){_0x60d4dc=_0x46f95f;_0x3139ab[_0x8edc('0x2e')]=_[_0x8edc('0x2c')](db['SalesforceConfiguration'][_0x8edc('0x48')]);_0x3139ab[_0x8edc('0x2b')]=_[_0x8edc('0x2c')](_0x22d8de['query']);_0x3139ab['filters']=_[_0x8edc('0x2d')](_0x3139ab['model'],_0x3139ab['query']);_0x30b1d0[_0x8edc('0x30')]=_[_0x8edc('0x2d')](_0x3139ab[_0x8edc('0x2e')],qs[_0x8edc('0x2f')](_0x22d8de[_0x8edc('0x2b')][_0x8edc('0x2f')]));_0x30b1d0[_0x8edc('0x30')]=_0x30b1d0['attributes'][_0x8edc('0x43')]?_0x30b1d0[_0x8edc('0x30')]:_0x3139ab[_0x8edc('0x2e')];_0x30b1d0[_0x8edc('0x33')]=qs[_0x8edc('0x34')](_0x22d8de[_0x8edc('0x2b')][_0x8edc('0x34')]);_0x30b1d0[_0x8edc('0x35')]=qs['filters'](_[_0x8edc('0x37')](_0x22d8de[_0x8edc('0x2b')],_0x3139ab[_0x8edc('0x36')]));if(_0x22d8de[_0x8edc('0x2b')][_0x8edc('0x38')]){_0x30b1d0[_0x8edc('0x35')]=_['merge'](_0x30b1d0['where'],{'$or':_[_0x8edc('0x2a')](_0x30b1d0['attributes'],function(_0x140665){var _0x7f6653={};_0x7f6653[_0x140665]={'$like':'%'+_0x22d8de[_0x8edc('0x2b')]['filter']+'%'};return _0x7f6653;})});}_0x30b1d0=_[_0x8edc('0x3a')]({},_0x30b1d0,_0x22d8de[_0x8edc('0x3b')]);return _0x60d4dc['getConfigurations'](_0x30b1d0);}})[_0x8edc('0x25')](function(_0x36c01){if(_0x36c01){_0x54b2a9=_0x36c01['length'];if(!_0x22d8de[_0x8edc('0x2b')][_0x8edc('0x31')](_0x8edc('0x32'))){_0x30b1d0[_0x8edc('0x1b')]=qs[_0x8edc('0x1b')](_0x22d8de[_0x8edc('0x2b')][_0x8edc('0x1b')]);_0x30b1d0[_0x8edc('0x1e')]=qs[_0x8edc('0x1e')](_0x22d8de[_0x8edc('0x2b')][_0x8edc('0x1e')]);}return _0x60d4dc[_0x8edc('0x47')](_0x30b1d0);}})[_0x8edc('0x25')](function(_0x3a3bf7){if(_0x3a3bf7){return _0x3a3bf7?{'count':_0x54b2a9,'rows':_0x3a3bf7}:null;}})[_0x8edc('0x25')](respondWithResult(_0x5f03e5,null))[_0x8edc('0x40')](handleError(_0x5f03e5,null));};exports[_0x8edc('0x49')]=function(_0xdbdd21,_0x3dd6c7,_0x1104cc){if(_0xdbdd21[_0x8edc('0x46')]['id']){delete _0xdbdd21[_0x8edc('0x46')]['id'];}return db[_0x8edc('0x3c')][_0x8edc('0x4a')]({'where':{'id':_0xdbdd21[_0x8edc('0x42')]['id']}})['then'](handleEntityNotFound(_0x3dd6c7,null))[_0x8edc('0x25')](function(_0x14e0c9){if(_0x14e0c9){_0xdbdd21[_0x8edc('0x46')][_0x8edc('0x4b')]=_0x14e0c9['id'];_0xdbdd21['body'][_0x8edc('0x4c')]=integrations[_0x8edc('0x4d')](_0xdbdd21[_0x8edc('0x46')]['channel'],_0xdbdd21[_0x8edc('0x46')]['type']);_0xdbdd21['body'][_0x8edc('0x4e')]=integrations[_0x8edc('0x4f')](_0xdbdd21[_0x8edc('0x46')][_0x8edc('0x50')],_0xdbdd21[_0x8edc('0x46')][_0x8edc('0x29')]);return db[_0x8edc('0x51')]['create'](_0xdbdd21['body'],{'include':[{'model':db[_0x8edc('0x52')],'as':_0x8edc('0x4c')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0x8edc('0x25')](respondWithResult(_0x3dd6c7,null))[_0x8edc('0x40')](handleError(_0x3dd6c7,null));};exports[_0x8edc('0x53')]=function(_0x5b7bda,_0x593d9c,_0x53c06c){var _0x229258;var _0xaad937='';var _0x3e0f07=_0x8edc('0x54');return db['SalesforceAccount'][_0x8edc('0x4a')]({'where':{'id':_0x5b7bda['params']['id']},'attributes':['id',_0x8edc('0x55'),'clientId',_0x8edc('0x56'),_0x8edc('0x57'),'password','securityToken']})['then'](handleEntityNotFound(_0x593d9c,null))[_0x8edc('0x25')](function(_0xe29435){if(_0xe29435){_0xaad937=_0xe29435['remoteUri'];var _0x473137=_0xaad937['slice'](-0x1);if(_0x473137==='/'){_0xaad937=_0xaad937[_0x8edc('0x58')](0x0,_0xaad937[_0x8edc('0x59')](_0x473137));}_0x229258=new jsforce['Connection']({'oauth2':{'loginUrl':_0xaad937,'clientId':_0xe29435[_0x8edc('0x5a')],'clientSecret':_0xe29435['clientSecret']}});return _0x229258[_0x8edc('0x5b')](_0xe29435[_0x8edc('0x57')],_0xe29435['password'][_0x8edc('0x5c')](_0xe29435[_0x8edc('0x5d')]));}})[_0x8edc('0x25')](function(_0x447e28){if(_0x447e28){if(!_[_0x8edc('0x5e')](_0x5b7bda[_0x8edc('0x2b')][_0x8edc('0x5f')])){_0x3e0f07=_0x5b7bda[_0x8edc('0x2b')][_0x8edc('0x5f')];}return _0x229258[_0x8edc('0x60')](_0x3e0f07)[_0x8edc('0x61')]();}})['then'](function(_0x41708d){var _0x2ff167=[_0x8edc('0x62'),'ActivityDate',_0x8edc('0x63'),'IsRecurrence','Subject',_0x8edc('0x64')];var _0x5b49cf=[_0x8edc('0x65'),'int',_0x8edc('0x66'),'boolean',_0x8edc('0x67'),_0x8edc('0x68'),_0x8edc('0x69')];if(_0x41708d){_['remove'](_0x41708d[_0x8edc('0x2f')],function(_0x25d520){return _0x2ff167[_0x8edc('0x6a')](_0x25d520[_0x8edc('0x27')])||!_0x5b49cf['includes'](_0x25d520['type']);});return{'count':_0x41708d[_0x8edc('0x2f')][_0x8edc('0x43')],'rows':_[_0x8edc('0x2a')](_0x41708d[_0x8edc('0x2f')],function(_0x52bf45){return{'id':_0x52bf45[_0x8edc('0x27')],'name':_0x52bf45['label'],'custom':_0x52bf45['custom'],'options':_0x52bf45[_0x8edc('0x6b')][_0x8edc('0x43')]>0x0?_['map'](_0x52bf45['picklistValues'],function(_0xa1f3b2){return{'name':_0xa1f3b2[_0x8edc('0x6c')],'value':_0xa1f3b2[_0x8edc('0x6d')]};}):_0x52bf45[_0x8edc('0x29')]==_0x8edc('0x6e')?[{'name':_0x8edc('0x6f'),'value':_0x8edc('0x70')},{'name':_0x8edc('0x71'),'value':'false'}]:[]};})};}})[_0x8edc('0x25')](respondWithResult(_0x593d9c,null))[_0x8edc('0x40')](function(_0x4e59d8){var _0x42565d=_0x5b7bda[_0x8edc('0x2b')][_0x8edc('0x72')]?0x1f4:_0x4e59d8[_0x8edc('0x73')]||0x1f4;logger[_0x8edc('0x74')](_0x8edc('0x75'),'getFields',_0x42565d,JSON[_0x8edc('0x76')](_0x4e59d8));delete _0x4e59d8[_0x8edc('0x27')];if(_0x42565d===0x191){_0x42565d=0x190;}_0x593d9c['status'](_0x42565d)['send'](_0x5b7bda[_0x8edc('0x2b')][_0x8edc('0x72')]?{'message':_0x8edc('0x77'),'statusCode':_0x4e59d8[_0x8edc('0x73')]}:_0x4e59d8);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5260cb4..241adbf 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 _0x7311=['./intSalesforceAccount.attributes','../../components/integrations/configuration','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x527799,_0x51370a){var _0x2cb74f=function(_0x5a911d){while(--_0x5a911d){_0x527799['push'](_0x527799['shift']());}};_0x2cb74f(++_0x51370a);}(_0x7311,0x148));var _0x1731=function(_0x5c5f2f,_0x4325f3){_0x5c5f2f=_0x5c5f2f-0x0;var _0x4ecef=_0x7311[_0x5c5f2f];return _0x4ecef;};'use strict';var _=require(_0x1731('0x0'));var util=require(_0x1731('0x1'));var logger=require(_0x1731('0x2'))(_0x1731('0x3'));var moment=require(_0x1731('0x4'));var BPromise=require(_0x1731('0x5'));var rp=require(_0x1731('0x6'));var fs=require('fs');var path=require(_0x1731('0x7'));var rimraf=require(_0x1731('0x8'));var config=require(_0x1731('0x9'));var attributes=require(_0x1731('0xa'));var integrations=require(_0x1731('0xb'));module['exports']=function(_0x39e9cb,_0x3e5ead){return _0x39e9cb[_0x1731('0xc')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa809=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0xa809,0x16e));var _0x9a80=function(_0x29165d,_0x43cb3f){_0x29165d=_0x29165d-0x0;var _0x4c7aeb=_0xa809[_0x29165d];return _0x4c7aeb;};'use strict';var _=require(_0x9a80('0x0'));var util=require(_0x9a80('0x1'));var logger=require(_0x9a80('0x2'))(_0x9a80('0x3'));var moment=require(_0x9a80('0x4'));var BPromise=require(_0x9a80('0x5'));var rp=require(_0x9a80('0x6'));var fs=require('fs');var path=require(_0x9a80('0x7'));var rimraf=require('rimraf');var config=require(_0x9a80('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x9a80('0x9'));module[_0x9a80('0xa')]=function(_0x56b040,_0x537157){return _0x56b040[_0x9a80('0xb')](_0x9a80('0xc'),attributes,{'tableName':_0x9a80('0xd'),'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 1265b0c..8905f12 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 _0xffdd=['attributes','GetSalesforceAccount','catch','find','where','model','ShowSalesforceAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','stringify','error','code','message','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount','findAll','options','raw','limit','include','map'];(function(_0x399a65,_0x2112da){var _0xa0ffca=function(_0xc30e1a){while(--_0xc30e1a){_0x399a65['push'](_0x399a65['shift']());}};_0xa0ffca(++_0x2112da);}(_0xffdd,0x193));var _0xdffd=function(_0x372080,_0x65d24){_0x372080=_0x372080-0x0;var _0x2405ec=_0xffdd[_0x372080];return _0x2405ec;};'use strict';var _=require(_0xdffd('0x0'));var util=require(_0xdffd('0x1'));var moment=require(_0xdffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdffd('0x3'));var db=require(_0xdffd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdffd('0x5'))(_0xdffd('0x6'));var config=require(_0xdffd('0x7'));var jayson=require(_0xdffd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4835f6,_0x372e34,_0x25cd14){return new BPromise(function(_0x1c39c6,_0x2e9eb0){return client[_0xdffd('0x9')](_0x4835f6,_0x25cd14)[_0xdffd('0xa')](function(_0x19137c){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x372e34,'request\x20sent');logger[_0xdffd('0xb')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x372e34,'request\x20sent',JSON[_0xdffd('0xc')](_0x19137c));if(_0x19137c[_0xdffd('0xd')]){if(_0x19137c[_0xdffd('0xd')][_0xdffd('0xe')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x372e34,_0x19137c[_0xdffd('0xd')]['message']);return _0x2e9eb0(_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);}logger[_0xdffd('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x372e34,_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);return _0x1c39c6(_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);}else{logger[_0xdffd('0x10')](_0xdffd('0x11'),_0x372e34,_0xdffd('0x12'));_0x1c39c6(_0x19137c['result'][_0xdffd('0xf')]);}})['catch'](function(_0xa5dd99){logger[_0xdffd('0xd')](_0xdffd('0x11'),_0x372e34,_0xa5dd99);_0x2e9eb0(_0xa5dd99);});});}exports['GetSalesforceAccount']=function(_0xdcc09f){var _0x5583ac=this;return new Promise(function(_0x16a733,_0x9d52b){return db[_0xdffd('0x13')][_0xdffd('0x14')]({'raw':_0xdcc09f[_0xdffd('0x15')]?_0xdcc09f[_0xdffd('0x15')][_0xdffd('0x16')]===undefined?!![]:![]:!![],'where':_0xdcc09f['options']?_0xdcc09f[_0xdffd('0x15')]['where']||null:null,'attributes':_0xdcc09f[_0xdffd('0x15')]?_0xdcc09f[_0xdffd('0x15')]['attributes']||null:null,'limit':_0xdcc09f[_0xdffd('0x15')]?_0xdcc09f['options'][_0xdffd('0x17')]||null:null,'include':_0xdcc09f[_0xdffd('0x15')]?_0xdcc09f[_0xdffd('0x15')][_0xdffd('0x18')]?_[_0xdffd('0x19')](_0xdcc09f['options'][_0xdffd('0x18')],function(_0x1a5926){return{'model':db[_0x1a5926['model']],'as':_0x1a5926['as'],'attributes':_0x1a5926[_0xdffd('0x1a')],'include':_0x1a5926[_0xdffd('0x18')]?_[_0xdffd('0x19')](_0x1a5926['include'],function(_0x324b3e){return{'model':db[_0x324b3e['model']],'as':_0x324b3e['as'],'attributes':_0x324b3e[_0xdffd('0x1a')],'include':_0x324b3e[_0xdffd('0x18')]?_[_0xdffd('0x19')](_0x324b3e[_0xdffd('0x18')],function(_0x2f0c69){return{'model':db[_0x2f0c69['model']],'as':_0x2f0c69['as'],'attributes':_0x2f0c69[_0xdffd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdffd('0xa')](function(_0x5c544f){logger[_0xdffd('0x10')](_0xdffd('0x1b'),_0xdcc09f);logger[_0xdffd('0xb')](_0xdffd('0x1b'),_0xdcc09f,JSON[_0xdffd('0xc')](_0x5c544f));_0x16a733(_0x5c544f);})[_0xdffd('0x1c')](function(_0x1c3289){logger[_0xdffd('0xd')]('GetSalesforceAccount',_0x1c3289['message'],_0xdcc09f);_0x9d52b(_0x5583ac['error'](0x1f4,_0x1c3289[_0xdffd('0xf')]));});});};exports['ShowSalesforceAccount']=function(_0x5c5761){var _0x45f8e9=this;return new Promise(function(_0x11b58d,_0x491dcd){return db['SalesforceAccount'][_0xdffd('0x1d')]({'raw':_0x5c5761[_0xdffd('0x15')]?_0x5c5761[_0xdffd('0x15')][_0xdffd('0x16')]===undefined?!![]:![]:!![],'where':_0x5c5761['options']?_0x5c5761['options'][_0xdffd('0x1e')]||null:null,'attributes':_0x5c5761[_0xdffd('0x15')]?_0x5c5761['options'][_0xdffd('0x1a')]||null:null,'include':_0x5c5761['options']?_0x5c5761[_0xdffd('0x15')][_0xdffd('0x18')]?_[_0xdffd('0x19')](_0x5c5761[_0xdffd('0x15')]['include'],function(_0xf7d01){return{'model':db[_0xf7d01['model']],'as':_0xf7d01['as'],'attributes':_0xf7d01[_0xdffd('0x1a')],'include':_0xf7d01['include']?_[_0xdffd('0x19')](_0xf7d01[_0xdffd('0x18')],function(_0x147f39){return{'model':db[_0x147f39[_0xdffd('0x1f')]],'as':_0x147f39['as'],'attributes':_0x147f39[_0xdffd('0x1a')],'include':_0x147f39[_0xdffd('0x18')]?_[_0xdffd('0x19')](_0x147f39[_0xdffd('0x18')],function(_0x595d9d){return{'model':db[_0x595d9d['model']],'as':_0x595d9d['as'],'attributes':_0x595d9d['attributes']};}):[]};}):[]};}):[]:[]})[_0xdffd('0xa')](function(_0x1954e9){logger[_0xdffd('0x10')](_0xdffd('0x20'),_0x5c5761);logger['debug'](_0xdffd('0x20'),_0x5c5761,JSON[_0xdffd('0xc')](_0x1954e9));_0x11b58d(_0x1954e9);})[_0xdffd('0x1c')](function(_0x45c185){logger[_0xdffd('0xd')](_0xdffd('0x20'),_0x45c185[_0xdffd('0xf')],_0x5c5761);_0x491dcd(_0x45f8e9[_0xdffd('0xd')](0x1f4,_0x45c185[_0xdffd('0xf')]));});});}; \ No newline at end of file +var _0x8c65=['jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','GetSalesforceAccount','catch','ShowSalesforceAccount','find','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4d3870,_0x504daa){var _0x38162c=function(_0x3a436d){while(--_0x3a436d){_0x4d3870['push'](_0x4d3870['shift']());}};_0x38162c(++_0x504daa);}(_0x8c65,0x12a));var _0x58c6=function(_0xbacbef,_0x4f0636){_0xbacbef=_0xbacbef-0x0;var _0x30e757=_0x8c65[_0xbacbef];return _0x30e757;};'use strict';var _=require('lodash');var util=require(_0x58c6('0x0'));var moment=require('moment');var BPromise=require(_0x58c6('0x1'));var rs=require(_0x58c6('0x2'));var fs=require('fs');var Redis=require(_0x58c6('0x3'));var db=require(_0x58c6('0x4'))['db'];var utils=require(_0x58c6('0x5'));var logger=require(_0x58c6('0x6'))('rpc');var config=require(_0x58c6('0x7'));var jayson=require(_0x58c6('0x8'));var client=jayson[_0x58c6('0x9')][_0x58c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc80e84,_0x3719f6,_0x32d776){return new BPromise(function(_0x150f4e,_0x25b018){return client[_0x58c6('0xb')](_0xc80e84,_0x32d776)[_0x58c6('0xc')](function(_0x3ec964){logger[_0x58c6('0xd')](_0x58c6('0xe'),_0x3719f6,_0x58c6('0xf'));logger[_0x58c6('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3719f6,_0x58c6('0xf'),JSON[_0x58c6('0x11')](_0x3ec964));if(_0x3ec964['error']){if(_0x3ec964['error']['code']===0x1f4){logger['error'](_0x58c6('0xe'),_0x3719f6,_0x3ec964['error']['message']);return _0x25b018(_0x3ec964['error'][_0x58c6('0x12')]);}logger[_0x58c6('0x13')](_0x58c6('0xe'),_0x3719f6,_0x3ec964[_0x58c6('0x13')]['message']);return _0x150f4e(_0x3ec964[_0x58c6('0x13')][_0x58c6('0x12')]);}else{logger['info'](_0x58c6('0xe'),_0x3719f6,_0x58c6('0xf'));_0x150f4e(_0x3ec964['result']['message']);}})['catch'](function(_0x50b347){logger[_0x58c6('0x13')](_0x58c6('0xe'),_0x3719f6,_0x50b347);_0x25b018(_0x50b347);});});}exports['GetSalesforceAccount']=function(_0x5e3c13){var _0x11056c=this;return new Promise(function(_0x437983,_0x411394){return db[_0x58c6('0x14')][_0x58c6('0x15')]({'raw':_0x5e3c13[_0x58c6('0x16')]?_0x5e3c13[_0x58c6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5e3c13['options']?_0x5e3c13[_0x58c6('0x16')][_0x58c6('0x17')]||null:null,'attributes':_0x5e3c13[_0x58c6('0x16')]?_0x5e3c13[_0x58c6('0x16')][_0x58c6('0x18')]||null:null,'limit':_0x5e3c13['options']?_0x5e3c13[_0x58c6('0x16')][_0x58c6('0x19')]||null:null,'include':_0x5e3c13[_0x58c6('0x16')]?_0x5e3c13[_0x58c6('0x16')][_0x58c6('0x1a')]?_[_0x58c6('0x1b')](_0x5e3c13[_0x58c6('0x16')]['include'],function(_0x50467b){return{'model':db[_0x50467b[_0x58c6('0x1c')]],'as':_0x50467b['as'],'attributes':_0x50467b[_0x58c6('0x18')],'include':_0x50467b['include']?_['map'](_0x50467b[_0x58c6('0x1a')],function(_0x1f478a){return{'model':db[_0x1f478a[_0x58c6('0x1c')]],'as':_0x1f478a['as'],'attributes':_0x1f478a['attributes'],'include':_0x1f478a[_0x58c6('0x1a')]?_['map'](_0x1f478a['include'],function(_0x5f379f){return{'model':db[_0x5f379f[_0x58c6('0x1c')]],'as':_0x5f379f['as'],'attributes':_0x5f379f[_0x58c6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x58c6('0xc')](function(_0x15335a){logger[_0x58c6('0xd')](_0x58c6('0x1d'),_0x5e3c13);logger[_0x58c6('0x10')]('GetSalesforceAccount',_0x5e3c13,JSON[_0x58c6('0x11')](_0x15335a));_0x437983(_0x15335a);})[_0x58c6('0x1e')](function(_0x535d8a){logger['error'](_0x58c6('0x1d'),_0x535d8a[_0x58c6('0x12')],_0x5e3c13);_0x411394(_0x11056c['error'](0x1f4,_0x535d8a['message']));});});};exports[_0x58c6('0x1f')]=function(_0x412bdc){var _0x26ac5e=this;return new Promise(function(_0x381a66,_0xb1189c){return db[_0x58c6('0x14')][_0x58c6('0x20')]({'raw':_0x412bdc[_0x58c6('0x16')]?_0x412bdc[_0x58c6('0x16')][_0x58c6('0x21')]===undefined?!![]:![]:!![],'where':_0x412bdc[_0x58c6('0x16')]?_0x412bdc[_0x58c6('0x16')][_0x58c6('0x17')]||null:null,'attributes':_0x412bdc['options']?_0x412bdc['options']['attributes']||null:null,'include':_0x412bdc[_0x58c6('0x16')]?_0x412bdc[_0x58c6('0x16')][_0x58c6('0x1a')]?_[_0x58c6('0x1b')](_0x412bdc[_0x58c6('0x16')][_0x58c6('0x1a')],function(_0x4d66aa){return{'model':db[_0x4d66aa[_0x58c6('0x1c')]],'as':_0x4d66aa['as'],'attributes':_0x4d66aa[_0x58c6('0x18')],'include':_0x4d66aa[_0x58c6('0x1a')]?_[_0x58c6('0x1b')](_0x4d66aa[_0x58c6('0x1a')],function(_0x54821d){return{'model':db[_0x54821d['model']],'as':_0x54821d['as'],'attributes':_0x54821d['attributes'],'include':_0x54821d[_0x58c6('0x1a')]?_[_0x58c6('0x1b')](_0x54821d[_0x58c6('0x1a')],function(_0x4dfdb6){return{'model':db[_0x4dfdb6[_0x58c6('0x1c')]],'as':_0x4dfdb6['as'],'attributes':_0x4dfdb6['attributes']};}):[]};}):[]};}):[]:[]})[_0x58c6('0xc')](function(_0x534621){logger[_0x58c6('0xd')](_0x58c6('0x1f'),_0x412bdc);logger[_0x58c6('0x10')](_0x58c6('0x1f'),_0x412bdc,JSON[_0x58c6('0x11')](_0x534621));_0x381a66(_0x534621);})[_0x58c6('0x1e')](function(_0xad7dd3){logger[_0x58c6('0x13')](_0x58c6('0x1f'),_0xad7dd3['message'],_0x412bdc);_0xb1189c(_0x26ac5e[_0x58c6('0x13')](0x1f4,_0xad7dd3[_0x58c6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f6aaf87..88eb95f 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b6420,_0x126201){_0x4b6420=_0x4b6420-0x0;var _0x37076f=_0x0b0e[_0x4b6420];return _0x37076f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdb28,0x106));var _0x8db2=function(_0x141957,_0x5ccff9){_0x141957=_0x141957-0x0;var _0x13e899=_0xdb28[_0x141957];return _0x13e899;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 74816d7..16e9fa4 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 _0xa104=['account','nothing','STRING','sequelize','exports','ENUM','Task','Case','contact_lead','lead','account_contact_lead'];(function(_0x3842fa,_0x40f55f){var _0x1143ae=function(_0x218b2c){while(--_0x218b2c){_0x3842fa['push'](_0x3842fa['shift']());}};_0x1143ae(++_0x40f55f);}(_0xa104,0xc9));var _0x4a10=function(_0x57979d,_0x354826){_0x57979d=_0x57979d-0x0;var _0x3d5b11=_0xa104[_0x57979d];return _0x3d5b11;};'use strict';var Sequelize=require(_0x4a10('0x0'));module[_0x4a10('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4a10('0x2')](_0x4a10('0x3'),_0x4a10('0x4')),'defaultValue':_0x4a10('0x3')},'moduleSearch':{'type':Sequelize[_0x4a10('0x2')](_0x4a10('0x5'),'contact',_0x4a10('0x6'),_0x4a10('0x7'),_0x4a10('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x4a10('0x2')](_0x4a10('0x9'),'contact',_0x4a10('0x6'),_0x4a10('0x8')),'defaultValue':_0x4a10('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x4a10('0xa')]},'additionalSearchContact':{'type':Sequelize[_0x4a10('0xa')]},'additionalSearchLead':{'type':Sequelize[_0x4a10('0xa')]}}; \ No newline at end of file +var _0x2c5b=['account','nothing','lead','sequelize','STRING','ENUM','Task','contact_lead','contact','account_contact_lead'];(function(_0x883cab,_0x149c7f){var _0x24731d=function(_0x4cb125){while(--_0x4cb125){_0x883cab['push'](_0x883cab['shift']());}};_0x24731d(++_0x149c7f);}(_0x2c5b,0x193));var _0xb2c5=function(_0x43f39e,_0x273951){_0x43f39e=_0x43f39e-0x0;var _0x41874b=_0x2c5b[_0x43f39e];return _0x41874b;};'use strict';var Sequelize=require(_0xb2c5('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2c5('0x1')]},'description':{'type':Sequelize[_0xb2c5('0x1')]},'ticketType':{'type':Sequelize[_0xb2c5('0x2')]('Task','Case'),'defaultValue':_0xb2c5('0x3')},'moduleSearch':{'type':Sequelize[_0xb2c5('0x2')](_0xb2c5('0x4'),_0xb2c5('0x5'),'lead',_0xb2c5('0x6'),_0xb2c5('0x7')),'defaultValue':_0xb2c5('0x4')},'moduleCreate':{'type':Sequelize[_0xb2c5('0x2')](_0xb2c5('0x8'),_0xb2c5('0x5'),'lead','account'),'defaultValue':_0xb2c5('0x9')},'leadId':{'type':Sequelize[_0xb2c5('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xb2c5('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xb2c5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 186e23e..fbccbe7 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 _0x13c4=['fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','intersection','options','find','create','body','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x13c4,0xf9));var _0x413c=function(_0x37eddf,_0x2d3277){_0x37eddf=_0x37eddf-0x0;var _0x376594=_0x13c4[_0x37eddf];return _0x376594;};'use strict';var emlformat=require(_0x413c('0x0'));var rimraf=require(_0x413c('0x1'));var zipdir=require(_0x413c('0x2'));var jsonpatch=require(_0x413c('0x3'));var rp=require(_0x413c('0x4'));var moment=require(_0x413c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x413c('0x6'));var sox=require(_0x413c('0x7'));var csv=require('to-csv');var ejs=require(_0x413c('0x8'));var fs=require('fs');var fs_extra=require(_0x413c('0x9'));var _=require(_0x413c('0xa'));var squel=require(_0x413c('0xb'));var crypto=require(_0x413c('0xc'));var jsforce=require(_0x413c('0xd'));var deskjs=require(_0x413c('0xe'));var toCsv=require(_0x413c('0xf'));var querystring=require(_0x413c('0x10'));var Papa=require(_0x413c('0x11'));var Redis=require('ioredis');var authService=require(_0x413c('0x12'));var qs=require(_0x413c('0x13'));var as=require(_0x413c('0x14'));var hardwareService=require(_0x413c('0x15'));var logger=require(_0x413c('0x16'))(_0x413c('0x17'));var utils=require(_0x413c('0x18'));var config=require(_0x413c('0x19'));var licenseUtil=require(_0x413c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9bd289,_0x16f78f){_0x16f78f=_0x16f78f||0xcc;return function(_0x84e77c){if(_0x84e77c){return _0x9bd289[_0x413c('0x1b')](_0x16f78f);}return _0x9bd289[_0x413c('0x1c')](_0x16f78f)['end']();};}function respondWithResult(_0x46b7a8,_0x2259a5){_0x2259a5=_0x2259a5||0xc8;return function(_0x23ec89){if(_0x23ec89){return _0x46b7a8['status'](_0x2259a5)[_0x413c('0x1d')](_0x23ec89);}};}function respondWithFilteredResult(_0xff0f28,_0x3c8ffb){return function(_0x1b6e3b){if(_0x1b6e3b){var _0x2a45be=typeof _0x3c8ffb['offset']==='undefined'&&typeof _0x3c8ffb[_0x413c('0x1e')]===_0x413c('0x1f');var _0x58e368=_0x1b6e3b[_0x413c('0x20')];var _0x3df3f0=_0x2a45be?0x0:_0x3c8ffb[_0x413c('0x21')];var _0x56954b=_0x2a45be?_0x1b6e3b['count']:_0x3c8ffb[_0x413c('0x21')]+_0x3c8ffb['limit'];var _0x4b2aa9;if(_0x56954b>=_0x58e368){_0x56954b=_0x58e368;_0x4b2aa9=0xc8;}else{_0x4b2aa9=0xce;}_0xff0f28[_0x413c('0x1c')](_0x4b2aa9);return _0xff0f28[_0x413c('0x22')](_0x413c('0x23'),_0x3df3f0+'-'+_0x56954b+'/'+_0x58e368)['json'](_0x1b6e3b);}return null;};}function patchUpdates(_0x5f38cb){return function(_0xff7efb){try{jsonpatch[_0x413c('0x24')](_0xff7efb,_0x5f38cb,!![]);}catch(_0x42f2e){return BPromise[_0x413c('0x25')](_0x42f2e);}return _0xff7efb['save']();};}function saveUpdates(_0x28fd8c,_0x100e92){return function(_0x5b2a13){if(_0x5b2a13){return _0x5b2a13[_0x413c('0x26')](_0x28fd8c)[_0x413c('0x27')](function(_0x559e59){return _0x559e59;});}return null;};}function removeEntity(_0xe177e0,_0x2930f9){return function(_0x56bb67){if(_0x56bb67){return _0x56bb67[_0x413c('0x28')]()['then'](function(){_0xe177e0[_0x413c('0x1c')](0xcc)[_0x413c('0x29')]();});}};}function handleEntityNotFound(_0x3078b0,_0x2a2097){return function(_0x356e71){if(!_0x356e71){_0x3078b0[_0x413c('0x1b')](0x194);}return _0x356e71;};}function handleError(_0x37bcbd,_0x2ae36d){_0x2ae36d=_0x2ae36d||0x1f4;return function(_0x4a8d05){logger[_0x413c('0x2a')](_0x4a8d05[_0x413c('0x2b')]);if(_0x4a8d05['name']){delete _0x4a8d05[_0x413c('0x2c')];}_0x37bcbd[_0x413c('0x1c')](_0x2ae36d)['send'](_0x4a8d05);};}exports[_0x413c('0x2d')]=function(_0x3d3922,_0x54df05){var _0x38e37c={},_0x209140={},_0x48a479={'count':0x0,'rows':[]};var _0x5f353f=_[_0x413c('0x2e')](db[_0x413c('0x2f')][_0x413c('0x30')],function(_0x4cdd79){return{'name':_0x4cdd79[_0x413c('0x31')],'type':_0x4cdd79[_0x413c('0x32')][_0x413c('0x33')]};});_0x209140[_0x413c('0x34')]=_['map'](_0x5f353f,'name');_0x209140[_0x413c('0x35')]=_[_0x413c('0x36')](_0x3d3922[_0x413c('0x35')]);_0x209140[_0x413c('0x37')]=_['intersection'](_0x209140[_0x413c('0x34')],_0x209140[_0x413c('0x35')]);_0x38e37c[_0x413c('0x38')]=_['intersection'](_0x209140['model'],qs[_0x413c('0x39')](_0x3d3922[_0x413c('0x35')]['fields']));_0x38e37c[_0x413c('0x38')]=_0x38e37c['attributes'][_0x413c('0x3a')]?_0x38e37c[_0x413c('0x38')]:_0x209140[_0x413c('0x34')];if(!_0x3d3922[_0x413c('0x35')][_0x413c('0x3b')](_0x413c('0x3c'))){_0x38e37c['limit']=qs[_0x413c('0x1e')](_0x3d3922[_0x413c('0x35')][_0x413c('0x1e')]);_0x38e37c[_0x413c('0x21')]=qs[_0x413c('0x21')](_0x3d3922['query']['offset']);}_0x38e37c['order']=qs['sort'](_0x3d3922[_0x413c('0x35')][_0x413c('0x3d')]);_0x38e37c['where']=qs['filters'](_[_0x413c('0x3e')](_0x3d3922[_0x413c('0x35')],_0x209140[_0x413c('0x37')]),_0x5f353f);if(_0x3d3922[_0x413c('0x35')][_0x413c('0x3f')]){_0x38e37c[_0x413c('0x40')]=_['merge'](_0x38e37c[_0x413c('0x40')],{'$or':_['map'](_0x5f353f,function(_0x446e49){if(_0x446e49[_0x413c('0x32')]!==_0x413c('0x41')){var _0x2f1e={};_0x2f1e[_0x446e49[_0x413c('0x2c')]]={'$like':'%'+_0x3d3922[_0x413c('0x35')][_0x413c('0x3f')]+'%'};return _0x2f1e;}})});}_0x38e37c=_[_0x413c('0x42')]({},_0x38e37c,_0x3d3922['options']);var _0x5265c3={'where':_0x38e37c[_0x413c('0x40')]};return db[_0x413c('0x2f')]['count'](_0x5265c3)[_0x413c('0x27')](function(_0x43fa3d){_0x48a479[_0x413c('0x20')]=_0x43fa3d;if(_0x3d3922[_0x413c('0x35')][_0x413c('0x43')]){_0x38e37c[_0x413c('0x44')]=[{'all':!![]}];}return db[_0x413c('0x2f')]['findAll'](_0x38e37c);})['then'](function(_0xb7831a){_0x48a479[_0x413c('0x45')]=_0xb7831a;return _0x48a479;})[_0x413c('0x27')](respondWithFilteredResult(_0x54df05,_0x38e37c))[_0x413c('0x46')](handleError(_0x54df05,null));};exports[_0x413c('0x47')]=function(_0x7ebf2,_0x30a69c){var _0xdc0a8c={'raw':![],'where':{'id':_0x7ebf2[_0x413c('0x48')]['id']}},_0x14a4e8={};_0x14a4e8[_0x413c('0x34')]=_[_0x413c('0x36')](db[_0x413c('0x2f')][_0x413c('0x30')]);_0x14a4e8[_0x413c('0x35')]=_[_0x413c('0x36')](_0x7ebf2['query']);_0x14a4e8['filters']=_[_0x413c('0x49')](_0x14a4e8['model'],_0x14a4e8[_0x413c('0x35')]);_0xdc0a8c['attributes']=_[_0x413c('0x49')](_0x14a4e8['model'],qs[_0x413c('0x39')](_0x7ebf2[_0x413c('0x35')][_0x413c('0x39')]));_0xdc0a8c['attributes']=_0xdc0a8c[_0x413c('0x38')]['length']?_0xdc0a8c['attributes']:_0x14a4e8[_0x413c('0x34')];if(_0x7ebf2[_0x413c('0x35')][_0x413c('0x43')]){_0xdc0a8c[_0x413c('0x44')]=[{'all':!![]}];}_0xdc0a8c=_[_0x413c('0x42')]({},_0xdc0a8c,_0x7ebf2[_0x413c('0x4a')]);return db[_0x413c('0x2f')][_0x413c('0x4b')](_0xdc0a8c)[_0x413c('0x27')](handleEntityNotFound(_0x30a69c,null))[_0x413c('0x27')](respondWithResult(_0x30a69c,null))['catch'](handleError(_0x30a69c,null));};exports[_0x413c('0x4c')]=function(_0x3aaf52,_0x4ef965){return db[_0x413c('0x2f')][_0x413c('0x4c')](_0x3aaf52[_0x413c('0x4d')],{})[_0x413c('0x27')](respondWithResult(_0x4ef965,0xc9))['catch'](handleError(_0x4ef965,null));};exports[_0x413c('0x26')]=function(_0x4ec858,_0x394204){if(_0x4ec858['body']['id']){delete _0x4ec858[_0x413c('0x4d')]['id'];}return db[_0x413c('0x2f')]['find']({'where':{'id':_0x4ec858['params']['id']}})[_0x413c('0x27')](handleEntityNotFound(_0x394204,null))[_0x413c('0x27')](saveUpdates(_0x4ec858['body'],null))[_0x413c('0x27')](respondWithResult(_0x394204,null))[_0x413c('0x46')](handleError(_0x394204,null));};exports[_0x413c('0x28')]=function(_0x2b0828,_0x3ba384){return db[_0x413c('0x2f')][_0x413c('0x4b')]({'where':{'id':_0x2b0828['params']['id']}})[_0x413c('0x27')](handleEntityNotFound(_0x3ba384,null))[_0x413c('0x27')](removeEntity(_0x3ba384,null))['catch'](handleError(_0x3ba384,null));};exports[_0x413c('0x4e')]=function(_0x5ddcf1,_0x3b7090,_0x2c1436){var _0xb094f9={};var _0x2fd748={};var _0x53a202;var _0x5b175a;return db[_0x413c('0x2f')][_0x413c('0x4f')]({'where':{'id':_0x5ddcf1['params']['id']}})[_0x413c('0x27')](handleEntityNotFound(_0x3b7090,null))['then'](function(_0x18f001){if(_0x18f001){_0x53a202=_0x18f001;_0x2fd748['model']=_[_0x413c('0x36')](db[_0x413c('0x50')][_0x413c('0x30')]);_0x2fd748[_0x413c('0x35')]=_['keys'](_0x5ddcf1[_0x413c('0x35')]);_0x2fd748[_0x413c('0x37')]=_[_0x413c('0x49')](_0x2fd748[_0x413c('0x34')],_0x2fd748[_0x413c('0x35')]);_0xb094f9['attributes']=_[_0x413c('0x49')](_0x2fd748['model'],qs[_0x413c('0x39')](_0x5ddcf1[_0x413c('0x35')][_0x413c('0x39')]));_0xb094f9[_0x413c('0x38')]=_0xb094f9[_0x413c('0x38')][_0x413c('0x3a')]?_0xb094f9[_0x413c('0x38')]:_0x2fd748['model'];_0xb094f9[_0x413c('0x51')]=qs[_0x413c('0x3d')](_0x5ddcf1[_0x413c('0x35')][_0x413c('0x3d')]);_0xb094f9['where']=qs[_0x413c('0x37')](_[_0x413c('0x3e')](_0x5ddcf1[_0x413c('0x35')],_0x2fd748[_0x413c('0x37')]));if(_0x5ddcf1[_0x413c('0x35')][_0x413c('0x3f')]){_0xb094f9[_0x413c('0x40')]=_[_0x413c('0x42')](_0xb094f9[_0x413c('0x40')],{'$or':_[_0x413c('0x2e')](_0xb094f9[_0x413c('0x38')],function(_0x4062c3){var _0x27148b={};_0x27148b[_0x4062c3]={'$like':'%'+_0x5ddcf1[_0x413c('0x35')][_0x413c('0x3f')]+'%'};return _0x27148b;})});}_0xb094f9=_[_0x413c('0x42')]({},_0xb094f9,_0x5ddcf1['options']);return _0x53a202['getFields'](_0xb094f9);}})[_0x413c('0x27')](function(_0x1bb761){if(_0x1bb761){_0x5b175a=_0x1bb761['length'];if(!_0x5ddcf1[_0x413c('0x35')][_0x413c('0x3b')](_0x413c('0x3c'))){_0xb094f9[_0x413c('0x1e')]=qs['limit'](_0x5ddcf1[_0x413c('0x35')][_0x413c('0x1e')]);_0xb094f9['offset']=qs[_0x413c('0x21')](_0x5ddcf1[_0x413c('0x35')][_0x413c('0x21')]);}return _0x53a202[_0x413c('0x4e')](_0xb094f9);}})[_0x413c('0x27')](function(_0x34fe60){if(_0x34fe60){return _0x34fe60?{'count':_0x5b175a,'rows':_0x34fe60}:null;}})['then'](respondWithResult(_0x3b7090,null))['catch'](handleError(_0x3b7090,null));};exports[_0x413c('0x52')]=function(_0x1695cf,_0x15e11c,_0x3bf88c){var _0x7e0e6e={};var _0x1fd588={};var _0x19b66c;var _0x1acf6d;return db['SalesforceConfiguration'][_0x413c('0x4f')]({'where':{'id':_0x1695cf[_0x413c('0x48')]['id']}})['then'](handleEntityNotFound(_0x15e11c,null))[_0x413c('0x27')](function(_0x534263){if(_0x534263){_0x19b66c=_0x534263;_0x1fd588['model']=_[_0x413c('0x36')](db[_0x413c('0x50')][_0x413c('0x30')]);_0x1fd588['query']=_['keys'](_0x1695cf[_0x413c('0x35')]);_0x1fd588[_0x413c('0x37')]=_[_0x413c('0x49')](_0x1fd588[_0x413c('0x34')],_0x1fd588[_0x413c('0x35')]);_0x7e0e6e[_0x413c('0x38')]=_[_0x413c('0x49')](_0x1fd588['model'],qs[_0x413c('0x39')](_0x1695cf[_0x413c('0x35')][_0x413c('0x39')]));_0x7e0e6e[_0x413c('0x38')]=_0x7e0e6e[_0x413c('0x38')][_0x413c('0x3a')]?_0x7e0e6e['attributes']:_0x1fd588[_0x413c('0x34')];_0x7e0e6e['order']=qs['sort'](_0x1695cf[_0x413c('0x35')][_0x413c('0x3d')]);_0x7e0e6e[_0x413c('0x40')]=qs[_0x413c('0x37')](_[_0x413c('0x3e')](_0x1695cf[_0x413c('0x35')],_0x1fd588[_0x413c('0x37')]));if(_0x1695cf[_0x413c('0x35')][_0x413c('0x3f')]){_0x7e0e6e[_0x413c('0x40')]=_[_0x413c('0x42')](_0x7e0e6e[_0x413c('0x40')],{'$or':_['map'](_0x7e0e6e[_0x413c('0x38')],function(_0x45723d){var _0xfabe2e={};_0xfabe2e[_0x45723d]={'$like':'%'+_0x1695cf[_0x413c('0x35')][_0x413c('0x3f')]+'%'};return _0xfabe2e;})});}_0x7e0e6e=_[_0x413c('0x42')]({},_0x7e0e6e,_0x1695cf[_0x413c('0x4a')]);return _0x19b66c[_0x413c('0x52')](_0x7e0e6e);}})[_0x413c('0x27')](function(_0x2afb23){if(_0x2afb23){_0x1acf6d=_0x2afb23[_0x413c('0x3a')];if(!_0x1695cf['query'][_0x413c('0x3b')](_0x413c('0x3c'))){_0x7e0e6e['limit']=qs[_0x413c('0x1e')](_0x1695cf[_0x413c('0x35')]['limit']);_0x7e0e6e[_0x413c('0x21')]=qs['offset'](_0x1695cf[_0x413c('0x35')]['offset']);}return _0x19b66c[_0x413c('0x52')](_0x7e0e6e);}})['then'](function(_0x56bc1a){if(_0x56bc1a){return _0x56bc1a?{'count':_0x1acf6d,'rows':_0x56bc1a}:null;}})[_0x413c('0x27')](respondWithResult(_0x15e11c,null))[_0x413c('0x46')](handleError(_0x15e11c,null));};exports['getDescriptions']=function(_0x24bbc7,_0x12f632,_0x37302c){var _0x36293d={};var _0x27122b={};var _0x26d1ac;var _0xc32109;return db[_0x413c('0x2f')][_0x413c('0x4f')]({'where':{'id':_0x24bbc7[_0x413c('0x48')]['id']}})['then'](handleEntityNotFound(_0x12f632,null))['then'](function(_0x4c0721){if(_0x4c0721){_0x26d1ac=_0x4c0721;_0x27122b[_0x413c('0x34')]=_[_0x413c('0x36')](db['SalesforceField'][_0x413c('0x30')]);_0x27122b['query']=_[_0x413c('0x36')](_0x24bbc7[_0x413c('0x35')]);_0x27122b[_0x413c('0x37')]=_[_0x413c('0x49')](_0x27122b[_0x413c('0x34')],_0x27122b[_0x413c('0x35')]);_0x36293d[_0x413c('0x38')]=_[_0x413c('0x49')](_0x27122b[_0x413c('0x34')],qs[_0x413c('0x39')](_0x24bbc7['query'][_0x413c('0x39')]));_0x36293d[_0x413c('0x38')]=_0x36293d[_0x413c('0x38')][_0x413c('0x3a')]?_0x36293d['attributes']:_0x27122b[_0x413c('0x34')];_0x36293d['order']=qs['sort'](_0x24bbc7[_0x413c('0x35')][_0x413c('0x3d')]);_0x36293d['where']=qs[_0x413c('0x37')](_[_0x413c('0x3e')](_0x24bbc7[_0x413c('0x35')],_0x27122b['filters']));if(_0x24bbc7[_0x413c('0x35')][_0x413c('0x3f')]){_0x36293d[_0x413c('0x40')]=_['merge'](_0x36293d[_0x413c('0x40')],{'$or':_[_0x413c('0x2e')](_0x36293d[_0x413c('0x38')],function(_0x5f381f){var _0x4cd00e={};_0x4cd00e[_0x5f381f]={'$like':'%'+_0x24bbc7[_0x413c('0x35')][_0x413c('0x3f')]+'%'};return _0x4cd00e;})});}_0x36293d=_[_0x413c('0x42')]({},_0x36293d,_0x24bbc7[_0x413c('0x4a')]);return _0x26d1ac[_0x413c('0x53')](_0x36293d);}})[_0x413c('0x27')](function(_0x1d63bd){if(_0x1d63bd){_0xc32109=_0x1d63bd[_0x413c('0x3a')];if(!_0x24bbc7[_0x413c('0x35')]['hasOwnProperty']('nolimit')){_0x36293d[_0x413c('0x1e')]=qs[_0x413c('0x1e')](_0x24bbc7[_0x413c('0x35')][_0x413c('0x1e')]);_0x36293d[_0x413c('0x21')]=qs[_0x413c('0x21')](_0x24bbc7['query'][_0x413c('0x21')]);}return _0x26d1ac['getDescriptions'](_0x36293d);}})[_0x413c('0x27')](function(_0x467e09){if(_0x467e09){return _0x467e09?{'count':_0xc32109,'rows':_0x467e09}:null;}})[_0x413c('0x27')](respondWithResult(_0x12f632,null))['catch'](handleError(_0x12f632,null));}; \ No newline at end of file +var _0xda9d=['../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','catch','keys','include','options','create','body','find','params','destroy','getFields','SalesforceField','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils'];(function(_0x887089,_0x4d27c0){var _0x151f2d=function(_0x48f5e0){while(--_0x48f5e0){_0x887089['push'](_0x887089['shift']());}};_0x151f2d(++_0x4d27c0);}(_0xda9d,0x85));var _0xdda9=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0xda9d[_0x119629];return _0x49a771;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda9('0x0'));var zipdir=require(_0xdda9('0x1'));var jsonpatch=require(_0xdda9('0x2'));var rp=require(_0xdda9('0x3'));var moment=require(_0xdda9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdda9('0x5'));var util=require('util');var path=require(_0xdda9('0x6'));var sox=require('sox');var csv=require(_0xdda9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdda9('0x8'));var crypto=require(_0xdda9('0x9'));var jsforce=require(_0xdda9('0xa'));var deskjs=require(_0xdda9('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdda9('0xc'));var Papa=require(_0xdda9('0xd'));var Redis=require(_0xdda9('0xe'));var authService=require(_0xdda9('0xf'));var qs=require(_0xdda9('0x10'));var as=require(_0xdda9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdda9('0x12'));var config=require(_0xdda9('0x13'));var licenseUtil=require(_0xdda9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd92e,_0x88ed91){_0x88ed91=_0x88ed91||0xcc;return function(_0x41e385){if(_0x41e385){return _0x2bd92e['sendStatus'](_0x88ed91);}return _0x2bd92e['status'](_0x88ed91)[_0xdda9('0x15')]();};}function respondWithResult(_0x9f53ec,_0x2045f3){_0x2045f3=_0x2045f3||0xc8;return function(_0x10061f){if(_0x10061f){return _0x9f53ec[_0xdda9('0x16')](_0x2045f3)[_0xdda9('0x17')](_0x10061f);}};}function respondWithFilteredResult(_0x15ee07,_0x272f20){return function(_0x27899a){if(_0x27899a){var _0x18a3f8=typeof _0x272f20[_0xdda9('0x18')]===_0xdda9('0x19')&&typeof _0x272f20[_0xdda9('0x1a')]===_0xdda9('0x19');var _0x1c0bbc=_0x27899a['count'];var _0x2e8c4e=_0x18a3f8?0x0:_0x272f20[_0xdda9('0x18')];var _0x1c46b9=_0x18a3f8?_0x27899a[_0xdda9('0x1b')]:_0x272f20[_0xdda9('0x18')]+_0x272f20[_0xdda9('0x1a')];var _0x6693f;if(_0x1c46b9>=_0x1c0bbc){_0x1c46b9=_0x1c0bbc;_0x6693f=0xc8;}else{_0x6693f=0xce;}_0x15ee07[_0xdda9('0x16')](_0x6693f);return _0x15ee07[_0xdda9('0x1c')](_0xdda9('0x1d'),_0x2e8c4e+'-'+_0x1c46b9+'/'+_0x1c0bbc)['json'](_0x27899a);}return null;};}function patchUpdates(_0x214251){return function(_0x518f92){try{jsonpatch[_0xdda9('0x1e')](_0x518f92,_0x214251,!![]);}catch(_0x1f5711){return BPromise[_0xdda9('0x1f')](_0x1f5711);}return _0x518f92['save']();};}function saveUpdates(_0x537354,_0x2ec141){return function(_0x2c9048){if(_0x2c9048){return _0x2c9048[_0xdda9('0x20')](_0x537354)[_0xdda9('0x21')](function(_0x4f57be){return _0x4f57be;});}return null;};}function removeEntity(_0x3462ce,_0x402134){return function(_0x3ddb32){if(_0x3ddb32){return _0x3ddb32['destroy']()[_0xdda9('0x21')](function(){_0x3462ce[_0xdda9('0x16')](0xcc)[_0xdda9('0x15')]();});}};}function handleEntityNotFound(_0x454d1a,_0x2b67d4){return function(_0x1c2f3f){if(!_0x1c2f3f){_0x454d1a['sendStatus'](0x194);}return _0x1c2f3f;};}function handleError(_0x2d0b5b,_0x39b435){_0x39b435=_0x39b435||0x1f4;return function(_0x424215){logger[_0xdda9('0x22')](_0x424215[_0xdda9('0x23')]);if(_0x424215[_0xdda9('0x24')]){delete _0x424215[_0xdda9('0x24')];}_0x2d0b5b[_0xdda9('0x16')](_0x39b435)[_0xdda9('0x25')](_0x424215);};}exports[_0xdda9('0x26')]=function(_0x2278cd,_0x3a74de){var _0x20f525={},_0x1b5241={},_0x4d6be4={'count':0x0,'rows':[]};var _0x376a3d=_[_0xdda9('0x27')](db[_0xdda9('0x28')][_0xdda9('0x29')],function(_0x1f078f){return{'name':_0x1f078f[_0xdda9('0x2a')],'type':_0x1f078f['type']['key']};});_0x1b5241[_0xdda9('0x2b')]=_['map'](_0x376a3d,_0xdda9('0x24'));_0x1b5241[_0xdda9('0x2c')]=_['keys'](_0x2278cd['query']);_0x1b5241['filters']=_[_0xdda9('0x2d')](_0x1b5241['model'],_0x1b5241[_0xdda9('0x2c')]);_0x20f525['attributes']=_[_0xdda9('0x2d')](_0x1b5241[_0xdda9('0x2b')],qs[_0xdda9('0x2e')](_0x2278cd[_0xdda9('0x2c')]['fields']));_0x20f525[_0xdda9('0x2f')]=_0x20f525[_0xdda9('0x2f')][_0xdda9('0x30')]?_0x20f525[_0xdda9('0x2f')]:_0x1b5241[_0xdda9('0x2b')];if(!_0x2278cd[_0xdda9('0x2c')]['hasOwnProperty']('nolimit')){_0x20f525['limit']=qs[_0xdda9('0x1a')](_0x2278cd[_0xdda9('0x2c')][_0xdda9('0x1a')]);_0x20f525[_0xdda9('0x18')]=qs[_0xdda9('0x18')](_0x2278cd['query'][_0xdda9('0x18')]);}_0x20f525[_0xdda9('0x31')]=qs[_0xdda9('0x32')](_0x2278cd[_0xdda9('0x2c')][_0xdda9('0x32')]);_0x20f525['where']=qs[_0xdda9('0x33')](_[_0xdda9('0x34')](_0x2278cd[_0xdda9('0x2c')],_0x1b5241['filters']),_0x376a3d);if(_0x2278cd[_0xdda9('0x2c')][_0xdda9('0x35')]){_0x20f525[_0xdda9('0x36')]=_[_0xdda9('0x37')](_0x20f525[_0xdda9('0x36')],{'$or':_['map'](_0x376a3d,function(_0x1fd284){if(_0x1fd284[_0xdda9('0x38')]!==_0xdda9('0x39')){var _0x4d69e7={};_0x4d69e7[_0x1fd284[_0xdda9('0x24')]]={'$like':'%'+_0x2278cd['query'][_0xdda9('0x35')]+'%'};return _0x4d69e7;}})});}_0x20f525=_[_0xdda9('0x37')]({},_0x20f525,_0x2278cd['options']);var _0x5ab11d={'where':_0x20f525[_0xdda9('0x36')]};return db[_0xdda9('0x28')][_0xdda9('0x1b')](_0x5ab11d)[_0xdda9('0x21')](function(_0x5e5e58){_0x4d6be4[_0xdda9('0x1b')]=_0x5e5e58;if(_0x2278cd[_0xdda9('0x2c')][_0xdda9('0x3a')]){_0x20f525['include']=[{'all':!![]}];}return db[_0xdda9('0x28')][_0xdda9('0x3b')](_0x20f525);})[_0xdda9('0x21')](function(_0x12b355){_0x4d6be4['rows']=_0x12b355;return _0x4d6be4;})['then'](respondWithFilteredResult(_0x3a74de,_0x20f525))[_0xdda9('0x3c')](handleError(_0x3a74de,null));};exports['show']=function(_0x23eef8,_0xe698b1){var _0x422d2c={'raw':![],'where':{'id':_0x23eef8['params']['id']}},_0x1be4ad={};_0x1be4ad[_0xdda9('0x2b')]=_[_0xdda9('0x3d')](db['SalesforceConfiguration'][_0xdda9('0x29')]);_0x1be4ad[_0xdda9('0x2c')]=_['keys'](_0x23eef8[_0xdda9('0x2c')]);_0x1be4ad[_0xdda9('0x33')]=_[_0xdda9('0x2d')](_0x1be4ad[_0xdda9('0x2b')],_0x1be4ad[_0xdda9('0x2c')]);_0x422d2c['attributes']=_[_0xdda9('0x2d')](_0x1be4ad[_0xdda9('0x2b')],qs[_0xdda9('0x2e')](_0x23eef8[_0xdda9('0x2c')][_0xdda9('0x2e')]));_0x422d2c[_0xdda9('0x2f')]=_0x422d2c[_0xdda9('0x2f')][_0xdda9('0x30')]?_0x422d2c[_0xdda9('0x2f')]:_0x1be4ad[_0xdda9('0x2b')];if(_0x23eef8[_0xdda9('0x2c')][_0xdda9('0x3a')]){_0x422d2c[_0xdda9('0x3e')]=[{'all':!![]}];}_0x422d2c=_['merge']({},_0x422d2c,_0x23eef8[_0xdda9('0x3f')]);return db[_0xdda9('0x28')]['find'](_0x422d2c)[_0xdda9('0x21')](handleEntityNotFound(_0xe698b1,null))['then'](respondWithResult(_0xe698b1,null))[_0xdda9('0x3c')](handleError(_0xe698b1,null));};exports[_0xdda9('0x40')]=function(_0x45a9ee,_0x3fb3ca){return db[_0xdda9('0x28')][_0xdda9('0x40')](_0x45a9ee[_0xdda9('0x41')],{})[_0xdda9('0x21')](respondWithResult(_0x3fb3ca,0xc9))['catch'](handleError(_0x3fb3ca,null));};exports[_0xdda9('0x20')]=function(_0x2af911,_0x5b667f){if(_0x2af911[_0xdda9('0x41')]['id']){delete _0x2af911['body']['id'];}return db['SalesforceConfiguration'][_0xdda9('0x42')]({'where':{'id':_0x2af911[_0xdda9('0x43')]['id']}})[_0xdda9('0x21')](handleEntityNotFound(_0x5b667f,null))[_0xdda9('0x21')](saveUpdates(_0x2af911[_0xdda9('0x41')],null))[_0xdda9('0x21')](respondWithResult(_0x5b667f,null))[_0xdda9('0x3c')](handleError(_0x5b667f,null));};exports[_0xdda9('0x44')]=function(_0x4eabd3,_0x2e745e){return db['SalesforceConfiguration'][_0xdda9('0x42')]({'where':{'id':_0x4eabd3['params']['id']}})[_0xdda9('0x21')](handleEntityNotFound(_0x2e745e,null))[_0xdda9('0x21')](removeEntity(_0x2e745e,null))['catch'](handleError(_0x2e745e,null));};exports[_0xdda9('0x45')]=function(_0x1f6af1,_0x5d3713,_0x47fa33){var _0x3d1813={};var _0x417e8e={};var _0x4b971b;var _0x2659a1;return db[_0xdda9('0x28')]['findOne']({'where':{'id':_0x1f6af1[_0xdda9('0x43')]['id']}})[_0xdda9('0x21')](handleEntityNotFound(_0x5d3713,null))[_0xdda9('0x21')](function(_0x32e808){if(_0x32e808){_0x4b971b=_0x32e808;_0x417e8e['model']=_[_0xdda9('0x3d')](db[_0xdda9('0x46')][_0xdda9('0x29')]);_0x417e8e[_0xdda9('0x2c')]=_['keys'](_0x1f6af1[_0xdda9('0x2c')]);_0x417e8e[_0xdda9('0x33')]=_[_0xdda9('0x2d')](_0x417e8e['model'],_0x417e8e[_0xdda9('0x2c')]);_0x3d1813[_0xdda9('0x2f')]=_[_0xdda9('0x2d')](_0x417e8e[_0xdda9('0x2b')],qs[_0xdda9('0x2e')](_0x1f6af1[_0xdda9('0x2c')][_0xdda9('0x2e')]));_0x3d1813['attributes']=_0x3d1813[_0xdda9('0x2f')][_0xdda9('0x30')]?_0x3d1813[_0xdda9('0x2f')]:_0x417e8e[_0xdda9('0x2b')];_0x3d1813[_0xdda9('0x31')]=qs[_0xdda9('0x32')](_0x1f6af1['query'][_0xdda9('0x32')]);_0x3d1813[_0xdda9('0x36')]=qs['filters'](_[_0xdda9('0x34')](_0x1f6af1[_0xdda9('0x2c')],_0x417e8e['filters']));if(_0x1f6af1['query'][_0xdda9('0x35')]){_0x3d1813[_0xdda9('0x36')]=_[_0xdda9('0x37')](_0x3d1813[_0xdda9('0x36')],{'$or':_['map'](_0x3d1813['attributes'],function(_0xf18ee7){var _0x18d3ae={};_0x18d3ae[_0xf18ee7]={'$like':'%'+_0x1f6af1[_0xdda9('0x2c')][_0xdda9('0x35')]+'%'};return _0x18d3ae;})});}_0x3d1813=_['merge']({},_0x3d1813,_0x1f6af1[_0xdda9('0x3f')]);return _0x4b971b[_0xdda9('0x45')](_0x3d1813);}})['then'](function(_0x432dd5){if(_0x432dd5){_0x2659a1=_0x432dd5[_0xdda9('0x30')];if(!_0x1f6af1[_0xdda9('0x2c')][_0xdda9('0x47')](_0xdda9('0x48'))){_0x3d1813['limit']=qs[_0xdda9('0x1a')](_0x1f6af1[_0xdda9('0x2c')][_0xdda9('0x1a')]);_0x3d1813[_0xdda9('0x18')]=qs[_0xdda9('0x18')](_0x1f6af1['query'][_0xdda9('0x18')]);}return _0x4b971b[_0xdda9('0x45')](_0x3d1813);}})[_0xdda9('0x21')](function(_0x3b83c4){if(_0x3b83c4){return _0x3b83c4?{'count':_0x2659a1,'rows':_0x3b83c4}:null;}})[_0xdda9('0x21')](respondWithResult(_0x5d3713,null))[_0xdda9('0x3c')](handleError(_0x5d3713,null));};exports[_0xdda9('0x49')]=function(_0xb05775,_0x4be8b4,_0x1e1f9a){var _0x4662a9={};var _0x10ca09={};var _0x48d504;var _0x4e374f;return db[_0xdda9('0x28')][_0xdda9('0x4a')]({'where':{'id':_0xb05775[_0xdda9('0x43')]['id']}})[_0xdda9('0x21')](handleEntityNotFound(_0x4be8b4,null))[_0xdda9('0x21')](function(_0x59384b){if(_0x59384b){_0x48d504=_0x59384b;_0x10ca09[_0xdda9('0x2b')]=_[_0xdda9('0x3d')](db['SalesforceField']['rawAttributes']);_0x10ca09[_0xdda9('0x2c')]=_['keys'](_0xb05775[_0xdda9('0x2c')]);_0x10ca09[_0xdda9('0x33')]=_['intersection'](_0x10ca09['model'],_0x10ca09[_0xdda9('0x2c')]);_0x4662a9[_0xdda9('0x2f')]=_[_0xdda9('0x2d')](_0x10ca09[_0xdda9('0x2b')],qs['fields'](_0xb05775['query'][_0xdda9('0x2e')]));_0x4662a9['attributes']=_0x4662a9[_0xdda9('0x2f')][_0xdda9('0x30')]?_0x4662a9['attributes']:_0x10ca09[_0xdda9('0x2b')];_0x4662a9[_0xdda9('0x31')]=qs[_0xdda9('0x32')](_0xb05775[_0xdda9('0x2c')]['sort']);_0x4662a9[_0xdda9('0x36')]=qs[_0xdda9('0x33')](_[_0xdda9('0x34')](_0xb05775[_0xdda9('0x2c')],_0x10ca09[_0xdda9('0x33')]));if(_0xb05775['query']['filter']){_0x4662a9[_0xdda9('0x36')]=_[_0xdda9('0x37')](_0x4662a9['where'],{'$or':_['map'](_0x4662a9[_0xdda9('0x2f')],function(_0x2c5788){var _0x1dbad1={};_0x1dbad1[_0x2c5788]={'$like':'%'+_0xb05775[_0xdda9('0x2c')]['filter']+'%'};return _0x1dbad1;})});}_0x4662a9=_[_0xdda9('0x37')]({},_0x4662a9,_0xb05775[_0xdda9('0x3f')]);return _0x48d504[_0xdda9('0x49')](_0x4662a9);}})[_0xdda9('0x21')](function(_0x54b364){if(_0x54b364){_0x4e374f=_0x54b364[_0xdda9('0x30')];if(!_0xb05775[_0xdda9('0x2c')][_0xdda9('0x47')](_0xdda9('0x48'))){_0x4662a9[_0xdda9('0x1a')]=qs[_0xdda9('0x1a')](_0xb05775[_0xdda9('0x2c')][_0xdda9('0x1a')]);_0x4662a9[_0xdda9('0x18')]=qs[_0xdda9('0x18')](_0xb05775[_0xdda9('0x2c')][_0xdda9('0x18')]);}return _0x48d504[_0xdda9('0x49')](_0x4662a9);}})[_0xdda9('0x21')](function(_0x579154){if(_0x579154){return _0x579154?{'count':_0x4e374f,'rows':_0x579154}:null;}})['then'](respondWithResult(_0x4be8b4,null))[_0xdda9('0x3c')](handleError(_0x4be8b4,null));};exports[_0xdda9('0x4b')]=function(_0x1f0c1e,_0xbd5d05,_0x5e91f5){var _0x39c1ed={};var _0x36fa09={};var _0x1627a2;var _0xd6b3d;return db[_0xdda9('0x28')]['findOne']({'where':{'id':_0x1f0c1e[_0xdda9('0x43')]['id']}})[_0xdda9('0x21')](handleEntityNotFound(_0xbd5d05,null))['then'](function(_0x37009c){if(_0x37009c){_0x1627a2=_0x37009c;_0x36fa09[_0xdda9('0x2b')]=_[_0xdda9('0x3d')](db[_0xdda9('0x46')][_0xdda9('0x29')]);_0x36fa09['query']=_[_0xdda9('0x3d')](_0x1f0c1e[_0xdda9('0x2c')]);_0x36fa09[_0xdda9('0x33')]=_[_0xdda9('0x2d')](_0x36fa09[_0xdda9('0x2b')],_0x36fa09[_0xdda9('0x2c')]);_0x39c1ed['attributes']=_['intersection'](_0x36fa09['model'],qs[_0xdda9('0x2e')](_0x1f0c1e['query']['fields']));_0x39c1ed[_0xdda9('0x2f')]=_0x39c1ed[_0xdda9('0x2f')][_0xdda9('0x30')]?_0x39c1ed[_0xdda9('0x2f')]:_0x36fa09['model'];_0x39c1ed[_0xdda9('0x31')]=qs['sort'](_0x1f0c1e[_0xdda9('0x2c')][_0xdda9('0x32')]);_0x39c1ed[_0xdda9('0x36')]=qs[_0xdda9('0x33')](_[_0xdda9('0x34')](_0x1f0c1e[_0xdda9('0x2c')],_0x36fa09[_0xdda9('0x33')]));if(_0x1f0c1e[_0xdda9('0x2c')][_0xdda9('0x35')]){_0x39c1ed[_0xdda9('0x36')]=_['merge'](_0x39c1ed[_0xdda9('0x36')],{'$or':_['map'](_0x39c1ed['attributes'],function(_0x1f80ab){var _0x322413={};_0x322413[_0x1f80ab]={'$like':'%'+_0x1f0c1e[_0xdda9('0x2c')][_0xdda9('0x35')]+'%'};return _0x322413;})});}_0x39c1ed=_[_0xdda9('0x37')]({},_0x39c1ed,_0x1f0c1e[_0xdda9('0x3f')]);return _0x1627a2[_0xdda9('0x4b')](_0x39c1ed);}})['then'](function(_0x2018b3){if(_0x2018b3){_0xd6b3d=_0x2018b3['length'];if(!_0x1f0c1e[_0xdda9('0x2c')][_0xdda9('0x47')](_0xdda9('0x48'))){_0x39c1ed[_0xdda9('0x1a')]=qs[_0xdda9('0x1a')](_0x1f0c1e['query'][_0xdda9('0x1a')]);_0x39c1ed['offset']=qs[_0xdda9('0x18')](_0x1f0c1e['query'][_0xdda9('0x18')]);}return _0x1627a2[_0xdda9('0x4b')](_0x39c1ed);}})[_0xdda9('0x21')](function(_0x335917){if(_0x335917){return _0x335917?{'count':_0xd6b3d,'rows':_0x335917}:null;}})[_0xdda9('0x21')](respondWithResult(_0xbd5d05,null))['catch'](handleError(_0xbd5d05,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 51717b1..875ed64 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 _0x2472=['define','SalesforceConfiguration','lodash','../../config/logger','api','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0x2472,0x188));var _0x2247=function(_0x282c17,_0x99a901){_0x282c17=_0x282c17-0x0;var _0x543428=_0x2472[_0x282c17];return _0x543428;};'use strict';var _=require(_0x2247('0x0'));var util=require('util');var logger=require(_0x2247('0x1'))(_0x2247('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2247('0x3'));var fs=require('fs');var path=require(_0x2247('0x4'));var rimraf=require(_0x2247('0x5'));var config=require('../../config/environment');var attributes=require(_0x2247('0x6'));module[_0x2247('0x7')]=function(_0x19c61c,_0x3a93ff){return _0x19c61c[_0x2247('0x8')](_0x2247('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x367d=['request-promise','path','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger'];(function(_0x525513,_0x44220c){var _0x17f77f=function(_0x28473e){while(--_0x28473e){_0x525513['push'](_0x525513['shift']());}};_0x17f77f(++_0x44220c);}(_0x367d,0x10c));var _0xd367=function(_0x172eea,_0x39d881){_0x172eea=_0x172eea-0x0;var _0x436a19=_0x367d[_0x172eea];return _0x436a19;};'use strict';var _=require('lodash');var util=require(_0xd367('0x0'));var logger=require(_0xd367('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd367('0x2'));var fs=require('fs');var path=require(_0xd367('0x3'));var rimraf=require('rimraf');var config=require(_0xd367('0x4'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd367('0x5')]=function(_0x4cb56b,_0xc97682){return _0x4cb56b[_0xd367('0x6')](_0xd367('0x7'),attributes,{'tableName':_0xd367('0x8'),'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 1df168c..de558c7 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 _0xe3e3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xe3e3,0x1b2));var _0x3e3e=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe3e3[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x3e3e('0x0'));var util=require(_0x3e3e('0x1'));var moment=require(_0x3e3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e3e('0x3'));var fs=require('fs');var Redis=require(_0x3e3e('0x4'));var db=require(_0x3e3e('0x5'))['db'];var utils=require(_0x3e3e('0x6'));var logger=require(_0x3e3e('0x7'))('rpc');var config=require(_0x3e3e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6d267a,_0x48bcc1,_0x73c273){return new BPromise(function(_0x3606fe,_0x3d1f31){return client[_0x3e3e('0xa')](_0x6d267a,_0x73c273)[_0x3e3e('0xb')](function(_0x11ec49){logger['info'](_0x3e3e('0xc'),_0x48bcc1,_0x3e3e('0xd'));logger[_0x3e3e('0xe')](_0x3e3e('0xf'),_0x48bcc1,_0x3e3e('0xd'),JSON[_0x3e3e('0x10')](_0x11ec49));if(_0x11ec49[_0x3e3e('0x11')]){if(_0x11ec49['error'][_0x3e3e('0x12')]===0x1f4){logger[_0x3e3e('0x11')](_0x3e3e('0xc'),_0x48bcc1,_0x11ec49[_0x3e3e('0x11')][_0x3e3e('0x13')]);return _0x3d1f31(_0x11ec49[_0x3e3e('0x11')][_0x3e3e('0x13')]);}logger[_0x3e3e('0x11')](_0x3e3e('0xc'),_0x48bcc1,_0x11ec49['error']['message']);return _0x3606fe(_0x11ec49[_0x3e3e('0x11')][_0x3e3e('0x13')]);}else{logger[_0x3e3e('0x14')](_0x3e3e('0xc'),_0x48bcc1,_0x3e3e('0xd'));_0x3606fe(_0x11ec49[_0x3e3e('0x15')]['message']);}})[_0x3e3e('0x16')](function(_0x302692){logger[_0x3e3e('0x11')](_0x3e3e('0xc'),_0x48bcc1,_0x302692);_0x3d1f31(_0x302692);});});} \ No newline at end of file +var _0x6d2f=['error','message','info','lodash','util','bluebird','randomstring','ioredis','../../config/logger','client','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ac7ca,_0x5efe6f){var _0x271386=function(_0x50aa36){while(--_0x50aa36){_0x3ac7ca['push'](_0x3ac7ca['shift']());}};_0x271386(++_0x5efe6f);}(_0x6d2f,0x7b));var _0xf6d2=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0x6d2f[_0xdefbc3];return _0x367798;};'use strict';var _=require(_0xf6d2('0x0'));var util=require(_0xf6d2('0x1'));var moment=require('moment');var BPromise=require(_0xf6d2('0x2'));var rs=require(_0xf6d2('0x3'));var fs=require('fs');var Redis=require(_0xf6d2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6d2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6d2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3c45,_0x184a5f,_0x48e279){return new BPromise(function(_0x53073a,_0x4f3155){return client[_0xf6d2('0x7')](_0x2a3c45,_0x48e279)['then'](function(_0x160c5a){logger['info'](_0xf6d2('0x8'),_0x184a5f,_0xf6d2('0x9'));logger['debug'](_0xf6d2('0xa'),_0x184a5f,_0xf6d2('0x9'),JSON[_0xf6d2('0xb')](_0x160c5a));if(_0x160c5a[_0xf6d2('0xc')]){if(_0x160c5a[_0xf6d2('0xc')]['code']===0x1f4){logger[_0xf6d2('0xc')](_0xf6d2('0x8'),_0x184a5f,_0x160c5a['error'][_0xf6d2('0xd')]);return _0x4f3155(_0x160c5a['error'][_0xf6d2('0xd')]);}logger['error'](_0xf6d2('0x8'),_0x184a5f,_0x160c5a['error'][_0xf6d2('0xd')]);return _0x53073a(_0x160c5a[_0xf6d2('0xc')]['message']);}else{logger[_0xf6d2('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x184a5f,'request\x20sent');_0x53073a(_0x160c5a['result'][_0xf6d2('0xd')]);}})['catch'](function(_0x19dffb){logger[_0xf6d2('0xc')](_0xf6d2('0x8'),_0x184a5f,_0x19dffb);_0x4f3155(_0x19dffb);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b39eaff..4826ab9 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 _0x6449=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0xd92e0f,_0x4c28de){var _0x408a33=function(_0x35be94){while(--_0x35be94){_0xd92e0f['push'](_0xd92e0f['shift']());}};_0x408a33(++_0x4c28de);}(_0x6449,0x12a));var _0x9644=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x6449[_0x28611e];return _0x530f69;};'use strict';var multer=require(_0x9644('0x0'));var util=require(_0x9644('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9644('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9644('0x3'));var interaction=require(_0x9644('0x4'));var config=require(_0x9644('0x5'));var controller=require(_0x9644('0x6'));router[_0x9644('0x7')]('/',auth[_0x9644('0x8')](),controller[_0x9644('0x9')]);router[_0x9644('0x7')](_0x9644('0xa'),auth[_0x9644('0x8')](),controller[_0x9644('0xb')]);router[_0x9644('0xc')]('/',auth[_0x9644('0x8')](),controller[_0x9644('0xd')]);router[_0x9644('0xe')](_0x9644('0xa'),auth[_0x9644('0x8')](),controller['update']);router[_0x9644('0xf')](_0x9644('0xa'),auth['isAuthenticated'](),controller[_0x9644('0x10')]);module[_0x9644('0x11')]=router; \ No newline at end of file +var _0x63dc=['isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x314e49,_0x184744){var _0x52944d=function(_0x30d3d1){while(--_0x30d3d1){_0x314e49['push'](_0x314e49['shift']());}};_0x52944d(++_0x184744);}(_0x63dc,0x1d1));var _0xc63d=function(_0x1a451b,_0x20c9c4){_0x1a451b=_0x1a451b-0x0;var _0x52a42b=_0x63dc[_0x1a451b];return _0x52a42b;};'use strict';var multer=require(_0xc63d('0x0'));var util=require(_0xc63d('0x1'));var path=require(_0xc63d('0x2'));var timeout=require('connect-timeout');var express=require(_0xc63d('0x3'));var router=express[_0xc63d('0x4')]();var fs_extra=require(_0xc63d('0x5'));var auth=require(_0xc63d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc63d('0x7'));var controller=require(_0xc63d('0x8'));router[_0xc63d('0x9')]('/',auth[_0xc63d('0xa')](),controller['index']);router[_0xc63d('0x9')](_0xc63d('0xb'),auth['isAuthenticated'](),controller[_0xc63d('0xc')]);router[_0xc63d('0xd')]('/',auth[_0xc63d('0xa')](),controller[_0xc63d('0xe')]);router['put'](_0xc63d('0xb'),auth[_0xc63d('0xa')](),controller[_0xc63d('0xf')]);router[_0xc63d('0x10')](_0xc63d('0xb'),auth['isAuthenticated'](),controller[_0xc63d('0x11')]);module[_0xc63d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c48bf92..e714111 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 _0x802b=['ENUM','sequelize','exports','string','variable','customVariable','picklist','STRING'];(function(_0x37ad0c,_0xff328d){var _0x148e24=function(_0x4830d3){while(--_0x4830d3){_0x37ad0c['push'](_0x37ad0c['shift']());}};_0x148e24(++_0xff328d);}(_0x802b,0x1b9));var _0xb802=function(_0x3f5d5c,_0xefb026){_0x3f5d5c=_0x3f5d5c-0x0;var _0x27155c=_0x802b[_0x3f5d5c];return _0x27155c;};'use strict';var Sequelize=require(_0xb802('0x0'));module[_0xb802('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb802('0x2'),_0xb802('0x3'),_0xb802('0x4'),'keyValue',_0xb802('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb802('0x6')]},'key':{'type':Sequelize[_0xb802('0x6')]},'keyType':{'type':Sequelize[_0xb802('0x7')]('string',_0xb802('0x3'),_0xb802('0x4'))},'keyContent':{'type':Sequelize[_0xb802('0x6')]},'idField':{'type':Sequelize[_0xb802('0x6')]},'variableName':{'type':Sequelize[_0xb802('0x6')]}}; \ No newline at end of file +var _0x9246=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x12245d,_0x1074cc){var _0x16d4c8=function(_0x145ec3){while(--_0x145ec3){_0x12245d['push'](_0x12245d['shift']());}};_0x16d4c8(++_0x1074cc);}(_0x9246,0x1c0));var _0x6924=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x9246[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0x6924('0x0'));module['exports']={'type':{'type':Sequelize[_0x6924('0x1')](_0x6924('0x2'),_0x6924('0x3'),_0x6924('0x4'),_0x6924('0x5'),_0x6924('0x6')),'defaultValue':_0x6924('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6924('0x7')]},'keyType':{'type':Sequelize[_0x6924('0x1')]('string',_0x6924('0x3'),_0x6924('0x4'))},'keyContent':{'type':Sequelize[_0x6924('0x7')]},'idField':{'type':Sequelize[_0x6924('0x7')]},'variableName':{'type':Sequelize[_0x6924('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 1b64189..b41a257 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 _0x38d8=['SalesforceField','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','sendStatus','error','name','send','index','map'];(function(_0x44f91e,_0x47e2eb){var _0x33a0bd=function(_0x6e7327){while(--_0x6e7327){_0x44f91e['push'](_0x44f91e['shift']());}};_0x33a0bd(++_0x47e2eb);}(_0x38d8,0xb9));var _0x838d=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x38d8[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0x838d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x838d('0x1'));var rp=require(_0x838d('0x2'));var moment=require(_0x838d('0x3'));var BPromise=require(_0x838d('0x4'));var Mustache=require(_0x838d('0x5'));var util=require(_0x838d('0x6'));var path=require(_0x838d('0x7'));var sox=require(_0x838d('0x8'));var csv=require(_0x838d('0x9'));var ejs=require(_0x838d('0xa'));var fs=require('fs');var fs_extra=require(_0x838d('0xb'));var _=require(_0x838d('0xc'));var squel=require(_0x838d('0xd'));var crypto=require(_0x838d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x838d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x838d('0x10'));var Papa=require(_0x838d('0x11'));var Redis=require('ioredis');var authService=require(_0x838d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x838d('0x13'));var hardwareService=require(_0x838d('0x14'));var logger=require(_0x838d('0x15'))(_0x838d('0x16'));var utils=require(_0x838d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x838d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29017f,_0x5e9dc2){_0x5e9dc2=_0x5e9dc2||0xcc;return function(_0x5962d0){if(_0x5962d0){return _0x29017f['sendStatus'](_0x5e9dc2);}return _0x29017f[_0x838d('0x19')](_0x5e9dc2)[_0x838d('0x1a')]();};}function respondWithResult(_0x208252,_0x4f3992){_0x4f3992=_0x4f3992||0xc8;return function(_0x177c0a){if(_0x177c0a){return _0x208252[_0x838d('0x19')](_0x4f3992)[_0x838d('0x1b')](_0x177c0a);}};}function respondWithFilteredResult(_0x353cfd,_0xeecdaf){return function(_0x571f8a){if(_0x571f8a){var _0x427184=typeof _0xeecdaf[_0x838d('0x1c')]===_0x838d('0x1d')&&typeof _0xeecdaf[_0x838d('0x1e')]===_0x838d('0x1d');var _0x583178=_0x571f8a['count'];var _0x47975c=_0x427184?0x0:_0xeecdaf[_0x838d('0x1c')];var _0x5a87e5=_0x427184?_0x571f8a[_0x838d('0x1f')]:_0xeecdaf[_0x838d('0x1c')]+_0xeecdaf[_0x838d('0x1e')];var _0x156429;if(_0x5a87e5>=_0x583178){_0x5a87e5=_0x583178;_0x156429=0xc8;}else{_0x156429=0xce;}_0x353cfd['status'](_0x156429);return _0x353cfd['set'](_0x838d('0x20'),_0x47975c+'-'+_0x5a87e5+'/'+_0x583178)[_0x838d('0x1b')](_0x571f8a);}return null;};}function patchUpdates(_0x262a72){return function(_0x5e6113){try{jsonpatch[_0x838d('0x21')](_0x5e6113,_0x262a72,!![]);}catch(_0xfcac35){return BPromise[_0x838d('0x22')](_0xfcac35);}return _0x5e6113[_0x838d('0x23')]();};}function saveUpdates(_0x3c8925,_0x40b9a7){return function(_0x94be6c){if(_0x94be6c){return _0x94be6c[_0x838d('0x24')](_0x3c8925)['then'](function(_0x2a4d9c){return _0x2a4d9c;});}return null;};}function removeEntity(_0x4d7b5d,_0x57adbc){return function(_0x53b327){if(_0x53b327){return _0x53b327['destroy']()['then'](function(){_0x4d7b5d[_0x838d('0x19')](0xcc)[_0x838d('0x1a')]();});}};}function handleEntityNotFound(_0x23336e,_0x3380cb){return function(_0x5ca543){if(!_0x5ca543){_0x23336e[_0x838d('0x25')](0x194);}return _0x5ca543;};}function handleError(_0xad20c,_0x24c0a9){_0x24c0a9=_0x24c0a9||0x1f4;return function(_0x570b90){logger[_0x838d('0x26')](_0x570b90['stack']);if(_0x570b90[_0x838d('0x27')]){delete _0x570b90[_0x838d('0x27')];}_0xad20c[_0x838d('0x19')](_0x24c0a9)[_0x838d('0x28')](_0x570b90);};}exports[_0x838d('0x29')]=function(_0x2d311f,_0x5a5bcc){var _0x1cb83f={},_0x2fe556={},_0x5d1263={'count':0x0,'rows':[]};var _0xc97a3d=_[_0x838d('0x2a')](db[_0x838d('0x2b')][_0x838d('0x2c')],function(_0x5bc396){return{'name':_0x5bc396['fieldName'],'type':_0x5bc396[_0x838d('0x2d')][_0x838d('0x2e')]};});_0x2fe556[_0x838d('0x2f')]=_['map'](_0xc97a3d,_0x838d('0x27'));_0x2fe556[_0x838d('0x30')]=_[_0x838d('0x31')](_0x2d311f[_0x838d('0x30')]);_0x2fe556['filters']=_['intersection'](_0x2fe556['model'],_0x2fe556[_0x838d('0x30')]);_0x1cb83f[_0x838d('0x32')]=_[_0x838d('0x33')](_0x2fe556['model'],qs['fields'](_0x2d311f[_0x838d('0x30')][_0x838d('0x34')]));_0x1cb83f['attributes']=_0x1cb83f[_0x838d('0x32')][_0x838d('0x35')]?_0x1cb83f[_0x838d('0x32')]:_0x2fe556[_0x838d('0x2f')];if(!_0x2d311f['query'][_0x838d('0x36')](_0x838d('0x37'))){_0x1cb83f[_0x838d('0x1e')]=qs[_0x838d('0x1e')](_0x2d311f[_0x838d('0x30')]['limit']);_0x1cb83f[_0x838d('0x1c')]=qs[_0x838d('0x1c')](_0x2d311f[_0x838d('0x30')][_0x838d('0x1c')]);}_0x1cb83f[_0x838d('0x38')]=qs[_0x838d('0x39')](_0x2d311f[_0x838d('0x30')][_0x838d('0x39')]);_0x1cb83f['where']=qs[_0x838d('0x3a')](_['pick'](_0x2d311f[_0x838d('0x30')],_0x2fe556[_0x838d('0x3a')]),_0xc97a3d);if(_0x2d311f['query'][_0x838d('0x3b')]){_0x1cb83f[_0x838d('0x3c')]=_[_0x838d('0x3d')](_0x1cb83f[_0x838d('0x3c')],{'$or':_['map'](_0xc97a3d,function(_0x50fdbb){if(_0x50fdbb[_0x838d('0x2d')]!==_0x838d('0x3e')){var _0x1e58cf={};_0x1e58cf[_0x50fdbb['name']]={'$like':'%'+_0x2d311f['query']['filter']+'%'};return _0x1e58cf;}})});}_0x1cb83f=_[_0x838d('0x3d')]({},_0x1cb83f,_0x2d311f['options']);var _0xa1188={'where':_0x1cb83f[_0x838d('0x3c')]};return db[_0x838d('0x2b')][_0x838d('0x1f')](_0xa1188)[_0x838d('0x3f')](function(_0x5a2353){_0x5d1263[_0x838d('0x1f')]=_0x5a2353;if(_0x2d311f[_0x838d('0x30')][_0x838d('0x40')]){_0x1cb83f[_0x838d('0x41')]=[{'all':!![]}];}return db[_0x838d('0x2b')][_0x838d('0x42')](_0x1cb83f);})['then'](function(_0x417da8){_0x5d1263[_0x838d('0x43')]=_0x417da8;return _0x5d1263;})[_0x838d('0x3f')](respondWithFilteredResult(_0x5a5bcc,_0x1cb83f))['catch'](handleError(_0x5a5bcc,null));};exports[_0x838d('0x44')]=function(_0x1dbc38,_0x27341d){var _0x4fbb67={'raw':!![],'where':{'id':_0x1dbc38[_0x838d('0x45')]['id']}},_0x223c4f={};_0x223c4f[_0x838d('0x2f')]=_[_0x838d('0x31')](db[_0x838d('0x2b')][_0x838d('0x2c')]);_0x223c4f[_0x838d('0x30')]=_[_0x838d('0x31')](_0x1dbc38[_0x838d('0x30')]);_0x223c4f[_0x838d('0x3a')]=_[_0x838d('0x33')](_0x223c4f[_0x838d('0x2f')],_0x223c4f[_0x838d('0x30')]);_0x4fbb67[_0x838d('0x32')]=_[_0x838d('0x33')](_0x223c4f['model'],qs[_0x838d('0x34')](_0x1dbc38[_0x838d('0x30')][_0x838d('0x34')]));_0x4fbb67['attributes']=_0x4fbb67[_0x838d('0x32')]['length']?_0x4fbb67[_0x838d('0x32')]:_0x223c4f[_0x838d('0x2f')];if(_0x1dbc38[_0x838d('0x30')]['includeAll']){_0x4fbb67[_0x838d('0x41')]=[{'all':!![]}];}_0x4fbb67=_[_0x838d('0x3d')]({},_0x4fbb67,_0x1dbc38[_0x838d('0x46')]);return db[_0x838d('0x2b')][_0x838d('0x47')](_0x4fbb67)[_0x838d('0x3f')](handleEntityNotFound(_0x27341d,null))[_0x838d('0x3f')](respondWithResult(_0x27341d,null))[_0x838d('0x48')](handleError(_0x27341d,null));};exports[_0x838d('0x49')]=function(_0x5b7835,_0x98200a){return db['SalesforceField']['create'](_0x5b7835[_0x838d('0x4a')],{})[_0x838d('0x3f')](respondWithResult(_0x98200a,0xc9))[_0x838d('0x48')](handleError(_0x98200a,null));};exports[_0x838d('0x24')]=function(_0x2c59fd,_0x23ecc4){if(_0x2c59fd['body']['id']){delete _0x2c59fd[_0x838d('0x4a')]['id'];}return db[_0x838d('0x2b')]['find']({'where':{'id':_0x2c59fd[_0x838d('0x45')]['id']}})[_0x838d('0x3f')](handleEntityNotFound(_0x23ecc4,null))[_0x838d('0x3f')](saveUpdates(_0x2c59fd[_0x838d('0x4a')],null))[_0x838d('0x3f')](respondWithResult(_0x23ecc4,null))[_0x838d('0x48')](handleError(_0x23ecc4,null));};exports[_0x838d('0x4b')]=function(_0x428d60,_0xddfe60){return db[_0x838d('0x2b')][_0x838d('0x47')]({'where':{'id':_0x428d60[_0x838d('0x45')]['id']}})[_0x838d('0x3f')](handleEntityNotFound(_0xddfe60,null))[_0x838d('0x3f')](removeEntity(_0xddfe60,null))['catch'](handleError(_0xddfe60,null));}; \ No newline at end of file +var _0x7f23=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','index','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','nolimit','where','filter','merge','map','VIRTUAL','options','SalesforceField','includeAll','findAll','rows','params','fields','find','catch','create','body','eml-format','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'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x7f23,0x153));var _0x37f2=function(_0x4a74e2,_0x1bda12){_0x4a74e2=_0x4a74e2-0x0;var _0x4bfb6a=_0x7f23[_0x4a74e2];return _0x4bfb6a;};'use strict';var emlformat=require(_0x37f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x37f2('0x1'));var jsonpatch=require(_0x37f2('0x2'));var rp=require(_0x37f2('0x3'));var moment=require(_0x37f2('0x4'));var BPromise=require(_0x37f2('0x5'));var Mustache=require(_0x37f2('0x6'));var util=require(_0x37f2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x37f2('0x8'));var ejs=require(_0x37f2('0x9'));var fs=require('fs');var fs_extra=require(_0x37f2('0xa'));var _=require(_0x37f2('0xb'));var squel=require(_0x37f2('0xc'));var crypto=require(_0x37f2('0xd'));var jsforce=require(_0x37f2('0xe'));var deskjs=require(_0x37f2('0xf'));var toCsv=require(_0x37f2('0x8'));var querystring=require(_0x37f2('0x10'));var Papa=require(_0x37f2('0x11'));var Redis=require(_0x37f2('0x12'));var authService=require(_0x37f2('0x13'));var qs=require(_0x37f2('0x14'));var as=require(_0x37f2('0x15'));var hardwareService=require(_0x37f2('0x16'));var logger=require('../../config/logger')(_0x37f2('0x17'));var utils=require(_0x37f2('0x18'));var config=require(_0x37f2('0x19'));var licenseUtil=require(_0x37f2('0x1a'));var db=require(_0x37f2('0x1b'))['db'];function respondWithStatusCode(_0x1b65ec,_0x5a228e){_0x5a228e=_0x5a228e||0xcc;return function(_0x28b461){if(_0x28b461){return _0x1b65ec['sendStatus'](_0x5a228e);}return _0x1b65ec[_0x37f2('0x1c')](_0x5a228e)[_0x37f2('0x1d')]();};}function respondWithResult(_0x2977d0,_0x301210){_0x301210=_0x301210||0xc8;return function(_0x2fa174){if(_0x2fa174){return _0x2977d0[_0x37f2('0x1c')](_0x301210)[_0x37f2('0x1e')](_0x2fa174);}};}function respondWithFilteredResult(_0x537a66,_0x38a401){return function(_0x178834){if(_0x178834){var _0x46b667=typeof _0x38a401[_0x37f2('0x1f')]===_0x37f2('0x20')&&typeof _0x38a401['limit']==='undefined';var _0x25528f=_0x178834[_0x37f2('0x21')];var _0x4a29b7=_0x46b667?0x0:_0x38a401['offset'];var _0x390384=_0x46b667?_0x178834[_0x37f2('0x21')]:_0x38a401['offset']+_0x38a401[_0x37f2('0x22')];var _0x4cf316;if(_0x390384>=_0x25528f){_0x390384=_0x25528f;_0x4cf316=0xc8;}else{_0x4cf316=0xce;}_0x537a66['status'](_0x4cf316);return _0x537a66[_0x37f2('0x23')](_0x37f2('0x24'),_0x4a29b7+'-'+_0x390384+'/'+_0x25528f)[_0x37f2('0x1e')](_0x178834);}return null;};}function patchUpdates(_0x159ec4){return function(_0x232a8e){try{jsonpatch[_0x37f2('0x25')](_0x232a8e,_0x159ec4,!![]);}catch(_0xebed21){return BPromise[_0x37f2('0x26')](_0xebed21);}return _0x232a8e['save']();};}function saveUpdates(_0xc80026,_0x46b828){return function(_0x36e7ba){if(_0x36e7ba){return _0x36e7ba[_0x37f2('0x27')](_0xc80026)[_0x37f2('0x28')](function(_0x472bb5){return _0x472bb5;});}return null;};}function removeEntity(_0x3f8af2,_0x691029){return function(_0x1c3ab3){if(_0x1c3ab3){return _0x1c3ab3['destroy']()['then'](function(){_0x3f8af2[_0x37f2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x386809,_0x515149){return function(_0x9ed98c){if(!_0x9ed98c){_0x386809[_0x37f2('0x29')](0x194);}return _0x9ed98c;};}function handleError(_0x2997db,_0x117257){_0x117257=_0x117257||0x1f4;return function(_0x30f758){logger['error'](_0x30f758[_0x37f2('0x2a')]);if(_0x30f758[_0x37f2('0x2b')]){delete _0x30f758[_0x37f2('0x2b')];}_0x2997db[_0x37f2('0x1c')](_0x117257)[_0x37f2('0x2c')](_0x30f758);};}exports[_0x37f2('0x2d')]=function(_0x39ff4c,_0x5000cd){var _0x528841={},_0x4424d2={},_0xc4fd66={'count':0x0,'rows':[]};var _0x32ee08=_['map'](db['SalesforceField'][_0x37f2('0x2e')],function(_0x5e3042){return{'name':_0x5e3042['fieldName'],'type':_0x5e3042[_0x37f2('0x2f')]['key']};});_0x4424d2[_0x37f2('0x30')]=_['map'](_0x32ee08,_0x37f2('0x2b'));_0x4424d2[_0x37f2('0x31')]=_[_0x37f2('0x32')](_0x39ff4c[_0x37f2('0x31')]);_0x4424d2[_0x37f2('0x33')]=_[_0x37f2('0x34')](_0x4424d2[_0x37f2('0x30')],_0x4424d2['query']);_0x528841[_0x37f2('0x35')]=_[_0x37f2('0x34')](_0x4424d2['model'],qs['fields'](_0x39ff4c[_0x37f2('0x31')]['fields']));_0x528841[_0x37f2('0x35')]=_0x528841['attributes'][_0x37f2('0x36')]?_0x528841[_0x37f2('0x35')]:_0x4424d2[_0x37f2('0x30')];if(!_0x39ff4c[_0x37f2('0x31')]['hasOwnProperty'](_0x37f2('0x37'))){_0x528841['limit']=qs[_0x37f2('0x22')](_0x39ff4c[_0x37f2('0x31')][_0x37f2('0x22')]);_0x528841['offset']=qs[_0x37f2('0x1f')](_0x39ff4c[_0x37f2('0x31')][_0x37f2('0x1f')]);}_0x528841['order']=qs['sort'](_0x39ff4c['query']['sort']);_0x528841[_0x37f2('0x38')]=qs[_0x37f2('0x33')](_['pick'](_0x39ff4c['query'],_0x4424d2[_0x37f2('0x33')]),_0x32ee08);if(_0x39ff4c[_0x37f2('0x31')][_0x37f2('0x39')]){_0x528841[_0x37f2('0x38')]=_[_0x37f2('0x3a')](_0x528841['where'],{'$or':_[_0x37f2('0x3b')](_0x32ee08,function(_0x3368e4){if(_0x3368e4['type']!==_0x37f2('0x3c')){var _0x3f3a3e={};_0x3f3a3e[_0x3368e4[_0x37f2('0x2b')]]={'$like':'%'+_0x39ff4c[_0x37f2('0x31')]['filter']+'%'};return _0x3f3a3e;}})});}_0x528841=_['merge']({},_0x528841,_0x39ff4c[_0x37f2('0x3d')]);var _0x103915={'where':_0x528841[_0x37f2('0x38')]};return db[_0x37f2('0x3e')]['count'](_0x103915)[_0x37f2('0x28')](function(_0x210f95){_0xc4fd66[_0x37f2('0x21')]=_0x210f95;if(_0x39ff4c[_0x37f2('0x31')][_0x37f2('0x3f')]){_0x528841['include']=[{'all':!![]}];}return db[_0x37f2('0x3e')][_0x37f2('0x40')](_0x528841);})[_0x37f2('0x28')](function(_0x4a5706){_0xc4fd66[_0x37f2('0x41')]=_0x4a5706;return _0xc4fd66;})[_0x37f2('0x28')](respondWithFilteredResult(_0x5000cd,_0x528841))['catch'](handleError(_0x5000cd,null));};exports['show']=function(_0x2cb9ab,_0x2cf3dd){var _0x42b475={'raw':!![],'where':{'id':_0x2cb9ab[_0x37f2('0x42')]['id']}},_0x9d4d10={};_0x9d4d10[_0x37f2('0x30')]=_[_0x37f2('0x32')](db[_0x37f2('0x3e')][_0x37f2('0x2e')]);_0x9d4d10[_0x37f2('0x31')]=_[_0x37f2('0x32')](_0x2cb9ab[_0x37f2('0x31')]);_0x9d4d10['filters']=_[_0x37f2('0x34')](_0x9d4d10[_0x37f2('0x30')],_0x9d4d10[_0x37f2('0x31')]);_0x42b475[_0x37f2('0x35')]=_['intersection'](_0x9d4d10[_0x37f2('0x30')],qs[_0x37f2('0x43')](_0x2cb9ab[_0x37f2('0x31')][_0x37f2('0x43')]));_0x42b475[_0x37f2('0x35')]=_0x42b475[_0x37f2('0x35')][_0x37f2('0x36')]?_0x42b475['attributes']:_0x9d4d10[_0x37f2('0x30')];if(_0x2cb9ab[_0x37f2('0x31')][_0x37f2('0x3f')]){_0x42b475['include']=[{'all':!![]}];}_0x42b475=_[_0x37f2('0x3a')]({},_0x42b475,_0x2cb9ab['options']);return db['SalesforceField'][_0x37f2('0x44')](_0x42b475)[_0x37f2('0x28')](handleEntityNotFound(_0x2cf3dd,null))[_0x37f2('0x28')](respondWithResult(_0x2cf3dd,null))[_0x37f2('0x45')](handleError(_0x2cf3dd,null));};exports[_0x37f2('0x46')]=function(_0x4c428c,_0xf40ff8){return db[_0x37f2('0x3e')]['create'](_0x4c428c[_0x37f2('0x47')],{})[_0x37f2('0x28')](respondWithResult(_0xf40ff8,0xc9))[_0x37f2('0x45')](handleError(_0xf40ff8,null));};exports['update']=function(_0xd28426,_0x485a7e){if(_0xd28426[_0x37f2('0x47')]['id']){delete _0xd28426[_0x37f2('0x47')]['id'];}return db[_0x37f2('0x3e')]['find']({'where':{'id':_0xd28426['params']['id']}})[_0x37f2('0x28')](handleEntityNotFound(_0x485a7e,null))[_0x37f2('0x28')](saveUpdates(_0xd28426[_0x37f2('0x47')],null))[_0x37f2('0x28')](respondWithResult(_0x485a7e,null))['catch'](handleError(_0x485a7e,null));};exports['destroy']=function(_0x3a1116,_0x20d1cd){return db['SalesforceField'][_0x37f2('0x44')]({'where':{'id':_0x3a1116['params']['id']}})['then'](handleEntityNotFound(_0x20d1cd,null))[_0x37f2('0x28')](removeEntity(_0x20d1cd,null))[_0x37f2('0x45')](handleError(_0x20d1cd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e8d18e9..d758b06 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 _0x32d6=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','moment','bluebird','request-promise','path'];(function(_0x2cfb9e,_0x21fcfd){var _0x5e76b5=function(_0x2362db){while(--_0x2362db){_0x2cfb9e['push'](_0x2cfb9e['shift']());}};_0x5e76b5(++_0x21fcfd);}(_0x32d6,0x1d7));var _0x632d=function(_0x35eb7c,_0xd39f5b){_0x35eb7c=_0x35eb7c-0x0;var _0x3b43ba=_0x32d6[_0x35eb7c];return _0x3b43ba;};'use strict';var _=require(_0x632d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x632d('0x1'));var BPromise=require(_0x632d('0x2'));var rp=require(_0x632d('0x3'));var fs=require('fs');var path=require(_0x632d('0x4'));var rimraf=require(_0x632d('0x5'));var config=require(_0x632d('0x6'));var attributes=require(_0x632d('0x7'));module[_0x632d('0x8')]=function(_0x334baf,_0x281245){return _0x334baf[_0x632d('0x9')](_0x632d('0xa'),attributes,{'tableName':_0x632d('0xb'),'paranoid':![],'indexes':[{'name':_0x632d('0xc'),'fields':[_0x632d('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf787=['../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x51cde2,_0x2a98f6){var _0x1a74ac=function(_0x3774b5){while(--_0x3774b5){_0x51cde2['push'](_0x51cde2['shift']());}};_0x1a74ac(++_0x2a98f6);}(_0xf787,0x73));var _0x7f78=function(_0x35f27f,_0x3ca07a){_0x35f27f=_0x35f27f-0x0;var _0x3377c0=_0xf787[_0x35f27f];return _0x3377c0;};'use strict';var _=require(_0x7f78('0x0'));var util=require('util');var logger=require(_0x7f78('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7f78('0x2'));var rp=require(_0x7f78('0x3'));var fs=require('fs');var path=require(_0x7f78('0x4'));var rimraf=require('rimraf');var config=require(_0x7f78('0x5'));var attributes=require(_0x7f78('0x6'));module['exports']=function(_0x2f4525,_0x5413eb){return _0x2f4525['define'](_0x7f78('0x7'),attributes,{'tableName':_0x7f78('0x8'),'paranoid':![],'indexes':[{'name':_0x7f78('0x9'),'fields':[_0x7f78('0xa'),_0x7f78('0xb')],'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 d8d5466..47a2ec0 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 _0xf152=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','result','catch','lodash'];(function(_0x1d60c0,_0x363996){var _0x169042=function(_0x4e29ba){while(--_0x4e29ba){_0x1d60c0['push'](_0x1d60c0['shift']());}};_0x169042(++_0x363996);}(_0xf152,0x7c));var _0x2f15=function(_0x508167,_0x2a24ec){_0x508167=_0x508167-0x0;var _0x5e7a78=_0xf152[_0x508167];return _0x5e7a78;};'use strict';var _=require(_0x2f15('0x0'));var util=require('util');var moment=require(_0x2f15('0x1'));var BPromise=require(_0x2f15('0x2'));var rs=require(_0x2f15('0x3'));var fs=require('fs');var Redis=require(_0x2f15('0x4'));var db=require(_0x2f15('0x5'))['db'];var utils=require(_0x2f15('0x6'));var logger=require(_0x2f15('0x7'))(_0x2f15('0x8'));var config=require(_0x2f15('0x9'));var jayson=require(_0x2f15('0xa'));var client=jayson[_0x2f15('0xb')][_0x2f15('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e4a55,_0x5cb626,_0x38bccb){return new BPromise(function(_0x5c6ef4,_0x52eaab){return client[_0x2f15('0xd')](_0x2e4a55,_0x38bccb)[_0x2f15('0xe')](function(_0x22f5be){logger['info']('SalesforceField,\x20%s,\x20%s',_0x5cb626,'request\x20sent');logger['debug'](_0x2f15('0xf'),_0x5cb626,_0x2f15('0x10'),JSON[_0x2f15('0x11')](_0x22f5be));if(_0x22f5be[_0x2f15('0x12')]){if(_0x22f5be[_0x2f15('0x12')][_0x2f15('0x13')]===0x1f4){logger[_0x2f15('0x12')]('SalesforceField,\x20%s,\x20%s',_0x5cb626,_0x22f5be[_0x2f15('0x12')][_0x2f15('0x14')]);return _0x52eaab(_0x22f5be['error'][_0x2f15('0x14')]);}logger[_0x2f15('0x12')](_0x2f15('0x15'),_0x5cb626,_0x22f5be[_0x2f15('0x12')][_0x2f15('0x14')]);return _0x5c6ef4(_0x22f5be['error'][_0x2f15('0x14')]);}else{logger[_0x2f15('0x16')](_0x2f15('0x15'),_0x5cb626,_0x2f15('0x10'));_0x5c6ef4(_0x22f5be[_0x2f15('0x17')][_0x2f15('0x14')]);}})[_0x2f15('0x18')](function(_0x197d1a){logger[_0x2f15('0x12')](_0x2f15('0x15'),_0x5cb626,_0x197d1a);_0x52eaab(_0x197d1a);});});} \ No newline at end of file +var _0x9755=['info','request\x20sent','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x310285,_0x6af2ed){var _0x3173db=function(_0x34d31b){while(--_0x34d31b){_0x310285['push'](_0x310285['shift']());}};_0x3173db(++_0x6af2ed);}(_0x9755,0x117));var _0x5975=function(_0xdb47d8,_0x933e5b){_0xdb47d8=_0xdb47d8-0x0;var _0x5cdfd9=_0x9755[_0xdb47d8];return _0x5cdfd9;};'use strict';var _=require('lodash');var util=require(_0x5975('0x0'));var moment=require(_0x5975('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5975('0x2'))(_0x5975('0x3'));var config=require(_0x5975('0x4'));var jayson=require(_0x5975('0x5'));var client=jayson[_0x5975('0x6')][_0x5975('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f2816,_0x21e704,_0x141b20){return new BPromise(function(_0x1f95bd,_0x42af7c){return client[_0x5975('0x8')](_0x4f2816,_0x141b20)['then'](function(_0x347b53){logger[_0x5975('0x9')]('SalesforceField,\x20%s,\x20%s',_0x21e704,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x21e704,_0x5975('0xa'),JSON[_0x5975('0xb')](_0x347b53));if(_0x347b53['error']){if(_0x347b53[_0x5975('0xc')][_0x5975('0xd')]===0x1f4){logger[_0x5975('0xc')](_0x5975('0xe'),_0x21e704,_0x347b53[_0x5975('0xc')][_0x5975('0xf')]);return _0x42af7c(_0x347b53[_0x5975('0xc')][_0x5975('0xf')]);}logger[_0x5975('0xc')](_0x5975('0xe'),_0x21e704,_0x347b53[_0x5975('0xc')][_0x5975('0xf')]);return _0x1f95bd(_0x347b53[_0x5975('0xc')]['message']);}else{logger['info'](_0x5975('0xe'),_0x21e704,_0x5975('0xa'));_0x1f95bd(_0x347b53[_0x5975('0x10')][_0x5975('0xf')]);}})[_0x5975('0x11')](function(_0x82e536){logger[_0x5975('0xc')]('SalesforceField,\x20%s,\x20%s',_0x21e704,_0x82e536);_0x42af7c(_0x82e536);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ce0e069..84dd958 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 _0x073e=['show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x4b8cc8,_0x316e38){var _0x15d14c=function(_0x1ccbe9){while(--_0x1ccbe9){_0x4b8cc8['push'](_0x4b8cc8['shift']());}};_0x15d14c(++_0x316e38);}(_0x073e,0x181));var _0xe073=function(_0x28dc29,_0x5addd8){_0x28dc29=_0x28dc29-0x0;var _0x5adba9=_0x073e[_0x28dc29];return _0x5adba9;};'use strict';var multer=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var path=require(_0xe073('0x2'));var timeout=require(_0xe073('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe073('0x4'));var interaction=require(_0xe073('0x5'));var config=require(_0xe073('0x6'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe073('0x7')]);router[_0xe073('0x8')](_0xe073('0x9'),auth[_0xe073('0xa')](),controller[_0xe073('0xb')]);router[_0xe073('0x8')]('/:id/configurations',auth[_0xe073('0xa')](),controller[_0xe073('0xc')]);router[_0xe073('0x8')](_0xe073('0xd'),auth['isAuthenticated'](),controller[_0xe073('0xe')]);router[_0xe073('0xf')]('/',auth[_0xe073('0xa')](),controller[_0xe073('0x10')]);router[_0xe073('0xf')](_0xe073('0x11'),auth['isAuthenticated'](),controller[_0xe073('0x12')]);router['put'](_0xe073('0x9'),auth['isAuthenticated'](),controller[_0xe073('0x13')]);router['delete'](_0xe073('0x9'),auth[_0xe073('0xa')](),controller[_0xe073('0x14')]);module[_0xe073('0x15')]=router; \ No newline at end of file +var _0x766b=['getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x766b,0x158));var _0xb766=function(_0x1f6fbb,_0x76d65){_0x1f6fbb=_0x1f6fbb-0x0;var _0x25a770=_0x766b[_0x1f6fbb];return _0x25a770;};'use strict';var multer=require(_0xb766('0x0'));var util=require(_0xb766('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb766('0x2')]();var fs_extra=require(_0xb766('0x3'));var auth=require(_0xb766('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb766('0x5'));var controller=require(_0xb766('0x6'));router['get']('/',auth[_0xb766('0x7')](),controller['index']);router[_0xb766('0x8')](_0xb766('0x9'),auth[_0xb766('0x7')](),controller[_0xb766('0xa')]);router[_0xb766('0x8')]('/:id/configurations',auth[_0xb766('0x7')](),controller[_0xb766('0xb')]);router[_0xb766('0x8')](_0xb766('0xc'),auth[_0xb766('0x7')](),controller[_0xb766('0xd')]);router[_0xb766('0xe')]('/',auth[_0xb766('0x7')](),controller['create']);router[_0xb766('0xe')](_0xb766('0xf'),auth[_0xb766('0x7')](),controller[_0xb766('0x10')]);router[_0xb766('0x11')](_0xb766('0x9'),auth[_0xb766('0x7')](),controller[_0xb766('0x12')]);router[_0xb766('0x13')]('/:id',auth[_0xb766('0x7')](),controller[_0xb766('0x14')]);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 4da8ae3..8d809fb 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 _0x7c7d=['exports','STRING','remoteUri','sequelize'];(function(_0x41c1d7,_0x4d28fc){var _0x46244c=function(_0x41bd9c){while(--_0x41bd9c){_0x41c1d7['push'](_0x41c1d7['shift']());}};_0x46244c(++_0x4d28fc);}(_0x7c7d,0x113));var _0xd7c7=function(_0x574984,_0x569bd1){_0x574984=_0x574984-0x0;var _0x2ba85c=_0x7c7d[_0x574984];return _0x2ba85c;};'use strict';var Sequelize=require(_0xd7c7('0x0'));module[_0xd7c7('0x1')]={'name':{'type':Sequelize[_0xd7c7('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd7c7('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xd7c7('0x2')]},'email':{'type':Sequelize[_0xd7c7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd7c7('0x3')},'serverUrl':{'type':Sequelize[_0xd7c7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4163=['STRING','username','remoteUri','sequelize','exports'];(function(_0x51b24a,_0x113efd){var _0x4be04a=function(_0x605cc6){while(--_0x605cc6){_0x51b24a['push'](_0x51b24a['shift']());}};_0x4be04a(++_0x113efd);}(_0x4163,0x71));var _0x3416=function(_0x2cf0b5,_0x592d23){_0x2cf0b5=_0x2cf0b5-0x0;var _0x45a637=_0x4163[_0x2cf0b5];return _0x45a637;};'use strict';var Sequelize=require(_0x3416('0x0'));module[_0x3416('0x1')]={'name':{'type':Sequelize[_0x3416('0x2')]},'description':{'type':Sequelize[_0x3416('0x2')]},'username':{'type':Sequelize[_0x3416('0x2')],'unique':_0x3416('0x3')},'password':{'type':Sequelize[_0x3416('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3416('0x2')],'unique':_0x3416('0x4')},'serverUrl':{'type':Sequelize[_0x3416('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 874fbd4..75cfcd3 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 _0x0852=['set','Content-Range','apply','reject','update','then','error','name','send','map','ServicenowAccount','rawAttributes','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','notify','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','activity_due','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','test','Wrong\x20credentials','statusCode','false','GET','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x1a521c,_0x3e2cf9){var _0x3cb2e4=function(_0x2d65dd){while(--_0x2d65dd){_0x1a521c['push'](_0x1a521c['shift']());}};_0x3cb2e4(++_0x3e2cf9);}(_0x0852,0x140));var _0x2085=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0852[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x2085('0x0'));var rimraf=require(_0x2085('0x1'));var zipdir=require(_0x2085('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2085('0x3'));var moment=require(_0x2085('0x4'));var BPromise=require(_0x2085('0x5'));var Mustache=require(_0x2085('0x6'));var util=require(_0x2085('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2085('0x8'));var ejs=require(_0x2085('0x9'));var fs=require('fs');var fs_extra=require(_0x2085('0xa'));var _=require(_0x2085('0xb'));var squel=require('squel');var crypto=require(_0x2085('0xc'));var jsforce=require(_0x2085('0xd'));var deskjs=require(_0x2085('0xe'));var toCsv=require(_0x2085('0x8'));var querystring=require(_0x2085('0xf'));var Papa=require(_0x2085('0x10'));var Redis=require(_0x2085('0x11'));var authService=require(_0x2085('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2085('0x13'));var hardwareService=require(_0x2085('0x14'));var logger=require(_0x2085('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2085('0x16'))['db'];var integrations=require(_0x2085('0x17'));function respondWithStatusCode(_0x14a95b,_0x235815){_0x235815=_0x235815||0xcc;return function(_0x789063){if(_0x789063){return _0x14a95b[_0x2085('0x18')](_0x235815);}return _0x14a95b[_0x2085('0x19')](_0x235815)[_0x2085('0x1a')]();};}function respondWithResult(_0x517b47,_0x4548bc){_0x4548bc=_0x4548bc||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0x517b47['status'](_0x4548bc)[_0x2085('0x1b')](_0x1c84d3);}};}function respondWithFilteredResult(_0x5e9bfd,_0x10fa0c){return function(_0x521031){if(_0x521031){var _0x397818=typeof _0x10fa0c[_0x2085('0x1c')]==='undefined'&&typeof _0x10fa0c['limit']===_0x2085('0x1d');var _0x51fc96=_0x521031['count'];var _0x362c9c=_0x397818?0x0:_0x10fa0c[_0x2085('0x1c')];var _0x1e2609=_0x397818?_0x521031[_0x2085('0x1e')]:_0x10fa0c[_0x2085('0x1c')]+_0x10fa0c[_0x2085('0x1f')];var _0x41d4a0;if(_0x1e2609>=_0x51fc96){_0x1e2609=_0x51fc96;_0x41d4a0=0xc8;}else{_0x41d4a0=0xce;}_0x5e9bfd[_0x2085('0x19')](_0x41d4a0);return _0x5e9bfd[_0x2085('0x20')](_0x2085('0x21'),_0x362c9c+'-'+_0x1e2609+'/'+_0x51fc96)[_0x2085('0x1b')](_0x521031);}return null;};}function patchUpdates(_0x520f95){return function(_0x5bd076){try{jsonpatch[_0x2085('0x22')](_0x5bd076,_0x520f95,!![]);}catch(_0xb7f83b){return BPromise[_0x2085('0x23')](_0xb7f83b);}return _0x5bd076['save']();};}function saveUpdates(_0x3a832b,_0x9b7e5a){return function(_0x921112){if(_0x921112){return _0x921112[_0x2085('0x24')](_0x3a832b)['then'](function(_0x3a387f){return _0x3a387f;});}return null;};}function removeEntity(_0x45d3be,_0x37dc63){return function(_0x535411){if(_0x535411){return _0x535411['destroy']()[_0x2085('0x25')](function(){_0x45d3be[_0x2085('0x19')](0xcc)[_0x2085('0x1a')]();});}};}function handleEntityNotFound(_0x5322d6,_0x385a53){return function(_0x43d510){if(!_0x43d510){_0x5322d6[_0x2085('0x18')](0x194);}return _0x43d510;};}function handleError(_0x41f523,_0x3b3380){_0x3b3380=_0x3b3380||0x1f4;return function(_0x529c87){logger[_0x2085('0x26')](_0x529c87['stack']);if(_0x529c87[_0x2085('0x27')]){delete _0x529c87[_0x2085('0x27')];}_0x41f523['status'](_0x3b3380)[_0x2085('0x28')](_0x529c87);};}exports['index']=function(_0x44b22c,_0x103f1f){var _0xf532fb={},_0x283f53={},_0x518b16={'count':0x0,'rows':[]};var _0x2f9c46=_[_0x2085('0x29')](db[_0x2085('0x2a')][_0x2085('0x2b')],function(_0x263a5d){return{'name':_0x263a5d['fieldName'],'type':_0x263a5d['type'][_0x2085('0x2c')]};});_0x283f53['model']=_[_0x2085('0x29')](_0x2f9c46,_0x2085('0x27'));_0x283f53[_0x2085('0x2d')]=_[_0x2085('0x2e')](_0x44b22c[_0x2085('0x2d')]);_0x283f53['filters']=_['intersection'](_0x283f53[_0x2085('0x2f')],_0x283f53[_0x2085('0x2d')]);_0xf532fb['attributes']=_[_0x2085('0x30')](_0x283f53[_0x2085('0x2f')],qs[_0x2085('0x31')](_0x44b22c[_0x2085('0x2d')][_0x2085('0x31')]));_0xf532fb[_0x2085('0x32')]=_0xf532fb['attributes'][_0x2085('0x33')]?_0xf532fb[_0x2085('0x32')]:_0x283f53[_0x2085('0x2f')];if(!_0x44b22c['query'][_0x2085('0x34')](_0x2085('0x35'))){_0xf532fb['limit']=qs[_0x2085('0x1f')](_0x44b22c[_0x2085('0x2d')][_0x2085('0x1f')]);_0xf532fb[_0x2085('0x1c')]=qs[_0x2085('0x1c')](_0x44b22c['query']['offset']);}_0xf532fb[_0x2085('0x36')]=qs[_0x2085('0x37')](_0x44b22c[_0x2085('0x2d')]['sort']);_0xf532fb[_0x2085('0x38')]=qs[_0x2085('0x39')](_[_0x2085('0x3a')](_0x44b22c[_0x2085('0x2d')],_0x283f53[_0x2085('0x39')]),_0x2f9c46);if(_0x44b22c[_0x2085('0x2d')]['filter']){_0xf532fb[_0x2085('0x38')]=_[_0x2085('0x3b')](_0xf532fb[_0x2085('0x38')],{'$or':_[_0x2085('0x29')](_0x2f9c46,function(_0x1bff34){if(_0x1bff34[_0x2085('0x3c')]!=='VIRTUAL'){var _0x155210={};_0x155210[_0x1bff34[_0x2085('0x27')]]={'$like':'%'+_0x44b22c['query'][_0x2085('0x3d')]+'%'};return _0x155210;}})});}_0xf532fb=_[_0x2085('0x3b')]({},_0xf532fb,_0x44b22c[_0x2085('0x3e')]);var _0xe788f9={'where':_0xf532fb[_0x2085('0x38')]};return db[_0x2085('0x2a')][_0x2085('0x1e')](_0xe788f9)[_0x2085('0x25')](function(_0x3f3cd8){_0x518b16['count']=_0x3f3cd8;if(_0x44b22c[_0x2085('0x2d')][_0x2085('0x3f')]){_0xf532fb[_0x2085('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x2085('0x41')](_0xf532fb);})[_0x2085('0x25')](function(_0xa0b3a9){_0x518b16[_0x2085('0x42')]=_0xa0b3a9;return _0x518b16;})[_0x2085('0x25')](respondWithFilteredResult(_0x103f1f,_0xf532fb))[_0x2085('0x43')](handleError(_0x103f1f,null));};exports[_0x2085('0x44')]=function(_0x34e678,_0x1c1395){var _0x4eff5b={'raw':![],'where':{'id':_0x34e678['params']['id']}},_0x299199={};_0x299199['model']=_[_0x2085('0x2e')](db['ServicenowAccount'][_0x2085('0x2b')]);_0x299199[_0x2085('0x2d')]=_[_0x2085('0x2e')](_0x34e678[_0x2085('0x2d')]);_0x299199[_0x2085('0x39')]=_[_0x2085('0x30')](_0x299199[_0x2085('0x2f')],_0x299199['query']);_0x4eff5b[_0x2085('0x32')]=_[_0x2085('0x30')](_0x299199[_0x2085('0x2f')],qs[_0x2085('0x31')](_0x34e678[_0x2085('0x2d')][_0x2085('0x31')]));_0x4eff5b[_0x2085('0x32')]=_0x4eff5b[_0x2085('0x32')][_0x2085('0x33')]?_0x4eff5b[_0x2085('0x32')]:_0x299199[_0x2085('0x2f')];if(_0x34e678[_0x2085('0x2d')][_0x2085('0x3f')]){_0x4eff5b[_0x2085('0x40')]=[{'all':!![]}];}_0x4eff5b=_[_0x2085('0x3b')]({},_0x4eff5b,_0x34e678[_0x2085('0x3e')]);return db[_0x2085('0x2a')]['find'](_0x4eff5b)[_0x2085('0x25')](handleEntityNotFound(_0x1c1395,null))[_0x2085('0x25')](respondWithResult(_0x1c1395,null))[_0x2085('0x43')](handleError(_0x1c1395,null));};exports[_0x2085('0x45')]=function(_0x5e68a1,_0x58cd99){return db[_0x2085('0x2a')][_0x2085('0x45')](_0x5e68a1[_0x2085('0x46')],{})[_0x2085('0x25')](respondWithResult(_0x58cd99,0xc9))['catch'](handleError(_0x58cd99,null));};exports[_0x2085('0x24')]=function(_0x1cd887,_0x24655e){if(_0x1cd887[_0x2085('0x46')]['id']){delete _0x1cd887['body']['id'];}return db['ServicenowAccount'][_0x2085('0x47')]({'where':{'id':_0x1cd887[_0x2085('0x48')]['id']}})[_0x2085('0x25')](handleEntityNotFound(_0x24655e,null))[_0x2085('0x25')](saveUpdates(_0x1cd887[_0x2085('0x46')],null))['then'](respondWithResult(_0x24655e,null))[_0x2085('0x43')](handleError(_0x24655e,null));};exports[_0x2085('0x49')]=function(_0xd0d425,_0x74b88d){return db['ServicenowAccount'][_0x2085('0x47')]({'where':{'id':_0xd0d425[_0x2085('0x48')]['id']}})[_0x2085('0x25')](handleEntityNotFound(_0x74b88d,null))[_0x2085('0x25')](removeEntity(_0x74b88d,null))[_0x2085('0x43')](handleError(_0x74b88d,null));};exports[_0x2085('0x4a')]=function(_0x141066,_0x1bc47c,_0xa449ad){var _0x74f898={};var _0x2e4098={};var _0x2b33d6;var _0x55cb67;return db[_0x2085('0x2a')][_0x2085('0x4b')]({'where':{'id':_0x141066[_0x2085('0x48')]['id']}})[_0x2085('0x25')](handleEntityNotFound(_0x1bc47c,null))[_0x2085('0x25')](function(_0x48392b){if(_0x48392b){_0x2b33d6=_0x48392b;_0x2e4098[_0x2085('0x2f')]=_['keys'](db[_0x2085('0x4c')][_0x2085('0x2b')]);_0x2e4098['query']=_[_0x2085('0x2e')](_0x141066[_0x2085('0x2d')]);_0x2e4098[_0x2085('0x39')]=_[_0x2085('0x30')](_0x2e4098[_0x2085('0x2f')],_0x2e4098[_0x2085('0x2d')]);_0x74f898[_0x2085('0x32')]=_['intersection'](_0x2e4098[_0x2085('0x2f')],qs[_0x2085('0x31')](_0x141066[_0x2085('0x2d')][_0x2085('0x31')]));_0x74f898[_0x2085('0x32')]=_0x74f898[_0x2085('0x32')][_0x2085('0x33')]?_0x74f898[_0x2085('0x32')]:_0x2e4098['model'];_0x74f898[_0x2085('0x36')]=qs[_0x2085('0x37')](_0x141066['query'][_0x2085('0x37')]);_0x74f898[_0x2085('0x38')]=qs['filters'](_[_0x2085('0x3a')](_0x141066[_0x2085('0x2d')],_0x2e4098[_0x2085('0x39')]));if(_0x141066['query'][_0x2085('0x3d')]){_0x74f898[_0x2085('0x38')]=_[_0x2085('0x3b')](_0x74f898[_0x2085('0x38')],{'$or':_[_0x2085('0x29')](_0x74f898[_0x2085('0x32')],function(_0x4c2da9){var _0x23959a={};_0x23959a[_0x4c2da9]={'$like':'%'+_0x141066[_0x2085('0x2d')][_0x2085('0x3d')]+'%'};return _0x23959a;})});}_0x74f898=_['merge']({},_0x74f898,_0x141066[_0x2085('0x3e')]);return _0x2b33d6[_0x2085('0x4a')](_0x74f898);}})[_0x2085('0x25')](function(_0x4a56da){if(_0x4a56da){_0x55cb67=_0x4a56da[_0x2085('0x33')];if(!_0x141066[_0x2085('0x2d')]['hasOwnProperty']('nolimit')){_0x74f898[_0x2085('0x1f')]=qs[_0x2085('0x1f')](_0x141066[_0x2085('0x2d')][_0x2085('0x1f')]);_0x74f898[_0x2085('0x1c')]=qs['offset'](_0x141066[_0x2085('0x2d')]['offset']);}return _0x2b33d6[_0x2085('0x4a')](_0x74f898);}})[_0x2085('0x25')](function(_0x3c6881){if(_0x3c6881){return _0x3c6881?{'count':_0x55cb67,'rows':_0x3c6881}:null;}})['then'](respondWithResult(_0x1bc47c,null))[_0x2085('0x43')](handleError(_0x1bc47c,null));};exports[_0x2085('0x4d')]=function(_0x463cea,_0x48e08f,_0x2934f8){if(_0x463cea[_0x2085('0x46')]['id']){delete _0x463cea['body']['id'];}return db[_0x2085('0x2a')][_0x2085('0x4b')]({'where':{'id':_0x463cea[_0x2085('0x48')]['id']}})[_0x2085('0x25')](handleEntityNotFound(_0x48e08f,null))['then'](function(_0x29f8a6){if(_0x29f8a6){_0x463cea[_0x2085('0x46')][_0x2085('0x4e')]=_0x29f8a6['id'];_0x463cea[_0x2085('0x46')][_0x2085('0x4f')]=integrations[_0x2085('0x50')](_0x463cea[_0x2085('0x46')][_0x2085('0x51')],_0x463cea[_0x2085('0x46')]['type']);_0x463cea[_0x2085('0x46')][_0x2085('0x52')]=integrations[_0x2085('0x53')](_0x463cea['body'][_0x2085('0x51')],_0x463cea[_0x2085('0x46')]['type']);return db[_0x2085('0x4c')][_0x2085('0x45')](_0x463cea['body'],{'include':[{'model':db[_0x2085('0x54')],'as':'Subjects'},{'model':db[_0x2085('0x54')],'as':_0x2085('0x52')}]});}return null;})[_0x2085('0x25')](respondWithResult(_0x48e08f,null))[_0x2085('0x43')](handleError(_0x48e08f,null));};exports['getFields']=function(_0x2532df,_0x323a34,_0x2e3b50){var _0x3a5409=[_0x2085('0x55'),_0x2085('0x56'),_0x2085('0x57'),'subcategory','close_code',_0x2085('0x58'),'incident_state','severity',_0x2085('0x59')];var _0x2650b3=[_0x2085('0x5a'),'made_sla','caused_by',_0x2085('0x5b'),_0x2085('0x5c'),_0x2085('0x5d'),_0x2085('0x5e'),_0x2085('0x56'),'approval_history',_0x2085('0x5f'),_0x2085('0x60'),_0x2085('0x61'),'opened_by','user_input',_0x2085('0x62'),_0x2085('0x63'),'state',_0x2085('0x64'),_0x2085('0x57'),_0x2085('0x36'),_0x2085('0x65'),_0x2085('0x66'),_0x2085('0x67'),'delivery_plan',_0x2085('0x68'),_0x2085('0x69'),_0x2085('0x6a'),_0x2085('0x6b'),_0x2085('0x6c'),_0x2085('0x6d'),'rfc',_0x2085('0x6e'),_0x2085('0x6f'),_0x2085('0x70'),_0x2085('0x71'),_0x2085('0x72'),_0x2085('0x73'),_0x2085('0x74'),_0x2085('0x75'),'caller_id',_0x2085('0x76'),_0x2085('0x77'),_0x2085('0x78'),_0x2085('0x79'),'close_code',_0x2085('0x7a'),_0x2085('0x7b'),'work_start','assignment_group',_0x2085('0x7c'),_0x2085('0x7d'),_0x2085('0x7e'),_0x2085('0x7f'),_0x2085('0x58'),'sys_class_name',_0x2085('0x80'),_0x2085('0x81'),'follow_up',_0x2085('0x82'),'sys_id',_0x2085('0x83'),_0x2085('0x84'),_0x2085('0x85'),_0x2085('0x86'),_0x2085('0x87'),'company','reassignment_count',_0x2085('0x88'),_0x2085('0x89'),_0x2085('0x8a'),_0x2085('0x8b'),'sla_due',_0x2085('0x8c'),_0x2085('0x8d'),_0x2085('0x8e'),_0x2085('0x8f'),_0x2085('0x90'),'sys_tags',_0x2085('0x91'),_0x2085('0x92'),'correlation_id',_0x2085('0x93'),_0x2085('0x59')];var _0x148cf1='';var _0x4968a5='';var _0x2ff7cd=[];var _0x4e3534='';var _0x58f179='';var _0x186814=[];var _0x5452cf='';var _0x1b9b6b='';var _0x54d5c4={};var _0x3c89ec='';return db[_0x2085('0x2a')][_0x2085('0x4b')]({'where':{'id':_0x2532df[_0x2085('0x48')]['id']},'attributes':['id','username',_0x2085('0x94'),_0x2085('0x95'),_0x2085('0x96'),'serverUrl']})[_0x2085('0x25')](handleEntityNotFound(_0x323a34,null))[_0x2085('0x25')](function(_0x2521c0){if(_0x2521c0){_0x3c89ec=_0x2521c0[_0x2085('0x96')];var _0x5e0c6f=_0x3c89ec[_0x2085('0x97')](-0x1);if(_0x5e0c6f==='/'){_0x3c89ec=_0x3c89ec[_0x2085('0x98')](0x0,_0x3c89ec[_0x2085('0x99')](_0x5e0c6f));}_0x1b9b6b=util[_0x2085('0x9a')](_0x2085('0x9b'),_0x3c89ec);_0x5452cf=util[_0x2085('0x9a')](_0x2085('0x9c'),_0x3c89ec);_0x54d5c4={'user':_0x2521c0[_0x2085('0x9d')],'pass':_0x2521c0[_0x2085('0x94')]};var _0x2e4966={'method':'GET','uri':_0x1b9b6b+'incident?sysparm_display_value=all','auth':_0x54d5c4,'json':!![]};return rp(_0x2e4966);}})[_0x2085('0x25')](function(_0x116c37){if(_0x116c37[_0x2085('0x9e')]['length']>0x0){_0x148cf1=_0x116c37[_0x2085('0x9e')];}console[_0x2085('0x9f')](_0x2085('0xa0'),_0x148cf1);_0x186814=[];_0x4968a5=Object[_0x2085('0xa1')]([],_0x148cf1);_[_0x2085('0xa2')](_0x4968a5,function(_0x2f7c27){return!_0x3a5409[_0x2085('0xa3')](_0x2f7c27['name']);});_0x4968a5[_0x2085('0xa4')](function(_0x2e0917){var _0x213549=createFieldObject(_0x5452cf,_0x54d5c4,_0x2e0917['internalType'],_0x2e0917[_0x2085('0x27')],_0x2e0917['label'],![]);_0x186814['push'](_0x213549);});return Promise[_0x2085('0xa5')](_0x186814);})['then'](function(_0x4f3ddd){_0x2ff7cd=_0x4f3ddd;_0x4e3534=Object[_0x2085('0xa1')]([],_0x148cf1);console['log']('TCL:\x20_object',_0x148cf1);_['remove'](_0x4e3534,function(_0x90880c){return _0x2650b3[_0x2085('0xa3')](_0x90880c[_0x2085('0x27')]);});console['log'](_0x2085('0xa6'),_0x4e3534);_0x186814=[];_0x4e3534[_0x2085('0xa4')](function(_0x24a4d1){var _0xa04661=createFieldObject(_0x5452cf,_0x54d5c4,_0x24a4d1[_0x2085('0xa7')],_0x24a4d1[_0x2085('0x27')],_0x24a4d1['label'],!![]);_0x186814[_0x2085('0xa8')](_0xa04661);});return Promise[_0x2085('0xa5')](_0x186814);})[_0x2085('0x25')](function(_0x2dd64d){_0x58f179=_0x2dd64d;var _0x2697e1=_0x2ff7cd['concat'](_0x58f179);return{'count':_0x2697e1[_0x2085('0x33')],'rows':_0x2697e1};})[_0x2085('0x25')](respondWithResult(_0x323a34,null))['catch'](function(_0x5ad2de){console[_0x2085('0x9f')]('ServiceNow\x20error:\x20'+_0x5ad2de);var _0x4600d7=_0x2532df[_0x2085('0x2d')][_0x2085('0xa9')]?0x1f4:_0x5ad2de['statusCode']||0x1f4;logger[_0x2085('0x26')](_0x5ad2de['stack']);delete _0x5ad2de[_0x2085('0x27')];if(_0x4600d7===0x191){_0x4600d7=0x190;}_0x323a34[_0x2085('0x19')](_0x4600d7)['send'](_0x2532df['query'][_0x2085('0xa9')]?{'message':_0x2085('0xaa'),'statusCode':_0x5ad2de[_0x2085('0xab')]}:_0x5ad2de);});};function createFieldObject(_0x1400c9,_0xb8c392,_0x14b956,_0xe1acca,_0x5ac72c,_0x43c0cf){return new Promise(function(_0x43f946,_0x57b99e){var _0x3547ee={'id':_0xe1acca,'name':_0x5ac72c,'custom':_0x43c0cf};if(_0x14b956==='boolean'){_0x3547ee['options']=[{'name':'True','value':'true'},{'name':'False','value':_0x2085('0xac')}];_0x43f946(_0x3547ee);}else{var _0x39debc={'method':_0x2085('0xad'),'uri':_0x1400c9+_0x2085('0xae')+_0xe1acca,'auth':_0xb8c392,'json':!![]};return rp(_0x39debc)[_0x2085('0x25')](function(_0xe8f135){var _0x3562ae=[];if(_0xe8f135['result']['length']>0x0){_0xe8f135[_0x2085('0x9e')][_0x2085('0xa4')](function(_0x5485d0){if(_0x5485d0['inactive']===_0x2085('0xac')){var _0x30cb7c={'name':_0x5485d0['label'],'value':_0x5485d0[_0x2085('0xaf')]};_0x3562ae[_0x2085('0xa8')](_0x30cb7c);}});}_0x3547ee['options']=_0x3562ae;if(_0x3547ee[_0x2085('0x3e')][_0x2085('0x33')]>0x0){_0x43f946(_0x3547ee);}else{if(_0x43c0cf==![]){_0x43f946();}else{_0x43f946(_0x3547ee);}}});}});} \ No newline at end of file +var _0x5b46=['comments_and_work_notes','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','ServicenowAccount','find','create','body','findOne','ServicenowConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','ServicenowField','Descriptions','made_sla','hold_reason','subcategory','notify','incident_state','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','correlation_display','delivery_task','work_start','business_stc','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments'];(function(_0x278612,_0x1a1cf4){var _0x7bc357=function(_0x1ba514){while(--_0x1ba514){_0x278612['push'](_0x278612['shift']());}};_0x7bc357(++_0x1a1cf4);}(_0x5b46,0xe3));var _0x65b4=function(_0x163634,_0x188fcf){_0x163634=_0x163634-0x0;var _0x114b14=_0x5b46[_0x163634];return _0x114b14;};'use strict';var emlformat=require(_0x65b4('0x0'));var rimraf=require(_0x65b4('0x1'));var zipdir=require(_0x65b4('0x2'));var jsonpatch=require(_0x65b4('0x3'));var rp=require(_0x65b4('0x4'));var moment=require(_0x65b4('0x5'));var BPromise=require(_0x65b4('0x6'));var Mustache=require(_0x65b4('0x7'));var util=require(_0x65b4('0x8'));var path=require(_0x65b4('0x9'));var sox=require(_0x65b4('0xa'));var csv=require(_0x65b4('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65b4('0xc'));var _=require(_0x65b4('0xd'));var squel=require('squel');var crypto=require(_0x65b4('0xe'));var jsforce=require(_0x65b4('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x65b4('0x10'));var Papa=require(_0x65b4('0x11'));var Redis=require(_0x65b4('0x12'));var authService=require(_0x65b4('0x13'));var qs=require(_0x65b4('0x14'));var as=require(_0x65b4('0x15'));var hardwareService=require(_0x65b4('0x16'));var logger=require(_0x65b4('0x17'))('api');var utils=require(_0x65b4('0x18'));var config=require(_0x65b4('0x19'));var licenseUtil=require(_0x65b4('0x1a'));var db=require(_0x65b4('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xffc68d,_0x342cba){_0x342cba=_0x342cba||0xcc;return function(_0x40d45c){if(_0x40d45c){return _0xffc68d[_0x65b4('0x1c')](_0x342cba);}return _0xffc68d[_0x65b4('0x1d')](_0x342cba)[_0x65b4('0x1e')]();};}function respondWithResult(_0x24a32d,_0x29c110){_0x29c110=_0x29c110||0xc8;return function(_0x72550e){if(_0x72550e){return _0x24a32d[_0x65b4('0x1d')](_0x29c110)[_0x65b4('0x1f')](_0x72550e);}};}function respondWithFilteredResult(_0x3e8a2e,_0x25b63e){return function(_0x2dfb03){if(_0x2dfb03){var _0x51fcb2=typeof _0x25b63e['offset']===_0x65b4('0x20')&&typeof _0x25b63e[_0x65b4('0x21')]===_0x65b4('0x20');var _0x305cf3=_0x2dfb03[_0x65b4('0x22')];var _0x5c6543=_0x51fcb2?0x0:_0x25b63e[_0x65b4('0x23')];var _0x14762a=_0x51fcb2?_0x2dfb03[_0x65b4('0x22')]:_0x25b63e[_0x65b4('0x23')]+_0x25b63e[_0x65b4('0x21')];var _0x3d2ec7;if(_0x14762a>=_0x305cf3){_0x14762a=_0x305cf3;_0x3d2ec7=0xc8;}else{_0x3d2ec7=0xce;}_0x3e8a2e[_0x65b4('0x1d')](_0x3d2ec7);return _0x3e8a2e[_0x65b4('0x24')]('Content-Range',_0x5c6543+'-'+_0x14762a+'/'+_0x305cf3)['json'](_0x2dfb03);}return null;};}function patchUpdates(_0x26e9c6){return function(_0x14a5f3){try{jsonpatch[_0x65b4('0x25')](_0x14a5f3,_0x26e9c6,!![]);}catch(_0x112a5d){return BPromise['reject'](_0x112a5d);}return _0x14a5f3['save']();};}function saveUpdates(_0x2846e0,_0x37501f){return function(_0x1e0726){if(_0x1e0726){return _0x1e0726[_0x65b4('0x26')](_0x2846e0)[_0x65b4('0x27')](function(_0x4f7513){return _0x4f7513;});}return null;};}function removeEntity(_0x2dbcd2,_0x39ff53){return function(_0x42f77f){if(_0x42f77f){return _0x42f77f[_0x65b4('0x28')]()[_0x65b4('0x27')](function(){_0x2dbcd2[_0x65b4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12113a,_0x2fc376){return function(_0x3608ac){if(!_0x3608ac){_0x12113a[_0x65b4('0x1c')](0x194);}return _0x3608ac;};}function handleError(_0x4cecec,_0x16d639){_0x16d639=_0x16d639||0x1f4;return function(_0xb73a3){logger[_0x65b4('0x29')](_0xb73a3[_0x65b4('0x2a')]);if(_0xb73a3[_0x65b4('0x2b')]){delete _0xb73a3[_0x65b4('0x2b')];}_0x4cecec[_0x65b4('0x1d')](_0x16d639)[_0x65b4('0x2c')](_0xb73a3);};}exports[_0x65b4('0x2d')]=function(_0x32659f,_0x3562b0){var _0x107a71={},_0x561d6a={},_0x2dd984={'count':0x0,'rows':[]};var _0x49f7c7=_[_0x65b4('0x2e')](db['ServicenowAccount'][_0x65b4('0x2f')],function(_0x159e50){return{'name':_0x159e50[_0x65b4('0x30')],'type':_0x159e50[_0x65b4('0x31')][_0x65b4('0x32')]};});_0x561d6a['model']=_['map'](_0x49f7c7,_0x65b4('0x2b'));_0x561d6a[_0x65b4('0x33')]=_['keys'](_0x32659f[_0x65b4('0x33')]);_0x561d6a[_0x65b4('0x34')]=_[_0x65b4('0x35')](_0x561d6a[_0x65b4('0x36')],_0x561d6a['query']);_0x107a71['attributes']=_[_0x65b4('0x35')](_0x561d6a[_0x65b4('0x36')],qs[_0x65b4('0x37')](_0x32659f['query'][_0x65b4('0x37')]));_0x107a71[_0x65b4('0x38')]=_0x107a71[_0x65b4('0x38')][_0x65b4('0x39')]?_0x107a71[_0x65b4('0x38')]:_0x561d6a['model'];if(!_0x32659f['query'][_0x65b4('0x3a')]('nolimit')){_0x107a71['limit']=qs[_0x65b4('0x21')](_0x32659f['query']['limit']);_0x107a71[_0x65b4('0x23')]=qs['offset'](_0x32659f[_0x65b4('0x33')]['offset']);}_0x107a71[_0x65b4('0x3b')]=qs['sort'](_0x32659f[_0x65b4('0x33')][_0x65b4('0x3c')]);_0x107a71[_0x65b4('0x3d')]=qs[_0x65b4('0x34')](_[_0x65b4('0x3e')](_0x32659f[_0x65b4('0x33')],_0x561d6a['filters']),_0x49f7c7);if(_0x32659f[_0x65b4('0x33')][_0x65b4('0x3f')]){_0x107a71['where']=_[_0x65b4('0x40')](_0x107a71[_0x65b4('0x3d')],{'$or':_[_0x65b4('0x2e')](_0x49f7c7,function(_0x3fb3b6){if(_0x3fb3b6[_0x65b4('0x31')]!==_0x65b4('0x41')){var _0x50b279={};_0x50b279[_0x3fb3b6['name']]={'$like':'%'+_0x32659f[_0x65b4('0x33')][_0x65b4('0x3f')]+'%'};return _0x50b279;}})});}_0x107a71=_[_0x65b4('0x40')]({},_0x107a71,_0x32659f[_0x65b4('0x42')]);var _0x207566={'where':_0x107a71['where']};return db['ServicenowAccount'][_0x65b4('0x22')](_0x207566)[_0x65b4('0x27')](function(_0x4fdeea){_0x2dd984[_0x65b4('0x22')]=_0x4fdeea;if(_0x32659f['query'][_0x65b4('0x43')]){_0x107a71[_0x65b4('0x44')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x65b4('0x45')](_0x107a71);})[_0x65b4('0x27')](function(_0x30b745){_0x2dd984['rows']=_0x30b745;return _0x2dd984;})[_0x65b4('0x27')](respondWithFilteredResult(_0x3562b0,_0x107a71))[_0x65b4('0x46')](handleError(_0x3562b0,null));};exports[_0x65b4('0x47')]=function(_0x550307,_0x2da89b){var _0x2d9280={'raw':![],'where':{'id':_0x550307[_0x65b4('0x48')]['id']}},_0x5734ad={};_0x5734ad['model']=_[_0x65b4('0x49')](db[_0x65b4('0x4a')]['rawAttributes']);_0x5734ad['query']=_['keys'](_0x550307[_0x65b4('0x33')]);_0x5734ad[_0x65b4('0x34')]=_['intersection'](_0x5734ad[_0x65b4('0x36')],_0x5734ad[_0x65b4('0x33')]);_0x2d9280['attributes']=_['intersection'](_0x5734ad[_0x65b4('0x36')],qs[_0x65b4('0x37')](_0x550307['query']['fields']));_0x2d9280[_0x65b4('0x38')]=_0x2d9280[_0x65b4('0x38')][_0x65b4('0x39')]?_0x2d9280[_0x65b4('0x38')]:_0x5734ad[_0x65b4('0x36')];if(_0x550307['query'][_0x65b4('0x43')]){_0x2d9280[_0x65b4('0x44')]=[{'all':!![]}];}_0x2d9280=_[_0x65b4('0x40')]({},_0x2d9280,_0x550307[_0x65b4('0x42')]);return db[_0x65b4('0x4a')][_0x65b4('0x4b')](_0x2d9280)['then'](handleEntityNotFound(_0x2da89b,null))[_0x65b4('0x27')](respondWithResult(_0x2da89b,null))[_0x65b4('0x46')](handleError(_0x2da89b,null));};exports['create']=function(_0x26799c,_0x45054d){return db[_0x65b4('0x4a')][_0x65b4('0x4c')](_0x26799c[_0x65b4('0x4d')],{})[_0x65b4('0x27')](respondWithResult(_0x45054d,0xc9))['catch'](handleError(_0x45054d,null));};exports['update']=function(_0x140fff,_0x124b1a){if(_0x140fff[_0x65b4('0x4d')]['id']){delete _0x140fff[_0x65b4('0x4d')]['id'];}return db['ServicenowAccount'][_0x65b4('0x4b')]({'where':{'id':_0x140fff[_0x65b4('0x48')]['id']}})[_0x65b4('0x27')](handleEntityNotFound(_0x124b1a,null))['then'](saveUpdates(_0x140fff['body'],null))['then'](respondWithResult(_0x124b1a,null))[_0x65b4('0x46')](handleError(_0x124b1a,null));};exports[_0x65b4('0x28')]=function(_0x1069f0,_0x40ed0d){return db[_0x65b4('0x4a')][_0x65b4('0x4b')]({'where':{'id':_0x1069f0['params']['id']}})[_0x65b4('0x27')](handleEntityNotFound(_0x40ed0d,null))[_0x65b4('0x27')](removeEntity(_0x40ed0d,null))[_0x65b4('0x46')](handleError(_0x40ed0d,null));};exports['getConfigurations']=function(_0x123d19,_0x465ad9,_0x29c823){var _0x260dee={};var _0x10bea9={};var _0x585980;var _0x3fb208;return db[_0x65b4('0x4a')][_0x65b4('0x4e')]({'where':{'id':_0x123d19[_0x65b4('0x48')]['id']}})[_0x65b4('0x27')](handleEntityNotFound(_0x465ad9,null))[_0x65b4('0x27')](function(_0x36fe67){if(_0x36fe67){_0x585980=_0x36fe67;_0x10bea9[_0x65b4('0x36')]=_[_0x65b4('0x49')](db[_0x65b4('0x4f')][_0x65b4('0x2f')]);_0x10bea9[_0x65b4('0x33')]=_[_0x65b4('0x49')](_0x123d19['query']);_0x10bea9['filters']=_[_0x65b4('0x35')](_0x10bea9[_0x65b4('0x36')],_0x10bea9[_0x65b4('0x33')]);_0x260dee[_0x65b4('0x38')]=_['intersection'](_0x10bea9[_0x65b4('0x36')],qs[_0x65b4('0x37')](_0x123d19['query'][_0x65b4('0x37')]));_0x260dee[_0x65b4('0x38')]=_0x260dee['attributes'][_0x65b4('0x39')]?_0x260dee[_0x65b4('0x38')]:_0x10bea9[_0x65b4('0x36')];_0x260dee[_0x65b4('0x3b')]=qs[_0x65b4('0x3c')](_0x123d19['query'][_0x65b4('0x3c')]);_0x260dee['where']=qs['filters'](_[_0x65b4('0x3e')](_0x123d19[_0x65b4('0x33')],_0x10bea9[_0x65b4('0x34')]));if(_0x123d19[_0x65b4('0x33')][_0x65b4('0x3f')]){_0x260dee[_0x65b4('0x3d')]=_[_0x65b4('0x40')](_0x260dee[_0x65b4('0x3d')],{'$or':_[_0x65b4('0x2e')](_0x260dee['attributes'],function(_0xff29cc){var _0x55615b={};_0x55615b[_0xff29cc]={'$like':'%'+_0x123d19['query']['filter']+'%'};return _0x55615b;})});}_0x260dee=_['merge']({},_0x260dee,_0x123d19[_0x65b4('0x42')]);return _0x585980[_0x65b4('0x50')](_0x260dee);}})[_0x65b4('0x27')](function(_0x162792){if(_0x162792){_0x3fb208=_0x162792[_0x65b4('0x39')];if(!_0x123d19[_0x65b4('0x33')][_0x65b4('0x3a')](_0x65b4('0x51'))){_0x260dee[_0x65b4('0x21')]=qs[_0x65b4('0x21')](_0x123d19[_0x65b4('0x33')][_0x65b4('0x21')]);_0x260dee[_0x65b4('0x23')]=qs[_0x65b4('0x23')](_0x123d19[_0x65b4('0x33')][_0x65b4('0x23')]);}return _0x585980[_0x65b4('0x50')](_0x260dee);}})[_0x65b4('0x27')](function(_0x40d857){if(_0x40d857){return _0x40d857?{'count':_0x3fb208,'rows':_0x40d857}:null;}})[_0x65b4('0x27')](respondWithResult(_0x465ad9,null))['catch'](handleError(_0x465ad9,null));};exports[_0x65b4('0x52')]=function(_0x2f9f8b,_0x3270a8,_0x10e0e3){if(_0x2f9f8b['body']['id']){delete _0x2f9f8b['body']['id'];}return db['ServicenowAccount'][_0x65b4('0x4e')]({'where':{'id':_0x2f9f8b[_0x65b4('0x48')]['id']}})['then'](handleEntityNotFound(_0x3270a8,null))['then'](function(_0x42c6d9){if(_0x42c6d9){_0x2f9f8b[_0x65b4('0x4d')][_0x65b4('0x53')]=_0x42c6d9['id'];_0x2f9f8b['body'][_0x65b4('0x54')]=integrations[_0x65b4('0x55')](_0x2f9f8b['body']['channel'],_0x2f9f8b[_0x65b4('0x4d')][_0x65b4('0x31')]);_0x2f9f8b['body']['Descriptions']=integrations[_0x65b4('0x56')](_0x2f9f8b[_0x65b4('0x4d')]['channel'],_0x2f9f8b[_0x65b4('0x4d')]['type']);return db[_0x65b4('0x4f')][_0x65b4('0x4c')](_0x2f9f8b[_0x65b4('0x4d')],{'include':[{'model':db['ServicenowField'],'as':_0x65b4('0x54')},{'model':db[_0x65b4('0x57')],'as':_0x65b4('0x58')}]});}return null;})[_0x65b4('0x27')](respondWithResult(_0x3270a8,null))[_0x65b4('0x46')](handleError(_0x3270a8,null));};exports['getFields']=function(_0x4d6b0d,_0x3c1f0e,_0x4814a7){var _0x49194f=[_0x65b4('0x59'),_0x65b4('0x5a'),'knowledge',_0x65b4('0x5b'),'close_code',_0x65b4('0x5c'),_0x65b4('0x5d'),'severity','category'];var _0x18e062=['parent','made_sla',_0x65b4('0x5e'),_0x65b4('0x5f'),_0x65b4('0x60'),_0x65b4('0x61'),_0x65b4('0x62'),_0x65b4('0x5a'),'approval_history','number',_0x65b4('0x63'),_0x65b4('0x64'),'opened_by',_0x65b4('0x65'),_0x65b4('0x66'),_0x65b4('0x67'),'state',_0x65b4('0x68'),_0x65b4('0x69'),_0x65b4('0x3b'),_0x65b4('0x6a'),_0x65b4('0x6b'),_0x65b4('0x6c'),'delivery_plan',_0x65b4('0x6d'),_0x65b4('0x6e'),_0x65b4('0x6f'),_0x65b4('0x70'),_0x65b4('0x71'),'sys_domain_path','rfc',_0x65b4('0x72'),'expected_start',_0x65b4('0x73'),_0x65b4('0x74'),_0x65b4('0x75'),_0x65b4('0x76'),_0x65b4('0x77'),_0x65b4('0x78'),_0x65b4('0x79'),'approval_set',_0x65b4('0x5b'),_0x65b4('0x7a'),'short_description','close_code',_0x65b4('0x7b'),_0x65b4('0x7c'),_0x65b4('0x7d'),'assignment_group',_0x65b4('0x7e'),'additional_assignee_list',_0x65b4('0x7f'),_0x65b4('0x80'),_0x65b4('0x5c'),'sys_class_name',_0x65b4('0x81'),_0x65b4('0x82'),_0x65b4('0x83'),_0x65b4('0x84'),_0x65b4('0x85'),_0x65b4('0x86'),_0x65b4('0x87'),_0x65b4('0x5d'),'urgency',_0x65b4('0x88'),_0x65b4('0x89'),_0x65b4('0x8a'),_0x65b4('0x8b'),_0x65b4('0x8c'),_0x65b4('0x8d'),_0x65b4('0x8e'),'sla_due','approval',_0x65b4('0x8f'),'due_date',_0x65b4('0x90'),'reopen_count',_0x65b4('0x91'),_0x65b4('0x92'),_0x65b4('0x93'),_0x65b4('0x94'),_0x65b4('0x95'),_0x65b4('0x96')];var _0x1750f5='';var _0x399ab3='';var _0x153cb4=[];var _0xbf17d4='';var _0x355e12='';var _0x4d52ee=[];var _0x226cb2='';var _0x497630='';var _0xdf18cf={};var _0x29be14='';return db['ServicenowAccount'][_0x65b4('0x4e')]({'where':{'id':_0x4d6b0d[_0x65b4('0x48')]['id']},'attributes':['id',_0x65b4('0x97'),_0x65b4('0x98'),_0x65b4('0x99'),_0x65b4('0x9a'),'serverUrl']})[_0x65b4('0x27')](handleEntityNotFound(_0x3c1f0e,null))[_0x65b4('0x27')](function(_0x34a99a){if(_0x34a99a){_0x29be14=_0x34a99a[_0x65b4('0x9a')];var _0x99b40a=_0x29be14[_0x65b4('0x9b')](-0x1);if(_0x99b40a==='/'){_0x29be14=_0x29be14[_0x65b4('0x9c')](0x0,_0x29be14[_0x65b4('0x9d')](_0x99b40a));}_0x497630=util[_0x65b4('0x9e')](_0x65b4('0x9f'),_0x29be14);_0x226cb2=util[_0x65b4('0x9e')](_0x65b4('0xa0'),_0x29be14);_0xdf18cf={'user':_0x34a99a[_0x65b4('0x97')],'pass':_0x34a99a[_0x65b4('0x98')]};var _0x2776c4={'method':_0x65b4('0xa1'),'uri':_0x497630+_0x65b4('0xa2'),'auth':_0xdf18cf,'json':!![]};return rp(_0x2776c4);}})[_0x65b4('0x27')](function(_0x393eef){if(_0x393eef[_0x65b4('0xa3')][_0x65b4('0x39')]>0x0){_0x1750f5=_0x393eef[_0x65b4('0xa3')];}console[_0x65b4('0xa4')](_0x65b4('0xa5'),_0x1750f5);_0x4d52ee=[];_0x399ab3=Object[_0x65b4('0xa6')]([],_0x1750f5);_[_0x65b4('0xa7')](_0x399ab3,function(_0x4bb8a9){return!_0x49194f[_0x65b4('0xa8')](_0x4bb8a9[_0x65b4('0x2b')]);});_0x399ab3[_0x65b4('0xa9')](function(_0x2a22a9){var _0xb8fdac=createFieldObject(_0x226cb2,_0xdf18cf,_0x2a22a9['internalType'],_0x2a22a9['name'],_0x2a22a9[_0x65b4('0xaa')],![]);_0x4d52ee[_0x65b4('0xab')](_0xb8fdac);});return Promise[_0x65b4('0xac')](_0x4d52ee);})[_0x65b4('0x27')](function(_0x1a6850){_0x153cb4=_0x1a6850;_0xbf17d4=Object[_0x65b4('0xa6')]([],_0x1750f5);console[_0x65b4('0xa4')](_0x65b4('0xad'),_0x1750f5);_[_0x65b4('0xa7')](_0xbf17d4,function(_0x1e7bde){return _0x18e062['includes'](_0x1e7bde[_0x65b4('0x2b')]);});console[_0x65b4('0xa4')](_0x65b4('0xae'),_0xbf17d4);_0x4d52ee=[];_0xbf17d4[_0x65b4('0xa9')](function(_0x54bd4f){var _0x562537=createFieldObject(_0x226cb2,_0xdf18cf,_0x54bd4f['internalType'],_0x54bd4f[_0x65b4('0x2b')],_0x54bd4f[_0x65b4('0xaa')],!![]);_0x4d52ee[_0x65b4('0xab')](_0x562537);});return Promise[_0x65b4('0xac')](_0x4d52ee);})[_0x65b4('0x27')](function(_0x24d911){_0x355e12=_0x24d911;var _0x5743b0=_0x153cb4[_0x65b4('0xaf')](_0x355e12);return{'count':_0x5743b0[_0x65b4('0x39')],'rows':_0x5743b0};})[_0x65b4('0x27')](respondWithResult(_0x3c1f0e,null))[_0x65b4('0x46')](function(_0x174304){console[_0x65b4('0xa4')]('ServiceNow\x20error:\x20'+_0x174304);var _0xce2efe=_0x4d6b0d[_0x65b4('0x33')][_0x65b4('0xb0')]?0x1f4:_0x174304['statusCode']||0x1f4;logger['error'](_0x174304[_0x65b4('0x2a')]);delete _0x174304['name'];if(_0xce2efe===0x191){_0xce2efe=0x190;}_0x3c1f0e[_0x65b4('0x1d')](_0xce2efe)[_0x65b4('0x2c')](_0x4d6b0d[_0x65b4('0x33')][_0x65b4('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x174304['statusCode']}:_0x174304);});};function createFieldObject(_0x21f0f8,_0x2fff85,_0x10fe40,_0x3576a4,_0x591144,_0x55a2ac){return new Promise(function(_0x12ba1f,_0x5a85e1){var _0x4366bd={'id':_0x3576a4,'name':_0x591144,'custom':_0x55a2ac};if(_0x10fe40===_0x65b4('0xb1')){_0x4366bd[_0x65b4('0x42')]=[{'name':_0x65b4('0xb2'),'value':_0x65b4('0xb3')},{'name':_0x65b4('0xb4'),'value':_0x65b4('0xb5')}];_0x12ba1f(_0x4366bd);}else{var _0x22ed25={'method':_0x65b4('0xa1'),'uri':_0x21f0f8+_0x65b4('0xb6')+_0x3576a4,'auth':_0x2fff85,'json':!![]};return rp(_0x22ed25)[_0x65b4('0x27')](function(_0x2646f1){var _0x2154cf=[];if(_0x2646f1['result'][_0x65b4('0x39')]>0x0){_0x2646f1[_0x65b4('0xa3')][_0x65b4('0xa9')](function(_0x62f30d){if(_0x62f30d[_0x65b4('0xb7')]===_0x65b4('0xb5')){var _0x44b97c={'name':_0x62f30d[_0x65b4('0xaa')],'value':_0x62f30d[_0x65b4('0xb8')]};_0x2154cf[_0x65b4('0xab')](_0x44b97c);}});}_0x4366bd[_0x65b4('0x42')]=_0x2154cf;if(_0x4366bd[_0x65b4('0x42')][_0x65b4('0x39')]>0x0){_0x12ba1f(_0x4366bd);}else{if(_0x55a2ac==![]){_0x12ba1f();}else{_0x12ba1f(_0x4366bd);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ffd4353..bee2eff 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 _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x455907,_0x1452a6){var _0x25b30b=function(_0x5e4a93){while(--_0x5e4a93){_0x455907['push'](_0x455907['shift']());}};_0x25b30b(++_0x1452a6);}(_0xb138,0x1dd));var _0x8b13=function(_0xd30b00,_0x168daa){_0xd30b00=_0xd30b00-0x0;var _0x1dc8fa=_0xb138[_0xd30b00];return _0x1dc8fa;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8b13('0xa')]=function(_0x13f7bd,_0x5d51b1){return _0x13f7bd[_0x8b13('0xb')](_0x8b13('0xc'),attributes,{'tableName':_0x8b13('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes'];(function(_0x5e09b1,_0x1e5456){var _0x50209b=function(_0x8f909){while(--_0x8f909){_0x5e09b1['push'](_0x5e09b1['shift']());}};_0x50209b(++_0x1e5456);}(_0xd8fb,0x99));var _0xbd8f=function(_0x48adfb,_0x55ac0c){_0x48adfb=_0x48adfb-0x0;var _0x5a425b=_0xd8fb[_0x48adfb];return _0x5a425b;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));var integrations=require(_0xbd8f('0x7'));module['exports']=function(_0x33d541,_0x4e97cf){return _0x33d541[_0xbd8f('0x8')]('ServicenowAccount',attributes,{'tableName':_0xbd8f('0x9'),'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 e72c498..dbd66aa 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 _0x5b76=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','ServicenowAccount,\x20%s,\x20%s','result','catch','ServicenowAccount','options','where','attributes','limit','map','include','model','GetServicenowAccount','stringify','ShowServicenowAccount','raw','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x22dd17,_0x56d249){var _0x517196=function(_0xdb7874){while(--_0xdb7874){_0x22dd17['push'](_0x22dd17['shift']());}};_0x517196(++_0x56d249);}(_0x5b76,0xba));var _0x65b7=function(_0x1dcc42,_0x2d45c6){_0x1dcc42=_0x1dcc42-0x0;var _0x5804d4=_0x5b76[_0x1dcc42];return _0x5804d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x65b7('0x0'));var BPromise=require(_0x65b7('0x1'));var rs=require(_0x65b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x65b7('0x4'))(_0x65b7('0x5'));var config=require(_0x65b7('0x6'));var jayson=require(_0x65b7('0x7'));var client=jayson[_0x65b7('0x8')][_0x65b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1eae42,_0x1f46a1,_0x4f223f){return new BPromise(function(_0x5298a6,_0x3da72a){return client['request'](_0x1eae42,_0x4f223f)[_0x65b7('0xa')](function(_0x152fa4){logger[_0x65b7('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x1f46a1,_0x65b7('0xc'));logger[_0x65b7('0xd')](_0x65b7('0xe'),_0x1f46a1,_0x65b7('0xc'),JSON['stringify'](_0x152fa4));if(_0x152fa4[_0x65b7('0xf')]){if(_0x152fa4['error']['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1f46a1,_0x152fa4[_0x65b7('0xf')][_0x65b7('0x10')]);return _0x3da72a(_0x152fa4[_0x65b7('0xf')][_0x65b7('0x10')]);}logger[_0x65b7('0xf')](_0x65b7('0x11'),_0x1f46a1,_0x152fa4[_0x65b7('0xf')][_0x65b7('0x10')]);return _0x5298a6(_0x152fa4[_0x65b7('0xf')][_0x65b7('0x10')]);}else{logger[_0x65b7('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x1f46a1,_0x65b7('0xc'));_0x5298a6(_0x152fa4[_0x65b7('0x12')][_0x65b7('0x10')]);}})[_0x65b7('0x13')](function(_0x2969b0){logger[_0x65b7('0xf')](_0x65b7('0x11'),_0x1f46a1,_0x2969b0);_0x3da72a(_0x2969b0);});});}exports['GetServicenowAccount']=function(_0x31a5d7){var _0x43e67f=this;return new Promise(function(_0x3fbb10,_0x20338e){return db[_0x65b7('0x14')]['findAll']({'raw':_0x31a5d7[_0x65b7('0x15')]?_0x31a5d7[_0x65b7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x31a5d7[_0x65b7('0x15')]?_0x31a5d7[_0x65b7('0x15')][_0x65b7('0x16')]||null:null,'attributes':_0x31a5d7[_0x65b7('0x15')]?_0x31a5d7['options'][_0x65b7('0x17')]||null:null,'limit':_0x31a5d7[_0x65b7('0x15')]?_0x31a5d7[_0x65b7('0x15')][_0x65b7('0x18')]||null:null,'include':_0x31a5d7['options']?_0x31a5d7[_0x65b7('0x15')]['include']?_[_0x65b7('0x19')](_0x31a5d7[_0x65b7('0x15')][_0x65b7('0x1a')],function(_0x4ba7fc){return{'model':db[_0x4ba7fc[_0x65b7('0x1b')]],'as':_0x4ba7fc['as'],'attributes':_0x4ba7fc['attributes'],'include':_0x4ba7fc['include']?_[_0x65b7('0x19')](_0x4ba7fc[_0x65b7('0x1a')],function(_0x3fae32){return{'model':db[_0x3fae32[_0x65b7('0x1b')]],'as':_0x3fae32['as'],'attributes':_0x3fae32[_0x65b7('0x17')],'include':_0x3fae32[_0x65b7('0x1a')]?_['map'](_0x3fae32[_0x65b7('0x1a')],function(_0x2498a7){return{'model':db[_0x2498a7[_0x65b7('0x1b')]],'as':_0x2498a7['as'],'attributes':_0x2498a7[_0x65b7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x65b7('0xa')](function(_0x3ac4c5){logger['info']('GetServicenowAccount',_0x31a5d7);logger[_0x65b7('0xd')](_0x65b7('0x1c'),_0x31a5d7,JSON[_0x65b7('0x1d')](_0x3ac4c5));_0x3fbb10(_0x3ac4c5);})[_0x65b7('0x13')](function(_0x14ab1e){logger[_0x65b7('0xf')](_0x65b7('0x1c'),_0x14ab1e[_0x65b7('0x10')],_0x31a5d7);_0x20338e(_0x43e67f['error'](0x1f4,_0x14ab1e[_0x65b7('0x10')]));});});};exports[_0x65b7('0x1e')]=function(_0x3696ba){var _0x43099b=this;return new Promise(function(_0x550e44,_0x45bf8c){return db[_0x65b7('0x14')]['find']({'raw':_0x3696ba[_0x65b7('0x15')]?_0x3696ba[_0x65b7('0x15')][_0x65b7('0x1f')]===undefined?!![]:![]:!![],'where':_0x3696ba[_0x65b7('0x15')]?_0x3696ba[_0x65b7('0x15')][_0x65b7('0x16')]||null:null,'attributes':_0x3696ba[_0x65b7('0x15')]?_0x3696ba[_0x65b7('0x15')][_0x65b7('0x17')]||null:null,'include':_0x3696ba[_0x65b7('0x15')]?_0x3696ba[_0x65b7('0x15')][_0x65b7('0x1a')]?_[_0x65b7('0x19')](_0x3696ba[_0x65b7('0x15')][_0x65b7('0x1a')],function(_0xc1467f){return{'model':db[_0xc1467f['model']],'as':_0xc1467f['as'],'attributes':_0xc1467f['attributes'],'include':_0xc1467f[_0x65b7('0x1a')]?_[_0x65b7('0x19')](_0xc1467f[_0x65b7('0x1a')],function(_0x2596ed){return{'model':db[_0x2596ed[_0x65b7('0x1b')]],'as':_0x2596ed['as'],'attributes':_0x2596ed['attributes'],'include':_0x2596ed[_0x65b7('0x1a')]?_[_0x65b7('0x19')](_0x2596ed[_0x65b7('0x1a')],function(_0x3f90c0){return{'model':db[_0x3f90c0[_0x65b7('0x1b')]],'as':_0x3f90c0['as'],'attributes':_0x3f90c0[_0x65b7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x65b7('0xa')](function(_0x1aef39){logger[_0x65b7('0xb')](_0x65b7('0x1e'),_0x3696ba);logger[_0x65b7('0xd')](_0x65b7('0x1e'),_0x3696ba,JSON[_0x65b7('0x1d')](_0x1aef39));_0x550e44(_0x1aef39);})[_0x65b7('0x13')](function(_0x2bb52d){logger['error']('ShowServicenowAccount',_0x2bb52d[_0x65b7('0x10')],_0x3696ba);_0x45bf8c(_0x43099b['error'](0x1f4,_0x2bb52d[_0x65b7('0x10')]));});});}; \ No newline at end of file +var _0xf4e1=['findAll','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ServicenowAccount'];(function(_0x503a61,_0x1a48f7){var _0x2202cb=function(_0x4e6fce){while(--_0x4e6fce){_0x503a61['push'](_0x503a61['shift']());}};_0x2202cb(++_0x1a48f7);}(_0xf4e1,0x13e));var _0x1f4e=function(_0x4bb061,_0x449692){_0x4bb061=_0x4bb061-0x0;var _0xa9f41f=_0xf4e1[_0x4bb061];return _0xa9f41f;};'use strict';var _=require(_0x1f4e('0x0'));var util=require(_0x1f4e('0x1'));var moment=require('moment');var BPromise=require(_0x1f4e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f4e('0x3'))['db'];var utils=require(_0x1f4e('0x4'));var logger=require('../../config/logger')(_0x1f4e('0x5'));var config=require('../../config/environment');var jayson=require(_0x1f4e('0x6'));var client=jayson[_0x1f4e('0x7')][_0x1f4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x502ba1,_0x25eed5,_0x22ce77){return new BPromise(function(_0x463f77,_0x246bc2){return client[_0x1f4e('0x9')](_0x502ba1,_0x22ce77)['then'](function(_0x483d20){logger['info'](_0x1f4e('0xa'),_0x25eed5,_0x1f4e('0xb'));logger[_0x1f4e('0xc')](_0x1f4e('0xd'),_0x25eed5,'request\x20sent',JSON[_0x1f4e('0xe')](_0x483d20));if(_0x483d20[_0x1f4e('0xf')]){if(_0x483d20[_0x1f4e('0xf')][_0x1f4e('0x10')]===0x1f4){logger[_0x1f4e('0xf')](_0x1f4e('0xa'),_0x25eed5,_0x483d20[_0x1f4e('0xf')]['message']);return _0x246bc2(_0x483d20[_0x1f4e('0xf')]['message']);}logger['error'](_0x1f4e('0xa'),_0x25eed5,_0x483d20[_0x1f4e('0xf')][_0x1f4e('0x11')]);return _0x463f77(_0x483d20['error'][_0x1f4e('0x11')]);}else{logger[_0x1f4e('0x12')](_0x1f4e('0xa'),_0x25eed5,_0x1f4e('0xb'));_0x463f77(_0x483d20[_0x1f4e('0x13')][_0x1f4e('0x11')]);}})[_0x1f4e('0x14')](function(_0xbf532d){logger[_0x1f4e('0xf')](_0x1f4e('0xa'),_0x25eed5,_0xbf532d);_0x246bc2(_0xbf532d);});});}exports['GetServicenowAccount']=function(_0x8af8f3){var _0x2e0c57=this;return new Promise(function(_0x37c888,_0x1db3e0){return db[_0x1f4e('0x15')][_0x1f4e('0x16')]({'raw':_0x8af8f3['options']?_0x8af8f3[_0x1f4e('0x17')][_0x1f4e('0x18')]===undefined?!![]:![]:!![],'where':_0x8af8f3[_0x1f4e('0x17')]?_0x8af8f3['options'][_0x1f4e('0x19')]||null:null,'attributes':_0x8af8f3[_0x1f4e('0x17')]?_0x8af8f3[_0x1f4e('0x17')][_0x1f4e('0x1a')]||null:null,'limit':_0x8af8f3[_0x1f4e('0x17')]?_0x8af8f3['options'][_0x1f4e('0x1b')]||null:null,'include':_0x8af8f3['options']?_0x8af8f3['options'][_0x1f4e('0x1c')]?_[_0x1f4e('0x1d')](_0x8af8f3['options'][_0x1f4e('0x1c')],function(_0x1bce06){return{'model':db[_0x1bce06[_0x1f4e('0x1e')]],'as':_0x1bce06['as'],'attributes':_0x1bce06['attributes'],'include':_0x1bce06[_0x1f4e('0x1c')]?_[_0x1f4e('0x1d')](_0x1bce06[_0x1f4e('0x1c')],function(_0x43d768){return{'model':db[_0x43d768[_0x1f4e('0x1e')]],'as':_0x43d768['as'],'attributes':_0x43d768['attributes'],'include':_0x43d768[_0x1f4e('0x1c')]?_[_0x1f4e('0x1d')](_0x43d768[_0x1f4e('0x1c')],function(_0x4b4163){return{'model':db[_0x4b4163[_0x1f4e('0x1e')]],'as':_0x4b4163['as'],'attributes':_0x4b4163[_0x1f4e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x164730){logger['info'](_0x1f4e('0x1f'),_0x8af8f3);logger[_0x1f4e('0xc')](_0x1f4e('0x1f'),_0x8af8f3,JSON[_0x1f4e('0xe')](_0x164730));_0x37c888(_0x164730);})[_0x1f4e('0x14')](function(_0x5db536){logger[_0x1f4e('0xf')]('GetServicenowAccount',_0x5db536[_0x1f4e('0x11')],_0x8af8f3);_0x1db3e0(_0x2e0c57[_0x1f4e('0xf')](0x1f4,_0x5db536[_0x1f4e('0x11')]));});});};exports[_0x1f4e('0x20')]=function(_0x33318b){var _0x2a1666=this;return new Promise(function(_0x218699,_0x3b74b7){return db['ServicenowAccount'][_0x1f4e('0x21')]({'raw':_0x33318b['options']?_0x33318b[_0x1f4e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x33318b[_0x1f4e('0x17')]?_0x33318b[_0x1f4e('0x17')]['where']||null:null,'attributes':_0x33318b['options']?_0x33318b[_0x1f4e('0x17')]['attributes']||null:null,'include':_0x33318b['options']?_0x33318b[_0x1f4e('0x17')]['include']?_[_0x1f4e('0x1d')](_0x33318b[_0x1f4e('0x17')]['include'],function(_0x4f64d9){return{'model':db[_0x4f64d9[_0x1f4e('0x1e')]],'as':_0x4f64d9['as'],'attributes':_0x4f64d9[_0x1f4e('0x1a')],'include':_0x4f64d9[_0x1f4e('0x1c')]?_['map'](_0x4f64d9[_0x1f4e('0x1c')],function(_0x5150a7){return{'model':db[_0x5150a7[_0x1f4e('0x1e')]],'as':_0x5150a7['as'],'attributes':_0x5150a7[_0x1f4e('0x1a')],'include':_0x5150a7[_0x1f4e('0x1c')]?_[_0x1f4e('0x1d')](_0x5150a7[_0x1f4e('0x1c')],function(_0x50194){return{'model':db[_0x50194[_0x1f4e('0x1e')]],'as':_0x50194['as'],'attributes':_0x50194['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x12852a){logger[_0x1f4e('0x12')](_0x1f4e('0x20'),_0x33318b);logger['debug'](_0x1f4e('0x20'),_0x33318b,JSON[_0x1f4e('0xe')](_0x12852a));_0x218699(_0x12852a);})[_0x1f4e('0x14')](function(_0x5b3075){logger[_0x1f4e('0xf')]('ShowServicenowAccount',_0x5b3075['message'],_0x33318b);_0x3b74b7(_0x2a1666[_0x1f4e('0xf')](0x1f4,_0x5b3075[_0x1f4e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a8ed5a0..6e889fa 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 _0x66cb=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','delete','/:id','destroy','exports','multer'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0x66cb,0xbc));var _0xb66c=function(_0x2234cb,_0x3539cb){_0x2234cb=_0x2234cb-0x0;var _0x577c8b=_0x66cb[_0x2234cb];return _0x577c8b;};'use strict';var multer=require(_0xb66c('0x0'));var util=require('util');var path=require(_0xb66c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb66c('0x2')]();var fs_extra=require(_0xb66c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb66c('0x4'));var config=require(_0xb66c('0x5'));var controller=require(_0xb66c('0x6'));router[_0xb66c('0x7')]('/',auth[_0xb66c('0x8')](),controller[_0xb66c('0x9')]);router['get']('/:id',auth[_0xb66c('0x8')](),controller[_0xb66c('0xa')]);router[_0xb66c('0x7')](_0xb66c('0xb'),auth[_0xb66c('0x8')](),controller[_0xb66c('0xc')]);router[_0xb66c('0x7')]('/:id/subjects',auth[_0xb66c('0x8')](),controller[_0xb66c('0xd')]);router[_0xb66c('0x7')](_0xb66c('0xe'),auth[_0xb66c('0x8')](),controller['getDescriptions']);router[_0xb66c('0xf')]('/',auth[_0xb66c('0x8')](),controller[_0xb66c('0x10')]);router['put']('/:id',auth[_0xb66c('0x8')](),controller['update']);router[_0xb66c('0x11')](_0xb66c('0x12'),auth[_0xb66c('0x8')](),controller[_0xb66c('0x13')]);module[_0xb66c('0x14')]=router; \ No newline at end of file +var _0x83b3=['./intServicenowConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x83b3,0xb0));var _0x383b=function(_0x567b7a,_0x40d8fc){_0x567b7a=_0x567b7a-0x0;var _0x31d55b=_0x83b3[_0x567b7a];return _0x31d55b;};'use strict';var multer=require(_0x383b('0x0'));var util=require('util');var path=require(_0x383b('0x1'));var timeout=require(_0x383b('0x2'));var express=require(_0x383b('0x3'));var router=express[_0x383b('0x4')]();var fs_extra=require(_0x383b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x383b('0x6'));var config=require(_0x383b('0x7'));var controller=require(_0x383b('0x8'));router[_0x383b('0x9')]('/',auth[_0x383b('0xa')](),controller['index']);router[_0x383b('0x9')]('/:id',auth[_0x383b('0xa')](),controller[_0x383b('0xb')]);router[_0x383b('0x9')](_0x383b('0xc'),auth[_0x383b('0xa')](),controller[_0x383b('0xd')]);router[_0x383b('0x9')](_0x383b('0xe'),auth[_0x383b('0xa')](),controller['getSubjects']);router['get'](_0x383b('0xf'),auth[_0x383b('0xa')](),controller[_0x383b('0x10')]);router[_0x383b('0x11')]('/',auth[_0x383b('0xa')](),controller[_0x383b('0x12')]);router[_0x383b('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x383b('0x14')]('/:id',auth[_0x383b('0xa')](),controller[_0x383b('0x15')]);module[_0x383b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 97d251a..3b0f0d0 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 _0xd472=['sequelize'];(function(_0xb7e3dc,_0x1ab66e){var _0x3dfa0b=function(_0x268574){while(--_0x268574){_0xb7e3dc['push'](_0xb7e3dc['shift']());}};_0x3dfa0b(++_0x1ab66e);}(_0xd472,0x190));var _0x2d47=function(_0x22d926,_0x5c9e32){_0x22d926=_0x22d926-0x0;var _0x369030=_0xd472[_0x22d926];return _0x369030;};'use strict';var Sequelize=require(_0x2d47('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc204=['exports','STRING','sequelize'];(function(_0x1ad07b,_0x551d55){var _0x2c447f=function(_0x43340b){while(--_0x43340b){_0x1ad07b['push'](_0x1ad07b['shift']());}};_0x2c447f(++_0x551d55);}(_0xc204,0xa1));var _0x4c20=function(_0xc9be11,_0x3f2f2b){_0xc9be11=_0xc9be11-0x0;var _0x1a78a2=_0xc204[_0xc9be11];return _0x1a78a2;};'use strict';var Sequelize=require(_0x4c20('0x0'));module[_0x4c20('0x1')]={'name':{'type':Sequelize[_0x4c20('0x2')]},'description':{'type':Sequelize[_0x4c20('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e670972..afca1bb 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 _0x21ee=['Content-Range','json','reject','save','destroy','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','then','include','findAll','catch','show','params','keys','intersection','includeAll','options','create','body','find','getFields','findOne','filter','hasOwnProperty','getSubjects','ServicenowField','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x136026,_0x16ce48){var _0x55a090=function(_0x1c21c8){while(--_0x1c21c8){_0x136026['push'](_0x136026['shift']());}};_0x55a090(++_0x16ce48);}(_0x21ee,0xd1));var _0xe21e=function(_0x54f9ea,_0x13912f){_0x54f9ea=_0x54f9ea-0x0;var _0x590a38=_0x21ee[_0x54f9ea];return _0x590a38;};'use strict';var emlformat=require(_0xe21e('0x0'));var rimraf=require(_0xe21e('0x1'));var zipdir=require(_0xe21e('0x2'));var jsonpatch=require(_0xe21e('0x3'));var rp=require(_0xe21e('0x4'));var moment=require(_0xe21e('0x5'));var BPromise=require(_0xe21e('0x6'));var Mustache=require(_0xe21e('0x7'));var util=require(_0xe21e('0x8'));var path=require(_0xe21e('0x9'));var sox=require('sox');var csv=require(_0xe21e('0xa'));var ejs=require(_0xe21e('0xb'));var fs=require('fs');var fs_extra=require(_0xe21e('0xc'));var _=require(_0xe21e('0xd'));var squel=require(_0xe21e('0xe'));var crypto=require('crypto');var jsforce=require(_0xe21e('0xf'));var deskjs=require(_0xe21e('0x10'));var toCsv=require(_0xe21e('0xa'));var querystring=require(_0xe21e('0x11'));var Papa=require(_0xe21e('0x12'));var Redis=require(_0xe21e('0x13'));var authService=require(_0xe21e('0x14'));var qs=require(_0xe21e('0x15'));var as=require(_0xe21e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe21e('0x17'))(_0xe21e('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe21e('0x19'))['db'];function respondWithStatusCode(_0xad1709,_0x5131c7){_0x5131c7=_0x5131c7||0xcc;return function(_0x1b24b3){if(_0x1b24b3){return _0xad1709[_0xe21e('0x1a')](_0x5131c7);}return _0xad1709[_0xe21e('0x1b')](_0x5131c7)[_0xe21e('0x1c')]();};}function respondWithResult(_0xa8f34f,_0x573df1){_0x573df1=_0x573df1||0xc8;return function(_0xa70403){if(_0xa70403){return _0xa8f34f[_0xe21e('0x1b')](_0x573df1)['json'](_0xa70403);}};}function respondWithFilteredResult(_0x4bc152,_0x23f766){return function(_0x75e74d){if(_0x75e74d){var _0x353ce0=typeof _0x23f766[_0xe21e('0x1d')]===_0xe21e('0x1e')&&typeof _0x23f766[_0xe21e('0x1f')]==='undefined';var _0x46829e=_0x75e74d[_0xe21e('0x20')];var _0x123805=_0x353ce0?0x0:_0x23f766[_0xe21e('0x1d')];var _0x469c9b=_0x353ce0?_0x75e74d['count']:_0x23f766[_0xe21e('0x1d')]+_0x23f766['limit'];var _0xc9f154;if(_0x469c9b>=_0x46829e){_0x469c9b=_0x46829e;_0xc9f154=0xc8;}else{_0xc9f154=0xce;}_0x4bc152[_0xe21e('0x1b')](_0xc9f154);return _0x4bc152[_0xe21e('0x21')](_0xe21e('0x22'),_0x123805+'-'+_0x469c9b+'/'+_0x46829e)[_0xe21e('0x23')](_0x75e74d);}return null;};}function patchUpdates(_0x6d1522){return function(_0x45ceec){try{jsonpatch['apply'](_0x45ceec,_0x6d1522,!![]);}catch(_0x2575b4){return BPromise[_0xe21e('0x24')](_0x2575b4);}return _0x45ceec[_0xe21e('0x25')]();};}function saveUpdates(_0x562e27,_0x5e9962){return function(_0x29aeab){if(_0x29aeab){return _0x29aeab['update'](_0x562e27)['then'](function(_0x34d1ad){return _0x34d1ad;});}return null;};}function removeEntity(_0x9f058e,_0xdf0daa){return function(_0x4dab17){if(_0x4dab17){return _0x4dab17[_0xe21e('0x26')]()['then'](function(){_0x9f058e[_0xe21e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557061,_0x25ece1){return function(_0x3f2c99){if(!_0x3f2c99){_0x557061['sendStatus'](0x194);}return _0x3f2c99;};}function handleError(_0x1569e8,_0x2bd460){_0x2bd460=_0x2bd460||0x1f4;return function(_0x1736ce){logger[_0xe21e('0x27')](_0x1736ce[_0xe21e('0x28')]);if(_0x1736ce[_0xe21e('0x29')]){delete _0x1736ce[_0xe21e('0x29')];}_0x1569e8[_0xe21e('0x1b')](_0x2bd460)['send'](_0x1736ce);};}exports[_0xe21e('0x2a')]=function(_0x49c015,_0x55a055){var _0x19171b={},_0x3a05a7={},_0x5c454d={'count':0x0,'rows':[]};var _0x5e78b9=_[_0xe21e('0x2b')](db[_0xe21e('0x2c')][_0xe21e('0x2d')],function(_0x562229){return{'name':_0x562229[_0xe21e('0x2e')],'type':_0x562229[_0xe21e('0x2f')]['key']};});_0x3a05a7[_0xe21e('0x30')]=_[_0xe21e('0x2b')](_0x5e78b9,_0xe21e('0x29'));_0x3a05a7[_0xe21e('0x31')]=_['keys'](_0x49c015[_0xe21e('0x31')]);_0x3a05a7[_0xe21e('0x32')]=_['intersection'](_0x3a05a7[_0xe21e('0x30')],_0x3a05a7['query']);_0x19171b[_0xe21e('0x33')]=_['intersection'](_0x3a05a7[_0xe21e('0x30')],qs[_0xe21e('0x34')](_0x49c015[_0xe21e('0x31')][_0xe21e('0x34')]));_0x19171b[_0xe21e('0x33')]=_0x19171b[_0xe21e('0x33')][_0xe21e('0x35')]?_0x19171b['attributes']:_0x3a05a7[_0xe21e('0x30')];if(!_0x49c015['query']['hasOwnProperty'](_0xe21e('0x36'))){_0x19171b[_0xe21e('0x1f')]=qs[_0xe21e('0x1f')](_0x49c015[_0xe21e('0x31')][_0xe21e('0x1f')]);_0x19171b['offset']=qs[_0xe21e('0x1d')](_0x49c015[_0xe21e('0x31')][_0xe21e('0x1d')]);}_0x19171b['order']=qs[_0xe21e('0x37')](_0x49c015['query']['sort']);_0x19171b[_0xe21e('0x38')]=qs['filters'](_[_0xe21e('0x39')](_0x49c015[_0xe21e('0x31')],_0x3a05a7[_0xe21e('0x32')]),_0x5e78b9);if(_0x49c015[_0xe21e('0x31')]['filter']){_0x19171b[_0xe21e('0x38')]=_[_0xe21e('0x3a')](_0x19171b['where'],{'$or':_[_0xe21e('0x2b')](_0x5e78b9,function(_0x256c02){if(_0x256c02[_0xe21e('0x2f')]!==_0xe21e('0x3b')){var _0x1933b6={};_0x1933b6[_0x256c02[_0xe21e('0x29')]]={'$like':'%'+_0x49c015['query']['filter']+'%'};return _0x1933b6;}})});}_0x19171b=_[_0xe21e('0x3a')]({},_0x19171b,_0x49c015['options']);var _0x2efceb={'where':_0x19171b[_0xe21e('0x38')]};return db[_0xe21e('0x2c')][_0xe21e('0x20')](_0x2efceb)[_0xe21e('0x3c')](function(_0x382f9e){_0x5c454d[_0xe21e('0x20')]=_0x382f9e;if(_0x49c015['query']['includeAll']){_0x19171b[_0xe21e('0x3d')]=[{'all':!![]}];}return db[_0xe21e('0x2c')][_0xe21e('0x3e')](_0x19171b);})[_0xe21e('0x3c')](function(_0x59b57d){_0x5c454d['rows']=_0x59b57d;return _0x5c454d;})[_0xe21e('0x3c')](respondWithFilteredResult(_0x55a055,_0x19171b))[_0xe21e('0x3f')](handleError(_0x55a055,null));};exports[_0xe21e('0x40')]=function(_0x3c27aa,_0x55f620){var _0x2a17f4={'raw':![],'where':{'id':_0x3c27aa[_0xe21e('0x41')]['id']}},_0x1fbab7={};_0x1fbab7[_0xe21e('0x30')]=_[_0xe21e('0x42')](db[_0xe21e('0x2c')][_0xe21e('0x2d')]);_0x1fbab7[_0xe21e('0x31')]=_[_0xe21e('0x42')](_0x3c27aa['query']);_0x1fbab7['filters']=_[_0xe21e('0x43')](_0x1fbab7[_0xe21e('0x30')],_0x1fbab7[_0xe21e('0x31')]);_0x2a17f4[_0xe21e('0x33')]=_[_0xe21e('0x43')](_0x1fbab7[_0xe21e('0x30')],qs[_0xe21e('0x34')](_0x3c27aa[_0xe21e('0x31')][_0xe21e('0x34')]));_0x2a17f4[_0xe21e('0x33')]=_0x2a17f4[_0xe21e('0x33')]['length']?_0x2a17f4[_0xe21e('0x33')]:_0x1fbab7[_0xe21e('0x30')];if(_0x3c27aa['query'][_0xe21e('0x44')]){_0x2a17f4['include']=[{'all':!![]}];}_0x2a17f4=_[_0xe21e('0x3a')]({},_0x2a17f4,_0x3c27aa[_0xe21e('0x45')]);return db[_0xe21e('0x2c')]['find'](_0x2a17f4)[_0xe21e('0x3c')](handleEntityNotFound(_0x55f620,null))[_0xe21e('0x3c')](respondWithResult(_0x55f620,null))[_0xe21e('0x3f')](handleError(_0x55f620,null));};exports[_0xe21e('0x46')]=function(_0x2c4640,_0x4bda7){return db[_0xe21e('0x2c')][_0xe21e('0x46')](_0x2c4640[_0xe21e('0x47')],{})[_0xe21e('0x3c')](respondWithResult(_0x4bda7,0xc9))[_0xe21e('0x3f')](handleError(_0x4bda7,null));};exports['update']=function(_0x83225d,_0x5758d2){if(_0x83225d[_0xe21e('0x47')]['id']){delete _0x83225d[_0xe21e('0x47')]['id'];}return db[_0xe21e('0x2c')][_0xe21e('0x48')]({'where':{'id':_0x83225d[_0xe21e('0x41')]['id']}})[_0xe21e('0x3c')](handleEntityNotFound(_0x5758d2,null))['then'](saveUpdates(_0x83225d[_0xe21e('0x47')],null))[_0xe21e('0x3c')](respondWithResult(_0x5758d2,null))[_0xe21e('0x3f')](handleError(_0x5758d2,null));};exports['destroy']=function(_0x98fd0b,_0x59b2c8){return db[_0xe21e('0x2c')][_0xe21e('0x48')]({'where':{'id':_0x98fd0b['params']['id']}})[_0xe21e('0x3c')](handleEntityNotFound(_0x59b2c8,null))[_0xe21e('0x3c')](removeEntity(_0x59b2c8,null))[_0xe21e('0x3f')](handleError(_0x59b2c8,null));};exports[_0xe21e('0x49')]=function(_0x3f3f6d,_0x5b9d31,_0x626227){var _0x2fafbb={};var _0x1eaa12={};var _0x2f8045;var _0x416ff9;return db['ServicenowConfiguration'][_0xe21e('0x4a')]({'where':{'id':_0x3f3f6d['params']['id']}})['then'](handleEntityNotFound(_0x5b9d31,null))['then'](function(_0x4b4d35){if(_0x4b4d35){_0x2f8045=_0x4b4d35;_0x1eaa12[_0xe21e('0x30')]=_[_0xe21e('0x42')](db['ServicenowField'][_0xe21e('0x2d')]);_0x1eaa12[_0xe21e('0x31')]=_['keys'](_0x3f3f6d[_0xe21e('0x31')]);_0x1eaa12[_0xe21e('0x32')]=_[_0xe21e('0x43')](_0x1eaa12[_0xe21e('0x30')],_0x1eaa12[_0xe21e('0x31')]);_0x2fafbb[_0xe21e('0x33')]=_[_0xe21e('0x43')](_0x1eaa12['model'],qs['fields'](_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x34')]));_0x2fafbb[_0xe21e('0x33')]=_0x2fafbb[_0xe21e('0x33')][_0xe21e('0x35')]?_0x2fafbb[_0xe21e('0x33')]:_0x1eaa12['model'];_0x2fafbb['order']=qs[_0xe21e('0x37')](_0x3f3f6d[_0xe21e('0x31')]['sort']);_0x2fafbb[_0xe21e('0x38')]=qs[_0xe21e('0x32')](_[_0xe21e('0x39')](_0x3f3f6d['query'],_0x1eaa12['filters']));if(_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x4b')]){_0x2fafbb['where']=_['merge'](_0x2fafbb['where'],{'$or':_[_0xe21e('0x2b')](_0x2fafbb['attributes'],function(_0x3ec815){var _0x2762f3={};_0x2762f3[_0x3ec815]={'$like':'%'+_0x3f3f6d[_0xe21e('0x31')]['filter']+'%'};return _0x2762f3;})});}_0x2fafbb=_[_0xe21e('0x3a')]({},_0x2fafbb,_0x3f3f6d[_0xe21e('0x45')]);return _0x2f8045[_0xe21e('0x49')](_0x2fafbb);}})['then'](function(_0x5131eb){if(_0x5131eb){_0x416ff9=_0x5131eb[_0xe21e('0x35')];if(!_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x4c')](_0xe21e('0x36'))){_0x2fafbb[_0xe21e('0x1f')]=qs[_0xe21e('0x1f')](_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x1f')]);_0x2fafbb[_0xe21e('0x1d')]=qs[_0xe21e('0x1d')](_0x3f3f6d[_0xe21e('0x31')][_0xe21e('0x1d')]);}return _0x2f8045[_0xe21e('0x49')](_0x2fafbb);}})[_0xe21e('0x3c')](function(_0x43d2f5){if(_0x43d2f5){return _0x43d2f5?{'count':_0x416ff9,'rows':_0x43d2f5}:null;}})[_0xe21e('0x3c')](respondWithResult(_0x5b9d31,null))[_0xe21e('0x3f')](handleError(_0x5b9d31,null));};exports['getSubjects']=function(_0x3c1bf8,_0x2acaaa,_0x1c0291){var _0x5f808a={};var _0x3a252e={};var _0x5da4c7;var _0x5b7dd9;return db[_0xe21e('0x2c')][_0xe21e('0x4a')]({'where':{'id':_0x3c1bf8[_0xe21e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2acaaa,null))[_0xe21e('0x3c')](function(_0x8740d4){if(_0x8740d4){_0x5da4c7=_0x8740d4;_0x3a252e['model']=_[_0xe21e('0x42')](db['ServicenowField'][_0xe21e('0x2d')]);_0x3a252e['query']=_[_0xe21e('0x42')](_0x3c1bf8[_0xe21e('0x31')]);_0x3a252e[_0xe21e('0x32')]=_[_0xe21e('0x43')](_0x3a252e[_0xe21e('0x30')],_0x3a252e[_0xe21e('0x31')]);_0x5f808a[_0xe21e('0x33')]=_[_0xe21e('0x43')](_0x3a252e[_0xe21e('0x30')],qs['fields'](_0x3c1bf8['query']['fields']));_0x5f808a[_0xe21e('0x33')]=_0x5f808a[_0xe21e('0x33')][_0xe21e('0x35')]?_0x5f808a['attributes']:_0x3a252e[_0xe21e('0x30')];_0x5f808a['order']=qs[_0xe21e('0x37')](_0x3c1bf8[_0xe21e('0x31')][_0xe21e('0x37')]);_0x5f808a[_0xe21e('0x38')]=qs[_0xe21e('0x32')](_['pick'](_0x3c1bf8[_0xe21e('0x31')],_0x3a252e['filters']));if(_0x3c1bf8['query'][_0xe21e('0x4b')]){_0x5f808a[_0xe21e('0x38')]=_['merge'](_0x5f808a[_0xe21e('0x38')],{'$or':_[_0xe21e('0x2b')](_0x5f808a[_0xe21e('0x33')],function(_0x51c38a){var _0x4c5f78={};_0x4c5f78[_0x51c38a]={'$like':'%'+_0x3c1bf8[_0xe21e('0x31')]['filter']+'%'};return _0x4c5f78;})});}_0x5f808a=_[_0xe21e('0x3a')]({},_0x5f808a,_0x3c1bf8[_0xe21e('0x45')]);return _0x5da4c7['getSubjects'](_0x5f808a);}})['then'](function(_0x3eab10){if(_0x3eab10){_0x5b7dd9=_0x3eab10['length'];if(!_0x3c1bf8['query'][_0xe21e('0x4c')](_0xe21e('0x36'))){_0x5f808a[_0xe21e('0x1f')]=qs[_0xe21e('0x1f')](_0x3c1bf8['query'][_0xe21e('0x1f')]);_0x5f808a['offset']=qs[_0xe21e('0x1d')](_0x3c1bf8[_0xe21e('0x31')][_0xe21e('0x1d')]);}return _0x5da4c7[_0xe21e('0x4d')](_0x5f808a);}})[_0xe21e('0x3c')](function(_0xc88018){if(_0xc88018){return _0xc88018?{'count':_0x5b7dd9,'rows':_0xc88018}:null;}})[_0xe21e('0x3c')](respondWithResult(_0x2acaaa,null))['catch'](handleError(_0x2acaaa,null));};exports['getDescriptions']=function(_0x4a862e,_0xd1e5ae,_0x2338b7){var _0x147a17={};var _0x159625={};var _0x27ec34;var _0x27113a;return db[_0xe21e('0x2c')][_0xe21e('0x4a')]({'where':{'id':_0x4a862e[_0xe21e('0x41')]['id']}})[_0xe21e('0x3c')](handleEntityNotFound(_0xd1e5ae,null))[_0xe21e('0x3c')](function(_0x68b043){if(_0x68b043){_0x27ec34=_0x68b043;_0x159625[_0xe21e('0x30')]=_[_0xe21e('0x42')](db[_0xe21e('0x4e')][_0xe21e('0x2d')]);_0x159625[_0xe21e('0x31')]=_[_0xe21e('0x42')](_0x4a862e['query']);_0x159625[_0xe21e('0x32')]=_[_0xe21e('0x43')](_0x159625['model'],_0x159625[_0xe21e('0x31')]);_0x147a17[_0xe21e('0x33')]=_[_0xe21e('0x43')](_0x159625[_0xe21e('0x30')],qs[_0xe21e('0x34')](_0x4a862e[_0xe21e('0x31')][_0xe21e('0x34')]));_0x147a17[_0xe21e('0x33')]=_0x147a17[_0xe21e('0x33')][_0xe21e('0x35')]?_0x147a17['attributes']:_0x159625['model'];_0x147a17[_0xe21e('0x4f')]=qs[_0xe21e('0x37')](_0x4a862e[_0xe21e('0x31')]['sort']);_0x147a17[_0xe21e('0x38')]=qs['filters'](_[_0xe21e('0x39')](_0x4a862e[_0xe21e('0x31')],_0x159625[_0xe21e('0x32')]));if(_0x4a862e['query'][_0xe21e('0x4b')]){_0x147a17['where']=_['merge'](_0x147a17[_0xe21e('0x38')],{'$or':_['map'](_0x147a17[_0xe21e('0x33')],function(_0x26be0f){var _0x13efa9={};_0x13efa9[_0x26be0f]={'$like':'%'+_0x4a862e[_0xe21e('0x31')][_0xe21e('0x4b')]+'%'};return _0x13efa9;})});}_0x147a17=_[_0xe21e('0x3a')]({},_0x147a17,_0x4a862e[_0xe21e('0x45')]);return _0x27ec34['getDescriptions'](_0x147a17);}})['then'](function(_0x2759bf){if(_0x2759bf){_0x27113a=_0x2759bf['length'];if(!_0x4a862e[_0xe21e('0x31')][_0xe21e('0x4c')](_0xe21e('0x36'))){_0x147a17[_0xe21e('0x1f')]=qs['limit'](_0x4a862e[_0xe21e('0x31')][_0xe21e('0x1f')]);_0x147a17[_0xe21e('0x1d')]=qs[_0xe21e('0x1d')](_0x4a862e[_0xe21e('0x31')][_0xe21e('0x1d')]);}return _0x27ec34[_0xe21e('0x50')](_0x147a17);}})[_0xe21e('0x3c')](function(_0x335863){if(_0x335863){return _0x335863?{'count':_0x27113a,'rows':_0x335863}:null;}})['then'](respondWithResult(_0xd1e5ae,null))[_0xe21e('0x3f')](handleError(_0xd1e5ae,null));}; \ No newline at end of file +var _0x2929=['options','includeAll','include','catch','create','body','find','params','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x36ab71,_0x1fc7d6){var _0x36005d=function(_0x149114){while(--_0x149114){_0x36ab71['push'](_0x36ab71['shift']());}};_0x36005d(++_0x1fc7d6);}(_0x2929,0x149));var _0x9292=function(_0x17f7aa,_0xc542b7){_0x17f7aa=_0x17f7aa-0x0;var _0xcd9468=_0x2929[_0x17f7aa];return _0xcd9468;};'use strict';var emlformat=require(_0x9292('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9292('0x1'));var jsonpatch=require(_0x9292('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9292('0x3'));var Mustache=require(_0x9292('0x4'));var util=require('util');var path=require(_0x9292('0x5'));var sox=require('sox');var csv=require(_0x9292('0x6'));var ejs=require(_0x9292('0x7'));var fs=require('fs');var fs_extra=require(_0x9292('0x8'));var _=require(_0x9292('0x9'));var squel=require('squel');var crypto=require(_0x9292('0xa'));var jsforce=require(_0x9292('0xb'));var deskjs=require(_0x9292('0xc'));var toCsv=require(_0x9292('0x6'));var querystring=require('querystring');var Papa=require(_0x9292('0xd'));var Redis=require(_0x9292('0xe'));var authService=require(_0x9292('0xf'));var qs=require(_0x9292('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9292('0x11'));var logger=require('../../config/logger')(_0x9292('0x12'));var utils=require(_0x9292('0x13'));var config=require(_0x9292('0x14'));var licenseUtil=require(_0x9292('0x15'));var db=require(_0x9292('0x16'))['db'];function respondWithStatusCode(_0x4ce35f,_0x38428b){_0x38428b=_0x38428b||0xcc;return function(_0x14a0f6){if(_0x14a0f6){return _0x4ce35f[_0x9292('0x17')](_0x38428b);}return _0x4ce35f[_0x9292('0x18')](_0x38428b)[_0x9292('0x19')]();};}function respondWithResult(_0x2ec585,_0x1b9bbb){_0x1b9bbb=_0x1b9bbb||0xc8;return function(_0x506070){if(_0x506070){return _0x2ec585['status'](_0x1b9bbb)[_0x9292('0x1a')](_0x506070);}};}function respondWithFilteredResult(_0xb17d81,_0x2b1e27){return function(_0x42853b){if(_0x42853b){var _0x399c55=typeof _0x2b1e27[_0x9292('0x1b')]===_0x9292('0x1c')&&typeof _0x2b1e27['limit']===_0x9292('0x1c');var _0x2e2af3=_0x42853b['count'];var _0x175c94=_0x399c55?0x0:_0x2b1e27['offset'];var _0x825449=_0x399c55?_0x42853b[_0x9292('0x1d')]:_0x2b1e27['offset']+_0x2b1e27[_0x9292('0x1e')];var _0x358258;if(_0x825449>=_0x2e2af3){_0x825449=_0x2e2af3;_0x358258=0xc8;}else{_0x358258=0xce;}_0xb17d81[_0x9292('0x18')](_0x358258);return _0xb17d81[_0x9292('0x1f')]('Content-Range',_0x175c94+'-'+_0x825449+'/'+_0x2e2af3)[_0x9292('0x1a')](_0x42853b);}return null;};}function patchUpdates(_0x3f66d1){return function(_0x59b7ec){try{jsonpatch[_0x9292('0x20')](_0x59b7ec,_0x3f66d1,!![]);}catch(_0x29d154){return BPromise[_0x9292('0x21')](_0x29d154);}return _0x59b7ec[_0x9292('0x22')]();};}function saveUpdates(_0x4eb042,_0x3dddd0){return function(_0x53690b){if(_0x53690b){return _0x53690b[_0x9292('0x23')](_0x4eb042)[_0x9292('0x24')](function(_0x261cad){return _0x261cad;});}return null;};}function removeEntity(_0x1bc6fb,_0x1545db){return function(_0x19b462){if(_0x19b462){return _0x19b462[_0x9292('0x25')]()[_0x9292('0x24')](function(){_0x1bc6fb[_0x9292('0x18')](0xcc)[_0x9292('0x19')]();});}};}function handleEntityNotFound(_0x42266f,_0x3c208f){return function(_0x315097){if(!_0x315097){_0x42266f[_0x9292('0x17')](0x194);}return _0x315097;};}function handleError(_0x4ef168,_0xf25d99){_0xf25d99=_0xf25d99||0x1f4;return function(_0x58c020){logger[_0x9292('0x26')](_0x58c020[_0x9292('0x27')]);if(_0x58c020['name']){delete _0x58c020[_0x9292('0x28')];}_0x4ef168['status'](_0xf25d99)[_0x9292('0x29')](_0x58c020);};}exports[_0x9292('0x2a')]=function(_0x39d8ed,_0x55d3c5){var _0x21f407={},_0x201466={},_0x25683c={'count':0x0,'rows':[]};var _0x27cefe=_['map'](db[_0x9292('0x2b')][_0x9292('0x2c')],function(_0x5a8c96){return{'name':_0x5a8c96[_0x9292('0x2d')],'type':_0x5a8c96[_0x9292('0x2e')][_0x9292('0x2f')]};});_0x201466[_0x9292('0x30')]=_[_0x9292('0x31')](_0x27cefe,_0x9292('0x28'));_0x201466[_0x9292('0x32')]=_[_0x9292('0x33')](_0x39d8ed[_0x9292('0x32')]);_0x201466[_0x9292('0x34')]=_[_0x9292('0x35')](_0x201466[_0x9292('0x30')],_0x201466[_0x9292('0x32')]);_0x21f407['attributes']=_[_0x9292('0x35')](_0x201466[_0x9292('0x30')],qs[_0x9292('0x36')](_0x39d8ed[_0x9292('0x32')][_0x9292('0x36')]));_0x21f407[_0x9292('0x37')]=_0x21f407['attributes'][_0x9292('0x38')]?_0x21f407[_0x9292('0x37')]:_0x201466[_0x9292('0x30')];if(!_0x39d8ed['query'][_0x9292('0x39')](_0x9292('0x3a'))){_0x21f407[_0x9292('0x1e')]=qs[_0x9292('0x1e')](_0x39d8ed[_0x9292('0x32')][_0x9292('0x1e')]);_0x21f407['offset']=qs['offset'](_0x39d8ed['query'][_0x9292('0x1b')]);}_0x21f407[_0x9292('0x3b')]=qs[_0x9292('0x3c')](_0x39d8ed['query']['sort']);_0x21f407[_0x9292('0x3d')]=qs['filters'](_[_0x9292('0x3e')](_0x39d8ed[_0x9292('0x32')],_0x201466['filters']),_0x27cefe);if(_0x39d8ed[_0x9292('0x32')][_0x9292('0x3f')]){_0x21f407[_0x9292('0x3d')]=_[_0x9292('0x40')](_0x21f407[_0x9292('0x3d')],{'$or':_[_0x9292('0x31')](_0x27cefe,function(_0x10fe58){if(_0x10fe58[_0x9292('0x2e')]!==_0x9292('0x41')){var _0x4a7a47={};_0x4a7a47[_0x10fe58['name']]={'$like':'%'+_0x39d8ed[_0x9292('0x32')][_0x9292('0x3f')]+'%'};return _0x4a7a47;}})});}_0x21f407=_[_0x9292('0x40')]({},_0x21f407,_0x39d8ed[_0x9292('0x42')]);var _0x30fb72={'where':_0x21f407[_0x9292('0x3d')]};return db['ServicenowConfiguration'][_0x9292('0x1d')](_0x30fb72)['then'](function(_0x532df0){_0x25683c['count']=_0x532df0;if(_0x39d8ed[_0x9292('0x32')][_0x9292('0x43')]){_0x21f407[_0x9292('0x44')]=[{'all':!![]}];}return db[_0x9292('0x2b')]['findAll'](_0x21f407);})[_0x9292('0x24')](function(_0x316c51){_0x25683c['rows']=_0x316c51;return _0x25683c;})[_0x9292('0x24')](respondWithFilteredResult(_0x55d3c5,_0x21f407))['catch'](handleError(_0x55d3c5,null));};exports['show']=function(_0x1221dc,_0x80fbaa){var _0x478101={'raw':![],'where':{'id':_0x1221dc['params']['id']}},_0x133504={};_0x133504[_0x9292('0x30')]=_[_0x9292('0x33')](db[_0x9292('0x2b')][_0x9292('0x2c')]);_0x133504[_0x9292('0x32')]=_[_0x9292('0x33')](_0x1221dc[_0x9292('0x32')]);_0x133504[_0x9292('0x34')]=_[_0x9292('0x35')](_0x133504[_0x9292('0x30')],_0x133504[_0x9292('0x32')]);_0x478101['attributes']=_[_0x9292('0x35')](_0x133504[_0x9292('0x30')],qs[_0x9292('0x36')](_0x1221dc[_0x9292('0x32')][_0x9292('0x36')]));_0x478101[_0x9292('0x37')]=_0x478101[_0x9292('0x37')][_0x9292('0x38')]?_0x478101[_0x9292('0x37')]:_0x133504[_0x9292('0x30')];if(_0x1221dc[_0x9292('0x32')]['includeAll']){_0x478101['include']=[{'all':!![]}];}_0x478101=_['merge']({},_0x478101,_0x1221dc[_0x9292('0x42')]);return db[_0x9292('0x2b')]['find'](_0x478101)[_0x9292('0x24')](handleEntityNotFound(_0x80fbaa,null))[_0x9292('0x24')](respondWithResult(_0x80fbaa,null))[_0x9292('0x45')](handleError(_0x80fbaa,null));};exports['create']=function(_0x4328b4,_0x4d007f){return db[_0x9292('0x2b')][_0x9292('0x46')](_0x4328b4[_0x9292('0x47')],{})[_0x9292('0x24')](respondWithResult(_0x4d007f,0xc9))[_0x9292('0x45')](handleError(_0x4d007f,null));};exports[_0x9292('0x23')]=function(_0x590732,_0x511e80){if(_0x590732[_0x9292('0x47')]['id']){delete _0x590732[_0x9292('0x47')]['id'];}return db[_0x9292('0x2b')][_0x9292('0x48')]({'where':{'id':_0x590732[_0x9292('0x49')]['id']}})[_0x9292('0x24')](handleEntityNotFound(_0x511e80,null))[_0x9292('0x24')](saveUpdates(_0x590732[_0x9292('0x47')],null))['then'](respondWithResult(_0x511e80,null))[_0x9292('0x45')](handleError(_0x511e80,null));};exports['destroy']=function(_0x2032ba,_0x1fb0d7){return db[_0x9292('0x2b')][_0x9292('0x48')]({'where':{'id':_0x2032ba['params']['id']}})[_0x9292('0x24')](handleEntityNotFound(_0x1fb0d7,null))[_0x9292('0x24')](removeEntity(_0x1fb0d7,null))[_0x9292('0x45')](handleError(_0x1fb0d7,null));};exports['getFields']=function(_0x271f51,_0x4292ba,_0x3d06da){var _0x3e27b0={};var _0x43613c={};var _0x269505;var _0x382f6c;return db[_0x9292('0x2b')][_0x9292('0x4a')]({'where':{'id':_0x271f51[_0x9292('0x49')]['id']}})[_0x9292('0x24')](handleEntityNotFound(_0x4292ba,null))[_0x9292('0x24')](function(_0x6620d3){if(_0x6620d3){_0x269505=_0x6620d3;_0x43613c[_0x9292('0x30')]=_[_0x9292('0x33')](db[_0x9292('0x4b')]['rawAttributes']);_0x43613c[_0x9292('0x32')]=_[_0x9292('0x33')](_0x271f51[_0x9292('0x32')]);_0x43613c['filters']=_[_0x9292('0x35')](_0x43613c['model'],_0x43613c[_0x9292('0x32')]);_0x3e27b0[_0x9292('0x37')]=_[_0x9292('0x35')](_0x43613c['model'],qs[_0x9292('0x36')](_0x271f51[_0x9292('0x32')][_0x9292('0x36')]));_0x3e27b0[_0x9292('0x37')]=_0x3e27b0[_0x9292('0x37')][_0x9292('0x38')]?_0x3e27b0['attributes']:_0x43613c[_0x9292('0x30')];_0x3e27b0[_0x9292('0x3b')]=qs['sort'](_0x271f51[_0x9292('0x32')]['sort']);_0x3e27b0[_0x9292('0x3d')]=qs[_0x9292('0x34')](_['pick'](_0x271f51['query'],_0x43613c['filters']));if(_0x271f51[_0x9292('0x32')][_0x9292('0x3f')]){_0x3e27b0[_0x9292('0x3d')]=_[_0x9292('0x40')](_0x3e27b0[_0x9292('0x3d')],{'$or':_[_0x9292('0x31')](_0x3e27b0[_0x9292('0x37')],function(_0x49b1a1){var _0x20f30d={};_0x20f30d[_0x49b1a1]={'$like':'%'+_0x271f51[_0x9292('0x32')]['filter']+'%'};return _0x20f30d;})});}_0x3e27b0=_[_0x9292('0x40')]({},_0x3e27b0,_0x271f51[_0x9292('0x42')]);return _0x269505[_0x9292('0x4c')](_0x3e27b0);}})[_0x9292('0x24')](function(_0x11bbab){if(_0x11bbab){_0x382f6c=_0x11bbab[_0x9292('0x38')];if(!_0x271f51[_0x9292('0x32')]['hasOwnProperty'](_0x9292('0x3a'))){_0x3e27b0[_0x9292('0x1e')]=qs[_0x9292('0x1e')](_0x271f51[_0x9292('0x32')][_0x9292('0x1e')]);_0x3e27b0[_0x9292('0x1b')]=qs['offset'](_0x271f51[_0x9292('0x32')][_0x9292('0x1b')]);}return _0x269505[_0x9292('0x4c')](_0x3e27b0);}})[_0x9292('0x24')](function(_0x5b08e1){if(_0x5b08e1){return _0x5b08e1?{'count':_0x382f6c,'rows':_0x5b08e1}:null;}})['then'](respondWithResult(_0x4292ba,null))['catch'](handleError(_0x4292ba,null));};exports['getSubjects']=function(_0x43f582,_0x3ee3ee,_0xcfdd9b){var _0xe10be6={};var _0x2f5a89={};var _0x376ce8;var _0x28cb6e;return db[_0x9292('0x2b')][_0x9292('0x4a')]({'where':{'id':_0x43f582[_0x9292('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ee3ee,null))[_0x9292('0x24')](function(_0x46a089){if(_0x46a089){_0x376ce8=_0x46a089;_0x2f5a89[_0x9292('0x30')]=_[_0x9292('0x33')](db[_0x9292('0x4b')][_0x9292('0x2c')]);_0x2f5a89[_0x9292('0x32')]=_[_0x9292('0x33')](_0x43f582[_0x9292('0x32')]);_0x2f5a89[_0x9292('0x34')]=_[_0x9292('0x35')](_0x2f5a89[_0x9292('0x30')],_0x2f5a89[_0x9292('0x32')]);_0xe10be6[_0x9292('0x37')]=_['intersection'](_0x2f5a89['model'],qs[_0x9292('0x36')](_0x43f582[_0x9292('0x32')][_0x9292('0x36')]));_0xe10be6[_0x9292('0x37')]=_0xe10be6[_0x9292('0x37')][_0x9292('0x38')]?_0xe10be6['attributes']:_0x2f5a89[_0x9292('0x30')];_0xe10be6[_0x9292('0x3b')]=qs[_0x9292('0x3c')](_0x43f582[_0x9292('0x32')][_0x9292('0x3c')]);_0xe10be6['where']=qs[_0x9292('0x34')](_[_0x9292('0x3e')](_0x43f582[_0x9292('0x32')],_0x2f5a89['filters']));if(_0x43f582[_0x9292('0x32')][_0x9292('0x3f')]){_0xe10be6[_0x9292('0x3d')]=_[_0x9292('0x40')](_0xe10be6['where'],{'$or':_[_0x9292('0x31')](_0xe10be6[_0x9292('0x37')],function(_0x419435){var _0x1cb97a={};_0x1cb97a[_0x419435]={'$like':'%'+_0x43f582[_0x9292('0x32')][_0x9292('0x3f')]+'%'};return _0x1cb97a;})});}_0xe10be6=_[_0x9292('0x40')]({},_0xe10be6,_0x43f582[_0x9292('0x42')]);return _0x376ce8[_0x9292('0x4d')](_0xe10be6);}})[_0x9292('0x24')](function(_0x20bc4a){if(_0x20bc4a){_0x28cb6e=_0x20bc4a[_0x9292('0x38')];if(!_0x43f582[_0x9292('0x32')][_0x9292('0x39')](_0x9292('0x3a'))){_0xe10be6[_0x9292('0x1e')]=qs[_0x9292('0x1e')](_0x43f582[_0x9292('0x32')]['limit']);_0xe10be6[_0x9292('0x1b')]=qs[_0x9292('0x1b')](_0x43f582[_0x9292('0x32')][_0x9292('0x1b')]);}return _0x376ce8[_0x9292('0x4d')](_0xe10be6);}})[_0x9292('0x24')](function(_0x44d371){if(_0x44d371){return _0x44d371?{'count':_0x28cb6e,'rows':_0x44d371}:null;}})['then'](respondWithResult(_0x3ee3ee,null))[_0x9292('0x45')](handleError(_0x3ee3ee,null));};exports['getDescriptions']=function(_0x4c582b,_0x5ea532,_0x149798){var _0xf0f67f={};var _0x3b8ac9={};var _0x186b4a;var _0x4f5c24;return db['ServicenowConfiguration'][_0x9292('0x4a')]({'where':{'id':_0x4c582b[_0x9292('0x49')]['id']}})[_0x9292('0x24')](handleEntityNotFound(_0x5ea532,null))[_0x9292('0x24')](function(_0x2cd1cf){if(_0x2cd1cf){_0x186b4a=_0x2cd1cf;_0x3b8ac9[_0x9292('0x30')]=_['keys'](db[_0x9292('0x4b')][_0x9292('0x2c')]);_0x3b8ac9[_0x9292('0x32')]=_['keys'](_0x4c582b['query']);_0x3b8ac9[_0x9292('0x34')]=_[_0x9292('0x35')](_0x3b8ac9[_0x9292('0x30')],_0x3b8ac9['query']);_0xf0f67f['attributes']=_[_0x9292('0x35')](_0x3b8ac9[_0x9292('0x30')],qs[_0x9292('0x36')](_0x4c582b[_0x9292('0x32')][_0x9292('0x36')]));_0xf0f67f[_0x9292('0x37')]=_0xf0f67f[_0x9292('0x37')][_0x9292('0x38')]?_0xf0f67f[_0x9292('0x37')]:_0x3b8ac9[_0x9292('0x30')];_0xf0f67f[_0x9292('0x3b')]=qs[_0x9292('0x3c')](_0x4c582b[_0x9292('0x32')]['sort']);_0xf0f67f['where']=qs[_0x9292('0x34')](_[_0x9292('0x3e')](_0x4c582b['query'],_0x3b8ac9[_0x9292('0x34')]));if(_0x4c582b[_0x9292('0x32')][_0x9292('0x3f')]){_0xf0f67f[_0x9292('0x3d')]=_[_0x9292('0x40')](_0xf0f67f[_0x9292('0x3d')],{'$or':_[_0x9292('0x31')](_0xf0f67f[_0x9292('0x37')],function(_0x4a027d){var _0x2a9a28={};_0x2a9a28[_0x4a027d]={'$like':'%'+_0x4c582b[_0x9292('0x32')]['filter']+'%'};return _0x2a9a28;})});}_0xf0f67f=_['merge']({},_0xf0f67f,_0x4c582b[_0x9292('0x42')]);return _0x186b4a[_0x9292('0x4e')](_0xf0f67f);}})[_0x9292('0x24')](function(_0x3381b3){if(_0x3381b3){_0x4f5c24=_0x3381b3['length'];if(!_0x4c582b[_0x9292('0x32')]['hasOwnProperty'](_0x9292('0x3a'))){_0xf0f67f[_0x9292('0x1e')]=qs[_0x9292('0x1e')](_0x4c582b[_0x9292('0x32')]['limit']);_0xf0f67f['offset']=qs[_0x9292('0x1b')](_0x4c582b[_0x9292('0x32')]['offset']);}return _0x186b4a[_0x9292('0x4e')](_0xf0f67f);}})[_0x9292('0x24')](function(_0x3d2bca){if(_0x3d2bca){return _0x3d2bca?{'count':_0x4f5c24,'rows':_0x3d2bca}:null;}})[_0x9292('0x24')](respondWithResult(_0x5ea532,null))[_0x9292('0x45')](handleError(_0x5ea532,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 3572016..89b8694 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 _0xdc9b=['define','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0xdc9b,0x70));var _0xbdc9=function(_0x29aa98,_0x225c56){_0x29aa98=_0x29aa98-0x0;var _0x56745c=_0xdc9b[_0x29aa98];return _0x56745c;};'use strict';var _=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var logger=require(_0xbdc9('0x2'))('api');var moment=require(_0xbdc9('0x3'));var BPromise=require(_0xbdc9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdc9('0x5'));var config=require(_0xbdc9('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xbdc9('0x7')]=function(_0x3065a8,_0x5bf8bc){return _0x3065a8[_0xbdc9('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xbdc9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98d8=['moment','bluebird','request-promise','../../config/environment','define','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x1adcab,_0x108a7c){var _0x8b5c5c=function(_0xa65d89){while(--_0xa65d89){_0x1adcab['push'](_0x1adcab['shift']());}};_0x8b5c5c(++_0x108a7c);}(_0x98d8,0xce));var _0x898d=function(_0x197df3,_0x57d366){_0x197df3=_0x197df3-0x0;var _0xafdaf7=_0x98d8[_0x197df3];return _0xafdaf7;};'use strict';var _=require(_0x898d('0x0'));var util=require(_0x898d('0x1'));var logger=require(_0x898d('0x2'))(_0x898d('0x3'));var moment=require(_0x898d('0x4'));var BPromise=require(_0x898d('0x5'));var rp=require(_0x898d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x898d('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x4047bd,_0x5215bf){return _0x4047bd[_0x898d('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x898d('0x9'),'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 d148331..607106f 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 _0xdaaf=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x48415d,_0x339044){var _0x2f6650=function(_0x40b2d4){while(--_0x40b2d4){_0x48415d['push'](_0x48415d['shift']());}};_0x2f6650(++_0x339044);}(_0xdaaf,0x130));var _0xfdaa=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdaaf[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xfdaa('0x0'));var moment=require(_0xfdaa('0x1'));var BPromise=require(_0xfdaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdaa('0x3'));var db=require(_0xfdaa('0x4'))['db'];var utils=require(_0xfdaa('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfdaa('0x6')][_0xfdaa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x49da41,_0x22d2c5,_0xde4ecd){return new BPromise(function(_0x74474f,_0x1ac37b){return client[_0xfdaa('0x8')](_0x49da41,_0xde4ecd)[_0xfdaa('0x9')](function(_0x53d2eb){logger['info'](_0xfdaa('0xa'),_0x22d2c5,_0xfdaa('0xb'));logger[_0xfdaa('0xc')](_0xfdaa('0xd'),_0x22d2c5,_0xfdaa('0xb'),JSON['stringify'](_0x53d2eb));if(_0x53d2eb['error']){if(_0x53d2eb[_0xfdaa('0xe')][_0xfdaa('0xf')]===0x1f4){logger['error'](_0xfdaa('0xa'),_0x22d2c5,_0x53d2eb[_0xfdaa('0xe')][_0xfdaa('0x10')]);return _0x1ac37b(_0x53d2eb['error'][_0xfdaa('0x10')]);}logger['error'](_0xfdaa('0xa'),_0x22d2c5,_0x53d2eb[_0xfdaa('0xe')][_0xfdaa('0x10')]);return _0x74474f(_0x53d2eb[_0xfdaa('0xe')][_0xfdaa('0x10')]);}else{logger[_0xfdaa('0x11')](_0xfdaa('0xa'),_0x22d2c5,'request\x20sent');_0x74474f(_0x53d2eb[_0xfdaa('0x12')][_0xfdaa('0x10')]);}})[_0xfdaa('0x13')](function(_0x44a556){logger[_0xfdaa('0xe')](_0xfdaa('0xa'),_0x22d2c5,_0x44a556);_0x1ac37b(_0x44a556);});});} \ No newline at end of file +var _0xb697=['error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x8e8760,_0x29c6b0){var _0x5b7878=function(_0x1e1a23){while(--_0x1e1a23){_0x8e8760['push'](_0x8e8760['shift']());}};_0x5b7878(++_0x29c6b0);}(_0xb697,0x142));var _0x7b69=function(_0x214cc7,_0x36f78a){_0x214cc7=_0x214cc7-0x0;var _0x135139=_0xb697[_0x214cc7];return _0x135139;};'use strict';var _=require(_0x7b69('0x0'));var util=require(_0x7b69('0x1'));var moment=require(_0x7b69('0x2'));var BPromise=require(_0x7b69('0x3'));var rs=require(_0x7b69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b69('0x5'))['db'];var utils=require(_0x7b69('0x6'));var logger=require(_0x7b69('0x7'))(_0x7b69('0x8'));var config=require(_0x7b69('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b69('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3045c5,_0x500f65,_0x872b7d){return new BPromise(function(_0x5b74c8,_0x363599){return client['request'](_0x3045c5,_0x872b7d)['then'](function(_0x6470e4){logger['info'](_0x7b69('0xb'),_0x500f65,'request\x20sent');logger[_0x7b69('0xc')](_0x7b69('0xd'),_0x500f65,'request\x20sent',JSON['stringify'](_0x6470e4));if(_0x6470e4[_0x7b69('0xe')]){if(_0x6470e4[_0x7b69('0xe')][_0x7b69('0xf')]===0x1f4){logger['error'](_0x7b69('0xb'),_0x500f65,_0x6470e4[_0x7b69('0xe')][_0x7b69('0x10')]);return _0x363599(_0x6470e4[_0x7b69('0xe')][_0x7b69('0x10')]);}logger[_0x7b69('0xe')](_0x7b69('0xb'),_0x500f65,_0x6470e4[_0x7b69('0xe')][_0x7b69('0x10')]);return _0x5b74c8(_0x6470e4['error'][_0x7b69('0x10')]);}else{logger[_0x7b69('0x11')](_0x7b69('0xb'),_0x500f65,_0x7b69('0x12'));_0x5b74c8(_0x6470e4[_0x7b69('0x13')][_0x7b69('0x10')]);}})[_0x7b69('0x14')](function(_0xd9cc4a){logger[_0x7b69('0xe')](_0x7b69('0xb'),_0x500f65,_0xd9cc4a);_0x363599(_0xd9cc4a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e571740..bb8ef16 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 _0xf1dd=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0xd02116,_0x177f37){var _0x2db2b7=function(_0x6646ba){while(--_0x6646ba){_0xd02116['push'](_0xd02116['shift']());}};_0x2db2b7(++_0x177f37);}(_0xf1dd,0x1c2));var _0xdf1d=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0xf1dd[_0x3452a8];return _0x233814;};'use strict';var multer=require(_0xdf1d('0x0'));var util=require('util');var path=require(_0xdf1d('0x1'));var timeout=require(_0xdf1d('0x2'));var express=require('express');var router=express[_0xdf1d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdf1d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdf1d('0x5'));var controller=require('./intServicenowField.controller');router[_0xdf1d('0x6')]('/',auth[_0xdf1d('0x7')](),controller['index']);router[_0xdf1d('0x6')](_0xdf1d('0x8'),auth[_0xdf1d('0x7')](),controller[_0xdf1d('0x9')]);router[_0xdf1d('0xa')]('/',auth[_0xdf1d('0x7')](),controller[_0xdf1d('0xb')]);router[_0xdf1d('0xc')]('/:id',auth[_0xdf1d('0x7')](),controller[_0xdf1d('0xd')]);router[_0xdf1d('0xe')](_0xdf1d('0x8'),auth[_0xdf1d('0x7')](),controller[_0xdf1d('0xf')]);module[_0xdf1d('0x10')]=router; \ No newline at end of file +var _0xf70d=['create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','isAuthenticated','show'];(function(_0x49d4a6,_0x411b51){var _0x25fdc3=function(_0x292685){while(--_0x292685){_0x49d4a6['push'](_0x49d4a6['shift']());}};_0x25fdc3(++_0x411b51);}(_0xf70d,0x16e));var _0xdf70=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf70d[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xdf70('0x0'));var util=require(_0xdf70('0x1'));var path=require('path');var timeout=require(_0xdf70('0x2'));var express=require(_0xdf70('0x3'));var router=express[_0xdf70('0x4')]();var fs_extra=require(_0xdf70('0x5'));var auth=require(_0xdf70('0x6'));var interaction=require(_0xdf70('0x7'));var config=require(_0xdf70('0x8'));var controller=require(_0xdf70('0x9'));router[_0xdf70('0xa')]('/',auth['isAuthenticated'](),controller[_0xdf70('0xb')]);router[_0xdf70('0xa')]('/:id',auth[_0xdf70('0xc')](),controller[_0xdf70('0xd')]);router['post']('/',auth[_0xdf70('0xc')](),controller[_0xdf70('0xe')]);router[_0xdf70('0xf')](_0xdf70('0x10'),auth[_0xdf70('0xc')](),controller['update']);router[_0xdf70('0x11')](_0xdf70('0x10'),auth[_0xdf70('0xc')](),controller[_0xdf70('0x12')]);module[_0xdf70('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e55dd1f..d0005e4 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 _0x33cc=['ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN','exports'];(function(_0x541155,_0x54f085){var _0x519cf5=function(_0x24faf0){while(--_0x24faf0){_0x541155['push'](_0x541155['shift']());}};_0x519cf5(++_0x54f085);}(_0x33cc,0x14c));var _0xc33c=function(_0x31bf4a,_0x2c90e7){_0x31bf4a=_0x31bf4a-0x0;var _0x542d25=_0x33cc[_0x31bf4a];return _0x542d25;};'use strict';var Sequelize=require('sequelize');module[_0xc33c('0x0')]={'type':{'type':Sequelize[_0xc33c('0x1')]('string',_0xc33c('0x2'),_0xc33c('0x3'),_0xc33c('0x4'),_0xc33c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc33c('0x6')]},'key':{'type':Sequelize[_0xc33c('0x6')]},'keyType':{'type':Sequelize[_0xc33c('0x1')](_0xc33c('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xc33c('0x6')]},'idField':{'type':Sequelize[_0xc33c('0x6')]},'nameField':{'type':Sequelize[_0xc33c('0x6')]},'customField':{'type':Sequelize[_0xc33c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc33c('0x6')]}}; \ No newline at end of file +var _0xa45c=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x27d054,_0x581a32){var _0x4807f7=function(_0x4ae2cb){while(--_0x4ae2cb){_0x27d054['push'](_0x27d054['shift']());}};_0x4807f7(++_0x581a32);}(_0xa45c,0x9b));var _0xca45=function(_0x1644b4,_0xd8cf97){_0x1644b4=_0x1644b4-0x0;var _0x56fdde=_0xa45c[_0x1644b4];return _0x56fdde;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'type':{'type':Sequelize[_0xca45('0x2')](_0xca45('0x3'),_0xca45('0x4'),'customVariable',_0xca45('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xca45('0x6')]},'key':{'type':Sequelize[_0xca45('0x6')]},'keyType':{'type':Sequelize[_0xca45('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xca45('0x6')]},'customField':{'type':Sequelize[_0xca45('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xca45('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1232da7..45aa313 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 _0xc5b7=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ServicenowField','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','destroy','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0xc5b7,0x1b2));var _0x7c5b=function(_0x2591b1,_0x2b5a30){_0x2591b1=_0x2591b1-0x0;var _0x19d29a=_0xc5b7[_0x2591b1];return _0x19d29a;};'use strict';var emlformat=require(_0x7c5b('0x0'));var rimraf=require(_0x7c5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c5b('0x2'));var rp=require(_0x7c5b('0x3'));var moment=require(_0x7c5b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7c5b('0x5'));var path=require(_0x7c5b('0x6'));var sox=require(_0x7c5b('0x7'));var csv=require(_0x7c5b('0x8'));var ejs=require(_0x7c5b('0x9'));var fs=require('fs');var fs_extra=require(_0x7c5b('0xa'));var _=require(_0x7c5b('0xb'));var squel=require(_0x7c5b('0xc'));var crypto=require(_0x7c5b('0xd'));var jsforce=require(_0x7c5b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7c5b('0x8'));var querystring=require('querystring');var Papa=require(_0x7c5b('0xf'));var Redis=require(_0x7c5b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7c5b('0x11'));var as=require(_0x7c5b('0x12'));var hardwareService=require(_0x7c5b('0x13'));var logger=require(_0x7c5b('0x14'))(_0x7c5b('0x15'));var utils=require(_0x7c5b('0x16'));var config=require(_0x7c5b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115683,_0x41c8c5){_0x41c8c5=_0x41c8c5||0xcc;return function(_0x5212f9){if(_0x5212f9){return _0x115683['sendStatus'](_0x41c8c5);}return _0x115683['status'](_0x41c8c5)['end']();};}function respondWithResult(_0x218200,_0x428c4b){_0x428c4b=_0x428c4b||0xc8;return function(_0x33a544){if(_0x33a544){return _0x218200[_0x7c5b('0x18')](_0x428c4b)[_0x7c5b('0x19')](_0x33a544);}};}function respondWithFilteredResult(_0x4647ba,_0x130af2){return function(_0x1939c6){if(_0x1939c6){var _0x4213ce=typeof _0x130af2[_0x7c5b('0x1a')]===_0x7c5b('0x1b')&&typeof _0x130af2[_0x7c5b('0x1c')]===_0x7c5b('0x1b');var _0x2b25d4=_0x1939c6[_0x7c5b('0x1d')];var _0xf353b9=_0x4213ce?0x0:_0x130af2['offset'];var _0x4a4a93=_0x4213ce?_0x1939c6[_0x7c5b('0x1d')]:_0x130af2['offset']+_0x130af2[_0x7c5b('0x1c')];var _0x79d9f4;if(_0x4a4a93>=_0x2b25d4){_0x4a4a93=_0x2b25d4;_0x79d9f4=0xc8;}else{_0x79d9f4=0xce;}_0x4647ba[_0x7c5b('0x18')](_0x79d9f4);return _0x4647ba[_0x7c5b('0x1e')](_0x7c5b('0x1f'),_0xf353b9+'-'+_0x4a4a93+'/'+_0x2b25d4)[_0x7c5b('0x19')](_0x1939c6);}return null;};}function patchUpdates(_0x4f58e3){return function(_0x12a453){try{jsonpatch[_0x7c5b('0x20')](_0x12a453,_0x4f58e3,!![]);}catch(_0x4c6361){return BPromise['reject'](_0x4c6361);}return _0x12a453[_0x7c5b('0x21')]();};}function saveUpdates(_0x26c869,_0x5b9ce7){return function(_0x15c1d7){if(_0x15c1d7){return _0x15c1d7[_0x7c5b('0x22')](_0x26c869)[_0x7c5b('0x23')](function(_0x4cea29){return _0x4cea29;});}return null;};}function removeEntity(_0x4c55a2,_0x2c4347){return function(_0x30c368){if(_0x30c368){return _0x30c368['destroy']()[_0x7c5b('0x23')](function(){_0x4c55a2['status'](0xcc)[_0x7c5b('0x24')]();});}};}function handleEntityNotFound(_0x235b46,_0x1f43b5){return function(_0x49ffb1){if(!_0x49ffb1){_0x235b46['sendStatus'](0x194);}return _0x49ffb1;};}function handleError(_0x5db185,_0x5549ca){_0x5549ca=_0x5549ca||0x1f4;return function(_0x4c373d){logger[_0x7c5b('0x25')](_0x4c373d[_0x7c5b('0x26')]);if(_0x4c373d[_0x7c5b('0x27')]){delete _0x4c373d['name'];}_0x5db185[_0x7c5b('0x18')](_0x5549ca)[_0x7c5b('0x28')](_0x4c373d);};}exports[_0x7c5b('0x29')]=function(_0x330619,_0x480831){var _0x556741={},_0x43f544={},_0x49e8eb={'count':0x0,'rows':[]};var _0x38e222=_[_0x7c5b('0x2a')](db[_0x7c5b('0x2b')]['rawAttributes'],function(_0x12bf28){return{'name':_0x12bf28['fieldName'],'type':_0x12bf28[_0x7c5b('0x2c')][_0x7c5b('0x2d')]};});_0x43f544[_0x7c5b('0x2e')]=_[_0x7c5b('0x2a')](_0x38e222,_0x7c5b('0x27'));_0x43f544[_0x7c5b('0x2f')]=_[_0x7c5b('0x30')](_0x330619[_0x7c5b('0x2f')]);_0x43f544[_0x7c5b('0x31')]=_[_0x7c5b('0x32')](_0x43f544[_0x7c5b('0x2e')],_0x43f544[_0x7c5b('0x2f')]);_0x556741['attributes']=_[_0x7c5b('0x32')](_0x43f544[_0x7c5b('0x2e')],qs[_0x7c5b('0x33')](_0x330619['query'][_0x7c5b('0x33')]));_0x556741[_0x7c5b('0x34')]=_0x556741['attributes'][_0x7c5b('0x35')]?_0x556741[_0x7c5b('0x34')]:_0x43f544['model'];if(!_0x330619[_0x7c5b('0x2f')]['hasOwnProperty'](_0x7c5b('0x36'))){_0x556741[_0x7c5b('0x1c')]=qs[_0x7c5b('0x1c')](_0x330619[_0x7c5b('0x2f')][_0x7c5b('0x1c')]);_0x556741[_0x7c5b('0x1a')]=qs[_0x7c5b('0x1a')](_0x330619[_0x7c5b('0x2f')][_0x7c5b('0x1a')]);}_0x556741[_0x7c5b('0x37')]=qs[_0x7c5b('0x38')](_0x330619[_0x7c5b('0x2f')][_0x7c5b('0x38')]);_0x556741[_0x7c5b('0x39')]=qs['filters'](_[_0x7c5b('0x3a')](_0x330619[_0x7c5b('0x2f')],_0x43f544['filters']),_0x38e222);if(_0x330619['query'][_0x7c5b('0x3b')]){_0x556741[_0x7c5b('0x39')]=_['merge'](_0x556741[_0x7c5b('0x39')],{'$or':_['map'](_0x38e222,function(_0x1b37f5){if(_0x1b37f5[_0x7c5b('0x2c')]!==_0x7c5b('0x3c')){var _0x522f6c={};_0x522f6c[_0x1b37f5[_0x7c5b('0x27')]]={'$like':'%'+_0x330619[_0x7c5b('0x2f')]['filter']+'%'};return _0x522f6c;}})});}_0x556741=_[_0x7c5b('0x3d')]({},_0x556741,_0x330619[_0x7c5b('0x3e')]);var _0x4d2e3b={'where':_0x556741[_0x7c5b('0x39')]};return db['ServicenowField'][_0x7c5b('0x1d')](_0x4d2e3b)[_0x7c5b('0x23')](function(_0x240148){_0x49e8eb[_0x7c5b('0x1d')]=_0x240148;if(_0x330619[_0x7c5b('0x2f')]['includeAll']){_0x556741[_0x7c5b('0x3f')]=[{'all':!![]}];}return db['ServicenowField'][_0x7c5b('0x40')](_0x556741);})[_0x7c5b('0x23')](function(_0x19ac69){_0x49e8eb[_0x7c5b('0x41')]=_0x19ac69;return _0x49e8eb;})['then'](respondWithFilteredResult(_0x480831,_0x556741))['catch'](handleError(_0x480831,null));};exports[_0x7c5b('0x42')]=function(_0x5034f2,_0x3c5e44){var _0x2217b8={'raw':!![],'where':{'id':_0x5034f2['params']['id']}},_0x519c79={};_0x519c79[_0x7c5b('0x2e')]=_['keys'](db[_0x7c5b('0x2b')][_0x7c5b('0x43')]);_0x519c79[_0x7c5b('0x2f')]=_[_0x7c5b('0x30')](_0x5034f2[_0x7c5b('0x2f')]);_0x519c79['filters']=_['intersection'](_0x519c79['model'],_0x519c79[_0x7c5b('0x2f')]);_0x2217b8['attributes']=_[_0x7c5b('0x32')](_0x519c79[_0x7c5b('0x2e')],qs[_0x7c5b('0x33')](_0x5034f2[_0x7c5b('0x2f')][_0x7c5b('0x33')]));_0x2217b8[_0x7c5b('0x34')]=_0x2217b8['attributes'][_0x7c5b('0x35')]?_0x2217b8[_0x7c5b('0x34')]:_0x519c79['model'];if(_0x5034f2[_0x7c5b('0x2f')][_0x7c5b('0x44')]){_0x2217b8[_0x7c5b('0x3f')]=[{'all':!![]}];}_0x2217b8=_[_0x7c5b('0x3d')]({},_0x2217b8,_0x5034f2[_0x7c5b('0x3e')]);return db[_0x7c5b('0x2b')][_0x7c5b('0x45')](_0x2217b8)[_0x7c5b('0x23')](handleEntityNotFound(_0x3c5e44,null))[_0x7c5b('0x23')](respondWithResult(_0x3c5e44,null))[_0x7c5b('0x46')](handleError(_0x3c5e44,null));};exports[_0x7c5b('0x47')]=function(_0x1af90d,_0xc1f513){return db[_0x7c5b('0x2b')][_0x7c5b('0x47')](_0x1af90d[_0x7c5b('0x48')],{})[_0x7c5b('0x23')](respondWithResult(_0xc1f513,0xc9))[_0x7c5b('0x46')](handleError(_0xc1f513,null));};exports[_0x7c5b('0x22')]=function(_0x2a6c58,_0x1e80da){if(_0x2a6c58[_0x7c5b('0x48')]['id']){delete _0x2a6c58['body']['id'];}return db['ServicenowField'][_0x7c5b('0x45')]({'where':{'id':_0x2a6c58['params']['id']}})[_0x7c5b('0x23')](handleEntityNotFound(_0x1e80da,null))[_0x7c5b('0x23')](saveUpdates(_0x2a6c58['body'],null))[_0x7c5b('0x23')](respondWithResult(_0x1e80da,null))['catch'](handleError(_0x1e80da,null));};exports[_0x7c5b('0x49')]=function(_0x43e595,_0xfb90a9){return db[_0x7c5b('0x2b')][_0x7c5b('0x45')]({'where':{'id':_0x43e595[_0x7c5b('0x4a')]['id']}})[_0x7c5b('0x23')](handleEntityNotFound(_0xfb90a9,null))[_0x7c5b('0x23')](removeEntity(_0xfb90a9,null))[_0x7c5b('0x46')](handleError(_0xfb90a9,null));}; \ No newline at end of file +var _0xc219=['bluebird','mustache','util','sox','to-csv','crypto','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','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ServicenowField','findAll','catch','show','params','keys','rawAttributes','find','create','body','eml-format','zip-dir','request-promise','moment'];(function(_0x3bdb96,_0x1f7b30){var _0x2d6ea0=function(_0x90430f){while(--_0x90430f){_0x3bdb96['push'](_0x3bdb96['shift']());}};_0x2d6ea0(++_0x1f7b30);}(_0xc219,0x1ac));var _0x9c21=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0xc219[_0x389832];return _0x59429e;};'use strict';var emlformat=require(_0x9c21('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c21('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c21('0x2'));var moment=require(_0x9c21('0x3'));var BPromise=require(_0x9c21('0x4'));var Mustache=require(_0x9c21('0x5'));var util=require(_0x9c21('0x6'));var path=require('path');var sox=require(_0x9c21('0x7'));var csv=require(_0x9c21('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c21('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9c21('0xa'));var toCsv=require(_0x9c21('0x8'));var querystring=require(_0x9c21('0xb'));var Papa=require(_0x9c21('0xc'));var Redis=require(_0x9c21('0xd'));var authService=require(_0x9c21('0xe'));var qs=require(_0x9c21('0xf'));var as=require(_0x9c21('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c21('0x11'));var utils=require(_0x9c21('0x12'));var config=require(_0x9c21('0x13'));var licenseUtil=require(_0x9c21('0x14'));var db=require(_0x9c21('0x15'))['db'];function respondWithStatusCode(_0x51c27f,_0x577a13){_0x577a13=_0x577a13||0xcc;return function(_0x1ef7db){if(_0x1ef7db){return _0x51c27f[_0x9c21('0x16')](_0x577a13);}return _0x51c27f[_0x9c21('0x17')](_0x577a13)[_0x9c21('0x18')]();};}function respondWithResult(_0x13ea2e,_0x3003a1){_0x3003a1=_0x3003a1||0xc8;return function(_0x51bd6a){if(_0x51bd6a){return _0x13ea2e[_0x9c21('0x17')](_0x3003a1)[_0x9c21('0x19')](_0x51bd6a);}};}function respondWithFilteredResult(_0x222225,_0x5be144){return function(_0x483424){if(_0x483424){var _0x5437cc=typeof _0x5be144['offset']===_0x9c21('0x1a')&&typeof _0x5be144[_0x9c21('0x1b')]==='undefined';var _0x2bbe3b=_0x483424[_0x9c21('0x1c')];var _0xd3bf03=_0x5437cc?0x0:_0x5be144[_0x9c21('0x1d')];var _0x379652=_0x5437cc?_0x483424[_0x9c21('0x1c')]:_0x5be144['offset']+_0x5be144[_0x9c21('0x1b')];var _0x3985f2;if(_0x379652>=_0x2bbe3b){_0x379652=_0x2bbe3b;_0x3985f2=0xc8;}else{_0x3985f2=0xce;}_0x222225['status'](_0x3985f2);return _0x222225[_0x9c21('0x1e')](_0x9c21('0x1f'),_0xd3bf03+'-'+_0x379652+'/'+_0x2bbe3b)[_0x9c21('0x19')](_0x483424);}return null;};}function patchUpdates(_0x40ecbc){return function(_0x391e25){try{jsonpatch[_0x9c21('0x20')](_0x391e25,_0x40ecbc,!![]);}catch(_0x3a5c22){return BPromise[_0x9c21('0x21')](_0x3a5c22);}return _0x391e25[_0x9c21('0x22')]();};}function saveUpdates(_0x115a2a,_0x15ed4d){return function(_0x34567d){if(_0x34567d){return _0x34567d[_0x9c21('0x23')](_0x115a2a)[_0x9c21('0x24')](function(_0x2b6035){return _0x2b6035;});}return null;};}function removeEntity(_0x44e4c4,_0xde50f2){return function(_0x1d7456){if(_0x1d7456){return _0x1d7456[_0x9c21('0x25')]()[_0x9c21('0x24')](function(){_0x44e4c4['status'](0xcc)[_0x9c21('0x18')]();});}};}function handleEntityNotFound(_0x231475,_0x21f05){return function(_0x32fd8c){if(!_0x32fd8c){_0x231475['sendStatus'](0x194);}return _0x32fd8c;};}function handleError(_0xfbd0ed,_0x445c33){_0x445c33=_0x445c33||0x1f4;return function(_0x4680e7){logger[_0x9c21('0x26')](_0x4680e7['stack']);if(_0x4680e7[_0x9c21('0x27')]){delete _0x4680e7[_0x9c21('0x27')];}_0xfbd0ed[_0x9c21('0x17')](_0x445c33)[_0x9c21('0x28')](_0x4680e7);};}exports[_0x9c21('0x29')]=function(_0x42d406,_0x46c12b){var _0x3a9080={},_0x5e0ae9={},_0x41da99={'count':0x0,'rows':[]};var _0x4eafe5=_['map'](db['ServicenowField']['rawAttributes'],function(_0x33763f){return{'name':_0x33763f[_0x9c21('0x2a')],'type':_0x33763f[_0x9c21('0x2b')][_0x9c21('0x2c')]};});_0x5e0ae9[_0x9c21('0x2d')]=_[_0x9c21('0x2e')](_0x4eafe5,_0x9c21('0x27'));_0x5e0ae9[_0x9c21('0x2f')]=_['keys'](_0x42d406[_0x9c21('0x2f')]);_0x5e0ae9[_0x9c21('0x30')]=_[_0x9c21('0x31')](_0x5e0ae9['model'],_0x5e0ae9['query']);_0x3a9080['attributes']=_[_0x9c21('0x31')](_0x5e0ae9[_0x9c21('0x2d')],qs[_0x9c21('0x32')](_0x42d406[_0x9c21('0x2f')][_0x9c21('0x32')]));_0x3a9080[_0x9c21('0x33')]=_0x3a9080[_0x9c21('0x33')][_0x9c21('0x34')]?_0x3a9080['attributes']:_0x5e0ae9[_0x9c21('0x2d')];if(!_0x42d406[_0x9c21('0x2f')][_0x9c21('0x35')](_0x9c21('0x36'))){_0x3a9080[_0x9c21('0x1b')]=qs[_0x9c21('0x1b')](_0x42d406[_0x9c21('0x2f')][_0x9c21('0x1b')]);_0x3a9080['offset']=qs[_0x9c21('0x1d')](_0x42d406[_0x9c21('0x2f')][_0x9c21('0x1d')]);}_0x3a9080[_0x9c21('0x37')]=qs[_0x9c21('0x38')](_0x42d406[_0x9c21('0x2f')]['sort']);_0x3a9080[_0x9c21('0x39')]=qs['filters'](_[_0x9c21('0x3a')](_0x42d406['query'],_0x5e0ae9[_0x9c21('0x30')]),_0x4eafe5);if(_0x42d406[_0x9c21('0x2f')][_0x9c21('0x3b')]){_0x3a9080[_0x9c21('0x39')]=_[_0x9c21('0x3c')](_0x3a9080['where'],{'$or':_['map'](_0x4eafe5,function(_0x19def1){if(_0x19def1['type']!=='VIRTUAL'){var _0x5517be={};_0x5517be[_0x19def1[_0x9c21('0x27')]]={'$like':'%'+_0x42d406['query'][_0x9c21('0x3b')]+'%'};return _0x5517be;}})});}_0x3a9080=_[_0x9c21('0x3c')]({},_0x3a9080,_0x42d406[_0x9c21('0x3d')]);var _0x5dd060={'where':_0x3a9080[_0x9c21('0x39')]};return db[_0x9c21('0x3e')][_0x9c21('0x1c')](_0x5dd060)['then'](function(_0x34dfb6){_0x41da99[_0x9c21('0x1c')]=_0x34dfb6;if(_0x42d406['query']['includeAll']){_0x3a9080['include']=[{'all':!![]}];}return db[_0x9c21('0x3e')][_0x9c21('0x3f')](_0x3a9080);})[_0x9c21('0x24')](function(_0x5e1ba2){_0x41da99['rows']=_0x5e1ba2;return _0x41da99;})[_0x9c21('0x24')](respondWithFilteredResult(_0x46c12b,_0x3a9080))[_0x9c21('0x40')](handleError(_0x46c12b,null));};exports[_0x9c21('0x41')]=function(_0x709a44,_0x11dea2){var _0x41c7c2={'raw':!![],'where':{'id':_0x709a44[_0x9c21('0x42')]['id']}},_0x56f26f={};_0x56f26f[_0x9c21('0x2d')]=_[_0x9c21('0x43')](db[_0x9c21('0x3e')][_0x9c21('0x44')]);_0x56f26f[_0x9c21('0x2f')]=_['keys'](_0x709a44[_0x9c21('0x2f')]);_0x56f26f[_0x9c21('0x30')]=_['intersection'](_0x56f26f[_0x9c21('0x2d')],_0x56f26f[_0x9c21('0x2f')]);_0x41c7c2[_0x9c21('0x33')]=_['intersection'](_0x56f26f['model'],qs[_0x9c21('0x32')](_0x709a44[_0x9c21('0x2f')][_0x9c21('0x32')]));_0x41c7c2[_0x9c21('0x33')]=_0x41c7c2[_0x9c21('0x33')][_0x9c21('0x34')]?_0x41c7c2[_0x9c21('0x33')]:_0x56f26f[_0x9c21('0x2d')];if(_0x709a44[_0x9c21('0x2f')]['includeAll']){_0x41c7c2['include']=[{'all':!![]}];}_0x41c7c2=_[_0x9c21('0x3c')]({},_0x41c7c2,_0x709a44['options']);return db[_0x9c21('0x3e')][_0x9c21('0x45')](_0x41c7c2)[_0x9c21('0x24')](handleEntityNotFound(_0x11dea2,null))[_0x9c21('0x24')](respondWithResult(_0x11dea2,null))[_0x9c21('0x40')](handleError(_0x11dea2,null));};exports['create']=function(_0x1cc65d,_0x4608fe){return db['ServicenowField'][_0x9c21('0x46')](_0x1cc65d[_0x9c21('0x47')],{})[_0x9c21('0x24')](respondWithResult(_0x4608fe,0xc9))[_0x9c21('0x40')](handleError(_0x4608fe,null));};exports[_0x9c21('0x23')]=function(_0x47507a,_0x5c07d6){if(_0x47507a['body']['id']){delete _0x47507a[_0x9c21('0x47')]['id'];}return db[_0x9c21('0x3e')][_0x9c21('0x45')]({'where':{'id':_0x47507a['params']['id']}})[_0x9c21('0x24')](handleEntityNotFound(_0x5c07d6,null))[_0x9c21('0x24')](saveUpdates(_0x47507a[_0x9c21('0x47')],null))[_0x9c21('0x24')](respondWithResult(_0x5c07d6,null))[_0x9c21('0x40')](handleError(_0x5c07d6,null));};exports['destroy']=function(_0x4bf13d,_0x7a04c3){return db[_0x9c21('0x3e')][_0x9c21('0x45')]({'where':{'id':_0x4bf13d['params']['id']}})[_0x9c21('0x24')](handleEntityNotFound(_0x7a04c3,null))['then'](removeEntity(_0x7a04c3,null))[_0x9c21('0x40')](handleError(_0x7a04c3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 06ffc0a..e4690ff 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 _0x7a06=['path','../../config/environment','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','moment','bluebird','request-promise'];(function(_0xf3dccf,_0x1b2256){var _0xfe770=function(_0x51e209){while(--_0x51e209){_0xf3dccf['push'](_0xf3dccf['shift']());}};_0xfe770(++_0x1b2256);}(_0x7a06,0x100));var _0x67a0=function(_0x4c6c8c,_0x3b624a){_0x4c6c8c=_0x4c6c8c-0x0;var _0x28aecd=_0x7a06[_0x4c6c8c];return _0x28aecd;};'use strict';var _=require(_0x67a0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x67a0('0x1'));var BPromise=require(_0x67a0('0x2'));var rp=require(_0x67a0('0x3'));var fs=require('fs');var path=require(_0x67a0('0x4'));var rimraf=require('rimraf');var config=require(_0x67a0('0x5'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x44664a,_0xa37e9a){return _0x44664a['define'](_0x67a0('0x6'),attributes,{'tableName':_0x67a0('0x7'),'paranoid':![],'indexes':[{'name':_0x67a0('0x8'),'fields':['idField',_0x67a0('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f1a=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0f1a,0x1b9));var _0xa0f1=function(_0x448a7e,_0x25d4b1){_0x448a7e=_0x448a7e-0x0;var _0x460433=_0x0f1a[_0x448a7e];return _0x460433;};'use strict';var _=require(_0xa0f1('0x0'));var util=require(_0xa0f1('0x1'));var logger=require(_0xa0f1('0x2'))(_0xa0f1('0x3'));var moment=require('moment');var BPromise=require(_0xa0f1('0x4'));var rp=require(_0xa0f1('0x5'));var fs=require('fs');var path=require(_0xa0f1('0x6'));var rimraf=require(_0xa0f1('0x7'));var config=require(_0xa0f1('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xa0f1('0x9')]=function(_0x4c99dd,_0xa2b107){return _0x4c99dd[_0xa0f1('0xa')](_0xa0f1('0xb'),attributes,{'tableName':_0xa0f1('0xc'),'paranoid':![],'indexes':[{'name':_0xa0f1('0xd'),'fields':['idField',_0xa0f1('0xe')],'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 358817b..79284d8 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 _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1b1f04,_0xc66e12){_0x1b1f04=_0x1b1f04-0x0;var _0x1c0109=_0xbdb7[_0x1b1f04];return _0x1c0109;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 8763dae..f1da391 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5f5d2c,_0x23ce26){var _0xc6240=function(_0xe9429d){while(--_0xe9429d){_0x5f5d2c['push'](_0x5f5d2c['shift']());}};_0xc6240(++_0x23ce26);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x139073,_0x5a4119){var _0xc7e049=function(_0xde4791){while(--_0xde4791){_0x139073['push'](_0x139073['shift']());}};_0xc7e049(++_0x5a4119);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 0f7d52a..bb2c699 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(_0x513eec,_0x303e88){var _0x413772=function(_0x2350ec){while(--_0x2350ec){_0x513eec['push'](_0x513eec['shift']());}};_0x413772(++_0x303e88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x498c0d,_0x29eead){var _0x209d6a=function(_0x17ec05){while(--_0x17ec05){_0x498c0d['push'](_0x498c0d['shift']());}};_0x209d6a(++_0x29eead);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 e53b4e5..8f0773a 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 _0xf675=['rawAttributes','includeAll','find','catch','create','body','params','SugarcrmConfiguration','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','stringify','Calls','values','module_fields','remove','label','endsWith','options','value','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','SugarcrmAccount','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','show'];(function(_0x1a6588,_0x1fea73){var _0x109b37=function(_0x595600){while(--_0x595600){_0x1a6588['push'](_0x1a6588['shift']());}};_0x109b37(++_0x1fea73);}(_0xf675,0xae));var _0x5f67=function(_0x15ddc9,_0x209223){_0x15ddc9=_0x15ddc9-0x0;var _0x2fc9e8=_0xf675[_0x15ddc9];return _0x2fc9e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f67('0x0'));var zipdir=require(_0x5f67('0x1'));var jsonpatch=require(_0x5f67('0x2'));var rp=require(_0x5f67('0x3'));var moment=require(_0x5f67('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5f67('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f67('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f67('0x7'));var jsforce=require(_0x5f67('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x5f67('0x9'));var querystring=require(_0x5f67('0xa'));var Papa=require(_0x5f67('0xb'));var Redis=require('ioredis');var authService=require(_0x5f67('0xc'));var qs=require(_0x5f67('0xd'));var as=require(_0x5f67('0xe'));var hardwareService=require(_0x5f67('0xf'));var logger=require(_0x5f67('0x10'))(_0x5f67('0x11'));var utils=require(_0x5f67('0x12'));var config=require(_0x5f67('0x13'));var licenseUtil=require(_0x5f67('0x14'));var db=require(_0x5f67('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1958d7,_0x586788){_0x586788=_0x586788||0xcc;return function(_0x25be40){if(_0x25be40){return _0x1958d7[_0x5f67('0x16')](_0x586788);}return _0x1958d7[_0x5f67('0x17')](_0x586788)[_0x5f67('0x18')]();};}function respondWithResult(_0x851888,_0x3e0bf6){_0x3e0bf6=_0x3e0bf6||0xc8;return function(_0x20b067){if(_0x20b067){return _0x851888[_0x5f67('0x17')](_0x3e0bf6)[_0x5f67('0x19')](_0x20b067);}};}function respondWithFilteredResult(_0x22a959,_0x5b23a8){return function(_0x189653){if(_0x189653){var _0x392b99=typeof _0x5b23a8[_0x5f67('0x1a')]===_0x5f67('0x1b')&&typeof _0x5b23a8['limit']===_0x5f67('0x1b');var _0x5adf16=_0x189653[_0x5f67('0x1c')];var _0x4e61bd=_0x392b99?0x0:_0x5b23a8[_0x5f67('0x1a')];var _0x519205=_0x392b99?_0x189653[_0x5f67('0x1c')]:_0x5b23a8[_0x5f67('0x1a')]+_0x5b23a8[_0x5f67('0x1d')];var _0x375a26;if(_0x519205>=_0x5adf16){_0x519205=_0x5adf16;_0x375a26=0xc8;}else{_0x375a26=0xce;}_0x22a959[_0x5f67('0x17')](_0x375a26);return _0x22a959['set'](_0x5f67('0x1e'),_0x4e61bd+'-'+_0x519205+'/'+_0x5adf16)[_0x5f67('0x19')](_0x189653);}return null;};}function patchUpdates(_0x1600bb){return function(_0x3d3702){try{jsonpatch[_0x5f67('0x1f')](_0x3d3702,_0x1600bb,!![]);}catch(_0x565a1f){return BPromise[_0x5f67('0x20')](_0x565a1f);}return _0x3d3702[_0x5f67('0x21')]();};}function saveUpdates(_0x2104b3,_0x24a9a8){return function(_0x4849f3){if(_0x4849f3){return _0x4849f3[_0x5f67('0x22')](_0x2104b3)['then'](function(_0x259f80){return _0x259f80;});}return null;};}function removeEntity(_0x29a0a4,_0x3ba26d){return function(_0x3da5e2){if(_0x3da5e2){return _0x3da5e2[_0x5f67('0x23')]()[_0x5f67('0x24')](function(){_0x29a0a4['status'](0xcc)[_0x5f67('0x18')]();});}};}function handleEntityNotFound(_0x10de0f,_0x453868){return function(_0x472f2c){if(!_0x472f2c){_0x10de0f[_0x5f67('0x16')](0x194);}return _0x472f2c;};}function handleError(_0xdeba6e,_0x3983e0){_0x3983e0=_0x3983e0||0x1f4;return function(_0x13635e){logger[_0x5f67('0x25')](_0x13635e['stack']);if(_0x13635e[_0x5f67('0x26')]){delete _0x13635e[_0x5f67('0x26')];}_0xdeba6e[_0x5f67('0x17')](_0x3983e0)[_0x5f67('0x27')](_0x13635e);};}exports[_0x5f67('0x28')]=function(_0x4af468,_0x58998a){var _0x3e64c5={},_0x3d2bfc={},_0x131442={'count':0x0,'rows':[]};var _0x333369=_['map'](db[_0x5f67('0x29')]['rawAttributes'],function(_0x441839){return{'name':_0x441839[_0x5f67('0x2a')],'type':_0x441839[_0x5f67('0x2b')][_0x5f67('0x2c')]};});_0x3d2bfc[_0x5f67('0x2d')]=_[_0x5f67('0x2e')](_0x333369,'name');_0x3d2bfc[_0x5f67('0x2f')]=_[_0x5f67('0x30')](_0x4af468['query']);_0x3d2bfc['filters']=_['intersection'](_0x3d2bfc[_0x5f67('0x2d')],_0x3d2bfc[_0x5f67('0x2f')]);_0x3e64c5['attributes']=_[_0x5f67('0x31')](_0x3d2bfc[_0x5f67('0x2d')],qs[_0x5f67('0x32')](_0x4af468[_0x5f67('0x2f')][_0x5f67('0x32')]));_0x3e64c5[_0x5f67('0x33')]=_0x3e64c5[_0x5f67('0x33')][_0x5f67('0x34')]?_0x3e64c5['attributes']:_0x3d2bfc[_0x5f67('0x2d')];if(!_0x4af468[_0x5f67('0x2f')]['hasOwnProperty'](_0x5f67('0x35'))){_0x3e64c5[_0x5f67('0x1d')]=qs[_0x5f67('0x1d')](_0x4af468['query'][_0x5f67('0x1d')]);_0x3e64c5[_0x5f67('0x1a')]=qs['offset'](_0x4af468[_0x5f67('0x2f')][_0x5f67('0x1a')]);}_0x3e64c5[_0x5f67('0x36')]=qs[_0x5f67('0x37')](_0x4af468[_0x5f67('0x2f')][_0x5f67('0x37')]);_0x3e64c5[_0x5f67('0x38')]=qs[_0x5f67('0x39')](_[_0x5f67('0x3a')](_0x4af468[_0x5f67('0x2f')],_0x3d2bfc[_0x5f67('0x39')]),_0x333369);if(_0x4af468[_0x5f67('0x2f')][_0x5f67('0x3b')]){_0x3e64c5[_0x5f67('0x38')]=_[_0x5f67('0x3c')](_0x3e64c5[_0x5f67('0x38')],{'$or':_[_0x5f67('0x2e')](_0x333369,function(_0x536054){if(_0x536054[_0x5f67('0x2b')]!==_0x5f67('0x3d')){var _0x48f6a7={};_0x48f6a7[_0x536054[_0x5f67('0x26')]]={'$like':'%'+_0x4af468[_0x5f67('0x2f')]['filter']+'%'};return _0x48f6a7;}})});}_0x3e64c5=_['merge']({},_0x3e64c5,_0x4af468['options']);var _0x494afd={'where':_0x3e64c5[_0x5f67('0x38')]};return db[_0x5f67('0x29')][_0x5f67('0x1c')](_0x494afd)['then'](function(_0x1d8db5){_0x131442['count']=_0x1d8db5;if(_0x4af468[_0x5f67('0x2f')]['includeAll']){_0x3e64c5[_0x5f67('0x3e')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x5f67('0x3f')](_0x3e64c5);})[_0x5f67('0x24')](function(_0x519cbf){_0x131442[_0x5f67('0x40')]=_0x519cbf;return _0x131442;})['then'](respondWithFilteredResult(_0x58998a,_0x3e64c5))['catch'](handleError(_0x58998a,null));};exports[_0x5f67('0x41')]=function(_0x1f79a1,_0x3c627f){var _0x102418={'raw':![],'where':{'id':_0x1f79a1['params']['id']}},_0x4663df={};_0x4663df[_0x5f67('0x2d')]=_[_0x5f67('0x30')](db[_0x5f67('0x29')][_0x5f67('0x42')]);_0x4663df['query']=_[_0x5f67('0x30')](_0x1f79a1[_0x5f67('0x2f')]);_0x4663df[_0x5f67('0x39')]=_[_0x5f67('0x31')](_0x4663df[_0x5f67('0x2d')],_0x4663df[_0x5f67('0x2f')]);_0x102418['attributes']=_[_0x5f67('0x31')](_0x4663df[_0x5f67('0x2d')],qs[_0x5f67('0x32')](_0x1f79a1[_0x5f67('0x2f')][_0x5f67('0x32')]));_0x102418[_0x5f67('0x33')]=_0x102418[_0x5f67('0x33')]['length']?_0x102418[_0x5f67('0x33')]:_0x4663df[_0x5f67('0x2d')];if(_0x1f79a1[_0x5f67('0x2f')][_0x5f67('0x43')]){_0x102418[_0x5f67('0x3e')]=[{'all':!![]}];}_0x102418=_['merge']({},_0x102418,_0x1f79a1['options']);return db[_0x5f67('0x29')][_0x5f67('0x44')](_0x102418)[_0x5f67('0x24')](handleEntityNotFound(_0x3c627f,null))[_0x5f67('0x24')](respondWithResult(_0x3c627f,null))[_0x5f67('0x45')](handleError(_0x3c627f,null));};exports[_0x5f67('0x46')]=function(_0x59ab0b,_0x2b5c75){return db[_0x5f67('0x29')][_0x5f67('0x46')](_0x59ab0b[_0x5f67('0x47')],{})[_0x5f67('0x24')](respondWithResult(_0x2b5c75,0xc9))[_0x5f67('0x45')](handleError(_0x2b5c75,null));};exports['update']=function(_0x595896,_0xd6f538){if(_0x595896[_0x5f67('0x47')]['id']){delete _0x595896[_0x5f67('0x47')]['id'];}return db[_0x5f67('0x29')][_0x5f67('0x44')]({'where':{'id':_0x595896[_0x5f67('0x48')]['id']}})[_0x5f67('0x24')](handleEntityNotFound(_0xd6f538,null))[_0x5f67('0x24')](saveUpdates(_0x595896['body'],null))[_0x5f67('0x24')](respondWithResult(_0xd6f538,null))[_0x5f67('0x45')](handleError(_0xd6f538,null));};exports['destroy']=function(_0x31c555,_0x50c7a3){return db[_0x5f67('0x29')][_0x5f67('0x44')]({'where':{'id':_0x31c555[_0x5f67('0x48')]['id']}})[_0x5f67('0x24')](handleEntityNotFound(_0x50c7a3,null))[_0x5f67('0x24')](removeEntity(_0x50c7a3,null))[_0x5f67('0x45')](handleError(_0x50c7a3,null));};exports['getConfigurations']=function(_0x231a14,_0x118a25,_0x348e40){var _0x46d7e4={};var _0x5bc615={};var _0x1d4e00;var _0x1f735c;return db[_0x5f67('0x29')]['findOne']({'where':{'id':_0x231a14[_0x5f67('0x48')]['id']}})[_0x5f67('0x24')](handleEntityNotFound(_0x118a25,null))[_0x5f67('0x24')](function(_0x6c1f3b){if(_0x6c1f3b){_0x1d4e00=_0x6c1f3b;_0x5bc615[_0x5f67('0x2d')]=_['keys'](db[_0x5f67('0x49')][_0x5f67('0x42')]);_0x5bc615[_0x5f67('0x2f')]=_[_0x5f67('0x30')](_0x231a14[_0x5f67('0x2f')]);_0x5bc615[_0x5f67('0x39')]=_[_0x5f67('0x31')](_0x5bc615[_0x5f67('0x2d')],_0x5bc615[_0x5f67('0x2f')]);_0x46d7e4[_0x5f67('0x33')]=_['intersection'](_0x5bc615[_0x5f67('0x2d')],qs['fields'](_0x231a14['query'][_0x5f67('0x32')]));_0x46d7e4[_0x5f67('0x33')]=_0x46d7e4[_0x5f67('0x33')]['length']?_0x46d7e4['attributes']:_0x5bc615[_0x5f67('0x2d')];_0x46d7e4['order']=qs[_0x5f67('0x37')](_0x231a14[_0x5f67('0x2f')][_0x5f67('0x37')]);_0x46d7e4[_0x5f67('0x38')]=qs[_0x5f67('0x39')](_['pick'](_0x231a14['query'],_0x5bc615[_0x5f67('0x39')]));if(_0x231a14[_0x5f67('0x2f')][_0x5f67('0x3b')]){_0x46d7e4[_0x5f67('0x38')]=_[_0x5f67('0x3c')](_0x46d7e4[_0x5f67('0x38')],{'$or':_[_0x5f67('0x2e')](_0x46d7e4[_0x5f67('0x33')],function(_0x99ff45){var _0x366ca8={};_0x366ca8[_0x99ff45]={'$like':'%'+_0x231a14[_0x5f67('0x2f')][_0x5f67('0x3b')]+'%'};return _0x366ca8;})});}_0x46d7e4=_[_0x5f67('0x3c')]({},_0x46d7e4,_0x231a14['options']);return _0x1d4e00[_0x5f67('0x4a')](_0x46d7e4);}})[_0x5f67('0x24')](function(_0xd69194){if(_0xd69194){_0x1f735c=_0xd69194[_0x5f67('0x34')];if(!_0x231a14[_0x5f67('0x2f')][_0x5f67('0x4b')](_0x5f67('0x35'))){_0x46d7e4[_0x5f67('0x1d')]=qs['limit'](_0x231a14[_0x5f67('0x2f')][_0x5f67('0x1d')]);_0x46d7e4[_0x5f67('0x1a')]=qs[_0x5f67('0x1a')](_0x231a14[_0x5f67('0x2f')][_0x5f67('0x1a')]);}return _0x1d4e00[_0x5f67('0x4a')](_0x46d7e4);}})['then'](function(_0x3ffb1b){if(_0x3ffb1b){return _0x3ffb1b?{'count':_0x1f735c,'rows':_0x3ffb1b}:null;}})[_0x5f67('0x24')](respondWithResult(_0x118a25,null))[_0x5f67('0x45')](handleError(_0x118a25,null));};exports['addConfiguration']=function(_0x45ebc7,_0x4e35ea,_0xb088d8){if(_0x45ebc7[_0x5f67('0x47')]['id']){delete _0x45ebc7[_0x5f67('0x47')]['id'];}return db[_0x5f67('0x29')][_0x5f67('0x4c')]({'where':{'id':_0x45ebc7['params']['id']}})[_0x5f67('0x24')](handleEntityNotFound(_0x4e35ea,null))['then'](function(_0x9192f4){if(_0x9192f4){_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x4d')]=_0x9192f4['id'];_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x4e')]=integrations['getSubjects'](_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x4f')],_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x2b')]);_0x45ebc7[_0x5f67('0x47')][_0x5f67('0x50')]=integrations[_0x5f67('0x51')](_0x45ebc7['body'][_0x5f67('0x4f')],_0x45ebc7['body'][_0x5f67('0x2b')]);return db[_0x5f67('0x49')]['create'](_0x45ebc7['body'],{'include':[{'model':db[_0x5f67('0x52')],'as':_0x5f67('0x4e')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4e35ea,null))['catch'](handleError(_0x4e35ea,null));};exports[_0x5f67('0x53')]=function(_0x2c58f4,_0xc05abe,_0x1eb6af){var _0x327182='';var _0x1301da=['id',_0x5f67('0x26'),_0x5f67('0x54'),_0x5f67('0x55'),_0x5f67('0x56'),'date_start',_0x5f67('0x57'),_0x5f67('0x58'),_0x5f67('0x59'),_0x5f67('0x5a'),'parent_name',_0x5f67('0x5b')];return db[_0x5f67('0x29')][_0x5f67('0x4c')]({'where':{'id':_0x2c58f4['params']['id']},'attributes':['id',_0x5f67('0x5c'),_0x5f67('0x5d'),_0x5f67('0x5e')]})[_0x5f67('0x24')](handleEntityNotFound(_0xc05abe,null))[_0x5f67('0x24')](function(_0x19d356){if(_0x19d356){_0x327182=_0x19d356[_0x5f67('0x5e')];var _0xe184d9=_0x327182[_0x5f67('0x5f')](-0x1);if(_0xe184d9==='/'){_0x327182=_0x327182[_0x5f67('0x60')](0x0,_0x327182['lastIndexOf'](_0xe184d9));}return rp({'method':_0x5f67('0x61'),'uri':util[_0x5f67('0x62')](_0x5f67('0x63'),_0x327182,_0x5f67('0x64')),'json':!![],'form':{'method':_0x5f67('0x65'),'input_type':_0x5f67('0x66'),'response_type':_0x5f67('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x19d356['username'],'password':_0x19d356[_0x5f67('0x5d')],'encryption':_0x5f67('0x67')},'application':_0x5f67('0x68')})}});}})['then'](function(_0xa8d9ae){if(_0xa8d9ae&&_0xa8d9ae[_0x5f67('0x26')]!==_0x5f67('0x69')&&_0xa8d9ae['name']!=='Password\x20Expired'){return rp({'method':_0x5f67('0x61'),'uri':util['format']('%s%s',_0x327182,_0x5f67('0x64')),'json':!![],'form':{'method':_0x5f67('0x6a'),'input_type':_0x5f67('0x66'),'response_type':_0x5f67('0x66'),'rest_data':JSON[_0x5f67('0x6b')]({'session':_0xa8d9ae['id'],'module_name':_0x5f67('0x6c')})}})[_0x5f67('0x24')](function(_0x14bb22){if(_0x14bb22){var _0x5bfb38=_[_0x5f67('0x6d')](_0x14bb22[_0x5f67('0x6e')]);_[_0x5f67('0x6f')](_0x5bfb38,function(_0x49f61a){return _0x1301da['includes'](_0x49f61a[_0x5f67('0x26')]);});return{'count':_0x5bfb38[_0x5f67('0x34')],'rows':_[_0x5f67('0x2e')](_0x5bfb38,function(_0xea6648){return{'id':_0xea6648['name'],'name':_0xea6648[_0x5f67('0x70')],'custom':_[_0x5f67('0x71')](_0xea6648[_0x5f67('0x26')],'_c')?!![]:![],'options':_0xea6648[_0x5f67('0x72')]?_[_0x5f67('0x2e')](_[_0x5f67('0x6d')](_0xea6648[_0x5f67('0x72')]),function(_0x4e531d){return{'name':_0x4e531d[_0x5f67('0x73')],'value':_0x4e531d['name']};}):[]};})};}})[_0x5f67('0x24')](respondWithResult(_0xc05abe,null))[_0x5f67('0x45')](function(_0x3e2d1b){var _0x52eea2=_0x2c58f4[_0x5f67('0x2f')][_0x5f67('0x74')]?0x1f4:_0x3e2d1b['statusCode']||0x1f4;logger['error'](_0x5f67('0x75'),_0x5f67('0x53'),_0x52eea2,JSON['stringify'](_0x3e2d1b));delete _0x3e2d1b[_0x5f67('0x26')];if(_0x52eea2===0x191){_0x52eea2=0x190;}_0xc05abe[_0x5f67('0x17')](_0x52eea2)[_0x5f67('0x27')](_0x2c58f4[_0x5f67('0x2f')][_0x5f67('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x3e2d1b[_0x5f67('0x76')]}:_0x3e2d1b);});}else{var _0xae3ad2=0x1f4;_0xc05abe[_0x5f67('0x17')](_0xae3ad2)[_0x5f67('0x27')]({'message':_0x5f67('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xf92f=['username','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','label','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','options','catch','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction'];(function(_0x35a146,_0x4d3f18){var _0x43dfa8=function(_0x39b747){while(--_0x39b747){_0x35a146['push'](_0x35a146['shift']());}};_0x43dfa8(++_0x4d3f18);}(_0xf92f,0x1f0));var _0xff92=function(_0x4eb2a2,_0x935cdb){_0x4eb2a2=_0x4eb2a2-0x0;var _0x3a0e8d=_0xf92f[_0x4eb2a2];return _0x3a0e8d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff92('0x0'));var zipdir=require(_0xff92('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xff92('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xff92('0x3'));var util=require('util');var path=require(_0xff92('0x4'));var sox=require('sox');var csv=require(_0xff92('0x5'));var ejs=require(_0xff92('0x6'));var fs=require('fs');var fs_extra=require(_0xff92('0x7'));var _=require('lodash');var squel=require(_0xff92('0x8'));var crypto=require(_0xff92('0x9'));var jsforce=require(_0xff92('0xa'));var deskjs=require(_0xff92('0xb'));var toCsv=require(_0xff92('0x5'));var querystring=require(_0xff92('0xc'));var Papa=require(_0xff92('0xd'));var Redis=require(_0xff92('0xe'));var authService=require(_0xff92('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff92('0x10'));var logger=require(_0xff92('0x11'))(_0xff92('0x12'));var utils=require('../../config/utils');var config=require(_0xff92('0x13'));var licenseUtil=require(_0xff92('0x14'));var db=require(_0xff92('0x15'))['db'];var integrations=require(_0xff92('0x16'));function respondWithStatusCode(_0x116444,_0x5e3404){_0x5e3404=_0x5e3404||0xcc;return function(_0x508b3d){if(_0x508b3d){return _0x116444[_0xff92('0x17')](_0x5e3404);}return _0x116444[_0xff92('0x18')](_0x5e3404)[_0xff92('0x19')]();};}function respondWithResult(_0x25a409,_0x4d6376){_0x4d6376=_0x4d6376||0xc8;return function(_0x599058){if(_0x599058){return _0x25a409[_0xff92('0x18')](_0x4d6376)[_0xff92('0x1a')](_0x599058);}};}function respondWithFilteredResult(_0x3270c4,_0x31e95d){return function(_0x283520){if(_0x283520){var _0x10ea48=typeof _0x31e95d[_0xff92('0x1b')]==='undefined'&&typeof _0x31e95d['limit']===_0xff92('0x1c');var _0x568dd5=_0x283520[_0xff92('0x1d')];var _0x5e9c67=_0x10ea48?0x0:_0x31e95d[_0xff92('0x1b')];var _0x4d8169=_0x10ea48?_0x283520[_0xff92('0x1d')]:_0x31e95d[_0xff92('0x1b')]+_0x31e95d[_0xff92('0x1e')];var _0x53e17c;if(_0x4d8169>=_0x568dd5){_0x4d8169=_0x568dd5;_0x53e17c=0xc8;}else{_0x53e17c=0xce;}_0x3270c4['status'](_0x53e17c);return _0x3270c4[_0xff92('0x1f')](_0xff92('0x20'),_0x5e9c67+'-'+_0x4d8169+'/'+_0x568dd5)['json'](_0x283520);}return null;};}function patchUpdates(_0x196dc0){return function(_0x16aa7b){try{jsonpatch[_0xff92('0x21')](_0x16aa7b,_0x196dc0,!![]);}catch(_0x1b062c){return BPromise['reject'](_0x1b062c);}return _0x16aa7b[_0xff92('0x22')]();};}function saveUpdates(_0x5856fa,_0x82a367){return function(_0x3ee31f){if(_0x3ee31f){return _0x3ee31f[_0xff92('0x23')](_0x5856fa)[_0xff92('0x24')](function(_0xf5a56a){return _0xf5a56a;});}return null;};}function removeEntity(_0x1b5fca,_0x2beea1){return function(_0x4acd07){if(_0x4acd07){return _0x4acd07[_0xff92('0x25')]()[_0xff92('0x24')](function(){_0x1b5fca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0415c,_0x456b6d){return function(_0x291a99){if(!_0x291a99){_0xd0415c[_0xff92('0x17')](0x194);}return _0x291a99;};}function handleError(_0x7edb67,_0x21ef7e){_0x21ef7e=_0x21ef7e||0x1f4;return function(_0x18dcaa){logger['error'](_0x18dcaa[_0xff92('0x26')]);if(_0x18dcaa[_0xff92('0x27')]){delete _0x18dcaa['name'];}_0x7edb67[_0xff92('0x18')](_0x21ef7e)[_0xff92('0x28')](_0x18dcaa);};}exports[_0xff92('0x29')]=function(_0x1a54c3,_0x158df1){var _0xdb837d={},_0x369c85={},_0x16ee04={'count':0x0,'rows':[]};var _0x2df438=_[_0xff92('0x2a')](db[_0xff92('0x2b')][_0xff92('0x2c')],function(_0x24703b){return{'name':_0x24703b[_0xff92('0x2d')],'type':_0x24703b[_0xff92('0x2e')][_0xff92('0x2f')]};});_0x369c85[_0xff92('0x30')]=_[_0xff92('0x2a')](_0x2df438,'name');_0x369c85['query']=_['keys'](_0x1a54c3[_0xff92('0x31')]);_0x369c85['filters']=_[_0xff92('0x32')](_0x369c85[_0xff92('0x30')],_0x369c85['query']);_0xdb837d[_0xff92('0x33')]=_[_0xff92('0x32')](_0x369c85[_0xff92('0x30')],qs[_0xff92('0x34')](_0x1a54c3[_0xff92('0x31')]['fields']));_0xdb837d[_0xff92('0x33')]=_0xdb837d[_0xff92('0x33')][_0xff92('0x35')]?_0xdb837d[_0xff92('0x33')]:_0x369c85['model'];if(!_0x1a54c3[_0xff92('0x31')][_0xff92('0x36')](_0xff92('0x37'))){_0xdb837d['limit']=qs[_0xff92('0x1e')](_0x1a54c3[_0xff92('0x31')][_0xff92('0x1e')]);_0xdb837d[_0xff92('0x1b')]=qs['offset'](_0x1a54c3[_0xff92('0x31')][_0xff92('0x1b')]);}_0xdb837d[_0xff92('0x38')]=qs[_0xff92('0x39')](_0x1a54c3[_0xff92('0x31')][_0xff92('0x39')]);_0xdb837d[_0xff92('0x3a')]=qs['filters'](_[_0xff92('0x3b')](_0x1a54c3[_0xff92('0x31')],_0x369c85[_0xff92('0x3c')]),_0x2df438);if(_0x1a54c3['query']['filter']){_0xdb837d['where']=_[_0xff92('0x3d')](_0xdb837d[_0xff92('0x3a')],{'$or':_[_0xff92('0x2a')](_0x2df438,function(_0x44cb07){if(_0x44cb07[_0xff92('0x2e')]!==_0xff92('0x3e')){var _0x47fb53={};_0x47fb53[_0x44cb07[_0xff92('0x27')]]={'$like':'%'+_0x1a54c3[_0xff92('0x31')][_0xff92('0x3f')]+'%'};return _0x47fb53;}})});}_0xdb837d=_[_0xff92('0x3d')]({},_0xdb837d,_0x1a54c3['options']);var _0x547c72={'where':_0xdb837d[_0xff92('0x3a')]};return db[_0xff92('0x2b')][_0xff92('0x1d')](_0x547c72)['then'](function(_0x7a9b84){_0x16ee04[_0xff92('0x1d')]=_0x7a9b84;if(_0x1a54c3[_0xff92('0x31')][_0xff92('0x40')]){_0xdb837d[_0xff92('0x41')]=[{'all':!![]}];}return db[_0xff92('0x2b')][_0xff92('0x42')](_0xdb837d);})[_0xff92('0x24')](function(_0xd24251){_0x16ee04['rows']=_0xd24251;return _0x16ee04;})[_0xff92('0x24')](respondWithFilteredResult(_0x158df1,_0xdb837d))['catch'](handleError(_0x158df1,null));};exports[_0xff92('0x43')]=function(_0x5e4cc3,_0xad2aca){var _0x484f7d={'raw':![],'where':{'id':_0x5e4cc3[_0xff92('0x44')]['id']}},_0x34250b={};_0x34250b[_0xff92('0x30')]=_[_0xff92('0x45')](db[_0xff92('0x2b')][_0xff92('0x2c')]);_0x34250b['query']=_[_0xff92('0x45')](_0x5e4cc3[_0xff92('0x31')]);_0x34250b['filters']=_['intersection'](_0x34250b[_0xff92('0x30')],_0x34250b[_0xff92('0x31')]);_0x484f7d[_0xff92('0x33')]=_[_0xff92('0x32')](_0x34250b['model'],qs['fields'](_0x5e4cc3[_0xff92('0x31')][_0xff92('0x34')]));_0x484f7d[_0xff92('0x33')]=_0x484f7d[_0xff92('0x33')][_0xff92('0x35')]?_0x484f7d[_0xff92('0x33')]:_0x34250b['model'];if(_0x5e4cc3[_0xff92('0x31')][_0xff92('0x40')]){_0x484f7d['include']=[{'all':!![]}];}_0x484f7d=_[_0xff92('0x3d')]({},_0x484f7d,_0x5e4cc3[_0xff92('0x46')]);return db['SugarcrmAccount']['find'](_0x484f7d)[_0xff92('0x24')](handleEntityNotFound(_0xad2aca,null))[_0xff92('0x24')](respondWithResult(_0xad2aca,null))[_0xff92('0x47')](handleError(_0xad2aca,null));};exports['create']=function(_0xc0e773,_0x59e2e9){return db[_0xff92('0x2b')][_0xff92('0x48')](_0xc0e773[_0xff92('0x49')],{})[_0xff92('0x24')](respondWithResult(_0x59e2e9,0xc9))['catch'](handleError(_0x59e2e9,null));};exports[_0xff92('0x23')]=function(_0x176fdd,_0x59d9a1){if(_0x176fdd[_0xff92('0x49')]['id']){delete _0x176fdd[_0xff92('0x49')]['id'];}return db[_0xff92('0x2b')]['find']({'where':{'id':_0x176fdd[_0xff92('0x44')]['id']}})[_0xff92('0x24')](handleEntityNotFound(_0x59d9a1,null))[_0xff92('0x24')](saveUpdates(_0x176fdd['body'],null))[_0xff92('0x24')](respondWithResult(_0x59d9a1,null))[_0xff92('0x47')](handleError(_0x59d9a1,null));};exports['destroy']=function(_0x4eefe1,_0x29d025){return db['SugarcrmAccount'][_0xff92('0x4a')]({'where':{'id':_0x4eefe1['params']['id']}})[_0xff92('0x24')](handleEntityNotFound(_0x29d025,null))[_0xff92('0x24')](removeEntity(_0x29d025,null))[_0xff92('0x47')](handleError(_0x29d025,null));};exports[_0xff92('0x4b')]=function(_0x3053f3,_0x3d1204,_0x3ff75b){var _0x375afb={};var _0x479b8e={};var _0x9198e2;var _0x1d2bc5;return db[_0xff92('0x2b')][_0xff92('0x4c')]({'where':{'id':_0x3053f3['params']['id']}})[_0xff92('0x24')](handleEntityNotFound(_0x3d1204,null))[_0xff92('0x24')](function(_0x85d6f3){if(_0x85d6f3){_0x9198e2=_0x85d6f3;_0x479b8e[_0xff92('0x30')]=_[_0xff92('0x45')](db[_0xff92('0x4d')][_0xff92('0x2c')]);_0x479b8e[_0xff92('0x31')]=_['keys'](_0x3053f3['query']);_0x479b8e['filters']=_[_0xff92('0x32')](_0x479b8e[_0xff92('0x30')],_0x479b8e[_0xff92('0x31')]);_0x375afb[_0xff92('0x33')]=_[_0xff92('0x32')](_0x479b8e[_0xff92('0x30')],qs['fields'](_0x3053f3[_0xff92('0x31')]['fields']));_0x375afb[_0xff92('0x33')]=_0x375afb[_0xff92('0x33')][_0xff92('0x35')]?_0x375afb['attributes']:_0x479b8e['model'];_0x375afb[_0xff92('0x38')]=qs[_0xff92('0x39')](_0x3053f3['query'][_0xff92('0x39')]);_0x375afb['where']=qs[_0xff92('0x3c')](_[_0xff92('0x3b')](_0x3053f3[_0xff92('0x31')],_0x479b8e[_0xff92('0x3c')]));if(_0x3053f3[_0xff92('0x31')][_0xff92('0x3f')]){_0x375afb[_0xff92('0x3a')]=_[_0xff92('0x3d')](_0x375afb[_0xff92('0x3a')],{'$or':_[_0xff92('0x2a')](_0x375afb[_0xff92('0x33')],function(_0x2b960f){var _0xcbcb81={};_0xcbcb81[_0x2b960f]={'$like':'%'+_0x3053f3[_0xff92('0x31')][_0xff92('0x3f')]+'%'};return _0xcbcb81;})});}_0x375afb=_['merge']({},_0x375afb,_0x3053f3['options']);return _0x9198e2[_0xff92('0x4b')](_0x375afb);}})['then'](function(_0x39acf0){if(_0x39acf0){_0x1d2bc5=_0x39acf0[_0xff92('0x35')];if(!_0x3053f3[_0xff92('0x31')][_0xff92('0x36')](_0xff92('0x37'))){_0x375afb[_0xff92('0x1e')]=qs[_0xff92('0x1e')](_0x3053f3['query'][_0xff92('0x1e')]);_0x375afb[_0xff92('0x1b')]=qs['offset'](_0x3053f3[_0xff92('0x31')][_0xff92('0x1b')]);}return _0x9198e2[_0xff92('0x4b')](_0x375afb);}})[_0xff92('0x24')](function(_0x193daa){if(_0x193daa){return _0x193daa?{'count':_0x1d2bc5,'rows':_0x193daa}:null;}})[_0xff92('0x24')](respondWithResult(_0x3d1204,null))[_0xff92('0x47')](handleError(_0x3d1204,null));};exports['addConfiguration']=function(_0x596a99,_0x317860,_0x5f2332){if(_0x596a99[_0xff92('0x49')]['id']){delete _0x596a99[_0xff92('0x49')]['id'];}return db['SugarcrmAccount'][_0xff92('0x4c')]({'where':{'id':_0x596a99[_0xff92('0x44')]['id']}})[_0xff92('0x24')](handleEntityNotFound(_0x317860,null))[_0xff92('0x24')](function(_0x575008){if(_0x575008){_0x596a99[_0xff92('0x49')]['AccountId']=_0x575008['id'];_0x596a99[_0xff92('0x49')][_0xff92('0x4e')]=integrations[_0xff92('0x4f')](_0x596a99['body'][_0xff92('0x50')],_0x596a99[_0xff92('0x49')]['type']);_0x596a99[_0xff92('0x49')]['Descriptions']=integrations[_0xff92('0x51')](_0x596a99['body']['channel'],_0x596a99[_0xff92('0x49')][_0xff92('0x2e')]);return db[_0xff92('0x4d')][_0xff92('0x48')](_0x596a99[_0xff92('0x49')],{'include':[{'model':db[_0xff92('0x52')],'as':_0xff92('0x4e')},{'model':db[_0xff92('0x52')],'as':_0xff92('0x53')}]});}return null;})[_0xff92('0x24')](respondWithResult(_0x317860,null))[_0xff92('0x47')](handleError(_0x317860,null));};exports[_0xff92('0x54')]=function(_0x535fcb,_0x7cf819,_0x140630){var _0x2d3f6a='';var _0x57de27=['id',_0xff92('0x27'),'assigned_user_id',_0xff92('0x55'),_0xff92('0x56'),_0xff92('0x57'),_0xff92('0x58'),_0xff92('0x59'),_0xff92('0x5a'),_0xff92('0x5b'),_0xff92('0x5c'),_0xff92('0x5d')];return db[_0xff92('0x2b')][_0xff92('0x4c')]({'where':{'id':_0x535fcb[_0xff92('0x44')]['id']},'attributes':['id',_0xff92('0x5e'),'password',_0xff92('0x5f')]})[_0xff92('0x24')](handleEntityNotFound(_0x7cf819,null))[_0xff92('0x24')](function(_0x806be5){if(_0x806be5){_0x2d3f6a=_0x806be5[_0xff92('0x5f')];var _0x8c8035=_0x2d3f6a['slice'](-0x1);if(_0x8c8035==='/'){_0x2d3f6a=_0x2d3f6a[_0xff92('0x60')](0x0,_0x2d3f6a['lastIndexOf'](_0x8c8035));}return rp({'method':_0xff92('0x61'),'uri':util[_0xff92('0x62')](_0xff92('0x63'),_0x2d3f6a,_0xff92('0x64')),'json':!![],'form':{'method':_0xff92('0x65'),'input_type':_0xff92('0x66'),'response_type':_0xff92('0x66'),'rest_data':JSON[_0xff92('0x67')]({'user_auth':{'user_name':_0x806be5[_0xff92('0x5e')],'password':_0x806be5[_0xff92('0x68')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xff92('0x24')](function(_0x2a13f5){if(_0x2a13f5&&_0x2a13f5['name']!==_0xff92('0x69')&&_0x2a13f5[_0xff92('0x27')]!==_0xff92('0x6a')){return rp({'method':'POST','uri':util[_0xff92('0x62')]('%s%s',_0x2d3f6a,_0xff92('0x64')),'json':!![],'form':{'method':_0xff92('0x6b'),'input_type':_0xff92('0x66'),'response_type':_0xff92('0x66'),'rest_data':JSON[_0xff92('0x67')]({'session':_0x2a13f5['id'],'module_name':_0xff92('0x6c')})}})[_0xff92('0x24')](function(_0x4baf89){if(_0x4baf89){var _0x5dba30=_[_0xff92('0x6d')](_0x4baf89[_0xff92('0x6e')]);_['remove'](_0x5dba30,function(_0x3187e4){return _0x57de27['includes'](_0x3187e4[_0xff92('0x27')]);});return{'count':_0x5dba30[_0xff92('0x35')],'rows':_['map'](_0x5dba30,function(_0x2821e8){return{'id':_0x2821e8[_0xff92('0x27')],'name':_0x2821e8[_0xff92('0x6f')],'custom':_['endsWith'](_0x2821e8[_0xff92('0x27')],'_c')?!![]:![],'options':_0x2821e8[_0xff92('0x46')]?_[_0xff92('0x2a')](_[_0xff92('0x6d')](_0x2821e8[_0xff92('0x46')]),function(_0x2b7299){return{'name':_0x2b7299[_0xff92('0x70')],'value':_0x2b7299[_0xff92('0x27')]};}):[]};})};}})[_0xff92('0x24')](respondWithResult(_0x7cf819,null))['catch'](function(_0x4463c1){var _0x416e5b=_0x535fcb[_0xff92('0x31')][_0xff92('0x71')]?0x1f4:_0x4463c1[_0xff92('0x72')]||0x1f4;logger[_0xff92('0x73')](_0xff92('0x74'),'getFields',_0x416e5b,JSON[_0xff92('0x67')](_0x4463c1));delete _0x4463c1[_0xff92('0x27')];if(_0x416e5b===0x191){_0x416e5b=0x190;}_0x7cf819[_0xff92('0x18')](_0x416e5b)[_0xff92('0x28')](_0x535fcb[_0xff92('0x31')]['test']?{'message':_0xff92('0x75'),'statusCode':_0x4463c1['statusCode']}:_0x4463c1);});}else{var _0x381c19=0x1f4;_0x7cf819['status'](_0x381c19)[_0xff92('0x28')]({'message':_0xff92('0x75'),'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 be8ca12..feb2db3 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 _0x8b33=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','util','api','moment','bluebird'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x8b33,0x64));var _0x38b3=function(_0x383841,_0x2043b3){_0x383841=_0x383841-0x0;var _0x513210=_0x8b33[_0x383841];return _0x513210;};'use strict';var _=require('lodash');var util=require(_0x38b3('0x0'));var logger=require('../../config/logger')(_0x38b3('0x1'));var moment=require(_0x38b3('0x2'));var BPromise=require(_0x38b3('0x3'));var rp=require(_0x38b3('0x4'));var fs=require('fs');var path=require(_0x38b3('0x5'));var rimraf=require(_0x38b3('0x6'));var config=require(_0x38b3('0x7'));var attributes=require(_0x38b3('0x8'));var integrations=require(_0x38b3('0x9'));module['exports']=function(_0x48d8c7,_0x174a8d){return _0x48d8c7[_0x38b3('0xa')](_0x38b3('0xb'),attributes,{'tableName':_0x38b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13c9=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger'];(function(_0x1bdbd1,_0x22340f){var _0x375a5d=function(_0x5931aa){while(--_0x5931aa){_0x1bdbd1['push'](_0x1bdbd1['shift']());}};_0x375a5d(++_0x22340f);}(_0x13c9,0x1c1));var _0x913c=function(_0x41354b,_0x205d08){_0x41354b=_0x41354b-0x0;var _0x328aec=_0x13c9[_0x41354b];return _0x328aec;};'use strict';var _=require('lodash');var util=require(_0x913c('0x0'));var logger=require(_0x913c('0x1'))('api');var moment=require(_0x913c('0x2'));var BPromise=require(_0x913c('0x3'));var rp=require(_0x913c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x913c('0x5'));var config=require(_0x913c('0x6'));var attributes=require(_0x913c('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2c4741,_0x52e125){return _0x2c4741[_0x913c('0x8')](_0x913c('0x9'),attributes,{'tableName':_0x913c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index b632f3f..851abcb 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 _0x28c0=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','attributes','map','model','ShowSugarcrmAccount','find','lodash','util'];(function(_0x12727b,_0xb9db62){var _0x1f871e=function(_0x1a535c){while(--_0x1a535c){_0x12727b['push'](_0x12727b['shift']());}};_0x1f871e(++_0xb9db62);}(_0x28c0,0x1ec));var _0x028c=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x28c0[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x028c('0x0'));var util=require(_0x028c('0x1'));var moment=require(_0x028c('0x2'));var BPromise=require(_0x028c('0x3'));var rs=require(_0x028c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x028c('0x5'))['db'];var utils=require(_0x028c('0x6'));var logger=require(_0x028c('0x7'))(_0x028c('0x8'));var config=require(_0x028c('0x9'));var jayson=require(_0x028c('0xa'));var client=jayson[_0x028c('0xb')][_0x028c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15a064,_0x251348,_0x133a22){return new BPromise(function(_0x12f991,_0xe8f431){return client[_0x028c('0xd')](_0x15a064,_0x133a22)[_0x028c('0xe')](function(_0x3c33cb){logger[_0x028c('0xf')](_0x028c('0x10'),_0x251348,_0x028c('0x11'));logger[_0x028c('0x12')](_0x028c('0x13'),_0x251348,'request\x20sent',JSON[_0x028c('0x14')](_0x3c33cb));if(_0x3c33cb[_0x028c('0x15')]){if(_0x3c33cb[_0x028c('0x15')]['code']===0x1f4){logger['error'](_0x028c('0x10'),_0x251348,_0x3c33cb[_0x028c('0x15')][_0x028c('0x16')]);return _0xe8f431(_0x3c33cb[_0x028c('0x15')][_0x028c('0x16')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x251348,_0x3c33cb[_0x028c('0x15')]['message']);return _0x12f991(_0x3c33cb['error']['message']);}else{logger[_0x028c('0xf')](_0x028c('0x10'),_0x251348,_0x028c('0x11'));_0x12f991(_0x3c33cb[_0x028c('0x17')][_0x028c('0x16')]);}})[_0x028c('0x18')](function(_0x34e95e){logger[_0x028c('0x15')](_0x028c('0x10'),_0x251348,_0x34e95e);_0xe8f431(_0x34e95e);});});}exports[_0x028c('0x19')]=function(_0x3b9542){var _0x228e8e=this;return new Promise(function(_0x17de42,_0x2356cc){return db[_0x028c('0x1a')][_0x028c('0x1b')]({'raw':_0x3b9542[_0x028c('0x1c')]?_0x3b9542['options'][_0x028c('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b9542['options']?_0x3b9542['options'][_0x028c('0x1e')]||null:null,'attributes':_0x3b9542[_0x028c('0x1c')]?_0x3b9542['options']['attributes']||null:null,'limit':_0x3b9542['options']?_0x3b9542[_0x028c('0x1c')][_0x028c('0x1f')]||null:null,'include':_0x3b9542['options']?_0x3b9542[_0x028c('0x1c')][_0x028c('0x20')]?_['map'](_0x3b9542['options'][_0x028c('0x20')],function(_0x15d67b){return{'model':db[_0x15d67b['model']],'as':_0x15d67b['as'],'attributes':_0x15d67b[_0x028c('0x21')],'include':_0x15d67b[_0x028c('0x20')]?_['map'](_0x15d67b['include'],function(_0x385764){return{'model':db[_0x385764['model']],'as':_0x385764['as'],'attributes':_0x385764[_0x028c('0x21')],'include':_0x385764[_0x028c('0x20')]?_[_0x028c('0x22')](_0x385764[_0x028c('0x20')],function(_0x18e9e7){return{'model':db[_0x18e9e7[_0x028c('0x23')]],'as':_0x18e9e7['as'],'attributes':_0x18e9e7[_0x028c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe78189){logger[_0x028c('0xf')](_0x028c('0x19'),_0x3b9542);logger[_0x028c('0x12')](_0x028c('0x19'),_0x3b9542,JSON['stringify'](_0xe78189));_0x17de42(_0xe78189);})[_0x028c('0x18')](function(_0x211209){logger[_0x028c('0x15')]('GetSugarcrmAccount',_0x211209[_0x028c('0x16')],_0x3b9542);_0x2356cc(_0x228e8e[_0x028c('0x15')](0x1f4,_0x211209[_0x028c('0x16')]));});});};exports[_0x028c('0x24')]=function(_0x130f93){var _0x40f87c=this;return new Promise(function(_0x1cdd33,_0x5e91c0){return db[_0x028c('0x1a')][_0x028c('0x25')]({'raw':_0x130f93[_0x028c('0x1c')]?_0x130f93[_0x028c('0x1c')][_0x028c('0x1d')]===undefined?!![]:![]:!![],'where':_0x130f93[_0x028c('0x1c')]?_0x130f93[_0x028c('0x1c')][_0x028c('0x1e')]||null:null,'attributes':_0x130f93[_0x028c('0x1c')]?_0x130f93[_0x028c('0x1c')][_0x028c('0x21')]||null:null,'include':_0x130f93[_0x028c('0x1c')]?_0x130f93[_0x028c('0x1c')][_0x028c('0x20')]?_['map'](_0x130f93[_0x028c('0x1c')]['include'],function(_0x4d8e83){return{'model':db[_0x4d8e83[_0x028c('0x23')]],'as':_0x4d8e83['as'],'attributes':_0x4d8e83[_0x028c('0x21')],'include':_0x4d8e83[_0x028c('0x20')]?_[_0x028c('0x22')](_0x4d8e83[_0x028c('0x20')],function(_0x26f580){return{'model':db[_0x26f580['model']],'as':_0x26f580['as'],'attributes':_0x26f580[_0x028c('0x21')],'include':_0x26f580[_0x028c('0x20')]?_[_0x028c('0x22')](_0x26f580[_0x028c('0x20')],function(_0x17b82e){return{'model':db[_0x17b82e[_0x028c('0x23')]],'as':_0x17b82e['as'],'attributes':_0x17b82e[_0x028c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x028c('0xe')](function(_0x3b82bc){logger[_0x028c('0xf')](_0x028c('0x24'),_0x130f93);logger[_0x028c('0x12')]('ShowSugarcrmAccount',_0x130f93,JSON[_0x028c('0x14')](_0x3b82bc));_0x1cdd33(_0x3b82bc);})[_0x028c('0x18')](function(_0x43a601){logger['error'](_0x028c('0x24'),_0x43a601[_0x028c('0x16')],_0x130f93);_0x5e91c0(_0x40f87c[_0x028c('0x15')](0x1f4,_0x43a601[_0x028c('0x16')]));});});}; \ No newline at end of file +var _0xa4c8=['attributes','limit','include','model','map','catch','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetSugarcrmAccount','findAll','options','raw','where'];(function(_0x204665,_0x4b7744){var _0x16fa00=function(_0x26f6b8){while(--_0x26f6b8){_0x204665['push'](_0x204665['shift']());}};_0x16fa00(++_0x4b7744);}(_0xa4c8,0x72));var _0x8a4c=function(_0x35d658,_0x34165a){_0x35d658=_0x35d658-0x0;var _0x2f95f4=_0xa4c8[_0x35d658];return _0x2f95f4;};'use strict';var _=require(_0x8a4c('0x0'));var util=require(_0x8a4c('0x1'));var moment=require(_0x8a4c('0x2'));var BPromise=require(_0x8a4c('0x3'));var rs=require(_0x8a4c('0x4'));var fs=require('fs');var Redis=require(_0x8a4c('0x5'));var db=require(_0x8a4c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a4c('0x7'))(_0x8a4c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8a4c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x325169,_0x5ef93f,_0x314f60){return new BPromise(function(_0x58570c,_0x4ff8aa){return client[_0x8a4c('0xa')](_0x325169,_0x314f60)[_0x8a4c('0xb')](function(_0x5a574b){logger[_0x8a4c('0xc')](_0x8a4c('0xd'),_0x5ef93f,_0x8a4c('0xe'));logger[_0x8a4c('0xf')](_0x8a4c('0x10'),_0x5ef93f,_0x8a4c('0xe'),JSON[_0x8a4c('0x11')](_0x5a574b));if(_0x5a574b[_0x8a4c('0x12')]){if(_0x5a574b[_0x8a4c('0x12')]['code']===0x1f4){logger[_0x8a4c('0x12')](_0x8a4c('0xd'),_0x5ef93f,_0x5a574b[_0x8a4c('0x12')]['message']);return _0x4ff8aa(_0x5a574b[_0x8a4c('0x12')][_0x8a4c('0x13')]);}logger[_0x8a4c('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x5ef93f,_0x5a574b[_0x8a4c('0x12')][_0x8a4c('0x13')]);return _0x58570c(_0x5a574b[_0x8a4c('0x12')]['message']);}else{logger[_0x8a4c('0xc')](_0x8a4c('0xd'),_0x5ef93f,_0x8a4c('0xe'));_0x58570c(_0x5a574b[_0x8a4c('0x14')]['message']);}})['catch'](function(_0x4df5b9){logger[_0x8a4c('0x12')](_0x8a4c('0xd'),_0x5ef93f,_0x4df5b9);_0x4ff8aa(_0x4df5b9);});});}exports[_0x8a4c('0x15')]=function(_0x3b1f51){var _0x2990bc=this;return new Promise(function(_0x1725e9,_0x360cf1){return db['SugarcrmAccount'][_0x8a4c('0x16')]({'raw':_0x3b1f51[_0x8a4c('0x17')]?_0x3b1f51[_0x8a4c('0x17')][_0x8a4c('0x18')]===undefined?!![]:![]:!![],'where':_0x3b1f51[_0x8a4c('0x17')]?_0x3b1f51[_0x8a4c('0x17')][_0x8a4c('0x19')]||null:null,'attributes':_0x3b1f51[_0x8a4c('0x17')]?_0x3b1f51[_0x8a4c('0x17')][_0x8a4c('0x1a')]||null:null,'limit':_0x3b1f51[_0x8a4c('0x17')]?_0x3b1f51[_0x8a4c('0x17')][_0x8a4c('0x1b')]||null:null,'include':_0x3b1f51[_0x8a4c('0x17')]?_0x3b1f51[_0x8a4c('0x17')][_0x8a4c('0x1c')]?_['map'](_0x3b1f51['options'][_0x8a4c('0x1c')],function(_0x2d1007){return{'model':db[_0x2d1007[_0x8a4c('0x1d')]],'as':_0x2d1007['as'],'attributes':_0x2d1007[_0x8a4c('0x1a')],'include':_0x2d1007[_0x8a4c('0x1c')]?_['map'](_0x2d1007[_0x8a4c('0x1c')],function(_0x241b2c){return{'model':db[_0x241b2c[_0x8a4c('0x1d')]],'as':_0x241b2c['as'],'attributes':_0x241b2c[_0x8a4c('0x1a')],'include':_0x241b2c[_0x8a4c('0x1c')]?_[_0x8a4c('0x1e')](_0x241b2c[_0x8a4c('0x1c')],function(_0x551872){return{'model':db[_0x551872[_0x8a4c('0x1d')]],'as':_0x551872['as'],'attributes':_0x551872['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a4c('0xb')](function(_0x116126){logger[_0x8a4c('0xc')](_0x8a4c('0x15'),_0x3b1f51);logger[_0x8a4c('0xf')](_0x8a4c('0x15'),_0x3b1f51,JSON['stringify'](_0x116126));_0x1725e9(_0x116126);})[_0x8a4c('0x1f')](function(_0x22abbd){logger[_0x8a4c('0x12')]('GetSugarcrmAccount',_0x22abbd[_0x8a4c('0x13')],_0x3b1f51);_0x360cf1(_0x2990bc['error'](0x1f4,_0x22abbd[_0x8a4c('0x13')]));});});};exports[_0x8a4c('0x20')]=function(_0x2f5cd9){var _0x14e592=this;return new Promise(function(_0x10c0da,_0x4c206b){return db[_0x8a4c('0x21')][_0x8a4c('0x22')]({'raw':_0x2f5cd9['options']?_0x2f5cd9[_0x8a4c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2f5cd9[_0x8a4c('0x17')]?_0x2f5cd9[_0x8a4c('0x17')]['where']||null:null,'attributes':_0x2f5cd9[_0x8a4c('0x17')]?_0x2f5cd9[_0x8a4c('0x17')]['attributes']||null:null,'include':_0x2f5cd9[_0x8a4c('0x17')]?_0x2f5cd9[_0x8a4c('0x17')][_0x8a4c('0x1c')]?_[_0x8a4c('0x1e')](_0x2f5cd9['options'][_0x8a4c('0x1c')],function(_0x302fbe){return{'model':db[_0x302fbe[_0x8a4c('0x1d')]],'as':_0x302fbe['as'],'attributes':_0x302fbe[_0x8a4c('0x1a')],'include':_0x302fbe[_0x8a4c('0x1c')]?_['map'](_0x302fbe[_0x8a4c('0x1c')],function(_0x21f538){return{'model':db[_0x21f538[_0x8a4c('0x1d')]],'as':_0x21f538['as'],'attributes':_0x21f538['attributes'],'include':_0x21f538[_0x8a4c('0x1c')]?_[_0x8a4c('0x1e')](_0x21f538['include'],function(_0x58f56e){return{'model':db[_0x58f56e['model']],'as':_0x58f56e['as'],'attributes':_0x58f56e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19cdc5){logger[_0x8a4c('0xc')](_0x8a4c('0x20'),_0x2f5cd9);logger[_0x8a4c('0xf')]('ShowSugarcrmAccount',_0x2f5cd9,JSON[_0x8a4c('0x11')](_0x19cdc5));_0x10c0da(_0x19cdc5);})[_0x8a4c('0x1f')](function(_0x150fa9){logger['error']('ShowSugarcrmAccount',_0x150fa9[_0x8a4c('0x13')],_0x2f5cd9);_0x4c206b(_0x14e592[_0x8a4c('0x12')](0x1f4,_0x150fa9['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 44e94df..024dd4f 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 _0x563f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x36fac3,_0x2ecf8b){var _0x576082=function(_0x50a248){while(--_0x50a248){_0x36fac3['push'](_0x36fac3['shift']());}};_0x576082(++_0x2ecf8b);}(_0x563f,0x131));var _0xf563=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x563f[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xf563('0x0'));var util=require(_0xf563('0x1'));var path=require(_0xf563('0x2'));var timeout=require(_0xf563('0x3'));var express=require(_0xf563('0x4'));var router=express[_0xf563('0x5')]();var fs_extra=require(_0xf563('0x6'));var auth=require(_0xf563('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf563('0x8'));var controller=require(_0xf563('0x9'));router['get']('/',auth[_0xf563('0xa')](),controller[_0xf563('0xb')]);router['get'](_0xf563('0xc'),auth[_0xf563('0xa')](),controller[_0xf563('0xd')]);router[_0xf563('0xe')](_0xf563('0xf'),auth[_0xf563('0xa')](),controller[_0xf563('0x10')]);router[_0xf563('0xe')](_0xf563('0x11'),auth['isAuthenticated'](),controller[_0xf563('0x12')]);router[_0xf563('0xe')](_0xf563('0x13'),auth[_0xf563('0xa')](),controller[_0xf563('0x14')]);router[_0xf563('0x15')]('/',auth[_0xf563('0xa')](),controller[_0xf563('0x16')]);router[_0xf563('0x17')](_0xf563('0xc'),auth[_0xf563('0xa')](),controller[_0xf563('0x18')]);router[_0xf563('0x19')](_0xf563('0xc'),auth['isAuthenticated'](),controller[_0xf563('0x1a')]);module[_0xf563('0x1b')]=router; \ No newline at end of file +var _0xecd5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','multer','util','path','express'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xecd5,0x15c));var _0x5ecd=function(_0x1ecd76,_0x49264a){_0x1ecd76=_0x1ecd76-0x0;var _0x3fb85b=_0xecd5[_0x1ecd76];return _0x3fb85b;};'use strict';var multer=require(_0x5ecd('0x0'));var util=require(_0x5ecd('0x1'));var path=require(_0x5ecd('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ecd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5ecd('0x4'));var interaction=require(_0x5ecd('0x5'));var config=require(_0x5ecd('0x6'));var controller=require(_0x5ecd('0x7'));router['get']('/',auth[_0x5ecd('0x8')](),controller[_0x5ecd('0x9')]);router[_0x5ecd('0xa')](_0x5ecd('0xb'),auth[_0x5ecd('0x8')](),controller[_0x5ecd('0xc')]);router[_0x5ecd('0xa')](_0x5ecd('0xd'),auth[_0x5ecd('0x8')](),controller[_0x5ecd('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x5ecd('0xf')]);router['get'](_0x5ecd('0x10'),auth[_0x5ecd('0x8')](),controller[_0x5ecd('0x11')]);router['post']('/',auth[_0x5ecd('0x8')](),controller[_0x5ecd('0x12')]);router[_0x5ecd('0x13')](_0x5ecd('0xb'),auth[_0x5ecd('0x8')](),controller['update']);router['delete'](_0x5ecd('0xb'),auth['isAuthenticated'](),controller[_0x5ecd('0x14')]);module[_0x5ecd('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index b59b6a3..637257c 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 _0x0c00=['exports','STRING','sequelize'];(function(_0x53d7c4,_0x21ebe1){var _0x4107d9=function(_0x5cac1e){while(--_0x5cac1e){_0x53d7c4['push'](_0x53d7c4['shift']());}};_0x4107d9(++_0x21ebe1);}(_0x0c00,0x77));var _0x00c0=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x0c00[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x00c0('0x0'));module[_0x00c0('0x1')]={'name':{'type':Sequelize[_0x00c0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb197=['STRING','sequelize'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb197,0x19b));var _0x7b19=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0xb197[_0x1709e7];return _0x402819;};'use strict';var Sequelize=require(_0x7b19('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b19('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 74dd0be..5cabf8e 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 _0x0e26=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','intersection','includeAll','find','catch','create','body','destroy','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','attributes','fields'];(function(_0x2327ce,_0x5c2ded){var _0x72dc62=function(_0x1d05f8){while(--_0x1d05f8){_0x2327ce['push'](_0x2327ce['shift']());}};_0x72dc62(++_0x5c2ded);}(_0x0e26,0x10c));var _0x60e2=function(_0x57de79,_0x4165d4){_0x57de79=_0x57de79-0x0;var _0xce00f7=_0x0e26[_0x57de79];return _0xce00f7;};'use strict';var emlformat=require(_0x60e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x60e2('0x1'));var jsonpatch=require(_0x60e2('0x2'));var rp=require('request-promise');var moment=require(_0x60e2('0x3'));var BPromise=require(_0x60e2('0x4'));var Mustache=require(_0x60e2('0x5'));var util=require(_0x60e2('0x6'));var path=require(_0x60e2('0x7'));var sox=require(_0x60e2('0x8'));var csv=require(_0x60e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60e2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x60e2('0xb'));var jsforce=require(_0x60e2('0xc'));var deskjs=require(_0x60e2('0xd'));var toCsv=require(_0x60e2('0x9'));var querystring=require(_0x60e2('0xe'));var Papa=require(_0x60e2('0xf'));var Redis=require(_0x60e2('0x10'));var authService=require(_0x60e2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x60e2('0x12'))(_0x60e2('0x13'));var utils=require(_0x60e2('0x14'));var config=require(_0x60e2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x60e2('0x16'))['db'];function respondWithStatusCode(_0x12cb74,_0x3ef58d){_0x3ef58d=_0x3ef58d||0xcc;return function(_0x88b5c4){if(_0x88b5c4){return _0x12cb74['sendStatus'](_0x3ef58d);}return _0x12cb74[_0x60e2('0x17')](_0x3ef58d)[_0x60e2('0x18')]();};}function respondWithResult(_0x274fbd,_0x46719c){_0x46719c=_0x46719c||0xc8;return function(_0x45a051){if(_0x45a051){return _0x274fbd[_0x60e2('0x17')](_0x46719c)[_0x60e2('0x19')](_0x45a051);}};}function respondWithFilteredResult(_0x19236b,_0x3d6275){return function(_0x346b3c){if(_0x346b3c){var _0xe31ac7=typeof _0x3d6275[_0x60e2('0x1a')]===_0x60e2('0x1b')&&typeof _0x3d6275['limit']===_0x60e2('0x1b');var _0x45f827=_0x346b3c['count'];var _0xd24e2c=_0xe31ac7?0x0:_0x3d6275[_0x60e2('0x1a')];var _0x42ff26=_0xe31ac7?_0x346b3c[_0x60e2('0x1c')]:_0x3d6275[_0x60e2('0x1a')]+_0x3d6275[_0x60e2('0x1d')];var _0x3a2d2a;if(_0x42ff26>=_0x45f827){_0x42ff26=_0x45f827;_0x3a2d2a=0xc8;}else{_0x3a2d2a=0xce;}_0x19236b['status'](_0x3a2d2a);return _0x19236b[_0x60e2('0x1e')](_0x60e2('0x1f'),_0xd24e2c+'-'+_0x42ff26+'/'+_0x45f827)[_0x60e2('0x19')](_0x346b3c);}return null;};}function patchUpdates(_0x1e4801){return function(_0x1763ee){try{jsonpatch[_0x60e2('0x20')](_0x1763ee,_0x1e4801,!![]);}catch(_0x3cc4ad){return BPromise[_0x60e2('0x21')](_0x3cc4ad);}return _0x1763ee['save']();};}function saveUpdates(_0x5eebb7,_0x1eaabe){return function(_0x3e0b7c){if(_0x3e0b7c){return _0x3e0b7c[_0x60e2('0x22')](_0x5eebb7)['then'](function(_0x4ec795){return _0x4ec795;});}return null;};}function removeEntity(_0x397ed3,_0x2f3cf1){return function(_0x9e5979){if(_0x9e5979){return _0x9e5979['destroy']()[_0x60e2('0x23')](function(){_0x397ed3[_0x60e2('0x17')](0xcc)[_0x60e2('0x18')]();});}};}function handleEntityNotFound(_0x47d2cf,_0x1a0eb9){return function(_0x33c3b9){if(!_0x33c3b9){_0x47d2cf[_0x60e2('0x24')](0x194);}return _0x33c3b9;};}function handleError(_0xf0a99f,_0x1a3e49){_0x1a3e49=_0x1a3e49||0x1f4;return function(_0x3e59de){logger[_0x60e2('0x25')](_0x3e59de[_0x60e2('0x26')]);if(_0x3e59de[_0x60e2('0x27')]){delete _0x3e59de[_0x60e2('0x27')];}_0xf0a99f[_0x60e2('0x17')](_0x1a3e49)['send'](_0x3e59de);};}exports[_0x60e2('0x28')]=function(_0xc3536e,_0x5df149){var _0x5e7bff={},_0x38b614={},_0xe7d5d1={'count':0x0,'rows':[]};var _0x3fcafa=_[_0x60e2('0x29')](db[_0x60e2('0x2a')]['rawAttributes'],function(_0x39a59b){return{'name':_0x39a59b[_0x60e2('0x2b')],'type':_0x39a59b[_0x60e2('0x2c')][_0x60e2('0x2d')]};});_0x38b614[_0x60e2('0x2e')]=_['map'](_0x3fcafa,_0x60e2('0x27'));_0x38b614[_0x60e2('0x2f')]=_[_0x60e2('0x30')](_0xc3536e['query']);_0x38b614[_0x60e2('0x31')]=_['intersection'](_0x38b614[_0x60e2('0x2e')],_0x38b614[_0x60e2('0x2f')]);_0x5e7bff[_0x60e2('0x32')]=_['intersection'](_0x38b614[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x33')]));_0x5e7bff[_0x60e2('0x32')]=_0x5e7bff[_0x60e2('0x32')][_0x60e2('0x34')]?_0x5e7bff[_0x60e2('0x32')]:_0x38b614[_0x60e2('0x2e')];if(!_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x35')](_0x60e2('0x36'))){_0x5e7bff[_0x60e2('0x1d')]=qs[_0x60e2('0x1d')](_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x1d')]);_0x5e7bff[_0x60e2('0x1a')]=qs[_0x60e2('0x1a')](_0xc3536e['query'][_0x60e2('0x1a')]);}_0x5e7bff[_0x60e2('0x37')]=qs[_0x60e2('0x38')](_0xc3536e[_0x60e2('0x2f')]['sort']);_0x5e7bff['where']=qs[_0x60e2('0x31')](_[_0x60e2('0x39')](_0xc3536e[_0x60e2('0x2f')],_0x38b614[_0x60e2('0x31')]),_0x3fcafa);if(_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x3a')]){_0x5e7bff[_0x60e2('0x3b')]=_[_0x60e2('0x3c')](_0x5e7bff['where'],{'$or':_[_0x60e2('0x29')](_0x3fcafa,function(_0xfbb745){if(_0xfbb745[_0x60e2('0x2c')]!==_0x60e2('0x3d')){var _0x35c15f={};_0x35c15f[_0xfbb745[_0x60e2('0x27')]]={'$like':'%'+_0xc3536e[_0x60e2('0x2f')][_0x60e2('0x3a')]+'%'};return _0x35c15f;}})});}_0x5e7bff=_[_0x60e2('0x3c')]({},_0x5e7bff,_0xc3536e[_0x60e2('0x3e')]);var _0x3f6cb4={'where':_0x5e7bff['where']};return db['SugarcrmConfiguration'][_0x60e2('0x1c')](_0x3f6cb4)[_0x60e2('0x23')](function(_0xd658a5){_0xe7d5d1[_0x60e2('0x1c')]=_0xd658a5;if(_0xc3536e[_0x60e2('0x2f')]['includeAll']){_0x5e7bff[_0x60e2('0x3f')]=[{'all':!![]}];}return db[_0x60e2('0x2a')][_0x60e2('0x40')](_0x5e7bff);})['then'](function(_0xe07e20){_0xe7d5d1[_0x60e2('0x41')]=_0xe07e20;return _0xe7d5d1;})[_0x60e2('0x23')](respondWithFilteredResult(_0x5df149,_0x5e7bff))['catch'](handleError(_0x5df149,null));};exports['show']=function(_0x429316,_0x3e275b){var _0x5381c7={'raw':![],'where':{'id':_0x429316[_0x60e2('0x42')]['id']}},_0x3ffc99={};_0x3ffc99[_0x60e2('0x2e')]=_[_0x60e2('0x30')](db[_0x60e2('0x2a')][_0x60e2('0x43')]);_0x3ffc99[_0x60e2('0x2f')]=_[_0x60e2('0x30')](_0x429316['query']);_0x3ffc99[_0x60e2('0x31')]=_['intersection'](_0x3ffc99['model'],_0x3ffc99[_0x60e2('0x2f')]);_0x5381c7[_0x60e2('0x32')]=_[_0x60e2('0x44')](_0x3ffc99[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0x429316[_0x60e2('0x2f')][_0x60e2('0x33')]));_0x5381c7['attributes']=_0x5381c7[_0x60e2('0x32')][_0x60e2('0x34')]?_0x5381c7['attributes']:_0x3ffc99[_0x60e2('0x2e')];if(_0x429316[_0x60e2('0x2f')][_0x60e2('0x45')]){_0x5381c7[_0x60e2('0x3f')]=[{'all':!![]}];}_0x5381c7=_[_0x60e2('0x3c')]({},_0x5381c7,_0x429316['options']);return db[_0x60e2('0x2a')][_0x60e2('0x46')](_0x5381c7)[_0x60e2('0x23')](handleEntityNotFound(_0x3e275b,null))['then'](respondWithResult(_0x3e275b,null))[_0x60e2('0x47')](handleError(_0x3e275b,null));};exports[_0x60e2('0x48')]=function(_0x2b9cad,_0x3c772d){return db[_0x60e2('0x2a')][_0x60e2('0x48')](_0x2b9cad[_0x60e2('0x49')],{})[_0x60e2('0x23')](respondWithResult(_0x3c772d,0xc9))[_0x60e2('0x47')](handleError(_0x3c772d,null));};exports[_0x60e2('0x22')]=function(_0x4d01b2,_0x3e7173){if(_0x4d01b2[_0x60e2('0x49')]['id']){delete _0x4d01b2[_0x60e2('0x49')]['id'];}return db[_0x60e2('0x2a')]['find']({'where':{'id':_0x4d01b2[_0x60e2('0x42')]['id']}})[_0x60e2('0x23')](handleEntityNotFound(_0x3e7173,null))['then'](saveUpdates(_0x4d01b2['body'],null))[_0x60e2('0x23')](respondWithResult(_0x3e7173,null))['catch'](handleError(_0x3e7173,null));};exports[_0x60e2('0x4a')]=function(_0x171206,_0x25b0b3){return db[_0x60e2('0x2a')][_0x60e2('0x46')]({'where':{'id':_0x171206[_0x60e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x25b0b3,null))[_0x60e2('0x23')](removeEntity(_0x25b0b3,null))[_0x60e2('0x47')](handleError(_0x25b0b3,null));};exports[_0x60e2('0x4b')]=function(_0x2b3a1d,_0x47836a,_0x112e5c){var _0x5b06c0={};var _0x3e1a0a={};var _0x4002fc;var _0x1ae672;return db[_0x60e2('0x2a')][_0x60e2('0x4c')]({'where':{'id':_0x2b3a1d[_0x60e2('0x42')]['id']}})[_0x60e2('0x23')](handleEntityNotFound(_0x47836a,null))[_0x60e2('0x23')](function(_0xbfa673){if(_0xbfa673){_0x4002fc=_0xbfa673;_0x3e1a0a[_0x60e2('0x2e')]=_[_0x60e2('0x30')](db[_0x60e2('0x4d')][_0x60e2('0x43')]);_0x3e1a0a[_0x60e2('0x2f')]=_['keys'](_0x2b3a1d[_0x60e2('0x2f')]);_0x3e1a0a['filters']=_[_0x60e2('0x44')](_0x3e1a0a[_0x60e2('0x2e')],_0x3e1a0a[_0x60e2('0x2f')]);_0x5b06c0[_0x60e2('0x32')]=_[_0x60e2('0x44')](_0x3e1a0a[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x33')]));_0x5b06c0[_0x60e2('0x32')]=_0x5b06c0[_0x60e2('0x32')][_0x60e2('0x34')]?_0x5b06c0[_0x60e2('0x32')]:_0x3e1a0a[_0x60e2('0x2e')];_0x5b06c0['order']=qs[_0x60e2('0x38')](_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x38')]);_0x5b06c0[_0x60e2('0x3b')]=qs[_0x60e2('0x31')](_['pick'](_0x2b3a1d[_0x60e2('0x2f')],_0x3e1a0a[_0x60e2('0x31')]));if(_0x2b3a1d[_0x60e2('0x2f')]['filter']){_0x5b06c0[_0x60e2('0x3b')]=_['merge'](_0x5b06c0[_0x60e2('0x3b')],{'$or':_[_0x60e2('0x29')](_0x5b06c0[_0x60e2('0x32')],function(_0x4185a3){var _0x1400f2={};_0x1400f2[_0x4185a3]={'$like':'%'+_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x3a')]+'%'};return _0x1400f2;})});}_0x5b06c0=_['merge']({},_0x5b06c0,_0x2b3a1d['options']);return _0x4002fc['getFields'](_0x5b06c0);}})[_0x60e2('0x23')](function(_0x55e61c){if(_0x55e61c){_0x1ae672=_0x55e61c[_0x60e2('0x34')];if(!_0x2b3a1d[_0x60e2('0x2f')]['hasOwnProperty'](_0x60e2('0x36'))){_0x5b06c0[_0x60e2('0x1d')]=qs[_0x60e2('0x1d')](_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x1d')]);_0x5b06c0[_0x60e2('0x1a')]=qs['offset'](_0x2b3a1d[_0x60e2('0x2f')][_0x60e2('0x1a')]);}return _0x4002fc['getFields'](_0x5b06c0);}})[_0x60e2('0x23')](function(_0x54be52){if(_0x54be52){return _0x54be52?{'count':_0x1ae672,'rows':_0x54be52}:null;}})[_0x60e2('0x23')](respondWithResult(_0x47836a,null))[_0x60e2('0x47')](handleError(_0x47836a,null));};exports[_0x60e2('0x4e')]=function(_0xf990c9,_0x65c8f2,_0x1b9e01){var _0x442084={};var _0x527ee1={};var _0x48b235;var _0x59f370;return db[_0x60e2('0x2a')][_0x60e2('0x4c')]({'where':{'id':_0xf990c9[_0x60e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x65c8f2,null))[_0x60e2('0x23')](function(_0x238588){if(_0x238588){_0x48b235=_0x238588;_0x527ee1['model']=_['keys'](db[_0x60e2('0x4d')][_0x60e2('0x43')]);_0x527ee1[_0x60e2('0x2f')]=_[_0x60e2('0x30')](_0xf990c9['query']);_0x527ee1['filters']=_['intersection'](_0x527ee1['model'],_0x527ee1[_0x60e2('0x2f')]);_0x442084['attributes']=_[_0x60e2('0x44')](_0x527ee1[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0xf990c9['query'][_0x60e2('0x33')]));_0x442084[_0x60e2('0x32')]=_0x442084[_0x60e2('0x32')][_0x60e2('0x34')]?_0x442084[_0x60e2('0x32')]:_0x527ee1[_0x60e2('0x2e')];_0x442084[_0x60e2('0x37')]=qs[_0x60e2('0x38')](_0xf990c9['query'][_0x60e2('0x38')]);_0x442084['where']=qs[_0x60e2('0x31')](_[_0x60e2('0x39')](_0xf990c9['query'],_0x527ee1[_0x60e2('0x31')]));if(_0xf990c9[_0x60e2('0x2f')][_0x60e2('0x3a')]){_0x442084[_0x60e2('0x3b')]=_[_0x60e2('0x3c')](_0x442084[_0x60e2('0x3b')],{'$or':_[_0x60e2('0x29')](_0x442084[_0x60e2('0x32')],function(_0x186301){var _0xd5325d={};_0xd5325d[_0x186301]={'$like':'%'+_0xf990c9[_0x60e2('0x2f')]['filter']+'%'};return _0xd5325d;})});}_0x442084=_[_0x60e2('0x3c')]({},_0x442084,_0xf990c9[_0x60e2('0x3e')]);return _0x48b235[_0x60e2('0x4e')](_0x442084);}})[_0x60e2('0x23')](function(_0x3ff89f){if(_0x3ff89f){_0x59f370=_0x3ff89f[_0x60e2('0x34')];if(!_0xf990c9[_0x60e2('0x2f')]['hasOwnProperty'](_0x60e2('0x36'))){_0x442084[_0x60e2('0x1d')]=qs[_0x60e2('0x1d')](_0xf990c9[_0x60e2('0x2f')][_0x60e2('0x1d')]);_0x442084[_0x60e2('0x1a')]=qs[_0x60e2('0x1a')](_0xf990c9[_0x60e2('0x2f')][_0x60e2('0x1a')]);}return _0x48b235[_0x60e2('0x4e')](_0x442084);}})[_0x60e2('0x23')](function(_0x5c65cd){if(_0x5c65cd){return _0x5c65cd?{'count':_0x59f370,'rows':_0x5c65cd}:null;}})[_0x60e2('0x23')](respondWithResult(_0x65c8f2,null))[_0x60e2('0x47')](handleError(_0x65c8f2,null));};exports['getDescriptions']=function(_0x4e979a,_0x438d06,_0x513539){var _0x222df0={};var _0xf7222c={};var _0x5ce096;var _0x4d2a90;return db[_0x60e2('0x2a')][_0x60e2('0x4c')]({'where':{'id':_0x4e979a[_0x60e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x438d06,null))[_0x60e2('0x23')](function(_0x44d376){if(_0x44d376){_0x5ce096=_0x44d376;_0xf7222c[_0x60e2('0x2e')]=_['keys'](db[_0x60e2('0x4d')][_0x60e2('0x43')]);_0xf7222c[_0x60e2('0x2f')]=_[_0x60e2('0x30')](_0x4e979a['query']);_0xf7222c[_0x60e2('0x31')]=_[_0x60e2('0x44')](_0xf7222c[_0x60e2('0x2e')],_0xf7222c[_0x60e2('0x2f')]);_0x222df0[_0x60e2('0x32')]=_[_0x60e2('0x44')](_0xf7222c[_0x60e2('0x2e')],qs[_0x60e2('0x33')](_0x4e979a['query'][_0x60e2('0x33')]));_0x222df0['attributes']=_0x222df0[_0x60e2('0x32')]['length']?_0x222df0[_0x60e2('0x32')]:_0xf7222c['model'];_0x222df0[_0x60e2('0x37')]=qs[_0x60e2('0x38')](_0x4e979a[_0x60e2('0x2f')][_0x60e2('0x38')]);_0x222df0[_0x60e2('0x3b')]=qs[_0x60e2('0x31')](_[_0x60e2('0x39')](_0x4e979a['query'],_0xf7222c[_0x60e2('0x31')]));if(_0x4e979a[_0x60e2('0x2f')][_0x60e2('0x3a')]){_0x222df0[_0x60e2('0x3b')]=_[_0x60e2('0x3c')](_0x222df0[_0x60e2('0x3b')],{'$or':_[_0x60e2('0x29')](_0x222df0[_0x60e2('0x32')],function(_0x33c41a){var _0x5f9728={};_0x5f9728[_0x33c41a]={'$like':'%'+_0x4e979a['query'][_0x60e2('0x3a')]+'%'};return _0x5f9728;})});}_0x222df0=_[_0x60e2('0x3c')]({},_0x222df0,_0x4e979a[_0x60e2('0x3e')]);return _0x5ce096[_0x60e2('0x4f')](_0x222df0);}})[_0x60e2('0x23')](function(_0x19051d){if(_0x19051d){_0x4d2a90=_0x19051d[_0x60e2('0x34')];if(!_0x4e979a[_0x60e2('0x2f')][_0x60e2('0x35')](_0x60e2('0x36'))){_0x222df0[_0x60e2('0x1d')]=qs[_0x60e2('0x1d')](_0x4e979a[_0x60e2('0x2f')][_0x60e2('0x1d')]);_0x222df0['offset']=qs[_0x60e2('0x1a')](_0x4e979a[_0x60e2('0x2f')]['offset']);}return _0x5ce096[_0x60e2('0x4f')](_0x222df0);}})['then'](function(_0x44e512){if(_0x44e512){return _0x44e512?{'count':_0x4d2a90,'rows':_0x44e512}:null;}})[_0x60e2('0x23')](respondWithResult(_0x438d06,null))[_0x60e2('0x47')](handleError(_0x438d06,null));}; \ No newline at end of file +var _0x4479=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','order','pick','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x5d4003,_0x5441b1){var _0x1b8ccf=function(_0x5409b9){while(--_0x5409b9){_0x5d4003['push'](_0x5d4003['shift']());}};_0x1b8ccf(++_0x5441b1);}(_0x4479,0x98));var _0x9447=function(_0x5cff59,_0x5adab4){_0x5cff59=_0x5cff59-0x0;var _0x16afa9=_0x4479[_0x5cff59];return _0x16afa9;};'use strict';var emlformat=require(_0x9447('0x0'));var rimraf=require(_0x9447('0x1'));var zipdir=require(_0x9447('0x2'));var jsonpatch=require(_0x9447('0x3'));var rp=require(_0x9447('0x4'));var moment=require(_0x9447('0x5'));var BPromise=require(_0x9447('0x6'));var Mustache=require(_0x9447('0x7'));var util=require(_0x9447('0x8'));var path=require('path');var sox=require(_0x9447('0x9'));var csv=require(_0x9447('0xa'));var ejs=require(_0x9447('0xb'));var fs=require('fs');var fs_extra=require(_0x9447('0xc'));var _=require(_0x9447('0xd'));var squel=require(_0x9447('0xe'));var crypto=require(_0x9447('0xf'));var jsforce=require(_0x9447('0x10'));var deskjs=require(_0x9447('0x11'));var toCsv=require(_0x9447('0xa'));var querystring=require(_0x9447('0x12'));var Papa=require('papaparse');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(_0x9447('0x13'));var logger=require(_0x9447('0x14'))(_0x9447('0x15'));var utils=require(_0x9447('0x16'));var config=require(_0x9447('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9447('0x18'))['db'];function respondWithStatusCode(_0x31c4f7,_0x38dc62){_0x38dc62=_0x38dc62||0xcc;return function(_0x4b4ad4){if(_0x4b4ad4){return _0x31c4f7['sendStatus'](_0x38dc62);}return _0x31c4f7[_0x9447('0x19')](_0x38dc62)[_0x9447('0x1a')]();};}function respondWithResult(_0x5089ff,_0x13a760){_0x13a760=_0x13a760||0xc8;return function(_0x4122ac){if(_0x4122ac){return _0x5089ff[_0x9447('0x19')](_0x13a760)[_0x9447('0x1b')](_0x4122ac);}};}function respondWithFilteredResult(_0x26fc2f,_0x15d240){return function(_0x5a0dcd){if(_0x5a0dcd){var _0x1c2c65=typeof _0x15d240[_0x9447('0x1c')]===_0x9447('0x1d')&&typeof _0x15d240['limit']===_0x9447('0x1d');var _0x2d5359=_0x5a0dcd['count'];var _0x235b9f=_0x1c2c65?0x0:_0x15d240[_0x9447('0x1c')];var _0x520bcd=_0x1c2c65?_0x5a0dcd[_0x9447('0x1e')]:_0x15d240[_0x9447('0x1c')]+_0x15d240['limit'];var _0x4e9e9e;if(_0x520bcd>=_0x2d5359){_0x520bcd=_0x2d5359;_0x4e9e9e=0xc8;}else{_0x4e9e9e=0xce;}_0x26fc2f[_0x9447('0x19')](_0x4e9e9e);return _0x26fc2f[_0x9447('0x1f')](_0x9447('0x20'),_0x235b9f+'-'+_0x520bcd+'/'+_0x2d5359)[_0x9447('0x1b')](_0x5a0dcd);}return null;};}function patchUpdates(_0x3aeede){return function(_0x1889e4){try{jsonpatch[_0x9447('0x21')](_0x1889e4,_0x3aeede,!![]);}catch(_0x424e72){return BPromise[_0x9447('0x22')](_0x424e72);}return _0x1889e4[_0x9447('0x23')]();};}function saveUpdates(_0x2399a2,_0x445512){return function(_0x3538d8){if(_0x3538d8){return _0x3538d8[_0x9447('0x24')](_0x2399a2)[_0x9447('0x25')](function(_0x5aa2dd){return _0x5aa2dd;});}return null;};}function removeEntity(_0x1c3377,_0x4c189a){return function(_0x5deb14){if(_0x5deb14){return _0x5deb14[_0x9447('0x26')]()[_0x9447('0x25')](function(){_0x1c3377[_0x9447('0x19')](0xcc)[_0x9447('0x1a')]();});}};}function handleEntityNotFound(_0x27d017,_0x909f1){return function(_0x300cd1){if(!_0x300cd1){_0x27d017['sendStatus'](0x194);}return _0x300cd1;};}function handleError(_0x5d4749,_0x1b5a05){_0x1b5a05=_0x1b5a05||0x1f4;return function(_0x6e46d3){logger[_0x9447('0x27')](_0x6e46d3[_0x9447('0x28')]);if(_0x6e46d3[_0x9447('0x29')]){delete _0x6e46d3[_0x9447('0x29')];}_0x5d4749['status'](_0x1b5a05)['send'](_0x6e46d3);};}exports['index']=function(_0x1fafe1,_0x1f9c35){var _0x326860={},_0x11bbc4={},_0x12fc9d={'count':0x0,'rows':[]};var _0x2279a2=_[_0x9447('0x2a')](db[_0x9447('0x2b')][_0x9447('0x2c')],function(_0x11e620){return{'name':_0x11e620[_0x9447('0x2d')],'type':_0x11e620[_0x9447('0x2e')][_0x9447('0x2f')]};});_0x11bbc4[_0x9447('0x30')]=_[_0x9447('0x2a')](_0x2279a2,_0x9447('0x29'));_0x11bbc4[_0x9447('0x31')]=_[_0x9447('0x32')](_0x1fafe1[_0x9447('0x31')]);_0x11bbc4[_0x9447('0x33')]=_[_0x9447('0x34')](_0x11bbc4['model'],_0x11bbc4[_0x9447('0x31')]);_0x326860[_0x9447('0x35')]=_[_0x9447('0x34')](_0x11bbc4[_0x9447('0x30')],qs[_0x9447('0x36')](_0x1fafe1[_0x9447('0x31')][_0x9447('0x36')]));_0x326860[_0x9447('0x35')]=_0x326860[_0x9447('0x35')][_0x9447('0x37')]?_0x326860[_0x9447('0x35')]:_0x11bbc4['model'];if(!_0x1fafe1['query'][_0x9447('0x38')](_0x9447('0x39'))){_0x326860[_0x9447('0x3a')]=qs[_0x9447('0x3a')](_0x1fafe1['query'][_0x9447('0x3a')]);_0x326860[_0x9447('0x1c')]=qs[_0x9447('0x1c')](_0x1fafe1[_0x9447('0x31')]['offset']);}_0x326860['order']=qs[_0x9447('0x3b')](_0x1fafe1[_0x9447('0x31')][_0x9447('0x3b')]);_0x326860['where']=qs[_0x9447('0x33')](_['pick'](_0x1fafe1['query'],_0x11bbc4[_0x9447('0x33')]),_0x2279a2);if(_0x1fafe1[_0x9447('0x31')][_0x9447('0x3c')]){_0x326860['where']=_[_0x9447('0x3d')](_0x326860[_0x9447('0x3e')],{'$or':_[_0x9447('0x2a')](_0x2279a2,function(_0x29872b){if(_0x29872b[_0x9447('0x2e')]!==_0x9447('0x3f')){var _0x2ba34a={};_0x2ba34a[_0x29872b[_0x9447('0x29')]]={'$like':'%'+_0x1fafe1[_0x9447('0x31')]['filter']+'%'};return _0x2ba34a;}})});}_0x326860=_['merge']({},_0x326860,_0x1fafe1[_0x9447('0x40')]);var _0xe5edad={'where':_0x326860[_0x9447('0x3e')]};return db[_0x9447('0x2b')]['count'](_0xe5edad)[_0x9447('0x25')](function(_0x343aa5){_0x12fc9d[_0x9447('0x1e')]=_0x343aa5;if(_0x1fafe1[_0x9447('0x31')][_0x9447('0x41')]){_0x326860[_0x9447('0x42')]=[{'all':!![]}];}return db[_0x9447('0x2b')][_0x9447('0x43')](_0x326860);})[_0x9447('0x25')](function(_0x51ced3){_0x12fc9d[_0x9447('0x44')]=_0x51ced3;return _0x12fc9d;})[_0x9447('0x25')](respondWithFilteredResult(_0x1f9c35,_0x326860))[_0x9447('0x45')](handleError(_0x1f9c35,null));};exports[_0x9447('0x46')]=function(_0x28e974,_0x1f6cc2){var _0x125654={'raw':![],'where':{'id':_0x28e974['params']['id']}},_0x1b4542={};_0x1b4542[_0x9447('0x30')]=_['keys'](db['SugarcrmConfiguration'][_0x9447('0x2c')]);_0x1b4542['query']=_['keys'](_0x28e974[_0x9447('0x31')]);_0x1b4542[_0x9447('0x33')]=_[_0x9447('0x34')](_0x1b4542['model'],_0x1b4542['query']);_0x125654['attributes']=_[_0x9447('0x34')](_0x1b4542[_0x9447('0x30')],qs[_0x9447('0x36')](_0x28e974[_0x9447('0x31')][_0x9447('0x36')]));_0x125654[_0x9447('0x35')]=_0x125654['attributes'][_0x9447('0x37')]?_0x125654[_0x9447('0x35')]:_0x1b4542[_0x9447('0x30')];if(_0x28e974[_0x9447('0x31')][_0x9447('0x41')]){_0x125654[_0x9447('0x42')]=[{'all':!![]}];}_0x125654=_[_0x9447('0x3d')]({},_0x125654,_0x28e974['options']);return db['SugarcrmConfiguration'][_0x9447('0x47')](_0x125654)[_0x9447('0x25')](handleEntityNotFound(_0x1f6cc2,null))[_0x9447('0x25')](respondWithResult(_0x1f6cc2,null))[_0x9447('0x45')](handleError(_0x1f6cc2,null));};exports['create']=function(_0x2d28d3,_0xd441bd){return db['SugarcrmConfiguration'][_0x9447('0x48')](_0x2d28d3['body'],{})[_0x9447('0x25')](respondWithResult(_0xd441bd,0xc9))['catch'](handleError(_0xd441bd,null));};exports['update']=function(_0x68c045,_0x1177fc){if(_0x68c045[_0x9447('0x49')]['id']){delete _0x68c045['body']['id'];}return db[_0x9447('0x2b')][_0x9447('0x47')]({'where':{'id':_0x68c045['params']['id']}})[_0x9447('0x25')](handleEntityNotFound(_0x1177fc,null))['then'](saveUpdates(_0x68c045[_0x9447('0x49')],null))['then'](respondWithResult(_0x1177fc,null))['catch'](handleError(_0x1177fc,null));};exports['destroy']=function(_0x20c3ed,_0x4f9c4a){return db[_0x9447('0x2b')]['find']({'where':{'id':_0x20c3ed[_0x9447('0x4a')]['id']}})[_0x9447('0x25')](handleEntityNotFound(_0x4f9c4a,null))[_0x9447('0x25')](removeEntity(_0x4f9c4a,null))[_0x9447('0x45')](handleError(_0x4f9c4a,null));};exports[_0x9447('0x4b')]=function(_0x57c636,_0x21ff1f,_0xf81001){var _0x4453d1={};var _0x384035={};var _0x3109cf;var _0x1be965;return db[_0x9447('0x2b')][_0x9447('0x4c')]({'where':{'id':_0x57c636[_0x9447('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21ff1f,null))[_0x9447('0x25')](function(_0x56ca9b){if(_0x56ca9b){_0x3109cf=_0x56ca9b;_0x384035[_0x9447('0x30')]=_[_0x9447('0x32')](db['SugarcrmField'][_0x9447('0x2c')]);_0x384035['query']=_['keys'](_0x57c636[_0x9447('0x31')]);_0x384035[_0x9447('0x33')]=_[_0x9447('0x34')](_0x384035[_0x9447('0x30')],_0x384035[_0x9447('0x31')]);_0x4453d1['attributes']=_[_0x9447('0x34')](_0x384035[_0x9447('0x30')],qs[_0x9447('0x36')](_0x57c636[_0x9447('0x31')][_0x9447('0x36')]));_0x4453d1['attributes']=_0x4453d1[_0x9447('0x35')][_0x9447('0x37')]?_0x4453d1[_0x9447('0x35')]:_0x384035['model'];_0x4453d1[_0x9447('0x4d')]=qs[_0x9447('0x3b')](_0x57c636[_0x9447('0x31')][_0x9447('0x3b')]);_0x4453d1[_0x9447('0x3e')]=qs[_0x9447('0x33')](_[_0x9447('0x4e')](_0x57c636['query'],_0x384035[_0x9447('0x33')]));if(_0x57c636[_0x9447('0x31')][_0x9447('0x3c')]){_0x4453d1[_0x9447('0x3e')]=_[_0x9447('0x3d')](_0x4453d1[_0x9447('0x3e')],{'$or':_['map'](_0x4453d1[_0x9447('0x35')],function(_0x1918e8){var _0x42a033={};_0x42a033[_0x1918e8]={'$like':'%'+_0x57c636[_0x9447('0x31')][_0x9447('0x3c')]+'%'};return _0x42a033;})});}_0x4453d1=_['merge']({},_0x4453d1,_0x57c636[_0x9447('0x40')]);return _0x3109cf['getFields'](_0x4453d1);}})['then'](function(_0x5f0e82){if(_0x5f0e82){_0x1be965=_0x5f0e82[_0x9447('0x37')];if(!_0x57c636[_0x9447('0x31')]['hasOwnProperty']('nolimit')){_0x4453d1[_0x9447('0x3a')]=qs[_0x9447('0x3a')](_0x57c636[_0x9447('0x31')][_0x9447('0x3a')]);_0x4453d1[_0x9447('0x1c')]=qs[_0x9447('0x1c')](_0x57c636[_0x9447('0x31')][_0x9447('0x1c')]);}return _0x3109cf[_0x9447('0x4b')](_0x4453d1);}})[_0x9447('0x25')](function(_0x11c527){if(_0x11c527){return _0x11c527?{'count':_0x1be965,'rows':_0x11c527}:null;}})[_0x9447('0x25')](respondWithResult(_0x21ff1f,null))[_0x9447('0x45')](handleError(_0x21ff1f,null));};exports[_0x9447('0x4f')]=function(_0x31b411,_0x2e6cee,_0x4f6506){var _0x5b8e27={};var _0x34d78e={};var _0x3aa174;var _0x4cbd46;return db['SugarcrmConfiguration'][_0x9447('0x4c')]({'where':{'id':_0x31b411['params']['id']}})['then'](handleEntityNotFound(_0x2e6cee,null))[_0x9447('0x25')](function(_0x5c97ac){if(_0x5c97ac){_0x3aa174=_0x5c97ac;_0x34d78e['model']=_[_0x9447('0x32')](db[_0x9447('0x50')][_0x9447('0x2c')]);_0x34d78e[_0x9447('0x31')]=_[_0x9447('0x32')](_0x31b411[_0x9447('0x31')]);_0x34d78e[_0x9447('0x33')]=_[_0x9447('0x34')](_0x34d78e[_0x9447('0x30')],_0x34d78e[_0x9447('0x31')]);_0x5b8e27[_0x9447('0x35')]=_['intersection'](_0x34d78e[_0x9447('0x30')],qs['fields'](_0x31b411[_0x9447('0x31')]['fields']));_0x5b8e27[_0x9447('0x35')]=_0x5b8e27['attributes']['length']?_0x5b8e27['attributes']:_0x34d78e[_0x9447('0x30')];_0x5b8e27[_0x9447('0x4d')]=qs[_0x9447('0x3b')](_0x31b411[_0x9447('0x31')][_0x9447('0x3b')]);_0x5b8e27[_0x9447('0x3e')]=qs[_0x9447('0x33')](_['pick'](_0x31b411['query'],_0x34d78e[_0x9447('0x33')]));if(_0x31b411['query']['filter']){_0x5b8e27[_0x9447('0x3e')]=_[_0x9447('0x3d')](_0x5b8e27[_0x9447('0x3e')],{'$or':_[_0x9447('0x2a')](_0x5b8e27[_0x9447('0x35')],function(_0x37e889){var _0x29996e={};_0x29996e[_0x37e889]={'$like':'%'+_0x31b411['query'][_0x9447('0x3c')]+'%'};return _0x29996e;})});}_0x5b8e27=_['merge']({},_0x5b8e27,_0x31b411['options']);return _0x3aa174[_0x9447('0x4f')](_0x5b8e27);}})[_0x9447('0x25')](function(_0x5cfcb0){if(_0x5cfcb0){_0x4cbd46=_0x5cfcb0[_0x9447('0x37')];if(!_0x31b411[_0x9447('0x31')][_0x9447('0x38')](_0x9447('0x39'))){_0x5b8e27[_0x9447('0x3a')]=qs[_0x9447('0x3a')](_0x31b411[_0x9447('0x31')]['limit']);_0x5b8e27[_0x9447('0x1c')]=qs[_0x9447('0x1c')](_0x31b411[_0x9447('0x31')][_0x9447('0x1c')]);}return _0x3aa174[_0x9447('0x4f')](_0x5b8e27);}})[_0x9447('0x25')](function(_0x497a9c){if(_0x497a9c){return _0x497a9c?{'count':_0x4cbd46,'rows':_0x497a9c}:null;}})['then'](respondWithResult(_0x2e6cee,null))[_0x9447('0x45')](handleError(_0x2e6cee,null));};exports[_0x9447('0x51')]=function(_0x574a39,_0x22a759,_0x40bbe6){var _0x5a39e3={};var _0x84da6e={};var _0x8b9e6;var _0x4764e1;return db[_0x9447('0x2b')][_0x9447('0x4c')]({'where':{'id':_0x574a39[_0x9447('0x4a')]['id']}})[_0x9447('0x25')](handleEntityNotFound(_0x22a759,null))[_0x9447('0x25')](function(_0x1ce3af){if(_0x1ce3af){_0x8b9e6=_0x1ce3af;_0x84da6e[_0x9447('0x30')]=_['keys'](db[_0x9447('0x50')]['rawAttributes']);_0x84da6e[_0x9447('0x31')]=_[_0x9447('0x32')](_0x574a39['query']);_0x84da6e[_0x9447('0x33')]=_['intersection'](_0x84da6e[_0x9447('0x30')],_0x84da6e[_0x9447('0x31')]);_0x5a39e3[_0x9447('0x35')]=_[_0x9447('0x34')](_0x84da6e[_0x9447('0x30')],qs[_0x9447('0x36')](_0x574a39[_0x9447('0x31')]['fields']));_0x5a39e3[_0x9447('0x35')]=_0x5a39e3['attributes']['length']?_0x5a39e3['attributes']:_0x84da6e['model'];_0x5a39e3[_0x9447('0x4d')]=qs['sort'](_0x574a39[_0x9447('0x31')][_0x9447('0x3b')]);_0x5a39e3[_0x9447('0x3e')]=qs['filters'](_[_0x9447('0x4e')](_0x574a39[_0x9447('0x31')],_0x84da6e[_0x9447('0x33')]));if(_0x574a39[_0x9447('0x31')][_0x9447('0x3c')]){_0x5a39e3['where']=_[_0x9447('0x3d')](_0x5a39e3['where'],{'$or':_[_0x9447('0x2a')](_0x5a39e3[_0x9447('0x35')],function(_0x4c3ca9){var _0x1a4c5a={};_0x1a4c5a[_0x4c3ca9]={'$like':'%'+_0x574a39['query'][_0x9447('0x3c')]+'%'};return _0x1a4c5a;})});}_0x5a39e3=_['merge']({},_0x5a39e3,_0x574a39[_0x9447('0x40')]);return _0x8b9e6[_0x9447('0x51')](_0x5a39e3);}})['then'](function(_0x20533b){if(_0x20533b){_0x4764e1=_0x20533b['length'];if(!_0x574a39[_0x9447('0x31')]['hasOwnProperty'](_0x9447('0x39'))){_0x5a39e3[_0x9447('0x3a')]=qs[_0x9447('0x3a')](_0x574a39[_0x9447('0x31')]['limit']);_0x5a39e3[_0x9447('0x1c')]=qs[_0x9447('0x1c')](_0x574a39[_0x9447('0x31')][_0x9447('0x1c')]);}return _0x8b9e6[_0x9447('0x51')](_0x5a39e3);}})[_0x9447('0x25')](function(_0x59ca79){if(_0x59ca79){return _0x59ca79?{'count':_0x4764e1,'rows':_0x59ca79}:null;}})[_0x9447('0x25')](respondWithResult(_0x22a759,null))[_0x9447('0x45')](handleError(_0x22a759,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c8ca621..2251706 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 _0x1340=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2627e4,_0x1a02e0){var _0x102358=function(_0x369701){while(--_0x369701){_0x2627e4['push'](_0x2627e4['shift']());}};_0x102358(++_0x1a02e0);}(_0x1340,0xa1));var _0x0134=function(_0x51def8,_0x21d4ac){_0x51def8=_0x51def8-0x0;var _0x4455ff=_0x1340[_0x51def8];return _0x4455ff;};'use strict';var _=require(_0x0134('0x0'));var util=require(_0x0134('0x1'));var logger=require(_0x0134('0x2'))(_0x0134('0x3'));var moment=require(_0x0134('0x4'));var BPromise=require('bluebird');var rp=require(_0x0134('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0134('0x6'));var config=require(_0x0134('0x7'));var attributes=require(_0x0134('0x8'));module[_0x0134('0x9')]=function(_0x1e790b,_0x195f28){return _0x1e790b[_0x0134('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x0134('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x771c=['lodash','util','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations'];(function(_0x317ed5,_0xd7d3e){var _0x4f3cd7=function(_0x55062f){while(--_0x55062f){_0x317ed5['push'](_0x317ed5['shift']());}};_0x4f3cd7(++_0xd7d3e);}(_0x771c,0x113));var _0xc771=function(_0x106ced,_0x518c26){_0x106ced=_0x106ced-0x0;var _0x2f35c9=_0x771c[_0x106ced];return _0x2f35c9;};'use strict';var _=require(_0xc771('0x0'));var util=require(_0xc771('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc771('0x2'));var BPromise=require(_0xc771('0x3'));var rp=require(_0xc771('0x4'));var fs=require('fs');var path=require(_0xc771('0x5'));var rimraf=require(_0xc771('0x6'));var config=require('../../config/environment');var attributes=require(_0xc771('0x7'));module[_0xc771('0x8')]=function(_0xf56d45,_0x2e6e14){return _0xf56d45[_0xc771('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0xc771('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 5a59e80..f33ac11 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 _0xa51f=['rpc','../../config/environment','jayson/promise','client','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1a09f3,_0x55835f){var _0x4bf28c=function(_0x543041){while(--_0x543041){_0x1a09f3['push'](_0x1a09f3['shift']());}};_0x4bf28c(++_0x55835f);}(_0xa51f,0x12f));var _0xfa51=function(_0x4b4ce5,_0x573d2d){_0x4b4ce5=_0x4b4ce5-0x0;var _0x6522f3=_0xa51f[_0x4b4ce5];return _0x6522f3;};'use strict';var _=require(_0xfa51('0x0'));var util=require(_0xfa51('0x1'));var moment=require(_0xfa51('0x2'));var BPromise=require(_0xfa51('0x3'));var rs=require(_0xfa51('0x4'));var fs=require('fs');var Redis=require(_0xfa51('0x5'));var db=require(_0xfa51('0x6'))['db'];var utils=require(_0xfa51('0x7'));var logger=require(_0xfa51('0x8'))(_0xfa51('0x9'));var config=require(_0xfa51('0xa'));var jayson=require(_0xfa51('0xb'));var client=jayson[_0xfa51('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44714c,_0x4557ed,_0x1dcaab){return new BPromise(function(_0x3d13cd,_0x299f06){return client['request'](_0x44714c,_0x1dcaab)[_0xfa51('0xd')](function(_0x2d5067){logger['info'](_0xfa51('0xe'),_0x4557ed,_0xfa51('0xf'));logger['debug'](_0xfa51('0x10'),_0x4557ed,_0xfa51('0xf'),JSON[_0xfa51('0x11')](_0x2d5067));if(_0x2d5067[_0xfa51('0x12')]){if(_0x2d5067[_0xfa51('0x12')][_0xfa51('0x13')]===0x1f4){logger[_0xfa51('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4557ed,_0x2d5067['error'][_0xfa51('0x14')]);return _0x299f06(_0x2d5067['error'][_0xfa51('0x14')]);}logger['error'](_0xfa51('0xe'),_0x4557ed,_0x2d5067[_0xfa51('0x12')]['message']);return _0x3d13cd(_0x2d5067[_0xfa51('0x12')][_0xfa51('0x14')]);}else{logger[_0xfa51('0x15')](_0xfa51('0xe'),_0x4557ed,_0xfa51('0xf'));_0x3d13cd(_0x2d5067[_0xfa51('0x16')]['message']);}})[_0xfa51('0x17')](function(_0x52194a){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4557ed,_0x52194a);_0x299f06(_0x52194a);});});} \ No newline at end of file +var _0xe0ff=['util','moment','bluebird','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x479822,_0x50e683){var _0x41c1fc=function(_0x598e53){while(--_0x598e53){_0x479822['push'](_0x479822['shift']());}};_0x41c1fc(++_0x50e683);}(_0xe0ff,0x1cb));var _0xfe0f=function(_0x315e85,_0x367012){_0x315e85=_0x315e85-0x0;var _0x4ea18c=_0xe0ff[_0x315e85];return _0x4ea18c;};'use strict';var _=require(_0xfe0f('0x0'));var util=require(_0xfe0f('0x1'));var moment=require(_0xfe0f('0x2'));var BPromise=require(_0xfe0f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe0f('0x4'));var logger=require('../../config/logger')(_0xfe0f('0x5'));var config=require(_0xfe0f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe0f('0x7')][_0xfe0f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0a9f,_0xf80cce,_0x59d843){return new BPromise(function(_0x4da64d,_0x46c2d8){return client[_0xfe0f('0x9')](_0x3f0a9f,_0x59d843)[_0xfe0f('0xa')](function(_0xc4e32f){logger[_0xfe0f('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xf80cce,_0xfe0f('0xc'));logger['debug'](_0xfe0f('0xd'),_0xf80cce,'request\x20sent',JSON[_0xfe0f('0xe')](_0xc4e32f));if(_0xc4e32f[_0xfe0f('0xf')]){if(_0xc4e32f['error']['code']===0x1f4){logger[_0xfe0f('0xf')](_0xfe0f('0x10'),_0xf80cce,_0xc4e32f[_0xfe0f('0xf')][_0xfe0f('0x11')]);return _0x46c2d8(_0xc4e32f[_0xfe0f('0xf')][_0xfe0f('0x11')]);}logger[_0xfe0f('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xf80cce,_0xc4e32f[_0xfe0f('0xf')][_0xfe0f('0x11')]);return _0x4da64d(_0xc4e32f['error']['message']);}else{logger['info'](_0xfe0f('0x10'),_0xf80cce,_0xfe0f('0xc'));_0x4da64d(_0xc4e32f[_0xfe0f('0x12')][_0xfe0f('0x11')]);}})[_0xfe0f('0x13')](function(_0x4cbbaf){logger[_0xfe0f('0xf')](_0xfe0f('0x10'),_0xf80cce,_0x4cbbaf);_0x46c2d8(_0x4cbbaf);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d2546c9..0773d19 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 _0x9846=['isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get'];(function(_0x3d797c,_0x2c994d){var _0x385aab=function(_0x34ee54){while(--_0x34ee54){_0x3d797c['push'](_0x3d797c['shift']());}};_0x385aab(++_0x2c994d);}(_0x9846,0x13a));var _0x6984=function(_0x2cd8b9,_0x285479){_0x2cd8b9=_0x2cd8b9-0x0;var _0x54d956=_0x9846[_0x2cd8b9];return _0x54d956;};'use strict';var multer=require(_0x6984('0x0'));var util=require(_0x6984('0x1'));var path=require(_0x6984('0x2'));var timeout=require('connect-timeout');var express=require(_0x6984('0x3'));var router=express[_0x6984('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6984('0x5'));var interaction=require(_0x6984('0x6'));var config=require('../../config/environment');var controller=require(_0x6984('0x7'));router[_0x6984('0x8')]('/',auth[_0x6984('0x9')](),controller['index']);router['get']('/:id',auth[_0x6984('0x9')](),controller[_0x6984('0xa')]);router[_0x6984('0xb')]('/',auth['isAuthenticated'](),controller[_0x6984('0xc')]);router[_0x6984('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6984('0xe')]);router[_0x6984('0xf')](_0x6984('0x10'),auth[_0x6984('0x9')](),controller[_0x6984('0x11')]);module[_0x6984('0x12')]=router; \ No newline at end of file +var _0xa2a9=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','isAuthenticated','show','post','/:id'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xa2a9,0x15a));var _0x9a2a=function(_0x26c2ab,_0x2a70c6){_0x26c2ab=_0x26c2ab-0x0;var _0x451932=_0xa2a9[_0x26c2ab];return _0x451932;};'use strict';var multer=require(_0x9a2a('0x0'));var util=require(_0x9a2a('0x1'));var path=require('path');var timeout=require(_0x9a2a('0x2'));var express=require('express');var router=express[_0x9a2a('0x3')]();var fs_extra=require(_0x9a2a('0x4'));var auth=require(_0x9a2a('0x5'));var interaction=require(_0x9a2a('0x6'));var config=require(_0x9a2a('0x7'));var controller=require(_0x9a2a('0x8'));router[_0x9a2a('0x9')]('/',auth['isAuthenticated'](),controller[_0x9a2a('0xa')]);router['get']('/:id',auth[_0x9a2a('0xb')](),controller[_0x9a2a('0xc')]);router[_0x9a2a('0xd')]('/',auth[_0x9a2a('0xb')](),controller['create']);router['put'](_0x9a2a('0xe'),auth[_0x9a2a('0xb')](),controller[_0x9a2a('0xf')]);router[_0x9a2a('0x10')]('/:id',auth[_0x9a2a('0xb')](),controller[_0x9a2a('0x11')]);module[_0x9a2a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4a4aa9e..43a4055 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 _0x19af=['exports','ENUM','string','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0xd60720,_0x30c5b7){var _0x1684dd=function(_0x3b2c35){while(--_0x3b2c35){_0xd60720['push'](_0xd60720['shift']());}};_0x1684dd(++_0x30c5b7);}(_0x19af,0x17f));var _0xf19a=function(_0x2a04c9,_0x391d1d){_0x2a04c9=_0x2a04c9-0x0;var _0x52a437=_0x19af[_0x2a04c9];return _0x52a437;};'use strict';var Sequelize=require(_0xf19a('0x0'));module[_0xf19a('0x1')]={'type':{'type':Sequelize[_0xf19a('0x2')]('string','variable','customVariable','keyValue','picklist'),'defaultValue':_0xf19a('0x3')},'content':{'type':Sequelize[_0xf19a('0x4')]},'key':{'type':Sequelize[_0xf19a('0x4')]},'keyType':{'type':Sequelize[_0xf19a('0x2')](_0xf19a('0x3'),_0xf19a('0x5'),_0xf19a('0x6'))},'keyContent':{'type':Sequelize[_0xf19a('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf19a('0x4')]},'customField':{'type':Sequelize[_0xf19a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf19a('0x4')]}}; \ No newline at end of file +var _0x7ea4=['picklist','STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x7ea4,0xe4));var _0x47ea=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x7ea4[_0x31dde9];return _0x1fbf2d;};'use strict';var Sequelize=require(_0x47ea('0x0'));module[_0x47ea('0x1')]={'type':{'type':Sequelize[_0x47ea('0x2')](_0x47ea('0x3'),'variable',_0x47ea('0x4'),_0x47ea('0x5'),_0x47ea('0x6')),'defaultValue':_0x47ea('0x3')},'content':{'type':Sequelize[_0x47ea('0x7')]},'key':{'type':Sequelize[_0x47ea('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x47ea('0x3'),_0x47ea('0x8'),_0x47ea('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x47ea('0x7')]},'nameField':{'type':Sequelize[_0x47ea('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 16133ba..bd7394d 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 _0x03ba=['bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SugarcrmField','include','findAll','rows','includeAll','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3e1eee,_0x202435){var _0x234779=function(_0xee00a1){while(--_0xee00a1){_0x3e1eee['push'](_0x3e1eee['shift']());}};_0x234779(++_0x202435);}(_0x03ba,0x88));var _0xa03b=function(_0x4e617e,_0x2f1088){_0x4e617e=_0x4e617e-0x0;var _0x1fcd72=_0x03ba[_0x4e617e];return _0x1fcd72;};'use strict';var emlformat=require(_0xa03b('0x0'));var rimraf=require(_0xa03b('0x1'));var zipdir=require(_0xa03b('0x2'));var jsonpatch=require(_0xa03b('0x3'));var rp=require(_0xa03b('0x4'));var moment=require(_0xa03b('0x5'));var BPromise=require(_0xa03b('0x6'));var Mustache=require('mustache');var util=require(_0xa03b('0x7'));var path=require(_0xa03b('0x8'));var sox=require(_0xa03b('0x9'));var csv=require('to-csv');var ejs=require(_0xa03b('0xa'));var fs=require('fs');var fs_extra=require(_0xa03b('0xb'));var _=require('lodash');var squel=require(_0xa03b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa03b('0xd'));var deskjs=require(_0xa03b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa03b('0xf'));var Papa=require('papaparse');var Redis=require(_0xa03b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa03b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa03b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa03b('0x13'));var db=require(_0xa03b('0x14'))['db'];function respondWithStatusCode(_0x480b63,_0x3c46c8){_0x3c46c8=_0x3c46c8||0xcc;return function(_0x19395c){if(_0x19395c){return _0x480b63['sendStatus'](_0x3c46c8);}return _0x480b63[_0xa03b('0x15')](_0x3c46c8)['end']();};}function respondWithResult(_0x2356a6,_0x34cfd4){_0x34cfd4=_0x34cfd4||0xc8;return function(_0x358ab4){if(_0x358ab4){return _0x2356a6['status'](_0x34cfd4)[_0xa03b('0x16')](_0x358ab4);}};}function respondWithFilteredResult(_0x42d93b,_0xd5aa71){return function(_0x4fa277){if(_0x4fa277){var _0x53024f=typeof _0xd5aa71['offset']===_0xa03b('0x17')&&typeof _0xd5aa71[_0xa03b('0x18')]===_0xa03b('0x17');var _0x5c3baa=_0x4fa277['count'];var _0x3d06c2=_0x53024f?0x0:_0xd5aa71[_0xa03b('0x19')];var _0x57afde=_0x53024f?_0x4fa277[_0xa03b('0x1a')]:_0xd5aa71[_0xa03b('0x19')]+_0xd5aa71[_0xa03b('0x18')];var _0x7ba666;if(_0x57afde>=_0x5c3baa){_0x57afde=_0x5c3baa;_0x7ba666=0xc8;}else{_0x7ba666=0xce;}_0x42d93b['status'](_0x7ba666);return _0x42d93b[_0xa03b('0x1b')](_0xa03b('0x1c'),_0x3d06c2+'-'+_0x57afde+'/'+_0x5c3baa)['json'](_0x4fa277);}return null;};}function patchUpdates(_0x6ccd5f){return function(_0x41bd7e){try{jsonpatch[_0xa03b('0x1d')](_0x41bd7e,_0x6ccd5f,!![]);}catch(_0x1a27a6){return BPromise['reject'](_0x1a27a6);}return _0x41bd7e[_0xa03b('0x1e')]();};}function saveUpdates(_0x9de565,_0x44e286){return function(_0x2802b5){if(_0x2802b5){return _0x2802b5['update'](_0x9de565)[_0xa03b('0x1f')](function(_0x28ba5d){return _0x28ba5d;});}return null;};}function removeEntity(_0x1e53d7,_0x1ba86e){return function(_0x3d81ee){if(_0x3d81ee){return _0x3d81ee[_0xa03b('0x20')]()[_0xa03b('0x1f')](function(){_0x1e53d7[_0xa03b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x434756,_0x202b96){return function(_0x14f1d1){if(!_0x14f1d1){_0x434756[_0xa03b('0x21')](0x194);}return _0x14f1d1;};}function handleError(_0x204750,_0x44962f){_0x44962f=_0x44962f||0x1f4;return function(_0x1e5b2c){logger[_0xa03b('0x22')](_0x1e5b2c[_0xa03b('0x23')]);if(_0x1e5b2c[_0xa03b('0x24')]){delete _0x1e5b2c['name'];}_0x204750[_0xa03b('0x15')](_0x44962f)[_0xa03b('0x25')](_0x1e5b2c);};}exports[_0xa03b('0x26')]=function(_0x171f34,_0x1eab77){var _0x2ecfc1={},_0x5d8244={},_0x2e437c={'count':0x0,'rows':[]};var _0xb43a65=_[_0xa03b('0x27')](db['SugarcrmField'][_0xa03b('0x28')],function(_0x261325){return{'name':_0x261325[_0xa03b('0x29')],'type':_0x261325[_0xa03b('0x2a')][_0xa03b('0x2b')]};});_0x5d8244[_0xa03b('0x2c')]=_['map'](_0xb43a65,_0xa03b('0x24'));_0x5d8244[_0xa03b('0x2d')]=_[_0xa03b('0x2e')](_0x171f34[_0xa03b('0x2d')]);_0x5d8244[_0xa03b('0x2f')]=_[_0xa03b('0x30')](_0x5d8244[_0xa03b('0x2c')],_0x5d8244[_0xa03b('0x2d')]);_0x2ecfc1[_0xa03b('0x31')]=_[_0xa03b('0x30')](_0x5d8244[_0xa03b('0x2c')],qs['fields'](_0x171f34[_0xa03b('0x2d')][_0xa03b('0x32')]));_0x2ecfc1['attributes']=_0x2ecfc1[_0xa03b('0x31')]['length']?_0x2ecfc1['attributes']:_0x5d8244[_0xa03b('0x2c')];if(!_0x171f34['query'][_0xa03b('0x33')](_0xa03b('0x34'))){_0x2ecfc1['limit']=qs[_0xa03b('0x18')](_0x171f34[_0xa03b('0x2d')][_0xa03b('0x18')]);_0x2ecfc1['offset']=qs[_0xa03b('0x19')](_0x171f34[_0xa03b('0x2d')][_0xa03b('0x19')]);}_0x2ecfc1[_0xa03b('0x35')]=qs[_0xa03b('0x36')](_0x171f34[_0xa03b('0x2d')][_0xa03b('0x36')]);_0x2ecfc1[_0xa03b('0x37')]=qs[_0xa03b('0x2f')](_[_0xa03b('0x38')](_0x171f34[_0xa03b('0x2d')],_0x5d8244[_0xa03b('0x2f')]),_0xb43a65);if(_0x171f34[_0xa03b('0x2d')][_0xa03b('0x39')]){_0x2ecfc1['where']=_[_0xa03b('0x3a')](_0x2ecfc1['where'],{'$or':_[_0xa03b('0x27')](_0xb43a65,function(_0x17d4b5){if(_0x17d4b5[_0xa03b('0x2a')]!=='VIRTUAL'){var _0x45718c={};_0x45718c[_0x17d4b5[_0xa03b('0x24')]]={'$like':'%'+_0x171f34[_0xa03b('0x2d')][_0xa03b('0x39')]+'%'};return _0x45718c;}})});}_0x2ecfc1=_[_0xa03b('0x3a')]({},_0x2ecfc1,_0x171f34['options']);var _0x6e3d4c={'where':_0x2ecfc1['where']};return db[_0xa03b('0x3b')][_0xa03b('0x1a')](_0x6e3d4c)[_0xa03b('0x1f')](function(_0x3951e1){_0x2e437c[_0xa03b('0x1a')]=_0x3951e1;if(_0x171f34[_0xa03b('0x2d')]['includeAll']){_0x2ecfc1[_0xa03b('0x3c')]=[{'all':!![]}];}return db[_0xa03b('0x3b')][_0xa03b('0x3d')](_0x2ecfc1);})[_0xa03b('0x1f')](function(_0x44ba67){_0x2e437c[_0xa03b('0x3e')]=_0x44ba67;return _0x2e437c;})[_0xa03b('0x1f')](respondWithFilteredResult(_0x1eab77,_0x2ecfc1))['catch'](handleError(_0x1eab77,null));};exports['show']=function(_0x3f9f8b,_0x37deb3){var _0x1959b2={'raw':!![],'where':{'id':_0x3f9f8b['params']['id']}},_0x33753a={};_0x33753a[_0xa03b('0x2c')]=_[_0xa03b('0x2e')](db['SugarcrmField']['rawAttributes']);_0x33753a['query']=_[_0xa03b('0x2e')](_0x3f9f8b[_0xa03b('0x2d')]);_0x33753a[_0xa03b('0x2f')]=_['intersection'](_0x33753a[_0xa03b('0x2c')],_0x33753a['query']);_0x1959b2['attributes']=_[_0xa03b('0x30')](_0x33753a[_0xa03b('0x2c')],qs['fields'](_0x3f9f8b['query'][_0xa03b('0x32')]));_0x1959b2[_0xa03b('0x31')]=_0x1959b2[_0xa03b('0x31')]['length']?_0x1959b2[_0xa03b('0x31')]:_0x33753a[_0xa03b('0x2c')];if(_0x3f9f8b[_0xa03b('0x2d')][_0xa03b('0x3f')]){_0x1959b2[_0xa03b('0x3c')]=[{'all':!![]}];}_0x1959b2=_[_0xa03b('0x3a')]({},_0x1959b2,_0x3f9f8b[_0xa03b('0x40')]);return db['SugarcrmField'][_0xa03b('0x41')](_0x1959b2)[_0xa03b('0x1f')](handleEntityNotFound(_0x37deb3,null))['then'](respondWithResult(_0x37deb3,null))[_0xa03b('0x42')](handleError(_0x37deb3,null));};exports[_0xa03b('0x43')]=function(_0x591778,_0x225513){return db['SugarcrmField'][_0xa03b('0x43')](_0x591778[_0xa03b('0x44')],{})[_0xa03b('0x1f')](respondWithResult(_0x225513,0xc9))['catch'](handleError(_0x225513,null));};exports[_0xa03b('0x45')]=function(_0x30e891,_0x3d28fd){if(_0x30e891['body']['id']){delete _0x30e891[_0xa03b('0x44')]['id'];}return db[_0xa03b('0x3b')][_0xa03b('0x41')]({'where':{'id':_0x30e891['params']['id']}})['then'](handleEntityNotFound(_0x3d28fd,null))[_0xa03b('0x1f')](saveUpdates(_0x30e891[_0xa03b('0x44')],null))[_0xa03b('0x1f')](respondWithResult(_0x3d28fd,null))[_0xa03b('0x42')](handleError(_0x3d28fd,null));};exports[_0xa03b('0x20')]=function(_0x293703,_0x4cacba){return db['SugarcrmField'][_0xa03b('0x41')]({'where':{'id':_0x293703[_0xa03b('0x46')]['id']}})[_0xa03b('0x1f')](handleEntityNotFound(_0x4cacba,null))['then'](removeEntity(_0x4cacba,null))['catch'](handleError(_0x4cacba,null));}; \ No newline at end of file +var _0xd2b6=['rows','catch','show','params','rawAttributes','keys','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','apply','reject','update','then','send','index','SugarcrmField','type','model','name','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xd2b6,0x11a));var _0x6d2b=function(_0x257c0c,_0x7237ec){_0x257c0c=_0x257c0c-0x0;var _0x54a6c5=_0xd2b6[_0x257c0c];return _0x54a6c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d2b('0x0'));var zipdir=require(_0x6d2b('0x1'));var jsonpatch=require(_0x6d2b('0x2'));var rp=require(_0x6d2b('0x3'));var moment=require(_0x6d2b('0x4'));var BPromise=require(_0x6d2b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6d2b('0x6'));var csv=require(_0x6d2b('0x7'));var ejs=require(_0x6d2b('0x8'));var fs=require('fs');var fs_extra=require(_0x6d2b('0x9'));var _=require(_0x6d2b('0xa'));var squel=require('squel');var crypto=require(_0x6d2b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6d2b('0x7'));var querystring=require(_0x6d2b('0xc'));var Papa=require(_0x6d2b('0xd'));var Redis=require('ioredis');var authService=require(_0x6d2b('0xe'));var qs=require(_0x6d2b('0xf'));var as=require(_0x6d2b('0x10'));var hardwareService=require(_0x6d2b('0x11'));var logger=require('../../config/logger')(_0x6d2b('0x12'));var utils=require(_0x6d2b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6d2b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40d5e4,_0x1ee610){_0x1ee610=_0x1ee610||0xcc;return function(_0x4678b2){if(_0x4678b2){return _0x40d5e4[_0x6d2b('0x15')](_0x1ee610);}return _0x40d5e4[_0x6d2b('0x16')](_0x1ee610)[_0x6d2b('0x17')]();};}function respondWithResult(_0x18246f,_0x2624ff){_0x2624ff=_0x2624ff||0xc8;return function(_0x3f9548){if(_0x3f9548){return _0x18246f['status'](_0x2624ff)[_0x6d2b('0x18')](_0x3f9548);}};}function respondWithFilteredResult(_0x4b50dc,_0x185737){return function(_0xbc063b){if(_0xbc063b){var _0x145158=typeof _0x185737[_0x6d2b('0x19')]==='undefined'&&typeof _0x185737['limit']==='undefined';var _0x1edfb5=_0xbc063b[_0x6d2b('0x1a')];var _0x494fce=_0x145158?0x0:_0x185737[_0x6d2b('0x19')];var _0x3613f3=_0x145158?_0xbc063b['count']:_0x185737['offset']+_0x185737[_0x6d2b('0x1b')];var _0x44b656;if(_0x3613f3>=_0x1edfb5){_0x3613f3=_0x1edfb5;_0x44b656=0xc8;}else{_0x44b656=0xce;}_0x4b50dc[_0x6d2b('0x16')](_0x44b656);return _0x4b50dc[_0x6d2b('0x1c')]('Content-Range',_0x494fce+'-'+_0x3613f3+'/'+_0x1edfb5)['json'](_0xbc063b);}return null;};}function patchUpdates(_0x5ef18e){return function(_0x2c5349){try{jsonpatch[_0x6d2b('0x1d')](_0x2c5349,_0x5ef18e,!![]);}catch(_0x25f912){return BPromise[_0x6d2b('0x1e')](_0x25f912);}return _0x2c5349['save']();};}function saveUpdates(_0x1b9345,_0x1021c3){return function(_0x137d19){if(_0x137d19){return _0x137d19[_0x6d2b('0x1f')](_0x1b9345)[_0x6d2b('0x20')](function(_0x153227){return _0x153227;});}return null;};}function removeEntity(_0x1362cc,_0xeb936c){return function(_0x322ff8){if(_0x322ff8){return _0x322ff8['destroy']()['then'](function(){_0x1362cc[_0x6d2b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x233438,_0x3f19b9){return function(_0x48fca5){if(!_0x48fca5){_0x233438[_0x6d2b('0x15')](0x194);}return _0x48fca5;};}function handleError(_0xc0a0b5,_0x2eb18b){_0x2eb18b=_0x2eb18b||0x1f4;return function(_0x21b2e0){logger['error'](_0x21b2e0['stack']);if(_0x21b2e0['name']){delete _0x21b2e0['name'];}_0xc0a0b5[_0x6d2b('0x16')](_0x2eb18b)[_0x6d2b('0x21')](_0x21b2e0);};}exports[_0x6d2b('0x22')]=function(_0x2df71a,_0x2a761c){var _0x5bc103={},_0x409efa={},_0x3e6389={'count':0x0,'rows':[]};var _0x528415=_['map'](db[_0x6d2b('0x23')]['rawAttributes'],function(_0x1ece3e){return{'name':_0x1ece3e['fieldName'],'type':_0x1ece3e[_0x6d2b('0x24')]['key']};});_0x409efa[_0x6d2b('0x25')]=_['map'](_0x528415,_0x6d2b('0x26'));_0x409efa[_0x6d2b('0x27')]=_['keys'](_0x2df71a[_0x6d2b('0x27')]);_0x409efa[_0x6d2b('0x28')]=_['intersection'](_0x409efa[_0x6d2b('0x25')],_0x409efa[_0x6d2b('0x27')]);_0x5bc103[_0x6d2b('0x29')]=_[_0x6d2b('0x2a')](_0x409efa[_0x6d2b('0x25')],qs[_0x6d2b('0x2b')](_0x2df71a[_0x6d2b('0x27')]['fields']));_0x5bc103[_0x6d2b('0x29')]=_0x5bc103['attributes']['length']?_0x5bc103[_0x6d2b('0x29')]:_0x409efa[_0x6d2b('0x25')];if(!_0x2df71a[_0x6d2b('0x27')][_0x6d2b('0x2c')](_0x6d2b('0x2d'))){_0x5bc103[_0x6d2b('0x1b')]=qs[_0x6d2b('0x1b')](_0x2df71a[_0x6d2b('0x27')][_0x6d2b('0x1b')]);_0x5bc103['offset']=qs['offset'](_0x2df71a[_0x6d2b('0x27')][_0x6d2b('0x19')]);}_0x5bc103[_0x6d2b('0x2e')]=qs[_0x6d2b('0x2f')](_0x2df71a[_0x6d2b('0x27')][_0x6d2b('0x2f')]);_0x5bc103[_0x6d2b('0x30')]=qs[_0x6d2b('0x28')](_[_0x6d2b('0x31')](_0x2df71a[_0x6d2b('0x27')],_0x409efa[_0x6d2b('0x28')]),_0x528415);if(_0x2df71a[_0x6d2b('0x27')]['filter']){_0x5bc103[_0x6d2b('0x30')]=_['merge'](_0x5bc103[_0x6d2b('0x30')],{'$or':_[_0x6d2b('0x32')](_0x528415,function(_0x24a9b9){if(_0x24a9b9['type']!==_0x6d2b('0x33')){var _0x54bbcd={};_0x54bbcd[_0x24a9b9['name']]={'$like':'%'+_0x2df71a['query'][_0x6d2b('0x34')]+'%'};return _0x54bbcd;}})});}_0x5bc103=_[_0x6d2b('0x35')]({},_0x5bc103,_0x2df71a[_0x6d2b('0x36')]);var _0x756943={'where':_0x5bc103[_0x6d2b('0x30')]};return db[_0x6d2b('0x23')][_0x6d2b('0x1a')](_0x756943)['then'](function(_0x2d1392){_0x3e6389[_0x6d2b('0x1a')]=_0x2d1392;if(_0x2df71a[_0x6d2b('0x27')][_0x6d2b('0x37')]){_0x5bc103[_0x6d2b('0x38')]=[{'all':!![]}];}return db['SugarcrmField'][_0x6d2b('0x39')](_0x5bc103);})['then'](function(_0x226b50){_0x3e6389[_0x6d2b('0x3a')]=_0x226b50;return _0x3e6389;})[_0x6d2b('0x20')](respondWithFilteredResult(_0x2a761c,_0x5bc103))[_0x6d2b('0x3b')](handleError(_0x2a761c,null));};exports[_0x6d2b('0x3c')]=function(_0x14abf2,_0x1c22a4){var _0x1ee099={'raw':!![],'where':{'id':_0x14abf2[_0x6d2b('0x3d')]['id']}},_0x3dff76={};_0x3dff76[_0x6d2b('0x25')]=_['keys'](db[_0x6d2b('0x23')][_0x6d2b('0x3e')]);_0x3dff76[_0x6d2b('0x27')]=_[_0x6d2b('0x3f')](_0x14abf2[_0x6d2b('0x27')]);_0x3dff76[_0x6d2b('0x28')]=_['intersection'](_0x3dff76[_0x6d2b('0x25')],_0x3dff76[_0x6d2b('0x27')]);_0x1ee099[_0x6d2b('0x29')]=_[_0x6d2b('0x2a')](_0x3dff76['model'],qs[_0x6d2b('0x2b')](_0x14abf2[_0x6d2b('0x27')][_0x6d2b('0x2b')]));_0x1ee099[_0x6d2b('0x29')]=_0x1ee099[_0x6d2b('0x29')][_0x6d2b('0x40')]?_0x1ee099['attributes']:_0x3dff76[_0x6d2b('0x25')];if(_0x14abf2[_0x6d2b('0x27')]['includeAll']){_0x1ee099[_0x6d2b('0x38')]=[{'all':!![]}];}_0x1ee099=_[_0x6d2b('0x35')]({},_0x1ee099,_0x14abf2['options']);return db[_0x6d2b('0x23')][_0x6d2b('0x41')](_0x1ee099)[_0x6d2b('0x20')](handleEntityNotFound(_0x1c22a4,null))[_0x6d2b('0x20')](respondWithResult(_0x1c22a4,null))[_0x6d2b('0x3b')](handleError(_0x1c22a4,null));};exports[_0x6d2b('0x42')]=function(_0x4520b9,_0x5562f5){return db[_0x6d2b('0x23')][_0x6d2b('0x42')](_0x4520b9[_0x6d2b('0x43')],{})['then'](respondWithResult(_0x5562f5,0xc9))[_0x6d2b('0x3b')](handleError(_0x5562f5,null));};exports[_0x6d2b('0x1f')]=function(_0x120ec6,_0x3b0d40){if(_0x120ec6[_0x6d2b('0x43')]['id']){delete _0x120ec6[_0x6d2b('0x43')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x120ec6[_0x6d2b('0x3d')]['id']}})[_0x6d2b('0x20')](handleEntityNotFound(_0x3b0d40,null))[_0x6d2b('0x20')](saveUpdates(_0x120ec6[_0x6d2b('0x43')],null))[_0x6d2b('0x20')](respondWithResult(_0x3b0d40,null))[_0x6d2b('0x3b')](handleError(_0x3b0d40,null));};exports['destroy']=function(_0x57ec6e,_0x552e94){return db['SugarcrmField'][_0x6d2b('0x41')]({'where':{'id':_0x57ec6e[_0x6d2b('0x3d')]['id']}})[_0x6d2b('0x20')](handleEntityNotFound(_0x552e94,null))[_0x6d2b('0x20')](removeEntity(_0x552e94,null))[_0x6d2b('0x3b')](handleError(_0x552e94,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6a40de8..3bf0a54 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 _0x4339=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x337216,_0x4184e2){var _0x113fdb=function(_0x34e656){while(--_0x34e656){_0x337216['push'](_0x337216['shift']());}};_0x113fdb(++_0x4184e2);}(_0x4339,0x1f0));var _0x9433=function(_0x44a862,_0xf79730){_0x44a862=_0x44a862-0x0;var _0x113b35=_0x4339[_0x44a862];return _0x113b35;};'use strict';var _=require(_0x9433('0x0'));var util=require('util');var logger=require(_0x9433('0x1'))(_0x9433('0x2'));var moment=require(_0x9433('0x3'));var BPromise=require(_0x9433('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9433('0x5'));var rimraf=require(_0x9433('0x6'));var config=require(_0x9433('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x889fcb,_0x46ba05){return _0x889fcb['define'](_0x9433('0x8'),attributes,{'tableName':_0x9433('0x9'),'paranoid':![],'indexes':[{'name':_0x9433('0xa'),'fields':[_0x9433('0xb'),_0x9433('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcdd6,0xde));var _0x6cdd=function(_0x277121,_0x1a802c){_0x277121=_0x277121-0x0;var _0x1b16c9=_0xcdd6[_0x277121];return _0x1b16c9;};'use strict';var _=require(_0x6cdd('0x0'));var util=require('util');var logger=require(_0x6cdd('0x1'))(_0x6cdd('0x2'));var moment=require(_0x6cdd('0x3'));var BPromise=require(_0x6cdd('0x4'));var rp=require(_0x6cdd('0x5'));var fs=require('fs');var path=require(_0x6cdd('0x6'));var rimraf=require(_0x6cdd('0x7'));var config=require(_0x6cdd('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x6cdd('0x9')]=function(_0x21fe5d,_0x26f7f1){return _0x21fe5d[_0x6cdd('0xa')](_0x6cdd('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x6cdd('0xc'),'fields':['idField',_0x6cdd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 78468d1..a9b7f16 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 _0xbea6=['error','message','info','result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1c1509,_0x2dfa81){var _0xf11b7=function(_0x17949e){while(--_0x17949e){_0x1c1509['push'](_0x1c1509['shift']());}};_0xf11b7(++_0x2dfa81);}(_0xbea6,0xb8));var _0x6bea=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xbea6[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x6bea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6bea('0x1'));var rs=require(_0x6bea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6bea('0x3'));var logger=require(_0x6bea('0x4'))(_0x6bea('0x5'));var config=require(_0x6bea('0x6'));var jayson=require(_0x6bea('0x7'));var client=jayson[_0x6bea('0x8')][_0x6bea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x371ce8,_0x89a7a5,_0x1bc49e){return new BPromise(function(_0x35b910,_0x12f8a6){return client[_0x6bea('0xa')](_0x371ce8,_0x1bc49e)['then'](function(_0x3d0c19){logger['info'](_0x6bea('0xb'),_0x89a7a5,_0x6bea('0xc'));logger[_0x6bea('0xd')](_0x6bea('0xe'),_0x89a7a5,_0x6bea('0xc'),JSON[_0x6bea('0xf')](_0x3d0c19));if(_0x3d0c19['error']){if(_0x3d0c19[_0x6bea('0x10')]['code']===0x1f4){logger['error'](_0x6bea('0xb'),_0x89a7a5,_0x3d0c19[_0x6bea('0x10')][_0x6bea('0x11')]);return _0x12f8a6(_0x3d0c19[_0x6bea('0x10')][_0x6bea('0x11')]);}logger[_0x6bea('0x10')](_0x6bea('0xb'),_0x89a7a5,_0x3d0c19['error'][_0x6bea('0x11')]);return _0x35b910(_0x3d0c19['error']['message']);}else{logger[_0x6bea('0x12')](_0x6bea('0xb'),_0x89a7a5,_0x6bea('0xc'));_0x35b910(_0x3d0c19[_0x6bea('0x13')][_0x6bea('0x11')]);}})['catch'](function(_0x3252de){logger[_0x6bea('0x10')](_0x6bea('0xb'),_0x89a7a5,_0x3252de);_0x12f8a6(_0x3252de);});});} \ No newline at end of file +var _0xb861=['SugarcrmField,\x20%s,\x20%s,\x20%s','error','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','request\x20sent','debug'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb861,0x124));var _0x1b86=function(_0x2d604d,_0x51a1f5){_0x2d604d=_0x2d604d-0x0;var _0x159761=_0xb861[_0x2d604d];return _0x159761;};'use strict';var _=require('lodash');var util=require(_0x1b86('0x0'));var moment=require(_0x1b86('0x1'));var BPromise=require(_0x1b86('0x2'));var rs=require(_0x1b86('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b86('0x4'))['db'];var utils=require(_0x1b86('0x5'));var logger=require('../../config/logger')(_0x1b86('0x6'));var config=require('../../config/environment');var jayson=require(_0x1b86('0x7'));var client=jayson['client'][_0x1b86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e5abc,_0x927ad1,_0x173674){return new BPromise(function(_0xfc3e47,_0x5151b9){return client[_0x1b86('0x9')](_0x4e5abc,_0x173674)['then'](function(_0x145c18){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x927ad1,_0x1b86('0xa'));logger[_0x1b86('0xb')](_0x1b86('0xc'),_0x927ad1,_0x1b86('0xa'),JSON['stringify'](_0x145c18));if(_0x145c18[_0x1b86('0xd')]){if(_0x145c18[_0x1b86('0xd')]['code']===0x1f4){logger[_0x1b86('0xd')](_0x1b86('0xe'),_0x927ad1,_0x145c18[_0x1b86('0xd')]['message']);return _0x5151b9(_0x145c18[_0x1b86('0xd')]['message']);}logger[_0x1b86('0xd')](_0x1b86('0xe'),_0x927ad1,_0x145c18[_0x1b86('0xd')]['message']);return _0xfc3e47(_0x145c18[_0x1b86('0xd')][_0x1b86('0xf')]);}else{logger[_0x1b86('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x927ad1,_0x1b86('0xa'));_0xfc3e47(_0x145c18[_0x1b86('0x11')]['message']);}})[_0x1b86('0x12')](function(_0x466de8){logger[_0x1b86('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x927ad1,_0x466de8);_0x5151b9(_0x466de8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ede1a57..e4dc2a9 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(_0x17633a,_0xf7f335){var _0x55c40b=function(_0x13863b){while(--_0x13863b){_0x17633a['push'](_0x17633a['shift']());}};_0x55c40b(++_0xf7f335);}(_0x925e,0x199));var _0xe925=function(_0x342186,_0x24596f){_0x342186=_0x342186-0x0;var _0x58fd4a=_0x925e[_0x342186];return _0x58fd4a;};'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 _0x3299=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x3299,0x1bc));var _0x9329=function(_0x1f954c,_0x10980f){_0x1f954c=_0x1f954c-0x0;var _0x43ce01=_0x3299[_0x1f954c];return _0x43ce01;};'use strict';var multer=require('multer');var util=require(_0x9329('0x0'));var path=require(_0x9329('0x1'));var timeout=require(_0x9329('0x2'));var express=require(_0x9329('0x3'));var router=express[_0x9329('0x4')]();var fs_extra=require(_0x9329('0x5'));var auth=require(_0x9329('0x6'));var interaction=require(_0x9329('0x7'));var config=require(_0x9329('0x8'));var controller=require(_0x9329('0x9'));router[_0x9329('0xa')]('/',auth[_0x9329('0xb')](),controller[_0x9329('0xc')]);router[_0x9329('0xa')](_0x9329('0xd'),auth[_0x9329('0xb')](),controller[_0x9329('0xe')]);router['get'](_0x9329('0xf'),auth[_0x9329('0xb')](),controller[_0x9329('0x10')]);router[_0x9329('0xa')](_0x9329('0x11'),auth['isAuthenticated'](),controller[_0x9329('0x12')]);router[_0x9329('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9329('0xf'),auth[_0x9329('0xb')](),controller[_0x9329('0x14')]);router[_0x9329('0x15')](_0x9329('0xd'),auth['isAuthenticated'](),controller[_0x9329('0x16')]);router[_0x9329('0x17')](_0x9329('0xd'),auth['isAuthenticated'](),controller[_0x9329('0x18')]);module[_0x9329('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index b8913f9..8a82791 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 _0x907b=['exports','STRING'];(function(_0x2e708c,_0x5eaa80){var _0x71f836=function(_0x57121a){while(--_0x57121a){_0x2e708c['push'](_0x2e708c['shift']());}};_0x71f836(++_0x5eaa80);}(_0x907b,0x150));var _0xb907=function(_0x444f91,_0x2a61f2){_0x444f91=_0x444f91-0x0;var _0x3248ab=_0x907b[_0x444f91];return _0x3248ab;};'use strict';var Sequelize=require('sequelize');module[_0xb907('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb907('0x1')]},'username':{'type':Sequelize[_0xb907('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb907('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xb907('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb907('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb907('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x85c1=['exports','STRING'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x85c1,0x18a));var _0x185c=function(_0x113a6c,_0x10df30){_0x113a6c=_0x113a6c-0x0;var _0x1ac632=_0x85c1[_0x113a6c];return _0x1ac632;};'use strict';var Sequelize=require('sequelize');module[_0x185c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x185c('0x1')]},'username':{'type':Sequelize[_0x185c('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x185c('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x185c('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x185c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f2954c3..596378e 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 _0x4aaf=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','error','name','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','options','find','create','body','update','findOne','pick','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','login','result','token','success','GET','describe','sessionName','reference','owner','remove','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','send','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x5047de,_0x3a2b23){var _0x516bb3=function(_0x3d279d){while(--_0x3d279d){_0x5047de['push'](_0x5047de['shift']());}};_0x516bb3(++_0x3a2b23);}(_0x4aaf,0x1d8));var _0xf4aa=function(_0x192895,_0xd92c82){_0x192895=_0x192895-0x0;var _0x6d6bb=_0x4aaf[_0x192895];return _0x6d6bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4aa('0x0'));var zipdir=require(_0xf4aa('0x1'));var jsonpatch=require(_0xf4aa('0x2'));var rp=require('request-promise');var moment=require(_0xf4aa('0x3'));var BPromise=require(_0xf4aa('0x4'));var Mustache=require(_0xf4aa('0x5'));var util=require(_0xf4aa('0x6'));var path=require(_0xf4aa('0x7'));var sox=require(_0xf4aa('0x8'));var csv=require(_0xf4aa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4aa('0xa'));var squel=require(_0xf4aa('0xb'));var crypto=require('crypto');var jsforce=require(_0xf4aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf4aa('0x9'));var querystring=require(_0xf4aa('0xd'));var Papa=require(_0xf4aa('0xe'));var Redis=require(_0xf4aa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf4aa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4aa('0x11'));var logger=require(_0xf4aa('0x12'))(_0xf4aa('0x13'));var utils=require(_0xf4aa('0x14'));var config=require(_0xf4aa('0x15'));var licenseUtil=require(_0xf4aa('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf4aa('0x17'));function respondWithStatusCode(_0x46ef3e,_0x3c198f){_0x3c198f=_0x3c198f||0xcc;return function(_0x3ab046){if(_0x3ab046){return _0x46ef3e[_0xf4aa('0x18')](_0x3c198f);}return _0x46ef3e[_0xf4aa('0x19')](_0x3c198f)[_0xf4aa('0x1a')]();};}function respondWithResult(_0x8cc882,_0x10b7f3){_0x10b7f3=_0x10b7f3||0xc8;return function(_0x2b283e){if(_0x2b283e){return _0x8cc882['status'](_0x10b7f3)[_0xf4aa('0x1b')](_0x2b283e);}};}function respondWithFilteredResult(_0x4e6794,_0x70776a){return function(_0x31309d){if(_0x31309d){var _0x426b56=typeof _0x70776a['offset']===_0xf4aa('0x1c')&&typeof _0x70776a[_0xf4aa('0x1d')]===_0xf4aa('0x1c');var _0x2f9120=_0x31309d['count'];var _0x22f289=_0x426b56?0x0:_0x70776a[_0xf4aa('0x1e')];var _0x552c63=_0x426b56?_0x31309d[_0xf4aa('0x1f')]:_0x70776a[_0xf4aa('0x1e')]+_0x70776a[_0xf4aa('0x1d')];var _0x37908f;if(_0x552c63>=_0x2f9120){_0x552c63=_0x2f9120;_0x37908f=0xc8;}else{_0x37908f=0xce;}_0x4e6794[_0xf4aa('0x19')](_0x37908f);return _0x4e6794[_0xf4aa('0x20')](_0xf4aa('0x21'),_0x22f289+'-'+_0x552c63+'/'+_0x2f9120)['json'](_0x31309d);}return null;};}function patchUpdates(_0x4604b9){return function(_0x41317c){try{jsonpatch[_0xf4aa('0x22')](_0x41317c,_0x4604b9,!![]);}catch(_0x482e24){return BPromise[_0xf4aa('0x23')](_0x482e24);}return _0x41317c[_0xf4aa('0x24')]();};}function saveUpdates(_0x18cd58,_0x1393af){return function(_0x338bb6){if(_0x338bb6){return _0x338bb6['update'](_0x18cd58)[_0xf4aa('0x25')](function(_0xcd71ee){return _0xcd71ee;});}return null;};}function removeEntity(_0x4f4616,_0x35ee5f){return function(_0x1cb850){if(_0x1cb850){return _0x1cb850['destroy']()['then'](function(){_0x4f4616[_0xf4aa('0x19')](0xcc)[_0xf4aa('0x1a')]();});}};}function handleEntityNotFound(_0x23b054,_0xcd97e4){return function(_0xc79c6c){if(!_0xc79c6c){_0x23b054[_0xf4aa('0x18')](0x194);}return _0xc79c6c;};}function handleError(_0x5051d4,_0x30cfd7){_0x30cfd7=_0x30cfd7||0x1f4;return function(_0x4db39d){logger[_0xf4aa('0x26')](_0x4db39d['stack']);if(_0x4db39d[_0xf4aa('0x27')]){delete _0x4db39d[_0xf4aa('0x27')];}_0x5051d4[_0xf4aa('0x19')](_0x30cfd7)['send'](_0x4db39d);};}exports['index']=function(_0x146b2a,_0xc8a66f){var _0x55a81e={},_0x2de3c6={},_0x579ccb={'count':0x0,'rows':[]};var _0xcb8a48=_[_0xf4aa('0x28')](db[_0xf4aa('0x29')][_0xf4aa('0x2a')],function(_0x45760a){return{'name':_0x45760a[_0xf4aa('0x2b')],'type':_0x45760a[_0xf4aa('0x2c')][_0xf4aa('0x2d')]};});_0x2de3c6[_0xf4aa('0x2e')]=_[_0xf4aa('0x28')](_0xcb8a48,_0xf4aa('0x27'));_0x2de3c6['query']=_['keys'](_0x146b2a[_0xf4aa('0x2f')]);_0x2de3c6[_0xf4aa('0x30')]=_[_0xf4aa('0x31')](_0x2de3c6[_0xf4aa('0x2e')],_0x2de3c6[_0xf4aa('0x2f')]);_0x55a81e[_0xf4aa('0x32')]=_[_0xf4aa('0x31')](_0x2de3c6[_0xf4aa('0x2e')],qs[_0xf4aa('0x33')](_0x146b2a[_0xf4aa('0x2f')]['fields']));_0x55a81e['attributes']=_0x55a81e[_0xf4aa('0x32')][_0xf4aa('0x34')]?_0x55a81e['attributes']:_0x2de3c6['model'];if(!_0x146b2a[_0xf4aa('0x2f')]['hasOwnProperty'](_0xf4aa('0x35'))){_0x55a81e['limit']=qs[_0xf4aa('0x1d')](_0x146b2a['query'][_0xf4aa('0x1d')]);_0x55a81e[_0xf4aa('0x1e')]=qs[_0xf4aa('0x1e')](_0x146b2a[_0xf4aa('0x2f')][_0xf4aa('0x1e')]);}_0x55a81e[_0xf4aa('0x36')]=qs['sort'](_0x146b2a[_0xf4aa('0x2f')][_0xf4aa('0x37')]);_0x55a81e[_0xf4aa('0x38')]=qs[_0xf4aa('0x30')](_['pick'](_0x146b2a['query'],_0x2de3c6['filters']),_0xcb8a48);if(_0x146b2a[_0xf4aa('0x2f')][_0xf4aa('0x39')]){_0x55a81e['where']=_[_0xf4aa('0x3a')](_0x55a81e[_0xf4aa('0x38')],{'$or':_[_0xf4aa('0x28')](_0xcb8a48,function(_0x47a087){if(_0x47a087['type']!==_0xf4aa('0x3b')){var _0x34e1da={};_0x34e1da[_0x47a087['name']]={'$like':'%'+_0x146b2a[_0xf4aa('0x2f')][_0xf4aa('0x39')]+'%'};return _0x34e1da;}})});}_0x55a81e=_[_0xf4aa('0x3a')]({},_0x55a81e,_0x146b2a['options']);var _0x153e7b={'where':_0x55a81e[_0xf4aa('0x38')]};return db[_0xf4aa('0x29')][_0xf4aa('0x1f')](_0x153e7b)[_0xf4aa('0x25')](function(_0x1f3014){_0x579ccb[_0xf4aa('0x1f')]=_0x1f3014;if(_0x146b2a['query'][_0xf4aa('0x3c')]){_0x55a81e[_0xf4aa('0x3d')]=[{'all':!![]}];}return db[_0xf4aa('0x29')]['findAll'](_0x55a81e);})[_0xf4aa('0x25')](function(_0x4f9bfa){_0x579ccb['rows']=_0x4f9bfa;return _0x579ccb;})[_0xf4aa('0x25')](respondWithFilteredResult(_0xc8a66f,_0x55a81e))[_0xf4aa('0x3e')](handleError(_0xc8a66f,null));};exports[_0xf4aa('0x3f')]=function(_0x3036e5,_0x5b40f7){var _0x15adc4={'raw':![],'where':{'id':_0x3036e5[_0xf4aa('0x40')]['id']}},_0x33d403={};_0x33d403[_0xf4aa('0x2e')]=_[_0xf4aa('0x41')](db[_0xf4aa('0x29')]['rawAttributes']);_0x33d403[_0xf4aa('0x2f')]=_[_0xf4aa('0x41')](_0x3036e5[_0xf4aa('0x2f')]);_0x33d403[_0xf4aa('0x30')]=_['intersection'](_0x33d403['model'],_0x33d403['query']);_0x15adc4[_0xf4aa('0x32')]=_['intersection'](_0x33d403[_0xf4aa('0x2e')],qs['fields'](_0x3036e5[_0xf4aa('0x2f')][_0xf4aa('0x33')]));_0x15adc4[_0xf4aa('0x32')]=_0x15adc4[_0xf4aa('0x32')][_0xf4aa('0x34')]?_0x15adc4[_0xf4aa('0x32')]:_0x33d403['model'];if(_0x3036e5[_0xf4aa('0x2f')][_0xf4aa('0x3c')]){_0x15adc4[_0xf4aa('0x3d')]=[{'all':!![]}];}_0x15adc4=_[_0xf4aa('0x3a')]({},_0x15adc4,_0x3036e5[_0xf4aa('0x42')]);return db[_0xf4aa('0x29')][_0xf4aa('0x43')](_0x15adc4)[_0xf4aa('0x25')](handleEntityNotFound(_0x5b40f7,null))[_0xf4aa('0x25')](respondWithResult(_0x5b40f7,null))['catch'](handleError(_0x5b40f7,null));};exports[_0xf4aa('0x44')]=function(_0x7c94cb,_0x81a6c3){return db['VtigerAccount'][_0xf4aa('0x44')](_0x7c94cb[_0xf4aa('0x45')],{})[_0xf4aa('0x25')](respondWithResult(_0x81a6c3,0xc9))[_0xf4aa('0x3e')](handleError(_0x81a6c3,null));};exports[_0xf4aa('0x46')]=function(_0x2ff67b,_0x2ef34f){if(_0x2ff67b[_0xf4aa('0x45')]['id']){delete _0x2ff67b['body']['id'];}return db[_0xf4aa('0x29')]['find']({'where':{'id':_0x2ff67b[_0xf4aa('0x40')]['id']}})[_0xf4aa('0x25')](handleEntityNotFound(_0x2ef34f,null))[_0xf4aa('0x25')](saveUpdates(_0x2ff67b[_0xf4aa('0x45')],null))[_0xf4aa('0x25')](respondWithResult(_0x2ef34f,null))[_0xf4aa('0x3e')](handleError(_0x2ef34f,null));};exports['destroy']=function(_0x238649,_0x16006c){return db[_0xf4aa('0x29')][_0xf4aa('0x43')]({'where':{'id':_0x238649[_0xf4aa('0x40')]['id']}})[_0xf4aa('0x25')](handleEntityNotFound(_0x16006c,null))['then'](removeEntity(_0x16006c,null))['catch'](handleError(_0x16006c,null));};exports['getConfigurations']=function(_0x37b6e6,_0x548437,_0x5932da){var _0x1dcd64={};var _0x492ecc={};var _0x1769b3;var _0x288475;return db[_0xf4aa('0x29')][_0xf4aa('0x47')]({'where':{'id':_0x37b6e6[_0xf4aa('0x40')]['id']}})[_0xf4aa('0x25')](handleEntityNotFound(_0x548437,null))[_0xf4aa('0x25')](function(_0x5ceb5d){if(_0x5ceb5d){_0x1769b3=_0x5ceb5d;_0x492ecc[_0xf4aa('0x2e')]=_[_0xf4aa('0x41')](db['VtigerConfiguration'][_0xf4aa('0x2a')]);_0x492ecc[_0xf4aa('0x2f')]=_[_0xf4aa('0x41')](_0x37b6e6[_0xf4aa('0x2f')]);_0x492ecc[_0xf4aa('0x30')]=_[_0xf4aa('0x31')](_0x492ecc['model'],_0x492ecc[_0xf4aa('0x2f')]);_0x1dcd64[_0xf4aa('0x32')]=_[_0xf4aa('0x31')](_0x492ecc[_0xf4aa('0x2e')],qs[_0xf4aa('0x33')](_0x37b6e6[_0xf4aa('0x2f')][_0xf4aa('0x33')]));_0x1dcd64[_0xf4aa('0x32')]=_0x1dcd64[_0xf4aa('0x32')][_0xf4aa('0x34')]?_0x1dcd64[_0xf4aa('0x32')]:_0x492ecc['model'];_0x1dcd64[_0xf4aa('0x36')]=qs[_0xf4aa('0x37')](_0x37b6e6['query'][_0xf4aa('0x37')]);_0x1dcd64[_0xf4aa('0x38')]=qs[_0xf4aa('0x30')](_[_0xf4aa('0x48')](_0x37b6e6[_0xf4aa('0x2f')],_0x492ecc[_0xf4aa('0x30')]));if(_0x37b6e6['query'][_0xf4aa('0x39')]){_0x1dcd64['where']=_[_0xf4aa('0x3a')](_0x1dcd64['where'],{'$or':_['map'](_0x1dcd64['attributes'],function(_0x337afe){var _0x4c754e={};_0x4c754e[_0x337afe]={'$like':'%'+_0x37b6e6[_0xf4aa('0x2f')][_0xf4aa('0x39')]+'%'};return _0x4c754e;})});}_0x1dcd64=_['merge']({},_0x1dcd64,_0x37b6e6['options']);return _0x1769b3[_0xf4aa('0x49')](_0x1dcd64);}})['then'](function(_0x118ffd){if(_0x118ffd){_0x288475=_0x118ffd[_0xf4aa('0x34')];if(!_0x37b6e6[_0xf4aa('0x2f')][_0xf4aa('0x4a')](_0xf4aa('0x35'))){_0x1dcd64[_0xf4aa('0x1d')]=qs['limit'](_0x37b6e6[_0xf4aa('0x2f')]['limit']);_0x1dcd64[_0xf4aa('0x1e')]=qs[_0xf4aa('0x1e')](_0x37b6e6[_0xf4aa('0x2f')][_0xf4aa('0x1e')]);}return _0x1769b3[_0xf4aa('0x49')](_0x1dcd64);}})[_0xf4aa('0x25')](function(_0x424bbb){if(_0x424bbb){return _0x424bbb?{'count':_0x288475,'rows':_0x424bbb}:null;}})[_0xf4aa('0x25')](respondWithResult(_0x548437,null))['catch'](handleError(_0x548437,null));};exports[_0xf4aa('0x4b')]=function(_0x1b0761,_0x2fd8a2,_0x1ee7f6){if(_0x1b0761[_0xf4aa('0x45')]['id']){delete _0x1b0761[_0xf4aa('0x45')]['id'];}return db[_0xf4aa('0x29')][_0xf4aa('0x47')]({'where':{'id':_0x1b0761[_0xf4aa('0x40')]['id']}})[_0xf4aa('0x25')](handleEntityNotFound(_0x2fd8a2,null))[_0xf4aa('0x25')](function(_0x456dbe){if(_0x456dbe){_0x1b0761[_0xf4aa('0x45')][_0xf4aa('0x4c')]=_0x456dbe['id'];_0x1b0761[_0xf4aa('0x45')][_0xf4aa('0x4d')]=integrations[_0xf4aa('0x4e')](_0x1b0761['body']['channel'],_0x1b0761['body'][_0xf4aa('0x2c')]);_0x1b0761[_0xf4aa('0x45')]['Descriptions']=integrations[_0xf4aa('0x4f')](_0x1b0761['body'][_0xf4aa('0x50')],_0x1b0761['body'][_0xf4aa('0x2c')]);return db[_0xf4aa('0x51')][_0xf4aa('0x44')](_0x1b0761['body'],{'include':[{'model':db[_0xf4aa('0x52')],'as':_0xf4aa('0x4d')},{'model':db['VtigerField'],'as':_0xf4aa('0x53')}]});}return null;})[_0xf4aa('0x25')](respondWithResult(_0x2fd8a2,null))[_0xf4aa('0x3e')](handleError(_0x2fd8a2,null));};var md5=require(_0xf4aa('0x54'));exports[_0xf4aa('0x55')]=function(_0x18f3e0,_0x13e623,_0x12d2aa){var _0x145e87=null;var _0x2c02bb=null;var _0xe1c170=null;var _0x1f1de2=null;var _0x23320c='';return db['VtigerAccount'][_0xf4aa('0x47')]({'where':{'id':_0x18f3e0[_0xf4aa('0x40')]['id']},'attributes':['id',_0xf4aa('0x27'),_0xf4aa('0x56'),_0xf4aa('0x57'),'moduleName',_0xf4aa('0x58'),_0xf4aa('0x59'),_0xf4aa('0x5a')]})[_0xf4aa('0x25')](handleEntityNotFound(_0x13e623,null))[_0xf4aa('0x25')](function(_0x1d5224){if(_0x1d5224){_0x145e87=_0x1d5224['username'];_0x2c02bb=_0x1d5224[_0xf4aa('0x5a')];_0xe1c170=_0x1d5224[_0xf4aa('0x5b')];_0x23320c=_0x1d5224[_0xf4aa('0x58')];var _0x18b1d6=_0x23320c['slice'](-0x1);if(_0x18b1d6==='/'){_0x23320c=_0x23320c[_0xf4aa('0x5c')](0x0,_0x23320c[_0xf4aa('0x5d')](_0x18b1d6));}_0x1f1de2=util[_0xf4aa('0x5e')](_0xf4aa('0x5f'),_0x23320c);var _0x18c404={'method':'GET','uri':_0x1f1de2,'qs':{'operation':_0xf4aa('0x60'),'username':_0x1d5224['username']},'json':!![]};return rp(_0x18c404);}})[_0xf4aa('0x25')](function(_0x426c5c){if(_0x426c5c['success']){var _0x396c8d={'method':_0xf4aa('0x61'),'uri':_0x1f1de2,'form':{'operation':_0xf4aa('0x62'),'username':_0x145e87,'accessKey':md5(_0x426c5c[_0xf4aa('0x63')][_0xf4aa('0x64')]+_0x2c02bb)},'json':!![]};return rp(_0x396c8d);}})[_0xf4aa('0x25')](function(_0x4c85e8){if(_0x4c85e8[_0xf4aa('0x65')]){var _0x3877c3={'method':_0xf4aa('0x66'),'uri':_0x1f1de2,'qs':{'operation':_0xf4aa('0x67'),'username':_0x145e87,'sessionName':_0x4c85e8['result'][_0xf4aa('0x68')],'elementType':_0xe1c170},'json':!![]};return rp(_0x3877c3);}})[_0xf4aa('0x25')](function(_0x43fdcb){if(_0x43fdcb[_0xf4aa('0x65')]){var _0x805d9a=['autogenerated',_0xf4aa('0x69'),_0xf4aa('0x6a')];_[_0xf4aa('0x6b')](_0x43fdcb['result']['fields'],function(_0x5b23b6){return _0x805d9a['includes'](_0x5b23b6[_0xf4aa('0x2c')]['name']);});_['remove'](_0x43fdcb[_0xf4aa('0x63')]['fields'],function(_0x2c23de){return _0x2c23de[_0xf4aa('0x6c')]===_0xf4aa('0x6d');});return{'count':_0x43fdcb[_0xf4aa('0x63')][_0xf4aa('0x33')][_0xf4aa('0x34')],'rows':_['map'](_0x43fdcb['result'][_0xf4aa('0x33')],function(_0x41ac9b){return{'id':_0x41ac9b[_0xf4aa('0x27')],'name':_0x41ac9b[_0xf4aa('0x6e')],'custom':_[_0xf4aa('0x6f')](_0x41ac9b[_0xf4aa('0x27')],_0xf4aa('0x70'))?!![]:![],'options':_0x41ac9b[_0xf4aa('0x2c')][_0xf4aa('0x27')]==='picklist'&&_0x41ac9b[_0xf4aa('0x2c')][_0xf4aa('0x71')][_0xf4aa('0x34')]>0x0?_['map'](_0x41ac9b['type']['picklistValues'],function(_0x4828ee){return{'name':_0x4828ee[_0xf4aa('0x6e')],'value':_0x4828ee[_0xf4aa('0x72')]};}):[]};})};}})[_0xf4aa('0x25')](respondWithResult(_0x13e623,null))[_0xf4aa('0x3e')](function(_0x49fd4c){console[_0xf4aa('0x73')](_0xf4aa('0x74')+_0x49fd4c);var _0x31af55=_0x18f3e0[_0xf4aa('0x2f')][_0xf4aa('0x75')]?0x1f4:_0x49fd4c[_0xf4aa('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xf4aa('0x55'),_0x31af55,JSON[_0xf4aa('0x77')](_0x49fd4c));delete _0x49fd4c[_0xf4aa('0x27')];if(_0x31af55===0x191){_0x31af55=0x190;}_0x13e623[_0xf4aa('0x19')](_0x31af55)[_0xf4aa('0x78')](_0x18f3e0['query'][_0xf4aa('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x49fd4c[_0xf4aa('0x76')]}:_0x49fd4c);});}; \ No newline at end of file +var _0xda76=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','create','body','params','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','type','VtigerField','Subjects','md5','getFields','description','moduleName','remoteUri','username','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','autogenerated','reference','includes','remove','editable','false','startsWith','picklist','picklistValues','label','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xda76,0x138));var _0x6da7=function(_0x3e1414,_0x43ffe0){_0x3e1414=_0x3e1414-0x0;var _0x3e7648=_0xda76[_0x3e1414];return _0x3e7648;};'use strict';var emlformat=require(_0x6da7('0x0'));var rimraf=require(_0x6da7('0x1'));var zipdir=require(_0x6da7('0x2'));var jsonpatch=require(_0x6da7('0x3'));var rp=require('request-promise');var moment=require(_0x6da7('0x4'));var BPromise=require(_0x6da7('0x5'));var Mustache=require(_0x6da7('0x6'));var util=require(_0x6da7('0x7'));var path=require(_0x6da7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6da7('0x9'));var fs=require('fs');var fs_extra=require(_0x6da7('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6da7('0xb'));var deskjs=require(_0x6da7('0xc'));var toCsv=require(_0x6da7('0xd'));var querystring=require(_0x6da7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6da7('0xf'));var qs=require(_0x6da7('0x10'));var as=require(_0x6da7('0x11'));var hardwareService=require(_0x6da7('0x12'));var logger=require('../../config/logger')(_0x6da7('0x13'));var utils=require(_0x6da7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6da7('0x15'));var db=require(_0x6da7('0x16'))['db'];var integrations=require(_0x6da7('0x17'));function respondWithStatusCode(_0x412805,_0x2ae4ad){_0x2ae4ad=_0x2ae4ad||0xcc;return function(_0x4d8819){if(_0x4d8819){return _0x412805['sendStatus'](_0x2ae4ad);}return _0x412805['status'](_0x2ae4ad)[_0x6da7('0x18')]();};}function respondWithResult(_0x191d06,_0x592029){_0x592029=_0x592029||0xc8;return function(_0x4f8f33){if(_0x4f8f33){return _0x191d06[_0x6da7('0x19')](_0x592029)['json'](_0x4f8f33);}};}function respondWithFilteredResult(_0x1b6423,_0x36612a){return function(_0x150b6a){if(_0x150b6a){var _0x88a4b7=typeof _0x36612a[_0x6da7('0x1a')]===_0x6da7('0x1b')&&typeof _0x36612a[_0x6da7('0x1c')]===_0x6da7('0x1b');var _0x1afd14=_0x150b6a[_0x6da7('0x1d')];var _0x59e466=_0x88a4b7?0x0:_0x36612a[_0x6da7('0x1a')];var _0x49a2a3=_0x88a4b7?_0x150b6a[_0x6da7('0x1d')]:_0x36612a[_0x6da7('0x1a')]+_0x36612a[_0x6da7('0x1c')];var _0x58800f;if(_0x49a2a3>=_0x1afd14){_0x49a2a3=_0x1afd14;_0x58800f=0xc8;}else{_0x58800f=0xce;}_0x1b6423[_0x6da7('0x19')](_0x58800f);return _0x1b6423[_0x6da7('0x1e')](_0x6da7('0x1f'),_0x59e466+'-'+_0x49a2a3+'/'+_0x1afd14)[_0x6da7('0x20')](_0x150b6a);}return null;};}function patchUpdates(_0x51c520){return function(_0x1d68bd){try{jsonpatch['apply'](_0x1d68bd,_0x51c520,!![]);}catch(_0x37a1c5){return BPromise[_0x6da7('0x21')](_0x37a1c5);}return _0x1d68bd[_0x6da7('0x22')]();};}function saveUpdates(_0x5abd1e,_0x5d8df2){return function(_0xb03cd3){if(_0xb03cd3){return _0xb03cd3[_0x6da7('0x23')](_0x5abd1e)[_0x6da7('0x24')](function(_0x423a93){return _0x423a93;});}return null;};}function removeEntity(_0x316572,_0x2a6178){return function(_0x52d3bc){if(_0x52d3bc){return _0x52d3bc[_0x6da7('0x25')]()['then'](function(){_0x316572['status'](0xcc)[_0x6da7('0x18')]();});}};}function handleEntityNotFound(_0x4f2f5a,_0xfec8a3){return function(_0x3cf988){if(!_0x3cf988){_0x4f2f5a[_0x6da7('0x26')](0x194);}return _0x3cf988;};}function handleError(_0x39fb9c,_0x4a3d48){_0x4a3d48=_0x4a3d48||0x1f4;return function(_0x1cf1e8){logger[_0x6da7('0x27')](_0x1cf1e8[_0x6da7('0x28')]);if(_0x1cf1e8[_0x6da7('0x29')]){delete _0x1cf1e8[_0x6da7('0x29')];}_0x39fb9c[_0x6da7('0x19')](_0x4a3d48)[_0x6da7('0x2a')](_0x1cf1e8);};}exports[_0x6da7('0x2b')]=function(_0x421911,_0x6f725a){var _0x5db3b8={},_0x444c0b={},_0x20b875={'count':0x0,'rows':[]};var _0x580a9a=_['map'](db[_0x6da7('0x2c')][_0x6da7('0x2d')],function(_0x53ce17){return{'name':_0x53ce17[_0x6da7('0x2e')],'type':_0x53ce17['type'][_0x6da7('0x2f')]};});_0x444c0b[_0x6da7('0x30')]=_[_0x6da7('0x31')](_0x580a9a,_0x6da7('0x29'));_0x444c0b[_0x6da7('0x32')]=_['keys'](_0x421911[_0x6da7('0x32')]);_0x444c0b[_0x6da7('0x33')]=_[_0x6da7('0x34')](_0x444c0b[_0x6da7('0x30')],_0x444c0b[_0x6da7('0x32')]);_0x5db3b8[_0x6da7('0x35')]=_['intersection'](_0x444c0b['model'],qs['fields'](_0x421911[_0x6da7('0x32')][_0x6da7('0x36')]));_0x5db3b8[_0x6da7('0x35')]=_0x5db3b8[_0x6da7('0x35')][_0x6da7('0x37')]?_0x5db3b8['attributes']:_0x444c0b[_0x6da7('0x30')];if(!_0x421911[_0x6da7('0x32')][_0x6da7('0x38')](_0x6da7('0x39'))){_0x5db3b8[_0x6da7('0x1c')]=qs['limit'](_0x421911['query'][_0x6da7('0x1c')]);_0x5db3b8[_0x6da7('0x1a')]=qs['offset'](_0x421911[_0x6da7('0x32')]['offset']);}_0x5db3b8[_0x6da7('0x3a')]=qs[_0x6da7('0x3b')](_0x421911[_0x6da7('0x32')][_0x6da7('0x3b')]);_0x5db3b8['where']=qs['filters'](_[_0x6da7('0x3c')](_0x421911['query'],_0x444c0b['filters']),_0x580a9a);if(_0x421911[_0x6da7('0x32')][_0x6da7('0x3d')]){_0x5db3b8[_0x6da7('0x3e')]=_[_0x6da7('0x3f')](_0x5db3b8['where'],{'$or':_['map'](_0x580a9a,function(_0x369400){if(_0x369400['type']!==_0x6da7('0x40')){var _0x156fbe={};_0x156fbe[_0x369400[_0x6da7('0x29')]]={'$like':'%'+_0x421911[_0x6da7('0x32')][_0x6da7('0x3d')]+'%'};return _0x156fbe;}})});}_0x5db3b8=_[_0x6da7('0x3f')]({},_0x5db3b8,_0x421911[_0x6da7('0x41')]);var _0x380c62={'where':_0x5db3b8[_0x6da7('0x3e')]};return db[_0x6da7('0x2c')][_0x6da7('0x1d')](_0x380c62)[_0x6da7('0x24')](function(_0xfaff5f){_0x20b875['count']=_0xfaff5f;if(_0x421911[_0x6da7('0x32')][_0x6da7('0x42')]){_0x5db3b8[_0x6da7('0x43')]=[{'all':!![]}];}return db[_0x6da7('0x2c')][_0x6da7('0x44')](_0x5db3b8);})[_0x6da7('0x24')](function(_0x4c2005){_0x20b875[_0x6da7('0x45')]=_0x4c2005;return _0x20b875;})[_0x6da7('0x24')](respondWithFilteredResult(_0x6f725a,_0x5db3b8))[_0x6da7('0x46')](handleError(_0x6f725a,null));};exports['show']=function(_0xd680f7,_0x4b4f36){var _0x388600={'raw':![],'where':{'id':_0xd680f7['params']['id']}},_0xb2b1f4={};_0xb2b1f4[_0x6da7('0x30')]=_['keys'](db[_0x6da7('0x2c')][_0x6da7('0x2d')]);_0xb2b1f4[_0x6da7('0x32')]=_[_0x6da7('0x47')](_0xd680f7[_0x6da7('0x32')]);_0xb2b1f4[_0x6da7('0x33')]=_[_0x6da7('0x34')](_0xb2b1f4[_0x6da7('0x30')],_0xb2b1f4['query']);_0x388600[_0x6da7('0x35')]=_[_0x6da7('0x34')](_0xb2b1f4[_0x6da7('0x30')],qs[_0x6da7('0x36')](_0xd680f7[_0x6da7('0x32')][_0x6da7('0x36')]));_0x388600[_0x6da7('0x35')]=_0x388600['attributes'][_0x6da7('0x37')]?_0x388600[_0x6da7('0x35')]:_0xb2b1f4[_0x6da7('0x30')];if(_0xd680f7['query']['includeAll']){_0x388600[_0x6da7('0x43')]=[{'all':!![]}];}_0x388600=_[_0x6da7('0x3f')]({},_0x388600,_0xd680f7[_0x6da7('0x41')]);return db[_0x6da7('0x2c')]['find'](_0x388600)[_0x6da7('0x24')](handleEntityNotFound(_0x4b4f36,null))[_0x6da7('0x24')](respondWithResult(_0x4b4f36,null))[_0x6da7('0x46')](handleError(_0x4b4f36,null));};exports['create']=function(_0x3b0b48,_0x45c29f){return db[_0x6da7('0x2c')][_0x6da7('0x48')](_0x3b0b48[_0x6da7('0x49')],{})['then'](respondWithResult(_0x45c29f,0xc9))['catch'](handleError(_0x45c29f,null));};exports[_0x6da7('0x23')]=function(_0xca3707,_0xd05055){if(_0xca3707[_0x6da7('0x49')]['id']){delete _0xca3707[_0x6da7('0x49')]['id'];}return db[_0x6da7('0x2c')]['find']({'where':{'id':_0xca3707[_0x6da7('0x4a')]['id']}})[_0x6da7('0x24')](handleEntityNotFound(_0xd05055,null))[_0x6da7('0x24')](saveUpdates(_0xca3707[_0x6da7('0x49')],null))[_0x6da7('0x24')](respondWithResult(_0xd05055,null))[_0x6da7('0x46')](handleError(_0xd05055,null));};exports[_0x6da7('0x25')]=function(_0x48f43c,_0x4ca879){return db[_0x6da7('0x2c')][_0x6da7('0x4b')]({'where':{'id':_0x48f43c[_0x6da7('0x4a')]['id']}})[_0x6da7('0x24')](handleEntityNotFound(_0x4ca879,null))[_0x6da7('0x24')](removeEntity(_0x4ca879,null))['catch'](handleError(_0x4ca879,null));};exports[_0x6da7('0x4c')]=function(_0x2b5485,_0xfa6e0f,_0x5ec5e0){var _0x139bf3={};var _0x22de8d={};var _0xbdd587;var _0x309cca;return db[_0x6da7('0x2c')][_0x6da7('0x4d')]({'where':{'id':_0x2b5485[_0x6da7('0x4a')]['id']}})[_0x6da7('0x24')](handleEntityNotFound(_0xfa6e0f,null))[_0x6da7('0x24')](function(_0x1265f8){if(_0x1265f8){_0xbdd587=_0x1265f8;_0x22de8d[_0x6da7('0x30')]=_[_0x6da7('0x47')](db[_0x6da7('0x4e')][_0x6da7('0x2d')]);_0x22de8d[_0x6da7('0x32')]=_[_0x6da7('0x47')](_0x2b5485[_0x6da7('0x32')]);_0x22de8d[_0x6da7('0x33')]=_['intersection'](_0x22de8d[_0x6da7('0x30')],_0x22de8d[_0x6da7('0x32')]);_0x139bf3[_0x6da7('0x35')]=_['intersection'](_0x22de8d[_0x6da7('0x30')],qs['fields'](_0x2b5485[_0x6da7('0x32')]['fields']));_0x139bf3[_0x6da7('0x35')]=_0x139bf3[_0x6da7('0x35')][_0x6da7('0x37')]?_0x139bf3['attributes']:_0x22de8d['model'];_0x139bf3[_0x6da7('0x3a')]=qs[_0x6da7('0x3b')](_0x2b5485['query'][_0x6da7('0x3b')]);_0x139bf3['where']=qs[_0x6da7('0x33')](_['pick'](_0x2b5485['query'],_0x22de8d[_0x6da7('0x33')]));if(_0x2b5485[_0x6da7('0x32')]['filter']){_0x139bf3[_0x6da7('0x3e')]=_[_0x6da7('0x3f')](_0x139bf3['where'],{'$or':_['map'](_0x139bf3[_0x6da7('0x35')],function(_0x5b5a0c){var _0x27eb53={};_0x27eb53[_0x5b5a0c]={'$like':'%'+_0x2b5485['query'][_0x6da7('0x3d')]+'%'};return _0x27eb53;})});}_0x139bf3=_[_0x6da7('0x3f')]({},_0x139bf3,_0x2b5485[_0x6da7('0x41')]);return _0xbdd587[_0x6da7('0x4c')](_0x139bf3);}})[_0x6da7('0x24')](function(_0x1e18d7){if(_0x1e18d7){_0x309cca=_0x1e18d7[_0x6da7('0x37')];if(!_0x2b5485[_0x6da7('0x32')][_0x6da7('0x38')](_0x6da7('0x39'))){_0x139bf3['limit']=qs[_0x6da7('0x1c')](_0x2b5485[_0x6da7('0x32')][_0x6da7('0x1c')]);_0x139bf3['offset']=qs[_0x6da7('0x1a')](_0x2b5485[_0x6da7('0x32')][_0x6da7('0x1a')]);}return _0xbdd587[_0x6da7('0x4c')](_0x139bf3);}})[_0x6da7('0x24')](function(_0xa46635){if(_0xa46635){return _0xa46635?{'count':_0x309cca,'rows':_0xa46635}:null;}})[_0x6da7('0x24')](respondWithResult(_0xfa6e0f,null))[_0x6da7('0x46')](handleError(_0xfa6e0f,null));};exports[_0x6da7('0x4f')]=function(_0x3d8119,_0x1fc63f,_0x2c3834){if(_0x3d8119[_0x6da7('0x49')]['id']){delete _0x3d8119['body']['id'];}return db[_0x6da7('0x2c')][_0x6da7('0x4d')]({'where':{'id':_0x3d8119[_0x6da7('0x4a')]['id']}})[_0x6da7('0x24')](handleEntityNotFound(_0x1fc63f,null))['then'](function(_0x4a7243){if(_0x4a7243){_0x3d8119['body']['AccountId']=_0x4a7243['id'];_0x3d8119[_0x6da7('0x49')]['Subjects']=integrations[_0x6da7('0x50')](_0x3d8119[_0x6da7('0x49')][_0x6da7('0x51')],_0x3d8119[_0x6da7('0x49')]['type']);_0x3d8119[_0x6da7('0x49')][_0x6da7('0x52')]=integrations[_0x6da7('0x53')](_0x3d8119['body'][_0x6da7('0x51')],_0x3d8119[_0x6da7('0x49')][_0x6da7('0x54')]);return db['VtigerConfiguration'][_0x6da7('0x48')](_0x3d8119[_0x6da7('0x49')],{'include':[{'model':db[_0x6da7('0x55')],'as':_0x6da7('0x56')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1fc63f,null))[_0x6da7('0x46')](handleError(_0x1fc63f,null));};var md5=require(_0x6da7('0x57'));exports[_0x6da7('0x58')]=function(_0x205846,_0x5e5825,_0x342c0d){var _0x1dccaa=null;var _0x278150=null;var _0x46ac0d=null;var _0x5628a0=null;var _0x53e93a='';return db[_0x6da7('0x2c')][_0x6da7('0x4d')]({'where':{'id':_0x205846[_0x6da7('0x4a')]['id']},'attributes':['id',_0x6da7('0x29'),'username',_0x6da7('0x59'),_0x6da7('0x5a'),_0x6da7('0x5b'),'serverUrl','accessKey']})[_0x6da7('0x24')](handleEntityNotFound(_0x5e5825,null))[_0x6da7('0x24')](function(_0x53b1f4){if(_0x53b1f4){_0x1dccaa=_0x53b1f4[_0x6da7('0x5c')];_0x278150=_0x53b1f4[_0x6da7('0x5d')];_0x46ac0d=_0x53b1f4[_0x6da7('0x5a')];_0x53e93a=_0x53b1f4[_0x6da7('0x5b')];var _0x327b9a=_0x53e93a[_0x6da7('0x5e')](-0x1);if(_0x327b9a==='/'){_0x53e93a=_0x53e93a[_0x6da7('0x5f')](0x0,_0x53e93a['lastIndexOf'](_0x327b9a));}_0x5628a0=util[_0x6da7('0x60')](_0x6da7('0x61'),_0x53e93a);var _0x16d1c3={'method':_0x6da7('0x62'),'uri':_0x5628a0,'qs':{'operation':_0x6da7('0x63'),'username':_0x53b1f4[_0x6da7('0x5c')]},'json':!![]};return rp(_0x16d1c3);}})[_0x6da7('0x24')](function(_0x4d254f){if(_0x4d254f['success']){var _0x48de56={'method':_0x6da7('0x64'),'uri':_0x5628a0,'form':{'operation':_0x6da7('0x65'),'username':_0x1dccaa,'accessKey':md5(_0x4d254f[_0x6da7('0x66')][_0x6da7('0x67')]+_0x278150)},'json':!![]};return rp(_0x48de56);}})['then'](function(_0x387869){if(_0x387869[_0x6da7('0x68')]){var _0x593875={'method':'GET','uri':_0x5628a0,'qs':{'operation':_0x6da7('0x69'),'username':_0x1dccaa,'sessionName':_0x387869[_0x6da7('0x66')]['sessionName'],'elementType':_0x46ac0d},'json':!![]};return rp(_0x593875);}})['then'](function(_0x544b8c){if(_0x544b8c[_0x6da7('0x68')]){var _0x49c056=[_0x6da7('0x6a'),_0x6da7('0x6b'),'owner'];_['remove'](_0x544b8c[_0x6da7('0x66')][_0x6da7('0x36')],function(_0x2f7ffa){return _0x49c056[_0x6da7('0x6c')](_0x2f7ffa[_0x6da7('0x54')][_0x6da7('0x29')]);});_[_0x6da7('0x6d')](_0x544b8c[_0x6da7('0x66')][_0x6da7('0x36')],function(_0x2e0680){return _0x2e0680[_0x6da7('0x6e')]===_0x6da7('0x6f');});return{'count':_0x544b8c[_0x6da7('0x66')]['fields']['length'],'rows':_[_0x6da7('0x31')](_0x544b8c[_0x6da7('0x66')][_0x6da7('0x36')],function(_0x3e46d9){return{'id':_0x3e46d9[_0x6da7('0x29')],'name':_0x3e46d9['label'],'custom':_[_0x6da7('0x70')](_0x3e46d9[_0x6da7('0x29')],'cf_')?!![]:![],'options':_0x3e46d9[_0x6da7('0x54')]['name']===_0x6da7('0x71')&&_0x3e46d9['type'][_0x6da7('0x72')][_0x6da7('0x37')]>0x0?_[_0x6da7('0x31')](_0x3e46d9['type'][_0x6da7('0x72')],function(_0x14c275){return{'name':_0x14c275[_0x6da7('0x73')],'value':_0x14c275[_0x6da7('0x74')]};}):[]};})};}})[_0x6da7('0x24')](respondWithResult(_0x5e5825,null))[_0x6da7('0x46')](function(_0x213289){console[_0x6da7('0x75')]('vTiger\x20error:\x20'+_0x213289);var _0x19fde0=_0x205846[_0x6da7('0x32')][_0x6da7('0x76')]?0x1f4:_0x213289[_0x6da7('0x77')]||0x1f4;logger[_0x6da7('0x27')](_0x6da7('0x78'),_0x6da7('0x58'),_0x19fde0,JSON[_0x6da7('0x79')](_0x213289));delete _0x213289[_0x6da7('0x29')];if(_0x19fde0===0x191){_0x19fde0=0x190;}_0x5e5825[_0x6da7('0x19')](_0x19fde0)[_0x6da7('0x2a')](_0x205846[_0x6da7('0x32')][_0x6da7('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x213289[_0x6da7('0x77')]}:_0x213289);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 566b20b..3659c0f 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 _0xe8bb=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','path'];(function(_0xe28899,_0x18cb5c){var _0x2639ec=function(_0x32ce8d){while(--_0x32ce8d){_0xe28899['push'](_0xe28899['shift']());}};_0x2639ec(++_0x18cb5c);}(_0xe8bb,0xfe));var _0xbe8b=function(_0x3d0bfe,_0x42e9ff){_0x3d0bfe=_0x3d0bfe-0x0;var _0x4cea77=_0xe8bb[_0x3d0bfe];return _0x4cea77;};'use strict';var _=require(_0xbe8b('0x0'));var util=require(_0xbe8b('0x1'));var logger=require(_0xbe8b('0x2'))(_0xbe8b('0x3'));var moment=require(_0xbe8b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe8b('0x5'));var rimraf=require(_0xbe8b('0x6'));var config=require(_0xbe8b('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xbe8b('0x8'));module[_0xbe8b('0x9')]=function(_0x583fe3,_0x9299d8){return _0x583fe3[_0xbe8b('0xa')](_0xbe8b('0xb'),attributes,{'tableName':_0xbe8b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc963=['define','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x3e32b4,_0x3e3856){var _0x1b5b1b=function(_0x55a66b){while(--_0x55a66b){_0x3e32b4['push'](_0x3e32b4['shift']());}};_0x1b5b1b(++_0x3e3856);}(_0xc963,0xab));var _0x3c96=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0xc963[_0x2c96f6];return _0x6d4808;};'use strict';var _=require(_0x3c96('0x0'));var util=require(_0x3c96('0x1'));var logger=require('../../config/logger')(_0x3c96('0x2'));var moment=require(_0x3c96('0x3'));var BPromise=require(_0x3c96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c96('0x5'));var rimraf=require('rimraf');var config=require(_0x3c96('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x3c96('0x7'));module[_0x3c96('0x8')]=function(_0x48c394,_0xe13b9c){return _0x48c394[_0x3c96('0x9')](_0x3c96('0xa'),attributes,{'tableName':_0x3c96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 6661909..e5c8b16 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 _0x9354=['catch','GetVtigerAccount','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowVtigerAccount','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x2549ae,_0x29da72){var _0x58e1a1=function(_0x79987e){while(--_0x79987e){_0x2549ae['push'](_0x2549ae['shift']());}};_0x58e1a1(++_0x29da72);}(_0x9354,0x96));var _0x4935=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x9354[_0x35c5a8];return _0x34782c;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e47bd,_0x118d36,_0x2d735e){return new BPromise(function(_0x10793e,_0x4c9902){return client[_0x4935('0xb')](_0x2e47bd,_0x2d735e)['then'](function(_0x2aac9a){logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));logger[_0x4935('0xf')](_0x4935('0x10'),_0x118d36,'request\x20sent',JSON['stringify'](_0x2aac9a));if(_0x2aac9a[_0x4935('0x11')]){if(_0x2aac9a['error']['code']===0x1f4){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x4c9902(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x10793e(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}else{logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));_0x10793e(_0x2aac9a[_0x4935('0x13')]['message']);}})[_0x4935('0x14')](function(_0x46526a){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x46526a);_0x4c9902(_0x46526a);});});}exports[_0x4935('0x15')]=function(_0x429ef3){var _0x4ebc63=this;return new Promise(function(_0xd70eff,_0x145277){return db['VtigerAccount'][_0x4935('0x16')]({'raw':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x429ef3['options']?_0x429ef3[_0x4935('0x17')][_0x4935('0x18')]||null:null,'attributes':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')][_0x4935('0x19')]||null:null,'limit':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')][_0x4935('0x1a')]||null:null,'include':_0x429ef3['options']?_0x429ef3[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x429ef3[_0x4935('0x17')][_0x4935('0x1b')],function(_0x53530f){return{'model':db[_0x53530f['model']],'as':_0x53530f['as'],'attributes':_0x53530f[_0x4935('0x19')],'include':_0x53530f[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x53530f[_0x4935('0x1b')],function(_0x344e51){return{'model':db[_0x344e51[_0x4935('0x1d')]],'as':_0x344e51['as'],'attributes':_0x344e51[_0x4935('0x19')],'include':_0x344e51[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x344e51[_0x4935('0x1b')],function(_0x1d08b5){return{'model':db[_0x1d08b5[_0x4935('0x1d')]],'as':_0x1d08b5['as'],'attributes':_0x1d08b5[_0x4935('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4935('0x1e')](function(_0x359522){logger['info']('GetVtigerAccount',_0x429ef3);logger['debug'](_0x4935('0x15'),_0x429ef3,JSON[_0x4935('0x1f')](_0x359522));_0xd70eff(_0x359522);})['catch'](function(_0x3f0707){logger[_0x4935('0x11')](_0x4935('0x15'),_0x3f0707[_0x4935('0x12')],_0x429ef3);_0x145277(_0x4ebc63[_0x4935('0x11')](0x1f4,_0x3f0707[_0x4935('0x12')]));});});};exports[_0x4935('0x20')]=function(_0x2fe6da){var _0x5b3c8e=this;return new Promise(function(_0xb7fe2a,_0x2dcb0b){return db['VtigerAccount']['find']({'raw':_0x2fe6da[_0x4935('0x17')]?_0x2fe6da['options'][_0x4935('0x21')]===undefined?!![]:![]:!![],'where':_0x2fe6da[_0x4935('0x17')]?_0x2fe6da[_0x4935('0x17')]['where']||null:null,'attributes':_0x2fe6da['options']?_0x2fe6da[_0x4935('0x17')][_0x4935('0x19')]||null:null,'include':_0x2fe6da['options']?_0x2fe6da[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x2fe6da[_0x4935('0x17')][_0x4935('0x1b')],function(_0x4a69bc){return{'model':db[_0x4a69bc['model']],'as':_0x4a69bc['as'],'attributes':_0x4a69bc[_0x4935('0x19')],'include':_0x4a69bc[_0x4935('0x1b')]?_['map'](_0x4a69bc['include'],function(_0xb3d934){return{'model':db[_0xb3d934['model']],'as':_0xb3d934['as'],'attributes':_0xb3d934[_0x4935('0x19')],'include':_0xb3d934[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0xb3d934[_0x4935('0x1b')],function(_0x1d77b8){return{'model':db[_0x1d77b8[_0x4935('0x1d')]],'as':_0x1d77b8['as'],'attributes':_0x1d77b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4935('0x1e')](function(_0x51b7ac){logger[_0x4935('0xc')]('ShowVtigerAccount',_0x2fe6da);logger[_0x4935('0xf')]('ShowVtigerAccount',_0x2fe6da,JSON[_0x4935('0x1f')](_0x51b7ac));_0xb7fe2a(_0x51b7ac);})[_0x4935('0x14')](function(_0x352679){logger[_0x4935('0x11')](_0x4935('0x20'),_0x352679[_0x4935('0x12')],_0x2fe6da);_0x2dcb0b(_0x5b3c8e[_0x4935('0x11')](0x1f4,_0x352679['message']));});});}; \ No newline at end of file +var _0x6c76=['findAll','options','raw','where','attributes','map','include','model','GetVtigerAccount','debug','ShowVtigerAccount','VtigerAccount','find','then','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2a7545,_0x184acc){var _0x1217f8=function(_0x5e52d0){while(--_0x5e52d0){_0x2a7545['push'](_0x2a7545['shift']());}};_0x1217f8(++_0x184acc);}(_0x6c76,0x184));var _0x66c7=function(_0x3a7f02,_0x41a19a){_0x3a7f02=_0x3a7f02-0x0;var _0x11badc=_0x6c76[_0x3a7f02];return _0x11badc;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});}exports['GetVtigerAccount']=function(_0x5129f6){var _0x8ad572=this;return new Promise(function(_0x19f29d,_0x47a299){return db['VtigerAccount'][_0x66c7('0x14')]({'raw':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x5129f6['options']?_0x5129f6['options'][_0x66c7('0x17')]||null:null,'attributes':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'limit':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['limit']||null:null,'include':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['include']?_[_0x66c7('0x19')](_0x5129f6[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fc9d3){return{'model':db[_0x1fc9d3['model']],'as':_0x1fc9d3['as'],'attributes':_0x1fc9d3[_0x66c7('0x18')],'include':_0x1fc9d3[_0x66c7('0x1a')]?_['map'](_0x1fc9d3[_0x66c7('0x1a')],function(_0x11a6b9){return{'model':db[_0x11a6b9[_0x66c7('0x1b')]],'as':_0x11a6b9['as'],'attributes':_0x11a6b9[_0x66c7('0x18')],'include':_0x11a6b9[_0x66c7('0x1a')]?_['map'](_0x11a6b9['include'],function(_0x4e514a){return{'model':db[_0x4e514a[_0x66c7('0x1b')]],'as':_0x4e514a['as'],'attributes':_0x4e514a[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9afd50){logger[_0x66c7('0xa')](_0x66c7('0x1c'),_0x5129f6);logger[_0x66c7('0x1d')](_0x66c7('0x1c'),_0x5129f6,JSON[_0x66c7('0xe')](_0x9afd50));_0x19f29d(_0x9afd50);})['catch'](function(_0xccefb2){logger[_0x66c7('0xf')](_0x66c7('0x1c'),_0xccefb2[_0x66c7('0x11')],_0x5129f6);_0x47a299(_0x8ad572[_0x66c7('0xf')](0x1f4,_0xccefb2['message']));});});};exports[_0x66c7('0x1e')]=function(_0x4f1a34){var _0xfbd97=this;return new Promise(function(_0x543fbf,_0x296875){return db[_0x66c7('0x1f')][_0x66c7('0x20')]({'raw':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x4f1a34['options']?_0x4f1a34['options'][_0x66c7('0x17')]||null:null,'attributes':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'include':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fd460){return{'model':db[_0x1fd460[_0x66c7('0x1b')]],'as':_0x1fd460['as'],'attributes':_0x1fd460['attributes'],'include':_0x1fd460['include']?_[_0x66c7('0x19')](_0x1fd460[_0x66c7('0x1a')],function(_0x367ad5){return{'model':db[_0x367ad5[_0x66c7('0x1b')]],'as':_0x367ad5['as'],'attributes':_0x367ad5[_0x66c7('0x18')],'include':_0x367ad5[_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x367ad5['include'],function(_0x30b90f){return{'model':db[_0x30b90f[_0x66c7('0x1b')]],'as':_0x30b90f['as'],'attributes':_0x30b90f[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x66c7('0x21')](function(_0x1e5993){logger[_0x66c7('0xa')](_0x66c7('0x1e'),_0x4f1a34);logger[_0x66c7('0x1d')](_0x66c7('0x1e'),_0x4f1a34,JSON[_0x66c7('0xe')](_0x1e5993));_0x543fbf(_0x1e5993);})[_0x66c7('0x13')](function(_0x4cd663){logger['error'](_0x66c7('0x1e'),_0x4cd663[_0x66c7('0x11')],_0x4f1a34);_0x296875(_0xfbd97[_0x66c7('0xf')](0x1f4,_0x4cd663['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 5ba2f63..3cdc00d 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 _0x8fa4=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','post','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x578e0d,_0x3af1d0){var _0x2bcb45=function(_0x52e20e){while(--_0x52e20e){_0x578e0d['push'](_0x578e0d['shift']());}};_0x2bcb45(++_0x3af1d0);}(_0x8fa4,0x177));var _0x48fa=function(_0x1e1625,_0x25bece){_0x1e1625=_0x1e1625-0x0;var _0x506714=_0x8fa4[_0x1e1625];return _0x506714;};'use strict';var multer=require(_0x48fa('0x0'));var util=require(_0x48fa('0x1'));var path=require(_0x48fa('0x2'));var timeout=require(_0x48fa('0x3'));var express=require('express');var router=express[_0x48fa('0x4')]();var fs_extra=require(_0x48fa('0x5'));var auth=require(_0x48fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x48fa('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x48fa('0x8')]('/',auth[_0x48fa('0x9')](),controller['index']);router[_0x48fa('0x8')]('/:id',auth[_0x48fa('0x9')](),controller[_0x48fa('0xa')]);router[_0x48fa('0x8')](_0x48fa('0xb'),auth[_0x48fa('0x9')](),controller['getFields']);router[_0x48fa('0x8')](_0x48fa('0xc'),auth[_0x48fa('0x9')](),controller[_0x48fa('0xd')]);router[_0x48fa('0x8')]('/:id/descriptions',auth[_0x48fa('0x9')](),controller['getDescriptions']);router[_0x48fa('0xe')]('/',auth[_0x48fa('0x9')](),controller[_0x48fa('0xf')]);router[_0x48fa('0x10')](_0x48fa('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x48fa('0x12')]('/:id',auth[_0x48fa('0x9')](),controller[_0x48fa('0x13')]);module[_0x48fa('0x14')]=router; \ No newline at end of file +var _0x3e69=['getDescriptions','create','put','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x3e69,0x1ab));var _0x93e6=function(_0x12a020,_0x85b476){_0x12a020=_0x12a020-0x0;var _0x63cddd=_0x3e69[_0x12a020];return _0x63cddd;};'use strict';var multer=require(_0x93e6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x93e6('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x93e6('0x2'));var interaction=require(_0x93e6('0x3'));var config=require('../../config/environment');var controller=require(_0x93e6('0x4'));router[_0x93e6('0x5')]('/',auth[_0x93e6('0x6')](),controller['index']);router[_0x93e6('0x5')](_0x93e6('0x7'),auth[_0x93e6('0x6')](),controller[_0x93e6('0x8')]);router[_0x93e6('0x5')](_0x93e6('0x9'),auth['isAuthenticated'](),controller[_0x93e6('0xa')]);router[_0x93e6('0x5')](_0x93e6('0xb'),auth[_0x93e6('0x6')](),controller[_0x93e6('0xc')]);router[_0x93e6('0x5')](_0x93e6('0xd'),auth['isAuthenticated'](),controller[_0x93e6('0xe')]);router['post']('/',auth[_0x93e6('0x6')](),controller[_0x93e6('0xf')]);router[_0x93e6('0x10')](_0x93e6('0x7'),auth['isAuthenticated'](),controller[_0x93e6('0x11')]);router[_0x93e6('0x12')](_0x93e6('0x7'),auth[_0x93e6('0x6')](),controller[_0x93e6('0x13')]);module[_0x93e6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index e9bb8d9..0b40ce9 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 _0xd0e3=['STRING','exports'];(function(_0x156515,_0x760da4){var _0x3e1e8b=function(_0x23970a){while(--_0x23970a){_0x156515['push'](_0x156515['shift']());}};_0x3e1e8b(++_0x760da4);}(_0xd0e3,0xd9));var _0x3d0e=function(_0x10da90,_0x4fcd65){_0x10da90=_0x10da90-0x0;var _0x533962=_0xd0e3[_0x10da90];return _0x533962;};'use strict';var Sequelize=require('sequelize');module[_0x3d0e('0x0')]={'name':{'type':Sequelize[_0x3d0e('0x1')]},'description':{'type':Sequelize[_0x3d0e('0x1')]}}; \ No newline at end of file +var _0xa8b0=['STRING'];(function(_0x2a2674,_0x308160){var _0x42c11f=function(_0x2cda1a){while(--_0x2cda1a){_0x2a2674['push'](_0x2a2674['shift']());}};_0x42c11f(++_0x308160);}(_0xa8b0,0x11e));var _0x0a8b=function(_0x1162f9,_0x35f87c){_0x1162f9=_0x1162f9-0x0;var _0x75257c=_0xa8b0[_0x1162f9];return _0x75257c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0a8b('0x0')]},'description':{'type':Sequelize[_0x0a8b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d3a6d62..efc6352 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 _0x4eca=['create','body','update','params','findOne','VtigerField','order','merge','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','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','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','save','then','destroy','end','error','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch'];(function(_0x517a7c,_0x508b9e){var _0x354b27=function(_0x44b32b){while(--_0x44b32b){_0x517a7c['push'](_0x517a7c['shift']());}};_0x354b27(++_0x508b9e);}(_0x4eca,0xab));var _0xa4ec=function(_0x15ca41,_0x3429d0){_0x15ca41=_0x15ca41-0x0;var _0x3cecb4=_0x4eca[_0x15ca41];return _0x3cecb4;};'use strict';var emlformat=require(_0xa4ec('0x0'));var rimraf=require(_0xa4ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4ec('0x2'));var rp=require(_0xa4ec('0x3'));var moment=require(_0xa4ec('0x4'));var BPromise=require(_0xa4ec('0x5'));var Mustache=require('mustache');var util=require(_0xa4ec('0x6'));var path=require(_0xa4ec('0x7'));var sox=require(_0xa4ec('0x8'));var csv=require(_0xa4ec('0x9'));var ejs=require(_0xa4ec('0xa'));var fs=require('fs');var fs_extra=require(_0xa4ec('0xb'));var _=require('lodash');var squel=require(_0xa4ec('0xc'));var crypto=require('crypto');var jsforce=require(_0xa4ec('0xd'));var deskjs=require(_0xa4ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa4ec('0xf'));var Papa=require(_0xa4ec('0x10'));var Redis=require(_0xa4ec('0x11'));var authService=require(_0xa4ec('0x12'));var qs=require(_0xa4ec('0x13'));var as=require(_0xa4ec('0x14'));var hardwareService=require(_0xa4ec('0x15'));var logger=require('../../config/logger')(_0xa4ec('0x16'));var utils=require('../../config/utils');var config=require(_0xa4ec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4ec('0x18'))['db'];function respondWithStatusCode(_0x4edb4b,_0x1d279b){_0x1d279b=_0x1d279b||0xcc;return function(_0x46a855){if(_0x46a855){return _0x4edb4b['sendStatus'](_0x1d279b);}return _0x4edb4b[_0xa4ec('0x19')](_0x1d279b)['end']();};}function respondWithResult(_0x5172ea,_0x3b57ff){_0x3b57ff=_0x3b57ff||0xc8;return function(_0x606a18){if(_0x606a18){return _0x5172ea['status'](_0x3b57ff)[_0xa4ec('0x1a')](_0x606a18);}};}function respondWithFilteredResult(_0x3a8174,_0x31de8d){return function(_0x297e86){if(_0x297e86){var _0xeca077=typeof _0x31de8d['offset']===_0xa4ec('0x1b')&&typeof _0x31de8d[_0xa4ec('0x1c')]==='undefined';var _0x1e8157=_0x297e86[_0xa4ec('0x1d')];var _0x4681b3=_0xeca077?0x0:_0x31de8d['offset'];var _0x444d2e=_0xeca077?_0x297e86[_0xa4ec('0x1d')]:_0x31de8d[_0xa4ec('0x1e')]+_0x31de8d[_0xa4ec('0x1c')];var _0x47e497;if(_0x444d2e>=_0x1e8157){_0x444d2e=_0x1e8157;_0x47e497=0xc8;}else{_0x47e497=0xce;}_0x3a8174[_0xa4ec('0x19')](_0x47e497);return _0x3a8174[_0xa4ec('0x1f')]('Content-Range',_0x4681b3+'-'+_0x444d2e+'/'+_0x1e8157)[_0xa4ec('0x1a')](_0x297e86);}return null;};}function patchUpdates(_0x33bda7){return function(_0x132274){try{jsonpatch[_0xa4ec('0x20')](_0x132274,_0x33bda7,!![]);}catch(_0x25200a){return BPromise['reject'](_0x25200a);}return _0x132274[_0xa4ec('0x21')]();};}function saveUpdates(_0x3f3777,_0x1fad06){return function(_0x490df9){if(_0x490df9){return _0x490df9['update'](_0x3f3777)[_0xa4ec('0x22')](function(_0x36a65a){return _0x36a65a;});}return null;};}function removeEntity(_0x51784c,_0x29a211){return function(_0x1faa9f){if(_0x1faa9f){return _0x1faa9f[_0xa4ec('0x23')]()[_0xa4ec('0x22')](function(){_0x51784c[_0xa4ec('0x19')](0xcc)[_0xa4ec('0x24')]();});}};}function handleEntityNotFound(_0x260c92,_0x15d563){return function(_0x1178f2){if(!_0x1178f2){_0x260c92['sendStatus'](0x194);}return _0x1178f2;};}function handleError(_0x417b02,_0x47888d){_0x47888d=_0x47888d||0x1f4;return function(_0x587bfa){logger[_0xa4ec('0x25')](_0x587bfa['stack']);if(_0x587bfa['name']){delete _0x587bfa[_0xa4ec('0x26')];}_0x417b02[_0xa4ec('0x19')](_0x47888d)[_0xa4ec('0x27')](_0x587bfa);};}exports[_0xa4ec('0x28')]=function(_0x3dd9da,_0x58e01a){var _0x113792={},_0x5ee1b7={},_0x24adc0={'count':0x0,'rows':[]};var _0x1602e0=_[_0xa4ec('0x29')](db[_0xa4ec('0x2a')][_0xa4ec('0x2b')],function(_0x3b4e31){return{'name':_0x3b4e31['fieldName'],'type':_0x3b4e31[_0xa4ec('0x2c')][_0xa4ec('0x2d')]};});_0x5ee1b7[_0xa4ec('0x2e')]=_[_0xa4ec('0x29')](_0x1602e0,'name');_0x5ee1b7[_0xa4ec('0x2f')]=_['keys'](_0x3dd9da[_0xa4ec('0x2f')]);_0x5ee1b7['filters']=_['intersection'](_0x5ee1b7[_0xa4ec('0x2e')],_0x5ee1b7['query']);_0x113792[_0xa4ec('0x30')]=_[_0xa4ec('0x31')](_0x5ee1b7[_0xa4ec('0x2e')],qs[_0xa4ec('0x32')](_0x3dd9da[_0xa4ec('0x2f')][_0xa4ec('0x32')]));_0x113792[_0xa4ec('0x30')]=_0x113792[_0xa4ec('0x30')][_0xa4ec('0x33')]?_0x113792[_0xa4ec('0x30')]:_0x5ee1b7['model'];if(!_0x3dd9da['query'][_0xa4ec('0x34')](_0xa4ec('0x35'))){_0x113792[_0xa4ec('0x1c')]=qs[_0xa4ec('0x1c')](_0x3dd9da[_0xa4ec('0x2f')][_0xa4ec('0x1c')]);_0x113792['offset']=qs[_0xa4ec('0x1e')](_0x3dd9da['query'][_0xa4ec('0x1e')]);}_0x113792['order']=qs['sort'](_0x3dd9da['query'][_0xa4ec('0x36')]);_0x113792[_0xa4ec('0x37')]=qs[_0xa4ec('0x38')](_[_0xa4ec('0x39')](_0x3dd9da[_0xa4ec('0x2f')],_0x5ee1b7[_0xa4ec('0x38')]),_0x1602e0);if(_0x3dd9da[_0xa4ec('0x2f')][_0xa4ec('0x3a')]){_0x113792['where']=_['merge'](_0x113792[_0xa4ec('0x37')],{'$or':_['map'](_0x1602e0,function(_0x2383c1){if(_0x2383c1['type']!==_0xa4ec('0x3b')){var _0x573b45={};_0x573b45[_0x2383c1[_0xa4ec('0x26')]]={'$like':'%'+_0x3dd9da[_0xa4ec('0x2f')][_0xa4ec('0x3a')]+'%'};return _0x573b45;}})});}_0x113792=_['merge']({},_0x113792,_0x3dd9da[_0xa4ec('0x3c')]);var _0x44012b={'where':_0x113792[_0xa4ec('0x37')]};return db['VtigerConfiguration'][_0xa4ec('0x1d')](_0x44012b)['then'](function(_0x554a99){_0x24adc0[_0xa4ec('0x1d')]=_0x554a99;if(_0x3dd9da['query'][_0xa4ec('0x3d')]){_0x113792[_0xa4ec('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xa4ec('0x3f')](_0x113792);})[_0xa4ec('0x22')](function(_0x282422){_0x24adc0[_0xa4ec('0x40')]=_0x282422;return _0x24adc0;})[_0xa4ec('0x22')](respondWithFilteredResult(_0x58e01a,_0x113792))['catch'](handleError(_0x58e01a,null));};exports[_0xa4ec('0x41')]=function(_0x344bed,_0x1d86f9){var _0x5bde3d={'raw':![],'where':{'id':_0x344bed['params']['id']}},_0x3ab48d={};_0x3ab48d[_0xa4ec('0x2e')]=_[_0xa4ec('0x42')](db['VtigerConfiguration'][_0xa4ec('0x2b')]);_0x3ab48d[_0xa4ec('0x2f')]=_[_0xa4ec('0x42')](_0x344bed[_0xa4ec('0x2f')]);_0x3ab48d['filters']=_[_0xa4ec('0x31')](_0x3ab48d[_0xa4ec('0x2e')],_0x3ab48d[_0xa4ec('0x2f')]);_0x5bde3d[_0xa4ec('0x30')]=_[_0xa4ec('0x31')](_0x3ab48d[_0xa4ec('0x2e')],qs[_0xa4ec('0x32')](_0x344bed[_0xa4ec('0x2f')][_0xa4ec('0x32')]));_0x5bde3d[_0xa4ec('0x30')]=_0x5bde3d[_0xa4ec('0x30')][_0xa4ec('0x33')]?_0x5bde3d[_0xa4ec('0x30')]:_0x3ab48d[_0xa4ec('0x2e')];if(_0x344bed[_0xa4ec('0x2f')]['includeAll']){_0x5bde3d[_0xa4ec('0x3e')]=[{'all':!![]}];}_0x5bde3d=_['merge']({},_0x5bde3d,_0x344bed['options']);return db[_0xa4ec('0x2a')][_0xa4ec('0x43')](_0x5bde3d)[_0xa4ec('0x22')](handleEntityNotFound(_0x1d86f9,null))[_0xa4ec('0x22')](respondWithResult(_0x1d86f9,null))[_0xa4ec('0x44')](handleError(_0x1d86f9,null));};exports[_0xa4ec('0x45')]=function(_0x21ca88,_0x538ab8){return db[_0xa4ec('0x2a')][_0xa4ec('0x45')](_0x21ca88[_0xa4ec('0x46')],{})[_0xa4ec('0x22')](respondWithResult(_0x538ab8,0xc9))[_0xa4ec('0x44')](handleError(_0x538ab8,null));};exports[_0xa4ec('0x47')]=function(_0x5da120,_0x533b6c){if(_0x5da120[_0xa4ec('0x46')]['id']){delete _0x5da120[_0xa4ec('0x46')]['id'];}return db[_0xa4ec('0x2a')][_0xa4ec('0x43')]({'where':{'id':_0x5da120[_0xa4ec('0x48')]['id']}})[_0xa4ec('0x22')](handleEntityNotFound(_0x533b6c,null))[_0xa4ec('0x22')](saveUpdates(_0x5da120['body'],null))[_0xa4ec('0x22')](respondWithResult(_0x533b6c,null))[_0xa4ec('0x44')](handleError(_0x533b6c,null));};exports[_0xa4ec('0x23')]=function(_0x55e024,_0x3dc24b){return db[_0xa4ec('0x2a')][_0xa4ec('0x43')]({'where':{'id':_0x55e024[_0xa4ec('0x48')]['id']}})[_0xa4ec('0x22')](handleEntityNotFound(_0x3dc24b,null))[_0xa4ec('0x22')](removeEntity(_0x3dc24b,null))[_0xa4ec('0x44')](handleError(_0x3dc24b,null));};exports['getFields']=function(_0x2e24ab,_0x1d2140,_0x4ebc47){var _0x17db00={};var _0x3dcb5b={};var _0xe67b85;var _0x717e1a;return db['VtigerConfiguration'][_0xa4ec('0x49')]({'where':{'id':_0x2e24ab[_0xa4ec('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d2140,null))[_0xa4ec('0x22')](function(_0x4f82a2){if(_0x4f82a2){_0xe67b85=_0x4f82a2;_0x3dcb5b[_0xa4ec('0x2e')]=_[_0xa4ec('0x42')](db[_0xa4ec('0x4a')][_0xa4ec('0x2b')]);_0x3dcb5b[_0xa4ec('0x2f')]=_[_0xa4ec('0x42')](_0x2e24ab[_0xa4ec('0x2f')]);_0x3dcb5b[_0xa4ec('0x38')]=_[_0xa4ec('0x31')](_0x3dcb5b['model'],_0x3dcb5b['query']);_0x17db00[_0xa4ec('0x30')]=_['intersection'](_0x3dcb5b[_0xa4ec('0x2e')],qs[_0xa4ec('0x32')](_0x2e24ab['query'][_0xa4ec('0x32')]));_0x17db00[_0xa4ec('0x30')]=_0x17db00[_0xa4ec('0x30')][_0xa4ec('0x33')]?_0x17db00['attributes']:_0x3dcb5b[_0xa4ec('0x2e')];_0x17db00[_0xa4ec('0x4b')]=qs[_0xa4ec('0x36')](_0x2e24ab['query'][_0xa4ec('0x36')]);_0x17db00[_0xa4ec('0x37')]=qs[_0xa4ec('0x38')](_[_0xa4ec('0x39')](_0x2e24ab[_0xa4ec('0x2f')],_0x3dcb5b[_0xa4ec('0x38')]));if(_0x2e24ab[_0xa4ec('0x2f')][_0xa4ec('0x3a')]){_0x17db00[_0xa4ec('0x37')]=_[_0xa4ec('0x4c')](_0x17db00[_0xa4ec('0x37')],{'$or':_['map'](_0x17db00['attributes'],function(_0x3c0318){var _0x49c460={};_0x49c460[_0x3c0318]={'$like':'%'+_0x2e24ab[_0xa4ec('0x2f')]['filter']+'%'};return _0x49c460;})});}_0x17db00=_[_0xa4ec('0x4c')]({},_0x17db00,_0x2e24ab[_0xa4ec('0x3c')]);return _0xe67b85[_0xa4ec('0x4d')](_0x17db00);}})['then'](function(_0x217981){if(_0x217981){_0x717e1a=_0x217981[_0xa4ec('0x33')];if(!_0x2e24ab[_0xa4ec('0x2f')]['hasOwnProperty']('nolimit')){_0x17db00[_0xa4ec('0x1c')]=qs[_0xa4ec('0x1c')](_0x2e24ab[_0xa4ec('0x2f')][_0xa4ec('0x1c')]);_0x17db00[_0xa4ec('0x1e')]=qs[_0xa4ec('0x1e')](_0x2e24ab[_0xa4ec('0x2f')][_0xa4ec('0x1e')]);}return _0xe67b85['getFields'](_0x17db00);}})[_0xa4ec('0x22')](function(_0x316401){if(_0x316401){return _0x316401?{'count':_0x717e1a,'rows':_0x316401}:null;}})['then'](respondWithResult(_0x1d2140,null))[_0xa4ec('0x44')](handleError(_0x1d2140,null));};exports[_0xa4ec('0x4e')]=function(_0x38e78c,_0x39bf8e,_0x3e381b){var _0x587e73={};var _0x111697={};var _0x30aa2f;var _0x51bd80;return db[_0xa4ec('0x2a')][_0xa4ec('0x49')]({'where':{'id':_0x38e78c[_0xa4ec('0x48')]['id']}})[_0xa4ec('0x22')](handleEntityNotFound(_0x39bf8e,null))[_0xa4ec('0x22')](function(_0x12e740){if(_0x12e740){_0x30aa2f=_0x12e740;_0x111697[_0xa4ec('0x2e')]=_[_0xa4ec('0x42')](db[_0xa4ec('0x4a')][_0xa4ec('0x2b')]);_0x111697[_0xa4ec('0x2f')]=_[_0xa4ec('0x42')](_0x38e78c['query']);_0x111697[_0xa4ec('0x38')]=_[_0xa4ec('0x31')](_0x111697[_0xa4ec('0x2e')],_0x111697[_0xa4ec('0x2f')]);_0x587e73['attributes']=_[_0xa4ec('0x31')](_0x111697[_0xa4ec('0x2e')],qs[_0xa4ec('0x32')](_0x38e78c[_0xa4ec('0x2f')][_0xa4ec('0x32')]));_0x587e73[_0xa4ec('0x30')]=_0x587e73[_0xa4ec('0x30')]['length']?_0x587e73[_0xa4ec('0x30')]:_0x111697['model'];_0x587e73[_0xa4ec('0x4b')]=qs['sort'](_0x38e78c[_0xa4ec('0x2f')]['sort']);_0x587e73[_0xa4ec('0x37')]=qs[_0xa4ec('0x38')](_['pick'](_0x38e78c['query'],_0x111697['filters']));if(_0x38e78c['query'][_0xa4ec('0x3a')]){_0x587e73[_0xa4ec('0x37')]=_[_0xa4ec('0x4c')](_0x587e73['where'],{'$or':_[_0xa4ec('0x29')](_0x587e73[_0xa4ec('0x30')],function(_0x5d3775){var _0x10d77b={};_0x10d77b[_0x5d3775]={'$like':'%'+_0x38e78c[_0xa4ec('0x2f')][_0xa4ec('0x3a')]+'%'};return _0x10d77b;})});}_0x587e73=_[_0xa4ec('0x4c')]({},_0x587e73,_0x38e78c[_0xa4ec('0x3c')]);return _0x30aa2f[_0xa4ec('0x4e')](_0x587e73);}})[_0xa4ec('0x22')](function(_0x3c2110){if(_0x3c2110){_0x51bd80=_0x3c2110[_0xa4ec('0x33')];if(!_0x38e78c[_0xa4ec('0x2f')][_0xa4ec('0x34')]('nolimit')){_0x587e73[_0xa4ec('0x1c')]=qs['limit'](_0x38e78c[_0xa4ec('0x2f')]['limit']);_0x587e73[_0xa4ec('0x1e')]=qs[_0xa4ec('0x1e')](_0x38e78c['query'][_0xa4ec('0x1e')]);}return _0x30aa2f[_0xa4ec('0x4e')](_0x587e73);}})['then'](function(_0x4dede4){if(_0x4dede4){return _0x4dede4?{'count':_0x51bd80,'rows':_0x4dede4}:null;}})[_0xa4ec('0x22')](respondWithResult(_0x39bf8e,null))[_0xa4ec('0x44')](handleError(_0x39bf8e,null));};exports[_0xa4ec('0x4f')]=function(_0x575b5c,_0x2397e2,_0x2218d5){var _0x4f4e71={};var _0x32de6f={};var _0x17f6ed;var _0x14737d;return db['VtigerConfiguration'][_0xa4ec('0x49')]({'where':{'id':_0x575b5c[_0xa4ec('0x48')]['id']}})[_0xa4ec('0x22')](handleEntityNotFound(_0x2397e2,null))[_0xa4ec('0x22')](function(_0x1d0c73){if(_0x1d0c73){_0x17f6ed=_0x1d0c73;_0x32de6f[_0xa4ec('0x2e')]=_['keys'](db[_0xa4ec('0x4a')]['rawAttributes']);_0x32de6f['query']=_[_0xa4ec('0x42')](_0x575b5c[_0xa4ec('0x2f')]);_0x32de6f[_0xa4ec('0x38')]=_['intersection'](_0x32de6f[_0xa4ec('0x2e')],_0x32de6f['query']);_0x4f4e71['attributes']=_[_0xa4ec('0x31')](_0x32de6f[_0xa4ec('0x2e')],qs['fields'](_0x575b5c[_0xa4ec('0x2f')][_0xa4ec('0x32')]));_0x4f4e71['attributes']=_0x4f4e71['attributes'][_0xa4ec('0x33')]?_0x4f4e71[_0xa4ec('0x30')]:_0x32de6f[_0xa4ec('0x2e')];_0x4f4e71[_0xa4ec('0x4b')]=qs[_0xa4ec('0x36')](_0x575b5c[_0xa4ec('0x2f')]['sort']);_0x4f4e71['where']=qs[_0xa4ec('0x38')](_[_0xa4ec('0x39')](_0x575b5c[_0xa4ec('0x2f')],_0x32de6f[_0xa4ec('0x38')]));if(_0x575b5c['query'][_0xa4ec('0x3a')]){_0x4f4e71[_0xa4ec('0x37')]=_['merge'](_0x4f4e71[_0xa4ec('0x37')],{'$or':_['map'](_0x4f4e71[_0xa4ec('0x30')],function(_0x417c77){var _0x44319a={};_0x44319a[_0x417c77]={'$like':'%'+_0x575b5c['query'][_0xa4ec('0x3a')]+'%'};return _0x44319a;})});}_0x4f4e71=_['merge']({},_0x4f4e71,_0x575b5c['options']);return _0x17f6ed[_0xa4ec('0x4f')](_0x4f4e71);}})[_0xa4ec('0x22')](function(_0x78a826){if(_0x78a826){_0x14737d=_0x78a826[_0xa4ec('0x33')];if(!_0x575b5c[_0xa4ec('0x2f')][_0xa4ec('0x34')](_0xa4ec('0x35'))){_0x4f4e71[_0xa4ec('0x1c')]=qs[_0xa4ec('0x1c')](_0x575b5c['query']['limit']);_0x4f4e71[_0xa4ec('0x1e')]=qs['offset'](_0x575b5c[_0xa4ec('0x2f')][_0xa4ec('0x1e')]);}return _0x17f6ed['getDescriptions'](_0x4f4e71);}})[_0xa4ec('0x22')](function(_0x43eba6){if(_0x43eba6){return _0x43eba6?{'count':_0x14737d,'rows':_0x43eba6}:null;}})[_0xa4ec('0x22')](respondWithResult(_0x2397e2,null))[_0xa4ec('0x44')](handleError(_0x2397e2,null));}; \ No newline at end of file +var _0x02ba=['sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','VtigerField','order','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','save','update','then','end','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xaa8eb4,_0x21bef7){var _0x30e951=function(_0x195d43){while(--_0x195d43){_0xaa8eb4['push'](_0xaa8eb4['shift']());}};_0x30e951(++_0x21bef7);}(_0x02ba,0xaf));var _0xa02b=function(_0x2cfa8e,_0x4e926f){_0x2cfa8e=_0x2cfa8e-0x0;var _0x33f4fc=_0x02ba[_0x2cfa8e];return _0x33f4fc;};'use strict';var emlformat=require(_0xa02b('0x0'));var rimraf=require(_0xa02b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa02b('0x2'));var rp=require(_0xa02b('0x3'));var moment=require(_0xa02b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa02b('0x5'));var util=require('util');var path=require(_0xa02b('0x6'));var sox=require(_0xa02b('0x7'));var csv=require(_0xa02b('0x8'));var ejs=require(_0xa02b('0x9'));var fs=require('fs');var fs_extra=require(_0xa02b('0xa'));var _=require('lodash');var squel=require(_0xa02b('0xb'));var crypto=require('crypto');var jsforce=require(_0xa02b('0xc'));var deskjs=require(_0xa02b('0xd'));var toCsv=require(_0xa02b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa02b('0xe'));var authService=require(_0xa02b('0xf'));var qs=require(_0xa02b('0x10'));var as=require(_0xa02b('0x11'));var hardwareService=require(_0xa02b('0x12'));var logger=require(_0xa02b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa02b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa02b('0x15'))['db'];function respondWithStatusCode(_0x36a943,_0x397331){_0x397331=_0x397331||0xcc;return function(_0x4cdec7){if(_0x4cdec7){return _0x36a943['sendStatus'](_0x397331);}return _0x36a943[_0xa02b('0x16')](_0x397331)['end']();};}function respondWithResult(_0x198d1b,_0x3ae1ca){_0x3ae1ca=_0x3ae1ca||0xc8;return function(_0x58e651){if(_0x58e651){return _0x198d1b['status'](_0x3ae1ca)['json'](_0x58e651);}};}function respondWithFilteredResult(_0x928c21,_0x3bc99a){return function(_0x171bed){if(_0x171bed){var _0x8fd113=typeof _0x3bc99a[_0xa02b('0x17')]===_0xa02b('0x18')&&typeof _0x3bc99a[_0xa02b('0x19')]===_0xa02b('0x18');var _0x1dadf9=_0x171bed[_0xa02b('0x1a')];var _0x258993=_0x8fd113?0x0:_0x3bc99a['offset'];var _0x1e2eda=_0x8fd113?_0x171bed['count']:_0x3bc99a[_0xa02b('0x17')]+_0x3bc99a[_0xa02b('0x19')];var _0x461f0c;if(_0x1e2eda>=_0x1dadf9){_0x1e2eda=_0x1dadf9;_0x461f0c=0xc8;}else{_0x461f0c=0xce;}_0x928c21[_0xa02b('0x16')](_0x461f0c);return _0x928c21['set'](_0xa02b('0x1b'),_0x258993+'-'+_0x1e2eda+'/'+_0x1dadf9)[_0xa02b('0x1c')](_0x171bed);}return null;};}function patchUpdates(_0x565c33){return function(_0x5b6a01){try{jsonpatch['apply'](_0x5b6a01,_0x565c33,!![]);}catch(_0x713d68){return BPromise['reject'](_0x713d68);}return _0x5b6a01[_0xa02b('0x1d')]();};}function saveUpdates(_0x3280a8,_0x5e984e){return function(_0x37ae7e){if(_0x37ae7e){return _0x37ae7e[_0xa02b('0x1e')](_0x3280a8)[_0xa02b('0x1f')](function(_0x2f1831){return _0x2f1831;});}return null;};}function removeEntity(_0x5bcc3a,_0x51d9ff){return function(_0x47f808){if(_0x47f808){return _0x47f808['destroy']()[_0xa02b('0x1f')](function(){_0x5bcc3a[_0xa02b('0x16')](0xcc)[_0xa02b('0x20')]();});}};}function handleEntityNotFound(_0x19570c,_0x30f894){return function(_0x2f625f){if(!_0x2f625f){_0x19570c['sendStatus'](0x194);}return _0x2f625f;};}function handleError(_0x2a09b4,_0x31ccca){_0x31ccca=_0x31ccca||0x1f4;return function(_0x2b8e63){logger[_0xa02b('0x21')](_0x2b8e63[_0xa02b('0x22')]);if(_0x2b8e63['name']){delete _0x2b8e63[_0xa02b('0x23')];}_0x2a09b4[_0xa02b('0x16')](_0x31ccca)[_0xa02b('0x24')](_0x2b8e63);};}exports[_0xa02b('0x25')]=function(_0x3db381,_0x5c5017){var _0x53aacb={},_0x3757cf={},_0x13a19d={'count':0x0,'rows':[]};var _0x2e0311=_[_0xa02b('0x26')](db[_0xa02b('0x27')][_0xa02b('0x28')],function(_0x273453){return{'name':_0x273453[_0xa02b('0x29')],'type':_0x273453[_0xa02b('0x2a')][_0xa02b('0x2b')]};});_0x3757cf[_0xa02b('0x2c')]=_[_0xa02b('0x26')](_0x2e0311,_0xa02b('0x23'));_0x3757cf[_0xa02b('0x2d')]=_[_0xa02b('0x2e')](_0x3db381[_0xa02b('0x2d')]);_0x3757cf['filters']=_[_0xa02b('0x2f')](_0x3757cf[_0xa02b('0x2c')],_0x3757cf['query']);_0x53aacb[_0xa02b('0x30')]=_[_0xa02b('0x2f')](_0x3757cf[_0xa02b('0x2c')],qs[_0xa02b('0x31')](_0x3db381['query']['fields']));_0x53aacb[_0xa02b('0x30')]=_0x53aacb[_0xa02b('0x30')][_0xa02b('0x32')]?_0x53aacb[_0xa02b('0x30')]:_0x3757cf[_0xa02b('0x2c')];if(!_0x3db381[_0xa02b('0x2d')][_0xa02b('0x33')](_0xa02b('0x34'))){_0x53aacb[_0xa02b('0x19')]=qs[_0xa02b('0x19')](_0x3db381[_0xa02b('0x2d')]['limit']);_0x53aacb[_0xa02b('0x17')]=qs['offset'](_0x3db381[_0xa02b('0x2d')]['offset']);}_0x53aacb['order']=qs[_0xa02b('0x35')](_0x3db381[_0xa02b('0x2d')]['sort']);_0x53aacb[_0xa02b('0x36')]=qs[_0xa02b('0x37')](_['pick'](_0x3db381[_0xa02b('0x2d')],_0x3757cf['filters']),_0x2e0311);if(_0x3db381[_0xa02b('0x2d')][_0xa02b('0x38')]){_0x53aacb[_0xa02b('0x36')]=_[_0xa02b('0x39')](_0x53aacb[_0xa02b('0x36')],{'$or':_['map'](_0x2e0311,function(_0x59f15c){if(_0x59f15c[_0xa02b('0x2a')]!==_0xa02b('0x3a')){var _0x28077d={};_0x28077d[_0x59f15c[_0xa02b('0x23')]]={'$like':'%'+_0x3db381[_0xa02b('0x2d')][_0xa02b('0x38')]+'%'};return _0x28077d;}})});}_0x53aacb=_['merge']({},_0x53aacb,_0x3db381[_0xa02b('0x3b')]);var _0x5b920d={'where':_0x53aacb[_0xa02b('0x36')]};return db[_0xa02b('0x27')]['count'](_0x5b920d)[_0xa02b('0x1f')](function(_0x10421a){_0x13a19d['count']=_0x10421a;if(_0x3db381[_0xa02b('0x2d')][_0xa02b('0x3c')]){_0x53aacb[_0xa02b('0x3d')]=[{'all':!![]}];}return db[_0xa02b('0x27')][_0xa02b('0x3e')](_0x53aacb);})['then'](function(_0xc98b80){_0x13a19d[_0xa02b('0x3f')]=_0xc98b80;return _0x13a19d;})[_0xa02b('0x1f')](respondWithFilteredResult(_0x5c5017,_0x53aacb))[_0xa02b('0x40')](handleError(_0x5c5017,null));};exports['show']=function(_0x6ff385,_0xca1ff1){var _0x5e1767={'raw':![],'where':{'id':_0x6ff385[_0xa02b('0x41')]['id']}},_0x4e91d5={};_0x4e91d5[_0xa02b('0x2c')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x4e91d5[_0xa02b('0x2d')]=_[_0xa02b('0x2e')](_0x6ff385['query']);_0x4e91d5['filters']=_[_0xa02b('0x2f')](_0x4e91d5['model'],_0x4e91d5[_0xa02b('0x2d')]);_0x5e1767['attributes']=_[_0xa02b('0x2f')](_0x4e91d5[_0xa02b('0x2c')],qs['fields'](_0x6ff385['query']['fields']));_0x5e1767[_0xa02b('0x30')]=_0x5e1767[_0xa02b('0x30')][_0xa02b('0x32')]?_0x5e1767[_0xa02b('0x30')]:_0x4e91d5['model'];if(_0x6ff385[_0xa02b('0x2d')][_0xa02b('0x3c')]){_0x5e1767['include']=[{'all':!![]}];}_0x5e1767=_[_0xa02b('0x39')]({},_0x5e1767,_0x6ff385[_0xa02b('0x3b')]);return db[_0xa02b('0x27')][_0xa02b('0x42')](_0x5e1767)[_0xa02b('0x1f')](handleEntityNotFound(_0xca1ff1,null))[_0xa02b('0x1f')](respondWithResult(_0xca1ff1,null))[_0xa02b('0x40')](handleError(_0xca1ff1,null));};exports[_0xa02b('0x43')]=function(_0x2a6ec5,_0x727213){return db[_0xa02b('0x27')]['create'](_0x2a6ec5[_0xa02b('0x44')],{})[_0xa02b('0x1f')](respondWithResult(_0x727213,0xc9))[_0xa02b('0x40')](handleError(_0x727213,null));};exports[_0xa02b('0x1e')]=function(_0x2fe504,_0x15c63e){if(_0x2fe504[_0xa02b('0x44')]['id']){delete _0x2fe504[_0xa02b('0x44')]['id'];}return db[_0xa02b('0x27')][_0xa02b('0x42')]({'where':{'id':_0x2fe504[_0xa02b('0x41')]['id']}})[_0xa02b('0x1f')](handleEntityNotFound(_0x15c63e,null))[_0xa02b('0x1f')](saveUpdates(_0x2fe504[_0xa02b('0x44')],null))['then'](respondWithResult(_0x15c63e,null))[_0xa02b('0x40')](handleError(_0x15c63e,null));};exports['destroy']=function(_0x147972,_0x41ad5c){return db['VtigerConfiguration'][_0xa02b('0x42')]({'where':{'id':_0x147972[_0xa02b('0x41')]['id']}})['then'](handleEntityNotFound(_0x41ad5c,null))[_0xa02b('0x1f')](removeEntity(_0x41ad5c,null))[_0xa02b('0x40')](handleError(_0x41ad5c,null));};exports[_0xa02b('0x45')]=function(_0x2e9e9b,_0x509acc,_0x3f01f6){var _0x591a6c={};var _0xf38dc2={};var _0x250ff0;var _0x4daaaa;return db['VtigerConfiguration'][_0xa02b('0x46')]({'where':{'id':_0x2e9e9b['params']['id']}})[_0xa02b('0x1f')](handleEntityNotFound(_0x509acc,null))[_0xa02b('0x1f')](function(_0x339785){if(_0x339785){_0x250ff0=_0x339785;_0xf38dc2['model']=_['keys'](db[_0xa02b('0x47')][_0xa02b('0x28')]);_0xf38dc2['query']=_[_0xa02b('0x2e')](_0x2e9e9b['query']);_0xf38dc2[_0xa02b('0x37')]=_['intersection'](_0xf38dc2[_0xa02b('0x2c')],_0xf38dc2[_0xa02b('0x2d')]);_0x591a6c[_0xa02b('0x30')]=_[_0xa02b('0x2f')](_0xf38dc2[_0xa02b('0x2c')],qs[_0xa02b('0x31')](_0x2e9e9b[_0xa02b('0x2d')][_0xa02b('0x31')]));_0x591a6c['attributes']=_0x591a6c[_0xa02b('0x30')][_0xa02b('0x32')]?_0x591a6c[_0xa02b('0x30')]:_0xf38dc2[_0xa02b('0x2c')];_0x591a6c[_0xa02b('0x48')]=qs['sort'](_0x2e9e9b['query'][_0xa02b('0x35')]);_0x591a6c['where']=qs[_0xa02b('0x37')](_[_0xa02b('0x49')](_0x2e9e9b['query'],_0xf38dc2['filters']));if(_0x2e9e9b[_0xa02b('0x2d')]['filter']){_0x591a6c['where']=_[_0xa02b('0x39')](_0x591a6c[_0xa02b('0x36')],{'$or':_[_0xa02b('0x26')](_0x591a6c[_0xa02b('0x30')],function(_0x4eed2c){var _0x21206c={};_0x21206c[_0x4eed2c]={'$like':'%'+_0x2e9e9b[_0xa02b('0x2d')][_0xa02b('0x38')]+'%'};return _0x21206c;})});}_0x591a6c=_[_0xa02b('0x39')]({},_0x591a6c,_0x2e9e9b[_0xa02b('0x3b')]);return _0x250ff0[_0xa02b('0x45')](_0x591a6c);}})[_0xa02b('0x1f')](function(_0x5ddb53){if(_0x5ddb53){_0x4daaaa=_0x5ddb53[_0xa02b('0x32')];if(!_0x2e9e9b[_0xa02b('0x2d')][_0xa02b('0x33')](_0xa02b('0x34'))){_0x591a6c['limit']=qs['limit'](_0x2e9e9b[_0xa02b('0x2d')]['limit']);_0x591a6c[_0xa02b('0x17')]=qs[_0xa02b('0x17')](_0x2e9e9b[_0xa02b('0x2d')][_0xa02b('0x17')]);}return _0x250ff0[_0xa02b('0x45')](_0x591a6c);}})[_0xa02b('0x1f')](function(_0x34dbea){if(_0x34dbea){return _0x34dbea?{'count':_0x4daaaa,'rows':_0x34dbea}:null;}})[_0xa02b('0x1f')](respondWithResult(_0x509acc,null))['catch'](handleError(_0x509acc,null));};exports[_0xa02b('0x4a')]=function(_0x9173eb,_0x3b6062,_0x1f37cd){var _0x139893={};var _0x4b3b24={};var _0x214043;var _0x4ae497;return db[_0xa02b('0x27')][_0xa02b('0x46')]({'where':{'id':_0x9173eb[_0xa02b('0x41')]['id']}})[_0xa02b('0x1f')](handleEntityNotFound(_0x3b6062,null))[_0xa02b('0x1f')](function(_0x2592af){if(_0x2592af){_0x214043=_0x2592af;_0x4b3b24[_0xa02b('0x2c')]=_[_0xa02b('0x2e')](db[_0xa02b('0x47')][_0xa02b('0x28')]);_0x4b3b24[_0xa02b('0x2d')]=_[_0xa02b('0x2e')](_0x9173eb[_0xa02b('0x2d')]);_0x4b3b24['filters']=_['intersection'](_0x4b3b24['model'],_0x4b3b24['query']);_0x139893[_0xa02b('0x30')]=_['intersection'](_0x4b3b24['model'],qs[_0xa02b('0x31')](_0x9173eb[_0xa02b('0x2d')][_0xa02b('0x31')]));_0x139893[_0xa02b('0x30')]=_0x139893[_0xa02b('0x30')]['length']?_0x139893[_0xa02b('0x30')]:_0x4b3b24[_0xa02b('0x2c')];_0x139893[_0xa02b('0x48')]=qs[_0xa02b('0x35')](_0x9173eb[_0xa02b('0x2d')][_0xa02b('0x35')]);_0x139893[_0xa02b('0x36')]=qs[_0xa02b('0x37')](_[_0xa02b('0x49')](_0x9173eb['query'],_0x4b3b24[_0xa02b('0x37')]));if(_0x9173eb['query'][_0xa02b('0x38')]){_0x139893['where']=_[_0xa02b('0x39')](_0x139893[_0xa02b('0x36')],{'$or':_[_0xa02b('0x26')](_0x139893[_0xa02b('0x30')],function(_0x5d0afb){var _0x115bfe={};_0x115bfe[_0x5d0afb]={'$like':'%'+_0x9173eb[_0xa02b('0x2d')][_0xa02b('0x38')]+'%'};return _0x115bfe;})});}_0x139893=_['merge']({},_0x139893,_0x9173eb['options']);return _0x214043['getSubjects'](_0x139893);}})['then'](function(_0x5d0de6){if(_0x5d0de6){_0x4ae497=_0x5d0de6[_0xa02b('0x32')];if(!_0x9173eb[_0xa02b('0x2d')][_0xa02b('0x33')]('nolimit')){_0x139893[_0xa02b('0x19')]=qs[_0xa02b('0x19')](_0x9173eb[_0xa02b('0x2d')]['limit']);_0x139893[_0xa02b('0x17')]=qs[_0xa02b('0x17')](_0x9173eb[_0xa02b('0x2d')][_0xa02b('0x17')]);}return _0x214043['getSubjects'](_0x139893);}})[_0xa02b('0x1f')](function(_0x5e6dbd){if(_0x5e6dbd){return _0x5e6dbd?{'count':_0x4ae497,'rows':_0x5e6dbd}:null;}})[_0xa02b('0x1f')](respondWithResult(_0x3b6062,null))[_0xa02b('0x40')](handleError(_0x3b6062,null));};exports[_0xa02b('0x4b')]=function(_0x200b34,_0x368fb0,_0x5ab470){var _0x53e0f0={};var _0x8e2f1b={};var _0x5cc3ab;var _0x144fa1;return db[_0xa02b('0x27')][_0xa02b('0x46')]({'where':{'id':_0x200b34[_0xa02b('0x41')]['id']}})['then'](handleEntityNotFound(_0x368fb0,null))[_0xa02b('0x1f')](function(_0x5984cd){if(_0x5984cd){_0x5cc3ab=_0x5984cd;_0x8e2f1b[_0xa02b('0x2c')]=_[_0xa02b('0x2e')](db[_0xa02b('0x47')][_0xa02b('0x28')]);_0x8e2f1b[_0xa02b('0x2d')]=_[_0xa02b('0x2e')](_0x200b34[_0xa02b('0x2d')]);_0x8e2f1b[_0xa02b('0x37')]=_[_0xa02b('0x2f')](_0x8e2f1b[_0xa02b('0x2c')],_0x8e2f1b['query']);_0x53e0f0[_0xa02b('0x30')]=_['intersection'](_0x8e2f1b[_0xa02b('0x2c')],qs['fields'](_0x200b34[_0xa02b('0x2d')]['fields']));_0x53e0f0[_0xa02b('0x30')]=_0x53e0f0['attributes'][_0xa02b('0x32')]?_0x53e0f0[_0xa02b('0x30')]:_0x8e2f1b[_0xa02b('0x2c')];_0x53e0f0[_0xa02b('0x48')]=qs[_0xa02b('0x35')](_0x200b34[_0xa02b('0x2d')][_0xa02b('0x35')]);_0x53e0f0[_0xa02b('0x36')]=qs['filters'](_[_0xa02b('0x49')](_0x200b34[_0xa02b('0x2d')],_0x8e2f1b[_0xa02b('0x37')]));if(_0x200b34[_0xa02b('0x2d')][_0xa02b('0x38')]){_0x53e0f0['where']=_[_0xa02b('0x39')](_0x53e0f0['where'],{'$or':_[_0xa02b('0x26')](_0x53e0f0[_0xa02b('0x30')],function(_0x2d2e69){var _0x4c1ae8={};_0x4c1ae8[_0x2d2e69]={'$like':'%'+_0x200b34[_0xa02b('0x2d')][_0xa02b('0x38')]+'%'};return _0x4c1ae8;})});}_0x53e0f0=_[_0xa02b('0x39')]({},_0x53e0f0,_0x200b34[_0xa02b('0x3b')]);return _0x5cc3ab['getDescriptions'](_0x53e0f0);}})['then'](function(_0x216be8){if(_0x216be8){_0x144fa1=_0x216be8[_0xa02b('0x32')];if(!_0x200b34[_0xa02b('0x2d')][_0xa02b('0x33')]('nolimit')){_0x53e0f0[_0xa02b('0x19')]=qs[_0xa02b('0x19')](_0x200b34[_0xa02b('0x2d')][_0xa02b('0x19')]);_0x53e0f0[_0xa02b('0x17')]=qs[_0xa02b('0x17')](_0x200b34[_0xa02b('0x2d')][_0xa02b('0x17')]);}return _0x5cc3ab[_0xa02b('0x4b')](_0x53e0f0);}})[_0xa02b('0x1f')](function(_0x4ec824){if(_0x4ec824){return _0x4ec824?{'count':_0x144fa1,'rows':_0x4ec824}:null;}})[_0xa02b('0x1f')](respondWithResult(_0x368fb0,null))[_0xa02b('0x40')](handleError(_0x368fb0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f5d87a5..fc21ef2 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 _0x7874=['request-promise','rimraf','./intVtigerConfiguration.attributes','int_vtiger_configurations','util','../../config/logger','api','moment'];(function(_0x51bb23,_0x378d1e){var _0x3a2fb9=function(_0x2c8409){while(--_0x2c8409){_0x51bb23['push'](_0x51bb23['shift']());}};_0x3a2fb9(++_0x378d1e);}(_0x7874,0xbc));var _0x4787=function(_0x1e7701,_0x13fd0f){_0x1e7701=_0x1e7701-0x0;var _0x3ab707=_0x7874[_0x1e7701];return _0x3ab707;};'use strict';var _=require('lodash');var util=require(_0x4787('0x0'));var logger=require(_0x4787('0x1'))(_0x4787('0x2'));var moment=require(_0x4787('0x3'));var BPromise=require('bluebird');var rp=require(_0x4787('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4787('0x5'));var config=require('../../config/environment');var attributes=require(_0x4787('0x6'));module['exports']=function(_0x2e14e3,_0x127049){return _0x2e14e3['define']('VtigerConfiguration',attributes,{'tableName':_0x4787('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a52=['rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a52,0x1f0));var _0x27a5=function(_0x26dfc7,_0x18efc0){_0x26dfc7=_0x26dfc7-0x0;var _0x55745a=_0x7a52[_0x26dfc7];return _0x55745a;};'use strict';var _=require(_0x27a5('0x0'));var util=require(_0x27a5('0x1'));var logger=require(_0x27a5('0x2'))(_0x27a5('0x3'));var moment=require(_0x27a5('0x4'));var BPromise=require(_0x27a5('0x5'));var rp=require(_0x27a5('0x6'));var fs=require('fs');var path=require(_0x27a5('0x7'));var rimraf=require(_0x27a5('0x8'));var config=require(_0x27a5('0x9'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x27a5('0xa')]=function(_0x1f33a6,_0xfb84ca){return _0x1f33a6[_0x27a5('0xb')](_0x27a5('0xc'),attributes,{'tableName':_0x27a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index b3e67c6..bf0c208 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 _0x0c8f=['moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x3e67e9,_0x1187a1){var _0x54abbb=function(_0x142996){while(--_0x142996){_0x3e67e9['push'](_0x3e67e9['shift']());}};_0x54abbb(++_0x1187a1);}(_0x0c8f,0x155));var _0xf0c8=function(_0x583790,_0x28322d){_0x583790=_0x583790-0x0;var _0x2fcf11=_0x0c8f[_0x583790];return _0x2fcf11;};'use strict';var _=require('lodash');var util=require(_0xf0c8('0x0'));var moment=require(_0xf0c8('0x1'));var BPromise=require(_0xf0c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0c8('0x3'));var logger=require(_0xf0c8('0x4'))(_0xf0c8('0x5'));var config=require(_0xf0c8('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x441fa4,_0x41708f,_0x4d2e93){return new BPromise(function(_0x2b5343,_0x1ddded){return client[_0xf0c8('0x7')](_0x441fa4,_0x4d2e93)[_0xf0c8('0x8')](function(_0x14c008){logger['info'](_0xf0c8('0x9'),_0x41708f,_0xf0c8('0xa'));logger[_0xf0c8('0xb')](_0xf0c8('0xc'),_0x41708f,_0xf0c8('0xa'),JSON[_0xf0c8('0xd')](_0x14c008));if(_0x14c008[_0xf0c8('0xe')]){if(_0x14c008[_0xf0c8('0xe')][_0xf0c8('0xf')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x41708f,_0x14c008[_0xf0c8('0xe')][_0xf0c8('0x10')]);return _0x1ddded(_0x14c008[_0xf0c8('0xe')][_0xf0c8('0x10')]);}logger[_0xf0c8('0xe')](_0xf0c8('0x9'),_0x41708f,_0x14c008[_0xf0c8('0xe')][_0xf0c8('0x10')]);return _0x2b5343(_0x14c008['error'][_0xf0c8('0x10')]);}else{logger['info'](_0xf0c8('0x9'),_0x41708f,'request\x20sent');_0x2b5343(_0x14c008[_0xf0c8('0x11')][_0xf0c8('0x10')]);}})[_0xf0c8('0x12')](function(_0x5849e2){logger[_0xf0c8('0xe')](_0xf0c8('0x9'),_0x41708f,_0x5849e2);_0x1ddded(_0x5849e2);});});} \ No newline at end of file +var _0x54be=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3a00d3,_0x7ea9ef){var _0x2af037=function(_0x2eff8c){while(--_0x2eff8c){_0x3a00d3['push'](_0x3a00d3['shift']());}};_0x2af037(++_0x7ea9ef);}(_0x54be,0x191));var _0xe54b=function(_0x9d7895,_0x48a6ce){_0x9d7895=_0x9d7895-0x0;var _0x1ad87c=_0x54be[_0x9d7895];return _0x1ad87c;};'use strict';var _=require(_0xe54b('0x0'));var util=require(_0xe54b('0x1'));var moment=require(_0xe54b('0x2'));var BPromise=require(_0xe54b('0x3'));var rs=require(_0xe54b('0x4'));var fs=require('fs');var Redis=require(_0xe54b('0x5'));var db=require(_0xe54b('0x6'))['db'];var utils=require(_0xe54b('0x7'));var logger=require(_0xe54b('0x8'))(_0xe54b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe54b('0xa')][_0xe54b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fd92c,_0x13fc5f,_0x2f2e4e){return new BPromise(function(_0x43054f,_0x5afbe3){return client[_0xe54b('0xc')](_0x1fd92c,_0x2f2e4e)[_0xe54b('0xd')](function(_0x3c1e4f){logger[_0xe54b('0xe')](_0xe54b('0xf'),_0x13fc5f,_0xe54b('0x10'));logger[_0xe54b('0x11')](_0xe54b('0x12'),_0x13fc5f,_0xe54b('0x10'),JSON['stringify'](_0x3c1e4f));if(_0x3c1e4f[_0xe54b('0x13')]){if(_0x3c1e4f[_0xe54b('0x13')][_0xe54b('0x14')]===0x1f4){logger[_0xe54b('0x13')](_0xe54b('0xf'),_0x13fc5f,_0x3c1e4f[_0xe54b('0x13')][_0xe54b('0x15')]);return _0x5afbe3(_0x3c1e4f[_0xe54b('0x13')][_0xe54b('0x15')]);}logger[_0xe54b('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x13fc5f,_0x3c1e4f[_0xe54b('0x13')][_0xe54b('0x15')]);return _0x43054f(_0x3c1e4f[_0xe54b('0x13')][_0xe54b('0x15')]);}else{logger['info'](_0xe54b('0xf'),_0x13fc5f,_0xe54b('0x10'));_0x43054f(_0x3c1e4f['result']['message']);}})['catch'](function(_0x1a860f){logger[_0xe54b('0x13')](_0xe54b('0xf'),_0x13fc5f,_0x1a860f);_0x5afbe3(_0x1a860f);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d3084d9..50e5a35 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 _0xfe9c=['delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x4232da,_0x3c54b0){var _0x358411=function(_0xce0b5c){while(--_0xce0b5c){_0x4232da['push'](_0x4232da['shift']());}};_0x358411(++_0x3c54b0);}(_0xfe9c,0x1b3));var _0xcfe9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xfe9c[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xcfe9('0x0'));var util=require('util');var path=require(_0xcfe9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcfe9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcfe9('0x3'));var interaction=require(_0xcfe9('0x4'));var config=require('../../config/environment');var controller=require(_0xcfe9('0x5'));router[_0xcfe9('0x6')]('/',auth['isAuthenticated'](),controller[_0xcfe9('0x7')]);router[_0xcfe9('0x6')](_0xcfe9('0x8'),auth['isAuthenticated'](),controller[_0xcfe9('0x9')]);router[_0xcfe9('0xa')]('/',auth[_0xcfe9('0xb')](),controller[_0xcfe9('0xc')]);router[_0xcfe9('0xd')](_0xcfe9('0x8'),auth['isAuthenticated'](),controller[_0xcfe9('0xe')]);router[_0xcfe9('0xf')](_0xcfe9('0x8'),auth[_0xcfe9('0xb')](),controller[_0xcfe9('0x10')]);module[_0xcfe9('0x11')]=router; \ No newline at end of file +var _0xee84=['get','show','put','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0xee84,0xe4));var _0x4ee8=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xee84[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x4ee8('0x0'));var util=require('util');var path=require(_0x4ee8('0x1'));var timeout=require(_0x4ee8('0x2'));var express=require(_0x4ee8('0x3'));var router=express['Router']();var fs_extra=require(_0x4ee8('0x4'));var auth=require(_0x4ee8('0x5'));var interaction=require(_0x4ee8('0x6'));var config=require(_0x4ee8('0x7'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x4ee8('0x8')](),controller[_0x4ee8('0x9')]);router[_0x4ee8('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4ee8('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4ee8('0xc')](_0x4ee8('0xd'),auth[_0x4ee8('0x8')](),controller[_0x4ee8('0xe')]);router[_0x4ee8('0xf')]('/:id',auth[_0x4ee8('0x8')](),controller['destroy']);module[_0x4ee8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 7459478..1385687 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 _0x7f4c=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x219c82,_0xe6f67f){var _0x2195c9=function(_0x333d71){while(--_0x333d71){_0x219c82['push'](_0x219c82['shift']());}};_0x2195c9(++_0xe6f67f);}(_0x7f4c,0x1a6));var _0xc7f4=function(_0x36a922,_0x4da114){_0x36a922=_0x36a922-0x0;var _0x3bfba1=_0x7f4c[_0x36a922];return _0x3bfba1;};'use strict';var Sequelize=require(_0xc7f4('0x0'));module[_0xc7f4('0x1')]={'type':{'type':Sequelize[_0xc7f4('0x2')](_0xc7f4('0x3'),_0xc7f4('0x4'),_0xc7f4('0x5'),_0xc7f4('0x6'),_0xc7f4('0x7')),'defaultValue':_0xc7f4('0x3')},'content':{'type':Sequelize[_0xc7f4('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xc7f4('0x4'),_0xc7f4('0x5'))},'keyContent':{'type':Sequelize[_0xc7f4('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc7f4('0x8')]},'customField':{'type':Sequelize[_0xc7f4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc7f4('0x8')]}}; \ No newline at end of file +var _0xb228=['string','variable','customVariable','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x5fa0b4,_0x37e47a){var _0x8f8e77=function(_0x57b61b){while(--_0x57b61b){_0x5fa0b4['push'](_0x5fa0b4['shift']());}};_0x8f8e77(++_0x37e47a);}(_0xb228,0x1ae));var _0x8b22=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb228[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x8b22('0x0')]={'type':{'type':Sequelize[_0x8b22('0x1')](_0x8b22('0x2'),_0x8b22('0x3'),_0x8b22('0x4'),'keyValue',_0x8b22('0x5')),'defaultValue':_0x8b22('0x2')},'content':{'type':Sequelize[_0x8b22('0x6')]},'key':{'type':Sequelize[_0x8b22('0x6')]},'keyType':{'type':Sequelize[_0x8b22('0x1')](_0x8b22('0x2'),_0x8b22('0x3'),_0x8b22('0x4'))},'keyContent':{'type':Sequelize[_0x8b22('0x6')]},'idField':{'type':Sequelize[_0x8b22('0x6')]},'nameField':{'type':Sequelize[_0x8b22('0x6')]},'customField':{'type':Sequelize[_0x8b22('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b22('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 47fb5a1..9885077 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 _0xfb8a=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter'];(function(_0x227b98,_0x32f2c2){var _0x4f4146=function(_0x5a7aaa){while(--_0x5a7aaa){_0x227b98['push'](_0x227b98['shift']());}};_0x4f4146(++_0x32f2c2);}(_0xfb8a,0x1ca));var _0xafb8=function(_0x3c704b,_0xd6f86f){_0x3c704b=_0x3c704b-0x0;var _0x44cb8b=_0xfb8a[_0x3c704b];return _0x44cb8b;};'use strict';var emlformat=require(_0xafb8('0x0'));var rimraf=require(_0xafb8('0x1'));var zipdir=require(_0xafb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xafb8('0x3'));var BPromise=require(_0xafb8('0x4'));var Mustache=require(_0xafb8('0x5'));var util=require(_0xafb8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xafb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafb8('0x8'));var _=require(_0xafb8('0x9'));var squel=require('squel');var crypto=require(_0xafb8('0xa'));var jsforce=require(_0xafb8('0xb'));var deskjs=require(_0xafb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xafb8('0xd'));var Papa=require(_0xafb8('0xe'));var Redis=require('ioredis');var authService=require(_0xafb8('0xf'));var qs=require(_0xafb8('0x10'));var as=require(_0xafb8('0x11'));var hardwareService=require(_0xafb8('0x12'));var logger=require('../../config/logger')(_0xafb8('0x13'));var utils=require(_0xafb8('0x14'));var config=require(_0xafb8('0x15'));var licenseUtil=require(_0xafb8('0x16'));var db=require(_0xafb8('0x17'))['db'];function respondWithStatusCode(_0x210789,_0x50f7f3){_0x50f7f3=_0x50f7f3||0xcc;return function(_0x33a86b){if(_0x33a86b){return _0x210789['sendStatus'](_0x50f7f3);}return _0x210789[_0xafb8('0x18')](_0x50f7f3)[_0xafb8('0x19')]();};}function respondWithResult(_0x2ad18a,_0x2d0041){_0x2d0041=_0x2d0041||0xc8;return function(_0x278f02){if(_0x278f02){return _0x2ad18a[_0xafb8('0x18')](_0x2d0041)['json'](_0x278f02);}};}function respondWithFilteredResult(_0x5aa818,_0x11fa2f){return function(_0x5bbd19){if(_0x5bbd19){var _0x3cc798=typeof _0x11fa2f['offset']===_0xafb8('0x1a')&&typeof _0x11fa2f['limit']===_0xafb8('0x1a');var _0x4240ac=_0x5bbd19[_0xafb8('0x1b')];var _0x241e8b=_0x3cc798?0x0:_0x11fa2f[_0xafb8('0x1c')];var _0x5c97ce=_0x3cc798?_0x5bbd19[_0xafb8('0x1b')]:_0x11fa2f['offset']+_0x11fa2f[_0xafb8('0x1d')];var _0x4e0a13;if(_0x5c97ce>=_0x4240ac){_0x5c97ce=_0x4240ac;_0x4e0a13=0xc8;}else{_0x4e0a13=0xce;}_0x5aa818['status'](_0x4e0a13);return _0x5aa818[_0xafb8('0x1e')](_0xafb8('0x1f'),_0x241e8b+'-'+_0x5c97ce+'/'+_0x4240ac)[_0xafb8('0x20')](_0x5bbd19);}return null;};}function patchUpdates(_0xc5944d){return function(_0x2d2c5d){try{jsonpatch[_0xafb8('0x21')](_0x2d2c5d,_0xc5944d,!![]);}catch(_0x1feca6){return BPromise[_0xafb8('0x22')](_0x1feca6);}return _0x2d2c5d[_0xafb8('0x23')]();};}function saveUpdates(_0x4e5760,_0x5f1626){return function(_0x3511c7){if(_0x3511c7){return _0x3511c7['update'](_0x4e5760)[_0xafb8('0x24')](function(_0x540de9){return _0x540de9;});}return null;};}function removeEntity(_0x2fb36d,_0x1b7f51){return function(_0x1d490c){if(_0x1d490c){return _0x1d490c[_0xafb8('0x25')]()['then'](function(){_0x2fb36d[_0xafb8('0x18')](0xcc)[_0xafb8('0x19')]();});}};}function handleEntityNotFound(_0x4bb20e,_0x246ae1){return function(_0x23696a){if(!_0x23696a){_0x4bb20e[_0xafb8('0x26')](0x194);}return _0x23696a;};}function handleError(_0x2f4e3d,_0x409881){_0x409881=_0x409881||0x1f4;return function(_0x16d950){logger[_0xafb8('0x27')](_0x16d950['stack']);if(_0x16d950[_0xafb8('0x28')]){delete _0x16d950['name'];}_0x2f4e3d[_0xafb8('0x18')](_0x409881)[_0xafb8('0x29')](_0x16d950);};}exports['index']=function(_0x2bf56d,_0xbc57ba){var _0x2d4f37={},_0x155bc3={},_0x18a913={'count':0x0,'rows':[]};var _0x1529ae=_[_0xafb8('0x2a')](db[_0xafb8('0x2b')][_0xafb8('0x2c')],function(_0x67cac1){return{'name':_0x67cac1[_0xafb8('0x2d')],'type':_0x67cac1[_0xafb8('0x2e')][_0xafb8('0x2f')]};});_0x155bc3[_0xafb8('0x30')]=_[_0xafb8('0x2a')](_0x1529ae,_0xafb8('0x28'));_0x155bc3[_0xafb8('0x31')]=_['keys'](_0x2bf56d['query']);_0x155bc3['filters']=_[_0xafb8('0x32')](_0x155bc3['model'],_0x155bc3[_0xafb8('0x31')]);_0x2d4f37[_0xafb8('0x33')]=_[_0xafb8('0x32')](_0x155bc3['model'],qs[_0xafb8('0x34')](_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x34')]));_0x2d4f37[_0xafb8('0x33')]=_0x2d4f37[_0xafb8('0x33')][_0xafb8('0x35')]?_0x2d4f37[_0xafb8('0x33')]:_0x155bc3['model'];if(!_0x2bf56d[_0xafb8('0x31')]['hasOwnProperty']('nolimit')){_0x2d4f37[_0xafb8('0x1d')]=qs[_0xafb8('0x1d')](_0x2bf56d[_0xafb8('0x31')]['limit']);_0x2d4f37[_0xafb8('0x1c')]=qs[_0xafb8('0x1c')](_0x2bf56d['query'][_0xafb8('0x1c')]);}_0x2d4f37[_0xafb8('0x36')]=qs[_0xafb8('0x37')](_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x37')]);_0x2d4f37[_0xafb8('0x38')]=qs[_0xafb8('0x39')](_[_0xafb8('0x3a')](_0x2bf56d[_0xafb8('0x31')],_0x155bc3[_0xafb8('0x39')]),_0x1529ae);if(_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x3b')]){_0x2d4f37[_0xafb8('0x38')]=_[_0xafb8('0x3c')](_0x2d4f37[_0xafb8('0x38')],{'$or':_['map'](_0x1529ae,function(_0xc3685b){if(_0xc3685b[_0xafb8('0x2e')]!==_0xafb8('0x3d')){var _0x1c234b={};_0x1c234b[_0xc3685b[_0xafb8('0x28')]]={'$like':'%'+_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x3b')]+'%'};return _0x1c234b;}})});}_0x2d4f37=_[_0xafb8('0x3c')]({},_0x2d4f37,_0x2bf56d[_0xafb8('0x3e')]);var _0x1bfd23={'where':_0x2d4f37['where']};return db[_0xafb8('0x2b')][_0xafb8('0x1b')](_0x1bfd23)[_0xafb8('0x24')](function(_0x498453){_0x18a913[_0xafb8('0x1b')]=_0x498453;if(_0x2bf56d[_0xafb8('0x31')][_0xafb8('0x3f')]){_0x2d4f37[_0xafb8('0x40')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x2d4f37);})[_0xafb8('0x24')](function(_0x5cceee){_0x18a913[_0xafb8('0x41')]=_0x5cceee;return _0x18a913;})['then'](respondWithFilteredResult(_0xbc57ba,_0x2d4f37))[_0xafb8('0x42')](handleError(_0xbc57ba,null));};exports[_0xafb8('0x43')]=function(_0x48cd1b,_0x91a4cf){var _0x28c082={'raw':!![],'where':{'id':_0x48cd1b[_0xafb8('0x44')]['id']}},_0x480094={};_0x480094[_0xafb8('0x30')]=_['keys'](db[_0xafb8('0x2b')][_0xafb8('0x2c')]);_0x480094[_0xafb8('0x31')]=_[_0xafb8('0x45')](_0x48cd1b[_0xafb8('0x31')]);_0x480094[_0xafb8('0x39')]=_[_0xafb8('0x32')](_0x480094['model'],_0x480094['query']);_0x28c082[_0xafb8('0x33')]=_[_0xafb8('0x32')](_0x480094[_0xafb8('0x30')],qs[_0xafb8('0x34')](_0x48cd1b['query'][_0xafb8('0x34')]));_0x28c082[_0xafb8('0x33')]=_0x28c082['attributes'][_0xafb8('0x35')]?_0x28c082['attributes']:_0x480094[_0xafb8('0x30')];if(_0x48cd1b[_0xafb8('0x31')][_0xafb8('0x3f')]){_0x28c082[_0xafb8('0x40')]=[{'all':!![]}];}_0x28c082=_[_0xafb8('0x3c')]({},_0x28c082,_0x48cd1b[_0xafb8('0x3e')]);return db['VtigerField'][_0xafb8('0x46')](_0x28c082)[_0xafb8('0x24')](handleEntityNotFound(_0x91a4cf,null))['then'](respondWithResult(_0x91a4cf,null))['catch'](handleError(_0x91a4cf,null));};exports[_0xafb8('0x47')]=function(_0x5804ff,_0x2aba58){return db[_0xafb8('0x2b')]['create'](_0x5804ff[_0xafb8('0x48')],{})[_0xafb8('0x24')](respondWithResult(_0x2aba58,0xc9))[_0xafb8('0x42')](handleError(_0x2aba58,null));};exports[_0xafb8('0x49')]=function(_0xabb625,_0x1ab472){if(_0xabb625[_0xafb8('0x48')]['id']){delete _0xabb625[_0xafb8('0x48')]['id'];}return db[_0xafb8('0x2b')][_0xafb8('0x46')]({'where':{'id':_0xabb625[_0xafb8('0x44')]['id']}})[_0xafb8('0x24')](handleEntityNotFound(_0x1ab472,null))[_0xafb8('0x24')](saveUpdates(_0xabb625[_0xafb8('0x48')],null))[_0xafb8('0x24')](respondWithResult(_0x1ab472,null))[_0xafb8('0x42')](handleError(_0x1ab472,null));};exports[_0xafb8('0x25')]=function(_0xe30f3c,_0x27fb37){return db[_0xafb8('0x2b')][_0xafb8('0x46')]({'where':{'id':_0xe30f3c[_0xafb8('0x44')]['id']}})['then'](handleEntityNotFound(_0x27fb37,null))[_0xafb8('0x24')](removeEntity(_0x27fb37,null))[_0xafb8('0x42')](handleError(_0x27fb37,null));}; \ No newline at end of file +var _0x6211=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','show','keys','find','catch','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2b6ba3,_0x345430){var _0x2cc6f0=function(_0x156d69){while(--_0x156d69){_0x2b6ba3['push'](_0x2b6ba3['shift']());}};_0x2cc6f0(++_0x345430);}(_0x6211,0xc2));var _0x1621=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6211[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1621('0x0'));var zipdir=require(_0x1621('0x1'));var jsonpatch=require(_0x1621('0x2'));var rp=require(_0x1621('0x3'));var moment=require(_0x1621('0x4'));var BPromise=require(_0x1621('0x5'));var Mustache=require(_0x1621('0x6'));var util=require(_0x1621('0x7'));var path=require('path');var sox=require(_0x1621('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1621('0x9'));var crypto=require(_0x1621('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1621('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1621('0xc'));var Redis=require(_0x1621('0xd'));var authService=require(_0x1621('0xe'));var qs=require(_0x1621('0xf'));var as=require(_0x1621('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1621('0x11'));var utils=require(_0x1621('0x12'));var config=require(_0x1621('0x13'));var licenseUtil=require(_0x1621('0x14'));var db=require(_0x1621('0x15'))['db'];function respondWithStatusCode(_0x547b00,_0x153747){_0x153747=_0x153747||0xcc;return function(_0x5bfa12){if(_0x5bfa12){return _0x547b00[_0x1621('0x16')](_0x153747);}return _0x547b00[_0x1621('0x17')](_0x153747)[_0x1621('0x18')]();};}function respondWithResult(_0x24b385,_0x37cc82){_0x37cc82=_0x37cc82||0xc8;return function(_0x5179fc){if(_0x5179fc){return _0x24b385['status'](_0x37cc82)[_0x1621('0x19')](_0x5179fc);}};}function respondWithFilteredResult(_0x20d3ce,_0x302da5){return function(_0xc9ead6){if(_0xc9ead6){var _0x4f7dca=typeof _0x302da5[_0x1621('0x1a')]===_0x1621('0x1b')&&typeof _0x302da5[_0x1621('0x1c')]===_0x1621('0x1b');var _0x269359=_0xc9ead6[_0x1621('0x1d')];var _0x316d35=_0x4f7dca?0x0:_0x302da5['offset'];var _0x99e2e8=_0x4f7dca?_0xc9ead6[_0x1621('0x1d')]:_0x302da5[_0x1621('0x1a')]+_0x302da5['limit'];var _0x4c3d50;if(_0x99e2e8>=_0x269359){_0x99e2e8=_0x269359;_0x4c3d50=0xc8;}else{_0x4c3d50=0xce;}_0x20d3ce['status'](_0x4c3d50);return _0x20d3ce[_0x1621('0x1e')]('Content-Range',_0x316d35+'-'+_0x99e2e8+'/'+_0x269359)[_0x1621('0x19')](_0xc9ead6);}return null;};}function patchUpdates(_0x5b8f38){return function(_0x55b4a9){try{jsonpatch[_0x1621('0x1f')](_0x55b4a9,_0x5b8f38,!![]);}catch(_0xb7b92a){return BPromise[_0x1621('0x20')](_0xb7b92a);}return _0x55b4a9[_0x1621('0x21')]();};}function saveUpdates(_0x25039c,_0x16116d){return function(_0x18d9c9){if(_0x18d9c9){return _0x18d9c9[_0x1621('0x22')](_0x25039c)['then'](function(_0x1f99f2){return _0x1f99f2;});}return null;};}function removeEntity(_0x260796,_0x34521f){return function(_0x554648){if(_0x554648){return _0x554648[_0x1621('0x23')]()['then'](function(){_0x260796[_0x1621('0x17')](0xcc)[_0x1621('0x18')]();});}};}function handleEntityNotFound(_0x26874a,_0x163360){return function(_0x14c02f){if(!_0x14c02f){_0x26874a['sendStatus'](0x194);}return _0x14c02f;};}function handleError(_0x4dcb5d,_0x2b51cd){_0x2b51cd=_0x2b51cd||0x1f4;return function(_0x2d76b0){logger['error'](_0x2d76b0[_0x1621('0x24')]);if(_0x2d76b0[_0x1621('0x25')]){delete _0x2d76b0[_0x1621('0x25')];}_0x4dcb5d[_0x1621('0x17')](_0x2b51cd)[_0x1621('0x26')](_0x2d76b0);};}exports[_0x1621('0x27')]=function(_0x48e5f3,_0x2c574a){var _0x14a84d={},_0x2a7737={},_0x526d14={'count':0x0,'rows':[]};var _0x34e367=_[_0x1621('0x28')](db[_0x1621('0x29')][_0x1621('0x2a')],function(_0x528201){return{'name':_0x528201[_0x1621('0x2b')],'type':_0x528201[_0x1621('0x2c')][_0x1621('0x2d')]};});_0x2a7737['model']=_[_0x1621('0x28')](_0x34e367,'name');_0x2a7737[_0x1621('0x2e')]=_['keys'](_0x48e5f3[_0x1621('0x2e')]);_0x2a7737[_0x1621('0x2f')]=_[_0x1621('0x30')](_0x2a7737[_0x1621('0x31')],_0x2a7737[_0x1621('0x2e')]);_0x14a84d[_0x1621('0x32')]=_[_0x1621('0x30')](_0x2a7737[_0x1621('0x31')],qs[_0x1621('0x33')](_0x48e5f3[_0x1621('0x2e')][_0x1621('0x33')]));_0x14a84d[_0x1621('0x32')]=_0x14a84d[_0x1621('0x32')][_0x1621('0x34')]?_0x14a84d[_0x1621('0x32')]:_0x2a7737['model'];if(!_0x48e5f3[_0x1621('0x2e')][_0x1621('0x35')]('nolimit')){_0x14a84d[_0x1621('0x1c')]=qs[_0x1621('0x1c')](_0x48e5f3[_0x1621('0x2e')][_0x1621('0x1c')]);_0x14a84d[_0x1621('0x1a')]=qs[_0x1621('0x1a')](_0x48e5f3[_0x1621('0x2e')][_0x1621('0x1a')]);}_0x14a84d[_0x1621('0x36')]=qs[_0x1621('0x37')](_0x48e5f3['query'][_0x1621('0x37')]);_0x14a84d['where']=qs[_0x1621('0x2f')](_[_0x1621('0x38')](_0x48e5f3[_0x1621('0x2e')],_0x2a7737[_0x1621('0x2f')]),_0x34e367);if(_0x48e5f3[_0x1621('0x2e')][_0x1621('0x39')]){_0x14a84d[_0x1621('0x3a')]=_[_0x1621('0x3b')](_0x14a84d[_0x1621('0x3a')],{'$or':_['map'](_0x34e367,function(_0xeeb291){if(_0xeeb291[_0x1621('0x2c')]!==_0x1621('0x3c')){var _0x57c7b0={};_0x57c7b0[_0xeeb291[_0x1621('0x25')]]={'$like':'%'+_0x48e5f3[_0x1621('0x2e')]['filter']+'%'};return _0x57c7b0;}})});}_0x14a84d=_['merge']({},_0x14a84d,_0x48e5f3['options']);var _0x19932a={'where':_0x14a84d['where']};return db[_0x1621('0x29')][_0x1621('0x1d')](_0x19932a)[_0x1621('0x3d')](function(_0x2c240e){_0x526d14[_0x1621('0x1d')]=_0x2c240e;if(_0x48e5f3['query'][_0x1621('0x3e')]){_0x14a84d[_0x1621('0x3f')]=[{'all':!![]}];}return db[_0x1621('0x29')][_0x1621('0x40')](_0x14a84d);})[_0x1621('0x3d')](function(_0x3f23c0){_0x526d14[_0x1621('0x41')]=_0x3f23c0;return _0x526d14;})['then'](respondWithFilteredResult(_0x2c574a,_0x14a84d))['catch'](handleError(_0x2c574a,null));};exports[_0x1621('0x42')]=function(_0x4aa3b9,_0x1dab07){var _0x409b40={'raw':!![],'where':{'id':_0x4aa3b9['params']['id']}},_0x2ce5b2={};_0x2ce5b2[_0x1621('0x31')]=_['keys'](db[_0x1621('0x29')]['rawAttributes']);_0x2ce5b2[_0x1621('0x2e')]=_[_0x1621('0x43')](_0x4aa3b9['query']);_0x2ce5b2['filters']=_[_0x1621('0x30')](_0x2ce5b2[_0x1621('0x31')],_0x2ce5b2[_0x1621('0x2e')]);_0x409b40[_0x1621('0x32')]=_[_0x1621('0x30')](_0x2ce5b2['model'],qs[_0x1621('0x33')](_0x4aa3b9[_0x1621('0x2e')][_0x1621('0x33')]));_0x409b40[_0x1621('0x32')]=_0x409b40[_0x1621('0x32')][_0x1621('0x34')]?_0x409b40[_0x1621('0x32')]:_0x2ce5b2[_0x1621('0x31')];if(_0x4aa3b9[_0x1621('0x2e')][_0x1621('0x3e')]){_0x409b40[_0x1621('0x3f')]=[{'all':!![]}];}_0x409b40=_[_0x1621('0x3b')]({},_0x409b40,_0x4aa3b9['options']);return db[_0x1621('0x29')][_0x1621('0x44')](_0x409b40)[_0x1621('0x3d')](handleEntityNotFound(_0x1dab07,null))['then'](respondWithResult(_0x1dab07,null))[_0x1621('0x45')](handleError(_0x1dab07,null));};exports['create']=function(_0xbf6e0,_0x4960e6){return db['VtigerField']['create'](_0xbf6e0[_0x1621('0x46')],{})[_0x1621('0x3d')](respondWithResult(_0x4960e6,0xc9))[_0x1621('0x45')](handleError(_0x4960e6,null));};exports[_0x1621('0x22')]=function(_0x38cf60,_0x382ac3){if(_0x38cf60[_0x1621('0x46')]['id']){delete _0x38cf60[_0x1621('0x46')]['id'];}return db[_0x1621('0x29')][_0x1621('0x44')]({'where':{'id':_0x38cf60['params']['id']}})[_0x1621('0x3d')](handleEntityNotFound(_0x382ac3,null))['then'](saveUpdates(_0x38cf60[_0x1621('0x46')],null))[_0x1621('0x3d')](respondWithResult(_0x382ac3,null))['catch'](handleError(_0x382ac3,null));};exports[_0x1621('0x23')]=function(_0x3371f2,_0x2ba512){return db[_0x1621('0x29')]['find']({'where':{'id':_0x3371f2[_0x1621('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ba512,null))[_0x1621('0x3d')](removeEntity(_0x2ba512,null))[_0x1621('0x45')](handleError(_0x2ba512,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 27bdee8..8cdbb7e 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 _0x7548=['FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x51782b,_0x384ea7){var _0x3174eb=function(_0x21cb97){while(--_0x21cb97){_0x51782b['push'](_0x51782b['shift']());}};_0x3174eb(++_0x384ea7);}(_0x7548,0xf8));var _0x8754=function(_0x1bbcd7,_0x6cbcf4){_0x1bbcd7=_0x1bbcd7-0x0;var _0x58ff2f=_0x7548[_0x1bbcd7];return _0x58ff2f;};'use strict';var _=require(_0x8754('0x0'));var util=require('util');var logger=require(_0x8754('0x1'))(_0x8754('0x2'));var moment=require('moment');var BPromise=require(_0x8754('0x3'));var rp=require(_0x8754('0x4'));var fs=require('fs');var path=require(_0x8754('0x5'));var rimraf=require('rimraf');var config=require(_0x8754('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x8754('0x7')]=function(_0x362559,_0x4b3abc){return _0x362559[_0x8754('0x8')](_0x8754('0x9'),attributes,{'tableName':_0x8754('0xa'),'paranoid':![],'indexes':[{'name':_0x8754('0xb'),'fields':['idField',_0x8754('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd707=['moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd707,0x1eb));var _0x7d70=function(_0x4f953c,_0x242bad){_0x4f953c=_0x4f953c-0x0;var _0x3ed5f6=_0xd707[_0x4f953c];return _0x3ed5f6;};'use strict';var _=require(_0x7d70('0x0'));var util=require(_0x7d70('0x1'));var logger=require(_0x7d70('0x2'))(_0x7d70('0x3'));var moment=require(_0x7d70('0x4'));var BPromise=require(_0x7d70('0x5'));var rp=require(_0x7d70('0x6'));var fs=require('fs');var path=require(_0x7d70('0x7'));var rimraf=require(_0x7d70('0x8'));var config=require('../../config/environment');var attributes=require(_0x7d70('0x9'));module[_0x7d70('0xa')]=function(_0x5e8167,_0x388c7a){return _0x5e8167['define'](_0x7d70('0xb'),attributes,{'tableName':_0x7d70('0xc'),'paranoid':![],'indexes':[{'name':_0x7d70('0xd'),'fields':[_0x7d70('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 23c7db5..0ea236c 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 _0x923d=['../../config/environment','jayson/promise','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x59cabb,_0x2a8fcd){var _0x5ca1b9=function(_0x2111ba){while(--_0x2111ba){_0x59cabb['push'](_0x59cabb['shift']());}};_0x5ca1b9(++_0x2a8fcd);}(_0x923d,0xdf));var _0xd923=function(_0x3b3faf,_0x4b11e1){_0x3b3faf=_0x3b3faf-0x0;var _0xc163eb=_0x923d[_0x3b3faf];return _0xc163eb;};'use strict';var _=require('lodash');var util=require(_0xd923('0x0'));var moment=require(_0xd923('0x1'));var BPromise=require(_0xd923('0x2'));var rs=require(_0xd923('0x3'));var fs=require('fs');var Redis=require(_0xd923('0x4'));var db=require(_0xd923('0x5'))['db'];var utils=require(_0xd923('0x6'));var logger=require(_0xd923('0x7'))('rpc');var config=require(_0xd923('0x8'));var jayson=require(_0xd923('0x9'));var client=jayson['client'][_0xd923('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x96a3ed,_0x120216,_0x4e43ba){return new BPromise(function(_0x5c4bac,_0x40064a){return client[_0xd923('0xb')](_0x96a3ed,_0x4e43ba)[_0xd923('0xc')](function(_0x1dbd8a){logger['info'](_0xd923('0xd'),_0x120216,_0xd923('0xe'));logger[_0xd923('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x120216,'request\x20sent',JSON['stringify'](_0x1dbd8a));if(_0x1dbd8a[_0xd923('0x10')]){if(_0x1dbd8a[_0xd923('0x10')][_0xd923('0x11')]===0x1f4){logger['error'](_0xd923('0xd'),_0x120216,_0x1dbd8a[_0xd923('0x10')][_0xd923('0x12')]);return _0x40064a(_0x1dbd8a[_0xd923('0x10')][_0xd923('0x12')]);}logger[_0xd923('0x10')](_0xd923('0xd'),_0x120216,_0x1dbd8a[_0xd923('0x10')][_0xd923('0x12')]);return _0x5c4bac(_0x1dbd8a[_0xd923('0x10')]['message']);}else{logger['info'](_0xd923('0xd'),_0x120216,_0xd923('0xe'));_0x5c4bac(_0x1dbd8a[_0xd923('0x13')][_0xd923('0x12')]);}})[_0xd923('0x14')](function(_0x36e9b6){logger['error'](_0xd923('0xd'),_0x120216,_0x36e9b6);_0x40064a(_0x36e9b6);});});} \ No newline at end of file +var _0x86bf=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','VtigerField,\x20%s,\x20%s','message','catch'];(function(_0x5d67a9,_0x3563b1){var _0x5d3570=function(_0xae1427){while(--_0xae1427){_0x5d67a9['push'](_0x5d67a9['shift']());}};_0x5d3570(++_0x3563b1);}(_0x86bf,0x176));var _0xf86b=function(_0x42977a,_0x51d24b){_0x42977a=_0x42977a-0x0;var _0x5f5244=_0x86bf[_0x42977a];return _0x5f5244;};'use strict';var _=require(_0xf86b('0x0'));var util=require(_0xf86b('0x1'));var moment=require(_0xf86b('0x2'));var BPromise=require(_0xf86b('0x3'));var rs=require(_0xf86b('0x4'));var fs=require('fs');var Redis=require(_0xf86b('0x5'));var db=require(_0xf86b('0x6'))['db'];var utils=require(_0xf86b('0x7'));var logger=require(_0xf86b('0x8'))(_0xf86b('0x9'));var config=require(_0xf86b('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf86b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1147ea,_0x153ce4,_0x5da925){return new BPromise(function(_0x58b3cf,_0x15c4cc){return client[_0xf86b('0xc')](_0x1147ea,_0x5da925)[_0xf86b('0xd')](function(_0x4b4ea1){logger[_0xf86b('0xe')]('VtigerField,\x20%s,\x20%s',_0x153ce4,_0xf86b('0xf'));logger['debug'](_0xf86b('0x10'),_0x153ce4,_0xf86b('0xf'),JSON['stringify'](_0x4b4ea1));if(_0x4b4ea1[_0xf86b('0x11')]){if(_0x4b4ea1[_0xf86b('0x11')][_0xf86b('0x12')]===0x1f4){logger[_0xf86b('0x11')](_0xf86b('0x13'),_0x153ce4,_0x4b4ea1[_0xf86b('0x11')][_0xf86b('0x14')]);return _0x15c4cc(_0x4b4ea1[_0xf86b('0x11')]['message']);}logger[_0xf86b('0x11')]('VtigerField,\x20%s,\x20%s',_0x153ce4,_0x4b4ea1[_0xf86b('0x11')][_0xf86b('0x14')]);return _0x58b3cf(_0x4b4ea1[_0xf86b('0x11')][_0xf86b('0x14')]);}else{logger[_0xf86b('0xe')](_0xf86b('0x13'),_0x153ce4,_0xf86b('0xf'));_0x58b3cf(_0x4b4ea1['result'][_0xf86b('0x14')]);}})[_0xf86b('0x15')](function(_0xdbb8bc){logger[_0xf86b('0x11')](_0xf86b('0x13'),_0x153ce4,_0xdbb8bc);_0x15c4cc(_0xdbb8bc);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9db9ad8..420ef07 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 _0xcd40=['../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x30946c,_0x4d0c73){var _0x1315a8=function(_0x445004){while(--_0x445004){_0x30946c['push'](_0x30946c['shift']());}};_0x1315a8(++_0x4d0c73);}(_0xcd40,0x101));var _0x0cd4=function(_0x419ffd,_0x10bdfe){_0x419ffd=_0x419ffd-0x0;var _0xb0b19d=_0xcd40[_0x419ffd];return _0xb0b19d;};'use strict';var multer=require(_0x0cd4('0x0'));var util=require(_0x0cd4('0x1'));var path=require(_0x0cd4('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cd4('0x3'));var router=express[_0x0cd4('0x4')]();var fs_extra=require(_0x0cd4('0x5'));var auth=require(_0x0cd4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0cd4('0x7'));var controller=require(_0x0cd4('0x8'));router[_0x0cd4('0x9')]('/',auth['isAuthenticated'](),controller[_0x0cd4('0xa')]);router['get'](_0x0cd4('0xb'),auth[_0x0cd4('0xc')](),controller['show']);router[_0x0cd4('0x9')]('/:id/configurations',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0xd')]);router[_0x0cd4('0x9')](_0x0cd4('0xe'),auth[_0x0cd4('0xc')](),controller[_0x0cd4('0xf')]);router[_0x0cd4('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0x11')]);router[_0x0cd4('0x12')](_0x0cd4('0xb'),auth[_0x0cd4('0xc')](),controller['update']);router[_0x0cd4('0x13')]('/:id',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0x14')]);module[_0x0cd4('0x15')]=router; \ No newline at end of file +var _0xdbff=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','update'];(function(_0xf7f67d,_0x56d2ca){var _0xf9b73=function(_0x436a37){while(--_0x436a37){_0xf7f67d['push'](_0xf7f67d['shift']());}};_0xf9b73(++_0x56d2ca);}(_0xdbff,0x87));var _0xfdbf=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xdbff[_0x313c96];return _0x522f53;};'use strict';var multer=require(_0xfdbf('0x0'));var util=require('util');var path=require(_0xfdbf('0x1'));var timeout=require(_0xfdbf('0x2'));var express=require(_0xfdbf('0x3'));var router=express['Router']();var fs_extra=require(_0xfdbf('0x4'));var auth=require(_0xfdbf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfdbf('0x6'));var controller=require(_0xfdbf('0x7'));router[_0xfdbf('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xfdbf('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0xfdbf('0xa')](),controller[_0xfdbf('0xb')]);router[_0xfdbf('0x8')](_0xfdbf('0xc'),auth[_0xfdbf('0xa')](),controller[_0xfdbf('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfdbf('0xe')]);router['post'](_0xfdbf('0xf'),auth[_0xfdbf('0xa')](),controller[_0xfdbf('0x10')]);router[_0xfdbf('0x11')](_0xfdbf('0x9'),auth[_0xfdbf('0xa')](),controller[_0xfdbf('0x12')]);router[_0xfdbf('0x13')]('/:id',auth[_0xfdbf('0xa')](),controller[_0xfdbf('0x14')]);module[_0xfdbf('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 10ee8df..ca0a6c4 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 _0x1115=['username','remoteUri','token','password','ENUM','integrationTab','exports','STRING'];(function(_0x4cc33a,_0x320a74){var _0x5b528f=function(_0x101f5a){while(--_0x101f5a){_0x4cc33a['push'](_0x4cc33a['shift']());}};_0x5b528f(++_0x320a74);}(_0x1115,0x1b6));var _0x5111=function(_0x7597e5,_0x545317){_0x7597e5=_0x7597e5-0x0;var _0x2f4acd=_0x1115[_0x7597e5];return _0x2f4acd;};'use strict';var Sequelize=require('sequelize');module[_0x5111('0x0')]={'name':{'type':Sequelize[_0x5111('0x1')]},'description':{'type':Sequelize[_0x5111('0x1')]},'username':{'type':Sequelize[_0x5111('0x1')],'unique':_0x5111('0x2')},'password':{'type':Sequelize[_0x5111('0x1')]},'token':{'type':Sequelize[_0x5111('0x1')]},'remoteUri':{'type':Sequelize[_0x5111('0x1')],'unique':_0x5111('0x3')},'authType':{'type':Sequelize['ENUM']('password',_0x5111('0x4')),'defaultValue':_0x5111('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5111('0x6')](_0x5111('0x7'),'newTab'),'defaultValue':_0x5111('0x7')}}; \ No newline at end of file +var _0xf072=['exports','STRING','ENUM','password','token','integrationTab','newTab','sequelize'];(function(_0x218733,_0x34c8b1){var _0x281c92=function(_0x120193){while(--_0x120193){_0x218733['push'](_0x218733['shift']());}};_0x281c92(++_0x34c8b1);}(_0xf072,0x1cf));var _0x2f07=function(_0x4704a1,_0x3c2642){_0x4704a1=_0x4704a1-0x0;var _0x194ae4=_0xf072[_0x4704a1];return _0x194ae4;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'name':{'type':Sequelize[_0x2f07('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2f07('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2f07('0x2')]},'token':{'type':Sequelize[_0x2f07('0x2')]},'remoteUri':{'type':Sequelize[_0x2f07('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x2f07('0x3')](_0x2f07('0x4'),_0x2f07('0x5')),'defaultValue':_0x2f07('0x4')},'serverUrl':{'type':Sequelize[_0x2f07('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2f07('0x3')](_0x2f07('0x6'),_0x2f07('0x7')),'defaultValue':_0x2f07('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a1b3672..489a5c1 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 _0x0972=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','error','name','send','index','map','ZendeskAccount','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','AccountId','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xa23d9a,_0x206c18){var _0x2a3d23=function(_0x2fa503){while(--_0x2fa503){_0xa23d9a['push'](_0xa23d9a['shift']());}};_0x2a3d23(++_0x206c18);}(_0x0972,0x64));var _0x2097=function(_0x4c7818,_0x2ab84f){_0x4c7818=_0x4c7818-0x0;var _0x2900e2=_0x0972[_0x4c7818];return _0x2900e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];var integrations=require(_0x2097('0x1a'));function respondWithStatusCode(_0x170005,_0x16871b){_0x16871b=_0x16871b||0xcc;return function(_0x24ca42){if(_0x24ca42){return _0x170005[_0x2097('0x1b')](_0x16871b);}return _0x170005[_0x2097('0x1c')](_0x16871b)[_0x2097('0x1d')]();};}function respondWithResult(_0x2c3e41,_0x354387){_0x354387=_0x354387||0xc8;return function(_0x5d0a43){if(_0x5d0a43){return _0x2c3e41[_0x2097('0x1c')](_0x354387)[_0x2097('0x1e')](_0x5d0a43);}};}function respondWithFilteredResult(_0x4d31bc,_0x4eec05){return function(_0x4fc8c5){if(_0x4fc8c5){var _0x409deb=typeof _0x4eec05['offset']===_0x2097('0x1f')&&typeof _0x4eec05[_0x2097('0x20')]===_0x2097('0x1f');var _0x1347e4=_0x4fc8c5[_0x2097('0x21')];var _0x53e2b4=_0x409deb?0x0:_0x4eec05[_0x2097('0x22')];var _0x140094=_0x409deb?_0x4fc8c5[_0x2097('0x21')]:_0x4eec05[_0x2097('0x22')]+_0x4eec05[_0x2097('0x20')];var _0x235304;if(_0x140094>=_0x1347e4){_0x140094=_0x1347e4;_0x235304=0xc8;}else{_0x235304=0xce;}_0x4d31bc[_0x2097('0x1c')](_0x235304);return _0x4d31bc[_0x2097('0x23')]('Content-Range',_0x53e2b4+'-'+_0x140094+'/'+_0x1347e4)['json'](_0x4fc8c5);}return null;};}function patchUpdates(_0xf65dc6){return function(_0x569c21){try{jsonpatch[_0x2097('0x24')](_0x569c21,_0xf65dc6,!![]);}catch(_0x1ac5f1){return BPromise['reject'](_0x1ac5f1);}return _0x569c21[_0x2097('0x25')]();};}function saveUpdates(_0x5b0582,_0x2e17c8){return function(_0xf32d3f){if(_0xf32d3f){return _0xf32d3f[_0x2097('0x26')](_0x5b0582)[_0x2097('0x27')](function(_0x36b15e){return _0x36b15e;});}return null;};}function removeEntity(_0x35047b,_0x56390a){return function(_0xae5f9){if(_0xae5f9){return _0xae5f9['destroy']()[_0x2097('0x27')](function(){_0x35047b[_0x2097('0x1c')](0xcc)[_0x2097('0x1d')]();});}};}function handleEntityNotFound(_0x9f59bc,_0x499988){return function(_0x2d683a){if(!_0x2d683a){_0x9f59bc[_0x2097('0x1b')](0x194);}return _0x2d683a;};}function handleError(_0x56af3b,_0x1229fc){_0x1229fc=_0x1229fc||0x1f4;return function(_0x5ed0fa){logger[_0x2097('0x28')](_0x5ed0fa['stack']);if(_0x5ed0fa[_0x2097('0x29')]){delete _0x5ed0fa[_0x2097('0x29')];}_0x56af3b[_0x2097('0x1c')](_0x1229fc)[_0x2097('0x2a')](_0x5ed0fa);};}exports[_0x2097('0x2b')]=function(_0x36228c,_0x450e0b){var _0x4b443d={},_0x11242f={},_0x14d964={'count':0x0,'rows':[]};var _0x5cce55=_[_0x2097('0x2c')](db[_0x2097('0x2d')]['rawAttributes'],function(_0x4d0916){return{'name':_0x4d0916[_0x2097('0x2e')],'type':_0x4d0916[_0x2097('0x2f')][_0x2097('0x30')]};});_0x11242f[_0x2097('0x31')]=_[_0x2097('0x2c')](_0x5cce55,_0x2097('0x29'));_0x11242f['query']=_[_0x2097('0x32')](_0x36228c['query']);_0x11242f[_0x2097('0x33')]=_[_0x2097('0x34')](_0x11242f[_0x2097('0x31')],_0x11242f[_0x2097('0x35')]);_0x4b443d[_0x2097('0x36')]=_[_0x2097('0x34')](_0x11242f[_0x2097('0x31')],qs[_0x2097('0x37')](_0x36228c[_0x2097('0x35')]['fields']));_0x4b443d[_0x2097('0x36')]=_0x4b443d[_0x2097('0x36')][_0x2097('0x38')]?_0x4b443d['attributes']:_0x11242f[_0x2097('0x31')];if(!_0x36228c[_0x2097('0x35')][_0x2097('0x39')](_0x2097('0x3a'))){_0x4b443d['limit']=qs['limit'](_0x36228c['query'][_0x2097('0x20')]);_0x4b443d[_0x2097('0x22')]=qs[_0x2097('0x22')](_0x36228c[_0x2097('0x35')][_0x2097('0x22')]);}_0x4b443d[_0x2097('0x3b')]=qs['sort'](_0x36228c[_0x2097('0x35')][_0x2097('0x3c')]);_0x4b443d[_0x2097('0x3d')]=qs[_0x2097('0x33')](_[_0x2097('0x3e')](_0x36228c[_0x2097('0x35')],_0x11242f['filters']),_0x5cce55);if(_0x36228c[_0x2097('0x35')][_0x2097('0x3f')]){_0x4b443d[_0x2097('0x3d')]=_['merge'](_0x4b443d['where'],{'$or':_[_0x2097('0x2c')](_0x5cce55,function(_0x372693){if(_0x372693[_0x2097('0x2f')]!==_0x2097('0x40')){var _0x41c9e6={};_0x41c9e6[_0x372693[_0x2097('0x29')]]={'$like':'%'+_0x36228c[_0x2097('0x35')][_0x2097('0x3f')]+'%'};return _0x41c9e6;}})});}_0x4b443d=_[_0x2097('0x41')]({},_0x4b443d,_0x36228c[_0x2097('0x42')]);var _0x337979={'where':_0x4b443d[_0x2097('0x3d')]};return db['ZendeskAccount'][_0x2097('0x21')](_0x337979)[_0x2097('0x27')](function(_0x7b556c){_0x14d964['count']=_0x7b556c;if(_0x36228c[_0x2097('0x35')][_0x2097('0x43')]){_0x4b443d[_0x2097('0x44')]=[{'all':!![]}];}return db[_0x2097('0x2d')][_0x2097('0x45')](_0x4b443d);})[_0x2097('0x27')](function(_0x29dab3){_0x14d964[_0x2097('0x46')]=_0x29dab3;return _0x14d964;})['then'](respondWithFilteredResult(_0x450e0b,_0x4b443d))[_0x2097('0x47')](handleError(_0x450e0b,null));};exports[_0x2097('0x48')]=function(_0x186ca5,_0x3288ae){var _0x12e0e2={'raw':![],'where':{'id':_0x186ca5[_0x2097('0x49')]['id']}},_0xe3ac1b={};_0xe3ac1b[_0x2097('0x31')]=_['keys'](db[_0x2097('0x2d')]['rawAttributes']);_0xe3ac1b[_0x2097('0x35')]=_[_0x2097('0x32')](_0x186ca5[_0x2097('0x35')]);_0xe3ac1b[_0x2097('0x33')]=_[_0x2097('0x34')](_0xe3ac1b['model'],_0xe3ac1b[_0x2097('0x35')]);_0x12e0e2[_0x2097('0x36')]=_[_0x2097('0x34')](_0xe3ac1b[_0x2097('0x31')],qs[_0x2097('0x37')](_0x186ca5['query'][_0x2097('0x37')]));_0x12e0e2[_0x2097('0x36')]=_0x12e0e2[_0x2097('0x36')][_0x2097('0x38')]?_0x12e0e2[_0x2097('0x36')]:_0xe3ac1b[_0x2097('0x31')];if(_0x186ca5[_0x2097('0x35')][_0x2097('0x43')]){_0x12e0e2['include']=[{'all':!![]}];}_0x12e0e2=_[_0x2097('0x41')]({},_0x12e0e2,_0x186ca5[_0x2097('0x42')]);return db[_0x2097('0x2d')][_0x2097('0x4a')](_0x12e0e2)['then'](handleEntityNotFound(_0x3288ae,null))['then'](respondWithResult(_0x3288ae,null))['catch'](handleError(_0x3288ae,null));};exports[_0x2097('0x4b')]=function(_0x396979,_0x4c4ef9){return db[_0x2097('0x2d')][_0x2097('0x4b')](_0x396979['body'],{})['then'](respondWithResult(_0x4c4ef9,0xc9))[_0x2097('0x47')](handleError(_0x4c4ef9,null));};exports[_0x2097('0x26')]=function(_0x1b4de6,_0x5a0c05){if(_0x1b4de6[_0x2097('0x4c')]['id']){delete _0x1b4de6[_0x2097('0x4c')]['id'];}return db['ZendeskAccount'][_0x2097('0x4a')]({'where':{'id':_0x1b4de6[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x5a0c05,null))[_0x2097('0x27')](saveUpdates(_0x1b4de6[_0x2097('0x4c')],null))['then'](respondWithResult(_0x5a0c05,null))['catch'](handleError(_0x5a0c05,null));};exports[_0x2097('0x4d')]=function(_0x39f9cb,_0x329632){return db['ZendeskAccount']['find']({'where':{'id':_0x39f9cb[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x329632,null))['then'](removeEntity(_0x329632,null))[_0x2097('0x47')](handleError(_0x329632,null));};exports[_0x2097('0x4e')]=function(_0x12bdbd,_0x33490e,_0x390a52){var _0x4a709a={};var _0x42b222={};var _0x228b60;var _0x190859;return db['ZendeskAccount'][_0x2097('0x4f')]({'where':{'id':_0x12bdbd[_0x2097('0x49')]['id']}})['then'](handleEntityNotFound(_0x33490e,null))[_0x2097('0x27')](function(_0x4d6ed6){if(_0x4d6ed6){_0x228b60=_0x4d6ed6;_0x42b222[_0x2097('0x31')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x42b222[_0x2097('0x35')]=_['keys'](_0x12bdbd['query']);_0x42b222[_0x2097('0x33')]=_['intersection'](_0x42b222[_0x2097('0x31')],_0x42b222[_0x2097('0x35')]);_0x4a709a['attributes']=_[_0x2097('0x34')](_0x42b222[_0x2097('0x31')],qs[_0x2097('0x37')](_0x12bdbd[_0x2097('0x35')][_0x2097('0x37')]));_0x4a709a['attributes']=_0x4a709a[_0x2097('0x36')]['length']?_0x4a709a[_0x2097('0x36')]:_0x42b222[_0x2097('0x31')];_0x4a709a[_0x2097('0x3b')]=qs['sort'](_0x12bdbd[_0x2097('0x35')][_0x2097('0x3c')]);_0x4a709a[_0x2097('0x3d')]=qs[_0x2097('0x33')](_[_0x2097('0x3e')](_0x12bdbd['query'],_0x42b222['filters']));if(_0x12bdbd[_0x2097('0x35')][_0x2097('0x3f')]){_0x4a709a['where']=_['merge'](_0x4a709a['where'],{'$or':_['map'](_0x4a709a[_0x2097('0x36')],function(_0x4cdc65){var _0x4445ff={};_0x4445ff[_0x4cdc65]={'$like':'%'+_0x12bdbd[_0x2097('0x35')]['filter']+'%'};return _0x4445ff;})});}_0x4a709a=_[_0x2097('0x41')]({},_0x4a709a,_0x12bdbd[_0x2097('0x42')]);return _0x228b60[_0x2097('0x4e')](_0x4a709a);}})[_0x2097('0x27')](function(_0x2a2673){if(_0x2a2673){_0x190859=_0x2a2673[_0x2097('0x38')];if(!_0x12bdbd[_0x2097('0x35')][_0x2097('0x39')](_0x2097('0x3a'))){_0x4a709a['limit']=qs[_0x2097('0x20')](_0x12bdbd[_0x2097('0x35')][_0x2097('0x20')]);_0x4a709a[_0x2097('0x22')]=qs[_0x2097('0x22')](_0x12bdbd[_0x2097('0x35')]['offset']);}return _0x228b60[_0x2097('0x4e')](_0x4a709a);}})[_0x2097('0x27')](function(_0xcabda7){if(_0xcabda7){return _0xcabda7?{'count':_0x190859,'rows':_0xcabda7}:null;}})[_0x2097('0x27')](respondWithResult(_0x33490e,null))[_0x2097('0x47')](handleError(_0x33490e,null));};exports['addConfiguration']=function(_0x437b79,_0x28dd95,_0x5ea02c){if(_0x437b79['body']['id']){delete _0x437b79['body']['id'];}return db[_0x2097('0x2d')][_0x2097('0x4f')]({'where':{'id':_0x437b79[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x28dd95,null))[_0x2097('0x27')](function(_0x18d90a){if(_0x18d90a){_0x437b79[_0x2097('0x4c')][_0x2097('0x50')]=_0x18d90a['id'];_0x437b79[_0x2097('0x4c')]['Subjects']=integrations['getSubjects'](_0x437b79[_0x2097('0x4c')][_0x2097('0x51')],_0x437b79[_0x2097('0x4c')][_0x2097('0x2f')]);_0x437b79[_0x2097('0x4c')][_0x2097('0x52')]=integrations['getDescriptions'](_0x437b79[_0x2097('0x4c')][_0x2097('0x51')],_0x437b79[_0x2097('0x4c')][_0x2097('0x2f')]);return db['ZendeskConfiguration']['create'](_0x437b79[_0x2097('0x4c')],{'include':[{'model':db[_0x2097('0x53')],'as':'Subjects'},{'model':db[_0x2097('0x53')],'as':_0x2097('0x52')}]});}return null;})[_0x2097('0x27')](respondWithResult(_0x28dd95,null))[_0x2097('0x47')](handleError(_0x28dd95,null));};exports[_0x2097('0x54')]=function(_0x3b5519,_0x10f891,_0x2c6f24){var _0x54159e='';return db[_0x2097('0x2d')][_0x2097('0x4f')]({'where':{'id':_0x3b5519['params']['id']},'attributes':['id',_0x2097('0x55'),_0x2097('0x56'),_0x2097('0x57'),_0x2097('0x58'),_0x2097('0x59')]})[_0x2097('0x27')](handleEntityNotFound(_0x10f891,null))[_0x2097('0x27')](function(_0x22d1ce){if(_0x22d1ce){_0x54159e=_0x22d1ce[_0x2097('0x59')];var _0x1b7021=_0x54159e[_0x2097('0x5a')](-0x1);if(_0x1b7021==='/'){_0x54159e=_0x54159e['substring'](0x0,_0x54159e[_0x2097('0x5b')](_0x1b7021));}var _0x41abda={'method':_0x2097('0x5c'),'uri':util[_0x2097('0x5d')](_0x2097('0x5e'),_0x54159e,'ticket_fields'),'json':!![]};switch(_0x22d1ce[_0x2097('0x58')]){case _0x2097('0x56'):_0x41abda[_0x2097('0x5f')]={'Authorization':util['format'](_0x2097('0x60'),new Buffer(util['format'](_0x2097('0x61'),_0x22d1ce['username'],_0x22d1ce[_0x2097('0x56')]))['toString'](_0x2097('0x62')))};break;case'token':_0x41abda[_0x2097('0x5f')]={'Authorization':util[_0x2097('0x5d')](_0x2097('0x60'),new Buffer(util[_0x2097('0x5d')](_0x2097('0x63'),_0x22d1ce['username'],_0x22d1ce[_0x2097('0x57')]))[_0x2097('0x64')](_0x2097('0x62')))};break;default:throw new db[(_0x2097('0x65'))][(_0x2097('0x66'))](_0x2097('0x67'));}return rp(_0x41abda);}})[_0x2097('0x27')](function(_0x360dd5){if(_0x360dd5){var _0xd4e39d=[_0x2097('0x68'),_0x2097('0x69'),_0x2097('0x6a'),_0x2097('0x6b')];_[_0x2097('0x6c')](_0x360dd5[_0x2097('0x6d')],function(_0xf3831c){return _0xd4e39d['includes'](_0xf3831c[_0x2097('0x2f')]);});return{'count':_0x360dd5['ticket_fields']['length'],'rows':_[_0x2097('0x2c')](_0x360dd5[_0x2097('0x6d')],function(_0x107fab){return{'id':_0x107fab['id'],'name':_0x107fab['position']>0x7?_0x107fab[_0x2097('0x6e')]:_0x107fab[_0x2097('0x2f')],'custom':_0x107fab[_0x2097('0x6f')]>0x7?!![]:![],'options':_0x107fab[_0x2097('0x70')]?_0x107fab['system_field_options']:_0x107fab[_0x2097('0x71')]?_0x107fab['custom_field_options']:[]};})};}})[_0x2097('0x27')](respondWithResult(_0x10f891,null))[_0x2097('0x47')](function(_0x2619db){var _0x1e380e=_0x3b5519['query'][_0x2097('0x72')]?0x1f4:_0x2619db[_0x2097('0x73')]||0x1f4;logger[_0x2097('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x2097('0x54'),_0x1e380e,JSON[_0x2097('0x74')](_0x2619db));delete _0x2619db[_0x2097('0x29')];if(_0x1e380e===0x191){_0x1e380e=0x190;}_0x10f891['status'](_0x1e380e)[_0x2097('0x2a')](_0x3b5519[_0x2097('0x35')][_0x2097('0x72')]?{'message':_0x2097('0x75'),'statusCode':_0x2619db[_0x2097('0x73')]}:_0x2619db);});}; \ No newline at end of file +var _0x7af2=['pick','VIRTUAL','filter','merge','options','includeAll','findAll','params','rawAttributes','include','catch','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters'];(function(_0x49e21c,_0x3f59c7){var _0x3ddfd0=function(_0x9ddcfc){while(--_0x9ddcfc){_0x49e21c['push'](_0x49e21c['shift']());}};_0x3ddfd0(++_0x3f59c7);}(_0x7af2,0x119));var _0x27af=function(_0x5f4cbc,_0x28fad7){_0x5f4cbc=_0x5f4cbc-0x0;var _0x3c7140=_0x7af2[_0x5f4cbc];return _0x3c7140;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x406340,_0x203501){_0x203501=_0x203501||0xcc;return function(_0x1fd964){if(_0x1fd964){return _0x406340[_0x27af('0x17')](_0x203501);}return _0x406340[_0x27af('0x18')](_0x203501)[_0x27af('0x19')]();};}function respondWithResult(_0x234825,_0x3da435){_0x3da435=_0x3da435||0xc8;return function(_0x423222){if(_0x423222){return _0x234825[_0x27af('0x18')](_0x3da435)[_0x27af('0x1a')](_0x423222);}};}function respondWithFilteredResult(_0x9c2d4b,_0x2d7800){return function(_0x3102c4){if(_0x3102c4){var _0x2bfc9=typeof _0x2d7800[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x2d7800[_0x27af('0x1d')]==='undefined';var _0x315661=_0x3102c4[_0x27af('0x1e')];var _0x5997ae=_0x2bfc9?0x0:_0x2d7800['offset'];var _0x20a6d7=_0x2bfc9?_0x3102c4[_0x27af('0x1e')]:_0x2d7800[_0x27af('0x1b')]+_0x2d7800[_0x27af('0x1d')];var _0xec699a;if(_0x20a6d7>=_0x315661){_0x20a6d7=_0x315661;_0xec699a=0xc8;}else{_0xec699a=0xce;}_0x9c2d4b['status'](_0xec699a);return _0x9c2d4b[_0x27af('0x1f')](_0x27af('0x20'),_0x5997ae+'-'+_0x20a6d7+'/'+_0x315661)[_0x27af('0x1a')](_0x3102c4);}return null;};}function patchUpdates(_0x5e7c19){return function(_0x19afb1){try{jsonpatch[_0x27af('0x21')](_0x19afb1,_0x5e7c19,!![]);}catch(_0x2ae47e){return BPromise['reject'](_0x2ae47e);}return _0x19afb1[_0x27af('0x22')]();};}function saveUpdates(_0x2460f4,_0x30720b){return function(_0x2af76d){if(_0x2af76d){return _0x2af76d[_0x27af('0x23')](_0x2460f4)[_0x27af('0x24')](function(_0x43dd9e){return _0x43dd9e;});}return null;};}function removeEntity(_0x35b36d,_0x2e1bb0){return function(_0x49780b){if(_0x49780b){return _0x49780b['destroy']()['then'](function(){_0x35b36d[_0x27af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12625c,_0x396326){return function(_0x4ba49f){if(!_0x4ba49f){_0x12625c[_0x27af('0x17')](0x194);}return _0x4ba49f;};}function handleError(_0x1d9341,_0x463e36){_0x463e36=_0x463e36||0x1f4;return function(_0x424490){logger[_0x27af('0x25')](_0x424490[_0x27af('0x26')]);if(_0x424490[_0x27af('0x27')]){delete _0x424490['name'];}_0x1d9341[_0x27af('0x18')](_0x463e36)[_0x27af('0x28')](_0x424490);};}exports[_0x27af('0x29')]=function(_0xe009a,_0x25d65a){var _0xa08dd9={},_0x42a5b7={},_0x2b26ac={'count':0x0,'rows':[]};var _0x4406e2=_[_0x27af('0x2a')](db[_0x27af('0x2b')]['rawAttributes'],function(_0x15e867){return{'name':_0x15e867[_0x27af('0x2c')],'type':_0x15e867[_0x27af('0x2d')][_0x27af('0x2e')]};});_0x42a5b7[_0x27af('0x2f')]=_[_0x27af('0x2a')](_0x4406e2,'name');_0x42a5b7['query']=_[_0x27af('0x30')](_0xe009a[_0x27af('0x31')]);_0x42a5b7['filters']=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],_0x42a5b7[_0x27af('0x31')]);_0xa08dd9[_0x27af('0x33')]=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],qs[_0x27af('0x34')](_0xe009a[_0x27af('0x31')][_0x27af('0x34')]));_0xa08dd9[_0x27af('0x33')]=_0xa08dd9[_0x27af('0x33')]['length']?_0xa08dd9['attributes']:_0x42a5b7[_0x27af('0x2f')];if(!_0xe009a[_0x27af('0x31')]['hasOwnProperty'](_0x27af('0x35'))){_0xa08dd9[_0x27af('0x1d')]=qs['limit'](_0xe009a[_0x27af('0x31')][_0x27af('0x1d')]);_0xa08dd9[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0xe009a[_0x27af('0x31')]['offset']);}_0xa08dd9[_0x27af('0x36')]=qs[_0x27af('0x37')](_0xe009a['query']['sort']);_0xa08dd9[_0x27af('0x38')]=qs[_0x27af('0x39')](_[_0x27af('0x3a')](_0xe009a[_0x27af('0x31')],_0x42a5b7[_0x27af('0x39')]),_0x4406e2);if(_0xe009a[_0x27af('0x31')]['filter']){_0xa08dd9[_0x27af('0x38')]=_['merge'](_0xa08dd9[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x4406e2,function(_0x2a6b14){if(_0x2a6b14[_0x27af('0x2d')]!==_0x27af('0x3b')){var _0x5f5504={};_0x5f5504[_0x2a6b14[_0x27af('0x27')]]={'$like':'%'+_0xe009a[_0x27af('0x31')][_0x27af('0x3c')]+'%'};return _0x5f5504;}})});}_0xa08dd9=_[_0x27af('0x3d')]({},_0xa08dd9,_0xe009a[_0x27af('0x3e')]);var _0x32b558={'where':_0xa08dd9[_0x27af('0x38')]};return db[_0x27af('0x2b')][_0x27af('0x1e')](_0x32b558)[_0x27af('0x24')](function(_0xda424e){_0x2b26ac[_0x27af('0x1e')]=_0xda424e;if(_0xe009a[_0x27af('0x31')][_0x27af('0x3f')]){_0xa08dd9['include']=[{'all':!![]}];}return db[_0x27af('0x2b')][_0x27af('0x40')](_0xa08dd9);})[_0x27af('0x24')](function(_0x373c05){_0x2b26ac['rows']=_0x373c05;return _0x2b26ac;})[_0x27af('0x24')](respondWithFilteredResult(_0x25d65a,_0xa08dd9))['catch'](handleError(_0x25d65a,null));};exports['show']=function(_0x2425dd,_0x3c9c81){var _0x279f99={'raw':![],'where':{'id':_0x2425dd[_0x27af('0x41')]['id']}},_0x17efd6={};_0x17efd6[_0x27af('0x2f')]=_[_0x27af('0x30')](db[_0x27af('0x2b')][_0x27af('0x42')]);_0x17efd6[_0x27af('0x31')]=_[_0x27af('0x30')](_0x2425dd[_0x27af('0x31')]);_0x17efd6['filters']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],_0x17efd6['query']);_0x279f99['attributes']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],qs[_0x27af('0x34')](_0x2425dd[_0x27af('0x31')][_0x27af('0x34')]));_0x279f99['attributes']=_0x279f99[_0x27af('0x33')]['length']?_0x279f99[_0x27af('0x33')]:_0x17efd6[_0x27af('0x2f')];if(_0x2425dd[_0x27af('0x31')][_0x27af('0x3f')]){_0x279f99[_0x27af('0x43')]=[{'all':!![]}];}_0x279f99=_[_0x27af('0x3d')]({},_0x279f99,_0x2425dd[_0x27af('0x3e')]);return db['ZendeskAccount']['find'](_0x279f99)[_0x27af('0x24')](handleEntityNotFound(_0x3c9c81,null))['then'](respondWithResult(_0x3c9c81,null))[_0x27af('0x44')](handleError(_0x3c9c81,null));};exports[_0x27af('0x45')]=function(_0x226025,_0x389962){return db[_0x27af('0x2b')][_0x27af('0x45')](_0x226025[_0x27af('0x46')],{})['then'](respondWithResult(_0x389962,0xc9))[_0x27af('0x44')](handleError(_0x389962,null));};exports[_0x27af('0x23')]=function(_0x20e180,_0x3fdc0e){if(_0x20e180[_0x27af('0x46')]['id']){delete _0x20e180['body']['id'];}return db[_0x27af('0x2b')][_0x27af('0x47')]({'where':{'id':_0x20e180[_0x27af('0x41')]['id']}})['then'](handleEntityNotFound(_0x3fdc0e,null))['then'](saveUpdates(_0x20e180[_0x27af('0x46')],null))[_0x27af('0x24')](respondWithResult(_0x3fdc0e,null))[_0x27af('0x44')](handleError(_0x3fdc0e,null));};exports['destroy']=function(_0x495794,_0x2fad23){return db['ZendeskAccount'][_0x27af('0x47')]({'where':{'id':_0x495794[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2fad23,null))[_0x27af('0x24')](removeEntity(_0x2fad23,null))[_0x27af('0x44')](handleError(_0x2fad23,null));};exports[_0x27af('0x48')]=function(_0x123533,_0x374794,_0x1b6d94){var _0x24d8bf={};var _0x23369a={};var _0x5c02c1;var _0x76ed78;return db[_0x27af('0x2b')][_0x27af('0x49')]({'where':{'id':_0x123533[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x374794,null))[_0x27af('0x24')](function(_0x20c155){if(_0x20c155){_0x5c02c1=_0x20c155;_0x23369a[_0x27af('0x2f')]=_['keys'](db[_0x27af('0x4a')]['rawAttributes']);_0x23369a[_0x27af('0x31')]=_[_0x27af('0x30')](_0x123533[_0x27af('0x31')]);_0x23369a['filters']=_[_0x27af('0x32')](_0x23369a['model'],_0x23369a[_0x27af('0x31')]);_0x24d8bf[_0x27af('0x33')]=_[_0x27af('0x32')](_0x23369a['model'],qs[_0x27af('0x34')](_0x123533['query'][_0x27af('0x34')]));_0x24d8bf['attributes']=_0x24d8bf[_0x27af('0x33')][_0x27af('0x4b')]?_0x24d8bf[_0x27af('0x33')]:_0x23369a['model'];_0x24d8bf['order']=qs[_0x27af('0x37')](_0x123533[_0x27af('0x31')][_0x27af('0x37')]);_0x24d8bf[_0x27af('0x38')]=qs['filters'](_[_0x27af('0x3a')](_0x123533[_0x27af('0x31')],_0x23369a[_0x27af('0x39')]));if(_0x123533[_0x27af('0x31')][_0x27af('0x3c')]){_0x24d8bf[_0x27af('0x38')]=_['merge'](_0x24d8bf[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x24d8bf[_0x27af('0x33')],function(_0x2401c7){var _0x49eb46={};_0x49eb46[_0x2401c7]={'$like':'%'+_0x123533[_0x27af('0x31')]['filter']+'%'};return _0x49eb46;})});}_0x24d8bf=_[_0x27af('0x3d')]({},_0x24d8bf,_0x123533[_0x27af('0x3e')]);return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x13a5a8){if(_0x13a5a8){_0x76ed78=_0x13a5a8['length'];if(!_0x123533['query'][_0x27af('0x4c')](_0x27af('0x35'))){_0x24d8bf[_0x27af('0x1d')]=qs['limit'](_0x123533[_0x27af('0x31')][_0x27af('0x1d')]);_0x24d8bf['offset']=qs[_0x27af('0x1b')](_0x123533[_0x27af('0x31')]['offset']);}return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x1fa50b){if(_0x1fa50b){return _0x1fa50b?{'count':_0x76ed78,'rows':_0x1fa50b}:null;}})['then'](respondWithResult(_0x374794,null))['catch'](handleError(_0x374794,null));};exports[_0x27af('0x4d')]=function(_0xf97695,_0x2a8534,_0x266220){if(_0xf97695[_0x27af('0x46')]['id']){delete _0xf97695[_0x27af('0x46')]['id'];}return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0xf97695['params']['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2a8534,null))[_0x27af('0x24')](function(_0xa692f6){if(_0xa692f6){_0xf97695[_0x27af('0x46')][_0x27af('0x4e')]=_0xa692f6['id'];_0xf97695[_0x27af('0x46')][_0x27af('0x4f')]=integrations[_0x27af('0x50')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695[_0x27af('0x46')][_0x27af('0x2d')]);_0xf97695[_0x27af('0x46')][_0x27af('0x52')]=integrations[_0x27af('0x53')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695['body'][_0x27af('0x2d')]);return db[_0x27af('0x4a')]['create'](_0xf97695[_0x27af('0x46')],{'include':[{'model':db[_0x27af('0x54')],'as':_0x27af('0x4f')},{'model':db[_0x27af('0x54')],'as':_0x27af('0x52')}]});}return null;})[_0x27af('0x24')](respondWithResult(_0x2a8534,null))['catch'](handleError(_0x2a8534,null));};exports[_0x27af('0x55')]=function(_0x31a595,_0x3a2958,_0x4ab463){var _0x5d7af4='';return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0x31a595[_0x27af('0x41')]['id']},'attributes':['id',_0x27af('0x56'),_0x27af('0x57'),_0x27af('0x58'),_0x27af('0x59'),'remoteUri']})[_0x27af('0x24')](handleEntityNotFound(_0x3a2958,null))[_0x27af('0x24')](function(_0x4ac2a3){if(_0x4ac2a3){_0x5d7af4=_0x4ac2a3[_0x27af('0x5a')];var _0xc0a98c=_0x5d7af4['slice'](-0x1);if(_0xc0a98c==='/'){_0x5d7af4=_0x5d7af4['substring'](0x0,_0x5d7af4[_0x27af('0x5b')](_0xc0a98c));}var _0x287f7c={'method':_0x27af('0x5c'),'uri':util[_0x27af('0x5d')](_0x27af('0x5e'),_0x5d7af4,_0x27af('0x5f')),'json':!![]};switch(_0x4ac2a3[_0x27af('0x59')]){case'password':_0x287f7c[_0x27af('0x60')]={'Authorization':util[_0x27af('0x5d')](_0x27af('0x61'),new Buffer(util[_0x27af('0x5d')]('%s:%s',_0x4ac2a3['username'],_0x4ac2a3[_0x27af('0x57')]))[_0x27af('0x62')](_0x27af('0x63')))};break;case _0x27af('0x58'):_0x287f7c['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x27af('0x5d')](_0x27af('0x64'),_0x4ac2a3[_0x27af('0x56')],_0x4ac2a3[_0x27af('0x58')]))[_0x27af('0x62')](_0x27af('0x63')))};break;default:throw new db['Sequelize']['ValidationError'](_0x27af('0x65'));}return rp(_0x287f7c);}})[_0x27af('0x24')](function(_0x55637f){if(_0x55637f){var _0x2c3d30=['subject','description',_0x27af('0x66'),_0x27af('0x67')];_[_0x27af('0x68')](_0x55637f[_0x27af('0x5f')],function(_0x2b7e18){return _0x2c3d30[_0x27af('0x69')](_0x2b7e18[_0x27af('0x2d')]);});return{'count':_0x55637f[_0x27af('0x5f')][_0x27af('0x4b')],'rows':_[_0x27af('0x2a')](_0x55637f[_0x27af('0x5f')],function(_0x4dd124){return{'id':_0x4dd124['id'],'name':_0x4dd124[_0x27af('0x6a')]>0x7?_0x4dd124[_0x27af('0x6b')]:_0x4dd124[_0x27af('0x2d')],'custom':_0x4dd124['position']>0x7?!![]:![],'options':_0x4dd124[_0x27af('0x6c')]?_0x4dd124[_0x27af('0x6c')]:_0x4dd124[_0x27af('0x6d')]?_0x4dd124['custom_field_options']:[]};})};}})[_0x27af('0x24')](respondWithResult(_0x3a2958,null))['catch'](function(_0x118d06){var _0x9350fa=_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?0x1f4:_0x118d06[_0x27af('0x6f')]||0x1f4;logger[_0x27af('0x25')](_0x27af('0x70'),_0x27af('0x55'),_0x9350fa,JSON['stringify'](_0x118d06));delete _0x118d06[_0x27af('0x27')];if(_0x9350fa===0x191){_0x9350fa=0x190;}_0x3a2958['status'](_0x9350fa)[_0x27af('0x28')](_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x118d06['statusCode']}:_0x118d06);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 77a1f21..23e630d 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 _0xf90e=['./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0xc53d2f,_0x5b954e){var _0x3645cf=function(_0x243c29){while(--_0x243c29){_0xc53d2f['push'](_0xc53d2f['shift']());}};_0x3645cf(++_0x5b954e);}(_0xf90e,0x102));var _0xef90=function(_0xe0558a,_0x20a1be){_0xe0558a=_0xe0558a-0x0;var _0x3ac0dd=_0xf90e[_0xe0558a];return _0x3ac0dd;};'use strict';var _=require(_0xef90('0x0'));var util=require(_0xef90('0x1'));var logger=require(_0xef90('0x2'))('api');var moment=require(_0xef90('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xef90('0x4'));var config=require(_0xef90('0x5'));var attributes=require(_0xef90('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xef90('0x7')]=function(_0x471d8d,_0x53479f){return _0x471d8d[_0xef90('0x8')](_0xef90('0x9'),attributes,{'tableName':_0xef90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f3c=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x58a0bb,_0x3464b8){var _0x1f1146=function(_0x1178ed){while(--_0x1178ed){_0x58a0bb['push'](_0x58a0bb['shift']());}};_0x1f1146(++_0x3464b8);}(_0x3f3c,0x18b));var _0xc3f3=function(_0x2b82a7,_0x352f7f){_0x2b82a7=_0x2b82a7-0x0;var _0x512e3b=_0x3f3c[_0x2b82a7];return _0x512e3b;};'use strict';var _=require(_0xc3f3('0x0'));var util=require(_0xc3f3('0x1'));var logger=require(_0xc3f3('0x2'))(_0xc3f3('0x3'));var moment=require(_0xc3f3('0x4'));var BPromise=require(_0xc3f3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3f3('0x6'));var rimraf=require(_0xc3f3('0x7'));var config=require(_0xc3f3('0x8'));var attributes=require(_0xc3f3('0x9'));var integrations=require(_0xc3f3('0xa'));module['exports']=function(_0x3775d8,_0x94799b){return _0x3775d8[_0xc3f3('0xb')](_0xc3f3('0xc'),attributes,{'tableName':_0xc3f3('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 d213ab4..ad58ab1 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 _0x9206=['info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','then'];(function(_0x1149b6,_0xe1a36b){var _0x532796=function(_0x44ab30){while(--_0x44ab30){_0x1149b6['push'](_0x1149b6['shift']());}};_0x532796(++_0xe1a36b);}(_0x9206,0x176));var _0x6920=function(_0x58dd56,_0x1a178c){_0x58dd56=_0x58dd56-0x0;var _0x1bf420=_0x9206[_0x58dd56];return _0x1bf420;};'use strict';var _=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var moment=require(_0x6920('0x2'));var BPromise=require(_0x6920('0x3'));var rs=require(_0x6920('0x4'));var fs=require('fs');var Redis=require(_0x6920('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6920('0x6'))(_0x6920('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6920('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21fb21,_0x31966d,_0x2aad51){return new BPromise(function(_0xef5d38,_0x56bb75){return client['request'](_0x21fb21,_0x2aad51)[_0x6920('0x9')](function(_0xc578c6){logger[_0x6920('0xa')](_0x6920('0xb'),_0x31966d,_0x6920('0xc'));logger[_0x6920('0xd')](_0x6920('0xe'),_0x31966d,_0x6920('0xc'),JSON[_0x6920('0xf')](_0xc578c6));if(_0xc578c6[_0x6920('0x10')]){if(_0xc578c6[_0x6920('0x10')][_0x6920('0x11')]===0x1f4){logger[_0x6920('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x31966d,_0xc578c6['error'][_0x6920('0x12')]);return _0x56bb75(_0xc578c6[_0x6920('0x10')]['message']);}logger[_0x6920('0x10')](_0x6920('0xb'),_0x31966d,_0xc578c6[_0x6920('0x10')][_0x6920('0x12')]);return _0xef5d38(_0xc578c6[_0x6920('0x10')]['message']);}else{logger[_0x6920('0xa')](_0x6920('0xb'),_0x31966d,_0x6920('0xc'));_0xef5d38(_0xc578c6[_0x6920('0x13')][_0x6920('0x12')]);}})[_0x6920('0x14')](function(_0x3452a4){logger[_0x6920('0x10')](_0x6920('0xb'),_0x31966d,_0x3452a4);_0x56bb75(_0x3452a4);});});}exports[_0x6920('0x15')]=function(_0x462500){var _0x3d0059=this;return new Promise(function(_0xc6e86b,_0x81f693){return db[_0x6920('0x16')]['findAll']({'raw':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x18')]===undefined?!![]:![]:!![],'where':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x19')]||null:null,'attributes':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x1a')]||null:null,'limit':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x1b')]||null:null,'include':_0x462500[_0x6920('0x17')]?_0x462500[_0x6920('0x17')][_0x6920('0x1c')]?_[_0x6920('0x1d')](_0x462500[_0x6920('0x17')][_0x6920('0x1c')],function(_0xa8f55){return{'model':db[_0xa8f55[_0x6920('0x1e')]],'as':_0xa8f55['as'],'attributes':_0xa8f55['attributes'],'include':_0xa8f55[_0x6920('0x1c')]?_['map'](_0xa8f55[_0x6920('0x1c')],function(_0x4dd08b){return{'model':db[_0x4dd08b[_0x6920('0x1e')]],'as':_0x4dd08b['as'],'attributes':_0x4dd08b[_0x6920('0x1a')],'include':_0x4dd08b[_0x6920('0x1c')]?_[_0x6920('0x1d')](_0x4dd08b['include'],function(_0x1cab00){return{'model':db[_0x1cab00[_0x6920('0x1e')]],'as':_0x1cab00['as'],'attributes':_0x1cab00[_0x6920('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6920('0x9')](function(_0x72e8bc){logger[_0x6920('0xa')](_0x6920('0x15'),_0x462500);logger[_0x6920('0xd')](_0x6920('0x15'),_0x462500,JSON[_0x6920('0xf')](_0x72e8bc));_0xc6e86b(_0x72e8bc);})[_0x6920('0x14')](function(_0x2b2cd9){logger['error'](_0x6920('0x15'),_0x2b2cd9['message'],_0x462500);_0x81f693(_0x3d0059[_0x6920('0x10')](0x1f4,_0x2b2cd9['message']));});});};exports[_0x6920('0x1f')]=function(_0x25e7ff){var _0x595dfe=this;return new Promise(function(_0x40b3ae,_0x173660){return db[_0x6920('0x16')]['find']({'raw':_0x25e7ff['options']?_0x25e7ff[_0x6920('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x25e7ff['options']?_0x25e7ff[_0x6920('0x17')][_0x6920('0x19')]||null:null,'attributes':_0x25e7ff[_0x6920('0x17')]?_0x25e7ff[_0x6920('0x17')][_0x6920('0x1a')]||null:null,'include':_0x25e7ff[_0x6920('0x17')]?_0x25e7ff[_0x6920('0x17')]['include']?_[_0x6920('0x1d')](_0x25e7ff['options'][_0x6920('0x1c')],function(_0x48f53a){return{'model':db[_0x48f53a['model']],'as':_0x48f53a['as'],'attributes':_0x48f53a[_0x6920('0x1a')],'include':_0x48f53a[_0x6920('0x1c')]?_[_0x6920('0x1d')](_0x48f53a[_0x6920('0x1c')],function(_0x54af8a){return{'model':db[_0x54af8a[_0x6920('0x1e')]],'as':_0x54af8a['as'],'attributes':_0x54af8a[_0x6920('0x1a')],'include':_0x54af8a[_0x6920('0x1c')]?_[_0x6920('0x1d')](_0x54af8a[_0x6920('0x1c')],function(_0xfdcc78){return{'model':db[_0xfdcc78[_0x6920('0x1e')]],'as':_0xfdcc78['as'],'attributes':_0xfdcc78['attributes']};}):[]};}):[]};}):[]:[]})[_0x6920('0x9')](function(_0x4c56be){logger[_0x6920('0xa')](_0x6920('0x1f'),_0x25e7ff);logger[_0x6920('0xd')]('ShowZendeskAccount',_0x25e7ff,JSON[_0x6920('0xf')](_0x4c56be));_0x40b3ae(_0x4c56be);})[_0x6920('0x14')](function(_0x14f841){logger[_0x6920('0x10')]('ShowZendeskAccount',_0x14f841[_0x6920('0x12')],_0x25e7ff);_0x173660(_0x595dfe[_0x6920('0x10')](0x1f4,_0x14f841['message']));});});}; \ No newline at end of file +var _0x7b66=['model','map','then','catch','ShowZendeskAccount','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','ZendeskAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x352d45,_0x698471){var _0x549ff7=function(_0x19c0f2){while(--_0x19c0f2){_0x352d45['push'](_0x352d45['shift']());}};_0x549ff7(++_0x698471);}(_0x7b66,0x1aa));var _0x67b6=function(_0x51eddc,_0x5a44b1){_0x51eddc=_0x51eddc-0x0;var _0x639ec0=_0x7b66[_0x51eddc];return _0x639ec0;};'use strict';var _=require('lodash');var util=require(_0x67b6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x67b6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67b6('0x2'))['db'];var utils=require(_0x67b6('0x3'));var logger=require(_0x67b6('0x4'))(_0x67b6('0x5'));var config=require('../../config/environment');var jayson=require(_0x67b6('0x6'));var client=jayson[_0x67b6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1240e6,_0x1cf9be,_0x4ada2d){return new BPromise(function(_0x3fac82,_0x24c2f3){return client['request'](_0x1240e6,_0x4ada2d)['then'](function(_0x3735ed){logger['info'](_0x67b6('0x8'),_0x1cf9be,_0x67b6('0x9'));logger[_0x67b6('0xa')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x1cf9be,'request\x20sent',JSON[_0x67b6('0xb')](_0x3735ed));if(_0x3735ed['error']){if(_0x3735ed[_0x67b6('0xc')]['code']===0x1f4){logger['error'](_0x67b6('0x8'),_0x1cf9be,_0x3735ed[_0x67b6('0xc')][_0x67b6('0xd')]);return _0x24c2f3(_0x3735ed['error'][_0x67b6('0xd')]);}logger[_0x67b6('0xc')](_0x67b6('0x8'),_0x1cf9be,_0x3735ed[_0x67b6('0xc')]['message']);return _0x3fac82(_0x3735ed[_0x67b6('0xc')][_0x67b6('0xd')]);}else{logger[_0x67b6('0xe')](_0x67b6('0x8'),_0x1cf9be,_0x67b6('0x9'));_0x3fac82(_0x3735ed[_0x67b6('0xf')][_0x67b6('0xd')]);}})['catch'](function(_0x5c650a){logger[_0x67b6('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x1cf9be,_0x5c650a);_0x24c2f3(_0x5c650a);});});}exports['GetZendeskAccount']=function(_0x40464d){var _0x2700d1=this;return new Promise(function(_0x18d612,_0x2f1d85){return db[_0x67b6('0x10')][_0x67b6('0x11')]({'raw':_0x40464d['options']?_0x40464d[_0x67b6('0x12')][_0x67b6('0x13')]===undefined?!![]:![]:!![],'where':_0x40464d['options']?_0x40464d['options'][_0x67b6('0x14')]||null:null,'attributes':_0x40464d[_0x67b6('0x12')]?_0x40464d[_0x67b6('0x12')][_0x67b6('0x15')]||null:null,'limit':_0x40464d[_0x67b6('0x12')]?_0x40464d['options'][_0x67b6('0x16')]||null:null,'include':_0x40464d[_0x67b6('0x12')]?_0x40464d[_0x67b6('0x12')][_0x67b6('0x17')]?_['map'](_0x40464d[_0x67b6('0x12')][_0x67b6('0x17')],function(_0x277148){return{'model':db[_0x277148[_0x67b6('0x18')]],'as':_0x277148['as'],'attributes':_0x277148[_0x67b6('0x15')],'include':_0x277148[_0x67b6('0x17')]?_['map'](_0x277148[_0x67b6('0x17')],function(_0x3f0e31){return{'model':db[_0x3f0e31[_0x67b6('0x18')]],'as':_0x3f0e31['as'],'attributes':_0x3f0e31[_0x67b6('0x15')],'include':_0x3f0e31[_0x67b6('0x17')]?_[_0x67b6('0x19')](_0x3f0e31[_0x67b6('0x17')],function(_0x553b2b){return{'model':db[_0x553b2b[_0x67b6('0x18')]],'as':_0x553b2b['as'],'attributes':_0x553b2b['attributes']};}):[]};}):[]};}):[]:[]})[_0x67b6('0x1a')](function(_0x949074){logger[_0x67b6('0xe')]('GetZendeskAccount',_0x40464d);logger[_0x67b6('0xa')]('GetZendeskAccount',_0x40464d,JSON[_0x67b6('0xb')](_0x949074));_0x18d612(_0x949074);})[_0x67b6('0x1b')](function(_0x58523){logger['error']('GetZendeskAccount',_0x58523[_0x67b6('0xd')],_0x40464d);_0x2f1d85(_0x2700d1[_0x67b6('0xc')](0x1f4,_0x58523[_0x67b6('0xd')]));});});};exports[_0x67b6('0x1c')]=function(_0x632816){var _0x2bd70e=this;return new Promise(function(_0x4a3e16,_0x415e99){return db[_0x67b6('0x10')][_0x67b6('0x1d')]({'raw':_0x632816[_0x67b6('0x12')]?_0x632816[_0x67b6('0x12')][_0x67b6('0x13')]===undefined?!![]:![]:!![],'where':_0x632816[_0x67b6('0x12')]?_0x632816[_0x67b6('0x12')]['where']||null:null,'attributes':_0x632816['options']?_0x632816[_0x67b6('0x12')][_0x67b6('0x15')]||null:null,'include':_0x632816[_0x67b6('0x12')]?_0x632816[_0x67b6('0x12')][_0x67b6('0x17')]?_[_0x67b6('0x19')](_0x632816['options']['include'],function(_0xc5159d){return{'model':db[_0xc5159d[_0x67b6('0x18')]],'as':_0xc5159d['as'],'attributes':_0xc5159d[_0x67b6('0x15')],'include':_0xc5159d['include']?_['map'](_0xc5159d[_0x67b6('0x17')],function(_0x4ed27e){return{'model':db[_0x4ed27e[_0x67b6('0x18')]],'as':_0x4ed27e['as'],'attributes':_0x4ed27e[_0x67b6('0x15')],'include':_0x4ed27e['include']?_[_0x67b6('0x19')](_0x4ed27e[_0x67b6('0x17')],function(_0x6bd1fe){return{'model':db[_0x6bd1fe['model']],'as':_0x6bd1fe['as'],'attributes':_0x6bd1fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x67b6('0x1a')](function(_0x50bbb2){logger[_0x67b6('0xe')](_0x67b6('0x1c'),_0x632816);logger['debug'](_0x67b6('0x1c'),_0x632816,JSON[_0x67b6('0xb')](_0x50bbb2));_0x4a3e16(_0x50bbb2);})[_0x67b6('0x1b')](function(_0x1b6750){logger[_0x67b6('0xc')](_0x67b6('0x1c'),_0x1b6750[_0x67b6('0xd')],_0x632816);_0x415e99(_0x2bd70e[_0x67b6('0xc')](0x1f4,_0x1b6750[_0x67b6('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 702e231..ac0919c 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 _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x28fa04,_0x503433){var _0x34c884=function(_0x831e47){while(--_0x831e47){_0x28fa04['push'](_0x28fa04['shift']());}};_0x34c884(++_0x503433);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file +var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x5610b2,_0x1e9693){var _0x27128c=function(_0x559ec1){while(--_0x559ec1){_0x5610b2['push'](_0x5610b2['shift']());}};_0x27128c(++_0x1e9693);}(_0x4fc2,0x111));var _0x24fc=function(_0x283f1a,_0x271f9a){_0x283f1a=_0x283f1a-0x0;var _0x3eeb4c=_0x4fc2[_0x283f1a];return _0x3eeb4c;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 7b505d1..6ea9bf8 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 _0x0628=['sequelize','STRING'];(function(_0x215d2d,_0x1f8c56){var _0x3862e3=function(_0x42786b){while(--_0x42786b){_0x215d2d['push'](_0x215d2d['shift']());}};_0x3862e3(++_0x1f8c56);}(_0x0628,0x194));var _0x8062=function(_0x125582,_0x508be1){_0x125582=_0x125582-0x0;var _0x28e6dc=_0x0628[_0x125582];return _0x28e6dc;};'use strict';var Sequelize=require(_0x8062('0x0'));module['exports']={'name':{'type':Sequelize[_0x8062('0x1')]},'description':{'type':Sequelize[_0x8062('0x1')]}}; \ No newline at end of file +var _0x2b4f=['sequelize','STRING'];(function(_0x4b6e3e,_0x34b926){var _0x348a81=function(_0x147ea7){while(--_0x147ea7){_0x4b6e3e['push'](_0x4b6e3e['shift']());}};_0x348a81(++_0x34b926);}(_0x2b4f,0x19c));var _0xf2b4=function(_0x1fb388,_0x199377){_0x1fb388=_0x1fb388-0x0;var _0x3eecf9=_0x2b4f[_0x1fb388];return _0x3eecf9;};'use strict';var Sequelize=require(_0xf2b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xf2b4('0x1')]},'description':{'type':Sequelize[_0xf2b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 98aed81..53a4410 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 _0xb1af=['findAll','rows','catch','includeAll','find','body','params','getFields','ZendeskField','pick','options','getSubjects','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','to-csv','ejs','lodash','squel','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','sendStatus','end','status','limit','count','offset','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include'];(function(_0x343e29,_0x29ebfb){var _0x41acba=function(_0x2dd39b){while(--_0x2dd39b){_0x343e29['push'](_0x343e29['shift']());}};_0x41acba(++_0x29ebfb);}(_0xb1af,0xb2));var _0xfb1a=function(_0x89c11b,_0x4196fe){_0x89c11b=_0x89c11b-0x0;var _0x7bbc44=_0xb1af[_0x89c11b];return _0x7bbc44;};'use strict';var emlformat=require(_0xfb1a('0x0'));var rimraf=require(_0xfb1a('0x1'));var zipdir=require(_0xfb1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb1a('0x3'));var moment=require(_0xfb1a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfb1a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfb1a('0x6'));var ejs=require(_0xfb1a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb1a('0x8'));var squel=require(_0xfb1a('0x9'));var crypto=require(_0xfb1a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfb1a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfb1a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb1a('0xd'));var qs=require(_0xfb1a('0xe'));var as=require(_0xfb1a('0xf'));var hardwareService=require(_0xfb1a('0x10'));var logger=require(_0xfb1a('0x11'))(_0xfb1a('0x12'));var utils=require(_0xfb1a('0x13'));var config=require(_0xfb1a('0x14'));var licenseUtil=require(_0xfb1a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7591,_0x4b28a5){_0x4b28a5=_0x4b28a5||0xcc;return function(_0x4015e2){if(_0x4015e2){return _0x3c7591[_0xfb1a('0x16')](_0x4b28a5);}return _0x3c7591['status'](_0x4b28a5)[_0xfb1a('0x17')]();};}function respondWithResult(_0x81a48f,_0x5a24f4){_0x5a24f4=_0x5a24f4||0xc8;return function(_0x42ca17){if(_0x42ca17){return _0x81a48f[_0xfb1a('0x18')](_0x5a24f4)['json'](_0x42ca17);}};}function respondWithFilteredResult(_0x1e5eb6,_0x126ee9){return function(_0x196535){if(_0x196535){var _0x16e4b1=typeof _0x126ee9['offset']==='undefined'&&typeof _0x126ee9[_0xfb1a('0x19')]==='undefined';var _0x23a35f=_0x196535['count'];var _0x43c683=_0x16e4b1?0x0:_0x126ee9['offset'];var _0x1f82b6=_0x16e4b1?_0x196535[_0xfb1a('0x1a')]:_0x126ee9[_0xfb1a('0x1b')]+_0x126ee9[_0xfb1a('0x19')];var _0x19f82d;if(_0x1f82b6>=_0x23a35f){_0x1f82b6=_0x23a35f;_0x19f82d=0xc8;}else{_0x19f82d=0xce;}_0x1e5eb6['status'](_0x19f82d);return _0x1e5eb6[_0xfb1a('0x1c')](_0xfb1a('0x1d'),_0x43c683+'-'+_0x1f82b6+'/'+_0x23a35f)[_0xfb1a('0x1e')](_0x196535);}return null;};}function patchUpdates(_0x288d11){return function(_0x375312){try{jsonpatch[_0xfb1a('0x1f')](_0x375312,_0x288d11,!![]);}catch(_0x3d42aa){return BPromise['reject'](_0x3d42aa);}return _0x375312['save']();};}function saveUpdates(_0x29d145,_0x471712){return function(_0x4856e8){if(_0x4856e8){return _0x4856e8[_0xfb1a('0x20')](_0x29d145)[_0xfb1a('0x21')](function(_0x5e5c05){return _0x5e5c05;});}return null;};}function removeEntity(_0x54d0cd,_0x5ee939){return function(_0x5ef9b8){if(_0x5ef9b8){return _0x5ef9b8[_0xfb1a('0x22')]()['then'](function(){_0x54d0cd[_0xfb1a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa2d5,_0x29409e){return function(_0x39194c){if(!_0x39194c){_0x3fa2d5[_0xfb1a('0x16')](0x194);}return _0x39194c;};}function handleError(_0x4aca53,_0x169d80){_0x169d80=_0x169d80||0x1f4;return function(_0x440030){logger[_0xfb1a('0x23')](_0x440030[_0xfb1a('0x24')]);if(_0x440030[_0xfb1a('0x25')]){delete _0x440030['name'];}_0x4aca53[_0xfb1a('0x18')](_0x169d80)[_0xfb1a('0x26')](_0x440030);};}exports[_0xfb1a('0x27')]=function(_0x2e292a,_0x1bac4a){var _0x15e83a={},_0x4bbdd7={},_0x2f74cb={'count':0x0,'rows':[]};var _0x36115c=_[_0xfb1a('0x28')](db[_0xfb1a('0x29')][_0xfb1a('0x2a')],function(_0x17e91c){return{'name':_0x17e91c[_0xfb1a('0x2b')],'type':_0x17e91c[_0xfb1a('0x2c')]['key']};});_0x4bbdd7[_0xfb1a('0x2d')]=_[_0xfb1a('0x28')](_0x36115c,'name');_0x4bbdd7[_0xfb1a('0x2e')]=_[_0xfb1a('0x2f')](_0x2e292a['query']);_0x4bbdd7[_0xfb1a('0x30')]=_[_0xfb1a('0x31')](_0x4bbdd7[_0xfb1a('0x2d')],_0x4bbdd7[_0xfb1a('0x2e')]);_0x15e83a[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x4bbdd7[_0xfb1a('0x2d')],qs[_0xfb1a('0x33')](_0x2e292a[_0xfb1a('0x2e')][_0xfb1a('0x33')]));_0x15e83a[_0xfb1a('0x32')]=_0x15e83a[_0xfb1a('0x32')][_0xfb1a('0x34')]?_0x15e83a[_0xfb1a('0x32')]:_0x4bbdd7[_0xfb1a('0x2d')];if(!_0x2e292a[_0xfb1a('0x2e')][_0xfb1a('0x35')](_0xfb1a('0x36'))){_0x15e83a[_0xfb1a('0x19')]=qs[_0xfb1a('0x19')](_0x2e292a[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x15e83a[_0xfb1a('0x1b')]=qs[_0xfb1a('0x1b')](_0x2e292a[_0xfb1a('0x2e')]['offset']);}_0x15e83a[_0xfb1a('0x37')]=qs[_0xfb1a('0x38')](_0x2e292a[_0xfb1a('0x2e')]['sort']);_0x15e83a['where']=qs[_0xfb1a('0x30')](_['pick'](_0x2e292a[_0xfb1a('0x2e')],_0x4bbdd7[_0xfb1a('0x30')]),_0x36115c);if(_0x2e292a[_0xfb1a('0x2e')][_0xfb1a('0x39')]){_0x15e83a[_0xfb1a('0x3a')]=_[_0xfb1a('0x3b')](_0x15e83a['where'],{'$or':_[_0xfb1a('0x28')](_0x36115c,function(_0x9359db){if(_0x9359db['type']!==_0xfb1a('0x3c')){var _0x58081a={};_0x58081a[_0x9359db[_0xfb1a('0x25')]]={'$like':'%'+_0x2e292a['query'][_0xfb1a('0x39')]+'%'};return _0x58081a;}})});}_0x15e83a=_['merge']({},_0x15e83a,_0x2e292a['options']);var _0xcdef3={'where':_0x15e83a[_0xfb1a('0x3a')]};return db[_0xfb1a('0x29')]['count'](_0xcdef3)[_0xfb1a('0x21')](function(_0x290230){_0x2f74cb[_0xfb1a('0x1a')]=_0x290230;if(_0x2e292a['query']['includeAll']){_0x15e83a[_0xfb1a('0x3d')]=[{'all':!![]}];}return db[_0xfb1a('0x29')][_0xfb1a('0x3e')](_0x15e83a);})[_0xfb1a('0x21')](function(_0x1a8b49){_0x2f74cb[_0xfb1a('0x3f')]=_0x1a8b49;return _0x2f74cb;})[_0xfb1a('0x21')](respondWithFilteredResult(_0x1bac4a,_0x15e83a))[_0xfb1a('0x40')](handleError(_0x1bac4a,null));};exports['show']=function(_0x2e9e43,_0x585037){var _0x1b22ec={'raw':![],'where':{'id':_0x2e9e43['params']['id']}},_0x1cff61={};_0x1cff61[_0xfb1a('0x2d')]=_['keys'](db[_0xfb1a('0x29')][_0xfb1a('0x2a')]);_0x1cff61[_0xfb1a('0x2e')]=_[_0xfb1a('0x2f')](_0x2e9e43[_0xfb1a('0x2e')]);_0x1cff61[_0xfb1a('0x30')]=_['intersection'](_0x1cff61[_0xfb1a('0x2d')],_0x1cff61[_0xfb1a('0x2e')]);_0x1b22ec[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x1cff61[_0xfb1a('0x2d')],qs[_0xfb1a('0x33')](_0x2e9e43[_0xfb1a('0x2e')][_0xfb1a('0x33')]));_0x1b22ec[_0xfb1a('0x32')]=_0x1b22ec[_0xfb1a('0x32')][_0xfb1a('0x34')]?_0x1b22ec['attributes']:_0x1cff61[_0xfb1a('0x2d')];if(_0x2e9e43['query'][_0xfb1a('0x41')]){_0x1b22ec[_0xfb1a('0x3d')]=[{'all':!![]}];}_0x1b22ec=_[_0xfb1a('0x3b')]({},_0x1b22ec,_0x2e9e43['options']);return db[_0xfb1a('0x29')][_0xfb1a('0x42')](_0x1b22ec)[_0xfb1a('0x21')](handleEntityNotFound(_0x585037,null))[_0xfb1a('0x21')](respondWithResult(_0x585037,null))[_0xfb1a('0x40')](handleError(_0x585037,null));};exports['create']=function(_0x20c6c4,_0x4f3127){return db[_0xfb1a('0x29')]['create'](_0x20c6c4['body'],{})['then'](respondWithResult(_0x4f3127,0xc9))[_0xfb1a('0x40')](handleError(_0x4f3127,null));};exports[_0xfb1a('0x20')]=function(_0x26e70c,_0x8d6762){if(_0x26e70c[_0xfb1a('0x43')]['id']){delete _0x26e70c[_0xfb1a('0x43')]['id'];}return db[_0xfb1a('0x29')][_0xfb1a('0x42')]({'where':{'id':_0x26e70c[_0xfb1a('0x44')]['id']}})[_0xfb1a('0x21')](handleEntityNotFound(_0x8d6762,null))[_0xfb1a('0x21')](saveUpdates(_0x26e70c[_0xfb1a('0x43')],null))[_0xfb1a('0x21')](respondWithResult(_0x8d6762,null))[_0xfb1a('0x40')](handleError(_0x8d6762,null));};exports[_0xfb1a('0x22')]=function(_0x23fe3f,_0x43729a){return db['ZendeskConfiguration'][_0xfb1a('0x42')]({'where':{'id':_0x23fe3f[_0xfb1a('0x44')]['id']}})[_0xfb1a('0x21')](handleEntityNotFound(_0x43729a,null))[_0xfb1a('0x21')](removeEntity(_0x43729a,null))['catch'](handleError(_0x43729a,null));};exports[_0xfb1a('0x45')]=function(_0x156d50,_0x16f7cc,_0x5f1b37){var _0x46d691={};var _0x4a7873={};var _0x17195f;var _0x614f80;return db[_0xfb1a('0x29')]['findOne']({'where':{'id':_0x156d50[_0xfb1a('0x44')]['id']}})['then'](handleEntityNotFound(_0x16f7cc,null))[_0xfb1a('0x21')](function(_0x5d677e){if(_0x5d677e){_0x17195f=_0x5d677e;_0x4a7873['model']=_[_0xfb1a('0x2f')](db[_0xfb1a('0x46')][_0xfb1a('0x2a')]);_0x4a7873[_0xfb1a('0x2e')]=_[_0xfb1a('0x2f')](_0x156d50[_0xfb1a('0x2e')]);_0x4a7873[_0xfb1a('0x30')]=_['intersection'](_0x4a7873[_0xfb1a('0x2d')],_0x4a7873[_0xfb1a('0x2e')]);_0x46d691[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x4a7873[_0xfb1a('0x2d')],qs[_0xfb1a('0x33')](_0x156d50[_0xfb1a('0x2e')]['fields']));_0x46d691['attributes']=_0x46d691[_0xfb1a('0x32')][_0xfb1a('0x34')]?_0x46d691[_0xfb1a('0x32')]:_0x4a7873[_0xfb1a('0x2d')];_0x46d691['order']=qs[_0xfb1a('0x38')](_0x156d50[_0xfb1a('0x2e')][_0xfb1a('0x38')]);_0x46d691[_0xfb1a('0x3a')]=qs[_0xfb1a('0x30')](_[_0xfb1a('0x47')](_0x156d50[_0xfb1a('0x2e')],_0x4a7873[_0xfb1a('0x30')]));if(_0x156d50[_0xfb1a('0x2e')][_0xfb1a('0x39')]){_0x46d691[_0xfb1a('0x3a')]=_['merge'](_0x46d691[_0xfb1a('0x3a')],{'$or':_[_0xfb1a('0x28')](_0x46d691[_0xfb1a('0x32')],function(_0x4659cd){var _0x1ec546={};_0x1ec546[_0x4659cd]={'$like':'%'+_0x156d50[_0xfb1a('0x2e')][_0xfb1a('0x39')]+'%'};return _0x1ec546;})});}_0x46d691=_['merge']({},_0x46d691,_0x156d50[_0xfb1a('0x48')]);return _0x17195f['getFields'](_0x46d691);}})[_0xfb1a('0x21')](function(_0x2628d7){if(_0x2628d7){_0x614f80=_0x2628d7['length'];if(!_0x156d50['query'][_0xfb1a('0x35')]('nolimit')){_0x46d691[_0xfb1a('0x19')]=qs[_0xfb1a('0x19')](_0x156d50[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x46d691['offset']=qs[_0xfb1a('0x1b')](_0x156d50['query'][_0xfb1a('0x1b')]);}return _0x17195f['getFields'](_0x46d691);}})[_0xfb1a('0x21')](function(_0x1963e1){if(_0x1963e1){return _0x1963e1?{'count':_0x614f80,'rows':_0x1963e1}:null;}})['then'](respondWithResult(_0x16f7cc,null))[_0xfb1a('0x40')](handleError(_0x16f7cc,null));};exports[_0xfb1a('0x49')]=function(_0x5354b3,_0x1671d6,_0x4acb06){var _0x15a115={};var _0x2a605e={};var _0x53bf4a;var _0x59e999;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5354b3[_0xfb1a('0x44')]['id']}})[_0xfb1a('0x21')](handleEntityNotFound(_0x1671d6,null))[_0xfb1a('0x21')](function(_0xa26304){if(_0xa26304){_0x53bf4a=_0xa26304;_0x2a605e[_0xfb1a('0x2d')]=_['keys'](db[_0xfb1a('0x46')][_0xfb1a('0x2a')]);_0x2a605e['query']=_[_0xfb1a('0x2f')](_0x5354b3['query']);_0x2a605e[_0xfb1a('0x30')]=_[_0xfb1a('0x31')](_0x2a605e[_0xfb1a('0x2d')],_0x2a605e[_0xfb1a('0x2e')]);_0x15a115[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x2a605e['model'],qs[_0xfb1a('0x33')](_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x33')]));_0x15a115['attributes']=_0x15a115[_0xfb1a('0x32')]['length']?_0x15a115['attributes']:_0x2a605e[_0xfb1a('0x2d')];_0x15a115[_0xfb1a('0x37')]=qs[_0xfb1a('0x38')](_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x38')]);_0x15a115[_0xfb1a('0x3a')]=qs[_0xfb1a('0x30')](_[_0xfb1a('0x47')](_0x5354b3[_0xfb1a('0x2e')],_0x2a605e[_0xfb1a('0x30')]));if(_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x39')]){_0x15a115['where']=_['merge'](_0x15a115[_0xfb1a('0x3a')],{'$or':_['map'](_0x15a115[_0xfb1a('0x32')],function(_0x404508){var _0x44b0ec={};_0x44b0ec[_0x404508]={'$like':'%'+_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x39')]+'%'};return _0x44b0ec;})});}_0x15a115=_[_0xfb1a('0x3b')]({},_0x15a115,_0x5354b3[_0xfb1a('0x48')]);return _0x53bf4a['getSubjects'](_0x15a115);}})[_0xfb1a('0x21')](function(_0x477312){if(_0x477312){_0x59e999=_0x477312[_0xfb1a('0x34')];if(!_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x35')](_0xfb1a('0x36'))){_0x15a115['limit']=qs[_0xfb1a('0x19')](_0x5354b3[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x15a115[_0xfb1a('0x1b')]=qs[_0xfb1a('0x1b')](_0x5354b3[_0xfb1a('0x2e')]['offset']);}return _0x53bf4a['getSubjects'](_0x15a115);}})[_0xfb1a('0x21')](function(_0x24ecce){if(_0x24ecce){return _0x24ecce?{'count':_0x59e999,'rows':_0x24ecce}:null;}})['then'](respondWithResult(_0x1671d6,null))[_0xfb1a('0x40')](handleError(_0x1671d6,null));};exports[_0xfb1a('0x4a')]=function(_0x484fb9,_0x38dedd,_0x1d3097){var _0x18649e={};var _0x3f47eb={};var _0x5653b0;var _0xaf7a62;return db[_0xfb1a('0x29')]['findOne']({'where':{'id':_0x484fb9[_0xfb1a('0x44')]['id']}})[_0xfb1a('0x21')](handleEntityNotFound(_0x38dedd,null))[_0xfb1a('0x21')](function(_0x5617e1){if(_0x5617e1){_0x5653b0=_0x5617e1;_0x3f47eb[_0xfb1a('0x2d')]=_[_0xfb1a('0x2f')](db[_0xfb1a('0x46')][_0xfb1a('0x2a')]);_0x3f47eb[_0xfb1a('0x2e')]=_[_0xfb1a('0x2f')](_0x484fb9[_0xfb1a('0x2e')]);_0x3f47eb['filters']=_[_0xfb1a('0x31')](_0x3f47eb['model'],_0x3f47eb[_0xfb1a('0x2e')]);_0x18649e[_0xfb1a('0x32')]=_[_0xfb1a('0x31')](_0x3f47eb[_0xfb1a('0x2d')],qs[_0xfb1a('0x33')](_0x484fb9['query'][_0xfb1a('0x33')]));_0x18649e[_0xfb1a('0x32')]=_0x18649e[_0xfb1a('0x32')][_0xfb1a('0x34')]?_0x18649e[_0xfb1a('0x32')]:_0x3f47eb[_0xfb1a('0x2d')];_0x18649e[_0xfb1a('0x37')]=qs[_0xfb1a('0x38')](_0x484fb9[_0xfb1a('0x2e')]['sort']);_0x18649e[_0xfb1a('0x3a')]=qs[_0xfb1a('0x30')](_[_0xfb1a('0x47')](_0x484fb9['query'],_0x3f47eb['filters']));if(_0x484fb9[_0xfb1a('0x2e')][_0xfb1a('0x39')]){_0x18649e[_0xfb1a('0x3a')]=_[_0xfb1a('0x3b')](_0x18649e[_0xfb1a('0x3a')],{'$or':_[_0xfb1a('0x28')](_0x18649e[_0xfb1a('0x32')],function(_0x32d10e){var _0x3ecdd4={};_0x3ecdd4[_0x32d10e]={'$like':'%'+_0x484fb9[_0xfb1a('0x2e')][_0xfb1a('0x39')]+'%'};return _0x3ecdd4;})});}_0x18649e=_[_0xfb1a('0x3b')]({},_0x18649e,_0x484fb9[_0xfb1a('0x48')]);return _0x5653b0['getDescriptions'](_0x18649e);}})[_0xfb1a('0x21')](function(_0x498c92){if(_0x498c92){_0xaf7a62=_0x498c92[_0xfb1a('0x34')];if(!_0x484fb9[_0xfb1a('0x2e')]['hasOwnProperty'](_0xfb1a('0x36'))){_0x18649e[_0xfb1a('0x19')]=qs[_0xfb1a('0x19')](_0x484fb9[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x18649e[_0xfb1a('0x1b')]=qs['offset'](_0x484fb9[_0xfb1a('0x2e')][_0xfb1a('0x1b')]);}return _0x5653b0[_0xfb1a('0x4a')](_0x18649e);}})[_0xfb1a('0x21')](function(_0x252cec){if(_0x252cec){return _0x252cec?{'count':_0xaf7a62,'rows':_0x252cec}:null;}})[_0xfb1a('0x21')](respondWithResult(_0x38dedd,null))[_0xfb1a('0x40')](handleError(_0x38dedd,null));};exports[_0xfb1a('0x4b')]=function(_0x44440b,_0x52a114,_0x15f965){var _0x37b290={};var _0x476895={};var _0x9c50fc;var _0x322d7b;return db[_0xfb1a('0x29')][_0xfb1a('0x4c')]({'where':{'id':_0x44440b[_0xfb1a('0x44')]['id']}})['then'](handleEntityNotFound(_0x52a114,null))[_0xfb1a('0x21')](function(_0x31b05e){if(_0x31b05e){_0x9c50fc=_0x31b05e;_0x476895[_0xfb1a('0x2d')]=_[_0xfb1a('0x2f')](db[_0xfb1a('0x4d')][_0xfb1a('0x2a')]);_0x476895[_0xfb1a('0x2e')]=_['keys'](_0x44440b[_0xfb1a('0x2e')]);_0x476895['filters']=_['intersection'](_0x476895[_0xfb1a('0x2d')],_0x476895[_0xfb1a('0x2e')]);_0x37b290['attributes']=_['intersection'](_0x476895['model'],qs[_0xfb1a('0x33')](_0x44440b[_0xfb1a('0x2e')]['fields']));_0x37b290[_0xfb1a('0x32')]=_0x37b290[_0xfb1a('0x32')]['length']?_0x37b290[_0xfb1a('0x32')]:_0x476895[_0xfb1a('0x2d')];_0x37b290[_0xfb1a('0x37')]=qs[_0xfb1a('0x38')](_0x44440b[_0xfb1a('0x2e')][_0xfb1a('0x38')]);_0x37b290['where']=qs['filters'](_[_0xfb1a('0x47')](_0x44440b['query'],_0x476895['filters']));if(_0x44440b['query'][_0xfb1a('0x39')]){_0x37b290['where']=_[_0xfb1a('0x3b')](_0x37b290['where'],{'$or':_['map'](_0x37b290[_0xfb1a('0x32')],function(_0x5b699a){var _0x59b4ab={};_0x59b4ab[_0x5b699a]={'$like':'%'+_0x44440b[_0xfb1a('0x2e')][_0xfb1a('0x39')]+'%'};return _0x59b4ab;})});}_0x37b290=_['merge']({},_0x37b290,_0x44440b['options']);return _0x9c50fc['getTags'](_0x37b290);}})[_0xfb1a('0x21')](function(_0x1efe9c){if(_0x1efe9c){_0x322d7b=_0x1efe9c['length'];if(!_0x44440b[_0xfb1a('0x2e')]['hasOwnProperty'](_0xfb1a('0x36'))){_0x37b290['limit']=qs[_0xfb1a('0x19')](_0x44440b[_0xfb1a('0x2e')][_0xfb1a('0x19')]);_0x37b290[_0xfb1a('0x1b')]=qs[_0xfb1a('0x1b')](_0x44440b[_0xfb1a('0x2e')][_0xfb1a('0x1b')]);}return _0x9c50fc[_0xfb1a('0x4b')](_0x37b290);}})[_0xfb1a('0x21')](function(_0x5956f4){if(_0x5956f4){return _0x5956f4?{'count':_0x322d7b,'rows':_0x5956f4}:null;}})[_0xfb1a('0x21')](respondWithResult(_0x52a114,null))[_0xfb1a('0x40')](handleError(_0x52a114,null));};exports[_0xfb1a('0x4e')]=function(_0x46f86f,_0x2cec9f,_0x377973){if(_0x46f86f[_0xfb1a('0x43')]['id']){delete _0x46f86f[_0xfb1a('0x43')]['id'];}return db[_0xfb1a('0x29')][_0xfb1a('0x4c')]({'where':{'id':_0x46f86f[_0xfb1a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cec9f,null))['then'](function(_0x289cfa){if(_0x289cfa){return _0x289cfa[_0xfb1a('0x4e')](_0x46f86f[_0xfb1a('0x43')][_0xfb1a('0x4f')]||[]);}return null;})[_0xfb1a('0x21')](respondWithResult(_0x2cec9f,null))[_0xfb1a('0x40')](handleError(_0x2cec9f,null));}; \ No newline at end of file +var _0x1eb0=['send','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','findAll','rows','show','params','keys','includeAll','include','options','find','catch','create','body','destroy','getFields','ZendeskField','length','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','name'];(function(_0x252af8,_0x2184c5){var _0x4adaa8=function(_0x38b75c){while(--_0x38b75c){_0x252af8['push'](_0x252af8['shift']());}};_0x4adaa8(++_0x2184c5);}(_0x1eb0,0x1e3));var _0x01eb=function(_0x3208bd,_0x994209){_0x3208bd=_0x3208bd-0x0;var _0x3d746f=_0x1eb0[_0x3208bd];return _0x3d746f;};'use strict';var emlformat=require(_0x01eb('0x0'));var rimraf=require(_0x01eb('0x1'));var zipdir=require(_0x01eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01eb('0x3'));var moment=require(_0x01eb('0x4'));var BPromise=require(_0x01eb('0x5'));var Mustache=require(_0x01eb('0x6'));var util=require(_0x01eb('0x7'));var path=require('path');var sox=require(_0x01eb('0x8'));var csv=require(_0x01eb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01eb('0xa'));var squel=require(_0x01eb('0xb'));var crypto=require(_0x01eb('0xc'));var jsforce=require(_0x01eb('0xd'));var deskjs=require(_0x01eb('0xe'));var toCsv=require(_0x01eb('0x9'));var querystring=require(_0x01eb('0xf'));var Papa=require(_0x01eb('0x10'));var Redis=require(_0x01eb('0x11'));var authService=require(_0x01eb('0x12'));var qs=require(_0x01eb('0x13'));var as=require(_0x01eb('0x14'));var hardwareService=require(_0x01eb('0x15'));var logger=require(_0x01eb('0x16'))(_0x01eb('0x17'));var utils=require(_0x01eb('0x18'));var config=require(_0x01eb('0x19'));var licenseUtil=require(_0x01eb('0x1a'));var db=require(_0x01eb('0x1b'))['db'];function respondWithStatusCode(_0xddb423,_0xae9671){_0xae9671=_0xae9671||0xcc;return function(_0x10b5c8){if(_0x10b5c8){return _0xddb423[_0x01eb('0x1c')](_0xae9671);}return _0xddb423['status'](_0xae9671)['end']();};}function respondWithResult(_0x2f2b48,_0x5729ce){_0x5729ce=_0x5729ce||0xc8;return function(_0x41921d){if(_0x41921d){return _0x2f2b48[_0x01eb('0x1d')](_0x5729ce)[_0x01eb('0x1e')](_0x41921d);}};}function respondWithFilteredResult(_0x33dbe8,_0x4bc62f){return function(_0x1a16cf){if(_0x1a16cf){var _0x188de0=typeof _0x4bc62f[_0x01eb('0x1f')]==='undefined'&&typeof _0x4bc62f[_0x01eb('0x20')]===_0x01eb('0x21');var _0x299886=_0x1a16cf[_0x01eb('0x22')];var _0x5025cc=_0x188de0?0x0:_0x4bc62f[_0x01eb('0x1f')];var _0x59f619=_0x188de0?_0x1a16cf['count']:_0x4bc62f[_0x01eb('0x1f')]+_0x4bc62f[_0x01eb('0x20')];var _0x13fe37;if(_0x59f619>=_0x299886){_0x59f619=_0x299886;_0x13fe37=0xc8;}else{_0x13fe37=0xce;}_0x33dbe8[_0x01eb('0x1d')](_0x13fe37);return _0x33dbe8[_0x01eb('0x23')](_0x01eb('0x24'),_0x5025cc+'-'+_0x59f619+'/'+_0x299886)[_0x01eb('0x1e')](_0x1a16cf);}return null;};}function patchUpdates(_0x2a4987){return function(_0x54aabd){try{jsonpatch[_0x01eb('0x25')](_0x54aabd,_0x2a4987,!![]);}catch(_0x419295){return BPromise[_0x01eb('0x26')](_0x419295);}return _0x54aabd[_0x01eb('0x27')]();};}function saveUpdates(_0x101bd7,_0xc80624){return function(_0x1ff7b2){if(_0x1ff7b2){return _0x1ff7b2[_0x01eb('0x28')](_0x101bd7)[_0x01eb('0x29')](function(_0x2592c8){return _0x2592c8;});}return null;};}function removeEntity(_0x4eec20,_0x51cd1a){return function(_0x2fde37){if(_0x2fde37){return _0x2fde37['destroy']()[_0x01eb('0x29')](function(){_0x4eec20['status'](0xcc)[_0x01eb('0x2a')]();});}};}function handleEntityNotFound(_0x2f3b13,_0x4c81c7){return function(_0x1a4324){if(!_0x1a4324){_0x2f3b13[_0x01eb('0x1c')](0x194);}return _0x1a4324;};}function handleError(_0x5e958e,_0xc7ae53){_0xc7ae53=_0xc7ae53||0x1f4;return function(_0x32ea4d){logger[_0x01eb('0x2b')](_0x32ea4d['stack']);if(_0x32ea4d[_0x01eb('0x2c')]){delete _0x32ea4d[_0x01eb('0x2c')];}_0x5e958e['status'](_0xc7ae53)[_0x01eb('0x2d')](_0x32ea4d);};}exports['index']=function(_0x3d0b44,_0x45980e){var _0x4e4eea={},_0xb1f049={},_0xd29bdc={'count':0x0,'rows':[]};var _0x1256fb=_[_0x01eb('0x2e')](db[_0x01eb('0x2f')][_0x01eb('0x30')],function(_0x3d3cd7){return{'name':_0x3d3cd7[_0x01eb('0x31')],'type':_0x3d3cd7['type'][_0x01eb('0x32')]};});_0xb1f049[_0x01eb('0x33')]=_['map'](_0x1256fb,'name');_0xb1f049[_0x01eb('0x34')]=_['keys'](_0x3d0b44[_0x01eb('0x34')]);_0xb1f049[_0x01eb('0x35')]=_[_0x01eb('0x36')](_0xb1f049[_0x01eb('0x33')],_0xb1f049[_0x01eb('0x34')]);_0x4e4eea[_0x01eb('0x37')]=_[_0x01eb('0x36')](_0xb1f049[_0x01eb('0x33')],qs[_0x01eb('0x38')](_0x3d0b44[_0x01eb('0x34')][_0x01eb('0x38')]));_0x4e4eea[_0x01eb('0x37')]=_0x4e4eea[_0x01eb('0x37')]['length']?_0x4e4eea[_0x01eb('0x37')]:_0xb1f049[_0x01eb('0x33')];if(!_0x3d0b44['query'][_0x01eb('0x39')](_0x01eb('0x3a'))){_0x4e4eea[_0x01eb('0x20')]=qs['limit'](_0x3d0b44[_0x01eb('0x34')][_0x01eb('0x20')]);_0x4e4eea[_0x01eb('0x1f')]=qs['offset'](_0x3d0b44[_0x01eb('0x34')][_0x01eb('0x1f')]);}_0x4e4eea[_0x01eb('0x3b')]=qs['sort'](_0x3d0b44['query'][_0x01eb('0x3c')]);_0x4e4eea['where']=qs[_0x01eb('0x35')](_[_0x01eb('0x3d')](_0x3d0b44[_0x01eb('0x34')],_0xb1f049[_0x01eb('0x35')]),_0x1256fb);if(_0x3d0b44[_0x01eb('0x34')]['filter']){_0x4e4eea[_0x01eb('0x3e')]=_[_0x01eb('0x3f')](_0x4e4eea[_0x01eb('0x3e')],{'$or':_[_0x01eb('0x2e')](_0x1256fb,function(_0xd137a2){if(_0xd137a2['type']!==_0x01eb('0x40')){var _0x3a36c4={};_0x3a36c4[_0xd137a2[_0x01eb('0x2c')]]={'$like':'%'+_0x3d0b44[_0x01eb('0x34')][_0x01eb('0x41')]+'%'};return _0x3a36c4;}})});}_0x4e4eea=_[_0x01eb('0x3f')]({},_0x4e4eea,_0x3d0b44['options']);var _0x1a9882={'where':_0x4e4eea[_0x01eb('0x3e')]};return db[_0x01eb('0x2f')][_0x01eb('0x22')](_0x1a9882)[_0x01eb('0x29')](function(_0x532a81){_0xd29bdc[_0x01eb('0x22')]=_0x532a81;if(_0x3d0b44['query']['includeAll']){_0x4e4eea['include']=[{'all':!![]}];}return db[_0x01eb('0x2f')][_0x01eb('0x42')](_0x4e4eea);})[_0x01eb('0x29')](function(_0x289ac1){_0xd29bdc[_0x01eb('0x43')]=_0x289ac1;return _0xd29bdc;})['then'](respondWithFilteredResult(_0x45980e,_0x4e4eea))['catch'](handleError(_0x45980e,null));};exports[_0x01eb('0x44')]=function(_0x51a907,_0x3a3992){var _0x2d8fb={'raw':![],'where':{'id':_0x51a907[_0x01eb('0x45')]['id']}},_0x413d6b={};_0x413d6b[_0x01eb('0x33')]=_[_0x01eb('0x46')](db[_0x01eb('0x2f')]['rawAttributes']);_0x413d6b[_0x01eb('0x34')]=_[_0x01eb('0x46')](_0x51a907[_0x01eb('0x34')]);_0x413d6b[_0x01eb('0x35')]=_[_0x01eb('0x36')](_0x413d6b[_0x01eb('0x33')],_0x413d6b[_0x01eb('0x34')]);_0x2d8fb[_0x01eb('0x37')]=_[_0x01eb('0x36')](_0x413d6b[_0x01eb('0x33')],qs[_0x01eb('0x38')](_0x51a907[_0x01eb('0x34')][_0x01eb('0x38')]));_0x2d8fb[_0x01eb('0x37')]=_0x2d8fb[_0x01eb('0x37')]['length']?_0x2d8fb['attributes']:_0x413d6b[_0x01eb('0x33')];if(_0x51a907[_0x01eb('0x34')][_0x01eb('0x47')]){_0x2d8fb[_0x01eb('0x48')]=[{'all':!![]}];}_0x2d8fb=_[_0x01eb('0x3f')]({},_0x2d8fb,_0x51a907[_0x01eb('0x49')]);return db[_0x01eb('0x2f')][_0x01eb('0x4a')](_0x2d8fb)['then'](handleEntityNotFound(_0x3a3992,null))['then'](respondWithResult(_0x3a3992,null))[_0x01eb('0x4b')](handleError(_0x3a3992,null));};exports[_0x01eb('0x4c')]=function(_0x295e3e,_0x2e344a){return db[_0x01eb('0x2f')][_0x01eb('0x4c')](_0x295e3e['body'],{})[_0x01eb('0x29')](respondWithResult(_0x2e344a,0xc9))[_0x01eb('0x4b')](handleError(_0x2e344a,null));};exports[_0x01eb('0x28')]=function(_0x581662,_0x2700d1){if(_0x581662[_0x01eb('0x4d')]['id']){delete _0x581662[_0x01eb('0x4d')]['id'];}return db[_0x01eb('0x2f')][_0x01eb('0x4a')]({'where':{'id':_0x581662['params']['id']}})[_0x01eb('0x29')](handleEntityNotFound(_0x2700d1,null))[_0x01eb('0x29')](saveUpdates(_0x581662[_0x01eb('0x4d')],null))[_0x01eb('0x29')](respondWithResult(_0x2700d1,null))[_0x01eb('0x4b')](handleError(_0x2700d1,null));};exports[_0x01eb('0x4e')]=function(_0xe8bdc8,_0x4523fa){return db[_0x01eb('0x2f')][_0x01eb('0x4a')]({'where':{'id':_0xe8bdc8['params']['id']}})['then'](handleEntityNotFound(_0x4523fa,null))[_0x01eb('0x29')](removeEntity(_0x4523fa,null))[_0x01eb('0x4b')](handleError(_0x4523fa,null));};exports[_0x01eb('0x4f')]=function(_0x2ad701,_0xe9b2f6,_0x1f6d64){var _0x59b7f5={};var _0x446f36={};var _0x4e9495;var _0x580428;return db[_0x01eb('0x2f')]['findOne']({'where':{'id':_0x2ad701[_0x01eb('0x45')]['id']}})[_0x01eb('0x29')](handleEntityNotFound(_0xe9b2f6,null))['then'](function(_0x36673b){if(_0x36673b){_0x4e9495=_0x36673b;_0x446f36[_0x01eb('0x33')]=_[_0x01eb('0x46')](db[_0x01eb('0x50')]['rawAttributes']);_0x446f36[_0x01eb('0x34')]=_['keys'](_0x2ad701['query']);_0x446f36[_0x01eb('0x35')]=_['intersection'](_0x446f36['model'],_0x446f36['query']);_0x59b7f5['attributes']=_[_0x01eb('0x36')](_0x446f36[_0x01eb('0x33')],qs[_0x01eb('0x38')](_0x2ad701[_0x01eb('0x34')][_0x01eb('0x38')]));_0x59b7f5['attributes']=_0x59b7f5['attributes'][_0x01eb('0x51')]?_0x59b7f5[_0x01eb('0x37')]:_0x446f36[_0x01eb('0x33')];_0x59b7f5[_0x01eb('0x3b')]=qs['sort'](_0x2ad701[_0x01eb('0x34')][_0x01eb('0x3c')]);_0x59b7f5[_0x01eb('0x3e')]=qs[_0x01eb('0x35')](_[_0x01eb('0x3d')](_0x2ad701[_0x01eb('0x34')],_0x446f36[_0x01eb('0x35')]));if(_0x2ad701[_0x01eb('0x34')]['filter']){_0x59b7f5[_0x01eb('0x3e')]=_[_0x01eb('0x3f')](_0x59b7f5[_0x01eb('0x3e')],{'$or':_['map'](_0x59b7f5['attributes'],function(_0x5b2cd3){var _0xa9c7e4={};_0xa9c7e4[_0x5b2cd3]={'$like':'%'+_0x2ad701[_0x01eb('0x34')][_0x01eb('0x41')]+'%'};return _0xa9c7e4;})});}_0x59b7f5=_[_0x01eb('0x3f')]({},_0x59b7f5,_0x2ad701[_0x01eb('0x49')]);return _0x4e9495[_0x01eb('0x4f')](_0x59b7f5);}})[_0x01eb('0x29')](function(_0xb7594f){if(_0xb7594f){_0x580428=_0xb7594f[_0x01eb('0x51')];if(!_0x2ad701[_0x01eb('0x34')][_0x01eb('0x39')](_0x01eb('0x3a'))){_0x59b7f5[_0x01eb('0x20')]=qs[_0x01eb('0x20')](_0x2ad701['query'][_0x01eb('0x20')]);_0x59b7f5[_0x01eb('0x1f')]=qs[_0x01eb('0x1f')](_0x2ad701['query'][_0x01eb('0x1f')]);}return _0x4e9495[_0x01eb('0x4f')](_0x59b7f5);}})[_0x01eb('0x29')](function(_0x540ff6){if(_0x540ff6){return _0x540ff6?{'count':_0x580428,'rows':_0x540ff6}:null;}})[_0x01eb('0x29')](respondWithResult(_0xe9b2f6,null))[_0x01eb('0x4b')](handleError(_0xe9b2f6,null));};exports[_0x01eb('0x52')]=function(_0x4a7c28,_0x187d2e,_0xcedcd2){var _0x318eb4={};var _0x1b0ac4={};var _0x2c9f93;var _0x339339;return db['ZendeskConfiguration'][_0x01eb('0x53')]({'where':{'id':_0x4a7c28[_0x01eb('0x45')]['id']}})[_0x01eb('0x29')](handleEntityNotFound(_0x187d2e,null))[_0x01eb('0x29')](function(_0x247f37){if(_0x247f37){_0x2c9f93=_0x247f37;_0x1b0ac4['model']=_[_0x01eb('0x46')](db[_0x01eb('0x50')][_0x01eb('0x30')]);_0x1b0ac4[_0x01eb('0x34')]=_[_0x01eb('0x46')](_0x4a7c28[_0x01eb('0x34')]);_0x1b0ac4[_0x01eb('0x35')]=_[_0x01eb('0x36')](_0x1b0ac4['model'],_0x1b0ac4['query']);_0x318eb4[_0x01eb('0x37')]=_[_0x01eb('0x36')](_0x1b0ac4['model'],qs[_0x01eb('0x38')](_0x4a7c28[_0x01eb('0x34')][_0x01eb('0x38')]));_0x318eb4[_0x01eb('0x37')]=_0x318eb4[_0x01eb('0x37')][_0x01eb('0x51')]?_0x318eb4[_0x01eb('0x37')]:_0x1b0ac4[_0x01eb('0x33')];_0x318eb4[_0x01eb('0x3b')]=qs[_0x01eb('0x3c')](_0x4a7c28[_0x01eb('0x34')]['sort']);_0x318eb4[_0x01eb('0x3e')]=qs[_0x01eb('0x35')](_[_0x01eb('0x3d')](_0x4a7c28[_0x01eb('0x34')],_0x1b0ac4[_0x01eb('0x35')]));if(_0x4a7c28[_0x01eb('0x34')][_0x01eb('0x41')]){_0x318eb4['where']=_['merge'](_0x318eb4['where'],{'$or':_['map'](_0x318eb4[_0x01eb('0x37')],function(_0x4fe422){var _0x3a9c96={};_0x3a9c96[_0x4fe422]={'$like':'%'+_0x4a7c28[_0x01eb('0x34')]['filter']+'%'};return _0x3a9c96;})});}_0x318eb4=_['merge']({},_0x318eb4,_0x4a7c28['options']);return _0x2c9f93[_0x01eb('0x52')](_0x318eb4);}})[_0x01eb('0x29')](function(_0x3da81e){if(_0x3da81e){_0x339339=_0x3da81e[_0x01eb('0x51')];if(!_0x4a7c28[_0x01eb('0x34')][_0x01eb('0x39')](_0x01eb('0x3a'))){_0x318eb4[_0x01eb('0x20')]=qs[_0x01eb('0x20')](_0x4a7c28[_0x01eb('0x34')][_0x01eb('0x20')]);_0x318eb4[_0x01eb('0x1f')]=qs[_0x01eb('0x1f')](_0x4a7c28[_0x01eb('0x34')][_0x01eb('0x1f')]);}return _0x2c9f93[_0x01eb('0x52')](_0x318eb4);}})[_0x01eb('0x29')](function(_0x9bf2ab){if(_0x9bf2ab){return _0x9bf2ab?{'count':_0x339339,'rows':_0x9bf2ab}:null;}})[_0x01eb('0x29')](respondWithResult(_0x187d2e,null))['catch'](handleError(_0x187d2e,null));};exports[_0x01eb('0x54')]=function(_0x3cd729,_0x5c0eb7,_0x1e663b){var _0xb20b7d={};var _0x3b2c03={};var _0x16059f;var _0x478ad1;return db[_0x01eb('0x2f')][_0x01eb('0x53')]({'where':{'id':_0x3cd729[_0x01eb('0x45')]['id']}})[_0x01eb('0x29')](handleEntityNotFound(_0x5c0eb7,null))[_0x01eb('0x29')](function(_0x2c6398){if(_0x2c6398){_0x16059f=_0x2c6398;_0x3b2c03[_0x01eb('0x33')]=_[_0x01eb('0x46')](db[_0x01eb('0x50')][_0x01eb('0x30')]);_0x3b2c03[_0x01eb('0x34')]=_[_0x01eb('0x46')](_0x3cd729[_0x01eb('0x34')]);_0x3b2c03[_0x01eb('0x35')]=_[_0x01eb('0x36')](_0x3b2c03['model'],_0x3b2c03[_0x01eb('0x34')]);_0xb20b7d[_0x01eb('0x37')]=_['intersection'](_0x3b2c03[_0x01eb('0x33')],qs[_0x01eb('0x38')](_0x3cd729[_0x01eb('0x34')][_0x01eb('0x38')]));_0xb20b7d[_0x01eb('0x37')]=_0xb20b7d[_0x01eb('0x37')][_0x01eb('0x51')]?_0xb20b7d[_0x01eb('0x37')]:_0x3b2c03[_0x01eb('0x33')];_0xb20b7d[_0x01eb('0x3b')]=qs[_0x01eb('0x3c')](_0x3cd729['query'][_0x01eb('0x3c')]);_0xb20b7d['where']=qs[_0x01eb('0x35')](_['pick'](_0x3cd729['query'],_0x3b2c03['filters']));if(_0x3cd729['query'][_0x01eb('0x41')]){_0xb20b7d['where']=_[_0x01eb('0x3f')](_0xb20b7d[_0x01eb('0x3e')],{'$or':_['map'](_0xb20b7d[_0x01eb('0x37')],function(_0x580bc6){var _0x1be4ea={};_0x1be4ea[_0x580bc6]={'$like':'%'+_0x3cd729['query'][_0x01eb('0x41')]+'%'};return _0x1be4ea;})});}_0xb20b7d=_[_0x01eb('0x3f')]({},_0xb20b7d,_0x3cd729[_0x01eb('0x49')]);return _0x16059f[_0x01eb('0x54')](_0xb20b7d);}})[_0x01eb('0x29')](function(_0x2491b7){if(_0x2491b7){_0x478ad1=_0x2491b7[_0x01eb('0x51')];if(!_0x3cd729[_0x01eb('0x34')][_0x01eb('0x39')](_0x01eb('0x3a'))){_0xb20b7d[_0x01eb('0x20')]=qs['limit'](_0x3cd729[_0x01eb('0x34')][_0x01eb('0x20')]);_0xb20b7d['offset']=qs[_0x01eb('0x1f')](_0x3cd729[_0x01eb('0x34')]['offset']);}return _0x16059f[_0x01eb('0x54')](_0xb20b7d);}})[_0x01eb('0x29')](function(_0x48da31){if(_0x48da31){return _0x48da31?{'count':_0x478ad1,'rows':_0x48da31}:null;}})['then'](respondWithResult(_0x5c0eb7,null))['catch'](handleError(_0x5c0eb7,null));};exports[_0x01eb('0x55')]=function(_0xcb9bd1,_0x4db70f,_0x1bf70b){var _0x14e8dc={};var _0x4ad80f={};var _0x4858e5;var _0x30a35b;return db[_0x01eb('0x2f')][_0x01eb('0x53')]({'where':{'id':_0xcb9bd1['params']['id']}})[_0x01eb('0x29')](handleEntityNotFound(_0x4db70f,null))[_0x01eb('0x29')](function(_0x11c305){if(_0x11c305){_0x4858e5=_0x11c305;_0x4ad80f[_0x01eb('0x33')]=_['keys'](db['Tag'][_0x01eb('0x30')]);_0x4ad80f['query']=_[_0x01eb('0x46')](_0xcb9bd1[_0x01eb('0x34')]);_0x4ad80f[_0x01eb('0x35')]=_[_0x01eb('0x36')](_0x4ad80f[_0x01eb('0x33')],_0x4ad80f[_0x01eb('0x34')]);_0x14e8dc['attributes']=_[_0x01eb('0x36')](_0x4ad80f[_0x01eb('0x33')],qs[_0x01eb('0x38')](_0xcb9bd1[_0x01eb('0x34')]['fields']));_0x14e8dc['attributes']=_0x14e8dc[_0x01eb('0x37')]['length']?_0x14e8dc[_0x01eb('0x37')]:_0x4ad80f[_0x01eb('0x33')];_0x14e8dc[_0x01eb('0x3b')]=qs['sort'](_0xcb9bd1['query']['sort']);_0x14e8dc[_0x01eb('0x3e')]=qs[_0x01eb('0x35')](_['pick'](_0xcb9bd1[_0x01eb('0x34')],_0x4ad80f[_0x01eb('0x35')]));if(_0xcb9bd1[_0x01eb('0x34')][_0x01eb('0x41')]){_0x14e8dc[_0x01eb('0x3e')]=_['merge'](_0x14e8dc['where'],{'$or':_[_0x01eb('0x2e')](_0x14e8dc[_0x01eb('0x37')],function(_0x19db42){var _0xcdbdad={};_0xcdbdad[_0x19db42]={'$like':'%'+_0xcb9bd1[_0x01eb('0x34')][_0x01eb('0x41')]+'%'};return _0xcdbdad;})});}_0x14e8dc=_[_0x01eb('0x3f')]({},_0x14e8dc,_0xcb9bd1[_0x01eb('0x49')]);return _0x4858e5[_0x01eb('0x55')](_0x14e8dc);}})[_0x01eb('0x29')](function(_0x2dd9b2){if(_0x2dd9b2){_0x30a35b=_0x2dd9b2[_0x01eb('0x51')];if(!_0xcb9bd1[_0x01eb('0x34')][_0x01eb('0x39')]('nolimit')){_0x14e8dc[_0x01eb('0x20')]=qs[_0x01eb('0x20')](_0xcb9bd1['query'][_0x01eb('0x20')]);_0x14e8dc['offset']=qs[_0x01eb('0x1f')](_0xcb9bd1['query'][_0x01eb('0x1f')]);}return _0x4858e5[_0x01eb('0x55')](_0x14e8dc);}})[_0x01eb('0x29')](function(_0x541c4b){if(_0x541c4b){return _0x541c4b?{'count':_0x30a35b,'rows':_0x541c4b}:null;}})[_0x01eb('0x29')](respondWithResult(_0x4db70f,null))[_0x01eb('0x4b')](handleError(_0x4db70f,null));};exports[_0x01eb('0x56')]=function(_0x3bef64,_0x1443ce,_0x2df9b6){if(_0x3bef64['body']['id']){delete _0x3bef64['body']['id'];}return db[_0x01eb('0x2f')][_0x01eb('0x53')]({'where':{'id':_0x3bef64[_0x01eb('0x45')]['id']}})[_0x01eb('0x29')](handleEntityNotFound(_0x1443ce,null))[_0x01eb('0x29')](function(_0x1d77df){if(_0x1d77df){return _0x1d77df['setTags'](_0x3bef64['body'][_0x01eb('0x57')]||[]);}return null;})[_0x01eb('0x29')](respondWithResult(_0x1443ce,null))[_0x01eb('0x4b')](handleError(_0x1443ce,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cad1268..a3b151c 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 _0xc900=['api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','../../config/logger'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xc900,0xb3));var _0x0c90=function(_0x12da49,_0x17842a){_0x12da49=_0x12da49-0x0;var _0x378ad0=_0xc900[_0x12da49];return _0x378ad0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb03e=['int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb03e,0x1eb));var _0xeb03=function(_0x81d79,_0xfb65d8){_0x81d79=_0x81d79-0x0;var _0x19e0ad=_0xb03e[_0x81d79];return _0x19e0ad;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'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 d714956..4df7d58 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 _0xa7db=['error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x477819,_0x71340f){var _0x464868=function(_0x1a178d){while(--_0x1a178d){_0x477819['push'](_0x477819['shift']());}};_0x464868(++_0x71340f);}(_0xa7db,0xf1));var _0xba7d=function(_0x41464b,_0x80f89c){_0x41464b=_0x41464b-0x0;var _0x5187e0=_0xa7db[_0x41464b];return _0x5187e0;};'use strict';var _=require('lodash');var util=require(_0xba7d('0x0'));var moment=require('moment');var BPromise=require(_0xba7d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba7d('0x2'));var db=require(_0xba7d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xba7d('0x4'))(_0xba7d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xba7d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x722c76,_0x57774f,_0x22c028){return new BPromise(function(_0x331b86,_0x597826){return client[_0xba7d('0x7')](_0x722c76,_0x22c028)[_0xba7d('0x8')](function(_0x264793){logger[_0xba7d('0x9')](_0xba7d('0xa'),_0x57774f,'request\x20sent');logger[_0xba7d('0xb')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x57774f,_0xba7d('0xc'),JSON[_0xba7d('0xd')](_0x264793));if(_0x264793[_0xba7d('0xe')]){if(_0x264793['error']['code']===0x1f4){logger[_0xba7d('0xe')](_0xba7d('0xa'),_0x57774f,_0x264793[_0xba7d('0xe')][_0xba7d('0xf')]);return _0x597826(_0x264793[_0xba7d('0xe')]['message']);}logger[_0xba7d('0xe')](_0xba7d('0xa'),_0x57774f,_0x264793[_0xba7d('0xe')][_0xba7d('0xf')]);return _0x331b86(_0x264793[_0xba7d('0xe')][_0xba7d('0xf')]);}else{logger['info'](_0xba7d('0xa'),_0x57774f,_0xba7d('0xc'));_0x331b86(_0x264793['result'][_0xba7d('0xf')]);}})[_0xba7d('0x10')](function(_0x4eace4){logger[_0xba7d('0xe')](_0xba7d('0xa'),_0x57774f,_0x4eace4);_0x597826(_0x4eace4);});});} \ No newline at end of file +var _0x0890=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x53a74f,_0x23673c){var _0x1b2d5d=function(_0x49d69b){while(--_0x49d69b){_0x53a74f['push'](_0x53a74f['shift']());}};_0x1b2d5d(++_0x23673c);}(_0x0890,0xe4));var _0x0089=function(_0x20a005,_0x3267c4){_0x20a005=_0x20a005-0x0;var _0x318723=_0x0890[_0x20a005];return _0x318723;};'use strict';var _=require(_0x0089('0x0'));var util=require(_0x0089('0x1'));var moment=require('moment');var BPromise=require(_0x0089('0x2'));var rs=require(_0x0089('0x3'));var fs=require('fs');var Redis=require(_0x0089('0x4'));var db=require(_0x0089('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0089('0x6'))('rpc');var config=require(_0x0089('0x7'));var jayson=require(_0x0089('0x8'));var client=jayson['client'][_0x0089('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5169da,_0x389368,_0x1f8bd1){return new BPromise(function(_0x281d85,_0x30c5d7){return client[_0x0089('0xa')](_0x5169da,_0x1f8bd1)['then'](function(_0x27284b){logger['info'](_0x0089('0xb'),_0x389368,_0x0089('0xc'));logger[_0x0089('0xd')](_0x0089('0xe'),_0x389368,'request\x20sent',JSON[_0x0089('0xf')](_0x27284b));if(_0x27284b['error']){if(_0x27284b['error']['code']===0x1f4){logger['error'](_0x0089('0xb'),_0x389368,_0x27284b[_0x0089('0x10')]['message']);return _0x30c5d7(_0x27284b['error'][_0x0089('0x11')]);}logger[_0x0089('0x10')](_0x0089('0xb'),_0x389368,_0x27284b[_0x0089('0x10')]['message']);return _0x281d85(_0x27284b[_0x0089('0x10')][_0x0089('0x11')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x389368,_0x0089('0xc'));_0x281d85(_0x27284b[_0x0089('0x12')][_0x0089('0x11')]);}})[_0x0089('0x13')](function(_0xae9a1f){logger[_0x0089('0x10')](_0x0089('0xb'),_0x389368,_0xae9a1f);_0x30c5d7(_0xae9a1f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ee43e7f..2530b21 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 _0x2dc6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x19e16f,_0x4a9324){var _0x242c29=function(_0x3c6694){while(--_0x3c6694){_0x19e16f['push'](_0x19e16f['shift']());}};_0x242c29(++_0x4a9324);}(_0x2dc6,0x1c4));var _0x62dc=function(_0x3759d2,_0x50258e){_0x3759d2=_0x3759d2-0x0;var _0x3499f5=_0x2dc6[_0x3759d2];return _0x3499f5;};'use strict';var multer=require('multer');var util=require(_0x62dc('0x0'));var path=require(_0x62dc('0x1'));var timeout=require(_0x62dc('0x2'));var express=require(_0x62dc('0x3'));var router=express['Router']();var fs_extra=require(_0x62dc('0x4'));var auth=require(_0x62dc('0x5'));var interaction=require(_0x62dc('0x6'));var config=require(_0x62dc('0x7'));var controller=require(_0x62dc('0x8'));router[_0x62dc('0x9')]('/',auth[_0x62dc('0xa')](),controller['index']);router[_0x62dc('0x9')](_0x62dc('0xb'),auth[_0x62dc('0xa')](),controller[_0x62dc('0xc')]);router[_0x62dc('0xd')]('/',auth['isAuthenticated'](),controller[_0x62dc('0xe')]);router[_0x62dc('0xf')](_0x62dc('0xb'),auth['isAuthenticated'](),controller[_0x62dc('0x10')]);router[_0x62dc('0x11')](_0x62dc('0xb'),auth[_0x62dc('0xa')](),controller['destroy']);module[_0x62dc('0x12')]=router; \ No newline at end of file +var _0x5e8a=['update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x48b122,_0x2e66d2){var _0x5f573a=function(_0x3b0901){while(--_0x3b0901){_0x48b122['push'](_0x48b122['shift']());}};_0x5f573a(++_0x2e66d2);}(_0x5e8a,0xae));var _0xa5e8=function(_0x3dcf18,_0x1c314f){_0x3dcf18=_0x3dcf18-0x0;var _0x202e0c=_0x5e8a[_0x3dcf18];return _0x202e0c;};'use strict';var multer=require(_0xa5e8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa5e8('0x1')]();var fs_extra=require(_0xa5e8('0x2'));var auth=require(_0xa5e8('0x3'));var interaction=require(_0xa5e8('0x4'));var config=require('../../config/environment');var controller=require(_0xa5e8('0x5'));router[_0xa5e8('0x6')]('/',auth[_0xa5e8('0x7')](),controller[_0xa5e8('0x8')]);router[_0xa5e8('0x6')](_0xa5e8('0x9'),auth[_0xa5e8('0x7')](),controller[_0xa5e8('0xa')]);router[_0xa5e8('0xb')]('/',auth[_0xa5e8('0x7')](),controller['create']);router[_0xa5e8('0xc')](_0xa5e8('0x9'),auth[_0xa5e8('0x7')](),controller[_0xa5e8('0xd')]);router[_0xa5e8('0xe')](_0xa5e8('0x9'),auth[_0xa5e8('0x7')](),controller[_0xa5e8('0xf')]);module[_0xa5e8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 16d18ce..457fb05 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 _0x64f5=['keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x64f5,0x10a));var _0x564f=function(_0x2cd9e2,_0x3b1331){_0x2cd9e2=_0x2cd9e2-0x0;var _0x5b4de0=_0x64f5[_0x2cd9e2];return _0x5b4de0;};'use strict';var Sequelize=require(_0x564f('0x0'));module[_0x564f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x564f('0x2'),'variable',_0x564f('0x3'),_0x564f('0x4'),_0x564f('0x5')),'defaultValue':_0x564f('0x2')},'content':{'type':Sequelize[_0x564f('0x6')]},'key':{'type':Sequelize[_0x564f('0x6')]},'keyType':{'type':Sequelize[_0x564f('0x7')](_0x564f('0x2'),_0x564f('0x8'),_0x564f('0x3'))},'keyContent':{'type':Sequelize[_0x564f('0x6')]},'idField':{'type':Sequelize[_0x564f('0x6')]},'nameField':{'type':Sequelize[_0x564f('0x6')]},'customField':{'type':Sequelize[_0x564f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x564f('0x6')]}}; \ No newline at end of file +var _0x8cf0=['picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0x8cf0,0xa4));var _0x08cf=function(_0x5cd8ae,_0x2e1e7a){_0x5cd8ae=_0x5cd8ae-0x0;var _0x24cce1=_0x8cf0[_0x5cd8ae];return _0x24cce1;};'use strict';var Sequelize=require(_0x08cf('0x0'));module[_0x08cf('0x1')]={'type':{'type':Sequelize[_0x08cf('0x2')](_0x08cf('0x3'),'variable',_0x08cf('0x4'),_0x08cf('0x5'),_0x08cf('0x6')),'defaultValue':_0x08cf('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x08cf('0x7')]},'keyType':{'type':Sequelize[_0x08cf('0x2')](_0x08cf('0x3'),_0x08cf('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x08cf('0x7')]},'idField':{'type':Sequelize[_0x08cf('0x7')]},'nameField':{'type':Sequelize[_0x08cf('0x7')]},'customField':{'type':Sequelize[_0x08cf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x08cf('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index c09770f..9289a61 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 _0xc288=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','update','then','destroy','error','stack','name','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','catch','keys','fields','includeAll','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto'];(function(_0x2cf8d3,_0x545a19){var _0x17a79d=function(_0x33f9fd){while(--_0x33f9fd){_0x2cf8d3['push'](_0x2cf8d3['shift']());}};_0x17a79d(++_0x545a19);}(_0xc288,0x18b));var _0x8c28=function(_0x1d063d,_0x25eaeb){_0x1d063d=_0x1d063d-0x0;var _0x10943a=_0xc288[_0x1d063d];return _0x10943a;};'use strict';var emlformat=require(_0x8c28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c28('0x1'));var jsonpatch=require(_0x8c28('0x2'));var rp=require(_0x8c28('0x3'));var moment=require(_0x8c28('0x4'));var BPromise=require(_0x8c28('0x5'));var Mustache=require(_0x8c28('0x6'));var util=require(_0x8c28('0x7'));var path=require(_0x8c28('0x8'));var sox=require(_0x8c28('0x9'));var csv=require(_0x8c28('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c28('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8c28('0xc'));var jsforce=require(_0x8c28('0xd'));var deskjs=require(_0x8c28('0xe'));var toCsv=require(_0x8c28('0xa'));var querystring=require(_0x8c28('0xf'));var Papa=require(_0x8c28('0x10'));var Redis=require('ioredis');var authService=require(_0x8c28('0x11'));var qs=require(_0x8c28('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8c28('0x13'));var utils=require(_0x8c28('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8c28('0x15'))['db'];function respondWithStatusCode(_0x55a7eb,_0x467a54){_0x467a54=_0x467a54||0xcc;return function(_0x450e14){if(_0x450e14){return _0x55a7eb[_0x8c28('0x16')](_0x467a54);}return _0x55a7eb['status'](_0x467a54)[_0x8c28('0x17')]();};}function respondWithResult(_0x47e1fe,_0x164671){_0x164671=_0x164671||0xc8;return function(_0x1b135c){if(_0x1b135c){return _0x47e1fe[_0x8c28('0x18')](_0x164671)[_0x8c28('0x19')](_0x1b135c);}};}function respondWithFilteredResult(_0xc61c8d,_0x324ebd){return function(_0x41f4c6){if(_0x41f4c6){var _0x3443cd=typeof _0x324ebd[_0x8c28('0x1a')]===_0x8c28('0x1b')&&typeof _0x324ebd[_0x8c28('0x1c')]==='undefined';var _0x58d0f7=_0x41f4c6['count'];var _0x4ab4ba=_0x3443cd?0x0:_0x324ebd[_0x8c28('0x1a')];var _0x3e8a0b=_0x3443cd?_0x41f4c6['count']:_0x324ebd['offset']+_0x324ebd[_0x8c28('0x1c')];var _0x20417a;if(_0x3e8a0b>=_0x58d0f7){_0x3e8a0b=_0x58d0f7;_0x20417a=0xc8;}else{_0x20417a=0xce;}_0xc61c8d[_0x8c28('0x18')](_0x20417a);return _0xc61c8d['set'](_0x8c28('0x1d'),_0x4ab4ba+'-'+_0x3e8a0b+'/'+_0x58d0f7)[_0x8c28('0x19')](_0x41f4c6);}return null;};}function patchUpdates(_0x2f78c7){return function(_0xcebaa9){try{jsonpatch['apply'](_0xcebaa9,_0x2f78c7,!![]);}catch(_0x70953e){return BPromise['reject'](_0x70953e);}return _0xcebaa9['save']();};}function saveUpdates(_0x526211,_0x21105d){return function(_0x515fe0){if(_0x515fe0){return _0x515fe0[_0x8c28('0x1e')](_0x526211)[_0x8c28('0x1f')](function(_0x3d37c7){return _0x3d37c7;});}return null;};}function removeEntity(_0x1ec10f,_0x40589f){return function(_0x5d0e91){if(_0x5d0e91){return _0x5d0e91[_0x8c28('0x20')]()[_0x8c28('0x1f')](function(){_0x1ec10f[_0x8c28('0x18')](0xcc)[_0x8c28('0x17')]();});}};}function handleEntityNotFound(_0x3c593d,_0x1f4382){return function(_0x59e116){if(!_0x59e116){_0x3c593d[_0x8c28('0x16')](0x194);}return _0x59e116;};}function handleError(_0x2318a1,_0x406d39){_0x406d39=_0x406d39||0x1f4;return function(_0x423e35){logger[_0x8c28('0x21')](_0x423e35[_0x8c28('0x22')]);if(_0x423e35[_0x8c28('0x23')]){delete _0x423e35[_0x8c28('0x23')];}_0x2318a1['status'](_0x406d39)['send'](_0x423e35);};}exports['index']=function(_0x18f9d8,_0x97d19c){var _0x1aba05={},_0x80b4={},_0x4de045={'count':0x0,'rows':[]};var _0x21592a=_[_0x8c28('0x24')](db[_0x8c28('0x25')][_0x8c28('0x26')],function(_0x3bdc6d){return{'name':_0x3bdc6d[_0x8c28('0x27')],'type':_0x3bdc6d[_0x8c28('0x28')][_0x8c28('0x29')]};});_0x80b4[_0x8c28('0x2a')]=_[_0x8c28('0x24')](_0x21592a,_0x8c28('0x23'));_0x80b4[_0x8c28('0x2b')]=_['keys'](_0x18f9d8[_0x8c28('0x2b')]);_0x80b4['filters']=_[_0x8c28('0x2c')](_0x80b4[_0x8c28('0x2a')],_0x80b4[_0x8c28('0x2b')]);_0x1aba05[_0x8c28('0x2d')]=_['intersection'](_0x80b4[_0x8c28('0x2a')],qs['fields'](_0x18f9d8[_0x8c28('0x2b')]['fields']));_0x1aba05[_0x8c28('0x2d')]=_0x1aba05[_0x8c28('0x2d')][_0x8c28('0x2e')]?_0x1aba05['attributes']:_0x80b4['model'];if(!_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x2f')](_0x8c28('0x30'))){_0x1aba05['limit']=qs[_0x8c28('0x1c')](_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x1c')]);_0x1aba05[_0x8c28('0x1a')]=qs[_0x8c28('0x1a')](_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x1a')]);}_0x1aba05['order']=qs[_0x8c28('0x31')](_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x31')]);_0x1aba05[_0x8c28('0x32')]=qs[_0x8c28('0x33')](_[_0x8c28('0x34')](_0x18f9d8[_0x8c28('0x2b')],_0x80b4[_0x8c28('0x33')]),_0x21592a);if(_0x18f9d8[_0x8c28('0x2b')]['filter']){_0x1aba05[_0x8c28('0x32')]=_[_0x8c28('0x35')](_0x1aba05[_0x8c28('0x32')],{'$or':_[_0x8c28('0x24')](_0x21592a,function(_0x2c8d0e){if(_0x2c8d0e['type']!==_0x8c28('0x36')){var _0x3dd583={};_0x3dd583[_0x2c8d0e[_0x8c28('0x23')]]={'$like':'%'+_0x18f9d8[_0x8c28('0x2b')][_0x8c28('0x37')]+'%'};return _0x3dd583;}})});}_0x1aba05=_[_0x8c28('0x35')]({},_0x1aba05,_0x18f9d8[_0x8c28('0x38')]);var _0x47add8={'where':_0x1aba05['where']};return db[_0x8c28('0x25')][_0x8c28('0x39')](_0x47add8)[_0x8c28('0x1f')](function(_0x539c0d){_0x4de045[_0x8c28('0x39')]=_0x539c0d;if(_0x18f9d8[_0x8c28('0x2b')]['includeAll']){_0x1aba05[_0x8c28('0x3a')]=[{'all':!![]}];}return db[_0x8c28('0x25')][_0x8c28('0x3b')](_0x1aba05);})[_0x8c28('0x1f')](function(_0x3fba8a){_0x4de045['rows']=_0x3fba8a;return _0x4de045;})['then'](respondWithFilteredResult(_0x97d19c,_0x1aba05))[_0x8c28('0x3c')](handleError(_0x97d19c,null));};exports['show']=function(_0x34d170,_0x56e1a2){var _0x27013d={'raw':!![],'where':{'id':_0x34d170['params']['id']}},_0x753b52={};_0x753b52[_0x8c28('0x2a')]=_[_0x8c28('0x3d')](db[_0x8c28('0x25')][_0x8c28('0x26')]);_0x753b52[_0x8c28('0x2b')]=_[_0x8c28('0x3d')](_0x34d170[_0x8c28('0x2b')]);_0x753b52[_0x8c28('0x33')]=_['intersection'](_0x753b52[_0x8c28('0x2a')],_0x753b52[_0x8c28('0x2b')]);_0x27013d['attributes']=_['intersection'](_0x753b52['model'],qs[_0x8c28('0x3e')](_0x34d170['query'][_0x8c28('0x3e')]));_0x27013d[_0x8c28('0x2d')]=_0x27013d[_0x8c28('0x2d')][_0x8c28('0x2e')]?_0x27013d['attributes']:_0x753b52['model'];if(_0x34d170[_0x8c28('0x2b')][_0x8c28('0x3f')]){_0x27013d[_0x8c28('0x3a')]=[{'all':!![]}];}_0x27013d=_['merge']({},_0x27013d,_0x34d170[_0x8c28('0x38')]);return db[_0x8c28('0x25')]['find'](_0x27013d)[_0x8c28('0x1f')](handleEntityNotFound(_0x56e1a2,null))['then'](respondWithResult(_0x56e1a2,null))['catch'](handleError(_0x56e1a2,null));};exports[_0x8c28('0x40')]=function(_0x3c43f5,_0x3506a0){return db[_0x8c28('0x25')][_0x8c28('0x40')](_0x3c43f5[_0x8c28('0x41')],{})[_0x8c28('0x1f')](respondWithResult(_0x3506a0,0xc9))['catch'](handleError(_0x3506a0,null));};exports[_0x8c28('0x1e')]=function(_0x50af4e,_0x40ea4d){if(_0x50af4e[_0x8c28('0x41')]['id']){delete _0x50af4e[_0x8c28('0x41')]['id'];}return db[_0x8c28('0x25')][_0x8c28('0x42')]({'where':{'id':_0x50af4e[_0x8c28('0x43')]['id']}})[_0x8c28('0x1f')](handleEntityNotFound(_0x40ea4d,null))[_0x8c28('0x1f')](saveUpdates(_0x50af4e['body'],null))[_0x8c28('0x1f')](respondWithResult(_0x40ea4d,null))[_0x8c28('0x3c')](handleError(_0x40ea4d,null));};exports[_0x8c28('0x20')]=function(_0x31073e,_0x5a6105){return db[_0x8c28('0x25')]['find']({'where':{'id':_0x31073e['params']['id']}})[_0x8c28('0x1f')](handleEntityNotFound(_0x5a6105,null))[_0x8c28('0x1f')](removeEntity(_0x5a6105,null))[_0x8c28('0x3c')](handleError(_0x5a6105,null));}; \ No newline at end of file +var _0x87ae=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','status','error','name','send','ZendeskField','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','include','findAll','catch','params','length','includeAll','find','create','body','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x87ae,0xf5));var _0xe87a=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x87ae[_0x5ecadc];return _0x565037;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe87a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe87a('0x1'));var BPromise=require(_0xe87a('0x2'));var Mustache=require(_0xe87a('0x3'));var util=require('util');var path=require(_0xe87a('0x4'));var sox=require(_0xe87a('0x5'));var csv=require(_0xe87a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe87a('0x7'));var squel=require(_0xe87a('0x8'));var crypto=require('crypto');var jsforce=require(_0xe87a('0x9'));var deskjs=require(_0xe87a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe87a('0xb'));var Papa=require(_0xe87a('0xc'));var Redis=require('ioredis');var authService=require(_0xe87a('0xd'));var qs=require(_0xe87a('0xe'));var as=require(_0xe87a('0xf'));var hardwareService=require(_0xe87a('0x10'));var logger=require(_0xe87a('0x11'))(_0xe87a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe87a('0x13'));var db=require(_0xe87a('0x14'))['db'];function respondWithStatusCode(_0x3e990c,_0x4db185){_0x4db185=_0x4db185||0xcc;return function(_0x1a725a){if(_0x1a725a){return _0x3e990c[_0xe87a('0x15')](_0x4db185);}return _0x3e990c['status'](_0x4db185)[_0xe87a('0x16')]();};}function respondWithResult(_0x353c52,_0x136340){_0x136340=_0x136340||0xc8;return function(_0x5032c5){if(_0x5032c5){return _0x353c52['status'](_0x136340)['json'](_0x5032c5);}};}function respondWithFilteredResult(_0x53a4f7,_0x44474f){return function(_0x1fa2cd){if(_0x1fa2cd){var _0xd2ca53=typeof _0x44474f[_0xe87a('0x17')]==='undefined'&&typeof _0x44474f[_0xe87a('0x18')]===_0xe87a('0x19');var _0x527c58=_0x1fa2cd['count'];var _0x4160e2=_0xd2ca53?0x0:_0x44474f['offset'];var _0x182e6f=_0xd2ca53?_0x1fa2cd[_0xe87a('0x1a')]:_0x44474f[_0xe87a('0x17')]+_0x44474f['limit'];var _0x444eeb;if(_0x182e6f>=_0x527c58){_0x182e6f=_0x527c58;_0x444eeb=0xc8;}else{_0x444eeb=0xce;}_0x53a4f7['status'](_0x444eeb);return _0x53a4f7[_0xe87a('0x1b')](_0xe87a('0x1c'),_0x4160e2+'-'+_0x182e6f+'/'+_0x527c58)[_0xe87a('0x1d')](_0x1fa2cd);}return null;};}function patchUpdates(_0x4059e1){return function(_0x104f67){try{jsonpatch[_0xe87a('0x1e')](_0x104f67,_0x4059e1,!![]);}catch(_0x1e37aa){return BPromise[_0xe87a('0x1f')](_0x1e37aa);}return _0x104f67['save']();};}function saveUpdates(_0x59c17c,_0x42ba03){return function(_0x363c6a){if(_0x363c6a){return _0x363c6a[_0xe87a('0x20')](_0x59c17c)[_0xe87a('0x21')](function(_0x15ced2){return _0x15ced2;});}return null;};}function removeEntity(_0x46731f,_0x56eba0){return function(_0x59d9f7){if(_0x59d9f7){return _0x59d9f7['destroy']()['then'](function(){_0x46731f[_0xe87a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1108d0,_0x59dc1a){return function(_0x19f21e){if(!_0x19f21e){_0x1108d0[_0xe87a('0x15')](0x194);}return _0x19f21e;};}function handleError(_0x13e0a8,_0x16ee69){_0x16ee69=_0x16ee69||0x1f4;return function(_0x294d8b){logger[_0xe87a('0x23')](_0x294d8b['stack']);if(_0x294d8b[_0xe87a('0x24')]){delete _0x294d8b['name'];}_0x13e0a8['status'](_0x16ee69)[_0xe87a('0x25')](_0x294d8b);};}exports['index']=function(_0x537b52,_0x58a2b8){var _0x17c895={},_0x6feaf6={},_0x36d4cc={'count':0x0,'rows':[]};var _0x4eae3f=_['map'](db[_0xe87a('0x26')]['rawAttributes'],function(_0x4f61f7){return{'name':_0x4f61f7[_0xe87a('0x27')],'type':_0x4f61f7[_0xe87a('0x28')][_0xe87a('0x29')]};});_0x6feaf6[_0xe87a('0x2a')]=_[_0xe87a('0x2b')](_0x4eae3f,'name');_0x6feaf6[_0xe87a('0x2c')]=_['keys'](_0x537b52[_0xe87a('0x2c')]);_0x6feaf6['filters']=_[_0xe87a('0x2d')](_0x6feaf6[_0xe87a('0x2a')],_0x6feaf6[_0xe87a('0x2c')]);_0x17c895[_0xe87a('0x2e')]=_[_0xe87a('0x2d')](_0x6feaf6[_0xe87a('0x2a')],qs[_0xe87a('0x2f')](_0x537b52[_0xe87a('0x2c')][_0xe87a('0x2f')]));_0x17c895[_0xe87a('0x2e')]=_0x17c895['attributes']['length']?_0x17c895['attributes']:_0x6feaf6[_0xe87a('0x2a')];if(!_0x537b52['query'][_0xe87a('0x30')](_0xe87a('0x31'))){_0x17c895['limit']=qs[_0xe87a('0x18')](_0x537b52['query']['limit']);_0x17c895[_0xe87a('0x17')]=qs[_0xe87a('0x17')](_0x537b52[_0xe87a('0x2c')][_0xe87a('0x17')]);}_0x17c895['order']=qs[_0xe87a('0x32')](_0x537b52[_0xe87a('0x2c')]['sort']);_0x17c895[_0xe87a('0x33')]=qs[_0xe87a('0x34')](_['pick'](_0x537b52[_0xe87a('0x2c')],_0x6feaf6[_0xe87a('0x34')]),_0x4eae3f);if(_0x537b52[_0xe87a('0x2c')][_0xe87a('0x35')]){_0x17c895[_0xe87a('0x33')]=_['merge'](_0x17c895[_0xe87a('0x33')],{'$or':_['map'](_0x4eae3f,function(_0x28ed95){if(_0x28ed95['type']!=='VIRTUAL'){var _0x4315f5={};_0x4315f5[_0x28ed95[_0xe87a('0x24')]]={'$like':'%'+_0x537b52[_0xe87a('0x2c')][_0xe87a('0x35')]+'%'};return _0x4315f5;}})});}_0x17c895=_[_0xe87a('0x36')]({},_0x17c895,_0x537b52[_0xe87a('0x37')]);var _0x8423ba={'where':_0x17c895[_0xe87a('0x33')]};return db[_0xe87a('0x26')][_0xe87a('0x1a')](_0x8423ba)[_0xe87a('0x21')](function(_0x211a3e){_0x36d4cc[_0xe87a('0x1a')]=_0x211a3e;if(_0x537b52[_0xe87a('0x2c')]['includeAll']){_0x17c895[_0xe87a('0x38')]=[{'all':!![]}];}return db[_0xe87a('0x26')][_0xe87a('0x39')](_0x17c895);})[_0xe87a('0x21')](function(_0x5eb4e1){_0x36d4cc['rows']=_0x5eb4e1;return _0x36d4cc;})['then'](respondWithFilteredResult(_0x58a2b8,_0x17c895))[_0xe87a('0x3a')](handleError(_0x58a2b8,null));};exports['show']=function(_0x5400ff,_0x3bcee7){var _0x5eb62e={'raw':!![],'where':{'id':_0x5400ff[_0xe87a('0x3b')]['id']}},_0x5b1f55={};_0x5b1f55[_0xe87a('0x2a')]=_['keys'](db[_0xe87a('0x26')]['rawAttributes']);_0x5b1f55['query']=_['keys'](_0x5400ff[_0xe87a('0x2c')]);_0x5b1f55[_0xe87a('0x34')]=_['intersection'](_0x5b1f55[_0xe87a('0x2a')],_0x5b1f55[_0xe87a('0x2c')]);_0x5eb62e[_0xe87a('0x2e')]=_['intersection'](_0x5b1f55['model'],qs['fields'](_0x5400ff['query'][_0xe87a('0x2f')]));_0x5eb62e['attributes']=_0x5eb62e[_0xe87a('0x2e')][_0xe87a('0x3c')]?_0x5eb62e[_0xe87a('0x2e')]:_0x5b1f55[_0xe87a('0x2a')];if(_0x5400ff['query'][_0xe87a('0x3d')]){_0x5eb62e[_0xe87a('0x38')]=[{'all':!![]}];}_0x5eb62e=_['merge']({},_0x5eb62e,_0x5400ff[_0xe87a('0x37')]);return db[_0xe87a('0x26')][_0xe87a('0x3e')](_0x5eb62e)[_0xe87a('0x21')](handleEntityNotFound(_0x3bcee7,null))[_0xe87a('0x21')](respondWithResult(_0x3bcee7,null))[_0xe87a('0x3a')](handleError(_0x3bcee7,null));};exports[_0xe87a('0x3f')]=function(_0x4595be,_0x2aa508){return db['ZendeskField'][_0xe87a('0x3f')](_0x4595be[_0xe87a('0x40')],{})[_0xe87a('0x21')](respondWithResult(_0x2aa508,0xc9))[_0xe87a('0x3a')](handleError(_0x2aa508,null));};exports['update']=function(_0x6ddec4,_0x28c00b){if(_0x6ddec4[_0xe87a('0x40')]['id']){delete _0x6ddec4[_0xe87a('0x40')]['id'];}return db[_0xe87a('0x26')][_0xe87a('0x3e')]({'where':{'id':_0x6ddec4[_0xe87a('0x3b')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0x28c00b,null))['then'](saveUpdates(_0x6ddec4[_0xe87a('0x40')],null))[_0xe87a('0x21')](respondWithResult(_0x28c00b,null))[_0xe87a('0x3a')](handleError(_0x28c00b,null));};exports['destroy']=function(_0x19d380,_0xc43c4a){return db[_0xe87a('0x26')][_0xe87a('0x3e')]({'where':{'id':_0x19d380[_0xe87a('0x3b')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0xc43c4a,null))[_0xe87a('0x21')](removeEntity(_0xc43c4a,null))[_0xe87a('0x3a')](handleError(_0xc43c4a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e1b5d38..9cc2826 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 _0xea2a=['request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','idField','util','../../config/logger','moment','bluebird'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0xea2a,0x1b6));var _0xaea2=function(_0x3ff58e,_0xc9ca44){_0x3ff58e=_0x3ff58e-0x0;var _0x23f36f=_0xea2a[_0x3ff58e];return _0x23f36f;};'use strict';var _=require('lodash');var util=require(_0xaea2('0x0'));var logger=require(_0xaea2('0x1'))('api');var moment=require(_0xaea2('0x2'));var BPromise=require(_0xaea2('0x3'));var rp=require(_0xaea2('0x4'));var fs=require('fs');var path=require(_0xaea2('0x5'));var rimraf=require(_0xaea2('0x6'));var config=require(_0xaea2('0x7'));var attributes=require(_0xaea2('0x8'));module['exports']=function(_0x2ac852,_0x2e2f19){return _0x2ac852[_0xaea2('0x9')]('ZendeskField',attributes,{'tableName':_0xaea2('0xa'),'paranoid':![],'indexes':[{'name':_0xaea2('0xb'),'fields':[_0xaea2('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b3b=['./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x48a81d,_0x2b3d9e){var _0x19699a=function(_0x117ebf){while(--_0x117ebf){_0x48a81d['push'](_0x48a81d['shift']());}};_0x19699a(++_0x2b3d9e);}(_0x8b3b,0xfe));var _0xb8b3=function(_0xb4d928,_0x579093){_0xb4d928=_0xb4d928-0x0;var _0x47166e=_0x8b3b[_0xb4d928];return _0x47166e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb8b3('0x0'))(_0xb8b3('0x1'));var moment=require(_0xb8b3('0x2'));var BPromise=require('bluebird');var rp=require(_0xb8b3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8b3('0x4'));var config=require(_0xb8b3('0x5'));var attributes=require(_0xb8b3('0x6'));module[_0xb8b3('0x7')]=function(_0x53a2e9,_0x4328ad){return _0x53a2e9[_0xb8b3('0x8')]('ZendeskField',attributes,{'tableName':_0xb8b3('0x9'),'paranoid':![],'indexes':[{'name':_0xb8b3('0xa'),'fields':[_0xb8b3('0xb'),_0xb8b3('0xc')],'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 6b3a46c..53b7e91 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 _0x9a83=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x5ebdd2,_0x3193c5){var _0x2dbf57=function(_0x5a1181){while(--_0x5a1181){_0x5ebdd2['push'](_0x5ebdd2['shift']());}};_0x2dbf57(++_0x3193c5);}(_0x9a83,0x1a6));var _0x39a8=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x9a83[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0x39a8('0x0'));var util=require(_0x39a8('0x1'));var moment=require(_0x39a8('0x2'));var BPromise=require(_0x39a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39a8('0x4'))['db'];var utils=require(_0x39a8('0x5'));var logger=require(_0x39a8('0x6'))('rpc');var config=require(_0x39a8('0x7'));var jayson=require(_0x39a8('0x8'));var client=jayson[_0x39a8('0x9')][_0x39a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf1621d,_0xd5fc54,_0x7704f5){return new BPromise(function(_0x23987a,_0x130e47){return client[_0x39a8('0xb')](_0xf1621d,_0x7704f5)[_0x39a8('0xc')](function(_0x24219b){logger[_0x39a8('0xd')](_0x39a8('0xe'),_0xd5fc54,_0x39a8('0xf'));logger[_0x39a8('0x10')](_0x39a8('0x11'),_0xd5fc54,_0x39a8('0xf'),JSON[_0x39a8('0x12')](_0x24219b));if(_0x24219b[_0x39a8('0x13')]){if(_0x24219b[_0x39a8('0x13')]['code']===0x1f4){logger[_0x39a8('0x13')](_0x39a8('0xe'),_0xd5fc54,_0x24219b['error'][_0x39a8('0x14')]);return _0x130e47(_0x24219b['error'][_0x39a8('0x14')]);}logger['error'](_0x39a8('0xe'),_0xd5fc54,_0x24219b['error'][_0x39a8('0x14')]);return _0x23987a(_0x24219b[_0x39a8('0x13')][_0x39a8('0x14')]);}else{logger[_0x39a8('0xd')](_0x39a8('0xe'),_0xd5fc54,_0x39a8('0xf'));_0x23987a(_0x24219b[_0x39a8('0x15')][_0x39a8('0x14')]);}})[_0x39a8('0x16')](function(_0x39c947){logger['error'](_0x39a8('0xe'),_0xd5fc54,_0x39c947);_0x130e47(_0x39c947);});});} \ No newline at end of file +var _0x5ef8=['then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x4f652b,_0x5316e0){var _0x45ee12=function(_0x3e47ef){while(--_0x3e47ef){_0x4f652b['push'](_0x4f652b['shift']());}};_0x45ee12(++_0x5316e0);}(_0x5ef8,0x18c));var _0x85ef=function(_0x9f1dc7,_0x2b1ed9){_0x9f1dc7=_0x9f1dc7-0x0;var _0x42869c=_0x5ef8[_0x9f1dc7];return _0x42869c;};'use strict';var _=require(_0x85ef('0x0'));var util=require(_0x85ef('0x1'));var moment=require(_0x85ef('0x2'));var BPromise=require(_0x85ef('0x3'));var rs=require(_0x85ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85ef('0x5'))['db'];var utils=require(_0x85ef('0x6'));var logger=require('../../config/logger')(_0x85ef('0x7'));var config=require(_0x85ef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x85ef('0x9')][_0x85ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x262f23,_0x14edb9,_0x3cf7d1){return new BPromise(function(_0x143b0e,_0x2845f0){return client[_0x85ef('0xb')](_0x262f23,_0x3cf7d1)[_0x85ef('0xc')](function(_0x118f9f){logger[_0x85ef('0xd')]('ZendeskField,\x20%s,\x20%s',_0x14edb9,_0x85ef('0xe'));logger[_0x85ef('0xf')](_0x85ef('0x10'),_0x14edb9,_0x85ef('0xe'),JSON[_0x85ef('0x11')](_0x118f9f));if(_0x118f9f[_0x85ef('0x12')]){if(_0x118f9f[_0x85ef('0x12')][_0x85ef('0x13')]===0x1f4){logger[_0x85ef('0x12')](_0x85ef('0x14'),_0x14edb9,_0x118f9f[_0x85ef('0x12')]['message']);return _0x2845f0(_0x118f9f[_0x85ef('0x12')][_0x85ef('0x15')]);}logger[_0x85ef('0x12')](_0x85ef('0x14'),_0x14edb9,_0x118f9f[_0x85ef('0x12')][_0x85ef('0x15')]);return _0x143b0e(_0x118f9f[_0x85ef('0x12')][_0x85ef('0x15')]);}else{logger[_0x85ef('0xd')](_0x85ef('0x14'),_0x14edb9,'request\x20sent');_0x143b0e(_0x118f9f[_0x85ef('0x16')][_0x85ef('0x15')]);}})[_0x85ef('0x17')](function(_0x26e595){logger['error']('ZendeskField,\x20%s,\x20%s',_0x14edb9,_0x26e595);_0x2845f0(_0x26e595);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2acc30f..05d8181 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 _0xfc75=['post','/:id/configurations','isAuthenticated','put','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','./intZohoAccount.controller','get','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xfc75,0x8b));var _0x5fc7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfc75[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5fc7('0x0'));var util=require(_0x5fc7('0x1'));var path=require('path');var timeout=require(_0x5fc7('0x2'));var express=require('express');var router=express[_0x5fc7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5fc7('0x4'));var config=require('../../config/environment');var controller=require(_0x5fc7('0x5'));router[_0x5fc7('0x6')]('/',auth['isAuthenticated'](),controller[_0x5fc7('0x7')]);router[_0x5fc7('0x6')](_0x5fc7('0x8'),auth['isAuthenticated'](),controller[_0x5fc7('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5fc7('0xa')]);router[_0x5fc7('0x6')](_0x5fc7('0xb'),auth['isAuthenticated'](),controller[_0x5fc7('0xc')]);router[_0x5fc7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5fc7('0xd')](_0x5fc7('0xe'),auth[_0x5fc7('0xf')](),controller['addConfiguration']);router[_0x5fc7('0x10')](_0x5fc7('0x8'),auth[_0x5fc7('0xf')](),controller['update']);router[_0x5fc7('0x11')](_0x5fc7('0x8'),auth[_0x5fc7('0xf')](),controller[_0x5fc7('0x12')]);module['exports']=router; \ No newline at end of file +var _0xde86=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','update','delete'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xde86,0x1a6));var _0x6de8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde86[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6de8('0x0'));var path=require(_0x6de8('0x1'));var timeout=require(_0x6de8('0x2'));var express=require('express');var router=express[_0x6de8('0x3')]();var fs_extra=require(_0x6de8('0x4'));var auth=require(_0x6de8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6de8('0x6'));var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6de8('0x7')]);router[_0x6de8('0x8')](_0x6de8('0x9'),auth[_0x6de8('0xa')](),controller['show']);router[_0x6de8('0x8')]('/:id/configurations',auth[_0x6de8('0xa')](),controller[_0x6de8('0xb')]);router['get'](_0x6de8('0xc'),auth[_0x6de8('0xa')](),controller[_0x6de8('0xd')]);router[_0x6de8('0xe')]('/',auth[_0x6de8('0xa')](),controller['create']);router[_0x6de8('0xe')](_0x6de8('0xf'),auth[_0x6de8('0xa')](),controller['addConfiguration']);router[_0x6de8('0x10')](_0x6de8('0x9'),auth['isAuthenticated'](),controller[_0x6de8('0x11')]);router[_0x6de8('0x12')](_0x6de8('0x9'),auth[_0x6de8('0xa')](),controller[_0x6de8('0x13')]);module[_0x6de8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 4a335c3..34c78b1 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 _0xbec5=['STRING','sequelize','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xbec5,0xe5));var _0x5bec=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0xbec5[_0x299784];return _0x5ab008;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file +var _0x84ab=['sequelize','exports','STRING'];(function(_0x34de24,_0x35f67b){var _0x882138=function(_0x1106fb){while(--_0x1106fb){_0x34de24['push'](_0x34de24['shift']());}};_0x882138(++_0x35f67b);}(_0x84ab,0x12f));var _0xb84a=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0x84ab[_0x91d019];return _0x19de1f;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'name':{'type':Sequelize[_0xb84a('0x2')]},'description':{'type':Sequelize[_0xb84a('0x2')]},'host':{'type':Sequelize[_0xb84a('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb84a('0x2')]},'clientSecret':{'type':Sequelize[_0xb84a('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb84a('0x2')]},'refreshToken':{'type':Sequelize[_0xb84a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 2feefd9..91fdf47 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 _0x67e1=['refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','status','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','AccountId','Subjects','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x67e1,0xa8));var _0x167e=function(_0x2a2a80,_0x59debe){_0x2a2a80=_0x2a2a80-0x0;var _0x296163=_0x67e1[_0x2a2a80];return _0x296163;};'use strict';var emlformat=require(_0x167e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x167e('0x1'));var rp=require(_0x167e('0x2'));var moment=require(_0x167e('0x3'));var BPromise=require(_0x167e('0x4'));var Mustache=require(_0x167e('0x5'));var util=require('util');var path=require(_0x167e('0x6'));var sox=require('sox');var csv=require(_0x167e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x167e('0x8'));var _=require(_0x167e('0x9'));var squel=require(_0x167e('0xa'));var crypto=require(_0x167e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x167e('0xc'));var Papa=require(_0x167e('0xd'));var Redis=require(_0x167e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x167e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x167e('0x10'));var logger=require(_0x167e('0x11'))(_0x167e('0x12'));var utils=require(_0x167e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x167e('0x14'));var db=require(_0x167e('0x15'))['db'];var integrations=require(_0x167e('0x16'));function respondWithStatusCode(_0x57b93a,_0x2598d1){_0x2598d1=_0x2598d1||0xcc;return function(_0x174295){if(_0x174295){return _0x57b93a[_0x167e('0x17')](_0x2598d1);}return _0x57b93a['status'](_0x2598d1)[_0x167e('0x18')]();};}function respondWithResult(_0x3092b7,_0x3dffe7){_0x3dffe7=_0x3dffe7||0xc8;return function(_0x5f0e4c){if(_0x5f0e4c){return _0x3092b7['status'](_0x3dffe7)[_0x167e('0x19')](_0x5f0e4c);}};}function respondWithFilteredResult(_0x51640e,_0x5c074a){return function(_0x528032){if(_0x528032){var _0x14f1b6=typeof _0x5c074a[_0x167e('0x1a')]===_0x167e('0x1b')&&typeof _0x5c074a['limit']===_0x167e('0x1b');var _0x5040b6=_0x528032[_0x167e('0x1c')];var _0xce088c=_0x14f1b6?0x0:_0x5c074a[_0x167e('0x1a')];var _0x57ec92=_0x14f1b6?_0x528032[_0x167e('0x1c')]:_0x5c074a[_0x167e('0x1a')]+_0x5c074a['limit'];var _0x309b2e;if(_0x57ec92>=_0x5040b6){_0x57ec92=_0x5040b6;_0x309b2e=0xc8;}else{_0x309b2e=0xce;}_0x51640e['status'](_0x309b2e);return _0x51640e[_0x167e('0x1d')](_0x167e('0x1e'),_0xce088c+'-'+_0x57ec92+'/'+_0x5040b6)[_0x167e('0x19')](_0x528032);}return null;};}function patchUpdates(_0x1a4ea7){return function(_0x3d5803){try{jsonpatch[_0x167e('0x1f')](_0x3d5803,_0x1a4ea7,!![]);}catch(_0x429998){return BPromise[_0x167e('0x20')](_0x429998);}return _0x3d5803[_0x167e('0x21')]();};}function saveUpdates(_0x5a5479,_0x4244b9){return function(_0x16953b){if(_0x16953b){return _0x16953b[_0x167e('0x22')](_0x5a5479)[_0x167e('0x23')](function(_0x2803ce){return _0x2803ce;});}return null;};}function removeEntity(_0x34093e,_0x2629d8){return function(_0x49fe64){if(_0x49fe64){return _0x49fe64[_0x167e('0x24')]()['then'](function(){_0x34093e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb29f61,_0x5976de){return function(_0x292786){if(!_0x292786){_0xb29f61[_0x167e('0x17')](0x194);}return _0x292786;};}function handleError(_0x2bc8db,_0x71c26){_0x71c26=_0x71c26||0x1f4;return function(_0x6debf7){logger[_0x167e('0x25')](_0x6debf7['stack']);if(_0x6debf7[_0x167e('0x26')]){delete _0x6debf7[_0x167e('0x26')];}_0x2bc8db['status'](_0x71c26)[_0x167e('0x27')](_0x6debf7);};}exports['index']=function(_0x235572,_0x59b253){var _0x39a5a6={},_0x5be67b={},_0x4763c6={'count':0x0,'rows':[]};var _0x90191d=_[_0x167e('0x28')](db[_0x167e('0x29')][_0x167e('0x2a')],function(_0x3d8d71){return{'name':_0x3d8d71[_0x167e('0x2b')],'type':_0x3d8d71[_0x167e('0x2c')][_0x167e('0x2d')]};});_0x5be67b[_0x167e('0x2e')]=_['map'](_0x90191d,_0x167e('0x26'));_0x5be67b[_0x167e('0x2f')]=_[_0x167e('0x30')](_0x235572[_0x167e('0x2f')]);_0x5be67b[_0x167e('0x31')]=_['intersection'](_0x5be67b[_0x167e('0x2e')],_0x5be67b[_0x167e('0x2f')]);_0x39a5a6[_0x167e('0x32')]=_['intersection'](_0x5be67b[_0x167e('0x2e')],qs['fields'](_0x235572['query'][_0x167e('0x33')]));_0x39a5a6[_0x167e('0x32')]=_0x39a5a6[_0x167e('0x32')][_0x167e('0x34')]?_0x39a5a6[_0x167e('0x32')]:_0x5be67b['model'];if(!_0x235572[_0x167e('0x2f')]['hasOwnProperty'](_0x167e('0x35'))){_0x39a5a6[_0x167e('0x36')]=qs[_0x167e('0x36')](_0x235572[_0x167e('0x2f')]['limit']);_0x39a5a6['offset']=qs['offset'](_0x235572[_0x167e('0x2f')]['offset']);}_0x39a5a6[_0x167e('0x37')]=qs[_0x167e('0x38')](_0x235572[_0x167e('0x2f')]['sort']);_0x39a5a6[_0x167e('0x39')]=qs['filters'](_['pick'](_0x235572['query'],_0x5be67b[_0x167e('0x31')]),_0x90191d);if(_0x235572[_0x167e('0x2f')][_0x167e('0x3a')]){_0x39a5a6[_0x167e('0x39')]=_['merge'](_0x39a5a6[_0x167e('0x39')],{'$or':_[_0x167e('0x28')](_0x90191d,function(_0x4fdfd8){if(_0x4fdfd8[_0x167e('0x2c')]!==_0x167e('0x3b')){var _0x55b0c6={};_0x55b0c6[_0x4fdfd8[_0x167e('0x26')]]={'$like':'%'+_0x235572['query'][_0x167e('0x3a')]+'%'};return _0x55b0c6;}})});}_0x39a5a6=_[_0x167e('0x3c')]({},_0x39a5a6,_0x235572[_0x167e('0x3d')]);var _0x46cbce={'where':_0x39a5a6[_0x167e('0x39')]};return db[_0x167e('0x29')]['count'](_0x46cbce)['then'](function(_0x382876){_0x4763c6[_0x167e('0x1c')]=_0x382876;if(_0x235572[_0x167e('0x2f')][_0x167e('0x3e')]){_0x39a5a6[_0x167e('0x3f')]=[{'all':!![]}];}return db[_0x167e('0x29')][_0x167e('0x40')](_0x39a5a6);})[_0x167e('0x23')](function(_0x46322c){_0x4763c6[_0x167e('0x41')]=_0x46322c;return _0x4763c6;})[_0x167e('0x23')](respondWithFilteredResult(_0x59b253,_0x39a5a6))[_0x167e('0x42')](handleError(_0x59b253,null));};exports['show']=function(_0x866c0d,_0x2fe440){var _0xb31c6f={'raw':![],'where':{'id':_0x866c0d[_0x167e('0x43')]['id']}},_0x23865a={};_0x23865a[_0x167e('0x2e')]=_[_0x167e('0x30')](db[_0x167e('0x29')][_0x167e('0x2a')]);_0x23865a[_0x167e('0x2f')]=_[_0x167e('0x30')](_0x866c0d[_0x167e('0x2f')]);_0x23865a['filters']=_[_0x167e('0x44')](_0x23865a['model'],_0x23865a[_0x167e('0x2f')]);_0xb31c6f[_0x167e('0x32')]=_[_0x167e('0x44')](_0x23865a['model'],qs['fields'](_0x866c0d[_0x167e('0x2f')][_0x167e('0x33')]));_0xb31c6f[_0x167e('0x32')]=_0xb31c6f['attributes'][_0x167e('0x34')]?_0xb31c6f[_0x167e('0x32')]:_0x23865a[_0x167e('0x2e')];if(_0x866c0d[_0x167e('0x2f')]['includeAll']){_0xb31c6f[_0x167e('0x3f')]=[{'all':!![]}];}_0xb31c6f=_[_0x167e('0x3c')]({},_0xb31c6f,_0x866c0d[_0x167e('0x3d')]);return db[_0x167e('0x29')][_0x167e('0x45')](_0xb31c6f)[_0x167e('0x23')](handleEntityNotFound(_0x2fe440,null))[_0x167e('0x23')](respondWithResult(_0x2fe440,null))[_0x167e('0x42')](handleError(_0x2fe440,null));};exports[_0x167e('0x46')]=function(_0x2a4571,_0x1c1cf7){return db['ZohoAccount'][_0x167e('0x46')](_0x2a4571[_0x167e('0x47')],{})[_0x167e('0x23')](respondWithResult(_0x1c1cf7,0xc9))[_0x167e('0x42')](handleError(_0x1c1cf7,null));};exports[_0x167e('0x22')]=function(_0x52a168,_0xcf5a35){if(_0x52a168[_0x167e('0x47')]['id']){delete _0x52a168[_0x167e('0x47')]['id'];}return db[_0x167e('0x29')][_0x167e('0x45')]({'where':{'id':_0x52a168[_0x167e('0x43')]['id']}})['then'](handleEntityNotFound(_0xcf5a35,null))[_0x167e('0x23')](saveUpdates(_0x52a168['body'],null))[_0x167e('0x23')](respondWithResult(_0xcf5a35,null))[_0x167e('0x42')](handleError(_0xcf5a35,null));};exports[_0x167e('0x24')]=function(_0x8244bb,_0x238eaf){return db[_0x167e('0x29')][_0x167e('0x45')]({'where':{'id':_0x8244bb[_0x167e('0x43')]['id']}})[_0x167e('0x23')](handleEntityNotFound(_0x238eaf,null))[_0x167e('0x23')](removeEntity(_0x238eaf,null))['catch'](handleError(_0x238eaf,null));};exports[_0x167e('0x48')]=function(_0x450c92,_0x5c6162,_0x1db3d8){var _0x1f3158={};var _0x3d20a6={};var _0x5f4a2a;var _0x39f755;return db[_0x167e('0x29')][_0x167e('0x49')]({'where':{'id':_0x450c92[_0x167e('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c6162,null))[_0x167e('0x23')](function(_0x58ac20){if(_0x58ac20){_0x5f4a2a=_0x58ac20;_0x3d20a6[_0x167e('0x2e')]=_[_0x167e('0x30')](db[_0x167e('0x4a')][_0x167e('0x2a')]);_0x3d20a6[_0x167e('0x2f')]=_['keys'](_0x450c92[_0x167e('0x2f')]);_0x3d20a6['filters']=_[_0x167e('0x44')](_0x3d20a6[_0x167e('0x2e')],_0x3d20a6['query']);_0x1f3158[_0x167e('0x32')]=_['intersection'](_0x3d20a6[_0x167e('0x2e')],qs[_0x167e('0x33')](_0x450c92[_0x167e('0x2f')][_0x167e('0x33')]));_0x1f3158[_0x167e('0x32')]=_0x1f3158['attributes'][_0x167e('0x34')]?_0x1f3158['attributes']:_0x3d20a6[_0x167e('0x2e')];_0x1f3158[_0x167e('0x37')]=qs['sort'](_0x450c92[_0x167e('0x2f')][_0x167e('0x38')]);_0x1f3158[_0x167e('0x39')]=qs[_0x167e('0x31')](_[_0x167e('0x4b')](_0x450c92[_0x167e('0x2f')],_0x3d20a6['filters']));if(_0x450c92[_0x167e('0x2f')][_0x167e('0x3a')]){_0x1f3158['where']=_[_0x167e('0x3c')](_0x1f3158[_0x167e('0x39')],{'$or':_[_0x167e('0x28')](_0x1f3158[_0x167e('0x32')],function(_0x221515){var _0x63c236={};_0x63c236[_0x221515]={'$like':'%'+_0x450c92[_0x167e('0x2f')]['filter']+'%'};return _0x63c236;})});}_0x1f3158=_[_0x167e('0x3c')]({},_0x1f3158,_0x450c92[_0x167e('0x3d')]);return _0x5f4a2a['getConfigurations'](_0x1f3158);}})[_0x167e('0x23')](function(_0x828b5e){if(_0x828b5e){_0x39f755=_0x828b5e[_0x167e('0x34')];if(!_0x450c92[_0x167e('0x2f')]['hasOwnProperty'](_0x167e('0x35'))){_0x1f3158[_0x167e('0x36')]=qs[_0x167e('0x36')](_0x450c92['query'][_0x167e('0x36')]);_0x1f3158['offset']=qs[_0x167e('0x1a')](_0x450c92['query']['offset']);}return _0x5f4a2a[_0x167e('0x48')](_0x1f3158);}})[_0x167e('0x23')](function(_0x3859f6){if(_0x3859f6){return _0x3859f6?{'count':_0x39f755,'rows':_0x3859f6}:null;}})[_0x167e('0x23')](respondWithResult(_0x5c6162,null))[_0x167e('0x42')](handleError(_0x5c6162,null));};exports[_0x167e('0x4c')]=function(_0x2fc620,_0xcabb78,_0x32207b){if(_0x2fc620[_0x167e('0x47')]['id']){delete _0x2fc620[_0x167e('0x47')]['id'];}return db[_0x167e('0x29')][_0x167e('0x49')]({'where':{'id':_0x2fc620[_0x167e('0x43')]['id']}})[_0x167e('0x23')](handleEntityNotFound(_0xcabb78,null))['then'](function(_0x2d9fec){if(_0x2d9fec){_0x2fc620[_0x167e('0x47')][_0x167e('0x4d')]=_0x2d9fec['id'];_0x2fc620[_0x167e('0x47')][_0x167e('0x4e')]=integrations['getSubjects'](_0x2fc620[_0x167e('0x47')]['channel'],_0x2fc620[_0x167e('0x47')]['type']);_0x2fc620[_0x167e('0x47')]['Descriptions']=integrations[_0x167e('0x4f')](_0x2fc620[_0x167e('0x47')][_0x167e('0x50')],_0x2fc620['body'][_0x167e('0x2c')]);return db[_0x167e('0x4a')][_0x167e('0x46')](_0x2fc620['body'],{'include':[{'model':db[_0x167e('0x51')],'as':_0x167e('0x4e')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xcabb78,null))['catch'](handleError(_0xcabb78,null));};function getAccessToken(_0x4a2156){return new Promise(function(_0x3e1a44,_0x15d1f1){var _0x5da9b5;switch(_0x4a2156[_0x167e('0x52')]){case'US':_0x5da9b5=_0x167e('0x53');break;case'AU':_0x5da9b5=_0x167e('0x54');break;case'EU':_0x5da9b5=_0x167e('0x55');break;case'IN':_0x5da9b5=_0x167e('0x56');break;case'CN':_0x5da9b5=_0x167e('0x57');break;default:_0x5da9b5=_0x167e('0x55');break;}var _0x2f3b74={'method':_0x167e('0x58'),'uri':_0x5da9b5+_0x167e('0x59'),'qs':{'refresh_token':_0x4a2156['refreshToken'],'client_id':_0x4a2156[_0x167e('0x5a')],'client_secret':_0x4a2156[_0x167e('0x5b')],'grant_type':_0x167e('0x5c')},'json':!![]};return rp(_0x2f3b74)[_0x167e('0x23')](function(_0x9bf40f){if(_0x9bf40f['access_token']){_0x3e1a44(_0x9bf40f[_0x167e('0x5d')]);}else{_0x15d1f1(_0x167e('0x5e'));}})[_0x167e('0x42')](function(_0x2f88a1){_0x15d1f1(_0x2f88a1);});});}exports[_0x167e('0x5f')]=function(_0x22b1b9,_0x1213f7,_0x587b71){var _0x46c9e9,_0x29e633,_0x50cc15,_0x4ba43e,_0x2eb94b;return db[_0x167e('0x29')][_0x167e('0x49')]({'where':{'id':_0x22b1b9['params']['id']},'attributes':['id',_0x167e('0x60'),_0x167e('0x52'),_0x167e('0x5a'),_0x167e('0x5b'),_0x167e('0x61'),_0x167e('0x62'),'refreshToken']})[_0x167e('0x23')](handleEntityNotFound(_0x1213f7,null))[_0x167e('0x23')](function(_0x3137eb){_0x2eb94b=_0x3137eb;_0x46c9e9=_0x2eb94b[_0x167e('0x60')];_0x29e633=_0x46c9e9===_0x167e('0x63')?'eu':_0x167e('0x64');_0x50cc15=_0x2eb94b[_0x167e('0x61')];var _0x2d3067=_0x50cc15[_0x167e('0x65')](-0x1);if(_0x2d3067==='/'||_0x2d3067==='\x5c'||_0x2d3067===':'){_0x50cc15=_0x50cc15[_0x167e('0x66')](0x0,_0x50cc15['lastIndexOf'](_0x2d3067));}if(!_0x2eb94b['refreshToken']){throw new Error(_0x167e('0x67'));}return getAccessToken(_0x2eb94b);})['then'](function(_0x4a0c42){if(_0x4a0c42){return rp({'method':_0x167e('0x68'),'uri':util[_0x167e('0x69')](_0x167e('0x6a'),_0x29e633),'qs':{'module':_0x167e('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4a0c42},'json':!![]});}})['then'](function(_0x555190){if(_0x555190){if(_0x555190['response']&&_0x555190[_0x167e('0x6c')][_0x167e('0x25')]){throw new Error(_0x555190['response']['error']['message']);}var _0x32cfa0=[];var _0x42d91c=[];var _0x2dd5f0=[_0x167e('0x6d'),_0x167e('0x6e'),_0x167e('0x6f'),_0x167e('0x70'),_0x167e('0x71'),_0x167e('0x72'),_0x167e('0x73'),_0x167e('0x74')];_0x42d91c=_[_0x167e('0x75')](_0x555190[_0x167e('0x33')],function(_0x2c6698){return _0x2dd5f0[_0x167e('0x76')](_0x2c6698[_0x167e('0x77')]);});for(var _0x1061bc=0x0;_0x1061bc<_0x42d91c[_0x167e('0x34')];_0x1061bc++){if(_0x42d91c[_0x1061bc]['system_mandatory']===![]){_0x32cfa0[_0x167e('0x78')]({'id':_0x42d91c[_0x1061bc]['id'],'name':_0x42d91c[_0x1061bc][_0x167e('0x79')],'custom':_0x42d91c[_0x1061bc][_0x167e('0x7a')],'options':_0x42d91c[_0x1061bc]['data_type']===_0x167e('0x7b')&&_0x42d91c[_0x1061bc][_0x167e('0x7c')][_0x167e('0x34')]>-0x1?_[_0x167e('0x28')](_0x42d91c[_0x1061bc][_0x167e('0x7c')],function(_0x2e16af){return{'name':_0x2e16af,'value':_0x2e16af};}):[]});}}return{'count':_0x32cfa0['length'],'rows':_0x32cfa0};}else{return{'count':0x0,'rows':[]};}})[_0x167e('0x23')](respondWithResult(_0x1213f7,null))[_0x167e('0x42')](function(_0x3786cd){var _0x5a1925=_0x22b1b9['query'][_0x167e('0x7d')]?0x1f4:_0x3786cd['statusCode']||0x1f4;logger[_0x167e('0x25')](_0x167e('0x7e'),'getFields',_0x5a1925,JSON['stringify'](_0x3786cd));delete _0x3786cd[_0x167e('0x26')];if(_0x5a1925===0x191){_0x5a1925=0x190;}_0x1213f7[_0x167e('0x7f')](_0x5a1925)[_0x167e('0x27')](_0x22b1b9[_0x167e('0x2f')][_0x167e('0x7d')]?{'message':_0x167e('0x80'),'statusCode':_0x3786cd[_0x167e('0x81')]}:_0x3786cd);});}; \ No newline at end of file +var _0xde30=['WhoId','Call_Duration','Call_Result','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','create','update','body','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','slice','substring','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','error','message','Subject','Description'];(function(_0x22fc54,_0x287c5e){var _0x218d59=function(_0x4a6040){while(--_0x4a6040){_0x22fc54['push'](_0x22fc54['shift']());}};_0x218d59(++_0x287c5e);}(_0xde30,0x194));var _0x0de3=function(_0x77a412,_0x2ae0bf){_0x77a412=_0x77a412-0x0;var _0x392630=_0xde30[_0x77a412];return _0x392630;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0de3('0x0'));var jsonpatch=require(_0x0de3('0x1'));var rp=require(_0x0de3('0x2'));var moment=require(_0x0de3('0x3'));var BPromise=require(_0x0de3('0x4'));var Mustache=require('mustache');var util=require(_0x0de3('0x5'));var path=require('path');var sox=require(_0x0de3('0x6'));var csv=require(_0x0de3('0x7'));var ejs=require(_0x0de3('0x8'));var fs=require('fs');var fs_extra=require(_0x0de3('0x9'));var _=require('lodash');var squel=require(_0x0de3('0xa'));var crypto=require(_0x0de3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0de3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0de3('0xd'));var Papa=require(_0x0de3('0xe'));var Redis=require(_0x0de3('0xf'));var authService=require(_0x0de3('0x10'));var qs=require(_0x0de3('0x11'));var as=require(_0x0de3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0de3('0x13'))(_0x0de3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0de3('0x15'))['db'];var integrations=require(_0x0de3('0x16'));function respondWithStatusCode(_0x473749,_0x4d1a0e){_0x4d1a0e=_0x4d1a0e||0xcc;return function(_0x5722da){if(_0x5722da){return _0x473749[_0x0de3('0x17')](_0x4d1a0e);}return _0x473749[_0x0de3('0x18')](_0x4d1a0e)[_0x0de3('0x19')]();};}function respondWithResult(_0x59cad6,_0x43edd1){_0x43edd1=_0x43edd1||0xc8;return function(_0x2e4205){if(_0x2e4205){return _0x59cad6[_0x0de3('0x18')](_0x43edd1)[_0x0de3('0x1a')](_0x2e4205);}};}function respondWithFilteredResult(_0x16ea63,_0x48baff){return function(_0x3a3c07){if(_0x3a3c07){var _0x5c1efe=typeof _0x48baff[_0x0de3('0x1b')]===_0x0de3('0x1c')&&typeof _0x48baff[_0x0de3('0x1d')]==='undefined';var _0x13e397=_0x3a3c07[_0x0de3('0x1e')];var _0x7d771e=_0x5c1efe?0x0:_0x48baff[_0x0de3('0x1b')];var _0x12f097=_0x5c1efe?_0x3a3c07[_0x0de3('0x1e')]:_0x48baff['offset']+_0x48baff['limit'];var _0x457133;if(_0x12f097>=_0x13e397){_0x12f097=_0x13e397;_0x457133=0xc8;}else{_0x457133=0xce;}_0x16ea63['status'](_0x457133);return _0x16ea63['set'](_0x0de3('0x1f'),_0x7d771e+'-'+_0x12f097+'/'+_0x13e397)[_0x0de3('0x1a')](_0x3a3c07);}return null;};}function patchUpdates(_0x203ecf){return function(_0x462695){try{jsonpatch[_0x0de3('0x20')](_0x462695,_0x203ecf,!![]);}catch(_0xb617b1){return BPromise[_0x0de3('0x21')](_0xb617b1);}return _0x462695[_0x0de3('0x22')]();};}function saveUpdates(_0x45cea0,_0x439705){return function(_0x42e3ec){if(_0x42e3ec){return _0x42e3ec['update'](_0x45cea0)[_0x0de3('0x23')](function(_0x14f2b6){return _0x14f2b6;});}return null;};}function removeEntity(_0xf64c57,_0x3be361){return function(_0x37a934){if(_0x37a934){return _0x37a934[_0x0de3('0x24')]()['then'](function(){_0xf64c57['status'](0xcc)[_0x0de3('0x19')]();});}};}function handleEntityNotFound(_0x2e94b0,_0x36ddb3){return function(_0x186259){if(!_0x186259){_0x2e94b0['sendStatus'](0x194);}return _0x186259;};}function handleError(_0x4ae42c,_0x273140){_0x273140=_0x273140||0x1f4;return function(_0x2c7aa2){logger['error'](_0x2c7aa2[_0x0de3('0x25')]);if(_0x2c7aa2['name']){delete _0x2c7aa2[_0x0de3('0x26')];}_0x4ae42c['status'](_0x273140)['send'](_0x2c7aa2);};}exports[_0x0de3('0x27')]=function(_0x4de8a0,_0x45ecf4){var _0x2fefdd={},_0x3d285e={},_0x4eb84d={'count':0x0,'rows':[]};var _0x5dbe39=_['map'](db[_0x0de3('0x28')][_0x0de3('0x29')],function(_0x1d5445){return{'name':_0x1d5445[_0x0de3('0x2a')],'type':_0x1d5445[_0x0de3('0x2b')][_0x0de3('0x2c')]};});_0x3d285e[_0x0de3('0x2d')]=_['map'](_0x5dbe39,_0x0de3('0x26'));_0x3d285e[_0x0de3('0x2e')]=_['keys'](_0x4de8a0[_0x0de3('0x2e')]);_0x3d285e[_0x0de3('0x2f')]=_[_0x0de3('0x30')](_0x3d285e[_0x0de3('0x2d')],_0x3d285e[_0x0de3('0x2e')]);_0x2fefdd[_0x0de3('0x31')]=_['intersection'](_0x3d285e[_0x0de3('0x2d')],qs['fields'](_0x4de8a0[_0x0de3('0x2e')][_0x0de3('0x32')]));_0x2fefdd['attributes']=_0x2fefdd['attributes'][_0x0de3('0x33')]?_0x2fefdd[_0x0de3('0x31')]:_0x3d285e['model'];if(!_0x4de8a0[_0x0de3('0x2e')][_0x0de3('0x34')](_0x0de3('0x35'))){_0x2fefdd[_0x0de3('0x1d')]=qs['limit'](_0x4de8a0['query'][_0x0de3('0x1d')]);_0x2fefdd[_0x0de3('0x1b')]=qs[_0x0de3('0x1b')](_0x4de8a0[_0x0de3('0x2e')][_0x0de3('0x1b')]);}_0x2fefdd[_0x0de3('0x36')]=qs[_0x0de3('0x37')](_0x4de8a0[_0x0de3('0x2e')]['sort']);_0x2fefdd[_0x0de3('0x38')]=qs[_0x0de3('0x2f')](_[_0x0de3('0x39')](_0x4de8a0[_0x0de3('0x2e')],_0x3d285e[_0x0de3('0x2f')]),_0x5dbe39);if(_0x4de8a0[_0x0de3('0x2e')]['filter']){_0x2fefdd['where']=_[_0x0de3('0x3a')](_0x2fefdd[_0x0de3('0x38')],{'$or':_[_0x0de3('0x3b')](_0x5dbe39,function(_0x3eeff1){if(_0x3eeff1[_0x0de3('0x2b')]!==_0x0de3('0x3c')){var _0x3d9750={};_0x3d9750[_0x3eeff1['name']]={'$like':'%'+_0x4de8a0[_0x0de3('0x2e')][_0x0de3('0x3d')]+'%'};return _0x3d9750;}})});}_0x2fefdd=_[_0x0de3('0x3a')]({},_0x2fefdd,_0x4de8a0[_0x0de3('0x3e')]);var _0x4346cc={'where':_0x2fefdd['where']};return db[_0x0de3('0x28')][_0x0de3('0x1e')](_0x4346cc)[_0x0de3('0x23')](function(_0x12ed9f){_0x4eb84d[_0x0de3('0x1e')]=_0x12ed9f;if(_0x4de8a0['query'][_0x0de3('0x3f')]){_0x2fefdd['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x0de3('0x40')](_0x2fefdd);})[_0x0de3('0x23')](function(_0x50bf51){_0x4eb84d[_0x0de3('0x41')]=_0x50bf51;return _0x4eb84d;})[_0x0de3('0x23')](respondWithFilteredResult(_0x45ecf4,_0x2fefdd))[_0x0de3('0x42')](handleError(_0x45ecf4,null));};exports[_0x0de3('0x43')]=function(_0x27d642,_0x14002f){var _0x54ad9b={'raw':![],'where':{'id':_0x27d642[_0x0de3('0x44')]['id']}},_0x506124={};_0x506124[_0x0de3('0x2d')]=_[_0x0de3('0x45')](db[_0x0de3('0x28')][_0x0de3('0x29')]);_0x506124[_0x0de3('0x2e')]=_[_0x0de3('0x45')](_0x27d642[_0x0de3('0x2e')]);_0x506124[_0x0de3('0x2f')]=_[_0x0de3('0x30')](_0x506124['model'],_0x506124['query']);_0x54ad9b[_0x0de3('0x31')]=_[_0x0de3('0x30')](_0x506124[_0x0de3('0x2d')],qs[_0x0de3('0x32')](_0x27d642[_0x0de3('0x2e')]['fields']));_0x54ad9b[_0x0de3('0x31')]=_0x54ad9b[_0x0de3('0x31')][_0x0de3('0x33')]?_0x54ad9b[_0x0de3('0x31')]:_0x506124['model'];if(_0x27d642[_0x0de3('0x2e')][_0x0de3('0x3f')]){_0x54ad9b[_0x0de3('0x46')]=[{'all':!![]}];}_0x54ad9b=_[_0x0de3('0x3a')]({},_0x54ad9b,_0x27d642[_0x0de3('0x3e')]);return db[_0x0de3('0x28')]['find'](_0x54ad9b)[_0x0de3('0x23')](handleEntityNotFound(_0x14002f,null))[_0x0de3('0x23')](respondWithResult(_0x14002f,null))['catch'](handleError(_0x14002f,null));};exports[_0x0de3('0x47')]=function(_0x2318ab,_0x268dc5){return db[_0x0de3('0x28')][_0x0de3('0x47')](_0x2318ab['body'],{})[_0x0de3('0x23')](respondWithResult(_0x268dc5,0xc9))['catch'](handleError(_0x268dc5,null));};exports[_0x0de3('0x48')]=function(_0x214d8b,_0x405723){if(_0x214d8b['body']['id']){delete _0x214d8b[_0x0de3('0x49')]['id'];}return db[_0x0de3('0x28')]['find']({'where':{'id':_0x214d8b[_0x0de3('0x44')]['id']}})[_0x0de3('0x23')](handleEntityNotFound(_0x405723,null))[_0x0de3('0x23')](saveUpdates(_0x214d8b[_0x0de3('0x49')],null))['then'](respondWithResult(_0x405723,null))[_0x0de3('0x42')](handleError(_0x405723,null));};exports[_0x0de3('0x24')]=function(_0xa6d0ad,_0xcf639f){return db[_0x0de3('0x28')]['find']({'where':{'id':_0xa6d0ad[_0x0de3('0x44')]['id']}})[_0x0de3('0x23')](handleEntityNotFound(_0xcf639f,null))[_0x0de3('0x23')](removeEntity(_0xcf639f,null))[_0x0de3('0x42')](handleError(_0xcf639f,null));};exports[_0x0de3('0x4a')]=function(_0x363d39,_0x304ec8,_0x252a21){var _0x1d1247={};var _0x31b1cc={};var _0x4d6afa;var _0x31953f;return db[_0x0de3('0x28')][_0x0de3('0x4b')]({'where':{'id':_0x363d39[_0x0de3('0x44')]['id']}})[_0x0de3('0x23')](handleEntityNotFound(_0x304ec8,null))[_0x0de3('0x23')](function(_0x4fae7d){if(_0x4fae7d){_0x4d6afa=_0x4fae7d;_0x31b1cc['model']=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x31b1cc[_0x0de3('0x2e')]=_[_0x0de3('0x45')](_0x363d39[_0x0de3('0x2e')]);_0x31b1cc[_0x0de3('0x2f')]=_[_0x0de3('0x30')](_0x31b1cc[_0x0de3('0x2d')],_0x31b1cc[_0x0de3('0x2e')]);_0x1d1247[_0x0de3('0x31')]=_[_0x0de3('0x30')](_0x31b1cc['model'],qs[_0x0de3('0x32')](_0x363d39['query']['fields']));_0x1d1247['attributes']=_0x1d1247[_0x0de3('0x31')]['length']?_0x1d1247[_0x0de3('0x31')]:_0x31b1cc[_0x0de3('0x2d')];_0x1d1247[_0x0de3('0x36')]=qs[_0x0de3('0x37')](_0x363d39[_0x0de3('0x2e')][_0x0de3('0x37')]);_0x1d1247[_0x0de3('0x38')]=qs['filters'](_[_0x0de3('0x39')](_0x363d39[_0x0de3('0x2e')],_0x31b1cc['filters']));if(_0x363d39['query'][_0x0de3('0x3d')]){_0x1d1247[_0x0de3('0x38')]=_[_0x0de3('0x3a')](_0x1d1247[_0x0de3('0x38')],{'$or':_[_0x0de3('0x3b')](_0x1d1247[_0x0de3('0x31')],function(_0x296bbd){var _0x43c38e={};_0x43c38e[_0x296bbd]={'$like':'%'+_0x363d39[_0x0de3('0x2e')][_0x0de3('0x3d')]+'%'};return _0x43c38e;})});}_0x1d1247=_[_0x0de3('0x3a')]({},_0x1d1247,_0x363d39[_0x0de3('0x3e')]);return _0x4d6afa[_0x0de3('0x4a')](_0x1d1247);}})[_0x0de3('0x23')](function(_0x258455){if(_0x258455){_0x31953f=_0x258455[_0x0de3('0x33')];if(!_0x363d39[_0x0de3('0x2e')]['hasOwnProperty']('nolimit')){_0x1d1247[_0x0de3('0x1d')]=qs[_0x0de3('0x1d')](_0x363d39[_0x0de3('0x2e')][_0x0de3('0x1d')]);_0x1d1247[_0x0de3('0x1b')]=qs[_0x0de3('0x1b')](_0x363d39[_0x0de3('0x2e')][_0x0de3('0x1b')]);}return _0x4d6afa[_0x0de3('0x4a')](_0x1d1247);}})[_0x0de3('0x23')](function(_0x43238f){if(_0x43238f){return _0x43238f?{'count':_0x31953f,'rows':_0x43238f}:null;}})[_0x0de3('0x23')](respondWithResult(_0x304ec8,null))[_0x0de3('0x42')](handleError(_0x304ec8,null));};exports[_0x0de3('0x4c')]=function(_0xe051c5,_0x1b03c7,_0x2cd719){if(_0xe051c5[_0x0de3('0x49')]['id']){delete _0xe051c5[_0x0de3('0x49')]['id'];}return db['ZohoAccount'][_0x0de3('0x4b')]({'where':{'id':_0xe051c5[_0x0de3('0x44')]['id']}})[_0x0de3('0x23')](handleEntityNotFound(_0x1b03c7,null))[_0x0de3('0x23')](function(_0x14c097){if(_0x14c097){_0xe051c5[_0x0de3('0x49')][_0x0de3('0x4d')]=_0x14c097['id'];_0xe051c5[_0x0de3('0x49')]['Subjects']=integrations[_0x0de3('0x4e')](_0xe051c5[_0x0de3('0x49')][_0x0de3('0x4f')],_0xe051c5[_0x0de3('0x49')]['type']);_0xe051c5[_0x0de3('0x49')][_0x0de3('0x50')]=integrations[_0x0de3('0x51')](_0xe051c5[_0x0de3('0x49')][_0x0de3('0x4f')],_0xe051c5[_0x0de3('0x49')][_0x0de3('0x2b')]);return db[_0x0de3('0x52')][_0x0de3('0x47')](_0xe051c5[_0x0de3('0x49')],{'include':[{'model':db['ZohoField'],'as':_0x0de3('0x53')},{'model':db['ZohoField'],'as':_0x0de3('0x50')}]});}return null;})['then'](respondWithResult(_0x1b03c7,null))[_0x0de3('0x42')](handleError(_0x1b03c7,null));};function getAccessToken(_0x4b1e2c){return new Promise(function(_0x41eed5,_0x3d7642){var _0x292bdf;switch(_0x4b1e2c[_0x0de3('0x54')]){case'US':_0x292bdf=_0x0de3('0x55');break;case'AU':_0x292bdf=_0x0de3('0x56');break;case'EU':_0x292bdf=_0x0de3('0x57');break;case'IN':_0x292bdf=_0x0de3('0x58');break;case'CN':_0x292bdf='https://accounts.zoho.com.cn';break;default:_0x292bdf=_0x0de3('0x57');break;}var _0x4a16e0={'method':_0x0de3('0x59'),'uri':_0x292bdf+_0x0de3('0x5a'),'qs':{'refresh_token':_0x4b1e2c['refreshToken'],'client_id':_0x4b1e2c[_0x0de3('0x5b')],'client_secret':_0x4b1e2c[_0x0de3('0x5c')],'grant_type':_0x0de3('0x5d')},'json':!![]};return rp(_0x4a16e0)[_0x0de3('0x23')](function(_0x2cfc71){if(_0x2cfc71[_0x0de3('0x5e')]){_0x41eed5(_0x2cfc71['access_token']);}else{_0x3d7642(_0x0de3('0x5f'));}})[_0x0de3('0x42')](function(_0x291020){_0x3d7642(_0x291020);});});}exports[_0x0de3('0x60')]=function(_0xcf6751,_0x5eb55d,_0x4442db){var _0x49d0a0,_0x3af494,_0x2c1335,_0x2add5d,_0x16e497;return db[_0x0de3('0x28')]['findOne']({'where':{'id':_0xcf6751[_0x0de3('0x44')]['id']},'attributes':['id',_0x0de3('0x61'),'zone',_0x0de3('0x5b'),_0x0de3('0x5c'),'serverUrl',_0x0de3('0x62'),'refreshToken']})['then'](handleEntityNotFound(_0x5eb55d,null))[_0x0de3('0x23')](function(_0x286706){_0x16e497=_0x286706;_0x49d0a0=_0x16e497['host'];_0x3af494=_0x49d0a0===_0x0de3('0x63')?'eu':'com';_0x2c1335=_0x16e497['serverUrl'];var _0x24caa7=_0x2c1335[_0x0de3('0x64')](-0x1);if(_0x24caa7==='/'||_0x24caa7==='\x5c'||_0x24caa7===':'){_0x2c1335=_0x2c1335[_0x0de3('0x65')](0x0,_0x2c1335['lastIndexOf'](_0x24caa7));}if(!_0x16e497[_0x0de3('0x66')]){throw new Error(_0x0de3('0x67'));}return getAccessToken(_0x16e497);})['then'](function(_0xb6b09){if(_0xb6b09){return rp({'method':'GET','uri':util[_0x0de3('0x68')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3af494),'qs':{'module':_0x0de3('0x69')},'headers':{'Authorization':_0x0de3('0x6a')+_0xb6b09},'json':!![]});}})[_0x0de3('0x23')](function(_0x4dd10d){if(_0x4dd10d){if(_0x4dd10d[_0x0de3('0x6b')]&&_0x4dd10d[_0x0de3('0x6b')][_0x0de3('0x6c')]){throw new Error(_0x4dd10d[_0x0de3('0x6b')][_0x0de3('0x6c')][_0x0de3('0x6d')]);}var _0x511906=[];var _0x22cac9=[];var _0x1b452c=['Owner',_0x0de3('0x6e'),_0x0de3('0x6f'),_0x0de3('0x70'),_0x0de3('0x71'),_0x0de3('0x72'),'Call_Start_Time','Call_Type'];_0x22cac9=_[_0x0de3('0x73')](_0x4dd10d[_0x0de3('0x32')],function(_0x198a84){return _0x1b452c[_0x0de3('0x74')](_0x198a84[_0x0de3('0x75')]);});for(var _0x40c1df=0x0;_0x40c1df<_0x22cac9[_0x0de3('0x33')];_0x40c1df++){if(_0x22cac9[_0x40c1df][_0x0de3('0x76')]===![]){_0x511906['push']({'id':_0x22cac9[_0x40c1df]['id'],'name':_0x22cac9[_0x40c1df][_0x0de3('0x77')],'custom':_0x22cac9[_0x40c1df][_0x0de3('0x78')],'options':_0x22cac9[_0x40c1df][_0x0de3('0x79')]===_0x0de3('0x7a')&&_0x22cac9[_0x40c1df][_0x0de3('0x7b')][_0x0de3('0x33')]>-0x1?_['map'](_0x22cac9[_0x40c1df][_0x0de3('0x7b')],function(_0xe95ea8){return{'name':_0xe95ea8,'value':_0xe95ea8};}):[]});}}return{'count':_0x511906['length'],'rows':_0x511906};}else{return{'count':0x0,'rows':[]};}})[_0x0de3('0x23')](respondWithResult(_0x5eb55d,null))[_0x0de3('0x42')](function(_0x1c7671){var _0x3f77d1=_0xcf6751[_0x0de3('0x2e')][_0x0de3('0x7c')]?0x1f4:_0x1c7671[_0x0de3('0x7d')]||0x1f4;logger[_0x0de3('0x6c')](_0x0de3('0x7e'),'getFields',_0x3f77d1,JSON[_0x0de3('0x7f')](_0x1c7671));delete _0x1c7671[_0x0de3('0x26')];if(_0x3f77d1===0x191){_0x3f77d1=0x190;}_0x5eb55d[_0x0de3('0x18')](_0x3f77d1)['send'](_0xcf6751[_0x0de3('0x2e')]['test']?{'message':_0x0de3('0x80'),'statusCode':_0x1c7671[_0x0de3('0x7d')]}:_0x1c7671);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c6e5f65..2e77def 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 _0x408b=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','https://accounts.zoho.com.au','refreshToken','catch','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x4d9df9,_0x2cedef){var _0x726884=function(_0x4d8876){while(--_0x4d8876){_0x4d9df9['push'](_0x4d9df9['shift']());}};_0x726884(++_0x2cedef);}(_0x408b,0x1ca));var _0xb408=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x408b[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xb408('0x0'));var util=require('util');var logger=require(_0xb408('0x1'))(_0xb408('0x2'));var moment=require(_0xb408('0x3'));var BPromise=require(_0xb408('0x4'));var rp=require(_0xb408('0x5'));var fs=require('fs');var path=require(_0xb408('0x6'));var rimraf=require('rimraf');var config=require(_0xb408('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xb408('0x8'));module[_0xb408('0x9')]=function(_0x4ddfd3,_0x18edb2){return _0x4ddfd3['define'](_0xb408('0xa'),attributes,{'tableName':_0xb408('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d383f,_0xd5da81,_0x2069c0){if(_0x3d383f[_0xb408('0xc')]('zone')||_0x3d383f['changed'](_0xb408('0xd'))||_0x3d383f[_0xb408('0xc')](_0xb408('0xe'))||_0x3d383f[_0xb408('0xc')](_0xb408('0xf'))||_0x3d383f[_0xb408('0xc')](_0xb408('0x10'))||_0x3d383f[_0xb408('0xc')](_0xb408('0x11'))){var _0x3a5615,_0x156e1c;_0x3a5615=_0x3d383f[_0xb408('0xd')];var _0x2b5250=_0x3a5615[_0xb408('0x12')](-0x1);if(_0x2b5250==='/'||_0x2b5250==='\x5c'||_0x2b5250===':'){_0x3a5615=_0x3a5615[_0xb408('0x13')](0x0,_0x3a5615[_0xb408('0x14')](_0x2b5250));}switch(_0x3d383f[_0xb408('0x15')]){case'US':_0x156e1c='https://accounts.zoho.com';break;case'AU':_0x156e1c='https://accounts.zoho.com.au';break;case'IN':_0x156e1c=_0xb408('0x16');break;case'CN':_0x156e1c=_0xb408('0x17');break;default:_0x156e1c=_0xb408('0x18');break;}var _0x4d7232={'method':'POST','uri':_0x156e1c+_0xb408('0x19'),'form':{'grant_type':_0xb408('0x1a'),'client_id':_0x3d383f[_0xb408('0xe')],'client_secret':_0x3d383f[_0xb408('0xf')],'redirect_uri':_0x3d383f[_0xb408('0xd')],'code':_0x3d383f[_0xb408('0x10')]},'headers':{'Content-Type':_0xb408('0x1b')}};return rp(_0x4d7232)[_0xb408('0x1c')](function(_0x5a2096){var _0x2becf4=JSON[_0xb408('0x1d')](_0x5a2096);if(_0x2becf4['refresh_token']){_0x3d383f['refreshToken']=_0x2becf4[_0xb408('0x1e')];logger[_0xb408('0x1f')](util[_0xb408('0x20')](_0xb408('0x21'),_0x3d383f['name'],_0x3d383f['id']));}else{logger[_0xb408('0x22')](util[_0xb408('0x20')](_0xb408('0x23'),_0x3d383f[_0xb408('0x24')],_0x3d383f['id']),util[_0xb408('0x25')](_0x2becf4,{'showHidden':![],'depth':null}));}return _0x2069c0(null,_0xd5da81);})['catch'](function(_0x4936bd){logger[_0xb408('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3d383f[_0xb408('0x24')],_0x3d383f['id']),util[_0xb408('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2069c0(_0x4936bd);});}else{return _0x2069c0(null,_0xd5da81);}},'beforeUpdate':function(_0xd1eb06,_0xcfa8a4,_0x3ae18d){if(_0xd1eb06[_0xb408('0xc')](_0xb408('0x15'))||_0xd1eb06[_0xb408('0xc')](_0xb408('0xd'))||_0xd1eb06[_0xb408('0xc')](_0xb408('0xe'))||_0xd1eb06['changed'](_0xb408('0xf'))||_0xd1eb06[_0xb408('0xc')](_0xb408('0x10'))||_0xd1eb06['changed'](_0xb408('0x11'))){var _0x146a98,_0x3d4dc8;_0x146a98=_0xd1eb06[_0xb408('0xd')];var _0x4c9f63=_0x146a98[_0xb408('0x12')](-0x1);if(_0x4c9f63==='/'||_0x4c9f63==='\x5c'||_0x4c9f63===':'){_0x146a98=_0x146a98[_0xb408('0x13')](0x0,_0x146a98[_0xb408('0x14')](_0x4c9f63));}switch(_0xd1eb06[_0xb408('0x15')]){case'US':_0x3d4dc8='https://accounts.zoho.com';break;case'AU':_0x3d4dc8=_0xb408('0x26');break;case'IN':_0x3d4dc8='https://accounts.zoho.in';break;case'CN':_0x3d4dc8=_0xb408('0x17');break;default:_0x3d4dc8=_0xb408('0x18');break;}var _0x29abf5={'method':'POST','uri':_0x3d4dc8+_0xb408('0x19'),'form':{'grant_type':_0xb408('0x1a'),'client_id':_0xd1eb06[_0xb408('0xe')],'client_secret':_0xd1eb06[_0xb408('0xf')],'redirect_uri':_0xd1eb06['serverUrl'],'code':_0xd1eb06[_0xb408('0x10')]},'headers':{'Content-Type':_0xb408('0x1b')}};return rp(_0x29abf5)[_0xb408('0x1c')](function(_0x4635f6){var _0x2debeb=JSON['parse'](_0x4635f6);if(_0x2debeb[_0xb408('0x1e')]){_0xd1eb06[_0xb408('0x27')]=_0x2debeb[_0xb408('0x1e')];logger['info'](util[_0xb408('0x20')](_0xb408('0x21'),_0xd1eb06[_0xb408('0x24')],_0xd1eb06['id']));}else{logger[_0xb408('0x22')](util['format'](_0xb408('0x23'),_0xd1eb06[_0xb408('0x24')],_0xd1eb06['id']),util['inspect'](_0x2debeb,{'showHidden':![],'depth':null}));}return _0x3ae18d(null,_0xcfa8a4);})[_0xb408('0x28')](function(_0x5f27ed){logger[_0xb408('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xd1eb06[_0xb408('0x24')],_0xd1eb06['id']),util[_0xb408('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3ae18d(_0x5f27ed);});}else{return _0x3ae18d(null,_0xcfa8a4);}}}});}; \ No newline at end of file +var _0x86a1=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','parse','refreshToken','refresh_token','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','format','host','substring','authorization_code','then','info','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x487b91,_0x5844de){var _0x3c6708=function(_0x3ceb76){while(--_0x3ceb76){_0x487b91['push'](_0x487b91['shift']());}};_0x3c6708(++_0x5844de);}(_0x86a1,0x18d));var _0x186a=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0x86a1[_0x2bb66c];return _0x1e0f98;};'use strict';var _=require(_0x186a('0x0'));var util=require(_0x186a('0x1'));var logger=require(_0x186a('0x2'))(_0x186a('0x3'));var moment=require(_0x186a('0x4'));var BPromise=require(_0x186a('0x5'));var rp=require(_0x186a('0x6'));var fs=require('fs');var path=require(_0x186a('0x7'));var rimraf=require('rimraf');var config=require(_0x186a('0x8'));var attributes=require(_0x186a('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3191e6,_0x4299ac){return _0x3191e6[_0x186a('0xa')]('ZohoAccount',attributes,{'tableName':_0x186a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe7b3c0,_0x37c93c,_0x3944fd){if(_0xe7b3c0[_0x186a('0xc')](_0x186a('0xd'))||_0xe7b3c0[_0x186a('0xc')](_0x186a('0xe'))||_0xe7b3c0['changed'](_0x186a('0xf'))||_0xe7b3c0[_0x186a('0xc')](_0x186a('0x10'))||_0xe7b3c0[_0x186a('0xc')](_0x186a('0x11'))||_0xe7b3c0[_0x186a('0xc')]('host')){var _0x167b31,_0x5ed197;_0x167b31=_0xe7b3c0['serverUrl'];var _0x3dadb0=_0x167b31[_0x186a('0x12')](-0x1);if(_0x3dadb0==='/'||_0x3dadb0==='\x5c'||_0x3dadb0===':'){_0x167b31=_0x167b31['substring'](0x0,_0x167b31[_0x186a('0x13')](_0x3dadb0));}switch(_0xe7b3c0[_0x186a('0xd')]){case'US':_0x5ed197=_0x186a('0x14');break;case'AU':_0x5ed197=_0x186a('0x15');break;case'IN':_0x5ed197=_0x186a('0x16');break;case'CN':_0x5ed197=_0x186a('0x17');break;default:_0x5ed197=_0x186a('0x18');break;}var _0x1613a1={'method':_0x186a('0x19'),'uri':_0x5ed197+_0x186a('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0xe7b3c0[_0x186a('0xf')],'client_secret':_0xe7b3c0[_0x186a('0x10')],'redirect_uri':_0xe7b3c0[_0x186a('0xe')],'code':_0xe7b3c0[_0x186a('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1613a1)['then'](function(_0x738bc3){var _0xc827de=JSON[_0x186a('0x1b')](_0x738bc3);if(_0xc827de['refresh_token']){_0xe7b3c0[_0x186a('0x1c')]=_0xc827de[_0x186a('0x1d')];logger['info'](util['format'](_0x186a('0x1e'),_0xe7b3c0[_0x186a('0x1f')],_0xe7b3c0['id']));}else{logger[_0x186a('0x20')](util['format'](_0x186a('0x21'),_0xe7b3c0['name'],_0xe7b3c0['id']),util[_0x186a('0x22')](_0xc827de,{'showHidden':![],'depth':null}));}return _0x3944fd(null,_0x37c93c);})[_0x186a('0x23')](function(_0x317b93){logger['error'](util[_0x186a('0x24')](_0x186a('0x21'),_0xe7b3c0[_0x186a('0x1f')],_0xe7b3c0['id']),util[_0x186a('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x3944fd(_0x317b93);});}else{return _0x3944fd(null,_0x37c93c);}},'beforeUpdate':function(_0x55b332,_0x4536bc,_0x34dcae){if(_0x55b332[_0x186a('0xc')]('zone')||_0x55b332[_0x186a('0xc')](_0x186a('0xe'))||_0x55b332['changed'](_0x186a('0xf'))||_0x55b332[_0x186a('0xc')](_0x186a('0x10'))||_0x55b332[_0x186a('0xc')](_0x186a('0x11'))||_0x55b332['changed'](_0x186a('0x25'))){var _0x3ed3d4,_0x3200cc;_0x3ed3d4=_0x55b332[_0x186a('0xe')];var _0x418c73=_0x3ed3d4['slice'](-0x1);if(_0x418c73==='/'||_0x418c73==='\x5c'||_0x418c73===':'){_0x3ed3d4=_0x3ed3d4[_0x186a('0x26')](0x0,_0x3ed3d4[_0x186a('0x13')](_0x418c73));}switch(_0x55b332[_0x186a('0xd')]){case'US':_0x3200cc=_0x186a('0x14');break;case'AU':_0x3200cc=_0x186a('0x15');break;case'IN':_0x3200cc=_0x186a('0x16');break;case'CN':_0x3200cc=_0x186a('0x17');break;default:_0x3200cc=_0x186a('0x18');break;}var _0x569b66={'method':_0x186a('0x19'),'uri':_0x3200cc+'/oauth/v2/token','form':{'grant_type':_0x186a('0x27'),'client_id':_0x55b332['clientId'],'client_secret':_0x55b332[_0x186a('0x10')],'redirect_uri':_0x55b332['serverUrl'],'code':_0x55b332['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x569b66)[_0x186a('0x28')](function(_0x10df7c){var _0x490a40=JSON[_0x186a('0x1b')](_0x10df7c);if(_0x490a40['refresh_token']){_0x55b332['refreshToken']=_0x490a40[_0x186a('0x1d')];logger[_0x186a('0x29')](util[_0x186a('0x24')](_0x186a('0x1e'),_0x55b332[_0x186a('0x1f')],_0x55b332['id']));}else{logger[_0x186a('0x20')](util[_0x186a('0x24')](_0x186a('0x21'),_0x55b332[_0x186a('0x1f')],_0x55b332['id']),util[_0x186a('0x22')](_0x490a40,{'showHidden':![],'depth':null}));}return _0x34dcae(null,_0x4536bc);})['catch'](function(_0x4a5722){logger[_0x186a('0x20')](util[_0x186a('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x55b332[_0x186a('0x1f')],_0x55b332['id']),util[_0x186a('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x34dcae(_0x4a5722);});}else{return _0x34dcae(null,_0x4536bc);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index fd0d196..ba0872f 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 _0x4253=['client','http','request','then','info','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','GetZohoAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowZohoAccount','ZohoAccount','find','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x46b392,_0x4f1ad0){var _0x41aca2=function(_0x1d8ca0){while(--_0x1d8ca0){_0x46b392['push'](_0x46b392['shift']());}};_0x41aca2(++_0x4f1ad0);}(_0x4253,0x14c));var _0x3425=function(_0x54e547,_0x4bbf7c){_0x54e547=_0x54e547-0x0;var _0x209dd5=_0x4253[_0x54e547];return _0x209dd5;};'use strict';var _=require(_0x3425('0x0'));var util=require(_0x3425('0x1'));var moment=require('moment');var BPromise=require(_0x3425('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3425('0x3'));var db=require(_0x3425('0x4'))['db'];var utils=require(_0x3425('0x5'));var logger=require(_0x3425('0x6'))(_0x3425('0x7'));var config=require(_0x3425('0x8'));var jayson=require(_0x3425('0x9'));var client=jayson[_0x3425('0xa')][_0x3425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53cc1f,_0x1bb3ca,_0x1994b1){return new BPromise(function(_0x33cbc7,_0x4ce62b){return client[_0x3425('0xc')](_0x53cc1f,_0x1994b1)[_0x3425('0xd')](function(_0x5a2bc6){logger[_0x3425('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1bb3ca,'request\x20sent');logger['debug'](_0x3425('0xf'),_0x1bb3ca,_0x3425('0x10'),JSON[_0x3425('0x11')](_0x5a2bc6));if(_0x5a2bc6['error']){if(_0x5a2bc6[_0x3425('0x12')][_0x3425('0x13')]===0x1f4){logger[_0x3425('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x1bb3ca,_0x5a2bc6[_0x3425('0x12')][_0x3425('0x14')]);return _0x4ce62b(_0x5a2bc6[_0x3425('0x12')][_0x3425('0x14')]);}logger[_0x3425('0x12')](_0x3425('0x15'),_0x1bb3ca,_0x5a2bc6[_0x3425('0x12')]['message']);return _0x33cbc7(_0x5a2bc6[_0x3425('0x12')]['message']);}else{logger[_0x3425('0xe')](_0x3425('0x15'),_0x1bb3ca,'request\x20sent');_0x33cbc7(_0x5a2bc6[_0x3425('0x16')][_0x3425('0x14')]);}})['catch'](function(_0x13aabd){logger['error'](_0x3425('0x15'),_0x1bb3ca,_0x13aabd);_0x4ce62b(_0x13aabd);});});}exports[_0x3425('0x17')]=function(_0x1565c8){var _0x2156c4=this;return new Promise(function(_0x4d5933,_0xb9b412){return db['ZohoAccount'][_0x3425('0x18')]({'raw':_0x1565c8[_0x3425('0x19')]?_0x1565c8[_0x3425('0x19')][_0x3425('0x1a')]===undefined?!![]:![]:!![],'where':_0x1565c8[_0x3425('0x19')]?_0x1565c8[_0x3425('0x19')][_0x3425('0x1b')]||null:null,'attributes':_0x1565c8[_0x3425('0x19')]?_0x1565c8['options']['attributes']||null:null,'limit':_0x1565c8[_0x3425('0x19')]?_0x1565c8['options'][_0x3425('0x1c')]||null:null,'include':_0x1565c8[_0x3425('0x19')]?_0x1565c8[_0x3425('0x19')][_0x3425('0x1d')]?_[_0x3425('0x1e')](_0x1565c8[_0x3425('0x19')]['include'],function(_0x38b577){return{'model':db[_0x38b577[_0x3425('0x1f')]],'as':_0x38b577['as'],'attributes':_0x38b577[_0x3425('0x20')],'include':_0x38b577[_0x3425('0x1d')]?_['map'](_0x38b577[_0x3425('0x1d')],function(_0x31d4d5){return{'model':db[_0x31d4d5[_0x3425('0x1f')]],'as':_0x31d4d5['as'],'attributes':_0x31d4d5[_0x3425('0x20')],'include':_0x31d4d5[_0x3425('0x1d')]?_[_0x3425('0x1e')](_0x31d4d5[_0x3425('0x1d')],function(_0x2638b5){return{'model':db[_0x2638b5[_0x3425('0x1f')]],'as':_0x2638b5['as'],'attributes':_0x2638b5[_0x3425('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3425('0xd')](function(_0x16c50a){logger[_0x3425('0xe')](_0x3425('0x17'),_0x1565c8);logger['debug'](_0x3425('0x17'),_0x1565c8,JSON[_0x3425('0x11')](_0x16c50a));_0x4d5933(_0x16c50a);})[_0x3425('0x21')](function(_0x27f416){logger[_0x3425('0x12')](_0x3425('0x17'),_0x27f416[_0x3425('0x14')],_0x1565c8);_0xb9b412(_0x2156c4[_0x3425('0x12')](0x1f4,_0x27f416[_0x3425('0x14')]));});});};exports[_0x3425('0x22')]=function(_0x24b353){var _0xf4111=this;return new Promise(function(_0x256a64,_0x425753){return db[_0x3425('0x23')][_0x3425('0x24')]({'raw':_0x24b353[_0x3425('0x19')]?_0x24b353[_0x3425('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x24b353[_0x3425('0x19')]?_0x24b353[_0x3425('0x19')][_0x3425('0x1b')]||null:null,'attributes':_0x24b353['options']?_0x24b353[_0x3425('0x19')][_0x3425('0x20')]||null:null,'include':_0x24b353[_0x3425('0x19')]?_0x24b353[_0x3425('0x19')][_0x3425('0x1d')]?_[_0x3425('0x1e')](_0x24b353[_0x3425('0x19')][_0x3425('0x1d')],function(_0x7b658c){return{'model':db[_0x7b658c[_0x3425('0x1f')]],'as':_0x7b658c['as'],'attributes':_0x7b658c[_0x3425('0x20')],'include':_0x7b658c[_0x3425('0x1d')]?_['map'](_0x7b658c[_0x3425('0x1d')],function(_0x3efee9){return{'model':db[_0x3efee9[_0x3425('0x1f')]],'as':_0x3efee9['as'],'attributes':_0x3efee9[_0x3425('0x20')],'include':_0x3efee9[_0x3425('0x1d')]?_[_0x3425('0x1e')](_0x3efee9[_0x3425('0x1d')],function(_0x22ef8e){return{'model':db[_0x22ef8e[_0x3425('0x1f')]],'as':_0x22ef8e['as'],'attributes':_0x22ef8e[_0x3425('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3425('0xd')](function(_0xda59ce){logger['info'](_0x3425('0x22'),_0x24b353);logger[_0x3425('0x25')](_0x3425('0x22'),_0x24b353,JSON[_0x3425('0x11')](_0xda59ce));_0x256a64(_0xda59ce);})[_0x3425('0x21')](function(_0x21e67e){logger[_0x3425('0x12')](_0x3425('0x22'),_0x21e67e[_0x3425('0x14')],_0x24b353);_0x425753(_0xf4111[_0x3425('0x12')](0x1f4,_0x21e67e[_0x3425('0x14')]));});});}; \ No newline at end of file +var _0x4f7a=['message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4f7a,0x105));var _0xa4f7=function(_0x1f6abc,_0xf55da9){_0x1f6abc=_0x1f6abc-0x0;var _0x1a46c2=_0x4f7a[_0x1f6abc];return _0x1a46c2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa4f7('0x0'));var BPromise=require(_0xa4f7('0x1'));var rs=require(_0xa4f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4f7('0x4'))(_0xa4f7('0x5'));var config=require(_0xa4f7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa4f7('0x7')][_0xa4f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c78bd,_0x58e1c7,_0x1cea4c){return new BPromise(function(_0x1e3ff3,_0x1410a1){return client[_0xa4f7('0x9')](_0x4c78bd,_0x1cea4c)[_0xa4f7('0xa')](function(_0x498186){logger[_0xa4f7('0xb')](_0xa4f7('0xc'),_0x58e1c7,_0xa4f7('0xd'));logger[_0xa4f7('0xe')](_0xa4f7('0xf'),_0x58e1c7,_0xa4f7('0xd'),JSON[_0xa4f7('0x10')](_0x498186));if(_0x498186['error']){if(_0x498186['error'][_0xa4f7('0x11')]===0x1f4){logger[_0xa4f7('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x58e1c7,_0x498186[_0xa4f7('0x12')][_0xa4f7('0x13')]);return _0x1410a1(_0x498186[_0xa4f7('0x12')]['message']);}logger[_0xa4f7('0x12')](_0xa4f7('0xc'),_0x58e1c7,_0x498186[_0xa4f7('0x12')]['message']);return _0x1e3ff3(_0x498186[_0xa4f7('0x12')][_0xa4f7('0x13')]);}else{logger[_0xa4f7('0xb')](_0xa4f7('0xc'),_0x58e1c7,'request\x20sent');_0x1e3ff3(_0x498186[_0xa4f7('0x14')][_0xa4f7('0x13')]);}})['catch'](function(_0x501fe1){logger[_0xa4f7('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x58e1c7,_0x501fe1);_0x1410a1(_0x501fe1);});});}exports[_0xa4f7('0x15')]=function(_0x44e119){var _0x5345a6=this;return new Promise(function(_0x1cba51,_0x5314d5){return db[_0xa4f7('0x16')][_0xa4f7('0x17')]({'raw':_0x44e119[_0xa4f7('0x18')]?_0x44e119[_0xa4f7('0x18')][_0xa4f7('0x19')]===undefined?!![]:![]:!![],'where':_0x44e119[_0xa4f7('0x18')]?_0x44e119['options'][_0xa4f7('0x1a')]||null:null,'attributes':_0x44e119[_0xa4f7('0x18')]?_0x44e119[_0xa4f7('0x18')][_0xa4f7('0x1b')]||null:null,'limit':_0x44e119['options']?_0x44e119[_0xa4f7('0x18')][_0xa4f7('0x1c')]||null:null,'include':_0x44e119[_0xa4f7('0x18')]?_0x44e119[_0xa4f7('0x18')][_0xa4f7('0x1d')]?_[_0xa4f7('0x1e')](_0x44e119[_0xa4f7('0x18')][_0xa4f7('0x1d')],function(_0x16a342){return{'model':db[_0x16a342[_0xa4f7('0x1f')]],'as':_0x16a342['as'],'attributes':_0x16a342[_0xa4f7('0x1b')],'include':_0x16a342[_0xa4f7('0x1d')]?_['map'](_0x16a342[_0xa4f7('0x1d')],function(_0x18b3c7){return{'model':db[_0x18b3c7[_0xa4f7('0x1f')]],'as':_0x18b3c7['as'],'attributes':_0x18b3c7[_0xa4f7('0x1b')],'include':_0x18b3c7[_0xa4f7('0x1d')]?_['map'](_0x18b3c7['include'],function(_0x4afd1d){return{'model':db[_0x4afd1d[_0xa4f7('0x1f')]],'as':_0x4afd1d['as'],'attributes':_0x4afd1d['attributes']};}):[]};}):[]};}):[]:[]})[_0xa4f7('0xa')](function(_0x23ffe5){logger[_0xa4f7('0xb')]('GetZohoAccount',_0x44e119);logger[_0xa4f7('0xe')]('GetZohoAccount',_0x44e119,JSON[_0xa4f7('0x10')](_0x23ffe5));_0x1cba51(_0x23ffe5);})['catch'](function(_0x36704e){logger[_0xa4f7('0x12')](_0xa4f7('0x15'),_0x36704e[_0xa4f7('0x13')],_0x44e119);_0x5314d5(_0x5345a6['error'](0x1f4,_0x36704e[_0xa4f7('0x13')]));});});};exports[_0xa4f7('0x20')]=function(_0x35c557){var _0x3e4d19=this;return new Promise(function(_0xf852a2,_0x5dd861){return db[_0xa4f7('0x16')][_0xa4f7('0x21')]({'raw':_0x35c557['options']?_0x35c557[_0xa4f7('0x18')][_0xa4f7('0x19')]===undefined?!![]:![]:!![],'where':_0x35c557[_0xa4f7('0x18')]?_0x35c557['options'][_0xa4f7('0x1a')]||null:null,'attributes':_0x35c557[_0xa4f7('0x18')]?_0x35c557['options']['attributes']||null:null,'include':_0x35c557[_0xa4f7('0x18')]?_0x35c557[_0xa4f7('0x18')][_0xa4f7('0x1d')]?_['map'](_0x35c557[_0xa4f7('0x18')][_0xa4f7('0x1d')],function(_0x28855b){return{'model':db[_0x28855b[_0xa4f7('0x1f')]],'as':_0x28855b['as'],'attributes':_0x28855b[_0xa4f7('0x1b')],'include':_0x28855b[_0xa4f7('0x1d')]?_[_0xa4f7('0x1e')](_0x28855b[_0xa4f7('0x1d')],function(_0x17600d){return{'model':db[_0x17600d['model']],'as':_0x17600d['as'],'attributes':_0x17600d[_0xa4f7('0x1b')],'include':_0x17600d[_0xa4f7('0x1d')]?_[_0xa4f7('0x1e')](_0x17600d[_0xa4f7('0x1d')],function(_0x174fb7){return{'model':db[_0x174fb7[_0xa4f7('0x1f')]],'as':_0x174fb7['as'],'attributes':_0x174fb7[_0xa4f7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa4f7('0xa')](function(_0x5975e9){logger[_0xa4f7('0xb')](_0xa4f7('0x20'),_0x35c557);logger['debug']('ShowZohoAccount',_0x35c557,JSON[_0xa4f7('0x10')](_0x5975e9));_0xf852a2(_0x5975e9);})[_0xa4f7('0x22')](function(_0x1c3b8f){logger['error'](_0xa4f7('0x20'),_0x1c3b8f[_0xa4f7('0x13')],_0x35c557);_0x5dd861(_0x3e4d19[_0xa4f7('0x12')](0x1f4,_0x1c3b8f[_0xa4f7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ad09718..475b6fe 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 _0x54a2=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x398ffc,_0x5357d8){var _0x546554=function(_0x2ec7b7){while(--_0x2ec7b7){_0x398ffc['push'](_0x398ffc['shift']());}};_0x546554(++_0x5357d8);}(_0x54a2,0x154));var _0x254a=function(_0x14e1cb,_0xd3465e){_0x14e1cb=_0x14e1cb-0x0;var _0x18a337=_0x54a2[_0x14e1cb];return _0x18a337;};'use strict';var multer=require(_0x254a('0x0'));var util=require(_0x254a('0x1'));var path=require('path');var timeout=require(_0x254a('0x2'));var express=require(_0x254a('0x3'));var router=express[_0x254a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x254a('0x5'));var interaction=require(_0x254a('0x6'));var config=require('../../config/environment');var controller=require(_0x254a('0x7'));router[_0x254a('0x8')]('/',auth['isAuthenticated'](),controller[_0x254a('0x9')]);router['get'](_0x254a('0xa'),auth[_0x254a('0xb')](),controller['show']);router['get'](_0x254a('0xc'),auth[_0x254a('0xb')](),controller[_0x254a('0xd')]);router[_0x254a('0x8')](_0x254a('0xe'),auth['isAuthenticated'](),controller[_0x254a('0xf')]);router[_0x254a('0x8')](_0x254a('0x10'),auth['isAuthenticated'](),controller[_0x254a('0x11')]);router['post']('/',auth[_0x254a('0xb')](),controller[_0x254a('0x12')]);router[_0x254a('0x13')](_0x254a('0xa'),auth['isAuthenticated'](),controller[_0x254a('0x14')]);router[_0x254a('0x15')](_0x254a('0xa'),auth[_0x254a('0xb')](),controller[_0x254a('0x16')]);module[_0x254a('0x17')]=router; \ No newline at end of file +var _0x558c=['../../config/environment','./intZohoConfiguration.controller','index','/:id','get','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x558c,0xb7));var _0xc558=function(_0x5673f7,_0x224b50){_0x5673f7=_0x5673f7-0x0;var _0x2dee59=_0x558c[_0x5673f7];return _0x2dee59;};'use strict';var multer=require(_0xc558('0x0'));var util=require(_0xc558('0x1'));var path=require(_0xc558('0x2'));var timeout=require(_0xc558('0x3'));var express=require(_0xc558('0x4'));var router=express[_0xc558('0x5')]();var fs_extra=require(_0xc558('0x6'));var auth=require(_0xc558('0x7'));var interaction=require(_0xc558('0x8'));var config=require(_0xc558('0x9'));var controller=require(_0xc558('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xc558('0xb')]);router['get'](_0xc558('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc558('0xd')]('/:id/fields',auth[_0xc558('0xe')](),controller[_0xc558('0xf')]);router['get'](_0xc558('0x10'),auth['isAuthenticated'](),controller[_0xc558('0x11')]);router[_0xc558('0xd')](_0xc558('0x12'),auth[_0xc558('0xe')](),controller[_0xc558('0x13')]);router[_0xc558('0x14')]('/',auth[_0xc558('0xe')](),controller['create']);router['put'](_0xc558('0xc'),auth[_0xc558('0xe')](),controller[_0xc558('0x15')]);router['delete']('/:id',auth[_0xc558('0xe')](),controller[_0xc558('0x16')]);module[_0xc558('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e038897..a993163 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 _0xca56=['contact_lead','contact','sequelize','STRING','ENUM','lead'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xca56,0xd4));var _0x6ca5=function(_0x4c9429,_0x2ae577){_0x4c9429=_0x4c9429-0x0;var _0x4cddb0=_0xca56[_0x4c9429];return _0x4cddb0;};'use strict';var Sequelize=require(_0x6ca5('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ca5('0x1')]},'moduleCreate':{'type':Sequelize[_0x6ca5('0x2')](_0x6ca5('0x3'),'contact','nothing'),'defaultValue':_0x6ca5('0x3')},'moduleSearch':{'type':Sequelize[_0x6ca5('0x2')](_0x6ca5('0x4'),_0x6ca5('0x5'),_0x6ca5('0x3')),'defaultValue':_0x6ca5('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcca3=['lead','contact','contact_lead','STRING','sequelize','exports','ENUM'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xcca3,0x1a8));var _0x3cca=function(_0x173fd1,_0x28db53){_0x173fd1=_0x173fd1-0x0;var _0x36a3d1=_0xcca3[_0x173fd1];return _0x36a3d1;};'use strict';var Sequelize=require(_0x3cca('0x0'));module[_0x3cca('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x3cca('0x2')](_0x3cca('0x3'),_0x3cca('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x3cca('0x2')](_0x3cca('0x5'),'contact','lead'),'defaultValue':_0x3cca('0x5')},'description':{'type':Sequelize[_0x3cca('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 13ddcf0..5f76bbf 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 _0xc20a=['ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','stack','rawAttributes','fieldName','type','model','name','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','ZohoConfiguration','includeAll','include','catch','show','params','keys','intersection','fields','options','find','create','body','update','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x5f42da,_0x3b5e13){var _0x2438ed=function(_0x3d21c4){while(--_0x3d21c4){_0x5f42da['push'](_0x5f42da['shift']());}};_0x2438ed(++_0x3b5e13);}(_0xc20a,0x176));var _0xac20=function(_0x30e399,_0x349c3f){_0x30e399=_0x30e399-0x0;var _0x12b5eb=_0xc20a[_0x30e399];return _0x12b5eb;};'use strict';var emlformat=require(_0xac20('0x0'));var rimraf=require(_0xac20('0x1'));var zipdir=require(_0xac20('0x2'));var jsonpatch=require(_0xac20('0x3'));var rp=require(_0xac20('0x4'));var moment=require(_0xac20('0x5'));var BPromise=require(_0xac20('0x6'));var Mustache=require(_0xac20('0x7'));var util=require('util');var path=require(_0xac20('0x8'));var sox=require(_0xac20('0x9'));var csv=require(_0xac20('0xa'));var ejs=require(_0xac20('0xb'));var fs=require('fs');var fs_extra=require(_0xac20('0xc'));var _=require(_0xac20('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac20('0xe'));var deskjs=require(_0xac20('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xac20('0x10'));var Redis=require('ioredis');var authService=require(_0xac20('0x11'));var qs=require(_0xac20('0x12'));var as=require(_0xac20('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac20('0x14'));var utils=require(_0xac20('0x15'));var config=require(_0xac20('0x16'));var licenseUtil=require(_0xac20('0x17'));var db=require(_0xac20('0x18'))['db'];function respondWithStatusCode(_0x1a9548,_0x58e2fa){_0x58e2fa=_0x58e2fa||0xcc;return function(_0xda655b){if(_0xda655b){return _0x1a9548[_0xac20('0x19')](_0x58e2fa);}return _0x1a9548[_0xac20('0x1a')](_0x58e2fa)[_0xac20('0x1b')]();};}function respondWithResult(_0x8b879c,_0x2e2208){_0x2e2208=_0x2e2208||0xc8;return function(_0x2914b7){if(_0x2914b7){return _0x8b879c[_0xac20('0x1a')](_0x2e2208)[_0xac20('0x1c')](_0x2914b7);}};}function respondWithFilteredResult(_0x5d6817,_0x2824b7){return function(_0x4fdf6e){if(_0x4fdf6e){var _0x304524=typeof _0x2824b7[_0xac20('0x1d')]===_0xac20('0x1e')&&typeof _0x2824b7[_0xac20('0x1f')]==='undefined';var _0x3601c5=_0x4fdf6e[_0xac20('0x20')];var _0x550735=_0x304524?0x0:_0x2824b7[_0xac20('0x1d')];var _0x3b9623=_0x304524?_0x4fdf6e[_0xac20('0x20')]:_0x2824b7['offset']+_0x2824b7[_0xac20('0x1f')];var _0xd48b77;if(_0x3b9623>=_0x3601c5){_0x3b9623=_0x3601c5;_0xd48b77=0xc8;}else{_0xd48b77=0xce;}_0x5d6817['status'](_0xd48b77);return _0x5d6817[_0xac20('0x21')]('Content-Range',_0x550735+'-'+_0x3b9623+'/'+_0x3601c5)[_0xac20('0x1c')](_0x4fdf6e);}return null;};}function patchUpdates(_0x2ffa6e){return function(_0x5ab890){try{jsonpatch['apply'](_0x5ab890,_0x2ffa6e,!![]);}catch(_0x159db9){return BPromise[_0xac20('0x22')](_0x159db9);}return _0x5ab890[_0xac20('0x23')]();};}function saveUpdates(_0x356721,_0x5598d8){return function(_0x45f8fc){if(_0x45f8fc){return _0x45f8fc['update'](_0x356721)[_0xac20('0x24')](function(_0x3f553b){return _0x3f553b;});}return null;};}function removeEntity(_0x5c3807,_0x328fb1){return function(_0x53042f){if(_0x53042f){return _0x53042f[_0xac20('0x25')]()[_0xac20('0x24')](function(){_0x5c3807['status'](0xcc)[_0xac20('0x1b')]();});}};}function handleEntityNotFound(_0x5392f8,_0x4c67b4){return function(_0x48f209){if(!_0x48f209){_0x5392f8['sendStatus'](0x194);}return _0x48f209;};}function handleError(_0x4b3c92,_0xefb166){_0xefb166=_0xefb166||0x1f4;return function(_0x14f94c){logger['error'](_0x14f94c[_0xac20('0x26')]);if(_0x14f94c['name']){delete _0x14f94c['name'];}_0x4b3c92[_0xac20('0x1a')](_0xefb166)['send'](_0x14f94c);};}exports['index']=function(_0x2a62f1,_0x58f55a){var _0x1c7c2f={},_0x540eb2={},_0x3b60df={'count':0x0,'rows':[]};var _0x5cd2bd=_['map'](db['ZohoConfiguration'][_0xac20('0x27')],function(_0x35b63e){return{'name':_0x35b63e[_0xac20('0x28')],'type':_0x35b63e[_0xac20('0x29')]['key']};});_0x540eb2[_0xac20('0x2a')]=_['map'](_0x5cd2bd,_0xac20('0x2b'));_0x540eb2['query']=_['keys'](_0x2a62f1[_0xac20('0x2c')]);_0x540eb2[_0xac20('0x2d')]=_['intersection'](_0x540eb2[_0xac20('0x2a')],_0x540eb2[_0xac20('0x2c')]);_0x1c7c2f[_0xac20('0x2e')]=_['intersection'](_0x540eb2['model'],qs['fields'](_0x2a62f1['query']['fields']));_0x1c7c2f[_0xac20('0x2e')]=_0x1c7c2f[_0xac20('0x2e')][_0xac20('0x2f')]?_0x1c7c2f[_0xac20('0x2e')]:_0x540eb2[_0xac20('0x2a')];if(!_0x2a62f1['query'][_0xac20('0x30')](_0xac20('0x31'))){_0x1c7c2f[_0xac20('0x1f')]=qs[_0xac20('0x1f')](_0x2a62f1[_0xac20('0x2c')][_0xac20('0x1f')]);_0x1c7c2f['offset']=qs[_0xac20('0x1d')](_0x2a62f1['query'][_0xac20('0x1d')]);}_0x1c7c2f[_0xac20('0x32')]=qs[_0xac20('0x33')](_0x2a62f1['query'][_0xac20('0x33')]);_0x1c7c2f['where']=qs[_0xac20('0x2d')](_[_0xac20('0x34')](_0x2a62f1[_0xac20('0x2c')],_0x540eb2[_0xac20('0x2d')]),_0x5cd2bd);if(_0x2a62f1['query'][_0xac20('0x35')]){_0x1c7c2f[_0xac20('0x36')]=_[_0xac20('0x37')](_0x1c7c2f[_0xac20('0x36')],{'$or':_[_0xac20('0x38')](_0x5cd2bd,function(_0x301ff1){if(_0x301ff1[_0xac20('0x29')]!==_0xac20('0x39')){var _0x327fbb={};_0x327fbb[_0x301ff1[_0xac20('0x2b')]]={'$like':'%'+_0x2a62f1[_0xac20('0x2c')][_0xac20('0x35')]+'%'};return _0x327fbb;}})});}_0x1c7c2f=_[_0xac20('0x37')]({},_0x1c7c2f,_0x2a62f1['options']);var _0xaa4965={'where':_0x1c7c2f[_0xac20('0x36')]};return db[_0xac20('0x3a')]['count'](_0xaa4965)[_0xac20('0x24')](function(_0x466ace){_0x3b60df['count']=_0x466ace;if(_0x2a62f1[_0xac20('0x2c')][_0xac20('0x3b')]){_0x1c7c2f[_0xac20('0x3c')]=[{'all':!![]}];}return db[_0xac20('0x3a')]['findAll'](_0x1c7c2f);})['then'](function(_0x4c267f){_0x3b60df['rows']=_0x4c267f;return _0x3b60df;})[_0xac20('0x24')](respondWithFilteredResult(_0x58f55a,_0x1c7c2f))[_0xac20('0x3d')](handleError(_0x58f55a,null));};exports[_0xac20('0x3e')]=function(_0x2c49a8,_0x25edaf){var _0xe83883={'raw':![],'where':{'id':_0x2c49a8[_0xac20('0x3f')]['id']}},_0x2dfcff={};_0x2dfcff[_0xac20('0x2a')]=_[_0xac20('0x40')](db[_0xac20('0x3a')][_0xac20('0x27')]);_0x2dfcff[_0xac20('0x2c')]=_['keys'](_0x2c49a8[_0xac20('0x2c')]);_0x2dfcff['filters']=_[_0xac20('0x41')](_0x2dfcff[_0xac20('0x2a')],_0x2dfcff[_0xac20('0x2c')]);_0xe83883[_0xac20('0x2e')]=_[_0xac20('0x41')](_0x2dfcff[_0xac20('0x2a')],qs[_0xac20('0x42')](_0x2c49a8[_0xac20('0x2c')][_0xac20('0x42')]));_0xe83883[_0xac20('0x2e')]=_0xe83883['attributes']['length']?_0xe83883[_0xac20('0x2e')]:_0x2dfcff[_0xac20('0x2a')];if(_0x2c49a8[_0xac20('0x2c')]['includeAll']){_0xe83883[_0xac20('0x3c')]=[{'all':!![]}];}_0xe83883=_[_0xac20('0x37')]({},_0xe83883,_0x2c49a8[_0xac20('0x43')]);return db[_0xac20('0x3a')][_0xac20('0x44')](_0xe83883)[_0xac20('0x24')](handleEntityNotFound(_0x25edaf,null))[_0xac20('0x24')](respondWithResult(_0x25edaf,null))['catch'](handleError(_0x25edaf,null));};exports[_0xac20('0x45')]=function(_0x259d0f,_0x18fad8){return db[_0xac20('0x3a')]['create'](_0x259d0f[_0xac20('0x46')],{})[_0xac20('0x24')](respondWithResult(_0x18fad8,0xc9))[_0xac20('0x3d')](handleError(_0x18fad8,null));};exports[_0xac20('0x47')]=function(_0x53f3cd,_0x5f4b77){if(_0x53f3cd['body']['id']){delete _0x53f3cd[_0xac20('0x46')]['id'];}return db[_0xac20('0x3a')][_0xac20('0x44')]({'where':{'id':_0x53f3cd[_0xac20('0x3f')]['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x5f4b77,null))[_0xac20('0x24')](saveUpdates(_0x53f3cd[_0xac20('0x46')],null))['then'](respondWithResult(_0x5f4b77,null))['catch'](handleError(_0x5f4b77,null));};exports[_0xac20('0x25')]=function(_0x5be6d3,_0x7a61b9){return db['ZohoConfiguration']['find']({'where':{'id':_0x5be6d3[_0xac20('0x3f')]['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x7a61b9,null))['then'](removeEntity(_0x7a61b9,null))[_0xac20('0x3d')](handleError(_0x7a61b9,null));};exports[_0xac20('0x48')]=function(_0x3f6e77,_0x4bd61e,_0x114fdf){var _0x5b2c97={};var _0x4a9ef1={};var _0x1e7003;var _0x3126ba;return db['ZohoConfiguration'][_0xac20('0x49')]({'where':{'id':_0x3f6e77[_0xac20('0x3f')]['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x4bd61e,null))['then'](function(_0xd1d969){if(_0xd1d969){_0x1e7003=_0xd1d969;_0x4a9ef1[_0xac20('0x2a')]=_['keys'](db[_0xac20('0x4a')][_0xac20('0x27')]);_0x4a9ef1[_0xac20('0x2c')]=_[_0xac20('0x40')](_0x3f6e77['query']);_0x4a9ef1[_0xac20('0x2d')]=_['intersection'](_0x4a9ef1[_0xac20('0x2a')],_0x4a9ef1[_0xac20('0x2c')]);_0x5b2c97[_0xac20('0x2e')]=_[_0xac20('0x41')](_0x4a9ef1['model'],qs['fields'](_0x3f6e77['query'][_0xac20('0x42')]));_0x5b2c97['attributes']=_0x5b2c97[_0xac20('0x2e')][_0xac20('0x2f')]?_0x5b2c97[_0xac20('0x2e')]:_0x4a9ef1[_0xac20('0x2a')];_0x5b2c97[_0xac20('0x32')]=qs['sort'](_0x3f6e77[_0xac20('0x2c')]['sort']);_0x5b2c97[_0xac20('0x36')]=qs[_0xac20('0x2d')](_['pick'](_0x3f6e77['query'],_0x4a9ef1[_0xac20('0x2d')]));if(_0x3f6e77[_0xac20('0x2c')][_0xac20('0x35')]){_0x5b2c97[_0xac20('0x36')]=_[_0xac20('0x37')](_0x5b2c97[_0xac20('0x36')],{'$or':_['map'](_0x5b2c97['attributes'],function(_0x52241f){var _0x1a66c9={};_0x1a66c9[_0x52241f]={'$like':'%'+_0x3f6e77[_0xac20('0x2c')][_0xac20('0x35')]+'%'};return _0x1a66c9;})});}_0x5b2c97=_[_0xac20('0x37')]({},_0x5b2c97,_0x3f6e77['options']);return _0x1e7003[_0xac20('0x48')](_0x5b2c97);}})[_0xac20('0x24')](function(_0x3f1b9b){if(_0x3f1b9b){_0x3126ba=_0x3f1b9b[_0xac20('0x2f')];if(!_0x3f6e77[_0xac20('0x2c')]['hasOwnProperty'](_0xac20('0x31'))){_0x5b2c97[_0xac20('0x1f')]=qs[_0xac20('0x1f')](_0x3f6e77[_0xac20('0x2c')][_0xac20('0x1f')]);_0x5b2c97['offset']=qs[_0xac20('0x1d')](_0x3f6e77[_0xac20('0x2c')][_0xac20('0x1d')]);}return _0x1e7003[_0xac20('0x48')](_0x5b2c97);}})[_0xac20('0x24')](function(_0x13d068){if(_0x13d068){return _0x13d068?{'count':_0x3126ba,'rows':_0x13d068}:null;}})[_0xac20('0x24')](respondWithResult(_0x4bd61e,null))['catch'](handleError(_0x4bd61e,null));};exports['getSubjects']=function(_0x41888d,_0x43aa49,_0x37d532){var _0x5dbaa2={};var _0x3029c4={};var _0x1ae03f;var _0x59ccb6;return db['ZohoConfiguration'][_0xac20('0x49')]({'where':{'id':_0x41888d['params']['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x43aa49,null))[_0xac20('0x24')](function(_0x2e057f){if(_0x2e057f){_0x1ae03f=_0x2e057f;_0x3029c4[_0xac20('0x2a')]=_['keys'](db[_0xac20('0x4a')][_0xac20('0x27')]);_0x3029c4[_0xac20('0x2c')]=_[_0xac20('0x40')](_0x41888d[_0xac20('0x2c')]);_0x3029c4['filters']=_[_0xac20('0x41')](_0x3029c4[_0xac20('0x2a')],_0x3029c4[_0xac20('0x2c')]);_0x5dbaa2[_0xac20('0x2e')]=_[_0xac20('0x41')](_0x3029c4[_0xac20('0x2a')],qs['fields'](_0x41888d['query'][_0xac20('0x42')]));_0x5dbaa2[_0xac20('0x2e')]=_0x5dbaa2['attributes'][_0xac20('0x2f')]?_0x5dbaa2[_0xac20('0x2e')]:_0x3029c4[_0xac20('0x2a')];_0x5dbaa2['order']=qs[_0xac20('0x33')](_0x41888d[_0xac20('0x2c')][_0xac20('0x33')]);_0x5dbaa2[_0xac20('0x36')]=qs[_0xac20('0x2d')](_[_0xac20('0x34')](_0x41888d[_0xac20('0x2c')],_0x3029c4[_0xac20('0x2d')]));if(_0x41888d[_0xac20('0x2c')][_0xac20('0x35')]){_0x5dbaa2[_0xac20('0x36')]=_[_0xac20('0x37')](_0x5dbaa2[_0xac20('0x36')],{'$or':_['map'](_0x5dbaa2['attributes'],function(_0x16d612){var _0x5e1f6a={};_0x5e1f6a[_0x16d612]={'$like':'%'+_0x41888d[_0xac20('0x2c')][_0xac20('0x35')]+'%'};return _0x5e1f6a;})});}_0x5dbaa2=_[_0xac20('0x37')]({},_0x5dbaa2,_0x41888d[_0xac20('0x43')]);return _0x1ae03f['getSubjects'](_0x5dbaa2);}})['then'](function(_0xa4cc6e){if(_0xa4cc6e){_0x59ccb6=_0xa4cc6e[_0xac20('0x2f')];if(!_0x41888d[_0xac20('0x2c')][_0xac20('0x30')](_0xac20('0x31'))){_0x5dbaa2[_0xac20('0x1f')]=qs[_0xac20('0x1f')](_0x41888d[_0xac20('0x2c')][_0xac20('0x1f')]);_0x5dbaa2[_0xac20('0x1d')]=qs[_0xac20('0x1d')](_0x41888d[_0xac20('0x2c')]['offset']);}return _0x1ae03f[_0xac20('0x4b')](_0x5dbaa2);}})['then'](function(_0x3bcd66){if(_0x3bcd66){return _0x3bcd66?{'count':_0x59ccb6,'rows':_0x3bcd66}:null;}})[_0xac20('0x24')](respondWithResult(_0x43aa49,null))[_0xac20('0x3d')](handleError(_0x43aa49,null));};exports['getDescriptions']=function(_0x4668f0,_0x2040ca,_0x3f8f89){var _0x1c3d2e={};var _0x2f2618={};var _0x159546;var _0x5c755a;return db[_0xac20('0x3a')][_0xac20('0x49')]({'where':{'id':_0x4668f0[_0xac20('0x3f')]['id']}})[_0xac20('0x24')](handleEntityNotFound(_0x2040ca,null))[_0xac20('0x24')](function(_0x3347fd){if(_0x3347fd){_0x159546=_0x3347fd;_0x2f2618[_0xac20('0x2a')]=_[_0xac20('0x40')](db[_0xac20('0x4a')][_0xac20('0x27')]);_0x2f2618[_0xac20('0x2c')]=_[_0xac20('0x40')](_0x4668f0[_0xac20('0x2c')]);_0x2f2618['filters']=_[_0xac20('0x41')](_0x2f2618[_0xac20('0x2a')],_0x2f2618[_0xac20('0x2c')]);_0x1c3d2e[_0xac20('0x2e')]=_[_0xac20('0x41')](_0x2f2618['model'],qs['fields'](_0x4668f0[_0xac20('0x2c')][_0xac20('0x42')]));_0x1c3d2e[_0xac20('0x2e')]=_0x1c3d2e['attributes'][_0xac20('0x2f')]?_0x1c3d2e['attributes']:_0x2f2618[_0xac20('0x2a')];_0x1c3d2e['order']=qs[_0xac20('0x33')](_0x4668f0[_0xac20('0x2c')][_0xac20('0x33')]);_0x1c3d2e[_0xac20('0x36')]=qs[_0xac20('0x2d')](_[_0xac20('0x34')](_0x4668f0[_0xac20('0x2c')],_0x2f2618[_0xac20('0x2d')]));if(_0x4668f0[_0xac20('0x2c')]['filter']){_0x1c3d2e[_0xac20('0x36')]=_[_0xac20('0x37')](_0x1c3d2e[_0xac20('0x36')],{'$or':_['map'](_0x1c3d2e[_0xac20('0x2e')],function(_0x3905ad){var _0x3da77a={};_0x3da77a[_0x3905ad]={'$like':'%'+_0x4668f0['query'][_0xac20('0x35')]+'%'};return _0x3da77a;})});}_0x1c3d2e=_[_0xac20('0x37')]({},_0x1c3d2e,_0x4668f0[_0xac20('0x43')]);return _0x159546[_0xac20('0x4c')](_0x1c3d2e);}})['then'](function(_0x42f68b){if(_0x42f68b){_0x5c755a=_0x42f68b[_0xac20('0x2f')];if(!_0x4668f0[_0xac20('0x2c')][_0xac20('0x30')](_0xac20('0x31'))){_0x1c3d2e[_0xac20('0x1f')]=qs[_0xac20('0x1f')](_0x4668f0[_0xac20('0x2c')][_0xac20('0x1f')]);_0x1c3d2e[_0xac20('0x1d')]=qs['offset'](_0x4668f0['query'][_0xac20('0x1d')]);}return _0x159546[_0xac20('0x4c')](_0x1c3d2e);}})['then'](function(_0x12ac0c){if(_0x12ac0c){return _0x12ac0c?{'count':_0x5c755a,'rows':_0x12ac0c}:null;}})['then'](respondWithResult(_0x2040ca,null))['catch'](handleError(_0x2040ca,null));}; \ No newline at end of file +var _0xc3a1=['Content-Range','apply','reject','update','then','error','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','ZohoConfiguration','findAll','rows','catch','show','params','create','body','find','destroy','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x3bca21,_0x3dd26a){var _0x512ef7=function(_0x488b1e){while(--_0x488b1e){_0x3bca21['push'](_0x3bca21['shift']());}};_0x512ef7(++_0x3dd26a);}(_0xc3a1,0x7f));var _0x1c3a=function(_0x4b84e0,_0x2b5d5a){_0x4b84e0=_0x4b84e0-0x0;var _0x424cb9=_0xc3a1[_0x4b84e0];return _0x424cb9;};'use strict';var emlformat=require(_0x1c3a('0x0'));var rimraf=require(_0x1c3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1c3a('0x2'));var moment=require(_0x1c3a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1c3a('0x4'));var util=require(_0x1c3a('0x5'));var path=require(_0x1c3a('0x6'));var sox=require(_0x1c3a('0x7'));var csv=require(_0x1c3a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c3a('0x9'));var _=require(_0x1c3a('0xa'));var squel=require(_0x1c3a('0xb'));var crypto=require(_0x1c3a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1c3a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1c3a('0xe'));var Redis=require(_0x1c3a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c3a('0x10'));var as=require(_0x1c3a('0x11'));var hardwareService=require(_0x1c3a('0x12'));var logger=require(_0x1c3a('0x13'))(_0x1c3a('0x14'));var utils=require(_0x1c3a('0x15'));var config=require(_0x1c3a('0x16'));var licenseUtil=require(_0x1c3a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d43a6,_0x4751fb){_0x4751fb=_0x4751fb||0xcc;return function(_0x4ef7c9){if(_0x4ef7c9){return _0x3d43a6[_0x1c3a('0x18')](_0x4751fb);}return _0x3d43a6[_0x1c3a('0x19')](_0x4751fb)[_0x1c3a('0x1a')]();};}function respondWithResult(_0x39b0f7,_0x26ba39){_0x26ba39=_0x26ba39||0xc8;return function(_0x3fc522){if(_0x3fc522){return _0x39b0f7['status'](_0x26ba39)[_0x1c3a('0x1b')](_0x3fc522);}};}function respondWithFilteredResult(_0x166c45,_0x1e3d07){return function(_0x3b081b){if(_0x3b081b){var _0x175498=typeof _0x1e3d07[_0x1c3a('0x1c')]===_0x1c3a('0x1d')&&typeof _0x1e3d07['limit']===_0x1c3a('0x1d');var _0xa63079=_0x3b081b[_0x1c3a('0x1e')];var _0x510dbc=_0x175498?0x0:_0x1e3d07[_0x1c3a('0x1c')];var _0x110879=_0x175498?_0x3b081b[_0x1c3a('0x1e')]:_0x1e3d07[_0x1c3a('0x1c')]+_0x1e3d07[_0x1c3a('0x1f')];var _0x254de0;if(_0x110879>=_0xa63079){_0x110879=_0xa63079;_0x254de0=0xc8;}else{_0x254de0=0xce;}_0x166c45[_0x1c3a('0x19')](_0x254de0);return _0x166c45[_0x1c3a('0x20')](_0x1c3a('0x21'),_0x510dbc+'-'+_0x110879+'/'+_0xa63079)[_0x1c3a('0x1b')](_0x3b081b);}return null;};}function patchUpdates(_0xb89e32){return function(_0xff594b){try{jsonpatch[_0x1c3a('0x22')](_0xff594b,_0xb89e32,!![]);}catch(_0x4790f7){return BPromise[_0x1c3a('0x23')](_0x4790f7);}return _0xff594b['save']();};}function saveUpdates(_0x540254,_0x41d488){return function(_0xc43ed){if(_0xc43ed){return _0xc43ed[_0x1c3a('0x24')](_0x540254)[_0x1c3a('0x25')](function(_0x390f39){return _0x390f39;});}return null;};}function removeEntity(_0x38fc33,_0x266c10){return function(_0x3ec47c){if(_0x3ec47c){return _0x3ec47c['destroy']()[_0x1c3a('0x25')](function(){_0x38fc33['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c156b,_0x185e50){return function(_0x131d43){if(!_0x131d43){_0x2c156b['sendStatus'](0x194);}return _0x131d43;};}function handleError(_0x38e758,_0x41981f){_0x41981f=_0x41981f||0x1f4;return function(_0x6c7e76){logger[_0x1c3a('0x26')](_0x6c7e76[_0x1c3a('0x27')]);if(_0x6c7e76['name']){delete _0x6c7e76[_0x1c3a('0x28')];}_0x38e758[_0x1c3a('0x19')](_0x41981f)[_0x1c3a('0x29')](_0x6c7e76);};}exports['index']=function(_0x48bf84,_0x59daf4){var _0x7a9656={},_0x246572={},_0x8830db={'count':0x0,'rows':[]};var _0x333233=_[_0x1c3a('0x2a')](db['ZohoConfiguration'][_0x1c3a('0x2b')],function(_0x492cb2){return{'name':_0x492cb2['fieldName'],'type':_0x492cb2[_0x1c3a('0x2c')][_0x1c3a('0x2d')]};});_0x246572['model']=_[_0x1c3a('0x2a')](_0x333233,_0x1c3a('0x28'));_0x246572[_0x1c3a('0x2e')]=_[_0x1c3a('0x2f')](_0x48bf84['query']);_0x246572[_0x1c3a('0x30')]=_[_0x1c3a('0x31')](_0x246572[_0x1c3a('0x32')],_0x246572[_0x1c3a('0x2e')]);_0x7a9656[_0x1c3a('0x33')]=_['intersection'](_0x246572[_0x1c3a('0x32')],qs[_0x1c3a('0x34')](_0x48bf84[_0x1c3a('0x2e')][_0x1c3a('0x34')]));_0x7a9656['attributes']=_0x7a9656['attributes'][_0x1c3a('0x35')]?_0x7a9656[_0x1c3a('0x33')]:_0x246572[_0x1c3a('0x32')];if(!_0x48bf84[_0x1c3a('0x2e')][_0x1c3a('0x36')]('nolimit')){_0x7a9656[_0x1c3a('0x1f')]=qs['limit'](_0x48bf84[_0x1c3a('0x2e')][_0x1c3a('0x1f')]);_0x7a9656[_0x1c3a('0x1c')]=qs[_0x1c3a('0x1c')](_0x48bf84[_0x1c3a('0x2e')][_0x1c3a('0x1c')]);}_0x7a9656[_0x1c3a('0x37')]=qs[_0x1c3a('0x38')](_0x48bf84[_0x1c3a('0x2e')][_0x1c3a('0x38')]);_0x7a9656['where']=qs[_0x1c3a('0x30')](_[_0x1c3a('0x39')](_0x48bf84['query'],_0x246572[_0x1c3a('0x30')]),_0x333233);if(_0x48bf84['query'][_0x1c3a('0x3a')]){_0x7a9656[_0x1c3a('0x3b')]=_['merge'](_0x7a9656[_0x1c3a('0x3b')],{'$or':_[_0x1c3a('0x2a')](_0x333233,function(_0x42fc9d){if(_0x42fc9d[_0x1c3a('0x2c')]!==_0x1c3a('0x3c')){var _0x32c8a8={};_0x32c8a8[_0x42fc9d[_0x1c3a('0x28')]]={'$like':'%'+_0x48bf84[_0x1c3a('0x2e')][_0x1c3a('0x3a')]+'%'};return _0x32c8a8;}})});}_0x7a9656=_[_0x1c3a('0x3d')]({},_0x7a9656,_0x48bf84[_0x1c3a('0x3e')]);var _0x2c5c46={'where':_0x7a9656['where']};return db['ZohoConfiguration'][_0x1c3a('0x1e')](_0x2c5c46)[_0x1c3a('0x25')](function(_0x4f322e){_0x8830db[_0x1c3a('0x1e')]=_0x4f322e;if(_0x48bf84['query'][_0x1c3a('0x3f')]){_0x7a9656['include']=[{'all':!![]}];}return db[_0x1c3a('0x40')][_0x1c3a('0x41')](_0x7a9656);})['then'](function(_0x5e3402){_0x8830db[_0x1c3a('0x42')]=_0x5e3402;return _0x8830db;})[_0x1c3a('0x25')](respondWithFilteredResult(_0x59daf4,_0x7a9656))[_0x1c3a('0x43')](handleError(_0x59daf4,null));};exports[_0x1c3a('0x44')]=function(_0x2a8662,_0x251ed1){var _0x1eafdc={'raw':![],'where':{'id':_0x2a8662[_0x1c3a('0x45')]['id']}},_0x5d651c={};_0x5d651c[_0x1c3a('0x32')]=_[_0x1c3a('0x2f')](db['ZohoConfiguration']['rawAttributes']);_0x5d651c['query']=_[_0x1c3a('0x2f')](_0x2a8662[_0x1c3a('0x2e')]);_0x5d651c[_0x1c3a('0x30')]=_[_0x1c3a('0x31')](_0x5d651c[_0x1c3a('0x32')],_0x5d651c[_0x1c3a('0x2e')]);_0x1eafdc['attributes']=_[_0x1c3a('0x31')](_0x5d651c[_0x1c3a('0x32')],qs['fields'](_0x2a8662['query'][_0x1c3a('0x34')]));_0x1eafdc[_0x1c3a('0x33')]=_0x1eafdc[_0x1c3a('0x33')][_0x1c3a('0x35')]?_0x1eafdc[_0x1c3a('0x33')]:_0x5d651c['model'];if(_0x2a8662[_0x1c3a('0x2e')][_0x1c3a('0x3f')]){_0x1eafdc['include']=[{'all':!![]}];}_0x1eafdc=_[_0x1c3a('0x3d')]({},_0x1eafdc,_0x2a8662['options']);return db[_0x1c3a('0x40')]['find'](_0x1eafdc)[_0x1c3a('0x25')](handleEntityNotFound(_0x251ed1,null))[_0x1c3a('0x25')](respondWithResult(_0x251ed1,null))[_0x1c3a('0x43')](handleError(_0x251ed1,null));};exports[_0x1c3a('0x46')]=function(_0x1971ce,_0xf172e5){return db[_0x1c3a('0x40')][_0x1c3a('0x46')](_0x1971ce[_0x1c3a('0x47')],{})[_0x1c3a('0x25')](respondWithResult(_0xf172e5,0xc9))['catch'](handleError(_0xf172e5,null));};exports[_0x1c3a('0x24')]=function(_0x5aa50d,_0x2e972f){if(_0x5aa50d[_0x1c3a('0x47')]['id']){delete _0x5aa50d['body']['id'];}return db[_0x1c3a('0x40')][_0x1c3a('0x48')]({'where':{'id':_0x5aa50d[_0x1c3a('0x45')]['id']}})[_0x1c3a('0x25')](handleEntityNotFound(_0x2e972f,null))[_0x1c3a('0x25')](saveUpdates(_0x5aa50d[_0x1c3a('0x47')],null))['then'](respondWithResult(_0x2e972f,null))[_0x1c3a('0x43')](handleError(_0x2e972f,null));};exports[_0x1c3a('0x49')]=function(_0x37f072,_0x56a0bb){return db['ZohoConfiguration'][_0x1c3a('0x48')]({'where':{'id':_0x37f072[_0x1c3a('0x45')]['id']}})[_0x1c3a('0x25')](handleEntityNotFound(_0x56a0bb,null))[_0x1c3a('0x25')](removeEntity(_0x56a0bb,null))[_0x1c3a('0x43')](handleError(_0x56a0bb,null));};exports[_0x1c3a('0x4a')]=function(_0x1f78f8,_0x2f9198,_0x2bcc40){var _0x195f4d={};var _0x3fe4a6={};var _0x341497;var _0x349db3;return db[_0x1c3a('0x40')][_0x1c3a('0x4b')]({'where':{'id':_0x1f78f8[_0x1c3a('0x45')]['id']}})[_0x1c3a('0x25')](handleEntityNotFound(_0x2f9198,null))[_0x1c3a('0x25')](function(_0x40cb0b){if(_0x40cb0b){_0x341497=_0x40cb0b;_0x3fe4a6[_0x1c3a('0x32')]=_[_0x1c3a('0x2f')](db[_0x1c3a('0x4c')][_0x1c3a('0x2b')]);_0x3fe4a6[_0x1c3a('0x2e')]=_['keys'](_0x1f78f8['query']);_0x3fe4a6[_0x1c3a('0x30')]=_[_0x1c3a('0x31')](_0x3fe4a6[_0x1c3a('0x32')],_0x3fe4a6['query']);_0x195f4d[_0x1c3a('0x33')]=_[_0x1c3a('0x31')](_0x3fe4a6['model'],qs[_0x1c3a('0x34')](_0x1f78f8[_0x1c3a('0x2e')][_0x1c3a('0x34')]));_0x195f4d[_0x1c3a('0x33')]=_0x195f4d[_0x1c3a('0x33')]['length']?_0x195f4d[_0x1c3a('0x33')]:_0x3fe4a6[_0x1c3a('0x32')];_0x195f4d[_0x1c3a('0x37')]=qs[_0x1c3a('0x38')](_0x1f78f8[_0x1c3a('0x2e')][_0x1c3a('0x38')]);_0x195f4d[_0x1c3a('0x3b')]=qs[_0x1c3a('0x30')](_[_0x1c3a('0x39')](_0x1f78f8[_0x1c3a('0x2e')],_0x3fe4a6['filters']));if(_0x1f78f8['query'][_0x1c3a('0x3a')]){_0x195f4d[_0x1c3a('0x3b')]=_['merge'](_0x195f4d['where'],{'$or':_[_0x1c3a('0x2a')](_0x195f4d[_0x1c3a('0x33')],function(_0x255eaf){var _0x288bb6={};_0x288bb6[_0x255eaf]={'$like':'%'+_0x1f78f8[_0x1c3a('0x2e')][_0x1c3a('0x3a')]+'%'};return _0x288bb6;})});}_0x195f4d=_['merge']({},_0x195f4d,_0x1f78f8[_0x1c3a('0x3e')]);return _0x341497[_0x1c3a('0x4a')](_0x195f4d);}})[_0x1c3a('0x25')](function(_0x3abe21){if(_0x3abe21){_0x349db3=_0x3abe21[_0x1c3a('0x35')];if(!_0x1f78f8[_0x1c3a('0x2e')][_0x1c3a('0x36')](_0x1c3a('0x4d'))){_0x195f4d[_0x1c3a('0x1f')]=qs[_0x1c3a('0x1f')](_0x1f78f8[_0x1c3a('0x2e')][_0x1c3a('0x1f')]);_0x195f4d['offset']=qs[_0x1c3a('0x1c')](_0x1f78f8[_0x1c3a('0x2e')][_0x1c3a('0x1c')]);}return _0x341497[_0x1c3a('0x4a')](_0x195f4d);}})[_0x1c3a('0x25')](function(_0x2b5e4c){if(_0x2b5e4c){return _0x2b5e4c?{'count':_0x349db3,'rows':_0x2b5e4c}:null;}})[_0x1c3a('0x25')](respondWithResult(_0x2f9198,null))[_0x1c3a('0x43')](handleError(_0x2f9198,null));};exports[_0x1c3a('0x4e')]=function(_0x3d65cf,_0x3e8b29,_0x49527c){var _0x57fffe={};var _0x60fd0c={};var _0x23a82e;var _0x2d82f4;return db['ZohoConfiguration'][_0x1c3a('0x4b')]({'where':{'id':_0x3d65cf['params']['id']}})[_0x1c3a('0x25')](handleEntityNotFound(_0x3e8b29,null))[_0x1c3a('0x25')](function(_0x2ca640){if(_0x2ca640){_0x23a82e=_0x2ca640;_0x60fd0c[_0x1c3a('0x32')]=_[_0x1c3a('0x2f')](db['ZohoField'][_0x1c3a('0x2b')]);_0x60fd0c['query']=_[_0x1c3a('0x2f')](_0x3d65cf[_0x1c3a('0x2e')]);_0x60fd0c['filters']=_[_0x1c3a('0x31')](_0x60fd0c[_0x1c3a('0x32')],_0x60fd0c['query']);_0x57fffe['attributes']=_[_0x1c3a('0x31')](_0x60fd0c[_0x1c3a('0x32')],qs['fields'](_0x3d65cf['query'][_0x1c3a('0x34')]));_0x57fffe['attributes']=_0x57fffe['attributes'][_0x1c3a('0x35')]?_0x57fffe[_0x1c3a('0x33')]:_0x60fd0c[_0x1c3a('0x32')];_0x57fffe[_0x1c3a('0x37')]=qs['sort'](_0x3d65cf[_0x1c3a('0x2e')][_0x1c3a('0x38')]);_0x57fffe[_0x1c3a('0x3b')]=qs['filters'](_['pick'](_0x3d65cf['query'],_0x60fd0c[_0x1c3a('0x30')]));if(_0x3d65cf[_0x1c3a('0x2e')][_0x1c3a('0x3a')]){_0x57fffe['where']=_[_0x1c3a('0x3d')](_0x57fffe[_0x1c3a('0x3b')],{'$or':_[_0x1c3a('0x2a')](_0x57fffe['attributes'],function(_0x215c7e){var _0x33f2e4={};_0x33f2e4[_0x215c7e]={'$like':'%'+_0x3d65cf[_0x1c3a('0x2e')]['filter']+'%'};return _0x33f2e4;})});}_0x57fffe=_[_0x1c3a('0x3d')]({},_0x57fffe,_0x3d65cf['options']);return _0x23a82e[_0x1c3a('0x4e')](_0x57fffe);}})['then'](function(_0x1164cf){if(_0x1164cf){_0x2d82f4=_0x1164cf[_0x1c3a('0x35')];if(!_0x3d65cf[_0x1c3a('0x2e')]['hasOwnProperty'](_0x1c3a('0x4d'))){_0x57fffe[_0x1c3a('0x1f')]=qs[_0x1c3a('0x1f')](_0x3d65cf[_0x1c3a('0x2e')][_0x1c3a('0x1f')]);_0x57fffe[_0x1c3a('0x1c')]=qs['offset'](_0x3d65cf[_0x1c3a('0x2e')]['offset']);}return _0x23a82e[_0x1c3a('0x4e')](_0x57fffe);}})[_0x1c3a('0x25')](function(_0x30bc1e){if(_0x30bc1e){return _0x30bc1e?{'count':_0x2d82f4,'rows':_0x30bc1e}:null;}})[_0x1c3a('0x25')](respondWithResult(_0x3e8b29,null))['catch'](handleError(_0x3e8b29,null));};exports[_0x1c3a('0x4f')]=function(_0x1d2123,_0x285589,_0x38a0bf){var _0x157f54={};var _0x2df6ff={};var _0x5a52fc;var _0x37da19;return db[_0x1c3a('0x40')][_0x1c3a('0x4b')]({'where':{'id':_0x1d2123[_0x1c3a('0x45')]['id']}})[_0x1c3a('0x25')](handleEntityNotFound(_0x285589,null))[_0x1c3a('0x25')](function(_0x555516){if(_0x555516){_0x5a52fc=_0x555516;_0x2df6ff[_0x1c3a('0x32')]=_[_0x1c3a('0x2f')](db['ZohoField'][_0x1c3a('0x2b')]);_0x2df6ff[_0x1c3a('0x2e')]=_['keys'](_0x1d2123[_0x1c3a('0x2e')]);_0x2df6ff[_0x1c3a('0x30')]=_[_0x1c3a('0x31')](_0x2df6ff[_0x1c3a('0x32')],_0x2df6ff[_0x1c3a('0x2e')]);_0x157f54['attributes']=_[_0x1c3a('0x31')](_0x2df6ff[_0x1c3a('0x32')],qs[_0x1c3a('0x34')](_0x1d2123[_0x1c3a('0x2e')][_0x1c3a('0x34')]));_0x157f54[_0x1c3a('0x33')]=_0x157f54[_0x1c3a('0x33')][_0x1c3a('0x35')]?_0x157f54['attributes']:_0x2df6ff[_0x1c3a('0x32')];_0x157f54[_0x1c3a('0x37')]=qs[_0x1c3a('0x38')](_0x1d2123[_0x1c3a('0x2e')][_0x1c3a('0x38')]);_0x157f54[_0x1c3a('0x3b')]=qs[_0x1c3a('0x30')](_['pick'](_0x1d2123['query'],_0x2df6ff[_0x1c3a('0x30')]));if(_0x1d2123[_0x1c3a('0x2e')]['filter']){_0x157f54['where']=_[_0x1c3a('0x3d')](_0x157f54[_0x1c3a('0x3b')],{'$or':_['map'](_0x157f54[_0x1c3a('0x33')],function(_0x2205bf){var _0xee2b83={};_0xee2b83[_0x2205bf]={'$like':'%'+_0x1d2123[_0x1c3a('0x2e')][_0x1c3a('0x3a')]+'%'};return _0xee2b83;})});}_0x157f54=_[_0x1c3a('0x3d')]({},_0x157f54,_0x1d2123[_0x1c3a('0x3e')]);return _0x5a52fc[_0x1c3a('0x4f')](_0x157f54);}})['then'](function(_0x2cf11f){if(_0x2cf11f){_0x37da19=_0x2cf11f[_0x1c3a('0x35')];if(!_0x1d2123[_0x1c3a('0x2e')][_0x1c3a('0x36')](_0x1c3a('0x4d'))){_0x157f54[_0x1c3a('0x1f')]=qs[_0x1c3a('0x1f')](_0x1d2123[_0x1c3a('0x2e')]['limit']);_0x157f54[_0x1c3a('0x1c')]=qs['offset'](_0x1d2123[_0x1c3a('0x2e')]['offset']);}return _0x5a52fc[_0x1c3a('0x4f')](_0x157f54);}})[_0x1c3a('0x25')](function(_0x224b9b){if(_0x224b9b){return _0x224b9b?{'count':_0x37da19,'rows':_0x224b9b}:null;}})[_0x1c3a('0x25')](respondWithResult(_0x285589,null))['catch'](handleError(_0x285589,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index dd6133e..d8b0d30 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 _0x6bd5=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','bluebird'];(function(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_0x6bd5,0xbc));var _0x56bd=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x6bd5[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x56bd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x56bd('0x1'));var rp=require(_0x56bd('0x2'));var fs=require('fs');var path=require(_0x56bd('0x3'));var rimraf=require(_0x56bd('0x4'));var config=require(_0x56bd('0x5'));var attributes=require(_0x56bd('0x6'));module[_0x56bd('0x7')]=function(_0x77078f,_0x301d42){return _0x77078f[_0x56bd('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x56bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe529=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_zoho_configurations','lodash','../../config/logger','api','moment'];(function(_0xcb78cf,_0x1ee7d5){var _0x2d7f16=function(_0x5840a4){while(--_0x5840a4){_0xcb78cf['push'](_0xcb78cf['shift']());}};_0x2d7f16(++_0x1ee7d5);}(_0xe529,0xc8));var _0x9e52=function(_0x1eacc6,_0x4f06ad){_0x1eacc6=_0x1eacc6-0x0;var _0x14353c=_0xe529[_0x1eacc6];return _0x14353c;};'use strict';var _=require(_0x9e52('0x0'));var util=require('util');var logger=require(_0x9e52('0x1'))(_0x9e52('0x2'));var moment=require(_0x9e52('0x3'));var BPromise=require(_0x9e52('0x4'));var rp=require(_0x9e52('0x5'));var fs=require('fs');var path=require(_0x9e52('0x6'));var rimraf=require(_0x9e52('0x7'));var config=require(_0x9e52('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x9e52('0x9')]=function(_0x4ff2a4,_0x2c69ac){return _0x4ff2a4[_0x9e52('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x9e52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 7c29521..20b728f 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 _0xcb4c=['code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0xcb4c,0x131));var _0xccb4=function(_0x4868f1,_0x161563){_0x4868f1=_0x4868f1-0x0;var _0x41e532=_0xcb4c[_0x4868f1];return _0x41e532;};'use strict';var _=require(_0xccb4('0x0'));var util=require(_0xccb4('0x1'));var moment=require('moment');var BPromise=require(_0xccb4('0x2'));var rs=require(_0xccb4('0x3'));var fs=require('fs');var Redis=require(_0xccb4('0x4'));var db=require(_0xccb4('0x5'))['db'];var utils=require(_0xccb4('0x6'));var logger=require(_0xccb4('0x7'))(_0xccb4('0x8'));var config=require(_0xccb4('0x9'));var jayson=require(_0xccb4('0xa'));var client=jayson[_0xccb4('0xb')][_0xccb4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d540f,_0x23e001,_0x425ede){return new BPromise(function(_0x544a90,_0x58a1c2){return client[_0xccb4('0xd')](_0x2d540f,_0x425ede)[_0xccb4('0xe')](function(_0x43f5d9){logger[_0xccb4('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x23e001,'request\x20sent');logger[_0xccb4('0x10')](_0xccb4('0x11'),_0x23e001,_0xccb4('0x12'),JSON['stringify'](_0x43f5d9));if(_0x43f5d9[_0xccb4('0x13')]){if(_0x43f5d9['error'][_0xccb4('0x14')]===0x1f4){logger[_0xccb4('0x13')](_0xccb4('0x15'),_0x23e001,_0x43f5d9[_0xccb4('0x13')][_0xccb4('0x16')]);return _0x58a1c2(_0x43f5d9['error'][_0xccb4('0x16')]);}logger[_0xccb4('0x13')](_0xccb4('0x15'),_0x23e001,_0x43f5d9['error'][_0xccb4('0x16')]);return _0x544a90(_0x43f5d9[_0xccb4('0x13')]['message']);}else{logger[_0xccb4('0xf')](_0xccb4('0x15'),_0x23e001,_0xccb4('0x12'));_0x544a90(_0x43f5d9[_0xccb4('0x17')][_0xccb4('0x16')]);}})[_0xccb4('0x18')](function(_0x5887f3){logger['error'](_0xccb4('0x15'),_0x23e001,_0x5887f3);_0x58a1c2(_0x5887f3);});});} \ No newline at end of file +var _0x3c0e=['rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x34a265,_0x4d3dcb){var _0x517c74=function(_0x2cf995){while(--_0x2cf995){_0x34a265['push'](_0x34a265['shift']());}};_0x517c74(++_0x4d3dcb);}(_0x3c0e,0x89));var _0xe3c0=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3c0e[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xe3c0('0x0'));var util=require(_0xe3c0('0x1'));var moment=require(_0xe3c0('0x2'));var BPromise=require('bluebird');var rs=require(_0xe3c0('0x3'));var fs=require('fs');var Redis=require(_0xe3c0('0x4'));var db=require(_0xe3c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3c0('0x6'))(_0xe3c0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe3c0('0x8'));var client=jayson[_0xe3c0('0x9')][_0xe3c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cc18d,_0x3de53d,_0x4355d9){return new BPromise(function(_0x4c97c2,_0x38f7b1){return client[_0xe3c0('0xb')](_0x1cc18d,_0x4355d9)[_0xe3c0('0xc')](function(_0x2ece9b){logger[_0xe3c0('0xd')](_0xe3c0('0xe'),_0x3de53d,_0xe3c0('0xf'));logger[_0xe3c0('0x10')](_0xe3c0('0x11'),_0x3de53d,_0xe3c0('0xf'),JSON[_0xe3c0('0x12')](_0x2ece9b));if(_0x2ece9b['error']){if(_0x2ece9b[_0xe3c0('0x13')][_0xe3c0('0x14')]===0x1f4){logger[_0xe3c0('0x13')](_0xe3c0('0xe'),_0x3de53d,_0x2ece9b[_0xe3c0('0x13')]['message']);return _0x38f7b1(_0x2ece9b['error'][_0xe3c0('0x15')]);}logger[_0xe3c0('0x13')](_0xe3c0('0xe'),_0x3de53d,_0x2ece9b[_0xe3c0('0x13')][_0xe3c0('0x15')]);return _0x4c97c2(_0x2ece9b['error'][_0xe3c0('0x15')]);}else{logger['info'](_0xe3c0('0xe'),_0x3de53d,_0xe3c0('0xf'));_0x4c97c2(_0x2ece9b[_0xe3c0('0x16')][_0xe3c0('0x15')]);}})[_0xe3c0('0x17')](function(_0xf8e355){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3de53d,_0xf8e355);_0x38f7b1(_0xf8e355);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9e93ee5..893bd2b 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 _0xb806=['connect-timeout','express','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3e9041,_0x5971f6){var _0x3519be=function(_0x1153d1){while(--_0x1153d1){_0x3e9041['push'](_0x3e9041['shift']());}};_0x3519be(++_0x5971f6);}(_0xb806,0x95));var _0x6b80=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xb806[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0x6b80('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b80('0x1'));var express=require(_0x6b80('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6b80('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b80('0x4'));router[_0x6b80('0x5')]('/',auth[_0x6b80('0x6')](),controller['index']);router[_0x6b80('0x5')](_0x6b80('0x7'),auth[_0x6b80('0x6')](),controller['show']);router[_0x6b80('0x8')]('/',auth[_0x6b80('0x6')](),controller[_0x6b80('0x9')]);router[_0x6b80('0xa')](_0x6b80('0x7'),auth[_0x6b80('0x6')](),controller[_0x6b80('0xb')]);router[_0x6b80('0xc')](_0x6b80('0x7'),auth[_0x6b80('0x6')](),controller[_0x6b80('0xd')]);module[_0x6b80('0xe')]=router; \ No newline at end of file +var _0x8796=['Router','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x8796,0xe5));var _0x6879=function(_0x12ed52,_0x4e5e22){_0x12ed52=_0x12ed52-0x0;var _0x2bb2be=_0x8796[_0x12ed52];return _0x2bb2be;};'use strict';var multer=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var path=require(_0x6879('0x2'));var timeout=require(_0x6879('0x3'));var express=require(_0x6879('0x4'));var router=express[_0x6879('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6879('0x6'));var controller=require(_0x6879('0x7'));router[_0x6879('0x8')]('/',auth[_0x6879('0x9')](),controller[_0x6879('0xa')]);router[_0x6879('0x8')](_0x6879('0xb'),auth[_0x6879('0x9')](),controller['show']);router[_0x6879('0xc')]('/',auth[_0x6879('0x9')](),controller[_0x6879('0xd')]);router[_0x6879('0xe')]('/:id',auth[_0x6879('0x9')](),controller['update']);router[_0x6879('0xf')](_0x6879('0xb'),auth['isAuthenticated'](),controller[_0x6879('0x10')]);module[_0x6879('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 7d18bd7..fe2fd0d 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 _0xa622=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x23dcd1,_0x2bf33d){var _0x14287e=function(_0x14e3d2){while(--_0x14e3d2){_0x23dcd1['push'](_0x23dcd1['shift']());}};_0x14287e(++_0x2bf33d);}(_0xa622,0x1cf));var _0x2a62=function(_0x35cddc,_0x43dbbb){_0x35cddc=_0x35cddc-0x0;var _0x30886a=_0xa622[_0x35cddc];return _0x30886a;};'use strict';var Sequelize=require(_0x2a62('0x0'));module[_0x2a62('0x1')]={'type':{'type':Sequelize[_0x2a62('0x2')]('string',_0x2a62('0x3'),_0x2a62('0x4'),'keyValue',_0x2a62('0x5')),'defaultValue':_0x2a62('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2a62('0x7')]},'keyType':{'type':Sequelize[_0x2a62('0x2')]('string','variable',_0x2a62('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2a62('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2a62('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a62('0x7')]}}; \ No newline at end of file +var _0xad95=['BOOLEAN','sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x2c3161,_0x38836e){var _0x5f5d7c=function(_0x6420f7){while(--_0x6420f7){_0x2c3161['push'](_0x2c3161['shift']());}};_0x5f5d7c(++_0x38836e);}(_0xad95,0x17b));var _0x5ad9=function(_0x5ab326,_0x167fa1){_0x5ab326=_0x5ab326-0x0;var _0x19c1d0=_0xad95[_0x5ab326];return _0x19c1d0;};'use strict';var Sequelize=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5ad9('0x2'),_0x5ad9('0x3'),_0x5ad9('0x4'),'keyValue',_0x5ad9('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5ad9('0x6')]},'keyType':{'type':Sequelize[_0x5ad9('0x7')](_0x5ad9('0x2'),_0x5ad9('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x5ad9('0x6')]},'idField':{'type':Sequelize[_0x5ad9('0x6')]},'nameField':{'type':Sequelize[_0x5ad9('0x6')]},'customField':{'type':Sequelize[_0x5ad9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ad9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 463b1c2..6e4dd2e 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 _0x278a=['keys','rawAttributes','include','find','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','ZohoField','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show'];(function(_0x104853,_0x2fa75a){var _0x200369=function(_0x240b84){while(--_0x240b84){_0x104853['push'](_0x104853['shift']());}};_0x200369(++_0x2fa75a);}(_0x278a,0x127));var _0xa278=function(_0x5729bf,_0x16f5dd){_0x5729bf=_0x5729bf-0x0;var _0x297d5c=_0x278a[_0x5729bf];return _0x297d5c;};'use strict';var emlformat=require(_0xa278('0x0'));var rimraf=require(_0xa278('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa278('0x2'));var rp=require('request-promise');var moment=require(_0xa278('0x3'));var BPromise=require(_0xa278('0x4'));var Mustache=require('mustache');var util=require(_0xa278('0x5'));var path=require(_0xa278('0x6'));var sox=require('sox');var csv=require(_0xa278('0x7'));var ejs=require(_0xa278('0x8'));var fs=require('fs');var fs_extra=require(_0xa278('0x9'));var _=require(_0xa278('0xa'));var squel=require(_0xa278('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa278('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa278('0xd'));var Papa=require('papaparse');var Redis=require(_0xa278('0xe'));var authService=require(_0xa278('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa278('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa278('0x11'))(_0xa278('0x12'));var utils=require(_0xa278('0x13'));var config=require(_0xa278('0x14'));var licenseUtil=require(_0xa278('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x333bfc,_0x39a54e){_0x39a54e=_0x39a54e||0xcc;return function(_0x26ac80){if(_0x26ac80){return _0x333bfc[_0xa278('0x16')](_0x39a54e);}return _0x333bfc[_0xa278('0x17')](_0x39a54e)[_0xa278('0x18')]();};}function respondWithResult(_0x1a7e30,_0x15c9c3){_0x15c9c3=_0x15c9c3||0xc8;return function(_0x55e417){if(_0x55e417){return _0x1a7e30[_0xa278('0x17')](_0x15c9c3)[_0xa278('0x19')](_0x55e417);}};}function respondWithFilteredResult(_0xb0b97c,_0x22fa72){return function(_0x2171ff){if(_0x2171ff){var _0x570d70=typeof _0x22fa72[_0xa278('0x1a')]===_0xa278('0x1b')&&typeof _0x22fa72[_0xa278('0x1c')]===_0xa278('0x1b');var _0x97d7d8=_0x2171ff[_0xa278('0x1d')];var _0xcb55c2=_0x570d70?0x0:_0x22fa72[_0xa278('0x1a')];var _0x1ba914=_0x570d70?_0x2171ff[_0xa278('0x1d')]:_0x22fa72['offset']+_0x22fa72[_0xa278('0x1c')];var _0x4dccb0;if(_0x1ba914>=_0x97d7d8){_0x1ba914=_0x97d7d8;_0x4dccb0=0xc8;}else{_0x4dccb0=0xce;}_0xb0b97c[_0xa278('0x17')](_0x4dccb0);return _0xb0b97c[_0xa278('0x1e')](_0xa278('0x1f'),_0xcb55c2+'-'+_0x1ba914+'/'+_0x97d7d8)[_0xa278('0x19')](_0x2171ff);}return null;};}function patchUpdates(_0x4c0246){return function(_0x486b21){try{jsonpatch[_0xa278('0x20')](_0x486b21,_0x4c0246,!![]);}catch(_0x165188){return BPromise[_0xa278('0x21')](_0x165188);}return _0x486b21['save']();};}function saveUpdates(_0x33d726,_0x509b20){return function(_0x2d3281){if(_0x2d3281){return _0x2d3281[_0xa278('0x22')](_0x33d726)[_0xa278('0x23')](function(_0x516d52){return _0x516d52;});}return null;};}function removeEntity(_0x1bff88,_0xc673d2){return function(_0x5db041){if(_0x5db041){return _0x5db041[_0xa278('0x24')]()[_0xa278('0x23')](function(){_0x1bff88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3db3,_0x596069){return function(_0x446921){if(!_0x446921){_0x1f3db3[_0xa278('0x16')](0x194);}return _0x446921;};}function handleError(_0x258fc4,_0x4cdb65){_0x4cdb65=_0x4cdb65||0x1f4;return function(_0x386dc2){logger[_0xa278('0x25')](_0x386dc2['stack']);if(_0x386dc2['name']){delete _0x386dc2[_0xa278('0x26')];}_0x258fc4[_0xa278('0x17')](_0x4cdb65)[_0xa278('0x27')](_0x386dc2);};}exports[_0xa278('0x28')]=function(_0x340552,_0x3616fb){var _0x47d76d={},_0x56816b={},_0x20784c={'count':0x0,'rows':[]};var _0x5ea9b1=_[_0xa278('0x29')](db[_0xa278('0x2a')]['rawAttributes'],function(_0x257fde){return{'name':_0x257fde[_0xa278('0x2b')],'type':_0x257fde[_0xa278('0x2c')]['key']};});_0x56816b[_0xa278('0x2d')]=_[_0xa278('0x29')](_0x5ea9b1,_0xa278('0x26'));_0x56816b['query']=_['keys'](_0x340552[_0xa278('0x2e')]);_0x56816b[_0xa278('0x2f')]=_[_0xa278('0x30')](_0x56816b[_0xa278('0x2d')],_0x56816b['query']);_0x47d76d[_0xa278('0x31')]=_[_0xa278('0x30')](_0x56816b[_0xa278('0x2d')],qs[_0xa278('0x32')](_0x340552[_0xa278('0x2e')][_0xa278('0x32')]));_0x47d76d[_0xa278('0x31')]=_0x47d76d[_0xa278('0x31')][_0xa278('0x33')]?_0x47d76d[_0xa278('0x31')]:_0x56816b[_0xa278('0x2d')];if(!_0x340552[_0xa278('0x2e')][_0xa278('0x34')](_0xa278('0x35'))){_0x47d76d[_0xa278('0x1c')]=qs['limit'](_0x340552['query']['limit']);_0x47d76d[_0xa278('0x1a')]=qs['offset'](_0x340552[_0xa278('0x2e')][_0xa278('0x1a')]);}_0x47d76d['order']=qs[_0xa278('0x36')](_0x340552[_0xa278('0x2e')][_0xa278('0x36')]);_0x47d76d[_0xa278('0x37')]=qs[_0xa278('0x2f')](_[_0xa278('0x38')](_0x340552[_0xa278('0x2e')],_0x56816b[_0xa278('0x2f')]),_0x5ea9b1);if(_0x340552[_0xa278('0x2e')][_0xa278('0x39')]){_0x47d76d['where']=_[_0xa278('0x3a')](_0x47d76d[_0xa278('0x37')],{'$or':_[_0xa278('0x29')](_0x5ea9b1,function(_0x153811){if(_0x153811[_0xa278('0x2c')]!=='VIRTUAL'){var _0x24ca26={};_0x24ca26[_0x153811[_0xa278('0x26')]]={'$like':'%'+_0x340552[_0xa278('0x2e')][_0xa278('0x39')]+'%'};return _0x24ca26;}})});}_0x47d76d=_[_0xa278('0x3a')]({},_0x47d76d,_0x340552[_0xa278('0x3b')]);var _0x4f4519={'where':_0x47d76d[_0xa278('0x37')]};return db['ZohoField'][_0xa278('0x1d')](_0x4f4519)[_0xa278('0x23')](function(_0x49371b){_0x20784c[_0xa278('0x1d')]=_0x49371b;if(_0x340552[_0xa278('0x2e')][_0xa278('0x3c')]){_0x47d76d['include']=[{'all':!![]}];}return db[_0xa278('0x2a')][_0xa278('0x3d')](_0x47d76d);})['then'](function(_0x16dec5){_0x20784c[_0xa278('0x3e')]=_0x16dec5;return _0x20784c;})['then'](respondWithFilteredResult(_0x3616fb,_0x47d76d))[_0xa278('0x3f')](handleError(_0x3616fb,null));};exports[_0xa278('0x40')]=function(_0x29d867,_0x15a624){var _0xeb5851={'raw':!![],'where':{'id':_0x29d867['params']['id']}},_0x180c68={};_0x180c68['model']=_[_0xa278('0x41')](db[_0xa278('0x2a')][_0xa278('0x42')]);_0x180c68[_0xa278('0x2e')]=_[_0xa278('0x41')](_0x29d867[_0xa278('0x2e')]);_0x180c68[_0xa278('0x2f')]=_['intersection'](_0x180c68[_0xa278('0x2d')],_0x180c68[_0xa278('0x2e')]);_0xeb5851[_0xa278('0x31')]=_[_0xa278('0x30')](_0x180c68['model'],qs['fields'](_0x29d867[_0xa278('0x2e')][_0xa278('0x32')]));_0xeb5851['attributes']=_0xeb5851[_0xa278('0x31')]['length']?_0xeb5851[_0xa278('0x31')]:_0x180c68[_0xa278('0x2d')];if(_0x29d867[_0xa278('0x2e')]['includeAll']){_0xeb5851[_0xa278('0x43')]=[{'all':!![]}];}_0xeb5851=_['merge']({},_0xeb5851,_0x29d867['options']);return db[_0xa278('0x2a')][_0xa278('0x44')](_0xeb5851)[_0xa278('0x23')](handleEntityNotFound(_0x15a624,null))[_0xa278('0x23')](respondWithResult(_0x15a624,null))[_0xa278('0x3f')](handleError(_0x15a624,null));};exports['create']=function(_0x57ee92,_0x1e38db){return db[_0xa278('0x2a')][_0xa278('0x45')](_0x57ee92[_0xa278('0x46')],{})['then'](respondWithResult(_0x1e38db,0xc9))[_0xa278('0x3f')](handleError(_0x1e38db,null));};exports[_0xa278('0x22')]=function(_0x1c77d7,_0x142d78){if(_0x1c77d7[_0xa278('0x46')]['id']){delete _0x1c77d7[_0xa278('0x46')]['id'];}return db[_0xa278('0x2a')]['find']({'where':{'id':_0x1c77d7[_0xa278('0x47')]['id']}})[_0xa278('0x23')](handleEntityNotFound(_0x142d78,null))[_0xa278('0x23')](saveUpdates(_0x1c77d7[_0xa278('0x46')],null))[_0xa278('0x23')](respondWithResult(_0x142d78,null))[_0xa278('0x3f')](handleError(_0x142d78,null));};exports[_0xa278('0x24')]=function(_0x252f42,_0x559a6b){return db[_0xa278('0x2a')][_0xa278('0x44')]({'where':{'id':_0x252f42['params']['id']}})[_0xa278('0x23')](handleEntityNotFound(_0x559a6b,null))[_0xa278('0x23')](removeEntity(_0x559a6b,null))[_0xa278('0x3f')](handleError(_0x559a6b,null));}; \ No newline at end of file +var _0x9f7c=['limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0x9f7c,0x1eb));var _0xc9f7=function(_0x4059ff,_0x403559){_0x4059ff=_0x4059ff-0x0;var _0x139301=_0x9f7c[_0x4059ff];return _0x139301;};'use strict';var emlformat=require(_0xc9f7('0x0'));var rimraf=require(_0xc9f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9f7('0x2'));var rp=require(_0xc9f7('0x3'));var moment=require(_0xc9f7('0x4'));var BPromise=require(_0xc9f7('0x5'));var Mustache=require(_0xc9f7('0x6'));var util=require('util');var path=require(_0xc9f7('0x7'));var sox=require(_0xc9f7('0x8'));var csv=require(_0xc9f7('0x9'));var ejs=require(_0xc9f7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9f7('0xb'));var squel=require('squel');var crypto=require(_0xc9f7('0xc'));var jsforce=require(_0xc9f7('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc9f7('0xe'));var Papa=require(_0xc9f7('0xf'));var Redis=require(_0xc9f7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc9f7('0x11'));var hardwareService=require(_0xc9f7('0x12'));var logger=require(_0xc9f7('0x13'))(_0xc9f7('0x14'));var utils=require('../../config/utils');var config=require(_0xc9f7('0x15'));var licenseUtil=require(_0xc9f7('0x16'));var db=require(_0xc9f7('0x17'))['db'];function respondWithStatusCode(_0x4846f2,_0x1e4f8d){_0x1e4f8d=_0x1e4f8d||0xcc;return function(_0x48de4f){if(_0x48de4f){return _0x4846f2['sendStatus'](_0x1e4f8d);}return _0x4846f2['status'](_0x1e4f8d)['end']();};}function respondWithResult(_0x110a50,_0x51edfa){_0x51edfa=_0x51edfa||0xc8;return function(_0x16b149){if(_0x16b149){return _0x110a50[_0xc9f7('0x18')](_0x51edfa)[_0xc9f7('0x19')](_0x16b149);}};}function respondWithFilteredResult(_0x5ab9c9,_0x322517){return function(_0x54a26f){if(_0x54a26f){var _0x4b6633=typeof _0x322517[_0xc9f7('0x1a')]==='undefined'&&typeof _0x322517[_0xc9f7('0x1b')]===_0xc9f7('0x1c');var _0x2975be=_0x54a26f['count'];var _0xdd00b9=_0x4b6633?0x0:_0x322517[_0xc9f7('0x1a')];var _0x2a077d=_0x4b6633?_0x54a26f[_0xc9f7('0x1d')]:_0x322517[_0xc9f7('0x1a')]+_0x322517['limit'];var _0x37d63d;if(_0x2a077d>=_0x2975be){_0x2a077d=_0x2975be;_0x37d63d=0xc8;}else{_0x37d63d=0xce;}_0x5ab9c9['status'](_0x37d63d);return _0x5ab9c9[_0xc9f7('0x1e')](_0xc9f7('0x1f'),_0xdd00b9+'-'+_0x2a077d+'/'+_0x2975be)[_0xc9f7('0x19')](_0x54a26f);}return null;};}function patchUpdates(_0x4bd62d){return function(_0x3f7530){try{jsonpatch[_0xc9f7('0x20')](_0x3f7530,_0x4bd62d,!![]);}catch(_0x1c3895){return BPromise[_0xc9f7('0x21')](_0x1c3895);}return _0x3f7530[_0xc9f7('0x22')]();};}function saveUpdates(_0x264d83,_0x426861){return function(_0x2c57b2){if(_0x2c57b2){return _0x2c57b2[_0xc9f7('0x23')](_0x264d83)[_0xc9f7('0x24')](function(_0x3350d0){return _0x3350d0;});}return null;};}function removeEntity(_0x528914,_0x28b888){return function(_0x50ecfa){if(_0x50ecfa){return _0x50ecfa['destroy']()[_0xc9f7('0x24')](function(){_0x528914['status'](0xcc)[_0xc9f7('0x25')]();});}};}function handleEntityNotFound(_0x512dea,_0x4cd81d){return function(_0x554510){if(!_0x554510){_0x512dea[_0xc9f7('0x26')](0x194);}return _0x554510;};}function handleError(_0x4a9eb9,_0x267f8c){_0x267f8c=_0x267f8c||0x1f4;return function(_0x455a44){logger['error'](_0x455a44['stack']);if(_0x455a44['name']){delete _0x455a44['name'];}_0x4a9eb9['status'](_0x267f8c)[_0xc9f7('0x27')](_0x455a44);};}exports[_0xc9f7('0x28')]=function(_0x5a685d,_0x20b9f7){var _0x125705={},_0x45d5ae={},_0x317425={'count':0x0,'rows':[]};var _0x1f0a0f=_[_0xc9f7('0x29')](db[_0xc9f7('0x2a')][_0xc9f7('0x2b')],function(_0x252764){return{'name':_0x252764[_0xc9f7('0x2c')],'type':_0x252764[_0xc9f7('0x2d')][_0xc9f7('0x2e')]};});_0x45d5ae[_0xc9f7('0x2f')]=_['map'](_0x1f0a0f,_0xc9f7('0x30'));_0x45d5ae['query']=_['keys'](_0x5a685d[_0xc9f7('0x31')]);_0x45d5ae[_0xc9f7('0x32')]=_[_0xc9f7('0x33')](_0x45d5ae[_0xc9f7('0x2f')],_0x45d5ae[_0xc9f7('0x31')]);_0x125705[_0xc9f7('0x34')]=_[_0xc9f7('0x33')](_0x45d5ae['model'],qs['fields'](_0x5a685d[_0xc9f7('0x31')][_0xc9f7('0x35')]));_0x125705[_0xc9f7('0x34')]=_0x125705['attributes']['length']?_0x125705[_0xc9f7('0x34')]:_0x45d5ae[_0xc9f7('0x2f')];if(!_0x5a685d['query'][_0xc9f7('0x36')](_0xc9f7('0x37'))){_0x125705[_0xc9f7('0x1b')]=qs[_0xc9f7('0x1b')](_0x5a685d[_0xc9f7('0x31')][_0xc9f7('0x1b')]);_0x125705[_0xc9f7('0x1a')]=qs[_0xc9f7('0x1a')](_0x5a685d[_0xc9f7('0x31')][_0xc9f7('0x1a')]);}_0x125705['order']=qs[_0xc9f7('0x38')](_0x5a685d[_0xc9f7('0x31')][_0xc9f7('0x38')]);_0x125705[_0xc9f7('0x39')]=qs[_0xc9f7('0x32')](_['pick'](_0x5a685d[_0xc9f7('0x31')],_0x45d5ae[_0xc9f7('0x32')]),_0x1f0a0f);if(_0x5a685d['query'][_0xc9f7('0x3a')]){_0x125705[_0xc9f7('0x39')]=_[_0xc9f7('0x3b')](_0x125705[_0xc9f7('0x39')],{'$or':_[_0xc9f7('0x29')](_0x1f0a0f,function(_0x350cea){if(_0x350cea['type']!==_0xc9f7('0x3c')){var _0x5cd283={};_0x5cd283[_0x350cea[_0xc9f7('0x30')]]={'$like':'%'+_0x5a685d[_0xc9f7('0x31')][_0xc9f7('0x3a')]+'%'};return _0x5cd283;}})});}_0x125705=_['merge']({},_0x125705,_0x5a685d[_0xc9f7('0x3d')]);var _0x18e2d1={'where':_0x125705['where']};return db[_0xc9f7('0x2a')][_0xc9f7('0x1d')](_0x18e2d1)['then'](function(_0x440757){_0x317425[_0xc9f7('0x1d')]=_0x440757;if(_0x5a685d[_0xc9f7('0x31')][_0xc9f7('0x3e')]){_0x125705[_0xc9f7('0x3f')]=[{'all':!![]}];}return db[_0xc9f7('0x2a')][_0xc9f7('0x40')](_0x125705);})['then'](function(_0x531bdd){_0x317425[_0xc9f7('0x41')]=_0x531bdd;return _0x317425;})['then'](respondWithFilteredResult(_0x20b9f7,_0x125705))['catch'](handleError(_0x20b9f7,null));};exports['show']=function(_0x531d98,_0x30f110){var _0x799fe9={'raw':!![],'where':{'id':_0x531d98[_0xc9f7('0x42')]['id']}},_0x3fea12={};_0x3fea12['model']=_[_0xc9f7('0x43')](db[_0xc9f7('0x2a')][_0xc9f7('0x2b')]);_0x3fea12[_0xc9f7('0x31')]=_['keys'](_0x531d98[_0xc9f7('0x31')]);_0x3fea12[_0xc9f7('0x32')]=_[_0xc9f7('0x33')](_0x3fea12['model'],_0x3fea12['query']);_0x799fe9[_0xc9f7('0x34')]=_['intersection'](_0x3fea12[_0xc9f7('0x2f')],qs['fields'](_0x531d98[_0xc9f7('0x31')][_0xc9f7('0x35')]));_0x799fe9['attributes']=_0x799fe9[_0xc9f7('0x34')][_0xc9f7('0x44')]?_0x799fe9[_0xc9f7('0x34')]:_0x3fea12['model'];if(_0x531d98[_0xc9f7('0x31')]['includeAll']){_0x799fe9['include']=[{'all':!![]}];}_0x799fe9=_[_0xc9f7('0x3b')]({},_0x799fe9,_0x531d98[_0xc9f7('0x3d')]);return db[_0xc9f7('0x2a')][_0xc9f7('0x45')](_0x799fe9)[_0xc9f7('0x24')](handleEntityNotFound(_0x30f110,null))[_0xc9f7('0x24')](respondWithResult(_0x30f110,null))[_0xc9f7('0x46')](handleError(_0x30f110,null));};exports[_0xc9f7('0x47')]=function(_0x4511df,_0x1cf968){return db['ZohoField']['create'](_0x4511df[_0xc9f7('0x48')],{})[_0xc9f7('0x24')](respondWithResult(_0x1cf968,0xc9))[_0xc9f7('0x46')](handleError(_0x1cf968,null));};exports[_0xc9f7('0x23')]=function(_0x5e4e3b,_0x1f669a){if(_0x5e4e3b[_0xc9f7('0x48')]['id']){delete _0x5e4e3b[_0xc9f7('0x48')]['id'];}return db['ZohoField'][_0xc9f7('0x45')]({'where':{'id':_0x5e4e3b[_0xc9f7('0x42')]['id']}})[_0xc9f7('0x24')](handleEntityNotFound(_0x1f669a,null))[_0xc9f7('0x24')](saveUpdates(_0x5e4e3b[_0xc9f7('0x48')],null))[_0xc9f7('0x24')](respondWithResult(_0x1f669a,null))[_0xc9f7('0x46')](handleError(_0x1f669a,null));};exports[_0xc9f7('0x49')]=function(_0x984fba,_0x46d63a){return db[_0xc9f7('0x2a')][_0xc9f7('0x45')]({'where':{'id':_0x984fba[_0xc9f7('0x42')]['id']}})[_0xc9f7('0x24')](handleEntityNotFound(_0x46d63a,null))[_0xc9f7('0x24')](removeEntity(_0x46d63a,null))[_0xc9f7('0x46')](handleError(_0x46d63a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a53d1a0..0e38612 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 _0x0adf=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x40f53b,_0x2dadbd){var _0x368e4c=function(_0x229103){while(--_0x229103){_0x40f53b['push'](_0x40f53b['shift']());}};_0x368e4c(++_0x2dadbd);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x87dde3,_0x369dfe){_0x87dde3=_0x87dde3-0x0;var _0x57dbb0=_0x0adf[_0x87dde3];return _0x57dbb0;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xf0ad('0xd'),'fields':[_0xf0ad('0xe'),_0xf0ad('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66fa=['rimraf','../../config/environment','define','ZohoField','int_zoho_fields','idField','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1f78cb,_0x58e9f3){var _0x2cf6b8=function(_0x5c753c){while(--_0x5c753c){_0x1f78cb['push'](_0x1f78cb['shift']());}};_0x2cf6b8(++_0x58e9f3);}(_0x66fa,0x117));var _0xa66f=function(_0x3c4ee1,_0x188bbd){_0x3c4ee1=_0x3c4ee1-0x0;var _0x48ebd3=_0x66fa[_0x3c4ee1];return _0x48ebd3;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x2239d3,_0x20a150){return _0x2239d3[_0xa66f('0x9')](_0xa66f('0xa'),attributes,{'tableName':_0xa66f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xa66f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 17eadda..2cf6cf1 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 _0x0b55=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','ZohoField,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x537f7f,_0x274b24){var _0x344f3d=function(_0x559fbd){while(--_0x559fbd){_0x537f7f['push'](_0x537f7f['shift']());}};_0x344f3d(++_0x274b24);}(_0x0b55,0x1e1));var _0x50b5=function(_0x22caf3,_0x508855){_0x22caf3=_0x22caf3-0x0;var _0x4cccc2=_0x0b55[_0x22caf3];return _0x4cccc2;};'use strict';var _=require('lodash');var util=require(_0x50b5('0x0'));var moment=require(_0x50b5('0x1'));var BPromise=require(_0x50b5('0x2'));var rs=require(_0x50b5('0x3'));var fs=require('fs');var Redis=require(_0x50b5('0x4'));var db=require(_0x50b5('0x5'))['db'];var utils=require(_0x50b5('0x6'));var logger=require(_0x50b5('0x7'))(_0x50b5('0x8'));var config=require(_0x50b5('0x9'));var jayson=require(_0x50b5('0xa'));var client=jayson[_0x50b5('0xb')][_0x50b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1492f4,_0x5782e2,_0x27cd08){return new BPromise(function(_0x56599f,_0x6b1cef){return client[_0x50b5('0xd')](_0x1492f4,_0x27cd08)['then'](function(_0x5b91b8){logger[_0x50b5('0xe')]('ZohoField,\x20%s,\x20%s',_0x5782e2,_0x50b5('0xf'));logger[_0x50b5('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x5782e2,_0x50b5('0xf'),JSON[_0x50b5('0x11')](_0x5b91b8));if(_0x5b91b8[_0x50b5('0x12')]){if(_0x5b91b8['error'][_0x50b5('0x13')]===0x1f4){logger[_0x50b5('0x12')](_0x50b5('0x14'),_0x5782e2,_0x5b91b8[_0x50b5('0x12')]['message']);return _0x6b1cef(_0x5b91b8[_0x50b5('0x12')][_0x50b5('0x15')]);}logger['error'](_0x50b5('0x14'),_0x5782e2,_0x5b91b8[_0x50b5('0x12')][_0x50b5('0x15')]);return _0x56599f(_0x5b91b8[_0x50b5('0x12')]['message']);}else{logger[_0x50b5('0xe')](_0x50b5('0x14'),_0x5782e2,_0x50b5('0xf'));_0x56599f(_0x5b91b8['result'][_0x50b5('0x15')]);}})[_0x50b5('0x16')](function(_0x4acc15){logger[_0x50b5('0x12')](_0x50b5('0x14'),_0x5782e2,_0x4acc15);_0x6b1cef(_0x4acc15);});});} \ No newline at end of file +var _0xacb7=['code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20afc3,_0x2f189a){var _0x4cbb43=function(_0x647042){while(--_0x647042){_0x20afc3['push'](_0x20afc3['shift']());}};_0x4cbb43(++_0x2f189a);}(_0xacb7,0xa6));var _0x7acb=function(_0x10db82,_0x465046){_0x10db82=_0x10db82-0x0;var _0x1e84b8=_0xacb7[_0x10db82];return _0x1e84b8;};'use strict';var _=require(_0x7acb('0x0'));var util=require(_0x7acb('0x1'));var moment=require('moment');var BPromise=require(_0x7acb('0x2'));var rs=require(_0x7acb('0x3'));var fs=require('fs');var Redis=require(_0x7acb('0x4'));var db=require(_0x7acb('0x5'))['db'];var utils=require(_0x7acb('0x6'));var logger=require('../../config/logger')(_0x7acb('0x7'));var config=require('../../config/environment');var jayson=require(_0x7acb('0x8'));var client=jayson[_0x7acb('0x9')][_0x7acb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56fb95,_0x126282,_0x290a4e){return new BPromise(function(_0x4c6c3f,_0x2af13a){return client[_0x7acb('0xb')](_0x56fb95,_0x290a4e)[_0x7acb('0xc')](function(_0x225523){logger['info'](_0x7acb('0xd'),_0x126282,_0x7acb('0xe'));logger['debug'](_0x7acb('0xf'),_0x126282,_0x7acb('0xe'),JSON[_0x7acb('0x10')](_0x225523));if(_0x225523[_0x7acb('0x11')]){if(_0x225523[_0x7acb('0x11')][_0x7acb('0x12')]===0x1f4){logger[_0x7acb('0x11')](_0x7acb('0xd'),_0x126282,_0x225523[_0x7acb('0x11')]['message']);return _0x2af13a(_0x225523[_0x7acb('0x11')]['message']);}logger[_0x7acb('0x11')](_0x7acb('0xd'),_0x126282,_0x225523[_0x7acb('0x11')][_0x7acb('0x13')]);return _0x4c6c3f(_0x225523[_0x7acb('0x11')][_0x7acb('0x13')]);}else{logger[_0x7acb('0x14')](_0x7acb('0xd'),_0x126282,_0x7acb('0xe'));_0x4c6c3f(_0x225523[_0x7acb('0x15')]['message']);}})[_0x7acb('0x16')](function(_0x4a95b1){logger[_0x7acb('0x11')]('ZohoField,\x20%s,\x20%s',_0x126282,_0x4a95b1);_0x2af13a(_0x4a95b1);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index ae350f2..4b6d19a 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x37cca8,_0x14827c){var _0x594b79=function(_0x113551){while(--_0x113551){_0x37cca8['push'](_0x37cca8['shift']());}};_0x594b79(++_0x14827c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x41818f,_0x2679ef){var _0x2131e8=function(_0x44cfe4){while(--_0x44cfe4){_0x41818f['push'](_0x41818f['shift']());}};_0x2131e8(++_0x2679ef);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0xcb91[_0x42e4d7];return _0x346cd8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 0847f71..18f551b 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 _0x682f=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x682f,0x1eb));var _0xf682=function(_0x5969b6,_0x2c983b){_0x5969b6=_0x5969b6-0x0;var _0x4155aa=_0x682f[_0x5969b6];return _0x4155aa;};'use strict';var Sequelize=require(_0xf682('0x0'));module[_0xf682('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xf682('0x2')],'allowNull':![],'unique':_0xf682('0x3')},'main':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x4')},'filename':{'type':Sequelize[_0xf682('0x2')]},'path':{'type':Sequelize[_0xf682('0x2')]},'type':{'type':Sequelize[_0xf682('0x2')]},'size':{'type':Sequelize[_0xf682('0x5')]},'active':{'type':Sequelize[_0xf682('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xf682('0x2')]},'state':{'type':Sequelize[_0xf682('0x2')],'unique':_0xf682('0x7')},'description':{'type':Sequelize[_0xf682('0x2')]},'title':{'type':Sequelize[_0xf682('0x2')]},'remoteUri':{'type':Sequelize[_0xf682('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xb18e=['unique_name_and_version','state','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb18e,0x147));var _0xeb18=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0xb18e[_0x4d7f3f];return _0x5d67cc;};'use strict';var Sequelize=require(_0xeb18('0x0'));module[_0xeb18('0x1')]={'name':{'type':Sequelize[_0xeb18('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xeb18('0x2')],'allowNull':![],'unique':_0xeb18('0x3')},'main':{'type':Sequelize[_0xeb18('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xeb18('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xeb18('0x2')]},'logo':{'type':Sequelize[_0xeb18('0x2')]},'state':{'type':Sequelize[_0xeb18('0x2')],'unique':_0xeb18('0x4')},'description':{'type':Sequelize[_0xeb18('0x2')]},'title':{'type':Sequelize[_0xeb18('0x2')]},'remoteUri':{'type':Sequelize[_0xeb18('0x2')]},'link':{'type':Sequelize[_0xeb18('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index e074133..ea03ed8 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 _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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1261,0x144));var _0x1126=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x1261[_0x817d9b];return _0x2752e1;};'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 +var _0xc4aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Integration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 3f560fd..54e6572 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 _0x5669=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','integrations','lodash','util'];(function(_0x542f45,_0x37468a){var _0x38c609=function(_0x44259b){while(--_0x44259b){_0x542f45['push'](_0x542f45['shift']());}};_0x38c609(++_0x37468a);}(_0x5669,0x194));var _0x9566=function(_0xa2ac9,_0xf07f28){_0xa2ac9=_0xa2ac9-0x0;var _0x690e9b=_0x5669[_0xa2ac9];return _0x690e9b;};'use strict';var _=require(_0x9566('0x0'));var util=require(_0x9566('0x1'));var logger=require(_0x9566('0x2'))(_0x9566('0x3'));var moment=require(_0x9566('0x4'));var BPromise=require(_0x9566('0x5'));var rp=require(_0x9566('0x6'));var fs=require('fs');var path=require(_0x9566('0x7'));var rimraf=require(_0x9566('0x8'));var config=require(_0x9566('0x9'));var attributes=require(_0x9566('0xa'));module[_0x9566('0xb')]=function(_0x2e34ba,_0x12b950){return _0x2e34ba[_0x9566('0xc')]('Integration',attributes,{'tableName':_0x9566('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60f9=['bluebird','path','rimraf','../../config/environment','./integration.attributes','define','Integration','lodash','util','../../config/logger','api','moment'];(function(_0x4cc296,_0x13f48c){var _0x4d5aee=function(_0x3c1f5d){while(--_0x3c1f5d){_0x4cc296['push'](_0x4cc296['shift']());}};_0x4d5aee(++_0x13f48c);}(_0x60f9,0x103));var _0x960f=function(_0x4f8791,_0x401832){_0x4f8791=_0x4f8791-0x0;var _0x4ffdc4=_0x60f9[_0x4f8791];return _0x4ffdc4;};'use strict';var _=require(_0x960f('0x0'));var util=require(_0x960f('0x1'));var logger=require(_0x960f('0x2'))(_0x960f('0x3'));var moment=require(_0x960f('0x4'));var BPromise=require(_0x960f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x960f('0x6'));var rimraf=require(_0x960f('0x7'));var config=require(_0x960f('0x8'));var attributes=require(_0x960f('0x9'));module['exports']=function(_0x4e831a,_0x451528){return _0x4e831a[_0x960f('0xa')](_0x960f('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 44384af..d40abef 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5a9aa7,_0x55b38f){var _0x298adf=function(_0x2643d4){while(--_0x2643d4){_0x5a9aa7['push'](_0x5a9aa7['shift']());}};_0x298adf(++_0x55b38f);}(_0xadb5,0xad));var _0x5adb=function(_0x2a46fb,_0x52799d){_0x2a46fb=_0x2a46fb-0x0;var _0x424af6=_0xadb5[_0x2a46fb];return _0x424af6;};'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']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _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(_0x44cd21,_0x27dc22){var _0x34e6b9=function(_0x522daf){while(--_0x522daf){_0x44cd21['push'](_0x44cd21['shift']());}};_0x34e6b9(++_0x27dc22);}(_0x955f,0x1eb));var _0xf955=function(_0x593a2c,_0x325ce5){_0x593a2c=_0x593a2c-0x0;var _0x1072cd=_0x955f[_0x593a2c];return _0x1072cd;};'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 c46a110..3a411ea 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 _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file +var _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2794e1,_0x22b0ff){var _0xe391c9=function(_0x4297d3){while(--_0x4297d3){_0x2794e1['push'](_0x2794e1['shift']());}};_0xe391c9(++_0x22b0ff);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x393333,_0xab5f58){_0x393333=_0x393333-0x0;var _0x1abc4b=_0xc6ac[_0x393333];return _0x1abc4b;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1fe3d45..a2a3d00 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 _0x57d6=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x57d6,0x167));var _0x657d=function(_0x58b6a8,_0x307021){_0x58b6a8=_0x58b6a8-0x0;var _0xc566dc=_0x57d6[_0x58b6a8];return _0xc566dc;};'use strict';var Sequelize=require(_0x657d('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x657d('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x657d('0x1')]},'integrationId':{'type':Sequelize[_0x657d('0x2')]},'contacts':{'type':Sequelize[_0x657d('0x1')]},'uniqueid':{'type':Sequelize[_0x657d('0x1')]},'calleridnum':{'type':Sequelize[_0x657d('0x1')]},'calleridname':{'type':Sequelize[_0x657d('0x1')]},'queue':{'type':Sequelize[_0x657d('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x657d('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x657d('0x2')]},'agentcomplete':{'type':Sequelize[_0x657d('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x657d('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x657d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x657d('0x2')]},'reason':{'type':Sequelize[_0x657d('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x657d('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x657d('0x3')]},'agentdump':{'type':Sequelize[_0x657d('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x657d('0x3')]},'lastevent':{'type':Sequelize[_0x657d('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x657d('0x1')]},'connectedlinenum':{'type':Sequelize[_0x657d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x657d('0x1')]},'accountcode':{'type':Sequelize[_0x657d('0x1')]},'context':{'type':Sequelize[_0x657d('0x1')]},'exten':{'type':Sequelize[_0x657d('0x1')]},'priority':{'type':Sequelize[_0x657d('0x1')]},'destchannel':{'type':Sequelize[_0x657d('0x1')]},'destchannelstate':{'type':Sequelize[_0x657d('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x657d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x657d('0x1')]},'destcalleridname':{'type':Sequelize[_0x657d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x657d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x657d('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x657d('0x1')]},'destexten':{'type':Sequelize[_0x657d('0x1')]},'destpriority':{'type':Sequelize[_0x657d('0x1')]},'destuniqueid':{'type':Sequelize[_0x657d('0x1')]},'messageId':{'type':Sequelize[_0x657d('0x1')]},'inReplyTo':{'type':Sequelize[_0x657d('0x1')]},'subject':{'type':Sequelize[_0x657d('0x1')]},'from':{'type':Sequelize[_0x657d('0x1')]},'to':{'type':Sequelize[_0x657d('0x1')]},'cc':{'type':Sequelize[_0x657d('0x1')]},'attachment':{'type':Sequelize[_0x657d('0x5')]},'html':{'type':Sequelize[_0x657d('0x5')]},'text':{'type':Sequelize[_0x657d('0x5')]},'status':{'type':Sequelize[_0x657d('0x6')](_0x657d('0x7'),_0x657d('0x8'),_0x657d('0x9'),'FAILED')},'url':{'type':Sequelize[_0x657d('0x1')]},'app':{'type':Sequelize[_0x657d('0x1')]},'appdata':{'type':Sequelize[_0x657d('0x1')]},'projectId':{'type':Sequelize[_0x657d('0x2')]}}; \ No newline at end of file +var _0x8000=['STRING','INTEGER','DATE','BOOLEAN','TEXT','RECEIVED','FAILED','exports'];(function(_0x9bd40a,_0x327ce1){var _0x465f96=function(_0x4d2984){while(--_0x4d2984){_0x9bd40a['push'](_0x9bd40a['shift']());}};_0x465f96(++_0x327ce1);}(_0x8000,0xb7));var _0x0800=function(_0x13bff3,_0x1136d8){_0x13bff3=_0x13bff3-0x0;var _0x15b907=_0x8000[_0x13bff3];return _0x15b907;};'use strict';var Sequelize=require('sequelize');module[_0x0800('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x0800('0x1')]},'exitStatus':{'type':Sequelize[_0x0800('0x1')]},'ticketId':{'type':Sequelize[_0x0800('0x1')]},'integrationId':{'type':Sequelize[_0x0800('0x2')]},'contacts':{'type':Sequelize[_0x0800('0x1')]},'uniqueid':{'type':Sequelize[_0x0800('0x1')]},'calleridnum':{'type':Sequelize[_0x0800('0x1')]},'calleridname':{'type':Sequelize[_0x0800('0x1')]},'queue':{'type':Sequelize[_0x0800('0x1')]},'interface':{'type':Sequelize[_0x0800('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0800('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0800('0x3')]},'holdtime':{'type':Sequelize[_0x0800('0x2')]},'agentcomplete':{'type':Sequelize[_0x0800('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0800('0x3')]},'talktime':{'type':Sequelize[_0x0800('0x2')]},'agentacw':{'type':Sequelize[_0x0800('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0800('0x2')]},'reason':{'type':Sequelize[_0x0800('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0800('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0800('0x3')]},'agentdump':{'type':Sequelize[_0x0800('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0800('0x3')]},'lastevent':{'type':Sequelize[_0x0800('0x1')]},'channel':{'type':Sequelize[_0x0800('0x1')]},'channelstate':{'type':Sequelize[_0x0800('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0800('0x1')]},'connectedlinename':{'type':Sequelize[_0x0800('0x1')]},'language':{'type':Sequelize[_0x0800('0x1')]},'accountcode':{'type':Sequelize[_0x0800('0x1')]},'context':{'type':Sequelize[_0x0800('0x1')]},'exten':{'type':Sequelize[_0x0800('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x0800('0x1')]},'destchannelstate':{'type':Sequelize[_0x0800('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0800('0x1')]},'destcalleridname':{'type':Sequelize[_0x0800('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0800('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0800('0x1')]},'destcontext':{'type':Sequelize[_0x0800('0x1')]},'destexten':{'type':Sequelize[_0x0800('0x1')]},'destpriority':{'type':Sequelize[_0x0800('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x0800('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x0800('0x1')]},'to':{'type':Sequelize[_0x0800('0x1')]},'cc':{'type':Sequelize[_0x0800('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x0800('0x5')]},'text':{'type':Sequelize[_0x0800('0x5')]},'status':{'type':Sequelize['ENUM']('SENT','SENDING',_0x0800('0x6'),_0x0800('0x7'))},'url':{'type':Sequelize[_0x0800('0x1')]},'app':{'type':Sequelize[_0x0800('0x1')]},'appdata':{'type':Sequelize[_0x0800('0x1')]},'projectId':{'type':Sequelize[_0x0800('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index fb8e39e..5c6618c 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 _0x30c0=['describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','then','error','stack','name','IntegrationReport','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','length','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update'];(function(_0x5c05ba,_0x2233ad){var _0x45b6de=function(_0x1cf854){while(--_0x1cf854){_0x5c05ba['push'](_0x5c05ba['shift']());}};_0x45b6de(++_0x2233ad);}(_0x30c0,0xca));var _0x030c=function(_0x1917c8,_0x12f95f){_0x1917c8=_0x1917c8-0x0;var _0x51948d=_0x30c0[_0x1917c8];return _0x51948d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x030c('0x0'));var zipdir=require(_0x030c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x030c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x030c('0x3'));var util=require(_0x030c('0x4'));var path=require(_0x030c('0x5'));var sox=require(_0x030c('0x6'));var csv=require('to-csv');var ejs=require(_0x030c('0x7'));var fs=require('fs');var fs_extra=require(_0x030c('0x8'));var _=require(_0x030c('0x9'));var squel=require('squel');var crypto=require(_0x030c('0xa'));var jsforce=require(_0x030c('0xb'));var deskjs=require(_0x030c('0xc'));var toCsv=require(_0x030c('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x030c('0xe'));var authService=require(_0x030c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x030c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x030c('0x11'))('api');var utils=require(_0x030c('0x12'));var config=require(_0x030c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x030c('0x14'))['db'];function respondWithStatusCode(_0x4afdc9,_0x16e417){_0x16e417=_0x16e417||0xcc;return function(_0x3ceb7b){if(_0x3ceb7b){return _0x4afdc9[_0x030c('0x15')](_0x16e417);}return _0x4afdc9['status'](_0x16e417)[_0x030c('0x16')]();};}function respondWithResult(_0x36a359,_0x4f7ab0){_0x4f7ab0=_0x4f7ab0||0xc8;return function(_0x49c103){if(_0x49c103){return _0x36a359['status'](_0x4f7ab0)[_0x030c('0x17')](_0x49c103);}};}function respondWithFilteredResult(_0x3a374d,_0x558c70){return function(_0x3cbe4c){if(_0x3cbe4c){var _0x54e232=typeof _0x558c70[_0x030c('0x18')]===_0x030c('0x19')&&typeof _0x558c70[_0x030c('0x1a')]===_0x030c('0x19');var _0x2bfa02=_0x3cbe4c[_0x030c('0x1b')];var _0x2535b2=_0x54e232?0x0:_0x558c70[_0x030c('0x18')];var _0x204d72=_0x54e232?_0x3cbe4c[_0x030c('0x1b')]:_0x558c70[_0x030c('0x18')]+_0x558c70[_0x030c('0x1a')];var _0x5cc1a5;if(_0x204d72>=_0x2bfa02){_0x204d72=_0x2bfa02;_0x5cc1a5=0xc8;}else{_0x5cc1a5=0xce;}_0x3a374d[_0x030c('0x1c')](_0x5cc1a5);return _0x3a374d[_0x030c('0x1d')]('Content-Range',_0x2535b2+'-'+_0x204d72+'/'+_0x2bfa02)[_0x030c('0x17')](_0x3cbe4c);}return null;};}function patchUpdates(_0x18dbd0){return function(_0x395b51){try{jsonpatch['apply'](_0x395b51,_0x18dbd0,!![]);}catch(_0x131030){return BPromise[_0x030c('0x1e')](_0x131030);}return _0x395b51[_0x030c('0x1f')]();};}function saveUpdates(_0x19c683,_0x285eab){return function(_0x87956e){if(_0x87956e){return _0x87956e['update'](_0x19c683)[_0x030c('0x20')](function(_0x563067){return _0x563067;});}return null;};}function removeEntity(_0x58e96e,_0x6618d0){return function(_0x401631){if(_0x401631){return _0x401631['destroy']()[_0x030c('0x20')](function(){_0x58e96e[_0x030c('0x1c')](0xcc)[_0x030c('0x16')]();});}};}function handleEntityNotFound(_0x1a3126,_0xed6c1d){return function(_0x2686aa){if(!_0x2686aa){_0x1a3126[_0x030c('0x15')](0x194);}return _0x2686aa;};}function handleError(_0x14b2c2,_0x65b903){_0x65b903=_0x65b903||0x1f4;return function(_0x37eba4){logger[_0x030c('0x21')](_0x37eba4[_0x030c('0x22')]);if(_0x37eba4[_0x030c('0x23')]){delete _0x37eba4[_0x030c('0x23')];}_0x14b2c2[_0x030c('0x1c')](_0x65b903)['send'](_0x37eba4);};}exports['index']=function(_0x5e2a68,_0x4090aa){var _0x38ccb5={},_0x4d6017={},_0x2a3c0d={'count':0x0,'rows':[]};var _0x1dd768=_['map'](db[_0x030c('0x24')][_0x030c('0x25')],function(_0x2555bd){return{'name':_0x2555bd['fieldName'],'type':_0x2555bd['type'][_0x030c('0x26')]};});_0x4d6017[_0x030c('0x27')]=_[_0x030c('0x28')](_0x1dd768,'name');_0x4d6017[_0x030c('0x29')]=_[_0x030c('0x2a')](_0x5e2a68[_0x030c('0x29')]);_0x4d6017['filters']=_['intersection'](_0x4d6017['model'],_0x4d6017[_0x030c('0x29')]);_0x38ccb5[_0x030c('0x2b')]=_[_0x030c('0x2c')](_0x4d6017[_0x030c('0x27')],qs['fields'](_0x5e2a68[_0x030c('0x29')][_0x030c('0x2d')]));_0x38ccb5[_0x030c('0x2b')]=_0x38ccb5['attributes'][_0x030c('0x2e')]?_0x38ccb5[_0x030c('0x2b')]:_0x4d6017['model'];if(!_0x5e2a68[_0x030c('0x29')]['hasOwnProperty']('nolimit')){_0x38ccb5[_0x030c('0x1a')]=qs[_0x030c('0x1a')](_0x5e2a68[_0x030c('0x29')]['limit']);_0x38ccb5['offset']=qs[_0x030c('0x18')](_0x5e2a68[_0x030c('0x29')][_0x030c('0x18')]);}_0x38ccb5['order']=qs[_0x030c('0x2f')](_0x5e2a68[_0x030c('0x29')][_0x030c('0x2f')]);_0x38ccb5[_0x030c('0x30')]=qs[_0x030c('0x31')](_[_0x030c('0x32')](_0x5e2a68[_0x030c('0x29')],_0x4d6017['filters']),_0x1dd768);if(_0x5e2a68[_0x030c('0x29')][_0x030c('0x33')]){_0x38ccb5[_0x030c('0x30')]=_[_0x030c('0x34')](_0x38ccb5[_0x030c('0x30')],{'$or':_['map'](_0x1dd768,function(_0x26c6d3){if(_0x26c6d3[_0x030c('0x35')]!==_0x030c('0x36')){var _0x573487={};_0x573487[_0x26c6d3[_0x030c('0x23')]]={'$like':'%'+_0x5e2a68[_0x030c('0x29')][_0x030c('0x33')]+'%'};return _0x573487;}})});}_0x38ccb5=_[_0x030c('0x34')]({},_0x38ccb5,_0x5e2a68[_0x030c('0x37')]);var _0x21348c={'where':_0x38ccb5[_0x030c('0x30')]};return db[_0x030c('0x24')]['count'](_0x21348c)[_0x030c('0x20')](function(_0x309ba3){_0x2a3c0d[_0x030c('0x1b')]=_0x309ba3;if(_0x5e2a68['query'][_0x030c('0x38')]){_0x38ccb5[_0x030c('0x39')]=[{'all':!![]}];}return db[_0x030c('0x24')]['findAll'](_0x38ccb5);})[_0x030c('0x20')](function(_0x2ea7ee){_0x2a3c0d[_0x030c('0x3a')]=_0x2ea7ee;return _0x2a3c0d;})[_0x030c('0x20')](respondWithFilteredResult(_0x4090aa,_0x38ccb5))[_0x030c('0x3b')](handleError(_0x4090aa,null));};exports[_0x030c('0x3c')]=function(_0x59c01e,_0x47a904){var _0x7bd321={'raw':![],'where':{'id':_0x59c01e[_0x030c('0x3d')]['id']}},_0x43c2f7={};_0x43c2f7[_0x030c('0x27')]=_[_0x030c('0x2a')](db[_0x030c('0x24')][_0x030c('0x25')]);_0x43c2f7[_0x030c('0x29')]=_[_0x030c('0x2a')](_0x59c01e[_0x030c('0x29')]);_0x43c2f7[_0x030c('0x31')]=_[_0x030c('0x2c')](_0x43c2f7['model'],_0x43c2f7['query']);_0x7bd321['attributes']=_['intersection'](_0x43c2f7[_0x030c('0x27')],qs[_0x030c('0x2d')](_0x59c01e[_0x030c('0x29')][_0x030c('0x2d')]));_0x7bd321[_0x030c('0x2b')]=_0x7bd321['attributes'][_0x030c('0x2e')]?_0x7bd321[_0x030c('0x2b')]:_0x43c2f7['model'];if(_0x59c01e[_0x030c('0x29')][_0x030c('0x38')]){_0x7bd321[_0x030c('0x39')]=[{'all':!![]}];}_0x7bd321=_[_0x030c('0x34')]({},_0x7bd321,_0x59c01e[_0x030c('0x37')]);return db[_0x030c('0x24')][_0x030c('0x3e')](_0x7bd321)[_0x030c('0x20')](handleEntityNotFound(_0x47a904,null))[_0x030c('0x20')](respondWithResult(_0x47a904,null))[_0x030c('0x3b')](handleError(_0x47a904,null));};exports[_0x030c('0x3f')]=function(_0x59cc47,_0x5e7c8a){return db['IntegrationReport'][_0x030c('0x3f')](_0x59cc47[_0x030c('0x40')],{})[_0x030c('0x20')](respondWithResult(_0x5e7c8a,0xc9))[_0x030c('0x3b')](handleError(_0x5e7c8a,null));};exports[_0x030c('0x41')]=function(_0x2d26ab,_0x454725){if(_0x2d26ab[_0x030c('0x40')]['id']){delete _0x2d26ab['body']['id'];}return db[_0x030c('0x24')][_0x030c('0x3e')]({'where':{'id':_0x2d26ab['params']['id']}})['then'](handleEntityNotFound(_0x454725,null))[_0x030c('0x20')](saveUpdates(_0x2d26ab[_0x030c('0x40')],null))['then'](respondWithResult(_0x454725,null))[_0x030c('0x3b')](handleError(_0x454725,null));};exports['destroy']=function(_0x1edb39,_0x3b635f){return db[_0x030c('0x24')]['find']({'where':{'id':_0x1edb39[_0x030c('0x3d')]['id']}})[_0x030c('0x20')](handleEntityNotFound(_0x3b635f,null))[_0x030c('0x20')](removeEntity(_0x3b635f,null))['catch'](handleError(_0x3b635f,null));};exports['describe']=function(_0x41f348,_0x56f329){return db[_0x030c('0x24')][_0x030c('0x42')]()[_0x030c('0x20')](respondWithResult(_0x56f329,null))[_0x030c('0x3b')](handleError(_0x56f329,null));}; \ No newline at end of file +var _0x03e3=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0xd0bed8,_0x26f099){var _0x25fbda=function(_0x497e03){while(--_0x497e03){_0xd0bed8['push'](_0xd0bed8['shift']());}};_0x25fbda(++_0x26f099);}(_0x03e3,0x1e3));var _0x303e=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x03e3[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x303e('0x0'));var jsonpatch=require(_0x303e('0x1'));var rp=require(_0x303e('0x2'));var moment=require(_0x303e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x303e('0x4'));var util=require(_0x303e('0x5'));var path=require(_0x303e('0x6'));var sox=require(_0x303e('0x7'));var csv=require('to-csv');var ejs=require(_0x303e('0x8'));var fs=require('fs');var fs_extra=require(_0x303e('0x9'));var _=require(_0x303e('0xa'));var squel=require('squel');var crypto=require(_0x303e('0xb'));var jsforce=require(_0x303e('0xc'));var deskjs=require(_0x303e('0xd'));var toCsv=require(_0x303e('0xe'));var querystring=require(_0x303e('0xf'));var Papa=require(_0x303e('0x10'));var Redis=require(_0x303e('0x11'));var authService=require(_0x303e('0x12'));var qs=require(_0x303e('0x13'));var as=require(_0x303e('0x14'));var hardwareService=require(_0x303e('0x15'));var logger=require('../../config/logger')(_0x303e('0x16'));var utils=require('../../config/utils');var config=require(_0x303e('0x17'));var licenseUtil=require(_0x303e('0x18'));var db=require(_0x303e('0x19'))['db'];function respondWithStatusCode(_0x34ff0f,_0x16be71){_0x16be71=_0x16be71||0xcc;return function(_0x69d8b4){if(_0x69d8b4){return _0x34ff0f[_0x303e('0x1a')](_0x16be71);}return _0x34ff0f[_0x303e('0x1b')](_0x16be71)[_0x303e('0x1c')]();};}function respondWithResult(_0x230b65,_0x2e95bd){_0x2e95bd=_0x2e95bd||0xc8;return function(_0x50dfe5){if(_0x50dfe5){return _0x230b65[_0x303e('0x1b')](_0x2e95bd)[_0x303e('0x1d')](_0x50dfe5);}};}function respondWithFilteredResult(_0x5bdf80,_0x28f590){return function(_0x33e91e){if(_0x33e91e){var _0x34060b=typeof _0x28f590['offset']===_0x303e('0x1e')&&typeof _0x28f590[_0x303e('0x1f')]===_0x303e('0x1e');var _0x386eee=_0x33e91e['count'];var _0x296568=_0x34060b?0x0:_0x28f590['offset'];var _0x2e2ab8=_0x34060b?_0x33e91e['count']:_0x28f590[_0x303e('0x20')]+_0x28f590[_0x303e('0x1f')];var _0x4660e9;if(_0x2e2ab8>=_0x386eee){_0x2e2ab8=_0x386eee;_0x4660e9=0xc8;}else{_0x4660e9=0xce;}_0x5bdf80[_0x303e('0x1b')](_0x4660e9);return _0x5bdf80[_0x303e('0x21')](_0x303e('0x22'),_0x296568+'-'+_0x2e2ab8+'/'+_0x386eee)[_0x303e('0x1d')](_0x33e91e);}return null;};}function patchUpdates(_0xf262c4){return function(_0x749443){try{jsonpatch[_0x303e('0x23')](_0x749443,_0xf262c4,!![]);}catch(_0x35914d){return BPromise[_0x303e('0x24')](_0x35914d);}return _0x749443[_0x303e('0x25')]();};}function saveUpdates(_0x35462a,_0x348e27){return function(_0xddc559){if(_0xddc559){return _0xddc559[_0x303e('0x26')](_0x35462a)[_0x303e('0x27')](function(_0x7b1cca){return _0x7b1cca;});}return null;};}function removeEntity(_0x326993,_0x30e067){return function(_0xb0a52b){if(_0xb0a52b){return _0xb0a52b[_0x303e('0x28')]()['then'](function(){_0x326993[_0x303e('0x1b')](0xcc)[_0x303e('0x1c')]();});}};}function handleEntityNotFound(_0x440223,_0x18a2fc){return function(_0x40b6d6){if(!_0x40b6d6){_0x440223[_0x303e('0x1a')](0x194);}return _0x40b6d6;};}function handleError(_0x3c2e74,_0xb42a17){_0xb42a17=_0xb42a17||0x1f4;return function(_0x41a2c7){logger[_0x303e('0x29')](_0x41a2c7[_0x303e('0x2a')]);if(_0x41a2c7[_0x303e('0x2b')]){delete _0x41a2c7[_0x303e('0x2b')];}_0x3c2e74[_0x303e('0x1b')](_0xb42a17)[_0x303e('0x2c')](_0x41a2c7);};}exports[_0x303e('0x2d')]=function(_0x4589a2,_0x2e3fd7){var _0x110c54={},_0x59fc2d={},_0x1ea016={'count':0x0,'rows':[]};var _0x2a1a28=_[_0x303e('0x2e')](db[_0x303e('0x2f')][_0x303e('0x30')],function(_0x374711){return{'name':_0x374711[_0x303e('0x31')],'type':_0x374711[_0x303e('0x32')][_0x303e('0x33')]};});_0x59fc2d[_0x303e('0x34')]=_[_0x303e('0x2e')](_0x2a1a28,'name');_0x59fc2d[_0x303e('0x35')]=_[_0x303e('0x36')](_0x4589a2[_0x303e('0x35')]);_0x59fc2d['filters']=_['intersection'](_0x59fc2d[_0x303e('0x34')],_0x59fc2d['query']);_0x110c54['attributes']=_[_0x303e('0x37')](_0x59fc2d[_0x303e('0x34')],qs[_0x303e('0x38')](_0x4589a2[_0x303e('0x35')]['fields']));_0x110c54[_0x303e('0x39')]=_0x110c54[_0x303e('0x39')][_0x303e('0x3a')]?_0x110c54[_0x303e('0x39')]:_0x59fc2d[_0x303e('0x34')];if(!_0x4589a2[_0x303e('0x35')][_0x303e('0x3b')](_0x303e('0x3c'))){_0x110c54['limit']=qs[_0x303e('0x1f')](_0x4589a2[_0x303e('0x35')][_0x303e('0x1f')]);_0x110c54[_0x303e('0x20')]=qs[_0x303e('0x20')](_0x4589a2[_0x303e('0x35')]['offset']);}_0x110c54[_0x303e('0x3d')]=qs['sort'](_0x4589a2[_0x303e('0x35')][_0x303e('0x3e')]);_0x110c54[_0x303e('0x3f')]=qs[_0x303e('0x40')](_[_0x303e('0x41')](_0x4589a2[_0x303e('0x35')],_0x59fc2d[_0x303e('0x40')]),_0x2a1a28);if(_0x4589a2['query'][_0x303e('0x42')]){_0x110c54[_0x303e('0x3f')]=_[_0x303e('0x43')](_0x110c54[_0x303e('0x3f')],{'$or':_['map'](_0x2a1a28,function(_0x1d7c0e){if(_0x1d7c0e[_0x303e('0x32')]!==_0x303e('0x44')){var _0x536125={};_0x536125[_0x1d7c0e['name']]={'$like':'%'+_0x4589a2['query'][_0x303e('0x42')]+'%'};return _0x536125;}})});}_0x110c54=_[_0x303e('0x43')]({},_0x110c54,_0x4589a2[_0x303e('0x45')]);var _0xdadb20={'where':_0x110c54[_0x303e('0x3f')]};return db['IntegrationReport'][_0x303e('0x46')](_0xdadb20)[_0x303e('0x27')](function(_0x29ba89){_0x1ea016[_0x303e('0x46')]=_0x29ba89;if(_0x4589a2[_0x303e('0x35')][_0x303e('0x47')]){_0x110c54[_0x303e('0x48')]=[{'all':!![]}];}return db[_0x303e('0x2f')][_0x303e('0x49')](_0x110c54);})[_0x303e('0x27')](function(_0x178783){_0x1ea016[_0x303e('0x4a')]=_0x178783;return _0x1ea016;})[_0x303e('0x27')](respondWithFilteredResult(_0x2e3fd7,_0x110c54))[_0x303e('0x4b')](handleError(_0x2e3fd7,null));};exports[_0x303e('0x4c')]=function(_0x40ae9b,_0x385f84){var _0x3c55c4={'raw':![],'where':{'id':_0x40ae9b[_0x303e('0x4d')]['id']}},_0x3f30ae={};_0x3f30ae['model']=_[_0x303e('0x36')](db[_0x303e('0x2f')][_0x303e('0x30')]);_0x3f30ae[_0x303e('0x35')]=_['keys'](_0x40ae9b[_0x303e('0x35')]);_0x3f30ae['filters']=_[_0x303e('0x37')](_0x3f30ae[_0x303e('0x34')],_0x3f30ae[_0x303e('0x35')]);_0x3c55c4[_0x303e('0x39')]=_[_0x303e('0x37')](_0x3f30ae[_0x303e('0x34')],qs[_0x303e('0x38')](_0x40ae9b[_0x303e('0x35')]['fields']));_0x3c55c4['attributes']=_0x3c55c4['attributes'][_0x303e('0x3a')]?_0x3c55c4['attributes']:_0x3f30ae['model'];if(_0x40ae9b[_0x303e('0x35')]['includeAll']){_0x3c55c4[_0x303e('0x48')]=[{'all':!![]}];}_0x3c55c4=_[_0x303e('0x43')]({},_0x3c55c4,_0x40ae9b[_0x303e('0x45')]);return db['IntegrationReport']['find'](_0x3c55c4)[_0x303e('0x27')](handleEntityNotFound(_0x385f84,null))[_0x303e('0x27')](respondWithResult(_0x385f84,null))['catch'](handleError(_0x385f84,null));};exports[_0x303e('0x4e')]=function(_0x5ca5a7,_0x45a24f){return db[_0x303e('0x2f')][_0x303e('0x4e')](_0x5ca5a7[_0x303e('0x4f')],{})[_0x303e('0x27')](respondWithResult(_0x45a24f,0xc9))[_0x303e('0x4b')](handleError(_0x45a24f,null));};exports[_0x303e('0x26')]=function(_0x1499a5,_0xea78dc){if(_0x1499a5['body']['id']){delete _0x1499a5[_0x303e('0x4f')]['id'];}return db[_0x303e('0x2f')]['find']({'where':{'id':_0x1499a5[_0x303e('0x4d')]['id']}})[_0x303e('0x27')](handleEntityNotFound(_0xea78dc,null))[_0x303e('0x27')](saveUpdates(_0x1499a5['body'],null))[_0x303e('0x27')](respondWithResult(_0xea78dc,null))[_0x303e('0x4b')](handleError(_0xea78dc,null));};exports[_0x303e('0x28')]=function(_0x585582,_0x7b670){return db[_0x303e('0x2f')][_0x303e('0x50')]({'where':{'id':_0x585582[_0x303e('0x4d')]['id']}})[_0x303e('0x27')](handleEntityNotFound(_0x7b670,null))[_0x303e('0x27')](removeEntity(_0x7b670,null))['catch'](handleError(_0x7b670,null));};exports[_0x303e('0x51')]=function(_0x59e2be,_0x5138a3){return db[_0x303e('0x2f')][_0x303e('0x51')]()[_0x303e('0x27')](respondWithResult(_0x5138a3,null))[_0x303e('0x4b')](handleError(_0x5138a3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5da9e60..3591537 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 _0xac0a=['moment','bluebird','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','lodash','util','../../config/logger','api'];(function(_0x1e1dd3,_0x15fdcd){var _0x2360f8=function(_0x49f176){while(--_0x49f176){_0x1e1dd3['push'](_0x1e1dd3['shift']());}};_0x2360f8(++_0x15fdcd);}(_0xac0a,0xe2));var _0xaac0=function(_0x2e29b4,_0x57262d){_0x2e29b4=_0x2e29b4-0x0;var _0x4ec6a6=_0xac0a[_0x2e29b4];return _0x4ec6a6;};'use strict';var _=require(_0xaac0('0x0'));var util=require(_0xaac0('0x1'));var logger=require(_0xaac0('0x2'))(_0xaac0('0x3'));var moment=require(_0xaac0('0x4'));var BPromise=require(_0xaac0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac0('0x6'));var config=require(_0xaac0('0x7'));var attributes=require(_0xaac0('0x8'));module['exports']=function(_0x578f5d,_0x2a8a88){return _0x578f5d['define'](_0xaac0('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc23=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x1d7dcc,_0x92024c){var _0x462723=function(_0x26061d){while(--_0x26061d){_0x1d7dcc['push'](_0x1d7dcc['shift']());}};_0x462723(++_0x92024c);}(_0xdc23,0xa6));var _0x3dc2=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0xdc23[_0x28a5ad];return _0x176b8a;};'use strict';var _=require(_0x3dc2('0x0'));var util=require(_0x3dc2('0x1'));var logger=require(_0x3dc2('0x2'))(_0x3dc2('0x3'));var moment=require('moment');var BPromise=require(_0x3dc2('0x4'));var rp=require(_0x3dc2('0x5'));var fs=require('fs');var path=require(_0x3dc2('0x6'));var rimraf=require('rimraf');var config=require(_0x3dc2('0x7'));var attributes=require('./integrationReport.attributes');module[_0x3dc2('0x8')]=function(_0x259150,_0x4cc385){return _0x259150[_0x3dc2('0x9')](_0x3dc2('0xa'),attributes,{'tableName':_0x3dc2('0xb'),'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 fde4cc8..f5c76d3 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3b7d72,_0x1e5c45){_0x3b7d72=_0x3b7d72-0x0;var _0x426cf1=_0xc2c7[_0x3b7d72];return _0x426cf1;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x5af8a2,_0x5a5626){_0x5af8a2=_0x5af8a2-0x0;var _0x1ac902=_0x7a54[_0x5af8a2];return _0x1ac902;};'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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index 00c557f..68f94cf 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 _0x05f1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index','get','isAuthenticated','show','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','exports','multer','util','path'];(function(_0x291af9,_0x2c11bb){var _0x5a0883=function(_0x976959){while(--_0x976959){_0x291af9['push'](_0x291af9['shift']());}};_0x5a0883(++_0x2c11bb);}(_0x05f1,0xfa));var _0x105f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x05f1[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x105f('0x0'));var util=require(_0x105f('0x1'));var path=require(_0x105f('0x2'));var timeout=require(_0x105f('0x3'));var express=require(_0x105f('0x4'));var router=express[_0x105f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x105f('0x6'));var interaction=require(_0x105f('0x7'));var config=require(_0x105f('0x8'));var controller=require(_0x105f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x105f('0xa')]);router[_0x105f('0xb')]('/:id',auth[_0x105f('0xc')](),controller[_0x105f('0xd')]);router[_0x105f('0xb')]('/:id/sub_intervals',auth[_0x105f('0xc')](),controller['getIntervals']);router[_0x105f('0xe')]('/',auth[_0x105f('0xc')](),controller[_0x105f('0xf')]);router[_0x105f('0xe')](_0x105f('0x10'),auth[_0x105f('0xc')](),controller[_0x105f('0x11')]);router[_0x105f('0xe')](_0x105f('0x12'),auth[_0x105f('0xc')](),controller[_0x105f('0x13')]);router['put'](_0x105f('0x14'),auth[_0x105f('0xc')](),controller['update']);router[_0x105f('0x15')](_0x105f('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x105f('0x16')]=router; \ No newline at end of file +var _0xb5dd=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','delete','destroy'];(function(_0x39d90a,_0x112f2f){var _0x4199b7=function(_0x400d50){while(--_0x400d50){_0x39d90a['push'](_0x39d90a['shift']());}};_0x4199b7(++_0x112f2f);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb5dd[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var path=require(_0xdb5d('0x2'));var timeout=require(_0xdb5d('0x3'));var express=require(_0xdb5d('0x4'));var router=express['Router']();var fs_extra=require(_0xdb5d('0x5'));var auth=require(_0xdb5d('0x6'));var interaction=require(_0xdb5d('0x7'));var config=require('../../config/environment');var controller=require(_0xdb5d('0x8'));router[_0xdb5d('0x9')]('/',auth[_0xdb5d('0xa')](),controller[_0xdb5d('0xb')]);router[_0xdb5d('0x9')](_0xdb5d('0xc'),auth[_0xdb5d('0xa')](),controller[_0xdb5d('0xd')]);router[_0xdb5d('0x9')](_0xdb5d('0xe'),auth['isAuthenticated'](),controller[_0xdb5d('0xf')]);router[_0xdb5d('0x10')]('/',auth[_0xdb5d('0xa')](),controller['create']);router['post'](_0xdb5d('0xe'),auth[_0xdb5d('0xa')](),controller[_0xdb5d('0x11')]);router['post']('/:id/sub_intervals/create_many',auth[_0xdb5d('0xa')](),controller[_0xdb5d('0x12')]);router[_0xdb5d('0x13')](_0xdb5d('0xc'),auth[_0xdb5d('0xa')](),controller[_0xdb5d('0x14')]);router[_0xdb5d('0x15')]('/:id',auth[_0xdb5d('0xa')](),controller[_0xdb5d('0x16')]);module[_0xdb5d('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e83de7c..19ed606 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 _0xf7ca=['sequelize','STRING'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xf7ca,0x80));var _0xaf7c=function(_0x5b5846,_0x3939bb){_0x5b5846=_0x5b5846-0x0;var _0x2be879=_0xf7ca[_0x5b5846];return _0x2be879;};'use strict';var Sequelize=require(_0xaf7c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xaf7c('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xdcc2=['STRING','sequelize','exports'];(function(_0x3dece4,_0x225125){var _0x3aff47=function(_0x47d1c5){while(--_0x47d1c5){_0x3dece4['push'](_0x3dece4['shift']());}};_0x3aff47(++_0x225125);}(_0xdcc2,0xac));var _0x2dcc=function(_0x369238,_0x2d6c54){_0x369238=_0x369238-0x0;var _0xfa05ed=_0xdcc2[_0x369238];return _0xfa05ed;};'use strict';var Sequelize=require(_0x2dcc('0x0'));module[_0x2dcc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2dcc('0x2')]},'interval':{'type':Sequelize[_0x2dcc('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 1850521..36981b1 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 _0x052d=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','IntervalId','findOne','order','pick','getIntervals','addIntervals','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','Interval','include','findAll','catch','show','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x052d,0x68));var _0xd052=function(_0x5304a3,_0x22f556){_0x5304a3=_0x5304a3-0x0;var _0x1d591a=_0x052d[_0x5304a3];return _0x1d591a;};'use strict';var emlformat=require(_0xd052('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd052('0x1'));var jsonpatch=require(_0xd052('0x2'));var rp=require(_0xd052('0x3'));var moment=require(_0xd052('0x4'));var BPromise=require(_0xd052('0x5'));var Mustache=require(_0xd052('0x6'));var util=require('util');var path=require(_0xd052('0x7'));var sox=require(_0xd052('0x8'));var csv=require('to-csv');var ejs=require(_0xd052('0x9'));var fs=require('fs');var fs_extra=require(_0xd052('0xa'));var _=require(_0xd052('0xb'));var squel=require(_0xd052('0xc'));var crypto=require('crypto');var jsforce=require(_0xd052('0xd'));var deskjs=require(_0xd052('0xe'));var toCsv=require(_0xd052('0xf'));var querystring=require(_0xd052('0x10'));var Papa=require(_0xd052('0x11'));var Redis=require(_0xd052('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd052('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd052('0x14'));var logger=require(_0xd052('0x15'))(_0xd052('0x16'));var utils=require(_0xd052('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd052('0x18'));var db=require(_0xd052('0x19'))['db'];var extensions=require(_0xd052('0x1a'));function respondWithStatusCode(_0x51d3b0,_0x33977d){_0x33977d=_0x33977d||0xcc;return function(_0x4fed91){if(_0x4fed91){return _0x51d3b0[_0xd052('0x1b')](_0x33977d);}return _0x51d3b0[_0xd052('0x1c')](_0x33977d)[_0xd052('0x1d')]();};}function respondWithResult(_0x51d816,_0x4cc173){_0x4cc173=_0x4cc173||0xc8;return function(_0x44c0a3){if(_0x44c0a3){return _0x51d816[_0xd052('0x1c')](_0x4cc173)[_0xd052('0x1e')](_0x44c0a3);}};}function respondWithFilteredResult(_0x12b419,_0x4a7280){return function(_0x4dde2e){if(_0x4dde2e){var _0x3589b7=typeof _0x4a7280['offset']===_0xd052('0x1f')&&typeof _0x4a7280['limit']===_0xd052('0x1f');var _0x1c14dd=_0x4dde2e[_0xd052('0x20')];var _0x45e823=_0x3589b7?0x0:_0x4a7280[_0xd052('0x21')];var _0x1a9838=_0x3589b7?_0x4dde2e[_0xd052('0x20')]:_0x4a7280['offset']+_0x4a7280[_0xd052('0x22')];var _0x13a312;if(_0x1a9838>=_0x1c14dd){_0x1a9838=_0x1c14dd;_0x13a312=0xc8;}else{_0x13a312=0xce;}_0x12b419[_0xd052('0x1c')](_0x13a312);return _0x12b419['set'](_0xd052('0x23'),_0x45e823+'-'+_0x1a9838+'/'+_0x1c14dd)[_0xd052('0x1e')](_0x4dde2e);}return null;};}function patchUpdates(_0x2a04d6){return function(_0x592e49){try{jsonpatch[_0xd052('0x24')](_0x592e49,_0x2a04d6,!![]);}catch(_0xaf1ac5){return BPromise[_0xd052('0x25')](_0xaf1ac5);}return _0x592e49[_0xd052('0x26')]();};}function saveUpdates(_0x24cc8e,_0x1929c9){return function(_0x55a809){if(_0x55a809){return _0x55a809['update'](_0x24cc8e)[_0xd052('0x27')](function(_0x14a1d5){return _0x14a1d5;});}return null;};}function removeEntity(_0x150faa,_0x375211){return function(_0x5f47dd){if(_0x5f47dd){return _0x5f47dd[_0xd052('0x28')]()[_0xd052('0x27')](function(){var _0x3bc811=_0x5f47dd['get']({'plain':!![]});var _0x2b4d50='Intervals';return db[_0xd052('0x29')]['destroy']({'where':{'type':_0x2b4d50,'resourceId':_0x3bc811['id']}})['then'](function(){return _0x5f47dd;});})[_0xd052('0x27')](function(){_0x150faa[_0xd052('0x1c')](0xcc)[_0xd052('0x1d')]();});}};}function handleEntityNotFound(_0x32d8ad,_0x5f0ab8){return function(_0x5230bc){if(!_0x5230bc){_0x32d8ad[_0xd052('0x1b')](0x194);}return _0x5230bc;};}function handleError(_0x4cf0bd,_0x1efed3){_0x1efed3=_0x1efed3||0x1f4;return function(_0x36c650){logger[_0xd052('0x2a')](_0x36c650[_0xd052('0x2b')]);if(_0x36c650['name']){delete _0x36c650[_0xd052('0x2c')];}_0x4cf0bd[_0xd052('0x1c')](_0x1efed3)['send'](_0x36c650);};}exports[_0xd052('0x2d')]=function(_0x151c22,_0x4be405){var _0x1d95c7={},_0xd8224c={},_0x1dba09={'count':0x0,'rows':[]};var _0xf2f66e=_[_0xd052('0x2e')](db['Interval'][_0xd052('0x2f')],function(_0x3b4ee2){return{'name':_0x3b4ee2['fieldName'],'type':_0x3b4ee2[_0xd052('0x30')]['key']};});_0xd8224c[_0xd052('0x31')]=_['map'](_0xf2f66e,_0xd052('0x2c'));_0xd8224c['query']=_[_0xd052('0x32')](_0x151c22[_0xd052('0x33')]);_0xd8224c[_0xd052('0x34')]=_[_0xd052('0x35')](_0xd8224c[_0xd052('0x31')],_0xd8224c[_0xd052('0x33')]);_0x1d95c7[_0xd052('0x36')]=_[_0xd052('0x35')](_0xd8224c[_0xd052('0x31')],qs[_0xd052('0x37')](_0x151c22[_0xd052('0x33')][_0xd052('0x37')]));_0x1d95c7['attributes']=_0x1d95c7[_0xd052('0x36')][_0xd052('0x38')]?_0x1d95c7[_0xd052('0x36')]:_0xd8224c[_0xd052('0x31')];if(!_0x151c22[_0xd052('0x33')]['hasOwnProperty'](_0xd052('0x39'))){_0x1d95c7[_0xd052('0x22')]=qs[_0xd052('0x22')](_0x151c22[_0xd052('0x33')][_0xd052('0x22')]);_0x1d95c7['offset']=qs[_0xd052('0x21')](_0x151c22[_0xd052('0x33')][_0xd052('0x21')]);}_0x1d95c7['order']=qs[_0xd052('0x3a')](_0x151c22['query']['sort']);_0x1d95c7[_0xd052('0x3b')]=qs[_0xd052('0x34')](_['pick'](_0x151c22['query'],_0xd8224c[_0xd052('0x34')]),_0xf2f66e);if(_0x151c22[_0xd052('0x33')][_0xd052('0x3c')]){_0x1d95c7[_0xd052('0x3b')]=_[_0xd052('0x3d')](_0x1d95c7[_0xd052('0x3b')],{'$or':_['map'](_0xf2f66e,function(_0x5770ef){if(_0x5770ef['type']!=='VIRTUAL'){var _0xda7fc={};_0xda7fc[_0x5770ef[_0xd052('0x2c')]]={'$like':'%'+_0x151c22['query'][_0xd052('0x3c')]+'%'};return _0xda7fc;}})});}_0x1d95c7=_['merge']({},_0x1d95c7,_0x151c22[_0xd052('0x3e')]);var _0xfa831b={'where':_0x1d95c7[_0xd052('0x3b')]};return db[_0xd052('0x3f')][_0xd052('0x20')](_0xfa831b)[_0xd052('0x27')](function(_0x559fe1){_0x1dba09[_0xd052('0x20')]=_0x559fe1;if(_0x151c22['query']['includeAll']){_0x1d95c7[_0xd052('0x40')]=[{'all':!![]}];}return db[_0xd052('0x3f')][_0xd052('0x41')](_0x1d95c7);})['then'](function(_0x5e3105){_0x1dba09['rows']=_0x5e3105;return _0x1dba09;})[_0xd052('0x27')](respondWithFilteredResult(_0x4be405,_0x1d95c7))[_0xd052('0x42')](handleError(_0x4be405,null));};exports[_0xd052('0x43')]=function(_0x656bcf,_0x30086d){var _0x5211a4={'raw':!![],'where':{'id':_0x656bcf[_0xd052('0x44')]['id']}},_0x3576d8={};_0x3576d8[_0xd052('0x31')]=_['keys'](db[_0xd052('0x3f')][_0xd052('0x2f')]);_0x3576d8[_0xd052('0x33')]=_[_0xd052('0x32')](_0x656bcf['query']);_0x3576d8[_0xd052('0x34')]=_[_0xd052('0x35')](_0x3576d8[_0xd052('0x31')],_0x3576d8[_0xd052('0x33')]);_0x5211a4['attributes']=_[_0xd052('0x35')](_0x3576d8[_0xd052('0x31')],qs[_0xd052('0x37')](_0x656bcf[_0xd052('0x33')][_0xd052('0x37')]));_0x5211a4[_0xd052('0x36')]=_0x5211a4['attributes'][_0xd052('0x38')]?_0x5211a4[_0xd052('0x36')]:_0x3576d8[_0xd052('0x31')];if(_0x656bcf['query'][_0xd052('0x45')]){_0x5211a4[_0xd052('0x40')]=[{'all':!![]}];}_0x5211a4=_[_0xd052('0x3d')]({},_0x5211a4,_0x656bcf[_0xd052('0x3e')]);return db['Interval'][_0xd052('0x46')](_0x5211a4)[_0xd052('0x27')](handleEntityNotFound(_0x30086d,null))['then'](respondWithResult(_0x30086d,null))[_0xd052('0x42')](handleError(_0x30086d,null));};exports[_0xd052('0x47')]=function(_0x2bfc7b,_0x5a29da){return db['Interval'][_0xd052('0x47')](_0x2bfc7b['body'],{})[_0xd052('0x27')](function(_0x44f923){var _0x231174=_0x2bfc7b[_0xd052('0x48')][_0xd052('0x49')]({'plain':!![]});if(!_0x231174)throw new Error(_0xd052('0x4a'));if(_0x231174[_0xd052('0x4b')]===_0xd052('0x48')){var _0x250da8=_0x44f923[_0xd052('0x49')]({'plain':!![]});var _0x2ac695=_0xd052('0x4c');return db[_0xd052('0x4d')][_0xd052('0x46')]({'where':{'name':_0x2ac695,'userProfileId':_0x231174[_0xd052('0x4e')]},'raw':!![]})[_0xd052('0x27')](function(_0x389648){if(_0x389648&&_0x389648[_0xd052('0x4f')]===0x0){return db[_0xd052('0x29')][_0xd052('0x47')]({'name':_0x250da8[_0xd052('0x2c')],'resourceId':_0x250da8['id'],'type':_0x389648[_0xd052('0x2c')],'sectionId':_0x389648['id']},{})[_0xd052('0x27')](function(){return _0x44f923;});}else{return _0x44f923;}})[_0xd052('0x42')](function(_0x342454){logger['error'](_0xd052('0x50'),_0x342454);throw _0x342454;});}return _0x44f923;})[_0xd052('0x27')](respondWithResult(_0x5a29da,0xc9))[_0xd052('0x42')](handleError(_0x5a29da,null));};exports[_0xd052('0x51')]=function(_0x1dc331,_0x2930af){if(_0x1dc331[_0xd052('0x52')]['id']){delete _0x1dc331[_0xd052('0x52')]['id'];}return db[_0xd052('0x3f')][_0xd052('0x46')]({'where':{'id':_0x1dc331[_0xd052('0x44')]['id']}})['then'](handleEntityNotFound(_0x2930af,null))[_0xd052('0x27')](saveUpdates(_0x1dc331[_0xd052('0x52')],null))['then'](respondWithResult(_0x2930af,null))['catch'](handleError(_0x2930af,null));};exports[_0xd052('0x28')]=function(_0x174545,_0x3365d2){return db['Interval']['find']({'where':{'id':_0x174545[_0xd052('0x44')]['id']}})[_0xd052('0x27')](handleEntityNotFound(_0x3365d2,null))[_0xd052('0x27')](removeEntity(_0x3365d2,null))[_0xd052('0x42')](handleError(_0x3365d2,null));};exports['addInterval']=function(_0x4bea3a,_0x1d72d2,_0x4d5073){if(_0x4bea3a[_0xd052('0x52')]['id']){delete _0x4bea3a[_0xd052('0x52')]['id'];}return db[_0xd052('0x3f')][_0xd052('0x46')]({'where':{'id':_0x4bea3a[_0xd052('0x44')]['id']}})[_0xd052('0x27')](handleEntityNotFound(_0x1d72d2,null))[_0xd052('0x27')](function(_0x16b987){if(_0x16b987){_0x4bea3a[_0xd052('0x52')][_0xd052('0x53')]=_0x16b987['id'];return db[_0xd052('0x3f')][_0xd052('0x47')](_0x4bea3a[_0xd052('0x52')]);}})[_0xd052('0x27')](respondWithResult(_0x1d72d2,null))[_0xd052('0x42')](handleError(_0x1d72d2,null));};exports['getIntervals']=function(_0x2daa9f,_0x4181ce,_0x1d0f12){var _0x5b3ebe={};var _0x240b2a={};var _0x13d06e;var _0x3b2271;return db[_0xd052('0x3f')][_0xd052('0x54')]({'where':{'id':_0x2daa9f['params']['id']}})['then'](handleEntityNotFound(_0x4181ce,null))[_0xd052('0x27')](function(_0x592828){if(_0x592828){_0x13d06e=_0x592828;_0x240b2a[_0xd052('0x31')]=_[_0xd052('0x32')](db['Interval'][_0xd052('0x2f')]);_0x240b2a['query']=_['keys'](_0x2daa9f['query']);_0x240b2a[_0xd052('0x34')]=_[_0xd052('0x35')](_0x240b2a[_0xd052('0x31')],_0x240b2a['query']);_0x5b3ebe[_0xd052('0x36')]=_[_0xd052('0x35')](_0x240b2a['model'],qs[_0xd052('0x37')](_0x2daa9f[_0xd052('0x33')]['fields']));_0x5b3ebe[_0xd052('0x36')]=_0x5b3ebe['attributes'][_0xd052('0x38')]?_0x5b3ebe['attributes']:_0x240b2a['model'];_0x5b3ebe[_0xd052('0x55')]=qs[_0xd052('0x3a')](_0x2daa9f[_0xd052('0x33')][_0xd052('0x3a')]);_0x5b3ebe[_0xd052('0x3b')]=qs[_0xd052('0x34')](_[_0xd052('0x56')](_0x2daa9f[_0xd052('0x33')],_0x240b2a[_0xd052('0x34')]));if(_0x2daa9f[_0xd052('0x33')][_0xd052('0x3c')]){_0x5b3ebe[_0xd052('0x3b')]=_[_0xd052('0x3d')](_0x5b3ebe[_0xd052('0x3b')],{'$or':_['map'](_0x5b3ebe['attributes'],function(_0x18eb1b){var _0x144f95={};_0x144f95[_0x18eb1b]={'$like':'%'+_0x2daa9f[_0xd052('0x33')][_0xd052('0x3c')]+'%'};return _0x144f95;})});}_0x5b3ebe=_['merge']({},_0x5b3ebe,_0x2daa9f[_0xd052('0x3e')]);return _0x13d06e[_0xd052('0x57')](_0x5b3ebe);}})[_0xd052('0x27')](function(_0x3d1518){if(_0x3d1518){_0x3b2271=_0x3d1518['length'];if(!_0x2daa9f[_0xd052('0x33')]['hasOwnProperty'](_0xd052('0x39'))){_0x5b3ebe[_0xd052('0x22')]=qs['limit'](_0x2daa9f[_0xd052('0x33')]['limit']);_0x5b3ebe[_0xd052('0x21')]=qs[_0xd052('0x21')](_0x2daa9f['query'][_0xd052('0x21')]);}return _0x13d06e[_0xd052('0x57')](_0x5b3ebe);}})['then'](function(_0x34b1ef){if(_0x34b1ef){return _0x34b1ef?{'count':_0x3b2271,'rows':_0x34b1ef}:null;}})[_0xd052('0x27')](respondWithResult(_0x4181ce,null))['catch'](handleError(_0x4181ce,null));};exports[_0xd052('0x58')]=function(_0x3ec354,_0x3e0f88,_0x51e09a){return db[_0xd052('0x3f')][_0xd052('0x54')]({'where':{'id':_0x3ec354['params']['id']}})['then'](handleEntityNotFound(_0x3e0f88,null))[_0xd052('0x27')](function(_0x36d7a0){if(_0x36d7a0){return db['sequelize'][_0xd052('0x59')](function(_0x5a8884){return db[_0xd052('0x3f')][_0xd052('0x28')]({'where':{'IntervalId':_0x3ec354[_0xd052('0x44')]['id']},'transaction':_0x5a8884})[_0xd052('0x27')](function(_0xecfb5f){var _0x3b9a7f=_[_0xd052('0x2e')](_0x3ec354[_0xd052('0x52')],function(_0x5c374c){delete _0x5c374c['id'];_0x5c374c[_0xd052('0x53')]=_0x3ec354[_0xd052('0x44')]['id'];return _0x5c374c;});return db[_0xd052('0x3f')][_0xd052('0x5a')](_0x3b9a7f,{'transaction':_0x5a8884});});})[_0xd052('0x27')](function(){return db[_0xd052('0x3f')][_0xd052('0x41')]({'where':{'IntervalId':_0x3ec354[_0xd052('0x44')]['id']}});});}})[_0xd052('0x27')](respondWithResult(_0x3e0f88,null))['catch'](handleError(_0x3e0f88,null));}; \ No newline at end of file +var _0x62a7=['sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','Interval','fieldName','type','key','model','map','query','keys','filters','attributes','fields','nolimit','order','pick','where','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','rawAttributes','length','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addInterval','IntervalId','create','getIntervals','findOne','intersection','sort','hasOwnProperty','addIntervals','bulkCreate','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite'];(function(_0x2d8e83,_0x39f41a){var _0x3d81f5=function(_0x228998){while(--_0x228998){_0x2d8e83['push'](_0x2d8e83['shift']());}};_0x3d81f5(++_0x39f41a);}(_0x62a7,0x150));var _0x762a=function(_0x31ce3d,_0x581047){_0x31ce3d=_0x31ce3d-0x0;var _0x203d95=_0x62a7[_0x31ce3d];return _0x203d95;};'use strict';var emlformat=require(_0x762a('0x0'));var rimraf=require(_0x762a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x762a('0x2'));var moment=require(_0x762a('0x3'));var BPromise=require(_0x762a('0x4'));var Mustache=require(_0x762a('0x5'));var util=require(_0x762a('0x6'));var path=require('path');var sox=require(_0x762a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x762a('0x8'));var _=require(_0x762a('0x9'));var squel=require(_0x762a('0xa'));var crypto=require('crypto');var jsforce=require(_0x762a('0xb'));var deskjs=require(_0x762a('0xc'));var toCsv=require(_0x762a('0xd'));var querystring=require(_0x762a('0xe'));var Papa=require(_0x762a('0xf'));var Redis=require(_0x762a('0x10'));var authService=require(_0x762a('0x11'));var qs=require(_0x762a('0x12'));var as=require(_0x762a('0x13'));var hardwareService=require(_0x762a('0x14'));var logger=require(_0x762a('0x15'))(_0x762a('0x16'));var utils=require(_0x762a('0x17'));var config=require(_0x762a('0x18'));var licenseUtil=require(_0x762a('0x19'));var db=require(_0x762a('0x1a'))['db'];var extensions=require(_0x762a('0x1b'));function respondWithStatusCode(_0x1c6871,_0x434416){_0x434416=_0x434416||0xcc;return function(_0x1ce50e){if(_0x1ce50e){return _0x1c6871[_0x762a('0x1c')](_0x434416);}return _0x1c6871[_0x762a('0x1d')](_0x434416)[_0x762a('0x1e')]();};}function respondWithResult(_0x31e1b9,_0x1a11be){_0x1a11be=_0x1a11be||0xc8;return function(_0x5cdc74){if(_0x5cdc74){return _0x31e1b9[_0x762a('0x1d')](_0x1a11be)['json'](_0x5cdc74);}};}function respondWithFilteredResult(_0x4018ef,_0x1833ba){return function(_0x374774){if(_0x374774){var _0x46dd03=typeof _0x1833ba['offset']===_0x762a('0x1f')&&typeof _0x1833ba[_0x762a('0x20')]==='undefined';var _0x35318f=_0x374774['count'];var _0x3e2dfc=_0x46dd03?0x0:_0x1833ba['offset'];var _0x41dfa1=_0x46dd03?_0x374774[_0x762a('0x21')]:_0x1833ba[_0x762a('0x22')]+_0x1833ba[_0x762a('0x20')];var _0x42102f;if(_0x41dfa1>=_0x35318f){_0x41dfa1=_0x35318f;_0x42102f=0xc8;}else{_0x42102f=0xce;}_0x4018ef['status'](_0x42102f);return _0x4018ef[_0x762a('0x23')](_0x762a('0x24'),_0x3e2dfc+'-'+_0x41dfa1+'/'+_0x35318f)[_0x762a('0x25')](_0x374774);}return null;};}function patchUpdates(_0x4bf5c5){return function(_0xb3b7fa){try{jsonpatch['apply'](_0xb3b7fa,_0x4bf5c5,!![]);}catch(_0x1ec053){return BPromise[_0x762a('0x26')](_0x1ec053);}return _0xb3b7fa['save']();};}function saveUpdates(_0x5be268,_0xe0ad85){return function(_0x52dc9a){if(_0x52dc9a){return _0x52dc9a['update'](_0x5be268)[_0x762a('0x27')](function(_0x1aca00){return _0x1aca00;});}return null;};}function removeEntity(_0x223724,_0x2e156d){return function(_0x3ec7da){if(_0x3ec7da){return _0x3ec7da[_0x762a('0x28')]()[_0x762a('0x27')](function(){var _0x5c0dfd=_0x3ec7da[_0x762a('0x29')]({'plain':!![]});var _0x270172=_0x762a('0x2a');return db[_0x762a('0x2b')]['destroy']({'where':{'type':_0x270172,'resourceId':_0x5c0dfd['id']}})[_0x762a('0x27')](function(){return _0x3ec7da;});})[_0x762a('0x27')](function(){_0x223724[_0x762a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54b904,_0x5a2a1a){return function(_0x4bbbec){if(!_0x4bbbec){_0x54b904['sendStatus'](0x194);}return _0x4bbbec;};}function handleError(_0x434003,_0x4bfc20){_0x4bfc20=_0x4bfc20||0x1f4;return function(_0x2b7d25){logger[_0x762a('0x2c')](_0x2b7d25[_0x762a('0x2d')]);if(_0x2b7d25[_0x762a('0x2e')]){delete _0x2b7d25[_0x762a('0x2e')];}_0x434003[_0x762a('0x1d')](_0x4bfc20)[_0x762a('0x2f')](_0x2b7d25);};}exports['index']=function(_0x5040a4,_0x34e318){var _0x528c5f={},_0x5adad0={},_0xf49a75={'count':0x0,'rows':[]};var _0x397af5=_['map'](db[_0x762a('0x30')]['rawAttributes'],function(_0x91ffe3){return{'name':_0x91ffe3[_0x762a('0x31')],'type':_0x91ffe3[_0x762a('0x32')][_0x762a('0x33')]};});_0x5adad0[_0x762a('0x34')]=_[_0x762a('0x35')](_0x397af5,'name');_0x5adad0[_0x762a('0x36')]=_[_0x762a('0x37')](_0x5040a4[_0x762a('0x36')]);_0x5adad0[_0x762a('0x38')]=_['intersection'](_0x5adad0[_0x762a('0x34')],_0x5adad0[_0x762a('0x36')]);_0x528c5f[_0x762a('0x39')]=_['intersection'](_0x5adad0['model'],qs[_0x762a('0x3a')](_0x5040a4['query'][_0x762a('0x3a')]));_0x528c5f[_0x762a('0x39')]=_0x528c5f[_0x762a('0x39')]['length']?_0x528c5f[_0x762a('0x39')]:_0x5adad0['model'];if(!_0x5040a4[_0x762a('0x36')]['hasOwnProperty'](_0x762a('0x3b'))){_0x528c5f[_0x762a('0x20')]=qs[_0x762a('0x20')](_0x5040a4['query'][_0x762a('0x20')]);_0x528c5f[_0x762a('0x22')]=qs[_0x762a('0x22')](_0x5040a4[_0x762a('0x36')]['offset']);}_0x528c5f[_0x762a('0x3c')]=qs['sort'](_0x5040a4['query']['sort']);_0x528c5f['where']=qs[_0x762a('0x38')](_[_0x762a('0x3d')](_0x5040a4['query'],_0x5adad0[_0x762a('0x38')]),_0x397af5);if(_0x5040a4[_0x762a('0x36')]['filter']){_0x528c5f[_0x762a('0x3e')]=_['merge'](_0x528c5f[_0x762a('0x3e')],{'$or':_[_0x762a('0x35')](_0x397af5,function(_0x3ce391){if(_0x3ce391[_0x762a('0x32')]!==_0x762a('0x3f')){var _0x34d0e4={};_0x34d0e4[_0x3ce391[_0x762a('0x2e')]]={'$like':'%'+_0x5040a4[_0x762a('0x36')][_0x762a('0x40')]+'%'};return _0x34d0e4;}})});}_0x528c5f=_[_0x762a('0x41')]({},_0x528c5f,_0x5040a4['options']);var _0x535e54={'where':_0x528c5f[_0x762a('0x3e')]};return db[_0x762a('0x30')]['count'](_0x535e54)[_0x762a('0x27')](function(_0x266df6){_0xf49a75[_0x762a('0x21')]=_0x266df6;if(_0x5040a4['query'][_0x762a('0x42')]){_0x528c5f['include']=[{'all':!![]}];}return db[_0x762a('0x30')][_0x762a('0x43')](_0x528c5f);})['then'](function(_0x2ee989){_0xf49a75[_0x762a('0x44')]=_0x2ee989;return _0xf49a75;})[_0x762a('0x27')](respondWithFilteredResult(_0x34e318,_0x528c5f))['catch'](handleError(_0x34e318,null));};exports[_0x762a('0x45')]=function(_0x31944a,_0x46839f){var _0x3002e4={'raw':!![],'where':{'id':_0x31944a[_0x762a('0x46')]['id']}},_0xe8a959={};_0xe8a959['model']=_['keys'](db[_0x762a('0x30')][_0x762a('0x47')]);_0xe8a959[_0x762a('0x36')]=_[_0x762a('0x37')](_0x31944a[_0x762a('0x36')]);_0xe8a959['filters']=_['intersection'](_0xe8a959[_0x762a('0x34')],_0xe8a959[_0x762a('0x36')]);_0x3002e4[_0x762a('0x39')]=_['intersection'](_0xe8a959[_0x762a('0x34')],qs[_0x762a('0x3a')](_0x31944a[_0x762a('0x36')]['fields']));_0x3002e4[_0x762a('0x39')]=_0x3002e4['attributes'][_0x762a('0x48')]?_0x3002e4[_0x762a('0x39')]:_0xe8a959[_0x762a('0x34')];if(_0x31944a[_0x762a('0x36')][_0x762a('0x42')]){_0x3002e4['include']=[{'all':!![]}];}_0x3002e4=_['merge']({},_0x3002e4,_0x31944a['options']);return db[_0x762a('0x30')][_0x762a('0x49')](_0x3002e4)['then'](handleEntityNotFound(_0x46839f,null))[_0x762a('0x27')](respondWithResult(_0x46839f,null))[_0x762a('0x4a')](handleError(_0x46839f,null));};exports['create']=function(_0x30d847,_0x36a929){return db['Interval']['create'](_0x30d847[_0x762a('0x4b')],{})['then'](function(_0x4c7b8f){var _0x46778d=_0x30d847[_0x762a('0x4c')]['get']({'plain':!![]});if(!_0x46778d)throw new Error(_0x762a('0x4d'));if(_0x46778d['role']==='user'){var _0x19885e=_0x4c7b8f[_0x762a('0x29')]({'plain':!![]});var _0xed4371=_0x762a('0x2a');return db[_0x762a('0x4e')][_0x762a('0x49')]({'where':{'name':_0xed4371,'userProfileId':_0x46778d[_0x762a('0x4f')]},'raw':!![]})['then'](function(_0x2042d3){if(_0x2042d3&&_0x2042d3[_0x762a('0x50')]===0x0){return db[_0x762a('0x2b')]['create']({'name':_0x19885e['name'],'resourceId':_0x19885e['id'],'type':_0x2042d3[_0x762a('0x2e')],'sectionId':_0x2042d3['id']},{})['then'](function(){return _0x4c7b8f;});}else{return _0x4c7b8f;}})['catch'](function(_0x5d56e8){logger[_0x762a('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d56e8);throw _0x5d56e8;});}return _0x4c7b8f;})[_0x762a('0x27')](respondWithResult(_0x36a929,0xc9))['catch'](handleError(_0x36a929,null));};exports['update']=function(_0xac1a3c,_0x5f48b5){if(_0xac1a3c['body']['id']){delete _0xac1a3c['body']['id'];}return db[_0x762a('0x30')][_0x762a('0x49')]({'where':{'id':_0xac1a3c[_0x762a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f48b5,null))['then'](saveUpdates(_0xac1a3c[_0x762a('0x4b')],null))[_0x762a('0x27')](respondWithResult(_0x5f48b5,null))[_0x762a('0x4a')](handleError(_0x5f48b5,null));};exports[_0x762a('0x28')]=function(_0x176e0b,_0x26b8fc){return db['Interval']['find']({'where':{'id':_0x176e0b[_0x762a('0x46')]['id']}})[_0x762a('0x27')](handleEntityNotFound(_0x26b8fc,null))[_0x762a('0x27')](removeEntity(_0x26b8fc,null))['catch'](handleError(_0x26b8fc,null));};exports[_0x762a('0x51')]=function(_0x22fdd9,_0x18aaf4,_0x473bca){if(_0x22fdd9[_0x762a('0x4b')]['id']){delete _0x22fdd9[_0x762a('0x4b')]['id'];}return db['Interval'][_0x762a('0x49')]({'where':{'id':_0x22fdd9[_0x762a('0x46')]['id']}})[_0x762a('0x27')](handleEntityNotFound(_0x18aaf4,null))['then'](function(_0x42013a){if(_0x42013a){_0x22fdd9[_0x762a('0x4b')][_0x762a('0x52')]=_0x42013a['id'];return db[_0x762a('0x30')][_0x762a('0x53')](_0x22fdd9['body']);}})['then'](respondWithResult(_0x18aaf4,null))['catch'](handleError(_0x18aaf4,null));};exports[_0x762a('0x54')]=function(_0x2d6404,_0x31de94,_0x4089a4){var _0x392bd7={};var _0x9219fe={};var _0x5f3d37;var _0xb50f16;return db[_0x762a('0x30')][_0x762a('0x55')]({'where':{'id':_0x2d6404[_0x762a('0x46')]['id']}})['then'](handleEntityNotFound(_0x31de94,null))['then'](function(_0x4469a9){if(_0x4469a9){_0x5f3d37=_0x4469a9;_0x9219fe[_0x762a('0x34')]=_['keys'](db[_0x762a('0x30')][_0x762a('0x47')]);_0x9219fe[_0x762a('0x36')]=_[_0x762a('0x37')](_0x2d6404['query']);_0x9219fe[_0x762a('0x38')]=_[_0x762a('0x56')](_0x9219fe[_0x762a('0x34')],_0x9219fe[_0x762a('0x36')]);_0x392bd7[_0x762a('0x39')]=_[_0x762a('0x56')](_0x9219fe[_0x762a('0x34')],qs[_0x762a('0x3a')](_0x2d6404['query'][_0x762a('0x3a')]));_0x392bd7[_0x762a('0x39')]=_0x392bd7['attributes'][_0x762a('0x48')]?_0x392bd7[_0x762a('0x39')]:_0x9219fe[_0x762a('0x34')];_0x392bd7[_0x762a('0x3c')]=qs['sort'](_0x2d6404['query'][_0x762a('0x57')]);_0x392bd7[_0x762a('0x3e')]=qs[_0x762a('0x38')](_['pick'](_0x2d6404[_0x762a('0x36')],_0x9219fe['filters']));if(_0x2d6404['query'][_0x762a('0x40')]){_0x392bd7[_0x762a('0x3e')]=_['merge'](_0x392bd7[_0x762a('0x3e')],{'$or':_[_0x762a('0x35')](_0x392bd7[_0x762a('0x39')],function(_0x6a820c){var _0x3f2565={};_0x3f2565[_0x6a820c]={'$like':'%'+_0x2d6404['query']['filter']+'%'};return _0x3f2565;})});}_0x392bd7=_[_0x762a('0x41')]({},_0x392bd7,_0x2d6404['options']);return _0x5f3d37[_0x762a('0x54')](_0x392bd7);}})[_0x762a('0x27')](function(_0x407224){if(_0x407224){_0xb50f16=_0x407224[_0x762a('0x48')];if(!_0x2d6404[_0x762a('0x36')][_0x762a('0x58')]('nolimit')){_0x392bd7[_0x762a('0x20')]=qs[_0x762a('0x20')](_0x2d6404[_0x762a('0x36')][_0x762a('0x20')]);_0x392bd7[_0x762a('0x22')]=qs[_0x762a('0x22')](_0x2d6404[_0x762a('0x36')]['offset']);}return _0x5f3d37[_0x762a('0x54')](_0x392bd7);}})[_0x762a('0x27')](function(_0x46a94b){if(_0x46a94b){return _0x46a94b?{'count':_0xb50f16,'rows':_0x46a94b}:null;}})[_0x762a('0x27')](respondWithResult(_0x31de94,null))[_0x762a('0x4a')](handleError(_0x31de94,null));};exports[_0x762a('0x59')]=function(_0x2a5045,_0x5a88fd,_0x5a419e){return db[_0x762a('0x30')][_0x762a('0x55')]({'where':{'id':_0x2a5045[_0x762a('0x46')]['id']}})[_0x762a('0x27')](handleEntityNotFound(_0x5a88fd,null))[_0x762a('0x27')](function(_0x190e40){if(_0x190e40){return db['sequelize']['transaction'](function(_0x55b593){return db['Interval']['destroy']({'where':{'IntervalId':_0x2a5045[_0x762a('0x46')]['id']},'transaction':_0x55b593})[_0x762a('0x27')](function(_0x53fa8c){var _0x185eda=_[_0x762a('0x35')](_0x2a5045[_0x762a('0x4b')],function(_0x166ebf){delete _0x166ebf['id'];_0x166ebf[_0x762a('0x52')]=_0x2a5045['params']['id'];return _0x166ebf;});return db[_0x762a('0x30')][_0x762a('0x5a')](_0x185eda,{'transaction':_0x55b593});});})[_0x762a('0x27')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x2a5045[_0x762a('0x46')]['id']}});});}})['then'](respondWithResult(_0x5a88fd,null))[_0x762a('0x4a')](handleError(_0x5a88fd,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0d0f817..24430d6 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 _0xfa44=['define','Interval','tools_intervals','rewrite','interval','then','all','map','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports'];(function(_0x1da72c,_0x15d2e9){var _0x58d9e7=function(_0x1487e3){while(--_0x1487e3){_0x1da72c['push'](_0x1da72c['shift']());}};_0x58d9e7(++_0x15d2e9);}(_0xfa44,0x1a9));var _0x4fa4=function(_0x158a01,_0x50bcb8){_0x158a01=_0x158a01-0x0;var _0x94b215=_0xfa44[_0x158a01];return _0x94b215;};'use strict';var attributes=require(_0x4fa4('0x0'));var extensions=require(_0x4fa4('0x1'));var iftime=require(_0x4fa4('0x2'))['iftime'];module[_0x4fa4('0x3')]=function(_0x9a08b4){return _0x9a08b4[_0x4fa4('0x4')](_0x4fa4('0x5'),attributes,{'tableName':_0x4fa4('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31cc9e){extensions['rewrite'](_0x9a08b4,_0x31cc9e);},'afterBulkCreate':function(_0x44f771,_0x382a3e,_0x1792a6){_0x1792a6();extensions[_0x4fa4('0x7')](_0x9a08b4,_0x44f771[0x0]);},'afterUpdate':function(_0x2e6c4b){extensions[_0x4fa4('0x7')](_0x9a08b4,_0x2e6c4b);},'afterDestroy':function(_0x388841){extensions['rewrite'](_0x9a08b4,_0x388841);}},'instanceMethods':{'ifTime':function(_0x6ce8d9=undefined,_0x4f9dc4=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x4fa4('0x8')],_0x6ce8d9,_0x4f9dc4);}else{return this['getIntervals']()[_0x4fa4('0x9')](function(_0x5cf307){return Promise[_0x4fa4('0xa')](_0x5cf307[_0x4fa4('0xb')](function(_0x2718a2){return _0x2718a2['ifTime'](_0x6ce8d9,_0x4f9dc4);}));})[_0x4fa4('0x9')](function(_0x240737){return _0x240737[_0x4fa4('0xc')](function(_0x5213ac,_0x1222ce){return _0x5213ac||_0x1222ce;},![]);});}}}});}; \ No newline at end of file +var _0x7967=['define','Interval','rewrite','interval','string','getIntervals','map','ifTime','then','reduce','../../components/extensions/rewrite','iftime','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7967,0x135));var _0x7796=function(_0x34aad4,_0x17da72){_0x34aad4=_0x34aad4-0x0;var _0x6a9458=_0x7967[_0x34aad4];return _0x6a9458;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x7796('0x0'));var iftime=require('../../utils/iftime')[_0x7796('0x1')];module[_0x7796('0x2')]=function(_0x48a225){return _0x48a225[_0x7796('0x3')](_0x7796('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b4ace){extensions[_0x7796('0x5')](_0x48a225,_0x3b4ace);},'afterBulkCreate':function(_0x49500f,_0x4f4aca,_0x1db58e){_0x1db58e();extensions['rewrite'](_0x48a225,_0x49500f[0x0]);},'afterUpdate':function(_0x3e8442){extensions[_0x7796('0x5')](_0x48a225,_0x3e8442);},'afterDestroy':function(_0x494fd1){extensions[_0x7796('0x5')](_0x48a225,_0x494fd1);}},'instanceMethods':{'ifTime':function(_0x16309f=undefined,_0x4525f2=new Date()){if(typeof this[_0x7796('0x6')]===_0x7796('0x7')){return iftime(this[_0x7796('0x6')],_0x16309f,_0x4525f2);}else{return this[_0x7796('0x8')]()['then'](function(_0x106c06){return Promise['all'](_0x106c06[_0x7796('0x9')](function(_0x1029e0){return _0x1029e0[_0x7796('0xa')](_0x16309f,_0x4525f2);}));})[_0x7796('0xb')](function(_0x3fb10c){return _0x3fb10c[_0x7796('0xc')](function(_0x2fb772,_0x485061){return _0x2fb772||_0x485061;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 675485e..63cac43 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 _0xd99a=['isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','reduce','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','GetInterval','stringify','catch','error','message','ShowInterval','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds'];(function(_0x294270,_0x55251e){var _0x9f8843=function(_0x324508){while(--_0x324508){_0x294270['push'](_0x294270['shift']());}};_0x9f8843(++_0x55251e);}(_0xd99a,0x64));var _0xad99=function(_0x4e6e0d,_0xa877e3){_0x4e6e0d=_0x4e6e0d-0x0;var _0x78a90=_0xd99a[_0x4e6e0d];return _0x78a90;};'use strict';var _=require('lodash');var util=require(_0xad99('0x0'));var db=require(_0xad99('0x1'))['db'];var iftime=require(_0xad99('0x2'))[_0xad99('0x3')];var logger=require(_0xad99('0x4'))(_0xad99('0x5'));exports['GetInterval']=function(_0x57a7ee){var _0x54b988=this;return new Promise(function(_0x17c701,_0x3bc9b0){return db[_0xad99('0x6')][_0xad99('0x7')]({'raw':_0x57a7ee[_0xad99('0x8')]?_0x57a7ee[_0xad99('0x8')][_0xad99('0x9')]===undefined?!![]:![]:!![],'where':_0x57a7ee[_0xad99('0x8')]?_0x57a7ee['options'][_0xad99('0xa')]||null:null,'attributes':_0x57a7ee['options']?_0x57a7ee[_0xad99('0x8')]['attributes']||null:null,'limit':_0x57a7ee['options']?_0x57a7ee[_0xad99('0x8')][_0xad99('0xb')]||null:null,'include':_0x57a7ee[_0xad99('0x8')]?_0x57a7ee[_0xad99('0x8')][_0xad99('0xc')]?_[_0xad99('0xd')](_0x57a7ee[_0xad99('0x8')]['include'],function(_0x39824a){return{'model':db[_0x39824a[_0xad99('0xe')]],'as':_0x39824a['as'],'attributes':_0x39824a[_0xad99('0xf')],'include':_0x39824a[_0xad99('0xc')]?_[_0xad99('0xd')](_0x39824a[_0xad99('0xc')],function(_0x1191a7){return{'model':db[_0x1191a7[_0xad99('0xe')]],'as':_0x1191a7['as'],'attributes':_0x1191a7[_0xad99('0xf')],'include':_0x1191a7[_0xad99('0xc')]?_[_0xad99('0xd')](_0x1191a7['include'],function(_0x3d9843){return{'model':db[_0x3d9843[_0xad99('0xe')]],'as':_0x3d9843['as'],'attributes':_0x3d9843[_0xad99('0xf')]};}):[]};}):[]};}):[]:[]})[_0xad99('0x10')](function(_0x9cccb8){logger[_0xad99('0x11')]('GetInterval',_0x57a7ee);logger[_0xad99('0x12')](_0xad99('0x13'),_0x57a7ee,JSON[_0xad99('0x14')](_0x9cccb8));_0x17c701(_0x9cccb8);})[_0xad99('0x15')](function(_0x2ad005){logger[_0xad99('0x16')](_0xad99('0x13'),_0x2ad005[_0xad99('0x17')],_0x57a7ee);_0x3bc9b0(_0x54b988['error'](0x1f4,_0x2ad005[_0xad99('0x17')]));});});};exports[_0xad99('0x18')]=function(_0x54139b){var _0x2189d5=this;return new Promise(function(_0x4cff3a,_0x504789){return db[_0xad99('0x6')]['find']({'raw':_0x54139b[_0xad99('0x8')]?_0x54139b[_0xad99('0x8')][_0xad99('0x9')]===undefined?!![]:![]:!![],'where':_0x54139b[_0xad99('0x8')]?_0x54139b[_0xad99('0x8')]['where']||null:null,'attributes':_0x54139b[_0xad99('0x8')]?_0x54139b[_0xad99('0x8')][_0xad99('0xf')]||null:null,'include':_0x54139b[_0xad99('0x8')]?_0x54139b[_0xad99('0x8')]['include']?_[_0xad99('0xd')](_0x54139b[_0xad99('0x8')][_0xad99('0xc')],function(_0x26c51c){return{'model':db[_0x26c51c[_0xad99('0xe')]],'as':_0x26c51c['as'],'attributes':_0x26c51c[_0xad99('0xf')],'include':_0x26c51c[_0xad99('0xc')]?_['map'](_0x26c51c[_0xad99('0xc')],function(_0x43d796){return{'model':db[_0x43d796[_0xad99('0xe')]],'as':_0x43d796['as'],'attributes':_0x43d796[_0xad99('0xf')],'include':_0x43d796['include']?_[_0xad99('0xd')](_0x43d796[_0xad99('0xc')],function(_0x57a8e2){return{'model':db[_0x57a8e2[_0xad99('0xe')]],'as':_0x57a8e2['as'],'attributes':_0x57a8e2['attributes']};}):[]};}):[]};}):[]:[]})[_0xad99('0x10')](function(_0x465370){logger[_0xad99('0x11')](_0xad99('0x18'),_0x54139b);logger[_0xad99('0x12')](_0xad99('0x18'),_0x54139b,JSON[_0xad99('0x14')](_0x465370));_0x4cff3a(_0x465370);})[_0xad99('0x15')](function(_0x42d389){logger['error'](_0xad99('0x18'),_0x42d389[_0xad99('0x17')],_0x54139b);_0x504789(_0x2189d5[_0xad99('0x16')](0x1f4,_0x42d389['message']));});});};function checkArrayOfIntervals(_0x193eca,_0x3ee0ad){var _0x41756a=[];return db[_0xad99('0x6')]['findAll']({'where':{'id':_0x193eca}})[_0xad99('0x10')](function(_0x50c129){_0x41756a=_0x50c129;return Promise[_0xad99('0x19')](_0x41756a[_0xad99('0xd')](function(_0x3c7906){return _0x3c7906[_0xad99('0x1a')](_0x3ee0ad);}));})['then'](function(_0x1b8939){var _0x5dc0c0=_0x1b8939['reduce'](function(_0x2af7ae,_0xd1546d){return _0x2af7ae||_0xd1546d;},![]);logger[_0xad99('0x11')](util[_0xad99('0x1b')](_0xad99('0x1c'),_0x41756a[_0xad99('0xd')](function(_0x10d2c8){return _0x10d2c8[_0xad99('0x1d')];})['join'](',\x20'),_0x41756a[_0xad99('0xd')](function(_0x3f532a){return _0x3f532a['id'];})[_0xad99('0x1e')](',\x20')));return _0x5dc0c0;});}function checkSingleInterval(_0xd53820,_0x44c105){return db[_0xad99('0x6')][_0xad99('0x1f')](_0xd53820)['then'](function(_0x329563){if(_0x329563){logger[_0xad99('0x11')](util[_0xad99('0x1b')](_0xad99('0x20'),_0x329563[_0xad99('0x1d')],_0x329563['id']));return _0x329563['ifTime'](_0x44c105);}});}exports[_0xad99('0x21')]=function(_0x51e223){var _0x19f57d=_0x51e223[_0xad99('0x22')];var _0x4c8954=Array[_0xad99('0x23')](_0x51e223[_0xad99('0x24')])?_0x51e223[_0xad99('0x24')]:typeof _0x51e223['intervals']===_0xad99('0x25')?[_0x51e223[_0xad99('0x24')]]:[];var _0x42426d=_0x51e223[_0xad99('0x26')]||undefined;var _0x23d7ea=![];if(_0x4c8954[_0xad99('0x27')]){logger['info'](util[_0xad99('0x1b')](_0xad99('0x28'),_0x4c8954[_0xad99('0x1e')](';\x20')));}if(_0x42426d){logger[_0xad99('0x11')](util[_0xad99('0x1b')](_0xad99('0x29'),_0x42426d));}logger[_0xad99('0x12')](_0xad99('0x2a'),_0x23d7ea);logger['silly'](_0xad99('0x21'),_0x51e223);return Promise[_0xad99('0x2b')]()['then'](function(){if(Array['isArray'](_0x19f57d)){return checkArrayOfIntervals(_0x19f57d,_0x42426d);}else if(_0x19f57d){return checkSingleInterval(_0x19f57d,_0x42426d);}})[_0xad99('0x10')](function(_0x4eff8c){var _0x253cc9=_0x4c8954[_0xad99('0x2c')](function(_0x42f493,_0x29f571){return _0x42f493||iftime(_0x29f571,_0x42426d);},![]);_0x23d7ea=_0x4eff8c||_0x253cc9;return _0x23d7ea;})[_0xad99('0x15')](function(_0x41d8ca){logger[_0xad99('0x16')](_0xad99('0x21'),_0x51e223,_0x41d8ca);throw this[_0xad99('0x16')](0x1f4,_0x41d8ca[_0xad99('0x17')]);});}; \ No newline at end of file +var _0x41c5=['options','raw','where','attributes','limit','map','include','model','info','debug','stringify','catch','error','message','ShowInterval','then','all','format','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','isArray','reduce','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','GetInterval','Interval','findAll'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x41c5,0x1c6));var _0x541c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x41c5[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x541c('0x0'));var util=require(_0x541c('0x1'));var db=require(_0x541c('0x2'))['db'];var iftime=require(_0x541c('0x3'))['iftime'];var logger=require(_0x541c('0x4'))('rpc');exports[_0x541c('0x5')]=function(_0x5c7994){var _0x2f35cc=this;return new Promise(function(_0x2e2b2a,_0x158772){return db[_0x541c('0x6')][_0x541c('0x7')]({'raw':_0x5c7994[_0x541c('0x8')]?_0x5c7994[_0x541c('0x8')][_0x541c('0x9')]===undefined?!![]:![]:!![],'where':_0x5c7994[_0x541c('0x8')]?_0x5c7994[_0x541c('0x8')][_0x541c('0xa')]||null:null,'attributes':_0x5c7994[_0x541c('0x8')]?_0x5c7994[_0x541c('0x8')][_0x541c('0xb')]||null:null,'limit':_0x5c7994[_0x541c('0x8')]?_0x5c7994[_0x541c('0x8')][_0x541c('0xc')]||null:null,'include':_0x5c7994[_0x541c('0x8')]?_0x5c7994[_0x541c('0x8')]['include']?_[_0x541c('0xd')](_0x5c7994[_0x541c('0x8')][_0x541c('0xe')],function(_0x52e443){return{'model':db[_0x52e443[_0x541c('0xf')]],'as':_0x52e443['as'],'attributes':_0x52e443[_0x541c('0xb')],'include':_0x52e443[_0x541c('0xe')]?_[_0x541c('0xd')](_0x52e443[_0x541c('0xe')],function(_0x3be031){return{'model':db[_0x3be031[_0x541c('0xf')]],'as':_0x3be031['as'],'attributes':_0x3be031['attributes'],'include':_0x3be031[_0x541c('0xe')]?_[_0x541c('0xd')](_0x3be031[_0x541c('0xe')],function(_0x5ab8c6){return{'model':db[_0x5ab8c6[_0x541c('0xf')]],'as':_0x5ab8c6['as'],'attributes':_0x5ab8c6[_0x541c('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a09a9){logger[_0x541c('0x10')](_0x541c('0x5'),_0x5c7994);logger[_0x541c('0x11')](_0x541c('0x5'),_0x5c7994,JSON[_0x541c('0x12')](_0x1a09a9));_0x2e2b2a(_0x1a09a9);})[_0x541c('0x13')](function(_0x35adef){logger[_0x541c('0x14')](_0x541c('0x5'),_0x35adef[_0x541c('0x15')],_0x5c7994);_0x158772(_0x2f35cc[_0x541c('0x14')](0x1f4,_0x35adef[_0x541c('0x15')]));});});};exports['ShowInterval']=function(_0x172892){var _0x11e08a=this;return new Promise(function(_0x427ef7,_0x5318e2){return db[_0x541c('0x6')]['find']({'raw':_0x172892[_0x541c('0x8')]?_0x172892['options']['raw']===undefined?!![]:![]:!![],'where':_0x172892['options']?_0x172892[_0x541c('0x8')]['where']||null:null,'attributes':_0x172892['options']?_0x172892[_0x541c('0x8')][_0x541c('0xb')]||null:null,'include':_0x172892[_0x541c('0x8')]?_0x172892[_0x541c('0x8')][_0x541c('0xe')]?_[_0x541c('0xd')](_0x172892[_0x541c('0x8')][_0x541c('0xe')],function(_0x30893d){return{'model':db[_0x30893d[_0x541c('0xf')]],'as':_0x30893d['as'],'attributes':_0x30893d[_0x541c('0xb')],'include':_0x30893d[_0x541c('0xe')]?_[_0x541c('0xd')](_0x30893d[_0x541c('0xe')],function(_0x9aa4ef){return{'model':db[_0x9aa4ef['model']],'as':_0x9aa4ef['as'],'attributes':_0x9aa4ef[_0x541c('0xb')],'include':_0x9aa4ef[_0x541c('0xe')]?_['map'](_0x9aa4ef['include'],function(_0x333a16){return{'model':db[_0x333a16[_0x541c('0xf')]],'as':_0x333a16['as'],'attributes':_0x333a16['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5da236){logger[_0x541c('0x10')](_0x541c('0x16'),_0x172892);logger[_0x541c('0x11')](_0x541c('0x16'),_0x172892,JSON['stringify'](_0x5da236));_0x427ef7(_0x5da236);})[_0x541c('0x13')](function(_0x10a1e1){logger[_0x541c('0x14')](_0x541c('0x16'),_0x10a1e1[_0x541c('0x15')],_0x172892);_0x5318e2(_0x11e08a[_0x541c('0x14')](0x1f4,_0x10a1e1['message']));});});};function checkArrayOfIntervals(_0x5b9da1,_0x390725){var _0x2db7fa=[];return db[_0x541c('0x6')][_0x541c('0x7')]({'where':{'id':_0x5b9da1}})[_0x541c('0x17')](function(_0x26c206){_0x2db7fa=_0x26c206;return Promise[_0x541c('0x18')](_0x2db7fa[_0x541c('0xd')](function(_0x4e273a){return _0x4e273a['ifTime'](_0x390725);}));})[_0x541c('0x17')](function(_0x572810){var _0x55c3d3=_0x572810['reduce'](function(_0x332eb5,_0x1f2db){return _0x332eb5||_0x1f2db;},![]);logger[_0x541c('0x10')](util[_0x541c('0x19')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2db7fa['map'](function(_0x11fcc5){return _0x11fcc5[_0x541c('0x1a')];})[_0x541c('0x1b')](',\x20'),_0x2db7fa[_0x541c('0xd')](function(_0x5d6c93){return _0x5d6c93['id'];})[_0x541c('0x1b')](',\x20')));return _0x55c3d3;});}function checkSingleInterval(_0x250478,_0x257ce3){return db['Interval']['findById'](_0x250478)[_0x541c('0x17')](function(_0x3b6787){if(_0x3b6787){logger[_0x541c('0x10')](util[_0x541c('0x19')](_0x541c('0x1c'),_0x3b6787[_0x541c('0x1a')],_0x3b6787['id']));return _0x3b6787[_0x541c('0x1d')](_0x257ce3);}});}exports[_0x541c('0x1e')]=function(_0x4a15f0){var _0x260038=_0x4a15f0[_0x541c('0x1f')];var _0x40cace=Array['isArray'](_0x4a15f0[_0x541c('0x20')])?_0x4a15f0[_0x541c('0x20')]:typeof _0x4a15f0[_0x541c('0x20')]===_0x541c('0x21')?[_0x4a15f0['intervals']]:[];var _0x4b52bf=_0x4a15f0['timezone']||undefined;var _0x45a067=![];if(_0x40cace[_0x541c('0x22')]){logger['info'](util['format'](_0x541c('0x23'),_0x40cace['join'](';\x20')));}if(_0x4b52bf){logger[_0x541c('0x10')](util[_0x541c('0x19')](_0x541c('0x24'),_0x4b52bf));}logger['debug'](_0x541c('0x25'),_0x45a067);logger[_0x541c('0x26')]('IntervalIftime',_0x4a15f0);return Promise[_0x541c('0x27')]()[_0x541c('0x17')](function(){if(Array[_0x541c('0x28')](_0x260038)){return checkArrayOfIntervals(_0x260038,_0x4b52bf);}else if(_0x260038){return checkSingleInterval(_0x260038,_0x4b52bf);}})[_0x541c('0x17')](function(_0x406368){var _0x5de44f=_0x40cace[_0x541c('0x29')](function(_0x5479ab,_0x1f21c3){return _0x5479ab||iftime(_0x1f21c3,_0x4b52bf);},![]);_0x45a067=_0x406368||_0x5de44f;return _0x45a067;})[_0x541c('0x13')](function(_0x56288e){logger[_0x541c('0x14')](_0x541c('0x1e'),_0x4a15f0,_0x56288e);throw this[_0x541c('0x14')](0x1f4,_0x56288e[_0x541c('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 8e2f000..84a8a6d 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0xfaa3d1,_0x4f2889){var _0x556a2e=function(_0x24b29f){while(--_0x24b29f){_0xfaa3d1['push'](_0xfaa3d1['shift']());}};_0x556a2e(++_0x4f2889);}(_0x2032,0xd9));var _0x2203=function(_0xf5a5b7,_0x197446){_0xf5a5b7=_0xf5a5b7-0x0;var _0x44d6c2=_0x2032[_0xf5a5b7];return _0x44d6c2;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x23f889,_0xa0d7b7){var _0x5bcf6d=function(_0x1a8b77){while(--_0x1a8b77){_0x23f889['push'](_0x23f889['shift']());}};_0x5bcf6d(++_0xa0d7b7);}(_0xadb5,0xad));var _0x5adb=function(_0x5763ce,_0x583706){_0x5763ce=_0x5763ce-0x0;var _0x53506f=_0xadb5[_0x5763ce];return _0x53506f;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index ce97825..ff11039 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 _0x4f92=['key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','connection','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4f92,0x17a));var _0x24f9=function(_0x5edbc8,_0x3cba86){_0x5edbc8=_0x5edbc8-0x0;var _0x1381ac=_0x4f92[_0x5edbc8];return _0x1381ac;};'use strict';var BPromise=require(_0x24f9('0x0'));var https=require(_0x24f9('0x1'));var logger=require(_0x24f9('0x2'))(_0x24f9('0x3'));var USERNAME=_0x24f9('0x4');var PASSWORD=_0x24f9('0x5');function openIssue(_0x2c9058,_0x57f217){var _0x53f372={'fields':{'project':{'key':_0x2c9058[_0x24f9('0x6')]||_0x24f9('0x7')},'summary':(_0x2c9058[_0x24f9('0x8')]||'Report')+_0x24f9('0x9')+_0x2c9058['ip'],'description':_0x2c9058[_0x24f9('0xa')]||JSON[_0x24f9('0xb')](_0x2c9058),'issuetype':{'name':_0x2c9058[_0x24f9('0xc')]||'Bug'}}};_0x53f372[_0x24f9('0xd')][_0x24f9('0xe')]=_0x2c9058[_0x24f9('0xf')];_0x53f372[_0x24f9('0xd')][_0x24f9('0x10')]=_0x2c9058[_0x24f9('0x11')];_0x53f372[_0x24f9('0xd')][_0x24f9('0x12')]=_0x2c9058['newToken'];_0x53f372[_0x24f9('0xd')][_0x24f9('0x13')]=_0x2c9058[_0x24f9('0x14')];_0x53f372[_0x24f9('0xd')][_0x24f9('0x15')]=_0x2c9058[_0x24f9('0x16')];_0x53f372[_0x24f9('0xd')][_0x24f9('0x17')]=_0x2c9058['ip'];var _0x593594={'host':_0x24f9('0x18'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x24f9('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x24f9('0x1a'),'Authorization':_0x24f9('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x24f9('0x1c')]('base64')}};var _0x2202a7=JSON[_0x24f9('0xb')](_0x53f372);var _0x49bdb8=https[_0x24f9('0x1d')](_0x593594,function(_0x22880a){_0x22880a[_0x24f9('0x1e')](_0x24f9('0x1f'));var _0x28a622='';_0x22880a['on'](_0x24f9('0x20'),function(_0x1a9b34){_0x28a622+=_0x1a9b34;});_0x22880a['on'](_0x24f9('0x21'),function(){if(_0x57f217){return _0x57f217[_0x24f9('0x22')](_0x22880a[_0x24f9('0x23')])[_0x24f9('0x24')](JSON[_0x24f9('0x25')](_0x28a622));}});});_0x49bdb8['on'](_0x24f9('0x26'),function(_0x1cf5bb){if(_0x57f217){return _0x57f217[_0x24f9('0x22')](0x1f4)[_0x24f9('0x24')]({'errors':[{'message':_0x24f9('0x27'),'type':_0x24f9('0x28')}]});}});_0x49bdb8[_0x24f9('0x29')](_0x2202a7);_0x49bdb8[_0x24f9('0x21')]();}exports[_0x24f9('0x2a')]=openIssue;exports[_0x24f9('0x2b')]=function(_0x39fd31,_0x3142ca){_0x39fd31['body']['ip']=_0x39fd31[_0x24f9('0x2c')]['x-forwarded-for']||_0x39fd31[_0x24f9('0x2d')]['remoteAddress']||_0x39fd31['socket']['remoteAddress']||_0x39fd31['connection'][_0x24f9('0x2e')]['remoteAddress'];return openIssue(_0x39fd31[_0x24f9('0x2f')],_0x3142ca);}; \ No newline at end of file +var _0xe67f=['summary','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','request','setEncoding','utf8','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','connection','remoteAddress','https','support','key','MOTGUI'];(function(_0x239e01,_0x3566cc){var _0x1df792=function(_0x2631f9){while(--_0x2631f9){_0x239e01['push'](_0x239e01['shift']());}};_0x1df792(++_0x3566cc);}(_0xe67f,0x1e8));var _0xfe67=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe67f[_0x40a045];return _0x1a687c;};'use strict';var BPromise=require('bluebird');var https=require(_0xfe67('0x0'));var logger=require('../../config/logger')('api');var USERNAME=_0xfe67('0x1');var PASSWORD='3eAmWpBVP0';function openIssue(_0x49d528,_0x12417f){var _0x37a9d7={'fields':{'project':{'key':_0x49d528[_0xfe67('0x2')]||_0xfe67('0x3')},'summary':(_0x49d528[_0xfe67('0x4')]||'Report')+_0xfe67('0x5')+_0x49d528['ip'],'description':_0x49d528[_0xfe67('0x6')]||JSON['stringify'](_0x49d528),'issuetype':{'name':_0x49d528[_0xfe67('0x7')]||_0xfe67('0x8')}}};_0x37a9d7[_0xfe67('0x9')][_0xfe67('0xa')]=_0x49d528[_0xfe67('0xb')];_0x37a9d7[_0xfe67('0x9')][_0xfe67('0xc')]=_0x49d528[_0xfe67('0xd')];_0x37a9d7[_0xfe67('0x9')]['customfield_11502']=_0x49d528['newToken'];_0x37a9d7[_0xfe67('0x9')][_0xfe67('0xe')]=_0x49d528[_0xfe67('0xf')];_0x37a9d7[_0xfe67('0x9')][_0xfe67('0x10')]=_0x49d528[_0xfe67('0x11')];_0x37a9d7[_0xfe67('0x9')][_0xfe67('0x12')]=_0x49d528['ip'];var _0x241804={'host':_0xfe67('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xfe67('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xfe67('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0xfe67('0x16')](_0xfe67('0x17'))}};var _0x38cec2=JSON['stringify'](_0x37a9d7);var _0x5cad64=https[_0xfe67('0x18')](_0x241804,function(_0x28459b){_0x28459b[_0xfe67('0x19')](_0xfe67('0x1a'));var _0x2350bc='';_0x28459b['on']('data',function(_0x2fc66d){_0x2350bc+=_0x2fc66d;});_0x28459b['on']('end',function(){if(_0x12417f){return _0x12417f[_0xfe67('0x1b')](_0x28459b[_0xfe67('0x1c')])[_0xfe67('0x1d')](JSON[_0xfe67('0x1e')](_0x2350bc));}});});_0x5cad64['on'](_0xfe67('0x1f'),function(_0x2947c2){if(_0x12417f){return _0x12417f['status'](0x1f4)[_0xfe67('0x1d')]({'errors':[{'message':_0xfe67('0x20'),'type':_0xfe67('0x21')}]});}});_0x5cad64[_0xfe67('0x22')](_0x38cec2);_0x5cad64[_0xfe67('0x23')]();}exports[_0xfe67('0x24')]=openIssue;exports['send']=function(_0x4d5f49,_0x157d83){_0x4d5f49[_0xfe67('0x25')]['ip']=_0x4d5f49[_0xfe67('0x26')]['x-forwarded-for']||_0x4d5f49[_0xfe67('0x27')][_0xfe67('0x28')]||_0x4d5f49['socket'][_0xfe67('0x28')]||_0x4d5f49[_0xfe67('0x27')]['socket'][_0xfe67('0x28')];return openIssue(_0x4d5f49[_0xfe67('0x25')],_0x157d83);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e6f4be8..4b343e7 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x398cc2,_0x1d1f2b){var _0x57bf1e=function(_0x2f75d4){while(--_0x2f75d4){_0x398cc2['push'](_0x398cc2['shift']());}};_0x57bf1e(++_0x1d1f2b);}(_0xedd9,0xfc));var _0x9edd=function(_0x526f38,_0x584c8f){_0x526f38=_0x526f38-0x0;var _0x42f8cf=_0xedd9[_0x526f38];return _0x42f8cf;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('0x14')]=router; \ No newline at end of file +var _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0xce4604,_0x5e98ad){var _0x474352=function(_0x9074e8){while(--_0x9074e8){_0xce4604['push'](_0xce4604['shift']());}};_0x474352(++_0x5e98ad);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x24f9d9,_0x6b4d81){_0x24f9d9=_0x24f9d9-0x0;var _0x392b6c=_0xf3cd[_0x24f9d9];return _0x392b6c;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 16993cc..d7f2a75 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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x3f9eae,_0x577f87){_0x3f9eae=_0x3f9eae-0x0;var _0x1aeb0f=_0x7a54[_0x3f9eae];return _0x1aeb0f;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x188ced,_0x4ff80f){_0x188ced=_0x188ced-0x0;var _0x32a7fb=_0x7a54[_0x188ced];return _0x32a7fb;};'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 3028c8f..a7bcfc9 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 _0x044a=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','limit','count','offset','set','apply','reject','update','then','stack','name','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','find','create','body','params','destroy'];(function(_0x195f43,_0x2f27d8){var _0x402a67=function(_0x55c502){while(--_0x55c502){_0x195f43['push'](_0x195f43['shift']());}};_0x402a67(++_0x2f27d8);}(_0x044a,0x173));var _0xa044=function(_0x37e6f3,_0x4ee128){_0x37e6f3=_0x37e6f3-0x0;var _0x2f2b7b=_0x044a[_0x37e6f3];return _0x2f2b7b;};'use strict';var emlformat=require(_0xa044('0x0'));var rimraf=require(_0xa044('0x1'));var zipdir=require(_0xa044('0x2'));var jsonpatch=require(_0xa044('0x3'));var rp=require(_0xa044('0x4'));var moment=require(_0xa044('0x5'));var BPromise=require(_0xa044('0x6'));var Mustache=require(_0xa044('0x7'));var util=require(_0xa044('0x8'));var path=require(_0xa044('0x9'));var sox=require('sox');var csv=require(_0xa044('0xa'));var ejs=require(_0xa044('0xb'));var fs=require('fs');var fs_extra=require(_0xa044('0xc'));var _=require(_0xa044('0xd'));var squel=require('squel');var crypto=require(_0xa044('0xe'));var jsforce=require(_0xa044('0xf'));var deskjs=require(_0xa044('0x10'));var toCsv=require(_0xa044('0xa'));var querystring=require('querystring');var Papa=require(_0xa044('0x11'));var Redis=require(_0xa044('0x12'));var authService=require(_0xa044('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa044('0x14'));var hardwareService=require(_0xa044('0x15'));var logger=require(_0xa044('0x16'))(_0xa044('0x17'));var utils=require('../../config/utils');var config=require(_0xa044('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ee43,_0x3e05cf){_0x3e05cf=_0x3e05cf||0xcc;return function(_0x2b73a1){if(_0x2b73a1){return _0x1ee43[_0xa044('0x19')](_0x3e05cf);}return _0x1ee43[_0xa044('0x1a')](_0x3e05cf)[_0xa044('0x1b')]();};}function respondWithResult(_0xe9a838,_0x4bec52){_0x4bec52=_0x4bec52||0xc8;return function(_0x31c5ae){if(_0x31c5ae){return _0xe9a838['status'](_0x4bec52)[_0xa044('0x1c')](_0x31c5ae);}};}function respondWithFilteredResult(_0x44c658,_0x141d1a){return function(_0x3bc2c9){if(_0x3bc2c9){var _0xeb7e4e=typeof _0x141d1a['offset']==='undefined'&&typeof _0x141d1a[_0xa044('0x1d')]==='undefined';var _0x3ca144=_0x3bc2c9[_0xa044('0x1e')];var _0x1b43c1=_0xeb7e4e?0x0:_0x141d1a[_0xa044('0x1f')];var _0x3ccbd3=_0xeb7e4e?_0x3bc2c9['count']:_0x141d1a['offset']+_0x141d1a['limit'];var _0x39422b;if(_0x3ccbd3>=_0x3ca144){_0x3ccbd3=_0x3ca144;_0x39422b=0xc8;}else{_0x39422b=0xce;}_0x44c658[_0xa044('0x1a')](_0x39422b);return _0x44c658[_0xa044('0x20')]('Content-Range',_0x1b43c1+'-'+_0x3ccbd3+'/'+_0x3ca144)[_0xa044('0x1c')](_0x3bc2c9);}return null;};}function patchUpdates(_0x19854d){return function(_0x4e0202){try{jsonpatch[_0xa044('0x21')](_0x4e0202,_0x19854d,!![]);}catch(_0x40999a){return BPromise[_0xa044('0x22')](_0x40999a);}return _0x4e0202['save']();};}function saveUpdates(_0x2e3468,_0x966548){return function(_0x26747b){if(_0x26747b){return _0x26747b[_0xa044('0x23')](_0x2e3468)[_0xa044('0x24')](function(_0x3f4d03){return _0x3f4d03;});}return null;};}function removeEntity(_0x18af4c,_0x46f14c){return function(_0x36c237){if(_0x36c237){return _0x36c237['destroy']()['then'](function(){_0x18af4c[_0xa044('0x1a')](0xcc)[_0xa044('0x1b')]();});}};}function handleEntityNotFound(_0x228d5e,_0x4c3d4b){return function(_0x418756){if(!_0x418756){_0x228d5e[_0xa044('0x19')](0x194);}return _0x418756;};}function handleError(_0x4e9357,_0x38bdd7){_0x38bdd7=_0x38bdd7||0x1f4;return function(_0x6746e8){logger['error'](_0x6746e8[_0xa044('0x25')]);if(_0x6746e8[_0xa044('0x26')]){delete _0x6746e8['name'];}_0x4e9357['status'](_0x38bdd7)['send'](_0x6746e8);};}exports[_0xa044('0x27')]=function(_0x159519,_0x1362ef){var _0x4c72f3={},_0x267512={},_0x300b6e={'count':0x0,'rows':[]};var _0x485212=_[_0xa044('0x28')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x1cb1be){return{'name':_0x1cb1be['fieldName'],'type':_0x1cb1be[_0xa044('0x29')][_0xa044('0x2a')]};});_0x267512[_0xa044('0x2b')]=_[_0xa044('0x28')](_0x485212,_0xa044('0x26'));_0x267512[_0xa044('0x2c')]=_['keys'](_0x159519[_0xa044('0x2c')]);_0x267512[_0xa044('0x2d')]=_[_0xa044('0x2e')](_0x267512[_0xa044('0x2b')],_0x267512['query']);_0x4c72f3[_0xa044('0x2f')]=_[_0xa044('0x2e')](_0x267512['model'],qs['fields'](_0x159519[_0xa044('0x2c')][_0xa044('0x30')]));_0x4c72f3['attributes']=_0x4c72f3[_0xa044('0x2f')][_0xa044('0x31')]?_0x4c72f3[_0xa044('0x2f')]:_0x267512['model'];if(!_0x159519[_0xa044('0x2c')][_0xa044('0x32')](_0xa044('0x33'))){_0x4c72f3[_0xa044('0x1d')]=qs[_0xa044('0x1d')](_0x159519['query'][_0xa044('0x1d')]);_0x4c72f3[_0xa044('0x1f')]=qs[_0xa044('0x1f')](_0x159519['query'][_0xa044('0x1f')]);}_0x4c72f3[_0xa044('0x34')]=qs['sort'](_0x159519[_0xa044('0x2c')][_0xa044('0x35')]);_0x4c72f3[_0xa044('0x36')]=qs[_0xa044('0x2d')](_[_0xa044('0x37')](_0x159519[_0xa044('0x2c')],_0x267512[_0xa044('0x2d')]),_0x485212);if(_0x159519[_0xa044('0x2c')]['filter']){_0x4c72f3[_0xa044('0x36')]=_[_0xa044('0x38')](_0x4c72f3[_0xa044('0x36')],{'$or':_[_0xa044('0x28')](_0x485212,function(_0x20509c){if(_0x20509c['type']!==_0xa044('0x39')){var _0x529be2={};_0x529be2[_0x20509c[_0xa044('0x26')]]={'$like':'%'+_0x159519[_0xa044('0x2c')]['filter']+'%'};return _0x529be2;}})});}_0x4c72f3=_['merge']({},_0x4c72f3,_0x159519['options']);var _0x22386d={'where':_0x4c72f3[_0xa044('0x36')]};return db[_0xa044('0x3a')][_0xa044('0x1e')](_0x22386d)[_0xa044('0x24')](function(_0x73aa8b){_0x300b6e[_0xa044('0x1e')]=_0x73aa8b;if(_0x159519[_0xa044('0x2c')][_0xa044('0x3b')]){_0x4c72f3[_0xa044('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa044('0x3d')](_0x4c72f3);})[_0xa044('0x24')](function(_0x1e84c1){_0x300b6e[_0xa044('0x3e')]=_0x1e84c1;return _0x300b6e;})[_0xa044('0x24')](respondWithFilteredResult(_0x1362ef,_0x4c72f3))[_0xa044('0x3f')](handleError(_0x1362ef,null));};exports[_0xa044('0x40')]=function(_0xc9246f,_0x2863a5){var _0x1f1c35={'raw':!![],'where':{'id':_0xc9246f['params']['id']}},_0x4b9cf6={};_0x4b9cf6[_0xa044('0x2b')]=_['keys'](db[_0xa044('0x3a')][_0xa044('0x41')]);_0x4b9cf6[_0xa044('0x2c')]=_[_0xa044('0x42')](_0xc9246f[_0xa044('0x2c')]);_0x4b9cf6[_0xa044('0x2d')]=_['intersection'](_0x4b9cf6[_0xa044('0x2b')],_0x4b9cf6['query']);_0x1f1c35[_0xa044('0x2f')]=_[_0xa044('0x2e')](_0x4b9cf6[_0xa044('0x2b')],qs['fields'](_0xc9246f['query'][_0xa044('0x30')]));_0x1f1c35[_0xa044('0x2f')]=_0x1f1c35[_0xa044('0x2f')][_0xa044('0x31')]?_0x1f1c35[_0xa044('0x2f')]:_0x4b9cf6[_0xa044('0x2b')];if(_0xc9246f['query'][_0xa044('0x3b')]){_0x1f1c35[_0xa044('0x3c')]=[{'all':!![]}];}_0x1f1c35=_[_0xa044('0x38')]({},_0x1f1c35,_0xc9246f[_0xa044('0x43')]);return db[_0xa044('0x3a')][_0xa044('0x44')](_0x1f1c35)[_0xa044('0x24')](handleEntityNotFound(_0x2863a5,null))[_0xa044('0x24')](respondWithResult(_0x2863a5,null))[_0xa044('0x3f')](handleError(_0x2863a5,null));};exports[_0xa044('0x45')]=function(_0x13e4e3,_0x3d303a){return db[_0xa044('0x3a')]['create'](_0x13e4e3[_0xa044('0x46')],{})[_0xa044('0x24')](respondWithResult(_0x3d303a,0xc9))[_0xa044('0x3f')](handleError(_0x3d303a,null));};exports[_0xa044('0x23')]=function(_0x6bf8a0,_0x230ecf){if(_0x6bf8a0[_0xa044('0x46')]['id']){delete _0x6bf8a0['body']['id'];}return db['JscriptyAnswerReport'][_0xa044('0x44')]({'where':{'id':_0x6bf8a0[_0xa044('0x47')]['id']}})[_0xa044('0x24')](handleEntityNotFound(_0x230ecf,null))[_0xa044('0x24')](saveUpdates(_0x6bf8a0['body'],null))[_0xa044('0x24')](respondWithResult(_0x230ecf,null))[_0xa044('0x3f')](handleError(_0x230ecf,null));};exports[_0xa044('0x48')]=function(_0x390d24,_0x1b7877){return db[_0xa044('0x3a')]['find']({'where':{'id':_0x390d24[_0xa044('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b7877,null))['then'](removeEntity(_0x1b7877,null))[_0xa044('0x3f')](handleError(_0x1b7877,null));};exports[_0xa044('0x49')]=function(_0x3ea870,_0x187ebd){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x187ebd,null))[_0xa044('0x3f')](handleError(_0x187ebd,null));}; \ No newline at end of file +var _0x2d2c=['name','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x2d2c[_0x51c819];return _0x15c5d2;};'use strict';var emlformat=require(_0xc2d2('0x0'));var rimraf=require(_0xc2d2('0x1'));var zipdir=require(_0xc2d2('0x2'));var jsonpatch=require(_0xc2d2('0x3'));var rp=require(_0xc2d2('0x4'));var moment=require(_0xc2d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2d2('0x6'));var util=require('util');var path=require(_0xc2d2('0x7'));var sox=require(_0xc2d2('0x8'));var csv=require(_0xc2d2('0x9'));var ejs=require(_0xc2d2('0xa'));var fs=require('fs');var fs_extra=require(_0xc2d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2d2('0xc'));var jsforce=require(_0xc2d2('0xd'));var deskjs=require(_0xc2d2('0xe'));var toCsv=require(_0xc2d2('0x9'));var querystring=require(_0xc2d2('0xf'));var Papa=require(_0xc2d2('0x10'));var Redis=require(_0xc2d2('0x11'));var authService=require(_0xc2d2('0x12'));var qs=require(_0xc2d2('0x13'));var as=require(_0xc2d2('0x14'));var hardwareService=require(_0xc2d2('0x15'));var logger=require(_0xc2d2('0x16'))('api');var utils=require(_0xc2d2('0x17'));var config=require(_0xc2d2('0x18'));var licenseUtil=require(_0xc2d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273269,_0x738877){_0x738877=_0x738877||0xcc;return function(_0x4c2b12){if(_0x4c2b12){return _0x273269[_0xc2d2('0x1a')](_0x738877);}return _0x273269[_0xc2d2('0x1b')](_0x738877)['end']();};}function respondWithResult(_0xa6f836,_0x4de52a){_0x4de52a=_0x4de52a||0xc8;return function(_0x5a1d24){if(_0x5a1d24){return _0xa6f836[_0xc2d2('0x1b')](_0x4de52a)[_0xc2d2('0x1c')](_0x5a1d24);}};}function respondWithFilteredResult(_0xf6bc66,_0x4006f3){return function(_0x2c42a6){if(_0x2c42a6){var _0x37552b=typeof _0x4006f3[_0xc2d2('0x1d')]===_0xc2d2('0x1e')&&typeof _0x4006f3[_0xc2d2('0x1f')]===_0xc2d2('0x1e');var _0x403d51=_0x2c42a6['count'];var _0x2d4ec4=_0x37552b?0x0:_0x4006f3[_0xc2d2('0x1d')];var _0x34f750=_0x37552b?_0x2c42a6[_0xc2d2('0x20')]:_0x4006f3['offset']+_0x4006f3[_0xc2d2('0x1f')];var _0x18cef7;if(_0x34f750>=_0x403d51){_0x34f750=_0x403d51;_0x18cef7=0xc8;}else{_0x18cef7=0xce;}_0xf6bc66['status'](_0x18cef7);return _0xf6bc66[_0xc2d2('0x21')](_0xc2d2('0x22'),_0x2d4ec4+'-'+_0x34f750+'/'+_0x403d51)[_0xc2d2('0x1c')](_0x2c42a6);}return null;};}function patchUpdates(_0xb14bc3){return function(_0x603323){try{jsonpatch['apply'](_0x603323,_0xb14bc3,!![]);}catch(_0x100d5b){return BPromise[_0xc2d2('0x23')](_0x100d5b);}return _0x603323['save']();};}function saveUpdates(_0x2cac91,_0x4e3cb5){return function(_0x5ecf78){if(_0x5ecf78){return _0x5ecf78['update'](_0x2cac91)[_0xc2d2('0x24')](function(_0x1bdcb5){return _0x1bdcb5;});}return null;};}function removeEntity(_0x7ffb28,_0x4b3449){return function(_0x2dbc46){if(_0x2dbc46){return _0x2dbc46[_0xc2d2('0x25')]()[_0xc2d2('0x24')](function(){_0x7ffb28[_0xc2d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b201,_0x25e6af){return function(_0xf2ba15){if(!_0xf2ba15){_0x25b201[_0xc2d2('0x1a')](0x194);}return _0xf2ba15;};}function handleError(_0x1a11d2,_0x1c14e5){_0x1c14e5=_0x1c14e5||0x1f4;return function(_0x49e955){logger[_0xc2d2('0x26')](_0x49e955[_0xc2d2('0x27')]);if(_0x49e955[_0xc2d2('0x28')]){delete _0x49e955[_0xc2d2('0x28')];}_0x1a11d2['status'](_0x1c14e5)['send'](_0x49e955);};}exports[_0xc2d2('0x29')]=function(_0x7b75f4,_0x1f3b66){var _0x21ca37={},_0x402337={},_0x460379={'count':0x0,'rows':[]};var _0x4d4af2=_[_0xc2d2('0x2a')](db[_0xc2d2('0x2b')]['rawAttributes'],function(_0x29cae5){return{'name':_0x29cae5[_0xc2d2('0x2c')],'type':_0x29cae5[_0xc2d2('0x2d')][_0xc2d2('0x2e')]};});_0x402337[_0xc2d2('0x2f')]=_['map'](_0x4d4af2,'name');_0x402337[_0xc2d2('0x30')]=_['keys'](_0x7b75f4[_0xc2d2('0x30')]);_0x402337[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],_0x402337[_0xc2d2('0x30')]);_0x21ca37['attributes']=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],qs[_0xc2d2('0x33')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x21ca37[_0xc2d2('0x34')]=_0x21ca37['attributes'][_0xc2d2('0x35')]?_0x21ca37[_0xc2d2('0x34')]:_0x402337['model'];if(!_0x7b75f4[_0xc2d2('0x30')]['hasOwnProperty'](_0xc2d2('0x36'))){_0x21ca37[_0xc2d2('0x1f')]=qs[_0xc2d2('0x1f')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x1f')]);_0x21ca37[_0xc2d2('0x1d')]=qs[_0xc2d2('0x1d')](_0x7b75f4[_0xc2d2('0x30')]['offset']);}_0x21ca37[_0xc2d2('0x37')]=qs[_0xc2d2('0x38')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x38')]);_0x21ca37['where']=qs[_0xc2d2('0x31')](_[_0xc2d2('0x39')](_0x7b75f4[_0xc2d2('0x30')],_0x402337[_0xc2d2('0x31')]),_0x4d4af2);if(_0x7b75f4['query'][_0xc2d2('0x3a')]){_0x21ca37['where']=_[_0xc2d2('0x3b')](_0x21ca37[_0xc2d2('0x3c')],{'$or':_['map'](_0x4d4af2,function(_0xdbdce0){if(_0xdbdce0[_0xc2d2('0x2d')]!==_0xc2d2('0x3d')){var _0x29d04b={};_0x29d04b[_0xdbdce0[_0xc2d2('0x28')]]={'$like':'%'+_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x3a')]+'%'};return _0x29d04b;}})});}_0x21ca37=_[_0xc2d2('0x3b')]({},_0x21ca37,_0x7b75f4[_0xc2d2('0x3e')]);var _0x49d900={'where':_0x21ca37['where']};return db[_0xc2d2('0x2b')][_0xc2d2('0x20')](_0x49d900)['then'](function(_0xfd3ad4){_0x460379[_0xc2d2('0x20')]=_0xfd3ad4;if(_0x7b75f4[_0xc2d2('0x30')]['includeAll']){_0x21ca37['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc2d2('0x3f')](_0x21ca37);})[_0xc2d2('0x24')](function(_0x4031d0){_0x460379[_0xc2d2('0x40')]=_0x4031d0;return _0x460379;})['then'](respondWithFilteredResult(_0x1f3b66,_0x21ca37))[_0xc2d2('0x41')](handleError(_0x1f3b66,null));};exports['show']=function(_0x582edb,_0x24544e){var _0x2a987a={'raw':!![],'where':{'id':_0x582edb['params']['id']}},_0x386a39={};_0x386a39[_0xc2d2('0x2f')]=_[_0xc2d2('0x42')](db[_0xc2d2('0x2b')]['rawAttributes']);_0x386a39[_0xc2d2('0x30')]=_['keys'](_0x582edb[_0xc2d2('0x30')]);_0x386a39[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x386a39[_0xc2d2('0x2f')],_0x386a39[_0xc2d2('0x30')]);_0x2a987a[_0xc2d2('0x34')]=_['intersection'](_0x386a39[_0xc2d2('0x2f')],qs['fields'](_0x582edb[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x2a987a[_0xc2d2('0x34')]=_0x2a987a[_0xc2d2('0x34')][_0xc2d2('0x35')]?_0x2a987a['attributes']:_0x386a39[_0xc2d2('0x2f')];if(_0x582edb[_0xc2d2('0x30')]['includeAll']){_0x2a987a['include']=[{'all':!![]}];}_0x2a987a=_['merge']({},_0x2a987a,_0x582edb['options']);return db[_0xc2d2('0x2b')][_0xc2d2('0x43')](_0x2a987a)[_0xc2d2('0x24')](handleEntityNotFound(_0x24544e,null))[_0xc2d2('0x24')](respondWithResult(_0x24544e,null))[_0xc2d2('0x41')](handleError(_0x24544e,null));};exports[_0xc2d2('0x44')]=function(_0x1146cb,_0x3b795a){return db[_0xc2d2('0x2b')][_0xc2d2('0x44')](_0x1146cb[_0xc2d2('0x45')],{})[_0xc2d2('0x24')](respondWithResult(_0x3b795a,0xc9))['catch'](handleError(_0x3b795a,null));};exports[_0xc2d2('0x46')]=function(_0x4181dc,_0x572764){if(_0x4181dc[_0xc2d2('0x45')]['id']){delete _0x4181dc['body']['id'];}return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x4181dc[_0xc2d2('0x47')]['id']}})[_0xc2d2('0x24')](handleEntityNotFound(_0x572764,null))['then'](saveUpdates(_0x4181dc[_0xc2d2('0x45')],null))[_0xc2d2('0x24')](respondWithResult(_0x572764,null))[_0xc2d2('0x41')](handleError(_0x572764,null));};exports[_0xc2d2('0x25')]=function(_0x3b61ef,_0x4765f9){return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x3b61ef[_0xc2d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4765f9,null))['then'](removeEntity(_0x4765f9,null))[_0xc2d2('0x41')](handleError(_0x4765f9,null));};exports[_0xc2d2('0x48')]=function(_0x472299,_0x1827c3){return db[_0xc2d2('0x2b')]['describe']()[_0xc2d2('0x24')](respondWithResult(_0x1827c3,null))[_0xc2d2('0x41')](handleError(_0x1827c3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7656fa5..dc12f25 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 _0x9456=['path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','lodash','../../config/logger','api','request-promise'];(function(_0x3a8740,_0x54a287){var _0xd16778=function(_0x13b331){while(--_0x13b331){_0x3a8740['push'](_0x3a8740['shift']());}};_0xd16778(++_0x54a287);}(_0x9456,0x71));var _0x6945=function(_0x134764,_0x1f51d4){_0x134764=_0x134764-0x0;var _0xc38e8=_0x9456[_0x134764];return _0xc38e8;};'use strict';var _=require(_0x6945('0x0'));var util=require('util');var logger=require(_0x6945('0x1'))(_0x6945('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6945('0x3'));var fs=require('fs');var path=require(_0x6945('0x4'));var rimraf=require('rimraf');var config=require(_0x6945('0x5'));var attributes=require(_0x6945('0x6'));module[_0x6945('0x7')]=function(_0x1b18b3,_0x51d2de){return _0x1b18b3[_0x6945('0x8')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46a0=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x4d50b4,_0x314aaa){var _0x18bcbf=function(_0x1f251f){while(--_0x1f251f){_0x4d50b4['push'](_0x4d50b4['shift']());}};_0x18bcbf(++_0x314aaa);}(_0x46a0,0x1e2));var _0x046a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x46a0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x046a('0x0'));var util=require(_0x046a('0x1'));var logger=require(_0x046a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x046a('0x3'));var rp=require(_0x046a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x046a('0x5'));var config=require(_0x046a('0x6'));var attributes=require(_0x046a('0x7'));module[_0x046a('0x8')]=function(_0x33af52,_0x27c01b){return _0x33af52[_0x046a('0x9')](_0x046a('0xa'),attributes,{'tableName':_0x046a('0xb'),'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 2a576db..d2f47c3 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 _0xae1c=['stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug'];(function(_0x2bd8f6,_0x362aa7){var _0x1a6654=function(_0x2af856){while(--_0x2af856){_0x2bd8f6['push'](_0x2bd8f6['shift']());}};_0x1a6654(++_0x362aa7);}(_0xae1c,0x15b));var _0xcae1=function(_0x232bd0,_0x459c63){_0x232bd0=_0x232bd0-0x0;var _0x160224=_0xae1c[_0x232bd0];return _0x160224;};'use strict';var _=require('lodash');var util=require(_0xcae1('0x0'));var moment=require(_0xcae1('0x1'));var BPromise=require('bluebird');var rs=require(_0xcae1('0x2'));var fs=require('fs');var Redis=require(_0xcae1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcae1('0x4'));var logger=require(_0xcae1('0x5'))(_0xcae1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcae1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c7c0,_0x376fa0,_0xe7df22){return new BPromise(function(_0x1dd857,_0x4008e9){return client[_0xcae1('0x8')](_0x6c7c0,_0xe7df22)[_0xcae1('0x9')](function(_0xa88241){logger[_0xcae1('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x376fa0,_0xcae1('0xb'));logger[_0xcae1('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x376fa0,_0xcae1('0xb'),JSON[_0xcae1('0xd')](_0xa88241));if(_0xa88241['error']){if(_0xa88241[_0xcae1('0xe')]['code']===0x1f4){logger[_0xcae1('0xe')](_0xcae1('0xf'),_0x376fa0,_0xa88241['error'][_0xcae1('0x10')]);return _0x4008e9(_0xa88241['error'][_0xcae1('0x10')]);}logger[_0xcae1('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x376fa0,_0xa88241[_0xcae1('0xe')][_0xcae1('0x10')]);return _0x1dd857(_0xa88241['error'][_0xcae1('0x10')]);}else{logger[_0xcae1('0xa')](_0xcae1('0xf'),_0x376fa0,_0xcae1('0xb'));_0x1dd857(_0xa88241[_0xcae1('0x11')][_0xcae1('0x10')]);}})['catch'](function(_0x5a49d5){logger[_0xcae1('0xe')](_0xcae1('0xf'),_0x376fa0,_0x5a49d5);_0x4008e9(_0x5a49d5);});});} \ No newline at end of file +var _0x95bb=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4e1349,_0x51a06d){var _0x213e02=function(_0x3b9aff){while(--_0x3b9aff){_0x4e1349['push'](_0x4e1349['shift']());}};_0x213e02(++_0x51a06d);}(_0x95bb,0x1b9));var _0xb95b=function(_0x1c2f07,_0x15e061){_0x1c2f07=_0x1c2f07-0x0;var _0x3771cb=_0x95bb[_0x1c2f07];return _0x3771cb;};'use strict';var _=require(_0xb95b('0x0'));var util=require(_0xb95b('0x1'));var moment=require('moment');var BPromise=require(_0xb95b('0x2'));var rs=require(_0xb95b('0x3'));var fs=require('fs');var Redis=require(_0xb95b('0x4'));var db=require(_0xb95b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb95b('0x6'))('rpc');var config=require(_0xb95b('0x7'));var jayson=require(_0xb95b('0x8'));var client=jayson[_0xb95b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x441657,_0x5d79ea,_0x26e0de){return new BPromise(function(_0x3c210a,_0x46921c){return client[_0xb95b('0xa')](_0x441657,_0x26e0de)[_0xb95b('0xb')](function(_0x3647be){logger['info'](_0xb95b('0xc'),_0x5d79ea,_0xb95b('0xd'));logger[_0xb95b('0xe')](_0xb95b('0xf'),_0x5d79ea,_0xb95b('0xd'),JSON['stringify'](_0x3647be));if(_0x3647be['error']){if(_0x3647be[_0xb95b('0x10')][_0xb95b('0x11')]===0x1f4){logger[_0xb95b('0x10')](_0xb95b('0xc'),_0x5d79ea,_0x3647be[_0xb95b('0x10')]['message']);return _0x46921c(_0x3647be['error']['message']);}logger[_0xb95b('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5d79ea,_0x3647be[_0xb95b('0x10')][_0xb95b('0x12')]);return _0x3c210a(_0x3647be[_0xb95b('0x10')][_0xb95b('0x12')]);}else{logger['info'](_0xb95b('0xc'),_0x5d79ea,_0xb95b('0xd'));_0x3c210a(_0x3647be[_0xb95b('0x13')][_0xb95b('0x12')]);}})[_0xb95b('0x14')](function(_0x286d21){logger['error'](_0xb95b('0xc'),_0x5d79ea,_0x286d21);_0x46921c(_0x286d21);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index c1d5d07..2189a9d 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 _0x0ce1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x114281,_0x23c3f2){var _0x866964=function(_0x43c0f3){while(--_0x43c0f3){_0x114281['push'](_0x114281['shift']());}};_0x866964(++_0x23c3f2);}(_0x0ce1,0x1f3));var _0x10ce=function(_0x4ac5bd,_0x593752){_0x4ac5bd=_0x4ac5bd-0x0;var _0x4256ae=_0x0ce1[_0x4ac5bd];return _0x4256ae;};'use strict';var multer=require(_0x10ce('0x0'));var util=require(_0x10ce('0x1'));var path=require(_0x10ce('0x2'));var timeout=require(_0x10ce('0x3'));var express=require(_0x10ce('0x4'));var router=express[_0x10ce('0x5')]();var fs_extra=require(_0x10ce('0x6'));var auth=require(_0x10ce('0x7'));var interaction=require(_0x10ce('0x8'));var config=require(_0x10ce('0x9'));var controller=require(_0x10ce('0xa'));router[_0x10ce('0xb')]('/',auth['isAuthenticated'](),controller[_0x10ce('0xc')]);router['get'](_0x10ce('0xd'),auth[_0x10ce('0xe')](),controller['show']);router[_0x10ce('0xb')]('/:id/sessions',auth[_0x10ce('0xe')](),controller[_0x10ce('0xf')]);router[_0x10ce('0xb')](_0x10ce('0x10'),auth[_0x10ce('0xe')](),controller[_0x10ce('0x11')]);router[_0x10ce('0xb')]('/:id/summary',auth[_0x10ce('0xe')](),timeout(_0x10ce('0x12')),controller[_0x10ce('0x13')]);router[_0x10ce('0x14')]('/',auth[_0x10ce('0xe')](),controller[_0x10ce('0x15')]);router[_0x10ce('0x14')](_0x10ce('0x16'),auth[_0x10ce('0xe')](),controller[_0x10ce('0x17')]);router[_0x10ce('0x18')](_0x10ce('0xd'),auth[_0x10ce('0xe')](),controller[_0x10ce('0x19')]);router[_0x10ce('0x1a')](_0x10ce('0xd'),auth['isAuthenticated'](),controller[_0x10ce('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa551=['create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post'];(function(_0x45cd48,_0x5821bd){var _0x5aae54=function(_0x437067){while(--_0x437067){_0x45cd48['push'](_0x45cd48['shift']());}};_0x5aae54(++_0x5821bd);}(_0xa551,0x117));var _0x1a55=function(_0x63d169,_0x5969c5){_0x63d169=_0x63d169-0x0;var _0x8b8095=_0xa551[_0x63d169];return _0x8b8095;};'use strict';var multer=require(_0x1a55('0x0'));var util=require(_0x1a55('0x1'));var path=require(_0x1a55('0x2'));var timeout=require(_0x1a55('0x3'));var express=require(_0x1a55('0x4'));var router=express[_0x1a55('0x5')]();var fs_extra=require(_0x1a55('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1a55('0x7'));var config=require('../../config/environment');var controller=require(_0x1a55('0x8'));router[_0x1a55('0x9')]('/',auth[_0x1a55('0xa')](),controller['index']);router[_0x1a55('0x9')](_0x1a55('0xb'),auth[_0x1a55('0xa')](),controller[_0x1a55('0xc')]);router['get'](_0x1a55('0xd'),auth[_0x1a55('0xa')](),controller['getSessions']);router[_0x1a55('0x9')](_0x1a55('0xe'),auth['isAuthenticated'](),controller[_0x1a55('0xf')]);router['get'](_0x1a55('0x10'),auth[_0x1a55('0xa')](),timeout(_0x1a55('0x11')),controller[_0x1a55('0x12')]);router[_0x1a55('0x13')]('/',auth[_0x1a55('0xa')](),controller[_0x1a55('0x14')]);router[_0x1a55('0x13')]('/:id/clone',auth[_0x1a55('0xa')](),controller['clone']);router[_0x1a55('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x1a55('0xb'),auth[_0x1a55('0xa')](),controller[_0x1a55('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 2b940c2..9bd550b 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 _0x62e7=['exports','name','TEXT','isObjectLike','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x3c2084,_0x4d5c7a){var _0x39798c=function(_0x281487){while(--_0x281487){_0x3c2084['push'](_0x3c2084['shift']());}};_0x39798c(++_0x4d5c7a);}(_0x62e7,0xb3));var _0x762e=function(_0x2b2ca2,_0x432095){_0x2b2ca2=_0x2b2ca2-0x0;var _0x1a3f1f=_0x62e7[_0x2b2ca2];return _0x1a3f1f;};'use strict';var Sequelize=require(_0x762e('0x0'));var _=require(_0x762e('0x1'));var util=require(_0x762e('0x2'));module[_0x762e('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x762e('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x762e('0x5')]('long'),'set':function(_0x12ede2){if(_[_0x762e('0x6')](_0x12ede2)){this[_0x762e('0x7')](_0x762e('0x8'),JSON['stringify'](_0x12ede2));}else if(_['isString'](_0x12ede2)){this['setDataValue'](_0x762e('0x8'),_0x12ede2);}else{this['setDataValue'](_0x762e('0x8'),util['format'](_0x762e('0x9'),this['getDataValue']('name')||'',this[_0x762e('0xa')](_0x762e('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x762e('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6931=['setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','exports','STRING','TEXT','long','stringify','isString'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x6931,0x18d));var _0x1693=function(_0x5e1614,_0x4e6feb){_0x5e1614=_0x5e1614-0x0;var _0x17d2ab=_0x6931[_0x5e1614];return _0x17d2ab;};'use strict';var Sequelize=require(_0x1693('0x0'));var _=require(_0x1693('0x1'));var util=require('util');module[_0x1693('0x2')]={'name':{'type':Sequelize[_0x1693('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x1693('0x3')]},'formData':{'type':Sequelize[_0x1693('0x4')](_0x1693('0x5')),'set':function(_0xb2987a){if(_['isObjectLike'](_0xb2987a)){this['setDataValue']('formData',JSON[_0x1693('0x6')](_0xb2987a));}else if(_[_0x1693('0x7')](_0xb2987a)){this[_0x1693('0x8')]('formData',_0xb2987a);}else{this[_0x1693('0x8')]('formData',util[_0x1693('0x9')](_0x1693('0xa'),this[_0x1693('0xb')](_0x1693('0xc'))||'',this[_0x1693('0xb')](_0x1693('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1693('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1693('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a7ec816..9d3826e 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 _0x6132=['isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','fast-json-patch','request-promise','moment','util','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Projects','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','JscriptyProject','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','updatedAt','createdAt','create','getSessions','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push'];(function(_0x275999,_0x142005){var _0x46eec0=function(_0x35b7f1){while(--_0x35b7f1){_0x275999['push'](_0x275999['shift']());}};_0x46eec0(++_0x142005);}(_0x6132,0xf3));var _0x2613=function(_0x349984,_0x5cb1fc){_0x349984=_0x349984-0x0;var _0x2a6bd5=_0x6132[_0x349984];return _0x2a6bd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2613('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2613('0x1'));var rp=require(_0x2613('0x2'));var moment=require(_0x2613('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2613('0x4'));var path=require('path');var sox=require(_0x2613('0x5'));var csv=require('to-csv');var ejs=require(_0x2613('0x6'));var fs=require('fs');var fs_extra=require(_0x2613('0x7'));var _=require(_0x2613('0x8'));var squel=require('squel');var crypto=require(_0x2613('0x9'));var jsforce=require(_0x2613('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2613('0xb'));var Papa=require('papaparse');var Redis=require(_0x2613('0xc'));var authService=require(_0x2613('0xd'));var qs=require(_0x2613('0xe'));var as=require(_0x2613('0xf'));var hardwareService=require(_0x2613('0x10'));var logger=require(_0x2613('0x11'))('api');var utils=require(_0x2613('0x12'));var config=require(_0x2613('0x13'));var licenseUtil=require(_0x2613('0x14'));var db=require(_0x2613('0x15'))['db'];function respondWithStatusCode(_0x5db104,_0x457b23){_0x457b23=_0x457b23||0xcc;return function(_0x1f46c7){if(_0x1f46c7){return _0x5db104[_0x2613('0x16')](_0x457b23);}return _0x5db104[_0x2613('0x17')](_0x457b23)[_0x2613('0x18')]();};}function respondWithResult(_0x18acee,_0x2d7b11){_0x2d7b11=_0x2d7b11||0xc8;return function(_0x2b3e5e){if(_0x2b3e5e){return _0x18acee[_0x2613('0x17')](_0x2d7b11)[_0x2613('0x19')](_0x2b3e5e);}};}function respondWithFilteredResult(_0x23a629,_0x34e96e){return function(_0x20d8a5){if(_0x20d8a5){var _0x441c1e=typeof _0x34e96e[_0x2613('0x1a')]===_0x2613('0x1b')&&typeof _0x34e96e[_0x2613('0x1c')]===_0x2613('0x1b');var _0x405ae3=_0x20d8a5[_0x2613('0x1d')];var _0x32e426=_0x441c1e?0x0:_0x34e96e[_0x2613('0x1a')];var _0x5072e5=_0x441c1e?_0x20d8a5[_0x2613('0x1d')]:_0x34e96e[_0x2613('0x1a')]+_0x34e96e[_0x2613('0x1c')];var _0x283a88;if(_0x5072e5>=_0x405ae3){_0x5072e5=_0x405ae3;_0x283a88=0xc8;}else{_0x283a88=0xce;}_0x23a629[_0x2613('0x17')](_0x283a88);return _0x23a629[_0x2613('0x1e')](_0x2613('0x1f'),_0x32e426+'-'+_0x5072e5+'/'+_0x405ae3)[_0x2613('0x19')](_0x20d8a5);}return null;};}function patchUpdates(_0x41f86d){return function(_0x335bf5){try{jsonpatch[_0x2613('0x20')](_0x335bf5,_0x41f86d,!![]);}catch(_0x48811a){return BPromise[_0x2613('0x21')](_0x48811a);}return _0x335bf5[_0x2613('0x22')]();};}function saveUpdates(_0x112732,_0x55d5c2){return function(_0x1f4368){if(_0x1f4368){return _0x1f4368['update'](_0x112732)[_0x2613('0x23')](function(_0x324697){return _0x324697;});}return null;};}function removeEntity(_0x4654cd,_0x1a84db){return function(_0x1e7e26){if(_0x1e7e26){return _0x1e7e26[_0x2613('0x24')]()[_0x2613('0x23')](function(){var _0x279fcc=_0x1e7e26[_0x2613('0x25')]({'plain':!![]});var _0x1c76dd=_0x2613('0x26');return db['UserProfileResource'][_0x2613('0x24')]({'where':{'type':_0x1c76dd,'resourceId':_0x279fcc['id']}})[_0x2613('0x23')](function(){return _0x1e7e26;});})['then'](function(){_0x4654cd[_0x2613('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x431e45,_0x1359a3){return function(_0x59c751){if(!_0x59c751){_0x431e45[_0x2613('0x16')](0x194);}return _0x59c751;};}function handleError(_0xf92eb9,_0x4da3f5){_0x4da3f5=_0x4da3f5||0x1f4;return function(_0x4dfef6){logger['error'](_0x4dfef6[_0x2613('0x27')]);if(_0x4dfef6['name']){delete _0x4dfef6[_0x2613('0x28')];}_0xf92eb9[_0x2613('0x17')](_0x4da3f5)[_0x2613('0x29')](_0x4dfef6);};}exports[_0x2613('0x2a')]=function(_0x4a6008,_0x124d27){var _0x38519={},_0x217269={},_0x4ea63f={'count':0x0,'rows':[]};var _0x1b9ddd=_[_0x2613('0x2b')](db['JscriptyProject'][_0x2613('0x2c')],function(_0x4c4ecf){return{'name':_0x4c4ecf[_0x2613('0x2d')],'type':_0x4c4ecf['type'][_0x2613('0x2e')]};});_0x217269[_0x2613('0x2f')]=_[_0x2613('0x2b')](_0x1b9ddd,_0x2613('0x28'));_0x217269[_0x2613('0x30')]=_[_0x2613('0x31')](_0x4a6008[_0x2613('0x30')]);_0x217269[_0x2613('0x32')]=_[_0x2613('0x33')](_0x217269[_0x2613('0x2f')],_0x217269[_0x2613('0x30')]);_0x38519['attributes']=_['intersection'](_0x217269[_0x2613('0x2f')],qs['fields'](_0x4a6008['query'][_0x2613('0x34')]));_0x38519[_0x2613('0x35')]=_0x38519[_0x2613('0x35')]['length']?_0x38519['attributes']:_0x217269['model'];if(!_0x4a6008[_0x2613('0x30')][_0x2613('0x36')](_0x2613('0x37'))){_0x38519[_0x2613('0x1c')]=qs[_0x2613('0x1c')](_0x4a6008[_0x2613('0x30')][_0x2613('0x1c')]);_0x38519[_0x2613('0x1a')]=qs[_0x2613('0x1a')](_0x4a6008[_0x2613('0x30')][_0x2613('0x1a')]);}_0x38519[_0x2613('0x38')]=qs[_0x2613('0x39')](_0x4a6008[_0x2613('0x30')][_0x2613('0x39')]);_0x38519[_0x2613('0x3a')]=qs[_0x2613('0x32')](_[_0x2613('0x3b')](_0x4a6008['query'],_0x217269['filters']),_0x1b9ddd);if(_0x4a6008['query']['filter']){_0x38519[_0x2613('0x3a')]=_[_0x2613('0x3c')](_0x38519['where'],{'$or':_['map'](_0x1b9ddd,function(_0x19af11){if(_0x19af11['type']!==_0x2613('0x3d')){var _0x43ff91={};_0x43ff91[_0x19af11[_0x2613('0x28')]]={'$like':'%'+_0x4a6008['query'][_0x2613('0x3e')]+'%'};return _0x43ff91;}})});}_0x38519=_[_0x2613('0x3c')]({},_0x38519,_0x4a6008[_0x2613('0x3f')]);var _0x1e8319={'where':_0x38519[_0x2613('0x3a')]};return db['JscriptyProject']['count'](_0x1e8319)[_0x2613('0x23')](function(_0x1999f1){_0x4ea63f['count']=_0x1999f1;if(_0x4a6008[_0x2613('0x30')][_0x2613('0x40')]){_0x38519[_0x2613('0x41')]=[{'all':!![]}];}return db['JscriptyProject'][_0x2613('0x42')](_0x38519);})[_0x2613('0x23')](function(_0x118dcd){_0x4ea63f[_0x2613('0x43')]=_0x118dcd;return _0x4ea63f;})['then'](respondWithFilteredResult(_0x124d27,_0x38519))['catch'](handleError(_0x124d27,null));};exports[_0x2613('0x44')]=function(_0x5aa59b,_0x444176){var _0x13ae88={'raw':![],'where':{'id':_0x5aa59b[_0x2613('0x45')]['id']}},_0x3f7758={};_0x3f7758[_0x2613('0x2f')]=_[_0x2613('0x31')](db['JscriptyProject'][_0x2613('0x2c')]);_0x3f7758[_0x2613('0x30')]=_['keys'](_0x5aa59b[_0x2613('0x30')]);_0x3f7758[_0x2613('0x32')]=_[_0x2613('0x33')](_0x3f7758[_0x2613('0x2f')],_0x3f7758['query']);_0x13ae88['attributes']=_[_0x2613('0x33')](_0x3f7758[_0x2613('0x2f')],qs[_0x2613('0x34')](_0x5aa59b[_0x2613('0x30')]['fields']));_0x13ae88[_0x2613('0x35')]=_0x13ae88['attributes']['length']?_0x13ae88[_0x2613('0x35')]:_0x3f7758[_0x2613('0x2f')];if(_0x5aa59b[_0x2613('0x30')][_0x2613('0x40')]){_0x13ae88['include']=[{'all':!![]}];}_0x13ae88=_[_0x2613('0x3c')]({},_0x13ae88,_0x5aa59b[_0x2613('0x3f')]);return db[_0x2613('0x46')][_0x2613('0x47')](_0x13ae88)['then'](handleEntityNotFound(_0x444176,null))[_0x2613('0x23')](respondWithResult(_0x444176,null))[_0x2613('0x48')](handleError(_0x444176,null));};exports['create']=function(_0x2a01de,_0x16f6d0){return db[_0x2613('0x46')]['create'](_0x2a01de[_0x2613('0x49')],{})['then'](function(_0xbbec13){var _0x3bb99f=_0x2a01de[_0x2613('0x4a')][_0x2613('0x25')]({'plain':!![]});if(!_0x3bb99f)throw new Error(_0x2613('0x4b'));if(_0x3bb99f[_0x2613('0x4c')]==='user'){var _0x359672=_0xbbec13[_0x2613('0x25')]({'plain':!![]});var _0x13d023=_0x2613('0x26');return db[_0x2613('0x4d')]['find']({'where':{'name':_0x13d023,'userProfileId':_0x3bb99f[_0x2613('0x4e')]},'raw':!![]})[_0x2613('0x23')](function(_0x31e3dd){if(_0x31e3dd&&_0x31e3dd[_0x2613('0x4f')]===0x0){return db[_0x2613('0x50')]['create']({'name':_0x359672[_0x2613('0x28')],'resourceId':_0x359672['id'],'type':_0x31e3dd[_0x2613('0x28')],'sectionId':_0x31e3dd['id']},{})[_0x2613('0x23')](function(){return _0xbbec13;});}else{return _0xbbec13;}})[_0x2613('0x48')](function(_0x3a78fe){logger['error'](_0x2613('0x51'),_0x3a78fe);throw _0x3a78fe;});}return _0xbbec13;})[_0x2613('0x23')](respondWithResult(_0x16f6d0,0xc9))['catch'](handleError(_0x16f6d0,null));};exports[_0x2613('0x52')]=function(_0x1cc06e,_0x50560f){var _0x194907={'where':{'id':_0x1cc06e[_0x2613('0x45')]['id']}},_0x32a661={};_0x32a661['model']=_[_0x2613('0x31')](db[_0x2613('0x46')][_0x2613('0x2c')]);_0x194907[_0x2613('0x35')]=_[_0x2613('0x33')](_0x32a661[_0x2613('0x2f')],qs[_0x2613('0x34')](_0x1cc06e[_0x2613('0x30')][_0x2613('0x34')]));_0x194907['attributes']=_0x194907['attributes'][_0x2613('0x53')]?_0x194907[_0x2613('0x35')]:_0x32a661[_0x2613('0x2f')];if(_0x1cc06e['query'][_0x2613('0x40')]){_0x194907[_0x2613('0x41')]=[{'all':!![]}];}_0x194907=_['merge']({},_0x194907,_0x1cc06e[_0x2613('0x3f')]);return db[_0x2613('0x46')][_0x2613('0x47')](_0x194907)[_0x2613('0x23')](handleEntityNotFound(_0x50560f,null))[_0x2613('0x23')](function(_0x30b6bb){if(_0x30b6bb){var _0x2bc548=_0x30b6bb['get']({'plain':!![]});_0x2bc548=qs[_0x2613('0x54')](_0x2bc548,['id','createdAt',_0x2613('0x55')]);_0x1cc06e['body']=_[_0x2613('0x54')](_0x1cc06e['body'],['id',_0x2613('0x56'),_0x2613('0x55')]);return db[_0x2613('0x46')][_0x2613('0x57')](_[_0x2613('0x3c')](_0x2bc548,_0x1cc06e['body']),{'include':_0x1cc06e[_0x2613('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x2613('0x23')](function(_0xb700af){var _0x1e3248=_0x1cc06e['user'][_0x2613('0x25')]({'plain':!![]});if(!_0x1e3248)throw new Error(_0x2613('0x4b'));if(_0x1e3248[_0x2613('0x4c')]===_0x2613('0x4a')){var _0x312c16=_0xb700af[_0x2613('0x25')]({'plain':!![]});var _0x538024='Projects';return db['UserProfileSection'][_0x2613('0x47')]({'where':{'name':_0x538024,'userProfileId':_0x1e3248['userProfileId']},'raw':!![]})['then'](function(_0x3ab911){if(_0x3ab911&&_0x3ab911[_0x2613('0x4f')]===0x0){return db[_0x2613('0x50')][_0x2613('0x57')]({'name':_0x312c16[_0x2613('0x28')],'resourceId':_0x312c16['id'],'type':_0x3ab911[_0x2613('0x28')],'sectionId':_0x3ab911['id']},{})['then'](function(){return _0xb700af;});}else{return _0xb700af;}})['catch'](function(_0x2df5cc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2df5cc);throw _0x2df5cc;});}return _0xb700af;});}})[_0x2613('0x23')](respondWithResult(_0x50560f,0xc9))[_0x2613('0x48')](handleError(_0x50560f,null));};exports['update']=function(_0x2f1f8a,_0x1090eb){if(_0x2f1f8a[_0x2613('0x49')]['id']){delete _0x2f1f8a[_0x2613('0x49')]['id'];}return db[_0x2613('0x46')][_0x2613('0x47')]({'where':{'id':_0x2f1f8a[_0x2613('0x45')]['id']}})['then'](handleEntityNotFound(_0x1090eb,null))[_0x2613('0x23')](saveUpdates(_0x2f1f8a[_0x2613('0x49')],null))['then'](respondWithResult(_0x1090eb,null))[_0x2613('0x48')](handleError(_0x1090eb,null));};exports[_0x2613('0x24')]=function(_0x9affdb,_0x142578){return db[_0x2613('0x46')]['find']({'where':{'id':_0x9affdb[_0x2613('0x45')]['id']}})[_0x2613('0x23')](handleEntityNotFound(_0x142578,null))[_0x2613('0x23')](removeEntity(_0x142578,null))[_0x2613('0x48')](handleError(_0x142578,null));};exports[_0x2613('0x58')]=function(_0x5467bd,_0x5c1e9d,_0x83b8fb){var _0x156edb={'raw':!![],'where':{}};var _0xe99b44={};var _0x1b5f8f={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x5467bd['params']['id']}})[_0x2613('0x23')](handleEntityNotFound(_0x5c1e9d,null))['then'](function(_0x2dcc84){if(_0x2dcc84){_0xe99b44[_0x2613('0x2f')]=_[_0x2613('0x31')](db['JscriptySessionReport']['rawAttributes']);_0xe99b44[_0x2613('0x30')]=_[_0x2613('0x31')](_0x5467bd['query']);_0xe99b44[_0x2613('0x32')]=_[_0x2613('0x33')](_0xe99b44[_0x2613('0x2f')],_0xe99b44[_0x2613('0x30')]);_0x156edb[_0x2613('0x35')]=_[_0x2613('0x33')](_0xe99b44[_0x2613('0x2f')],qs[_0x2613('0x34')](_0x5467bd['query'][_0x2613('0x34')]));_0x156edb[_0x2613('0x35')]=_0x156edb[_0x2613('0x35')][_0x2613('0x53')]?_0x156edb[_0x2613('0x35')]:_0xe99b44[_0x2613('0x2f')];if(!_0x5467bd[_0x2613('0x30')][_0x2613('0x36')](_0x2613('0x37'))){_0x156edb[_0x2613('0x1c')]=qs[_0x2613('0x1c')](_0x5467bd['query'][_0x2613('0x1c')]);_0x156edb[_0x2613('0x1a')]=qs['offset'](_0x5467bd[_0x2613('0x30')][_0x2613('0x1a')]);}_0x156edb['order']=qs['sort'](_0x5467bd[_0x2613('0x30')][_0x2613('0x39')]);_0x156edb[_0x2613('0x3a')]=qs[_0x2613('0x32')](_['pick'](_0x5467bd[_0x2613('0x30')],_0xe99b44[_0x2613('0x32')]));_0x156edb[_0x2613('0x3a')][_0x2613('0x59')]=_0x2dcc84['id'];if(_0x5467bd[_0x2613('0x30')][_0x2613('0x3e')]){_0x156edb[_0x2613('0x3a')]=_['merge'](_0x156edb[_0x2613('0x3a')],{'$or':_[_0x2613('0x2b')](_0x156edb['attributes'],function(_0x3c9930){var _0xb4981d={};_0xb4981d[_0x3c9930]={'$like':'%'+_0x5467bd[_0x2613('0x30')][_0x2613('0x3e')]+'%'};return _0xb4981d;})});}_0x156edb=_[_0x2613('0x3c')]({},_0x156edb,_0x5467bd[_0x2613('0x3f')]);return db[_0x2613('0x5a')][_0x2613('0x1d')]({'where':_0x156edb['where']})[_0x2613('0x23')](function(_0x12af1c){_0x1b5f8f[_0x2613('0x1d')]=_0x12af1c;if(_0x5467bd[_0x2613('0x30')][_0x2613('0x40')]){_0x156edb['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2613('0x42')](_0x156edb);})[_0x2613('0x23')](function(_0x3e8023){_0x1b5f8f[_0x2613('0x43')]=_0x3e8023;return _0x1b5f8f;});}})[_0x2613('0x23')](respondWithFilteredResult(_0x5c1e9d,_0x156edb))[_0x2613('0x48')](handleError(_0x5c1e9d,null));};exports[_0x2613('0x5b')]=function(_0x57512d,_0x3e79fb,_0x1a5445){var _0x5db85a={'raw':!![],'where':{}};var _0x2b2899={};var _0x4212c5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x2613('0x5c')]({'where':{'id':_0x57512d['params']['id']}})['then'](handleEntityNotFound(_0x3e79fb,null))[_0x2613('0x23')](function(_0x1ccd90){if(_0x1ccd90){_0x2b2899['model']=_['keys'](db['JscriptyAnswerReport'][_0x2613('0x2c')]);_0x2b2899[_0x2613('0x30')]=_[_0x2613('0x31')](_0x57512d[_0x2613('0x30')]);_0x2b2899[_0x2613('0x32')]=_[_0x2613('0x33')](_0x2b2899['model'],_0x2b2899['query']);_0x5db85a['attributes']=_[_0x2613('0x33')](_0x2b2899[_0x2613('0x2f')],qs[_0x2613('0x34')](_0x57512d[_0x2613('0x30')][_0x2613('0x34')]));_0x5db85a[_0x2613('0x35')]=_0x5db85a[_0x2613('0x35')]['length']?_0x5db85a[_0x2613('0x35')]:_0x2b2899[_0x2613('0x2f')];if(!_0x57512d[_0x2613('0x30')][_0x2613('0x36')](_0x2613('0x37'))){_0x5db85a[_0x2613('0x1c')]=qs[_0x2613('0x1c')](_0x57512d[_0x2613('0x30')][_0x2613('0x1c')]);_0x5db85a[_0x2613('0x1a')]=qs[_0x2613('0x1a')](_0x57512d[_0x2613('0x30')]['offset']);}_0x5db85a['order']=qs[_0x2613('0x39')](_0x57512d[_0x2613('0x30')][_0x2613('0x39')]);_0x5db85a['where']=qs[_0x2613('0x32')](_[_0x2613('0x3b')](_0x57512d[_0x2613('0x30')],_0x2b2899[_0x2613('0x32')]));_0x5db85a[_0x2613('0x3a')][_0x2613('0x59')]=_0x1ccd90['id'];if(_0x57512d[_0x2613('0x30')][_0x2613('0x3e')]){_0x5db85a[_0x2613('0x3a')]=_[_0x2613('0x3c')](_0x5db85a['where'],{'$or':_[_0x2613('0x2b')](_0x5db85a[_0x2613('0x35')],function(_0x2f2ace){var _0x3e2c30={};_0x3e2c30[_0x2f2ace]={'$like':'%'+_0x57512d[_0x2613('0x30')][_0x2613('0x3e')]+'%'};return _0x3e2c30;})});}_0x5db85a=_[_0x2613('0x3c')]({},_0x5db85a,_0x57512d[_0x2613('0x3f')]);return db[_0x2613('0x5d')][_0x2613('0x1d')]({'where':_0x5db85a[_0x2613('0x3a')]})['then'](function(_0x5b22ea){_0x4212c5['count']=_0x5b22ea;if(_0x57512d[_0x2613('0x30')][_0x2613('0x40')]){_0x5db85a[_0x2613('0x41')]=[{'all':!![]}];}return db[_0x2613('0x5d')][_0x2613('0x42')](_0x5db85a);})[_0x2613('0x23')](function(_0x529461){_0x4212c5[_0x2613('0x43')]=_0x529461;return _0x4212c5;});}})['then'](respondWithFilteredResult(_0x3e79fb,_0x5db85a))[_0x2613('0x48')](handleError(_0x3e79fb,null));};function char(_0x3b86da){return'number'===typeof _0x3b86da?String[_0x2613('0x5e')][_0x2613('0x20')](null,arguments):_0x3b86da;}function needsEncapsulation(_0x12f120){return!!_0x12f120&&(_0x12f120[_0x2613('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x12f120[_0x2613('0x5f')]()[_0x2613('0x60')](char(0xa))>=0x0||_0x12f120['toString']()[_0x2613('0x60')](char(0x2c))>=0x0||_0x12f120[_0x2613('0x5f')]()[_0x2613('0x60')](char(0x22))>=0x0);}function encapsulate(_0x1b4e81){var _0x2cdb36=char(0x22),_0x1e9bf1='\x5c'+char(0x22),_0x46dffe=_0x1b4e81[_0x2613('0x5f')]()[_0x2613('0x61')](new RegExp(_0x2cdb36,'g'),_0x1e9bf1);return _0x2cdb36+_0x46dffe+_0x2cdb36;}exports[_0x2613('0x62')]=function(_0xe07026,_0x5411b3,_0x2b2774){var _0x1fdfed,_0x54bab2;var _0x33f5aa={'where':{'ProjectId':_0xe07026['params']['id']}};if(_0xe07026[_0x2613('0x30')][_0x2613('0x63')]){_0x33f5aa['where'][_0x2613('0x64')]=JSON[_0x2613('0x65')](_0xe07026[_0x2613('0x30')][_0x2613('0x63')]);}return db[_0x2613('0x5a')][_0x2613('0x42')](_0x33f5aa)['then'](handleEntityNotFound(_0x5411b3,null))[_0x2613('0x23')](function(_0x2ebf94){if(_0x2ebf94){_0x1fdfed=_0x2ebf94;return db[_0x2613('0x66')][_0x2613('0x42')]({'where':{'SessionId':{'$in':_['map'](_0x1fdfed,'id')},'ProjectId':_0xe07026['params']['id']},'order':'-createdAt'});}})[_0x2613('0x23')](handleEntityNotFound(_0x5411b3,null))[_0x2613('0x23')](function(_0x2c0ebf){if(_0x2c0ebf){_0x54bab2=_0x2c0ebf;var _0xba19c={};for(var _0xb8cbc3=0x0,_0xe5e633=_0x54bab2['length'];_0xb8cbc3<_0xe5e633;_0xb8cbc3++){if(!_0xba19c[_0x2613('0x36')](_0x54bab2[_0xb8cbc3][_0x2613('0x67')])){_0xba19c[_0x54bab2[_0xb8cbc3][_0x2613('0x67')]]=needsEncapsulation(_0x54bab2[_0xb8cbc3]['question'])?encapsulate(_0x54bab2[_0xb8cbc3][_0x2613('0x68')]):_0x54bab2[_0xb8cbc3][_0x2613('0x68')];}}var _0xf046ad=[],_0x550134={};for(var _0x459a62=0x0,_0x35a439=_0x1fdfed[_0x2613('0x53')];_0x459a62<_0x35a439;_0x459a62++){_0x550134={'ProjectId':_0xe07026[_0x2613('0x45')]['id'],'SessionId':_0x1fdfed[_0x459a62]['id'],'StartTime':moment(_0x1fdfed[_0x459a62][_0x2613('0x64')])[_0x2613('0x69')](_0x2613('0x6a'))};for(var _0x5f5163=0x0,_0x557bba=_0x54bab2[_0x2613('0x53')];_0x5f5163<_0x557bba;_0x5f5163++){if(_0x54bab2[_0x5f5163]['SessionId']==_0x1fdfed[_0x459a62]['id']&&_0xba19c[_0x2613('0x36')](_0x54bab2[_0x5f5163]['questionId'])){_0x550134[_0xba19c[_0x54bab2[_0x5f5163][_0x2613('0x67')]]]=_0x54bab2[_0x5f5163]['answer'];}}for(var _0x12336c in _0xba19c){if(!_0x550134[_0x2613('0x36')](_0xba19c[_0x12336c])){_0x550134[_0xba19c[_0x12336c]]=null;}}_0xf046ad[_0x2613('0x6b')](_0x550134);}return _0xf046ad;}})['then'](function(_0x84fda0){if(!_[_0x2613('0x6c')](_0x84fda0)){var _0x1c3f7c=toCsv(_0x84fda0);var _0x20c9d6=Date['now']();fs['writeFileSync'](util[_0x2613('0x69')](_0x2613('0x6d'),_0xe07026[_0x2613('0x45')]['id'],_0x20c9d6),_0x1c3f7c);_0x5411b3[_0x2613('0x6e')](_0x2613('0x6f'),_0x2613('0x70')+util[_0x2613('0x69')](_0x2613('0x71'),_0xe07026[_0x2613('0x45')]['id'],_0x20c9d6));_0x5411b3['setHeader'](_0x2613('0x72'),_0x2613('0x73'));return _0x5411b3[_0x2613('0x74')](util[_0x2613('0x69')](_0x2613('0x6d'),_0xe07026[_0x2613('0x45')]['id'],_0x20c9d6));}else{return _0x5411b3[_0x2613('0x16')](0xcc);}})[_0x2613('0x48')](handleError(_0x5411b3,null));}; \ No newline at end of file +var _0xbb84=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','end','stack','name','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getSessions','JscriptySessionReport','nolimit','order','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','pick','fromCharCode','indexOf','toString','getSummary','starttime','parse','startTime','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','Content-disposition','format','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3d73ff,_0x2c5bb9){var _0x150650=function(_0x4439dd){while(--_0x4439dd){_0x3d73ff['push'](_0x3d73ff['shift']());}};_0x150650(++_0x2c5bb9);}(_0xbb84,0x158));var _0x4bb8=function(_0x530e38,_0x5f1d0f){_0x530e38=_0x530e38-0x0;var _0x4b6a58=_0xbb84[_0x530e38];return _0x4b6a58;};'use strict';var emlformat=require(_0x4bb8('0x0'));var rimraf=require(_0x4bb8('0x1'));var zipdir=require(_0x4bb8('0x2'));var jsonpatch=require(_0x4bb8('0x3'));var rp=require('request-promise');var moment=require(_0x4bb8('0x4'));var BPromise=require(_0x4bb8('0x5'));var Mustache=require(_0x4bb8('0x6'));var util=require(_0x4bb8('0x7'));var path=require(_0x4bb8('0x8'));var sox=require(_0x4bb8('0x9'));var csv=require(_0x4bb8('0xa'));var ejs=require(_0x4bb8('0xb'));var fs=require('fs');var fs_extra=require(_0x4bb8('0xc'));var _=require(_0x4bb8('0xd'));var squel=require(_0x4bb8('0xe'));var crypto=require(_0x4bb8('0xf'));var jsforce=require(_0x4bb8('0x10'));var deskjs=require(_0x4bb8('0x11'));var toCsv=require(_0x4bb8('0xa'));var querystring=require(_0x4bb8('0x12'));var Papa=require(_0x4bb8('0x13'));var Redis=require(_0x4bb8('0x14'));var authService=require(_0x4bb8('0x15'));var qs=require(_0x4bb8('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bb8('0x17'));var logger=require(_0x4bb8('0x18'))(_0x4bb8('0x19'));var utils=require(_0x4bb8('0x1a'));var config=require(_0x4bb8('0x1b'));var licenseUtil=require(_0x4bb8('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe52b4f,_0x2ab008){_0x2ab008=_0x2ab008||0xcc;return function(_0x5e838d){if(_0x5e838d){return _0xe52b4f[_0x4bb8('0x1d')](_0x2ab008);}return _0xe52b4f[_0x4bb8('0x1e')](_0x2ab008)['end']();};}function respondWithResult(_0xf37ce0,_0x3f1bd9){_0x3f1bd9=_0x3f1bd9||0xc8;return function(_0x10c975){if(_0x10c975){return _0xf37ce0['status'](_0x3f1bd9)[_0x4bb8('0x1f')](_0x10c975);}};}function respondWithFilteredResult(_0x40b300,_0x5be06b){return function(_0x474c33){if(_0x474c33){var _0x1529b3=typeof _0x5be06b[_0x4bb8('0x20')]===_0x4bb8('0x21')&&typeof _0x5be06b[_0x4bb8('0x22')]===_0x4bb8('0x21');var _0x4ad2b7=_0x474c33[_0x4bb8('0x23')];var _0x301810=_0x1529b3?0x0:_0x5be06b[_0x4bb8('0x20')];var _0x584d82=_0x1529b3?_0x474c33[_0x4bb8('0x23')]:_0x5be06b[_0x4bb8('0x20')]+_0x5be06b[_0x4bb8('0x22')];var _0x5955e9;if(_0x584d82>=_0x4ad2b7){_0x584d82=_0x4ad2b7;_0x5955e9=0xc8;}else{_0x5955e9=0xce;}_0x40b300['status'](_0x5955e9);return _0x40b300['set'](_0x4bb8('0x24'),_0x301810+'-'+_0x584d82+'/'+_0x4ad2b7)[_0x4bb8('0x1f')](_0x474c33);}return null;};}function patchUpdates(_0x14a2cb){return function(_0x5eb5c4){try{jsonpatch[_0x4bb8('0x25')](_0x5eb5c4,_0x14a2cb,!![]);}catch(_0xf8df27){return BPromise[_0x4bb8('0x26')](_0xf8df27);}return _0x5eb5c4['save']();};}function saveUpdates(_0x307ac7,_0x45474d){return function(_0x3fa907){if(_0x3fa907){return _0x3fa907[_0x4bb8('0x27')](_0x307ac7)['then'](function(_0x5e3507){return _0x5e3507;});}return null;};}function removeEntity(_0x4afb5d,_0x2a1556){return function(_0x2dfe9b){if(_0x2dfe9b){return _0x2dfe9b[_0x4bb8('0x28')]()[_0x4bb8('0x29')](function(){var _0x479018=_0x2dfe9b[_0x4bb8('0x2a')]({'plain':!![]});var _0x178ce5='Projects';return db[_0x4bb8('0x2b')][_0x4bb8('0x28')]({'where':{'type':_0x178ce5,'resourceId':_0x479018['id']}})[_0x4bb8('0x29')](function(){return _0x2dfe9b;});})[_0x4bb8('0x29')](function(){_0x4afb5d['status'](0xcc)[_0x4bb8('0x2c')]();});}};}function handleEntityNotFound(_0x57f3c1,_0xa5972c){return function(_0x47e463){if(!_0x47e463){_0x57f3c1[_0x4bb8('0x1d')](0x194);}return _0x47e463;};}function handleError(_0xaa4d2d,_0x29aba6){_0x29aba6=_0x29aba6||0x1f4;return function(_0x4614f8){logger['error'](_0x4614f8[_0x4bb8('0x2d')]);if(_0x4614f8['name']){delete _0x4614f8[_0x4bb8('0x2e')];}_0xaa4d2d[_0x4bb8('0x1e')](_0x29aba6)['send'](_0x4614f8);};}exports[_0x4bb8('0x2f')]=function(_0x2f7d55,_0x2475c8){var _0x1d2e4a={},_0x52975c={},_0x3f5acf={'count':0x0,'rows':[]};var _0x4147c3=_['map'](db[_0x4bb8('0x30')][_0x4bb8('0x31')],function(_0x162bb8){return{'name':_0x162bb8[_0x4bb8('0x32')],'type':_0x162bb8[_0x4bb8('0x33')][_0x4bb8('0x34')]};});_0x52975c[_0x4bb8('0x35')]=_[_0x4bb8('0x36')](_0x4147c3,_0x4bb8('0x2e'));_0x52975c['query']=_['keys'](_0x2f7d55[_0x4bb8('0x37')]);_0x52975c[_0x4bb8('0x38')]=_[_0x4bb8('0x39')](_0x52975c[_0x4bb8('0x35')],_0x52975c[_0x4bb8('0x37')]);_0x1d2e4a[_0x4bb8('0x3a')]=_[_0x4bb8('0x39')](_0x52975c[_0x4bb8('0x35')],qs['fields'](_0x2f7d55[_0x4bb8('0x37')][_0x4bb8('0x3b')]));_0x1d2e4a[_0x4bb8('0x3a')]=_0x1d2e4a[_0x4bb8('0x3a')][_0x4bb8('0x3c')]?_0x1d2e4a[_0x4bb8('0x3a')]:_0x52975c[_0x4bb8('0x35')];if(!_0x2f7d55['query'][_0x4bb8('0x3d')]('nolimit')){_0x1d2e4a[_0x4bb8('0x22')]=qs['limit'](_0x2f7d55[_0x4bb8('0x37')][_0x4bb8('0x22')]);_0x1d2e4a['offset']=qs['offset'](_0x2f7d55[_0x4bb8('0x37')][_0x4bb8('0x20')]);}_0x1d2e4a['order']=qs[_0x4bb8('0x3e')](_0x2f7d55[_0x4bb8('0x37')]['sort']);_0x1d2e4a[_0x4bb8('0x3f')]=qs[_0x4bb8('0x38')](_['pick'](_0x2f7d55[_0x4bb8('0x37')],_0x52975c[_0x4bb8('0x38')]),_0x4147c3);if(_0x2f7d55[_0x4bb8('0x37')][_0x4bb8('0x40')]){_0x1d2e4a[_0x4bb8('0x3f')]=_[_0x4bb8('0x41')](_0x1d2e4a[_0x4bb8('0x3f')],{'$or':_[_0x4bb8('0x36')](_0x4147c3,function(_0x47bab2){if(_0x47bab2[_0x4bb8('0x33')]!==_0x4bb8('0x42')){var _0x8a30a9={};_0x8a30a9[_0x47bab2[_0x4bb8('0x2e')]]={'$like':'%'+_0x2f7d55[_0x4bb8('0x37')]['filter']+'%'};return _0x8a30a9;}})});}_0x1d2e4a=_[_0x4bb8('0x41')]({},_0x1d2e4a,_0x2f7d55[_0x4bb8('0x43')]);var _0x1eb43a={'where':_0x1d2e4a[_0x4bb8('0x3f')]};return db[_0x4bb8('0x30')][_0x4bb8('0x23')](_0x1eb43a)[_0x4bb8('0x29')](function(_0x47f27e){_0x3f5acf['count']=_0x47f27e;if(_0x2f7d55[_0x4bb8('0x37')][_0x4bb8('0x44')]){_0x1d2e4a[_0x4bb8('0x45')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x1d2e4a);})['then'](function(_0x1a5e60){_0x3f5acf[_0x4bb8('0x46')]=_0x1a5e60;return _0x3f5acf;})[_0x4bb8('0x29')](respondWithFilteredResult(_0x2475c8,_0x1d2e4a))[_0x4bb8('0x47')](handleError(_0x2475c8,null));};exports[_0x4bb8('0x48')]=function(_0x3d3679,_0xf1d8bb){var _0x245804={'raw':![],'where':{'id':_0x3d3679[_0x4bb8('0x49')]['id']}},_0x4ca263={};_0x4ca263[_0x4bb8('0x35')]=_[_0x4bb8('0x4a')](db[_0x4bb8('0x30')][_0x4bb8('0x31')]);_0x4ca263[_0x4bb8('0x37')]=_[_0x4bb8('0x4a')](_0x3d3679[_0x4bb8('0x37')]);_0x4ca263['filters']=_[_0x4bb8('0x39')](_0x4ca263[_0x4bb8('0x35')],_0x4ca263['query']);_0x245804[_0x4bb8('0x3a')]=_[_0x4bb8('0x39')](_0x4ca263[_0x4bb8('0x35')],qs['fields'](_0x3d3679[_0x4bb8('0x37')]['fields']));_0x245804['attributes']=_0x245804[_0x4bb8('0x3a')][_0x4bb8('0x3c')]?_0x245804[_0x4bb8('0x3a')]:_0x4ca263[_0x4bb8('0x35')];if(_0x3d3679[_0x4bb8('0x37')][_0x4bb8('0x44')]){_0x245804['include']=[{'all':!![]}];}_0x245804=_[_0x4bb8('0x41')]({},_0x245804,_0x3d3679[_0x4bb8('0x43')]);return db[_0x4bb8('0x30')][_0x4bb8('0x4b')](_0x245804)['then'](handleEntityNotFound(_0xf1d8bb,null))[_0x4bb8('0x29')](respondWithResult(_0xf1d8bb,null))[_0x4bb8('0x47')](handleError(_0xf1d8bb,null));};exports[_0x4bb8('0x4c')]=function(_0x8ce65,_0x260fa2){return db['JscriptyProject'][_0x4bb8('0x4c')](_0x8ce65[_0x4bb8('0x4d')],{})[_0x4bb8('0x29')](function(_0x67963b){var _0x17fc20=_0x8ce65[_0x4bb8('0x4e')][_0x4bb8('0x2a')]({'plain':!![]});if(!_0x17fc20)throw new Error(_0x4bb8('0x4f'));if(_0x17fc20['role']==='user'){var _0x4e0c22=_0x67963b[_0x4bb8('0x2a')]({'plain':!![]});var _0x3e18ee=_0x4bb8('0x50');return db[_0x4bb8('0x51')]['find']({'where':{'name':_0x3e18ee,'userProfileId':_0x17fc20['userProfileId']},'raw':!![]})[_0x4bb8('0x29')](function(_0x313d09){if(_0x313d09&&_0x313d09[_0x4bb8('0x52')]===0x0){return db[_0x4bb8('0x2b')]['create']({'name':_0x4e0c22[_0x4bb8('0x2e')],'resourceId':_0x4e0c22['id'],'type':_0x313d09['name'],'sectionId':_0x313d09['id']},{})['then'](function(){return _0x67963b;});}else{return _0x67963b;}})[_0x4bb8('0x47')](function(_0x49211b){logger['error'](_0x4bb8('0x53'),_0x49211b);throw _0x49211b;});}return _0x67963b;})[_0x4bb8('0x29')](respondWithResult(_0x260fa2,0xc9))[_0x4bb8('0x47')](handleError(_0x260fa2,null));};exports[_0x4bb8('0x54')]=function(_0x32ebe5,_0x16c025){var _0x5250e8={'where':{'id':_0x32ebe5[_0x4bb8('0x49')]['id']}},_0x42c7af={};_0x42c7af['model']=_[_0x4bb8('0x4a')](db[_0x4bb8('0x30')][_0x4bb8('0x31')]);_0x5250e8[_0x4bb8('0x3a')]=_[_0x4bb8('0x39')](_0x42c7af[_0x4bb8('0x35')],qs[_0x4bb8('0x3b')](_0x32ebe5[_0x4bb8('0x37')][_0x4bb8('0x3b')]));_0x5250e8[_0x4bb8('0x3a')]=_0x5250e8[_0x4bb8('0x3a')][_0x4bb8('0x3c')]?_0x5250e8[_0x4bb8('0x3a')]:_0x42c7af[_0x4bb8('0x35')];if(_0x32ebe5[_0x4bb8('0x37')][_0x4bb8('0x44')]){_0x5250e8[_0x4bb8('0x45')]=[{'all':!![]}];}_0x5250e8=_[_0x4bb8('0x41')]({},_0x5250e8,_0x32ebe5[_0x4bb8('0x43')]);return db[_0x4bb8('0x30')][_0x4bb8('0x4b')](_0x5250e8)[_0x4bb8('0x29')](handleEntityNotFound(_0x16c025,null))[_0x4bb8('0x29')](function(_0x1231cd){if(_0x1231cd){var _0x3e9ace=_0x1231cd[_0x4bb8('0x2a')]({'plain':!![]});_0x3e9ace=qs[_0x4bb8('0x55')](_0x3e9ace,['id','createdAt','updatedAt']);_0x32ebe5[_0x4bb8('0x4d')]=_[_0x4bb8('0x55')](_0x32ebe5[_0x4bb8('0x4d')],['id',_0x4bb8('0x56'),_0x4bb8('0x57')]);return db[_0x4bb8('0x30')]['create'](_[_0x4bb8('0x41')](_0x3e9ace,_0x32ebe5[_0x4bb8('0x4d')]),{'include':_0x32ebe5[_0x4bb8('0x37')][_0x4bb8('0x44')]?[{'all':!![]}]:undefined})[_0x4bb8('0x29')](function(_0x81b9c7){var _0x5e1cfa=_0x32ebe5[_0x4bb8('0x4e')][_0x4bb8('0x2a')]({'plain':!![]});if(!_0x5e1cfa)throw new Error(_0x4bb8('0x4f'));if(_0x5e1cfa[_0x4bb8('0x58')]===_0x4bb8('0x4e')){var _0x26a6c=_0x81b9c7[_0x4bb8('0x2a')]({'plain':!![]});var _0x17478b=_0x4bb8('0x50');return db[_0x4bb8('0x51')][_0x4bb8('0x4b')]({'where':{'name':_0x17478b,'userProfileId':_0x5e1cfa['userProfileId']},'raw':!![]})[_0x4bb8('0x29')](function(_0x15622d){if(_0x15622d&&_0x15622d['autoAssociation']===0x0){return db[_0x4bb8('0x2b')][_0x4bb8('0x4c')]({'name':_0x26a6c[_0x4bb8('0x2e')],'resourceId':_0x26a6c['id'],'type':_0x15622d[_0x4bb8('0x2e')],'sectionId':_0x15622d['id']},{})[_0x4bb8('0x29')](function(){return _0x81b9c7;});}else{return _0x81b9c7;}})[_0x4bb8('0x47')](function(_0x6c6aeb){logger['error'](_0x4bb8('0x53'),_0x6c6aeb);throw _0x6c6aeb;});}return _0x81b9c7;});}})[_0x4bb8('0x29')](respondWithResult(_0x16c025,0xc9))[_0x4bb8('0x47')](handleError(_0x16c025,null));};exports['update']=function(_0x330ceb,_0x18885c){if(_0x330ceb['body']['id']){delete _0x330ceb[_0x4bb8('0x4d')]['id'];}return db[_0x4bb8('0x30')]['find']({'where':{'id':_0x330ceb[_0x4bb8('0x49')]['id']}})[_0x4bb8('0x29')](handleEntityNotFound(_0x18885c,null))[_0x4bb8('0x29')](saveUpdates(_0x330ceb['body'],null))[_0x4bb8('0x29')](respondWithResult(_0x18885c,null))[_0x4bb8('0x47')](handleError(_0x18885c,null));};exports[_0x4bb8('0x28')]=function(_0x5771ae,_0x447b02){return db[_0x4bb8('0x30')]['find']({'where':{'id':_0x5771ae['params']['id']}})[_0x4bb8('0x29')](handleEntityNotFound(_0x447b02,null))[_0x4bb8('0x29')](removeEntity(_0x447b02,null))['catch'](handleError(_0x447b02,null));};exports[_0x4bb8('0x59')]=function(_0x43c043,_0x2a0b35,_0x2a628b){var _0x258c56={'raw':!![],'where':{}};var _0x56a257={};var _0x1bcc7e={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x43c043[_0x4bb8('0x49')]['id']}})[_0x4bb8('0x29')](handleEntityNotFound(_0x2a0b35,null))['then'](function(_0x1eb607){if(_0x1eb607){_0x56a257[_0x4bb8('0x35')]=_['keys'](db[_0x4bb8('0x5a')][_0x4bb8('0x31')]);_0x56a257['query']=_['keys'](_0x43c043['query']);_0x56a257['filters']=_[_0x4bb8('0x39')](_0x56a257[_0x4bb8('0x35')],_0x56a257[_0x4bb8('0x37')]);_0x258c56[_0x4bb8('0x3a')]=_['intersection'](_0x56a257[_0x4bb8('0x35')],qs['fields'](_0x43c043[_0x4bb8('0x37')][_0x4bb8('0x3b')]));_0x258c56[_0x4bb8('0x3a')]=_0x258c56[_0x4bb8('0x3a')][_0x4bb8('0x3c')]?_0x258c56[_0x4bb8('0x3a')]:_0x56a257[_0x4bb8('0x35')];if(!_0x43c043[_0x4bb8('0x37')]['hasOwnProperty'](_0x4bb8('0x5b'))){_0x258c56[_0x4bb8('0x22')]=qs['limit'](_0x43c043[_0x4bb8('0x37')]['limit']);_0x258c56[_0x4bb8('0x20')]=qs['offset'](_0x43c043[_0x4bb8('0x37')]['offset']);}_0x258c56[_0x4bb8('0x5c')]=qs[_0x4bb8('0x3e')](_0x43c043[_0x4bb8('0x37')]['sort']);_0x258c56[_0x4bb8('0x3f')]=qs[_0x4bb8('0x38')](_['pick'](_0x43c043[_0x4bb8('0x37')],_0x56a257[_0x4bb8('0x38')]));_0x258c56['where'][_0x4bb8('0x5d')]=_0x1eb607['id'];if(_0x43c043[_0x4bb8('0x37')]['filter']){_0x258c56['where']=_[_0x4bb8('0x41')](_0x258c56[_0x4bb8('0x3f')],{'$or':_[_0x4bb8('0x36')](_0x258c56[_0x4bb8('0x3a')],function(_0x58f82c){var _0xedc25d={};_0xedc25d[_0x58f82c]={'$like':'%'+_0x43c043[_0x4bb8('0x37')][_0x4bb8('0x40')]+'%'};return _0xedc25d;})});}_0x258c56=_[_0x4bb8('0x41')]({},_0x258c56,_0x43c043['options']);return db[_0x4bb8('0x5a')]['count']({'where':_0x258c56[_0x4bb8('0x3f')]})[_0x4bb8('0x29')](function(_0x321dea){_0x1bcc7e[_0x4bb8('0x23')]=_0x321dea;if(_0x43c043[_0x4bb8('0x37')][_0x4bb8('0x44')]){_0x258c56[_0x4bb8('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4bb8('0x5e')](_0x258c56);})[_0x4bb8('0x29')](function(_0x4c2a9b){_0x1bcc7e[_0x4bb8('0x46')]=_0x4c2a9b;return _0x1bcc7e;});}})['then'](respondWithFilteredResult(_0x2a0b35,_0x258c56))[_0x4bb8('0x47')](handleError(_0x2a0b35,null));};exports[_0x4bb8('0x5f')]=function(_0x15b8cc,_0x450e90,_0xc2918b){var _0xecc48f={'raw':!![],'where':{}};var _0x5592a0={};var _0x2e686d={'count':0x0,'rows':[]};return db[_0x4bb8('0x30')][_0x4bb8('0x60')]({'where':{'id':_0x15b8cc[_0x4bb8('0x49')]['id']}})[_0x4bb8('0x29')](handleEntityNotFound(_0x450e90,null))['then'](function(_0x4db557){if(_0x4db557){_0x5592a0['model']=_[_0x4bb8('0x4a')](db[_0x4bb8('0x61')][_0x4bb8('0x31')]);_0x5592a0[_0x4bb8('0x37')]=_['keys'](_0x15b8cc[_0x4bb8('0x37')]);_0x5592a0['filters']=_[_0x4bb8('0x39')](_0x5592a0['model'],_0x5592a0['query']);_0xecc48f[_0x4bb8('0x3a')]=_[_0x4bb8('0x39')](_0x5592a0[_0x4bb8('0x35')],qs[_0x4bb8('0x3b')](_0x15b8cc['query']['fields']));_0xecc48f['attributes']=_0xecc48f['attributes'][_0x4bb8('0x3c')]?_0xecc48f['attributes']:_0x5592a0['model'];if(!_0x15b8cc[_0x4bb8('0x37')][_0x4bb8('0x3d')](_0x4bb8('0x5b'))){_0xecc48f['limit']=qs[_0x4bb8('0x22')](_0x15b8cc[_0x4bb8('0x37')][_0x4bb8('0x22')]);_0xecc48f[_0x4bb8('0x20')]=qs[_0x4bb8('0x20')](_0x15b8cc[_0x4bb8('0x37')][_0x4bb8('0x20')]);}_0xecc48f[_0x4bb8('0x5c')]=qs['sort'](_0x15b8cc[_0x4bb8('0x37')][_0x4bb8('0x3e')]);_0xecc48f[_0x4bb8('0x3f')]=qs[_0x4bb8('0x38')](_[_0x4bb8('0x62')](_0x15b8cc[_0x4bb8('0x37')],_0x5592a0[_0x4bb8('0x38')]));_0xecc48f[_0x4bb8('0x3f')][_0x4bb8('0x5d')]=_0x4db557['id'];if(_0x15b8cc[_0x4bb8('0x37')][_0x4bb8('0x40')]){_0xecc48f[_0x4bb8('0x3f')]=_[_0x4bb8('0x41')](_0xecc48f[_0x4bb8('0x3f')],{'$or':_['map'](_0xecc48f['attributes'],function(_0x2a562a){var _0x53e622={};_0x53e622[_0x2a562a]={'$like':'%'+_0x15b8cc[_0x4bb8('0x37')][_0x4bb8('0x40')]+'%'};return _0x53e622;})});}_0xecc48f=_[_0x4bb8('0x41')]({},_0xecc48f,_0x15b8cc[_0x4bb8('0x43')]);return db[_0x4bb8('0x61')][_0x4bb8('0x23')]({'where':_0xecc48f['where']})[_0x4bb8('0x29')](function(_0x223bb8){_0x2e686d[_0x4bb8('0x23')]=_0x223bb8;if(_0x15b8cc[_0x4bb8('0x37')][_0x4bb8('0x44')]){_0xecc48f[_0x4bb8('0x45')]=[{'all':!![]}];}return db[_0x4bb8('0x61')][_0x4bb8('0x5e')](_0xecc48f);})[_0x4bb8('0x29')](function(_0x3999af){_0x2e686d[_0x4bb8('0x46')]=_0x3999af;return _0x2e686d;});}})[_0x4bb8('0x29')](respondWithFilteredResult(_0x450e90,_0xecc48f))['catch'](handleError(_0x450e90,null));};function char(_0x3152a5){return'number'===typeof _0x3152a5?String[_0x4bb8('0x63')][_0x4bb8('0x25')](null,arguments):_0x3152a5;}function needsEncapsulation(_0x3652b0){return!!_0x3652b0&&(_0x3652b0['toString']()[_0x4bb8('0x64')](char(0xd))>=0x0||_0x3652b0['toString']()['indexOf'](char(0xa))>=0x0||_0x3652b0[_0x4bb8('0x65')]()[_0x4bb8('0x64')](char(0x2c))>=0x0||_0x3652b0['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x37a88b){var _0x1a23b1=char(0x22),_0xbe2043='\x5c'+char(0x22),_0xa7b5fd=_0x37a88b['toString']()['replace'](new RegExp(_0x1a23b1,'g'),_0xbe2043);return _0x1a23b1+_0xa7b5fd+_0x1a23b1;}exports[_0x4bb8('0x66')]=function(_0x524089,_0x4a50ba,_0x6eec84){var _0x2b9e8d,_0x15ec11;var _0x2917bb={'where':{'ProjectId':_0x524089[_0x4bb8('0x49')]['id']}};if(_0x524089[_0x4bb8('0x37')]['startTime']){_0x2917bb['where'][_0x4bb8('0x67')]=JSON[_0x4bb8('0x68')](_0x524089[_0x4bb8('0x37')][_0x4bb8('0x69')]);}return db[_0x4bb8('0x5a')][_0x4bb8('0x5e')](_0x2917bb)[_0x4bb8('0x29')](handleEntityNotFound(_0x4a50ba,null))[_0x4bb8('0x29')](function(_0x45903e){if(_0x45903e){_0x2b9e8d=_0x45903e;return db['JscriptyQuestionReport'][_0x4bb8('0x5e')]({'where':{'SessionId':{'$in':_[_0x4bb8('0x36')](_0x2b9e8d,'id')},'ProjectId':_0x524089[_0x4bb8('0x49')]['id']},'order':_0x4bb8('0x6a')});}})[_0x4bb8('0x29')](handleEntityNotFound(_0x4a50ba,null))[_0x4bb8('0x29')](function(_0x251cbd){if(_0x251cbd){_0x15ec11=_0x251cbd;var _0x4dd061={};for(var _0x3b4abf=0x0,_0x3c9da1=_0x15ec11[_0x4bb8('0x3c')];_0x3b4abf<_0x3c9da1;_0x3b4abf++){if(!_0x4dd061[_0x4bb8('0x3d')](_0x15ec11[_0x3b4abf][_0x4bb8('0x6b')])){_0x4dd061[_0x15ec11[_0x3b4abf][_0x4bb8('0x6b')]]=needsEncapsulation(_0x15ec11[_0x3b4abf]['question'])?encapsulate(_0x15ec11[_0x3b4abf][_0x4bb8('0x6c')]):_0x15ec11[_0x3b4abf][_0x4bb8('0x6c')];}}var _0x15544a=[],_0xf99a32={};for(var _0x48a0ac=0x0,_0x40bbd5=_0x2b9e8d[_0x4bb8('0x3c')];_0x48a0ac<_0x40bbd5;_0x48a0ac++){_0xf99a32={'ProjectId':_0x524089[_0x4bb8('0x49')]['id'],'SessionId':_0x2b9e8d[_0x48a0ac]['id'],'StartTime':moment(_0x2b9e8d[_0x48a0ac][_0x4bb8('0x67')])['format'](_0x4bb8('0x6d'))};for(var _0x5bf69b=0x0,_0x3e8246=_0x15ec11[_0x4bb8('0x3c')];_0x5bf69b<_0x3e8246;_0x5bf69b++){if(_0x15ec11[_0x5bf69b][_0x4bb8('0x6e')]==_0x2b9e8d[_0x48a0ac]['id']&&_0x4dd061['hasOwnProperty'](_0x15ec11[_0x5bf69b][_0x4bb8('0x6b')])){_0xf99a32[_0x4dd061[_0x15ec11[_0x5bf69b][_0x4bb8('0x6b')]]]=_0x15ec11[_0x5bf69b][_0x4bb8('0x6f')];}}for(var _0x395454 in _0x4dd061){if(!_0xf99a32['hasOwnProperty'](_0x4dd061[_0x395454])){_0xf99a32[_0x4dd061[_0x395454]]=null;}}_0x15544a[_0x4bb8('0x70')](_0xf99a32);}return _0x15544a;}})[_0x4bb8('0x29')](function(_0x36ba6a){if(!_[_0x4bb8('0x71')](_0x36ba6a)){var _0xcdda68=toCsv(_0x36ba6a);var _0x55caa7=Date[_0x4bb8('0x72')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x524089[_0x4bb8('0x49')]['id'],_0x55caa7),_0xcdda68);_0x4a50ba['setHeader'](_0x4bb8('0x73'),'attachment;\x20filename='+util[_0x4bb8('0x74')](_0x4bb8('0x75'),_0x524089[_0x4bb8('0x49')]['id'],_0x55caa7));_0x4a50ba['setHeader'](_0x4bb8('0x76'),'text/csv');return _0x4a50ba[_0x4bb8('0x77')](util[_0x4bb8('0x74')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x524089['params']['id'],_0x55caa7));}else{return _0x4a50ba[_0x4bb8('0x1d')](0xcc);}})['catch'](handleError(_0x4a50ba,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 2f94252..bfa6130 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 _0xb3ea=['../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x3cfa3c,_0xd29827){var _0x49ee56=function(_0x5850b9){while(--_0x5850b9){_0x3cfa3c['push'](_0x3cfa3c['shift']());}};_0x49ee56(++_0xd29827);}(_0xb3ea,0x10d));var _0xab3e=function(_0x29a345,_0x5bac6d){_0x29a345=_0x29a345-0x0;var _0x38e8be=_0xb3ea[_0x29a345];return _0x38e8be;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var logger=require(_0xab3e('0x2'))('api');var moment=require(_0xab3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xab3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab3e('0x5'));var config=require(_0xab3e('0x6'));var attributes=require(_0xab3e('0x7'));module[_0xab3e('0x8')]=function(_0x135941,_0x570744){return _0x135941[_0xab3e('0x9')]('JscriptyProject',attributes,{'tableName':_0xab3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d55=['JscriptyProject','jscripty_projects','util','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x5d55,0x1a4));var _0x55d5=function(_0x433868,_0x39ceed){_0x433868=_0x433868-0x0;var _0x517995=_0x5d55[_0x433868];return _0x517995;};'use strict';var _=require('lodash');var util=require(_0x55d5('0x0'));var logger=require('../../config/logger')(_0x55d5('0x1'));var moment=require(_0x55d5('0x2'));var BPromise=require('bluebird');var rp=require(_0x55d5('0x3'));var fs=require('fs');var path=require(_0x55d5('0x4'));var rimraf=require(_0x55d5('0x5'));var config=require('../../config/environment');var attributes=require(_0x55d5('0x6'));module[_0x55d5('0x7')]=function(_0x33e5c5,_0x35fe43){return _0x33e5c5[_0x55d5('0x8')](_0x55d5('0x9'),attributes,{'tableName':_0x55d5('0xa'),'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 eebf0cd..11880a1 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x15ce4c,_0x5c4106){var _0xab2819=function(_0x405ff6){while(--_0x405ff6){_0x15ce4c['push'](_0x15ce4c['shift']());}};_0xab2819(++_0x5c4106);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2484fa,_0x120551){var _0x2dfe01=function(_0x561f48){while(--_0x561f48){_0x2484fa['push'](_0x2484fa['shift']());}};_0x2dfe01(++_0x120551);}(_0xb43b,0x1b2));var _0xbb43=function(_0x246367,_0x29a04d){_0x246367=_0x246367-0x0;var _0x35f596=_0xb43b[_0x246367];return _0x35f596;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f419d16..067b1f4 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 _0x3949=['get','isAuthenticated','index','describe','/:id','show','create','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3949,0x77));var _0x9394=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0x3949[_0x2fa457];return _0x4f250a;};'use strict';var multer=require(_0x9394('0x0'));var util=require(_0x9394('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9394('0x2'));var router=express[_0x9394('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9394('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9394('0x5'));var controller=require(_0x9394('0x6'));router[_0x9394('0x7')]('/',auth[_0x9394('0x8')](),controller[_0x9394('0x9')]);router[_0x9394('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9394('0xa')]);router[_0x9394('0x7')](_0x9394('0xb'),auth[_0x9394('0x8')](),controller[_0x9394('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9394('0xd')]);router[_0x9394('0xe')](_0x9394('0xb'),auth[_0x9394('0x8')](),controller['update']);router[_0x9394('0xf')](_0x9394('0xb'),auth[_0x9394('0x8')](),controller[_0x9394('0x10')]);module[_0x9394('0x11')]=router; \ No newline at end of file +var _0x2f0f=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer'];(function(_0x550f80,_0x2d7260){var _0x2159d9=function(_0x3416e3){while(--_0x3416e3){_0x550f80['push'](_0x550f80['shift']());}};_0x2159d9(++_0x2d7260);}(_0x2f0f,0x168));var _0xf2f0=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0x2f0f[_0x44e00a];return _0x2bdfba;};'use strict';var multer=require(_0xf2f0('0x0'));var util=require('util');var path=require(_0xf2f0('0x1'));var timeout=require(_0xf2f0('0x2'));var express=require(_0xf2f0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf2f0('0x4'));var config=require(_0xf2f0('0x5'));var controller=require(_0xf2f0('0x6'));router[_0xf2f0('0x7')]('/',auth[_0xf2f0('0x8')](),controller[_0xf2f0('0x9')]);router['get'](_0xf2f0('0xa'),auth[_0xf2f0('0x8')](),controller[_0xf2f0('0xb')]);router[_0xf2f0('0x7')](_0xf2f0('0xc'),auth['isAuthenticated'](),controller[_0xf2f0('0xd')]);router[_0xf2f0('0xe')]('/',auth[_0xf2f0('0x8')](),controller[_0xf2f0('0xf')]);router[_0xf2f0('0x10')]('/:id',auth[_0xf2f0('0x8')](),controller[_0xf2f0('0x11')]);router[_0xf2f0('0x12')](_0xf2f0('0xc'),auth[_0xf2f0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 7c06c3d..77f68e6 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x19f325,_0x1693d3){_0x19f325=_0x19f325-0x0;var _0x9f6e34=_0x7a54[_0x19f325];return _0x9f6e34;};'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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x27e5d8,_0x76251a){_0x27e5d8=_0x27e5d8-0x0;var _0x5604d3=_0x7a54[_0x27e5d8];return _0x5604d3;};'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 6f7d752..8d4836a 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 _0xcbf6=['reject','then','error','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','apply'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcbf6,0x104));var _0x6cbf=function(_0x4f84c3,_0x6d094d){_0x4f84c3=_0x4f84c3-0x0;var _0x460f9f=_0xcbf6[_0x4f84c3];return _0x460f9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cbf('0x0'));var zipdir=require(_0x6cbf('0x1'));var jsonpatch=require(_0x6cbf('0x2'));var rp=require(_0x6cbf('0x3'));var moment=require(_0x6cbf('0x4'));var BPromise=require(_0x6cbf('0x5'));var Mustache=require('mustache');var util=require(_0x6cbf('0x6'));var path=require(_0x6cbf('0x7'));var sox=require(_0x6cbf('0x8'));var csv=require(_0x6cbf('0x9'));var ejs=require(_0x6cbf('0xa'));var fs=require('fs');var fs_extra=require(_0x6cbf('0xb'));var _=require(_0x6cbf('0xc'));var squel=require('squel');var crypto=require(_0x6cbf('0xd'));var jsforce=require(_0x6cbf('0xe'));var deskjs=require(_0x6cbf('0xf'));var toCsv=require(_0x6cbf('0x9'));var querystring=require(_0x6cbf('0x10'));var Papa=require('papaparse');var Redis=require(_0x6cbf('0x11'));var authService=require(_0x6cbf('0x12'));var qs=require(_0x6cbf('0x13'));var as=require(_0x6cbf('0x14'));var hardwareService=require(_0x6cbf('0x15'));var logger=require(_0x6cbf('0x16'))(_0x6cbf('0x17'));var utils=require(_0x6cbf('0x18'));var config=require(_0x6cbf('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x361134,_0x385ed8){_0x385ed8=_0x385ed8||0xcc;return function(_0x36ee0d){if(_0x36ee0d){return _0x361134[_0x6cbf('0x1a')](_0x385ed8);}return _0x361134['status'](_0x385ed8)[_0x6cbf('0x1b')]();};}function respondWithResult(_0x341050,_0x214df7){_0x214df7=_0x214df7||0xc8;return function(_0x5dfbc0){if(_0x5dfbc0){return _0x341050[_0x6cbf('0x1c')](_0x214df7)[_0x6cbf('0x1d')](_0x5dfbc0);}};}function respondWithFilteredResult(_0x40149e,_0x2a73cc){return function(_0x694a1f){if(_0x694a1f){var _0x515bb2=typeof _0x2a73cc[_0x6cbf('0x1e')]==='undefined'&&typeof _0x2a73cc[_0x6cbf('0x1f')]===_0x6cbf('0x20');var _0x527b41=_0x694a1f[_0x6cbf('0x21')];var _0x25dc6a=_0x515bb2?0x0:_0x2a73cc['offset'];var _0x1bc269=_0x515bb2?_0x694a1f[_0x6cbf('0x21')]:_0x2a73cc[_0x6cbf('0x1e')]+_0x2a73cc[_0x6cbf('0x1f')];var _0x177739;if(_0x1bc269>=_0x527b41){_0x1bc269=_0x527b41;_0x177739=0xc8;}else{_0x177739=0xce;}_0x40149e['status'](_0x177739);return _0x40149e[_0x6cbf('0x22')]('Content-Range',_0x25dc6a+'-'+_0x1bc269+'/'+_0x527b41)[_0x6cbf('0x1d')](_0x694a1f);}return null;};}function patchUpdates(_0x242f90){return function(_0x4b37ab){try{jsonpatch[_0x6cbf('0x23')](_0x4b37ab,_0x242f90,!![]);}catch(_0x1e2f93){return BPromise[_0x6cbf('0x24')](_0x1e2f93);}return _0x4b37ab['save']();};}function saveUpdates(_0x182bc2,_0x162256){return function(_0x18a89b){if(_0x18a89b){return _0x18a89b['update'](_0x182bc2)[_0x6cbf('0x25')](function(_0x4b8cee){return _0x4b8cee;});}return null;};}function removeEntity(_0x48d5e5,_0x4cce87){return function(_0x137a08){if(_0x137a08){return _0x137a08['destroy']()[_0x6cbf('0x25')](function(){_0x48d5e5[_0x6cbf('0x1c')](0xcc)[_0x6cbf('0x1b')]();});}};}function handleEntityNotFound(_0x27f1f9,_0x54f227){return function(_0x489bb7){if(!_0x489bb7){_0x27f1f9[_0x6cbf('0x1a')](0x194);}return _0x489bb7;};}function handleError(_0x50e180,_0x482073){_0x482073=_0x482073||0x1f4;return function(_0x3c2c21){logger[_0x6cbf('0x26')](_0x3c2c21['stack']);if(_0x3c2c21[_0x6cbf('0x27')]){delete _0x3c2c21[_0x6cbf('0x27')];}_0x50e180[_0x6cbf('0x1c')](_0x482073)[_0x6cbf('0x28')](_0x3c2c21);};}exports[_0x6cbf('0x29')]=function(_0x18d05a,_0x43e936){var _0x534c03={},_0x5b30cd={},_0x19c9cb={'count':0x0,'rows':[]};var _0x298eb1=_[_0x6cbf('0x2a')](db[_0x6cbf('0x2b')]['rawAttributes'],function(_0x18f6f3){return{'name':_0x18f6f3[_0x6cbf('0x2c')],'type':_0x18f6f3[_0x6cbf('0x2d')][_0x6cbf('0x2e')]};});_0x5b30cd[_0x6cbf('0x2f')]=_[_0x6cbf('0x2a')](_0x298eb1,_0x6cbf('0x27'));_0x5b30cd[_0x6cbf('0x30')]=_[_0x6cbf('0x31')](_0x18d05a[_0x6cbf('0x30')]);_0x5b30cd[_0x6cbf('0x32')]=_[_0x6cbf('0x33')](_0x5b30cd[_0x6cbf('0x2f')],_0x5b30cd[_0x6cbf('0x30')]);_0x534c03['attributes']=_[_0x6cbf('0x33')](_0x5b30cd[_0x6cbf('0x2f')],qs[_0x6cbf('0x34')](_0x18d05a[_0x6cbf('0x30')]['fields']));_0x534c03[_0x6cbf('0x35')]=_0x534c03['attributes']['length']?_0x534c03[_0x6cbf('0x35')]:_0x5b30cd['model'];if(!_0x18d05a['query'][_0x6cbf('0x36')]('nolimit')){_0x534c03[_0x6cbf('0x1f')]=qs[_0x6cbf('0x1f')](_0x18d05a['query']['limit']);_0x534c03[_0x6cbf('0x1e')]=qs[_0x6cbf('0x1e')](_0x18d05a[_0x6cbf('0x30')]['offset']);}_0x534c03['order']=qs[_0x6cbf('0x37')](_0x18d05a[_0x6cbf('0x30')][_0x6cbf('0x37')]);_0x534c03[_0x6cbf('0x38')]=qs[_0x6cbf('0x32')](_['pick'](_0x18d05a[_0x6cbf('0x30')],_0x5b30cd[_0x6cbf('0x32')]),_0x298eb1);if(_0x18d05a[_0x6cbf('0x30')]['filter']){_0x534c03[_0x6cbf('0x38')]=_[_0x6cbf('0x39')](_0x534c03['where'],{'$or':_[_0x6cbf('0x2a')](_0x298eb1,function(_0x3ea33b){if(_0x3ea33b['type']!==_0x6cbf('0x3a')){var _0x34fa8b={};_0x34fa8b[_0x3ea33b[_0x6cbf('0x27')]]={'$like':'%'+_0x18d05a['query'][_0x6cbf('0x3b')]+'%'};return _0x34fa8b;}})});}_0x534c03=_['merge']({},_0x534c03,_0x18d05a[_0x6cbf('0x3c')]);var _0x130aa4={'where':_0x534c03[_0x6cbf('0x38')]};return db[_0x6cbf('0x2b')][_0x6cbf('0x21')](_0x130aa4)[_0x6cbf('0x25')](function(_0x427778){_0x19c9cb[_0x6cbf('0x21')]=_0x427778;if(_0x18d05a['query'][_0x6cbf('0x3d')]){_0x534c03[_0x6cbf('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6cbf('0x3f')](_0x534c03);})[_0x6cbf('0x25')](function(_0x27ef06){_0x19c9cb[_0x6cbf('0x40')]=_0x27ef06;return _0x19c9cb;})[_0x6cbf('0x25')](respondWithFilteredResult(_0x43e936,_0x534c03))[_0x6cbf('0x41')](handleError(_0x43e936,null));};exports[_0x6cbf('0x42')]=function(_0x38442e,_0xbce9aa){var _0x1b0e34={'raw':!![],'where':{'id':_0x38442e[_0x6cbf('0x43')]['id']}},_0x484988={};_0x484988[_0x6cbf('0x2f')]=_[_0x6cbf('0x31')](db[_0x6cbf('0x2b')][_0x6cbf('0x44')]);_0x484988['query']=_['keys'](_0x38442e[_0x6cbf('0x30')]);_0x484988[_0x6cbf('0x32')]=_[_0x6cbf('0x33')](_0x484988['model'],_0x484988['query']);_0x1b0e34[_0x6cbf('0x35')]=_['intersection'](_0x484988[_0x6cbf('0x2f')],qs[_0x6cbf('0x34')](_0x38442e[_0x6cbf('0x30')][_0x6cbf('0x34')]));_0x1b0e34['attributes']=_0x1b0e34[_0x6cbf('0x35')]['length']?_0x1b0e34['attributes']:_0x484988[_0x6cbf('0x2f')];if(_0x38442e[_0x6cbf('0x30')]['includeAll']){_0x1b0e34[_0x6cbf('0x3e')]=[{'all':!![]}];}_0x1b0e34=_[_0x6cbf('0x39')]({},_0x1b0e34,_0x38442e[_0x6cbf('0x3c')]);return db[_0x6cbf('0x2b')][_0x6cbf('0x45')](_0x1b0e34)[_0x6cbf('0x25')](handleEntityNotFound(_0xbce9aa,null))[_0x6cbf('0x25')](respondWithResult(_0xbce9aa,null))[_0x6cbf('0x41')](handleError(_0xbce9aa,null));};exports['create']=function(_0xbfce89,_0x5c5c2c){return db[_0x6cbf('0x2b')][_0x6cbf('0x46')](_0xbfce89[_0x6cbf('0x47')],{})[_0x6cbf('0x25')](respondWithResult(_0x5c5c2c,0xc9))['catch'](handleError(_0x5c5c2c,null));};exports['update']=function(_0x1026ec,_0x1a7674){if(_0x1026ec[_0x6cbf('0x47')]['id']){delete _0x1026ec['body']['id'];}return db[_0x6cbf('0x2b')][_0x6cbf('0x45')]({'where':{'id':_0x1026ec[_0x6cbf('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a7674,null))['then'](saveUpdates(_0x1026ec[_0x6cbf('0x47')],null))[_0x6cbf('0x25')](respondWithResult(_0x1a7674,null))[_0x6cbf('0x41')](handleError(_0x1a7674,null));};exports[_0x6cbf('0x48')]=function(_0x1878ec,_0x222599){return db[_0x6cbf('0x2b')][_0x6cbf('0x45')]({'where':{'id':_0x1878ec[_0x6cbf('0x43')]['id']}})[_0x6cbf('0x25')](handleEntityNotFound(_0x222599,null))[_0x6cbf('0x25')](removeEntity(_0x222599,null))[_0x6cbf('0x41')](handleError(_0x222599,null));};exports[_0x6cbf('0x49')]=function(_0x5f5907,_0x31717b){return db[_0x6cbf('0x2b')][_0x6cbf('0x49')]()['then'](respondWithResult(_0x31717b,null))[_0x6cbf('0x41')](handleError(_0x31717b,null));}; \ No newline at end of file +var _0xefb8=['status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','merge','where','options','JscriptyQuestionReport','includeAll','include','findAll','show','params','fields','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xefb8,0x159));var _0x8efb=function(_0x24086e,_0x222530){_0x24086e=_0x24086e-0x0;var _0x376fb1=_0xefb8[_0x24086e];return _0x376fb1;};'use strict';var emlformat=require(_0x8efb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8efb('0x1'));var jsonpatch=require(_0x8efb('0x2'));var rp=require(_0x8efb('0x3'));var moment=require(_0x8efb('0x4'));var BPromise=require(_0x8efb('0x5'));var Mustache=require(_0x8efb('0x6'));var util=require(_0x8efb('0x7'));var path=require(_0x8efb('0x8'));var sox=require('sox');var csv=require(_0x8efb('0x9'));var ejs=require(_0x8efb('0xa'));var fs=require('fs');var fs_extra=require(_0x8efb('0xb'));var _=require(_0x8efb('0xc'));var squel=require('squel');var crypto=require(_0x8efb('0xd'));var jsforce=require(_0x8efb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8efb('0x9'));var querystring=require('querystring');var Papa=require(_0x8efb('0xf'));var Redis=require('ioredis');var authService=require(_0x8efb('0x10'));var qs=require(_0x8efb('0x11'));var as=require(_0x8efb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8efb('0x13'))(_0x8efb('0x14'));var utils=require('../../config/utils');var config=require(_0x8efb('0x15'));var licenseUtil=require(_0x8efb('0x16'));var db=require(_0x8efb('0x17'))['db'];function respondWithStatusCode(_0x159dab,_0x4a122d){_0x4a122d=_0x4a122d||0xcc;return function(_0x1928ca){if(_0x1928ca){return _0x159dab[_0x8efb('0x18')](_0x4a122d);}return _0x159dab[_0x8efb('0x19')](_0x4a122d)['end']();};}function respondWithResult(_0x7040e1,_0x25132e){_0x25132e=_0x25132e||0xc8;return function(_0x5241ff){if(_0x5241ff){return _0x7040e1[_0x8efb('0x19')](_0x25132e)[_0x8efb('0x1a')](_0x5241ff);}};}function respondWithFilteredResult(_0x191f83,_0x52e4d4){return function(_0x3d64d8){if(_0x3d64d8){var _0x53ccc2=typeof _0x52e4d4[_0x8efb('0x1b')]==='undefined'&&typeof _0x52e4d4[_0x8efb('0x1c')]===_0x8efb('0x1d');var _0x1e9a87=_0x3d64d8[_0x8efb('0x1e')];var _0x4c4db0=_0x53ccc2?0x0:_0x52e4d4[_0x8efb('0x1b')];var _0x6ab52d=_0x53ccc2?_0x3d64d8[_0x8efb('0x1e')]:_0x52e4d4[_0x8efb('0x1b')]+_0x52e4d4[_0x8efb('0x1c')];var _0x10d7ee;if(_0x6ab52d>=_0x1e9a87){_0x6ab52d=_0x1e9a87;_0x10d7ee=0xc8;}else{_0x10d7ee=0xce;}_0x191f83['status'](_0x10d7ee);return _0x191f83[_0x8efb('0x1f')](_0x8efb('0x20'),_0x4c4db0+'-'+_0x6ab52d+'/'+_0x1e9a87)[_0x8efb('0x1a')](_0x3d64d8);}return null;};}function patchUpdates(_0x252987){return function(_0x4f688e){try{jsonpatch['apply'](_0x4f688e,_0x252987,!![]);}catch(_0x264b30){return BPromise[_0x8efb('0x21')](_0x264b30);}return _0x4f688e[_0x8efb('0x22')]();};}function saveUpdates(_0x39a6b3,_0x3393dd){return function(_0xd5bafb){if(_0xd5bafb){return _0xd5bafb[_0x8efb('0x23')](_0x39a6b3)[_0x8efb('0x24')](function(_0x51337f){return _0x51337f;});}return null;};}function removeEntity(_0x367713,_0x8ddd72){return function(_0xdfc2ef){if(_0xdfc2ef){return _0xdfc2ef[_0x8efb('0x25')]()[_0x8efb('0x24')](function(){_0x367713[_0x8efb('0x19')](0xcc)[_0x8efb('0x26')]();});}};}function handleEntityNotFound(_0x52d527,_0x5ea69b){return function(_0x4c8aab){if(!_0x4c8aab){_0x52d527[_0x8efb('0x18')](0x194);}return _0x4c8aab;};}function handleError(_0x3e69ee,_0x1e828c){_0x1e828c=_0x1e828c||0x1f4;return function(_0x2ae7d1){logger[_0x8efb('0x27')](_0x2ae7d1['stack']);if(_0x2ae7d1['name']){delete _0x2ae7d1[_0x8efb('0x28')];}_0x3e69ee[_0x8efb('0x19')](_0x1e828c)['send'](_0x2ae7d1);};}exports[_0x8efb('0x29')]=function(_0xfdba9d,_0x5b95df){var _0x20c7f2={},_0x42d286={},_0x206379={'count':0x0,'rows':[]};var _0x59f46c=_[_0x8efb('0x2a')](db['JscriptyQuestionReport'][_0x8efb('0x2b')],function(_0x4c43e3){return{'name':_0x4c43e3[_0x8efb('0x2c')],'type':_0x4c43e3[_0x8efb('0x2d')][_0x8efb('0x2e')]};});_0x42d286[_0x8efb('0x2f')]=_['map'](_0x59f46c,_0x8efb('0x28'));_0x42d286[_0x8efb('0x30')]=_[_0x8efb('0x31')](_0xfdba9d[_0x8efb('0x30')]);_0x42d286['filters']=_[_0x8efb('0x32')](_0x42d286['model'],_0x42d286[_0x8efb('0x30')]);_0x20c7f2[_0x8efb('0x33')]=_['intersection'](_0x42d286[_0x8efb('0x2f')],qs['fields'](_0xfdba9d[_0x8efb('0x30')]['fields']));_0x20c7f2[_0x8efb('0x33')]=_0x20c7f2[_0x8efb('0x33')][_0x8efb('0x34')]?_0x20c7f2[_0x8efb('0x33')]:_0x42d286[_0x8efb('0x2f')];if(!_0xfdba9d[_0x8efb('0x30')]['hasOwnProperty'](_0x8efb('0x35'))){_0x20c7f2['limit']=qs[_0x8efb('0x1c')](_0xfdba9d[_0x8efb('0x30')][_0x8efb('0x1c')]);_0x20c7f2[_0x8efb('0x1b')]=qs[_0x8efb('0x1b')](_0xfdba9d[_0x8efb('0x30')][_0x8efb('0x1b')]);}_0x20c7f2[_0x8efb('0x36')]=qs[_0x8efb('0x37')](_0xfdba9d['query'][_0x8efb('0x37')]);_0x20c7f2['where']=qs[_0x8efb('0x38')](_[_0x8efb('0x39')](_0xfdba9d[_0x8efb('0x30')],_0x42d286[_0x8efb('0x38')]),_0x59f46c);if(_0xfdba9d[_0x8efb('0x30')][_0x8efb('0x3a')]){_0x20c7f2['where']=_[_0x8efb('0x3b')](_0x20c7f2[_0x8efb('0x3c')],{'$or':_['map'](_0x59f46c,function(_0x182e9d){if(_0x182e9d['type']!=='VIRTUAL'){var _0x3e4c02={};_0x3e4c02[_0x182e9d[_0x8efb('0x28')]]={'$like':'%'+_0xfdba9d[_0x8efb('0x30')][_0x8efb('0x3a')]+'%'};return _0x3e4c02;}})});}_0x20c7f2=_['merge']({},_0x20c7f2,_0xfdba9d[_0x8efb('0x3d')]);var _0xb62895={'where':_0x20c7f2[_0x8efb('0x3c')]};return db[_0x8efb('0x3e')]['count'](_0xb62895)[_0x8efb('0x24')](function(_0x539d10){_0x206379[_0x8efb('0x1e')]=_0x539d10;if(_0xfdba9d[_0x8efb('0x30')][_0x8efb('0x3f')]){_0x20c7f2[_0x8efb('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8efb('0x41')](_0x20c7f2);})[_0x8efb('0x24')](function(_0x5daa2d){_0x206379['rows']=_0x5daa2d;return _0x206379;})[_0x8efb('0x24')](respondWithFilteredResult(_0x5b95df,_0x20c7f2))['catch'](handleError(_0x5b95df,null));};exports[_0x8efb('0x42')]=function(_0x5d97ec,_0x100e0d){var _0x4c2ca8={'raw':!![],'where':{'id':_0x5d97ec[_0x8efb('0x43')]['id']}},_0x87f635={};_0x87f635[_0x8efb('0x2f')]=_['keys'](db[_0x8efb('0x3e')][_0x8efb('0x2b')]);_0x87f635['query']=_['keys'](_0x5d97ec[_0x8efb('0x30')]);_0x87f635[_0x8efb('0x38')]=_[_0x8efb('0x32')](_0x87f635[_0x8efb('0x2f')],_0x87f635[_0x8efb('0x30')]);_0x4c2ca8[_0x8efb('0x33')]=_[_0x8efb('0x32')](_0x87f635['model'],qs[_0x8efb('0x44')](_0x5d97ec[_0x8efb('0x30')][_0x8efb('0x44')]));_0x4c2ca8[_0x8efb('0x33')]=_0x4c2ca8[_0x8efb('0x33')]['length']?_0x4c2ca8['attributes']:_0x87f635['model'];if(_0x5d97ec[_0x8efb('0x30')][_0x8efb('0x3f')]){_0x4c2ca8[_0x8efb('0x40')]=[{'all':!![]}];}_0x4c2ca8=_[_0x8efb('0x3b')]({},_0x4c2ca8,_0x5d97ec[_0x8efb('0x3d')]);return db[_0x8efb('0x3e')]['find'](_0x4c2ca8)[_0x8efb('0x24')](handleEntityNotFound(_0x100e0d,null))[_0x8efb('0x24')](respondWithResult(_0x100e0d,null))[_0x8efb('0x45')](handleError(_0x100e0d,null));};exports[_0x8efb('0x46')]=function(_0x436bba,_0x434be6){return db[_0x8efb('0x3e')][_0x8efb('0x46')](_0x436bba[_0x8efb('0x47')],{})[_0x8efb('0x24')](respondWithResult(_0x434be6,0xc9))['catch'](handleError(_0x434be6,null));};exports[_0x8efb('0x23')]=function(_0x1adfc6,_0x469033){if(_0x1adfc6[_0x8efb('0x47')]['id']){delete _0x1adfc6[_0x8efb('0x47')]['id'];}return db[_0x8efb('0x3e')][_0x8efb('0x48')]({'where':{'id':_0x1adfc6[_0x8efb('0x43')]['id']}})[_0x8efb('0x24')](handleEntityNotFound(_0x469033,null))[_0x8efb('0x24')](saveUpdates(_0x1adfc6[_0x8efb('0x47')],null))['then'](respondWithResult(_0x469033,null))['catch'](handleError(_0x469033,null));};exports[_0x8efb('0x25')]=function(_0x22a0e7,_0x87d86e){return db[_0x8efb('0x3e')]['find']({'where':{'id':_0x22a0e7[_0x8efb('0x43')]['id']}})[_0x8efb('0x24')](handleEntityNotFound(_0x87d86e,null))[_0x8efb('0x24')](removeEntity(_0x87d86e,null))[_0x8efb('0x45')](handleError(_0x87d86e,null));};exports['describe']=function(_0x192d37,_0x222fb5){return db[_0x8efb('0x3e')][_0x8efb('0x49')]()['then'](respondWithResult(_0x222fb5,null))[_0x8efb('0x45')](handleError(_0x222fb5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e3a1fdd..bb9b425 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 _0x9222=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','../../config/logger','moment'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x9222,0x17d));var _0x2922=function(_0xee05c6,_0x2a794f){_0xee05c6=_0xee05c6-0x0;var _0x4539c7=_0x9222[_0xee05c6];return _0x4539c7;};'use strict';var _=require(_0x2922('0x0'));var util=require(_0x2922('0x1'));var logger=require(_0x2922('0x2'))('api');var moment=require(_0x2922('0x3'));var BPromise=require('bluebird');var rp=require(_0x2922('0x4'));var fs=require('fs');var path=require(_0x2922('0x5'));var rimraf=require(_0x2922('0x6'));var config=require(_0x2922('0x7'));var attributes=require(_0x2922('0x8'));module['exports']=function(_0x40e8d3,_0x26265b){return _0x40e8d3[_0x2922('0x9')](_0x2922('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc88f=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x1171af,_0x13f3a5){var _0x55c690=function(_0x582cde){while(--_0x582cde){_0x1171af['push'](_0x1171af['shift']());}};_0x55c690(++_0x13f3a5);}(_0xc88f,0xce));var _0xfc88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc88f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfc88('0x0'));var util=require(_0xfc88('0x1'));var logger=require(_0xfc88('0x2'))(_0xfc88('0x3'));var moment=require('moment');var BPromise=require(_0xfc88('0x4'));var rp=require(_0xfc88('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc88('0x6'));var config=require(_0xfc88('0x7'));var attributes=require(_0xfc88('0x8'));module[_0xfc88('0x9')]=function(_0x27a9be,_0x221768){return _0x27a9be[_0xfc88('0xa')](_0xfc88('0xb'),attributes,{'tableName':_0xfc88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 7efdea9..fe1010b 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 _0xc3c3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x53a01c,_0x1405b9){var _0x3ce181=function(_0x591532){while(--_0x591532){_0x53a01c['push'](_0x53a01c['shift']());}};_0x3ce181(++_0x1405b9);}(_0xc3c3,0x11a));var _0x3c3c=function(_0x58d7f7,_0x5247fb){_0x58d7f7=_0x58d7f7-0x0;var _0x140760=_0xc3c3[_0x58d7f7];return _0x140760;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require('moment');var BPromise=require(_0x3c3c('0x2'));var rs=require(_0x3c3c('0x3'));var fs=require('fs');var Redis=require(_0x3c3c('0x4'));var db=require(_0x3c3c('0x5'))['db'];var utils=require(_0x3c3c('0x6'));var logger=require(_0x3c3c('0x7'))('rpc');var config=require(_0x3c3c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3c3c('0x9')][_0x3c3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa2445f,_0x4fd993,_0x14581f){return new BPromise(function(_0x5309c7,_0x24f294){return client[_0x3c3c('0xb')](_0xa2445f,_0x14581f)[_0x3c3c('0xc')](function(_0x2fd7ce){logger[_0x3c3c('0xd')](_0x3c3c('0xe'),_0x4fd993,_0x3c3c('0xf'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x4fd993,_0x3c3c('0xf'),JSON[_0x3c3c('0x10')](_0x2fd7ce));if(_0x2fd7ce['error']){if(_0x2fd7ce[_0x3c3c('0x11')][_0x3c3c('0x12')]===0x1f4){logger[_0x3c3c('0x11')](_0x3c3c('0xe'),_0x4fd993,_0x2fd7ce['error'][_0x3c3c('0x13')]);return _0x24f294(_0x2fd7ce['error'][_0x3c3c('0x13')]);}logger[_0x3c3c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fd993,_0x2fd7ce[_0x3c3c('0x11')][_0x3c3c('0x13')]);return _0x5309c7(_0x2fd7ce[_0x3c3c('0x11')][_0x3c3c('0x13')]);}else{logger[_0x3c3c('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fd993,'request\x20sent');_0x5309c7(_0x2fd7ce[_0x3c3c('0x14')][_0x3c3c('0x13')]);}})[_0x3c3c('0x15')](function(_0x264ed2){logger[_0x3c3c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fd993,_0x264ed2);_0x24f294(_0x264ed2);});});} \ No newline at end of file +var _0x21dd=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3f9882,_0x4063bb){var _0x18b725=function(_0x8e5916){while(--_0x8e5916){_0x3f9882['push'](_0x3f9882['shift']());}};_0x18b725(++_0x4063bb);}(_0x21dd,0x128));var _0xd21d=function(_0x665e55,_0x55145a){_0x665e55=_0x665e55-0x0;var _0x1ab6db=_0x21dd[_0x665e55];return _0x1ab6db;};'use strict';var _=require(_0xd21d('0x0'));var util=require('util');var moment=require(_0xd21d('0x1'));var BPromise=require(_0xd21d('0x2'));var rs=require(_0xd21d('0x3'));var fs=require('fs');var Redis=require(_0xd21d('0x4'));var db=require(_0xd21d('0x5'))['db'];var utils=require(_0xd21d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd21d('0x7'));var client=jayson[_0xd21d('0x8')][_0xd21d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d6b2f,_0x5d7b35,_0x4dd2cb){return new BPromise(function(_0x4b49db,_0x545291){return client[_0xd21d('0xa')](_0x2d6b2f,_0x4dd2cb)['then'](function(_0x364d21){logger[_0xd21d('0xb')](_0xd21d('0xc'),_0x5d7b35,_0xd21d('0xd'));logger['debug'](_0xd21d('0xe'),_0x5d7b35,'request\x20sent',JSON[_0xd21d('0xf')](_0x364d21));if(_0x364d21[_0xd21d('0x10')]){if(_0x364d21[_0xd21d('0x10')][_0xd21d('0x11')]===0x1f4){logger[_0xd21d('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5d7b35,_0x364d21[_0xd21d('0x10')][_0xd21d('0x12')]);return _0x545291(_0x364d21[_0xd21d('0x10')]['message']);}logger[_0xd21d('0x10')](_0xd21d('0xc'),_0x5d7b35,_0x364d21[_0xd21d('0x10')][_0xd21d('0x12')]);return _0x4b49db(_0x364d21[_0xd21d('0x10')][_0xd21d('0x12')]);}else{logger[_0xd21d('0xb')](_0xd21d('0xc'),_0x5d7b35,_0xd21d('0xd'));_0x4b49db(_0x364d21[_0xd21d('0x13')][_0xd21d('0x12')]);}})[_0xd21d('0x14')](function(_0x9dd9b4){logger['error'](_0xd21d('0xc'),_0x5d7b35,_0x9dd9b4);_0x545291(_0x9dd9b4);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index c2daab1..a944710 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 _0x64d9=['delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','update'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x64d9,0xba));var _0x964d=function(_0x3df9e0,_0x2ade61){_0x3df9e0=_0x3df9e0-0x0;var _0x4bbfc6=_0x64d9[_0x3df9e0];return _0x4bbfc6;};'use strict';var multer=require(_0x964d('0x0'));var util=require(_0x964d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x964d('0x2'));var router=express[_0x964d('0x3')]();var fs_extra=require(_0x964d('0x4'));var auth=require(_0x964d('0x5'));var interaction=require(_0x964d('0x6'));var config=require(_0x964d('0x7'));var controller=require(_0x964d('0x8'));router[_0x964d('0x9')]('/',auth[_0x964d('0xa')](),controller[_0x964d('0xb')]);router['get'](_0x964d('0xc'),auth[_0x964d('0xa')](),controller[_0x964d('0xd')]);router['get'](_0x964d('0xe'),auth['isAuthenticated'](),controller[_0x964d('0xf')]);router[_0x964d('0x9')](_0x964d('0x10'),auth[_0x964d('0xa')](),controller[_0x964d('0x11')]);router[_0x964d('0x12')]('/',auth[_0x964d('0xa')](),controller[_0x964d('0x13')]);router['put'](_0x964d('0xe'),auth['isAuthenticated'](),controller[_0x964d('0x14')]);router[_0x964d('0x15')](_0x964d('0xe'),auth[_0x964d('0xa')](),controller['destroy']);module[_0x964d('0x16')]=router; \ No newline at end of file +var _0x4b70=['getQuestions','post','create','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/:id','show','/:id/questions'];(function(_0x9cc727,_0x4fef14){var _0x4e6077=function(_0x29dd4b){while(--_0x29dd4b){_0x9cc727['push'](_0x9cc727['shift']());}};_0x4e6077(++_0x4fef14);}(_0x4b70,0xb9));var _0x04b7=function(_0x49ec72,_0x53774a){_0x49ec72=_0x49ec72-0x0;var _0x4058d2=_0x4b70[_0x49ec72];return _0x4058d2;};'use strict';var multer=require('multer');var util=require(_0x04b7('0x0'));var path=require(_0x04b7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x04b7('0x2')]();var fs_extra=require(_0x04b7('0x3'));var auth=require(_0x04b7('0x4'));var interaction=require(_0x04b7('0x5'));var config=require(_0x04b7('0x6'));var controller=require(_0x04b7('0x7'));router[_0x04b7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x04b7('0x8')]('/describe',auth[_0x04b7('0x9')](),controller['describe']);router[_0x04b7('0x8')](_0x04b7('0xa'),auth[_0x04b7('0x9')](),controller[_0x04b7('0xb')]);router[_0x04b7('0x8')](_0x04b7('0xc'),auth[_0x04b7('0x9')](),controller[_0x04b7('0xd')]);router[_0x04b7('0xe')]('/',auth[_0x04b7('0x9')](),controller[_0x04b7('0xf')]);router['put'](_0x04b7('0xa'),auth[_0x04b7('0x9')](),controller['update']);router[_0x04b7('0x10')](_0x04b7('0xa'),auth[_0x04b7('0x9')](),controller[_0x04b7('0x11')]);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 a100314..2dd738d 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 _0xb118=['YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x517ebd,_0x4ddf11){var _0x5f0b5c=function(_0x40f97d){while(--_0x40f97d){_0x517ebd['push'](_0x517ebd['shift']());}};_0x5f0b5c(++_0x4ddf11);}(_0xb118,0x1e8));var _0x8b11=function(_0x4da6e8,_0x463393){_0x4da6e8=_0x4da6e8-0x0;var _0x357569=_0xb118[_0x4da6e8];return _0x357569;};'use strict';var moment=require('moment');var Sequelize=require(_0x8b11('0x0'));module[_0x8b11('0x1')]={'starttime':{'type':Sequelize[_0x8b11('0x2')],'set':function(_0x5ed857){this[_0x8b11('0x3')](_0x8b11('0x4'),_0x5ed857);this[_0x8b11('0x3')](_0x8b11('0x5'),moment()[_0x8b11('0x6')](_0x8b11('0x7')));}},'endtime':{'type':Sequelize[_0x8b11('0x2')]},'membername':{'type':Sequelize[_0x8b11('0x8')]},'projectname':{'type':Sequelize[_0x8b11('0x8')]},'queue':{'type':Sequelize[_0x8b11('0x8')]},'uniqueid':{'type':Sequelize[_0x8b11('0x8')]},'calleridname':{'type':Sequelize[_0x8b11('0x8')]},'calleridnum':{'type':Sequelize[_0x8b11('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc743=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x11d8d4,_0x4a3023){var _0x57ccf6=function(_0x511af2){while(--_0x511af2){_0x11d8d4['push'](_0x11d8d4['shift']());}};_0x57ccf6(++_0x4a3023);}(_0xc743,0xa4));var _0x3c74=function(_0x28b850,_0x4f96af){_0x28b850=_0x28b850-0x0;var _0x44b823=_0xc743[_0x28b850];return _0x44b823;};'use strict';var moment=require(_0x3c74('0x0'));var Sequelize=require(_0x3c74('0x1'));module[_0x3c74('0x2')]={'starttime':{'type':Sequelize[_0x3c74('0x3')],'set':function(_0x48c3cb){this[_0x3c74('0x4')](_0x3c74('0x5'),_0x48c3cb);this[_0x3c74('0x4')]('endtime',moment()[_0x3c74('0x6')](_0x3c74('0x7')));}},'endtime':{'type':Sequelize[_0x3c74('0x3')]},'membername':{'type':Sequelize[_0x3c74('0x8')]},'projectname':{'type':Sequelize[_0x3c74('0x8')]},'queue':{'type':Sequelize[_0x3c74('0x8')]},'uniqueid':{'type':Sequelize[_0x3c74('0x8')]},'calleridname':{'type':Sequelize[_0x3c74('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x3c74('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 8c6481f..da2812e 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 _0xcefe=['describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','nolimit','order','pick','SessionId','rimraf','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','save','update','then','error','name','index','map','JscriptySessionReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','destroy','find'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xcefe,0xea));var _0xecef=function(_0x5ea952,_0xc78c71){_0x5ea952=_0x5ea952-0x0;var _0x45d14e=_0xcefe[_0x5ea952];return _0x45d14e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecef('0x1'));var rp=require(_0xecef('0x2'));var moment=require('moment');var BPromise=require(_0xecef('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xecef('0x4'));var csv=require('to-csv');var ejs=require(_0xecef('0x5'));var fs=require('fs');var fs_extra=require(_0xecef('0x6'));var _=require('lodash');var squel=require(_0xecef('0x7'));var crypto=require(_0xecef('0x8'));var jsforce=require(_0xecef('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xecef('0xa'));var Papa=require(_0xecef('0xb'));var Redis=require(_0xecef('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xecef('0xd'));var as=require(_0xecef('0xe'));var hardwareService=require(_0xecef('0xf'));var logger=require('../../config/logger')(_0xecef('0x10'));var utils=require(_0xecef('0x11'));var config=require(_0xecef('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xecef('0x13'))['db'];function respondWithStatusCode(_0x5cfc30,_0x42e4b3){_0x42e4b3=_0x42e4b3||0xcc;return function(_0xd853e){if(_0xd853e){return _0x5cfc30[_0xecef('0x14')](_0x42e4b3);}return _0x5cfc30['status'](_0x42e4b3)[_0xecef('0x15')]();};}function respondWithResult(_0x4bd4fa,_0x2eee2f){_0x2eee2f=_0x2eee2f||0xc8;return function(_0x405df2){if(_0x405df2){return _0x4bd4fa[_0xecef('0x16')](_0x2eee2f)[_0xecef('0x17')](_0x405df2);}};}function respondWithFilteredResult(_0x31d007,_0x4d7e54){return function(_0xff2348){if(_0xff2348){var _0x159c5a=typeof _0x4d7e54['offset']===_0xecef('0x18')&&typeof _0x4d7e54[_0xecef('0x19')]==='undefined';var _0xa14551=_0xff2348['count'];var _0x861ad6=_0x159c5a?0x0:_0x4d7e54[_0xecef('0x1a')];var _0x2a7fa9=_0x159c5a?_0xff2348[_0xecef('0x1b')]:_0x4d7e54[_0xecef('0x1a')]+_0x4d7e54[_0xecef('0x19')];var _0x1cdda6;if(_0x2a7fa9>=_0xa14551){_0x2a7fa9=_0xa14551;_0x1cdda6=0xc8;}else{_0x1cdda6=0xce;}_0x31d007[_0xecef('0x16')](_0x1cdda6);return _0x31d007[_0xecef('0x1c')]('Content-Range',_0x861ad6+'-'+_0x2a7fa9+'/'+_0xa14551)['json'](_0xff2348);}return null;};}function patchUpdates(_0x50c97e){return function(_0x3c9c09){try{jsonpatch[_0xecef('0x1d')](_0x3c9c09,_0x50c97e,!![]);}catch(_0x14ed11){return BPromise['reject'](_0x14ed11);}return _0x3c9c09[_0xecef('0x1e')]();};}function saveUpdates(_0x505e76,_0x9a193){return function(_0xcf3f14){if(_0xcf3f14){return _0xcf3f14[_0xecef('0x1f')](_0x505e76)[_0xecef('0x20')](function(_0x2679b3){return _0x2679b3;});}return null;};}function removeEntity(_0x53cc48,_0x52161f){return function(_0x49043a){if(_0x49043a){return _0x49043a['destroy']()['then'](function(){_0x53cc48[_0xecef('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e51ca,_0x13d4e1){return function(_0x5816e5){if(!_0x5816e5){_0x5e51ca[_0xecef('0x14')](0x194);}return _0x5816e5;};}function handleError(_0xe2a17b,_0xf81d58){_0xf81d58=_0xf81d58||0x1f4;return function(_0x1a30cd){logger[_0xecef('0x21')](_0x1a30cd['stack']);if(_0x1a30cd['name']){delete _0x1a30cd[_0xecef('0x22')];}_0xe2a17b[_0xecef('0x16')](_0xf81d58)['send'](_0x1a30cd);};}exports[_0xecef('0x23')]=function(_0x33c616,_0x302af1){var _0x5d1c1d={},_0xe4892a={},_0x2a67c4={'count':0x0,'rows':[]};var _0x4820e8=_[_0xecef('0x24')](db[_0xecef('0x25')][_0xecef('0x26')],function(_0x3f16dc){return{'name':_0x3f16dc['fieldName'],'type':_0x3f16dc['type'][_0xecef('0x27')]};});_0xe4892a['model']=_['map'](_0x4820e8,_0xecef('0x22'));_0xe4892a[_0xecef('0x28')]=_[_0xecef('0x29')](_0x33c616['query']);_0xe4892a[_0xecef('0x2a')]=_[_0xecef('0x2b')](_0xe4892a[_0xecef('0x2c')],_0xe4892a[_0xecef('0x28')]);_0x5d1c1d[_0xecef('0x2d')]=_['intersection'](_0xe4892a[_0xecef('0x2c')],qs[_0xecef('0x2e')](_0x33c616[_0xecef('0x28')][_0xecef('0x2e')]));_0x5d1c1d[_0xecef('0x2d')]=_0x5d1c1d['attributes']['length']?_0x5d1c1d[_0xecef('0x2d')]:_0xe4892a[_0xecef('0x2c')];if(!_0x33c616[_0xecef('0x28')]['hasOwnProperty']('nolimit')){_0x5d1c1d[_0xecef('0x19')]=qs[_0xecef('0x19')](_0x33c616['query'][_0xecef('0x19')]);_0x5d1c1d[_0xecef('0x1a')]=qs['offset'](_0x33c616[_0xecef('0x28')]['offset']);}_0x5d1c1d['order']=qs[_0xecef('0x2f')](_0x33c616[_0xecef('0x28')][_0xecef('0x2f')]);_0x5d1c1d[_0xecef('0x30')]=qs[_0xecef('0x2a')](_['pick'](_0x33c616['query'],_0xe4892a[_0xecef('0x2a')]),_0x4820e8);if(_0x33c616['query'][_0xecef('0x31')]){_0x5d1c1d[_0xecef('0x30')]=_[_0xecef('0x32')](_0x5d1c1d[_0xecef('0x30')],{'$or':_[_0xecef('0x24')](_0x4820e8,function(_0x17fc7d){if(_0x17fc7d[_0xecef('0x33')]!==_0xecef('0x34')){var _0x22c434={};_0x22c434[_0x17fc7d[_0xecef('0x22')]]={'$like':'%'+_0x33c616[_0xecef('0x28')][_0xecef('0x31')]+'%'};return _0x22c434;}})});}_0x5d1c1d=_[_0xecef('0x32')]({},_0x5d1c1d,_0x33c616[_0xecef('0x35')]);var _0x39511f={'where':_0x5d1c1d[_0xecef('0x30')]};return db['JscriptySessionReport']['count'](_0x39511f)[_0xecef('0x20')](function(_0xdaebac){_0x2a67c4[_0xecef('0x1b')]=_0xdaebac;if(_0x33c616[_0xecef('0x28')][_0xecef('0x36')]){_0x5d1c1d[_0xecef('0x37')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xecef('0x38')](_0x5d1c1d);})[_0xecef('0x20')](function(_0x3243ba){_0x2a67c4[_0xecef('0x39')]=_0x3243ba;return _0x2a67c4;})[_0xecef('0x20')](respondWithFilteredResult(_0x302af1,_0x5d1c1d))[_0xecef('0x3a')](handleError(_0x302af1,null));};exports[_0xecef('0x3b')]=function(_0x27a8a3,_0x2d0f20){var _0x2658c5={'raw':!![],'where':{'id':_0x27a8a3[_0xecef('0x3c')]['id']}},_0x5c6b5b={};_0x5c6b5b[_0xecef('0x2c')]=_['keys'](db[_0xecef('0x25')][_0xecef('0x26')]);_0x5c6b5b['query']=_[_0xecef('0x29')](_0x27a8a3[_0xecef('0x28')]);_0x5c6b5b['filters']=_[_0xecef('0x2b')](_0x5c6b5b[_0xecef('0x2c')],_0x5c6b5b[_0xecef('0x28')]);_0x2658c5[_0xecef('0x2d')]=_[_0xecef('0x2b')](_0x5c6b5b[_0xecef('0x2c')],qs[_0xecef('0x2e')](_0x27a8a3['query'][_0xecef('0x2e')]));_0x2658c5[_0xecef('0x2d')]=_0x2658c5[_0xecef('0x2d')][_0xecef('0x3d')]?_0x2658c5['attributes']:_0x5c6b5b[_0xecef('0x2c')];if(_0x27a8a3['query'][_0xecef('0x36')]){_0x2658c5[_0xecef('0x37')]=[{'all':!![]}];}_0x2658c5=_[_0xecef('0x32')]({},_0x2658c5,_0x27a8a3[_0xecef('0x35')]);return db[_0xecef('0x25')]['find'](_0x2658c5)['then'](handleEntityNotFound(_0x2d0f20,null))[_0xecef('0x20')](respondWithResult(_0x2d0f20,null))[_0xecef('0x3a')](handleError(_0x2d0f20,null));};exports[_0xecef('0x3e')]=function(_0x327d71,_0x4fa7e3){return db[_0xecef('0x25')]['create'](_0x327d71[_0xecef('0x3f')],{})[_0xecef('0x20')](respondWithResult(_0x4fa7e3,0xc9))[_0xecef('0x3a')](handleError(_0x4fa7e3,null));};exports[_0xecef('0x1f')]=function(_0x1255a6,_0x418155){if(_0x1255a6[_0xecef('0x3f')]['id']){delete _0x1255a6[_0xecef('0x3f')]['id'];}return db[_0xecef('0x25')]['find']({'where':{'id':_0x1255a6[_0xecef('0x3c')]['id']}})[_0xecef('0x20')](handleEntityNotFound(_0x418155,null))[_0xecef('0x20')](saveUpdates(_0x1255a6[_0xecef('0x3f')],null))['then'](respondWithResult(_0x418155,null))[_0xecef('0x3a')](handleError(_0x418155,null));};exports[_0xecef('0x40')]=function(_0x4913f0,_0x4c8a0b){return db[_0xecef('0x25')][_0xecef('0x41')]({'where':{'id':_0x4913f0[_0xecef('0x3c')]['id']}})[_0xecef('0x20')](handleEntityNotFound(_0x4c8a0b,null))[_0xecef('0x20')](removeEntity(_0x4c8a0b,null))[_0xecef('0x3a')](handleError(_0x4c8a0b,null));};exports[_0xecef('0x42')]=function(_0x31551f,_0x15964b){return db[_0xecef('0x25')][_0xecef('0x42')]()[_0xecef('0x20')](respondWithResult(_0x15964b,null))[_0xecef('0x3a')](handleError(_0x15964b,null));};exports[_0xecef('0x43')]=function(_0x5269b2,_0x3cd466,_0x259485){var _0x426150={'raw':!![],'where':{}};var _0x1dc739={};var _0x3495e6={'count':0x0,'rows':[]};return db[_0xecef('0x25')][_0xecef('0x44')]({'where':{'id':_0x5269b2[_0xecef('0x3c')]['id']}})[_0xecef('0x20')](handleEntityNotFound(_0x3cd466,null))[_0xecef('0x20')](function(_0x550e75){if(_0x550e75){_0x1dc739[_0xecef('0x2c')]=_[_0xecef('0x29')](db[_0xecef('0x45')][_0xecef('0x26')]);_0x1dc739['query']=_[_0xecef('0x29')](_0x5269b2[_0xecef('0x28')]);_0x1dc739[_0xecef('0x2a')]=_[_0xecef('0x2b')](_0x1dc739[_0xecef('0x2c')],_0x1dc739[_0xecef('0x28')]);_0x426150[_0xecef('0x2d')]=_['intersection'](_0x1dc739['model'],qs['fields'](_0x5269b2[_0xecef('0x28')]['fields']));_0x426150[_0xecef('0x2d')]=_0x426150['attributes']['length']?_0x426150[_0xecef('0x2d')]:_0x1dc739[_0xecef('0x2c')];if(!_0x5269b2[_0xecef('0x28')][_0xecef('0x46')](_0xecef('0x47'))){_0x426150['limit']=qs[_0xecef('0x19')](_0x5269b2['query'][_0xecef('0x19')]);_0x426150[_0xecef('0x1a')]=qs[_0xecef('0x1a')](_0x5269b2[_0xecef('0x28')][_0xecef('0x1a')]);}_0x426150[_0xecef('0x48')]=qs['sort'](_0x5269b2[_0xecef('0x28')][_0xecef('0x2f')]);_0x426150['where']=qs[_0xecef('0x2a')](_[_0xecef('0x49')](_0x5269b2[_0xecef('0x28')],_0x1dc739[_0xecef('0x2a')]));_0x426150[_0xecef('0x30')][_0xecef('0x4a')]=_0x550e75['id'];if(_0x5269b2['query'][_0xecef('0x31')]){_0x426150['where']=_[_0xecef('0x32')](_0x426150['where'],{'$or':_[_0xecef('0x24')](_0x426150[_0xecef('0x2d')],function(_0x49c07b){var _0x12f28f={};_0x12f28f[_0x49c07b]={'$like':'%'+_0x5269b2['query']['filter']+'%'};return _0x12f28f;})});}_0x426150=_['merge']({},_0x426150,_0x5269b2['options']);return db['JscriptyQuestionReport'][_0xecef('0x1b')]({'where':_0x426150[_0xecef('0x30')]})[_0xecef('0x20')](function(_0xf34eb9){_0x3495e6[_0xecef('0x1b')]=_0xf34eb9;if(_0x5269b2[_0xecef('0x28')][_0xecef('0x36')]){_0x426150[_0xecef('0x37')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xecef('0x38')](_0x426150);})[_0xecef('0x20')](function(_0x189486){_0x3495e6[_0xecef('0x39')]=_0x189486;return _0x3495e6;});}})['then'](respondWithFilteredResult(_0x3cd466,_0x426150))['catch'](handleError(_0x3cd466,null));}; \ No newline at end of file +var _0x9c5b=['moment','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','JscriptySessionReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','find','create','body','destroy','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','findAll','eml-format','zip-dir','fast-json-patch'];(function(_0x1100c6,_0x401e64){var _0x51a87f=function(_0x4d2254){while(--_0x4d2254){_0x1100c6['push'](_0x1100c6['shift']());}};_0x51a87f(++_0x401e64);}(_0x9c5b,0x188));var _0xb9c5=function(_0x34ce72,_0x19ce31){_0x34ce72=_0x34ce72-0x0;var _0x4a3fe8=_0x9c5b[_0x34ce72];return _0x4a3fe8;};'use strict';var emlformat=require(_0xb9c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9c5('0x1'));var jsonpatch=require(_0xb9c5('0x2'));var rp=require('request-promise');var moment=require(_0xb9c5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb9c5('0x4'));var util=require(_0xb9c5('0x5'));var path=require(_0xb9c5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb9c5('0x7'));var fs=require('fs');var fs_extra=require(_0xb9c5('0x8'));var _=require('lodash');var squel=require(_0xb9c5('0x9'));var crypto=require(_0xb9c5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb9c5('0xb'));var toCsv=require(_0xb9c5('0xc'));var querystring=require(_0xb9c5('0xd'));var Papa=require(_0xb9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xb9c5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb9c5('0x10'));var hardwareService=require(_0xb9c5('0x11'));var logger=require('../../config/logger')(_0xb9c5('0x12'));var utils=require(_0xb9c5('0x13'));var config=require(_0xb9c5('0x14'));var licenseUtil=require(_0xb9c5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7180ef,_0x14c74e){_0x14c74e=_0x14c74e||0xcc;return function(_0x4f1349){if(_0x4f1349){return _0x7180ef[_0xb9c5('0x16')](_0x14c74e);}return _0x7180ef[_0xb9c5('0x17')](_0x14c74e)[_0xb9c5('0x18')]();};}function respondWithResult(_0x44e762,_0x3328dd){_0x3328dd=_0x3328dd||0xc8;return function(_0x331232){if(_0x331232){return _0x44e762['status'](_0x3328dd)[_0xb9c5('0x19')](_0x331232);}};}function respondWithFilteredResult(_0x26b1c7,_0x4bb60e){return function(_0xbd5453){if(_0xbd5453){var _0x164fcb=typeof _0x4bb60e[_0xb9c5('0x1a')]==='undefined'&&typeof _0x4bb60e[_0xb9c5('0x1b')]===_0xb9c5('0x1c');var _0x1b6f10=_0xbd5453[_0xb9c5('0x1d')];var _0x4e18ba=_0x164fcb?0x0:_0x4bb60e[_0xb9c5('0x1a')];var _0x14c92f=_0x164fcb?_0xbd5453[_0xb9c5('0x1d')]:_0x4bb60e['offset']+_0x4bb60e[_0xb9c5('0x1b')];var _0x1814c6;if(_0x14c92f>=_0x1b6f10){_0x14c92f=_0x1b6f10;_0x1814c6=0xc8;}else{_0x1814c6=0xce;}_0x26b1c7[_0xb9c5('0x17')](_0x1814c6);return _0x26b1c7[_0xb9c5('0x1e')](_0xb9c5('0x1f'),_0x4e18ba+'-'+_0x14c92f+'/'+_0x1b6f10)[_0xb9c5('0x19')](_0xbd5453);}return null;};}function patchUpdates(_0x1096f6){return function(_0x2aa93f){try{jsonpatch[_0xb9c5('0x20')](_0x2aa93f,_0x1096f6,!![]);}catch(_0x49979b){return BPromise[_0xb9c5('0x21')](_0x49979b);}return _0x2aa93f[_0xb9c5('0x22')]();};}function saveUpdates(_0x31bee7,_0x321bb9){return function(_0x2228a7){if(_0x2228a7){return _0x2228a7[_0xb9c5('0x23')](_0x31bee7)[_0xb9c5('0x24')](function(_0x2f639d){return _0x2f639d;});}return null;};}function removeEntity(_0x3774d5,_0x11401c){return function(_0x52efbd){if(_0x52efbd){return _0x52efbd['destroy']()[_0xb9c5('0x24')](function(){_0x3774d5[_0xb9c5('0x17')](0xcc)[_0xb9c5('0x18')]();});}};}function handleEntityNotFound(_0x149135,_0x1da8f0){return function(_0x3a89e9){if(!_0x3a89e9){_0x149135[_0xb9c5('0x16')](0x194);}return _0x3a89e9;};}function handleError(_0x2564e9,_0x35f9b6){_0x35f9b6=_0x35f9b6||0x1f4;return function(_0x4b29e4){logger[_0xb9c5('0x25')](_0x4b29e4[_0xb9c5('0x26')]);if(_0x4b29e4[_0xb9c5('0x27')]){delete _0x4b29e4[_0xb9c5('0x27')];}_0x2564e9[_0xb9c5('0x17')](_0x35f9b6)[_0xb9c5('0x28')](_0x4b29e4);};}exports['index']=function(_0x56b86a,_0x1d5e71){var _0x524b5a={},_0x43673d={},_0x5b1708={'count':0x0,'rows':[]};var _0x45b0b0=_['map'](db[_0xb9c5('0x29')][_0xb9c5('0x2a')],function(_0x50de95){return{'name':_0x50de95[_0xb9c5('0x2b')],'type':_0x50de95[_0xb9c5('0x2c')]['key']};});_0x43673d[_0xb9c5('0x2d')]=_[_0xb9c5('0x2e')](_0x45b0b0,_0xb9c5('0x27'));_0x43673d[_0xb9c5('0x2f')]=_[_0xb9c5('0x30')](_0x56b86a[_0xb9c5('0x2f')]);_0x43673d[_0xb9c5('0x31')]=_[_0xb9c5('0x32')](_0x43673d[_0xb9c5('0x2d')],_0x43673d['query']);_0x524b5a[_0xb9c5('0x33')]=_[_0xb9c5('0x32')](_0x43673d[_0xb9c5('0x2d')],qs['fields'](_0x56b86a[_0xb9c5('0x2f')][_0xb9c5('0x34')]));_0x524b5a[_0xb9c5('0x33')]=_0x524b5a[_0xb9c5('0x33')][_0xb9c5('0x35')]?_0x524b5a['attributes']:_0x43673d[_0xb9c5('0x2d')];if(!_0x56b86a[_0xb9c5('0x2f')][_0xb9c5('0x36')](_0xb9c5('0x37'))){_0x524b5a[_0xb9c5('0x1b')]=qs[_0xb9c5('0x1b')](_0x56b86a[_0xb9c5('0x2f')][_0xb9c5('0x1b')]);_0x524b5a[_0xb9c5('0x1a')]=qs[_0xb9c5('0x1a')](_0x56b86a['query']['offset']);}_0x524b5a[_0xb9c5('0x38')]=qs[_0xb9c5('0x39')](_0x56b86a[_0xb9c5('0x2f')][_0xb9c5('0x39')]);_0x524b5a[_0xb9c5('0x3a')]=qs[_0xb9c5('0x31')](_[_0xb9c5('0x3b')](_0x56b86a['query'],_0x43673d[_0xb9c5('0x31')]),_0x45b0b0);if(_0x56b86a[_0xb9c5('0x2f')][_0xb9c5('0x3c')]){_0x524b5a['where']=_[_0xb9c5('0x3d')](_0x524b5a['where'],{'$or':_[_0xb9c5('0x2e')](_0x45b0b0,function(_0x14c06e){if(_0x14c06e[_0xb9c5('0x2c')]!==_0xb9c5('0x3e')){var _0x44923c={};_0x44923c[_0x14c06e[_0xb9c5('0x27')]]={'$like':'%'+_0x56b86a['query']['filter']+'%'};return _0x44923c;}})});}_0x524b5a=_[_0xb9c5('0x3d')]({},_0x524b5a,_0x56b86a[_0xb9c5('0x3f')]);var _0x1453cf={'where':_0x524b5a[_0xb9c5('0x3a')]};return db[_0xb9c5('0x29')][_0xb9c5('0x1d')](_0x1453cf)[_0xb9c5('0x24')](function(_0x2a9a4f){_0x5b1708[_0xb9c5('0x1d')]=_0x2a9a4f;if(_0x56b86a[_0xb9c5('0x2f')]['includeAll']){_0x524b5a[_0xb9c5('0x40')]=[{'all':!![]}];}return db[_0xb9c5('0x29')]['findAll'](_0x524b5a);})[_0xb9c5('0x24')](function(_0x1d30b7){_0x5b1708[_0xb9c5('0x41')]=_0x1d30b7;return _0x5b1708;})['then'](respondWithFilteredResult(_0x1d5e71,_0x524b5a))[_0xb9c5('0x42')](handleError(_0x1d5e71,null));};exports['show']=function(_0x4b402d,_0x16b9e1){var _0x1c34ff={'raw':!![],'where':{'id':_0x4b402d[_0xb9c5('0x43')]['id']}},_0x4d8fd6={};_0x4d8fd6['model']=_[_0xb9c5('0x30')](db[_0xb9c5('0x29')][_0xb9c5('0x2a')]);_0x4d8fd6[_0xb9c5('0x2f')]=_['keys'](_0x4b402d[_0xb9c5('0x2f')]);_0x4d8fd6[_0xb9c5('0x31')]=_[_0xb9c5('0x32')](_0x4d8fd6['model'],_0x4d8fd6[_0xb9c5('0x2f')]);_0x1c34ff[_0xb9c5('0x33')]=_[_0xb9c5('0x32')](_0x4d8fd6[_0xb9c5('0x2d')],qs[_0xb9c5('0x34')](_0x4b402d[_0xb9c5('0x2f')]['fields']));_0x1c34ff[_0xb9c5('0x33')]=_0x1c34ff[_0xb9c5('0x33')][_0xb9c5('0x35')]?_0x1c34ff['attributes']:_0x4d8fd6[_0xb9c5('0x2d')];if(_0x4b402d[_0xb9c5('0x2f')][_0xb9c5('0x44')]){_0x1c34ff['include']=[{'all':!![]}];}_0x1c34ff=_[_0xb9c5('0x3d')]({},_0x1c34ff,_0x4b402d[_0xb9c5('0x3f')]);return db[_0xb9c5('0x29')][_0xb9c5('0x45')](_0x1c34ff)[_0xb9c5('0x24')](handleEntityNotFound(_0x16b9e1,null))[_0xb9c5('0x24')](respondWithResult(_0x16b9e1,null))[_0xb9c5('0x42')](handleError(_0x16b9e1,null));};exports[_0xb9c5('0x46')]=function(_0x3c3f69,_0x3aee92){return db['JscriptySessionReport'][_0xb9c5('0x46')](_0x3c3f69['body'],{})[_0xb9c5('0x24')](respondWithResult(_0x3aee92,0xc9))[_0xb9c5('0x42')](handleError(_0x3aee92,null));};exports[_0xb9c5('0x23')]=function(_0x128822,_0x56c54f){if(_0x128822[_0xb9c5('0x47')]['id']){delete _0x128822[_0xb9c5('0x47')]['id'];}return db['JscriptySessionReport'][_0xb9c5('0x45')]({'where':{'id':_0x128822['params']['id']}})[_0xb9c5('0x24')](handleEntityNotFound(_0x56c54f,null))[_0xb9c5('0x24')](saveUpdates(_0x128822[_0xb9c5('0x47')],null))[_0xb9c5('0x24')](respondWithResult(_0x56c54f,null))['catch'](handleError(_0x56c54f,null));};exports[_0xb9c5('0x48')]=function(_0x1423a2,_0x10c6e5){return db[_0xb9c5('0x29')]['find']({'where':{'id':_0x1423a2['params']['id']}})['then'](handleEntityNotFound(_0x10c6e5,null))['then'](removeEntity(_0x10c6e5,null))[_0xb9c5('0x42')](handleError(_0x10c6e5,null));};exports[_0xb9c5('0x49')]=function(_0x3b2273,_0x30af15){return db[_0xb9c5('0x29')][_0xb9c5('0x49')]()[_0xb9c5('0x24')](respondWithResult(_0x30af15,null))[_0xb9c5('0x42')](handleError(_0x30af15,null));};exports[_0xb9c5('0x4a')]=function(_0x13a43c,_0x2e51d4,_0x3c3ed9){var _0x6fd606={'raw':!![],'where':{}};var _0x49541f={};var _0x98a290={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xb9c5('0x4b')]({'where':{'id':_0x13a43c['params']['id']}})[_0xb9c5('0x24')](handleEntityNotFound(_0x2e51d4,null))[_0xb9c5('0x24')](function(_0x383729){if(_0x383729){_0x49541f[_0xb9c5('0x2d')]=_[_0xb9c5('0x30')](db['JscriptyQuestionReport'][_0xb9c5('0x2a')]);_0x49541f[_0xb9c5('0x2f')]=_[_0xb9c5('0x30')](_0x13a43c['query']);_0x49541f[_0xb9c5('0x31')]=_[_0xb9c5('0x32')](_0x49541f[_0xb9c5('0x2d')],_0x49541f[_0xb9c5('0x2f')]);_0x6fd606[_0xb9c5('0x33')]=_[_0xb9c5('0x32')](_0x49541f[_0xb9c5('0x2d')],qs[_0xb9c5('0x34')](_0x13a43c[_0xb9c5('0x2f')][_0xb9c5('0x34')]));_0x6fd606['attributes']=_0x6fd606[_0xb9c5('0x33')]['length']?_0x6fd606[_0xb9c5('0x33')]:_0x49541f[_0xb9c5('0x2d')];if(!_0x13a43c[_0xb9c5('0x2f')][_0xb9c5('0x36')](_0xb9c5('0x37'))){_0x6fd606[_0xb9c5('0x1b')]=qs['limit'](_0x13a43c[_0xb9c5('0x2f')]['limit']);_0x6fd606[_0xb9c5('0x1a')]=qs[_0xb9c5('0x1a')](_0x13a43c['query'][_0xb9c5('0x1a')]);}_0x6fd606['order']=qs[_0xb9c5('0x39')](_0x13a43c['query'][_0xb9c5('0x39')]);_0x6fd606['where']=qs['filters'](_[_0xb9c5('0x3b')](_0x13a43c[_0xb9c5('0x2f')],_0x49541f[_0xb9c5('0x31')]));_0x6fd606[_0xb9c5('0x3a')][_0xb9c5('0x4c')]=_0x383729['id'];if(_0x13a43c[_0xb9c5('0x2f')]['filter']){_0x6fd606[_0xb9c5('0x3a')]=_['merge'](_0x6fd606[_0xb9c5('0x3a')],{'$or':_[_0xb9c5('0x2e')](_0x6fd606[_0xb9c5('0x33')],function(_0x360161){var _0x45c550={};_0x45c550[_0x360161]={'$like':'%'+_0x13a43c[_0xb9c5('0x2f')][_0xb9c5('0x3c')]+'%'};return _0x45c550;})});}_0x6fd606=_[_0xb9c5('0x3d')]({},_0x6fd606,_0x13a43c[_0xb9c5('0x3f')]);return db[_0xb9c5('0x4d')]['count']({'where':_0x6fd606[_0xb9c5('0x3a')]})[_0xb9c5('0x24')](function(_0x2d0769){_0x98a290[_0xb9c5('0x1d')]=_0x2d0769;if(_0x13a43c[_0xb9c5('0x2f')][_0xb9c5('0x44')]){_0x6fd606[_0xb9c5('0x40')]=[{'all':!![]}];}return db[_0xb9c5('0x4d')][_0xb9c5('0x4e')](_0x6fd606);})[_0xb9c5('0x24')](function(_0x30f1ee){_0x98a290['rows']=_0x30f1ee;return _0x98a290;});}})['then'](respondWithFilteredResult(_0x2e51d4,_0x6fd606))[_0xb9c5('0x42')](handleError(_0x2e51d4,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 098964b..50f1f7a 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 _0x81c6=['JscriptySessionReport','util','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x416fc9,_0x17b241){var _0xf399c9=function(_0x2bd383){while(--_0x2bd383){_0x416fc9['push'](_0x416fc9['shift']());}};_0xf399c9(++_0x17b241);}(_0x81c6,0x1d5));var _0x681c=function(_0x479c68,_0x4f2415){_0x479c68=_0x479c68-0x0;var _0x5215b1=_0x81c6[_0x479c68];return _0x5215b1;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c6c=['rimraf','../../config/environment','exports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x27fa92,_0xf66051){_0x27fa92=_0x27fa92-0x0;var _0x1963c0=_0x3c6c[_0x27fa92];return _0x1963c0;};'use strict';var _=require(_0xc3c6('0x0'));var util=require('util');var logger=require(_0xc3c6('0x1'))(_0xc3c6('0x2'));var moment=require(_0xc3c6('0x3'));var BPromise=require(_0xc3c6('0x4'));var rp=require(_0xc3c6('0x5'));var fs=require('fs');var path=require(_0xc3c6('0x6'));var rimraf=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0xc3c6('0x9')]=function(_0x4a2ca1,_0xe7731e){return _0x4a2ca1['define']('JscriptySessionReport',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 205380b..a538461 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 _0x1967=['then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x1967,0x173));var _0x7196=function(_0x8ddf76,_0x2bb7d3){_0x8ddf76=_0x8ddf76-0x0;var _0x31f249=_0x1967[_0x8ddf76];return _0x31f249;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x3d04=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','info'];(function(_0x185f50,_0x523682){var _0x1ca692=function(_0x5c7667){while(--_0x5c7667){_0x185f50['push'](_0x185f50['shift']());}};_0x1ca692(++_0x523682);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 3ec1a8a..2b3b458 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 _0xcc59=['index','put','/:id','isAuthenticated','update','/download_log_file','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0xcc59,0x115));var _0x9cc5=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xcc59[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x9cc5('0x0'));var util=require(_0x9cc5('0x1'));var path=require(_0x9cc5('0x2'));var timeout=require(_0x9cc5('0x3'));var express=require('express');var router=express[_0x9cc5('0x4')]();var fs_extra=require(_0x9cc5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9cc5('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x9cc5('0x7')]('/',controller[_0x9cc5('0x8')]);router[_0x9cc5('0x9')](_0x9cc5('0xa'),auth[_0x9cc5('0xb')](),controller[_0x9cc5('0xc')]);router[_0x9cc5('0x7')](_0x9cc5('0xd'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x9cc5('0xe')]=router; \ No newline at end of file +var _0x961e=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','/download_log_file','downloadLogFile'];(function(_0x2f91dd,_0x976a56){var _0x5422e7=function(_0xe330e1){while(--_0xe330e1){_0x2f91dd['push'](_0x2f91dd['shift']());}};_0x5422e7(++_0x976a56);}(_0x961e,0xf1));var _0xe961=function(_0x24e121,_0x2f18ea){_0x24e121=_0x24e121-0x0;var _0x542e8c=_0x961e[_0x24e121];return _0x542e8c;};'use strict';var multer=require(_0xe961('0x0'));var util=require(_0xe961('0x1'));var path=require(_0xe961('0x2'));var timeout=require('connect-timeout');var express=require(_0xe961('0x3'));var router=express[_0xe961('0x4')]();var fs_extra=require(_0xe961('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe961('0x6'));var config=require(_0xe961('0x7'));var controller=require(_0xe961('0x8'));router[_0xe961('0x9')]('/',controller[_0xe961('0xa')]);router['put'](_0xe961('0xb'),auth[_0xe961('0xc')](),controller['update']);router[_0xe961('0x9')](_0xe961('0xd'),auth[_0xe961('0xc')](),controller[_0xe961('0xe')]);module[_0xe961('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a425c6a..9b96722 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 _0x24f7=['INTEGER','STRING'];(function(_0x47fba3,_0x4449dd){var _0x1d2a14=function(_0x4f4c1a){while(--_0x4f4c1a){_0x47fba3['push'](_0x47fba3['shift']());}};_0x1d2a14(++_0x4449dd);}(_0x24f7,0x157));var _0x724f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x24f7[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x724f('0x0')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x724f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x582a=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x582a,0x1a7));var _0xa582=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x582a[_0x5e9876];return _0x576c48;};'use strict';var Sequelize=require(_0xa582('0x0'));module[_0xa582('0x1')]={'license':{'type':Sequelize[_0xa582('0x2')]},'data1':{'type':Sequelize[_0xa582('0x3')]},'data2':{'type':Sequelize[_0xa582('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xa582('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 30bd144..a88ab2c 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 _0x3c5f=['intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','params','get','key','demo','license-info.log','join','/var','log','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','destroy','then','sendStatus','error','stack','send','index','model','keys','License','rawAttributes','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c5f,0xec));var _0xf3c5=function(_0x4f5f0a,_0x35e9fd){_0x4f5f0a=_0x4f5f0a-0x0;var _0x52ec65=_0x3c5f[_0x4f5f0a];return _0x52ec65;};'use strict';var emlformat=require(_0xf3c5('0x0'));var rimraf=require(_0xf3c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3c5('0x2'));var rp=require(_0xf3c5('0x3'));var moment=require(_0xf3c5('0x4'));var BPromise=require(_0xf3c5('0x5'));var Mustache=require('mustache');var util=require(_0xf3c5('0x6'));var path=require(_0xf3c5('0x7'));var sox=require(_0xf3c5('0x8'));var csv=require(_0xf3c5('0x9'));var ejs=require(_0xf3c5('0xa'));var fs=require('fs');var fs_extra=require(_0xf3c5('0xb'));var _=require('lodash');var squel=require(_0xf3c5('0xc'));var crypto=require(_0xf3c5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf3c5('0xe'));var toCsv=require(_0xf3c5('0x9'));var querystring=require(_0xf3c5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf3c5('0x10'));var qs=require(_0xf3c5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3c5('0x12'));var logger=require(_0xf3c5('0x13'))(_0xf3c5('0x14'));var utils=require(_0xf3c5('0x15'));var config=require(_0xf3c5('0x16'));var licenseUtil=require(_0xf3c5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5ff6,_0x4d2aa5){_0x4d2aa5=_0x4d2aa5||0xcc;return function(_0x4fdf00){if(_0x4fdf00){return _0x1e5ff6['sendStatus'](_0x4d2aa5);}return _0x1e5ff6[_0xf3c5('0x18')](_0x4d2aa5)[_0xf3c5('0x19')]();};}function respondWithResult(_0x2c8e97,_0x426dbb){_0x426dbb=_0x426dbb||0xc8;return function(_0xd8670){if(_0xd8670){return _0x2c8e97[_0xf3c5('0x18')](_0x426dbb)['json'](_0xd8670);}};}function respondWithFilteredResult(_0x17a404,_0x5534d0){return function(_0x29a493){if(_0x29a493){var _0x491372=typeof _0x5534d0['offset']===_0xf3c5('0x1a')&&typeof _0x5534d0[_0xf3c5('0x1b')]===_0xf3c5('0x1a');var _0x150afc=_0x29a493[_0xf3c5('0x1c')];var _0x1a67ca=_0x491372?0x0:_0x5534d0['offset'];var _0x6f3df3=_0x491372?_0x29a493[_0xf3c5('0x1c')]:_0x5534d0[_0xf3c5('0x1d')]+_0x5534d0[_0xf3c5('0x1b')];var _0x1a0bbc;if(_0x6f3df3>=_0x150afc){_0x6f3df3=_0x150afc;_0x1a0bbc=0xc8;}else{_0x1a0bbc=0xce;}_0x17a404[_0xf3c5('0x18')](_0x1a0bbc);return _0x17a404[_0xf3c5('0x1e')](_0xf3c5('0x1f'),_0x1a67ca+'-'+_0x6f3df3+'/'+_0x150afc)[_0xf3c5('0x20')](_0x29a493);}return null;};}function patchUpdates(_0x5c62fa){return function(_0x52a6ab){try{jsonpatch['apply'](_0x52a6ab,_0x5c62fa,!![]);}catch(_0x4f9ee8){return BPromise[_0xf3c5('0x21')](_0x4f9ee8);}return _0x52a6ab[_0xf3c5('0x22')]();};}function saveUpdates(_0x4283d6,_0x507fc0){return function(_0x1c1060){if(_0x1c1060){return _0x1c1060['update'](_0x4283d6)['then'](function(_0xa536a5){return _0xa536a5;});}return null;};}function removeEntity(_0x225176,_0x5a3f91){return function(_0x5683ca){if(_0x5683ca){return _0x5683ca[_0xf3c5('0x23')]()[_0xf3c5('0x24')](function(){_0x225176[_0xf3c5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x562ec4,_0x2ec710){return function(_0x4644ff){if(!_0x4644ff){_0x562ec4[_0xf3c5('0x25')](0x194);}return _0x4644ff;};}function handleError(_0x51a73a,_0x425981){_0x425981=_0x425981||0x1f4;return function(_0x3e30a5){logger[_0xf3c5('0x26')](_0x3e30a5[_0xf3c5('0x27')]);if(_0x3e30a5['name']){delete _0x3e30a5['name'];}_0x51a73a[_0xf3c5('0x18')](_0x425981)[_0xf3c5('0x28')](_0x3e30a5);};}var utilLicense=require(_0xf3c5('0x17'));exports[_0xf3c5('0x29')]=function(_0x54cf67,_0x3c0dab){var _0x415135={'raw':!![],'where':{'id':0x1}},_0x360043={};_0x360043[_0xf3c5('0x2a')]=_[_0xf3c5('0x2b')](db[_0xf3c5('0x2c')][_0xf3c5('0x2d')]);_0x360043[_0xf3c5('0x2e')]=_['keys'](_0x54cf67[_0xf3c5('0x2e')]);_0x360043[_0xf3c5('0x2f')]=_[_0xf3c5('0x30')](_0x360043[_0xf3c5('0x2a')],_0x360043['query']);_0x415135[_0xf3c5('0x31')]=_[_0xf3c5('0x30')](_0x360043[_0xf3c5('0x2a')],qs[_0xf3c5('0x32')](_0x54cf67[_0xf3c5('0x2e')][_0xf3c5('0x32')]));_0x415135['attributes']=_0x415135[_0xf3c5('0x31')][_0xf3c5('0x33')]?_0x415135['attributes']:_0x360043[_0xf3c5('0x2a')];_0x415135=_[_0xf3c5('0x34')]({},_0x415135,_0x54cf67[_0xf3c5('0x35')]);return utilLicense[_0xf3c5('0x36')](_0x415135)[_0xf3c5('0x24')](respondWithResult(_0x3c0dab,null))[_0xf3c5('0x37')](handleError(_0x3c0dab,null));};exports[_0xf3c5('0x38')]=function(_0x296f5c,_0x351ace){if(_0x296f5c['body']['id']){delete _0x296f5c[_0xf3c5('0x39')]['id'];}return db[_0xf3c5('0x2c')]['find']({'where':{'id':_0x296f5c[_0xf3c5('0x3a')]['id']}})[_0xf3c5('0x24')](handleEntityNotFound(_0x351ace,null))[_0xf3c5('0x24')](function(_0x39a991){var _0x510de4=_0x39a991[_0xf3c5('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x510de4,_0x296f5c[_0xf3c5('0x39')][_0xf3c5('0x3c')]);})[_0xf3c5('0x24')](function(_0x2e8470){if(!_0x2e8470[_0xf3c5('0x3d')]){return saveUpdates(_0x296f5c[_0xf3c5('0x39')],null);}return _0x2e8470;})[_0xf3c5('0x24')](respondWithResult(_0x351ace,null))[_0xf3c5('0x37')](handleError(_0x351ace,null));};exports['downloadLogFile']=function(_0x238e27,_0x408864){var _0x287efa=_0xf3c5('0x3e');var _0x32e9e5=path[_0xf3c5('0x3f')](_0xf3c5('0x40'),_0xf3c5('0x41'),'xcally',_0x287efa);_0x408864[_0xf3c5('0x42')]('Content-disposition',_0xf3c5('0x43')+_0x287efa);_0x408864['set'](_0xf3c5('0x44'),_0xf3c5('0x45'));_0x408864[_0xf3c5('0x46')](_0x32e9e5);}; \ No newline at end of file +var _0x69ef=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','model','keys','License','query','intersection','fields','attributes','length','merge','getLicense','body','params','get','checkLicense','key','demo','catch','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x69ef,0x1ef));var _0xf69e=function(_0x4b1d48,_0x46c439){_0x4b1d48=_0x4b1d48-0x0;var _0x1524cb=_0x69ef[_0x4b1d48];return _0x1524cb;};'use strict';var emlformat=require(_0xf69e('0x0'));var rimraf=require(_0xf69e('0x1'));var zipdir=require(_0xf69e('0x2'));var jsonpatch=require(_0xf69e('0x3'));var rp=require(_0xf69e('0x4'));var moment=require(_0xf69e('0x5'));var BPromise=require(_0xf69e('0x6'));var Mustache=require(_0xf69e('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf69e('0x8'));var csv=require(_0xf69e('0x9'));var ejs=require(_0xf69e('0xa'));var fs=require('fs');var fs_extra=require(_0xf69e('0xb'));var _=require(_0xf69e('0xc'));var squel=require('squel');var crypto=require(_0xf69e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf69e('0xe'));var toCsv=require(_0xf69e('0x9'));var querystring=require(_0xf69e('0xf'));var Papa=require(_0xf69e('0x10'));var Redis=require(_0xf69e('0x11'));var authService=require(_0xf69e('0x12'));var qs=require(_0xf69e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf69e('0x14'));var logger=require('../../config/logger')(_0xf69e('0x15'));var utils=require(_0xf69e('0x16'));var config=require(_0xf69e('0x17'));var licenseUtil=require(_0xf69e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3789df,_0xb3a788){_0xb3a788=_0xb3a788||0xcc;return function(_0x4ed317){if(_0x4ed317){return _0x3789df[_0xf69e('0x19')](_0xb3a788);}return _0x3789df['status'](_0xb3a788)[_0xf69e('0x1a')]();};}function respondWithResult(_0x611465,_0x4eabd2){_0x4eabd2=_0x4eabd2||0xc8;return function(_0x43684b){if(_0x43684b){return _0x611465[_0xf69e('0x1b')](_0x4eabd2)[_0xf69e('0x1c')](_0x43684b);}};}function respondWithFilteredResult(_0x444af0,_0xe1edac){return function(_0x5ddd2b){if(_0x5ddd2b){var _0x25dea3=typeof _0xe1edac['offset']===_0xf69e('0x1d')&&typeof _0xe1edac['limit']==='undefined';var _0x40d8ce=_0x5ddd2b[_0xf69e('0x1e')];var _0x9d3f5a=_0x25dea3?0x0:_0xe1edac[_0xf69e('0x1f')];var _0x65cfdc=_0x25dea3?_0x5ddd2b[_0xf69e('0x1e')]:_0xe1edac[_0xf69e('0x1f')]+_0xe1edac[_0xf69e('0x20')];var _0x5ae0ad;if(_0x65cfdc>=_0x40d8ce){_0x65cfdc=_0x40d8ce;_0x5ae0ad=0xc8;}else{_0x5ae0ad=0xce;}_0x444af0[_0xf69e('0x1b')](_0x5ae0ad);return _0x444af0[_0xf69e('0x21')]('Content-Range',_0x9d3f5a+'-'+_0x65cfdc+'/'+_0x40d8ce)[_0xf69e('0x1c')](_0x5ddd2b);}return null;};}function patchUpdates(_0x3e0f98){return function(_0x5a5909){try{jsonpatch[_0xf69e('0x22')](_0x5a5909,_0x3e0f98,!![]);}catch(_0x46faa1){return BPromise[_0xf69e('0x23')](_0x46faa1);}return _0x5a5909[_0xf69e('0x24')]();};}function saveUpdates(_0x43f2f9,_0x4e0f23){return function(_0x2134dc){if(_0x2134dc){return _0x2134dc[_0xf69e('0x25')](_0x43f2f9)[_0xf69e('0x26')](function(_0x1b39f8){return _0x1b39f8;});}return null;};}function removeEntity(_0x49c6ab,_0x250892){return function(_0x2f5356){if(_0x2f5356){return _0x2f5356[_0xf69e('0x27')]()[_0xf69e('0x26')](function(){_0x49c6ab[_0xf69e('0x1b')](0xcc)[_0xf69e('0x1a')]();});}};}function handleEntityNotFound(_0x3aa231,_0x9c2a45){return function(_0x13c7e0){if(!_0x13c7e0){_0x3aa231[_0xf69e('0x19')](0x194);}return _0x13c7e0;};}function handleError(_0xe3161b,_0x51f2e2){_0x51f2e2=_0x51f2e2||0x1f4;return function(_0x4dbefc){logger[_0xf69e('0x28')](_0x4dbefc[_0xf69e('0x29')]);if(_0x4dbefc[_0xf69e('0x2a')]){delete _0x4dbefc[_0xf69e('0x2a')];}_0xe3161b[_0xf69e('0x1b')](_0x51f2e2)['send'](_0x4dbefc);};}var utilLicense=require(_0xf69e('0x18'));exports[_0xf69e('0x2b')]=function(_0x2cc2ad,_0x35ee25){var _0xfcdab5={'raw':!![],'where':{'id':0x1}},_0x1b3977={};_0x1b3977[_0xf69e('0x2c')]=_[_0xf69e('0x2d')](db[_0xf69e('0x2e')]['rawAttributes']);_0x1b3977[_0xf69e('0x2f')]=_['keys'](_0x2cc2ad[_0xf69e('0x2f')]);_0x1b3977['filters']=_['intersection'](_0x1b3977[_0xf69e('0x2c')],_0x1b3977[_0xf69e('0x2f')]);_0xfcdab5['attributes']=_[_0xf69e('0x30')](_0x1b3977[_0xf69e('0x2c')],qs[_0xf69e('0x31')](_0x2cc2ad[_0xf69e('0x2f')][_0xf69e('0x31')]));_0xfcdab5['attributes']=_0xfcdab5[_0xf69e('0x32')][_0xf69e('0x33')]?_0xfcdab5[_0xf69e('0x32')]:_0x1b3977[_0xf69e('0x2c')];_0xfcdab5=_[_0xf69e('0x34')]({},_0xfcdab5,_0x2cc2ad['options']);return utilLicense[_0xf69e('0x35')](_0xfcdab5)['then'](respondWithResult(_0x35ee25,null))['catch'](handleError(_0x35ee25,null));};exports['update']=function(_0x3ad79b,_0x388fe3){if(_0x3ad79b[_0xf69e('0x36')]['id']){delete _0x3ad79b[_0xf69e('0x36')]['id'];}return db['License']['find']({'where':{'id':_0x3ad79b[_0xf69e('0x37')]['id']}})[_0xf69e('0x26')](handleEntityNotFound(_0x388fe3,null))[_0xf69e('0x26')](function(_0x513bd3){var _0x5a8bd6=_0x513bd3[_0xf69e('0x38')]({'plain':!![]});return utilLicense[_0xf69e('0x39')](_0x5a8bd6,_0x3ad79b[_0xf69e('0x36')][_0xf69e('0x3a')]);})[_0xf69e('0x26')](function(_0x4bff4f){if(!_0x4bff4f[_0xf69e('0x3b')]){return saveUpdates(_0x3ad79b['body'],null);}return _0x4bff4f;})[_0xf69e('0x26')](respondWithResult(_0x388fe3,null))[_0xf69e('0x3c')](handleError(_0x388fe3,null));};exports[_0xf69e('0x3d')]=function(_0x352f77,_0x219ccc){var _0x33a02e=_0xf69e('0x3e');var _0x422510=path[_0xf69e('0x3f')](_0xf69e('0x40'),_0xf69e('0x41'),_0xf69e('0x42'),_0x33a02e);_0x219ccc[_0xf69e('0x43')]('Content-disposition',_0xf69e('0x44')+_0x33a02e);_0x219ccc['set'](_0xf69e('0x45'),_0xf69e('0x46'));_0x219ccc[_0xf69e('0x47')](_0x422510);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6a11272..8f3313e 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 _0x557c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','util'];(function(_0x3fb9a7,_0x3b14f9){var _0x2d10c6=function(_0x3d6b71){while(--_0x3d6b71){_0x3fb9a7['push'](_0x3fb9a7['shift']());}};_0x2d10c6(++_0x3b14f9);}(_0x557c,0x1df));var _0xc557=function(_0x51426b,_0x56069c){_0x51426b=_0x51426b-0x0;var _0xb53cc3=_0x557c[_0x51426b];return _0xb53cc3;};'use strict';var _=require('lodash');var util=require(_0xc557('0x0'));var logger=require(_0xc557('0x1'))(_0xc557('0x2'));var moment=require(_0xc557('0x3'));var BPromise=require(_0xc557('0x4'));var rp=require(_0xc557('0x5'));var fs=require('fs');var path=require(_0xc557('0x6'));var rimraf=require(_0xc557('0x7'));var config=require(_0xc557('0x8'));var attributes=require(_0xc557('0x9'));module['exports']=function(_0xd41faa,_0xa40d8b){return _0xd41faa[_0xc557('0xa')](_0xc557('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80ae=['./license.attributes','exports','define','license','lodash','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x3e39c2,_0x57d50c){var _0x28f1a2=function(_0x2fefd0){while(--_0x2fefd0){_0x3e39c2['push'](_0x3e39c2['shift']());}};_0x28f1a2(++_0x57d50c);}(_0x80ae,0x144));var _0xe80a=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0x80ae[_0x456bd2];return _0x2218c1;};'use strict';var _=require(_0xe80a('0x0'));var util=require('util');var logger=require(_0xe80a('0x1'))(_0xe80a('0x2'));var moment=require('moment');var BPromise=require(_0xe80a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe80a('0x4'));var rimraf=require('rimraf');var config=require(_0xe80a('0x5'));var attributes=require(_0xe80a('0x6'));module[_0xe80a('0x7')]=function(_0x2da5ff,_0x3ef873){return _0x2da5ff[_0xe80a('0x8')]('License',attributes,{'tableName':_0xe80a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 090f3e0..55ab908 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 _0xa7e9=['jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5434dd,_0x5b6caa){var _0x5d55de=function(_0x5515fe){while(--_0x5515fe){_0x5434dd['push'](_0x5434dd['shift']());}};_0x5d55de(++_0x5b6caa);}(_0xa7e9,0x14c));var _0x9a7e=function(_0x1700c1,_0xeba2e9){_0x1700c1=_0x1700c1-0x0;var _0x4bf44b=_0xa7e9[_0x1700c1];return _0x4bf44b;};'use strict';var _=require(_0x9a7e('0x0'));var util=require(_0x9a7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a7e('0x2'));var fs=require('fs');var Redis=require(_0x9a7e('0x3'));var db=require(_0x9a7e('0x4'))['db'];var utils=require(_0x9a7e('0x5'));var logger=require(_0x9a7e('0x6'))(_0x9a7e('0x7'));var config=require('../../config/environment');var jayson=require(_0x9a7e('0x8'));var client=jayson[_0x9a7e('0x9')][_0x9a7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c805e,_0x456d8d,_0x13ad18){return new BPromise(function(_0x15d692,_0x1ecbc8){return client[_0x9a7e('0xb')](_0x2c805e,_0x13ad18)['then'](function(_0x2085e9){logger[_0x9a7e('0xc')](_0x9a7e('0xd'),_0x456d8d,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x456d8d,_0x9a7e('0xe'),JSON['stringify'](_0x2085e9));if(_0x2085e9[_0x9a7e('0xf')]){if(_0x2085e9['error'][_0x9a7e('0x10')]===0x1f4){logger[_0x9a7e('0xf')](_0x9a7e('0xd'),_0x456d8d,_0x2085e9[_0x9a7e('0xf')]['message']);return _0x1ecbc8(_0x2085e9[_0x9a7e('0xf')]['message']);}logger[_0x9a7e('0xf')]('License,\x20%s,\x20%s',_0x456d8d,_0x2085e9[_0x9a7e('0xf')][_0x9a7e('0x11')]);return _0x15d692(_0x2085e9[_0x9a7e('0xf')][_0x9a7e('0x11')]);}else{logger['info'](_0x9a7e('0xd'),_0x456d8d,'request\x20sent');_0x15d692(_0x2085e9[_0x9a7e('0x12')][_0x9a7e('0x11')]);}})[_0x9a7e('0x13')](function(_0x5cee3c){logger[_0x9a7e('0xf')](_0x9a7e('0xd'),_0x456d8d,_0x5cee3c);_0x1ecbc8(_0x5cee3c);});});} \ No newline at end of file +var _0xf9d6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0xf9d6,0x179));var _0x6f9d=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xf9d6[_0x1a87b3];return _0x37e84d;};'use strict';var _=require(_0x6f9d('0x0'));var util=require(_0x6f9d('0x1'));var moment=require('moment');var BPromise=require(_0x6f9d('0x2'));var rs=require(_0x6f9d('0x3'));var fs=require('fs');var Redis=require(_0x6f9d('0x4'));var db=require(_0x6f9d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f9d('0x6'))(_0x6f9d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6f9d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x458a74,_0x55763e,_0x2112d2){return new BPromise(function(_0x32b7f8,_0x3effc8){return client[_0x6f9d('0x9')](_0x458a74,_0x2112d2)[_0x6f9d('0xa')](function(_0x467b2d){logger[_0x6f9d('0xb')]('License,\x20%s,\x20%s',_0x55763e,'request\x20sent');logger[_0x6f9d('0xc')](_0x6f9d('0xd'),_0x55763e,'request\x20sent',JSON[_0x6f9d('0xe')](_0x467b2d));if(_0x467b2d[_0x6f9d('0xf')]){if(_0x467b2d[_0x6f9d('0xf')]['code']===0x1f4){logger[_0x6f9d('0xf')](_0x6f9d('0x10'),_0x55763e,_0x467b2d[_0x6f9d('0xf')][_0x6f9d('0x11')]);return _0x3effc8(_0x467b2d[_0x6f9d('0xf')][_0x6f9d('0x11')]);}logger['error'](_0x6f9d('0x10'),_0x55763e,_0x467b2d[_0x6f9d('0xf')][_0x6f9d('0x11')]);return _0x32b7f8(_0x467b2d[_0x6f9d('0xf')][_0x6f9d('0x11')]);}else{logger['info']('License,\x20%s,\x20%s',_0x55763e,_0x6f9d('0x12'));_0x32b7f8(_0x467b2d[_0x6f9d('0x13')][_0x6f9d('0x11')]);}})['catch'](function(_0x52d071){logger['error'](_0x6f9d('0x10'),_0x55763e,_0x52d071);_0x3effc8(_0x52d071);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index bb80f31..2befab9 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 _0xfbd5=['addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','addDisposition','post','addAnswer','create','addImap'];(function(_0x1a387c,_0x3a66cc){var _0x2b8089=function(_0x3c3b89){while(--_0x3c3b89){_0x1a387c['push'](_0x1a387c['shift']());}};_0x2b8089(++_0x3a66cc);}(_0xfbd5,0x158));var _0x5fbd=function(_0x2f54f0,_0x211640){_0x2f54f0=_0x2f54f0-0x0;var _0x5d4f27=_0xfbd5[_0x2f54f0];return _0x5d4f27;};'use strict';var multer=require('multer');var util=require(_0x5fbd('0x0'));var path=require(_0x5fbd('0x1'));var timeout=require(_0x5fbd('0x2'));var express=require(_0x5fbd('0x3'));var router=express[_0x5fbd('0x4')]();var fs_extra=require(_0x5fbd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5fbd('0x6'));var controller=require(_0x5fbd('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5fbd('0x8')](_0x5fbd('0x9'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0xb')]);router['get'](_0x5fbd('0xc'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0xd')]);router['get'](_0x5fbd('0xe'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0xf')]);router[_0x5fbd('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x5fbd('0x10'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x11')]);router['get'](_0x5fbd('0x12'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x13')]);router[_0x5fbd('0x8')]('/:id/interactions',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x14')]);router[_0x5fbd('0x8')](_0x5fbd('0x15'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x16')]);router['get'](_0x5fbd('0x17'),auth['isAuthenticated'](),controller[_0x5fbd('0x18')]);router[_0x5fbd('0x8')](_0x5fbd('0x19'),auth[_0x5fbd('0xa')](),controller['verifySmtp']);router[_0x5fbd('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x5fbd('0x1a')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5fbd('0x1b')]);router[_0x5fbd('0x1c')]('/:id/canned_answers',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x1d')]);router[_0x5fbd('0x1c')]('/',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x1e')]);router[_0x5fbd('0x1c')](_0x5fbd('0x10'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x1f')]);router[_0x5fbd('0x1c')](_0x5fbd('0x12'),auth['isAuthenticated'](),controller[_0x5fbd('0x20')]);router['post']('/:id/interactions',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x21')]);router[_0x5fbd('0x1c')]('/:id/applications',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x22')]);router[_0x5fbd('0x1c')]('/:id/send',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x23')]);router['post'](_0x5fbd('0x24'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x25')]);router['put'](_0x5fbd('0xc'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x26')]);router[_0x5fbd('0x27')](_0x5fbd('0xe'),auth['isAuthenticated'](),controller[_0x5fbd('0x28')]);router['delete'](_0x5fbd('0x29'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2a')]);router['delete'](_0x5fbd('0x10'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2b')]);router[_0x5fbd('0x27')]('/:id/out_servers',auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2c')]);router[_0x5fbd('0x27')](_0x5fbd('0xc'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2d')]);router[_0x5fbd('0x27')](_0x5fbd('0x24'),auth[_0x5fbd('0xa')](),controller[_0x5fbd('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x890b=['describe','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','/:id','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x890b,0x194));var _0xb890=function(_0x552124,_0x1ba044){_0x552124=_0x552124-0x0;var _0xffe611=_0x890b[_0x552124];return _0xffe611;};'use strict';var multer=require(_0xb890('0x0'));var util=require(_0xb890('0x1'));var path=require('path');var timeout=require(_0xb890('0x2'));var express=require(_0xb890('0x3'));var router=express[_0xb890('0x4')]();var fs_extra=require(_0xb890('0x5'));var auth=require(_0xb890('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb890('0x7'));var controller=require(_0xb890('0x8'));router[_0xb890('0x9')]('/',auth[_0xb890('0xa')](),controller[_0xb890('0xb')]);router[_0xb890('0x9')]('/describe',auth[_0xb890('0xa')](),controller[_0xb890('0xc')]);router[_0xb890('0x9')]('/:id',auth[_0xb890('0xa')](),controller[_0xb890('0xd')]);router[_0xb890('0x9')](_0xb890('0xe'),auth[_0xb890('0xa')](),controller['getDispositions']);router[_0xb890('0x9')]('/:id/canned_answers',auth[_0xb890('0xa')](),controller[_0xb890('0xf')]);router['get'](_0xb890('0x10'),auth['isAuthenticated'](),controller[_0xb890('0x11')]);router[_0xb890('0x9')](_0xb890('0x12'),auth[_0xb890('0xa')](),controller[_0xb890('0x13')]);router[_0xb890('0x9')](_0xb890('0x14'),auth[_0xb890('0xa')](),controller[_0xb890('0x15')]);router[_0xb890('0x9')](_0xb890('0x16'),auth[_0xb890('0xa')](),controller[_0xb890('0x17')]);router[_0xb890('0x9')](_0xb890('0x18'),auth[_0xb890('0xa')](),controller[_0xb890('0x19')]);router[_0xb890('0x9')](_0xb890('0x1a'),auth[_0xb890('0xa')](),controller[_0xb890('0x1b')]);router[_0xb890('0x9')](_0xb890('0x1c'),auth[_0xb890('0xa')](),controller[_0xb890('0x1d')]);router['post'](_0xb890('0xe'),auth[_0xb890('0xa')](),controller[_0xb890('0x1e')]);router[_0xb890('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb890('0x20')]);router[_0xb890('0x1f')]('/',auth[_0xb890('0xa')](),controller['create']);router['post'](_0xb890('0x10'),auth[_0xb890('0xa')](),controller[_0xb890('0x21')]);router[_0xb890('0x1f')](_0xb890('0x12'),auth[_0xb890('0xa')](),controller[_0xb890('0x22')]);router['post'](_0xb890('0x14'),auth[_0xb890('0xa')](),controller[_0xb890('0x23')]);router[_0xb890('0x1f')](_0xb890('0x16'),auth['isAuthenticated'](),controller[_0xb890('0x24')]);router[_0xb890('0x1f')](_0xb890('0x25'),auth[_0xb890('0xa')](),controller[_0xb890('0x26')]);router['post'](_0xb890('0x1c'),auth[_0xb890('0xa')](),controller[_0xb890('0x27')]);router[_0xb890('0x28')]('/:id',auth[_0xb890('0xa')](),controller[_0xb890('0x29')]);router[_0xb890('0x2a')](_0xb890('0xe'),auth[_0xb890('0xa')](),controller[_0xb890('0x2b')]);router['delete'](_0xb890('0x2c'),auth[_0xb890('0xa')](),controller[_0xb890('0x2d')]);router[_0xb890('0x2a')](_0xb890('0x10'),auth[_0xb890('0xa')](),controller[_0xb890('0x2e')]);router['delete'](_0xb890('0x12'),auth[_0xb890('0xa')](),controller[_0xb890('0x2f')]);router[_0xb890('0x2a')](_0xb890('0x30'),auth[_0xb890('0xa')](),controller[_0xb890('0x31')]);router[_0xb890('0x2a')]('/:id/users',auth[_0xb890('0xa')](),controller[_0xb890('0x32')]);module[_0xb890('0x33')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ac2a18c..2588177 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 _0x5dc4=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','ENUM','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x5dc4,0x11c));var _0x45dc=function(_0x45d71d,_0x383f29){_0x45d71d=_0x45d71d-0x0;var _0x467901=_0x5dc4[_0x45d71d];return _0x467901;};'use strict';var Sequelize=require(_0x45dc('0x0'));module[_0x45dc('0x1')]={'description':{'type':Sequelize[_0x45dc('0x2')]},'name':{'type':Sequelize[_0x45dc('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x45dc('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x45dc('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x45dc('0x4')]},'markAsUnread':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x45dc('0x2')],'allowNull':![],'defaultValue':_0x45dc('0x5')},'fontSize':{'type':Sequelize[_0x45dc('0x6')](0x2)[_0x45dc('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x45dc('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x45dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x45dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x45dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x45dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x45dc('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![],'comment':_0x45dc('0x9'),'set':function(_0x2874a0){if(!_0x2874a0)this['setDataValue'](_0x45dc('0xa'),null);this[_0x45dc('0xb')]('mandatoryDisposition',_0x2874a0);}},'provider':{'type':Sequelize[_0x45dc('0xc')]('gmail','hotmail',_0x45dc('0xd'),_0x45dc('0xe')),'defaultValue':null,'get':function(){var _0x3460a0=this[_0x45dc('0xf')](_0x45dc('0x10'));return _0x3460a0||_0x45dc('0x11');},'set':function(_0x1eb81c){if(_0x1eb81c==='custom'){_0x1eb81c=null;}return this[_0x45dc('0xb')](_0x45dc('0x10'),_0x1eb81c);}}}; \ No newline at end of file +var _0xe9ff=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','provider','custom','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x643de2,_0x136b09){var _0x35902e=function(_0x4db067){while(--_0x4db067){_0x643de2['push'](_0x643de2['shift']());}};_0x35902e(++_0x136b09);}(_0xe9ff,0x1cc));var _0xfe9f=function(_0x5c19c5,_0x809a07){_0x5c19c5=_0x5c19c5-0x0;var _0x42b9b3=_0xe9ff[_0x5c19c5];return _0x42b9b3;};'use strict';var Sequelize=require('sequelize');module[_0xfe9f('0x0')]={'description':{'type':Sequelize[_0xfe9f('0x1')]},'name':{'type':Sequelize[_0xfe9f('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xfe9f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xfe9f('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xfe9f('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xfe9f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfe9f('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xfe9f('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfe9f('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfe9f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfe9f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe9f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe9f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfe9f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe9f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xfe9f('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfe9f('0x8'),'set':function(_0x463e27){if(!_0x463e27)this[_0xfe9f('0x9')](_0xfe9f('0xa'),null);this[_0xfe9f('0x9')](_0xfe9f('0xb'),_0x463e27);}},'provider':{'type':Sequelize[_0xfe9f('0xc')]('gmail',_0xfe9f('0xd'),_0xfe9f('0xe'),_0xfe9f('0xf')),'defaultValue':null,'get':function(){var _0x27865f=this['getDataValue'](_0xfe9f('0x10'));return _0x27865f||_0xfe9f('0x11');},'set':function(_0x3f0167){if(_0x3f0167==='custom'){_0x3f0167=null;}return this[_0xfe9f('0x9')](_0xfe9f('0x10'),_0x3f0167);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 2d2327d..e70e578 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 _0x804a=['./mailAccount.socket','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','find','body','custom','provider','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','findOne','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','key','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','email','attachments','join','root','basename','getSmtpOptions','List\x20not\x20found','messageId','attach','out','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','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults'];(function(_0x1f82e8,_0x13094d){var _0x4c4e3a=function(_0x4ef4a9){while(--_0x4ef4a9){_0x1f82e8['push'](_0x1f82e8['shift']());}};_0x4c4e3a(++_0x13094d);}(_0x804a,0x184));var _0xa804=function(_0x531390,_0xfb0b58){_0x531390=_0x531390-0x0;var _0x1c5c69=_0x804a[_0x531390];return _0x1c5c69;};'use strict';var moment=require('moment');var BPromise=require(_0xa804('0x0'));var util=require(_0xa804('0x1'));var path=require(_0xa804('0x2'));var _=require(_0xa804('0x3'));var juice=require(_0xa804('0x4'));var Redis=require(_0xa804('0x5'));var qs=require(_0xa804('0x6'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xa804('0x7'))['db'];config[_0xa804('0x8')]=_[_0xa804('0x9')](config[_0xa804('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa804('0xa'))['register'](socket);var jayson=require(_0xa804('0xb'));var client=jayson[_0xa804('0xc')][_0xa804('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x527fa3,_0x4c1bd6,_0x167892,_0x58d82e){return new BPromise(function(_0x38589f,_0x23d6b3){var _0x3ac894=_0x58d82e||client;return _0x3ac894[_0xa804('0xe')](_0x527fa3,_0x167892)['then'](function(_0x591fc1){logger[_0xa804('0xf')](_0xa804('0x10'),_0x4c1bd6,_0xa804('0x11'));logger[_0xa804('0x12')](_0xa804('0x13'),_0x4c1bd6,_0xa804('0x11'),JSON[_0xa804('0x14')](_0x591fc1));if(_0x591fc1[_0xa804('0x15')]){if(_0x591fc1[_0xa804('0x15')][_0xa804('0x16')]===0x1f4){logger[_0xa804('0x15')](_0xa804('0x10'),_0x4c1bd6,_0x591fc1[_0xa804('0x15')][_0xa804('0x17')]);return _0x23d6b3(_0x591fc1[_0xa804('0x15')]['message']);}logger[_0xa804('0x15')](_0xa804('0x10'),_0x4c1bd6,_0x591fc1['error'][_0xa804('0x17')]);return _0x38589f(_0x591fc1[_0xa804('0x15')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x4c1bd6,'request\x20sent');_0x38589f(_0x591fc1[_0xa804('0x18')][_0xa804('0x17')]);}})['catch'](function(_0x5b1cda){logger[_0xa804('0x15')](_0xa804('0x10'),_0x4c1bd6,_0x5b1cda);_0x23d6b3(_0x5b1cda);});});}function respondWithStatusCode(_0x59fc65,_0x10b486){_0x10b486=_0x10b486||0xcc;return function(_0x2603ea){if(_0x2603ea){return _0x59fc65[_0xa804('0x19')](_0x10b486);}return _0x59fc65[_0xa804('0x1a')](_0x10b486)[_0xa804('0x1b')]();};}function respondWithResult(_0x4803c1,_0x5d152d){_0x5d152d=_0x5d152d||0xc8;return function(_0x29c930){if(_0x29c930){return _0x4803c1['status'](_0x5d152d)[_0xa804('0x1c')](_0x29c930);}};}function respondWithFilteredResult(_0x5ac34a,_0x35c95c){return function(_0x4e22bf){if(_0x4e22bf){var _0x5190d9=typeof _0x35c95c[_0xa804('0x1d')]===_0xa804('0x1e')&&typeof _0x35c95c[_0xa804('0x1f')]===_0xa804('0x1e');var _0x1a2a1e=_0x4e22bf[_0xa804('0x20')];var _0xe78aac=_0x5190d9?0x0:_0x35c95c[_0xa804('0x1d')];var _0x1a444b=_0x5190d9?_0x4e22bf[_0xa804('0x20')]:_0x35c95c['offset']+_0x35c95c[_0xa804('0x1f')];var _0x467a61;if(_0x1a444b>=_0x1a2a1e){_0x1a444b=_0x1a2a1e;_0x467a61=0xc8;}else{_0x467a61=0xce;}_0x5ac34a['status'](_0x467a61);return _0x5ac34a[_0xa804('0x21')](_0xa804('0x22'),_0xe78aac+'-'+_0x1a444b+'/'+_0x1a2a1e)[_0xa804('0x1c')](_0x4e22bf);}return null;};}function saveUpdates(_0x525492){return function(_0x1bc4a2){if(_0x1bc4a2){return _0x1bc4a2[_0xa804('0x23')](_0x525492)[_0xa804('0x24')](function(_0x4c8ac0){return _0x4c8ac0;});}return null;};}function removeEntity(_0x25a3d3){return function(_0x35d1ac){if(_0x35d1ac){return _0x35d1ac[_0xa804('0x25')]()[_0xa804('0x24')](function(){var _0x492c63=_0x35d1ac[_0xa804('0x26')]({'plain':!![]});var _0x37e574='MailAccounts';return db[_0xa804('0x27')][_0xa804('0x25')]({'where':{'type':_0x37e574,'resourceId':_0x492c63['id']}})[_0xa804('0x24')](function(){return _0x35d1ac;});})[_0xa804('0x24')](function(){_0x25a3d3[_0xa804('0x1a')](0xcc)[_0xa804('0x1b')]();});}};}function handleEntityNotFound(_0x57317b){return function(_0x6c0b22){if(!_0x6c0b22){_0x57317b['sendStatus'](0x194);}return _0x6c0b22;};}function handleError(_0x54b356,_0x195ec3){_0x195ec3=_0x195ec3||0x1f4;return function(_0x4d8424){logger[_0xa804('0x15')](_0x4d8424[_0xa804('0x28')]);if(_0x4d8424[_0xa804('0x29')]){delete _0x4d8424[_0xa804('0x29')];}_0x54b356[_0xa804('0x1a')](_0x195ec3)[_0xa804('0x2a')](_0x4d8424);};}function getImapHost(_0x4be84e){switch(_0x4be84e){case _0xa804('0x2b'):return _0xa804('0x2c');case _0xa804('0x2d'):return _0xa804('0x2e');case _0xa804('0x2f'):return _0xa804('0x30');case _0xa804('0x31'):return _0xa804('0x32');}throw new Error(_0xa804('0x33'),_0x4be84e);}function getSmtpHost(_0x4029b2){switch(_0x4029b2){case _0xa804('0x2b'):return _0xa804('0x34');case _0xa804('0x2d'):return _0xa804('0x35');case _0xa804('0x2f'):return _0xa804('0x36');case _0xa804('0x31'):return _0xa804('0x37');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4029b2);}function getAuthenticationOptions(_0x9149d,_0x56ae98){var _0x31b6f0={};var _0xe2e44e={};if(_0x9149d){_0x31b6f0[_0xa804('0x38')]=_0xe2e44e['user']=_0x56ae98['username'];_0x31b6f0['password']=_0xe2e44e[_0xa804('0x39')]=_0x56ae98[_0xa804('0x3a')];if(_0x56ae98[_0xa804('0x3b')]){_0x31b6f0[_0xa804('0x3b')]=_0xe2e44e[_0xa804('0x3b')]=!![];_0x31b6f0[_0xa804('0x3c')]=_0xe2e44e[_0xa804('0x3c')]=_0x56ae98[_0xa804('0x3c')];_0x31b6f0[_0xa804('0x3a')]=_0xe2e44e[_0xa804('0x39')]=null;}else{_0x31b6f0[_0xa804('0x3c')]=_0xe2e44e[_0xa804('0x3c')]=null;}_0x31b6f0[_0xa804('0x3d')]=getImapHost(_0x9149d);_0x31b6f0[_0xa804('0x3e')]=0x3e1;_0xe2e44e[_0xa804('0x3d')]=getSmtpHost(_0x9149d);_0xe2e44e[_0xa804('0x3e')]=0x24b;_0xe2e44e[_0xa804('0x3f')]=![];_0x31b6f0[_0xa804('0x40')]=_0xe2e44e['service']=null;}else{if(_0x56ae98[_0xa804('0x41')]){_0x31b6f0[_0xa804('0x38')]=_0xe2e44e[_0xa804('0x38')]=_0x56ae98[_0xa804('0x42')];_0x31b6f0[_0xa804('0x3a')]=_0xe2e44e[_0xa804('0x39')]=_0x56ae98[_0xa804('0x3a')];}else{_0x31b6f0[_0xa804('0x41')]=_0xe2e44e[_0xa804('0x41')]=![];_0x31b6f0['user']=_0xe2e44e['user']=null;_0x31b6f0['password']=_0xe2e44e[_0xa804('0x39')]=null;}_0x31b6f0[_0xa804('0x3d')]=_0x56ae98[_0xa804('0x43')][_0xa804('0x3d')];_0x31b6f0[_0xa804('0x3e')]=_0x56ae98[_0xa804('0x43')][_0xa804('0x3e')];_0xe2e44e[_0xa804('0x3d')]=_0x56ae98[_0xa804('0x44')]['host'];_0xe2e44e[_0xa804('0x3e')]=_0x56ae98['Smtp']['port'];}return{'Imap':_0x31b6f0,'Smtp':_0xe2e44e};}exports[_0xa804('0x45')]=function(_0x3b28bc,_0x15676f){var _0x4340d2={'include':[{'model':db[_0xa804('0x46')],'as':_0xa804('0x43')},{'model':db[_0xa804('0x47')],'as':_0xa804('0x44')},{'model':db[_0xa804('0x48')],'as':'mandatoryDispositionPause'}]},_0x5dd8e7={},_0xb5b6be={'count':0x0,'rows':[]};var _0x348fb9=_[_0xa804('0x49')](db[_0xa804('0x4a')][_0xa804('0x4b')],function(_0x1a0463){return{'name':_0x1a0463[_0xa804('0x4c')],'type':_0x1a0463[_0xa804('0x4d')]['key']};});_0x5dd8e7[_0xa804('0x4e')]=_[_0xa804('0x49')](_0x348fb9,'name');_0x5dd8e7[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x3b28bc['query']);_0x5dd8e7[_0xa804('0x51')]=_['intersection'](_0x5dd8e7['model'],_0x5dd8e7[_0xa804('0x4f')]);_0x4340d2[_0xa804('0x52')]=_[_0xa804('0x53')](_0x5dd8e7[_0xa804('0x4e')],qs[_0xa804('0x54')](_0x3b28bc[_0xa804('0x4f')][_0xa804('0x54')]));_0x4340d2[_0xa804('0x52')]=_0x4340d2[_0xa804('0x52')][_0xa804('0x55')]?_0x4340d2[_0xa804('0x52')]:_0x5dd8e7[_0xa804('0x4e')];if(!_0x3b28bc[_0xa804('0x4f')][_0xa804('0x56')](_0xa804('0x57'))){_0x4340d2[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x3b28bc[_0xa804('0x4f')][_0xa804('0x1f')]);_0x4340d2[_0xa804('0x1d')]=qs[_0xa804('0x1d')](_0x3b28bc[_0xa804('0x4f')]['offset']);}_0x4340d2['order']=qs[_0xa804('0x58')](_0x3b28bc[_0xa804('0x4f')][_0xa804('0x58')]);_0x4340d2[_0xa804('0x59')]=qs[_0xa804('0x51')](_['pick'](_0x3b28bc[_0xa804('0x4f')],_0x5dd8e7[_0xa804('0x51')]),_0x348fb9);if(_0x3b28bc[_0xa804('0x4f')][_0xa804('0x5a')]){_0x4340d2['where']=_[_0xa804('0x5b')](_0x4340d2[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x348fb9,function(_0x2a74ec){if(_0x2a74ec['type']!=='VIRTUAL'){var _0x51e0af={};_0x51e0af[_0x2a74ec[_0xa804('0x29')]]={'$like':'%'+_0x3b28bc[_0xa804('0x4f')][_0xa804('0x5a')]+'%'};return _0x51e0af;}})});}_0x4340d2=_[_0xa804('0x5b')]({},_0x4340d2,_0x3b28bc[_0xa804('0x5c')]);var _0x525027={'where':_0x4340d2[_0xa804('0x59')]};return db[_0xa804('0x4a')][_0xa804('0x20')](_0x525027)[_0xa804('0x24')](function(_0x46f706){_0xb5b6be[_0xa804('0x20')]=_0x46f706;if(_0x3b28bc[_0xa804('0x4f')][_0xa804('0x5d')]){_0x4340d2[_0xa804('0x5e')]=[{'all':!![]}];}return db[_0xa804('0x4a')][_0xa804('0x5f')](_0x4340d2);})['then'](function(_0x303c9f){_0xb5b6be['rows']=_0x303c9f;return _0xb5b6be;})[_0xa804('0x24')](respondWithFilteredResult(_0x15676f,_0x4340d2))[_0xa804('0x60')](handleError(_0x15676f,null));};exports[_0xa804('0x61')]=function(_0x5c57bf,_0x835092){var _0x275b7f={'raw':![],'where':{'id':_0x5c57bf[_0xa804('0x62')]['id']},'include':[{'model':db[_0xa804('0x46')],'as':_0xa804('0x43')},{'model':db[_0xa804('0x47')],'as':_0xa804('0x44')},{'model':db[_0xa804('0x48')],'as':'mandatoryDispositionPause'}]},_0x20d49b={};_0x20d49b[_0xa804('0x4e')]=_['keys'](db[_0xa804('0x4a')]['rawAttributes']);_0x20d49b['query']=_['keys'](_0x5c57bf['query']);_0x20d49b[_0xa804('0x51')]=_[_0xa804('0x53')](_0x20d49b[_0xa804('0x4e')],_0x20d49b['query']);_0x275b7f[_0xa804('0x52')]=_['intersection'](_0x20d49b[_0xa804('0x4e')],qs[_0xa804('0x54')](_0x5c57bf[_0xa804('0x4f')][_0xa804('0x54')]));_0x275b7f[_0xa804('0x52')]=_0x275b7f[_0xa804('0x52')][_0xa804('0x55')]?_0x275b7f['attributes']:_0x20d49b[_0xa804('0x4e')];if(_0x5c57bf['query']['includeAll']){_0x275b7f[_0xa804('0x5e')]=[{'all':!![]}];}_0x275b7f=_[_0xa804('0x5b')]({},_0x275b7f,_0x5c57bf[_0xa804('0x5c')]);return db['MailAccount'][_0xa804('0x63')](_0x275b7f)[_0xa804('0x24')](handleEntityNotFound(_0x835092,null))[_0xa804('0x24')](respondWithResult(_0x835092,null))[_0xa804('0x60')](handleError(_0x835092,null));};exports[_0xa804('0x23')]=function(_0x2e25ee,_0x105e5f){if(_0x2e25ee[_0xa804('0x64')]['id']){delete _0x2e25ee[_0xa804('0x64')]['id'];}var _0x544b31=_0x2e25ee[_0xa804('0x64')]['provider']===_0xa804('0x65')?null:_0x2e25ee[_0xa804('0x64')][_0xa804('0x66')];var _0x4e1148=_0x2e25ee[_0xa804('0x64')][_0xa804('0x43')]||{};var _0x2bbf75=_0x2e25ee['body']['Smtp']||{};if(_0x544b31){_0x4e1148[_0xa804('0x3d')]=getImapHost(_0x544b31);_0x4e1148['port']=0x3e1;_0x2bbf75['host']=getSmtpHost(_0x544b31);_0x2bbf75[_0xa804('0x3e')]=0x24b;_0x2bbf75['secure']=![];}if(_0x2bbf75[_0xa804('0x3b')]){_0x2bbf75['secure']=![];}else{_0x2bbf75[_0xa804('0x3c')]=null;}if(!_0x4e1148[_0xa804('0x3b')])_0x4e1148['CloudProviderId']=null;_0x2e25ee[_0xa804('0x64')][_0xa804('0x43')]=_0x4e1148;_0x2e25ee[_0xa804('0x64')][_0xa804('0x44')]=_0x2bbf75;return db[_0xa804('0x4a')]['find']({'where':{'id':_0x2e25ee[_0xa804('0x62')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xa804('0x43')},{'model':db['MailServerOut'],'as':_0xa804('0x44')},{'model':db[_0xa804('0x48')],'as':_0xa804('0x67')}]})[_0xa804('0x24')](handleEntityNotFound(_0x105e5f,null))[_0xa804('0x24')](function(_0x55c1e6){if(!_0x55c1e6)throw new Error(_0xa804('0x68'));if(_0x55c1e6[_0xa804('0x40')])delete _0x2e25ee['body'][_0xa804('0x43')];return _0x55c1e6;})[_0xa804('0x24')](saveUpdates(_0x2e25ee[_0xa804('0x64')],null))[_0xa804('0x24')](function(_0x10eb9e){if(!_0x2e25ee['body'][_0xa804('0x43')])return _0x10eb9e;return db[_0xa804('0x46')][_0xa804('0x23')](_0x2e25ee[_0xa804('0x64')][_0xa804('0x43')],{'where':{'MailAccountId':_0x10eb9e['id']}})[_0xa804('0x24')](function(){return _0x10eb9e;});})['then'](function(_0x115e13){if(!_0x2e25ee[_0xa804('0x64')][_0xa804('0x44')])return _0x115e13;return db[_0xa804('0x47')][_0xa804('0x23')](_0x2e25ee[_0xa804('0x64')][_0xa804('0x44')],{'where':{'MailAccountId':_0x115e13['id']}})['then'](function(){return _0x115e13;});})['then'](respondWithResult(_0x105e5f,null))['catch'](handleError(_0x105e5f,null));};exports[_0xa804('0x69')]=function(_0x12f049,_0x11afa8){return db[_0xa804('0x4a')][_0xa804('0x69')]()[_0xa804('0x24')](respondWithResult(_0x11afa8,null))[_0xa804('0x60')](handleError(_0x11afa8,null));};exports[_0xa804('0x6a')]=function(_0x3bba5f,_0x1fbe37){if(_0x3bba5f[_0xa804('0x64')]['id']){delete _0x3bba5f['body']['id'];}return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x3bba5f['params']['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x1fbe37,null))[_0xa804('0x24')](function(_0x4e13ad){if(_0x4e13ad){_0x3bba5f['body'][_0xa804('0x6b')]=_0x4e13ad['id'];return db[_0xa804('0x6c')]['create'](_0x3bba5f[_0xa804('0x64')]);}})[_0xa804('0x24')](respondWithResult(_0x1fbe37,null))[_0xa804('0x60')](handleError(_0x1fbe37,null));};exports['getDispositions']=function(_0x4ecca3,_0xe4e1be){var _0x318bf9={'raw':![],'where':{}};var _0x23e31e={};var _0x14cdf8={'count':0x0,'rows':[]};return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x4ecca3[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0xe4e1be,null))[_0xa804('0x24')](function(_0x5d2f7c){if(_0x5d2f7c){_0x23e31e[_0xa804('0x4e')]=_[_0xa804('0x50')](db[_0xa804('0x6c')][_0xa804('0x4b')]);_0x23e31e[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x4ecca3[_0xa804('0x4f')]);_0x23e31e[_0xa804('0x51')]=_['intersection'](_0x23e31e['model'],_0x23e31e['query']);_0x318bf9['attributes']=_[_0xa804('0x53')](_0x23e31e[_0xa804('0x4e')],qs['fields'](_0x4ecca3[_0xa804('0x4f')][_0xa804('0x54')]));_0x318bf9['attributes']=_0x318bf9['attributes']['length']?_0x318bf9[_0xa804('0x52')]:_0x23e31e['model'];if(!_0x4ecca3[_0xa804('0x4f')]['hasOwnProperty'](_0xa804('0x57'))){_0x318bf9[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x4ecca3['query']['limit']);_0x318bf9['offset']=qs[_0xa804('0x1d')](_0x4ecca3[_0xa804('0x4f')][_0xa804('0x1d')]);}_0x318bf9[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x4ecca3[_0xa804('0x4f')]['sort']);_0x318bf9[_0xa804('0x59')]=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x4ecca3['query'],_0x23e31e[_0xa804('0x51')]));_0x318bf9['where'][_0xa804('0x6b')]=_0x5d2f7c['id'];if(_0x4ecca3[_0xa804('0x4f')][_0xa804('0x5a')]){_0x318bf9['where']=_[_0xa804('0x5b')](_0x318bf9[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x318bf9[_0xa804('0x52')],function(_0x5ecae0){var _0x1c3d14={};_0x1c3d14[_0x5ecae0]={'$like':'%'+_0x4ecca3[_0xa804('0x4f')][_0xa804('0x5a')]+'%'};return _0x1c3d14;})});}_0x318bf9=_[_0xa804('0x5b')]({},_0x318bf9,_0x4ecca3[_0xa804('0x5c')]);return db['Disposition']['count']({'where':_0x318bf9[_0xa804('0x59')]})[_0xa804('0x24')](function(_0x24d6e6){_0x14cdf8['count']=_0x24d6e6;if(_0x4ecca3[_0xa804('0x4f')]['includeAll']){_0x318bf9[_0xa804('0x5e')]=[{'all':!![]}];}return db[_0xa804('0x6c')]['findAll'](_0x318bf9);})[_0xa804('0x24')](function(_0x12c58d){_0x14cdf8[_0xa804('0x70')]=_0x12c58d;return _0x14cdf8;});}})[_0xa804('0x24')](respondWithFilteredResult(_0xe4e1be,_0x318bf9))[_0xa804('0x60')](handleError(_0xe4e1be,null));};exports[_0xa804('0x71')]=function(_0x4682aa,_0x19bca3){return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4682aa[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x19bca3,null))[_0xa804('0x24')](function(_0x4f3cfb){if(_0x4f3cfb){return _0x4f3cfb['removeDispositions'](_0x4682aa[_0xa804('0x4f')][_0xa804('0x72')]);}})['then'](respondWithStatusCode(_0x19bca3,null))[_0xa804('0x60')](handleError(_0x19bca3,null));};exports[_0xa804('0x73')]=function(_0x54a124,_0x1170ec){if(_0x54a124[_0xa804('0x64')]['id']){delete _0x54a124['body']['id'];}return db['MailAccount'][_0xa804('0x63')]({'where':{'id':_0x54a124[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x1170ec,null))[_0xa804('0x24')](function(_0x147606){if(_0x147606){_0x54a124['body'][_0xa804('0x6b')]=_0x147606['id'];return db[_0xa804('0x74')][_0xa804('0x75')](_0x54a124[_0xa804('0x64')]);}})[_0xa804('0x24')](respondWithResult(_0x1170ec,null))['catch'](handleError(_0x1170ec,null));};exports[_0xa804('0x76')]=function(_0x4d755a,_0x3a5d70){var _0x2284f1={'raw':![],'where':{}};var _0x46652a={};var _0xb5e14f={'count':0x0,'rows':[]};return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x4d755a[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x3a5d70,null))['then'](function(_0x31a4f2){if(_0x31a4f2){_0x46652a[_0xa804('0x4e')]=_['keys'](db[_0xa804('0x74')]['rawAttributes']);_0x46652a[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x4d755a[_0xa804('0x4f')]);_0x46652a[_0xa804('0x51')]=_[_0xa804('0x53')](_0x46652a['model'],_0x46652a[_0xa804('0x4f')]);_0x2284f1[_0xa804('0x52')]=_['intersection'](_0x46652a['model'],qs[_0xa804('0x54')](_0x4d755a[_0xa804('0x4f')][_0xa804('0x54')]));_0x2284f1[_0xa804('0x52')]=_0x2284f1[_0xa804('0x52')]['length']?_0x2284f1[_0xa804('0x52')]:_0x46652a['model'];if(!_0x4d755a[_0xa804('0x4f')][_0xa804('0x56')]('nolimit')){_0x2284f1[_0xa804('0x1f')]=qs['limit'](_0x4d755a['query']['limit']);_0x2284f1['offset']=qs[_0xa804('0x1d')](_0x4d755a[_0xa804('0x4f')][_0xa804('0x1d')]);}_0x2284f1[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x4d755a[_0xa804('0x4f')]['sort']);_0x2284f1[_0xa804('0x59')]=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x4d755a['query'],_0x46652a[_0xa804('0x51')]));_0x2284f1[_0xa804('0x59')][_0xa804('0x6b')]=_0x31a4f2['id'];if(_0x4d755a[_0xa804('0x4f')][_0xa804('0x5a')]){_0x2284f1[_0xa804('0x59')]=_['merge'](_0x2284f1['where'],{'$or':_[_0xa804('0x49')](_0x2284f1[_0xa804('0x52')],function(_0x33056b){var _0x389a91={};_0x389a91[_0x33056b]={'$like':'%'+_0x4d755a['query'][_0xa804('0x5a')]+'%'};return _0x389a91;})});}_0x2284f1=_[_0xa804('0x5b')]({},_0x2284f1,_0x4d755a[_0xa804('0x5c')]);return db['CannedAnswer'][_0xa804('0x20')]({'where':_0x2284f1[_0xa804('0x59')]})[_0xa804('0x24')](function(_0x533043){_0xb5e14f['count']=_0x533043;if(_0x4d755a[_0xa804('0x4f')][_0xa804('0x5d')]){_0x2284f1[_0xa804('0x5e')]=[{'all':!![]}];}return db[_0xa804('0x74')][_0xa804('0x5f')](_0x2284f1);})[_0xa804('0x24')](function(_0x5073fd){_0xb5e14f[_0xa804('0x70')]=_0x5073fd;return _0xb5e14f;});}})[_0xa804('0x24')](respondWithFilteredResult(_0x3a5d70,_0x2284f1))[_0xa804('0x60')](handleError(_0x3a5d70,null));};exports[_0xa804('0x77')]=function(_0x5611a,_0x6438a){return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x5611a[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x6438a,null))[_0xa804('0x24')](function(_0xe2a2ff){if(_0xe2a2ff){return _0xe2a2ff[_0xa804('0x77')](_0x5611a[_0xa804('0x4f')][_0xa804('0x72')]);}})[_0xa804('0x24')](respondWithStatusCode(_0x6438a,null))[_0xa804('0x60')](handleError(_0x6438a,null));};exports[_0xa804('0x75')]=function(_0x2a700d,_0x3acd0f){var _0x5e95db={'name':_0x2a700d[_0xa804('0x64')][_0xa804('0x29')],'key':_0x2a700d['body'][_0xa804('0x78')],'provider':_0x2a700d[_0xa804('0x64')][_0xa804('0x66')]===_0xa804('0x65')?null:_0x2a700d[_0xa804('0x64')][_0xa804('0x66')],'email':_0x2a700d[_0xa804('0x64')]['email'],'ListId':_0x2a700d[_0xa804('0x64')][_0xa804('0x79')],'active':!_[_0xa804('0x7a')](_0x2a700d[_0xa804('0x64')][_0xa804('0x7b')])?_0x2a700d[_0xa804('0x64')][_0xa804('0x7b')]:!![],'description':_0x2a700d[_0xa804('0x64')][_0xa804('0x7c')]||null};var _0xbd3b08=getAuthenticationOptions(_0x5e95db[_0xa804('0x66')],_0x2a700d[_0xa804('0x64')]);_0x5e95db[_0xa804('0x43')]=_0xbd3b08[_0xa804('0x43')];_0x5e95db[_0xa804('0x44')]=_0xbd3b08[_0xa804('0x44')];return db['MailAccount'][_0xa804('0x75')](_0x5e95db,{'include':[{'model':db[_0xa804('0x47')],'as':_0xa804('0x44')},{'model':db[_0xa804('0x46')],'as':_0xa804('0x43')}]})['then'](function(_0x2c81cd){var _0x641614=_0x2a700d['user']['get']({'plain':!![]});if(!_0x641614)throw new Error(_0xa804('0x7d'));if(_0x641614[_0xa804('0x7e')]===_0xa804('0x38')){var _0x399ce0=_0x2c81cd['get']({'plain':!![]});return db[_0xa804('0x7f')][_0xa804('0x63')]({'where':{'name':_0xa804('0x80'),'userProfileId':_0x641614[_0xa804('0x81')]},'raw':!![]})[_0xa804('0x24')](function(_0xef7333){if(_0xef7333&&_0xef7333[_0xa804('0x82')]===0x0){return db['UserProfileResource'][_0xa804('0x75')]({'name':_0x399ce0['name'],'resourceId':_0x399ce0['id'],'type':_0xef7333[_0xa804('0x29')],'sectionId':_0xef7333['id']},{})['then'](function(){return _0x2c81cd;});}else{return _0x2c81cd;}})[_0xa804('0x60')](function(_0x1143a8){logger[_0xa804('0x15')](_0xa804('0x83'),_0x1143a8);throw _0x1143a8;});}return _0x2c81cd;})[_0xa804('0x24')](respondWithResult(_0x3acd0f,0xc9))[_0xa804('0x60')](handleError(_0x3acd0f,null));};exports[_0xa804('0x84')]=function(_0x2964ef,_0x400665){return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x2964ef[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x400665,null))[_0xa804('0x24')](function(_0x3ff3a4){if(_0x3ff3a4){return _0x3ff3a4[_0xa804('0x84')]();}return null;})[_0xa804('0x24')](respondWithResult(_0x400665,null))[_0xa804('0x60')](handleError(_0x400665,null));};exports[_0xa804('0x85')]=function(_0x4e90da,_0x3774d2){if(_0x4e90da[_0xa804('0x64')]['id']){delete _0x4e90da[_0xa804('0x64')]['id'];}return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4e90da[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x3774d2,null))['then'](function(_0x1f9a43){if(_0x1f9a43){_0x4e90da[_0xa804('0x64')][_0xa804('0x6b')]=_0x1f9a43['id'];return db[_0xa804('0x46')]['create'](_0x4e90da[_0xa804('0x64')]);}})[_0xa804('0x24')](respondWithResult(_0x3774d2,null))[_0xa804('0x60')](handleError(_0x3774d2,null));};exports['removeImap']=function(_0x2221f9,_0x405c6e){return db[_0xa804('0x4a')]['findOne']({'where':{'id':_0x2221f9[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x405c6e,null))[_0xa804('0x24')](function(_0x1fcd0f){if(_0x1fcd0f){return _0x1fcd0f[_0xa804('0x86')](null);}return null;})[_0xa804('0x24')](respondWithStatusCode(_0x405c6e,null))[_0xa804('0x60')](handleError(_0x405c6e,null));};exports[_0xa804('0x87')]=function(_0x4b9344,_0x131e2a){return db['MailAccount'][_0xa804('0x6d')]({'where':{'id':_0x4b9344[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x131e2a,null))[_0xa804('0x24')](function(_0x2a4646){if(_0x2a4646){return _0x2a4646[_0xa804('0x87')]();}return null;})[_0xa804('0x24')](respondWithResult(_0x131e2a,null))[_0xa804('0x60')](handleError(_0x131e2a,null));};exports[_0xa804('0x88')]=function(_0x4e7cc5,_0x54fac5){if(_0x4e7cc5[_0xa804('0x64')]['id']){delete _0x4e7cc5[_0xa804('0x64')]['id'];}return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4e7cc5['params']['id']}})['then'](handleEntityNotFound(_0x54fac5,null))['then'](function(_0x51f136){if(_0x51f136){_0x4e7cc5[_0xa804('0x64')]['MailAccountId']=_0x51f136['id'];return db[_0xa804('0x47')][_0xa804('0x75')](_0x4e7cc5[_0xa804('0x64')]);}})['then'](respondWithResult(_0x54fac5,null))[_0xa804('0x60')](handleError(_0x54fac5,null));};exports[_0xa804('0x89')]=function(_0x48d0f9,_0x187d1d){return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x48d0f9[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x187d1d,null))['then'](function(_0x2a0062){if(_0x2a0062){return _0x2a0062[_0xa804('0x8a')](null);}return null;})[_0xa804('0x24')](respondWithStatusCode(_0x187d1d,null))[_0xa804('0x60')](handleError(_0x187d1d,null));};exports[_0xa804('0x8b')]=function(_0xb49440,_0x30e1d1){return db[_0xa804('0x8c')][_0xa804('0x63')]({'where':{'id':_0xb49440[_0xa804('0x62')]['id']}})['then'](handleEntityNotFound(_0x30e1d1,null))[_0xa804('0x24')](function(_0x49d51a){if(_0x49d51a){return _0x49d51a['addInteraction'](_0xb49440[_0xa804('0x64')]['ids'],_['omit'](_0xb49440['body'],[_0xa804('0x72'),'id'])||{});}})[_0xa804('0x24')](respondWithResult(_0x30e1d1,null))[_0xa804('0x60')](handleError(_0x30e1d1,null));};exports[_0xa804('0x8d')]=function(_0x4fe676,_0x4ee135){var _0x4a1fe7={'raw':![],'where':{}};var _0x3e338c={};var _0x3c4c92={'count':0x0,'rows':[]};return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x4fe676['params']['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x4ee135,null))[_0xa804('0x24')](function(_0x447131){if(_0x447131){_0x3e338c[_0xa804('0x4e')]=_[_0xa804('0x50')](db['MailInteraction']['rawAttributes']);_0x3e338c[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x4fe676[_0xa804('0x4f')]);_0x3e338c[_0xa804('0x51')]=_[_0xa804('0x53')](_0x3e338c['model'],_0x3e338c[_0xa804('0x4f')]);_0x4a1fe7[_0xa804('0x52')]=_[_0xa804('0x53')](_0x3e338c[_0xa804('0x4e')],qs['fields'](_0x4fe676[_0xa804('0x4f')]['fields']));_0x4a1fe7[_0xa804('0x52')]=_0x4a1fe7[_0xa804('0x52')][_0xa804('0x55')]?_0x4a1fe7[_0xa804('0x52')]:_0x3e338c[_0xa804('0x4e')];if(!_0x4fe676[_0xa804('0x4f')][_0xa804('0x56')](_0xa804('0x57'))){_0x4a1fe7['limit']=qs['limit'](_0x4fe676[_0xa804('0x4f')][_0xa804('0x1f')]);_0x4a1fe7[_0xa804('0x1d')]=qs['offset'](_0x4fe676[_0xa804('0x4f')][_0xa804('0x1d')]);}_0x4a1fe7['order']=qs['sort'](_0x4fe676[_0xa804('0x4f')][_0xa804('0x58')]);_0x4a1fe7['where']=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x4fe676[_0xa804('0x4f')],_0x3e338c[_0xa804('0x51')]));_0x4a1fe7['where'][_0xa804('0x6b')]=_0x447131['id'];if(_0x4fe676[_0xa804('0x4f')][_0xa804('0x5a')]){_0x4a1fe7[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x4a1fe7[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x4a1fe7['attributes'],function(_0x48c8e8){var _0x41e04d={};_0x41e04d[_0x48c8e8]={'$like':'%'+_0x4fe676['query'][_0xa804('0x5a')]+'%'};return _0x41e04d;})});}_0x4a1fe7=_[_0xa804('0x5b')]({},_0x4a1fe7,_0x4fe676[_0xa804('0x5c')]);return db[_0xa804('0x8c')]['count']({'where':_0x4a1fe7[_0xa804('0x59')]})[_0xa804('0x24')](function(_0x431ed0){_0x3c4c92[_0xa804('0x20')]=_0x431ed0;if(_0x4fe676[_0xa804('0x4f')]['includeAll']){_0x4a1fe7['include']=[{'model':db[_0xa804('0x8e')],'as':'Contact','required':![]},{'model':db[_0xa804('0x8f')],'as':'Owner','attributes':[_0xa804('0x29'),_0xa804('0x90'),'internal'],'required':![]},{'model':db[_0xa804('0x91')],'as':_0xa804('0x92'),'attributes':['id',_0xa804('0x29'),_0xa804('0x93')],'where':_0x4fe676[_0xa804('0x4f')][_0xa804('0x94')]?{'id':_0x4fe676[_0xa804('0x4f')][_0xa804('0x94')]}:undefined,'required':_0x4fe676[_0xa804('0x4f')][_0xa804('0x94')]?!![]:![]}];}return db['MailInteraction'][_0xa804('0x5f')](_0x4a1fe7);})['then'](function(_0x5302ef){_0x3c4c92['rows']=_0x5302ef;return _0x3c4c92;});}})[_0xa804('0x24')](respondWithFilteredResult(_0x4ee135,_0x4a1fe7))[_0xa804('0x60')](handleError(_0x4ee135,null));};exports[_0xa804('0x95')]=function addApplications(_0x883196,_0x38b00a){var _0x12bcb8=_0x883196['params']['id'];var _0x54ba22=_0x883196[_0xa804('0x64')];var _0x2b286e=0xc8;var _0x38142c=null;return db[_0xa804('0x96')]['transaction']({'isolationLevel':db[_0xa804('0x96')]['Transaction'][_0xa804('0x97')][_0xa804('0x98')]},function(_0x326e73){return db['MailAccount'][_0xa804('0x6d')]({'where':{'id':_0x12bcb8},'transaction':_0x326e73})[_0xa804('0x24')](function(_0x23e8d1){if(_0x23e8d1){return db[_0xa804('0x99')][_0xa804('0x25')]({'where':{'MailAccountId':_0x12bcb8},'transaction':_0x326e73})[_0xa804('0x24')](function(){var _0xa151b0=_['map'](_0x54ba22,function(_0x2d30e5){_0x2d30e5[_0xa804('0x6b')]=_0x12bcb8;return _0x2d30e5;});return db[_0xa804('0x99')][_0xa804('0x9a')](_0xa151b0,{'transaction':_0x326e73});});}else{_0x2b286e=0x194;_0x38142c=[];}});})[_0xa804('0x24')](function(){if(_0x2b286e!==0x194){return db[_0xa804('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0x12bcb8},'order':'priority'})['then'](function(_0x207567){_0x38142c=_0x207567;});}})[_0xa804('0x60')](function(_0x51cb26){_0x2b286e=0x1f4;logger[_0xa804('0x15')](_0x51cb26[_0xa804('0x28')]);if(_0x51cb26['name']){delete _0x51cb26[_0xa804('0x29')];}_0x38142c=_0x51cb26;})[_0xa804('0x9b')](function(){if(_0x38142c===null){_0x38b00a[_0xa804('0x19')](_0x2b286e);}else{if(_0x2b286e===0x1f4){_0x38b00a['status'](_0x2b286e)[_0xa804('0x2a')](_0x38142c);}else{_0x38b00a[_0xa804('0x1a')](_0x2b286e)['json'](_0x38142c);}}});};exports[_0xa804('0x9c')]=function(_0x27c5ab,_0x5006ac){var _0x5dca47={};var _0x56ad1e={};var _0x354ac4;var _0x416bb3;return db['MailAccount'][_0xa804('0x6d')]({'where':{'id':_0x27c5ab[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x5006ac,null))[_0xa804('0x24')](function(_0x176087){if(_0x176087){_0x354ac4=_0x176087;_0x56ad1e[_0xa804('0x4e')]=_[_0xa804('0x50')](db[_0xa804('0x99')][_0xa804('0x4b')]);_0x56ad1e[_0xa804('0x4f')]=_['keys'](_0x27c5ab[_0xa804('0x4f')]);_0x56ad1e['filters']=_[_0xa804('0x53')](_0x56ad1e[_0xa804('0x4e')],_0x56ad1e[_0xa804('0x4f')]);_0x5dca47['attributes']=_['intersection'](_0x56ad1e['model'],qs[_0xa804('0x54')](_0x27c5ab[_0xa804('0x4f')][_0xa804('0x54')]));_0x5dca47['attributes']=_0x5dca47[_0xa804('0x52')][_0xa804('0x55')]?_0x5dca47[_0xa804('0x52')]:_0x56ad1e[_0xa804('0x4e')];_0x5dca47[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x27c5ab[_0xa804('0x4f')][_0xa804('0x58')]);_0x5dca47['where']=qs[_0xa804('0x51')](_['pick'](_0x27c5ab[_0xa804('0x4f')],_0x56ad1e[_0xa804('0x51')]));if(_0x27c5ab[_0xa804('0x4f')][_0xa804('0x5a')]){_0x5dca47[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x5dca47['where'],{'$or':_[_0xa804('0x49')](_0x5dca47['attributes'],function(_0x11f777){var _0x54f39f={};_0x54f39f[_0x11f777]={'$like':'%'+_0x27c5ab['query']['filter']+'%'};return _0x54f39f;})});}_0x5dca47=_['merge']({},_0x5dca47,_0x27c5ab[_0xa804('0x5c')]);return _0x354ac4[_0xa804('0x9c')](_0x5dca47);}})['then'](function(_0x194f01){if(_0x194f01){_0x416bb3=_0x194f01[_0xa804('0x55')];if(!_0x27c5ab[_0xa804('0x4f')]['hasOwnProperty'](_0xa804('0x57'))){_0x5dca47[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x27c5ab[_0xa804('0x4f')][_0xa804('0x1f')]);_0x5dca47[_0xa804('0x1d')]=qs[_0xa804('0x1d')](_0x27c5ab['query']['offset']);}return _0x354ac4[_0xa804('0x9c')](_0x5dca47);}})[_0xa804('0x24')](function(_0x162f08){if(_0x162f08){return _0x162f08?{'count':_0x416bb3,'rows':_0x162f08}:null;}})['then'](respondWithResult(_0x5006ac,null))[_0xa804('0x60')](handleError(_0x5006ac,null));};exports[_0xa804('0x9d')]=function(_0x419bcc,_0x13218d){var _0x3f24dd={'raw':!![],'where':{}};var _0x25a367={};var _0x53189c={'count':0x0,'rows':[]};return db[_0xa804('0x4a')][_0xa804('0x6d')]({'where':{'id':_0x419bcc[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x13218d,null))[_0xa804('0x24')](function(_0x5868a7){if(_0x5868a7){_0x25a367[_0xa804('0x4e')]=_[_0xa804('0x50')](db[_0xa804('0x9e')][_0xa804('0x4b')]);_0x25a367['query']=_[_0xa804('0x50')](_0x419bcc[_0xa804('0x4f')]);_0x25a367[_0xa804('0x51')]=_[_0xa804('0x53')](_0x25a367['model'],_0x25a367[_0xa804('0x4f')]);_0x3f24dd[_0xa804('0x52')]=_[_0xa804('0x53')](_0x25a367[_0xa804('0x4e')],qs[_0xa804('0x54')](_0x419bcc[_0xa804('0x4f')][_0xa804('0x54')]));_0x3f24dd[_0xa804('0x52')]=_0x3f24dd[_0xa804('0x52')][_0xa804('0x55')]?_0x3f24dd[_0xa804('0x52')]:_0x25a367[_0xa804('0x4e')];if(!_0x419bcc['query'][_0xa804('0x56')](_0xa804('0x57'))){_0x3f24dd[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x419bcc[_0xa804('0x4f')][_0xa804('0x1f')]);_0x3f24dd[_0xa804('0x1d')]=qs[_0xa804('0x1d')](_0x419bcc['query']['offset']);}_0x3f24dd[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x419bcc['query']['sort']);_0x3f24dd[_0xa804('0x59')]=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x419bcc['query'],_0x25a367[_0xa804('0x51')]));_0x3f24dd[_0xa804('0x59')]['MailAccountId']=_0x5868a7['id'];if(_0x419bcc[_0xa804('0x4f')][_0xa804('0x5a')]){_0x3f24dd[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x3f24dd[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x3f24dd[_0xa804('0x52')],function(_0x4189cc){var _0xa85223={};_0xa85223[_0x4189cc]={'$like':'%'+_0x419bcc['query'][_0xa804('0x5a')]+'%'};return _0xa85223;})});}if(_0x419bcc[_0xa804('0x4f')][_0xa804('0x9f')]){var _0x999f2=_0x419bcc[_0xa804('0x4f')][_0xa804('0x9f')][_0xa804('0xa0')](',');var _0x2261de={};_0x2261de[_0x999f2[0x0]]={'$gte':moment(_0x999f2[0x1])['format'](_0xa804('0xa1'))};_0x3f24dd[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x3f24dd['where'],_0x2261de);}_0x3f24dd=_[_0xa804('0x5b')]({},_0x3f24dd,_0x419bcc['options']);return db['MailMessage']['count']({'where':_0x3f24dd[_0xa804('0x59')]})[_0xa804('0x24')](function(_0x284531){_0x53189c[_0xa804('0x20')]=_0x284531;if(_0x419bcc[_0xa804('0x4f')][_0xa804('0x5d')]){_0x3f24dd[_0xa804('0x5e')]=[{'all':!![]}];}return db['MailMessage'][_0xa804('0x5f')](_0x3f24dd);})[_0xa804('0x24')](function(_0x3bdb97){if(_0x419bcc[_0xa804('0x4f')][_0xa804('0xa2')]===_0xa804('0xa3')){for(var _0x2784e5=0x0;_0x2784e5<_0x3bdb97[_0xa804('0x55')];_0x2784e5++){_0x3bdb97[_0x2784e5][_0xa804('0x64')]=juice(_0x3bdb97[_0x2784e5]['body']);}}_0x53189c['rows']=_0x3bdb97;return _0x53189c;});}})['then'](respondWithFilteredResult(_0x13218d,_0x3f24dd))[_0xa804('0x60')](handleError(_0x13218d,null));};exports[_0xa804('0x2a')]=function(_0x4bc49d,_0x1e568d){var _0x66ceb6,_0x981ecf={},_0x459ae8;if(_0x4bc49d[_0xa804('0x64')]['to']){_0x459ae8=_0x4bc49d[_0xa804('0x64')]['to'][_0xa804('0xa0')](',')[0x0];}return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4bc49d['params']['id']},'include':[{'model':db[_0xa804('0xa4')],'as':_0xa804('0xa5'),'include':[{'model':db[_0xa804('0x8e')],'as':_0xa804('0xa6'),'where':{'email':_0x459ae8},'limit':0x1,'order':[[_0xa804('0xa7'),_0xa804('0xa8')]]}]},{'model':db[_0xa804('0x47')],'as':_0xa804('0x44'),'raw':!![],'include':[{'model':db[_0xa804('0xa9')],'as':_0xa804('0xa9'),'raw':!![]}]}]})[_0xa804('0x24')](handleEntityNotFound(_0x1e568d,null))[_0xa804('0x24')](function(_0x1d510c){if(!_0x1d510c)return;_0x66ceb6=_0x1d510c;if(!_0x1d510c[_0xa804('0x44')])throw new Error(_0xa804('0xaa'));if(_[_0xa804('0x7a')](_0x4bc49d['body'][_0xa804('0xab')])){_0x4bc49d[_0xa804('0x64')]['from']=util[_0xa804('0xac')]('%s\x20<%s>',_0x1d510c[_0xa804('0x29')],_0x1d510c[_0xa804('0xad')]||_0x1d510c['Smtp'][_0xa804('0x38')]);}if(_0x4bc49d[_0xa804('0x64')]['attachments']&&_0x4bc49d['body'][_0xa804('0xae')][_0xa804('0x55')]){for(var _0x2c0944=0x0;_0x2c0944<_0x4bc49d[_0xa804('0x64')]['attachments'][_0xa804('0x55')];_0x2c0944+=0x1){_0x4bc49d[_0xa804('0x64')][_0xa804('0xae')][_0x2c0944]={'filename':_0x4bc49d['body'][_0xa804('0xae')][_0x2c0944][_0xa804('0x29')],'path':path[_0xa804('0xaf')](config[_0xa804('0xb0')],'server/files/attachments',_0x4bc49d[_0xa804('0x64')][_0xa804('0xae')][_0x2c0944][_0xa804('0xb1')])};}}var _0x339e8e=_0x1d510c[_0xa804('0xb2')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x339e8e,'message':_0x4bc49d['body']});})['then'](function(_0x1aeec5){if(!_0x1aeec5)return;_0x981ecf=_0x1aeec5;if(!_0x66ceb6[_0xa804('0xa5')])throw new Error(_0xa804('0xb3'));if(_0x66ceb6[_0xa804('0xa5')][_0xa804('0xa6')][_0xa804('0x55')])return _0x66ceb6[_0xa804('0xa5')]['Contacts'][0x0];return db[_0xa804('0x8e')][_0xa804('0x75')](_['defaults'](_0x4bc49d['body'],{'firstName':_0x4bc49d[_0xa804('0x64')]['to'],'email':_0x4bc49d['body']['to'],'phone':_0x4bc49d[_0xa804('0x64')]['to'],'ListId':_0x66ceb6['ListId']}));})[_0xa804('0x24')](function(_0x20543b){if(!_0x20543b)return;var _0x4dfcca={'UserId':_0x4bc49d[_0xa804('0x38')]['id'],'ContactId':_0x20543b['id'],'MailAccountId':_0x66ceb6['id'],'inReplyTo':_0x981ecf[_0xa804('0xb4')],'to':_0x4bc49d[_0xa804('0x64')][_0xa804('0xab')],'cc':_0x4bc49d['body']['cc'],'subject':_0x4bc49d[_0xa804('0x64')]['subject'],'attach':_0x4bc49d[_0xa804('0x64')][_0xa804('0xb5')],'firstMsgDirection':_0xa804('0xb6'),'lastMsgAt':moment()[_0xa804('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xa804('0xb6'),'Messages':[_[_0xa804('0x5b')](_0x4bc49d[_0xa804('0x64')],{'messageId':_0x981ecf['messageId'],'sentAt':moment()[_0xa804('0xac')](_0xa804('0xa1')),'read':!![],'MailAccountId':_0x66ceb6['id'],'UserId':_0x4bc49d[_0xa804('0x38')]['id'],'ContactId':_0x20543b['id']})]};if(_0x4bc49d[_0xa804('0x64')][_0xa804('0xb7')]){_0x4dfcca=_[_0xa804('0x5b')](_0x4dfcca,_0x4bc49d[_0xa804('0x64')][_0xa804('0xb7')]);}return db[_0xa804('0x8c')][_0xa804('0x75')](_0x4dfcca,{'include':[{'model':db[_0xa804('0x9e')],'as':_0xa804('0xb8')}]});})[_0xa804('0x24')](respondWithResult(_0x1e568d,null))['catch'](handleError(_0x1e568d,null));};exports[_0xa804('0xb9')]=function(_0x10407b,_0x3da43e){return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x10407b[_0xa804('0x62')]['id']},'include':[{'model':db[_0xa804('0x47')],'as':_0xa804('0x44'),'raw':!![],'include':[{'model':db[_0xa804('0xa9')],'as':_0xa804('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3da43e,null))[_0xa804('0x24')](function(_0x387529){if(!_0x387529[_0xa804('0x44')])return;var _0x26ffd5=_0x387529[_0xa804('0xb2')]();return respondWithRpcPromise(_0xa804('0xba'),_0xa804('0xb9'),{'account':_0x26ffd5});})[_0xa804('0x24')](respondWithResult(_0x3da43e,null))['catch'](handleError(_0x3da43e,null));};exports['destroy']=function(_0x73dbd6,_0x3b5906){return db['MailAccount']['find']({'where':{'id':_0x73dbd6['params']['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x3b5906,null))[_0xa804('0x24')](function(_0x9aa953){if(_0x9aa953&&_0x9aa953[_0xa804('0x40')]){throw new db[(_0xa804('0xbb'))][(_0xa804('0xbc'))](_0xa804('0xbd'));}return _0x9aa953;})[_0xa804('0x24')](removeEntity(_0x3b5906,null))['catch'](handleError(_0x3b5906,null));};exports['addAgents']=function(_0x4131c9,_0x2f3813){return db[_0xa804('0x4a')][_0xa804('0x63')]({'where':{'id':_0x4131c9['params']['id']}})['then'](handleEntityNotFound(_0x2f3813,null))[_0xa804('0x24')](function(_0x44b29b){if(_0x44b29b){return _0x44b29b[_0xa804('0xbe')](_0x4131c9[_0xa804('0x64')][_0xa804('0x72')],_[_0xa804('0xbf')](_0x4131c9['body'],[_0xa804('0x72'),'id'])||{})[_0xa804('0xc0')](function(_0x21251b){for(var _0x1c3d1e=0x0;_0x1c3d1e<_0x4131c9['body'][_0xa804('0x72')][_0xa804('0x55')];_0x1c3d1e+=0x1){socket[_0xa804('0xc1')](_0xa804('0xc2'),{'UserId':Number(_0x4131c9[_0xa804('0x64')][_0xa804('0x72')][_0x1c3d1e]),'MailAccountId':Number(_0x4131c9[_0xa804('0x62')]['id'])});}return _0x21251b;});}})[_0xa804('0x24')](respondWithResult(_0x2f3813,null))[_0xa804('0x60')](handleError(_0x2f3813,null));};exports[_0xa804('0xc3')]=function(_0x5e210b,_0x21e88b){return db[_0xa804('0x4a')]['find']({'where':{'id':_0x5e210b[_0xa804('0x62')]['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x21e88b,null))[_0xa804('0x24')](function(_0xf738af){if(_0xf738af){return _0xf738af[_0xa804('0xc3')](_0x5e210b[_0xa804('0x4f')]['ids'])[_0xa804('0x24')](function(){if(_[_0xa804('0xc4')](_0x5e210b['query']['ids'])){for(var _0x362bdb=0x0;_0x362bdb<_0x5e210b['query'][_0xa804('0x72')][_0xa804('0x55')];_0x362bdb+=0x1){socket[_0xa804('0xc1')](_0xa804('0xc5'),{'UserId':Number(_0x5e210b[_0xa804('0x4f')][_0xa804('0x72')][_0x362bdb]),'MailAccountId':Number(_0x5e210b[_0xa804('0x62')]['id'])});}}else{socket[_0xa804('0xc1')](_0xa804('0xc5'),{'UserId':Number(_0x5e210b[_0xa804('0x4f')][_0xa804('0x72')]),'MailAccountId':Number(_0x5e210b['params']['id'])});}});}})[_0xa804('0x24')](respondWithStatusCode(_0x21e88b,null))[_0xa804('0x60')](handleError(_0x21e88b,null));};exports[_0xa804('0xc6')]=function(_0x4d6c3e,_0x2af9e2){var _0x43e402={};var _0x2e70bb={};var _0x1bccaf;var _0x23bb58;return db['MailAccount'][_0xa804('0x6d')]({'where':{'id':_0x4d6c3e['params']['id']}})[_0xa804('0x24')](handleEntityNotFound(_0x2af9e2,null))[_0xa804('0x24')](function(_0x2dc66e){if(_0x2dc66e){_0x1bccaf=_0x2dc66e;_0x2e70bb['model']=_[_0xa804('0x50')](db[_0xa804('0x8f')]['rawAttributes']);_0x2e70bb[_0xa804('0x4f')]=_[_0xa804('0x50')](_0x4d6c3e['query']);_0x2e70bb[_0xa804('0x51')]=_[_0xa804('0x53')](_0x2e70bb[_0xa804('0x4e')],_0x2e70bb[_0xa804('0x4f')]);_0x43e402[_0xa804('0x52')]=_[_0xa804('0x53')](_0x2e70bb[_0xa804('0x4e')],qs[_0xa804('0x54')](_0x4d6c3e[_0xa804('0x4f')][_0xa804('0x54')]));_0x43e402['attributes']=_0x43e402[_0xa804('0x52')]['length']?_0x43e402[_0xa804('0x52')]:_0x2e70bb['model'];_0x43e402[_0xa804('0x6e')]=qs[_0xa804('0x58')](_0x4d6c3e[_0xa804('0x4f')][_0xa804('0x58')]);_0x43e402[_0xa804('0x59')]=qs[_0xa804('0x51')](_[_0xa804('0x6f')](_0x4d6c3e[_0xa804('0x4f')],_0x2e70bb[_0xa804('0x51')]));if(_0x4d6c3e['query'][_0xa804('0x5a')]){_0x43e402[_0xa804('0x59')]=_[_0xa804('0x5b')](_0x43e402[_0xa804('0x59')],{'$or':_[_0xa804('0x49')](_0x43e402[_0xa804('0x52')],function(_0x410e7b){var _0x3bde06={};_0x3bde06[_0x410e7b]={'$like':'%'+_0x4d6c3e[_0xa804('0x4f')][_0xa804('0x5a')]+'%'};return _0x3bde06;})});}_0x43e402=_['merge']({},_0x43e402,_0x4d6c3e[_0xa804('0x5c')]);return _0x1bccaf[_0xa804('0xc6')](_0x43e402);}})[_0xa804('0x24')](function(_0x6356a7){if(_0x6356a7){_0x23bb58=_0x6356a7[_0xa804('0x55')];if(!_0x4d6c3e[_0xa804('0x4f')]['hasOwnProperty']('nolimit')){_0x43e402[_0xa804('0x1f')]=qs[_0xa804('0x1f')](_0x4d6c3e[_0xa804('0x4f')]['limit']);_0x43e402['offset']=qs['offset'](_0x4d6c3e['query'][_0xa804('0x1d')]);}return _0x1bccaf['getAgents'](_0x43e402);}})[_0xa804('0x24')](function(_0x4c6529){if(_0x4c6529){return _0x4c6529?{'count':_0x23bb58,'rows':_0x4c6529}:null;}})[_0xa804('0x24')](respondWithResult(_0x2af9e2,null))['catch'](handleError(_0x2af9e2,null));}; \ No newline at end of file +var _0x09ca=['rows','keys','options','find','update','body','provider','secure','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','rawAttributes','MailAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','custom','email','ListId','active','role','userProfileId','autoAssociation','getImap','removeImap','setImap','getSmtp','setSmtp','MailInteraction','addInteraction','ids','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','Contacts','subject','out','messageId','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','util','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','service','authentication','Imap','port','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x581d80,_0x40a23b){var _0x3d85ef=function(_0x4aaa7b){while(--_0x4aaa7b){_0x581d80['push'](_0x581d80['shift']());}};_0x3d85ef(++_0x40a23b);}(_0x09ca,0x120));var _0xa09c=function(_0xfb11b7,_0x1ef767){_0xfb11b7=_0xfb11b7-0x0;var _0x307811=_0x09ca[_0xfb11b7];return _0x307811;};'use strict';var moment=require(_0xa09c('0x0'));var BPromise=require('bluebird');var util=require(_0xa09c('0x1'));var path=require('path');var _=require('lodash');var juice=require(_0xa09c('0x2'));var Redis=require('ioredis');var qs=require(_0xa09c('0x3'));var logger=require(_0xa09c('0x4'))(_0xa09c('0x5'));var config=require(_0xa09c('0x6'));var db=require(_0xa09c('0x7'))['db'];config[_0xa09c('0x8')]=_[_0xa09c('0x9')](config[_0xa09c('0x8')],{'host':_0xa09c('0xa'),'port':0x18eb});var socket=require(_0xa09c('0xb'))(new Redis(config[_0xa09c('0x8')]));require(_0xa09c('0xc'))[_0xa09c('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa09c('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0xf2bd04,_0x59ad0f,_0x4a21ec,_0x1229bc){return new BPromise(function(_0x53a3b7,_0x240793){var _0x13ce82=_0x1229bc||client;return _0x13ce82[_0xa09c('0xf')](_0xf2bd04,_0x4a21ec)['then'](function(_0x3aadd8){logger[_0xa09c('0x10')](_0xa09c('0x11'),_0x59ad0f,_0xa09c('0x12'));logger['debug'](_0xa09c('0x13'),_0x59ad0f,_0xa09c('0x12'),JSON[_0xa09c('0x14')](_0x3aadd8));if(_0x3aadd8[_0xa09c('0x15')]){if(_0x3aadd8[_0xa09c('0x15')][_0xa09c('0x16')]===0x1f4){logger[_0xa09c('0x15')](_0xa09c('0x11'),_0x59ad0f,_0x3aadd8[_0xa09c('0x15')][_0xa09c('0x17')]);return _0x240793(_0x3aadd8[_0xa09c('0x15')][_0xa09c('0x17')]);}logger[_0xa09c('0x15')](_0xa09c('0x11'),_0x59ad0f,_0x3aadd8[_0xa09c('0x15')][_0xa09c('0x17')]);return _0x53a3b7(_0x3aadd8['error'][_0xa09c('0x17')]);}else{logger[_0xa09c('0x10')]('MailAccount,\x20%s,\x20%s',_0x59ad0f,_0xa09c('0x12'));_0x53a3b7(_0x3aadd8[_0xa09c('0x18')][_0xa09c('0x17')]);}})[_0xa09c('0x19')](function(_0x174032){logger[_0xa09c('0x15')](_0xa09c('0x11'),_0x59ad0f,_0x174032);_0x240793(_0x174032);});});}function respondWithStatusCode(_0x367af1,_0x575af6){_0x575af6=_0x575af6||0xcc;return function(_0x392364){if(_0x392364){return _0x367af1['sendStatus'](_0x575af6);}return _0x367af1[_0xa09c('0x1a')](_0x575af6)[_0xa09c('0x1b')]();};}function respondWithResult(_0x18fcc7,_0x451b2e){_0x451b2e=_0x451b2e||0xc8;return function(_0x349fd3){if(_0x349fd3){return _0x18fcc7[_0xa09c('0x1a')](_0x451b2e)[_0xa09c('0x1c')](_0x349fd3);}};}function respondWithFilteredResult(_0x4ce43f,_0x2a9eab){return function(_0x1efac6){if(_0x1efac6){var _0x194a6c=typeof _0x2a9eab[_0xa09c('0x1d')]==='undefined'&&typeof _0x2a9eab[_0xa09c('0x1e')]===_0xa09c('0x1f');var _0x2c1ff0=_0x1efac6[_0xa09c('0x20')];var _0x5f27dc=_0x194a6c?0x0:_0x2a9eab[_0xa09c('0x1d')];var _0x80130b=_0x194a6c?_0x1efac6[_0xa09c('0x20')]:_0x2a9eab[_0xa09c('0x1d')]+_0x2a9eab[_0xa09c('0x1e')];var _0x1d5fb0;if(_0x80130b>=_0x2c1ff0){_0x80130b=_0x2c1ff0;_0x1d5fb0=0xc8;}else{_0x1d5fb0=0xce;}_0x4ce43f[_0xa09c('0x1a')](_0x1d5fb0);return _0x4ce43f['set'](_0xa09c('0x21'),_0x5f27dc+'-'+_0x80130b+'/'+_0x2c1ff0)[_0xa09c('0x1c')](_0x1efac6);}return null;};}function saveUpdates(_0x126bd2){return function(_0x3e2445){if(_0x3e2445){return _0x3e2445['update'](_0x126bd2)[_0xa09c('0x22')](function(_0x4f01d8){return _0x4f01d8;});}return null;};}function removeEntity(_0x2df118){return function(_0x142a68){if(_0x142a68){return _0x142a68[_0xa09c('0x23')]()[_0xa09c('0x22')](function(){var _0x5b5c9f=_0x142a68[_0xa09c('0x24')]({'plain':!![]});var _0x22810e=_0xa09c('0x25');return db[_0xa09c('0x26')][_0xa09c('0x23')]({'where':{'type':_0x22810e,'resourceId':_0x5b5c9f['id']}})[_0xa09c('0x22')](function(){return _0x142a68;});})[_0xa09c('0x22')](function(){_0x2df118[_0xa09c('0x1a')](0xcc)[_0xa09c('0x1b')]();});}};}function handleEntityNotFound(_0x22218b){return function(_0x1c65bd){if(!_0x1c65bd){_0x22218b[_0xa09c('0x27')](0x194);}return _0x1c65bd;};}function handleError(_0x3c58cd,_0x259123){_0x259123=_0x259123||0x1f4;return function(_0x56026a){logger['error'](_0x56026a[_0xa09c('0x28')]);if(_0x56026a[_0xa09c('0x29')]){delete _0x56026a[_0xa09c('0x29')];}_0x3c58cd[_0xa09c('0x1a')](_0x259123)[_0xa09c('0x2a')](_0x56026a);};}function getImapHost(_0x3b7e60){switch(_0x3b7e60){case'gmail':return _0xa09c('0x2b');case _0xa09c('0x2c'):return _0xa09c('0x2d');case'hotmail':return _0xa09c('0x2e');case _0xa09c('0x2f'):return _0xa09c('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3b7e60);}function getSmtpHost(_0x57940b){switch(_0x57940b){case _0xa09c('0x31'):return _0xa09c('0x32');case _0xa09c('0x2c'):return _0xa09c('0x33');case'hotmail':return _0xa09c('0x34');case _0xa09c('0x2f'):return _0xa09c('0x35');}throw new Error(_0xa09c('0x36'),_0x57940b);}function getAuthenticationOptions(_0x5761e0,_0x55781c){var _0x534477={};var _0x1f27f7={};if(_0x5761e0){_0x534477[_0xa09c('0x37')]=_0x1f27f7[_0xa09c('0x37')]=_0x55781c[_0xa09c('0x38')];_0x534477[_0xa09c('0x39')]=_0x1f27f7[_0xa09c('0x3a')]=_0x55781c['password'];if(_0x55781c[_0xa09c('0x3b')]){_0x534477[_0xa09c('0x3b')]=_0x1f27f7[_0xa09c('0x3b')]=!![];_0x534477[_0xa09c('0x3c')]=_0x1f27f7[_0xa09c('0x3c')]=_0x55781c[_0xa09c('0x3c')];_0x534477[_0xa09c('0x39')]=_0x1f27f7[_0xa09c('0x3a')]=null;}else{_0x534477[_0xa09c('0x3c')]=_0x1f27f7['CloudProviderId']=null;}_0x534477[_0xa09c('0x3d')]=getImapHost(_0x5761e0);_0x534477['port']=0x3e1;_0x1f27f7['host']=getSmtpHost(_0x5761e0);_0x1f27f7['port']=0x24b;_0x1f27f7['secure']=![];_0x534477[_0xa09c('0x3e')]=_0x1f27f7[_0xa09c('0x3e')]=null;}else{if(_0x55781c['authentication']){_0x534477[_0xa09c('0x37')]=_0x1f27f7['user']=_0x55781c[_0xa09c('0x38')];_0x534477['password']=_0x1f27f7[_0xa09c('0x3a')]=_0x55781c['password'];}else{_0x534477[_0xa09c('0x3f')]=_0x1f27f7[_0xa09c('0x3f')]=![];_0x534477[_0xa09c('0x37')]=_0x1f27f7[_0xa09c('0x37')]=null;_0x534477['password']=_0x1f27f7['pass']=null;}_0x534477['host']=_0x55781c[_0xa09c('0x40')]['host'];_0x534477[_0xa09c('0x41')]=_0x55781c[_0xa09c('0x40')][_0xa09c('0x41')];_0x1f27f7[_0xa09c('0x3d')]=_0x55781c['Smtp'][_0xa09c('0x3d')];_0x1f27f7[_0xa09c('0x41')]=_0x55781c[_0xa09c('0x42')]['port'];}return{'Imap':_0x534477,'Smtp':_0x1f27f7};}exports[_0xa09c('0x43')]=function(_0x1d97e8,_0x48ba03){var _0x34108b={'include':[{'model':db[_0xa09c('0x44')],'as':_0xa09c('0x40')},{'model':db[_0xa09c('0x45')],'as':'Smtp'},{'model':db[_0xa09c('0x46')],'as':_0xa09c('0x47')}]},_0x5c955f={},_0x35546b={'count':0x0,'rows':[]};var _0x393d54=_[_0xa09c('0x48')](db[_0xa09c('0x49')]['rawAttributes'],function(_0x398472){return{'name':_0x398472[_0xa09c('0x4a')],'type':_0x398472[_0xa09c('0x4b')][_0xa09c('0x4c')]};});_0x5c955f[_0xa09c('0x4d')]=_[_0xa09c('0x48')](_0x393d54,'name');_0x5c955f[_0xa09c('0x4e')]=_['keys'](_0x1d97e8[_0xa09c('0x4e')]);_0x5c955f[_0xa09c('0x4f')]=_[_0xa09c('0x50')](_0x5c955f['model'],_0x5c955f[_0xa09c('0x4e')]);_0x34108b[_0xa09c('0x51')]=_[_0xa09c('0x50')](_0x5c955f[_0xa09c('0x4d')],qs[_0xa09c('0x52')](_0x1d97e8[_0xa09c('0x4e')][_0xa09c('0x52')]));_0x34108b['attributes']=_0x34108b[_0xa09c('0x51')][_0xa09c('0x53')]?_0x34108b[_0xa09c('0x51')]:_0x5c955f[_0xa09c('0x4d')];if(!_0x1d97e8['query'][_0xa09c('0x54')](_0xa09c('0x55'))){_0x34108b[_0xa09c('0x1e')]=qs[_0xa09c('0x1e')](_0x1d97e8[_0xa09c('0x4e')][_0xa09c('0x1e')]);_0x34108b[_0xa09c('0x1d')]=qs[_0xa09c('0x1d')](_0x1d97e8['query'][_0xa09c('0x1d')]);}_0x34108b[_0xa09c('0x56')]=qs[_0xa09c('0x57')](_0x1d97e8[_0xa09c('0x4e')][_0xa09c('0x57')]);_0x34108b[_0xa09c('0x58')]=qs['filters'](_[_0xa09c('0x59')](_0x1d97e8[_0xa09c('0x4e')],_0x5c955f[_0xa09c('0x4f')]),_0x393d54);if(_0x1d97e8[_0xa09c('0x4e')][_0xa09c('0x5a')]){_0x34108b[_0xa09c('0x58')]=_[_0xa09c('0x5b')](_0x34108b[_0xa09c('0x58')],{'$or':_['map'](_0x393d54,function(_0x5726fd){if(_0x5726fd['type']!==_0xa09c('0x5c')){var _0x509d59={};_0x509d59[_0x5726fd['name']]={'$like':'%'+_0x1d97e8['query'][_0xa09c('0x5a')]+'%'};return _0x509d59;}})});}_0x34108b=_[_0xa09c('0x5b')]({},_0x34108b,_0x1d97e8['options']);var _0x4fac56={'where':_0x34108b['where']};return db[_0xa09c('0x49')][_0xa09c('0x20')](_0x4fac56)['then'](function(_0x144e3f){_0x35546b[_0xa09c('0x20')]=_0x144e3f;if(_0x1d97e8[_0xa09c('0x4e')][_0xa09c('0x5d')]){_0x34108b[_0xa09c('0x5e')]=[{'all':!![]}];}return db[_0xa09c('0x49')][_0xa09c('0x5f')](_0x34108b);})[_0xa09c('0x22')](function(_0x383690){_0x35546b[_0xa09c('0x60')]=_0x383690;return _0x35546b;})[_0xa09c('0x22')](respondWithFilteredResult(_0x48ba03,_0x34108b))[_0xa09c('0x19')](handleError(_0x48ba03,null));};exports['show']=function(_0x1ba56a,_0x5ed097){var _0x27daac={'raw':![],'where':{'id':_0x1ba56a['params']['id']},'include':[{'model':db[_0xa09c('0x44')],'as':_0xa09c('0x40')},{'model':db[_0xa09c('0x45')],'as':_0xa09c('0x42')},{'model':db[_0xa09c('0x46')],'as':_0xa09c('0x47')}]},_0x43337c={};_0x43337c[_0xa09c('0x4d')]=_[_0xa09c('0x61')](db[_0xa09c('0x49')]['rawAttributes']);_0x43337c['query']=_[_0xa09c('0x61')](_0x1ba56a[_0xa09c('0x4e')]);_0x43337c[_0xa09c('0x4f')]=_[_0xa09c('0x50')](_0x43337c['model'],_0x43337c['query']);_0x27daac[_0xa09c('0x51')]=_[_0xa09c('0x50')](_0x43337c[_0xa09c('0x4d')],qs[_0xa09c('0x52')](_0x1ba56a[_0xa09c('0x4e')][_0xa09c('0x52')]));_0x27daac[_0xa09c('0x51')]=_0x27daac['attributes'][_0xa09c('0x53')]?_0x27daac['attributes']:_0x43337c[_0xa09c('0x4d')];if(_0x1ba56a['query'][_0xa09c('0x5d')]){_0x27daac[_0xa09c('0x5e')]=[{'all':!![]}];}_0x27daac=_['merge']({},_0x27daac,_0x1ba56a[_0xa09c('0x62')]);return db['MailAccount'][_0xa09c('0x63')](_0x27daac)[_0xa09c('0x22')](handleEntityNotFound(_0x5ed097,null))[_0xa09c('0x22')](respondWithResult(_0x5ed097,null))[_0xa09c('0x19')](handleError(_0x5ed097,null));};exports[_0xa09c('0x64')]=function(_0x5b6a62,_0x50cf26){if(_0x5b6a62[_0xa09c('0x65')]['id']){delete _0x5b6a62[_0xa09c('0x65')]['id'];}var _0x900d27=_0x5b6a62['body']['provider']==='custom'?null:_0x5b6a62[_0xa09c('0x65')][_0xa09c('0x66')];var _0x88c008=_0x5b6a62[_0xa09c('0x65')]['Imap']||{};var _0x1340a7=_0x5b6a62[_0xa09c('0x65')]['Smtp']||{};if(_0x900d27){_0x88c008[_0xa09c('0x3d')]=getImapHost(_0x900d27);_0x88c008['port']=0x3e1;_0x1340a7[_0xa09c('0x3d')]=getSmtpHost(_0x900d27);_0x1340a7[_0xa09c('0x41')]=0x24b;_0x1340a7[_0xa09c('0x67')]=![];}if(_0x1340a7[_0xa09c('0x3b')]){_0x1340a7[_0xa09c('0x67')]=![];}else{_0x1340a7['CloudProviderId']=null;}if(!_0x88c008[_0xa09c('0x3b')])_0x88c008[_0xa09c('0x3c')]=null;_0x5b6a62[_0xa09c('0x65')][_0xa09c('0x40')]=_0x88c008;_0x5b6a62[_0xa09c('0x65')][_0xa09c('0x42')]=_0x1340a7;return db['MailAccount'][_0xa09c('0x63')]({'where':{'id':_0x5b6a62[_0xa09c('0x68')]['id']},'include':[{'model':db[_0xa09c('0x44')],'as':_0xa09c('0x40')},{'model':db[_0xa09c('0x45')],'as':'Smtp'},{'model':db[_0xa09c('0x46')],'as':_0xa09c('0x47')}]})[_0xa09c('0x22')](handleEntityNotFound(_0x50cf26,null))[_0xa09c('0x22')](function(_0x8ebb52){if(!_0x8ebb52)throw new Error(_0xa09c('0x69'));if(_0x8ebb52['service'])delete _0x5b6a62[_0xa09c('0x65')][_0xa09c('0x40')];return _0x8ebb52;})['then'](saveUpdates(_0x5b6a62[_0xa09c('0x65')],null))[_0xa09c('0x22')](function(_0x36dbaf){if(!_0x5b6a62[_0xa09c('0x65')]['Imap'])return _0x36dbaf;return db[_0xa09c('0x44')][_0xa09c('0x64')](_0x5b6a62[_0xa09c('0x65')][_0xa09c('0x40')],{'where':{'MailAccountId':_0x36dbaf['id']}})[_0xa09c('0x22')](function(){return _0x36dbaf;});})[_0xa09c('0x22')](function(_0x4cd27b){if(!_0x5b6a62[_0xa09c('0x65')]['Smtp'])return _0x4cd27b;return db[_0xa09c('0x45')][_0xa09c('0x64')](_0x5b6a62['body'][_0xa09c('0x42')],{'where':{'MailAccountId':_0x4cd27b['id']}})[_0xa09c('0x22')](function(){return _0x4cd27b;});})[_0xa09c('0x22')](respondWithResult(_0x50cf26,null))['catch'](handleError(_0x50cf26,null));};exports[_0xa09c('0x6a')]=function(_0x48e091,_0x42b5f0){return db[_0xa09c('0x49')]['describe']()[_0xa09c('0x22')](respondWithResult(_0x42b5f0,null))[_0xa09c('0x19')](handleError(_0x42b5f0,null));};exports[_0xa09c('0x6b')]=function(_0x40c11a,_0x5006a4){if(_0x40c11a[_0xa09c('0x65')]['id']){delete _0x40c11a['body']['id'];}return db['MailAccount'][_0xa09c('0x63')]({'where':{'id':_0x40c11a[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x5006a4,null))[_0xa09c('0x22')](function(_0x3c781c){if(_0x3c781c){_0x40c11a[_0xa09c('0x65')]['MailAccountId']=_0x3c781c['id'];return db[_0xa09c('0x6c')][_0xa09c('0x6d')](_0x40c11a[_0xa09c('0x65')]);}})[_0xa09c('0x22')](respondWithResult(_0x5006a4,null))['catch'](handleError(_0x5006a4,null));};exports[_0xa09c('0x6e')]=function(_0x2b2c4a,_0xdc0e6a){var _0x4517b8={'raw':![],'where':{}};var _0x4a2cd5={};var _0x325b70={'count':0x0,'rows':[]};return db[_0xa09c('0x49')][_0xa09c('0x6f')]({'where':{'id':_0x2b2c4a[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0xdc0e6a,null))[_0xa09c('0x22')](function(_0x4037b6){if(_0x4037b6){_0x4a2cd5[_0xa09c('0x4d')]=_[_0xa09c('0x61')](db[_0xa09c('0x6c')][_0xa09c('0x70')]);_0x4a2cd5[_0xa09c('0x4e')]=_[_0xa09c('0x61')](_0x2b2c4a[_0xa09c('0x4e')]);_0x4a2cd5[_0xa09c('0x4f')]=_[_0xa09c('0x50')](_0x4a2cd5['model'],_0x4a2cd5['query']);_0x4517b8[_0xa09c('0x51')]=_[_0xa09c('0x50')](_0x4a2cd5[_0xa09c('0x4d')],qs[_0xa09c('0x52')](_0x2b2c4a[_0xa09c('0x4e')][_0xa09c('0x52')]));_0x4517b8[_0xa09c('0x51')]=_0x4517b8[_0xa09c('0x51')]['length']?_0x4517b8['attributes']:_0x4a2cd5['model'];if(!_0x2b2c4a[_0xa09c('0x4e')][_0xa09c('0x54')](_0xa09c('0x55'))){_0x4517b8[_0xa09c('0x1e')]=qs['limit'](_0x2b2c4a[_0xa09c('0x4e')][_0xa09c('0x1e')]);_0x4517b8[_0xa09c('0x1d')]=qs[_0xa09c('0x1d')](_0x2b2c4a['query']['offset']);}_0x4517b8['order']=qs[_0xa09c('0x57')](_0x2b2c4a[_0xa09c('0x4e')][_0xa09c('0x57')]);_0x4517b8[_0xa09c('0x58')]=qs[_0xa09c('0x4f')](_[_0xa09c('0x59')](_0x2b2c4a['query'],_0x4a2cd5[_0xa09c('0x4f')]));_0x4517b8[_0xa09c('0x58')][_0xa09c('0x71')]=_0x4037b6['id'];if(_0x2b2c4a[_0xa09c('0x4e')][_0xa09c('0x5a')]){_0x4517b8[_0xa09c('0x58')]=_[_0xa09c('0x5b')](_0x4517b8[_0xa09c('0x58')],{'$or':_['map'](_0x4517b8[_0xa09c('0x51')],function(_0x2eafa5){var _0xe041df={};_0xe041df[_0x2eafa5]={'$like':'%'+_0x2b2c4a[_0xa09c('0x4e')][_0xa09c('0x5a')]+'%'};return _0xe041df;})});}_0x4517b8=_[_0xa09c('0x5b')]({},_0x4517b8,_0x2b2c4a[_0xa09c('0x62')]);return db[_0xa09c('0x6c')][_0xa09c('0x20')]({'where':_0x4517b8[_0xa09c('0x58')]})['then'](function(_0x27d426){_0x325b70[_0xa09c('0x20')]=_0x27d426;if(_0x2b2c4a[_0xa09c('0x4e')]['includeAll']){_0x4517b8['include']=[{'all':!![]}];}return db[_0xa09c('0x6c')][_0xa09c('0x5f')](_0x4517b8);})[_0xa09c('0x22')](function(_0x1add66){_0x325b70[_0xa09c('0x60')]=_0x1add66;return _0x325b70;});}})[_0xa09c('0x22')](respondWithFilteredResult(_0xdc0e6a,_0x4517b8))['catch'](handleError(_0xdc0e6a,null));};exports[_0xa09c('0x72')]=function(_0x35d19a,_0x4d0e4e){return db[_0xa09c('0x49')][_0xa09c('0x63')]({'where':{'id':_0x35d19a[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x4d0e4e,null))[_0xa09c('0x22')](function(_0xc85f7e){if(_0xc85f7e){return _0xc85f7e[_0xa09c('0x72')](_0x35d19a[_0xa09c('0x4e')]['ids']);}})[_0xa09c('0x22')](respondWithStatusCode(_0x4d0e4e,null))[_0xa09c('0x19')](handleError(_0x4d0e4e,null));};exports[_0xa09c('0x73')]=function(_0x55863b,_0x748b1b){if(_0x55863b[_0xa09c('0x65')]['id']){delete _0x55863b['body']['id'];}return db[_0xa09c('0x49')][_0xa09c('0x63')]({'where':{'id':_0x55863b['params']['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x748b1b,null))['then'](function(_0x1fef01){if(_0x1fef01){_0x55863b[_0xa09c('0x65')][_0xa09c('0x71')]=_0x1fef01['id'];return db[_0xa09c('0x74')][_0xa09c('0x6d')](_0x55863b[_0xa09c('0x65')]);}})['then'](respondWithResult(_0x748b1b,null))['catch'](handleError(_0x748b1b,null));};exports[_0xa09c('0x75')]=function(_0x156195,_0x50e76d){var _0x2f3943={'raw':![],'where':{}};var _0x4da074={};var _0x54564d={'count':0x0,'rows':[]};return db['MailAccount'][_0xa09c('0x6f')]({'where':{'id':_0x156195[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x50e76d,null))[_0xa09c('0x22')](function(_0x1b6250){if(_0x1b6250){_0x4da074[_0xa09c('0x4d')]=_[_0xa09c('0x61')](db[_0xa09c('0x74')][_0xa09c('0x70')]);_0x4da074['query']=_[_0xa09c('0x61')](_0x156195[_0xa09c('0x4e')]);_0x4da074[_0xa09c('0x4f')]=_['intersection'](_0x4da074['model'],_0x4da074[_0xa09c('0x4e')]);_0x2f3943[_0xa09c('0x51')]=_[_0xa09c('0x50')](_0x4da074['model'],qs[_0xa09c('0x52')](_0x156195[_0xa09c('0x4e')][_0xa09c('0x52')]));_0x2f3943[_0xa09c('0x51')]=_0x2f3943['attributes'][_0xa09c('0x53')]?_0x2f3943[_0xa09c('0x51')]:_0x4da074[_0xa09c('0x4d')];if(!_0x156195[_0xa09c('0x4e')][_0xa09c('0x54')](_0xa09c('0x55'))){_0x2f3943[_0xa09c('0x1e')]=qs[_0xa09c('0x1e')](_0x156195[_0xa09c('0x4e')]['limit']);_0x2f3943[_0xa09c('0x1d')]=qs['offset'](_0x156195[_0xa09c('0x4e')][_0xa09c('0x1d')]);}_0x2f3943[_0xa09c('0x56')]=qs['sort'](_0x156195['query'][_0xa09c('0x57')]);_0x2f3943['where']=qs[_0xa09c('0x4f')](_['pick'](_0x156195['query'],_0x4da074['filters']));_0x2f3943[_0xa09c('0x58')][_0xa09c('0x71')]=_0x1b6250['id'];if(_0x156195[_0xa09c('0x4e')][_0xa09c('0x5a')]){_0x2f3943[_0xa09c('0x58')]=_[_0xa09c('0x5b')](_0x2f3943[_0xa09c('0x58')],{'$or':_[_0xa09c('0x48')](_0x2f3943[_0xa09c('0x51')],function(_0x4bba08){var _0x7b6f01={};_0x7b6f01[_0x4bba08]={'$like':'%'+_0x156195[_0xa09c('0x4e')][_0xa09c('0x5a')]+'%'};return _0x7b6f01;})});}_0x2f3943=_['merge']({},_0x2f3943,_0x156195['options']);return db[_0xa09c('0x74')]['count']({'where':_0x2f3943[_0xa09c('0x58')]})[_0xa09c('0x22')](function(_0x380bb2){_0x54564d[_0xa09c('0x20')]=_0x380bb2;if(_0x156195[_0xa09c('0x4e')][_0xa09c('0x5d')]){_0x2f3943['include']=[{'all':!![]}];}return db[_0xa09c('0x74')][_0xa09c('0x5f')](_0x2f3943);})[_0xa09c('0x22')](function(_0x384947){_0x54564d[_0xa09c('0x60')]=_0x384947;return _0x54564d;});}})[_0xa09c('0x22')](respondWithFilteredResult(_0x50e76d,_0x2f3943))['catch'](handleError(_0x50e76d,null));};exports[_0xa09c('0x76')]=function(_0x34df7c,_0x391499){return db['MailAccount'][_0xa09c('0x63')]({'where':{'id':_0x34df7c[_0xa09c('0x68')]['id']}})['then'](handleEntityNotFound(_0x391499,null))['then'](function(_0x106c41){if(_0x106c41){return _0x106c41[_0xa09c('0x76')](_0x34df7c[_0xa09c('0x4e')]['ids']);}})[_0xa09c('0x22')](respondWithStatusCode(_0x391499,null))[_0xa09c('0x19')](handleError(_0x391499,null));};exports[_0xa09c('0x6d')]=function(_0x448a38,_0x261061){var _0x292a2f={'name':_0x448a38['body'][_0xa09c('0x29')],'key':_0x448a38[_0xa09c('0x65')][_0xa09c('0x4c')],'provider':_0x448a38[_0xa09c('0x65')][_0xa09c('0x66')]===_0xa09c('0x77')?null:_0x448a38[_0xa09c('0x65')][_0xa09c('0x66')],'email':_0x448a38[_0xa09c('0x65')][_0xa09c('0x78')],'ListId':_0x448a38[_0xa09c('0x65')][_0xa09c('0x79')],'active':!_['isNil'](_0x448a38['body']['active'])?_0x448a38['body'][_0xa09c('0x7a')]:!![],'description':_0x448a38[_0xa09c('0x65')]['description']||null};var _0x39e4de=getAuthenticationOptions(_0x292a2f[_0xa09c('0x66')],_0x448a38[_0xa09c('0x65')]);_0x292a2f['Imap']=_0x39e4de['Imap'];_0x292a2f[_0xa09c('0x42')]=_0x39e4de['Smtp'];return db[_0xa09c('0x49')][_0xa09c('0x6d')](_0x292a2f,{'include':[{'model':db[_0xa09c('0x45')],'as':_0xa09c('0x42')},{'model':db[_0xa09c('0x44')],'as':_0xa09c('0x40')}]})[_0xa09c('0x22')](function(_0x1fba2e){var _0x4969be=_0x448a38[_0xa09c('0x37')][_0xa09c('0x24')]({'plain':!![]});if(!_0x4969be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4969be[_0xa09c('0x7b')]===_0xa09c('0x37')){var _0x362b98=_0x1fba2e[_0xa09c('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xa09c('0x63')]({'where':{'name':'MailAccounts','userProfileId':_0x4969be[_0xa09c('0x7c')]},'raw':!![]})['then'](function(_0x3ab9a2){if(_0x3ab9a2&&_0x3ab9a2[_0xa09c('0x7d')]===0x0){return db['UserProfileResource'][_0xa09c('0x6d')]({'name':_0x362b98[_0xa09c('0x29')],'resourceId':_0x362b98['id'],'type':_0x3ab9a2['name'],'sectionId':_0x3ab9a2['id']},{})[_0xa09c('0x22')](function(){return _0x1fba2e;});}else{return _0x1fba2e;}})[_0xa09c('0x19')](function(_0x3c54e5){logger[_0xa09c('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c54e5);throw _0x3c54e5;});}return _0x1fba2e;})[_0xa09c('0x22')](respondWithResult(_0x261061,0xc9))[_0xa09c('0x19')](handleError(_0x261061,null));};exports[_0xa09c('0x7e')]=function(_0x5e3b76,_0x242a3e){return db[_0xa09c('0x49')][_0xa09c('0x6f')]({'where':{'id':_0x5e3b76[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x242a3e,null))[_0xa09c('0x22')](function(_0x524a95){if(_0x524a95){return _0x524a95[_0xa09c('0x7e')]();}return null;})['then'](respondWithResult(_0x242a3e,null))[_0xa09c('0x19')](handleError(_0x242a3e,null));};exports['addImap']=function(_0x1b3df3,_0x2c4431){if(_0x1b3df3[_0xa09c('0x65')]['id']){delete _0x1b3df3['body']['id'];}return db[_0xa09c('0x49')][_0xa09c('0x63')]({'where':{'id':_0x1b3df3['params']['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x2c4431,null))[_0xa09c('0x22')](function(_0x23550f){if(_0x23550f){_0x1b3df3[_0xa09c('0x65')][_0xa09c('0x71')]=_0x23550f['id'];return db[_0xa09c('0x44')][_0xa09c('0x6d')](_0x1b3df3[_0xa09c('0x65')]);}})[_0xa09c('0x22')](respondWithResult(_0x2c4431,null))[_0xa09c('0x19')](handleError(_0x2c4431,null));};exports[_0xa09c('0x7f')]=function(_0x3ca6c0,_0x119e7c){return db[_0xa09c('0x49')][_0xa09c('0x6f')]({'where':{'id':_0x3ca6c0[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x119e7c,null))[_0xa09c('0x22')](function(_0x2596cc){if(_0x2596cc){return _0x2596cc[_0xa09c('0x80')](null);}return null;})[_0xa09c('0x22')](respondWithStatusCode(_0x119e7c,null))[_0xa09c('0x19')](handleError(_0x119e7c,null));};exports[_0xa09c('0x81')]=function(_0x3671af,_0x2b8326){return db['MailAccount'][_0xa09c('0x6f')]({'where':{'id':_0x3671af[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x2b8326,null))[_0xa09c('0x22')](function(_0x1b0020){if(_0x1b0020){return _0x1b0020[_0xa09c('0x81')]();}return null;})[_0xa09c('0x22')](respondWithResult(_0x2b8326,null))['catch'](handleError(_0x2b8326,null));};exports['addSmtp']=function(_0x469dbe,_0x341e9c){if(_0x469dbe['body']['id']){delete _0x469dbe[_0xa09c('0x65')]['id'];}return db[_0xa09c('0x49')][_0xa09c('0x63')]({'where':{'id':_0x469dbe[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x341e9c,null))[_0xa09c('0x22')](function(_0x4fbf2a){if(_0x4fbf2a){_0x469dbe['body'][_0xa09c('0x71')]=_0x4fbf2a['id'];return db[_0xa09c('0x45')][_0xa09c('0x6d')](_0x469dbe[_0xa09c('0x65')]);}})[_0xa09c('0x22')](respondWithResult(_0x341e9c,null))[_0xa09c('0x19')](handleError(_0x341e9c,null));};exports['removeSmtp']=function(_0x4b5a4a,_0x1ff19c){return db[_0xa09c('0x49')]['findOne']({'where':{'id':_0x4b5a4a[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x1ff19c,null))[_0xa09c('0x22')](function(_0x1ad8fc){if(_0x1ad8fc){return _0x1ad8fc[_0xa09c('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x1ff19c,null))[_0xa09c('0x19')](handleError(_0x1ff19c,null));};exports['addInteraction']=function(_0x229e11,_0x72053a){return db[_0xa09c('0x83')][_0xa09c('0x63')]({'where':{'id':_0x229e11[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x72053a,null))[_0xa09c('0x22')](function(_0x586b16){if(_0x586b16){return _0x586b16[_0xa09c('0x84')](_0x229e11[_0xa09c('0x65')][_0xa09c('0x85')],_['omit'](_0x229e11[_0xa09c('0x65')],[_0xa09c('0x85'),'id'])||{});}})[_0xa09c('0x22')](respondWithResult(_0x72053a,null))[_0xa09c('0x19')](handleError(_0x72053a,null));};exports['getInteractions']=function(_0x1432ce,_0x25f2a2){var _0x6fa351={'raw':![],'where':{}};var _0x590dde={};var _0x21b83d={'count':0x0,'rows':[]};return db[_0xa09c('0x49')]['findOne']({'where':{'id':_0x1432ce[_0xa09c('0x68')]['id']}})['then'](handleEntityNotFound(_0x25f2a2,null))['then'](function(_0x499ac0){if(_0x499ac0){_0x590dde[_0xa09c('0x4d')]=_[_0xa09c('0x61')](db[_0xa09c('0x83')][_0xa09c('0x70')]);_0x590dde[_0xa09c('0x4e')]=_[_0xa09c('0x61')](_0x1432ce['query']);_0x590dde[_0xa09c('0x4f')]=_[_0xa09c('0x50')](_0x590dde[_0xa09c('0x4d')],_0x590dde[_0xa09c('0x4e')]);_0x6fa351[_0xa09c('0x51')]=_['intersection'](_0x590dde[_0xa09c('0x4d')],qs[_0xa09c('0x52')](_0x1432ce['query'][_0xa09c('0x52')]));_0x6fa351[_0xa09c('0x51')]=_0x6fa351[_0xa09c('0x51')][_0xa09c('0x53')]?_0x6fa351['attributes']:_0x590dde[_0xa09c('0x4d')];if(!_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x54')](_0xa09c('0x55'))){_0x6fa351[_0xa09c('0x1e')]=qs['limit'](_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x1e')]);_0x6fa351['offset']=qs[_0xa09c('0x1d')](_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x1d')]);}_0x6fa351['order']=qs[_0xa09c('0x57')](_0x1432ce[_0xa09c('0x4e')]['sort']);_0x6fa351[_0xa09c('0x58')]=qs[_0xa09c('0x4f')](_['pick'](_0x1432ce[_0xa09c('0x4e')],_0x590dde['filters']));_0x6fa351['where'][_0xa09c('0x71')]=_0x499ac0['id'];if(_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x5a')]){_0x6fa351[_0xa09c('0x58')]=_[_0xa09c('0x5b')](_0x6fa351[_0xa09c('0x58')],{'$or':_[_0xa09c('0x48')](_0x6fa351['attributes'],function(_0x3391d7){var _0x1b083f={};_0x1b083f[_0x3391d7]={'$like':'%'+_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x5a')]+'%'};return _0x1b083f;})});}_0x6fa351=_[_0xa09c('0x5b')]({},_0x6fa351,_0x1432ce[_0xa09c('0x62')]);return db[_0xa09c('0x83')][_0xa09c('0x20')]({'where':_0x6fa351[_0xa09c('0x58')]})[_0xa09c('0x22')](function(_0x4304e0){_0x21b83d[_0xa09c('0x20')]=_0x4304e0;if(_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x5d')]){_0x6fa351[_0xa09c('0x5e')]=[{'model':db[_0xa09c('0x86')],'as':_0xa09c('0x87'),'required':![]},{'model':db[_0xa09c('0x88')],'as':_0xa09c('0x89'),'attributes':['name',_0xa09c('0x8a'),_0xa09c('0x8b')],'required':![]},{'model':db['Tag'],'as':_0xa09c('0x8c'),'attributes':['id',_0xa09c('0x29'),_0xa09c('0x8d')],'where':_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x8e')]?{'id':_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x8e')]}:undefined,'required':_0x1432ce[_0xa09c('0x4e')][_0xa09c('0x8e')]?!![]:![]}];}return db[_0xa09c('0x83')]['findAll'](_0x6fa351);})['then'](function(_0x335681){_0x21b83d[_0xa09c('0x60')]=_0x335681;return _0x21b83d;});}})[_0xa09c('0x22')](respondWithFilteredResult(_0x25f2a2,_0x6fa351))[_0xa09c('0x19')](handleError(_0x25f2a2,null));};exports[_0xa09c('0x8f')]=function addApplications(_0x507e92,_0x496966){var _0x4941f7=_0x507e92['params']['id'];var _0x4312bb=_0x507e92[_0xa09c('0x65')];var _0x2df510=0xc8;var _0x2d4039=null;return db[_0xa09c('0x90')][_0xa09c('0x91')]({'isolationLevel':db['sequelize']['Transaction'][_0xa09c('0x92')][_0xa09c('0x93')]},function(_0x1ceb19){return db['MailAccount'][_0xa09c('0x6f')]({'where':{'id':_0x4941f7},'transaction':_0x1ceb19})[_0xa09c('0x22')](function(_0x1a9833){if(_0x1a9833){return db[_0xa09c('0x94')]['destroy']({'where':{'MailAccountId':_0x4941f7},'transaction':_0x1ceb19})[_0xa09c('0x22')](function(){var _0x487393=_['map'](_0x4312bb,function(_0x2da69d){_0x2da69d[_0xa09c('0x71')]=_0x4941f7;return _0x2da69d;});return db[_0xa09c('0x94')][_0xa09c('0x95')](_0x487393,{'transaction':_0x1ceb19});});}else{_0x2df510=0x194;_0x2d4039=[];}});})[_0xa09c('0x22')](function(){if(_0x2df510!==0x194){return db['MailApplication'][_0xa09c('0x96')]({'where':{'MailAccountId':_0x4941f7},'order':'priority'})[_0xa09c('0x22')](function(_0x5be61d){_0x2d4039=_0x5be61d;});}})[_0xa09c('0x19')](function(_0x54afff){_0x2df510=0x1f4;logger[_0xa09c('0x15')](_0x54afff[_0xa09c('0x28')]);if(_0x54afff[_0xa09c('0x29')]){delete _0x54afff['name'];}_0x2d4039=_0x54afff;})['finally'](function(){if(_0x2d4039===null){_0x496966[_0xa09c('0x27')](_0x2df510);}else{if(_0x2df510===0x1f4){_0x496966['status'](_0x2df510)[_0xa09c('0x2a')](_0x2d4039);}else{_0x496966['status'](_0x2df510)['json'](_0x2d4039);}}});};exports[_0xa09c('0x97')]=function(_0x1f0213,_0x5a7cab){var _0x5ea1ca={};var _0x2bc9ce={};var _0x55d4dd;var _0x4bd508;return db['MailAccount'][_0xa09c('0x6f')]({'where':{'id':_0x1f0213[_0xa09c('0x68')]['id']}})['then'](handleEntityNotFound(_0x5a7cab,null))[_0xa09c('0x22')](function(_0x5b56c8){if(_0x5b56c8){_0x55d4dd=_0x5b56c8;_0x2bc9ce[_0xa09c('0x4d')]=_[_0xa09c('0x61')](db[_0xa09c('0x94')][_0xa09c('0x70')]);_0x2bc9ce[_0xa09c('0x4e')]=_[_0xa09c('0x61')](_0x1f0213[_0xa09c('0x4e')]);_0x2bc9ce[_0xa09c('0x4f')]=_[_0xa09c('0x50')](_0x2bc9ce[_0xa09c('0x4d')],_0x2bc9ce[_0xa09c('0x4e')]);_0x5ea1ca[_0xa09c('0x51')]=_[_0xa09c('0x50')](_0x2bc9ce[_0xa09c('0x4d')],qs[_0xa09c('0x52')](_0x1f0213[_0xa09c('0x4e')]['fields']));_0x5ea1ca['attributes']=_0x5ea1ca[_0xa09c('0x51')]['length']?_0x5ea1ca[_0xa09c('0x51')]:_0x2bc9ce[_0xa09c('0x4d')];_0x5ea1ca[_0xa09c('0x56')]=qs[_0xa09c('0x57')](_0x1f0213['query']['sort']);_0x5ea1ca[_0xa09c('0x58')]=qs[_0xa09c('0x4f')](_[_0xa09c('0x59')](_0x1f0213[_0xa09c('0x4e')],_0x2bc9ce[_0xa09c('0x4f')]));if(_0x1f0213[_0xa09c('0x4e')][_0xa09c('0x5a')]){_0x5ea1ca[_0xa09c('0x58')]=_['merge'](_0x5ea1ca[_0xa09c('0x58')],{'$or':_[_0xa09c('0x48')](_0x5ea1ca[_0xa09c('0x51')],function(_0x3f39b9){var _0x5e25a2={};_0x5e25a2[_0x3f39b9]={'$like':'%'+_0x1f0213[_0xa09c('0x4e')][_0xa09c('0x5a')]+'%'};return _0x5e25a2;})});}_0x5ea1ca=_['merge']({},_0x5ea1ca,_0x1f0213[_0xa09c('0x62')]);return _0x55d4dd[_0xa09c('0x97')](_0x5ea1ca);}})[_0xa09c('0x22')](function(_0x3f3b4b){if(_0x3f3b4b){_0x4bd508=_0x3f3b4b['length'];if(!_0x1f0213[_0xa09c('0x4e')][_0xa09c('0x54')](_0xa09c('0x55'))){_0x5ea1ca['limit']=qs['limit'](_0x1f0213[_0xa09c('0x4e')][_0xa09c('0x1e')]);_0x5ea1ca[_0xa09c('0x1d')]=qs['offset'](_0x1f0213[_0xa09c('0x4e')]['offset']);}return _0x55d4dd[_0xa09c('0x97')](_0x5ea1ca);}})[_0xa09c('0x22')](function(_0x4fe43a){if(_0x4fe43a){return _0x4fe43a?{'count':_0x4bd508,'rows':_0x4fe43a}:null;}})['then'](respondWithResult(_0x5a7cab,null))[_0xa09c('0x19')](handleError(_0x5a7cab,null));};exports['getMessages']=function(_0x122a4d,_0x364fef){var _0x1b9ce8={'raw':!![],'where':{}};var _0x2df0b4={};var _0x20562e={'count':0x0,'rows':[]};return db[_0xa09c('0x49')][_0xa09c('0x6f')]({'where':{'id':_0x122a4d['params']['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x364fef,null))[_0xa09c('0x22')](function(_0x160649){if(_0x160649){_0x2df0b4[_0xa09c('0x4d')]=_['keys'](db[_0xa09c('0x98')]['rawAttributes']);_0x2df0b4['query']=_['keys'](_0x122a4d[_0xa09c('0x4e')]);_0x2df0b4[_0xa09c('0x4f')]=_[_0xa09c('0x50')](_0x2df0b4[_0xa09c('0x4d')],_0x2df0b4[_0xa09c('0x4e')]);_0x1b9ce8['attributes']=_[_0xa09c('0x50')](_0x2df0b4[_0xa09c('0x4d')],qs[_0xa09c('0x52')](_0x122a4d['query'][_0xa09c('0x52')]));_0x1b9ce8['attributes']=_0x1b9ce8[_0xa09c('0x51')][_0xa09c('0x53')]?_0x1b9ce8[_0xa09c('0x51')]:_0x2df0b4['model'];if(!_0x122a4d['query'][_0xa09c('0x54')](_0xa09c('0x55'))){_0x1b9ce8[_0xa09c('0x1e')]=qs[_0xa09c('0x1e')](_0x122a4d[_0xa09c('0x4e')][_0xa09c('0x1e')]);_0x1b9ce8[_0xa09c('0x1d')]=qs[_0xa09c('0x1d')](_0x122a4d[_0xa09c('0x4e')][_0xa09c('0x1d')]);}_0x1b9ce8[_0xa09c('0x56')]=qs[_0xa09c('0x57')](_0x122a4d[_0xa09c('0x4e')]['sort']);_0x1b9ce8[_0xa09c('0x58')]=qs[_0xa09c('0x4f')](_[_0xa09c('0x59')](_0x122a4d[_0xa09c('0x4e')],_0x2df0b4[_0xa09c('0x4f')]));_0x1b9ce8[_0xa09c('0x58')][_0xa09c('0x71')]=_0x160649['id'];if(_0x122a4d[_0xa09c('0x4e')][_0xa09c('0x5a')]){_0x1b9ce8[_0xa09c('0x58')]=_[_0xa09c('0x5b')](_0x1b9ce8[_0xa09c('0x58')],{'$or':_[_0xa09c('0x48')](_0x1b9ce8[_0xa09c('0x51')],function(_0x1a9f8f){var _0x3e9f3c={};_0x3e9f3c[_0x1a9f8f]={'$like':'%'+_0x122a4d[_0xa09c('0x4e')][_0xa09c('0x5a')]+'%'};return _0x3e9f3c;})});}if(_0x122a4d[_0xa09c('0x4e')][_0xa09c('0x99')]){var _0x3af840=_0x122a4d[_0xa09c('0x4e')][_0xa09c('0x99')][_0xa09c('0x9a')](',');var _0x572f48={};_0x572f48[_0x3af840[0x0]]={'$gte':moment(_0x3af840[0x1])['format'](_0xa09c('0x9b'))};_0x1b9ce8[_0xa09c('0x58')]=_[_0xa09c('0x5b')](_0x1b9ce8[_0xa09c('0x58')],_0x572f48);}_0x1b9ce8=_[_0xa09c('0x5b')]({},_0x1b9ce8,_0x122a4d[_0xa09c('0x62')]);return db[_0xa09c('0x98')][_0xa09c('0x20')]({'where':_0x1b9ce8[_0xa09c('0x58')]})[_0xa09c('0x22')](function(_0x2997b0){_0x20562e[_0xa09c('0x20')]=_0x2997b0;if(_0x122a4d['query'][_0xa09c('0x5d')]){_0x1b9ce8['include']=[{'all':!![]}];}return db[_0xa09c('0x98')][_0xa09c('0x5f')](_0x1b9ce8);})['then'](function(_0x34f06d){if(_0x122a4d['query']['inlineCss']===_0xa09c('0x9c')){for(var _0x22f49b=0x0;_0x22f49b<_0x34f06d['length'];_0x22f49b++){_0x34f06d[_0x22f49b]['body']=juice(_0x34f06d[_0x22f49b][_0xa09c('0x65')]);}}_0x20562e['rows']=_0x34f06d;return _0x20562e;});}})[_0xa09c('0x22')](respondWithFilteredResult(_0x364fef,_0x1b9ce8))[_0xa09c('0x19')](handleError(_0x364fef,null));};exports[_0xa09c('0x2a')]=function(_0x32a7ca,_0x39cb48){var _0x5c7595,_0x22776e={},_0x5f0d93;if(_0x32a7ca[_0xa09c('0x65')]['to']){_0x5f0d93=_0x32a7ca[_0xa09c('0x65')]['to'][_0xa09c('0x9a')](',')[0x0];}return db[_0xa09c('0x49')][_0xa09c('0x63')]({'where':{'id':_0x32a7ca[_0xa09c('0x68')]['id']},'include':[{'model':db[_0xa09c('0x9d')],'as':_0xa09c('0x9e'),'include':[{'model':db[_0xa09c('0x86')],'as':'Contacts','where':{'email':_0x5f0d93},'limit':0x1,'order':[['updatedAt',_0xa09c('0x9f')]]}]},{'model':db[_0xa09c('0x45')],'as':_0xa09c('0x42'),'raw':!![],'include':[{'model':db[_0xa09c('0xa0')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x39cb48,null))[_0xa09c('0x22')](function(_0x1df81c){if(!_0x1df81c)return;_0x5c7595=_0x1df81c;if(!_0x1df81c['Smtp'])throw new Error(_0xa09c('0xa1'));if(_['isNil'](_0x32a7ca[_0xa09c('0x65')][_0xa09c('0xa2')])){_0x32a7ca['body'][_0xa09c('0xa2')]=util[_0xa09c('0xa3')](_0xa09c('0xa4'),_0x1df81c['name'],_0x1df81c[_0xa09c('0x78')]||_0x1df81c['Smtp'][_0xa09c('0x37')]);}if(_0x32a7ca['body'][_0xa09c('0xa5')]&&_0x32a7ca[_0xa09c('0x65')]['attachments']['length']){for(var _0x455618=0x0;_0x455618<_0x32a7ca['body'][_0xa09c('0xa5')][_0xa09c('0x53')];_0x455618+=0x1){_0x32a7ca['body'][_0xa09c('0xa5')][_0x455618]={'filename':_0x32a7ca[_0xa09c('0x65')][_0xa09c('0xa5')][_0x455618]['name'],'path':path[_0xa09c('0xa6')](config[_0xa09c('0xa7')],_0xa09c('0xa8'),_0x32a7ca[_0xa09c('0x65')][_0xa09c('0xa5')][_0x455618][_0xa09c('0xa9')])};}}var _0x349bb0=_0x1df81c['getSmtpOptions']();return respondWithRpcPromise(_0xa09c('0xaa'),_0xa09c('0xab'),{'account':_0x349bb0,'message':_0x32a7ca[_0xa09c('0x65')]});})[_0xa09c('0x22')](function(_0x4f6cba){if(!_0x4f6cba)return;_0x22776e=_0x4f6cba;if(!_0x5c7595[_0xa09c('0x9e')])throw new Error(_0xa09c('0xac'));if(_0x5c7595['List'][_0xa09c('0xad')][_0xa09c('0x53')])return _0x5c7595[_0xa09c('0x9e')][_0xa09c('0xad')][0x0];return db[_0xa09c('0x86')][_0xa09c('0x6d')](_['defaults'](_0x32a7ca[_0xa09c('0x65')],{'firstName':_0x32a7ca[_0xa09c('0x65')]['to'],'email':_0x32a7ca[_0xa09c('0x65')]['to'],'phone':_0x32a7ca[_0xa09c('0x65')]['to'],'ListId':_0x5c7595[_0xa09c('0x79')]}));})[_0xa09c('0x22')](function(_0x5c99b5){if(!_0x5c99b5)return;var _0x481aaa={'UserId':_0x32a7ca[_0xa09c('0x37')]['id'],'ContactId':_0x5c99b5['id'],'MailAccountId':_0x5c7595['id'],'inReplyTo':_0x22776e['messageId'],'to':_0x32a7ca[_0xa09c('0x65')][_0xa09c('0xa2')],'cc':_0x32a7ca['body']['cc'],'subject':_0x32a7ca[_0xa09c('0x65')][_0xa09c('0xae')],'attach':_0x32a7ca['body']['attach'],'firstMsgDirection':_0xa09c('0xaf'),'lastMsgAt':moment()['format'](_0xa09c('0x9b')),'lastMsgDirection':_0xa09c('0xaf'),'Messages':[_[_0xa09c('0x5b')](_0x32a7ca[_0xa09c('0x65')],{'messageId':_0x22776e[_0xa09c('0xb0')],'sentAt':moment()['format'](_0xa09c('0x9b')),'read':!![],'MailAccountId':_0x5c7595['id'],'UserId':_0x32a7ca['user']['id'],'ContactId':_0x5c99b5['id']})]};if(_0x32a7ca['body']['Interaction']){_0x481aaa=_['merge'](_0x481aaa,_0x32a7ca[_0xa09c('0x65')][_0xa09c('0xb1')]);}return db[_0xa09c('0x83')][_0xa09c('0x6d')](_0x481aaa,{'include':[{'model':db[_0xa09c('0x98')],'as':_0xa09c('0xb2')}]});})[_0xa09c('0x22')](respondWithResult(_0x39cb48,null))[_0xa09c('0x19')](handleError(_0x39cb48,null));};exports[_0xa09c('0xb3')]=function(_0x27b4ce,_0x48fb9f){return db[_0xa09c('0x49')][_0xa09c('0x63')]({'where':{'id':_0x27b4ce[_0xa09c('0x68')]['id']},'include':[{'model':db[_0xa09c('0x45')],'as':_0xa09c('0x42'),'raw':!![],'include':[{'model':db[_0xa09c('0xa0')],'as':_0xa09c('0xa0'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x48fb9f,null))[_0xa09c('0x22')](function(_0x146c3c){if(!_0x146c3c[_0xa09c('0x42')])return;var _0x9bb4c3=_0x146c3c[_0xa09c('0xb4')]();return respondWithRpcPromise(_0xa09c('0xb5'),'verifySmtp',{'account':_0x9bb4c3});})[_0xa09c('0x22')](respondWithResult(_0x48fb9f,null))[_0xa09c('0x19')](handleError(_0x48fb9f,null));};exports['destroy']=function(_0x29e450,_0x1b6b4c){return db[_0xa09c('0x49')][_0xa09c('0x63')]({'where':{'id':_0x29e450[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x1b6b4c,null))[_0xa09c('0x22')](function(_0x5453b6){if(_0x5453b6&&_0x5453b6['service']){throw new db['Sequelize'][(_0xa09c('0xb6'))](_0xa09c('0xb7'));}return _0x5453b6;})[_0xa09c('0x22')](removeEntity(_0x1b6b4c,null))[_0xa09c('0x19')](handleError(_0x1b6b4c,null));};exports[_0xa09c('0xb8')]=function(_0x5e568a,_0x41cea7){return db['MailAccount'][_0xa09c('0x63')]({'where':{'id':_0x5e568a[_0xa09c('0x68')]['id']}})['then'](handleEntityNotFound(_0x41cea7,null))[_0xa09c('0x22')](function(_0x40ebb8){if(_0x40ebb8){return _0x40ebb8[_0xa09c('0xb8')](_0x5e568a['body'][_0xa09c('0x85')],_[_0xa09c('0xb9')](_0x5e568a[_0xa09c('0x65')],[_0xa09c('0x85'),'id'])||{})[_0xa09c('0xba')](function(_0x30562f){for(var _0x19e43d=0x0;_0x19e43d<_0x5e568a[_0xa09c('0x65')][_0xa09c('0x85')]['length'];_0x19e43d+=0x1){socket[_0xa09c('0xbb')](_0xa09c('0xbc'),{'UserId':Number(_0x5e568a[_0xa09c('0x65')][_0xa09c('0x85')][_0x19e43d]),'MailAccountId':Number(_0x5e568a[_0xa09c('0x68')]['id'])});}return _0x30562f;});}})[_0xa09c('0x22')](respondWithResult(_0x41cea7,null))['catch'](handleError(_0x41cea7,null));};exports[_0xa09c('0xbd')]=function(_0x384e04,_0xa90777){return db['MailAccount'][_0xa09c('0x63')]({'where':{'id':_0x384e04[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0xa90777,null))['then'](function(_0x2bc40f){if(_0x2bc40f){return _0x2bc40f['removeAgents'](_0x384e04[_0xa09c('0x4e')][_0xa09c('0x85')])[_0xa09c('0x22')](function(){if(_['isArray'](_0x384e04[_0xa09c('0x4e')][_0xa09c('0x85')])){for(var _0x5c0c52=0x0;_0x5c0c52<_0x384e04[_0xa09c('0x4e')][_0xa09c('0x85')]['length'];_0x5c0c52+=0x1){socket[_0xa09c('0xbb')](_0xa09c('0xbe'),{'UserId':Number(_0x384e04[_0xa09c('0x4e')][_0xa09c('0x85')][_0x5c0c52]),'MailAccountId':Number(_0x384e04['params']['id'])});}}else{socket[_0xa09c('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x384e04['query'][_0xa09c('0x85')]),'MailAccountId':Number(_0x384e04[_0xa09c('0x68')]['id'])});}});}})[_0xa09c('0x22')](respondWithStatusCode(_0xa90777,null))[_0xa09c('0x19')](handleError(_0xa90777,null));};exports[_0xa09c('0xbf')]=function(_0x281e10,_0x1329e9){var _0xbb36={};var _0x180a09={};var _0x57ae57;var _0x3edf2e;return db[_0xa09c('0x49')]['findOne']({'where':{'id':_0x281e10[_0xa09c('0x68')]['id']}})[_0xa09c('0x22')](handleEntityNotFound(_0x1329e9,null))[_0xa09c('0x22')](function(_0x20ca63){if(_0x20ca63){_0x57ae57=_0x20ca63;_0x180a09['model']=_[_0xa09c('0x61')](db[_0xa09c('0x88')][_0xa09c('0x70')]);_0x180a09[_0xa09c('0x4e')]=_[_0xa09c('0x61')](_0x281e10[_0xa09c('0x4e')]);_0x180a09[_0xa09c('0x4f')]=_[_0xa09c('0x50')](_0x180a09['model'],_0x180a09['query']);_0xbb36['attributes']=_[_0xa09c('0x50')](_0x180a09[_0xa09c('0x4d')],qs['fields'](_0x281e10[_0xa09c('0x4e')][_0xa09c('0x52')]));_0xbb36[_0xa09c('0x51')]=_0xbb36[_0xa09c('0x51')]['length']?_0xbb36[_0xa09c('0x51')]:_0x180a09[_0xa09c('0x4d')];_0xbb36['order']=qs[_0xa09c('0x57')](_0x281e10[_0xa09c('0x4e')]['sort']);_0xbb36['where']=qs[_0xa09c('0x4f')](_[_0xa09c('0x59')](_0x281e10['query'],_0x180a09[_0xa09c('0x4f')]));if(_0x281e10[_0xa09c('0x4e')]['filter']){_0xbb36[_0xa09c('0x58')]=_[_0xa09c('0x5b')](_0xbb36[_0xa09c('0x58')],{'$or':_[_0xa09c('0x48')](_0xbb36[_0xa09c('0x51')],function(_0x5affc6){var _0xa0bf28={};_0xa0bf28[_0x5affc6]={'$like':'%'+_0x281e10[_0xa09c('0x4e')][_0xa09c('0x5a')]+'%'};return _0xa0bf28;})});}_0xbb36=_[_0xa09c('0x5b')]({},_0xbb36,_0x281e10['options']);return _0x57ae57['getAgents'](_0xbb36);}})['then'](function(_0x11bea7){if(_0x11bea7){_0x3edf2e=_0x11bea7[_0xa09c('0x53')];if(!_0x281e10['query']['hasOwnProperty'](_0xa09c('0x55'))){_0xbb36[_0xa09c('0x1e')]=qs[_0xa09c('0x1e')](_0x281e10[_0xa09c('0x4e')][_0xa09c('0x1e')]);_0xbb36[_0xa09c('0x1d')]=qs['offset'](_0x281e10[_0xa09c('0x4e')][_0xa09c('0x1d')]);}return _0x57ae57[_0xa09c('0xbf')](_0xbb36);}})[_0xa09c('0x22')](function(_0x56e370){if(_0x56e370){return _0x56e370?{'count':_0x3edf2e,'rows':_0x56e370}:null;}})[_0xa09c('0x22')](respondWithResult(_0x1329e9,null))['catch'](handleError(_0x1329e9,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e74539a..51d36f7 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 _0x0b36=['MailAccount','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x2a90b5,_0x3e29f6){var _0x5c6728=function(_0x25e0bf){while(--_0x25e0bf){_0x2a90b5['push'](_0x2a90b5['shift']());}};_0x5c6728(++_0x3e29f6);}(_0x0b36,0x10c));var _0x60b3=function(_0x5d3956,_0x697661){_0x5d3956=_0x5d3956-0x0;var _0x17325f=_0x0b36[_0x5d3956];return _0x17325f;};'use strict';var EventEmitter=require(_0x60b3('0x0'));var MailAccount=require(_0x60b3('0x1'))['db'][_0x60b3('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x60b3('0x3')};function emitEvent(_0x530d5b){return function(_0xa0e029,_0x19dbae,_0x3afbc7){MailAccountEvents[_0x60b3('0x4')](_0x530d5b+':'+_0xa0e029['id'],_0xa0e029);MailAccountEvents[_0x60b3('0x4')](_0x530d5b,_0xa0e029);_0x3afbc7(null);};}for(var e in events){if(events[_0x60b3('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x5263=['MailAccount','emit','hasOwnProperty','hook','exports'];(function(_0x4083da,_0x7aee27){var _0x46dfcc=function(_0x4daa29){while(--_0x4daa29){_0x4083da['push'](_0x4083da['shift']());}};_0x46dfcc(++_0x7aee27);}(_0x5263,0xaa));var _0x3526=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x5263[_0x599e60];return _0x468e19;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x3526('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2878bd){return function(_0x38ce8f,_0x23cd42,_0x1b250d){MailAccountEvents['emit'](_0x2878bd+':'+_0x38ce8f['id'],_0x38ce8f);MailAccountEvents[_0x3526('0x1')](_0x2878bd,_0x38ce8f);_0x1b250d(null);};}for(var e in events){if(events[_0x3526('0x2')](e)){var event=events[e];MailAccount[_0x3526('0x3')](e,emitEvent(event));}}module[_0x3526('0x4')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index ff63346..8395a74 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 _0x8f0f=['port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','auth','define','MailAccount','custom','Smtp','host'];(function(_0x465da7,_0x495254){var _0x3bcb75=function(_0x17da61){while(--_0x17da61){_0x465da7['push'](_0x465da7['shift']());}};_0x3bcb75(++_0x495254);}(_0x8f0f,0x79));var _0xf8f0=function(_0xe858c0,_0x124a9a){_0xe858c0=_0xe858c0-0x0;var _0x23043d=_0x8f0f[_0xe858c0];return _0x23043d;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x2d70cb){return _0x2d70cb[_0xf8f0('0x0')](_0xf8f0('0x1'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1bb821=this;var _0x1cab7c={'id':_0x1bb821['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1bb821['provider']!==_0xf8f0('0x2')){_0x1cab7c['service']=_0x1bb821['provider'];}else{_0x1cab7c['host']=_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x4')];_0x1cab7c[_0xf8f0('0x5')]=_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x5')];_0x1cab7c[_0xf8f0('0x6')]=_0x1bb821['Smtp']['secure'];}if(_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x7')]){if(_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x8')]){if(!_0x1bb821['Smtp'][_0xf8f0('0x9')])throw new Error(_0xf8f0('0xa'));_0x1cab7c['auth']={'type':_0xf8f0('0xb'),'user':_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0xc')],'accessToken':_0x1bb821[_0xf8f0('0x3')][_0xf8f0('0x9')]['data5']};}else{_0x1cab7c[_0xf8f0('0xd')]={'user':_0x1bb821['Smtp'][_0xf8f0('0xc')],'pass':_0x1bb821[_0xf8f0('0x3')]['pass']};}}return _0x1cab7c;}}});}; \ No newline at end of file +var _0x9287=['exports','define','mail_accounts','service','provider','host','Smtp','secure','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','./mailAccount.attributes'];(function(_0x2d3cce,_0x3cd847){var _0x291577=function(_0x490b75){while(--_0x490b75){_0x2d3cce['push'](_0x2d3cce['shift']());}};_0x291577(++_0x3cd847);}(_0x9287,0x77));var _0x7928=function(_0x4a9433,_0x5337cb){_0x4a9433=_0x4a9433-0x0;var _0x434947=_0x9287[_0x4a9433];return _0x434947;};'use strict';var attributes=require(_0x7928('0x0'));module[_0x7928('0x1')]=function(_0x31ae43){return _0x31ae43[_0x7928('0x2')]('MailAccount',attributes,{'tableName':_0x7928('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x579d07=this;var _0x3bd624={'id':_0x579d07['id'],'tls':{'rejectUnauthorized':![]}};if(_0x579d07['provider']!=='custom'){_0x3bd624[_0x7928('0x4')]=_0x579d07[_0x7928('0x5')];}else{_0x3bd624[_0x7928('0x6')]=_0x579d07[_0x7928('0x7')][_0x7928('0x6')];_0x3bd624['port']=_0x579d07['Smtp']['port'];_0x3bd624[_0x7928('0x8')]=_0x579d07[_0x7928('0x7')][_0x7928('0x8')];}if(_0x579d07['Smtp'][_0x7928('0x9')]){if(_0x579d07[_0x7928('0x7')]['modernAuthentication']){if(!_0x579d07[_0x7928('0x7')][_0x7928('0xa')])throw new Error(_0x7928('0xb'));_0x3bd624[_0x7928('0xc')]={'type':_0x7928('0xd'),'user':_0x579d07[_0x7928('0x7')][_0x7928('0xe')],'accessToken':_0x579d07[_0x7928('0x7')][_0x7928('0xa')]['data5']};}else{_0x3bd624[_0x7928('0xc')]={'user':_0x579d07[_0x7928('0x7')][_0x7928('0xe')],'pass':_0x579d07[_0x7928('0x7')]['pass']};}}return _0x3bd624;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index cc2b7b9..5c14737 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 _0x236d=['created','MailMessage','originTo','bcc','ChatWebsiteId','originChannel','Attachment','Attachments','User','UserId','unshift','name','waitForTheAssignedAgent','queueId','MailQueue','waitForTheAssignedQueue','startRouting','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','GetMailAccount','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','rawAttributes','createdAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','List','applications','list','orderBy','asc','autoclose','push','close','*,*,*,*','length','CmContact','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','spread','update','format','interaction'];(function(_0x56740d,_0x1e9994){var _0x4718d8=function(_0x84d815){while(--_0x84d815){_0x56740d['push'](_0x56740d['shift']());}};_0x4718d8(++_0x1e9994);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd236('0x0'));var moment=require(_0xd236('0x1'));var BPromise=require('bluebird');var rs=require(_0xd236('0x2'));var Redis=require('ioredis');var db=require(_0xd236('0x3'))['db'];var logger=require(_0xd236('0x4'))(_0xd236('0x5'));var config=require(_0xd236('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd236('0x7')]({'port':0x232c});config[_0xd236('0x8')]=_[_0xd236('0x9')](config[_0xd236('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd236('0x8')]));require(_0xd236('0xa'))['register'](socket);function respondWithRpcPromise(_0x186a0b,_0x110545,_0x5a3447){return new BPromise(function(_0x3d11c7,_0x29ba1d){return client[_0xd236('0xb')](_0x186a0b,_0x5a3447)['then'](function(_0x470524){logger[_0xd236('0xc')](_0xd236('0xd'),_0x110545,'request\x20sent');logger[_0xd236('0xe')](_0xd236('0xf'),_0x110545,_0xd236('0x10'),JSON[_0xd236('0x11')](_0x470524));if(_0x470524[_0xd236('0x12')]){if(_0x470524[_0xd236('0x12')][_0xd236('0x13')]===0x1f4){logger[_0xd236('0x12')](_0xd236('0xd'),_0x110545,_0x470524[_0xd236('0x12')][_0xd236('0x14')]);return _0x29ba1d(_0x470524[_0xd236('0x12')][_0xd236('0x14')]);}logger[_0xd236('0x12')](_0xd236('0xd'),_0x110545,_0x470524[_0xd236('0x12')][_0xd236('0x14')]);return _0x3d11c7(_0x470524[_0xd236('0x12')][_0xd236('0x14')]);}else{logger[_0xd236('0xc')]('MailAccount,\x20%s,\x20%s',_0x110545,'request\x20sent');_0x3d11c7(_0x470524[_0xd236('0x15')][_0xd236('0x14')]);}})['catch'](function(_0x11c6ec){logger[_0xd236('0x12')](_0xd236('0xd'),_0x110545,_0x11c6ec);_0x29ba1d(_0x11c6ec);});});}exports['GetMailAccount']=function(_0x355b65){var _0x1b6aaa=this;return new Promise(function(_0x31f0bb,_0x551b53){return db[_0xd236('0x16')][_0xd236('0x17')]({'raw':_0x355b65[_0xd236('0x18')]?_0x355b65[_0xd236('0x18')][_0xd236('0x19')]===undefined?!![]:![]:!![],'where':_0x355b65['options']?_0x355b65[_0xd236('0x18')][_0xd236('0x1a')]||null:null,'attributes':_0x355b65[_0xd236('0x18')]?_0x355b65[_0xd236('0x18')][_0xd236('0x1b')]||null:null,'limit':_0x355b65['options']?_0x355b65['options'][_0xd236('0x1c')]||null:null,'include':_0x355b65['options']?_0x355b65[_0xd236('0x18')]['include']?_[_0xd236('0x1d')](_0x355b65[_0xd236('0x18')][_0xd236('0x1e')],function(_0x49d822){return{'model':db[_0x49d822[_0xd236('0x1f')]],'as':_0x49d822['as'],'attributes':_0x49d822[_0xd236('0x1b')],'include':_0x49d822[_0xd236('0x1e')]?_[_0xd236('0x1d')](_0x49d822[_0xd236('0x1e')],function(_0x17f927){return{'model':db[_0x17f927[_0xd236('0x1f')]],'as':_0x17f927['as'],'attributes':_0x17f927[_0xd236('0x1b')],'include':_0x17f927[_0xd236('0x1e')]?_[_0xd236('0x1d')](_0x17f927[_0xd236('0x1e')],function(_0x2af382){return{'model':db[_0x2af382[_0xd236('0x1f')]],'as':_0x2af382['as'],'attributes':_0x2af382[_0xd236('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd236('0x20')](function(_0x28175d){logger[_0xd236('0xc')](_0xd236('0x21'),_0x355b65);logger[_0xd236('0xe')](_0xd236('0x21'),_0x355b65,JSON[_0xd236('0x11')](_0x28175d));_0x31f0bb(_0x28175d);})[_0xd236('0x22')](function(_0x3c1617){logger[_0xd236('0x12')](_0xd236('0x21'),_0x3c1617[_0xd236('0x14')],_0x355b65);_0x551b53(_0x1b6aaa[_0xd236('0x12')](0x1f4,_0x3c1617[_0xd236('0x14')]));});});};exports[_0xd236('0x23')]=function(_0x52a556){var _0xf50f02=this;return new Promise(function(_0x4ece4b,_0x2168a1){return db[_0xd236('0x16')][_0xd236('0x24')]({'raw':_0x52a556['options']?_0x52a556[_0xd236('0x18')][_0xd236('0x19')]===undefined?!![]:![]:!![],'where':_0x52a556[_0xd236('0x18')]?_0x52a556[_0xd236('0x18')][_0xd236('0x1a')]||null:null,'attributes':_0x52a556[_0xd236('0x18')]?_0x52a556[_0xd236('0x18')]['attributes']||null:null,'include':_0x52a556[_0xd236('0x18')]?_0x52a556['options'][_0xd236('0x1e')]?_['map'](_0x52a556[_0xd236('0x18')][_0xd236('0x1e')],function(_0x366128){return{'model':db[_0x366128[_0xd236('0x1f')]],'as':_0x366128['as'],'attributes':_0x366128[_0xd236('0x1b')],'include':_0x366128[_0xd236('0x1e')]?_[_0xd236('0x1d')](_0x366128[_0xd236('0x1e')],function(_0x450217){return{'model':db[_0x450217[_0xd236('0x1f')]],'as':_0x450217['as'],'attributes':_0x450217[_0xd236('0x1b')],'include':_0x450217[_0xd236('0x1e')]?_[_0xd236('0x1d')](_0x450217['include'],function(_0x414f55){return{'model':db[_0x414f55[_0xd236('0x1f')]],'as':_0x414f55['as'],'attributes':_0x414f55[_0xd236('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cb19a){if(_0x52a556[_0xd236('0x18')][_0xd236('0x25')]===!![])_0x2cb19a[_0xd236('0x26')](_0xd236('0x27'),_0x2cb19a[_0xd236('0x28')]());logger['info'](_0xd236('0x23'),_0x52a556);logger[_0xd236('0xe')](_0xd236('0x23'),_0x52a556,JSON[_0xd236('0x11')](_0x2cb19a));_0x4ece4b(_0x2cb19a);})[_0xd236('0x22')](function(_0x222495){logger['error'](_0xd236('0x23'),_0x222495[_0xd236('0x14')],_0x52a556);_0x2168a1(_0xf50f02[_0xd236('0x12')](0x1f4,_0x222495['message']));});});};exports[_0xd236('0x29')]=function(_0x5a8b18){var _0x442c6f=this;return new Promise(function(_0x5793bf,_0x55c4d9){var _0x29268e={'body':_0x5a8b18[_0xd236('0x2a')],'channel':_0xd236('0x2b')};var _0x276f11=_[_0xd236('0x2c')](_['keys'](db['CmContact'][_0xd236('0x2d')]),[_0xd236('0x2e'),'updatedAt',_0xd236('0x2f'),_0xd236('0x30')]);var _0x2d815b=![];if(_0x5a8b18['body']['id']){delete _0x5a8b18['body']['id'];}if(_['isNil'](_0x5a8b18[_0xd236('0x2a')]['from'])){return _0x55c4d9(_0x442c6f['error'](0x1f4,_0xd236('0x31')));}if(_[_0xd236('0x32')](_0x5a8b18[_0xd236('0x2a')][_0xd236('0x2a')])||_0x5a8b18[_0xd236('0x2a')]['body']===''){return _0x55c4d9(_0x442c6f['error'](0x1f4,_0xd236('0x33')));}if(_[_0xd236('0x32')](_0x5a8b18[_0xd236('0x2a')][_0xd236('0x34')])){return _0x55c4d9(_0x442c6f[_0xd236('0x12')](0x1f4,_0xd236('0x35')+_0x276f11));}if(!_['includes'](_0x276f11,_0x5a8b18[_0xd236('0x2a')]['mapKey'])){return _0x55c4d9(_0x442c6f[_0xd236('0x12')](0x1f4,_0xd236('0x36')+_0x276f11));}var _0x57c0cf={};_0x57c0cf[_0x5a8b18['body']['mapKey']]=_0x5a8b18['body'][_0xd236('0x37')];return db[_0xd236('0x16')][_0xd236('0x24')]({'where':{'id':_0x5a8b18[_0xd236('0x38')]['id']},'include':[{'model':db[_0xd236('0x39')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd236('0x3a'),'where':_0x57c0cf,'limit':0x1,'order':[[_0xd236('0x3b'),_0xd236('0x3c')]]}]},{'model':db[_0xd236('0x3d')],'as':_0xd236('0x3e')},{'model':db[_0xd236('0x3f')],'as':'Smtp','include':[{'model':db[_0xd236('0x40')],'as':'CloudProvider'}]}]})[_0xd236('0x20')](function(_0x2c8861){if(_0x2c8861&&_0x2c8861['List']){var _0x22cb72=_0x2c8861[_0xd236('0x41')]({'plain':!![]});_0x29268e['account']=_['omit'](_0x22cb72,[_0xd236('0x3e'),_0xd236('0x42')]);_0x29268e[_0xd236('0x38')][_0xd236('0x27')]=_0x2c8861['getSmtpOptions']();_0x29268e[_0xd236('0x43')]=_0x22cb72[_0xd236('0x3e')];_0x29268e[_0xd236('0x44')]=_0x22cb72[_0xd236('0x42')];_0x29268e[_0xd236('0x43')]=_[_0xd236('0x45')](_0x29268e['applications'],['priority'],[_0xd236('0x46')]);if(_0x29268e['account']&&_0x29268e[_0xd236('0x38')][_0xd236('0x47')]){_0x29268e['applications'][_0xd236('0x48')]({'id':0x0,'priority':_0x29268e[_0xd236('0x43')]['length']+0x1,'app':_0xd236('0x49'),'appdata':_0xd236('0x47'),'interval':_0xd236('0x4a')});}if(_0x29268e[_0xd236('0x38')]['Applications']){delete _0x29268e['account'][_0xd236('0x3e')];}if(_0x29268e[_0xd236('0x38')]['List']){delete _0x29268e[_0xd236('0x38')][_0xd236('0x42')];}if(_0x22cb72[_0xd236('0x42')][_0xd236('0x3a')][_0xd236('0x4b')]){return _0x22cb72['List'][_0xd236('0x3a')][0x0];}var _0x45a2c1=_[_0xd236('0x9')](_0x5a8b18['body'],{'firstName':_0x5a8b18[_0xd236('0x2a')]['from'],'ListId':_0x22cb72['ListId']});_0x45a2c1[_0x5a8b18[_0xd236('0x2a')][_0xd236('0x34')]]=_0x5a8b18[_0xd236('0x2a')][_0xd236('0x37')];return db[_0xd236('0x4c')][_0xd236('0x4d')](_0x45a2c1);}else{throw new Error(_0xd236('0x4e'));}})['then'](function(_0x4291a1){_0x29268e[_0xd236('0x4f')]=_0x4291a1;if(_0x4291a1){if(!_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')][_0xd236('0x50')]){_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x50')]=rs[_0xd236('0x51')]()+'\x20'+_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x37')];}var _0x6f83a2={'ContactId':_0x4291a1['id'],'MailAccountId':_0x5a8b18[_0xd236('0x38')]['id'],'inReplyTo':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x50')],'to':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['from'],'cc':_0x5a8b18[_0xd236('0x2a')]['message']['cc'],'subject':_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x52')],'attach':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x53')],'lastMsgAt':moment()['format'](_0xd236('0x54')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd236('0x24')]({'where':{'closed':![],'MailAccountId':_0x5a8b18[_0xd236('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':_0xd236('0x55'),'attributes':[_0xd236('0x50')],'where':{'messageId':_0x5a8b18['body']['message'][_0xd236('0x56')]}}]})[_0xd236('0x20')](function(_0x4c5527){if(_0x4c5527){return[_0x4c5527,![]];}return db[_0xd236('0x57')]['create'](_0x6f83a2)[_0xd236('0x20')](function(_0x13bb7a){return[_0x13bb7a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd236('0x58')](function(_0x3d3954,_0x275f2b){if(_0x3d3954){_0x2d815b=_0x275f2b;if(!_0x275f2b){return _0x3d3954[_0xd236('0x59')]({'inReplyTo':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x50')],'to':_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x37')],'cc':_0x5a8b18['body'][_0xd236('0x14')]['cc'],'subject':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['subject'],'attach':_0x3d3954[_0xd236('0x53')]?_0x3d3954[_0xd236('0x53')]:_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['attach'],'substatus':null,'substatusAt':moment()[_0xd236('0x5a')](_0xd236('0x54')),'lastMsgAt':moment()[_0xd236('0x5a')](_0xd236('0x54')),'lastMsgDirection':'in'});}else{return _0x3d3954;}}})['then'](function(_0x48e465){_0x29268e[_0xd236('0x5b')]=_0x48e465['get']({'plain':!![]});_0x29268e['interaction'][_0xd236('0x5c')]=_0x2d815b;return db[_0xd236('0x5d')][_0xd236('0x4d')]({'body':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x2a')],'MailAccountId':_0x5a8b18[_0xd236('0x38')]['id'],'MailInteractionId':_0x48e465['id'],'direction':'in','ContactId':_0x29268e[_0xd236('0x4f')]['id'],'messageId':_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x50')],'from':_0x5a8b18[_0xd236('0x2a')]['message'][_0xd236('0x37')],'to':_0x5a8b18[_0xd236('0x2a')]['message']['to'],'cc':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['cc'],'subject':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x52')],'attach':_0x5a8b18[_0xd236('0x2a')]['message']['attach'],'Attachments':_0x5a8b18['body'][_0xd236('0x14')]['attachments'],'originTo':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x5e')],'originCc':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')]['originCc'],'bcc':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')][_0xd236('0x5f')],'ChatWebsiteId':_0x5a8b18['body'][_0xd236('0x14')][_0xd236('0x60')]||null,'originChannel':_0x5a8b18[_0xd236('0x2a')][_0xd236('0x14')][_0xd236('0x61')]||'Email','ChatOfflineMessageId':_0x5a8b18['body'][_0xd236('0x14')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xd236('0x62')],'as':_0xd236('0x63')}]});})[_0xd236('0x20')](function(_0x4d22e9){_0x29268e[_0xd236('0x14')]=_0x4d22e9;if(!_0x29268e[_0xd236('0x5b')]['UserId']){return;}return db[_0xd236('0x64')][_0xd236('0x24')]({'attributes':['id','name'],'where':{'id':_0x29268e[_0xd236('0x5b')][_0xd236('0x65')]}});})['then'](function(_0x47e7b2){if(_0x47e7b2){_0x29268e[_0xd236('0x43')][_0xd236('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x47e7b2[_0xd236('0x67')]+','+(_0x29268e['account'][_0xd236('0x68')]||0xa),'interval':_0xd236('0x4a')});}if(!_0x29268e['interaction'][_0xd236('0x69')]){return;}return db[_0xd236('0x6a')]['find']({'attributes':['id',_0xd236('0x67')],'where':{'id':_0x29268e['interaction'][_0xd236('0x69')]}});})[_0xd236('0x20')](function(_0x21543c){if(_0x21543c){_0x29268e[_0xd236('0x43')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x21543c[_0xd236('0x67')]+','+(_0x29268e['account'][_0xd236('0x6b')]||0x12c),'interval':_0xd236('0x4a')});}return respondWithRpcPromise('Start',_0xd236('0x6c'),_0x29268e);})[_0xd236('0x20')](function(_0x4f02e7){_0x5793bf(_0x4f02e7);})[_0xd236('0x22')](function(_0x3b4e4c){_0x55c4d9(_0x442c6f[_0xd236('0x12')](0x1f4,_0x3b4e4c['message']));});});}; \ No newline at end of file +var _0x8f9d=['generate','attach','format','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','User','name','UserId','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetMailAccount','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','debug','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','DESC','MailApplication','Applications','Smtp','get','omit','list','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId'];(function(_0x4f774a,_0x30a14c){var _0x50ec05=function(_0x2af2b7){while(--_0x2af2b7){_0x4f774a['push'](_0x4f774a['shift']());}};_0x50ec05(++_0x30a14c);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd8f9('0x0'));var moment=require('moment');var BPromise=require(_0xd8f9('0x1'));var rs=require('randomstring');var Redis=require(_0xd8f9('0x2'));var db=require(_0xd8f9('0x3'))['db'];var logger=require(_0xd8f9('0x4'))(_0xd8f9('0x5'));var config=require(_0xd8f9('0x6'));var jayson=require(_0xd8f9('0x7'));var client=jayson[_0xd8f9('0x8')]['http']({'port':0x232c});config[_0xd8f9('0x9')]=_[_0xd8f9('0xa')](config[_0xd8f9('0x9')],{'host':_0xd8f9('0xb'),'port':0x18eb});var socket=require(_0xd8f9('0xc'))(new Redis(config['redis']));require(_0xd8f9('0xd'))[_0xd8f9('0xe')](socket);function respondWithRpcPromise(_0x4957ae,_0x33c31e,_0x4ac0ea){return new BPromise(function(_0x5caee9,_0x421aca){return client[_0xd8f9('0xf')](_0x4957ae,_0x4ac0ea)[_0xd8f9('0x10')](function(_0x379359){logger[_0xd8f9('0x11')](_0xd8f9('0x12'),_0x33c31e,_0xd8f9('0x13'));logger['debug'](_0xd8f9('0x14'),_0x33c31e,'request\x20sent',JSON[_0xd8f9('0x15')](_0x379359));if(_0x379359[_0xd8f9('0x16')]){if(_0x379359[_0xd8f9('0x16')]['code']===0x1f4){logger[_0xd8f9('0x16')](_0xd8f9('0x12'),_0x33c31e,_0x379359[_0xd8f9('0x16')][_0xd8f9('0x17')]);return _0x421aca(_0x379359['error'][_0xd8f9('0x17')]);}logger[_0xd8f9('0x16')](_0xd8f9('0x12'),_0x33c31e,_0x379359[_0xd8f9('0x16')][_0xd8f9('0x17')]);return _0x5caee9(_0x379359[_0xd8f9('0x16')][_0xd8f9('0x17')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x33c31e,_0xd8f9('0x13'));_0x5caee9(_0x379359[_0xd8f9('0x18')]['message']);}})[_0xd8f9('0x19')](function(_0x47bdea){logger[_0xd8f9('0x16')]('MailAccount,\x20%s,\x20%s',_0x33c31e,_0x47bdea);_0x421aca(_0x47bdea);});});}exports['GetMailAccount']=function(_0x58956e){var _0xa3b0cd=this;return new Promise(function(_0x5d094d,_0x37a252){return db[_0xd8f9('0x1a')][_0xd8f9('0x1b')]({'raw':_0x58956e[_0xd8f9('0x1c')]?_0x58956e[_0xd8f9('0x1c')][_0xd8f9('0x1d')]===undefined?!![]:![]:!![],'where':_0x58956e['options']?_0x58956e[_0xd8f9('0x1c')][_0xd8f9('0x1e')]||null:null,'attributes':_0x58956e[_0xd8f9('0x1c')]?_0x58956e[_0xd8f9('0x1c')][_0xd8f9('0x1f')]||null:null,'limit':_0x58956e[_0xd8f9('0x1c')]?_0x58956e['options'][_0xd8f9('0x20')]||null:null,'include':_0x58956e[_0xd8f9('0x1c')]?_0x58956e[_0xd8f9('0x1c')][_0xd8f9('0x21')]?_[_0xd8f9('0x22')](_0x58956e['options'][_0xd8f9('0x21')],function(_0x1d6796){return{'model':db[_0x1d6796[_0xd8f9('0x23')]],'as':_0x1d6796['as'],'attributes':_0x1d6796[_0xd8f9('0x1f')],'include':_0x1d6796[_0xd8f9('0x21')]?_[_0xd8f9('0x22')](_0x1d6796[_0xd8f9('0x21')],function(_0x461880){return{'model':db[_0x461880['model']],'as':_0x461880['as'],'attributes':_0x461880[_0xd8f9('0x1f')],'include':_0x461880[_0xd8f9('0x21')]?_[_0xd8f9('0x22')](_0x461880['include'],function(_0x5bd32e){return{'model':db[_0x5bd32e['model']],'as':_0x5bd32e['as'],'attributes':_0x5bd32e[_0xd8f9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd8f9('0x10')](function(_0x5050a4){logger[_0xd8f9('0x11')](_0xd8f9('0x24'),_0x58956e);logger['debug'](_0xd8f9('0x24'),_0x58956e,JSON[_0xd8f9('0x15')](_0x5050a4));_0x5d094d(_0x5050a4);})[_0xd8f9('0x19')](function(_0x4caa27){logger[_0xd8f9('0x16')]('GetMailAccount',_0x4caa27[_0xd8f9('0x17')],_0x58956e);_0x37a252(_0xa3b0cd[_0xd8f9('0x16')](0x1f4,_0x4caa27['message']));});});};exports[_0xd8f9('0x25')]=function(_0x54b8c1){var _0x340f0a=this;return new Promise(function(_0x45f8bf,_0x26b7ff){return db[_0xd8f9('0x1a')][_0xd8f9('0x26')]({'raw':_0x54b8c1[_0xd8f9('0x1c')]?_0x54b8c1[_0xd8f9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x54b8c1[_0xd8f9('0x1c')]?_0x54b8c1['options']['where']||null:null,'attributes':_0x54b8c1['options']?_0x54b8c1['options'][_0xd8f9('0x1f')]||null:null,'include':_0x54b8c1[_0xd8f9('0x1c')]?_0x54b8c1[_0xd8f9('0x1c')][_0xd8f9('0x21')]?_[_0xd8f9('0x22')](_0x54b8c1['options']['include'],function(_0x1d5c7d){return{'model':db[_0x1d5c7d[_0xd8f9('0x23')]],'as':_0x1d5c7d['as'],'attributes':_0x1d5c7d['attributes'],'include':_0x1d5c7d[_0xd8f9('0x21')]?_[_0xd8f9('0x22')](_0x1d5c7d[_0xd8f9('0x21')],function(_0x5cd7a7){return{'model':db[_0x5cd7a7['model']],'as':_0x5cd7a7['as'],'attributes':_0x5cd7a7['attributes'],'include':_0x5cd7a7['include']?_[_0xd8f9('0x22')](_0x5cd7a7[_0xd8f9('0x21')],function(_0x324541){return{'model':db[_0x324541[_0xd8f9('0x23')]],'as':_0x324541['as'],'attributes':_0x324541[_0xd8f9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3333ea){if(_0x54b8c1[_0xd8f9('0x1c')][_0xd8f9('0x27')]===!![])_0x3333ea[_0xd8f9('0x28')](_0xd8f9('0x29'),_0x3333ea[_0xd8f9('0x2a')]());logger[_0xd8f9('0x11')](_0xd8f9('0x25'),_0x54b8c1);logger[_0xd8f9('0x2b')](_0xd8f9('0x25'),_0x54b8c1,JSON[_0xd8f9('0x15')](_0x3333ea));_0x45f8bf(_0x3333ea);})['catch'](function(_0x310836){logger[_0xd8f9('0x16')](_0xd8f9('0x25'),_0x310836[_0xd8f9('0x17')],_0x54b8c1);_0x26b7ff(_0x340f0a['error'](0x1f4,_0x310836[_0xd8f9('0x17')]));});});};exports[_0xd8f9('0x2c')]=function(_0x8d41c4){var _0x32159f=this;return new Promise(function(_0x1ab301,_0x23330a){var _0x597357={'body':_0x8d41c4['body'],'channel':'mail'};var _0x3c6643=_[_0xd8f9('0x2d')](_[_0xd8f9('0x2e')](db[_0xd8f9('0x2f')][_0xd8f9('0x30')]),[_0xd8f9('0x31'),_0xd8f9('0x32'),_0xd8f9('0x33'),_0xd8f9('0x34')]);var _0x5ed1b7=![];if(_0x8d41c4['body']['id']){delete _0x8d41c4[_0xd8f9('0x35')]['id'];}if(_[_0xd8f9('0x36')](_0x8d41c4[_0xd8f9('0x35')]['from'])){return _0x23330a(_0x32159f['error'](0x1f4,_0xd8f9('0x37')));}if(_[_0xd8f9('0x36')](_0x8d41c4[_0xd8f9('0x35')]['body'])||_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x35')]===''){return _0x23330a(_0x32159f[_0xd8f9('0x16')](0x1f4,_0xd8f9('0x38')));}if(_[_0xd8f9('0x36')](_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x39')])){return _0x23330a(_0x32159f[_0xd8f9('0x16')](0x1f4,_0xd8f9('0x3a')+_0x3c6643));}if(!_['includes'](_0x3c6643,_0x8d41c4['body']['mapKey'])){return _0x23330a(_0x32159f[_0xd8f9('0x16')](0x1f4,_0xd8f9('0x3b')+_0x3c6643));}var _0x2c2396={};_0x2c2396[_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x39')]]=_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x3c')];return db[_0xd8f9('0x1a')][_0xd8f9('0x26')]({'where':{'id':_0x8d41c4[_0xd8f9('0x3d')]['id']},'include':[{'model':db[_0xd8f9('0x3e')],'as':_0xd8f9('0x3f'),'include':[{'model':db[_0xd8f9('0x2f')],'as':'Contacts','where':_0x2c2396,'limit':0x1,'order':[[_0xd8f9('0x32'),_0xd8f9('0x40')]]}]},{'model':db[_0xd8f9('0x41')],'as':_0xd8f9('0x42')},{'model':db['MailServerOut'],'as':_0xd8f9('0x43'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0xd8f9('0x10')](function(_0x14e622){if(_0x14e622&&_0x14e622[_0xd8f9('0x3f')]){var _0x1361c4=_0x14e622[_0xd8f9('0x44')]({'plain':!![]});_0x597357[_0xd8f9('0x3d')]=_[_0xd8f9('0x45')](_0x1361c4,[_0xd8f9('0x42'),_0xd8f9('0x3f')]);_0x597357[_0xd8f9('0x3d')]['smtpOptions']=_0x14e622['getSmtpOptions']();_0x597357['applications']=_0x1361c4[_0xd8f9('0x42')];_0x597357[_0xd8f9('0x46')]=_0x1361c4['List'];_0x597357[_0xd8f9('0x47')]=_[_0xd8f9('0x48')](_0x597357[_0xd8f9('0x47')],[_0xd8f9('0x49')],[_0xd8f9('0x4a')]);if(_0x597357[_0xd8f9('0x3d')]&&_0x597357[_0xd8f9('0x3d')][_0xd8f9('0x4b')]){_0x597357['applications'][_0xd8f9('0x4c')]({'id':0x0,'priority':_0x597357[_0xd8f9('0x47')][_0xd8f9('0x4d')]+0x1,'app':_0xd8f9('0x4e'),'appdata':_0xd8f9('0x4b'),'interval':_0xd8f9('0x4f')});}if(_0x597357[_0xd8f9('0x3d')][_0xd8f9('0x42')]){delete _0x597357[_0xd8f9('0x3d')][_0xd8f9('0x42')];}if(_0x597357[_0xd8f9('0x3d')]['List']){delete _0x597357[_0xd8f9('0x3d')][_0xd8f9('0x3f')];}if(_0x1361c4[_0xd8f9('0x3f')][_0xd8f9('0x50')]['length']){return _0x1361c4[_0xd8f9('0x3f')][_0xd8f9('0x50')][0x0];}var _0x3ac9f6=_['defaults'](_0x8d41c4[_0xd8f9('0x35')],{'firstName':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x3c')],'ListId':_0x1361c4[_0xd8f9('0x34')]});_0x3ac9f6[_0x8d41c4['body'][_0xd8f9('0x39')]]=_0x8d41c4[_0xd8f9('0x35')]['from'];return db['CmContact'][_0xd8f9('0x51')](_0x3ac9f6);}else{throw new Error(_0xd8f9('0x52'));}})[_0xd8f9('0x10')](function(_0x5043f5){_0x597357[_0xd8f9('0x53')]=_0x5043f5;if(_0x5043f5){if(!_0x8d41c4['body'][_0xd8f9('0x17')]['messageId']){_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x54')]=rs[_0xd8f9('0x55')]()+'\x20'+_0x8d41c4['body'][_0xd8f9('0x17')][_0xd8f9('0x3c')];}var _0x10aa0a={'ContactId':_0x5043f5['id'],'MailAccountId':_0x8d41c4[_0xd8f9('0x3d')]['id'],'inReplyTo':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x54')],'to':_0x8d41c4[_0xd8f9('0x35')]['message'][_0xd8f9('0x3c')],'cc':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')]['cc'],'subject':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')]['subject'],'attach':_0x8d41c4['body']['message'][_0xd8f9('0x56')],'lastMsgAt':moment()[_0xd8f9('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd8f9('0x26')]({'where':{'closed':![],'MailAccountId':_0x8d41c4[_0xd8f9('0x3d')]['id']},'include':[{'model':db[_0xd8f9('0x58')],'as':_0xd8f9('0x59'),'attributes':[_0xd8f9('0x54')],'where':{'messageId':_0x8d41c4[_0xd8f9('0x35')]['message'][_0xd8f9('0x5a')]}}]})[_0xd8f9('0x10')](function(_0x15d4e5){if(_0x15d4e5){return[_0x15d4e5,![]];}return db[_0xd8f9('0x5b')]['create'](_0x10aa0a)[_0xd8f9('0x10')](function(_0x1e7251){return[_0x1e7251,!![]];});});}else{throw new Error(_0xd8f9('0x5c'));}})[_0xd8f9('0x5d')](function(_0xf900a3,_0x156c68){if(_0xf900a3){_0x5ed1b7=_0x156c68;if(!_0x156c68){return _0xf900a3[_0xd8f9('0x5e')]({'inReplyTo':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')]['messageId'],'to':_0x8d41c4['body']['message'][_0xd8f9('0x3c')],'cc':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')]['cc'],'subject':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x5f')],'attach':_0xf900a3[_0xd8f9('0x56')]?_0xf900a3[_0xd8f9('0x56')]:_0x8d41c4['body'][_0xd8f9('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0xd8f9('0x57')](_0xd8f9('0x60')),'lastMsgAt':moment()[_0xd8f9('0x57')](_0xd8f9('0x60')),'lastMsgDirection':'in'});}else{return _0xf900a3;}}})[_0xd8f9('0x10')](function(_0x19b6c0){_0x597357[_0xd8f9('0x61')]=_0x19b6c0[_0xd8f9('0x44')]({'plain':!![]});_0x597357['interaction'][_0xd8f9('0x62')]=_0x5ed1b7;return db['MailMessage'][_0xd8f9('0x51')]({'body':_0x8d41c4['body']['body'],'MailAccountId':_0x8d41c4[_0xd8f9('0x3d')]['id'],'MailInteractionId':_0x19b6c0['id'],'direction':'in','ContactId':_0x597357['contact']['id'],'messageId':_0x8d41c4['body'][_0xd8f9('0x17')][_0xd8f9('0x54')],'from':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x3c')],'to':_0x8d41c4['body'][_0xd8f9('0x17')]['to'],'cc':_0x8d41c4[_0xd8f9('0x35')]['message']['cc'],'subject':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x5f')],'attach':_0x8d41c4[_0xd8f9('0x35')]['message'][_0xd8f9('0x56')],'Attachments':_0x8d41c4['body'][_0xd8f9('0x17')][_0xd8f9('0x63')],'originTo':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x64')],'originCc':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x65')],'bcc':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x66')],'ChatWebsiteId':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x67')]||null,'originChannel':_0x8d41c4[_0xd8f9('0x35')][_0xd8f9('0x17')][_0xd8f9('0x68')]||_0xd8f9('0x69'),'ChatOfflineMessageId':_0x8d41c4['body'][_0xd8f9('0x17')][_0xd8f9('0x6a')]||null},{'include':[{'model':db['Attachment'],'as':_0xd8f9('0x6b')}]});})[_0xd8f9('0x10')](function(_0x3a3e83){_0x597357[_0xd8f9('0x17')]=_0x3a3e83;if(!_0x597357[_0xd8f9('0x61')]['UserId']){return;}return db[_0xd8f9('0x6c')]['find']({'attributes':['id',_0xd8f9('0x6d')],'where':{'id':_0x597357['interaction'][_0xd8f9('0x6e')]}});})[_0xd8f9('0x10')](function(_0x556bb2){if(_0x556bb2){_0x597357[_0xd8f9('0x47')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x556bb2[_0xd8f9('0x6d')]+','+(_0x597357['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd8f9('0x4f')});}if(!_0x597357['interaction'][_0xd8f9('0x6f')]){return;}return db['MailQueue'][_0xd8f9('0x26')]({'attributes':['id',_0xd8f9('0x6d')],'where':{'id':_0x597357['interaction'][_0xd8f9('0x6f')]}});})[_0xd8f9('0x10')](function(_0x3754bd){if(_0x3754bd){_0x597357[_0xd8f9('0x47')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd8f9('0x70'),'appdata':_0x3754bd[_0xd8f9('0x6d')]+','+(_0x597357[_0xd8f9('0x3d')][_0xd8f9('0x71')]||0x12c),'interval':_0xd8f9('0x4f')});}return respondWithRpcPromise(_0xd8f9('0x72'),_0xd8f9('0x73'),_0x597357);})[_0xd8f9('0x10')](function(_0x56e4b0){_0x1ab301(_0x56e4b0);})[_0xd8f9('0x19')](function(_0x3c0966){_0x23330a(_0x32159f['error'](0x1f4,_0x3c0966['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1b9d7fc..41dbbe3 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 _0x0135=['./mailAccount.events','save','remove','update','emit','register','mailAccount:'];(function(_0x566909,_0x5af4c6){var _0x104652=function(_0x51df5b){while(--_0x51df5b){_0x566909['push'](_0x566909['shift']());}};_0x104652(++_0x5af4c6);}(_0x0135,0x188));var _0x5013=function(_0x283093,_0x103dc4){_0x283093=_0x283093-0x0;var _0x37d60c=_0x0135[_0x283093];return _0x37d60c;};'use strict';var MailAccountEvents=require(_0x5013('0x0'));var events=[_0x5013('0x1'),_0x5013('0x2'),_0x5013('0x3')];function createListener(_0x5d17da,_0x535319){return function(_0x51204c){_0x535319[_0x5013('0x4')](_0x5d17da,_0x51204c);};}function removeListener(_0x4e3d33,_0x23ff8b){return function(){MailAccountEvents['removeListener'](_0x4e3d33,_0x23ff8b);};}exports[_0x5013('0x5')]=function(_0x18e91b){for(var _0x5046c8=0x0,_0x524c20=events['length'];_0x5046c8<_0x524c20;_0x5046c8++){var _0x4a75fd=events[_0x5046c8];var _0x45c147=createListener(_0x5013('0x6')+_0x4a75fd,_0x18e91b);MailAccountEvents['on'](_0x4a75fd,_0x45c147);}}; \ No newline at end of file +var _0x71d3=['mailAccount:','./mailAccount.events','save','remove','emit','removeListener'];(function(_0x31dc0b,_0x1f115a){var _0x20aa62=function(_0x345083){while(--_0x345083){_0x31dc0b['push'](_0x31dc0b['shift']());}};_0x20aa62(++_0x1f115a);}(_0x71d3,0x67));var _0x371d=function(_0x1eedcb,_0x274b0d){_0x1eedcb=_0x1eedcb-0x0;var _0x20d50a=_0x71d3[_0x1eedcb];return _0x20d50a;};'use strict';var MailAccountEvents=require(_0x371d('0x0'));var events=[_0x371d('0x1'),_0x371d('0x2'),'update'];function createListener(_0x41bda5,_0xd66cd6){return function(_0x238a27){_0xd66cd6[_0x371d('0x3')](_0x41bda5,_0x238a27);};}function removeListener(_0x1c5cd4,_0x3db8e7){return function(){MailAccountEvents[_0x371d('0x4')](_0x1c5cd4,_0x3db8e7);};}exports['register']=function(_0x1c3cb7){for(var _0x26ce75=0x0,_0x578e1d=events['length'];_0x26ce75<_0x578e1d;_0x26ce75++){var _0x18140f=events[_0x26ce75];var _0x1709e6=createListener(_0x371d('0x5')+_0x18140f,_0x1c3cb7);MailAccountEvents['on'](_0x18140f,_0x1709e6);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 729867d..1741d03 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 _0x3024=['../../config/environment','get','/:id','isAuthenticated','show','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc1e28d,_0x3b1460){var _0x25fdf9=function(_0x9fdee5){while(--_0x9fdee5){_0xc1e28d['push'](_0xc1e28d['shift']());}};_0x25fdf9(++_0x3b1460);}(_0x3024,0x180));var _0x4302=function(_0x43b141,_0x14e681){_0x43b141=_0x43b141-0x0;var _0x1f0d6a=_0x3024[_0x43b141];return _0x1f0d6a;};'use strict';var multer=require(_0x4302('0x0'));var util=require('util');var path=require(_0x4302('0x1'));var timeout=require('connect-timeout');var express=require(_0x4302('0x2'));var router=express[_0x4302('0x3')]();var fs_extra=require(_0x4302('0x4'));var auth=require(_0x4302('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4302('0x6'));var controller=require('./mailApplication.controller');router[_0x4302('0x7')](_0x4302('0x8'),auth[_0x4302('0x9')](),controller[_0x4302('0xa')]);router['put'](_0x4302('0x8'),auth[_0x4302('0x9')](),controller[_0x4302('0xb')]);router['delete'](_0x4302('0x8'),auth[_0x4302('0x9')](),controller['destroy']);module[_0x4302('0xc')]=router; \ No newline at end of file +var _0x6885=['get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller'];(function(_0x47f1cb,_0x446c91){var _0x2e1104=function(_0x36ffe5){while(--_0x36ffe5){_0x47f1cb['push'](_0x47f1cb['shift']());}};_0x2e1104(++_0x446c91);}(_0x6885,0xe5));var _0x5688=function(_0x47888a,_0x4be666){_0x47888a=_0x47888a-0x0;var _0x582527=_0x6885[_0x47888a];return _0x582527;};'use strict';var multer=require(_0x5688('0x0'));var util=require(_0x5688('0x1'));var path=require(_0x5688('0x2'));var timeout=require(_0x5688('0x3'));var express=require('express');var router=express[_0x5688('0x4')]();var fs_extra=require(_0x5688('0x5'));var auth=require(_0x5688('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5688('0x7'));var controller=require(_0x5688('0x8'));router[_0x5688('0x9')](_0x5688('0xa'),auth[_0x5688('0xb')](),controller[_0x5688('0xc')]);router[_0x5688('0xd')](_0x5688('0xa'),auth[_0x5688('0xb')](),controller['update']);router[_0x5688('0xe')](_0x5688('0xa'),auth['isAuthenticated'](),controller[_0x5688('0xf')]);module[_0x5688('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 026650d..9197855 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 _0xe583=['STRING','*,*,*,*','sequelize','exports','noop','TEXT'];(function(_0x1dbc55,_0x2e0bb0){var _0x498980=function(_0x26a1d0){while(--_0x26a1d0){_0x1dbc55['push'](_0x1dbc55['shift']());}};_0x498980(++_0x2e0bb0);}(_0xe583,0x194));var _0x3e58=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe583[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0x3e58('0x0'));module[_0x3e58('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3e58('0x2')},'appdata':{'type':Sequelize[_0x3e58('0x3')]()},'description':{'type':Sequelize[_0x3e58('0x4')]},'interval':{'type':Sequelize[_0x3e58('0x4')],'defaultValue':_0x3e58('0x5')}}; \ No newline at end of file +var _0xad07=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x513cc6,_0x4d08ab){var _0x3d4d11=function(_0x3df65a){while(--_0x3df65a){_0x513cc6['push'](_0x513cc6['shift']());}};_0x3d4d11(++_0x4d08ab);}(_0xad07,0x157));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7ad0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7ad0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7ad0('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7ad0('0x3')]()},'description':{'type':Sequelize[_0x7ad0('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7ad0('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 79be95d..aec7a87 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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x9bde,0xe1));var _0xe9bd=function(_0x23266c,_0x45bfd9){_0x23266c=_0x23266c-0x0;var _0x5a0da5=_0x9bde[_0x23266c];return _0x5a0da5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x337216,_0x4184e2){_0x337216=_0x337216-0x0;var _0x113fdb=_0xbdb7[_0x337216];return _0x113fdb;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8f873da..862df25 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 _0x853d=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x853d,0xa9));var _0xd853=function(_0x580027,_0x5fa2dd){_0x580027=_0x580027-0x0;var _0x2f4af0=_0x853d[_0x580027];return _0x2f4af0;};'use strict';var _=require(_0xd853('0x0'));var util=require('util');var logger=require(_0xd853('0x1'))(_0xd853('0x2'));var moment=require('moment');var BPromise=require(_0xd853('0x3'));var rp=require(_0xd853('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd853('0x5'));var attributes=require(_0xd853('0x6'));module['exports']=function(_0x47ccbb,_0x2b7d61){return _0x47ccbb[_0xd853('0x7')](_0xd853('0x8'),attributes,{'tableName':_0xd853('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd853('0xa'),'collate':_0xd853('0xb')});}; \ No newline at end of file +var _0xe218=['mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication'];(function(_0x22a826,_0x10035a){var _0x393488=function(_0x1287df){while(--_0x1287df){_0x22a826['push'](_0x22a826['shift']());}};_0x393488(++_0x10035a);}(_0xe218,0x120));var _0x8e21=function(_0x39a86d,_0x10287a){_0x39a86d=_0x39a86d-0x0;var _0x960fdf=_0xe218[_0x39a86d];return _0x960fdf;};'use strict';var _=require('lodash');var util=require(_0x8e21('0x0'));var logger=require(_0x8e21('0x1'))(_0x8e21('0x2'));var moment=require(_0x8e21('0x3'));var BPromise=require(_0x8e21('0x4'));var rp=require(_0x8e21('0x5'));var fs=require('fs');var path=require(_0x8e21('0x6'));var rimraf=require('rimraf');var config=require(_0x8e21('0x7'));var attributes=require(_0x8e21('0x8'));module[_0x8e21('0x9')]=function(_0x572363,_0xc035d9){return _0x572363[_0x8e21('0xa')](_0x8e21('0xb'),attributes,{'tableName':_0x8e21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e21('0xd'),'collate':_0x8e21('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index dfaa261..280be45 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 _0x6e15=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','MailApplication','body','options','raw','where','attributes','limit','UpdateMailApplication','stringify','catch','lodash','util','bluebird','ioredis'];(function(_0x592cd8,_0x515308){var _0x46959d=function(_0x584132){while(--_0x584132){_0x592cd8['push'](_0x592cd8['shift']());}};_0x46959d(++_0x515308);}(_0x6e15,0xf8));var _0x56e1=function(_0x297a9a,_0x3f317b){_0x297a9a=_0x297a9a-0x0;var _0x20e58e=_0x6e15[_0x297a9a];return _0x20e58e;};'use strict';var _=require(_0x56e1('0x0'));var util=require(_0x56e1('0x1'));var moment=require('moment');var BPromise=require(_0x56e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56e1('0x3'));var db=require(_0x56e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x56e1('0x5'))(_0x56e1('0x6'));var config=require(_0x56e1('0x7'));var jayson=require(_0x56e1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5398e4,_0xfdd1ee,_0x1a5443){return new BPromise(function(_0x547965,_0x2f9afa){return client['request'](_0x5398e4,_0x1a5443)[_0x56e1('0x9')](function(_0x4244a9){logger[_0x56e1('0xa')](_0x56e1('0xb'),_0xfdd1ee,'request\x20sent');logger[_0x56e1('0xc')]('MailApplication,\x20%s,\x20%s,\x20%s',_0xfdd1ee,_0x56e1('0xd'),JSON['stringify'](_0x4244a9));if(_0x4244a9[_0x56e1('0xe')]){if(_0x4244a9[_0x56e1('0xe')][_0x56e1('0xf')]===0x1f4){logger['error'](_0x56e1('0xb'),_0xfdd1ee,_0x4244a9[_0x56e1('0xe')]['message']);return _0x2f9afa(_0x4244a9[_0x56e1('0xe')][_0x56e1('0x10')]);}logger[_0x56e1('0xe')](_0x56e1('0xb'),_0xfdd1ee,_0x4244a9[_0x56e1('0xe')][_0x56e1('0x10')]);return _0x547965(_0x4244a9[_0x56e1('0xe')]['message']);}else{logger[_0x56e1('0xa')]('MailApplication,\x20%s,\x20%s',_0xfdd1ee,'request\x20sent');_0x547965(_0x4244a9[_0x56e1('0x11')][_0x56e1('0x10')]);}})['catch'](function(_0x1a8c8f){logger['error']('MailApplication,\x20%s,\x20%s',_0xfdd1ee,_0x1a8c8f);_0x2f9afa(_0x1a8c8f);});});}exports['UpdateMailApplication']=function(_0x52dc76){var _0x423509=this;return new Promise(function(_0x2307d7,_0x3f8543){return db[_0x56e1('0x12')]['update'](_0x52dc76[_0x56e1('0x13')],{'raw':_0x52dc76[_0x56e1('0x14')]?_0x52dc76[_0x56e1('0x14')][_0x56e1('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52dc76[_0x56e1('0x14')]?_0x52dc76[_0x56e1('0x14')][_0x56e1('0x16')]||null:null,'attributes':_0x52dc76[_0x56e1('0x14')]?_0x52dc76[_0x56e1('0x14')][_0x56e1('0x17')]||null:null,'limit':_0x52dc76[_0x56e1('0x14')]?_0x52dc76[_0x56e1('0x14')][_0x56e1('0x18')]||null:null})['then'](function(_0x2117e3){logger[_0x56e1('0xa')](_0x56e1('0x19'),_0x52dc76);logger[_0x56e1('0xc')](_0x56e1('0x19'),_0x52dc76,JSON[_0x56e1('0x1a')](_0x2117e3));_0x2307d7(_0x2117e3);})[_0x56e1('0x1b')](function(_0x44ba40){logger['error'](_0x56e1('0x19'),_0x44ba40[_0x56e1('0x10')],_0x52dc76);_0x3f8543(_0x423509[_0x56e1('0xe')](0x1f4,_0x44ba40['message']));});});}; \ No newline at end of file +var _0x58b9=['raw','attributes','limit','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','update','options'];(function(_0x5e072d,_0x505cfc){var _0x3bbfb4=function(_0x1c1fe5){while(--_0x1c1fe5){_0x5e072d['push'](_0x5e072d['shift']());}};_0x3bbfb4(++_0x505cfc);}(_0x58b9,0x18a));var _0x958b=function(_0xb1125a,_0x4b5ecd){_0xb1125a=_0xb1125a-0x0;var _0x11a717=_0x58b9[_0xb1125a];return _0x11a717;};'use strict';var _=require(_0x958b('0x0'));var util=require(_0x958b('0x1'));var moment=require(_0x958b('0x2'));var BPromise=require(_0x958b('0x3'));var rs=require(_0x958b('0x4'));var fs=require('fs');var Redis=require(_0x958b('0x5'));var db=require(_0x958b('0x6'))['db'];var utils=require(_0x958b('0x7'));var logger=require(_0x958b('0x8'))(_0x958b('0x9'));var config=require(_0x958b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x958b('0xb')][_0x958b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48c28c,_0x2f5b5e,_0x4a912a){return new BPromise(function(_0x194e36,_0x15d09f){return client['request'](_0x48c28c,_0x4a912a)[_0x958b('0xd')](function(_0x4c76df){logger['info']('MailApplication,\x20%s,\x20%s',_0x2f5b5e,'request\x20sent');logger['debug'](_0x958b('0xe'),_0x2f5b5e,_0x958b('0xf'),JSON[_0x958b('0x10')](_0x4c76df));if(_0x4c76df['error']){if(_0x4c76df[_0x958b('0x11')][_0x958b('0x12')]===0x1f4){logger[_0x958b('0x11')](_0x958b('0x13'),_0x2f5b5e,_0x4c76df[_0x958b('0x11')][_0x958b('0x14')]);return _0x15d09f(_0x4c76df[_0x958b('0x11')][_0x958b('0x14')]);}logger[_0x958b('0x11')](_0x958b('0x13'),_0x2f5b5e,_0x4c76df[_0x958b('0x11')][_0x958b('0x14')]);return _0x194e36(_0x4c76df[_0x958b('0x11')][_0x958b('0x14')]);}else{logger['info'](_0x958b('0x13'),_0x2f5b5e,'request\x20sent');_0x194e36(_0x4c76df['result']['message']);}})[_0x958b('0x15')](function(_0x2a0c25){logger[_0x958b('0x11')](_0x958b('0x13'),_0x2f5b5e,_0x2a0c25);_0x15d09f(_0x2a0c25);});});}exports[_0x958b('0x16')]=function(_0xe06d39){var _0x21a661=this;return new Promise(function(_0x4274c4,_0x31a7e9){return db[_0x958b('0x17')][_0x958b('0x18')](_0xe06d39['body'],{'raw':_0xe06d39[_0x958b('0x19')]?_0xe06d39[_0x958b('0x19')][_0x958b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe06d39[_0x958b('0x19')]?_0xe06d39[_0x958b('0x19')]['where']||null:null,'attributes':_0xe06d39[_0x958b('0x19')]?_0xe06d39['options'][_0x958b('0x1b')]||null:null,'limit':_0xe06d39[_0x958b('0x19')]?_0xe06d39[_0x958b('0x19')][_0x958b('0x1c')]||null:null})[_0x958b('0xd')](function(_0x7a24a9){logger[_0x958b('0x1d')](_0x958b('0x16'),_0xe06d39);logger['debug'](_0x958b('0x16'),_0xe06d39,JSON[_0x958b('0x10')](_0x7a24a9));_0x4274c4(_0x7a24a9);})['catch'](function(_0x280b68){logger[_0x958b('0x11')](_0x958b('0x16'),_0x280b68[_0x958b('0x14')],_0xe06d39);_0x31a7e9(_0x21a661[_0x958b('0x11')](0x1f4,_0x280b68[_0x958b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1fc0dfc..1eb36e7 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 _0xc794=['/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','/:id/download','download','create','tracked','mailinteraction:addtags','put','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x16d045,_0x24faf3){var _0x5649cd=function(_0x3d2c01){while(--_0x3d2c01){_0x16d045['push'](_0x16d045['shift']());}};_0x5649cd(++_0x24faf3);}(_0xc794,0x10f));var _0x4c79=function(_0x48db69,_0x455a6a){_0x48db69=_0x48db69-0x0;var _0x3e1c3d=_0xc794[_0x48db69];return _0x3e1c3d;};'use strict';var express=require('express');var router=express[_0x4c79('0x0')]();var auth=require(_0x4c79('0x1'));var interaction=require(_0x4c79('0x2'));var controller=require('./mailInteraction.controller');router[_0x4c79('0x3')]('/',auth['isAuthenticated'](),controller[_0x4c79('0x4')]);router[_0x4c79('0x3')](_0x4c79('0x5'),auth['isAuthenticated'](),controller[_0x4c79('0x6')]);router[_0x4c79('0x3')](_0x4c79('0x7'),auth[_0x4c79('0x8')](),controller['show']);router['get'](_0x4c79('0x9'),auth[_0x4c79('0x8')](),controller[_0x4c79('0xa')]);router['get'](_0x4c79('0xb'),auth['isAuthenticated'](),controller[_0x4c79('0xc')]);router['post']('/',auth[_0x4c79('0x8')](),controller[_0x4c79('0xd')]);router['post'](_0x4c79('0x9'),auth[_0x4c79('0x8')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x4c79('0x8')](),interaction[_0x4c79('0xe')]('mail',_0x4c79('0xf')),controller['addTags']);router[_0x4c79('0x10')]('/:id',auth['isAuthenticated'](),interaction[_0x4c79('0xe')](_0x4c79('0x11'),_0x4c79('0x12')),controller['update']);router[_0x4c79('0x13')](_0x4c79('0x7'),auth[_0x4c79('0x8')](),interaction[_0x4c79('0xe')](_0x4c79('0x11'),_0x4c79('0x14')),controller[_0x4c79('0x15')]);router['delete']('/:id/tags',auth[_0x4c79('0x8')](),controller[_0x4c79('0x16')]);module['exports']=router; \ No newline at end of file +var _0xc4d0=['removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','show','getMessages','post','create','/:id/messages','addMessage','tracked','mail','addTags','put','update','delete','mailinteraction:destroy','destroy','/:id/tags'];(function(_0x53273a,_0x5ed978){var _0x3c41db=function(_0x491a57){while(--_0x491a57){_0x53273a['push'](_0x53273a['shift']());}};_0x3c41db(++_0x5ed978);}(_0xc4d0,0x84));var _0x0c4d=function(_0x302b5e,_0x564a8e){_0x302b5e=_0x302b5e-0x0;var _0x523ab7=_0xc4d0[_0x302b5e];return _0x523ab7;};'use strict';var express=require(_0x0c4d('0x0'));var router=express[_0x0c4d('0x1')]();var auth=require(_0x0c4d('0x2'));var interaction=require(_0x0c4d('0x3'));var controller=require(_0x0c4d('0x4'));router[_0x0c4d('0x5')]('/',auth[_0x0c4d('0x6')](),controller['index']);router[_0x0c4d('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x0c4d('0x7')]);router[_0x0c4d('0x5')](_0x0c4d('0x8'),auth[_0x0c4d('0x6')](),controller[_0x0c4d('0x9')]);router[_0x0c4d('0x5')]('/:id/messages',auth[_0x0c4d('0x6')](),controller[_0x0c4d('0xa')]);router['get']('/:id/download',auth[_0x0c4d('0x6')](),controller['download']);router[_0x0c4d('0xb')]('/',auth['isAuthenticated'](),controller[_0x0c4d('0xc')]);router[_0x0c4d('0xb')](_0x0c4d('0xd'),auth[_0x0c4d('0x6')](),controller[_0x0c4d('0xe')]);router[_0x0c4d('0xb')]('/:id/tags',auth[_0x0c4d('0x6')](),interaction[_0x0c4d('0xf')](_0x0c4d('0x10'),'mailinteraction:addtags'),controller[_0x0c4d('0x11')]);router[_0x0c4d('0x12')](_0x0c4d('0x8'),auth[_0x0c4d('0x6')](),interaction[_0x0c4d('0xf')](_0x0c4d('0x10'),'mailinteraction:update'),controller[_0x0c4d('0x13')]);router[_0x0c4d('0x14')](_0x0c4d('0x8'),auth[_0x0c4d('0x6')](),interaction[_0x0c4d('0xf')](_0x0c4d('0x10'),_0x0c4d('0x15')),controller[_0x0c4d('0x16')]);router[_0x0c4d('0x14')](_0x0c4d('0x17'),auth[_0x0c4d('0x6')](),controller[_0x0c4d('0x18')]);module[_0x0c4d('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 27cc0b0..2600392 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 _0x7071=['TEXT','BOOLEAN','DATE','ENUM','out','INTEGER','iconv','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7071,0xcc));var _0x1707=function(_0x348ff2,_0x5e0e1d){_0x348ff2=_0x348ff2-0x0;var _0x454cee=_0x7071[_0x348ff2];return _0x454cee;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x1707('0x0'));module[_0x1707('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1707('0x2')]},'secondDisposition':{'type':Sequelize[_0x1707('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1707('0x2')]},'note':{'type':Sequelize[_0x1707('0x2')]},'inReplyTo':{'type':Sequelize[_0x1707('0x2')](0x1fe)},'to':{'type':Sequelize[_0x1707('0x2')]},'cc':{'type':Sequelize[_0x1707('0x3')]('long')},'subject':{'type':Sequelize[_0x1707('0x3')]()},'attach':{'type':Sequelize[_0x1707('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1707('0x5')]},'substatus':{'type':Sequelize[_0x1707('0x2')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1707('0x6')]('in',_0x1707('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1707('0x6')]('in',_0x1707('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1707('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1707('0x8')]}}; \ No newline at end of file +var _0x9a07=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','INTEGER'];(function(_0x2486b9,_0x5d871d){var _0x19e5c6=function(_0x26f882){while(--_0x26f882){_0x2486b9['push'](_0x2486b9['shift']());}};_0x19e5c6(++_0x5d871d);}(_0x9a07,0x138));var _0x79a0=function(_0x2e4a8d,_0x134539){_0x2e4a8d=_0x2e4a8d-0x0;var _0x5dad03=_0x9a07[_0x2e4a8d];return _0x5dad03;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x79a0('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x79a0('0x1')]},'disposition':{'type':Sequelize[_0x79a0('0x2')]},'secondDisposition':{'type':Sequelize[_0x79a0('0x2')]},'thirdDisposition':{'type':Sequelize[_0x79a0('0x2')]},'note':{'type':Sequelize[_0x79a0('0x2')]},'inReplyTo':{'type':Sequelize[_0x79a0('0x2')](0x1fe)},'to':{'type':Sequelize[_0x79a0('0x2')]},'cc':{'type':Sequelize[_0x79a0('0x3')](_0x79a0('0x4'))},'subject':{'type':Sequelize[_0x79a0('0x3')]()},'attach':{'type':Sequelize[_0x79a0('0x0')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x79a0('0x1')]},'substatus':{'type':Sequelize[_0x79a0('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x79a0('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x79a0('0x5')]('in',_0x79a0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x79a0('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x79a0('0x5')]('in',_0x79a0('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x79a0('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x79a0('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 1afbf1f..947dbff 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 _0x31c5=['ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','findAll','query','user','catch','show','params','model','keys','intersection','attributes','fields','merge','find','create','body','update','describe','addMessage','MailMessage','ids','omit','getMessages','length','hasOwnProperty','sort','where','filters','pick','MailInteractionId','filter','map','$gte','split','format','includeAll','include','inlineCss','rows','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x31c5,0x7b));var _0x531c=function(_0x1baa57,_0x1d28da){_0x1baa57=_0x1baa57-0x0;var _0x2bba51=_0x31c5[_0x1baa57];return _0x2bba51;};'use strict';var emlformat=require(_0x531c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x531c('0x1'));var moment=require(_0x531c('0x2'));var BPromise=require(_0x531c('0x3'));var util=require('util');var path=require(_0x531c('0x4'));var fs=require('fs');var _=require('lodash');var juice=require(_0x531c('0x5'));var Redis=require(_0x531c('0x6'));var interaction=require(_0x531c('0x7'));var qs=require(_0x531c('0x8'));var logger=require(_0x531c('0x9'))(_0x531c('0xa'));var config=require('../../config/environment');var db=require(_0x531c('0xb'))['db'];var htmlEntities=require(_0x531c('0xc'));config[_0x531c('0xd')]=_[_0x531c('0xe')](config[_0x531c('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x531c('0xd')]));require(_0x531c('0xf'))[_0x531c('0x10')](socket);function respondWithStatusCode(_0x31d779,_0x33d3b0){_0x33d3b0=_0x33d3b0||0xcc;return function(_0xc4e9c3){if(_0xc4e9c3){return _0x31d779['sendStatus'](_0x33d3b0);}return _0x31d779[_0x531c('0x11')](_0x33d3b0)['end']();};}function respondWithResult(_0x38abf2,_0x4ef1c6){_0x4ef1c6=_0x4ef1c6||0xc8;return function(_0x13d034){if(_0x13d034){return _0x38abf2[_0x531c('0x11')](_0x4ef1c6)[_0x531c('0x12')](_0x13d034);}};}function respondWithFilteredResult(_0x388aed,_0x1047fa){return function(_0x17027d){if(_0x17027d){var _0x5cd22f=typeof _0x1047fa[_0x531c('0x13')]===_0x531c('0x14')&&typeof _0x1047fa[_0x531c('0x15')]===_0x531c('0x14');var _0x58fb98=_0x17027d[_0x531c('0x16')];var _0x1b1ab3=_0x5cd22f?0x0:_0x1047fa[_0x531c('0x13')];var _0x4bdbe3=_0x5cd22f?_0x17027d[_0x531c('0x16')]:_0x1047fa[_0x531c('0x13')]+_0x1047fa['limit'];var _0x5e23ca;if(_0x4bdbe3>=_0x58fb98){_0x4bdbe3=_0x58fb98;_0x5e23ca=0xc8;}else{_0x5e23ca=0xce;}_0x388aed[_0x531c('0x11')](_0x5e23ca);return _0x388aed[_0x531c('0x17')](_0x531c('0x18'),_0x1b1ab3+'-'+_0x4bdbe3+'/'+_0x58fb98)[_0x531c('0x12')](_0x17027d);}return null;};}function saveUpdates(_0x465cde){return function(_0x517ffe){if(_0x517ffe){return _0x517ffe['update'](_0x465cde)[_0x531c('0x19')](function(_0x93a271){return _0x93a271;});}return null;};}function removeEntity(_0x453606){return function(_0x2727d0){if(_0x2727d0){return _0x2727d0[_0x531c('0x1a')]()[_0x531c('0x19')](function(){_0x453606[_0x531c('0x11')](0xcc)[_0x531c('0x1b')]();});}};}function handleEntityNotFound(_0x3879fa){return function(_0x11f5fb){if(!_0x11f5fb){_0x3879fa[_0x531c('0x1c')](0x194);}return _0x11f5fb;};}function handleError(_0x250ebf,_0x617ca2){_0x617ca2=_0x617ca2||0x1f4;return function(_0x353da8){logger['error'](_0x353da8[_0x531c('0x1d')]);if(_0x353da8[_0x531c('0x1e')]){delete _0x353da8[_0x531c('0x1e')];}_0x250ebf[_0x531c('0x11')](_0x617ca2)[_0x531c('0x1f')](_0x353da8);};}exports[_0x531c('0x20')]=function(_0x5a2f93,_0x1164d0){var _0x38aaf6={};var _0x634212=_['map'](db[_0x531c('0x21')][_0x531c('0x22')],function(_0x357e42){return{'name':_0x357e42[_0x531c('0x23')],'type':_0x357e42[_0x531c('0x24')][_0x531c('0x25')]};});_0x38aaf6=qs['getOptions'](_0x634212,_0x5a2f93);return interaction[_0x531c('0x26')]('mail',_0x5a2f93[_0x531c('0x27')],_0x5a2f93[_0x531c('0x28')],_0x38aaf6,_0x634212)[_0x531c('0x19')](respondWithFilteredResult(_0x1164d0,_0x38aaf6))[_0x531c('0x29')](handleError(_0x1164d0,null));};exports[_0x531c('0x2a')]=function(_0x4eb811,_0x2b92c7){var _0x430d7a={'raw':![],'where':{'id':_0x4eb811[_0x531c('0x2b')]['id']}},_0xa31b1b={};_0xa31b1b[_0x531c('0x2c')]=_['keys'](db[_0x531c('0x21')][_0x531c('0x22')]);_0xa31b1b[_0x531c('0x27')]=_[_0x531c('0x2d')](_0x4eb811[_0x531c('0x27')]);_0xa31b1b['filters']=_[_0x531c('0x2e')](_0xa31b1b[_0x531c('0x2c')],_0xa31b1b['query']);_0x430d7a[_0x531c('0x2f')]=_['intersection'](_0xa31b1b['model'],qs[_0x531c('0x30')](_0x4eb811[_0x531c('0x27')]['fields']));_0x430d7a[_0x531c('0x2f')]=_0x430d7a['attributes']['length']?_0x430d7a['attributes']:_0xa31b1b[_0x531c('0x2c')];if(_0x4eb811['query']['includeAll']){_0x430d7a['include']=[{'all':!![]}];}_0x430d7a=_[_0x531c('0x31')]({},_0x430d7a,_0x4eb811['options']);return db[_0x531c('0x21')][_0x531c('0x32')](_0x430d7a)['then'](handleEntityNotFound(_0x2b92c7,null))[_0x531c('0x19')](respondWithResult(_0x2b92c7,null))['catch'](handleError(_0x2b92c7,null));};exports['create']=function(_0x342663,_0x38b7dd){return db['MailInteraction'][_0x531c('0x33')](_0x342663[_0x531c('0x34')],{})[_0x531c('0x19')](respondWithResult(_0x38b7dd,0xc9))[_0x531c('0x29')](handleError(_0x38b7dd,null));};exports[_0x531c('0x35')]=function(_0x19ef97,_0x312c44){if(_0x19ef97[_0x531c('0x34')]['id']){delete _0x19ef97[_0x531c('0x34')]['id'];}return db['MailInteraction'][_0x531c('0x32')]({'where':{'id':_0x19ef97[_0x531c('0x2b')]['id']}})[_0x531c('0x19')](handleEntityNotFound(_0x312c44,null))[_0x531c('0x19')](saveUpdates(_0x19ef97[_0x531c('0x34')],null))[_0x531c('0x19')](respondWithResult(_0x312c44,null))[_0x531c('0x29')](handleError(_0x312c44,null));};exports['destroy']=function(_0x2d76cf,_0x2eed95){return db['MailInteraction'][_0x531c('0x32')]({'where':{'id':_0x2d76cf['params']['id']}})[_0x531c('0x19')](handleEntityNotFound(_0x2eed95,null))[_0x531c('0x19')](removeEntity(_0x2eed95,null))[_0x531c('0x29')](handleError(_0x2eed95,null));};exports[_0x531c('0x36')]=function(_0x4f0e06,_0x2d844a){return db[_0x531c('0x21')][_0x531c('0x36')]()['then'](respondWithResult(_0x2d844a,null))[_0x531c('0x29')](handleError(_0x2d844a,null));};exports[_0x531c('0x37')]=function(_0x1d5b6b,_0xcd5442){return db[_0x531c('0x38')][_0x531c('0x32')]({'where':{'id':_0x1d5b6b[_0x531c('0x2b')]['id']}})[_0x531c('0x19')](handleEntityNotFound(_0xcd5442,null))[_0x531c('0x19')](function(_0x8c6efd){if(_0x8c6efd){return _0x8c6efd[_0x531c('0x37')](_0x1d5b6b['body'][_0x531c('0x39')],_[_0x531c('0x3a')](_0x1d5b6b['body'],[_0x531c('0x39'),'id'])||{});}})['then'](respondWithResult(_0xcd5442,null))[_0x531c('0x29')](handleError(_0xcd5442,null));};exports[_0x531c('0x3b')]=function(_0x4c64e8,_0xe69e5f){var _0x1c4bd8={'raw':![],'where':{}};var _0x57b4ab={};var _0x377291={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x4c64e8[_0x531c('0x2b')]['id']}})[_0x531c('0x19')](handleEntityNotFound(_0xe69e5f,null))[_0x531c('0x19')](function(_0x4d5460){if(_0x4d5460){_0x57b4ab['model']=_[_0x531c('0x2d')](db[_0x531c('0x38')][_0x531c('0x22')]);_0x57b4ab[_0x531c('0x27')]=_['keys'](_0x4c64e8[_0x531c('0x27')]);_0x57b4ab['filters']=_[_0x531c('0x2e')](_0x57b4ab['model'],_0x57b4ab[_0x531c('0x27')]);_0x1c4bd8[_0x531c('0x2f')]=_[_0x531c('0x2e')](_0x57b4ab['model'],qs[_0x531c('0x30')](_0x4c64e8[_0x531c('0x27')][_0x531c('0x30')]));_0x1c4bd8[_0x531c('0x2f')]=_0x1c4bd8[_0x531c('0x2f')][_0x531c('0x3c')]?_0x1c4bd8[_0x531c('0x2f')]:_0x57b4ab[_0x531c('0x2c')];if(!_0x4c64e8[_0x531c('0x27')][_0x531c('0x3d')]('nolimit')){_0x1c4bd8[_0x531c('0x15')]=qs[_0x531c('0x15')](_0x4c64e8['query'][_0x531c('0x15')]);_0x1c4bd8[_0x531c('0x13')]=qs['offset'](_0x4c64e8[_0x531c('0x27')][_0x531c('0x13')]);}_0x1c4bd8['order']=qs[_0x531c('0x3e')](_0x4c64e8[_0x531c('0x27')]['sort']);_0x1c4bd8[_0x531c('0x3f')]=qs[_0x531c('0x40')](_[_0x531c('0x41')](_0x4c64e8[_0x531c('0x27')],_0x57b4ab[_0x531c('0x40')]));_0x1c4bd8[_0x531c('0x3f')][_0x531c('0x42')]=_0x4d5460['id'];if(_0x4c64e8['query'][_0x531c('0x43')]){_0x1c4bd8[_0x531c('0x3f')]=_['merge'](_0x1c4bd8[_0x531c('0x3f')],{'$or':_[_0x531c('0x44')](_0x1c4bd8[_0x531c('0x2f')],function(_0x36eb9a){var _0x5a3780={};_0x5a3780[_0x36eb9a]={'$like':'%'+_0x4c64e8[_0x531c('0x27')]['filter']+'%'};return _0x5a3780;})});}if(_0x4c64e8[_0x531c('0x27')][_0x531c('0x45')]){var _0x4f36c6=_0x4c64e8[_0x531c('0x27')][_0x531c('0x45')][_0x531c('0x46')](',');var _0x1b8551={};_0x1b8551[_0x4f36c6[0x0]]={'$gte':moment(_0x4f36c6[0x1])[_0x531c('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1c4bd8['where']=_[_0x531c('0x31')](_0x1c4bd8[_0x531c('0x3f')],_0x1b8551);}_0x1c4bd8=_[_0x531c('0x31')]({},_0x1c4bd8,_0x4c64e8['options']);return db[_0x531c('0x38')]['count']({'where':_0x1c4bd8[_0x531c('0x3f')]})[_0x531c('0x19')](function(_0x48a80d){_0x377291[_0x531c('0x16')]=_0x48a80d;if(_0x4c64e8[_0x531c('0x27')][_0x531c('0x48')]){_0x1c4bd8[_0x531c('0x49')]=[{'all':!![]}];}return db[_0x531c('0x38')][_0x531c('0x26')](_0x1c4bd8);})[_0x531c('0x19')](function(_0x3795d2){if(_0x4c64e8['query'][_0x531c('0x4a')]==='true'){for(var _0x1cfd5d=0x0;_0x1cfd5d<_0x3795d2[_0x531c('0x3c')];_0x1cfd5d++){_0x3795d2[_0x1cfd5d][_0x531c('0x34')]=juice(_0x3795d2[_0x1cfd5d][_0x531c('0x34')]);}}_0x377291[_0x531c('0x4b')]=_0x3795d2;return _0x377291;});}})[_0x531c('0x19')](respondWithFilteredResult(_0xe69e5f,_0x1c4bd8))[_0x531c('0x29')](handleError(_0xe69e5f,null));};exports['addTags']=function(_0x1dab33,_0x3d2a2a){return db['MailInteraction']['find']({'where':{'id':_0x1dab33['params']['id']}})[_0x531c('0x19')](handleEntityNotFound(_0x3d2a2a,null))[_0x531c('0x19')](function(_0x52738b){if(_0x52738b){return _0x52738b['setTags'](_0x1dab33[_0x531c('0x34')]['ids'],_[_0x531c('0x3a')](_0x1dab33[_0x531c('0x34')],[_0x531c('0x39'),'id'])||{})['spread'](function(){return db[_0x531c('0x4c')][_0x531c('0x26')]({'attributes':['id','name',_0x531c('0x4d')],'where':{'id':_0x1dab33[_0x531c('0x34')][_0x531c('0x39')]}});})['then'](function(_0x3cfedf){socket[_0x531c('0x4e')](_0x531c('0x4f'),{'id':Number(_0x1dab33[_0x531c('0x2b')]['id']),'tags':_0x3cfedf||[]});return{'id':Number(_0x1dab33[_0x531c('0x2b')]['id']),'tags':_0x3cfedf||[]};});}})[_0x531c('0x19')](respondWithResult(_0x3d2a2a,null))[_0x531c('0x29')](handleError(_0x3d2a2a,null));};exports[_0x531c('0x50')]=function(_0x5a2123,_0x1d5561){return db[_0x531c('0x21')][_0x531c('0x32')]({'where':{'id':_0x5a2123[_0x531c('0x2b')]['id']}})[_0x531c('0x19')](handleEntityNotFound(_0x1d5561,null))['then'](function(_0x3b5671){if(_0x3b5671){return _0x3b5671['removeTags'](_0x5a2123['query'][_0x531c('0x39')]);}})[_0x531c('0x19')](respondWithStatusCode(_0x1d5561,null))[_0x531c('0x29')](handleError(_0x1d5561,null));};exports[_0x531c('0x51')]=function(_0x4280bc,_0x12d2f3){var _0x3cbc29=moment()[_0x531c('0x52')]()[_0x531c('0x53')]();var _0x1619d6=path[_0x531c('0x54')](config[_0x531c('0x55')],_0x531c('0x56'),_0x531c('0x57'),_0x531c('0x58'));var _0x33abc8=path[_0x531c('0x54')](config[_0x531c('0x55')],_0x531c('0x56'),_0x531c('0x57'),'attachments');var _0x13cd57=path[_0x531c('0x54')](_0x1619d6,_0x3cbc29);var _0x35831a=util[_0x531c('0x47')](_0x531c('0x59'),_0x4280bc[_0x531c('0x2b')]['id'],_0x3cbc29);var _0x22de14=path[_0x531c('0x54')](_0x1619d6,_0x35831a);var _0x58bdeb=[];if(_0x4280bc[_0x531c('0x27')][_0x531c('0x5a')]){_0x58bdeb[_0x531c('0x5b')]({'model':db[_0x531c('0x5c')],'as':_0x531c('0x5d'),'raw':!![]});}var _0x2433d4=[{'model':db[_0x531c('0x38')],'as':_0x531c('0x5e'),'attributes':['id','body',_0x531c('0x5f'),'to','cc','bcc',_0x531c('0x60'),_0x531c('0x61')],'where':{'secret':![]},'order':qs[_0x531c('0x3e')]('id'),'include':_0x58bdeb}];return db['MailInteraction'][_0x531c('0x32')]({'where':{'id':_0x4280bc[_0x531c('0x2b')]['id']},'include':_0x2433d4})[_0x531c('0x19')](handleEntityNotFound(_0x12d2f3,null))[_0x531c('0x19')](function(_0x3288ef){if(_0x3288ef&&_0x3288ef[_0x531c('0x5e')]){var _0x49f2b7=_0x3288ef[_0x531c('0x62')]({'plain':!![]});fs[_0x531c('0x63')](_0x13cd57);return BPromise[_0x531c('0x64')](_0x49f2b7['Messages'],function(_0x4e86c6,_0x42b258){var _0x5786a4={'from':_0x4e86c6['from'],'to':_0x4e86c6['to']||_0x531c('0x65'),'subject':_0x4e86c6['subject'],'html':htmlEntities[_0x531c('0x66')](_0x4e86c6[_0x531c('0x34')]),'headers':{'Date':moment(_0x4e86c6[_0x531c('0x61')])[_0x531c('0x47')](_0x531c('0x67'))},'attachments':[]};if(_0x4e86c6['cc']){_0x5786a4[_0x531c('0x68')]['Cc']=_0x4e86c6['cc'];}if(_0x4e86c6[_0x531c('0x69')]){_0x5786a4[_0x531c('0x68')][_0x531c('0x6a')]=_0x4e86c6['bcc'];}return new BPromise(function(_0x59e18e,_0xe27e4f){if(_0x4e86c6[_0x531c('0x5d')]){for(var _0x4510dc=0x0;_0x4510dc<_0x4e86c6[_0x531c('0x5d')][_0x531c('0x3c')];_0x4510dc++){var _0x26beb8=_0x4e86c6[_0x531c('0x5d')][_0x4510dc];var _0x5f47b0=path[_0x531c('0x54')](_0x33abc8,_0x26beb8[_0x531c('0x6b')]);if(fs[_0x531c('0x6c')](_0x5f47b0)){_0x5786a4['attachments'][_0x531c('0x5b')]({'name':_0x26beb8[_0x531c('0x1e')],'contentType':_0x26beb8[_0x531c('0x24')],'data':fs['readFileSync'](_0x5f47b0)});}}}emlformat[_0x531c('0x6d')](_0x5786a4,function(_0x5762b4,_0x267739){if(_0x5762b4)return _0xe27e4f(_0x5762b4);fs[_0x531c('0x6e')](path[_0x531c('0x54')](_0x13cd57,util[_0x531c('0x47')](_0x531c('0x6f'),_0x42b258)),_0x267739);return _0x59e18e(_0x267739);});});})[_0x531c('0x19')](function(){return new BPromise(function(_0x4d53c8,_0x57c834){zipdir(_0x13cd57,{'saveTo':_0x22de14},function(_0x1e9240,_0x1f5335){if(_0x1e9240)return _0x57c834(_0x1e9240);return _0x4d53c8(_0x1f5335);});})['then'](function(){return new BPromise(function(_0xa29207,_0x315ea6){rimraf(_0x13cd57,function(_0x20d454){if(_0x20d454)_0x315ea6(_0x20d454);return _0xa29207();});});})[_0x531c('0x19')](function(){return _0x12d2f3[_0x531c('0x51')](_0x22de14,_0x35831a,function(_0x15c21a){if(!_0x15c21a)fs[_0x531c('0x70')](_0x22de14);});});});}else{return _0x12d2f3[_0x531c('0x1c')](0xc8);}})['catch'](handleError(_0x12d2f3,null));}; \ No newline at end of file +var _0x5b8f=['describe','addMessage','MailMessage','ids','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','map','$gte','format','merge','include','inlineCss','true','length','rows','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','root','transcript-%d-%s.zip','attachments','push','Attachment','Messages','from','bcc','subject','createdAt','mkdirSync','each','headers','Bcc','Attachments','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','keys','filters','model','attributes','fields','includeAll','options','find','create','body'];(function(_0x58bb7f,_0x58c585){var _0x248f61=function(_0x201e5a){while(--_0x201e5a){_0x58bb7f['push'](_0x58bb7f['shift']());}};_0x248f61(++_0x58c585);}(_0x5b8f,0x18d));var _0xf5b8=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x5b8f[_0x500c0];return _0xdd146f;};'use strict';var emlformat=require(_0xf5b8('0x0'));var rimraf=require(_0xf5b8('0x1'));var zipdir=require(_0xf5b8('0x2'));var moment=require(_0xf5b8('0x3'));var BPromise=require(_0xf5b8('0x4'));var util=require('util');var path=require(_0xf5b8('0x5'));var fs=require('fs');var _=require(_0xf5b8('0x6'));var juice=require(_0xf5b8('0x7'));var Redis=require('ioredis');var interaction=require(_0xf5b8('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xf5b8('0x9'))(_0xf5b8('0xa'));var config=require(_0xf5b8('0xb'));var db=require(_0xf5b8('0xc'))['db'];var htmlEntities=require(_0xf5b8('0xd'));config[_0xf5b8('0xe')]=_[_0xf5b8('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5b8('0xe')]));require(_0xf5b8('0x10'))['register'](socket);function respondWithStatusCode(_0x275b34,_0x11ee0a){_0x11ee0a=_0x11ee0a||0xcc;return function(_0x43ddc){if(_0x43ddc){return _0x275b34[_0xf5b8('0x11')](_0x11ee0a);}return _0x275b34['status'](_0x11ee0a)[_0xf5b8('0x12')]();};}function respondWithResult(_0x16a76e,_0x56d1ec){_0x56d1ec=_0x56d1ec||0xc8;return function(_0x235770){if(_0x235770){return _0x16a76e[_0xf5b8('0x13')](_0x56d1ec)[_0xf5b8('0x14')](_0x235770);}};}function respondWithFilteredResult(_0x17d1b8,_0xed5983){return function(_0x16043a){if(_0x16043a){var _0x65fb9c=typeof _0xed5983['offset']==='undefined'&&typeof _0xed5983[_0xf5b8('0x15')]===_0xf5b8('0x16');var _0x221430=_0x16043a[_0xf5b8('0x17')];var _0x58cf32=_0x65fb9c?0x0:_0xed5983[_0xf5b8('0x18')];var _0x2984ee=_0x65fb9c?_0x16043a[_0xf5b8('0x17')]:_0xed5983[_0xf5b8('0x18')]+_0xed5983['limit'];var _0x322b6a;if(_0x2984ee>=_0x221430){_0x2984ee=_0x221430;_0x322b6a=0xc8;}else{_0x322b6a=0xce;}_0x17d1b8[_0xf5b8('0x13')](_0x322b6a);return _0x17d1b8[_0xf5b8('0x19')](_0xf5b8('0x1a'),_0x58cf32+'-'+_0x2984ee+'/'+_0x221430)['json'](_0x16043a);}return null;};}function saveUpdates(_0x16bcb9){return function(_0x468cc6){if(_0x468cc6){return _0x468cc6[_0xf5b8('0x1b')](_0x16bcb9)[_0xf5b8('0x1c')](function(_0x562fcf){return _0x562fcf;});}return null;};}function removeEntity(_0x12d639){return function(_0x2ff111){if(_0x2ff111){return _0x2ff111[_0xf5b8('0x1d')]()['then'](function(){_0x12d639[_0xf5b8('0x13')](0xcc)[_0xf5b8('0x12')]();});}};}function handleEntityNotFound(_0x2f4a98){return function(_0x195e84){if(!_0x195e84){_0x2f4a98[_0xf5b8('0x11')](0x194);}return _0x195e84;};}function handleError(_0x4429e6,_0xa3c655){_0xa3c655=_0xa3c655||0x1f4;return function(_0x249906){logger['error'](_0x249906['stack']);if(_0x249906[_0xf5b8('0x1e')]){delete _0x249906['name'];}_0x4429e6['status'](_0xa3c655)[_0xf5b8('0x1f')](_0x249906);};}exports[_0xf5b8('0x20')]=function(_0x3c832e,_0x31dec1){var _0x21c4e9={};var _0x3fc45c=_['map'](db[_0xf5b8('0x21')][_0xf5b8('0x22')],function(_0x1aa754){return{'name':_0x1aa754[_0xf5b8('0x23')],'type':_0x1aa754[_0xf5b8('0x24')][_0xf5b8('0x25')]};});_0x21c4e9=qs[_0xf5b8('0x26')](_0x3fc45c,_0x3c832e);return interaction[_0xf5b8('0x27')]('mail',_0x3c832e[_0xf5b8('0x28')],_0x3c832e[_0xf5b8('0x29')],_0x21c4e9,_0x3fc45c)[_0xf5b8('0x1c')](respondWithFilteredResult(_0x31dec1,_0x21c4e9))[_0xf5b8('0x2a')](handleError(_0x31dec1,null));};exports[_0xf5b8('0x2b')]=function(_0x36e552,_0x4af29c){var _0x109a02={'raw':![],'where':{'id':_0x36e552[_0xf5b8('0x2c')]['id']}},_0x57643c={};_0x57643c['model']=_[_0xf5b8('0x2d')](db[_0xf5b8('0x21')][_0xf5b8('0x22')]);_0x57643c[_0xf5b8('0x28')]=_[_0xf5b8('0x2d')](_0x36e552[_0xf5b8('0x28')]);_0x57643c[_0xf5b8('0x2e')]=_['intersection'](_0x57643c[_0xf5b8('0x2f')],_0x57643c[_0xf5b8('0x28')]);_0x109a02[_0xf5b8('0x30')]=_['intersection'](_0x57643c[_0xf5b8('0x2f')],qs[_0xf5b8('0x31')](_0x36e552[_0xf5b8('0x28')][_0xf5b8('0x31')]));_0x109a02[_0xf5b8('0x30')]=_0x109a02['attributes']['length']?_0x109a02[_0xf5b8('0x30')]:_0x57643c[_0xf5b8('0x2f')];if(_0x36e552[_0xf5b8('0x28')][_0xf5b8('0x32')]){_0x109a02['include']=[{'all':!![]}];}_0x109a02=_['merge']({},_0x109a02,_0x36e552[_0xf5b8('0x33')]);return db[_0xf5b8('0x21')][_0xf5b8('0x34')](_0x109a02)[_0xf5b8('0x1c')](handleEntityNotFound(_0x4af29c,null))[_0xf5b8('0x1c')](respondWithResult(_0x4af29c,null))[_0xf5b8('0x2a')](handleError(_0x4af29c,null));};exports['create']=function(_0x178918,_0x3d7e62){return db[_0xf5b8('0x21')][_0xf5b8('0x35')](_0x178918[_0xf5b8('0x36')],{})['then'](respondWithResult(_0x3d7e62,0xc9))[_0xf5b8('0x2a')](handleError(_0x3d7e62,null));};exports[_0xf5b8('0x1b')]=function(_0x255bb0,_0x57375e){if(_0x255bb0[_0xf5b8('0x36')]['id']){delete _0x255bb0[_0xf5b8('0x36')]['id'];}return db['MailInteraction'][_0xf5b8('0x34')]({'where':{'id':_0x255bb0[_0xf5b8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x57375e,null))[_0xf5b8('0x1c')](saveUpdates(_0x255bb0[_0xf5b8('0x36')],null))[_0xf5b8('0x1c')](respondWithResult(_0x57375e,null))['catch'](handleError(_0x57375e,null));};exports[_0xf5b8('0x1d')]=function(_0x1b0ca6,_0x483225){return db[_0xf5b8('0x21')]['find']({'where':{'id':_0x1b0ca6['params']['id']}})[_0xf5b8('0x1c')](handleEntityNotFound(_0x483225,null))[_0xf5b8('0x1c')](removeEntity(_0x483225,null))[_0xf5b8('0x2a')](handleError(_0x483225,null));};exports[_0xf5b8('0x37')]=function(_0x172132,_0x182adb){return db[_0xf5b8('0x21')][_0xf5b8('0x37')]()['then'](respondWithResult(_0x182adb,null))[_0xf5b8('0x2a')](handleError(_0x182adb,null));};exports[_0xf5b8('0x38')]=function(_0x12dde0,_0x4a82fe){return db[_0xf5b8('0x39')][_0xf5b8('0x34')]({'where':{'id':_0x12dde0[_0xf5b8('0x2c')]['id']}})[_0xf5b8('0x1c')](handleEntityNotFound(_0x4a82fe,null))[_0xf5b8('0x1c')](function(_0x243e02){if(_0x243e02){return _0x243e02[_0xf5b8('0x38')](_0x12dde0['body'][_0xf5b8('0x3a')],_['omit'](_0x12dde0['body'],[_0xf5b8('0x3a'),'id'])||{});}})[_0xf5b8('0x1c')](respondWithResult(_0x4a82fe,null))[_0xf5b8('0x2a')](handleError(_0x4a82fe,null));};exports[_0xf5b8('0x3b')]=function(_0x3f57a3,_0x239f97){var _0x359819={'raw':![],'where':{}};var _0x4a5605={};var _0x4f9e50={'count':0x0,'rows':[]};return db[_0xf5b8('0x21')][_0xf5b8('0x3c')]({'where':{'id':_0x3f57a3[_0xf5b8('0x2c')]['id']}})[_0xf5b8('0x1c')](handleEntityNotFound(_0x239f97,null))[_0xf5b8('0x1c')](function(_0x2e33d7){if(_0x2e33d7){_0x4a5605[_0xf5b8('0x2f')]=_['keys'](db[_0xf5b8('0x39')]['rawAttributes']);_0x4a5605[_0xf5b8('0x28')]=_[_0xf5b8('0x2d')](_0x3f57a3[_0xf5b8('0x28')]);_0x4a5605[_0xf5b8('0x2e')]=_[_0xf5b8('0x3d')](_0x4a5605['model'],_0x4a5605[_0xf5b8('0x28')]);_0x359819[_0xf5b8('0x30')]=_[_0xf5b8('0x3d')](_0x4a5605[_0xf5b8('0x2f')],qs[_0xf5b8('0x31')](_0x3f57a3['query'][_0xf5b8('0x31')]));_0x359819['attributes']=_0x359819[_0xf5b8('0x30')]['length']?_0x359819[_0xf5b8('0x30')]:_0x4a5605[_0xf5b8('0x2f')];if(!_0x3f57a3['query'][_0xf5b8('0x3e')](_0xf5b8('0x3f'))){_0x359819[_0xf5b8('0x15')]=qs[_0xf5b8('0x15')](_0x3f57a3['query'][_0xf5b8('0x15')]);_0x359819[_0xf5b8('0x18')]=qs[_0xf5b8('0x18')](_0x3f57a3['query'][_0xf5b8('0x18')]);}_0x359819[_0xf5b8('0x40')]=qs[_0xf5b8('0x41')](_0x3f57a3['query'][_0xf5b8('0x41')]);_0x359819[_0xf5b8('0x42')]=qs['filters'](_[_0xf5b8('0x43')](_0x3f57a3[_0xf5b8('0x28')],_0x4a5605[_0xf5b8('0x2e')]));_0x359819['where'][_0xf5b8('0x44')]=_0x2e33d7['id'];if(_0x3f57a3['query'][_0xf5b8('0x45')]){_0x359819[_0xf5b8('0x42')]=_['merge'](_0x359819[_0xf5b8('0x42')],{'$or':_[_0xf5b8('0x46')](_0x359819[_0xf5b8('0x30')],function(_0xcfbc75){var _0x4ce396={};_0x4ce396[_0xcfbc75]={'$like':'%'+_0x3f57a3[_0xf5b8('0x28')][_0xf5b8('0x45')]+'%'};return _0x4ce396;})});}if(_0x3f57a3[_0xf5b8('0x28')][_0xf5b8('0x47')]){var _0x2e84f3=_0x3f57a3[_0xf5b8('0x28')][_0xf5b8('0x47')]['split'](',');var _0x26241b={};_0x26241b[_0x2e84f3[0x0]]={'$gte':moment(_0x2e84f3[0x1])[_0xf5b8('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x359819[_0xf5b8('0x42')]=_[_0xf5b8('0x49')](_0x359819['where'],_0x26241b);}_0x359819=_['merge']({},_0x359819,_0x3f57a3[_0xf5b8('0x33')]);return db[_0xf5b8('0x39')][_0xf5b8('0x17')]({'where':_0x359819[_0xf5b8('0x42')]})[_0xf5b8('0x1c')](function(_0x1be0dd){_0x4f9e50[_0xf5b8('0x17')]=_0x1be0dd;if(_0x3f57a3['query']['includeAll']){_0x359819[_0xf5b8('0x4a')]=[{'all':!![]}];}return db['MailMessage'][_0xf5b8('0x27')](_0x359819);})[_0xf5b8('0x1c')](function(_0x3a51f4){if(_0x3f57a3['query'][_0xf5b8('0x4b')]===_0xf5b8('0x4c')){for(var _0x28fdb2=0x0;_0x28fdb2<_0x3a51f4[_0xf5b8('0x4d')];_0x28fdb2++){_0x3a51f4[_0x28fdb2][_0xf5b8('0x36')]=juice(_0x3a51f4[_0x28fdb2][_0xf5b8('0x36')]);}}_0x4f9e50[_0xf5b8('0x4e')]=_0x3a51f4;return _0x4f9e50;});}})['then'](respondWithFilteredResult(_0x239f97,_0x359819))[_0xf5b8('0x2a')](handleError(_0x239f97,null));};exports[_0xf5b8('0x4f')]=function(_0x17bf5a,_0x5aad7f){return db[_0xf5b8('0x21')]['find']({'where':{'id':_0x17bf5a[_0xf5b8('0x2c')]['id']}})[_0xf5b8('0x1c')](handleEntityNotFound(_0x5aad7f,null))[_0xf5b8('0x1c')](function(_0x5b158b){if(_0x5b158b){return _0x5b158b['setTags'](_0x17bf5a[_0xf5b8('0x36')][_0xf5b8('0x3a')],_['omit'](_0x17bf5a[_0xf5b8('0x36')],[_0xf5b8('0x3a'),'id'])||{})[_0xf5b8('0x50')](function(){return db[_0xf5b8('0x51')][_0xf5b8('0x27')]({'attributes':['id',_0xf5b8('0x1e'),_0xf5b8('0x52')],'where':{'id':_0x17bf5a[_0xf5b8('0x36')][_0xf5b8('0x3a')]}});})[_0xf5b8('0x1c')](function(_0x598f6e){socket[_0xf5b8('0x53')](_0xf5b8('0x54'),{'id':Number(_0x17bf5a[_0xf5b8('0x2c')]['id']),'tags':_0x598f6e||[]});return{'id':Number(_0x17bf5a[_0xf5b8('0x2c')]['id']),'tags':_0x598f6e||[]};});}})[_0xf5b8('0x1c')](respondWithResult(_0x5aad7f,null))['catch'](handleError(_0x5aad7f,null));};exports[_0xf5b8('0x55')]=function(_0x244a35,_0x243083){return db['MailInteraction']['find']({'where':{'id':_0x244a35[_0xf5b8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x243083,null))['then'](function(_0x16739d){if(_0x16739d){return _0x16739d[_0xf5b8('0x55')](_0x244a35[_0xf5b8('0x28')][_0xf5b8('0x3a')]);}})[_0xf5b8('0x1c')](respondWithStatusCode(_0x243083,null))[_0xf5b8('0x2a')](handleError(_0x243083,null));};exports['download']=function(_0xf2ad7e,_0x5aeb9f){var _0x3f230e=moment()[_0xf5b8('0x56')]()[_0xf5b8('0x57')]();var _0x14f59=path[_0xf5b8('0x58')](config['root'],_0xf5b8('0x59'),_0xf5b8('0x5a'),_0xf5b8('0x5b'));var _0x36d4ea=path[_0xf5b8('0x58')](config[_0xf5b8('0x5c')],'server',_0xf5b8('0x5a'),'attachments');var _0x2ba7ae=path['join'](_0x14f59,_0x3f230e);var _0x543af8=util[_0xf5b8('0x48')](_0xf5b8('0x5d'),_0xf2ad7e[_0xf5b8('0x2c')]['id'],_0x3f230e);var _0x457241=path[_0xf5b8('0x58')](_0x14f59,_0x543af8);var _0x518e1a=[];if(_0xf2ad7e[_0xf5b8('0x28')][_0xf5b8('0x5e')]){_0x518e1a[_0xf5b8('0x5f')]({'model':db[_0xf5b8('0x60')],'as':'Attachments','raw':!![]});}var _0x201969=[{'model':db[_0xf5b8('0x39')],'as':_0xf5b8('0x61'),'attributes':['id',_0xf5b8('0x36'),_0xf5b8('0x62'),'to','cc',_0xf5b8('0x63'),_0xf5b8('0x64'),_0xf5b8('0x65')],'where':{'secret':![]},'order':qs[_0xf5b8('0x41')]('id'),'include':_0x518e1a}];return db['MailInteraction'][_0xf5b8('0x34')]({'where':{'id':_0xf2ad7e[_0xf5b8('0x2c')]['id']},'include':_0x201969})['then'](handleEntityNotFound(_0x5aeb9f,null))[_0xf5b8('0x1c')](function(_0x5dc659){if(_0x5dc659&&_0x5dc659['Messages']){var _0x1b20ba=_0x5dc659['get']({'plain':!![]});fs[_0xf5b8('0x66')](_0x2ba7ae);return BPromise[_0xf5b8('0x67')](_0x1b20ba[_0xf5b8('0x61')],function(_0x14e50e,_0x1dbafe){var _0x557196={'from':_0x14e50e[_0xf5b8('0x62')],'to':_0x14e50e['to']||'missing.recipient@your.company.com','subject':_0x14e50e['subject'],'html':htmlEntities['decode'](_0x14e50e[_0xf5b8('0x36')]),'headers':{'Date':moment(_0x14e50e[_0xf5b8('0x65')])[_0xf5b8('0x48')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x14e50e['cc']){_0x557196[_0xf5b8('0x68')]['Cc']=_0x14e50e['cc'];}if(_0x14e50e[_0xf5b8('0x63')]){_0x557196[_0xf5b8('0x68')][_0xf5b8('0x69')]=_0x14e50e[_0xf5b8('0x63')];}return new BPromise(function(_0x3dbe45,_0x281faa){if(_0x14e50e[_0xf5b8('0x6a')]){for(var _0x2fc138=0x0;_0x2fc138<_0x14e50e[_0xf5b8('0x6a')][_0xf5b8('0x4d')];_0x2fc138++){var _0x3ca4fb=_0x14e50e[_0xf5b8('0x6a')][_0x2fc138];var _0x1fde87=path[_0xf5b8('0x58')](_0x36d4ea,_0x3ca4fb['basename']);if(fs['existsSync'](_0x1fde87)){_0x557196[_0xf5b8('0x5e')][_0xf5b8('0x5f')]({'name':_0x3ca4fb[_0xf5b8('0x1e')],'contentType':_0x3ca4fb[_0xf5b8('0x24')],'data':fs[_0xf5b8('0x6b')](_0x1fde87)});}}}emlformat[_0xf5b8('0x6c')](_0x557196,function(_0x45d68c,_0x22092e){if(_0x45d68c)return _0x281faa(_0x45d68c);fs[_0xf5b8('0x6d')](path[_0xf5b8('0x58')](_0x2ba7ae,util['format'](_0xf5b8('0x6e'),_0x1dbafe)),_0x22092e);return _0x3dbe45(_0x22092e);});});})[_0xf5b8('0x1c')](function(){return new BPromise(function(_0x30d80f,_0x550b50){zipdir(_0x2ba7ae,{'saveTo':_0x457241},function(_0x3a1119,_0x48d209){if(_0x3a1119)return _0x550b50(_0x3a1119);return _0x30d80f(_0x48d209);});})['then'](function(){return new BPromise(function(_0x3afead,_0x44fb5f){rimraf(_0x2ba7ae,function(_0xda4d5){if(_0xda4d5)_0x44fb5f(_0xda4d5);return _0x3afead();});});})['then'](function(){return _0x5aeb9f[_0xf5b8('0x6f')](_0x457241,_0x543af8,function(_0x24430f){if(!_0x24430f)fs[_0xf5b8('0x70')](_0x457241);});});});}else{return _0x5aeb9f[_0xf5b8('0x11')](0xc8);}})[_0xf5b8('0x2a')](handleError(_0x5aeb9f,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f535905..da3059c 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 _0xbeef=['catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','save','update','remove','then','setDataValue','findAll','unreadMessages','length','emit'];(function(_0x488b49,_0x34d2e2){var _0x241e56=function(_0x47d0f3){while(--_0x47d0f3){_0x488b49['push'](_0x488b49['shift']());}};_0x241e56(++_0x34d2e2);}(_0xbeef,0x1e4));var _0xfbee=function(_0xa2f4e8,_0x97c0){_0xa2f4e8=_0xa2f4e8-0x0;var _0x521c24=_0xbeef[_0xa2f4e8];return _0x521c24;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xfbee('0x0'))['db'][_0xfbee('0x1')];var MailMessage=require(_0xfbee('0x0'))['db'][_0xfbee('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfbee('0x3'),'afterUpdate':_0xfbee('0x4'),'afterDestroy':_0xfbee('0x5')};function emitEvent(_0x1ae96d){return function(_0x529710,_0x1f9837,_0x21da01){_0x529710['getUsers']({'attributes':['id'],'raw':!![]})[_0xfbee('0x6')](function(_0x134b45){_0x529710[_0xfbee('0x7')]('Users',_0x134b45['map'](function(_0x533d13){return{'id':_0x533d13['id']};}));return MailMessage[_0xfbee('0x8')]({'where':{'MailInteractionId':_0x529710['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfbee('0x6')](function(_0xbb972e){_0x529710[_0xfbee('0x7')](_0xfbee('0x9'),_0xbb972e[_0xfbee('0xa')]);MailInteractionEvents[_0xfbee('0xb')](_0x1ae96d+':'+_0x529710['id'],_0x529710);MailInteractionEvents['emit'](_0x1ae96d,_0x529710);_0x21da01(null);})[_0xfbee('0xc')](_0x21da01(null));};}for(var e in events){if(events[_0xfbee('0xd')](e)){var event=events[e];MailInteraction[_0xfbee('0xe')](e,emitEvent(event));}}module[_0xfbee('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x2f65=['unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers','then','map'];(function(_0x1c76e4,_0x700b6a){var _0x117e4e=function(_0x4b8836){while(--_0x4b8836){_0x1c76e4['push'](_0x1c76e4['shift']());}};_0x117e4e(++_0x700b6a);}(_0x2f65,0xf3));var _0x52f6=function(_0x46ad00,_0x4a1e49){_0x46ad00=_0x46ad00-0x0;var _0x54736b=_0x2f65[_0x46ad00];return _0x54736b;};'use strict';var EventEmitter=require(_0x52f6('0x0'));var MailInteraction=require(_0x52f6('0x1'))['db'][_0x52f6('0x2')];var MailMessage=require(_0x52f6('0x1'))['db'][_0x52f6('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x52f6('0x4'),'afterDestroy':_0x52f6('0x5')};function emitEvent(_0xa6aa1){return function(_0x285cae,_0x2c27b8,_0x199e5d){_0x285cae[_0x52f6('0x6')]({'attributes':['id'],'raw':!![]})[_0x52f6('0x7')](function(_0x4643ec){_0x285cae['setDataValue']('Users',_0x4643ec[_0x52f6('0x8')](function(_0x4e134f){return{'id':_0x4e134f['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x285cae['id'],'direction':'in','read':![]},'raw':!![]});})[_0x52f6('0x7')](function(_0x4cce33){_0x285cae['setDataValue'](_0x52f6('0x9'),_0x4cce33['length']);MailInteractionEvents[_0x52f6('0xa')](_0xa6aa1+':'+_0x285cae['id'],_0x285cae);MailInteractionEvents[_0x52f6('0xa')](_0xa6aa1,_0x285cae);_0x199e5d(null);})['catch'](_0x199e5d(null));};}for(var e in events){if(events[_0x52f6('0xb')](e)){var event=events[e];MailInteraction[_0x52f6('0xc')](e,emitEvent(event));}}module[_0x52f6('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 9851832..f886622 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 _0x713c=['YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','substatus','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format'];(function(_0x2c727b,_0x3aa202){var _0x27180a=function(_0x846789){while(--_0x846789){_0x2c727b['push'](_0x2c727b['shift']());}};_0x27180a(++_0x3aa202);}(_0x713c,0x6a));var _0xc713=function(_0x1ae087,_0x1e1b68){_0x1ae087=_0x1ae087-0x0;var _0xf9d37e=_0x713c[_0x1ae087];return _0xf9d37e;};'use strict';var _=require(_0xc713('0x0'));var util=require(_0xc713('0x1'));var logger=require(_0xc713('0x2'))('api');var moment=require(_0xc713('0x3'));var BPromise=require(_0xc713('0x4'));var rp=require(_0xc713('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc713('0x6'));var config=require(_0xc713('0x7'));var attributes=require(_0xc713('0x8'));module[_0xc713('0x9')]=function(_0x28693e,_0x1bc191){return _0x28693e[_0xc713('0xa')](_0xc713('0xb'),attributes,{'tableName':_0xc713('0xc'),'paranoid':![],'indexes':[{'name':_0xc713('0xd'),'fields':[_0xc713('0xe'),'to'],'type':_0xc713('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15a7e5,_0x157387,_0x109085){if(_0x15a7e5['substatus']){_0x15a7e5[_0xc713('0x10')]=moment()[_0xc713('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x15a7e5['closed']){_0x15a7e5['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x109085(null,_0x157387);},'beforeUpdate':function(_0x12b85a,_0x4d64b2,_0x44f2ee){if(_0x12b85a['changed']('substatus')){_0x12b85a[_0xc713('0x10')]=_0x12b85a['substatus']?moment()['format'](_0xc713('0x12')):null;}if(_0x12b85a[_0xc713('0x13')](_0xc713('0x14'))){_0x12b85a[_0xc713('0x15')]=moment()[_0xc713('0x11')](_0xc713('0x12'));_0x12b85a[_0xc713('0x16')]=null;_0x12b85a[_0xc713('0x10')]=null;}_0x44f2ee(null,_0x12b85a);},'afterUpdate':function(_0x214fe2,_0x3c932e,_0x2216b7){var _0x2f8395=_0x28693e[_0xc713('0x17')];var _0x1955ec=_0x214fe2[_0xc713('0x18')]({'plain':!![]});if(_0x1955ec['closed']){return _0x2f8395[_0xc713('0x19')][_0xc713('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x1955ec['id']}})[_0xc713('0x1b')](function(){_0x2216b7();})[_0xc713('0x1c')](function(_0x16e8e0){_0x2216b7(_0x16e8e0);});}else{_0x2216b7();}}},'charset':_0xc713('0x1d'),'collate':_0xc713('0x1e')});}; \ No newline at end of file +var _0x92e4=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','substatusAt','models','get','closed','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment'];(function(_0x1f8e28,_0x52f825){var _0x1807d3=function(_0x59cf43){while(--_0x59cf43){_0x1f8e28['push'](_0x1f8e28['shift']());}};_0x1807d3(++_0x52f825);}(_0x92e4,0x85));var _0x492e=function(_0x59d4db,_0x39b4c1){_0x59d4db=_0x59d4db-0x0;var _0x16b124=_0x92e4[_0x59d4db];return _0x16b124;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x492e('0x0'))('api');var moment=require(_0x492e('0x1'));var BPromise=require(_0x492e('0x2'));var rp=require(_0x492e('0x3'));var fs=require('fs');var path=require(_0x492e('0x4'));var rimraf=require(_0x492e('0x5'));var config=require(_0x492e('0x6'));var attributes=require(_0x492e('0x7'));module[_0x492e('0x8')]=function(_0x1ce5e4,_0x3a2b68){return _0x1ce5e4[_0x492e('0x9')]('MailInteraction',attributes,{'tableName':_0x492e('0xa'),'paranoid':![],'indexes':[{'name':_0x492e('0xb'),'fields':[_0x492e('0xc'),'to'],'type':_0x492e('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe260f,_0x49ab76,_0x368a34){if(_0xe260f[_0x492e('0xe')]){_0xe260f['substatusAt']=moment()['format'](_0x492e('0xf'));}if(_0xe260f['closed']){_0xe260f[_0x492e('0x10')]=moment()[_0x492e('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x368a34(null,_0x49ab76);},'beforeUpdate':function(_0x44063c,_0x1303ae,_0x5e2ec1){if(_0x44063c[_0x492e('0x12')]('substatus')){_0x44063c[_0x492e('0x13')]=_0x44063c[_0x492e('0xe')]?moment()['format'](_0x492e('0xf')):null;}if(_0x44063c['changed']('closed')){_0x44063c['closedAt']=moment()[_0x492e('0x11')](_0x492e('0xf'));_0x44063c[_0x492e('0xe')]=null;_0x44063c[_0x492e('0x13')]=null;}_0x5e2ec1(null,_0x44063c);},'afterUpdate':function(_0x2ab3f0,_0x43a642,_0x28ef86){var _0x3ee969=_0x1ce5e4[_0x492e('0x14')];var _0x5d203e=_0x2ab3f0[_0x492e('0x15')]({'plain':!![]});if(_0x5d203e[_0x492e('0x16')]){return _0x3ee969[_0x492e('0x17')][_0x492e('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x5d203e['id']}})['then'](function(){_0x28ef86();})['catch'](function(_0x4c92e4){_0x28ef86(_0x4c92e4);});}else{_0x28ef86();}}},'charset':_0x492e('0x19'),'collate':_0x492e('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f0bc2c9..50c4280 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 _0x57f0=['where','attributes','UpdateMailInteraction','stringify','ids','omit','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','update','body','options','raw'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x57f0,0x9f));var _0x057f=function(_0x37dac2,_0xdb5e75){_0x37dac2=_0x37dac2-0x0;var _0x351e15=_0x57f0[_0x37dac2];return _0x351e15;};'use strict';var _=require('lodash');var util=require(_0x057f('0x0'));var moment=require(_0x057f('0x1'));var BPromise=require(_0x057f('0x2'));var rs=require(_0x057f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x057f('0x4'))['db'];var utils=require(_0x057f('0x5'));var logger=require(_0x057f('0x6'))('rpc');var config=require(_0x057f('0x7'));var jayson=require(_0x057f('0x8'));var client=jayson[_0x057f('0x9')][_0x057f('0xa')]({'port':0x232a});config['redis']=_[_0x057f('0xb')](config[_0x057f('0xc')],{'host':_0x057f('0xd'),'port':0x18eb});var socket=require(_0x057f('0xe'))(new Redis(config[_0x057f('0xc')]));require(_0x057f('0xf'))[_0x057f('0x10')](socket);function respondWithRpcPromise(_0x1b209b,_0x28dbfe,_0x3b433d){return new BPromise(function(_0x21e411,_0xeb40de){return client['request'](_0x1b209b,_0x3b433d)[_0x057f('0x11')](function(_0x444d32){logger[_0x057f('0x12')](_0x057f('0x13'),_0x28dbfe,_0x057f('0x14'));logger[_0x057f('0x15')](_0x057f('0x16'),_0x28dbfe,_0x057f('0x14'),JSON['stringify'](_0x444d32));if(_0x444d32[_0x057f('0x17')]){if(_0x444d32[_0x057f('0x17')][_0x057f('0x18')]===0x1f4){logger[_0x057f('0x17')](_0x057f('0x13'),_0x28dbfe,_0x444d32[_0x057f('0x17')][_0x057f('0x19')]);return _0xeb40de(_0x444d32[_0x057f('0x17')][_0x057f('0x19')]);}logger[_0x057f('0x17')]('MailInteraction,\x20%s,\x20%s',_0x28dbfe,_0x444d32['error']['message']);return _0x21e411(_0x444d32['error']['message']);}else{logger[_0x057f('0x12')](_0x057f('0x13'),_0x28dbfe,_0x057f('0x14'));_0x21e411(_0x444d32['result']['message']);}})[_0x057f('0x1a')](function(_0x59a5ef){logger[_0x057f('0x17')]('MailInteraction,\x20%s,\x20%s',_0x28dbfe,_0x59a5ef);_0xeb40de(_0x59a5ef);});});}exports['UpdateMailInteraction']=function(_0x33d777){var _0xc7299a=this;return new Promise(function(_0x36a506,_0x550f65){return db['MailInteraction'][_0x057f('0x1b')](_0x33d777[_0x057f('0x1c')],{'raw':_0x33d777[_0x057f('0x1d')]?_0x33d777[_0x057f('0x1d')][_0x057f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d777['options']?_0x33d777[_0x057f('0x1d')][_0x057f('0x1f')]||null:null,'attributes':_0x33d777[_0x057f('0x1d')]?_0x33d777[_0x057f('0x1d')][_0x057f('0x20')]||null:null,'limit':_0x33d777[_0x057f('0x1d')]?_0x33d777[_0x057f('0x1d')]['limit']||null:null})[_0x057f('0x11')](function(_0x38b608){logger[_0x057f('0x12')](_0x057f('0x21'),_0x33d777);logger['debug']('UpdateMailInteraction',_0x33d777,JSON[_0x057f('0x22')](_0x38b608));_0x36a506(_0x38b608);})[_0x057f('0x1a')](function(_0x431f4b){logger[_0x057f('0x17')]('UpdateMailInteraction',_0x431f4b[_0x057f('0x19')],_0x33d777);_0x550f65(_0xc7299a[_0x057f('0x17')](0x1f4,_0x431f4b[_0x057f('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x2834b3){return new Promise(function(_0x98241a,_0xcd712c){return db['MailInteraction']['find']({'where':_0x2834b3['options']?_0x2834b3[_0x057f('0x1d')][_0x057f('0x1f')]||null:null})[_0x057f('0x11')](function(_0x4f387d){if(_0x4f387d){return _0x4f387d['addTags'](_0x2834b3['body'][_0x057f('0x23')],_[_0x057f('0x24')](_0x2834b3[_0x057f('0x1c')],['ids','id'])||{});}})['spread'](function(_0xd88729){logger[_0x057f('0x12')](_0x057f('0x25'),_0x2834b3);logger['debug']('AddTags',_0x2834b3,JSON[_0x057f('0x22')](_0xd88729));_0x98241a(_0xd88729);})[_0x057f('0x1a')](function(_0x73a9f2){logger[_0x057f('0x17')](_0x057f('0x25'),_0x73a9f2[_0x057f('0x19')],_0x2834b3);_0xcd712c(_this[_0x057f('0x17')](0x1f4,_0x73a9f2['message']));});});}; \ No newline at end of file +var _0xafdf=['./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','ids','spread','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter'];(function(_0x230447,_0x2f9892){var _0x4431fc=function(_0x443317){while(--_0x443317){_0x230447['push'](_0x230447['shift']());}};_0x4431fc(++_0x2f9892);}(_0xafdf,0x15c));var _0xfafd=function(_0x144fbd,_0x51b6c6){_0x144fbd=_0x144fbd-0x0;var _0x20aba4=_0xafdf[_0x144fbd];return _0x20aba4;};'use strict';var _=require(_0xfafd('0x0'));var util=require(_0xfafd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfafd('0x2'));var db=require(_0xfafd('0x3'))['db'];var utils=require(_0xfafd('0x4'));var logger=require(_0xfafd('0x5'))('rpc');var config=require(_0xfafd('0x6'));var jayson=require(_0xfafd('0x7'));var client=jayson[_0xfafd('0x8')]['http']({'port':0x232a});config[_0xfafd('0x9')]=_[_0xfafd('0xa')](config[_0xfafd('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfafd('0xb'))(new Redis(config['redis']));require(_0xfafd('0xc'))[_0xfafd('0xd')](socket);function respondWithRpcPromise(_0x54b9c7,_0x3a1742,_0x1361bc){return new BPromise(function(_0x5cb991,_0x54376a){return client[_0xfafd('0xe')](_0x54b9c7,_0x1361bc)[_0xfafd('0xf')](function(_0x120d56){logger[_0xfafd('0x10')](_0xfafd('0x11'),_0x3a1742,_0xfafd('0x12'));logger[_0xfafd('0x13')](_0xfafd('0x14'),_0x3a1742,'request\x20sent',JSON[_0xfafd('0x15')](_0x120d56));if(_0x120d56[_0xfafd('0x16')]){if(_0x120d56[_0xfafd('0x16')][_0xfafd('0x17')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3a1742,_0x120d56[_0xfafd('0x16')]['message']);return _0x54376a(_0x120d56['error'][_0xfafd('0x18')]);}logger[_0xfafd('0x16')](_0xfafd('0x11'),_0x3a1742,_0x120d56[_0xfafd('0x16')][_0xfafd('0x18')]);return _0x5cb991(_0x120d56[_0xfafd('0x16')]['message']);}else{logger[_0xfafd('0x10')]('MailInteraction,\x20%s,\x20%s',_0x3a1742,'request\x20sent');_0x5cb991(_0x120d56[_0xfafd('0x19')]['message']);}})[_0xfafd('0x1a')](function(_0x24e3ed){logger[_0xfafd('0x16')]('MailInteraction,\x20%s,\x20%s',_0x3a1742,_0x24e3ed);_0x54376a(_0x24e3ed);});});}exports['UpdateMailInteraction']=function(_0x1ccca3){var _0x182e77=this;return new Promise(function(_0x34deca,_0x4303d1){return db['MailInteraction'][_0xfafd('0x1b')](_0x1ccca3[_0xfafd('0x1c')],{'raw':_0x1ccca3[_0xfafd('0x1d')]?_0x1ccca3[_0xfafd('0x1d')][_0xfafd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ccca3[_0xfafd('0x1d')]?_0x1ccca3['options'][_0xfafd('0x1f')]||null:null,'attributes':_0x1ccca3['options']?_0x1ccca3[_0xfafd('0x1d')][_0xfafd('0x20')]||null:null,'limit':_0x1ccca3[_0xfafd('0x1d')]?_0x1ccca3[_0xfafd('0x1d')][_0xfafd('0x21')]||null:null})[_0xfafd('0xf')](function(_0x4cb771){logger[_0xfafd('0x10')](_0xfafd('0x22'),_0x1ccca3);logger[_0xfafd('0x13')]('UpdateMailInteraction',_0x1ccca3,JSON[_0xfafd('0x15')](_0x4cb771));_0x34deca(_0x4cb771);})['catch'](function(_0x3078f7){logger[_0xfafd('0x16')](_0xfafd('0x22'),_0x3078f7[_0xfafd('0x18')],_0x1ccca3);_0x4303d1(_0x182e77[_0xfafd('0x16')](0x1f4,_0x3078f7['message']));});});};exports[_0xfafd('0x23')]=function(_0x58bb03){return new Promise(function(_0x42baaa,_0x536bad){return db['MailInteraction'][_0xfafd('0x24')]({'where':_0x58bb03[_0xfafd('0x1d')]?_0x58bb03[_0xfafd('0x1d')][_0xfafd('0x1f')]||null:null})['then'](function(_0x1cd059){if(_0x1cd059){return _0x1cd059['addTags'](_0x58bb03[_0xfafd('0x1c')]['ids'],_['omit'](_0x58bb03[_0xfafd('0x1c')],[_0xfafd('0x25'),'id'])||{});}})[_0xfafd('0x26')](function(_0x549ae0){logger['info']('AddTags',_0x58bb03);logger[_0xfafd('0x13')](_0xfafd('0x27'),_0x58bb03,JSON[_0xfafd('0x15')](_0x549ae0));_0x42baaa(_0x549ae0);})[_0xfafd('0x1a')](function(_0x4831f6){logger[_0xfafd('0x16')](_0xfafd('0x27'),_0x4831f6['message'],_0x58bb03);_0x536bad(_this[_0xfafd('0x16')](0x1f4,_0x4831f6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6ef6cf0..8298810 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 _0x67b2=['./mailInteraction.events','update','emit','length','mailInteraction:'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x67b2,0xa5));var _0x267b=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x67b2[_0x34eb31];return _0x254994;};'use strict';var MailInteractionEvents=require(_0x267b('0x0'));var events=['save','remove',_0x267b('0x1')];function createListener(_0x3805df,_0x46e897){return function(_0x36192b){_0x46e897[_0x267b('0x2')](_0x3805df,_0x36192b);};}function removeListener(_0x62319e,_0x5bbb12){return function(){MailInteractionEvents['removeListener'](_0x62319e,_0x5bbb12);};}exports['register']=function(_0x2aa199){for(var _0x538673=0x0,_0x130f06=events[_0x267b('0x3')];_0x538673<_0x130f06;_0x538673++){var _0x5a6328=events[_0x538673];var _0x1178f4=createListener(_0x267b('0x4')+_0x5a6328,_0x2aa199);MailInteractionEvents['on'](_0x5a6328,_0x1178f4);}}; \ No newline at end of file +var _0x461f=['remove','emit','length','./mailInteraction.events','save'];(function(_0x58ac88,_0x4495be){var _0x1d2cb9=function(_0x33c1e9){while(--_0x33c1e9){_0x58ac88['push'](_0x58ac88['shift']());}};_0x1d2cb9(++_0x4495be);}(_0x461f,0x12f));var _0xf461=function(_0x33f1e2,_0x2111bb){_0x33f1e2=_0x33f1e2-0x0;var _0x581421=_0x461f[_0x33f1e2];return _0x581421;};'use strict';var MailInteractionEvents=require(_0xf461('0x0'));var events=[_0xf461('0x1'),_0xf461('0x2'),'update'];function createListener(_0xebe0a0,_0x5ad96c){return function(_0x47a76b){_0x5ad96c[_0xf461('0x3')](_0xebe0a0,_0x47a76b);};}function removeListener(_0x5ac519,_0x8225b){return function(){MailInteractionEvents['removeListener'](_0x5ac519,_0x8225b);};}exports['register']=function(_0x259c90){for(var _0x44f7ae=0x0,_0x33edc1=events[_0xf461('0x4')];_0x44f7ae<_0x33edc1;_0x44f7ae++){var _0x527f7d=events[_0x44f7ae];var _0x3aff8e=createListener('mailInteraction:'+_0x527f7d,_0x259c90);MailInteractionEvents['on'](_0x527f7d,_0x3aff8e);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 8bedd20..8ab9340 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7181=['isAuthenticated','describe','exports','express','Router','/describe'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x7181,0x1ef));var _0x1718=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0x7181[_0x3cf387];return _0x24425f;};'use strict';var express=require(_0x1718('0x0'));var router=express[_0x1718('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router['get'](_0x1718('0x2'),auth[_0x1718('0x3')](),controller[_0x1718('0x4')]);module[_0x1718('0x5')]=router; \ No newline at end of file +var _0x1cfd=['isAuthenticated','describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x196b05,_0x2021f4){var _0x4f6d82=function(_0x56431e){while(--_0x56431e){_0x196b05['push'](_0x196b05['shift']());}};_0x4f6d82(++_0x2021f4);}(_0x1cfd,0x1db));var _0xd1cf=function(_0x38dea6,_0x35b3af){_0x38dea6=_0x38dea6-0x0;var _0x48a705=_0x1cfd[_0x38dea6];return _0x48a705;};'use strict';var express=require(_0xd1cf('0x0'));var router=express[_0xd1cf('0x1')]();var auth=require(_0xd1cf('0x2'));var controller=require(_0xd1cf('0x3'));router[_0xd1cf('0x4')]('/describe',auth[_0xd1cf('0x5')](),controller[_0xd1cf('0x6')]);module[_0xd1cf('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 135e2a9..8560251 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x315476,_0x2eba41){var _0x30ed85=function(_0x17e9aa){while(--_0x17e9aa){_0x315476['push'](_0x315476['shift']());}};_0x30ed85(++_0x2eba41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x100f4f,_0x2d176c){var _0x2bac61=function(_0x115a18){while(--_0x115a18){_0x100f4f['push'](_0x100f4f['shift']());}};_0x2bac61(++_0x2d176c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index b0e3eb4..14cc8e8 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7c1=['sequelize','exports','INTEGER'];(function(_0x1293fa,_0x446d6b){var _0x1dd054=function(_0x1b2d93){while(--_0x1b2d93){_0x1293fa['push'](_0x1293fa['shift']());}};_0x1dd054(++_0x446d6b);}(_0xa7c1,0x144));var _0x1a7c=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xa7c1[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0x1a7c('0x0'));module[_0x1a7c('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x1a7c('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xc472=['sequelize','exports'];(function(_0x25ab51,_0x4f84f5){var _0x3b4aa0=function(_0x23dd86){while(--_0x23dd86){_0x25ab51['push'](_0x25ab51['shift']());}};_0x3b4aa0(++_0x4f84f5);}(_0xc472,0xb6));var _0x2c47=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc472[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x2c47('0x0'));module[_0x2c47('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 5223e0e..17ad720 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc16a=['./mailInteractionHasTag','exports','define','MailInteractionHasTag','mail_interaction_has_tags'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc16a,0x136));var _0xac16=function(_0x3a5cf4,_0x773b69){_0x3a5cf4=_0x3a5cf4-0x0;var _0x488364=_0xc16a[_0x3a5cf4];return _0x488364;};'use strict';var attributes=require(_0xac16('0x0'));module[_0xac16('0x1')]=function(_0x48cdb6){return _0x48cdb6[_0xac16('0x2')](_0xac16('0x3'),attributes,{'tableName':_0xac16('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1e0=['./mailInteractionHasTag','define','mail_interaction_has_tags'];(function(_0x386ddd,_0x17ead6){var _0x1aeeb2=function(_0x397bae){while(--_0x397bae){_0x386ddd['push'](_0x386ddd['shift']());}};_0x1aeeb2(++_0x17ead6);}(_0xa1e0,0x153));var _0x0a1e=function(_0xe94eed,_0x5bc55d){_0xe94eed=_0xe94eed-0x0;var _0x5c5150=_0xa1e0[_0xe94eed];return _0x5c5150;};'use strict';var attributes=require(_0x0a1e('0x0'));module['exports']=function(_0x389d7a){return _0x389d7a[_0x0a1e('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0x0a1e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index fb32212..04d01d0 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 _0x136c=['tracked','mail','put','update','accept','/:id/reject','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post'];(function(_0x134901,_0x5145a5){var _0x165c06=function(_0x521e33){while(--_0x521e33){_0x134901['push'](_0x134901['shift']());}};_0x165c06(++_0x5145a5);}(_0x136c,0x1d2));var _0xc136=function(_0x2c2a98,_0x1b0613){_0x2c2a98=_0x2c2a98-0x0;var _0x5170ba=_0x136c[_0x2c2a98];return _0x5170ba;};'use strict';var multer=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var path=require('path');var timeout=require(_0xc136('0x2'));var express=require(_0xc136('0x3'));var router=express[_0xc136('0x4')]();var fs_extra=require(_0xc136('0x5'));var auth=require(_0xc136('0x6'));var interaction=require(_0xc136('0x7'));var config=require(_0xc136('0x8'));var controller=require(_0xc136('0x9'));router[_0xc136('0xa')]('/',auth['isAuthenticated'](),controller[_0xc136('0xb')]);router['get'](_0xc136('0xc'),auth[_0xc136('0xd')](),controller[_0xc136('0xe')]);router['get'](_0xc136('0xf'),auth['isAuthenticated'](),controller[_0xc136('0x10')]);router[_0xc136('0xa')](_0xc136('0x11'),auth[_0xc136('0xd')](),controller[_0xc136('0x12')]);router[_0xc136('0x13')]('/',auth[_0xc136('0xd')](),interaction[_0xc136('0x14')](_0xc136('0x15'),'mailmessage:create'),controller['create']);router[_0xc136('0x16')]('/:id',auth[_0xc136('0xd')](),controller[_0xc136('0x17')]);router[_0xc136('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc136('0x18')]);router[_0xc136('0x16')](_0xc136('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0xc136('0x1a')](_0xc136('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2083=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','/:id/download','download','post','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x83569f,_0x7f59a6){var _0x47fc5e=function(_0x3cb322){while(--_0x3cb322){_0x83569f['push'](_0x83569f['shift']());}};_0x47fc5e(++_0x7f59a6);}(_0x2083,0x137));var _0x3208=function(_0x18f7b3,_0x53d23e){_0x18f7b3=_0x18f7b3-0x0;var _0xe54b36=_0x2083[_0x18f7b3];return _0xe54b36;};'use strict';var multer=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var path=require('path');var timeout=require(_0x3208('0x2'));var express=require(_0x3208('0x3'));var router=express[_0x3208('0x4')]();var fs_extra=require(_0x3208('0x5'));var auth=require(_0x3208('0x6'));var interaction=require(_0x3208('0x7'));var config=require(_0x3208('0x8'));var controller=require('./mailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3208('0x9')]);router[_0x3208('0xa')](_0x3208('0xb'),auth[_0x3208('0xc')](),controller['describe']);router[_0x3208('0xa')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller['show']);router['get'](_0x3208('0xe'),auth[_0x3208('0xc')](),controller[_0x3208('0xf')]);router[_0x3208('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3208('0x11'),_0x3208('0x12')),controller[_0x3208('0x13')]);router[_0x3208('0x14')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller[_0x3208('0x15')]);router[_0x3208('0x14')](_0x3208('0x16'),auth[_0x3208('0xc')](),controller[_0x3208('0x17')]);router[_0x3208('0x14')](_0x3208('0x18'),auth[_0x3208('0xc')](),controller['reject']);router[_0x3208('0x19')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller[_0x3208('0x1a')]);module[_0x3208('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 94a0932..edbeac2 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 _0x043a=['BOOLEAN','ENUM','out','STRING','long','DATE','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x043a,0x17c));var _0xa043=function(_0x359284,_0x4950d6){_0x359284=_0x359284-0x0;var _0x5298a4=_0x043a[_0x359284];return _0x5298a4;};'use strict';var Sequelize=require(_0xa043('0x0'));var _=require(_0xa043('0x1'));module[_0xa043('0x2')]={'body':{'type':Sequelize[_0xa043('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa043('0x3')]('medium')},'read':{'type':Sequelize[_0xa043('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa043('0x5')]('in',_0xa043('0x6')),'defaultValue':_0xa043('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa043('0x7')](0x1fe)},'from':{'type':Sequelize[_0xa043('0x7')]},'to':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'cc':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'bcc':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa043('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa043('0x9')]},'originTo':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'originCc':{'type':Sequelize[_0xa043('0x3')](_0xa043('0x8'))},'originChannel':{'type':Sequelize[_0xa043('0x5')](_0xa043('0xa'),_0xa043('0xb')),'defaultValue':_0xa043('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xb45e=['medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT'];(function(_0x1e6bcf,_0x372752){var _0x420ccb=function(_0x38bc5c){while(--_0x38bc5c){_0x1e6bcf['push'](_0x1e6bcf['shift']());}};_0x420ccb(++_0x372752);}(_0xb45e,0xe6));var _0xeb45=function(_0x1e9442,_0x18bbd8){_0x1e9442=_0x1e9442-0x0;var _0x403575=_0xb45e[_0x1e9442];return _0x403575;};'use strict';var Sequelize=require(_0xeb45('0x0'));var _=require(_0xeb45('0x1'));module[_0xeb45('0x2')]={'body':{'type':Sequelize[_0xeb45('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xeb45('0x3')](_0xeb45('0x4'))},'read':{'type':Sequelize[_0xeb45('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeb45('0x6')]('in',_0xeb45('0x7')),'defaultValue':_0xeb45('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xeb45('0x8')](0x1fe)},'from':{'type':Sequelize[_0xeb45('0x8')]},'to':{'type':Sequelize[_0xeb45('0x3')]('long')},'cc':{'type':Sequelize['TEXT'](_0xeb45('0x9'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xeb45('0x3')]},'sentAt':{'type':Sequelize[_0xeb45('0xa')]},'attach':{'type':Sequelize[_0xeb45('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xeb45('0xa')]},'originTo':{'type':Sequelize[_0xeb45('0x3')](_0xeb45('0x9'))},'originCc':{'type':Sequelize[_0xeb45('0x3')](_0xeb45('0x9'))},'originChannel':{'type':Sequelize[_0xeb45('0x6')](_0xeb45('0xc'),'Chat'),'defaultValue':_0xeb45('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 fbfb672..dc68da1 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 _0xd218=['../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','json','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','show','length','includeAll','MailMessage','find','update','body','params','describe','create','direction','secret','split','findOne','List','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','UserId','user','agent','get','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','reject','fromString','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','subject','createdAt','decode','headers','Bcc','Attachments','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','mail-interactions'];(function(_0xc46cfe,_0x538ade){var _0x1d4574=function(_0x2373fe){while(--_0x2373fe){_0xc46cfe['push'](_0xc46cfe['shift']());}};_0x1d4574(++_0x538ade);}(_0xd218,0x1b4));var _0x8d21=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xd218[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0x8d21('0x0'));var moment=require(_0x8d21('0x1'));var util=require(_0x8d21('0x2'));var path=require(_0x8d21('0x3'));var fs=require('fs');var _=require(_0x8d21('0x4'));var Redis=require(_0x8d21('0x5'));var htmlToText=require(_0x8d21('0x6'));var interactionService=require(_0x8d21('0x7'));var qs=require(_0x8d21('0x8'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x8d21('0x9'))(_0x8d21('0xa'));var config=require(_0x8d21('0xb'));var db=require('../../mysqldb')['db'];config[_0x8d21('0xc')]=_[_0x8d21('0xd')](config[_0x8d21('0xc')],{'host':_0x8d21('0xe'),'port':0x18eb});var socket=require(_0x8d21('0xf'))(new Redis(config[_0x8d21('0xc')]));var htmlEntities=require(_0x8d21('0x10'));require('./mailMessage.socket')[_0x8d21('0x11')](socket);var jayson=require(_0x8d21('0x12'));var client=jayson[_0x8d21('0x13')][_0x8d21('0x14')]({'port':0x232c});var client9003=jayson['client'][_0x8d21('0x14')]({'port':0x232b});var client9002=jayson[_0x8d21('0x13')][_0x8d21('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x449c7b,_0xbcef4a,_0x1b2736,_0x3e6aaf){return new Promise(function(_0x35828c,_0x3a6081){var _0x528c58=_0x3e6aaf||client;return _0x528c58[_0x8d21('0x15')](_0x449c7b,_0x1b2736)['then'](function(_0x1062ba){logger[_0x8d21('0x16')](_0x8d21('0x17'),_0xbcef4a,_0x8d21('0x18'));logger[_0x8d21('0x19')](_0x8d21('0x1a'),_0xbcef4a,_0x8d21('0x18'),JSON[_0x8d21('0x1b')](_0x1062ba));if(_0x1062ba[_0x8d21('0x1c')]){if(_0x1062ba['error'][_0x8d21('0x1d')]===0x1f4){logger[_0x8d21('0x1c')]('MailMessage,\x20%s,\x20%s',_0xbcef4a,_0x1062ba[_0x8d21('0x1c')][_0x8d21('0x1e')]);return _0x3a6081(_0x1062ba[_0x8d21('0x1c')][_0x8d21('0x1e')]);}logger['error'](_0x8d21('0x17'),_0xbcef4a,_0x1062ba['error'][_0x8d21('0x1e')]);return _0x35828c(_0x1062ba[_0x8d21('0x1c')][_0x8d21('0x1e')]);}else{logger[_0x8d21('0x16')]('MailMessage,\x20%s,\x20%s',_0xbcef4a,_0x8d21('0x18'));_0x35828c(_0x1062ba[_0x8d21('0x1f')][_0x8d21('0x1e')]);}})[_0x8d21('0x20')](function(_0x4dd57c){logger[_0x8d21('0x1c')](_0x8d21('0x17'),_0xbcef4a,_0x4dd57c);_0x3a6081(_0x4dd57c);});});}function respondWithResult(_0x1cd857,_0x32c444){_0x32c444=_0x32c444||0xc8;return function(_0x3d9cf1){if(_0x3d9cf1){return _0x1cd857[_0x8d21('0x21')](_0x32c444)['json'](_0x3d9cf1);}};}function respondWithFilteredResult(_0x25059a,_0x4b42ca){return function(_0x1c2ea9){if(_0x1c2ea9){var _0x58b73c=typeof _0x4b42ca[_0x8d21('0x22')]===_0x8d21('0x23')&&typeof _0x4b42ca[_0x8d21('0x24')]===_0x8d21('0x23');var _0x45310b=_0x1c2ea9[_0x8d21('0x25')];var _0x2ebba2=_0x58b73c?0x0:_0x4b42ca[_0x8d21('0x22')];var _0x249aaa=_0x58b73c?_0x1c2ea9[_0x8d21('0x25')]:_0x4b42ca['offset']+_0x4b42ca[_0x8d21('0x24')];var _0x5c6b99;if(_0x249aaa>=_0x45310b){_0x249aaa=_0x45310b;_0x5c6b99=0xc8;}else{_0x5c6b99=0xce;}_0x25059a[_0x8d21('0x21')](_0x5c6b99);return _0x25059a[_0x8d21('0x26')]('Content-Range',_0x2ebba2+'-'+_0x249aaa+'/'+_0x45310b)[_0x8d21('0x27')](_0x1c2ea9);}return null;};}function saveUpdates(_0x57b205){return function(_0x231766){if(_0x231766){return _0x231766['update'](_0x57b205)[_0x8d21('0x28')](function(_0x322767){return _0x322767;});}return null;};}function removeEntity(_0x40e32f){return function(_0x23083f){if(_0x23083f){return _0x23083f['destroy']()[_0x8d21('0x28')](function(){_0x40e32f[_0x8d21('0x21')](0xcc)[_0x8d21('0x29')]();});}};}function handleEntityNotFound(_0x2f1e8a){return function(_0x38d186){if(!_0x38d186){_0x2f1e8a['sendStatus'](0x194);}return _0x38d186;};}function handleError(_0x4f65ff,_0x3421c5){_0x3421c5=_0x3421c5||0x1f4;return function(_0x1a7f0c){logger[_0x8d21('0x1c')](_0x1a7f0c[_0x8d21('0x2a')]);if(_0x1a7f0c[_0x8d21('0x2b')]){delete _0x1a7f0c[_0x8d21('0x2b')];}_0x4f65ff['status'](_0x3421c5)[_0x8d21('0x2c')](_0x1a7f0c);};}exports[_0x8d21('0x2d')]=function(_0x54f777,_0x5298aa){var _0x5956a8={},_0x5518b={},_0x3768ae={'count':0x0,'rows':[]};var _0x67ec07=_[_0x8d21('0x2e')](db['MailMessage'][_0x8d21('0x2f')],function(_0x1f3ba9){return{'name':_0x1f3ba9[_0x8d21('0x30')],'type':_0x1f3ba9[_0x8d21('0x31')]['key']};});_0x5518b[_0x8d21('0x32')]=_[_0x8d21('0x2e')](_0x67ec07,'name');_0x5518b[_0x8d21('0x33')]=_[_0x8d21('0x34')](_0x54f777[_0x8d21('0x33')]);_0x5518b['filters']=_['intersection'](_0x5518b[_0x8d21('0x32')],_0x5518b[_0x8d21('0x33')]);_0x5956a8[_0x8d21('0x35')]=_[_0x8d21('0x36')](_0x5518b[_0x8d21('0x32')],qs[_0x8d21('0x37')](_0x54f777[_0x8d21('0x33')]['fields']));_0x5956a8[_0x8d21('0x35')]=_0x5956a8[_0x8d21('0x35')]['length']?_0x5956a8[_0x8d21('0x35')]:_0x5518b[_0x8d21('0x32')];if(!_0x54f777[_0x8d21('0x33')][_0x8d21('0x38')]('nolimit')){_0x5956a8[_0x8d21('0x24')]=qs['limit'](_0x54f777[_0x8d21('0x33')][_0x8d21('0x24')]);_0x5956a8['offset']=qs[_0x8d21('0x22')](_0x54f777['query']['offset']);}_0x5956a8[_0x8d21('0x39')]=qs[_0x8d21('0x3a')](_0x54f777[_0x8d21('0x33')][_0x8d21('0x3a')]);_0x5956a8[_0x8d21('0x3b')]=qs[_0x8d21('0x3c')](_['pick'](_0x54f777[_0x8d21('0x33')],_0x5518b['filters']),_0x67ec07);if(_0x54f777[_0x8d21('0x33')][_0x8d21('0x3d')]){_0x5956a8[_0x8d21('0x3b')]=_[_0x8d21('0x3e')](_0x5956a8['where'],{'$or':_['map'](_0x67ec07,function(_0x32cccf){if(_0x32cccf['type']!==_0x8d21('0x3f')){var _0x4f6781={};_0x4f6781[_0x32cccf[_0x8d21('0x2b')]]={'$like':'%'+_0x54f777[_0x8d21('0x33')][_0x8d21('0x3d')]+'%'};return _0x4f6781;}})});}_0x5956a8=_['merge']({},_0x5956a8,_0x54f777[_0x8d21('0x40')]);var _0x38448e={'where':_0x5956a8['where']};return db['MailMessage'][_0x8d21('0x25')](_0x38448e)[_0x8d21('0x28')](function(_0x2aca6d){_0x3768ae[_0x8d21('0x25')]=_0x2aca6d;if(_0x54f777[_0x8d21('0x33')]['includeAll']){_0x5956a8['include']=[{'all':!![]}];}return db['MailMessage'][_0x8d21('0x41')](_0x5956a8);})[_0x8d21('0x28')](function(_0x135998){_0x3768ae[_0x8d21('0x42')]=_0x135998;return _0x3768ae;})['then'](respondWithFilteredResult(_0x5298aa,_0x5956a8))['catch'](handleError(_0x5298aa,null));};exports[_0x8d21('0x43')]=function(_0x57c588,_0x561650){var _0x5576dd={'raw':!![],'where':{'id':_0x57c588['params']['id']}},_0x50094b={};_0x50094b['model']=_[_0x8d21('0x34')](db['MailMessage'][_0x8d21('0x2f')]);_0x50094b['query']=_[_0x8d21('0x34')](_0x57c588['query']);_0x50094b[_0x8d21('0x3c')]=_['intersection'](_0x50094b[_0x8d21('0x32')],_0x50094b[_0x8d21('0x33')]);_0x5576dd[_0x8d21('0x35')]=_[_0x8d21('0x36')](_0x50094b['model'],qs[_0x8d21('0x37')](_0x57c588[_0x8d21('0x33')][_0x8d21('0x37')]));_0x5576dd[_0x8d21('0x35')]=_0x5576dd[_0x8d21('0x35')][_0x8d21('0x44')]?_0x5576dd[_0x8d21('0x35')]:_0x50094b[_0x8d21('0x32')];if(_0x57c588[_0x8d21('0x33')][_0x8d21('0x45')]){_0x5576dd['include']=[{'all':!![]}];}_0x5576dd=_[_0x8d21('0x3e')]({},_0x5576dd,_0x57c588[_0x8d21('0x40')]);return db[_0x8d21('0x46')][_0x8d21('0x47')](_0x5576dd)[_0x8d21('0x28')](handleEntityNotFound(_0x561650,null))[_0x8d21('0x28')](respondWithResult(_0x561650,null))[_0x8d21('0x20')](handleError(_0x561650,null));};exports[_0x8d21('0x48')]=function(_0x4bb8d0,_0x2882a5){if(_0x4bb8d0[_0x8d21('0x49')]['id']){delete _0x4bb8d0[_0x8d21('0x49')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4bb8d0[_0x8d21('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2882a5,null))[_0x8d21('0x28')](saveUpdates(_0x4bb8d0[_0x8d21('0x49')],null))[_0x8d21('0x28')](respondWithResult(_0x2882a5,null))[_0x8d21('0x20')](handleError(_0x2882a5,null));};exports['destroy']=function(_0xdad9d9,_0x2aed30){return db[_0x8d21('0x46')][_0x8d21('0x47')]({'where':{'id':_0xdad9d9[_0x8d21('0x4a')]['id']}})[_0x8d21('0x28')](handleEntityNotFound(_0x2aed30,null))[_0x8d21('0x28')](removeEntity(_0x2aed30,null))['catch'](handleError(_0x2aed30,null));};exports[_0x8d21('0x4b')]=function(_0x52b6a5,_0x3dbe96){return db['MailMessage'][_0x8d21('0x4b')]()[_0x8d21('0x28')](respondWithResult(_0x3dbe96,null))['catch'](handleError(_0x3dbe96,null));};exports[_0x8d21('0x4c')]=function(_0x175ccc,_0x83245){return db['MailMessage'][_0x8d21('0x4c')](_0x175ccc[_0x8d21('0x49')])[_0x8d21('0x28')](function(_0x4db14c){if(_0x4db14c){if(_0x4db14c[_0x8d21('0x4d')]==='out'&&!_0x4db14c[_0x8d21('0x4e')]){var _0x4aacbf,_0x550b3f,_0x81914b;if(_0x175ccc['body']['to']){_0x550b3f=_0x175ccc[_0x8d21('0x49')]['to'][_0x8d21('0x4f')](',')[0x0];}return db['MailAccount'][_0x8d21('0x50')]({'where':{'id':_0x4db14c['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x8d21('0x51'),'include':[{'model':db[_0x8d21('0x52')],'as':_0x8d21('0x53'),'where':{'email':_0x550b3f},'limit':0x1,'order':[[_0x8d21('0x54'),_0x8d21('0x55')]]}]},{'model':db['MailServerOut'],'as':_0x8d21('0x56'),'raw':!![],'include':[{'model':db[_0x8d21('0x57')],'as':_0x8d21('0x57'),'raw':!![]}]}]})[_0x8d21('0x28')](function(_0x2e59a9){_0x4aacbf=_0x2e59a9;if(!_0x4aacbf||!_0x4aacbf[_0x8d21('0x56')])return;var _0x48b0ad=_0x4aacbf['getSmtpOptions']();if(_0x175ccc[_0x8d21('0x49')][_0x8d21('0x58')]&&_0x175ccc[_0x8d21('0x49')][_0x8d21('0x58')][_0x8d21('0x44')]){for(var _0xa83e32=0x0;_0xa83e32<_0x175ccc[_0x8d21('0x49')][_0x8d21('0x58')]['length'];_0xa83e32+=0x1){_0x175ccc[_0x8d21('0x49')]['attachments'][_0xa83e32]={'filename':_0x175ccc['body'][_0x8d21('0x58')][_0xa83e32][_0x8d21('0x2b')],'path':path[_0x8d21('0x59')](config[_0x8d21('0x5a')],_0x8d21('0x5b'),_0x175ccc[_0x8d21('0x49')][_0x8d21('0x58')][_0xa83e32][_0x8d21('0x5c')])};}}_0x81914b={'account':_0x48b0ad,'message':_0x175ccc[_0x8d21('0x49')]};return;})[_0x8d21('0x28')](function(){if(_0x4aacbf['List']){if(_0x4aacbf[_0x8d21('0x51')]['Contacts'][_0x8d21('0x44')]){return _0x4aacbf[_0x8d21('0x51')][_0x8d21('0x53')][0x0];}else{return db[_0x8d21('0x52')][_0x8d21('0x4c')](_[_0x8d21('0xd')](_0x175ccc[_0x8d21('0x49')],{'firstName':_0x175ccc['body']['to'],'email':_0x175ccc[_0x8d21('0x49')]['to'],'phone':_0x175ccc[_0x8d21('0x49')]['to'],'ListId':_0x4aacbf['ListId']}));}}else{throw new Error(_0x8d21('0x5d'));}})['then'](function(){if(_0x81914b){return respondWithRpcPromise(_0x8d21('0x5e'),_0x8d21('0x5f'),_0x81914b,client9003)['then'](function(_0x2fa5d2){return _0x4db14c[_0x8d21('0x48')]({'read':!![],'messageId':_0x2fa5d2['messageId'],'sentAt':moment()[_0x8d21('0x60')](_0x8d21('0x61'))});})[_0x8d21('0x20')](function(_0x36232f){logger[_0x8d21('0x1c')]('%s',JSON[_0x8d21('0x1b')](_0x36232f));return _0x4db14c;});}return _0x4db14c;});}return _0x4db14c;}})['then'](respondWithResult(_0x83245,0xc9))[_0x8d21('0x20')](handleError(_0x83245,null));};exports[_0x8d21('0x62')]=function(_0x12af71,_0x587c13){var _0x38239e=_0x8d21('0x63');return interactionService[_0x8d21('0x64')](_0x12af71,_0x38239e)[_0x8d21('0x28')](respondWithResult(_0x587c13,null))[_0x8d21('0x20')](handleError(_0x587c13,null));};exports['reject']=function(_0x26fa47,_0x21f12d){var _0x7e0c70={'agent':{},'channel':_0x8d21('0x63')};if(_0x26fa47['body']['id']){delete _0x26fa47[_0x8d21('0x49')]['id'];}_0x26fa47['body'][_0x8d21('0x65')]=_0x26fa47[_0x8d21('0x49')][_0x8d21('0x65')]||_0x26fa47[_0x8d21('0x66')]['id'];_0x7e0c70[_0x8d21('0x67')]['id']=_0x26fa47[_0x8d21('0x49')][_0x8d21('0x65')];return db[_0x8d21('0x46')]['find']({'where':{'id':_0x26fa47[_0x8d21('0x4a')]['id'],'UserId':null}})[_0x8d21('0x28')](handleEntityNotFound(_0x21f12d,null))[_0x8d21('0x28')](function(_0x3beb2c){if(_0x3beb2c){_0x7e0c70[_0x8d21('0x1e')]=_0x3beb2c[_0x8d21('0x68')]({'plain':!![]});return db['MailInteraction'][_0x8d21('0x47')]({'where':{'id':_0x3beb2c[_0x8d21('0x69')]}});}return null;})[_0x8d21('0x28')](handleEntityNotFound(_0x21f12d,null))[_0x8d21('0x28')](function(_0x13540c){if(_0x13540c){_0x7e0c70['interaction']=_0x13540c[_0x8d21('0x68')]({'plain':!![]});interaction_log[_0x8d21('0x16')](_0x8d21('0x6a'),_0x26fa47[_0x8d21('0x66')]['id'],_0x26fa47[_0x8d21('0x66')]['name'],_0x26fa47[_0x8d21('0x66')][_0x8d21('0x6b')],_0x7e0c70[_0x8d21('0x6c')]['id'],_0x26fa47[_0x8d21('0x49')]?JSON[_0x8d21('0x1b')](_0x26fa47[_0x8d21('0x49')]):_0x8d21('0x6d'));return respondWithRpcPromise(_0x8d21('0x6e'),_0x8d21('0x6f'),_0x7e0c70);}return null;})[_0x8d21('0x28')](function(_0x5115d2){var _0x4b0c34=_0x8d21('0x70')+_0x5115d2[_0x8d21('0x1e')][_0x8d21('0x71')];return db[_0x8d21('0x72')][_0x8d21('0x33')](_0x4b0c34,{'type':db[_0x8d21('0x73')]['QueryTypes'][_0x8d21('0x74')],'raw':!![]})[_0x8d21('0x28')](function(_0x1c8bd9){return _0x1c8bd9;});})[_0x8d21('0x28')](function(_0x5dc403){if(_0x5dc403){_0x7e0c70[_0x8d21('0x1e')][_0x8d21('0x75')]=_0x5dc403[0x0];if(!_0x26fa47[_0x8d21('0x49')][_0x8d21('0x65')])return;return db[_0x8d21('0x76')][_0x8d21('0x47')]({'where':{'id':_0x26fa47['body'][_0x8d21('0x65')],'role':_0x8d21('0x67')},'attributes':['id','name',_0x8d21('0x77'),_0x8d21('0x78'),_0x8d21('0x79')],'raw':!![]});}return null;})[_0x8d21('0x28')](function(_0x4e6a42){if(!_0x4e6a42)return null;_0x7e0c70[_0x8d21('0x1e')][_0x8d21('0x67')]=_0x4e6a42;return _0x7e0c70;})[_0x8d21('0x28')](function(_0x272694){if(_0x272694){_0x272694['message'][_0x8d21('0x7a')]=util['format'](_0x8d21('0x7b'),_0x26fa47[_0x8d21('0x66')]['name']);_0x272694['message'][_0x8d21('0x7c')]=_0x7e0c70[_0x8d21('0x7c')];_0x272694[_0x8d21('0x1e')][_0x8d21('0x7d')]=_0x7e0c70[_0x8d21('0x7c')];_0x272694[_0x8d21('0x1e')][_0x8d21('0x7e')]=_0x8d21('0x7f');_0x272694[_0x8d21('0x1e')][_0x8d21('0x49')]=htmlToText[_0x8d21('0x80')](_0x7e0c70[_0x8d21('0x1e')][_0x8d21('0x49')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0x8d21('0x81'),'message':_0x272694[_0x8d21('0x1e')]},client9002);return _0x7e0c70;}return null;})[_0x8d21('0x28')](respondWithResult(_0x21f12d,null))[_0x8d21('0x20')](handleError(_0x21f12d,null));};exports[_0x8d21('0x82')]=function(_0x2c7b95,_0x525935){var _0x2db078=moment()[_0x8d21('0x83')]()[_0x8d21('0x84')]();var _0x240b9b=path[_0x8d21('0x59')](config[_0x8d21('0x5a')],_0x8d21('0x85'),_0x8d21('0x86'),_0x8d21('0x87'));var _0x165866=path[_0x8d21('0x59')](config['root'],_0x8d21('0x85'),_0x8d21('0x86'),_0x8d21('0x58'));var _0x50fa8e=util[_0x8d21('0x60')]('message-%s.eml',_0x2db078);return db[_0x8d21('0x46')][_0x8d21('0x47')]({'where':{'id':_0x2c7b95[_0x8d21('0x4a')]['id']},'attributes':['id',_0x8d21('0x49'),_0x8d21('0x88'),'to','cc',_0x8d21('0x89'),_0x8d21('0x8a'),_0x8d21('0x8b')],'include':_0x2c7b95[_0x8d21('0x33')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x525935,null))[_0x8d21('0x28')](function(_0x3a1dc4){if(_0x3a1dc4){var _0x1fc9cf=_0x3a1dc4;var _0x5d958f={'from':_0x1fc9cf[_0x8d21('0x88')],'to':_0x1fc9cf['to'],'subject':_0x1fc9cf['subject'],'html':htmlEntities[_0x8d21('0x8c')](_0x1fc9cf[_0x8d21('0x49')]),'headers':{'Date':moment(_0x1fc9cf[_0x8d21('0x8b')])[_0x8d21('0x60')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3a1dc4['cc']){_0x5d958f[_0x8d21('0x8d')]['Cc']=_0x3a1dc4['cc'];}if(_0x3a1dc4[_0x8d21('0x89')]){_0x5d958f[_0x8d21('0x8d')][_0x8d21('0x8e')]=_0x3a1dc4[_0x8d21('0x89')];}return new Promise(function(_0xe8b6b8,_0x25d2de){if(_0x3a1dc4[_0x8d21('0x8f')]){for(var _0x14afb8=0x0;_0x14afb8<_0x3a1dc4[_0x8d21('0x8f')][_0x8d21('0x44')];_0x14afb8++){var _0x4d04fd=_0x3a1dc4[_0x8d21('0x8f')][_0x14afb8];var _0x5d2bdc=path['join'](_0x165866,_0x4d04fd[_0x8d21('0x5c')]);if(fs[_0x8d21('0x90')](_0x5d2bdc)){_0x5d958f[_0x8d21('0x58')]['push']({'name':_0x4d04fd['name'],'contentType':_0x4d04fd[_0x8d21('0x31')],'data':fs[_0x8d21('0x91')](_0x5d2bdc)});}}}emlformat[_0x8d21('0x92')](_0x5d958f,function(_0x23166c,_0x1a1d54){if(_0x23166c)return _0x25d2de(_0x23166c);fs[_0x8d21('0x93')](path[_0x8d21('0x59')](_0x240b9b,_0x50fa8e),_0x1a1d54);return _0xe8b6b8(_0x1a1d54);});});}})[_0x8d21('0x28')](function(_0x5684d0){if(_0x5684d0){return _0x525935[_0x8d21('0x82')](path['join'](_0x240b9b,_0x50fa8e),_0x50fa8e,function(_0x79f886){if(!_0x79f886)fs[_0x8d21('0x94')](path[_0x8d21('0x59')](_0x240b9b,_0x50fa8e));});}})['catch'](handleError(_0x525935,null));}; \ No newline at end of file +var _0xb692=['update','then','destroy','end','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','includeAll','findAll','rows','show','find','body','params','create','out','secret','split','findOne','MailAccountId','CmList','CmContact','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','reject','UserId','user','agent','MailInteraction','MailInteractionId','interaction','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','fromString','EventManager','download','unix','toString','join','server','files','message-%s.eml','from','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','moment','util','lodash','ioredis','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','limit','status','Content-Range'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0xb692,0x72));var _0x2b69=function(_0x13bea0,_0x210a0c){_0x13bea0=_0x13bea0-0x0;var _0x3f12df=_0xb692[_0x13bea0];return _0x3f12df;};'use strict';var emlformat=require('eml-format');var moment=require(_0x2b69('0x0'));var util=require(_0x2b69('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x2b69('0x2'));var Redis=require(_0x2b69('0x3'));var htmlToText=require(_0x2b69('0x4'));var interactionService=require(_0x2b69('0x5'));var qs=require(_0x2b69('0x6'));var logger=require(_0x2b69('0x7'))('api');var interaction_log=require(_0x2b69('0x7'))('mail-interactions');var config=require(_0x2b69('0x8'));var db=require(_0x2b69('0x9'))['db'];config[_0x2b69('0xa')]=_[_0x2b69('0xb')](config[_0x2b69('0xa')],{'host':_0x2b69('0xc'),'port':0x18eb});var socket=require(_0x2b69('0xd'))(new Redis(config[_0x2b69('0xa')]));var htmlEntities=require(_0x2b69('0xe'));require(_0x2b69('0xf'))[_0x2b69('0x10')](socket);var jayson=require(_0x2b69('0x11'));var client=jayson[_0x2b69('0x12')][_0x2b69('0x13')]({'port':0x232c});var client9003=jayson['client'][_0x2b69('0x13')]({'port':0x232b});var client9002=jayson[_0x2b69('0x12')][_0x2b69('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x38711b,_0x183f6b,_0x44c576,_0x3fcdc7){return new Promise(function(_0x23a32e,_0x2dff3c){var _0x4d76f1=_0x3fcdc7||client;return _0x4d76f1[_0x2b69('0x14')](_0x38711b,_0x44c576)['then'](function(_0x355652){logger[_0x2b69('0x15')]('MailMessage,\x20%s,\x20%s',_0x183f6b,_0x2b69('0x16'));logger[_0x2b69('0x17')](_0x2b69('0x18'),_0x183f6b,_0x2b69('0x16'),JSON[_0x2b69('0x19')](_0x355652));if(_0x355652[_0x2b69('0x1a')]){if(_0x355652[_0x2b69('0x1a')][_0x2b69('0x1b')]===0x1f4){logger['error'](_0x2b69('0x1c'),_0x183f6b,_0x355652[_0x2b69('0x1a')][_0x2b69('0x1d')]);return _0x2dff3c(_0x355652[_0x2b69('0x1a')]['message']);}logger[_0x2b69('0x1a')](_0x2b69('0x1c'),_0x183f6b,_0x355652[_0x2b69('0x1a')][_0x2b69('0x1d')]);return _0x23a32e(_0x355652['error'][_0x2b69('0x1d')]);}else{logger[_0x2b69('0x15')](_0x2b69('0x1c'),_0x183f6b,_0x2b69('0x16'));_0x23a32e(_0x355652[_0x2b69('0x1e')][_0x2b69('0x1d')]);}})[_0x2b69('0x1f')](function(_0x1f38da){logger[_0x2b69('0x1a')](_0x2b69('0x1c'),_0x183f6b,_0x1f38da);_0x2dff3c(_0x1f38da);});});}function respondWithResult(_0xffdd7c,_0x580670){_0x580670=_0x580670||0xc8;return function(_0x141820){if(_0x141820){return _0xffdd7c['status'](_0x580670)[_0x2b69('0x20')](_0x141820);}};}function respondWithFilteredResult(_0x3a2796,_0x124b68){return function(_0x2ca06f){if(_0x2ca06f){var _0x968d9e=typeof _0x124b68[_0x2b69('0x21')]===_0x2b69('0x22')&&typeof _0x124b68[_0x2b69('0x23')]===_0x2b69('0x22');var _0x4d96bf=_0x2ca06f['count'];var _0x37adb6=_0x968d9e?0x0:_0x124b68[_0x2b69('0x21')];var _0x2867be=_0x968d9e?_0x2ca06f['count']:_0x124b68[_0x2b69('0x21')]+_0x124b68[_0x2b69('0x23')];var _0x5a9eff;if(_0x2867be>=_0x4d96bf){_0x2867be=_0x4d96bf;_0x5a9eff=0xc8;}else{_0x5a9eff=0xce;}_0x3a2796[_0x2b69('0x24')](_0x5a9eff);return _0x3a2796['set'](_0x2b69('0x25'),_0x37adb6+'-'+_0x2867be+'/'+_0x4d96bf)[_0x2b69('0x20')](_0x2ca06f);}return null;};}function saveUpdates(_0x15d833){return function(_0x4ab679){if(_0x4ab679){return _0x4ab679[_0x2b69('0x26')](_0x15d833)[_0x2b69('0x27')](function(_0x450936){return _0x450936;});}return null;};}function removeEntity(_0x1fba84){return function(_0x1601bf){if(_0x1601bf){return _0x1601bf[_0x2b69('0x28')]()[_0x2b69('0x27')](function(){_0x1fba84['status'](0xcc)[_0x2b69('0x29')]();});}};}function handleEntityNotFound(_0x21326e){return function(_0x4af72a){if(!_0x4af72a){_0x21326e[_0x2b69('0x2a')](0x194);}return _0x4af72a;};}function handleError(_0x39ea0c,_0x542e11){_0x542e11=_0x542e11||0x1f4;return function(_0x5bcb7b){logger['error'](_0x5bcb7b['stack']);if(_0x5bcb7b[_0x2b69('0x2b')]){delete _0x5bcb7b['name'];}_0x39ea0c['status'](_0x542e11)[_0x2b69('0x2c')](_0x5bcb7b);};}exports['index']=function(_0x21bbbc,_0x1efccb){var _0x52b698={},_0x95ce3={},_0x105556={'count':0x0,'rows':[]};var _0x5dbeed=_[_0x2b69('0x2d')](db['MailMessage'][_0x2b69('0x2e')],function(_0x31f027){return{'name':_0x31f027[_0x2b69('0x2f')],'type':_0x31f027[_0x2b69('0x30')][_0x2b69('0x31')]};});_0x95ce3[_0x2b69('0x32')]=_[_0x2b69('0x2d')](_0x5dbeed,_0x2b69('0x2b'));_0x95ce3[_0x2b69('0x33')]=_[_0x2b69('0x34')](_0x21bbbc[_0x2b69('0x33')]);_0x95ce3[_0x2b69('0x35')]=_['intersection'](_0x95ce3[_0x2b69('0x32')],_0x95ce3[_0x2b69('0x33')]);_0x52b698[_0x2b69('0x36')]=_[_0x2b69('0x37')](_0x95ce3['model'],qs[_0x2b69('0x38')](_0x21bbbc[_0x2b69('0x33')][_0x2b69('0x38')]));_0x52b698[_0x2b69('0x36')]=_0x52b698['attributes'][_0x2b69('0x39')]?_0x52b698[_0x2b69('0x36')]:_0x95ce3['model'];if(!_0x21bbbc[_0x2b69('0x33')][_0x2b69('0x3a')](_0x2b69('0x3b'))){_0x52b698[_0x2b69('0x23')]=qs[_0x2b69('0x23')](_0x21bbbc['query'][_0x2b69('0x23')]);_0x52b698[_0x2b69('0x21')]=qs['offset'](_0x21bbbc[_0x2b69('0x33')]['offset']);}_0x52b698[_0x2b69('0x3c')]=qs['sort'](_0x21bbbc['query'][_0x2b69('0x3d')]);_0x52b698[_0x2b69('0x3e')]=qs[_0x2b69('0x35')](_[_0x2b69('0x3f')](_0x21bbbc[_0x2b69('0x33')],_0x95ce3[_0x2b69('0x35')]),_0x5dbeed);if(_0x21bbbc[_0x2b69('0x33')][_0x2b69('0x40')]){_0x52b698[_0x2b69('0x3e')]=_[_0x2b69('0x41')](_0x52b698[_0x2b69('0x3e')],{'$or':_[_0x2b69('0x2d')](_0x5dbeed,function(_0x10cb51){if(_0x10cb51[_0x2b69('0x30')]!==_0x2b69('0x42')){var _0xca246b={};_0xca246b[_0x10cb51[_0x2b69('0x2b')]]={'$like':'%'+_0x21bbbc[_0x2b69('0x33')][_0x2b69('0x40')]+'%'};return _0xca246b;}})});}_0x52b698=_['merge']({},_0x52b698,_0x21bbbc[_0x2b69('0x43')]);var _0x285bce={'where':_0x52b698[_0x2b69('0x3e')]};return db[_0x2b69('0x44')]['count'](_0x285bce)[_0x2b69('0x27')](function(_0x135684){_0x105556['count']=_0x135684;if(_0x21bbbc[_0x2b69('0x33')][_0x2b69('0x45')]){_0x52b698['include']=[{'all':!![]}];}return db[_0x2b69('0x44')][_0x2b69('0x46')](_0x52b698);})[_0x2b69('0x27')](function(_0x3c3493){_0x105556[_0x2b69('0x47')]=_0x3c3493;return _0x105556;})[_0x2b69('0x27')](respondWithFilteredResult(_0x1efccb,_0x52b698))[_0x2b69('0x1f')](handleError(_0x1efccb,null));};exports[_0x2b69('0x48')]=function(_0x342205,_0x127d19){var _0xbed408={'raw':!![],'where':{'id':_0x342205['params']['id']}},_0x16029e={};_0x16029e[_0x2b69('0x32')]=_[_0x2b69('0x34')](db['MailMessage'][_0x2b69('0x2e')]);_0x16029e['query']=_['keys'](_0x342205['query']);_0x16029e['filters']=_['intersection'](_0x16029e[_0x2b69('0x32')],_0x16029e['query']);_0xbed408[_0x2b69('0x36')]=_[_0x2b69('0x37')](_0x16029e[_0x2b69('0x32')],qs[_0x2b69('0x38')](_0x342205[_0x2b69('0x33')][_0x2b69('0x38')]));_0xbed408['attributes']=_0xbed408[_0x2b69('0x36')][_0x2b69('0x39')]?_0xbed408[_0x2b69('0x36')]:_0x16029e['model'];if(_0x342205[_0x2b69('0x33')][_0x2b69('0x45')]){_0xbed408['include']=[{'all':!![]}];}_0xbed408=_[_0x2b69('0x41')]({},_0xbed408,_0x342205[_0x2b69('0x43')]);return db['MailMessage'][_0x2b69('0x49')](_0xbed408)['then'](handleEntityNotFound(_0x127d19,null))[_0x2b69('0x27')](respondWithResult(_0x127d19,null))['catch'](handleError(_0x127d19,null));};exports[_0x2b69('0x26')]=function(_0x692ec6,_0x3b7fb4){if(_0x692ec6['body']['id']){delete _0x692ec6[_0x2b69('0x4a')]['id'];}return db[_0x2b69('0x44')][_0x2b69('0x49')]({'where':{'id':_0x692ec6['params']['id']}})[_0x2b69('0x27')](handleEntityNotFound(_0x3b7fb4,null))[_0x2b69('0x27')](saveUpdates(_0x692ec6[_0x2b69('0x4a')],null))[_0x2b69('0x27')](respondWithResult(_0x3b7fb4,null))[_0x2b69('0x1f')](handleError(_0x3b7fb4,null));};exports[_0x2b69('0x28')]=function(_0x2de9ca,_0x3aaed1){return db[_0x2b69('0x44')][_0x2b69('0x49')]({'where':{'id':_0x2de9ca[_0x2b69('0x4b')]['id']}})[_0x2b69('0x27')](handleEntityNotFound(_0x3aaed1,null))[_0x2b69('0x27')](removeEntity(_0x3aaed1,null))[_0x2b69('0x1f')](handleError(_0x3aaed1,null));};exports['describe']=function(_0x4966dc,_0x3439b0){return db[_0x2b69('0x44')]['describe']()['then'](respondWithResult(_0x3439b0,null))[_0x2b69('0x1f')](handleError(_0x3439b0,null));};exports['create']=function(_0x5437de,_0x167a26){return db[_0x2b69('0x44')][_0x2b69('0x4c')](_0x5437de[_0x2b69('0x4a')])['then'](function(_0x3f6723){if(_0x3f6723){if(_0x3f6723['direction']===_0x2b69('0x4d')&&!_0x3f6723[_0x2b69('0x4e')]){var _0x16f003,_0x1aacaf,_0x47a2a3;if(_0x5437de[_0x2b69('0x4a')]['to']){_0x1aacaf=_0x5437de['body']['to'][_0x2b69('0x4f')](',')[0x0];}return db['MailAccount'][_0x2b69('0x50')]({'where':{'id':_0x3f6723[_0x2b69('0x51')]},'include':[{'model':db[_0x2b69('0x52')],'as':'List','include':[{'model':db[_0x2b69('0x53')],'as':_0x2b69('0x54'),'where':{'email':_0x1aacaf},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x2b69('0x55')],'as':_0x2b69('0x56'),'raw':!![],'include':[{'model':db[_0x2b69('0x57')],'as':_0x2b69('0x57'),'raw':!![]}]}]})[_0x2b69('0x27')](function(_0x52ba99){_0x16f003=_0x52ba99;if(!_0x16f003||!_0x16f003[_0x2b69('0x56')])return;var _0x1a266c=_0x16f003[_0x2b69('0x58')]();if(_0x5437de[_0x2b69('0x4a')][_0x2b69('0x59')]&&_0x5437de['body'][_0x2b69('0x59')][_0x2b69('0x39')]){for(var _0x2731e4=0x0;_0x2731e4<_0x5437de[_0x2b69('0x4a')][_0x2b69('0x59')]['length'];_0x2731e4+=0x1){_0x5437de[_0x2b69('0x4a')]['attachments'][_0x2731e4]={'filename':_0x5437de[_0x2b69('0x4a')][_0x2b69('0x59')][_0x2731e4][_0x2b69('0x2b')],'path':path['join'](config[_0x2b69('0x5a')],_0x2b69('0x5b'),_0x5437de[_0x2b69('0x4a')]['attachments'][_0x2731e4][_0x2b69('0x5c')])};}}_0x47a2a3={'account':_0x1a266c,'message':_0x5437de['body']};return;})[_0x2b69('0x27')](function(){if(_0x16f003[_0x2b69('0x5d')]){if(_0x16f003[_0x2b69('0x5d')]['Contacts'][_0x2b69('0x39')]){return _0x16f003['List']['Contacts'][0x0];}else{return db[_0x2b69('0x53')][_0x2b69('0x4c')](_['defaults'](_0x5437de[_0x2b69('0x4a')],{'firstName':_0x5437de[_0x2b69('0x4a')]['to'],'email':_0x5437de[_0x2b69('0x4a')]['to'],'phone':_0x5437de[_0x2b69('0x4a')]['to'],'ListId':_0x16f003[_0x2b69('0x5e')]}));}}else{throw new Error(_0x2b69('0x5f'));}})[_0x2b69('0x27')](function(){if(_0x47a2a3){return respondWithRpcPromise('SendMail',_0x2b69('0x60'),_0x47a2a3,client9003)['then'](function(_0x5a5149){return _0x3f6723[_0x2b69('0x26')]({'read':!![],'messageId':_0x5a5149[_0x2b69('0x61')],'sentAt':moment()[_0x2b69('0x62')](_0x2b69('0x63'))});})[_0x2b69('0x1f')](function(_0x135311){logger['error']('%s',JSON[_0x2b69('0x19')](_0x135311));return _0x3f6723;});}return _0x3f6723;});}return _0x3f6723;}})[_0x2b69('0x27')](respondWithResult(_0x167a26,0xc9))['catch'](handleError(_0x167a26,null));};exports[_0x2b69('0x64')]=function(_0x53befe,_0x44e91c){var _0x5e8989=_0x2b69('0x65');return interactionService[_0x2b69('0x66')](_0x53befe,_0x5e8989)[_0x2b69('0x27')](respondWithResult(_0x44e91c,null))['catch'](handleError(_0x44e91c,null));};exports[_0x2b69('0x67')]=function(_0xb3eeaf,_0xe38654){var _0x52122b={'agent':{},'channel':_0x2b69('0x65')};if(_0xb3eeaf[_0x2b69('0x4a')]['id']){delete _0xb3eeaf[_0x2b69('0x4a')]['id'];}_0xb3eeaf[_0x2b69('0x4a')][_0x2b69('0x68')]=_0xb3eeaf[_0x2b69('0x4a')][_0x2b69('0x68')]||_0xb3eeaf[_0x2b69('0x69')]['id'];_0x52122b[_0x2b69('0x6a')]['id']=_0xb3eeaf[_0x2b69('0x4a')][_0x2b69('0x68')];return db['MailMessage'][_0x2b69('0x49')]({'where':{'id':_0xb3eeaf['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe38654,null))['then'](function(_0x40be36){if(_0x40be36){_0x52122b[_0x2b69('0x1d')]=_0x40be36['get']({'plain':!![]});return db[_0x2b69('0x6b')][_0x2b69('0x49')]({'where':{'id':_0x40be36[_0x2b69('0x6c')]}});}return null;})[_0x2b69('0x27')](handleEntityNotFound(_0xe38654,null))[_0x2b69('0x27')](function(_0x4d0851){if(_0x4d0851){_0x52122b[_0x2b69('0x6d')]=_0x4d0851[_0x2b69('0x6e')]({'plain':!![]});interaction_log[_0x2b69('0x15')](_0x2b69('0x6f'),_0xb3eeaf[_0x2b69('0x69')]['id'],_0xb3eeaf['user'][_0x2b69('0x2b')],_0xb3eeaf[_0x2b69('0x69')][_0x2b69('0x70')],_0x52122b[_0x2b69('0x6d')]['id'],_0xb3eeaf['body']?JSON[_0x2b69('0x19')](_0xb3eeaf[_0x2b69('0x4a')]):_0x2b69('0x71'));return respondWithRpcPromise(_0x2b69('0x72'),_0x2b69('0x73'),_0x52122b);}return null;})[_0x2b69('0x27')](function(_0x44c793){var _0x1a4565='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x44c793['message'][_0x2b69('0x74')];return db[_0x2b69('0x75')][_0x2b69('0x33')](_0x1a4565,{'type':db['Sequelize'][_0x2b69('0x76')][_0x2b69('0x77')],'raw':!![]})[_0x2b69('0x27')](function(_0x5995a5){return _0x5995a5;});})['then'](function(_0x22ff5e){if(_0x22ff5e){_0x52122b[_0x2b69('0x1d')][_0x2b69('0x78')]=_0x22ff5e[0x0];if(!_0xb3eeaf[_0x2b69('0x4a')][_0x2b69('0x68')])return;return db[_0x2b69('0x79')]['find']({'where':{'id':_0xb3eeaf[_0x2b69('0x4a')][_0x2b69('0x68')],'role':_0x2b69('0x6a')},'attributes':['id',_0x2b69('0x2b'),_0x2b69('0x7a'),_0x2b69('0x7b'),_0x2b69('0x7c')],'raw':!![]});}return null;})[_0x2b69('0x27')](function(_0x28a242){if(!_0x28a242)return null;_0x52122b[_0x2b69('0x1d')][_0x2b69('0x6a')]=_0x28a242;return _0x52122b;})[_0x2b69('0x27')](function(_0x177302){if(_0x177302){_0x177302[_0x2b69('0x1d')][_0x2b69('0x7d')]=util['format'](_0x2b69('0x7e'),_0xb3eeaf[_0x2b69('0x69')][_0x2b69('0x2b')]);_0x177302['message'][_0x2b69('0x7f')]=_0x52122b['channel'];_0x177302[_0x2b69('0x1d')]['motionChannel']=_0x52122b[_0x2b69('0x7f')];_0x177302[_0x2b69('0x1d')]['event']=_0x2b69('0x67');_0x177302['message']['body']=htmlToText[_0x2b69('0x80')](_0x52122b[_0x2b69('0x1d')]['body']);respondWithRpcPromise(_0x2b69('0x81'),'EventManager',{'event':'rejectmessage','message':_0x177302['message']},client9002);return _0x52122b;}return null;})['then'](respondWithResult(_0xe38654,null))[_0x2b69('0x1f')](handleError(_0xe38654,null));};exports[_0x2b69('0x82')]=function(_0x5d3b02,_0x2ef45a){var _0x342979=moment()[_0x2b69('0x83')]()[_0x2b69('0x84')]();var _0x325345=path[_0x2b69('0x85')](config['root'],_0x2b69('0x86'),'files','tmp');var _0x2c8127=path[_0x2b69('0x85')](config[_0x2b69('0x5a')],_0x2b69('0x86'),_0x2b69('0x87'),_0x2b69('0x59'));var _0xf31535=util[_0x2b69('0x62')](_0x2b69('0x88'),_0x342979);return db[_0x2b69('0x44')][_0x2b69('0x49')]({'where':{'id':_0x5d3b02[_0x2b69('0x4b')]['id']},'attributes':['id','body',_0x2b69('0x89'),'to','cc','bcc',_0x2b69('0x8a'),_0x2b69('0x8b')],'include':_0x5d3b02[_0x2b69('0x33')][_0x2b69('0x59')]?[{'model':db['Attachment'],'as':_0x2b69('0x8c')}]:undefined})[_0x2b69('0x27')](handleEntityNotFound(_0x2ef45a,null))[_0x2b69('0x27')](function(_0x39f040){if(_0x39f040){var _0x43daeb=_0x39f040;var _0x2a3f51={'from':_0x43daeb[_0x2b69('0x89')],'to':_0x43daeb['to'],'subject':_0x43daeb['subject'],'html':htmlEntities[_0x2b69('0x8d')](_0x43daeb[_0x2b69('0x4a')]),'headers':{'Date':moment(_0x43daeb[_0x2b69('0x8b')])[_0x2b69('0x62')](_0x2b69('0x8e'))},'attachments':[]};if(_0x39f040['cc']){_0x2a3f51[_0x2b69('0x8f')]['Cc']=_0x39f040['cc'];}if(_0x39f040['bcc']){_0x2a3f51[_0x2b69('0x8f')][_0x2b69('0x90')]=_0x39f040[_0x2b69('0x91')];}return new Promise(function(_0x22cd66,_0x5b5e4b){if(_0x39f040['Attachments']){for(var _0x54dd05=0x0;_0x54dd05<_0x39f040[_0x2b69('0x8c')][_0x2b69('0x39')];_0x54dd05++){var _0x3149d5=_0x39f040['Attachments'][_0x54dd05];var _0x412373=path[_0x2b69('0x85')](_0x2c8127,_0x3149d5[_0x2b69('0x5c')]);if(fs[_0x2b69('0x92')](_0x412373)){_0x2a3f51['attachments'][_0x2b69('0x93')]({'name':_0x3149d5[_0x2b69('0x2b')],'contentType':_0x3149d5[_0x2b69('0x30')],'data':fs[_0x2b69('0x94')](_0x412373)});}}}emlformat[_0x2b69('0x95')](_0x2a3f51,function(_0x13579b,_0x13ef86){if(_0x13579b)return _0x5b5e4b(_0x13579b);fs[_0x2b69('0x96')](path[_0x2b69('0x85')](_0x325345,_0xf31535),_0x13ef86);return _0x22cd66(_0x13ef86);});});}})[_0x2b69('0x27')](function(_0x276baa){if(_0x276baa){return _0x2ef45a[_0x2b69('0x82')](path['join'](_0x325345,_0xf31535),_0xf31535,function(_0x5cf267){if(!_0x5cf267)fs[_0x2b69('0x97')](path[_0x2b69('0x85')](_0x325345,_0xf31535));});}})[_0x2b69('0x1f')](handleError(_0x2ef45a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index b737578..06c5808 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 _0x84dc=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','MailMessage'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x84dc,0x116));var _0xc84d=function(_0x5b2835,_0x582cdf){_0x5b2835=_0x5b2835-0x0;var _0x15694a=_0x84dc[_0x5b2835];return _0x15694a;};'use strict';var EventEmitter=require(_0xc84d('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xc84d('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc84d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc84d('0x3'),'afterDestroy':_0xc84d('0x4')};function emitEvent(_0x508d51){return function(_0x300888,_0x234bd5,_0x313491){MailMessageEvents[_0xc84d('0x5')](_0x508d51+':'+_0x300888['id'],_0x300888);MailMessageEvents[_0xc84d('0x5')](_0x508d51,_0x300888);_0x313491(null);};}for(var e in events){if(events[_0xc84d('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc84d('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x9e58=['update','remove','emit','hook','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x284dfb,_0x4e56a8){var _0x4f523d=function(_0x4fae3f){while(--_0x4fae3f){_0x284dfb['push'](_0x284dfb['shift']());}};_0x4f523d(++_0x4e56a8);}(_0x9e58,0x190));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x89e5('0x0'));var MailMessage=require(_0x89e5('0x1'))['db'][_0x89e5('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x89e5('0x3')](0x0);var events={'afterCreate':_0x89e5('0x4'),'afterUpdate':_0x89e5('0x5'),'afterDestroy':_0x89e5('0x6')};function emitEvent(_0x5b1507){return function(_0x536db7,_0x15507e,_0x452ba2){MailMessageEvents[_0x89e5('0x7')](_0x5b1507+':'+_0x536db7['id'],_0x536db7);MailMessageEvents[_0x89e5('0x7')](_0x5b1507,_0x536db7);_0x452ba2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x89e5('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 a646792..b274a4b 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 _0x364d=['rimraf','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x33ed32,_0x1b50ff){var _0x55c3b8=function(_0x566f07){while(--_0x566f07){_0x33ed32['push'](_0x33ed32['shift']());}};_0x55c3b8(++_0x1b50ff);}(_0x364d,0xd3));var _0xd364=function(_0x4644da,_0x2c6a27){_0x4644da=_0x4644da-0x0;var _0x1226dc=_0x364d[_0x4644da];return _0x1226dc;};'use strict';var _=require('lodash');var util=require(_0xd364('0x0'));var logger=require(_0xd364('0x1'))(_0xd364('0x2'));var moment=require(_0xd364('0x3'));var BPromise=require(_0xd364('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xd364('0x5'));var rimraf=require(_0xd364('0x6'));var config=require('../../config/environment');var attributes=require(_0xd364('0x7'));module[_0xd364('0x8')]=function(_0x2213c4,_0x5c6580){return _0x2213c4[_0xd364('0x9')]('MailMessage',attributes,{'tableName':_0xd364('0xa'),'paranoid':![],'indexes':[{'name':_0xd364('0xb'),'fields':['messageId']},{'name':_0xd364('0xc'),'fields':['plainBody','subject'],'type':_0xd364('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x312b12,_0x4f7ae3,_0x431e51){if(_0x312b12[_0xd364('0xe')]){_0x312b12[_0xd364('0xf')]=htmlToText[_0xd364('0x10')](_0x312b12['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x431e51(null,_0x4f7ae3);},'afterCreate':function(_0x23bdfb,_0x53506a,_0x1c8e97){var _0x51d35b=_0x2213c4['models'];var _0x31674b=_0x23bdfb[_0xd364('0x11')]({'plain':!![]});if(_0x31674b[_0xd364('0x12')][_0xd364('0x13')]()==='in'||_0x31674b['direction'][_0xd364('0x13')]()===_0xd364('0x14')&&!_0x31674b[_0xd364('0x15')]&&!_['isNil'](_0x31674b[_0xd364('0x16')])){_0x51d35b[_0xd364('0x17')][_0xd364('0x18')]({'where':{'id':_0x31674b['MailInteractionId']}})['then'](function(_0x51c81d){if(_0x51c81d){_0x51c81d[_0xd364('0x19')]({'lastMsgAt':_0x31674b[_0xd364('0x1a')],'lastMsgDirection':_0x31674b[_0xd364('0x12')][_0xd364('0x13')]()});}})[_0xd364('0x1b')](function(_0x575f81){console[_0xd364('0x1c')](_0x575f81);});}_0x1c8e97();}},'charset':_0xd364('0x1d'),'collate':_0xd364('0x1e')});}; \ No newline at end of file +var _0x98d2=['isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','direction','out','secret'];(function(_0x4df1f8,_0x45d96b){var _0x227d88=function(_0x1ce8ab){while(--_0x1ce8ab){_0x4df1f8['push'](_0x4df1f8['shift']());}};_0x227d88(++_0x45d96b);}(_0x98d2,0x107));var _0x298d=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0x98d2[_0x1a87b3];return _0x37e84d;};'use strict';var _=require(_0x298d('0x0'));var util=require('util');var logger=require(_0x298d('0x1'))(_0x298d('0x2'));var moment=require(_0x298d('0x3'));var BPromise=require(_0x298d('0x4'));var rp=require(_0x298d('0x5'));var htmlToText=require(_0x298d('0x6'));var fs=require('fs');var path=require(_0x298d('0x7'));var rimraf=require(_0x298d('0x8'));var config=require(_0x298d('0x9'));var attributes=require(_0x298d('0xa'));module['exports']=function(_0x1b066f,_0x10389d){return _0x1b066f[_0x298d('0xb')](_0x298d('0xc'),attributes,{'tableName':_0x298d('0xd'),'paranoid':![],'indexes':[{'name':_0x298d('0xe'),'fields':[_0x298d('0xe')]},{'name':_0x298d('0xf'),'fields':[_0x298d('0x10'),_0x298d('0x11')],'type':_0x298d('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x57eded,_0x4b5ad7,_0x176cbe){if(_0x57eded['body']){_0x57eded[_0x298d('0x10')]=htmlToText[_0x298d('0x13')](_0x57eded[_0x298d('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x176cbe(null,_0x4b5ad7);},'afterCreate':function(_0x36225f,_0xcf1bfa,_0x56a5b4){var _0x4c0a8f=_0x1b066f[_0x298d('0x15')];var _0x4fbe01=_0x36225f['get']({'plain':!![]});if(_0x4fbe01['direction']['toLowerCase']()==='in'||_0x4fbe01[_0x298d('0x16')]['toLowerCase']()===_0x298d('0x17')&&!_0x4fbe01[_0x298d('0x18')]&&!_[_0x298d('0x19')](_0x4fbe01['UserId'])){_0x4c0a8f[_0x298d('0x1a')][_0x298d('0x1b')]({'where':{'id':_0x4fbe01[_0x298d('0x1c')]}})[_0x298d('0x1d')](function(_0x3c77f8){if(_0x3c77f8){_0x3c77f8[_0x298d('0x1e')]({'lastMsgAt':_0x4fbe01[_0x298d('0x1f')],'lastMsgDirection':_0x4fbe01['direction']['toLowerCase']()});}})[_0x298d('0x20')](function(_0x56593b){console[_0x298d('0x21')](_0x56593b);});}_0x56a5b4();}},'charset':_0x298d('0x22'),'collate':_0x298d('0x23')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 25e384e..dffb5e0 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 _0x0120=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0120,0x6f));var _0x0012=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0120[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0012('0xc')](config[_0x0012('0xd')],{'host':_0x0012('0xe'),'port':0x18eb});var socket=require(_0x0012('0xf'))(new Redis(config[_0x0012('0xd')]));require('./mailMessage.socket')[_0x0012('0x10')](socket);function respondWithRpcPromise(_0x2d484c,_0x1dc1b2,_0x323282){return new BPromise(function(_0x520171,_0x2d4674){return client['request'](_0x2d484c,_0x323282)[_0x0012('0x11')](function(_0x1d1c02){logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));logger['debug'](_0x0012('0x15'),_0x1dc1b2,'request\x20sent',JSON['stringify'](_0x1d1c02));if(_0x1d1c02['error']){if(_0x1d1c02['error'][_0x0012('0x16')]===0x1f4){logger['error'](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02[_0x0012('0x17')]['message']);return _0x2d4674(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02['error']['message']);return _0x520171(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}else{logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));_0x520171(_0x1d1c02[_0x0012('0x19')][_0x0012('0x18')]);}})[_0x0012('0x1a')](function(_0x5b236f){logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x5b236f);_0x2d4674(_0x5b236f);});});}exports['CreateMailMessage']=function(_0x45d00b){var _0x1f54fc=this;return new Promise(function(_0xa2e623,_0x2c837e){return db['MailMessage']['create'](_0x45d00b[_0x0012('0x1b')],{'raw':_0x45d00b[_0x0012('0x1c')]?_0x45d00b[_0x0012('0x1c')][_0x0012('0x1d')]===undefined?!![]:![]:!![]})[_0x0012('0x11')](function(_0x2e6a2c){logger[_0x0012('0x12')](_0x0012('0x1e'),_0x45d00b);logger['debug'](_0x0012('0x1e'),_0x45d00b,JSON[_0x0012('0x1f')](_0x2e6a2c));_0xa2e623(_0x2e6a2c);})['catch'](function(_0x36cf42){logger[_0x0012('0x17')](_0x0012('0x1e'),_0x36cf42[_0x0012('0x18')],_0x45d00b);_0x2c837e(_0x1f54fc[_0x0012('0x17')](0x1f4,_0x36cf42['message']));});});}; \ No newline at end of file +var _0xd4f4=['CreateMailMessage','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x53ca1e,_0x2286b7){var _0xbf8e76=function(_0x390e20){while(--_0x390e20){_0x53ca1e['push'](_0x53ca1e['shift']());}};_0xbf8e76(++_0x2286b7);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x30a02f,_0x3ad198){_0x30a02f=_0x30a02f-0x0;var _0x393c95=_0xd4f4[_0x30a02f];return _0x393c95;};'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});config[_0x4d4f('0xb')]=_[_0x4d4f('0xc')](config[_0x4d4f('0xb')],{'host':_0x4d4f('0xd'),'port':0x18eb});var socket=require(_0x4d4f('0xe'))(new Redis(config[_0x4d4f('0xb')]));require(_0x4d4f('0xf'))[_0x4d4f('0x10')](socket);function respondWithRpcPromise(_0x385597,_0xba5200,_0x20db50){return new BPromise(function(_0x88b592,_0x128d39){return client[_0x4d4f('0x11')](_0x385597,_0x20db50)[_0x4d4f('0x12')](function(_0x28fb3e){logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0xba5200,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0xba5200,_0x4d4f('0x15'),JSON[_0x4d4f('0x16')](_0x28fb3e));if(_0x28fb3e['error']){if(_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x18')]===0x1f4){logger[_0x4d4f('0x17')]('MailMessage,\x20%s,\x20%s',_0xba5200,_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x128d39(_0x28fb3e[_0x4d4f('0x17')]['message']);}logger[_0x4d4f('0x17')]('MailMessage,\x20%s,\x20%s',_0xba5200,_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x88b592(_0x28fb3e[_0x4d4f('0x17')]['message']);}else{logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0xba5200,'request\x20sent');_0x88b592(_0x28fb3e['result']['message']);}})['catch'](function(_0x5eebec){logger[_0x4d4f('0x17')](_0x4d4f('0x14'),_0xba5200,_0x5eebec);_0x128d39(_0x5eebec);});});}exports[_0x4d4f('0x1a')]=function(_0x3566a5){var _0x5d7b1f=this;return new Promise(function(_0x5b2863,_0x1e1ae2){return db['MailMessage'][_0x4d4f('0x1b')](_0x3566a5[_0x4d4f('0x1c')],{'raw':_0x3566a5[_0x4d4f('0x1d')]?_0x3566a5[_0x4d4f('0x1d')][_0x4d4f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x570520){logger[_0x4d4f('0x13')]('CreateMailMessage',_0x3566a5);logger[_0x4d4f('0x1f')](_0x4d4f('0x1a'),_0x3566a5,JSON[_0x4d4f('0x16')](_0x570520));_0x5b2863(_0x570520);})[_0x4d4f('0x20')](function(_0xf3f7a4){logger['error'](_0x4d4f('0x1a'),_0xf3f7a4[_0x4d4f('0x19')],_0x3566a5);_0x1e1ae2(_0x5d7b1f[_0x4d4f('0x17')](0x1f4,_0xf3f7a4[_0x4d4f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1e8f76a..046c08d 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 _0xa3b4=['register','length','mailMessage:','save','remove','update','removeListener'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xa3b4,0x130));var _0x4a3b=function(_0x774d4e,_0x328adf){_0x774d4e=_0x774d4e-0x0;var _0x13e542=_0xa3b4[_0x774d4e];return _0x13e542;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x4a3b('0x0'),_0x4a3b('0x1'),_0x4a3b('0x2')];function createListener(_0x2fb16b,_0x132420){return function(_0x256bbf){_0x132420['emit'](_0x2fb16b,_0x256bbf);};}function removeListener(_0x541d47,_0x209fe7){return function(){MailMessageEvents[_0x4a3b('0x3')](_0x541d47,_0x209fe7);};}exports[_0x4a3b('0x4')]=function(_0x3acfed){for(var _0x4b6b77=0x0,_0x249afb=events[_0x4a3b('0x5')];_0x4b6b77<_0x249afb;_0x4b6b77++){var _0x3599b0=events[_0x4b6b77];var _0x36e55a=createListener(_0x4a3b('0x6')+_0x3599b0,_0x3acfed);MailMessageEvents['on'](_0x3599b0,_0x36e55a);}}; \ No newline at end of file +var _0x9d67=['mailMessage:','./mailMessage.events','save','remove','emit','removeListener','length'];(function(_0x6f1d38,_0x4979b0){var _0xc1f9b=function(_0x1ea663){while(--_0x1ea663){_0x6f1d38['push'](_0x6f1d38['shift']());}};_0xc1f9b(++_0x4979b0);}(_0x9d67,0x78));var _0x79d6=function(_0x2984a2,_0x43adf8){_0x2984a2=_0x2984a2-0x0;var _0x3b0252=_0x9d67[_0x2984a2];return _0x3b0252;};'use strict';var MailMessageEvents=require(_0x79d6('0x0'));var events=[_0x79d6('0x1'),_0x79d6('0x2'),'update'];function createListener(_0x412f6e,_0x8777ab){return function(_0x35fb5c){_0x8777ab[_0x79d6('0x3')](_0x412f6e,_0x35fb5c);};}function removeListener(_0x5e72c7,_0x235c12){return function(){MailMessageEvents[_0x79d6('0x4')](_0x5e72c7,_0x235c12);};}exports['register']=function(_0x38afa1){for(var _0x11a972=0x0,_0x4b05c9=events[_0x79d6('0x5')];_0x11a972<_0x4b05c9;_0x11a972++){var _0x1bbf14=events[_0x11a972];var _0x398a93=createListener(_0x79d6('0x6')+_0x1bbf14,_0x38afa1);MailMessageEvents['on'](_0x1bbf14,_0x398a93);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b8c091a..9a651a6 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 _0x52ce=['create','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x52ce,0x170));var _0xe52c=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x52ce[_0x36c6eb];return _0x30675b;};'use strict';var multer=require(_0xe52c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe52c('0x1'));var express=require(_0xe52c('0x2'));var router=express[_0xe52c('0x3')]();var fs_extra=require(_0xe52c('0x4'));var auth=require(_0xe52c('0x5'));var interaction=require(_0xe52c('0x6'));var config=require(_0xe52c('0x7'));var controller=require(_0xe52c('0x8'));router[_0xe52c('0x9')]('/',auth[_0xe52c('0xa')](),controller[_0xe52c('0xb')]);router[_0xe52c('0x9')](_0xe52c('0xc'),auth['isAuthenticated'](),controller[_0xe52c('0xd')]);router[_0xe52c('0x9')](_0xe52c('0xe'),auth[_0xe52c('0xa')](),controller['show']);router[_0xe52c('0x9')](_0xe52c('0xf'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x10')]);router['get'](_0xe52c('0x11'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x12')]);router[_0xe52c('0x9')](_0xe52c('0x13'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x14')]);router[_0xe52c('0x15')]('/',auth[_0xe52c('0xa')](),controller[_0xe52c('0x16')]);router[_0xe52c('0x15')](_0xe52c('0x11'),auth[_0xe52c('0xa')](),controller['addTeams']);router['post']('/:id/users',auth[_0xe52c('0xa')](),controller['addAgents']);router[_0xe52c('0x17')](_0xe52c('0xe'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x18')]);router[_0xe52c('0x19')](_0xe52c('0xe'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x1a')]);router[_0xe52c('0x19')](_0xe52c('0x11'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x1b')]);router['delete'](_0xe52c('0x13'),auth[_0xe52c('0xa')](),controller[_0xe52c('0x1c')]);module[_0xe52c('0x1d')]=router; \ No newline at end of file +var _0x9ce7=['./mailQueue.controller','get','index','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4bd09c,_0x243574){var _0x1aa7ee=function(_0xd9cc11){while(--_0xd9cc11){_0x4bd09c['push'](_0x4bd09c['shift']());}};_0x1aa7ee(++_0x243574);}(_0x9ce7,0x13c));var _0x79ce=function(_0x47d7ec,_0x17f197){_0x47d7ec=_0x47d7ec-0x0;var _0x98674a=_0x9ce7[_0x47d7ec];return _0x98674a;};'use strict';var multer=require(_0x79ce('0x0'));var util=require(_0x79ce('0x1'));var path=require(_0x79ce('0x2'));var timeout=require(_0x79ce('0x3'));var express=require(_0x79ce('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x79ce('0x5'));var interaction=require(_0x79ce('0x6'));var config=require(_0x79ce('0x7'));var controller=require(_0x79ce('0x8'));router[_0x79ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x79ce('0xa')]);router[_0x79ce('0x9')]('/describe',auth[_0x79ce('0xb')](),controller['describe']);router[_0x79ce('0x9')](_0x79ce('0xc'),auth['isAuthenticated'](),controller[_0x79ce('0xd')]);router[_0x79ce('0x9')](_0x79ce('0xe'),auth[_0x79ce('0xb')](),controller['getMembers']);router[_0x79ce('0x9')](_0x79ce('0xf'),auth[_0x79ce('0xb')](),controller[_0x79ce('0x10')]);router[_0x79ce('0x9')](_0x79ce('0x11'),auth[_0x79ce('0xb')](),controller['getAgents']);router[_0x79ce('0x12')]('/',auth[_0x79ce('0xb')](),controller['create']);router['post'](_0x79ce('0xf'),auth[_0x79ce('0xb')](),controller[_0x79ce('0x13')]);router[_0x79ce('0x12')](_0x79ce('0x11'),auth[_0x79ce('0xb')](),controller[_0x79ce('0x14')]);router['put']('/:id',auth[_0x79ce('0xb')](),controller[_0x79ce('0x15')]);router[_0x79ce('0x16')](_0x79ce('0xc'),auth[_0x79ce('0xb')](),controller[_0x79ce('0x17')]);router[_0x79ce('0x16')](_0x79ce('0xf'),auth[_0x79ce('0xb')](),controller[_0x79ce('0x18')]);router['delete'](_0x79ce('0x11'),auth[_0x79ce('0xb')](),controller[_0x79ce('0x19')]);module[_0x79ce('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index ef51058..1d93774 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 _0x3c33=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3c33,0x67));var _0x33c3=function(_0x5bce6d,_0x3d3b72){_0x5bce6d=_0x5bce6d-0x0;var _0x4ee73c=_0x3c33[_0x5bce6d];return _0x4ee73c;};'use strict';var Sequelize=require('sequelize');module[_0x33c3('0x0')]={'name':{'type':Sequelize[_0x33c3('0x1')],'unique':_0x33c3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x33c3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x33c3('0x4'),_0x33c3('0x5'),_0x33c3('0x6'))}}; \ No newline at end of file +var _0xb20d=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x15d327,_0x28fdab){var _0x569a8e=function(_0x55a496){while(--_0x55a496){_0x15d327['push'](_0x15d327['shift']());}};_0x569a8e(++_0x28fdab);}(_0xb20d,0xed));var _0xdb20=function(_0x3c41e9,_0x5d60d2){_0x3c41e9=_0x3c41e9-0x0;var _0x3b9556=_0xb20d[_0x3c41e9];return _0x3b9556;};'use strict';var Sequelize=require(_0xdb20('0x0'));module[_0xdb20('0x1')]={'name':{'type':Sequelize[_0xdb20('0x2')],'unique':_0xdb20('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdb20('0x2')]},'timeout':{'type':Sequelize[_0xdb20('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb20('0x5')](_0xdb20('0x6'),_0xdb20('0x7'),_0xdb20('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1bca525..f433f1c 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 _0x21c7=['tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','sequelize','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','pick','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','where','include','query','MailQueue','rows','catch','params','keys','intersection','model','attributes','fields','includeAll','merge','options','find','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserMailQueue','filters','length','hasOwnProperty','nolimit','order','sort','filter','findAll','User','UserId','agent','mailPause','createdAt','format','SIP','updatedAt','getTeams','findOne','addTeams','ids','online','voicePause','flatMap','Agents','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','Team','select','field'];(function(_0x15a64c,_0x180366){var _0x1ee0ef=function(_0x5cf9bd){while(--_0x5cf9bd){_0x15a64c['push'](_0x15a64c['shift']());}};_0x1ee0ef(++_0x180366);}(_0x21c7,0x183));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x721c('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x721c('0x1'));var Redis=require(_0x721c('0x2'));var qs=require(_0x721c('0x3'));var logger=require(_0x721c('0x4'))(_0x721c('0x5'));var config=require(_0x721c('0x6'));var db=require('../../mysqldb')['db'];config[_0x721c('0x7')]=_[_0x721c('0x8')](config[_0x721c('0x7')],{'host':_0x721c('0x9'),'port':0x18eb});var socket=require(_0x721c('0xa'))(new Redis(config[_0x721c('0x7')]));require('./mailQueue.socket')[_0x721c('0xb')](socket);function respondWithStatusCode(_0x4b7f4d,_0x3fa36a){_0x3fa36a=_0x3fa36a||0xcc;return function(_0x4f643a){if(_0x4f643a){return _0x4b7f4d[_0x721c('0xc')](_0x3fa36a);}return _0x4b7f4d[_0x721c('0xd')](_0x3fa36a)[_0x721c('0xe')]();};}function respondWithResult(_0x2eaaf9,_0x5b9362){_0x5b9362=_0x5b9362||0xc8;return function(_0x52686c){if(_0x52686c){return _0x2eaaf9[_0x721c('0xd')](_0x5b9362)[_0x721c('0xf')](_0x52686c);}};}function respondWithFilteredResult(_0x386053,_0x108fc9){return function(_0xfb71dc){if(_0xfb71dc){var _0x2ba4ce=typeof _0x108fc9[_0x721c('0x10')]===_0x721c('0x11')&&typeof _0x108fc9[_0x721c('0x12')]===_0x721c('0x11');var _0x593fa2=_0xfb71dc[_0x721c('0x13')];var _0x5061aa=_0x2ba4ce?0x0:_0x108fc9[_0x721c('0x10')];var _0x113a8f=_0x2ba4ce?_0xfb71dc['count']:_0x108fc9['offset']+_0x108fc9[_0x721c('0x12')];var _0xe13815;if(_0x113a8f>=_0x593fa2){_0x113a8f=_0x593fa2;_0xe13815=0xc8;}else{_0xe13815=0xce;}_0x386053[_0x721c('0xd')](_0xe13815);return _0x386053[_0x721c('0x14')]('Content-Range',_0x5061aa+'-'+_0x113a8f+'/'+_0x593fa2)['json'](_0xfb71dc);}return null;};}function saveUpdates(_0xe99bd5){return function(_0x41d51d){if(_0x41d51d){return _0x41d51d[_0x721c('0x15')](_0xe99bd5)['then'](function(_0x9e04c8){return _0x9e04c8;});}return null;};}function removeEntity(_0x1ccc6e){return function(_0x31043e){if(_0x31043e){return _0x31043e[_0x721c('0x16')]()[_0x721c('0x17')](function(){var _0x201c64=_0x31043e[_0x721c('0x18')]({'plain':!![]});var _0x491a20='MailQueues';return db['UserProfileResource'][_0x721c('0x16')]({'where':{'type':_0x491a20,'resourceId':_0x201c64['id']}})[_0x721c('0x17')](function(){return _0x31043e;});})[_0x721c('0x17')](function(){_0x1ccc6e['status'](0xcc)[_0x721c('0xe')]();});}};}function handleEntityNotFound(_0x4b1316){return function(_0x340820){if(!_0x340820){_0x4b1316[_0x721c('0xc')](0x194);}return _0x340820;};}function handleError(_0x3bc7f7,_0x4a6755){_0x4a6755=_0x4a6755||0x1f4;return function(_0x3f832e){logger[_0x721c('0x19')](_0x3f832e[_0x721c('0x1a')]);if(_0x3f832e[_0x721c('0x1b')]){delete _0x3f832e[_0x721c('0x1b')];}_0x3bc7f7[_0x721c('0xd')](_0x4a6755)[_0x721c('0x1c')](_0x3f832e);};}exports[_0x721c('0x1d')]=function(_0xa7935f,_0x3af67d){var _0x38e868={};var _0x3012dd={'count':0x0,'rows':[]};var _0xe02e33=_[_0x721c('0x1e')](db['MailQueue'][_0x721c('0x1f')],function(_0x39b7b9){return{'name':_0x39b7b9[_0x721c('0x20')],'type':_0x39b7b9[_0x721c('0x21')][_0x721c('0x22')]};});_0x38e868=qs['getOptions'](_0xe02e33,_0xa7935f);var _0x58a16d={'where':_0x38e868[_0x721c('0x23')]};return db['MailQueue'][_0x721c('0x13')](_0x58a16d)[_0x721c('0x17')](function(_0x52bfc3){_0x3012dd[_0x721c('0x13')]=_0x52bfc3;_0x38e868['include']=qs[_0x721c('0x24')](_0xa7935f[_0x721c('0x25')]);return db[_0x721c('0x26')]['findAll'](_0x38e868);})[_0x721c('0x17')](function(_0x40d6f4){_0x3012dd[_0x721c('0x27')]=_0x40d6f4;return _0x3012dd;})[_0x721c('0x17')](respondWithFilteredResult(_0x3af67d,_0x38e868))[_0x721c('0x28')](handleError(_0x3af67d,null));};exports['show']=function(_0x541438,_0x7e0b73){var _0x156e96={'raw':!![],'where':{'id':_0x541438[_0x721c('0x29')]['id']}},_0x8834a4={};_0x8834a4['model']=_[_0x721c('0x2a')](db['MailQueue'][_0x721c('0x1f')]);_0x8834a4[_0x721c('0x25')]=_[_0x721c('0x2a')](_0x541438[_0x721c('0x25')]);_0x8834a4['filters']=_[_0x721c('0x2b')](_0x8834a4[_0x721c('0x2c')],_0x8834a4['query']);_0x156e96[_0x721c('0x2d')]=_['intersection'](_0x8834a4[_0x721c('0x2c')],qs[_0x721c('0x2e')](_0x541438[_0x721c('0x25')]['fields']));_0x156e96['attributes']=_0x156e96[_0x721c('0x2d')]['length']?_0x156e96['attributes']:_0x8834a4[_0x721c('0x2c')];if(_0x541438['query'][_0x721c('0x2f')]){_0x156e96['include']=[{'all':!![]}];}_0x156e96=_[_0x721c('0x30')]({},_0x156e96,_0x541438[_0x721c('0x31')]);return db[_0x721c('0x26')][_0x721c('0x32')](_0x156e96)[_0x721c('0x17')](handleEntityNotFound(_0x7e0b73,null))[_0x721c('0x17')](respondWithResult(_0x7e0b73,null))[_0x721c('0x28')](handleError(_0x7e0b73,null));};exports['create']=function(_0x24b430,_0x423b09){return db[_0x721c('0x26')][_0x721c('0x33')](_0x24b430['body'],{})[_0x721c('0x17')](function(_0x1003bd){var _0x18f99d=_0x24b430['user'][_0x721c('0x18')]({'plain':!![]});if(!_0x18f99d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f99d[_0x721c('0x34')]===_0x721c('0x35')){var _0x12c223=_0x1003bd['get']({'plain':!![]});var _0x15e988='MailQueues';return db[_0x721c('0x36')][_0x721c('0x32')]({'where':{'name':_0x15e988,'userProfileId':_0x18f99d[_0x721c('0x37')]},'raw':!![]})['then'](function(_0x5b230e){if(_0x5b230e&&_0x5b230e['autoAssociation']===0x0){return db['UserProfileResource'][_0x721c('0x33')]({'name':_0x12c223[_0x721c('0x1b')],'resourceId':_0x12c223['id'],'type':_0x5b230e[_0x721c('0x1b')],'sectionId':_0x5b230e['id']},{})[_0x721c('0x17')](function(){return _0x1003bd;});}else{return _0x1003bd;}})[_0x721c('0x28')](function(_0x17384b){logger['error'](_0x721c('0x38'),_0x17384b);throw _0x17384b;});}return _0x1003bd;})[_0x721c('0x17')](respondWithResult(_0x423b09,0xc9))['catch'](handleError(_0x423b09,null));};exports[_0x721c('0x15')]=function(_0x202ffc,_0x48dd31){if(_0x202ffc[_0x721c('0x39')]['id']){delete _0x202ffc[_0x721c('0x39')]['id'];}return db[_0x721c('0x26')][_0x721c('0x32')]({'where':{'id':_0x202ffc[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x48dd31,null))['then'](saveUpdates(_0x202ffc[_0x721c('0x39')],null))[_0x721c('0x17')](respondWithResult(_0x48dd31,null))['catch'](handleError(_0x48dd31,null));};exports[_0x721c('0x16')]=function(_0x1cb0cc,_0x298a5d){return db['MailQueue'][_0x721c('0x32')]({'where':{'id':_0x1cb0cc[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x298a5d,null))[_0x721c('0x17')](removeEntity(_0x298a5d,null))[_0x721c('0x28')](handleError(_0x298a5d,null));};exports[_0x721c('0x3a')]=function(_0x59d7ca,_0x11c1f4){return db[_0x721c('0x26')]['describe']()['then'](respondWithResult(_0x11c1f4,null))[_0x721c('0x28')](handleError(_0x11c1f4,null));};exports['getMembers']=function(_0x147392,_0x4d11ef){var _0x5a44a7={'raw':!![],'where':{}},_0x29b631={},_0x1027f3;return db['MailQueue']['findOne']({'where':{'id':_0x147392[_0x721c('0x29')]['id']}})['then'](handleEntityNotFound(_0x4d11ef,null))[_0x721c('0x17')](function(_0x52f2cf){if(_0x52f2cf){_0x1027f3=_0x52f2cf[_0x721c('0x18')]({'plain':!![]});_0x29b631[_0x721c('0x2c')]=_[_0x721c('0x2a')](db[_0x721c('0x3b')]['rawAttributes']);_0x29b631['query']=_['keys'](_0x147392[_0x721c('0x25')]);_0x29b631[_0x721c('0x3c')]=_[_0x721c('0x2b')](_0x29b631['model'],_0x29b631[_0x721c('0x25')]);_0x5a44a7[_0x721c('0x2d')]=_[_0x721c('0x2b')](_0x29b631[_0x721c('0x2c')],qs[_0x721c('0x2e')](_0x147392[_0x721c('0x25')]['fields']));_0x5a44a7[_0x721c('0x2d')]=_0x5a44a7['attributes'][_0x721c('0x3d')]?_0x5a44a7[_0x721c('0x2d')]:_0x29b631['model'];if(!_0x147392[_0x721c('0x25')][_0x721c('0x3e')](_0x721c('0x3f'))){_0x5a44a7['limit']=qs[_0x721c('0x12')](_0x147392[_0x721c('0x25')][_0x721c('0x12')]);_0x5a44a7[_0x721c('0x10')]=qs[_0x721c('0x10')](_0x147392[_0x721c('0x25')][_0x721c('0x10')]);}_0x5a44a7[_0x721c('0x40')]=qs[_0x721c('0x41')](_0x147392[_0x721c('0x25')][_0x721c('0x41')]);_0x5a44a7[_0x721c('0x23')]=qs[_0x721c('0x3c')](_['pick'](_0x147392[_0x721c('0x25')],_0x29b631[_0x721c('0x3c')]));_0x5a44a7[_0x721c('0x23')]['MailQueueId']=_0x52f2cf['id'];if(_0x147392['query'][_0x721c('0x42')]){_0x5a44a7['where']=_[_0x721c('0x30')](_0x5a44a7[_0x721c('0x23')],{'$or':_['map'](_0x5a44a7[_0x721c('0x2d')],function(_0x2cb426){var _0x446348={};_0x446348[_0x2cb426]={'$like':'%'+_0x147392[_0x721c('0x25')][_0x721c('0x42')]+'%'};return _0x446348;})});}_0x5a44a7=_[_0x721c('0x30')]({},_0x5a44a7,_0x147392[_0x721c('0x31')]);return db[_0x721c('0x3b')][_0x721c('0x43')](_0x5a44a7);}})[_0x721c('0x17')](function(_0x3d0601){if(_0x3d0601){return db[_0x721c('0x44')]['findAndCountAll']({'where':{'id':_['map'](_0x3d0601,_0x721c('0x45')),'role':_0x721c('0x46')},'attributes':['id','name',_0x721c('0x47'),'updatedAt',_0x721c('0x48')]});}})[_0x721c('0x17')](function(_0x5592eb){if(_0x5592eb){return{'count':_0x5592eb[_0x721c('0x13')],'rows':_['map'](_0x5592eb[_0x721c('0x27')],function(_0x4718b0){return{'membername':_0x4718b0['name'],'UserId':_0x4718b0['id'],'queue_name':_0x1027f3[_0x721c('0x1b')],'MailQueueId':_0x1027f3['id'],'interface':util[_0x721c('0x49')]('%s/%s',_0x721c('0x4a'),_0x4718b0[_0x721c('0x1b')]),'penalty':0x0,'paused':_0x4718b0['mailPause'],'createdAt':_0x4718b0['createdAt'],'updatedAt':_0x4718b0[_0x721c('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x721c('0x17')](respondWithFilteredResult(_0x4d11ef,_0x5a44a7))[_0x721c('0x28')](handleError(_0x4d11ef,null));};exports[_0x721c('0x4c')]=function(_0x30a11d,_0x5b27c0){var _0x388e9a={};var _0x49286b={};var _0x3cca5c;var _0x1f372f;return db[_0x721c('0x26')][_0x721c('0x4d')]({'where':{'id':_0x30a11d[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x5b27c0,null))['then'](function(_0x38f631){if(_0x38f631){_0x3cca5c=_0x38f631;_0x49286b['model']=_[_0x721c('0x2a')](db['Team']['rawAttributes']);_0x49286b[_0x721c('0x25')]=_[_0x721c('0x2a')](_0x30a11d['query']);_0x49286b[_0x721c('0x3c')]=_[_0x721c('0x2b')](_0x49286b[_0x721c('0x2c')],_0x49286b[_0x721c('0x25')]);_0x388e9a['attributes']=_[_0x721c('0x2b')](_0x49286b[_0x721c('0x2c')],qs[_0x721c('0x2e')](_0x30a11d[_0x721c('0x25')][_0x721c('0x2e')]));_0x388e9a[_0x721c('0x2d')]=_0x388e9a[_0x721c('0x2d')]['length']?_0x388e9a[_0x721c('0x2d')]:_0x49286b[_0x721c('0x2c')];_0x388e9a[_0x721c('0x40')]=qs[_0x721c('0x41')](_0x30a11d[_0x721c('0x25')]['sort']);_0x388e9a[_0x721c('0x23')]=qs[_0x721c('0x3c')](_['pick'](_0x30a11d[_0x721c('0x25')],_0x49286b[_0x721c('0x3c')]));if(_0x30a11d[_0x721c('0x25')]['filter']){_0x388e9a['where']=_[_0x721c('0x30')](_0x388e9a[_0x721c('0x23')],{'$or':_[_0x721c('0x1e')](_0x388e9a[_0x721c('0x2d')],function(_0x31ceac){var _0x453722={};_0x453722[_0x31ceac]={'$like':'%'+_0x30a11d[_0x721c('0x25')][_0x721c('0x42')]+'%'};return _0x453722;})});}_0x388e9a=_[_0x721c('0x30')]({},_0x388e9a,_0x30a11d[_0x721c('0x31')]);return _0x3cca5c[_0x721c('0x4c')](_0x388e9a);}})[_0x721c('0x17')](function(_0x2ab965){if(_0x2ab965){_0x1f372f=_0x2ab965[_0x721c('0x3d')];if(!_0x30a11d[_0x721c('0x25')][_0x721c('0x3e')](_0x721c('0x3f'))){_0x388e9a[_0x721c('0x12')]=qs[_0x721c('0x12')](_0x30a11d[_0x721c('0x25')][_0x721c('0x12')]);_0x388e9a[_0x721c('0x10')]=qs[_0x721c('0x10')](_0x30a11d['query'][_0x721c('0x10')]);}return _0x3cca5c[_0x721c('0x4c')](_0x388e9a);}})[_0x721c('0x17')](function(_0x2273bd){if(_0x2273bd){return _0x2273bd?{'count':_0x1f372f,'rows':_0x2273bd}:null;}})[_0x721c('0x17')](respondWithResult(_0x5b27c0,null))[_0x721c('0x28')](handleError(_0x5b27c0,null));};exports[_0x721c('0x4e')]=function(_0x3fb458,_0x3a985f){var _0x95bdad=_0x3fb458['body'][_0x721c('0x4f')];return db['Team'][_0x721c('0x43')]({'where':{'id':_0x95bdad},'attributes':['id'],'include':[{'model':db[_0x721c('0x44')],'as':'Agents','attributes':['id',_0x721c('0x1b'),_0x721c('0x50'),_0x721c('0x51'),'interface'],'raw':!![]}]})[_0x721c('0x17')](function(_0x19e069){if(_0x19e069){var _0x84a589=_[_0x721c('0x52')](_0x19e069,function(_0x486f3b){var _0x282c9a=_0x486f3b['get']({'plain':!![]});return _0x282c9a[_0x721c('0x53')];});return db[_0x721c('0x26')]['find']({'where':{'id':_0x3fb458[_0x721c('0x29')]['id']}})[_0x721c('0x17')](function(_0x2baebf){return db['sequelize'][_0x721c('0x54')](function(_0x3c9220){return _0x2baebf[_0x721c('0x4e')](_0x95bdad,{'transaction':_0x3c9220})[_0x721c('0x17')](function(){return BPromise[_0x721c('0x55')](_0x84a589,function(_0x4cf1a2){return db[_0x721c('0x3b')][_0x721c('0x56')]({'where':{'UserId':_0x4cf1a2['id'],'MailQueueId':_0x3fb458[_0x721c('0x29')]['id']},'transaction':_0x3c9220});});})['then'](function(){_0x84a589['forEach'](function(_0x2fc7a8){socket[_0x721c('0x57')](_0x721c('0x58'),{'UserId':_0x2fc7a8['id'],'MailQueueId':_0x2baebf['id']});});});});});}})[_0x721c('0x17')](respondWithStatusCode(_0x3a985f,null))[_0x721c('0x28')](handleError(_0x3a985f,null));};exports[_0x721c('0x59')]=function(_0x208f93,_0x3ece00){return db[_0x721c('0x5a')]['findAll']({'where':{'id':_0x208f93[_0x721c('0x25')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x721c('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3ece00,null))[_0x721c('0x17')](function(_0x25c777){var _0xce7c0a=_['map'](_0x25c777,'id');var _0x1c7108=[];var _0x113261=[];var _0x11a891=squel[_0x721c('0x5b')]();_0x11a891[_0x721c('0x5c')](_0x721c('0x5d'))[_0x721c('0x5e')]('team_has_mail_queues','tq')[_0x721c('0x5f')](_0x721c('0x60'),'ut',_0x721c('0x61'))[_0x721c('0x23')](_0x721c('0x62'),_0x208f93[_0x721c('0x29')]['id']);for(var _0x2cf833=0x0;_0x2cf833<_0x25c777[_0x721c('0x3d')];_0x2cf833+=0x1){let _0x42d423=_0x25c777[_0x2cf833];for(var _0x340b6e=0x0;_0x340b6e<_0x42d423[_0x721c('0x53')][_0x721c('0x3d')];_0x340b6e+=0x1){let _0x31b19b=_0x42d423[_0x721c('0x53')][_0x340b6e];var _0x24c582=_0x11a891[_0x721c('0x63')]();_0x24c582['where'](_0x721c('0x64'),_0x31b19b['id']);_0x113261['push'](db['sequelize'][_0x721c('0x25')](_0x24c582[_0x721c('0x65')](),{'type':db['sequelize'][_0x721c('0x66')][_0x721c('0x67')]})[_0x721c('0x17')](function(_0x111821){if(_0x111821[_0x721c('0x3d')]===0x1){return _0x31b19b['id'];}else{var _0x13f3ae=_[_0x721c('0x68')](_[_0x721c('0x1e')](_0x111821,_0x721c('0x69')),function(_0x5d573a){return _[_0x721c('0x6a')](_0xce7c0a,_0x5d573a);});if(_0x13f3ae){return _0x31b19b['id'];}}}));}}return BPromise[_0x721c('0x6b')](_0x113261)['then'](function(_0x1b44f4){_0x1c7108=_(_0x1c7108)['union'](_0x1b44f4)[_0x721c('0x6c')]()[_0x721c('0x6d')]();return db[_0x721c('0x26')][_0x721c('0x32')]({'where':{'id':_0x208f93[_0x721c('0x29')]['id']}})[_0x721c('0x17')](function(_0x2207bb){return db[_0x721c('0x6e')]['transaction'](function(_0x1a11cd){return _0x2207bb['removeTeams'](_0x208f93[_0x721c('0x25')][_0x721c('0x4f')],{'transaction':_0x1a11cd})[_0x721c('0x17')](function(){if(!_[_0x721c('0x6f')](_0x1c7108)){return _0x2207bb[_0x721c('0x70')](_0x1c7108,{'transaction':_0x1a11cd});}})[_0x721c('0x17')](function(){_0x1c7108[_0x721c('0x71')](function(_0x21522a){socket['emit'](_0x721c('0x72'),{'UserId':_0x21522a,'MailQueueId':_0x2207bb['id']});});});});});});})[_0x721c('0x17')](respondWithStatusCode(_0x3ece00,null))[_0x721c('0x28')](handleError(_0x3ece00,null));};exports[_0x721c('0x73')]=function(_0x45579d,_0x14e434){return db['MailQueue'][_0x721c('0x32')]({'where':{'id':_0x45579d[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x14e434,null))[_0x721c('0x17')](function(_0x25f064){if(_0x25f064){return _0x25f064['addAgents'](_0x45579d['body'][_0x721c('0x4f')],_[_0x721c('0x74')](_0x45579d['body'],[_0x721c('0x4f'),'id'])||{})[_0x721c('0x75')](function(_0x1b5d20){for(var _0x491555=0x0;_0x491555<_0x45579d[_0x721c('0x39')][_0x721c('0x4f')]['length'];_0x491555+=0x1){socket[_0x721c('0x57')](_0x721c('0x58'),{'UserId':Number(_0x45579d[_0x721c('0x39')][_0x721c('0x4f')][_0x491555]),'MailQueueId':Number(_0x45579d['params']['id'])});}return _0x1b5d20;});}})['then'](respondWithResult(_0x14e434,null))['catch'](handleError(_0x14e434,null));};exports[_0x721c('0x70')]=function(_0x30c7a1,_0x561df4){return db[_0x721c('0x26')][_0x721c('0x32')]({'where':{'id':_0x30c7a1[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0x561df4,null))['then'](function(_0x46414f){if(_0x46414f){return _0x46414f[_0x721c('0x70')](_0x30c7a1[_0x721c('0x25')][_0x721c('0x4f')])[_0x721c('0x17')](function(){if(_['isArray'](_0x30c7a1[_0x721c('0x25')][_0x721c('0x4f')])){for(var _0x1c42cd=0x0;_0x1c42cd<_0x30c7a1[_0x721c('0x25')][_0x721c('0x4f')][_0x721c('0x3d')];_0x1c42cd+=0x1){socket['emit'](_0x721c('0x72'),{'UserId':Number(_0x30c7a1[_0x721c('0x25')][_0x721c('0x4f')][_0x1c42cd]),'MailQueueId':Number(_0x30c7a1[_0x721c('0x29')]['id'])});}}else{socket[_0x721c('0x57')](_0x721c('0x72'),{'UserId':Number(_0x30c7a1['query']['ids']),'MailQueueId':Number(_0x30c7a1['params']['id'])});}});}})[_0x721c('0x17')](respondWithStatusCode(_0x561df4,null))['catch'](handleError(_0x561df4,null));};exports['getAgents']=function(_0x29a551,_0xb28bed){var _0x2d7731={};var _0x54f2db={};var _0x3f36a1;var _0x556310;return db[_0x721c('0x26')]['findOne']({'where':{'id':_0x29a551[_0x721c('0x29')]['id']}})[_0x721c('0x17')](handleEntityNotFound(_0xb28bed,null))[_0x721c('0x17')](function(_0x374cde){if(_0x374cde){_0x3f36a1=_0x374cde;_0x54f2db[_0x721c('0x2c')]=_['keys'](db[_0x721c('0x44')][_0x721c('0x1f')]);_0x54f2db[_0x721c('0x25')]=_[_0x721c('0x2a')](_0x29a551[_0x721c('0x25')]);_0x54f2db[_0x721c('0x3c')]=_[_0x721c('0x2b')](_0x54f2db[_0x721c('0x2c')],_0x54f2db[_0x721c('0x25')]);_0x2d7731['attributes']=_[_0x721c('0x2b')](_0x54f2db[_0x721c('0x2c')],qs[_0x721c('0x2e')](_0x29a551[_0x721c('0x25')]['fields']));_0x2d7731['attributes']=_0x2d7731['attributes'][_0x721c('0x3d')]?_0x2d7731[_0x721c('0x2d')]:_0x54f2db['model'];_0x2d7731[_0x721c('0x40')]=qs['sort'](_0x29a551[_0x721c('0x25')][_0x721c('0x41')]);_0x2d7731[_0x721c('0x23')]=qs[_0x721c('0x3c')](_[_0x721c('0x76')](_0x29a551[_0x721c('0x25')],_0x54f2db[_0x721c('0x3c')]));if(_0x29a551[_0x721c('0x25')][_0x721c('0x42')]){_0x2d7731[_0x721c('0x23')]=_[_0x721c('0x30')](_0x2d7731[_0x721c('0x23')],{'$or':_[_0x721c('0x1e')](_0x2d7731[_0x721c('0x2d')],function(_0x2a9d89){var _0x565295={};_0x565295[_0x2a9d89]={'$like':'%'+_0x29a551[_0x721c('0x25')][_0x721c('0x42')]+'%'};return _0x565295;})});}_0x2d7731=_[_0x721c('0x30')]({},_0x2d7731,_0x29a551['options']);return _0x3f36a1[_0x721c('0x77')](_0x2d7731);}})[_0x721c('0x17')](function(_0x19dc45){if(_0x19dc45){_0x556310=_0x19dc45[_0x721c('0x3d')];if(!_0x29a551[_0x721c('0x25')][_0x721c('0x3e')](_0x721c('0x3f'))){_0x2d7731['limit']=qs['limit'](_0x29a551[_0x721c('0x25')][_0x721c('0x12')]);_0x2d7731[_0x721c('0x10')]=qs['offset'](_0x29a551[_0x721c('0x25')][_0x721c('0x10')]);}return _0x3f36a1[_0x721c('0x77')](_0x2d7731);}})['then'](function(_0x4e7821){if(_0x4e7821){return _0x4e7821?{'count':_0x556310,'rows':_0x4e7821}:null;}})['then'](respondWithResult(_0xb28bed,null))['catch'](handleError(_0xb28bed,null));}; \ No newline at end of file +var _0xf1b0=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','end','status','json','limit','undefined','count','offset','set','update','then','MailQueues','UserProfileResource','destroy','sendStatus','error','name','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','findAll','rows','catch','show','keys','query','filters','model','attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','describe','findOne','UserMailQueue','intersection','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x357d24,_0x5e3bf9){var _0x1eff08=function(_0x1e382c){while(--_0x1e382c){_0x357d24['push'](_0x357d24['shift']());}};_0x1eff08(++_0x5e3bf9);}(_0xf1b0,0x1d5));var _0x0f1b=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0xf1b0[_0x1db831];return _0x39ba56;};'use strict';var BPromise=require('bluebird');var util=require(_0x0f1b('0x0'));var _=require(_0x0f1b('0x1'));var squel=require(_0x0f1b('0x2'));var Redis=require(_0x0f1b('0x3'));var qs=require(_0x0f1b('0x4'));var logger=require(_0x0f1b('0x5'))(_0x0f1b('0x6'));var config=require('../../config/environment');var db=require(_0x0f1b('0x7'))['db'];config[_0x0f1b('0x8')]=_[_0x0f1b('0x9')](config[_0x0f1b('0x8')],{'host':_0x0f1b('0xa'),'port':0x18eb});var socket=require(_0x0f1b('0xb'))(new Redis(config[_0x0f1b('0x8')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x41338c,_0x368244){_0x368244=_0x368244||0xcc;return function(_0xc822de){if(_0xc822de){return _0x41338c['sendStatus'](_0x368244);}return _0x41338c['status'](_0x368244)[_0x0f1b('0xc')]();};}function respondWithResult(_0x315223,_0x261a18){_0x261a18=_0x261a18||0xc8;return function(_0x430536){if(_0x430536){return _0x315223[_0x0f1b('0xd')](_0x261a18)[_0x0f1b('0xe')](_0x430536);}};}function respondWithFilteredResult(_0xab68df,_0x592ca5){return function(_0x27b4b8){if(_0x27b4b8){var _0x21344b=typeof _0x592ca5['offset']==='undefined'&&typeof _0x592ca5[_0x0f1b('0xf')]===_0x0f1b('0x10');var _0x42e1af=_0x27b4b8[_0x0f1b('0x11')];var _0x4f8ba0=_0x21344b?0x0:_0x592ca5['offset'];var _0x1b0771=_0x21344b?_0x27b4b8[_0x0f1b('0x11')]:_0x592ca5[_0x0f1b('0x12')]+_0x592ca5[_0x0f1b('0xf')];var _0x1af1b8;if(_0x1b0771>=_0x42e1af){_0x1b0771=_0x42e1af;_0x1af1b8=0xc8;}else{_0x1af1b8=0xce;}_0xab68df[_0x0f1b('0xd')](_0x1af1b8);return _0xab68df[_0x0f1b('0x13')]('Content-Range',_0x4f8ba0+'-'+_0x1b0771+'/'+_0x42e1af)[_0x0f1b('0xe')](_0x27b4b8);}return null;};}function saveUpdates(_0x49c6c5){return function(_0x56272){if(_0x56272){return _0x56272[_0x0f1b('0x14')](_0x49c6c5)[_0x0f1b('0x15')](function(_0x3dee5f){return _0x3dee5f;});}return null;};}function removeEntity(_0x4b4173){return function(_0x2bc99c){if(_0x2bc99c){return _0x2bc99c['destroy']()[_0x0f1b('0x15')](function(){var _0x4aeadd=_0x2bc99c['get']({'plain':!![]});var _0x26582d=_0x0f1b('0x16');return db[_0x0f1b('0x17')][_0x0f1b('0x18')]({'where':{'type':_0x26582d,'resourceId':_0x4aeadd['id']}})[_0x0f1b('0x15')](function(){return _0x2bc99c;});})[_0x0f1b('0x15')](function(){_0x4b4173[_0x0f1b('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e4606){return function(_0x4a1909){if(!_0x4a1909){_0x2e4606[_0x0f1b('0x19')](0x194);}return _0x4a1909;};}function handleError(_0x4e2ead,_0x2540bf){_0x2540bf=_0x2540bf||0x1f4;return function(_0x3b3a98){logger[_0x0f1b('0x1a')](_0x3b3a98['stack']);if(_0x3b3a98[_0x0f1b('0x1b')]){delete _0x3b3a98[_0x0f1b('0x1b')];}_0x4e2ead[_0x0f1b('0xd')](_0x2540bf)['send'](_0x3b3a98);};}exports[_0x0f1b('0x1c')]=function(_0x4f1e18,_0x343bcb){var _0x29444a={};var _0x349c30={'count':0x0,'rows':[]};var _0x23f566=_[_0x0f1b('0x1d')](db[_0x0f1b('0x1e')][_0x0f1b('0x1f')],function(_0x2a1095){return{'name':_0x2a1095[_0x0f1b('0x20')],'type':_0x2a1095['type'][_0x0f1b('0x21')]};});_0x29444a=qs[_0x0f1b('0x22')](_0x23f566,_0x4f1e18);var _0x43185b={'where':_0x29444a[_0x0f1b('0x23')]};return db[_0x0f1b('0x1e')]['count'](_0x43185b)[_0x0f1b('0x15')](function(_0x4533d8){_0x349c30[_0x0f1b('0x11')]=_0x4533d8;_0x29444a[_0x0f1b('0x24')]=qs[_0x0f1b('0x24')](_0x4f1e18['query']);return db[_0x0f1b('0x1e')][_0x0f1b('0x25')](_0x29444a);})[_0x0f1b('0x15')](function(_0x4c0b31){_0x349c30[_0x0f1b('0x26')]=_0x4c0b31;return _0x349c30;})[_0x0f1b('0x15')](respondWithFilteredResult(_0x343bcb,_0x29444a))[_0x0f1b('0x27')](handleError(_0x343bcb,null));};exports[_0x0f1b('0x28')]=function(_0x2f4127,_0x4e87d8){var _0x46f503={'raw':!![],'where':{'id':_0x2f4127['params']['id']}},_0x8b57f1={};_0x8b57f1['model']=_[_0x0f1b('0x29')](db['MailQueue'][_0x0f1b('0x1f')]);_0x8b57f1[_0x0f1b('0x2a')]=_[_0x0f1b('0x29')](_0x2f4127[_0x0f1b('0x2a')]);_0x8b57f1[_0x0f1b('0x2b')]=_['intersection'](_0x8b57f1[_0x0f1b('0x2c')],_0x8b57f1[_0x0f1b('0x2a')]);_0x46f503[_0x0f1b('0x2d')]=_['intersection'](_0x8b57f1['model'],qs['fields'](_0x2f4127[_0x0f1b('0x2a')][_0x0f1b('0x2e')]));_0x46f503['attributes']=_0x46f503[_0x0f1b('0x2d')][_0x0f1b('0x2f')]?_0x46f503[_0x0f1b('0x2d')]:_0x8b57f1[_0x0f1b('0x2c')];if(_0x2f4127[_0x0f1b('0x2a')][_0x0f1b('0x30')]){_0x46f503[_0x0f1b('0x24')]=[{'all':!![]}];}_0x46f503=_[_0x0f1b('0x31')]({},_0x46f503,_0x2f4127[_0x0f1b('0x32')]);return db[_0x0f1b('0x1e')][_0x0f1b('0x33')](_0x46f503)['then'](handleEntityNotFound(_0x4e87d8,null))[_0x0f1b('0x15')](respondWithResult(_0x4e87d8,null))[_0x0f1b('0x27')](handleError(_0x4e87d8,null));};exports[_0x0f1b('0x34')]=function(_0x37e049,_0x19cda3){return db[_0x0f1b('0x1e')][_0x0f1b('0x34')](_0x37e049[_0x0f1b('0x35')],{})['then'](function(_0x445862){var _0x2bc412=_0x37e049[_0x0f1b('0x36')][_0x0f1b('0x37')]({'plain':!![]});if(!_0x2bc412)throw new Error(_0x0f1b('0x38'));if(_0x2bc412[_0x0f1b('0x39')]===_0x0f1b('0x36')){var _0xce6487=_0x445862[_0x0f1b('0x37')]({'plain':!![]});var _0x2829c8='MailQueues';return db[_0x0f1b('0x3a')][_0x0f1b('0x33')]({'where':{'name':_0x2829c8,'userProfileId':_0x2bc412['userProfileId']},'raw':!![]})['then'](function(_0x3bbf20){if(_0x3bbf20&&_0x3bbf20[_0x0f1b('0x3b')]===0x0){return db[_0x0f1b('0x17')]['create']({'name':_0xce6487[_0x0f1b('0x1b')],'resourceId':_0xce6487['id'],'type':_0x3bbf20['name'],'sectionId':_0x3bbf20['id']},{})[_0x0f1b('0x15')](function(){return _0x445862;});}else{return _0x445862;}})[_0x0f1b('0x27')](function(_0x5c6e0a){logger[_0x0f1b('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6e0a);throw _0x5c6e0a;});}return _0x445862;})[_0x0f1b('0x15')](respondWithResult(_0x19cda3,0xc9))['catch'](handleError(_0x19cda3,null));};exports[_0x0f1b('0x14')]=function(_0x405918,_0x450d3f){if(_0x405918[_0x0f1b('0x35')]['id']){delete _0x405918[_0x0f1b('0x35')]['id'];}return db[_0x0f1b('0x1e')]['find']({'where':{'id':_0x405918[_0x0f1b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x450d3f,null))['then'](saveUpdates(_0x405918['body'],null))[_0x0f1b('0x15')](respondWithResult(_0x450d3f,null))['catch'](handleError(_0x450d3f,null));};exports['destroy']=function(_0x8f26c,_0x31ac70){return db[_0x0f1b('0x1e')]['find']({'where':{'id':_0x8f26c[_0x0f1b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x31ac70,null))[_0x0f1b('0x15')](removeEntity(_0x31ac70,null))[_0x0f1b('0x27')](handleError(_0x31ac70,null));};exports[_0x0f1b('0x3d')]=function(_0x268554,_0x456975){return db['MailQueue'][_0x0f1b('0x3d')]()[_0x0f1b('0x15')](respondWithResult(_0x456975,null))[_0x0f1b('0x27')](handleError(_0x456975,null));};exports['getMembers']=function(_0x31f860,_0x24dfe2){var _0x35d5bc={'raw':!![],'where':{}},_0x31426f={},_0xf0808;return db['MailQueue'][_0x0f1b('0x3e')]({'where':{'id':_0x31f860[_0x0f1b('0x3c')]['id']}})[_0x0f1b('0x15')](handleEntityNotFound(_0x24dfe2,null))[_0x0f1b('0x15')](function(_0x3131da){if(_0x3131da){_0xf0808=_0x3131da[_0x0f1b('0x37')]({'plain':!![]});_0x31426f[_0x0f1b('0x2c')]=_['keys'](db[_0x0f1b('0x3f')][_0x0f1b('0x1f')]);_0x31426f[_0x0f1b('0x2a')]=_[_0x0f1b('0x29')](_0x31f860[_0x0f1b('0x2a')]);_0x31426f[_0x0f1b('0x2b')]=_[_0x0f1b('0x40')](_0x31426f[_0x0f1b('0x2c')],_0x31426f[_0x0f1b('0x2a')]);_0x35d5bc['attributes']=_[_0x0f1b('0x40')](_0x31426f[_0x0f1b('0x2c')],qs['fields'](_0x31f860['query'][_0x0f1b('0x2e')]));_0x35d5bc[_0x0f1b('0x2d')]=_0x35d5bc['attributes'][_0x0f1b('0x2f')]?_0x35d5bc[_0x0f1b('0x2d')]:_0x31426f[_0x0f1b('0x2c')];if(!_0x31f860[_0x0f1b('0x2a')][_0x0f1b('0x41')](_0x0f1b('0x42'))){_0x35d5bc[_0x0f1b('0xf')]=qs[_0x0f1b('0xf')](_0x31f860[_0x0f1b('0x2a')][_0x0f1b('0xf')]);_0x35d5bc[_0x0f1b('0x12')]=qs[_0x0f1b('0x12')](_0x31f860[_0x0f1b('0x2a')]['offset']);}_0x35d5bc[_0x0f1b('0x43')]=qs[_0x0f1b('0x44')](_0x31f860[_0x0f1b('0x2a')][_0x0f1b('0x44')]);_0x35d5bc['where']=qs[_0x0f1b('0x2b')](_[_0x0f1b('0x45')](_0x31f860[_0x0f1b('0x2a')],_0x31426f[_0x0f1b('0x2b')]));_0x35d5bc['where'][_0x0f1b('0x46')]=_0x3131da['id'];if(_0x31f860[_0x0f1b('0x2a')][_0x0f1b('0x47')]){_0x35d5bc['where']=_[_0x0f1b('0x31')](_0x35d5bc[_0x0f1b('0x23')],{'$or':_[_0x0f1b('0x1d')](_0x35d5bc[_0x0f1b('0x2d')],function(_0x6450eb){var _0x199b79={};_0x199b79[_0x6450eb]={'$like':'%'+_0x31f860[_0x0f1b('0x2a')][_0x0f1b('0x47')]+'%'};return _0x199b79;})});}_0x35d5bc=_['merge']({},_0x35d5bc,_0x31f860[_0x0f1b('0x32')]);return db[_0x0f1b('0x3f')][_0x0f1b('0x25')](_0x35d5bc);}})['then'](function(_0x3daa10){if(_0x3daa10){return db[_0x0f1b('0x48')][_0x0f1b('0x49')]({'where':{'id':_[_0x0f1b('0x1d')](_0x3daa10,_0x0f1b('0x4a')),'role':_0x0f1b('0x4b')},'attributes':['id',_0x0f1b('0x1b'),'mailPause',_0x0f1b('0x4c'),_0x0f1b('0x4d')]});}})[_0x0f1b('0x15')](function(_0x3d923f){if(_0x3d923f){return{'count':_0x3d923f[_0x0f1b('0x11')],'rows':_[_0x0f1b('0x1d')](_0x3d923f[_0x0f1b('0x26')],function(_0xafc737){return{'membername':_0xafc737[_0x0f1b('0x1b')],'UserId':_0xafc737['id'],'queue_name':_0xf0808['name'],'MailQueueId':_0xf0808['id'],'interface':util[_0x0f1b('0x4e')](_0x0f1b('0x4f'),_0x0f1b('0x50'),_0xafc737['name']),'penalty':0x0,'paused':_0xafc737['mailPause'],'createdAt':_0xafc737[_0x0f1b('0x4d')],'updatedAt':_0xafc737[_0x0f1b('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0f1b('0x15')](respondWithFilteredResult(_0x24dfe2,_0x35d5bc))[_0x0f1b('0x27')](handleError(_0x24dfe2,null));};exports[_0x0f1b('0x51')]=function(_0x2d553b,_0x562a77){var _0xc96df9={};var _0x2290fb={};var _0x439078;var _0x516758;return db[_0x0f1b('0x1e')]['findOne']({'where':{'id':_0x2d553b[_0x0f1b('0x3c')]['id']}})[_0x0f1b('0x15')](handleEntityNotFound(_0x562a77,null))[_0x0f1b('0x15')](function(_0x31b25c){if(_0x31b25c){_0x439078=_0x31b25c;_0x2290fb[_0x0f1b('0x2c')]=_['keys'](db[_0x0f1b('0x52')]['rawAttributes']);_0x2290fb['query']=_['keys'](_0x2d553b[_0x0f1b('0x2a')]);_0x2290fb['filters']=_[_0x0f1b('0x40')](_0x2290fb['model'],_0x2290fb[_0x0f1b('0x2a')]);_0xc96df9[_0x0f1b('0x2d')]=_[_0x0f1b('0x40')](_0x2290fb[_0x0f1b('0x2c')],qs[_0x0f1b('0x2e')](_0x2d553b[_0x0f1b('0x2a')][_0x0f1b('0x2e')]));_0xc96df9[_0x0f1b('0x2d')]=_0xc96df9[_0x0f1b('0x2d')][_0x0f1b('0x2f')]?_0xc96df9[_0x0f1b('0x2d')]:_0x2290fb['model'];_0xc96df9['order']=qs['sort'](_0x2d553b['query']['sort']);_0xc96df9[_0x0f1b('0x23')]=qs['filters'](_[_0x0f1b('0x45')](_0x2d553b[_0x0f1b('0x2a')],_0x2290fb[_0x0f1b('0x2b')]));if(_0x2d553b[_0x0f1b('0x2a')][_0x0f1b('0x47')]){_0xc96df9[_0x0f1b('0x23')]=_[_0x0f1b('0x31')](_0xc96df9[_0x0f1b('0x23')],{'$or':_[_0x0f1b('0x1d')](_0xc96df9[_0x0f1b('0x2d')],function(_0x25c272){var _0x51a19e={};_0x51a19e[_0x25c272]={'$like':'%'+_0x2d553b[_0x0f1b('0x2a')][_0x0f1b('0x47')]+'%'};return _0x51a19e;})});}_0xc96df9=_['merge']({},_0xc96df9,_0x2d553b[_0x0f1b('0x32')]);return _0x439078[_0x0f1b('0x51')](_0xc96df9);}})['then'](function(_0x34b149){if(_0x34b149){_0x516758=_0x34b149['length'];if(!_0x2d553b[_0x0f1b('0x2a')]['hasOwnProperty'](_0x0f1b('0x42'))){_0xc96df9[_0x0f1b('0xf')]=qs[_0x0f1b('0xf')](_0x2d553b[_0x0f1b('0x2a')]['limit']);_0xc96df9[_0x0f1b('0x12')]=qs['offset'](_0x2d553b[_0x0f1b('0x2a')][_0x0f1b('0x12')]);}return _0x439078[_0x0f1b('0x51')](_0xc96df9);}})[_0x0f1b('0x15')](function(_0x748b88){if(_0x748b88){return _0x748b88?{'count':_0x516758,'rows':_0x748b88}:null;}})['then'](respondWithResult(_0x562a77,null))['catch'](handleError(_0x562a77,null));};exports[_0x0f1b('0x53')]=function(_0x207089,_0x286ff1){var _0x421f30=_0x207089['body'][_0x0f1b('0x54')];return db[_0x0f1b('0x52')][_0x0f1b('0x25')]({'where':{'id':_0x421f30},'attributes':['id'],'include':[{'model':db[_0x0f1b('0x48')],'as':_0x0f1b('0x55'),'attributes':['id',_0x0f1b('0x1b'),_0x0f1b('0x56'),_0x0f1b('0x57'),'interface'],'raw':!![]}]})[_0x0f1b('0x15')](function(_0x5667a7){if(_0x5667a7){var _0x6d4112=_[_0x0f1b('0x58')](_0x5667a7,function(_0x1a26fe){var _0x1e5043=_0x1a26fe[_0x0f1b('0x37')]({'plain':!![]});return _0x1e5043['Agents'];});return db[_0x0f1b('0x1e')][_0x0f1b('0x33')]({'where':{'id':_0x207089['params']['id']}})[_0x0f1b('0x15')](function(_0x9e4ac8){return db[_0x0f1b('0x59')]['transaction'](function(_0x487909){return _0x9e4ac8[_0x0f1b('0x53')](_0x421f30,{'transaction':_0x487909})[_0x0f1b('0x15')](function(){return BPromise[_0x0f1b('0x5a')](_0x6d4112,function(_0x45e28a){return db['UserMailQueue'][_0x0f1b('0x5b')]({'where':{'UserId':_0x45e28a['id'],'MailQueueId':_0x207089[_0x0f1b('0x3c')]['id']},'transaction':_0x487909});});})['then'](function(){_0x6d4112[_0x0f1b('0x5c')](function(_0x36f52f){socket[_0x0f1b('0x5d')](_0x0f1b('0x5e'),{'UserId':_0x36f52f['id'],'MailQueueId':_0x9e4ac8['id']});});});});});}})[_0x0f1b('0x15')](respondWithStatusCode(_0x286ff1,null))[_0x0f1b('0x27')](handleError(_0x286ff1,null));};exports[_0x0f1b('0x5f')]=function(_0x29fc33,_0x423569){return db[_0x0f1b('0x52')]['findAll']({'where':{'id':_0x29fc33[_0x0f1b('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0f1b('0x55'),'attributes':['id'],'raw':!![]}]})[_0x0f1b('0x15')](handleEntityNotFound(_0x423569,null))['then'](function(_0x47d502){var _0x583cb9=_[_0x0f1b('0x1d')](_0x47d502,'id');var _0x5eb212=[];var _0x1b7cb9=[];var _0x4f094b=squel[_0x0f1b('0x60')]();_0x4f094b['field'](_0x0f1b('0x61'))['from'](_0x0f1b('0x62'),'tq')['join'](_0x0f1b('0x63'),'ut',_0x0f1b('0x64'))['where']('MailQueueId\x20=\x20?',_0x29fc33[_0x0f1b('0x3c')]['id']);for(var _0x5d84ad=0x0;_0x5d84ad<_0x47d502[_0x0f1b('0x2f')];_0x5d84ad+=0x1){let _0x30d104=_0x47d502[_0x5d84ad];for(var _0x50cf62=0x0;_0x50cf62<_0x30d104[_0x0f1b('0x55')][_0x0f1b('0x2f')];_0x50cf62+=0x1){let _0x1d4f6f=_0x30d104[_0x0f1b('0x55')][_0x50cf62];var _0x50db5f=_0x4f094b['clone']();_0x50db5f['where'](_0x0f1b('0x65'),_0x1d4f6f['id']);_0x1b7cb9[_0x0f1b('0x66')](db[_0x0f1b('0x59')][_0x0f1b('0x2a')](_0x50db5f[_0x0f1b('0x67')](),{'type':db['sequelize'][_0x0f1b('0x68')][_0x0f1b('0x69')]})[_0x0f1b('0x15')](function(_0x4b1ffe){if(_0x4b1ffe['length']===0x1){return _0x1d4f6f['id'];}else{var _0x17abc5=_['every'](_[_0x0f1b('0x1d')](_0x4b1ffe,_0x0f1b('0x6a')),function(_0x199c68){return _['includes'](_0x583cb9,_0x199c68);});if(_0x17abc5){return _0x1d4f6f['id'];}}}));}}return BPromise[_0x0f1b('0x6b')](_0x1b7cb9)[_0x0f1b('0x15')](function(_0x2b0820){_0x5eb212=_(_0x5eb212)[_0x0f1b('0x6c')](_0x2b0820)[_0x0f1b('0x6d')]()[_0x0f1b('0x6e')]();return db[_0x0f1b('0x1e')][_0x0f1b('0x33')]({'where':{'id':_0x29fc33[_0x0f1b('0x3c')]['id']}})[_0x0f1b('0x15')](function(_0x2b1c2b){return db[_0x0f1b('0x59')][_0x0f1b('0x6f')](function(_0x29c1b0){return _0x2b1c2b[_0x0f1b('0x5f')](_0x29fc33['query'][_0x0f1b('0x54')],{'transaction':_0x29c1b0})['then'](function(){if(!_[_0x0f1b('0x70')](_0x5eb212)){return _0x2b1c2b[_0x0f1b('0x71')](_0x5eb212,{'transaction':_0x29c1b0});}})[_0x0f1b('0x15')](function(){_0x5eb212[_0x0f1b('0x5c')](function(_0x36ee90){socket[_0x0f1b('0x5d')](_0x0f1b('0x72'),{'UserId':_0x36ee90,'MailQueueId':_0x2b1c2b['id']});});});});});});})[_0x0f1b('0x15')](respondWithStatusCode(_0x423569,null))[_0x0f1b('0x27')](handleError(_0x423569,null));};exports[_0x0f1b('0x73')]=function(_0x5a24bc,_0x5031a9){return db[_0x0f1b('0x1e')][_0x0f1b('0x33')]({'where':{'id':_0x5a24bc['params']['id']}})[_0x0f1b('0x15')](handleEntityNotFound(_0x5031a9,null))[_0x0f1b('0x15')](function(_0x4c0135){if(_0x4c0135){return _0x4c0135['addAgents'](_0x5a24bc['body'][_0x0f1b('0x54')],_[_0x0f1b('0x74')](_0x5a24bc[_0x0f1b('0x35')],['ids','id'])||{})['spread'](function(_0x387c23){for(var _0x172c7c=0x0;_0x172c7c<_0x5a24bc['body'][_0x0f1b('0x54')][_0x0f1b('0x2f')];_0x172c7c+=0x1){socket[_0x0f1b('0x5d')](_0x0f1b('0x5e'),{'UserId':Number(_0x5a24bc[_0x0f1b('0x35')]['ids'][_0x172c7c]),'MailQueueId':Number(_0x5a24bc[_0x0f1b('0x3c')]['id'])});}return _0x387c23;});}})[_0x0f1b('0x15')](respondWithResult(_0x5031a9,null))['catch'](handleError(_0x5031a9,null));};exports['removeAgents']=function(_0x41f86b,_0xcd6228){return db[_0x0f1b('0x1e')][_0x0f1b('0x33')]({'where':{'id':_0x41f86b['params']['id']}})[_0x0f1b('0x15')](handleEntityNotFound(_0xcd6228,null))[_0x0f1b('0x15')](function(_0x39116c){if(_0x39116c){return _0x39116c['removeAgents'](_0x41f86b[_0x0f1b('0x2a')][_0x0f1b('0x54')])[_0x0f1b('0x15')](function(){if(_[_0x0f1b('0x75')](_0x41f86b['query'][_0x0f1b('0x54')])){for(var _0x4b0ad4=0x0;_0x4b0ad4<_0x41f86b['query'][_0x0f1b('0x54')][_0x0f1b('0x2f')];_0x4b0ad4+=0x1){socket['emit'](_0x0f1b('0x72'),{'UserId':Number(_0x41f86b[_0x0f1b('0x2a')][_0x0f1b('0x54')][_0x4b0ad4]),'MailQueueId':Number(_0x41f86b[_0x0f1b('0x3c')]['id'])});}}else{socket[_0x0f1b('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x41f86b[_0x0f1b('0x2a')][_0x0f1b('0x54')]),'MailQueueId':Number(_0x41f86b[_0x0f1b('0x3c')]['id'])});}});}})['then'](respondWithStatusCode(_0xcd6228,null))[_0x0f1b('0x27')](handleError(_0xcd6228,null));};exports[_0x0f1b('0x76')]=function(_0x32d2a9,_0x3ee372){var _0x3f72b6={};var _0xb1327e={};var _0x1e6767;var _0x19d76a;return db[_0x0f1b('0x1e')][_0x0f1b('0x3e')]({'where':{'id':_0x32d2a9[_0x0f1b('0x3c')]['id']}})[_0x0f1b('0x15')](handleEntityNotFound(_0x3ee372,null))[_0x0f1b('0x15')](function(_0x3e7eaf){if(_0x3e7eaf){_0x1e6767=_0x3e7eaf;_0xb1327e[_0x0f1b('0x2c')]=_['keys'](db[_0x0f1b('0x48')][_0x0f1b('0x1f')]);_0xb1327e['query']=_[_0x0f1b('0x29')](_0x32d2a9[_0x0f1b('0x2a')]);_0xb1327e[_0x0f1b('0x2b')]=_[_0x0f1b('0x40')](_0xb1327e[_0x0f1b('0x2c')],_0xb1327e[_0x0f1b('0x2a')]);_0x3f72b6[_0x0f1b('0x2d')]=_[_0x0f1b('0x40')](_0xb1327e['model'],qs[_0x0f1b('0x2e')](_0x32d2a9[_0x0f1b('0x2a')]['fields']));_0x3f72b6[_0x0f1b('0x2d')]=_0x3f72b6['attributes'][_0x0f1b('0x2f')]?_0x3f72b6[_0x0f1b('0x2d')]:_0xb1327e[_0x0f1b('0x2c')];_0x3f72b6[_0x0f1b('0x43')]=qs[_0x0f1b('0x44')](_0x32d2a9[_0x0f1b('0x2a')]['sort']);_0x3f72b6['where']=qs[_0x0f1b('0x2b')](_[_0x0f1b('0x45')](_0x32d2a9[_0x0f1b('0x2a')],_0xb1327e[_0x0f1b('0x2b')]));if(_0x32d2a9[_0x0f1b('0x2a')][_0x0f1b('0x47')]){_0x3f72b6[_0x0f1b('0x23')]=_['merge'](_0x3f72b6['where'],{'$or':_[_0x0f1b('0x1d')](_0x3f72b6[_0x0f1b('0x2d')],function(_0x3afb46){var _0x2e7b09={};_0x2e7b09[_0x3afb46]={'$like':'%'+_0x32d2a9[_0x0f1b('0x2a')][_0x0f1b('0x47')]+'%'};return _0x2e7b09;})});}_0x3f72b6=_['merge']({},_0x3f72b6,_0x32d2a9[_0x0f1b('0x32')]);return _0x1e6767['getAgents'](_0x3f72b6);}})['then'](function(_0x5fac7a){if(_0x5fac7a){_0x19d76a=_0x5fac7a[_0x0f1b('0x2f')];if(!_0x32d2a9[_0x0f1b('0x2a')]['hasOwnProperty'](_0x0f1b('0x42'))){_0x3f72b6[_0x0f1b('0xf')]=qs[_0x0f1b('0xf')](_0x32d2a9[_0x0f1b('0x2a')][_0x0f1b('0xf')]);_0x3f72b6[_0x0f1b('0x12')]=qs[_0x0f1b('0x12')](_0x32d2a9['query'][_0x0f1b('0x12')]);}return _0x1e6767['getAgents'](_0x3f72b6);}})[_0x0f1b('0x15')](function(_0x46b4bd){if(_0x46b4bd){return _0x46b4bd?{'count':_0x19d76a,'rows':_0x46b4bd}:null;}})['then'](respondWithResult(_0x3ee372,null))['catch'](handleError(_0x3ee372,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7d49e64..f6d2ab5 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 _0x649f=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4c7594,_0x270c9c){var _0x2f0614=function(_0x5cb540){while(--_0x5cb540){_0x4c7594['push'](_0x4c7594['shift']());}};_0x2f0614(++_0x270c9c);}(_0x649f,0x1ae));var _0xf649=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x649f[_0xbf8ebe];return _0x1e25e8;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xf649('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf649('0x1')](0x0);var events={'afterCreate':_0xf649('0x2'),'afterUpdate':'update','afterDestroy':_0xf649('0x3')};function emitEvent(_0x3feebf){return function(_0x5f1297,_0x558770,_0x26fe55){MailQueueEvents[_0xf649('0x4')](_0x3feebf+':'+_0x5f1297['id'],_0x5f1297);MailQueueEvents[_0xf649('0x4')](_0x3feebf,_0x5f1297);_0x26fe55(null);};}for(var e in events){if(events[_0xf649('0x5')](e)){var event=events[e];MailQueue[_0xf649('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xc091=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0xc091,0x159));var _0x1c09=function(_0x34c1ab,_0x8d09a8){_0x34c1ab=_0x34c1ab-0x0;var _0x44fa8d=_0xc091[_0x34c1ab];return _0x44fa8d;};'use strict';var EventEmitter=require(_0x1c09('0x0'));var MailQueue=require(_0x1c09('0x1'))['db'][_0x1c09('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1c09('0x3')](0x0);var events={'afterCreate':_0x1c09('0x4'),'afterUpdate':_0x1c09('0x5'),'afterDestroy':_0x1c09('0x6')};function emitEvent(_0x25283d){return function(_0x27fc47,_0x2851ac,_0x147b45){MailQueueEvents[_0x1c09('0x7')](_0x25283d+':'+_0x27fc47['id'],_0x27fc47);MailQueueEvents[_0x1c09('0x7')](_0x25283d,_0x27fc47);_0x147b45(null);};}for(var e in events){if(events[_0x1c09('0x8')](e)){var event=events[e];MailQueue[_0x1c09('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b0c3dc0..408a0b2 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 _0xa256=['request-promise','path','rimraf','exports','define','MailQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1a9cd3,_0x16882e){var _0x3f5026=function(_0x17fc09){while(--_0x17fc09){_0x1a9cd3['push'](_0x1a9cd3['shift']());}};_0x3f5026(++_0x16882e);}(_0xa256,0x1a8));var _0x6a25=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xa256[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x6a25('0x0'));var util=require(_0x6a25('0x1'));var logger=require(_0x6a25('0x2'))('api');var moment=require(_0x6a25('0x3'));var BPromise=require(_0x6a25('0x4'));var rp=require(_0x6a25('0x5'));var fs=require('fs');var path=require(_0x6a25('0x6'));var rimraf=require(_0x6a25('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x6a25('0x8')]=function(_0x1a94a9,_0x59c104){return _0x1a94a9[_0x6a25('0x9')](_0x6a25('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7cf=['api','bluebird','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','../../config/logger'];(function(_0x2ff0de,_0x59cc17){var _0x5f4516=function(_0x4fa9d1){while(--_0x4fa9d1){_0x2ff0de['push'](_0x2ff0de['shift']());}};_0x5f4516(++_0x59cc17);}(_0xc7cf,0x1ca));var _0xfc7c=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0xc7cf[_0x57b236];return _0x4feb29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc7c('0x0'))(_0xfc7c('0x1'));var moment=require('moment');var BPromise=require(_0xfc7c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc7c('0x3'));var config=require(_0xfc7c('0x4'));var attributes=require(_0xfc7c('0x5'));module[_0xfc7c('0x6')]=function(_0x6dc46d,_0x3b040f){return _0x6dc46d['define'](_0xfc7c('0x7'),attributes,{'tableName':_0xfc7c('0x8'),'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 867b6bc..be13cfb 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 _0xa227=['result','GetMailQueue','MailQueue','options','raw','attributes','limit','include','map','model','debug','catch','ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x19caba,_0x2078d7){var _0x441070=function(_0x20bf38){while(--_0x20bf38){_0x19caba['push'](_0x19caba['shift']());}};_0x441070(++_0x2078d7);}(_0xa227,0x18b));var _0x7a22=function(_0x143089,_0x3ff842){_0x143089=_0x143089-0x0;var _0x3196fc=_0xa227[_0x143089];return _0x3196fc;};'use strict';var _=require(_0x7a22('0x0'));var util=require(_0x7a22('0x1'));var moment=require(_0x7a22('0x2'));var BPromise=require(_0x7a22('0x3'));var rs=require(_0x7a22('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a22('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a22('0x6'))('rpc');var config=require(_0x7a22('0x7'));var jayson=require(_0x7a22('0x8'));var client=jayson['client'][_0x7a22('0x9')]({'port':0x232a});config[_0x7a22('0xa')]=_[_0x7a22('0xb')](config[_0x7a22('0xa')],{'host':_0x7a22('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x7a22('0xd')](socket);function respondWithRpcPromise(_0x3a2d6d,_0x38de7e,_0x5a18d0){return new BPromise(function(_0x337735,_0x2254ff){return client['request'](_0x3a2d6d,_0x5a18d0)[_0x7a22('0xe')](function(_0x426a99){logger[_0x7a22('0xf')](_0x7a22('0x10'),_0x38de7e,_0x7a22('0x11'));logger['debug'](_0x7a22('0x12'),_0x38de7e,_0x7a22('0x11'),JSON[_0x7a22('0x13')](_0x426a99));if(_0x426a99[_0x7a22('0x14')]){if(_0x426a99[_0x7a22('0x14')][_0x7a22('0x15')]===0x1f4){logger[_0x7a22('0x14')](_0x7a22('0x10'),_0x38de7e,_0x426a99[_0x7a22('0x14')][_0x7a22('0x16')]);return _0x2254ff(_0x426a99[_0x7a22('0x14')]['message']);}logger[_0x7a22('0x14')](_0x7a22('0x10'),_0x38de7e,_0x426a99[_0x7a22('0x14')][_0x7a22('0x16')]);return _0x337735(_0x426a99['error'][_0x7a22('0x16')]);}else{logger[_0x7a22('0xf')](_0x7a22('0x10'),_0x38de7e,_0x7a22('0x11'));_0x337735(_0x426a99[_0x7a22('0x17')][_0x7a22('0x16')]);}})['catch'](function(_0x796273){logger[_0x7a22('0x14')](_0x7a22('0x10'),_0x38de7e,_0x796273);_0x2254ff(_0x796273);});});}exports[_0x7a22('0x18')]=function(_0x23fe70){var _0x4c7a83=this;return new Promise(function(_0x5b3995,_0x173e8b){return db[_0x7a22('0x19')]['findAll']({'raw':_0x23fe70['options']?_0x23fe70[_0x7a22('0x1a')][_0x7a22('0x1b')]===undefined?!![]:![]:!![],'where':_0x23fe70['options']?_0x23fe70[_0x7a22('0x1a')]['where']||null:null,'attributes':_0x23fe70['options']?_0x23fe70[_0x7a22('0x1a')][_0x7a22('0x1c')]||null:null,'limit':_0x23fe70[_0x7a22('0x1a')]?_0x23fe70['options'][_0x7a22('0x1d')]||null:null,'include':_0x23fe70[_0x7a22('0x1a')]?_0x23fe70[_0x7a22('0x1a')][_0x7a22('0x1e')]?_['map'](_0x23fe70['options'][_0x7a22('0x1e')],function(_0x254247){return{'model':db[_0x254247['model']],'as':_0x254247['as'],'attributes':_0x254247[_0x7a22('0x1c')],'include':_0x254247[_0x7a22('0x1e')]?_[_0x7a22('0x1f')](_0x254247['include'],function(_0xdff368){return{'model':db[_0xdff368[_0x7a22('0x20')]],'as':_0xdff368['as'],'attributes':_0xdff368[_0x7a22('0x1c')],'include':_0xdff368[_0x7a22('0x1e')]?_[_0x7a22('0x1f')](_0xdff368[_0x7a22('0x1e')],function(_0x336dff){return{'model':db[_0x336dff['model']],'as':_0x336dff['as'],'attributes':_0x336dff[_0x7a22('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a22('0xe')](function(_0x50140c){logger[_0x7a22('0xf')](_0x7a22('0x18'),_0x23fe70);logger[_0x7a22('0x21')]('GetMailQueue',_0x23fe70,JSON[_0x7a22('0x13')](_0x50140c));_0x5b3995(_0x50140c);})[_0x7a22('0x22')](function(_0x11f67d){logger[_0x7a22('0x14')](_0x7a22('0x18'),_0x11f67d[_0x7a22('0x16')],_0x23fe70);_0x173e8b(_0x4c7a83['error'](0x1f4,_0x11f67d[_0x7a22('0x16')]));});});};exports[_0x7a22('0x23')]=function(_0x15a84f){var _0x3ab16b=this;return new Promise(function(_0x1b3f76,_0x45545d){return db[_0x7a22('0x19')][_0x7a22('0x24')]({'raw':_0x15a84f['options']?_0x15a84f[_0x7a22('0x1a')][_0x7a22('0x1b')]===undefined?!![]:![]:!![],'where':_0x15a84f[_0x7a22('0x1a')]?_0x15a84f[_0x7a22('0x1a')][_0x7a22('0x25')]||null:null,'attributes':_0x15a84f[_0x7a22('0x1a')]?_0x15a84f['options'][_0x7a22('0x1c')]||null:null,'include':_0x15a84f['options']?_0x15a84f[_0x7a22('0x1a')][_0x7a22('0x1e')]?_['map'](_0x15a84f[_0x7a22('0x1a')]['include'],function(_0x1406df){return{'model':db[_0x1406df[_0x7a22('0x20')]],'as':_0x1406df['as'],'attributes':_0x1406df[_0x7a22('0x1c')],'include':_0x1406df[_0x7a22('0x1e')]?_[_0x7a22('0x1f')](_0x1406df[_0x7a22('0x1e')],function(_0x14d056){return{'model':db[_0x14d056['model']],'as':_0x14d056['as'],'attributes':_0x14d056['attributes'],'include':_0x14d056[_0x7a22('0x1e')]?_[_0x7a22('0x1f')](_0x14d056[_0x7a22('0x1e')],function(_0x2f784e){return{'model':db[_0x2f784e[_0x7a22('0x20')]],'as':_0x2f784e['as'],'attributes':_0x2f784e[_0x7a22('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a22('0xe')](function(_0x56b169){logger[_0x7a22('0xf')](_0x7a22('0x23'),_0x15a84f);logger[_0x7a22('0x21')](_0x7a22('0x23'),_0x15a84f,JSON[_0x7a22('0x13')](_0x56b169));_0x1b3f76(_0x56b169);})[_0x7a22('0x22')](function(_0x599966){logger[_0x7a22('0x14')](_0x7a22('0x23'),_0x599966['message'],_0x15a84f);_0x45545d(_0x3ab16b[_0x7a22('0x14')](0x1f4,_0x599966[_0x7a22('0x16')]));});});}; \ No newline at end of file +var _0xf281=['http','redis','defaults','socket.io-emitter','./mailQueue.socket','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','MailQueue','options','where','limit','map','include','model','attributes','GetMailQueue','catch','ShowMailQueue','find','raw','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1e6f9e,_0x3e91bb){var _0x198686=function(_0x31758f){while(--_0x31758f){_0x1e6f9e['push'](_0x1e6f9e['shift']());}};_0x198686(++_0x3e91bb);}(_0xf281,0xba));var _0x1f28=function(_0x145791,_0x21f198){_0x145791=_0x145791-0x0;var _0x2900ea=_0xf281[_0x145791];return _0x2900ea;};'use strict';var _=require('lodash');var util=require(_0x1f28('0x0'));var moment=require(_0x1f28('0x1'));var BPromise=require(_0x1f28('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f28('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f28('0x4'))(_0x1f28('0x5'));var config=require(_0x1f28('0x6'));var jayson=require(_0x1f28('0x7'));var client=jayson[_0x1f28('0x8')][_0x1f28('0x9')]({'port':0x232a});config[_0x1f28('0xa')]=_[_0x1f28('0xb')](config[_0x1f28('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f28('0xc'))(new Redis(config['redis']));require(_0x1f28('0xd'))['register'](socket);function respondWithRpcPromise(_0x13168d,_0x3e16cc,_0x24c01f){return new BPromise(function(_0x55ed8a,_0x25f3fc){return client[_0x1f28('0xe')](_0x13168d,_0x24c01f)[_0x1f28('0xf')](function(_0x16ca28){logger[_0x1f28('0x10')]('MailQueue,\x20%s,\x20%s',_0x3e16cc,_0x1f28('0x11'));logger[_0x1f28('0x12')](_0x1f28('0x13'),_0x3e16cc,_0x1f28('0x11'),JSON[_0x1f28('0x14')](_0x16ca28));if(_0x16ca28['error']){if(_0x16ca28[_0x1f28('0x15')][_0x1f28('0x16')]===0x1f4){logger[_0x1f28('0x15')](_0x1f28('0x17'),_0x3e16cc,_0x16ca28['error'][_0x1f28('0x18')]);return _0x25f3fc(_0x16ca28[_0x1f28('0x15')]['message']);}logger[_0x1f28('0x15')](_0x1f28('0x17'),_0x3e16cc,_0x16ca28['error'][_0x1f28('0x18')]);return _0x55ed8a(_0x16ca28[_0x1f28('0x15')][_0x1f28('0x18')]);}else{logger[_0x1f28('0x10')]('MailQueue,\x20%s,\x20%s',_0x3e16cc,_0x1f28('0x11'));_0x55ed8a(_0x16ca28[_0x1f28('0x19')]['message']);}})['catch'](function(_0xda4243){logger[_0x1f28('0x15')](_0x1f28('0x17'),_0x3e16cc,_0xda4243);_0x25f3fc(_0xda4243);});});}exports['GetMailQueue']=function(_0x4499f6){var _0x1d945e=this;return new Promise(function(_0x12fdb6,_0x526a9d){return db[_0x1f28('0x1a')]['findAll']({'raw':_0x4499f6[_0x1f28('0x1b')]?_0x4499f6[_0x1f28('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4499f6[_0x1f28('0x1b')]?_0x4499f6[_0x1f28('0x1b')][_0x1f28('0x1c')]||null:null,'attributes':_0x4499f6['options']?_0x4499f6[_0x1f28('0x1b')]['attributes']||null:null,'limit':_0x4499f6[_0x1f28('0x1b')]?_0x4499f6[_0x1f28('0x1b')][_0x1f28('0x1d')]||null:null,'include':_0x4499f6[_0x1f28('0x1b')]?_0x4499f6[_0x1f28('0x1b')]['include']?_[_0x1f28('0x1e')](_0x4499f6[_0x1f28('0x1b')][_0x1f28('0x1f')],function(_0x4409d6){return{'model':db[_0x4409d6[_0x1f28('0x20')]],'as':_0x4409d6['as'],'attributes':_0x4409d6[_0x1f28('0x21')],'include':_0x4409d6[_0x1f28('0x1f')]?_[_0x1f28('0x1e')](_0x4409d6[_0x1f28('0x1f')],function(_0x27600f){return{'model':db[_0x27600f[_0x1f28('0x20')]],'as':_0x27600f['as'],'attributes':_0x27600f[_0x1f28('0x21')],'include':_0x27600f['include']?_[_0x1f28('0x1e')](_0x27600f[_0x1f28('0x1f')],function(_0x4aa175){return{'model':db[_0x4aa175[_0x1f28('0x20')]],'as':_0x4aa175['as'],'attributes':_0x4aa175[_0x1f28('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1f28('0xf')](function(_0x119f64){logger[_0x1f28('0x10')](_0x1f28('0x22'),_0x4499f6);logger['debug'](_0x1f28('0x22'),_0x4499f6,JSON['stringify'](_0x119f64));_0x12fdb6(_0x119f64);})[_0x1f28('0x23')](function(_0x2d75ab){logger[_0x1f28('0x15')](_0x1f28('0x22'),_0x2d75ab['message'],_0x4499f6);_0x526a9d(_0x1d945e['error'](0x1f4,_0x2d75ab[_0x1f28('0x18')]));});});};exports[_0x1f28('0x24')]=function(_0x687294){var _0x457c3e=this;return new Promise(function(_0x555595,_0x12d0c4){return db[_0x1f28('0x1a')][_0x1f28('0x25')]({'raw':_0x687294['options']?_0x687294[_0x1f28('0x1b')][_0x1f28('0x26')]===undefined?!![]:![]:!![],'where':_0x687294[_0x1f28('0x1b')]?_0x687294[_0x1f28('0x1b')][_0x1f28('0x1c')]||null:null,'attributes':_0x687294[_0x1f28('0x1b')]?_0x687294[_0x1f28('0x1b')][_0x1f28('0x21')]||null:null,'include':_0x687294[_0x1f28('0x1b')]?_0x687294[_0x1f28('0x1b')]['include']?_[_0x1f28('0x1e')](_0x687294[_0x1f28('0x1b')][_0x1f28('0x1f')],function(_0x2488e4){return{'model':db[_0x2488e4[_0x1f28('0x20')]],'as':_0x2488e4['as'],'attributes':_0x2488e4[_0x1f28('0x21')],'include':_0x2488e4['include']?_['map'](_0x2488e4[_0x1f28('0x1f')],function(_0xe75a3d){return{'model':db[_0xe75a3d[_0x1f28('0x20')]],'as':_0xe75a3d['as'],'attributes':_0xe75a3d[_0x1f28('0x21')],'include':_0xe75a3d[_0x1f28('0x1f')]?_['map'](_0xe75a3d[_0x1f28('0x1f')],function(_0x3eed7e){return{'model':db[_0x3eed7e[_0x1f28('0x20')]],'as':_0x3eed7e['as'],'attributes':_0x3eed7e[_0x1f28('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c496f){logger[_0x1f28('0x10')](_0x1f28('0x24'),_0x687294);logger[_0x1f28('0x12')]('ShowMailQueue',_0x687294,JSON[_0x1f28('0x14')](_0x5c496f));_0x555595(_0x5c496f);})[_0x1f28('0x23')](function(_0x4f8987){logger[_0x1f28('0x15')](_0x1f28('0x24'),_0x4f8987[_0x1f28('0x18')],_0x687294);_0x12d0c4(_0x457c3e[_0x1f28('0x15')](0x1f4,_0x4f8987[_0x1f28('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 70a7011..0fdeacc 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 _0x758c=['length','mailQueue:','./mailQueue.events','save','remove','emit','removeListener','register'];(function(_0x4c8573,_0x46396c){var _0x4e1794=function(_0x4cdba1){while(--_0x4cdba1){_0x4c8573['push'](_0x4c8573['shift']());}};_0x4e1794(++_0x46396c);}(_0x758c,0xd2));var _0xc758=function(_0x5aa2f4,_0x27f5fe){_0x5aa2f4=_0x5aa2f4-0x0;var _0x3ae835=_0x758c[_0x5aa2f4];return _0x3ae835;};'use strict';var MailQueueEvents=require(_0xc758('0x0'));var events=[_0xc758('0x1'),_0xc758('0x2'),'update'];function createListener(_0x5f505a,_0x1b0ff8){return function(_0x4fcbd0){_0x1b0ff8[_0xc758('0x3')](_0x5f505a,_0x4fcbd0);};}function removeListener(_0x4c60d0,_0x3a6b3a){return function(){MailQueueEvents[_0xc758('0x4')](_0x4c60d0,_0x3a6b3a);};}exports[_0xc758('0x5')]=function(_0x520eda){for(var _0x23ba21=0x0,_0x258c8f=events[_0xc758('0x6')];_0x23ba21<_0x258c8f;_0x23ba21++){var _0x4181e5=events[_0x23ba21];var _0xeaf672=createListener(_0xc758('0x7')+_0x4181e5,_0x520eda);MailQueueEvents['on'](_0x4181e5,_0xeaf672);}}; \ No newline at end of file +var _0xa45b=['mailQueue:','save','remove','emit','register','length'];(function(_0x916164,_0x3096b1){var _0x336142=function(_0x1901c8){while(--_0x1901c8){_0x916164['push'](_0x916164['shift']());}};_0x336142(++_0x3096b1);}(_0xa45b,0x199));var _0xba45=function(_0x1a7d54,_0x2508aa){_0x1a7d54=_0x1a7d54-0x0;var _0x32f29c=_0xa45b[_0x1a7d54];return _0x32f29c;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xba45('0x0'),_0xba45('0x1'),'update'];function createListener(_0x4be628,_0x5390e4){return function(_0x22c95a){_0x5390e4[_0xba45('0x2')](_0x4be628,_0x22c95a);};}function removeListener(_0xfe4200,_0x35008a){return function(){MailQueueEvents['removeListener'](_0xfe4200,_0x35008a);};}exports[_0xba45('0x3')]=function(_0x14ee6c){for(var _0x330e53=0x0,_0x298bfc=events[_0xba45('0x4')];_0x330e53<_0x298bfc;_0x330e53++){var _0x20905f=events[_0x330e53];var _0x1a7a40=createListener(_0xba45('0x5')+_0x20905f,_0x14ee6c);MailQueueEvents['on'](_0x20905f,_0x1a7a40);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ba3281c..603297a 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 _0x729a=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','put','update','delete'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x729a,0x10b));var _0xa729=function(_0x54b766,_0x313856){_0x54b766=_0x54b766-0x0;var _0x1ddc75=_0x729a[_0x54b766];return _0x1ddc75;};'use strict';var multer=require(_0xa729('0x0'));var util=require(_0xa729('0x1'));var path=require(_0xa729('0x2'));var timeout=require('connect-timeout');var express=require(_0xa729('0x3'));var router=express[_0xa729('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa729('0x5'));var interaction=require(_0xa729('0x6'));var config=require('../../config/environment');var controller=require(_0xa729('0x7'));router['get']('/',auth[_0xa729('0x8')](),controller[_0xa729('0x9')]);router['get'](_0xa729('0xa'),auth[_0xa729('0x8')](),controller[_0xa729('0xb')]);router[_0xa729('0xc')](_0xa729('0xd'),auth[_0xa729('0x8')](),controller[_0xa729('0xe')]);router['post']('/',auth[_0xa729('0x8')](),controller['create']);router[_0xa729('0xf')](_0xa729('0xd'),auth['isAuthenticated'](),controller[_0xa729('0x10')]);router[_0xa729('0x11')]('/:id',auth[_0xa729('0x8')](),controller[_0xa729('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdd05=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller'];(function(_0x4b125e,_0x36dea5){var _0x209366=function(_0x3b9569){while(--_0x3b9569){_0x4b125e['push'](_0x4b125e['shift']());}};_0x209366(++_0x36dea5);}(_0xdd05,0x1c2));var _0x5dd0=function(_0x58a0bb,_0x3464b8){_0x58a0bb=_0x58a0bb-0x0;var _0x1f1146=_0xdd05[_0x58a0bb];return _0x1f1146;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5dd0('0x0'));var timeout=require('connect-timeout');var express=require(_0x5dd0('0x1'));var router=express[_0x5dd0('0x2')]();var fs_extra=require(_0x5dd0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5dd0('0x4'));var config=require('../../config/environment');var controller=require(_0x5dd0('0x5'));router[_0x5dd0('0x6')]('/',auth[_0x5dd0('0x7')](),controller[_0x5dd0('0x8')]);router[_0x5dd0('0x6')](_0x5dd0('0x9'),auth['isAuthenticated'](),controller[_0x5dd0('0xa')]);router[_0x5dd0('0x6')](_0x5dd0('0xb'),auth['isAuthenticated'](),controller[_0x5dd0('0xc')]);router[_0x5dd0('0xd')]('/',auth[_0x5dd0('0x7')](),controller[_0x5dd0('0xe')]);router['put'](_0x5dd0('0xb'),auth[_0x5dd0('0x7')](),controller[_0x5dd0('0xf')]);router[_0x5dd0('0x10')](_0x5dd0('0xb'),auth[_0x5dd0('0x7')](),controller[_0x5dd0('0x11')]);module[_0x5dd0('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 596db41..d1bc35f 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 _0x7953=['STRING','DATE','moment','sequelize','exports'];(function(_0x180b01,_0x16cd10){var _0x51fe8f=function(_0x3590b8){while(--_0x3590b8){_0x180b01['push'](_0x180b01['shift']());}};_0x51fe8f(++_0x16cd10);}(_0x7953,0x1c4));var _0x3795=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0x7953[_0x572637];return _0xb6748;};'use strict';var moment=require(_0x3795('0x0'));var Sequelize=require(_0x3795('0x1'));module[_0x3795('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3795('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3795('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3795('0x4')]},'reason':{'type':Sequelize[_0x3795('0x3')]}}; \ No newline at end of file +var _0x09f4=['DATE','sequelize','exports','STRING'];(function(_0x1b8011,_0x36d4d6){var _0x48286d=function(_0x9bfeb1){while(--_0x9bfeb1){_0x1b8011['push'](_0x1b8011['shift']());}};_0x48286d(++_0x36d4d6);}(_0x09f4,0x1a5));var _0x409f=function(_0x15d2e7,_0x575e70){_0x15d2e7=_0x15d2e7-0x0;var _0x2341c8=_0x09f4[_0x15d2e7];return _0x2341c8;};'use strict';var moment=require('moment');var Sequelize=require(_0x409f('0x0'));module[_0x409f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x409f('0x2')]},'joinAt':{'type':Sequelize[_0x409f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x409f('0x3')]},'exitAt':{'type':Sequelize[_0x409f('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f1b2b39..e24b680 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 _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','MailQueueReport','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x4a155f,_0xb73f2){var _0x518b24=function(_0x1e5578){while(--_0x1e5578){_0x4a155f['push'](_0x4a155f['shift']());}};_0x518b24(++_0xb73f2);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['MailQueueReport']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['MailQueueReport']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +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(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'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 0c1310d..53fcf58 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 _0x0298=['bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4e7240,_0x2353cd){var _0x40c8d7=function(_0x68231a){while(--_0x68231a){_0x4e7240['push'](_0x4e7240['shift']());}};_0x40c8d7(++_0x2353cd);}(_0x0298,0x1bb));var _0x8029=function(_0x3520c1,_0x1257ad){_0x3520c1=_0x3520c1-0x0;var _0x24e55c=_0x0298[_0x3520c1];return _0x24e55c;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var logger=require(_0x8029('0x2'))(_0x8029('0x3'));var moment=require(_0x8029('0x4'));var BPromise=require(_0x8029('0x5'));var rp=require(_0x8029('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var attributes=require(_0x8029('0x9'));module[_0x8029('0xa')]=function(_0x4aad74,_0x280ee6){return _0x4aad74[_0x8029('0xb')](_0x8029('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x8029('0xd'),'fields':[_0x8029('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ee6=['api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','uniqueid','lodash','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3ee6,0xa6));var _0x63ee=function(_0x59801c,_0x469230){_0x59801c=_0x59801c-0x0;var _0x44e7eb=_0x3ee6[_0x59801c];return _0x44e7eb;};'use strict';var _=require(_0x63ee('0x0'));var util=require('util');var logger=require(_0x63ee('0x1'))(_0x63ee('0x2'));var moment=require('moment');var BPromise=require(_0x63ee('0x3'));var rp=require(_0x63ee('0x4'));var fs=require('fs');var path=require(_0x63ee('0x5'));var rimraf=require(_0x63ee('0x6'));var config=require(_0x63ee('0x7'));var attributes=require(_0x63ee('0x8'));module[_0x63ee('0x9')]=function(_0x48c8cf,_0x2342ae){return _0x48c8cf[_0x63ee('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x63ee('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 58ea875..96b8cfb 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(_0xf49856,_0x56509c){var _0x3b6bfb=function(_0x185d84){while(--_0x185d84){_0xf49856['push'](_0xf49856['shift']());}};_0x3b6bfb(++_0x56509c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31ae15,_0x33a759){var _0x13bb1a=function(_0x509599){while(--_0x509599){_0x31ae15['push'](_0x31ae15['shift']());}};_0x13bb1a(++_0x33a759);}(_0x326f,0xd1));var _0xf326=function(_0x5a65bf,_0x89f4d5){_0x5a65bf=_0x5a65bf-0x0;var _0x17ecac=_0x326f[_0x5a65bf];return _0x17ecac;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 9ff2098..1e648f3 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xb40f40,_0x41708a){var _0x55c108=function(_0x5c4f7b){while(--_0x5c4f7b){_0xb40f40['push'](_0xb40f40['shift']());}};_0x55c108(++_0x41708a);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xac307d,_0x270314){var _0x2c1b39=function(_0x19e9f8){while(--_0x19e9f8){_0xac307d['push'](_0xac307d['shift']());}};_0x2c1b39(++_0x270314);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 50eda42..89e2291 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 _0x1771=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x1ac053,_0x39267a){var _0x2d209a=function(_0x5106d2){while(--_0x5106d2){_0x1ac053['push'](_0x1ac053['shift']());}};_0x2d209a(++_0x39267a);}(_0x1771,0x152));var _0x1177=function(_0x1b3f65,_0x48aa09){_0x1b3f65=_0x1b3f65-0x0;var _0x10d936=_0x1771[_0x1b3f65];return _0x10d936;};'use strict';var Sequelize=require(_0x1177('0x0'));module[_0x1177('0x1')]={'description':{'type':Sequelize[_0x1177('0x2')]},'host':{'type':Sequelize[_0x1177('0x2')]},'authentication':{'type':Sequelize[_0x1177('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1177('0x4')]},'tls':{'type':Sequelize[_0x1177('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1177('0x2')],'defaultValue':_0x1177('0x5')},'connTimeout':{'type':Sequelize[_0x1177('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x1177('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb8e3=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x30e9b4,_0x6acffa){var _0xf8ce0d=function(_0x13e7c0){while(--_0x13e7c0){_0x30e9b4['push'](_0x30e9b4['shift']());}};_0xf8ce0d(++_0x6acffa);}(_0xb8e3,0x102));var _0x3b8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3b8e('0x0'));module[_0x3b8e('0x1')]={'description':{'type':Sequelize[_0x3b8e('0x2')]},'host':{'type':Sequelize[_0x3b8e('0x2')]},'authentication':{'type':Sequelize[_0x3b8e('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3b8e('0x2')]},'password':{'type':Sequelize[_0x3b8e('0x2')]},'port':{'type':Sequelize[_0x3b8e('0x4')]},'tls':{'type':Sequelize[_0x3b8e('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3b8e('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x3b8e('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x3b8e('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index d06c2bf..51a63be 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 _0x71d7=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4f7037,_0x4feea9){var _0x49a0e3=function(_0x4460e8){while(--_0x4460e8){_0x4f7037['push'](_0x4f7037['shift']());}};_0x49a0e3(++_0x4feea9);}(_0x71d7,0x1ad));var _0x771d=function(_0x5554e1,_0x85e73a){_0x5554e1=_0x5554e1-0x0;var _0x3e85a8=_0x71d7[_0x5554e1];return _0x3e85a8;};'use strict';var _=require(_0x771d('0x0'));var util=require(_0x771d('0x1'));var logger=require(_0x771d('0x2'))('api');var moment=require(_0x771d('0x3'));var BPromise=require(_0x771d('0x4'));var rp=require(_0x771d('0x5'));var fs=require('fs');var path=require(_0x771d('0x6'));var rimraf=require(_0x771d('0x7'));var config=require(_0x771d('0x8'));var attributes=require(_0x771d('0x9'));module[_0x771d('0xa')]=function(_0x4ba2d9,_0x7b8d8e){return _0x4ba2d9[_0x771d('0xb')](_0x771d('0xc'),attributes,{'tableName':_0x771d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74c8=['bluebird','request-promise','../../config/environment','./mailServerIn.attributes','exports','mail_servers_in','util','api','moment'];(function(_0x1fe67a,_0x3794b1){var _0x3c5f44=function(_0x4b04e2){while(--_0x4b04e2){_0x1fe67a['push'](_0x1fe67a['shift']());}};_0x3c5f44(++_0x3794b1);}(_0x74c8,0xc3));var _0x874c=function(_0x3099bb,_0x5d29e3){_0x3099bb=_0x3099bb-0x0;var _0x31df2a=_0x74c8[_0x3099bb];return _0x31df2a;};'use strict';var _=require('lodash');var util=require(_0x874c('0x0'));var logger=require('../../config/logger')(_0x874c('0x1'));var moment=require(_0x874c('0x2'));var BPromise=require(_0x874c('0x3'));var rp=require(_0x874c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x874c('0x5'));var attributes=require(_0x874c('0x6'));module[_0x874c('0x7')]=function(_0x2a970a,_0x3c5f08){return _0x2a970a['define']('MailServerIn',attributes,{'tableName':_0x874c('0x8'),'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 1e0b6a6..ea51778 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 _0xac0b=['GetMailServerIn','MailServerIn','options','where','attributes','include','map','model','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x273885,_0x29c348){var _0x4cf035=function(_0x243fad){while(--_0x243fad){_0x273885['push'](_0x273885['shift']());}};_0x4cf035(++_0x29c348);}(_0xac0b,0x164));var _0xbac0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xac0b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbac0('0x0'));var util=require(_0xbac0('0x1'));var moment=require(_0xbac0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbac0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbac0('0x4'));var logger=require(_0xbac0('0x5'))(_0xbac0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbac0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3dbf70,_0x2f1d61,_0x3592de){return new BPromise(function(_0x25167c,_0x268346){return client[_0xbac0('0x8')](_0x3dbf70,_0x3592de)[_0xbac0('0x9')](function(_0x114d2e){logger[_0xbac0('0xa')](_0xbac0('0xb'),_0x2f1d61,'request\x20sent');logger[_0xbac0('0xc')](_0xbac0('0xd'),_0x2f1d61,_0xbac0('0xe'),JSON[_0xbac0('0xf')](_0x114d2e));if(_0x114d2e[_0xbac0('0x10')]){if(_0x114d2e[_0xbac0('0x10')][_0xbac0('0x11')]===0x1f4){logger[_0xbac0('0x10')](_0xbac0('0xb'),_0x2f1d61,_0x114d2e[_0xbac0('0x10')]['message']);return _0x268346(_0x114d2e[_0xbac0('0x10')][_0xbac0('0x12')]);}logger[_0xbac0('0x10')](_0xbac0('0xb'),_0x2f1d61,_0x114d2e['error'][_0xbac0('0x12')]);return _0x25167c(_0x114d2e[_0xbac0('0x10')][_0xbac0('0x12')]);}else{logger[_0xbac0('0xa')]('MailServerIn,\x20%s,\x20%s',_0x2f1d61,_0xbac0('0xe'));_0x25167c(_0x114d2e[_0xbac0('0x13')][_0xbac0('0x12')]);}})[_0xbac0('0x14')](function(_0x13c623){logger[_0xbac0('0x10')](_0xbac0('0xb'),_0x2f1d61,_0x13c623);_0x268346(_0x13c623);});});}exports[_0xbac0('0x15')]=function(_0x271597){var _0x5956b5=this;return new Promise(function(_0x5bd87c,_0x107e44){return db[_0xbac0('0x16')]['findAll']({'raw':_0x271597['options']?_0x271597['options']['raw']===undefined?!![]:![]:!![],'where':_0x271597[_0xbac0('0x17')]?_0x271597[_0xbac0('0x17')][_0xbac0('0x18')]||null:null,'attributes':_0x271597['options']?_0x271597[_0xbac0('0x17')][_0xbac0('0x19')]||null:null,'limit':_0x271597[_0xbac0('0x17')]?_0x271597[_0xbac0('0x17')]['limit']||null:null,'include':_0x271597[_0xbac0('0x17')]?_0x271597[_0xbac0('0x17')][_0xbac0('0x1a')]?_[_0xbac0('0x1b')](_0x271597['options'][_0xbac0('0x1a')],function(_0x535b4d){return{'model':db[_0x535b4d['model']],'as':_0x535b4d['as'],'attributes':_0x535b4d[_0xbac0('0x19')],'include':_0x535b4d[_0xbac0('0x1a')]?_['map'](_0x535b4d[_0xbac0('0x1a')],function(_0x1bb298){return{'model':db[_0x1bb298[_0xbac0('0x1c')]],'as':_0x1bb298['as'],'attributes':_0x1bb298['attributes'],'include':_0x1bb298[_0xbac0('0x1a')]?_['map'](_0x1bb298[_0xbac0('0x1a')],function(_0xa98ec5){return{'model':db[_0xa98ec5[_0xbac0('0x1c')]],'as':_0xa98ec5['as'],'attributes':_0xa98ec5[_0xbac0('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbac0('0x9')](function(_0x442395){logger[_0xbac0('0xa')](_0xbac0('0x15'),_0x271597);logger[_0xbac0('0xc')](_0xbac0('0x15'),_0x271597,JSON[_0xbac0('0xf')](_0x442395));_0x5bd87c(_0x442395);})['catch'](function(_0x162d09){logger['error']('GetMailServerIn',_0x162d09[_0xbac0('0x12')],_0x271597);_0x107e44(_0x5956b5['error'](0x1f4,_0x162d09[_0xbac0('0x12')]));});});}; \ No newline at end of file +var _0x8985=['MailServerIn,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','randomstring','../../config/utils','../../config/logger','client','http','request','stringify','error','code'];(function(_0x58a1bf,_0x1a4122){var _0x5c495c=function(_0x38b340){while(--_0x38b340){_0x58a1bf['push'](_0x58a1bf['shift']());}};_0x5c495c(++_0x1a4122);}(_0x8985,0x198));var _0x5898=function(_0x52790e,_0x34910b){_0x52790e=_0x52790e-0x0;var _0x275ce9=_0x8985[_0x52790e];return _0x275ce9;};'use strict';var _=require(_0x5898('0x0'));var util=require(_0x5898('0x1'));var moment=require(_0x5898('0x2'));var BPromise=require('bluebird');var rs=require(_0x5898('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5898('0x4'));var logger=require(_0x5898('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5898('0x6')][_0x5898('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x164607,_0x5441e1,_0x21fa2b){return new BPromise(function(_0x5b8012,_0x113677){return client[_0x5898('0x8')](_0x164607,_0x21fa2b)['then'](function(_0x34995f){logger['info']('MailServerIn,\x20%s,\x20%s',_0x5441e1,'request\x20sent');logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5441e1,'request\x20sent',JSON[_0x5898('0x9')](_0x34995f));if(_0x34995f[_0x5898('0xa')]){if(_0x34995f[_0x5898('0xa')][_0x5898('0xb')]===0x1f4){logger['error'](_0x5898('0xc'),_0x5441e1,_0x34995f[_0x5898('0xa')][_0x5898('0xd')]);return _0x113677(_0x34995f[_0x5898('0xa')][_0x5898('0xd')]);}logger['error'](_0x5898('0xc'),_0x5441e1,_0x34995f[_0x5898('0xa')]['message']);return _0x5b8012(_0x34995f[_0x5898('0xa')][_0x5898('0xd')]);}else{logger['info'](_0x5898('0xc'),_0x5441e1,_0x5898('0xe'));_0x5b8012(_0x34995f[_0x5898('0xf')][_0x5898('0xd')]);}})[_0x5898('0x10')](function(_0x29d1e2){logger['error']('MailServerIn,\x20%s,\x20%s',_0x5441e1,_0x29d1e2);_0x113677(_0x29d1e2);});});}exports[_0x5898('0x11')]=function(_0x319a7e){var _0x1d883b=this;return new Promise(function(_0x3afcbd,_0x2db33a){return db[_0x5898('0x12')][_0x5898('0x13')]({'raw':_0x319a7e[_0x5898('0x14')]?_0x319a7e[_0x5898('0x14')][_0x5898('0x15')]===undefined?!![]:![]:!![],'where':_0x319a7e['options']?_0x319a7e[_0x5898('0x14')][_0x5898('0x16')]||null:null,'attributes':_0x319a7e['options']?_0x319a7e[_0x5898('0x14')][_0x5898('0x17')]||null:null,'limit':_0x319a7e['options']?_0x319a7e[_0x5898('0x14')]['limit']||null:null,'include':_0x319a7e[_0x5898('0x14')]?_0x319a7e[_0x5898('0x14')][_0x5898('0x18')]?_[_0x5898('0x19')](_0x319a7e[_0x5898('0x14')][_0x5898('0x18')],function(_0x1681f8){return{'model':db[_0x1681f8['model']],'as':_0x1681f8['as'],'attributes':_0x1681f8[_0x5898('0x17')],'include':_0x1681f8['include']?_[_0x5898('0x19')](_0x1681f8[_0x5898('0x18')],function(_0xf369cf){return{'model':db[_0xf369cf['model']],'as':_0xf369cf['as'],'attributes':_0xf369cf[_0x5898('0x17')],'include':_0xf369cf['include']?_[_0x5898('0x19')](_0xf369cf[_0x5898('0x18')],function(_0x22898c){return{'model':db[_0x22898c[_0x5898('0x1a')]],'as':_0x22898c['as'],'attributes':_0x22898c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3910f3){logger['info'](_0x5898('0x11'),_0x319a7e);logger[_0x5898('0x1b')](_0x5898('0x11'),_0x319a7e,JSON[_0x5898('0x9')](_0x3910f3));_0x3afcbd(_0x3910f3);})[_0x5898('0x10')](function(_0x212c7e){logger[_0x5898('0xa')]('GetMailServerIn',_0x212c7e[_0x5898('0xd')],_0x319a7e);_0x2db33a(_0x1d883b[_0x5898('0xa')](0x1f4,_0x212c7e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 80d6e55..1e477f7 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7a54,0x106));var _0x47a5=function(_0x9d4c6c,_0x45f8ae){_0x9d4c6c=_0x9d4c6c-0x0;var _0x2a1833=_0x7a54[_0x9d4c6c];return _0x2a1833;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a54,0x106));var _0x47a5=function(_0x12373e,_0x5d270f){_0x12373e=_0x12373e-0x0;var _0x522d36=_0x7a54[_0x12373e];return _0x522d36;};'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 f1f4cfb..0c83fd6 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 _0xf7b4=['STRING','BOOLEAN','sequelize'];(function(_0x54dee4,_0x5bdb9f){var _0x2fa406=function(_0x41d0ea){while(--_0x41d0ea){_0x54dee4['push'](_0x54dee4['shift']());}};_0x2fa406(++_0x5bdb9f);}(_0xf7b4,0x152));var _0x4f7b=function(_0x375676,_0x59d59f){_0x375676=_0x375676-0x0;var _0x31b3b7=_0xf7b4[_0x375676];return _0x31b3b7;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4f7b('0x1')]},'user':{'type':Sequelize[_0x4f7b('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x4f7b('0x1')]},'authentication':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x2f68=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x3a019c,_0x3eaf02){var _0xeeb4f9=function(_0xfc66c5){while(--_0xfc66c5){_0x3a019c['push'](_0x3a019c['shift']());}};_0xeeb4f9(++_0x3eaf02);}(_0x2f68,0x9a));var _0x82f6=function(_0x4d40f9,_0x29e790){_0x4d40f9=_0x4d40f9-0x0;var _0x36d8d8=_0x2f68[_0x4d40f9];return _0x36d8d8;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'description':{'type':Sequelize[_0x82f6('0x1')]},'host':{'type':Sequelize[_0x82f6('0x1')]},'user':{'type':Sequelize[_0x82f6('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x82f6('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x82f6('0x1')]},'authentication':{'type':Sequelize[_0x82f6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 798b96a..0469294 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 _0xf033=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','MailServerOut','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','status','end'];(function(_0xe81bfd,_0x29f01d){var _0x448377=function(_0x509d24){while(--_0x509d24){_0xe81bfd['push'](_0xe81bfd['shift']());}};_0x448377(++_0x29f01d);}(_0xf033,0x82));var _0x3f03=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0xf033[_0x2dd22e];return _0x257b01;};'use strict';var emlformat=require(_0x3f03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f03('0x1'));var jsonpatch=require(_0x3f03('0x2'));var rp=require(_0x3f03('0x3'));var moment=require(_0x3f03('0x4'));var BPromise=require(_0x3f03('0x5'));var Mustache=require(_0x3f03('0x6'));var util=require(_0x3f03('0x7'));var path=require(_0x3f03('0x8'));var sox=require(_0x3f03('0x9'));var csv=require(_0x3f03('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f03('0xb'));var _=require(_0x3f03('0xc'));var squel=require(_0x3f03('0xd'));var crypto=require(_0x3f03('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3f03('0xf'));var toCsv=require(_0x3f03('0xa'));var querystring=require(_0x3f03('0x10'));var Papa=require(_0x3f03('0x11'));var Redis=require(_0x3f03('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3f03('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3f03('0x14'));var utils=require(_0x3f03('0x15'));var config=require(_0x3f03('0x16'));var licenseUtil=require(_0x3f03('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d1903,_0x15a501){_0x15a501=_0x15a501||0xcc;return function(_0x14aa0d){if(_0x14aa0d){return _0x4d1903['sendStatus'](_0x15a501);}return _0x4d1903[_0x3f03('0x18')](_0x15a501)[_0x3f03('0x19')]();};}function respondWithResult(_0x49621b,_0x7616fb){_0x7616fb=_0x7616fb||0xc8;return function(_0xe3668f){if(_0xe3668f){return _0x49621b['status'](_0x7616fb)['json'](_0xe3668f);}};}function respondWithFilteredResult(_0x1f8db8,_0x4a129d){return function(_0x45ef3c){if(_0x45ef3c){var _0x455990=typeof _0x4a129d[_0x3f03('0x1a')]===_0x3f03('0x1b')&&typeof _0x4a129d[_0x3f03('0x1c')]===_0x3f03('0x1b');var _0x1644c8=_0x45ef3c[_0x3f03('0x1d')];var _0xd9442=_0x455990?0x0:_0x4a129d[_0x3f03('0x1a')];var _0x587bb0=_0x455990?_0x45ef3c[_0x3f03('0x1d')]:_0x4a129d[_0x3f03('0x1a')]+_0x4a129d[_0x3f03('0x1c')];var _0x6a27f3;if(_0x587bb0>=_0x1644c8){_0x587bb0=_0x1644c8;_0x6a27f3=0xc8;}else{_0x6a27f3=0xce;}_0x1f8db8[_0x3f03('0x18')](_0x6a27f3);return _0x1f8db8[_0x3f03('0x1e')](_0x3f03('0x1f'),_0xd9442+'-'+_0x587bb0+'/'+_0x1644c8)[_0x3f03('0x20')](_0x45ef3c);}return null;};}function patchUpdates(_0xf0720e){return function(_0x5cc614){try{jsonpatch[_0x3f03('0x21')](_0x5cc614,_0xf0720e,!![]);}catch(_0x533a03){return BPromise[_0x3f03('0x22')](_0x533a03);}return _0x5cc614[_0x3f03('0x23')]();};}function saveUpdates(_0xa94c4b,_0x217654){return function(_0x4f4928){if(_0x4f4928){return _0x4f4928[_0x3f03('0x24')](_0xa94c4b)['then'](function(_0x535dce){return _0x535dce;});}return null;};}function removeEntity(_0x48e18c,_0x5a2628){return function(_0x18e6f2){if(_0x18e6f2){return _0x18e6f2[_0x3f03('0x25')]()[_0x3f03('0x26')](function(){_0x48e18c[_0x3f03('0x18')](0xcc)[_0x3f03('0x19')]();});}};}function handleEntityNotFound(_0x5a7749,_0x3cd66e){return function(_0x47df25){if(!_0x47df25){_0x5a7749[_0x3f03('0x27')](0x194);}return _0x47df25;};}function handleError(_0x424db9,_0x3a131c){_0x3a131c=_0x3a131c||0x1f4;return function(_0xcc9350){logger[_0x3f03('0x28')](_0xcc9350[_0x3f03('0x29')]);if(_0xcc9350[_0x3f03('0x2a')]){delete _0xcc9350[_0x3f03('0x2a')];}_0x424db9[_0x3f03('0x18')](_0x3a131c)[_0x3f03('0x2b')](_0xcc9350);};}exports[_0x3f03('0x2c')]=function(_0x14b971,_0x4cfca6){var _0xf723fd={},_0x1b86ea={},_0xc71328={'count':0x0,'rows':[]};var _0x26bdbd=_[_0x3f03('0x2d')](db[_0x3f03('0x2e')]['rawAttributes'],function(_0x4f6f49){return{'name':_0x4f6f49[_0x3f03('0x2f')],'type':_0x4f6f49['type'][_0x3f03('0x30')]};});_0x1b86ea[_0x3f03('0x31')]=_[_0x3f03('0x2d')](_0x26bdbd,_0x3f03('0x2a'));_0x1b86ea[_0x3f03('0x32')]=_['keys'](_0x14b971['query']);_0x1b86ea[_0x3f03('0x33')]=_[_0x3f03('0x34')](_0x1b86ea[_0x3f03('0x31')],_0x1b86ea[_0x3f03('0x32')]);_0xf723fd['attributes']=_['intersection'](_0x1b86ea['model'],qs[_0x3f03('0x35')](_0x14b971[_0x3f03('0x32')][_0x3f03('0x35')]));_0xf723fd[_0x3f03('0x36')]=_0xf723fd['attributes']['length']?_0xf723fd['attributes']:_0x1b86ea[_0x3f03('0x31')];if(!_0x14b971['query'][_0x3f03('0x37')](_0x3f03('0x38'))){_0xf723fd[_0x3f03('0x1c')]=qs[_0x3f03('0x1c')](_0x14b971[_0x3f03('0x32')][_0x3f03('0x1c')]);_0xf723fd['offset']=qs[_0x3f03('0x1a')](_0x14b971[_0x3f03('0x32')][_0x3f03('0x1a')]);}_0xf723fd[_0x3f03('0x39')]=qs['sort'](_0x14b971['query'][_0x3f03('0x3a')]);_0xf723fd[_0x3f03('0x3b')]=qs['filters'](_[_0x3f03('0x3c')](_0x14b971[_0x3f03('0x32')],_0x1b86ea[_0x3f03('0x33')]),_0x26bdbd);if(_0x14b971[_0x3f03('0x32')][_0x3f03('0x3d')]){_0xf723fd['where']=_[_0x3f03('0x3e')](_0xf723fd[_0x3f03('0x3b')],{'$or':_[_0x3f03('0x2d')](_0x26bdbd,function(_0x1f9198){if(_0x1f9198[_0x3f03('0x3f')]!==_0x3f03('0x40')){var _0xdc8b13={};_0xdc8b13[_0x1f9198[_0x3f03('0x2a')]]={'$like':'%'+_0x14b971['query'][_0x3f03('0x3d')]+'%'};return _0xdc8b13;}})});}_0xf723fd=_[_0x3f03('0x3e')]({},_0xf723fd,_0x14b971[_0x3f03('0x41')]);var _0x31c39c={'where':_0xf723fd['where']};return db[_0x3f03('0x2e')][_0x3f03('0x1d')](_0x31c39c)[_0x3f03('0x26')](function(_0x5ee6a6){_0xc71328[_0x3f03('0x1d')]=_0x5ee6a6;if(_0x14b971[_0x3f03('0x32')]['includeAll']){_0xf723fd[_0x3f03('0x42')]=[{'all':!![]}];}return db[_0x3f03('0x2e')][_0x3f03('0x43')](_0xf723fd);})[_0x3f03('0x26')](function(_0x348c42){_0xc71328[_0x3f03('0x44')]=_0x348c42;return _0xc71328;})[_0x3f03('0x26')](respondWithFilteredResult(_0x4cfca6,_0xf723fd))[_0x3f03('0x45')](handleError(_0x4cfca6,null));};exports[_0x3f03('0x46')]=function(_0xb51369,_0x4b2a61){var _0x4a56c5={'raw':!![],'where':{'id':_0xb51369['params']['id']}},_0x443797={};_0x443797['model']=_[_0x3f03('0x47')](db[_0x3f03('0x2e')]['rawAttributes']);_0x443797[_0x3f03('0x32')]=_[_0x3f03('0x47')](_0xb51369['query']);_0x443797[_0x3f03('0x33')]=_[_0x3f03('0x34')](_0x443797[_0x3f03('0x31')],_0x443797['query']);_0x4a56c5[_0x3f03('0x36')]=_[_0x3f03('0x34')](_0x443797[_0x3f03('0x31')],qs[_0x3f03('0x35')](_0xb51369[_0x3f03('0x32')][_0x3f03('0x35')]));_0x4a56c5['attributes']=_0x4a56c5[_0x3f03('0x36')][_0x3f03('0x48')]?_0x4a56c5[_0x3f03('0x36')]:_0x443797[_0x3f03('0x31')];if(_0xb51369[_0x3f03('0x32')][_0x3f03('0x49')]){_0x4a56c5[_0x3f03('0x42')]=[{'all':!![]}];}_0x4a56c5=_[_0x3f03('0x3e')]({},_0x4a56c5,_0xb51369[_0x3f03('0x41')]);return db[_0x3f03('0x2e')][_0x3f03('0x4a')](_0x4a56c5)[_0x3f03('0x26')](handleEntityNotFound(_0x4b2a61,null))[_0x3f03('0x26')](respondWithResult(_0x4b2a61,null))['catch'](handleError(_0x4b2a61,null));};exports[_0x3f03('0x4b')]=function(_0x527464,_0x18a281){return db[_0x3f03('0x2e')][_0x3f03('0x4b')](_0x527464[_0x3f03('0x4c')],{})[_0x3f03('0x26')](respondWithResult(_0x18a281,0xc9))[_0x3f03('0x45')](handleError(_0x18a281,null));};exports[_0x3f03('0x24')]=function(_0x317fdd,_0x354a2f){if(_0x317fdd[_0x3f03('0x4c')]['id']){delete _0x317fdd['body']['id'];}return db[_0x3f03('0x2e')][_0x3f03('0x4a')]({'where':{'id':_0x317fdd[_0x3f03('0x4d')]['id']}})['then'](handleEntityNotFound(_0x354a2f,null))['then'](saveUpdates(_0x317fdd[_0x3f03('0x4c')],null))['then'](respondWithResult(_0x354a2f,null))[_0x3f03('0x45')](handleError(_0x354a2f,null));};exports[_0x3f03('0x25')]=function(_0x509535,_0x3755c9){return db['MailServerOut']['find']({'where':{'id':_0x509535[_0x3f03('0x4d')]['id']}})[_0x3f03('0x26')](handleEntityNotFound(_0x3755c9,null))['then'](removeEntity(_0x3755c9,null))[_0x3f03('0x45')](handleError(_0x3755c9,null));}; \ No newline at end of file +var _0x12fa=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','find','create','body','params','destroy','eml-format','zip-dir','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','status','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x12fa,0x1ed));var _0xa12f=function(_0x2b28dd,_0x23fa55){_0x2b28dd=_0x2b28dd-0x0;var _0x44a5cd=_0x12fa[_0x2b28dd];return _0x44a5cd;};'use strict';var emlformat=require(_0xa12f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa12f('0x1'));var jsonpatch=require(_0xa12f('0x2'));var rp=require(_0xa12f('0x3'));var moment=require(_0xa12f('0x4'));var BPromise=require(_0xa12f('0x5'));var Mustache=require(_0xa12f('0x6'));var util=require(_0xa12f('0x7'));var path=require(_0xa12f('0x8'));var sox=require(_0xa12f('0x9'));var csv=require(_0xa12f('0xa'));var ejs=require(_0xa12f('0xb'));var fs=require('fs');var fs_extra=require(_0xa12f('0xc'));var _=require(_0xa12f('0xd'));var squel=require(_0xa12f('0xe'));var crypto=require('crypto');var jsforce=require(_0xa12f('0xf'));var deskjs=require(_0xa12f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa12f('0x11'));var Papa=require(_0xa12f('0x12'));var Redis=require('ioredis');var authService=require(_0xa12f('0x13'));var qs=require(_0xa12f('0x14'));var as=require(_0xa12f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa12f('0x16'))(_0xa12f('0x17'));var utils=require(_0xa12f('0x18'));var config=require(_0xa12f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa12f('0x1a'))['db'];function respondWithStatusCode(_0x5c6f69,_0x3d591b){_0x3d591b=_0x3d591b||0xcc;return function(_0x43186e){if(_0x43186e){return _0x5c6f69[_0xa12f('0x1b')](_0x3d591b);}return _0x5c6f69['status'](_0x3d591b)[_0xa12f('0x1c')]();};}function respondWithResult(_0x5ea7b7,_0x516079){_0x516079=_0x516079||0xc8;return function(_0x1f4dc5){if(_0x1f4dc5){return _0x5ea7b7['status'](_0x516079)['json'](_0x1f4dc5);}};}function respondWithFilteredResult(_0x52d1fb,_0x45104d){return function(_0x44f1dd){if(_0x44f1dd){var _0x28b73b=typeof _0x45104d[_0xa12f('0x1d')]==='undefined'&&typeof _0x45104d['limit']===_0xa12f('0x1e');var _0xdee5e3=_0x44f1dd['count'];var _0x1ee1af=_0x28b73b?0x0:_0x45104d[_0xa12f('0x1d')];var _0x43cab5=_0x28b73b?_0x44f1dd['count']:_0x45104d['offset']+_0x45104d[_0xa12f('0x1f')];var _0xaaf746;if(_0x43cab5>=_0xdee5e3){_0x43cab5=_0xdee5e3;_0xaaf746=0xc8;}else{_0xaaf746=0xce;}_0x52d1fb['status'](_0xaaf746);return _0x52d1fb['set'](_0xa12f('0x20'),_0x1ee1af+'-'+_0x43cab5+'/'+_0xdee5e3)[_0xa12f('0x21')](_0x44f1dd);}return null;};}function patchUpdates(_0x3f5f43){return function(_0xa728a0){try{jsonpatch[_0xa12f('0x22')](_0xa728a0,_0x3f5f43,!![]);}catch(_0x208104){return BPromise[_0xa12f('0x23')](_0x208104);}return _0xa728a0[_0xa12f('0x24')]();};}function saveUpdates(_0x17d289,_0x2080e8){return function(_0x177076){if(_0x177076){return _0x177076[_0xa12f('0x25')](_0x17d289)[_0xa12f('0x26')](function(_0x308a9d){return _0x308a9d;});}return null;};}function removeEntity(_0x6fa552,_0x20fb50){return function(_0x2d7a6d){if(_0x2d7a6d){return _0x2d7a6d['destroy']()[_0xa12f('0x26')](function(){_0x6fa552[_0xa12f('0x27')](0xcc)[_0xa12f('0x1c')]();});}};}function handleEntityNotFound(_0x516c70,_0x21f501){return function(_0xe7c441){if(!_0xe7c441){_0x516c70[_0xa12f('0x1b')](0x194);}return _0xe7c441;};}function handleError(_0x1c39f4,_0x237ad2){_0x237ad2=_0x237ad2||0x1f4;return function(_0x23d2f4){logger[_0xa12f('0x28')](_0x23d2f4[_0xa12f('0x29')]);if(_0x23d2f4[_0xa12f('0x2a')]){delete _0x23d2f4['name'];}_0x1c39f4['status'](_0x237ad2)[_0xa12f('0x2b')](_0x23d2f4);};}exports[_0xa12f('0x2c')]=function(_0x95adc6,_0x3786f5){var _0x48c52a={},_0x47a42b={},_0x4a47b7={'count':0x0,'rows':[]};var _0xdf611d=_[_0xa12f('0x2d')](db[_0xa12f('0x2e')][_0xa12f('0x2f')],function(_0x53319b){return{'name':_0x53319b[_0xa12f('0x30')],'type':_0x53319b['type'][_0xa12f('0x31')]};});_0x47a42b['model']=_[_0xa12f('0x2d')](_0xdf611d,_0xa12f('0x2a'));_0x47a42b[_0xa12f('0x32')]=_[_0xa12f('0x33')](_0x95adc6[_0xa12f('0x32')]);_0x47a42b[_0xa12f('0x34')]=_[_0xa12f('0x35')](_0x47a42b[_0xa12f('0x36')],_0x47a42b[_0xa12f('0x32')]);_0x48c52a[_0xa12f('0x37')]=_[_0xa12f('0x35')](_0x47a42b[_0xa12f('0x36')],qs[_0xa12f('0x38')](_0x95adc6['query']['fields']));_0x48c52a[_0xa12f('0x37')]=_0x48c52a[_0xa12f('0x37')][_0xa12f('0x39')]?_0x48c52a[_0xa12f('0x37')]:_0x47a42b[_0xa12f('0x36')];if(!_0x95adc6[_0xa12f('0x32')][_0xa12f('0x3a')](_0xa12f('0x3b'))){_0x48c52a[_0xa12f('0x1f')]=qs['limit'](_0x95adc6['query'][_0xa12f('0x1f')]);_0x48c52a[_0xa12f('0x1d')]=qs[_0xa12f('0x1d')](_0x95adc6[_0xa12f('0x32')][_0xa12f('0x1d')]);}_0x48c52a[_0xa12f('0x3c')]=qs[_0xa12f('0x3d')](_0x95adc6[_0xa12f('0x32')][_0xa12f('0x3d')]);_0x48c52a[_0xa12f('0x3e')]=qs[_0xa12f('0x34')](_[_0xa12f('0x3f')](_0x95adc6[_0xa12f('0x32')],_0x47a42b['filters']),_0xdf611d);if(_0x95adc6[_0xa12f('0x32')][_0xa12f('0x40')]){_0x48c52a[_0xa12f('0x3e')]=_[_0xa12f('0x41')](_0x48c52a['where'],{'$or':_[_0xa12f('0x2d')](_0xdf611d,function(_0x311da4){if(_0x311da4[_0xa12f('0x42')]!==_0xa12f('0x43')){var _0x5b8e2e={};_0x5b8e2e[_0x311da4[_0xa12f('0x2a')]]={'$like':'%'+_0x95adc6[_0xa12f('0x32')][_0xa12f('0x40')]+'%'};return _0x5b8e2e;}})});}_0x48c52a=_[_0xa12f('0x41')]({},_0x48c52a,_0x95adc6[_0xa12f('0x44')]);var _0x2fdfb5={'where':_0x48c52a[_0xa12f('0x3e')]};return db[_0xa12f('0x2e')][_0xa12f('0x45')](_0x2fdfb5)['then'](function(_0x2de86e){_0x4a47b7[_0xa12f('0x45')]=_0x2de86e;if(_0x95adc6[_0xa12f('0x32')][_0xa12f('0x46')]){_0x48c52a[_0xa12f('0x47')]=[{'all':!![]}];}return db[_0xa12f('0x2e')][_0xa12f('0x48')](_0x48c52a);})[_0xa12f('0x26')](function(_0x23ff89){_0x4a47b7['rows']=_0x23ff89;return _0x4a47b7;})[_0xa12f('0x26')](respondWithFilteredResult(_0x3786f5,_0x48c52a))[_0xa12f('0x49')](handleError(_0x3786f5,null));};exports['show']=function(_0x22e70e,_0x45bf6e){var _0x1eb847={'raw':!![],'where':{'id':_0x22e70e['params']['id']}},_0x4b63cd={};_0x4b63cd[_0xa12f('0x36')]=_['keys'](db[_0xa12f('0x2e')][_0xa12f('0x2f')]);_0x4b63cd[_0xa12f('0x32')]=_[_0xa12f('0x33')](_0x22e70e[_0xa12f('0x32')]);_0x4b63cd[_0xa12f('0x34')]=_[_0xa12f('0x35')](_0x4b63cd[_0xa12f('0x36')],_0x4b63cd['query']);_0x1eb847[_0xa12f('0x37')]=_[_0xa12f('0x35')](_0x4b63cd[_0xa12f('0x36')],qs[_0xa12f('0x38')](_0x22e70e[_0xa12f('0x32')][_0xa12f('0x38')]));_0x1eb847['attributes']=_0x1eb847[_0xa12f('0x37')][_0xa12f('0x39')]?_0x1eb847['attributes']:_0x4b63cd[_0xa12f('0x36')];if(_0x22e70e['query']['includeAll']){_0x1eb847[_0xa12f('0x47')]=[{'all':!![]}];}_0x1eb847=_[_0xa12f('0x41')]({},_0x1eb847,_0x22e70e[_0xa12f('0x44')]);return db[_0xa12f('0x2e')][_0xa12f('0x4a')](_0x1eb847)[_0xa12f('0x26')](handleEntityNotFound(_0x45bf6e,null))[_0xa12f('0x26')](respondWithResult(_0x45bf6e,null))[_0xa12f('0x49')](handleError(_0x45bf6e,null));};exports[_0xa12f('0x4b')]=function(_0x34b87d,_0x406f2){return db[_0xa12f('0x2e')][_0xa12f('0x4b')](_0x34b87d[_0xa12f('0x4c')],{})[_0xa12f('0x26')](respondWithResult(_0x406f2,0xc9))[_0xa12f('0x49')](handleError(_0x406f2,null));};exports[_0xa12f('0x25')]=function(_0x49c622,_0x34b2bb){if(_0x49c622[_0xa12f('0x4c')]['id']){delete _0x49c622[_0xa12f('0x4c')]['id'];}return db[_0xa12f('0x2e')][_0xa12f('0x4a')]({'where':{'id':_0x49c622[_0xa12f('0x4d')]['id']}})[_0xa12f('0x26')](handleEntityNotFound(_0x34b2bb,null))[_0xa12f('0x26')](saveUpdates(_0x49c622['body'],null))[_0xa12f('0x26')](respondWithResult(_0x34b2bb,null))['catch'](handleError(_0x34b2bb,null));};exports[_0xa12f('0x4e')]=function(_0x47c3a3,_0x1fc9ed){return db['MailServerOut']['find']({'where':{'id':_0x47c3a3[_0xa12f('0x4d')]['id']}})[_0xa12f('0x26')](handleEntityNotFound(_0x1fc9ed,null))['then'](removeEntity(_0x1fc9ed,null))[_0xa12f('0x49')](handleError(_0x1fc9ed,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index fff5fba..132c807 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 _0x5676=['mail_servers_out','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes','exports','MailServerOut'];(function(_0x5034b7,_0x53bcf8){var _0x47d466=function(_0x224ef3){while(--_0x224ef3){_0x5034b7['push'](_0x5034b7['shift']());}};_0x47d466(++_0x53bcf8);}(_0x5676,0x1e1));var _0x6567=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5676[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6567('0x0'));var logger=require(_0x6567('0x1'))('api');var moment=require(_0x6567('0x2'));var BPromise=require(_0x6567('0x3'));var rp=require(_0x6567('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6567('0x5'));var attributes=require(_0x6567('0x6'));module[_0x6567('0x7')]=function(_0x20f2ec,_0x3a5598){return _0x20f2ec['define'](_0x6567('0x8'),attributes,{'tableName':_0x6567('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b6f=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0x1b6f,0xb3));var _0xf1b6=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x1b6f[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0xf1b6('0x0'));var util=require(_0xf1b6('0x1'));var logger=require(_0xf1b6('0x2'))(_0xf1b6('0x3'));var moment=require(_0xf1b6('0x4'));var BPromise=require(_0xf1b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1b6('0x6'));var rimraf=require('rimraf');var config=require(_0xf1b6('0x7'));var attributes=require(_0xf1b6('0x8'));module[_0xf1b6('0x9')]=function(_0x5d87c4,_0x55b45a){return _0x5d87c4[_0xf1b6('0xa')](_0xf1b6('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2e19001..245f24b 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x5ebe82,_0x26b338){var _0x44e192=function(_0x4e37fa){while(--_0x4e37fa){_0x5ebe82['push'](_0x5ebe82['shift']());}};_0x44e192(++_0x26b338);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'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')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x500b0d,_0x2a7e27){var _0x4e41d=function(_0x410599){while(--_0x410599){_0x500b0d['push'](_0x500b0d['shift']());}};_0x4e41d(++_0x2a7e27);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d7193,_0x10650f){_0x2d7193=_0x2d7193-0x0;var _0x5b6f9c=_0x5f2f[_0x2d7193];return _0x5b6f9c;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ce76b4d..caf7b66 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 _0xc31f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc31f,0xd0));var _0xfc31=function(_0x31d7c3,_0x2f88c3){_0x31d7c3=_0x31d7c3-0x0;var _0x257c99=_0xc31f[_0x31d7c3];return _0x257c99;};'use strict';var multer=require(_0xfc31('0x0'));var util=require(_0xfc31('0x1'));var path=require('path');var timeout=require(_0xfc31('0x2'));var express=require('express');var router=express[_0xfc31('0x3')]();var fs_extra=require(_0xfc31('0x4'));var auth=require(_0xfc31('0x5'));var interaction=require(_0xfc31('0x6'));var config=require(_0xfc31('0x7'));var controller=require('./mailSubstatus.controller');router[_0xfc31('0x8')]('/',auth[_0xfc31('0x9')](),controller['index']);router[_0xfc31('0x8')](_0xfc31('0xa'),auth['isAuthenticated'](),controller[_0xfc31('0xb')]);router[_0xfc31('0x8')](_0xfc31('0xc'),auth[_0xfc31('0x9')](),controller[_0xfc31('0xd')]);router[_0xfc31('0xe')]('/',auth[_0xfc31('0x9')](),controller[_0xfc31('0xf')]);router[_0xfc31('0x10')](_0xfc31('0xc'),auth['isAuthenticated'](),controller[_0xfc31('0x11')]);router[_0xfc31('0x12')](_0xfc31('0xc'),auth[_0xfc31('0x9')](),controller[_0xfc31('0x13')]);module[_0xfc31('0x14')]=router; \ No newline at end of file +var _0xd86e=['post','create','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/:id'];(function(_0x6ee17c,_0x332bc6){var _0x6b2426=function(_0x231a1c){while(--_0x231a1c){_0x6ee17c['push'](_0x6ee17c['shift']());}};_0x6b2426(++_0x332bc6);}(_0xd86e,0x64));var _0xed86=function(_0x12b6e2,_0x1bb255){_0x12b6e2=_0x12b6e2-0x0;var _0x187187=_0xd86e[_0x12b6e2];return _0x187187;};'use strict';var multer=require(_0xed86('0x0'));var util=require(_0xed86('0x1'));var path=require(_0xed86('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed86('0x3')]();var fs_extra=require(_0xed86('0x4'));var auth=require(_0xed86('0x5'));var interaction=require(_0xed86('0x6'));var config=require(_0xed86('0x7'));var controller=require(_0xed86('0x8'));router[_0xed86('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xed86('0x9')]('/describe',auth[_0xed86('0xa')](),controller['describe']);router['get'](_0xed86('0xb'),auth[_0xed86('0xa')](),controller['show']);router[_0xed86('0xc')]('/',auth[_0xed86('0xa')](),controller[_0xed86('0xd')]);router['put']('/:id',auth[_0xed86('0xa')](),controller['update']);router[_0xed86('0xe')](_0xed86('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xed86('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index cc6a008..0417ed7 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 _0xf072=['STRING','sequelize','exports'];(function(_0x5f53c3,_0x5f40b0){var _0x5d4be5=function(_0x365e48){while(--_0x365e48){_0x5f53c3['push'](_0x5f53c3['shift']());}};_0x5d4be5(++_0x5f40b0);}(_0xf072,0x1cf));var _0x2f07=function(_0x467f4d,_0x1606a0){_0x467f4d=_0x467f4d-0x0;var _0x2738f4=_0xf072[_0x467f4d];return _0x2738f4;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'name':{'type':Sequelize[_0x2f07('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2f07('0x2')]}}; \ No newline at end of file +var _0x2bd8=['name','sequelize','STRING'];(function(_0x4e34f6,_0x16ff99){var _0x13aab9=function(_0x5d2565){while(--_0x5d2565){_0x4e34f6['push'](_0x4e34f6['shift']());}};_0x13aab9(++_0x16ff99);}(_0x2bd8,0x130));var _0x82bd=function(_0x171f51,_0x2ec6cb){_0x171f51=_0x171f51-0x0;var _0x2fbe6b=_0x2bd8[_0x171f51];return _0x2fbe6b;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'unique':_0x82bd('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x82bd('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index aff0fdb..96d2462 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 _0x7c9f=['send','index','map','MailSubstatus','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name'];(function(_0x5ec698,_0x499134){var _0x2cdeb0=function(_0x23d034){while(--_0x23d034){_0x5ec698['push'](_0x5ec698['shift']());}};_0x2cdeb0(++_0x499134);}(_0x7c9f,0x1eb));var _0xf7c9=function(_0x174d7b,_0x50f7ab){_0x174d7b=_0x174d7b-0x0;var _0x506f7a=_0x7c9f[_0x174d7b];return _0x506f7a;};'use strict';var emlformat=require(_0xf7c9('0x0'));var rimraf=require(_0xf7c9('0x1'));var zipdir=require(_0xf7c9('0x2'));var jsonpatch=require(_0xf7c9('0x3'));var rp=require(_0xf7c9('0x4'));var moment=require(_0xf7c9('0x5'));var BPromise=require(_0xf7c9('0x6'));var Mustache=require(_0xf7c9('0x7'));var util=require(_0xf7c9('0x8'));var path=require(_0xf7c9('0x9'));var sox=require('sox');var csv=require(_0xf7c9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7c9('0xb'));var _=require(_0xf7c9('0xc'));var squel=require('squel');var crypto=require(_0xf7c9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf7c9('0xe'));var toCsv=require(_0xf7c9('0xa'));var querystring=require(_0xf7c9('0xf'));var Papa=require(_0xf7c9('0x10'));var Redis=require(_0xf7c9('0x11'));var authService=require(_0xf7c9('0x12'));var qs=require(_0xf7c9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7c9('0x14'));var logger=require('../../config/logger')(_0xf7c9('0x15'));var utils=require(_0xf7c9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf7c9('0x17'));var db=require(_0xf7c9('0x18'))['db'];function respondWithStatusCode(_0x2f696d,_0x165fcd){_0x165fcd=_0x165fcd||0xcc;return function(_0x2f6e2d){if(_0x2f6e2d){return _0x2f696d['sendStatus'](_0x165fcd);}return _0x2f696d[_0xf7c9('0x19')](_0x165fcd)[_0xf7c9('0x1a')]();};}function respondWithResult(_0x2555a4,_0x82d12b){_0x82d12b=_0x82d12b||0xc8;return function(_0x4485d3){if(_0x4485d3){return _0x2555a4[_0xf7c9('0x19')](_0x82d12b)[_0xf7c9('0x1b')](_0x4485d3);}};}function respondWithFilteredResult(_0x23d4f9,_0x1f8725){return function(_0xf8c4f3){if(_0xf8c4f3){var _0x1b818e=typeof _0x1f8725[_0xf7c9('0x1c')]===_0xf7c9('0x1d')&&typeof _0x1f8725[_0xf7c9('0x1e')]===_0xf7c9('0x1d');var _0x4aa6dc=_0xf8c4f3[_0xf7c9('0x1f')];var _0x3d93ef=_0x1b818e?0x0:_0x1f8725[_0xf7c9('0x1c')];var _0x1616d9=_0x1b818e?_0xf8c4f3['count']:_0x1f8725['offset']+_0x1f8725[_0xf7c9('0x1e')];var _0x117468;if(_0x1616d9>=_0x4aa6dc){_0x1616d9=_0x4aa6dc;_0x117468=0xc8;}else{_0x117468=0xce;}_0x23d4f9[_0xf7c9('0x19')](_0x117468);return _0x23d4f9['set'](_0xf7c9('0x20'),_0x3d93ef+'-'+_0x1616d9+'/'+_0x4aa6dc)[_0xf7c9('0x1b')](_0xf8c4f3);}return null;};}function patchUpdates(_0x11c180){return function(_0x162442){try{jsonpatch[_0xf7c9('0x21')](_0x162442,_0x11c180,!![]);}catch(_0x25aa2d){return BPromise[_0xf7c9('0x22')](_0x25aa2d);}return _0x162442['save']();};}function saveUpdates(_0x3d84d2,_0x18cd8e){return function(_0x3ff1f5){if(_0x3ff1f5){return _0x3ff1f5['update'](_0x3d84d2)[_0xf7c9('0x23')](function(_0x1ff018){return _0x1ff018;});}return null;};}function removeEntity(_0x2874a2,_0x11f7b9){return function(_0x22d7c3){if(_0x22d7c3){return _0x22d7c3[_0xf7c9('0x24')]()[_0xf7c9('0x23')](function(){_0x2874a2[_0xf7c9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9c61,_0x1aa39e){return function(_0x52043d){if(!_0x52043d){_0x2e9c61[_0xf7c9('0x25')](0x194);}return _0x52043d;};}function handleError(_0xf0984a,_0x404521){_0x404521=_0x404521||0x1f4;return function(_0x1ae59d){logger[_0xf7c9('0x26')](_0x1ae59d[_0xf7c9('0x27')]);if(_0x1ae59d[_0xf7c9('0x28')]){delete _0x1ae59d[_0xf7c9('0x28')];}_0xf0984a['status'](_0x404521)[_0xf7c9('0x29')](_0x1ae59d);};}exports[_0xf7c9('0x2a')]=function(_0x29c5fc,_0x4dc983){var _0x338bbe={},_0x401a43={},_0x12dd17={'count':0x0,'rows':[]};var _0x11931c=_[_0xf7c9('0x2b')](db[_0xf7c9('0x2c')]['rawAttributes'],function(_0x8df962){return{'name':_0x8df962['fieldName'],'type':_0x8df962[_0xf7c9('0x2d')][_0xf7c9('0x2e')]};});_0x401a43[_0xf7c9('0x2f')]=_['map'](_0x11931c,_0xf7c9('0x28'));_0x401a43[_0xf7c9('0x30')]=_[_0xf7c9('0x31')](_0x29c5fc[_0xf7c9('0x30')]);_0x401a43['filters']=_[_0xf7c9('0x32')](_0x401a43['model'],_0x401a43[_0xf7c9('0x30')]);_0x338bbe['attributes']=_[_0xf7c9('0x32')](_0x401a43[_0xf7c9('0x2f')],qs[_0xf7c9('0x33')](_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x33')]));_0x338bbe[_0xf7c9('0x34')]=_0x338bbe[_0xf7c9('0x34')][_0xf7c9('0x35')]?_0x338bbe['attributes']:_0x401a43[_0xf7c9('0x2f')];if(!_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x36')](_0xf7c9('0x37'))){_0x338bbe[_0xf7c9('0x1e')]=qs[_0xf7c9('0x1e')](_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x1e')]);_0x338bbe[_0xf7c9('0x1c')]=qs[_0xf7c9('0x1c')](_0x29c5fc[_0xf7c9('0x30')]['offset']);}_0x338bbe['order']=qs[_0xf7c9('0x38')](_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x38')]);_0x338bbe[_0xf7c9('0x39')]=qs[_0xf7c9('0x3a')](_[_0xf7c9('0x3b')](_0x29c5fc[_0xf7c9('0x30')],_0x401a43['filters']),_0x11931c);if(_0x29c5fc['query'][_0xf7c9('0x3c')]){_0x338bbe[_0xf7c9('0x39')]=_[_0xf7c9('0x3d')](_0x338bbe['where'],{'$or':_[_0xf7c9('0x2b')](_0x11931c,function(_0x5af31a){if(_0x5af31a['type']!==_0xf7c9('0x3e')){var _0x4e778c={};_0x4e778c[_0x5af31a[_0xf7c9('0x28')]]={'$like':'%'+_0x29c5fc['query'][_0xf7c9('0x3c')]+'%'};return _0x4e778c;}})});}_0x338bbe=_[_0xf7c9('0x3d')]({},_0x338bbe,_0x29c5fc[_0xf7c9('0x3f')]);var _0x5510e8={'where':_0x338bbe[_0xf7c9('0x39')]};return db[_0xf7c9('0x2c')][_0xf7c9('0x1f')](_0x5510e8)[_0xf7c9('0x23')](function(_0x2a4863){_0x12dd17['count']=_0x2a4863;if(_0x29c5fc[_0xf7c9('0x30')][_0xf7c9('0x40')]){_0x338bbe[_0xf7c9('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0xf7c9('0x42')](_0x338bbe);})[_0xf7c9('0x23')](function(_0x250475){_0x12dd17['rows']=_0x250475;return _0x12dd17;})[_0xf7c9('0x23')](respondWithFilteredResult(_0x4dc983,_0x338bbe))[_0xf7c9('0x43')](handleError(_0x4dc983,null));};exports[_0xf7c9('0x44')]=function(_0x191ea0,_0x3938f1){var _0x430411={'raw':!![],'where':{'id':_0x191ea0['params']['id']}},_0x1ac2c8={};_0x1ac2c8[_0xf7c9('0x2f')]=_['keys'](db[_0xf7c9('0x2c')][_0xf7c9('0x45')]);_0x1ac2c8['query']=_['keys'](_0x191ea0[_0xf7c9('0x30')]);_0x1ac2c8[_0xf7c9('0x3a')]=_['intersection'](_0x1ac2c8[_0xf7c9('0x2f')],_0x1ac2c8['query']);_0x430411[_0xf7c9('0x34')]=_[_0xf7c9('0x32')](_0x1ac2c8[_0xf7c9('0x2f')],qs[_0xf7c9('0x33')](_0x191ea0[_0xf7c9('0x30')][_0xf7c9('0x33')]));_0x430411[_0xf7c9('0x34')]=_0x430411[_0xf7c9('0x34')][_0xf7c9('0x35')]?_0x430411[_0xf7c9('0x34')]:_0x1ac2c8[_0xf7c9('0x2f')];if(_0x191ea0[_0xf7c9('0x30')][_0xf7c9('0x40')]){_0x430411[_0xf7c9('0x41')]=[{'all':!![]}];}_0x430411=_[_0xf7c9('0x3d')]({},_0x430411,_0x191ea0['options']);return db['MailSubstatus'][_0xf7c9('0x46')](_0x430411)[_0xf7c9('0x23')](handleEntityNotFound(_0x3938f1,null))[_0xf7c9('0x23')](respondWithResult(_0x3938f1,null))[_0xf7c9('0x43')](handleError(_0x3938f1,null));};exports[_0xf7c9('0x47')]=function(_0x547cc2,_0x2cbc19){return db['MailSubstatus'][_0xf7c9('0x47')](_0x547cc2['body'],{})[_0xf7c9('0x23')](respondWithResult(_0x2cbc19,0xc9))['catch'](handleError(_0x2cbc19,null));};exports[_0xf7c9('0x48')]=function(_0x296627,_0x2cad18){if(_0x296627[_0xf7c9('0x49')]['id']){delete _0x296627['body']['id'];}return db[_0xf7c9('0x2c')][_0xf7c9('0x46')]({'where':{'id':_0x296627[_0xf7c9('0x4a')]['id']}})[_0xf7c9('0x23')](handleEntityNotFound(_0x2cad18,null))[_0xf7c9('0x23')](saveUpdates(_0x296627[_0xf7c9('0x49')],null))[_0xf7c9('0x23')](respondWithResult(_0x2cad18,null))[_0xf7c9('0x43')](handleError(_0x2cad18,null));};exports[_0xf7c9('0x24')]=function(_0x4da3d6,_0x426208){return db[_0xf7c9('0x2c')][_0xf7c9('0x46')]({'where':{'id':_0x4da3d6[_0xf7c9('0x4a')]['id']}})[_0xf7c9('0x23')](handleEntityNotFound(_0x426208,null))[_0xf7c9('0x23')](removeEntity(_0x426208,null))[_0xf7c9('0x43')](handleError(_0x426208,null));};exports['describe']=function(_0x1ac42b,_0x2533f){return db[_0xf7c9('0x2c')][_0xf7c9('0x4b')]()[_0xf7c9('0x23')](respondWithResult(_0x2533f,null))[_0xf7c9('0x43')](handleError(_0x2533f,null));}; \ No newline at end of file +var _0x989d=['includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x989d,0xe8));var _0xd989=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x989d[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0xd989('0x0'));var rimraf=require(_0xd989('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd989('0x2'));var rp=require(_0xd989('0x3'));var moment=require(_0xd989('0x4'));var BPromise=require(_0xd989('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd989('0x6'));var csv=require(_0xd989('0x7'));var ejs=require(_0xd989('0x8'));var fs=require('fs');var fs_extra=require(_0xd989('0x9'));var _=require(_0xd989('0xa'));var squel=require(_0xd989('0xb'));var crypto=require(_0xd989('0xc'));var jsforce=require(_0xd989('0xd'));var deskjs=require(_0xd989('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd989('0xf'));var Papa=require(_0xd989('0x10'));var Redis=require(_0xd989('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd989('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd989('0x13'));var logger=require(_0xd989('0x14'))(_0xd989('0x15'));var utils=require(_0xd989('0x16'));var config=require(_0xd989('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd989('0x18'))['db'];function respondWithStatusCode(_0x7ec6aa,_0x58c151){_0x58c151=_0x58c151||0xcc;return function(_0x2bdb3b){if(_0x2bdb3b){return _0x7ec6aa[_0xd989('0x19')](_0x58c151);}return _0x7ec6aa[_0xd989('0x1a')](_0x58c151)[_0xd989('0x1b')]();};}function respondWithResult(_0x4db88f,_0x488b2f){_0x488b2f=_0x488b2f||0xc8;return function(_0x14e5e5){if(_0x14e5e5){return _0x4db88f[_0xd989('0x1a')](_0x488b2f)[_0xd989('0x1c')](_0x14e5e5);}};}function respondWithFilteredResult(_0x14d3ae,_0x360ed1){return function(_0x50f7a3){if(_0x50f7a3){var _0x4ca0c0=typeof _0x360ed1[_0xd989('0x1d')]==='undefined'&&typeof _0x360ed1[_0xd989('0x1e')]==='undefined';var _0x2539b3=_0x50f7a3[_0xd989('0x1f')];var _0x227774=_0x4ca0c0?0x0:_0x360ed1[_0xd989('0x1d')];var _0x29221c=_0x4ca0c0?_0x50f7a3[_0xd989('0x1f')]:_0x360ed1[_0xd989('0x1d')]+_0x360ed1['limit'];var _0x4909db;if(_0x29221c>=_0x2539b3){_0x29221c=_0x2539b3;_0x4909db=0xc8;}else{_0x4909db=0xce;}_0x14d3ae[_0xd989('0x1a')](_0x4909db);return _0x14d3ae['set'](_0xd989('0x20'),_0x227774+'-'+_0x29221c+'/'+_0x2539b3)['json'](_0x50f7a3);}return null;};}function patchUpdates(_0x4bc299){return function(_0x4880e6){try{jsonpatch[_0xd989('0x21')](_0x4880e6,_0x4bc299,!![]);}catch(_0x4213d7){return BPromise['reject'](_0x4213d7);}return _0x4880e6[_0xd989('0x22')]();};}function saveUpdates(_0x3b1d5a,_0x5df481){return function(_0x12ee9a){if(_0x12ee9a){return _0x12ee9a[_0xd989('0x23')](_0x3b1d5a)[_0xd989('0x24')](function(_0x518e59){return _0x518e59;});}return null;};}function removeEntity(_0x4c7cce,_0x16f11b){return function(_0x4e46c8){if(_0x4e46c8){return _0x4e46c8[_0xd989('0x25')]()['then'](function(){_0x4c7cce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55425f,_0x2d3eb4){return function(_0x1ba1f9){if(!_0x1ba1f9){_0x55425f[_0xd989('0x19')](0x194);}return _0x1ba1f9;};}function handleError(_0x2818f4,_0x3f3130){_0x3f3130=_0x3f3130||0x1f4;return function(_0x2d23f4){logger[_0xd989('0x26')](_0x2d23f4[_0xd989('0x27')]);if(_0x2d23f4['name']){delete _0x2d23f4[_0xd989('0x28')];}_0x2818f4[_0xd989('0x1a')](_0x3f3130)[_0xd989('0x29')](_0x2d23f4);};}exports['index']=function(_0x271de7,_0x2aee4d){var _0x1bbc79={},_0x1e0013={},_0x47f24a={'count':0x0,'rows':[]};var _0x170709=_[_0xd989('0x2a')](db[_0xd989('0x2b')][_0xd989('0x2c')],function(_0x47daec){return{'name':_0x47daec[_0xd989('0x2d')],'type':_0x47daec[_0xd989('0x2e')][_0xd989('0x2f')]};});_0x1e0013['model']=_['map'](_0x170709,_0xd989('0x28'));_0x1e0013[_0xd989('0x30')]=_[_0xd989('0x31')](_0x271de7[_0xd989('0x30')]);_0x1e0013[_0xd989('0x32')]=_[_0xd989('0x33')](_0x1e0013[_0xd989('0x34')],_0x1e0013[_0xd989('0x30')]);_0x1bbc79[_0xd989('0x35')]=_[_0xd989('0x33')](_0x1e0013[_0xd989('0x34')],qs[_0xd989('0x36')](_0x271de7[_0xd989('0x30')]['fields']));_0x1bbc79[_0xd989('0x35')]=_0x1bbc79[_0xd989('0x35')][_0xd989('0x37')]?_0x1bbc79[_0xd989('0x35')]:_0x1e0013[_0xd989('0x34')];if(!_0x271de7[_0xd989('0x30')][_0xd989('0x38')]('nolimit')){_0x1bbc79[_0xd989('0x1e')]=qs[_0xd989('0x1e')](_0x271de7[_0xd989('0x30')][_0xd989('0x1e')]);_0x1bbc79[_0xd989('0x1d')]=qs[_0xd989('0x1d')](_0x271de7[_0xd989('0x30')][_0xd989('0x1d')]);}_0x1bbc79[_0xd989('0x39')]=qs['sort'](_0x271de7[_0xd989('0x30')][_0xd989('0x3a')]);_0x1bbc79[_0xd989('0x3b')]=qs['filters'](_['pick'](_0x271de7[_0xd989('0x30')],_0x1e0013[_0xd989('0x32')]),_0x170709);if(_0x271de7[_0xd989('0x30')][_0xd989('0x3c')]){_0x1bbc79[_0xd989('0x3b')]=_[_0xd989('0x3d')](_0x1bbc79[_0xd989('0x3b')],{'$or':_[_0xd989('0x2a')](_0x170709,function(_0x23fd24){if(_0x23fd24[_0xd989('0x2e')]!==_0xd989('0x3e')){var _0x4d122e={};_0x4d122e[_0x23fd24[_0xd989('0x28')]]={'$like':'%'+_0x271de7[_0xd989('0x30')][_0xd989('0x3c')]+'%'};return _0x4d122e;}})});}_0x1bbc79=_[_0xd989('0x3d')]({},_0x1bbc79,_0x271de7[_0xd989('0x3f')]);var _0xdf9f6f={'where':_0x1bbc79[_0xd989('0x3b')]};return db[_0xd989('0x2b')][_0xd989('0x1f')](_0xdf9f6f)[_0xd989('0x24')](function(_0x59d69d){_0x47f24a['count']=_0x59d69d;if(_0x271de7[_0xd989('0x30')][_0xd989('0x40')]){_0x1bbc79[_0xd989('0x41')]=[{'all':!![]}];}return db[_0xd989('0x2b')][_0xd989('0x42')](_0x1bbc79);})['then'](function(_0x5d9ddb){_0x47f24a[_0xd989('0x43')]=_0x5d9ddb;return _0x47f24a;})[_0xd989('0x24')](respondWithFilteredResult(_0x2aee4d,_0x1bbc79))[_0xd989('0x44')](handleError(_0x2aee4d,null));};exports['show']=function(_0x1f977d,_0x44502d){var _0x3c7b69={'raw':!![],'where':{'id':_0x1f977d[_0xd989('0x45')]['id']}},_0x1ae5cf={};_0x1ae5cf['model']=_[_0xd989('0x31')](db[_0xd989('0x2b')]['rawAttributes']);_0x1ae5cf[_0xd989('0x30')]=_[_0xd989('0x31')](_0x1f977d['query']);_0x1ae5cf[_0xd989('0x32')]=_[_0xd989('0x33')](_0x1ae5cf[_0xd989('0x34')],_0x1ae5cf[_0xd989('0x30')]);_0x3c7b69[_0xd989('0x35')]=_[_0xd989('0x33')](_0x1ae5cf[_0xd989('0x34')],qs[_0xd989('0x36')](_0x1f977d[_0xd989('0x30')][_0xd989('0x36')]));_0x3c7b69[_0xd989('0x35')]=_0x3c7b69['attributes'][_0xd989('0x37')]?_0x3c7b69['attributes']:_0x1ae5cf[_0xd989('0x34')];if(_0x1f977d[_0xd989('0x30')][_0xd989('0x40')]){_0x3c7b69[_0xd989('0x41')]=[{'all':!![]}];}_0x3c7b69=_[_0xd989('0x3d')]({},_0x3c7b69,_0x1f977d[_0xd989('0x3f')]);return db['MailSubstatus'][_0xd989('0x46')](_0x3c7b69)[_0xd989('0x24')](handleEntityNotFound(_0x44502d,null))[_0xd989('0x24')](respondWithResult(_0x44502d,null))[_0xd989('0x44')](handleError(_0x44502d,null));};exports['create']=function(_0x34defd,_0x150047){return db[_0xd989('0x2b')][_0xd989('0x47')](_0x34defd['body'],{})[_0xd989('0x24')](respondWithResult(_0x150047,0xc9))['catch'](handleError(_0x150047,null));};exports[_0xd989('0x23')]=function(_0x548f01,_0x50c6f4){if(_0x548f01[_0xd989('0x48')]['id']){delete _0x548f01['body']['id'];}return db[_0xd989('0x2b')][_0xd989('0x46')]({'where':{'id':_0x548f01[_0xd989('0x45')]['id']}})[_0xd989('0x24')](handleEntityNotFound(_0x50c6f4,null))['then'](saveUpdates(_0x548f01[_0xd989('0x48')],null))[_0xd989('0x24')](respondWithResult(_0x50c6f4,null))[_0xd989('0x44')](handleError(_0x50c6f4,null));};exports['destroy']=function(_0x2f9220,_0x343f3e){return db[_0xd989('0x2b')]['find']({'where':{'id':_0x2f9220[_0xd989('0x45')]['id']}})[_0xd989('0x24')](handleEntityNotFound(_0x343f3e,null))[_0xd989('0x24')](removeEntity(_0x343f3e,null))['catch'](handleError(_0x343f3e,null));};exports[_0xd989('0x49')]=function(_0xb7765c,_0x5a9450){return db[_0xd989('0x2b')][_0xd989('0x49')]()['then'](respondWithResult(_0x5a9450,null))['catch'](handleError(_0x5a9450,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 3d1391e..2e3a6bd 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 _0xdd9c=['hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners','emit'];(function(_0x40e7f7,_0x5dc0d3){var _0x48605d=function(_0x37372c){while(--_0x37372c){_0x40e7f7['push'](_0x40e7f7['shift']());}};_0x48605d(++_0x5dc0d3);}(_0xdd9c,0x1df));var _0xcdd9=function(_0x1bd43e,_0x28fc4e){_0x1bd43e=_0x1bd43e-0x0;var _0x14a92e=_0xdd9c[_0x1bd43e];return _0x14a92e;};'use strict';var EventEmitter=require(_0xcdd9('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xcdd9('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xcdd9('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x5905cb){return function(_0x1cf203,_0xe2de8a,_0x4889ed){MailSubstatusEvents[_0xcdd9('0x3')](_0x5905cb+':'+_0x1cf203['id'],_0x1cf203);MailSubstatusEvents[_0xcdd9('0x3')](_0x5905cb,_0x1cf203);_0x4889ed(null);};}for(var e in events){if(events[_0xcdd9('0x4')](e)){var event=events[e];MailSubstatus[_0xcdd9('0x5')](e,emitEvent(event));}}module[_0xcdd9('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0xb6b5=['hasOwnProperty','hook','events','../../mysqldb','MailSubstatus','update','emit'];(function(_0x214040,_0x24a1a1){var _0x190c8c=function(_0x1ca3fb){while(--_0x1ca3fb){_0x214040['push'](_0x214040['shift']());}};_0x190c8c(++_0x24a1a1);}(_0xb6b5,0x1f3));var _0x5b6b=function(_0x40b771,_0x2910b3){_0x40b771=_0x40b771-0x0;var _0x5afb86=_0xb6b5[_0x40b771];return _0x5afb86;};'use strict';var EventEmitter=require(_0x5b6b('0x0'));var MailSubstatus=require(_0x5b6b('0x1'))['db'][_0x5b6b('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x5b6b('0x3')};function emitEvent(_0x685918){return function(_0x315ae5,_0x309031,_0x2263c0){MailSubstatusEvents[_0x5b6b('0x4')](_0x685918+':'+_0x315ae5['id'],_0x315ae5);MailSubstatusEvents[_0x5b6b('0x4')](_0x685918,_0x315ae5);_0x2263c0(null);};}for(var e in events){if(events[_0x5b6b('0x5')](e)){var event=events[e];MailSubstatus[_0x5b6b('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index cd3c9df..83dd9dd 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 _0x7ad3=['MailSubstatus','Condition','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define'];(function(_0x4a790a,_0xd87322){var _0x1717e4=function(_0x11da2e){while(--_0x11da2e){_0x4a790a['push'](_0x4a790a['shift']());}};_0x1717e4(++_0xd87322);}(_0x7ad3,0x1b8));var _0x37ad=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x7ad3[_0x2074db];return _0x27324c;};'use strict';var attributes=require(_0x37ad('0x0'));module[_0x37ad('0x1')]=function(_0x33c9d9){var _0x87b7bf=_0x33c9d9[_0x37ad('0x2')];return _0x33c9d9[_0x37ad('0x3')](_0x37ad('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x192d5e,_0x1b69dc,_0x324eb2){return _0x87b7bf[_0x37ad('0x5')][_0x37ad('0x6')]({'value':_0x192d5e['name']},{'where':{'field':_0x37ad('0x7'),'value':_0x192d5e[_0x37ad('0x8')][_0x37ad('0x9')]}})[_0x37ad('0xa')](function(){_0x324eb2();})[_0x37ad('0xb')](function(_0x2d5508){_0x324eb2(_0x2d5508);});}}});}; \ No newline at end of file +var _0xb982=['models','define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues','then','catch'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0xb982,0x15e));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x190824){var _0x37a3ff=_0x190824[_0x2b98('0x0')];return _0x190824[_0x2b98('0x1')](_0x2b98('0x2'),attributes,{'tableName':_0x2b98('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x202506,_0x1176d5,_0x2f9789){return _0x37a3ff[_0x2b98('0x4')]['update']({'value':_0x202506[_0x2b98('0x5')]},{'where':{'field':_0x2b98('0x6'),'value':_0x202506[_0x2b98('0x7')][_0x2b98('0x5')]}})[_0x2b98('0x8')](function(){_0x2f9789();})[_0x2b98('0x9')](function(_0x557884){_0x2f9789(_0x557884);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c953817..4a259b5 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 _0xd704=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment'];(function(_0x2d7ca4,_0x2ade95){var _0x27f283=function(_0x4d1447){while(--_0x4d1447){_0x2d7ca4['push'](_0x2d7ca4['shift']());}};_0x27f283(++_0x2ade95);}(_0xd704,0xd0));var _0x4d70=function(_0x457840,_0x32a6c2){_0x457840=_0x457840-0x0;var _0x291996=_0xd704[_0x457840];return _0x291996;};'use strict';var _=require(_0x4d70('0x0'));var util=require('util');var moment=require(_0x4d70('0x1'));var BPromise=require(_0x4d70('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d70('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d70('0x4'));var logger=require(_0x4d70('0x5'))(_0x4d70('0x6'));var config=require(_0x4d70('0x7'));var jayson=require(_0x4d70('0x8'));var client=jayson[_0x4d70('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x503a5e,_0x9b09b7,_0x6bbf4f){return new BPromise(function(_0x3c61cd,_0x54909b){return client['request'](_0x503a5e,_0x6bbf4f)[_0x4d70('0xa')](function(_0x12609b){logger[_0x4d70('0xb')](_0x4d70('0xc'),_0x9b09b7,_0x4d70('0xd'));logger[_0x4d70('0xe')](_0x4d70('0xf'),_0x9b09b7,_0x4d70('0xd'),JSON[_0x4d70('0x10')](_0x12609b));if(_0x12609b[_0x4d70('0x11')]){if(_0x12609b[_0x4d70('0x11')][_0x4d70('0x12')]===0x1f4){logger[_0x4d70('0x11')](_0x4d70('0xc'),_0x9b09b7,_0x12609b[_0x4d70('0x11')]['message']);return _0x54909b(_0x12609b[_0x4d70('0x11')][_0x4d70('0x13')]);}logger[_0x4d70('0x11')](_0x4d70('0xc'),_0x9b09b7,_0x12609b['error'][_0x4d70('0x13')]);return _0x3c61cd(_0x12609b[_0x4d70('0x11')]['message']);}else{logger[_0x4d70('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x9b09b7,'request\x20sent');_0x3c61cd(_0x12609b['result'][_0x4d70('0x13')]);}})[_0x4d70('0x14')](function(_0x4102e5){logger[_0x4d70('0x11')](_0x4d70('0xc'),_0x9b09b7,_0x4102e5);_0x54909b(_0x4102e5);});});} \ No newline at end of file +var _0xbed4=['stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x826b5d,_0x5a01c8){var _0x1e5727=function(_0xe80e49){while(--_0xe80e49){_0x826b5d['push'](_0x826b5d['shift']());}};_0x1e5727(++_0x5a01c8);}(_0xbed4,0x142));var _0x4bed=function(_0x5796bf,_0x2c93ef){_0x5796bf=_0x5796bf-0x0;var _0x1aba5c=_0xbed4[_0x5796bf];return _0x1aba5c;};'use strict';var _=require(_0x4bed('0x0'));var util=require(_0x4bed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4bed('0x2'));var fs=require('fs');var Redis=require(_0x4bed('0x3'));var db=require(_0x4bed('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4bed('0x5'));var client=jayson[_0x4bed('0x6')][_0x4bed('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51037e,_0x582049,_0x55d671){return new BPromise(function(_0x27d03f,_0x35f4a1){return client[_0x4bed('0x8')](_0x51037e,_0x55d671)[_0x4bed('0x9')](function(_0x1a401b){logger[_0x4bed('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x582049,_0x4bed('0xb'));logger[_0x4bed('0xc')](_0x4bed('0xd'),_0x582049,'request\x20sent',JSON[_0x4bed('0xe')](_0x1a401b));if(_0x1a401b[_0x4bed('0xf')]){if(_0x1a401b[_0x4bed('0xf')][_0x4bed('0x10')]===0x1f4){logger[_0x4bed('0xf')](_0x4bed('0x11'),_0x582049,_0x1a401b['error'][_0x4bed('0x12')]);return _0x35f4a1(_0x1a401b['error'][_0x4bed('0x12')]);}logger[_0x4bed('0xf')](_0x4bed('0x11'),_0x582049,_0x1a401b[_0x4bed('0xf')][_0x4bed('0x12')]);return _0x27d03f(_0x1a401b[_0x4bed('0xf')]['message']);}else{logger[_0x4bed('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x582049,_0x4bed('0xb'));_0x27d03f(_0x1a401b[_0x4bed('0x13')]['message']);}})[_0x4bed('0x14')](function(_0x1a898d){logger[_0x4bed('0xf')](_0x4bed('0x11'),_0x582049,_0x1a898d);_0x35f4a1(_0x1a898d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index b3d9e73..a1f3e63 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 _0x5ed8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0xd4b0ea,_0x5d35b7){var _0x57c43e=function(_0x9e2480){while(--_0x9e2480){_0xd4b0ea['push'](_0xd4b0ea['shift']());}};_0x57c43e(++_0x5d35b7);}(_0x5ed8,0x150));var _0x85ed=function(_0x2e6e12,_0x238fc4){_0x2e6e12=_0x2e6e12-0x0;var _0x4bebf6=_0x5ed8[_0x2e6e12];return _0x4bebf6;};'use strict';var multer=require(_0x85ed('0x0'));var util=require(_0x85ed('0x1'));var path=require(_0x85ed('0x2'));var timeout=require(_0x85ed('0x3'));var express=require('express');var router=express[_0x85ed('0x4')]();var fs_extra=require(_0x85ed('0x5'));var auth=require(_0x85ed('0x6'));var interaction=require(_0x85ed('0x7'));var config=require(_0x85ed('0x8'));var controller=require(_0x85ed('0x9'));router[_0x85ed('0xa')]('/',auth[_0x85ed('0xb')](),controller['index']);router[_0x85ed('0xa')]('/describe',auth[_0x85ed('0xb')](),controller[_0x85ed('0xc')]);router[_0x85ed('0xa')](_0x85ed('0xd'),auth[_0x85ed('0xb')](),controller[_0x85ed('0xe')]);router['post']('/',auth[_0x85ed('0xb')](),controller[_0x85ed('0xf')]);router[_0x85ed('0x10')](_0x85ed('0xd'),auth[_0x85ed('0xb')](),controller[_0x85ed('0x11')]);router[_0x85ed('0x12')](_0x85ed('0xd'),auth['isAuthenticated'](),controller[_0x85ed('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5386=['delete','/:id','destroy','exports','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','post','create','update'];(function(_0x5e7216,_0x15c860){var _0x15f43a=function(_0xd3eeaa){while(--_0xd3eeaa){_0x5e7216['push'](_0x5e7216['shift']());}};_0x15f43a(++_0x15c860);}(_0x5386,0x158));var _0x6538=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0x5386[_0x1cfe2e];return _0x39233f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6538('0x0'));var timeout=require(_0x6538('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6538('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6538('0x3'));var config=require(_0x6538('0x4'));var controller=require(_0x6538('0x5'));router[_0x6538('0x6')]('/',auth[_0x6538('0x7')](),controller[_0x6538('0x8')]);router['get'](_0x6538('0x9'),auth[_0x6538('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6538('0xa')]('/',auth[_0x6538('0x7')](),controller[_0x6538('0xb')]);router['put']('/:id',auth[_0x6538('0x7')](),controller[_0x6538('0xc')]);router[_0x6538('0xd')](_0x6538('0xe'),auth['isAuthenticated'](),controller[_0x6538('0xf')]);module[_0x6538('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e4792cf..206d697 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x414ff1,_0xf0462b){var _0x29c53f=function(_0x1dab72){while(--_0x1dab72){_0x414ff1['push'](_0x414ff1['shift']());}};_0x29c53f(++_0xf0462b);}(_0x34e8,0x12c));var _0x834e=function(_0x679ab0,_0x5846be){_0x679ab0=_0x679ab0-0x0;var _0x641fde=_0x34e8[_0x679ab0];return _0x641fde;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x417182,_0x353daf){var _0x2045f9=function(_0x46248a){while(--_0x46248a){_0x417182['push'](_0x417182['shift']());}};_0x2045f9(++_0x353daf);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x4b84[_0x4cd21c];return _0x5d8e5e;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 951f97b..9a1b281 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 _0x621d=['findAll','show','params','options','create','body','catch','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','MailTransferReport','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filters','where','merge','type','VIRTUAL','filter','includeAll','include'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0x621d,0x135));var _0xd621=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x621d[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0xd621('0x0'));var rimraf=require(_0xd621('0x1'));var zipdir=require(_0xd621('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd621('0x3'));var moment=require(_0xd621('0x4'));var BPromise=require(_0xd621('0x5'));var Mustache=require(_0xd621('0x6'));var util=require('util');var path=require(_0xd621('0x7'));var sox=require(_0xd621('0x8'));var csv=require(_0xd621('0x9'));var ejs=require(_0xd621('0xa'));var fs=require('fs');var fs_extra=require(_0xd621('0xb'));var _=require(_0xd621('0xc'));var squel=require(_0xd621('0xd'));var crypto=require(_0xd621('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd621('0xf'));var toCsv=require(_0xd621('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd621('0x10'));var authService=require(_0xd621('0x11'));var qs=require(_0xd621('0x12'));var as=require(_0xd621('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd621('0x14'))(_0xd621('0x15'));var utils=require(_0xd621('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd621('0x17'));var db=require(_0xd621('0x18'))['db'];function respondWithStatusCode(_0x294037,_0xf64cba){_0xf64cba=_0xf64cba||0xcc;return function(_0x37f054){if(_0x37f054){return _0x294037[_0xd621('0x19')](_0xf64cba);}return _0x294037[_0xd621('0x1a')](_0xf64cba)[_0xd621('0x1b')]();};}function respondWithResult(_0x5f50f5,_0x1a3fce){_0x1a3fce=_0x1a3fce||0xc8;return function(_0x3ebcb0){if(_0x3ebcb0){return _0x5f50f5[_0xd621('0x1a')](_0x1a3fce)[_0xd621('0x1c')](_0x3ebcb0);}};}function respondWithFilteredResult(_0x454f30,_0x3a8853){return function(_0x418fbc){if(_0x418fbc){var _0x45faf1=typeof _0x3a8853['offset']===_0xd621('0x1d')&&typeof _0x3a8853[_0xd621('0x1e')]==='undefined';var _0x154c63=_0x418fbc['count'];var _0x4c7f50=_0x45faf1?0x0:_0x3a8853['offset'];var _0x1a8033=_0x45faf1?_0x418fbc[_0xd621('0x1f')]:_0x3a8853[_0xd621('0x20')]+_0x3a8853[_0xd621('0x1e')];var _0x117ebb;if(_0x1a8033>=_0x154c63){_0x1a8033=_0x154c63;_0x117ebb=0xc8;}else{_0x117ebb=0xce;}_0x454f30['status'](_0x117ebb);return _0x454f30[_0xd621('0x21')](_0xd621('0x22'),_0x4c7f50+'-'+_0x1a8033+'/'+_0x154c63)[_0xd621('0x1c')](_0x418fbc);}return null;};}function patchUpdates(_0x1e1ed7){return function(_0x571d2a){try{jsonpatch['apply'](_0x571d2a,_0x1e1ed7,!![]);}catch(_0x3ea8d6){return BPromise[_0xd621('0x23')](_0x3ea8d6);}return _0x571d2a[_0xd621('0x24')]();};}function saveUpdates(_0x314b8d,_0xa58e1d){return function(_0x8a0dd5){if(_0x8a0dd5){return _0x8a0dd5[_0xd621('0x25')](_0x314b8d)[_0xd621('0x26')](function(_0x8ba2c9){return _0x8ba2c9;});}return null;};}function removeEntity(_0x1aac2d,_0x404caf){return function(_0x503646){if(_0x503646){return _0x503646[_0xd621('0x27')]()[_0xd621('0x26')](function(){_0x1aac2d[_0xd621('0x1a')](0xcc)[_0xd621('0x1b')]();});}};}function handleEntityNotFound(_0x4cdc18,_0x491e36){return function(_0x52b08b){if(!_0x52b08b){_0x4cdc18[_0xd621('0x19')](0x194);}return _0x52b08b;};}function handleError(_0x4164f9,_0x27dadf){_0x27dadf=_0x27dadf||0x1f4;return function(_0x29034b){logger[_0xd621('0x28')](_0x29034b[_0xd621('0x29')]);if(_0x29034b[_0xd621('0x2a')]){delete _0x29034b['name'];}_0x4164f9[_0xd621('0x1a')](_0x27dadf)['send'](_0x29034b);};}exports['index']=function(_0x4ebda0,_0x42664b){var _0x19e0a6={},_0xe3fb46={},_0x34b398={'count':0x0,'rows':[]};var _0x1bda49=_[_0xd621('0x2b')](db[_0xd621('0x2c')][_0xd621('0x2d')],function(_0x3177ad){return{'name':_0x3177ad['fieldName'],'type':_0x3177ad['type'][_0xd621('0x2e')]};});_0xe3fb46[_0xd621('0x2f')]=_[_0xd621('0x2b')](_0x1bda49,_0xd621('0x2a'));_0xe3fb46[_0xd621('0x30')]=_[_0xd621('0x31')](_0x4ebda0[_0xd621('0x30')]);_0xe3fb46['filters']=_['intersection'](_0xe3fb46[_0xd621('0x2f')],_0xe3fb46[_0xd621('0x30')]);_0x19e0a6[_0xd621('0x32')]=_[_0xd621('0x33')](_0xe3fb46[_0xd621('0x2f')],qs[_0xd621('0x34')](_0x4ebda0[_0xd621('0x30')][_0xd621('0x34')]));_0x19e0a6['attributes']=_0x19e0a6[_0xd621('0x32')][_0xd621('0x35')]?_0x19e0a6[_0xd621('0x32')]:_0xe3fb46['model'];if(!_0x4ebda0[_0xd621('0x30')][_0xd621('0x36')]('nolimit')){_0x19e0a6[_0xd621('0x1e')]=qs[_0xd621('0x1e')](_0x4ebda0[_0xd621('0x30')][_0xd621('0x1e')]);_0x19e0a6[_0xd621('0x20')]=qs['offset'](_0x4ebda0[_0xd621('0x30')][_0xd621('0x20')]);}_0x19e0a6[_0xd621('0x37')]=qs[_0xd621('0x38')](_0x4ebda0[_0xd621('0x30')]['sort']);_0x19e0a6['where']=qs['filters'](_[_0xd621('0x39')](_0x4ebda0[_0xd621('0x30')],_0xe3fb46[_0xd621('0x3a')]),_0x1bda49);if(_0x4ebda0[_0xd621('0x30')]['filter']){_0x19e0a6[_0xd621('0x3b')]=_[_0xd621('0x3c')](_0x19e0a6[_0xd621('0x3b')],{'$or':_[_0xd621('0x2b')](_0x1bda49,function(_0x173b26){if(_0x173b26[_0xd621('0x3d')]!==_0xd621('0x3e')){var _0x5669fe={};_0x5669fe[_0x173b26[_0xd621('0x2a')]]={'$like':'%'+_0x4ebda0['query'][_0xd621('0x3f')]+'%'};return _0x5669fe;}})});}_0x19e0a6=_[_0xd621('0x3c')]({},_0x19e0a6,_0x4ebda0['options']);var _0x4264ea={'where':_0x19e0a6[_0xd621('0x3b')]};return db[_0xd621('0x2c')][_0xd621('0x1f')](_0x4264ea)[_0xd621('0x26')](function(_0x50c4f7){_0x34b398['count']=_0x50c4f7;if(_0x4ebda0[_0xd621('0x30')][_0xd621('0x40')]){_0x19e0a6[_0xd621('0x41')]=[{'all':!![]}];}return db[_0xd621('0x2c')][_0xd621('0x42')](_0x19e0a6);})[_0xd621('0x26')](function(_0x23c161){_0x34b398['rows']=_0x23c161;return _0x34b398;})[_0xd621('0x26')](respondWithFilteredResult(_0x42664b,_0x19e0a6))['catch'](handleError(_0x42664b,null));};exports[_0xd621('0x43')]=function(_0x37fc2b,_0x4d79aa){var _0x541b9f={'raw':!![],'where':{'id':_0x37fc2b[_0xd621('0x44')]['id']}},_0x4e3665={};_0x4e3665[_0xd621('0x2f')]=_['keys'](db['MailTransferReport'][_0xd621('0x2d')]);_0x4e3665[_0xd621('0x30')]=_[_0xd621('0x31')](_0x37fc2b[_0xd621('0x30')]);_0x4e3665['filters']=_[_0xd621('0x33')](_0x4e3665[_0xd621('0x2f')],_0x4e3665[_0xd621('0x30')]);_0x541b9f[_0xd621('0x32')]=_['intersection'](_0x4e3665[_0xd621('0x2f')],qs[_0xd621('0x34')](_0x37fc2b[_0xd621('0x30')]['fields']));_0x541b9f[_0xd621('0x32')]=_0x541b9f[_0xd621('0x32')][_0xd621('0x35')]?_0x541b9f['attributes']:_0x4e3665['model'];if(_0x37fc2b[_0xd621('0x30')][_0xd621('0x40')]){_0x541b9f[_0xd621('0x41')]=[{'all':!![]}];}_0x541b9f=_[_0xd621('0x3c')]({},_0x541b9f,_0x37fc2b[_0xd621('0x45')]);return db['MailTransferReport']['find'](_0x541b9f)[_0xd621('0x26')](handleEntityNotFound(_0x4d79aa,null))[_0xd621('0x26')](respondWithResult(_0x4d79aa,null))['catch'](handleError(_0x4d79aa,null));};exports[_0xd621('0x46')]=function(_0x3092c0,_0x7e3f50){return db['MailTransferReport']['create'](_0x3092c0[_0xd621('0x47')],{})[_0xd621('0x26')](respondWithResult(_0x7e3f50,0xc9))[_0xd621('0x48')](handleError(_0x7e3f50,null));};exports[_0xd621('0x25')]=function(_0x562f5f,_0x4737e0){if(_0x562f5f[_0xd621('0x47')]['id']){delete _0x562f5f[_0xd621('0x47')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x562f5f[_0xd621('0x44')]['id']}})['then'](handleEntityNotFound(_0x4737e0,null))['then'](saveUpdates(_0x562f5f[_0xd621('0x47')],null))[_0xd621('0x26')](respondWithResult(_0x4737e0,null))[_0xd621('0x48')](handleError(_0x4737e0,null));};exports['destroy']=function(_0x3b941b,_0x35746f){return db[_0xd621('0x2c')][_0xd621('0x49')]({'where':{'id':_0x3b941b[_0xd621('0x44')]['id']}})[_0xd621('0x26')](handleEntityNotFound(_0x35746f,null))[_0xd621('0x26')](removeEntity(_0x35746f,null))[_0xd621('0x48')](handleError(_0x35746f,null));};exports[_0xd621('0x4a')]=function(_0x1f77dc,_0x3d264a){return db[_0xd621('0x2c')][_0xd621('0x4a')]()[_0xd621('0x26')](respondWithResult(_0x3d264a,null))[_0xd621('0x48')](handleError(_0x3d264a,null));}; \ No newline at end of file +var _0xc886=['api','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x38d887,_0x261d68){var _0x84c717=function(_0x4c5a40){while(--_0x4c5a40){_0x38d887['push'](_0x38d887['shift']());}};_0x84c717(++_0x261d68);}(_0xc886,0x16b));var _0x6c88=function(_0x455ae2,_0x3dd6e7){_0x455ae2=_0x455ae2-0x0;var _0x2f8754=_0xc886[_0x455ae2];return _0x2f8754;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c88('0x0'));var zipdir=require(_0x6c88('0x1'));var jsonpatch=require(_0x6c88('0x2'));var rp=require(_0x6c88('0x3'));var moment=require(_0x6c88('0x4'));var BPromise=require(_0x6c88('0x5'));var Mustache=require(_0x6c88('0x6'));var util=require(_0x6c88('0x7'));var path=require(_0x6c88('0x8'));var sox=require(_0x6c88('0x9'));var csv=require(_0x6c88('0xa'));var ejs=require(_0x6c88('0xb'));var fs=require('fs');var fs_extra=require(_0x6c88('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c88('0xd'));var jsforce=require(_0x6c88('0xe'));var deskjs=require(_0x6c88('0xf'));var toCsv=require(_0x6c88('0xa'));var querystring=require(_0x6c88('0x10'));var Papa=require(_0x6c88('0x11'));var Redis=require('ioredis');var authService=require(_0x6c88('0x12'));var qs=require(_0x6c88('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c88('0x14'));var logger=require(_0x6c88('0x15'))(_0x6c88('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6c88('0x17'))['db'];function respondWithStatusCode(_0x341551,_0x3fe190){_0x3fe190=_0x3fe190||0xcc;return function(_0x389281){if(_0x389281){return _0x341551['sendStatus'](_0x3fe190);}return _0x341551['status'](_0x3fe190)[_0x6c88('0x18')]();};}function respondWithResult(_0x1e489f,_0x376249){_0x376249=_0x376249||0xc8;return function(_0x251d0e){if(_0x251d0e){return _0x1e489f[_0x6c88('0x19')](_0x376249)[_0x6c88('0x1a')](_0x251d0e);}};}function respondWithFilteredResult(_0x227746,_0x57625d){return function(_0x34bed0){if(_0x34bed0){var _0x3fcbe4=typeof _0x57625d[_0x6c88('0x1b')]===_0x6c88('0x1c')&&typeof _0x57625d[_0x6c88('0x1d')]===_0x6c88('0x1c');var _0x3f3ec1=_0x34bed0[_0x6c88('0x1e')];var _0x1e5792=_0x3fcbe4?0x0:_0x57625d[_0x6c88('0x1b')];var _0x467695=_0x3fcbe4?_0x34bed0[_0x6c88('0x1e')]:_0x57625d[_0x6c88('0x1b')]+_0x57625d[_0x6c88('0x1d')];var _0x453ac3;if(_0x467695>=_0x3f3ec1){_0x467695=_0x3f3ec1;_0x453ac3=0xc8;}else{_0x453ac3=0xce;}_0x227746['status'](_0x453ac3);return _0x227746[_0x6c88('0x1f')](_0x6c88('0x20'),_0x1e5792+'-'+_0x467695+'/'+_0x3f3ec1)['json'](_0x34bed0);}return null;};}function patchUpdates(_0x29aa70){return function(_0x2d6908){try{jsonpatch[_0x6c88('0x21')](_0x2d6908,_0x29aa70,!![]);}catch(_0x596ddf){return BPromise[_0x6c88('0x22')](_0x596ddf);}return _0x2d6908[_0x6c88('0x23')]();};}function saveUpdates(_0x5e51d7,_0x3c1019){return function(_0x3b0690){if(_0x3b0690){return _0x3b0690[_0x6c88('0x24')](_0x5e51d7)[_0x6c88('0x25')](function(_0x577ae1){return _0x577ae1;});}return null;};}function removeEntity(_0x29513f,_0x407d88){return function(_0x3fa0da){if(_0x3fa0da){return _0x3fa0da[_0x6c88('0x26')]()[_0x6c88('0x25')](function(){_0x29513f[_0x6c88('0x19')](0xcc)[_0x6c88('0x18')]();});}};}function handleEntityNotFound(_0x37b80d,_0x1b78c2){return function(_0x4cb69a){if(!_0x4cb69a){_0x37b80d[_0x6c88('0x27')](0x194);}return _0x4cb69a;};}function handleError(_0x573380,_0x2d2983){_0x2d2983=_0x2d2983||0x1f4;return function(_0x23934d){logger['error'](_0x23934d[_0x6c88('0x28')]);if(_0x23934d[_0x6c88('0x29')]){delete _0x23934d[_0x6c88('0x29')];}_0x573380['status'](_0x2d2983)['send'](_0x23934d);};}exports[_0x6c88('0x2a')]=function(_0x1f84a4,_0x34b4c7){var _0x26230d={},_0xc3376a={},_0x53df9b={'count':0x0,'rows':[]};var _0x550c1c=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x553640){return{'name':_0x553640[_0x6c88('0x2b')],'type':_0x553640['type'][_0x6c88('0x2c')]};});_0xc3376a['model']=_[_0x6c88('0x2d')](_0x550c1c,_0x6c88('0x29'));_0xc3376a[_0x6c88('0x2e')]=_[_0x6c88('0x2f')](_0x1f84a4[_0x6c88('0x2e')]);_0xc3376a[_0x6c88('0x30')]=_[_0x6c88('0x31')](_0xc3376a[_0x6c88('0x32')],_0xc3376a[_0x6c88('0x2e')]);_0x26230d[_0x6c88('0x33')]=_[_0x6c88('0x31')](_0xc3376a[_0x6c88('0x32')],qs[_0x6c88('0x34')](_0x1f84a4[_0x6c88('0x2e')][_0x6c88('0x34')]));_0x26230d[_0x6c88('0x33')]=_0x26230d[_0x6c88('0x33')][_0x6c88('0x35')]?_0x26230d['attributes']:_0xc3376a['model'];if(!_0x1f84a4[_0x6c88('0x2e')]['hasOwnProperty'](_0x6c88('0x36'))){_0x26230d[_0x6c88('0x1d')]=qs['limit'](_0x1f84a4['query']['limit']);_0x26230d[_0x6c88('0x1b')]=qs[_0x6c88('0x1b')](_0x1f84a4['query'][_0x6c88('0x1b')]);}_0x26230d[_0x6c88('0x37')]=qs[_0x6c88('0x38')](_0x1f84a4[_0x6c88('0x2e')][_0x6c88('0x38')]);_0x26230d[_0x6c88('0x39')]=qs['filters'](_[_0x6c88('0x3a')](_0x1f84a4[_0x6c88('0x2e')],_0xc3376a[_0x6c88('0x30')]),_0x550c1c);if(_0x1f84a4[_0x6c88('0x2e')][_0x6c88('0x3b')]){_0x26230d[_0x6c88('0x39')]=_[_0x6c88('0x3c')](_0x26230d['where'],{'$or':_[_0x6c88('0x2d')](_0x550c1c,function(_0x3b261a){if(_0x3b261a[_0x6c88('0x3d')]!==_0x6c88('0x3e')){var _0x578bbe={};_0x578bbe[_0x3b261a[_0x6c88('0x29')]]={'$like':'%'+_0x1f84a4[_0x6c88('0x2e')]['filter']+'%'};return _0x578bbe;}})});}_0x26230d=_[_0x6c88('0x3c')]({},_0x26230d,_0x1f84a4[_0x6c88('0x3f')]);var _0xb75645={'where':_0x26230d[_0x6c88('0x39')]};return db[_0x6c88('0x40')][_0x6c88('0x1e')](_0xb75645)[_0x6c88('0x25')](function(_0x1fd7b6){_0x53df9b[_0x6c88('0x1e')]=_0x1fd7b6;if(_0x1f84a4[_0x6c88('0x2e')][_0x6c88('0x41')]){_0x26230d[_0x6c88('0x42')]=[{'all':!![]}];}return db['MailTransferReport'][_0x6c88('0x43')](_0x26230d);})[_0x6c88('0x25')](function(_0x1feb67){_0x53df9b[_0x6c88('0x44')]=_0x1feb67;return _0x53df9b;})[_0x6c88('0x25')](respondWithFilteredResult(_0x34b4c7,_0x26230d))[_0x6c88('0x45')](handleError(_0x34b4c7,null));};exports[_0x6c88('0x46')]=function(_0x3ad24b,_0x54a674){var _0x5f3dd1={'raw':!![],'where':{'id':_0x3ad24b[_0x6c88('0x47')]['id']}},_0x373807={};_0x373807[_0x6c88('0x32')]=_[_0x6c88('0x2f')](db['MailTransferReport'][_0x6c88('0x48')]);_0x373807['query']=_[_0x6c88('0x2f')](_0x3ad24b[_0x6c88('0x2e')]);_0x373807[_0x6c88('0x30')]=_[_0x6c88('0x31')](_0x373807['model'],_0x373807['query']);_0x5f3dd1['attributes']=_['intersection'](_0x373807[_0x6c88('0x32')],qs[_0x6c88('0x34')](_0x3ad24b[_0x6c88('0x2e')][_0x6c88('0x34')]));_0x5f3dd1[_0x6c88('0x33')]=_0x5f3dd1[_0x6c88('0x33')][_0x6c88('0x35')]?_0x5f3dd1[_0x6c88('0x33')]:_0x373807[_0x6c88('0x32')];if(_0x3ad24b['query'][_0x6c88('0x41')]){_0x5f3dd1[_0x6c88('0x42')]=[{'all':!![]}];}_0x5f3dd1=_[_0x6c88('0x3c')]({},_0x5f3dd1,_0x3ad24b[_0x6c88('0x3f')]);return db[_0x6c88('0x40')]['find'](_0x5f3dd1)[_0x6c88('0x25')](handleEntityNotFound(_0x54a674,null))[_0x6c88('0x25')](respondWithResult(_0x54a674,null))[_0x6c88('0x45')](handleError(_0x54a674,null));};exports[_0x6c88('0x49')]=function(_0x205c5a,_0x52cd3e){return db[_0x6c88('0x40')]['create'](_0x205c5a['body'],{})[_0x6c88('0x25')](respondWithResult(_0x52cd3e,0xc9))[_0x6c88('0x45')](handleError(_0x52cd3e,null));};exports[_0x6c88('0x24')]=function(_0x18d74b,_0x22c5df){if(_0x18d74b[_0x6c88('0x4a')]['id']){delete _0x18d74b[_0x6c88('0x4a')]['id'];}return db[_0x6c88('0x40')][_0x6c88('0x4b')]({'where':{'id':_0x18d74b[_0x6c88('0x47')]['id']}})[_0x6c88('0x25')](handleEntityNotFound(_0x22c5df,null))['then'](saveUpdates(_0x18d74b['body'],null))[_0x6c88('0x25')](respondWithResult(_0x22c5df,null))[_0x6c88('0x45')](handleError(_0x22c5df,null));};exports['destroy']=function(_0x4c0afa,_0x4ac5b0){return db[_0x6c88('0x40')][_0x6c88('0x4b')]({'where':{'id':_0x4c0afa['params']['id']}})[_0x6c88('0x25')](handleEntityNotFound(_0x4ac5b0,null))[_0x6c88('0x25')](removeEntity(_0x4ac5b0,null))['catch'](handleError(_0x4ac5b0,null));};exports[_0x6c88('0x4c')]=function(_0x174e10,_0x1ff77f){return db[_0x6c88('0x40')][_0x6c88('0x4c')]()[_0x6c88('0x25')](respondWithResult(_0x1ff77f,null))[_0x6c88('0x45')](handleError(_0x1ff77f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8700350..b78ef89 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 _0xc746=['request-promise','../../config/environment','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x124695,_0x300019){var _0x298915=function(_0xfb952e){while(--_0xfb952e){_0x124695['push'](_0x124695['shift']());}};_0x298915(++_0x300019);}(_0xc746,0xc9));var _0x6c74=function(_0x536e1e,_0x23d7a4){_0x536e1e=_0x536e1e-0x0;var _0x4b7ca3=_0xc746[_0x536e1e];return _0x4b7ca3;};'use strict';var _=require(_0x6c74('0x0'));var util=require(_0x6c74('0x1'));var logger=require(_0x6c74('0x2'))(_0x6c74('0x3'));var moment=require(_0x6c74('0x4'));var BPromise=require(_0x6c74('0x5'));var rp=require(_0x6c74('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6c74('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x2fb882,_0x412f92){return _0x2fb882['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x6c74('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x446c=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x446c,0x156));var _0xc446=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x446c[_0x47623f];return _0x282ce8;};'use strict';var _=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var logger=require(_0xc446('0x2'))(_0xc446('0x3'));var moment=require('moment');var BPromise=require(_0xc446('0x4'));var rp=require(_0xc446('0x5'));var fs=require('fs');var path=require(_0xc446('0x6'));var rimraf=require('rimraf');var config=require(_0xc446('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x115a9e,_0x235050){return _0x115a9e['define']('MailTransferReport',attributes,{'tableName':_0xc446('0x8'),'paranoid':![],'indexes':[{'name':_0xc446('0x9'),'fields':[_0xc446('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 53e2554..0bdd623 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 _0x7ee2=['stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1f3908,_0x3c164d){var _0x3ecd70=function(_0x331797){while(--_0x331797){_0x1f3908['push'](_0x1f3908['shift']());}};_0x3ecd70(++_0x3c164d);}(_0x7ee2,0x74));var _0x27ee=function(_0x539dae,_0x1fcf2f){_0x539dae=_0x539dae-0x0;var _0x5f3b18=_0x7ee2[_0x539dae];return _0x5f3b18;};'use strict';var _=require(_0x27ee('0x0'));var util=require('util');var moment=require(_0x27ee('0x1'));var BPromise=require(_0x27ee('0x2'));var rs=require(_0x27ee('0x3'));var fs=require('fs');var Redis=require(_0x27ee('0x4'));var db=require(_0x27ee('0x5'))['db'];var utils=require(_0x27ee('0x6'));var logger=require(_0x27ee('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x27ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fc259,_0x21038a,_0x5aa18c){return new BPromise(function(_0x288175,_0x3fa415){return client[_0x27ee('0x9')](_0x3fc259,_0x5aa18c)[_0x27ee('0xa')](function(_0x40a684){logger[_0x27ee('0xb')](_0x27ee('0xc'),_0x21038a,_0x27ee('0xd'));logger[_0x27ee('0xe')](_0x27ee('0xf'),_0x21038a,_0x27ee('0xd'),JSON[_0x27ee('0x10')](_0x40a684));if(_0x40a684['error']){if(_0x40a684['error'][_0x27ee('0x11')]===0x1f4){logger[_0x27ee('0x12')](_0x27ee('0xc'),_0x21038a,_0x40a684['error'][_0x27ee('0x13')]);return _0x3fa415(_0x40a684[_0x27ee('0x12')][_0x27ee('0x13')]);}logger[_0x27ee('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x21038a,_0x40a684['error'][_0x27ee('0x13')]);return _0x288175(_0x40a684[_0x27ee('0x12')][_0x27ee('0x13')]);}else{logger[_0x27ee('0xb')](_0x27ee('0xc'),_0x21038a,'request\x20sent');_0x288175(_0x40a684[_0x27ee('0x14')][_0x27ee('0x13')]);}})[_0x27ee('0x15')](function(_0x393301){logger[_0x27ee('0x12')](_0x27ee('0xc'),_0x21038a,_0x393301);_0x3fa415(_0x393301);});});} \ No newline at end of file +var _0xa3f0=['rpc','../../config/environment','jayson/promise','client','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x258037,_0x4f3987){var _0x5bd045=function(_0x1e1333){while(--_0x1e1333){_0x258037['push'](_0x258037['shift']());}};_0x5bd045(++_0x4f3987);}(_0xa3f0,0xb6));var _0x0a3f=function(_0x3a8697,_0x4e39e8){_0x3a8697=_0x3a8697-0x0;var _0xa4c873=_0xa3f0[_0x3a8697];return _0xa4c873;};'use strict';var _=require(_0x0a3f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0a3f('0x1'));var rs=require(_0x0a3f('0x2'));var fs=require('fs');var Redis=require(_0x0a3f('0x3'));var db=require(_0x0a3f('0x4'))['db'];var utils=require(_0x0a3f('0x5'));var logger=require(_0x0a3f('0x6'))(_0x0a3f('0x7'));var config=require(_0x0a3f('0x8'));var jayson=require(_0x0a3f('0x9'));var client=jayson[_0x0a3f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5043b0,_0x41be12,_0x31dcdf){return new BPromise(function(_0x530145,_0x5a9245){return client['request'](_0x5043b0,_0x31dcdf)[_0x0a3f('0xb')](function(_0x2596da){logger['info'](_0x0a3f('0xc'),_0x41be12,'request\x20sent');logger[_0x0a3f('0xd')](_0x0a3f('0xe'),_0x41be12,_0x0a3f('0xf'),JSON['stringify'](_0x2596da));if(_0x2596da[_0x0a3f('0x10')]){if(_0x2596da[_0x0a3f('0x10')][_0x0a3f('0x11')]===0x1f4){logger[_0x0a3f('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x41be12,_0x2596da[_0x0a3f('0x10')][_0x0a3f('0x12')]);return _0x5a9245(_0x2596da['error'][_0x0a3f('0x12')]);}logger[_0x0a3f('0x10')](_0x0a3f('0xc'),_0x41be12,_0x2596da[_0x0a3f('0x10')][_0x0a3f('0x12')]);return _0x530145(_0x2596da[_0x0a3f('0x10')][_0x0a3f('0x12')]);}else{logger[_0x0a3f('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x41be12,_0x0a3f('0xf'));_0x530145(_0x2596da[_0x0a3f('0x14')]['message']);}})['catch'](function(_0x250389){logger['error'](_0x0a3f('0xc'),_0x41be12,_0x250389);_0x5a9245(_0x250389);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c0623f0..34d6a75 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 _0x33b5=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','create','put','update'];(function(_0x24bb1d,_0x193893){var _0x30e6f7=function(_0x4102da){while(--_0x4102da){_0x24bb1d['push'](_0x24bb1d['shift']());}};_0x30e6f7(++_0x193893);}(_0x33b5,0x16a));var _0x533b=function(_0xfded01,_0x20fc6b){_0xfded01=_0xfded01-0x0;var _0x28312c=_0x33b5[_0xfded01];return _0x28312c;};'use strict';var multer=require(_0x533b('0x0'));var util=require(_0x533b('0x1'));var path=require(_0x533b('0x2'));var timeout=require('connect-timeout');var express=require(_0x533b('0x3'));var router=express[_0x533b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x533b('0x5'));var interaction=require(_0x533b('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x533b('0x7')]('/',auth[_0x533b('0x8')](),controller[_0x533b('0x9')]);router[_0x533b('0x7')](_0x533b('0xa'),auth[_0x533b('0x8')](),controller[_0x533b('0xb')]);router[_0x533b('0x7')](_0x533b('0xc'),auth[_0x533b('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x533b('0xd')]);router[_0x533b('0xe')]('/:id',auth[_0x533b('0x8')](),controller[_0x533b('0xf')]);router['delete'](_0x533b('0xc'),auth['isAuthenticated'](),controller[_0x533b('0x10')]);module[_0x533b('0x11')]=router; \ No newline at end of file +var _0x071c=['index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','isAuthenticated'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x071c,0x13d));var _0xc071=function(_0x5dfd91,_0x52d7a4){_0x5dfd91=_0x5dfd91-0x0;var _0x49410d=_0x071c[_0x5dfd91];return _0x49410d;};'use strict';var multer=require(_0xc071('0x0'));var util=require('util');var path=require(_0xc071('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc071('0x2')]();var fs_extra=require(_0xc071('0x3'));var auth=require(_0xc071('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0xc071('0x5')](),controller[_0xc071('0x6')]);router[_0xc071('0x7')](_0xc071('0x8'),auth['isAuthenticated'](),controller[_0xc071('0x9')]);router[_0xc071('0x7')](_0xc071('0xa'),auth[_0xc071('0x5')](),controller[_0xc071('0xb')]);router[_0xc071('0xc')]('/',auth[_0xc071('0x5')](),controller[_0xc071('0xd')]);router[_0xc071('0xe')](_0xc071('0xa'),auth['isAuthenticated'](),controller[_0xc071('0xf')]);router[_0xc071('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc071('0x11')]);module[_0xc071('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 3debda9..3265b62 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 _0x3e86=['DATE','getDataValue','seconds','setDataValue','exitAt','talk:[start]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x279eef,_0x2f56ce){var _0x44f487=function(_0xe6210c){while(--_0xe6210c){_0x279eef['push'](_0x279eef['shift']());}};_0x44f487(++_0x2f56ce);}(_0x3e86,0x159));var _0x63e8=function(_0x1781a3,_0x306745){_0x1781a3=_0x1781a3-0x0;var _0x14944e=_0x3e86[_0x1781a3];return _0x14944e;};'use strict';var Sequelize=require(_0x63e8('0x0'));var moment=require(_0x63e8('0x1'));module[_0x63e8('0x2')]={'channel':{'type':Sequelize[_0x63e8('0x3')]},'membername':{'type':Sequelize[_0x63e8('0x3')]},'interface':{'type':Sequelize[_0x63e8('0x3')]},'type':{'type':Sequelize[_0x63e8('0x3')],'defaultValue':_0x63e8('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x63e8('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x350727){var _0x5f3e38=moment(_0x350727);var _0x5628f6=moment(this[_0x63e8('0x6')]('enterAt'));var _0x52aabe=_0x5f3e38['diff'](_0x5628f6,_0x63e8('0x7'));this[_0x63e8('0x8')](_0x63e8('0x9'),_0x350727);this[_0x63e8('0x8')]('duration',_0x52aabe>=0x0?_0x52aabe:null);}},'data1':{'type':Sequelize[_0x63e8('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x63e8('0x3')],'comment':_0x63e8('0xa')},'data3':{'type':Sequelize[_0x63e8('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x63e8('0x3')],'comment':_0x63e8('0xb')},'data5':{'type':Sequelize[_0x63e8('0x3')],'comment':_0x63e8('0xc')},'role':{'type':Sequelize[_0x63e8('0x3')]},'internal':{'type':Sequelize[_0x63e8('0xd')]},'uniqueid':{'type':Sequelize[_0x63e8('0x3')]}}; \ No newline at end of file +var _0x1ebe=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1ebe,0x1ad));var _0xe1eb=function(_0x15e2c3,_0x4670e7){_0x15e2c3=_0x15e2c3-0x0;var _0x4f0877=_0x1ebe[_0x15e2c3];return _0x4f0877;};'use strict';var Sequelize=require(_0xe1eb('0x0'));var moment=require('moment');module[_0xe1eb('0x1')]={'channel':{'type':Sequelize[_0xe1eb('0x2')]},'membername':{'type':Sequelize[_0xe1eb('0x2')]},'interface':{'type':Sequelize[_0xe1eb('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xe1eb('0x3')},'duration':{'type':Sequelize[_0xe1eb('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe1eb('0x5')],'set':function(_0x38bd3e){var _0x51f214=moment(_0x38bd3e);var _0x53e844=moment(this[_0xe1eb('0x6')](_0xe1eb('0x7')));var _0xa21196=_0x51f214['diff'](_0x53e844,_0xe1eb('0x8'));this['setDataValue']('exitAt',_0x38bd3e);this[_0xe1eb('0x9')](_0xe1eb('0xa'),_0xa21196>=0x0?_0xa21196:null);}},'data1':{'type':Sequelize[_0xe1eb('0x2')],'comment':_0xe1eb('0xb')},'data2':{'type':Sequelize[_0xe1eb('0x2')],'comment':_0xe1eb('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xe1eb('0xd')},'data4':{'type':Sequelize[_0xe1eb('0x2')],'comment':_0xe1eb('0xe')},'data5':{'type':Sequelize[_0xe1eb('0x2')],'comment':_0xe1eb('0xf')},'role':{'type':Sequelize[_0xe1eb('0x2')]},'internal':{'type':Sequelize[_0xe1eb('0x4')]},'uniqueid':{'type':Sequelize[_0xe1eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b5bca8c..03065a9 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xedd9,0xfc));var _0x9edd=function(_0x2a570e,_0x1e042a){_0x2a570e=_0x2a570e-0x0;var _0x5a166c=_0xedd9[_0x2a570e];return _0x5a166c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x55ca,0x126));var _0xa55c=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x55ca[_0x47fd36];return _0x21a0fc;};'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 75209e2..0a7db89 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 _0x0348=['api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','util'];(function(_0xb59fcc,_0x693426){var _0x3c7e69=function(_0x48f4c8){while(--_0x48f4c8){_0xb59fcc['push'](_0xb59fcc['shift']());}};_0x3c7e69(++_0x693426);}(_0x0348,0x1e9));var _0x8034=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x0348[_0x2ff4bd];return _0x28edc6;};'use strict';var _=require('lodash');var util=require(_0x8034('0x0'));var logger=require('../../config/logger')(_0x8034('0x1'));var moment=require(_0x8034('0x2'));var BPromise=require('bluebird');var rp=require(_0x8034('0x3'));var fs=require('fs');var path=require(_0x8034('0x4'));var rimraf=require(_0x8034('0x5'));var config=require(_0x8034('0x6'));var attributes=require(_0x8034('0x7'));module[_0x8034('0x8')]=function(_0x32e7e6,_0x2e1798){return _0x32e7e6['define'](_0x8034('0x9'),attributes,{'tableName':_0x8034('0xa'),'paranoid':![],'indexes':[{'name':_0x8034('0xb'),'fields':[_0x8034('0xc'),_0x8034('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8193=['MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x6f2598,_0x5d6cff){var _0x798b3f=function(_0x1fb37e){while(--_0x1fb37e){_0x6f2598['push'](_0x6f2598['shift']());}};_0x798b3f(++_0x5d6cff);}(_0x8193,0x135));var _0x3819=function(_0x5c586b,_0x5b8b3b){_0x5c586b=_0x5c586b-0x0;var _0x518867=_0x8193[_0x5c586b];return _0x518867;};'use strict';var _=require(_0x3819('0x0'));var util=require(_0x3819('0x1'));var logger=require(_0x3819('0x2'))(_0x3819('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3819('0x4'));var fs=require('fs');var path=require(_0x3819('0x5'));var rimraf=require(_0x3819('0x6'));var config=require(_0x3819('0x7'));var attributes=require(_0x3819('0x8'));module[_0x3819('0x9')]=function(_0x5566e7,_0x38ef1a){return _0x5566e7[_0x3819('0xa')](_0x3819('0xb'),attributes,{'tableName':_0x3819('0xc'),'paranoid':![],'indexes':[{'name':_0x3819('0xd'),'fields':[_0x3819('0xe'),_0x3819('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index dba3dd6..381f5f2 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 _0x885a=['body','stringify','UpdateMemberReport','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MemberReport','options','raw','where','attributes','include','map','model','then','GetMemberReport','CreateMemberReport','create'];(function(_0x6e2d64,_0x5bf0fc){var _0x36c4e6=function(_0x233431){while(--_0x233431){_0x6e2d64['push'](_0x6e2d64['shift']());}};_0x36c4e6(++_0x5bf0fc);}(_0x885a,0x180));var _0xa885=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x885a[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var moment=require(_0xa885('0x1'));var BPromise=require(_0xa885('0x2'));var rs=require(_0xa885('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa885('0x4'))['db'];var utils=require(_0xa885('0x5'));var logger=require(_0xa885('0x6'))(_0xa885('0x7'));var config=require(_0xa885('0x8'));var jayson=require(_0xa885('0x9'));var client=jayson['client'][_0xa885('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1200c7,_0x31fd77,_0x546175){return new BPromise(function(_0x6b26e2,_0x2b7916){return client[_0xa885('0xb')](_0x1200c7,_0x546175)['then'](function(_0x2305b1){logger[_0xa885('0xc')](_0xa885('0xd'),_0x31fd77,_0xa885('0xe'));logger[_0xa885('0xf')](_0xa885('0x10'),_0x31fd77,_0xa885('0xe'),JSON['stringify'](_0x2305b1));if(_0x2305b1[_0xa885('0x11')]){if(_0x2305b1[_0xa885('0x11')][_0xa885('0x12')]===0x1f4){logger[_0xa885('0x11')](_0xa885('0xd'),_0x31fd77,_0x2305b1[_0xa885('0x11')][_0xa885('0x13')]);return _0x2b7916(_0x2305b1['error'][_0xa885('0x13')]);}logger[_0xa885('0x11')](_0xa885('0xd'),_0x31fd77,_0x2305b1[_0xa885('0x11')][_0xa885('0x13')]);return _0x6b26e2(_0x2305b1['error'][_0xa885('0x13')]);}else{logger[_0xa885('0xc')]('MemberReport,\x20%s,\x20%s',_0x31fd77,_0xa885('0xe'));_0x6b26e2(_0x2305b1[_0xa885('0x14')]['message']);}})[_0xa885('0x15')](function(_0x41b3de){logger['error'](_0xa885('0xd'),_0x31fd77,_0x41b3de);_0x2b7916(_0x41b3de);});});}exports['GetMemberReport']=function(_0x2e9290){var _0x3960ea=this;return new Promise(function(_0x8c26c,_0x4e4d51){return db[_0xa885('0x16')]['findAll']({'raw':_0x2e9290[_0xa885('0x17')]?_0x2e9290[_0xa885('0x17')][_0xa885('0x18')]===undefined?!![]:![]:!![],'where':_0x2e9290['options']?_0x2e9290[_0xa885('0x17')][_0xa885('0x19')]||null:null,'attributes':_0x2e9290[_0xa885('0x17')]?_0x2e9290['options'][_0xa885('0x1a')]||null:null,'limit':_0x2e9290[_0xa885('0x17')]?_0x2e9290[_0xa885('0x17')]['limit']||null:null,'include':_0x2e9290[_0xa885('0x17')]?_0x2e9290['options'][_0xa885('0x1b')]?_[_0xa885('0x1c')](_0x2e9290['options'][_0xa885('0x1b')],function(_0x190a57){return{'model':db[_0x190a57[_0xa885('0x1d')]],'as':_0x190a57['as'],'attributes':_0x190a57['attributes'],'include':_0x190a57[_0xa885('0x1b')]?_[_0xa885('0x1c')](_0x190a57['include'],function(_0x39ae58){return{'model':db[_0x39ae58['model']],'as':_0x39ae58['as'],'attributes':_0x39ae58[_0xa885('0x1a')],'include':_0x39ae58['include']?_[_0xa885('0x1c')](_0x39ae58[_0xa885('0x1b')],function(_0x3e347e){return{'model':db[_0x3e347e[_0xa885('0x1d')]],'as':_0x3e347e['as'],'attributes':_0x3e347e[_0xa885('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa885('0x1e')](function(_0x1e13d5){logger[_0xa885('0xc')]('GetMemberReport',_0x2e9290);logger['debug']('GetMemberReport',_0x2e9290,JSON['stringify'](_0x1e13d5));_0x8c26c(_0x1e13d5);})[_0xa885('0x15')](function(_0x3e9e22){logger[_0xa885('0x11')](_0xa885('0x1f'),_0x3e9e22[_0xa885('0x13')],_0x2e9290);_0x4e4d51(_0x3960ea[_0xa885('0x11')](0x1f4,_0x3e9e22['message']));});});};exports[_0xa885('0x20')]=function(_0x47d01c){var _0x1318ef=this;return new Promise(function(_0x4a1e54,_0x39990f){return db['MemberReport'][_0xa885('0x21')](_0x47d01c[_0xa885('0x22')],{'raw':_0x47d01c[_0xa885('0x17')]?_0x47d01c['options'][_0xa885('0x18')]===undefined?!![]:![]:!![]})[_0xa885('0x1e')](function(_0x5ed672){logger[_0xa885('0xc')]('CreateMemberReport',_0x47d01c);logger[_0xa885('0xf')](_0xa885('0x20'),_0x47d01c,JSON[_0xa885('0x23')](_0x5ed672));_0x4a1e54(_0x5ed672);})['catch'](function(_0xf34189){logger[_0xa885('0x11')](_0xa885('0x20'),_0xf34189['message'],_0x47d01c);_0x39990f(_0x1318ef[_0xa885('0x11')](0x1f4,_0xf34189[_0xa885('0x13')]));});});};exports[_0xa885('0x24')]=function(_0xd7c964){var _0x3995f0=this;return new Promise(function(_0x209758,_0x2a00d4){return db[_0xa885('0x16')]['update'](_0xd7c964['body'],{'raw':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x19')]||null:null,'attributes':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x1a')]||null:null,'limit':_0xd7c964['options']?_0xd7c964['options'][_0xa885('0x25')]||null:null})['then'](function(_0x502a96){logger[_0xa885('0xc')]('UpdateMemberReport',_0xd7c964);logger[_0xa885('0xf')](_0xa885('0x24'),_0xd7c964,JSON[_0xa885('0x23')](_0x502a96));_0x209758(_0x502a96);})[_0xa885('0x15')](function(_0x2d433e){logger[_0xa885('0x11')](_0xa885('0x24'),_0x2d433e[_0xa885('0x13')],_0xd7c964);_0x2a00d4(_0x3995f0[_0xa885('0x11')](0x1f4,_0x2d433e[_0xa885('0x13')]));});});}; \ No newline at end of file +var _0x6075=['map','model','debug','CreateMemberReport','create','raw','stringify','UpdateMemberReport','update','body','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','GetMemberReport','findAll','options','where','attributes','limit','include'];(function(_0x4663cf,_0x4045b2){var _0x5e7f76=function(_0x1e01ae){while(--_0x1e01ae){_0x4663cf['push'](_0x4663cf['shift']());}};_0x5e7f76(++_0x4045b2);}(_0x6075,0x191));var _0x5607=function(_0x1d7597,_0xf0dd8){_0x1d7597=_0x1d7597-0x0;var _0x9d029f=_0x6075[_0x1d7597];return _0x9d029f;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var moment=require(_0x5607('0x1'));var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require(_0x5607('0x4'));var db=require(_0x5607('0x5'))['db'];var utils=require(_0x5607('0x6'));var logger=require(_0x5607('0x7'))(_0x5607('0x8'));var config=require('../../config/environment');var jayson=require(_0x5607('0x9'));var client=jayson[_0x5607('0xa')][_0x5607('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab18d,_0x53f825,_0x3dc860){return new BPromise(function(_0x25107d,_0x24d9da){return client[_0x5607('0xc')](_0x5ab18d,_0x3dc860)[_0x5607('0xd')](function(_0x4f61bf){logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,_0x5607('0x10'));logger['debug'](_0x5607('0x11'),_0x53f825,'request\x20sent',JSON['stringify'](_0x4f61bf));if(_0x4f61bf[_0x5607('0x12')]){if(_0x4f61bf[_0x5607('0x12')][_0x5607('0x13')]===0x1f4){logger['error'](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x24d9da(_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);}logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x25107d(_0x4f61bf['error'][_0x5607('0x14')]);}else{logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,'request\x20sent');_0x25107d(_0x4f61bf['result'][_0x5607('0x14')]);}})['catch'](function(_0x38ab1c){logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x38ab1c);_0x24d9da(_0x38ab1c);});});}exports[_0x5607('0x15')]=function(_0x3eaaa0){var _0x16a8d9=this;return new Promise(function(_0x55689e,_0x40b0ee){return db['MemberReport'][_0x5607('0x16')]({'raw':_0x3eaaa0[_0x5607('0x17')]?_0x3eaaa0[_0x5607('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3eaaa0[_0x5607('0x17')]?_0x3eaaa0[_0x5607('0x17')][_0x5607('0x18')]||null:null,'attributes':_0x3eaaa0['options']?_0x3eaaa0[_0x5607('0x17')][_0x5607('0x19')]||null:null,'limit':_0x3eaaa0[_0x5607('0x17')]?_0x3eaaa0['options'][_0x5607('0x1a')]||null:null,'include':_0x3eaaa0['options']?_0x3eaaa0['options'][_0x5607('0x1b')]?_[_0x5607('0x1c')](_0x3eaaa0[_0x5607('0x17')][_0x5607('0x1b')],function(_0x351c32){return{'model':db[_0x351c32[_0x5607('0x1d')]],'as':_0x351c32['as'],'attributes':_0x351c32[_0x5607('0x19')],'include':_0x351c32[_0x5607('0x1b')]?_[_0x5607('0x1c')](_0x351c32[_0x5607('0x1b')],function(_0x593df7){return{'model':db[_0x593df7[_0x5607('0x1d')]],'as':_0x593df7['as'],'attributes':_0x593df7[_0x5607('0x19')],'include':_0x593df7['include']?_[_0x5607('0x1c')](_0x593df7[_0x5607('0x1b')],function(_0xdb07c8){return{'model':db[_0xdb07c8[_0x5607('0x1d')]],'as':_0xdb07c8['as'],'attributes':_0xdb07c8[_0x5607('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5607('0xd')](function(_0x4a9e32){logger[_0x5607('0xe')]('GetMemberReport',_0x3eaaa0);logger[_0x5607('0x1e')](_0x5607('0x15'),_0x3eaaa0,JSON['stringify'](_0x4a9e32));_0x55689e(_0x4a9e32);})['catch'](function(_0x12f58f){logger[_0x5607('0x12')](_0x5607('0x15'),_0x12f58f[_0x5607('0x14')],_0x3eaaa0);_0x40b0ee(_0x16a8d9[_0x5607('0x12')](0x1f4,_0x12f58f['message']));});});};exports[_0x5607('0x1f')]=function(_0x4bc522){var _0xd6c90a=this;return new Promise(function(_0x15a1a2,_0x2c90e3){return db['MemberReport'][_0x5607('0x20')](_0x4bc522['body'],{'raw':_0x4bc522[_0x5607('0x17')]?_0x4bc522[_0x5607('0x17')][_0x5607('0x21')]===undefined?!![]:![]:!![]})[_0x5607('0xd')](function(_0x31afed){logger['info'](_0x5607('0x1f'),_0x4bc522);logger['debug'](_0x5607('0x1f'),_0x4bc522,JSON[_0x5607('0x22')](_0x31afed));_0x15a1a2(_0x31afed);})['catch'](function(_0x335f90){logger[_0x5607('0x12')](_0x5607('0x1f'),_0x335f90['message'],_0x4bc522);_0x2c90e3(_0xd6c90a[_0x5607('0x12')](0x1f4,_0x335f90[_0x5607('0x14')]));});});};exports[_0x5607('0x23')]=function(_0x4ef3c3){var _0x5d55cf=this;return new Promise(function(_0x3478dc,_0x36bc31){return db['MemberReport'][_0x5607('0x24')](_0x4ef3c3[_0x5607('0x25')],{'raw':_0x4ef3c3[_0x5607('0x17')]?_0x4ef3c3['options'][_0x5607('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ef3c3['options']?_0x4ef3c3[_0x5607('0x17')][_0x5607('0x18')]||null:null,'attributes':_0x4ef3c3[_0x5607('0x17')]?_0x4ef3c3['options']['attributes']||null:null,'limit':_0x4ef3c3['options']?_0x4ef3c3[_0x5607('0x17')][_0x5607('0x1a')]||null:null})[_0x5607('0xd')](function(_0x273e71){logger[_0x5607('0xe')](_0x5607('0x23'),_0x4ef3c3);logger[_0x5607('0x1e')](_0x5607('0x23'),_0x4ef3c3,JSON['stringify'](_0x273e71));_0x3478dc(_0x273e71);})[_0x5607('0x26')](function(_0x261687){logger[_0x5607('0x12')](_0x5607('0x23'),_0x261687['message'],_0x4ef3c3);_0x36bc31(_0x5d55cf[_0x5607('0x12')](0x1f4,_0x261687[_0x5607('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0fff87f..333e4c2 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 _0xd8f6=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','util','path'];(function(_0x2cda29,_0xbd9b12){var _0x37d2d5=function(_0x297c69){while(--_0x297c69){_0x2cda29['push'](_0x2cda29['shift']());}};_0x37d2d5(++_0xbd9b12);}(_0xd8f6,0xf0));var _0x6d8f=function(_0x3a9557,_0xb61dec){_0x3a9557=_0x3a9557-0x0;var _0xccd1e9=_0xd8f6[_0x3a9557];return _0xccd1e9;};'use strict';var multer=require('multer');var util=require(_0x6d8f('0x0'));var path=require(_0x6d8f('0x1'));var timeout=require(_0x6d8f('0x2'));var express=require(_0x6d8f('0x3'));var router=express['Router']();var fs_extra=require(_0x6d8f('0x4'));var auth=require(_0x6d8f('0x5'));var interaction=require(_0x6d8f('0x6'));var config=require('../../config/environment');var controller=require(_0x6d8f('0x7'));router[_0x6d8f('0x8')]('/',controller[_0x6d8f('0x9')]);module[_0x6d8f('0xa')]=router; \ No newline at end of file +var _0x4db5=['fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','multer','util','connect-timeout','express','Router'];(function(_0x114345,_0x585f93){var _0x2d309c=function(_0x4114b1){while(--_0x4114b1){_0x114345['push'](_0x114345['shift']());}};_0x2d309c(++_0x585f93);}(_0x4db5,0xab));var _0x54db=function(_0x1147d6,_0x281869){_0x1147d6=_0x1147d6-0x0;var _0xe3a264=_0x4db5[_0x1147d6];return _0xe3a264;};'use strict';var multer=require(_0x54db('0x0'));var util=require(_0x54db('0x1'));var path=require('path');var timeout=require(_0x54db('0x2'));var express=require(_0x54db('0x3'));var router=express[_0x54db('0x4')]();var fs_extra=require(_0x54db('0x5'));var auth=require(_0x54db('0x6'));var interaction=require(_0x54db('0x7'));var config=require('../../config/environment');var controller=require(_0x54db('0x8'));router[_0x54db('0x9')]('/',controller[_0x54db('0xa')]);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 89e8e5d..bbb4e5e 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 _0x9767=['STRING','version','exports'];(function(_0xde1d00,_0x187948){var _0x54a79a=function(_0x378643){while(--_0x378643){_0xde1d00['push'](_0xde1d00['shift']());}};_0x54a79a(++_0x187948);}(_0x9767,0x191));var _0x7976=function(_0x5d9339,_0x29c424){_0x5d9339=_0x5d9339-0x0;var _0x579826=_0x9767[_0x5d9339];return _0x579826;};'use strict';var Sequelize=require('sequelize');module[_0x7976('0x0')]={'version':{'type':Sequelize[_0x7976('0x1')],'unique':_0x7976('0x2')}}; \ No newline at end of file +var _0x206d=['exports','sequelize'];(function(_0x3cce76,_0x5cc2ad){var _0x34f1ba=function(_0x4f62f4){while(--_0x4f62f4){_0x3cce76['push'](_0x3cce76['shift']());}};_0x34f1ba(++_0x5cc2ad);}(_0x206d,0x173));var _0xd206=function(_0x5a7ce5,_0x3db5a1){_0x5a7ce5=_0x5a7ce5-0x0;var _0x3b74c4=_0x206d[_0x5a7ce5];return _0x3b74c4;};'use strict';var Sequelize=require(_0xd206('0x0'));module[_0xd206('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 4d65bd8..a418e72 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 _0x2491=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Migration','include','rows','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0xa0ac05,_0x4a7da8){var _0x6ea8b4=function(_0x501c8d){while(--_0x501c8d){_0xa0ac05['push'](_0xa0ac05['shift']());}};_0x6ea8b4(++_0x4a7da8);}(_0x2491,0x1ca));var _0x1249=function(_0x54086b,_0x4154a2){_0x54086b=_0x54086b-0x0;var _0x395694=_0x2491[_0x54086b];return _0x395694;};'use strict';var emlformat=require(_0x1249('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1249('0x1'));var rp=require(_0x1249('0x2'));var moment=require(_0x1249('0x3'));var BPromise=require(_0x1249('0x4'));var Mustache=require(_0x1249('0x5'));var util=require(_0x1249('0x6'));var path=require(_0x1249('0x7'));var sox=require(_0x1249('0x8'));var csv=require(_0x1249('0x9'));var ejs=require(_0x1249('0xa'));var fs=require('fs');var fs_extra=require(_0x1249('0xb'));var _=require('lodash');var squel=require(_0x1249('0xc'));var crypto=require(_0x1249('0xd'));var jsforce=require(_0x1249('0xe'));var deskjs=require(_0x1249('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1249('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1249('0x11'));var qs=require(_0x1249('0x12'));var as=require(_0x1249('0x13'));var hardwareService=require(_0x1249('0x14'));var logger=require(_0x1249('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1249('0x16'));var licenseUtil=require(_0x1249('0x17'));var db=require(_0x1249('0x18'))['db'];function respondWithStatusCode(_0x1bde2b,_0x56f3ca){_0x56f3ca=_0x56f3ca||0xcc;return function(_0x54c4b8){if(_0x54c4b8){return _0x1bde2b[_0x1249('0x19')](_0x56f3ca);}return _0x1bde2b[_0x1249('0x1a')](_0x56f3ca)[_0x1249('0x1b')]();};}function respondWithResult(_0x107e65,_0x2f2766){_0x2f2766=_0x2f2766||0xc8;return function(_0x194871){if(_0x194871){return _0x107e65[_0x1249('0x1a')](_0x2f2766)[_0x1249('0x1c')](_0x194871);}};}function respondWithFilteredResult(_0x1fa86b,_0x503dee){return function(_0x53cab3){if(_0x53cab3){var _0x400c40=typeof _0x503dee['offset']===_0x1249('0x1d')&&typeof _0x503dee[_0x1249('0x1e')]===_0x1249('0x1d');var _0xd49acd=_0x53cab3[_0x1249('0x1f')];var _0x5158d1=_0x400c40?0x0:_0x503dee[_0x1249('0x20')];var _0x3ff1aa=_0x400c40?_0x53cab3[_0x1249('0x1f')]:_0x503dee[_0x1249('0x20')]+_0x503dee[_0x1249('0x1e')];var _0x17605f;if(_0x3ff1aa>=_0xd49acd){_0x3ff1aa=_0xd49acd;_0x17605f=0xc8;}else{_0x17605f=0xce;}_0x1fa86b[_0x1249('0x1a')](_0x17605f);return _0x1fa86b['set'](_0x1249('0x21'),_0x5158d1+'-'+_0x3ff1aa+'/'+_0xd49acd)['json'](_0x53cab3);}return null;};}function patchUpdates(_0x6d5e05){return function(_0x4b5f72){try{jsonpatch[_0x1249('0x22')](_0x4b5f72,_0x6d5e05,!![]);}catch(_0x57885a){return BPromise['reject'](_0x57885a);}return _0x4b5f72['save']();};}function saveUpdates(_0x50c8fe,_0x65eb53){return function(_0x5b4b40){if(_0x5b4b40){return _0x5b4b40[_0x1249('0x23')](_0x50c8fe)['then'](function(_0x47f97c){return _0x47f97c;});}return null;};}function removeEntity(_0x544b24,_0x18aae9){return function(_0x4d51eb){if(_0x4d51eb){return _0x4d51eb[_0x1249('0x24')]()[_0x1249('0x25')](function(){_0x544b24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x502fa9,_0x30ffe8){return function(_0x46e1d4){if(!_0x46e1d4){_0x502fa9['sendStatus'](0x194);}return _0x46e1d4;};}function handleError(_0x35083b,_0x1b3f93){_0x1b3f93=_0x1b3f93||0x1f4;return function(_0x579cbc){logger[_0x1249('0x26')](_0x579cbc[_0x1249('0x27')]);if(_0x579cbc[_0x1249('0x28')]){delete _0x579cbc['name'];}_0x35083b[_0x1249('0x1a')](_0x1b3f93)['send'](_0x579cbc);};}exports[_0x1249('0x29')]=function(_0x254dcb,_0x3000da){var _0x48cfff={},_0x51e933={},_0x5ac0b4={'count':0x0,'rows':[]};var _0x3fda98=_[_0x1249('0x2a')](db['Migration'][_0x1249('0x2b')],function(_0xd9f2d0){return{'name':_0xd9f2d0[_0x1249('0x2c')],'type':_0xd9f2d0[_0x1249('0x2d')][_0x1249('0x2e')]};});_0x51e933[_0x1249('0x2f')]=_[_0x1249('0x2a')](_0x3fda98,_0x1249('0x28'));_0x51e933['query']=_[_0x1249('0x30')](_0x254dcb['query']);_0x51e933[_0x1249('0x31')]=_[_0x1249('0x32')](_0x51e933[_0x1249('0x2f')],_0x51e933[_0x1249('0x33')]);_0x48cfff[_0x1249('0x34')]=_['intersection'](_0x51e933[_0x1249('0x2f')],qs[_0x1249('0x35')](_0x254dcb[_0x1249('0x33')][_0x1249('0x35')]));_0x48cfff[_0x1249('0x34')]=_0x48cfff[_0x1249('0x34')][_0x1249('0x36')]?_0x48cfff[_0x1249('0x34')]:_0x51e933[_0x1249('0x2f')];if(!_0x254dcb[_0x1249('0x33')][_0x1249('0x37')](_0x1249('0x38'))){_0x48cfff[_0x1249('0x1e')]=qs[_0x1249('0x1e')](_0x254dcb[_0x1249('0x33')][_0x1249('0x1e')]);_0x48cfff[_0x1249('0x20')]=qs[_0x1249('0x20')](_0x254dcb[_0x1249('0x33')][_0x1249('0x20')]);}_0x48cfff[_0x1249('0x39')]=qs[_0x1249('0x3a')](_0x254dcb[_0x1249('0x33')][_0x1249('0x3a')]);_0x48cfff[_0x1249('0x3b')]=qs['filters'](_[_0x1249('0x3c')](_0x254dcb['query'],_0x51e933[_0x1249('0x31')]),_0x3fda98);if(_0x254dcb['query'][_0x1249('0x3d')]){_0x48cfff[_0x1249('0x3b')]=_[_0x1249('0x3e')](_0x48cfff[_0x1249('0x3b')],{'$or':_[_0x1249('0x2a')](_0x3fda98,function(_0x1b291d){if(_0x1b291d['type']!=='VIRTUAL'){var _0xfd50a6={};_0xfd50a6[_0x1b291d[_0x1249('0x28')]]={'$like':'%'+_0x254dcb[_0x1249('0x33')]['filter']+'%'};return _0xfd50a6;}})});}_0x48cfff=_[_0x1249('0x3e')]({},_0x48cfff,_0x254dcb[_0x1249('0x3f')]);var _0x11c173={'where':_0x48cfff[_0x1249('0x3b')]};return db[_0x1249('0x40')][_0x1249('0x1f')](_0x11c173)['then'](function(_0x1cfd3a){_0x5ac0b4['count']=_0x1cfd3a;if(_0x254dcb['query']['includeAll']){_0x48cfff[_0x1249('0x41')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x48cfff);})[_0x1249('0x25')](function(_0x2a7f67){_0x5ac0b4[_0x1249('0x42')]=_0x2a7f67;return _0x5ac0b4;})['then'](respondWithFilteredResult(_0x3000da,_0x48cfff))[_0x1249('0x43')](handleError(_0x3000da,null));}; \ No newline at end of file +var _0x8bef=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Migration','includeAll','include','findAll','rows','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2b5cc4,_0x3de7f8){var _0x3c7a90=function(_0x5477e7){while(--_0x5477e7){_0x2b5cc4['push'](_0x2b5cc4['shift']());}};_0x3c7a90(++_0x3de7f8);}(_0x8bef,0x17c));var _0xf8be=function(_0x588a56,_0x4adb69){_0x588a56=_0x588a56-0x0;var _0x5666ea=_0x8bef[_0x588a56];return _0x5666ea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf8be('0x0'));var jsonpatch=require(_0xf8be('0x1'));var rp=require(_0xf8be('0x2'));var moment=require(_0xf8be('0x3'));var BPromise=require(_0xf8be('0x4'));var Mustache=require(_0xf8be('0x5'));var util=require(_0xf8be('0x6'));var path=require(_0xf8be('0x7'));var sox=require('sox');var csv=require(_0xf8be('0x8'));var ejs=require(_0xf8be('0x9'));var fs=require('fs');var fs_extra=require(_0xf8be('0xa'));var _=require('lodash');var squel=require(_0xf8be('0xb'));var crypto=require(_0xf8be('0xc'));var jsforce=require(_0xf8be('0xd'));var deskjs=require(_0xf8be('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf8be('0xf'));var Papa=require(_0xf8be('0x10'));var Redis=require('ioredis');var authService=require(_0xf8be('0x11'));var qs=require(_0xf8be('0x12'));var as=require(_0xf8be('0x13'));var hardwareService=require(_0xf8be('0x14'));var logger=require('../../config/logger')(_0xf8be('0x15'));var utils=require('../../config/utils');var config=require(_0xf8be('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf8be('0x17'))['db'];function respondWithStatusCode(_0x3b3966,_0x37f50a){_0x37f50a=_0x37f50a||0xcc;return function(_0x2bac66){if(_0x2bac66){return _0x3b3966[_0xf8be('0x18')](_0x37f50a);}return _0x3b3966[_0xf8be('0x19')](_0x37f50a)[_0xf8be('0x1a')]();};}function respondWithResult(_0x2ffd42,_0x45778c){_0x45778c=_0x45778c||0xc8;return function(_0xda5248){if(_0xda5248){return _0x2ffd42['status'](_0x45778c)[_0xf8be('0x1b')](_0xda5248);}};}function respondWithFilteredResult(_0x4c0af3,_0x5ab397){return function(_0x3a15f3){if(_0x3a15f3){var _0x16f446=typeof _0x5ab397[_0xf8be('0x1c')]===_0xf8be('0x1d')&&typeof _0x5ab397[_0xf8be('0x1e')]==='undefined';var _0x38f8f3=_0x3a15f3[_0xf8be('0x1f')];var _0x1be864=_0x16f446?0x0:_0x5ab397['offset'];var _0x5ab5bb=_0x16f446?_0x3a15f3[_0xf8be('0x1f')]:_0x5ab397[_0xf8be('0x1c')]+_0x5ab397[_0xf8be('0x1e')];var _0xa3f22;if(_0x5ab5bb>=_0x38f8f3){_0x5ab5bb=_0x38f8f3;_0xa3f22=0xc8;}else{_0xa3f22=0xce;}_0x4c0af3[_0xf8be('0x19')](_0xa3f22);return _0x4c0af3[_0xf8be('0x20')](_0xf8be('0x21'),_0x1be864+'-'+_0x5ab5bb+'/'+_0x38f8f3)[_0xf8be('0x1b')](_0x3a15f3);}return null;};}function patchUpdates(_0x564790){return function(_0x2f6cdc){try{jsonpatch[_0xf8be('0x22')](_0x2f6cdc,_0x564790,!![]);}catch(_0x4a18e6){return BPromise[_0xf8be('0x23')](_0x4a18e6);}return _0x2f6cdc[_0xf8be('0x24')]();};}function saveUpdates(_0xed1a28,_0x403417){return function(_0x2b2df9){if(_0x2b2df9){return _0x2b2df9['update'](_0xed1a28)[_0xf8be('0x25')](function(_0x19884c){return _0x19884c;});}return null;};}function removeEntity(_0xf1d062,_0xb492fc){return function(_0x2741cf){if(_0x2741cf){return _0x2741cf[_0xf8be('0x26')]()[_0xf8be('0x25')](function(){_0xf1d062[_0xf8be('0x19')](0xcc)[_0xf8be('0x1a')]();});}};}function handleEntityNotFound(_0x4337ac,_0x136d28){return function(_0x36920b){if(!_0x36920b){_0x4337ac[_0xf8be('0x18')](0x194);}return _0x36920b;};}function handleError(_0xe08c1b,_0x451256){_0x451256=_0x451256||0x1f4;return function(_0x4b84bc){logger['error'](_0x4b84bc[_0xf8be('0x27')]);if(_0x4b84bc[_0xf8be('0x28')]){delete _0x4b84bc['name'];}_0xe08c1b[_0xf8be('0x19')](_0x451256)['send'](_0x4b84bc);};}exports[_0xf8be('0x29')]=function(_0x3b0e46,_0x28d0f3){var _0x44832b={},_0x2a58d3={},_0x204848={'count':0x0,'rows':[]};var _0x254e94=_['map'](db['Migration']['rawAttributes'],function(_0x2541e1){return{'name':_0x2541e1[_0xf8be('0x2a')],'type':_0x2541e1['type']['key']};});_0x2a58d3['model']=_['map'](_0x254e94,_0xf8be('0x28'));_0x2a58d3[_0xf8be('0x2b')]=_[_0xf8be('0x2c')](_0x3b0e46[_0xf8be('0x2b')]);_0x2a58d3[_0xf8be('0x2d')]=_['intersection'](_0x2a58d3[_0xf8be('0x2e')],_0x2a58d3[_0xf8be('0x2b')]);_0x44832b[_0xf8be('0x2f')]=_[_0xf8be('0x30')](_0x2a58d3[_0xf8be('0x2e')],qs[_0xf8be('0x31')](_0x3b0e46['query'][_0xf8be('0x31')]));_0x44832b['attributes']=_0x44832b[_0xf8be('0x2f')]['length']?_0x44832b[_0xf8be('0x2f')]:_0x2a58d3[_0xf8be('0x2e')];if(!_0x3b0e46[_0xf8be('0x2b')][_0xf8be('0x32')](_0xf8be('0x33'))){_0x44832b[_0xf8be('0x1e')]=qs['limit'](_0x3b0e46['query'][_0xf8be('0x1e')]);_0x44832b[_0xf8be('0x1c')]=qs['offset'](_0x3b0e46[_0xf8be('0x2b')][_0xf8be('0x1c')]);}_0x44832b[_0xf8be('0x34')]=qs['sort'](_0x3b0e46[_0xf8be('0x2b')][_0xf8be('0x35')]);_0x44832b[_0xf8be('0x36')]=qs['filters'](_[_0xf8be('0x37')](_0x3b0e46[_0xf8be('0x2b')],_0x2a58d3[_0xf8be('0x2d')]),_0x254e94);if(_0x3b0e46[_0xf8be('0x2b')][_0xf8be('0x38')]){_0x44832b['where']=_[_0xf8be('0x39')](_0x44832b['where'],{'$or':_['map'](_0x254e94,function(_0x28f431){if(_0x28f431['type']!==_0xf8be('0x3a')){var _0x1a83b8={};_0x1a83b8[_0x28f431[_0xf8be('0x28')]]={'$like':'%'+_0x3b0e46[_0xf8be('0x2b')][_0xf8be('0x38')]+'%'};return _0x1a83b8;}})});}_0x44832b=_[_0xf8be('0x39')]({},_0x44832b,_0x3b0e46['options']);var _0x1583a5={'where':_0x44832b[_0xf8be('0x36')]};return db[_0xf8be('0x3b')][_0xf8be('0x1f')](_0x1583a5)[_0xf8be('0x25')](function(_0x3b68f8){_0x204848[_0xf8be('0x1f')]=_0x3b68f8;if(_0x3b0e46[_0xf8be('0x2b')][_0xf8be('0x3c')]){_0x44832b[_0xf8be('0x3d')]=[{'all':!![]}];}return db[_0xf8be('0x3b')][_0xf8be('0x3e')](_0x44832b);})[_0xf8be('0x25')](function(_0x3410fa){_0x204848[_0xf8be('0x3f')]=_0x3410fa;return _0x204848;})[_0xf8be('0x25')](respondWithFilteredResult(_0x28d0f3,_0x44832b))['catch'](handleError(_0x28d0f3,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 5b20726..ca28349 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 _0xa582=['define','Migration','migrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports'];(function(_0x235c28,_0x2fbcf6){var _0x5caaa1=function(_0xa19e71){while(--_0xa19e71){_0x235c28['push'](_0x235c28['shift']());}};_0x5caaa1(++_0x2fbcf6);}(_0xa582,0x17c));var _0x2a58=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xa582[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x2a58('0x0'));var util=require(_0x2a58('0x1'));var logger=require(_0x2a58('0x2'))('api');var moment=require(_0x2a58('0x3'));var BPromise=require(_0x2a58('0x4'));var rp=require(_0x2a58('0x5'));var fs=require('fs');var path=require(_0x2a58('0x6'));var rimraf=require(_0x2a58('0x7'));var config=require('../../config/environment');var attributes=require(_0x2a58('0x8'));module[_0x2a58('0x9')]=function(_0x14e2d4,_0x33bcde){return _0x14e2d4[_0x2a58('0xa')](_0x2a58('0xb'),attributes,{'tableName':_0x2a58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5e6=['bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','define','Migration','migrations','util','../../config/logger','api','moment'];(function(_0x35fbaf,_0x5217fe){var _0x1ccf0c=function(_0x217d4c){while(--_0x217d4c){_0x35fbaf['push'](_0x35fbaf['shift']());}};_0x1ccf0c(++_0x5217fe);}(_0xe5e6,0x164));var _0x6e5e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe5e6[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x6e5e('0x0'));var logger=require(_0x6e5e('0x1'))(_0x6e5e('0x2'));var moment=require(_0x6e5e('0x3'));var BPromise=require(_0x6e5e('0x4'));var rp=require(_0x6e5e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e5e('0x6'));var config=require(_0x6e5e('0x7'));var attributes=require(_0x6e5e('0x8'));module['exports']=function(_0x52048e,_0x43e7ad){return _0x52048e[_0x6e5e('0x9')](_0x6e5e('0xa'),attributes,{'tableName':_0x6e5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 3b3e968..dc2d6f1 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 _0x2f68=['Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug'];(function(_0x2bfb3f,_0x16fe71){var _0x19fcf3=function(_0x9078f2){while(--_0x9078f2){_0x2bfb3f['push'](_0x2bfb3f['shift']());}};_0x19fcf3(++_0x16fe71);}(_0x2f68,0x9a));var _0x82f6=function(_0x2ac929,_0xdc2eec){_0x2ac929=_0x2ac929-0x0;var _0x2632ce=_0x2f68[_0x2ac929];return _0x2632ce;};'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);});});} \ No newline at end of file +var _0x3eec=['debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x5842a4,_0x5d1f80){_0x5842a4=_0x5842a4-0x0;var _0x25d71c=_0x3eec[_0x5842a4];return _0x25d71c;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ee('0x4'));var db=require(_0xc3ee('0x5'))['db'];var utils=require(_0xc3ee('0x6'));var logger=require(_0xc3ee('0x7'))(_0xc3ee('0x8'));var config=require(_0xc3ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3ee('0xa')][_0xc3ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea4318,_0x2cc750,_0x356374){return new BPromise(function(_0x3d74c0,_0xd88f6){return client[_0xc3ee('0xc')](_0xea4318,_0x356374)[_0xc3ee('0xd')](function(_0x23e9c0){logger['info']('Migration,\x20%s,\x20%s',_0x2cc750,_0xc3ee('0xe'));logger[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x2cc750,_0xc3ee('0xe'),JSON['stringify'](_0x23e9c0));if(_0x23e9c0[_0xc3ee('0x11')]){if(_0x23e9c0['error'][_0xc3ee('0x12')]===0x1f4){logger[_0xc3ee('0x11')]('Migration,\x20%s,\x20%s',_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0xd88f6(_0x23e9c0['error'][_0xc3ee('0x13')]);}logger['error'](_0xc3ee('0x14'),_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0x3d74c0(_0x23e9c0[_0xc3ee('0x11')][_0xc3ee('0x13')]);}else{logger[_0xc3ee('0x15')](_0xc3ee('0x14'),_0x2cc750,_0xc3ee('0xe'));_0x3d74c0(_0x23e9c0[_0xc3ee('0x16')]['message']);}})[_0xc3ee('0x17')](function(_0x4eea89){logger[_0xc3ee('0x11')](_0xc3ee('0x14'),_0x2cc750,_0x4eea89);_0xd88f6(_0x4eea89);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 3e02cec..17c9d38 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 _0xe797=['./network.controller','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3307bd,_0x256dbf){var _0x2561be=function(_0x3ebf){while(--_0x3ebf){_0x3307bd['push'](_0x3307bd['shift']());}};_0x2561be(++_0x256dbf);}(_0xe797,0x12a));var _0x7e79=function(_0x4320b9,_0x3340df){_0x4320b9=_0x4320b9-0x0;var _0x193aa5=_0xe797[_0x4320b9];return _0x193aa5;};'use strict';var multer=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var path=require(_0x7e79('0x2'));var timeout=require(_0x7e79('0x3'));var express=require(_0x7e79('0x4'));var router=express[_0x7e79('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7e79('0x6'));var interaction=require(_0x7e79('0x7'));var config=require('../../config/environment');var controller=require(_0x7e79('0x8'));router[_0x7e79('0x9')]('/',auth[_0x7e79('0xa')](),controller['index']);router['get'](_0x7e79('0xb'),auth[_0x7e79('0xa')](),controller['show']);router['post']('/',auth[_0x7e79('0xa')](),controller[_0x7e79('0xc')]);router[_0x7e79('0xd')]('/:id',auth[_0x7e79('0xa')](),controller[_0x7e79('0xe')]);router[_0x7e79('0xf')](_0x7e79('0xb'),auth[_0x7e79('0xa')](),controller[_0x7e79('0x10')]);module[_0x7e79('0x11')]=router; \ No newline at end of file +var _0x6c65=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy'];(function(_0x463e45,_0x1ff35f){var _0x172e49=function(_0x35f7d0){while(--_0x35f7d0){_0x463e45['push'](_0x463e45['shift']());}};_0x172e49(++_0x1ff35f);}(_0x6c65,0x78));var _0x56c6=function(_0x1bc173,_0x1f46f5){_0x1bc173=_0x1bc173-0x0;var _0x2815a0=_0x6c65[_0x1bc173];return _0x2815a0;};'use strict';var multer=require(_0x56c6('0x0'));var util=require(_0x56c6('0x1'));var path=require(_0x56c6('0x2'));var timeout=require(_0x56c6('0x3'));var express=require(_0x56c6('0x4'));var router=express[_0x56c6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x56c6('0x6'));var interaction=require(_0x56c6('0x7'));var config=require(_0x56c6('0x8'));var controller=require(_0x56c6('0x9'));router[_0x56c6('0xa')]('/',auth['isAuthenticated'](),controller[_0x56c6('0xb')]);router[_0x56c6('0xa')](_0x56c6('0xc'),auth[_0x56c6('0xd')](),controller[_0x56c6('0xe')]);router['post']('/',auth[_0x56c6('0xd')](),controller[_0x56c6('0xf')]);router[_0x56c6('0x10')]('/:id',auth[_0x56c6('0xd')](),controller[_0x56c6('0x11')]);router[_0x56c6('0x12')](_0x56c6('0xc'),auth[_0x56c6('0xd')](),controller[_0x56c6('0x13')]);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 dff6aa8..3884b1e 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 _0x517a=['STRING','sequelize','exports','ENUM','externip','stun','turn'];(function(_0x463a1d,_0x2ad8e2){var _0xfc76e=function(_0x28a54f){while(--_0x28a54f){_0x463a1d['push'](_0x463a1d['shift']());}};_0xfc76e(++_0x2ad8e2);}(_0x517a,0xd3));var _0xa517=function(_0x51d319,_0x2971a9){_0x51d319=_0x51d319-0x0;var _0x22c953=_0x517a[_0x51d319];return _0x22c953;};'use strict';var Sequelize=require(_0xa517('0x0'));module[_0xa517('0x1')]={'type':{'type':Sequelize[_0xa517('0x2')]('localnet',_0xa517('0x3'),_0xa517('0x4'),_0xa517('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa517('0x6')]},'password':{'type':Sequelize[_0xa517('0x6')]}}; \ No newline at end of file +var _0xee69=['ENUM','localnet','externip','turn','STRING'];(function(_0x4637e2,_0x573d75){var _0x1543c7=function(_0x56fe32){while(--_0x56fe32){_0x4637e2['push'](_0x4637e2['shift']());}};_0x1543c7(++_0x573d75);}(_0xee69,0x104));var _0x9ee6=function(_0x6166ee,_0xa17a76){_0x6166ee=_0x6166ee-0x0;var _0x5f5042=_0xee69[_0x6166ee];return _0x5f5042;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9ee6('0x0')](_0x9ee6('0x1'),_0x9ee6('0x2'),'stun',_0x9ee6('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9ee6('0x4')]},'password':{'type':Sequelize[_0x9ee6('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 678f146..7054114 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 _0xa57c=['server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','update','format','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','name','send','map','rawAttributes','fieldName','type','key','model','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Network','includeAll','findAll','rows','catch','keys','include','find','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf'];(function(_0x40c9bc,_0x6eb340){var _0x3acedf=function(_0x1c8532){while(--_0x1c8532){_0x40c9bc['push'](_0x40c9bc['shift']());}};_0x3acedf(++_0x6eb340);}(_0xa57c,0x1ba));var _0xca57=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xa57c[_0x565ed7];return _0x183ad7;};'use strict';var util=require(_0xca57('0x0'));var path=require(_0xca57('0x1'));var ejs=require(_0xca57('0x2'));var fs=require('fs');var _=require(_0xca57('0x3'));var qs=require(_0xca57('0x4'));var logger=require(_0xca57('0x5'))(_0xca57('0x6'));var config=require(_0xca57('0x7'));var db=require(_0xca57('0x8'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xca57('0x9')][_0xca57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d7595,_0x28d557,_0x608584,_0x48b08b){return new Promise(function(_0xc3722a,_0x4e046b){var _0x163f09=_0x48b08b||client;return _0x163f09[_0xca57('0xb')](_0x5d7595,_0x608584)[_0xca57('0xc')](function(_0x3e8d78){logger[_0xca57('0xd')](_0xca57('0xe'),_0x28d557,'request\x20sent');logger[_0xca57('0xf')](_0xca57('0x10'),_0x28d557,'request\x20sent',JSON[_0xca57('0x11')](_0x3e8d78));if(_0x3e8d78['error']){if(_0x3e8d78['error'][_0xca57('0x12')]===0x1f4){logger[_0xca57('0x13')](_0xca57('0xe'),_0x28d557,_0x3e8d78[_0xca57('0x13')][_0xca57('0x14')]);return _0x4e046b(_0x3e8d78['error'][_0xca57('0x14')]);}logger[_0xca57('0x13')](_0xca57('0xe'),_0x28d557,_0x3e8d78[_0xca57('0x13')][_0xca57('0x14')]);return _0xc3722a(_0x3e8d78[_0xca57('0x13')][_0xca57('0x14')]);}else{logger[_0xca57('0xd')](_0xca57('0xe'),_0x28d557,_0xca57('0x15'));_0xc3722a(_0x3e8d78[_0xca57('0x16')][_0xca57('0x14')]);}})['catch'](function(_0x341d76){logger[_0xca57('0x13')](_0xca57('0xe'),_0x28d557,_0x341d76);_0x4e046b(_0x341d76);});});}function respondWithResult(_0x328878,_0x2cdc6c){_0x2cdc6c=_0x2cdc6c||0xc8;return function(_0x5122cd){if(_0x5122cd){return _0x328878[_0xca57('0x17')](_0x2cdc6c)[_0xca57('0x18')](_0x5122cd);}};}function respondWithFilteredResult(_0x2bc696,_0x5cb7c3){return function(_0x2721ca){if(_0x2721ca){var _0x30b26e=typeof _0x5cb7c3[_0xca57('0x19')]===_0xca57('0x1a')&&typeof _0x5cb7c3[_0xca57('0x1b')]===_0xca57('0x1a');var _0x24e927=_0x2721ca[_0xca57('0x1c')];var _0xd82ed3=_0x30b26e?0x0:_0x5cb7c3[_0xca57('0x19')];var _0x4c5393=_0x30b26e?_0x2721ca[_0xca57('0x1c')]:_0x5cb7c3[_0xca57('0x19')]+_0x5cb7c3[_0xca57('0x1b')];var _0x2a41c5;if(_0x4c5393>=_0x24e927){_0x4c5393=_0x24e927;_0x2a41c5=0xc8;}else{_0x2a41c5=0xce;}_0x2bc696[_0xca57('0x17')](_0x2a41c5);return _0x2bc696[_0xca57('0x1d')](_0xca57('0x1e'),_0xd82ed3+'-'+_0x4c5393+'/'+_0x24e927)[_0xca57('0x18')](_0x2721ca);}return null;};}function saveUpdates(_0x6d42dc){return function(_0xc656bb){if(_0xc656bb){return _0xc656bb['update'](_0x6d42dc)[_0xca57('0xc')](function(_0xa6f668){return _0xa6f668;});}return null;};}function removeEntity(_0x2ab8cf){return function(_0x597f27){if(_0x597f27){return _0x597f27[_0xca57('0x1f')]()[_0xca57('0xc')](function(){_0x2ab8cf[_0xca57('0x17')](0xcc)[_0xca57('0x20')]();});}};}function handleEntityNotFound(_0xde6f46){return function(_0x10f9f0){if(!_0x10f9f0){_0xde6f46['sendStatus'](0x194);}return _0x10f9f0;};}function handleError(_0x302ac4,_0x116f29){_0x116f29=_0x116f29||0x1f4;return function(_0x182534){logger[_0xca57('0x13')](_0x182534['stack']);if(_0x182534[_0xca57('0x21')]){delete _0x182534[_0xca57('0x21')];}_0x302ac4[_0xca57('0x17')](_0x116f29)[_0xca57('0x22')](_0x182534);};}exports['index']=function(_0x1de0cc,_0x2bcb66){var _0xdcded1={},_0x1d9e33={},_0x3d8239={'count':0x0,'rows':[]};var _0x25253e=_[_0xca57('0x23')](db['Network'][_0xca57('0x24')],function(_0x2cdedd){return{'name':_0x2cdedd[_0xca57('0x25')],'type':_0x2cdedd[_0xca57('0x26')][_0xca57('0x27')]};});_0x1d9e33[_0xca57('0x28')]=_['map'](_0x25253e,_0xca57('0x21'));_0x1d9e33['query']=_['keys'](_0x1de0cc['query']);_0x1d9e33[_0xca57('0x29')]=_[_0xca57('0x2a')](_0x1d9e33['model'],_0x1d9e33['query']);_0xdcded1['attributes']=_[_0xca57('0x2a')](_0x1d9e33[_0xca57('0x28')],qs[_0xca57('0x2b')](_0x1de0cc['query'][_0xca57('0x2b')]));_0xdcded1[_0xca57('0x2c')]=_0xdcded1[_0xca57('0x2c')][_0xca57('0x2d')]?_0xdcded1[_0xca57('0x2c')]:_0x1d9e33['model'];if(!_0x1de0cc[_0xca57('0x2e')][_0xca57('0x2f')](_0xca57('0x30'))){_0xdcded1['limit']=qs[_0xca57('0x1b')](_0x1de0cc[_0xca57('0x2e')][_0xca57('0x1b')]);_0xdcded1[_0xca57('0x19')]=qs['offset'](_0x1de0cc[_0xca57('0x2e')][_0xca57('0x19')]);}_0xdcded1['order']=qs[_0xca57('0x31')](_0x1de0cc[_0xca57('0x2e')][_0xca57('0x31')]);_0xdcded1[_0xca57('0x32')]=qs['filters'](_['pick'](_0x1de0cc[_0xca57('0x2e')],_0x1d9e33['filters']),_0x25253e);if(_0x1de0cc[_0xca57('0x2e')][_0xca57('0x33')]){_0xdcded1[_0xca57('0x32')]=_[_0xca57('0x34')](_0xdcded1['where'],{'$or':_[_0xca57('0x23')](_0x25253e,function(_0x5c90cf){if(_0x5c90cf['type']!==_0xca57('0x35')){var _0xa85013={};_0xa85013[_0x5c90cf[_0xca57('0x21')]]={'$like':'%'+_0x1de0cc['query'][_0xca57('0x33')]+'%'};return _0xa85013;}})});}_0xdcded1=_['merge']({},_0xdcded1,_0x1de0cc[_0xca57('0x36')]);var _0x2cd748={'where':_0xdcded1[_0xca57('0x32')]};return db[_0xca57('0x37')][_0xca57('0x1c')](_0x2cd748)[_0xca57('0xc')](function(_0x5b4441){_0x3d8239[_0xca57('0x1c')]=_0x5b4441;if(_0x1de0cc[_0xca57('0x2e')][_0xca57('0x38')]){_0xdcded1['include']=[{'all':!![]}];}return db['Network'][_0xca57('0x39')](_0xdcded1);})[_0xca57('0xc')](function(_0x3e0a11){_0x3d8239[_0xca57('0x3a')]=_0x3e0a11;return _0x3d8239;})[_0xca57('0xc')](respondWithFilteredResult(_0x2bcb66,_0xdcded1))[_0xca57('0x3b')](handleError(_0x2bcb66,null));};exports['show']=function(_0x4a9ec7,_0xde5d0a){var _0x27fc19={'raw':!![],'where':{'id':_0x4a9ec7['params']['id']}},_0x4ca6a9={};_0x4ca6a9[_0xca57('0x28')]=_[_0xca57('0x3c')](db[_0xca57('0x37')]['rawAttributes']);_0x4ca6a9[_0xca57('0x2e')]=_['keys'](_0x4a9ec7['query']);_0x4ca6a9[_0xca57('0x29')]=_['intersection'](_0x4ca6a9[_0xca57('0x28')],_0x4ca6a9[_0xca57('0x2e')]);_0x27fc19[_0xca57('0x2c')]=_[_0xca57('0x2a')](_0x4ca6a9['model'],qs[_0xca57('0x2b')](_0x4a9ec7[_0xca57('0x2e')][_0xca57('0x2b')]));_0x27fc19['attributes']=_0x27fc19[_0xca57('0x2c')][_0xca57('0x2d')]?_0x27fc19[_0xca57('0x2c')]:_0x4ca6a9['model'];if(_0x4a9ec7[_0xca57('0x2e')][_0xca57('0x38')]){_0x27fc19[_0xca57('0x3d')]=[{'all':!![]}];}_0x27fc19=_[_0xca57('0x34')]({},_0x27fc19,_0x4a9ec7[_0xca57('0x36')]);return db[_0xca57('0x37')][_0xca57('0x3e')](_0x27fc19)[_0xca57('0xc')](handleEntityNotFound(_0xde5d0a,null))[_0xca57('0xc')](respondWithResult(_0xde5d0a,null))[_0xca57('0x3b')](handleError(_0xde5d0a,null));};exports['create']=function(_0xbc161c,_0x361601){var _0x4a035b;return db[_0xca57('0x37')][_0xca57('0x3f')](_0xbc161c[_0xca57('0x40')],{'raw':!![]})[_0xca57('0xc')](function(_0x5f4253){_0x4a035b=_0x5f4253;return db['Network'][_0xca57('0x39')]({'where':{'type':_0xbc161c['body']['type']},'raw':!![]});})[_0xca57('0xc')](function(_0x3eeda2){if(_0x4a035b['type'][_0xca57('0x41')]()==_0xca57('0x42')){var _0x5a8d74=fs[_0xca57('0x43')](path[_0xca57('0x44')](config['root'],_0xca57('0x45')),'utf8');var _0x55dfb0=ejs[_0xca57('0x46')](_0x5a8d74,{'networks':_0x3eeda2||[]});fs[_0xca57('0x47')](_0xca57('0x48'),_0x55dfb0);return respondWithRpcPromise(_0xca57('0x49'),_0xca57('0x3f'),{'module':_0xca57('0x4a')});}else if(_0x4a035b[_0xca57('0x26')][_0xca57('0x41')]()==_0xca57('0x4b')){var _0x541a2a=fs['readFileSync'](path['join'](config[_0xca57('0x4c')],_0xca57('0x4d')),_0xca57('0x4e'));var _0x3fc398=ejs[_0xca57('0x46')](_0x541a2a,{'networks':_0x3eeda2||[]});fs[_0xca57('0x47')](_0xca57('0x4f'),_0x3fc398);return respondWithRpcPromise(_0xca57('0x49'),'create',{'module':'res_stun_monitor.so'});}else{var _0x183bd3=fs[_0xca57('0x43')](path[_0xca57('0x44')](config[_0xca57('0x4c')],_0xca57('0x50')),_0xca57('0x4e'));var _0x30c782=ejs[_0xca57('0x46')](_0x183bd3,{'networks':_0x3eeda2||[]});fs[_0xca57('0x47')](util['format'](_0xca57('0x51'),_0xbc161c['body']['type'][_0xca57('0x52')]()),_0x30c782);return respondWithRpcPromise(_0xca57('0x49'),'create',{'module':_0xca57('0x53')});}})[_0xca57('0xc')](function(){return _0x4a035b;})[_0xca57('0xc')](respondWithResult(_0x361601,0xc9))['catch'](handleError(_0x361601,null));};exports['update']=function(_0x36b6c1,_0x3040c7){var _0x440518;return db[_0xca57('0x37')][_0xca57('0x3e')]({'where':{'id':_0x36b6c1[_0xca57('0x54')]['id']}})[_0xca57('0xc')](handleEntityNotFound(_0x3040c7,null))[_0xca57('0xc')](saveUpdates(_0x36b6c1[_0xca57('0x40')],null))['then'](function(_0x14d66c){if(_0x14d66c){_0x440518=_0x14d66c;return db[_0xca57('0x37')][_0xca57('0x39')]({'where':{'type':_0x440518['type']},'raw':!![]});}return null;})[_0xca57('0xc')](function(_0x47da72){if(_0x440518['type'][_0xca57('0x41')]()=='STUN'){var _0x4376c4=fs[_0xca57('0x43')](path[_0xca57('0x44')](config['root'],_0xca57('0x45')),_0xca57('0x4e'));var _0x3f745e=ejs['render'](_0x4376c4,{'networks':_0x47da72||[]});fs[_0xca57('0x47')](_0xca57('0x48'),_0x3f745e);return respondWithRpcPromise(_0xca57('0x49'),'update',{'module':'res_stun_monitor.so'});}else if(_0x440518[_0xca57('0x26')][_0xca57('0x41')]()==_0xca57('0x4b')){var _0x12ca92=fs[_0xca57('0x43')](path[_0xca57('0x44')](config[_0xca57('0x4c')],_0xca57('0x4d')),'utf8');var _0x58eadd=ejs[_0xca57('0x46')](_0x12ca92,{'networks':_0x47da72||[]});fs[_0xca57('0x47')](_0xca57('0x4f'),_0x58eadd);return respondWithRpcPromise('Reload',_0xca57('0x55'),{'module':_0xca57('0x4a')});}else{var _0x44e356=fs[_0xca57('0x43')](path[_0xca57('0x44')](config[_0xca57('0x4c')],'server/files/templates/network.ejs'),'utf8');var _0x4f1536=ejs['render'](_0x44e356,{'networks':_0x47da72||[]});fs[_0xca57('0x47')](util[_0xca57('0x56')]('/etc/asterisk/sip_xcally_%s.conf',_0x36b6c1[_0xca57('0x40')][_0xca57('0x26')][_0xca57('0x52')]()),_0x4f1536);return respondWithRpcPromise(_0xca57('0x49'),_0xca57('0x55'),{'module':_0xca57('0x53')});}})[_0xca57('0xc')](function(_0x159928){if(_0x159928){return _0x440518;}return null;})[_0xca57('0xc')](respondWithResult(_0x3040c7,null))[_0xca57('0x3b')](handleError(_0x3040c7,null));};exports[_0xca57('0x1f')]=function(_0x1eb481,_0x4d244d){var _0x51c96b;return db[_0xca57('0x37')]['find']({'where':{'id':_0x1eb481[_0xca57('0x54')]['id']}})[_0xca57('0xc')](function(_0x29942f){_0x51c96b=_0x29942f;return _0x29942f;})[_0xca57('0xc')](handleEntityNotFound(_0x4d244d,null))[_0xca57('0xc')](removeEntity(_0x4d244d,null))['then'](function(){if(_0x51c96b){return db[_0xca57('0x37')][_0xca57('0x39')]({'where':{'type':_0x51c96b[_0xca57('0x26')]},'raw':!![]});}})[_0xca57('0xc')](function(_0x44d213){if(_0x51c96b[_0xca57('0x26')][_0xca57('0x41')]()==_0xca57('0x42')){var _0x24f697=fs['readFileSync'](path[_0xca57('0x44')](config[_0xca57('0x4c')],_0xca57('0x45')),'utf8');var _0x563dcd=ejs[_0xca57('0x46')](_0x24f697,{'networks':_0x44d213||[]});fs[_0xca57('0x47')](_0xca57('0x48'),_0x563dcd);return respondWithRpcPromise(_0xca57('0x49'),_0xca57('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0x51c96b[_0xca57('0x26')][_0xca57('0x41')]()==_0xca57('0x4b')){var _0x1bf74d=fs[_0xca57('0x43')](path[_0xca57('0x44')](config[_0xca57('0x4c')],_0xca57('0x4d')),_0xca57('0x4e'));var _0x23139c=ejs[_0xca57('0x46')](_0x1bf74d,{'networks':_0x44d213||[]});fs['writeFileSync'](_0xca57('0x4f'),_0x23139c);return respondWithRpcPromise(_0xca57('0x49'),'destroy',{'module':_0xca57('0x4a')});}else{var _0x373d47=fs['readFileSync'](path[_0xca57('0x44')](config[_0xca57('0x4c')],'server/files/templates/network.ejs'),'utf8');var _0x60615d=ejs[_0xca57('0x46')](_0x373d47,{'networks':_0x44d213||[]});fs[_0xca57('0x47')](util[_0xca57('0x56')](_0xca57('0x51'),_0x51c96b['type'][_0xca57('0x52')]()),_0x60615d);return respondWithRpcPromise('Reload',_0xca57('0x1f'),{'module':_0xca57('0x53')});}})[_0xca57('0x3b')](handleError(_0x4d244d,null));}; \ No newline at end of file +var _0x98d9=['limit','set','Content-Range','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','count','includeAll','include','findAll','rows','params','find','catch','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','TURN','chan_sip.so','destroy','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','status','json','offset','undefined'];(function(_0x58ecac,_0xc38a77){var _0x439e6a=function(_0xc871c4){while(--_0xc871c4){_0x58ecac['push'](_0x58ecac['shift']());}};_0x439e6a(++_0xc38a77);}(_0x98d9,0x1e8));var _0x998d=function(_0x25abca,_0x32962f){_0x25abca=_0x25abca-0x0;var _0x52e7d1=_0x98d9[_0x25abca];return _0x52e7d1;};'use strict';var util=require(_0x998d('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x998d('0x1'));var qs=require(_0x998d('0x2'));var logger=require(_0x998d('0x3'))(_0x998d('0x4'));var config=require(_0x998d('0x5'));var db=require(_0x998d('0x6'))['db'];var jayson=require(_0x998d('0x7'));var client=jayson[_0x998d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe84176,_0x37044a,_0x44a663,_0x321676){return new Promise(function(_0x39c540,_0x260c8d){var _0x48ace1=_0x321676||client;return _0x48ace1['request'](_0xe84176,_0x44a663)[_0x998d('0x9')](function(_0x7d2896){logger[_0x998d('0xa')](_0x998d('0xb'),_0x37044a,_0x998d('0xc'));logger[_0x998d('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x37044a,_0x998d('0xc'),JSON['stringify'](_0x7d2896));if(_0x7d2896['error']){if(_0x7d2896[_0x998d('0xe')][_0x998d('0xf')]===0x1f4){logger[_0x998d('0xe')]('Network,\x20%s,\x20%s',_0x37044a,_0x7d2896[_0x998d('0xe')][_0x998d('0x10')]);return _0x260c8d(_0x7d2896[_0x998d('0xe')]['message']);}logger[_0x998d('0xe')]('Network,\x20%s,\x20%s',_0x37044a,_0x7d2896['error'][_0x998d('0x10')]);return _0x39c540(_0x7d2896[_0x998d('0xe')][_0x998d('0x10')]);}else{logger[_0x998d('0xa')]('Network,\x20%s,\x20%s',_0x37044a,'request\x20sent');_0x39c540(_0x7d2896[_0x998d('0x11')][_0x998d('0x10')]);}})['catch'](function(_0x32544e){logger[_0x998d('0xe')](_0x998d('0xb'),_0x37044a,_0x32544e);_0x260c8d(_0x32544e);});});}function respondWithResult(_0xf9cf6f,_0x37d0a9){_0x37d0a9=_0x37d0a9||0xc8;return function(_0x495c2f){if(_0x495c2f){return _0xf9cf6f[_0x998d('0x12')](_0x37d0a9)[_0x998d('0x13')](_0x495c2f);}};}function respondWithFilteredResult(_0x24135a,_0x53d812){return function(_0x22d6ec){if(_0x22d6ec){var _0x2ed881=typeof _0x53d812[_0x998d('0x14')]===_0x998d('0x15')&&typeof _0x53d812['limit']==='undefined';var _0x2e9c71=_0x22d6ec['count'];var _0x4afb64=_0x2ed881?0x0:_0x53d812[_0x998d('0x14')];var _0x4d13bb=_0x2ed881?_0x22d6ec['count']:_0x53d812[_0x998d('0x14')]+_0x53d812[_0x998d('0x16')];var _0x22729f;if(_0x4d13bb>=_0x2e9c71){_0x4d13bb=_0x2e9c71;_0x22729f=0xc8;}else{_0x22729f=0xce;}_0x24135a[_0x998d('0x12')](_0x22729f);return _0x24135a[_0x998d('0x17')](_0x998d('0x18'),_0x4afb64+'-'+_0x4d13bb+'/'+_0x2e9c71)[_0x998d('0x13')](_0x22d6ec);}return null;};}function saveUpdates(_0x3c7b9a){return function(_0x2fbeb4){if(_0x2fbeb4){return _0x2fbeb4['update'](_0x3c7b9a)[_0x998d('0x9')](function(_0x41b418){return _0x41b418;});}return null;};}function removeEntity(_0x506bf5){return function(_0x73004f){if(_0x73004f){return _0x73004f['destroy']()[_0x998d('0x9')](function(){_0x506bf5['status'](0xcc)[_0x998d('0x19')]();});}};}function handleEntityNotFound(_0x39a273){return function(_0x1fa009){if(!_0x1fa009){_0x39a273[_0x998d('0x1a')](0x194);}return _0x1fa009;};}function handleError(_0x3185f7,_0x52d24b){_0x52d24b=_0x52d24b||0x1f4;return function(_0x476435){logger[_0x998d('0xe')](_0x476435[_0x998d('0x1b')]);if(_0x476435[_0x998d('0x1c')]){delete _0x476435[_0x998d('0x1c')];}_0x3185f7[_0x998d('0x12')](_0x52d24b)[_0x998d('0x1d')](_0x476435);};}exports[_0x998d('0x1e')]=function(_0x5f4146,_0x4d8265){var _0x54a466={},_0x417549={},_0x166bb6={'count':0x0,'rows':[]};var _0x1f3c91=_[_0x998d('0x1f')](db[_0x998d('0x20')][_0x998d('0x21')],function(_0x370ae9){return{'name':_0x370ae9[_0x998d('0x22')],'type':_0x370ae9['type'][_0x998d('0x23')]};});_0x417549[_0x998d('0x24')]=_[_0x998d('0x1f')](_0x1f3c91,_0x998d('0x1c'));_0x417549[_0x998d('0x25')]=_[_0x998d('0x26')](_0x5f4146[_0x998d('0x25')]);_0x417549[_0x998d('0x27')]=_[_0x998d('0x28')](_0x417549[_0x998d('0x24')],_0x417549[_0x998d('0x25')]);_0x54a466[_0x998d('0x29')]=_[_0x998d('0x28')](_0x417549[_0x998d('0x24')],qs[_0x998d('0x2a')](_0x5f4146[_0x998d('0x25')][_0x998d('0x2a')]));_0x54a466[_0x998d('0x29')]=_0x54a466[_0x998d('0x29')][_0x998d('0x2b')]?_0x54a466[_0x998d('0x29')]:_0x417549['model'];if(!_0x5f4146[_0x998d('0x25')][_0x998d('0x2c')](_0x998d('0x2d'))){_0x54a466[_0x998d('0x16')]=qs[_0x998d('0x16')](_0x5f4146[_0x998d('0x25')][_0x998d('0x16')]);_0x54a466[_0x998d('0x14')]=qs[_0x998d('0x14')](_0x5f4146['query']['offset']);}_0x54a466[_0x998d('0x2e')]=qs[_0x998d('0x2f')](_0x5f4146[_0x998d('0x25')][_0x998d('0x2f')]);_0x54a466[_0x998d('0x30')]=qs['filters'](_[_0x998d('0x31')](_0x5f4146[_0x998d('0x25')],_0x417549[_0x998d('0x27')]),_0x1f3c91);if(_0x5f4146[_0x998d('0x25')][_0x998d('0x32')]){_0x54a466['where']=_[_0x998d('0x33')](_0x54a466[_0x998d('0x30')],{'$or':_[_0x998d('0x1f')](_0x1f3c91,function(_0x5e8b9a){if(_0x5e8b9a[_0x998d('0x34')]!=='VIRTUAL'){var _0x1f670a={};_0x1f670a[_0x5e8b9a[_0x998d('0x1c')]]={'$like':'%'+_0x5f4146[_0x998d('0x25')][_0x998d('0x32')]+'%'};return _0x1f670a;}})});}_0x54a466=_[_0x998d('0x33')]({},_0x54a466,_0x5f4146['options']);var _0x12e577={'where':_0x54a466['where']};return db['Network'][_0x998d('0x35')](_0x12e577)['then'](function(_0x17a530){_0x166bb6[_0x998d('0x35')]=_0x17a530;if(_0x5f4146[_0x998d('0x25')][_0x998d('0x36')]){_0x54a466[_0x998d('0x37')]=[{'all':!![]}];}return db[_0x998d('0x20')][_0x998d('0x38')](_0x54a466);})[_0x998d('0x9')](function(_0x4eb930){_0x166bb6[_0x998d('0x39')]=_0x4eb930;return _0x166bb6;})[_0x998d('0x9')](respondWithFilteredResult(_0x4d8265,_0x54a466))['catch'](handleError(_0x4d8265,null));};exports['show']=function(_0x5836c2,_0x39bbbd){var _0x154580={'raw':!![],'where':{'id':_0x5836c2[_0x998d('0x3a')]['id']}},_0x5909cf={};_0x5909cf['model']=_[_0x998d('0x26')](db[_0x998d('0x20')]['rawAttributes']);_0x5909cf[_0x998d('0x25')]=_[_0x998d('0x26')](_0x5836c2['query']);_0x5909cf[_0x998d('0x27')]=_[_0x998d('0x28')](_0x5909cf[_0x998d('0x24')],_0x5909cf[_0x998d('0x25')]);_0x154580[_0x998d('0x29')]=_[_0x998d('0x28')](_0x5909cf[_0x998d('0x24')],qs[_0x998d('0x2a')](_0x5836c2[_0x998d('0x25')][_0x998d('0x2a')]));_0x154580[_0x998d('0x29')]=_0x154580[_0x998d('0x29')]['length']?_0x154580[_0x998d('0x29')]:_0x5909cf[_0x998d('0x24')];if(_0x5836c2[_0x998d('0x25')][_0x998d('0x36')]){_0x154580[_0x998d('0x37')]=[{'all':!![]}];}_0x154580=_[_0x998d('0x33')]({},_0x154580,_0x5836c2['options']);return db[_0x998d('0x20')][_0x998d('0x3b')](_0x154580)[_0x998d('0x9')](handleEntityNotFound(_0x39bbbd,null))[_0x998d('0x9')](respondWithResult(_0x39bbbd,null))[_0x998d('0x3c')](handleError(_0x39bbbd,null));};exports[_0x998d('0x3d')]=function(_0x38dc09,_0x4d8ab2){var _0x1a83ea;return db[_0x998d('0x20')][_0x998d('0x3d')](_0x38dc09[_0x998d('0x3e')],{'raw':!![]})[_0x998d('0x9')](function(_0x5a3d66){_0x1a83ea=_0x5a3d66;return db[_0x998d('0x20')][_0x998d('0x38')]({'where':{'type':_0x38dc09[_0x998d('0x3e')]['type']},'raw':!![]});})[_0x998d('0x9')](function(_0x4fd227){if(_0x1a83ea[_0x998d('0x34')][_0x998d('0x3f')]()==_0x998d('0x40')){var _0x4c652a=fs[_0x998d('0x41')](path[_0x998d('0x42')](config['root'],_0x998d('0x43')),'utf8');var _0x565cf5=ejs['render'](_0x4c652a,{'networks':_0x4fd227||[]});fs['writeFileSync'](_0x998d('0x44'),_0x565cf5);return respondWithRpcPromise('Reload',_0x998d('0x3d'),{'module':_0x998d('0x45')});}else if(_0x1a83ea['type'][_0x998d('0x3f')]()=='TURN'){var _0x230986=fs[_0x998d('0x41')](path[_0x998d('0x42')](config[_0x998d('0x46')],_0x998d('0x47')),_0x998d('0x48'));var _0x2db33a=ejs[_0x998d('0x49')](_0x230986,{'networks':_0x4fd227||[]});fs[_0x998d('0x4a')](_0x998d('0x4b'),_0x2db33a);return respondWithRpcPromise(_0x998d('0x4c'),_0x998d('0x3d'),{'module':'res_stun_monitor.so'});}else{var _0x33eb89=fs[_0x998d('0x41')](path['join'](config[_0x998d('0x46')],_0x998d('0x4d')),_0x998d('0x48'));var _0x261818=ejs[_0x998d('0x49')](_0x33eb89,{'networks':_0x4fd227||[]});fs['writeFileSync'](util[_0x998d('0x4e')](_0x998d('0x4f'),_0x38dc09[_0x998d('0x3e')]['type'][_0x998d('0x50')]()),_0x261818);return respondWithRpcPromise(_0x998d('0x4c'),_0x998d('0x3d'),{'module':'chan_sip.so'});}})[_0x998d('0x9')](function(){return _0x1a83ea;})[_0x998d('0x9')](respondWithResult(_0x4d8ab2,0xc9))[_0x998d('0x3c')](handleError(_0x4d8ab2,null));};exports[_0x998d('0x51')]=function(_0x3a0b33,_0x3b8f06){var _0xa75524;return db[_0x998d('0x20')][_0x998d('0x3b')]({'where':{'id':_0x3a0b33[_0x998d('0x3a')]['id']}})[_0x998d('0x9')](handleEntityNotFound(_0x3b8f06,null))[_0x998d('0x9')](saveUpdates(_0x3a0b33[_0x998d('0x3e')],null))['then'](function(_0x12a693){if(_0x12a693){_0xa75524=_0x12a693;return db[_0x998d('0x20')][_0x998d('0x38')]({'where':{'type':_0xa75524[_0x998d('0x34')]},'raw':!![]});}return null;})[_0x998d('0x9')](function(_0x4816dd){if(_0xa75524['type']['toUpperCase']()=='STUN'){var _0x4efdd0=fs[_0x998d('0x41')](path[_0x998d('0x42')](config[_0x998d('0x46')],_0x998d('0x43')),_0x998d('0x48'));var _0x5703b4=ejs[_0x998d('0x49')](_0x4efdd0,{'networks':_0x4816dd||[]});fs[_0x998d('0x4a')]('/etc/asterisk/stun_xcally.conf',_0x5703b4);return respondWithRpcPromise(_0x998d('0x4c'),_0x998d('0x51'),{'module':'res_stun_monitor.so'});}else if(_0xa75524[_0x998d('0x34')]['toUpperCase']()==_0x998d('0x52')){var _0x327446=fs[_0x998d('0x41')](path[_0x998d('0x42')](config[_0x998d('0x46')],_0x998d('0x47')),_0x998d('0x48'));var _0xa055a7=ejs[_0x998d('0x49')](_0x327446,{'networks':_0x4816dd||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xa055a7);return respondWithRpcPromise(_0x998d('0x4c'),_0x998d('0x51'),{'module':_0x998d('0x45')});}else{var _0x181a3f=fs['readFileSync'](path[_0x998d('0x42')](config[_0x998d('0x46')],_0x998d('0x4d')),_0x998d('0x48'));var _0xc8d523=ejs[_0x998d('0x49')](_0x181a3f,{'networks':_0x4816dd||[]});fs['writeFileSync'](util[_0x998d('0x4e')](_0x998d('0x4f'),_0x3a0b33[_0x998d('0x3e')][_0x998d('0x34')][_0x998d('0x50')]()),_0xc8d523);return respondWithRpcPromise(_0x998d('0x4c'),'update',{'module':_0x998d('0x53')});}})[_0x998d('0x9')](function(_0x4cf38b){if(_0x4cf38b){return _0xa75524;}return null;})[_0x998d('0x9')](respondWithResult(_0x3b8f06,null))[_0x998d('0x3c')](handleError(_0x3b8f06,null));};exports[_0x998d('0x54')]=function(_0x5e22f3,_0x3a612e){var _0x240ee1;return db[_0x998d('0x20')][_0x998d('0x3b')]({'where':{'id':_0x5e22f3[_0x998d('0x3a')]['id']}})[_0x998d('0x9')](function(_0x223467){_0x240ee1=_0x223467;return _0x223467;})[_0x998d('0x9')](handleEntityNotFound(_0x3a612e,null))['then'](removeEntity(_0x3a612e,null))[_0x998d('0x9')](function(){if(_0x240ee1){return db[_0x998d('0x20')]['findAll']({'where':{'type':_0x240ee1[_0x998d('0x34')]},'raw':!![]});}})['then'](function(_0x465655){if(_0x240ee1[_0x998d('0x34')][_0x998d('0x3f')]()==_0x998d('0x40')){var _0x1cbef7=fs[_0x998d('0x41')](path[_0x998d('0x42')](config[_0x998d('0x46')],'server/files/templates/stun_multiple.ejs'),_0x998d('0x48'));var _0x334b90=ejs[_0x998d('0x49')](_0x1cbef7,{'networks':_0x465655||[]});fs[_0x998d('0x4a')](_0x998d('0x44'),_0x334b90);return respondWithRpcPromise(_0x998d('0x4c'),_0x998d('0x54'),{'module':'res_stun_monitor.so'});}else if(_0x240ee1[_0x998d('0x34')]['toUpperCase']()=='TURN'){var _0x281dfb=fs[_0x998d('0x41')](path[_0x998d('0x42')](config['root'],_0x998d('0x47')),_0x998d('0x48'));var _0x12494b=ejs[_0x998d('0x49')](_0x281dfb,{'networks':_0x465655||[]});fs[_0x998d('0x4a')](_0x998d('0x4b'),_0x12494b);return respondWithRpcPromise(_0x998d('0x4c'),_0x998d('0x54'),{'module':_0x998d('0x45')});}else{var _0x507dec=fs[_0x998d('0x41')](path[_0x998d('0x42')](config[_0x998d('0x46')],_0x998d('0x4d')),'utf8');var _0x13e115=ejs['render'](_0x507dec,{'networks':_0x465655||[]});fs[_0x998d('0x4a')](util[_0x998d('0x4e')](_0x998d('0x4f'),_0x240ee1[_0x998d('0x34')][_0x998d('0x50')]()),_0x13e115);return respondWithRpcPromise(_0x998d('0x4c'),_0x998d('0x54'),{'module':_0x998d('0x53')});}})[_0x998d('0x3c')](handleError(_0x3a612e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 39e74c3..f58b544 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 _0xc3fe=['request-promise','rimraf','../../config/environment','./network.attributes','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x12dd87,_0x5929c7){var _0x5f2132=function(_0x199816){while(--_0x199816){_0x12dd87['push'](_0x12dd87['shift']());}};_0x5f2132(++_0x5929c7);}(_0xc3fe,0xff));var _0xec3f=function(_0xbbee20,_0x44e08f){_0xbbee20=_0xbbee20-0x0;var _0x505e14=_0xc3fe[_0xbbee20];return _0x505e14;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var logger=require(_0xec3f('0x2'))('api');var moment=require(_0xec3f('0x3'));var BPromise=require(_0xec3f('0x4'));var rp=require(_0xec3f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec3f('0x6'));var config=require(_0xec3f('0x7'));var attributes=require(_0xec3f('0x8'));module['exports']=function(_0x4fb9aa,_0x2d5b29){return _0x4fb9aa[_0xec3f('0x9')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7c8=['request-promise','path','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','api','moment','bluebird'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xb7c8,0x119));var _0x8b7c=function(_0x4271f9,_0x333b46){_0x4271f9=_0x4271f9-0x0;var _0x18dbc0=_0xb7c8[_0x4271f9];return _0x18dbc0;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'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 beef1bd..a9001a3 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x21f574,_0x407f06){_0x21f574=_0x21f574-0x0;var _0x2279ae=_0x7a54[_0x21f574];return _0x2279ae;};'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(_0x1dc5c0,_0x2b4dd8){_0x1dc5c0=_0x1dc5c0-0x0;var _0x2327fe=_0x7a54[_0x1dc5c0];return _0x2327fe;};'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 aa3b78e..82e4c79 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 _0x5430=['/:id/interactions','getInteractions','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x6ec16,_0x2e8212){var _0x2b62ac=function(_0x3aa462){while(--_0x3aa462){_0x6ec16['push'](_0x6ec16['shift']());}};_0x2b62ac(++_0x2e8212);}(_0x5430,0x10c));var _0x0543=function(_0x37adb6,_0x301243){_0x37adb6=_0x37adb6-0x0;var _0x35723c=_0x5430[_0x37adb6];return _0x35723c;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0x7')]('/:id/dispositions',auth[_0x0543('0x8')](),controller[_0x0543('0xe')]);router['get'](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x10')]);router[_0x0543('0x7')](_0x0543('0x11'),auth[_0x0543('0x8')](),controller[_0x0543('0x12')]);router[_0x0543('0x7')](_0x0543('0x13'),auth[_0x0543('0x8')](),controller[_0x0543('0x14')]);router[_0x0543('0x7')]('/:id/users',auth[_0x0543('0x8')](),controller[_0x0543('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0543('0x16')]);router[_0x0543('0x17')](_0x0543('0x18'),auth[_0x0543('0x8')](),controller[_0x0543('0x19')]);router['post'](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x1a')]);router[_0x0543('0x17')](_0x0543('0x1b'),controller[_0x0543('0x1c')]);router[_0x0543('0x17')]('/:id/applications',auth[_0x0543('0x8')](),controller['addApplications']);router['post'](_0x0543('0x1d'),auth[_0x0543('0x8')](),controller[_0x0543('0x1e')]);router['post'](_0x0543('0x1f'),auth['isAuthenticated'](),controller[_0x0543('0x20')]);router[_0x0543('0x21')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0x22')]);router[_0x0543('0x23')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0x24')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0543('0x25')]);router[_0x0543('0x23')](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x26')]);router[_0x0543('0x23')](_0x0543('0x1d'),auth[_0x0543('0x8')](),controller[_0x0543('0x27')]);module[_0x0543('0x28')]=router; \ No newline at end of file +var _0x5464=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','post','create','addDisposition','addAnswer','addApplications','/:id/users','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated'];(function(_0x1b8ba0,_0x3b574e){var _0x15d48b=function(_0x3936f4){while(--_0x3936f4){_0x1b8ba0['push'](_0x1b8ba0['shift']());}};_0x15d48b(++_0x3b574e);}(_0x5464,0x15d));var _0x4546=function(_0x3ebbaa,_0xff2933){_0x3ebbaa=_0x3ebbaa-0x0;var _0x1d955f=_0x5464[_0x3ebbaa];return _0x1d955f;};'use strict';var multer=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var timeout=require('connect-timeout');var express=require(_0x4546('0x3'));var router=express['Router']();var fs_extra=require(_0x4546('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var controller=require(_0x4546('0x7'));router[_0x4546('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4546('0x9'),auth[_0x4546('0xa')](),controller[_0x4546('0xb')]);router[_0x4546('0x8')](_0x4546('0xc'),auth[_0x4546('0xa')](),controller[_0x4546('0xd')]);router[_0x4546('0x8')](_0x4546('0xe'),auth['isAuthenticated'](),controller[_0x4546('0xf')]);router[_0x4546('0x8')](_0x4546('0x10'),auth['isAuthenticated'](),controller[_0x4546('0x11')]);router[_0x4546('0x8')](_0x4546('0x12'),auth[_0x4546('0xa')](),controller['getApplications']);router['get'](_0x4546('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x4546('0x14')]('/',auth['isAuthenticated'](),controller[_0x4546('0x15')]);router['post'](_0x4546('0xe'),auth['isAuthenticated'](),controller[_0x4546('0x16')]);router[_0x4546('0x14')](_0x4546('0x10'),auth[_0x4546('0xa')](),controller[_0x4546('0x17')]);router[_0x4546('0x14')]('/:id/notify',controller['notify']);router['post'](_0x4546('0x12'),auth[_0x4546('0xa')](),controller[_0x4546('0x18')]);router[_0x4546('0x14')](_0x4546('0x19'),auth[_0x4546('0xa')](),controller[_0x4546('0x1a')]);router[_0x4546('0x14')](_0x4546('0x1b'),auth[_0x4546('0xa')](),controller['send']);router[_0x4546('0x1c')](_0x4546('0xc'),auth['isAuthenticated'](),controller[_0x4546('0x1d')]);router[_0x4546('0x1e')](_0x4546('0xc'),auth[_0x4546('0xa')](),controller[_0x4546('0x1f')]);router[_0x4546('0x1e')]('/:id/dispositions',auth[_0x4546('0xa')](),controller[_0x4546('0x20')]);router['delete'](_0x4546('0x10'),auth[_0x4546('0xa')](),controller[_0x4546('0x21')]);router[_0x4546('0x1e')](_0x4546('0x19'),auth['isAuthenticated'](),controller[_0x4546('0x22')]);module[_0x4546('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 4be434a..f64b298 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 _0x9919=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0xe7dfa7,_0x3d17ee){var _0x1a9fbf=function(_0x2ef98a){while(--_0x2ef98a){_0xe7dfa7['push'](_0xe7dfa7['shift']());}};_0x1a9fbf(++_0x3d17ee);}(_0x9919,0x1b1));var _0x9991=function(_0x163977,_0x4ef72e){_0x163977=_0x163977-0x0;var _0x28bf3a=_0x9919[_0x163977];return _0x28bf3a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9991('0x0'));module[_0x9991('0x1')]={'name':{'type':Sequelize[_0x9991('0x2')],'unique':_0x9991('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9991('0x2')]},'token':{'type':Sequelize[_0x9991('0x2')],'defaultValue':function(){return rs[_0x9991('0x4')]();}},'replyUri':{'type':Sequelize[_0x9991('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9991('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9991('0x5')],'defaultValue':function(){return _0x9991('0x6');}},'notificationSound':{'type':Sequelize[_0x9991('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9991('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9991('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9991('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9991('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9991('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x9991('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x9991('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x43ea34){if(!_0x43ea34)this[_0x9991('0xa')](_0x9991('0xb'),null);this[_0x9991('0xa')](_0x9991('0xc'),_0x43ea34);}}}; \ No newline at end of file +var _0x6a02=['name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x47bdae,_0x7d9236){var _0x1bcf04=function(_0x5d7d4b){while(--_0x5d7d4b){_0x47bdae['push'](_0x47bdae['shift']());}};_0x1bcf04(++_0x7d9236);}(_0x6a02,0x1dc));var _0x26a0=function(_0x4c093a,_0x5451f2){_0x4c093a=_0x4c093a-0x0;var _0x2a832e=_0x6a02[_0x4c093a];return _0x2a832e;};'use strict';var Sequelize=require(_0x26a0('0x0'));var rs=require(_0x26a0('0x1'));module[_0x26a0('0x2')]={'name':{'type':Sequelize[_0x26a0('0x3')],'unique':_0x26a0('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x26a0('0x3')]},'token':{'type':Sequelize[_0x26a0('0x3')],'defaultValue':function(){return rs[_0x26a0('0x5')]();}},'replyUri':{'type':Sequelize[_0x26a0('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x26a0('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x26a0('0x6');}},'notificationSound':{'type':Sequelize[_0x26a0('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x26a0('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x26a0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x26a0('0x3')]},'queueTransfer':{'type':Sequelize[_0x26a0('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x26a0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x26a0('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26a0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26a0('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x26a0('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x26a0('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xeee0b3){if(!_0xeee0b3)this['setDataValue'](_0x26a0('0xa'),null);this['setDataValue'](_0x26a0('0xb'),_0xeee0b3);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4c069cf..f21a1f2 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 _0xa23f=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find','autoAssociation','addDisposition','Disposition','getDispositions','OpenchannelAccountId','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','openchannel','CmContact','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','Start','startRouting','EventManager','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','order','getInteractions','Contact','Owner','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./openchannelAccount.socket','register','jayson/promise','http','client','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','end','status','json','undefined','offset','count','limit','set','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xa23f,0x7c));var _0xfa23=function(_0x357a38,_0x304f09){_0x357a38=_0x357a38-0x0;var _0x819481=_0xa23f[_0x357a38];return _0x819481;};'use strict';var emlformat=require(_0xfa23('0x0'));var rimraf=require(_0xfa23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa23('0x2'));var moment=require(_0xfa23('0x3'));var BPromise=require(_0xfa23('0x4'));var Mustache=require(_0xfa23('0x5'));var util=require('util');var path=require(_0xfa23('0x6'));var sox=require('sox');var csv=require(_0xfa23('0x7'));var ejs=require(_0xfa23('0x8'));var fs=require('fs');var fs_extra=require(_0xfa23('0x9'));var _=require(_0xfa23('0xa'));var squel=require('squel');var crypto=require(_0xfa23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa23('0xc'));var toCsv=require(_0xfa23('0x7'));var querystring=require(_0xfa23('0xd'));var Papa=require(_0xfa23('0xe'));var Redis=require(_0xfa23('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa23('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa23('0x11'))('api');var utils=require(_0xfa23('0x12'));var config=require(_0xfa23('0x13'));var licenseUtil=require(_0xfa23('0x14'));var db=require('../../mysqldb')['db'];config[_0xfa23('0x15')]=_[_0xfa23('0x16')](config[_0xfa23('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa23('0x15')]));require(_0xfa23('0x17'))[_0xfa23('0x18')](socket);var jayson=require(_0xfa23('0x19'));var client=jayson['client'][_0xfa23('0x1a')]({'port':0x232c});var client9002=jayson[_0xfa23('0x1b')][_0xfa23('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x9611e0,_0x542d9a,_0x1c4882,_0x39729e){return new BPromise(function(_0x3ca6be,_0x375f5a){var _0x3fa5f6=_0x39729e||client;return _0x3fa5f6['request'](_0x9611e0,_0x1c4882)['then'](function(_0x5c3c6d){logger[_0xfa23('0x1c')](_0xfa23('0x1d'),_0x542d9a,'request\x20sent');logger[_0xfa23('0x1e')](_0xfa23('0x1f'),_0x542d9a,_0xfa23('0x20'),JSON['stringify'](_0x5c3c6d));if(_0x5c3c6d[_0xfa23('0x21')]){if(_0x5c3c6d[_0xfa23('0x21')]['code']===0x1f4){logger[_0xfa23('0x21')](_0xfa23('0x1d'),_0x542d9a,_0x5c3c6d[_0xfa23('0x21')][_0xfa23('0x22')]);return _0x375f5a(_0x5c3c6d[_0xfa23('0x21')][_0xfa23('0x22')]);}logger[_0xfa23('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x542d9a,_0x5c3c6d[_0xfa23('0x21')][_0xfa23('0x22')]);return _0x3ca6be(_0x5c3c6d[_0xfa23('0x21')][_0xfa23('0x22')]);}else{logger['info'](_0xfa23('0x1d'),_0x542d9a,'request\x20sent');_0x3ca6be(_0x5c3c6d[_0xfa23('0x23')][_0xfa23('0x22')]);}})[_0xfa23('0x24')](function(_0x26bdce){logger[_0xfa23('0x21')](_0xfa23('0x1d'),_0x542d9a,_0x26bdce);_0x375f5a(_0x26bdce);});});}function respondWithStatusCode(_0x21bbc0,_0x499407){_0x499407=_0x499407||0xcc;return function(_0x5e1780){if(_0x5e1780){return _0x21bbc0[_0xfa23('0x25')](_0x499407);}return _0x21bbc0['status'](_0x499407)[_0xfa23('0x26')]();};}function respondWithResult(_0x5de208,_0x4ea972){_0x4ea972=_0x4ea972||0xc8;return function(_0x35b493){if(_0x35b493){return _0x5de208[_0xfa23('0x27')](_0x4ea972)[_0xfa23('0x28')](_0x35b493);}};}function respondWithFilteredResult(_0x3b00a8,_0x374169){return function(_0x24da31){if(_0x24da31){var _0x3c9d9d=typeof _0x374169['offset']===_0xfa23('0x29')&&typeof _0x374169['limit']===_0xfa23('0x29');var _0x6bf719=_0x24da31['count'];var _0x1c83d0=_0x3c9d9d?0x0:_0x374169[_0xfa23('0x2a')];var _0xf9c420=_0x3c9d9d?_0x24da31[_0xfa23('0x2b')]:_0x374169[_0xfa23('0x2a')]+_0x374169[_0xfa23('0x2c')];var _0x2d3564;if(_0xf9c420>=_0x6bf719){_0xf9c420=_0x6bf719;_0x2d3564=0xc8;}else{_0x2d3564=0xce;}_0x3b00a8[_0xfa23('0x27')](_0x2d3564);return _0x3b00a8[_0xfa23('0x2d')]('Content-Range',_0x1c83d0+'-'+_0xf9c420+'/'+_0x6bf719)[_0xfa23('0x28')](_0x24da31);}return null;};}function patchUpdates(_0x59c393){return function(_0x9d0602){try{jsonpatch[_0xfa23('0x2e')](_0x9d0602,_0x59c393,!![]);}catch(_0x451e40){return BPromise[_0xfa23('0x2f')](_0x451e40);}return _0x9d0602[_0xfa23('0x30')]();};}function saveUpdates(_0x8ac724,_0x18f549){return function(_0x33aa43){if(_0x33aa43){return _0x33aa43[_0xfa23('0x31')](_0x8ac724)['then'](function(_0x1571f8){return _0x1571f8;});}return null;};}function removeEntity(_0x4e82a3,_0x2709f9){return function(_0x88a593){if(_0x88a593){return _0x88a593[_0xfa23('0x32')]()[_0xfa23('0x33')](function(){var _0x3fed37=_0x88a593[_0xfa23('0x34')]({'plain':!![]});var _0x304c56='OpenchannelAccounts';return db[_0xfa23('0x35')][_0xfa23('0x32')]({'where':{'type':_0x304c56,'resourceId':_0x3fed37['id']}})[_0xfa23('0x33')](function(){return _0x88a593;});})[_0xfa23('0x33')](function(){_0x4e82a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5179a3,_0x4528cb){return function(_0x3e004f){if(!_0x3e004f){_0x5179a3['sendStatus'](0x194);}return _0x3e004f;};}function handleError(_0x22fd83,_0x4492ea){_0x4492ea=_0x4492ea||0x1f4;return function(_0x9d0ca0){logger['error'](_0x9d0ca0[_0xfa23('0x36')]);if(_0x9d0ca0['name']){delete _0x9d0ca0[_0xfa23('0x37')];}_0x22fd83[_0xfa23('0x27')](_0x4492ea)[_0xfa23('0x38')](_0x9d0ca0);};}exports[_0xfa23('0x39')]=function(_0x1bc029,_0x80827f){var _0x58fc41={'include':[{'model':db[_0xfa23('0x3a')],'as':_0xfa23('0x3b')}]},_0xe546db={},_0x3c4743={'count':0x0,'rows':[]};var _0x48c3a4=_[_0xfa23('0x3c')](db[_0xfa23('0x3d')][_0xfa23('0x3e')],function(_0x41682e){return{'name':_0x41682e[_0xfa23('0x3f')],'type':_0x41682e[_0xfa23('0x40')]['key']};});_0xe546db[_0xfa23('0x41')]=_['map'](_0x48c3a4,'name');_0xe546db[_0xfa23('0x42')]=_[_0xfa23('0x43')](_0x1bc029['query']);_0xe546db[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0xe546db[_0xfa23('0x41')],_0xe546db['query']);_0x58fc41[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0xe546db[_0xfa23('0x41')],qs['fields'](_0x1bc029['query'][_0xfa23('0x47')]));_0x58fc41['attributes']=_0x58fc41[_0xfa23('0x46')][_0xfa23('0x48')]?_0x58fc41[_0xfa23('0x46')]:_0xe546db['model'];if(!_0x1bc029[_0xfa23('0x42')][_0xfa23('0x49')](_0xfa23('0x4a'))){_0x58fc41[_0xfa23('0x2c')]=qs['limit'](_0x1bc029[_0xfa23('0x42')][_0xfa23('0x2c')]);_0x58fc41[_0xfa23('0x2a')]=qs['offset'](_0x1bc029['query'][_0xfa23('0x2a')]);}_0x58fc41['order']=qs[_0xfa23('0x4b')](_0x1bc029[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x58fc41[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0x1bc029['query'],_0xe546db[_0xfa23('0x44')]),_0x48c3a4);if(_0x1bc029[_0xfa23('0x42')][_0xfa23('0x4e')]){_0x58fc41[_0xfa23('0x4c')]=_[_0xfa23('0x4f')](_0x58fc41[_0xfa23('0x4c')],{'$or':_['map'](_0x48c3a4,function(_0x9e8cb6){if(_0x9e8cb6[_0xfa23('0x40')]!==_0xfa23('0x50')){var _0x2f6a37={};_0x2f6a37[_0x9e8cb6[_0xfa23('0x37')]]={'$like':'%'+_0x1bc029['query'][_0xfa23('0x4e')]+'%'};return _0x2f6a37;}})});}_0x58fc41=_[_0xfa23('0x4f')]({},_0x58fc41,_0x1bc029[_0xfa23('0x51')]);var _0x5e4633={'where':_0x58fc41[_0xfa23('0x4c')]};return db[_0xfa23('0x3d')][_0xfa23('0x2b')](_0x5e4633)[_0xfa23('0x33')](function(_0xfe2115){_0x3c4743[_0xfa23('0x2b')]=_0xfe2115;if(_0x1bc029[_0xfa23('0x42')]['includeAll']){_0x58fc41[_0xfa23('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xfa23('0x53')](_0x58fc41);})[_0xfa23('0x33')](function(_0x3824a9){_0x3c4743[_0xfa23('0x54')]=_0x3824a9;return _0x3c4743;})[_0xfa23('0x33')](respondWithFilteredResult(_0x80827f,_0x58fc41))[_0xfa23('0x24')](handleError(_0x80827f,null));};exports['show']=function(_0x2f355d,_0x2b7628){var _0x2ec20b={'raw':![],'where':{'id':_0x2f355d[_0xfa23('0x55')]['id']},'include':[{'model':db[_0xfa23('0x3a')],'as':_0xfa23('0x3b')}]},_0x47459e={};_0x47459e['model']=_[_0xfa23('0x43')](db[_0xfa23('0x3d')][_0xfa23('0x3e')]);_0x47459e[_0xfa23('0x42')]=_['keys'](_0x2f355d[_0xfa23('0x42')]);_0x47459e[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x47459e[_0xfa23('0x41')],_0x47459e[_0xfa23('0x42')]);_0x2ec20b[_0xfa23('0x46')]=_['intersection'](_0x47459e[_0xfa23('0x41')],qs['fields'](_0x2f355d[_0xfa23('0x42')][_0xfa23('0x47')]));_0x2ec20b['attributes']=_0x2ec20b[_0xfa23('0x46')][_0xfa23('0x48')]?_0x2ec20b['attributes']:_0x47459e[_0xfa23('0x41')];if(_0x2f355d[_0xfa23('0x42')]['includeAll']){_0x2ec20b[_0xfa23('0x52')]=[{'all':!![]}];}_0x2ec20b=_[_0xfa23('0x4f')]({},_0x2ec20b,_0x2f355d[_0xfa23('0x51')]);return db[_0xfa23('0x3d')]['find'](_0x2ec20b)[_0xfa23('0x33')](handleEntityNotFound(_0x2b7628,null))[_0xfa23('0x33')](respondWithResult(_0x2b7628,null))['catch'](handleError(_0x2b7628,null));};exports[_0xfa23('0x56')]=function(_0x2322a3,_0x20bba5){return db[_0xfa23('0x3d')][_0xfa23('0x56')](_0x2322a3[_0xfa23('0x57')],{})['then'](function(_0x1924c7){var _0x3a7fcb=_0x2322a3[_0xfa23('0x58')]['get']({'plain':!![]});if(!_0x3a7fcb)throw new Error(_0xfa23('0x59'));if(_0x3a7fcb[_0xfa23('0x5a')]===_0xfa23('0x58')){var _0x51910e=_0x1924c7[_0xfa23('0x34')]({'plain':!![]});var _0x1e0f67=_0xfa23('0x5b');return db[_0xfa23('0x5c')][_0xfa23('0x5d')]({'where':{'name':_0x1e0f67,'userProfileId':_0x3a7fcb['userProfileId']},'raw':!![]})['then'](function(_0x20cde3){if(_0x20cde3&&_0x20cde3[_0xfa23('0x5e')]===0x0){return db[_0xfa23('0x35')][_0xfa23('0x56')]({'name':_0x51910e['name'],'resourceId':_0x51910e['id'],'type':_0x20cde3['name'],'sectionId':_0x20cde3['id']},{})[_0xfa23('0x33')](function(){return _0x1924c7;});}else{return _0x1924c7;}})[_0xfa23('0x24')](function(_0x38a265){logger[_0xfa23('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38a265);throw _0x38a265;});}return _0x1924c7;})[_0xfa23('0x33')](respondWithResult(_0x20bba5,0xc9))[_0xfa23('0x24')](handleError(_0x20bba5,null));};exports['update']=function(_0x16db28,_0x2f08be){if(_0x16db28['body']['id']){delete _0x16db28[_0xfa23('0x57')]['id'];}return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x16db28[_0xfa23('0x55')]['id']},'include':[{'model':db[_0xfa23('0x3a')],'as':_0xfa23('0x3b')}]})['then'](handleEntityNotFound(_0x2f08be,null))[_0xfa23('0x33')](saveUpdates(_0x16db28['body'],null))[_0xfa23('0x33')](respondWithResult(_0x2f08be,null))[_0xfa23('0x24')](handleError(_0x2f08be,null));};exports[_0xfa23('0x32')]=function(_0x1a8a80,_0x266c4a){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x1a8a80[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x266c4a,null))['then'](removeEntity(_0x266c4a,null))[_0xfa23('0x24')](handleError(_0x266c4a,null));};exports['describe']=function(_0x2e346d,_0xd14e5a){return db['OpenchannelAccount']['describe']()[_0xfa23('0x33')](respondWithResult(_0xd14e5a,null))['catch'](handleError(_0xd14e5a,null));};exports[_0xfa23('0x5f')]=function(_0x4fb4b5,_0x268494,_0x400fc9){if(_0x4fb4b5[_0xfa23('0x57')]['id']){delete _0x4fb4b5[_0xfa23('0x57')]['id'];}return db[_0xfa23('0x3d')]['find']({'where':{'id':_0x4fb4b5['params']['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x268494,null))[_0xfa23('0x33')](function(_0x83153f){if(_0x83153f){_0x4fb4b5[_0xfa23('0x57')]['OpenchannelAccountId']=_0x83153f['id'];return db[_0xfa23('0x60')]['create'](_0x4fb4b5[_0xfa23('0x57')]);}})[_0xfa23('0x33')](respondWithResult(_0x268494,null))[_0xfa23('0x24')](handleError(_0x268494,null));};exports[_0xfa23('0x61')]=function(_0x74a9aa,_0x3bf459,_0x19c67f){var _0x1b93f4={'raw':![],'where':{}};var _0x787989={};var _0x4130cf={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x74a9aa[_0xfa23('0x55')]['id']}})['then'](handleEntityNotFound(_0x3bf459,null))[_0xfa23('0x33')](function(_0x47e2ee){if(_0x47e2ee){_0x787989[_0xfa23('0x41')]=_[_0xfa23('0x43')](db['Disposition'][_0xfa23('0x3e')]);_0x787989['query']=_['keys'](_0x74a9aa[_0xfa23('0x42')]);_0x787989[_0xfa23('0x44')]=_['intersection'](_0x787989[_0xfa23('0x41')],_0x787989[_0xfa23('0x42')]);_0x1b93f4[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0x787989[_0xfa23('0x41')],qs[_0xfa23('0x47')](_0x74a9aa[_0xfa23('0x42')]['fields']));_0x1b93f4[_0xfa23('0x46')]=_0x1b93f4[_0xfa23('0x46')][_0xfa23('0x48')]?_0x1b93f4[_0xfa23('0x46')]:_0x787989[_0xfa23('0x41')];if(!_0x74a9aa['query'][_0xfa23('0x49')]('nolimit')){_0x1b93f4['limit']=qs['limit'](_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x2c')]);_0x1b93f4[_0xfa23('0x2a')]=qs['offset'](_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x2a')]);}_0x1b93f4['order']=qs[_0xfa23('0x4b')](_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x1b93f4[_0xfa23('0x4c')]=qs['filters'](_['pick'](_0x74a9aa[_0xfa23('0x42')],_0x787989['filters']));_0x1b93f4[_0xfa23('0x4c')][_0xfa23('0x62')]=_0x47e2ee['id'];if(_0x74a9aa[_0xfa23('0x42')]['filter']){_0x1b93f4[_0xfa23('0x4c')]=_[_0xfa23('0x4f')](_0x1b93f4[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x1b93f4[_0xfa23('0x46')],function(_0x4f95cf){var _0x5034ba={};_0x5034ba[_0x4f95cf]={'$like':'%'+_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x4e')]+'%'};return _0x5034ba;})});}_0x1b93f4=_[_0xfa23('0x4f')]({},_0x1b93f4,_0x74a9aa[_0xfa23('0x51')]);return db[_0xfa23('0x60')][_0xfa23('0x2b')]({'where':_0x1b93f4['where']})[_0xfa23('0x33')](function(_0x360f6f){_0x4130cf['count']=_0x360f6f;if(_0x74a9aa[_0xfa23('0x42')][_0xfa23('0x63')]){_0x1b93f4[_0xfa23('0x52')]=[{'all':!![]}];}return db[_0xfa23('0x60')][_0xfa23('0x53')](_0x1b93f4);})['then'](function(_0x231461){_0x4130cf['rows']=_0x231461;return _0x4130cf;});}})['then'](respondWithFilteredResult(_0x3bf459,_0x1b93f4))['catch'](handleError(_0x3bf459,null));};exports['removeDispositions']=function(_0x23349e,_0x50e6f5,_0x17cec3){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x23349e[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x50e6f5,null))[_0xfa23('0x33')](function(_0x23c6f4){if(_0x23c6f4){return _0x23c6f4[_0xfa23('0x64')](_0x23349e['query'][_0xfa23('0x65')]);}})['then'](respondWithStatusCode(_0x50e6f5,null))[_0xfa23('0x24')](handleError(_0x50e6f5,null));};exports[_0xfa23('0x66')]=function(_0x5ae0ab,_0x2c4684,_0x469be3){if(_0x5ae0ab['body']['id']){delete _0x5ae0ab[_0xfa23('0x57')]['id'];}return db['OpenchannelAccount'][_0xfa23('0x5d')]({'where':{'id':_0x5ae0ab['params']['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x2c4684,null))['then'](function(_0xea852){if(_0xea852){_0x5ae0ab[_0xfa23('0x57')]['OpenchannelAccountId']=_0xea852['id'];return db[_0xfa23('0x67')][_0xfa23('0x56')](_0x5ae0ab[_0xfa23('0x57')]);}})['then'](respondWithResult(_0x2c4684,null))[_0xfa23('0x24')](handleError(_0x2c4684,null));};exports['getAnswers']=function(_0xfee428,_0x1c5e30,_0x3c8176){var _0x1c6329={'raw':![],'where':{}};var _0x58f34e={};var _0x3e0a3e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xfa23('0x68')]({'where':{'id':_0xfee428['params']['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x1c5e30,null))[_0xfa23('0x33')](function(_0x70ba0f){if(_0x70ba0f){_0x58f34e[_0xfa23('0x41')]=_[_0xfa23('0x43')](db['CannedAnswer'][_0xfa23('0x3e')]);_0x58f34e['query']=_['keys'](_0xfee428[_0xfa23('0x42')]);_0x58f34e[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x58f34e[_0xfa23('0x41')],_0x58f34e['query']);_0x1c6329[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0x58f34e[_0xfa23('0x41')],qs[_0xfa23('0x47')](_0xfee428[_0xfa23('0x42')][_0xfa23('0x47')]));_0x1c6329[_0xfa23('0x46')]=_0x1c6329[_0xfa23('0x46')][_0xfa23('0x48')]?_0x1c6329[_0xfa23('0x46')]:_0x58f34e[_0xfa23('0x41')];if(!_0xfee428[_0xfa23('0x42')]['hasOwnProperty'](_0xfa23('0x4a'))){_0x1c6329[_0xfa23('0x2c')]=qs[_0xfa23('0x2c')](_0xfee428[_0xfa23('0x42')][_0xfa23('0x2c')]);_0x1c6329[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0xfee428['query'][_0xfa23('0x2a')]);}_0x1c6329['order']=qs['sort'](_0xfee428['query']['sort']);_0x1c6329[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0xfee428['query'],_0x58f34e[_0xfa23('0x44')]));_0x1c6329[_0xfa23('0x4c')][_0xfa23('0x62')]=_0x70ba0f['id'];if(_0xfee428[_0xfa23('0x42')][_0xfa23('0x4e')]){_0x1c6329['where']=_[_0xfa23('0x4f')](_0x1c6329[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x1c6329[_0xfa23('0x46')],function(_0xcaf538){var _0x2152a1={};_0x2152a1[_0xcaf538]={'$like':'%'+_0xfee428['query']['filter']+'%'};return _0x2152a1;})});}_0x1c6329=_['merge']({},_0x1c6329,_0xfee428['options']);return db[_0xfa23('0x67')][_0xfa23('0x2b')]({'where':_0x1c6329[_0xfa23('0x4c')]})[_0xfa23('0x33')](function(_0xed12f2){_0x3e0a3e['count']=_0xed12f2;if(_0xfee428[_0xfa23('0x42')][_0xfa23('0x63')]){_0x1c6329[_0xfa23('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfa23('0x53')](_0x1c6329);})['then'](function(_0x478c77){_0x3e0a3e[_0xfa23('0x54')]=_0x478c77;return _0x3e0a3e;});}})[_0xfa23('0x33')](respondWithFilteredResult(_0x1c5e30,_0x1c6329))[_0xfa23('0x24')](handleError(_0x1c5e30,null));};exports[_0xfa23('0x69')]=function(_0x47c4fd,_0x6bdaf0,_0x370cd0){return db['OpenchannelAccount'][_0xfa23('0x5d')]({'where':{'id':_0x47c4fd[_0xfa23('0x55')]['id']}})['then'](handleEntityNotFound(_0x6bdaf0,null))['then'](function(_0x1ca59c){if(_0x1ca59c){return _0x1ca59c['removeAnswers'](_0x47c4fd[_0xfa23('0x42')][_0xfa23('0x65')]);}})[_0xfa23('0x33')](respondWithStatusCode(_0x6bdaf0,null))[_0xfa23('0x24')](handleError(_0x6bdaf0,null));};exports[_0xfa23('0x6a')]=function(_0x3d566f,_0x26ce87,_0x1235e5){var _0x3e42dc={'body':_0x3d566f[_0xfa23('0x57')],'channel':_0xfa23('0x6b')};var _0x4c0059=[];var _0x2e33d5=[];var _0x9fb7c8={};var _0x48a314=![];return db[_0xfa23('0x6c')][_0xfa23('0x6d')]()[_0xfa23('0x33')](function(_0x293db0){if(!_0x293db0){throw new db['Sequelize']['ValidationError'](_0xfa23('0x6e'));}_0x4c0059=_[_0xfa23('0x6f')](_[_0xfa23('0x43')](_0x293db0),[_0xfa23('0x70'),'updatedAt']);_0x2e33d5=_['difference'](_[_0xfa23('0x43')](_0x293db0),[_0xfa23('0x70'),_0xfa23('0x71'),'CompanyId',_0xfa23('0x72')]);if(_0x3d566f[_0xfa23('0x57')]['id']){delete _0x3d566f['body']['id'];}if(_[_0xfa23('0x73')](_0x3d566f[_0xfa23('0x57')][_0xfa23('0x74')])){throw new db[(_0xfa23('0x75'))][(_0xfa23('0x76'))](_0xfa23('0x77'));}if(_[_0xfa23('0x73')](_0x3d566f[_0xfa23('0x57')][_0xfa23('0x57')])||_0x3d566f['body']['body']===''){throw new db[(_0xfa23('0x75'))][(_0xfa23('0x76'))](_0xfa23('0x78'));}if(_['isNil'](_0x3d566f[_0xfa23('0x57')][_0xfa23('0x79')])){throw new db[(_0xfa23('0x75'))][(_0xfa23('0x76'))](_0xfa23('0x7a')+_0x2e33d5);}if(!_[_0xfa23('0x7b')](_0x2e33d5,_0x3d566f[_0xfa23('0x57')][_0xfa23('0x79')])){throw new db['Sequelize'][(_0xfa23('0x76'))](_0xfa23('0x7c')+_0x2e33d5);}_0x9fb7c8[_0x3d566f[_0xfa23('0x57')][_0xfa23('0x79')]]=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x74')];})['then'](function(){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x3d566f['params']['id']},'include':[{'model':db[_0xfa23('0x7d')],'as':_0xfa23('0x7e'),'include':[{'model':db[_0xfa23('0x6c')],'as':_0xfa23('0x7f'),'where':_0x9fb7c8,'limit':0x1,'order':[[_0xfa23('0x71'),_0xfa23('0x80')]]}]},{'model':db[_0xfa23('0x81')],'as':_0xfa23('0x82')}]});})[_0xfa23('0x33')](handleEntityNotFound(_0x26ce87,null))[_0xfa23('0x33')](function(_0x3c0c1a){if(_0x3c0c1a&&_0x3c0c1a[_0xfa23('0x7e')]){_0x3e42dc[_0xfa23('0x83')]=_0x3c0c1a;_0x3e42dc[_0xfa23('0x84')]=_0x3c0c1a[_0xfa23('0x82')];_0x3e42dc[_0xfa23('0x85')]=_0x3c0c1a[_0xfa23('0x7e')];_0x3e42dc[_0xfa23('0x84')]=_[_0xfa23('0x86')](_0x3e42dc[_0xfa23('0x84')],[_0xfa23('0x87')],['asc']);if(_0x3e42dc[_0xfa23('0x83')][_0xfa23('0x82')]){delete _0x3e42dc[_0xfa23('0x83')][_0xfa23('0x82')];}if(_0x3e42dc[_0xfa23('0x83')]['List']&&_0x3e42dc[_0xfa23('0x83')][_0xfa23('0x7e')]['Contacts'][_0xfa23('0x48')]){return _0x3e42dc[_0xfa23('0x83')][_0xfa23('0x7e')][_0xfa23('0x7f')][0x0];}var _0x157e42=_[_0xfa23('0x16')](_0x3d566f['body'],{'firstName':_0x3d566f[_0xfa23('0x57')][_0xfa23('0x74')],'ListId':_0x3c0c1a[_0xfa23('0x72')]});_0x157e42[_0x3d566f[_0xfa23('0x57')][_0xfa23('0x79')]]=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x74')];return db[_0xfa23('0x6c')][_0xfa23('0x56')](_0x157e42,{'fields':_0x4c0059,'raw':!![]});}})['then'](handleEntityNotFound(_0x26ce87,null))[_0xfa23('0x33')](function(_0x166783){_0x3e42dc[_0xfa23('0x88')]=_0x166783;if(_0x166783){var _0x49d5f3={'ContactId':_0x166783['id'],'OpenchannelAccountId':_0x3d566f[_0xfa23('0x55')]['id'],'from':(_0x166783[_0xfa23('0x89')]||'')+'\x20'+(_0x166783[_0xfa23('0x8a')]||'')};var _0x2a52ad={'OpenchannelAccountId':_0x3d566f[_0xfa23('0x55')]['id'],'closed':![]};if(_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')]){_0x2a52ad[_0xfa23('0x8b')]=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')];return db['OpenchannelInteraction'][_0xfa23('0x5d')]({'where':_0x2a52ad})[_0xfa23('0x33')](function(_0x5600de){if(_0x5600de){return[_0x5600de,![]];}_0x49d5f3['threadId']=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')];_0x49d5f3[_0xfa23('0x8c')]=_0x3d566f[_0xfa23('0x57')]['externalUrl'];return db[_0xfa23('0x8d')]['create'](_0x49d5f3)[_0xfa23('0x33')](function(_0x59ca8a){return[_0x59ca8a,!![]];});});}else{_0x2a52ad[_0xfa23('0x8b')]=null;}_0x2a52ad[_0xfa23('0x8e')]=_0x166783['id'];return db['OpenchannelInteraction'][_0xfa23('0x5d')]({'where':_0x2a52ad})[_0xfa23('0x33')](function(_0x46d1ca){if(_0x46d1ca){return[_0x46d1ca,![]];}return db[_0xfa23('0x8d')][_0xfa23('0x56')](_0x49d5f3)[_0xfa23('0x33')](function(_0x31ce88){return[_0x31ce88,!![]];});});}})[_0xfa23('0x8f')](function(_0x5ed24f,_0x4cf772){if(_0x5ed24f){_0x48a314=_0x4cf772;if(!_0x4cf772){var _0x38be7d={'from':(_0x3e42dc[_0xfa23('0x88')][_0xfa23('0x89')]||'')+'\x20'+(_0x3e42dc[_0xfa23('0x88')][_0xfa23('0x8a')]||'')};if(_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')]&&_0x3d566f[_0xfa23('0x57')][_0xfa23('0x90')]&&_0x3d566f[_0xfa23('0x57')][_0xfa23('0x8b')]!=_0x3d566f[_0xfa23('0x57')][_0xfa23('0x90')]){_0x38be7d[_0xfa23('0x8b')]=_0x3d566f[_0xfa23('0x57')]['messageId'];}return _0x5ed24f['update'](_0x38be7d);}else{return _0x5ed24f;}}})['then'](function(_0x113257){_0x3e42dc['interaction']=_0x113257[_0xfa23('0x34')]({'plain':!![]});_0x3e42dc[_0xfa23('0x91')][_0xfa23('0x92')]=_0x48a314;if(_0x3e42dc[_0xfa23('0x91')]['created']){if(_0x3e42dc[_0xfa23('0x83')]['autoclose']){_0x3e42dc[_0xfa23('0x84')]['push']({'id':0x0,'priority':_0x3e42dc[_0xfa23('0x84')][_0xfa23('0x48')]+0x1,'app':_0xfa23('0x93'),'appdata':_0xfa23('0x94'),'interval':_0xfa23('0x95')});}}return db[_0xfa23('0x96')][_0xfa23('0x56')]({'body':_0x3d566f[_0xfa23('0x57')]['body'],'OpenchannelAccountId':_0x3d566f[_0xfa23('0x55')]['id'],'OpenchannelInteractionId':_0x113257['id'],'direction':'in','ContactId':_0x3e42dc[_0xfa23('0x88')]['id'],'AttachmentId':_0x3d566f[_0xfa23('0x57')][_0xfa23('0x97')]});})['then'](function(_0x149a15){_0x3e42dc[_0xfa23('0x22')]=_0x149a15;if(!_0x3e42dc[_0xfa23('0x91')][_0xfa23('0x98')])return;return db[_0xfa23('0x99')][_0xfa23('0x5d')]({'attributes':['id',_0xfa23('0x37')],'where':{'id':_0x3e42dc[_0xfa23('0x91')][_0xfa23('0x98')]}});})['then'](function(_0x22e4bf){if(_0x22e4bf){_0x3e42dc[_0xfa23('0x84')][_0xfa23('0x9a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x22e4bf['name']+','+(_0x3e42dc[_0xfa23('0x83')][_0xfa23('0x9b')]||0xa),'interval':_0xfa23('0x95')});}if(!_0x3e42dc[_0xfa23('0x91')][_0xfa23('0x9c')])return;return db[_0xfa23('0x9d')]['find']({'attributes':['id',_0xfa23('0x37')],'where':{'id':_0x3e42dc[_0xfa23('0x91')]['queueId']}});})[_0xfa23('0x33')](function(_0x2fe73b){if(_0x2fe73b){_0x3e42dc[_0xfa23('0x84')][_0xfa23('0x9a')]({'id':0x0,'priority':0x1,'app':_0xfa23('0x9e'),'appdata':_0x2fe73b[_0xfa23('0x37')]+','+(_0x3e42dc[_0xfa23('0x83')]['waitForTheAssignedQueue']||0x12c),'interval':_0xfa23('0x95')});}return respondWithRpcPromise(_0xfa23('0x9f'),_0xfa23('0xa0'),_0x3e42dc);})['then'](function(_0x34bc33){respondWithRpcPromise('EventManager',_0xfa23('0xa1'),{'event':_0xfa23('0x6a'),'message':_0x34bc33},client9002);return _0x34bc33;})[_0xfa23('0x33')](respondWithResult(_0x26ce87,null))[_0xfa23('0x24')](handleError(_0x26ce87,null));};exports[_0xfa23('0xa2')]=function(_0x5ee234,_0x34367a){var _0x17b3a7=_0x5ee234[_0xfa23('0x55')]['id'];var _0x47157d=_0x5ee234[_0xfa23('0x57')];var _0x1a93ba=0xc8;var _0x4f0051=null;return db[_0xfa23('0xa3')]['transaction']({'isolationLevel':db[_0xfa23('0xa3')]['Transaction'][_0xfa23('0xa4')][_0xfa23('0xa5')]},function(_0x1e8cae){return db[_0xfa23('0x3d')][_0xfa23('0x68')]({'where':{'id':_0x17b3a7},'transaction':_0x1e8cae})['then'](function(_0x316700){if(_0x316700){return db['OpenchannelApplication'][_0xfa23('0x32')]({'where':{'OpenchannelAccountId':_0x17b3a7},'transaction':_0x1e8cae})[_0xfa23('0x33')](function(){var _0x144a38=_[_0xfa23('0x3c')](_0x47157d,function(_0x1730c0){_0x1730c0[_0xfa23('0x62')]=_0x17b3a7;return _0x1730c0;});return db[_0xfa23('0x81')][_0xfa23('0xa6')](_0x144a38,{'transaction':_0x1e8cae});});}else{_0x1a93ba=0x194;_0x4f0051=[];}});})[_0xfa23('0x33')](function(){if(_0x1a93ba!==0x194){return db[_0xfa23('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x17b3a7},'order':_0xfa23('0x87')})[_0xfa23('0x33')](function(_0x1b0f19){_0x4f0051=_0x1b0f19;});}})[_0xfa23('0x24')](function(_0x117863){_0x1a93ba=0x1f4;logger['error'](_0x117863[_0xfa23('0x36')]);if(_0x117863[_0xfa23('0x37')]){delete _0x117863[_0xfa23('0x37')];}_0x4f0051=_0x117863;})[_0xfa23('0xa7')](function(){if(_0x4f0051===null){_0x34367a[_0xfa23('0x25')](_0x1a93ba);}else{if(_0x1a93ba===0x1f4){_0x34367a['status'](_0x1a93ba)[_0xfa23('0x38')](_0x4f0051);}else{_0x34367a[_0xfa23('0x27')](_0x1a93ba)[_0xfa23('0x28')](_0x4f0051);}}});};exports[_0xfa23('0xa8')]=function(_0x381290,_0x4afe81,_0x3fbb95){var _0x47b141={};var _0x55dc5f={};var _0x4d9d31;var _0x37ba1a;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x381290[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x4afe81,null))[_0xfa23('0x33')](function(_0xf39a18){if(_0xf39a18){_0x4d9d31=_0xf39a18;_0x55dc5f[_0xfa23('0x41')]=_[_0xfa23('0x43')](db[_0xfa23('0x81')][_0xfa23('0x3e')]);_0x55dc5f[_0xfa23('0x42')]=_[_0xfa23('0x43')](_0x381290[_0xfa23('0x42')]);_0x55dc5f[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x55dc5f[_0xfa23('0x41')],_0x55dc5f[_0xfa23('0x42')]);_0x47b141[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0x55dc5f['model'],qs[_0xfa23('0x47')](_0x381290['query'][_0xfa23('0x47')]));_0x47b141[_0xfa23('0x46')]=_0x47b141['attributes'][_0xfa23('0x48')]?_0x47b141[_0xfa23('0x46')]:_0x55dc5f[_0xfa23('0x41')];_0x47b141[_0xfa23('0xa9')]=qs[_0xfa23('0x4b')](_0x381290[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x47b141[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0x381290[_0xfa23('0x42')],_0x55dc5f[_0xfa23('0x44')]));if(_0x381290[_0xfa23('0x42')]['filter']){_0x47b141[_0xfa23('0x4c')]=_[_0xfa23('0x4f')](_0x47b141[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x47b141[_0xfa23('0x46')],function(_0x2aa3a5){var _0x287132={};_0x287132[_0x2aa3a5]={'$like':'%'+_0x381290[_0xfa23('0x42')][_0xfa23('0x4e')]+'%'};return _0x287132;})});}_0x47b141=_[_0xfa23('0x4f')]({},_0x47b141,_0x381290['options']);return _0x4d9d31[_0xfa23('0xa8')](_0x47b141);}})['then'](function(_0x227587){if(_0x227587){_0x37ba1a=_0x227587[_0xfa23('0x48')];if(!_0x381290['query'][_0xfa23('0x49')](_0xfa23('0x4a'))){_0x47b141[_0xfa23('0x2c')]=qs['limit'](_0x381290[_0xfa23('0x42')]['limit']);_0x47b141[_0xfa23('0x2a')]=qs['offset'](_0x381290[_0xfa23('0x42')][_0xfa23('0x2a')]);}return _0x4d9d31[_0xfa23('0xa8')](_0x47b141);}})[_0xfa23('0x33')](function(_0x3c9c27){if(_0x3c9c27){return _0x3c9c27?{'count':_0x37ba1a,'rows':_0x3c9c27}:null;}})[_0xfa23('0x33')](respondWithResult(_0x4afe81,null))[_0xfa23('0x24')](handleError(_0x4afe81,null));};exports[_0xfa23('0xaa')]=function(_0xe2aa6c,_0xdf540f,_0x244672){var _0x5c038b={'raw':![],'where':{}};var _0x487203={};var _0x188ce1={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xe2aa6c[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0xdf540f,null))[_0xfa23('0x33')](function(_0x31f8af){if(_0x31f8af){_0x487203[_0xfa23('0x41')]=_['keys'](db['OpenchannelInteraction'][_0xfa23('0x3e')]);_0x487203[_0xfa23('0x42')]=_[_0xfa23('0x43')](_0xe2aa6c[_0xfa23('0x42')]);_0x487203['filters']=_['intersection'](_0x487203[_0xfa23('0x41')],_0x487203[_0xfa23('0x42')]);_0x5c038b['attributes']=_[_0xfa23('0x45')](_0x487203[_0xfa23('0x41')],qs[_0xfa23('0x47')](_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x47')]));_0x5c038b[_0xfa23('0x46')]=_0x5c038b[_0xfa23('0x46')][_0xfa23('0x48')]?_0x5c038b[_0xfa23('0x46')]:_0x487203[_0xfa23('0x41')];if(!_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x49')](_0xfa23('0x4a'))){_0x5c038b[_0xfa23('0x2c')]=qs['limit'](_0xe2aa6c['query'][_0xfa23('0x2c')]);_0x5c038b[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x2a')]);}_0x5c038b[_0xfa23('0xa9')]=qs['sort'](_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x5c038b[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0xe2aa6c[_0xfa23('0x42')],_0x487203[_0xfa23('0x44')]));_0x5c038b[_0xfa23('0x4c')][_0xfa23('0x62')]=_0x31f8af['id'];if(_0xe2aa6c[_0xfa23('0x42')]['filter']){_0x5c038b[_0xfa23('0x4c')]=_['merge'](_0x5c038b[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x5c038b[_0xfa23('0x46')],function(_0x50acd1){var _0x462ea8={};_0x462ea8[_0x50acd1]={'$like':'%'+_0xe2aa6c['query'][_0xfa23('0x4e')]+'%'};return _0x462ea8;})});}_0x5c038b=_['merge']({},_0x5c038b,_0xe2aa6c[_0xfa23('0x51')]);return db[_0xfa23('0x8d')][_0xfa23('0x2b')]({'where':_0x5c038b[_0xfa23('0x4c')]})[_0xfa23('0x33')](function(_0x97229d){_0x188ce1[_0xfa23('0x2b')]=_0x97229d;if(_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0x63')]){_0x5c038b[_0xfa23('0x52')]=[{'model':db[_0xfa23('0x6c')],'as':_0xfa23('0xab'),'required':![]},{'model':db[_0xfa23('0x99')],'as':_0xfa23('0xac'),'attributes':[_0xfa23('0x37'),'fullname',_0xfa23('0xad')],'required':![]},{'model':db[_0xfa23('0xae')],'as':'Tags','attributes':['id','name',_0xfa23('0xaf')],'where':_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0xb0')]?{'id':_0xe2aa6c['query'][_0xfa23('0xb0')]}:undefined,'required':_0xe2aa6c[_0xfa23('0x42')][_0xfa23('0xb0')]?!![]:![]}];}return db[_0xfa23('0x8d')]['findAll'](_0x5c038b);})[_0xfa23('0x33')](function(_0x3cdcdb){_0x188ce1[_0xfa23('0x54')]=_0x3cdcdb;return _0x188ce1;});}})[_0xfa23('0x33')](respondWithFilteredResult(_0xdf540f,_0x5c038b))[_0xfa23('0x24')](handleError(_0xdf540f,null));};exports[_0xfa23('0xb1')]=function(_0x2f04a1,_0x29a3f5,_0x22d3d7){return db[_0xfa23('0x3d')]['find']({'where':{'id':_0x2f04a1[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x29a3f5,null))[_0xfa23('0x33')](function(_0x4854ef){if(_0x4854ef){return _0x4854ef[_0xfa23('0xb1')](_0x2f04a1['body'][_0xfa23('0x65')],_[_0xfa23('0xb2')](_0x2f04a1[_0xfa23('0x57')],[_0xfa23('0x65'),'id'])||{})['spread'](function(_0x46d5a3){for(var _0x2b505a=0x0;_0x2b505a<_0x2f04a1[_0xfa23('0x57')][_0xfa23('0x65')][_0xfa23('0x48')];_0x2b505a+=0x1){socket[_0xfa23('0xb3')](_0xfa23('0xb4'),{'UserId':Number(_0x2f04a1[_0xfa23('0x57')]['ids'][_0x2b505a]),'OpenchannelAccountId':Number(_0x2f04a1[_0xfa23('0x55')]['id'])});}return _0x46d5a3;});}})[_0xfa23('0x33')](respondWithResult(_0x29a3f5,null))['catch'](handleError(_0x29a3f5,null));};exports['removeAgents']=function(_0x54128e,_0x5a99ea,_0x34c412){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x54128e[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x5a99ea,null))[_0xfa23('0x33')](function(_0xa1f3e7){if(_0xa1f3e7){return _0xa1f3e7[_0xfa23('0xb5')](_0x54128e[_0xfa23('0x42')][_0xfa23('0x65')])[_0xfa23('0x33')](function(){if(_[_0xfa23('0xb6')](_0x54128e[_0xfa23('0x42')]['ids'])){for(var _0x146f3f=0x0;_0x146f3f<_0x54128e[_0xfa23('0x42')]['ids'][_0xfa23('0x48')];_0x146f3f+=0x1){socket[_0xfa23('0xb3')](_0xfa23('0xb7'),{'UserId':Number(_0x54128e[_0xfa23('0x42')][_0xfa23('0x65')][_0x146f3f]),'OpenchannelAccountId':Number(_0x54128e[_0xfa23('0x55')]['id'])});}}else{socket['emit'](_0xfa23('0xb7'),{'UserId':Number(_0x54128e['query']['ids']),'OpenchannelAccountId':Number(_0x54128e[_0xfa23('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x5a99ea,null))['catch'](handleError(_0x5a99ea,null));};exports[_0xfa23('0xb8')]=function(_0x33e6bd,_0x2a1992,_0x225d51){var _0x53a8fa={};var _0x4e743a={};var _0x3024d8;var _0x3f3651;return db['OpenchannelAccount'][_0xfa23('0x68')]({'where':{'id':_0x33e6bd[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x2a1992,null))[_0xfa23('0x33')](function(_0x30b6a9){if(_0x30b6a9){_0x3024d8=_0x30b6a9;_0x4e743a[_0xfa23('0x41')]=_[_0xfa23('0x43')](db[_0xfa23('0x99')][_0xfa23('0x3e')]);_0x4e743a['query']=_[_0xfa23('0x43')](_0x33e6bd['query']);_0x4e743a[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x4e743a[_0xfa23('0x41')],_0x4e743a[_0xfa23('0x42')]);_0x53a8fa[_0xfa23('0x46')]=_[_0xfa23('0x45')](_0x4e743a['model'],qs[_0xfa23('0x47')](_0x33e6bd['query'][_0xfa23('0x47')]));_0x53a8fa['attributes']=_0x53a8fa[_0xfa23('0x46')][_0xfa23('0x48')]?_0x53a8fa[_0xfa23('0x46')]:_0x4e743a[_0xfa23('0x41')];_0x53a8fa[_0xfa23('0xa9')]=qs[_0xfa23('0x4b')](_0x33e6bd[_0xfa23('0x42')][_0xfa23('0x4b')]);_0x53a8fa[_0xfa23('0x4c')]=qs[_0xfa23('0x44')](_[_0xfa23('0x4d')](_0x33e6bd[_0xfa23('0x42')],_0x4e743a['filters']));if(_0x33e6bd[_0xfa23('0x42')][_0xfa23('0x4e')]){_0x53a8fa[_0xfa23('0x4c')]=_[_0xfa23('0x4f')](_0x53a8fa[_0xfa23('0x4c')],{'$or':_[_0xfa23('0x3c')](_0x53a8fa['attributes'],function(_0x3da733){var _0xeaddfe={};_0xeaddfe[_0x3da733]={'$like':'%'+_0x33e6bd[_0xfa23('0x42')]['filter']+'%'};return _0xeaddfe;})});}_0x53a8fa=_[_0xfa23('0x4f')]({},_0x53a8fa,_0x33e6bd[_0xfa23('0x51')]);return _0x3024d8[_0xfa23('0xb8')](_0x53a8fa);}})[_0xfa23('0x33')](function(_0x5b3a66){if(_0x5b3a66){_0x3f3651=_0x5b3a66[_0xfa23('0x48')];if(!_0x33e6bd[_0xfa23('0x42')]['hasOwnProperty'](_0xfa23('0x4a'))){_0x53a8fa[_0xfa23('0x2c')]=qs['limit'](_0x33e6bd[_0xfa23('0x42')][_0xfa23('0x2c')]);_0x53a8fa[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0x33e6bd[_0xfa23('0x42')][_0xfa23('0x2a')]);}return _0x3024d8[_0xfa23('0xb8')](_0x53a8fa);}})['then'](function(_0x4e6de1){if(_0x4e6de1){return _0x4e6de1?{'count':_0x3f3651,'rows':_0x4e6de1}:null;}})['then'](respondWithResult(_0x2a1992,null))[_0xfa23('0x24')](handleError(_0x2a1992,null));};exports[_0xfa23('0x38')]=function(_0x5dabc8,_0x4ac5fd,_0x24318e){var _0x38a371,_0x1f66f6,_0x3cf3e8;if(_[_0xfa23('0x73')](_0x5dabc8[_0xfa23('0x57')]['body'])||_0x5dabc8[_0xfa23('0x57')][_0xfa23('0x57')]===''){throw new db[(_0xfa23('0x75'))][(_0xfa23('0x76'))](_0xfa23('0x78'));}if(_[_0xfa23('0x73')](_0x5dabc8[_0xfa23('0x57')]['to'])){}_0x38a371=_0x5dabc8[_0xfa23('0x57')]['to'];return db['OpenchannelAccount'][_0xfa23('0x68')]({'where':{'id':_0x5dabc8[_0xfa23('0x55')]['id']}})[_0xfa23('0x33')](handleEntityNotFound(_0x4ac5fd,null))[_0xfa23('0x33')](function(_0x45bc08){if(_0x45bc08){return db[_0xfa23('0x3d')][_0xfa23('0x5d')]({'where':{'id':_0x45bc08['id']},'include':[{'model':db[_0xfa23('0x7d')],'as':'List','include':[{'model':db[_0xfa23('0x6c')],'as':_0xfa23('0x7f'),'where':{[_0x45bc08[_0xfa23('0x79')]]:_0x38a371},'limit':0x1,'order':[[_0xfa23('0x71'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x4ac5fd,null))[_0xfa23('0x33')](function(_0x5543f2){if(_0x5543f2&&_0x5543f2[_0xfa23('0x7e')]){_0x1f66f6=_0x5543f2['get']({'plain':!![]});if(_0x1f66f6[_0xfa23('0x7e')]&&_0x1f66f6[_0xfa23('0x7e')][_0xfa23('0x7f')][_0xfa23('0x48')]){return _0x1f66f6['List'][_0xfa23('0x7f')][0x0];}return db['CmContact'][_0xfa23('0x56')](_[_0xfa23('0x16')](_0x5dabc8[_0xfa23('0x57')],{'firstName':_0x38a371,[_0x5543f2['mapKey']]:_0x38a371,'phone':_0x38a371,'ListId':_0x1f66f6[_0xfa23('0x72')]}));}})[_0xfa23('0x33')](handleEntityNotFound(_0x4ac5fd,null))[_0xfa23('0x33')](function(_0x57ec7f){if(_0x57ec7f){_0x3cf3e8=_0x57ec7f;return db[_0xfa23('0x8d')]['find']({'where':{'ContactId':_0x3cf3e8['id'],'closed':![],'OpenchannelAccountId':_0x1f66f6['id']}})['then'](function(_0x8d8a1e){if(_0x8d8a1e){return[_0x8d8a1e,![]];}return db[_0xfa23('0x8d')][_0xfa23('0x56')]({'UserId':_0x5dabc8[_0xfa23('0x58')]['id'],'ContactId':_0x3cf3e8['id'],'OpenchannelAccountId':_0x1f66f6['id'],'lastMsgDirection':_0xfa23('0xb9'),'firstMsgDirection':_0xfa23('0xb9'),'Messages':[_[_0xfa23('0x4f')](_0x5dabc8[_0xfa23('0x57')],{'read':![],'body':_0x5dabc8[_0xfa23('0x57')][_0xfa23('0x57')],'OpenchannelAccountId':_0x1f66f6['id'],'UserId':_0x5dabc8[_0xfa23('0x58')]['id'],'ContactId':_0x3cf3e8['id']})]},{'include':[{'model':db[_0xfa23('0x96')],'as':_0xfa23('0xba')}]})[_0xfa23('0x33')](function(_0x439528){return[_0x439528,!![]];});});}})[_0xfa23('0x8f')](function(_0x3e6ec6,_0x3270a2){if(_0x3270a2){return _0x3e6ec6;}return db[_0xfa23('0x96')][_0xfa23('0x56')](_[_0xfa23('0x4f')](_0x5dabc8[_0xfa23('0x57')],{'read':![],'body':_0x5dabc8['body'][_0xfa23('0x57')],'OpenchannelAccountId':_0x1f66f6['id'],'OpenchannelInteractionId':_0x3e6ec6['id'],'UserId':_0x5dabc8[_0xfa23('0x58')]['id'],'ContactId':_0x3cf3e8['id']}))[_0xfa23('0x33')](function(_0x1e867e){_0x3e6ec6[_0xfa23('0xbb')][_0xfa23('0xba')]=[];_0x3e6ec6['dataValues'][_0xfa23('0xba')][_0xfa23('0xbc')](_0x1e867e[_0xfa23('0xbb')]);return _0x3e6ec6;});});}})[_0xfa23('0x33')](respondWithResult(_0x4ac5fd,null))['catch'](handleError(_0x4ac5fd,null));}; \ No newline at end of file +var _0xd0c9=['close','unmanaged','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','User','Owner','fullname','internal','Tag','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','http','client','request','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','OpenchannelAccounts','destroy','end','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','Applications','List','account','applications','list','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','autoclose','push'];(function(_0x3128e5,_0x4b18b1){var _0x5dd40a=function(_0x127925){while(--_0x127925){_0x3128e5['push'](_0x3128e5['shift']());}};_0x5dd40a(++_0x4b18b1);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xd0c9[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x9d0c('0x0'));var rimraf=require(_0x9d0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d0c('0x2'));var BPromise=require(_0x9d0c('0x3'));var Mustache=require(_0x9d0c('0x4'));var util=require('util');var path=require(_0x9d0c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d0c('0x7'));var squel=require(_0x9d0c('0x8'));var crypto=require(_0x9d0c('0x9'));var jsforce=require(_0x9d0c('0xa'));var deskjs=require(_0x9d0c('0xb'));var toCsv=require(_0x9d0c('0xc'));var querystring=require('querystring');var Papa=require(_0x9d0c('0xd'));var Redis=require('ioredis');var authService=require(_0x9d0c('0xe'));var qs=require(_0x9d0c('0xf'));var as=require(_0x9d0c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d0c('0x11'))(_0x9d0c('0x12'));var utils=require(_0x9d0c('0x13'));var config=require(_0x9d0c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d0c('0x15'))['db'];config['redis']=_[_0x9d0c('0x16')](config[_0x9d0c('0x17')],{'host':_0x9d0c('0x18'),'port':0x18eb});var socket=require(_0x9d0c('0x19'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x9d0c('0x1a'));var client=jayson['client'][_0x9d0c('0x1b')]({'port':0x232c});var client9002=jayson[_0x9d0c('0x1c')][_0x9d0c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x275bb0,_0x40e4e7,_0x29229b,_0x1846cc){return new BPromise(function(_0x751d05,_0x57ed4c){var _0x4514fd=_0x1846cc||client;return _0x4514fd[_0x9d0c('0x1d')](_0x275bb0,_0x29229b)['then'](function(_0x720a0a){logger[_0x9d0c('0x1e')](_0x9d0c('0x1f'),_0x40e4e7,'request\x20sent');logger['debug'](_0x9d0c('0x20'),_0x40e4e7,_0x9d0c('0x21'),JSON['stringify'](_0x720a0a));if(_0x720a0a[_0x9d0c('0x22')]){if(_0x720a0a[_0x9d0c('0x22')][_0x9d0c('0x23')]===0x1f4){logger[_0x9d0c('0x22')](_0x9d0c('0x1f'),_0x40e4e7,_0x720a0a['error'][_0x9d0c('0x24')]);return _0x57ed4c(_0x720a0a['error'][_0x9d0c('0x24')]);}logger[_0x9d0c('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x40e4e7,_0x720a0a[_0x9d0c('0x22')][_0x9d0c('0x24')]);return _0x751d05(_0x720a0a[_0x9d0c('0x22')]['message']);}else{logger[_0x9d0c('0x1e')](_0x9d0c('0x1f'),_0x40e4e7,'request\x20sent');_0x751d05(_0x720a0a[_0x9d0c('0x25')][_0x9d0c('0x24')]);}})[_0x9d0c('0x26')](function(_0x35b60f){logger[_0x9d0c('0x22')](_0x9d0c('0x1f'),_0x40e4e7,_0x35b60f);_0x57ed4c(_0x35b60f);});});}function respondWithStatusCode(_0x222216,_0x48b65b){_0x48b65b=_0x48b65b||0xcc;return function(_0x46b647){if(_0x46b647){return _0x222216[_0x9d0c('0x27')](_0x48b65b);}return _0x222216[_0x9d0c('0x28')](_0x48b65b)['end']();};}function respondWithResult(_0x3a274b,_0x1b634d){_0x1b634d=_0x1b634d||0xc8;return function(_0x2a6a88){if(_0x2a6a88){return _0x3a274b[_0x9d0c('0x28')](_0x1b634d)['json'](_0x2a6a88);}};}function respondWithFilteredResult(_0x12d75f,_0x46955f){return function(_0x1846f0){if(_0x1846f0){var _0x2cbbbc=typeof _0x46955f['offset']==='undefined'&&typeof _0x46955f['limit']==='undefined';var _0x38144e=_0x1846f0[_0x9d0c('0x29')];var _0xe7265b=_0x2cbbbc?0x0:_0x46955f[_0x9d0c('0x2a')];var _0x4f4ada=_0x2cbbbc?_0x1846f0['count']:_0x46955f[_0x9d0c('0x2a')]+_0x46955f[_0x9d0c('0x2b')];var _0x2e6731;if(_0x4f4ada>=_0x38144e){_0x4f4ada=_0x38144e;_0x2e6731=0xc8;}else{_0x2e6731=0xce;}_0x12d75f[_0x9d0c('0x28')](_0x2e6731);return _0x12d75f[_0x9d0c('0x2c')](_0x9d0c('0x2d'),_0xe7265b+'-'+_0x4f4ada+'/'+_0x38144e)['json'](_0x1846f0);}return null;};}function patchUpdates(_0x2fcf87){return function(_0x28fa62){try{jsonpatch[_0x9d0c('0x2e')](_0x28fa62,_0x2fcf87,!![]);}catch(_0x87830){return BPromise[_0x9d0c('0x2f')](_0x87830);}return _0x28fa62[_0x9d0c('0x30')]();};}function saveUpdates(_0x4b5bdf,_0x5e6271){return function(_0x5aeea8){if(_0x5aeea8){return _0x5aeea8[_0x9d0c('0x31')](_0x4b5bdf)[_0x9d0c('0x32')](function(_0x527a6b){return _0x527a6b;});}return null;};}function removeEntity(_0x445cdb,_0x5405b3){return function(_0x1bb1af){if(_0x1bb1af){return _0x1bb1af['destroy']()['then'](function(){var _0x5ab91e=_0x1bb1af['get']({'plain':!![]});var _0x184475=_0x9d0c('0x33');return db['UserProfileResource'][_0x9d0c('0x34')]({'where':{'type':_0x184475,'resourceId':_0x5ab91e['id']}})[_0x9d0c('0x32')](function(){return _0x1bb1af;});})[_0x9d0c('0x32')](function(){_0x445cdb['status'](0xcc)[_0x9d0c('0x35')]();});}};}function handleEntityNotFound(_0x841925,_0x1c1de6){return function(_0x42b34c){if(!_0x42b34c){_0x841925[_0x9d0c('0x27')](0x194);}return _0x42b34c;};}function handleError(_0x29d1c6,_0x2ecb33){_0x2ecb33=_0x2ecb33||0x1f4;return function(_0x1a0b64){logger['error'](_0x1a0b64[_0x9d0c('0x36')]);if(_0x1a0b64[_0x9d0c('0x37')]){delete _0x1a0b64['name'];}_0x29d1c6[_0x9d0c('0x28')](_0x2ecb33)[_0x9d0c('0x38')](_0x1a0b64);};}exports[_0x9d0c('0x39')]=function(_0x1084fa,_0x4935f2){var _0x13b373={'include':[{'model':db[_0x9d0c('0x3a')],'as':'mandatoryDispositionPause'}]},_0x3a8543={},_0x74eda3={'count':0x0,'rows':[]};var _0x528517=_[_0x9d0c('0x3b')](db[_0x9d0c('0x3c')][_0x9d0c('0x3d')],function(_0x4ea907){return{'name':_0x4ea907[_0x9d0c('0x3e')],'type':_0x4ea907[_0x9d0c('0x3f')][_0x9d0c('0x40')]};});_0x3a8543['model']=_['map'](_0x528517,_0x9d0c('0x37'));_0x3a8543[_0x9d0c('0x41')]=_[_0x9d0c('0x42')](_0x1084fa[_0x9d0c('0x41')]);_0x3a8543[_0x9d0c('0x43')]=_[_0x9d0c('0x44')](_0x3a8543[_0x9d0c('0x45')],_0x3a8543[_0x9d0c('0x41')]);_0x13b373[_0x9d0c('0x46')]=_[_0x9d0c('0x44')](_0x3a8543[_0x9d0c('0x45')],qs[_0x9d0c('0x47')](_0x1084fa[_0x9d0c('0x41')][_0x9d0c('0x47')]));_0x13b373[_0x9d0c('0x46')]=_0x13b373[_0x9d0c('0x46')][_0x9d0c('0x48')]?_0x13b373[_0x9d0c('0x46')]:_0x3a8543['model'];if(!_0x1084fa[_0x9d0c('0x41')][_0x9d0c('0x49')](_0x9d0c('0x4a'))){_0x13b373[_0x9d0c('0x2b')]=qs[_0x9d0c('0x2b')](_0x1084fa[_0x9d0c('0x41')]['limit']);_0x13b373[_0x9d0c('0x2a')]=qs['offset'](_0x1084fa[_0x9d0c('0x41')][_0x9d0c('0x2a')]);}_0x13b373['order']=qs[_0x9d0c('0x4b')](_0x1084fa[_0x9d0c('0x41')][_0x9d0c('0x4b')]);_0x13b373[_0x9d0c('0x4c')]=qs[_0x9d0c('0x43')](_[_0x9d0c('0x4d')](_0x1084fa[_0x9d0c('0x41')],_0x3a8543[_0x9d0c('0x43')]),_0x528517);if(_0x1084fa[_0x9d0c('0x41')][_0x9d0c('0x4e')]){_0x13b373[_0x9d0c('0x4c')]=_[_0x9d0c('0x4f')](_0x13b373[_0x9d0c('0x4c')],{'$or':_[_0x9d0c('0x3b')](_0x528517,function(_0x2735f4){if(_0x2735f4['type']!=='VIRTUAL'){var _0xd8e7de={};_0xd8e7de[_0x2735f4[_0x9d0c('0x37')]]={'$like':'%'+_0x1084fa[_0x9d0c('0x41')][_0x9d0c('0x4e')]+'%'};return _0xd8e7de;}})});}_0x13b373=_['merge']({},_0x13b373,_0x1084fa[_0x9d0c('0x50')]);var _0x6b2dcf={'where':_0x13b373[_0x9d0c('0x4c')]};return db[_0x9d0c('0x3c')]['count'](_0x6b2dcf)[_0x9d0c('0x32')](function(_0x9062c5){_0x74eda3[_0x9d0c('0x29')]=_0x9062c5;if(_0x1084fa[_0x9d0c('0x41')][_0x9d0c('0x51')]){_0x13b373[_0x9d0c('0x52')]=[{'all':!![]}];}return db[_0x9d0c('0x3c')][_0x9d0c('0x53')](_0x13b373);})[_0x9d0c('0x32')](function(_0xb0c06){_0x74eda3[_0x9d0c('0x54')]=_0xb0c06;return _0x74eda3;})[_0x9d0c('0x32')](respondWithFilteredResult(_0x4935f2,_0x13b373))[_0x9d0c('0x26')](handleError(_0x4935f2,null));};exports[_0x9d0c('0x55')]=function(_0x55b825,_0x56a16c){var _0x56bcd1={'raw':![],'where':{'id':_0x55b825[_0x9d0c('0x56')]['id']},'include':[{'model':db[_0x9d0c('0x3a')],'as':_0x9d0c('0x57')}]},_0x4a9719={};_0x4a9719['model']=_['keys'](db[_0x9d0c('0x3c')]['rawAttributes']);_0x4a9719[_0x9d0c('0x41')]=_[_0x9d0c('0x42')](_0x55b825[_0x9d0c('0x41')]);_0x4a9719[_0x9d0c('0x43')]=_['intersection'](_0x4a9719[_0x9d0c('0x45')],_0x4a9719[_0x9d0c('0x41')]);_0x56bcd1['attributes']=_[_0x9d0c('0x44')](_0x4a9719[_0x9d0c('0x45')],qs[_0x9d0c('0x47')](_0x55b825['query'][_0x9d0c('0x47')]));_0x56bcd1['attributes']=_0x56bcd1[_0x9d0c('0x46')][_0x9d0c('0x48')]?_0x56bcd1[_0x9d0c('0x46')]:_0x4a9719[_0x9d0c('0x45')];if(_0x55b825[_0x9d0c('0x41')][_0x9d0c('0x51')]){_0x56bcd1[_0x9d0c('0x52')]=[{'all':!![]}];}_0x56bcd1=_[_0x9d0c('0x4f')]({},_0x56bcd1,_0x55b825[_0x9d0c('0x50')]);return db['OpenchannelAccount'][_0x9d0c('0x58')](_0x56bcd1)[_0x9d0c('0x32')](handleEntityNotFound(_0x56a16c,null))['then'](respondWithResult(_0x56a16c,null))[_0x9d0c('0x26')](handleError(_0x56a16c,null));};exports['create']=function(_0x4b9fca,_0x1862c2){return db['OpenchannelAccount'][_0x9d0c('0x59')](_0x4b9fca[_0x9d0c('0x5a')],{})[_0x9d0c('0x32')](function(_0x49439f){var _0x319500=_0x4b9fca[_0x9d0c('0x5b')][_0x9d0c('0x5c')]({'plain':!![]});if(!_0x319500)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x319500[_0x9d0c('0x5d')]==='user'){var _0x2ab9ae=_0x49439f['get']({'plain':!![]});var _0x239189='OpenchannelAccounts';return db[_0x9d0c('0x5e')][_0x9d0c('0x58')]({'where':{'name':_0x239189,'userProfileId':_0x319500[_0x9d0c('0x5f')]},'raw':!![]})[_0x9d0c('0x32')](function(_0xde0449){if(_0xde0449&&_0xde0449[_0x9d0c('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x2ab9ae[_0x9d0c('0x37')],'resourceId':_0x2ab9ae['id'],'type':_0xde0449['name'],'sectionId':_0xde0449['id']},{})[_0x9d0c('0x32')](function(){return _0x49439f;});}else{return _0x49439f;}})[_0x9d0c('0x26')](function(_0x44a54b){logger['error'](_0x9d0c('0x61'),_0x44a54b);throw _0x44a54b;});}return _0x49439f;})[_0x9d0c('0x32')](respondWithResult(_0x1862c2,0xc9))['catch'](handleError(_0x1862c2,null));};exports[_0x9d0c('0x31')]=function(_0x42b2db,_0x679079){if(_0x42b2db[_0x9d0c('0x5a')]['id']){delete _0x42b2db['body']['id'];}return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x42b2db[_0x9d0c('0x56')]['id']},'include':[{'model':db[_0x9d0c('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x9d0c('0x32')](handleEntityNotFound(_0x679079,null))[_0x9d0c('0x32')](saveUpdates(_0x42b2db[_0x9d0c('0x5a')],null))[_0x9d0c('0x32')](respondWithResult(_0x679079,null))['catch'](handleError(_0x679079,null));};exports[_0x9d0c('0x34')]=function(_0x5946b0,_0x1039d4){return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x5946b0[_0x9d0c('0x56')]['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x1039d4,null))['then'](removeEntity(_0x1039d4,null))[_0x9d0c('0x26')](handleError(_0x1039d4,null));};exports[_0x9d0c('0x62')]=function(_0x44fab7,_0x5eba2e){return db['OpenchannelAccount'][_0x9d0c('0x62')]()[_0x9d0c('0x32')](respondWithResult(_0x5eba2e,null))[_0x9d0c('0x26')](handleError(_0x5eba2e,null));};exports[_0x9d0c('0x63')]=function(_0x209187,_0x434bd0,_0x26816b){if(_0x209187[_0x9d0c('0x5a')]['id']){delete _0x209187[_0x9d0c('0x5a')]['id'];}return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x209187['params']['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x434bd0,null))[_0x9d0c('0x32')](function(_0xcd5d0d){if(_0xcd5d0d){_0x209187[_0x9d0c('0x5a')][_0x9d0c('0x64')]=_0xcd5d0d['id'];return db[_0x9d0c('0x65')][_0x9d0c('0x59')](_0x209187[_0x9d0c('0x5a')]);}})[_0x9d0c('0x32')](respondWithResult(_0x434bd0,null))[_0x9d0c('0x26')](handleError(_0x434bd0,null));};exports[_0x9d0c('0x66')]=function(_0x5d135b,_0x2935c1,_0x2a8193){var _0x5d10ac={'raw':![],'where':{}};var _0x190ffd={};var _0x26a763={'count':0x0,'rows':[]};return db[_0x9d0c('0x3c')][_0x9d0c('0x67')]({'where':{'id':_0x5d135b[_0x9d0c('0x56')]['id']}})['then'](handleEntityNotFound(_0x2935c1,null))['then'](function(_0x35a767){if(_0x35a767){_0x190ffd[_0x9d0c('0x45')]=_['keys'](db['Disposition'][_0x9d0c('0x3d')]);_0x190ffd[_0x9d0c('0x41')]=_[_0x9d0c('0x42')](_0x5d135b['query']);_0x190ffd[_0x9d0c('0x43')]=_[_0x9d0c('0x44')](_0x190ffd[_0x9d0c('0x45')],_0x190ffd[_0x9d0c('0x41')]);_0x5d10ac['attributes']=_['intersection'](_0x190ffd['model'],qs[_0x9d0c('0x47')](_0x5d135b[_0x9d0c('0x41')][_0x9d0c('0x47')]));_0x5d10ac[_0x9d0c('0x46')]=_0x5d10ac[_0x9d0c('0x46')][_0x9d0c('0x48')]?_0x5d10ac['attributes']:_0x190ffd[_0x9d0c('0x45')];if(!_0x5d135b[_0x9d0c('0x41')]['hasOwnProperty'](_0x9d0c('0x4a'))){_0x5d10ac['limit']=qs[_0x9d0c('0x2b')](_0x5d135b[_0x9d0c('0x41')][_0x9d0c('0x2b')]);_0x5d10ac['offset']=qs[_0x9d0c('0x2a')](_0x5d135b[_0x9d0c('0x41')][_0x9d0c('0x2a')]);}_0x5d10ac[_0x9d0c('0x68')]=qs[_0x9d0c('0x4b')](_0x5d135b[_0x9d0c('0x41')][_0x9d0c('0x4b')]);_0x5d10ac[_0x9d0c('0x4c')]=qs[_0x9d0c('0x43')](_[_0x9d0c('0x4d')](_0x5d135b[_0x9d0c('0x41')],_0x190ffd[_0x9d0c('0x43')]));_0x5d10ac[_0x9d0c('0x4c')]['OpenchannelAccountId']=_0x35a767['id'];if(_0x5d135b[_0x9d0c('0x41')][_0x9d0c('0x4e')]){_0x5d10ac['where']=_['merge'](_0x5d10ac[_0x9d0c('0x4c')],{'$or':_['map'](_0x5d10ac[_0x9d0c('0x46')],function(_0x4fc9fc){var _0x4d7220={};_0x4d7220[_0x4fc9fc]={'$like':'%'+_0x5d135b[_0x9d0c('0x41')][_0x9d0c('0x4e')]+'%'};return _0x4d7220;})});}_0x5d10ac=_[_0x9d0c('0x4f')]({},_0x5d10ac,_0x5d135b['options']);return db[_0x9d0c('0x65')][_0x9d0c('0x29')]({'where':_0x5d10ac['where']})[_0x9d0c('0x32')](function(_0x4d8873){_0x26a763['count']=_0x4d8873;if(_0x5d135b['query']['includeAll']){_0x5d10ac['include']=[{'all':!![]}];}return db[_0x9d0c('0x65')][_0x9d0c('0x53')](_0x5d10ac);})['then'](function(_0x454a4b){_0x26a763['rows']=_0x454a4b;return _0x26a763;});}})[_0x9d0c('0x32')](respondWithFilteredResult(_0x2935c1,_0x5d10ac))[_0x9d0c('0x26')](handleError(_0x2935c1,null));};exports[_0x9d0c('0x69')]=function(_0x2de938,_0x137859,_0x13dc36){return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x2de938[_0x9d0c('0x56')]['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x137859,null))[_0x9d0c('0x32')](function(_0xee47bb){if(_0xee47bb){return _0xee47bb['removeDispositions'](_0x2de938[_0x9d0c('0x41')][_0x9d0c('0x6a')]);}})[_0x9d0c('0x32')](respondWithStatusCode(_0x137859,null))['catch'](handleError(_0x137859,null));};exports['addAnswer']=function(_0x5e80fa,_0x261213,_0xb59821){if(_0x5e80fa[_0x9d0c('0x5a')]['id']){delete _0x5e80fa['body']['id'];}return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x5e80fa['params']['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x261213,null))['then'](function(_0xa8d79e){if(_0xa8d79e){_0x5e80fa['body'][_0x9d0c('0x64')]=_0xa8d79e['id'];return db[_0x9d0c('0x6b')]['create'](_0x5e80fa[_0x9d0c('0x5a')]);}})['then'](respondWithResult(_0x261213,null))[_0x9d0c('0x26')](handleError(_0x261213,null));};exports['getAnswers']=function(_0x15f472,_0x268626,_0x3fec29){var _0x113a8f={'raw':![],'where':{}};var _0x3094ba={};var _0xc68efb={'count':0x0,'rows':[]};return db[_0x9d0c('0x3c')]['findOne']({'where':{'id':_0x15f472[_0x9d0c('0x56')]['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x268626,null))['then'](function(_0x1d0e14){if(_0x1d0e14){_0x3094ba[_0x9d0c('0x45')]=_['keys'](db[_0x9d0c('0x6b')][_0x9d0c('0x3d')]);_0x3094ba[_0x9d0c('0x41')]=_[_0x9d0c('0x42')](_0x15f472[_0x9d0c('0x41')]);_0x3094ba[_0x9d0c('0x43')]=_['intersection'](_0x3094ba['model'],_0x3094ba[_0x9d0c('0x41')]);_0x113a8f[_0x9d0c('0x46')]=_[_0x9d0c('0x44')](_0x3094ba['model'],qs[_0x9d0c('0x47')](_0x15f472[_0x9d0c('0x41')][_0x9d0c('0x47')]));_0x113a8f[_0x9d0c('0x46')]=_0x113a8f['attributes']['length']?_0x113a8f[_0x9d0c('0x46')]:_0x3094ba[_0x9d0c('0x45')];if(!_0x15f472[_0x9d0c('0x41')][_0x9d0c('0x49')]('nolimit')){_0x113a8f['limit']=qs[_0x9d0c('0x2b')](_0x15f472[_0x9d0c('0x41')][_0x9d0c('0x2b')]);_0x113a8f[_0x9d0c('0x2a')]=qs['offset'](_0x15f472['query'][_0x9d0c('0x2a')]);}_0x113a8f[_0x9d0c('0x68')]=qs[_0x9d0c('0x4b')](_0x15f472[_0x9d0c('0x41')][_0x9d0c('0x4b')]);_0x113a8f[_0x9d0c('0x4c')]=qs[_0x9d0c('0x43')](_['pick'](_0x15f472[_0x9d0c('0x41')],_0x3094ba[_0x9d0c('0x43')]));_0x113a8f['where']['OpenchannelAccountId']=_0x1d0e14['id'];if(_0x15f472['query'][_0x9d0c('0x4e')]){_0x113a8f[_0x9d0c('0x4c')]=_['merge'](_0x113a8f[_0x9d0c('0x4c')],{'$or':_[_0x9d0c('0x3b')](_0x113a8f[_0x9d0c('0x46')],function(_0x114bbd){var _0x4cc075={};_0x4cc075[_0x114bbd]={'$like':'%'+_0x15f472[_0x9d0c('0x41')][_0x9d0c('0x4e')]+'%'};return _0x4cc075;})});}_0x113a8f=_[_0x9d0c('0x4f')]({},_0x113a8f,_0x15f472[_0x9d0c('0x50')]);return db[_0x9d0c('0x6b')][_0x9d0c('0x29')]({'where':_0x113a8f[_0x9d0c('0x4c')]})['then'](function(_0x17d839){_0xc68efb[_0x9d0c('0x29')]=_0x17d839;if(_0x15f472['query'][_0x9d0c('0x51')]){_0x113a8f[_0x9d0c('0x52')]=[{'all':!![]}];}return db[_0x9d0c('0x6b')][_0x9d0c('0x53')](_0x113a8f);})['then'](function(_0x37eeda){_0xc68efb[_0x9d0c('0x54')]=_0x37eeda;return _0xc68efb;});}})[_0x9d0c('0x32')](respondWithFilteredResult(_0x268626,_0x113a8f))[_0x9d0c('0x26')](handleError(_0x268626,null));};exports[_0x9d0c('0x6c')]=function(_0x599db6,_0x172d1c,_0x41eca8){return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x599db6['params']['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x172d1c,null))[_0x9d0c('0x32')](function(_0x300330){if(_0x300330){return _0x300330[_0x9d0c('0x6c')](_0x599db6[_0x9d0c('0x41')][_0x9d0c('0x6a')]);}})['then'](respondWithStatusCode(_0x172d1c,null))[_0x9d0c('0x26')](handleError(_0x172d1c,null));};exports[_0x9d0c('0x6d')]=function(_0x1b4e4a,_0x586e16,_0x41d184){var _0xd6ee12={'body':_0x1b4e4a[_0x9d0c('0x5a')],'channel':_0x9d0c('0x6e')};var _0x4d313=[];var _0x4a1d95=[];var _0x1f69f2={};var _0x5c4b0e=![];return db[_0x9d0c('0x6f')][_0x9d0c('0x62')]()['then'](function(_0x5d6e13){if(!_0x5d6e13){throw new db[(_0x9d0c('0x70'))][(_0x9d0c('0x71'))](_0x9d0c('0x72'));}_0x4d313=_[_0x9d0c('0x73')](_[_0x9d0c('0x42')](_0x5d6e13),['createdAt',_0x9d0c('0x74')]);_0x4a1d95=_[_0x9d0c('0x73')](_['keys'](_0x5d6e13),['createdAt',_0x9d0c('0x74'),'CompanyId',_0x9d0c('0x75')]);if(_0x1b4e4a[_0x9d0c('0x5a')]['id']){delete _0x1b4e4a[_0x9d0c('0x5a')]['id'];}if(_['isNil'](_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x76')])){throw new db[(_0x9d0c('0x70'))]['ValidationError'](_0x9d0c('0x77'));}if(_[_0x9d0c('0x78')](_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x5a')])||_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x5a')]===''){throw new db[(_0x9d0c('0x70'))][(_0x9d0c('0x71'))](_0x9d0c('0x79'));}if(_['isNil'](_0x1b4e4a['body'][_0x9d0c('0x7a')])){throw new db[(_0x9d0c('0x70'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a1d95);}if(!_[_0x9d0c('0x7b')](_0x4a1d95,_0x1b4e4a['body'][_0x9d0c('0x7a')])){throw new db['Sequelize'][(_0x9d0c('0x71'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a1d95);}_0x1f69f2[_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x7a')]]=_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x76')];})[_0x9d0c('0x32')](function(){return db['OpenchannelAccount'][_0x9d0c('0x58')]({'where':{'id':_0x1b4e4a[_0x9d0c('0x56')]['id']},'include':[{'model':db[_0x9d0c('0x7c')],'as':'List','include':[{'model':db[_0x9d0c('0x6f')],'as':_0x9d0c('0x7d'),'where':_0x1f69f2,'limit':0x1,'order':[[_0x9d0c('0x74'),_0x9d0c('0x7e')]]}]},{'model':db['OpenchannelApplication'],'as':_0x9d0c('0x7f')}]});})[_0x9d0c('0x32')](handleEntityNotFound(_0x586e16,null))[_0x9d0c('0x32')](function(_0x56a265){if(_0x56a265&&_0x56a265[_0x9d0c('0x80')]){_0xd6ee12[_0x9d0c('0x81')]=_0x56a265;_0xd6ee12[_0x9d0c('0x82')]=_0x56a265['Applications'];_0xd6ee12[_0x9d0c('0x83')]=_0x56a265[_0x9d0c('0x80')];_0xd6ee12['applications']=_['orderBy'](_0xd6ee12['applications'],[_0x9d0c('0x84')],[_0x9d0c('0x85')]);if(_0xd6ee12[_0x9d0c('0x81')][_0x9d0c('0x7f')]){delete _0xd6ee12['account'][_0x9d0c('0x7f')];}if(_0xd6ee12[_0x9d0c('0x81')]['List']&&_0xd6ee12[_0x9d0c('0x81')]['List'][_0x9d0c('0x7d')][_0x9d0c('0x48')]){return _0xd6ee12['account'][_0x9d0c('0x80')]['Contacts'][0x0];}var _0x5570c2=_[_0x9d0c('0x16')](_0x1b4e4a['body'],{'firstName':_0x1b4e4a[_0x9d0c('0x5a')]['from'],'ListId':_0x56a265[_0x9d0c('0x75')]});_0x5570c2[_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x7a')]]=_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x76')];return db['CmContact'][_0x9d0c('0x59')](_0x5570c2,{'fields':_0x4d313,'raw':!![]});}})[_0x9d0c('0x32')](handleEntityNotFound(_0x586e16,null))['then'](function(_0x2fd2e8){_0xd6ee12[_0x9d0c('0x86')]=_0x2fd2e8;if(_0x2fd2e8){var _0x47ffbe={'ContactId':_0x2fd2e8['id'],'OpenchannelAccountId':_0x1b4e4a[_0x9d0c('0x56')]['id'],'from':(_0x2fd2e8['firstName']||'')+'\x20'+(_0x2fd2e8[_0x9d0c('0x87')]||'')};var _0x505d82={'OpenchannelAccountId':_0x1b4e4a['params']['id'],'closed':![]};if(_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x88')]){_0x505d82[_0x9d0c('0x88')]=_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x88')];return db[_0x9d0c('0x89')]['find']({'where':_0x505d82})[_0x9d0c('0x32')](function(_0x169d3e){if(_0x169d3e){return[_0x169d3e,![]];}_0x47ffbe[_0x9d0c('0x88')]=_0x1b4e4a['body'][_0x9d0c('0x88')];_0x47ffbe['externalUrl']=_0x1b4e4a['body'][_0x9d0c('0x8a')];return db[_0x9d0c('0x89')][_0x9d0c('0x59')](_0x47ffbe)[_0x9d0c('0x32')](function(_0x49e5d5){return[_0x49e5d5,!![]];});});}else{_0x505d82[_0x9d0c('0x88')]=null;}_0x505d82[_0x9d0c('0x8b')]=_0x2fd2e8['id'];return db['OpenchannelInteraction']['find']({'where':_0x505d82})[_0x9d0c('0x32')](function(_0x5613da){if(_0x5613da){return[_0x5613da,![]];}return db['OpenchannelInteraction'][_0x9d0c('0x59')](_0x47ffbe)[_0x9d0c('0x32')](function(_0x4a3fe3){return[_0x4a3fe3,!![]];});});}})[_0x9d0c('0x8c')](function(_0x2c54d2,_0x164791){if(_0x2c54d2){_0x5c4b0e=_0x164791;if(!_0x164791){var _0x4f52bd={'from':(_0xd6ee12[_0x9d0c('0x86')][_0x9d0c('0x8d')]||'')+'\x20'+(_0xd6ee12[_0x9d0c('0x86')][_0x9d0c('0x87')]||'')};if(_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x88')]&&_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x8e')]&&_0x1b4e4a[_0x9d0c('0x5a')]['threadId']!=_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x8e')]){_0x4f52bd[_0x9d0c('0x88')]=_0x1b4e4a['body'][_0x9d0c('0x8e')];}return _0x2c54d2[_0x9d0c('0x31')](_0x4f52bd);}else{return _0x2c54d2;}}})[_0x9d0c('0x32')](function(_0x28b721){_0xd6ee12[_0x9d0c('0x8f')]=_0x28b721[_0x9d0c('0x5c')]({'plain':!![]});_0xd6ee12[_0x9d0c('0x8f')]['created']=_0x5c4b0e;if(_0xd6ee12['interaction']['created']){if(_0xd6ee12['account'][_0x9d0c('0x90')]){_0xd6ee12['applications'][_0x9d0c('0x91')]({'id':0x0,'priority':_0xd6ee12[_0x9d0c('0x82')]['length']+0x1,'app':_0x9d0c('0x92'),'appdata':_0x9d0c('0x93'),'interval':'*,*,*,*'});}}return db[_0x9d0c('0x94')][_0x9d0c('0x59')]({'body':_0x1b4e4a[_0x9d0c('0x5a')][_0x9d0c('0x5a')],'OpenchannelAccountId':_0x1b4e4a['params']['id'],'OpenchannelInteractionId':_0x28b721['id'],'direction':'in','ContactId':_0xd6ee12['contact']['id'],'AttachmentId':_0x1b4e4a['body'][_0x9d0c('0x95')]});})[_0x9d0c('0x32')](function(_0xcfd82e){_0xd6ee12[_0x9d0c('0x24')]=_0xcfd82e;if(!_0xd6ee12[_0x9d0c('0x8f')][_0x9d0c('0x96')])return;return db['User'][_0x9d0c('0x58')]({'attributes':['id',_0x9d0c('0x37')],'where':{'id':_0xd6ee12['interaction'][_0x9d0c('0x96')]}});})['then'](function(_0x1e756f){if(_0x1e756f){_0xd6ee12['applications'][_0x9d0c('0x97')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1e756f[_0x9d0c('0x37')]+','+(_0xd6ee12['account'][_0x9d0c('0x98')]||0xa),'interval':_0x9d0c('0x99')});}if(!_0xd6ee12[_0x9d0c('0x8f')][_0x9d0c('0x9a')])return;return db[_0x9d0c('0x9b')][_0x9d0c('0x58')]({'attributes':['id',_0x9d0c('0x37')],'where':{'id':_0xd6ee12[_0x9d0c('0x8f')]['queueId']}});})[_0x9d0c('0x32')](function(_0x101f23){if(_0x101f23){_0xd6ee12[_0x9d0c('0x82')][_0x9d0c('0x97')]({'id':0x0,'priority':0x1,'app':_0x9d0c('0x9c'),'appdata':_0x101f23[_0x9d0c('0x37')]+','+(_0xd6ee12[_0x9d0c('0x81')]['waitForTheAssignedQueue']||0x12c),'interval':_0x9d0c('0x99')});}return respondWithRpcPromise('Start','startRouting',_0xd6ee12);})[_0x9d0c('0x32')](function(_0x259f56){respondWithRpcPromise(_0x9d0c('0x9d'),_0x9d0c('0x9d'),{'event':_0x9d0c('0x6d'),'message':_0x259f56},client9002);return _0x259f56;})[_0x9d0c('0x32')](respondWithResult(_0x586e16,null))[_0x9d0c('0x26')](handleError(_0x586e16,null));};exports[_0x9d0c('0x9e')]=function(_0x295dc9,_0x1fb90a){var _0x2dde65=_0x295dc9['params']['id'];var _0x56c550=_0x295dc9[_0x9d0c('0x5a')];var _0x4c09e1=0xc8;var _0x1bce14=null;return db[_0x9d0c('0x9f')][_0x9d0c('0xa0')]({'isolationLevel':db[_0x9d0c('0x9f')][_0x9d0c('0xa1')][_0x9d0c('0xa2')][_0x9d0c('0xa3')]},function(_0x380ab3){return db[_0x9d0c('0x3c')][_0x9d0c('0x67')]({'where':{'id':_0x2dde65},'transaction':_0x380ab3})['then'](function(_0x4f5669){if(_0x4f5669){return db[_0x9d0c('0xa4')][_0x9d0c('0x34')]({'where':{'OpenchannelAccountId':_0x2dde65},'transaction':_0x380ab3})[_0x9d0c('0x32')](function(){var _0x3d9d33=_['map'](_0x56c550,function(_0x664447){_0x664447['OpenchannelAccountId']=_0x2dde65;return _0x664447;});return db[_0x9d0c('0xa4')][_0x9d0c('0xa5')](_0x3d9d33,{'transaction':_0x380ab3});});}else{_0x4c09e1=0x194;_0x1bce14=[];}});})[_0x9d0c('0x32')](function(){if(_0x4c09e1!==0x194){return db['OpenchannelApplication'][_0x9d0c('0xa6')]({'where':{'OpenchannelAccountId':_0x2dde65},'order':_0x9d0c('0x84')})['then'](function(_0x42c57e){_0x1bce14=_0x42c57e;});}})[_0x9d0c('0x26')](function(_0xf65f51){_0x4c09e1=0x1f4;logger[_0x9d0c('0x22')](_0xf65f51[_0x9d0c('0x36')]);if(_0xf65f51['name']){delete _0xf65f51[_0x9d0c('0x37')];}_0x1bce14=_0xf65f51;})[_0x9d0c('0xa7')](function(){if(_0x1bce14===null){_0x1fb90a[_0x9d0c('0x27')](_0x4c09e1);}else{if(_0x4c09e1===0x1f4){_0x1fb90a[_0x9d0c('0x28')](_0x4c09e1)[_0x9d0c('0x38')](_0x1bce14);}else{_0x1fb90a[_0x9d0c('0x28')](_0x4c09e1)['json'](_0x1bce14);}}});};exports[_0x9d0c('0xa8')]=function(_0x12c208,_0x338bf8,_0x488a11){var _0x1ff179={};var _0x167b8b={};var _0x348da5;var _0x3b7ec3;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x12c208['params']['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x338bf8,null))['then'](function(_0x596f01){if(_0x596f01){_0x348da5=_0x596f01;_0x167b8b[_0x9d0c('0x45')]=_['keys'](db[_0x9d0c('0xa4')]['rawAttributes']);_0x167b8b[_0x9d0c('0x41')]=_[_0x9d0c('0x42')](_0x12c208['query']);_0x167b8b['filters']=_['intersection'](_0x167b8b[_0x9d0c('0x45')],_0x167b8b[_0x9d0c('0x41')]);_0x1ff179[_0x9d0c('0x46')]=_[_0x9d0c('0x44')](_0x167b8b[_0x9d0c('0x45')],qs[_0x9d0c('0x47')](_0x12c208['query'][_0x9d0c('0x47')]));_0x1ff179[_0x9d0c('0x46')]=_0x1ff179[_0x9d0c('0x46')][_0x9d0c('0x48')]?_0x1ff179[_0x9d0c('0x46')]:_0x167b8b[_0x9d0c('0x45')];_0x1ff179[_0x9d0c('0x68')]=qs[_0x9d0c('0x4b')](_0x12c208[_0x9d0c('0x41')][_0x9d0c('0x4b')]);_0x1ff179[_0x9d0c('0x4c')]=qs[_0x9d0c('0x43')](_[_0x9d0c('0x4d')](_0x12c208[_0x9d0c('0x41')],_0x167b8b[_0x9d0c('0x43')]));if(_0x12c208[_0x9d0c('0x41')][_0x9d0c('0x4e')]){_0x1ff179['where']=_[_0x9d0c('0x4f')](_0x1ff179[_0x9d0c('0x4c')],{'$or':_[_0x9d0c('0x3b')](_0x1ff179['attributes'],function(_0x228a3c){var _0x2def6f={};_0x2def6f[_0x228a3c]={'$like':'%'+_0x12c208['query'][_0x9d0c('0x4e')]+'%'};return _0x2def6f;})});}_0x1ff179=_['merge']({},_0x1ff179,_0x12c208[_0x9d0c('0x50')]);return _0x348da5[_0x9d0c('0xa8')](_0x1ff179);}})['then'](function(_0x2d365a){if(_0x2d365a){_0x3b7ec3=_0x2d365a[_0x9d0c('0x48')];if(!_0x12c208[_0x9d0c('0x41')][_0x9d0c('0x49')](_0x9d0c('0x4a'))){_0x1ff179[_0x9d0c('0x2b')]=qs[_0x9d0c('0x2b')](_0x12c208[_0x9d0c('0x41')][_0x9d0c('0x2b')]);_0x1ff179[_0x9d0c('0x2a')]=qs[_0x9d0c('0x2a')](_0x12c208[_0x9d0c('0x41')][_0x9d0c('0x2a')]);}return _0x348da5[_0x9d0c('0xa8')](_0x1ff179);}})['then'](function(_0x1f7c79){if(_0x1f7c79){return _0x1f7c79?{'count':_0x3b7ec3,'rows':_0x1f7c79}:null;}})[_0x9d0c('0x32')](respondWithResult(_0x338bf8,null))['catch'](handleError(_0x338bf8,null));};exports[_0x9d0c('0xa9')]=function(_0x574953,_0x1d3dc4,_0x4504fd){var _0x5f1a1b={'raw':![],'where':{}};var _0x4b6280={};var _0x4f6d14={'count':0x0,'rows':[]};return db[_0x9d0c('0x3c')]['findOne']({'where':{'id':_0x574953[_0x9d0c('0x56')]['id']}})['then'](handleEntityNotFound(_0x1d3dc4,null))[_0x9d0c('0x32')](function(_0x2912d0){if(_0x2912d0){_0x4b6280['model']=_[_0x9d0c('0x42')](db[_0x9d0c('0x89')][_0x9d0c('0x3d')]);_0x4b6280[_0x9d0c('0x41')]=_['keys'](_0x574953[_0x9d0c('0x41')]);_0x4b6280['filters']=_['intersection'](_0x4b6280[_0x9d0c('0x45')],_0x4b6280[_0x9d0c('0x41')]);_0x5f1a1b[_0x9d0c('0x46')]=_[_0x9d0c('0x44')](_0x4b6280[_0x9d0c('0x45')],qs[_0x9d0c('0x47')](_0x574953[_0x9d0c('0x41')]['fields']));_0x5f1a1b['attributes']=_0x5f1a1b['attributes'][_0x9d0c('0x48')]?_0x5f1a1b[_0x9d0c('0x46')]:_0x4b6280['model'];if(!_0x574953[_0x9d0c('0x41')][_0x9d0c('0x49')](_0x9d0c('0x4a'))){_0x5f1a1b[_0x9d0c('0x2b')]=qs[_0x9d0c('0x2b')](_0x574953[_0x9d0c('0x41')][_0x9d0c('0x2b')]);_0x5f1a1b[_0x9d0c('0x2a')]=qs[_0x9d0c('0x2a')](_0x574953['query'][_0x9d0c('0x2a')]);}_0x5f1a1b[_0x9d0c('0x68')]=qs[_0x9d0c('0x4b')](_0x574953[_0x9d0c('0x41')][_0x9d0c('0x4b')]);_0x5f1a1b[_0x9d0c('0x4c')]=qs['filters'](_[_0x9d0c('0x4d')](_0x574953['query'],_0x4b6280[_0x9d0c('0x43')]));_0x5f1a1b[_0x9d0c('0x4c')]['OpenchannelAccountId']=_0x2912d0['id'];if(_0x574953[_0x9d0c('0x41')][_0x9d0c('0x4e')]){_0x5f1a1b['where']=_[_0x9d0c('0x4f')](_0x5f1a1b['where'],{'$or':_[_0x9d0c('0x3b')](_0x5f1a1b[_0x9d0c('0x46')],function(_0x27bc6a){var _0x22618b={};_0x22618b[_0x27bc6a]={'$like':'%'+_0x574953[_0x9d0c('0x41')][_0x9d0c('0x4e')]+'%'};return _0x22618b;})});}_0x5f1a1b=_[_0x9d0c('0x4f')]({},_0x5f1a1b,_0x574953[_0x9d0c('0x50')]);return db['OpenchannelInteraction'][_0x9d0c('0x29')]({'where':_0x5f1a1b['where']})[_0x9d0c('0x32')](function(_0x171974){_0x4f6d14[_0x9d0c('0x29')]=_0x171974;if(_0x574953['query'][_0x9d0c('0x51')]){_0x5f1a1b[_0x9d0c('0x52')]=[{'model':db[_0x9d0c('0x6f')],'as':'Contact','required':![]},{'model':db[_0x9d0c('0xaa')],'as':_0x9d0c('0xab'),'attributes':[_0x9d0c('0x37'),_0x9d0c('0xac'),_0x9d0c('0xad')],'required':![]},{'model':db[_0x9d0c('0xae')],'as':'Tags','attributes':['id',_0x9d0c('0x37'),'color'],'where':_0x574953[_0x9d0c('0x41')]['tag']?{'id':_0x574953[_0x9d0c('0x41')][_0x9d0c('0xaf')]}:undefined,'required':_0x574953[_0x9d0c('0x41')][_0x9d0c('0xaf')]?!![]:![]}];}return db[_0x9d0c('0x89')][_0x9d0c('0x53')](_0x5f1a1b);})[_0x9d0c('0x32')](function(_0x498483){_0x4f6d14[_0x9d0c('0x54')]=_0x498483;return _0x4f6d14;});}})[_0x9d0c('0x32')](respondWithFilteredResult(_0x1d3dc4,_0x5f1a1b))[_0x9d0c('0x26')](handleError(_0x1d3dc4,null));};exports['addAgents']=function(_0x4ca090,_0x1cb666,_0x371631){return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x4ca090['params']['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x1cb666,null))[_0x9d0c('0x32')](function(_0x54c0af){if(_0x54c0af){return _0x54c0af[_0x9d0c('0xb0')](_0x4ca090[_0x9d0c('0x5a')]['ids'],_[_0x9d0c('0xb1')](_0x4ca090['body'],[_0x9d0c('0x6a'),'id'])||{})['spread'](function(_0x2030c1){for(var _0x360577=0x0;_0x360577<_0x4ca090[_0x9d0c('0x5a')]['ids']['length'];_0x360577+=0x1){socket[_0x9d0c('0xb2')](_0x9d0c('0xb3'),{'UserId':Number(_0x4ca090[_0x9d0c('0x5a')][_0x9d0c('0x6a')][_0x360577]),'OpenchannelAccountId':Number(_0x4ca090[_0x9d0c('0x56')]['id'])});}return _0x2030c1;});}})[_0x9d0c('0x32')](respondWithResult(_0x1cb666,null))[_0x9d0c('0x26')](handleError(_0x1cb666,null));};exports[_0x9d0c('0xb4')]=function(_0x3af091,_0x5541ff,_0x360d7){return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x3af091[_0x9d0c('0x56')]['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x5541ff,null))[_0x9d0c('0x32')](function(_0x13616d){if(_0x13616d){return _0x13616d[_0x9d0c('0xb4')](_0x3af091[_0x9d0c('0x41')]['ids'])['then'](function(){if(_['isArray'](_0x3af091[_0x9d0c('0x41')]['ids'])){for(var _0x208728=0x0;_0x208728<_0x3af091[_0x9d0c('0x41')][_0x9d0c('0x6a')]['length'];_0x208728+=0x1){socket[_0x9d0c('0xb2')](_0x9d0c('0xb5'),{'UserId':Number(_0x3af091[_0x9d0c('0x41')][_0x9d0c('0x6a')][_0x208728]),'OpenchannelAccountId':Number(_0x3af091[_0x9d0c('0x56')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3af091[_0x9d0c('0x41')]['ids']),'OpenchannelAccountId':Number(_0x3af091['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5541ff,null))[_0x9d0c('0x26')](handleError(_0x5541ff,null));};exports[_0x9d0c('0xb6')]=function(_0x52a55f,_0x34ae03,_0x59d190){var _0x227bad={};var _0x5ba2a3={};var _0x4f14c7;var _0x35b1ed;return db[_0x9d0c('0x3c')][_0x9d0c('0x67')]({'where':{'id':_0x52a55f['params']['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x34ae03,null))[_0x9d0c('0x32')](function(_0xd3967d){if(_0xd3967d){_0x4f14c7=_0xd3967d;_0x5ba2a3[_0x9d0c('0x45')]=_['keys'](db[_0x9d0c('0xaa')][_0x9d0c('0x3d')]);_0x5ba2a3[_0x9d0c('0x41')]=_['keys'](_0x52a55f[_0x9d0c('0x41')]);_0x5ba2a3['filters']=_[_0x9d0c('0x44')](_0x5ba2a3[_0x9d0c('0x45')],_0x5ba2a3[_0x9d0c('0x41')]);_0x227bad['attributes']=_[_0x9d0c('0x44')](_0x5ba2a3[_0x9d0c('0x45')],qs[_0x9d0c('0x47')](_0x52a55f[_0x9d0c('0x41')][_0x9d0c('0x47')]));_0x227bad[_0x9d0c('0x46')]=_0x227bad[_0x9d0c('0x46')][_0x9d0c('0x48')]?_0x227bad[_0x9d0c('0x46')]:_0x5ba2a3[_0x9d0c('0x45')];_0x227bad[_0x9d0c('0x68')]=qs['sort'](_0x52a55f[_0x9d0c('0x41')]['sort']);_0x227bad[_0x9d0c('0x4c')]=qs[_0x9d0c('0x43')](_[_0x9d0c('0x4d')](_0x52a55f[_0x9d0c('0x41')],_0x5ba2a3[_0x9d0c('0x43')]));if(_0x52a55f[_0x9d0c('0x41')]['filter']){_0x227bad['where']=_['merge'](_0x227bad['where'],{'$or':_['map'](_0x227bad['attributes'],function(_0xffdf6a){var _0x2f3fdc={};_0x2f3fdc[_0xffdf6a]={'$like':'%'+_0x52a55f[_0x9d0c('0x41')][_0x9d0c('0x4e')]+'%'};return _0x2f3fdc;})});}_0x227bad=_[_0x9d0c('0x4f')]({},_0x227bad,_0x52a55f[_0x9d0c('0x50')]);return _0x4f14c7['getAgents'](_0x227bad);}})[_0x9d0c('0x32')](function(_0x419c68){if(_0x419c68){_0x35b1ed=_0x419c68[_0x9d0c('0x48')];if(!_0x52a55f[_0x9d0c('0x41')]['hasOwnProperty']('nolimit')){_0x227bad['limit']=qs['limit'](_0x52a55f['query'][_0x9d0c('0x2b')]);_0x227bad['offset']=qs[_0x9d0c('0x2a')](_0x52a55f[_0x9d0c('0x41')]['offset']);}return _0x4f14c7[_0x9d0c('0xb6')](_0x227bad);}})[_0x9d0c('0x32')](function(_0x4fc32d){if(_0x4fc32d){return _0x4fc32d?{'count':_0x35b1ed,'rows':_0x4fc32d}:null;}})[_0x9d0c('0x32')](respondWithResult(_0x34ae03,null))[_0x9d0c('0x26')](handleError(_0x34ae03,null));};exports[_0x9d0c('0x38')]=function(_0x210367,_0x4260c4,_0x5dc763){var _0x45a1ab,_0x2b08f9,_0x5d0f9f;if(_['isNil'](_0x210367['body']['body'])||_0x210367['body']['body']===''){throw new db[(_0x9d0c('0x70'))]['ValidationError'](_0x9d0c('0x79'));}if(_[_0x9d0c('0x78')](_0x210367[_0x9d0c('0x5a')]['to'])){}_0x45a1ab=_0x210367[_0x9d0c('0x5a')]['to'];return db[_0x9d0c('0x3c')][_0x9d0c('0x67')]({'where':{'id':_0x210367['params']['id']}})[_0x9d0c('0x32')](handleEntityNotFound(_0x4260c4,null))[_0x9d0c('0x32')](function(_0x58a583){if(_0x58a583){return db[_0x9d0c('0x3c')][_0x9d0c('0x58')]({'where':{'id':_0x58a583['id']},'include':[{'model':db[_0x9d0c('0x7c')],'as':'List','include':[{'model':db[_0x9d0c('0x6f')],'as':_0x9d0c('0x7d'),'where':{[_0x58a583[_0x9d0c('0x7a')]]:_0x45a1ab},'limit':0x1,'order':[[_0x9d0c('0x74'),'DESC']]}]}]})[_0x9d0c('0x32')](handleEntityNotFound(_0x4260c4,null))[_0x9d0c('0x32')](function(_0xd2614f){if(_0xd2614f&&_0xd2614f[_0x9d0c('0x80')]){_0x2b08f9=_0xd2614f[_0x9d0c('0x5c')]({'plain':!![]});if(_0x2b08f9['List']&&_0x2b08f9[_0x9d0c('0x80')]['Contacts']['length']){return _0x2b08f9[_0x9d0c('0x80')]['Contacts'][0x0];}return db[_0x9d0c('0x6f')][_0x9d0c('0x59')](_[_0x9d0c('0x16')](_0x210367[_0x9d0c('0x5a')],{'firstName':_0x45a1ab,[_0xd2614f[_0x9d0c('0x7a')]]:_0x45a1ab,'phone':_0x45a1ab,'ListId':_0x2b08f9[_0x9d0c('0x75')]}));}})[_0x9d0c('0x32')](handleEntityNotFound(_0x4260c4,null))[_0x9d0c('0x32')](function(_0x21fc3d){if(_0x21fc3d){_0x5d0f9f=_0x21fc3d;return db[_0x9d0c('0x89')]['find']({'where':{'ContactId':_0x5d0f9f['id'],'closed':![],'OpenchannelAccountId':_0x2b08f9['id']}})[_0x9d0c('0x32')](function(_0x5efaeb){if(_0x5efaeb){return[_0x5efaeb,![]];}return db['OpenchannelInteraction'][_0x9d0c('0x59')]({'UserId':_0x210367[_0x9d0c('0x5b')]['id'],'ContactId':_0x5d0f9f['id'],'OpenchannelAccountId':_0x2b08f9['id'],'lastMsgDirection':_0x9d0c('0xb7'),'firstMsgDirection':_0x9d0c('0xb7'),'Messages':[_[_0x9d0c('0x4f')](_0x210367[_0x9d0c('0x5a')],{'read':![],'body':_0x210367[_0x9d0c('0x5a')][_0x9d0c('0x5a')],'OpenchannelAccountId':_0x2b08f9['id'],'UserId':_0x210367['user']['id'],'ContactId':_0x5d0f9f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x9d0c('0xb8')}]})[_0x9d0c('0x32')](function(_0x3ebb59){return[_0x3ebb59,!![]];});});}})['spread'](function(_0xeac917,_0x19cb6d){if(_0x19cb6d){return _0xeac917;}return db[_0x9d0c('0x94')][_0x9d0c('0x59')](_[_0x9d0c('0x4f')](_0x210367[_0x9d0c('0x5a')],{'read':![],'body':_0x210367['body']['body'],'OpenchannelAccountId':_0x2b08f9['id'],'OpenchannelInteractionId':_0xeac917['id'],'UserId':_0x210367[_0x9d0c('0x5b')]['id'],'ContactId':_0x5d0f9f['id']}))[_0x9d0c('0x32')](function(_0x14c9b9){_0xeac917[_0x9d0c('0xb9')]['Messages']=[];_0xeac917[_0x9d0c('0xb9')][_0x9d0c('0xb8')]['push'](_0x14c9b9['dataValues']);return _0xeac917;});});}})[_0x9d0c('0x32')](respondWithResult(_0x4260c4,null))['catch'](handleError(_0x4260c4,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index cbe8cfe..6341678 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 _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x18dfbd,_0xdaf40e){var _0x433f71=function(_0x3073e3){while(--_0x3073e3){_0x18dfbd['push'](_0x18dfbd['shift']());}};_0x433f71(++_0xdaf40e);}(_0x878f,0x173));var _0xf878=function(_0x5be477,_0x1b7f4c){_0x5be477=_0x5be477-0x0;var _0x3711be=_0x878f[_0x5be477];return _0x3711be;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xb903,0x185));var _0x3b90=function(_0x3103fe,_0x3cf534){_0x3103fe=_0x3103fe-0x0;var _0x4a0652=_0xb903[_0x3103fe];return _0x4a0652;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4436263..c03b28f 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(_0x363b40,_0x203c6c){var _0x534fd1=function(_0x1a66fa){while(--_0x1a66fa){_0x363b40['push'](_0x363b40['shift']());}};_0x534fd1(++_0x203c6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x29bd8d,_0xef0c5f){var _0x2b0f48=function(_0x5dae16){while(--_0x5dae16){_0x29bd8d['push'](_0x29bd8d['shift']());}};_0x2b0f48(++_0xef0c5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 7ff45cc..c2b7656 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 _0xcffe=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x426de2,_0x24acaf){var _0x1dbafc=function(_0x57e5d4){while(--_0x57e5d4){_0x426de2['push'](_0x426de2['shift']());}};_0x1dbafc(++_0x24acaf);}(_0xcffe,0x1a1));var _0xecff=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0xcffe[_0x3d73ba];return _0x47e406;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var rs=require(_0xecff('0x4'));var fs=require('fs');var Redis=require(_0xecff('0x5'));var db=require(_0xecff('0x6'))['db'];var utils=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecff('0xa')][_0xecff('0xb')]({'port':0x232a});config[_0xecff('0xc')]=_[_0xecff('0xd')](config[_0xecff('0xc')],{'host':_0xecff('0xe'),'port':0x18eb});var socket=require(_0xecff('0xf'))(new Redis(config['redis']));require(_0xecff('0x10'))[_0xecff('0x11')](socket);function respondWithRpcPromise(_0x195b15,_0x20ab4f,_0x698e40){return new BPromise(function(_0x4fa444,_0x425380){return client[_0xecff('0x12')](_0x195b15,_0x698e40)[_0xecff('0x13')](function(_0x3ed904){logger[_0xecff('0x14')](_0xecff('0x15'),_0x20ab4f,_0xecff('0x16'));logger[_0xecff('0x17')](_0xecff('0x18'),_0x20ab4f,_0xecff('0x16'),JSON[_0xecff('0x19')](_0x3ed904));if(_0x3ed904[_0xecff('0x1a')]){if(_0x3ed904[_0xecff('0x1a')][_0xecff('0x1b')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x20ab4f,_0x3ed904[_0xecff('0x1a')][_0xecff('0x1c')]);return _0x425380(_0x3ed904['error'][_0xecff('0x1c')]);}logger[_0xecff('0x1a')](_0xecff('0x15'),_0x20ab4f,_0x3ed904['error']['message']);return _0x4fa444(_0x3ed904[_0xecff('0x1a')][_0xecff('0x1c')]);}else{logger['info'](_0xecff('0x15'),_0x20ab4f,_0xecff('0x16'));_0x4fa444(_0x3ed904[_0xecff('0x1d')][_0xecff('0x1c')]);}})[_0xecff('0x1e')](function(_0x1682a2){logger['error'](_0xecff('0x15'),_0x20ab4f,_0x1682a2);_0x425380(_0x1682a2);});});} \ No newline at end of file +var _0x0833=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','request','then','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x35be1c,_0x45a7ef){var _0x1d99e1=function(_0x4e8004){while(--_0x4e8004){_0x35be1c['push'](_0x35be1c['shift']());}};_0x1d99e1(++_0x45a7ef);}(_0x0833,0x1bd));var _0x3083=function(_0x1d822f,_0x48fdee){_0x1d822f=_0x1d822f-0x0;var _0x2e137d=_0x0833[_0x1d822f];return _0x2e137d;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var moment=require(_0x3083('0x2'));var BPromise=require(_0x3083('0x3'));var rs=require(_0x3083('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3083('0x5'))('rpc');var config=require(_0x3083('0x6'));var jayson=require(_0x3083('0x7'));var client=jayson[_0x3083('0x8')]['http']({'port':0x232a});config[_0x3083('0x9')]=_[_0x3083('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3083('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x43f038,_0x2e7419,_0xb187b0){return new BPromise(function(_0x18d150,_0x312ee7){return client[_0x3083('0xb')](_0x43f038,_0xb187b0)[_0x3083('0xc')](function(_0x2f5961){logger[_0x3083('0xd')](_0x3083('0xe'),_0x2e7419,_0x3083('0xf'));logger[_0x3083('0x10')](_0x3083('0x11'),_0x2e7419,_0x3083('0xf'),JSON[_0x3083('0x12')](_0x2f5961));if(_0x2f5961['error']){if(_0x2f5961[_0x3083('0x13')][_0x3083('0x14')]===0x1f4){logger['error'](_0x3083('0xe'),_0x2e7419,_0x2f5961[_0x3083('0x13')]['message']);return _0x312ee7(_0x2f5961[_0x3083('0x13')][_0x3083('0x15')]);}logger[_0x3083('0x13')](_0x3083('0xe'),_0x2e7419,_0x2f5961[_0x3083('0x13')][_0x3083('0x15')]);return _0x18d150(_0x2f5961[_0x3083('0x13')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2e7419,_0x3083('0xf'));_0x18d150(_0x2f5961['result'][_0x3083('0x15')]);}})[_0x3083('0x16')](function(_0x419c95){logger[_0x3083('0x13')](_0x3083('0xe'),_0x2e7419,_0x419c95);_0x312ee7(_0x419c95);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index acec013..bb1cc1b 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 _0x8db0=['register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8db0,0x65));var _0x08db=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x8db0[_0x46428c];return _0x16a677;};'use strict';var OpenchannelAccountEvents=require(_0x08db('0x0'));var events=[_0x08db('0x1'),'remove',_0x08db('0x2')];function createListener(_0x2ac694,_0x17ccf3){return function(_0x5eb423){_0x17ccf3[_0x08db('0x3')](_0x2ac694,_0x5eb423);};}function removeListener(_0x55e572,_0x4f4614){return function(){OpenchannelAccountEvents['removeListener'](_0x55e572,_0x4f4614);};}exports[_0x08db('0x4')]=function(_0x55af6b){for(var _0x14b0e6=0x0,_0x528139=events[_0x08db('0x5')];_0x14b0e6<_0x528139;_0x14b0e6++){var _0x1ca3d1=events[_0x14b0e6];var _0x16bcc0=createListener(_0x08db('0x6')+_0x1ca3d1,_0x55af6b);OpenchannelAccountEvents['on'](_0x1ca3d1,_0x16bcc0);}}; \ No newline at end of file +var _0x2121=['length','./openchannelAccount.events','save','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2121,0x1b4));var _0x1212=function(_0x52e402,_0x2e2400){_0x52e402=_0x52e402-0x0;var _0x11119e=_0x2121[_0x52e402];return _0x11119e;};'use strict';var OpenchannelAccountEvents=require(_0x1212('0x0'));var events=[_0x1212('0x1'),'remove','update'];function createListener(_0x1e00c4,_0x3081d8){return function(_0x3929a1){_0x3081d8[_0x1212('0x2')](_0x1e00c4,_0x3929a1);};}function removeListener(_0x44337c,_0x553ed1){return function(){OpenchannelAccountEvents[_0x1212('0x3')](_0x44337c,_0x553ed1);};}exports['register']=function(_0x7b16ef){for(var _0x452116=0x0,_0x20fadc=events[_0x1212('0x4')];_0x452116<_0x20fadc;_0x452116++){var _0x233a53=events[_0x452116];var _0x642ed5=createListener('openchannelAccount:'+_0x233a53,_0x7b16ef);OpenchannelAccountEvents['on'](_0x233a53,_0x642ed5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 274bff6..02d12ab 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 _0xd57f=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x1a6556,_0x1fd199){var _0x4c6148=function(_0xed9d82){while(--_0xed9d82){_0x1a6556['push'](_0x1a6556['shift']());}};_0x4c6148(++_0x1fd199);}(_0xd57f,0x137));var _0xfd57=function(_0x5478c9,_0x4a396f){_0x5478c9=_0x5478c9-0x0;var _0x2bd706=_0xd57f[_0x5478c9];return _0x2bd706;};'use strict';var multer=require(_0xfd57('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfd57('0x1'));var express=require('express');var router=express[_0xfd57('0x2')]();var fs_extra=require(_0xfd57('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfd57('0x4'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xfd57('0x5')]('/',auth[_0xfd57('0x6')](),controller[_0xfd57('0x7')]);router[_0xfd57('0x5')](_0xfd57('0x8'),auth[_0xfd57('0x6')](),controller[_0xfd57('0x9')]);router[_0xfd57('0xa')]('/',auth[_0xfd57('0x6')](),controller[_0xfd57('0xb')]);router[_0xfd57('0xc')](_0xfd57('0x8'),auth[_0xfd57('0x6')](),controller[_0xfd57('0xd')]);router['delete'](_0xfd57('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xfd57('0xe')]=router; \ No newline at end of file +var _0xf11a=['../../config/environment','./openchannelApplication.controller','isAuthenticated','/:id','show','post','create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57f210,_0x11ff56){var _0xbe9f70=function(_0x554dbb){while(--_0x554dbb){_0x57f210['push'](_0x57f210['shift']());}};_0xbe9f70(++_0x11ff56);}(_0xf11a,0xb4));var _0xaf11=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xf11a[_0x2a7b8e];return _0x29b5c8;};'use strict';var multer=require(_0xaf11('0x0'));var util=require(_0xaf11('0x1'));var path=require(_0xaf11('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf11('0x3'));var router=express[_0xaf11('0x4')]();var fs_extra=require(_0xaf11('0x5'));var auth=require(_0xaf11('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf11('0x7'));var controller=require(_0xaf11('0x8'));router['get']('/',auth[_0xaf11('0x9')](),controller['index']);router['get'](_0xaf11('0xa'),auth['isAuthenticated'](),controller[_0xaf11('0xb')]);router[_0xaf11('0xc')]('/',auth[_0xaf11('0x9')](),controller[_0xaf11('0xd')]);router[_0xaf11('0xe')](_0xaf11('0xa'),auth[_0xaf11('0x9')](),controller['update']);router[_0xaf11('0xf')](_0xaf11('0xa'),auth[_0xaf11('0x9')](),controller[_0xaf11('0x10')]);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 32fd08f..43379be 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 _0xa9d8=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x3f213e,_0x26eaee){var _0x181a85=function(_0x4fbc02){while(--_0x4fbc02){_0x3f213e['push'](_0x3f213e['shift']());}};_0x181a85(++_0x26eaee);}(_0xa9d8,0x84));var _0x8a9d=function(_0x3de0b8,_0x2dc6c1){_0x3de0b8=_0x3de0b8-0x0;var _0x19d5da=_0xa9d8[_0x3de0b8];return _0x19d5da;};'use strict';var Sequelize=require(_0x8a9d('0x0'));module[_0x8a9d('0x1')]={'priority':{'type':Sequelize[_0x8a9d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8a9d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8a9d('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8a9d('0x5')}}; \ No newline at end of file +var _0xef67=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xef67,0x1cf));var _0x7ef6=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xef67[_0x3712e2];return _0x1faff4;};'use strict';var Sequelize=require(_0x7ef6('0x0'));module[_0x7ef6('0x1')]={'priority':{'type':Sequelize[_0x7ef6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7ef6('0x3')],'allowNull':![],'defaultValue':_0x7ef6('0x4')},'appdata':{'type':Sequelize[_0x7ef6('0x5')]()},'description':{'type':Sequelize[_0x7ef6('0x3')]},'interval':{'type':Sequelize[_0x7ef6('0x3')],'defaultValue':_0x7ef6('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 611f45a..11c37d0 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 _0x3c96=['catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x3583c8,_0x114e2c){var _0x29385b=function(_0x5edb24){while(--_0x5edb24){_0x3583c8['push'](_0x3583c8['shift']());}};_0x29385b(++_0x114e2c);}(_0x3c96,0xef));var _0x63c9=function(_0x5388bf,_0x4c5388){_0x5388bf=_0x5388bf-0x0;var _0x3dfcd1=_0x3c96[_0x5388bf];return _0x3dfcd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63c9('0x0'));var zipdir=require(_0x63c9('0x1'));var jsonpatch=require(_0x63c9('0x2'));var rp=require(_0x63c9('0x3'));var moment=require(_0x63c9('0x4'));var BPromise=require(_0x63c9('0x5'));var Mustache=require(_0x63c9('0x6'));var util=require(_0x63c9('0x7'));var path=require(_0x63c9('0x8'));var sox=require(_0x63c9('0x9'));var csv=require(_0x63c9('0xa'));var ejs=require(_0x63c9('0xb'));var fs=require('fs');var fs_extra=require(_0x63c9('0xc'));var _=require(_0x63c9('0xd'));var squel=require(_0x63c9('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x63c9('0xf'));var toCsv=require(_0x63c9('0xa'));var querystring=require(_0x63c9('0x10'));var Papa=require('papaparse');var Redis=require(_0x63c9('0x11'));var authService=require(_0x63c9('0x12'));var qs=require(_0x63c9('0x13'));var as=require(_0x63c9('0x14'));var hardwareService=require(_0x63c9('0x15'));var logger=require(_0x63c9('0x16'))(_0x63c9('0x17'));var utils=require(_0x63c9('0x18'));var config=require(_0x63c9('0x19'));var licenseUtil=require(_0x63c9('0x1a'));var db=require(_0x63c9('0x1b'))['db'];function respondWithStatusCode(_0x597a20,_0x537948){_0x537948=_0x537948||0xcc;return function(_0x41ce77){if(_0x41ce77){return _0x597a20[_0x63c9('0x1c')](_0x537948);}return _0x597a20[_0x63c9('0x1d')](_0x537948)[_0x63c9('0x1e')]();};}function respondWithResult(_0x64a591,_0x2d8106){_0x2d8106=_0x2d8106||0xc8;return function(_0x28d708){if(_0x28d708){return _0x64a591[_0x63c9('0x1d')](_0x2d8106)[_0x63c9('0x1f')](_0x28d708);}};}function respondWithFilteredResult(_0x53a26d,_0xeda03e){return function(_0x42050a){if(_0x42050a){var _0x201f3c=typeof _0xeda03e[_0x63c9('0x20')]===_0x63c9('0x21')&&typeof _0xeda03e['limit']===_0x63c9('0x21');var _0x57c63b=_0x42050a[_0x63c9('0x22')];var _0x40a1fe=_0x201f3c?0x0:_0xeda03e[_0x63c9('0x20')];var _0x4a4699=_0x201f3c?_0x42050a['count']:_0xeda03e[_0x63c9('0x20')]+_0xeda03e[_0x63c9('0x23')];var _0x939b71;if(_0x4a4699>=_0x57c63b){_0x4a4699=_0x57c63b;_0x939b71=0xc8;}else{_0x939b71=0xce;}_0x53a26d[_0x63c9('0x1d')](_0x939b71);return _0x53a26d[_0x63c9('0x24')](_0x63c9('0x25'),_0x40a1fe+'-'+_0x4a4699+'/'+_0x57c63b)[_0x63c9('0x1f')](_0x42050a);}return null;};}function patchUpdates(_0x5df26a){return function(_0x4c6010){try{jsonpatch[_0x63c9('0x26')](_0x4c6010,_0x5df26a,!![]);}catch(_0x25cdc9){return BPromise[_0x63c9('0x27')](_0x25cdc9);}return _0x4c6010[_0x63c9('0x28')]();};}function saveUpdates(_0x57886f,_0x2de996){return function(_0x435c79){if(_0x435c79){return _0x435c79[_0x63c9('0x29')](_0x57886f)['then'](function(_0x5b1965){return _0x5b1965;});}return null;};}function removeEntity(_0x416643,_0x4a3831){return function(_0x4bf325){if(_0x4bf325){return _0x4bf325[_0x63c9('0x2a')]()[_0x63c9('0x2b')](function(){_0x416643[_0x63c9('0x1d')](0xcc)[_0x63c9('0x1e')]();});}};}function handleEntityNotFound(_0xf6515e,_0x1986bf){return function(_0x5415e0){if(!_0x5415e0){_0xf6515e[_0x63c9('0x1c')](0x194);}return _0x5415e0;};}function handleError(_0x1a9ae1,_0x578cf6){_0x578cf6=_0x578cf6||0x1f4;return function(_0x106ff8){logger[_0x63c9('0x2c')](_0x106ff8[_0x63c9('0x2d')]);if(_0x106ff8[_0x63c9('0x2e')]){delete _0x106ff8[_0x63c9('0x2e')];}_0x1a9ae1['status'](_0x578cf6)['send'](_0x106ff8);};}exports[_0x63c9('0x2f')]=function(_0x53100b,_0x59e0f9){var _0x8eafcc={},_0x1cfc92={},_0xefc6c7={'count':0x0,'rows':[]};var _0x47fe29=_[_0x63c9('0x30')](db[_0x63c9('0x31')][_0x63c9('0x32')],function(_0x24a350){return{'name':_0x24a350['fieldName'],'type':_0x24a350[_0x63c9('0x33')][_0x63c9('0x34')]};});_0x1cfc92[_0x63c9('0x35')]=_[_0x63c9('0x30')](_0x47fe29,_0x63c9('0x2e'));_0x1cfc92['query']=_[_0x63c9('0x36')](_0x53100b[_0x63c9('0x37')]);_0x1cfc92[_0x63c9('0x38')]=_[_0x63c9('0x39')](_0x1cfc92['model'],_0x1cfc92[_0x63c9('0x37')]);_0x8eafcc[_0x63c9('0x3a')]=_[_0x63c9('0x39')](_0x1cfc92[_0x63c9('0x35')],qs[_0x63c9('0x3b')](_0x53100b[_0x63c9('0x37')]['fields']));_0x8eafcc[_0x63c9('0x3a')]=_0x8eafcc[_0x63c9('0x3a')][_0x63c9('0x3c')]?_0x8eafcc[_0x63c9('0x3a')]:_0x1cfc92['model'];if(!_0x53100b[_0x63c9('0x37')][_0x63c9('0x3d')]('nolimit')){_0x8eafcc['limit']=qs['limit'](_0x53100b[_0x63c9('0x37')][_0x63c9('0x23')]);_0x8eafcc[_0x63c9('0x20')]=qs['offset'](_0x53100b[_0x63c9('0x37')][_0x63c9('0x20')]);}_0x8eafcc[_0x63c9('0x3e')]=qs[_0x63c9('0x3f')](_0x53100b[_0x63c9('0x37')][_0x63c9('0x3f')]);_0x8eafcc[_0x63c9('0x40')]=qs[_0x63c9('0x38')](_[_0x63c9('0x41')](_0x53100b[_0x63c9('0x37')],_0x1cfc92[_0x63c9('0x38')]),_0x47fe29);if(_0x53100b[_0x63c9('0x37')][_0x63c9('0x42')]){_0x8eafcc[_0x63c9('0x40')]=_[_0x63c9('0x43')](_0x8eafcc[_0x63c9('0x40')],{'$or':_['map'](_0x47fe29,function(_0x35d5da){if(_0x35d5da[_0x63c9('0x33')]!==_0x63c9('0x44')){var _0x3668a3={};_0x3668a3[_0x35d5da[_0x63c9('0x2e')]]={'$like':'%'+_0x53100b[_0x63c9('0x37')]['filter']+'%'};return _0x3668a3;}})});}_0x8eafcc=_['merge']({},_0x8eafcc,_0x53100b[_0x63c9('0x45')]);var _0x53653f={'where':_0x8eafcc[_0x63c9('0x40')]};return db[_0x63c9('0x31')]['count'](_0x53653f)['then'](function(_0x3cb39a){_0xefc6c7['count']=_0x3cb39a;if(_0x53100b[_0x63c9('0x37')][_0x63c9('0x46')]){_0x8eafcc[_0x63c9('0x47')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x8eafcc);})[_0x63c9('0x2b')](function(_0xe1bac2){_0xefc6c7[_0x63c9('0x48')]=_0xe1bac2;return _0xefc6c7;})[_0x63c9('0x2b')](respondWithFilteredResult(_0x59e0f9,_0x8eafcc))[_0x63c9('0x49')](handleError(_0x59e0f9,null));};exports['show']=function(_0x54a85a,_0x5d73a8){var _0x31e005={'raw':!![],'where':{'id':_0x54a85a[_0x63c9('0x4a')]['id']}},_0x3d759c={};_0x3d759c['model']=_[_0x63c9('0x36')](db[_0x63c9('0x31')][_0x63c9('0x32')]);_0x3d759c[_0x63c9('0x37')]=_[_0x63c9('0x36')](_0x54a85a[_0x63c9('0x37')]);_0x3d759c[_0x63c9('0x38')]=_[_0x63c9('0x39')](_0x3d759c['model'],_0x3d759c['query']);_0x31e005[_0x63c9('0x3a')]=_['intersection'](_0x3d759c[_0x63c9('0x35')],qs['fields'](_0x54a85a[_0x63c9('0x37')][_0x63c9('0x3b')]));_0x31e005[_0x63c9('0x3a')]=_0x31e005[_0x63c9('0x3a')][_0x63c9('0x3c')]?_0x31e005[_0x63c9('0x3a')]:_0x3d759c[_0x63c9('0x35')];if(_0x54a85a[_0x63c9('0x37')]['includeAll']){_0x31e005[_0x63c9('0x47')]=[{'all':!![]}];}_0x31e005=_[_0x63c9('0x43')]({},_0x31e005,_0x54a85a['options']);return db[_0x63c9('0x31')][_0x63c9('0x4b')](_0x31e005)[_0x63c9('0x2b')](handleEntityNotFound(_0x5d73a8,null))[_0x63c9('0x2b')](respondWithResult(_0x5d73a8,null))[_0x63c9('0x49')](handleError(_0x5d73a8,null));};exports['create']=function(_0x541414,_0x132a9c){return db['OpenchannelApplication'][_0x63c9('0x4c')](_0x541414[_0x63c9('0x4d')],{})['then'](respondWithResult(_0x132a9c,0xc9))[_0x63c9('0x49')](handleError(_0x132a9c,null));};exports[_0x63c9('0x29')]=function(_0x111a5e,_0x479011){if(_0x111a5e[_0x63c9('0x4d')]['id']){delete _0x111a5e[_0x63c9('0x4d')]['id'];}return db[_0x63c9('0x31')]['find']({'where':{'id':_0x111a5e[_0x63c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x479011,null))[_0x63c9('0x2b')](saveUpdates(_0x111a5e['body'],null))[_0x63c9('0x2b')](respondWithResult(_0x479011,null))[_0x63c9('0x49')](handleError(_0x479011,null));};exports[_0x63c9('0x2a')]=function(_0x13b92c,_0x311bb5){return db[_0x63c9('0x31')][_0x63c9('0x4b')]({'where':{'id':_0x13b92c[_0x63c9('0x4a')]['id']}})[_0x63c9('0x2b')](handleEntityNotFound(_0x311bb5,null))['then'](removeEntity(_0x311bb5,null))[_0x63c9('0x49')](handleError(_0x311bb5,null));}; \ No newline at end of file +var _0x9fcc=['send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','body','find','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name'];(function(_0x1e50a0,_0x10d03e){var _0x5b8709=function(_0x6c7db3){while(--_0x6c7db3){_0x1e50a0['push'](_0x1e50a0['shift']());}};_0x5b8709(++_0x10d03e);}(_0x9fcc,0x1b9));var _0xc9fc=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9fcc[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require(_0xc9fc('0x0'));var rimraf=require(_0xc9fc('0x1'));var zipdir=require(_0xc9fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9fc('0x3'));var moment=require(_0xc9fc('0x4'));var BPromise=require(_0xc9fc('0x5'));var Mustache=require(_0xc9fc('0x6'));var util=require(_0xc9fc('0x7'));var path=require(_0xc9fc('0x8'));var sox=require('sox');var csv=require(_0xc9fc('0x9'));var ejs=require(_0xc9fc('0xa'));var fs=require('fs');var fs_extra=require(_0xc9fc('0xb'));var _=require(_0xc9fc('0xc'));var squel=require('squel');var crypto=require(_0xc9fc('0xd'));var jsforce=require(_0xc9fc('0xe'));var deskjs=require(_0xc9fc('0xf'));var toCsv=require(_0xc9fc('0x9'));var querystring=require(_0xc9fc('0x10'));var Papa=require(_0xc9fc('0x11'));var Redis=require(_0xc9fc('0x12'));var authService=require(_0xc9fc('0x13'));var qs=require(_0xc9fc('0x14'));var as=require(_0xc9fc('0x15'));var hardwareService=require(_0xc9fc('0x16'));var logger=require(_0xc9fc('0x17'))(_0xc9fc('0x18'));var utils=require(_0xc9fc('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc9fc('0x1a'));var db=require(_0xc9fc('0x1b'))['db'];function respondWithStatusCode(_0x26af99,_0x129811){_0x129811=_0x129811||0xcc;return function(_0x5e5dd6){if(_0x5e5dd6){return _0x26af99[_0xc9fc('0x1c')](_0x129811);}return _0x26af99[_0xc9fc('0x1d')](_0x129811)[_0xc9fc('0x1e')]();};}function respondWithResult(_0x1dc533,_0x54d993){_0x54d993=_0x54d993||0xc8;return function(_0x36cf87){if(_0x36cf87){return _0x1dc533[_0xc9fc('0x1d')](_0x54d993)[_0xc9fc('0x1f')](_0x36cf87);}};}function respondWithFilteredResult(_0x52c183,_0xdeb6b7){return function(_0x5d16e5){if(_0x5d16e5){var _0x15e558=typeof _0xdeb6b7['offset']===_0xc9fc('0x20')&&typeof _0xdeb6b7['limit']===_0xc9fc('0x20');var _0x223c5f=_0x5d16e5[_0xc9fc('0x21')];var _0x2bd544=_0x15e558?0x0:_0xdeb6b7[_0xc9fc('0x22')];var _0x20587d=_0x15e558?_0x5d16e5[_0xc9fc('0x21')]:_0xdeb6b7[_0xc9fc('0x22')]+_0xdeb6b7['limit'];var _0xa6f295;if(_0x20587d>=_0x223c5f){_0x20587d=_0x223c5f;_0xa6f295=0xc8;}else{_0xa6f295=0xce;}_0x52c183['status'](_0xa6f295);return _0x52c183[_0xc9fc('0x23')](_0xc9fc('0x24'),_0x2bd544+'-'+_0x20587d+'/'+_0x223c5f)[_0xc9fc('0x1f')](_0x5d16e5);}return null;};}function patchUpdates(_0x20b83e){return function(_0x299798){try{jsonpatch[_0xc9fc('0x25')](_0x299798,_0x20b83e,!![]);}catch(_0x336351){return BPromise[_0xc9fc('0x26')](_0x336351);}return _0x299798[_0xc9fc('0x27')]();};}function saveUpdates(_0x1a4fb8,_0x4b7bd7){return function(_0x5248b9){if(_0x5248b9){return _0x5248b9[_0xc9fc('0x28')](_0x1a4fb8)[_0xc9fc('0x29')](function(_0x2b3f1f){return _0x2b3f1f;});}return null;};}function removeEntity(_0x4a3f3b,_0x4a0c22){return function(_0x3642d3){if(_0x3642d3){return _0x3642d3['destroy']()[_0xc9fc('0x29')](function(){_0x4a3f3b[_0xc9fc('0x1d')](0xcc)[_0xc9fc('0x1e')]();});}};}function handleEntityNotFound(_0x2971a2,_0x6c522f){return function(_0x47ed1a){if(!_0x47ed1a){_0x2971a2[_0xc9fc('0x1c')](0x194);}return _0x47ed1a;};}function handleError(_0x1d7dda,_0x419c8d){_0x419c8d=_0x419c8d||0x1f4;return function(_0x513126){logger[_0xc9fc('0x2a')](_0x513126[_0xc9fc('0x2b')]);if(_0x513126[_0xc9fc('0x2c')]){delete _0x513126[_0xc9fc('0x2c')];}_0x1d7dda[_0xc9fc('0x1d')](_0x419c8d)[_0xc9fc('0x2d')](_0x513126);};}exports[_0xc9fc('0x2e')]=function(_0x419b19,_0x2b24ed){var _0x4b483e={},_0x55f628={},_0x20c49e={'count':0x0,'rows':[]};var _0x4bd4b7=_[_0xc9fc('0x2f')](db[_0xc9fc('0x30')][_0xc9fc('0x31')],function(_0x7388ec){return{'name':_0x7388ec[_0xc9fc('0x32')],'type':_0x7388ec[_0xc9fc('0x33')][_0xc9fc('0x34')]};});_0x55f628[_0xc9fc('0x35')]=_[_0xc9fc('0x2f')](_0x4bd4b7,_0xc9fc('0x2c'));_0x55f628[_0xc9fc('0x36')]=_['keys'](_0x419b19[_0xc9fc('0x36')]);_0x55f628[_0xc9fc('0x37')]=_[_0xc9fc('0x38')](_0x55f628[_0xc9fc('0x35')],_0x55f628[_0xc9fc('0x36')]);_0x4b483e[_0xc9fc('0x39')]=_[_0xc9fc('0x38')](_0x55f628[_0xc9fc('0x35')],qs[_0xc9fc('0x3a')](_0x419b19[_0xc9fc('0x36')]['fields']));_0x4b483e[_0xc9fc('0x39')]=_0x4b483e[_0xc9fc('0x39')][_0xc9fc('0x3b')]?_0x4b483e[_0xc9fc('0x39')]:_0x55f628['model'];if(!_0x419b19[_0xc9fc('0x36')][_0xc9fc('0x3c')](_0xc9fc('0x3d'))){_0x4b483e[_0xc9fc('0x3e')]=qs[_0xc9fc('0x3e')](_0x419b19[_0xc9fc('0x36')]['limit']);_0x4b483e[_0xc9fc('0x22')]=qs[_0xc9fc('0x22')](_0x419b19[_0xc9fc('0x36')][_0xc9fc('0x22')]);}_0x4b483e[_0xc9fc('0x3f')]=qs['sort'](_0x419b19[_0xc9fc('0x36')]['sort']);_0x4b483e[_0xc9fc('0x40')]=qs[_0xc9fc('0x37')](_[_0xc9fc('0x41')](_0x419b19[_0xc9fc('0x36')],_0x55f628[_0xc9fc('0x37')]),_0x4bd4b7);if(_0x419b19['query'][_0xc9fc('0x42')]){_0x4b483e[_0xc9fc('0x40')]=_[_0xc9fc('0x43')](_0x4b483e[_0xc9fc('0x40')],{'$or':_[_0xc9fc('0x2f')](_0x4bd4b7,function(_0x50a5eb){if(_0x50a5eb['type']!==_0xc9fc('0x44')){var _0x1a7000={};_0x1a7000[_0x50a5eb['name']]={'$like':'%'+_0x419b19[_0xc9fc('0x36')][_0xc9fc('0x42')]+'%'};return _0x1a7000;}})});}_0x4b483e=_[_0xc9fc('0x43')]({},_0x4b483e,_0x419b19[_0xc9fc('0x45')]);var _0x48a659={'where':_0x4b483e[_0xc9fc('0x40')]};return db['OpenchannelApplication'][_0xc9fc('0x21')](_0x48a659)[_0xc9fc('0x29')](function(_0xa0fb4b){_0x20c49e['count']=_0xa0fb4b;if(_0x419b19[_0xc9fc('0x36')][_0xc9fc('0x46')]){_0x4b483e[_0xc9fc('0x47')]=[{'all':!![]}];}return db[_0xc9fc('0x30')]['findAll'](_0x4b483e);})[_0xc9fc('0x29')](function(_0x271e75){_0x20c49e[_0xc9fc('0x48')]=_0x271e75;return _0x20c49e;})[_0xc9fc('0x29')](respondWithFilteredResult(_0x2b24ed,_0x4b483e))[_0xc9fc('0x49')](handleError(_0x2b24ed,null));};exports[_0xc9fc('0x4a')]=function(_0x410ede,_0x17d0f4){var _0x2ec842={'raw':!![],'where':{'id':_0x410ede['params']['id']}},_0x222f42={};_0x222f42[_0xc9fc('0x35')]=_[_0xc9fc('0x4b')](db[_0xc9fc('0x30')][_0xc9fc('0x31')]);_0x222f42[_0xc9fc('0x36')]=_[_0xc9fc('0x4b')](_0x410ede[_0xc9fc('0x36')]);_0x222f42['filters']=_[_0xc9fc('0x38')](_0x222f42['model'],_0x222f42[_0xc9fc('0x36')]);_0x2ec842[_0xc9fc('0x39')]=_['intersection'](_0x222f42['model'],qs[_0xc9fc('0x3a')](_0x410ede['query'][_0xc9fc('0x3a')]));_0x2ec842[_0xc9fc('0x39')]=_0x2ec842[_0xc9fc('0x39')][_0xc9fc('0x3b')]?_0x2ec842[_0xc9fc('0x39')]:_0x222f42[_0xc9fc('0x35')];if(_0x410ede[_0xc9fc('0x36')]['includeAll']){_0x2ec842[_0xc9fc('0x47')]=[{'all':!![]}];}_0x2ec842=_[_0xc9fc('0x43')]({},_0x2ec842,_0x410ede[_0xc9fc('0x45')]);return db['OpenchannelApplication']['find'](_0x2ec842)[_0xc9fc('0x29')](handleEntityNotFound(_0x17d0f4,null))[_0xc9fc('0x29')](respondWithResult(_0x17d0f4,null))[_0xc9fc('0x49')](handleError(_0x17d0f4,null));};exports[_0xc9fc('0x4c')]=function(_0x2a3001,_0x1713a7){return db[_0xc9fc('0x30')][_0xc9fc('0x4c')](_0x2a3001['body'],{})['then'](respondWithResult(_0x1713a7,0xc9))[_0xc9fc('0x49')](handleError(_0x1713a7,null));};exports[_0xc9fc('0x28')]=function(_0x131ee8,_0xb27656){if(_0x131ee8[_0xc9fc('0x4d')]['id']){delete _0x131ee8[_0xc9fc('0x4d')]['id'];}return db['OpenchannelApplication'][_0xc9fc('0x4e')]({'where':{'id':_0x131ee8[_0xc9fc('0x4f')]['id']}})['then'](handleEntityNotFound(_0xb27656,null))[_0xc9fc('0x29')](saveUpdates(_0x131ee8[_0xc9fc('0x4d')],null))['then'](respondWithResult(_0xb27656,null))[_0xc9fc('0x49')](handleError(_0xb27656,null));};exports[_0xc9fc('0x50')]=function(_0x793a35,_0x5263a4){return db[_0xc9fc('0x30')][_0xc9fc('0x4e')]({'where':{'id':_0x793a35['params']['id']}})['then'](handleEntityNotFound(_0x5263a4,null))[_0xc9fc('0x29')](removeEntity(_0x5263a4,null))[_0xc9fc('0x49')](handleError(_0x5263a4,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 108750c..16f4552 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 _0x885b=['../../config/environment','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1c7d3a,_0x526b24){var _0x42a22d=function(_0x137fd4){while(--_0x137fd4){_0x1c7d3a['push'](_0x1c7d3a['shift']());}};_0x42a22d(++_0x526b24);}(_0x885b,0x1f4));var _0xb885=function(_0x4dfcaf,_0x3be22a){_0x4dfcaf=_0x4dfcaf-0x0;var _0x494669=_0x885b[_0x4dfcaf];return _0x494669;};'use strict';var _=require(_0xb885('0x0'));var util=require(_0xb885('0x1'));var logger=require(_0xb885('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb885('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb885('0x4'));var rimraf=require(_0xb885('0x5'));var config=require(_0xb885('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x44e1ca,_0x321a0b){return _0x44e1ca[_0xb885('0x7')]('OpenchannelApplication',attributes,{'tableName':_0xb885('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb885('0x9'),'collate':_0xb885('0xa')});}; \ No newline at end of file +var _0x552b=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2688fa,_0x2ec975){var _0x23c7a7=function(_0x270f8b){while(--_0x270f8b){_0x2688fa['push'](_0x2688fa['shift']());}};_0x23c7a7(++_0x2ec975);}(_0x552b,0x95));var _0xb552=function(_0x42995c,_0x4856c0){_0x42995c=_0x42995c-0x0;var _0x230629=_0x552b[_0x42995c];return _0x230629;};'use strict';var _=require(_0xb552('0x0'));var util=require(_0xb552('0x1'));var logger=require('../../config/logger')(_0xb552('0x2'));var moment=require(_0xb552('0x3'));var BPromise=require(_0xb552('0x4'));var rp=require(_0xb552('0x5'));var fs=require('fs');var path=require(_0xb552('0x6'));var rimraf=require(_0xb552('0x7'));var config=require(_0xb552('0x8'));var attributes=require(_0xb552('0x9'));module['exports']=function(_0xbb80b2,_0x1cd347){return _0xbb80b2[_0xb552('0xa')](_0xb552('0xb'),attributes,{'tableName':_0xb552('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb552('0xd'),'collate':_0xb552('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f844948..78b076d 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 _0x248b=['body','options','raw','where','attributes','UpdateOpenchannelApplication','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelApplication'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x248b,0x92));var _0xb248=function(_0x8cac0c,_0x187d8a){_0x8cac0c=_0x8cac0c-0x0;var _0x39ae4f=_0x248b[_0x8cac0c];return _0x39ae4f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb248('0x0'));var BPromise=require(_0xb248('0x1'));var rs=require(_0xb248('0x2'));var fs=require('fs');var Redis=require(_0xb248('0x3'));var db=require(_0xb248('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb248('0x5'));var config=require(_0xb248('0x6'));var jayson=require(_0xb248('0x7'));var client=jayson[_0xb248('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d84cd,_0x147d74,_0x104dca){return new BPromise(function(_0x1d3de6,_0x31060e){return client[_0xb248('0x9')](_0x1d84cd,_0x104dca)[_0xb248('0xa')](function(_0x36c244){logger['info'](_0xb248('0xb'),_0x147d74,_0xb248('0xc'));logger[_0xb248('0xd')](_0xb248('0xe'),_0x147d74,_0xb248('0xc'),JSON[_0xb248('0xf')](_0x36c244));if(_0x36c244[_0xb248('0x10')]){if(_0x36c244[_0xb248('0x10')][_0xb248('0x11')]===0x1f4){logger[_0xb248('0x10')](_0xb248('0xb'),_0x147d74,_0x36c244[_0xb248('0x10')][_0xb248('0x12')]);return _0x31060e(_0x36c244[_0xb248('0x10')][_0xb248('0x12')]);}logger[_0xb248('0x10')](_0xb248('0xb'),_0x147d74,_0x36c244[_0xb248('0x10')][_0xb248('0x12')]);return _0x1d3de6(_0x36c244['error'][_0xb248('0x12')]);}else{logger[_0xb248('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x147d74,_0xb248('0xc'));_0x1d3de6(_0x36c244['result'][_0xb248('0x12')]);}})[_0xb248('0x14')](function(_0x1c88a8){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x147d74,_0x1c88a8);_0x31060e(_0x1c88a8);});});}exports['UpdateOpenchannelApplication']=function(_0x4dd5e9){var _0xa0f6a1=this;return new Promise(function(_0x1993fe,_0x3f369b){return db[_0xb248('0x15')]['update'](_0x4dd5e9[_0xb248('0x16')],{'raw':_0x4dd5e9['options']?_0x4dd5e9[_0xb248('0x17')][_0xb248('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dd5e9[_0xb248('0x17')]?_0x4dd5e9['options'][_0xb248('0x19')]||null:null,'attributes':_0x4dd5e9[_0xb248('0x17')]?_0x4dd5e9[_0xb248('0x17')][_0xb248('0x1a')]||null:null,'limit':_0x4dd5e9[_0xb248('0x17')]?_0x4dd5e9['options']['limit']||null:null})['then'](function(_0x28d283){logger[_0xb248('0x13')](_0xb248('0x1b'),_0x4dd5e9);logger[_0xb248('0xd')](_0xb248('0x1b'),_0x4dd5e9,JSON[_0xb248('0xf')](_0x28d283));_0x1993fe(_0x28d283);})['catch'](function(_0x2c1f7c){logger['error'](_0xb248('0x1b'),_0x2c1f7c[_0xb248('0x12')],_0x4dd5e9);_0x3f369b(_0xa0f6a1[_0xb248('0x10')](0x1f4,_0x2c1f7c[_0xb248('0x12')]));});});}; \ No newline at end of file +var _0x25cb=['then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','body','options','raw','where','limit'];(function(_0x22ca53,_0x30e1a9){var _0x80aacf=function(_0x55f0b9){while(--_0x55f0b9){_0x22ca53['push'](_0x22ca53['shift']());}};_0x80aacf(++_0x30e1a9);}(_0x25cb,0x10f));var _0xb25c=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0x25cb[_0x631a3c];return _0x2bdfa3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb25c('0x0'));var BPromise=require(_0xb25c('0x1'));var rs=require(_0xb25c('0x2'));var fs=require('fs');var Redis=require(_0xb25c('0x3'));var db=require(_0xb25c('0x4'))['db'];var utils=require(_0xb25c('0x5'));var logger=require(_0xb25c('0x6'))(_0xb25c('0x7'));var config=require(_0xb25c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb25c('0x9')][_0xb25c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fa6ca,_0x31738a,_0x19ab6e){return new BPromise(function(_0xc600e9,_0x42d3ef){return client[_0xb25c('0xb')](_0x4fa6ca,_0x19ab6e)['then'](function(_0x53bb0e){logger[_0xb25c('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x31738a,'request\x20sent');logger[_0xb25c('0xd')](_0xb25c('0xe'),_0x31738a,_0xb25c('0xf'),JSON[_0xb25c('0x10')](_0x53bb0e));if(_0x53bb0e[_0xb25c('0x11')]){if(_0x53bb0e[_0xb25c('0x11')][_0xb25c('0x12')]===0x1f4){logger[_0xb25c('0x11')](_0xb25c('0x13'),_0x31738a,_0x53bb0e[_0xb25c('0x11')]['message']);return _0x42d3ef(_0x53bb0e[_0xb25c('0x11')][_0xb25c('0x14')]);}logger[_0xb25c('0x11')](_0xb25c('0x13'),_0x31738a,_0x53bb0e[_0xb25c('0x11')][_0xb25c('0x14')]);return _0xc600e9(_0x53bb0e['error'][_0xb25c('0x14')]);}else{logger[_0xb25c('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x31738a,_0xb25c('0xf'));_0xc600e9(_0x53bb0e[_0xb25c('0x15')]['message']);}})[_0xb25c('0x16')](function(_0x1b0519){logger[_0xb25c('0x11')](_0xb25c('0x13'),_0x31738a,_0x1b0519);_0x42d3ef(_0x1b0519);});});}exports[_0xb25c('0x17')]=function(_0x2d8890){var _0xc0508f=this;return new Promise(function(_0x7873e1,_0x141bd4){return db['OpenchannelApplication']['update'](_0x2d8890[_0xb25c('0x18')],{'raw':_0x2d8890[_0xb25c('0x19')]?_0x2d8890['options'][_0xb25c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d8890[_0xb25c('0x19')]?_0x2d8890[_0xb25c('0x19')][_0xb25c('0x1b')]||null:null,'attributes':_0x2d8890[_0xb25c('0x19')]?_0x2d8890[_0xb25c('0x19')]['attributes']||null:null,'limit':_0x2d8890[_0xb25c('0x19')]?_0x2d8890[_0xb25c('0x19')][_0xb25c('0x1c')]||null:null})[_0xb25c('0x1d')](function(_0x36e901){logger['info'](_0xb25c('0x17'),_0x2d8890);logger['debug'](_0xb25c('0x17'),_0x2d8890,JSON[_0xb25c('0x10')](_0x36e901));_0x7873e1(_0x36e901);})['catch'](function(_0x25b212){logger[_0xb25c('0x11')](_0xb25c('0x17'),_0x25b212[_0xb25c('0x14')],_0x2d8890);_0x141bd4(_0xc0508f[_0xb25c('0x11')](0x1f4,_0x25b212[_0xb25c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3c703de..b0bace3 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 _0xd5ff=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','post','/:id/tags','tracked','openchannelinteraction:addtags','put','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util'];(function(_0x4944dd,_0x5a8677){var _0x58ebba=function(_0x450258){while(--_0x450258){_0x4944dd['push'](_0x4944dd['shift']());}};_0x58ebba(++_0x5a8677);}(_0xd5ff,0x106));var _0xfd5f=function(_0x5f4bde,_0xa25d11){_0x5f4bde=_0x5f4bde-0x0;var _0x1c12ec=_0xd5ff[_0x5f4bde];return _0x1c12ec;};'use strict';var multer=require(_0xfd5f('0x0'));var util=require(_0xfd5f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd5f('0x2'));var router=express[_0xfd5f('0x3')]();var fs_extra=require(_0xfd5f('0x4'));var auth=require(_0xfd5f('0x5'));var interaction=require(_0xfd5f('0x6'));var config=require(_0xfd5f('0x7'));var controller=require(_0xfd5f('0x8'));router[_0xfd5f('0x9')]('/',auth[_0xfd5f('0xa')](),controller[_0xfd5f('0xb')]);router[_0xfd5f('0x9')](_0xfd5f('0xc'),auth[_0xfd5f('0xa')](),controller[_0xfd5f('0xd')]);router[_0xfd5f('0x9')](_0xfd5f('0xe'),auth[_0xfd5f('0xa')](),controller[_0xfd5f('0xf')]);router[_0xfd5f('0x9')](_0xfd5f('0x10'),auth[_0xfd5f('0xa')](),controller['getMessages']);router[_0xfd5f('0x9')](_0xfd5f('0x11'),auth[_0xfd5f('0xa')](),controller[_0xfd5f('0x12')]);router['post']('/',auth[_0xfd5f('0xa')](),controller[_0xfd5f('0x13')]);router['post']('/:id/messages',auth[_0xfd5f('0xa')](),controller['addMessage']);router[_0xfd5f('0x14')](_0xfd5f('0x15'),auth[_0xfd5f('0xa')](),interaction[_0xfd5f('0x16')]('openchannel',_0xfd5f('0x17')),controller['addTags']);router[_0xfd5f('0x18')](_0xfd5f('0xe'),auth[_0xfd5f('0xa')](),interaction[_0xfd5f('0x16')](_0xfd5f('0x19'),_0xfd5f('0x1a')),controller[_0xfd5f('0x1b')]);router['delete'](_0xfd5f('0xe'),auth[_0xfd5f('0xa')](),interaction['tracked'](_0xfd5f('0x19'),_0xfd5f('0x1c')),controller[_0xfd5f('0x1d')]);router[_0xfd5f('0x1e')](_0xfd5f('0x15'),auth[_0xfd5f('0xa')](),controller[_0xfd5f('0x1f')]);module[_0xfd5f('0x20')]=router; \ No newline at end of file +var _0xe467=['openchannelinteraction:destroy','destroy','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update','update','/:id'];(function(_0x29cd14,_0x245c40){var _0x4229d1=function(_0x1ef992){while(--_0x1ef992){_0x29cd14['push'](_0x29cd14['shift']());}};_0x4229d1(++_0x245c40);}(_0xe467,0x8c));var _0x7e46=function(_0x596053,_0x1a9efd){_0x596053=_0x596053-0x0;var _0x1fb180=_0xe467[_0x596053];return _0x1fb180;};'use strict';var multer=require(_0x7e46('0x0'));var util=require(_0x7e46('0x1'));var path=require(_0x7e46('0x2'));var timeout=require(_0x7e46('0x3'));var express=require(_0x7e46('0x4'));var router=express['Router']();var fs_extra=require(_0x7e46('0x5'));var auth=require(_0x7e46('0x6'));var interaction=require(_0x7e46('0x7'));var config=require(_0x7e46('0x8'));var controller=require(_0x7e46('0x9'));router[_0x7e46('0xa')]('/',auth['isAuthenticated'](),controller[_0x7e46('0xb')]);router[_0x7e46('0xa')]('/describe',auth[_0x7e46('0xc')](),controller[_0x7e46('0xd')]);router[_0x7e46('0xa')]('/:id',auth[_0x7e46('0xc')](),controller[_0x7e46('0xe')]);router['get'](_0x7e46('0xf'),auth['isAuthenticated'](),controller[_0x7e46('0x10')]);router[_0x7e46('0xa')](_0x7e46('0x11'),auth[_0x7e46('0xc')](),controller[_0x7e46('0x12')]);router[_0x7e46('0x13')]('/',auth['isAuthenticated'](),controller[_0x7e46('0x14')]);router[_0x7e46('0x13')](_0x7e46('0xf'),auth['isAuthenticated'](),controller[_0x7e46('0x15')]);router[_0x7e46('0x13')](_0x7e46('0x16'),auth[_0x7e46('0xc')](),interaction['tracked'](_0x7e46('0x17'),_0x7e46('0x18')),controller['addTags']);router[_0x7e46('0x19')]('/:id',auth[_0x7e46('0xc')](),interaction[_0x7e46('0x1a')](_0x7e46('0x17'),_0x7e46('0x1b')),controller[_0x7e46('0x1c')]);router['delete'](_0x7e46('0x1d'),auth['isAuthenticated'](),interaction[_0x7e46('0x1a')]('openchannel',_0x7e46('0x1e')),controller[_0x7e46('0x1f')]);router[_0x7e46('0x20')](_0x7e46('0x16'),auth[_0x7e46('0xc')](),controller['removeTags']);module[_0x7e46('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ad1769e..0df3e2c 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 _0x5cbc=['BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize'];(function(_0x6c9dea,_0xcf03e5){var _0x448ab9=function(_0x75c520){while(--_0x75c520){_0x6c9dea['push'](_0x6c9dea['shift']());}};_0x448ab9(++_0xcf03e5);}(_0x5cbc,0xfb));var _0xc5cb=function(_0x3c5924,_0x4d295f){_0x3c5924=_0x3c5924-0x0;var _0x576958=_0x5cbc[_0x3c5924];return _0x576958;};'use strict';var Sequelize=require(_0xc5cb('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc5cb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc5cb('0x2')]},'disposition':{'type':Sequelize[_0xc5cb('0x3')]},'secondDisposition':{'type':Sequelize[_0xc5cb('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc5cb('0x3')]},'read1stAt':{'type':Sequelize[_0xc5cb('0x2')]},'threadId':{'type':Sequelize[_0xc5cb('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xc5cb('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc5cb('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xc5cb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc5cb('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc5cb('0x6')]}}; \ No newline at end of file +var _0x5106=['ENUM','out','sequelize','BOOLEAN','STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5106,0x116));var _0x6510=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5106[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x6510('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6510('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6510('0x2')]},'secondDisposition':{'type':Sequelize[_0x6510('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6510('0x3')]},'threadId':{'type':Sequelize[_0x6510('0x2')]},'externalUrl':{'type':Sequelize[_0x6510('0x2')]},'lastMsgAt':{'type':Sequelize[_0x6510('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6510('0x4')]('in',_0x6510('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x6510('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 42986e7..b699d0b 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 _0xd6e6=['json','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','type','key','findAll','openchannel','query','catch','show','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','includeAll','merge','options','create','update','body','find','describe','addMessage','ids','getMessages','OpenchannelMessage','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','User','fullname','push','CmContact','firstName','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closed','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','lastName','renderFile','views','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','limit','undefined','count','offset','set','Content-Range'];(function(_0x1a1b1e,_0x48de13){var _0x567349=function(_0x11eb31){while(--_0x11eb31){_0x1a1b1e['push'](_0x1a1b1e['shift']());}};_0x567349(++_0x48de13);}(_0xd6e6,0x155));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var rimraf=require(_0x6d6e('0x0'));var zipdir=require('zip-dir');var moment=require(_0x6d6e('0x1'));var util=require(_0x6d6e('0x2'));var path=require(_0x6d6e('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x6d6e('0x4'));var interaction=require(_0x6d6e('0x5'));var qs=require(_0x6d6e('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x6d6e('0x7'))(_0x6d6e('0x8'));var config=require('../../config/environment');var db=require(_0x6d6e('0x9'))['db'];config[_0x6d6e('0xa')]=_[_0x6d6e('0xb')](config[_0x6d6e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d6e('0xc'))(new Redis(config[_0x6d6e('0xa')]));require('./openchannelInteraction.socket')[_0x6d6e('0xd')](socket);function respondWithStatusCode(_0x4f9def,_0x5b90b7){_0x5b90b7=_0x5b90b7||0xcc;return function(_0xfdf566){if(_0xfdf566){return _0x4f9def['sendStatus'](_0x5b90b7);}return _0x4f9def[_0x6d6e('0xe')](_0x5b90b7)[_0x6d6e('0xf')]();};}function respondWithResult(_0x8b1446,_0x4cf8ee){_0x4cf8ee=_0x4cf8ee||0xc8;return function(_0x116c33){if(_0x116c33){return _0x8b1446[_0x6d6e('0xe')](_0x4cf8ee)['json'](_0x116c33);}};}function respondWithFilteredResult(_0x5587a6,_0x256b7c){return function(_0x3c4b75){if(_0x3c4b75){var _0x24a445=typeof _0x256b7c['offset']==='undefined'&&typeof _0x256b7c[_0x6d6e('0x10')]===_0x6d6e('0x11');var _0x1bfaa6=_0x3c4b75[_0x6d6e('0x12')];var _0x19d75a=_0x24a445?0x0:_0x256b7c[_0x6d6e('0x13')];var _0x2961aa=_0x24a445?_0x3c4b75['count']:_0x256b7c[_0x6d6e('0x13')]+_0x256b7c[_0x6d6e('0x10')];var _0x58abc8;if(_0x2961aa>=_0x1bfaa6){_0x2961aa=_0x1bfaa6;_0x58abc8=0xc8;}else{_0x58abc8=0xce;}_0x5587a6[_0x6d6e('0xe')](_0x58abc8);return _0x5587a6[_0x6d6e('0x14')](_0x6d6e('0x15'),_0x19d75a+'-'+_0x2961aa+'/'+_0x1bfaa6)[_0x6d6e('0x16')](_0x3c4b75);}return null;};}function saveUpdates(_0x293f5e){return function(_0x27b273){if(_0x27b273){return _0x27b273['update'](_0x293f5e)[_0x6d6e('0x17')](function(_0x3eaa35){return _0x3eaa35;});}return null;};}function removeEntity(_0x5640be){return function(_0x1fee1d){if(_0x1fee1d){return _0x1fee1d[_0x6d6e('0x18')]()['then'](function(){_0x5640be[_0x6d6e('0xe')](0xcc)[_0x6d6e('0xf')]();});}};}function handleEntityNotFound(_0x3051b1){return function(_0x18d70d){if(!_0x18d70d){_0x3051b1[_0x6d6e('0x19')](0x194);}return _0x18d70d;};}function handleError(_0x689297,_0x312710){_0x312710=_0x312710||0x1f4;return function(_0xaf09a6){logger[_0x6d6e('0x1a')](_0xaf09a6[_0x6d6e('0x1b')]);if(_0xaf09a6[_0x6d6e('0x1c')]){delete _0xaf09a6[_0x6d6e('0x1c')];}_0x689297[_0x6d6e('0xe')](_0x312710)['send'](_0xaf09a6);};}exports[_0x6d6e('0x1d')]=function(_0x4692fb,_0x477afb){var _0x20c5f0={};var _0x558956=_[_0x6d6e('0x1e')](db['OpenchannelInteraction'][_0x6d6e('0x1f')],function(_0x3cc64a){return{'name':_0x3cc64a['fieldName'],'type':_0x3cc64a[_0x6d6e('0x20')][_0x6d6e('0x21')]};});_0x20c5f0=qs['getOptions'](_0x558956,_0x4692fb);return interaction[_0x6d6e('0x22')](_0x6d6e('0x23'),_0x4692fb[_0x6d6e('0x24')],_0x4692fb['user'],_0x20c5f0,_0x558956)[_0x6d6e('0x17')](respondWithFilteredResult(_0x477afb,_0x20c5f0))[_0x6d6e('0x25')](handleError(_0x477afb,null));};exports[_0x6d6e('0x26')]=function(_0x44311e,_0x58eece){var _0x437a04={};if(_0x44311e[_0x6d6e('0x24')][_0x6d6e('0x20')]&&_0x44311e[_0x6d6e('0x24')][_0x6d6e('0x20')]==='from'){_0x437a04['from']=_0x44311e[_0x6d6e('0x27')]['id'];}else{_0x437a04['id']=_0x44311e[_0x6d6e('0x27')]['id'];}var _0x12d630={'raw':![],'where':_0x437a04},_0x2ac20c={};_0x2ac20c[_0x6d6e('0x28')]=_[_0x6d6e('0x29')](db[_0x6d6e('0x2a')][_0x6d6e('0x1f')]);_0x2ac20c[_0x6d6e('0x24')]=_['keys'](_0x44311e['query']);_0x2ac20c[_0x6d6e('0x2b')]=_[_0x6d6e('0x2c')](_0x2ac20c[_0x6d6e('0x28')],_0x2ac20c[_0x6d6e('0x24')]);_0x12d630[_0x6d6e('0x2d')]=_[_0x6d6e('0x2c')](_0x2ac20c[_0x6d6e('0x28')],qs[_0x6d6e('0x2e')](_0x44311e[_0x6d6e('0x24')][_0x6d6e('0x2e')]));_0x12d630[_0x6d6e('0x2d')]=_0x12d630['attributes']['length']?_0x12d630[_0x6d6e('0x2d')]:_0x2ac20c['model'];if(_0x44311e[_0x6d6e('0x24')][_0x6d6e('0x2f')]){_0x12d630['include']=[{'all':!![]}];}_0x12d630=_[_0x6d6e('0x30')]({},_0x12d630,_0x44311e[_0x6d6e('0x31')]);return db['OpenchannelInteraction']['find'](_0x12d630)['then'](handleEntityNotFound(_0x58eece,null))[_0x6d6e('0x17')](respondWithResult(_0x58eece,null))[_0x6d6e('0x25')](handleError(_0x58eece,null));};exports['create']=function(_0x4c4054,_0x4b292a){return db['OpenchannelInteraction'][_0x6d6e('0x32')](_0x4c4054['body'],{})['then'](respondWithResult(_0x4b292a,0xc9))['catch'](handleError(_0x4b292a,null));};exports[_0x6d6e('0x33')]=function(_0x1b8ac5,_0x2283f2){if(_0x1b8ac5[_0x6d6e('0x34')]['id']){delete _0x1b8ac5[_0x6d6e('0x34')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x1b8ac5[_0x6d6e('0x27')]['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x2283f2,null))[_0x6d6e('0x17')](saveUpdates(_0x1b8ac5[_0x6d6e('0x34')],null))[_0x6d6e('0x17')](respondWithResult(_0x2283f2,null))[_0x6d6e('0x25')](handleError(_0x2283f2,null));};exports[_0x6d6e('0x18')]=function(_0x79ac5d,_0x2dd289){return db[_0x6d6e('0x2a')][_0x6d6e('0x35')]({'where':{'id':_0x79ac5d[_0x6d6e('0x27')]['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x2dd289,null))[_0x6d6e('0x17')](removeEntity(_0x2dd289,null))[_0x6d6e('0x25')](handleError(_0x2dd289,null));};exports[_0x6d6e('0x36')]=function(_0x434776,_0x8863e3){return db[_0x6d6e('0x2a')][_0x6d6e('0x36')]()[_0x6d6e('0x17')](respondWithResult(_0x8863e3,null))[_0x6d6e('0x25')](handleError(_0x8863e3,null));};exports[_0x6d6e('0x37')]=function(_0x361d02,_0x8716e8){return db['OpenchannelMessage'][_0x6d6e('0x35')]({'where':{'id':_0x361d02['params']['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x8716e8,null))[_0x6d6e('0x17')](function(_0xa1f615){if(_0xa1f615){return _0xa1f615[_0x6d6e('0x37')](_0x361d02[_0x6d6e('0x34')][_0x6d6e('0x38')],_['omit'](_0x361d02[_0x6d6e('0x34')],[_0x6d6e('0x38'),'id'])||{});}})[_0x6d6e('0x17')](respondWithResult(_0x8716e8,null))['catch'](handleError(_0x8716e8,null));};exports[_0x6d6e('0x39')]=function(_0x20429b,_0x5e0667){var _0x21baf1={'raw':![],'where':{}};var _0x432054={};var _0x5c2e22={'count':0x0,'rows':[]};return db[_0x6d6e('0x2a')]['findOne']({'where':{'id':_0x20429b[_0x6d6e('0x27')]['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x5e0667,null))[_0x6d6e('0x17')](function(_0x646643){if(_0x646643){_0x432054[_0x6d6e('0x28')]=_['keys'](db[_0x6d6e('0x3a')]['rawAttributes']);_0x432054['query']=_[_0x6d6e('0x29')](_0x20429b[_0x6d6e('0x24')]);_0x432054[_0x6d6e('0x2b')]=_[_0x6d6e('0x2c')](_0x432054[_0x6d6e('0x28')],_0x432054[_0x6d6e('0x24')]);_0x21baf1[_0x6d6e('0x2d')]=_[_0x6d6e('0x2c')](_0x432054[_0x6d6e('0x28')],qs[_0x6d6e('0x2e')](_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x2e')]));_0x21baf1[_0x6d6e('0x2d')]=_0x21baf1[_0x6d6e('0x2d')][_0x6d6e('0x3b')]?_0x21baf1[_0x6d6e('0x2d')]:_0x432054[_0x6d6e('0x28')];if(!_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x3c')](_0x6d6e('0x3d'))){_0x21baf1[_0x6d6e('0x10')]=qs[_0x6d6e('0x10')](_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x10')]);_0x21baf1[_0x6d6e('0x13')]=qs[_0x6d6e('0x13')](_0x20429b['query'][_0x6d6e('0x13')]);}_0x21baf1[_0x6d6e('0x3e')]=qs[_0x6d6e('0x3f')](_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x3f')]);_0x21baf1[_0x6d6e('0x40')]=qs[_0x6d6e('0x2b')](_[_0x6d6e('0x41')](_0x20429b['query'],_0x432054[_0x6d6e('0x2b')]));_0x21baf1[_0x6d6e('0x40')][_0x6d6e('0x42')]=_0x646643['id'];if(_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x43')]){_0x21baf1[_0x6d6e('0x40')]=_[_0x6d6e('0x30')](_0x21baf1['where'],{'$or':_[_0x6d6e('0x1e')](_0x21baf1[_0x6d6e('0x2d')],function(_0x25beba){var _0x294c6c={};_0x294c6c[_0x25beba]={'$like':'%'+_0x20429b[_0x6d6e('0x24')]['filter']+'%'};return _0x294c6c;})});}if(_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x44')]){var _0x546884=_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x44')]['split'](',');var _0x80886d={};_0x80886d[_0x546884[0x0]]={'$gte':moment(_0x546884[0x1])[_0x6d6e('0x45')](_0x6d6e('0x46'))};_0x21baf1[_0x6d6e('0x40')]=_[_0x6d6e('0x30')](_0x21baf1[_0x6d6e('0x40')],_0x80886d);}_0x21baf1=_['merge']({},_0x21baf1,_0x20429b['options']);return db[_0x6d6e('0x3a')]['count']({'where':_0x21baf1[_0x6d6e('0x40')]})[_0x6d6e('0x17')](function(_0x24ff74){_0x5c2e22[_0x6d6e('0x12')]=_0x24ff74;if(_0x20429b[_0x6d6e('0x24')][_0x6d6e('0x2f')]){_0x21baf1['include']=[{'all':!![]}];}return db[_0x6d6e('0x3a')]['findAll'](_0x21baf1);})[_0x6d6e('0x17')](function(_0x4ba33d){_0x5c2e22[_0x6d6e('0x47')]=_0x4ba33d;return _0x5c2e22;});}})[_0x6d6e('0x17')](respondWithFilteredResult(_0x5e0667,_0x21baf1))[_0x6d6e('0x25')](handleError(_0x5e0667,null));};exports['addTags']=function(_0x382187,_0x4c9080){return db[_0x6d6e('0x2a')]['find']({'where':{'id':_0x382187['params']['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x4c9080,null))['then'](function(_0x555580){if(_0x555580){return _0x555580[_0x6d6e('0x48')](_0x382187[_0x6d6e('0x34')][_0x6d6e('0x38')],_['omit'](_0x382187[_0x6d6e('0x34')],[_0x6d6e('0x38'),'id'])||{})[_0x6d6e('0x49')](function(){return db[_0x6d6e('0x4a')][_0x6d6e('0x22')]({'attributes':['id',_0x6d6e('0x1c'),'color'],'where':{'id':_0x382187[_0x6d6e('0x34')][_0x6d6e('0x38')]}});})['then'](function(_0x5e2137){socket[_0x6d6e('0x4b')](_0x6d6e('0x4c'),{'id':Number(_0x382187['params']['id']),'tags':_0x5e2137||[]});return{'id':Number(_0x382187[_0x6d6e('0x27')]['id']),'tags':_0x5e2137||[]};});}})['then'](respondWithResult(_0x4c9080,null))['catch'](handleError(_0x4c9080,null));};exports[_0x6d6e('0x4d')]=function(_0x571406,_0x23afc7){return db[_0x6d6e('0x2a')]['find']({'where':{'id':_0x571406['params']['id']}})[_0x6d6e('0x17')](handleEntityNotFound(_0x23afc7,null))[_0x6d6e('0x17')](function(_0xc52fed){if(_0xc52fed){return _0xc52fed[_0x6d6e('0x4d')](_0x571406['query']['ids']);}})[_0x6d6e('0x17')](respondWithStatusCode(_0x23afc7,null))[_0x6d6e('0x25')](handleError(_0x23afc7,null));};exports[_0x6d6e('0x4e')]=function(_0x5d6899,_0x3b2ac0){var _0x3086cf=moment()[_0x6d6e('0x4f')]()[_0x6d6e('0x50')]();var _0x264059=path[_0x6d6e('0x51')](config[_0x6d6e('0x52')],_0x6d6e('0x53'),_0x6d6e('0x54'),_0x6d6e('0x55'));var _0x1f4a26=path['join'](config[_0x6d6e('0x52')],_0x6d6e('0x53'),'files',_0x6d6e('0x56'));var _0x4371cb=path[_0x6d6e('0x51')](_0x264059,_0x3086cf);var _0x512cee=util[_0x6d6e('0x45')]('transcript-%d-%s.zip',_0x5d6899[_0x6d6e('0x27')]['id'],_0x3086cf);var _0x423583=path[_0x6d6e('0x51')](_0x264059,_0x512cee);var _0x3fb3a6=[];_0x3fb3a6['push']({'model':db[_0x6d6e('0x57')],'as':_0x6d6e('0x57'),'attributes':['id',_0x6d6e('0x58')],'raw':!![]});_0x3fb3a6[_0x6d6e('0x59')]({'model':db[_0x6d6e('0x5a')],'as':'Contact','attributes':['id',_0x6d6e('0x5b'),'lastName'],'raw':!![]});if(_0x5d6899[_0x6d6e('0x24')]['attachments']){_0x3fb3a6[_0x6d6e('0x59')]({'model':db[_0x6d6e('0x5c')],'as':_0x6d6e('0x5c'),'raw':!![]});}var _0x463172=[{'model':db[_0x6d6e('0x3a')],'as':'Messages','attributes':['id',_0x6d6e('0x34'),_0x6d6e('0x5d'),_0x6d6e('0x5e'),_0x6d6e('0x5f'),'read'],'include':_0x3fb3a6}];_0x463172['push']({'model':db[_0x6d6e('0x60')],'as':_0x6d6e('0x61'),'attributes':['id',_0x6d6e('0x1c')]});_0x463172[_0x6d6e('0x59')]({'model':db['User'],'as':_0x6d6e('0x62'),'attributes':['id','fullname']});return db[_0x6d6e('0x2a')][_0x6d6e('0x35')]({'where':{'id':_0x5d6899['params']['id']},'include':_0x463172})[_0x6d6e('0x17')](handleEntityNotFound(_0x3b2ac0,null))['then'](function(_0x310bdd){if(_0x310bdd){var _0x223e9f=_0x310bdd['get']({'plain':!![]});fs[_0x6d6e('0x63')](_0x4371cb);var _0x450a97={'channel':_0x6d6e('0x64'),'account':_0x223e9f[_0x6d6e('0x61')][_0x6d6e('0x1c')],'agent':_0x223e9f['Owner']?_0x223e9f[_0x6d6e('0x62')]['fullname']:_0x6d6e('0x65'),'createdAt':moment(_0x223e9f[_0x6d6e('0x5d')])[_0x6d6e('0x45')](_0x6d6e('0x46'))['toString'](),'closedAt':_0x223e9f[_0x6d6e('0x66')]?moment(_0x223e9f['closedAt'])['format'](_0x6d6e('0x46'))['toString']():'','disposition':_0x223e9f['disposition'],'visibility':_0x223e9f[_0x6d6e('0x67')]?_0x6d6e('0x68'):_0x6d6e('0x69'),'messages':_(_0x223e9f['Messages'])[_0x6d6e('0x43')]({'secret':![]})[_0x6d6e('0x1e')](function(_0x130904){if(_0x130904[_0x6d6e('0x5c')]){var _0x171b59=path['join'](_0x1f4a26,_0x130904['Attachment'][_0x6d6e('0x6a')]);if(fs[_0x6d6e('0x6b')](_0x171b59)){fs[_0x6d6e('0x6c')](_0x171b59)[_0x6d6e('0x6d')](fs[_0x6d6e('0x6e')](path[_0x6d6e('0x51')](_0x4371cb,_0x130904['Attachment'][_0x6d6e('0x6a')])));}}return{'date':moment(_0x130904[_0x6d6e('0x5d')])[_0x6d6e('0x45')](_0x6d6e('0x46'))[_0x6d6e('0x50')](),'sender':_0x130904[_0x6d6e('0x5e')]===_0x6d6e('0x6f')?_0x130904[_0x6d6e('0x57')]?_0x130904['User'][_0x6d6e('0x58')]:_0x6d6e('0x70'):_0x130904[_0x6d6e('0x71')][_0x6d6e('0x5b')]+(_0x130904[_0x6d6e('0x71')][_0x6d6e('0x72')]?'\x20'+_0x130904[_0x6d6e('0x71')]['lastName']:''),'body':_0x130904[_0x6d6e('0x5c')]?_0x130904[_0x6d6e('0x5c')]['basename']:_0x130904['body'],'direction':_0x130904[_0x6d6e('0x5e')]===_0x6d6e('0x6f')?'A':'C','secret':_0x130904['secret'],'read':_0x130904['read'],'attachment':_0x130904[_0x6d6e('0x5c')]};})['value']()};return ejs[_0x6d6e('0x73')](path[_0x6d6e('0x51')](config['root'],_0x6d6e('0x53'),_0x6d6e('0x74'),'downloadInteraction.ejs'),{'interaction':_0x450a97})['then'](function(_0x253014){var _0x4270b3=path[_0x6d6e('0x51')](_0x4371cb,'transcript-'+_0x223e9f['id']+'-'+_0x3086cf+_0x6d6e('0x75'));var _0x2c9dd8={'path':_0x4270b3,'channel':_0x6d6e('0x64'),'interactionId':_0x223e9f['id']};return pdf[_0x6d6e('0x76')](_0x253014,_0x2c9dd8);})[_0x6d6e('0x17')](function(){return new Promise(function(_0x3980b0,_0x37742c){zipdir(_0x4371cb,{'saveTo':_0x423583},function(_0x19a89e,_0x50109b){if(_0x19a89e)return _0x37742c(_0x19a89e);return _0x3980b0(_0x50109b);});})[_0x6d6e('0x17')](function(){return new Promise(function(_0x4ca912,_0xb316b8){rimraf(_0x4371cb,function(_0x55c0ef){if(_0x55c0ef)_0xb316b8(_0x55c0ef);return _0x4ca912();});});})[_0x6d6e('0x17')](function(){return _0x3b2ac0[_0x6d6e('0x4e')](_0x423583,_0x512cee,function(_0x2cf8e0){if(_0x2cf8e0){logger[_0x6d6e('0x1a')](_0x6d6e('0x77'),_0x2cf8e0);}else{fs[_0x6d6e('0x78')](_0x423583);}});});});}else{return _0x3b2ac0[_0x6d6e('0x19')](0xc8);}})[_0x6d6e('0x25')](handleError(_0x3b2ac0,null));}; \ No newline at end of file +var _0x77b4=['download','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','User','Openchannel','Owner','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','threadId','Public','Private','filter','existsSync','createReadStream','pipe','createWriteStream','basename','System','out','value','renderFile','views','downloadInteraction.ejs','.pdf','unlinkSync','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','getOptions','openchannel','query','user','catch','show','type','from','params','model','OpenchannelInteraction','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','keys','nolimit','order','sort','where','pick','OpenchannelInteractionId','map','$gte','split','format','includeAll','findAll','rows','addTags','spread','Tag','color','openchannelInteractionTags:save','removeTags'];(function(_0x373131,_0x1882ab){var _0x5ef716=function(_0x16f9f0){while(--_0x16f9f0){_0x373131['push'](_0x373131['shift']());}};_0x5ef716(++_0x1882ab);}(_0x77b4,0xb7));var _0x477b=function(_0x2a863f,_0x3e7a74){_0x2a863f=_0x2a863f-0x0;var _0x525dac=_0x77b4[_0x2a863f];return _0x525dac;};'use strict';var rimraf=require(_0x477b('0x0'));var zipdir=require(_0x477b('0x1'));var moment=require(_0x477b('0x2'));var util=require(_0x477b('0x3'));var path=require('path');var ejs=require(_0x477b('0x4'));var fs=require('fs');var _=require(_0x477b('0x5'));var Redis=require(_0x477b('0x6'));var interaction=require(_0x477b('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x477b('0x8'));var logger=require(_0x477b('0x9'))(_0x477b('0xa'));var config=require(_0x477b('0xb'));var db=require(_0x477b('0xc'))['db'];config[_0x477b('0xd')]=_['defaults'](config[_0x477b('0xd')],{'host':_0x477b('0xe'),'port':0x18eb});var socket=require(_0x477b('0xf'))(new Redis(config[_0x477b('0xd')]));require(_0x477b('0x10'))[_0x477b('0x11')](socket);function respondWithStatusCode(_0x496f62,_0x2466b8){_0x2466b8=_0x2466b8||0xcc;return function(_0x46def0){if(_0x46def0){return _0x496f62[_0x477b('0x12')](_0x2466b8);}return _0x496f62[_0x477b('0x13')](_0x2466b8)[_0x477b('0x14')]();};}function respondWithResult(_0x47f87a,_0x254455){_0x254455=_0x254455||0xc8;return function(_0x43c9d3){if(_0x43c9d3){return _0x47f87a['status'](_0x254455)[_0x477b('0x15')](_0x43c9d3);}};}function respondWithFilteredResult(_0xcd5c52,_0x7f8f4d){return function(_0x410e66){if(_0x410e66){var _0x6904fe=typeof _0x7f8f4d[_0x477b('0x16')]===_0x477b('0x17')&&typeof _0x7f8f4d[_0x477b('0x18')]==='undefined';var _0x589c79=_0x410e66[_0x477b('0x19')];var _0x34c7b5=_0x6904fe?0x0:_0x7f8f4d[_0x477b('0x16')];var _0x475289=_0x6904fe?_0x410e66[_0x477b('0x19')]:_0x7f8f4d[_0x477b('0x16')]+_0x7f8f4d[_0x477b('0x18')];var _0x4f80a8;if(_0x475289>=_0x589c79){_0x475289=_0x589c79;_0x4f80a8=0xc8;}else{_0x4f80a8=0xce;}_0xcd5c52[_0x477b('0x13')](_0x4f80a8);return _0xcd5c52[_0x477b('0x1a')](_0x477b('0x1b'),_0x34c7b5+'-'+_0x475289+'/'+_0x589c79)[_0x477b('0x15')](_0x410e66);}return null;};}function saveUpdates(_0x579066){return function(_0x25ae29){if(_0x25ae29){return _0x25ae29[_0x477b('0x1c')](_0x579066)[_0x477b('0x1d')](function(_0x42a857){return _0x42a857;});}return null;};}function removeEntity(_0x2e682e){return function(_0x4bd5dc){if(_0x4bd5dc){return _0x4bd5dc[_0x477b('0x1e')]()[_0x477b('0x1d')](function(){_0x2e682e[_0x477b('0x13')](0xcc)[_0x477b('0x14')]();});}};}function handleEntityNotFound(_0x3937c0){return function(_0x5f52ff){if(!_0x5f52ff){_0x3937c0[_0x477b('0x12')](0x194);}return _0x5f52ff;};}function handleError(_0x5861a2,_0xe2ebd9){_0xe2ebd9=_0xe2ebd9||0x1f4;return function(_0x2ac2ae){logger[_0x477b('0x1f')](_0x2ac2ae[_0x477b('0x20')]);if(_0x2ac2ae['name']){delete _0x2ac2ae[_0x477b('0x21')];}_0x5861a2['status'](_0xe2ebd9)['send'](_0x2ac2ae);};}exports[_0x477b('0x22')]=function(_0x25e638,_0x2f5e33){var _0x4a411c={};var _0x14aa40=_['map'](db['OpenchannelInteraction'][_0x477b('0x23')],function(_0xecfd79){return{'name':_0xecfd79[_0x477b('0x24')],'type':_0xecfd79['type'][_0x477b('0x25')]};});_0x4a411c=qs[_0x477b('0x26')](_0x14aa40,_0x25e638);return interaction['findAll'](_0x477b('0x27'),_0x25e638[_0x477b('0x28')],_0x25e638[_0x477b('0x29')],_0x4a411c,_0x14aa40)[_0x477b('0x1d')](respondWithFilteredResult(_0x2f5e33,_0x4a411c))[_0x477b('0x2a')](handleError(_0x2f5e33,null));};exports[_0x477b('0x2b')]=function(_0x39dd26,_0x3b9f73){var _0x548174={};if(_0x39dd26[_0x477b('0x28')]['type']&&_0x39dd26[_0x477b('0x28')][_0x477b('0x2c')]===_0x477b('0x2d')){_0x548174[_0x477b('0x2d')]=_0x39dd26[_0x477b('0x2e')]['id'];}else{_0x548174['id']=_0x39dd26[_0x477b('0x2e')]['id'];}var _0x4a05b2={'raw':![],'where':_0x548174},_0x122a5b={};_0x122a5b[_0x477b('0x2f')]=_['keys'](db[_0x477b('0x30')][_0x477b('0x23')]);_0x122a5b[_0x477b('0x28')]=_['keys'](_0x39dd26[_0x477b('0x28')]);_0x122a5b[_0x477b('0x31')]=_[_0x477b('0x32')](_0x122a5b[_0x477b('0x2f')],_0x122a5b[_0x477b('0x28')]);_0x4a05b2[_0x477b('0x33')]=_[_0x477b('0x32')](_0x122a5b[_0x477b('0x2f')],qs[_0x477b('0x34')](_0x39dd26[_0x477b('0x28')][_0x477b('0x34')]));_0x4a05b2[_0x477b('0x33')]=_0x4a05b2['attributes'][_0x477b('0x35')]?_0x4a05b2[_0x477b('0x33')]:_0x122a5b['model'];if(_0x39dd26[_0x477b('0x28')]['includeAll']){_0x4a05b2[_0x477b('0x36')]=[{'all':!![]}];}_0x4a05b2=_[_0x477b('0x37')]({},_0x4a05b2,_0x39dd26[_0x477b('0x38')]);return db[_0x477b('0x30')][_0x477b('0x39')](_0x4a05b2)[_0x477b('0x1d')](handleEntityNotFound(_0x3b9f73,null))[_0x477b('0x1d')](respondWithResult(_0x3b9f73,null))[_0x477b('0x2a')](handleError(_0x3b9f73,null));};exports['create']=function(_0x433e3e,_0x1b82d0){return db[_0x477b('0x30')][_0x477b('0x3a')](_0x433e3e[_0x477b('0x3b')],{})[_0x477b('0x1d')](respondWithResult(_0x1b82d0,0xc9))['catch'](handleError(_0x1b82d0,null));};exports[_0x477b('0x1c')]=function(_0x385678,_0x4ef19a){if(_0x385678['body']['id']){delete _0x385678['body']['id'];}return db[_0x477b('0x30')]['find']({'where':{'id':_0x385678['params']['id']}})[_0x477b('0x1d')](handleEntityNotFound(_0x4ef19a,null))[_0x477b('0x1d')](saveUpdates(_0x385678[_0x477b('0x3b')],null))[_0x477b('0x1d')](respondWithResult(_0x4ef19a,null))[_0x477b('0x2a')](handleError(_0x4ef19a,null));};exports[_0x477b('0x1e')]=function(_0x4829c7,_0x564760){return db[_0x477b('0x30')][_0x477b('0x39')]({'where':{'id':_0x4829c7[_0x477b('0x2e')]['id']}})[_0x477b('0x1d')](handleEntityNotFound(_0x564760,null))[_0x477b('0x1d')](removeEntity(_0x564760,null))[_0x477b('0x2a')](handleError(_0x564760,null));};exports[_0x477b('0x3c')]=function(_0x471671,_0x234f87){return db[_0x477b('0x30')][_0x477b('0x3c')]()['then'](respondWithResult(_0x234f87,null))[_0x477b('0x2a')](handleError(_0x234f87,null));};exports[_0x477b('0x3d')]=function(_0xe0e208,_0x429e02){return db[_0x477b('0x3e')]['find']({'where':{'id':_0xe0e208['params']['id']}})['then'](handleEntityNotFound(_0x429e02,null))['then'](function(_0x2ecf3f){if(_0x2ecf3f){return _0x2ecf3f['addMessage'](_0xe0e208[_0x477b('0x3b')]['ids'],_[_0x477b('0x3f')](_0xe0e208[_0x477b('0x3b')],[_0x477b('0x40'),'id'])||{});}})[_0x477b('0x1d')](respondWithResult(_0x429e02,null))['catch'](handleError(_0x429e02,null));};exports[_0x477b('0x41')]=function(_0x354a55,_0x304da1){var _0x1d9f55={'raw':![],'where':{}};var _0x5a4749={};var _0x1f5a0a={'count':0x0,'rows':[]};return db[_0x477b('0x30')][_0x477b('0x42')]({'where':{'id':_0x354a55[_0x477b('0x2e')]['id']}})[_0x477b('0x1d')](handleEntityNotFound(_0x304da1,null))['then'](function(_0x17bb91){if(_0x17bb91){_0x5a4749[_0x477b('0x2f')]=_['keys'](db[_0x477b('0x3e')][_0x477b('0x23')]);_0x5a4749['query']=_[_0x477b('0x43')](_0x354a55[_0x477b('0x28')]);_0x5a4749[_0x477b('0x31')]=_[_0x477b('0x32')](_0x5a4749[_0x477b('0x2f')],_0x5a4749['query']);_0x1d9f55[_0x477b('0x33')]=_['intersection'](_0x5a4749[_0x477b('0x2f')],qs[_0x477b('0x34')](_0x354a55[_0x477b('0x28')][_0x477b('0x34')]));_0x1d9f55['attributes']=_0x1d9f55[_0x477b('0x33')][_0x477b('0x35')]?_0x1d9f55[_0x477b('0x33')]:_0x5a4749[_0x477b('0x2f')];if(!_0x354a55[_0x477b('0x28')]['hasOwnProperty'](_0x477b('0x44'))){_0x1d9f55[_0x477b('0x18')]=qs[_0x477b('0x18')](_0x354a55[_0x477b('0x28')][_0x477b('0x18')]);_0x1d9f55['offset']=qs[_0x477b('0x16')](_0x354a55[_0x477b('0x28')][_0x477b('0x16')]);}_0x1d9f55[_0x477b('0x45')]=qs[_0x477b('0x46')](_0x354a55[_0x477b('0x28')][_0x477b('0x46')]);_0x1d9f55[_0x477b('0x47')]=qs['filters'](_[_0x477b('0x48')](_0x354a55[_0x477b('0x28')],_0x5a4749[_0x477b('0x31')]));_0x1d9f55[_0x477b('0x47')][_0x477b('0x49')]=_0x17bb91['id'];if(_0x354a55[_0x477b('0x28')]['filter']){_0x1d9f55[_0x477b('0x47')]=_[_0x477b('0x37')](_0x1d9f55[_0x477b('0x47')],{'$or':_[_0x477b('0x4a')](_0x1d9f55[_0x477b('0x33')],function(_0x4c23d4){var _0x3bf052={};_0x3bf052[_0x4c23d4]={'$like':'%'+_0x354a55[_0x477b('0x28')]['filter']+'%'};return _0x3bf052;})});}if(_0x354a55[_0x477b('0x28')][_0x477b('0x4b')]){var _0x2e415c=_0x354a55[_0x477b('0x28')][_0x477b('0x4b')][_0x477b('0x4c')](',');var _0x27de18={};_0x27de18[_0x2e415c[0x0]]={'$gte':moment(_0x2e415c[0x1])[_0x477b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d9f55['where']=_[_0x477b('0x37')](_0x1d9f55[_0x477b('0x47')],_0x27de18);}_0x1d9f55=_[_0x477b('0x37')]({},_0x1d9f55,_0x354a55[_0x477b('0x38')]);return db[_0x477b('0x3e')][_0x477b('0x19')]({'where':_0x1d9f55[_0x477b('0x47')]})[_0x477b('0x1d')](function(_0x281186){_0x1f5a0a['count']=_0x281186;if(_0x354a55[_0x477b('0x28')][_0x477b('0x4e')]){_0x1d9f55[_0x477b('0x36')]=[{'all':!![]}];}return db[_0x477b('0x3e')][_0x477b('0x4f')](_0x1d9f55);})['then'](function(_0x5136b4){_0x1f5a0a[_0x477b('0x50')]=_0x5136b4;return _0x1f5a0a;});}})[_0x477b('0x1d')](respondWithFilteredResult(_0x304da1,_0x1d9f55))[_0x477b('0x2a')](handleError(_0x304da1,null));};exports[_0x477b('0x51')]=function(_0x1d0129,_0x10eaae){return db[_0x477b('0x30')][_0x477b('0x39')]({'where':{'id':_0x1d0129[_0x477b('0x2e')]['id']}})['then'](handleEntityNotFound(_0x10eaae,null))[_0x477b('0x1d')](function(_0x19b06b){if(_0x19b06b){return _0x19b06b['setTags'](_0x1d0129[_0x477b('0x3b')][_0x477b('0x40')],_['omit'](_0x1d0129[_0x477b('0x3b')],[_0x477b('0x40'),'id'])||{})[_0x477b('0x52')](function(){return db[_0x477b('0x53')][_0x477b('0x4f')]({'attributes':['id',_0x477b('0x21'),_0x477b('0x54')],'where':{'id':_0x1d0129['body']['ids']}});})[_0x477b('0x1d')](function(_0x4d2820){socket['emit'](_0x477b('0x55'),{'id':Number(_0x1d0129[_0x477b('0x2e')]['id']),'tags':_0x4d2820||[]});return{'id':Number(_0x1d0129['params']['id']),'tags':_0x4d2820||[]};});}})['then'](respondWithResult(_0x10eaae,null))[_0x477b('0x2a')](handleError(_0x10eaae,null));};exports['removeTags']=function(_0x1dc3be,_0x3ac9fd){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1dc3be[_0x477b('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3ac9fd,null))[_0x477b('0x1d')](function(_0x29f4e9){if(_0x29f4e9){return _0x29f4e9[_0x477b('0x56')](_0x1dc3be[_0x477b('0x28')][_0x477b('0x40')]);}})['then'](respondWithStatusCode(_0x3ac9fd,null))[_0x477b('0x2a')](handleError(_0x3ac9fd,null));};exports[_0x477b('0x57')]=function(_0x1c739c,_0x4cf52f){var _0x18b801=moment()['unix']()['toString']();var _0x19bcae=path[_0x477b('0x58')](config[_0x477b('0x59')],'server',_0x477b('0x5a'),_0x477b('0x5b'));var _0xd96773=path[_0x477b('0x58')](config[_0x477b('0x59')],_0x477b('0x5c'),_0x477b('0x5a'),_0x477b('0x5d'));var _0x2c6b28=path[_0x477b('0x58')](_0x19bcae,_0x18b801);var _0xc227db=util[_0x477b('0x4d')](_0x477b('0x5e'),_0x1c739c[_0x477b('0x2e')]['id'],_0x18b801);var _0x253dcb=path['join'](_0x19bcae,_0xc227db);var _0x2a3122=[];_0x2a3122[_0x477b('0x5f')]({'model':db['User'],'as':'User','attributes':['id',_0x477b('0x60')],'raw':!![]});_0x2a3122[_0x477b('0x5f')]({'model':db[_0x477b('0x61')],'as':_0x477b('0x62'),'attributes':['id',_0x477b('0x63'),_0x477b('0x64')],'raw':!![]});if(_0x1c739c[_0x477b('0x28')]['attachments']){_0x2a3122[_0x477b('0x5f')]({'model':db[_0x477b('0x65')],'as':'Attachment','raw':!![]});}var _0x398bf4=[{'model':db['OpenchannelMessage'],'as':_0x477b('0x66'),'attributes':['id',_0x477b('0x3b'),'createdAt',_0x477b('0x67'),_0x477b('0x68'),_0x477b('0x69')],'include':_0x2a3122}];_0x398bf4['push']({'model':db[_0x477b('0x6a')],'as':_0x477b('0x6b'),'attributes':['id',_0x477b('0x21')]});_0x398bf4['push']({'model':db[_0x477b('0x6c')],'as':'Owner','attributes':['id',_0x477b('0x60')]});return db[_0x477b('0x30')][_0x477b('0x39')]({'where':{'id':_0x1c739c['params']['id']},'include':_0x398bf4})[_0x477b('0x1d')](handleEntityNotFound(_0x4cf52f,null))[_0x477b('0x1d')](function(_0xdc16da){if(_0xdc16da){var _0x2db7df=_0xdc16da['get']({'plain':!![]});fs['mkdirSync'](_0x2c6b28);var _0x3aaf74={'channel':_0x477b('0x6d'),'account':_0x2db7df[_0x477b('0x6b')]['name'],'agent':_0x2db7df[_0x477b('0x6e')]?_0x2db7df[_0x477b('0x6e')][_0x477b('0x60')]:_0x477b('0x6f'),'createdAt':moment(_0x2db7df[_0x477b('0x70')])[_0x477b('0x4d')](_0x477b('0x71'))[_0x477b('0x72')](),'closedAt':_0x2db7df[_0x477b('0x73')]?moment(_0x2db7df[_0x477b('0x74')])[_0x477b('0x4d')](_0x477b('0x71'))[_0x477b('0x72')]():'','disposition':_0x2db7df[_0x477b('0x75')],'visibility':_0x2db7df[_0x477b('0x76')]?_0x477b('0x77'):_0x477b('0x78'),'messages':_(_0x2db7df[_0x477b('0x66')])[_0x477b('0x79')]({'secret':![]})[_0x477b('0x4a')](function(_0x57c635){if(_0x57c635[_0x477b('0x65')]){var _0xa3fc36=path[_0x477b('0x58')](_0xd96773,_0x57c635[_0x477b('0x65')]['basename']);if(fs[_0x477b('0x7a')](_0xa3fc36)){fs[_0x477b('0x7b')](_0xa3fc36)[_0x477b('0x7c')](fs[_0x477b('0x7d')](path[_0x477b('0x58')](_0x2c6b28,_0x57c635[_0x477b('0x65')][_0x477b('0x7e')])));}}return{'date':moment(_0x57c635[_0x477b('0x70')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x477b('0x72')](),'sender':_0x57c635['direction']==='out'?_0x57c635['User']?_0x57c635[_0x477b('0x6c')][_0x477b('0x60')]:_0x477b('0x7f'):_0x57c635[_0x477b('0x62')][_0x477b('0x63')]+(_0x57c635[_0x477b('0x62')][_0x477b('0x64')]?'\x20'+_0x57c635[_0x477b('0x62')][_0x477b('0x64')]:''),'body':_0x57c635[_0x477b('0x65')]?_0x57c635[_0x477b('0x65')][_0x477b('0x7e')]:_0x57c635[_0x477b('0x3b')],'direction':_0x57c635[_0x477b('0x67')]===_0x477b('0x80')?'A':'C','secret':_0x57c635[_0x477b('0x68')],'read':_0x57c635[_0x477b('0x69')],'attachment':_0x57c635[_0x477b('0x65')]};})[_0x477b('0x81')]()};return ejs[_0x477b('0x82')](path[_0x477b('0x58')](config[_0x477b('0x59')],_0x477b('0x5c'),_0x477b('0x83'),_0x477b('0x84')),{'interaction':_0x3aaf74})['then'](function(_0x537ced){var _0xaeb6c2=path[_0x477b('0x58')](_0x2c6b28,'transcript-'+_0x2db7df['id']+'-'+_0x18b801+_0x477b('0x85'));var _0x3701c2={'path':_0xaeb6c2,'channel':_0x477b('0x6d'),'interactionId':_0x2db7df['id']};return pdf['createPdfFromHTML'](_0x537ced,_0x3701c2);})[_0x477b('0x1d')](function(){return new Promise(function(_0x1bd83b,_0x1910f7){zipdir(_0x2c6b28,{'saveTo':_0x253dcb},function(_0xa14635,_0x517412){if(_0xa14635)return _0x1910f7(_0xa14635);return _0x1bd83b(_0x517412);});})[_0x477b('0x1d')](function(){return new Promise(function(_0x4b216e,_0x427905){rimraf(_0x2c6b28,function(_0x34002a){if(_0x34002a)_0x427905(_0x34002a);return _0x4b216e();});});})[_0x477b('0x1d')](function(){return _0x4cf52f[_0x477b('0x57')](_0x253dcb,_0xc227db,function(_0x174f7d){if(_0x174f7d){logger[_0x477b('0x1f')]('Unable\x20to\x20delete\x20zip\x20file',_0x174f7d);}else{fs[_0x477b('0x86')](_0x253dcb);}});});});}else{return _0x4cf52f[_0x477b('0x12')](0xc8);}})[_0x477b('0x2a')](handleError(_0x4cf52f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 51c4343..f29019f 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 _0x0a0a=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','getUsers','then'];(function(_0x145b54,_0x267c42){var _0x52007e=function(_0xfc9fdf){while(--_0xfc9fdf){_0x145b54['push'](_0x145b54['shift']());}};_0x52007e(++_0x267c42);}(_0x0a0a,0xbd));var _0xa0a0=function(_0x17cb3f,_0x1faa8f){_0x17cb3f=_0x17cb3f-0x0;var _0x235ba2=_0x0a0a[_0x17cb3f];return _0x235ba2;};'use strict';var EventEmitter=require(_0xa0a0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa0a0('0x1')];var OpenchannelMessage=require(_0xa0a0('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa0a0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0a0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x262cb0){return function(_0xd006b8,_0x592e24,_0xc7e8a7){_0xd006b8[_0xa0a0('0x5')]({'attributes':['id'],'raw':!![]})[_0xa0a0('0x6')](function(_0x1f52df){_0xd006b8[_0xa0a0('0x7')](_0xa0a0('0x8'),_0x1f52df[_0xa0a0('0x9')](function(_0x55607b){return{'id':_0x55607b['id']};}));return OpenchannelMessage[_0xa0a0('0xa')]({'where':{'OpenchannelInteractionId':_0xd006b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa0a0('0x6')](function(_0x2a33da){_0xd006b8['setDataValue'](_0xa0a0('0xb'),_0x2a33da['length']);OpenchannelInteractionEvents[_0xa0a0('0xc')](_0x262cb0+':'+_0xd006b8['id'],_0xd006b8);OpenchannelInteractionEvents[_0xa0a0('0xc')](_0x262cb0,_0xd006b8);_0xc7e8a7(null);})[_0xa0a0('0xd')](_0xc7e8a7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf9a1=['update','getUsers','then','setDataValue','map','findAll','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf9a1,0x133));var _0x1f9a=function(_0xfa558,_0x27060e){_0xfa558=_0xfa558-0x0;var _0x8fe230=_0xf9a1[_0xfa558];return _0x8fe230;};'use strict';var EventEmitter=require(_0x1f9a('0x0'));var OpenchannelInteraction=require(_0x1f9a('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x1f9a('0x1'))['db'][_0x1f9a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1f9a('0x3')](0x0);var events={'afterCreate':_0x1f9a('0x4'),'afterUpdate':_0x1f9a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58e9a2){return function(_0x22dedd,_0x27eb2b,_0x51aff6){_0x22dedd[_0x1f9a('0x6')]({'attributes':['id'],'raw':!![]})[_0x1f9a('0x7')](function(_0xf46bd5){_0x22dedd[_0x1f9a('0x8')]('Users',_0xf46bd5[_0x1f9a('0x9')](function(_0x4537f1){return{'id':_0x4537f1['id']};}));return OpenchannelMessage[_0x1f9a('0xa')]({'where':{'OpenchannelInteractionId':_0x22dedd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1f9a('0x7')](function(_0x2b92ab){_0x22dedd[_0x1f9a('0x8')]('unreadMessages',_0x2b92ab['length']);OpenchannelInteractionEvents['emit'](_0x58e9a2+':'+_0x22dedd['id'],_0x22dedd);OpenchannelInteractionEvents['emit'](_0x58e9a2,_0x22dedd);_0x51aff6(null);})['catch'](_0x51aff6(null));};}for(var e in events){if(events[_0x1f9a('0xb')](e)){var event=events[e];OpenchannelInteraction[_0x1f9a('0xc')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 493ccf9..58a4aef 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 _0x2b87=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x5943ae,_0x35da2a){var _0x189dd9=function(_0x225b1e){while(--_0x225b1e){_0x5943ae['push'](_0x5943ae['shift']());}};_0x189dd9(++_0x35da2a);}(_0x2b87,0x72));var _0x72b8=function(_0x2cbbcb,_0x55ef2d){_0x2cbbcb=_0x2cbbcb-0x0;var _0x2e4d60=_0x2b87[_0x2cbbcb];return _0x2e4d60;};'use strict';var _=require(_0x72b8('0x0'));var util=require(_0x72b8('0x1'));var logger=require(_0x72b8('0x2'))(_0x72b8('0x3'));var moment=require('moment');var BPromise=require(_0x72b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x72b8('0x5'));var config=require(_0x72b8('0x6'));var attributes=require(_0x72b8('0x7'));module['exports']=function(_0x13e9d4,_0x366848){return _0x13e9d4[_0x72b8('0x8')](_0x72b8('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72b8('0xa'),'collate':_0x72b8('0xb'),'hooks':{'beforeUpdate':function(_0x1980d9,_0x4340f7,_0x5ffea0){if(_0x1980d9[_0x72b8('0xc')](_0x72b8('0xd'))){_0x1980d9['closedAt']=moment()[_0x72b8('0xe')](_0x72b8('0xf'));}_0x5ffea0(null,_0x1980d9);}}});}; \ No newline at end of file +var _0x736c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x736c,0x190));var _0xc736=function(_0xbfcd0c,_0x9a83a5){_0xbfcd0c=_0xbfcd0c-0x0;var _0x4c239c=_0x736c[_0xbfcd0c];return _0x4c239c;};'use strict';var _=require(_0xc736('0x0'));var util=require(_0xc736('0x1'));var logger=require('../../config/logger')(_0xc736('0x2'));var moment=require(_0xc736('0x3'));var BPromise=require(_0xc736('0x4'));var rp=require(_0xc736('0x5'));var fs=require('fs');var path=require(_0xc736('0x6'));var rimraf=require(_0xc736('0x7'));var config=require(_0xc736('0x8'));var attributes=require(_0xc736('0x9'));module['exports']=function(_0x5b2a92,_0x22cdd6){return _0x5b2a92['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc736('0xa'),'collate':_0xc736('0xb'),'hooks':{'beforeUpdate':function(_0x268e4a,_0x21eb49,_0x13682d){if(_0x268e4a[_0xc736('0xc')](_0xc736('0xd'))){_0x268e4a['closedAt']=moment()[_0xc736('0xe')](_0xc736('0xf'));}_0x13682d(null,_0x268e4a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index c91e5b4..f5c29d2 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 _0x0a08=['then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','find','where','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request'];(function(_0x4796ab,_0x4e78a4){var _0x8026b8=function(_0x43589d){while(--_0x43589d){_0x4796ab['push'](_0x4796ab['shift']());}};_0x8026b8(++_0x4e78a4);}(_0x0a08,0x6d));var _0x80a0=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0a08[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x80a0('0x0'));var util=require(_0x80a0('0x1'));var moment=require(_0x80a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x80a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80a0('0x4'))['db'];var utils=require(_0x80a0('0x5'));var logger=require('../../config/logger')(_0x80a0('0x6'));var config=require(_0x80a0('0x7'));var jayson=require(_0x80a0('0x8'));var client=jayson[_0x80a0('0x9')][_0x80a0('0xa')]({'port':0x232a});config[_0x80a0('0xb')]=_['defaults'](config[_0x80a0('0xb')],{'host':_0x80a0('0xc'),'port':0x18eb});var socket=require(_0x80a0('0xd'))(new Redis(config[_0x80a0('0xb')]));require(_0x80a0('0xe'))[_0x80a0('0xf')](socket);function respondWithRpcPromise(_0x92f85e,_0x372e79,_0x53e365){return new BPromise(function(_0xba7789,_0x2eef15){return client[_0x80a0('0x10')](_0x92f85e,_0x53e365)[_0x80a0('0x11')](function(_0x5cb76c){logger[_0x80a0('0x12')](_0x80a0('0x13'),_0x372e79,'request\x20sent');logger[_0x80a0('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x372e79,_0x80a0('0x15'),JSON[_0x80a0('0x16')](_0x5cb76c));if(_0x5cb76c[_0x80a0('0x17')]){if(_0x5cb76c[_0x80a0('0x17')][_0x80a0('0x18')]===0x1f4){logger[_0x80a0('0x17')](_0x80a0('0x13'),_0x372e79,_0x5cb76c[_0x80a0('0x17')][_0x80a0('0x19')]);return _0x2eef15(_0x5cb76c['error'][_0x80a0('0x19')]);}logger[_0x80a0('0x17')](_0x80a0('0x13'),_0x372e79,_0x5cb76c['error'][_0x80a0('0x19')]);return _0xba7789(_0x5cb76c[_0x80a0('0x17')]['message']);}else{logger[_0x80a0('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x372e79,_0x80a0('0x15'));_0xba7789(_0x5cb76c[_0x80a0('0x1a')]['message']);}})[_0x80a0('0x1b')](function(_0x4d277a){logger[_0x80a0('0x17')](_0x80a0('0x13'),_0x372e79,_0x4d277a);_0x2eef15(_0x4d277a);});});}exports['UpdateOpenchannelInteraction']=function(_0x456b1a){var _0x382548=this;return new Promise(function(_0x398206,_0x2dcc01){return db[_0x80a0('0x1c')][_0x80a0('0x1d')](_0x456b1a[_0x80a0('0x1e')],{'raw':_0x456b1a['options']?_0x456b1a[_0x80a0('0x1f')][_0x80a0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456b1a[_0x80a0('0x1f')]?_0x456b1a[_0x80a0('0x1f')]['where']||null:null,'attributes':_0x456b1a[_0x80a0('0x1f')]?_0x456b1a['options'][_0x80a0('0x21')]||null:null,'limit':_0x456b1a['options']?_0x456b1a[_0x80a0('0x1f')][_0x80a0('0x22')]||null:null})[_0x80a0('0x11')](function(_0x3875a0){logger[_0x80a0('0x12')](_0x80a0('0x23'),_0x456b1a);logger[_0x80a0('0x14')]('UpdateOpenchannelInteraction',_0x456b1a,JSON['stringify'](_0x3875a0));_0x398206(_0x3875a0);})[_0x80a0('0x1b')](function(_0x44bae8){logger[_0x80a0('0x17')]('UpdateOpenchannelInteraction',_0x44bae8[_0x80a0('0x19')],_0x456b1a);_0x2dcc01(_0x382548['error'](0x1f4,_0x44bae8[_0x80a0('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x184551){return new Promise(function(_0x140576,_0x37e43d){return db[_0x80a0('0x1c')][_0x80a0('0x24')]({'where':_0x184551[_0x80a0('0x1f')]?_0x184551[_0x80a0('0x1f')][_0x80a0('0x25')]||null:null})['then'](function(_0x56bb2f){if(_0x56bb2f){return _0x56bb2f['addTags'](_0x184551[_0x80a0('0x1e')][_0x80a0('0x26')],_[_0x80a0('0x27')](_0x184551[_0x80a0('0x1e')],[_0x80a0('0x26'),'id'])||{});}})[_0x80a0('0x28')](function(_0x4eb112){logger[_0x80a0('0x12')](_0x80a0('0x29'),_0x184551);logger[_0x80a0('0x14')](_0x80a0('0x29'),_0x184551,JSON[_0x80a0('0x16')](_0x4eb112));_0x140576(_0x4eb112);})[_0x80a0('0x1b')](function(_0x6b046){logger[_0x80a0('0x17')](_0x80a0('0x29'),_0x6b046[_0x80a0('0x19')],_0x184551);_0x37e43d(_this[_0x80a0('0x17')](0x1f4,_0x6b046['message']));});});}; \ No newline at end of file +var _0x9810=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','OpenchannelInteraction','body','options','raw','where','attributes','UpdateOpenchannelInteraction','stringify','catch','AddTagsToOpenchannelInteraction','find','addTags','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','then','info'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9810,0xb2));var _0x0981=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x9810[_0x3de8a4];return _0x4635cf;};'use strict';var _=require('lodash');var util=require(_0x0981('0x0'));var moment=require(_0x0981('0x1'));var BPromise=require(_0x0981('0x2'));var rs=require(_0x0981('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0981('0x4'))['db'];var utils=require(_0x0981('0x5'));var logger=require(_0x0981('0x6'))(_0x0981('0x7'));var config=require(_0x0981('0x8'));var jayson=require(_0x0981('0x9'));var client=jayson[_0x0981('0xa')]['http']({'port':0x232a});config[_0x0981('0xb')]=_[_0x0981('0xc')](config[_0x0981('0xb')],{'host':_0x0981('0xd'),'port':0x18eb});var socket=require(_0x0981('0xe'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1f1498,_0x11c4c6,_0x328788){return new BPromise(function(_0x2e3ee4,_0x579f66){return client['request'](_0x1f1498,_0x328788)[_0x0981('0xf')](function(_0x152702){logger[_0x0981('0x10')](_0x0981('0x11'),_0x11c4c6,_0x0981('0x12'));logger[_0x0981('0x13')](_0x0981('0x14'),_0x11c4c6,_0x0981('0x12'),JSON['stringify'](_0x152702));if(_0x152702[_0x0981('0x15')]){if(_0x152702['error'][_0x0981('0x16')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x11c4c6,_0x152702[_0x0981('0x15')][_0x0981('0x17')]);return _0x579f66(_0x152702[_0x0981('0x15')][_0x0981('0x17')]);}logger[_0x0981('0x15')](_0x0981('0x11'),_0x11c4c6,_0x152702[_0x0981('0x15')]['message']);return _0x2e3ee4(_0x152702[_0x0981('0x15')]['message']);}else{logger[_0x0981('0x10')](_0x0981('0x11'),_0x11c4c6,_0x0981('0x12'));_0x2e3ee4(_0x152702[_0x0981('0x18')][_0x0981('0x17')]);}})['catch'](function(_0x3cf543){logger[_0x0981('0x15')](_0x0981('0x11'),_0x11c4c6,_0x3cf543);_0x579f66(_0x3cf543);});});}exports['UpdateOpenchannelInteraction']=function(_0x5403c0){var _0x55c527=this;return new Promise(function(_0x8ce9ea,_0xeacec7){return db[_0x0981('0x19')]['update'](_0x5403c0[_0x0981('0x1a')],{'raw':_0x5403c0[_0x0981('0x1b')]?_0x5403c0['options'][_0x0981('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5403c0[_0x0981('0x1b')]?_0x5403c0[_0x0981('0x1b')][_0x0981('0x1d')]||null:null,'attributes':_0x5403c0['options']?_0x5403c0[_0x0981('0x1b')][_0x0981('0x1e')]||null:null,'limit':_0x5403c0['options']?_0x5403c0[_0x0981('0x1b')]['limit']||null:null})['then'](function(_0x501cad){logger[_0x0981('0x10')](_0x0981('0x1f'),_0x5403c0);logger['debug'](_0x0981('0x1f'),_0x5403c0,JSON[_0x0981('0x20')](_0x501cad));_0x8ce9ea(_0x501cad);})[_0x0981('0x21')](function(_0x35d895){logger[_0x0981('0x15')](_0x0981('0x1f'),_0x35d895[_0x0981('0x17')],_0x5403c0);_0xeacec7(_0x55c527[_0x0981('0x15')](0x1f4,_0x35d895[_0x0981('0x17')]));});});};exports[_0x0981('0x22')]=function(_0x597c24){return new Promise(function(_0x3e1a4d,_0x16b242){return db[_0x0981('0x19')][_0x0981('0x23')]({'where':_0x597c24[_0x0981('0x1b')]?_0x597c24['options'][_0x0981('0x1d')]||null:null})[_0x0981('0xf')](function(_0x19c4ca){if(_0x19c4ca){return _0x19c4ca[_0x0981('0x24')](_0x597c24['body']['ids'],_['omit'](_0x597c24[_0x0981('0x1a')],['ids','id'])||{});}})[_0x0981('0x25')](function(_0x5d6905){logger['info'](_0x0981('0x26'),_0x597c24);logger[_0x0981('0x13')]('AddTags',_0x597c24,JSON[_0x0981('0x20')](_0x5d6905));_0x3e1a4d(_0x5d6905);})[_0x0981('0x21')](function(_0x40054b){logger['error'](_0x0981('0x26'),_0x40054b[_0x0981('0x17')],_0x597c24);_0x16b242(_this[_0x0981('0x15')](0x1f4,_0x40054b[_0x0981('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index fc46e03..5d324d2 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 _0xb6fb=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','update'];(function(_0x1a835a,_0x2a00a8){var _0x44e27b=function(_0x2d683c){while(--_0x2d683c){_0x1a835a['push'](_0x1a835a['shift']());}};_0x44e27b(++_0x2a00a8);}(_0xb6fb,0x17f));var _0xbb6f=function(_0x34d1e5,_0x209bed){_0x34d1e5=_0x34d1e5-0x0;var _0x3892a6=_0xb6fb[_0x34d1e5];return _0x3892a6;};'use strict';var OpenchannelInteractionEvents=require(_0xbb6f('0x0'));var events=['save','remove',_0xbb6f('0x1')];function createListener(_0x337def,_0xff8c6f){return function(_0xf71041){_0xff8c6f[_0xbb6f('0x2')](_0x337def,_0xf71041);};}function removeListener(_0x21de6d,_0x251503){return function(){OpenchannelInteractionEvents[_0xbb6f('0x3')](_0x21de6d,_0x251503);};}exports[_0xbb6f('0x4')]=function(_0x4ebf3c){for(var _0x330500=0x0,_0x31be2a=events[_0xbb6f('0x5')];_0x330500<_0x31be2a;_0x330500++){var _0x1933df=events[_0x330500];var _0x25f4cb=createListener(_0xbb6f('0x6')+_0x1933df,_0x4ebf3c);OpenchannelInteractionEvents['on'](_0x1933df,_0x25f4cb);}}; \ No newline at end of file +var _0xb931=['save','remove','update','emit','removeListener','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x3079f4,_0x314293){var _0x57b4ad=function(_0x400c83){while(--_0x400c83){_0x3079f4['push'](_0x3079f4['shift']());}};_0x57b4ad(++_0x314293);}(_0xb931,0x164));var _0x1b93=function(_0x34a10b,_0x3e2de5){_0x34a10b=_0x34a10b-0x0;var _0x4a0a5b=_0xb931[_0x34a10b];return _0x4a0a5b;};'use strict';var OpenchannelInteractionEvents=require(_0x1b93('0x0'));var events=[_0x1b93('0x1'),_0x1b93('0x2'),_0x1b93('0x3')];function createListener(_0x44f57f,_0x361144){return function(_0x3a926b){_0x361144[_0x1b93('0x4')](_0x44f57f,_0x3a926b);};}function removeListener(_0x492550,_0x13c369){return function(){OpenchannelInteractionEvents[_0x1b93('0x5')](_0x492550,_0x13c369);};}exports['register']=function(_0xba6254){for(var _0xc807d8=0x0,_0x19f0dc=events['length'];_0xc807d8<_0x19f0dc;_0xc807d8++){var _0x9c1d9b=events[_0xc807d8];var _0x59fa2d=createListener(_0x1b93('0x6')+_0x9c1d9b,_0xba6254);OpenchannelInteractionEvents['on'](_0x9c1d9b,_0x59fa2d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 7432e70..8f60e96 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 _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(_0x3b8a26,_0x168cc4){var _0x31bafd=function(_0x3e8667){while(--_0x3e8667){_0x3b8a26['push'](_0x3b8a26['shift']());}};_0x31bafd(++_0x168cc4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0xcb91[_0x80f51a];return _0x327148;};'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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x23cc14,_0x1a9a85){var _0xacc80c=function(_0x38e067){while(--_0x38e067){_0x23cc14['push'](_0x23cc14['shift']());}};_0xacc80c(++_0x1a9a85);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 9dcb467..c0c9b38 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 _0xaa5e=['DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x4e2ecb,_0x57ee22){var _0x1cada8=function(_0x1f7dd1){while(--_0x1f7dd1){_0x4e2ecb['push'](_0x4e2ecb['shift']());}};_0x1cada8(++_0x57ee22);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x2bd1f1,_0x191e68){_0x2bd1f1=_0x2bd1f1-0x0;var _0x2310da=_0xaa5e[_0x2bd1f1];return _0x2310da;};'use strict';var Sequelize=require(_0xeaa5('0x0'));module[_0xeaa5('0x1')]={'body':{'type':Sequelize['TEXT'](_0xeaa5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeaa5('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeaa5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeaa5('0x4')]('in',_0xeaa5('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xeaa5('0x6')]},'providerName':{'type':Sequelize[_0xeaa5('0x7')]},'providerResponse':{'type':Sequelize[_0xeaa5('0x8')]}}; \ No newline at end of file +var _0x390a=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x7d095,_0x1b5d9a){var _0x44baa8=function(_0x1fc446){while(--_0x1fc446){_0x7d095['push'](_0x7d095['shift']());}};_0x44baa8(++_0x1b5d9a);}(_0x390a,0xc9));var _0xa390=function(_0x503dba,_0x42141e){_0x503dba=_0x503dba-0x0;var _0x5653a8=_0x390a[_0x503dba];return _0x5653a8;};'use strict';var Sequelize=require(_0xa390('0x0'));module[_0xa390('0x1')]={'body':{'type':Sequelize[_0xa390('0x2')](_0xa390('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa390('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa390('0x5')]('in',_0xa390('0x6')),'defaultValue':_0xa390('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa390('0x7')]},'providerResponse':{'type':Sequelize[_0xa390('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index ce42810..1325b8e 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 _0xab96=['model','query','attributes','fields','length','order','where','merge','VIRTUAL','filter','includeAll','include','rows','show','options','find','create','body','params','describe','accept','openchannel','acceptMessage','reject','UserId','user','get','OpenchannelInteraction','interaction','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','undefined','count','limit','set','Content-Range','update','destroy','status','end','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','map','keys','filters','intersection'];(function(_0xad70ab,_0x2461d2){var _0x4a7024=function(_0x9ebf55){while(--_0x9ebf55){_0xad70ab['push'](_0xad70ab['shift']());}};_0x4a7024(++_0x2461d2);}(_0xab96,0x95));var _0x6ab9=function(_0x1d3a4d,_0x7a4edb){_0x1d3a4d=_0x1d3a4d-0x0;var _0x122e3d=_0xab96[_0x1d3a4d];return _0x122e3d;};'use strict';var util=require(_0x6ab9('0x0'));var _=require(_0x6ab9('0x1'));var Redis=require('ioredis');var interactionService=require(_0x6ab9('0x2'));var qs=require(_0x6ab9('0x3'));var logger=require(_0x6ab9('0x4'))(_0x6ab9('0x5'));var config=require(_0x6ab9('0x6'));var db=require('../../mysqldb')['db'];config[_0x6ab9('0x7')]=_[_0x6ab9('0x8')](config[_0x6ab9('0x7')],{'host':_0x6ab9('0x9'),'port':0x18eb});var socket=require(_0x6ab9('0xa'))(new Redis(config[_0x6ab9('0x7')]));require(_0x6ab9('0xb'))[_0x6ab9('0xc')](socket);var jayson=require(_0x6ab9('0xd'));var client=jayson['client'][_0x6ab9('0xe')]({'port':0x232c});var client9002=jayson[_0x6ab9('0xf')]['http']({'port':0x232a});var interaction_log=require(_0x6ab9('0x4'))(_0x6ab9('0x10'));function respondWithRpcPromise(_0x30ebf0,_0x4231f6,_0x240179,_0x3eacca){return new Promise(function(_0x12c13a,_0x544ea8){var _0x5d75db=_0x3eacca||client;return _0x5d75db[_0x6ab9('0x11')](_0x30ebf0,_0x240179)[_0x6ab9('0x12')](function(_0x4a89c1){logger[_0x6ab9('0x13')](_0x6ab9('0x14'),_0x4231f6,_0x6ab9('0x15'));logger[_0x6ab9('0x16')](_0x6ab9('0x17'),_0x4231f6,_0x6ab9('0x15'),JSON[_0x6ab9('0x18')](_0x4a89c1));if(_0x4a89c1[_0x6ab9('0x19')]){if(_0x4a89c1['error'][_0x6ab9('0x1a')]===0x1f4){logger[_0x6ab9('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x4231f6,_0x4a89c1[_0x6ab9('0x19')]['message']);return _0x544ea8(_0x4a89c1[_0x6ab9('0x19')]['message']);}logger['error'](_0x6ab9('0x14'),_0x4231f6,_0x4a89c1['error'][_0x6ab9('0x1b')]);return _0x12c13a(_0x4a89c1['error'][_0x6ab9('0x1b')]);}else{logger[_0x6ab9('0x13')](_0x6ab9('0x14'),_0x4231f6,'request\x20sent');_0x12c13a(_0x4a89c1[_0x6ab9('0x1c')][_0x6ab9('0x1b')]);}})[_0x6ab9('0x1d')](function(_0x3e410a){logger['error'](_0x6ab9('0x14'),_0x4231f6,_0x3e410a);_0x544ea8(_0x3e410a);});});}function respondWithResult(_0x42b325,_0x43e323){_0x43e323=_0x43e323||0xc8;return function(_0x5bcb20){if(_0x5bcb20){return _0x42b325['status'](_0x43e323)[_0x6ab9('0x1e')](_0x5bcb20);}};}function respondWithFilteredResult(_0x162aa2,_0x3f539e){return function(_0x3ee982){if(_0x3ee982){var _0x552a45=typeof _0x3f539e[_0x6ab9('0x1f')]===_0x6ab9('0x20')&&typeof _0x3f539e['limit']===_0x6ab9('0x20');var _0x175a7a=_0x3ee982[_0x6ab9('0x21')];var _0x32f1c6=_0x552a45?0x0:_0x3f539e[_0x6ab9('0x1f')];var _0x739b70=_0x552a45?_0x3ee982['count']:_0x3f539e['offset']+_0x3f539e[_0x6ab9('0x22')];var _0xae0903;if(_0x739b70>=_0x175a7a){_0x739b70=_0x175a7a;_0xae0903=0xc8;}else{_0xae0903=0xce;}_0x162aa2['status'](_0xae0903);return _0x162aa2[_0x6ab9('0x23')](_0x6ab9('0x24'),_0x32f1c6+'-'+_0x739b70+'/'+_0x175a7a)['json'](_0x3ee982);}return null;};}function saveUpdates(_0x47470f){return function(_0x1594b4){if(_0x1594b4){return _0x1594b4[_0x6ab9('0x25')](_0x47470f)[_0x6ab9('0x12')](function(_0x520c8a){return _0x520c8a;});}return null;};}function removeEntity(_0x26dcc4){return function(_0x44388f){if(_0x44388f){return _0x44388f[_0x6ab9('0x26')]()['then'](function(){_0x26dcc4[_0x6ab9('0x27')](0xcc)[_0x6ab9('0x28')]();});}};}function handleEntityNotFound(_0x38fc4f){return function(_0x3a604c){if(!_0x3a604c){_0x38fc4f[_0x6ab9('0x29')](0x194);}return _0x3a604c;};}function handleError(_0x16b530,_0x52ed0a){_0x52ed0a=_0x52ed0a||0x1f4;return function(_0x9c52bf){logger['error'](_0x9c52bf[_0x6ab9('0x2a')]);if(_0x9c52bf[_0x6ab9('0x2b')]){delete _0x9c52bf[_0x6ab9('0x2b')];}_0x16b530[_0x6ab9('0x27')](_0x52ed0a)[_0x6ab9('0x2c')](_0x9c52bf);};}exports[_0x6ab9('0x2d')]=function(_0x69d534,_0x1182a0){var _0x2709d5={},_0x54ab23={},_0x515d0d={'count':0x0,'rows':[]};var _0x28cc74=_['map'](db[_0x6ab9('0x2e')][_0x6ab9('0x2f')],function(_0xd2b5dc){return{'name':_0xd2b5dc[_0x6ab9('0x30')],'type':_0xd2b5dc[_0x6ab9('0x31')][_0x6ab9('0x32')]};});_0x54ab23['model']=_[_0x6ab9('0x33')](_0x28cc74,_0x6ab9('0x2b'));_0x54ab23['query']=_[_0x6ab9('0x34')](_0x69d534['query']);_0x54ab23[_0x6ab9('0x35')]=_[_0x6ab9('0x36')](_0x54ab23[_0x6ab9('0x37')],_0x54ab23[_0x6ab9('0x38')]);_0x2709d5[_0x6ab9('0x39')]=_[_0x6ab9('0x36')](_0x54ab23[_0x6ab9('0x37')],qs[_0x6ab9('0x3a')](_0x69d534[_0x6ab9('0x38')][_0x6ab9('0x3a')]));_0x2709d5[_0x6ab9('0x39')]=_0x2709d5[_0x6ab9('0x39')][_0x6ab9('0x3b')]?_0x2709d5[_0x6ab9('0x39')]:_0x54ab23[_0x6ab9('0x37')];if(!_0x69d534[_0x6ab9('0x38')]['hasOwnProperty']('nolimit')){_0x2709d5[_0x6ab9('0x22')]=qs[_0x6ab9('0x22')](_0x69d534[_0x6ab9('0x38')][_0x6ab9('0x22')]);_0x2709d5[_0x6ab9('0x1f')]=qs[_0x6ab9('0x1f')](_0x69d534[_0x6ab9('0x38')]['offset']);}_0x2709d5[_0x6ab9('0x3c')]=qs['sort'](_0x69d534[_0x6ab9('0x38')]['sort']);_0x2709d5[_0x6ab9('0x3d')]=qs['filters'](_['pick'](_0x69d534[_0x6ab9('0x38')],_0x54ab23[_0x6ab9('0x35')]),_0x28cc74);if(_0x69d534[_0x6ab9('0x38')]['filter']){_0x2709d5['where']=_[_0x6ab9('0x3e')](_0x2709d5[_0x6ab9('0x3d')],{'$or':_[_0x6ab9('0x33')](_0x28cc74,function(_0x3627ab){if(_0x3627ab[_0x6ab9('0x31')]!==_0x6ab9('0x3f')){var _0xaf877e={};_0xaf877e[_0x3627ab[_0x6ab9('0x2b')]]={'$like':'%'+_0x69d534[_0x6ab9('0x38')][_0x6ab9('0x40')]+'%'};return _0xaf877e;}})});}_0x2709d5=_[_0x6ab9('0x3e')]({},_0x2709d5,_0x69d534['options']);var _0x5d196e={'where':_0x2709d5['where']};return db[_0x6ab9('0x2e')][_0x6ab9('0x21')](_0x5d196e)['then'](function(_0x2c5173){_0x515d0d[_0x6ab9('0x21')]=_0x2c5173;if(_0x69d534[_0x6ab9('0x38')][_0x6ab9('0x41')]){_0x2709d5[_0x6ab9('0x42')]=[{'all':!![]}];}return db[_0x6ab9('0x2e')]['findAll'](_0x2709d5);})[_0x6ab9('0x12')](function(_0x568e7d){_0x515d0d[_0x6ab9('0x43')]=_0x568e7d;return _0x515d0d;})['then'](respondWithFilteredResult(_0x1182a0,_0x2709d5))['catch'](handleError(_0x1182a0,null));};exports[_0x6ab9('0x44')]=function(_0x33bf58,_0xe12f65){var _0x18fbb5={'raw':!![],'where':{'id':_0x33bf58['params']['id']}},_0x46e4be={};_0x46e4be[_0x6ab9('0x37')]=_[_0x6ab9('0x34')](db[_0x6ab9('0x2e')][_0x6ab9('0x2f')]);_0x46e4be['query']=_[_0x6ab9('0x34')](_0x33bf58[_0x6ab9('0x38')]);_0x46e4be['filters']=_['intersection'](_0x46e4be['model'],_0x46e4be[_0x6ab9('0x38')]);_0x18fbb5[_0x6ab9('0x39')]=_[_0x6ab9('0x36')](_0x46e4be['model'],qs['fields'](_0x33bf58[_0x6ab9('0x38')][_0x6ab9('0x3a')]));_0x18fbb5[_0x6ab9('0x39')]=_0x18fbb5[_0x6ab9('0x39')][_0x6ab9('0x3b')]?_0x18fbb5[_0x6ab9('0x39')]:_0x46e4be[_0x6ab9('0x37')];if(_0x33bf58[_0x6ab9('0x38')][_0x6ab9('0x41')]){_0x18fbb5[_0x6ab9('0x42')]=[{'all':!![]}];}_0x18fbb5=_[_0x6ab9('0x3e')]({},_0x18fbb5,_0x33bf58[_0x6ab9('0x45')]);return db['OpenchannelMessage'][_0x6ab9('0x46')](_0x18fbb5)[_0x6ab9('0x12')](handleEntityNotFound(_0xe12f65,null))['then'](respondWithResult(_0xe12f65,null))[_0x6ab9('0x1d')](handleError(_0xe12f65,null));};exports[_0x6ab9('0x47')]=function(_0x2658de,_0x4e4122){return db['OpenchannelMessage'][_0x6ab9('0x47')](_0x2658de['body'],{})['then'](respondWithResult(_0x4e4122,0xc9))[_0x6ab9('0x1d')](handleError(_0x4e4122,null));};exports[_0x6ab9('0x25')]=function(_0x40109c,_0x112033){if(_0x40109c['body']['id']){delete _0x40109c[_0x6ab9('0x48')]['id'];}return db['OpenchannelMessage'][_0x6ab9('0x46')]({'where':{'id':_0x40109c[_0x6ab9('0x49')]['id']}})[_0x6ab9('0x12')](handleEntityNotFound(_0x112033,null))[_0x6ab9('0x12')](saveUpdates(_0x40109c[_0x6ab9('0x48')],null))[_0x6ab9('0x12')](respondWithResult(_0x112033,null))['catch'](handleError(_0x112033,null));};exports[_0x6ab9('0x26')]=function(_0x3df9ce,_0x310a7a){return db[_0x6ab9('0x2e')][_0x6ab9('0x46')]({'where':{'id':_0x3df9ce[_0x6ab9('0x49')]['id']}})['then'](handleEntityNotFound(_0x310a7a,null))[_0x6ab9('0x12')](removeEntity(_0x310a7a,null))[_0x6ab9('0x1d')](handleError(_0x310a7a,null));};exports['describe']=function(_0x53ee14,_0x5e351e){return db[_0x6ab9('0x2e')][_0x6ab9('0x4a')]()[_0x6ab9('0x12')](respondWithResult(_0x5e351e,null))[_0x6ab9('0x1d')](handleError(_0x5e351e,null));};exports[_0x6ab9('0x4b')]=function(_0x4abe82,_0x592112){var _0x3c3de1=_0x6ab9('0x4c');return interactionService[_0x6ab9('0x4d')](_0x4abe82,_0x3c3de1)[_0x6ab9('0x12')](respondWithResult(_0x592112,null))['catch'](handleError(_0x592112,null));};exports[_0x6ab9('0x4e')]=function(_0x22459e,_0x2fa64f){var _0x127c13={'agent':{},'channel':'openchannel'};if(_0x22459e[_0x6ab9('0x48')]['id']){delete _0x22459e['body']['id'];}_0x22459e[_0x6ab9('0x48')]['UserId']=_0x22459e[_0x6ab9('0x48')][_0x6ab9('0x4f')]||_0x22459e[_0x6ab9('0x50')]['id'];_0x127c13['agent']['id']=_0x22459e[_0x6ab9('0x48')]['UserId'];return db[_0x6ab9('0x2e')][_0x6ab9('0x46')]({'where':{'id':_0x22459e[_0x6ab9('0x49')]['id'],'UserId':null}})[_0x6ab9('0x12')](handleEntityNotFound(_0x2fa64f,null))[_0x6ab9('0x12')](function(_0x1ed483){if(_0x1ed483){_0x127c13['message']=_0x1ed483[_0x6ab9('0x51')]({'plain':!![]});return db[_0x6ab9('0x52')]['find']({'where':{'id':_0x1ed483['OpenchannelInteractionId']}});}return null;})[_0x6ab9('0x12')](handleEntityNotFound(_0x2fa64f,null))['then'](function(_0x591873){if(_0x591873){_0x127c13[_0x6ab9('0x53')]=_0x591873[_0x6ab9('0x51')]({'plain':!![]});interaction_log[_0x6ab9('0x13')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22459e[_0x6ab9('0x50')]['id'],_0x22459e[_0x6ab9('0x50')][_0x6ab9('0x2b')],_0x22459e[_0x6ab9('0x50')][_0x6ab9('0x54')],_0x127c13[_0x6ab9('0x53')]['id'],_0x22459e[_0x6ab9('0x48')]?JSON[_0x6ab9('0x18')](_0x22459e['body']):_0x6ab9('0x55'));return respondWithRpcPromise(_0x6ab9('0x56'),'rejectMessage',_0x127c13);}return null;})[_0x6ab9('0x12')](function(_0x373c17){var _0x530522=_0x6ab9('0x57')+_0x373c17[_0x6ab9('0x1b')][_0x6ab9('0x58')];return db[_0x6ab9('0x59')][_0x6ab9('0x38')](_0x530522,{'type':db['Sequelize'][_0x6ab9('0x5a')][_0x6ab9('0x5b')],'raw':!![]})['then'](function(_0x1c22f7){return _0x1c22f7;});})[_0x6ab9('0x12')](function(_0x2f2f31){if(_0x2f2f31){_0x127c13['message'][_0x6ab9('0x5c')]=_0x2f2f31[0x0];if(!_0x22459e[_0x6ab9('0x48')][_0x6ab9('0x4f')])return;return db[_0x6ab9('0x5d')][_0x6ab9('0x46')]({'where':{'id':_0x22459e[_0x6ab9('0x48')][_0x6ab9('0x4f')],'role':'agent'},'attributes':['id','name',_0x6ab9('0x5e'),_0x6ab9('0x5f'),_0x6ab9('0x60')],'raw':!![]});}return null;})[_0x6ab9('0x12')](function(_0x11fc96){if(!_0x11fc96)return null;_0x127c13[_0x6ab9('0x1b')]['agent']=_0x11fc96;return _0x127c13;})[_0x6ab9('0x12')](function(_0x371a45){if(_0x371a45){_0x371a45[_0x6ab9('0x1b')]['interface']=util['format'](_0x6ab9('0x61'),_0x22459e[_0x6ab9('0x50')]['name']);_0x371a45[_0x6ab9('0x1b')][_0x6ab9('0x62')]=_0x127c13[_0x6ab9('0x62')];_0x371a45[_0x6ab9('0x1b')][_0x6ab9('0x63')]=_0x127c13[_0x6ab9('0x62')];_0x371a45['message'][_0x6ab9('0x64')]=_0x6ab9('0x4e');respondWithRpcPromise(_0x6ab9('0x65'),'EventManager',{'event':'rejectmessage','message':_0x371a45[_0x6ab9('0x1b')]},client9002);return _0x127c13;}return null;})['then'](respondWithResult(_0x2fa64f,null))[_0x6ab9('0x1d')](handleError(_0x2fa64f,null));}; \ No newline at end of file +var _0x280b=['stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','Content-Range','then','destroy','end','sendStatus','stack','name','map','OpenchannelMessage','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','update','find','describe','accept','reject','UserId','agent','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','rejectMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','http','openchannel-interactions','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x280b,0x177));var _0xb280=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x280b[_0x4cf98e];return _0x1623ac;};'use strict';var util=require(_0xb280('0x0'));var _=require(_0xb280('0x1'));var Redis=require(_0xb280('0x2'));var interactionService=require(_0xb280('0x3'));var qs=require(_0xb280('0x4'));var logger=require(_0xb280('0x5'))('api');var config=require(_0xb280('0x6'));var db=require(_0xb280('0x7'))['db'];config[_0xb280('0x8')]=_[_0xb280('0x9')](config[_0xb280('0x8')],{'host':_0xb280('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb280('0x8')]));require(_0xb280('0xb'))[_0xb280('0xc')](socket);var jayson=require(_0xb280('0xd'));var client=jayson['client'][_0xb280('0xe')]({'port':0x232c});var client9002=jayson['client'][_0xb280('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xb280('0xf'));function respondWithRpcPromise(_0x16276d,_0x37bcb0,_0xbcb511,_0x43553d){return new Promise(function(_0x5be961,_0xf5e258){var _0x54220f=_0x43553d||client;return _0x54220f['request'](_0x16276d,_0xbcb511)['then'](function(_0xcbee0c){logger[_0xb280('0x10')](_0xb280('0x11'),_0x37bcb0,_0xb280('0x12'));logger[_0xb280('0x13')](_0xb280('0x14'),_0x37bcb0,_0xb280('0x12'),JSON[_0xb280('0x15')](_0xcbee0c));if(_0xcbee0c[_0xb280('0x16')]){if(_0xcbee0c[_0xb280('0x16')][_0xb280('0x17')]===0x1f4){logger[_0xb280('0x16')](_0xb280('0x11'),_0x37bcb0,_0xcbee0c[_0xb280('0x16')][_0xb280('0x18')]);return _0xf5e258(_0xcbee0c['error'][_0xb280('0x18')]);}logger[_0xb280('0x16')](_0xb280('0x11'),_0x37bcb0,_0xcbee0c[_0xb280('0x16')]['message']);return _0x5be961(_0xcbee0c[_0xb280('0x16')][_0xb280('0x18')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x37bcb0,'request\x20sent');_0x5be961(_0xcbee0c[_0xb280('0x19')][_0xb280('0x18')]);}})[_0xb280('0x1a')](function(_0x9773e4){logger[_0xb280('0x16')](_0xb280('0x11'),_0x37bcb0,_0x9773e4);_0xf5e258(_0x9773e4);});});}function respondWithResult(_0x19a45,_0x41cea4){_0x41cea4=_0x41cea4||0xc8;return function(_0x9222f7){if(_0x9222f7){return _0x19a45[_0xb280('0x1b')](_0x41cea4)[_0xb280('0x1c')](_0x9222f7);}};}function respondWithFilteredResult(_0x11eb1b,_0x56ae9a){return function(_0x56432b){if(_0x56432b){var _0x253c01=typeof _0x56ae9a[_0xb280('0x1d')]===_0xb280('0x1e')&&typeof _0x56ae9a['limit']===_0xb280('0x1e');var _0x57de76=_0x56432b[_0xb280('0x1f')];var _0x2f0b39=_0x253c01?0x0:_0x56ae9a[_0xb280('0x1d')];var _0x3ffca9=_0x253c01?_0x56432b[_0xb280('0x1f')]:_0x56ae9a[_0xb280('0x1d')]+_0x56ae9a[_0xb280('0x20')];var _0x4595a1;if(_0x3ffca9>=_0x57de76){_0x3ffca9=_0x57de76;_0x4595a1=0xc8;}else{_0x4595a1=0xce;}_0x11eb1b[_0xb280('0x1b')](_0x4595a1);return _0x11eb1b['set'](_0xb280('0x21'),_0x2f0b39+'-'+_0x3ffca9+'/'+_0x57de76)[_0xb280('0x1c')](_0x56432b);}return null;};}function saveUpdates(_0xc11031){return function(_0x1832b9){if(_0x1832b9){return _0x1832b9['update'](_0xc11031)[_0xb280('0x22')](function(_0x5c0b52){return _0x5c0b52;});}return null;};}function removeEntity(_0x2cdf84){return function(_0x33b63d){if(_0x33b63d){return _0x33b63d[_0xb280('0x23')]()[_0xb280('0x22')](function(){_0x2cdf84[_0xb280('0x1b')](0xcc)[_0xb280('0x24')]();});}};}function handleEntityNotFound(_0x426823){return function(_0xd16f35){if(!_0xd16f35){_0x426823[_0xb280('0x25')](0x194);}return _0xd16f35;};}function handleError(_0x520584,_0xd6021b){_0xd6021b=_0xd6021b||0x1f4;return function(_0x5f1d8a){logger[_0xb280('0x16')](_0x5f1d8a[_0xb280('0x26')]);if(_0x5f1d8a[_0xb280('0x27')]){delete _0x5f1d8a['name'];}_0x520584[_0xb280('0x1b')](_0xd6021b)['send'](_0x5f1d8a);};}exports['index']=function(_0xacc8d1,_0x46f7ab){var _0x50be78={},_0x1e8a46={},_0x5596d1={'count':0x0,'rows':[]};var _0x366d64=_[_0xb280('0x28')](db[_0xb280('0x29')]['rawAttributes'],function(_0x120616){return{'name':_0x120616['fieldName'],'type':_0x120616['type'][_0xb280('0x2a')]};});_0x1e8a46[_0xb280('0x2b')]=_[_0xb280('0x28')](_0x366d64,_0xb280('0x27'));_0x1e8a46['query']=_[_0xb280('0x2c')](_0xacc8d1[_0xb280('0x2d')]);_0x1e8a46[_0xb280('0x2e')]=_[_0xb280('0x2f')](_0x1e8a46[_0xb280('0x2b')],_0x1e8a46[_0xb280('0x2d')]);_0x50be78[_0xb280('0x30')]=_['intersection'](_0x1e8a46['model'],qs[_0xb280('0x31')](_0xacc8d1['query'][_0xb280('0x31')]));_0x50be78[_0xb280('0x30')]=_0x50be78[_0xb280('0x30')][_0xb280('0x32')]?_0x50be78['attributes']:_0x1e8a46['model'];if(!_0xacc8d1[_0xb280('0x2d')]['hasOwnProperty']('nolimit')){_0x50be78['limit']=qs['limit'](_0xacc8d1['query'][_0xb280('0x20')]);_0x50be78[_0xb280('0x1d')]=qs['offset'](_0xacc8d1['query'][_0xb280('0x1d')]);}_0x50be78[_0xb280('0x33')]=qs[_0xb280('0x34')](_0xacc8d1[_0xb280('0x2d')]['sort']);_0x50be78[_0xb280('0x35')]=qs[_0xb280('0x2e')](_[_0xb280('0x36')](_0xacc8d1[_0xb280('0x2d')],_0x1e8a46[_0xb280('0x2e')]),_0x366d64);if(_0xacc8d1['query'][_0xb280('0x37')]){_0x50be78[_0xb280('0x35')]=_[_0xb280('0x38')](_0x50be78[_0xb280('0x35')],{'$or':_['map'](_0x366d64,function(_0x11824a){if(_0x11824a[_0xb280('0x39')]!==_0xb280('0x3a')){var _0x51bd64={};_0x51bd64[_0x11824a[_0xb280('0x27')]]={'$like':'%'+_0xacc8d1[_0xb280('0x2d')][_0xb280('0x37')]+'%'};return _0x51bd64;}})});}_0x50be78=_['merge']({},_0x50be78,_0xacc8d1[_0xb280('0x3b')]);var _0x57453f={'where':_0x50be78[_0xb280('0x35')]};return db[_0xb280('0x29')][_0xb280('0x1f')](_0x57453f)[_0xb280('0x22')](function(_0x1784e0){_0x5596d1['count']=_0x1784e0;if(_0xacc8d1['query'][_0xb280('0x3c')]){_0x50be78[_0xb280('0x3d')]=[{'all':!![]}];}return db[_0xb280('0x29')][_0xb280('0x3e')](_0x50be78);})['then'](function(_0x589b3c){_0x5596d1[_0xb280('0x3f')]=_0x589b3c;return _0x5596d1;})[_0xb280('0x22')](respondWithFilteredResult(_0x46f7ab,_0x50be78))[_0xb280('0x1a')](handleError(_0x46f7ab,null));};exports[_0xb280('0x40')]=function(_0x1d4eba,_0x4a8820){var _0x13545d={'raw':!![],'where':{'id':_0x1d4eba[_0xb280('0x41')]['id']}},_0x2dd370={};_0x2dd370[_0xb280('0x2b')]=_[_0xb280('0x2c')](db[_0xb280('0x29')]['rawAttributes']);_0x2dd370[_0xb280('0x2d')]=_[_0xb280('0x2c')](_0x1d4eba['query']);_0x2dd370['filters']=_[_0xb280('0x2f')](_0x2dd370[_0xb280('0x2b')],_0x2dd370[_0xb280('0x2d')]);_0x13545d[_0xb280('0x30')]=_['intersection'](_0x2dd370[_0xb280('0x2b')],qs[_0xb280('0x31')](_0x1d4eba[_0xb280('0x2d')][_0xb280('0x31')]));_0x13545d[_0xb280('0x30')]=_0x13545d['attributes'][_0xb280('0x32')]?_0x13545d[_0xb280('0x30')]:_0x2dd370[_0xb280('0x2b')];if(_0x1d4eba[_0xb280('0x2d')][_0xb280('0x3c')]){_0x13545d[_0xb280('0x3d')]=[{'all':!![]}];}_0x13545d=_['merge']({},_0x13545d,_0x1d4eba['options']);return db[_0xb280('0x29')]['find'](_0x13545d)[_0xb280('0x22')](handleEntityNotFound(_0x4a8820,null))[_0xb280('0x22')](respondWithResult(_0x4a8820,null))[_0xb280('0x1a')](handleError(_0x4a8820,null));};exports[_0xb280('0x42')]=function(_0x2562e7,_0x312d2c){return db[_0xb280('0x29')]['create'](_0x2562e7[_0xb280('0x43')],{})[_0xb280('0x22')](respondWithResult(_0x312d2c,0xc9))[_0xb280('0x1a')](handleError(_0x312d2c,null));};exports[_0xb280('0x44')]=function(_0x2a6965,_0x235b46){if(_0x2a6965[_0xb280('0x43')]['id']){delete _0x2a6965[_0xb280('0x43')]['id'];}return db[_0xb280('0x29')]['find']({'where':{'id':_0x2a6965['params']['id']}})[_0xb280('0x22')](handleEntityNotFound(_0x235b46,null))[_0xb280('0x22')](saveUpdates(_0x2a6965['body'],null))['then'](respondWithResult(_0x235b46,null))['catch'](handleError(_0x235b46,null));};exports[_0xb280('0x23')]=function(_0x17de2a,_0x3408bd){return db['OpenchannelMessage'][_0xb280('0x45')]({'where':{'id':_0x17de2a[_0xb280('0x41')]['id']}})[_0xb280('0x22')](handleEntityNotFound(_0x3408bd,null))[_0xb280('0x22')](removeEntity(_0x3408bd,null))[_0xb280('0x1a')](handleError(_0x3408bd,null));};exports[_0xb280('0x46')]=function(_0x5288e2,_0x51f54c){return db[_0xb280('0x29')]['describe']()[_0xb280('0x22')](respondWithResult(_0x51f54c,null))[_0xb280('0x1a')](handleError(_0x51f54c,null));};exports[_0xb280('0x47')]=function(_0x1e1cae,_0x7a8211){var _0x2b8321='openchannel';return interactionService['acceptMessage'](_0x1e1cae,_0x2b8321)[_0xb280('0x22')](respondWithResult(_0x7a8211,null))[_0xb280('0x1a')](handleError(_0x7a8211,null));};exports[_0xb280('0x48')]=function(_0xb3bfab,_0x423287){var _0x5aae9e={'agent':{},'channel':'openchannel'};if(_0xb3bfab['body']['id']){delete _0xb3bfab[_0xb280('0x43')]['id'];}_0xb3bfab[_0xb280('0x43')][_0xb280('0x49')]=_0xb3bfab[_0xb280('0x43')][_0xb280('0x49')]||_0xb3bfab['user']['id'];_0x5aae9e[_0xb280('0x4a')]['id']=_0xb3bfab[_0xb280('0x43')][_0xb280('0x49')];return db['OpenchannelMessage'][_0xb280('0x45')]({'where':{'id':_0xb3bfab[_0xb280('0x41')]['id'],'UserId':null}})[_0xb280('0x22')](handleEntityNotFound(_0x423287,null))[_0xb280('0x22')](function(_0x351a06){if(_0x351a06){_0x5aae9e[_0xb280('0x18')]=_0x351a06['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x351a06[_0xb280('0x4b')]}});}return null;})[_0xb280('0x22')](handleEntityNotFound(_0x423287,null))[_0xb280('0x22')](function(_0x4a2950){if(_0x4a2950){_0x5aae9e[_0xb280('0x4c')]=_0x4a2950[_0xb280('0x4d')]({'plain':!![]});interaction_log[_0xb280('0x10')](_0xb280('0x4e'),_0xb3bfab[_0xb280('0x4f')]['id'],_0xb3bfab['user'][_0xb280('0x27')],_0xb3bfab[_0xb280('0x4f')][_0xb280('0x50')],_0x5aae9e[_0xb280('0x4c')]['id'],_0xb3bfab['body']?JSON[_0xb280('0x15')](_0xb3bfab[_0xb280('0x43')]):_0xb280('0x51'));return respondWithRpcPromise('RejectMessage',_0xb280('0x52'),_0x5aae9e);}return null;})['then'](function(_0x59c3a7){var _0xf2d949='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x59c3a7['message']['ContactId'];return db[_0xb280('0x53')][_0xb280('0x2d')](_0xf2d949,{'type':db[_0xb280('0x54')][_0xb280('0x55')][_0xb280('0x56')],'raw':!![]})['then'](function(_0xdb1b7d){return _0xdb1b7d;});})[_0xb280('0x22')](function(_0x470caa){if(_0x470caa){_0x5aae9e[_0xb280('0x18')][_0xb280('0x57')]=_0x470caa[0x0];if(!_0xb3bfab[_0xb280('0x43')]['UserId'])return;return db[_0xb280('0x58')][_0xb280('0x45')]({'where':{'id':_0xb3bfab[_0xb280('0x43')][_0xb280('0x49')],'role':_0xb280('0x4a')},'attributes':['id',_0xb280('0x27'),_0xb280('0x59'),_0xb280('0x5a'),_0xb280('0x5b')],'raw':!![]});}return null;})[_0xb280('0x22')](function(_0xac0f44){if(!_0xac0f44)return null;_0x5aae9e[_0xb280('0x18')]['agent']=_0xac0f44;return _0x5aae9e;})[_0xb280('0x22')](function(_0x135847){if(_0x135847){_0x135847['message'][_0xb280('0x5c')]=util[_0xb280('0x5d')](_0xb280('0x5e'),_0xb3bfab[_0xb280('0x4f')][_0xb280('0x27')]);_0x135847[_0xb280('0x18')][_0xb280('0x5f')]=_0x5aae9e[_0xb280('0x5f')];_0x135847[_0xb280('0x18')][_0xb280('0x60')]=_0x5aae9e[_0xb280('0x5f')];_0x135847[_0xb280('0x18')]['event']=_0xb280('0x48');respondWithRpcPromise('EventManager',_0xb280('0x61'),{'event':_0xb280('0x62'),'message':_0x135847[_0xb280('0x18')]},client9002);return _0x5aae9e;}return null;})[_0xb280('0x22')](respondWithResult(_0x423287,null))[_0xb280('0x1a')](handleError(_0x423287,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 8b029cc..33d9a25 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 _0xbf4a=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x56674a,_0x19b40a){var _0x364f52=function(_0x30f9b7){while(--_0x30f9b7){_0x56674a['push'](_0x56674a['shift']());}};_0x364f52(++_0x19b40a);}(_0xbf4a,0x125));var _0xabf4=function(_0x122da1,_0x158e84){_0x122da1=_0x122da1-0x0;var _0x273065=_0xbf4a[_0x122da1];return _0x273065;};'use strict';var EventEmitter=require(_0xabf4('0x0'));var OpenchannelMessage=require(_0xabf4('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xabf4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xabf4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x18c603){return function(_0x5f764d,_0x1eb223,_0x3360c2){OpenchannelMessageEvents[_0xabf4('0x4')](_0x18c603+':'+_0x5f764d['id'],_0x5f764d);OpenchannelMessageEvents['emit'](_0x18c603,_0x5f764d);_0x3360c2(null);};}for(var e in events){if(events[_0xabf4('0x5')](e)){var event=events[e];OpenchannelMessage[_0xabf4('0x6')](e,emitEvent(event));}}module[_0xabf4('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xcedf=['emit','hasOwnProperty','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x179f01,_0x114a9c){var _0x4aff4e=function(_0x4febae){while(--_0x4febae){_0x179f01['push'](_0x179f01['shift']());}};_0x4aff4e(++_0x114a9c);}(_0xcedf,0x1ea));var _0xfced=function(_0x15b1eb,_0x360761){_0x15b1eb=_0x15b1eb-0x0;var _0x434c57=_0xcedf[_0x15b1eb];return _0x434c57;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xfced('0x0'))['db'][_0xfced('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfced('0x2')](0x0);var events={'afterCreate':_0xfced('0x3'),'afterUpdate':_0xfced('0x4'),'afterDestroy':_0xfced('0x5')};function emitEvent(_0x4f0969){return function(_0x50c98d,_0x261145,_0x5e0d43){OpenchannelMessageEvents['emit'](_0x4f0969+':'+_0x50c98d['id'],_0x50c98d);OpenchannelMessageEvents[_0xfced('0x6')](_0x4f0969,_0x50c98d);_0x5e0d43(null);};}for(var e in events){if(events[_0xfced('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5eab69e..37b2b40 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 _0x5e8a=['isNil','UserId','OpenchannelInteraction','then','update','createdAt','CmContact','describe','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret'];(function(_0x48df17,_0x1f5087){var _0x207d77=function(_0x57ebd4){while(--_0x57ebd4){_0x48df17['push'](_0x48df17['shift']());}};_0x207d77(++_0x1f5087);}(_0x5e8a,0xb8));var _0xa5e8=function(_0x34eaf7,_0x1ff68a){_0x34eaf7=_0x34eaf7-0x0;var _0xb4694e=_0x5e8a[_0x34eaf7];return _0xb4694e;};'use strict';var _=require(_0xa5e8('0x0'));var util=require(_0xa5e8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa5e8('0x2'));var BPromise=require(_0xa5e8('0x3'));var rp=require(_0xa5e8('0x4'));var fs=require('fs');var path=require(_0xa5e8('0x5'));var rimraf=require(_0xa5e8('0x6'));var config=require(_0xa5e8('0x7'));var attributes=require(_0xa5e8('0x8'));module[_0xa5e8('0x9')]=function(_0x2e209a,_0x22f509){return _0x2e209a[_0xa5e8('0xa')](_0xa5e8('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xa5e8('0xc'),'fields':[_0xa5e8('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a9b95,_0x1d4662,_0x348c3e){var _0x56744d=_0x2e209a[_0xa5e8('0xe')];var _0x54036f=_0x3a9b95[_0xa5e8('0xf')]({'plain':!![]});if(_0x54036f[_0xa5e8('0x10')][_0xa5e8('0x11')]()==='in'||_0x54036f[_0xa5e8('0x10')]['toLowerCase']()===_0xa5e8('0x12')&&!_0x54036f[_0xa5e8('0x13')]&&!_[_0xa5e8('0x14')](_0x54036f[_0xa5e8('0x15')])){_0x56744d[_0xa5e8('0x16')]['findOne']({'where':{'id':_0x54036f['OpenchannelInteractionId']}})[_0xa5e8('0x17')](function(_0xcfb587){if(_0xcfb587){_0xcfb587[_0xa5e8('0x18')]({'lastMsgAt':_0x54036f[_0xa5e8('0x19')],'lastMsgDirection':_0x54036f['direction']['toLowerCase']()});}})['catch'](function(_0x18ad72){console['error'](_0x18ad72);});}if(_0x54036f[_0xa5e8('0x10')]==='out'&&!_0x54036f['secret']){var _0x139fe5;_0x56744d[_0xa5e8('0x1a')][_0xa5e8('0x1b')]()[_0xa5e8('0x17')](function(_0x1d1948){return _0x56744d[_0xa5e8('0x1c')][_0xa5e8('0x1d')]({'where':{'id':_0x54036f['OpenchannelAccountId']},'include':[{'model':_0x56744d[_0xa5e8('0x16')],'as':_0xa5e8('0x1e'),'where':{'id':_0x54036f[_0xa5e8('0x1f')]},'limit':0x1,'include':[{'model':_0x56744d[_0xa5e8('0x1a')],'as':_0xa5e8('0x20'),'attributes':_[_0xa5e8('0x21')](_0x1d1948)}]}]});})[_0xa5e8('0x17')](function(_0x24938a){_0x139fe5=_0x24938a[_0xa5e8('0xf')]({'plain':!![]});if(_0x139fe5&&_0x139fe5[_0xa5e8('0x22')]){logger[_0xa5e8('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xa5e8('0x24'),util[_0xa5e8('0x25')](_0xa5e8('0x26'),_0x54036f['id'],_0x139fe5[_0xa5e8('0x22')]));if(_0x139fe5[_0xa5e8('0x1e')]&&_0x139fe5[_0xa5e8('0x1e')][_0xa5e8('0x27')]){_0x54036f['Interaction']=_[_0xa5e8('0x28')](_0x139fe5[_0xa5e8('0x1e')][0x0],_0xa5e8('0x20'));_0x54036f[_0xa5e8('0x20')]=_0x139fe5[_0xa5e8('0x1e')][0x0][_0xa5e8('0x20')];}var _0x1d4662={'method':_0xa5e8('0x29'),'uri':encodeURI(_0x139fe5[_0xa5e8('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1d4662['method']){case _0xa5e8('0x2a'):_0x1d4662['qs']=_0x54036f;break;case _0xa5e8('0x29'):_0x1d4662['body']=_0x54036f;break;}return rp(_0x1d4662)[_0xa5e8('0x17')](function(_0x4ef0dd){logger['info'](_0xa5e8('0x2b'),_0xa5e8('0x24'),util['format'](_0xa5e8('0x2c'),_0x54036f['id'],_0x139fe5[_0xa5e8('0x22')]));if(_0x4ef0dd[_0xa5e8('0xd')][_0xa5e8('0x2d')]&&_0x4ef0dd['body']['threadId']!=_0x54036f[_0xa5e8('0x2e')][_0xa5e8('0x2d')]){return _0x56744d[_0xa5e8('0x16')]['update']({'threadId':_0x4ef0dd['body'][_0xa5e8('0x2d')]},{'where':{'id':_0x54036f[_0xa5e8('0x2e')]['id']}});}else{return;}})[_0xa5e8('0x17')](function(){return _0x3a9b95[_0xa5e8('0x18')]({'read':!![]});})[_0xa5e8('0x2f')](function(_0x472689){logger['error'](_0xa5e8('0x2b'),'afterCreate',util['inspect'](_0x472689,{'showHidden':![],'depth':null}));_0x348c3e();});}else{_0x348c3e();}})[_0xa5e8('0x30')](function(){_0x348c3e();});}else{_0x348c3e();}}},'charset':_0xa5e8('0x31'),'collate':_0xa5e8('0x32')});}; \ No newline at end of file +var _0x9da1=['request-promise','path','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','createdAt','catch','error','describe','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','then','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird'];(function(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0x9da1,0x8d));var _0x19da=function(_0x5bc202,_0x314535){_0x5bc202=_0x5bc202-0x0;var _0x253744=_0x9da1[_0x5bc202];return _0x253744;};'use strict';var _=require(_0x19da('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x19da('0x1'));var moment=require('moment');var BPromise=require(_0x19da('0x2'));var rp=require(_0x19da('0x3'));var fs=require('fs');var path=require(_0x19da('0x4'));var rimraf=require(_0x19da('0x5'));var config=require('../../config/environment');var attributes=require(_0x19da('0x6'));module[_0x19da('0x7')]=function(_0x2a2f56,_0x2b974f){return _0x2a2f56['define'](_0x19da('0x8'),attributes,{'tableName':_0x19da('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x19da('0xa')],'type':_0x19da('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c4dff,_0x2c3c66,_0x595b03){var _0x15194e=_0x2a2f56[_0x19da('0xc')];var _0x2e182b=_0x1c4dff[_0x19da('0xd')]({'plain':!![]});if(_0x2e182b[_0x19da('0xe')][_0x19da('0xf')]()==='in'||_0x2e182b[_0x19da('0xe')][_0x19da('0xf')]()===_0x19da('0x10')&&!_0x2e182b[_0x19da('0x11')]&&!_[_0x19da('0x12')](_0x2e182b[_0x19da('0x13')])){_0x15194e['OpenchannelInteraction'][_0x19da('0x14')]({'where':{'id':_0x2e182b[_0x19da('0x15')]}})['then'](function(_0x35899a){if(_0x35899a){_0x35899a['update']({'lastMsgAt':_0x2e182b[_0x19da('0x16')],'lastMsgDirection':_0x2e182b[_0x19da('0xe')][_0x19da('0xf')]()});}})[_0x19da('0x17')](function(_0x13a3d0){console[_0x19da('0x18')](_0x13a3d0);});}if(_0x2e182b['direction']==='out'&&!_0x2e182b[_0x19da('0x11')]){var _0x4125d4;_0x15194e['CmContact'][_0x19da('0x19')]()['then'](function(_0x43db3c){return _0x15194e[_0x19da('0x1a')]['find']({'where':{'id':_0x2e182b[_0x19da('0x1b')]},'include':[{'model':_0x15194e[_0x19da('0x1c')],'as':_0x19da('0x1d'),'where':{'id':_0x2e182b[_0x19da('0x15')]},'limit':0x1,'include':[{'model':_0x15194e['CmContact'],'as':_0x19da('0x1e'),'attributes':_[_0x19da('0x1f')](_0x43db3c)}]}]});})['then'](function(_0x3c107b){_0x4125d4=_0x3c107b[_0x19da('0xd')]({'plain':!![]});if(_0x4125d4&&_0x4125d4[_0x19da('0x20')]){logger[_0x19da('0x21')](_0x19da('0x22'),_0x19da('0x23'),util[_0x19da('0x24')](_0x19da('0x25'),_0x2e182b['id'],_0x4125d4[_0x19da('0x20')]));if(_0x4125d4[_0x19da('0x1d')]&&_0x4125d4[_0x19da('0x1d')][_0x19da('0x26')]){_0x2e182b[_0x19da('0x27')]=_[_0x19da('0x28')](_0x4125d4['Interactions'][0x0],_0x19da('0x1e'));_0x2e182b['Contact']=_0x4125d4[_0x19da('0x1d')][0x0][_0x19da('0x1e')];}var _0x2c3c66={'method':_0x19da('0x29'),'uri':encodeURI(_0x4125d4[_0x19da('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2c3c66[_0x19da('0x2a')]){case'GET':_0x2c3c66['qs']=_0x2e182b;break;case _0x19da('0x29'):_0x2c3c66[_0x19da('0xa')]=_0x2e182b;break;}return rp(_0x2c3c66)[_0x19da('0x2b')](function(_0x3920a5){logger[_0x19da('0x21')](_0x19da('0x22'),_0x19da('0x23'),util[_0x19da('0x24')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2e182b['id'],_0x4125d4[_0x19da('0x20')]));if(_0x3920a5[_0x19da('0xa')][_0x19da('0x2c')]&&_0x3920a5['body']['threadId']!=_0x2e182b[_0x19da('0x27')][_0x19da('0x2c')]){return _0x15194e[_0x19da('0x1c')]['update']({'threadId':_0x3920a5[_0x19da('0xa')]['threadId']},{'where':{'id':_0x2e182b[_0x19da('0x27')]['id']}});}else{return;}})[_0x19da('0x2b')](function(){return _0x1c4dff['update']({'read':!![]});})[_0x19da('0x17')](function(_0x40f5f3){logger['error'](_0x19da('0x22'),_0x19da('0x23'),util[_0x19da('0x2d')](_0x40f5f3,{'showHidden':![],'depth':null}));_0x595b03();});}else{_0x595b03();}})['finally'](function(){_0x595b03();});}else{_0x595b03();}}},'charset':_0x19da('0x2e'),'collate':_0x19da('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 2aac989..6981995 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 _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(_0x26ce19,_0x56cb79){var _0x3b923e=function(_0x54b832){while(--_0x54b832){_0x26ce19['push'](_0x26ce19['shift']());}};_0x3b923e(++_0x56cb79);}(_0xdb28,0x106));var _0x8db2=function(_0x3a19a2,_0x572699){_0x3a19a2=_0x3a19a2-0x0;var _0x433fec=_0xdb28[_0x3a19a2];return _0x433fec;};'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 +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(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0xdb28,0x106));var _0x8db2=function(_0x317f96,_0x24dcb9){_0x317f96=_0x317f96-0x0;var _0x514ff2=_0xdb28[_0x317f96];return _0x514ff2;};'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 d5d4ffd..b482b1f 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 _0x477f=['register','openchannelMessage:','remove','update','emit','removeListener'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x477f,0x1dc));var _0xf477=function(_0x205135,_0x262f65){_0x205135=_0x205135-0x0;var _0x33090f=_0x477f[_0x205135];return _0x33090f;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0xf477('0x0'),_0xf477('0x1')];function createListener(_0x301f39,_0xed4ce9){return function(_0x32606e){_0xed4ce9[_0xf477('0x2')](_0x301f39,_0x32606e);};}function removeListener(_0x209f1b,_0x456382){return function(){OpenchannelMessageEvents[_0xf477('0x3')](_0x209f1b,_0x456382);};}exports[_0xf477('0x4')]=function(_0x124edc){for(var _0x4abc54=0x0,_0x345e47=events['length'];_0x4abc54<_0x345e47;_0x4abc54++){var _0x4d51ec=events[_0x4abc54];var _0x3948e0=createListener(_0xf477('0x5')+_0x4d51ec,_0x124edc);OpenchannelMessageEvents['on'](_0x4d51ec,_0x3948e0);}}; \ No newline at end of file +var _0x74f7=['update','removeListener','register','openchannelMessage:','remove'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x74f7,0xbd));var _0x774f=function(_0x7dc296,_0x17af36){_0x7dc296=_0x7dc296-0x0;var _0x3ca2c1=_0x74f7[_0x7dc296];return _0x3ca2c1;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x774f('0x0'),_0x774f('0x1')];function createListener(_0x295ed7,_0x4d6c25){return function(_0x4e0a3b){_0x4d6c25['emit'](_0x295ed7,_0x4e0a3b);};}function removeListener(_0x3e996f,_0x232bc1){return function(){OpenchannelMessageEvents[_0x774f('0x2')](_0x3e996f,_0x232bc1);};}exports[_0x774f('0x3')]=function(_0x30b7b7){for(var _0x2e4526=0x0,_0xd9d8cf=events['length'];_0x2e4526<_0xd9d8cf;_0x2e4526++){var _0x323aa6=events[_0x2e4526];var _0x10fe91=createListener(_0x774f('0x4')+_0x323aa6,_0x30b7b7);OpenchannelMessageEvents['on'](_0x323aa6,_0x10fe91);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 0c2bc24..94ae537 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 _0x9955=['destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','delete'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9955,0x72));var _0x5995=function(_0x31261f,_0x33b7c1){_0x31261f=_0x31261f-0x0;var _0x1fd785=_0x9955[_0x31261f];return _0x1fd785;};'use strict';var multer=require(_0x5995('0x0'));var util=require(_0x5995('0x1'));var path=require(_0x5995('0x2'));var timeout=require(_0x5995('0x3'));var express=require(_0x5995('0x4'));var router=express[_0x5995('0x5')]();var fs_extra=require(_0x5995('0x6'));var auth=require(_0x5995('0x7'));var interaction=require(_0x5995('0x8'));var config=require(_0x5995('0x9'));var controller=require(_0x5995('0xa'));router['get']('/',auth[_0x5995('0xb')](),controller[_0x5995('0xc')]);router[_0x5995('0xd')]('/describe',auth['isAuthenticated'](),controller[_0x5995('0xe')]);router[_0x5995('0xd')](_0x5995('0xf'),auth[_0x5995('0xb')](),controller['show']);router['get'](_0x5995('0x10'),auth[_0x5995('0xb')](),controller[_0x5995('0x11')]);router[_0x5995('0xd')](_0x5995('0x12'),auth[_0x5995('0xb')](),controller['getTeams']);router[_0x5995('0xd')](_0x5995('0x13'),auth['isAuthenticated'](),controller[_0x5995('0x14')]);router[_0x5995('0x15')]('/',auth[_0x5995('0xb')](),controller[_0x5995('0x16')]);router[_0x5995('0x15')](_0x5995('0x12'),auth['isAuthenticated'](),controller[_0x5995('0x17')]);router[_0x5995('0x15')](_0x5995('0x13'),auth[_0x5995('0xb')](),controller['addAgents']);router[_0x5995('0x18')]('/:id',auth[_0x5995('0xb')](),controller['update']);router[_0x5995('0x19')](_0x5995('0xf'),auth[_0x5995('0xb')](),controller[_0x5995('0x1a')]);router[_0x5995('0x19')]('/:id/teams',auth[_0x5995('0xb')](),controller[_0x5995('0x1b')]);router[_0x5995('0x19')](_0x5995('0x13'),auth[_0x5995('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xa566=['/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers'];(function(_0x28c89b,_0x2510b3){var _0x176500=function(_0x3dfee2){while(--_0x3dfee2){_0x28c89b['push'](_0x28c89b['shift']());}};_0x176500(++_0x2510b3);}(_0xa566,0x9f));var _0x6a56=function(_0x43c1f3,_0xefe627){_0x43c1f3=_0x43c1f3-0x0;var _0x157f0c=_0xa566[_0x43c1f3];return _0x157f0c;};'use strict';var multer=require('multer');var util=require(_0x6a56('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a56('0x1')]();var fs_extra=require(_0x6a56('0x2'));var auth=require(_0x6a56('0x3'));var interaction=require(_0x6a56('0x4'));var config=require(_0x6a56('0x5'));var controller=require(_0x6a56('0x6'));router[_0x6a56('0x7')]('/',auth[_0x6a56('0x8')](),controller[_0x6a56('0x9')]);router[_0x6a56('0x7')](_0x6a56('0xa'),auth[_0x6a56('0x8')](),controller[_0x6a56('0xb')]);router[_0x6a56('0x7')]('/:id',auth[_0x6a56('0x8')](),controller[_0x6a56('0xc')]);router['get'](_0x6a56('0xd'),auth[_0x6a56('0x8')](),controller[_0x6a56('0xe')]);router[_0x6a56('0x7')](_0x6a56('0xf'),auth[_0x6a56('0x8')](),controller[_0x6a56('0x10')]);router[_0x6a56('0x7')](_0x6a56('0x11'),auth[_0x6a56('0x8')](),controller['getAgents']);router[_0x6a56('0x12')]('/',auth[_0x6a56('0x8')](),controller[_0x6a56('0x13')]);router[_0x6a56('0x12')](_0x6a56('0xf'),auth[_0x6a56('0x8')](),controller[_0x6a56('0x14')]);router[_0x6a56('0x12')](_0x6a56('0x11'),auth['isAuthenticated'](),controller[_0x6a56('0x15')]);router[_0x6a56('0x16')](_0x6a56('0x17'),auth[_0x6a56('0x8')](),controller[_0x6a56('0x18')]);router[_0x6a56('0x19')](_0x6a56('0x17'),auth[_0x6a56('0x8')](),controller[_0x6a56('0x1a')]);router[_0x6a56('0x19')](_0x6a56('0xf'),auth[_0x6a56('0x8')](),controller[_0x6a56('0x1b')]);router[_0x6a56('0x19')](_0x6a56('0x11'),auth['isAuthenticated'](),controller[_0x6a56('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a13ccdc..4389a62 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 _0xa78e=['STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x22e34e,_0x598a1d){var _0x411e59=function(_0x63f722){while(--_0x63f722){_0x22e34e['push'](_0x22e34e['shift']());}};_0x411e59(++_0x598a1d);}(_0xa78e,0xa5));var _0xea78=function(_0x1a888d,_0x2a0331){_0x1a888d=_0x1a888d-0x0;var _0x2b445c=_0xa78e[_0x1a888d];return _0x2b445c;};'use strict';var Sequelize=require(_0xea78('0x0'));module[_0xea78('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea78('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea78('0x3')]},'timeout':{'type':Sequelize[_0xea78('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xea78('0x5'),_0xea78('0x6'),_0xea78('0x7'))}}; \ No newline at end of file +var _0x7e4d=['sequelize','exports','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0xb50370,_0x3fe5d0){var _0x34040e=function(_0x5ba355){while(--_0x5ba355){_0xb50370['push'](_0xb50370['shift']());}};_0x34040e(++_0x3fe5d0);}(_0x7e4d,0x173));var _0xd7e4=function(_0x30f89e,_0x439e3d){_0x30f89e=_0x30f89e-0x0;var _0x17b7ef=_0x7e4d[_0x30f89e];return _0x17b7ef;};'use strict';var Sequelize=require(_0xd7e4('0x0'));module[_0xd7e4('0x1')]={'name':{'type':Sequelize[_0xd7e4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd7e4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd7e4('0x4'),_0xd7e4('0x5'),_0xd7e4('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 05ffe71..1ba4a62 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 _0xd3ed=['isArray','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','status','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','include','query','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','sort','where','pick','OpenchannelQueueId','filter','findAll','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','order','getTeams','hasOwnProperty','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save'];(function(_0x5f36fe,_0x2ddbd2){var _0x327468=function(_0xc061b6){while(--_0xc061b6){_0x5f36fe['push'](_0x5f36fe['shift']());}};_0x327468(++_0x2ddbd2);}(_0xd3ed,0xfd));var _0xdd3e=function(_0x12b8a2,_0x1feb50){_0x12b8a2=_0x12b8a2-0x0;var _0x31ffb2=_0xd3ed[_0x12b8a2];return _0x31ffb2;};'use strict';var BPromise=require(_0xdd3e('0x0'));var util=require(_0xdd3e('0x1'));var _=require(_0xdd3e('0x2'));var squel=require(_0xdd3e('0x3'));var Redis=require(_0xdd3e('0x4'));var qs=require(_0xdd3e('0x5'));var logger=require(_0xdd3e('0x6'))(_0xdd3e('0x7'));var config=require(_0xdd3e('0x8'));var db=require(_0xdd3e('0x9'))['db'];config['redis']=_[_0xdd3e('0xa')](config[_0xdd3e('0xb')],{'host':_0xdd3e('0xc'),'port':0x18eb});var socket=require(_0xdd3e('0xd'))(new Redis(config[_0xdd3e('0xb')]));require(_0xdd3e('0xe'))['register'](socket);function respondWithStatusCode(_0x4f7299,_0xdf5301){_0xdf5301=_0xdf5301||0xcc;return function(_0x5350fe){if(_0x5350fe){return _0x4f7299['sendStatus'](_0xdf5301);}return _0x4f7299['status'](_0xdf5301)[_0xdd3e('0xf')]();};}function respondWithResult(_0xd9dcab,_0x56efe0){_0x56efe0=_0x56efe0||0xc8;return function(_0x4d8ec3){if(_0x4d8ec3){return _0xd9dcab['status'](_0x56efe0)[_0xdd3e('0x10')](_0x4d8ec3);}};}function respondWithFilteredResult(_0x2fca1c,_0x45ec27){return function(_0x424ff0){if(_0x424ff0){var _0x186de2=typeof _0x45ec27[_0xdd3e('0x11')]===_0xdd3e('0x12')&&typeof _0x45ec27[_0xdd3e('0x13')]===_0xdd3e('0x12');var _0x39e2ff=_0x424ff0[_0xdd3e('0x14')];var _0x43f422=_0x186de2?0x0:_0x45ec27[_0xdd3e('0x11')];var _0x44a706=_0x186de2?_0x424ff0[_0xdd3e('0x14')]:_0x45ec27[_0xdd3e('0x11')]+_0x45ec27[_0xdd3e('0x13')];var _0x250180;if(_0x44a706>=_0x39e2ff){_0x44a706=_0x39e2ff;_0x250180=0xc8;}else{_0x250180=0xce;}_0x2fca1c['status'](_0x250180);return _0x2fca1c[_0xdd3e('0x15')](_0xdd3e('0x16'),_0x43f422+'-'+_0x44a706+'/'+_0x39e2ff)[_0xdd3e('0x10')](_0x424ff0);}return null;};}function saveUpdates(_0x15417f){return function(_0x27debc){if(_0x27debc){return _0x27debc[_0xdd3e('0x17')](_0x15417f)[_0xdd3e('0x18')](function(_0xca42ac){return _0xca42ac;});}return null;};}function removeEntity(_0x67ce5a){return function(_0x1448fd){if(_0x1448fd){return _0x1448fd[_0xdd3e('0x19')]()[_0xdd3e('0x18')](function(){var _0x3dc59f=_0x1448fd[_0xdd3e('0x1a')]({'plain':!![]});var _0x32195b='OpenchannelQueues';return db[_0xdd3e('0x1b')][_0xdd3e('0x19')]({'where':{'type':_0x32195b,'resourceId':_0x3dc59f['id']}})[_0xdd3e('0x18')](function(){return _0x1448fd;});})[_0xdd3e('0x18')](function(){_0x67ce5a[_0xdd3e('0x1c')](0xcc)[_0xdd3e('0xf')]();});}};}function handleEntityNotFound(_0x493fbd){return function(_0x13f7dd){if(!_0x13f7dd){_0x493fbd[_0xdd3e('0x1d')](0x194);}return _0x13f7dd;};}function handleError(_0x5b9286,_0x86e8d3){_0x86e8d3=_0x86e8d3||0x1f4;return function(_0x3eb17c){logger[_0xdd3e('0x1e')](_0x3eb17c[_0xdd3e('0x1f')]);if(_0x3eb17c[_0xdd3e('0x20')]){delete _0x3eb17c[_0xdd3e('0x20')];}_0x5b9286[_0xdd3e('0x1c')](_0x86e8d3)[_0xdd3e('0x21')](_0x3eb17c);};}exports[_0xdd3e('0x22')]=function(_0x3a9f42,_0x4844f9){var _0xb91f7d={};var _0x3ffbc3={'count':0x0,'rows':[]};var _0x4efa58=_[_0xdd3e('0x23')](db[_0xdd3e('0x24')][_0xdd3e('0x25')],function(_0x575299){return{'name':_0x575299[_0xdd3e('0x26')],'type':_0x575299[_0xdd3e('0x27')]['key']};});_0xb91f7d=qs[_0xdd3e('0x28')](_0x4efa58,_0x3a9f42);var _0x130365={'where':_0xb91f7d['where']};return db[_0xdd3e('0x24')][_0xdd3e('0x14')](_0x130365)['then'](function(_0xa3beec){_0x3ffbc3[_0xdd3e('0x14')]=_0xa3beec;_0xb91f7d[_0xdd3e('0x29')]=qs[_0xdd3e('0x29')](_0x3a9f42[_0xdd3e('0x2a')]);return db[_0xdd3e('0x24')]['findAll'](_0xb91f7d);})[_0xdd3e('0x18')](function(_0x102e5a){_0x3ffbc3['rows']=_0x102e5a;return _0x3ffbc3;})[_0xdd3e('0x18')](respondWithFilteredResult(_0x4844f9,_0xb91f7d))[_0xdd3e('0x2b')](handleError(_0x4844f9,null));};exports['show']=function(_0x2b5c2c,_0x242529){var _0x8374fb={'raw':!![],'where':{'id':_0x2b5c2c[_0xdd3e('0x2c')]['id']}},_0x28bcaf={};_0x28bcaf[_0xdd3e('0x2d')]=_[_0xdd3e('0x2e')](db['OpenchannelQueue'][_0xdd3e('0x25')]);_0x28bcaf[_0xdd3e('0x2a')]=_[_0xdd3e('0x2e')](_0x2b5c2c[_0xdd3e('0x2a')]);_0x28bcaf[_0xdd3e('0x2f')]=_[_0xdd3e('0x30')](_0x28bcaf[_0xdd3e('0x2d')],_0x28bcaf['query']);_0x8374fb[_0xdd3e('0x31')]=_[_0xdd3e('0x30')](_0x28bcaf['model'],qs[_0xdd3e('0x32')](_0x2b5c2c[_0xdd3e('0x2a')][_0xdd3e('0x32')]));_0x8374fb[_0xdd3e('0x31')]=_0x8374fb['attributes'][_0xdd3e('0x33')]?_0x8374fb[_0xdd3e('0x31')]:_0x28bcaf[_0xdd3e('0x2d')];if(_0x2b5c2c[_0xdd3e('0x2a')][_0xdd3e('0x34')]){_0x8374fb[_0xdd3e('0x29')]=[{'all':!![]}];}_0x8374fb=_[_0xdd3e('0x35')]({},_0x8374fb,_0x2b5c2c[_0xdd3e('0x36')]);return db[_0xdd3e('0x24')]['find'](_0x8374fb)['then'](handleEntityNotFound(_0x242529,null))['then'](respondWithResult(_0x242529,null))[_0xdd3e('0x2b')](handleError(_0x242529,null));};exports[_0xdd3e('0x37')]=function(_0x1c1acc,_0x5225db){return db['OpenchannelQueue'][_0xdd3e('0x37')](_0x1c1acc['body'],{})[_0xdd3e('0x18')](function(_0x5492eb){var _0x13c811=_0x1c1acc[_0xdd3e('0x38')][_0xdd3e('0x1a')]({'plain':!![]});if(!_0x13c811)throw new Error(_0xdd3e('0x39'));if(_0x13c811[_0xdd3e('0x3a')]===_0xdd3e('0x38')){var _0x14f413=_0x5492eb['get']({'plain':!![]});var _0x1f1ae1=_0xdd3e('0x3b');return db[_0xdd3e('0x3c')][_0xdd3e('0x3d')]({'where':{'name':_0x1f1ae1,'userProfileId':_0x13c811[_0xdd3e('0x3e')]},'raw':!![]})['then'](function(_0x144d91){if(_0x144d91&&_0x144d91[_0xdd3e('0x3f')]===0x0){return db[_0xdd3e('0x1b')][_0xdd3e('0x37')]({'name':_0x14f413['name'],'resourceId':_0x14f413['id'],'type':_0x144d91['name'],'sectionId':_0x144d91['id']},{})[_0xdd3e('0x18')](function(){return _0x5492eb;});}else{return _0x5492eb;}})[_0xdd3e('0x2b')](function(_0x34a4df){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34a4df);throw _0x34a4df;});}return _0x5492eb;})[_0xdd3e('0x18')](respondWithResult(_0x5225db,0xc9))[_0xdd3e('0x2b')](handleError(_0x5225db,null));};exports[_0xdd3e('0x17')]=function(_0x11ab77,_0x5a3f2e){if(_0x11ab77[_0xdd3e('0x40')]['id']){delete _0x11ab77[_0xdd3e('0x40')]['id'];}return db[_0xdd3e('0x24')][_0xdd3e('0x3d')]({'where':{'id':_0x11ab77[_0xdd3e('0x2c')]['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x5a3f2e,null))[_0xdd3e('0x18')](saveUpdates(_0x11ab77[_0xdd3e('0x40')],null))['then'](respondWithResult(_0x5a3f2e,null))[_0xdd3e('0x2b')](handleError(_0x5a3f2e,null));};exports['destroy']=function(_0x3076bd,_0x41802e){return db[_0xdd3e('0x24')]['find']({'where':{'id':_0x3076bd['params']['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x41802e,null))[_0xdd3e('0x18')](removeEntity(_0x41802e,null))['catch'](handleError(_0x41802e,null));};exports['describe']=function(_0x3e1d99,_0x58a395){return db[_0xdd3e('0x24')][_0xdd3e('0x41')]()[_0xdd3e('0x18')](respondWithResult(_0x58a395,null))['catch'](handleError(_0x58a395,null));};exports[_0xdd3e('0x42')]=function(_0xfde8a6,_0x2642be){var _0x4c8243={'raw':!![],'where':{}},_0x1b097c={},_0x35694f;return db[_0xdd3e('0x24')][_0xdd3e('0x43')]({'where':{'id':_0xfde8a6['params']['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x2642be,null))[_0xdd3e('0x18')](function(_0x33f0c0){if(_0x33f0c0){_0x35694f=_0x33f0c0[_0xdd3e('0x1a')]({'plain':!![]});_0x1b097c[_0xdd3e('0x2d')]=_[_0xdd3e('0x2e')](db[_0xdd3e('0x44')][_0xdd3e('0x25')]);_0x1b097c[_0xdd3e('0x2a')]=_[_0xdd3e('0x2e')](_0xfde8a6['query']);_0x1b097c[_0xdd3e('0x2f')]=_[_0xdd3e('0x30')](_0x1b097c['model'],_0x1b097c[_0xdd3e('0x2a')]);_0x4c8243['attributes']=_[_0xdd3e('0x30')](_0x1b097c[_0xdd3e('0x2d')],qs[_0xdd3e('0x32')](_0xfde8a6[_0xdd3e('0x2a')]['fields']));_0x4c8243[_0xdd3e('0x31')]=_0x4c8243[_0xdd3e('0x31')][_0xdd3e('0x33')]?_0x4c8243[_0xdd3e('0x31')]:_0x1b097c['model'];if(!_0xfde8a6['query']['hasOwnProperty'](_0xdd3e('0x45'))){_0x4c8243[_0xdd3e('0x13')]=qs[_0xdd3e('0x13')](_0xfde8a6['query'][_0xdd3e('0x13')]);_0x4c8243[_0xdd3e('0x11')]=qs[_0xdd3e('0x11')](_0xfde8a6['query'][_0xdd3e('0x11')]);}_0x4c8243['order']=qs['sort'](_0xfde8a6['query'][_0xdd3e('0x46')]);_0x4c8243[_0xdd3e('0x47')]=qs['filters'](_[_0xdd3e('0x48')](_0xfde8a6[_0xdd3e('0x2a')],_0x1b097c[_0xdd3e('0x2f')]));_0x4c8243[_0xdd3e('0x47')][_0xdd3e('0x49')]=_0x33f0c0['id'];if(_0xfde8a6['query'][_0xdd3e('0x4a')]){_0x4c8243[_0xdd3e('0x47')]=_[_0xdd3e('0x35')](_0x4c8243['where'],{'$or':_[_0xdd3e('0x23')](_0x4c8243[_0xdd3e('0x31')],function(_0x3dd7e4){var _0x4cdd39={};_0x4cdd39[_0x3dd7e4]={'$like':'%'+_0xfde8a6['query']['filter']+'%'};return _0x4cdd39;})});}_0x4c8243=_[_0xdd3e('0x35')]({},_0x4c8243,_0xfde8a6[_0xdd3e('0x36')]);return db['UserOpenchannelQueue'][_0xdd3e('0x4b')](_0x4c8243);}})[_0xdd3e('0x18')](function(_0x3a6d2f){if(_0x3a6d2f){return db['User'][_0xdd3e('0x4c')]({'where':{'id':_['map'](_0x3a6d2f,'UserId'),'role':_0xdd3e('0x4d')},'attributes':['id',_0xdd3e('0x20'),_0xdd3e('0x4e'),_0xdd3e('0x4f'),_0xdd3e('0x50')]});}})[_0xdd3e('0x18')](function(_0x21ee3c){if(_0x21ee3c){return{'count':_0x21ee3c[_0xdd3e('0x14')],'rows':_[_0xdd3e('0x23')](_0x21ee3c[_0xdd3e('0x51')],function(_0x4e4624){return{'membername':_0x4e4624['name'],'UserId':_0x4e4624['id'],'queue_name':_0x35694f[_0xdd3e('0x20')],'OpenchannelQueueId':_0x35694f['id'],'interface':util[_0xdd3e('0x52')](_0xdd3e('0x53'),_0xdd3e('0x54'),_0x4e4624[_0xdd3e('0x20')]),'penalty':0x0,'paused':_0x4e4624[_0xdd3e('0x4e')],'createdAt':_0x4e4624[_0xdd3e('0x50')],'updatedAt':_0x4e4624[_0xdd3e('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdd3e('0x18')](respondWithFilteredResult(_0x2642be,_0x4c8243))[_0xdd3e('0x2b')](handleError(_0x2642be,null));};exports['getTeams']=function(_0x1f10c7,_0x18ce4f){var _0x2620c6={};var _0x5b8177={};var _0x1e4169;var _0x37a0ef;return db[_0xdd3e('0x24')][_0xdd3e('0x43')]({'where':{'id':_0x1f10c7['params']['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x18ce4f,null))[_0xdd3e('0x18')](function(_0x1d0cdf){if(_0x1d0cdf){_0x1e4169=_0x1d0cdf;_0x5b8177[_0xdd3e('0x2d')]=_[_0xdd3e('0x2e')](db['Team'][_0xdd3e('0x25')]);_0x5b8177[_0xdd3e('0x2a')]=_['keys'](_0x1f10c7[_0xdd3e('0x2a')]);_0x5b8177[_0xdd3e('0x2f')]=_['intersection'](_0x5b8177[_0xdd3e('0x2d')],_0x5b8177[_0xdd3e('0x2a')]);_0x2620c6[_0xdd3e('0x31')]=_['intersection'](_0x5b8177[_0xdd3e('0x2d')],qs[_0xdd3e('0x32')](_0x1f10c7[_0xdd3e('0x2a')][_0xdd3e('0x32')]));_0x2620c6['attributes']=_0x2620c6[_0xdd3e('0x31')][_0xdd3e('0x33')]?_0x2620c6[_0xdd3e('0x31')]:_0x5b8177[_0xdd3e('0x2d')];_0x2620c6[_0xdd3e('0x55')]=qs[_0xdd3e('0x46')](_0x1f10c7[_0xdd3e('0x2a')]['sort']);_0x2620c6['where']=qs[_0xdd3e('0x2f')](_[_0xdd3e('0x48')](_0x1f10c7[_0xdd3e('0x2a')],_0x5b8177[_0xdd3e('0x2f')]));if(_0x1f10c7[_0xdd3e('0x2a')]['filter']){_0x2620c6[_0xdd3e('0x47')]=_[_0xdd3e('0x35')](_0x2620c6['where'],{'$or':_[_0xdd3e('0x23')](_0x2620c6[_0xdd3e('0x31')],function(_0x5f30c2){var _0x16738a={};_0x16738a[_0x5f30c2]={'$like':'%'+_0x1f10c7[_0xdd3e('0x2a')]['filter']+'%'};return _0x16738a;})});}_0x2620c6=_[_0xdd3e('0x35')]({},_0x2620c6,_0x1f10c7[_0xdd3e('0x36')]);return _0x1e4169[_0xdd3e('0x56')](_0x2620c6);}})['then'](function(_0x1bfb94){if(_0x1bfb94){_0x37a0ef=_0x1bfb94[_0xdd3e('0x33')];if(!_0x1f10c7[_0xdd3e('0x2a')][_0xdd3e('0x57')]('nolimit')){_0x2620c6['limit']=qs[_0xdd3e('0x13')](_0x1f10c7[_0xdd3e('0x2a')][_0xdd3e('0x13')]);_0x2620c6['offset']=qs['offset'](_0x1f10c7[_0xdd3e('0x2a')]['offset']);}return _0x1e4169['getTeams'](_0x2620c6);}})[_0xdd3e('0x18')](function(_0x225b6d){if(_0x225b6d){return _0x225b6d?{'count':_0x37a0ef,'rows':_0x225b6d}:null;}})[_0xdd3e('0x18')](respondWithResult(_0x18ce4f,null))[_0xdd3e('0x2b')](handleError(_0x18ce4f,null));};exports['addTeams']=function(_0x145c27,_0x4d3d95){var _0xec2403=_0x145c27[_0xdd3e('0x40')][_0xdd3e('0x58')];return db[_0xdd3e('0x59')][_0xdd3e('0x4b')]({'where':{'id':_0xec2403},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdd3e('0x5a'),'attributes':['id',_0xdd3e('0x20'),_0xdd3e('0x5b'),_0xdd3e('0x5c'),'interface'],'raw':!![]}]})[_0xdd3e('0x18')](function(_0x202a51){if(_0x202a51){var _0x32b41b=_[_0xdd3e('0x5d')](_0x202a51,function(_0x24d0dd){var _0x3c5e13=_0x24d0dd[_0xdd3e('0x1a')]({'plain':!![]});return _0x3c5e13['Agents'];});return db[_0xdd3e('0x24')][_0xdd3e('0x3d')]({'where':{'id':_0x145c27[_0xdd3e('0x2c')]['id']}})[_0xdd3e('0x18')](function(_0x49732f){return db[_0xdd3e('0x5e')][_0xdd3e('0x5f')](function(_0x4ad368){return _0x49732f['addTeams'](_0xec2403,{'transaction':_0x4ad368})[_0xdd3e('0x18')](function(){return BPromise[_0xdd3e('0x60')](_0x32b41b,function(_0x348de3){return db[_0xdd3e('0x44')][_0xdd3e('0x61')]({'where':{'UserId':_0x348de3['id'],'OpenchannelQueueId':_0x145c27[_0xdd3e('0x2c')]['id']},'transaction':_0x4ad368});});})['then'](function(){_0x32b41b[_0xdd3e('0x62')](function(_0x537f24){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x537f24['id'],'OpenchannelQueueId':_0x49732f['id']});});});});});}})[_0xdd3e('0x18')](respondWithStatusCode(_0x4d3d95,null))[_0xdd3e('0x2b')](handleError(_0x4d3d95,null));};exports[_0xdd3e('0x63')]=function(_0x6ddf78,_0x16a349){return db['Team']['findAll']({'where':{'id':_0x6ddf78['query'][_0xdd3e('0x58')]},'attributes':['id'],'include':[{'model':db[_0xdd3e('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x16a349,null))['then'](function(_0x917d46){var _0x3b93b6=_[_0xdd3e('0x23')](_0x917d46,'id');var _0x28636a=[];var _0x458d3e=[];var _0x16fec6=squel[_0xdd3e('0x65')]();_0x16fec6[_0xdd3e('0x66')](_0xdd3e('0x67'))['from'](_0xdd3e('0x68'),'tq')['join']('user_has_teams','ut',_0xdd3e('0x69'))[_0xdd3e('0x47')]('OpenchannelQueueId\x20=\x20?',_0x6ddf78[_0xdd3e('0x2c')]['id']);for(var _0x54dc3c=0x0;_0x54dc3c<_0x917d46['length'];_0x54dc3c+=0x1){let _0x1a7f5c=_0x917d46[_0x54dc3c];for(var _0xa66042=0x0;_0xa66042<_0x1a7f5c[_0xdd3e('0x5a')][_0xdd3e('0x33')];_0xa66042+=0x1){let _0x4e68e6=_0x1a7f5c[_0xdd3e('0x5a')][_0xa66042];var _0x5dc66c=_0x16fec6['clone']();_0x5dc66c['where']('ut.UserId\x20=\x20?',_0x4e68e6['id']);_0x458d3e[_0xdd3e('0x6a')](db[_0xdd3e('0x5e')][_0xdd3e('0x2a')](_0x5dc66c[_0xdd3e('0x6b')](),{'type':db[_0xdd3e('0x5e')][_0xdd3e('0x6c')][_0xdd3e('0x6d')]})[_0xdd3e('0x18')](function(_0x478665){if(_0x478665['length']===0x1){return _0x4e68e6['id'];}else{var _0x275905=_[_0xdd3e('0x6e')](_[_0xdd3e('0x23')](_0x478665,_0xdd3e('0x6f')),function(_0x4fbbf9){return _[_0xdd3e('0x70')](_0x3b93b6,_0x4fbbf9);});if(_0x275905){return _0x4e68e6['id'];}}}));}}return BPromise[_0xdd3e('0x71')](_0x458d3e)[_0xdd3e('0x18')](function(_0x1b6e0c){_0x28636a=_(_0x28636a)[_0xdd3e('0x72')](_0x1b6e0c)[_0xdd3e('0x73')]()[_0xdd3e('0x74')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x6ddf78[_0xdd3e('0x2c')]['id']}})['then'](function(_0x559f4d){return db[_0xdd3e('0x5e')][_0xdd3e('0x5f')](function(_0x3b5c55){return _0x559f4d[_0xdd3e('0x63')](_0x6ddf78[_0xdd3e('0x2a')][_0xdd3e('0x58')],{'transaction':_0x3b5c55})[_0xdd3e('0x18')](function(){if(!_[_0xdd3e('0x75')](_0x28636a)){return _0x559f4d[_0xdd3e('0x76')](_0x28636a,{'transaction':_0x3b5c55});}})[_0xdd3e('0x18')](function(){_0x28636a[_0xdd3e('0x62')](function(_0x5dd526){socket[_0xdd3e('0x77')](_0xdd3e('0x78'),{'UserId':_0x5dd526,'OpenchannelQueueId':_0x559f4d['id']});});});});});});})['then'](respondWithStatusCode(_0x16a349,null))['catch'](handleError(_0x16a349,null));};exports['addAgents']=function(_0x2ebd62,_0x165317){return db[_0xdd3e('0x24')][_0xdd3e('0x3d')]({'where':{'id':_0x2ebd62[_0xdd3e('0x2c')]['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x165317,null))[_0xdd3e('0x18')](function(_0x575e18){if(_0x575e18){return _0x575e18[_0xdd3e('0x79')](_0x2ebd62[_0xdd3e('0x40')][_0xdd3e('0x58')],_[_0xdd3e('0x7a')](_0x2ebd62[_0xdd3e('0x40')],['ids','id'])||{})[_0xdd3e('0x7b')](function(_0x539208){for(var _0x22839b=0x0;_0x22839b<_0x2ebd62['body'][_0xdd3e('0x58')]['length'];_0x22839b+=0x1){socket[_0xdd3e('0x77')](_0xdd3e('0x7c'),{'UserId':Number(_0x2ebd62[_0xdd3e('0x40')][_0xdd3e('0x58')][_0x22839b]),'OpenchannelQueueId':Number(_0x2ebd62['params']['id'])});}return _0x539208;});}})[_0xdd3e('0x18')](respondWithResult(_0x165317,null))[_0xdd3e('0x2b')](handleError(_0x165317,null));};exports[_0xdd3e('0x76')]=function(_0x5bd357,_0x296cac){return db[_0xdd3e('0x24')]['find']({'where':{'id':_0x5bd357['params']['id']}})['then'](handleEntityNotFound(_0x296cac,null))[_0xdd3e('0x18')](function(_0x1e4937){if(_0x1e4937){return _0x1e4937[_0xdd3e('0x76')](_0x5bd357[_0xdd3e('0x2a')][_0xdd3e('0x58')])[_0xdd3e('0x18')](function(){if(_[_0xdd3e('0x7d')](_0x5bd357[_0xdd3e('0x2a')][_0xdd3e('0x58')])){for(var _0x37eb9a=0x0;_0x37eb9a<_0x5bd357['query'][_0xdd3e('0x58')][_0xdd3e('0x33')];_0x37eb9a+=0x1){socket[_0xdd3e('0x77')](_0xdd3e('0x78'),{'UserId':Number(_0x5bd357['query']['ids'][_0x37eb9a]),'OpenchannelQueueId':Number(_0x5bd357['params']['id'])});}}else{socket[_0xdd3e('0x77')](_0xdd3e('0x78'),{'UserId':Number(_0x5bd357[_0xdd3e('0x2a')][_0xdd3e('0x58')]),'OpenchannelQueueId':Number(_0x5bd357[_0xdd3e('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x296cac,null))['catch'](handleError(_0x296cac,null));};exports['getAgents']=function(_0x469a62,_0x312b7b){var _0x5b6af8={};var _0x4588c8={};var _0x11e695;var _0x13fe72;return db[_0xdd3e('0x24')][_0xdd3e('0x43')]({'where':{'id':_0x469a62[_0xdd3e('0x2c')]['id']}})[_0xdd3e('0x18')](handleEntityNotFound(_0x312b7b,null))['then'](function(_0x154968){if(_0x154968){_0x11e695=_0x154968;_0x4588c8[_0xdd3e('0x2d')]=_[_0xdd3e('0x2e')](db[_0xdd3e('0x64')][_0xdd3e('0x25')]);_0x4588c8[_0xdd3e('0x2a')]=_[_0xdd3e('0x2e')](_0x469a62[_0xdd3e('0x2a')]);_0x4588c8[_0xdd3e('0x2f')]=_[_0xdd3e('0x30')](_0x4588c8['model'],_0x4588c8[_0xdd3e('0x2a')]);_0x5b6af8[_0xdd3e('0x31')]=_['intersection'](_0x4588c8[_0xdd3e('0x2d')],qs[_0xdd3e('0x32')](_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x32')]));_0x5b6af8['attributes']=_0x5b6af8[_0xdd3e('0x31')]['length']?_0x5b6af8[_0xdd3e('0x31')]:_0x4588c8[_0xdd3e('0x2d')];_0x5b6af8[_0xdd3e('0x55')]=qs[_0xdd3e('0x46')](_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x46')]);_0x5b6af8[_0xdd3e('0x47')]=qs[_0xdd3e('0x2f')](_['pick'](_0x469a62[_0xdd3e('0x2a')],_0x4588c8['filters']));if(_0x469a62['query'][_0xdd3e('0x4a')]){_0x5b6af8[_0xdd3e('0x47')]=_[_0xdd3e('0x35')](_0x5b6af8[_0xdd3e('0x47')],{'$or':_[_0xdd3e('0x23')](_0x5b6af8['attributes'],function(_0x4fd1de){var _0x1838c4={};_0x1838c4[_0x4fd1de]={'$like':'%'+_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x4a')]+'%'};return _0x1838c4;})});}_0x5b6af8=_[_0xdd3e('0x35')]({},_0x5b6af8,_0x469a62[_0xdd3e('0x36')]);return _0x11e695['getAgents'](_0x5b6af8);}})['then'](function(_0x1ef895){if(_0x1ef895){_0x13fe72=_0x1ef895[_0xdd3e('0x33')];if(!_0x469a62[_0xdd3e('0x2a')]['hasOwnProperty'](_0xdd3e('0x45'))){_0x5b6af8[_0xdd3e('0x13')]=qs[_0xdd3e('0x13')](_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x13')]);_0x5b6af8['offset']=qs[_0xdd3e('0x11')](_0x469a62[_0xdd3e('0x2a')][_0xdd3e('0x11')]);}return _0x11e695['getAgents'](_0x5b6af8);}})['then'](function(_0x3ebbae){if(_0x3ebbae){return _0x3ebbae?{'count':_0x13fe72,'rows':_0x3ebbae}:null;}})['then'](respondWithResult(_0x312b7b,null))[_0xdd3e('0x2b')](handleError(_0x312b7b,null));}; \ No newline at end of file +var _0x67a0=['QueryTypes','SELECT','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','./openchannelQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','get','OpenchannelQueues','destroy','then','end','error','name','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','filters','attributes','intersection','fields','includeAll','options','create','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','pick','OpenchannelQueueId','filter','merge','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','sort','length','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString'];(function(_0x48d4f1,_0x5efbed){var _0x335d8b=function(_0x1d8de9){while(--_0x1d8de9){_0x48d4f1['push'](_0x48d4f1['shift']());}};_0x335d8b(++_0x5efbed);}(_0x67a0,0x1f3));var _0x067a=function(_0xa07fad,_0x1da3be){_0xa07fad=_0xa07fad-0x0;var _0x5935db=_0x67a0[_0xa07fad];return _0x5935db;};'use strict';var BPromise=require(_0x067a('0x0'));var util=require(_0x067a('0x1'));var _=require(_0x067a('0x2'));var squel=require(_0x067a('0x3'));var Redis=require(_0x067a('0x4'));var qs=require(_0x067a('0x5'));var logger=require(_0x067a('0x6'))(_0x067a('0x7'));var config=require(_0x067a('0x8'));var db=require(_0x067a('0x9'))['db'];config[_0x067a('0xa')]=_['defaults'](config[_0x067a('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x067a('0xa')]));require(_0x067a('0xb'))['register'](socket);function respondWithStatusCode(_0x266d84,_0x4ec8da){_0x4ec8da=_0x4ec8da||0xcc;return function(_0x4dc4bc){if(_0x4dc4bc){return _0x266d84[_0x067a('0xc')](_0x4ec8da);}return _0x266d84['status'](_0x4ec8da)['end']();};}function respondWithResult(_0x2ae67f,_0x1ab4e4){_0x1ab4e4=_0x1ab4e4||0xc8;return function(_0xc052a){if(_0xc052a){return _0x2ae67f[_0x067a('0xd')](_0x1ab4e4)[_0x067a('0xe')](_0xc052a);}};}function respondWithFilteredResult(_0x49cf99,_0x462496){return function(_0x1c1e7c){if(_0x1c1e7c){var _0x2e599c=typeof _0x462496[_0x067a('0xf')]===_0x067a('0x10')&&typeof _0x462496[_0x067a('0x11')]===_0x067a('0x10');var _0xbb8864=_0x1c1e7c['count'];var _0x253d09=_0x2e599c?0x0:_0x462496[_0x067a('0xf')];var _0x4f382d=_0x2e599c?_0x1c1e7c[_0x067a('0x12')]:_0x462496['offset']+_0x462496[_0x067a('0x11')];var _0x5baeba;if(_0x4f382d>=_0xbb8864){_0x4f382d=_0xbb8864;_0x5baeba=0xc8;}else{_0x5baeba=0xce;}_0x49cf99[_0x067a('0xd')](_0x5baeba);return _0x49cf99[_0x067a('0x13')](_0x067a('0x14'),_0x253d09+'-'+_0x4f382d+'/'+_0xbb8864)[_0x067a('0xe')](_0x1c1e7c);}return null;};}function saveUpdates(_0x29ed2b){return function(_0x11122c){if(_0x11122c){return _0x11122c[_0x067a('0x15')](_0x29ed2b)['then'](function(_0x57e537){return _0x57e537;});}return null;};}function removeEntity(_0x1393b9){return function(_0xbee685){if(_0xbee685){return _0xbee685['destroy']()['then'](function(){var _0x5d954f=_0xbee685[_0x067a('0x16')]({'plain':!![]});var _0x1eecb2=_0x067a('0x17');return db['UserProfileResource'][_0x067a('0x18')]({'where':{'type':_0x1eecb2,'resourceId':_0x5d954f['id']}})[_0x067a('0x19')](function(){return _0xbee685;});})['then'](function(){_0x1393b9[_0x067a('0xd')](0xcc)[_0x067a('0x1a')]();});}};}function handleEntityNotFound(_0x5a27f4){return function(_0x42a045){if(!_0x42a045){_0x5a27f4['sendStatus'](0x194);}return _0x42a045;};}function handleError(_0x5128f4,_0x34e528){_0x34e528=_0x34e528||0x1f4;return function(_0x1b4705){logger[_0x067a('0x1b')](_0x1b4705['stack']);if(_0x1b4705[_0x067a('0x1c')]){delete _0x1b4705[_0x067a('0x1c')];}_0x5128f4[_0x067a('0xd')](_0x34e528)['send'](_0x1b4705);};}exports['index']=function(_0x13c28e,_0x32b13f){var _0x446425={};var _0xef20f9={'count':0x0,'rows':[]};var _0x4f0d0f=_[_0x067a('0x1d')](db[_0x067a('0x1e')][_0x067a('0x1f')],function(_0x4d2171){return{'name':_0x4d2171[_0x067a('0x20')],'type':_0x4d2171[_0x067a('0x21')][_0x067a('0x22')]};});_0x446425=qs[_0x067a('0x23')](_0x4f0d0f,_0x13c28e);var _0x19eb5a={'where':_0x446425[_0x067a('0x24')]};return db[_0x067a('0x1e')][_0x067a('0x12')](_0x19eb5a)['then'](function(_0x445134){_0xef20f9[_0x067a('0x12')]=_0x445134;_0x446425[_0x067a('0x25')]=qs[_0x067a('0x25')](_0x13c28e['query']);return db['OpenchannelQueue'][_0x067a('0x26')](_0x446425);})['then'](function(_0x3526f1){_0xef20f9[_0x067a('0x27')]=_0x3526f1;return _0xef20f9;})[_0x067a('0x19')](respondWithFilteredResult(_0x32b13f,_0x446425))[_0x067a('0x28')](handleError(_0x32b13f,null));};exports[_0x067a('0x29')]=function(_0x37359c,_0x552769){var _0x567219={'raw':!![],'where':{'id':_0x37359c[_0x067a('0x2a')]['id']}},_0x1d1e65={};_0x1d1e65[_0x067a('0x2b')]=_[_0x067a('0x2c')](db[_0x067a('0x1e')][_0x067a('0x1f')]);_0x1d1e65[_0x067a('0x2d')]=_[_0x067a('0x2c')](_0x37359c[_0x067a('0x2d')]);_0x1d1e65[_0x067a('0x2e')]=_['intersection'](_0x1d1e65[_0x067a('0x2b')],_0x1d1e65[_0x067a('0x2d')]);_0x567219[_0x067a('0x2f')]=_[_0x067a('0x30')](_0x1d1e65[_0x067a('0x2b')],qs[_0x067a('0x31')](_0x37359c[_0x067a('0x2d')][_0x067a('0x31')]));_0x567219['attributes']=_0x567219[_0x067a('0x2f')]['length']?_0x567219['attributes']:_0x1d1e65['model'];if(_0x37359c[_0x067a('0x2d')][_0x067a('0x32')]){_0x567219[_0x067a('0x25')]=[{'all':!![]}];}_0x567219=_['merge']({},_0x567219,_0x37359c[_0x067a('0x33')]);return db[_0x067a('0x1e')]['find'](_0x567219)[_0x067a('0x19')](handleEntityNotFound(_0x552769,null))[_0x067a('0x19')](respondWithResult(_0x552769,null))['catch'](handleError(_0x552769,null));};exports[_0x067a('0x34')]=function(_0xd1ad94,_0x34053b){return db['OpenchannelQueue']['create'](_0xd1ad94['body'],{})[_0x067a('0x19')](function(_0x188fd6){var _0x325f0e=_0xd1ad94[_0x067a('0x35')]['get']({'plain':!![]});if(!_0x325f0e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x325f0e[_0x067a('0x36')]==='user'){var _0x13c57a=_0x188fd6['get']({'plain':!![]});var _0x2930d8=_0x067a('0x17');return db['UserProfileSection'][_0x067a('0x37')]({'where':{'name':_0x2930d8,'userProfileId':_0x325f0e[_0x067a('0x38')]},'raw':!![]})[_0x067a('0x19')](function(_0x567a8f){if(_0x567a8f&&_0x567a8f[_0x067a('0x39')]===0x0){return db['UserProfileResource'][_0x067a('0x34')]({'name':_0x13c57a[_0x067a('0x1c')],'resourceId':_0x13c57a['id'],'type':_0x567a8f[_0x067a('0x1c')],'sectionId':_0x567a8f['id']},{})[_0x067a('0x19')](function(){return _0x188fd6;});}else{return _0x188fd6;}})['catch'](function(_0x19e388){logger[_0x067a('0x1b')](_0x067a('0x3a'),_0x19e388);throw _0x19e388;});}return _0x188fd6;})[_0x067a('0x19')](respondWithResult(_0x34053b,0xc9))[_0x067a('0x28')](handleError(_0x34053b,null));};exports['update']=function(_0x28d038,_0x886210){if(_0x28d038[_0x067a('0x3b')]['id']){delete _0x28d038['body']['id'];}return db[_0x067a('0x1e')][_0x067a('0x37')]({'where':{'id':_0x28d038['params']['id']}})['then'](handleEntityNotFound(_0x886210,null))[_0x067a('0x19')](saveUpdates(_0x28d038[_0x067a('0x3b')],null))[_0x067a('0x19')](respondWithResult(_0x886210,null))['catch'](handleError(_0x886210,null));};exports['destroy']=function(_0x3163d4,_0x38dd89){return db['OpenchannelQueue'][_0x067a('0x37')]({'where':{'id':_0x3163d4[_0x067a('0x2a')]['id']}})[_0x067a('0x19')](handleEntityNotFound(_0x38dd89,null))[_0x067a('0x19')](removeEntity(_0x38dd89,null))[_0x067a('0x28')](handleError(_0x38dd89,null));};exports[_0x067a('0x3c')]=function(_0x49643b,_0x2c067f){return db[_0x067a('0x1e')]['describe']()[_0x067a('0x19')](respondWithResult(_0x2c067f,null))['catch'](handleError(_0x2c067f,null));};exports[_0x067a('0x3d')]=function(_0x411128,_0x4aabb7){var _0x169d23={'raw':!![],'where':{}},_0x18cd7b={},_0xabeaae;return db['OpenchannelQueue'][_0x067a('0x3e')]({'where':{'id':_0x411128['params']['id']}})[_0x067a('0x19')](handleEntityNotFound(_0x4aabb7,null))[_0x067a('0x19')](function(_0x4a06e0){if(_0x4a06e0){_0xabeaae=_0x4a06e0[_0x067a('0x16')]({'plain':!![]});_0x18cd7b[_0x067a('0x2b')]=_[_0x067a('0x2c')](db[_0x067a('0x3f')][_0x067a('0x1f')]);_0x18cd7b[_0x067a('0x2d')]=_[_0x067a('0x2c')](_0x411128[_0x067a('0x2d')]);_0x18cd7b[_0x067a('0x2e')]=_['intersection'](_0x18cd7b[_0x067a('0x2b')],_0x18cd7b[_0x067a('0x2d')]);_0x169d23['attributes']=_[_0x067a('0x30')](_0x18cd7b['model'],qs[_0x067a('0x31')](_0x411128[_0x067a('0x2d')][_0x067a('0x31')]));_0x169d23[_0x067a('0x2f')]=_0x169d23[_0x067a('0x2f')]['length']?_0x169d23[_0x067a('0x2f')]:_0x18cd7b[_0x067a('0x2b')];if(!_0x411128[_0x067a('0x2d')][_0x067a('0x40')](_0x067a('0x41'))){_0x169d23['limit']=qs[_0x067a('0x11')](_0x411128[_0x067a('0x2d')][_0x067a('0x11')]);_0x169d23[_0x067a('0xf')]=qs[_0x067a('0xf')](_0x411128[_0x067a('0x2d')]['offset']);}_0x169d23[_0x067a('0x42')]=qs['sort'](_0x411128[_0x067a('0x2d')]['sort']);_0x169d23[_0x067a('0x24')]=qs[_0x067a('0x2e')](_[_0x067a('0x43')](_0x411128['query'],_0x18cd7b[_0x067a('0x2e')]));_0x169d23['where'][_0x067a('0x44')]=_0x4a06e0['id'];if(_0x411128[_0x067a('0x2d')][_0x067a('0x45')]){_0x169d23[_0x067a('0x24')]=_[_0x067a('0x46')](_0x169d23[_0x067a('0x24')],{'$or':_['map'](_0x169d23[_0x067a('0x2f')],function(_0x34878c){var _0x1ec3d0={};_0x1ec3d0[_0x34878c]={'$like':'%'+_0x411128['query'][_0x067a('0x45')]+'%'};return _0x1ec3d0;})});}_0x169d23=_[_0x067a('0x46')]({},_0x169d23,_0x411128[_0x067a('0x33')]);return db['UserOpenchannelQueue'][_0x067a('0x26')](_0x169d23);}})[_0x067a('0x19')](function(_0x249394){if(_0x249394){return db[_0x067a('0x47')][_0x067a('0x48')]({'where':{'id':_[_0x067a('0x1d')](_0x249394,_0x067a('0x49')),'role':_0x067a('0x4a')},'attributes':['id',_0x067a('0x1c'),_0x067a('0x4b'),'updatedAt',_0x067a('0x4c')]});}})['then'](function(_0x40dff2){if(_0x40dff2){return{'count':_0x40dff2['count'],'rows':_[_0x067a('0x1d')](_0x40dff2[_0x067a('0x27')],function(_0x35c380){return{'membername':_0x35c380[_0x067a('0x1c')],'UserId':_0x35c380['id'],'queue_name':_0xabeaae[_0x067a('0x1c')],'OpenchannelQueueId':_0xabeaae['id'],'interface':util[_0x067a('0x4d')](_0x067a('0x4e'),_0x067a('0x4f'),_0x35c380[_0x067a('0x1c')]),'penalty':0x0,'paused':_0x35c380[_0x067a('0x4b')],'createdAt':_0x35c380[_0x067a('0x4c')],'updatedAt':_0x35c380[_0x067a('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4aabb7,_0x169d23))['catch'](handleError(_0x4aabb7,null));};exports[_0x067a('0x51')]=function(_0x3d917b,_0x136a31){var _0x58b610={};var _0x351aa2={};var _0x155e09;var _0x4bb495;return db['OpenchannelQueue'][_0x067a('0x3e')]({'where':{'id':_0x3d917b[_0x067a('0x2a')]['id']}})[_0x067a('0x19')](handleEntityNotFound(_0x136a31,null))[_0x067a('0x19')](function(_0x39c6b7){if(_0x39c6b7){_0x155e09=_0x39c6b7;_0x351aa2[_0x067a('0x2b')]=_[_0x067a('0x2c')](db['Team'][_0x067a('0x1f')]);_0x351aa2[_0x067a('0x2d')]=_[_0x067a('0x2c')](_0x3d917b[_0x067a('0x2d')]);_0x351aa2[_0x067a('0x2e')]=_[_0x067a('0x30')](_0x351aa2['model'],_0x351aa2[_0x067a('0x2d')]);_0x58b610[_0x067a('0x2f')]=_[_0x067a('0x30')](_0x351aa2['model'],qs['fields'](_0x3d917b['query'][_0x067a('0x31')]));_0x58b610[_0x067a('0x2f')]=_0x58b610[_0x067a('0x2f')]['length']?_0x58b610[_0x067a('0x2f')]:_0x351aa2[_0x067a('0x2b')];_0x58b610[_0x067a('0x42')]=qs['sort'](_0x3d917b['query'][_0x067a('0x52')]);_0x58b610[_0x067a('0x24')]=qs[_0x067a('0x2e')](_[_0x067a('0x43')](_0x3d917b[_0x067a('0x2d')],_0x351aa2[_0x067a('0x2e')]));if(_0x3d917b[_0x067a('0x2d')][_0x067a('0x45')]){_0x58b610[_0x067a('0x24')]=_[_0x067a('0x46')](_0x58b610[_0x067a('0x24')],{'$or':_['map'](_0x58b610['attributes'],function(_0x3f1ab0){var _0x49c630={};_0x49c630[_0x3f1ab0]={'$like':'%'+_0x3d917b['query'][_0x067a('0x45')]+'%'};return _0x49c630;})});}_0x58b610=_['merge']({},_0x58b610,_0x3d917b[_0x067a('0x33')]);return _0x155e09[_0x067a('0x51')](_0x58b610);}})[_0x067a('0x19')](function(_0x22efa4){if(_0x22efa4){_0x4bb495=_0x22efa4[_0x067a('0x53')];if(!_0x3d917b[_0x067a('0x2d')][_0x067a('0x40')]('nolimit')){_0x58b610[_0x067a('0x11')]=qs[_0x067a('0x11')](_0x3d917b[_0x067a('0x2d')][_0x067a('0x11')]);_0x58b610[_0x067a('0xf')]=qs['offset'](_0x3d917b[_0x067a('0x2d')][_0x067a('0xf')]);}return _0x155e09['getTeams'](_0x58b610);}})[_0x067a('0x19')](function(_0x44f8f1){if(_0x44f8f1){return _0x44f8f1?{'count':_0x4bb495,'rows':_0x44f8f1}:null;}})[_0x067a('0x19')](respondWithResult(_0x136a31,null))[_0x067a('0x28')](handleError(_0x136a31,null));};exports['addTeams']=function(_0x36cc47,_0x1ec813){var _0x21d6d2=_0x36cc47[_0x067a('0x3b')][_0x067a('0x54')];return db[_0x067a('0x55')][_0x067a('0x26')]({'where':{'id':_0x21d6d2},'attributes':['id'],'include':[{'model':db[_0x067a('0x47')],'as':'Agents','attributes':['id','name',_0x067a('0x56'),_0x067a('0x57'),_0x067a('0x58')],'raw':!![]}]})[_0x067a('0x19')](function(_0x3354e8){if(_0x3354e8){var _0x24fa1f=_[_0x067a('0x59')](_0x3354e8,function(_0x365303){var _0x1c7eef=_0x365303[_0x067a('0x16')]({'plain':!![]});return _0x1c7eef[_0x067a('0x5a')];});return db[_0x067a('0x1e')][_0x067a('0x37')]({'where':{'id':_0x36cc47['params']['id']}})[_0x067a('0x19')](function(_0xa3ad9b){return db[_0x067a('0x5b')]['transaction'](function(_0x41ff8c){return _0xa3ad9b[_0x067a('0x5c')](_0x21d6d2,{'transaction':_0x41ff8c})['then'](function(){return BPromise['each'](_0x24fa1f,function(_0x5366f4){return db['UserOpenchannelQueue'][_0x067a('0x5d')]({'where':{'UserId':_0x5366f4['id'],'OpenchannelQueueId':_0x36cc47[_0x067a('0x2a')]['id']},'transaction':_0x41ff8c});});})[_0x067a('0x19')](function(){_0x24fa1f[_0x067a('0x5e')](function(_0xc9568d){socket[_0x067a('0x5f')](_0x067a('0x60'),{'UserId':_0xc9568d['id'],'OpenchannelQueueId':_0xa3ad9b['id']});});});});});}})[_0x067a('0x19')](respondWithStatusCode(_0x1ec813,null))['catch'](handleError(_0x1ec813,null));};exports[_0x067a('0x61')]=function(_0x10203a,_0x353f7a){return db['Team'][_0x067a('0x26')]({'where':{'id':_0x10203a[_0x067a('0x2d')][_0x067a('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x067a('0x19')](handleEntityNotFound(_0x353f7a,null))[_0x067a('0x19')](function(_0x126c0c){var _0x4451de=_['map'](_0x126c0c,'id');var _0x35e566=[];var _0x5f488a=[];var _0x172226=squel['select']();_0x172226[_0x067a('0x62')](_0x067a('0x63'))['from'](_0x067a('0x64'),'tq')[_0x067a('0x65')]('user_has_teams','ut',_0x067a('0x66'))[_0x067a('0x24')](_0x067a('0x67'),_0x10203a[_0x067a('0x2a')]['id']);for(var _0x26b832=0x0;_0x26b832<_0x126c0c['length'];_0x26b832+=0x1){let _0x134ebc=_0x126c0c[_0x26b832];for(var _0x18bb11=0x0;_0x18bb11<_0x134ebc[_0x067a('0x5a')][_0x067a('0x53')];_0x18bb11+=0x1){let _0x410f2b=_0x134ebc[_0x067a('0x5a')][_0x18bb11];var _0x471556=_0x172226['clone']();_0x471556[_0x067a('0x24')](_0x067a('0x68'),_0x410f2b['id']);_0x5f488a['push'](db[_0x067a('0x5b')][_0x067a('0x2d')](_0x471556[_0x067a('0x69')](),{'type':db[_0x067a('0x5b')][_0x067a('0x6a')][_0x067a('0x6b')]})[_0x067a('0x19')](function(_0x4fa18e){if(_0x4fa18e[_0x067a('0x53')]===0x1){return _0x410f2b['id'];}else{var _0x1ee924=_['every'](_[_0x067a('0x1d')](_0x4fa18e,_0x067a('0x6c')),function(_0x3f2776){return _[_0x067a('0x6d')](_0x4451de,_0x3f2776);});if(_0x1ee924){return _0x410f2b['id'];}}}));}}return BPromise['all'](_0x5f488a)[_0x067a('0x19')](function(_0x26d32e){_0x35e566=_(_0x35e566)[_0x067a('0x6e')](_0x26d32e)[_0x067a('0x6f')]()[_0x067a('0x70')]();return db[_0x067a('0x1e')]['find']({'where':{'id':_0x10203a['params']['id']}})[_0x067a('0x19')](function(_0x3e5bd2){return db['sequelize'][_0x067a('0x71')](function(_0x3ddd30){return _0x3e5bd2[_0x067a('0x61')](_0x10203a['query'][_0x067a('0x54')],{'transaction':_0x3ddd30})[_0x067a('0x19')](function(){if(!_[_0x067a('0x72')](_0x35e566)){return _0x3e5bd2[_0x067a('0x73')](_0x35e566,{'transaction':_0x3ddd30});}})['then'](function(){_0x35e566[_0x067a('0x5e')](function(_0x1c658a){socket[_0x067a('0x5f')](_0x067a('0x74'),{'UserId':_0x1c658a,'OpenchannelQueueId':_0x3e5bd2['id']});});});});});});})[_0x067a('0x19')](respondWithStatusCode(_0x353f7a,null))['catch'](handleError(_0x353f7a,null));};exports[_0x067a('0x75')]=function(_0x367b1c,_0x45afa5){return db[_0x067a('0x1e')]['find']({'where':{'id':_0x367b1c[_0x067a('0x2a')]['id']}})[_0x067a('0x19')](handleEntityNotFound(_0x45afa5,null))[_0x067a('0x19')](function(_0x37939e){if(_0x37939e){return _0x37939e['addAgents'](_0x367b1c[_0x067a('0x3b')][_0x067a('0x54')],_[_0x067a('0x76')](_0x367b1c[_0x067a('0x3b')],[_0x067a('0x54'),'id'])||{})['spread'](function(_0x2a686a){for(var _0x1651f6=0x0;_0x1651f6<_0x367b1c['body']['ids'][_0x067a('0x53')];_0x1651f6+=0x1){socket[_0x067a('0x5f')](_0x067a('0x60'),{'UserId':Number(_0x367b1c['body'][_0x067a('0x54')][_0x1651f6]),'OpenchannelQueueId':Number(_0x367b1c[_0x067a('0x2a')]['id'])});}return _0x2a686a;});}})[_0x067a('0x19')](respondWithResult(_0x45afa5,null))[_0x067a('0x28')](handleError(_0x45afa5,null));};exports[_0x067a('0x73')]=function(_0x1b46cb,_0x59f4b6){return db[_0x067a('0x1e')][_0x067a('0x37')]({'where':{'id':_0x1b46cb[_0x067a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x59f4b6,null))[_0x067a('0x19')](function(_0x27f74c){if(_0x27f74c){return _0x27f74c[_0x067a('0x73')](_0x1b46cb[_0x067a('0x2d')][_0x067a('0x54')])[_0x067a('0x19')](function(){if(_[_0x067a('0x77')](_0x1b46cb[_0x067a('0x2d')][_0x067a('0x54')])){for(var _0x270307=0x0;_0x270307<_0x1b46cb[_0x067a('0x2d')][_0x067a('0x54')]['length'];_0x270307+=0x1){socket[_0x067a('0x5f')](_0x067a('0x74'),{'UserId':Number(_0x1b46cb[_0x067a('0x2d')]['ids'][_0x270307]),'OpenchannelQueueId':Number(_0x1b46cb[_0x067a('0x2a')]['id'])});}}else{socket[_0x067a('0x5f')](_0x067a('0x74'),{'UserId':Number(_0x1b46cb['query'][_0x067a('0x54')]),'OpenchannelQueueId':Number(_0x1b46cb[_0x067a('0x2a')]['id'])});}});}})[_0x067a('0x19')](respondWithStatusCode(_0x59f4b6,null))['catch'](handleError(_0x59f4b6,null));};exports['getAgents']=function(_0xe0fa62,_0x5b7d16){var _0x42c0b0={};var _0x470004={};var _0x5d70b6;var _0x36767a;return db[_0x067a('0x1e')]['findOne']({'where':{'id':_0xe0fa62[_0x067a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b7d16,null))[_0x067a('0x19')](function(_0x2e91a0){if(_0x2e91a0){_0x5d70b6=_0x2e91a0;_0x470004['model']=_[_0x067a('0x2c')](db[_0x067a('0x47')][_0x067a('0x1f')]);_0x470004[_0x067a('0x2d')]=_[_0x067a('0x2c')](_0xe0fa62[_0x067a('0x2d')]);_0x470004[_0x067a('0x2e')]=_[_0x067a('0x30')](_0x470004['model'],_0x470004[_0x067a('0x2d')]);_0x42c0b0[_0x067a('0x2f')]=_[_0x067a('0x30')](_0x470004[_0x067a('0x2b')],qs[_0x067a('0x31')](_0xe0fa62[_0x067a('0x2d')]['fields']));_0x42c0b0[_0x067a('0x2f')]=_0x42c0b0[_0x067a('0x2f')][_0x067a('0x53')]?_0x42c0b0['attributes']:_0x470004[_0x067a('0x2b')];_0x42c0b0[_0x067a('0x42')]=qs[_0x067a('0x52')](_0xe0fa62['query'][_0x067a('0x52')]);_0x42c0b0[_0x067a('0x24')]=qs[_0x067a('0x2e')](_[_0x067a('0x43')](_0xe0fa62[_0x067a('0x2d')],_0x470004['filters']));if(_0xe0fa62[_0x067a('0x2d')][_0x067a('0x45')]){_0x42c0b0[_0x067a('0x24')]=_['merge'](_0x42c0b0[_0x067a('0x24')],{'$or':_[_0x067a('0x1d')](_0x42c0b0[_0x067a('0x2f')],function(_0xa37f88){var _0x3be8ef={};_0x3be8ef[_0xa37f88]={'$like':'%'+_0xe0fa62[_0x067a('0x2d')][_0x067a('0x45')]+'%'};return _0x3be8ef;})});}_0x42c0b0=_[_0x067a('0x46')]({},_0x42c0b0,_0xe0fa62[_0x067a('0x33')]);return _0x5d70b6['getAgents'](_0x42c0b0);}})['then'](function(_0x26efb4){if(_0x26efb4){_0x36767a=_0x26efb4[_0x067a('0x53')];if(!_0xe0fa62[_0x067a('0x2d')][_0x067a('0x40')](_0x067a('0x41'))){_0x42c0b0[_0x067a('0x11')]=qs[_0x067a('0x11')](_0xe0fa62['query']['limit']);_0x42c0b0['offset']=qs[_0x067a('0xf')](_0xe0fa62[_0x067a('0x2d')][_0x067a('0xf')]);}return _0x5d70b6[_0x067a('0x78')](_0x42c0b0);}})[_0x067a('0x19')](function(_0x35a49c){if(_0x35a49c){return _0x35a49c?{'count':_0x36767a,'rows':_0x35a49c}:null;}})[_0x067a('0x19')](respondWithResult(_0x5b7d16,null))[_0x067a('0x28')](handleError(_0x5b7d16,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 233867a..362e3ab 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 _0xedc0=['../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xedc0,0x13f));var _0x0edc=function(_0x46ab02,_0x46f430){_0x46ab02=_0x46ab02-0x0;var _0x39d9a4=_0xedc0[_0x46ab02];return _0x39d9a4;};'use strict';var EventEmitter=require(_0x0edc('0x0'));var OpenchannelQueue=require(_0x0edc('0x1'))['db'][_0x0edc('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0edc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0edc('0x4'),'afterDestroy':_0x0edc('0x5')};function emitEvent(_0x5b2a48){return function(_0x2ccbe5,_0x1486ca,_0x11c43e){OpenchannelQueueEvents[_0x0edc('0x6')](_0x5b2a48+':'+_0x2ccbe5['id'],_0x2ccbe5);OpenchannelQueueEvents[_0x0edc('0x6')](_0x5b2a48,_0x2ccbe5);_0x11c43e(null);};}for(var e in events){if(events[_0x0edc('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0edc('0x8')](e,emitEvent(event));}}module[_0x0edc('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x0a15=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2416fa,_0x551e5d){var _0x406e4f=function(_0x5b9403){while(--_0x5b9403){_0x2416fa['push'](_0x2416fa['shift']());}};_0x406e4f(++_0x551e5d);}(_0x0a15,0x9d));var _0x50a1=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x0a15[_0x2080a3];return _0x8d7d17;};'use strict';var EventEmitter=require(_0x50a1('0x0'));var OpenchannelQueue=require(_0x50a1('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x50a1('0x2')](0x0);var events={'afterCreate':_0x50a1('0x3'),'afterUpdate':_0x50a1('0x4'),'afterDestroy':_0x50a1('0x5')};function emitEvent(_0xd55bcc){return function(_0x2297b7,_0x17e155,_0x531f16){OpenchannelQueueEvents[_0x50a1('0x6')](_0xd55bcc+':'+_0x2297b7['id'],_0x2297b7);OpenchannelQueueEvents[_0x50a1('0x6')](_0xd55bcc,_0x2297b7);_0x531f16(null);};}for(var e in events){if(events[_0x50a1('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x50a1('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index ce6b03e..a3dd439 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 _0x975b=['util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x104f8f,_0x52ecc){var _0x49cd8c=function(_0x252fbb){while(--_0x252fbb){_0x104f8f['push'](_0x104f8f['shift']());}};_0x49cd8c(++_0x52ecc);}(_0x975b,0x154));var _0xb975=function(_0x10723e,_0x4147de){_0x10723e=_0x10723e-0x0;var _0x35439b=_0x975b[_0x10723e];return _0x35439b;};'use strict';var _=require(_0xb975('0x0'));var util=require(_0xb975('0x1'));var logger=require(_0xb975('0x2'))(_0xb975('0x3'));var moment=require(_0xb975('0x4'));var BPromise=require(_0xb975('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb975('0x6'));var attributes=require(_0xb975('0x7'));module[_0xb975('0x8')]=function(_0x5ba710,_0x5bd3c1){return _0x5ba710['define'](_0xb975('0x9'),attributes,{'tableName':_0xb975('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f90=['path','rimraf','../../config/environment','exports','define','OpenchannelQueue','lodash','util','../../config/logger','api'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x4f90,0x146));var _0x04f9=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0x4f90[_0x16cb03];return _0x10944e;};'use strict';var _=require(_0x04f9('0x0'));var util=require(_0x04f9('0x1'));var logger=require(_0x04f9('0x2'))(_0x04f9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04f9('0x4'));var rimraf=require(_0x04f9('0x5'));var config=require(_0x04f9('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x04f9('0x7')]=function(_0x27d446,_0x50765c){return _0x27d446[_0x04f9('0x8')](_0x04f9('0x9'),attributes,{'tableName':'openchannel_queues','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 d1dc754..6c4a56f 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 _0x2a20=['OpenchannelQueue','findAll','options','raw','attributes','include','map','model','find','where','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','debug','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','info','request\x20sent','catch','GetOpenchannelQueue'];(function(_0x2f67c3,_0x518e18){var _0x4a8e41=function(_0x334210){while(--_0x334210){_0x2f67c3['push'](_0x2f67c3['shift']());}};_0x4a8e41(++_0x518e18);}(_0x2a20,0x1bb));var _0x02a2=function(_0x3533b8,_0x259028){_0x3533b8=_0x3533b8-0x0;var _0x29785b=_0x2a20[_0x3533b8];return _0x29785b;};'use strict';var _=require(_0x02a2('0x0'));var util=require(_0x02a2('0x1'));var moment=require(_0x02a2('0x2'));var BPromise=require(_0x02a2('0x3'));var rs=require(_0x02a2('0x4'));var fs=require('fs');var Redis=require(_0x02a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x02a2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x02a2('0x7'));var client=jayson[_0x02a2('0x8')][_0x02a2('0x9')]({'port':0x232a});config[_0x02a2('0xa')]=_[_0x02a2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x02a2('0xc'))(new Redis(config[_0x02a2('0xa')]));require('./openchannelQueue.socket')[_0x02a2('0xd')](socket);function respondWithRpcPromise(_0x344a2a,_0x4fca11,_0x3ff0c7){return new BPromise(function(_0x5aeb74,_0x489588){return client[_0x02a2('0xe')](_0x344a2a,_0x3ff0c7)[_0x02a2('0xf')](function(_0x1f8ac5){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x4fca11,'request\x20sent');logger[_0x02a2('0x10')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4fca11,'request\x20sent',JSON[_0x02a2('0x11')](_0x1f8ac5));if(_0x1f8ac5[_0x02a2('0x12')]){if(_0x1f8ac5[_0x02a2('0x12')]['code']===0x1f4){logger['error'](_0x02a2('0x13'),_0x4fca11,_0x1f8ac5[_0x02a2('0x12')]['message']);return _0x489588(_0x1f8ac5[_0x02a2('0x12')][_0x02a2('0x14')]);}logger['error'](_0x02a2('0x13'),_0x4fca11,_0x1f8ac5[_0x02a2('0x12')][_0x02a2('0x14')]);return _0x5aeb74(_0x1f8ac5['error'][_0x02a2('0x14')]);}else{logger[_0x02a2('0x15')](_0x02a2('0x13'),_0x4fca11,_0x02a2('0x16'));_0x5aeb74(_0x1f8ac5['result'][_0x02a2('0x14')]);}})[_0x02a2('0x17')](function(_0x4de932){logger[_0x02a2('0x12')](_0x02a2('0x13'),_0x4fca11,_0x4de932);_0x489588(_0x4de932);});});}exports[_0x02a2('0x18')]=function(_0x57c205){var _0x45db0a=this;return new Promise(function(_0x4fd675,_0x20a9f4){return db[_0x02a2('0x19')][_0x02a2('0x1a')]({'raw':_0x57c205['options']?_0x57c205[_0x02a2('0x1b')][_0x02a2('0x1c')]===undefined?!![]:![]:!![],'where':_0x57c205['options']?_0x57c205[_0x02a2('0x1b')]['where']||null:null,'attributes':_0x57c205[_0x02a2('0x1b')]?_0x57c205[_0x02a2('0x1b')][_0x02a2('0x1d')]||null:null,'limit':_0x57c205[_0x02a2('0x1b')]?_0x57c205[_0x02a2('0x1b')]['limit']||null:null,'include':_0x57c205[_0x02a2('0x1b')]?_0x57c205[_0x02a2('0x1b')][_0x02a2('0x1e')]?_[_0x02a2('0x1f')](_0x57c205[_0x02a2('0x1b')]['include'],function(_0x4e0ae6){return{'model':db[_0x4e0ae6[_0x02a2('0x20')]],'as':_0x4e0ae6['as'],'attributes':_0x4e0ae6[_0x02a2('0x1d')],'include':_0x4e0ae6[_0x02a2('0x1e')]?_[_0x02a2('0x1f')](_0x4e0ae6[_0x02a2('0x1e')],function(_0x399fdf){return{'model':db[_0x399fdf[_0x02a2('0x20')]],'as':_0x399fdf['as'],'attributes':_0x399fdf[_0x02a2('0x1d')],'include':_0x399fdf[_0x02a2('0x1e')]?_[_0x02a2('0x1f')](_0x399fdf[_0x02a2('0x1e')],function(_0x23d46c){return{'model':db[_0x23d46c[_0x02a2('0x20')]],'as':_0x23d46c['as'],'attributes':_0x23d46c[_0x02a2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x02a2('0xf')](function(_0x188af6){logger[_0x02a2('0x15')](_0x02a2('0x18'),_0x57c205);logger[_0x02a2('0x10')](_0x02a2('0x18'),_0x57c205,JSON[_0x02a2('0x11')](_0x188af6));_0x4fd675(_0x188af6);})[_0x02a2('0x17')](function(_0x42cac4){logger['error'](_0x02a2('0x18'),_0x42cac4[_0x02a2('0x14')],_0x57c205);_0x20a9f4(_0x45db0a['error'](0x1f4,_0x42cac4[_0x02a2('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0xf88d5b){var _0x4e970e=this;return new Promise(function(_0x235855,_0x4c9e5c){return db[_0x02a2('0x19')][_0x02a2('0x21')]({'raw':_0xf88d5b[_0x02a2('0x1b')]?_0xf88d5b[_0x02a2('0x1b')][_0x02a2('0x1c')]===undefined?!![]:![]:!![],'where':_0xf88d5b[_0x02a2('0x1b')]?_0xf88d5b['options'][_0x02a2('0x22')]||null:null,'attributes':_0xf88d5b[_0x02a2('0x1b')]?_0xf88d5b[_0x02a2('0x1b')][_0x02a2('0x1d')]||null:null,'include':_0xf88d5b['options']?_0xf88d5b[_0x02a2('0x1b')]['include']?_[_0x02a2('0x1f')](_0xf88d5b[_0x02a2('0x1b')]['include'],function(_0x372bd4){return{'model':db[_0x372bd4[_0x02a2('0x20')]],'as':_0x372bd4['as'],'attributes':_0x372bd4[_0x02a2('0x1d')],'include':_0x372bd4[_0x02a2('0x1e')]?_['map'](_0x372bd4[_0x02a2('0x1e')],function(_0x4f5803){return{'model':db[_0x4f5803[_0x02a2('0x20')]],'as':_0x4f5803['as'],'attributes':_0x4f5803[_0x02a2('0x1d')],'include':_0x4f5803['include']?_[_0x02a2('0x1f')](_0x4f5803['include'],function(_0x35b450){return{'model':db[_0x35b450['model']],'as':_0x35b450['as'],'attributes':_0x35b450['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f4d3e){logger['info']('ShowOpenchannelQueue',_0xf88d5b);logger[_0x02a2('0x10')](_0x02a2('0x23'),_0xf88d5b,JSON[_0x02a2('0x11')](_0x2f4d3e));_0x235855(_0x2f4d3e);})[_0x02a2('0x17')](function(_0x3b1fb4){logger[_0x02a2('0x12')]('ShowOpenchannelQueue',_0x3b1fb4['message'],_0xf88d5b);_0x4c9e5c(_0x4e970e['error'](0x1f4,_0x3b1fb4[_0x02a2('0x14')]));});});}; \ No newline at end of file +var _0x3e57=['error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','map','include','model','stringify','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1f7274,_0x9a9c2){var _0x4521cc=function(_0xe5660d){while(--_0xe5660d){_0x1f7274['push'](_0x1f7274['shift']());}};_0x4521cc(++_0x9a9c2);}(_0x3e57,0xae));var _0x73e5=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x3e57[_0x5bf420];return _0x1c5255;};'use strict';var _=require(_0x73e5('0x0'));var util=require(_0x73e5('0x1'));var moment=require(_0x73e5('0x2'));var BPromise=require(_0x73e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73e5('0x4'));var db=require(_0x73e5('0x5'))['db'];var utils=require(_0x73e5('0x6'));var logger=require('../../config/logger')(_0x73e5('0x7'));var config=require(_0x73e5('0x8'));var jayson=require(_0x73e5('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x73e5('0xa')],{'host':_0x73e5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x73e5('0xc'))[_0x73e5('0xd')](socket);function respondWithRpcPromise(_0x20f7da,_0x49aa8c,_0x34267f){return new BPromise(function(_0x4467b7,_0x6df7ff){return client[_0x73e5('0xe')](_0x20f7da,_0x34267f)[_0x73e5('0xf')](function(_0x41e5db){logger[_0x73e5('0x10')](_0x73e5('0x11'),_0x49aa8c,_0x73e5('0x12'));logger[_0x73e5('0x13')](_0x73e5('0x14'),_0x49aa8c,_0x73e5('0x12'),JSON['stringify'](_0x41e5db));if(_0x41e5db[_0x73e5('0x15')]){if(_0x41e5db[_0x73e5('0x15')][_0x73e5('0x16')]===0x1f4){logger[_0x73e5('0x15')](_0x73e5('0x11'),_0x49aa8c,_0x41e5db['error'][_0x73e5('0x17')]);return _0x6df7ff(_0x41e5db[_0x73e5('0x15')][_0x73e5('0x17')]);}logger[_0x73e5('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x49aa8c,_0x41e5db['error'][_0x73e5('0x17')]);return _0x4467b7(_0x41e5db[_0x73e5('0x15')][_0x73e5('0x17')]);}else{logger[_0x73e5('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x49aa8c,_0x73e5('0x12'));_0x4467b7(_0x41e5db[_0x73e5('0x18')]['message']);}})[_0x73e5('0x19')](function(_0x55d849){logger[_0x73e5('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x49aa8c,_0x55d849);_0x6df7ff(_0x55d849);});});}exports[_0x73e5('0x1a')]=function(_0x58cb53){var _0x10e3f9=this;return new Promise(function(_0x48045d,_0xaab8ad){return db[_0x73e5('0x1b')][_0x73e5('0x1c')]({'raw':_0x58cb53[_0x73e5('0x1d')]?_0x58cb53[_0x73e5('0x1d')][_0x73e5('0x1e')]===undefined?!![]:![]:!![],'where':_0x58cb53[_0x73e5('0x1d')]?_0x58cb53[_0x73e5('0x1d')][_0x73e5('0x1f')]||null:null,'attributes':_0x58cb53[_0x73e5('0x1d')]?_0x58cb53[_0x73e5('0x1d')][_0x73e5('0x20')]||null:null,'limit':_0x58cb53[_0x73e5('0x1d')]?_0x58cb53[_0x73e5('0x1d')]['limit']||null:null,'include':_0x58cb53['options']?_0x58cb53[_0x73e5('0x1d')]['include']?_[_0x73e5('0x21')](_0x58cb53[_0x73e5('0x1d')][_0x73e5('0x22')],function(_0x402362){return{'model':db[_0x402362[_0x73e5('0x23')]],'as':_0x402362['as'],'attributes':_0x402362['attributes'],'include':_0x402362['include']?_[_0x73e5('0x21')](_0x402362[_0x73e5('0x22')],function(_0x5799de){return{'model':db[_0x5799de[_0x73e5('0x23')]],'as':_0x5799de['as'],'attributes':_0x5799de[_0x73e5('0x20')],'include':_0x5799de[_0x73e5('0x22')]?_[_0x73e5('0x21')](_0x5799de[_0x73e5('0x22')],function(_0x8099c6){return{'model':db[_0x8099c6['model']],'as':_0x8099c6['as'],'attributes':_0x8099c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x73e5('0xf')](function(_0x1053d9){logger['info'](_0x73e5('0x1a'),_0x58cb53);logger['debug'](_0x73e5('0x1a'),_0x58cb53,JSON[_0x73e5('0x24')](_0x1053d9));_0x48045d(_0x1053d9);})['catch'](function(_0x1f717d){logger[_0x73e5('0x15')]('GetOpenchannelQueue',_0x1f717d['message'],_0x58cb53);_0xaab8ad(_0x10e3f9[_0x73e5('0x15')](0x1f4,_0x1f717d[_0x73e5('0x17')]));});});};exports[_0x73e5('0x25')]=function(_0x5990d1){var _0x2cc39e=this;return new Promise(function(_0x25bd48,_0x5dd8d6){return db[_0x73e5('0x1b')][_0x73e5('0x26')]({'raw':_0x5990d1['options']?_0x5990d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x5990d1[_0x73e5('0x1d')]?_0x5990d1[_0x73e5('0x1d')][_0x73e5('0x1f')]||null:null,'attributes':_0x5990d1[_0x73e5('0x1d')]?_0x5990d1[_0x73e5('0x1d')][_0x73e5('0x20')]||null:null,'include':_0x5990d1[_0x73e5('0x1d')]?_0x5990d1[_0x73e5('0x1d')][_0x73e5('0x22')]?_[_0x73e5('0x21')](_0x5990d1[_0x73e5('0x1d')][_0x73e5('0x22')],function(_0x50f0c8){return{'model':db[_0x50f0c8[_0x73e5('0x23')]],'as':_0x50f0c8['as'],'attributes':_0x50f0c8[_0x73e5('0x20')],'include':_0x50f0c8[_0x73e5('0x22')]?_[_0x73e5('0x21')](_0x50f0c8[_0x73e5('0x22')],function(_0x1b892c){return{'model':db[_0x1b892c[_0x73e5('0x23')]],'as':_0x1b892c['as'],'attributes':_0x1b892c[_0x73e5('0x20')],'include':_0x1b892c[_0x73e5('0x22')]?_[_0x73e5('0x21')](_0x1b892c['include'],function(_0x565da6){return{'model':db[_0x565da6['model']],'as':_0x565da6['as'],'attributes':_0x565da6[_0x73e5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x73e5('0xf')](function(_0x8d6aeb){logger[_0x73e5('0x10')](_0x73e5('0x25'),_0x5990d1);logger[_0x73e5('0x13')](_0x73e5('0x25'),_0x5990d1,JSON[_0x73e5('0x24')](_0x8d6aeb));_0x25bd48(_0x8d6aeb);})[_0x73e5('0x19')](function(_0x35389e){logger[_0x73e5('0x15')](_0x73e5('0x25'),_0x35389e['message'],_0x5990d1);_0x5dd8d6(_0x2cc39e[_0x73e5('0x15')](0x1f4,_0x35389e[_0x73e5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8d8bcad..e1208eb 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 _0xbbd8=['emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x194fc6,_0x47bf1d){var _0xfdd5dc=function(_0x4b5d90){while(--_0x4b5d90){_0x194fc6['push'](_0x194fc6['shift']());}};_0xfdd5dc(++_0x47bf1d);}(_0xbbd8,0x17c));var _0x8bbd=function(_0x1be4af,_0x1d9164){_0x1be4af=_0x1be4af-0x0;var _0xa960c4=_0xbbd8[_0x1be4af];return _0xa960c4;};'use strict';var OpenchannelQueueEvents=require(_0x8bbd('0x0'));var events=[_0x8bbd('0x1'),_0x8bbd('0x2'),_0x8bbd('0x3')];function createListener(_0x77c805,_0x2a6cea){return function(_0x420bf7){_0x2a6cea[_0x8bbd('0x4')](_0x77c805,_0x420bf7);};}function removeListener(_0x4e62e6,_0x31e434){return function(){OpenchannelQueueEvents[_0x8bbd('0x5')](_0x4e62e6,_0x31e434);};}exports[_0x8bbd('0x6')]=function(_0x19a5b6){for(var _0x1833f6=0x0,_0x364958=events['length'];_0x1833f6<_0x364958;_0x1833f6++){var _0x228831=events[_0x1833f6];var _0x104963=createListener(_0x8bbd('0x7')+_0x228831,_0x19a5b6);OpenchannelQueueEvents['on'](_0x228831,_0x104963);}}; \ No newline at end of file +var _0xe3af=['remove','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x42e94d,_0x13d7df){var _0x23d492=function(_0x21c33f){while(--_0x21c33f){_0x42e94d['push'](_0x42e94d['shift']());}};_0x23d492(++_0x13d7df);}(_0xe3af,0x176));var _0xfe3a=function(_0x3a376f,_0x4694fb){_0x3a376f=_0x3a376f-0x0;var _0x2cc9ae=_0xe3af[_0x3a376f];return _0x2cc9ae;};'use strict';var OpenchannelQueueEvents=require(_0xfe3a('0x0'));var events=['save',_0xfe3a('0x1'),'update'];function createListener(_0x3a45c8,_0x147836){return function(_0xe68cec){_0x147836['emit'](_0x3a45c8,_0xe68cec);};}function removeListener(_0x4d279d,_0x385ff7){return function(){OpenchannelQueueEvents[_0xfe3a('0x2')](_0x4d279d,_0x385ff7);};}exports[_0xfe3a('0x3')]=function(_0x2635c8){for(var _0x3c9043=0x0,_0x3424c0=events['length'];_0x3c9043<_0x3424c0;_0x3c9043++){var _0x4151a7=events[_0x3c9043];var _0x12463f=createListener(_0xfe3a('0x4')+_0x4151a7,_0x2635c8);OpenchannelQueueEvents['on'](_0x4151a7,_0x12463f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c4cc155..45ebe6b 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 _0x60e9=['show','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x13b165,_0x16ef65){var _0x2caac2=function(_0x1d28ae){while(--_0x1d28ae){_0x13b165['push'](_0x13b165['shift']());}};_0x2caac2(++_0x16ef65);}(_0x60e9,0x1a3));var _0x960e=function(_0x17cc8d,_0x1465a1){_0x17cc8d=_0x17cc8d-0x0;var _0x2966c0=_0x60e9[_0x17cc8d];return _0x2966c0;};'use strict';var multer=require('multer');var util=require(_0x960e('0x0'));var path=require(_0x960e('0x1'));var timeout=require(_0x960e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x960e('0x3'));var interaction=require(_0x960e('0x4'));var config=require(_0x960e('0x5'));var controller=require(_0x960e('0x6'));router['get']('/',auth[_0x960e('0x7')](),controller[_0x960e('0x8')]);router[_0x960e('0x9')](_0x960e('0xa'),auth[_0x960e('0x7')](),controller[_0x960e('0xb')]);router['get'](_0x960e('0xc'),auth[_0x960e('0x7')](),controller[_0x960e('0xd')]);router['post']('/',auth[_0x960e('0x7')](),controller['create']);router['put'](_0x960e('0xc'),auth['isAuthenticated'](),controller[_0x960e('0xe')]);router[_0x960e('0xf')](_0x960e('0xc'),auth['isAuthenticated'](),controller[_0x960e('0x10')]);module[_0x960e('0x11')]=router; \ No newline at end of file +var _0xa30f=['/describe','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index'];(function(_0x2900bf,_0x396900){var _0x4ff896=function(_0x4366c7){while(--_0x4366c7){_0x2900bf['push'](_0x2900bf['shift']());}};_0x4ff896(++_0x396900);}(_0xa30f,0x1c0));var _0xfa30=function(_0x441b5c,_0x252121){_0x441b5c=_0x441b5c-0x0;var _0x2163f5=_0xa30f[_0x441b5c];return _0x2163f5;};'use strict';var multer=require(_0xfa30('0x0'));var util=require('util');var path=require(_0xfa30('0x1'));var timeout=require(_0xfa30('0x2'));var express=require(_0xfa30('0x3'));var router=express[_0xfa30('0x4')]();var fs_extra=require(_0xfa30('0x5'));var auth=require(_0xfa30('0x6'));var interaction=require(_0xfa30('0x7'));var config=require('../../config/environment');var controller=require(_0xfa30('0x8'));router[_0xfa30('0x9')]('/',auth[_0xfa30('0xa')](),controller[_0xfa30('0xb')]);router[_0xfa30('0x9')](_0xfa30('0xc'),auth[_0xfa30('0xa')](),controller['describe']);router[_0xfa30('0x9')](_0xfa30('0xd'),auth[_0xfa30('0xa')](),controller[_0xfa30('0xe')]);router[_0xfa30('0xf')]('/',auth[_0xfa30('0xa')](),controller['create']);router[_0xfa30('0x10')](_0xfa30('0xd'),auth[_0xfa30('0xa')](),controller[_0xfa30('0x11')]);router[_0xfa30('0x12')](_0xfa30('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa30('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1d61364..457ec92 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 _0xbcfe=['moment','exports','STRING','DATE'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbcfe,0x128));var _0xebcf=function(_0x346207,_0x2705aa){_0x346207=_0x346207-0x0;var _0x5e850b=_0xbcfe[_0x346207];return _0x5e850b;};'use strict';var moment=require(_0xebcf('0x0'));var Sequelize=require('sequelize');module[_0xebcf('0x1')]={'uniqueid':{'type':Sequelize[_0xebcf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xebcf('0x2')]},'joinAt':{'type':Sequelize[_0xebcf('0x3')]},'leaveAt':{'type':Sequelize[_0xebcf('0x3')]},'acceptAt':{'type':Sequelize[_0xebcf('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xebcf('0x2')]}}; \ No newline at end of file +var _0x5f79=['STRING','DATE','moment','exports'];(function(_0x37d28f,_0x345763){var _0x14e7f5=function(_0x527554){while(--_0x527554){_0x37d28f['push'](_0x37d28f['shift']());}};_0x14e7f5(++_0x345763);}(_0x5f79,0x146));var _0x95f7=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x5f79[_0x2605dc];return _0x4568c9;};'use strict';var moment=require(_0x95f7('0x0'));var Sequelize=require('sequelize');module[_0x95f7('0x1')]={'uniqueid':{'type':Sequelize[_0x95f7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x95f7('0x2')]},'joinAt':{'type':Sequelize[_0x95f7('0x3')]},'leaveAt':{'type':Sequelize[_0x95f7('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x95f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 46ce466..8e3c4ce 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 _0x1704=['map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','OpenchannelQueueReport','catch','show','keys','fields','includeAll','include','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1704,0xb5));var _0x4170=function(_0x3af8d3,_0x5ee12d){_0x3af8d3=_0x3af8d3-0x0;var _0x1f0654=_0x1704[_0x3af8d3];return _0x1f0654;};'use strict';var emlformat=require(_0x4170('0x0'));var rimraf=require(_0x4170('0x1'));var zipdir=require(_0x4170('0x2'));var jsonpatch=require(_0x4170('0x3'));var rp=require(_0x4170('0x4'));var moment=require(_0x4170('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4170('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4170('0x7'));var csv=require(_0x4170('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4170('0x9'));var _=require(_0x4170('0xa'));var squel=require(_0x4170('0xb'));var crypto=require(_0x4170('0xc'));var jsforce=require(_0x4170('0xd'));var deskjs=require(_0x4170('0xe'));var toCsv=require(_0x4170('0x8'));var querystring=require(_0x4170('0xf'));var Papa=require(_0x4170('0x10'));var Redis=require(_0x4170('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4170('0x12'));var logger=require(_0x4170('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4170('0x14'))['db'];function respondWithStatusCode(_0x5c042e,_0x5c26b0){_0x5c26b0=_0x5c26b0||0xcc;return function(_0x32426c){if(_0x32426c){return _0x5c042e[_0x4170('0x15')](_0x5c26b0);}return _0x5c042e[_0x4170('0x16')](_0x5c26b0)[_0x4170('0x17')]();};}function respondWithResult(_0xb6caf3,_0x3a3c8b){_0x3a3c8b=_0x3a3c8b||0xc8;return function(_0x124c5f){if(_0x124c5f){return _0xb6caf3[_0x4170('0x16')](_0x3a3c8b)['json'](_0x124c5f);}};}function respondWithFilteredResult(_0x1b9bd8,_0x47be5d){return function(_0x119085){if(_0x119085){var _0x53aed3=typeof _0x47be5d[_0x4170('0x18')]===_0x4170('0x19')&&typeof _0x47be5d['limit']===_0x4170('0x19');var _0x141ff0=_0x119085[_0x4170('0x1a')];var _0x3fc10e=_0x53aed3?0x0:_0x47be5d[_0x4170('0x18')];var _0x13ab15=_0x53aed3?_0x119085[_0x4170('0x1a')]:_0x47be5d[_0x4170('0x18')]+_0x47be5d['limit'];var _0x306e6c;if(_0x13ab15>=_0x141ff0){_0x13ab15=_0x141ff0;_0x306e6c=0xc8;}else{_0x306e6c=0xce;}_0x1b9bd8[_0x4170('0x16')](_0x306e6c);return _0x1b9bd8[_0x4170('0x1b')](_0x4170('0x1c'),_0x3fc10e+'-'+_0x13ab15+'/'+_0x141ff0)[_0x4170('0x1d')](_0x119085);}return null;};}function patchUpdates(_0x5b0df6){return function(_0x3bd121){try{jsonpatch[_0x4170('0x1e')](_0x3bd121,_0x5b0df6,!![]);}catch(_0x15fa79){return BPromise[_0x4170('0x1f')](_0x15fa79);}return _0x3bd121[_0x4170('0x20')]();};}function saveUpdates(_0x43b70e,_0x587ca3){return function(_0x3b8445){if(_0x3b8445){return _0x3b8445[_0x4170('0x21')](_0x43b70e)['then'](function(_0x3128c2){return _0x3128c2;});}return null;};}function removeEntity(_0x3fb0df,_0x120d03){return function(_0x2c84e1){if(_0x2c84e1){return _0x2c84e1[_0x4170('0x22')]()[_0x4170('0x23')](function(){_0x3fb0df[_0x4170('0x16')](0xcc)[_0x4170('0x17')]();});}};}function handleEntityNotFound(_0x4684bf,_0x3c8f88){return function(_0x34bb10){if(!_0x34bb10){_0x4684bf[_0x4170('0x15')](0x194);}return _0x34bb10;};}function handleError(_0x478171,_0x47a00f){_0x47a00f=_0x47a00f||0x1f4;return function(_0x47e780){logger[_0x4170('0x24')](_0x47e780[_0x4170('0x25')]);if(_0x47e780[_0x4170('0x26')]){delete _0x47e780[_0x4170('0x26')];}_0x478171[_0x4170('0x16')](_0x47a00f)[_0x4170('0x27')](_0x47e780);};}exports[_0x4170('0x28')]=function(_0x301ee7,_0x182753){var _0x59b18e={},_0x4cda1d={},_0xac5347={'count':0x0,'rows':[]};var _0x5dcb38=_[_0x4170('0x29')](db['OpenchannelQueueReport'][_0x4170('0x2a')],function(_0x1c8b4a){return{'name':_0x1c8b4a[_0x4170('0x2b')],'type':_0x1c8b4a[_0x4170('0x2c')][_0x4170('0x2d')]};});_0x4cda1d[_0x4170('0x2e')]=_[_0x4170('0x29')](_0x5dcb38,_0x4170('0x26'));_0x4cda1d[_0x4170('0x2f')]=_['keys'](_0x301ee7[_0x4170('0x2f')]);_0x4cda1d[_0x4170('0x30')]=_[_0x4170('0x31')](_0x4cda1d[_0x4170('0x2e')],_0x4cda1d['query']);_0x59b18e[_0x4170('0x32')]=_[_0x4170('0x31')](_0x4cda1d[_0x4170('0x2e')],qs['fields'](_0x301ee7[_0x4170('0x2f')]['fields']));_0x59b18e[_0x4170('0x32')]=_0x59b18e['attributes'][_0x4170('0x33')]?_0x59b18e[_0x4170('0x32')]:_0x4cda1d[_0x4170('0x2e')];if(!_0x301ee7[_0x4170('0x2f')][_0x4170('0x34')](_0x4170('0x35'))){_0x59b18e[_0x4170('0x36')]=qs['limit'](_0x301ee7[_0x4170('0x2f')][_0x4170('0x36')]);_0x59b18e[_0x4170('0x18')]=qs[_0x4170('0x18')](_0x301ee7[_0x4170('0x2f')][_0x4170('0x18')]);}_0x59b18e[_0x4170('0x37')]=qs[_0x4170('0x38')](_0x301ee7['query'][_0x4170('0x38')]);_0x59b18e[_0x4170('0x39')]=qs[_0x4170('0x30')](_['pick'](_0x301ee7[_0x4170('0x2f')],_0x4cda1d['filters']),_0x5dcb38);if(_0x301ee7['query'][_0x4170('0x3a')]){_0x59b18e[_0x4170('0x39')]=_['merge'](_0x59b18e[_0x4170('0x39')],{'$or':_[_0x4170('0x29')](_0x5dcb38,function(_0x14a679){if(_0x14a679[_0x4170('0x2c')]!==_0x4170('0x3b')){var _0x27968e={};_0x27968e[_0x14a679[_0x4170('0x26')]]={'$like':'%'+_0x301ee7[_0x4170('0x2f')][_0x4170('0x3a')]+'%'};return _0x27968e;}})});}_0x59b18e=_[_0x4170('0x3c')]({},_0x59b18e,_0x301ee7['options']);var _0x384308={'where':_0x59b18e[_0x4170('0x39')]};return db[_0x4170('0x3d')][_0x4170('0x1a')](_0x384308)[_0x4170('0x23')](function(_0x51b870){_0xac5347[_0x4170('0x1a')]=_0x51b870;if(_0x301ee7[_0x4170('0x2f')]['includeAll']){_0x59b18e['include']=[{'all':!![]}];}return db[_0x4170('0x3d')]['findAll'](_0x59b18e);})[_0x4170('0x23')](function(_0x278aaa){_0xac5347['rows']=_0x278aaa;return _0xac5347;})[_0x4170('0x23')](respondWithFilteredResult(_0x182753,_0x59b18e))[_0x4170('0x3e')](handleError(_0x182753,null));};exports[_0x4170('0x3f')]=function(_0x5d82a3,_0x2cb17a){var _0x400397={'raw':!![],'where':{'id':_0x5d82a3['params']['id']}},_0xa05374={};_0xa05374['model']=_[_0x4170('0x40')](db[_0x4170('0x3d')]['rawAttributes']);_0xa05374[_0x4170('0x2f')]=_[_0x4170('0x40')](_0x5d82a3[_0x4170('0x2f')]);_0xa05374[_0x4170('0x30')]=_[_0x4170('0x31')](_0xa05374[_0x4170('0x2e')],_0xa05374[_0x4170('0x2f')]);_0x400397[_0x4170('0x32')]=_[_0x4170('0x31')](_0xa05374[_0x4170('0x2e')],qs['fields'](_0x5d82a3[_0x4170('0x2f')][_0x4170('0x41')]));_0x400397[_0x4170('0x32')]=_0x400397[_0x4170('0x32')][_0x4170('0x33')]?_0x400397[_0x4170('0x32')]:_0xa05374[_0x4170('0x2e')];if(_0x5d82a3[_0x4170('0x2f')][_0x4170('0x42')]){_0x400397[_0x4170('0x43')]=[{'all':!![]}];}_0x400397=_[_0x4170('0x3c')]({},_0x400397,_0x5d82a3[_0x4170('0x44')]);return db[_0x4170('0x3d')]['find'](_0x400397)[_0x4170('0x23')](handleEntityNotFound(_0x2cb17a,null))[_0x4170('0x23')](respondWithResult(_0x2cb17a,null))[_0x4170('0x3e')](handleError(_0x2cb17a,null));};exports[_0x4170('0x45')]=function(_0x3378b0,_0x1ab37b){return db[_0x4170('0x3d')][_0x4170('0x45')](_0x3378b0['body'],{})[_0x4170('0x23')](respondWithResult(_0x1ab37b,0xc9))[_0x4170('0x3e')](handleError(_0x1ab37b,null));};exports['update']=function(_0x473aa4,_0x50857c){if(_0x473aa4[_0x4170('0x46')]['id']){delete _0x473aa4[_0x4170('0x46')]['id'];}return db[_0x4170('0x3d')][_0x4170('0x47')]({'where':{'id':_0x473aa4[_0x4170('0x48')]['id']}})[_0x4170('0x23')](handleEntityNotFound(_0x50857c,null))[_0x4170('0x23')](saveUpdates(_0x473aa4[_0x4170('0x46')],null))[_0x4170('0x23')](respondWithResult(_0x50857c,null))[_0x4170('0x3e')](handleError(_0x50857c,null));};exports['destroy']=function(_0x41ca7d,_0x5ade23){return db[_0x4170('0x3d')][_0x4170('0x47')]({'where':{'id':_0x41ca7d['params']['id']}})['then'](handleEntityNotFound(_0x5ade23,null))[_0x4170('0x23')](removeEntity(_0x5ade23,null))[_0x4170('0x3e')](handleError(_0x5ade23,null));};exports[_0x4170('0x49')]=function(_0x4edc20,_0x3e33c2){return db[_0x4170('0x3d')][_0x4170('0x49')]()[_0x4170('0x23')](respondWithResult(_0x3e33c2,null))[_0x4170('0x3e')](handleError(_0x3e33c2,null));}; \ No newline at end of file +var _0xf93b=['catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','filter','options','includeAll','findAll','params','keys','include','merge','find'];(function(_0x7508da,_0x55b651){var _0x4dbae5=function(_0x18b9e5){while(--_0x18b9e5){_0x7508da['push'](_0x7508da['shift']());}};_0x4dbae5(++_0x55b651);}(_0xf93b,0xeb));var _0xbf93=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xf93b[_0x2f71f6];return _0x2b23ea;};'use strict';var emlformat=require(_0xbf93('0x0'));var rimraf=require(_0xbf93('0x1'));var zipdir=require(_0xbf93('0x2'));var jsonpatch=require(_0xbf93('0x3'));var rp=require(_0xbf93('0x4'));var moment=require(_0xbf93('0x5'));var BPromise=require(_0xbf93('0x6'));var Mustache=require('mustache');var util=require(_0xbf93('0x7'));var path=require(_0xbf93('0x8'));var sox=require(_0xbf93('0x9'));var csv=require(_0xbf93('0xa'));var ejs=require(_0xbf93('0xb'));var fs=require('fs');var fs_extra=require(_0xbf93('0xc'));var _=require(_0xbf93('0xd'));var squel=require(_0xbf93('0xe'));var crypto=require(_0xbf93('0xf'));var jsforce=require(_0xbf93('0x10'));var deskjs=require(_0xbf93('0x11'));var toCsv=require(_0xbf93('0xa'));var querystring=require(_0xbf93('0x12'));var Papa=require('papaparse');var Redis=require(_0xbf93('0x13'));var authService=require(_0xbf93('0x14'));var qs=require(_0xbf93('0x15'));var as=require(_0xbf93('0x16'));var hardwareService=require(_0xbf93('0x17'));var logger=require('../../config/logger')(_0xbf93('0x18'));var utils=require(_0xbf93('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbf93('0x1a'));var db=require(_0xbf93('0x1b'))['db'];function respondWithStatusCode(_0x199a38,_0x31b682){_0x31b682=_0x31b682||0xcc;return function(_0x166667){if(_0x166667){return _0x199a38['sendStatus'](_0x31b682);}return _0x199a38[_0xbf93('0x1c')](_0x31b682)[_0xbf93('0x1d')]();};}function respondWithResult(_0x18ead0,_0x10aa70){_0x10aa70=_0x10aa70||0xc8;return function(_0x48431f){if(_0x48431f){return _0x18ead0[_0xbf93('0x1c')](_0x10aa70)[_0xbf93('0x1e')](_0x48431f);}};}function respondWithFilteredResult(_0x4d1d06,_0x2c124d){return function(_0x1c9a95){if(_0x1c9a95){var _0x27603c=typeof _0x2c124d[_0xbf93('0x1f')]===_0xbf93('0x20')&&typeof _0x2c124d['limit']===_0xbf93('0x20');var _0x432375=_0x1c9a95['count'];var _0x23f3ed=_0x27603c?0x0:_0x2c124d[_0xbf93('0x1f')];var _0x4daee7=_0x27603c?_0x1c9a95[_0xbf93('0x21')]:_0x2c124d['offset']+_0x2c124d[_0xbf93('0x22')];var _0xc72b3f;if(_0x4daee7>=_0x432375){_0x4daee7=_0x432375;_0xc72b3f=0xc8;}else{_0xc72b3f=0xce;}_0x4d1d06[_0xbf93('0x1c')](_0xc72b3f);return _0x4d1d06[_0xbf93('0x23')](_0xbf93('0x24'),_0x23f3ed+'-'+_0x4daee7+'/'+_0x432375)[_0xbf93('0x1e')](_0x1c9a95);}return null;};}function patchUpdates(_0x271c2e){return function(_0x47a005){try{jsonpatch[_0xbf93('0x25')](_0x47a005,_0x271c2e,!![]);}catch(_0x274da0){return BPromise[_0xbf93('0x26')](_0x274da0);}return _0x47a005[_0xbf93('0x27')]();};}function saveUpdates(_0x5e3c55,_0x5d6301){return function(_0xe0ba65){if(_0xe0ba65){return _0xe0ba65[_0xbf93('0x28')](_0x5e3c55)[_0xbf93('0x29')](function(_0x4a385d){return _0x4a385d;});}return null;};}function removeEntity(_0x44eb59,_0x442147){return function(_0x2a0d59){if(_0x2a0d59){return _0x2a0d59[_0xbf93('0x2a')]()['then'](function(){_0x44eb59[_0xbf93('0x1c')](0xcc)[_0xbf93('0x1d')]();});}};}function handleEntityNotFound(_0x25c8cf,_0x53ccaf){return function(_0x3f7e2f){if(!_0x3f7e2f){_0x25c8cf['sendStatus'](0x194);}return _0x3f7e2f;};}function handleError(_0xa2d1a1,_0x534d37){_0x534d37=_0x534d37||0x1f4;return function(_0x5dddf5){logger[_0xbf93('0x2b')](_0x5dddf5[_0xbf93('0x2c')]);if(_0x5dddf5[_0xbf93('0x2d')]){delete _0x5dddf5['name'];}_0xa2d1a1[_0xbf93('0x1c')](_0x534d37)[_0xbf93('0x2e')](_0x5dddf5);};}exports['index']=function(_0x3ce5e4,_0x2fad39){var _0x577b78={},_0x23357a={},_0x25c17f={'count':0x0,'rows':[]};var _0x114c3d=_[_0xbf93('0x2f')](db[_0xbf93('0x30')][_0xbf93('0x31')],function(_0x28c305){return{'name':_0x28c305[_0xbf93('0x32')],'type':_0x28c305[_0xbf93('0x33')]['key']};});_0x23357a['model']=_[_0xbf93('0x2f')](_0x114c3d,_0xbf93('0x2d'));_0x23357a[_0xbf93('0x34')]=_['keys'](_0x3ce5e4[_0xbf93('0x34')]);_0x23357a[_0xbf93('0x35')]=_[_0xbf93('0x36')](_0x23357a[_0xbf93('0x37')],_0x23357a[_0xbf93('0x34')]);_0x577b78[_0xbf93('0x38')]=_[_0xbf93('0x36')](_0x23357a[_0xbf93('0x37')],qs[_0xbf93('0x39')](_0x3ce5e4[_0xbf93('0x34')][_0xbf93('0x39')]));_0x577b78[_0xbf93('0x38')]=_0x577b78[_0xbf93('0x38')][_0xbf93('0x3a')]?_0x577b78[_0xbf93('0x38')]:_0x23357a[_0xbf93('0x37')];if(!_0x3ce5e4[_0xbf93('0x34')][_0xbf93('0x3b')](_0xbf93('0x3c'))){_0x577b78['limit']=qs[_0xbf93('0x22')](_0x3ce5e4['query'][_0xbf93('0x22')]);_0x577b78[_0xbf93('0x1f')]=qs['offset'](_0x3ce5e4['query'][_0xbf93('0x1f')]);}_0x577b78[_0xbf93('0x3d')]=qs['sort'](_0x3ce5e4[_0xbf93('0x34')]['sort']);_0x577b78['where']=qs[_0xbf93('0x35')](_[_0xbf93('0x3e')](_0x3ce5e4[_0xbf93('0x34')],_0x23357a[_0xbf93('0x35')]),_0x114c3d);if(_0x3ce5e4[_0xbf93('0x34')]['filter']){_0x577b78[_0xbf93('0x3f')]=_['merge'](_0x577b78[_0xbf93('0x3f')],{'$or':_[_0xbf93('0x2f')](_0x114c3d,function(_0x2bf059){if(_0x2bf059[_0xbf93('0x33')]!=='VIRTUAL'){var _0x3fcaee={};_0x3fcaee[_0x2bf059['name']]={'$like':'%'+_0x3ce5e4[_0xbf93('0x34')][_0xbf93('0x40')]+'%'};return _0x3fcaee;}})});}_0x577b78=_['merge']({},_0x577b78,_0x3ce5e4[_0xbf93('0x41')]);var _0x39e392={'where':_0x577b78[_0xbf93('0x3f')]};return db[_0xbf93('0x30')][_0xbf93('0x21')](_0x39e392)['then'](function(_0x4bc705){_0x25c17f[_0xbf93('0x21')]=_0x4bc705;if(_0x3ce5e4[_0xbf93('0x34')][_0xbf93('0x42')]){_0x577b78['include']=[{'all':!![]}];}return db[_0xbf93('0x30')][_0xbf93('0x43')](_0x577b78);})['then'](function(_0x53a188){_0x25c17f['rows']=_0x53a188;return _0x25c17f;})[_0xbf93('0x29')](respondWithFilteredResult(_0x2fad39,_0x577b78))['catch'](handleError(_0x2fad39,null));};exports['show']=function(_0x4eef22,_0x569d93){var _0x18cc77={'raw':!![],'where':{'id':_0x4eef22[_0xbf93('0x44')]['id']}},_0x190df6={};_0x190df6['model']=_[_0xbf93('0x45')](db[_0xbf93('0x30')][_0xbf93('0x31')]);_0x190df6[_0xbf93('0x34')]=_[_0xbf93('0x45')](_0x4eef22[_0xbf93('0x34')]);_0x190df6[_0xbf93('0x35')]=_[_0xbf93('0x36')](_0x190df6[_0xbf93('0x37')],_0x190df6[_0xbf93('0x34')]);_0x18cc77['attributes']=_[_0xbf93('0x36')](_0x190df6[_0xbf93('0x37')],qs[_0xbf93('0x39')](_0x4eef22[_0xbf93('0x34')]['fields']));_0x18cc77[_0xbf93('0x38')]=_0x18cc77['attributes'][_0xbf93('0x3a')]?_0x18cc77['attributes']:_0x190df6[_0xbf93('0x37')];if(_0x4eef22[_0xbf93('0x34')][_0xbf93('0x42')]){_0x18cc77[_0xbf93('0x46')]=[{'all':!![]}];}_0x18cc77=_[_0xbf93('0x47')]({},_0x18cc77,_0x4eef22[_0xbf93('0x41')]);return db[_0xbf93('0x30')][_0xbf93('0x48')](_0x18cc77)['then'](handleEntityNotFound(_0x569d93,null))[_0xbf93('0x29')](respondWithResult(_0x569d93,null))[_0xbf93('0x49')](handleError(_0x569d93,null));};exports[_0xbf93('0x4a')]=function(_0x44242c,_0x3a1e6f){return db['OpenchannelQueueReport'][_0xbf93('0x4a')](_0x44242c[_0xbf93('0x4b')],{})[_0xbf93('0x29')](respondWithResult(_0x3a1e6f,0xc9))[_0xbf93('0x49')](handleError(_0x3a1e6f,null));};exports[_0xbf93('0x28')]=function(_0x3dade9,_0x65dad3){if(_0x3dade9[_0xbf93('0x4b')]['id']){delete _0x3dade9[_0xbf93('0x4b')]['id'];}return db[_0xbf93('0x30')]['find']({'where':{'id':_0x3dade9[_0xbf93('0x44')]['id']}})[_0xbf93('0x29')](handleEntityNotFound(_0x65dad3,null))['then'](saveUpdates(_0x3dade9[_0xbf93('0x4b')],null))['then'](respondWithResult(_0x65dad3,null))[_0xbf93('0x49')](handleError(_0x65dad3,null));};exports[_0xbf93('0x2a')]=function(_0x309a0e,_0x2d4d51){return db['OpenchannelQueueReport'][_0xbf93('0x48')]({'where':{'id':_0x309a0e[_0xbf93('0x44')]['id']}})[_0xbf93('0x29')](handleEntityNotFound(_0x2d4d51,null))[_0xbf93('0x29')](removeEntity(_0x2d4d51,null))[_0xbf93('0x49')](handleError(_0x2d4d51,null));};exports[_0xbf93('0x4c')]=function(_0x59270f,_0x140e43){return db[_0xbf93('0x30')][_0xbf93('0x4c')]()[_0xbf93('0x29')](respondWithResult(_0x140e43,null))['catch'](handleError(_0x140e43,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ac207c4..d4c15ed 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x443e26,_0x57bcb4){var _0x3ec90a=function(_0x402efa){while(--_0x402efa){_0x443e26['push'](_0x443e26['shift']());}};_0x3ec90a(++_0x57bcb4);}(_0x2ef3,0xba));var _0x32ef=function(_0xd206cc,_0x3842a3){_0xd206cc=_0xd206cc-0x0;var _0x549ca1=_0x2ef3[_0xd206cc];return _0x549ca1;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x1d926f,_0x1c043d){var _0x137a15=function(_0x1546f5){while(--_0x1546f5){_0x1d926f['push'](_0x1d926f['shift']());}};_0x137a15(++_0x1c043d);}(_0x1261,0x144));var _0x1126=function(_0x5afbd5,_0x48a693){_0x5afbd5=_0x5afbd5-0x0;var _0x298511=_0x1261[_0x5afbd5];return _0x298511;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('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 af97869..267940b 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 _0x7d25=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x391f9b,_0x275a37){var _0x52cf58=function(_0xca13ce){while(--_0xca13ce){_0x391f9b['push'](_0x391f9b['shift']());}};_0x52cf58(++_0x275a37);}(_0x7d25,0x8a));var _0x57d2=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x7d25[_0x5627e1];return _0x2f013f;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')](_0x7d4cf1[_0x57d2('0x17')],{'raw':_0x7d4cf1[_0x57d2('0x18')]?_0x7d4cf1['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![]})[_0x57d2('0x1a')](function(_0x55191e){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x55191e));_0x4a94e3(_0x55191e);})[_0x57d2('0x13')](function(_0x803c25){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x803c25[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x803c25[_0x57d2('0x11')]));});});};exports[_0x57d2('0x1b')]=function(_0x12ff19){var _0x473df2=this;return new Promise(function(_0x5327ea,_0x424ddc){return db[_0x57d2('0x15')][_0x57d2('0x1c')](_0x12ff19[_0x57d2('0x17')],{'raw':_0x12ff19[_0x57d2('0x18')]?_0x12ff19['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12ff19[_0x57d2('0x18')]?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1d')]||null:null,'attributes':_0x12ff19[_0x57d2('0x18')]?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1e')]||null:null,'limit':_0x12ff19['options']?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1f')]||null:null})[_0x57d2('0x1a')](function(_0x1fe383){logger[_0x57d2('0x9')](_0x57d2('0x1b'),_0x12ff19);logger[_0x57d2('0xb')](_0x57d2('0x1b'),_0x12ff19,JSON[_0x57d2('0xe')](_0x1fe383));_0x5327ea(_0x1fe383);})[_0x57d2('0x13')](function(_0x574589){logger[_0x57d2('0xf')](_0x57d2('0x1b'),_0x574589[_0x57d2('0x11')],_0x12ff19);_0x424ddc(_0x473df2[_0x57d2('0xf')](0x1f4,_0x574589['message']));});});}; \ No newline at end of file +var _0xd290=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x3ff8d0,_0x3f9b20){var _0x3caeca=function(_0x1b15ff){while(--_0x1b15ff){_0x3ff8d0['push'](_0x3ff8d0['shift']());}};_0x3caeca(++_0x3f9b20);}(_0xd290,0x165));var _0x0d29=function(_0x275b85,_0x2f848c){_0x275b85=_0x275b85-0x0;var _0x58f1d7=_0xd290[_0x275b85];return _0x58f1d7;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151d32,_0x376d19,_0x276aeb){return new BPromise(function(_0x4edfcd,_0x3ee63c){return client[_0x0d29('0xa')](_0x151d32,_0x276aeb)[_0x0d29('0xb')](function(_0x4b876e){logger[_0x0d29('0xc')](_0x0d29('0xd'),_0x376d19,'request\x20sent');logger[_0x0d29('0xe')](_0x0d29('0xf'),_0x376d19,'request\x20sent',JSON[_0x0d29('0x10')](_0x4b876e));if(_0x4b876e['error']){if(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x12')]===0x1f4){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x3ee63c(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x13')]);}logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x4edfcd(_0x4b876e['error']['message']);}else{logger[_0x0d29('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x376d19,_0x0d29('0x14'));_0x4edfcd(_0x4b876e['result'][_0x0d29('0x13')]);}})[_0x0d29('0x15')](function(_0x2a04d6){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x2a04d6);_0x3ee63c(_0x2a04d6);});});}exports[_0x0d29('0x16')]=function(_0x488fa2){var _0x319a36=this;return new Promise(function(_0x2600b3,_0xca30af){return db[_0x0d29('0x17')][_0x0d29('0x18')](_0x488fa2[_0x0d29('0x19')],{'raw':_0x488fa2[_0x0d29('0x1a')]?_0x488fa2['options'][_0x0d29('0x1b')]===undefined?!![]:![]:!![]})[_0x0d29('0xb')](function(_0x215cd7){logger[_0x0d29('0xc')](_0x0d29('0x16'),_0x488fa2);logger[_0x0d29('0xe')](_0x0d29('0x16'),_0x488fa2,JSON[_0x0d29('0x10')](_0x215cd7));_0x2600b3(_0x215cd7);})[_0x0d29('0x15')](function(_0xed8228){logger[_0x0d29('0x11')](_0x0d29('0x16'),_0xed8228[_0x0d29('0x13')],_0x488fa2);_0xca30af(_0x319a36['error'](0x1f4,_0xed8228[_0x0d29('0x13')]));});});};exports[_0x0d29('0x1c')]=function(_0x2f0fe2){var _0xd3afa0=this;return new Promise(function(_0x4adc85,_0x249205){return db[_0x0d29('0x17')][_0x0d29('0x1d')](_0x2f0fe2[_0x0d29('0x19')],{'raw':_0x2f0fe2[_0x0d29('0x1a')]?_0x2f0fe2[_0x0d29('0x1a')][_0x0d29('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f0fe2['options']?_0x2f0fe2['options'][_0x0d29('0x1e')]||null:null,'attributes':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['attributes']||null:null,'limit':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['limit']||null:null})[_0x0d29('0xb')](function(_0x5c197f){logger[_0x0d29('0xc')](_0x0d29('0x1c'),_0x2f0fe2);logger['debug'](_0x0d29('0x1c'),_0x2f0fe2,JSON[_0x0d29('0x10')](_0x5c197f));_0x4adc85(_0x5c197f);})[_0x0d29('0x15')](function(_0x58caa6){logger[_0x0d29('0x11')](_0x0d29('0x1c'),_0x58caa6[_0x0d29('0x13')],_0x2f0fe2);_0x249205(_0xd3afa0[_0x0d29('0x11')](0x1f4,_0x58caa6[_0x0d29('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1fd6a19..c4938fa 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 _0xc144=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','path'];(function(_0x275a1e,_0x399674){var _0x367ee9=function(_0x89bca9){while(--_0x89bca9){_0x275a1e['push'](_0x275a1e['shift']());}};_0x367ee9(++_0x399674);}(_0xc144,0x15e));var _0x4c14=function(_0x3d226c,_0x5e6f89){_0x3d226c=_0x3d226c-0x0;var _0x28bebf=_0xc144[_0x3d226c];return _0x28bebf;};'use strict';var multer=require('multer');var util=require(_0x4c14('0x0'));var path=require(_0x4c14('0x1'));var timeout=require(_0x4c14('0x2'));var express=require(_0x4c14('0x3'));var router=express['Router']();var fs_extra=require(_0x4c14('0x4'));var auth=require(_0x4c14('0x5'));var interaction=require(_0x4c14('0x6'));var config=require(_0x4c14('0x7'));var controller=require(_0x4c14('0x8'));router['get']('/',auth[_0x4c14('0x9')](),controller[_0x4c14('0xa')]);router[_0x4c14('0xb')](_0x4c14('0xc'),auth['isAuthenticated'](),controller[_0x4c14('0xd')]);router['get'](_0x4c14('0xe'),auth['isAuthenticated'](),controller[_0x4c14('0xf')]);router[_0x4c14('0x10')]('/',auth[_0x4c14('0x9')](),controller['create']);router[_0x4c14('0x11')](_0x4c14('0xe'),auth[_0x4c14('0x9')](),controller[_0x4c14('0x12')]);router[_0x4c14('0x13')]('/:id',auth[_0x4c14('0x9')](),controller[_0x4c14('0x14')]);module[_0x4c14('0x15')]=router; \ No newline at end of file +var _0x1779=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x34439e,_0x3cc308){var _0x13f3f5=function(_0x57a28e){while(--_0x57a28e){_0x34439e['push'](_0x34439e['shift']());}};_0x13f3f5(++_0x3cc308);}(_0x1779,0x1a4));var _0x9177=function(_0x17f040,_0x20654f){_0x17f040=_0x17f040-0x0;var _0x407884=_0x1779[_0x17f040];return _0x407884;};'use strict';var multer=require(_0x9177('0x0'));var util=require('util');var path=require(_0x9177('0x1'));var timeout=require(_0x9177('0x2'));var express=require(_0x9177('0x3'));var router=express[_0x9177('0x4')]();var fs_extra=require(_0x9177('0x5'));var auth=require(_0x9177('0x6'));var interaction=require(_0x9177('0x7'));var config=require(_0x9177('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x9177('0x9')]('/',auth['isAuthenticated'](),controller[_0x9177('0xa')]);router['get'](_0x9177('0xb'),auth[_0x9177('0xc')](),controller[_0x9177('0xd')]);router['get'](_0x9177('0xe'),auth[_0x9177('0xc')](),controller[_0x9177('0xf')]);router[_0x9177('0x10')]('/',auth[_0x9177('0xc')](),controller[_0x9177('0x11')]);router[_0x9177('0x12')](_0x9177('0xe'),auth['isAuthenticated'](),controller[_0x9177('0x13')]);router[_0x9177('0x14')](_0x9177('0xe'),auth[_0x9177('0xc')](),controller[_0x9177('0x15')]);module[_0x9177('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 91fcf5a..db71536 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x5538b3,_0x402023){var _0x43ddfe=function(_0x4e7870){while(--_0x4e7870){_0x5538b3['push'](_0x5538b3['shift']());}};_0x43ddfe(++_0x402023);}(_0x54ef,0x112));var _0xf54e=function(_0x3ca563,_0x44e561){_0x3ca563=_0x3ca563-0x0;var _0xdd2c70=_0x54ef[_0x3ca563];return _0xdd2c70;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x47da8d,_0x517e13){var _0x5aabef=function(_0x2528d7){while(--_0x2528d7){_0x47da8d['push'](_0x47da8d['shift']());}};_0x5aabef(++_0x517e13);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8a4cb4f..ec6e817 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 _0x3911=['find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','OpenchannelTransferReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','pick','filters','filter','merge','where','map','options','count','include','findAll','rows','catch','show','params','includeAll'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x3911,0x93));var _0x1391=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0x3911[_0x1d3791];return _0x40fbf5;};'use strict';var emlformat=require(_0x1391('0x0'));var rimraf=require(_0x1391('0x1'));var zipdir=require(_0x1391('0x2'));var jsonpatch=require(_0x1391('0x3'));var rp=require(_0x1391('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1391('0x5'));var util=require(_0x1391('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1391('0x7'));var ejs=require(_0x1391('0x8'));var fs=require('fs');var fs_extra=require(_0x1391('0x9'));var _=require(_0x1391('0xa'));var squel=require(_0x1391('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1391('0xc'));var Redis=require('ioredis');var authService=require(_0x1391('0xd'));var qs=require(_0x1391('0xe'));var as=require(_0x1391('0xf'));var hardwareService=require(_0x1391('0x10'));var logger=require(_0x1391('0x11'))(_0x1391('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1391('0x13'))['db'];function respondWithStatusCode(_0xd7cd45,_0x2ea7fa){_0x2ea7fa=_0x2ea7fa||0xcc;return function(_0x2cdc0c){if(_0x2cdc0c){return _0xd7cd45[_0x1391('0x14')](_0x2ea7fa);}return _0xd7cd45['status'](_0x2ea7fa)[_0x1391('0x15')]();};}function respondWithResult(_0x3215f9,_0x529dd8){_0x529dd8=_0x529dd8||0xc8;return function(_0xa66cc5){if(_0xa66cc5){return _0x3215f9[_0x1391('0x16')](_0x529dd8)[_0x1391('0x17')](_0xa66cc5);}};}function respondWithFilteredResult(_0x312b4d,_0x1375a6){return function(_0x599e30){if(_0x599e30){var _0x3a1ab7=typeof _0x1375a6[_0x1391('0x18')]===_0x1391('0x19')&&typeof _0x1375a6[_0x1391('0x1a')]===_0x1391('0x19');var _0x557698=_0x599e30['count'];var _0xb7bdd=_0x3a1ab7?0x0:_0x1375a6[_0x1391('0x18')];var _0x1f486b=_0x3a1ab7?_0x599e30['count']:_0x1375a6[_0x1391('0x18')]+_0x1375a6[_0x1391('0x1a')];var _0x265faf;if(_0x1f486b>=_0x557698){_0x1f486b=_0x557698;_0x265faf=0xc8;}else{_0x265faf=0xce;}_0x312b4d[_0x1391('0x16')](_0x265faf);return _0x312b4d[_0x1391('0x1b')](_0x1391('0x1c'),_0xb7bdd+'-'+_0x1f486b+'/'+_0x557698)['json'](_0x599e30);}return null;};}function patchUpdates(_0x1b9f49){return function(_0x3b7c4f){try{jsonpatch[_0x1391('0x1d')](_0x3b7c4f,_0x1b9f49,!![]);}catch(_0x279d34){return BPromise[_0x1391('0x1e')](_0x279d34);}return _0x3b7c4f[_0x1391('0x1f')]();};}function saveUpdates(_0x5bf94b,_0x193cef){return function(_0x19dc53){if(_0x19dc53){return _0x19dc53[_0x1391('0x20')](_0x5bf94b)[_0x1391('0x21')](function(_0x4761b7){return _0x4761b7;});}return null;};}function removeEntity(_0x10e9db,_0x222006){return function(_0x476497){if(_0x476497){return _0x476497['destroy']()['then'](function(){_0x10e9db['status'](0xcc)[_0x1391('0x15')]();});}};}function handleEntityNotFound(_0x40bac0,_0x4f59b6){return function(_0x1adafd){if(!_0x1adafd){_0x40bac0[_0x1391('0x14')](0x194);}return _0x1adafd;};}function handleError(_0x3ed527,_0x1cfced){_0x1cfced=_0x1cfced||0x1f4;return function(_0x23cc3b){logger[_0x1391('0x22')](_0x23cc3b['stack']);if(_0x23cc3b[_0x1391('0x23')]){delete _0x23cc3b[_0x1391('0x23')];}_0x3ed527['status'](_0x1cfced)[_0x1391('0x24')](_0x23cc3b);};}exports[_0x1391('0x25')]=function(_0x2400f5,_0x4a8750){var _0x2d426f={},_0x5ec7fc={},_0x1762d1={'count':0x0,'rows':[]};var _0x113c51=_['map'](db[_0x1391('0x26')]['rawAttributes'],function(_0x4be3a0){return{'name':_0x4be3a0[_0x1391('0x27')],'type':_0x4be3a0[_0x1391('0x28')][_0x1391('0x29')]};});_0x5ec7fc[_0x1391('0x2a')]=_['map'](_0x113c51,_0x1391('0x23'));_0x5ec7fc[_0x1391('0x2b')]=_[_0x1391('0x2c')](_0x2400f5['query']);_0x5ec7fc['filters']=_['intersection'](_0x5ec7fc[_0x1391('0x2a')],_0x5ec7fc[_0x1391('0x2b')]);_0x2d426f[_0x1391('0x2d')]=_[_0x1391('0x2e')](_0x5ec7fc['model'],qs['fields'](_0x2400f5[_0x1391('0x2b')][_0x1391('0x2f')]));_0x2d426f[_0x1391('0x2d')]=_0x2d426f[_0x1391('0x2d')][_0x1391('0x30')]?_0x2d426f[_0x1391('0x2d')]:_0x5ec7fc[_0x1391('0x2a')];if(!_0x2400f5[_0x1391('0x2b')]['hasOwnProperty'](_0x1391('0x31'))){_0x2d426f[_0x1391('0x1a')]=qs[_0x1391('0x1a')](_0x2400f5[_0x1391('0x2b')][_0x1391('0x1a')]);_0x2d426f['offset']=qs[_0x1391('0x18')](_0x2400f5[_0x1391('0x2b')][_0x1391('0x18')]);}_0x2d426f['order']=qs[_0x1391('0x32')](_0x2400f5['query'][_0x1391('0x32')]);_0x2d426f['where']=qs['filters'](_[_0x1391('0x33')](_0x2400f5[_0x1391('0x2b')],_0x5ec7fc[_0x1391('0x34')]),_0x113c51);if(_0x2400f5[_0x1391('0x2b')][_0x1391('0x35')]){_0x2d426f['where']=_[_0x1391('0x36')](_0x2d426f[_0x1391('0x37')],{'$or':_[_0x1391('0x38')](_0x113c51,function(_0x5d3f75){if(_0x5d3f75[_0x1391('0x28')]!=='VIRTUAL'){var _0x4b8882={};_0x4b8882[_0x5d3f75['name']]={'$like':'%'+_0x2400f5['query'][_0x1391('0x35')]+'%'};return _0x4b8882;}})});}_0x2d426f=_[_0x1391('0x36')]({},_0x2d426f,_0x2400f5[_0x1391('0x39')]);var _0x700c25={'where':_0x2d426f[_0x1391('0x37')]};return db[_0x1391('0x26')][_0x1391('0x3a')](_0x700c25)['then'](function(_0x48b594){_0x1762d1['count']=_0x48b594;if(_0x2400f5['query']['includeAll']){_0x2d426f[_0x1391('0x3b')]=[{'all':!![]}];}return db[_0x1391('0x26')][_0x1391('0x3c')](_0x2d426f);})[_0x1391('0x21')](function(_0x2ad0a4){_0x1762d1[_0x1391('0x3d')]=_0x2ad0a4;return _0x1762d1;})['then'](respondWithFilteredResult(_0x4a8750,_0x2d426f))[_0x1391('0x3e')](handleError(_0x4a8750,null));};exports[_0x1391('0x3f')]=function(_0x387c87,_0x60a9ba){var _0x397d65={'raw':!![],'where':{'id':_0x387c87[_0x1391('0x40')]['id']}},_0x17b99f={};_0x17b99f['model']=_['keys'](db[_0x1391('0x26')]['rawAttributes']);_0x17b99f[_0x1391('0x2b')]=_['keys'](_0x387c87[_0x1391('0x2b')]);_0x17b99f[_0x1391('0x34')]=_[_0x1391('0x2e')](_0x17b99f[_0x1391('0x2a')],_0x17b99f[_0x1391('0x2b')]);_0x397d65['attributes']=_['intersection'](_0x17b99f[_0x1391('0x2a')],qs[_0x1391('0x2f')](_0x387c87['query'][_0x1391('0x2f')]));_0x397d65[_0x1391('0x2d')]=_0x397d65[_0x1391('0x2d')][_0x1391('0x30')]?_0x397d65['attributes']:_0x17b99f[_0x1391('0x2a')];if(_0x387c87[_0x1391('0x2b')][_0x1391('0x41')]){_0x397d65[_0x1391('0x3b')]=[{'all':!![]}];}_0x397d65=_['merge']({},_0x397d65,_0x387c87['options']);return db['OpenchannelTransferReport'][_0x1391('0x42')](_0x397d65)[_0x1391('0x21')](handleEntityNotFound(_0x60a9ba,null))['then'](respondWithResult(_0x60a9ba,null))[_0x1391('0x3e')](handleError(_0x60a9ba,null));};exports[_0x1391('0x43')]=function(_0x4f137c,_0x5216bb){return db['OpenchannelTransferReport'][_0x1391('0x43')](_0x4f137c[_0x1391('0x44')],{})[_0x1391('0x21')](respondWithResult(_0x5216bb,0xc9))[_0x1391('0x3e')](handleError(_0x5216bb,null));};exports[_0x1391('0x20')]=function(_0x38d3c4,_0x599bdd){if(_0x38d3c4['body']['id']){delete _0x38d3c4[_0x1391('0x44')]['id'];}return db[_0x1391('0x26')]['find']({'where':{'id':_0x38d3c4['params']['id']}})[_0x1391('0x21')](handleEntityNotFound(_0x599bdd,null))[_0x1391('0x21')](saveUpdates(_0x38d3c4['body'],null))[_0x1391('0x21')](respondWithResult(_0x599bdd,null))[_0x1391('0x3e')](handleError(_0x599bdd,null));};exports[_0x1391('0x45')]=function(_0x156edd,_0x4448e0){return db['OpenchannelTransferReport'][_0x1391('0x42')]({'where':{'id':_0x156edd[_0x1391('0x40')]['id']}})[_0x1391('0x21')](handleEntityNotFound(_0x4448e0,null))['then'](removeEntity(_0x4448e0,null))[_0x1391('0x3e')](handleError(_0x4448e0,null));};exports[_0x1391('0x46')]=function(_0x35fdef,_0xf20858){return db[_0x1391('0x26')]['describe']()[_0x1391('0x21')](respondWithResult(_0xf20858,null))[_0x1391('0x3e')](handleError(_0xf20858,null));}; \ No newline at end of file +var _0x3bcb=['model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','options','includeAll','findAll','rows','show','params','include','merge','find','create','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x3bcb,0x18c));var _0xb3bc=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x3bcb[_0x5af97c];return _0x3472ae;};'use strict';var emlformat=require(_0xb3bc('0x0'));var rimraf=require(_0xb3bc('0x1'));var zipdir=require(_0xb3bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3bc('0x3'));var moment=require(_0xb3bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb3bc('0x5'));var util=require(_0xb3bc('0x6'));var path=require(_0xb3bc('0x7'));var sox=require(_0xb3bc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3bc('0x9'));var _=require(_0xb3bc('0xa'));var squel=require(_0xb3bc('0xb'));var crypto=require(_0xb3bc('0xc'));var jsforce=require(_0xb3bc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb3bc('0xe'));var querystring=require('querystring');var Papa=require(_0xb3bc('0xf'));var Redis=require('ioredis');var authService=require(_0xb3bc('0x10'));var qs=require(_0xb3bc('0x11'));var as=require(_0xb3bc('0x12'));var hardwareService=require(_0xb3bc('0x13'));var logger=require(_0xb3bc('0x14'))(_0xb3bc('0x15'));var utils=require(_0xb3bc('0x16'));var config=require(_0xb3bc('0x17'));var licenseUtil=require(_0xb3bc('0x18'));var db=require(_0xb3bc('0x19'))['db'];function respondWithStatusCode(_0x226cd4,_0x19c871){_0x19c871=_0x19c871||0xcc;return function(_0x49e3e1){if(_0x49e3e1){return _0x226cd4[_0xb3bc('0x1a')](_0x19c871);}return _0x226cd4[_0xb3bc('0x1b')](_0x19c871)[_0xb3bc('0x1c')]();};}function respondWithResult(_0x2b2220,_0x170bac){_0x170bac=_0x170bac||0xc8;return function(_0x2dd746){if(_0x2dd746){return _0x2b2220[_0xb3bc('0x1b')](_0x170bac)['json'](_0x2dd746);}};}function respondWithFilteredResult(_0x5b3db3,_0x4dc9d5){return function(_0x352c4d){if(_0x352c4d){var _0x21a72b=typeof _0x4dc9d5[_0xb3bc('0x1d')]===_0xb3bc('0x1e')&&typeof _0x4dc9d5[_0xb3bc('0x1f')]===_0xb3bc('0x1e');var _0x5bb399=_0x352c4d[_0xb3bc('0x20')];var _0x53e13a=_0x21a72b?0x0:_0x4dc9d5[_0xb3bc('0x1d')];var _0x2e6d0e=_0x21a72b?_0x352c4d[_0xb3bc('0x20')]:_0x4dc9d5['offset']+_0x4dc9d5[_0xb3bc('0x1f')];var _0x563f5e;if(_0x2e6d0e>=_0x5bb399){_0x2e6d0e=_0x5bb399;_0x563f5e=0xc8;}else{_0x563f5e=0xce;}_0x5b3db3[_0xb3bc('0x1b')](_0x563f5e);return _0x5b3db3[_0xb3bc('0x21')]('Content-Range',_0x53e13a+'-'+_0x2e6d0e+'/'+_0x5bb399)[_0xb3bc('0x22')](_0x352c4d);}return null;};}function patchUpdates(_0x365db0){return function(_0x3a33c7){try{jsonpatch['apply'](_0x3a33c7,_0x365db0,!![]);}catch(_0x58693c){return BPromise['reject'](_0x58693c);}return _0x3a33c7['save']();};}function saveUpdates(_0xc67fc4,_0x4ff924){return function(_0x1cfe2d){if(_0x1cfe2d){return _0x1cfe2d[_0xb3bc('0x23')](_0xc67fc4)[_0xb3bc('0x24')](function(_0x1b2c58){return _0x1b2c58;});}return null;};}function removeEntity(_0x585922,_0x2be0d5){return function(_0x272975){if(_0x272975){return _0x272975[_0xb3bc('0x25')]()[_0xb3bc('0x24')](function(){_0x585922[_0xb3bc('0x1b')](0xcc)[_0xb3bc('0x1c')]();});}};}function handleEntityNotFound(_0x2614fa,_0x65694f){return function(_0x4e107a){if(!_0x4e107a){_0x2614fa[_0xb3bc('0x1a')](0x194);}return _0x4e107a;};}function handleError(_0x27f51a,_0x4f9623){_0x4f9623=_0x4f9623||0x1f4;return function(_0x348c6f){logger[_0xb3bc('0x26')](_0x348c6f['stack']);if(_0x348c6f[_0xb3bc('0x27')]){delete _0x348c6f[_0xb3bc('0x27')];}_0x27f51a[_0xb3bc('0x1b')](_0x4f9623)[_0xb3bc('0x28')](_0x348c6f);};}exports[_0xb3bc('0x29')]=function(_0x206ede,_0x4d401d){var _0x1d29e6={},_0x582ece={},_0x1e34a4={'count':0x0,'rows':[]};var _0x56f644=_[_0xb3bc('0x2a')](db[_0xb3bc('0x2b')][_0xb3bc('0x2c')],function(_0x5cbe7c){return{'name':_0x5cbe7c[_0xb3bc('0x2d')],'type':_0x5cbe7c[_0xb3bc('0x2e')][_0xb3bc('0x2f')]};});_0x582ece[_0xb3bc('0x30')]=_[_0xb3bc('0x2a')](_0x56f644,_0xb3bc('0x27'));_0x582ece['query']=_[_0xb3bc('0x31')](_0x206ede['query']);_0x582ece[_0xb3bc('0x32')]=_[_0xb3bc('0x33')](_0x582ece[_0xb3bc('0x30')],_0x582ece[_0xb3bc('0x34')]);_0x1d29e6[_0xb3bc('0x35')]=_[_0xb3bc('0x33')](_0x582ece['model'],qs[_0xb3bc('0x36')](_0x206ede[_0xb3bc('0x34')][_0xb3bc('0x36')]));_0x1d29e6['attributes']=_0x1d29e6[_0xb3bc('0x35')][_0xb3bc('0x37')]?_0x1d29e6[_0xb3bc('0x35')]:_0x582ece[_0xb3bc('0x30')];if(!_0x206ede[_0xb3bc('0x34')][_0xb3bc('0x38')](_0xb3bc('0x39'))){_0x1d29e6[_0xb3bc('0x1f')]=qs[_0xb3bc('0x1f')](_0x206ede['query'][_0xb3bc('0x1f')]);_0x1d29e6[_0xb3bc('0x1d')]=qs[_0xb3bc('0x1d')](_0x206ede[_0xb3bc('0x34')][_0xb3bc('0x1d')]);}_0x1d29e6['order']=qs[_0xb3bc('0x3a')](_0x206ede[_0xb3bc('0x34')][_0xb3bc('0x3a')]);_0x1d29e6['where']=qs[_0xb3bc('0x32')](_['pick'](_0x206ede['query'],_0x582ece[_0xb3bc('0x32')]),_0x56f644);if(_0x206ede[_0xb3bc('0x34')][_0xb3bc('0x3b')]){_0x1d29e6[_0xb3bc('0x3c')]=_['merge'](_0x1d29e6[_0xb3bc('0x3c')],{'$or':_[_0xb3bc('0x2a')](_0x56f644,function(_0x2443ec){if(_0x2443ec[_0xb3bc('0x2e')]!=='VIRTUAL'){var _0x51d887={};_0x51d887[_0x2443ec[_0xb3bc('0x27')]]={'$like':'%'+_0x206ede[_0xb3bc('0x34')]['filter']+'%'};return _0x51d887;}})});}_0x1d29e6=_['merge']({},_0x1d29e6,_0x206ede[_0xb3bc('0x3d')]);var _0x31d355={'where':_0x1d29e6[_0xb3bc('0x3c')]};return db[_0xb3bc('0x2b')][_0xb3bc('0x20')](_0x31d355)[_0xb3bc('0x24')](function(_0x579980){_0x1e34a4[_0xb3bc('0x20')]=_0x579980;if(_0x206ede[_0xb3bc('0x34')][_0xb3bc('0x3e')]){_0x1d29e6['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xb3bc('0x3f')](_0x1d29e6);})[_0xb3bc('0x24')](function(_0x5c0bc5){_0x1e34a4[_0xb3bc('0x40')]=_0x5c0bc5;return _0x1e34a4;})['then'](respondWithFilteredResult(_0x4d401d,_0x1d29e6))['catch'](handleError(_0x4d401d,null));};exports[_0xb3bc('0x41')]=function(_0x42a013,_0x1285d8){var _0x235cb2={'raw':!![],'where':{'id':_0x42a013[_0xb3bc('0x42')]['id']}},_0x2be9cc={};_0x2be9cc['model']=_[_0xb3bc('0x31')](db[_0xb3bc('0x2b')]['rawAttributes']);_0x2be9cc['query']=_[_0xb3bc('0x31')](_0x42a013['query']);_0x2be9cc['filters']=_[_0xb3bc('0x33')](_0x2be9cc[_0xb3bc('0x30')],_0x2be9cc[_0xb3bc('0x34')]);_0x235cb2[_0xb3bc('0x35')]=_['intersection'](_0x2be9cc[_0xb3bc('0x30')],qs[_0xb3bc('0x36')](_0x42a013[_0xb3bc('0x34')][_0xb3bc('0x36')]));_0x235cb2[_0xb3bc('0x35')]=_0x235cb2[_0xb3bc('0x35')][_0xb3bc('0x37')]?_0x235cb2[_0xb3bc('0x35')]:_0x2be9cc['model'];if(_0x42a013[_0xb3bc('0x34')][_0xb3bc('0x3e')]){_0x235cb2[_0xb3bc('0x43')]=[{'all':!![]}];}_0x235cb2=_[_0xb3bc('0x44')]({},_0x235cb2,_0x42a013[_0xb3bc('0x3d')]);return db[_0xb3bc('0x2b')][_0xb3bc('0x45')](_0x235cb2)['then'](handleEntityNotFound(_0x1285d8,null))[_0xb3bc('0x24')](respondWithResult(_0x1285d8,null))['catch'](handleError(_0x1285d8,null));};exports[_0xb3bc('0x46')]=function(_0x17c630,_0x475574){return db[_0xb3bc('0x2b')][_0xb3bc('0x46')](_0x17c630[_0xb3bc('0x47')],{})[_0xb3bc('0x24')](respondWithResult(_0x475574,0xc9))[_0xb3bc('0x48')](handleError(_0x475574,null));};exports[_0xb3bc('0x23')]=function(_0x8d08be,_0x38a8ad){if(_0x8d08be['body']['id']){delete _0x8d08be['body']['id'];}return db['OpenchannelTransferReport'][_0xb3bc('0x45')]({'where':{'id':_0x8d08be['params']['id']}})[_0xb3bc('0x24')](handleEntityNotFound(_0x38a8ad,null))['then'](saveUpdates(_0x8d08be['body'],null))['then'](respondWithResult(_0x38a8ad,null))[_0xb3bc('0x48')](handleError(_0x38a8ad,null));};exports[_0xb3bc('0x25')]=function(_0xc8d249,_0x276432){return db[_0xb3bc('0x2b')][_0xb3bc('0x45')]({'where':{'id':_0xc8d249[_0xb3bc('0x42')]['id']}})[_0xb3bc('0x24')](handleEntityNotFound(_0x276432,null))['then'](removeEntity(_0x276432,null))[_0xb3bc('0x48')](handleError(_0x276432,null));};exports[_0xb3bc('0x49')]=function(_0x168e1d,_0x2ad864){return db['OpenchannelTransferReport']['describe']()[_0xb3bc('0x24')](respondWithResult(_0x2ad864,null))[_0xb3bc('0x48')](handleError(_0x2ad864,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d81091a..7a53c6a 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 _0xabce=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x4235b3,_0x4295b9){var _0x5a6cc9=function(_0x3cd80d){while(--_0x3cd80d){_0x4235b3['push'](_0x4235b3['shift']());}};_0x5a6cc9(++_0x4295b9);}(_0xabce,0x104));var _0xeabc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xabce[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xeabc('0x0'));var util=require('util');var logger=require(_0xeabc('0x1'))('api');var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require(_0xeabc('0x8'));module[_0xeabc('0x9')]=function(_0x103836,_0x4dfed9){return _0x103836[_0xeabc('0xa')](_0xeabc('0xb'),attributes,{'tableName':_0xeabc('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x33b8=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0x3ceba7,_0x130a14){var _0xa70029=function(_0xdff1e8){while(--_0xdff1e8){_0x3ceba7['push'](_0x3ceba7['shift']());}};_0xa70029(++_0x130a14);}(_0x33b8,0x183));var _0x833b=function(_0x4383e9,_0xa4b307){_0x4383e9=_0x4383e9-0x0;var _0x355405=_0x33b8[_0x4383e9];return _0x355405;};'use strict';var _=require('lodash');var util=require(_0x833b('0x0'));var logger=require(_0x833b('0x1'))(_0x833b('0x2'));var moment=require(_0x833b('0x3'));var BPromise=require('bluebird');var rp=require(_0x833b('0x4'));var fs=require('fs');var path=require(_0x833b('0x5'));var rimraf=require(_0x833b('0x6'));var config=require(_0x833b('0x7'));var attributes=require(_0x833b('0x8'));module[_0x833b('0x9')]=function(_0x5d0f39,_0x234e44){return _0x5d0f39[_0x833b('0xa')](_0x833b('0xb'),attributes,{'tableName':_0x833b('0xc'),'paranoid':![],'indexes':[{'name':_0x833b('0xd'),'fields':[_0x833b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 966c3b7..7d929aa 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 _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x42c788,_0x5c6fd3){var _0xcf9ef5=function(_0x34ba44){while(--_0x34ba44){_0x42c788['push'](_0x42c788['shift']());}};_0xcf9ef5(++_0x5c6fd3);}(_0xee14,0x13a));var _0x4ee1=function(_0xb41b14,_0x2e14e8){_0xb41b14=_0xb41b14-0x0;var _0x17fd27=_0xee14[_0xb41b14];return _0x17fd27;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file +var _0x05bc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird'];(function(_0x1d6f25,_0x43770d){var _0x5eb2b4=function(_0x2e7975){while(--_0x2e7975){_0x1d6f25['push'](_0x1d6f25['shift']());}};_0x5eb2b4(++_0x43770d);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc05b('0x0'));var moment=require('moment');var BPromise=require(_0xc05b('0x1'));var rs=require(_0xc05b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc05b('0x3'))['db'];var utils=require(_0xc05b('0x4'));var logger=require(_0xc05b('0x5'))(_0xc05b('0x6'));var config=require(_0xc05b('0x7'));var jayson=require(_0xc05b('0x8'));var client=jayson[_0xc05b('0x9')][_0xc05b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9c6c57,_0x1b501a,_0x275f0f){return new BPromise(function(_0x143ba4,_0x45245b){return client[_0xc05b('0xb')](_0x9c6c57,_0x275f0f)['then'](function(_0x5d72b9){logger[_0xc05b('0xc')](_0xc05b('0xd'),_0x1b501a,_0xc05b('0xe'));logger[_0xc05b('0xf')](_0xc05b('0x10'),_0x1b501a,_0xc05b('0xe'),JSON[_0xc05b('0x11')](_0x5d72b9));if(_0x5d72b9[_0xc05b('0x12')]){if(_0x5d72b9[_0xc05b('0x12')]['code']===0x1f4){logger[_0xc05b('0x12')](_0xc05b('0xd'),_0x1b501a,_0x5d72b9[_0xc05b('0x12')][_0xc05b('0x13')]);return _0x45245b(_0x5d72b9[_0xc05b('0x12')][_0xc05b('0x13')]);}logger['error'](_0xc05b('0xd'),_0x1b501a,_0x5d72b9[_0xc05b('0x12')]['message']);return _0x143ba4(_0x5d72b9['error'][_0xc05b('0x13')]);}else{logger[_0xc05b('0xc')](_0xc05b('0xd'),_0x1b501a,_0xc05b('0xe'));_0x143ba4(_0x5d72b9[_0xc05b('0x14')][_0xc05b('0x13')]);}})[_0xc05b('0x15')](function(_0x5a33c1){logger[_0xc05b('0x12')](_0xc05b('0xd'),_0x1b501a,_0x5a33c1);_0x45245b(_0x5a33c1);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d9f1ab5..1a71716 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 _0x9ca1=['create','put','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','post'];(function(_0x13f710,_0x18a2a1){var _0x28afbe=function(_0x44ff2d){while(--_0x44ff2d){_0x13f710['push'](_0x13f710['shift']());}};_0x28afbe(++_0x18a2a1);}(_0x9ca1,0xf3));var _0x19ca=function(_0x4ab167,_0x5ce71c){_0x4ab167=_0x4ab167-0x0;var _0xef426d=_0x9ca1[_0x4ab167];return _0xef426d;};'use strict';var multer=require('multer');var util=require(_0x19ca('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x19ca('0x1'));var router=express[_0x19ca('0x2')]();var fs_extra=require(_0x19ca('0x3'));var auth=require(_0x19ca('0x4'));var interaction=require(_0x19ca('0x5'));var config=require(_0x19ca('0x6'));var controller=require(_0x19ca('0x7'));router[_0x19ca('0x8')]('/',auth[_0x19ca('0x9')](),controller[_0x19ca('0xa')]);router[_0x19ca('0x8')](_0x19ca('0xb'),auth[_0x19ca('0x9')](),controller['show']);router[_0x19ca('0xc')]('/',auth[_0x19ca('0x9')](),controller[_0x19ca('0xd')]);router[_0x19ca('0xe')]('/:id',auth[_0x19ca('0x9')](),controller['update']);router['delete']('/:id',auth[_0x19ca('0x9')](),controller['destroy']);module[_0x19ca('0xf')]=router; \ No newline at end of file +var _0x4157=['./pause.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14c0e6,_0x5aeafc){var _0x2e2e95=function(_0x403a6c){while(--_0x403a6c){_0x14c0e6['push'](_0x14c0e6['shift']());}};_0x2e2e95(++_0x5aeafc);}(_0x4157,0xf3));var _0x7415=function(_0x4323c0,_0x9f071b){_0x4323c0=_0x4323c0-0x0;var _0x81d17f=_0x4157[_0x4323c0];return _0x81d17f;};'use strict';var multer=require(_0x7415('0x0'));var util=require(_0x7415('0x1'));var path=require(_0x7415('0x2'));var timeout=require(_0x7415('0x3'));var express=require(_0x7415('0x4'));var router=express['Router']();var fs_extra=require(_0x7415('0x5'));var auth=require(_0x7415('0x6'));var interaction=require(_0x7415('0x7'));var config=require(_0x7415('0x8'));var controller=require(_0x7415('0x9'));router[_0x7415('0xa')]('/',auth[_0x7415('0xb')](),controller[_0x7415('0xc')]);router[_0x7415('0xa')]('/:id',auth[_0x7415('0xb')](),controller['show']);router[_0x7415('0xd')]('/',auth['isAuthenticated'](),controller[_0x7415('0xe')]);router[_0x7415('0xf')](_0x7415('0x10'),auth[_0x7415('0xb')](),controller[_0x7415('0x11')]);router[_0x7415('0x12')](_0x7415('0x10'),auth['isAuthenticated'](),controller[_0x7415('0x13')]);module[_0x7415('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index bfb2df4..e7e465d 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 _0xc6a0=['STRING','sequelize','exports','name'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0xc6a0,0x95));var _0x0c6a=function(_0x31ebeb,_0x75cef9){_0x31ebeb=_0x31ebeb-0x0;var _0x52bdfd=_0xc6a0[_0x31ebeb];return _0x52bdfd;};'use strict';var Sequelize=require(_0x0c6a('0x0'));module[_0x0c6a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0c6a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x0c6a('0x3')]}}; \ No newline at end of file +var _0x488d=['exports','STRING'];(function(_0x1f4fc0,_0x4679f9){var _0x124543=function(_0x198d5e){while(--_0x198d5e){_0x1f4fc0['push'](_0x1f4fc0['shift']());}};_0x124543(++_0x4679f9);}(_0x488d,0x144));var _0xd488=function(_0x18d564,_0x51c2e0){_0x18d564=_0x18d564-0x0;var _0x343199=_0x488d[_0x18d564];return _0x343199;};'use strict';var Sequelize=require('sequelize');module[_0xd488('0x0')]={'name':{'type':Sequelize[_0xd488('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd488('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f79e11f..35b6f1e 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 _0x5cd4=['ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','apply','reject','save','update','destroy','then','get','Pauses','error','name','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','create','user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','moment','bluebird','util','to-csv'];(function(_0x55275d,_0x1b2bd4){var _0x31fa28=function(_0xcb2110){while(--_0xcb2110){_0x55275d['push'](_0x55275d['shift']());}};_0x31fa28(++_0x1b2bd4);}(_0x5cd4,0x1b0));var _0x45cd=function(_0x3fa386,_0x2a03d0){_0x3fa386=_0x3fa386-0x0;var _0x118475=_0x5cd4[_0x3fa386];return _0x118475;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x45cd('0x0'));var jsonpatch=require(_0x45cd('0x1'));var rp=require('request-promise');var moment=require(_0x45cd('0x2'));var BPromise=require(_0x45cd('0x3'));var Mustache=require('mustache');var util=require(_0x45cd('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x45cd('0x5'));var ejs=require(_0x45cd('0x6'));var fs=require('fs');var fs_extra=require(_0x45cd('0x7'));var _=require(_0x45cd('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x45cd('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x45cd('0xa'));var Papa=require(_0x45cd('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x45cd('0xc'));var as=require(_0x45cd('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45cd('0xe'))(_0x45cd('0xf'));var utils=require(_0x45cd('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x45cd('0x11'));var db=require(_0x45cd('0x12'))['db'];function respondWithStatusCode(_0xea87ad,_0x57c153){_0x57c153=_0x57c153||0xcc;return function(_0x467aa3){if(_0x467aa3){return _0xea87ad[_0x45cd('0x13')](_0x57c153);}return _0xea87ad[_0x45cd('0x14')](_0x57c153)['end']();};}function respondWithResult(_0x23d117,_0x3f93b3){_0x3f93b3=_0x3f93b3||0xc8;return function(_0x4e9c33){if(_0x4e9c33){return _0x23d117[_0x45cd('0x14')](_0x3f93b3)[_0x45cd('0x15')](_0x4e9c33);}};}function respondWithFilteredResult(_0x5151a6,_0x27ee54){return function(_0xe47f9c){if(_0xe47f9c){var _0x4ec7ad=typeof _0x27ee54['offset']==='undefined'&&typeof _0x27ee54[_0x45cd('0x16')]===_0x45cd('0x17');var _0xe12f32=_0xe47f9c[_0x45cd('0x18')];var _0x5b1646=_0x4ec7ad?0x0:_0x27ee54[_0x45cd('0x19')];var _0x127a53=_0x4ec7ad?_0xe47f9c[_0x45cd('0x18')]:_0x27ee54[_0x45cd('0x19')]+_0x27ee54[_0x45cd('0x16')];var _0x3e60cc;if(_0x127a53>=_0xe12f32){_0x127a53=_0xe12f32;_0x3e60cc=0xc8;}else{_0x3e60cc=0xce;}_0x5151a6[_0x45cd('0x14')](_0x3e60cc);return _0x5151a6['set']('Content-Range',_0x5b1646+'-'+_0x127a53+'/'+_0xe12f32)[_0x45cd('0x15')](_0xe47f9c);}return null;};}function patchUpdates(_0xaf863b){return function(_0x2f6ac8){try{jsonpatch[_0x45cd('0x1a')](_0x2f6ac8,_0xaf863b,!![]);}catch(_0x5279e9){return BPromise[_0x45cd('0x1b')](_0x5279e9);}return _0x2f6ac8[_0x45cd('0x1c')]();};}function saveUpdates(_0x5c05b6,_0x426c09){return function(_0x4bbae5){if(_0x4bbae5){return _0x4bbae5[_0x45cd('0x1d')](_0x5c05b6)['then'](function(_0x4c4b0b){return _0x4c4b0b;});}return null;};}function removeEntity(_0x2c357d,_0x4bff44){return function(_0x1e3625){if(_0x1e3625){return _0x1e3625[_0x45cd('0x1e')]()[_0x45cd('0x1f')](function(){var _0x4d0bc5=_0x1e3625[_0x45cd('0x20')]({'plain':!![]});var _0x514622=_0x45cd('0x21');return db['UserProfileResource'][_0x45cd('0x1e')]({'where':{'type':_0x514622,'resourceId':_0x4d0bc5['id']}})['then'](function(){return _0x1e3625;});})[_0x45cd('0x1f')](function(){_0x2c357d[_0x45cd('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16710e,_0x2ec040){return function(_0x23f508){if(!_0x23f508){_0x16710e[_0x45cd('0x13')](0x194);}return _0x23f508;};}function handleError(_0x131e4a,_0x32cf48){_0x32cf48=_0x32cf48||0x1f4;return function(_0x1cb24e){logger[_0x45cd('0x22')](_0x1cb24e['stack']);if(_0x1cb24e['name']){delete _0x1cb24e[_0x45cd('0x23')];}_0x131e4a['status'](_0x32cf48)['send'](_0x1cb24e);};}exports['index']=function(_0x1c1f03,_0x51b6f8){var _0x3812ce={},_0x4a0eab={},_0x3dfb76={'count':0x0,'rows':[]};var _0x42a873=_[_0x45cd('0x24')](db[_0x45cd('0x25')][_0x45cd('0x26')],function(_0x12283e){return{'name':_0x12283e[_0x45cd('0x27')],'type':_0x12283e[_0x45cd('0x28')][_0x45cd('0x29')]};});_0x4a0eab[_0x45cd('0x2a')]=_[_0x45cd('0x24')](_0x42a873,_0x45cd('0x23'));_0x4a0eab[_0x45cd('0x2b')]=_[_0x45cd('0x2c')](_0x1c1f03['query']);_0x4a0eab[_0x45cd('0x2d')]=_['intersection'](_0x4a0eab[_0x45cd('0x2a')],_0x4a0eab['query']);_0x3812ce[_0x45cd('0x2e')]=_[_0x45cd('0x2f')](_0x4a0eab[_0x45cd('0x2a')],qs[_0x45cd('0x30')](_0x1c1f03['query'][_0x45cd('0x30')]));_0x3812ce[_0x45cd('0x2e')]=_0x3812ce[_0x45cd('0x2e')][_0x45cd('0x31')]?_0x3812ce[_0x45cd('0x2e')]:_0x4a0eab[_0x45cd('0x2a')];if(!_0x1c1f03[_0x45cd('0x2b')][_0x45cd('0x32')]('nolimit')){_0x3812ce[_0x45cd('0x16')]=qs[_0x45cd('0x16')](_0x1c1f03[_0x45cd('0x2b')]['limit']);_0x3812ce['offset']=qs[_0x45cd('0x19')](_0x1c1f03[_0x45cd('0x2b')][_0x45cd('0x19')]);}_0x3812ce[_0x45cd('0x33')]=qs[_0x45cd('0x34')](_0x1c1f03['query'][_0x45cd('0x34')]);_0x3812ce['where']=qs[_0x45cd('0x2d')](_['pick'](_0x1c1f03[_0x45cd('0x2b')],_0x4a0eab[_0x45cd('0x2d')]),_0x42a873);if(_0x1c1f03['query']['filter']){_0x3812ce['where']=_[_0x45cd('0x35')](_0x3812ce[_0x45cd('0x36')],{'$or':_[_0x45cd('0x24')](_0x42a873,function(_0xe1591c){if(_0xe1591c[_0x45cd('0x28')]!==_0x45cd('0x37')){var _0x2bb0b2={};_0x2bb0b2[_0xe1591c[_0x45cd('0x23')]]={'$like':'%'+_0x1c1f03['query']['filter']+'%'};return _0x2bb0b2;}})});}_0x3812ce=_['merge']({},_0x3812ce,_0x1c1f03[_0x45cd('0x38')]);var _0x37e837={'where':_0x3812ce['where']};return db[_0x45cd('0x25')][_0x45cd('0x18')](_0x37e837)[_0x45cd('0x1f')](function(_0x2efb42){_0x3dfb76[_0x45cd('0x18')]=_0x2efb42;if(_0x1c1f03[_0x45cd('0x2b')]['includeAll']){_0x3812ce[_0x45cd('0x39')]=[{'all':!![]}];}return db[_0x45cd('0x25')][_0x45cd('0x3a')](_0x3812ce);})[_0x45cd('0x1f')](function(_0x4697c9){_0x3dfb76[_0x45cd('0x3b')]=_0x4697c9;return _0x3dfb76;})['then'](respondWithFilteredResult(_0x51b6f8,_0x3812ce))['catch'](handleError(_0x51b6f8,null));};exports[_0x45cd('0x3c')]=function(_0x3c22fc,_0x11b1c3){var _0x26d416={'raw':!![],'where':{'id':_0x3c22fc[_0x45cd('0x3d')]['id']}},_0x5a58eb={};_0x5a58eb[_0x45cd('0x2a')]=_['keys'](db[_0x45cd('0x25')][_0x45cd('0x26')]);_0x5a58eb[_0x45cd('0x2b')]=_[_0x45cd('0x2c')](_0x3c22fc[_0x45cd('0x2b')]);_0x5a58eb[_0x45cd('0x2d')]=_['intersection'](_0x5a58eb['model'],_0x5a58eb[_0x45cd('0x2b')]);_0x26d416[_0x45cd('0x2e')]=_[_0x45cd('0x2f')](_0x5a58eb[_0x45cd('0x2a')],qs[_0x45cd('0x30')](_0x3c22fc['query'][_0x45cd('0x30')]));_0x26d416[_0x45cd('0x2e')]=_0x26d416[_0x45cd('0x2e')][_0x45cd('0x31')]?_0x26d416[_0x45cd('0x2e')]:_0x5a58eb[_0x45cd('0x2a')];if(_0x3c22fc[_0x45cd('0x2b')][_0x45cd('0x3e')]){_0x26d416[_0x45cd('0x39')]=[{'all':!![]}];}_0x26d416=_[_0x45cd('0x35')]({},_0x26d416,_0x3c22fc[_0x45cd('0x38')]);return db[_0x45cd('0x25')]['find'](_0x26d416)[_0x45cd('0x1f')](handleEntityNotFound(_0x11b1c3,null))['then'](respondWithResult(_0x11b1c3,null))[_0x45cd('0x3f')](handleError(_0x11b1c3,null));};exports[_0x45cd('0x40')]=function(_0x3bf045,_0x10b05b){return db[_0x45cd('0x25')][_0x45cd('0x40')](_0x3bf045['body'],{})[_0x45cd('0x1f')](function(_0x1956d4){var _0x400ae7=_0x3bf045[_0x45cd('0x41')][_0x45cd('0x20')]({'plain':!![]});if(!_0x400ae7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x400ae7[_0x45cd('0x42')]===_0x45cd('0x41')){var _0x5ac61c=_0x1956d4[_0x45cd('0x20')]({'plain':!![]});var _0x32dc5b=_0x45cd('0x21');return db[_0x45cd('0x43')][_0x45cd('0x44')]({'where':{'name':_0x32dc5b,'userProfileId':_0x400ae7[_0x45cd('0x45')]},'raw':!![]})['then'](function(_0x5cef1b){if(_0x5cef1b&&_0x5cef1b['autoAssociation']===0x0){return db[_0x45cd('0x46')][_0x45cd('0x40')]({'name':_0x5ac61c[_0x45cd('0x23')],'resourceId':_0x5ac61c['id'],'type':_0x5cef1b['name'],'sectionId':_0x5cef1b['id']},{})[_0x45cd('0x1f')](function(){return _0x1956d4;});}else{return _0x1956d4;}})[_0x45cd('0x3f')](function(_0x430849){logger[_0x45cd('0x22')](_0x45cd('0x47'),_0x430849);throw _0x430849;});}return _0x1956d4;})[_0x45cd('0x1f')](respondWithResult(_0x10b05b,0xc9))[_0x45cd('0x3f')](handleError(_0x10b05b,null));};exports[_0x45cd('0x1d')]=function(_0x30ebd6,_0xfbe8a8){if(_0x30ebd6[_0x45cd('0x48')]['id']){delete _0x30ebd6['body']['id'];}return db['Pause'][_0x45cd('0x44')]({'where':{'id':_0x30ebd6['params']['id']}})['then'](handleEntityNotFound(_0xfbe8a8,null))[_0x45cd('0x1f')](saveUpdates(_0x30ebd6['body'],null))[_0x45cd('0x1f')](respondWithResult(_0xfbe8a8,null))['catch'](handleError(_0xfbe8a8,null));};exports[_0x45cd('0x1e')]=function(_0x3939f8,_0x442654){return db[_0x45cd('0x25')][_0x45cd('0x44')]({'where':{'id':_0x3939f8[_0x45cd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x442654,null))[_0x45cd('0x1f')](removeEntity(_0x442654,null))[_0x45cd('0x3f')](handleError(_0x442654,null));}; \ No newline at end of file +var _0xfd84=['findAll','catch','find','create','body','user','UserProfileSection','userProfileId','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','destroy','then','get','Pauses','UserProfileResource','error','stack','name','send','index','Pause','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xfd84,0x1e4));var _0x4fd8=function(_0x9acdcd,_0x396331){_0x9acdcd=_0x9acdcd-0x0;var _0x4b3e16=_0xfd84[_0x9acdcd];return _0x4b3e16;};'use strict';var emlformat=require(_0x4fd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fd8('0x1'));var jsonpatch=require(_0x4fd8('0x2'));var rp=require(_0x4fd8('0x3'));var moment=require(_0x4fd8('0x4'));var BPromise=require(_0x4fd8('0x5'));var Mustache=require(_0x4fd8('0x6'));var util=require('util');var path=require(_0x4fd8('0x7'));var sox=require(_0x4fd8('0x8'));var csv=require(_0x4fd8('0x9'));var ejs=require(_0x4fd8('0xa'));var fs=require('fs');var fs_extra=require(_0x4fd8('0xb'));var _=require('lodash');var squel=require(_0x4fd8('0xc'));var crypto=require(_0x4fd8('0xd'));var jsforce=require(_0x4fd8('0xe'));var deskjs=require(_0x4fd8('0xf'));var toCsv=require(_0x4fd8('0x9'));var querystring=require(_0x4fd8('0x10'));var Papa=require(_0x4fd8('0x11'));var Redis=require(_0x4fd8('0x12'));var authService=require(_0x4fd8('0x13'));var qs=require(_0x4fd8('0x14'));var as=require(_0x4fd8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4fd8('0x16'));var utils=require(_0x4fd8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4fd8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47002b,_0x477cdf){_0x477cdf=_0x477cdf||0xcc;return function(_0x8757b3){if(_0x8757b3){return _0x47002b[_0x4fd8('0x19')](_0x477cdf);}return _0x47002b[_0x4fd8('0x1a')](_0x477cdf)[_0x4fd8('0x1b')]();};}function respondWithResult(_0x1393bb,_0x2d7be2){_0x2d7be2=_0x2d7be2||0xc8;return function(_0x35b5c8){if(_0x35b5c8){return _0x1393bb['status'](_0x2d7be2)['json'](_0x35b5c8);}};}function respondWithFilteredResult(_0x5f5ade,_0x47674a){return function(_0x1ad3ba){if(_0x1ad3ba){var _0x22a6b6=typeof _0x47674a[_0x4fd8('0x1c')]===_0x4fd8('0x1d')&&typeof _0x47674a[_0x4fd8('0x1e')]===_0x4fd8('0x1d');var _0x1a4c6d=_0x1ad3ba[_0x4fd8('0x1f')];var _0x52d621=_0x22a6b6?0x0:_0x47674a[_0x4fd8('0x1c')];var _0x453c8f=_0x22a6b6?_0x1ad3ba[_0x4fd8('0x1f')]:_0x47674a[_0x4fd8('0x1c')]+_0x47674a['limit'];var _0x1e24da;if(_0x453c8f>=_0x1a4c6d){_0x453c8f=_0x1a4c6d;_0x1e24da=0xc8;}else{_0x1e24da=0xce;}_0x5f5ade[_0x4fd8('0x1a')](_0x1e24da);return _0x5f5ade[_0x4fd8('0x20')]('Content-Range',_0x52d621+'-'+_0x453c8f+'/'+_0x1a4c6d)['json'](_0x1ad3ba);}return null;};}function patchUpdates(_0x1a73bd){return function(_0x234f59){try{jsonpatch['apply'](_0x234f59,_0x1a73bd,!![]);}catch(_0x38fe93){return BPromise[_0x4fd8('0x21')](_0x38fe93);}return _0x234f59[_0x4fd8('0x22')]();};}function saveUpdates(_0x5c6881,_0x5c6081){return function(_0x547cde){if(_0x547cde){return _0x547cde['update'](_0x5c6881)['then'](function(_0x2e418e){return _0x2e418e;});}return null;};}function removeEntity(_0x3e228e,_0xcee9a6){return function(_0x470124){if(_0x470124){return _0x470124[_0x4fd8('0x23')]()[_0x4fd8('0x24')](function(){var _0x7d363f=_0x470124[_0x4fd8('0x25')]({'plain':!![]});var _0x4ed63c=_0x4fd8('0x26');return db[_0x4fd8('0x27')][_0x4fd8('0x23')]({'where':{'type':_0x4ed63c,'resourceId':_0x7d363f['id']}})[_0x4fd8('0x24')](function(){return _0x470124;});})[_0x4fd8('0x24')](function(){_0x3e228e['status'](0xcc)[_0x4fd8('0x1b')]();});}};}function handleEntityNotFound(_0x2a3564,_0x474e8d){return function(_0x3f61ee){if(!_0x3f61ee){_0x2a3564[_0x4fd8('0x19')](0x194);}return _0x3f61ee;};}function handleError(_0x43fc09,_0x4a3f22){_0x4a3f22=_0x4a3f22||0x1f4;return function(_0x2ecc87){logger[_0x4fd8('0x28')](_0x2ecc87[_0x4fd8('0x29')]);if(_0x2ecc87[_0x4fd8('0x2a')]){delete _0x2ecc87[_0x4fd8('0x2a')];}_0x43fc09['status'](_0x4a3f22)[_0x4fd8('0x2b')](_0x2ecc87);};}exports[_0x4fd8('0x2c')]=function(_0x4d2686,_0x31c739){var _0x3a7737={},_0xaadeb0={},_0x4bb2f0={'count':0x0,'rows':[]};var _0x49a6d7=_['map'](db[_0x4fd8('0x2d')][_0x4fd8('0x2e')],function(_0x3072de){return{'name':_0x3072de['fieldName'],'type':_0x3072de[_0x4fd8('0x2f')][_0x4fd8('0x30')]};});_0xaadeb0['model']=_[_0x4fd8('0x31')](_0x49a6d7,_0x4fd8('0x2a'));_0xaadeb0[_0x4fd8('0x32')]=_[_0x4fd8('0x33')](_0x4d2686['query']);_0xaadeb0[_0x4fd8('0x34')]=_[_0x4fd8('0x35')](_0xaadeb0[_0x4fd8('0x36')],_0xaadeb0[_0x4fd8('0x32')]);_0x3a7737['attributes']=_[_0x4fd8('0x35')](_0xaadeb0[_0x4fd8('0x36')],qs['fields'](_0x4d2686['query'][_0x4fd8('0x37')]));_0x3a7737[_0x4fd8('0x38')]=_0x3a7737[_0x4fd8('0x38')][_0x4fd8('0x39')]?_0x3a7737[_0x4fd8('0x38')]:_0xaadeb0['model'];if(!_0x4d2686[_0x4fd8('0x32')][_0x4fd8('0x3a')]('nolimit')){_0x3a7737[_0x4fd8('0x1e')]=qs[_0x4fd8('0x1e')](_0x4d2686[_0x4fd8('0x32')][_0x4fd8('0x1e')]);_0x3a7737['offset']=qs[_0x4fd8('0x1c')](_0x4d2686[_0x4fd8('0x32')]['offset']);}_0x3a7737[_0x4fd8('0x3b')]=qs[_0x4fd8('0x3c')](_0x4d2686[_0x4fd8('0x32')][_0x4fd8('0x3c')]);_0x3a7737['where']=qs[_0x4fd8('0x34')](_[_0x4fd8('0x3d')](_0x4d2686[_0x4fd8('0x32')],_0xaadeb0[_0x4fd8('0x34')]),_0x49a6d7);if(_0x4d2686[_0x4fd8('0x32')]['filter']){_0x3a7737[_0x4fd8('0x3e')]=_[_0x4fd8('0x3f')](_0x3a7737[_0x4fd8('0x3e')],{'$or':_[_0x4fd8('0x31')](_0x49a6d7,function(_0x5dea47){if(_0x5dea47['type']!==_0x4fd8('0x40')){var _0xd019bd={};_0xd019bd[_0x5dea47['name']]={'$like':'%'+_0x4d2686['query'][_0x4fd8('0x41')]+'%'};return _0xd019bd;}})});}_0x3a7737=_[_0x4fd8('0x3f')]({},_0x3a7737,_0x4d2686[_0x4fd8('0x42')]);var _0x10a3a9={'where':_0x3a7737[_0x4fd8('0x3e')]};return db[_0x4fd8('0x2d')][_0x4fd8('0x1f')](_0x10a3a9)['then'](function(_0x1d225a){_0x4bb2f0[_0x4fd8('0x1f')]=_0x1d225a;if(_0x4d2686[_0x4fd8('0x32')][_0x4fd8('0x43')]){_0x3a7737[_0x4fd8('0x44')]=[{'all':!![]}];}return db[_0x4fd8('0x2d')][_0x4fd8('0x45')](_0x3a7737);})[_0x4fd8('0x24')](function(_0x5b9392){_0x4bb2f0['rows']=_0x5b9392;return _0x4bb2f0;})['then'](respondWithFilteredResult(_0x31c739,_0x3a7737))[_0x4fd8('0x46')](handleError(_0x31c739,null));};exports['show']=function(_0x3a45d1,_0x168de6){var _0x16747d={'raw':!![],'where':{'id':_0x3a45d1['params']['id']}},_0x5e28b8={};_0x5e28b8[_0x4fd8('0x36')]=_[_0x4fd8('0x33')](db[_0x4fd8('0x2d')][_0x4fd8('0x2e')]);_0x5e28b8[_0x4fd8('0x32')]=_[_0x4fd8('0x33')](_0x3a45d1['query']);_0x5e28b8[_0x4fd8('0x34')]=_['intersection'](_0x5e28b8['model'],_0x5e28b8[_0x4fd8('0x32')]);_0x16747d['attributes']=_[_0x4fd8('0x35')](_0x5e28b8[_0x4fd8('0x36')],qs[_0x4fd8('0x37')](_0x3a45d1[_0x4fd8('0x32')][_0x4fd8('0x37')]));_0x16747d['attributes']=_0x16747d[_0x4fd8('0x38')][_0x4fd8('0x39')]?_0x16747d[_0x4fd8('0x38')]:_0x5e28b8['model'];if(_0x3a45d1[_0x4fd8('0x32')]['includeAll']){_0x16747d['include']=[{'all':!![]}];}_0x16747d=_[_0x4fd8('0x3f')]({},_0x16747d,_0x3a45d1[_0x4fd8('0x42')]);return db[_0x4fd8('0x2d')][_0x4fd8('0x47')](_0x16747d)['then'](handleEntityNotFound(_0x168de6,null))['then'](respondWithResult(_0x168de6,null))[_0x4fd8('0x46')](handleError(_0x168de6,null));};exports[_0x4fd8('0x48')]=function(_0x517e6f,_0x14874b){return db[_0x4fd8('0x2d')][_0x4fd8('0x48')](_0x517e6f[_0x4fd8('0x49')],{})[_0x4fd8('0x24')](function(_0x14fb7a){var _0x1a5527=_0x517e6f['user'][_0x4fd8('0x25')]({'plain':!![]});if(!_0x1a5527)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a5527['role']===_0x4fd8('0x4a')){var _0x12d5e5=_0x14fb7a[_0x4fd8('0x25')]({'plain':!![]});var _0x52c504=_0x4fd8('0x26');return db[_0x4fd8('0x4b')]['find']({'where':{'name':_0x52c504,'userProfileId':_0x1a5527[_0x4fd8('0x4c')]},'raw':!![]})[_0x4fd8('0x24')](function(_0x22bb39){if(_0x22bb39&&_0x22bb39['autoAssociation']===0x0){return db[_0x4fd8('0x27')]['create']({'name':_0x12d5e5[_0x4fd8('0x2a')],'resourceId':_0x12d5e5['id'],'type':_0x22bb39[_0x4fd8('0x2a')],'sectionId':_0x22bb39['id']},{})[_0x4fd8('0x24')](function(){return _0x14fb7a;});}else{return _0x14fb7a;}})[_0x4fd8('0x46')](function(_0x3a8cc){logger[_0x4fd8('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a8cc);throw _0x3a8cc;});}return _0x14fb7a;})['then'](respondWithResult(_0x14874b,0xc9))['catch'](handleError(_0x14874b,null));};exports[_0x4fd8('0x4d')]=function(_0x30215b,_0x4341c6){if(_0x30215b[_0x4fd8('0x49')]['id']){delete _0x30215b[_0x4fd8('0x49')]['id'];}return db[_0x4fd8('0x2d')][_0x4fd8('0x47')]({'where':{'id':_0x30215b[_0x4fd8('0x4e')]['id']}})[_0x4fd8('0x24')](handleEntityNotFound(_0x4341c6,null))[_0x4fd8('0x24')](saveUpdates(_0x30215b['body'],null))[_0x4fd8('0x24')](respondWithResult(_0x4341c6,null))['catch'](handleError(_0x4341c6,null));};exports['destroy']=function(_0x14c0cc,_0x56abd6){return db[_0x4fd8('0x2d')][_0x4fd8('0x47')]({'where':{'id':_0x14c0cc['params']['id']}})[_0x4fd8('0x24')](handleEntityNotFound(_0x56abd6,null))['then'](removeEntity(_0x56abd6,null))[_0x4fd8('0x46')](handleError(_0x56abd6,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 4e94aa5..c4ccaf5 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x250c78,_0x25b838){_0x250c78=_0x250c78-0x0;var _0x44f07a=_0x7fbe[_0x250c78];return _0x44f07a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x2fd764,_0x2bc535){var _0x1b4faa=function(_0x31cd5f){while(--_0x31cd5f){_0x2fd764['push'](_0x2fd764['shift']());}};_0x1b4faa(++_0x2bc535);}(_0xf494,0x1c6));var _0x4f49=function(_0x42788f,_0x5b486e){_0x42788f=_0x42788f-0x0;var _0x2a69d6=_0xf494[_0x42788f];return _0x2a69d6;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5c8a220..9115649 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(_0x466c05,_0x60fbd9){var _0x55f66e=function(_0x55485b){while(--_0x55485b){_0x466c05['push'](_0x466c05['shift']());}};_0x55f66e(++_0x60fbd9);}(_0x7a54,0x106));var _0x47a5=function(_0x84fd53,_0x99a14){_0x84fd53=_0x84fd53-0x0;var _0x5c002d=_0x7a54[_0x84fd53];return _0x5c002d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x2af9fa,_0x40f7f7){var _0x272a2c=function(_0x54e465){while(--_0x54e465){_0x2af9fa['push'](_0x2af9fa['shift']());}};_0x272a2c(++_0x40f7f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x16ca8e,_0x60f267){_0x16ca8e=_0x16ca8e-0x0;var _0x4c560e=_0xb10b[_0x16ca8e];return _0x4c560e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 0ac9bfb..4c5c45a 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 _0x207c=['file','upload','post','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/webhook','/:id','isAuthenticated','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','extname','now','single'];(function(_0x2b861e,_0x3d9404){var _0x5513b8=function(_0x56800c){while(--_0x56800c){_0x2b861e['push'](_0x2b861e['shift']());}};_0x5513b8(++_0x3d9404);}(_0x207c,0x1e8));var _0xc207=function(_0x5ecbe8,_0x42522f){_0x5ecbe8=_0x5ecbe8-0x0;var _0x1c6e21=_0x207c[_0x5ecbe8];return _0x1c6e21;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),controller['webhookGet']);router[_0xc207('0x9')](_0xc207('0xb'),auth[_0xc207('0xc')](),controller['show']);router[_0xc207('0x9')](_0xc207('0xd'),auth[_0xc207('0xc')](),controller[_0xc207('0xe')]);var upload=multer({'storage':multer[_0xc207('0xf')]({'destination':function(_0x347549,_0x487d95,_0x574425){_0x574425(null,path['join'](config[_0xc207('0x10')],'server/files/plugins'));},'filename':function(_0x2741f3,_0x2782ce,_0x59d401){_0x2782ce[_0xc207('0x11')]=_0x2782ce[_0xc207('0x11')][_0xc207('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59d401(null,util[_0xc207('0x13')](_0xc207('0x14'),path['basename'](_0x2782ce[_0xc207('0x11')],path[_0xc207('0x15')](_0x2782ce[_0xc207('0x11')])),Date[_0xc207('0x16')](),path['extname'](_0x2782ce['originalname'])));}})});router['post']('/',upload[_0xc207('0x17')](_0xc207('0x18')),controller[_0xc207('0x19')]);router[_0xc207('0x1a')]('/webhook',controller[_0xc207('0x1b')]);router[_0xc207('0x1c')](_0xc207('0xb'),auth['isAuthenticated'](),controller[_0xc207('0x1d')]);router['delete'](_0xc207('0xb'),auth[_0xc207('0xc')](),controller[_0xc207('0x1e')]);module[_0xc207('0x1f')]=router; \ No newline at end of file +var _0x4b19=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','webhookGet','/:id','show','isAuthenticated','download','diskStorage','root','server/files/plugins','originalname','replace','basename','post','single','file','/webhook','webhookPost','put','update','delete','multer'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x4b19,0x195));var _0x94b1=function(_0x86a1a6,_0x5d9eb9){_0x86a1a6=_0x86a1a6-0x0;var _0xcab415=_0x4b19[_0x86a1a6];return _0xcab415;};'use strict';var multer=require(_0x94b1('0x0'));var util=require('util');var path=require(_0x94b1('0x1'));var timeout=require(_0x94b1('0x2'));var express=require(_0x94b1('0x3'));var router=express['Router']();var fs_extra=require(_0x94b1('0x4'));var auth=require(_0x94b1('0x5'));var interaction=require(_0x94b1('0x6'));var config=require('../../config/environment');var controller=require(_0x94b1('0x7'));router[_0x94b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x94b1('0x9')]);router[_0x94b1('0x8')]('/webhook',controller[_0x94b1('0xa')]);router[_0x94b1('0x8')](_0x94b1('0xb'),auth['isAuthenticated'](),controller[_0x94b1('0xc')]);router['get']('/:id/download',auth[_0x94b1('0xd')](),controller[_0x94b1('0xe')]);var upload=multer({'storage':multer[_0x94b1('0xf')]({'destination':function(_0x8ddf47,_0x162995,_0x3aeb91){_0x3aeb91(null,path['join'](config[_0x94b1('0x10')],_0x94b1('0x11')));},'filename':function(_0x340a29,_0x2b378c,_0x5cbf96){_0x2b378c['originalname']=_0x2b378c[_0x94b1('0x12')][_0x94b1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5cbf96(null,util['format']('%s-%s%s',path[_0x94b1('0x14')](_0x2b378c[_0x94b1('0x12')],path['extname'](_0x2b378c[_0x94b1('0x12')])),Date['now'](),path['extname'](_0x2b378c[_0x94b1('0x12')])));}})});router[_0x94b1('0x15')]('/',upload[_0x94b1('0x16')](_0x94b1('0x17')),controller['upload']);router[_0x94b1('0x15')](_0x94b1('0x18'),controller[_0x94b1('0x19')]);router[_0x94b1('0x1a')](_0x94b1('0xb'),auth[_0x94b1('0xd')](),controller[_0x94b1('0x1b')]);router['delete'](_0x94b1('0xb'),auth[_0x94b1('0xd')](),controller[_0x94b1('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f1f0966..14229a9 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 _0x6d8c=['TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script'];(function(_0x1350b0,_0x267231){var _0xeee748=function(_0x3af6ef){while(--_0x3af6ef){_0x1350b0['push'](_0x1350b0['shift']());}};_0xeee748(++_0x267231);}(_0x6d8c,0x127));var _0xc6d8=function(_0x2cb7b4,_0x204ca2){_0x2cb7b4=_0x2cb7b4-0x0;var _0x1bb99a=_0x6d8c[_0x2cb7b4];return _0x1bb99a;};'use strict';var Sequelize=require(_0xc6d8('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6d8('0x1')]},'type':{'type':Sequelize[_0xc6d8('0x2')](_0xc6d8('0x3'),_0xc6d8('0x4'))},'description':{'type':Sequelize[_0xc6d8('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xc6d8('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xc6d8('0x6')],'defaultValue':0x0,'comment':_0xc6d8('0x7')},'sidebar':{'type':Sequelize[_0xc6d8('0x2')]('adminOnly',_0xc6d8('0x8'),_0xc6d8('0x9'),_0xc6d8('0xa')),'defaultValue':'always','comment':_0xc6d8('0xb')},'icon':{'type':Sequelize[_0xc6d8('0x1')]},'adminUrl':{'type':Sequelize[_0xc6d8('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xc6d8('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6bcd=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','never','always'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bcd,0x145));var _0xd6bc=function(_0x14de3a,_0x53d103){_0x14de3a=_0x14de3a-0x0;var _0x116c80=_0x6bcd[_0x14de3a];return _0x116c80;};'use strict';var Sequelize=require('sequelize');module[_0xd6bc('0x0')]={'name':{'type':Sequelize[_0xd6bc('0x1')]},'type':{'type':Sequelize[_0xd6bc('0x2')](_0xd6bc('0x3'),_0xd6bc('0x4'))},'description':{'type':Sequelize[_0xd6bc('0x5')]},'version':{'type':Sequelize[_0xd6bc('0x5')]},'path':{'type':Sequelize[_0xd6bc('0x1')],'comment':_0xd6bc('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xd6bc('0x2')](_0xd6bc('0x7'),_0xd6bc('0x8'),'always',_0xd6bc('0x9')),'defaultValue':_0xd6bc('0xa'),'comment':_0xd6bc('0xb')},'icon':{'type':Sequelize[_0xd6bc('0x1')]},'adminUrl':{'type':Sequelize[_0xd6bc('0x1')]},'agentUrl':{'type':Sequelize[_0xd6bc('0x1')]},'scriptName':{'type':Sequelize[_0xd6bc('0x1')]},'scriptPath':{'type':Sequelize[_0xd6bc('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f6ab282..4561ffd 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 _0x2dd8=['../../config/utils','../../config/environment','defaults','redis','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','get','Plugins','destroy','then','error','name','index','Plugin','fieldName','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','path','join','root','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','views','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','userProfileId','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','statusCode','send','webhookPost','resolve','method','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x333a5b,_0x2fe2c3){var _0x24f0d4=function(_0x3be709){while(--_0x3be709){_0x333a5b['push'](_0x333a5b['shift']());}};_0x24f0d4(++_0x2fe2c3);}(_0x2dd8,0x91));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x82dd('0x0'));var rimraf=require(_0x82dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82dd('0x2'));var moment=require(_0x82dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x82dd('0x4'));var util=require(_0x82dd('0x5'));var path=require('path');var sox=require(_0x82dd('0x6'));var csv=require('to-csv');var ejs=require(_0x82dd('0x7'));var fs=require('fs');var fs_extra=require(_0x82dd('0x8'));var _=require(_0x82dd('0x9'));var squel=require(_0x82dd('0xa'));var crypto=require(_0x82dd('0xb'));var jsforce=require(_0x82dd('0xc'));var deskjs=require(_0x82dd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x82dd('0xe'));var Papa=require(_0x82dd('0xf'));var extract=require(_0x82dd('0x10'));var rimraf=require(_0x82dd('0x1'));var archiver=require(_0x82dd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x82dd('0x12'));var as=require(_0x82dd('0x13'));var hardwareService=require(_0x82dd('0x14'));var logger=require(_0x82dd('0x15'))(_0x82dd('0x16'));var utils=require(_0x82dd('0x17'));var config=require(_0x82dd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x82dd('0x19')](config[_0x82dd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82dd('0x1a')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x26d617,_0x5b286d){_0x5b286d=_0x5b286d||0xcc;return function(_0x14a9c8){if(_0x14a9c8){return _0x26d617[_0x82dd('0x1b')](_0x5b286d);}return _0x26d617[_0x82dd('0x1c')](_0x5b286d)[_0x82dd('0x1d')]();};}function respondWithResult(_0x329f75,_0x482aa6){_0x482aa6=_0x482aa6||0xc8;return function(_0x4195a6){if(_0x4195a6){return _0x329f75[_0x82dd('0x1c')](_0x482aa6)[_0x82dd('0x1e')](_0x4195a6);}};}function respondWithFilteredResult(_0x2d737a,_0x28cca6){return function(_0xf39459){if(_0xf39459){var _0x5419cf=typeof _0x28cca6[_0x82dd('0x1f')]===_0x82dd('0x20')&&typeof _0x28cca6[_0x82dd('0x21')]===_0x82dd('0x20');var _0x1e1861=_0xf39459['count'];var _0x1fc62a=_0x5419cf?0x0:_0x28cca6['offset'];var _0x4d971c=_0x5419cf?_0xf39459['count']:_0x28cca6[_0x82dd('0x1f')]+_0x28cca6['limit'];var _0x4bcdd2;if(_0x4d971c>=_0x1e1861){_0x4d971c=_0x1e1861;_0x4bcdd2=0xc8;}else{_0x4bcdd2=0xce;}_0x2d737a['status'](_0x4bcdd2);return _0x2d737a['set'](_0x82dd('0x22'),_0x1fc62a+'-'+_0x4d971c+'/'+_0x1e1861)[_0x82dd('0x1e')](_0xf39459);}return null;};}function patchUpdates(_0x415414){return function(_0x3c81a9){try{jsonpatch[_0x82dd('0x23')](_0x3c81a9,_0x415414,!![]);}catch(_0x38f9df){return BPromise[_0x82dd('0x24')](_0x38f9df);}return _0x3c81a9[_0x82dd('0x25')]();};}function saveUpdates(_0x2ad78e,_0x33c987){return function(_0x50ba1b){if(_0x50ba1b){return _0x50ba1b['update'](_0x2ad78e)['then'](function(_0x4441b7){return _0x4441b7;});}return null;};}function removeEntity(_0x3d25b0,_0x241ec0){return function(_0x3ad53f){if(_0x3ad53f){return _0x3ad53f['destroy']()['then'](function(){var _0x7fb6a2=_0x3ad53f[_0x82dd('0x26')]({'plain':!![]});var _0x544e14=_0x82dd('0x27');return db['UserProfileResource'][_0x82dd('0x28')]({'where':{'type':_0x544e14,'resourceId':_0x7fb6a2['id']}})[_0x82dd('0x29')](function(){return _0x3ad53f;});})[_0x82dd('0x29')](function(){_0x3d25b0[_0x82dd('0x1c')](0xcc)[_0x82dd('0x1d')]();});}};}function handleEntityNotFound(_0x486dac,_0xc77c8c){return function(_0x1d7657){if(!_0x1d7657){_0x486dac['sendStatus'](0x194);}return _0x1d7657;};}function handleError(_0x4c1fd9,_0x5351e8){_0x5351e8=_0x5351e8||0x1f4;return function(_0x319af7){logger[_0x82dd('0x2a')](_0x319af7['stack']);if(_0x319af7[_0x82dd('0x2b')]){delete _0x319af7[_0x82dd('0x2b')];}_0x4c1fd9['status'](_0x5351e8)['send'](_0x319af7);};}exports[_0x82dd('0x2c')]=function(_0x2264d4,_0x1572d3){var _0x80ef46={},_0x252a69={},_0x5aed46={'count':0x0,'rows':[]};var _0xcdd62d=_['map'](db[_0x82dd('0x2d')]['rawAttributes'],function(_0x1020eb){return{'name':_0x1020eb[_0x82dd('0x2e')],'type':_0x1020eb['type']['key']};});_0x252a69[_0x82dd('0x2f')]=_[_0x82dd('0x30')](_0xcdd62d,_0x82dd('0x2b'));_0x252a69[_0x82dd('0x31')]=_['keys'](_0x2264d4[_0x82dd('0x31')]);_0x252a69[_0x82dd('0x32')]=_[_0x82dd('0x33')](_0x252a69[_0x82dd('0x2f')],_0x252a69['query']);_0x80ef46['attributes']=_[_0x82dd('0x33')](_0x252a69[_0x82dd('0x2f')],qs[_0x82dd('0x34')](_0x2264d4[_0x82dd('0x31')][_0x82dd('0x34')]));_0x80ef46['attributes']=_0x80ef46[_0x82dd('0x35')]['length']?_0x80ef46[_0x82dd('0x35')]:_0x252a69[_0x82dd('0x2f')];if(!_0x2264d4[_0x82dd('0x31')][_0x82dd('0x36')](_0x82dd('0x37'))){_0x80ef46['limit']=qs[_0x82dd('0x21')](_0x2264d4['query'][_0x82dd('0x21')]);_0x80ef46['offset']=qs['offset'](_0x2264d4[_0x82dd('0x31')][_0x82dd('0x1f')]);}_0x80ef46['order']=qs[_0x82dd('0x38')](_0x2264d4['query'][_0x82dd('0x38')]);_0x80ef46[_0x82dd('0x39')]=qs[_0x82dd('0x32')](_[_0x82dd('0x3a')](_0x2264d4['query'],_0x252a69[_0x82dd('0x32')]),_0xcdd62d);if(_0x2264d4[_0x82dd('0x31')][_0x82dd('0x3b')]){_0x80ef46[_0x82dd('0x39')]=_[_0x82dd('0x3c')](_0x80ef46[_0x82dd('0x39')],{'$or':_[_0x82dd('0x30')](_0xcdd62d,function(_0x9fb0d5){if(_0x9fb0d5[_0x82dd('0x3d')]!=='VIRTUAL'){var _0x479806={};_0x479806[_0x9fb0d5[_0x82dd('0x2b')]]={'$like':'%'+_0x2264d4[_0x82dd('0x31')]['filter']+'%'};return _0x479806;}})});}_0x80ef46=_['merge']({},_0x80ef46,_0x2264d4[_0x82dd('0x3e')]);var _0x6d7532={'where':_0x80ef46['where']};return db['Plugin'][_0x82dd('0x3f')](_0x6d7532)[_0x82dd('0x29')](function(_0x6ab89){_0x5aed46[_0x82dd('0x3f')]=_0x6ab89;if(_0x2264d4[_0x82dd('0x31')][_0x82dd('0x40')]){_0x80ef46[_0x82dd('0x41')]=[{'all':!![]}];}return db[_0x82dd('0x2d')][_0x82dd('0x42')](_0x80ef46);})[_0x82dd('0x29')](function(_0xc685a1){_0x5aed46[_0x82dd('0x43')]=_0xc685a1;return _0x5aed46;})[_0x82dd('0x29')](respondWithFilteredResult(_0x1572d3,_0x80ef46))[_0x82dd('0x44')](handleError(_0x1572d3,null));};exports['show']=function(_0x2e58e4,_0x3a1ede){var _0x145d4c={'raw':!![],'where':{'id':_0x2e58e4[_0x82dd('0x45')]['id']}},_0x121014={};_0x121014[_0x82dd('0x2f')]=_[_0x82dd('0x46')](db[_0x82dd('0x2d')][_0x82dd('0x47')]);_0x121014[_0x82dd('0x31')]=_[_0x82dd('0x46')](_0x2e58e4[_0x82dd('0x31')]);_0x121014[_0x82dd('0x32')]=_['intersection'](_0x121014[_0x82dd('0x2f')],_0x121014[_0x82dd('0x31')]);_0x145d4c[_0x82dd('0x35')]=_[_0x82dd('0x33')](_0x121014[_0x82dd('0x2f')],qs[_0x82dd('0x34')](_0x2e58e4[_0x82dd('0x31')][_0x82dd('0x34')]));_0x145d4c[_0x82dd('0x35')]=_0x145d4c[_0x82dd('0x35')][_0x82dd('0x48')]?_0x145d4c[_0x82dd('0x35')]:_0x121014[_0x82dd('0x2f')];if(_0x2e58e4[_0x82dd('0x31')]['includeAll']){_0x145d4c[_0x82dd('0x41')]=[{'all':!![]}];}_0x145d4c=_['merge']({},_0x145d4c,_0x2e58e4[_0x82dd('0x3e')]);return db[_0x82dd('0x2d')][_0x82dd('0x49')](_0x145d4c)['then'](handleEntityNotFound(_0x3a1ede,null))[_0x82dd('0x29')](respondWithResult(_0x3a1ede,null))[_0x82dd('0x44')](handleError(_0x3a1ede,null));};exports['download']=function(_0x55c1c8,_0x5f51f7,_0x48231c){return db[_0x82dd('0x2d')]['find']({'where':{'id':_0x55c1c8[_0x82dd('0x45')]['id']},'attributes':['name',_0x82dd('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x5f51f7,null))[_0x82dd('0x29')](function(_0x506860){if(_0x506860){var _0x4058b0=path[_0x82dd('0x4b')](config[_0x82dd('0x4c')],_0x82dd('0x4d'),util[_0x82dd('0x4e')]('%s.zip',path[_0x82dd('0x4f')](_0x506860['path'])));var _0x5391b4=fs[_0x82dd('0x50')](_0x4058b0);var _0x554ebc=archiver(_0x82dd('0x51'),{'zlib':{'level':0x9}});_0x554ebc['on']('warning',function(_0x40309a){if(_0x40309a[_0x82dd('0x52')]===_0x82dd('0x53')){logger['error'](_0x40309a);}else{throw new db[(_0x82dd('0x54'))]['Error'](_0x82dd('0x55'));}});_0x554ebc['on'](_0x82dd('0x2a'),function(_0x4c0ce7){throw new db[(_0x82dd('0x54'))][(_0x82dd('0x56'))](_0x82dd('0x55'));});_0x554ebc[_0x82dd('0x57')](_0x5391b4);_0x554ebc[_0x82dd('0x58')](_0x82dd('0x59'),{'cwd':path[_0x82dd('0x4b')](config[_0x82dd('0x4c')],_0x82dd('0x4d'),path[_0x82dd('0x5a')](_0x506860[_0x82dd('0x4a')])),'ignore':[path[_0x82dd('0x4b')](path[_0x82dd('0x4f')](_0x506860[_0x82dd('0x4a')]),_0x82dd('0x5b')),path[_0x82dd('0x4b')](path[_0x82dd('0x4f')](_0x506860[_0x82dd('0x4a')]),'attachments/**/*')],'nodir':!![]})[_0x82dd('0x5c')]();_0x5391b4['on'](_0x82dd('0x5d'),function(){if(!fs[_0x82dd('0x5e')](_0x4058b0)){throw new db[(_0x82dd('0x54'))][(_0x82dd('0x56'))](_0x82dd('0x5f'));}return _0x5f51f7[_0x82dd('0x60')](_0x4058b0,util['format'](_0x82dd('0x61'),path['basename'](_0x506860['path'])),function(_0x175018){if(_0x175018){throw new db[(_0x82dd('0x54'))]['Error'](_0x82dd('0x62'));}fs[_0x82dd('0x63')](_0x4058b0);logger[_0x82dd('0x64')]('Download\x20completed');logger['info'](_0x82dd('0x65'));});});}return null;})[_0x82dd('0x44')](handleError(_0x5f51f7,null));};exports[_0x82dd('0x66')]=function(_0x401375,_0x596103,_0x10fe6e){var _0x5ab1b7=path[_0x82dd('0x4f')](_0x401375[_0x82dd('0x67')]['filename'],path['extname'](_0x401375[_0x82dd('0x67')]['filename']));var _0x23e5a2=path[_0x82dd('0x4b')](config[_0x82dd('0x4c')],_0x82dd('0x4d'),_0x401375[_0x82dd('0x67')][_0x82dd('0x68')]);var _0x1f0159=path[_0x82dd('0x4b')](config[_0x82dd('0x4c')],_0x82dd('0x4d'),_0x5ab1b7);logger[_0x82dd('0x64')](_0x82dd('0x69'),_0x23e5a2);logger[_0x82dd('0x64')](_0x82dd('0x6a'),_0x1f0159);try{fs[_0x82dd('0x6b')](_0x23e5a2,parseInt(_0x82dd('0x6c'),0x8));extract(_0x23e5a2,{'dir':_0x1f0159},function(_0x1f1aa6){if(_0x1f1aa6){logger[_0x82dd('0x2a')](_0x1f1aa6);handleError(_0x1f1aa6,!![]);};var _0x2fe0bc=fs[_0x82dd('0x6d')](_0x1f0159);if(_0x2fe0bc[_0x82dd('0x48')]>0x1){removeReferences(_0x23e5a2,_0x1f0159);logger[_0x82dd('0x2a')](_0x82dd('0x6e'));return _0x10fe6e(new Error(_0x82dd('0x6e')));}var _0xac78b1=fs[_0x82dd('0x6f')](path[_0x82dd('0x4b')](_0x1f0159,_0x2fe0bc[0x0]));if(_0xac78b1['isFile']()){removeReferences(_0x23e5a2,_0x1f0159);logger['error']('Invalid\x20plugin\x20structure');return _0x10fe6e(new Error(_0x82dd('0x6e')));}if(_0xac78b1[_0x82dd('0x70')]()){var _0x447658=fs[_0x82dd('0x6d')](path['join'](_0x1f0159,_0x2fe0bc[0x0]));if(_0x447658[_0x82dd('0x48')]===0x0){removeReferences(_0x23e5a2,_0x1f0159);logger[_0x82dd('0x2a')](_0x82dd('0x6e'));return _0x10fe6e(new Error(_0x82dd('0x6e')));}var _0xe04f06=_0x447658[_0x82dd('0x71')](function(_0x5bf279){return _0x5bf279===_0x82dd('0x72');});if(!_0xe04f06){return _0x10fe6e(new Error(_0x82dd('0x73')));}var _0x1e7b16=fs['readFileSync'](path[_0x82dd('0x4b')](_0x1f0159,_0x2fe0bc[0x0],_0x82dd('0x72')));var _0x4b8d99=JSON['parse'](_0x1e7b16);if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x2b')]){return _0x10fe6e(new Error(_0x82dd('0x74')));}if('undefined'==typeof _0x4b8d99[_0x82dd('0x3d')]){return _0x10fe6e(new Error(_0x82dd('0x75')));}if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x76')]){return _0x10fe6e(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x82dd('0x20')==typeof _0x4b8d99['parameters']){return _0x10fe6e(new Error(_0x82dd('0x77')));}if(_0x4b8d99[_0x82dd('0x3d')]===_0x82dd('0x78')){if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x79')]['views']){return _0x10fe6e(new Error(_0x82dd('0x7a')));}if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x79')]['views'][_0x82dd('0x7b')]&&'undefined'==typeof _0x4b8d99['parameters']['views'][_0x82dd('0x7c')]){return _0x10fe6e(new Error(_0x82dd('0x7d')));}}else if(_0x4b8d99[_0x82dd('0x3d')]==='script'){if('undefined'==typeof _0x4b8d99[_0x82dd('0x79')][_0x82dd('0x7e')]){return _0x10fe6e(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x82dd('0x20')==typeof _0x4b8d99[_0x82dd('0x79')]['scriptPath']){return _0x10fe6e(new Error(_0x82dd('0x7f')));}}else{return _0x10fe6e(new Error(_0x82dd('0x80')));}var _0x434446=_0x4b8d99[_0x82dd('0x2b')];var _0x34853e=_0x4b8d99[_0x82dd('0x81')];var _0x5d1c0c=_0x4b8d99[_0x82dd('0x3d')];var _0x217831=_0x4b8d99[_0x82dd('0x82')]?_0x4b8d99['sidebar']:_0x82dd('0x83');var _0x4c60de=_0x4b8d99['icon']?_0x4b8d99[_0x82dd('0x84')]:_0x82dd('0x85');var _0x45b2dc='';var _0x33d738='';var _0x32178d='';var _0x23885d='';var _0x3e40cc=_0x4b8d99[_0x82dd('0x76')];if(_0x5d1c0c===_0x82dd('0x78')){if('undefined'!=typeof _0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')][_0x82dd('0x7b')]){var _0x30c1b4=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')][_0x82dd('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x82dd('0x87')](_0x30c1b4)){_0x45b2dc=path[_0x82dd('0x4b')](_0x82dd('0x88'),_0x5ab1b7,_0x2fe0bc[0x0],_0x30c1b4);}else{_0x45b2dc=_0x30c1b4;}}else{logger[_0x82dd('0x64')](_0x82dd('0x89'));}if('undefined'!=typeof _0x4b8d99['parameters'][_0x82dd('0x86')][_0x82dd('0x7c')]){var _0x56a067=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')][_0x82dd('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x82dd('0x87')](_0x56a067)){_0x33d738=path[_0x82dd('0x4b')](_0x82dd('0x88'),_0x5ab1b7,_0x2fe0bc[0x0],_0x56a067);}else{_0x33d738=_0x56a067;}}else{logger[_0x82dd('0x64')](_0x82dd('0x8a'));}}else if(_0x5d1c0c===_0x82dd('0x8b')){_0x32178d=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x7e')];_0x23885d=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x8c')];if(_0x82dd('0x20')!=typeof _0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')]){if(_0x82dd('0x20')!=typeof _0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')][_0x82dd('0x7b')]){var _0x30c1b4=_0x4b8d99[_0x82dd('0x79')]['views'][_0x82dd('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x82dd('0x87')](_0x30c1b4)){_0x45b2dc=path[_0x82dd('0x4b')](_0x82dd('0x88'),_0x5ab1b7,_0x2fe0bc[0x0],_0x30c1b4);}else{_0x45b2dc=_0x30c1b4;}}if('undefined'!=typeof _0x4b8d99[_0x82dd('0x79')]['views'][_0x82dd('0x7c')]){var _0x56a067=_0x4b8d99[_0x82dd('0x79')][_0x82dd('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x82dd('0x87')](_0x56a067)){_0x33d738=path[_0x82dd('0x4b')](_0x82dd('0x88'),_0x5ab1b7,_0x2fe0bc[0x0],_0x56a067);}else{_0x33d738=_0x56a067;}}}}var _0x441209={'name':_0x434446,'description':_0x34853e,'path':path[_0x82dd('0x4b')](_0x5ab1b7,_0x2fe0bc[0x0]),'type':_0x5d1c0c,'sidebar':_0x217831,'icon':_0x4c60de,'adminUrl':_0x45b2dc,'agentUrl':_0x33d738,'scriptName':_0x32178d,'scriptPath':_0x23885d,'version':_0x3e40cc};removeReferences(_0x23e5a2,null);return db['Plugin'][_0x82dd('0x8d')](_0x441209)[_0x82dd('0x29')](function(_0x433845){var _0x1e70a1={'role':_0x401375[_0x82dd('0x8e')]['role'],'userProfileId':_0x401375['body'][_0x82dd('0x8f')]};if(!_0x1e70a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e70a1[_0x82dd('0x90')]===_0x82dd('0x91')){var _0x4f408c=_0x433845[_0x82dd('0x26')]({'plain':!![]});return db[_0x82dd('0x92')][_0x82dd('0x49')]({'where':{'name':_0x82dd('0x27'),'userProfileId':_0x1e70a1[_0x82dd('0x8f')]},'raw':!![]})[_0x82dd('0x29')](function(_0x24ac5e){if(_0x24ac5e&&_0x24ac5e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4f408c['name'],'resourceId':_0x4f408c['id'],'type':_0x24ac5e[_0x82dd('0x2b')],'sectionId':_0x24ac5e['id']},{})[_0x82dd('0x29')](function(){return _0x433845;});}else{return _0x433845;}})['catch'](function(_0x5c94e2){logger[_0x82dd('0x2a')](_0x82dd('0x93'),_0x5c94e2);throw _0x5c94e2;});}return _0x433845;})['then'](respondWithResult(_0x596103,null))['catch'](handleError(_0x596103,null));}});}catch(_0x1dba95){_0x596103['status'](0x1f4)['send'](_0x1dba95);}};function removeReferences(_0x2c0660,_0x53c042){try{if(_0x2c0660){fs[_0x82dd('0x63')](_0x2c0660);logger[_0x82dd('0x64')](_0x82dd('0x94'));}if(_0x53c042){rimraf(_0x53c042,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x180537){logger[_0x82dd('0x2a')](_0x180537);}}exports[_0x82dd('0x95')]=function(_0x130b88,_0x2c41a6,_0x5ec206){return db[_0x82dd('0x2d')][_0x82dd('0x49')]({'where':{'id':_0x130b88[_0x82dd('0x45')]['id']}})[_0x82dd('0x29')](handleEntityNotFound(_0x2c41a6,null))[_0x82dd('0x29')](saveUpdates(_0x130b88[_0x82dd('0x8e')],null))[_0x82dd('0x29')](respondWithResult(_0x2c41a6,null))['catch'](handleError(_0x2c41a6,null));};exports[_0x82dd('0x96')]=function(_0x2eb9b7,_0x1fb150,_0x398cb3){return db[_0x82dd('0x2d')]['find']({'where':{'id':_0x2eb9b7[_0x82dd('0x45')]['id']}})[_0x82dd('0x29')](function(_0x2f9994){if(_0x2f9994){return _0x2f9994[_0x82dd('0x28')]();}})[_0x82dd('0x29')](function(_0x41b884){rimraf(path['join'](config[_0x82dd('0x4c')],'server/files/plugins',path[_0x82dd('0x5a')](_0x41b884[_0x82dd('0x4a')])),function(){});return _0x41b884;})[_0x82dd('0x29')](handleEntityNotFound(_0x1fb150,null))['then'](respondWithStatusCode(_0x1fb150,null))[_0x82dd('0x44')](handleError(_0x1fb150,null));};exports[_0x82dd('0x97')]=function(_0x4a685a,_0x1f333c,_0x48eb4a){return BPromise['resolve']()['then'](function(){if(!_0x4a685a['query'][_0x82dd('0x4a')]){throw new Error(_0x82dd('0x98'));}if(!_0x4a685a[_0x82dd('0x31')][_0x82dd('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x306ea8=_0x4a685a[_0x82dd('0x31')][_0x82dd('0x9a')]?_0x4a685a[_0x82dd('0x31')][_0x82dd('0x9a')]+':'+_0x4a685a[_0x82dd('0x31')][_0x82dd('0x99')]:_0x82dd('0x9b')+_0x4a685a[_0x82dd('0x31')][_0x82dd('0x99')];var _0x2a4bee=_0x4a685a['query']['json']?_0x4a685a[_0x82dd('0x31')][_0x82dd('0x1e')]:!![];var _0x495b6c=_0x4a685a[_0x82dd('0x31')][_0x82dd('0x9c')]?_0x4a685a[_0x82dd('0x31')][_0x82dd('0x9c')]:null;var _0x4aef5d={'method':_0x4a685a['method'],'uri':util[_0x82dd('0x4e')](_0x82dd('0x9d'),_0x306ea8,_0x4a685a[_0x82dd('0x31')][_0x82dd('0x4a')]),'json':_0x2a4bee,'resolveWithFullResponse':!![],'encoding':_0x495b6c,'qs':_0x4a685a['query']};if(_0x4a685a['headers']){_0x4aef5d[_0x82dd('0x9e')]=_0x4a685a[_0x82dd('0x9e')];if(_0x4aef5d[_0x82dd('0x9e')]['content-length']){delete _0x4aef5d[_0x82dd('0x9e')][_0x82dd('0x9f')];}}if(_0x4aef5d['headers'][_0x82dd('0xa0')]){delete _0x4aef5d['headers'][_0x82dd('0xa0')];}return rp(_0x4aef5d);})[_0x82dd('0x29')](function(_0x3fe90e){if(_0x3fe90e){_0x1f333c[_0x82dd('0xa1')](_0x3fe90e[_0x82dd('0x9e')]);logger[_0x82dd('0x64')](_0x3fe90e['body']);if(_[_0x82dd('0xa2')](_0x4a685a[_0x82dd('0x31')][_0x82dd('0x4a')],_0x82dd('0x60'))&&_0x3fe90e[_0x82dd('0xa3')]==0x1f4){return _0x1f333c[_0x82dd('0x1b')](_0x3fe90e[_0x82dd('0xa3')]);}else{return _0x1f333c[_0x82dd('0x1c')](_0x3fe90e[_0x82dd('0xa3')])[_0x82dd('0xa4')](_0x3fe90e['body']);}}else{return _0x1f333c[_0x82dd('0x1b')](0xc8);}})[_0x82dd('0x44')](handleError(_0x1f333c,null));};exports[_0x82dd('0xa5')]=function(_0x2fae8b,_0x506c9c,_0x539468){return BPromise[_0x82dd('0xa6')]()['then'](function(){if(!_0x2fae8b['query'][_0x82dd('0x4a')]){throw new Error(_0x82dd('0x98'));}if(!_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x125234=_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x9a')]?_0x2fae8b[_0x82dd('0x31')]['hostname']+':'+_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x99')]:_0x82dd('0x9b')+_0x2fae8b['query'][_0x82dd('0x99')];var _0x5198e9=_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x1e')]?_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x1e')]:!![];var _0x7b1bf8=_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x9c')]?_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x9c')]:null;var _0x21aa21={'method':_0x2fae8b[_0x82dd('0xa7')],'uri':util['format'](_0x82dd('0x9d'),_0x125234,_0x2fae8b[_0x82dd('0x31')][_0x82dd('0x4a')]),'json':_0x5198e9,'resolveWithFullResponse':!![],'encoding':_0x7b1bf8,'body':_0x2fae8b[_0x82dd('0x8e')]};if(_0x2fae8b[_0x82dd('0x9e')]){_0x21aa21[_0x82dd('0x9e')]=_0x2fae8b['headers'];if(_0x21aa21[_0x82dd('0x9e')][_0x82dd('0x9f')]){delete _0x21aa21['headers'][_0x82dd('0x9f')];}}if(_0x21aa21['headers']['content-type']){delete _0x21aa21[_0x82dd('0x9e')][_0x82dd('0xa0')];}return rp(_0x21aa21);})['then'](function(_0x507ae9){if(_0x507ae9){_0x506c9c[_0x82dd('0xa1')](_0x507ae9[_0x82dd('0x9e')]);logger[_0x82dd('0x64')](_0x507ae9['body']);return _0x506c9c[_0x82dd('0x1c')](_0x507ae9['statusCode'])[_0x82dd('0xa4')](_0x507ae9[_0x82dd('0x8e')]);}else{return _0x506c9c[_0x82dd('0x1b')](0xc8);}})[_0x82dd('0x44')](handleError(_0x506c9c,null));}; \ No newline at end of file +var _0x5c97=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./plugin.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','catch','show','rawAttributes','length','include','options','find','download','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','params','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','%s%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','papaparse','extract-zip','archiver','ioredis'];(function(_0x2dfcc3,_0x244881){var _0x2d4796=function(_0x3083f1){while(--_0x3083f1){_0x2dfcc3['push'](_0x2dfcc3['shift']());}};_0x2d4796(++_0x244881);}(_0x5c97,0x1eb));var _0x75c9=function(_0x17e0ff,_0x4dbd1e){_0x17e0ff=_0x17e0ff-0x0;var _0x357979=_0x5c97[_0x17e0ff];return _0x357979;};'use strict';var emlformat=require(_0x75c9('0x0'));var rimraf=require(_0x75c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75c9('0x2'));var moment=require(_0x75c9('0x3'));var BPromise=require(_0x75c9('0x4'));var Mustache=require(_0x75c9('0x5'));var util=require(_0x75c9('0x6'));var path=require('path');var sox=require(_0x75c9('0x7'));var csv=require(_0x75c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x75c9('0x9'));var squel=require(_0x75c9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x75c9('0xb'));var toCsv=require(_0x75c9('0x8'));var querystring=require('querystring');var Papa=require(_0x75c9('0xc'));var extract=require(_0x75c9('0xd'));var rimraf=require(_0x75c9('0x1'));var archiver=require(_0x75c9('0xe'));var Redis=require(_0x75c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x75c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75c9('0x11'));var logger=require(_0x75c9('0x12'))(_0x75c9('0x13'));var utils=require(_0x75c9('0x14'));var config=require(_0x75c9('0x15'));var licenseUtil=require(_0x75c9('0x16'));var db=require(_0x75c9('0x17'))['db'];config['redis']=_[_0x75c9('0x18')](config['redis'],{'host':_0x75c9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75c9('0x1a')]));require(_0x75c9('0x1b'))['register'](socket);function respondWithStatusCode(_0x4fdbc7,_0x34831b){_0x34831b=_0x34831b||0xcc;return function(_0x179de0){if(_0x179de0){return _0x4fdbc7[_0x75c9('0x1c')](_0x34831b);}return _0x4fdbc7['status'](_0x34831b)[_0x75c9('0x1d')]();};}function respondWithResult(_0xf40a39,_0x3d046f){_0x3d046f=_0x3d046f||0xc8;return function(_0x1bf76f){if(_0x1bf76f){return _0xf40a39[_0x75c9('0x1e')](_0x3d046f)[_0x75c9('0x1f')](_0x1bf76f);}};}function respondWithFilteredResult(_0x465481,_0xdc6da6){return function(_0x4ead6e){if(_0x4ead6e){var _0x9c6ce8=typeof _0xdc6da6[_0x75c9('0x20')]===_0x75c9('0x21')&&typeof _0xdc6da6[_0x75c9('0x22')]===_0x75c9('0x21');var _0x28e937=_0x4ead6e[_0x75c9('0x23')];var _0x55c21c=_0x9c6ce8?0x0:_0xdc6da6[_0x75c9('0x20')];var _0x382a82=_0x9c6ce8?_0x4ead6e['count']:_0xdc6da6[_0x75c9('0x20')]+_0xdc6da6['limit'];var _0x2fcd22;if(_0x382a82>=_0x28e937){_0x382a82=_0x28e937;_0x2fcd22=0xc8;}else{_0x2fcd22=0xce;}_0x465481[_0x75c9('0x1e')](_0x2fcd22);return _0x465481[_0x75c9('0x24')]('Content-Range',_0x55c21c+'-'+_0x382a82+'/'+_0x28e937)['json'](_0x4ead6e);}return null;};}function patchUpdates(_0x2bd15c){return function(_0x58a3ba){try{jsonpatch['apply'](_0x58a3ba,_0x2bd15c,!![]);}catch(_0x59b7f2){return BPromise[_0x75c9('0x25')](_0x59b7f2);}return _0x58a3ba[_0x75c9('0x26')]();};}function saveUpdates(_0x38ba1f,_0x36da46){return function(_0x50612f){if(_0x50612f){return _0x50612f['update'](_0x38ba1f)[_0x75c9('0x27')](function(_0x431a32){return _0x431a32;});}return null;};}function removeEntity(_0x305fdc,_0x2aff3b){return function(_0x50e394){if(_0x50e394){return _0x50e394[_0x75c9('0x28')]()[_0x75c9('0x27')](function(){var _0x48eecd=_0x50e394[_0x75c9('0x29')]({'plain':!![]});var _0x4e3add=_0x75c9('0x2a');return db[_0x75c9('0x2b')][_0x75c9('0x28')]({'where':{'type':_0x4e3add,'resourceId':_0x48eecd['id']}})[_0x75c9('0x27')](function(){return _0x50e394;});})[_0x75c9('0x27')](function(){_0x305fdc['status'](0xcc)[_0x75c9('0x1d')]();});}};}function handleEntityNotFound(_0x4c15fa,_0x462976){return function(_0x1ee9af){if(!_0x1ee9af){_0x4c15fa[_0x75c9('0x1c')](0x194);}return _0x1ee9af;};}function handleError(_0x5bac14,_0x1ca30b){_0x1ca30b=_0x1ca30b||0x1f4;return function(_0x4f7d77){logger[_0x75c9('0x2c')](_0x4f7d77[_0x75c9('0x2d')]);if(_0x4f7d77[_0x75c9('0x2e')]){delete _0x4f7d77[_0x75c9('0x2e')];}_0x5bac14[_0x75c9('0x1e')](_0x1ca30b)[_0x75c9('0x2f')](_0x4f7d77);};}exports[_0x75c9('0x30')]=function(_0x14e31e,_0x42053e){var _0x1c20c6={},_0x282ec5={},_0x4b9086={'count':0x0,'rows':[]};var _0x8c6293=_[_0x75c9('0x31')](db[_0x75c9('0x32')]['rawAttributes'],function(_0x591199){return{'name':_0x591199[_0x75c9('0x33')],'type':_0x591199[_0x75c9('0x34')]['key']};});_0x282ec5[_0x75c9('0x35')]=_['map'](_0x8c6293,'name');_0x282ec5[_0x75c9('0x36')]=_[_0x75c9('0x37')](_0x14e31e[_0x75c9('0x36')]);_0x282ec5[_0x75c9('0x38')]=_[_0x75c9('0x39')](_0x282ec5['model'],_0x282ec5[_0x75c9('0x36')]);_0x1c20c6[_0x75c9('0x3a')]=_[_0x75c9('0x39')](_0x282ec5[_0x75c9('0x35')],qs[_0x75c9('0x3b')](_0x14e31e[_0x75c9('0x36')][_0x75c9('0x3b')]));_0x1c20c6[_0x75c9('0x3a')]=_0x1c20c6[_0x75c9('0x3a')]['length']?_0x1c20c6[_0x75c9('0x3a')]:_0x282ec5[_0x75c9('0x35')];if(!_0x14e31e[_0x75c9('0x36')]['hasOwnProperty'](_0x75c9('0x3c'))){_0x1c20c6[_0x75c9('0x22')]=qs[_0x75c9('0x22')](_0x14e31e[_0x75c9('0x36')][_0x75c9('0x22')]);_0x1c20c6['offset']=qs['offset'](_0x14e31e[_0x75c9('0x36')]['offset']);}_0x1c20c6['order']=qs[_0x75c9('0x3d')](_0x14e31e[_0x75c9('0x36')]['sort']);_0x1c20c6[_0x75c9('0x3e')]=qs[_0x75c9('0x38')](_[_0x75c9('0x3f')](_0x14e31e[_0x75c9('0x36')],_0x282ec5[_0x75c9('0x38')]),_0x8c6293);if(_0x14e31e['query']['filter']){_0x1c20c6[_0x75c9('0x3e')]=_[_0x75c9('0x40')](_0x1c20c6[_0x75c9('0x3e')],{'$or':_[_0x75c9('0x31')](_0x8c6293,function(_0x10d8f8){if(_0x10d8f8[_0x75c9('0x34')]!==_0x75c9('0x41')){var _0x528698={};_0x528698[_0x10d8f8[_0x75c9('0x2e')]]={'$like':'%'+_0x14e31e['query'][_0x75c9('0x42')]+'%'};return _0x528698;}})});}_0x1c20c6=_[_0x75c9('0x40')]({},_0x1c20c6,_0x14e31e['options']);var _0x48b331={'where':_0x1c20c6[_0x75c9('0x3e')]};return db['Plugin'][_0x75c9('0x23')](_0x48b331)[_0x75c9('0x27')](function(_0x291dfb){_0x4b9086[_0x75c9('0x23')]=_0x291dfb;if(_0x14e31e['query'][_0x75c9('0x43')]){_0x1c20c6['include']=[{'all':!![]}];}return db[_0x75c9('0x32')]['findAll'](_0x1c20c6);})[_0x75c9('0x27')](function(_0x219a1d){_0x4b9086[_0x75c9('0x44')]=_0x219a1d;return _0x4b9086;})[_0x75c9('0x27')](respondWithFilteredResult(_0x42053e,_0x1c20c6))[_0x75c9('0x45')](handleError(_0x42053e,null));};exports[_0x75c9('0x46')]=function(_0x3f22cd,_0x38e126){var _0x1d95d3={'raw':!![],'where':{'id':_0x3f22cd['params']['id']}},_0x114551={};_0x114551[_0x75c9('0x35')]=_[_0x75c9('0x37')](db[_0x75c9('0x32')][_0x75c9('0x47')]);_0x114551[_0x75c9('0x36')]=_[_0x75c9('0x37')](_0x3f22cd[_0x75c9('0x36')]);_0x114551[_0x75c9('0x38')]=_[_0x75c9('0x39')](_0x114551[_0x75c9('0x35')],_0x114551[_0x75c9('0x36')]);_0x1d95d3[_0x75c9('0x3a')]=_['intersection'](_0x114551[_0x75c9('0x35')],qs[_0x75c9('0x3b')](_0x3f22cd[_0x75c9('0x36')]['fields']));_0x1d95d3['attributes']=_0x1d95d3['attributes'][_0x75c9('0x48')]?_0x1d95d3[_0x75c9('0x3a')]:_0x114551[_0x75c9('0x35')];if(_0x3f22cd[_0x75c9('0x36')][_0x75c9('0x43')]){_0x1d95d3[_0x75c9('0x49')]=[{'all':!![]}];}_0x1d95d3=_['merge']({},_0x1d95d3,_0x3f22cd[_0x75c9('0x4a')]);return db[_0x75c9('0x32')][_0x75c9('0x4b')](_0x1d95d3)[_0x75c9('0x27')](handleEntityNotFound(_0x38e126,null))[_0x75c9('0x27')](respondWithResult(_0x38e126,null))[_0x75c9('0x45')](handleError(_0x38e126,null));};exports[_0x75c9('0x4c')]=function(_0x53ab84,_0xc0964c,_0x27f002){return db['Plugin'][_0x75c9('0x4b')]({'where':{'id':_0x53ab84['params']['id']},'attributes':[_0x75c9('0x2e'),_0x75c9('0x4d')],'raw':!![]})[_0x75c9('0x27')](handleEntityNotFound(_0xc0964c,null))[_0x75c9('0x27')](function(_0x454d17){if(_0x454d17){var _0x1b28b6=path[_0x75c9('0x4e')](config[_0x75c9('0x4f')],_0x75c9('0x50'),util[_0x75c9('0x51')](_0x75c9('0x52'),path[_0x75c9('0x53')](_0x454d17[_0x75c9('0x4d')])));var _0x565825=fs[_0x75c9('0x54')](_0x1b28b6);var _0x4df532=archiver('zip',{'zlib':{'level':0x9}});_0x4df532['on'](_0x75c9('0x55'),function(_0x5cbd68){if(_0x5cbd68['code']===_0x75c9('0x56')){logger[_0x75c9('0x2c')](_0x5cbd68);}else{throw new db[(_0x75c9('0x57'))][(_0x75c9('0x58'))](_0x75c9('0x59'));}});_0x4df532['on'](_0x75c9('0x2c'),function(_0x3bc631){throw new db[(_0x75c9('0x57'))][(_0x75c9('0x58'))](_0x75c9('0x59'));});_0x4df532['pipe'](_0x565825);_0x4df532[_0x75c9('0x5a')](_0x75c9('0x5b'),{'cwd':path[_0x75c9('0x4e')](config['root'],_0x75c9('0x50'),path[_0x75c9('0x5c')](_0x454d17['path'])),'ignore':[path[_0x75c9('0x4e')](path[_0x75c9('0x53')](_0x454d17['path']),_0x75c9('0x5d')),path[_0x75c9('0x4e')](path[_0x75c9('0x53')](_0x454d17[_0x75c9('0x4d')]),_0x75c9('0x5e'))],'nodir':!![]})['finalize']();_0x565825['on'](_0x75c9('0x5f'),function(){if(!fs[_0x75c9('0x60')](_0x1b28b6)){throw new db['Sequelize'][(_0x75c9('0x58'))]('Plugin\x20not\x20found');}return _0xc0964c['download'](_0x1b28b6,util[_0x75c9('0x51')](_0x75c9('0x52'),path[_0x75c9('0x53')](_0x454d17[_0x75c9('0x4d')])),function(_0x3e146a){if(_0x3e146a){throw new db[(_0x75c9('0x57'))][(_0x75c9('0x58'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x75c9('0x61')](_0x1b28b6);logger[_0x75c9('0x62')](_0x75c9('0x63'));logger['info'](_0x75c9('0x64'));});});}return null;})[_0x75c9('0x45')](handleError(_0xc0964c,null));};exports[_0x75c9('0x65')]=function(_0x40d2d6,_0x13e2ae,_0x115804){var _0x110c47=path[_0x75c9('0x53')](_0x40d2d6[_0x75c9('0x66')][_0x75c9('0x67')],path[_0x75c9('0x68')](_0x40d2d6['file'][_0x75c9('0x67')]));var _0x27d9ca=path[_0x75c9('0x4e')](config[_0x75c9('0x4f')],'server/files/plugins',_0x40d2d6[_0x75c9('0x66')]['filename']);var _0xc12d04=path[_0x75c9('0x4e')](config[_0x75c9('0x4f')],'server/files/plugins',_0x110c47);logger[_0x75c9('0x62')](_0x75c9('0x69'),_0x27d9ca);logger['info'](_0x75c9('0x6a'),_0xc12d04);try{fs[_0x75c9('0x6b')](_0x27d9ca,parseInt(_0x75c9('0x6c'),0x8));extract(_0x27d9ca,{'dir':_0xc12d04},function(_0x4cd19d){if(_0x4cd19d){logger['error'](_0x4cd19d);handleError(_0x4cd19d,!![]);};var _0x510037=fs['readdirSync'](_0xc12d04);if(_0x510037[_0x75c9('0x48')]>0x1){removeReferences(_0x27d9ca,_0xc12d04);logger[_0x75c9('0x2c')](_0x75c9('0x6d'));return _0x115804(new Error(_0x75c9('0x6d')));}var _0x5cb6ac=fs[_0x75c9('0x6e')](path[_0x75c9('0x4e')](_0xc12d04,_0x510037[0x0]));if(_0x5cb6ac[_0x75c9('0x6f')]()){removeReferences(_0x27d9ca,_0xc12d04);logger['error'](_0x75c9('0x6d'));return _0x115804(new Error(_0x75c9('0x6d')));}if(_0x5cb6ac['isDirectory']()){var _0x1383a0=fs[_0x75c9('0x70')](path['join'](_0xc12d04,_0x510037[0x0]));if(_0x1383a0['length']===0x0){removeReferences(_0x27d9ca,_0xc12d04);logger['error'](_0x75c9('0x6d'));return _0x115804(new Error(_0x75c9('0x6d')));}var _0x2161e9=_0x1383a0[_0x75c9('0x71')](function(_0x35e7bb){return _0x35e7bb===_0x75c9('0x72');});if(!_0x2161e9){return _0x115804(new Error('Plugin\x20manifest\x20missing'));}var _0x3a5d29=fs[_0x75c9('0x73')](path[_0x75c9('0x4e')](_0xc12d04,_0x510037[0x0],_0x75c9('0x72')));var _0xb08675=JSON['parse'](_0x3a5d29);if(_0x75c9('0x21')==typeof _0xb08675[_0x75c9('0x2e')]){return _0x115804(new Error(_0x75c9('0x74')));}if(_0x75c9('0x21')==typeof _0xb08675['type']){return _0x115804(new Error(_0x75c9('0x75')));}if(_0x75c9('0x21')==typeof _0xb08675[_0x75c9('0x76')]){return _0x115804(new Error(_0x75c9('0x77')));}if('undefined'==typeof _0xb08675['parameters']){return _0x115804(new Error(_0x75c9('0x78')));}if(_0xb08675[_0x75c9('0x34')]==='html'){if(_0x75c9('0x21')==typeof _0xb08675[_0x75c9('0x79')]['views']){return _0x115804(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x75c9('0x21')==typeof _0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')][_0x75c9('0x7b')]&&_0x75c9('0x21')==typeof _0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')]['agent']){return _0x115804(new Error(_0x75c9('0x7c')));}}else if(_0xb08675[_0x75c9('0x34')]==='script'){if(_0x75c9('0x21')==typeof _0xb08675[_0x75c9('0x79')][_0x75c9('0x7d')]){return _0x115804(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x75c9('0x21')==typeof _0xb08675['parameters']['scriptPath']){return _0x115804(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x115804(new Error(_0x75c9('0x7e')));}var _0x58cc95=_0xb08675['name'];var _0x5051a0=_0xb08675[_0x75c9('0x7f')];var _0x1578df=_0xb08675[_0x75c9('0x34')];var _0xfd7b5c=_0xb08675['sidebar']?_0xb08675[_0x75c9('0x80')]:'always';var _0x134f0b=_0xb08675[_0x75c9('0x81')]?_0xb08675['icon']:_0x75c9('0x82');var _0x46dd63='';var _0x22f993='';var _0x17a9ef='';var _0x4a609b='';var _0x4f586a=_0xb08675['version'];if(_0x1578df===_0x75c9('0x83')){if('undefined'!=typeof _0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')]['admin']){var _0x16e84c=_0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')][_0x75c9('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x16e84c)){_0x46dd63=path['join'](_0x75c9('0x84'),_0x110c47,_0x510037[0x0],_0x16e84c);}else{_0x46dd63=_0x16e84c;}}else{logger[_0x75c9('0x62')](_0x75c9('0x85'));}if(_0x75c9('0x21')!=typeof _0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')][_0x75c9('0x86')]){var _0x5ae203=_0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x75c9('0x87')](_0x5ae203)){_0x22f993=path[_0x75c9('0x4e')]('plugins',_0x110c47,_0x510037[0x0],_0x5ae203);}else{_0x22f993=_0x5ae203;}}else{logger['info'](_0x75c9('0x88'));}}else if(_0x1578df===_0x75c9('0x89')){_0x17a9ef=_0xb08675['parameters'][_0x75c9('0x7d')];_0x4a609b=_0xb08675[_0x75c9('0x79')][_0x75c9('0x8a')];if('undefined'!=typeof _0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')]){if(_0x75c9('0x21')!=typeof _0xb08675[_0x75c9('0x79')]['views'][_0x75c9('0x7b')]){var _0x16e84c=_0xb08675[_0x75c9('0x79')]['views'][_0x75c9('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x75c9('0x87')](_0x16e84c)){_0x46dd63=path[_0x75c9('0x4e')]('plugins',_0x110c47,_0x510037[0x0],_0x16e84c);}else{_0x46dd63=_0x16e84c;}}if(_0x75c9('0x21')!=typeof _0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')][_0x75c9('0x86')]){var _0x5ae203=_0xb08675[_0x75c9('0x79')][_0x75c9('0x7a')][_0x75c9('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5ae203)){_0x22f993=path[_0x75c9('0x4e')](_0x75c9('0x84'),_0x110c47,_0x510037[0x0],_0x5ae203);}else{_0x22f993=_0x5ae203;}}}}var _0x21f618={'name':_0x58cc95,'description':_0x5051a0,'path':path[_0x75c9('0x4e')](_0x110c47,_0x510037[0x0]),'type':_0x1578df,'sidebar':_0xfd7b5c,'icon':_0x134f0b,'adminUrl':_0x46dd63,'agentUrl':_0x22f993,'scriptName':_0x17a9ef,'scriptPath':_0x4a609b,'version':_0x4f586a};removeReferences(_0x27d9ca,null);return db['Plugin'][_0x75c9('0x8b')](_0x21f618)[_0x75c9('0x27')](function(_0x50c7de){var _0x2c4709={'role':_0x40d2d6[_0x75c9('0x8c')]['role'],'userProfileId':_0x40d2d6[_0x75c9('0x8c')]['userProfileId']};if(!_0x2c4709)throw new Error(_0x75c9('0x8d'));if(_0x2c4709[_0x75c9('0x8e')]===_0x75c9('0x8f')){var _0x2e194b=_0x50c7de['get']({'plain':!![]});return db[_0x75c9('0x90')][_0x75c9('0x4b')]({'where':{'name':_0x75c9('0x2a'),'userProfileId':_0x2c4709[_0x75c9('0x91')]},'raw':!![]})[_0x75c9('0x27')](function(_0x13c7ba){if(_0x13c7ba&&_0x13c7ba[_0x75c9('0x92')]===0x0){return db['UserProfileResource'][_0x75c9('0x8b')]({'name':_0x2e194b[_0x75c9('0x2e')],'resourceId':_0x2e194b['id'],'type':_0x13c7ba[_0x75c9('0x2e')],'sectionId':_0x13c7ba['id']},{})[_0x75c9('0x27')](function(){return _0x50c7de;});}else{return _0x50c7de;}})[_0x75c9('0x45')](function(_0x1d994c){logger['error'](_0x75c9('0x93'),_0x1d994c);throw _0x1d994c;});}return _0x50c7de;})[_0x75c9('0x27')](respondWithResult(_0x13e2ae,null))[_0x75c9('0x45')](handleError(_0x13e2ae,null));}});}catch(_0x4ba4bc){_0x13e2ae[_0x75c9('0x1e')](0x1f4)['send'](_0x4ba4bc);}};function removeReferences(_0x52e2a1,_0x2aaf1d){try{if(_0x52e2a1){fs[_0x75c9('0x61')](_0x52e2a1);logger[_0x75c9('0x62')](_0x75c9('0x94'));}if(_0x2aaf1d){rimraf(_0x2aaf1d,function(){});logger[_0x75c9('0x62')](_0x75c9('0x95'));}}catch(_0x347613){logger[_0x75c9('0x2c')](_0x347613);}}exports[_0x75c9('0x96')]=function(_0x1bc80f,_0x4288de,_0x4eb30d){return db['Plugin']['find']({'where':{'id':_0x1bc80f['params']['id']}})[_0x75c9('0x27')](handleEntityNotFound(_0x4288de,null))[_0x75c9('0x27')](saveUpdates(_0x1bc80f['body'],null))[_0x75c9('0x27')](respondWithResult(_0x4288de,null))[_0x75c9('0x45')](handleError(_0x4288de,null));};exports[_0x75c9('0x97')]=function(_0x49babe,_0xf34f71,_0x4f4d74){return db[_0x75c9('0x32')][_0x75c9('0x4b')]({'where':{'id':_0x49babe[_0x75c9('0x98')]['id']}})[_0x75c9('0x27')](function(_0xefecc2){if(_0xefecc2){return _0xefecc2['destroy']();}})['then'](function(_0x2ab683){rimraf(path[_0x75c9('0x4e')](config['root'],'server/files/plugins',path['dirname'](_0x2ab683[_0x75c9('0x4d')])),function(){});return _0x2ab683;})['then'](handleEntityNotFound(_0xf34f71,null))[_0x75c9('0x27')](respondWithStatusCode(_0xf34f71,null))[_0x75c9('0x45')](handleError(_0xf34f71,null));};exports[_0x75c9('0x99')]=function(_0x3a4065,_0x48f7e4,_0x5b64f9){return BPromise[_0x75c9('0x9a')]()[_0x75c9('0x27')](function(){if(!_0x3a4065[_0x75c9('0x36')]['path']){throw new Error(_0x75c9('0x9b'));}if(!_0x3a4065[_0x75c9('0x36')][_0x75c9('0x9c')]){throw new Error(_0x75c9('0x9d'));}var _0x4aee22=_0x3a4065[_0x75c9('0x36')]['hostname']?_0x3a4065[_0x75c9('0x36')][_0x75c9('0x9e')]+':'+_0x3a4065[_0x75c9('0x36')]['port']:_0x75c9('0x9f')+_0x3a4065[_0x75c9('0x36')]['port'];var _0xa061e7=_0x3a4065[_0x75c9('0x36')][_0x75c9('0x1f')]?_0x3a4065[_0x75c9('0x36')][_0x75c9('0x1f')]:!![];var _0x5b2989=_0x3a4065[_0x75c9('0x36')][_0x75c9('0xa0')]?_0x3a4065['query'][_0x75c9('0xa0')]:null;var _0x159a27={'method':_0x3a4065['method'],'uri':util[_0x75c9('0x51')]('%s%s',_0x4aee22,_0x3a4065[_0x75c9('0x36')][_0x75c9('0x4d')]),'json':_0xa061e7,'resolveWithFullResponse':!![],'encoding':_0x5b2989,'qs':_0x3a4065['query']};if(_0x3a4065[_0x75c9('0xa1')]){_0x159a27[_0x75c9('0xa1')]=_0x3a4065['headers'];if(_0x159a27['headers'][_0x75c9('0xa2')]){delete _0x159a27[_0x75c9('0xa1')][_0x75c9('0xa2')];}}if(_0x159a27[_0x75c9('0xa1')][_0x75c9('0xa3')]){delete _0x159a27[_0x75c9('0xa1')][_0x75c9('0xa3')];}return rp(_0x159a27);})['then'](function(_0x34018d){if(_0x34018d){_0x48f7e4['set'](_0x34018d[_0x75c9('0xa1')]);logger[_0x75c9('0x62')](_0x34018d[_0x75c9('0x8c')]);if(_[_0x75c9('0xa4')](_0x3a4065['query'][_0x75c9('0x4d')],_0x75c9('0x4c'))&&_0x34018d[_0x75c9('0xa5')]==0x1f4){return _0x48f7e4['sendStatus'](_0x34018d[_0x75c9('0xa5')]);}else{return _0x48f7e4[_0x75c9('0x1e')](_0x34018d[_0x75c9('0xa5')])[_0x75c9('0x2f')](_0x34018d[_0x75c9('0x8c')]);}}else{return _0x48f7e4[_0x75c9('0x1c')](0xc8);}})[_0x75c9('0x45')](handleError(_0x48f7e4,null));};exports[_0x75c9('0xa6')]=function(_0xb5a675,_0x206c65,_0x51380f){return BPromise['resolve']()['then'](function(){if(!_0xb5a675[_0x75c9('0x36')][_0x75c9('0x4d')]){throw new Error(_0x75c9('0x9b'));}if(!_0xb5a675[_0x75c9('0x36')][_0x75c9('0x9c')]){throw new Error(_0x75c9('0x9d'));}var _0x55513e=_0xb5a675[_0x75c9('0x36')]['hostname']?_0xb5a675['query'][_0x75c9('0x9e')]+':'+_0xb5a675[_0x75c9('0x36')][_0x75c9('0x9c')]:_0x75c9('0x9f')+_0xb5a675[_0x75c9('0x36')][_0x75c9('0x9c')];var _0x497695=_0xb5a675[_0x75c9('0x36')][_0x75c9('0x1f')]?_0xb5a675[_0x75c9('0x36')][_0x75c9('0x1f')]:!![];var _0x1d2e8c=_0xb5a675['query'][_0x75c9('0xa0')]?_0xb5a675[_0x75c9('0x36')][_0x75c9('0xa0')]:null;var _0x7c1a55={'method':_0xb5a675[_0x75c9('0xa7')],'uri':util[_0x75c9('0x51')](_0x75c9('0xa8'),_0x55513e,_0xb5a675[_0x75c9('0x36')][_0x75c9('0x4d')]),'json':_0x497695,'resolveWithFullResponse':!![],'encoding':_0x1d2e8c,'body':_0xb5a675[_0x75c9('0x8c')]};if(_0xb5a675[_0x75c9('0xa1')]){_0x7c1a55['headers']=_0xb5a675[_0x75c9('0xa1')];if(_0x7c1a55['headers'][_0x75c9('0xa2')]){delete _0x7c1a55[_0x75c9('0xa1')][_0x75c9('0xa2')];}}if(_0x7c1a55[_0x75c9('0xa1')][_0x75c9('0xa3')]){delete _0x7c1a55[_0x75c9('0xa1')][_0x75c9('0xa3')];}return rp(_0x7c1a55);})['then'](function(_0x23366e){if(_0x23366e){_0x206c65['set'](_0x23366e[_0x75c9('0xa1')]);logger[_0x75c9('0x62')](_0x23366e[_0x75c9('0x8c')]);return _0x206c65['status'](_0x23366e[_0x75c9('0xa5')])['send'](_0x23366e[_0x75c9('0x8c')]);}else{return _0x206c65[_0x75c9('0x1c')](0xc8);}})[_0x75c9('0x45')](handleError(_0x206c65,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index c51db99..39d3189 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 _0x0619=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update','remove'];(function(_0x4113f8,_0x21f91c){var _0x1201d9=function(_0x1a5ebe){while(--_0x1a5ebe){_0x4113f8['push'](_0x4113f8['shift']());}};_0x1201d9(++_0x21f91c);}(_0x0619,0x90));var _0x9061=function(_0x3d46fb,_0x27709e){_0x3d46fb=_0x3d46fb-0x0;var _0x4ddbbf=_0x0619[_0x3d46fb];return _0x4ddbbf;};'use strict';var EventEmitter=require(_0x9061('0x0'));var Plugin=require(_0x9061('0x1'))['db'][_0x9061('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x9061('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9061('0x4'),'afterDestroy':_0x9061('0x5')};function emitEvent(_0x1f0fe8){return function(_0x1384a7,_0x1bc8ce,_0xa713e1){PluginEvents[_0x9061('0x6')](_0x1f0fe8+':'+_0x1384a7['id'],_0x1384a7);PluginEvents[_0x9061('0x6')](_0x1f0fe8,_0x1384a7);_0xa713e1(null);};}for(var e in events){if(events[_0x9061('0x7')](e)){var event=events[e];Plugin[_0x9061('0x8')](e,emitEvent(event));}}module[_0x9061('0x9')]=PluginEvents; \ No newline at end of file +var _0x96fd=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x1b58b8,_0x3e1c2a){var _0x479502=function(_0x3af2ae){while(--_0x3af2ae){_0x1b58b8['push'](_0x1b58b8['shift']());}};_0x479502(++_0x3e1c2a);}(_0x96fd,0x1e9));var _0xd96f=function(_0x20851b,_0x593393){_0x20851b=_0x20851b-0x0;var _0x41c459=_0x96fd[_0x20851b];return _0x41c459;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xd96f('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xd96f('0x1')](0x0);var events={'afterCreate':_0xd96f('0x2'),'afterUpdate':'update','afterDestroy':_0xd96f('0x3')};function emitEvent(_0x110958){return function(_0x44f63c,_0x22b39b,_0x5d8681){PluginEvents[_0xd96f('0x4')](_0x110958+':'+_0x44f63c['id'],_0x44f63c);PluginEvents[_0xd96f('0x4')](_0x110958,_0x44f63c);_0x5d8681(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xd96f('0x5')](e,emitEvent(event));}}module[_0xd96f('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9dfef7c..626c442 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 _0x18ae=['define','Plugin','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x1b0da1,_0x501aa6){var _0x19aeb5=function(_0x3334fa){while(--_0x3334fa){_0x1b0da1['push'](_0x1b0da1['shift']());}};_0x19aeb5(++_0x501aa6);}(_0x18ae,0x1c5));var _0xe18a=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x18ae[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0xe18a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe18a('0x1'));var BPromise=require(_0xe18a('0x2'));var rp=require(_0xe18a('0x3'));var fs=require('fs');var path=require(_0xe18a('0x4'));var rimraf=require(_0xe18a('0x5'));var config=require(_0xe18a('0x6'));var attributes=require(_0xe18a('0x7'));module[_0xe18a('0x8')]=function(_0x284bd9,_0x4683a1){return _0x284bd9[_0xe18a('0x9')](_0xe18a('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62f8=['Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./plugin.attributes','exports'];(function(_0x22f7aa,_0x5c01d8){var _0x9f6274=function(_0x17cbc1){while(--_0x17cbc1){_0x22f7aa['push'](_0x22f7aa['shift']());}};_0x9f6274(++_0x5c01d8);}(_0x62f8,0x116));var _0x862f=function(_0x478285,_0x4c8942){_0x478285=_0x478285-0x0;var _0x2dca74=_0x62f8[_0x478285];return _0x2dca74;};'use strict';var _=require(_0x862f('0x0'));var util=require(_0x862f('0x1'));var logger=require(_0x862f('0x2'))(_0x862f('0x3'));var moment=require(_0x862f('0x4'));var BPromise=require(_0x862f('0x5'));var rp=require(_0x862f('0x6'));var fs=require('fs');var path=require(_0x862f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x862f('0x8'));module[_0x862f('0x9')]=function(_0x1b341e,_0x5c29cb){return _0x1b341e['define'](_0x862f('0xa'),attributes,{'tableName':_0x862f('0xb'),'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 d7143fe..5a3b7ae 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 _0xd15d=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4b719b,_0x440b42){var _0x90fbee=function(_0xccfd7e){while(--_0xccfd7e){_0x4b719b['push'](_0x4b719b['shift']());}};_0x90fbee(++_0x440b42);}(_0xd15d,0xe1));var _0xdd15=function(_0x2d0d4b,_0x2e4c34){_0x2d0d4b=_0x2d0d4b-0x0;var _0x55a5dd=_0xd15d[_0x2d0d4b];return _0x55a5dd;};'use strict';var _=require(_0xdd15('0x0'));var util=require(_0xdd15('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdd15('0x2'));var fs=require('fs');var Redis=require(_0xdd15('0x3'));var db=require(_0xdd15('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd15('0x5'))(_0xdd15('0x6'));var config=require(_0xdd15('0x7'));var jayson=require(_0xdd15('0x8'));var client=jayson['client'][_0xdd15('0x9')]({'port':0x232a});config[_0xdd15('0xa')]=_[_0xdd15('0xb')](config[_0xdd15('0xa')],{'host':_0xdd15('0xc'),'port':0x18eb});var socket=require(_0xdd15('0xd'))(new Redis(config[_0xdd15('0xa')]));require(_0xdd15('0xe'))['register'](socket);function respondWithRpcPromise(_0x64c710,_0x1ce611,_0x307d01){return new BPromise(function(_0x47a020,_0x3f9bfa){return client[_0xdd15('0xf')](_0x64c710,_0x307d01)['then'](function(_0x220822){logger[_0xdd15('0x10')](_0xdd15('0x11'),_0x1ce611,'request\x20sent');logger[_0xdd15('0x12')](_0xdd15('0x13'),_0x1ce611,_0xdd15('0x14'),JSON[_0xdd15('0x15')](_0x220822));if(_0x220822[_0xdd15('0x16')]){if(_0x220822[_0xdd15('0x16')][_0xdd15('0x17')]===0x1f4){logger[_0xdd15('0x16')](_0xdd15('0x11'),_0x1ce611,_0x220822['error'][_0xdd15('0x18')]);return _0x3f9bfa(_0x220822[_0xdd15('0x16')][_0xdd15('0x18')]);}logger[_0xdd15('0x16')](_0xdd15('0x11'),_0x1ce611,_0x220822[_0xdd15('0x16')][_0xdd15('0x18')]);return _0x47a020(_0x220822[_0xdd15('0x16')][_0xdd15('0x18')]);}else{logger[_0xdd15('0x10')](_0xdd15('0x11'),_0x1ce611,_0xdd15('0x14'));_0x47a020(_0x220822[_0xdd15('0x19')][_0xdd15('0x18')]);}})[_0xdd15('0x1a')](function(_0x2a8944){logger[_0xdd15('0x16')](_0xdd15('0x11'),_0x1ce611,_0x2a8944);_0x3f9bfa(_0x2a8944);});});}exports['CreatePlugin']=function(_0x348573){var _0x338edc=this;return new Promise(function(_0x5ac3af,_0x1105e6){return db[_0xdd15('0x1b')][_0xdd15('0x1c')](_0x348573[_0xdd15('0x1d')],{'raw':_0x348573['options']?_0x348573[_0xdd15('0x1e')][_0xdd15('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x54fc41){logger[_0xdd15('0x10')](_0xdd15('0x20'),_0x348573);logger[_0xdd15('0x12')](_0xdd15('0x20'),_0x348573,JSON[_0xdd15('0x15')](_0x54fc41));_0x5ac3af(_0x54fc41);})[_0xdd15('0x1a')](function(_0x348f04){logger[_0xdd15('0x16')](_0xdd15('0x20'),_0x348f04['message'],_0x348573);_0x1105e6(_0x338edc[_0xdd15('0x16')](0x1f4,_0x348f04[_0xdd15('0x18')]));});});}; \ No newline at end of file +var _0xbaf4=['request\x20sent','stringify','error','message','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0x2317af,_0x1332d3){var _0x3cb58d=function(_0x4e75a0){while(--_0x4e75a0){_0x2317af['push'](_0x2317af['shift']());}};_0x3cb58d(++_0x1332d3);}(_0xbaf4,0x13f));var _0x4baf=function(_0x82630f,_0x3a1261){_0x82630f=_0x82630f-0x0;var _0xd67eb6=_0xbaf4[_0x82630f];return _0xd67eb6;};'use strict';var _=require(_0x4baf('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(_0x4baf('0x1'))['db'];var utils=require(_0x4baf('0x2'));var logger=require(_0x4baf('0x3'))('rpc');var config=require(_0x4baf('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4baf('0x5')][_0x4baf('0x6')]({'port':0x232a});config[_0x4baf('0x7')]=_['defaults'](config[_0x4baf('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x4baf('0x8'))(new Redis(config[_0x4baf('0x7')]));require(_0x4baf('0x9'))[_0x4baf('0xa')](socket);function respondWithRpcPromise(_0x5d0059,_0x500bcb,_0x11c8fe){return new BPromise(function(_0x4d9160,_0x1dcd2d){return client[_0x4baf('0xb')](_0x5d0059,_0x11c8fe)[_0x4baf('0xc')](function(_0x20e6d1){logger[_0x4baf('0xd')](_0x4baf('0xe'),_0x500bcb,'request\x20sent');logger[_0x4baf('0xf')](_0x4baf('0x10'),_0x500bcb,_0x4baf('0x11'),JSON[_0x4baf('0x12')](_0x20e6d1));if(_0x20e6d1['error']){if(_0x20e6d1['error']['code']===0x1f4){logger['error'](_0x4baf('0xe'),_0x500bcb,_0x20e6d1[_0x4baf('0x13')][_0x4baf('0x14')]);return _0x1dcd2d(_0x20e6d1[_0x4baf('0x13')][_0x4baf('0x14')]);}logger[_0x4baf('0x13')]('Plugin,\x20%s,\x20%s',_0x500bcb,_0x20e6d1['error'][_0x4baf('0x14')]);return _0x4d9160(_0x20e6d1[_0x4baf('0x13')][_0x4baf('0x14')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x500bcb,_0x4baf('0x11'));_0x4d9160(_0x20e6d1['result'][_0x4baf('0x14')]);}})[_0x4baf('0x15')](function(_0x126b93){logger[_0x4baf('0x13')]('Plugin,\x20%s,\x20%s',_0x500bcb,_0x126b93);_0x1dcd2d(_0x126b93);});});}exports['CreatePlugin']=function(_0x110090){var _0x4ec7ee=this;return new Promise(function(_0x37554f,_0x5511c2){return db[_0x4baf('0x16')][_0x4baf('0x17')](_0x110090[_0x4baf('0x18')],{'raw':_0x110090[_0x4baf('0x19')]?_0x110090[_0x4baf('0x19')][_0x4baf('0x1a')]===undefined?!![]:![]:!![]})[_0x4baf('0xc')](function(_0x5a4a81){logger[_0x4baf('0xd')](_0x4baf('0x1b'),_0x110090);logger['debug']('CreatePlugin',_0x110090,JSON[_0x4baf('0x12')](_0x5a4a81));_0x37554f(_0x5a4a81);})[_0x4baf('0x15')](function(_0x551d14){logger[_0x4baf('0x13')](_0x4baf('0x1b'),_0x551d14[_0x4baf('0x14')],_0x110090);_0x5511c2(_0x4ec7ee[_0x4baf('0x13')](0x1f4,_0x551d14[_0x4baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3f9f364..cb20542 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 _0xb15c=['save','update','emit','removeListener','register','length','plugin:'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb15c,0x103));var _0xcb15=function(_0x595719,_0x475ccc){_0x595719=_0x595719-0x0;var _0x4226ff=_0xb15c[_0x595719];return _0x4226ff;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xcb15('0x0'),'remove',_0xcb15('0x1')];function createListener(_0x3e0cc9,_0x498187){return function(_0x3b0e23){_0x498187[_0xcb15('0x2')](_0x3e0cc9,_0x3b0e23);};}function removeListener(_0x401a0d,_0xe310b6){return function(){PluginEvents[_0xcb15('0x3')](_0x401a0d,_0xe310b6);};}exports[_0xcb15('0x4')]=function(_0x4234b6){for(var _0x2f1ade=0x0,_0x533f2f=events[_0xcb15('0x5')];_0x2f1ade<_0x533f2f;_0x2f1ade++){var _0x355823=events[_0x2f1ade];var _0x1a5d2a=createListener(_0xcb15('0x6')+_0x355823,_0x4234b6);PluginEvents['on'](_0x355823,_0x1a5d2a);}}; \ No newline at end of file +var _0xa384=['./plugin.events','remove','update','emit','removeListener','register','length','plugin:'];(function(_0x25a0b9,_0x86e28f){var _0x30b9ab=function(_0x883a4){while(--_0x883a4){_0x25a0b9['push'](_0x25a0b9['shift']());}};_0x30b9ab(++_0x86e28f);}(_0xa384,0x80));var _0x4a38=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xa384[_0xbd08b4];return _0x314f1e;};'use strict';var PluginEvents=require(_0x4a38('0x0'));var events=['save',_0x4a38('0x1'),_0x4a38('0x2')];function createListener(_0x3f5e14,_0x2e24a3){return function(_0x500d7d){_0x2e24a3[_0x4a38('0x3')](_0x3f5e14,_0x500d7d);};}function removeListener(_0x16b3aa,_0x10f3ac){return function(){PluginEvents[_0x4a38('0x4')](_0x16b3aa,_0x10f3ac);};}exports[_0x4a38('0x5')]=function(_0xe2cc3b){for(var _0x1c1cee=0x0,_0x16b82f=events[_0x4a38('0x6')];_0x1c1cee<_0x16b82f;_0x1c1cee++){var _0x1acaef=events[_0x1c1cee];var _0x42703d=createListener(_0x4a38('0x7')+_0x1acaef,_0xe2cc3b);PluginEvents['on'](_0x1acaef,_0x42703d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 98545a8..72eb7fd 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(_0x3c327d,_0x1c6652){var _0x15bdbe=function(_0x862b16){while(--_0x862b16){_0x3c327d['push'](_0x3c327d['shift']());}};_0x15bdbe(++_0x1c6652);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x39a7d7,_0x3a608e){var _0x4c219a=function(_0x1c6281){while(--_0x1c6281){_0x39a7d7['push'](_0x39a7d7['shift']());}};_0x4c219a(++_0x3a608e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 a7061f6..6229e4e 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 _0x9c44=['exec','bluebird','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','motion2','length','catch','body','script','join','../../files/plugins','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','../../config/logger','api','path','child_process'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var path=require(_0x49c4('0x2'));var exec=require(_0x49c4('0x3'))[_0x49c4('0x4')];var BPromise=require(_0x49c4('0x5'));function handleEntityNotFound(_0x4e0313,_0x4941f1){return function(_0x41a183){if(!_0x41a183){_0x4e0313['sendStatus'](0x194);;}return _0x41a183;};}function respondWithResult(_0xc1278f,_0x6030ae){_0x6030ae=_0x6030ae||0xc8;return function(_0x69bc41){if(_0x69bc41){return _0xc1278f[_0x49c4('0x6')](_0x6030ae)[_0x49c4('0x7')](_0x69bc41);}return null;};}function handleError(_0x511d53,_0x11c586){_0x11c586=_0x11c586||0x1f4;return function(_0x42e4f8){logger[_0x49c4('0x8')](_0x42e4f8[_0x49c4('0x9')]);if(_0x42e4f8['name']){delete _0x42e4f8['name'];}_0x511d53[_0x49c4('0x6')](_0x11c586)[_0x49c4('0xa')](_0x42e4f8);};}function execChildProcess(){return new BPromise(function(_0x58cad7,_0xb611a1){exec(_0x49c4('0xb'),function(_0x4adb3c,_0x536d42,_0x1d19bf){logger[_0x49c4('0xc')](_0x536d42);logger['info'](_0x1d19bf);if(_0x4adb3c){logger[_0x49c4('0x8')](_0x4adb3c);return _0xb611a1(_0x4adb3c);}return _0x58cad7(_0x536d42);});});}exports[_0x49c4('0xd')]=function(_0x5f2fd9,_0x1909fe){return pm2[_0x49c4('0xe')]()[_0x49c4('0xf')](function(_0x2decee){if(_0x2decee){var _0x12777c=_[_0x49c4('0x10')](_0x2decee,function(_0x75ea8){return _0x75ea8[_0x49c4('0x11')]==='express'||_0x75ea8[_0x49c4('0x11')]===_0x49c4('0x12');});return{'rows':_0x12777c,'count':_0x12777c[_0x49c4('0x13')]};}return null;})[_0x49c4('0xf')](respondWithResult(_0x1909fe,null))[_0x49c4('0x14')](handleError(_0x1909fe,null));};exports['show']=function(_0x44e607,_0x2891f4){return pm2['describe'](_0x44e607['params']['id'])[_0x49c4('0xf')](respondWithResult(_0x2891f4,null))[_0x49c4('0xf')](handleEntityNotFound(_0x2891f4,null))[_0x49c4('0x14')](handleError(_0x2891f4,null));};exports['create']=function(_0x24856d,_0x50b151){if(_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')]&&_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]){var _0x382040=path[_0x49c4('0x17')](__dirname,_0x49c4('0x18'),_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]);var _0x578447=process['cwd']();process['chdir'](path[_0x49c4('0x19')](_0x382040));return execChildProcess()['then'](function(_0x592bb8){process[_0x49c4('0x1a')](_0x578447);return pm2[_0x49c4('0x1b')]({'name':_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')],'script':_0x382040});})['then'](function(_0x5850f2){pm2[_0x49c4('0x1c')]();return _0x5850f2[0x0];})[_0x49c4('0xf')](respondWithResult(_0x50b151,0xc9))['catch'](handleError(_0x50b151,null));}else{return _0x50b151[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x1d')});}};exports[_0x49c4('0x1e')]=function(_0x531d92,_0x543ea2){if(_0x531d92[_0x49c4('0x15')]['id']){delete _0x531d92['body']['id'];}var _0x3800b7={'online':_0x49c4('0x1f'),'stopped':_0x49c4('0x20')};if(_0x3800b7[_0x49c4('0x21')](_0x531d92['body'][_0x49c4('0x6')])){return pm2[_0x3800b7[_0x531d92[_0x49c4('0x15')][_0x49c4('0x6')]]](_0x531d92[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](respondWithResult(_0x543ea2,0xc8))[_0x49c4('0x14')](handleError(_0x543ea2,null));}else{return _0x543ea2[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x23')});}};exports[_0x49c4('0x24')]=function(_0x46f7ea,_0x4ea6ea){if(_0x46f7ea['body']['id']){delete _0x46f7ea['body']['id'];}if(_0x46f7ea[_0x49c4('0x22')]['id']){return pm2[_0x49c4('0x25')](_0x46f7ea[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](function(_0x28eb47){pm2['dump']();return _0x28eb47[0x0];})[_0x49c4('0xf')](respondWithResult(_0x4ea6ea,null))[_0x49c4('0x14')](handleError(_0x4ea6ea,null));}else{return _0x4ea6ea[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x7072=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','express','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump'];(function(_0x198b50,_0x4c2758){var _0x36bc7d=function(_0x2c7120){while(--_0x2c7120){_0x198b50['push'](_0x198b50['shift']());}};_0x36bc7d(++_0x4c2758);}(_0x7072,0x138));var _0x2707=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x7072[_0x4b73a2];return _0x383c66;};'use strict';var _=require('lodash');var pm2=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var path=require(_0x2707('0x3'));var exec=require(_0x2707('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0xfdfa7a,_0x5f3c1c){return function(_0xd36287){if(!_0xd36287){_0xfdfa7a[_0x2707('0x5')](0x194);;}return _0xd36287;};}function respondWithResult(_0x1e86f2,_0x194132){_0x194132=_0x194132||0xc8;return function(_0x2fd8ff){if(_0x2fd8ff){return _0x1e86f2[_0x2707('0x6')](_0x194132)[_0x2707('0x7')](_0x2fd8ff);}return null;};}function handleError(_0x745cfd,_0x4062b6){_0x4062b6=_0x4062b6||0x1f4;return function(_0x2820ef){logger['error'](_0x2820ef['stack']);if(_0x2820ef[_0x2707('0x8')]){delete _0x2820ef[_0x2707('0x8')];}_0x745cfd[_0x2707('0x6')](_0x4062b6)[_0x2707('0x9')](_0x2820ef);};}function execChildProcess(){return new BPromise(function(_0x30090e,_0x2e1a46){exec(_0x2707('0xa'),function(_0x19881c,_0x115535,_0x478717){logger[_0x2707('0xb')](_0x115535);logger[_0x2707('0xb')](_0x478717);if(_0x19881c){logger[_0x2707('0xc')](_0x19881c);return _0x2e1a46(_0x19881c);}return _0x30090e(_0x115535);});});}exports['index']=function(_0x44c1d7,_0x590152){return pm2[_0x2707('0xd')]()[_0x2707('0xe')](function(_0xfe975c){if(_0xfe975c){var _0x3a67f2=_[_0x2707('0xf')](_0xfe975c,function(_0x4e52a3){return _0x4e52a3[_0x2707('0x8')]===_0x2707('0x10')||_0x4e52a3[_0x2707('0x8')]==='motion2';});return{'rows':_0x3a67f2,'count':_0x3a67f2[_0x2707('0x11')]};}return null;})[_0x2707('0xe')](respondWithResult(_0x590152,null))[_0x2707('0x12')](handleError(_0x590152,null));};exports[_0x2707('0x13')]=function(_0x7ed037,_0x27a3ea){return pm2['describe'](_0x7ed037[_0x2707('0x14')]['id'])[_0x2707('0xe')](respondWithResult(_0x27a3ea,null))[_0x2707('0xe')](handleEntityNotFound(_0x27a3ea,null))['catch'](handleError(_0x27a3ea,null));};exports['create']=function(_0x58a4ee,_0x1da4a6){if(_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')]&&_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]){var _0x3c2935=path[_0x2707('0x17')](__dirname,_0x2707('0x18'),_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]);var _0x37c475=process[_0x2707('0x19')]();process[_0x2707('0x1a')](path[_0x2707('0x1b')](_0x3c2935));return execChildProcess()['then'](function(_0x1acf22){process[_0x2707('0x1a')](_0x37c475);return pm2[_0x2707('0x1c')]({'name':_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')],'script':_0x3c2935});})[_0x2707('0xe')](function(_0x4831ed){pm2[_0x2707('0x1d')]();return _0x4831ed[0x0];})[_0x2707('0xe')](respondWithResult(_0x1da4a6,0xc9))[_0x2707('0x12')](handleError(_0x1da4a6,null));}else{return _0x1da4a6[_0x2707('0x6')](0x1f4)[_0x2707('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2707('0x1e')]=function(_0x4ca05d,_0x29dad2){if(_0x4ca05d[_0x2707('0x15')]['id']){delete _0x4ca05d[_0x2707('0x15')]['id'];}var _0x57da26={'online':_0x2707('0x1f'),'stopped':_0x2707('0x20')};if(_0x57da26[_0x2707('0x21')](_0x4ca05d['body'][_0x2707('0x6')])){return pm2[_0x57da26[_0x4ca05d[_0x2707('0x15')]['status']]](_0x4ca05d[_0x2707('0x14')]['id'])['then'](respondWithResult(_0x29dad2,0xc8))['catch'](handleError(_0x29dad2,null));}else{return _0x29dad2[_0x2707('0x6')](0x1f4)['send']({'message':_0x2707('0x22')});}};exports[_0x2707('0x23')]=function(_0x417a97,_0x36b2e9){if(_0x417a97['body']['id']){delete _0x417a97[_0x2707('0x15')]['id'];}if(_0x417a97[_0x2707('0x14')]['id']){return pm2[_0x2707('0x24')](_0x417a97[_0x2707('0x14')]['id'])[_0x2707('0xe')](function(_0x341e14){pm2[_0x2707('0x1d')]();return _0x341e14[0x0];})[_0x2707('0xe')](respondWithResult(_0x36b2e9,null))[_0x2707('0x12')](handleError(_0x36b2e9,null));}else{return _0x36b2e9['status'](0x1f4)[_0x2707('0x9')]({'message':_0x2707('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index fd5a87c..df75e8f 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 _0x7331=['get','/agents','getAgents','/queues','isAuthenticated','getQueues','express','Router','../../components/auth/service'];(function(_0x4f03e5,_0x16d974){var _0x2d4e1c=function(_0x487e9f){while(--_0x487e9f){_0x4f03e5['push'](_0x4f03e5['shift']());}};_0x2d4e1c(++_0x16d974);}(_0x7331,0x189));var _0x1733=function(_0x34c4ec,_0x4804f0){_0x34c4ec=_0x34c4ec-0x0;var _0x4defbf=_0x7331[_0x34c4ec];return _0x4defbf;};'use strict';var express=require(_0x1733('0x0'));var router=express[_0x1733('0x1')]();var auth=require(_0x1733('0x2'));var controller=require('./realtime.controller');router[_0x1733('0x3')](_0x1733('0x4'),auth['isAuthenticated'](),controller[_0x1733('0x5')]);router[_0x1733('0x3')](_0x1733('0x6'),auth[_0x1733('0x7')](),controller[_0x1733('0x8')]);module['exports']=router; \ No newline at end of file +var _0x0c6d=['/queues','getQueues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0c6d,0x89));var _0xd0c6=function(_0x459c22,_0x226a3f){_0x459c22=_0x459c22-0x0;var _0x5878df=_0x0c6d[_0x459c22];return _0x5878df;};'use strict';var express=require(_0xd0c6('0x0'));var router=express[_0xd0c6('0x1')]();var auth=require(_0xd0c6('0x2'));var controller=require(_0xd0c6('0x3'));router[_0xd0c6('0x4')](_0xd0c6('0x5'),auth[_0xd0c6('0x6')](),controller['getAgents']);router[_0xd0c6('0x4')](_0xd0c6('0x7'),auth[_0xd0c6('0x6')](),controller[_0xd0c6('0x8')]);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 fcbd3b0..f4da013 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 _0x1c08=['UserProfile','getResources','User','find','filterAgentAttributes','globalStatus','getAgentStatus','includes','voice','voiceStatus','Status','sortAgentsByStatus','pick','getQueues','resolve','startCase','outbound','dialActive','dialMethod','QueueCampaigns','Queues','name','filter','findAndCountAll','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','fields','join','then','getRealtimeAgents','rows','getAgentIdsByStatus','map','rawAttributes','fieldName','type','key','agent','getOptions','length','sequelize','literal','order','push','Pause','forEach','where','merge','user','role','userProfileId','Agents','online','extraQueryConditions','assign'];(function(_0x1816ae,_0x29ca4c){var _0x3173ec=function(_0x3ae04e){while(--_0x3ae04e){_0x1816ae['push'](_0x1816ae['shift']());}};_0x3173ec(++_0x29ca4c);}(_0x1c08,0x169));var _0x81c0=function(_0x5b6828,_0x4a19d9){_0x5b6828=_0x5b6828-0x0;var _0x2dbd2c=_0x1c08[_0x5b6828];return _0x2dbd2c;};'use strict';var _=require(_0x81c0('0x0'));var util=require(_0x81c0('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x81c0('0x2'));var qs=require(_0x81c0('0x3'));var utils=require(_0x81c0('0x4'));var db=require(_0x81c0('0x5'))['db'];var APIBadRequestError=require(_0x81c0('0x6'))[_0x81c0('0x7')];var APIHandleError=require('../../errors/api')[_0x81c0('0x8')];function respondWithFilteredResult(_0x43ed11,_0x7499f7){return function(_0x48fd44){if(_0x48fd44){var _0x20e7e1=typeof _0x7499f7[_0x81c0('0x9')]===_0x81c0('0xa')&&typeof _0x7499f7[_0x81c0('0xb')]==='undefined';var _0x565ca6=_0x48fd44[_0x81c0('0xc')];var _0x55dd4f=_0x20e7e1?0x0:_0x7499f7[_0x81c0('0x9')];var _0x2a5871=_0x20e7e1?_0x48fd44[_0x81c0('0xc')]:_0x7499f7['offset']+_0x7499f7[_0x81c0('0xb')];var _0x27019c;if(_0x2a5871>=_0x565ca6){_0x2a5871=_0x565ca6;_0x27019c=0xc8;}else{_0x27019c=0xce;}_0x43ed11['status'](_0x27019c);return _0x43ed11[_0x81c0('0xd')](_0x81c0('0xe'),_0x55dd4f+'-'+_0x2a5871+'/'+_0x565ca6)[_0x81c0('0xf')](_0x48fd44);}return null;};}exports[_0x81c0('0x10')]=function(_0x5f4440,_0x40875b){var _0x2619a6={'count':0x0,'rows':[]};var _0x162b73={};var _0x499e38;var _0x5a6b21=utils[_0x81c0('0x11')]();var _0xe5ecce;var _0xc43409;var _0x5613dc=_0x5f4440[_0x81c0('0x12')][_0x81c0('0x13')];var _0x1a2649=_0x5f4440[_0x81c0('0x12')][_0x81c0('0x14')];var _0x4b9a05=_0x5f4440[_0x81c0('0x12')][_0x81c0('0x15')];var _0x3e8062=_0x1a2649===_0x81c0('0x16')||_0x1a2649===_0x81c0('0x17')?!![]:![];var _0x17fabb=[];var _0x29a781;var _0x3cd2b0;Promise['resolve']()['then'](function(){if(_0x5f4440[_0x81c0('0x12')][_0x81c0('0x18')]){if(!utils[_0x81c0('0x19')](_0x5f4440['query'][_0x81c0('0x18')])){throw new APIBadRequestError(util[_0x81c0('0x1a')](_0x81c0('0x1b'),_0x5f4440[_0x81c0('0x12')]['channel']));}_0x499e38=_0x5f4440[_0x81c0('0x12')]['channel'][_0x81c0('0x1c')]();}if(!_0x5f4440[_0x81c0('0x12')][_0x81c0('0x1d')]||!_0x5f4440[_0x81c0('0x12')][_0x81c0('0x1d')]['includes']('globalStatus')){_0x5f4440[_0x81c0('0x12')][_0x81c0('0x1d')]=rta['validateSortParameter'](_0x5f4440[_0x81c0('0x12')]['sort']);return;}var _0x496d1a=rta['getUpdatedSortOptions'](_0x5f4440[_0x81c0('0x12')]['sort']);_0x5f4440[_0x81c0('0x12')][_0x81c0('0x1d')]=_0x496d1a[_0x81c0('0x1e')][_0x81c0('0x1f')](',');_0x29a781=_0x496d1a['order'];})[_0x81c0('0x20')](function(){if(!_0x5613dc){return[];}return rta['getAgentIdsByQueues'](_0x5613dc,_0x499e38);})['then'](function(_0x47dcf6){_0x17fabb=_0x47dcf6;return rta[_0x81c0('0x21')]();})[_0x81c0('0x20')](function(_0x1e83e5){_0xc43409=_0x1e83e5[_0x81c0('0x22')];if((!_0x1a2649||_0x3e8062)&&!_0x29a781){return _0x17fabb;}if(_0x29a781&&!_0x1a2649){return rta['getSortedAgentsIdsByStatus'](_0xc43409,_0x17fabb,_0x29a781);}else{return rta[_0x81c0('0x23')](_0xc43409,_0x17fabb,_0x1a2649);}})[_0x81c0('0x20')](function(_0x195c47){_0x17fabb=_0x195c47;var _0x56d021=![];if(_0x17fabb['length']===0x0){if(_0x5613dc||_0x1a2649){_0x56d021=!![];}if(_0x3e8062){_0x56d021=![];}}if(_0x56d021){return _0x2619a6;}var _0x425045=_[_0x81c0('0x24')](db['User'][_0x81c0('0x25')],function(_0x4c588c){return{'name':_0x4c588c[_0x81c0('0x26')],'type':_0x4c588c[_0x81c0('0x27')][_0x81c0('0x28')]};});_0x5f4440[_0x81c0('0x12')]['role']=_0x81c0('0x29');_0x162b73=qs[_0x81c0('0x2a')](_0x425045,_0x5f4440);_0x162b73['raw']=!![];var _0x3103ec=[];if(_0x17fabb[_0x81c0('0x2b')]>0x0){_0x3103ec['push']({'id':{'$in':_0x17fabb}});if(_0x29a781&&!_0x1a2649){_0x3cd2b0=[db[_0x81c0('0x2c')][_0x81c0('0x2d')]('FIELD(id,'+_0x17fabb+')')];_0x162b73[_0x81c0('0x2e')]=_0x3cd2b0;}}if(_0x3e8062){_0x5a6b21['forEach'](function(_0x66231a){var _0x4c5294=!![];if(_0x1a2649===_0x81c0('0x17')&&_0x499e38!==_0x66231a){_0x4c5294=![];}_0x3103ec[_0x81c0('0x2f')]({[_0x66231a+_0x81c0('0x30')]:_0x4c5294});});if(_0x4b9a05){_0x3103ec[_0x81c0('0x2f')]({'pauseType':_0x4b9a05});}}else if(_0x1a2649){_0x5a6b21[_0x81c0('0x31')](function(_0x4d90a0){_0x3103ec[_0x81c0('0x2f')]({[_0x4d90a0+_0x81c0('0x30')]:![]});});}_0x162b73[_0x81c0('0x32')]=_[_0x81c0('0x33')](_0x162b73['where'],{'$and':_0x3103ec});if(_0x5f4440[_0x81c0('0x34')][_0x81c0('0x35')]===_0x81c0('0x34')){var _0x170076={'params':{'id':_0x5f4440[_0x81c0('0x34')][_0x81c0('0x36')]},'query':{'section':_0x81c0('0x37'),'role':_0x81c0('0x29'),'raw':!![],'ids':_0x17fabb,'customSorting':_0x3cd2b0}};if(_0x5f4440[_0x81c0('0x12')][_0x81c0('0x38')]){_0x170076['query']['online']=!![];}if(_0x3e8062){_0x170076[_0x81c0('0x12')][_0x81c0('0x39')]=_0x3103ec;}_0x170076[_0x81c0('0x12')]=Object[_0x81c0('0x3a')](_0x170076[_0x81c0('0x12')],_['omit'](_0x5f4440[_0x81c0('0x12')],'id'));return db[_0x81c0('0x3b')][_0x81c0('0x3c')](_0x170076);}return db[_0x81c0('0x3d')]['findAndCountAll'](_0x162b73);})[_0x81c0('0x20')](function(_0x25a73f){_0x2619a6[_0x81c0('0xc')]=_0x25a73f[_0x81c0('0xc')];_0xe5ecce=_0x25a73f['rows'];return _0xe5ecce[_0x81c0('0x24')](function(_0x4cc77e){var _0x43f775=_[_0x81c0('0x3e')](_0xc43409,['id',_0x4cc77e['id']]);if(_0x43f775){var _0x189d1a=rta[_0x81c0('0x3f')](_0x43f775);_[_0x81c0('0x33')](_0x4cc77e,_0x189d1a);}_0x4cc77e[_0x81c0('0x40')]=rta[_0x81c0('0x41')](_0x4cc77e);if(_0x4cc77e[_0x81c0('0x40')][_0x81c0('0x42')](_0x81c0('0x16'))){_0x5a6b21[_0x81c0('0x31')](function(_0x427926){if(_0x4cc77e[_0x427926+'Pause']){if(_0x427926===_0x81c0('0x43')){if(_0x4cc77e[_0x81c0('0x44')]!=='talking'){_0x4cc77e[_0x81c0('0x44')]=_0x81c0('0x16');}}else{_0x4cc77e[_0x427926+_0x81c0('0x45')]=_0x81c0('0x16');}}});}return _0x4cc77e;});})['then'](function(_0x3e9986){if(!_0x29a781||_0x3cd2b0){return _0x3e9986;}return rta[_0x81c0('0x46')](_0x3e9986,_0x29a781);})[_0x81c0('0x20')](function(_0x5cf335){var _0x33f082=rta['getRealtimeAgentsQueryFields']();_0x2619a6[_0x81c0('0x22')]=_0x5cf335[_0x81c0('0x24')](function(_0x66790e){return _[_0x81c0('0x47')](_0x66790e,_0x33f082);});return _0x2619a6;})[_0x81c0('0x20')](respondWithFilteredResult(_0x40875b,_0x162b73))['catch'](APIHandleError(_0x40875b));};exports[_0x81c0('0x48')]=function(_0xa4d24d,_0x314dfe){var _0x25f7e5={'count':0x0,'rows':[]};var _0x3a8f4d={};var _0x2a528e;var _0x525498;var _0x15e4ca;Promise[_0x81c0('0x49')]()[_0x81c0('0x20')](function(){if(_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x18')]){if(!utils[_0x81c0('0x19')](_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x18')])){throw new APIBadRequestError(util[_0x81c0('0x1a')](_0x81c0('0x1b'),_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x18')]));}_0x2a528e=_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x18')][_0x81c0('0x1c')]();}var _0x4a6409=_[_0x81c0('0x4a')](_0x2a528e)+'Queue';var _0x2742a1=_[_0x81c0('0x24')](db[_0x4a6409][_0x81c0('0x25')],function(_0x53c8aa){return{'name':_0x53c8aa[_0x81c0('0x26')],'type':_0x53c8aa['type'][_0x81c0('0x28')]};});if(!_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x1e')]){var _0x57b259=['id','name'];if(_0x2a528e===_0x81c0('0x43')){_0x57b259['push'](_0x81c0('0x27'));if(_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x27')]===_0x81c0('0x4b')){_0x57b259[_0x81c0('0x2f')]([_0x81c0('0x4c'),_0x81c0('0x4d')]);}}_0xa4d24d['query'][_0x81c0('0x1e')]=_0x57b259[_0x81c0('0x1f')](',');}_0x3a8f4d=qs[_0x81c0('0x2a')](_0x2742a1,_0xa4d24d);if(_0xa4d24d[_0x81c0('0x34')]['role']===_0x81c0('0x34')){var _0x58c41d={'params':{'id':_0xa4d24d['user'][_0x81c0('0x36')]},'query':{'section':_0x2a528e===_0x81c0('0x43')&&_0xa4d24d['query'][_0x81c0('0x27')]===_0x81c0('0x4b')?_0x81c0('0x4e'):_[_0x81c0('0x4a')](_0x2a528e)+_0x81c0('0x4f'),'type':_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x27')],'nolimit':!![],'sort':_0x81c0('0x50'),'filter':_0xa4d24d['query'][_0x81c0('0x51')]}};_0x58c41d['query']=Object[_0x81c0('0x3a')](_0x58c41d[_0x81c0('0x12')],_0xa4d24d['query']);delete _0x58c41d['query']['id'];return db[_0x81c0('0x3b')][_0x81c0('0x3c')](_0x58c41d);}return db[_0x4a6409][_0x81c0('0x52')](_0x3a8f4d);})[_0x81c0('0x20')](function(_0x4f83b2){_0x25f7e5[_0x81c0('0xc')]=_0x4f83b2[_0x81c0('0xc')];_0x525498=_0x4f83b2[_0x81c0('0x22')];return rtq['getRealtimeQueues'](_0xa4d24d,_0x2a528e);})[_0x81c0('0x20')](function(_0x487ef3){_0x15e4ca=_0x487ef3['rows'];return rtq[_0x81c0('0x53')](_0x525498,_0x15e4ca,_0x2a528e,_0xa4d24d[_0x81c0('0x12')][_0x81c0('0x27')]);})[_0x81c0('0x20')](function(_0x2ed314){_0x25f7e5['rows']=_0x2ed314;return _0x25f7e5;})[_0x81c0('0x20')](respondWithFilteredResult(_0x314dfe,_0x3a8f4d))['catch'](APIHandleError(_0x314dfe));}; \ No newline at end of file +var _0xea11=['type','key','role','agent','getOptions','raw','push','FIELD(id,','order','*pause','forEach','Pause','where','user','userProfileId','Agents','online','extraQueryConditions','assign','omit','getResources','findAndCountAll','find','merge','globalStatus','getAgentStatus','pause','voice','talking','Status','sortAgentsByStatus','catch','resolve','format','name','outbound','dialActive','dialMethod','startCase','Queues','filter','UserProfile','getRealtimeQueues','initializeQueues','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','Content-Range','json','getAgents','query','globalStatusFilter','pauseTypeFilter','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','then','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName'];(function(_0x463885,_0x2cd358){var _0x4ecc1c=function(_0x24aa39){while(--_0x24aa39){_0x463885['push'](_0x463885['shift']());}};_0x4ecc1c(++_0x2cd358);}(_0xea11,0x7c));var _0x1ea1=function(_0x1e0937,_0xedf597){_0x1e0937=_0x1e0937-0x0;var _0x28aa73=_0xea11[_0x1e0937];return _0x28aa73;};'use strict';var _=require('lodash');var util=require('util');var rta=require(_0x1ea1('0x0'));var rtq=require(_0x1ea1('0x1'));var qs=require(_0x1ea1('0x2'));var utils=require(_0x1ea1('0x3'));var db=require(_0x1ea1('0x4'))['db'];var APIBadRequestError=require(_0x1ea1('0x5'))[_0x1ea1('0x6')];var APIHandleError=require(_0x1ea1('0x5'))[_0x1ea1('0x7')];function respondWithFilteredResult(_0x2417b5,_0x5c4365){return function(_0x3d27f6){if(_0x3d27f6){var _0x3f172e=typeof _0x5c4365[_0x1ea1('0x8')]===_0x1ea1('0x9')&&typeof _0x5c4365['limit']===_0x1ea1('0x9');var _0xe38fbc=_0x3d27f6[_0x1ea1('0xa')];var _0x26bfd9=_0x3f172e?0x0:_0x5c4365['offset'];var _0x1cf814=_0x3f172e?_0x3d27f6[_0x1ea1('0xa')]:_0x5c4365[_0x1ea1('0x8')]+_0x5c4365[_0x1ea1('0xb')];var _0x1cb04f;if(_0x1cf814>=_0xe38fbc){_0x1cf814=_0xe38fbc;_0x1cb04f=0xc8;}else{_0x1cb04f=0xce;}_0x2417b5['status'](_0x1cb04f);return _0x2417b5['set'](_0x1ea1('0xc'),_0x26bfd9+'-'+_0x1cf814+'/'+_0xe38fbc)[_0x1ea1('0xd')](_0x3d27f6);}return null;};}exports[_0x1ea1('0xe')]=function(_0xe69ab7,_0x3ee594){var _0x245b89={'count':0x0,'rows':[]};var _0x4ea8fc={};var _0x4215eb;var _0x3e5071=utils['getChannels']();var _0x1d138f;var _0x40f0ee;var _0x25a52a=_0xe69ab7[_0x1ea1('0xf')]['globalQueueFilter'];var _0x584a68=_0xe69ab7[_0x1ea1('0xf')][_0x1ea1('0x10')];var _0x4b71f8=_0xe69ab7['query'][_0x1ea1('0x11')];var _0x4cdfef=_0x584a68==='pause'||_0x584a68==='*pause'?!![]:![];var _0x8ffa4a=[];var _0xd409f4;var _0x2670a4;Promise['resolve']()['then'](function(){if(_0xe69ab7[_0x1ea1('0xf')][_0x1ea1('0x12')]){if(!utils[_0x1ea1('0x13')](_0xe69ab7['query']['channel'])){throw new APIBadRequestError(util['format'](_0x1ea1('0x14'),_0xe69ab7[_0x1ea1('0xf')]['channel']));}_0x4215eb=_0xe69ab7['query'][_0x1ea1('0x12')][_0x1ea1('0x15')]();}if(!_0xe69ab7['query'][_0x1ea1('0x16')]||!_0xe69ab7[_0x1ea1('0xf')]['sort'][_0x1ea1('0x17')]('globalStatus')){_0xe69ab7[_0x1ea1('0xf')][_0x1ea1('0x16')]=rta[_0x1ea1('0x18')](_0xe69ab7[_0x1ea1('0xf')][_0x1ea1('0x16')]);return;}var _0x508d2e=rta[_0x1ea1('0x19')](_0xe69ab7['query']['sort']);_0xe69ab7[_0x1ea1('0xf')][_0x1ea1('0x16')]=_0x508d2e[_0x1ea1('0x1a')]['join'](',');_0xd409f4=_0x508d2e['order'];})['then'](function(){if(!_0x25a52a){return[];}return rta['getAgentIdsByQueues'](_0x25a52a,_0x4215eb);})[_0x1ea1('0x1b')](function(_0x406656){_0x8ffa4a=_0x406656;return rta['getRealtimeAgents']();})['then'](function(_0x1c4edf){_0x40f0ee=_0x1c4edf[_0x1ea1('0x1c')];if((!_0x584a68||_0x4cdfef)&&!_0xd409f4){return _0x8ffa4a;}if(_0xd409f4&&!_0x584a68){return rta[_0x1ea1('0x1d')](_0x40f0ee,_0x8ffa4a,_0xd409f4);}else{return rta[_0x1ea1('0x1e')](_0x40f0ee,_0x8ffa4a,_0x584a68);}})['then'](function(_0x5d48e9){_0x8ffa4a=_0x5d48e9;var _0x118105=![];if(_0x8ffa4a[_0x1ea1('0x1f')]===0x0){if(_0x25a52a||_0x584a68){_0x118105=!![];}if(_0x4cdfef){_0x118105=![];}}if(_0x118105){return _0x245b89;}var _0x499417=_[_0x1ea1('0x20')](db[_0x1ea1('0x21')][_0x1ea1('0x22')],function(_0xe45d5b){return{'name':_0xe45d5b[_0x1ea1('0x23')],'type':_0xe45d5b[_0x1ea1('0x24')][_0x1ea1('0x25')]};});_0xe69ab7[_0x1ea1('0xf')][_0x1ea1('0x26')]=_0x1ea1('0x27');_0x4ea8fc=qs[_0x1ea1('0x28')](_0x499417,_0xe69ab7);_0x4ea8fc[_0x1ea1('0x29')]=!![];var _0x488cc8=[];if(_0x8ffa4a['length']>0x0){_0x488cc8[_0x1ea1('0x2a')]({'id':{'$in':_0x8ffa4a}});if(_0xd409f4&&!_0x584a68){_0x2670a4=[db['sequelize']['literal'](_0x1ea1('0x2b')+_0x8ffa4a+')')];_0x4ea8fc[_0x1ea1('0x2c')]=_0x2670a4;}}if(_0x4cdfef){_0x3e5071['forEach'](function(_0x4b3c1d){var _0x5c9ae3=!![];if(_0x584a68===_0x1ea1('0x2d')&&_0x4215eb!==_0x4b3c1d){_0x5c9ae3=![];}_0x488cc8[_0x1ea1('0x2a')]({[_0x4b3c1d+'Pause']:_0x5c9ae3});});if(_0x4b71f8){_0x488cc8[_0x1ea1('0x2a')]({'pauseType':_0x4b71f8});}}else if(_0x584a68){_0x3e5071[_0x1ea1('0x2e')](function(_0x44f15a){_0x488cc8[_0x1ea1('0x2a')]({[_0x44f15a+_0x1ea1('0x2f')]:![]});});}_0x4ea8fc[_0x1ea1('0x30')]=_['merge'](_0x4ea8fc[_0x1ea1('0x30')],{'$and':_0x488cc8});if(_0xe69ab7[_0x1ea1('0x31')]['role']===_0x1ea1('0x31')){var _0x535f51={'params':{'id':_0xe69ab7[_0x1ea1('0x31')][_0x1ea1('0x32')]},'query':{'section':_0x1ea1('0x33'),'role':_0x1ea1('0x27'),'raw':!![],'ids':_0x8ffa4a,'customSorting':_0x2670a4}};if(_0xe69ab7[_0x1ea1('0xf')][_0x1ea1('0x34')]){_0x535f51[_0x1ea1('0xf')]['online']=!![];}if(_0x4cdfef){_0x535f51[_0x1ea1('0xf')][_0x1ea1('0x35')]=_0x488cc8;}_0x535f51[_0x1ea1('0xf')]=Object[_0x1ea1('0x36')](_0x535f51['query'],_[_0x1ea1('0x37')](_0xe69ab7[_0x1ea1('0xf')],'id'));return db['UserProfile'][_0x1ea1('0x38')](_0x535f51);}return db['User'][_0x1ea1('0x39')](_0x4ea8fc);})['then'](function(_0xcb63fc){_0x245b89[_0x1ea1('0xa')]=_0xcb63fc[_0x1ea1('0xa')];_0x1d138f=_0xcb63fc[_0x1ea1('0x1c')];return _0x1d138f['map'](function(_0x5ed6a1){var _0x3e61c2=_[_0x1ea1('0x3a')](_0x40f0ee,['id',_0x5ed6a1['id']]);if(_0x3e61c2){var _0x12ec83=rta['filterAgentAttributes'](_0x3e61c2);_[_0x1ea1('0x3b')](_0x5ed6a1,_0x12ec83);}_0x5ed6a1[_0x1ea1('0x3c')]=rta[_0x1ea1('0x3d')](_0x5ed6a1);if(_0x5ed6a1[_0x1ea1('0x3c')][_0x1ea1('0x17')](_0x1ea1('0x3e'))){_0x3e5071['forEach'](function(_0x8ef37d){if(_0x5ed6a1[_0x8ef37d+_0x1ea1('0x2f')]){if(_0x8ef37d===_0x1ea1('0x3f')){if(_0x5ed6a1['voiceStatus']!==_0x1ea1('0x40')){_0x5ed6a1['voiceStatus']=_0x1ea1('0x3e');}}else{_0x5ed6a1[_0x8ef37d+_0x1ea1('0x41')]=_0x1ea1('0x3e');}}});}return _0x5ed6a1;});})[_0x1ea1('0x1b')](function(_0x4436b1){if(!_0xd409f4||_0x2670a4){return _0x4436b1;}return rta[_0x1ea1('0x42')](_0x4436b1,_0xd409f4);})[_0x1ea1('0x1b')](function(_0x27f130){var _0x1da91d=rta['getRealtimeAgentsQueryFields']();_0x245b89[_0x1ea1('0x1c')]=_0x27f130[_0x1ea1('0x20')](function(_0x20fe92){return _['pick'](_0x20fe92,_0x1da91d);});return _0x245b89;})[_0x1ea1('0x1b')](respondWithFilteredResult(_0x3ee594,_0x4ea8fc))[_0x1ea1('0x43')](APIHandleError(_0x3ee594));};exports['getQueues']=function(_0x14a330,_0x224c7f){var _0x28b7aa={'count':0x0,'rows':[]};var _0x236b5e={};var _0x2e8589;var _0x3945df;var _0x28f75a;Promise[_0x1ea1('0x44')]()[_0x1ea1('0x1b')](function(){if(_0x14a330[_0x1ea1('0xf')][_0x1ea1('0x12')]){if(!utils[_0x1ea1('0x13')](_0x14a330[_0x1ea1('0xf')]['channel'])){throw new APIBadRequestError(util[_0x1ea1('0x45')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x14a330[_0x1ea1('0xf')][_0x1ea1('0x12')]));}_0x2e8589=_0x14a330['query'][_0x1ea1('0x12')][_0x1ea1('0x15')]();}var _0x1348f7=_['startCase'](_0x2e8589)+'Queue';var _0x2dbaa4=_[_0x1ea1('0x20')](db[_0x1348f7][_0x1ea1('0x22')],function(_0x9a3ef1){return{'name':_0x9a3ef1['fieldName'],'type':_0x9a3ef1[_0x1ea1('0x24')][_0x1ea1('0x25')]};});if(!_0x14a330[_0x1ea1('0xf')][_0x1ea1('0x1a')]){var _0xc5883c=['id',_0x1ea1('0x46')];if(_0x2e8589===_0x1ea1('0x3f')){_0xc5883c[_0x1ea1('0x2a')](_0x1ea1('0x24'));if(_0x14a330['query']['type']===_0x1ea1('0x47')){_0xc5883c[_0x1ea1('0x2a')]([_0x1ea1('0x48'),_0x1ea1('0x49')]);}}_0x14a330[_0x1ea1('0xf')][_0x1ea1('0x1a')]=_0xc5883c['join'](',');}_0x236b5e=qs[_0x1ea1('0x28')](_0x2dbaa4,_0x14a330);if(_0x14a330['user'][_0x1ea1('0x26')]==='user'){var _0x19063e={'params':{'id':_0x14a330[_0x1ea1('0x31')]['userProfileId']},'query':{'section':_0x2e8589===_0x1ea1('0x3f')&&_0x14a330[_0x1ea1('0xf')][_0x1ea1('0x24')]===_0x1ea1('0x47')?'QueueCampaigns':_[_0x1ea1('0x4a')](_0x2e8589)+_0x1ea1('0x4b'),'type':_0x14a330[_0x1ea1('0xf')][_0x1ea1('0x24')],'nolimit':!![],'sort':_0x1ea1('0x46'),'filter':_0x14a330['query'][_0x1ea1('0x4c')]}};_0x19063e[_0x1ea1('0xf')]=Object[_0x1ea1('0x36')](_0x19063e['query'],_0x14a330[_0x1ea1('0xf')]);delete _0x19063e[_0x1ea1('0xf')]['id'];return db[_0x1ea1('0x4d')][_0x1ea1('0x38')](_0x19063e);}return db[_0x1348f7][_0x1ea1('0x39')](_0x236b5e);})[_0x1ea1('0x1b')](function(_0x199ba3){_0x28b7aa['count']=_0x199ba3[_0x1ea1('0xa')];_0x3945df=_0x199ba3[_0x1ea1('0x1c')];return rtq[_0x1ea1('0x4e')](_0x14a330,_0x2e8589);})[_0x1ea1('0x1b')](function(_0x2c52f9){_0x28f75a=_0x2c52f9[_0x1ea1('0x1c')];return rtq[_0x1ea1('0x4f')](_0x3945df,_0x28f75a,_0x2e8589,_0x14a330['query']['type']);})[_0x1ea1('0x1b')](function(_0x564279){_0x28b7aa['rows']=_0x564279;return _0x28b7aa;})[_0x1ea1('0x1b')](respondWithFilteredResult(_0x224c7f,_0x236b5e))['catch'](APIHandleError(_0x224c7f));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 8c85579..ea2f7ab 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x275383,_0x21ad58){var _0x348e94=function(_0x45ddd5){while(--_0x45ddd5){_0x275383['push'](_0x275383['shift']());}};_0x348e94(++_0x21ad58);}(_0x70e0,0x17b));var _0x070e=function(_0x2be7c8,_0x3ffd42){_0x2be7c8=_0x2be7c8-0x0;var _0x1580c3=_0x70e0[_0x2be7c8];return _0x1580c3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2898bc,_0x310976){var _0xf47cf4=function(_0x403954){while(--_0x403954){_0x2898bc['push'](_0x2898bc['shift']());}};_0xf47cf4(++_0x310976);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 4056931..357d52d 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 _0xe0c1=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x2ed13c,_0x190337){var _0x10cf06=function(_0x2d95cc){while(--_0x2d95cc){_0x2ed13c['push'](_0x2ed13c['shift']());}};_0x10cf06(++_0x190337);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x564e3e,_0x19524d){_0x564e3e=_0x564e3e-0x0;var _0x4e35dc=_0xe0c1[_0x564e3e];return _0x4e35dc;};'use strict';var Sequelize=require(_0x1e0c('0x0'));module[_0x1e0c('0x1')]={'state':{'type':Sequelize[_0x1e0c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1e0c('0x3')]},'scheduledat':{'type':Sequelize[_0x1e0c('0x4')]},'uniqueid':{'type':Sequelize[_0x1e0c('0x3')]},'starttime':{'type':Sequelize[_0x1e0c('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1696=['DATE','sequelize','INTEGER','STRING'];(function(_0x50117a,_0x2cb19f){var _0x57a031=function(_0x27b9f9){while(--_0x27b9f9){_0x50117a['push'](_0x50117a['shift']());}};_0x57a031(++_0x2cb19f);}(_0x1696,0x79));var _0x6169=function(_0x1460f7,_0x36c140){_0x1460f7=_0x1460f7-0x0;var _0x1c601a=_0x1696[_0x1460f7];return _0x1c601a;};'use strict';var Sequelize=require(_0x6169('0x0'));module['exports']={'state':{'type':Sequelize[_0x6169('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6169('0x2')]},'scheduledat':{'type':Sequelize[_0x6169('0x3')]},'uniqueid':{'type':Sequelize[_0x6169('0x2')]},'starttime':{'type':Sequelize[_0x6169('0x3')]},'responsetime':{'type':Sequelize[_0x6169('0x3')]},'ringtime':{'type':Sequelize[_0x6169('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6169('0x2')]},'campaigntype':{'type':Sequelize[_0x6169('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 358edc5..f404f55 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 _0xc4cb=['./reportAgentPreview.attributes','exports','define','lodash','util','request-promise','path','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc4cb,0x1a3));var _0xbc4c=function(_0x1d484c,_0x27c954){_0x1d484c=_0x1d484c-0x0;var _0xb2ec18=_0xc4cb[_0x1d484c];return _0xb2ec18;};'use strict';var _=require(_0xbc4c('0x0'));var util=require(_0xbc4c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc4c('0x2'));var fs=require('fs');var path=require(_0xbc4c('0x3'));var rimraf=require('rimraf');var config=require(_0xbc4c('0x4'));var attributes=require(_0xbc4c('0x5'));module[_0xbc4c('0x6')]=function(_0x3d2b7a,_0x4a6d2e){return _0x3d2b7a[_0xbc4c('0x7')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf1b=['../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x174253,_0x3a0f82){var _0x14fdd5=function(_0x46c9b0){while(--_0x46c9b0){_0x174253['push'](_0x174253['shift']());}};_0x14fdd5(++_0x3a0f82);}(_0xbf1b,0xf7));var _0xbbf1=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xbf1b[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbbf1('0x0'));var moment=require(_0xbbf1('0x1'));var BPromise=require(_0xbbf1('0x2'));var rp=require(_0xbbf1('0x3'));var fs=require('fs');var path=require(_0xbbf1('0x4'));var rimraf=require(_0xbbf1('0x5'));var config=require(_0xbbf1('0x6'));var attributes=require(_0xbbf1('0x7'));module[_0xbbf1('0x8')]=function(_0x426031,_0x49262e){return _0x426031['define'](_0xbbf1('0x9'),attributes,{'tableName':_0xbbf1('0xa'),'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 92c098a..0b63050 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 _0xb05c=['http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb05c,0x1dd));var _0xcb05=function(_0xf58718,_0x33541a){_0xf58718=_0xf58718-0x0;var _0x5aea10=_0xb05c[_0xf58718];return _0x5aea10;};'use strict';var _=require('lodash');var util=require(_0xcb05('0x0'));var moment=require('moment');var BPromise=require(_0xcb05('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb05('0x2'));var db=require(_0xcb05('0x3'))['db'];var utils=require(_0xcb05('0x4'));var logger=require(_0xcb05('0x5'))(_0xcb05('0x6'));var config=require(_0xcb05('0x7'));var jayson=require(_0xcb05('0x8'));var client=jayson['client'][_0xcb05('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe48e84,_0x56acb8,_0x6d97d4){return new BPromise(function(_0xdffd23,_0x2f7b1c){return client['request'](_0xe48e84,_0x6d97d4)[_0xcb05('0xa')](function(_0x2e3a98){logger[_0xcb05('0xb')](_0xcb05('0xc'),_0x56acb8,_0xcb05('0xd'));logger[_0xcb05('0xe')](_0xcb05('0xf'),_0x56acb8,_0xcb05('0xd'),JSON[_0xcb05('0x10')](_0x2e3a98));if(_0x2e3a98[_0xcb05('0x11')]){if(_0x2e3a98[_0xcb05('0x11')][_0xcb05('0x12')]===0x1f4){logger[_0xcb05('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x56acb8,_0x2e3a98[_0xcb05('0x11')][_0xcb05('0x13')]);return _0x2f7b1c(_0x2e3a98[_0xcb05('0x11')][_0xcb05('0x13')]);}logger[_0xcb05('0x11')](_0xcb05('0xc'),_0x56acb8,_0x2e3a98[_0xcb05('0x11')][_0xcb05('0x13')]);return _0xdffd23(_0x2e3a98[_0xcb05('0x11')]['message']);}else{logger[_0xcb05('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x56acb8,_0xcb05('0xd'));_0xdffd23(_0x2e3a98[_0xcb05('0x14')][_0xcb05('0x13')]);}})['catch'](function(_0x1f6fb5){logger['error'](_0xcb05('0xc'),_0x56acb8,_0x1f6fb5);_0x2f7b1c(_0x1f6fb5);});});}exports['CreateReportAgentPreview']=function(_0x43bc08){var _0x525e8=this;return new Promise(function(_0x5c3c33,_0x25c785){return db[_0xcb05('0x15')]['create'](_0x43bc08[_0xcb05('0x16')],{'raw':_0x43bc08[_0xcb05('0x17')]?_0x43bc08[_0xcb05('0x17')][_0xcb05('0x18')]===undefined?!![]:![]:!![]})[_0xcb05('0xa')](function(_0x3afd45){logger[_0xcb05('0xb')](_0xcb05('0x19'),_0x43bc08);logger[_0xcb05('0xe')]('CreateReportAgentPreview',_0x43bc08,JSON[_0xcb05('0x10')](_0x3afd45));_0x5c3c33(_0x3afd45);})[_0xcb05('0x1a')](function(_0x55124d){logger['error'](_0xcb05('0x19'),_0x55124d[_0xcb05('0x13')],_0x43bc08);_0x25c785(_0x525e8[_0xcb05('0x11')](0x1f4,_0x55124d[_0xcb05('0x13')]));});});}; \ No newline at end of file +var _0x12a1=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateReportAgentPreview','ReportAgentPreview','body','lodash'];(function(_0x7dc7a8,_0x56a053){var _0x37f727=function(_0x2ad3cf){while(--_0x2ad3cf){_0x7dc7a8['push'](_0x7dc7a8['shift']());}};_0x37f727(++_0x56a053);}(_0x12a1,0xbf));var _0x112a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x12a1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x112a('0x0'));var util=require(_0x112a('0x1'));var moment=require(_0x112a('0x2'));var BPromise=require(_0x112a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x112a('0x4'));var db=require(_0x112a('0x5'))['db'];var utils=require(_0x112a('0x6'));var logger=require('../../config/logger')(_0x112a('0x7'));var config=require('../../config/environment');var jayson=require(_0x112a('0x8'));var client=jayson[_0x112a('0x9')][_0x112a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x411097,_0x4f743d,_0x2aff4c){return new BPromise(function(_0x45e297,_0x17bedf){return client[_0x112a('0xb')](_0x411097,_0x2aff4c)[_0x112a('0xc')](function(_0x414199){logger[_0x112a('0xd')](_0x112a('0xe'),_0x4f743d,_0x112a('0xf'));logger[_0x112a('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x4f743d,_0x112a('0xf'),JSON[_0x112a('0x11')](_0x414199));if(_0x414199['error']){if(_0x414199[_0x112a('0x12')]['code']===0x1f4){logger[_0x112a('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f743d,_0x414199[_0x112a('0x12')][_0x112a('0x13')]);return _0x17bedf(_0x414199[_0x112a('0x12')][_0x112a('0x13')]);}logger[_0x112a('0x12')](_0x112a('0xe'),_0x4f743d,_0x414199['error'][_0x112a('0x13')]);return _0x45e297(_0x414199['error'][_0x112a('0x13')]);}else{logger[_0x112a('0xd')](_0x112a('0xe'),_0x4f743d,_0x112a('0xf'));_0x45e297(_0x414199['result']['message']);}})[_0x112a('0x14')](function(_0x3586c6){logger[_0x112a('0x12')](_0x112a('0xe'),_0x4f743d,_0x3586c6);_0x17bedf(_0x3586c6);});});}exports[_0x112a('0x15')]=function(_0x49c8cc){var _0x494bd7=this;return new Promise(function(_0x1b9f88,_0x49751d){return db[_0x112a('0x16')]['create'](_0x49c8cc[_0x112a('0x17')],{'raw':_0x49c8cc['options']?_0x49c8cc['options']['raw']===undefined?!![]:![]:!![]})[_0x112a('0xc')](function(_0x503852){logger[_0x112a('0xd')](_0x112a('0x15'),_0x49c8cc);logger[_0x112a('0x10')](_0x112a('0x15'),_0x49c8cc,JSON[_0x112a('0x11')](_0x503852));_0x1b9f88(_0x503852);})[_0x112a('0x14')](function(_0x4863f5){logger[_0x112a('0x12')]('CreateReportAgentPreview',_0x4863f5[_0x112a('0x13')],_0x49c8cc);_0x49751d(_0x494bd7[_0x112a('0x12')](0x1f4,_0x4863f5[_0x112a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c91cf54..62ebcad 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 _0xadf5=['whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/whatsapp/queues'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xadf5,0xf1));var _0x5adf=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xadf5[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require(_0x5adf('0x0'));var util=require('util');var path=require(_0x5adf('0x1'));var express=require('express');var router=express[_0x5adf('0x2')]();var auth=require(_0x5adf('0x3'));var controller=require(_0x5adf('0x4'));router[_0x5adf('0x5')](_0x5adf('0x6'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x8')]);router[_0x5adf('0x5')](_0x5adf('0x9'),auth[_0x5adf('0x7')](),controller[_0x5adf('0xa')]);router['get'](_0x5adf('0xb'),auth[_0x5adf('0x7')](),controller[_0x5adf('0xc')]);router[_0x5adf('0x5')](_0x5adf('0xd'),auth[_0x5adf('0x7')](),controller[_0x5adf('0xe')]);router[_0x5adf('0x5')](_0x5adf('0xf'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x10')]);router[_0x5adf('0x5')](_0x5adf('0x11'),auth['isAuthenticated'](),controller[_0x5adf('0x12')]);router[_0x5adf('0x5')](_0x5adf('0x13'),auth[_0x5adf('0x7')](),controller['mailAccounts']);router[_0x5adf('0x5')]('/openchannel/queues',auth[_0x5adf('0x7')](),controller['openchannelQueues']);router['get'](_0x5adf('0x14'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x15')]);router[_0x5adf('0x5')](_0x5adf('0x16'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x17')]);router['get'](_0x5adf('0x18'),auth['isAuthenticated'](),controller[_0x5adf('0x19')]);router[_0x5adf('0x5')](_0x5adf('0x1a'),auth['isAuthenticated'](),controller[_0x5adf('0x1b')]);router[_0x5adf('0x5')](_0x5adf('0x1c'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x1d')]);router[_0x5adf('0x5')](_0x5adf('0x1e'),auth['isAuthenticated'](),controller[_0x5adf('0x1f')]);router['get'](_0x5adf('0x20'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x21')]);router[_0x5adf('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5adf('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x5adf('0x5')](_0x5adf('0x22'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x23')]);router['put'](_0x5adf('0x22'),auth['isAuthenticated'](),controller[_0x5adf('0x24')]);router[_0x5adf('0x5')]('/outbound',auth[_0x5adf('0x7')](),controller[_0x5adf('0x25')]);router['get']('/outbound/channels',auth[_0x5adf('0x7')](),controller[_0x5adf('0x26')]);router[_0x5adf('0x5')](_0x5adf('0x27'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x28')]);router[_0x5adf('0x29')](_0x5adf('0x2a'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x5adf('0x5')](_0x5adf('0x2b'),auth[_0x5adf('0x7')](),controller['telephones']);router['get'](_0x5adf('0x2c'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x2d')]);router[_0x5adf('0x5')](_0x5adf('0x2e'),auth['isAuthenticated'](),controller[_0x5adf('0x2f')]);router[_0x5adf('0x5')](_0x5adf('0x30'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x31')]);router[_0x5adf('0x5')](_0x5adf('0x32'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x33')]);router[_0x5adf('0x5')](_0x5adf('0x34'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x35')]);router[_0x5adf('0x5')](_0x5adf('0x36'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x37')]);router[_0x5adf('0x5')](_0x5adf('0x38'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x39')]);router[_0x5adf('0x5')](_0x5adf('0x3a'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x3b')]);router[_0x5adf('0x5')](_0x5adf('0x3c'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x3d')]);router[_0x5adf('0x5')](_0x5adf('0x3e'),auth['isAuthenticated'](),controller[_0x5adf('0x3f')]);router[_0x5adf('0x40')](_0x5adf('0x41'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')](_0x5adf('0x43')));router[_0x5adf('0x5')](_0x5adf('0x44'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x45')]);router[_0x5adf('0x40')](_0x5adf('0x46'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')](_0x5adf('0x47')));router[_0x5adf('0x5')](_0x5adf('0x48'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x49')]);router[_0x5adf('0x40')](_0x5adf('0x4a'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')]('fax'));router[_0x5adf('0x5')]('/fax/queues/:id',auth[_0x5adf('0x7')](),controller[_0x5adf('0x4b')]);router[_0x5adf('0x40')](_0x5adf('0x4c'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')](_0x5adf('0x4d')));router[_0x5adf('0x5')]('/openchannel/queues/:id',auth[_0x5adf('0x7')](),controller[_0x5adf('0x4e')]);router[_0x5adf('0x40')](_0x5adf('0x4f'),auth[_0x5adf('0x7')](),controller[_0x5adf('0x42')](_0x5adf('0x50')));router['post'](_0x5adf('0x51'),auth['isAuthenticated'](),controller[_0x5adf('0x42')]('whatsapp'));router['get']('/sms/queues/:id',auth[_0x5adf('0x7')](),controller[_0x5adf('0x52')]);router[_0x5adf('0x5')](_0x5adf('0x53'),auth['isAuthenticated'](),controller[_0x5adf('0x54')]);router[_0x5adf('0x40')](_0x5adf('0x55'),auth['isAuthenticated'](),controller[_0x5adf('0x56')]);module[_0x5adf('0x57')]=router; \ No newline at end of file +var _0xe0c7=['/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','util','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel'];(function(_0x7e5035,_0x5db273){var _0x41bc4e=function(_0x5ed116){while(--_0x5ed116){_0x7e5035['push'](_0x7e5035['shift']());}};_0x41bc4e(++_0x5db273);}(_0xe0c7,0x1ba));var _0x7e0c=function(_0x418955,_0x4ad793){_0x418955=_0x418955-0x0;var _0x4d4765=_0xe0c7[_0x418955];return _0x4d4765;};'use strict';var multer=require('multer');var util=require(_0x7e0c('0x0'));var path=require('path');var express=require(_0x7e0c('0x1'));var router=express['Router']();var auth=require(_0x7e0c('0x2'));var controller=require(_0x7e0c('0x3'));router[_0x7e0c('0x4')]('/voice/channels',auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x6')]);router[_0x7e0c('0x4')](_0x7e0c('0x7'),auth[_0x7e0c('0x5')](),controller['voiceChannelMixMonitor']);router[_0x7e0c('0x4')](_0x7e0c('0x8'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth['isAuthenticated'](),controller[_0x7e0c('0x9')]);router['get']('/chat/queues',auth[_0x7e0c('0x5')](),controller[_0x7e0c('0xa')]);router['get'](_0x7e0c('0xb'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0xc')]);router[_0x7e0c('0x4')](_0x7e0c('0xd'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x7e0c('0x4')](_0x7e0c('0xe'),auth[_0x7e0c('0x5')](),controller['openchannelQueues']);router[_0x7e0c('0x4')](_0x7e0c('0xf'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x10')]);router[_0x7e0c('0x4')](_0x7e0c('0x11'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x12')]);router[_0x7e0c('0x4')](_0x7e0c('0x13'),auth['isAuthenticated'](),controller[_0x7e0c('0x14')]);router[_0x7e0c('0x4')]('/voice/queues/preview/:id',auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x15')]);router['get'](_0x7e0c('0x16'),auth['isAuthenticated'](),controller[_0x7e0c('0x17')]);router[_0x7e0c('0x4')](_0x7e0c('0x18'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x19')]);router[_0x7e0c('0x4')](_0x7e0c('0x1a'),auth[_0x7e0c('0x5')](),controller['voiceQueuesChannelHangup']);router[_0x7e0c('0x4')](_0x7e0c('0x1b'),auth['isAuthenticated'](),controller[_0x7e0c('0x1c')]);router[_0x7e0c('0x4')](_0x7e0c('0x1d'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x1e')]);router[_0x7e0c('0x1f')](_0x7e0c('0x1d'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x20')]);router[_0x7e0c('0x4')](_0x7e0c('0x21'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x22')]);router[_0x7e0c('0x4')](_0x7e0c('0x23'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x24')]);router[_0x7e0c('0x4')](_0x7e0c('0x25'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x26')]);router[_0x7e0c('0x1f')](_0x7e0c('0x27'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x28')]);router[_0x7e0c('0x4')]('/telephones',auth['isAuthenticated'](),controller['telephones']);router[_0x7e0c('0x4')]('/trunks',auth[_0x7e0c('0x5')](),controller['trunks']);router[_0x7e0c('0x4')]('/campaigns',auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x29')]);router['get'](_0x7e0c('0x2a'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x7e0c('0x4')](_0x7e0c('0x2b'),auth['isAuthenticated'](),controller[_0x7e0c('0x2c')]);router[_0x7e0c('0x4')]('/mail/queues/waitinginteractions',auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x2d')]);router[_0x7e0c('0x4')](_0x7e0c('0x2e'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x2f')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x30')]);router['get'](_0x7e0c('0x31'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x32')]);router['get'](_0x7e0c('0x33'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x34')]);router['get'](_0x7e0c('0x35'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x36')]);router['post'](_0x7e0c('0x37'),auth[_0x7e0c('0x5')](),controller['queueNotify'](_0x7e0c('0x38')));router['get'](_0x7e0c('0x39'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x3a')]);router[_0x7e0c('0x3b')](_0x7e0c('0x3c'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x3d')]('chat'));router['get'](_0x7e0c('0x3e'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x3f')]);router[_0x7e0c('0x3b')](_0x7e0c('0x40'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x3d')]('fax'));router[_0x7e0c('0x4')](_0x7e0c('0x41'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x42')]);router['post']('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x7e0c('0x3d')](_0x7e0c('0x43')));router[_0x7e0c('0x4')](_0x7e0c('0x44'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x45')]);router[_0x7e0c('0x3b')](_0x7e0c('0x46'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x3d')]('sms'));router[_0x7e0c('0x3b')](_0x7e0c('0x47'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x3d')](_0x7e0c('0x48')));router['get'](_0x7e0c('0x49'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x4a')]);router[_0x7e0c('0x4')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x7e0c('0x3b')](_0x7e0c('0x4b'),auth[_0x7e0c('0x5')](),controller[_0x7e0c('0x4c')]);module[_0x7e0c('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f89c50a..7667306 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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file +var _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x131e60,_0x5352ce){var _0x4bc497=function(_0x2a758e){while(--_0x2a758e){_0x131e60['push'](_0x131e60['shift']());}};_0x4bc497(++_0x5352ce);}(_0xb10b,0x12a));var _0xbb10=function(_0x26ac27,_0x574b86){_0x26ac27=_0x26ac27-0x0;var _0x44a599=_0xb10b[_0x26ac27];return _0x44a599;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8da0691..7c08f3a 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 _0xff88=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/run','run','post','create','put','delete','destroy','exports','multer'];(function(_0x77fbf8,_0x31cf3f){var _0x2df250=function(_0x24b65f){while(--_0x24b65f){_0x77fbf8['push'](_0x77fbf8['shift']());}};_0x2df250(++_0x31cf3f);}(_0xff88,0x1e2));var _0x8ff8=function(_0x4de442,_0x5abd68){_0x4de442=_0x4de442-0x0;var _0x1d503a=_0xff88[_0x4de442];return _0x1d503a;};'use strict';var multer=require(_0x8ff8('0x0'));var util=require(_0x8ff8('0x1'));var path=require(_0x8ff8('0x2'));var timeout=require(_0x8ff8('0x3'));var express=require(_0x8ff8('0x4'));var router=express[_0x8ff8('0x5')]();var fs_extra=require(_0x8ff8('0x6'));var auth=require(_0x8ff8('0x7'));var interaction=require(_0x8ff8('0x8'));var config=require(_0x8ff8('0x9'));var controller=require('./schedule.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8ff8('0xa')]);router[_0x8ff8('0xb')](_0x8ff8('0xc'),auth[_0x8ff8('0xd')](),controller[_0x8ff8('0xe')]);router['get'](_0x8ff8('0xf'),auth[_0x8ff8('0xd')](),controller[_0x8ff8('0x10')]);router[_0x8ff8('0x11')]('/',auth[_0x8ff8('0xd')](),controller[_0x8ff8('0x12')]);router[_0x8ff8('0x13')](_0x8ff8('0xc'),auth[_0x8ff8('0xd')](),controller['update']);router[_0x8ff8('0x14')]('/:id',auth[_0x8ff8('0xd')](),controller[_0x8ff8('0x15')]);module[_0x8ff8('0x16')]=router; \ No newline at end of file +var _0x7115=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','run','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x7115,0x1ca));var _0x5711=function(_0x1ee2a2,_0x354970){_0x1ee2a2=_0x1ee2a2-0x0;var _0x2da2d9=_0x7115[_0x1ee2a2];return _0x2da2d9;};'use strict';var multer=require(_0x5711('0x0'));var util=require(_0x5711('0x1'));var path=require(_0x5711('0x2'));var timeout=require(_0x5711('0x3'));var express=require('express');var router=express[_0x5711('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5711('0x5'));var interaction=require(_0x5711('0x6'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x5711('0x7')]('/',auth[_0x5711('0x8')](),controller[_0x5711('0x9')]);router[_0x5711('0x7')](_0x5711('0xa'),auth[_0x5711('0x8')](),controller[_0x5711('0xb')]);router[_0x5711('0x7')]('/:id/run',auth[_0x5711('0x8')](),controller[_0x5711('0xc')]);router[_0x5711('0xd')]('/',auth['isAuthenticated'](),controller[_0x5711('0xe')]);router[_0x5711('0xf')]('/:id',auth[_0x5711('0x8')](),controller[_0x5711('0x10')]);router[_0x5711('0x11')](_0x5711('0xa'),auth['isAuthenticated'](),controller[_0x5711('0x12')]);module[_0x5711('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 f55b5b0..e0386eb 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 _0xe5e3=['years','quarters','hours','days','csv','pdf','xlsx','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x467ef6,_0x932cef){var _0x3e4aa2=function(_0xb56bb5){while(--_0xb56bb5){_0x467ef6['push'](_0x467ef6['shift']());}};_0x3e4aa2(++_0x932cef);}(_0xe5e3,0x1da));var _0x3e5e=function(_0x1af56e,_0x3cae62){_0x1af56e=_0x1af56e-0x0;var _0x511827=_0xe5e3[_0x1af56e];return _0x511827;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3e5e('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x3e5e('0x0')]},'active':{'type':Sequelize[_0x3e5e('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3e5e('0x0')],'allowNull':![],'defaultValue':_0x3e5e('0x2')},'startAt':{'type':Sequelize[_0x3e5e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3e5e('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3e5e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3e5e('0x5')](_0x3e5e('0x6'),_0x3e5e('0x7'),'months','weeks','days',_0x3e5e('0x8'),'minutes'),'allowNull':![],'defaultValue':_0x3e5e('0x9')},'output':{'type':Sequelize[_0x3e5e('0x5')](_0x3e5e('0xa'),_0x3e5e('0xb'),_0x3e5e('0xc')),'allowNull':![],'defaultValue':_0x3e5e('0xa')},'type':{'type':Sequelize['ENUM'](_0x3e5e('0xd'),_0x3e5e('0xe')),'allowNull':![],'defaultValue':_0x3e5e('0xd')},'sendMail':{'type':Sequelize[_0x3e5e('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x3e5e('0x0')]},'cc':{'type':Sequelize[_0x3e5e('0xf')]},'bcc':{'type':Sequelize[_0x3e5e('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x3e5e('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb869=['BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','months','weeks','days','hours','csv','pdf','custom','default'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb869,0x82));var _0x9b86=function(_0x13cd03,_0x136897){_0x13cd03=_0x13cd03-0x0;var _0x4f394c=_0xb869[_0x13cd03];return _0x4f394c;};'use strict';var Sequelize=require(_0x9b86('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9b86('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9b86('0x2')},'startAt':{'type':Sequelize[_0x9b86('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9b86('0x4')](_0x9b86('0x5'),'quarters',_0x9b86('0x6'),_0x9b86('0x7'),_0x9b86('0x8'),_0x9b86('0x9'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x9b86('0xa'),_0x9b86('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0x9b86('0xa')},'type':{'type':Sequelize[_0x9b86('0x4')](_0x9b86('0xc'),_0x9b86('0xd')),'allowNull':![],'defaultValue':_0x9b86('0xc')},'sendMail':{'type':Sequelize[_0x9b86('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0x9b86('0x1')]},'cc':{'type':Sequelize[_0x9b86('0xf')]},'bcc':{'type':Sequelize[_0x9b86('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index a4f961f..6c7f3fd 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 _0x37ba=['length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','then','destroy','get','Scheduler','end','send','index','map','Schedule','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x37ba,0x1ac));var _0xa37b=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x37ba[_0x485b5a];return _0xd2b34d;};'use strict';var emlformat=require(_0xa37b('0x0'));var rimraf=require(_0xa37b('0x1'));var zipdir=require(_0xa37b('0x2'));var jsonpatch=require(_0xa37b('0x3'));var rp=require(_0xa37b('0x4'));var moment=require(_0xa37b('0x5'));var BPromise=require(_0xa37b('0x6'));var Mustache=require(_0xa37b('0x7'));var util=require(_0xa37b('0x8'));var path=require(_0xa37b('0x9'));var sox=require('sox');var csv=require(_0xa37b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa37b('0xb'));var crypto=require(_0xa37b('0xc'));var jsforce=require(_0xa37b('0xd'));var deskjs=require(_0xa37b('0xe'));var toCsv=require(_0xa37b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa37b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa37b('0x10'));var as=require(_0xa37b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa37b('0x12'));var utils=require('../../config/utils');var config=require(_0xa37b('0x13'));var licenseUtil=require(_0xa37b('0x14'));var db=require(_0xa37b('0x15'))['db'];function respondWithStatusCode(_0x12578c,_0x3fe8f0){_0x3fe8f0=_0x3fe8f0||0xcc;return function(_0xceff7b){if(_0xceff7b){return _0x12578c[_0xa37b('0x16')](_0x3fe8f0);}return _0x12578c[_0xa37b('0x17')](_0x3fe8f0)['end']();};}function respondWithResult(_0x3b0bc4,_0x16b81b){_0x16b81b=_0x16b81b||0xc8;return function(_0x123218){if(_0x123218){return _0x3b0bc4[_0xa37b('0x17')](_0x16b81b)[_0xa37b('0x18')](_0x123218);}};}function respondWithFilteredResult(_0xea3a0,_0x54ce10){return function(_0x45348d){if(_0x45348d){var _0x7fc15e=typeof _0x54ce10[_0xa37b('0x19')]===_0xa37b('0x1a')&&typeof _0x54ce10['limit']===_0xa37b('0x1a');var _0x350067=_0x45348d[_0xa37b('0x1b')];var _0x562503=_0x7fc15e?0x0:_0x54ce10['offset'];var _0x1121ab=_0x7fc15e?_0x45348d['count']:_0x54ce10[_0xa37b('0x19')]+_0x54ce10[_0xa37b('0x1c')];var _0x3bab55;if(_0x1121ab>=_0x350067){_0x1121ab=_0x350067;_0x3bab55=0xc8;}else{_0x3bab55=0xce;}_0xea3a0[_0xa37b('0x17')](_0x3bab55);return _0xea3a0[_0xa37b('0x1d')]('Content-Range',_0x562503+'-'+_0x1121ab+'/'+_0x350067)[_0xa37b('0x18')](_0x45348d);}return null;};}function patchUpdates(_0x5548ba){return function(_0x1362a6){try{jsonpatch['apply'](_0x1362a6,_0x5548ba,!![]);}catch(_0xa6adc5){return BPromise[_0xa37b('0x1e')](_0xa6adc5);}return _0x1362a6['save']();};}function saveUpdates(_0x38dd5a,_0x5e7080){return function(_0x176085){if(_0x176085){return _0x176085['update'](_0x38dd5a)[_0xa37b('0x1f')](function(_0x1d7b0a){return _0x1d7b0a;});}return null;};}function removeEntity(_0x550e90,_0x45ffd3){return function(_0x190126){if(_0x190126){return _0x190126[_0xa37b('0x20')]()['then'](function(){var _0x5e3d0d=_0x190126[_0xa37b('0x21')]({'plain':!![]});var _0x3530df=_0xa37b('0x22');return db['UserProfileResource'][_0xa37b('0x20')]({'where':{'type':_0x3530df,'resourceId':_0x5e3d0d['id']}})[_0xa37b('0x1f')](function(){return _0x190126;});})[_0xa37b('0x1f')](function(){_0x550e90[_0xa37b('0x17')](0xcc)[_0xa37b('0x23')]();});}};}function handleEntityNotFound(_0x56daff,_0x2e8e13){return function(_0x33a298){if(!_0x33a298){_0x56daff[_0xa37b('0x16')](0x194);}return _0x33a298;};}function handleError(_0x29b308,_0x2ff214){_0x2ff214=_0x2ff214||0x1f4;return function(_0x4e1ac3){logger['error'](_0x4e1ac3['stack']);if(_0x4e1ac3['name']){delete _0x4e1ac3['name'];}_0x29b308[_0xa37b('0x17')](_0x2ff214)[_0xa37b('0x24')](_0x4e1ac3);};}exports[_0xa37b('0x25')]=function(_0x4f29e2,_0x1e5696){var _0x55e9bd={},_0x13d7a2={},_0x5beab5={'count':0x0,'rows':[]};var _0x355341=_[_0xa37b('0x26')](db[_0xa37b('0x27')][_0xa37b('0x28')],function(_0x3289ec){return{'name':_0x3289ec[_0xa37b('0x29')],'type':_0x3289ec[_0xa37b('0x2a')][_0xa37b('0x2b')]};});_0x13d7a2['model']=_['map'](_0x355341,_0xa37b('0x2c'));_0x13d7a2[_0xa37b('0x2d')]=_[_0xa37b('0x2e')](_0x4f29e2[_0xa37b('0x2d')]);_0x13d7a2[_0xa37b('0x2f')]=_['intersection'](_0x13d7a2[_0xa37b('0x30')],_0x13d7a2[_0xa37b('0x2d')]);_0x55e9bd[_0xa37b('0x31')]=_[_0xa37b('0x32')](_0x13d7a2[_0xa37b('0x30')],qs[_0xa37b('0x33')](_0x4f29e2[_0xa37b('0x2d')][_0xa37b('0x33')]));_0x55e9bd[_0xa37b('0x31')]=_0x55e9bd['attributes'][_0xa37b('0x34')]?_0x55e9bd['attributes']:_0x13d7a2[_0xa37b('0x30')];if(!_0x4f29e2[_0xa37b('0x2d')]['hasOwnProperty']('nolimit')){_0x55e9bd[_0xa37b('0x1c')]=qs[_0xa37b('0x1c')](_0x4f29e2['query'][_0xa37b('0x1c')]);_0x55e9bd[_0xa37b('0x19')]=qs[_0xa37b('0x19')](_0x4f29e2[_0xa37b('0x2d')]['offset']);}_0x55e9bd[_0xa37b('0x35')]=qs[_0xa37b('0x36')](_0x4f29e2[_0xa37b('0x2d')][_0xa37b('0x36')]);_0x55e9bd[_0xa37b('0x37')]=qs[_0xa37b('0x2f')](_[_0xa37b('0x38')](_0x4f29e2['query'],_0x13d7a2['filters']),_0x355341);if(_0x4f29e2[_0xa37b('0x2d')][_0xa37b('0x39')]){_0x55e9bd[_0xa37b('0x37')]=_[_0xa37b('0x3a')](_0x55e9bd[_0xa37b('0x37')],{'$or':_['map'](_0x355341,function(_0x5f1a2c){if(_0x5f1a2c[_0xa37b('0x2a')]!==_0xa37b('0x3b')){var _0x47bedd={};_0x47bedd[_0x5f1a2c[_0xa37b('0x2c')]]={'$like':'%'+_0x4f29e2[_0xa37b('0x2d')][_0xa37b('0x39')]+'%'};return _0x47bedd;}})});}_0x55e9bd=_['merge']({},_0x55e9bd,_0x4f29e2[_0xa37b('0x3c')]);var _0xe556df={'where':_0x55e9bd[_0xa37b('0x37')]};return db[_0xa37b('0x27')][_0xa37b('0x1b')](_0xe556df)[_0xa37b('0x1f')](function(_0x591c6a){_0x5beab5['count']=_0x591c6a;if(_0x4f29e2['query'][_0xa37b('0x3d')]){_0x55e9bd['include']=[{'all':!![]}];}return db[_0xa37b('0x27')]['findAll'](_0x55e9bd);})[_0xa37b('0x1f')](function(_0x34fdcd){_0x5beab5[_0xa37b('0x3e')]=_0x34fdcd;return _0x5beab5;})[_0xa37b('0x1f')](respondWithFilteredResult(_0x1e5696,_0x55e9bd))[_0xa37b('0x3f')](handleError(_0x1e5696,null));};exports[_0xa37b('0x40')]=function(_0x592fc9,_0xd332dc){var _0x2736a3={'raw':![],'where':{'id':_0x592fc9['params']['id']}},_0x1abca6={};_0x1abca6[_0xa37b('0x30')]=_[_0xa37b('0x2e')](db[_0xa37b('0x27')][_0xa37b('0x28')]);_0x1abca6[_0xa37b('0x2d')]=_[_0xa37b('0x2e')](_0x592fc9[_0xa37b('0x2d')]);_0x1abca6['filters']=_[_0xa37b('0x32')](_0x1abca6[_0xa37b('0x30')],_0x1abca6[_0xa37b('0x2d')]);_0x2736a3['attributes']=_[_0xa37b('0x32')](_0x1abca6['model'],qs[_0xa37b('0x33')](_0x592fc9[_0xa37b('0x2d')]['fields']));_0x2736a3[_0xa37b('0x31')]=_0x2736a3[_0xa37b('0x31')][_0xa37b('0x34')]?_0x2736a3['attributes']:_0x1abca6[_0xa37b('0x30')];if(_0x592fc9[_0xa37b('0x2d')][_0xa37b('0x3d')]){_0x2736a3['include']=[{'all':!![]}];}_0x2736a3=_[_0xa37b('0x3a')]({},_0x2736a3,_0x592fc9[_0xa37b('0x3c')]);return db[_0xa37b('0x27')][_0xa37b('0x41')](_0x2736a3)[_0xa37b('0x1f')](handleEntityNotFound(_0xd332dc,null))[_0xa37b('0x1f')](respondWithResult(_0xd332dc,null))[_0xa37b('0x3f')](handleError(_0xd332dc,null));};exports[_0xa37b('0x42')]=function(_0x3c5af2,_0x1d3d24){return db[_0xa37b('0x27')][_0xa37b('0x42')](_0x3c5af2['body'],{})['then'](function(_0x1c0842){var _0x17c556=_0x3c5af2[_0xa37b('0x43')][_0xa37b('0x21')]({'plain':!![]});if(!_0x17c556)throw new Error(_0xa37b('0x44'));if(_0x17c556[_0xa37b('0x45')]===_0xa37b('0x43')){var _0x4009b1=_0x1c0842[_0xa37b('0x21')]({'plain':!![]});var _0x72ae96='Scheduler';return db['UserProfileSection'][_0xa37b('0x41')]({'where':{'name':_0x72ae96,'userProfileId':_0x17c556[_0xa37b('0x46')]},'raw':!![]})[_0xa37b('0x1f')](function(_0x5eebce){if(_0x5eebce&&_0x5eebce[_0xa37b('0x47')]===0x0){return db[_0xa37b('0x48')][_0xa37b('0x42')]({'name':_0x4009b1[_0xa37b('0x2c')],'resourceId':_0x4009b1['id'],'type':_0x5eebce[_0xa37b('0x2c')],'sectionId':_0x5eebce['id']},{})[_0xa37b('0x1f')](function(){return _0x1c0842;});}else{return _0x1c0842;}})[_0xa37b('0x3f')](function(_0x50d048){logger[_0xa37b('0x49')](_0xa37b('0x4a'),_0x50d048);throw _0x50d048;});}return _0x1c0842;})[_0xa37b('0x1f')](respondWithResult(_0x1d3d24,0xc9))[_0xa37b('0x3f')](handleError(_0x1d3d24,null));};exports[_0xa37b('0x4b')]=function(_0x103b55,_0x3e7b23){if(_0x103b55['body']['id']){delete _0x103b55[_0xa37b('0x4c')]['id'];}return db['Schedule'][_0xa37b('0x41')]({'where':{'id':_0x103b55[_0xa37b('0x4d')]['id']}})[_0xa37b('0x1f')](handleEntityNotFound(_0x3e7b23,null))[_0xa37b('0x1f')](saveUpdates(_0x103b55[_0xa37b('0x4c')],null))[_0xa37b('0x1f')](respondWithResult(_0x3e7b23,null))['catch'](handleError(_0x3e7b23,null));};exports['destroy']=function(_0x45c275,_0x49e115){return db[_0xa37b('0x27')][_0xa37b('0x41')]({'where':{'id':_0x45c275[_0xa37b('0x4d')]['id']}})[_0xa37b('0x1f')](handleEntityNotFound(_0x49e115,null))[_0xa37b('0x1f')](removeEntity(_0x49e115,null))['catch'](handleError(_0x49e115,null));};exports['run']=function(_0x44a4b1,_0x4a76f5,_0x2a5c92){var _0x55ff2=require(_0xa37b('0x4e'));return db['Schedule'][_0xa37b('0x41')]({'where':{'id':_0x44a4b1[_0xa37b('0x4d')]['id']},'raw':!![]})[_0xa37b('0x1f')](handleEntityNotFound(_0x4a76f5,null))['then'](function(){_0x55ff2[_0xa37b('0x4f')](_0x44a4b1[_0xa37b('0x4d')]['id']);})[_0xa37b('0x1f')](respondWithStatusCode(_0x4a76f5,null))[_0xa37b('0x3f')](handleError(_0x4a76f5,null));}; \ No newline at end of file +var _0xe10b=['Schedule','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','zip-dir','request-promise','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/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','undefined','count','offset','limit','set','json','apply','save','update','then','get','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','length','query','nolimit','order','sort','where','pick','filter','merge','type','options'];(function(_0x21a0cb,_0x5a4cc5){var _0x2e9bb4=function(_0x3b47cf){while(--_0x3b47cf){_0x21a0cb['push'](_0x21a0cb['shift']());}};_0x2e9bb4(++_0x5a4cc5);}(_0xe10b,0x1ac));var _0xbe10=function(_0xe88991,_0x3f2d34){_0xe88991=_0xe88991-0x0;var _0x11b3e5=_0xe10b[_0xe88991];return _0x11b3e5;};'use strict';var emlformat=require(_0xbe10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe10('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe10('0x2'));var moment=require(_0xbe10('0x3'));var BPromise=require(_0xbe10('0x4'));var Mustache=require(_0xbe10('0x5'));var util=require('util');var path=require(_0xbe10('0x6'));var sox=require(_0xbe10('0x7'));var csv=require(_0xbe10('0x8'));var ejs=require(_0xbe10('0x9'));var fs=require('fs');var fs_extra=require(_0xbe10('0xa'));var _=require(_0xbe10('0xb'));var squel=require(_0xbe10('0xc'));var crypto=require(_0xbe10('0xd'));var jsforce=require(_0xbe10('0xe'));var deskjs=require(_0xbe10('0xf'));var toCsv=require(_0xbe10('0x8'));var querystring=require(_0xbe10('0x10'));var Papa=require(_0xbe10('0x11'));var Redis=require(_0xbe10('0x12'));var authService=require(_0xbe10('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbe10('0x14'));var hardwareService=require(_0xbe10('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbe10('0x16'));var config=require(_0xbe10('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe10('0x18'))['db'];function respondWithStatusCode(_0x1395c8,_0x19e9ab){_0x19e9ab=_0x19e9ab||0xcc;return function(_0x125612){if(_0x125612){return _0x1395c8['sendStatus'](_0x19e9ab);}return _0x1395c8[_0xbe10('0x19')](_0x19e9ab)['end']();};}function respondWithResult(_0x12bec0,_0x2cda14){_0x2cda14=_0x2cda14||0xc8;return function(_0x358771){if(_0x358771){return _0x12bec0[_0xbe10('0x19')](_0x2cda14)['json'](_0x358771);}};}function respondWithFilteredResult(_0x389172,_0x2d7b06){return function(_0x308377){if(_0x308377){var _0x2b368b=typeof _0x2d7b06['offset']===_0xbe10('0x1a')&&typeof _0x2d7b06['limit']===_0xbe10('0x1a');var _0x310d69=_0x308377[_0xbe10('0x1b')];var _0x37ba73=_0x2b368b?0x0:_0x2d7b06[_0xbe10('0x1c')];var _0x3b8a27=_0x2b368b?_0x308377['count']:_0x2d7b06[_0xbe10('0x1c')]+_0x2d7b06[_0xbe10('0x1d')];var _0x58a076;if(_0x3b8a27>=_0x310d69){_0x3b8a27=_0x310d69;_0x58a076=0xc8;}else{_0x58a076=0xce;}_0x389172['status'](_0x58a076);return _0x389172[_0xbe10('0x1e')]('Content-Range',_0x37ba73+'-'+_0x3b8a27+'/'+_0x310d69)[_0xbe10('0x1f')](_0x308377);}return null;};}function patchUpdates(_0x5b5375){return function(_0x353675){try{jsonpatch[_0xbe10('0x20')](_0x353675,_0x5b5375,!![]);}catch(_0x3c722b){return BPromise['reject'](_0x3c722b);}return _0x353675[_0xbe10('0x21')]();};}function saveUpdates(_0x214a84,_0xec614){return function(_0x1d8a86){if(_0x1d8a86){return _0x1d8a86[_0xbe10('0x22')](_0x214a84)[_0xbe10('0x23')](function(_0x54aae9){return _0x54aae9;});}return null;};}function removeEntity(_0x5c56c3,_0x219ebb){return function(_0x2e6295){if(_0x2e6295){return _0x2e6295['destroy']()[_0xbe10('0x23')](function(){var _0x48f3e4=_0x2e6295[_0xbe10('0x24')]({'plain':!![]});var _0x4b9cd1='Scheduler';return db['UserProfileResource'][_0xbe10('0x25')]({'where':{'type':_0x4b9cd1,'resourceId':_0x48f3e4['id']}})[_0xbe10('0x23')](function(){return _0x2e6295;});})[_0xbe10('0x23')](function(){_0x5c56c3[_0xbe10('0x19')](0xcc)[_0xbe10('0x26')]();});}};}function handleEntityNotFound(_0x2566fc,_0x343c56){return function(_0x1e4248){if(!_0x1e4248){_0x2566fc['sendStatus'](0x194);}return _0x1e4248;};}function handleError(_0x4386a1,_0xc8f23c){_0xc8f23c=_0xc8f23c||0x1f4;return function(_0x9e90b7){logger['error'](_0x9e90b7[_0xbe10('0x27')]);if(_0x9e90b7[_0xbe10('0x28')]){delete _0x9e90b7[_0xbe10('0x28')];}_0x4386a1[_0xbe10('0x19')](_0xc8f23c)[_0xbe10('0x29')](_0x9e90b7);};}exports[_0xbe10('0x2a')]=function(_0x27db58,_0x445175){var _0x496351={},_0x58c869={},_0x339b16={'count':0x0,'rows':[]};var _0x25d61d=_[_0xbe10('0x2b')](db['Schedule'][_0xbe10('0x2c')],function(_0x54a28c){return{'name':_0x54a28c[_0xbe10('0x2d')],'type':_0x54a28c['type'][_0xbe10('0x2e')]};});_0x58c869[_0xbe10('0x2f')]=_[_0xbe10('0x2b')](_0x25d61d,_0xbe10('0x28'));_0x58c869['query']=_[_0xbe10('0x30')](_0x27db58['query']);_0x58c869[_0xbe10('0x31')]=_[_0xbe10('0x32')](_0x58c869[_0xbe10('0x2f')],_0x58c869['query']);_0x496351[_0xbe10('0x33')]=_[_0xbe10('0x32')](_0x58c869[_0xbe10('0x2f')],qs[_0xbe10('0x34')](_0x27db58['query']['fields']));_0x496351[_0xbe10('0x33')]=_0x496351['attributes'][_0xbe10('0x35')]?_0x496351[_0xbe10('0x33')]:_0x58c869[_0xbe10('0x2f')];if(!_0x27db58[_0xbe10('0x36')]['hasOwnProperty'](_0xbe10('0x37'))){_0x496351[_0xbe10('0x1d')]=qs['limit'](_0x27db58[_0xbe10('0x36')][_0xbe10('0x1d')]);_0x496351['offset']=qs[_0xbe10('0x1c')](_0x27db58[_0xbe10('0x36')]['offset']);}_0x496351[_0xbe10('0x38')]=qs[_0xbe10('0x39')](_0x27db58[_0xbe10('0x36')][_0xbe10('0x39')]);_0x496351[_0xbe10('0x3a')]=qs[_0xbe10('0x31')](_[_0xbe10('0x3b')](_0x27db58['query'],_0x58c869['filters']),_0x25d61d);if(_0x27db58[_0xbe10('0x36')][_0xbe10('0x3c')]){_0x496351[_0xbe10('0x3a')]=_[_0xbe10('0x3d')](_0x496351[_0xbe10('0x3a')],{'$or':_[_0xbe10('0x2b')](_0x25d61d,function(_0x4d685e){if(_0x4d685e[_0xbe10('0x3e')]!=='VIRTUAL'){var _0x1dad72={};_0x1dad72[_0x4d685e[_0xbe10('0x28')]]={'$like':'%'+_0x27db58[_0xbe10('0x36')][_0xbe10('0x3c')]+'%'};return _0x1dad72;}})});}_0x496351=_['merge']({},_0x496351,_0x27db58[_0xbe10('0x3f')]);var _0xd84dd3={'where':_0x496351[_0xbe10('0x3a')]};return db[_0xbe10('0x40')][_0xbe10('0x1b')](_0xd84dd3)[_0xbe10('0x23')](function(_0x520eea){_0x339b16[_0xbe10('0x1b')]=_0x520eea;if(_0x27db58['query'][_0xbe10('0x41')]){_0x496351[_0xbe10('0x42')]=[{'all':!![]}];}return db[_0xbe10('0x40')][_0xbe10('0x43')](_0x496351);})[_0xbe10('0x23')](function(_0xbac595){_0x339b16[_0xbe10('0x44')]=_0xbac595;return _0x339b16;})[_0xbe10('0x23')](respondWithFilteredResult(_0x445175,_0x496351))[_0xbe10('0x45')](handleError(_0x445175,null));};exports[_0xbe10('0x46')]=function(_0x2088ca,_0x2c4e1b){var _0x17a784={'raw':![],'where':{'id':_0x2088ca[_0xbe10('0x47')]['id']}},_0x30a8b9={};_0x30a8b9[_0xbe10('0x2f')]=_[_0xbe10('0x30')](db['Schedule']['rawAttributes']);_0x30a8b9[_0xbe10('0x36')]=_[_0xbe10('0x30')](_0x2088ca[_0xbe10('0x36')]);_0x30a8b9[_0xbe10('0x31')]=_[_0xbe10('0x32')](_0x30a8b9[_0xbe10('0x2f')],_0x30a8b9['query']);_0x17a784[_0xbe10('0x33')]=_[_0xbe10('0x32')](_0x30a8b9[_0xbe10('0x2f')],qs[_0xbe10('0x34')](_0x2088ca[_0xbe10('0x36')]['fields']));_0x17a784[_0xbe10('0x33')]=_0x17a784[_0xbe10('0x33')][_0xbe10('0x35')]?_0x17a784[_0xbe10('0x33')]:_0x30a8b9['model'];if(_0x2088ca[_0xbe10('0x36')][_0xbe10('0x41')]){_0x17a784[_0xbe10('0x42')]=[{'all':!![]}];}_0x17a784=_[_0xbe10('0x3d')]({},_0x17a784,_0x2088ca[_0xbe10('0x3f')]);return db[_0xbe10('0x40')]['find'](_0x17a784)[_0xbe10('0x23')](handleEntityNotFound(_0x2c4e1b,null))[_0xbe10('0x23')](respondWithResult(_0x2c4e1b,null))[_0xbe10('0x45')](handleError(_0x2c4e1b,null));};exports[_0xbe10('0x48')]=function(_0x56c6ff,_0x40fbdd){return db[_0xbe10('0x40')][_0xbe10('0x48')](_0x56c6ff[_0xbe10('0x49')],{})[_0xbe10('0x23')](function(_0x4641c2){var _0x3e1f3a=_0x56c6ff[_0xbe10('0x4a')][_0xbe10('0x24')]({'plain':!![]});if(!_0x3e1f3a)throw new Error(_0xbe10('0x4b'));if(_0x3e1f3a['role']==='user'){var _0x47bc7d=_0x4641c2[_0xbe10('0x24')]({'plain':!![]});var _0x392425='Scheduler';return db['UserProfileSection'][_0xbe10('0x4c')]({'where':{'name':_0x392425,'userProfileId':_0x3e1f3a[_0xbe10('0x4d')]},'raw':!![]})[_0xbe10('0x23')](function(_0x526af4){if(_0x526af4&&_0x526af4[_0xbe10('0x4e')]===0x0){return db['UserProfileResource'][_0xbe10('0x48')]({'name':_0x47bc7d[_0xbe10('0x28')],'resourceId':_0x47bc7d['id'],'type':_0x526af4[_0xbe10('0x28')],'sectionId':_0x526af4['id']},{})[_0xbe10('0x23')](function(){return _0x4641c2;});}else{return _0x4641c2;}})[_0xbe10('0x45')](function(_0x363694){logger['error'](_0xbe10('0x4f'),_0x363694);throw _0x363694;});}return _0x4641c2;})[_0xbe10('0x23')](respondWithResult(_0x40fbdd,0xc9))[_0xbe10('0x45')](handleError(_0x40fbdd,null));};exports[_0xbe10('0x22')]=function(_0x361c60,_0x55858d){if(_0x361c60[_0xbe10('0x49')]['id']){delete _0x361c60[_0xbe10('0x49')]['id'];}return db[_0xbe10('0x40')][_0xbe10('0x4c')]({'where':{'id':_0x361c60['params']['id']}})[_0xbe10('0x23')](handleEntityNotFound(_0x55858d,null))[_0xbe10('0x23')](saveUpdates(_0x361c60[_0xbe10('0x49')],null))['then'](respondWithResult(_0x55858d,null))[_0xbe10('0x45')](handleError(_0x55858d,null));};exports[_0xbe10('0x25')]=function(_0x231fe4,_0x354f3f){return db[_0xbe10('0x40')][_0xbe10('0x4c')]({'where':{'id':_0x231fe4[_0xbe10('0x47')]['id']}})['then'](handleEntityNotFound(_0x354f3f,null))[_0xbe10('0x23')](removeEntity(_0x354f3f,null))[_0xbe10('0x45')](handleError(_0x354f3f,null));};exports[_0xbe10('0x50')]=function(_0x3a8f1f,_0x4d8452,_0x39fdf9){var _0x3a8b21=require(_0xbe10('0x51'));return db[_0xbe10('0x40')][_0xbe10('0x4c')]({'where':{'id':_0x3a8f1f[_0xbe10('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4d8452,null))[_0xbe10('0x23')](function(){_0x3a8b21[_0xbe10('0x50')](_0x3a8f1f[_0xbe10('0x47')]['id']);})[_0xbe10('0x23')](respondWithStatusCode(_0x4d8452,null))[_0xbe10('0x45')](handleError(_0x4d8452,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index bfd21e1..004af1c 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 _0x14c5=['define','Schedule','tools_schedules','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x48c2e9,_0x2ba941){var _0x3e6c24=function(_0x316cdc){while(--_0x316cdc){_0x48c2e9['push'](_0x48c2e9['shift']());}};_0x3e6c24(++_0x2ba941);}(_0x14c5,0xdf));var _0x514c=function(_0x4767fa,_0x367ed9){_0x4767fa=_0x4767fa-0x0;var _0x1fc61a=_0x14c5[_0x4767fa];return _0x1fc61a;};'use strict';var _=require(_0x514c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x514c('0x1'));var BPromise=require(_0x514c('0x2'));var rp=require(_0x514c('0x3'));var fs=require('fs');var path=require(_0x514c('0x4'));var rimraf=require(_0x514c('0x5'));var config=require(_0x514c('0x6'));var attributes=require('./schedule.attributes');module[_0x514c('0x7')]=function(_0x867848,_0x3b97c7){return _0x867848[_0x514c('0x8')](_0x514c('0x9'),attributes,{'tableName':_0x514c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd20b=['path','../../config/environment','exports','define','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x133ea6,_0x337682){var _0x143380=function(_0x4352e6){while(--_0x4352e6){_0x133ea6['push'](_0x133ea6['shift']());}};_0x143380(++_0x337682);}(_0xd20b,0x14f));var _0xbd20=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0xd20b[_0x1ae4a9];return _0x54d0b0;};'use strict';var _=require(_0xbd20('0x0'));var util=require(_0xbd20('0x1'));var logger=require(_0xbd20('0x2'))('api');var moment=require(_0xbd20('0x3'));var BPromise=require(_0xbd20('0x4'));var rp=require(_0xbd20('0x5'));var fs=require('fs');var path=require(_0xbd20('0x6'));var rimraf=require('rimraf');var config=require(_0xbd20('0x7'));var attributes=require('./schedule.attributes');module[_0xbd20('0x8')]=function(_0x3d9dc2,_0x81a4fc){return _0x3d9dc2[_0xbd20('0x9')]('Schedule',attributes,{'tableName':_0xbd20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 7a9a188..b79ff39 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 _0xc029=['debug','error','Schedule,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x534a4b,_0x44c67a){var _0x311ed6=function(_0x48b06a){while(--_0x48b06a){_0x534a4b['push'](_0x534a4b['shift']());}};_0x311ed6(++_0x44c67a);}(_0xc029,0x7d));var _0x9c02=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xc029[_0x1ac120];return _0x19b703;};'use strict';var _=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var moment=require(_0x9c02('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c02('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c02('0x4'))['db'];var utils=require(_0x9c02('0x5'));var logger=require('../../config/logger')(_0x9c02('0x6'));var config=require(_0x9c02('0x7'));var jayson=require(_0x9c02('0x8'));var client=jayson[_0x9c02('0x9')][_0x9c02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c1378,_0x4ce8de,_0x362894){return new BPromise(function(_0x5da18d,_0x23f873){return client[_0x9c02('0xb')](_0x2c1378,_0x362894)[_0x9c02('0xc')](function(_0x190af8){logger[_0x9c02('0xd')]('Schedule,\x20%s,\x20%s',_0x4ce8de,_0x9c02('0xe'));logger[_0x9c02('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x4ce8de,_0x9c02('0xe'),JSON['stringify'](_0x190af8));if(_0x190af8[_0x9c02('0x10')]){if(_0x190af8['error']['code']===0x1f4){logger[_0x9c02('0x10')](_0x9c02('0x11'),_0x4ce8de,_0x190af8['error']['message']);return _0x23f873(_0x190af8[_0x9c02('0x10')][_0x9c02('0x12')]);}logger[_0x9c02('0x10')]('Schedule,\x20%s,\x20%s',_0x4ce8de,_0x190af8['error']['message']);return _0x5da18d(_0x190af8['error'][_0x9c02('0x12')]);}else{logger[_0x9c02('0xd')]('Schedule,\x20%s,\x20%s',_0x4ce8de,'request\x20sent');_0x5da18d(_0x190af8[_0x9c02('0x13')][_0x9c02('0x12')]);}})['catch'](function(_0x1c2a6f){logger['error'](_0x9c02('0x11'),_0x4ce8de,_0x1c2a6f);_0x23f873(_0x1c2a6f);});});} \ No newline at end of file +var _0xae99=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','Schedule,\x20%s,\x20%s'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xae99,0x161));var _0x9ae9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae99[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ae9('0x0'));var util=require(_0x9ae9('0x1'));var moment=require(_0x9ae9('0x2'));var BPromise=require(_0x9ae9('0x3'));var rs=require(_0x9ae9('0x4'));var fs=require('fs');var Redis=require(_0x9ae9('0x5'));var db=require(_0x9ae9('0x6'))['db'];var utils=require(_0x9ae9('0x7'));var logger=require(_0x9ae9('0x8'))(_0x9ae9('0x9'));var config=require('../../config/environment');var jayson=require(_0x9ae9('0xa'));var client=jayson[_0x9ae9('0xb')][_0x9ae9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ab6c5,_0x15770e,_0x5ebd19){return new BPromise(function(_0x454cc8,_0x33716a){return client[_0x9ae9('0xd')](_0x2ab6c5,_0x5ebd19)[_0x9ae9('0xe')](function(_0x326568){logger[_0x9ae9('0xf')]('Schedule,\x20%s,\x20%s',_0x15770e,'request\x20sent');logger[_0x9ae9('0x10')](_0x9ae9('0x11'),_0x15770e,_0x9ae9('0x12'),JSON['stringify'](_0x326568));if(_0x326568['error']){if(_0x326568['error'][_0x9ae9('0x13')]===0x1f4){logger[_0x9ae9('0x14')](_0x9ae9('0x15'),_0x15770e,_0x326568[_0x9ae9('0x14')]['message']);return _0x33716a(_0x326568[_0x9ae9('0x14')]['message']);}logger['error'](_0x9ae9('0x15'),_0x15770e,_0x326568[_0x9ae9('0x14')][_0x9ae9('0x16')]);return _0x454cc8(_0x326568[_0x9ae9('0x14')][_0x9ae9('0x16')]);}else{logger[_0x9ae9('0xf')]('Schedule,\x20%s,\x20%s',_0x15770e,_0x9ae9('0x12'));_0x454cc8(_0x326568[_0x9ae9('0x17')][_0x9ae9('0x16')]);}})[_0x9ae9('0x18')](function(_0xc4d51c){logger['error'](_0x9ae9('0x15'),_0x15770e,_0xc4d51c);_0x33716a(_0xc4d51c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 638a12f..09928f8 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 _0xac5e=['describe','/:id','show','/:id/download','download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x34b5ca,_0x594010){var _0x2d72c0=function(_0x4ae1d3){while(--_0x4ae1d3){_0x34b5ca['push'](_0x34b5ca['shift']());}};_0x2d72c0(++_0x594010);}(_0xac5e,0x172));var _0xeac5=function(_0x57d624,_0x453030){_0x57d624=_0x57d624-0x0;var _0x35663b=_0xac5e[_0x57d624];return _0x35663b;};'use strict';var multer=require(_0xeac5('0x0'));var util=require(_0xeac5('0x1'));var path=require(_0xeac5('0x2'));var timeout=require(_0xeac5('0x3'));var express=require(_0xeac5('0x4'));var router=express['Router']();var fs_extra=require(_0xeac5('0x5'));var auth=require(_0xeac5('0x6'));var interaction=require(_0xeac5('0x7'));var config=require(_0xeac5('0x8'));var controller=require(_0xeac5('0x9'));router[_0xeac5('0xa')]('/',auth[_0xeac5('0xb')](),controller[_0xeac5('0xc')]);router[_0xeac5('0xa')](_0xeac5('0xd'),auth[_0xeac5('0xb')](),controller[_0xeac5('0xe')]);router['get'](_0xeac5('0xf'),auth[_0xeac5('0xb')](),controller[_0xeac5('0x10')]);router['get'](_0xeac5('0x11'),auth['isAuthenticated'](),controller[_0xeac5('0x12')]);router[_0xeac5('0x13')]('/',auth[_0xeac5('0xb')](),controller['create']);router['put'](_0xeac5('0xf'),auth[_0xeac5('0xb')](),controller[_0xeac5('0x14')]);router[_0xeac5('0x15')](_0xeac5('0xf'),auth[_0xeac5('0xb')](),controller[_0xeac5('0x16')]);module[_0xeac5('0x17')]=router; \ No newline at end of file +var _0xfea0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','download','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x45ae0d,_0x1ea3b9){var _0x371826=function(_0x20e757){while(--_0x20e757){_0x45ae0d['push'](_0x45ae0d['shift']());}};_0x371826(++_0x1ea3b9);}(_0xfea0,0xa3));var _0x0fea=function(_0xdd3215,_0xf7dacc){_0xdd3215=_0xdd3215-0x0;var _0x475da7=_0xfea0[_0xdd3215];return _0x475da7;};'use strict';var multer=require(_0x0fea('0x0'));var util=require(_0x0fea('0x1'));var path=require(_0x0fea('0x2'));var timeout=require(_0x0fea('0x3'));var express=require(_0x0fea('0x4'));var router=express[_0x0fea('0x5')]();var fs_extra=require(_0x0fea('0x6'));var auth=require(_0x0fea('0x7'));var interaction=require(_0x0fea('0x8'));var config=require(_0x0fea('0x9'));var controller=require(_0x0fea('0xa'));router[_0x0fea('0xb')]('/',auth[_0x0fea('0xc')](),controller[_0x0fea('0xd')]);router[_0x0fea('0xb')](_0x0fea('0xe'),auth[_0x0fea('0xc')](),controller[_0x0fea('0xf')]);router[_0x0fea('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x0fea('0x10')]);router[_0x0fea('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x0fea('0x11')]);router[_0x0fea('0x12')]('/',auth[_0x0fea('0xc')](),controller[_0x0fea('0x13')]);router[_0x0fea('0x14')](_0x0fea('0x15'),auth['isAuthenticated'](),controller[_0x0fea('0x16')]);router[_0x0fea('0x17')](_0x0fea('0x15'),auth[_0x0fea('0xc')](),controller['destroy']);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 1f085de..43d69f1 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 _0x57ef=['duration','DATE','startedAt','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','setDataValue','subtract'];(function(_0x2e1511,_0x1ea390){var _0x3a2aa0=function(_0x45cee1){while(--_0x45cee1){_0x2e1511['push'](_0x2e1511['shift']());}};_0x3a2aa0(++_0x1ea390);}(_0x57ef,0xdb));var _0xf57e=function(_0x5e4140,_0xb8f3f0){_0x5e4140=_0x5e4140-0x0;var _0x1a5b7e=_0x57ef[_0x5e4140];return _0x1a5b7e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf57e('0x0'));var path=require(_0xf57e('0x1'));var config=require(_0xf57e('0x2'));module[_0xf57e('0x3')]={'format':{'type':Sequelize[_0xf57e('0x4')],'get':function(){return this[_0xf57e('0x5')](_0xf57e('0x6'))?path['extname'](this[_0xf57e('0x5')](_0xf57e('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xf57e('0x7')]},'channel':{'type':Sequelize[_0xf57e('0x7')]},'value':{'type':Sequelize[_0xf57e('0x7')],'set':function(_0x2f47b5){var _0x2498c5=_0x2f47b5[_0xf57e('0x8')](/\\/g,'/');this['setDataValue'](_0xf57e('0x6'),_0x2498c5);}},'rating':{'type':Sequelize[_0xf57e('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xf57e('0x9')],'set':function(_0x2430b1){this[_0xf57e('0xa')]('startedAt',moment()[_0xf57e('0xb')](_0x2430b1,'ms'));this[_0xf57e('0xa')]('closedAt',moment());this[_0xf57e('0xa')](_0xf57e('0xc'),_0x2430b1);}},'startedAt':{'type':Sequelize[_0xf57e('0xd')],'get':function(){return moment(this[_0xf57e('0x5')](_0xf57e('0xe')))[_0xf57e('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xf57e('0x10')]();}},'closedAt':{'type':Sequelize[_0xf57e('0xd')],'get':function(){return moment(this[_0xf57e('0x5')](_0xf57e('0x11')))[_0xf57e('0xf')](_0xf57e('0x12'))[_0xf57e('0x10')]();}},'createdAt':{'type':Sequelize[_0xf57e('0xd')],'get':function(){return moment(this[_0xf57e('0x5')](_0xf57e('0x13')))[_0xf57e('0xf')](_0xf57e('0x12'))[_0xf57e('0x10')]();}},'updatedAt':{'type':Sequelize[_0xf57e('0xd')],'get':function(){return moment(this[_0xf57e('0x5')](_0xf57e('0x14')))[_0xf57e('0xf')](_0xf57e('0x12'))[_0xf57e('0x10')]();}}}; \ No newline at end of file +var _0x4bd3=['../../config/environment','value','extname','getDataValue','STRING','setDataValue','INTEGER','subtract','closedAt','MM-DD-YYYY\x20HH:mm','toString','DATE','format','createdAt','updatedAt','sequelize','path'];(function(_0x391160,_0x2f17a8){var _0x424572=function(_0x256969){while(--_0x256969){_0x391160['push'](_0x391160['shift']());}};_0x424572(++_0x2f17a8);}(_0x4bd3,0x174));var _0x34bd=function(_0x36143a,_0x2786f7){_0x36143a=_0x36143a-0x0;var _0x54e266=_0x4bd3[_0x36143a];return _0x54e266;};'use strict';var Sequelize=require(_0x34bd('0x0'));var moment=require('moment');var path=require(_0x34bd('0x1'));var config=require(_0x34bd('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x34bd('0x3'))?path[_0x34bd('0x4')](this[_0x34bd('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x34bd('0x6')]},'channel':{'type':Sequelize[_0x34bd('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3e8744){var _0x213716=_0x3e8744['replace'](/\\/g,'/');this[_0x34bd('0x7')](_0x34bd('0x3'),_0x213716);}},'rating':{'type':Sequelize[_0x34bd('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x34bd('0x8')],'set':function(_0x1ac77f){this[_0x34bd('0x7')]('startedAt',moment()[_0x34bd('0x9')](_0x1ac77f,'ms'));this[_0x34bd('0x7')](_0x34bd('0xa'),moment());this[_0x34bd('0x7')]('duration',_0x1ac77f);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x34bd('0x5')]('startedAt'))['format'](_0x34bd('0xb'))[_0x34bd('0xc')]();}},'closedAt':{'type':Sequelize[_0x34bd('0xd')],'get':function(){return moment(this[_0x34bd('0x5')](_0x34bd('0xa')))[_0x34bd('0xe')](_0x34bd('0xb'))[_0x34bd('0xc')]();}},'createdAt':{'type':Sequelize[_0x34bd('0xd')],'get':function(){return moment(this['getDataValue'](_0x34bd('0xf')))['format']('MM-DD-YYYY\x20HH:mm')[_0x34bd('0xc')]();}},'updatedAt':{'type':Sequelize[_0x34bd('0xd')],'get':function(){return moment(this[_0x34bd('0x5')](_0x34bd('0x10')))[_0x34bd('0xe')](_0x34bd('0xb'))[_0x34bd('0xc')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5082908..ce21550 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 _0x46ed=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','params','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','filters'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x46ed,0x168));var _0xd46e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46ed[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={},_0x2d1afe={},_0xa716ce={'count':0x0,'rows':[]};var _0x106edc=_[_0xd46e('0x2a')](db[_0xd46e('0x2b')][_0xd46e('0x2c')],function(_0x18f060){return{'name':_0x18f060[_0xd46e('0x2d')],'type':_0x18f060[_0xd46e('0x2e')][_0xd46e('0x2f')]};});_0x2d1afe[_0xd46e('0x30')]=_['differenceBy'](_[_0xd46e('0x2a')](_0x106edc,_0xd46e('0x27')),[_0xd46e('0x31')]);_0x2d1afe[_0xd46e('0x32')]=_['keys'](_0x58aeef[_0xd46e('0x32')]);_0x2d1afe[_0xd46e('0x33')]=_['intersection'](_0x2d1afe[_0xd46e('0x30')],_0x2d1afe[_0xd46e('0x32')]);_0x3a1ced['attributes']=_[_0xd46e('0x34')](_0x2d1afe[_0xd46e('0x30')],qs[_0xd46e('0x35')](_0x58aeef['query']['fields']));_0x3a1ced[_0xd46e('0x36')]=_0x3a1ced[_0xd46e('0x36')][_0xd46e('0x37')]?_0x3a1ced[_0xd46e('0x36')]:_0x2d1afe[_0xd46e('0x30')];if(!_0x58aeef[_0xd46e('0x32')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x3a1ced['limit']=qs[_0xd46e('0x1d')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1d')]);_0x3a1ced[_0xd46e('0x1c')]=qs[_0xd46e('0x1c')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1c')]);}_0x3a1ced['order']=qs[_0xd46e('0x3a')](_0x58aeef[_0xd46e('0x32')]['sort']);_0x3a1ced[_0xd46e('0x3b')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3c')](_0x58aeef[_0xd46e('0x32')],_0x2d1afe['filters']),_0x106edc);if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]){_0x3a1ced[_0xd46e('0x3b')]=_[_0xd46e('0x3e')](_0x3a1ced[_0xd46e('0x3b')],{'$or':_[_0xd46e('0x2a')](_0x106edc,function(_0x220c57){if(_0x220c57[_0xd46e('0x2e')]!=='VIRTUAL'){var _0x232e6f={};_0x232e6f[_0x220c57[_0xd46e('0x27')]]={'$like':'%'+_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]+'%'};return _0x232e6f;}})});}_0x3a1ced=_[_0xd46e('0x3e')]({},_0x3a1ced,_0x58aeef['options']);var _0x964c66={'where':_0x3a1ced['where']};return db['ScreenRecording']['count'](_0x964c66)['then'](function(_0x17c3d9){_0xa716ce['count']=_0x17c3d9;if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x3a1ced['include']=[{'all':!![]}];}return db[_0xd46e('0x2b')][_0xd46e('0x40')](_0x3a1ced);})[_0xd46e('0x25')](function(_0x31ba12){_0xa716ce[_0xd46e('0x41')]=_0x31ba12;return _0xa716ce;})[_0xd46e('0x25')](respondWithFilteredResult(_0x465d54,_0x3a1ced))[_0xd46e('0x42')](handleError(_0x465d54,null));};exports[_0xd46e('0x43')]=function(_0x3a98e4,_0xec367d){var _0x259e2={'raw':![],'where':{'id':_0x3a98e4['params']['id']}},_0x5ea048={};_0x5ea048['model']=_[_0xd46e('0x44')](db['ScreenRecording'][_0xd46e('0x2c')]);_0x5ea048[_0xd46e('0x32')]=_[_0xd46e('0x44')](_0x3a98e4[_0xd46e('0x32')]);_0x5ea048[_0xd46e('0x33')]=_[_0xd46e('0x34')](_0x5ea048[_0xd46e('0x30')],_0x5ea048[_0xd46e('0x32')]);_0x259e2['attributes']=_[_0xd46e('0x34')](_0x5ea048['model'],qs[_0xd46e('0x35')](_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x35')]));_0x259e2[_0xd46e('0x36')]=_0x259e2[_0xd46e('0x36')]['length']?_0x259e2[_0xd46e('0x36')]:_0x5ea048[_0xd46e('0x30')];if(_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x259e2[_0xd46e('0x45')]=[{'all':!![]}];}_0x259e2=_['merge']({},_0x259e2,_0x3a98e4[_0xd46e('0x46')]);return db[_0xd46e('0x2b')][_0xd46e('0x47')](_0x259e2)[_0xd46e('0x25')](handleEntityNotFound(_0xec367d,null))[_0xd46e('0x25')](respondWithResult(_0xec367d,null))['catch'](handleError(_0xec367d,null));};exports[_0xd46e('0x48')]=function(_0x3ea9e6,_0x45baf1){return db[_0xd46e('0x2b')][_0xd46e('0x48')](_0x3ea9e6[_0xd46e('0x49')],{})[_0xd46e('0x25')](respondWithResult(_0x45baf1,0xc9))[_0xd46e('0x42')](handleError(_0x45baf1,null));};exports['update']=function(_0xf9dab,_0x71a8dc){if(_0xf9dab[_0xd46e('0x49')]['id']){delete _0xf9dab[_0xd46e('0x49')]['id'];}delete _0xf9dab[_0xd46e('0x49')]['duration'];delete _0xf9dab['body'][_0xd46e('0x4a')];delete _0xf9dab[_0xd46e('0x49')][_0xd46e('0x4b')];delete _0xf9dab['body']['value'];return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0xf9dab['params']['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x71a8dc,null))[_0xd46e('0x25')](saveUpdates(_0xf9dab[_0xd46e('0x49')],null))[_0xd46e('0x25')](respondWithResult(_0x71a8dc,null))[_0xd46e('0x42')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x4c')]=function(_0x80ed51,_0x16ca0e){return db['ScreenRecording'][_0xd46e('0x4c')]()[_0xd46e('0x25')](respondWithResult(_0x16ca0e,null))[_0xd46e('0x42')](handleError(_0x16ca0e,null));};exports[_0xd46e('0x4d')]=function(_0x4ec295,_0x56dd9a,_0xced102){var _0x5a4a44=require(_0xd46e('0x4e'));var _0x2af20b=![];var _0x393cb9={};if(_0x4ec295[_0xd46e('0x32')][_0xd46e('0x2e')]&&_0x4ec295[_0xd46e('0x32')]['type']===_0xd46e('0x4f')){_0x393cb9[_0xd46e('0x4f')]=_0x4ec295[_0xd46e('0x50')]['id'];}else{_0x393cb9['id']=_0x4ec295['params']['id'];}return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':_0x393cb9,'attributes':['id',_0xd46e('0x51')],'raw':!![]})[_0xd46e('0x25')](handleEntityNotFound(_0x56dd9a,null))[_0xd46e('0x25')](function(_0x2cc676){if(_0x2cc676){var _0x2760ef=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x2cc676[_0xd46e('0x51')]);var _0x411b19=util[_0xd46e('0x31')](_0xd46e('0x55'),_0x2760ef);if(fs['existsSync'](_0x411b19)){_0x2af20b=!![];return _0x5a4a44[_0xd46e('0x56')](_0x411b19,_0x2760ef,config[_0xd46e('0x57')][_0xd46e('0x58')])[_0xd46e('0x25')](function(){return _0x2cc676;});}return _0x2cc676;}})['then'](function(_0x636f15){if(_0x636f15){var _0x36e18a=path[_0xd46e('0x52')](config[_0xd46e('0x53')],'server/files/screen_recordings',_0x636f15[_0xd46e('0x51')]);if(!fs[_0xd46e('0x59')](_0x36e18a)){throw new db['Sequelize']['ValidationError'](_0xd46e('0x5a'));}if(_0x636f15[_0xd46e('0x5b')]){return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,_0x636f15['filename']+path['extname'](_0x36e18a),function(){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}else{return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,function(_0x1f310d){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}}})[_0xd46e('0x42')](function(_0x2f9fcb){if(_0x2f9fcb[_0xd46e('0x5d')]===_0xd46e('0x5a')){_0x56dd9a[_0xd46e('0x1b')](0x194)[_0xd46e('0x28')](_0xd46e('0x5e'));}else{return handleError(_0x56dd9a,null);}});};exports[_0xd46e('0x5f')]=function(_0x272514,_0x329204){return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0x272514['params']['id']}})[_0xd46e('0x25')](function(_0x1a3771){if(_[_0xd46e('0x60')](_0x1a3771)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1a3771;})[_0xd46e('0x25')](function(_0x313c7e){var _0x4dec29=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x313c7e['value']);logger[_0xd46e('0x61')](_0xd46e('0x62'),_0x4dec29);if(!_[_0xd46e('0x60')](_0x313c7e['value'])&&fs[_0xd46e('0x59')](_0x4dec29)){logger['info'](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}_0x4dec29=_0x4dec29+'.cypher';if(!_[_0xd46e('0x60')](_0x313c7e[_0xd46e('0x51')])&&fs[_0xd46e('0x59')](_0x4dec29)){logger[_0xd46e('0x61')](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}return _0x313c7e;})[_0xd46e('0x25')](function(_0x300ee9){if(!_0x300ee9)throw new InternalError();return _0x300ee9[_0xd46e('0x5f')]();})[_0xd46e('0x25')](function(){_0x329204[_0xd46e('0x1b')](0xcc)[_0xd46e('0x66')]();})[_0xd46e('0x42')](handleError(_0x329204,null));}; \ No newline at end of file +var _0xa630=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','order','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','createdAt','value','describe','../../components/encryptor','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','ScreenRecording\x20not\x20found','filename','extname','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa630,0xbe));var _0x0a63=function(_0x4b7e17,_0x307ad1){_0x4b7e17=_0x4b7e17-0x0;var _0x4c5a57=_0xa630[_0x4b7e17];return _0x4c5a57;};'use strict';var emlformat=require(_0x0a63('0x0'));var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a63('0x2'));var moment=require('moment');var BPromise=require(_0x0a63('0x3'));var Mustache=require('mustache');var util=require(_0x0a63('0x4'));var path=require(_0x0a63('0x5'));var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=typeof _0x552b1f[_0x0a63('0x1b')]==='undefined'&&typeof _0x552b1f[_0x0a63('0x1c')]===_0x0a63('0x1d');var _0x36a9e8=_0x1e3251[_0x0a63('0x1e')];var _0x1f7481=_0x524a98?0x0:_0x552b1f[_0x0a63('0x1b')];var _0x30f292=_0x524a98?_0x1e3251[_0x0a63('0x1e')]:_0x552b1f[_0x0a63('0x1b')]+_0x552b1f[_0x0a63('0x1c')];var _0x2ad167;if(_0x30f292>=_0x36a9e8){_0x30f292=_0x36a9e8;_0x2ad167=0xc8;}else{_0x2ad167=0xce;}_0x23b49d['status'](_0x2ad167);return _0x23b49d['set'](_0x0a63('0x1f'),_0x1f7481+'-'+_0x30f292+'/'+_0x36a9e8)['json'](_0x1e3251);}return null;};}function patchUpdates(_0x2fc87c){return function(_0x5937df){try{jsonpatch[_0x0a63('0x20')](_0x5937df,_0x2fc87c,!![]);}catch(_0x41d6b8){return BPromise[_0x0a63('0x21')](_0x41d6b8);}return _0x5937df[_0x0a63('0x22')]();};}function saveUpdates(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')](_0x5da46b)[_0x0a63('0x24')](function(_0x1bf64a){return _0x1bf64a;});}return null;};}function removeEntity(_0x20c114,_0x343273){return function(_0x1f929f){if(_0x1f929f){return _0x1f929f[_0x0a63('0x25')]()[_0x0a63('0x24')](function(){_0x20c114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fb70,_0x4c8637){return function(_0xeacfc9){if(!_0xeacfc9){_0x55fb70['sendStatus'](0x194);}return _0xeacfc9;};}function handleError(_0x496c93,_0x2133cf){_0x2133cf=_0x2133cf||0x1f4;return function(_0x1d5448){logger[_0x0a63('0x26')](_0x1d5448[_0x0a63('0x27')]);if(_0x1d5448['name']){delete _0x1d5448[_0x0a63('0x28')];}_0x496c93[_0x0a63('0x19')](_0x2133cf)[_0x0a63('0x29')](_0x1d5448);};}exports['index']=function(_0x34239b,_0xcf409){var _0x1b7bdb={},_0x145090={},_0x32a52b={'count':0x0,'rows':[]};var _0x4577b6=_[_0x0a63('0x2a')](db[_0x0a63('0x2b')]['rawAttributes'],function(_0x58cc71){return{'name':_0x58cc71['fieldName'],'type':_0x58cc71[_0x0a63('0x2c')][_0x0a63('0x2d')]};});_0x145090[_0x0a63('0x2e')]=_[_0x0a63('0x2f')](_[_0x0a63('0x2a')](_0x4577b6,'name'),[_0x0a63('0x30')]);_0x145090[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x34239b[_0x0a63('0x31')]);_0x145090['filters']=_[_0x0a63('0x33')](_0x145090[_0x0a63('0x2e')],_0x145090['query']);_0x1b7bdb['attributes']=_[_0x0a63('0x33')](_0x145090['model'],qs['fields'](_0x34239b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x1b7bdb['attributes']=_0x1b7bdb[_0x0a63('0x35')][_0x0a63('0x36')]?_0x1b7bdb[_0x0a63('0x35')]:_0x145090[_0x0a63('0x2e')];if(!_0x34239b[_0x0a63('0x31')]['hasOwnProperty']('nolimit')){_0x1b7bdb[_0x0a63('0x1c')]=qs[_0x0a63('0x1c')](_0x34239b[_0x0a63('0x31')][_0x0a63('0x1c')]);_0x1b7bdb[_0x0a63('0x1b')]=qs[_0x0a63('0x1b')](_0x34239b['query'][_0x0a63('0x1b')]);}_0x1b7bdb[_0x0a63('0x37')]=qs['sort'](_0x34239b[_0x0a63('0x31')]['sort']);_0x1b7bdb['where']=qs[_0x0a63('0x38')](_[_0x0a63('0x39')](_0x34239b[_0x0a63('0x31')],_0x145090['filters']),_0x4577b6);if(_0x34239b[_0x0a63('0x31')][_0x0a63('0x3a')]){_0x1b7bdb[_0x0a63('0x3b')]=_[_0x0a63('0x3c')](_0x1b7bdb[_0x0a63('0x3b')],{'$or':_[_0x0a63('0x2a')](_0x4577b6,function(_0x604a45){if(_0x604a45['type']!==_0x0a63('0x3d')){var _0x1c7e67={};_0x1c7e67[_0x604a45[_0x0a63('0x28')]]={'$like':'%'+_0x34239b['query']['filter']+'%'};return _0x1c7e67;}})});}_0x1b7bdb=_[_0x0a63('0x3c')]({},_0x1b7bdb,_0x34239b['options']);var _0x1a01f4={'where':_0x1b7bdb[_0x0a63('0x3b')]};return db[_0x0a63('0x2b')]['count'](_0x1a01f4)[_0x0a63('0x24')](function(_0x14c737){_0x32a52b[_0x0a63('0x1e')]=_0x14c737;if(_0x34239b[_0x0a63('0x31')]['includeAll']){_0x1b7bdb[_0x0a63('0x3e')]=[{'all':!![]}];}return db[_0x0a63('0x2b')][_0x0a63('0x3f')](_0x1b7bdb);})[_0x0a63('0x24')](function(_0xf18ace){_0x32a52b[_0x0a63('0x40')]=_0xf18ace;return _0x32a52b;})['then'](respondWithFilteredResult(_0xcf409,_0x1b7bdb))[_0x0a63('0x41')](handleError(_0xcf409,null));};exports[_0x0a63('0x42')]=function(_0x347a0b,_0x793502){var _0x20fa0d={'raw':![],'where':{'id':_0x347a0b[_0x0a63('0x43')]['id']}},_0x2482ca={};_0x2482ca[_0x0a63('0x2e')]=_[_0x0a63('0x32')](db[_0x0a63('0x2b')][_0x0a63('0x44')]);_0x2482ca[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x347a0b[_0x0a63('0x31')]);_0x2482ca[_0x0a63('0x38')]=_[_0x0a63('0x33')](_0x2482ca[_0x0a63('0x2e')],_0x2482ca[_0x0a63('0x31')]);_0x20fa0d['attributes']=_[_0x0a63('0x33')](_0x2482ca['model'],qs['fields'](_0x347a0b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x20fa0d[_0x0a63('0x35')]=_0x20fa0d[_0x0a63('0x35')][_0x0a63('0x36')]?_0x20fa0d[_0x0a63('0x35')]:_0x2482ca[_0x0a63('0x2e')];if(_0x347a0b[_0x0a63('0x31')][_0x0a63('0x45')]){_0x20fa0d[_0x0a63('0x3e')]=[{'all':!![]}];}_0x20fa0d=_[_0x0a63('0x3c')]({},_0x20fa0d,_0x347a0b[_0x0a63('0x46')]);return db[_0x0a63('0x2b')][_0x0a63('0x47')](_0x20fa0d)[_0x0a63('0x24')](handleEntityNotFound(_0x793502,null))[_0x0a63('0x24')](respondWithResult(_0x793502,null))[_0x0a63('0x41')](handleError(_0x793502,null));};exports[_0x0a63('0x48')]=function(_0x366887,_0x148e0a){return db['ScreenRecording'][_0x0a63('0x48')](_0x366887[_0x0a63('0x49')],{})['then'](respondWithResult(_0x148e0a,0xc9))['catch'](handleError(_0x148e0a,null));};exports['update']=function(_0x485f20,_0x36d066){if(_0x485f20[_0x0a63('0x49')]['id']){delete _0x485f20['body']['id'];}delete _0x485f20[_0x0a63('0x49')]['duration'];delete _0x485f20[_0x0a63('0x49')][_0x0a63('0x4a')];delete _0x485f20['body']['closedAt'];delete _0x485f20['body'][_0x0a63('0x4b')];return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':{'id':_0x485f20[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x36d066,null))['then'](saveUpdates(_0x485f20[_0x0a63('0x49')],null))[_0x0a63('0x24')](respondWithResult(_0x36d066,null))[_0x0a63('0x41')](handleError(_0x36d066,null));};exports[_0x0a63('0x4c')]=function(_0x3575ae,_0x4a5b6e){return db[_0x0a63('0x2b')][_0x0a63('0x4c')]()[_0x0a63('0x24')](respondWithResult(_0x4a5b6e,null))[_0x0a63('0x41')](handleError(_0x4a5b6e,null));};exports['download']=function(_0x35b688,_0x3bd10c,_0x337bef){var _0x330550=require(_0x0a63('0x4d'));var _0x258ed3=![];var _0x4d4e20={};if(_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]&&_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]==='uniqueid'){_0x4d4e20['uniqueid']=_0x35b688[_0x0a63('0x43')]['id'];}else{_0x4d4e20['id']=_0x35b688[_0x0a63('0x43')]['id'];}return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':_0x4d4e20,'attributes':['id',_0x0a63('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3bd10c,null))['then'](function(_0x58b3a8){if(_0x58b3a8){var _0x42c1bb=path['join'](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x58b3a8[_0x0a63('0x4b')]);var _0x5d77e3=util['format'](_0x0a63('0x50'),_0x42c1bb);if(fs[_0x0a63('0x51')](_0x5d77e3)){_0x258ed3=!![];return _0x330550[_0x0a63('0x52')](_0x5d77e3,_0x42c1bb,config[_0x0a63('0x53')][_0x0a63('0x54')])[_0x0a63('0x24')](function(){return _0x58b3a8;});}return _0x58b3a8;}})[_0x0a63('0x24')](function(_0xc3415c){if(_0xc3415c){var _0xe454ef=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0xc3415c[_0x0a63('0x4b')]);if(!fs[_0x0a63('0x51')](_0xe454ef)){throw new db['Sequelize']['ValidationError'](_0x0a63('0x56'));}if(_0xc3415c[_0x0a63('0x57')]){return _0x3bd10c['download'](_0xe454ef,_0xc3415c[_0x0a63('0x57')]+path[_0x0a63('0x58')](_0xe454ef),function(){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}else{return _0x3bd10c[_0x0a63('0x59')](_0xe454ef,function(_0x3053e4){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}}})['catch'](function(_0x3b395a){if(_0x3b395a[_0x0a63('0x5a')]===_0x0a63('0x56')){_0x3bd10c['status'](0x194)[_0x0a63('0x29')](_0x0a63('0x5b'));}else{return handleError(_0x3bd10c,null);}});};exports[_0x0a63('0x25')]=function(_0x284dca,_0x15fc2e){return db['ScreenRecording'][_0x0a63('0x47')]({'where':{'id':_0x284dca[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](function(_0x1fa9cd){if(_[_0x0a63('0x5c')](_0x1fa9cd)){throw new ReferenceError(_0x0a63('0x5d'));}return _0x1fa9cd;})[_0x0a63('0x24')](function(_0x57313b){var _0x4571e7=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x57313b[_0x0a63('0x4b')]);logger[_0x0a63('0x5e')](_0x0a63('0x5f'),_0x4571e7);if(!_[_0x0a63('0x5c')](_0x57313b['value'])&&fs['existsSync'](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}_0x4571e7=_0x4571e7+_0x0a63('0x63');if(!_['isNil'](_0x57313b[_0x0a63('0x4b')])&&fs[_0x0a63('0x51')](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}return _0x57313b;})[_0x0a63('0x24')](function(_0xe52dfd){if(!_0xe52dfd)throw new InternalError();return _0xe52dfd[_0x0a63('0x25')]();})[_0x0a63('0x24')](function(){_0x15fc2e[_0x0a63('0x19')](0xcc)['end']();})[_0x0a63('0x41')](handleError(_0x15fc2e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 785f3cb..5294ead 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 _0x2daf=['exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x3970d9,_0x43e60d){var _0x42ff83=function(_0x4505cf){while(--_0x4505cf){_0x3970d9['push'](_0x3970d9['shift']());}};_0x42ff83(++_0x43e60d);}(_0x2daf,0x1c5));var _0xf2da=function(_0x152405,_0x5e8952){_0x152405=_0x152405-0x0;var _0x46647a=_0x2daf[_0x152405];return _0x46647a;};'use strict';var _=require(_0xf2da('0x0'));var util=require(_0xf2da('0x1'));var logger=require(_0xf2da('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2da('0x3'));var rp=require(_0xf2da('0x4'));var fs=require('fs');var path=require(_0xf2da('0x5'));var rimraf=require(_0xf2da('0x6'));var config=require(_0xf2da('0x7'));var attributes=require(_0xf2da('0x8'));module[_0xf2da('0x9')]=function(_0x239770,_0x2b43dd){return _0x239770[_0xf2da('0xa')](_0xf2da('0xb'),attributes,{'tableName':_0xf2da('0xc'),'paranoid':![],'indexes':[{'name':_0xf2da('0xd'),'fields':[_0xf2da('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x58da=['api','moment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','../../config/logger'];(function(_0x22f048,_0x20c372){var _0xda0bfa=function(_0x19a86b){while(--_0x19a86b){_0x22f048['push'](_0x22f048['shift']());}};_0xda0bfa(++_0x20c372);}(_0x58da,0x1c1));var _0xa58d=function(_0xeb73fb,_0x227320){_0xeb73fb=_0xeb73fb-0x0;var _0x103c60=_0x58da[_0xeb73fb];return _0x103c60;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa58d('0x0'))(_0xa58d('0x1'));var moment=require(_0xa58d('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(_0xa58d('0x3'));module[_0xa58d('0x4')]=function(_0x1ad51f,_0x5a0101){return _0x1ad51f[_0xa58d('0x5')](_0xa58d('0x6'),attributes,{'tableName':_0xa58d('0x7'),'paranoid':![],'indexes':[{'name':_0xa58d('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 11c13a5..583baa7 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 _0xa919=['catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x51e20e,_0x568d8b){var _0x1e8ee3=function(_0x45f883){while(--_0x45f883){_0x51e20e['push'](_0x51e20e['shift']());}};_0x1e8ee3(++_0x568d8b);}(_0xa919,0x1cf));var _0x9a91=function(_0x449158,_0x44e1b0){_0x449158=_0x449158-0x0;var _0x1f3c3a=_0xa919[_0x449158];return _0x1f3c3a;};'use strict';var _=require(_0x9a91('0x0'));var util=require(_0x9a91('0x1'));var moment=require(_0x9a91('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9a91('0x4'));var logger=require(_0x9a91('0x5'))(_0x9a91('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a91('0x7'));var client=jayson['client'][_0x9a91('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ed42b,_0xb7d4b0,_0x386c8d){return new BPromise(function(_0x4dd4d3,_0x45e00b){return client['request'](_0x2ed42b,_0x386c8d)[_0x9a91('0x9')](function(_0x356f59){logger['info'](_0x9a91('0xa'),_0xb7d4b0,_0x9a91('0xb'));logger[_0x9a91('0xc')](_0x9a91('0xd'),_0xb7d4b0,_0x9a91('0xb'),JSON[_0x9a91('0xe')](_0x356f59));if(_0x356f59[_0x9a91('0xf')]){if(_0x356f59[_0x9a91('0xf')][_0x9a91('0x10')]===0x1f4){logger[_0x9a91('0xf')](_0x9a91('0xa'),_0xb7d4b0,_0x356f59[_0x9a91('0xf')]['message']);return _0x45e00b(_0x356f59[_0x9a91('0xf')][_0x9a91('0x11')]);}logger[_0x9a91('0xf')](_0x9a91('0xa'),_0xb7d4b0,_0x356f59[_0x9a91('0xf')][_0x9a91('0x11')]);return _0x4dd4d3(_0x356f59[_0x9a91('0xf')][_0x9a91('0x11')]);}else{logger[_0x9a91('0x12')](_0x9a91('0xa'),_0xb7d4b0,_0x9a91('0xb'));_0x4dd4d3(_0x356f59[_0x9a91('0x13')][_0x9a91('0x11')]);}})[_0x9a91('0x14')](function(_0x1499ed){logger[_0x9a91('0xf')](_0x9a91('0xa'),_0xb7d4b0,_0x1499ed);_0x45e00b(_0x1499ed);});});} \ No newline at end of file +var _0x8841=['stringify','error','code','message','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x29bdba,_0x3fb651){var _0x340f38=function(_0x3545c4){while(--_0x3545c4){_0x29bdba['push'](_0x29bdba['shift']());}};_0x340f38(++_0x3fb651);}(_0x8841,0x193));var _0x1884=function(_0x9fdad3,_0x228592){_0x9fdad3=_0x9fdad3-0x0;var _0x11c108=_0x8841[_0x9fdad3];return _0x11c108;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1884('0x0'));var BPromise=require(_0x1884('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1884('0x2'))['db'];var utils=require(_0x1884('0x3'));var logger=require(_0x1884('0x4'))('rpc');var config=require(_0x1884('0x5'));var jayson=require(_0x1884('0x6'));var client=jayson['client'][_0x1884('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3182a7,_0x491497,_0x1c25e1){return new BPromise(function(_0x5b865d,_0x57dd45){return client[_0x1884('0x8')](_0x3182a7,_0x1c25e1)[_0x1884('0x9')](function(_0x31e04e){logger[_0x1884('0xa')](_0x1884('0xb'),_0x491497,_0x1884('0xc'));logger[_0x1884('0xd')](_0x1884('0xe'),_0x491497,_0x1884('0xc'),JSON[_0x1884('0xf')](_0x31e04e));if(_0x31e04e['error']){if(_0x31e04e[_0x1884('0x10')][_0x1884('0x11')]===0x1f4){logger[_0x1884('0x10')](_0x1884('0xb'),_0x491497,_0x31e04e[_0x1884('0x10')]['message']);return _0x57dd45(_0x31e04e[_0x1884('0x10')]['message']);}logger[_0x1884('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x491497,_0x31e04e[_0x1884('0x10')][_0x1884('0x12')]);return _0x5b865d(_0x31e04e[_0x1884('0x10')][_0x1884('0x12')]);}else{logger['info'](_0x1884('0xb'),_0x491497,_0x1884('0xc'));_0x5b865d(_0x31e04e['result'][_0x1884('0x12')]);}})['catch'](function(_0x4aa542){logger[_0x1884('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x491497,_0x4aa542);_0x57dd45(_0x4aa542);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 17f940d..a985966 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 _0x369c=['/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','format','%s%s','originalname','post','single','addLogo','join','logologin','extname','file','preferred','/:id/preferred','favicon','put','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index'];(function(_0x57455c,_0x2dc57c){var _0x3dc97e=function(_0x1a7100){while(--_0x1a7100){_0x57455c['push'](_0x57455c['shift']());}};_0x3dc97e(++_0x2dc57c);}(_0x369c,0xe4));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc369('0x0'));var util=require(_0xc369('0x1'));var path=require(_0xc369('0x2'));var timeout=require('connect-timeout');var express=require(_0xc369('0x3'));var router=express[_0xc369('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc369('0x5'));var interaction=require(_0xc369('0x6'));var config=require(_0xc369('0x7'));var controller=require(_0xc369('0x8'));router[_0xc369('0x9')]('/',auth[_0xc369('0xa')](),controller[_0xc369('0xb')]);router[_0xc369('0x9')](_0xc369('0xc'),controller['getDate']);router[_0xc369('0x9')](_0xc369('0xd'),controller[_0xc369('0xe')]);router['get'](_0xc369('0xf'),controller[_0xc369('0x10')]);router[_0xc369('0x9')](_0xc369('0x11'),controller[_0xc369('0x12')]);router[_0xc369('0x9')](_0xc369('0x13'),controller['gdpr']);router[_0xc369('0x9')]('/:id/preferred',controller[_0xc369('0x14')]);router['get'](_0xc369('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc369('0x16')]({'destination':function(_0x20fb42,_0x1430f9,_0x2c845f){_0x2c845f(null,path['join'](config[_0xc369('0x17')],_0xc369('0x18')));},'filename':function(_0x500509,_0x743ad,_0xebd7ce){_0xebd7ce(null,util[_0xc369('0x19')](_0xc369('0x1a'),'logo',path['extname'](_0x743ad[_0xc369('0x1b')])));}})});router[_0xc369('0x1c')](_0xc369('0xf'),upload[_0xc369('0x1d')]('file'),controller[_0xc369('0x1e')]);var upload=multer({'storage':multer[_0xc369('0x16')]({'destination':function(_0x259246,_0x242454,_0x42bf4f){_0x42bf4f(null,path[_0xc369('0x1f')](config[_0xc369('0x17')],_0xc369('0x18')));},'filename':function(_0xefc02f,_0x307fe3,_0x215938){_0x215938(null,util[_0xc369('0x19')](_0xc369('0x1a'),_0xc369('0x20'),path[_0xc369('0x21')](_0x307fe3[_0xc369('0x1b')])));}})});router[_0xc369('0x1c')]('/:id/logo_login',upload[_0xc369('0x1d')](_0xc369('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc369('0x16')]({'destination':function(_0x4b1f1a,_0x2670ae,_0x19b779){_0x19b779(null,path['join'](config[_0xc369('0x17')],_0xc369('0x18')));},'filename':function(_0x113008,_0x289dfa,_0x4030bf){_0x4030bf(null,util[_0xc369('0x19')]('%s%s',_0xc369('0x23'),path[_0xc369('0x21')](_0x289dfa[_0xc369('0x1b')])));}})});router[_0xc369('0x1c')](_0xc369('0x24'),upload['single'](_0xc369('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc369('0x16')]({'destination':function(_0x49c5a5,_0x514dbb,_0x17b521){_0x17b521(null,path[_0xc369('0x1f')](config[_0xc369('0x17')],_0xc369('0x18')));},'filename':function(_0x278217,_0x2e5e7a,_0x5af15f){_0x5af15f(null,util[_0xc369('0x19')](_0xc369('0x1a'),_0xc369('0x25'),path[_0xc369('0x21')](_0x2e5e7a['originalname'])));}})});router['post'](_0xc369('0x15'),upload[_0xc369('0x1d')](_0xc369('0x22')),controller['addFavicon']);router[_0xc369('0x26')](_0xc369('0xd'),auth[_0xc369('0xa')](),controller[_0xc369('0x27')]);module['exports']=router; \ No newline at end of file +var _0xe008=['update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','server/files/images/logos/','logo','extname','originalname','single','file','root','%s%s','logologin','post','addLogoLogin','format','preferred','addPreferred','/:id/favicon','put','isAuthenticated'];(function(_0xd4057b,_0x5b3ac1){var _0x5f17e1=function(_0xdf13b5){while(--_0xdf13b5){_0xd4057b['push'](_0xd4057b['shift']());}};_0x5f17e1(++_0x5b3ac1);}(_0xe008,0xaa));var _0x8e00=function(_0x230220,_0x576d95){_0x230220=_0x230220-0x0;var _0x5bd96d=_0xe008[_0x230220];return _0x5bd96d;};'use strict';var multer=require(_0x8e00('0x0'));var util=require('util');var path=require(_0x8e00('0x1'));var timeout=require(_0x8e00('0x2'));var express=require(_0x8e00('0x3'));var router=express[_0x8e00('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e00('0x5'));var interaction=require(_0x8e00('0x6'));var config=require(_0x8e00('0x7'));var controller=require('./setting.controller');router[_0x8e00('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e00('0x9')]);router['get']('/now',controller[_0x8e00('0xa')]);router['get'](_0x8e00('0xb'),controller[_0x8e00('0xc')]);router['get'](_0x8e00('0xd'),controller[_0x8e00('0xe')]);router[_0x8e00('0x8')](_0x8e00('0xf'),controller[_0x8e00('0x10')]);router[_0x8e00('0x8')]('/:id/gdpr',controller[_0x8e00('0x11')]);router[_0x8e00('0x8')](_0x8e00('0x12'),controller[_0x8e00('0x13')]);router[_0x8e00('0x8')]('/:id/favicon',controller[_0x8e00('0x14')]);var upload=multer({'storage':multer[_0x8e00('0x15')]({'destination':function(_0x8749f6,_0x44f412,_0x377bbb){_0x377bbb(null,path[_0x8e00('0x16')](config['root'],_0x8e00('0x17')));},'filename':function(_0x38bdfd,_0x207a99,_0x447bc5){_0x447bc5(null,util['format']('%s%s',_0x8e00('0x18'),path[_0x8e00('0x19')](_0x207a99[_0x8e00('0x1a')])));}})});router['post'](_0x8e00('0xd'),upload[_0x8e00('0x1b')](_0x8e00('0x1c')),controller['addLogo']);var upload=multer({'storage':multer[_0x8e00('0x15')]({'destination':function(_0x1c4502,_0x36dc53,_0xf54aa0){_0xf54aa0(null,path['join'](config[_0x8e00('0x1d')],'server/files/images/logos/'));},'filename':function(_0x13bb8a,_0x28d390,_0x3cd83a){_0x3cd83a(null,util['format'](_0x8e00('0x1e'),_0x8e00('0x1f'),path['extname'](_0x28d390['originalname'])));}})});router[_0x8e00('0x20')](_0x8e00('0xf'),upload[_0x8e00('0x1b')]('file'),controller[_0x8e00('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x418994,_0x4a1b54,_0x35594d){_0x35594d(null,path[_0x8e00('0x16')](config[_0x8e00('0x1d')],_0x8e00('0x17')));},'filename':function(_0x4f216d,_0x27d48e,_0x149b2e){_0x149b2e(null,util[_0x8e00('0x22')]('%s%s',_0x8e00('0x23'),path[_0x8e00('0x19')](_0x27d48e[_0x8e00('0x1a')])));}})});router[_0x8e00('0x20')](_0x8e00('0x12'),upload[_0x8e00('0x1b')](_0x8e00('0x1c')),controller[_0x8e00('0x24')]);var upload=multer({'storage':multer[_0x8e00('0x15')]({'destination':function(_0x11d113,_0x266e3d,_0x1fd117){_0x1fd117(null,path[_0x8e00('0x16')](config[_0x8e00('0x1d')],_0x8e00('0x17')));},'filename':function(_0x346dd3,_0x1dfac1,_0x2da9b4){_0x2da9b4(null,util['format'](_0x8e00('0x1e'),'favicon',path['extname'](_0x1dfac1[_0x8e00('0x1a')])));}})});router[_0x8e00('0x20')](_0x8e00('0x25'),upload['single'](_0x8e00('0x1c')),controller['addFavicon']);router[_0x8e00('0x26')](_0x8e00('0xb'),auth[_0x8e00('0x27')](),controller[_0x8e00('0x28')]);module[_0x8e00('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 cea41b6..39890e7 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 _0x39e0=['INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x39e0,0x1a3));var _0x039e=function(_0x1b103c,_0x139e86){_0x1b103c=_0x1b103c-0x0;var _0x5ecbe8=_0x39e0[_0x1b103c];return _0x5ecbe8;};'use strict';var Sequelize=require('sequelize');module[_0x039e('0x0')]={'min_internal':{'type':Sequelize[_0x039e('0x1')](0xb),'unique':_0x039e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x039e('0x1')](0xb),'unique':_0x039e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x039e('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x039e('0x4')},'logo':{'type':Sequelize[_0x039e('0x5')]},'defaultLogo':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x039e('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x039e('0x5')]},'turnaddr':{'type':Sequelize[_0x039e('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x039e('0x5')]},'pageTitle':{'type':Sequelize[_0x039e('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x039e('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x039e('0x5')],'defaultValue':_0x039e('0x7')},'enableEmailPreview':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x039e('0x5')],'defaultValue':_0x039e('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x039e('0x5')]},'defaultPreferred':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x039e('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x039e('0x5')]},'sentiment':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x039e('0x1')]},'sentimentRegion':{'type':Sequelize[_0x039e('0x5')]},'language':{'type':Sequelize[_0x039e('0x5')]},'bucket':{'type':Sequelize[_0x039e('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x039e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x039e('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x039e('0x1')](0x2)[_0x039e('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x039e('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x039e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x039e('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x039e('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x9866=['INTEGER','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports'];(function(_0x5efeed,_0x1201ee){var _0x1c764d=function(_0x3d1ef9){while(--_0x3d1ef9){_0x5efeed['push'](_0x5efeed['shift']());}};_0x1c764d(++_0x1201ee);}(_0x9866,0x1d6));var _0x6986=function(_0x3cb233,_0x3bcda5){_0x3cb233=_0x3cb233-0x0;var _0x51f00d=_0x9866[_0x3cb233];return _0x51f00d;};'use strict';var Sequelize=require(_0x6986('0x0'));module[_0x6986('0x1')]={'min_internal':{'type':Sequelize[_0x6986('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6986('0x2')](0xb),'unique':_0x6986('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x6986('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x6986('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6986('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6986('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x6986('0x4')]},'turnpassword':{'type':Sequelize[_0x6986('0x4')]},'pageTitle':{'type':Sequelize[_0x6986('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x6986('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6986('0x4')],'defaultValue':_0x6986('0x6')},'enableEmailPreview':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x6986('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x6986('0x4')]},'defaultPreferred':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6986('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6986('0x4')]},'defaultFavicon':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6986('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6986('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x6986('0x2')]},'sentimentRegion':{'type':Sequelize[_0x6986('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x6986('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6986('0x2')](0x2)[_0x6986('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x6986('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6986('0x2')](0x2)[_0x6986('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x6986('0x2')](0x2)[_0x6986('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x6986('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x6986('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x6986('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x6986('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x6986('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x6986('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 7cb608d..585e493 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 _0xcf75=['default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','apply','reject','save','update','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','show','fields','find','body','params','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','custom','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf75,0x83));var _0x5cf7=function(_0x2422bd,_0x1120d2){_0x2422bd=_0x2422bd-0x0;var _0x1a6113=_0xcf75[_0x2422bd];return _0x1a6113;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cf7('0x0'));var zipdir=require(_0x5cf7('0x1'));var jsonpatch=require(_0x5cf7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5cf7('0x3'));var Mustache=require(_0x5cf7('0x4'));var util=require('util');var path=require(_0x5cf7('0x5'));var sox=require(_0x5cf7('0x6'));var csv=require(_0x5cf7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5cf7('0x8'));var _=require(_0x5cf7('0x9'));var squel=require('squel');var crypto=require(_0x5cf7('0xa'));var jsforce=require(_0x5cf7('0xb'));var deskjs=require(_0x5cf7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5cf7('0xd'));var Papa=require(_0x5cf7('0xe'));var Redis=require(_0x5cf7('0xf'));var authService=require(_0x5cf7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5cf7('0x11'));var hardwareService=require(_0x5cf7('0x12'));var logger=require(_0x5cf7('0x13'))('api');var utils=require(_0x5cf7('0x14'));var config=require(_0x5cf7('0x15'));var licenseUtil=require(_0x5cf7('0x16'));var db=require(_0x5cf7('0x17'))['db'];var jayson=require(_0x5cf7('0x18'));var client=jayson[_0x5cf7('0x19')][_0x5cf7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x59636c,_0xbee2fe,_0x501738,_0x15e638){return new BPromise(function(_0x2ffa28,_0x48e63f){var _0x85019c=_0x15e638||client;return _0x85019c[_0x5cf7('0x1b')](_0x59636c,_0x501738)[_0x5cf7('0x1c')](function(_0x5a2653){logger[_0x5cf7('0x1d')](_0x5cf7('0x1e'),_0xbee2fe,_0x5cf7('0x1f'));logger[_0x5cf7('0x20')](_0x5cf7('0x21'),_0xbee2fe,_0x5cf7('0x1f'),JSON[_0x5cf7('0x22')](_0x5a2653));if(_0x5a2653[_0x5cf7('0x23')]){if(_0x5a2653[_0x5cf7('0x23')][_0x5cf7('0x24')]===0x1f4){logger[_0x5cf7('0x23')]('Setting,\x20%s,\x20%s',_0xbee2fe,_0x5a2653[_0x5cf7('0x23')][_0x5cf7('0x25')]);return _0x48e63f(_0x5a2653['error'][_0x5cf7('0x25')]);}logger[_0x5cf7('0x23')](_0x5cf7('0x1e'),_0xbee2fe,_0x5a2653[_0x5cf7('0x23')][_0x5cf7('0x25')]);return _0x2ffa28(_0x5a2653['error'][_0x5cf7('0x25')]);}else{logger[_0x5cf7('0x1d')](_0x5cf7('0x1e'),_0xbee2fe,_0x5cf7('0x1f'));_0x2ffa28(_0x5a2653[_0x5cf7('0x26')]['message']);}})[_0x5cf7('0x27')](function(_0x1867cb){logger[_0x5cf7('0x23')]('Setting,\x20%s,\x20%s',_0xbee2fe,_0x1867cb);_0x48e63f(_0x1867cb);});});}function respondWithStatusCode(_0x30895c,_0x1e16a6){_0x1e16a6=_0x1e16a6||0xcc;return function(_0x1bba38){if(_0x1bba38){return _0x30895c[_0x5cf7('0x28')](_0x1e16a6);}return _0x30895c[_0x5cf7('0x29')](_0x1e16a6)[_0x5cf7('0x2a')]();};}function respondWithResult(_0x4daa56,_0x3ba3aa){_0x3ba3aa=_0x3ba3aa||0xc8;return function(_0x2aadd3){if(_0x2aadd3){return _0x4daa56[_0x5cf7('0x29')](_0x3ba3aa)[_0x5cf7('0x2b')](_0x2aadd3);}};}function respondWithFilteredResult(_0xd444a6,_0x20560f){return function(_0x3fec44){if(_0x3fec44){var _0x5b94dd=typeof _0x20560f[_0x5cf7('0x2c')]===_0x5cf7('0x2d')&&typeof _0x20560f['limit']===_0x5cf7('0x2d');var _0x546a21=_0x3fec44['count'];var _0x3abf5e=_0x5b94dd?0x0:_0x20560f[_0x5cf7('0x2c')];var _0x22b9b7=_0x5b94dd?_0x3fec44['count']:_0x20560f[_0x5cf7('0x2c')]+_0x20560f['limit'];var _0x206426;if(_0x22b9b7>=_0x546a21){_0x22b9b7=_0x546a21;_0x206426=0xc8;}else{_0x206426=0xce;}_0xd444a6[_0x5cf7('0x29')](_0x206426);return _0xd444a6['set']('Content-Range',_0x3abf5e+'-'+_0x22b9b7+'/'+_0x546a21)[_0x5cf7('0x2b')](_0x3fec44);}return null;};}function patchUpdates(_0x54b8bc){return function(_0x5c33e0){try{jsonpatch[_0x5cf7('0x2e')](_0x5c33e0,_0x54b8bc,!![]);}catch(_0x45c423){return BPromise[_0x5cf7('0x2f')](_0x45c423);}return _0x5c33e0[_0x5cf7('0x30')]();};}function saveUpdates(_0x38935f,_0x36b4fa){return function(_0x70f233){if(_0x70f233){return _0x70f233[_0x5cf7('0x31')](_0x38935f)[_0x5cf7('0x1c')](function(_0x3cc6ce){return _0x3cc6ce;});}return null;};}function removeEntity(_0x198ee5,_0x21519f){return function(_0x1960e2){if(_0x1960e2){return _0x1960e2['destroy']()[_0x5cf7('0x1c')](function(){_0x198ee5[_0x5cf7('0x29')](0xcc)[_0x5cf7('0x2a')]();});}};}function handleEntityNotFound(_0x2fb459,_0x3228b4){return function(_0x59e539){if(!_0x59e539){_0x2fb459['sendStatus'](0x194);}return _0x59e539;};}function handleError(_0x231812,_0x4cc74a){_0x4cc74a=_0x4cc74a||0x1f4;return function(_0x24a417){logger[_0x5cf7('0x23')](_0x24a417['stack']);if(_0x24a417[_0x5cf7('0x32')]){delete _0x24a417[_0x5cf7('0x32')];}_0x231812[_0x5cf7('0x29')](_0x4cc74a)[_0x5cf7('0x33')](_0x24a417);};}exports[_0x5cf7('0x34')]=function(_0x480ac6,_0x3f3b05){var _0x42a400={},_0x44fb56={},_0xc9dd2={'count':0x0,'rows':[]};var _0x50dd07=_[_0x5cf7('0x35')](db[_0x5cf7('0x36')][_0x5cf7('0x37')],function(_0x4fb5d8){return{'name':_0x4fb5d8[_0x5cf7('0x38')],'type':_0x4fb5d8[_0x5cf7('0x39')]['key']};});_0x44fb56[_0x5cf7('0x3a')]=_[_0x5cf7('0x35')](_0x50dd07,_0x5cf7('0x32'));_0x44fb56[_0x5cf7('0x3b')]=_[_0x5cf7('0x3c')](_0x480ac6[_0x5cf7('0x3b')]);_0x44fb56[_0x5cf7('0x3d')]=_[_0x5cf7('0x3e')](_0x44fb56[_0x5cf7('0x3a')],_0x44fb56['query']);_0x42a400[_0x5cf7('0x3f')]=_['intersection'](_0x44fb56[_0x5cf7('0x3a')],qs['fields'](_0x480ac6['query']['fields']));_0x42a400[_0x5cf7('0x3f')]=_0x42a400['attributes'][_0x5cf7('0x40')]?_0x42a400[_0x5cf7('0x3f')]:_0x44fb56['model'];if(!_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x41')](_0x5cf7('0x42'))){_0x42a400['limit']=qs[_0x5cf7('0x43')](_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x43')]);_0x42a400[_0x5cf7('0x2c')]=qs[_0x5cf7('0x2c')](_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x2c')]);}_0x42a400[_0x5cf7('0x44')]=qs[_0x5cf7('0x45')](_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x45')]);_0x42a400[_0x5cf7('0x46')]=qs[_0x5cf7('0x3d')](_[_0x5cf7('0x47')](_0x480ac6[_0x5cf7('0x3b')],_0x44fb56[_0x5cf7('0x3d')]),_0x50dd07);if(_0x480ac6[_0x5cf7('0x3b')]['filter']){_0x42a400['where']=_[_0x5cf7('0x48')](_0x42a400['where'],{'$or':_[_0x5cf7('0x35')](_0x50dd07,function(_0x1ff1d9){if(_0x1ff1d9[_0x5cf7('0x39')]!==_0x5cf7('0x49')){var _0x2de773={};_0x2de773[_0x1ff1d9[_0x5cf7('0x32')]]={'$like':'%'+_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x4a')]+'%'};return _0x2de773;}})});}_0x42a400=_[_0x5cf7('0x48')]({},_0x42a400,_0x480ac6[_0x5cf7('0x4b')]);var _0xfa9be7={'where':_0x42a400[_0x5cf7('0x46')]};return db[_0x5cf7('0x36')]['count'](_0xfa9be7)[_0x5cf7('0x1c')](function(_0x36054a){_0xc9dd2[_0x5cf7('0x4c')]=_0x36054a;if(_0x480ac6[_0x5cf7('0x3b')][_0x5cf7('0x4d')]){_0x42a400[_0x5cf7('0x4e')]=[{'all':!![]}];}return db[_0x5cf7('0x36')][_0x5cf7('0x4f')](_0x42a400);})[_0x5cf7('0x1c')](function(_0x1d6256){_0xc9dd2['rows']=_0x1d6256;return _0xc9dd2;})[_0x5cf7('0x1c')](respondWithFilteredResult(_0x3f3b05,_0x42a400))['catch'](handleError(_0x3f3b05,null));};exports[_0x5cf7('0x50')]=function(_0x2c132f,_0x5060c3){var _0x15dc95={'raw':![],'where':{'id':_0x2c132f['params']['id']}},_0x52447c={};_0x52447c[_0x5cf7('0x3a')]=_['keys'](db[_0x5cf7('0x36')]['rawAttributes']);_0x52447c[_0x5cf7('0x3b')]=_['keys'](_0x2c132f['query']);_0x52447c['filters']=_[_0x5cf7('0x3e')](_0x52447c[_0x5cf7('0x3a')],_0x52447c[_0x5cf7('0x3b')]);_0x15dc95[_0x5cf7('0x3f')]=_['intersection'](_0x52447c[_0x5cf7('0x3a')],qs[_0x5cf7('0x51')](_0x2c132f[_0x5cf7('0x3b')][_0x5cf7('0x51')]));_0x15dc95['attributes']=_0x15dc95['attributes'][_0x5cf7('0x40')]?_0x15dc95[_0x5cf7('0x3f')]:_0x52447c[_0x5cf7('0x3a')];if(_0x2c132f[_0x5cf7('0x3b')][_0x5cf7('0x4d')]){_0x15dc95['include']=[{'all':!![]}];}_0x15dc95=_[_0x5cf7('0x48')]({},_0x15dc95,_0x2c132f[_0x5cf7('0x4b')]);return db[_0x5cf7('0x36')][_0x5cf7('0x52')](_0x15dc95)[_0x5cf7('0x1c')](handleEntityNotFound(_0x5060c3,null))[_0x5cf7('0x1c')](respondWithResult(_0x5060c3,null))[_0x5cf7('0x27')](handleError(_0x5060c3,null));};exports[_0x5cf7('0x31')]=function(_0x90caa,_0x4e0dc0){if(_0x90caa[_0x5cf7('0x53')]['id']){delete _0x90caa[_0x5cf7('0x53')]['id'];}return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x90caa[_0x5cf7('0x54')]['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x4e0dc0,null))[_0x5cf7('0x1c')](saveUpdates(_0x90caa[_0x5cf7('0x53')],null))[_0x5cf7('0x1c')](respondWithResult(_0x4e0dc0,null))['catch'](handleError(_0x4e0dc0,null));};exports['addLogo']=function(_0x34905e,_0x57d75d,_0x5373c2){if(_0x34905e[_0x5cf7('0x55')]&&_0x34905e[_0x5cf7('0x55')][_0x5cf7('0x56')]){_0x34905e['body'][_0x5cf7('0x57')]=_0x34905e['file'][_0x5cf7('0x56')];}return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x34905e[_0x5cf7('0x54')]['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x57d75d,null))[_0x5cf7('0x1c')](saveUpdates(_0x34905e['body'],null))['then'](respondWithResult(_0x57d75d,null))[_0x5cf7('0x27')](handleError(_0x57d75d,null));};exports[_0x5cf7('0x58')]=function(_0x322608,_0x4dcdf2,_0xef03b5){if(_0x322608[_0x5cf7('0x55')]&&_0x322608[_0x5cf7('0x55')][_0x5cf7('0x56')]){_0x322608[_0x5cf7('0x53')][_0x5cf7('0x59')]=_0x322608[_0x5cf7('0x55')][_0x5cf7('0x56')];}return db['Setting'][_0x5cf7('0x52')]({'where':{'id':_0x322608[_0x5cf7('0x54')]['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x4dcdf2,null))[_0x5cf7('0x1c')](saveUpdates(_0x322608[_0x5cf7('0x53')],null))[_0x5cf7('0x1c')](respondWithResult(_0x4dcdf2,null))[_0x5cf7('0x27')](handleError(_0x4dcdf2,null));};var utilLicense=require(_0x5cf7('0x16'));exports[_0x5cf7('0x5a')]=function(_0x24eaf2,_0x265053,_0x2584c4){var _0x35be78=_0x5cf7('0x5b');var _0x1d89cc={'custom':![]};return utilLicense[_0x5cf7('0x5c')]()[_0x5cf7('0x1c')](function(_0x75b398){if(_0x75b398){_0x1d89cc=_0x75b398;}return db['Setting'][_0x5cf7('0x52')]({'where':{'id':_0x24eaf2[_0x5cf7('0x54')]['id']},'attributes':[_0x5cf7('0x57'),'loginLogo','preferred',_0x5cf7('0x5d'),_0x5cf7('0x5e'),_0x5cf7('0x5f'),_0x5cf7('0x60'),_0x5cf7('0x61')],'raw':!![]});})[_0x5cf7('0x1c')](handleEntityNotFound(_0x265053,null))[_0x5cf7('0x1c')](function(_0x32a26b){if(_0x32a26b){var _0x586641=_0x32a26b['logo']&&fs[_0x5cf7('0x62')](path[_0x5cf7('0x63')](config['root'],_0x35be78,_[_0x5cf7('0x64')](_0x32a26b[_0x5cf7('0x57')])))?path[_0x5cf7('0x63')](config['root'],_0x35be78,_[_0x5cf7('0x64')](_0x32a26b[_0x5cf7('0x57')])):path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x35be78,_['toLower'](_0x5cf7('0x66')));var _0x5e6f1c=_0x5cf7('0x67')+_[_0x5cf7('0x68')](_0x5cf7('0x57'));if(_0x32a26b[_0x5e6f1c]||!_0x1d89cc['custom']){_0x586641=path['join'](config[_0x5cf7('0x65')],_0x35be78,_[_0x5cf7('0x64')](_0x5cf7('0x66')));}if(!fs[_0x5cf7('0x62')](_0x586641)){throw new db[(_0x5cf7('0x69'))][(_0x5cf7('0x6a'))](_[_0x5cf7('0x68')](_0x5cf7('0x57'))+_0x5cf7('0x6b'));}return _0x265053[_0x5cf7('0x6c')](_0x586641);}})[_0x5cf7('0x27')](handleError(_0x265053,null));};var utilLicense=require(_0x5cf7('0x16'));exports[_0x5cf7('0x6d')]=function(_0x1ad10f,_0x326fb2,_0x50167b){var _0x402bfa=_0x5cf7('0x5b');var _0x334db1={'custom':![]};return utilLicense[_0x5cf7('0x5c')]()[_0x5cf7('0x1c')](function(_0x456303){if(_0x456303){_0x334db1=_0x456303;}return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x1ad10f[_0x5cf7('0x54')]['id']},'attributes':['logo',_0x5cf7('0x59'),_0x5cf7('0x6e'),_0x5cf7('0x5d'),_0x5cf7('0x5e'),'defaultLoginLogo',_0x5cf7('0x60'),_0x5cf7('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x326fb2,null))['then'](function(_0x22bfaf){if(_0x22bfaf){var _0x12bf5b=_0x22bfaf['loginLogo']&&fs['existsSync'](path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x402bfa,_[_0x5cf7('0x64')](_0x22bfaf[_0x5cf7('0x59')])))?path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x402bfa,_[_0x5cf7('0x64')](_0x22bfaf[_0x5cf7('0x59')])):path[_0x5cf7('0x63')](config['root'],_0x402bfa,_[_0x5cf7('0x64')]('default_loginLogo.svg'));var _0x4ea1b4=_0x5cf7('0x67')+_[_0x5cf7('0x68')](_0x5cf7('0x59'));if(_0x22bfaf[_0x4ea1b4]||!_0x334db1[_0x5cf7('0x6f')]){_0x12bf5b=path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x402bfa,_[_0x5cf7('0x64')](_0x5cf7('0x70')));}if(!fs[_0x5cf7('0x62')](_0x12bf5b)){throw new db[(_0x5cf7('0x69'))][(_0x5cf7('0x6a'))](_[_0x5cf7('0x68')](_0x5cf7('0x59'))+_0x5cf7('0x6b'));}return _0x326fb2[_0x5cf7('0x6c')](_0x12bf5b);}})[_0x5cf7('0x27')](handleError(_0x326fb2,null));};exports[_0x5cf7('0x71')]=function(_0x19652f,_0x56034e){return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x19652f[_0x5cf7('0x54')]['id']},'attributes':['securePassword']})[_0x5cf7('0x1c')](respondWithResult(_0x56034e,null))['catch'](handleError(_0x56034e,null));};exports[_0x5cf7('0x72')]=function(_0x3d349c,_0x126022,_0x17e4ec){if(_0x3d349c['file']&&_0x3d349c[_0x5cf7('0x55')]['filename']){_0x3d349c[_0x5cf7('0x53')]['preferred']=_0x3d349c[_0x5cf7('0x55')][_0x5cf7('0x56')];}return db['Setting'][_0x5cf7('0x52')]({'where':{'id':_0x3d349c['params']['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x126022,null))['then'](saveUpdates(_0x3d349c[_0x5cf7('0x53')],null))[_0x5cf7('0x1c')](respondWithResult(_0x126022,null))[_0x5cf7('0x27')](handleError(_0x126022,null));};var utilLicense=require(_0x5cf7('0x16'));exports[_0x5cf7('0x73')]=function(_0x27fa07,_0x2e0f5f,_0x16ee80){var _0x664197=_0x5cf7('0x5b');var _0x254933={'custom':![]};return utilLicense[_0x5cf7('0x5c')]()[_0x5cf7('0x1c')](function(_0x2dde5f){if(_0x2dde5f){_0x254933=_0x2dde5f;}return db[_0x5cf7('0x36')]['find']({'where':{'id':_0x27fa07[_0x5cf7('0x54')]['id']},'attributes':[_0x5cf7('0x57'),_0x5cf7('0x59'),_0x5cf7('0x6e'),_0x5cf7('0x5d'),_0x5cf7('0x5e'),_0x5cf7('0x5f'),_0x5cf7('0x60'),_0x5cf7('0x61')],'raw':!![]});})[_0x5cf7('0x1c')](handleEntityNotFound(_0x2e0f5f,null))[_0x5cf7('0x1c')](function(_0x4a0285){if(_0x4a0285){var _0x52621b=_0x4a0285[_0x5cf7('0x6e')]&&fs[_0x5cf7('0x62')](path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x664197,_[_0x5cf7('0x64')](_0x4a0285[_0x5cf7('0x6e')])))?path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x664197,_[_0x5cf7('0x64')](_0x4a0285['preferred'])):path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x664197,_['toLower'](_0x5cf7('0x74')));var _0x43967e=_0x5cf7('0x67')+_[_0x5cf7('0x68')](_0x5cf7('0x6e'));if(_0x4a0285[_0x43967e]||!_0x254933['custom']||!_0x254933[_0x5cf7('0x6e')]){_0x52621b=path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x664197,_['toLower']('default_preferred.png'));}if(!fs[_0x5cf7('0x62')](_0x52621b)){throw new db[(_0x5cf7('0x69'))]['ValidationError'](_[_0x5cf7('0x68')](_0x5cf7('0x6e'))+_0x5cf7('0x6b'));}return _0x2e0f5f['download'](_0x52621b);}})['catch'](handleError(_0x2e0f5f,null));};exports[_0x5cf7('0x75')]=function(_0x3c851c,_0x158466,_0xca987){if(_0x3c851c[_0x5cf7('0x55')]&&_0x3c851c[_0x5cf7('0x55')][_0x5cf7('0x56')]){_0x3c851c[_0x5cf7('0x53')]['favicon']=_0x3c851c[_0x5cf7('0x55')][_0x5cf7('0x56')];}return db[_0x5cf7('0x36')]['find']({'where':{'id':_0x3c851c[_0x5cf7('0x54')]['id']}})[_0x5cf7('0x1c')](handleEntityNotFound(_0x158466,null))[_0x5cf7('0x1c')](saveUpdates(_0x3c851c[_0x5cf7('0x53')],null))[_0x5cf7('0x1c')](respondWithResult(_0x158466,null))[_0x5cf7('0x27')](handleError(_0x158466,null));};var utilLicense=require('../../config/license/util');exports[_0x5cf7('0x76')]=function(_0x1bedd8,_0x2661b1,_0xca978b){var _0x42bc96=_0x5cf7('0x5b');var _0x130f6e={'custom':![]};return utilLicense[_0x5cf7('0x5c')]()[_0x5cf7('0x1c')](function(_0x251551){if(_0x251551){_0x130f6e=_0x251551;}return db[_0x5cf7('0x36')][_0x5cf7('0x52')]({'where':{'id':_0x1bedd8[_0x5cf7('0x54')]['id']},'attributes':['logo','loginLogo',_0x5cf7('0x6e'),_0x5cf7('0x5d'),_0x5cf7('0x5e'),_0x5cf7('0x5f'),'defaultPreferred',_0x5cf7('0x61')],'raw':!![]});})[_0x5cf7('0x1c')](handleEntityNotFound(_0x2661b1,null))[_0x5cf7('0x1c')](function(_0x2914ce){if(_0x2914ce){var _0x1af9be=_0x2914ce[_0x5cf7('0x5d')]&&fs['existsSync'](path['join'](config[_0x5cf7('0x65')],_0x42bc96,_[_0x5cf7('0x64')](_0x2914ce[_0x5cf7('0x5d')])))?path['join'](config[_0x5cf7('0x65')],_0x42bc96,_[_0x5cf7('0x64')](_0x2914ce[_0x5cf7('0x5d')])):path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x42bc96,_[_0x5cf7('0x64')](_0x5cf7('0x77')));var _0x5c7b0e=_0x5cf7('0x67')+_[_0x5cf7('0x68')](_0x5cf7('0x5d'));if(_0x2914ce[_0x5c7b0e]||!_0x130f6e['custom']){_0x1af9be=path[_0x5cf7('0x63')](config[_0x5cf7('0x65')],_0x42bc96,_[_0x5cf7('0x64')](_0x5cf7('0x77')));}if(!fs[_0x5cf7('0x62')](_0x1af9be)){throw new db['Sequelize'][(_0x5cf7('0x6a'))](_['upperFirst'](_0x5cf7('0x5d'))+_0x5cf7('0x6b'));}return _0x2661b1[_0x5cf7('0x6c')](_0x1af9be);}})[_0x5cf7('0x27')](handleError(_0x2661b1,null));};exports[_0x5cf7('0x78')]=function(_0x302495,_0x51db37){var _0x4d1597={'offset':moment()[_0x5cf7('0x79')]()};_0x4d1597[_0x5cf7('0x7a')]=moment()[_0x5cf7('0x79')](_0x4d1597[_0x5cf7('0x2c')])[_0x5cf7('0x7b')](_0x5cf7('0x7c'));return _0x51db37[_0x5cf7('0x29')](0xc8)[_0x5cf7('0x33')](_0x4d1597);}; \ No newline at end of file +var _0xe559=['moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','body','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','logo','root','toLower','join','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','defaultPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x421c5a,_0x424e8d){var _0x598255=function(_0x2c701b){while(--_0x2c701b){_0x421c5a['push'](_0x421c5a['shift']());}};_0x598255(++_0x424e8d);}(_0xe559,0x176));var _0x9e55=function(_0x3862d7,_0x46805e){_0x3862d7=_0x3862d7-0x0;var _0x4dc13f=_0xe559[_0x3862d7];return _0x4dc13f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e55('0x0'));var zipdir=require(_0x9e55('0x1'));var jsonpatch=require(_0x9e55('0x2'));var rp=require(_0x9e55('0x3'));var moment=require(_0x9e55('0x4'));var BPromise=require(_0x9e55('0x5'));var Mustache=require('mustache');var util=require(_0x9e55('0x6'));var path=require(_0x9e55('0x7'));var sox=require(_0x9e55('0x8'));var csv=require('to-csv');var ejs=require(_0x9e55('0x9'));var fs=require('fs');var fs_extra=require(_0x9e55('0xa'));var _=require(_0x9e55('0xb'));var squel=require(_0x9e55('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e55('0xd'));var toCsv=require(_0x9e55('0xe'));var querystring=require('querystring');var Papa=require(_0x9e55('0xf'));var Redis=require(_0x9e55('0x10'));var authService=require(_0x9e55('0x11'));var qs=require(_0x9e55('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e55('0x13'));var logger=require(_0x9e55('0x14'))(_0x9e55('0x15'));var utils=require('../../config/utils');var config=require(_0x9e55('0x16'));var licenseUtil=require(_0x9e55('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9e55('0x18'));var client=jayson[_0x9e55('0x19')][_0x9e55('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3126fc,_0x506181,_0x47a442,_0x371720){return new BPromise(function(_0x4d84e1,_0x1b6a3a){var _0x5dcbe4=_0x371720||client;return _0x5dcbe4[_0x9e55('0x1b')](_0x3126fc,_0x47a442)[_0x9e55('0x1c')](function(_0x2de722){logger[_0x9e55('0x1d')](_0x9e55('0x1e'),_0x506181,_0x9e55('0x1f'));logger[_0x9e55('0x20')](_0x9e55('0x21'),_0x506181,_0x9e55('0x1f'),JSON['stringify'](_0x2de722));if(_0x2de722[_0x9e55('0x22')]){if(_0x2de722[_0x9e55('0x22')]['code']===0x1f4){logger[_0x9e55('0x22')]('Setting,\x20%s,\x20%s',_0x506181,_0x2de722[_0x9e55('0x22')][_0x9e55('0x23')]);return _0x1b6a3a(_0x2de722['error'][_0x9e55('0x23')]);}logger[_0x9e55('0x22')]('Setting,\x20%s,\x20%s',_0x506181,_0x2de722[_0x9e55('0x22')][_0x9e55('0x23')]);return _0x4d84e1(_0x2de722[_0x9e55('0x22')][_0x9e55('0x23')]);}else{logger[_0x9e55('0x1d')](_0x9e55('0x1e'),_0x506181,_0x9e55('0x1f'));_0x4d84e1(_0x2de722[_0x9e55('0x24')][_0x9e55('0x23')]);}})[_0x9e55('0x25')](function(_0x1839b5){logger[_0x9e55('0x22')]('Setting,\x20%s,\x20%s',_0x506181,_0x1839b5);_0x1b6a3a(_0x1839b5);});});}function respondWithStatusCode(_0x44de13,_0x5aba8e){_0x5aba8e=_0x5aba8e||0xcc;return function(_0x1420b2){if(_0x1420b2){return _0x44de13['sendStatus'](_0x5aba8e);}return _0x44de13[_0x9e55('0x26')](_0x5aba8e)[_0x9e55('0x27')]();};}function respondWithResult(_0x203d36,_0x173d27){_0x173d27=_0x173d27||0xc8;return function(_0xfb6415){if(_0xfb6415){return _0x203d36[_0x9e55('0x26')](_0x173d27)[_0x9e55('0x28')](_0xfb6415);}};}function respondWithFilteredResult(_0x31fbdf,_0x14ea8d){return function(_0xce28cd){if(_0xce28cd){var _0x12c19f=typeof _0x14ea8d[_0x9e55('0x29')]===_0x9e55('0x2a')&&typeof _0x14ea8d[_0x9e55('0x2b')]===_0x9e55('0x2a');var _0x14170b=_0xce28cd[_0x9e55('0x2c')];var _0x1451fc=_0x12c19f?0x0:_0x14ea8d['offset'];var _0x1e5b32=_0x12c19f?_0xce28cd[_0x9e55('0x2c')]:_0x14ea8d[_0x9e55('0x29')]+_0x14ea8d[_0x9e55('0x2b')];var _0x205062;if(_0x1e5b32>=_0x14170b){_0x1e5b32=_0x14170b;_0x205062=0xc8;}else{_0x205062=0xce;}_0x31fbdf[_0x9e55('0x26')](_0x205062);return _0x31fbdf[_0x9e55('0x2d')](_0x9e55('0x2e'),_0x1451fc+'-'+_0x1e5b32+'/'+_0x14170b)[_0x9e55('0x28')](_0xce28cd);}return null;};}function patchUpdates(_0x2b2691){return function(_0x177e8c){try{jsonpatch[_0x9e55('0x2f')](_0x177e8c,_0x2b2691,!![]);}catch(_0x24914f){return BPromise[_0x9e55('0x30')](_0x24914f);}return _0x177e8c[_0x9e55('0x31')]();};}function saveUpdates(_0x285f57,_0x1ca93a){return function(_0x59c7fb){if(_0x59c7fb){return _0x59c7fb[_0x9e55('0x32')](_0x285f57)[_0x9e55('0x1c')](function(_0x1cdb7d){return _0x1cdb7d;});}return null;};}function removeEntity(_0x4cca9b,_0x54b7cd){return function(_0x142224){if(_0x142224){return _0x142224[_0x9e55('0x33')]()[_0x9e55('0x1c')](function(){_0x4cca9b[_0x9e55('0x26')](0xcc)[_0x9e55('0x27')]();});}};}function handleEntityNotFound(_0x4a8106,_0x598b34){return function(_0x56ccc5){if(!_0x56ccc5){_0x4a8106[_0x9e55('0x34')](0x194);}return _0x56ccc5;};}function handleError(_0x1edf89,_0x2087bb){_0x2087bb=_0x2087bb||0x1f4;return function(_0x2fc702){logger[_0x9e55('0x22')](_0x2fc702[_0x9e55('0x35')]);if(_0x2fc702['name']){delete _0x2fc702[_0x9e55('0x36')];}_0x1edf89[_0x9e55('0x26')](_0x2087bb)[_0x9e55('0x37')](_0x2fc702);};}exports[_0x9e55('0x38')]=function(_0x3bad81,_0x29a9e1){var _0x20ec94={},_0x136fc2={},_0x587c07={'count':0x0,'rows':[]};var _0x404b64=_[_0x9e55('0x39')](db[_0x9e55('0x3a')][_0x9e55('0x3b')],function(_0x55143d){return{'name':_0x55143d[_0x9e55('0x3c')],'type':_0x55143d[_0x9e55('0x3d')][_0x9e55('0x3e')]};});_0x136fc2[_0x9e55('0x3f')]=_[_0x9e55('0x39')](_0x404b64,'name');_0x136fc2['query']=_[_0x9e55('0x40')](_0x3bad81[_0x9e55('0x41')]);_0x136fc2[_0x9e55('0x42')]=_[_0x9e55('0x43')](_0x136fc2['model'],_0x136fc2[_0x9e55('0x41')]);_0x20ec94['attributes']=_[_0x9e55('0x43')](_0x136fc2[_0x9e55('0x3f')],qs[_0x9e55('0x44')](_0x3bad81[_0x9e55('0x41')][_0x9e55('0x44')]));_0x20ec94[_0x9e55('0x45')]=_0x20ec94[_0x9e55('0x45')]['length']?_0x20ec94[_0x9e55('0x45')]:_0x136fc2[_0x9e55('0x3f')];if(!_0x3bad81[_0x9e55('0x41')][_0x9e55('0x46')]('nolimit')){_0x20ec94[_0x9e55('0x2b')]=qs['limit'](_0x3bad81[_0x9e55('0x41')][_0x9e55('0x2b')]);_0x20ec94[_0x9e55('0x29')]=qs['offset'](_0x3bad81[_0x9e55('0x41')][_0x9e55('0x29')]);}_0x20ec94[_0x9e55('0x47')]=qs[_0x9e55('0x48')](_0x3bad81['query']['sort']);_0x20ec94[_0x9e55('0x49')]=qs['filters'](_[_0x9e55('0x4a')](_0x3bad81[_0x9e55('0x41')],_0x136fc2[_0x9e55('0x42')]),_0x404b64);if(_0x3bad81[_0x9e55('0x41')][_0x9e55('0x4b')]){_0x20ec94[_0x9e55('0x49')]=_['merge'](_0x20ec94[_0x9e55('0x49')],{'$or':_[_0x9e55('0x39')](_0x404b64,function(_0x38fcef){if(_0x38fcef[_0x9e55('0x3d')]!==_0x9e55('0x4c')){var _0xa2437={};_0xa2437[_0x38fcef['name']]={'$like':'%'+_0x3bad81[_0x9e55('0x41')][_0x9e55('0x4b')]+'%'};return _0xa2437;}})});}_0x20ec94=_[_0x9e55('0x4d')]({},_0x20ec94,_0x3bad81[_0x9e55('0x4e')]);var _0x4d3cc7={'where':_0x20ec94[_0x9e55('0x49')]};return db[_0x9e55('0x3a')][_0x9e55('0x2c')](_0x4d3cc7)['then'](function(_0x14c858){_0x587c07[_0x9e55('0x2c')]=_0x14c858;if(_0x3bad81[_0x9e55('0x41')][_0x9e55('0x4f')]){_0x20ec94[_0x9e55('0x50')]=[{'all':!![]}];}return db[_0x9e55('0x3a')][_0x9e55('0x51')](_0x20ec94);})[_0x9e55('0x1c')](function(_0x5bff75){_0x587c07[_0x9e55('0x52')]=_0x5bff75;return _0x587c07;})[_0x9e55('0x1c')](respondWithFilteredResult(_0x29a9e1,_0x20ec94))[_0x9e55('0x25')](handleError(_0x29a9e1,null));};exports[_0x9e55('0x53')]=function(_0x356111,_0x4ad3f8){var _0x9e9e5b={'raw':![],'where':{'id':_0x356111[_0x9e55('0x54')]['id']}},_0x110a28={};_0x110a28['model']=_['keys'](db[_0x9e55('0x3a')][_0x9e55('0x3b')]);_0x110a28[_0x9e55('0x41')]=_[_0x9e55('0x40')](_0x356111[_0x9e55('0x41')]);_0x110a28[_0x9e55('0x42')]=_[_0x9e55('0x43')](_0x110a28[_0x9e55('0x3f')],_0x110a28['query']);_0x9e9e5b[_0x9e55('0x45')]=_[_0x9e55('0x43')](_0x110a28[_0x9e55('0x3f')],qs['fields'](_0x356111[_0x9e55('0x41')][_0x9e55('0x44')]));_0x9e9e5b[_0x9e55('0x45')]=_0x9e9e5b[_0x9e55('0x45')][_0x9e55('0x55')]?_0x9e9e5b[_0x9e55('0x45')]:_0x110a28[_0x9e55('0x3f')];if(_0x356111[_0x9e55('0x41')][_0x9e55('0x4f')]){_0x9e9e5b[_0x9e55('0x50')]=[{'all':!![]}];}_0x9e9e5b=_[_0x9e55('0x4d')]({},_0x9e9e5b,_0x356111['options']);return db[_0x9e55('0x3a')][_0x9e55('0x56')](_0x9e9e5b)[_0x9e55('0x1c')](handleEntityNotFound(_0x4ad3f8,null))[_0x9e55('0x1c')](respondWithResult(_0x4ad3f8,null))[_0x9e55('0x25')](handleError(_0x4ad3f8,null));};exports[_0x9e55('0x32')]=function(_0x3a9d1c,_0x1e8ff6){if(_0x3a9d1c[_0x9e55('0x57')]['id']){delete _0x3a9d1c[_0x9e55('0x57')]['id'];}return db[_0x9e55('0x3a')][_0x9e55('0x56')]({'where':{'id':_0x3a9d1c['params']['id']}})[_0x9e55('0x1c')](handleEntityNotFound(_0x1e8ff6,null))[_0x9e55('0x1c')](saveUpdates(_0x3a9d1c[_0x9e55('0x57')],null))[_0x9e55('0x1c')](respondWithResult(_0x1e8ff6,null))[_0x9e55('0x25')](handleError(_0x1e8ff6,null));};exports['addLogo']=function(_0x25b58e,_0x17078b,_0x382c72){if(_0x25b58e['file']&&_0x25b58e[_0x9e55('0x58')][_0x9e55('0x59')]){_0x25b58e[_0x9e55('0x57')]['logo']=_0x25b58e[_0x9e55('0x58')][_0x9e55('0x59')];}return db[_0x9e55('0x3a')][_0x9e55('0x56')]({'where':{'id':_0x25b58e[_0x9e55('0x54')]['id']}})['then'](handleEntityNotFound(_0x17078b,null))[_0x9e55('0x1c')](saveUpdates(_0x25b58e['body'],null))[_0x9e55('0x1c')](respondWithResult(_0x17078b,null))[_0x9e55('0x25')](handleError(_0x17078b,null));};exports['addLogoLogin']=function(_0x3001e4,_0x21b14c,_0x37f5d3){if(_0x3001e4['file']&&_0x3001e4['file'][_0x9e55('0x59')]){_0x3001e4[_0x9e55('0x57')][_0x9e55('0x5a')]=_0x3001e4['file'][_0x9e55('0x59')];}return db[_0x9e55('0x3a')][_0x9e55('0x56')]({'where':{'id':_0x3001e4[_0x9e55('0x54')]['id']}})[_0x9e55('0x1c')](handleEntityNotFound(_0x21b14c,null))[_0x9e55('0x1c')](saveUpdates(_0x3001e4[_0x9e55('0x57')],null))[_0x9e55('0x1c')](respondWithResult(_0x21b14c,null))[_0x9e55('0x25')](handleError(_0x21b14c,null));};var utilLicense=require(_0x9e55('0x17'));exports[_0x9e55('0x5b')]=function(_0x248b1,_0x3db455,_0x413c4a){var _0x555b03=_0x9e55('0x5c');var _0x5e2ce6={'custom':![]};return utilLicense[_0x9e55('0x5d')]()[_0x9e55('0x1c')](function(_0x278c1e){if(_0x278c1e){_0x5e2ce6=_0x278c1e;}return db[_0x9e55('0x3a')][_0x9e55('0x56')]({'where':{'id':_0x248b1[_0x9e55('0x54')]['id']},'attributes':['logo',_0x9e55('0x5a'),_0x9e55('0x5e'),_0x9e55('0x5f'),_0x9e55('0x60'),_0x9e55('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x9e55('0x1c')](handleEntityNotFound(_0x3db455,null))['then'](function(_0x410e4c){if(_0x410e4c){var _0x291167=_0x410e4c[_0x9e55('0x62')]&&fs['existsSync'](path['join'](config[_0x9e55('0x63')],_0x555b03,_[_0x9e55('0x64')](_0x410e4c[_0x9e55('0x62')])))?path[_0x9e55('0x65')](config[_0x9e55('0x63')],_0x555b03,_[_0x9e55('0x64')](_0x410e4c[_0x9e55('0x62')])):path[_0x9e55('0x65')](config[_0x9e55('0x63')],_0x555b03,_['toLower'](_0x9e55('0x66')));var _0x2fdc2c=_0x9e55('0x67')+_[_0x9e55('0x68')](_0x9e55('0x62'));if(_0x410e4c[_0x2fdc2c]||!_0x5e2ce6[_0x9e55('0x69')]){_0x291167=path['join'](config[_0x9e55('0x63')],_0x555b03,_[_0x9e55('0x64')](_0x9e55('0x66')));}if(!fs[_0x9e55('0x6a')](_0x291167)){throw new db[(_0x9e55('0x6b'))][(_0x9e55('0x6c'))](_[_0x9e55('0x68')]('logo')+_0x9e55('0x6d'));}return _0x3db455[_0x9e55('0x6e')](_0x291167);}})[_0x9e55('0x25')](handleError(_0x3db455,null));};var utilLicense=require(_0x9e55('0x17'));exports[_0x9e55('0x6f')]=function(_0x37ce14,_0x33e90f,_0x2863c7){var _0x3929f9=_0x9e55('0x5c');var _0x4b8ec0={'custom':![]};return utilLicense[_0x9e55('0x5d')]()[_0x9e55('0x1c')](function(_0x32ce93){if(_0x32ce93){_0x4b8ec0=_0x32ce93;}return db['Setting'][_0x9e55('0x56')]({'where':{'id':_0x37ce14[_0x9e55('0x54')]['id']},'attributes':['logo',_0x9e55('0x5a'),_0x9e55('0x5e'),_0x9e55('0x5f'),_0x9e55('0x60'),_0x9e55('0x61'),'defaultPreferred',_0x9e55('0x70')],'raw':!![]});})['then'](handleEntityNotFound(_0x33e90f,null))['then'](function(_0x5e0f19){if(_0x5e0f19){var _0x213391=_0x5e0f19[_0x9e55('0x5a')]&&fs[_0x9e55('0x6a')](path[_0x9e55('0x65')](config[_0x9e55('0x63')],_0x3929f9,_[_0x9e55('0x64')](_0x5e0f19[_0x9e55('0x5a')])))?path['join'](config[_0x9e55('0x63')],_0x3929f9,_[_0x9e55('0x64')](_0x5e0f19['loginLogo'])):path['join'](config[_0x9e55('0x63')],_0x3929f9,_[_0x9e55('0x64')](_0x9e55('0x71')));var _0x21f141=_0x9e55('0x67')+_[_0x9e55('0x68')](_0x9e55('0x5a'));if(_0x5e0f19[_0x21f141]||!_0x4b8ec0[_0x9e55('0x69')]){_0x213391=path['join'](config[_0x9e55('0x63')],_0x3929f9,_[_0x9e55('0x64')](_0x9e55('0x71')));}if(!fs['existsSync'](_0x213391)){throw new db['Sequelize'][(_0x9e55('0x6c'))](_[_0x9e55('0x68')](_0x9e55('0x5a'))+_0x9e55('0x6d'));}return _0x33e90f[_0x9e55('0x6e')](_0x213391);}})['catch'](handleError(_0x33e90f,null));};exports[_0x9e55('0x72')]=function(_0x48c77c,_0xf170d6){return db['Setting'][_0x9e55('0x56')]({'where':{'id':_0x48c77c[_0x9e55('0x54')]['id']},'attributes':[_0x9e55('0x73')]})[_0x9e55('0x1c')](respondWithResult(_0xf170d6,null))[_0x9e55('0x25')](handleError(_0xf170d6,null));};exports[_0x9e55('0x74')]=function(_0x43a492,_0x37e4cb,_0x34487e){if(_0x43a492[_0x9e55('0x58')]&&_0x43a492[_0x9e55('0x58')][_0x9e55('0x59')]){_0x43a492[_0x9e55('0x57')]['preferred']=_0x43a492[_0x9e55('0x58')][_0x9e55('0x59')];}return db[_0x9e55('0x3a')]['find']({'where':{'id':_0x43a492[_0x9e55('0x54')]['id']}})[_0x9e55('0x1c')](handleEntityNotFound(_0x37e4cb,null))[_0x9e55('0x1c')](saveUpdates(_0x43a492['body'],null))[_0x9e55('0x1c')](respondWithResult(_0x37e4cb,null))[_0x9e55('0x25')](handleError(_0x37e4cb,null));};var utilLicense=require(_0x9e55('0x17'));exports[_0x9e55('0x75')]=function(_0x1b2072,_0x26ed7e,_0x4b2b57){var _0x15d199=_0x9e55('0x5c');var _0x9e43de={'custom':![]};return utilLicense[_0x9e55('0x5d')]()[_0x9e55('0x1c')](function(_0x92704e){if(_0x92704e){_0x9e43de=_0x92704e;}return db[_0x9e55('0x3a')][_0x9e55('0x56')]({'where':{'id':_0x1b2072[_0x9e55('0x54')]['id']},'attributes':[_0x9e55('0x62'),_0x9e55('0x5a'),'preferred',_0x9e55('0x5f'),_0x9e55('0x60'),_0x9e55('0x61'),_0x9e55('0x76'),_0x9e55('0x70')],'raw':!![]});})[_0x9e55('0x1c')](handleEntityNotFound(_0x26ed7e,null))['then'](function(_0x298437){if(_0x298437){var _0x572f01=_0x298437['preferred']&&fs[_0x9e55('0x6a')](path[_0x9e55('0x65')](config[_0x9e55('0x63')],_0x15d199,_['toLower'](_0x298437[_0x9e55('0x5e')])))?path[_0x9e55('0x65')](config['root'],_0x15d199,_[_0x9e55('0x64')](_0x298437[_0x9e55('0x5e')])):path[_0x9e55('0x65')](config['root'],_0x15d199,_['toLower'](_0x9e55('0x77')));var _0x56857c='default'+_['upperFirst'](_0x9e55('0x5e'));if(_0x298437[_0x56857c]||!_0x9e43de[_0x9e55('0x69')]||!_0x9e43de[_0x9e55('0x5e')]){_0x572f01=path[_0x9e55('0x65')](config[_0x9e55('0x63')],_0x15d199,_[_0x9e55('0x64')]('default_preferred.png'));}if(!fs[_0x9e55('0x6a')](_0x572f01)){throw new db[(_0x9e55('0x6b'))][(_0x9e55('0x6c'))](_[_0x9e55('0x68')](_0x9e55('0x5e'))+_0x9e55('0x6d'));}return _0x26ed7e[_0x9e55('0x6e')](_0x572f01);}})[_0x9e55('0x25')](handleError(_0x26ed7e,null));};exports['addFavicon']=function(_0x145b18,_0x414162,_0x3dd010){if(_0x145b18['file']&&_0x145b18[_0x9e55('0x58')]['filename']){_0x145b18[_0x9e55('0x57')][_0x9e55('0x5f')]=_0x145b18[_0x9e55('0x58')]['filename'];}return db[_0x9e55('0x3a')]['find']({'where':{'id':_0x145b18[_0x9e55('0x54')]['id']}})[_0x9e55('0x1c')](handleEntityNotFound(_0x414162,null))['then'](saveUpdates(_0x145b18['body'],null))[_0x9e55('0x1c')](respondWithResult(_0x414162,null))[_0x9e55('0x25')](handleError(_0x414162,null));};var utilLicense=require(_0x9e55('0x17'));exports[_0x9e55('0x78')]=function(_0x567991,_0x2872f2,_0xe4f807){var _0x47665f=_0x9e55('0x5c');var _0xaa7485={'custom':![]};return utilLicense[_0x9e55('0x5d')]()[_0x9e55('0x1c')](function(_0xcb104a){if(_0xcb104a){_0xaa7485=_0xcb104a;}return db[_0x9e55('0x3a')][_0x9e55('0x56')]({'where':{'id':_0x567991[_0x9e55('0x54')]['id']},'attributes':['logo',_0x9e55('0x5a'),_0x9e55('0x5e'),_0x9e55('0x5f'),_0x9e55('0x60'),_0x9e55('0x61'),_0x9e55('0x76'),_0x9e55('0x70')],'raw':!![]});})[_0x9e55('0x1c')](handleEntityNotFound(_0x2872f2,null))[_0x9e55('0x1c')](function(_0x1876e9){if(_0x1876e9){var _0x15fe23=_0x1876e9[_0x9e55('0x5f')]&&fs['existsSync'](path[_0x9e55('0x65')](config[_0x9e55('0x63')],_0x47665f,_[_0x9e55('0x64')](_0x1876e9[_0x9e55('0x5f')])))?path['join'](config[_0x9e55('0x63')],_0x47665f,_['toLower'](_0x1876e9[_0x9e55('0x5f')])):path[_0x9e55('0x65')](config['root'],_0x47665f,_['toLower'](_0x9e55('0x79')));var _0x34cdee=_0x9e55('0x67')+_['upperFirst'](_0x9e55('0x5f'));if(_0x1876e9[_0x34cdee]||!_0xaa7485[_0x9e55('0x69')]){_0x15fe23=path[_0x9e55('0x65')](config['root'],_0x47665f,_[_0x9e55('0x64')](_0x9e55('0x79')));}if(!fs[_0x9e55('0x6a')](_0x15fe23)){throw new db[(_0x9e55('0x6b'))][(_0x9e55('0x6c'))](_[_0x9e55('0x68')](_0x9e55('0x5f'))+_0x9e55('0x6d'));}return _0x2872f2[_0x9e55('0x6e')](_0x15fe23);}})[_0x9e55('0x25')](handleError(_0x2872f2,null));};exports[_0x9e55('0x7a')]=function(_0x211cda,_0x5aa6b5){var _0x1e1508={'offset':moment()['utcOffset']()};_0x1e1508['now']=moment()[_0x9e55('0x7b')](_0x1e1508[_0x9e55('0x29')])[_0x9e55('0x7c')](_0x9e55('0x7d'));return _0x5aa6b5['status'](0xc8)[_0x9e55('0x37')](_0x1e1508);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6b822b7..1e7cf24 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x1018b6,_0x36df64){var _0x4ef97e=function(_0x2d624b){while(--_0x2d624b){_0x1018b6['push'](_0x1018b6['shift']());}};_0x4ef97e(++_0x36df64);}(_0x34e8,0x12c));var _0x834e=function(_0x527e56,_0x54a240){_0x527e56=_0x527e56-0x0;var _0x319aa6=_0x34e8[_0x527e56];return _0x319aa6;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x55ca,0x126));var _0xa55c=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x55ca[_0x365e54];return _0x13317a;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 001a654..353cc52 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 _0x9277=['error','code','message','catch','ShowSetting','Setting','options','where','attributes','map','include','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xe19fdd,_0x147735){var _0x1cc94b=function(_0x5ade99){while(--_0x5ade99){_0xe19fdd['push'](_0xe19fdd['shift']());}};_0x1cc94b(++_0x147735);}(_0x9277,0x111));var _0x7927=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x9277[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0x7927('0x0'));var util=require(_0x7927('0x1'));var moment=require(_0x7927('0x2'));var BPromise=require('bluebird');var rs=require(_0x7927('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7927('0x4'))['db'];var utils=require(_0x7927('0x5'));var logger=require('../../config/logger')(_0x7927('0x6'));var config=require(_0x7927('0x7'));var jayson=require(_0x7927('0x8'));var client=jayson['client'][_0x7927('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432b73,_0x5df478,_0x2bbfaa){return new BPromise(function(_0x4a8277,_0xeec2eb){return client[_0x7927('0xa')](_0x432b73,_0x2bbfaa)[_0x7927('0xb')](function(_0x3d8e4f){logger[_0x7927('0xc')](_0x7927('0xd'),_0x5df478,_0x7927('0xe'));logger[_0x7927('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x5df478,_0x7927('0xe'),JSON[_0x7927('0x10')](_0x3d8e4f));if(_0x3d8e4f[_0x7927('0x11')]){if(_0x3d8e4f[_0x7927('0x11')][_0x7927('0x12')]===0x1f4){logger[_0x7927('0x11')]('Setting,\x20%s,\x20%s',_0x5df478,_0x3d8e4f[_0x7927('0x11')][_0x7927('0x13')]);return _0xeec2eb(_0x3d8e4f[_0x7927('0x11')][_0x7927('0x13')]);}logger[_0x7927('0x11')](_0x7927('0xd'),_0x5df478,_0x3d8e4f['error'][_0x7927('0x13')]);return _0x4a8277(_0x3d8e4f[_0x7927('0x11')]['message']);}else{logger['info'](_0x7927('0xd'),_0x5df478,_0x7927('0xe'));_0x4a8277(_0x3d8e4f['result'][_0x7927('0x13')]);}})[_0x7927('0x14')](function(_0x271234){logger[_0x7927('0x11')]('Setting,\x20%s,\x20%s',_0x5df478,_0x271234);_0xeec2eb(_0x271234);});});}exports[_0x7927('0x15')]=function(_0x823df1){var _0x5eafb3=this;return new Promise(function(_0x1ad138,_0x34ec10){return db[_0x7927('0x16')]['find']({'raw':_0x823df1[_0x7927('0x17')]?_0x823df1[_0x7927('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x823df1[_0x7927('0x17')]?_0x823df1[_0x7927('0x17')][_0x7927('0x18')]||null:null,'attributes':_0x823df1['options']?_0x823df1['options'][_0x7927('0x19')]||null:null,'include':_0x823df1['options']?_0x823df1[_0x7927('0x17')]['include']?_[_0x7927('0x1a')](_0x823df1[_0x7927('0x17')][_0x7927('0x1b')],function(_0x5b4a3b){return{'model':db[_0x5b4a3b[_0x7927('0x1c')]],'as':_0x5b4a3b['as'],'attributes':_0x5b4a3b[_0x7927('0x19')],'include':_0x5b4a3b[_0x7927('0x1b')]?_[_0x7927('0x1a')](_0x5b4a3b[_0x7927('0x1b')],function(_0x173ae2){return{'model':db[_0x173ae2['model']],'as':_0x173ae2['as'],'attributes':_0x173ae2[_0x7927('0x19')],'include':_0x173ae2[_0x7927('0x1b')]?_['map'](_0x173ae2['include'],function(_0xcf2cf3){return{'model':db[_0xcf2cf3[_0x7927('0x1c')]],'as':_0xcf2cf3['as'],'attributes':_0xcf2cf3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x182c1a){logger[_0x7927('0xc')](_0x7927('0x15'),_0x823df1);logger[_0x7927('0xf')](_0x7927('0x15'),_0x823df1,JSON[_0x7927('0x10')](_0x182c1a));_0x1ad138(_0x182c1a);})[_0x7927('0x14')](function(_0x36e0fd){logger[_0x7927('0x11')]('ShowSetting',_0x36e0fd[_0x7927('0x13')],_0x823df1);_0x34ec10(_0x5eafb3[_0x7927('0x11')](0x1f4,_0x36e0fd[_0x7927('0x13')]));});});}; \ No newline at end of file +var _0x86e8=['result','catch','ShowSetting','find','options','attributes','include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x377d42,_0x9e888){var _0x3676f2=function(_0x4c0275){while(--_0x4c0275){_0x377d42['push'](_0x377d42['shift']());}};_0x3676f2(++_0x9e888);}(_0x86e8,0x1cc));var _0x886e=function(_0x22aef0,_0x41e442){_0x22aef0=_0x22aef0-0x0;var _0x4de019=_0x86e8[_0x22aef0];return _0x4de019;};'use strict';var _=require(_0x886e('0x0'));var util=require('util');var moment=require(_0x886e('0x1'));var BPromise=require(_0x886e('0x2'));var rs=require(_0x886e('0x3'));var fs=require('fs');var Redis=require(_0x886e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x886e('0x5'));var logger=require(_0x886e('0x6'))('rpc');var config=require(_0x886e('0x7'));var jayson=require(_0x886e('0x8'));var client=jayson[_0x886e('0x9')][_0x886e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dd74d,_0x2ba424,_0x48f03f){return new BPromise(function(_0x552664,_0x33fa97){return client[_0x886e('0xb')](_0x2dd74d,_0x48f03f)['then'](function(_0xecb26b){logger[_0x886e('0xc')](_0x886e('0xd'),_0x2ba424,_0x886e('0xe'));logger[_0x886e('0xf')](_0x886e('0x10'),_0x2ba424,_0x886e('0xe'),JSON[_0x886e('0x11')](_0xecb26b));if(_0xecb26b[_0x886e('0x12')]){if(_0xecb26b[_0x886e('0x12')]['code']===0x1f4){logger[_0x886e('0x12')](_0x886e('0xd'),_0x2ba424,_0xecb26b[_0x886e('0x12')]['message']);return _0x33fa97(_0xecb26b[_0x886e('0x12')][_0x886e('0x13')]);}logger[_0x886e('0x12')](_0x886e('0xd'),_0x2ba424,_0xecb26b['error'][_0x886e('0x13')]);return _0x552664(_0xecb26b[_0x886e('0x12')][_0x886e('0x13')]);}else{logger[_0x886e('0xc')](_0x886e('0xd'),_0x2ba424,_0x886e('0xe'));_0x552664(_0xecb26b[_0x886e('0x14')][_0x886e('0x13')]);}})[_0x886e('0x15')](function(_0x5f5dfa){logger['error'](_0x886e('0xd'),_0x2ba424,_0x5f5dfa);_0x33fa97(_0x5f5dfa);});});}exports[_0x886e('0x16')]=function(_0x159eda){var _0x2ebea2=this;return new Promise(function(_0x32fb35,_0x255492){return db['Setting'][_0x886e('0x17')]({'raw':_0x159eda[_0x886e('0x18')]?_0x159eda[_0x886e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x159eda[_0x886e('0x18')]?_0x159eda['options']['where']||null:null,'attributes':_0x159eda['options']?_0x159eda[_0x886e('0x18')][_0x886e('0x19')]||null:null,'include':_0x159eda[_0x886e('0x18')]?_0x159eda[_0x886e('0x18')][_0x886e('0x1a')]?_[_0x886e('0x1b')](_0x159eda[_0x886e('0x18')][_0x886e('0x1a')],function(_0x594abb){return{'model':db[_0x594abb['model']],'as':_0x594abb['as'],'attributes':_0x594abb[_0x886e('0x19')],'include':_0x594abb['include']?_[_0x886e('0x1b')](_0x594abb[_0x886e('0x1a')],function(_0x57c7e4){return{'model':db[_0x57c7e4[_0x886e('0x1c')]],'as':_0x57c7e4['as'],'attributes':_0x57c7e4[_0x886e('0x19')],'include':_0x57c7e4[_0x886e('0x1a')]?_['map'](_0x57c7e4['include'],function(_0x19ed32){return{'model':db[_0x19ed32[_0x886e('0x1c')]],'as':_0x19ed32['as'],'attributes':_0x19ed32['attributes']};}):[]};}):[]};}):[]:[]})[_0x886e('0x1d')](function(_0x1a55d5){logger[_0x886e('0xc')](_0x886e('0x16'),_0x159eda);logger[_0x886e('0xf')](_0x886e('0x16'),_0x159eda,JSON[_0x886e('0x11')](_0x1a55d5));_0x32fb35(_0x1a55d5);})[_0x886e('0x15')](function(_0x4e4c74){logger[_0x886e('0x12')](_0x886e('0x16'),_0x4e4c74[_0x886e('0x13')],_0x159eda);_0x255492(_0x2ebea2['error'](0x1f4,_0x4e4c74[_0x886e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 74b8068..5050bd6 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x473b41,_0x1c320f){var _0x4e521d=function(_0x19a745){while(--_0x19a745){_0x473b41['push'](_0x473b41['shift']());}};_0x4e521d(++_0x1c320f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x5bcff7,_0x41ea72){var _0x55356b=function(_0x22f929){while(--_0x22f929){_0x5bcff7['push'](_0x5bcff7['shift']());}};_0x55356b(++_0x41ea72);}(_0x7a54,0x106));var _0x47a5=function(_0x230066,_0xd178e3){_0x230066=_0x230066-0x0;var _0x2002b8=_0x7a54[_0x230066];return _0x2002b8;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e71d440..ac6a953 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 _0x6872=['mandatoryDispositionPauseId','setDataValue','sequelize','exports','name','STRING','generate','twilio','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2c0312,_0x2be972){var _0x46222d=function(_0x593c31){while(--_0x593c31){_0x2c0312['push'](_0x2c0312['shift']());}};_0x46222d(++_0x2be972);}(_0x6872,0xaa));var _0x2687=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x6872[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x2687('0x0'));var rs=require('randomstring');module[_0x2687('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2687('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x2687('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2687('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2687('0x3')],'defaultValue':function(){return rs[_0x2687('0x4')]();}},'phone':{'type':Sequelize[_0x2687('0x3')]},'type':{'type':Sequelize['ENUM'](_0x2687('0x5'),'skebby',_0x2687('0x6'),_0x2687('0x7'),_0x2687('0x8'),_0x2687('0x9'),'bandwidth',_0x2687('0xa'),_0x2687('0xb'),_0x2687('0xc'))},'accountSid':{'type':Sequelize[_0x2687('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x2687('0x3')]},'smsMethod':{'type':Sequelize[_0x2687('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2687('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x2687('0x3')]},'applicationId':{'type':Sequelize[_0x2687('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x2687('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x2687('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2687('0xe')],'defaultValue':function(){return _0x2687('0xf');}},'notificationSound':{'type':Sequelize[_0x2687('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2687('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2687('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2687('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2687('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2687('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2687('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2687('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x2687('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x487e72){if(!_0x487e72)this['setDataValue'](_0x2687('0x13'),null);this[_0x2687('0x14')]('mandatoryDisposition',_0x487e72);}}}; \ No newline at end of file +var _0x692e=['randomstring','exports','STRING','name','generate','ENUM','connectel','clickatell','bandwidth','infobip','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','setDataValue','mandatoryDisposition','sequelize'];(function(_0x488bbb,_0x37e11c){var _0xc91bb7=function(_0x4f3b2d){while(--_0x4f3b2d){_0x488bbb['push'](_0x488bbb['shift']());}};_0xc91bb7(++_0x37e11c);}(_0x692e,0x6b));var _0xe692=function(_0x5db81e,_0x33860c){_0x5db81e=_0x5db81e-0x0;var _0x2e6985=_0x692e[_0x5db81e];return _0x2e6985;};'use strict';var Sequelize=require(_0xe692('0x0'));var rs=require(_0xe692('0x1'));module[_0xe692('0x2')]={'name':{'type':Sequelize[_0xe692('0x3')],'unique':_0xe692('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe692('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe692('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe692('0x3')],'defaultValue':function(){return rs[_0xe692('0x5')]();}},'phone':{'type':Sequelize[_0xe692('0x3')]},'type':{'type':Sequelize[_0xe692('0x6')]('twilio','skebby',_0xe692('0x7'),'clicksend','plivo',_0xe692('0x8'),_0xe692('0x9'),'csc',_0xe692('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0xe692('0x3')]},'authId':{'type':Sequelize[_0xe692('0x3')]},'authToken':{'type':Sequelize[_0xe692('0x3')]},'smsMethod':{'type':Sequelize[_0xe692('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe692('0x3')]},'password':{'type':Sequelize[_0xe692('0x3')]},'apiKey':{'type':Sequelize[_0xe692('0x3')]},'applicationId':{'type':Sequelize[_0xe692('0x3')]},'accountId':{'type':Sequelize[_0xe692('0x3')]},'senderString':{'type':Sequelize[_0xe692('0x3')]},'deliveryReport':{'type':Sequelize[_0xe692('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xe692('0x3')]},'notificationTemplate':{'type':Sequelize[_0xe692('0xc')],'defaultValue':function(){return _0xe692('0xd');}},'notificationSound':{'type':Sequelize[_0xe692('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe692('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe692('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe692('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe692('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe692('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe692('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe692('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe692('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe692('0xe')],'comment':_0xe692('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xe692('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x177c4a){if(!_0x177c4a)this[_0xe692('0x10')]('mandatoryDispositionPauseId',null);this[_0xe692('0x10')](_0xe692('0x11'),_0x177c4a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 7d7758b..cc0409c 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 _0x24fa=['model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','SmsAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','queueId','SmsQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','SmsAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type'];(function(_0x2be240,_0x1e119d){var _0x123543=function(_0x580bf4){while(--_0x580bf4){_0x2be240['push'](_0x2be240['shift']());}};_0x123543(++_0x1e119d);}(_0x24fa,0xa8));var _0xa24f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x24fa[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa24f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa24f('0x1'));var rp=require(_0xa24f('0x2'));var moment=require(_0xa24f('0x3'));var BPromise=require(_0xa24f('0x4'));var Mustache=require(_0xa24f('0x5'));var util=require(_0xa24f('0x6'));var path=require('path');var sox=require(_0xa24f('0x7'));var csv=require(_0xa24f('0x8'));var ejs=require(_0xa24f('0x9'));var fs=require('fs');var fs_extra=require(_0xa24f('0xa'));var _=require(_0xa24f('0xb'));var squel=require(_0xa24f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa24f('0xd'));var toCsv=require(_0xa24f('0x8'));var querystring=require(_0xa24f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa24f('0xf'));var authService=require(_0xa24f('0x10'));var qs=require(_0xa24f('0x11'));var as=require(_0xa24f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24f('0x13'))(_0xa24f('0x14'));var utils=require(_0xa24f('0x15'));var config=require(_0xa24f('0x16'));var licenseUtil=require(_0xa24f('0x17'));var db=require(_0xa24f('0x18'))['db'];config[_0xa24f('0x19')]=_[_0xa24f('0x1a')](config[_0xa24f('0x19')],{'host':_0xa24f('0x1b'),'port':0x18eb});var socket=require(_0xa24f('0x1c'))(new Redis(config[_0xa24f('0x19')]));require(_0xa24f('0x1d'))['register'](socket);var jayson=require(_0xa24f('0x1e'));var client=jayson[_0xa24f('0x1f')][_0xa24f('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4280e1,_0x30a311,_0x28a752,_0x4236d5){return new BPromise(function(_0x9bb3b,_0x2a4a7c){var _0x18059d=_0x4236d5||client;return _0x18059d[_0xa24f('0x21')](_0x4280e1,_0x28a752)[_0xa24f('0x22')](function(_0x4ab44c){logger[_0xa24f('0x23')](_0xa24f('0x24'),_0x30a311,'request\x20sent');logger[_0xa24f('0x25')](_0xa24f('0x26'),_0x30a311,_0xa24f('0x27'),JSON['stringify'](_0x4ab44c));if(_0x4ab44c[_0xa24f('0x28')]){if(_0x4ab44c[_0xa24f('0x28')][_0xa24f('0x29')]===0x1f4){logger['error'](_0xa24f('0x24'),_0x30a311,_0x4ab44c[_0xa24f('0x28')]['message']);return _0x2a4a7c(_0x4ab44c['error']['message']);}logger['error'](_0xa24f('0x24'),_0x30a311,_0x4ab44c[_0xa24f('0x28')][_0xa24f('0x2a')]);return _0x9bb3b(_0x4ab44c[_0xa24f('0x28')][_0xa24f('0x2a')]);}else{logger['info'](_0xa24f('0x24'),_0x30a311,'request\x20sent');_0x9bb3b(_0x4ab44c[_0xa24f('0x2b')][_0xa24f('0x2a')]);}})[_0xa24f('0x2c')](function(_0x16fff3){logger[_0xa24f('0x28')]('SmsAccount,\x20%s,\x20%s',_0x30a311,_0x16fff3);_0x2a4a7c(_0x16fff3);});});}function respondWithStatusCode(_0x29e788,_0x53bc7b){_0x53bc7b=_0x53bc7b||0xcc;return function(_0x4485df){if(_0x4485df){return _0x29e788[_0xa24f('0x2d')](_0x53bc7b);}return _0x29e788['status'](_0x53bc7b)[_0xa24f('0x2e')]();};}function respondWithResult(_0x316918,_0x3e152f){_0x3e152f=_0x3e152f||0xc8;return function(_0x470b2c){if(_0x470b2c){return _0x316918[_0xa24f('0x2f')](_0x3e152f)[_0xa24f('0x30')](_0x470b2c);}};}function respondWithFilteredResult(_0x10c6cb,_0x29bea3){return function(_0x2d5e27){if(_0x2d5e27){var _0x5d2aca=typeof _0x29bea3[_0xa24f('0x31')]===_0xa24f('0x32')&&typeof _0x29bea3[_0xa24f('0x33')]==='undefined';var _0x27418a=_0x2d5e27[_0xa24f('0x34')];var _0x4678a1=_0x5d2aca?0x0:_0x29bea3['offset'];var _0x407e50=_0x5d2aca?_0x2d5e27[_0xa24f('0x34')]:_0x29bea3[_0xa24f('0x31')]+_0x29bea3[_0xa24f('0x33')];var _0x1c06d5;if(_0x407e50>=_0x27418a){_0x407e50=_0x27418a;_0x1c06d5=0xc8;}else{_0x1c06d5=0xce;}_0x10c6cb[_0xa24f('0x2f')](_0x1c06d5);return _0x10c6cb[_0xa24f('0x35')](_0xa24f('0x36'),_0x4678a1+'-'+_0x407e50+'/'+_0x27418a)[_0xa24f('0x30')](_0x2d5e27);}return null;};}function patchUpdates(_0x1160e6){return function(_0x585fd9){try{jsonpatch[_0xa24f('0x37')](_0x585fd9,_0x1160e6,!![]);}catch(_0x46627a){return BPromise[_0xa24f('0x38')](_0x46627a);}return _0x585fd9[_0xa24f('0x39')]();};}function saveUpdates(_0x3b3d2b,_0x3f0cd7){return function(_0x10f2a8){if(_0x10f2a8){return _0x10f2a8['update'](_0x3b3d2b)[_0xa24f('0x22')](function(_0x33b49b){return _0x33b49b;});}return null;};}function removeEntity(_0x2c2bae,_0x2120b2){return function(_0x4a6fa5){if(_0x4a6fa5){return _0x4a6fa5['destroy']()[_0xa24f('0x22')](function(){var _0x306883=_0x4a6fa5['get']({'plain':!![]});var _0x1cfc6f=_0xa24f('0x3a');return db['UserProfileResource'][_0xa24f('0x3b')]({'where':{'type':_0x1cfc6f,'resourceId':_0x306883['id']}})['then'](function(){return _0x4a6fa5;});})['then'](function(){_0x2c2bae[_0xa24f('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c1930,_0x578e16){return function(_0xd79940){if(!_0xd79940){_0x4c1930[_0xa24f('0x2d')](0x194);}return _0xd79940;};}function handleError(_0x29e12c,_0x56d19e){_0x56d19e=_0x56d19e||0x1f4;return function(_0x3ae158){logger[_0xa24f('0x28')](_0x3ae158[_0xa24f('0x3c')]);if(_0x3ae158[_0xa24f('0x3d')]){delete _0x3ae158[_0xa24f('0x3d')];}_0x29e12c[_0xa24f('0x2f')](_0x56d19e)[_0xa24f('0x3e')](_0x3ae158);};}exports[_0xa24f('0x3f')]=function(_0xd52d15,_0x41c94f){var _0x1cb84d={'include':[{'model':db[_0xa24f('0x40')],'as':_0xa24f('0x41')}]},_0x52affe={},_0xf7effa={'count':0x0,'rows':[]};var _0x486499=_['map'](db[_0xa24f('0x42')][_0xa24f('0x43')],function(_0x45056f){return{'name':_0x45056f['fieldName'],'type':_0x45056f[_0xa24f('0x44')]['key']};});_0x52affe[_0xa24f('0x45')]=_[_0xa24f('0x46')](_0x486499,_0xa24f('0x3d'));_0x52affe[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0xd52d15[_0xa24f('0x47')]);_0x52affe['filters']=_[_0xa24f('0x49')](_0x52affe[_0xa24f('0x45')],_0x52affe[_0xa24f('0x47')]);_0x1cb84d['attributes']=_['intersection'](_0x52affe['model'],qs[_0xa24f('0x4a')](_0xd52d15[_0xa24f('0x47')][_0xa24f('0x4a')]));_0x1cb84d['attributes']=_0x1cb84d[_0xa24f('0x4b')][_0xa24f('0x4c')]?_0x1cb84d[_0xa24f('0x4b')]:_0x52affe['model'];if(!_0xd52d15[_0xa24f('0x47')][_0xa24f('0x4d')](_0xa24f('0x4e'))){_0x1cb84d[_0xa24f('0x33')]=qs[_0xa24f('0x33')](_0xd52d15['query'][_0xa24f('0x33')]);_0x1cb84d[_0xa24f('0x31')]=qs[_0xa24f('0x31')](_0xd52d15['query'][_0xa24f('0x31')]);}_0x1cb84d[_0xa24f('0x4f')]=qs[_0xa24f('0x50')](_0xd52d15[_0xa24f('0x47')]['sort']);_0x1cb84d[_0xa24f('0x51')]=qs[_0xa24f('0x52')](_[_0xa24f('0x53')](_0xd52d15[_0xa24f('0x47')],_0x52affe[_0xa24f('0x52')]),_0x486499);if(_0xd52d15['query']['filter']){_0x1cb84d['where']=_[_0xa24f('0x54')](_0x1cb84d[_0xa24f('0x51')],{'$or':_[_0xa24f('0x46')](_0x486499,function(_0x822b7a){if(_0x822b7a[_0xa24f('0x44')]!==_0xa24f('0x55')){var _0x3a8001={};_0x3a8001[_0x822b7a[_0xa24f('0x3d')]]={'$like':'%'+_0xd52d15[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x3a8001;}})});}_0x1cb84d=_[_0xa24f('0x54')]({},_0x1cb84d,_0xd52d15[_0xa24f('0x57')]);var _0x514302={'where':_0x1cb84d[_0xa24f('0x51')]};return db['SmsAccount']['count'](_0x514302)[_0xa24f('0x22')](function(_0x5a92da){_0xf7effa['count']=_0x5a92da;if(_0xd52d15[_0xa24f('0x47')][_0xa24f('0x58')]){_0x1cb84d['include']=[{'all':!![]}];}return db[_0xa24f('0x42')][_0xa24f('0x59')](_0x1cb84d);})[_0xa24f('0x22')](function(_0x3fd82e){_0xf7effa[_0xa24f('0x5a')]=_0x3fd82e;return _0xf7effa;})[_0xa24f('0x22')](respondWithFilteredResult(_0x41c94f,_0x1cb84d))[_0xa24f('0x2c')](handleError(_0x41c94f,null));};exports['show']=function(_0x2f85c1,_0x1ee8a4){var _0x3293c7={'raw':![],'where':{'id':_0x2f85c1['params']['id']},'include':[{'model':db[_0xa24f('0x40')],'as':_0xa24f('0x41')}]},_0x3ed18d={};_0x3ed18d[_0xa24f('0x45')]=_[_0xa24f('0x48')](db[_0xa24f('0x42')][_0xa24f('0x43')]);_0x3ed18d[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0x2f85c1[_0xa24f('0x47')]);_0x3ed18d[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x3ed18d[_0xa24f('0x45')],_0x3ed18d[_0xa24f('0x47')]);_0x3293c7[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x3ed18d[_0xa24f('0x45')],qs[_0xa24f('0x4a')](_0x2f85c1[_0xa24f('0x47')][_0xa24f('0x4a')]));_0x3293c7['attributes']=_0x3293c7[_0xa24f('0x4b')][_0xa24f('0x4c')]?_0x3293c7[_0xa24f('0x4b')]:_0x3ed18d['model'];if(_0x2f85c1[_0xa24f('0x47')]['includeAll']){_0x3293c7[_0xa24f('0x5b')]=[{'all':!![]}];}_0x3293c7=_[_0xa24f('0x54')]({},_0x3293c7,_0x2f85c1[_0xa24f('0x57')]);return db[_0xa24f('0x42')]['find'](_0x3293c7)['then'](handleEntityNotFound(_0x1ee8a4,null))[_0xa24f('0x22')](respondWithResult(_0x1ee8a4,null))['catch'](handleError(_0x1ee8a4,null));};exports['create']=function(_0x19b520,_0xf25bdd){return db['SmsAccount'][_0xa24f('0x5c')](_0x19b520[_0xa24f('0x5d')],{})[_0xa24f('0x22')](function(_0x50ce3a){var _0x3aba99=_0x19b520['user'][_0xa24f('0x5e')]({'plain':!![]});if(!_0x3aba99)throw new Error(_0xa24f('0x5f'));if(_0x3aba99['role']===_0xa24f('0x60')){var _0x59d974=_0x50ce3a[_0xa24f('0x5e')]({'plain':!![]});var _0x137cbf='SmsAccounts';return db['UserProfileSection'][_0xa24f('0x61')]({'where':{'name':_0x137cbf,'userProfileId':_0x3aba99[_0xa24f('0x62')]},'raw':!![]})[_0xa24f('0x22')](function(_0x3ad097){if(_0x3ad097&&_0x3ad097[_0xa24f('0x63')]===0x0){return db[_0xa24f('0x64')][_0xa24f('0x5c')]({'name':_0x59d974[_0xa24f('0x3d')],'resourceId':_0x59d974['id'],'type':_0x3ad097[_0xa24f('0x3d')],'sectionId':_0x3ad097['id']},{})['then'](function(){return _0x50ce3a;});}else{return _0x50ce3a;}})[_0xa24f('0x2c')](function(_0x23f897){logger[_0xa24f('0x28')](_0xa24f('0x65'),_0x23f897);throw _0x23f897;});}return _0x50ce3a;})['then'](respondWithResult(_0xf25bdd,0xc9))[_0xa24f('0x2c')](handleError(_0xf25bdd,null));};exports[_0xa24f('0x66')]=function(_0x18f94d,_0xabf90b){if(_0x18f94d['body']['id']){delete _0x18f94d[_0xa24f('0x5d')]['id'];}return db['SmsAccount'][_0xa24f('0x61')]({'where':{'id':_0x18f94d[_0xa24f('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0xa24f('0x41')}]})[_0xa24f('0x22')](handleEntityNotFound(_0xabf90b,null))['then'](saveUpdates(_0x18f94d[_0xa24f('0x5d')],null))['then'](respondWithResult(_0xabf90b,null))[_0xa24f('0x2c')](handleError(_0xabf90b,null));};exports[_0xa24f('0x3b')]=function(_0x5cd620,_0x25104d){return db['SmsAccount'][_0xa24f('0x61')]({'where':{'id':_0x5cd620[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x25104d,null))['then'](removeEntity(_0x25104d,null))[_0xa24f('0x2c')](handleError(_0x25104d,null));};exports['describe']=function(_0x2591de,_0x3425ca){return db['SmsAccount'][_0xa24f('0x68')]()['then'](respondWithResult(_0x3425ca,null))['catch'](handleError(_0x3425ca,null));};exports[_0xa24f('0x69')]=function(_0x29ff40,_0x16d94e,_0x361797){if(_0x29ff40[_0xa24f('0x5d')]['id']){delete _0x29ff40[_0xa24f('0x5d')]['id'];}return db[_0xa24f('0x42')]['find']({'where':{'id':_0x29ff40['params']['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x16d94e,null))[_0xa24f('0x22')](function(_0x1f4d9e){if(_0x1f4d9e){_0x29ff40[_0xa24f('0x5d')][_0xa24f('0x6a')]=_0x1f4d9e['id'];return db[_0xa24f('0x6b')][_0xa24f('0x5c')](_0x29ff40[_0xa24f('0x5d')]);}})[_0xa24f('0x22')](respondWithResult(_0x16d94e,null))[_0xa24f('0x2c')](handleError(_0x16d94e,null));};exports['getDispositions']=function(_0x4dcc9c,_0x315acb,_0x3f1855){var _0x9eb6f3={'raw':![],'where':{}};var _0x2c2c1f={};var _0x4ab89b={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa24f('0x6c')]({'where':{'id':_0x4dcc9c[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x315acb,null))[_0xa24f('0x22')](function(_0x354355){if(_0x354355){_0x2c2c1f[_0xa24f('0x45')]=_[_0xa24f('0x48')](db[_0xa24f('0x6b')][_0xa24f('0x43')]);_0x2c2c1f[_0xa24f('0x47')]=_['keys'](_0x4dcc9c[_0xa24f('0x47')]);_0x2c2c1f[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x2c2c1f[_0xa24f('0x45')],_0x2c2c1f[_0xa24f('0x47')]);_0x9eb6f3[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x2c2c1f[_0xa24f('0x45')],qs[_0xa24f('0x4a')](_0x4dcc9c['query'][_0xa24f('0x4a')]));_0x9eb6f3['attributes']=_0x9eb6f3[_0xa24f('0x4b')][_0xa24f('0x4c')]?_0x9eb6f3[_0xa24f('0x4b')]:_0x2c2c1f[_0xa24f('0x45')];if(!_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x4d')]('nolimit')){_0x9eb6f3['limit']=qs[_0xa24f('0x33')](_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x33')]);_0x9eb6f3[_0xa24f('0x31')]=qs[_0xa24f('0x31')](_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x31')]);}_0x9eb6f3[_0xa24f('0x4f')]=qs['sort'](_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x50')]);_0x9eb6f3[_0xa24f('0x51')]=qs['filters'](_[_0xa24f('0x53')](_0x4dcc9c[_0xa24f('0x47')],_0x2c2c1f[_0xa24f('0x52')]));_0x9eb6f3['where'][_0xa24f('0x6a')]=_0x354355['id'];if(_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x56')]){_0x9eb6f3['where']=_[_0xa24f('0x54')](_0x9eb6f3['where'],{'$or':_[_0xa24f('0x46')](_0x9eb6f3['attributes'],function(_0x30daaa){var _0x223e55={};_0x223e55[_0x30daaa]={'$like':'%'+_0x4dcc9c[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x223e55;})});}_0x9eb6f3=_['merge']({},_0x9eb6f3,_0x4dcc9c['options']);return db[_0xa24f('0x6b')]['count']({'where':_0x9eb6f3[_0xa24f('0x51')]})[_0xa24f('0x22')](function(_0x120dcc){_0x4ab89b[_0xa24f('0x34')]=_0x120dcc;if(_0x4dcc9c['query'][_0xa24f('0x58')]){_0x9eb6f3['include']=[{'all':!![]}];}return db['Disposition'][_0xa24f('0x59')](_0x9eb6f3);})[_0xa24f('0x22')](function(_0x25020b){_0x4ab89b['rows']=_0x25020b;return _0x4ab89b;});}})[_0xa24f('0x22')](respondWithFilteredResult(_0x315acb,_0x9eb6f3))[_0xa24f('0x2c')](handleError(_0x315acb,null));};exports[_0xa24f('0x6d')]=function(_0x29ac5e,_0x472ccc,_0xf2e223){return db[_0xa24f('0x42')][_0xa24f('0x61')]({'where':{'id':_0x29ac5e[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x472ccc,null))[_0xa24f('0x22')](function(_0x5aa8a4){if(_0x5aa8a4){return _0x5aa8a4[_0xa24f('0x6d')](_0x29ac5e[_0xa24f('0x47')][_0xa24f('0x6e')]);}})[_0xa24f('0x22')](respondWithStatusCode(_0x472ccc,null))['catch'](handleError(_0x472ccc,null));};exports[_0xa24f('0x6f')]=function(_0x2c1631,_0x3f03f,_0x2b2184){if(_0x2c1631[_0xa24f('0x5d')]['id']){delete _0x2c1631[_0xa24f('0x5d')]['id'];}return db[_0xa24f('0x42')][_0xa24f('0x61')]({'where':{'id':_0x2c1631[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x3f03f,null))['then'](function(_0x3516c3){if(_0x3516c3){_0x2c1631['body']['SmsAccountId']=_0x3516c3['id'];return db[_0xa24f('0x70')]['create'](_0x2c1631[_0xa24f('0x5d')]);}})[_0xa24f('0x22')](respondWithResult(_0x3f03f,null))[_0xa24f('0x2c')](handleError(_0x3f03f,null));};exports[_0xa24f('0x71')]=function(_0x5d3198,_0x122e8e,_0x1b0356){var _0xd55cf6={'raw':![],'where':{}};var _0x54f911={};var _0x22cc85={'count':0x0,'rows':[]};return db[_0xa24f('0x42')]['findOne']({'where':{'id':_0x5d3198[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x122e8e,null))[_0xa24f('0x22')](function(_0x38ffc6){if(_0x38ffc6){_0x54f911[_0xa24f('0x45')]=_['keys'](db[_0xa24f('0x70')]['rawAttributes']);_0x54f911['query']=_['keys'](_0x5d3198['query']);_0x54f911[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x54f911[_0xa24f('0x45')],_0x54f911[_0xa24f('0x47')]);_0xd55cf6[_0xa24f('0x4b')]=_['intersection'](_0x54f911[_0xa24f('0x45')],qs[_0xa24f('0x4a')](_0x5d3198[_0xa24f('0x47')]['fields']));_0xd55cf6[_0xa24f('0x4b')]=_0xd55cf6[_0xa24f('0x4b')][_0xa24f('0x4c')]?_0xd55cf6[_0xa24f('0x4b')]:_0x54f911[_0xa24f('0x45')];if(!_0x5d3198['query'][_0xa24f('0x4d')]('nolimit')){_0xd55cf6['limit']=qs[_0xa24f('0x33')](_0x5d3198['query'][_0xa24f('0x33')]);_0xd55cf6['offset']=qs[_0xa24f('0x31')](_0x5d3198['query']['offset']);}_0xd55cf6[_0xa24f('0x4f')]=qs[_0xa24f('0x50')](_0x5d3198[_0xa24f('0x47')]['sort']);_0xd55cf6['where']=qs['filters'](_[_0xa24f('0x53')](_0x5d3198['query'],_0x54f911[_0xa24f('0x52')]));_0xd55cf6[_0xa24f('0x51')][_0xa24f('0x6a')]=_0x38ffc6['id'];if(_0x5d3198[_0xa24f('0x47')][_0xa24f('0x56')]){_0xd55cf6[_0xa24f('0x51')]=_[_0xa24f('0x54')](_0xd55cf6['where'],{'$or':_[_0xa24f('0x46')](_0xd55cf6['attributes'],function(_0x457bd6){var _0x304fed={};_0x304fed[_0x457bd6]={'$like':'%'+_0x5d3198[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x304fed;})});}_0xd55cf6=_[_0xa24f('0x54')]({},_0xd55cf6,_0x5d3198[_0xa24f('0x57')]);return db['CannedAnswer'][_0xa24f('0x34')]({'where':_0xd55cf6['where']})[_0xa24f('0x22')](function(_0x1669a4){_0x22cc85[_0xa24f('0x34')]=_0x1669a4;if(_0x5d3198[_0xa24f('0x47')][_0xa24f('0x58')]){_0xd55cf6[_0xa24f('0x5b')]=[{'all':!![]}];}return db[_0xa24f('0x70')]['findAll'](_0xd55cf6);})[_0xa24f('0x22')](function(_0x259c8b){_0x22cc85['rows']=_0x259c8b;return _0x22cc85;});}})[_0xa24f('0x22')](respondWithFilteredResult(_0x122e8e,_0xd55cf6))[_0xa24f('0x2c')](handleError(_0x122e8e,null));};exports[_0xa24f('0x72')]=function(_0x49532c,_0x495459,_0x41ebb2){return db[_0xa24f('0x42')]['find']({'where':{'id':_0x49532c['params']['id']}})['then'](handleEntityNotFound(_0x495459,null))[_0xa24f('0x22')](function(_0x2e5965){if(_0x2e5965){return _0x2e5965[_0xa24f('0x72')](_0x49532c[_0xa24f('0x47')][_0xa24f('0x6e')]);}})[_0xa24f('0x22')](respondWithStatusCode(_0x495459,null))[_0xa24f('0x2c')](handleError(_0x495459,null));};exports[_0xa24f('0x73')]=function(_0x1be0ad,_0x1ddc8a,_0x4131db){var _0x1fdbd1={'channel':_0xa24f('0x74')};var _0x387a2a=[];var _0x44a597=[];var _0x4e7a45={};return db[_0xa24f('0x42')]['find']({'where':{'id':_0x1be0ad[_0xa24f('0x67')]['id']},'include':[{'model':db[_0xa24f('0x75')],'as':'Applications'}]})[_0xa24f('0x22')](handleEntityNotFound(_0x1ddc8a,null))[_0xa24f('0x22')](function(_0x478d70){_0x1fdbd1[_0xa24f('0x76')]=_0x478d70;_0x1fdbd1[_0xa24f('0x77')]=_[_0xa24f('0x78')](_0x478d70[_0xa24f('0x79')],['priority'],['asc']);if(_0x1fdbd1[_0xa24f('0x76')][_0xa24f('0x79')]){delete _0x1fdbd1[_0xa24f('0x76')]['Applications'];}return db['CmContact'][_0xa24f('0x68')]();})[_0xa24f('0x22')](function(_0x4621bf){if(!_0x4621bf){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))]('no\x20available\x20attributes');}_0x387a2a=_['difference'](_[_0xa24f('0x48')](_0x4621bf),[_0xa24f('0x7c'),'updatedAt']);_0x44a597=_['difference'](_[_0xa24f('0x48')](_0x4621bf),['createdAt',_0xa24f('0x7d'),_0xa24f('0x7e'),_0xa24f('0x7f')]);_0x1fdbd1[_0xa24f('0x5d')]={'mapKey':_0xa24f('0x80')};if(_0x1fdbd1[_0xa24f('0x76')]['type']){switch(_0x1fdbd1[_0xa24f('0x76')]['type']){case _0xa24f('0x81'):_0x1fdbd1['body'][_0xa24f('0x82')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x83')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x84')];_0x1fdbd1['body'][_0xa24f('0x85')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x86')];break;case _0xa24f('0x87'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]='+'+_0x1be0ad['body'][_0xa24f('0x88')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x89')];break;case _0xa24f('0x8a'):_0x1fdbd1[_0xa24f('0x5d')]['from']=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x82')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x2a')];break;case _0xa24f('0x8b'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]=_0x1be0ad[_0xa24f('0x5d')]['from'];_0x1fdbd1['body'][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x5d')];_0x1fdbd1[_0xa24f('0x5d')]['messageId']=_0x1be0ad['body'][_0xa24f('0x8c')];break;case'plivo':_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]=_0x1be0ad['body']['From'];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x8d')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x85')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x8e')];break;case _0xa24f('0x8f'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]='+'+_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x90')][0x0][_0xa24f('0x82')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad['body'][_0xa24f('0x90')][0x0]['text'];_0x1fdbd1['body'][_0xa24f('0x85')]=_0x1be0ad[_0xa24f('0x5d')]['results'][0x0][_0xa24f('0x85')];break;case _0xa24f('0x91'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x92')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad['body'][_0xa24f('0x93')][_0xa24f('0x2a')];break;case _0xa24f('0x94'):_0x1fdbd1[_0xa24f('0x5d')]['from']=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x95')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x89')];_0x1fdbd1['body'][_0xa24f('0x85')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x96')];break;case _0xa24f('0x97'):_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x85')]=_0x1be0ad['body'][0x0][_0xa24f('0x2a')]['id'];_0x1fdbd1[_0xa24f('0x5d')]['from']=_0x1be0ad[_0xa24f('0x5d')][0x0][_0xa24f('0x2a')][_0xa24f('0x82')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][0x0]['message'][_0xa24f('0x89')];break;case _0xa24f('0x98'):_0x1fdbd1[_0xa24f('0x5d')]['from']=_0x1be0ad['body'][_0xa24f('0x82')];_0x1fdbd1['body'][_0xa24f('0x5d')]=_0x1be0ad[_0xa24f('0x5d')][_0xa24f('0x2a')];_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x85')]=_0x1be0ad['body'][_0xa24f('0x99')];break;}}if(_0x1fdbd1[_0xa24f('0x5d')]['id']){delete _0x1fdbd1[_0xa24f('0x5d')]['id'];}if(_[_0xa24f('0x9a')](_0x1fdbd1['body'][_0xa24f('0x82')])){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))](_0xa24f('0x9b'));}if(_[_0xa24f('0x9a')](_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')])||_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x5d')]===''){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))](_0xa24f('0x9c'));}if(_['isNil'](_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x9d')])){throw new db['Sequelize']['ValidationError'](_0xa24f('0x9e')+_0x44a597);}if(!_[_0xa24f('0x9f')](_0x44a597,_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x9d')])){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x44a597);}_0x4e7a45[_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x9d')]]=_0x1fdbd1[_0xa24f('0x5d')]['from'];return db[_0xa24f('0xa0')]['find']({'where':{'id':_0x1fdbd1['account'][_0xa24f('0x7f')]},'include':[{'model':db['CmContact'],'as':_0xa24f('0xa1'),'where':_0x4e7a45,'limit':0x1,'order':[[_0xa24f('0x7d'),_0xa24f('0xa2')]]}]});})['then'](handleEntityNotFound(_0x1ddc8a,null))[_0xa24f('0x22')](function(_0x1f04cf){if(_0x1f04cf){_0x1fdbd1[_0xa24f('0xa3')]=_[_0xa24f('0xa4')](_0x1f04cf,['Contacts']);if(_0x1f04cf['Contacts']['length']){return _0x1f04cf[_0xa24f('0xa1')][0x0];}var _0x5b4dea=_[_0xa24f('0x1a')](_0x1fdbd1[_0xa24f('0x5d')],{'firstName':_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')],'ListId':_0x1f04cf['id']});_0x5b4dea[_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x9d')]]=_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')];return db['CmContact']['create'](_0x5b4dea,{'fields':_0x387a2a,'raw':!![]});}})['then'](handleEntityNotFound(_0x1ddc8a,null))[_0xa24f('0x22')](function(_0x31c42f){if(_0x31c42f){_0x1fdbd1['contact']=_0x31c42f;var _0x3a1c90={'ContactId':_0x31c42f['id'],'phone':_0x1fdbd1[_0xa24f('0x5d')]['from'],'SmsAccountId':_0x1be0ad[_0xa24f('0x67')]['id']};var _0x3099fa={'ContactId':_0x31c42f['id'],'SmsAccountId':_0x1be0ad[_0xa24f('0x67')]['id'],'closed':![]};return db[_0xa24f('0xa5')][_0xa24f('0x61')]({'where':_0x3099fa})[_0xa24f('0x22')](function(_0x572aca){if(_0x572aca){return[_0x572aca,![]];}return db['SmsInteraction']['create'](_0x3a1c90)['then'](function(_0x1414a8){return[_0x1414a8,!![]];});});}})[_0xa24f('0xa6')](function(_0x4856c9,_0xf6adee){_0x1fdbd1[_0xa24f('0xa7')]=_0x4856c9[_0xa24f('0x5e')]({'plain':!![]});_0x1fdbd1[_0xa24f('0xa7')][_0xa24f('0xa8')]=![];if(_0xf6adee){if(_0x1fdbd1[_0xa24f('0x76')][_0xa24f('0xa9')]){_0x1fdbd1['applications'][_0xa24f('0xaa')]({'id':0x0,'priority':_0x1fdbd1[_0xa24f('0x77')][_0xa24f('0x4c')]+0x1,'app':_0xa24f('0xab'),'appdata':_0xa24f('0xac'),'interval':_0xa24f('0xad')});}_0x1fdbd1['interaction'][_0xa24f('0xa8')]=!![];}return db[_0xa24f('0xae')]['create']({'phone':_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0x82')],'messageId':_0x1fdbd1['body'][_0xa24f('0x85')],'body':_0x1fdbd1['body']['body'],'SmsAccountId':_0x1be0ad[_0xa24f('0x67')]['id'],'SmsInteractionId':_0x4856c9['id'],'direction':'in','ContactId':_0x4856c9[_0xa24f('0xaf')],'AttachmentId':_0x1fdbd1[_0xa24f('0x5d')][_0xa24f('0xb0')]});})['then'](function(_0x28cd40){_0x1fdbd1[_0xa24f('0x2a')]=_0x28cd40;if(!_0x1fdbd1['interaction'][_0xa24f('0xb1')])return;return db[_0xa24f('0xb2')]['find']({'attributes':['id',_0xa24f('0x3d')],'where':{'id':_0x1fdbd1[_0xa24f('0xa7')][_0xa24f('0xb1')]}});})['then'](function(_0x26e735){if(_0x26e735){_0x1fdbd1[_0xa24f('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa24f('0xb3'),'appdata':_0x26e735['name']+','+(_0x1fdbd1['account']['waitForTheAssignedAgent']||0xa),'interval':_0xa24f('0xad')});}if(!_0x1fdbd1[_0xa24f('0xa7')][_0xa24f('0xb4')])return;return db[_0xa24f('0xb5')]['find']({'attributes':['id',_0xa24f('0x3d')],'where':{'id':_0x1fdbd1['interaction'][_0xa24f('0xb4')]}});})[_0xa24f('0x22')](function(_0x5127d6){if(_0x5127d6){_0x1fdbd1[_0xa24f('0x77')][_0xa24f('0xb6')]({'id':0x0,'priority':0x1,'app':_0xa24f('0xb7'),'appdata':_0x5127d6[_0xa24f('0x3d')]+','+(_0x1fdbd1['account'][_0xa24f('0xb8')]||0x12c),'interval':_0xa24f('0xad')});}return respondWithRpcPromise(_0xa24f('0xb9'),_0xa24f('0xba'),_0x1fdbd1);})[_0xa24f('0x22')](function(_0x9e9822){if(_0x9e9822){var _0x26582e=0xc8;var _0x35cfd1=_0xa24f('0xbb');logger[_0xa24f('0x23')](_0xa24f('0x26'),_0x35cfd1,_0x26582e,_0xa24f('0xbc'));logger[_0xa24f('0x25')](_0xa24f('0xbd'),_0x35cfd1,_0x26582e,_0xa24f('0xbc'),JSON['stringify'](_0x9e9822));if(_0x1fdbd1[_0xa24f('0x76')][_0xa24f('0x44')]==='twilio'){return _0x1ddc8a['status'](_0x26582e)[_0xa24f('0x35')](_0xa24f('0xbe'),_0xa24f('0xbf'))[_0xa24f('0x3e')](_0xa24f('0xc0'));}else{return _0x1ddc8a[_0xa24f('0x2f')](_0x26582e)[_0xa24f('0x30')](_0x9e9822);}}})[_0xa24f('0x2c')](handleError(_0x1ddc8a,null));};exports[_0xa24f('0xc1')]=function(_0x3c902b,_0x459f6d){var _0x33fc58=_0x3c902b[_0xa24f('0x67')]['id'];var _0x5aa93a=_0x3c902b[_0xa24f('0x5d')];var _0xc42843=0xc8;var _0xf05590=null;return db[_0xa24f('0xc2')][_0xa24f('0xc3')]({'isolationLevel':db[_0xa24f('0xc2')][_0xa24f('0xc4')]['ISOLATION_LEVELS'][_0xa24f('0xc5')]},function(_0x4a7f7d){return db[_0xa24f('0x42')]['findOne']({'where':{'id':_0x33fc58},'transaction':_0x4a7f7d})[_0xa24f('0x22')](function(_0x1b9872){if(_0x1b9872){return db[_0xa24f('0x75')]['destroy']({'where':{'SmsAccountId':_0x33fc58},'transaction':_0x4a7f7d})[_0xa24f('0x22')](function(){var _0x27ea93=_[_0xa24f('0x46')](_0x5aa93a,function(_0x3191c9){_0x3191c9[_0xa24f('0x6a')]=_0x33fc58;return _0x3191c9;});return db[_0xa24f('0x75')][_0xa24f('0xc6')](_0x27ea93,{'transaction':_0x4a7f7d});});}else{_0xc42843=0x194;_0xf05590=[];}});})[_0xa24f('0x22')](function(){if(_0xc42843!==0x194){return db[_0xa24f('0x75')][_0xa24f('0xc7')]({'where':{'SmsAccountId':_0x33fc58},'order':_0xa24f('0xc8')})[_0xa24f('0x22')](function(_0x53df4c){_0xf05590=_0x53df4c;});}})['catch'](function(_0xe768a2){_0xc42843=0x1f4;logger[_0xa24f('0x28')](_0xe768a2[_0xa24f('0x3c')]);if(_0xe768a2['name']){delete _0xe768a2['name'];}_0xf05590=_0xe768a2;})[_0xa24f('0xc9')](function(){if(_0xf05590===null){_0x459f6d[_0xa24f('0x2d')](_0xc42843);}else{if(_0xc42843===0x1f4){_0x459f6d[_0xa24f('0x2f')](_0xc42843)[_0xa24f('0x3e')](_0xf05590);}else{_0x459f6d[_0xa24f('0x2f')](_0xc42843)[_0xa24f('0x30')](_0xf05590);}}});};exports[_0xa24f('0xca')]=function(_0x1565f0,_0x8776ea,_0x1992dc){var _0x56f335={};var _0x314fda={};var _0xf97991;var _0x5e8ff5;return db['SmsAccount'][_0xa24f('0x6c')]({'where':{'id':_0x1565f0[_0xa24f('0x67')]['id']}})['then'](handleEntityNotFound(_0x8776ea,null))[_0xa24f('0x22')](function(_0x21e14d){if(_0x21e14d){_0xf97991=_0x21e14d;_0x314fda['model']=_[_0xa24f('0x48')](db[_0xa24f('0x75')][_0xa24f('0x43')]);_0x314fda[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0x1565f0[_0xa24f('0x47')]);_0x314fda[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x314fda[_0xa24f('0x45')],_0x314fda[_0xa24f('0x47')]);_0x56f335[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x314fda['model'],qs[_0xa24f('0x4a')](_0x1565f0['query']['fields']));_0x56f335[_0xa24f('0x4b')]=_0x56f335['attributes']['length']?_0x56f335[_0xa24f('0x4b')]:_0x314fda[_0xa24f('0x45')];_0x56f335[_0xa24f('0x4f')]=qs['sort'](_0x1565f0[_0xa24f('0x47')][_0xa24f('0x50')]);_0x56f335['where']=qs[_0xa24f('0x52')](_[_0xa24f('0x53')](_0x1565f0[_0xa24f('0x47')],_0x314fda[_0xa24f('0x52')]));if(_0x1565f0[_0xa24f('0x47')]['filter']){_0x56f335[_0xa24f('0x51')]=_[_0xa24f('0x54')](_0x56f335['where'],{'$or':_[_0xa24f('0x46')](_0x56f335[_0xa24f('0x4b')],function(_0x527124){var _0x51bf77={};_0x51bf77[_0x527124]={'$like':'%'+_0x1565f0[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x51bf77;})});}_0x56f335=_[_0xa24f('0x54')]({},_0x56f335,_0x1565f0[_0xa24f('0x57')]);return _0xf97991[_0xa24f('0xca')](_0x56f335);}})[_0xa24f('0x22')](function(_0x391d6f){if(_0x391d6f){_0x5e8ff5=_0x391d6f['length'];if(!_0x1565f0[_0xa24f('0x47')]['hasOwnProperty'](_0xa24f('0x4e'))){_0x56f335[_0xa24f('0x33')]=qs[_0xa24f('0x33')](_0x1565f0[_0xa24f('0x47')]['limit']);_0x56f335['offset']=qs[_0xa24f('0x31')](_0x1565f0[_0xa24f('0x47')][_0xa24f('0x31')]);}return _0xf97991[_0xa24f('0xca')](_0x56f335);}})[_0xa24f('0x22')](function(_0x28e2c3){if(_0x28e2c3){return _0x28e2c3?{'count':_0x5e8ff5,'rows':_0x28e2c3}:null;}})[_0xa24f('0x22')](respondWithResult(_0x8776ea,null))[_0xa24f('0x2c')](handleError(_0x8776ea,null));};exports[_0xa24f('0xcb')]=function(_0x1b5366,_0x4c0a9e,_0xc11a23){var _0x40eab8={'raw':![],'where':{}};var _0x209f2c={};var _0x336f62={'count':0x0,'rows':[]};return db[_0xa24f('0x42')][_0xa24f('0x6c')]({'where':{'id':_0x1b5366[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x4c0a9e,null))['then'](function(_0x31991e){if(_0x31991e){_0x209f2c[_0xa24f('0x45')]=_[_0xa24f('0x48')](db[_0xa24f('0xa5')]['rawAttributes']);_0x209f2c[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0x1b5366[_0xa24f('0x47')]);_0x209f2c[_0xa24f('0x52')]=_[_0xa24f('0x49')](_0x209f2c[_0xa24f('0x45')],_0x209f2c[_0xa24f('0x47')]);_0x40eab8[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x209f2c[_0xa24f('0x45')],qs[_0xa24f('0x4a')](_0x1b5366['query']['fields']));_0x40eab8[_0xa24f('0x4b')]=_0x40eab8['attributes'][_0xa24f('0x4c')]?_0x40eab8[_0xa24f('0x4b')]:_0x209f2c['model'];if(!_0x1b5366[_0xa24f('0x47')][_0xa24f('0x4d')]('nolimit')){_0x40eab8[_0xa24f('0x33')]=qs['limit'](_0x1b5366['query'][_0xa24f('0x33')]);_0x40eab8['offset']=qs[_0xa24f('0x31')](_0x1b5366[_0xa24f('0x47')][_0xa24f('0x31')]);}_0x40eab8['order']=qs[_0xa24f('0x50')](_0x1b5366[_0xa24f('0x47')][_0xa24f('0x50')]);_0x40eab8[_0xa24f('0x51')]=qs['filters'](_[_0xa24f('0x53')](_0x1b5366['query'],_0x209f2c['filters']));_0x40eab8[_0xa24f('0x51')][_0xa24f('0x6a')]=_0x31991e['id'];if(_0x1b5366['query'][_0xa24f('0x56')]){_0x40eab8[_0xa24f('0x51')]=_[_0xa24f('0x54')](_0x40eab8[_0xa24f('0x51')],{'$or':_[_0xa24f('0x46')](_0x40eab8[_0xa24f('0x4b')],function(_0x4ce1fd){var _0x1590d4={};_0x1590d4[_0x4ce1fd]={'$like':'%'+_0x1b5366[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x1590d4;})});}_0x40eab8=_[_0xa24f('0x54')]({},_0x40eab8,_0x1b5366[_0xa24f('0x57')]);return db[_0xa24f('0xa5')][_0xa24f('0x34')]({'where':_0x40eab8[_0xa24f('0x51')]})[_0xa24f('0x22')](function(_0x1788e1){_0x336f62[_0xa24f('0x34')]=_0x1788e1;if(_0x1b5366['query']['includeAll']){_0x40eab8[_0xa24f('0x5b')]=[{'model':db[_0xa24f('0xcc')],'as':_0xa24f('0xcd'),'required':![]},{'model':db[_0xa24f('0xb2')],'as':_0xa24f('0xce'),'attributes':[_0xa24f('0x3d'),_0xa24f('0xcf'),_0xa24f('0xd0')],'required':![]},{'model':db[_0xa24f('0xd1')],'as':_0xa24f('0xd2'),'attributes':['id',_0xa24f('0x3d'),_0xa24f('0xd3')],'where':_0x1b5366[_0xa24f('0x47')][_0xa24f('0xd4')]?{'id':_0x1b5366['query'][_0xa24f('0xd4')]}:undefined,'required':_0x1b5366[_0xa24f('0x47')][_0xa24f('0xd4')]?!![]:![]}];}return db[_0xa24f('0xa5')]['findAll'](_0x40eab8);})['then'](function(_0x53ca86){_0x336f62[_0xa24f('0x5a')]=_0x53ca86;return _0x336f62;});}})[_0xa24f('0x22')](respondWithFilteredResult(_0x4c0a9e,_0x40eab8))[_0xa24f('0x2c')](handleError(_0x4c0a9e,null));};exports[_0xa24f('0x3e')]=function(_0x3e8d7e,_0x4e450d,_0x5d1aa8){var _0x44e620,_0x5b7cd1,_0x234738;if(_['isNil'](_0x3e8d7e[_0xa24f('0x5d')][_0xa24f('0x5d')])||_0x3e8d7e[_0xa24f('0x5d')][_0xa24f('0x5d')]===''){throw new db[(_0xa24f('0x7a'))][(_0xa24f('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa24f('0x9a')](_0x3e8d7e['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xa24f('0xd5'));}_0x44e620=_0x3e8d7e[_0xa24f('0x5d')]['to'];return db[_0xa24f('0x42')][_0xa24f('0x61')]({'where':{'id':_0x3e8d7e[_0xa24f('0x67')]['id']},'include':[{'model':db[_0xa24f('0xa0')],'as':_0xa24f('0xd6'),'include':[{'model':db[_0xa24f('0xcc')],'as':_0xa24f('0xa1'),'where':{'mobile':_0x44e620},'limit':0x1,'order':[[_0xa24f('0x7d'),_0xa24f('0xa2')]]}]}]})[_0xa24f('0x22')](handleEntityNotFound(_0x4e450d,null))[_0xa24f('0x22')](function(_0x551d52){if(_0x551d52&&_0x551d52[_0xa24f('0xd6')]){_0x5b7cd1=_0x551d52[_0xa24f('0x5e')]({'plain':!![]});if(_0x5b7cd1[_0xa24f('0xd6')]&&_0x5b7cd1[_0xa24f('0xd6')][_0xa24f('0xa1')][_0xa24f('0x4c')]){return _0x5b7cd1[_0xa24f('0xd6')][_0xa24f('0xa1')][0x0];}return db[_0xa24f('0xcc')][_0xa24f('0x5c')](_['defaults'](_0x3e8d7e[_0xa24f('0x5d')],{'firstName':_0x44e620,'mobile':_0x44e620,'phone':_0x44e620,'ListId':_0x5b7cd1['ListId']}));}})[_0xa24f('0x22')](handleEntityNotFound(_0x4e450d,null))[_0xa24f('0x22')](function(_0x21bf6b){if(_0x21bf6b){_0x234738=_0x21bf6b;return db['SmsInteraction'][_0xa24f('0x61')]({'where':{'ContactId':_0x234738['id'],'closed':![],'SmsAccountId':_0x5b7cd1['id']}})['then'](function(_0xa43b8e){if(_0xa43b8e){return[_0xa43b8e,![]];}return db['SmsInteraction'][_0xa24f('0x5c')]({'UserId':_0x3e8d7e[_0xa24f('0x60')]['id'],'ContactId':_0x234738['id'],'SmsAccountId':_0x5b7cd1['id'],'phone':_0x44e620,'firstMsgDirection':'out','Messages':[_[_0xa24f('0x54')](_0x3e8d7e[_0xa24f('0x5d')],{'read':![],'body':_0x3e8d7e[_0xa24f('0x5d')][_0xa24f('0x5d')],'phone':_0x44e620,'SmsAccountId':_0x5b7cd1['id'],'UserId':_0x3e8d7e[_0xa24f('0x60')]['id'],'ContactId':_0x234738['id']})]},{'include':[{'model':db[_0xa24f('0xae')],'as':_0xa24f('0xd7')}]})[_0xa24f('0x22')](function(_0x5a25c1){return[_0x5a25c1,!![]];});});}})[_0xa24f('0xa6')](function(_0x224142,_0x555cd5){if(_0x555cd5){return _0x224142;}return db['SmsMessage'][_0xa24f('0x5c')](_[_0xa24f('0x54')](_0x3e8d7e[_0xa24f('0x5d')],{'read':![],'body':_0x3e8d7e[_0xa24f('0x5d')][_0xa24f('0x5d')],'phone':_0x44e620,'SmsAccountId':_0x5b7cd1['id'],'SmsInteractionId':_0x224142['id'],'UserId':_0x3e8d7e[_0xa24f('0x60')]['id'],'ContactId':_0x234738['id']}))[_0xa24f('0x22')](function(_0x26ec11){_0x224142['dataValues'][_0xa24f('0xd7')]=[];_0x224142[_0xa24f('0xd8')]['Messages'][_0xa24f('0xaa')](_0x26ec11[_0xa24f('0xd8')]);return _0x224142;});})['then'](respondWithResult(_0x4e450d,null))['catch'](handleError(_0x4e450d,null));};exports[_0xa24f('0x2f')]=function(_0x38fc4c,_0x13820d,_0x1287a5){if(_0x38fc4c[_0xa24f('0x5d')]['id']){delete _0x38fc4c['body']['id'];}var _0x49debe,_0x3c6ab0,_0x26cf3f;return db[_0xa24f('0x42')]['find']({'where':{'id':_0x38fc4c[_0xa24f('0x67')]['id']}})['then'](handleEntityNotFound(_0x13820d,null))[_0xa24f('0x22')](function(_0x3ab20f){if(_0x3ab20f){_0x26cf3f=_0x3ab20f;logger[_0xa24f('0x25')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0xd9'),_0x3ab20f[_0xa24f('0x44')],util[_0xa24f('0xda')](_0x38fc4c['body'],{'showHidden':![],'depth':null}));switch(_0x3ab20f[_0xa24f('0x44')]){case'skebby':if(_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xdb')]&&_0x38fc4c[_0xa24f('0x5d')]['status']){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x2f')];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c['body'][_0xa24f('0xdb')]}});}break;case _0xa24f('0x8a'):if(_0x38fc4c[_0xa24f('0x5d')]['requestid']&&_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xdc')]){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xdc')];return db['SmsMessage'][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xdd')]}});}break;case _0xa24f('0x8b'):if(_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x8c')]&&_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xde')]){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xde')];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x8c')]}});}break;case _0xa24f('0x8f'):var _0x3475a7=_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x90')][0x0];if(_0x3475a7[_0xa24f('0x85')]&&_0x3475a7[_0xa24f('0x2f')]['groupName']===_0xa24f('0xdf')){_0x3c6ab0=_0x3475a7[_0xa24f('0x2f')][_0xa24f('0xe0')];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0x3475a7['messageId']}});}break;case'clickatell':if(_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0x85')]&&_0x38fc4c[_0xa24f('0x5d')]['status']){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')]['status'];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c['body']['messageId']}});}break;case _0xa24f('0x97'):if(_0x38fc4c[_0xa24f('0x5d')][0x0]['message']['id']){_0x3c6ab0=_0x38fc4c['body'][0x0][_0xa24f('0x44')];return db[_0xa24f('0xae')]['find']({'where':{'messageId':_0x38fc4c[_0xa24f('0x5d')][0x0][_0xa24f('0x2a')]['id']}});}break;case _0xa24f('0x98'):if(_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xe1')]&&_0x38fc4c['body'][_0xa24f('0x2f')]){_0x3c6ab0=_0x38fc4c[_0xa24f('0x5d')]['status'];return db['SmsMessage'][_0xa24f('0x61')]({'where':{'messageId':_0x38fc4c['body'][_0xa24f('0xe1')]}});}break;}}})[_0xa24f('0x22')](handleEntityNotFound(_0x13820d,null))[_0xa24f('0x22')](function(_0x1ff644){if(_0x1ff644){_0x49debe=_0x1ff644;switch(_0x26cf3f['type']){case _0xa24f('0x87'):if(_0x3c6ab0===_0xa24f('0xdf')){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0x87'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa24f('0x8a'):if(_0x3c6ab0==='1'){return _0x49debe['update']({'read':!![]});}else{logger[_0xa24f('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa24f('0x2f'),_0xa24f('0x87'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x38fc4c[_0xa24f('0x5d')][_0xa24f('0xe2')]&&_0x3c6ab0>=0xc8&&_0x3c6ab0<=0xce){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),'status',_0xa24f('0x8b'),util['inspect'](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa24f('0x8f'):var _0x39b880=_0x38fc4c['body'][_0xa24f('0x90')][0x0];if(_0x39b880[_0xa24f('0x2f')][_0xa24f('0xe0')]===_0xa24f('0xdf')){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger['error'](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0x8f'),util[_0xa24f('0xda')](_0x38fc4c['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3c6ab0==_0xa24f('0xe3')||_0x3c6ab0=='RECEIVED_BY_RECIPIENT'){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0x94'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x3c6ab0==_0xa24f('0xe4')){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0x97'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa24f('0x98'):if(_0x3c6ab0===_0xa24f('0xe5')||_0x3c6ab0==='ACCEPTD'){return _0x49debe[_0xa24f('0x66')]({'read':!![]});}else{logger[_0xa24f('0x28')](_0xa24f('0x26'),'status',_0xa24f('0x98'),util[_0xa24f('0xda')](_0x38fc4c[_0xa24f('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x49debe;}})[_0xa24f('0x22')](respondWithResult(_0x13820d,null))[_0xa24f('0x2c')](handleError(_0x13820d,null));};exports['statusGet']=function(_0xd2c76d,_0x365d0f,_0x423efe){var _0x5bd3b5,_0x36f317,_0x434ebf;return db[_0xa24f('0x42')][_0xa24f('0x61')]({'where':{'id':_0xd2c76d[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x365d0f,null))[_0xa24f('0x22')](function(_0x36a480){if(_0x36a480){_0x434ebf=_0x36a480;logger[_0xa24f('0x25')](_0xa24f('0x26'),_0xa24f('0x2f'),_0xa24f('0xd9'),_0x36a480['type'],util[_0xa24f('0xda')](_0xd2c76d['query'],{'showHidden':![],'depth':null}));switch(_0x36a480[_0xa24f('0x44')]){case _0xa24f('0x91'):if(_0xd2c76d[_0xa24f('0x47')][_0xa24f('0xe6')]&&_0xd2c76d[_0xa24f('0x47')][_0xa24f('0xe7')]){_0x36f317=_0xd2c76d[_0xa24f('0x47')]['state'];return db[_0xa24f('0xae')][_0xa24f('0x61')]({'where':{'messageId':_0xd2c76d[_0xa24f('0x47')][_0xa24f('0xe6')]}});}break;}}})['then'](handleEntityNotFound(_0x365d0f,null))[_0xa24f('0x22')](function(_0x7b3d1e){if(_0x7b3d1e){_0x5bd3b5=_0x7b3d1e;switch(_0x434ebf[_0xa24f('0x44')]){case _0xa24f('0x91'):if(_0x36f317==='2'||_0x36f317==='6'){return _0x5bd3b5['update']({'read':!![]});}else{logger[_0xa24f('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa24f('0x2f'),_0xa24f('0x91'),util['inspect'](_0xd2c76d[_0xa24f('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x5bd3b5;}})['then'](respondWithResult(_0x365d0f,null))['catch'](handleError(_0x365d0f,null));};exports[_0xa24f('0xe8')]=function(_0x50283d,_0x1c3747,_0x4a82f5){return db['SmsAccount'][_0xa24f('0x61')]({'where':{'id':_0x50283d[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x1c3747,null))[_0xa24f('0x22')](function(_0x5e075f){if(_0x5e075f){return _0x5e075f[_0xa24f('0xe8')](_0x50283d[_0xa24f('0x5d')][_0xa24f('0x6e')],_[_0xa24f('0xa4')](_0x50283d['body'],[_0xa24f('0x6e'),'id'])||{})[_0xa24f('0xa6')](function(_0x33deed){for(var _0x5b7563=0x0;_0x5b7563<_0x50283d[_0xa24f('0x5d')][_0xa24f('0x6e')]['length'];_0x5b7563+=0x1){socket[_0xa24f('0xe9')]('userSmsAccount:save',{'UserId':Number(_0x50283d[_0xa24f('0x5d')]['ids'][_0x5b7563]),'SmsAccountId':Number(_0x50283d['params']['id'])});}return _0x33deed;});}})[_0xa24f('0x22')](respondWithResult(_0x1c3747,null))[_0xa24f('0x2c')](handleError(_0x1c3747,null));};exports[_0xa24f('0xea')]=function(_0xa1b8e9,_0x30af8b,_0x1d6a7f){return db['SmsAccount'][_0xa24f('0x61')]({'where':{'id':_0xa1b8e9['params']['id']}})['then'](handleEntityNotFound(_0x30af8b,null))[_0xa24f('0x22')](function(_0xff807e){if(_0xff807e){return _0xff807e[_0xa24f('0xea')](_0xa1b8e9[_0xa24f('0x47')][_0xa24f('0x6e')])[_0xa24f('0x22')](function(){if(_['isArray'](_0xa1b8e9[_0xa24f('0x47')][_0xa24f('0x6e')])){for(var _0x561e33=0x0;_0x561e33<_0xa1b8e9[_0xa24f('0x47')][_0xa24f('0x6e')][_0xa24f('0x4c')];_0x561e33+=0x1){socket[_0xa24f('0xe9')](_0xa24f('0xeb'),{'UserId':Number(_0xa1b8e9['query'][_0xa24f('0x6e')][_0x561e33]),'SmsAccountId':Number(_0xa1b8e9['params']['id'])});}}else{socket[_0xa24f('0xe9')](_0xa24f('0xeb'),{'UserId':Number(_0xa1b8e9[_0xa24f('0x47')]['ids']),'SmsAccountId':Number(_0xa1b8e9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x30af8b,null))[_0xa24f('0x2c')](handleError(_0x30af8b,null));};exports[_0xa24f('0xec')]=function(_0x4e76fb,_0x345c26,_0xafb0){var _0x34df07={};var _0x3af0cb={};var _0x1b174e;var _0x409634;return db['SmsAccount'][_0xa24f('0x6c')]({'where':{'id':_0x4e76fb[_0xa24f('0x67')]['id']}})[_0xa24f('0x22')](handleEntityNotFound(_0x345c26,null))[_0xa24f('0x22')](function(_0x40165e){if(_0x40165e){_0x1b174e=_0x40165e;_0x3af0cb['model']=_[_0xa24f('0x48')](db[_0xa24f('0xb2')][_0xa24f('0x43')]);_0x3af0cb[_0xa24f('0x47')]=_[_0xa24f('0x48')](_0x4e76fb['query']);_0x3af0cb[_0xa24f('0x52')]=_['intersection'](_0x3af0cb[_0xa24f('0x45')],_0x3af0cb[_0xa24f('0x47')]);_0x34df07[_0xa24f('0x4b')]=_[_0xa24f('0x49')](_0x3af0cb['model'],qs[_0xa24f('0x4a')](_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x4a')]));_0x34df07['attributes']=_0x34df07[_0xa24f('0x4b')]['length']?_0x34df07[_0xa24f('0x4b')]:_0x3af0cb['model'];_0x34df07[_0xa24f('0x4f')]=qs[_0xa24f('0x50')](_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x50')]);_0x34df07[_0xa24f('0x51')]=qs['filters'](_[_0xa24f('0x53')](_0x4e76fb['query'],_0x3af0cb['filters']));if(_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x56')]){_0x34df07['where']=_['merge'](_0x34df07['where'],{'$or':_[_0xa24f('0x46')](_0x34df07['attributes'],function(_0x29fc3d){var _0x50fcaf={};_0x50fcaf[_0x29fc3d]={'$like':'%'+_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x56')]+'%'};return _0x50fcaf;})});}_0x34df07=_[_0xa24f('0x54')]({},_0x34df07,_0x4e76fb[_0xa24f('0x57')]);return _0x1b174e[_0xa24f('0xec')](_0x34df07);}})[_0xa24f('0x22')](function(_0x59b13e){if(_0x59b13e){_0x409634=_0x59b13e['length'];if(!_0x4e76fb[_0xa24f('0x47')][_0xa24f('0x4d')]('nolimit')){_0x34df07[_0xa24f('0x33')]=qs[_0xa24f('0x33')](_0x4e76fb[_0xa24f('0x47')]['limit']);_0x34df07[_0xa24f('0x31')]=qs[_0xa24f('0x31')](_0x4e76fb[_0xa24f('0x47')]['offset']);}return _0x1b174e[_0xa24f('0xec')](_0x34df07);}})[_0xa24f('0x22')](function(_0x4f34cd){if(_0x4f34cd){return _0x4f34cd?{'count':_0x409634,'rows':_0x4f34cd}:null;}})['then'](respondWithResult(_0x345c26,null))[_0xa24f('0x2c')](handleError(_0x345c26,null));}; \ No newline at end of file +var _0x4048=['squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','key','map','query','keys','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','create','body','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Disposition','getDispositions','SmsAccountId','findAll','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','from','From','messageId','MessageSid','sender','text','clicksend','message_id','plivo','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','queue','Start','startRouting','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','json','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','addAgents','omit','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x1b6314,_0xd51a7c){var _0x2bd01a=function(_0xb81299){while(--_0xb81299){_0x1b6314['push'](_0x1b6314['shift']());}};_0x2bd01a(++_0xd51a7c);}(_0x4048,0x1c6));var _0x8404=function(_0x509406,_0x2eae43){_0x509406=_0x509406-0x0;var _0xca2650=_0x4048[_0x509406];return _0xca2650;};'use strict';var emlformat=require(_0x8404('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8404('0x1'));var jsonpatch=require(_0x8404('0x2'));var rp=require('request-promise');var moment=require(_0x8404('0x3'));var BPromise=require(_0x8404('0x4'));var Mustache=require(_0x8404('0x5'));var util=require(_0x8404('0x6'));var path=require(_0x8404('0x7'));var sox=require(_0x8404('0x8'));var csv=require('to-csv');var ejs=require(_0x8404('0x9'));var fs=require('fs');var fs_extra=require(_0x8404('0xa'));var _=require(_0x8404('0xb'));var squel=require(_0x8404('0xc'));var crypto=require(_0x8404('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8404('0xe'));var toCsv=require(_0x8404('0xf'));var querystring=require(_0x8404('0x10'));var Papa=require(_0x8404('0x11'));var Redis=require(_0x8404('0x12'));var authService=require(_0x8404('0x13'));var qs=require(_0x8404('0x14'));var as=require(_0x8404('0x15'));var hardwareService=require(_0x8404('0x16'));var logger=require(_0x8404('0x17'))(_0x8404('0x18'));var utils=require('../../config/utils');var config=require(_0x8404('0x19'));var licenseUtil=require(_0x8404('0x1a'));var db=require('../../mysqldb')['db'];config[_0x8404('0x1b')]=_['defaults'](config[_0x8404('0x1b')],{'host':_0x8404('0x1c'),'port':0x18eb});var socket=require(_0x8404('0x1d'))(new Redis(config[_0x8404('0x1b')]));require(_0x8404('0x1e'))[_0x8404('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8404('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4f3dc2,_0x3bdafe,_0x2af922,_0x496f6b){return new BPromise(function(_0x34b07f,_0x57ceb5){var _0x3bbf08=_0x496f6b||client;return _0x3bbf08[_0x8404('0x21')](_0x4f3dc2,_0x2af922)[_0x8404('0x22')](function(_0x2f9eab){logger[_0x8404('0x23')](_0x8404('0x24'),_0x3bdafe,_0x8404('0x25'));logger['debug'](_0x8404('0x26'),_0x3bdafe,_0x8404('0x25'),JSON['stringify'](_0x2f9eab));if(_0x2f9eab['error']){if(_0x2f9eab[_0x8404('0x27')][_0x8404('0x28')]===0x1f4){logger['error'](_0x8404('0x24'),_0x3bdafe,_0x2f9eab['error'][_0x8404('0x29')]);return _0x57ceb5(_0x2f9eab[_0x8404('0x27')][_0x8404('0x29')]);}logger[_0x8404('0x27')](_0x8404('0x24'),_0x3bdafe,_0x2f9eab[_0x8404('0x27')][_0x8404('0x29')]);return _0x34b07f(_0x2f9eab[_0x8404('0x27')]['message']);}else{logger['info'](_0x8404('0x24'),_0x3bdafe,_0x8404('0x25'));_0x34b07f(_0x2f9eab[_0x8404('0x2a')][_0x8404('0x29')]);}})[_0x8404('0x2b')](function(_0x3091a6){logger[_0x8404('0x27')](_0x8404('0x24'),_0x3bdafe,_0x3091a6);_0x57ceb5(_0x3091a6);});});}function respondWithStatusCode(_0x10ded3,_0x292895){_0x292895=_0x292895||0xcc;return function(_0x30f085){if(_0x30f085){return _0x10ded3[_0x8404('0x2c')](_0x292895);}return _0x10ded3[_0x8404('0x2d')](_0x292895)[_0x8404('0x2e')]();};}function respondWithResult(_0x2dc1a4,_0x2bedc4){_0x2bedc4=_0x2bedc4||0xc8;return function(_0xe42361){if(_0xe42361){return _0x2dc1a4[_0x8404('0x2d')](_0x2bedc4)['json'](_0xe42361);}};}function respondWithFilteredResult(_0x90350e,_0x163767){return function(_0x44e229){if(_0x44e229){var _0x28036e=typeof _0x163767['offset']===_0x8404('0x2f')&&typeof _0x163767[_0x8404('0x30')]===_0x8404('0x2f');var _0x10673a=_0x44e229[_0x8404('0x31')];var _0x33285b=_0x28036e?0x0:_0x163767['offset'];var _0x5aec7a=_0x28036e?_0x44e229[_0x8404('0x31')]:_0x163767[_0x8404('0x32')]+_0x163767[_0x8404('0x30')];var _0x35c3e7;if(_0x5aec7a>=_0x10673a){_0x5aec7a=_0x10673a;_0x35c3e7=0xc8;}else{_0x35c3e7=0xce;}_0x90350e[_0x8404('0x2d')](_0x35c3e7);return _0x90350e['set']('Content-Range',_0x33285b+'-'+_0x5aec7a+'/'+_0x10673a)['json'](_0x44e229);}return null;};}function patchUpdates(_0x8e55d1){return function(_0x49c4de){try{jsonpatch[_0x8404('0x33')](_0x49c4de,_0x8e55d1,!![]);}catch(_0x3268e3){return BPromise[_0x8404('0x34')](_0x3268e3);}return _0x49c4de['save']();};}function saveUpdates(_0x3a3c6b,_0x2cc17b){return function(_0x179ddd){if(_0x179ddd){return _0x179ddd[_0x8404('0x35')](_0x3a3c6b)[_0x8404('0x22')](function(_0xaf2365){return _0xaf2365;});}return null;};}function removeEntity(_0x320c92,_0x5da113){return function(_0x1abf5e){if(_0x1abf5e){return _0x1abf5e[_0x8404('0x36')]()[_0x8404('0x22')](function(){var _0xeaf951=_0x1abf5e[_0x8404('0x37')]({'plain':!![]});var _0x47f111=_0x8404('0x38');return db[_0x8404('0x39')]['destroy']({'where':{'type':_0x47f111,'resourceId':_0xeaf951['id']}})[_0x8404('0x22')](function(){return _0x1abf5e;});})[_0x8404('0x22')](function(){_0x320c92[_0x8404('0x2d')](0xcc)[_0x8404('0x2e')]();});}};}function handleEntityNotFound(_0x2bf53a,_0x289c0c){return function(_0x26910b){if(!_0x26910b){_0x2bf53a[_0x8404('0x2c')](0x194);}return _0x26910b;};}function handleError(_0x33e254,_0x3412f7){_0x3412f7=_0x3412f7||0x1f4;return function(_0x4c680a){logger['error'](_0x4c680a[_0x8404('0x3a')]);if(_0x4c680a['name']){delete _0x4c680a[_0x8404('0x3b')];}_0x33e254['status'](_0x3412f7)[_0x8404('0x3c')](_0x4c680a);};}exports['index']=function(_0x1ad45a,_0x223e4f){var _0x25c8f2={'include':[{'model':db[_0x8404('0x3d')],'as':_0x8404('0x3e')}]},_0x40b6a9={},_0x12656a={'count':0x0,'rows':[]};var _0x77e2d2=_['map'](db[_0x8404('0x3f')][_0x8404('0x40')],function(_0xc4da23){return{'name':_0xc4da23['fieldName'],'type':_0xc4da23['type'][_0x8404('0x41')]};});_0x40b6a9['model']=_[_0x8404('0x42')](_0x77e2d2,'name');_0x40b6a9[_0x8404('0x43')]=_[_0x8404('0x44')](_0x1ad45a[_0x8404('0x43')]);_0x40b6a9['filters']=_[_0x8404('0x45')](_0x40b6a9['model'],_0x40b6a9[_0x8404('0x43')]);_0x25c8f2['attributes']=_[_0x8404('0x45')](_0x40b6a9[_0x8404('0x46')],qs[_0x8404('0x47')](_0x1ad45a['query'][_0x8404('0x47')]));_0x25c8f2['attributes']=_0x25c8f2['attributes'][_0x8404('0x48')]?_0x25c8f2[_0x8404('0x49')]:_0x40b6a9[_0x8404('0x46')];if(!_0x1ad45a[_0x8404('0x43')][_0x8404('0x4a')](_0x8404('0x4b'))){_0x25c8f2[_0x8404('0x30')]=qs['limit'](_0x1ad45a[_0x8404('0x43')][_0x8404('0x30')]);_0x25c8f2['offset']=qs['offset'](_0x1ad45a[_0x8404('0x43')][_0x8404('0x32')]);}_0x25c8f2[_0x8404('0x4c')]=qs[_0x8404('0x4d')](_0x1ad45a['query']['sort']);_0x25c8f2['where']=qs['filters'](_[_0x8404('0x4e')](_0x1ad45a['query'],_0x40b6a9[_0x8404('0x4f')]),_0x77e2d2);if(_0x1ad45a[_0x8404('0x43')][_0x8404('0x50')]){_0x25c8f2['where']=_[_0x8404('0x51')](_0x25c8f2[_0x8404('0x52')],{'$or':_[_0x8404('0x42')](_0x77e2d2,function(_0x3eaf55){if(_0x3eaf55['type']!==_0x8404('0x53')){var _0xd2d082={};_0xd2d082[_0x3eaf55[_0x8404('0x3b')]]={'$like':'%'+_0x1ad45a[_0x8404('0x43')][_0x8404('0x50')]+'%'};return _0xd2d082;}})});}_0x25c8f2=_['merge']({},_0x25c8f2,_0x1ad45a[_0x8404('0x54')]);var _0x4a9919={'where':_0x25c8f2[_0x8404('0x52')]};return db[_0x8404('0x3f')][_0x8404('0x31')](_0x4a9919)['then'](function(_0x19cfdb){_0x12656a[_0x8404('0x31')]=_0x19cfdb;if(_0x1ad45a[_0x8404('0x43')][_0x8404('0x55')]){_0x25c8f2[_0x8404('0x56')]=[{'all':!![]}];}return db[_0x8404('0x3f')]['findAll'](_0x25c8f2);})['then'](function(_0x2b17cd){_0x12656a[_0x8404('0x57')]=_0x2b17cd;return _0x12656a;})[_0x8404('0x22')](respondWithFilteredResult(_0x223e4f,_0x25c8f2))[_0x8404('0x2b')](handleError(_0x223e4f,null));};exports[_0x8404('0x58')]=function(_0x4d1da7,_0x2d8bb6){var _0x5a84de={'raw':![],'where':{'id':_0x4d1da7[_0x8404('0x59')]['id']},'include':[{'model':db[_0x8404('0x3d')],'as':_0x8404('0x3e')}]},_0x615b04={};_0x615b04['model']=_[_0x8404('0x44')](db[_0x8404('0x3f')][_0x8404('0x40')]);_0x615b04['query']=_[_0x8404('0x44')](_0x4d1da7['query']);_0x615b04[_0x8404('0x4f')]=_[_0x8404('0x45')](_0x615b04[_0x8404('0x46')],_0x615b04[_0x8404('0x43')]);_0x5a84de[_0x8404('0x49')]=_[_0x8404('0x45')](_0x615b04[_0x8404('0x46')],qs['fields'](_0x4d1da7[_0x8404('0x43')][_0x8404('0x47')]));_0x5a84de[_0x8404('0x49')]=_0x5a84de['attributes'][_0x8404('0x48')]?_0x5a84de[_0x8404('0x49')]:_0x615b04[_0x8404('0x46')];if(_0x4d1da7[_0x8404('0x43')][_0x8404('0x55')]){_0x5a84de['include']=[{'all':!![]}];}_0x5a84de=_[_0x8404('0x51')]({},_0x5a84de,_0x4d1da7[_0x8404('0x54')]);return db['SmsAccount']['find'](_0x5a84de)[_0x8404('0x22')](handleEntityNotFound(_0x2d8bb6,null))['then'](respondWithResult(_0x2d8bb6,null))['catch'](handleError(_0x2d8bb6,null));};exports[_0x8404('0x5a')]=function(_0x2c05cd,_0x564add){return db[_0x8404('0x3f')][_0x8404('0x5a')](_0x2c05cd[_0x8404('0x5b')],{})['then'](function(_0x22354b){var _0x58416d=_0x2c05cd['user'][_0x8404('0x37')]({'plain':!![]});if(!_0x58416d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58416d[_0x8404('0x5c')]==='user'){var _0x3936e2=_0x22354b['get']({'plain':!![]});var _0x2522f4=_0x8404('0x38');return db[_0x8404('0x5d')][_0x8404('0x5e')]({'where':{'name':_0x2522f4,'userProfileId':_0x58416d[_0x8404('0x5f')]},'raw':!![]})['then'](function(_0x3e135b){if(_0x3e135b&&_0x3e135b[_0x8404('0x60')]===0x0){return db[_0x8404('0x39')][_0x8404('0x5a')]({'name':_0x3936e2[_0x8404('0x3b')],'resourceId':_0x3936e2['id'],'type':_0x3e135b[_0x8404('0x3b')],'sectionId':_0x3e135b['id']},{})['then'](function(){return _0x22354b;});}else{return _0x22354b;}})[_0x8404('0x2b')](function(_0x493d80){logger[_0x8404('0x27')](_0x8404('0x61'),_0x493d80);throw _0x493d80;});}return _0x22354b;})[_0x8404('0x22')](respondWithResult(_0x564add,0xc9))[_0x8404('0x2b')](handleError(_0x564add,null));};exports[_0x8404('0x35')]=function(_0x3a39d1,_0x268c2f){if(_0x3a39d1[_0x8404('0x5b')]['id']){delete _0x3a39d1[_0x8404('0x5b')]['id'];}return db['SmsAccount'][_0x8404('0x5e')]({'where':{'id':_0x3a39d1['params']['id']},'include':[{'model':db[_0x8404('0x3d')],'as':_0x8404('0x3e')}]})[_0x8404('0x22')](handleEntityNotFound(_0x268c2f,null))[_0x8404('0x22')](saveUpdates(_0x3a39d1['body'],null))[_0x8404('0x22')](respondWithResult(_0x268c2f,null))['catch'](handleError(_0x268c2f,null));};exports[_0x8404('0x36')]=function(_0x5d35bf,_0x5b559e){return db[_0x8404('0x3f')]['find']({'where':{'id':_0x5d35bf[_0x8404('0x59')]['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x5b559e,null))[_0x8404('0x22')](removeEntity(_0x5b559e,null))['catch'](handleError(_0x5b559e,null));};exports['describe']=function(_0x52d2ba,_0x39d771){return db[_0x8404('0x3f')]['describe']()['then'](respondWithResult(_0x39d771,null))['catch'](handleError(_0x39d771,null));};exports['addDisposition']=function(_0x40f61a,_0x500f85,_0xbd5c7f){if(_0x40f61a[_0x8404('0x5b')]['id']){delete _0x40f61a['body']['id'];}return db[_0x8404('0x3f')]['find']({'where':{'id':_0x40f61a[_0x8404('0x59')]['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x500f85,null))[_0x8404('0x22')](function(_0x48708b){if(_0x48708b){_0x40f61a['body']['SmsAccountId']=_0x48708b['id'];return db[_0x8404('0x62')][_0x8404('0x5a')](_0x40f61a[_0x8404('0x5b')]);}})[_0x8404('0x22')](respondWithResult(_0x500f85,null))[_0x8404('0x2b')](handleError(_0x500f85,null));};exports[_0x8404('0x63')]=function(_0x20d196,_0x40232b,_0x5bf635){var _0x58070c={'raw':![],'where':{}};var _0x3d719b={};var _0x495ed1={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x20d196['params']['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x40232b,null))[_0x8404('0x22')](function(_0x5ca908){if(_0x5ca908){_0x3d719b['model']=_[_0x8404('0x44')](db[_0x8404('0x62')][_0x8404('0x40')]);_0x3d719b['query']=_[_0x8404('0x44')](_0x20d196[_0x8404('0x43')]);_0x3d719b[_0x8404('0x4f')]=_[_0x8404('0x45')](_0x3d719b[_0x8404('0x46')],_0x3d719b[_0x8404('0x43')]);_0x58070c['attributes']=_[_0x8404('0x45')](_0x3d719b[_0x8404('0x46')],qs[_0x8404('0x47')](_0x20d196['query'][_0x8404('0x47')]));_0x58070c[_0x8404('0x49')]=_0x58070c[_0x8404('0x49')][_0x8404('0x48')]?_0x58070c[_0x8404('0x49')]:_0x3d719b[_0x8404('0x46')];if(!_0x20d196['query'][_0x8404('0x4a')](_0x8404('0x4b'))){_0x58070c['limit']=qs[_0x8404('0x30')](_0x20d196['query']['limit']);_0x58070c[_0x8404('0x32')]=qs[_0x8404('0x32')](_0x20d196['query'][_0x8404('0x32')]);}_0x58070c[_0x8404('0x4c')]=qs[_0x8404('0x4d')](_0x20d196['query'][_0x8404('0x4d')]);_0x58070c[_0x8404('0x52')]=qs[_0x8404('0x4f')](_[_0x8404('0x4e')](_0x20d196[_0x8404('0x43')],_0x3d719b[_0x8404('0x4f')]));_0x58070c[_0x8404('0x52')][_0x8404('0x64')]=_0x5ca908['id'];if(_0x20d196[_0x8404('0x43')]['filter']){_0x58070c[_0x8404('0x52')]=_[_0x8404('0x51')](_0x58070c[_0x8404('0x52')],{'$or':_[_0x8404('0x42')](_0x58070c[_0x8404('0x49')],function(_0x1387de){var _0x3f1c55={};_0x3f1c55[_0x1387de]={'$like':'%'+_0x20d196[_0x8404('0x43')][_0x8404('0x50')]+'%'};return _0x3f1c55;})});}_0x58070c=_['merge']({},_0x58070c,_0x20d196[_0x8404('0x54')]);return db[_0x8404('0x62')][_0x8404('0x31')]({'where':_0x58070c[_0x8404('0x52')]})[_0x8404('0x22')](function(_0x306c0a){_0x495ed1['count']=_0x306c0a;if(_0x20d196[_0x8404('0x43')][_0x8404('0x55')]){_0x58070c[_0x8404('0x56')]=[{'all':!![]}];}return db[_0x8404('0x62')][_0x8404('0x65')](_0x58070c);})['then'](function(_0x492ecd){_0x495ed1[_0x8404('0x57')]=_0x492ecd;return _0x495ed1;});}})[_0x8404('0x22')](respondWithFilteredResult(_0x40232b,_0x58070c))['catch'](handleError(_0x40232b,null));};exports['removeDispositions']=function(_0x4fdbb8,_0x22b206,_0x347f4d){return db[_0x8404('0x3f')][_0x8404('0x5e')]({'where':{'id':_0x4fdbb8[_0x8404('0x59')]['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x22b206,null))['then'](function(_0x4c97b6){if(_0x4c97b6){return _0x4c97b6[_0x8404('0x66')](_0x4fdbb8[_0x8404('0x43')][_0x8404('0x67')]);}})[_0x8404('0x22')](respondWithStatusCode(_0x22b206,null))[_0x8404('0x2b')](handleError(_0x22b206,null));};exports[_0x8404('0x68')]=function(_0x294d93,_0x4cdde1,_0x5b149b){if(_0x294d93[_0x8404('0x5b')]['id']){delete _0x294d93[_0x8404('0x5b')]['id'];}return db[_0x8404('0x3f')][_0x8404('0x5e')]({'where':{'id':_0x294d93[_0x8404('0x59')]['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x4cdde1,null))[_0x8404('0x22')](function(_0x1ae44a){if(_0x1ae44a){_0x294d93[_0x8404('0x5b')]['SmsAccountId']=_0x1ae44a['id'];return db['CannedAnswer'][_0x8404('0x5a')](_0x294d93[_0x8404('0x5b')]);}})[_0x8404('0x22')](respondWithResult(_0x4cdde1,null))[_0x8404('0x2b')](handleError(_0x4cdde1,null));};exports[_0x8404('0x69')]=function(_0x102b7b,_0x4d0279,_0xa4a846){var _0x572f53={'raw':![],'where':{}};var _0x36eb2e={};var _0x189b08={'count':0x0,'rows':[]};return db['SmsAccount'][_0x8404('0x6a')]({'where':{'id':_0x102b7b[_0x8404('0x59')]['id']}})['then'](handleEntityNotFound(_0x4d0279,null))['then'](function(_0x2dbdad){if(_0x2dbdad){_0x36eb2e[_0x8404('0x46')]=_['keys'](db[_0x8404('0x6b')][_0x8404('0x40')]);_0x36eb2e[_0x8404('0x43')]=_['keys'](_0x102b7b[_0x8404('0x43')]);_0x36eb2e[_0x8404('0x4f')]=_[_0x8404('0x45')](_0x36eb2e[_0x8404('0x46')],_0x36eb2e[_0x8404('0x43')]);_0x572f53['attributes']=_['intersection'](_0x36eb2e[_0x8404('0x46')],qs['fields'](_0x102b7b[_0x8404('0x43')][_0x8404('0x47')]));_0x572f53['attributes']=_0x572f53[_0x8404('0x49')]['length']?_0x572f53['attributes']:_0x36eb2e['model'];if(!_0x102b7b['query'][_0x8404('0x4a')](_0x8404('0x4b'))){_0x572f53[_0x8404('0x30')]=qs['limit'](_0x102b7b[_0x8404('0x43')][_0x8404('0x30')]);_0x572f53[_0x8404('0x32')]=qs[_0x8404('0x32')](_0x102b7b[_0x8404('0x43')][_0x8404('0x32')]);}_0x572f53['order']=qs[_0x8404('0x4d')](_0x102b7b['query'][_0x8404('0x4d')]);_0x572f53[_0x8404('0x52')]=qs[_0x8404('0x4f')](_['pick'](_0x102b7b[_0x8404('0x43')],_0x36eb2e[_0x8404('0x4f')]));_0x572f53[_0x8404('0x52')][_0x8404('0x64')]=_0x2dbdad['id'];if(_0x102b7b['query'][_0x8404('0x50')]){_0x572f53[_0x8404('0x52')]=_[_0x8404('0x51')](_0x572f53[_0x8404('0x52')],{'$or':_['map'](_0x572f53[_0x8404('0x49')],function(_0x35276f){var _0x158760={};_0x158760[_0x35276f]={'$like':'%'+_0x102b7b[_0x8404('0x43')][_0x8404('0x50')]+'%'};return _0x158760;})});}_0x572f53=_['merge']({},_0x572f53,_0x102b7b[_0x8404('0x54')]);return db[_0x8404('0x6b')][_0x8404('0x31')]({'where':_0x572f53[_0x8404('0x52')]})[_0x8404('0x22')](function(_0x1a44a7){_0x189b08['count']=_0x1a44a7;if(_0x102b7b['query'][_0x8404('0x55')]){_0x572f53[_0x8404('0x56')]=[{'all':!![]}];}return db[_0x8404('0x6b')][_0x8404('0x65')](_0x572f53);})[_0x8404('0x22')](function(_0x3593d4){_0x189b08[_0x8404('0x57')]=_0x3593d4;return _0x189b08;});}})['then'](respondWithFilteredResult(_0x4d0279,_0x572f53))[_0x8404('0x2b')](handleError(_0x4d0279,null));};exports[_0x8404('0x6c')]=function(_0x255e83,_0x1cc7c9,_0x2ca350){return db[_0x8404('0x3f')][_0x8404('0x5e')]({'where':{'id':_0x255e83['params']['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x1cc7c9,null))[_0x8404('0x22')](function(_0x3b5290){if(_0x3b5290){return _0x3b5290[_0x8404('0x6c')](_0x255e83['query'][_0x8404('0x67')]);}})[_0x8404('0x22')](respondWithStatusCode(_0x1cc7c9,null))['catch'](handleError(_0x1cc7c9,null));};exports[_0x8404('0x6d')]=function(_0x38bcf5,_0x10cc39,_0x570497){var _0x2313f8={'channel':_0x8404('0x6e')};var _0x3ec091=[];var _0x556c2f=[];var _0x3dbd19={};return db[_0x8404('0x3f')]['find']({'where':{'id':_0x38bcf5['params']['id']},'include':[{'model':db[_0x8404('0x6f')],'as':_0x8404('0x70')}]})[_0x8404('0x22')](handleEntityNotFound(_0x10cc39,null))[_0x8404('0x22')](function(_0x10d07a){_0x2313f8['account']=_0x10d07a;_0x2313f8[_0x8404('0x71')]=_[_0x8404('0x72')](_0x10d07a['Applications'],[_0x8404('0x73')],[_0x8404('0x74')]);if(_0x2313f8[_0x8404('0x75')]['Applications']){delete _0x2313f8[_0x8404('0x75')]['Applications'];}return db[_0x8404('0x76')][_0x8404('0x77')]();})[_0x8404('0x22')](function(_0x35fd34){if(!_0x35fd34){throw new db['Sequelize'][(_0x8404('0x78'))](_0x8404('0x79'));}_0x3ec091=_[_0x8404('0x7a')](_[_0x8404('0x44')](_0x35fd34),[_0x8404('0x7b'),'updatedAt']);_0x556c2f=_[_0x8404('0x7a')](_[_0x8404('0x44')](_0x35fd34),[_0x8404('0x7b'),_0x8404('0x7c'),_0x8404('0x7d'),_0x8404('0x7e')]);_0x2313f8[_0x8404('0x5b')]={'mapKey':_0x8404('0x7f')};if(_0x2313f8['account'][_0x8404('0x80')]){switch(_0x2313f8[_0x8404('0x75')][_0x8404('0x80')]){case _0x8404('0x81'):_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')]=_0x38bcf5['body'][_0x8404('0x83')];_0x2313f8[_0x8404('0x5b')][_0x8404('0x5b')]=_0x38bcf5['body']['Body'];_0x2313f8['body'][_0x8404('0x84')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x85')];break;case'skebby':_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')]='+'+_0x38bcf5[_0x8404('0x5b')][_0x8404('0x86')];_0x2313f8['body'][_0x8404('0x5b')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x87')];break;case'connectel':_0x2313f8['body'][_0x8404('0x82')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x82')];_0x2313f8[_0x8404('0x5b')][_0x8404('0x5b')]=_0x38bcf5['body'][_0x8404('0x29')];break;case _0x8404('0x88'):_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x82')];_0x2313f8['body'][_0x8404('0x5b')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x5b')];_0x2313f8[_0x8404('0x5b')][_0x8404('0x84')]=_0x38bcf5['body'][_0x8404('0x89')];break;case _0x8404('0x8a'):_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')]=_0x38bcf5[_0x8404('0x5b')]['From'];_0x2313f8[_0x8404('0x5b')][_0x8404('0x5b')]=_0x38bcf5[_0x8404('0x5b')]['Text'];_0x2313f8['body'][_0x8404('0x84')]=_0x38bcf5[_0x8404('0x5b')]['MessageUUID'];break;case _0x8404('0x8b'):_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')]='+'+_0x38bcf5[_0x8404('0x5b')][_0x8404('0x8c')][0x0][_0x8404('0x82')];_0x2313f8[_0x8404('0x5b')]['body']=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x8c')][0x0][_0x8404('0x87')];_0x2313f8[_0x8404('0x5b')]['messageId']=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x8c')][0x0][_0x8404('0x84')];break;case _0x8404('0x8d'):_0x2313f8['body'][_0x8404('0x82')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x8e')];_0x2313f8[_0x8404('0x5b')][_0x8404('0x5b')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x8f')][_0x8404('0x29')];break;case _0x8404('0x90'):_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')]=_0x38bcf5[_0x8404('0x5b')]['fromNumber'];_0x2313f8[_0x8404('0x5b')][_0x8404('0x5b')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x87')];_0x2313f8[_0x8404('0x5b')][_0x8404('0x84')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x91')];break;case _0x8404('0x92'):_0x2313f8[_0x8404('0x5b')][_0x8404('0x84')]=_0x38bcf5[_0x8404('0x5b')][0x0]['message']['id'];_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')]=_0x38bcf5[_0x8404('0x5b')][0x0][_0x8404('0x29')][_0x8404('0x82')];_0x2313f8['body']['body']=_0x38bcf5[_0x8404('0x5b')][0x0]['message'][_0x8404('0x87')];break;case _0x8404('0x93'):_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x82')];_0x2313f8['body']['body']=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x29')];_0x2313f8[_0x8404('0x5b')][_0x8404('0x84')]=_0x38bcf5[_0x8404('0x5b')][_0x8404('0x94')];break;}}if(_0x2313f8[_0x8404('0x5b')]['id']){delete _0x2313f8[_0x8404('0x5b')]['id'];}if(_[_0x8404('0x95')](_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')])){throw new db[(_0x8404('0x96'))][(_0x8404('0x78'))](_0x8404('0x97'));}if(_[_0x8404('0x95')](_0x2313f8[_0x8404('0x5b')][_0x8404('0x5b')])||_0x2313f8[_0x8404('0x5b')][_0x8404('0x5b')]===''){throw new db[(_0x8404('0x96'))][(_0x8404('0x78'))](_0x8404('0x98'));}if(_[_0x8404('0x95')](_0x2313f8[_0x8404('0x5b')][_0x8404('0x99')])){throw new db[(_0x8404('0x96'))][(_0x8404('0x78'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x556c2f);}if(!_[_0x8404('0x9a')](_0x556c2f,_0x2313f8[_0x8404('0x5b')][_0x8404('0x99')])){throw new db[(_0x8404('0x96'))][(_0x8404('0x78'))](_0x8404('0x9b')+_0x556c2f);}_0x3dbd19[_0x2313f8[_0x8404('0x5b')][_0x8404('0x99')]]=_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')];return db[_0x8404('0x9c')][_0x8404('0x5e')]({'where':{'id':_0x2313f8[_0x8404('0x75')][_0x8404('0x7e')]},'include':[{'model':db[_0x8404('0x76')],'as':_0x8404('0x9d'),'where':_0x3dbd19,'limit':0x1,'order':[[_0x8404('0x7c'),_0x8404('0x9e')]]}]});})[_0x8404('0x22')](handleEntityNotFound(_0x10cc39,null))[_0x8404('0x22')](function(_0x144579){if(_0x144579){_0x2313f8[_0x8404('0x9f')]=_['omit'](_0x144579,['Contacts']);if(_0x144579[_0x8404('0x9d')][_0x8404('0x48')]){return _0x144579[_0x8404('0x9d')][0x0];}var _0x5b2043=_[_0x8404('0xa0')](_0x2313f8['body'],{'firstName':_0x2313f8['body']['from'],'ListId':_0x144579['id']});_0x5b2043[_0x2313f8['body']['mapKey']]=_0x2313f8[_0x8404('0x5b')][_0x8404('0x82')];return db['CmContact'][_0x8404('0x5a')](_0x5b2043,{'fields':_0x3ec091,'raw':!![]});}})['then'](handleEntityNotFound(_0x10cc39,null))[_0x8404('0x22')](function(_0x239138){if(_0x239138){_0x2313f8['contact']=_0x239138;var _0x525a34={'ContactId':_0x239138['id'],'phone':_0x2313f8[_0x8404('0x5b')]['from'],'SmsAccountId':_0x38bcf5[_0x8404('0x59')]['id']};var _0x2075a7={'ContactId':_0x239138['id'],'SmsAccountId':_0x38bcf5[_0x8404('0x59')]['id'],'closed':![]};return db[_0x8404('0xa1')][_0x8404('0x5e')]({'where':_0x2075a7})['then'](function(_0x2ecdd7){if(_0x2ecdd7){return[_0x2ecdd7,![]];}return db[_0x8404('0xa1')][_0x8404('0x5a')](_0x525a34)['then'](function(_0x5aad87){return[_0x5aad87,!![]];});});}})[_0x8404('0xa2')](function(_0x406fcb,_0x2d4811){_0x2313f8[_0x8404('0xa3')]=_0x406fcb[_0x8404('0x37')]({'plain':!![]});_0x2313f8[_0x8404('0xa3')][_0x8404('0xa4')]=![];if(_0x2d4811){if(_0x2313f8[_0x8404('0x75')][_0x8404('0xa5')]){_0x2313f8[_0x8404('0x71')][_0x8404('0xa6')]({'id':0x0,'priority':_0x2313f8[_0x8404('0x71')]['length']+0x1,'app':_0x8404('0xa7'),'appdata':_0x8404('0xa8'),'interval':_0x8404('0xa9')});}_0x2313f8['interaction'][_0x8404('0xa4')]=!![];}return db[_0x8404('0xaa')][_0x8404('0x5a')]({'phone':_0x2313f8[_0x8404('0x5b')]['from'],'messageId':_0x2313f8[_0x8404('0x5b')][_0x8404('0x84')],'body':_0x2313f8[_0x8404('0x5b')][_0x8404('0x5b')],'SmsAccountId':_0x38bcf5[_0x8404('0x59')]['id'],'SmsInteractionId':_0x406fcb['id'],'direction':'in','ContactId':_0x406fcb['ContactId'],'AttachmentId':_0x2313f8[_0x8404('0x5b')][_0x8404('0xab')]});})['then'](function(_0x12d163){_0x2313f8[_0x8404('0x29')]=_0x12d163;if(!_0x2313f8['interaction'][_0x8404('0xac')])return;return db[_0x8404('0xad')][_0x8404('0x5e')]({'attributes':['id',_0x8404('0x3b')],'where':{'id':_0x2313f8['interaction']['UserId']}});})[_0x8404('0x22')](function(_0x462e4d){if(_0x462e4d){_0x2313f8[_0x8404('0x71')][_0x8404('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x462e4d[_0x8404('0x3b')]+','+(_0x2313f8[_0x8404('0x75')][_0x8404('0xaf')]||0xa),'interval':_0x8404('0xa9')});}if(!_0x2313f8[_0x8404('0xa3')][_0x8404('0xb0')])return;return db[_0x8404('0xb1')][_0x8404('0x5e')]({'attributes':['id','name'],'where':{'id':_0x2313f8[_0x8404('0xa3')][_0x8404('0xb0')]}});})[_0x8404('0x22')](function(_0x4d0728){if(_0x4d0728){_0x2313f8['applications'][_0x8404('0xae')]({'id':0x0,'priority':0x1,'app':_0x8404('0xb2'),'appdata':_0x4d0728[_0x8404('0x3b')]+','+(_0x2313f8[_0x8404('0x75')]['waitForTheAssignedQueue']||0x12c),'interval':_0x8404('0xa9')});}return respondWithRpcPromise(_0x8404('0xb3'),_0x8404('0xb4'),_0x2313f8);})[_0x8404('0x22')](function(_0x37fb5a){if(_0x37fb5a){var _0x10347a=0xc8;var _0x5e2d96='receiveMessage';logger[_0x8404('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e2d96,_0x10347a,'entity\x20found');logger[_0x8404('0xb5')](_0x8404('0xb6'),_0x5e2d96,_0x10347a,'entity\x20found',JSON['stringify'](_0x37fb5a));if(_0x2313f8[_0x8404('0x75')][_0x8404('0x80')]===_0x8404('0x81')){return _0x10cc39[_0x8404('0x2d')](_0x10347a)[_0x8404('0xb7')](_0x8404('0xb8'),'text/xml')[_0x8404('0x3c')](_0x8404('0xb9'));}else{return _0x10cc39[_0x8404('0x2d')](_0x10347a)[_0x8404('0xba')](_0x37fb5a);}}})[_0x8404('0x2b')](handleError(_0x10cc39,null));};exports[_0x8404('0xbb')]=function(_0x1f865c,_0x4f2e13){var _0x45be77=_0x1f865c[_0x8404('0x59')]['id'];var _0x11610e=_0x1f865c['body'];var _0x56e0bd=0xc8;var _0xd8d28a=null;return db[_0x8404('0xbc')]['transaction']({'isolationLevel':db[_0x8404('0xbc')][_0x8404('0xbd')]['ISOLATION_LEVELS'][_0x8404('0xbe')]},function(_0x3f8dc7){return db[_0x8404('0x3f')]['findOne']({'where':{'id':_0x45be77},'transaction':_0x3f8dc7})['then'](function(_0x510646){if(_0x510646){return db[_0x8404('0x6f')][_0x8404('0x36')]({'where':{'SmsAccountId':_0x45be77},'transaction':_0x3f8dc7})[_0x8404('0x22')](function(){var _0x46a05c=_['map'](_0x11610e,function(_0x43ef96){_0x43ef96[_0x8404('0x64')]=_0x45be77;return _0x43ef96;});return db['SmsApplication'][_0x8404('0xbf')](_0x46a05c,{'transaction':_0x3f8dc7});});}else{_0x56e0bd=0x194;_0xd8d28a=[];}});})[_0x8404('0x22')](function(){if(_0x56e0bd!==0x194){return db[_0x8404('0x6f')][_0x8404('0xc0')]({'where':{'SmsAccountId':_0x45be77},'order':'priority'})[_0x8404('0x22')](function(_0x1bc7dd){_0xd8d28a=_0x1bc7dd;});}})[_0x8404('0x2b')](function(_0x374b73){_0x56e0bd=0x1f4;logger[_0x8404('0x27')](_0x374b73[_0x8404('0x3a')]);if(_0x374b73[_0x8404('0x3b')]){delete _0x374b73[_0x8404('0x3b')];}_0xd8d28a=_0x374b73;})[_0x8404('0xc1')](function(){if(_0xd8d28a===null){_0x4f2e13['sendStatus'](_0x56e0bd);}else{if(_0x56e0bd===0x1f4){_0x4f2e13['status'](_0x56e0bd)[_0x8404('0x3c')](_0xd8d28a);}else{_0x4f2e13[_0x8404('0x2d')](_0x56e0bd)[_0x8404('0xba')](_0xd8d28a);}}});};exports['getApplications']=function(_0x1646f6,_0x1b1008,_0x5118c0){var _0x2bd80b={};var _0x560453={};var _0x7bea96;var _0x32e179;return db[_0x8404('0x3f')]['findOne']({'where':{'id':_0x1646f6[_0x8404('0x59')]['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x1b1008,null))[_0x8404('0x22')](function(_0x5cbdcd){if(_0x5cbdcd){_0x7bea96=_0x5cbdcd;_0x560453[_0x8404('0x46')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x560453[_0x8404('0x43')]=_[_0x8404('0x44')](_0x1646f6[_0x8404('0x43')]);_0x560453[_0x8404('0x4f')]=_[_0x8404('0x45')](_0x560453[_0x8404('0x46')],_0x560453[_0x8404('0x43')]);_0x2bd80b['attributes']=_[_0x8404('0x45')](_0x560453['model'],qs['fields'](_0x1646f6[_0x8404('0x43')][_0x8404('0x47')]));_0x2bd80b[_0x8404('0x49')]=_0x2bd80b[_0x8404('0x49')][_0x8404('0x48')]?_0x2bd80b[_0x8404('0x49')]:_0x560453[_0x8404('0x46')];_0x2bd80b[_0x8404('0x4c')]=qs['sort'](_0x1646f6[_0x8404('0x43')]['sort']);_0x2bd80b['where']=qs[_0x8404('0x4f')](_['pick'](_0x1646f6[_0x8404('0x43')],_0x560453[_0x8404('0x4f')]));if(_0x1646f6[_0x8404('0x43')][_0x8404('0x50')]){_0x2bd80b[_0x8404('0x52')]=_['merge'](_0x2bd80b['where'],{'$or':_[_0x8404('0x42')](_0x2bd80b[_0x8404('0x49')],function(_0x45c4c7){var _0x5bc977={};_0x5bc977[_0x45c4c7]={'$like':'%'+_0x1646f6[_0x8404('0x43')][_0x8404('0x50')]+'%'};return _0x5bc977;})});}_0x2bd80b=_[_0x8404('0x51')]({},_0x2bd80b,_0x1646f6['options']);return _0x7bea96[_0x8404('0xc2')](_0x2bd80b);}})[_0x8404('0x22')](function(_0x390096){if(_0x390096){_0x32e179=_0x390096[_0x8404('0x48')];if(!_0x1646f6['query'][_0x8404('0x4a')](_0x8404('0x4b'))){_0x2bd80b[_0x8404('0x30')]=qs['limit'](_0x1646f6[_0x8404('0x43')]['limit']);_0x2bd80b['offset']=qs[_0x8404('0x32')](_0x1646f6['query']['offset']);}return _0x7bea96[_0x8404('0xc2')](_0x2bd80b);}})[_0x8404('0x22')](function(_0x252cce){if(_0x252cce){return _0x252cce?{'count':_0x32e179,'rows':_0x252cce}:null;}})[_0x8404('0x22')](respondWithResult(_0x1b1008,null))['catch'](handleError(_0x1b1008,null));};exports[_0x8404('0xc3')]=function(_0x126979,_0x55dd4,_0x2e60eb){var _0x16cc59={'raw':![],'where':{}};var _0x34fa33={};var _0x1651ed={'count':0x0,'rows':[]};return db['SmsAccount'][_0x8404('0x6a')]({'where':{'id':_0x126979[_0x8404('0x59')]['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x55dd4,null))[_0x8404('0x22')](function(_0x1eaf57){if(_0x1eaf57){_0x34fa33['model']=_[_0x8404('0x44')](db[_0x8404('0xa1')][_0x8404('0x40')]);_0x34fa33[_0x8404('0x43')]=_[_0x8404('0x44')](_0x126979['query']);_0x34fa33['filters']=_[_0x8404('0x45')](_0x34fa33[_0x8404('0x46')],_0x34fa33[_0x8404('0x43')]);_0x16cc59['attributes']=_[_0x8404('0x45')](_0x34fa33['model'],qs[_0x8404('0x47')](_0x126979[_0x8404('0x43')]['fields']));_0x16cc59['attributes']=_0x16cc59[_0x8404('0x49')][_0x8404('0x48')]?_0x16cc59['attributes']:_0x34fa33[_0x8404('0x46')];if(!_0x126979['query'][_0x8404('0x4a')](_0x8404('0x4b'))){_0x16cc59[_0x8404('0x30')]=qs[_0x8404('0x30')](_0x126979[_0x8404('0x43')][_0x8404('0x30')]);_0x16cc59['offset']=qs['offset'](_0x126979['query'][_0x8404('0x32')]);}_0x16cc59[_0x8404('0x4c')]=qs[_0x8404('0x4d')](_0x126979['query'][_0x8404('0x4d')]);_0x16cc59[_0x8404('0x52')]=qs[_0x8404('0x4f')](_[_0x8404('0x4e')](_0x126979['query'],_0x34fa33['filters']));_0x16cc59[_0x8404('0x52')]['SmsAccountId']=_0x1eaf57['id'];if(_0x126979['query'][_0x8404('0x50')]){_0x16cc59[_0x8404('0x52')]=_[_0x8404('0x51')](_0x16cc59[_0x8404('0x52')],{'$or':_[_0x8404('0x42')](_0x16cc59[_0x8404('0x49')],function(_0x223fc6){var _0x4a9a37={};_0x4a9a37[_0x223fc6]={'$like':'%'+_0x126979[_0x8404('0x43')][_0x8404('0x50')]+'%'};return _0x4a9a37;})});}_0x16cc59=_[_0x8404('0x51')]({},_0x16cc59,_0x126979['options']);return db[_0x8404('0xa1')][_0x8404('0x31')]({'where':_0x16cc59[_0x8404('0x52')]})['then'](function(_0x2e2879){_0x1651ed['count']=_0x2e2879;if(_0x126979[_0x8404('0x43')][_0x8404('0x55')]){_0x16cc59[_0x8404('0x56')]=[{'model':db[_0x8404('0x76')],'as':_0x8404('0xc4'),'required':![]},{'model':db[_0x8404('0xad')],'as':_0x8404('0xc5'),'attributes':['name',_0x8404('0xc6'),'internal'],'required':![]},{'model':db[_0x8404('0xc7')],'as':_0x8404('0xc8'),'attributes':['id','name',_0x8404('0xc9')],'where':_0x126979[_0x8404('0x43')]['tag']?{'id':_0x126979[_0x8404('0x43')][_0x8404('0xca')]}:undefined,'required':_0x126979[_0x8404('0x43')][_0x8404('0xca')]?!![]:![]}];}return db[_0x8404('0xa1')][_0x8404('0x65')](_0x16cc59);})[_0x8404('0x22')](function(_0x25f3d7){_0x1651ed[_0x8404('0x57')]=_0x25f3d7;return _0x1651ed;});}})[_0x8404('0x22')](respondWithFilteredResult(_0x55dd4,_0x16cc59))[_0x8404('0x2b')](handleError(_0x55dd4,null));};exports[_0x8404('0x3c')]=function(_0x303edc,_0x5437f4,_0xeff881){var _0x38baeb,_0x59673e,_0x51075e;if(_[_0x8404('0x95')](_0x303edc[_0x8404('0x5b')][_0x8404('0x5b')])||_0x303edc[_0x8404('0x5b')][_0x8404('0x5b')]===''){throw new db['Sequelize'][(_0x8404('0x78'))](_0x8404('0x98'));}if(_[_0x8404('0x95')](_0x303edc['body']['to'])){throw new db[(_0x8404('0x96'))][(_0x8404('0x78'))](_0x8404('0xcb'));}_0x38baeb=_0x303edc['body']['to'];return db[_0x8404('0x3f')]['find']({'where':{'id':_0x303edc[_0x8404('0x59')]['id']},'include':[{'model':db[_0x8404('0x9c')],'as':'List','include':[{'model':db[_0x8404('0x76')],'as':_0x8404('0x9d'),'where':{'mobile':_0x38baeb},'limit':0x1,'order':[['updatedAt',_0x8404('0x9e')]]}]}]})[_0x8404('0x22')](handleEntityNotFound(_0x5437f4,null))[_0x8404('0x22')](function(_0x9f11bd){if(_0x9f11bd&&_0x9f11bd[_0x8404('0xcc')]){_0x59673e=_0x9f11bd['get']({'plain':!![]});if(_0x59673e[_0x8404('0xcc')]&&_0x59673e[_0x8404('0xcc')][_0x8404('0x9d')][_0x8404('0x48')]){return _0x59673e[_0x8404('0xcc')][_0x8404('0x9d')][0x0];}return db[_0x8404('0x76')][_0x8404('0x5a')](_[_0x8404('0xa0')](_0x303edc[_0x8404('0x5b')],{'firstName':_0x38baeb,'mobile':_0x38baeb,'phone':_0x38baeb,'ListId':_0x59673e[_0x8404('0x7e')]}));}})['then'](handleEntityNotFound(_0x5437f4,null))[_0x8404('0x22')](function(_0x5240f0){if(_0x5240f0){_0x51075e=_0x5240f0;return db[_0x8404('0xa1')][_0x8404('0x5e')]({'where':{'ContactId':_0x51075e['id'],'closed':![],'SmsAccountId':_0x59673e['id']}})[_0x8404('0x22')](function(_0x5a94db){if(_0x5a94db){return[_0x5a94db,![]];}return db[_0x8404('0xa1')]['create']({'UserId':_0x303edc[_0x8404('0xcd')]['id'],'ContactId':_0x51075e['id'],'SmsAccountId':_0x59673e['id'],'phone':_0x38baeb,'firstMsgDirection':_0x8404('0xce'),'Messages':[_['merge'](_0x303edc[_0x8404('0x5b')],{'read':![],'body':_0x303edc[_0x8404('0x5b')]['body'],'phone':_0x38baeb,'SmsAccountId':_0x59673e['id'],'UserId':_0x303edc['user']['id'],'ContactId':_0x51075e['id']})]},{'include':[{'model':db[_0x8404('0xaa')],'as':_0x8404('0xcf')}]})[_0x8404('0x22')](function(_0x25a36b){return[_0x25a36b,!![]];});});}})[_0x8404('0xa2')](function(_0x5d7fde,_0x14aff6){if(_0x14aff6){return _0x5d7fde;}return db['SmsMessage']['create'](_[_0x8404('0x51')](_0x303edc[_0x8404('0x5b')],{'read':![],'body':_0x303edc[_0x8404('0x5b')][_0x8404('0x5b')],'phone':_0x38baeb,'SmsAccountId':_0x59673e['id'],'SmsInteractionId':_0x5d7fde['id'],'UserId':_0x303edc[_0x8404('0xcd')]['id'],'ContactId':_0x51075e['id']}))[_0x8404('0x22')](function(_0x25386d){_0x5d7fde[_0x8404('0xd0')]['Messages']=[];_0x5d7fde['dataValues']['Messages'][_0x8404('0xa6')](_0x25386d[_0x8404('0xd0')]);return _0x5d7fde;});})[_0x8404('0x22')](respondWithResult(_0x5437f4,null))['catch'](handleError(_0x5437f4,null));};exports[_0x8404('0x2d')]=function(_0x2556b5,_0x9367da,_0x45d203){if(_0x2556b5[_0x8404('0x5b')]['id']){delete _0x2556b5[_0x8404('0x5b')]['id'];}var _0x2828df,_0x36e54a,_0x57890f;return db[_0x8404('0x3f')]['find']({'where':{'id':_0x2556b5[_0x8404('0x59')]['id']}})['then'](handleEntityNotFound(_0x9367da,null))[_0x8404('0x22')](function(_0x2e96d9){if(_0x2e96d9){_0x57890f=_0x2e96d9;logger['debug'](_0x8404('0x26'),_0x8404('0x2d'),_0x8404('0xd1'),_0x2e96d9[_0x8404('0x80')],util[_0x8404('0xd2')](_0x2556b5[_0x8404('0x5b')],{'showHidden':![],'depth':null}));switch(_0x2e96d9[_0x8404('0x80')]){case _0x8404('0xd3'):if(_0x2556b5['body'][_0x8404('0xd4')]&&_0x2556b5[_0x8404('0x5b')][_0x8404('0x2d')]){_0x36e54a=_0x2556b5[_0x8404('0x5b')][_0x8404('0x2d')];return db[_0x8404('0xaa')][_0x8404('0x5e')]({'where':{'messageId':_0x2556b5[_0x8404('0x5b')]['skebby_dispatch_id']}});}break;case _0x8404('0xd5'):if(_0x2556b5[_0x8404('0x5b')][_0x8404('0xd6')]&&_0x2556b5[_0x8404('0x5b')][_0x8404('0xd7')]){_0x36e54a=_0x2556b5[_0x8404('0x5b')][_0x8404('0xd7')];return db[_0x8404('0xaa')]['find']({'where':{'messageId':_0x2556b5[_0x8404('0x5b')][_0x8404('0xd6')]}});}break;case _0x8404('0x88'):if(_0x2556b5[_0x8404('0x5b')][_0x8404('0x89')]&&_0x2556b5[_0x8404('0x5b')][_0x8404('0xd8')]){_0x36e54a=_0x2556b5['body']['status_code'];return db[_0x8404('0xaa')][_0x8404('0x5e')]({'where':{'messageId':_0x2556b5['body'][_0x8404('0x89')]}});}break;case'infobip':var _0x3ffc0a=_0x2556b5[_0x8404('0x5b')][_0x8404('0x8c')][0x0];if(_0x3ffc0a[_0x8404('0x84')]&&_0x3ffc0a['status'][_0x8404('0xd9')]==='DELIVERED'){_0x36e54a=_0x3ffc0a[_0x8404('0x2d')][_0x8404('0xd9')];return db['SmsMessage'][_0x8404('0x5e')]({'where':{'messageId':_0x3ffc0a[_0x8404('0x84')]}});}break;case _0x8404('0x90'):if(_0x2556b5[_0x8404('0x5b')][_0x8404('0x84')]&&_0x2556b5[_0x8404('0x5b')][_0x8404('0x2d')]){_0x36e54a=_0x2556b5[_0x8404('0x5b')][_0x8404('0x2d')];return db[_0x8404('0xaa')][_0x8404('0x5e')]({'where':{'messageId':_0x2556b5[_0x8404('0x5b')][_0x8404('0x84')]}});}break;case _0x8404('0x92'):if(_0x2556b5[_0x8404('0x5b')][0x0][_0x8404('0x29')]['id']){_0x36e54a=_0x2556b5[_0x8404('0x5b')][0x0][_0x8404('0x80')];return db[_0x8404('0xaa')][_0x8404('0x5e')]({'where':{'messageId':_0x2556b5[_0x8404('0x5b')][0x0]['message']['id']}});}break;case _0x8404('0x93'):if(_0x2556b5[_0x8404('0x5b')]['redif']&&_0x2556b5['body'][_0x8404('0x2d')]){_0x36e54a=_0x2556b5['body'][_0x8404('0x2d')];return db[_0x8404('0xaa')][_0x8404('0x5e')]({'where':{'messageId':_0x2556b5[_0x8404('0x5b')]['redif']}});}break;}}})[_0x8404('0x22')](handleEntityNotFound(_0x9367da,null))['then'](function(_0x1f713b){if(_0x1f713b){_0x2828df=_0x1f713b;switch(_0x57890f[_0x8404('0x80')]){case'skebby':if(_0x36e54a===_0x8404('0xda')){return _0x2828df[_0x8404('0x35')]({'read':!![]});}else{logger[_0x8404('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8404('0x2d'),_0x8404('0xd3'),util[_0x8404('0xd2')](_0x2556b5[_0x8404('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8404('0xd5'):if(_0x36e54a==='1'){return _0x2828df[_0x8404('0x35')]({'read':!![]});}else{logger['error'](_0x8404('0x26'),_0x8404('0x2d'),'skebby',util['inspect'](_0x2556b5[_0x8404('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8404('0x88'):if(!_0x2556b5['body'][_0x8404('0xdb')]&&_0x36e54a>=0xc8&&_0x36e54a<=0xce){return _0x2828df[_0x8404('0x35')]({'read':!![]});}else{logger[_0x8404('0x27')](_0x8404('0x26'),_0x8404('0x2d'),_0x8404('0x88'),util[_0x8404('0xd2')](_0x2556b5[_0x8404('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8404('0x8b'):var _0x22d879=_0x2556b5['body'][_0x8404('0x8c')][0x0];if(_0x22d879['status']['groupName']===_0x8404('0xda')){return _0x2828df[_0x8404('0x35')]({'read':!![]});}else{logger[_0x8404('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8404('0x2d'),_0x8404('0x8b'),util[_0x8404('0xd2')](_0x2556b5[_0x8404('0x5b')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x36e54a==_0x8404('0xdc')||_0x36e54a==_0x8404('0xdd')){return _0x2828df[_0x8404('0x35')]({'read':!![]});}else{logger[_0x8404('0x27')](_0x8404('0x26'),_0x8404('0x2d'),'clickatell',util[_0x8404('0xd2')](_0x2556b5[_0x8404('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x36e54a==_0x8404('0xde')){return _0x2828df[_0x8404('0x35')]({'read':!![]});}else{logger[_0x8404('0x27')](_0x8404('0x26'),_0x8404('0x2d'),_0x8404('0x92'),util[_0x8404('0xd2')](_0x2556b5[_0x8404('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8404('0x93'):if(_0x36e54a===_0x8404('0xdf')||_0x36e54a==='ACCEPTD'){return _0x2828df[_0x8404('0x35')]({'read':!![]});}else{logger['error'](_0x8404('0x26'),_0x8404('0x2d'),_0x8404('0x93'),util[_0x8404('0xd2')](_0x2556b5[_0x8404('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2828df;}})[_0x8404('0x22')](respondWithResult(_0x9367da,null))[_0x8404('0x2b')](handleError(_0x9367da,null));};exports[_0x8404('0xe0')]=function(_0x4c17dd,_0xd450d8,_0x118f6c){var _0x532e05,_0x294b25,_0x31286b;return db[_0x8404('0x3f')][_0x8404('0x5e')]({'where':{'id':_0x4c17dd['params']['id']}})['then'](handleEntityNotFound(_0xd450d8,null))[_0x8404('0x22')](function(_0x229c26){if(_0x229c26){_0x31286b=_0x229c26;logger['debug'](_0x8404('0x26'),'status',_0x8404('0xd1'),_0x229c26[_0x8404('0x80')],util[_0x8404('0xd2')](_0x4c17dd[_0x8404('0x43')],{'showHidden':![],'depth':null}));switch(_0x229c26[_0x8404('0x80')]){case _0x8404('0x8d'):if(_0x4c17dd[_0x8404('0x43')][_0x8404('0xe1')]&&_0x4c17dd[_0x8404('0x43')]['state']){_0x294b25=_0x4c17dd[_0x8404('0x43')]['state'];return db['SmsMessage'][_0x8404('0x5e')]({'where':{'messageId':_0x4c17dd[_0x8404('0x43')][_0x8404('0xe1')]}});}break;}}})[_0x8404('0x22')](handleEntityNotFound(_0xd450d8,null))[_0x8404('0x22')](function(_0x1dc71){if(_0x1dc71){_0x532e05=_0x1dc71;switch(_0x31286b[_0x8404('0x80')]){case _0x8404('0x8d'):if(_0x294b25==='2'||_0x294b25==='6'){return _0x532e05[_0x8404('0x35')]({'read':!![]});}else{logger[_0x8404('0x27')](_0x8404('0x26'),_0x8404('0x2d'),_0x8404('0x8d'),util['inspect'](_0x4c17dd['query'],{'showHidden':![],'depth':null}));};break;}return _0x532e05;}})[_0x8404('0x22')](respondWithResult(_0xd450d8,null))[_0x8404('0x2b')](handleError(_0xd450d8,null));};exports['addAgents']=function(_0x552c4f,_0x4059e5,_0x24d089){return db[_0x8404('0x3f')][_0x8404('0x5e')]({'where':{'id':_0x552c4f[_0x8404('0x59')]['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x4059e5,null))[_0x8404('0x22')](function(_0x1836b0){if(_0x1836b0){return _0x1836b0[_0x8404('0xe2')](_0x552c4f[_0x8404('0x5b')][_0x8404('0x67')],_[_0x8404('0xe3')](_0x552c4f[_0x8404('0x5b')],[_0x8404('0x67'),'id'])||{})[_0x8404('0xa2')](function(_0x1150a7){for(var _0x4b063e=0x0;_0x4b063e<_0x552c4f[_0x8404('0x5b')][_0x8404('0x67')][_0x8404('0x48')];_0x4b063e+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x552c4f[_0x8404('0x5b')][_0x8404('0x67')][_0x4b063e]),'SmsAccountId':Number(_0x552c4f['params']['id'])});}return _0x1150a7;});}})[_0x8404('0x22')](respondWithResult(_0x4059e5,null))[_0x8404('0x2b')](handleError(_0x4059e5,null));};exports[_0x8404('0xe4')]=function(_0x34ceba,_0x290874,_0x50bc8e){return db['SmsAccount'][_0x8404('0x5e')]({'where':{'id':_0x34ceba[_0x8404('0x59')]['id']}})['then'](handleEntityNotFound(_0x290874,null))[_0x8404('0x22')](function(_0x36d401){if(_0x36d401){return _0x36d401[_0x8404('0xe4')](_0x34ceba['query']['ids'])[_0x8404('0x22')](function(){if(_[_0x8404('0xe5')](_0x34ceba['query'][_0x8404('0x67')])){for(var _0x3119ad=0x0;_0x3119ad<_0x34ceba['query'][_0x8404('0x67')][_0x8404('0x48')];_0x3119ad+=0x1){socket[_0x8404('0xe6')](_0x8404('0xe7'),{'UserId':Number(_0x34ceba[_0x8404('0x43')]['ids'][_0x3119ad]),'SmsAccountId':Number(_0x34ceba[_0x8404('0x59')]['id'])});}}else{socket[_0x8404('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0x34ceba[_0x8404('0x43')][_0x8404('0x67')]),'SmsAccountId':Number(_0x34ceba[_0x8404('0x59')]['id'])});}});}})[_0x8404('0x22')](respondWithStatusCode(_0x290874,null))[_0x8404('0x2b')](handleError(_0x290874,null));};exports[_0x8404('0xe8')]=function(_0x48d5e3,_0x535a58,_0x7c292){var _0x1afb5f={};var _0x1be7d0={};var _0x2efde6;var _0x53f1dd;return db['SmsAccount'][_0x8404('0x6a')]({'where':{'id':_0x48d5e3[_0x8404('0x59')]['id']}})[_0x8404('0x22')](handleEntityNotFound(_0x535a58,null))['then'](function(_0x4e9476){if(_0x4e9476){_0x2efde6=_0x4e9476;_0x1be7d0[_0x8404('0x46')]=_[_0x8404('0x44')](db[_0x8404('0xad')][_0x8404('0x40')]);_0x1be7d0[_0x8404('0x43')]=_[_0x8404('0x44')](_0x48d5e3[_0x8404('0x43')]);_0x1be7d0[_0x8404('0x4f')]=_['intersection'](_0x1be7d0[_0x8404('0x46')],_0x1be7d0[_0x8404('0x43')]);_0x1afb5f[_0x8404('0x49')]=_[_0x8404('0x45')](_0x1be7d0[_0x8404('0x46')],qs[_0x8404('0x47')](_0x48d5e3['query'][_0x8404('0x47')]));_0x1afb5f[_0x8404('0x49')]=_0x1afb5f[_0x8404('0x49')]['length']?_0x1afb5f[_0x8404('0x49')]:_0x1be7d0[_0x8404('0x46')];_0x1afb5f['order']=qs[_0x8404('0x4d')](_0x48d5e3['query'][_0x8404('0x4d')]);_0x1afb5f[_0x8404('0x52')]=qs[_0x8404('0x4f')](_[_0x8404('0x4e')](_0x48d5e3['query'],_0x1be7d0[_0x8404('0x4f')]));if(_0x48d5e3[_0x8404('0x43')][_0x8404('0x50')]){_0x1afb5f[_0x8404('0x52')]=_[_0x8404('0x51')](_0x1afb5f[_0x8404('0x52')],{'$or':_[_0x8404('0x42')](_0x1afb5f[_0x8404('0x49')],function(_0xe34f5a){var _0xa11e9c={};_0xa11e9c[_0xe34f5a]={'$like':'%'+_0x48d5e3[_0x8404('0x43')]['filter']+'%'};return _0xa11e9c;})});}_0x1afb5f=_[_0x8404('0x51')]({},_0x1afb5f,_0x48d5e3[_0x8404('0x54')]);return _0x2efde6['getAgents'](_0x1afb5f);}})[_0x8404('0x22')](function(_0x1cf2be){if(_0x1cf2be){_0x53f1dd=_0x1cf2be[_0x8404('0x48')];if(!_0x48d5e3[_0x8404('0x43')][_0x8404('0x4a')](_0x8404('0x4b'))){_0x1afb5f['limit']=qs[_0x8404('0x30')](_0x48d5e3[_0x8404('0x43')]['limit']);_0x1afb5f['offset']=qs['offset'](_0x48d5e3['query'][_0x8404('0x32')]);}return _0x2efde6[_0x8404('0xe8')](_0x1afb5f);}})[_0x8404('0x22')](function(_0x28818b){if(_0x28818b){return _0x28818b?{'count':_0x53f1dd,'rows':_0x28818b}:null;}})[_0x8404('0x22')](respondWithResult(_0x535a58,null))[_0x8404('0x2b')](handleError(_0x535a58,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 66e916e..e4ad29d 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 _0x08b9=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x08b9,0xa3));var _0x908b=function(_0x4a22c5,_0x5ac44b){_0x4a22c5=_0x4a22c5-0x0;var _0x5ba569=_0x08b9[_0x4a22c5];return _0x5ba569;};'use strict';var EventEmitter=require(_0x908b('0x0'));var SmsAccount=require(_0x908b('0x1'))['db'][_0x908b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x908b('0x3')](0x0);var events={'afterCreate':_0x908b('0x4'),'afterUpdate':'update','afterDestroy':_0x908b('0x5')};function emitEvent(_0x51ebb7){return function(_0x363707,_0x354f2a,_0x4e4c33){SmsAccountEvents[_0x908b('0x6')](_0x51ebb7+':'+_0x363707['id'],_0x363707);SmsAccountEvents[_0x908b('0x6')](_0x51ebb7,_0x363707);_0x4e4c33(null);};}for(var e in events){if(events[_0x908b('0x7')](e)){var event=events[e];SmsAccount[_0x908b('0x8')](e,emitEvent(event));}}module[_0x908b('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x3200=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save','update','remove','emit'];(function(_0x4be36f,_0x20fdbc){var _0x644d28=function(_0x4a89bf){while(--_0x4a89bf){_0x4be36f['push'](_0x4be36f['shift']());}};_0x644d28(++_0x20fdbc);}(_0x3200,0x139));var _0x0320=function(_0x17caf5,_0xa140a6){_0x17caf5=_0x17caf5-0x0;var _0x52da11=_0x3200[_0x17caf5];return _0x52da11;};'use strict';var EventEmitter=require(_0x0320('0x0'));var SmsAccount=require(_0x0320('0x1'))['db'][_0x0320('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0320('0x3'),'afterUpdate':_0x0320('0x4'),'afterDestroy':_0x0320('0x5')};function emitEvent(_0x44b1c4){return function(_0x1fab80,_0x5a313d,_0x557de0){SmsAccountEvents[_0x0320('0x6')](_0x44b1c4+':'+_0x1fab80['id'],_0x1fab80);SmsAccountEvents[_0x0320('0x6')](_0x44b1c4,_0x1fab80);_0x557de0(null);};}for(var e in events){if(events[_0x0320('0x7')](e)){var event=events[e];SmsAccount[_0x0320('0x8')](e,emitEvent(event));}}module[_0x0320('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3ade6cb..472704d 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 _0x0e27=['define','SmsAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0e27,0x7a));var _0x70e2=function(_0x2fadf7,_0x2bfc9d){_0x2fadf7=_0x2fadf7-0x0;var _0x5bccca=_0x0e27[_0x2fadf7];return _0x5bccca;};'use strict';var _=require('lodash');var util=require(_0x70e2('0x0'));var logger=require(_0x70e2('0x1'))(_0x70e2('0x2'));var moment=require(_0x70e2('0x3'));var BPromise=require(_0x70e2('0x4'));var rp=require(_0x70e2('0x5'));var fs=require('fs');var path=require(_0x70e2('0x6'));var rimraf=require(_0x70e2('0x7'));var config=require('../../config/environment');var attributes=require(_0x70e2('0x8'));module[_0x70e2('0x9')]=function(_0x23296e,_0x45af19){return _0x23296e[_0x70e2('0xa')](_0x70e2('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb480=['bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api'];(function(_0x30a797,_0x774e2d){var _0x257f66=function(_0x2a3190){while(--_0x2a3190){_0x30a797['push'](_0x30a797['shift']());}};_0x257f66(++_0x774e2d);}(_0xb480,0xb2));var _0x0b48=function(_0x2f279a,_0x3acb74){_0x2f279a=_0x2f279a-0x0;var _0x183d73=_0xb480[_0x2f279a];return _0x183d73;};'use strict';var _=require(_0x0b48('0x0'));var util=require(_0x0b48('0x1'));var logger=require(_0x0b48('0x2'))(_0x0b48('0x3'));var moment=require('moment');var BPromise=require(_0x0b48('0x4'));var rp=require(_0x0b48('0x5'));var fs=require('fs');var path=require(_0x0b48('0x6'));var rimraf=require(_0x0b48('0x7'));var config=require(_0x0b48('0x8'));var attributes=require(_0x0b48('0x9'));module[_0x0b48('0xa')]=function(_0x141107,_0x1d5a39){return _0x141107[_0x0b48('0xb')](_0x0b48('0xc'),attributes,{'tableName':_0x0b48('0xd'),'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 1db917c..7b1e61a 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 _0x4f4f=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SmsAccount','find','options','raw','attributes','map','include','model','then','ShowSmsAccount','util','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x25572a,_0x5debf7){var _0x4da0b5=function(_0xb04fa3){while(--_0xb04fa3){_0x25572a['push'](_0x25572a['shift']());}};_0x4da0b5(++_0x5debf7);}(_0x4f4f,0x1a8));var _0xf4f4=function(_0x553183,_0x5479b4){_0x553183=_0x553183-0x0;var _0xfc0ebe=_0x4f4f[_0x553183];return _0xfc0ebe;};'use strict';var _=require('lodash');var util=require(_0xf4f4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4f4('0x1'));var db=require(_0xf4f4('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4f4('0x3'))(_0xf4f4('0x4'));var config=require(_0xf4f4('0x5'));var jayson=require(_0xf4f4('0x6'));var client=jayson['client'][_0xf4f4('0x7')]({'port':0x232a});config[_0xf4f4('0x8')]=_[_0xf4f4('0x9')](config[_0xf4f4('0x8')],{'host':_0xf4f4('0xa'),'port':0x18eb});var socket=require(_0xf4f4('0xb'))(new Redis(config[_0xf4f4('0x8')]));require('./smsAccount.socket')[_0xf4f4('0xc')](socket);function respondWithRpcPromise(_0x4c72b6,_0x33605a,_0xf53454){return new BPromise(function(_0x505b32,_0x312506){return client[_0xf4f4('0xd')](_0x4c72b6,_0xf53454)['then'](function(_0x2e1619){logger[_0xf4f4('0xe')](_0xf4f4('0xf'),_0x33605a,_0xf4f4('0x10'));logger[_0xf4f4('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x33605a,_0xf4f4('0x10'),JSON[_0xf4f4('0x12')](_0x2e1619));if(_0x2e1619[_0xf4f4('0x13')]){if(_0x2e1619['error'][_0xf4f4('0x14')]===0x1f4){logger[_0xf4f4('0x13')](_0xf4f4('0xf'),_0x33605a,_0x2e1619[_0xf4f4('0x13')][_0xf4f4('0x15')]);return _0x312506(_0x2e1619[_0xf4f4('0x13')][_0xf4f4('0x15')]);}logger[_0xf4f4('0x13')]('SmsAccount,\x20%s,\x20%s',_0x33605a,_0x2e1619[_0xf4f4('0x13')][_0xf4f4('0x15')]);return _0x505b32(_0x2e1619[_0xf4f4('0x13')]['message']);}else{logger[_0xf4f4('0xe')](_0xf4f4('0xf'),_0x33605a,_0xf4f4('0x10'));_0x505b32(_0x2e1619['result'][_0xf4f4('0x15')]);}})[_0xf4f4('0x16')](function(_0x83def6){logger[_0xf4f4('0x13')](_0xf4f4('0xf'),_0x33605a,_0x83def6);_0x312506(_0x83def6);});});}exports['ShowSmsAccount']=function(_0x2f674f){var _0x3a666c=this;return new Promise(function(_0x547e73,_0x58edd9){return db[_0xf4f4('0x17')][_0xf4f4('0x18')]({'raw':_0x2f674f[_0xf4f4('0x19')]?_0x2f674f[_0xf4f4('0x19')][_0xf4f4('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f674f[_0xf4f4('0x19')]?_0x2f674f['options']['where']||null:null,'attributes':_0x2f674f[_0xf4f4('0x19')]?_0x2f674f[_0xf4f4('0x19')][_0xf4f4('0x1b')]||null:null,'include':_0x2f674f['options']?_0x2f674f['options']['include']?_[_0xf4f4('0x1c')](_0x2f674f[_0xf4f4('0x19')][_0xf4f4('0x1d')],function(_0x37816b){return{'model':db[_0x37816b[_0xf4f4('0x1e')]],'as':_0x37816b['as'],'attributes':_0x37816b['attributes'],'include':_0x37816b['include']?_[_0xf4f4('0x1c')](_0x37816b[_0xf4f4('0x1d')],function(_0x2dff17){return{'model':db[_0x2dff17[_0xf4f4('0x1e')]],'as':_0x2dff17['as'],'attributes':_0x2dff17[_0xf4f4('0x1b')],'include':_0x2dff17[_0xf4f4('0x1d')]?_[_0xf4f4('0x1c')](_0x2dff17[_0xf4f4('0x1d')],function(_0x317892){return{'model':db[_0x317892['model']],'as':_0x317892['as'],'attributes':_0x317892['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4f4('0x1f')](function(_0xa8ffa4){logger[_0xf4f4('0xe')](_0xf4f4('0x20'),_0x2f674f);logger[_0xf4f4('0x11')](_0xf4f4('0x20'),_0x2f674f,JSON[_0xf4f4('0x12')](_0xa8ffa4));_0x547e73(_0xa8ffa4);})[_0xf4f4('0x16')](function(_0xb1b4fb){logger[_0xf4f4('0x13')]('ShowSmsAccount',_0xb1b4fb['message'],_0x2f674f);_0x58edd9(_0x3a666c[_0xf4f4('0x13')](0x1f4,_0xb1b4fb[_0xf4f4('0x15')]));});});}; \ No newline at end of file +var _0x5d07=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','then','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d07,0xa2));var _0x75d0=function(_0x32abb6,_0x102ffb){_0x32abb6=_0x32abb6-0x0;var _0x4c353a=_0x5d07[_0x32abb6];return _0x4c353a;};'use strict';var _=require(_0x75d0('0x0'));var util=require(_0x75d0('0x1'));var moment=require(_0x75d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x75d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75d0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x75d0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x75d0('0x6')][_0x75d0('0x7')]({'port':0x232a});config[_0x75d0('0x8')]=_[_0x75d0('0x9')](config[_0x75d0('0x8')],{'host':_0x75d0('0xa'),'port':0x18eb});var socket=require(_0x75d0('0xb'))(new Redis(config['redis']));require(_0x75d0('0xc'))[_0x75d0('0xd')](socket);function respondWithRpcPromise(_0x2451d0,_0x208b2f,_0x333be7){return new BPromise(function(_0x52d662,_0x1ae3b9){return client[_0x75d0('0xe')](_0x2451d0,_0x333be7)['then'](function(_0x1d070e){logger[_0x75d0('0xf')](_0x75d0('0x10'),_0x208b2f,_0x75d0('0x11'));logger[_0x75d0('0x12')](_0x75d0('0x13'),_0x208b2f,_0x75d0('0x11'),JSON[_0x75d0('0x14')](_0x1d070e));if(_0x1d070e[_0x75d0('0x15')]){if(_0x1d070e['error'][_0x75d0('0x16')]===0x1f4){logger[_0x75d0('0x15')](_0x75d0('0x10'),_0x208b2f,_0x1d070e[_0x75d0('0x15')][_0x75d0('0x17')]);return _0x1ae3b9(_0x1d070e[_0x75d0('0x15')][_0x75d0('0x17')]);}logger[_0x75d0('0x15')]('SmsAccount,\x20%s,\x20%s',_0x208b2f,_0x1d070e[_0x75d0('0x15')][_0x75d0('0x17')]);return _0x52d662(_0x1d070e['error'][_0x75d0('0x17')]);}else{logger['info'](_0x75d0('0x10'),_0x208b2f,_0x75d0('0x11'));_0x52d662(_0x1d070e['result'][_0x75d0('0x17')]);}})['catch'](function(_0x19c00a){logger[_0x75d0('0x15')](_0x75d0('0x10'),_0x208b2f,_0x19c00a);_0x1ae3b9(_0x19c00a);});});}exports[_0x75d0('0x18')]=function(_0x1190a3){var _0x1896b0=this;return new Promise(function(_0x17e3ab,_0x1db0f5){return db[_0x75d0('0x19')][_0x75d0('0x1a')]({'raw':_0x1190a3[_0x75d0('0x1b')]?_0x1190a3[_0x75d0('0x1b')][_0x75d0('0x1c')]===undefined?!![]:![]:!![],'where':_0x1190a3[_0x75d0('0x1b')]?_0x1190a3[_0x75d0('0x1b')][_0x75d0('0x1d')]||null:null,'attributes':_0x1190a3[_0x75d0('0x1b')]?_0x1190a3['options'][_0x75d0('0x1e')]||null:null,'include':_0x1190a3['options']?_0x1190a3[_0x75d0('0x1b')][_0x75d0('0x1f')]?_['map'](_0x1190a3[_0x75d0('0x1b')]['include'],function(_0x390a93){return{'model':db[_0x390a93['model']],'as':_0x390a93['as'],'attributes':_0x390a93['attributes'],'include':_0x390a93[_0x75d0('0x1f')]?_[_0x75d0('0x20')](_0x390a93['include'],function(_0x20106a){return{'model':db[_0x20106a[_0x75d0('0x21')]],'as':_0x20106a['as'],'attributes':_0x20106a[_0x75d0('0x1e')],'include':_0x20106a['include']?_[_0x75d0('0x20')](_0x20106a['include'],function(_0x3eb4a9){return{'model':db[_0x3eb4a9[_0x75d0('0x21')]],'as':_0x3eb4a9['as'],'attributes':_0x3eb4a9[_0x75d0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x75d0('0x22')](function(_0x2f949b){logger[_0x75d0('0xf')](_0x75d0('0x18'),_0x1190a3);logger[_0x75d0('0x12')](_0x75d0('0x18'),_0x1190a3,JSON[_0x75d0('0x14')](_0x2f949b));_0x17e3ab(_0x2f949b);})[_0x75d0('0x23')](function(_0x4d5761){logger['error'](_0x75d0('0x18'),_0x4d5761[_0x75d0('0x17')],_0x1190a3);_0x1db0f5(_0x1896b0[_0x75d0('0x15')](0x1f4,_0x4d5761[_0x75d0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 56cf7dd..d542c23 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(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 23f0d01..80cd7a9 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(_0x464889,_0x10045){var _0x3d66a4=function(_0x249969){while(--_0x249969){_0x464889['push'](_0x464889['shift']());}};_0x3d66a4(++_0x10045);}(_0x008c,0x188));var _0xc008=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x008c[_0x2aec52];return _0x3b8835;};'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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x535754,_0x225a9d){var _0x16e5df=function(_0x1c615b){while(--_0x1c615b){_0x535754['push'](_0x535754['shift']());}};_0x16e5df(++_0x225a9d);}(_0x55ca,0x126));var _0xa55c=function(_0xea98ab,_0x297344){_0xea98ab=_0xea98ab-0x0;var _0x39058e=_0x55ca[_0xea98ab];return _0x39058e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 5a16c0f..0853884 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 _0x41c6=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x2ec498,_0xe698dd){var _0x156726=function(_0x258a4a){while(--_0x258a4a){_0x2ec498['push'](_0x2ec498['shift']());}};_0x156726(++_0xe698dd);}(_0x41c6,0xe0));var _0x641c=function(_0x1e9950,_0x5db1c6){_0x1e9950=_0x1e9950-0x0;var _0x8f6b95=_0x41c6[_0x1e9950];return _0x8f6b95;};'use strict';var Sequelize=require(_0x641c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x641c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x641c('0x2')],'allowNull':![],'defaultValue':_0x641c('0x3')},'appdata':{'type':Sequelize[_0x641c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x641c('0x2')],'defaultValue':_0x641c('0x5')}}; \ No newline at end of file +var _0xf36e=['noop','TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x1e28a7,_0x3b1532){var _0x3bc69f=function(_0x4da5b2){while(--_0x4da5b2){_0x1e28a7['push'](_0x1e28a7['shift']());}};_0x3bc69f(++_0x3b1532);}(_0xf36e,0xb7));var _0xef36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf36e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xef36('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xef36('0x1')],'allowNull':![],'defaultValue':_0xef36('0x2')},'appdata':{'type':Sequelize[_0xef36('0x3')]()},'description':{'type':Sequelize[_0xef36('0x1')]},'interval':{'type':Sequelize[_0xef36('0x1')],'defaultValue':_0xef36('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6dce057..fbd9744 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 _0x88e5=['catch','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','SmsApplication','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows'];(function(_0x54a3d0,_0x26b80c){var _0x3f898f=function(_0x423c8b){while(--_0x423c8b){_0x54a3d0['push'](_0x54a3d0['shift']());}};_0x3f898f(++_0x26b80c);}(_0x88e5,0xe3));var _0x588e=function(_0x35f3d5,_0x4cd1aa){_0x35f3d5=_0x35f3d5-0x0;var _0x2828ec=_0x88e5[_0x35f3d5];return _0x2828ec;};'use strict';var emlformat=require(_0x588e('0x0'));var rimraf=require(_0x588e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x588e('0x2'));var rp=require(_0x588e('0x3'));var moment=require(_0x588e('0x4'));var BPromise=require(_0x588e('0x5'));var Mustache=require(_0x588e('0x6'));var util=require(_0x588e('0x7'));var path=require(_0x588e('0x8'));var sox=require(_0x588e('0x9'));var csv=require(_0x588e('0xa'));var ejs=require(_0x588e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x588e('0xc'));var squel=require('squel');var crypto=require(_0x588e('0xd'));var jsforce=require(_0x588e('0xe'));var deskjs=require(_0x588e('0xf'));var toCsv=require(_0x588e('0xa'));var querystring=require(_0x588e('0x10'));var Papa=require('papaparse');var Redis=require(_0x588e('0x11'));var authService=require(_0x588e('0x12'));var qs=require(_0x588e('0x13'));var as=require(_0x588e('0x14'));var hardwareService=require(_0x588e('0x15'));var logger=require('../../config/logger')(_0x588e('0x16'));var utils=require('../../config/utils');var config=require(_0x588e('0x17'));var licenseUtil=require(_0x588e('0x18'));var db=require(_0x588e('0x19'))['db'];function respondWithStatusCode(_0x3d00f0,_0x5b5ad7){_0x5b5ad7=_0x5b5ad7||0xcc;return function(_0x295d6a){if(_0x295d6a){return _0x3d00f0[_0x588e('0x1a')](_0x5b5ad7);}return _0x3d00f0['status'](_0x5b5ad7)[_0x588e('0x1b')]();};}function respondWithResult(_0x185307,_0x111fe1){_0x111fe1=_0x111fe1||0xc8;return function(_0x4f841b){if(_0x4f841b){return _0x185307[_0x588e('0x1c')](_0x111fe1)[_0x588e('0x1d')](_0x4f841b);}};}function respondWithFilteredResult(_0x217b1a,_0x303ba2){return function(_0x5db324){if(_0x5db324){var _0x479459=typeof _0x303ba2[_0x588e('0x1e')]===_0x588e('0x1f')&&typeof _0x303ba2[_0x588e('0x20')]===_0x588e('0x1f');var _0x4e900f=_0x5db324[_0x588e('0x21')];var _0x1d0750=_0x479459?0x0:_0x303ba2[_0x588e('0x1e')];var _0x2fb34f=_0x479459?_0x5db324[_0x588e('0x21')]:_0x303ba2[_0x588e('0x1e')]+_0x303ba2[_0x588e('0x20')];var _0x2795eb;if(_0x2fb34f>=_0x4e900f){_0x2fb34f=_0x4e900f;_0x2795eb=0xc8;}else{_0x2795eb=0xce;}_0x217b1a[_0x588e('0x1c')](_0x2795eb);return _0x217b1a[_0x588e('0x22')](_0x588e('0x23'),_0x1d0750+'-'+_0x2fb34f+'/'+_0x4e900f)['json'](_0x5db324);}return null;};}function patchUpdates(_0x460e1d){return function(_0x158be5){try{jsonpatch['apply'](_0x158be5,_0x460e1d,!![]);}catch(_0x4f5b4f){return BPromise['reject'](_0x4f5b4f);}return _0x158be5['save']();};}function saveUpdates(_0x2ebb63,_0xefcc48){return function(_0xc83555){if(_0xc83555){return _0xc83555[_0x588e('0x24')](_0x2ebb63)[_0x588e('0x25')](function(_0x5c172c){return _0x5c172c;});}return null;};}function removeEntity(_0x2cbb95,_0x1c1693){return function(_0x2a86ec){if(_0x2a86ec){return _0x2a86ec[_0x588e('0x26')]()['then'](function(){_0x2cbb95[_0x588e('0x1c')](0xcc)[_0x588e('0x1b')]();});}};}function handleEntityNotFound(_0x1aa96d,_0x220673){return function(_0x471e35){if(!_0x471e35){_0x1aa96d[_0x588e('0x1a')](0x194);}return _0x471e35;};}function handleError(_0x107d70,_0x1985fa){_0x1985fa=_0x1985fa||0x1f4;return function(_0x31e97e){logger[_0x588e('0x27')](_0x31e97e[_0x588e('0x28')]);if(_0x31e97e[_0x588e('0x29')]){delete _0x31e97e[_0x588e('0x29')];}_0x107d70[_0x588e('0x1c')](_0x1985fa)['send'](_0x31e97e);};}exports[_0x588e('0x2a')]=function(_0x2fe744,_0x113f88){var _0x5e6483={},_0x48427c={},_0x462c52={'count':0x0,'rows':[]};var _0x3fb304=_['map'](db[_0x588e('0x2b')][_0x588e('0x2c')],function(_0x58cb2e){return{'name':_0x58cb2e[_0x588e('0x2d')],'type':_0x58cb2e[_0x588e('0x2e')][_0x588e('0x2f')]};});_0x48427c['model']=_[_0x588e('0x30')](_0x3fb304,'name');_0x48427c['query']=_[_0x588e('0x31')](_0x2fe744[_0x588e('0x32')]);_0x48427c[_0x588e('0x33')]=_['intersection'](_0x48427c[_0x588e('0x34')],_0x48427c[_0x588e('0x32')]);_0x5e6483[_0x588e('0x35')]=_[_0x588e('0x36')](_0x48427c[_0x588e('0x34')],qs[_0x588e('0x37')](_0x2fe744['query'][_0x588e('0x37')]));_0x5e6483[_0x588e('0x35')]=_0x5e6483['attributes']['length']?_0x5e6483[_0x588e('0x35')]:_0x48427c[_0x588e('0x34')];if(!_0x2fe744['query'][_0x588e('0x38')](_0x588e('0x39'))){_0x5e6483[_0x588e('0x20')]=qs[_0x588e('0x20')](_0x2fe744[_0x588e('0x32')]['limit']);_0x5e6483['offset']=qs[_0x588e('0x1e')](_0x2fe744['query'][_0x588e('0x1e')]);}_0x5e6483[_0x588e('0x3a')]=qs[_0x588e('0x3b')](_0x2fe744[_0x588e('0x32')]['sort']);_0x5e6483[_0x588e('0x3c')]=qs[_0x588e('0x33')](_['pick'](_0x2fe744['query'],_0x48427c[_0x588e('0x33')]),_0x3fb304);if(_0x2fe744['query']['filter']){_0x5e6483['where']=_[_0x588e('0x3d')](_0x5e6483[_0x588e('0x3c')],{'$or':_[_0x588e('0x30')](_0x3fb304,function(_0x3b1c43){if(_0x3b1c43[_0x588e('0x2e')]!==_0x588e('0x3e')){var _0x128511={};_0x128511[_0x3b1c43[_0x588e('0x29')]]={'$like':'%'+_0x2fe744[_0x588e('0x32')][_0x588e('0x3f')]+'%'};return _0x128511;}})});}_0x5e6483=_[_0x588e('0x3d')]({},_0x5e6483,_0x2fe744[_0x588e('0x40')]);var _0x3d4153={'where':_0x5e6483[_0x588e('0x3c')]};return db[_0x588e('0x2b')][_0x588e('0x21')](_0x3d4153)['then'](function(_0x31d68b){_0x462c52[_0x588e('0x21')]=_0x31d68b;if(_0x2fe744[_0x588e('0x32')][_0x588e('0x41')]){_0x5e6483[_0x588e('0x42')]=[{'all':!![]}];}return db[_0x588e('0x2b')][_0x588e('0x43')](_0x5e6483);})[_0x588e('0x25')](function(_0x282448){_0x462c52[_0x588e('0x44')]=_0x282448;return _0x462c52;})[_0x588e('0x25')](respondWithFilteredResult(_0x113f88,_0x5e6483))[_0x588e('0x45')](handleError(_0x113f88,null));};exports['show']=function(_0xc2ba91,_0x28a429){var _0x3cb239={'raw':!![],'where':{'id':_0xc2ba91['params']['id']}},_0xdf5b4e={};_0xdf5b4e[_0x588e('0x34')]=_[_0x588e('0x31')](db[_0x588e('0x2b')][_0x588e('0x2c')]);_0xdf5b4e['query']=_[_0x588e('0x31')](_0xc2ba91[_0x588e('0x32')]);_0xdf5b4e[_0x588e('0x33')]=_[_0x588e('0x36')](_0xdf5b4e[_0x588e('0x34')],_0xdf5b4e[_0x588e('0x32')]);_0x3cb239[_0x588e('0x35')]=_['intersection'](_0xdf5b4e['model'],qs[_0x588e('0x37')](_0xc2ba91[_0x588e('0x32')][_0x588e('0x37')]));_0x3cb239['attributes']=_0x3cb239[_0x588e('0x35')]['length']?_0x3cb239[_0x588e('0x35')]:_0xdf5b4e['model'];if(_0xc2ba91[_0x588e('0x32')][_0x588e('0x41')]){_0x3cb239[_0x588e('0x42')]=[{'all':!![]}];}_0x3cb239=_[_0x588e('0x3d')]({},_0x3cb239,_0xc2ba91['options']);return db[_0x588e('0x2b')][_0x588e('0x46')](_0x3cb239)[_0x588e('0x25')](handleEntityNotFound(_0x28a429,null))[_0x588e('0x25')](respondWithResult(_0x28a429,null))[_0x588e('0x45')](handleError(_0x28a429,null));};exports['create']=function(_0x199930,_0x465a99){return db[_0x588e('0x2b')][_0x588e('0x47')](_0x199930[_0x588e('0x48')],{})[_0x588e('0x25')](respondWithResult(_0x465a99,0xc9))['catch'](handleError(_0x465a99,null));};exports['update']=function(_0x4010f4,_0x5f4f18){if(_0x4010f4[_0x588e('0x48')]['id']){delete _0x4010f4[_0x588e('0x48')]['id'];}return db[_0x588e('0x2b')][_0x588e('0x46')]({'where':{'id':_0x4010f4[_0x588e('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f4f18,null))[_0x588e('0x25')](saveUpdates(_0x4010f4['body'],null))[_0x588e('0x25')](respondWithResult(_0x5f4f18,null))['catch'](handleError(_0x5f4f18,null));};exports[_0x588e('0x26')]=function(_0x2035ed,_0x280271){return db['SmsApplication'][_0x588e('0x46')]({'where':{'id':_0x2035ed['params']['id']}})['then'](handleEntityNotFound(_0x280271,null))[_0x588e('0x25')](removeEntity(_0x280271,null))[_0x588e('0x45')](handleError(_0x280271,null));}; \ No newline at end of file +var _0x5176=['params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','SmsApplication','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x21565c,_0x103f86){var _0x5b18f0=function(_0x514433){while(--_0x514433){_0x21565c['push'](_0x21565c['shift']());}};_0x5b18f0(++_0x103f86);}(_0x5176,0x9b));var _0x6517=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5176[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x6517('0x0'));var rimraf=require(_0x6517('0x1'));var zipdir=require(_0x6517('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6517('0x3'));var moment=require('moment');var BPromise=require(_0x6517('0x4'));var Mustache=require(_0x6517('0x5'));var util=require(_0x6517('0x6'));var path=require(_0x6517('0x7'));var sox=require(_0x6517('0x8'));var csv=require('to-csv');var ejs=require(_0x6517('0x9'));var fs=require('fs');var fs_extra=require(_0x6517('0xa'));var _=require(_0x6517('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6517('0xc'));var deskjs=require(_0x6517('0xd'));var toCsv=require(_0x6517('0xe'));var querystring=require('querystring');var Papa=require(_0x6517('0xf'));var Redis=require(_0x6517('0x10'));var authService=require(_0x6517('0x11'));var qs=require(_0x6517('0x12'));var as=require(_0x6517('0x13'));var hardwareService=require(_0x6517('0x14'));var logger=require(_0x6517('0x15'))(_0x6517('0x16'));var utils=require(_0x6517('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6517('0x18'));var db=require(_0x6517('0x19'))['db'];function respondWithStatusCode(_0x423483,_0x3345c3){_0x3345c3=_0x3345c3||0xcc;return function(_0x43212b){if(_0x43212b){return _0x423483[_0x6517('0x1a')](_0x3345c3);}return _0x423483[_0x6517('0x1b')](_0x3345c3)[_0x6517('0x1c')]();};}function respondWithResult(_0x1512a9,_0x1be3b4){_0x1be3b4=_0x1be3b4||0xc8;return function(_0x347aa2){if(_0x347aa2){return _0x1512a9[_0x6517('0x1b')](_0x1be3b4)[_0x6517('0x1d')](_0x347aa2);}};}function respondWithFilteredResult(_0x91dcae,_0x462875){return function(_0x180867){if(_0x180867){var _0x275ecc=typeof _0x462875[_0x6517('0x1e')]===_0x6517('0x1f')&&typeof _0x462875[_0x6517('0x20')]==='undefined';var _0x2ebaac=_0x180867[_0x6517('0x21')];var _0x3b27a7=_0x275ecc?0x0:_0x462875['offset'];var _0x6198ec=_0x275ecc?_0x180867[_0x6517('0x21')]:_0x462875['offset']+_0x462875[_0x6517('0x20')];var _0x1118dc;if(_0x6198ec>=_0x2ebaac){_0x6198ec=_0x2ebaac;_0x1118dc=0xc8;}else{_0x1118dc=0xce;}_0x91dcae[_0x6517('0x1b')](_0x1118dc);return _0x91dcae[_0x6517('0x22')](_0x6517('0x23'),_0x3b27a7+'-'+_0x6198ec+'/'+_0x2ebaac)[_0x6517('0x1d')](_0x180867);}return null;};}function patchUpdates(_0x17b768){return function(_0x2a4e72){try{jsonpatch[_0x6517('0x24')](_0x2a4e72,_0x17b768,!![]);}catch(_0x406ab9){return BPromise[_0x6517('0x25')](_0x406ab9);}return _0x2a4e72[_0x6517('0x26')]();};}function saveUpdates(_0x5bc6de,_0x4d81a9){return function(_0x11eeac){if(_0x11eeac){return _0x11eeac[_0x6517('0x27')](_0x5bc6de)[_0x6517('0x28')](function(_0x5407f5){return _0x5407f5;});}return null;};}function removeEntity(_0x1cf331,_0x4278fc){return function(_0x5e423f){if(_0x5e423f){return _0x5e423f['destroy']()[_0x6517('0x28')](function(){_0x1cf331[_0x6517('0x1b')](0xcc)[_0x6517('0x1c')]();});}};}function handleEntityNotFound(_0x3b0e63,_0x39e2b6){return function(_0x17d975){if(!_0x17d975){_0x3b0e63[_0x6517('0x1a')](0x194);}return _0x17d975;};}function handleError(_0x596b91,_0x1f0d98){_0x1f0d98=_0x1f0d98||0x1f4;return function(_0x2b1675){logger[_0x6517('0x29')](_0x2b1675['stack']);if(_0x2b1675[_0x6517('0x2a')]){delete _0x2b1675['name'];}_0x596b91[_0x6517('0x1b')](_0x1f0d98)[_0x6517('0x2b')](_0x2b1675);};}exports['index']=function(_0x3b163c,_0x5abfb9){var _0xced82a={},_0x1667e5={},_0x2d8ca0={'count':0x0,'rows':[]};var _0x124ea6=_[_0x6517('0x2c')](db[_0x6517('0x2d')]['rawAttributes'],function(_0x1c2c35){return{'name':_0x1c2c35['fieldName'],'type':_0x1c2c35['type'][_0x6517('0x2e')]};});_0x1667e5['model']=_['map'](_0x124ea6,_0x6517('0x2a'));_0x1667e5[_0x6517('0x2f')]=_[_0x6517('0x30')](_0x3b163c[_0x6517('0x2f')]);_0x1667e5[_0x6517('0x31')]=_[_0x6517('0x32')](_0x1667e5[_0x6517('0x33')],_0x1667e5[_0x6517('0x2f')]);_0xced82a[_0x6517('0x34')]=_[_0x6517('0x32')](_0x1667e5[_0x6517('0x33')],qs['fields'](_0x3b163c[_0x6517('0x2f')][_0x6517('0x35')]));_0xced82a[_0x6517('0x34')]=_0xced82a['attributes'][_0x6517('0x36')]?_0xced82a[_0x6517('0x34')]:_0x1667e5['model'];if(!_0x3b163c[_0x6517('0x2f')][_0x6517('0x37')](_0x6517('0x38'))){_0xced82a[_0x6517('0x20')]=qs['limit'](_0x3b163c[_0x6517('0x2f')][_0x6517('0x20')]);_0xced82a[_0x6517('0x1e')]=qs['offset'](_0x3b163c['query'][_0x6517('0x1e')]);}_0xced82a[_0x6517('0x39')]=qs['sort'](_0x3b163c[_0x6517('0x2f')][_0x6517('0x3a')]);_0xced82a[_0x6517('0x3b')]=qs['filters'](_[_0x6517('0x3c')](_0x3b163c['query'],_0x1667e5[_0x6517('0x31')]),_0x124ea6);if(_0x3b163c['query'][_0x6517('0x3d')]){_0xced82a[_0x6517('0x3b')]=_[_0x6517('0x3e')](_0xced82a[_0x6517('0x3b')],{'$or':_[_0x6517('0x2c')](_0x124ea6,function(_0x33793b){if(_0x33793b['type']!=='VIRTUAL'){var _0xcaa65c={};_0xcaa65c[_0x33793b['name']]={'$like':'%'+_0x3b163c[_0x6517('0x2f')]['filter']+'%'};return _0xcaa65c;}})});}_0xced82a=_['merge']({},_0xced82a,_0x3b163c[_0x6517('0x3f')]);var _0x29ae1e={'where':_0xced82a[_0x6517('0x3b')]};return db[_0x6517('0x2d')][_0x6517('0x21')](_0x29ae1e)[_0x6517('0x28')](function(_0x32b86){_0x2d8ca0[_0x6517('0x21')]=_0x32b86;if(_0x3b163c[_0x6517('0x2f')][_0x6517('0x40')]){_0xced82a[_0x6517('0x41')]=[{'all':!![]}];}return db[_0x6517('0x2d')][_0x6517('0x42')](_0xced82a);})[_0x6517('0x28')](function(_0x5c799a){_0x2d8ca0[_0x6517('0x43')]=_0x5c799a;return _0x2d8ca0;})['then'](respondWithFilteredResult(_0x5abfb9,_0xced82a))[_0x6517('0x44')](handleError(_0x5abfb9,null));};exports[_0x6517('0x45')]=function(_0x367644,_0x5a93e4){var _0x5a2c3d={'raw':!![],'where':{'id':_0x367644[_0x6517('0x46')]['id']}},_0x540d9b={};_0x540d9b[_0x6517('0x33')]=_[_0x6517('0x30')](db['SmsApplication'][_0x6517('0x47')]);_0x540d9b[_0x6517('0x2f')]=_['keys'](_0x367644['query']);_0x540d9b[_0x6517('0x31')]=_[_0x6517('0x32')](_0x540d9b['model'],_0x540d9b[_0x6517('0x2f')]);_0x5a2c3d[_0x6517('0x34')]=_[_0x6517('0x32')](_0x540d9b['model'],qs[_0x6517('0x35')](_0x367644[_0x6517('0x2f')][_0x6517('0x35')]));_0x5a2c3d['attributes']=_0x5a2c3d[_0x6517('0x34')][_0x6517('0x36')]?_0x5a2c3d[_0x6517('0x34')]:_0x540d9b[_0x6517('0x33')];if(_0x367644[_0x6517('0x2f')]['includeAll']){_0x5a2c3d[_0x6517('0x41')]=[{'all':!![]}];}_0x5a2c3d=_[_0x6517('0x3e')]({},_0x5a2c3d,_0x367644[_0x6517('0x3f')]);return db[_0x6517('0x2d')]['find'](_0x5a2c3d)['then'](handleEntityNotFound(_0x5a93e4,null))[_0x6517('0x28')](respondWithResult(_0x5a93e4,null))[_0x6517('0x44')](handleError(_0x5a93e4,null));};exports[_0x6517('0x48')]=function(_0x16080e,_0x596388){return db[_0x6517('0x2d')]['create'](_0x16080e['body'],{})['then'](respondWithResult(_0x596388,0xc9))[_0x6517('0x44')](handleError(_0x596388,null));};exports[_0x6517('0x27')]=function(_0x4b86b5,_0x1f5258){if(_0x4b86b5['body']['id']){delete _0x4b86b5[_0x6517('0x49')]['id'];}return db[_0x6517('0x2d')][_0x6517('0x4a')]({'where':{'id':_0x4b86b5[_0x6517('0x46')]['id']}})[_0x6517('0x28')](handleEntityNotFound(_0x1f5258,null))['then'](saveUpdates(_0x4b86b5[_0x6517('0x49')],null))[_0x6517('0x28')](respondWithResult(_0x1f5258,null))[_0x6517('0x44')](handleError(_0x1f5258,null));};exports['destroy']=function(_0x31502b,_0x4585a0){return db[_0x6517('0x2d')][_0x6517('0x4a')]({'where':{'id':_0x31502b[_0x6517('0x46')]['id']}})[_0x6517('0x28')](handleEntityNotFound(_0x4585a0,null))[_0x6517('0x28')](removeEntity(_0x4585a0,null))[_0x6517('0x44')](handleError(_0x4585a0,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1697eef..af9c161 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 _0x28c8=['request-promise','path','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','util','bluebird'];(function(_0x17240f,_0x5da80b){var _0x3b1fac=function(_0x10c62f){while(--_0x10c62f){_0x17240f['push'](_0x17240f['shift']());}};_0x3b1fac(++_0x5da80b);}(_0x28c8,0x127));var _0x828c=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x28c8[_0x1ac120];return _0x19b703;};'use strict';var _=require('lodash');var util=require(_0x828c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x828c('0x1'));var rp=require(_0x828c('0x2'));var fs=require('fs');var path=require(_0x828c('0x3'));var rimraf=require('rimraf');var config=require(_0x828c('0x4'));var attributes=require(_0x828c('0x5'));module['exports']=function(_0xc1e09d,_0x528548){return _0xc1e09d[_0x828c('0x6')](_0x828c('0x7'),attributes,{'tableName':_0x828c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc11b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x1132c7,_0x4a733d){var _0x56b032=function(_0x1dbd92){while(--_0x1dbd92){_0x1132c7['push'](_0x1132c7['shift']());}};_0x56b032(++_0x4a733d);}(_0xc11b,0x125));var _0xbc11=function(_0x3345dc,_0x3e4313){_0x3345dc=_0x3345dc-0x0;var _0x349075=_0xc11b[_0x3345dc];return _0x349075;};'use strict';var _=require('lodash');var util=require(_0xbc11('0x0'));var logger=require('../../config/logger')(_0xbc11('0x1'));var moment=require(_0xbc11('0x2'));var BPromise=require(_0xbc11('0x3'));var rp=require(_0xbc11('0x4'));var fs=require('fs');var path=require(_0xbc11('0x5'));var rimraf=require(_0xbc11('0x6'));var config=require(_0xbc11('0x7'));var attributes=require(_0xbc11('0x8'));module[_0xbc11('0x9')]=function(_0x138f03,_0x38dc05){return _0x138f03['define'](_0xbc11('0xa'),attributes,{'tableName':_0xbc11('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc11('0xc'),'collate':_0xbc11('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4cc111f..2b603f1 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 _0xa3db=['client','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0xa3db,0x10c));var _0xba3d=function(_0x14b6c2,_0x4a790a){_0x14b6c2=_0x14b6c2-0x0;var _0x6ac993=_0xa3db[_0x14b6c2];return _0x6ac993;};'use strict';var _=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var moment=require(_0xba3d('0x2'));var BPromise=require(_0xba3d('0x3'));var rs=require(_0xba3d('0x4'));var fs=require('fs');var Redis=require(_0xba3d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba3d('0x6'))('rpc');var config=require(_0xba3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba3d('0x8')][_0xba3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x477583,_0x1bacd7,_0x1bd181){return new BPromise(function(_0x426868,_0x3b69e9){return client[_0xba3d('0xa')](_0x477583,_0x1bd181)[_0xba3d('0xb')](function(_0x102fe6){logger[_0xba3d('0xc')]('SmsApplication,\x20%s,\x20%s',_0x1bacd7,_0xba3d('0xd'));logger[_0xba3d('0xe')](_0xba3d('0xf'),_0x1bacd7,_0xba3d('0xd'),JSON[_0xba3d('0x10')](_0x102fe6));if(_0x102fe6['error']){if(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x12')]===0x1f4){logger[_0xba3d('0x11')]('SmsApplication,\x20%s,\x20%s',_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x3b69e9(_0x102fe6[_0xba3d('0x11')]['message']);}logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x426868(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x13')]);}else{logger[_0xba3d('0xc')](_0xba3d('0x14'),_0x1bacd7,_0xba3d('0xd'));_0x426868(_0x102fe6[_0xba3d('0x15')][_0xba3d('0x13')]);}})[_0xba3d('0x16')](function(_0x2ce092){logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x2ce092);_0x3b69e9(_0x2ce092);});});} \ No newline at end of file +var _0x677a=['message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14aa74,_0x972315){var _0x25ceab=function(_0x572328){while(--_0x572328){_0x14aa74['push'](_0x14aa74['shift']());}};_0x25ceab(++_0x972315);}(_0x677a,0xd6));var _0xa677=function(_0x32665b,_0x8b3633){_0x32665b=_0x32665b-0x0;var _0xdef32f=_0x677a[_0x32665b];return _0xdef32f;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var moment=require(_0xa677('0x1'));var BPromise=require(_0xa677('0x2'));var rs=require(_0xa677('0x3'));var fs=require('fs');var Redis=require(_0xa677('0x4'));var db=require(_0xa677('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa677('0x6'))(_0xa677('0x7'));var config=require(_0xa677('0x8'));var jayson=require(_0xa677('0x9'));var client=jayson[_0xa677('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303092,_0x1c997f,_0x130b66){return new BPromise(function(_0x10fb5e,_0x568910){return client['request'](_0x303092,_0x130b66)['then'](function(_0x43d392){logger['info'](_0xa677('0xb'),_0x1c997f,_0xa677('0xc'));logger['debug'](_0xa677('0xd'),_0x1c997f,_0xa677('0xc'),JSON[_0xa677('0xe')](_0x43d392));if(_0x43d392[_0xa677('0xf')]){if(_0x43d392['error'][_0xa677('0x10')]===0x1f4){logger[_0xa677('0xf')](_0xa677('0xb'),_0x1c997f,_0x43d392[_0xa677('0xf')]['message']);return _0x568910(_0x43d392[_0xa677('0xf')]['message']);}logger[_0xa677('0xf')](_0xa677('0xb'),_0x1c997f,_0x43d392[_0xa677('0xf')][_0xa677('0x11')]);return _0x10fb5e(_0x43d392[_0xa677('0xf')][_0xa677('0x11')]);}else{logger[_0xa677('0x12')](_0xa677('0xb'),_0x1c997f,_0xa677('0xc'));_0x10fb5e(_0x43d392[_0xa677('0x13')][_0xa677('0x11')]);}})[_0xa677('0x14')](function(_0x37316c){logger[_0xa677('0xf')]('SmsApplication,\x20%s,\x20%s',_0x1c997f,_0x37316c);_0x568910(_0x37316c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 80c556f..55025d4 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 _0x4024=['addTags','put','smsinteraction:update','update','delete','destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x4024,0x89));var _0x4402=function(_0x803ae0,_0x5c5f30){_0x803ae0=_0x803ae0-0x0;var _0x3c38b1=_0x4024[_0x803ae0];return _0x3c38b1;};'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('./smsInteraction.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/describe',auth[_0x4402('0x7')](),controller['describe']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4402('0x9')]('/:id/messages',auth[_0x4402('0x7')](),controller['getMessages']);router[_0x4402('0x9')]('/:id/download',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xc')]);router[_0x4402('0xd')]('/:id/messages',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xd')](_0x4402('0xf'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x12')),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x15')),controller[_0x4402('0x16')]);router[_0x4402('0x17')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')]('sms','smsinteraction:destroy'),controller[_0x4402('0x18')]);router[_0x4402('0x17')]('/:id/tags',auth[_0x4402('0x7')](),controller[_0x4402('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x309048,_0x13377f){var _0x2e051a=function(_0x3fe200){while(--_0x3fe200){_0x309048['push'](_0x309048['shift']());}};_0x2e051a(++_0x13377f);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index fd6d259..ce75bb9 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 _0xfe39=['out','sequelize','moment','BOOLEAN','STRING','DATE','ENUM'];(function(_0x1adb1a,_0x281561){var _0xa733a3=function(_0x56830c){while(--_0x56830c){_0x1adb1a['push'](_0x1adb1a['shift']());}};_0xa733a3(++_0x281561);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xfe39[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0x9fe3('0x0'));var moment=require(_0x9fe3('0x1'));module['exports']={'closed':{'type':Sequelize[_0x9fe3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9fe3('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9fe3('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9fe3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9fe3('0x5')]('in',_0x9fe3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9fe3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9fe3('0x5')]('in',_0x9fe3('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9fe3('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd4f4=['STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x530d6e,_0x441161){var _0x2916b4=function(_0x450b93){while(--_0x450b93){_0x530d6e['push'](_0x530d6e['shift']());}};_0x2916b4(++_0x441161);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x183d4b,_0x222230){_0x183d4b=_0x183d4b-0x0;var _0x3309f3=_0xd4f4[_0x183d4b];return _0x3309f3;};'use strict';var Sequelize=require(_0x4d4f('0x0'));var moment=require(_0x4d4f('0x1'));module[_0x4d4f('0x2')]={'closed':{'type':Sequelize[_0x4d4f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d4f('0x4')]},'disposition':{'type':Sequelize[_0x4d4f('0x5')]},'secondDisposition':{'type':Sequelize[_0x4d4f('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4d4f('0x5')]},'note':{'type':Sequelize[_0x4d4f('0x5')]},'phone':{'type':Sequelize[_0x4d4f('0x5')]},'read1stAt':{'type':Sequelize[_0x4d4f('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4d4f('0x6')]('in',_0x4d4f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4d4f('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4d4f('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 586f9c9..b1e7bbb 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 _0x95a5=['merge','options','find','create','body','catch','describe','SmsMessage','addMessage','omit','ids','findOne','rawAttributes','fields','nolimit','order','sort','where','filters','pick','SmsInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','removeTags','download','unix','toString','join','server','tmp','transcript-%d-%s.zip','push','User','CmContact','lastName','createdAt','direction','secret','read','Account','Owner','fullname','get','mkdirSync','closed','closedAt','disposition','Messages','Contact','firstName','out','value','renderFile','root','views','downloadInteraction.ejs','transcript-','Sms','err','zip-dir','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','end','stack','name','SmsInteraction','fieldName','type','key','getOptions','findAll','sms','user','show','params','model','keys','query','intersection','attributes','includeAll','include'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x95a5,0x12b));var _0x595a=function(_0x4a9dbb,_0x2b123b){_0x4a9dbb=_0x4a9dbb-0x0;var _0x9c1a3f=_0x95a5[_0x4a9dbb];return _0x9c1a3f;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x595a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x595a('0x1'));var path=require(_0x595a('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x595a('0x3'));var Redis=require('ioredis');var interaction=require(_0x595a('0x4'));var qs=require(_0x595a('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0x595a('0x6'))(_0x595a('0x7'));var config=require(_0x595a('0x8'));var db=require(_0x595a('0x9'))['db'];config[_0x595a('0xa')]=_[_0x595a('0xb')](config[_0x595a('0xa')],{'host':_0x595a('0xc'),'port':0x18eb});var socket=require(_0x595a('0xd'))(new Redis(config[_0x595a('0xa')]));require(_0x595a('0xe'))['register'](socket);function respondWithStatusCode(_0x30e4f1,_0x590622){_0x590622=_0x590622||0xcc;return function(_0x4a2dc6){if(_0x4a2dc6){return _0x30e4f1[_0x595a('0xf')](_0x590622);}return _0x30e4f1[_0x595a('0x10')](_0x590622)['end']();};}function respondWithResult(_0x450509,_0x84226e){_0x84226e=_0x84226e||0xc8;return function(_0x21f6a4){if(_0x21f6a4){return _0x450509[_0x595a('0x10')](_0x84226e)[_0x595a('0x11')](_0x21f6a4);}};}function respondWithFilteredResult(_0x23b127,_0x141200){return function(_0x5f34f2){if(_0x5f34f2){var _0x5758bc=typeof _0x141200[_0x595a('0x12')]===_0x595a('0x13')&&typeof _0x141200[_0x595a('0x14')]==='undefined';var _0x3e18ee=_0x5f34f2[_0x595a('0x15')];var _0x4050fc=_0x5758bc?0x0:_0x141200['offset'];var _0x8d78b4=_0x5758bc?_0x5f34f2['count']:_0x141200[_0x595a('0x12')]+_0x141200['limit'];var _0x12a4cb;if(_0x8d78b4>=_0x3e18ee){_0x8d78b4=_0x3e18ee;_0x12a4cb=0xc8;}else{_0x12a4cb=0xce;}_0x23b127['status'](_0x12a4cb);return _0x23b127[_0x595a('0x16')]('Content-Range',_0x4050fc+'-'+_0x8d78b4+'/'+_0x3e18ee)[_0x595a('0x11')](_0x5f34f2);}return null;};}function saveUpdates(_0x3c85e0){return function(_0x1695ff){if(_0x1695ff){return _0x1695ff[_0x595a('0x17')](_0x3c85e0)[_0x595a('0x18')](function(_0x3345b1){return _0x3345b1;});}return null;};}function removeEntity(_0x791fc4){return function(_0x16f61c){if(_0x16f61c){return _0x16f61c[_0x595a('0x19')]()[_0x595a('0x18')](function(){_0x791fc4[_0x595a('0x10')](0xcc)[_0x595a('0x1a')]();});}};}function handleEntityNotFound(_0x4fcac5){return function(_0x1e2c5f){if(!_0x1e2c5f){_0x4fcac5[_0x595a('0xf')](0x194);}return _0x1e2c5f;};}function handleError(_0x523eb6,_0x59b385){_0x59b385=_0x59b385||0x1f4;return function(_0x1333fc){logger['error'](_0x1333fc[_0x595a('0x1b')]);if(_0x1333fc[_0x595a('0x1c')]){delete _0x1333fc['name'];}_0x523eb6[_0x595a('0x10')](_0x59b385)['send'](_0x1333fc);};}exports['index']=function(_0x589c74,_0x2855de){var _0xc388ea={};var _0x1756d1=_['map'](db[_0x595a('0x1d')]['rawAttributes'],function(_0x2376dc){return{'name':_0x2376dc[_0x595a('0x1e')],'type':_0x2376dc[_0x595a('0x1f')][_0x595a('0x20')]};});_0xc388ea=qs[_0x595a('0x21')](_0x1756d1,_0x589c74);return interaction[_0x595a('0x22')](_0x595a('0x23'),_0x589c74['query'],_0x589c74[_0x595a('0x24')],_0xc388ea,_0x1756d1)[_0x595a('0x18')](respondWithFilteredResult(_0x2855de,_0xc388ea))['catch'](handleError(_0x2855de,null));};exports[_0x595a('0x25')]=function(_0x236add,_0x16d812){var _0xfd66c={'raw':![],'where':{'id':_0x236add[_0x595a('0x26')]['id']}},_0x3a4a32={};_0x3a4a32[_0x595a('0x27')]=_[_0x595a('0x28')](db[_0x595a('0x1d')]['rawAttributes']);_0x3a4a32[_0x595a('0x29')]=_[_0x595a('0x28')](_0x236add[_0x595a('0x29')]);_0x3a4a32['filters']=_[_0x595a('0x2a')](_0x3a4a32['model'],_0x3a4a32[_0x595a('0x29')]);_0xfd66c[_0x595a('0x2b')]=_[_0x595a('0x2a')](_0x3a4a32[_0x595a('0x27')],qs['fields'](_0x236add['query']['fields']));_0xfd66c[_0x595a('0x2b')]=_0xfd66c[_0x595a('0x2b')]['length']?_0xfd66c[_0x595a('0x2b')]:_0x3a4a32[_0x595a('0x27')];if(_0x236add[_0x595a('0x29')][_0x595a('0x2c')]){_0xfd66c[_0x595a('0x2d')]=[{'all':!![]}];}_0xfd66c=_[_0x595a('0x2e')]({},_0xfd66c,_0x236add[_0x595a('0x2f')]);return db[_0x595a('0x1d')][_0x595a('0x30')](_0xfd66c)[_0x595a('0x18')](handleEntityNotFound(_0x16d812,null))[_0x595a('0x18')](respondWithResult(_0x16d812,null))['catch'](handleError(_0x16d812,null));};exports[_0x595a('0x31')]=function(_0x41f856,_0xefafbc){return db[_0x595a('0x1d')][_0x595a('0x31')](_0x41f856[_0x595a('0x32')],{})[_0x595a('0x18')](respondWithResult(_0xefafbc,0xc9))[_0x595a('0x33')](handleError(_0xefafbc,null));};exports[_0x595a('0x17')]=function(_0x41ae6c,_0x2e1b34){if(_0x41ae6c[_0x595a('0x32')]['id']){delete _0x41ae6c['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x41ae6c[_0x595a('0x26')]['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x2e1b34,null))[_0x595a('0x18')](saveUpdates(_0x41ae6c[_0x595a('0x32')],null))[_0x595a('0x18')](respondWithResult(_0x2e1b34,null))['catch'](handleError(_0x2e1b34,null));};exports[_0x595a('0x19')]=function(_0x514dc5,_0x19ca54){return db[_0x595a('0x1d')][_0x595a('0x30')]({'where':{'id':_0x514dc5['params']['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x19ca54,null))[_0x595a('0x18')](removeEntity(_0x19ca54,null))[_0x595a('0x33')](handleError(_0x19ca54,null));};exports['describe']=function(_0xf6185d,_0x55786f){return db[_0x595a('0x1d')][_0x595a('0x34')]()['then'](respondWithResult(_0x55786f,null))[_0x595a('0x33')](handleError(_0x55786f,null));};exports['addMessage']=function(_0x538872,_0x246fab){return db[_0x595a('0x35')][_0x595a('0x30')]({'where':{'id':_0x538872[_0x595a('0x26')]['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x246fab,null))['then'](function(_0xc7b8d6){if(_0xc7b8d6){return _0xc7b8d6[_0x595a('0x36')](_0x538872[_0x595a('0x32')]['ids'],_[_0x595a('0x37')](_0x538872['body'],[_0x595a('0x38'),'id'])||{});}})[_0x595a('0x18')](respondWithResult(_0x246fab,null))[_0x595a('0x33')](handleError(_0x246fab,null));};exports['getMessages']=function(_0x57b61c,_0x25adb0){var _0x12e7a5={'raw':![],'where':{}};var _0x19dc3a={};var _0x46cb8f={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x595a('0x39')]({'where':{'id':_0x57b61c[_0x595a('0x26')]['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x25adb0,null))[_0x595a('0x18')](function(_0x2cecf3){if(_0x2cecf3){_0x19dc3a[_0x595a('0x27')]=_['keys'](db['SmsMessage'][_0x595a('0x3a')]);_0x19dc3a[_0x595a('0x29')]=_[_0x595a('0x28')](_0x57b61c[_0x595a('0x29')]);_0x19dc3a['filters']=_[_0x595a('0x2a')](_0x19dc3a['model'],_0x19dc3a[_0x595a('0x29')]);_0x12e7a5[_0x595a('0x2b')]=_['intersection'](_0x19dc3a[_0x595a('0x27')],qs[_0x595a('0x3b')](_0x57b61c[_0x595a('0x29')][_0x595a('0x3b')]));_0x12e7a5['attributes']=_0x12e7a5[_0x595a('0x2b')]['length']?_0x12e7a5[_0x595a('0x2b')]:_0x19dc3a[_0x595a('0x27')];if(!_0x57b61c['query']['hasOwnProperty'](_0x595a('0x3c'))){_0x12e7a5[_0x595a('0x14')]=qs[_0x595a('0x14')](_0x57b61c[_0x595a('0x29')][_0x595a('0x14')]);_0x12e7a5[_0x595a('0x12')]=qs[_0x595a('0x12')](_0x57b61c[_0x595a('0x29')]['offset']);}_0x12e7a5[_0x595a('0x3d')]=qs[_0x595a('0x3e')](_0x57b61c[_0x595a('0x29')][_0x595a('0x3e')]);_0x12e7a5[_0x595a('0x3f')]=qs[_0x595a('0x40')](_[_0x595a('0x41')](_0x57b61c[_0x595a('0x29')],_0x19dc3a['filters']));_0x12e7a5['where'][_0x595a('0x42')]=_0x2cecf3['id'];if(_0x57b61c['query'][_0x595a('0x43')]){_0x12e7a5[_0x595a('0x3f')]=_[_0x595a('0x2e')](_0x12e7a5[_0x595a('0x3f')],{'$or':_[_0x595a('0x44')](_0x12e7a5[_0x595a('0x2b')],function(_0x239318){var _0x264fca={};_0x264fca[_0x239318]={'$like':'%'+_0x57b61c[_0x595a('0x29')][_0x595a('0x43')]+'%'};return _0x264fca;})});}if(_0x57b61c['query'][_0x595a('0x45')]){var _0x476105=_0x57b61c['query']['$gte'][_0x595a('0x46')](',');var _0x1dbc3f={};_0x1dbc3f[_0x476105[0x0]]={'$gte':moment(_0x476105[0x1])[_0x595a('0x47')](_0x595a('0x48'))};_0x12e7a5[_0x595a('0x3f')]=_[_0x595a('0x2e')](_0x12e7a5[_0x595a('0x3f')],_0x1dbc3f);}_0x12e7a5=_[_0x595a('0x2e')]({},_0x12e7a5,_0x57b61c[_0x595a('0x2f')]);return db[_0x595a('0x35')][_0x595a('0x15')]({'where':_0x12e7a5[_0x595a('0x3f')]})[_0x595a('0x18')](function(_0x8058cf){_0x46cb8f['count']=_0x8058cf;if(_0x57b61c[_0x595a('0x29')][_0x595a('0x2c')]){_0x12e7a5['include']=[{'all':!![]}];}return db[_0x595a('0x35')][_0x595a('0x22')](_0x12e7a5);})['then'](function(_0x1a9704){_0x46cb8f[_0x595a('0x49')]=_0x1a9704;return _0x46cb8f;});}})[_0x595a('0x18')](respondWithFilteredResult(_0x25adb0,_0x12e7a5))[_0x595a('0x33')](handleError(_0x25adb0,null));};exports[_0x595a('0x4a')]=function(_0x2d2979,_0x9c57a2){return db[_0x595a('0x1d')]['find']({'where':{'id':_0x2d2979[_0x595a('0x26')]['id']}})[_0x595a('0x18')](handleEntityNotFound(_0x9c57a2,null))[_0x595a('0x18')](function(_0x10adee){if(_0x10adee){return _0x10adee[_0x595a('0x4b')](_0x2d2979[_0x595a('0x32')]['ids'],_[_0x595a('0x37')](_0x2d2979[_0x595a('0x32')],['ids','id'])||{})['spread'](function(){return db[_0x595a('0x4c')]['findAll']({'attributes':['id',_0x595a('0x1c'),_0x595a('0x4d')],'where':{'id':_0x2d2979['body'][_0x595a('0x38')]}});})[_0x595a('0x18')](function(_0x205574){socket[_0x595a('0x4e')]('smsInteractionTags:save',{'id':Number(_0x2d2979[_0x595a('0x26')]['id']),'tags':_0x205574||[]});return{'id':Number(_0x2d2979[_0x595a('0x26')]['id']),'tags':_0x205574||[]};});}})[_0x595a('0x18')](respondWithResult(_0x9c57a2,null))[_0x595a('0x33')](handleError(_0x9c57a2,null));};exports[_0x595a('0x4f')]=function(_0x3c704f,_0x3676f7){return db[_0x595a('0x1d')][_0x595a('0x30')]({'where':{'id':_0x3c704f[_0x595a('0x26')]['id']}})['then'](handleEntityNotFound(_0x3676f7,null))[_0x595a('0x18')](function(_0x1e2a3f){if(_0x1e2a3f){return _0x1e2a3f[_0x595a('0x4f')](_0x3c704f[_0x595a('0x29')][_0x595a('0x38')]);}})[_0x595a('0x18')](respondWithStatusCode(_0x3676f7,null))[_0x595a('0x33')](handleError(_0x3676f7,null));};exports[_0x595a('0x50')]=function(_0x2a168a,_0x38094e){var _0x3fec99=moment()[_0x595a('0x51')]()[_0x595a('0x52')]();var _0x3450e1=path[_0x595a('0x53')](config['root'],_0x595a('0x54'),'files',_0x595a('0x55'));var _0x2c7731=path[_0x595a('0x53')](_0x3450e1,_0x3fec99);var _0x35c53d=util[_0x595a('0x47')](_0x595a('0x56'),_0x2a168a[_0x595a('0x26')]['id'],_0x3fec99);var _0x4ffbd6=path[_0x595a('0x53')](_0x3450e1,_0x35c53d);var _0x158bf5=[];_0x158bf5[_0x595a('0x57')]({'model':db[_0x595a('0x58')],'as':_0x595a('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x158bf5['push']({'model':db[_0x595a('0x59')],'as':'Contact','attributes':['id','firstName',_0x595a('0x5a')],'raw':!![]});var _0x45b3ad=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body',_0x595a('0x5b'),_0x595a('0x5c'),_0x595a('0x5d'),_0x595a('0x5e')],'include':_0x158bf5}];_0x45b3ad[_0x595a('0x57')]({'model':db['SmsAccount'],'as':_0x595a('0x5f'),'attributes':['id',_0x595a('0x1c')]});_0x45b3ad[_0x595a('0x57')]({'model':db[_0x595a('0x58')],'as':_0x595a('0x60'),'attributes':['id',_0x595a('0x61')]});return db['SmsInteraction'][_0x595a('0x30')]({'where':{'id':_0x2a168a[_0x595a('0x26')]['id']},'include':_0x45b3ad})[_0x595a('0x18')](handleEntityNotFound(_0x38094e,null))[_0x595a('0x18')](function(_0x31623f){if(_0x31623f){var _0xe3efc0=_0x31623f[_0x595a('0x62')]({'plain':!![]});fs[_0x595a('0x63')](_0x2c7731);var _0xb104eb={'channel':'Sms','account':_0xe3efc0[_0x595a('0x5f')][_0x595a('0x1c')],'agent':_0xe3efc0[_0x595a('0x60')]?_0xe3efc0[_0x595a('0x60')]['fullname']:'N.A.','createdAt':moment(_0xe3efc0[_0x595a('0x5b')])[_0x595a('0x47')](_0x595a('0x48'))[_0x595a('0x52')](),'closedAt':_0xe3efc0[_0x595a('0x64')]?moment(_0xe3efc0[_0x595a('0x65')])[_0x595a('0x47')](_0x595a('0x48'))[_0x595a('0x52')]():'','disposition':_0xe3efc0[_0x595a('0x66')],'messages':_(_0xe3efc0[_0x595a('0x67')])[_0x595a('0x43')]({'secret':![]})[_0x595a('0x44')](function(_0x5459f1){return{'date':moment(_0x5459f1[_0x595a('0x5b')])[_0x595a('0x47')](_0x595a('0x48'))[_0x595a('0x52')](),'sender':_0x5459f1[_0x595a('0x5c')]==='out'?_0x5459f1['User']?_0x5459f1[_0x595a('0x58')]['fullname']:'System':_0x5459f1[_0x595a('0x68')][_0x595a('0x69')]+(_0x5459f1[_0x595a('0x68')]['lastName']?'\x20'+_0x5459f1[_0x595a('0x68')]['lastName']:''),'body':_0x5459f1[_0x595a('0x32')],'direction':_0x5459f1['direction']===_0x595a('0x6a')?'A':'C','secret':_0x5459f1[_0x595a('0x5d')],'read':_0x5459f1[_0x595a('0x5e')]};})[_0x595a('0x6b')]()};return ejs[_0x595a('0x6c')](path['join'](config[_0x595a('0x6d')],_0x595a('0x54'),_0x595a('0x6e'),_0x595a('0x6f')),{'interaction':_0xb104eb})[_0x595a('0x18')](function(_0x59889d){var _0x39d740=path[_0x595a('0x53')](_0x2c7731,_0x595a('0x70')+_0xe3efc0['id']+'-'+_0x3fec99+'.pdf');var _0x4e3d89={'path':_0x39d740,'channel':_0x595a('0x71'),'interactionId':_0xe3efc0['id']};return pdf['createPdfFromHTML'](_0x59889d,_0x4e3d89);})[_0x595a('0x18')](function(){return new BPromise(function(_0x2c5a1e,_0xceeadb){zipdir(_0x2c7731,{'saveTo':_0x4ffbd6},function(_0x48b5a2,_0x2295a0){if(_0x48b5a2)return _0xceeadb(_0x48b5a2);return _0x2c5a1e(_0x2295a0);});})[_0x595a('0x18')](function(){return new BPromise(function(_0x4809d4,_0x5a0cfd){rimraf(_0x2c7731,function(_0x1d2263){if(_0x1d2263)_0x5a0cfd(_0x1d2263);return _0x4809d4();});});})[_0x595a('0x18')](function(){return _0x38094e[_0x595a('0x50')](_0x4ffbd6,_0x35c53d,function(_0x130404){if(_0x130404){console['log'](_0x595a('0x72'),_0x130404);}else{fs['unlinkSync'](_0x4ffbd6);}});});});}else{return _0x38094e['sendStatus'](0xc8);}})['catch'](handleError(_0x38094e,null));}; \ No newline at end of file +var _0xc1d0=['find','create','body','SmsInteraction','params','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','nolimit','sort','pick','SmsInteractionId','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','tmp','join','transcript-%d-%s.zip','fullname','push','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','Account','Owner','get','Sms','N.A.','closed','disposition','direction','out','User','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','getOptions','sms','query','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge'];(function(_0x542c6f,_0x3e85b8){var _0x270fed=function(_0x12ee48){while(--_0x12ee48){_0x542c6f['push'](_0x542c6f['shift']());}};_0x270fed(++_0x3e85b8);}(_0xc1d0,0x1a1));var _0x0c1d=function(_0x2394ca,_0x238f6b){_0x2394ca=_0x2394ca-0x0;var _0x138889=_0xc1d0[_0x2394ca];return _0x138889;};'use strict';var rimraf=require(_0x0c1d('0x0'));var zipdir=require(_0x0c1d('0x1'));var moment=require(_0x0c1d('0x2'));var BPromise=require(_0x0c1d('0x3'));var util=require(_0x0c1d('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c1d('0x5'));var Redis=require(_0x0c1d('0x6'));var interaction=require(_0x0c1d('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0c1d('0x8'));var logger=require(_0x0c1d('0x9'))('api');var config=require('../../config/environment');var db=require(_0x0c1d('0xa'))['db'];config[_0x0c1d('0xb')]=_['defaults'](config[_0x0c1d('0xb')],{'host':_0x0c1d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0c1d('0xd'))[_0x0c1d('0xe')](socket);function respondWithStatusCode(_0x759a5a,_0xf85a56){_0xf85a56=_0xf85a56||0xcc;return function(_0x1740bf){if(_0x1740bf){return _0x759a5a[_0x0c1d('0xf')](_0xf85a56);}return _0x759a5a[_0x0c1d('0x10')](_0xf85a56)[_0x0c1d('0x11')]();};}function respondWithResult(_0x119aba,_0x1661b4){_0x1661b4=_0x1661b4||0xc8;return function(_0x44e5b5){if(_0x44e5b5){return _0x119aba[_0x0c1d('0x10')](_0x1661b4)[_0x0c1d('0x12')](_0x44e5b5);}};}function respondWithFilteredResult(_0x59a2df,_0x3790bb){return function(_0x452b1f){if(_0x452b1f){var _0x3cb1f1=typeof _0x3790bb[_0x0c1d('0x13')]===_0x0c1d('0x14')&&typeof _0x3790bb['limit']===_0x0c1d('0x14');var _0x26661f=_0x452b1f['count'];var _0x405e7f=_0x3cb1f1?0x0:_0x3790bb[_0x0c1d('0x13')];var _0x34de39=_0x3cb1f1?_0x452b1f[_0x0c1d('0x15')]:_0x3790bb[_0x0c1d('0x13')]+_0x3790bb[_0x0c1d('0x16')];var _0x1ed920;if(_0x34de39>=_0x26661f){_0x34de39=_0x26661f;_0x1ed920=0xc8;}else{_0x1ed920=0xce;}_0x59a2df['status'](_0x1ed920);return _0x59a2df[_0x0c1d('0x17')](_0x0c1d('0x18'),_0x405e7f+'-'+_0x34de39+'/'+_0x26661f)[_0x0c1d('0x12')](_0x452b1f);}return null;};}function saveUpdates(_0xcca316){return function(_0x5a0144){if(_0x5a0144){return _0x5a0144[_0x0c1d('0x19')](_0xcca316)[_0x0c1d('0x1a')](function(_0x564e85){return _0x564e85;});}return null;};}function removeEntity(_0x50d7e2){return function(_0x4c07d1){if(_0x4c07d1){return _0x4c07d1[_0x0c1d('0x1b')]()['then'](function(){_0x50d7e2['status'](0xcc)[_0x0c1d('0x11')]();});}};}function handleEntityNotFound(_0x4fb3a0){return function(_0x454259){if(!_0x454259){_0x4fb3a0[_0x0c1d('0xf')](0x194);}return _0x454259;};}function handleError(_0x57ccf0,_0x2ad158){_0x2ad158=_0x2ad158||0x1f4;return function(_0x465d37){logger[_0x0c1d('0x1c')](_0x465d37[_0x0c1d('0x1d')]);if(_0x465d37[_0x0c1d('0x1e')]){delete _0x465d37['name'];}_0x57ccf0[_0x0c1d('0x10')](_0x2ad158)[_0x0c1d('0x1f')](_0x465d37);};}exports[_0x0c1d('0x20')]=function(_0x4bd64f,_0x30b4b9){var _0x1ea579={};var _0x13f01a=_[_0x0c1d('0x21')](db['SmsInteraction'][_0x0c1d('0x22')],function(_0x32c66f){return{'name':_0x32c66f['fieldName'],'type':_0x32c66f[_0x0c1d('0x23')]['key']};});_0x1ea579=qs[_0x0c1d('0x24')](_0x13f01a,_0x4bd64f);return interaction['findAll'](_0x0c1d('0x25'),_0x4bd64f[_0x0c1d('0x26')],_0x4bd64f['user'],_0x1ea579,_0x13f01a)[_0x0c1d('0x1a')](respondWithFilteredResult(_0x30b4b9,_0x1ea579))[_0x0c1d('0x27')](handleError(_0x30b4b9,null));};exports[_0x0c1d('0x28')]=function(_0x29d4d5,_0x2c4810){var _0x3ffea1={'raw':![],'where':{'id':_0x29d4d5['params']['id']}},_0x15aa7a={};_0x15aa7a[_0x0c1d('0x29')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x15aa7a['query']=_[_0x0c1d('0x2a')](_0x29d4d5['query']);_0x15aa7a[_0x0c1d('0x2b')]=_[_0x0c1d('0x2c')](_0x15aa7a[_0x0c1d('0x29')],_0x15aa7a[_0x0c1d('0x26')]);_0x3ffea1[_0x0c1d('0x2d')]=_[_0x0c1d('0x2c')](_0x15aa7a['model'],qs[_0x0c1d('0x2e')](_0x29d4d5[_0x0c1d('0x26')]['fields']));_0x3ffea1[_0x0c1d('0x2d')]=_0x3ffea1[_0x0c1d('0x2d')][_0x0c1d('0x2f')]?_0x3ffea1['attributes']:_0x15aa7a[_0x0c1d('0x29')];if(_0x29d4d5[_0x0c1d('0x26')][_0x0c1d('0x30')]){_0x3ffea1[_0x0c1d('0x31')]=[{'all':!![]}];}_0x3ffea1=_[_0x0c1d('0x32')]({},_0x3ffea1,_0x29d4d5['options']);return db['SmsInteraction'][_0x0c1d('0x33')](_0x3ffea1)[_0x0c1d('0x1a')](handleEntityNotFound(_0x2c4810,null))[_0x0c1d('0x1a')](respondWithResult(_0x2c4810,null))[_0x0c1d('0x27')](handleError(_0x2c4810,null));};exports[_0x0c1d('0x34')]=function(_0x1400d2,_0x48d562){return db['SmsInteraction'][_0x0c1d('0x34')](_0x1400d2[_0x0c1d('0x35')],{})[_0x0c1d('0x1a')](respondWithResult(_0x48d562,0xc9))['catch'](handleError(_0x48d562,null));};exports[_0x0c1d('0x19')]=function(_0x381673,_0x1fb8fb){if(_0x381673[_0x0c1d('0x35')]['id']){delete _0x381673[_0x0c1d('0x35')]['id'];}return db[_0x0c1d('0x36')][_0x0c1d('0x33')]({'where':{'id':_0x381673[_0x0c1d('0x37')]['id']}})['then'](handleEntityNotFound(_0x1fb8fb,null))['then'](saveUpdates(_0x381673[_0x0c1d('0x35')],null))['then'](respondWithResult(_0x1fb8fb,null))[_0x0c1d('0x27')](handleError(_0x1fb8fb,null));};exports['destroy']=function(_0x4ab0df,_0x1ff423){return db[_0x0c1d('0x36')][_0x0c1d('0x33')]({'where':{'id':_0x4ab0df[_0x0c1d('0x37')]['id']}})['then'](handleEntityNotFound(_0x1ff423,null))[_0x0c1d('0x1a')](removeEntity(_0x1ff423,null))['catch'](handleError(_0x1ff423,null));};exports[_0x0c1d('0x38')]=function(_0x130bbf,_0x57039e){return db[_0x0c1d('0x36')][_0x0c1d('0x38')]()[_0x0c1d('0x1a')](respondWithResult(_0x57039e,null))[_0x0c1d('0x27')](handleError(_0x57039e,null));};exports[_0x0c1d('0x39')]=function(_0x1c9d52,_0x1baca2){return db[_0x0c1d('0x3a')][_0x0c1d('0x33')]({'where':{'id':_0x1c9d52[_0x0c1d('0x37')]['id']}})[_0x0c1d('0x1a')](handleEntityNotFound(_0x1baca2,null))[_0x0c1d('0x1a')](function(_0xad7bd2){if(_0xad7bd2){return _0xad7bd2[_0x0c1d('0x39')](_0x1c9d52[_0x0c1d('0x35')][_0x0c1d('0x3b')],_[_0x0c1d('0x3c')](_0x1c9d52['body'],[_0x0c1d('0x3b'),'id'])||{});}})[_0x0c1d('0x1a')](respondWithResult(_0x1baca2,null))['catch'](handleError(_0x1baca2,null));};exports['getMessages']=function(_0xd5b365,_0x12de56){var _0x410559={'raw':![],'where':{}};var _0x3d8788={};var _0x4d9c3f={'count':0x0,'rows':[]};return db[_0x0c1d('0x36')][_0x0c1d('0x3d')]({'where':{'id':_0xd5b365[_0x0c1d('0x37')]['id']}})[_0x0c1d('0x1a')](handleEntityNotFound(_0x12de56,null))[_0x0c1d('0x1a')](function(_0x438780){if(_0x438780){_0x3d8788['model']=_[_0x0c1d('0x2a')](db['SmsMessage']['rawAttributes']);_0x3d8788[_0x0c1d('0x26')]=_['keys'](_0xd5b365[_0x0c1d('0x26')]);_0x3d8788[_0x0c1d('0x2b')]=_[_0x0c1d('0x2c')](_0x3d8788['model'],_0x3d8788[_0x0c1d('0x26')]);_0x410559['attributes']=_['intersection'](_0x3d8788[_0x0c1d('0x29')],qs[_0x0c1d('0x2e')](_0xd5b365[_0x0c1d('0x26')][_0x0c1d('0x2e')]));_0x410559[_0x0c1d('0x2d')]=_0x410559['attributes'][_0x0c1d('0x2f')]?_0x410559[_0x0c1d('0x2d')]:_0x3d8788[_0x0c1d('0x29')];if(!_0xd5b365[_0x0c1d('0x26')][_0x0c1d('0x3e')](_0x0c1d('0x3f'))){_0x410559[_0x0c1d('0x16')]=qs[_0x0c1d('0x16')](_0xd5b365[_0x0c1d('0x26')][_0x0c1d('0x16')]);_0x410559['offset']=qs[_0x0c1d('0x13')](_0xd5b365[_0x0c1d('0x26')]['offset']);}_0x410559['order']=qs[_0x0c1d('0x40')](_0xd5b365[_0x0c1d('0x26')][_0x0c1d('0x40')]);_0x410559['where']=qs[_0x0c1d('0x2b')](_[_0x0c1d('0x41')](_0xd5b365[_0x0c1d('0x26')],_0x3d8788[_0x0c1d('0x2b')]));_0x410559['where'][_0x0c1d('0x42')]=_0x438780['id'];if(_0xd5b365[_0x0c1d('0x26')][_0x0c1d('0x43')]){_0x410559[_0x0c1d('0x44')]=_[_0x0c1d('0x32')](_0x410559[_0x0c1d('0x44')],{'$or':_[_0x0c1d('0x21')](_0x410559['attributes'],function(_0x5332d2){var _0x426138={};_0x426138[_0x5332d2]={'$like':'%'+_0xd5b365[_0x0c1d('0x26')][_0x0c1d('0x43')]+'%'};return _0x426138;})});}if(_0xd5b365[_0x0c1d('0x26')][_0x0c1d('0x45')]){var _0x26e91a=_0xd5b365[_0x0c1d('0x26')]['$gte'][_0x0c1d('0x46')](',');var _0xe22393={};_0xe22393[_0x26e91a[0x0]]={'$gte':moment(_0x26e91a[0x1])[_0x0c1d('0x47')](_0x0c1d('0x48'))};_0x410559['where']=_[_0x0c1d('0x32')](_0x410559[_0x0c1d('0x44')],_0xe22393);}_0x410559=_['merge']({},_0x410559,_0xd5b365[_0x0c1d('0x49')]);return db['SmsMessage'][_0x0c1d('0x15')]({'where':_0x410559['where']})[_0x0c1d('0x1a')](function(_0x2d1dc5){_0x4d9c3f[_0x0c1d('0x15')]=_0x2d1dc5;if(_0xd5b365['query']['includeAll']){_0x410559[_0x0c1d('0x31')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x410559);})['then'](function(_0x3a6c13){_0x4d9c3f['rows']=_0x3a6c13;return _0x4d9c3f;});}})[_0x0c1d('0x1a')](respondWithFilteredResult(_0x12de56,_0x410559))[_0x0c1d('0x27')](handleError(_0x12de56,null));};exports[_0x0c1d('0x4a')]=function(_0x258d35,_0x54d9a1){return db[_0x0c1d('0x36')][_0x0c1d('0x33')]({'where':{'id':_0x258d35[_0x0c1d('0x37')]['id']}})[_0x0c1d('0x1a')](handleEntityNotFound(_0x54d9a1,null))[_0x0c1d('0x1a')](function(_0x45b550){if(_0x45b550){return _0x45b550[_0x0c1d('0x4b')](_0x258d35[_0x0c1d('0x35')][_0x0c1d('0x3b')],_[_0x0c1d('0x3c')](_0x258d35[_0x0c1d('0x35')],[_0x0c1d('0x3b'),'id'])||{})[_0x0c1d('0x4c')](function(){return db['Tag']['findAll']({'attributes':['id',_0x0c1d('0x1e'),_0x0c1d('0x4d')],'where':{'id':_0x258d35[_0x0c1d('0x35')][_0x0c1d('0x3b')]}});})[_0x0c1d('0x1a')](function(_0x45e922){socket[_0x0c1d('0x4e')](_0x0c1d('0x4f'),{'id':Number(_0x258d35[_0x0c1d('0x37')]['id']),'tags':_0x45e922||[]});return{'id':Number(_0x258d35[_0x0c1d('0x37')]['id']),'tags':_0x45e922||[]};});}})[_0x0c1d('0x1a')](respondWithResult(_0x54d9a1,null))[_0x0c1d('0x27')](handleError(_0x54d9a1,null));};exports['removeTags']=function(_0x71e25d,_0x4b6d10){return db['SmsInteraction'][_0x0c1d('0x33')]({'where':{'id':_0x71e25d[_0x0c1d('0x37')]['id']}})[_0x0c1d('0x1a')](handleEntityNotFound(_0x4b6d10,null))['then'](function(_0x4a2ff3){if(_0x4a2ff3){return _0x4a2ff3[_0x0c1d('0x50')](_0x71e25d[_0x0c1d('0x26')][_0x0c1d('0x3b')]);}})['then'](respondWithStatusCode(_0x4b6d10,null))[_0x0c1d('0x27')](handleError(_0x4b6d10,null));};exports[_0x0c1d('0x51')]=function(_0x125b7f,_0x1fac76){var _0x441425=moment()[_0x0c1d('0x52')]()[_0x0c1d('0x53')]();var _0x3a85ca=path['join'](config[_0x0c1d('0x54')],_0x0c1d('0x55'),'files',_0x0c1d('0x56'));var _0xad01a9=path[_0x0c1d('0x57')](_0x3a85ca,_0x441425);var _0x53cca2=util[_0x0c1d('0x47')](_0x0c1d('0x58'),_0x125b7f[_0x0c1d('0x37')]['id'],_0x441425);var _0x65643e=path[_0x0c1d('0x57')](_0x3a85ca,_0x53cca2);var _0x2018be=[];_0x2018be['push']({'model':db['User'],'as':'User','attributes':['id',_0x0c1d('0x59')],'raw':!![]});_0x2018be[_0x0c1d('0x5a')]({'model':db[_0x0c1d('0x5b')],'as':_0x0c1d('0x5c'),'attributes':['id',_0x0c1d('0x5d'),_0x0c1d('0x5e')],'raw':!![]});var _0x48d584=[{'model':db[_0x0c1d('0x3a')],'as':_0x0c1d('0x5f'),'attributes':['id',_0x0c1d('0x35'),_0x0c1d('0x60'),'direction',_0x0c1d('0x61'),'read'],'include':_0x2018be}];_0x48d584['push']({'model':db['SmsAccount'],'as':_0x0c1d('0x62'),'attributes':['id','name']});_0x48d584[_0x0c1d('0x5a')]({'model':db['User'],'as':_0x0c1d('0x63'),'attributes':['id',_0x0c1d('0x59')]});return db[_0x0c1d('0x36')][_0x0c1d('0x33')]({'where':{'id':_0x125b7f['params']['id']},'include':_0x48d584})[_0x0c1d('0x1a')](handleEntityNotFound(_0x1fac76,null))[_0x0c1d('0x1a')](function(_0x4873f3){if(_0x4873f3){var _0x310ad1=_0x4873f3[_0x0c1d('0x64')]({'plain':!![]});fs['mkdirSync'](_0xad01a9);var _0x2db6f7={'channel':_0x0c1d('0x65'),'account':_0x310ad1[_0x0c1d('0x62')]['name'],'agent':_0x310ad1[_0x0c1d('0x63')]?_0x310ad1[_0x0c1d('0x63')]['fullname']:_0x0c1d('0x66'),'createdAt':moment(_0x310ad1['createdAt'])[_0x0c1d('0x47')](_0x0c1d('0x48'))[_0x0c1d('0x53')](),'closedAt':_0x310ad1[_0x0c1d('0x67')]?moment(_0x310ad1['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0c1d('0x53')]():'','disposition':_0x310ad1[_0x0c1d('0x68')],'messages':_(_0x310ad1[_0x0c1d('0x5f')])[_0x0c1d('0x43')]({'secret':![]})[_0x0c1d('0x21')](function(_0x3351e8){return{'date':moment(_0x3351e8[_0x0c1d('0x60')])[_0x0c1d('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0c1d('0x53')](),'sender':_0x3351e8[_0x0c1d('0x69')]===_0x0c1d('0x6a')?_0x3351e8[_0x0c1d('0x6b')]?_0x3351e8[_0x0c1d('0x6b')][_0x0c1d('0x59')]:_0x0c1d('0x6c'):_0x3351e8['Contact'][_0x0c1d('0x5d')]+(_0x3351e8[_0x0c1d('0x5c')]['lastName']?'\x20'+_0x3351e8[_0x0c1d('0x5c')][_0x0c1d('0x5e')]:''),'body':_0x3351e8['body'],'direction':_0x3351e8[_0x0c1d('0x69')]===_0x0c1d('0x6a')?'A':'C','secret':_0x3351e8['secret'],'read':_0x3351e8[_0x0c1d('0x6d')]};})[_0x0c1d('0x6e')]()};return ejs[_0x0c1d('0x6f')](path['join'](config['root'],_0x0c1d('0x55'),_0x0c1d('0x70'),_0x0c1d('0x71')),{'interaction':_0x2db6f7})[_0x0c1d('0x1a')](function(_0xf7dbe5){var _0x2cc33e=path[_0x0c1d('0x57')](_0xad01a9,_0x0c1d('0x72')+_0x310ad1['id']+'-'+_0x441425+'.pdf');var _0x337074={'path':_0x2cc33e,'channel':'Sms','interactionId':_0x310ad1['id']};return pdf['createPdfFromHTML'](_0xf7dbe5,_0x337074);})[_0x0c1d('0x1a')](function(){return new BPromise(function(_0x136613,_0x31da85){zipdir(_0xad01a9,{'saveTo':_0x65643e},function(_0x54c16c,_0x1a2fe0){if(_0x54c16c)return _0x31da85(_0x54c16c);return _0x136613(_0x1a2fe0);});})[_0x0c1d('0x1a')](function(){return new BPromise(function(_0x554a59,_0x5c6a18){rimraf(_0xad01a9,function(_0x57e9c8){if(_0x57e9c8)_0x5c6a18(_0x57e9c8);return _0x554a59();});});})[_0x0c1d('0x1a')](function(){return _0x1fac76[_0x0c1d('0x51')](_0x65643e,_0x53cca2,function(_0xcd9312){if(_0xcd9312){console[_0x0c1d('0x73')]('err',_0xcd9312);}else{fs[_0x0c1d('0x74')](_0x65643e);}});});});}else{return _0x1fac76[_0x0c1d('0xf')](0xc8);}})[_0x0c1d('0x27')](handleError(_0x1fac76,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9341987..5fac7c7 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 _0x6343=['then','map','findAll','setDataValue','emit','hasOwnProperty','hook','exports','SmsInteraction','../../mysqldb','remove'];(function(_0x4866cb,_0x46b5c9){var _0x17ca38=function(_0x4d05e8){while(--_0x4d05e8){_0x4866cb['push'](_0x4866cb['shift']());}};_0x17ca38(++_0x46b5c9);}(_0x6343,0x168));var _0x3634=function(_0x96b5be,_0x18015d){_0x96b5be=_0x96b5be-0x0;var _0x223f06=_0x6343[_0x96b5be];return _0x223f06;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3634('0x0')];var SmsMessage=require(_0x3634('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3634('0x2')};function emitEvent(_0x420510){return function(_0x57c5e4,_0x247964,_0x388c18){_0x57c5e4['getUsers']({'attributes':['id'],'raw':!![]})[_0x3634('0x3')](function(_0xd40513){_0x57c5e4['setDataValue']('Users',_0xd40513[_0x3634('0x4')](function(_0x1bcdb2){return{'id':_0x1bcdb2['id']};}));return SmsMessage[_0x3634('0x5')]({'where':{'SmsInteractionId':_0x57c5e4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3634('0x3')](function(_0x2e8e8b){_0x57c5e4[_0x3634('0x6')]('unreadMessages',_0x2e8e8b['length']);SmsInteractionEvents[_0x3634('0x7')](_0x420510+':'+_0x57c5e4['id'],_0x57c5e4);SmsInteractionEvents[_0x3634('0x7')](_0x420510,_0x57c5e4);_0x388c18(null);})['catch'](_0x388c18(null));};}for(var e in events){if(events[_0x3634('0x8')](e)){var event=events[e];SmsInteraction[_0x3634('0x9')](e,emitEvent(event));}}module[_0x3634('0xa')]=SmsInteractionEvents; \ No newline at end of file +var _0xd824=['SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xd824,0xc2));var _0x4d82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd824[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x4d82('0x0'));var SmsInteraction=require(_0x4d82('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x4d82('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4d82('0x3')](0x0);var events={'afterCreate':_0x4d82('0x4'),'afterUpdate':_0x4d82('0x5'),'afterDestroy':_0x4d82('0x6')};function emitEvent(_0x1c8ad9){return function(_0x4bc746,_0x57850a,_0xd00023){_0x4bc746['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x464caf){_0x4bc746[_0x4d82('0x7')](_0x4d82('0x8'),_0x464caf['map'](function(_0x1ff96b){return{'id':_0x1ff96b['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4bc746['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x580bbd){_0x4bc746[_0x4d82('0x7')](_0x4d82('0x9'),_0x580bbd['length']);SmsInteractionEvents[_0x4d82('0xa')](_0x1c8ad9+':'+_0x4bc746['id'],_0x4bc746);SmsInteractionEvents['emit'](_0x1c8ad9,_0x4bc746);_0xd00023(null);})[_0x4d82('0xb')](_0xd00023(null));};}for(var e in events){if(events[_0x4d82('0xc')](e)){var event=events[e];SmsInteraction[_0x4d82('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 4dcb256..ae9c1af 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 _0xa4aa=['request-promise','path','../../config/environment','sms_interactions','changed','closed','closedAt','format','lodash','util'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa4aa,0x170));var _0xaa4a=function(_0x128d1b,_0x1b863b){_0x128d1b=_0x128d1b-0x0;var _0x3d955c=_0xa4aa[_0x128d1b];return _0x3d955c;};'use strict';var _=require(_0xaa4a('0x0'));var util=require(_0xaa4a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa4a('0x2'));var fs=require('fs');var path=require(_0xaa4a('0x3'));var rimraf=require('rimraf');var config=require(_0xaa4a('0x4'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x18a188,_0x5ca896){return _0x18a188['define']('SmsInteraction',attributes,{'tableName':_0xaa4a('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a2515,_0x55e282,_0x1a4547){if(_0x5a2515[_0xaa4a('0x6')](_0xaa4a('0x7'))){_0x5a2515[_0xaa4a('0x8')]=moment()[_0xaa4a('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1a4547(null,_0x5a2515);}}});}; \ No newline at end of file +var _0xc299=['request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird'];(function(_0x4446e4,_0x42ff9b){var _0x408ed5=function(_0x38670c){while(--_0x38670c){_0x4446e4['push'](_0x4446e4['shift']());}};_0x408ed5(++_0x42ff9b);}(_0xc299,0x6c));var _0x9c29=function(_0x5a91a5,_0x1eb099){_0x5a91a5=_0x5a91a5-0x0;var _0x8f99de=_0xc299[_0x5a91a5];return _0x8f99de;};'use strict';var _=require('lodash');var util=require(_0x9c29('0x0'));var logger=require(_0x9c29('0x1'))(_0x9c29('0x2'));var moment=require('moment');var BPromise=require(_0x9c29('0x3'));var rp=require(_0x9c29('0x4'));var fs=require('fs');var path=require(_0x9c29('0x5'));var rimraf=require(_0x9c29('0x6'));var config=require(_0x9c29('0x7'));var attributes=require(_0x9c29('0x8'));module['exports']=function(_0x2de581,_0x181b3c){return _0x2de581[_0x9c29('0x9')](_0x9c29('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b2e9d,_0x2e0dae,_0x110acc){if(_0x3b2e9d[_0x9c29('0xb')]('closed')){_0x3b2e9d[_0x9c29('0xc')]=moment()['format'](_0x9c29('0xd'));}_0x110acc(null,_0x3b2e9d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 80203fe..bdf843e 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 _0x3147=['request\x20sent','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message'];(function(_0x3439bc,_0x620c5e){var _0x3120cf=function(_0x16c871){while(--_0x16c871){_0x3439bc['push'](_0x3439bc['shift']());}};_0x3120cf(++_0x620c5e);}(_0x3147,0x6b));var _0x7314=function(_0x3fc81b,_0xd49a94){_0x3fc81b=_0x3fc81b-0x0;var _0x39596d=_0x3147[_0x3fc81b];return _0x39596d;};'use strict';var _=require(_0x7314('0x0'));var util=require(_0x7314('0x1'));var moment=require(_0x7314('0x2'));var BPromise=require(_0x7314('0x3'));var rs=require(_0x7314('0x4'));var fs=require('fs');var Redis=require(_0x7314('0x5'));var db=require(_0x7314('0x6'))['db'];var utils=require(_0x7314('0x7'));var logger=require(_0x7314('0x8'))(_0x7314('0x9'));var config=require(_0x7314('0xa'));var jayson=require(_0x7314('0xb'));var client=jayson['client'][_0x7314('0xc')]({'port':0x232a});config[_0x7314('0xd')]=_[_0x7314('0xe')](config[_0x7314('0xd')],{'host':_0x7314('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7314('0xd')]));require('./smsInteraction.socket')[_0x7314('0x10')](socket);function respondWithRpcPromise(_0x1d8c0d,_0x40e16b,_0x420936){return new BPromise(function(_0x3608f7,_0x5add0a){return client['request'](_0x1d8c0d,_0x420936)[_0x7314('0x11')](function(_0x70bd57){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x40e16b,'request\x20sent');logger[_0x7314('0x12')](_0x7314('0x13'),_0x40e16b,'request\x20sent',JSON[_0x7314('0x14')](_0x70bd57));if(_0x70bd57[_0x7314('0x15')]){if(_0x70bd57[_0x7314('0x15')][_0x7314('0x16')]===0x1f4){logger[_0x7314('0x15')](_0x7314('0x17'),_0x40e16b,_0x70bd57['error']['message']);return _0x5add0a(_0x70bd57[_0x7314('0x15')][_0x7314('0x18')]);}logger[_0x7314('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x40e16b,_0x70bd57['error'][_0x7314('0x18')]);return _0x3608f7(_0x70bd57[_0x7314('0x15')]['message']);}else{logger['info'](_0x7314('0x17'),_0x40e16b,_0x7314('0x19'));_0x3608f7(_0x70bd57[_0x7314('0x1a')]['message']);}})[_0x7314('0x1b')](function(_0x323279){logger[_0x7314('0x15')](_0x7314('0x17'),_0x40e16b,_0x323279);_0x5add0a(_0x323279);});});}exports[_0x7314('0x1c')]=function(_0x865d3c){var _0xa9e4fe=this;return new Promise(function(_0x277193,_0x2b5978){return db[_0x7314('0x1d')][_0x7314('0x1e')](_0x865d3c[_0x7314('0x1f')],{'raw':_0x865d3c[_0x7314('0x20')]?_0x865d3c[_0x7314('0x20')][_0x7314('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x865d3c[_0x7314('0x20')]?_0x865d3c[_0x7314('0x20')][_0x7314('0x22')]||null:null,'attributes':_0x865d3c['options']?_0x865d3c[_0x7314('0x20')][_0x7314('0x23')]||null:null,'limit':_0x865d3c['options']?_0x865d3c[_0x7314('0x20')][_0x7314('0x24')]||null:null})['then'](function(_0x2a2834){logger['info'](_0x7314('0x1c'),_0x865d3c);logger[_0x7314('0x12')](_0x7314('0x1c'),_0x865d3c,JSON['stringify'](_0x2a2834));_0x277193(_0x2a2834);})['catch'](function(_0x24e5ed){logger[_0x7314('0x15')](_0x7314('0x1c'),_0x24e5ed[_0x7314('0x18')],_0x865d3c);_0x2b5978(_0xa9e4fe[_0x7314('0x15')](0x1f4,_0x24e5ed[_0x7314('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x204517){return new Promise(function(_0x57c902,_0x8e3b59){return db['SmsInteraction'][_0x7314('0x25')]({'where':_0x204517[_0x7314('0x20')]?_0x204517[_0x7314('0x20')]['where']||null:null})[_0x7314('0x11')](function(_0x50409d){if(_0x50409d){return _0x50409d[_0x7314('0x26')](_0x204517['body'][_0x7314('0x27')],_[_0x7314('0x28')](_0x204517[_0x7314('0x1f')],[_0x7314('0x27'),'id'])||{});}})[_0x7314('0x29')](function(_0x1d2eeb){logger[_0x7314('0x2a')]('AddTags',_0x204517);logger[_0x7314('0x12')](_0x7314('0x2b'),_0x204517,JSON['stringify'](_0x1d2eeb));_0x57c902(_0x1d2eeb);})['catch'](function(_0x3c63c1){logger['error'](_0x7314('0x2b'),_0x3c63c1[_0x7314('0x18')],_0x204517);_0x8e3b59(_this['error'](0x1f4,_0x3c63c1['message']));});});}; \ No newline at end of file +var _0x2df2=['message','catch','SmsInteraction','update','body','raw','options','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0x2df2,0xd9));var _0x22df=function(_0x1dc29a,_0x10db83){_0x1dc29a=_0x1dc29a-0x0;var _0x547b4f=_0x2df2[_0x1dc29a];return _0x547b4f;};'use strict';var _=require(_0x22df('0x0'));var util=require(_0x22df('0x1'));var moment=require(_0x22df('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22df('0x3'))['db'];var utils=require(_0x22df('0x4'));var logger=require('../../config/logger')(_0x22df('0x5'));var config=require(_0x22df('0x6'));var jayson=require(_0x22df('0x7'));var client=jayson['client'][_0x22df('0x8')]({'port':0x232a});config[_0x22df('0x9')]=_[_0x22df('0xa')](config[_0x22df('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x22df('0xb'))(new Redis(config['redis']));require(_0x22df('0xc'))['register'](socket);function respondWithRpcPromise(_0x4c5cf0,_0x290720,_0x178936){return new BPromise(function(_0x10d749,_0x23759d){return client[_0x22df('0xd')](_0x4c5cf0,_0x178936)[_0x22df('0xe')](function(_0x539dcf){logger[_0x22df('0xf')](_0x22df('0x10'),_0x290720,'request\x20sent');logger[_0x22df('0x11')](_0x22df('0x12'),_0x290720,_0x22df('0x13'),JSON[_0x22df('0x14')](_0x539dcf));if(_0x539dcf[_0x22df('0x15')]){if(_0x539dcf[_0x22df('0x15')][_0x22df('0x16')]===0x1f4){logger[_0x22df('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x290720,_0x539dcf[_0x22df('0x15')][_0x22df('0x17')]);return _0x23759d(_0x539dcf['error'][_0x22df('0x17')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x290720,_0x539dcf['error'][_0x22df('0x17')]);return _0x10d749(_0x539dcf[_0x22df('0x15')]['message']);}else{logger[_0x22df('0xf')](_0x22df('0x10'),_0x290720,_0x22df('0x13'));_0x10d749(_0x539dcf['result'][_0x22df('0x17')]);}})[_0x22df('0x18')](function(_0x594c2c){logger['error'](_0x22df('0x10'),_0x290720,_0x594c2c);_0x23759d(_0x594c2c);});});}exports['UpdateSmsInteraction']=function(_0x27a1a2){var _0x9318ea=this;return new Promise(function(_0x26ddc7,_0x5cb9f7){return db[_0x22df('0x19')][_0x22df('0x1a')](_0x27a1a2[_0x22df('0x1b')],{'raw':_0x27a1a2['options']?_0x27a1a2['options'][_0x22df('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27a1a2['options']?_0x27a1a2[_0x22df('0x1d')][_0x22df('0x1e')]||null:null,'attributes':_0x27a1a2[_0x22df('0x1d')]?_0x27a1a2[_0x22df('0x1d')][_0x22df('0x1f')]||null:null,'limit':_0x27a1a2[_0x22df('0x1d')]?_0x27a1a2['options'][_0x22df('0x20')]||null:null})[_0x22df('0xe')](function(_0x3806d0){logger['info']('UpdateSmsInteraction',_0x27a1a2);logger['debug'](_0x22df('0x21'),_0x27a1a2,JSON['stringify'](_0x3806d0));_0x26ddc7(_0x3806d0);})[_0x22df('0x18')](function(_0xa92df7){logger['error'](_0x22df('0x21'),_0xa92df7[_0x22df('0x17')],_0x27a1a2);_0x5cb9f7(_0x9318ea[_0x22df('0x15')](0x1f4,_0xa92df7[_0x22df('0x17')]));});});};exports[_0x22df('0x22')]=function(_0x3fb4ca){return new Promise(function(_0xaa98b0,_0x3a25ef){return db[_0x22df('0x19')][_0x22df('0x23')]({'where':_0x3fb4ca[_0x22df('0x1d')]?_0x3fb4ca[_0x22df('0x1d')]['where']||null:null})[_0x22df('0xe')](function(_0x5c7369){if(_0x5c7369){return _0x5c7369[_0x22df('0x24')](_0x3fb4ca[_0x22df('0x1b')][_0x22df('0x25')],_[_0x22df('0x26')](_0x3fb4ca[_0x22df('0x1b')],[_0x22df('0x25'),'id'])||{});}})['spread'](function(_0x4dd0b7){logger[_0x22df('0xf')]('AddTags',_0x3fb4ca);logger[_0x22df('0x11')](_0x22df('0x27'),_0x3fb4ca,JSON[_0x22df('0x14')](_0x4dd0b7));_0xaa98b0(_0x4dd0b7);})['catch'](function(_0xd1af58){logger[_0x22df('0x15')](_0x22df('0x27'),_0xd1af58['message'],_0x3fb4ca);_0x3a25ef(_this[_0x22df('0x15')](0x1f4,_0xd1af58[_0x22df('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 79e2541..6cd37c9 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 _0x652a=['length','smsInteraction:','./smsInteraction.events','save','update','emit','removeListener','register'];(function(_0x3b0b8a,_0x52bcd1){var _0x1ee320=function(_0x1b40fb){while(--_0x1b40fb){_0x3b0b8a['push'](_0x3b0b8a['shift']());}};_0x1ee320(++_0x52bcd1);}(_0x652a,0x14a));var _0xa652=function(_0x18c917,_0x589c41){_0x18c917=_0x18c917-0x0;var _0x77f600=_0x652a[_0x18c917];return _0x77f600;};'use strict';var SmsInteractionEvents=require(_0xa652('0x0'));var events=[_0xa652('0x1'),'remove',_0xa652('0x2')];function createListener(_0x2ab061,_0x44e4d8){return function(_0x3942a6){_0x44e4d8[_0xa652('0x3')](_0x2ab061,_0x3942a6);};}function removeListener(_0x15d556,_0x54f896){return function(){SmsInteractionEvents[_0xa652('0x4')](_0x15d556,_0x54f896);};}exports[_0xa652('0x5')]=function(_0x21b24f){for(var _0x4f864d=0x0,_0x227aae=events[_0xa652('0x6')];_0x4f864d<_0x227aae;_0x4f864d++){var _0x405701=events[_0x4f864d];var _0x4b95e1=createListener(_0xa652('0x7')+_0x405701,_0x21b24f);SmsInteractionEvents['on'](_0x405701,_0x4b95e1);}}; \ No newline at end of file +var _0x1528=['register','smsInteraction:','./smsInteraction.events','save','emit'];(function(_0x4f4430,_0x3462d3){var _0x5448c4=function(_0x11e69b){while(--_0x11e69b){_0x4f4430['push'](_0x4f4430['shift']());}};_0x5448c4(++_0x3462d3);}(_0x1528,0xf7));var _0x8152=function(_0x4de443,_0x30fde7){_0x4de443=_0x4de443-0x0;var _0x1004be=_0x1528[_0x4de443];return _0x1004be;};'use strict';var SmsInteractionEvents=require(_0x8152('0x0'));var events=[_0x8152('0x1'),'remove','update'];function createListener(_0x313ae4,_0x296ed7){return function(_0x56232f){_0x296ed7[_0x8152('0x2')](_0x313ae4,_0x56232f);};}function removeListener(_0x223c72,_0x9f75c0){return function(){SmsInteractionEvents['removeListener'](_0x223c72,_0x9f75c0);};}exports[_0x8152('0x3')]=function(_0x362da0){for(var _0x1f1bde=0x0,_0x1d8e7c=events['length'];_0x1f1bde<_0x1d8e7c;_0x1f1bde++){var _0x21ec68=events[_0x1f1bde];var _0xe65ab3=createListener(_0x8152('0x4')+_0x21ec68,_0x362da0);SmsInteractionEvents['on'](_0x21ec68,_0xe65ab3);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 02d5b12..3c49929 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 _0xcc22=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','smsmessage:create','/:id/status','status','put','update','/:id/accept'];(function(_0x273edb,_0x224407){var _0x345a37=function(_0x54c30b){while(--_0x54c30b){_0x273edb['push'](_0x273edb['shift']());}};_0x345a37(++_0x224407);}(_0xcc22,0x19c));var _0x2cc2=function(_0x572c8b,_0x202e71){_0x572c8b=_0x572c8b-0x0;var _0x500ca1=_0xcc22[_0x572c8b];return _0x500ca1;};'use strict';var multer=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var path=require(_0x2cc2('0x2'));var timeout=require(_0x2cc2('0x3'));var express=require(_0x2cc2('0x4'));var router=express['Router']();var fs_extra=require(_0x2cc2('0x5'));var auth=require(_0x2cc2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2cc2('0x7'));var controller=require(_0x2cc2('0x8'));router[_0x2cc2('0x9')]('/',auth['isAuthenticated'](),controller[_0x2cc2('0xa')]);router[_0x2cc2('0x9')](_0x2cc2('0xb'),auth[_0x2cc2('0xc')](),controller['describe']);router[_0x2cc2('0x9')](_0x2cc2('0xd'),auth['isAuthenticated'](),controller[_0x2cc2('0xe')]);router[_0x2cc2('0xf')]('/',auth['isAuthenticated'](),interaction[_0x2cc2('0x10')]('sms',_0x2cc2('0x11')),controller['create']);router[_0x2cc2('0xf')](_0x2cc2('0x12'),controller[_0x2cc2('0x13')]);router[_0x2cc2('0x14')]('/:id',auth[_0x2cc2('0xc')](),controller[_0x2cc2('0x15')]);router['put'](_0x2cc2('0x16'),auth['isAuthenticated'](),controller[_0x2cc2('0x17')]);router['put'](_0x2cc2('0x18'),auth[_0x2cc2('0xc')](),controller[_0x2cc2('0x19')]);router[_0x2cc2('0x1a')]('/:id',auth[_0x2cc2('0xc')](),controller[_0x2cc2('0x1b')]);module[_0x2cc2('0x1c')]=router; \ No newline at end of file +var _0xf4ce=['tracked','sms','smsmessage:create','create','/:id/status','update','put','accept','/:id/reject','reject','delete','exports','multer','connect-timeout','express','Router','fs-extra','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4ce,0xf2));var _0xef4c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf4ce[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xef4c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xef4c('0x1'));var express=require(_0xef4c('0x2'));var router=express[_0xef4c('0x3')]();var fs_extra=require(_0xef4c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth[_0xef4c('0x5')](),controller[_0xef4c('0x6')]);router[_0xef4c('0x7')](_0xef4c('0x8'),auth[_0xef4c('0x5')](),controller[_0xef4c('0x9')]);router['get'](_0xef4c('0xa'),auth[_0xef4c('0x5')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0xef4c('0xb')](_0xef4c('0xc'),_0xef4c('0xd')),controller[_0xef4c('0xe')]);router['post'](_0xef4c('0xf'),controller['status']);router['put'](_0xef4c('0xa'),auth[_0xef4c('0x5')](),controller[_0xef4c('0x10')]);router[_0xef4c('0x11')]('/:id/accept',auth[_0xef4c('0x5')](),controller[_0xef4c('0x12')]);router[_0xef4c('0x11')](_0xef4c('0x13'),auth[_0xef4c('0x5')](),controller[_0xef4c('0x14')]);router[_0xef4c('0x15')](_0xef4c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xef4c('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 9b6874a..d27aad4 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 _0x142f=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','medium'];(function(_0x40eea5,_0x340e03){var _0x3fbbd0=function(_0x3a637a){while(--_0x3a637a){_0x40eea5['push'](_0x40eea5['shift']());}};_0x3fbbd0(++_0x340e03);}(_0x142f,0x136));var _0xf142=function(_0x281334,_0x4d8013){_0x281334=_0x281334-0x0;var _0x115f37=_0x142f[_0x281334];return _0x115f37;};'use strict';var Sequelize=require(_0xf142('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xf142('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xf142('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf142('0x3')]('in',_0xf142('0x4')),'defaultValue':_0xf142('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf142('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf142('0x5')]},'readAt':{'type':Sequelize[_0xf142('0x6')]},'secret':{'type':Sequelize[_0xf142('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf142('0x7')]}}; \ No newline at end of file +var _0x91f6=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0xca4c9,_0x14c72a){var _0x1e70c2=function(_0x1318ac){while(--_0x1318ac){_0xca4c9['push'](_0xca4c9['shift']());}};_0x1e70c2(++_0x14c72a);}(_0x91f6,0x168));var _0x691f=function(_0xec09da,_0x3bd270){_0xec09da=_0xec09da-0x0;var _0xff7281=_0x91f6[_0xec09da];return _0xff7281;};'use strict';var Sequelize=require('sequelize');module[_0x691f('0x0')]={'body':{'type':Sequelize[_0x691f('0x1')](_0x691f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x691f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x691f('0x4')]('in',_0x691f('0x5')),'defaultValue':_0x691f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x691f('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x691f('0x7')]},'secret':{'type':Sequelize[_0x691f('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x691f('0x6')]},'providerResponse':{'type':Sequelize[_0x691f('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1485b80..debc14c 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 _0x8edd=['interface','channel','motionChannel','EventManager','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','json','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','includeAll','merge','find','create','body','params','describe','accept','reject','sms','UserId','user','agent','get','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal'];(function(_0x4fe923,_0x57f797){var _0x31631e=function(_0x57ac12){while(--_0x57ac12){_0x4fe923['push'](_0x4fe923['shift']());}};_0x31631e(++_0x57f797);}(_0x8edd,0x175));var _0xd8ed=function(_0x13c475,_0x18dda1){_0x13c475=_0x13c475-0x0;var _0x1e04c5=_0x8edd[_0x13c475];return _0x1e04c5;};'use strict';var util=require(_0xd8ed('0x0'));var _=require(_0xd8ed('0x1'));var Redis=require(_0xd8ed('0x2'));var interactionService=require(_0xd8ed('0x3'));var qs=require(_0xd8ed('0x4'));var logger=require('../../config/logger')(_0xd8ed('0x5'));var config=require(_0xd8ed('0x6'));var db=require(_0xd8ed('0x7'))['db'];config[_0xd8ed('0x8')]=_['defaults'](config[_0xd8ed('0x8')],{'host':_0xd8ed('0x9'),'port':0x18eb});var socket=require(_0xd8ed('0xa'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xd8ed('0xb')](socket);var jayson=require(_0xd8ed('0xc'));var client=jayson[_0xd8ed('0xd')][_0xd8ed('0xe')]({'port':0x232c});var client9002=jayson[_0xd8ed('0xd')][_0xd8ed('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')('sms-interactions');function respondWithRpcPromise(_0x25aee0,_0xfc4b15,_0x4583d8,_0x3c6c1e){return new Promise(function(_0x458893,_0x4b0525){var _0x464f03=_0x3c6c1e||client;return _0x464f03['request'](_0x25aee0,_0x4583d8)['then'](function(_0x16253e){logger[_0xd8ed('0xf')](_0xd8ed('0x10'),_0xfc4b15,_0xd8ed('0x11'));logger[_0xd8ed('0x12')](_0xd8ed('0x13'),_0xfc4b15,_0xd8ed('0x11'),JSON['stringify'](_0x16253e));if(_0x16253e[_0xd8ed('0x14')]){if(_0x16253e[_0xd8ed('0x14')]['code']===0x1f4){logger[_0xd8ed('0x14')]('SmsMessage,\x20%s,\x20%s',_0xfc4b15,_0x16253e[_0xd8ed('0x14')][_0xd8ed('0x15')]);return _0x4b0525(_0x16253e[_0xd8ed('0x14')]['message']);}logger[_0xd8ed('0x14')](_0xd8ed('0x10'),_0xfc4b15,_0x16253e[_0xd8ed('0x14')][_0xd8ed('0x15')]);return _0x458893(_0x16253e[_0xd8ed('0x14')][_0xd8ed('0x15')]);}else{logger[_0xd8ed('0xf')]('SmsMessage,\x20%s,\x20%s',_0xfc4b15,_0xd8ed('0x11'));_0x458893(_0x16253e[_0xd8ed('0x16')][_0xd8ed('0x15')]);}})[_0xd8ed('0x17')](function(_0x19624f){logger[_0xd8ed('0x14')](_0xd8ed('0x10'),_0xfc4b15,_0x19624f);_0x4b0525(_0x19624f);});});}function respondWithResult(_0x1c54c1,_0x1b0143){_0x1b0143=_0x1b0143||0xc8;return function(_0x5c1997){if(_0x5c1997){return _0x1c54c1[_0xd8ed('0x18')](_0x1b0143)[_0xd8ed('0x19')](_0x5c1997);}};}function respondWithFilteredResult(_0x2d0fd2,_0x12bce8){return function(_0x29f988){if(_0x29f988){var _0x5450a5=typeof _0x12bce8[_0xd8ed('0x1a')]===_0xd8ed('0x1b')&&typeof _0x12bce8['limit']===_0xd8ed('0x1b');var _0x257765=_0x29f988[_0xd8ed('0x1c')];var _0x3de60a=_0x5450a5?0x0:_0x12bce8[_0xd8ed('0x1a')];var _0x9f6a04=_0x5450a5?_0x29f988[_0xd8ed('0x1c')]:_0x12bce8[_0xd8ed('0x1a')]+_0x12bce8[_0xd8ed('0x1d')];var _0x473a5f;if(_0x9f6a04>=_0x257765){_0x9f6a04=_0x257765;_0x473a5f=0xc8;}else{_0x473a5f=0xce;}_0x2d0fd2[_0xd8ed('0x18')](_0x473a5f);return _0x2d0fd2[_0xd8ed('0x1e')]('Content-Range',_0x3de60a+'-'+_0x9f6a04+'/'+_0x257765)[_0xd8ed('0x19')](_0x29f988);}return null;};}function saveUpdates(_0x4b3a7a){return function(_0x616516){if(_0x616516){return _0x616516[_0xd8ed('0x1f')](_0x4b3a7a)[_0xd8ed('0x20')](function(_0x56d825){return _0x56d825;});}return null;};}function removeEntity(_0x1df68a){return function(_0x56d6af){if(_0x56d6af){return _0x56d6af[_0xd8ed('0x21')]()['then'](function(){_0x1df68a[_0xd8ed('0x18')](0xcc)[_0xd8ed('0x22')]();});}};}function handleEntityNotFound(_0x47c244){return function(_0x3bbb7e){if(!_0x3bbb7e){_0x47c244[_0xd8ed('0x23')](0x194);}return _0x3bbb7e;};}function handleError(_0x5ee00d,_0x1921d1){_0x1921d1=_0x1921d1||0x1f4;return function(_0x12bd4d){logger[_0xd8ed('0x14')](_0x12bd4d[_0xd8ed('0x24')]);if(_0x12bd4d[_0xd8ed('0x25')]){delete _0x12bd4d['name'];}_0x5ee00d[_0xd8ed('0x18')](_0x1921d1)['send'](_0x12bd4d);};}exports[_0xd8ed('0x26')]=function(_0x421f80,_0x439209){var _0x13371d={},_0x13e5d4={},_0x44d361={'count':0x0,'rows':[]};var _0xef9d54=_[_0xd8ed('0x27')](db[_0xd8ed('0x28')][_0xd8ed('0x29')],function(_0x2ec2b0){return{'name':_0x2ec2b0[_0xd8ed('0x2a')],'type':_0x2ec2b0[_0xd8ed('0x2b')][_0xd8ed('0x2c')]};});_0x13e5d4['model']=_[_0xd8ed('0x27')](_0xef9d54,_0xd8ed('0x25'));_0x13e5d4['query']=_[_0xd8ed('0x2d')](_0x421f80[_0xd8ed('0x2e')]);_0x13e5d4[_0xd8ed('0x2f')]=_[_0xd8ed('0x30')](_0x13e5d4[_0xd8ed('0x31')],_0x13e5d4['query']);_0x13371d[_0xd8ed('0x32')]=_[_0xd8ed('0x30')](_0x13e5d4[_0xd8ed('0x31')],qs['fields'](_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x33')]));_0x13371d[_0xd8ed('0x32')]=_0x13371d[_0xd8ed('0x32')][_0xd8ed('0x34')]?_0x13371d[_0xd8ed('0x32')]:_0x13e5d4['model'];if(!_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x35')](_0xd8ed('0x36'))){_0x13371d[_0xd8ed('0x1d')]=qs['limit'](_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x1d')]);_0x13371d[_0xd8ed('0x1a')]=qs[_0xd8ed('0x1a')](_0x421f80[_0xd8ed('0x2e')]['offset']);}_0x13371d[_0xd8ed('0x37')]=qs['sort'](_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x38')]);_0x13371d['where']=qs[_0xd8ed('0x2f')](_[_0xd8ed('0x39')](_0x421f80['query'],_0x13e5d4[_0xd8ed('0x2f')]),_0xef9d54);if(_0x421f80[_0xd8ed('0x2e')][_0xd8ed('0x3a')]){_0x13371d[_0xd8ed('0x3b')]=_['merge'](_0x13371d[_0xd8ed('0x3b')],{'$or':_['map'](_0xef9d54,function(_0x10ddfd){if(_0x10ddfd[_0xd8ed('0x2b')]!==_0xd8ed('0x3c')){var _0x280f10={};_0x280f10[_0x10ddfd[_0xd8ed('0x25')]]={'$like':'%'+_0x421f80['query'][_0xd8ed('0x3a')]+'%'};return _0x280f10;}})});}_0x13371d=_['merge']({},_0x13371d,_0x421f80[_0xd8ed('0x3d')]);var _0x1d4ef4={'where':_0x13371d['where']};return db[_0xd8ed('0x28')]['count'](_0x1d4ef4)[_0xd8ed('0x20')](function(_0x2c84d2){_0x44d361[_0xd8ed('0x1c')]=_0x2c84d2;if(_0x421f80[_0xd8ed('0x2e')]['includeAll']){_0x13371d[_0xd8ed('0x3e')]=[{'all':!![]}];}return db['SmsMessage'][_0xd8ed('0x3f')](_0x13371d);})[_0xd8ed('0x20')](function(_0x3b1d01){_0x44d361[_0xd8ed('0x40')]=_0x3b1d01;return _0x44d361;})['then'](respondWithFilteredResult(_0x439209,_0x13371d))[_0xd8ed('0x17')](handleError(_0x439209,null));};exports['show']=function(_0x5afdac,_0x4a036c){var _0x592db6={'raw':!![],'where':{'id':_0x5afdac['params']['id']}},_0x5c9eab={};_0x5c9eab[_0xd8ed('0x31')]=_[_0xd8ed('0x2d')](db['SmsMessage'][_0xd8ed('0x29')]);_0x5c9eab[_0xd8ed('0x2e')]=_[_0xd8ed('0x2d')](_0x5afdac[_0xd8ed('0x2e')]);_0x5c9eab[_0xd8ed('0x2f')]=_[_0xd8ed('0x30')](_0x5c9eab[_0xd8ed('0x31')],_0x5c9eab[_0xd8ed('0x2e')]);_0x592db6[_0xd8ed('0x32')]=_[_0xd8ed('0x30')](_0x5c9eab[_0xd8ed('0x31')],qs[_0xd8ed('0x33')](_0x5afdac['query']['fields']));_0x592db6[_0xd8ed('0x32')]=_0x592db6[_0xd8ed('0x32')][_0xd8ed('0x34')]?_0x592db6[_0xd8ed('0x32')]:_0x5c9eab[_0xd8ed('0x31')];if(_0x5afdac[_0xd8ed('0x2e')][_0xd8ed('0x41')]){_0x592db6['include']=[{'all':!![]}];}_0x592db6=_[_0xd8ed('0x42')]({},_0x592db6,_0x5afdac[_0xd8ed('0x3d')]);return db[_0xd8ed('0x28')][_0xd8ed('0x43')](_0x592db6)[_0xd8ed('0x20')](handleEntityNotFound(_0x4a036c,null))[_0xd8ed('0x20')](respondWithResult(_0x4a036c,null))[_0xd8ed('0x17')](handleError(_0x4a036c,null));};exports[_0xd8ed('0x44')]=function(_0x391864,_0x4d2f0c){return db[_0xd8ed('0x28')][_0xd8ed('0x44')](_0x391864[_0xd8ed('0x45')],{})[_0xd8ed('0x20')](respondWithResult(_0x4d2f0c,0xc9))['catch'](handleError(_0x4d2f0c,null));};exports['update']=function(_0x591d44,_0x268542){if(_0x591d44[_0xd8ed('0x45')]['id']){delete _0x591d44['body']['id'];}return db['SmsMessage'][_0xd8ed('0x43')]({'where':{'id':_0x591d44[_0xd8ed('0x46')]['id']}})[_0xd8ed('0x20')](handleEntityNotFound(_0x268542,null))[_0xd8ed('0x20')](saveUpdates(_0x591d44[_0xd8ed('0x45')],null))[_0xd8ed('0x20')](respondWithResult(_0x268542,null))['catch'](handleError(_0x268542,null));};exports[_0xd8ed('0x21')]=function(_0xfcc3aa,_0x372169){return db[_0xd8ed('0x28')][_0xd8ed('0x43')]({'where':{'id':_0xfcc3aa[_0xd8ed('0x46')]['id']}})['then'](handleEntityNotFound(_0x372169,null))[_0xd8ed('0x20')](removeEntity(_0x372169,null))[_0xd8ed('0x17')](handleError(_0x372169,null));};exports[_0xd8ed('0x47')]=function(_0x25e00a,_0x33bd48){return db[_0xd8ed('0x28')][_0xd8ed('0x47')]()[_0xd8ed('0x20')](respondWithResult(_0x33bd48,null))[_0xd8ed('0x17')](handleError(_0x33bd48,null));};exports[_0xd8ed('0x48')]=function(_0x5cc414,_0x4d890c){var _0x1d971e='sms';return interactionService['acceptMessage'](_0x5cc414,_0x1d971e)[_0xd8ed('0x20')](respondWithResult(_0x4d890c,null))[_0xd8ed('0x17')](handleError(_0x4d890c,null));};exports[_0xd8ed('0x49')]=function(_0x588840,_0xf35e68){var _0x37175a={'agent':{},'channel':_0xd8ed('0x4a')};if(_0x588840[_0xd8ed('0x45')]['id']){delete _0x588840[_0xd8ed('0x45')]['id'];}_0x588840[_0xd8ed('0x45')][_0xd8ed('0x4b')]=_0x588840['body']['UserId']||_0x588840[_0xd8ed('0x4c')]['id'];_0x37175a[_0xd8ed('0x4d')]['id']=_0x588840['body'][_0xd8ed('0x4b')];return db[_0xd8ed('0x28')]['find']({'where':{'id':_0x588840[_0xd8ed('0x46')]['id'],'UserId':null}})[_0xd8ed('0x20')](handleEntityNotFound(_0xf35e68,null))['then'](function(_0xdb9587){if(_0xdb9587){_0x37175a['message']=_0xdb9587[_0xd8ed('0x4e')]({'plain':!![]});return db[_0xd8ed('0x4f')][_0xd8ed('0x43')]({'where':{'id':_0xdb9587[_0xd8ed('0x50')]}});}return null;})['then'](handleEntityNotFound(_0xf35e68,null))[_0xd8ed('0x20')](function(_0x17e0da){if(_0x17e0da){_0x37175a['interaction']=_0x17e0da[_0xd8ed('0x4e')]({'plain':!![]});interaction_log['info'](_0xd8ed('0x51'),_0x588840[_0xd8ed('0x4c')]['id'],_0x588840['user']['name'],_0x588840['user'][_0xd8ed('0x52')],_0x37175a[_0xd8ed('0x53')]['id'],_0x588840[_0xd8ed('0x45')]?JSON[_0xd8ed('0x54')](_0x588840['body']):'null');return respondWithRpcPromise('RejectMessage',_0xd8ed('0x55'),_0x37175a);}return null;})[_0xd8ed('0x20')](function(_0xb541ec){var _0x1b56e0=_0xd8ed('0x56')+_0xb541ec[_0xd8ed('0x15')][_0xd8ed('0x57')];return db[_0xd8ed('0x58')][_0xd8ed('0x2e')](_0x1b56e0,{'type':db[_0xd8ed('0x59')]['QueryTypes'][_0xd8ed('0x5a')],'raw':!![]})[_0xd8ed('0x20')](function(_0x33972b){return _0x33972b;});})[_0xd8ed('0x20')](function(_0x361720){if(_0x361720){_0x37175a[_0xd8ed('0x15')][_0xd8ed('0x5b')]=_0x361720[0x0];if(!_0x588840[_0xd8ed('0x45')][_0xd8ed('0x4b')])return;return db[_0xd8ed('0x5c')][_0xd8ed('0x43')]({'where':{'id':_0x588840['body'][_0xd8ed('0x4b')],'role':_0xd8ed('0x4d')},'attributes':['id',_0xd8ed('0x25'),'fullname',_0xd8ed('0x5d'),_0xd8ed('0x5e')],'raw':!![]});}return null;})[_0xd8ed('0x20')](function(_0x3df51b){if(!_0x3df51b)return null;_0x37175a['message']['agent']=_0x3df51b;return _0x37175a;})[_0xd8ed('0x20')](function(_0x130593){if(_0x130593){_0x130593[_0xd8ed('0x15')][_0xd8ed('0x5f')]=util['format']('SIP/%s',_0x588840[_0xd8ed('0x4c')]['name']);_0x130593[_0xd8ed('0x15')][_0xd8ed('0x60')]=_0x37175a[_0xd8ed('0x60')];_0x130593[_0xd8ed('0x15')][_0xd8ed('0x61')]=_0x37175a['channel'];_0x130593[_0xd8ed('0x15')]['event']=_0xd8ed('0x49');respondWithRpcPromise(_0xd8ed('0x62'),'EventManager',{'event':_0xd8ed('0x63'),'message':_0x130593['message']},client9002);return _0x37175a;}return null;})[_0xd8ed('0x20')](respondWithResult(_0xf35e68,null))[_0xd8ed('0x17')](handleError(_0xf35e68,null));};exports[_0xd8ed('0x18')]=function(_0x9ce309,_0x4a4a21){if(_0x9ce309['body']['id']){delete _0x9ce309[_0xd8ed('0x45')]['id'];}var _0x1170d2;return db[_0xd8ed('0x28')][_0xd8ed('0x43')]({'where':{'id':_0x9ce309[_0xd8ed('0x46')]['id']}})[_0xd8ed('0x20')](handleEntityNotFound(_0x4a4a21,null))[_0xd8ed('0x20')](function(_0xd88d34){if(_0xd88d34){_0x1170d2=_0xd88d34;return db['SmsAccount'][_0xd8ed('0x43')]({'where':{'id':_0xd88d34[_0xd8ed('0x64')]}});}})[_0xd8ed('0x20')](handleEntityNotFound(_0x4a4a21,null))[_0xd8ed('0x20')](function(_0x3789fc){if(_0x3789fc){logger[_0xd8ed('0x12')](_0xd8ed('0x13'),_0xd8ed('0x18'),_0xd8ed('0x65'),_0x3789fc[_0xd8ed('0x2b')],util[_0xd8ed('0x66')](_0x9ce309[_0xd8ed('0x45')],{'showHidden':![],'depth':null}));switch(_0x3789fc[_0xd8ed('0x2b')]){case _0xd8ed('0x67'):if(_0x9ce309[_0xd8ed('0x45')][_0xd8ed('0x68')]&&_0x9ce309[_0xd8ed('0x45')][_0xd8ed('0x68')]===_0x1170d2[_0xd8ed('0x69')]){return _0x1170d2[_0xd8ed('0x1f')]({'read':!![]});}else{logger[_0xd8ed('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd8ed('0x67'),util[_0xd8ed('0x66')](_0x9ce309[_0xd8ed('0x45')],{'showHidden':![],'depth':null}));}break;case _0xd8ed('0x6a'):if(_0x9ce309[_0xd8ed('0x45')][_0xd8ed('0x6b')]&&_0x9ce309[_0xd8ed('0x45')]['MessageUUID']===_0x1170d2['messageId']&&_[_0xd8ed('0x6c')]([_0xd8ed('0x6d'),_0xd8ed('0x6e')],_0x9ce309['body'][_0xd8ed('0x6f')])>=0x0){return _0x1170d2[_0xd8ed('0x1f')]({'read':!![]});}else{logger[_0xd8ed('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd8ed('0x18'),_0xd8ed('0x70'),util[_0xd8ed('0x66')](_0x9ce309[_0xd8ed('0x45')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x33e8ae=_0x9ce309['body'][_0xd8ed('0x71')][0x0];if(_0x33e8ae[_0xd8ed('0x18')][_0xd8ed('0x72')]==='DELIVERED'){return _0x1170d2[_0xd8ed('0x1f')]({'read':!![]});}else{logger[_0xd8ed('0x14')](_0xd8ed('0x73'),_0xd8ed('0x18'),_0xd8ed('0x74'),util[_0xd8ed('0x66')](_0x9ce309['body'],{'showHidden':![],'depth':null}));}break;}return _0x1170d2;}})['then'](respondWithResult(_0x4a4a21,null))[_0xd8ed('0x17')](handleError(_0x4a4a21,null));}; \ No newline at end of file +var _0x6bbb=['create','body','describe','sms','acceptMessage','reject','UserId','agent','get','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','format','SIP/%s','channel','motionChannel','EventManager','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageUUID','messageId','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','DELIVERED','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','sms-interactions','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','undefined','limit','count','offset','Content-Range','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','keys','includeAll','find'];(function(_0x1e01f1,_0x16ce39){var _0x466547=function(_0x2774cc){while(--_0x2774cc){_0x1e01f1['push'](_0x1e01f1['shift']());}};_0x466547(++_0x16ce39);}(_0x6bbb,0x18f));var _0xb6bb=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x6bbb[_0x5c4f6b];return _0x104c4e;};'use strict';var util=require(_0xb6bb('0x0'));var _=require(_0xb6bb('0x1'));var Redis=require(_0xb6bb('0x2'));var interactionService=require(_0xb6bb('0x3'));var qs=require(_0xb6bb('0x4'));var logger=require(_0xb6bb('0x5'))(_0xb6bb('0x6'));var config=require(_0xb6bb('0x7'));var db=require('../../mysqldb')['db'];config[_0xb6bb('0x8')]=_[_0xb6bb('0x9')](config['redis'],{'host':_0xb6bb('0xa'),'port':0x18eb});var socket=require(_0xb6bb('0xb'))(new Redis(config['redis']));require(_0xb6bb('0xc'))[_0xb6bb('0xd')](socket);var jayson=require(_0xb6bb('0xe'));var client=jayson['client'][_0xb6bb('0xf')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0xb6bb('0x10'));function respondWithRpcPromise(_0xbef022,_0x1ed444,_0x44d1f1,_0x1c00ed){return new Promise(function(_0x1babe1,_0x593834){var _0xb418b5=_0x1c00ed||client;return _0xb418b5['request'](_0xbef022,_0x44d1f1)[_0xb6bb('0x11')](function(_0x3f2998){logger[_0xb6bb('0x12')](_0xb6bb('0x13'),_0x1ed444,'request\x20sent');logger['debug'](_0xb6bb('0x14'),_0x1ed444,_0xb6bb('0x15'),JSON[_0xb6bb('0x16')](_0x3f2998));if(_0x3f2998[_0xb6bb('0x17')]){if(_0x3f2998[_0xb6bb('0x17')][_0xb6bb('0x18')]===0x1f4){logger['error'](_0xb6bb('0x13'),_0x1ed444,_0x3f2998[_0xb6bb('0x17')]['message']);return _0x593834(_0x3f2998[_0xb6bb('0x17')][_0xb6bb('0x19')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1ed444,_0x3f2998['error'][_0xb6bb('0x19')]);return _0x1babe1(_0x3f2998['error']['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1ed444,_0xb6bb('0x15'));_0x1babe1(_0x3f2998['result'][_0xb6bb('0x19')]);}})[_0xb6bb('0x1a')](function(_0x464b54){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1ed444,_0x464b54);_0x593834(_0x464b54);});});}function respondWithResult(_0x348c2e,_0x56420f){_0x56420f=_0x56420f||0xc8;return function(_0x474f31){if(_0x474f31){return _0x348c2e[_0xb6bb('0x1b')](_0x56420f)[_0xb6bb('0x1c')](_0x474f31);}};}function respondWithFilteredResult(_0x2ffb7a,_0x4ac9c0){return function(_0x1285b7){if(_0x1285b7){var _0x380c47=typeof _0x4ac9c0['offset']===_0xb6bb('0x1d')&&typeof _0x4ac9c0[_0xb6bb('0x1e')]===_0xb6bb('0x1d');var _0x19a00a=_0x1285b7[_0xb6bb('0x1f')];var _0x374b92=_0x380c47?0x0:_0x4ac9c0[_0xb6bb('0x20')];var _0x3be78d=_0x380c47?_0x1285b7[_0xb6bb('0x1f')]:_0x4ac9c0['offset']+_0x4ac9c0[_0xb6bb('0x1e')];var _0x52232c;if(_0x3be78d>=_0x19a00a){_0x3be78d=_0x19a00a;_0x52232c=0xc8;}else{_0x52232c=0xce;}_0x2ffb7a['status'](_0x52232c);return _0x2ffb7a['set'](_0xb6bb('0x21'),_0x374b92+'-'+_0x3be78d+'/'+_0x19a00a)[_0xb6bb('0x1c')](_0x1285b7);}return null;};}function saveUpdates(_0x32e5de){return function(_0x297190){if(_0x297190){return _0x297190[_0xb6bb('0x22')](_0x32e5de)['then'](function(_0x3df22e){return _0x3df22e;});}return null;};}function removeEntity(_0x506a35){return function(_0xf89da5){if(_0xf89da5){return _0xf89da5[_0xb6bb('0x23')]()[_0xb6bb('0x11')](function(){_0x506a35[_0xb6bb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xec483c){return function(_0x5ade08){if(!_0x5ade08){_0xec483c[_0xb6bb('0x24')](0x194);}return _0x5ade08;};}function handleError(_0x518b19,_0x19f5a5){_0x19f5a5=_0x19f5a5||0x1f4;return function(_0xa4001c){logger[_0xb6bb('0x17')](_0xa4001c[_0xb6bb('0x25')]);if(_0xa4001c[_0xb6bb('0x26')]){delete _0xa4001c[_0xb6bb('0x26')];}_0x518b19['status'](_0x19f5a5)[_0xb6bb('0x27')](_0xa4001c);};}exports[_0xb6bb('0x28')]=function(_0x57a909,_0x5ef8cb){var _0x33e986={},_0x585cf0={},_0x107408={'count':0x0,'rows':[]};var _0x75a35c=_[_0xb6bb('0x29')](db[_0xb6bb('0x2a')]['rawAttributes'],function(_0x334dec){return{'name':_0x334dec[_0xb6bb('0x2b')],'type':_0x334dec[_0xb6bb('0x2c')][_0xb6bb('0x2d')]};});_0x585cf0[_0xb6bb('0x2e')]=_['map'](_0x75a35c,_0xb6bb('0x26'));_0x585cf0[_0xb6bb('0x2f')]=_['keys'](_0x57a909[_0xb6bb('0x2f')]);_0x585cf0[_0xb6bb('0x30')]=_['intersection'](_0x585cf0[_0xb6bb('0x2e')],_0x585cf0[_0xb6bb('0x2f')]);_0x33e986['attributes']=_[_0xb6bb('0x31')](_0x585cf0[_0xb6bb('0x2e')],qs[_0xb6bb('0x32')](_0x57a909[_0xb6bb('0x2f')][_0xb6bb('0x32')]));_0x33e986['attributes']=_0x33e986[_0xb6bb('0x33')]['length']?_0x33e986[_0xb6bb('0x33')]:_0x585cf0['model'];if(!_0x57a909[_0xb6bb('0x2f')][_0xb6bb('0x34')](_0xb6bb('0x35'))){_0x33e986[_0xb6bb('0x1e')]=qs['limit'](_0x57a909['query'][_0xb6bb('0x1e')]);_0x33e986[_0xb6bb('0x20')]=qs[_0xb6bb('0x20')](_0x57a909['query']['offset']);}_0x33e986[_0xb6bb('0x36')]=qs[_0xb6bb('0x37')](_0x57a909[_0xb6bb('0x2f')][_0xb6bb('0x37')]);_0x33e986['where']=qs['filters'](_[_0xb6bb('0x38')](_0x57a909[_0xb6bb('0x2f')],_0x585cf0[_0xb6bb('0x30')]),_0x75a35c);if(_0x57a909[_0xb6bb('0x2f')][_0xb6bb('0x39')]){_0x33e986['where']=_['merge'](_0x33e986['where'],{'$or':_[_0xb6bb('0x29')](_0x75a35c,function(_0x200897){if(_0x200897['type']!==_0xb6bb('0x3a')){var _0x11f1e5={};_0x11f1e5[_0x200897[_0xb6bb('0x26')]]={'$like':'%'+_0x57a909['query'][_0xb6bb('0x39')]+'%'};return _0x11f1e5;}})});}_0x33e986=_[_0xb6bb('0x3b')]({},_0x33e986,_0x57a909[_0xb6bb('0x3c')]);var _0x4e8cb0={'where':_0x33e986['where']};return db[_0xb6bb('0x2a')][_0xb6bb('0x1f')](_0x4e8cb0)['then'](function(_0x163f4e){_0x107408[_0xb6bb('0x1f')]=_0x163f4e;if(_0x57a909[_0xb6bb('0x2f')]['includeAll']){_0x33e986[_0xb6bb('0x3d')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x33e986);})[_0xb6bb('0x11')](function(_0x418329){_0x107408[_0xb6bb('0x3e')]=_0x418329;return _0x107408;})[_0xb6bb('0x11')](respondWithFilteredResult(_0x5ef8cb,_0x33e986))[_0xb6bb('0x1a')](handleError(_0x5ef8cb,null));};exports[_0xb6bb('0x3f')]=function(_0x2611ec,_0x5e15cb){var _0xd065a4={'raw':!![],'where':{'id':_0x2611ec[_0xb6bb('0x40')]['id']}},_0x22878b={};_0x22878b['model']=_['keys'](db[_0xb6bb('0x2a')][_0xb6bb('0x41')]);_0x22878b[_0xb6bb('0x2f')]=_[_0xb6bb('0x42')](_0x2611ec['query']);_0x22878b[_0xb6bb('0x30')]=_[_0xb6bb('0x31')](_0x22878b['model'],_0x22878b[_0xb6bb('0x2f')]);_0xd065a4[_0xb6bb('0x33')]=_[_0xb6bb('0x31')](_0x22878b[_0xb6bb('0x2e')],qs[_0xb6bb('0x32')](_0x2611ec['query']['fields']));_0xd065a4['attributes']=_0xd065a4[_0xb6bb('0x33')]['length']?_0xd065a4[_0xb6bb('0x33')]:_0x22878b[_0xb6bb('0x2e')];if(_0x2611ec[_0xb6bb('0x2f')][_0xb6bb('0x43')]){_0xd065a4[_0xb6bb('0x3d')]=[{'all':!![]}];}_0xd065a4=_[_0xb6bb('0x3b')]({},_0xd065a4,_0x2611ec[_0xb6bb('0x3c')]);return db[_0xb6bb('0x2a')][_0xb6bb('0x44')](_0xd065a4)['then'](handleEntityNotFound(_0x5e15cb,null))['then'](respondWithResult(_0x5e15cb,null))[_0xb6bb('0x1a')](handleError(_0x5e15cb,null));};exports[_0xb6bb('0x45')]=function(_0x76c7e1,_0x13cc54){return db[_0xb6bb('0x2a')][_0xb6bb('0x45')](_0x76c7e1['body'],{})[_0xb6bb('0x11')](respondWithResult(_0x13cc54,0xc9))[_0xb6bb('0x1a')](handleError(_0x13cc54,null));};exports['update']=function(_0xd97c03,_0xbd05a3){if(_0xd97c03[_0xb6bb('0x46')]['id']){delete _0xd97c03[_0xb6bb('0x46')]['id'];}return db['SmsMessage'][_0xb6bb('0x44')]({'where':{'id':_0xd97c03[_0xb6bb('0x40')]['id']}})['then'](handleEntityNotFound(_0xbd05a3,null))[_0xb6bb('0x11')](saveUpdates(_0xd97c03[_0xb6bb('0x46')],null))[_0xb6bb('0x11')](respondWithResult(_0xbd05a3,null))[_0xb6bb('0x1a')](handleError(_0xbd05a3,null));};exports['destroy']=function(_0x127147,_0x18db8b){return db[_0xb6bb('0x2a')][_0xb6bb('0x44')]({'where':{'id':_0x127147[_0xb6bb('0x40')]['id']}})['then'](handleEntityNotFound(_0x18db8b,null))[_0xb6bb('0x11')](removeEntity(_0x18db8b,null))['catch'](handleError(_0x18db8b,null));};exports[_0xb6bb('0x47')]=function(_0x4f12b5,_0x1716cd){return db[_0xb6bb('0x2a')][_0xb6bb('0x47')]()[_0xb6bb('0x11')](respondWithResult(_0x1716cd,null))[_0xb6bb('0x1a')](handleError(_0x1716cd,null));};exports['accept']=function(_0x42f300,_0xe8ba33){var _0x122bf8=_0xb6bb('0x48');return interactionService[_0xb6bb('0x49')](_0x42f300,_0x122bf8)[_0xb6bb('0x11')](respondWithResult(_0xe8ba33,null))[_0xb6bb('0x1a')](handleError(_0xe8ba33,null));};exports[_0xb6bb('0x4a')]=function(_0xb7e00,_0x30a41f){var _0x57a769={'agent':{},'channel':'sms'};if(_0xb7e00[_0xb6bb('0x46')]['id']){delete _0xb7e00[_0xb6bb('0x46')]['id'];}_0xb7e00[_0xb6bb('0x46')][_0xb6bb('0x4b')]=_0xb7e00[_0xb6bb('0x46')][_0xb6bb('0x4b')]||_0xb7e00['user']['id'];_0x57a769[_0xb6bb('0x4c')]['id']=_0xb7e00[_0xb6bb('0x46')][_0xb6bb('0x4b')];return db[_0xb6bb('0x2a')]['find']({'where':{'id':_0xb7e00[_0xb6bb('0x40')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30a41f,null))[_0xb6bb('0x11')](function(_0x37992b){if(_0x37992b){_0x57a769[_0xb6bb('0x19')]=_0x37992b[_0xb6bb('0x4d')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x37992b[_0xb6bb('0x4e')]}});}return null;})['then'](handleEntityNotFound(_0x30a41f,null))[_0xb6bb('0x11')](function(_0x30d6c8){if(_0x30d6c8){_0x57a769[_0xb6bb('0x4f')]=_0x30d6c8[_0xb6bb('0x4d')]({'plain':!![]});interaction_log[_0xb6bb('0x12')](_0xb6bb('0x50'),_0xb7e00[_0xb6bb('0x51')]['id'],_0xb7e00['user'][_0xb6bb('0x26')],_0xb7e00[_0xb6bb('0x51')][_0xb6bb('0x52')],_0x57a769[_0xb6bb('0x4f')]['id'],_0xb7e00[_0xb6bb('0x46')]?JSON[_0xb6bb('0x16')](_0xb7e00['body']):_0xb6bb('0x53'));return respondWithRpcPromise(_0xb6bb('0x54'),_0xb6bb('0x55'),_0x57a769);}return null;})[_0xb6bb('0x11')](function(_0x4f79fc){var _0x470348='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4f79fc[_0xb6bb('0x19')][_0xb6bb('0x56')];return db[_0xb6bb('0x57')]['query'](_0x470348,{'type':db['Sequelize'][_0xb6bb('0x58')][_0xb6bb('0x59')],'raw':!![]})[_0xb6bb('0x11')](function(_0x5be2b9){return _0x5be2b9;});})[_0xb6bb('0x11')](function(_0x39beab){if(_0x39beab){_0x57a769[_0xb6bb('0x19')][_0xb6bb('0x5a')]=_0x39beab[0x0];if(!_0xb7e00[_0xb6bb('0x46')][_0xb6bb('0x4b')])return;return db[_0xb6bb('0x5b')]['find']({'where':{'id':_0xb7e00[_0xb6bb('0x46')][_0xb6bb('0x4b')],'role':_0xb6bb('0x4c')},'attributes':['id',_0xb6bb('0x26'),_0xb6bb('0x5c'),_0xb6bb('0x5d'),_0xb6bb('0x5e')],'raw':!![]});}return null;})['then'](function(_0x3bfa37){if(!_0x3bfa37)return null;_0x57a769[_0xb6bb('0x19')][_0xb6bb('0x4c')]=_0x3bfa37;return _0x57a769;})[_0xb6bb('0x11')](function(_0x5c08b4){if(_0x5c08b4){_0x5c08b4[_0xb6bb('0x19')]['interface']=util[_0xb6bb('0x5f')](_0xb6bb('0x60'),_0xb7e00['user'][_0xb6bb('0x26')]);_0x5c08b4[_0xb6bb('0x19')][_0xb6bb('0x61')]=_0x57a769[_0xb6bb('0x61')];_0x5c08b4[_0xb6bb('0x19')][_0xb6bb('0x62')]=_0x57a769['channel'];_0x5c08b4[_0xb6bb('0x19')]['event']='reject';respondWithRpcPromise(_0xb6bb('0x63'),_0xb6bb('0x63'),{'event':'rejectmessage','message':_0x5c08b4[_0xb6bb('0x19')]},client9002);return _0x57a769;}return null;})[_0xb6bb('0x11')](respondWithResult(_0x30a41f,null))['catch'](handleError(_0x30a41f,null));};exports[_0xb6bb('0x1b')]=function(_0x39093e,_0x1b82fc){if(_0x39093e['body']['id']){delete _0x39093e[_0xb6bb('0x46')]['id'];}var _0xabe4a4;return db[_0xb6bb('0x2a')]['find']({'where':{'id':_0x39093e['params']['id']}})[_0xb6bb('0x11')](handleEntityNotFound(_0x1b82fc,null))['then'](function(_0x603bdc){if(_0x603bdc){_0xabe4a4=_0x603bdc;return db[_0xb6bb('0x64')][_0xb6bb('0x44')]({'where':{'id':_0x603bdc[_0xb6bb('0x65')]}});}})[_0xb6bb('0x11')](handleEntityNotFound(_0x1b82fc,null))[_0xb6bb('0x11')](function(_0x2a31b2){if(_0x2a31b2){logger[_0xb6bb('0x66')](_0xb6bb('0x14'),_0xb6bb('0x1b'),_0xb6bb('0x67'),_0x2a31b2[_0xb6bb('0x2c')],util[_0xb6bb('0x68')](_0x39093e[_0xb6bb('0x46')],{'showHidden':![],'depth':null}));switch(_0x2a31b2[_0xb6bb('0x2c')]){case _0xb6bb('0x69'):if(_0x39093e[_0xb6bb('0x46')]['MessageSid']&&_0x39093e[_0xb6bb('0x46')][_0xb6bb('0x6a')]===_0xabe4a4['messageId']){return _0xabe4a4['update']({'read':!![]});}else{logger[_0xb6bb('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb6bb('0x1b'),_0xb6bb('0x69'),util['inspect'](_0x39093e[_0xb6bb('0x46')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x39093e['body'][_0xb6bb('0x6b')]&&_0x39093e[_0xb6bb('0x46')][_0xb6bb('0x6b')]===_0xabe4a4[_0xb6bb('0x6c')]&&_[_0xb6bb('0x6d')]([_0xb6bb('0x6e'),_0xb6bb('0x6f')],_0x39093e['body']['Status'])>=0x0){return _0xabe4a4[_0xb6bb('0x22')]({'read':!![]});}else{logger[_0xb6bb('0x17')](_0xb6bb('0x70'),'status',_0xb6bb('0x71'),util[_0xb6bb('0x68')](_0x39093e['body'],{'showHidden':![],'depth':null}));}break;case _0xb6bb('0x72'):var _0x2ffedc=_0x39093e[_0xb6bb('0x46')][_0xb6bb('0x73')][0x0];if(_0x2ffedc[_0xb6bb('0x1b')]['groupName']===_0xb6bb('0x74')){return _0xabe4a4[_0xb6bb('0x22')]({'read':!![]});}else{logger['error'](_0xb6bb('0x70'),_0xb6bb('0x1b'),_0xb6bb('0x72'),util['inspect'](_0x39093e['body'],{'showHidden':![],'depth':null}));}break;}return _0xabe4a4;}})[_0xb6bb('0x11')](respondWithResult(_0x1b82fc,null))[_0xb6bb('0x1a')](handleError(_0x1b82fc,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 927e8b6..e0f9e56 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 _0x74b6=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4747d4,_0x3e7853){var _0x282803=function(_0x4a8a3b){while(--_0x4a8a3b){_0x4747d4['push'](_0x4747d4['shift']());}};_0x282803(++_0x3e7853);}(_0x74b6,0x80));var _0x674b=function(_0xd324cd,_0x506a6c){_0xd324cd=_0xd324cd-0x0;var _0x306a33=_0x74b6[_0xd324cd];return _0x306a33;};'use strict';var EventEmitter=require(_0x674b('0x0'));var SmsMessage=require(_0x674b('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x674b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x674b('0x3'),'afterDestroy':_0x674b('0x4')};function emitEvent(_0x5c6735){return function(_0x59eb53,_0x301763,_0xf71f25){SmsMessageEvents[_0x674b('0x5')](_0x5c6735+':'+_0x59eb53['id'],_0x59eb53);SmsMessageEvents[_0x674b('0x5')](_0x5c6735,_0x59eb53);_0xf71f25(null);};}for(var e in events){if(events[_0x674b('0x6')](e)){var event=events[e];SmsMessage[_0x674b('0x7')](e,emitEvent(event));}}module[_0x674b('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x4bb8=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x43cd8c,_0x53b715){var _0x4f879e=function(_0x1d5eb7){while(--_0x1d5eb7){_0x43cd8c['push'](_0x43cd8c['shift']());}};_0x4f879e(++_0x53b715);}(_0x4bb8,0xa2));var _0x84bb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4bb8[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x84bb('0x0'));var SmsMessage=require(_0x84bb('0x1'))['db'][_0x84bb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x84bb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x84bb('0x4'),'afterDestroy':_0x84bb('0x5')};function emitEvent(_0xa3bff8){return function(_0x3d287a,_0x119997,_0x2b2b90){SmsMessageEvents[_0x84bb('0x6')](_0xa3bff8+':'+_0x3d287a['id'],_0x3d287a);SmsMessageEvents[_0x84bb('0x6')](_0xa3bff8,_0x3d287a);_0x2b2b90(null);};}for(var e in events){if(events[_0x84bb('0x7')](e)){var event=events[e];SmsMessage[_0x84bb('0x8')](e,emitEvent(event));}}module[_0x84bb('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 074d343..96b8a79 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 _0x97be=['sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','username','smsMethod','sender','&password=','password','split','sms','POST','user_key','session_key','total_sent','deliveryReport','senderString','https://smsapi.connectel.se/api/v2/send/','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','/api/sms/messages/','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage'];(function(_0x4511d8,_0x434729){var _0x4c6413=function(_0x5f3218){while(--_0x5f3218){_0x4511d8['push'](_0x4511d8['shift']());}};_0x4c6413(++_0x434729);}(_0x97be,0x1ee));var _0xe97b=function(_0x205135,_0x41fa04){_0x205135=_0x205135-0x0;var _0x166636=_0x97be[_0x205135];return _0x166636;};'use strict';var _=require(_0xe97b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe97b('0x1'));var BPromise=require(_0xe97b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe97b('0x3'));var rimraf=require(_0xe97b('0x4'));var config=require(_0xe97b('0x5'));var attributes=require(_0xe97b('0x6'));module[_0xe97b('0x7')]=function(_0x22a94a,_0x3b9351){return _0x22a94a[_0xe97b('0x8')](_0xe97b('0x9'),attributes,{'tableName':_0xe97b('0xa'),'paranoid':![],'indexes':[{'name':_0xe97b('0xb'),'fields':[_0xe97b('0xb')]},{'name':_0xe97b('0xc'),'fields':[_0xe97b('0xd')],'type':_0xe97b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42b069,_0xeafcc8,_0x1f150f){var _0x1126a3=_0x22a94a[_0xe97b('0xf')];var _0x46f67e=_0x42b069[_0xe97b('0x10')]({'plain':!![]});if(_0x46f67e[_0xe97b('0x11')][_0xe97b('0x12')]()==='in'||_0x46f67e[_0xe97b('0x11')][_0xe97b('0x12')]()===_0xe97b('0x13')&&!_0x46f67e[_0xe97b('0x14')]&&!_['isNil'](_0x46f67e[_0xe97b('0x15')])&&!_[_0xe97b('0x16')](_0x46f67e[_0xe97b('0x17')])){_0x1126a3[_0xe97b('0x18')][_0xe97b('0x19')]({'where':{'id':_0x46f67e['SmsInteractionId']}})[_0xe97b('0x1a')](function(_0x1044ee){if(_0x1044ee){_0x1044ee[_0xe97b('0x1b')]({'lastMsgAt':_0x46f67e['createdAt'],'lastMsgDirection':_0x46f67e[_0xe97b('0x11')][_0xe97b('0x12')]()});}})[_0xe97b('0x1c')](function(_0x531727){console[_0xe97b('0x1d')](_0x531727);});}if(_0x46f67e[_0xe97b('0x11')]===_0xe97b('0x13')&&!_0x46f67e[_0xe97b('0x14')]){var _0x357ec4;_0x1126a3[_0xe97b('0x1e')][_0xe97b('0x1f')]({'where':{'id':_0x46f67e[_0xe97b('0x20')]},'raw':!![]})[_0xe97b('0x1a')](function(_0x4caca6){_0x357ec4=_0x4caca6;if(_0x357ec4&&_0x357ec4[_0xe97b('0x21')]){switch(_0x357ec4[_0xe97b('0x21')]){case _0xe97b('0x22'):var _0x1fe2dd=require(_0xe97b('0x22'));if(_0x357ec4[_0xe97b('0x23')]&&_0x357ec4[_0xe97b('0x24')]&&_0x357ec4[_0xe97b('0x25')]){var _0x2a2d5b=new _0x1fe2dd(_0x357ec4['accountSid'],_0x357ec4[_0xe97b('0x24')]);_0x2a2d5b[_0xe97b('0x26')][_0xe97b('0x27')]({'body':_0x46f67e[_0xe97b('0xd')],'to':_0x46f67e[_0xe97b('0x25')],'from':_0x357ec4[_0xe97b('0x25')],'statusCallback':_0x357ec4['remote']+'/api/sms/messages/'+_0x46f67e['id']+'/status?token='+_0x357ec4[_0xe97b('0x28')]})[_0xe97b('0x1a')](function(_0x4ad4eb){if(_0x4ad4eb[_0xe97b('0x29')]){return _0x42b069[_0xe97b('0x1b')]({'messageId':_0x4ad4eb[_0xe97b('0x29')]});}})[_0xe97b('0x1c')](function(_0x2a7570){logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x22'),util[_0xe97b('0x2c')](_0x2a7570,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe97b('0x2d'):var _0x35b9ba='https://api.skebby.it/API/v1.0/REST/';if(_0x357ec4[_0xe97b('0x2e')]&&_0x357ec4['password']){var _0x3fdc9b={'recipient':[_0x46f67e['phone']],'message':_0x46f67e[_0xe97b('0xd')],'message_type':_0x357ec4['smsMethod']};if(_0x357ec4[_0xe97b('0x2f')]&&_0x357ec4[_0xe97b('0x2f')]!=='SI'){_0x3fdc9b[_0xe97b('0x30')]=_0x357ec4['phone'];}var _0x25145b={'url':_0x35b9ba+'login?username='+_0x357ec4[_0xe97b('0x2e')]+_0xe97b('0x31')+_0x357ec4[_0xe97b('0x32')],'method':'GET'};rp(_0x25145b)[_0xe97b('0x1a')](function(_0x43a210){var _0x126011=_0x43a210[_0xe97b('0x33')](';');var _0x40646f={'user_key':_0x126011[0x0],'session_key':_0x126011[0x1]};_0x25145b={'url':_0x35b9ba+_0xe97b('0x34'),'method':_0xe97b('0x35'),'headers':{'user_key':_0x40646f[_0xe97b('0x36')],'Session_key':_0x40646f[_0xe97b('0x37')]},'json':!![],'body':_0x3fdc9b};return rp(_0x25145b);})[_0xe97b('0x1a')](function(_0x127eb1){if(_0x127eb1[_0xe97b('0x38')]>=0x1){var _0x2673f3={'messageId':_0x127eb1['internal_order_id']};if(_0x357ec4[_0xe97b('0x2f')]!=='GP'||!_0x357ec4[_0xe97b('0x39')]){_0x2673f3['read']=!![];}return _0x42b069[_0xe97b('0x1b')](_0x2673f3);}else{return logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),'skebby',util[_0xe97b('0x2c')](_0x127eb1,{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x314f16){return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x2d'),util[_0xe97b('0x2c')](_0x314f16,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x357ec4[_0xe97b('0x24')]){var _0x5361ec={'recipient':_0x46f67e[_0xe97b('0x25')],'message':_0x46f67e[_0xe97b('0xd')],'sender':_0x357ec4[_0xe97b('0x3a')]||_0x357ec4['phone'],'authorization':_0x357ec4[_0xe97b('0x24')]};var _0xeafcc8={'method':_0xe97b('0x35'),'uri':_0xe97b('0x3b'),'body':_0x5361ec,'json':!![]};rp(_0xeafcc8)[_0xe97b('0x1a')](function(_0x3e5e3a){var _0x47d937={'messageId':_0x3e5e3a['requestid']};if(!_0x357ec4['deliveryReport']){_0x47d937[_0xe97b('0x3c')]=!![];}return _0x42b069[_0xe97b('0x1b')](_0x47d937);})['catch'](function(_0x2fe590){logger[_0xe97b('0x1d')](_0xe97b('0x2a'),'afterCreate',_0xe97b('0x3d'),util[_0xe97b('0x2c')](_0x2fe590,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),'connectel',_0xe97b('0x3e'));}break;case _0xe97b('0x3f'):if(_0x357ec4[_0xe97b('0x2e')]&&_0x357ec4[_0xe97b('0x32')]){var _0x5361ec={'messages':[{'source':_0xe97b('0x40'),'to':_0x46f67e['phone'],'body':_0x46f67e[_0xe97b('0xd')],'from':_0x357ec4[_0xe97b('0x3a')]||_0x357ec4[_0xe97b('0x25')]}]};var _0x112bdd=util[_0xe97b('0x41')](_0xe97b('0x42'),_0x357ec4['username'],_0x357ec4[_0xe97b('0x32')]);var _0xeafcc8={'method':_0xe97b('0x35'),'uri':_0xe97b('0x43'),'body':_0x5361ec,'headers':{'Authorization':util[_0xe97b('0x41')]('Basic\x20%s',new Buffer(_0x112bdd)['toString'](_0xe97b('0x44')))},'json':!![]};rp(_0xeafcc8)[_0xe97b('0x1a')](function(_0x19acde){if(_0x19acde['http_code']>=0xc8&&_0x19acde[_0xe97b('0x45')]<=0xce){if(_0x19acde[_0xe97b('0x46')]&&_0x19acde[_0xe97b('0x46')][_0xe97b('0x47')]>0x0){var _0xf59817=_['head'](_0x19acde[_0xe97b('0x46')][_0xe97b('0x26')]);var _0x375f24={'messageId':_0xf59817[_0xe97b('0x48')]};if(!_0x357ec4[_0xe97b('0x39')]){_0x375f24[_0xe97b('0x3c')]=!![];}return _0x42b069['update'](_0x375f24);}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),'clickSend',util[_0xe97b('0x2c')](_0x19acde,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),'clickSend',util[_0xe97b('0x2c')](_0x19acde,{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x469563){logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x49'),util[_0xe97b('0x2c')](_0x469563,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),_0xe97b('0x49'),_0xe97b('0x4a'));}break;case _0xe97b('0x4b'):if(_0x357ec4[_0xe97b('0x4c')]&&_0x357ec4[_0xe97b('0x24')]){var _0x5361ec={'dst':_0x46f67e[_0xe97b('0x25')],'text':_0x46f67e['body'],'src':_0x357ec4[_0xe97b('0x3a')]||_0x357ec4[_0xe97b('0x25')],'url':_0x357ec4[_0xe97b('0x4d')]+_0xe97b('0x4e')+_0x46f67e['id']+_0xe97b('0x4f')+_0x357ec4[_0xe97b('0x28')]};var _0x112bdd=util[_0xe97b('0x41')]('%s:%s',_0x357ec4['authId'],_0x357ec4[_0xe97b('0x24')]);var _0xeafcc8={'method':_0xe97b('0x35'),'uri':util[_0xe97b('0x41')](_0xe97b('0x50'),_0x357ec4[_0xe97b('0x4c')]),'body':_0x5361ec,'headers':{'Authorization':util[_0xe97b('0x41')](_0xe97b('0x51'),new Buffer(_0x112bdd)[_0xe97b('0x52')](_0xe97b('0x44')))},'json':!![]};rp(_0xeafcc8)[_0xe97b('0x1a')](function(_0x2cc9bc){var _0x49a812={'messageId':_0x2cc9bc[_0xe97b('0x53')][0x0]};return _0x42b069['update'](_0x49a812);})['catch'](function(_0x37ce12){logger[_0xe97b('0x1d')](_0xe97b('0x2a'),'afterCreate','plivo',util[_0xe97b('0x2c')](_0x37ce12,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x4b'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xe97b('0x54'):if(_0x357ec4['username']&&_0x357ec4['password']){if(_0x357ec4[_0xe97b('0x55')]){var _0x12dc0c={'method':'POST','uri':_0x357ec4[_0xe97b('0x55')]+_0xe97b('0x56'),'body':{'username':_0x357ec4[_0xe97b('0x2e')],'password':_0x357ec4[_0xe97b('0x32')]},'json':!![]};return rp(_0x12dc0c)[_0xe97b('0x1a')](function(_0x43c167){var _0x3acd78={'method':_0xe97b('0x35'),'uri':_0x357ec4['baseUrl']+_0xe97b('0x57'),'body':{'messages':[{'from':_0x357ec4[_0xe97b('0x25')],'destinations':[{'to':_0x46f67e[_0xe97b('0x25')]}],'text':_0x46f67e[_0xe97b('0xd')],'notifyUrl':_0x357ec4[_0xe97b('0x4d')]+_0xe97b('0x4e')+_0x46f67e['id']+_0xe97b('0x4f')+_0x357ec4[_0xe97b('0x28')],'notifyContentType':_0xe97b('0x58'),'callbackData':_0x357ec4[_0xe97b('0x25')]+';'+_0x46f67e[_0xe97b('0xd')]}]},'headers':{'Authorization':_0xe97b('0x59')+_0x43c167[_0xe97b('0x28')]},'json':!![]};return rp(_0x3acd78)[_0xe97b('0x1a')](function(_0x11866a){if(_0x11866a['messages']){var _0xdaf153={'messageId':_0x11866a[_0xe97b('0x26')][0x0][_0xe97b('0xb')]};if(!_0x357ec4[_0xe97b('0x39')]){_0xdaf153['read']=!![];}return _0x42b069[_0xe97b('0x1b')](_0xdaf153);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),_0xe97b('0x54'),util[_0xe97b('0x2c')](_0x11866a,{'showHidden':![],'depth':null}));}});})[_0xe97b('0x1c')](function(_0xcabe42){return logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x54'),util[_0xe97b('0x2c')](_0xcabe42,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x54'),_0xe97b('0x5a'));}}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe97b('0x5b'):var _0x51c723=require('crypto');if(_0x357ec4[_0xe97b('0x5c')]){var _0x5d0b2f={};_0x5d0b2f[_0xe97b('0x5d')]=_0x357ec4['username'];_0x5d0b2f['phone']=_0x46f67e[_0xe97b('0x25')];_0x5d0b2f['sender']=_0x357ec4[_0xe97b('0x25')];_0x5d0b2f[_0xe97b('0x5e')]=_0x46f67e[_0xe97b('0xd')];_0x5d0b2f[_0xe97b('0x5f')]=+new Date();var _0x5893c6='';var _0x1cc22b='';var _0x5a20ac=Object[_0xe97b('0x60')](_0x5d0b2f);_0x5a20ac[_0xe97b('0x61')]();for(var _0x40dffe=0x0;_0x40dffe<_0x5a20ac['length'];_0x40dffe++){if(_0x5893c6!=''){_0x5893c6+='&';}_0x5893c6+=_0x5a20ac[_0x40dffe]+'='+encodeURIComponent(_0x5d0b2f[_0x5a20ac[_0x40dffe]]);_0x1cc22b+=_0x5d0b2f[_0x5a20ac[_0x40dffe]];}_0x1cc22b+=_0x357ec4[_0xe97b('0x5c')];_0x1cc22b=_0x51c723[_0xe97b('0x62')](_0xe97b('0x63'))[_0xe97b('0x1b')](_0x1cc22b)[_0xe97b('0x64')](_0xe97b('0x65'));if(_0x5893c6!==''){_0x5893c6+='&';}_0x5893c6+=_0xe97b('0x66')+_0x1cc22b;var _0x25145b={'method':_0xe97b('0x67'),'uri':_0x357ec4[_0xe97b('0x55')]+_0xe97b('0x68')+_0x5893c6,'json':!![]};return rp(_0x25145b)[_0xe97b('0x1a')](function(_0x2ea68f){var _0x5723b6=Object[_0xe97b('0x60')](_0x2ea68f);if(_0x2ea68f[_0x5723b6[0x0]]['error']&&parseInt(_0x2ea68f[_0x5723b6[0x0]][_0xe97b('0x1d')])===0x0){var _0x5254ea={'messageId':_0x2ea68f[_0x5723b6[0x0]][_0xe97b('0x69')]};if(!_0x357ec4[_0xe97b('0x39')]){_0x5254ea['read']=!![];}return _0x42b069['update'](_0x5254ea);}else{return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x5b'),util[_0xe97b('0x2c')](_0x2ea68f[_0xe97b('0x1d')],{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x209b2a){return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x5b'),util[_0xe97b('0x2c')](_0x209b2a,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),'afterCreate','csc','Missing\x20parameters:\x20apiKey');}break;case _0xe97b('0x6a'):if(_0x357ec4[_0xe97b('0x5c')]){var _0x5edf1d={'method':_0xe97b('0x35'),'uri':_0xe97b('0x6b'),'headers':{'Authorization':_0x357ec4[_0xe97b('0x5c')]},'body':{'content':_0x46f67e['body'],'to':[_0x46f67e[_0xe97b('0x25')]],'from':_0x357ec4[_0xe97b('0x25')],'binary':![],'clientMessageId':'uuid','charset':_0xe97b('0x6c')},'json':!![]};rp(_0x5edf1d)[_0xe97b('0x1a')](function(_0x1ad8e3){if(!_0x1ad8e3[_0xe97b('0x1d')]){var _0x2acd04={'messageId':_0x1ad8e3[_0xe97b('0x26')][0x0][_0xe97b('0x6d')]};if(!_0x357ec4[_0xe97b('0x39')]){_0x2acd04[_0xe97b('0x3c')]=!![];}return _0x42b069[_0xe97b('0x1b')](_0x2acd04);}else{return logger['error'](_0xe97b('0x2a'),'afterCreate','clickatell',util[_0xe97b('0x2c')](_0x1ad8e3['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3bbe21){return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x6a'),util[_0xe97b('0x2c')](_0x3bbe21,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),_0xe97b('0x6a'),_0xe97b('0x6e'));}break;case _0xe97b('0x6f'):if(_0x357ec4[_0xe97b('0x2e')]&&_0x357ec4[_0xe97b('0x32')]){var _0x112bdd=util[_0xe97b('0x41')]('%s:%s',_0x357ec4[_0xe97b('0x2e')],_0x357ec4['password']);var _0xeafcc8={'method':_0xe97b('0x35'),'uri':_0xe97b('0x70')+_0x357ec4[_0xe97b('0x71')]+_0xe97b('0x72'),'body':{'to':[_0x46f67e[_0xe97b('0x25')]],'text':_0x46f67e['body'],'from':_0x357ec4[_0xe97b('0x25')],'applicationId':_0x357ec4[_0xe97b('0x73')]},'headers':{'Authorization':util[_0xe97b('0x41')]('Basic\x20%s',new Buffer(_0x112bdd)[_0xe97b('0x52')](_0xe97b('0x44')))},'json':!![]};rp(_0xeafcc8)['then'](function(_0x2670e7){if(_0x2670e7['id']){var _0x215bcd={'messageId':_0x2670e7['id']};return _0x42b069['update'](_0x215bcd);}else{logger['error'](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x6f'),util['inspect'](_0x2670e7,{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x56f11b){logger[_0xe97b('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),'bandwidth',util[_0xe97b('0x2c')](_0x56f11b,{'showHidden':![],'depth':null}));});}else{logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x6f'),_0xe97b('0x4a'));}break;case _0xe97b('0x74'):if(_0x357ec4[_0xe97b('0x5c')]){var _0x330d9c={};var _0x25145b={'method':'POST','uri':_0xe97b('0x75'),'headers':{'Authorization':_0xe97b('0x76')+_0x357ec4['apiKey'],'Content-Type':_0xe97b('0x58')},'body':{'from':_0x357ec4[_0xe97b('0x25')],'to':_0x46f67e[_0xe97b('0x25')],'text':_0x46f67e[_0xe97b('0xd')]},'json':!![]};return rp(_0x25145b)[_0xe97b('0x1a')](function(_0x459743){if(_0x459743[_0xe97b('0x77')]==0xca){_0x330d9c[_0xe97b('0x78')]=_0x459743;var _0x1060f6={'method':'POST','uri':_0xe97b('0x79'),'headers':{'Authorization':'Bearer\x20'+_0x357ec4[_0xe97b('0x5c')],'Content-Type':_0xe97b('0x58')},'body':{'refid':_0x330d9c[_0xe97b('0x78')][_0xe97b('0x7a')]},'json':!![]};return rp(_0x1060f6)[_0xe97b('0x1a')](function(_0x3c766c){_0x330d9c[_0xe97b('0x7b')]=_0x3c766c;var _0x1eb639={'messageId':_0x330d9c[_0xe97b('0x78')][_0xe97b('0x7a')],'read':!![]};return _0x42b069[_0xe97b('0x1b')](_0x1eb639);});}else{return logger[_0xe97b('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe97b('0x2b'),'intelepeer',util['inspect'](_0x459743,{'showHidden':![],'depth':null}));}})[_0xe97b('0x1c')](function(_0x5c99da){return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),'afterCreate',_0xe97b('0x74'),util[_0xe97b('0x2c')](_0x5c99da,{'showHidden':![],'depth':null}));});}else{return logger[_0xe97b('0x1d')](_0xe97b('0x2a'),_0xe97b('0x2b'),_0xe97b('0x74'),_0xe97b('0x7c'));}break;}}})['finally'](function(){_0x1f150f();});}else{_0x1f150f();}}},'charset':'utf8mb4','collate':_0xe97b('0x7d')});}; \ No newline at end of file +var _0xf68a=['SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','accountSid','authToken','phone','create','remote','/status?token=','token','sid','afterCreate','inspect','error','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','deliveryReport','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','sort','length','hex','signature=','GET','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x1d1276,_0x4c549c){var _0x234498=function(_0x50e969){while(--_0x50e969){_0x1d1276['push'](_0x1d1276['shift']());}};_0x234498(++_0x4c549c);}(_0xf68a,0x69));var _0xaf68=function(_0x655ad4,_0x259823){_0x655ad4=_0x655ad4-0x0;var _0x4b931f=_0xf68a[_0x655ad4];return _0x4b931f;};'use strict';var _=require(_0xaf68('0x0'));var util=require(_0xaf68('0x1'));var logger=require('../../config/logger')(_0xaf68('0x2'));var moment=require(_0xaf68('0x3'));var BPromise=require(_0xaf68('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf68('0x5'));var rimraf=require(_0xaf68('0x6'));var config=require(_0xaf68('0x7'));var attributes=require(_0xaf68('0x8'));module[_0xaf68('0x9')]=function(_0x52cefe,_0x4f8f8f){return _0x52cefe[_0xaf68('0xa')](_0xaf68('0xb'),attributes,{'tableName':_0xaf68('0xc'),'paranoid':![],'indexes':[{'name':_0xaf68('0xd'),'fields':[_0xaf68('0xd')]},{'name':_0xaf68('0xe'),'fields':[_0xaf68('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x510ed8,_0x37210b,_0x2e1b98){var _0x264dd6=_0x52cefe[_0xaf68('0x10')];var _0x53f8b9=_0x510ed8[_0xaf68('0x11')]({'plain':!![]});if(_0x53f8b9[_0xaf68('0x12')][_0xaf68('0x13')]()==='in'||_0x53f8b9[_0xaf68('0x12')][_0xaf68('0x13')]()===_0xaf68('0x14')&&!_0x53f8b9[_0xaf68('0x15')]&&!_[_0xaf68('0x16')](_0x53f8b9['UserId'])&&!_[_0xaf68('0x16')](_0x53f8b9[_0xaf68('0x17')])){_0x264dd6[_0xaf68('0x18')][_0xaf68('0x19')]({'where':{'id':_0x53f8b9['SmsInteractionId']}})[_0xaf68('0x1a')](function(_0x557ea3){if(_0x557ea3){_0x557ea3[_0xaf68('0x1b')]({'lastMsgAt':_0x53f8b9[_0xaf68('0x1c')],'lastMsgDirection':_0x53f8b9[_0xaf68('0x12')][_0xaf68('0x13')]()});}})[_0xaf68('0x1d')](function(_0x1af174){console['error'](_0x1af174);});}if(_0x53f8b9[_0xaf68('0x12')]===_0xaf68('0x14')&&!_0x53f8b9[_0xaf68('0x15')]){var _0xef17b0;_0x264dd6[_0xaf68('0x1e')][_0xaf68('0x1f')]({'where':{'id':_0x53f8b9[_0xaf68('0x20')]},'raw':!![]})[_0xaf68('0x1a')](function(_0x1ecbad){_0xef17b0=_0x1ecbad;if(_0xef17b0&&_0xef17b0[_0xaf68('0x21')]){switch(_0xef17b0['type']){case'twilio':var _0x1980e0=require('twilio');if(_0xef17b0[_0xaf68('0x22')]&&_0xef17b0[_0xaf68('0x23')]&&_0xef17b0[_0xaf68('0x24')]){var _0x44916d=new _0x1980e0(_0xef17b0[_0xaf68('0x22')],_0xef17b0[_0xaf68('0x23')]);_0x44916d['messages'][_0xaf68('0x25')]({'body':_0x53f8b9[_0xaf68('0xf')],'to':_0x53f8b9['phone'],'from':_0xef17b0[_0xaf68('0x24')],'statusCallback':_0xef17b0[_0xaf68('0x26')]+'/api/sms/messages/'+_0x53f8b9['id']+_0xaf68('0x27')+_0xef17b0[_0xaf68('0x28')]})['then'](function(_0x4ea386){if(_0x4ea386[_0xaf68('0x29')]){return _0x510ed8[_0xaf68('0x1b')]({'messageId':_0x4ea386[_0xaf68('0x29')]});}})['catch'](function(_0x3de685){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf68('0x2a'),'twilio',util[_0xaf68('0x2b')](_0x3de685,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x2e'),_0xaf68('0x2f'));}break;case _0xaf68('0x30'):var _0x1c6825=_0xaf68('0x31');if(_0xef17b0[_0xaf68('0x32')]&&_0xef17b0[_0xaf68('0x33')]){var _0x14fefa={'recipient':[_0x53f8b9[_0xaf68('0x24')]],'message':_0x53f8b9[_0xaf68('0xf')],'message_type':_0xef17b0[_0xaf68('0x34')]};if(_0xef17b0[_0xaf68('0x34')]&&_0xef17b0[_0xaf68('0x34')]!=='SI'){_0x14fefa[_0xaf68('0x35')]=_0xef17b0[_0xaf68('0x24')];}var _0x35e4f4={'url':_0x1c6825+_0xaf68('0x36')+_0xef17b0[_0xaf68('0x32')]+_0xaf68('0x37')+_0xef17b0[_0xaf68('0x33')],'method':'GET'};rp(_0x35e4f4)[_0xaf68('0x1a')](function(_0x45f779){var _0x32a327=_0x45f779[_0xaf68('0x38')](';');var _0x31855a={'user_key':_0x32a327[0x0],'session_key':_0x32a327[0x1]};_0x35e4f4={'url':_0x1c6825+'sms','method':_0xaf68('0x39'),'headers':{'user_key':_0x31855a[_0xaf68('0x3a')],'Session_key':_0x31855a[_0xaf68('0x3b')]},'json':!![],'body':_0x14fefa};return rp(_0x35e4f4);})[_0xaf68('0x1a')](function(_0x4f096b){if(_0x4f096b[_0xaf68('0x3c')]>=0x1){var _0x1bb76d={'messageId':_0x4f096b[_0xaf68('0x3d')]};if(_0xef17b0[_0xaf68('0x34')]!=='GP'||!_0xef17b0['deliveryReport']){_0x1bb76d[_0xaf68('0x3e')]=!![];}return _0x510ed8[_0xaf68('0x1b')](_0x1bb76d);}else{return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x30'),util[_0xaf68('0x2b')](_0x4f096b,{'showHidden':![],'depth':null}));}})[_0xaf68('0x1d')](function(_0x1fb578){return logger['error'](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x30'),util[_0xaf68('0x2b')](_0x1fb578,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf68('0x2a'),'skebby',_0xaf68('0x3f'));}break;case _0xaf68('0x40'):if(_0xef17b0[_0xaf68('0x23')]){var _0x53b57c={'recipient':_0x53f8b9[_0xaf68('0x24')],'message':_0x53f8b9['body'],'sender':_0xef17b0[_0xaf68('0x41')]||_0xef17b0['phone'],'authorization':_0xef17b0[_0xaf68('0x23')]};var _0x37210b={'method':_0xaf68('0x39'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x53b57c,'json':!![]};rp(_0x37210b)[_0xaf68('0x1a')](function(_0xa70c60){var _0x20a2e5={'messageId':_0xa70c60[_0xaf68('0x42')]};if(!_0xef17b0[_0xaf68('0x43')]){_0x20a2e5['read']=!![];}return _0x510ed8[_0xaf68('0x1b')](_0x20a2e5);})[_0xaf68('0x1d')](function(_0x48edf5){logger[_0xaf68('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf68('0x2a'),'connectel',util[_0xaf68('0x2b')](_0x48edf5,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')](_0xaf68('0x2d'),'afterCreate','connectel',_0xaf68('0x44'));}break;case'clicksend':if(_0xef17b0[_0xaf68('0x32')]&&_0xef17b0[_0xaf68('0x33')]){var _0x53b57c={'messages':[{'source':_0xaf68('0x45'),'to':_0x53f8b9[_0xaf68('0x24')],'body':_0x53f8b9[_0xaf68('0xf')],'from':_0xef17b0[_0xaf68('0x41')]||_0xef17b0['phone']}]};var _0x3b2c11=util[_0xaf68('0x46')](_0xaf68('0x47'),_0xef17b0[_0xaf68('0x32')],_0xef17b0[_0xaf68('0x33')]);var _0x37210b={'method':_0xaf68('0x39'),'uri':_0xaf68('0x48'),'body':_0x53b57c,'headers':{'Authorization':util['format'](_0xaf68('0x49'),new Buffer(_0x3b2c11)['toString'](_0xaf68('0x4a')))},'json':!![]};rp(_0x37210b)[_0xaf68('0x1a')](function(_0x4a4905){if(_0x4a4905[_0xaf68('0x4b')]>=0xc8&&_0x4a4905['http_code']<=0xce){if(_0x4a4905['data']&&_0x4a4905[_0xaf68('0x4c')][_0xaf68('0x4d')]>0x0){var _0x39b306=_[_0xaf68('0x4e')](_0x4a4905[_0xaf68('0x4c')][_0xaf68('0x4f')]);var _0x38591c={'messageId':_0x39b306[_0xaf68('0x50')]};if(!_0xef17b0[_0xaf68('0x43')]){_0x38591c[_0xaf68('0x3e')]=!![];}return _0x510ed8[_0xaf68('0x1b')](_0x38591c);}else{logger[_0xaf68('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf68('0x2a'),_0xaf68('0x51'),util[_0xaf68('0x2b')](_0x4a4905,{'showHidden':![],'depth':null}));}}else{logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x51'),util['inspect'](_0x4a4905,{'showHidden':![],'depth':null}));}})[_0xaf68('0x1d')](function(_0xe3c0f){logger[_0xaf68('0x2c')](_0xaf68('0x2d'),'afterCreate','clickSend',util[_0xaf68('0x2b')](_0xe3c0f,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xaf68('0x52'):if(_0xef17b0[_0xaf68('0x53')]&&_0xef17b0[_0xaf68('0x23')]){var _0x53b57c={'dst':_0x53f8b9[_0xaf68('0x24')],'text':_0x53f8b9[_0xaf68('0xf')],'src':_0xef17b0[_0xaf68('0x41')]||_0xef17b0['phone'],'url':_0xef17b0[_0xaf68('0x26')]+_0xaf68('0x54')+_0x53f8b9['id']+'/status?token='+_0xef17b0['token']};var _0x3b2c11=util[_0xaf68('0x46')](_0xaf68('0x47'),_0xef17b0[_0xaf68('0x53')],_0xef17b0['authToken']);var _0x37210b={'method':'POST','uri':util[_0xaf68('0x46')](_0xaf68('0x55'),_0xef17b0['authId']),'body':_0x53b57c,'headers':{'Authorization':util[_0xaf68('0x46')](_0xaf68('0x49'),new Buffer(_0x3b2c11)[_0xaf68('0x56')](_0xaf68('0x4a')))},'json':!![]};rp(_0x37210b)[_0xaf68('0x1a')](function(_0x49f797){var _0x13f59a={'messageId':_0x49f797[_0xaf68('0x57')][0x0]};return _0x510ed8[_0xaf68('0x1b')](_0x13f59a);})['catch'](function(_0x49a3ae){logger[_0xaf68('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf68('0x2a'),_0xaf68('0x52'),util[_0xaf68('0x2b')](_0x49a3ae,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xaf68('0x58'):if(_0xef17b0[_0xaf68('0x32')]&&_0xef17b0['password']){if(_0xef17b0[_0xaf68('0x59')]){var _0x5b9443={'method':_0xaf68('0x39'),'uri':_0xef17b0[_0xaf68('0x59')]+_0xaf68('0x5a'),'body':{'username':_0xef17b0[_0xaf68('0x32')],'password':_0xef17b0[_0xaf68('0x33')]},'json':!![]};return rp(_0x5b9443)['then'](function(_0x4e43fd){var _0x478c45={'method':_0xaf68('0x39'),'uri':_0xef17b0[_0xaf68('0x59')]+_0xaf68('0x5b'),'body':{'messages':[{'from':_0xef17b0[_0xaf68('0x24')],'destinations':[{'to':_0x53f8b9['phone']}],'text':_0x53f8b9[_0xaf68('0xf')],'notifyUrl':_0xef17b0['remote']+'/api/sms/messages/'+_0x53f8b9['id']+_0xaf68('0x27')+_0xef17b0[_0xaf68('0x28')],'notifyContentType':_0xaf68('0x5c'),'callbackData':_0xef17b0[_0xaf68('0x24')]+';'+_0x53f8b9[_0xaf68('0xf')]}]},'headers':{'Authorization':_0xaf68('0x5d')+_0x4e43fd[_0xaf68('0x28')]},'json':!![]};return rp(_0x478c45)[_0xaf68('0x1a')](function(_0x21f704){if(_0x21f704[_0xaf68('0x4f')]){var _0x54bc94={'messageId':_0x21f704[_0xaf68('0x4f')][0x0]['messageId']};if(!_0xef17b0[_0xaf68('0x43')]){_0x54bc94['read']=!![];}return _0x510ed8['update'](_0x54bc94);}else{return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),'afterCreate','infobip',util[_0xaf68('0x2b')](_0x21f704,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5b3a25){return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),'infobip',util[_0xaf68('0x2b')](_0x5b3a25,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf68('0x2a'),_0xaf68('0x58'),_0xaf68('0x5e'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaf68('0x58'),_0xaf68('0x3f'));}break;case'csc':var _0x5c91e8=require(_0xaf68('0x5f'));if(_0xef17b0[_0xaf68('0x60')]){var _0x42c2e4={};_0x42c2e4[_0xaf68('0x61')]=_0xef17b0[_0xaf68('0x32')];_0x42c2e4['phone']=_0x53f8b9[_0xaf68('0x24')];_0x42c2e4[_0xaf68('0x35')]=_0xef17b0[_0xaf68('0x24')];_0x42c2e4[_0xaf68('0x62')]=_0x53f8b9['body'];_0x42c2e4[_0xaf68('0x63')]=+new Date();var _0x28221e='';var _0x2cdd86='';var _0x1d61b8=Object[_0xaf68('0x64')](_0x42c2e4);_0x1d61b8[_0xaf68('0x65')]();for(var _0x1cea07=0x0;_0x1cea07<_0x1d61b8[_0xaf68('0x66')];_0x1cea07++){if(_0x28221e!=''){_0x28221e+='&';}_0x28221e+=_0x1d61b8[_0x1cea07]+'='+encodeURIComponent(_0x42c2e4[_0x1d61b8[_0x1cea07]]);_0x2cdd86+=_0x42c2e4[_0x1d61b8[_0x1cea07]];}_0x2cdd86+=_0xef17b0[_0xaf68('0x60')];_0x2cdd86=_0x5c91e8['createHash']('md5')[_0xaf68('0x1b')](_0x2cdd86)['digest'](_0xaf68('0x67'));if(_0x28221e!==''){_0x28221e+='&';}_0x28221e+=_0xaf68('0x68')+_0x2cdd86;var _0x35e4f4={'method':_0xaf68('0x69'),'uri':_0xef17b0['baseUrl']+_0xaf68('0x6a')+_0x28221e,'json':!![]};return rp(_0x35e4f4)[_0xaf68('0x1a')](function(_0x2228a6){var _0x4c654d=Object[_0xaf68('0x64')](_0x2228a6);if(_0x2228a6[_0x4c654d[0x0]][_0xaf68('0x2c')]&&parseInt(_0x2228a6[_0x4c654d[0x0]][_0xaf68('0x2c')])===0x0){var _0x52eaf2={'messageId':_0x2228a6[_0x4c654d[0x0]][_0xaf68('0x6b')]};if(!_0xef17b0[_0xaf68('0x43')]){_0x52eaf2[_0xaf68('0x3e')]=!![];}return _0x510ed8[_0xaf68('0x1b')](_0x52eaf2);}else{return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x6c'),util['inspect'](_0x2228a6[_0xaf68('0x2c')],{'showHidden':![],'depth':null}));}})[_0xaf68('0x1d')](function(_0x1635f4){return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),'afterCreate',_0xaf68('0x6c'),util[_0xaf68('0x2b')](_0x1635f4,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf68('0x2a'),_0xaf68('0x6c'),_0xaf68('0x6d'));}break;case'clickatell':if(_0xef17b0[_0xaf68('0x60')]){var _0x4d7bf5={'method':_0xaf68('0x39'),'uri':_0xaf68('0x6e'),'headers':{'Authorization':_0xef17b0[_0xaf68('0x60')]},'body':{'content':_0x53f8b9['body'],'to':[_0x53f8b9[_0xaf68('0x24')]],'from':_0xef17b0[_0xaf68('0x24')],'binary':![],'clientMessageId':_0xaf68('0x6f'),'charset':_0xaf68('0x70')},'json':!![]};rp(_0x4d7bf5)[_0xaf68('0x1a')](function(_0x8677ef){if(!_0x8677ef[_0xaf68('0x2c')]){var _0x23679b={'messageId':_0x8677ef[_0xaf68('0x4f')][0x0][_0xaf68('0x71')]};if(!_0xef17b0['deliveryReport']){_0x23679b[_0xaf68('0x3e')]=!![];}return _0x510ed8[_0xaf68('0x1b')](_0x23679b);}else{return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),'afterCreate',_0xaf68('0x72'),util[_0xaf68('0x2b')](_0x8677ef[_0xaf68('0x2c')],{'showHidden':![],'depth':null}));}})[_0xaf68('0x1d')](function(_0x3f85aa){return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x72'),util[_0xaf68('0x2b')](_0x3f85aa,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x72'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0xef17b0[_0xaf68('0x32')]&&_0xef17b0[_0xaf68('0x33')]){var _0x3b2c11=util[_0xaf68('0x46')](_0xaf68('0x47'),_0xef17b0[_0xaf68('0x32')],_0xef17b0['password']);var _0x37210b={'method':_0xaf68('0x39'),'uri':_0xaf68('0x73')+_0xef17b0['accountId']+'/messages','body':{'to':[_0x53f8b9[_0xaf68('0x24')]],'text':_0x53f8b9[_0xaf68('0xf')],'from':_0xef17b0['phone'],'applicationId':_0xef17b0[_0xaf68('0x74')]},'headers':{'Authorization':util[_0xaf68('0x46')](_0xaf68('0x49'),new Buffer(_0x3b2c11)[_0xaf68('0x56')](_0xaf68('0x4a')))},'json':!![]};rp(_0x37210b)['then'](function(_0x12968a){if(_0x12968a['id']){var _0x427aa2={'messageId':_0x12968a['id']};return _0x510ed8['update'](_0x427aa2);}else{logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),'bandwidth',util[_0xaf68('0x2b')](_0x12968a,{'showHidden':![],'depth':null}));}})[_0xaf68('0x1d')](function(_0x311a5e){logger['error'](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x75'),util[_0xaf68('0x2b')](_0x311a5e,{'showHidden':![],'depth':null}));});}else{logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x75'),_0xaf68('0x3f'));}break;case _0xaf68('0x76'):if(_0xef17b0[_0xaf68('0x60')]){var _0x5eb7f7={};var _0x35e4f4={'method':_0xaf68('0x39'),'uri':_0xaf68('0x77'),'headers':{'Authorization':_0xaf68('0x78')+_0xef17b0['apiKey'],'Content-Type':_0xaf68('0x5c')},'body':{'from':_0xef17b0[_0xaf68('0x24')],'to':_0x53f8b9[_0xaf68('0x24')],'text':_0x53f8b9[_0xaf68('0xf')]},'json':!![]};return rp(_0x35e4f4)[_0xaf68('0x1a')](function(_0x36fb4b){if(_0x36fb4b[_0xaf68('0x79')]==0xca){_0x5eb7f7[_0xaf68('0x7a')]=_0x36fb4b;var _0x4d077e={'method':'POST','uri':_0xaf68('0x7b'),'headers':{'Authorization':_0xaf68('0x78')+_0xef17b0[_0xaf68('0x60')],'Content-Type':'application/json'},'body':{'refid':_0x5eb7f7['message'][_0xaf68('0x7c')]},'json':!![]};return rp(_0x4d077e)[_0xaf68('0x1a')](function(_0xdc12bb){_0x5eb7f7[_0xaf68('0x7d')]=_0xdc12bb;var _0x1fa022={'messageId':_0x5eb7f7['message'][_0xaf68('0x7c')],'read':!![]};return _0x510ed8[_0xaf68('0x1b')](_0x1fa022);});}else{return logger['error'](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x76'),util[_0xaf68('0x2b')](_0x36fb4b,{'showHidden':![],'depth':null}));}})[_0xaf68('0x1d')](function(_0x48735d){return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),_0xaf68('0x76'),util[_0xaf68('0x2b')](_0x48735d,{'showHidden':![],'depth':null}));});}else{return logger[_0xaf68('0x2c')](_0xaf68('0x2d'),_0xaf68('0x2a'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x2e1b98();});}else{_0x2e1b98();}}},'charset':_0xaf68('0x7e'),'collate':_0xaf68('0x7f')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index de5f371..ef51770 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 _0xbca4=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','body','options','lodash'];(function(_0x4f4882,_0x22255c){var _0x126d36=function(_0xa2c0c8){while(--_0xa2c0c8){_0x4f4882['push'](_0x4f4882['shift']());}};_0x126d36(++_0x22255c);}(_0xbca4,0x8b));var _0x4bca=function(_0x5aa593,_0x275634){_0x5aa593=_0x5aa593-0x0;var _0x3c2770=_0xbca4[_0x5aa593];return _0x3c2770;};'use strict';var _=require(_0x4bca('0x0'));var util=require(_0x4bca('0x1'));var moment=require('moment');var BPromise=require(_0x4bca('0x2'));var rs=require(_0x4bca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bca('0x5'))(_0x4bca('0x6'));var config=require('../../config/environment');var jayson=require(_0x4bca('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4bca('0x8')],{'host':_0x4bca('0x9'),'port':0x18eb});var socket=require(_0x4bca('0xa'))(new Redis(config[_0x4bca('0x8')]));require('./smsMessage.socket')[_0x4bca('0xb')](socket);function respondWithRpcPromise(_0x1274bd,_0x4b6be7,_0x555e95){return new BPromise(function(_0x15b806,_0x43720f){return client[_0x4bca('0xc')](_0x1274bd,_0x555e95)[_0x4bca('0xd')](function(_0x5dc8ef){logger[_0x4bca('0xe')](_0x4bca('0xf'),_0x4b6be7,_0x4bca('0x10'));logger[_0x4bca('0x11')](_0x4bca('0x12'),_0x4b6be7,_0x4bca('0x10'),JSON[_0x4bca('0x13')](_0x5dc8ef));if(_0x5dc8ef[_0x4bca('0x14')]){if(_0x5dc8ef['error'][_0x4bca('0x15')]===0x1f4){logger[_0x4bca('0x14')]('SmsMessage,\x20%s,\x20%s',_0x4b6be7,_0x5dc8ef[_0x4bca('0x14')][_0x4bca('0x16')]);return _0x43720f(_0x5dc8ef['error'][_0x4bca('0x16')]);}logger[_0x4bca('0x14')](_0x4bca('0xf'),_0x4b6be7,_0x5dc8ef[_0x4bca('0x14')]['message']);return _0x15b806(_0x5dc8ef['error']['message']);}else{logger['info'](_0x4bca('0xf'),_0x4b6be7,_0x4bca('0x10'));_0x15b806(_0x5dc8ef[_0x4bca('0x17')]['message']);}})[_0x4bca('0x18')](function(_0x43a616){logger[_0x4bca('0x14')](_0x4bca('0xf'),_0x4b6be7,_0x43a616);_0x43720f(_0x43a616);});});}exports[_0x4bca('0x19')]=function(_0x3c4e6b){var _0x4b9645=this;return new Promise(function(_0x143334,_0x10de05){return db['SmsMessage']['create'](_0x3c4e6b[_0x4bca('0x1a')],{'raw':_0x3c4e6b[_0x4bca('0x1b')]?_0x3c4e6b[_0x4bca('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x4bca('0xd')](function(_0x3f7aa6){logger['info']('CreateSmsMessage',_0x3c4e6b);logger[_0x4bca('0x11')](_0x4bca('0x19'),_0x3c4e6b,JSON[_0x4bca('0x13')](_0x3f7aa6));_0x143334(_0x3f7aa6);})['catch'](function(_0x590179){logger[_0x4bca('0x14')](_0x4bca('0x19'),_0x590179['message'],_0x3c4e6b);_0x10de05(_0x4b9645['error'](0x1f4,_0x590179[_0x4bca('0x16')]));});});}; \ No newline at end of file +var _0x765f=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','stringify','util','moment','bluebird','randomstring','ioredis'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x765f,0xdb));var _0xf765=function(_0x2fd536,_0x3d3e4d){_0x2fd536=_0x2fd536-0x0;var _0x2be50b=_0x765f[_0x2fd536];return _0x2be50b;};'use strict';var _=require('lodash');var util=require(_0xf765('0x0'));var moment=require(_0xf765('0x1'));var BPromise=require(_0xf765('0x2'));var rs=require(_0xf765('0x3'));var fs=require('fs');var Redis=require(_0xf765('0x4'));var db=require(_0xf765('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf765('0x6'))(_0xf765('0x7'));var config=require(_0xf765('0x8'));var jayson=require(_0xf765('0x9'));var client=jayson['client'][_0xf765('0xa')]({'port':0x232a});config[_0xf765('0xb')]=_[_0xf765('0xc')](config[_0xf765('0xb')],{'host':_0xf765('0xd'),'port':0x18eb});var socket=require(_0xf765('0xe'))(new Redis(config[_0xf765('0xb')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5c9bdb,_0x320698,_0x51a1db){return new BPromise(function(_0x8e69b1,_0x5ebbb2){return client['request'](_0x5c9bdb,_0x51a1db)[_0xf765('0xf')](function(_0x5ac5b7){logger[_0xf765('0x10')]('SmsMessage,\x20%s,\x20%s',_0x320698,_0xf765('0x11'));logger[_0xf765('0x12')](_0xf765('0x13'),_0x320698,_0xf765('0x11'),JSON['stringify'](_0x5ac5b7));if(_0x5ac5b7[_0xf765('0x14')]){if(_0x5ac5b7['error'][_0xf765('0x15')]===0x1f4){logger[_0xf765('0x14')](_0xf765('0x16'),_0x320698,_0x5ac5b7[_0xf765('0x14')][_0xf765('0x17')]);return _0x5ebbb2(_0x5ac5b7[_0xf765('0x14')][_0xf765('0x17')]);}logger[_0xf765('0x14')](_0xf765('0x16'),_0x320698,_0x5ac5b7[_0xf765('0x14')][_0xf765('0x17')]);return _0x8e69b1(_0x5ac5b7['error'][_0xf765('0x17')]);}else{logger[_0xf765('0x10')]('SmsMessage,\x20%s,\x20%s',_0x320698,_0xf765('0x11'));_0x8e69b1(_0x5ac5b7[_0xf765('0x18')][_0xf765('0x17')]);}})[_0xf765('0x19')](function(_0x40acb3){logger[_0xf765('0x14')](_0xf765('0x16'),_0x320698,_0x40acb3);_0x5ebbb2(_0x40acb3);});});}exports['CreateSmsMessage']=function(_0x137ae7){var _0x5caad0=this;return new Promise(function(_0x29427a,_0x519e70){return db[_0xf765('0x1a')][_0xf765('0x1b')](_0x137ae7['body'],{'raw':_0x137ae7[_0xf765('0x1c')]?_0x137ae7['options'][_0xf765('0x1d')]===undefined?!![]:![]:!![]})[_0xf765('0xf')](function(_0x36dd15){logger[_0xf765('0x10')]('CreateSmsMessage',_0x137ae7);logger[_0xf765('0x12')](_0xf765('0x1e'),_0x137ae7,JSON[_0xf765('0x1f')](_0x36dd15));_0x29427a(_0x36dd15);})[_0xf765('0x19')](function(_0x44cd88){logger[_0xf765('0x14')](_0xf765('0x1e'),_0x44cd88[_0xf765('0x17')],_0x137ae7);_0x519e70(_0x5caad0[_0xf765('0x14')](0x1f4,_0x44cd88[_0xf765('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 2e1e8a4..ce8158b 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 _0x21f1=['update','emit','removeListener','register','length','./smsMessage.events','remove'];(function(_0x4abc8f,_0xef597d){var _0x5d7939=function(_0x145f23){while(--_0x145f23){_0x4abc8f['push'](_0x4abc8f['shift']());}};_0x5d7939(++_0xef597d);}(_0x21f1,0x1ef));var _0x121f=function(_0x58d988,_0x41978f){_0x58d988=_0x58d988-0x0;var _0x39ec4a=_0x21f1[_0x58d988];return _0x39ec4a;};'use strict';var SmsMessageEvents=require(_0x121f('0x0'));var events=['save',_0x121f('0x1'),_0x121f('0x2')];function createListener(_0x455cd9,_0x53d479){return function(_0x2cb2ff){_0x53d479[_0x121f('0x3')](_0x455cd9,_0x2cb2ff);};}function removeListener(_0x4981fd,_0xeaa825){return function(){SmsMessageEvents[_0x121f('0x4')](_0x4981fd,_0xeaa825);};}exports[_0x121f('0x5')]=function(_0x296eab){for(var _0x31f592=0x0,_0x3957db=events[_0x121f('0x6')];_0x31f592<_0x3957db;_0x31f592++){var _0x5b893a=events[_0x31f592];var _0x116491=createListener('smsMessage:'+_0x5b893a,_0x296eab);SmsMessageEvents['on'](_0x5b893a,_0x116491);}}; \ No newline at end of file +var _0x70e1=['length','smsMessage:','save','remove','update','emit','removeListener','register'];(function(_0x58a00e,_0x32d0c6){var _0x1f9d4e=function(_0x75e861){while(--_0x75e861){_0x58a00e['push'](_0x58a00e['shift']());}};_0x1f9d4e(++_0x32d0c6);}(_0x70e1,0x122));var _0x170e=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x70e1[_0x323430];return _0x9eecd1;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x170e('0x0'),_0x170e('0x1'),_0x170e('0x2')];function createListener(_0x41eb00,_0x41498c){return function(_0x467d3a){_0x41498c[_0x170e('0x3')](_0x41eb00,_0x467d3a);};}function removeListener(_0x3909e3,_0x1dc57a){return function(){SmsMessageEvents[_0x170e('0x4')](_0x3909e3,_0x1dc57a);};}exports[_0x170e('0x5')]=function(_0x1ef0b3){for(var _0x1fb810=0x0,_0x23ee70=events[_0x170e('0x6')];_0x1fb810<_0x23ee70;_0x1fb810++){var _0xdfed4e=events[_0x1fb810];var _0x1a07ed=createListener(_0x170e('0x7')+_0xdfed4e,_0x1ef0b3);SmsMessageEvents['on'](_0xdfed4e,_0x1a07ed);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a147199..3471c33 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 _0x66a1=['post','addTeams','addAgents','put','delete','/:id','destroy','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0x66a1,0x121));var _0x166a=function(_0x684918,_0x338d95){_0x684918=_0x684918-0x0;var _0x340ee3=_0x66a1[_0x684918];return _0x340ee3;};'use strict';var multer=require(_0x166a('0x0'));var util=require(_0x166a('0x1'));var path=require('path');var timeout=require(_0x166a('0x2'));var express=require('express');var router=express[_0x166a('0x3')]();var fs_extra=require(_0x166a('0x4'));var auth=require(_0x166a('0x5'));var interaction=require(_0x166a('0x6'));var config=require(_0x166a('0x7'));var controller=require(_0x166a('0x8'));router[_0x166a('0x9')]('/',auth[_0x166a('0xa')](),controller[_0x166a('0xb')]);router[_0x166a('0x9')](_0x166a('0xc'),auth['isAuthenticated'](),controller[_0x166a('0xd')]);router[_0x166a('0x9')]('/:id',auth[_0x166a('0xa')](),controller[_0x166a('0xe')]);router[_0x166a('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x166a('0xf')]);router[_0x166a('0x9')](_0x166a('0x10'),auth[_0x166a('0xa')](),controller['getTeams']);router['get'](_0x166a('0x11'),auth[_0x166a('0xa')](),controller[_0x166a('0x12')]);router[_0x166a('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x166a('0x10'),auth[_0x166a('0xa')](),controller[_0x166a('0x14')]);router[_0x166a('0x13')](_0x166a('0x11'),auth[_0x166a('0xa')](),controller[_0x166a('0x15')]);router[_0x166a('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x166a('0x17')](_0x166a('0x18'),auth['isAuthenticated'](),controller[_0x166a('0x19')]);router[_0x166a('0x17')](_0x166a('0x10'),auth[_0x166a('0xa')](),controller['removeTeams']);router[_0x166a('0x17')](_0x166a('0x11'),auth[_0x166a('0xa')](),controller[_0x166a('0x1a')]);module[_0x166a('0x1b')]=router; \ No newline at end of file +var _0x0f89=['/:id/teams','getTeams','create','addTeams','post','/:id/users','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x0f89,0x111));var _0x90f8=function(_0xa8ec52,_0x7ed88f){_0xa8ec52=_0xa8ec52-0x0;var _0x575bcf=_0x0f89[_0xa8ec52];return _0x575bcf;};'use strict';var multer=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var path=require(_0x90f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x90f8('0x3'));var router=express[_0x90f8('0x4')]();var fs_extra=require(_0x90f8('0x5'));var auth=require(_0x90f8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x90f8('0x7'));var controller=require(_0x90f8('0x8'));router['get']('/',auth[_0x90f8('0x9')](),controller[_0x90f8('0xa')]);router[_0x90f8('0xb')](_0x90f8('0xc'),auth[_0x90f8('0x9')](),controller[_0x90f8('0xd')]);router[_0x90f8('0xb')](_0x90f8('0xe'),auth[_0x90f8('0x9')](),controller[_0x90f8('0xf')]);router[_0x90f8('0xb')]('/:id/members',auth['isAuthenticated'](),controller[_0x90f8('0x10')]);router[_0x90f8('0xb')](_0x90f8('0x11'),auth[_0x90f8('0x9')](),controller[_0x90f8('0x12')]);router[_0x90f8('0xb')]('/:id/users',auth[_0x90f8('0x9')](),controller['getAgents']);router['post']('/',auth[_0x90f8('0x9')](),controller[_0x90f8('0x13')]);router['post'](_0x90f8('0x11'),auth['isAuthenticated'](),controller[_0x90f8('0x14')]);router[_0x90f8('0x15')](_0x90f8('0x16'),auth[_0x90f8('0x9')](),controller['addAgents']);router[_0x90f8('0x17')](_0x90f8('0xe'),auth[_0x90f8('0x9')](),controller[_0x90f8('0x18')]);router['delete'](_0x90f8('0xe'),auth[_0x90f8('0x9')](),controller['destroy']);router[_0x90f8('0x19')](_0x90f8('0x11'),auth[_0x90f8('0x9')](),controller[_0x90f8('0x1a')]);router[_0x90f8('0x19')](_0x90f8('0x16'),auth[_0x90f8('0x9')](),controller[_0x90f8('0x1b')]);module[_0x90f8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 0b779b3..f257828 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 _0x32f7=['INTEGER','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x3a39bd,_0x5c5c15){var _0x4c7f04=function(_0x288218){while(--_0x288218){_0x3a39bd['push'](_0x3a39bd['shift']());}};_0x4c7f04(++_0x5c5c15);}(_0x32f7,0xb1));var _0x732f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x732f('0x0'));module[_0x732f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x732f('0x2')]},'timeout':{'type':Sequelize[_0x732f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x732f('0x4'),_0x732f('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xae2a=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x20bcec,_0x2074c4){var _0x197cc9=function(_0x10edfe){while(--_0x10edfe){_0x20bcec['push'](_0x20bcec['shift']());}};_0x197cc9(++_0x2074c4);}(_0xae2a,0x1d6));var _0xaae2=function(_0x49b4ce,_0x22d5a4){_0x49b4ce=_0x49b4ce-0x0;var _0x1e0dd6=_0xae2a[_0x49b4ce];return _0x1e0dd6;};'use strict';var Sequelize=require(_0xaae2('0x0'));module['exports']={'name':{'type':Sequelize[_0xaae2('0x1')],'unique':_0xaae2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xaae2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaae2('0x4')](_0xaae2('0x5'),'beepall',_0xaae2('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e6a7f8e..39d4b0e 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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x404562,_0x581f17){var _0x2982dc=function(_0x50b01d){while(--_0x50b01d){_0x404562['push'](_0x404562['shift']());}};_0x2982dc(++_0x581f17);}(_0x7a54,0x106));var _0x47a5=function(_0x1e71e1,_0x57f3f5){_0x1e71e1=_0x1e71e1-0x0;var _0x3ad421=_0x7a54[_0x1e71e1];return _0x3ad421;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file +var _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x2032,0xd9));var _0x2203=function(_0x28cfd2,_0x5bb43a){_0x28cfd2=_0x28cfd2-0x0;var _0x3ebe88=_0x2032[_0x28cfd2];return _0x3ebe88;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5f2c6d0..1bc9dc1 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 _0xf5c1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x4bbaaf,_0x4a0e26){var _0x567c80=function(_0x303fae){while(--_0x303fae){_0x4bbaaf['push'](_0x4bbaaf['shift']());}};_0x567c80(++_0x4a0e26);}(_0xf5c1,0x19b));var _0x1f5c=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0xf5c1[_0x11b1b3];return _0x437029;};'use strict';var EventEmitter=require(_0x1f5c('0x0'));var SmsQueue=require(_0x1f5c('0x1'))['db'][_0x1f5c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1f5c('0x3')](0x0);var events={'afterCreate':_0x1f5c('0x4'),'afterUpdate':_0x1f5c('0x5'),'afterDestroy':_0x1f5c('0x6')};function emitEvent(_0x1468d3){return function(_0x3fee81,_0x483ca0,_0x6ecede){SmsQueueEvents['emit'](_0x1468d3+':'+_0x3fee81['id'],_0x3fee81);SmsQueueEvents[_0x1f5c('0x7')](_0x1468d3,_0x3fee81);_0x6ecede(null);};}for(var e in events){if(events[_0x1f5c('0x8')](e)){var event=events[e];SmsQueue[_0x1f5c('0x9')](e,emitEvent(event));}}module[_0x1f5c('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0x9e4e=['remove','emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save'];(function(_0x43b808,_0x308435){var _0x2eaac1=function(_0x4c443b){while(--_0x4c443b){_0x43b808['push'](_0x43b808['shift']());}};_0x2eaac1(++_0x308435);}(_0x9e4e,0xd4));var _0xe9e4=function(_0x5c0678,_0x5d2d9a){_0x5c0678=_0x5c0678-0x0;var _0x45fff7=_0x9e4e[_0x5c0678];return _0x45fff7;};'use strict';var EventEmitter=require(_0xe9e4('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xe9e4('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe9e4('0x2')](0x0);var events={'afterCreate':_0xe9e4('0x3'),'afterUpdate':'update','afterDestroy':_0xe9e4('0x4')};function emitEvent(_0x575f4d){return function(_0x1d4ea1,_0x1f721e,_0x3a595b){SmsQueueEvents['emit'](_0x575f4d+':'+_0x1d4ea1['id'],_0x1d4ea1);SmsQueueEvents[_0xe9e4('0x5')](_0x575f4d,_0x1d4ea1);_0x3a595b(null);};}for(var e in events){if(events[_0xe9e4('0x6')](e)){var event=events[e];SmsQueue[_0xe9e4('0x7')](e,emitEvent(event));}}module[_0xe9e4('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 d5afdf0..0f91874 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 _0xaa76=['lodash','util','../../config/logger','bluebird','path','rimraf','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x3cbbf0,_0x1b630f){var _0x557d5d=function(_0x4f17fb){while(--_0x4f17fb){_0x3cbbf0['push'](_0x3cbbf0['shift']());}};_0x557d5d(++_0x1b630f);}(_0xaa76,0xbb));var _0x6aa7=function(_0x453052,_0x5824cd){_0x453052=_0x453052-0x0;var _0xddc922=_0xaa76[_0x453052];return _0xddc922;};'use strict';var _=require(_0x6aa7('0x0'));var util=require(_0x6aa7('0x1'));var logger=require(_0x6aa7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6aa7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6aa7('0x4'));var rimraf=require(_0x6aa7('0x5'));var config=require('../../config/environment');var attributes=require(_0x6aa7('0x6'));module[_0x6aa7('0x7')]=function(_0x1664bd,_0x9514de){return _0x1664bd[_0x6aa7('0x8')](_0x6aa7('0x9'),attributes,{'tableName':_0x6aa7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf625=['../../config/environment','./smsQueue.attributes','define','util','moment','bluebird','path','rimraf'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf625,0x83));var _0x5f62=function(_0x2e75c8,_0x43557b){_0x2e75c8=_0x2e75c8-0x0;var _0x4ebdd0=_0xf625[_0x2e75c8];return _0x4ebdd0;};'use strict';var _=require('lodash');var util=require(_0x5f62('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5f62('0x1'));var BPromise=require(_0x5f62('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f62('0x3'));var rimraf=require(_0x5f62('0x4'));var config=require(_0x5f62('0x5'));var attributes=require(_0x5f62('0x6'));module['exports']=function(_0x3cbb98,_0x112a16){return _0x3cbb98[_0x5f62('0x7')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index e2c4a31..07dfd6c 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 _0xbcdb=['rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xbcdb,0x1a6));var _0xbbcd=function(_0xdfc21c,_0x65831a){_0xdfc21c=_0xdfc21c-0x0;var _0x4cedda=_0xbcdb[_0xdfc21c];return _0x4cedda;};'use strict';var _=require(_0xbbcd('0x0'));var util=require(_0xbbcd('0x1'));var moment=require(_0xbbcd('0x2'));var BPromise=require(_0xbbcd('0x3'));var rs=require(_0xbbcd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbcd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbcd('0x6'))(_0xbbcd('0x7'));var config=require('../../config/environment');var jayson=require(_0xbbcd('0x8'));var client=jayson[_0xbbcd('0x9')][_0xbbcd('0xa')]({'port':0x232a});config['redis']=_[_0xbbcd('0xb')](config[_0xbbcd('0xc')],{'host':_0xbbcd('0xd'),'port':0x18eb});var socket=require(_0xbbcd('0xe'))(new Redis(config[_0xbbcd('0xc')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x144f05,_0x592f,_0x283bf1){return new BPromise(function(_0x49a98f,_0xde160e){return client[_0xbbcd('0xf')](_0x144f05,_0x283bf1)[_0xbbcd('0x10')](function(_0x54a638){logger[_0xbbcd('0x11')]('SmsQueue,\x20%s,\x20%s',_0x592f,'request\x20sent');logger[_0xbbcd('0x12')](_0xbbcd('0x13'),_0x592f,_0xbbcd('0x14'),JSON[_0xbbcd('0x15')](_0x54a638));if(_0x54a638['error']){if(_0x54a638[_0xbbcd('0x16')][_0xbbcd('0x17')]===0x1f4){logger['error'](_0xbbcd('0x18'),_0x592f,_0x54a638['error'][_0xbbcd('0x19')]);return _0xde160e(_0x54a638[_0xbbcd('0x16')]['message']);}logger[_0xbbcd('0x16')]('SmsQueue,\x20%s,\x20%s',_0x592f,_0x54a638[_0xbbcd('0x16')][_0xbbcd('0x19')]);return _0x49a98f(_0x54a638[_0xbbcd('0x16')][_0xbbcd('0x19')]);}else{logger[_0xbbcd('0x11')](_0xbbcd('0x18'),_0x592f,_0xbbcd('0x14'));_0x49a98f(_0x54a638['result'][_0xbbcd('0x19')]);}})[_0xbbcd('0x1a')](function(_0x1d58ae){logger[_0xbbcd('0x16')](_0xbbcd('0x18'),_0x592f,_0x1d58ae);_0xde160e(_0x1d58ae);});});}exports[_0xbbcd('0x1b')]=function(_0xceccb0){var _0x5f0bcf=this;return new Promise(function(_0x144386,_0x5a42e9){return db[_0xbbcd('0x1c')][_0xbbcd('0x1d')]({'raw':_0xceccb0[_0xbbcd('0x1e')]?_0xceccb0[_0xbbcd('0x1e')][_0xbbcd('0x1f')]===undefined?!![]:![]:!![],'where':_0xceccb0[_0xbbcd('0x1e')]?_0xceccb0[_0xbbcd('0x1e')][_0xbbcd('0x20')]||null:null,'attributes':_0xceccb0[_0xbbcd('0x1e')]?_0xceccb0['options'][_0xbbcd('0x21')]||null:null,'limit':_0xceccb0[_0xbbcd('0x1e')]?_0xceccb0[_0xbbcd('0x1e')][_0xbbcd('0x22')]||null:null,'include':_0xceccb0['options']?_0xceccb0['options'][_0xbbcd('0x23')]?_[_0xbbcd('0x24')](_0xceccb0['options'][_0xbbcd('0x23')],function(_0x369870){return{'model':db[_0x369870[_0xbbcd('0x25')]],'as':_0x369870['as'],'attributes':_0x369870[_0xbbcd('0x21')],'include':_0x369870[_0xbbcd('0x23')]?_['map'](_0x369870[_0xbbcd('0x23')],function(_0x508f2c){return{'model':db[_0x508f2c[_0xbbcd('0x25')]],'as':_0x508f2c['as'],'attributes':_0x508f2c[_0xbbcd('0x21')],'include':_0x508f2c[_0xbbcd('0x23')]?_[_0xbbcd('0x24')](_0x508f2c[_0xbbcd('0x23')],function(_0x5593ce){return{'model':db[_0x5593ce[_0xbbcd('0x25')]],'as':_0x5593ce['as'],'attributes':_0x5593ce['attributes']};}):[]};}):[]};}):[]:[]})[_0xbbcd('0x10')](function(_0x59d15c){logger['info']('GetSmsQueue',_0xceccb0);logger[_0xbbcd('0x12')](_0xbbcd('0x1b'),_0xceccb0,JSON[_0xbbcd('0x15')](_0x59d15c));_0x144386(_0x59d15c);})[_0xbbcd('0x1a')](function(_0x123895){logger['error']('GetSmsQueue',_0x123895[_0xbbcd('0x19')],_0xceccb0);_0x5a42e9(_0x5f0bcf[_0xbbcd('0x16')](0x1f4,_0x123895[_0xbbcd('0x19')]));});});};exports[_0xbbcd('0x26')]=function(_0x360a62){var _0x3660bd=this;return new Promise(function(_0x2e139c,_0x4f4570){return db[_0xbbcd('0x1c')]['find']({'raw':_0x360a62[_0xbbcd('0x1e')]?_0x360a62['options'][_0xbbcd('0x1f')]===undefined?!![]:![]:!![],'where':_0x360a62['options']?_0x360a62['options'][_0xbbcd('0x20')]||null:null,'attributes':_0x360a62[_0xbbcd('0x1e')]?_0x360a62['options']['attributes']||null:null,'include':_0x360a62['options']?_0x360a62[_0xbbcd('0x1e')]['include']?_[_0xbbcd('0x24')](_0x360a62[_0xbbcd('0x1e')]['include'],function(_0x3a4840){return{'model':db[_0x3a4840[_0xbbcd('0x25')]],'as':_0x3a4840['as'],'attributes':_0x3a4840[_0xbbcd('0x21')],'include':_0x3a4840[_0xbbcd('0x23')]?_['map'](_0x3a4840[_0xbbcd('0x23')],function(_0xe6a46f){return{'model':db[_0xe6a46f[_0xbbcd('0x25')]],'as':_0xe6a46f['as'],'attributes':_0xe6a46f['attributes'],'include':_0xe6a46f['include']?_[_0xbbcd('0x24')](_0xe6a46f[_0xbbcd('0x23')],function(_0x4386f7){return{'model':db[_0x4386f7[_0xbbcd('0x25')]],'as':_0x4386f7['as'],'attributes':_0x4386f7[_0xbbcd('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbbcd('0x10')](function(_0x5214e5){logger[_0xbbcd('0x11')](_0xbbcd('0x26'),_0x360a62);logger[_0xbbcd('0x12')]('ShowSmsQueue',_0x360a62,JSON[_0xbbcd('0x15')](_0x5214e5));_0x2e139c(_0x5214e5);})[_0xbbcd('0x1a')](function(_0x5af98d){logger[_0xbbcd('0x16')](_0xbbcd('0x26'),_0x5af98d[_0xbbcd('0x19')],_0x360a62);_0x4f4570(_0x3660bd[_0xbbcd('0x16')](0x1f4,_0x5af98d[_0xbbcd('0x19')]));});});}; \ No newline at end of file +var _0x4184=['where','attributes','include','map','model','ShowSmsQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','findAll','options','raw'];(function(_0xe04ebf,_0x5b44cd){var _0x36256f=function(_0x472c78){while(--_0x472c78){_0xe04ebf['push'](_0xe04ebf['shift']());}};_0x36256f(++_0x5b44cd);}(_0x4184,0xf1));var _0x4418=function(_0x491335,_0x2546ce){_0x491335=_0x491335-0x0;var _0xe64bf4=_0x4184[_0x491335];return _0xe64bf4;};'use strict';var _=require(_0x4418('0x0'));var util=require(_0x4418('0x1'));var moment=require(_0x4418('0x2'));var BPromise=require('bluebird');var rs=require(_0x4418('0x3'));var fs=require('fs');var Redis=require(_0x4418('0x4'));var db=require(_0x4418('0x5'))['db'];var utils=require(_0x4418('0x6'));var logger=require(_0x4418('0x7'))(_0x4418('0x8'));var config=require('../../config/environment');var jayson=require(_0x4418('0x9'));var client=jayson[_0x4418('0xa')][_0x4418('0xb')]({'port':0x232a});config[_0x4418('0xc')]=_[_0x4418('0xd')](config[_0x4418('0xc')],{'host':_0x4418('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4418('0xc')]));require('./smsQueue.socket')[_0x4418('0xf')](socket);function respondWithRpcPromise(_0x20440b,_0x4cbd62,_0x61ca9){return new BPromise(function(_0x25174d,_0x2628ef){return client[_0x4418('0x10')](_0x20440b,_0x61ca9)[_0x4418('0x11')](function(_0x27c19d){logger[_0x4418('0x12')]('SmsQueue,\x20%s,\x20%s',_0x4cbd62,_0x4418('0x13'));logger['debug'](_0x4418('0x14'),_0x4cbd62,_0x4418('0x13'),JSON[_0x4418('0x15')](_0x27c19d));if(_0x27c19d[_0x4418('0x16')]){if(_0x27c19d[_0x4418('0x16')][_0x4418('0x17')]===0x1f4){logger['error'](_0x4418('0x18'),_0x4cbd62,_0x27c19d[_0x4418('0x16')]['message']);return _0x2628ef(_0x27c19d[_0x4418('0x16')][_0x4418('0x19')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x4cbd62,_0x27c19d[_0x4418('0x16')][_0x4418('0x19')]);return _0x25174d(_0x27c19d[_0x4418('0x16')][_0x4418('0x19')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x4cbd62,_0x4418('0x13'));_0x25174d(_0x27c19d[_0x4418('0x1a')]['message']);}})['catch'](function(_0x680ae8){logger[_0x4418('0x16')](_0x4418('0x18'),_0x4cbd62,_0x680ae8);_0x2628ef(_0x680ae8);});});}exports[_0x4418('0x1b')]=function(_0x2ddacc){var _0x467af4=this;return new Promise(function(_0x426d9f,_0x105cb0){return db[_0x4418('0x1c')][_0x4418('0x1d')]({'raw':_0x2ddacc[_0x4418('0x1e')]?_0x2ddacc[_0x4418('0x1e')][_0x4418('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ddacc[_0x4418('0x1e')]?_0x2ddacc[_0x4418('0x1e')][_0x4418('0x20')]||null:null,'attributes':_0x2ddacc[_0x4418('0x1e')]?_0x2ddacc['options'][_0x4418('0x21')]||null:null,'limit':_0x2ddacc['options']?_0x2ddacc[_0x4418('0x1e')]['limit']||null:null,'include':_0x2ddacc[_0x4418('0x1e')]?_0x2ddacc[_0x4418('0x1e')][_0x4418('0x22')]?_[_0x4418('0x23')](_0x2ddacc[_0x4418('0x1e')][_0x4418('0x22')],function(_0x51ccc0){return{'model':db[_0x51ccc0[_0x4418('0x24')]],'as':_0x51ccc0['as'],'attributes':_0x51ccc0[_0x4418('0x21')],'include':_0x51ccc0[_0x4418('0x22')]?_['map'](_0x51ccc0['include'],function(_0x48c264){return{'model':db[_0x48c264[_0x4418('0x24')]],'as':_0x48c264['as'],'attributes':_0x48c264[_0x4418('0x21')],'include':_0x48c264[_0x4418('0x22')]?_[_0x4418('0x23')](_0x48c264[_0x4418('0x22')],function(_0x3f89dc){return{'model':db[_0x3f89dc[_0x4418('0x24')]],'as':_0x3f89dc['as'],'attributes':_0x3f89dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x4418('0x11')](function(_0x36aaf8){logger[_0x4418('0x12')](_0x4418('0x1b'),_0x2ddacc);logger['debug'](_0x4418('0x1b'),_0x2ddacc,JSON['stringify'](_0x36aaf8));_0x426d9f(_0x36aaf8);})['catch'](function(_0x5552ec){logger['error']('GetSmsQueue',_0x5552ec['message'],_0x2ddacc);_0x105cb0(_0x467af4[_0x4418('0x16')](0x1f4,_0x5552ec[_0x4418('0x19')]));});});};exports[_0x4418('0x25')]=function(_0x546488){var _0x5bda1a=this;return new Promise(function(_0x2a7da5,_0x975314){return db['SmsQueue'][_0x4418('0x26')]({'raw':_0x546488[_0x4418('0x1e')]?_0x546488['options'][_0x4418('0x1f')]===undefined?!![]:![]:!![],'where':_0x546488[_0x4418('0x1e')]?_0x546488[_0x4418('0x1e')][_0x4418('0x20')]||null:null,'attributes':_0x546488['options']?_0x546488[_0x4418('0x1e')][_0x4418('0x21')]||null:null,'include':_0x546488[_0x4418('0x1e')]?_0x546488[_0x4418('0x1e')][_0x4418('0x22')]?_[_0x4418('0x23')](_0x546488[_0x4418('0x1e')][_0x4418('0x22')],function(_0x5e6a79){return{'model':db[_0x5e6a79[_0x4418('0x24')]],'as':_0x5e6a79['as'],'attributes':_0x5e6a79['attributes'],'include':_0x5e6a79[_0x4418('0x22')]?_[_0x4418('0x23')](_0x5e6a79[_0x4418('0x22')],function(_0x458f1d){return{'model':db[_0x458f1d[_0x4418('0x24')]],'as':_0x458f1d['as'],'attributes':_0x458f1d[_0x4418('0x21')],'include':_0x458f1d[_0x4418('0x22')]?_['map'](_0x458f1d['include'],function(_0x6ddd42){return{'model':db[_0x6ddd42['model']],'as':_0x6ddd42['as'],'attributes':_0x6ddd42[_0x4418('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4418('0x11')](function(_0x4273d9){logger[_0x4418('0x12')](_0x4418('0x25'),_0x546488);logger['debug'](_0x4418('0x25'),_0x546488,JSON[_0x4418('0x15')](_0x4273d9));_0x2a7da5(_0x4273d9);})['catch'](function(_0x42b1c5){logger[_0x4418('0x16')](_0x4418('0x25'),_0x42b1c5[_0x4418('0x19')],_0x546488);_0x975314(_0x5bda1a[_0x4418('0x16')](0x1f4,_0x42b1c5[_0x4418('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5272bc9..193aec1 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 _0xcec8=['register','smsQueue:','save','remove','update','emit','removeListener'];(function(_0x53ed97,_0x1b32fd){var _0x5eb20e=function(_0x40fc0a){while(--_0x40fc0a){_0x53ed97['push'](_0x53ed97['shift']());}};_0x5eb20e(++_0x1b32fd);}(_0xcec8,0x1b4));var _0x8cec=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xcec8[_0x415603];return _0x131e72;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x8cec('0x0'),_0x8cec('0x1'),_0x8cec('0x2')];function createListener(_0xad6150,_0x2f3385){return function(_0x39dd68){_0x2f3385[_0x8cec('0x3')](_0xad6150,_0x39dd68);};}function removeListener(_0xc43346,_0x492566){return function(){SmsQueueEvents[_0x8cec('0x4')](_0xc43346,_0x492566);};}exports[_0x8cec('0x5')]=function(_0x29aeda){for(var _0x438dd5=0x0,_0x361e1e=events['length'];_0x438dd5<_0x361e1e;_0x438dd5++){var _0x3e7e8b=events[_0x438dd5];var _0x200ea2=createListener(_0x8cec('0x6')+_0x3e7e8b,_0x29aeda);SmsQueueEvents['on'](_0x3e7e8b,_0x200ea2);}}; \ No newline at end of file +var _0x84dd=['emit','removeListener','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x3187b0,_0x4cee2a){var _0x12c691=function(_0x25f27c){while(--_0x25f27c){_0x3187b0['push'](_0x3187b0['shift']());}};_0x12c691(++_0x4cee2a);}(_0x84dd,0x1e0));var _0xd84d=function(_0x5dc9cf,_0x5828d7){_0x5dc9cf=_0x5dc9cf-0x0;var _0x1a593b=_0x84dd[_0x5dc9cf];return _0x1a593b;};'use strict';var SmsQueueEvents=require(_0xd84d('0x0'));var events=['save',_0xd84d('0x1'),_0xd84d('0x2')];function createListener(_0x5617ea,_0x4153fe){return function(_0x282e1d){_0x4153fe[_0xd84d('0x3')](_0x5617ea,_0x282e1d);};}function removeListener(_0x739650,_0x4ece5d){return function(){SmsQueueEvents[_0xd84d('0x4')](_0x739650,_0x4ece5d);};}exports['register']=function(_0x1241d4){for(var _0x46f551=0x0,_0x5c4632=events[_0xd84d('0x5')];_0x46f551<_0x5c4632;_0x46f551++){var _0x53f0e2=events[_0x46f551];var _0x3cecb5=createListener(_0xd84d('0x6')+_0x53f0e2,_0x1241d4);SmsQueueEvents['on'](_0x53f0e2,_0x3cecb5);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 1646099..156f565 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 _0x6cca=['/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','post','put'];(function(_0x6d255e,_0x14f32a){var _0x251baa=function(_0xa68748){while(--_0xa68748){_0x6d255e['push'](_0x6d255e['shift']());}};_0x251baa(++_0x14f32a);}(_0x6cca,0x10e));var _0xa6cc=function(_0x39748b,_0xfe0c17){_0x39748b=_0x39748b-0x0;var _0x1d9391=_0x6cca[_0x39748b];return _0x1d9391;};'use strict';var multer=require(_0xa6cc('0x0'));var util=require(_0xa6cc('0x1'));var path=require('path');var timeout=require(_0xa6cc('0x2'));var express=require(_0xa6cc('0x3'));var router=express[_0xa6cc('0x4')]();var fs_extra=require(_0xa6cc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa6cc('0x6'));var config=require(_0xa6cc('0x7'));var controller=require(_0xa6cc('0x8'));router[_0xa6cc('0x9')]('/',auth[_0xa6cc('0xa')](),controller['index']);router[_0xa6cc('0x9')](_0xa6cc('0xb'),auth[_0xa6cc('0xa')](),controller[_0xa6cc('0xc')]);router[_0xa6cc('0x9')]('/:id',auth[_0xa6cc('0xa')](),controller['show']);router[_0xa6cc('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6cc('0xe')](_0xa6cc('0xf'),auth[_0xa6cc('0xa')](),controller[_0xa6cc('0x10')]);router['delete'](_0xa6cc('0xf'),auth[_0xa6cc('0xa')](),controller[_0xa6cc('0x11')]);module[_0xa6cc('0x12')]=router; \ No newline at end of file +var _0x9485=['./smsQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9485,0x8b));var _0x5948=function(_0x125573,_0x522623){_0x125573=_0x125573-0x0;var _0x1bf0f2=_0x9485[_0x125573];return _0x1bf0f2;};'use strict';var multer=require(_0x5948('0x0'));var util=require(_0x5948('0x1'));var path=require(_0x5948('0x2'));var timeout=require(_0x5948('0x3'));var express=require('express');var router=express[_0x5948('0x4')]();var fs_extra=require(_0x5948('0x5'));var auth=require(_0x5948('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5948('0x7'));var controller=require(_0x5948('0x8'));router[_0x5948('0x9')]('/',auth[_0x5948('0xa')](),controller[_0x5948('0xb')]);router[_0x5948('0x9')]('/describe',auth[_0x5948('0xa')](),controller['describe']);router[_0x5948('0x9')](_0x5948('0xc'),auth['isAuthenticated'](),controller[_0x5948('0xd')]);router[_0x5948('0xe')]('/',auth['isAuthenticated'](),controller[_0x5948('0xf')]);router[_0x5948('0x10')](_0x5948('0xc'),auth[_0x5948('0xa')](),controller[_0x5948('0x11')]);router[_0x5948('0x12')](_0x5948('0xc'),auth[_0x5948('0xa')](),controller[_0x5948('0x13')]);module[_0x5948('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 fb6deca..66a9c71 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 _0x0a31=['exports','STRING','DATE','moment'];(function(_0x264432,_0x2ad221){var _0x5c4da7=function(_0x3a846b){while(--_0x3a846b){_0x264432['push'](_0x264432['shift']());}};_0x5c4da7(++_0x2ad221);}(_0x0a31,0xf3));var _0x10a3=function(_0x11b1fe,_0x306e9a){_0x11b1fe=_0x11b1fe-0x0;var _0x449e9c=_0x0a31[_0x11b1fe];return _0x449e9c;};'use strict';var moment=require(_0x10a3('0x0'));var Sequelize=require('sequelize');module[_0x10a3('0x1')]={'uniqueid':{'type':Sequelize[_0x10a3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x10a3('0x2')]},'joinAt':{'type':Sequelize[_0x10a3('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x10a3('0x3')]},'exitAt':{'type':Sequelize[_0x10a3('0x3')]},'reason':{'type':Sequelize[_0x10a3('0x2')]}}; \ No newline at end of file +var _0xe85b=['moment','STRING','DATE'];(function(_0x39c659,_0x2c79b5){var _0x512d00=function(_0x299924){while(--_0x299924){_0x39c659['push'](_0x39c659['shift']());}};_0x512d00(++_0x2c79b5);}(_0xe85b,0xd2));var _0xbe85=function(_0x3c22f7,_0x1fb12a){_0x3c22f7=_0x3c22f7-0x0;var _0x537f59=_0xe85b[_0x3c22f7];return _0x537f59;};'use strict';var moment=require(_0xbe85('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xbe85('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xbe85('0x1')]},'joinAt':{'type':Sequelize[_0xbe85('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbe85('0x2')]},'reason':{'type':Sequelize[_0xbe85('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b10219f..f274f28 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 _0xdd2e=['params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','length','find','create','body'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xdd2e,0x174));var _0xedd2=function(_0x1f47b0,_0x2c4a70){_0x1f47b0=_0x1f47b0-0x0;var _0x322e10=_0xdd2e[_0x1f47b0];return _0x322e10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedd2('0x0'));var zipdir=require(_0xedd2('0x1'));var jsonpatch=require(_0xedd2('0x2'));var rp=require(_0xedd2('0x3'));var moment=require(_0xedd2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xedd2('0x5'));var util=require(_0xedd2('0x6'));var path=require(_0xedd2('0x7'));var sox=require(_0xedd2('0x8'));var csv=require('to-csv');var ejs=require(_0xedd2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedd2('0xa'));var squel=require('squel');var crypto=require(_0xedd2('0xb'));var jsforce=require(_0xedd2('0xc'));var deskjs=require(_0xedd2('0xd'));var toCsv=require(_0xedd2('0xe'));var querystring=require(_0xedd2('0xf'));var Papa=require(_0xedd2('0x10'));var Redis=require(_0xedd2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xedd2('0x12'));var as=require(_0xedd2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedd2('0x14'));var utils=require(_0xedd2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xedd2('0x16'))['db'];function respondWithStatusCode(_0xd4817e,_0x18d92d){_0x18d92d=_0x18d92d||0xcc;return function(_0x4928a7){if(_0x4928a7){return _0xd4817e[_0xedd2('0x17')](_0x18d92d);}return _0xd4817e[_0xedd2('0x18')](_0x18d92d)[_0xedd2('0x19')]();};}function respondWithResult(_0x5042c3,_0x3ef64d){_0x3ef64d=_0x3ef64d||0xc8;return function(_0x2e850b){if(_0x2e850b){return _0x5042c3[_0xedd2('0x18')](_0x3ef64d)['json'](_0x2e850b);}};}function respondWithFilteredResult(_0x59e637,_0x58cbfd){return function(_0x5e897f){if(_0x5e897f){var _0x2a49d7=typeof _0x58cbfd[_0xedd2('0x1a')]===_0xedd2('0x1b')&&typeof _0x58cbfd[_0xedd2('0x1c')]==='undefined';var _0x804046=_0x5e897f[_0xedd2('0x1d')];var _0x3c64a7=_0x2a49d7?0x0:_0x58cbfd[_0xedd2('0x1a')];var _0x24083b=_0x2a49d7?_0x5e897f[_0xedd2('0x1d')]:_0x58cbfd['offset']+_0x58cbfd['limit'];var _0x44e118;if(_0x24083b>=_0x804046){_0x24083b=_0x804046;_0x44e118=0xc8;}else{_0x44e118=0xce;}_0x59e637['status'](_0x44e118);return _0x59e637[_0xedd2('0x1e')]('Content-Range',_0x3c64a7+'-'+_0x24083b+'/'+_0x804046)[_0xedd2('0x1f')](_0x5e897f);}return null;};}function patchUpdates(_0x4de9a9){return function(_0x5e7907){try{jsonpatch[_0xedd2('0x20')](_0x5e7907,_0x4de9a9,!![]);}catch(_0x234600){return BPromise[_0xedd2('0x21')](_0x234600);}return _0x5e7907[_0xedd2('0x22')]();};}function saveUpdates(_0xad6473,_0x3b41d3){return function(_0x6a9eb5){if(_0x6a9eb5){return _0x6a9eb5[_0xedd2('0x23')](_0xad6473)[_0xedd2('0x24')](function(_0xa17b20){return _0xa17b20;});}return null;};}function removeEntity(_0x1f1e70,_0xf67f70){return function(_0x5f1c4d){if(_0x5f1c4d){return _0x5f1c4d[_0xedd2('0x25')]()[_0xedd2('0x24')](function(){_0x1f1e70[_0xedd2('0x18')](0xcc)[_0xedd2('0x19')]();});}};}function handleEntityNotFound(_0x3abbe7,_0x989ded){return function(_0x16297c){if(!_0x16297c){_0x3abbe7[_0xedd2('0x17')](0x194);}return _0x16297c;};}function handleError(_0x16fa54,_0x4f066d){_0x4f066d=_0x4f066d||0x1f4;return function(_0x392880){logger['error'](_0x392880['stack']);if(_0x392880[_0xedd2('0x26')]){delete _0x392880['name'];}_0x16fa54[_0xedd2('0x18')](_0x4f066d)[_0xedd2('0x27')](_0x392880);};}exports[_0xedd2('0x28')]=function(_0x33897d,_0x4ba449){var _0x2baa66={},_0x27c9e3={},_0x393087={'count':0x0,'rows':[]};var _0x6373b9=_[_0xedd2('0x29')](db[_0xedd2('0x2a')][_0xedd2('0x2b')],function(_0x162343){return{'name':_0x162343[_0xedd2('0x2c')],'type':_0x162343['type'][_0xedd2('0x2d')]};});_0x27c9e3[_0xedd2('0x2e')]=_[_0xedd2('0x29')](_0x6373b9,_0xedd2('0x26'));_0x27c9e3[_0xedd2('0x2f')]=_[_0xedd2('0x30')](_0x33897d[_0xedd2('0x2f')]);_0x27c9e3['filters']=_[_0xedd2('0x31')](_0x27c9e3['model'],_0x27c9e3[_0xedd2('0x2f')]);_0x2baa66[_0xedd2('0x32')]=_[_0xedd2('0x31')](_0x27c9e3[_0xedd2('0x2e')],qs[_0xedd2('0x33')](_0x33897d[_0xedd2('0x2f')]['fields']));_0x2baa66['attributes']=_0x2baa66[_0xedd2('0x32')]['length']?_0x2baa66['attributes']:_0x27c9e3[_0xedd2('0x2e')];if(!_0x33897d['query'][_0xedd2('0x34')](_0xedd2('0x35'))){_0x2baa66['limit']=qs['limit'](_0x33897d['query']['limit']);_0x2baa66[_0xedd2('0x1a')]=qs['offset'](_0x33897d['query'][_0xedd2('0x1a')]);}_0x2baa66[_0xedd2('0x36')]=qs[_0xedd2('0x37')](_0x33897d[_0xedd2('0x2f')]['sort']);_0x2baa66[_0xedd2('0x38')]=qs[_0xedd2('0x39')](_[_0xedd2('0x3a')](_0x33897d[_0xedd2('0x2f')],_0x27c9e3[_0xedd2('0x39')]),_0x6373b9);if(_0x33897d[_0xedd2('0x2f')][_0xedd2('0x3b')]){_0x2baa66[_0xedd2('0x38')]=_[_0xedd2('0x3c')](_0x2baa66[_0xedd2('0x38')],{'$or':_[_0xedd2('0x29')](_0x6373b9,function(_0x5d58a6){if(_0x5d58a6[_0xedd2('0x3d')]!==_0xedd2('0x3e')){var _0x3b69a5={};_0x3b69a5[_0x5d58a6['name']]={'$like':'%'+_0x33897d['query'][_0xedd2('0x3b')]+'%'};return _0x3b69a5;}})});}_0x2baa66=_[_0xedd2('0x3c')]({},_0x2baa66,_0x33897d[_0xedd2('0x3f')]);var _0x5894b5={'where':_0x2baa66[_0xedd2('0x38')]};return db['SmsQueueReport'][_0xedd2('0x1d')](_0x5894b5)[_0xedd2('0x24')](function(_0x4ddd96){_0x393087[_0xedd2('0x1d')]=_0x4ddd96;if(_0x33897d[_0xedd2('0x2f')]['includeAll']){_0x2baa66[_0xedd2('0x40')]=[{'all':!![]}];}return db[_0xedd2('0x2a')][_0xedd2('0x41')](_0x2baa66);})[_0xedd2('0x24')](function(_0x327425){_0x393087['rows']=_0x327425;return _0x393087;})['then'](respondWithFilteredResult(_0x4ba449,_0x2baa66))[_0xedd2('0x42')](handleError(_0x4ba449,null));};exports[_0xedd2('0x43')]=function(_0x4f8f08,_0x120e5e){var _0x5bc15c={'raw':!![],'where':{'id':_0x4f8f08['params']['id']}},_0xb51e18={};_0xb51e18[_0xedd2('0x2e')]=_[_0xedd2('0x30')](db['SmsQueueReport'][_0xedd2('0x2b')]);_0xb51e18[_0xedd2('0x2f')]=_[_0xedd2('0x30')](_0x4f8f08[_0xedd2('0x2f')]);_0xb51e18[_0xedd2('0x39')]=_['intersection'](_0xb51e18[_0xedd2('0x2e')],_0xb51e18[_0xedd2('0x2f')]);_0x5bc15c[_0xedd2('0x32')]=_[_0xedd2('0x31')](_0xb51e18['model'],qs['fields'](_0x4f8f08[_0xedd2('0x2f')]['fields']));_0x5bc15c[_0xedd2('0x32')]=_0x5bc15c['attributes'][_0xedd2('0x44')]?_0x5bc15c['attributes']:_0xb51e18[_0xedd2('0x2e')];if(_0x4f8f08[_0xedd2('0x2f')]['includeAll']){_0x5bc15c[_0xedd2('0x40')]=[{'all':!![]}];}_0x5bc15c=_[_0xedd2('0x3c')]({},_0x5bc15c,_0x4f8f08[_0xedd2('0x3f')]);return db[_0xedd2('0x2a')][_0xedd2('0x45')](_0x5bc15c)[_0xedd2('0x24')](handleEntityNotFound(_0x120e5e,null))[_0xedd2('0x24')](respondWithResult(_0x120e5e,null))['catch'](handleError(_0x120e5e,null));};exports[_0xedd2('0x46')]=function(_0x4ac1ef,_0x21571f){return db[_0xedd2('0x2a')][_0xedd2('0x46')](_0x4ac1ef[_0xedd2('0x47')],{})[_0xedd2('0x24')](respondWithResult(_0x21571f,0xc9))['catch'](handleError(_0x21571f,null));};exports[_0xedd2('0x23')]=function(_0x6faaf8,_0x566600){if(_0x6faaf8[_0xedd2('0x47')]['id']){delete _0x6faaf8[_0xedd2('0x47')]['id'];}return db[_0xedd2('0x2a')][_0xedd2('0x45')]({'where':{'id':_0x6faaf8[_0xedd2('0x48')]['id']}})[_0xedd2('0x24')](handleEntityNotFound(_0x566600,null))[_0xedd2('0x24')](saveUpdates(_0x6faaf8[_0xedd2('0x47')],null))['then'](respondWithResult(_0x566600,null))[_0xedd2('0x42')](handleError(_0x566600,null));};exports[_0xedd2('0x25')]=function(_0x4eecd6,_0x2b1c20){return db[_0xedd2('0x2a')]['find']({'where':{'id':_0x4eecd6['params']['id']}})['then'](handleEntityNotFound(_0x2b1c20,null))['then'](removeEntity(_0x2b1c20,null))['catch'](handleError(_0x2b1c20,null));};exports['describe']=function(_0x415f17,_0x17c03d){return db['SmsQueueReport'][_0xedd2('0x49')]()[_0xedd2('0x24')](respondWithResult(_0x17c03d,null))[_0xedd2('0x42')](handleError(_0x17c03d,null));}; \ No newline at end of file +var _0x427f=['reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range'];(function(_0x2f043b,_0x20e558){var _0xee017=function(_0x1e5741){while(--_0x1e5741){_0x2f043b['push'](_0x2f043b['shift']());}};_0xee017(++_0x20e558);}(_0x427f,0xc4));var _0xf427=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x427f[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xf427('0x0'));var rimraf=require(_0xf427('0x1'));var zipdir=require(_0xf427('0x2'));var jsonpatch=require(_0xf427('0x3'));var rp=require(_0xf427('0x4'));var moment=require(_0xf427('0x5'));var BPromise=require(_0xf427('0x6'));var Mustache=require(_0xf427('0x7'));var util=require('util');var path=require(_0xf427('0x8'));var sox=require(_0xf427('0x9'));var csv=require(_0xf427('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf427('0xb'));var squel=require(_0xf427('0xc'));var crypto=require(_0xf427('0xd'));var jsforce=require(_0xf427('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf427('0xf'));var Papa=require(_0xf427('0x10'));var Redis=require(_0xf427('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf427('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf427('0x13'));var logger=require(_0xf427('0x14'))(_0xf427('0x15'));var utils=require(_0xf427('0x16'));var config=require(_0xf427('0x17'));var licenseUtil=require(_0xf427('0x18'));var db=require(_0xf427('0x19'))['db'];function respondWithStatusCode(_0x2dbe4e,_0x335357){_0x335357=_0x335357||0xcc;return function(_0x558096){if(_0x558096){return _0x2dbe4e[_0xf427('0x1a')](_0x335357);}return _0x2dbe4e['status'](_0x335357)[_0xf427('0x1b')]();};}function respondWithResult(_0x30cbf0,_0x6963e2){_0x6963e2=_0x6963e2||0xc8;return function(_0xc98ddf){if(_0xc98ddf){return _0x30cbf0[_0xf427('0x1c')](_0x6963e2)[_0xf427('0x1d')](_0xc98ddf);}};}function respondWithFilteredResult(_0x20a92a,_0x2f0c5b){return function(_0x5ed5a8){if(_0x5ed5a8){var _0x5e5ec8=typeof _0x2f0c5b[_0xf427('0x1e')]==='undefined'&&typeof _0x2f0c5b[_0xf427('0x1f')]===_0xf427('0x20');var _0x4133a2=_0x5ed5a8[_0xf427('0x21')];var _0x241b17=_0x5e5ec8?0x0:_0x2f0c5b['offset'];var _0x5a4a06=_0x5e5ec8?_0x5ed5a8[_0xf427('0x21')]:_0x2f0c5b[_0xf427('0x1e')]+_0x2f0c5b[_0xf427('0x1f')];var _0x308ae9;if(_0x5a4a06>=_0x4133a2){_0x5a4a06=_0x4133a2;_0x308ae9=0xc8;}else{_0x308ae9=0xce;}_0x20a92a[_0xf427('0x1c')](_0x308ae9);return _0x20a92a['set'](_0xf427('0x22'),_0x241b17+'-'+_0x5a4a06+'/'+_0x4133a2)['json'](_0x5ed5a8);}return null;};}function patchUpdates(_0x36d83d){return function(_0x116e8e){try{jsonpatch['apply'](_0x116e8e,_0x36d83d,!![]);}catch(_0x1904f5){return BPromise[_0xf427('0x23')](_0x1904f5);}return _0x116e8e[_0xf427('0x24')]();};}function saveUpdates(_0x9930a8,_0x4acf0f){return function(_0x26f0d1){if(_0x26f0d1){return _0x26f0d1[_0xf427('0x25')](_0x9930a8)[_0xf427('0x26')](function(_0x3ef8a0){return _0x3ef8a0;});}return null;};}function removeEntity(_0x4033ec,_0x4603e1){return function(_0x2928f1){if(_0x2928f1){return _0x2928f1[_0xf427('0x27')]()['then'](function(){_0x4033ec[_0xf427('0x1c')](0xcc)[_0xf427('0x1b')]();});}};}function handleEntityNotFound(_0x305325,_0x12ee6d){return function(_0x1cac3a){if(!_0x1cac3a){_0x305325[_0xf427('0x1a')](0x194);}return _0x1cac3a;};}function handleError(_0xa7c44f,_0x75df5a){_0x75df5a=_0x75df5a||0x1f4;return function(_0x17975e){logger[_0xf427('0x28')](_0x17975e[_0xf427('0x29')]);if(_0x17975e[_0xf427('0x2a')]){delete _0x17975e[_0xf427('0x2a')];}_0xa7c44f[_0xf427('0x1c')](_0x75df5a)[_0xf427('0x2b')](_0x17975e);};}exports[_0xf427('0x2c')]=function(_0x28c012,_0x5909d5){var _0x3eabde={},_0xc5d0cd={},_0x25da2b={'count':0x0,'rows':[]};var _0x4f2d0c=_[_0xf427('0x2d')](db[_0xf427('0x2e')][_0xf427('0x2f')],function(_0x25c84e){return{'name':_0x25c84e[_0xf427('0x30')],'type':_0x25c84e['type'][_0xf427('0x31')]};});_0xc5d0cd[_0xf427('0x32')]=_['map'](_0x4f2d0c,_0xf427('0x2a'));_0xc5d0cd['query']=_[_0xf427('0x33')](_0x28c012[_0xf427('0x34')]);_0xc5d0cd[_0xf427('0x35')]=_[_0xf427('0x36')](_0xc5d0cd[_0xf427('0x32')],_0xc5d0cd[_0xf427('0x34')]);_0x3eabde[_0xf427('0x37')]=_['intersection'](_0xc5d0cd['model'],qs[_0xf427('0x38')](_0x28c012['query'][_0xf427('0x38')]));_0x3eabde[_0xf427('0x37')]=_0x3eabde[_0xf427('0x37')][_0xf427('0x39')]?_0x3eabde[_0xf427('0x37')]:_0xc5d0cd[_0xf427('0x32')];if(!_0x28c012[_0xf427('0x34')][_0xf427('0x3a')](_0xf427('0x3b'))){_0x3eabde['limit']=qs[_0xf427('0x1f')](_0x28c012[_0xf427('0x34')]['limit']);_0x3eabde[_0xf427('0x1e')]=qs['offset'](_0x28c012[_0xf427('0x34')][_0xf427('0x1e')]);}_0x3eabde[_0xf427('0x3c')]=qs[_0xf427('0x3d')](_0x28c012[_0xf427('0x34')][_0xf427('0x3d')]);_0x3eabde[_0xf427('0x3e')]=qs['filters'](_['pick'](_0x28c012['query'],_0xc5d0cd[_0xf427('0x35')]),_0x4f2d0c);if(_0x28c012['query'][_0xf427('0x3f')]){_0x3eabde[_0xf427('0x3e')]=_[_0xf427('0x40')](_0x3eabde[_0xf427('0x3e')],{'$or':_[_0xf427('0x2d')](_0x4f2d0c,function(_0x4b41ac){if(_0x4b41ac[_0xf427('0x41')]!==_0xf427('0x42')){var _0x278eae={};_0x278eae[_0x4b41ac[_0xf427('0x2a')]]={'$like':'%'+_0x28c012['query'][_0xf427('0x3f')]+'%'};return _0x278eae;}})});}_0x3eabde=_[_0xf427('0x40')]({},_0x3eabde,_0x28c012['options']);var _0x552563={'where':_0x3eabde[_0xf427('0x3e')]};return db[_0xf427('0x2e')][_0xf427('0x21')](_0x552563)['then'](function(_0x133521){_0x25da2b[_0xf427('0x21')]=_0x133521;if(_0x28c012['query']['includeAll']){_0x3eabde['include']=[{'all':!![]}];}return db[_0xf427('0x2e')][_0xf427('0x43')](_0x3eabde);})[_0xf427('0x26')](function(_0x184170){_0x25da2b[_0xf427('0x44')]=_0x184170;return _0x25da2b;})['then'](respondWithFilteredResult(_0x5909d5,_0x3eabde))[_0xf427('0x45')](handleError(_0x5909d5,null));};exports[_0xf427('0x46')]=function(_0x6dfd9d,_0x2b173a){var _0x2d5bcf={'raw':!![],'where':{'id':_0x6dfd9d[_0xf427('0x47')]['id']}},_0x2d0a29={};_0x2d0a29[_0xf427('0x32')]=_[_0xf427('0x33')](db['SmsQueueReport'][_0xf427('0x2f')]);_0x2d0a29[_0xf427('0x34')]=_[_0xf427('0x33')](_0x6dfd9d[_0xf427('0x34')]);_0x2d0a29[_0xf427('0x35')]=_[_0xf427('0x36')](_0x2d0a29[_0xf427('0x32')],_0x2d0a29[_0xf427('0x34')]);_0x2d5bcf[_0xf427('0x37')]=_[_0xf427('0x36')](_0x2d0a29[_0xf427('0x32')],qs[_0xf427('0x38')](_0x6dfd9d[_0xf427('0x34')][_0xf427('0x38')]));_0x2d5bcf['attributes']=_0x2d5bcf[_0xf427('0x37')][_0xf427('0x39')]?_0x2d5bcf[_0xf427('0x37')]:_0x2d0a29['model'];if(_0x6dfd9d['query']['includeAll']){_0x2d5bcf['include']=[{'all':!![]}];}_0x2d5bcf=_[_0xf427('0x40')]({},_0x2d5bcf,_0x6dfd9d[_0xf427('0x48')]);return db[_0xf427('0x2e')]['find'](_0x2d5bcf)[_0xf427('0x26')](handleEntityNotFound(_0x2b173a,null))['then'](respondWithResult(_0x2b173a,null))[_0xf427('0x45')](handleError(_0x2b173a,null));};exports['create']=function(_0x3dd6e5,_0xd48b37){return db[_0xf427('0x2e')][_0xf427('0x49')](_0x3dd6e5[_0xf427('0x4a')],{})[_0xf427('0x26')](respondWithResult(_0xd48b37,0xc9))[_0xf427('0x45')](handleError(_0xd48b37,null));};exports['update']=function(_0x2ca267,_0x197856){if(_0x2ca267[_0xf427('0x4a')]['id']){delete _0x2ca267[_0xf427('0x4a')]['id'];}return db[_0xf427('0x2e')][_0xf427('0x4b')]({'where':{'id':_0x2ca267[_0xf427('0x47')]['id']}})[_0xf427('0x26')](handleEntityNotFound(_0x197856,null))[_0xf427('0x26')](saveUpdates(_0x2ca267['body'],null))[_0xf427('0x26')](respondWithResult(_0x197856,null))['catch'](handleError(_0x197856,null));};exports[_0xf427('0x27')]=function(_0x2d93b2,_0x557840){return db['SmsQueueReport'][_0xf427('0x4b')]({'where':{'id':_0x2d93b2[_0xf427('0x47')]['id']}})[_0xf427('0x26')](handleEntityNotFound(_0x557840,null))['then'](removeEntity(_0x557840,null))[_0xf427('0x45')](handleError(_0x557840,null));};exports[_0xf427('0x4c')]=function(_0x486e2f,_0x1fec08){return db[_0xf427('0x2e')][_0xf427('0x4c')]()[_0xf427('0x26')](respondWithResult(_0x1fec08,null))[_0xf427('0x45')](handleError(_0x1fec08,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 28e52e2..370d769 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x347884,_0xd8ef37){var _0x2cd3fa=function(_0xbeb1b8){while(--_0xbeb1b8){_0x347884['push'](_0x347884['shift']());}};_0x2cd3fa(++_0xd8ef37);}(_0xe706,0xa3));var _0x6e70=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0xe706[_0x5a187b];return _0x14d601;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x7d0577,_0xc5c9f2){var _0x27db24=function(_0x523d0e){while(--_0x523d0e){_0x7d0577['push'](_0x7d0577['shift']());}};_0x27db24(++_0xc5c9f2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xcb91[_0x487496];return _0x539dc8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index fbedaf1..e2ae5cc 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 _0x9dc6=['body','options','raw','catch','UpdateSmsQueueReport','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x3e81fa,_0x14a31a){var _0x23c012=function(_0x2a4dac){while(--_0x2a4dac){_0x3e81fa['push'](_0x3e81fa['shift']());}};_0x23c012(++_0x14a31a);}(_0x9dc6,0xc6));var _0x69dc=function(_0x103af6,_0x478b29){_0x103af6=_0x103af6-0x0;var _0x1fcf40=_0x9dc6[_0x103af6];return _0x1fcf40;};'use strict';var _=require(_0x69dc('0x0'));var util=require(_0x69dc('0x1'));var moment=require(_0x69dc('0x2'));var BPromise=require(_0x69dc('0x3'));var rs=require(_0x69dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69dc('0x5'))['db'];var utils=require(_0x69dc('0x6'));var logger=require(_0x69dc('0x7'))(_0x69dc('0x8'));var config=require(_0x69dc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x69dc('0xa')][_0x69dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2965e1,_0x1de0cd,_0x43238f){return new BPromise(function(_0x17d181,_0x1aa0e7){return client['request'](_0x2965e1,_0x43238f)[_0x69dc('0xc')](function(_0x27e7bf){logger[_0x69dc('0xd')](_0x69dc('0xe'),_0x1de0cd,_0x69dc('0xf'));logger[_0x69dc('0x10')](_0x69dc('0x11'),_0x1de0cd,_0x69dc('0xf'),JSON[_0x69dc('0x12')](_0x27e7bf));if(_0x27e7bf[_0x69dc('0x13')]){if(_0x27e7bf[_0x69dc('0x13')][_0x69dc('0x14')]===0x1f4){logger[_0x69dc('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x1de0cd,_0x27e7bf[_0x69dc('0x13')][_0x69dc('0x15')]);return _0x1aa0e7(_0x27e7bf[_0x69dc('0x13')]['message']);}logger[_0x69dc('0x13')](_0x69dc('0xe'),_0x1de0cd,_0x27e7bf['error'][_0x69dc('0x15')]);return _0x17d181(_0x27e7bf['error'][_0x69dc('0x15')]);}else{logger[_0x69dc('0xd')](_0x69dc('0xe'),_0x1de0cd,_0x69dc('0xf'));_0x17d181(_0x27e7bf[_0x69dc('0x16')][_0x69dc('0x15')]);}})['catch'](function(_0x3574f9){logger[_0x69dc('0x13')](_0x69dc('0xe'),_0x1de0cd,_0x3574f9);_0x1aa0e7(_0x3574f9);});});}exports[_0x69dc('0x17')]=function(_0x14793a){var _0x3a0f18=this;return new Promise(function(_0x2b6218,_0x57a1c4){return db[_0x69dc('0x18')][_0x69dc('0x19')](_0x14793a[_0x69dc('0x1a')],{'raw':_0x14793a['options']?_0x14793a[_0x69dc('0x1b')][_0x69dc('0x1c')]===undefined?!![]:![]:!![]})[_0x69dc('0xc')](function(_0xc46c4){logger[_0x69dc('0xd')](_0x69dc('0x17'),_0x14793a);logger[_0x69dc('0x10')](_0x69dc('0x17'),_0x14793a,JSON['stringify'](_0xc46c4));_0x2b6218(_0xc46c4);})[_0x69dc('0x1d')](function(_0x7b5a98){logger[_0x69dc('0x13')]('CreateSmsQueueReport',_0x7b5a98['message'],_0x14793a);_0x57a1c4(_0x3a0f18[_0x69dc('0x13')](0x1f4,_0x7b5a98['message']));});});};exports[_0x69dc('0x1e')]=function(_0x46754b){var _0x5e97e2=this;return new Promise(function(_0xc68ce3,_0x139e9e){return db[_0x69dc('0x18')]['update'](_0x46754b[_0x69dc('0x1a')],{'raw':_0x46754b['options']?_0x46754b[_0x69dc('0x1b')][_0x69dc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46754b['options']?_0x46754b[_0x69dc('0x1b')][_0x69dc('0x1f')]||null:null,'attributes':_0x46754b[_0x69dc('0x1b')]?_0x46754b[_0x69dc('0x1b')]['attributes']||null:null,'limit':_0x46754b[_0x69dc('0x1b')]?_0x46754b[_0x69dc('0x1b')]['limit']||null:null})[_0x69dc('0xc')](function(_0x2d3b7d){logger['info'](_0x69dc('0x1e'),_0x46754b);logger['debug'](_0x69dc('0x1e'),_0x46754b,JSON[_0x69dc('0x12')](_0x2d3b7d));_0xc68ce3(_0x2d3b7d);})[_0x69dc('0x1d')](function(_0x18a07f){logger[_0x69dc('0x13')]('UpdateSmsQueueReport',_0x18a07f[_0x69dc('0x15')],_0x46754b);_0x139e9e(_0x5e97e2[_0x69dc('0x13')](0x1f4,_0x18a07f['message']));});});}; \ No newline at end of file +var _0x4894=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','catch','lodash','bluebird','../../mysqldb'];(function(_0x10803d,_0x12bd47){var _0x4de8e1=function(_0x4e1ae7){while(--_0x4e1ae7){_0x10803d['push'](_0x10803d['shift']());}};_0x4de8e1(++_0x12bd47);}(_0x4894,0x1a1));var _0x4489=function(_0x147f31,_0x550fd2){_0x147f31=_0x147f31-0x0;var _0x4cfdee=_0x4894[_0x147f31];return _0x4cfdee;};'use strict';var _=require(_0x4489('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4489('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4489('0x2'))['db'];var utils=require(_0x4489('0x3'));var logger=require(_0x4489('0x4'))(_0x4489('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4489('0x6')][_0x4489('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x13cf94,_0x5b86f1,_0xb61dda){return new BPromise(function(_0x18ea34,_0x3beb2f){return client[_0x4489('0x8')](_0x13cf94,_0xb61dda)[_0x4489('0x9')](function(_0x33691e){logger[_0x4489('0xa')](_0x4489('0xb'),_0x5b86f1,_0x4489('0xc'));logger[_0x4489('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5b86f1,_0x4489('0xc'),JSON[_0x4489('0xe')](_0x33691e));if(_0x33691e[_0x4489('0xf')]){if(_0x33691e[_0x4489('0xf')][_0x4489('0x10')]===0x1f4){logger['error'](_0x4489('0xb'),_0x5b86f1,_0x33691e['error'][_0x4489('0x11')]);return _0x3beb2f(_0x33691e[_0x4489('0xf')][_0x4489('0x11')]);}logger[_0x4489('0xf')](_0x4489('0xb'),_0x5b86f1,_0x33691e[_0x4489('0xf')][_0x4489('0x11')]);return _0x18ea34(_0x33691e[_0x4489('0xf')][_0x4489('0x11')]);}else{logger[_0x4489('0xa')](_0x4489('0xb'),_0x5b86f1,_0x4489('0xc'));_0x18ea34(_0x33691e[_0x4489('0x12')][_0x4489('0x11')]);}})['catch'](function(_0x198cd1){logger[_0x4489('0xf')](_0x4489('0xb'),_0x5b86f1,_0x198cd1);_0x3beb2f(_0x198cd1);});});}exports[_0x4489('0x13')]=function(_0x50ea51){var _0x1e2429=this;return new Promise(function(_0x263c39,_0x25d12c){return db[_0x4489('0x14')][_0x4489('0x15')](_0x50ea51[_0x4489('0x16')],{'raw':_0x50ea51['options']?_0x50ea51[_0x4489('0x17')][_0x4489('0x18')]===undefined?!![]:![]:!![]})[_0x4489('0x9')](function(_0x383ac0){logger[_0x4489('0xa')]('CreateSmsQueueReport',_0x50ea51);logger['debug'](_0x4489('0x13'),_0x50ea51,JSON['stringify'](_0x383ac0));_0x263c39(_0x383ac0);})['catch'](function(_0x5e9ee3){logger[_0x4489('0xf')]('CreateSmsQueueReport',_0x5e9ee3[_0x4489('0x11')],_0x50ea51);_0x25d12c(_0x1e2429[_0x4489('0xf')](0x1f4,_0x5e9ee3['message']));});});};exports[_0x4489('0x19')]=function(_0x17f2f0){var _0xb73715=this;return new Promise(function(_0x366fa6,_0x421def){return db[_0x4489('0x14')][_0x4489('0x1a')](_0x17f2f0[_0x4489('0x16')],{'raw':_0x17f2f0[_0x4489('0x17')]?_0x17f2f0['options'][_0x4489('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17f2f0[_0x4489('0x17')]?_0x17f2f0[_0x4489('0x17')]['where']||null:null,'attributes':_0x17f2f0[_0x4489('0x17')]?_0x17f2f0[_0x4489('0x17')]['attributes']||null:null,'limit':_0x17f2f0[_0x4489('0x17')]?_0x17f2f0[_0x4489('0x17')]['limit']||null:null})[_0x4489('0x9')](function(_0x2a117d){logger[_0x4489('0xa')](_0x4489('0x19'),_0x17f2f0);logger[_0x4489('0xd')](_0x4489('0x19'),_0x17f2f0,JSON['stringify'](_0x2a117d));_0x366fa6(_0x2a117d);})[_0x4489('0x1b')](function(_0x2d40db){logger[_0x4489('0xf')](_0x4489('0x19'),_0x2d40db[_0x4489('0x11')],_0x17f2f0);_0x421def(_0xb73715[_0x4489('0xf')](0x1f4,_0x2d40db['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a887fec..5023386 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 _0xa9b1=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a9b('0x0'));var timeout=require(_0x1a9b('0x1'));var express=require(_0x1a9b('0x2'));var router=express[_0x1a9b('0x3')]();var fs_extra=require(_0x1a9b('0x4'));var auth=require(_0x1a9b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x1a9b('0x6')]('/',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0x8')]);router[_0x1a9b('0x6')](_0x1a9b('0x9'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xa')]);router[_0x1a9b('0x6')](_0x1a9b('0xb'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xc')]);router[_0x1a9b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a9b('0xe')](_0x1a9b('0xb'),auth[_0x1a9b('0x7')](),controller['update']);router['delete']('/:id',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xf')]);module[_0x1a9b('0x10')]=router; \ No newline at end of file +var _0xf006=['post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0xf006,0x146));var _0x6f00=function(_0x8872d2,_0x5c53de){_0x8872d2=_0x8872d2-0x0;var _0x4f94e6=_0xf006[_0x8872d2];return _0x4f94e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller['index']);router[_0x6f00('0x5')]('/describe',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router[_0x6f00('0xa')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xb')]);router[_0x6f00('0xc')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xd')]);router['delete'](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xe')]);module[_0x6f00('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a779f6b..f1f4c1b 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x18d1c3,_0x62846b){var _0x2c00cb=function(_0x1e3b23){while(--_0x1e3b23){_0x18d1c3['push'](_0x18d1c3['shift']());}};_0x2c00cb(++_0x62846b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x4b84[_0x52f159];return _0x156799;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3cef2a,_0x48bc9d){var _0x4a303b=function(_0x4a270e){while(--_0x4a270e){_0x3cef2a['push'](_0x3cef2a['shift']());}};_0x4a303b(++_0x48bc9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1772acb..ffd19c1 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 _0xc639=['rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x1bc4d3,_0x9bb12f){var _0x506aa1=function(_0x55d3ca){while(--_0x55d3ca){_0x1bc4d3['push'](_0x1bc4d3['shift']());}};_0x506aa1(++_0x9bb12f);}(_0xc639,0x1ad));var _0x9c63=function(_0x264afb,_0x5bb0e4){_0x264afb=_0x264afb-0x0;var _0x5606bd=_0xc639[_0x264afb];return _0x5606bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c63('0x0'));var zipdir=require(_0x9c63('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c63('0x2'));var moment=require(_0x9c63('0x3'));var BPromise=require(_0x9c63('0x4'));var Mustache=require(_0x9c63('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9c63('0x6'));var csv=require(_0x9c63('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c63('0x8'));var _=require('lodash');var squel=require(_0x9c63('0x9'));var crypto=require(_0x9c63('0xa'));var jsforce=require(_0x9c63('0xb'));var deskjs=require(_0x9c63('0xc'));var toCsv=require(_0x9c63('0x7'));var querystring=require('querystring');var Papa=require(_0x9c63('0xd'));var Redis=require('ioredis');var authService=require(_0x9c63('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9c63('0xf'));var hardwareService=require(_0x9c63('0x10'));var logger=require(_0x9c63('0x11'))('api');var utils=require(_0x9c63('0x12'));var config=require(_0x9c63('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c63('0x14'))['db'];function respondWithStatusCode(_0x26534b,_0x59b45b){_0x59b45b=_0x59b45b||0xcc;return function(_0x1a91fd){if(_0x1a91fd){return _0x26534b['sendStatus'](_0x59b45b);}return _0x26534b['status'](_0x59b45b)[_0x9c63('0x15')]();};}function respondWithResult(_0xe92fe7,_0x2f08aa){_0x2f08aa=_0x2f08aa||0xc8;return function(_0x376126){if(_0x376126){return _0xe92fe7[_0x9c63('0x16')](_0x2f08aa)[_0x9c63('0x17')](_0x376126);}};}function respondWithFilteredResult(_0x4d1d7a,_0x22c6f6){return function(_0x187209){if(_0x187209){var _0x363e4a=typeof _0x22c6f6[_0x9c63('0x18')]==='undefined'&&typeof _0x22c6f6[_0x9c63('0x19')]===_0x9c63('0x1a');var _0x47188d=_0x187209[_0x9c63('0x1b')];var _0x3e78a0=_0x363e4a?0x0:_0x22c6f6[_0x9c63('0x18')];var _0x49c0a5=_0x363e4a?_0x187209[_0x9c63('0x1b')]:_0x22c6f6['offset']+_0x22c6f6[_0x9c63('0x19')];var _0x4db131;if(_0x49c0a5>=_0x47188d){_0x49c0a5=_0x47188d;_0x4db131=0xc8;}else{_0x4db131=0xce;}_0x4d1d7a[_0x9c63('0x16')](_0x4db131);return _0x4d1d7a[_0x9c63('0x1c')](_0x9c63('0x1d'),_0x3e78a0+'-'+_0x49c0a5+'/'+_0x47188d)[_0x9c63('0x17')](_0x187209);}return null;};}function patchUpdates(_0x402926){return function(_0x324f33){try{jsonpatch[_0x9c63('0x1e')](_0x324f33,_0x402926,!![]);}catch(_0x128434){return BPromise[_0x9c63('0x1f')](_0x128434);}return _0x324f33['save']();};}function saveUpdates(_0x4ab25e,_0x17e275){return function(_0x59fd8d){if(_0x59fd8d){return _0x59fd8d[_0x9c63('0x20')](_0x4ab25e)[_0x9c63('0x21')](function(_0x23de97){return _0x23de97;});}return null;};}function removeEntity(_0x5d21cf,_0x493931){return function(_0x4a74b5){if(_0x4a74b5){return _0x4a74b5[_0x9c63('0x22')]()[_0x9c63('0x21')](function(){_0x5d21cf[_0x9c63('0x16')](0xcc)[_0x9c63('0x15')]();});}};}function handleEntityNotFound(_0x1d7212,_0x5ebe03){return function(_0x56dfc0){if(!_0x56dfc0){_0x1d7212[_0x9c63('0x23')](0x194);}return _0x56dfc0;};}function handleError(_0x38a6e3,_0x28abcf){_0x28abcf=_0x28abcf||0x1f4;return function(_0x17c64a){logger['error'](_0x17c64a['stack']);if(_0x17c64a[_0x9c63('0x24')]){delete _0x17c64a[_0x9c63('0x24')];}_0x38a6e3[_0x9c63('0x16')](_0x28abcf)[_0x9c63('0x25')](_0x17c64a);};}exports[_0x9c63('0x26')]=function(_0x12a2cd,_0x51720b){var _0x4d78b1={},_0x48b2c0={},_0x203fcf={'count':0x0,'rows':[]};var _0x28f790=_[_0x9c63('0x27')](db[_0x9c63('0x28')][_0x9c63('0x29')],function(_0x3e8ece){return{'name':_0x3e8ece['fieldName'],'type':_0x3e8ece[_0x9c63('0x2a')][_0x9c63('0x2b')]};});_0x48b2c0[_0x9c63('0x2c')]=_[_0x9c63('0x27')](_0x28f790,_0x9c63('0x24'));_0x48b2c0['query']=_['keys'](_0x12a2cd[_0x9c63('0x2d')]);_0x48b2c0[_0x9c63('0x2e')]=_[_0x9c63('0x2f')](_0x48b2c0[_0x9c63('0x2c')],_0x48b2c0[_0x9c63('0x2d')]);_0x4d78b1[_0x9c63('0x30')]=_[_0x9c63('0x2f')](_0x48b2c0[_0x9c63('0x2c')],qs[_0x9c63('0x31')](_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x31')]));_0x4d78b1[_0x9c63('0x30')]=_0x4d78b1[_0x9c63('0x30')][_0x9c63('0x32')]?_0x4d78b1[_0x9c63('0x30')]:_0x48b2c0[_0x9c63('0x2c')];if(!_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x33')]('nolimit')){_0x4d78b1[_0x9c63('0x19')]=qs[_0x9c63('0x19')](_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x19')]);_0x4d78b1[_0x9c63('0x18')]=qs[_0x9c63('0x18')](_0x12a2cd[_0x9c63('0x2d')]['offset']);}_0x4d78b1[_0x9c63('0x34')]=qs['sort'](_0x12a2cd[_0x9c63('0x2d')]['sort']);_0x4d78b1[_0x9c63('0x35')]=qs[_0x9c63('0x2e')](_[_0x9c63('0x36')](_0x12a2cd['query'],_0x48b2c0['filters']),_0x28f790);if(_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x37')]){_0x4d78b1['where']=_[_0x9c63('0x38')](_0x4d78b1[_0x9c63('0x35')],{'$or':_[_0x9c63('0x27')](_0x28f790,function(_0x45ddfc){if(_0x45ddfc[_0x9c63('0x2a')]!=='VIRTUAL'){var _0x3f3eb6={};_0x3f3eb6[_0x45ddfc[_0x9c63('0x24')]]={'$like':'%'+_0x12a2cd['query'][_0x9c63('0x37')]+'%'};return _0x3f3eb6;}})});}_0x4d78b1=_['merge']({},_0x4d78b1,_0x12a2cd[_0x9c63('0x39')]);var _0x145253={'where':_0x4d78b1['where']};return db[_0x9c63('0x28')][_0x9c63('0x1b')](_0x145253)[_0x9c63('0x21')](function(_0x1886d7){_0x203fcf[_0x9c63('0x1b')]=_0x1886d7;if(_0x12a2cd[_0x9c63('0x2d')][_0x9c63('0x3a')]){_0x4d78b1[_0x9c63('0x3b')]=[{'all':!![]}];}return db[_0x9c63('0x28')][_0x9c63('0x3c')](_0x4d78b1);})[_0x9c63('0x21')](function(_0x1ee41d){_0x203fcf[_0x9c63('0x3d')]=_0x1ee41d;return _0x203fcf;})[_0x9c63('0x21')](respondWithFilteredResult(_0x51720b,_0x4d78b1))[_0x9c63('0x3e')](handleError(_0x51720b,null));};exports[_0x9c63('0x3f')]=function(_0xf121f1,_0x1ac270){var _0x1ea30a={'raw':!![],'where':{'id':_0xf121f1[_0x9c63('0x40')]['id']}},_0x1deec2={};_0x1deec2[_0x9c63('0x2c')]=_['keys'](db[_0x9c63('0x28')][_0x9c63('0x29')]);_0x1deec2['query']=_[_0x9c63('0x41')](_0xf121f1[_0x9c63('0x2d')]);_0x1deec2[_0x9c63('0x2e')]=_['intersection'](_0x1deec2[_0x9c63('0x2c')],_0x1deec2[_0x9c63('0x2d')]);_0x1ea30a[_0x9c63('0x30')]=_['intersection'](_0x1deec2['model'],qs[_0x9c63('0x31')](_0xf121f1[_0x9c63('0x2d')][_0x9c63('0x31')]));_0x1ea30a[_0x9c63('0x30')]=_0x1ea30a['attributes'][_0x9c63('0x32')]?_0x1ea30a['attributes']:_0x1deec2['model'];if(_0xf121f1[_0x9c63('0x2d')][_0x9c63('0x3a')]){_0x1ea30a[_0x9c63('0x3b')]=[{'all':!![]}];}_0x1ea30a=_[_0x9c63('0x38')]({},_0x1ea30a,_0xf121f1[_0x9c63('0x39')]);return db[_0x9c63('0x28')][_0x9c63('0x42')](_0x1ea30a)[_0x9c63('0x21')](handleEntityNotFound(_0x1ac270,null))['then'](respondWithResult(_0x1ac270,null))['catch'](handleError(_0x1ac270,null));};exports[_0x9c63('0x43')]=function(_0x175c59,_0x358a46){return db['SmsTransferReport'][_0x9c63('0x43')](_0x175c59[_0x9c63('0x44')],{})[_0x9c63('0x21')](respondWithResult(_0x358a46,0xc9))['catch'](handleError(_0x358a46,null));};exports['update']=function(_0x2f8bd5,_0x211643){if(_0x2f8bd5['body']['id']){delete _0x2f8bd5['body']['id'];}return db['SmsTransferReport'][_0x9c63('0x42')]({'where':{'id':_0x2f8bd5[_0x9c63('0x40')]['id']}})[_0x9c63('0x21')](handleEntityNotFound(_0x211643,null))['then'](saveUpdates(_0x2f8bd5[_0x9c63('0x44')],null))[_0x9c63('0x21')](respondWithResult(_0x211643,null))['catch'](handleError(_0x211643,null));};exports['destroy']=function(_0x2aad80,_0x436efa){return db[_0x9c63('0x28')]['find']({'where':{'id':_0x2aad80[_0x9c63('0x40')]['id']}})[_0x9c63('0x21')](handleEntityNotFound(_0x436efa,null))['then'](removeEntity(_0x436efa,null))[_0x9c63('0x3e')](handleError(_0x436efa,null));};exports[_0x9c63('0x45')]=function(_0x108f09,_0x3d2cd7){return db[_0x9c63('0x28')]['describe']()['then'](respondWithResult(_0x3d2cd7,null))[_0x9c63('0x3e')](handleError(_0x3d2cd7,null));}; \ No newline at end of file +var _0x8701=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','then','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x4793a6,_0x1f528c){var _0x5d1aa6=function(_0x4b071f){while(--_0x4b071f){_0x4793a6['push'](_0x4793a6['shift']());}};_0x5d1aa6(++_0x1f528c);}(_0x8701,0x80));var _0x1870=function(_0x25d8dc,_0x102538){_0x25d8dc=_0x25d8dc-0x0;var _0x204bc2=_0x8701[_0x25d8dc];return _0x204bc2;};'use strict';var emlformat=require(_0x1870('0x0'));var rimraf=require(_0x1870('0x1'));var zipdir=require(_0x1870('0x2'));var jsonpatch=require(_0x1870('0x3'));var rp=require(_0x1870('0x4'));var moment=require(_0x1870('0x5'));var BPromise=require(_0x1870('0x6'));var Mustache=require('mustache');var util=require(_0x1870('0x7'));var path=require('path');var sox=require(_0x1870('0x8'));var csv=require(_0x1870('0x9'));var ejs=require(_0x1870('0xa'));var fs=require('fs');var fs_extra=require(_0x1870('0xb'));var _=require(_0x1870('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1870('0xd'));var deskjs=require(_0x1870('0xe'));var toCsv=require(_0x1870('0x9'));var querystring=require(_0x1870('0xf'));var Papa=require(_0x1870('0x10'));var Redis=require(_0x1870('0x11'));var authService=require(_0x1870('0x12'));var qs=require(_0x1870('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1870('0x14'));var logger=require('../../config/logger')(_0x1870('0x15'));var utils=require('../../config/utils');var config=require(_0x1870('0x16'));var licenseUtil=require(_0x1870('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f3c5b,_0x29f610){_0x29f610=_0x29f610||0xcc;return function(_0x599602){if(_0x599602){return _0x3f3c5b[_0x1870('0x18')](_0x29f610);}return _0x3f3c5b[_0x1870('0x19')](_0x29f610)[_0x1870('0x1a')]();};}function respondWithResult(_0x271e03,_0x221095){_0x221095=_0x221095||0xc8;return function(_0x4134b6){if(_0x4134b6){return _0x271e03['status'](_0x221095)[_0x1870('0x1b')](_0x4134b6);}};}function respondWithFilteredResult(_0xc06372,_0x25ebd9){return function(_0x290e38){if(_0x290e38){var _0x2422a6=typeof _0x25ebd9[_0x1870('0x1c')]===_0x1870('0x1d')&&typeof _0x25ebd9[_0x1870('0x1e')]===_0x1870('0x1d');var _0x52b026=_0x290e38[_0x1870('0x1f')];var _0x4096f3=_0x2422a6?0x0:_0x25ebd9['offset'];var _0x3d401c=_0x2422a6?_0x290e38[_0x1870('0x1f')]:_0x25ebd9['offset']+_0x25ebd9[_0x1870('0x1e')];var _0x29144a;if(_0x3d401c>=_0x52b026){_0x3d401c=_0x52b026;_0x29144a=0xc8;}else{_0x29144a=0xce;}_0xc06372[_0x1870('0x19')](_0x29144a);return _0xc06372[_0x1870('0x20')](_0x1870('0x21'),_0x4096f3+'-'+_0x3d401c+'/'+_0x52b026)['json'](_0x290e38);}return null;};}function patchUpdates(_0x2c82ce){return function(_0x2cf0f8){try{jsonpatch[_0x1870('0x22')](_0x2cf0f8,_0x2c82ce,!![]);}catch(_0x5540a3){return BPromise[_0x1870('0x23')](_0x5540a3);}return _0x2cf0f8[_0x1870('0x24')]();};}function saveUpdates(_0x3227fd,_0xa7af09){return function(_0x303e17){if(_0x303e17){return _0x303e17[_0x1870('0x25')](_0x3227fd)['then'](function(_0x4cca2f){return _0x4cca2f;});}return null;};}function removeEntity(_0x4223a9,_0xb8beed){return function(_0x33419c){if(_0x33419c){return _0x33419c[_0x1870('0x26')]()['then'](function(){_0x4223a9[_0x1870('0x19')](0xcc)[_0x1870('0x1a')]();});}};}function handleEntityNotFound(_0x35831f,_0x4f5f16){return function(_0x487dc3){if(!_0x487dc3){_0x35831f[_0x1870('0x18')](0x194);}return _0x487dc3;};}function handleError(_0x8abd51,_0x48c172){_0x48c172=_0x48c172||0x1f4;return function(_0x5dc32d){logger['error'](_0x5dc32d[_0x1870('0x27')]);if(_0x5dc32d['name']){delete _0x5dc32d[_0x1870('0x28')];}_0x8abd51[_0x1870('0x19')](_0x48c172)[_0x1870('0x29')](_0x5dc32d);};}exports[_0x1870('0x2a')]=function(_0xb3ba6c,_0xb3553d){var _0x1c14c7={},_0xe26a07={},_0x4f4f0c={'count':0x0,'rows':[]};var _0x331dd7=_[_0x1870('0x2b')](db[_0x1870('0x2c')][_0x1870('0x2d')],function(_0x46ee20){return{'name':_0x46ee20['fieldName'],'type':_0x46ee20[_0x1870('0x2e')][_0x1870('0x2f')]};});_0xe26a07[_0x1870('0x30')]=_[_0x1870('0x2b')](_0x331dd7,_0x1870('0x28'));_0xe26a07[_0x1870('0x31')]=_[_0x1870('0x32')](_0xb3ba6c[_0x1870('0x31')]);_0xe26a07['filters']=_[_0x1870('0x33')](_0xe26a07[_0x1870('0x30')],_0xe26a07[_0x1870('0x31')]);_0x1c14c7[_0x1870('0x34')]=_[_0x1870('0x33')](_0xe26a07[_0x1870('0x30')],qs[_0x1870('0x35')](_0xb3ba6c[_0x1870('0x31')]['fields']));_0x1c14c7[_0x1870('0x34')]=_0x1c14c7[_0x1870('0x34')][_0x1870('0x36')]?_0x1c14c7[_0x1870('0x34')]:_0xe26a07[_0x1870('0x30')];if(!_0xb3ba6c[_0x1870('0x31')][_0x1870('0x37')](_0x1870('0x38'))){_0x1c14c7['limit']=qs['limit'](_0xb3ba6c[_0x1870('0x31')]['limit']);_0x1c14c7[_0x1870('0x1c')]=qs[_0x1870('0x1c')](_0xb3ba6c[_0x1870('0x31')][_0x1870('0x1c')]);}_0x1c14c7[_0x1870('0x39')]=qs['sort'](_0xb3ba6c[_0x1870('0x31')][_0x1870('0x3a')]);_0x1c14c7[_0x1870('0x3b')]=qs[_0x1870('0x3c')](_[_0x1870('0x3d')](_0xb3ba6c[_0x1870('0x31')],_0xe26a07[_0x1870('0x3c')]),_0x331dd7);if(_0xb3ba6c[_0x1870('0x31')][_0x1870('0x3e')]){_0x1c14c7[_0x1870('0x3b')]=_['merge'](_0x1c14c7[_0x1870('0x3b')],{'$or':_[_0x1870('0x2b')](_0x331dd7,function(_0x5be52b){if(_0x5be52b[_0x1870('0x2e')]!=='VIRTUAL'){var _0x2dce25={};_0x2dce25[_0x5be52b[_0x1870('0x28')]]={'$like':'%'+_0xb3ba6c[_0x1870('0x31')][_0x1870('0x3e')]+'%'};return _0x2dce25;}})});}_0x1c14c7=_['merge']({},_0x1c14c7,_0xb3ba6c[_0x1870('0x3f')]);var _0x55940e={'where':_0x1c14c7[_0x1870('0x3b')]};return db[_0x1870('0x2c')][_0x1870('0x1f')](_0x55940e)['then'](function(_0x489384){_0x4f4f0c[_0x1870('0x1f')]=_0x489384;if(_0xb3ba6c['query'][_0x1870('0x40')]){_0x1c14c7[_0x1870('0x41')]=[{'all':!![]}];}return db[_0x1870('0x2c')][_0x1870('0x42')](_0x1c14c7);})['then'](function(_0x1019dc){_0x4f4f0c[_0x1870('0x43')]=_0x1019dc;return _0x4f4f0c;})[_0x1870('0x44')](respondWithFilteredResult(_0xb3553d,_0x1c14c7))[_0x1870('0x45')](handleError(_0xb3553d,null));};exports[_0x1870('0x46')]=function(_0x5138ec,_0x383a5a){var _0x5073b4={'raw':!![],'where':{'id':_0x5138ec[_0x1870('0x47')]['id']}},_0x1c09e2={};_0x1c09e2[_0x1870('0x30')]=_[_0x1870('0x32')](db[_0x1870('0x2c')][_0x1870('0x2d')]);_0x1c09e2['query']=_[_0x1870('0x32')](_0x5138ec['query']);_0x1c09e2[_0x1870('0x3c')]=_[_0x1870('0x33')](_0x1c09e2[_0x1870('0x30')],_0x1c09e2[_0x1870('0x31')]);_0x5073b4['attributes']=_[_0x1870('0x33')](_0x1c09e2[_0x1870('0x30')],qs['fields'](_0x5138ec[_0x1870('0x31')][_0x1870('0x35')]));_0x5073b4['attributes']=_0x5073b4['attributes'][_0x1870('0x36')]?_0x5073b4['attributes']:_0x1c09e2[_0x1870('0x30')];if(_0x5138ec[_0x1870('0x31')]['includeAll']){_0x5073b4[_0x1870('0x41')]=[{'all':!![]}];}_0x5073b4=_['merge']({},_0x5073b4,_0x5138ec['options']);return db[_0x1870('0x2c')][_0x1870('0x48')](_0x5073b4)[_0x1870('0x44')](handleEntityNotFound(_0x383a5a,null))['then'](respondWithResult(_0x383a5a,null))[_0x1870('0x45')](handleError(_0x383a5a,null));};exports['create']=function(_0x15ccef,_0x4297fb){return db[_0x1870('0x2c')][_0x1870('0x49')](_0x15ccef[_0x1870('0x4a')],{})[_0x1870('0x44')](respondWithResult(_0x4297fb,0xc9))[_0x1870('0x45')](handleError(_0x4297fb,null));};exports['update']=function(_0x3a9b4c,_0x2dad65){if(_0x3a9b4c[_0x1870('0x4a')]['id']){delete _0x3a9b4c[_0x1870('0x4a')]['id'];}return db[_0x1870('0x2c')]['find']({'where':{'id':_0x3a9b4c[_0x1870('0x47')]['id']}})[_0x1870('0x44')](handleEntityNotFound(_0x2dad65,null))['then'](saveUpdates(_0x3a9b4c[_0x1870('0x4a')],null))[_0x1870('0x44')](respondWithResult(_0x2dad65,null))[_0x1870('0x45')](handleError(_0x2dad65,null));};exports['destroy']=function(_0x2d5a95,_0x450921){return db[_0x1870('0x2c')][_0x1870('0x48')]({'where':{'id':_0x2d5a95['params']['id']}})['then'](handleEntityNotFound(_0x450921,null))[_0x1870('0x44')](removeEntity(_0x450921,null))[_0x1870('0x45')](handleError(_0x450921,null));};exports[_0x1870('0x4b')]=function(_0x56e9cd,_0x3efe3b){return db[_0x1870('0x2c')][_0x1870('0x4b')]()[_0x1870('0x44')](respondWithResult(_0x3efe3b,null))['catch'](handleError(_0x3efe3b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 70b9ac5..4147671 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 _0x90c8=['moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5d7cf7,_0x783d86){var _0x48ffe2=function(_0x40274e){while(--_0x40274e){_0x5d7cf7['push'](_0x5d7cf7['shift']());}};_0x48ffe2(++_0x783d86);}(_0x90c8,0x1eb));var _0x890c=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x90c8[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x890c('0x0'));var util=require(_0x890c('0x1'));var logger=require(_0x890c('0x2'))(_0x890c('0x3'));var moment=require(_0x890c('0x4'));var BPromise=require(_0x890c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x890c('0x6'));var rimraf=require(_0x890c('0x7'));var config=require(_0x890c('0x8'));var attributes=require(_0x890c('0x9'));module[_0x890c('0xa')]=function(_0x1b1b10,_0x1adc15){return _0x1b1b10[_0x890c('0xb')](_0x890c('0xc'),attributes,{'tableName':_0x890c('0xd'),'paranoid':![],'indexes':[{'name':_0x890c('0xe'),'fields':[_0x890c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb0d=['../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','moment','bluebird','path','rimraf'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x5a24fc,_0x8d4266){_0x5a24fc=_0x5a24fc-0x0;var _0xe44766=_0xeb0d[_0x5a24fc];return _0xe44766;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdeb0('0x1'));var BPromise=require(_0xdeb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb0('0x3'));var rimraf=require(_0xdeb0('0x4'));var config=require(_0xdeb0('0x5'));var attributes=require(_0xdeb0('0x6'));module[_0xdeb0('0x7')]=function(_0x13d486,_0xc48108){return _0x13d486[_0xdeb0('0x8')]('SmsTransferReport',attributes,{'tableName':_0xdeb0('0x9'),'paranoid':![],'indexes':[{'name':_0xdeb0('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 d04c044..cb083d7 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 _0xe35c=['request','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe35c,0x146));var _0xce35=function(_0x1b3254,_0x310a7f){_0x1b3254=_0x1b3254-0x0;var _0x388744=_0xe35c[_0x1b3254];return _0x388744;};'use strict';var _=require(_0xce35('0x0'));var util=require(_0xce35('0x1'));var moment=require(_0xce35('0x2'));var BPromise=require(_0xce35('0x3'));var rs=require(_0xce35('0x4'));var fs=require('fs');var Redis=require(_0xce35('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce35('0x6'))('rpc');var config=require(_0xce35('0x7'));var jayson=require(_0xce35('0x8'));var client=jayson[_0xce35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x270b81,_0x2df0d0,_0x2b4a82){return new BPromise(function(_0x74ae5e,_0x55e7f0){return client[_0xce35('0xa')](_0x270b81,_0x2b4a82)['then'](function(_0x549f60){logger[_0xce35('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x2df0d0,'request\x20sent');logger[_0xce35('0xc')](_0xce35('0xd'),_0x2df0d0,_0xce35('0xe'),JSON[_0xce35('0xf')](_0x549f60));if(_0x549f60[_0xce35('0x10')]){if(_0x549f60['error']['code']===0x1f4){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);return _0x55e7f0(_0x549f60[_0xce35('0x10')]['message']);}logger['error'](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')]['message']);return _0x74ae5e(_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);}else{logger[_0xce35('0xb')](_0xce35('0x11'),_0x2df0d0,_0xce35('0xe'));_0x74ae5e(_0x549f60[_0xce35('0x13')][_0xce35('0x12')]);}})[_0xce35('0x14')](function(_0x4388fd){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x4388fd);_0x55e7f0(_0x4388fd);});});} \ No newline at end of file +var _0x8255=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','info','SmsTransferReport,\x20%s,\x20%s','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8255,0x176));var _0x5825=function(_0x3d68ca,_0x3184ce){_0x3d68ca=_0x3d68ca-0x0;var _0x50cd11=_0x8255[_0x3d68ca];return _0x50cd11;};'use strict';var _=require(_0x5825('0x0'));var util=require(_0x5825('0x1'));var moment=require(_0x5825('0x2'));var BPromise=require(_0x5825('0x3'));var rs=require(_0x5825('0x4'));var fs=require('fs');var Redis=require(_0x5825('0x5'));var db=require(_0x5825('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5825('0x7'));var jayson=require(_0x5825('0x8'));var client=jayson[_0x5825('0x9')][_0x5825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x383a49,_0x3415c5,_0x27d87e){return new BPromise(function(_0x577974,_0x4975de){return client[_0x5825('0xb')](_0x383a49,_0x27d87e)[_0x5825('0xc')](function(_0x754d99){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x5825('0xd'));logger[_0x5825('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3415c5,_0x5825('0xd'),JSON[_0x5825('0xf')](_0x754d99));if(_0x754d99['error']){if(_0x754d99[_0x5825('0x10')][_0x5825('0x11')]===0x1f4){logger[_0x5825('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x754d99['error'][_0x5825('0x12')]);return _0x4975de(_0x754d99[_0x5825('0x10')][_0x5825('0x12')]);}logger[_0x5825('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x754d99[_0x5825('0x10')]['message']);return _0x577974(_0x754d99[_0x5825('0x10')][_0x5825('0x12')]);}else{logger[_0x5825('0x13')](_0x5825('0x14'),_0x3415c5,_0x5825('0xd'));_0x577974(_0x754d99['result']['message']);}})[_0x5825('0x15')](function(_0x38cd22){logger[_0x5825('0x10')](_0x5825('0x14'),_0x3415c5,_0x38cd22);_0x4975de(_0x38cd22);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 359d172..c5bb412 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 _0x3aba=['isAuthenticated','index','/:id','show','download','join','server/files/sounds/original/','originalname','basename','now','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x3aba,0x82));var _0xa3ab=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0x3aba[_0x7a3247];return _0x1bfde5;};'use strict';var multer=require(_0xa3ab('0x0'));var util=require(_0xa3ab('0x1'));var path=require(_0xa3ab('0x2'));var timeout=require(_0xa3ab('0x3'));var express=require(_0xa3ab('0x4'));var router=express['Router']();var fs_extra=require(_0xa3ab('0x5'));var auth=require(_0xa3ab('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa3ab('0x7'));var controller=require(_0xa3ab('0x8'));router[_0xa3ab('0x9')]('/',auth[_0xa3ab('0xa')](),controller[_0xa3ab('0xb')]);router[_0xa3ab('0x9')](_0xa3ab('0xc'),auth[_0xa3ab('0xa')](),controller[_0xa3ab('0xd')]);router[_0xa3ab('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xa3ab('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x414046,_0x176b65,_0x48c1ee){_0x48c1ee(null,path[_0xa3ab('0xf')](config['root'],_0xa3ab('0x10')));},'filename':function(_0x23c035,_0x110b9e,_0x124c51){_0x110b9e[_0xa3ab('0x11')]=_0x110b9e[_0xa3ab('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x124c51(null,util['format']('%s-%s%s',path[_0xa3ab('0x12')](_0x110b9e[_0xa3ab('0x11')],path['extname'](_0x110b9e['originalname'])),Date[_0xa3ab('0x13')](),path['extname'](_0x110b9e[_0xa3ab('0x11')])));}})});router[_0xa3ab('0x14')]('/',upload[_0xa3ab('0x15')](_0xa3ab('0x16')),controller[_0xa3ab('0x17')]);router[_0xa3ab('0x18')]('/:id',auth[_0xa3ab('0xa')](),controller[_0xa3ab('0x19')]);router[_0xa3ab('0x1a')](_0xa3ab('0xc'),auth[_0xa3ab('0xa')](),controller[_0xa3ab('0x1a')]);module[_0xa3ab('0x1b')]=router; \ No newline at end of file +var _0xfb50=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','now','post','single','file','create','put','delete','exports','multer','util','connect-timeout'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xfb50,0xfd));var _0x0fb5=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xfb50[_0x2a56ad];return _0x425175;};'use strict';var multer=require(_0x0fb5('0x0'));var util=require(_0x0fb5('0x1'));var path=require('path');var timeout=require(_0x0fb5('0x2'));var express=require(_0x0fb5('0x3'));var router=express[_0x0fb5('0x4')]();var fs_extra=require(_0x0fb5('0x5'));var auth=require(_0x0fb5('0x6'));var interaction=require(_0x0fb5('0x7'));var config=require(_0x0fb5('0x8'));var controller=require(_0x0fb5('0x9'));router[_0x0fb5('0xa')]('/',auth[_0x0fb5('0xb')](),controller['index']);router['get'](_0x0fb5('0xc'),auth[_0x0fb5('0xb')](),controller[_0x0fb5('0xd')]);router['get'](_0x0fb5('0xe'),auth['isAuthenticated'](),controller[_0x0fb5('0xf')]);var upload=multer({'storage':multer[_0x0fb5('0x10')]({'destination':function(_0x527e0f,_0x357479,_0x19d501){_0x19d501(null,path[_0x0fb5('0x11')](config[_0x0fb5('0x12')],_0x0fb5('0x13')));},'filename':function(_0x1a064b,_0x3017a3,_0x30ede8){_0x3017a3[_0x0fb5('0x14')]=_0x3017a3[_0x0fb5('0x14')][_0x0fb5('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x30ede8(null,util['format'](_0x0fb5('0x16'),path['basename'](_0x3017a3[_0x0fb5('0x14')],path[_0x0fb5('0x17')](_0x3017a3[_0x0fb5('0x14')])),Date[_0x0fb5('0x18')](),path[_0x0fb5('0x17')](_0x3017a3['originalname'])));}})});router[_0x0fb5('0x19')]('/',upload[_0x0fb5('0x1a')](_0x0fb5('0x1b')),controller[_0x0fb5('0x1c')]);router[_0x0fb5('0x1d')](_0x0fb5('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0fb5('0xc'),auth[_0x0fb5('0xb')](),controller[_0x0fb5('0x1e')]);module[_0x0fb5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 0da8b44..3efef1e 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 _0xc7e9=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x58707c,_0x329446){var _0x4765dc=function(_0x4fa42e){while(--_0x4fa42e){_0x58707c['push'](_0x58707c['shift']());}};_0x4765dc(++_0x329446);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xc7e9[_0x5627e1];return _0x2f013f;};'use strict';var Sequelize=require(_0x9c7e('0x0'));module[_0x9c7e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c7e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9c7e('0x3')]},'display_name':{'type':Sequelize[_0x9c7e('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x9c7e('0x3')]},'original_duration':{'type':Sequelize[_0x9c7e('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x9c7e('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x9c7e('0x3')]},'converted_duration':{'type':Sequelize[_0x9c7e('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x9c7e('0x5')]},'converted_channelCount':{'type':Sequelize[_0x9c7e('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x9c7e('0x6')]}}; \ No newline at end of file +var _0xc6ec=['BIGINT','INTEGER','STRING','name','FLOAT'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0xc6ec,0x1ba));var _0xcc6e=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xc6ec[_0x5dc03e];return _0x466a07;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcc6e('0x0')],'unique':_0xcc6e('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcc6e('0x0')]},'display_name':{'type':Sequelize[_0xcc6e('0x0')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xcc6e('0x0')]},'original_duration':{'type':Sequelize[_0xcc6e('0x2')]},'original_sampleCount':{'type':Sequelize[_0xcc6e('0x3')]},'original_channelCount':{'type':Sequelize[_0xcc6e('0x4')]},'original_bitRate':{'type':Sequelize[_0xcc6e('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xcc6e('0x0')]},'converted_duration':{'type':Sequelize[_0xcc6e('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xcc6e('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xcc6e('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xcc6e('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 76f379d..92de6f4 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 _0xc353=['root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','join','format','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','start','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get','Sounds','UserProfileResource','error','name','send','map','Sound','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','length','find','download','converted_format','existsSync'];(function(_0x3eb28d,_0x2fb93e){var _0x44a424=function(_0x935b10){while(--_0x935b10){_0x3eb28d['push'](_0x3eb28d['shift']());}};_0x44a424(++_0x2fb93e);}(_0xc353,0x134));var _0x3c35=function(_0x5ac707,_0x106792){_0x5ac707=_0x5ac707-0x0;var _0x11451b=_0xc353[_0x5ac707];return _0x11451b;};'use strict';var emlformat=require(_0x3c35('0x0'));var rimraf=require(_0x3c35('0x1'));var zipdir=require(_0x3c35('0x2'));var jsonpatch=require(_0x3c35('0x3'));var rp=require(_0x3c35('0x4'));var moment=require(_0x3c35('0x5'));var BPromise=require(_0x3c35('0x6'));var Mustache=require(_0x3c35('0x7'));var util=require(_0x3c35('0x8'));var path=require(_0x3c35('0x9'));var sox=require(_0x3c35('0xa'));var csv=require('to-csv');var ejs=require(_0x3c35('0xb'));var fs=require('fs');var fs_extra=require(_0x3c35('0xc'));var _=require(_0x3c35('0xd'));var squel=require(_0x3c35('0xe'));var crypto=require(_0x3c35('0xf'));var jsforce=require(_0x3c35('0x10'));var deskjs=require(_0x3c35('0x11'));var toCsv=require(_0x3c35('0x12'));var querystring=require(_0x3c35('0x13'));var Papa=require(_0x3c35('0x14'));var Redis=require(_0x3c35('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x3c35('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c35('0x17'));var logger=require(_0x3c35('0x18'))(_0x3c35('0x19'));var utils=require(_0x3c35('0x1a'));var config=require(_0x3c35('0x1b'));var licenseUtil=require(_0x3c35('0x1c'));var db=require(_0x3c35('0x1d'))['db'];function respondWithStatusCode(_0x5ad412,_0x5d4d01){_0x5d4d01=_0x5d4d01||0xcc;return function(_0x544814){if(_0x544814){return _0x5ad412[_0x3c35('0x1e')](_0x5d4d01);}return _0x5ad412[_0x3c35('0x1f')](_0x5d4d01)[_0x3c35('0x20')]();};}function respondWithResult(_0x2c8407,_0x1d5497){_0x1d5497=_0x1d5497||0xc8;return function(_0xd11e56){if(_0xd11e56){return _0x2c8407[_0x3c35('0x1f')](_0x1d5497)[_0x3c35('0x21')](_0xd11e56);}};}function respondWithFilteredResult(_0x179950,_0x503946){return function(_0x1b25c2){if(_0x1b25c2){var _0x1eb897=typeof _0x503946[_0x3c35('0x22')]===_0x3c35('0x23')&&typeof _0x503946['limit']===_0x3c35('0x23');var _0x46cbc4=_0x1b25c2[_0x3c35('0x24')];var _0x8d708=_0x1eb897?0x0:_0x503946['offset'];var _0x30d9f8=_0x1eb897?_0x1b25c2[_0x3c35('0x24')]:_0x503946['offset']+_0x503946['limit'];var _0x2cffaf;if(_0x30d9f8>=_0x46cbc4){_0x30d9f8=_0x46cbc4;_0x2cffaf=0xc8;}else{_0x2cffaf=0xce;}_0x179950[_0x3c35('0x1f')](_0x2cffaf);return _0x179950[_0x3c35('0x25')](_0x3c35('0x26'),_0x8d708+'-'+_0x30d9f8+'/'+_0x46cbc4)[_0x3c35('0x21')](_0x1b25c2);}return null;};}function patchUpdates(_0x561b38){return function(_0x275b8e){try{jsonpatch[_0x3c35('0x27')](_0x275b8e,_0x561b38,!![]);}catch(_0x420f63){return BPromise[_0x3c35('0x28')](_0x420f63);}return _0x275b8e['save']();};}function saveUpdates(_0x3ce200,_0x36aac0){return function(_0x443346){if(_0x443346){return _0x443346[_0x3c35('0x29')](_0x3ce200)['then'](function(_0x1b1f6c){return _0x1b1f6c;});}return null;};}function removeEntity(_0x9e45ae,_0x1867c9){return function(_0x44a4fc){if(_0x44a4fc){return _0x44a4fc[_0x3c35('0x2a')]()[_0x3c35('0x2b')](function(){var _0x1253df=_0x44a4fc[_0x3c35('0x2c')]({'plain':!![]});var _0x1a0167=_0x3c35('0x2d');return db[_0x3c35('0x2e')][_0x3c35('0x2a')]({'where':{'type':_0x1a0167,'resourceId':_0x1253df['id']}})[_0x3c35('0x2b')](function(){return _0x44a4fc;});})[_0x3c35('0x2b')](function(){_0x9e45ae['status'](0xcc)[_0x3c35('0x20')]();});}};}function handleEntityNotFound(_0x28c091,_0x4c1b43){return function(_0x13631b){if(!_0x13631b){_0x28c091[_0x3c35('0x1e')](0x194);}return _0x13631b;};}function handleError(_0x5e3032,_0x91fe98){_0x91fe98=_0x91fe98||0x1f4;return function(_0x46a92d){logger[_0x3c35('0x2f')](_0x46a92d['stack']);if(_0x46a92d[_0x3c35('0x30')]){delete _0x46a92d[_0x3c35('0x30')];}_0x5e3032[_0x3c35('0x1f')](_0x91fe98)[_0x3c35('0x31')](_0x46a92d);};}exports['index']=function(_0x546133,_0x5f434e){var _0x20c65c={},_0x29c81e={},_0x4b73f3={'count':0x0,'rows':[]};var _0x3ddbbf=_[_0x3c35('0x32')](db[_0x3c35('0x33')][_0x3c35('0x34')],function(_0x345baa){return{'name':_0x345baa[_0x3c35('0x35')],'type':_0x345baa[_0x3c35('0x36')][_0x3c35('0x37')]};});_0x29c81e[_0x3c35('0x38')]=_[_0x3c35('0x32')](_0x3ddbbf,_0x3c35('0x30'));_0x29c81e['query']=_[_0x3c35('0x39')](_0x546133[_0x3c35('0x3a')]);_0x29c81e['filters']=_[_0x3c35('0x3b')](_0x29c81e['model'],_0x29c81e[_0x3c35('0x3a')]);_0x20c65c['attributes']=_['intersection'](_0x29c81e['model'],qs[_0x3c35('0x3c')](_0x546133[_0x3c35('0x3a')][_0x3c35('0x3c')]));_0x20c65c[_0x3c35('0x3d')]=_0x20c65c['attributes']['length']?_0x20c65c[_0x3c35('0x3d')]:_0x29c81e[_0x3c35('0x38')];if(!_0x546133[_0x3c35('0x3a')][_0x3c35('0x3e')](_0x3c35('0x3f'))){_0x20c65c[_0x3c35('0x40')]=qs[_0x3c35('0x40')](_0x546133[_0x3c35('0x3a')][_0x3c35('0x40')]);_0x20c65c[_0x3c35('0x22')]=qs['offset'](_0x546133[_0x3c35('0x3a')][_0x3c35('0x22')]);}_0x20c65c[_0x3c35('0x41')]=qs[_0x3c35('0x42')](_0x546133[_0x3c35('0x3a')][_0x3c35('0x42')]);_0x20c65c[_0x3c35('0x43')]=qs['filters'](_[_0x3c35('0x44')](_0x546133[_0x3c35('0x3a')],_0x29c81e['filters']),_0x3ddbbf);if(_0x546133[_0x3c35('0x3a')][_0x3c35('0x45')]){_0x20c65c[_0x3c35('0x43')]=_[_0x3c35('0x46')](_0x20c65c[_0x3c35('0x43')],{'$or':_[_0x3c35('0x32')](_0x3ddbbf,function(_0xe5e8e7){if(_0xe5e8e7['type']!=='VIRTUAL'){var _0x59d2e7={};_0x59d2e7[_0xe5e8e7[_0x3c35('0x30')]]={'$like':'%'+_0x546133[_0x3c35('0x3a')]['filter']+'%'};return _0x59d2e7;}})});}_0x20c65c=_[_0x3c35('0x46')]({},_0x20c65c,_0x546133['options']);var _0x540696={'where':_0x20c65c[_0x3c35('0x43')]};return db['Sound']['count'](_0x540696)['then'](function(_0x323384){_0x4b73f3[_0x3c35('0x24')]=_0x323384;if(_0x546133[_0x3c35('0x3a')][_0x3c35('0x47')]){_0x20c65c[_0x3c35('0x48')]=[{'all':!![]}];}return db['Sound'][_0x3c35('0x49')](_0x20c65c);})[_0x3c35('0x2b')](function(_0x29f6fb){_0x4b73f3['rows']=_0x29f6fb;return _0x4b73f3;})['then'](respondWithFilteredResult(_0x5f434e,_0x20c65c))[_0x3c35('0x4a')](handleError(_0x5f434e,null));};exports[_0x3c35('0x4b')]=function(_0x2177f7,_0x4dfb19){var _0x5e6f09={'raw':!![],'where':{'id':_0x2177f7[_0x3c35('0x4c')]['id']}},_0x1106eb={};_0x1106eb[_0x3c35('0x38')]=_[_0x3c35('0x39')](db[_0x3c35('0x33')][_0x3c35('0x34')]);_0x1106eb[_0x3c35('0x3a')]=_[_0x3c35('0x39')](_0x2177f7['query']);_0x1106eb['filters']=_[_0x3c35('0x3b')](_0x1106eb[_0x3c35('0x38')],_0x1106eb[_0x3c35('0x3a')]);_0x5e6f09['attributes']=_[_0x3c35('0x3b')](_0x1106eb['model'],qs[_0x3c35('0x3c')](_0x2177f7['query'][_0x3c35('0x3c')]));_0x5e6f09['attributes']=_0x5e6f09[_0x3c35('0x3d')][_0x3c35('0x4d')]?_0x5e6f09[_0x3c35('0x3d')]:_0x1106eb[_0x3c35('0x38')];if(_0x2177f7['query'][_0x3c35('0x47')]){_0x5e6f09[_0x3c35('0x48')]=[{'all':!![]}];}_0x5e6f09=_[_0x3c35('0x46')]({},_0x5e6f09,_0x2177f7['options']);return db[_0x3c35('0x33')][_0x3c35('0x4e')](_0x5e6f09)[_0x3c35('0x2b')](handleEntityNotFound(_0x4dfb19,null))[_0x3c35('0x2b')](respondWithResult(_0x4dfb19,null))[_0x3c35('0x4a')](handleError(_0x4dfb19,null));};exports[_0x3c35('0x4f')]=function(_0x5445e0,_0x244176,_0x5b1469){return db[_0x3c35('0x33')][_0x3c35('0x4e')]({'where':{'id':_0x5445e0['params']['id']},'attributes':['name','save_name',_0x3c35('0x50')],'raw':!![]})[_0x3c35('0x2b')](handleEntityNotFound(_0x244176,null))[_0x3c35('0x2b')](function(_0x1770e0){if(_0x1770e0){if(!fs[_0x3c35('0x51')](path['join'](config[_0x3c35('0x52')],_0x3c35('0x53'),_0x1770e0[_0x3c35('0x54')]+'.'+_0x1770e0[_0x3c35('0x50')]))){throw new db[(_0x3c35('0x55'))][(_0x3c35('0x56'))](_0x3c35('0x57'));}return _0x244176[_0x3c35('0x4f')](path[_0x3c35('0x58')](config['root'],_0x3c35('0x53'),util['format']('%s.%s',_0x1770e0[_0x3c35('0x54')],_0x1770e0['converted_format'])),util[_0x3c35('0x59')]('%s.%s',_0x1770e0[_0x3c35('0x30')],_0x1770e0[_0x3c35('0x50')]));}return null;})[_0x3c35('0x4a')](handleError(_0x244176,null));};exports[_0x3c35('0x5a')]=function(_0x10bbdc,_0x56dcd4,_0x38835c){var _0x14ae5a={'name':path[_0x3c35('0x5b')](_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5d')],path[_0x3c35('0x5e')](_0x10bbdc[_0x3c35('0x5c')]['originalname'])),'save_name':path[_0x3c35('0x5b')](_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5f')],path['extname'](_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5f')])),'original_format':path[_0x3c35('0x5e')](_0x10bbdc[_0x3c35('0x5c')]['originalname'])[_0x3c35('0x60')](0x1),'converted_format':'wav'};var _0x4230a7=path['join'](config[_0x3c35('0x52')],_0x3c35('0x61'),_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5f')]);var _0x5e14dc=path[_0x3c35('0x58')](config[_0x3c35('0x52')],_0x3c35('0x53'),util[_0x3c35('0x59')](_0x3c35('0x62'),path['basename'](_0x10bbdc[_0x3c35('0x5c')][_0x3c35('0x5f')],path[_0x3c35('0x5e')](_0x10bbdc[_0x3c35('0x5c')]['filename'])),_0x14ae5a['converted_format']));logger[_0x3c35('0x63')](_0x3c35('0x64'),_0x4230a7);logger[_0x3c35('0x63')](_0x3c35('0x65'),_0x5e14dc);try{fs[_0x3c35('0x66')](_0x4230a7,parseInt(_0x3c35('0x67'),0x8));var _0x26ddb3=sox['transcode'](_0x4230a7,_0x5e14dc,{'sampleRate':0x1f40,'format':_0x3c35('0x68'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x26ddb3['on']('error',function(_0x32c7eb){fs['unlinkSync'](_0x4230a7);_0x56dcd4[_0x3c35('0x1f')](0x1f4)[_0x3c35('0x31')](_0x32c7eb);});_0x26ddb3['on'](_0x3c35('0x69'),function(_0x3a8408){_0x14ae5a['original_duration']=isNaN(_0x3a8408[_0x3c35('0x6a')])?null:_0x3a8408[_0x3c35('0x6a')]*0x3e8;_0x14ae5a['original_sampleCount']=isNaN(_0x3a8408['sampleCount'])?null:_0x3a8408[_0x3c35('0x6b')];_0x14ae5a[_0x3c35('0x6c')]=isNaN(_0x3a8408[_0x3c35('0x6d')])?null:_0x3a8408['channelCount'];_0x14ae5a[_0x3c35('0x6e')]=isNaN(_0x3a8408[_0x3c35('0x6f')])?null:_0x3a8408[_0x3c35('0x6f')];_0x14ae5a['original_sampleRate']=isNaN(_0x3a8408[_0x3c35('0x70')])?null:_0x3a8408[_0x3c35('0x70')];});_0x26ddb3['on'](_0x3c35('0x71'),function(_0x8a107b){_0x14ae5a[_0x3c35('0x72')]=isNaN(_0x8a107b[_0x3c35('0x6a')])?null:_0x8a107b[_0x3c35('0x6a')]*0x3e8;_0x14ae5a[_0x3c35('0x73')]=isNaN(_0x8a107b[_0x3c35('0x6b')])?null:_0x8a107b[_0x3c35('0x6b')];_0x14ae5a[_0x3c35('0x74')]=isNaN(_0x8a107b['channelCount'])?null:_0x8a107b[_0x3c35('0x6d')];_0x14ae5a[_0x3c35('0x75')]=isNaN(_0x8a107b['bitRate'])?null:_0x8a107b['bitRate'];_0x14ae5a[_0x3c35('0x76')]=isNaN(_0x8a107b[_0x3c35('0x70')])?null:_0x8a107b[_0x3c35('0x70')];});_0x26ddb3['on']('end',function(){fs[_0x3c35('0x66')](_0x5e14dc,parseInt(_0x3c35('0x67'),0x8));return db[_0x3c35('0x33')][_0x3c35('0x5a')](_0x14ae5a)[_0x3c35('0x2b')](function(_0x5caadc){var _0x40b96a={'role':_0x10bbdc[_0x3c35('0x77')][_0x3c35('0x78')],'userProfileId':_0x10bbdc['body'][_0x3c35('0x79')]};if(!_0x40b96a)throw new Error(_0x3c35('0x7a'));if(_0x40b96a[_0x3c35('0x78')]===_0x3c35('0x7b')){var _0x538f1e=_0x5caadc[_0x3c35('0x2c')]({'plain':!![]});return db[_0x3c35('0x7c')][_0x3c35('0x4e')]({'where':{'name':_0x3c35('0x2d'),'userProfileId':_0x40b96a['userProfileId']},'raw':!![]})['then'](function(_0x30aa3d){if(_0x30aa3d&&_0x30aa3d['autoAssociation']===0x0){return db[_0x3c35('0x2e')][_0x3c35('0x5a')]({'name':_0x538f1e[_0x3c35('0x30')],'resourceId':_0x538f1e['id'],'type':_0x30aa3d[_0x3c35('0x30')],'sectionId':_0x30aa3d['id']},{})[_0x3c35('0x2b')](function(){return _0x5caadc;});}else{return _0x5caadc;}})[_0x3c35('0x4a')](function(_0x8f2797){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8f2797);throw _0x8f2797;});}return _0x5caadc;})[_0x3c35('0x2b')](respondWithResult(_0x56dcd4,null))['catch'](handleError(_0x56dcd4,null));});_0x26ddb3[_0x3c35('0x7d')]();}catch(_0x3e0d14){_0x56dcd4[_0x3c35('0x1f')](0x1f4)[_0x3c35('0x31')](_0x3e0d14);}};exports[_0x3c35('0x29')]=function(_0xdc2969,_0x23c74b,_0x2458fe){return db['Sound']['find']({'where':{'id':_0xdc2969[_0x3c35('0x4c')]['id']}})[_0x3c35('0x2b')](handleEntityNotFound(_0x23c74b,null))[_0x3c35('0x2b')](saveUpdates(_['pick'](_0xdc2969[_0x3c35('0x77')],['name',_0x3c35('0x7e')]),null))[_0x3c35('0x2b')](respondWithResult(_0x23c74b,null))['catch'](handleError(_0x23c74b,null));};exports[_0x3c35('0x7f')]=function(_0x15fd80,_0x4d4897,_0x5d1335){return db[_0x3c35('0x33')]['find']({'where':{'id':_0x15fd80['params']['id']}})[_0x3c35('0x2b')](function(_0x34119f){if(_0x34119f){return _0x34119f[_0x3c35('0x2a')]();}})['then'](function(_0x234605){var _0x35e9a6=path[_0x3c35('0x58')](config[_0x3c35('0x52')],_0x3c35('0x61'),util[_0x3c35('0x59')](_0x3c35('0x62'),_0x234605[_0x3c35('0x54')],_0x234605[_0x3c35('0x80')]));var _0xe24f5e=path[_0x3c35('0x58')](config['root'],_0x3c35('0x53'),util[_0x3c35('0x59')](_0x3c35('0x62'),_0x234605[_0x3c35('0x54')],_0x234605[_0x3c35('0x50')]));fs[_0x3c35('0x81')](_0x35e9a6);fs['unlinkSync'](_0xe24f5e);return _0x234605;})['then'](function(_0x40a7bb){if(_0x40a7bb){return _0x4d4897[_0x3c35('0x1f')](0xcc)[_0x3c35('0x20')]();}})[_0x3c35('0x2b')](handleEntityNotFound(_0x4d4897,null))['catch'](handleError(_0x4d4897,null));}; \ No newline at end of file +var _0x103f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','fieldName','type','key','model','query','keys','attributes','intersection','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','fields','length','includeAll','find','download','save_name','converted_format','join','root','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','channelCount','converted_sampleRate','0777','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','server/files/sounds/original','original_format','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x103f,0x175));var _0xf103=function(_0x555b75,_0x4109e6){_0x555b75=_0x555b75-0x0;var _0x2d9b1b=_0x103f[_0x555b75];return _0x2d9b1b;};'use strict';var emlformat=require(_0xf103('0x0'));var rimraf=require(_0xf103('0x1'));var zipdir=require(_0xf103('0x2'));var jsonpatch=require(_0xf103('0x3'));var rp=require(_0xf103('0x4'));var moment=require(_0xf103('0x5'));var BPromise=require(_0xf103('0x6'));var Mustache=require(_0xf103('0x7'));var util=require(_0xf103('0x8'));var path=require(_0xf103('0x9'));var sox=require(_0xf103('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf103('0xb'));var _=require(_0xf103('0xc'));var squel=require(_0xf103('0xd'));var crypto=require(_0xf103('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf103('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf103('0x10'));var Papa=require(_0xf103('0x11'));var Redis=require(_0xf103('0x12'));var authService=require(_0xf103('0x13'));var qs=require(_0xf103('0x14'));var as=require(_0xf103('0x15'));var hardwareService=require(_0xf103('0x16'));var logger=require(_0xf103('0x17'))(_0xf103('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf103('0x19'));var db=require(_0xf103('0x1a'))['db'];function respondWithStatusCode(_0x454330,_0x5832c6){_0x5832c6=_0x5832c6||0xcc;return function(_0x1ca680){if(_0x1ca680){return _0x454330[_0xf103('0x1b')](_0x5832c6);}return _0x454330[_0xf103('0x1c')](_0x5832c6)[_0xf103('0x1d')]();};}function respondWithResult(_0x1d6513,_0x3a7557){_0x3a7557=_0x3a7557||0xc8;return function(_0x340dd9){if(_0x340dd9){return _0x1d6513[_0xf103('0x1c')](_0x3a7557)[_0xf103('0x1e')](_0x340dd9);}};}function respondWithFilteredResult(_0x3238ad,_0x57ca8e){return function(_0x984c57){if(_0x984c57){var _0x5a702f=typeof _0x57ca8e[_0xf103('0x1f')]==='undefined'&&typeof _0x57ca8e['limit']===_0xf103('0x20');var _0x526377=_0x984c57[_0xf103('0x21')];var _0x2caaf4=_0x5a702f?0x0:_0x57ca8e[_0xf103('0x1f')];var _0x318e85=_0x5a702f?_0x984c57['count']:_0x57ca8e[_0xf103('0x1f')]+_0x57ca8e[_0xf103('0x22')];var _0x264222;if(_0x318e85>=_0x526377){_0x318e85=_0x526377;_0x264222=0xc8;}else{_0x264222=0xce;}_0x3238ad[_0xf103('0x1c')](_0x264222);return _0x3238ad['set'](_0xf103('0x23'),_0x2caaf4+'-'+_0x318e85+'/'+_0x526377)['json'](_0x984c57);}return null;};}function patchUpdates(_0x237795){return function(_0x46a2bf){try{jsonpatch['apply'](_0x46a2bf,_0x237795,!![]);}catch(_0x8bdd10){return BPromise['reject'](_0x8bdd10);}return _0x46a2bf['save']();};}function saveUpdates(_0x275b16,_0x4a4488){return function(_0x144e02){if(_0x144e02){return _0x144e02[_0xf103('0x24')](_0x275b16)[_0xf103('0x25')](function(_0x3481a8){return _0x3481a8;});}return null;};}function removeEntity(_0xea713c,_0x4833da){return function(_0x58b1e9){if(_0x58b1e9){return _0x58b1e9['destroy']()['then'](function(){var _0x3df5c6=_0x58b1e9[_0xf103('0x26')]({'plain':!![]});var _0x537cb9=_0xf103('0x27');return db[_0xf103('0x28')][_0xf103('0x29')]({'where':{'type':_0x537cb9,'resourceId':_0x3df5c6['id']}})[_0xf103('0x25')](function(){return _0x58b1e9;});})['then'](function(){_0xea713c['status'](0xcc)[_0xf103('0x1d')]();});}};}function handleEntityNotFound(_0x794863,_0x567c22){return function(_0x48180d){if(!_0x48180d){_0x794863[_0xf103('0x1b')](0x194);}return _0x48180d;};}function handleError(_0x34651d,_0x195a72){_0x195a72=_0x195a72||0x1f4;return function(_0x515738){logger[_0xf103('0x2a')](_0x515738[_0xf103('0x2b')]);if(_0x515738[_0xf103('0x2c')]){delete _0x515738['name'];}_0x34651d['status'](_0x195a72)[_0xf103('0x2d')](_0x515738);};}exports[_0xf103('0x2e')]=function(_0x43be61,_0x247fe1){var _0x1f648b={},_0x571a53={},_0x17d2af={'count':0x0,'rows':[]};var _0x312640=_[_0xf103('0x2f')](db[_0xf103('0x30')]['rawAttributes'],function(_0x4a0757){return{'name':_0x4a0757[_0xf103('0x31')],'type':_0x4a0757[_0xf103('0x32')][_0xf103('0x33')]};});_0x571a53[_0xf103('0x34')]=_['map'](_0x312640,_0xf103('0x2c'));_0x571a53[_0xf103('0x35')]=_[_0xf103('0x36')](_0x43be61[_0xf103('0x35')]);_0x571a53['filters']=_['intersection'](_0x571a53[_0xf103('0x34')],_0x571a53[_0xf103('0x35')]);_0x1f648b[_0xf103('0x37')]=_[_0xf103('0x38')](_0x571a53[_0xf103('0x34')],qs['fields'](_0x43be61[_0xf103('0x35')]['fields']));_0x1f648b[_0xf103('0x37')]=_0x1f648b[_0xf103('0x37')]['length']?_0x1f648b[_0xf103('0x37')]:_0x571a53[_0xf103('0x34')];if(!_0x43be61[_0xf103('0x35')][_0xf103('0x39')]('nolimit')){_0x1f648b['limit']=qs[_0xf103('0x22')](_0x43be61['query'][_0xf103('0x22')]);_0x1f648b[_0xf103('0x1f')]=qs[_0xf103('0x1f')](_0x43be61[_0xf103('0x35')]['offset']);}_0x1f648b['order']=qs['sort'](_0x43be61[_0xf103('0x35')][_0xf103('0x3a')]);_0x1f648b[_0xf103('0x3b')]=qs[_0xf103('0x3c')](_[_0xf103('0x3d')](_0x43be61[_0xf103('0x35')],_0x571a53['filters']),_0x312640);if(_0x43be61[_0xf103('0x35')][_0xf103('0x3e')]){_0x1f648b[_0xf103('0x3b')]=_[_0xf103('0x3f')](_0x1f648b[_0xf103('0x3b')],{'$or':_[_0xf103('0x2f')](_0x312640,function(_0x767f8b){if(_0x767f8b['type']!==_0xf103('0x40')){var _0x4fbacd={};_0x4fbacd[_0x767f8b['name']]={'$like':'%'+_0x43be61[_0xf103('0x35')][_0xf103('0x3e')]+'%'};return _0x4fbacd;}})});}_0x1f648b=_[_0xf103('0x3f')]({},_0x1f648b,_0x43be61[_0xf103('0x41')]);var _0x5d1686={'where':_0x1f648b['where']};return db[_0xf103('0x30')][_0xf103('0x21')](_0x5d1686)[_0xf103('0x25')](function(_0x382f35){_0x17d2af[_0xf103('0x21')]=_0x382f35;if(_0x43be61[_0xf103('0x35')]['includeAll']){_0x1f648b[_0xf103('0x42')]=[{'all':!![]}];}return db['Sound'][_0xf103('0x43')](_0x1f648b);})[_0xf103('0x25')](function(_0x233fa1){_0x17d2af[_0xf103('0x44')]=_0x233fa1;return _0x17d2af;})[_0xf103('0x25')](respondWithFilteredResult(_0x247fe1,_0x1f648b))[_0xf103('0x45')](handleError(_0x247fe1,null));};exports[_0xf103('0x46')]=function(_0x463cee,_0xdb02df){var _0x370524={'raw':!![],'where':{'id':_0x463cee[_0xf103('0x47')]['id']}},_0x568252={};_0x568252[_0xf103('0x34')]=_[_0xf103('0x36')](db[_0xf103('0x30')][_0xf103('0x48')]);_0x568252['query']=_[_0xf103('0x36')](_0x463cee[_0xf103('0x35')]);_0x568252[_0xf103('0x3c')]=_[_0xf103('0x38')](_0x568252[_0xf103('0x34')],_0x568252['query']);_0x370524[_0xf103('0x37')]=_[_0xf103('0x38')](_0x568252[_0xf103('0x34')],qs[_0xf103('0x49')](_0x463cee[_0xf103('0x35')][_0xf103('0x49')]));_0x370524[_0xf103('0x37')]=_0x370524[_0xf103('0x37')][_0xf103('0x4a')]?_0x370524['attributes']:_0x568252[_0xf103('0x34')];if(_0x463cee[_0xf103('0x35')][_0xf103('0x4b')]){_0x370524[_0xf103('0x42')]=[{'all':!![]}];}_0x370524=_[_0xf103('0x3f')]({},_0x370524,_0x463cee[_0xf103('0x41')]);return db[_0xf103('0x30')][_0xf103('0x4c')](_0x370524)[_0xf103('0x25')](handleEntityNotFound(_0xdb02df,null))['then'](respondWithResult(_0xdb02df,null))[_0xf103('0x45')](handleError(_0xdb02df,null));};exports[_0xf103('0x4d')]=function(_0x58fa73,_0x16f53d,_0xaec4b9){return db[_0xf103('0x30')][_0xf103('0x4c')]({'where':{'id':_0x58fa73[_0xf103('0x47')]['id']},'attributes':['name',_0xf103('0x4e'),_0xf103('0x4f')],'raw':!![]})[_0xf103('0x25')](handleEntityNotFound(_0x16f53d,null))['then'](function(_0xa50dac){if(_0xa50dac){if(!fs['existsSync'](path[_0xf103('0x50')](config[_0xf103('0x51')],'server/files/sounds/converted',_0xa50dac[_0xf103('0x4e')]+'.'+_0xa50dac[_0xf103('0x4f')]))){throw new db[(_0xf103('0x52'))]['ValidationError'](_0xf103('0x53'));}return _0x16f53d[_0xf103('0x4d')](path[_0xf103('0x50')](config[_0xf103('0x51')],_0xf103('0x54'),util[_0xf103('0x55')](_0xf103('0x56'),_0xa50dac[_0xf103('0x4e')],_0xa50dac['converted_format'])),util[_0xf103('0x55')]('%s.%s',_0xa50dac[_0xf103('0x2c')],_0xa50dac[_0xf103('0x4f')]));}return null;})[_0xf103('0x45')](handleError(_0x16f53d,null));};exports[_0xf103('0x57')]=function(_0x5205e9,_0x582b80,_0x3c974b){var _0x441535={'name':path[_0xf103('0x58')](_0x5205e9[_0xf103('0x59')][_0xf103('0x5a')],path['extname'](_0x5205e9[_0xf103('0x59')][_0xf103('0x5a')])),'save_name':path['basename'](_0x5205e9[_0xf103('0x59')][_0xf103('0x5b')],path[_0xf103('0x5c')](_0x5205e9[_0xf103('0x59')]['filename'])),'original_format':path[_0xf103('0x5c')](_0x5205e9[_0xf103('0x59')][_0xf103('0x5a')])[_0xf103('0x5d')](0x1),'converted_format':_0xf103('0x5e')};var _0x5d66be=path[_0xf103('0x50')](config['root'],'server/files/sounds/original',_0x5205e9['file'][_0xf103('0x5b')]);var _0x1f4c9b=path[_0xf103('0x50')](config[_0xf103('0x51')],_0xf103('0x54'),util[_0xf103('0x55')]('%s.%s',path[_0xf103('0x58')](_0x5205e9[_0xf103('0x59')][_0xf103('0x5b')],path[_0xf103('0x5c')](_0x5205e9[_0xf103('0x59')][_0xf103('0x5b')])),_0x441535[_0xf103('0x4f')]));logger[_0xf103('0x5f')](_0xf103('0x60'),_0x5d66be);logger[_0xf103('0x5f')](_0xf103('0x61'),_0x1f4c9b);try{fs[_0xf103('0x62')](_0x5d66be,parseInt('0777',0x8));var _0x39db00=sox[_0xf103('0x63')](_0x5d66be,_0x1f4c9b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x39db00['on'](_0xf103('0x2a'),function(_0x2e29a8){fs[_0xf103('0x64')](_0x5d66be);_0x582b80[_0xf103('0x1c')](0x1f4)[_0xf103('0x2d')](_0x2e29a8);});_0x39db00['on'](_0xf103('0x65'),function(_0xa773e2){_0x441535[_0xf103('0x66')]=isNaN(_0xa773e2['duration'])?null:_0xa773e2[_0xf103('0x67')]*0x3e8;_0x441535['original_sampleCount']=isNaN(_0xa773e2['sampleCount'])?null:_0xa773e2['sampleCount'];_0x441535[_0xf103('0x68')]=isNaN(_0xa773e2['channelCount'])?null:_0xa773e2['channelCount'];_0x441535['original_bitRate']=isNaN(_0xa773e2[_0xf103('0x69')])?null:_0xa773e2['bitRate'];_0x441535['original_sampleRate']=isNaN(_0xa773e2[_0xf103('0x6a')])?null:_0xa773e2[_0xf103('0x6a')];});_0x39db00['on'](_0xf103('0x6b'),function(_0x47432f){_0x441535[_0xf103('0x6c')]=isNaN(_0x47432f[_0xf103('0x67')])?null:_0x47432f[_0xf103('0x67')]*0x3e8;_0x441535[_0xf103('0x6d')]=isNaN(_0x47432f[_0xf103('0x6e')])?null:_0x47432f['sampleCount'];_0x441535[_0xf103('0x6f')]=isNaN(_0x47432f[_0xf103('0x70')])?null:_0x47432f[_0xf103('0x70')];_0x441535['converted_bitRate']=isNaN(_0x47432f[_0xf103('0x69')])?null:_0x47432f[_0xf103('0x69')];_0x441535[_0xf103('0x71')]=isNaN(_0x47432f[_0xf103('0x6a')])?null:_0x47432f[_0xf103('0x6a')];});_0x39db00['on'](_0xf103('0x1d'),function(){fs['chmodSync'](_0x1f4c9b,parseInt(_0xf103('0x72'),0x8));return db[_0xf103('0x30')][_0xf103('0x57')](_0x441535)['then'](function(_0x4df6b3){var _0x4ccc2b={'role':_0x5205e9['body'][_0xf103('0x73')],'userProfileId':_0x5205e9[_0xf103('0x74')][_0xf103('0x75')]};if(!_0x4ccc2b)throw new Error(_0xf103('0x76'));if(_0x4ccc2b[_0xf103('0x73')]==='user'){var _0x3a213b=_0x4df6b3['get']({'plain':!![]});return db[_0xf103('0x77')][_0xf103('0x4c')]({'where':{'name':_0xf103('0x27'),'userProfileId':_0x4ccc2b['userProfileId']},'raw':!![]})[_0xf103('0x25')](function(_0x45f009){if(_0x45f009&&_0x45f009[_0xf103('0x78')]===0x0){return db[_0xf103('0x28')][_0xf103('0x57')]({'name':_0x3a213b[_0xf103('0x2c')],'resourceId':_0x3a213b['id'],'type':_0x45f009[_0xf103('0x2c')],'sectionId':_0x45f009['id']},{})['then'](function(){return _0x4df6b3;});}else{return _0x4df6b3;}})[_0xf103('0x45')](function(_0x5383b3){logger[_0xf103('0x2a')](_0xf103('0x79'),_0x5383b3);throw _0x5383b3;});}return _0x4df6b3;})[_0xf103('0x25')](respondWithResult(_0x582b80,null))[_0xf103('0x45')](handleError(_0x582b80,null));});_0x39db00['start']();}catch(_0x5218ab){_0x582b80[_0xf103('0x1c')](0x1f4)[_0xf103('0x2d')](_0x5218ab);}};exports[_0xf103('0x24')]=function(_0x49cee6,_0x35069b,_0x575c27){return db['Sound'][_0xf103('0x4c')]({'where':{'id':_0x49cee6['params']['id']}})[_0xf103('0x25')](handleEntityNotFound(_0x35069b,null))['then'](saveUpdates(_[_0xf103('0x3d')](_0x49cee6[_0xf103('0x74')],[_0xf103('0x2c'),_0xf103('0x7a')]),null))[_0xf103('0x25')](respondWithResult(_0x35069b,null))['catch'](handleError(_0x35069b,null));};exports['delete']=function(_0x1b950b,_0x323e69,_0x299a3d){return db[_0xf103('0x30')][_0xf103('0x4c')]({'where':{'id':_0x1b950b[_0xf103('0x47')]['id']}})[_0xf103('0x25')](function(_0x5fc23a){if(_0x5fc23a){return _0x5fc23a[_0xf103('0x29')]();}})[_0xf103('0x25')](function(_0x13a7c9){var _0x4833a2=path[_0xf103('0x50')](config[_0xf103('0x51')],_0xf103('0x7b'),util[_0xf103('0x55')](_0xf103('0x56'),_0x13a7c9['save_name'],_0x13a7c9[_0xf103('0x7c')]));var _0x5dd97b=path[_0xf103('0x50')](config[_0xf103('0x51')],_0xf103('0x54'),util[_0xf103('0x55')](_0xf103('0x56'),_0x13a7c9[_0xf103('0x4e')],_0x13a7c9[_0xf103('0x4f')]));fs[_0xf103('0x64')](_0x4833a2);fs[_0xf103('0x64')](_0x5dd97b);return _0x13a7c9;})['then'](function(_0x3bb6f0){if(_0x3bb6f0){return _0x323e69[_0xf103('0x1c')](0xcc)[_0xf103('0x1d')]();}})[_0xf103('0x25')](handleEntityNotFound(_0x323e69,null))['catch'](handleError(_0x323e69,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 1a4dedf..9d4db56 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 _0x50bd=['exports','define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./sound.attributes'];(function(_0x48ad11,_0x52a7f1){var _0x5a0be9=function(_0x3aca25){while(--_0x3aca25){_0x48ad11['push'](_0x48ad11['shift']());}};_0x5a0be9(++_0x52a7f1);}(_0x50bd,0xc3));var _0xd50b=function(_0x6f0435,_0x4fd891){_0x6f0435=_0x6f0435-0x0;var _0x254166=_0x50bd[_0x6f0435];return _0x254166;};'use strict';var _=require(_0xd50b('0x0'));var util=require(_0xd50b('0x1'));var logger=require(_0xd50b('0x2'))(_0xd50b('0x3'));var moment=require(_0xd50b('0x4'));var BPromise=require(_0xd50b('0x5'));var rp=require(_0xd50b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd50b('0x7'));var config=require('../../config/environment');var attributes=require(_0xd50b('0x8'));module[_0xd50b('0x9')]=function(_0x4e11b8,_0x15beaa){return _0x4e11b8[_0xd50b('0xa')]('Sound',attributes,{'tableName':_0xd50b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9872=['request-promise','path','rimraf','../../config/environment','exports','define','Sound','util','../../config/logger','api','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9872,0x14b));var _0x2987=function(_0x122bf4,_0x437617){_0x122bf4=_0x122bf4-0x0;var _0x1099e8=_0x9872[_0x122bf4];return _0x1099e8;};'use strict';var _=require('lodash');var util=require(_0x2987('0x0'));var logger=require(_0x2987('0x1'))(_0x2987('0x2'));var moment=require(_0x2987('0x3'));var BPromise=require(_0x2987('0x4'));var rp=require(_0x2987('0x5'));var fs=require('fs');var path=require(_0x2987('0x6'));var rimraf=require(_0x2987('0x7'));var config=require(_0x2987('0x8'));var attributes=require('./sound.attributes');module[_0x2987('0x9')]=function(_0xb4abab,_0x30bc17){return _0xb4abab[_0x2987('0xa')](_0x2987('0xb'),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 3e32aab..2040d01 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 _0x4e5d=['options','raw','where','include','model','attributes','map','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find'];(function(_0xf29ccb,_0x2e8ddf){var _0x36f405=function(_0x347229){while(--_0x347229){_0xf29ccb['push'](_0xf29ccb['shift']());}};_0x36f405(++_0x2e8ddf);}(_0x4e5d,0x19a));var _0xd4e5=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0x4e5d[_0x183256];return _0x5394a2;};'use strict';var _=require(_0xd4e5('0x0'));var util=require('util');var moment=require(_0xd4e5('0x1'));var BPromise=require(_0xd4e5('0x2'));var rs=require(_0xd4e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd4e5('0x5'));var jayson=require(_0xd4e5('0x6'));var client=jayson[_0xd4e5('0x7')][_0xd4e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a7b52,_0x5acd89,_0x13cb4e){return new BPromise(function(_0x34bbff,_0x51986e){return client[_0xd4e5('0x9')](_0x2a7b52,_0x13cb4e)[_0xd4e5('0xa')](function(_0x3df959){logger[_0xd4e5('0xb')]('Sound,\x20%s,\x20%s',_0x5acd89,'request\x20sent');logger[_0xd4e5('0xc')](_0xd4e5('0xd'),_0x5acd89,_0xd4e5('0xe'),JSON[_0xd4e5('0xf')](_0x3df959));if(_0x3df959[_0xd4e5('0x10')]){if(_0x3df959[_0xd4e5('0x10')]['code']===0x1f4){logger[_0xd4e5('0x10')](_0xd4e5('0x11'),_0x5acd89,_0x3df959['error'][_0xd4e5('0x12')]);return _0x51986e(_0x3df959['error'][_0xd4e5('0x12')]);}logger['error'](_0xd4e5('0x11'),_0x5acd89,_0x3df959[_0xd4e5('0x10')][_0xd4e5('0x12')]);return _0x34bbff(_0x3df959[_0xd4e5('0x10')][_0xd4e5('0x12')]);}else{logger[_0xd4e5('0xb')](_0xd4e5('0x11'),_0x5acd89,_0xd4e5('0xe'));_0x34bbff(_0x3df959[_0xd4e5('0x13')]['message']);}})[_0xd4e5('0x14')](function(_0x4f6601){logger[_0xd4e5('0x10')](_0xd4e5('0x11'),_0x5acd89,_0x4f6601);_0x51986e(_0x4f6601);});});}exports[_0xd4e5('0x15')]=function(_0x25f09a){var _0x201b9e=this;return new Promise(function(_0x390567,_0x2c8820){return db[_0xd4e5('0x16')][_0xd4e5('0x17')]({'raw':_0x25f09a[_0xd4e5('0x18')]?_0x25f09a[_0xd4e5('0x18')][_0xd4e5('0x19')]===undefined?!![]:![]:!![],'where':_0x25f09a[_0xd4e5('0x18')]?_0x25f09a['options'][_0xd4e5('0x1a')]||null:null,'attributes':_0x25f09a[_0xd4e5('0x18')]?_0x25f09a['options']['attributes']||null:null,'include':_0x25f09a['options']?_0x25f09a[_0xd4e5('0x18')][_0xd4e5('0x1b')]?_['map'](_0x25f09a['options'][_0xd4e5('0x1b')],function(_0x981ed9){return{'model':db[_0x981ed9[_0xd4e5('0x1c')]],'as':_0x981ed9['as'],'attributes':_0x981ed9[_0xd4e5('0x1d')],'include':_0x981ed9['include']?_[_0xd4e5('0x1e')](_0x981ed9[_0xd4e5('0x1b')],function(_0x5e466b){return{'model':db[_0x5e466b[_0xd4e5('0x1c')]],'as':_0x5e466b['as'],'attributes':_0x5e466b[_0xd4e5('0x1d')],'include':_0x5e466b[_0xd4e5('0x1b')]?_[_0xd4e5('0x1e')](_0x5e466b['include'],function(_0x5eccde){return{'model':db[_0x5eccde['model']],'as':_0x5eccde['as'],'attributes':_0x5eccde[_0xd4e5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d3915){logger['info']('ShowSound',_0x25f09a);logger[_0xd4e5('0xc')](_0xd4e5('0x15'),_0x25f09a,JSON[_0xd4e5('0xf')](_0x1d3915));_0x390567(_0x1d3915);})[_0xd4e5('0x14')](function(_0x1b0e88){logger['error'](_0xd4e5('0x15'),_0x1b0e88[_0xd4e5('0x12')],_0x25f09a);_0x2c8820(_0x201b9e[_0xd4e5('0x10')](0x1f4,_0x1b0e88['message']));});});}; \ No newline at end of file +var _0xe321=['catch','ShowSound','Sound','options','raw','include','map','model','attributes','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Sound,\x20%s,\x20%s','result'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe321,0xcb));var _0x1e32=function(_0x4d525c,_0x277dac){_0x4d525c=_0x4d525c-0x0;var _0x3f0655=_0xe321[_0x4d525c];return _0x3f0655;};'use strict';var _=require('lodash');var util=require(_0x1e32('0x0'));var moment=require(_0x1e32('0x1'));var BPromise=require(_0x1e32('0x2'));var rs=require(_0x1e32('0x3'));var fs=require('fs');var Redis=require(_0x1e32('0x4'));var db=require(_0x1e32('0x5'))['db'];var utils=require(_0x1e32('0x6'));var logger=require(_0x1e32('0x7'))(_0x1e32('0x8'));var config=require(_0x1e32('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1e32('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13fd88,_0x269798,_0x358be8){return new BPromise(function(_0x2db9e3,_0x5e1a76){return client[_0x1e32('0xb')](_0x13fd88,_0x358be8)['then'](function(_0x12901e){logger[_0x1e32('0xc')]('Sound,\x20%s,\x20%s',_0x269798,_0x1e32('0xd'));logger['debug'](_0x1e32('0xe'),_0x269798,_0x1e32('0xd'),JSON[_0x1e32('0xf')](_0x12901e));if(_0x12901e[_0x1e32('0x10')]){if(_0x12901e[_0x1e32('0x10')][_0x1e32('0x11')]===0x1f4){logger[_0x1e32('0x10')]('Sound,\x20%s,\x20%s',_0x269798,_0x12901e[_0x1e32('0x10')][_0x1e32('0x12')]);return _0x5e1a76(_0x12901e[_0x1e32('0x10')][_0x1e32('0x12')]);}logger[_0x1e32('0x10')](_0x1e32('0x13'),_0x269798,_0x12901e[_0x1e32('0x10')][_0x1e32('0x12')]);return _0x2db9e3(_0x12901e[_0x1e32('0x10')][_0x1e32('0x12')]);}else{logger[_0x1e32('0xc')](_0x1e32('0x13'),_0x269798,_0x1e32('0xd'));_0x2db9e3(_0x12901e[_0x1e32('0x14')][_0x1e32('0x12')]);}})[_0x1e32('0x15')](function(_0x1cecb2){logger[_0x1e32('0x10')](_0x1e32('0x13'),_0x269798,_0x1cecb2);_0x5e1a76(_0x1cecb2);});});}exports[_0x1e32('0x16')]=function(_0x485542){var _0x401420=this;return new Promise(function(_0x44f584,_0x178bc6){return db[_0x1e32('0x17')]['find']({'raw':_0x485542[_0x1e32('0x18')]?_0x485542[_0x1e32('0x18')][_0x1e32('0x19')]===undefined?!![]:![]:!![],'where':_0x485542[_0x1e32('0x18')]?_0x485542['options']['where']||null:null,'attributes':_0x485542[_0x1e32('0x18')]?_0x485542[_0x1e32('0x18')]['attributes']||null:null,'include':_0x485542[_0x1e32('0x18')]?_0x485542[_0x1e32('0x18')][_0x1e32('0x1a')]?_[_0x1e32('0x1b')](_0x485542[_0x1e32('0x18')]['include'],function(_0x18b40b){return{'model':db[_0x18b40b[_0x1e32('0x1c')]],'as':_0x18b40b['as'],'attributes':_0x18b40b['attributes'],'include':_0x18b40b[_0x1e32('0x1a')]?_[_0x1e32('0x1b')](_0x18b40b[_0x1e32('0x1a')],function(_0x56b55f){return{'model':db[_0x56b55f[_0x1e32('0x1c')]],'as':_0x56b55f['as'],'attributes':_0x56b55f[_0x1e32('0x1d')],'include':_0x56b55f[_0x1e32('0x1a')]?_[_0x1e32('0x1b')](_0x56b55f[_0x1e32('0x1a')],function(_0x4b7ebb){return{'model':db[_0x4b7ebb['model']],'as':_0x4b7ebb['as'],'attributes':_0x4b7ebb['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e32('0x1e')](function(_0x341f70){logger[_0x1e32('0xc')](_0x1e32('0x16'),_0x485542);logger[_0x1e32('0x1f')](_0x1e32('0x16'),_0x485542,JSON[_0x1e32('0xf')](_0x341f70));_0x44f584(_0x341f70);})['catch'](function(_0x468ac1){logger[_0x1e32('0x10')](_0x1e32('0x16'),_0x468ac1['message'],_0x485542);_0x178bc6(_0x401420[_0x1e32('0x10')](0x1f4,_0x468ac1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d6ec586..d77b3cd 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 _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3beea0,_0x416691){var _0x314eb1=function(_0x937185){while(--_0x937185){_0x3beea0['push'](_0x3beea0['shift']());}};_0x314eb1(++_0x416691);}(_0x8603,0x190));var _0x3860=function(_0x4e0ab8,_0x401afb){_0x4e0ab8=_0x4e0ab8-0x0;var _0x4c1f40=_0x8603[_0x4e0ab8];return _0x4c1f40;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x2d51ca,_0x556adb){var _0x1e5187=function(_0x466a65){while(--_0x466a65){_0x2d51ca['push'](_0x2d51ca['shift']());}};_0x1e5187(++_0x556adb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f044632..58c4fce 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 _0x8726=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x185781,_0x131f71){var _0x10f1ae=function(_0x45e7bd){while(--_0x45e7bd){_0x185781['push'](_0x185781['shift']());}};_0x10f1ae(++_0x131f71);}(_0x8726,0x10c));var _0x6872=function(_0x1691dc,_0x3ff728){_0x1691dc=_0x1691dc-0x0;var _0x4769de=_0x8726[_0x1691dc];return _0x4769de;};'use strict';var Sequelize=require(_0x6872('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6872('0x1')]},'body':{'type':Sequelize[_0x6872('0x2')](_0x6872('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6872('0x4')]('in',_0x6872('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x6872('0x1')]},'providerResponse':{'type':Sequelize[_0x6872('0x2')]}}; \ No newline at end of file +var _0xb34f=['out','sequelize','STRING','TEXT','medium','ENUM'];(function(_0x49b0e7,_0x4ca5d7){var _0x1267c4=function(_0x1af6c9){while(--_0x1af6c9){_0x49b0e7['push'](_0x49b0e7['shift']());}};_0x1267c4(++_0x4ca5d7);}(_0xb34f,0x18d));var _0xfb34=function(_0xb7f287,_0x1a4185){_0xb7f287=_0xb7f287-0x0;var _0x4af712=_0xb34f[_0xb7f287];return _0x4af712;};'use strict';var Sequelize=require(_0xfb34('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xfb34('0x1')]},'body':{'type':Sequelize[_0xfb34('0x2')](_0xfb34('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xfb34('0x4')]('in',_0xfb34('0x5')),'defaultValue':_0xfb34('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xfb34('0x1')]},'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 f3faf8d..64bc991 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 _0xaaee=['fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','intersection','catch','create','body','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','SquareMessage','rawAttributes','type','key','keys','query','filters','attributes','model'];(function(_0x4654a4,_0x101d85){var _0x535f45=function(_0x1d3a3c){while(--_0x1d3a3c){_0x4654a4['push'](_0x4654a4['shift']());}};_0x535f45(++_0x101d85);}(_0xaaee,0xa9));var _0xeaae=function(_0x4f0ee6,_0x15d9b4){_0x4f0ee6=_0x4f0ee6-0x0;var _0x146ee5=_0xaaee[_0x4f0ee6];return _0x146ee5;};'use strict';var emlformat=require(_0xeaae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeaae('0x1'));var jsonpatch=require(_0xeaae('0x2'));var rp=require('request-promise');var moment=require(_0xeaae('0x3'));var BPromise=require(_0xeaae('0x4'));var Mustache=require(_0xeaae('0x5'));var util=require(_0xeaae('0x6'));var path=require('path');var sox=require(_0xeaae('0x7'));var csv=require(_0xeaae('0x8'));var ejs=require(_0xeaae('0x9'));var fs=require('fs');var fs_extra=require(_0xeaae('0xa'));var _=require(_0xeaae('0xb'));var squel=require(_0xeaae('0xc'));var crypto=require('crypto');var jsforce=require(_0xeaae('0xd'));var deskjs=require(_0xeaae('0xe'));var toCsv=require(_0xeaae('0x8'));var querystring=require(_0xeaae('0xf'));var Papa=require(_0xeaae('0x10'));var Redis=require(_0xeaae('0x11'));var authService=require(_0xeaae('0x12'));var qs=require(_0xeaae('0x13'));var as=require(_0xeaae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaae('0x15'))(_0xeaae('0x16'));var utils=require(_0xeaae('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeaae('0x18'))['db'];function respondWithStatusCode(_0xf4e6b7,_0x16c851){_0x16c851=_0x16c851||0xcc;return function(_0x564b56){if(_0x564b56){return _0xf4e6b7[_0xeaae('0x19')](_0x16c851);}return _0xf4e6b7[_0xeaae('0x1a')](_0x16c851)[_0xeaae('0x1b')]();};}function respondWithResult(_0x3f46ff,_0x4f3501){_0x4f3501=_0x4f3501||0xc8;return function(_0x4d3766){if(_0x4d3766){return _0x3f46ff[_0xeaae('0x1a')](_0x4f3501)[_0xeaae('0x1c')](_0x4d3766);}};}function respondWithFilteredResult(_0x8dc1ac,_0x25b974){return function(_0x49741a){if(_0x49741a){var _0x1dd48f=typeof _0x25b974['offset']===_0xeaae('0x1d')&&typeof _0x25b974[_0xeaae('0x1e')]===_0xeaae('0x1d');var _0x355f39=_0x49741a['count'];var _0x538e3d=_0x1dd48f?0x0:_0x25b974['offset'];var _0x5b44f5=_0x1dd48f?_0x49741a[_0xeaae('0x1f')]:_0x25b974[_0xeaae('0x20')]+_0x25b974['limit'];var _0x4667ff;if(_0x5b44f5>=_0x355f39){_0x5b44f5=_0x355f39;_0x4667ff=0xc8;}else{_0x4667ff=0xce;}_0x8dc1ac['status'](_0x4667ff);return _0x8dc1ac[_0xeaae('0x21')](_0xeaae('0x22'),_0x538e3d+'-'+_0x5b44f5+'/'+_0x355f39)[_0xeaae('0x1c')](_0x49741a);}return null;};}function patchUpdates(_0x52de90){return function(_0x3be7cf){try{jsonpatch[_0xeaae('0x23')](_0x3be7cf,_0x52de90,!![]);}catch(_0x4c925a){return BPromise['reject'](_0x4c925a);}return _0x3be7cf[_0xeaae('0x24')]();};}function saveUpdates(_0x5ee523,_0x48f4a9){return function(_0x12f1b0){if(_0x12f1b0){return _0x12f1b0[_0xeaae('0x25')](_0x5ee523)[_0xeaae('0x26')](function(_0x25945c){return _0x25945c;});}return null;};}function removeEntity(_0xefe74b,_0x41739e){return function(_0x2a961c){if(_0x2a961c){return _0x2a961c[_0xeaae('0x27')]()[_0xeaae('0x26')](function(){_0xefe74b[_0xeaae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa7fa13,_0x124b21){return function(_0x10a0f2){if(!_0x10a0f2){_0xa7fa13[_0xeaae('0x19')](0x194);}return _0x10a0f2;};}function handleError(_0x98ec5a,_0x45a6df){_0x45a6df=_0x45a6df||0x1f4;return function(_0x145b46){logger[_0xeaae('0x28')](_0x145b46['stack']);if(_0x145b46['name']){delete _0x145b46[_0xeaae('0x29')];}_0x98ec5a[_0xeaae('0x1a')](_0x45a6df)[_0xeaae('0x2a')](_0x145b46);};}exports['index']=function(_0x294938,_0x30e777){var _0xa334c8={},_0x14a68a={},_0x24d86a={'count':0x0,'rows':[]};var _0x1c7175=_[_0xeaae('0x2b')](db[_0xeaae('0x2c')][_0xeaae('0x2d')],function(_0x24f0f2){return{'name':_0x24f0f2['fieldName'],'type':_0x24f0f2[_0xeaae('0x2e')][_0xeaae('0x2f')]};});_0x14a68a['model']=_['map'](_0x1c7175,_0xeaae('0x29'));_0x14a68a['query']=_[_0xeaae('0x30')](_0x294938[_0xeaae('0x31')]);_0x14a68a[_0xeaae('0x32')]=_['intersection'](_0x14a68a['model'],_0x14a68a['query']);_0xa334c8[_0xeaae('0x33')]=_['intersection'](_0x14a68a[_0xeaae('0x34')],qs[_0xeaae('0x35')](_0x294938[_0xeaae('0x31')]['fields']));_0xa334c8[_0xeaae('0x33')]=_0xa334c8[_0xeaae('0x33')][_0xeaae('0x36')]?_0xa334c8[_0xeaae('0x33')]:_0x14a68a[_0xeaae('0x34')];if(!_0x294938['query'][_0xeaae('0x37')](_0xeaae('0x38'))){_0xa334c8[_0xeaae('0x1e')]=qs[_0xeaae('0x1e')](_0x294938[_0xeaae('0x31')][_0xeaae('0x1e')]);_0xa334c8[_0xeaae('0x20')]=qs[_0xeaae('0x20')](_0x294938[_0xeaae('0x31')][_0xeaae('0x20')]);}_0xa334c8[_0xeaae('0x39')]=qs['sort'](_0x294938['query']['sort']);_0xa334c8['where']=qs['filters'](_[_0xeaae('0x3a')](_0x294938['query'],_0x14a68a[_0xeaae('0x32')]),_0x1c7175);if(_0x294938['query'][_0xeaae('0x3b')]){_0xa334c8['where']=_['merge'](_0xa334c8[_0xeaae('0x3c')],{'$or':_[_0xeaae('0x2b')](_0x1c7175,function(_0x58089f){if(_0x58089f[_0xeaae('0x2e')]!==_0xeaae('0x3d')){var _0x4af203={};_0x4af203[_0x58089f[_0xeaae('0x29')]]={'$like':'%'+_0x294938[_0xeaae('0x31')][_0xeaae('0x3b')]+'%'};return _0x4af203;}})});}_0xa334c8=_[_0xeaae('0x3e')]({},_0xa334c8,_0x294938[_0xeaae('0x3f')]);var _0x5a97a8={'where':_0xa334c8[_0xeaae('0x3c')]};return db['SquareMessage'][_0xeaae('0x1f')](_0x5a97a8)[_0xeaae('0x26')](function(_0x4b47db){_0x24d86a[_0xeaae('0x1f')]=_0x4b47db;if(_0x294938[_0xeaae('0x31')][_0xeaae('0x40')]){_0xa334c8['include']=[{'all':!![]}];}return db[_0xeaae('0x2c')][_0xeaae('0x41')](_0xa334c8);})[_0xeaae('0x26')](function(_0x40d844){_0x24d86a[_0xeaae('0x42')]=_0x40d844;return _0x24d86a;})['then'](respondWithFilteredResult(_0x30e777,_0xa334c8))['catch'](handleError(_0x30e777,null));};exports[_0xeaae('0x43')]=function(_0x2b97c9,_0x2d81b5){var _0x47d796={'raw':!![],'where':{'id':_0x2b97c9['params']['id']}},_0x467a65={};_0x467a65[_0xeaae('0x34')]=_['keys'](db[_0xeaae('0x2c')][_0xeaae('0x2d')]);_0x467a65[_0xeaae('0x31')]=_['keys'](_0x2b97c9[_0xeaae('0x31')]);_0x467a65['filters']=_[_0xeaae('0x44')](_0x467a65['model'],_0x467a65['query']);_0x47d796[_0xeaae('0x33')]=_[_0xeaae('0x44')](_0x467a65['model'],qs[_0xeaae('0x35')](_0x2b97c9[_0xeaae('0x31')][_0xeaae('0x35')]));_0x47d796[_0xeaae('0x33')]=_0x47d796[_0xeaae('0x33')][_0xeaae('0x36')]?_0x47d796['attributes']:_0x467a65[_0xeaae('0x34')];if(_0x2b97c9[_0xeaae('0x31')][_0xeaae('0x40')]){_0x47d796['include']=[{'all':!![]}];}_0x47d796=_['merge']({},_0x47d796,_0x2b97c9[_0xeaae('0x3f')]);return db[_0xeaae('0x2c')]['find'](_0x47d796)[_0xeaae('0x26')](handleEntityNotFound(_0x2d81b5,null))[_0xeaae('0x26')](respondWithResult(_0x2d81b5,null))[_0xeaae('0x45')](handleError(_0x2d81b5,null));};exports[_0xeaae('0x46')]=function(_0x29121a,_0x57a5ff){return db[_0xeaae('0x2c')]['create'](_0x29121a['body'],{})[_0xeaae('0x26')](respondWithResult(_0x57a5ff,0xc9))[_0xeaae('0x45')](handleError(_0x57a5ff,null));};exports[_0xeaae('0x25')]=function(_0x285dfe,_0x235b0d){if(_0x285dfe[_0xeaae('0x47')]['id']){delete _0x285dfe[_0xeaae('0x47')]['id'];}return db[_0xeaae('0x2c')][_0xeaae('0x48')]({'where':{'id':_0x285dfe[_0xeaae('0x49')]['id']}})[_0xeaae('0x26')](handleEntityNotFound(_0x235b0d,null))[_0xeaae('0x26')](saveUpdates(_0x285dfe[_0xeaae('0x47')],null))[_0xeaae('0x26')](respondWithResult(_0x235b0d,null))['catch'](handleError(_0x235b0d,null));};exports[_0xeaae('0x27')]=function(_0x506341,_0x1e6af9){return db[_0xeaae('0x2c')][_0xeaae('0x48')]({'where':{'id':_0x506341[_0xeaae('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e6af9,null))[_0xeaae('0x26')](removeEntity(_0x1e6af9,null))['catch'](handleError(_0x1e6af9,null));}; \ No newline at end of file +var _0x70af=['keys','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','SquareMessage','fieldName','type'];(function(_0x34e23d,_0x3cec91){var _0x390dd2=function(_0x57fc59){while(--_0x57fc59){_0x34e23d['push'](_0x34e23d['shift']());}};_0x390dd2(++_0x3cec91);}(_0x70af,0xa9));var _0xf70a=function(_0x394499,_0x55456f){_0x394499=_0x394499-0x0;var _0x322327=_0x70af[_0x394499];return _0x322327;};'use strict';var emlformat=require(_0xf70a('0x0'));var rimraf=require(_0xf70a('0x1'));var zipdir=require(_0xf70a('0x2'));var jsonpatch=require(_0xf70a('0x3'));var rp=require(_0xf70a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf70a('0x5'));var path=require(_0xf70a('0x6'));var sox=require(_0xf70a('0x7'));var csv=require(_0xf70a('0x8'));var ejs=require(_0xf70a('0x9'));var fs=require('fs');var fs_extra=require(_0xf70a('0xa'));var _=require(_0xf70a('0xb'));var squel=require(_0xf70a('0xc'));var crypto=require(_0xf70a('0xd'));var jsforce=require(_0xf70a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf70a('0x8'));var querystring=require('querystring');var Papa=require(_0xf70a('0xf'));var Redis=require(_0xf70a('0x10'));var authService=require(_0xf70a('0x11'));var qs=require(_0xf70a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf70a('0x13'));var logger=require(_0xf70a('0x14'))(_0xf70a('0x15'));var utils=require(_0xf70a('0x16'));var config=require(_0xf70a('0x17'));var licenseUtil=require(_0xf70a('0x18'));var db=require(_0xf70a('0x19'))['db'];function respondWithStatusCode(_0x736135,_0x31ded4){_0x31ded4=_0x31ded4||0xcc;return function(_0x3adf75){if(_0x3adf75){return _0x736135[_0xf70a('0x1a')](_0x31ded4);}return _0x736135[_0xf70a('0x1b')](_0x31ded4)['end']();};}function respondWithResult(_0x38188b,_0x5513e9){_0x5513e9=_0x5513e9||0xc8;return function(_0x4b2aa8){if(_0x4b2aa8){return _0x38188b[_0xf70a('0x1b')](_0x5513e9)[_0xf70a('0x1c')](_0x4b2aa8);}};}function respondWithFilteredResult(_0x200837,_0x588d47){return function(_0x1a35d2){if(_0x1a35d2){var _0x132649=typeof _0x588d47[_0xf70a('0x1d')]===_0xf70a('0x1e')&&typeof _0x588d47[_0xf70a('0x1f')]==='undefined';var _0x1a41a4=_0x1a35d2[_0xf70a('0x20')];var _0x1eece5=_0x132649?0x0:_0x588d47[_0xf70a('0x1d')];var _0x4fe6e9=_0x132649?_0x1a35d2['count']:_0x588d47[_0xf70a('0x1d')]+_0x588d47[_0xf70a('0x1f')];var _0x336322;if(_0x4fe6e9>=_0x1a41a4){_0x4fe6e9=_0x1a41a4;_0x336322=0xc8;}else{_0x336322=0xce;}_0x200837['status'](_0x336322);return _0x200837['set'](_0xf70a('0x21'),_0x1eece5+'-'+_0x4fe6e9+'/'+_0x1a41a4)['json'](_0x1a35d2);}return null;};}function patchUpdates(_0x292ba9){return function(_0x2c2bf1){try{jsonpatch[_0xf70a('0x22')](_0x2c2bf1,_0x292ba9,!![]);}catch(_0x2be9a5){return BPromise[_0xf70a('0x23')](_0x2be9a5);}return _0x2c2bf1['save']();};}function saveUpdates(_0x4a4d62,_0x52c64b){return function(_0x4e3acf){if(_0x4e3acf){return _0x4e3acf[_0xf70a('0x24')](_0x4a4d62)[_0xf70a('0x25')](function(_0x25cce4){return _0x25cce4;});}return null;};}function removeEntity(_0x5655fa,_0x4790ac){return function(_0x147308){if(_0x147308){return _0x147308[_0xf70a('0x26')]()['then'](function(){_0x5655fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11768e,_0x14ae99){return function(_0x298ef2){if(!_0x298ef2){_0x11768e[_0xf70a('0x1a')](0x194);}return _0x298ef2;};}function handleError(_0x1783f9,_0x53ed36){_0x53ed36=_0x53ed36||0x1f4;return function(_0x2deda6){logger[_0xf70a('0x27')](_0x2deda6[_0xf70a('0x28')]);if(_0x2deda6[_0xf70a('0x29')]){delete _0x2deda6[_0xf70a('0x29')];}_0x1783f9[_0xf70a('0x1b')](_0x53ed36)[_0xf70a('0x2a')](_0x2deda6);};}exports['index']=function(_0x2cb282,_0x415536){var _0x33856c={},_0x2395d3={},_0x41cb25={'count':0x0,'rows':[]};var _0x4c0a94=_[_0xf70a('0x2b')](db[_0xf70a('0x2c')]['rawAttributes'],function(_0x3b4c6c){return{'name':_0x3b4c6c[_0xf70a('0x2d')],'type':_0x3b4c6c[_0xf70a('0x2e')]['key']};});_0x2395d3['model']=_['map'](_0x4c0a94,_0xf70a('0x29'));_0x2395d3['query']=_[_0xf70a('0x2f')](_0x2cb282[_0xf70a('0x30')]);_0x2395d3['filters']=_['intersection'](_0x2395d3[_0xf70a('0x31')],_0x2395d3[_0xf70a('0x30')]);_0x33856c['attributes']=_[_0xf70a('0x32')](_0x2395d3[_0xf70a('0x31')],qs[_0xf70a('0x33')](_0x2cb282[_0xf70a('0x30')][_0xf70a('0x33')]));_0x33856c[_0xf70a('0x34')]=_0x33856c['attributes']['length']?_0x33856c[_0xf70a('0x34')]:_0x2395d3[_0xf70a('0x31')];if(!_0x2cb282['query'][_0xf70a('0x35')](_0xf70a('0x36'))){_0x33856c[_0xf70a('0x1f')]=qs['limit'](_0x2cb282[_0xf70a('0x30')][_0xf70a('0x1f')]);_0x33856c['offset']=qs['offset'](_0x2cb282['query']['offset']);}_0x33856c[_0xf70a('0x37')]=qs[_0xf70a('0x38')](_0x2cb282[_0xf70a('0x30')][_0xf70a('0x38')]);_0x33856c[_0xf70a('0x39')]=qs[_0xf70a('0x3a')](_[_0xf70a('0x3b')](_0x2cb282['query'],_0x2395d3['filters']),_0x4c0a94);if(_0x2cb282[_0xf70a('0x30')]['filter']){_0x33856c['where']=_[_0xf70a('0x3c')](_0x33856c[_0xf70a('0x39')],{'$or':_[_0xf70a('0x2b')](_0x4c0a94,function(_0x1921da){if(_0x1921da[_0xf70a('0x2e')]!=='VIRTUAL'){var _0x438ed0={};_0x438ed0[_0x1921da[_0xf70a('0x29')]]={'$like':'%'+_0x2cb282['query'][_0xf70a('0x3d')]+'%'};return _0x438ed0;}})});}_0x33856c=_[_0xf70a('0x3c')]({},_0x33856c,_0x2cb282[_0xf70a('0x3e')]);var _0x5cfb6f={'where':_0x33856c[_0xf70a('0x39')]};return db[_0xf70a('0x2c')][_0xf70a('0x20')](_0x5cfb6f)[_0xf70a('0x25')](function(_0xe4c878){_0x41cb25[_0xf70a('0x20')]=_0xe4c878;if(_0x2cb282[_0xf70a('0x30')][_0xf70a('0x3f')]){_0x33856c[_0xf70a('0x40')]=[{'all':!![]}];}return db[_0xf70a('0x2c')]['findAll'](_0x33856c);})[_0xf70a('0x25')](function(_0xb68697){_0x41cb25['rows']=_0xb68697;return _0x41cb25;})[_0xf70a('0x25')](respondWithFilteredResult(_0x415536,_0x33856c))[_0xf70a('0x41')](handleError(_0x415536,null));};exports[_0xf70a('0x42')]=function(_0x3a0560,_0x8b790c){var _0x3f3a81={'raw':!![],'where':{'id':_0x3a0560[_0xf70a('0x43')]['id']}},_0x64bd5c={};_0x64bd5c['model']=_[_0xf70a('0x2f')](db['SquareMessage']['rawAttributes']);_0x64bd5c['query']=_['keys'](_0x3a0560[_0xf70a('0x30')]);_0x64bd5c[_0xf70a('0x3a')]=_[_0xf70a('0x32')](_0x64bd5c['model'],_0x64bd5c[_0xf70a('0x30')]);_0x3f3a81['attributes']=_[_0xf70a('0x32')](_0x64bd5c['model'],qs[_0xf70a('0x33')](_0x3a0560[_0xf70a('0x30')][_0xf70a('0x33')]));_0x3f3a81[_0xf70a('0x34')]=_0x3f3a81['attributes'][_0xf70a('0x44')]?_0x3f3a81[_0xf70a('0x34')]:_0x64bd5c[_0xf70a('0x31')];if(_0x3a0560[_0xf70a('0x30')][_0xf70a('0x3f')]){_0x3f3a81[_0xf70a('0x40')]=[{'all':!![]}];}_0x3f3a81=_[_0xf70a('0x3c')]({},_0x3f3a81,_0x3a0560[_0xf70a('0x3e')]);return db[_0xf70a('0x2c')][_0xf70a('0x45')](_0x3f3a81)[_0xf70a('0x25')](handleEntityNotFound(_0x8b790c,null))['then'](respondWithResult(_0x8b790c,null))[_0xf70a('0x41')](handleError(_0x8b790c,null));};exports[_0xf70a('0x46')]=function(_0x5ecb7b,_0x24f7b6){return db[_0xf70a('0x2c')][_0xf70a('0x46')](_0x5ecb7b[_0xf70a('0x47')],{})[_0xf70a('0x25')](respondWithResult(_0x24f7b6,0xc9))[_0xf70a('0x41')](handleError(_0x24f7b6,null));};exports[_0xf70a('0x24')]=function(_0x1fd585,_0x562ff8){if(_0x1fd585[_0xf70a('0x47')]['id']){delete _0x1fd585[_0xf70a('0x47')]['id'];}return db['SquareMessage'][_0xf70a('0x45')]({'where':{'id':_0x1fd585[_0xf70a('0x43')]['id']}})[_0xf70a('0x25')](handleEntityNotFound(_0x562ff8,null))[_0xf70a('0x25')](saveUpdates(_0x1fd585[_0xf70a('0x47')],null))[_0xf70a('0x25')](respondWithResult(_0x562ff8,null))[_0xf70a('0x41')](handleError(_0x562ff8,null));};exports[_0xf70a('0x26')]=function(_0x58af9d,_0x4da6d8){return db[_0xf70a('0x2c')][_0xf70a('0x45')]({'where':{'id':_0x58af9d[_0xf70a('0x43')]['id']}})[_0xf70a('0x25')](handleEntityNotFound(_0x4da6d8,null))['then'](removeEntity(_0x4da6d8,null))[_0xf70a('0x41')](handleError(_0x4da6d8,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4855d13..35544fc 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 _0x8e5d=['bluebird','request-promise','path','rimraf','./squareMessage.attributes','SquareMessage','square_messages','lodash','../../config/logger','api','moment'];(function(_0x5ac542,_0x52b641){var _0xcd1a9=function(_0x1a1470){while(--_0x1a1470){_0x5ac542['push'](_0x5ac542['shift']());}};_0xcd1a9(++_0x52b641);}(_0x8e5d,0x6a));var _0xd8e5=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x8e5d[_0x15cbce];return _0x257f29;};'use strict';var _=require(_0xd8e5('0x0'));var util=require('util');var logger=require(_0xd8e5('0x1'))(_0xd8e5('0x2'));var moment=require(_0xd8e5('0x3'));var BPromise=require(_0xd8e5('0x4'));var rp=require(_0xd8e5('0x5'));var fs=require('fs');var path=require(_0xd8e5('0x6'));var rimraf=require(_0xd8e5('0x7'));var config=require('../../config/environment');var attributes=require(_0xd8e5('0x8'));module['exports']=function(_0x1816d0,_0x3a8c08){return _0x1816d0['define'](_0xd8e5('0x9'),attributes,{'tableName':_0xd8e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c5c=['exports','square_messages','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes'];(function(_0x47099e,_0x518d61){var _0x3109be=function(_0x589e79){while(--_0x589e79){_0x47099e['push'](_0x47099e['shift']());}};_0x3109be(++_0x518d61);}(_0x3c5c,0xa7));var _0xc3c5=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x3c5c[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0xc3c5('0x0'));var logger=require(_0xc3c5('0x1'))(_0xc3c5('0x2'));var moment=require(_0xc3c5('0x3'));var BPromise=require(_0xc3c5('0x4'));var rp=require(_0xc3c5('0x5'));var fs=require('fs');var path=require(_0xc3c5('0x6'));var rimraf=require(_0xc3c5('0x7'));var config=require('../../config/environment');var attributes=require(_0xc3c5('0x8'));module[_0xc3c5('0x9')]=function(_0x2a2a32,_0x2f24a5){return _0x2a2a32['define']('SquareMessage',attributes,{'tableName':_0xc3c5('0xa'),'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 8d9f983..13af53e 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 _0x8801=['options','raw','then','CreateSquareMessage','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','create','body'];(function(_0x201319,_0xed17ce){var _0x84c5be=function(_0x37db25){while(--_0x37db25){_0x201319['push'](_0x201319['shift']());}};_0x84c5be(++_0xed17ce);}(_0x8801,0xad));var _0x1880=function(_0x28f09f,_0x5d7c60){_0x28f09f=_0x28f09f-0x0;var _0x1d7650=_0x8801[_0x28f09f];return _0x1d7650;};'use strict';var _=require('lodash');var util=require(_0x1880('0x0'));var moment=require(_0x1880('0x1'));var BPromise=require('bluebird');var rs=require(_0x1880('0x2'));var fs=require('fs');var Redis=require(_0x1880('0x3'));var db=require(_0x1880('0x4'))['db'];var utils=require(_0x1880('0x5'));var logger=require(_0x1880('0x6'))(_0x1880('0x7'));var config=require(_0x1880('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1880('0x9')][_0x1880('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eae09,_0x3135aa,_0x294a55){return new BPromise(function(_0x18801e,_0x1a84ea){return client['request'](_0x5eae09,_0x294a55)['then'](function(_0x3b36ff){logger[_0x1880('0xb')]('SquareMessage,\x20%s,\x20%s',_0x3135aa,_0x1880('0xc'));logger['debug'](_0x1880('0xd'),_0x3135aa,_0x1880('0xc'),JSON[_0x1880('0xe')](_0x3b36ff));if(_0x3b36ff[_0x1880('0xf')]){if(_0x3b36ff['error'][_0x1880('0x10')]===0x1f4){logger[_0x1880('0xf')](_0x1880('0x11'),_0x3135aa,_0x3b36ff['error'][_0x1880('0x12')]);return _0x1a84ea(_0x3b36ff[_0x1880('0xf')][_0x1880('0x12')]);}logger[_0x1880('0xf')](_0x1880('0x11'),_0x3135aa,_0x3b36ff[_0x1880('0xf')][_0x1880('0x12')]);return _0x18801e(_0x3b36ff['error'][_0x1880('0x12')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x3135aa,_0x1880('0xc'));_0x18801e(_0x3b36ff[_0x1880('0x13')]['message']);}})[_0x1880('0x14')](function(_0x1b3bbf){logger[_0x1880('0xf')]('SquareMessage,\x20%s,\x20%s',_0x3135aa,_0x1b3bbf);_0x1a84ea(_0x1b3bbf);});});}exports['CreateSquareMessage']=function(_0x30fa17){var _0x2fe3d1=this;return new Promise(function(_0x58407c,_0x52c646){return db['SquareMessage'][_0x1880('0x15')](_0x30fa17[_0x1880('0x16')],{'raw':_0x30fa17[_0x1880('0x17')]?_0x30fa17[_0x1880('0x17')][_0x1880('0x18')]===undefined?!![]:![]:!![]})[_0x1880('0x19')](function(_0x590f9c){logger[_0x1880('0xb')](_0x1880('0x1a'),_0x30fa17);logger[_0x1880('0x1b')](_0x1880('0x1a'),_0x30fa17,JSON[_0x1880('0xe')](_0x590f9c));_0x58407c(_0x590f9c);})[_0x1880('0x14')](function(_0x3a5d95){logger[_0x1880('0xf')](_0x1880('0x1a'),_0x3a5d95['message'],_0x30fa17);_0x52c646(_0x2fe3d1[_0x1880('0xf')](0x1f4,_0x3a5d95[_0x1880('0x12')]));});});}; \ No newline at end of file +var _0x812e=['SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateSquareMessage','SquareMessage','create','body','options','stringify','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then'];(function(_0x50fc6e,_0x5ee804){var _0x4f8aad=function(_0xeeb17){while(--_0xeeb17){_0x50fc6e['push'](_0x50fc6e['shift']());}};_0x4f8aad(++_0x5ee804);}(_0x812e,0x1ee));var _0xe812=function(_0x28d5df,_0x513b92){_0x28d5df=_0x28d5df-0x0;var _0x987319=_0x812e[_0x28d5df];return _0x987319;};'use strict';var _=require('lodash');var util=require(_0xe812('0x0'));var moment=require('moment');var BPromise=require(_0xe812('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe812('0x2'));var db=require(_0xe812('0x3'))['db'];var utils=require(_0xe812('0x4'));var logger=require('../../config/logger')(_0xe812('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe812('0x6')][_0xe812('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3463f4,_0x5abaca,_0x95a6c0){return new BPromise(function(_0xafff8f,_0x156c4e){return client[_0xe812('0x8')](_0x3463f4,_0x95a6c0)[_0xe812('0x9')](function(_0x29c9a9){logger['info'](_0xe812('0xa'),_0x5abaca,_0xe812('0xb'));logger[_0xe812('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5abaca,_0xe812('0xb'),JSON['stringify'](_0x29c9a9));if(_0x29c9a9[_0xe812('0xd')]){if(_0x29c9a9[_0xe812('0xd')][_0xe812('0xe')]===0x1f4){logger[_0xe812('0xd')](_0xe812('0xa'),_0x5abaca,_0x29c9a9['error'][_0xe812('0xf')]);return _0x156c4e(_0x29c9a9[_0xe812('0xd')][_0xe812('0xf')]);}logger[_0xe812('0xd')]('SquareMessage,\x20%s,\x20%s',_0x5abaca,_0x29c9a9[_0xe812('0xd')][_0xe812('0xf')]);return _0xafff8f(_0x29c9a9['error'][_0xe812('0xf')]);}else{logger[_0xe812('0x10')](_0xe812('0xa'),_0x5abaca,_0xe812('0xb'));_0xafff8f(_0x29c9a9['result'][_0xe812('0xf')]);}})[_0xe812('0x11')](function(_0x63ee4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x5abaca,_0x63ee4);_0x156c4e(_0x63ee4);});});}exports[_0xe812('0x12')]=function(_0x168f6a){var _0x4b7d6e=this;return new Promise(function(_0x1e05ab,_0x8a5e7d){return db[_0xe812('0x13')][_0xe812('0x14')](_0x168f6a[_0xe812('0x15')],{'raw':_0x168f6a[_0xe812('0x16')]?_0x168f6a[_0xe812('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xe812('0x9')](function(_0x551493){logger[_0xe812('0x10')]('CreateSquareMessage',_0x168f6a);logger['debug']('CreateSquareMessage',_0x168f6a,JSON[_0xe812('0x17')](_0x551493));_0x1e05ab(_0x551493);})['catch'](function(_0x3a2455){logger['error'](_0xe812('0x12'),_0x3a2455['message'],_0x168f6a);_0x8a5e7d(_0x4b7d6e[_0xe812('0xd')](0x1f4,_0x3a2455[_0xe812('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index eac7d61..c1773f0 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 _0x844b=['delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','15s','post','create','put'];(function(_0x32239c,_0x279d71){var _0x9111dd=function(_0x414ecd){while(--_0x414ecd){_0x32239c['push'](_0x32239c['shift']());}};_0x9111dd(++_0x279d71);}(_0x844b,0x80));var _0xb844=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0x844b[_0x4cfa2e];return _0x279b50;};'use strict';var multer=require(_0xb844('0x0'));var util=require(_0xb844('0x1'));var path=require(_0xb844('0x2'));var timeout=require(_0xb844('0x3'));var express=require(_0xb844('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb844('0x5'));var interaction=require(_0xb844('0x6'));var config=require(_0xb844('0x7'));var controller=require(_0xb844('0x8'));router[_0xb844('0x9')]('/',auth['isAuthenticated'](),controller[_0xb844('0xa')]);router[_0xb844('0x9')](_0xb844('0xb'),auth[_0xb844('0xc')](),controller[_0xb844('0xd')]);router[_0xb844('0x9')](_0xb844('0xe'),auth['isAuthenticated'](),timeout(_0xb844('0xf')),controller['test']);router[_0xb844('0x10')]('/',auth[_0xb844('0xc')](),controller[_0xb844('0x11')]);router[_0xb844('0x12')]('/:id',auth[_0xb844('0xc')](),controller['update']);router[_0xb844('0x13')](_0xb844('0xb'),auth[_0xb844('0xc')](),controller['destroy']);module[_0xb844('0x14')]=router; \ No newline at end of file +var _0x9e75=['post','create','put','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','test'];(function(_0x447d73,_0x50f8c7){var _0x343b07=function(_0x467a77){while(--_0x467a77){_0x447d73['push'](_0x447d73['shift']());}};_0x343b07(++_0x50f8c7);}(_0x9e75,0x1a1));var _0x59e7=function(_0x3dd1af,_0x91f250){_0x3dd1af=_0x3dd1af-0x0;var _0x2f92a4=_0x9e75[_0x3dd1af];return _0x2f92a4;};'use strict';var multer=require(_0x59e7('0x0'));var util=require(_0x59e7('0x1'));var path=require('path');var timeout=require(_0x59e7('0x2'));var express=require(_0x59e7('0x3'));var router=express[_0x59e7('0x4')]();var fs_extra=require(_0x59e7('0x5'));var auth=require(_0x59e7('0x6'));var interaction=require(_0x59e7('0x7'));var config=require(_0x59e7('0x8'));var controller=require('./squareOdbc.controller');router[_0x59e7('0x9')]('/',auth[_0x59e7('0xa')](),controller[_0x59e7('0xb')]);router['get'](_0x59e7('0xc'),auth[_0x59e7('0xa')](),controller[_0x59e7('0xd')]);router[_0x59e7('0x9')]('/:id/test',auth[_0x59e7('0xa')](),timeout('15s'),controller[_0x59e7('0xe')]);router[_0x59e7('0xf')]('/',auth['isAuthenticated'](),controller[_0x59e7('0x10')]);router[_0x59e7('0x11')]('/:id',auth[_0x59e7('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 256bc4d..01af001 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 _0x1e13=['name','exports','STRING'];(function(_0xbfc51a,_0x1b3642){var _0x3bc5db=function(_0xf24669){while(--_0xf24669){_0xbfc51a['push'](_0xbfc51a['shift']());}};_0x3bc5db(++_0x1b3642);}(_0x1e13,0x184));var _0x31e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1e13[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x31e1('0x0')]={'name':{'type':Sequelize[_0x31e1('0x1')],'unique':_0x31e1('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x31e1('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd70c=['STRING','sequelize'];(function(_0x8aeb18,_0x33aba0){var _0x32d256=function(_0x35f2fb){while(--_0x35f2fb){_0x8aeb18['push'](_0x8aeb18['shift']());}};_0x32d256(++_0x33aba0);}(_0xd70c,0x1d5));var _0xcd70=function(_0x3c7ad2,_0x1e335b){_0x3c7ad2=_0x3c7ad2-0x0;var _0x5738b6=_0xd70c[_0x3c7ad2];return _0x5738b6;};'use strict';var Sequelize=require(_0xcd70('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd70('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcd70('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f819e24..3280c08 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 _0x7f89=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','ODBC','UserProfileResource','end','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','test','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2c2775,_0x195446){var _0x3bbad9=function(_0x7a7a71){while(--_0x7a7a71){_0x2c2775['push'](_0x2c2775['shift']());}};_0x3bbad9(++_0x195446);}(_0x7f89,0x149));var _0x97f8=function(_0x3662b4,_0x503b4d){_0x3662b4=_0x3662b4-0x0;var _0x50928c=_0x7f89[_0x3662b4];return _0x50928c;};'use strict';var emlformat=require(_0x97f8('0x0'));var rimraf=require(_0x97f8('0x1'));var zipdir=require(_0x97f8('0x2'));var jsonpatch=require(_0x97f8('0x3'));var rp=require(_0x97f8('0x4'));var moment=require('moment');var BPromise=require(_0x97f8('0x5'));var Mustache=require(_0x97f8('0x6'));var util=require(_0x97f8('0x7'));var path=require(_0x97f8('0x8'));var sox=require(_0x97f8('0x9'));var csv=require(_0x97f8('0xa'));var ejs=require(_0x97f8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x97f8('0xc'));var crypto=require(_0x97f8('0xd'));var jsforce=require(_0x97f8('0xe'));var deskjs=require(_0x97f8('0xf'));var toCsv=require(_0x97f8('0xa'));var querystring=require(_0x97f8('0x10'));var Papa=require(_0x97f8('0x11'));var Redis=require(_0x97f8('0x12'));var authService=require(_0x97f8('0x13'));var qs=require(_0x97f8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97f8('0x15'));var logger=require(_0x97f8('0x16'))(_0x97f8('0x17'));var utils=require('../../config/utils');var config=require(_0x97f8('0x18'));var licenseUtil=require(_0x97f8('0x19'));var db=require(_0x97f8('0x1a'))['db'];function respondWithStatusCode(_0x394100,_0x584b69){_0x584b69=_0x584b69||0xcc;return function(_0xd4ffb1){if(_0xd4ffb1){return _0x394100[_0x97f8('0x1b')](_0x584b69);}return _0x394100[_0x97f8('0x1c')](_0x584b69)['end']();};}function respondWithResult(_0x1a8b85,_0x44d740){_0x44d740=_0x44d740||0xc8;return function(_0x18d431){if(_0x18d431){return _0x1a8b85['status'](_0x44d740)[_0x97f8('0x1d')](_0x18d431);}};}function respondWithFilteredResult(_0x5ca165,_0x2187fa){return function(_0x92caac){if(_0x92caac){var _0x2f829b=typeof _0x2187fa[_0x97f8('0x1e')]===_0x97f8('0x1f')&&typeof _0x2187fa['limit']===_0x97f8('0x1f');var _0x25a019=_0x92caac[_0x97f8('0x20')];var _0x9ebf5c=_0x2f829b?0x0:_0x2187fa[_0x97f8('0x1e')];var _0xf77b94=_0x2f829b?_0x92caac[_0x97f8('0x20')]:_0x2187fa[_0x97f8('0x1e')]+_0x2187fa[_0x97f8('0x21')];var _0x346519;if(_0xf77b94>=_0x25a019){_0xf77b94=_0x25a019;_0x346519=0xc8;}else{_0x346519=0xce;}_0x5ca165[_0x97f8('0x1c')](_0x346519);return _0x5ca165['set'](_0x97f8('0x22'),_0x9ebf5c+'-'+_0xf77b94+'/'+_0x25a019)['json'](_0x92caac);}return null;};}function patchUpdates(_0x3535f8){return function(_0x1c819e){try{jsonpatch['apply'](_0x1c819e,_0x3535f8,!![]);}catch(_0x4c3640){return BPromise[_0x97f8('0x23')](_0x4c3640);}return _0x1c819e[_0x97f8('0x24')]();};}function saveUpdates(_0x160dd3,_0x2e749b){return function(_0x504dfd){if(_0x504dfd){return _0x504dfd[_0x97f8('0x25')](_0x160dd3)[_0x97f8('0x26')](function(_0x4fd204){return _0x4fd204;});}return null;};}function removeEntity(_0x2c5aa3,_0x3bf6b9){return function(_0x1829c0){if(_0x1829c0){return _0x1829c0['destroy']()['then'](function(){var _0x26589d=_0x1829c0['get']({'plain':!![]});var _0x17313c=_0x97f8('0x27');return db[_0x97f8('0x28')]['destroy']({'where':{'type':_0x17313c,'resourceId':_0x26589d['id']}})[_0x97f8('0x26')](function(){return _0x1829c0;});})[_0x97f8('0x26')](function(){_0x2c5aa3[_0x97f8('0x1c')](0xcc)[_0x97f8('0x29')]();});}};}function handleEntityNotFound(_0x51502c,_0x5531c8){return function(_0x5b84e5){if(!_0x5b84e5){_0x51502c['sendStatus'](0x194);}return _0x5b84e5;};}function handleError(_0x51ef8d,_0x21667f){_0x21667f=_0x21667f||0x1f4;return function(_0x205869){logger['error'](_0x205869[_0x97f8('0x2a')]);if(_0x205869[_0x97f8('0x2b')]){delete _0x205869[_0x97f8('0x2b')];}_0x51ef8d[_0x97f8('0x1c')](_0x21667f)['send'](_0x205869);};}exports[_0x97f8('0x2c')]=function(_0x1ae9e9,_0x58720a){var _0x1a1d16={},_0x353973={},_0x2f6051={'count':0x0,'rows':[]};var _0x12eec9=_[_0x97f8('0x2d')](db[_0x97f8('0x2e')][_0x97f8('0x2f')],function(_0x1745d7){return{'name':_0x1745d7[_0x97f8('0x30')],'type':_0x1745d7[_0x97f8('0x31')][_0x97f8('0x32')]};});_0x353973[_0x97f8('0x33')]=_[_0x97f8('0x2d')](_0x12eec9,_0x97f8('0x2b'));_0x353973[_0x97f8('0x34')]=_['keys'](_0x1ae9e9[_0x97f8('0x34')]);_0x353973[_0x97f8('0x35')]=_[_0x97f8('0x36')](_0x353973[_0x97f8('0x33')],_0x353973[_0x97f8('0x34')]);_0x1a1d16[_0x97f8('0x37')]=_['intersection'](_0x353973[_0x97f8('0x33')],qs[_0x97f8('0x38')](_0x1ae9e9[_0x97f8('0x34')][_0x97f8('0x38')]));_0x1a1d16[_0x97f8('0x37')]=_0x1a1d16[_0x97f8('0x37')][_0x97f8('0x39')]?_0x1a1d16[_0x97f8('0x37')]:_0x353973[_0x97f8('0x33')];if(!_0x1ae9e9['query']['hasOwnProperty']('nolimit')){_0x1a1d16['limit']=qs[_0x97f8('0x21')](_0x1ae9e9['query'][_0x97f8('0x21')]);_0x1a1d16[_0x97f8('0x1e')]=qs[_0x97f8('0x1e')](_0x1ae9e9[_0x97f8('0x34')]['offset']);}_0x1a1d16[_0x97f8('0x3a')]=qs[_0x97f8('0x3b')](_0x1ae9e9[_0x97f8('0x34')][_0x97f8('0x3b')]);_0x1a1d16['where']=qs[_0x97f8('0x35')](_[_0x97f8('0x3c')](_0x1ae9e9[_0x97f8('0x34')],_0x353973[_0x97f8('0x35')]),_0x12eec9);if(_0x1ae9e9['query'][_0x97f8('0x3d')]){_0x1a1d16[_0x97f8('0x3e')]=_[_0x97f8('0x3f')](_0x1a1d16['where'],{'$or':_['map'](_0x12eec9,function(_0x27f87c){if(_0x27f87c['type']!==_0x97f8('0x40')){var _0x2f9a34={};_0x2f9a34[_0x27f87c[_0x97f8('0x2b')]]={'$like':'%'+_0x1ae9e9[_0x97f8('0x34')][_0x97f8('0x3d')]+'%'};return _0x2f9a34;}})});}_0x1a1d16=_[_0x97f8('0x3f')]({},_0x1a1d16,_0x1ae9e9[_0x97f8('0x41')]);var _0x5ec2c6={'where':_0x1a1d16[_0x97f8('0x3e')]};return db[_0x97f8('0x2e')][_0x97f8('0x20')](_0x5ec2c6)[_0x97f8('0x26')](function(_0x5cd83e){_0x2f6051[_0x97f8('0x20')]=_0x5cd83e;if(_0x1ae9e9[_0x97f8('0x34')][_0x97f8('0x42')]){_0x1a1d16[_0x97f8('0x43')]=[{'all':!![]}];}return db[_0x97f8('0x2e')][_0x97f8('0x44')](_0x1a1d16);})[_0x97f8('0x26')](function(_0xa3e3ff){_0x2f6051[_0x97f8('0x45')]=_0xa3e3ff;return _0x2f6051;})[_0x97f8('0x26')](respondWithFilteredResult(_0x58720a,_0x1a1d16))['catch'](handleError(_0x58720a,null));};exports[_0x97f8('0x46')]=function(_0x3e878b,_0x55461b){var _0x376b43={'raw':!![],'where':{'id':_0x3e878b[_0x97f8('0x47')]['id']}},_0x7f19c={};_0x7f19c['model']=_['keys'](db[_0x97f8('0x2e')][_0x97f8('0x2f')]);_0x7f19c[_0x97f8('0x34')]=_[_0x97f8('0x48')](_0x3e878b[_0x97f8('0x34')]);_0x7f19c['filters']=_[_0x97f8('0x36')](_0x7f19c[_0x97f8('0x33')],_0x7f19c[_0x97f8('0x34')]);_0x376b43[_0x97f8('0x37')]=_[_0x97f8('0x36')](_0x7f19c['model'],qs['fields'](_0x3e878b['query'][_0x97f8('0x38')]));_0x376b43[_0x97f8('0x37')]=_0x376b43[_0x97f8('0x37')]['length']?_0x376b43[_0x97f8('0x37')]:_0x7f19c[_0x97f8('0x33')];if(_0x3e878b[_0x97f8('0x34')]['includeAll']){_0x376b43[_0x97f8('0x43')]=[{'all':!![]}];}_0x376b43=_['merge']({},_0x376b43,_0x3e878b[_0x97f8('0x41')]);return db[_0x97f8('0x2e')][_0x97f8('0x49')](_0x376b43)[_0x97f8('0x26')](handleEntityNotFound(_0x55461b,null))['then'](respondWithResult(_0x55461b,null))[_0x97f8('0x4a')](handleError(_0x55461b,null));};exports['create']=function(_0x994e88,_0x296cd0){return db[_0x97f8('0x2e')]['create'](_0x994e88[_0x97f8('0x4b')],{})['then'](function(_0x3ccd4e){var _0x2de78f=_0x994e88[_0x97f8('0x4c')][_0x97f8('0x4d')]({'plain':!![]});if(!_0x2de78f)throw new Error(_0x97f8('0x4e'));if(_0x2de78f[_0x97f8('0x4f')]===_0x97f8('0x4c')){var _0x2d7fd0=_0x3ccd4e[_0x97f8('0x4d')]({'plain':!![]});var _0x71d9f1=_0x97f8('0x27');return db[_0x97f8('0x50')][_0x97f8('0x49')]({'where':{'name':_0x71d9f1,'userProfileId':_0x2de78f[_0x97f8('0x51')]},'raw':!![]})['then'](function(_0x5b4125){if(_0x5b4125&&_0x5b4125[_0x97f8('0x52')]===0x0){return db[_0x97f8('0x28')][_0x97f8('0x53')]({'name':_0x2d7fd0[_0x97f8('0x2b')],'resourceId':_0x2d7fd0['id'],'type':_0x5b4125['name'],'sectionId':_0x5b4125['id']},{})[_0x97f8('0x26')](function(){return _0x3ccd4e;});}else{return _0x3ccd4e;}})[_0x97f8('0x4a')](function(_0x14d562){logger[_0x97f8('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14d562);throw _0x14d562;});}return _0x3ccd4e;})['then'](respondWithResult(_0x296cd0,0xc9))[_0x97f8('0x4a')](handleError(_0x296cd0,null));};exports[_0x97f8('0x25')]=function(_0x3ad080,_0x22bcf7){if(_0x3ad080[_0x97f8('0x4b')]['id']){delete _0x3ad080[_0x97f8('0x4b')]['id'];}return db['SquareOdbc'][_0x97f8('0x49')]({'where':{'id':_0x3ad080[_0x97f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x22bcf7,null))[_0x97f8('0x26')](saveUpdates(_0x3ad080[_0x97f8('0x4b')],null))['then'](respondWithResult(_0x22bcf7,null))['catch'](handleError(_0x22bcf7,null));};exports['destroy']=function(_0x405df2,_0x47dd88){return db[_0x97f8('0x2e')][_0x97f8('0x49')]({'where':{'id':_0x405df2[_0x97f8('0x47')]['id']}})[_0x97f8('0x26')](handleEntityNotFound(_0x47dd88,null))[_0x97f8('0x26')](removeEntity(_0x47dd88,null))[_0x97f8('0x4a')](handleError(_0x47dd88,null));};exports[_0x97f8('0x55')]=function(_0x1e56f6,_0x20f01e,_0x4ee7d9){var _0x2d6937;return db['SquareOdbc']['find']({'where':{'id':_0x1e56f6[_0x97f8('0x47')]['id']},'attributes':['id',_0x97f8('0x56')]})[_0x97f8('0x26')](handleEntityNotFound(_0x20f01e,null))[_0x97f8('0x26')](function(_0x26af9e){if(_0x26af9e){var _0x3f8eb5=require('odbc')();_0x3f8eb5['openSync'](_0x26af9e[_0x97f8('0x56')]);_0x3f8eb5[_0x97f8('0x57')]();return _0x26af9e;}})[_0x97f8('0x26')](respondWithResult(_0x20f01e,null))[_0x97f8('0x4a')](handleError(_0x20f01e,null));}; \ No newline at end of file +var _0xf66f=['count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ODBC','error','name','send','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit'];(function(_0x1f0e7c,_0x174dfc){var _0x795b2a=function(_0x462300){while(--_0x462300){_0x1f0e7c['push'](_0x1f0e7c['shift']());}};_0x795b2a(++_0x174dfc);}(_0xf66f,0xd8));var _0xff66=function(_0x545dd8,_0x404f75){_0x545dd8=_0x545dd8-0x0;var _0x44cd80=_0xf66f[_0x545dd8];return _0x44cd80;};'use strict';var emlformat=require(_0xff66('0x0'));var rimraf=require(_0xff66('0x1'));var zipdir=require(_0xff66('0x2'));var jsonpatch=require(_0xff66('0x3'));var rp=require(_0xff66('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff66('0x5'));var util=require(_0xff66('0x6'));var path=require(_0xff66('0x7'));var sox=require('sox');var csv=require(_0xff66('0x8'));var ejs=require(_0xff66('0x9'));var fs=require('fs');var fs_extra=require(_0xff66('0xa'));var _=require(_0xff66('0xb'));var squel=require(_0xff66('0xc'));var crypto=require(_0xff66('0xd'));var jsforce=require(_0xff66('0xe'));var deskjs=require(_0xff66('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xff66('0x10'));var qs=require(_0xff66('0x11'));var as=require(_0xff66('0x12'));var hardwareService=require(_0xff66('0x13'));var logger=require('../../config/logger')(_0xff66('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xff66('0x15'));var db=require(_0xff66('0x16'))['db'];function respondWithStatusCode(_0x15ae46,_0x2d1e88){_0x2d1e88=_0x2d1e88||0xcc;return function(_0x6edc5a){if(_0x6edc5a){return _0x15ae46['sendStatus'](_0x2d1e88);}return _0x15ae46[_0xff66('0x17')](_0x2d1e88)['end']();};}function respondWithResult(_0x5c7e04,_0x278b0a){_0x278b0a=_0x278b0a||0xc8;return function(_0x1d36d8){if(_0x1d36d8){return _0x5c7e04[_0xff66('0x17')](_0x278b0a)['json'](_0x1d36d8);}};}function respondWithFilteredResult(_0xa596da,_0x1be0d5){return function(_0xdb9ba9){if(_0xdb9ba9){var _0x2fce43=typeof _0x1be0d5[_0xff66('0x18')]===_0xff66('0x19')&&typeof _0x1be0d5[_0xff66('0x1a')]===_0xff66('0x19');var _0x28e00c=_0xdb9ba9[_0xff66('0x1b')];var _0x3f7c36=_0x2fce43?0x0:_0x1be0d5[_0xff66('0x18')];var _0x1c7182=_0x2fce43?_0xdb9ba9[_0xff66('0x1b')]:_0x1be0d5['offset']+_0x1be0d5[_0xff66('0x1a')];var _0x41841e;if(_0x1c7182>=_0x28e00c){_0x1c7182=_0x28e00c;_0x41841e=0xc8;}else{_0x41841e=0xce;}_0xa596da['status'](_0x41841e);return _0xa596da[_0xff66('0x1c')](_0xff66('0x1d'),_0x3f7c36+'-'+_0x1c7182+'/'+_0x28e00c)[_0xff66('0x1e')](_0xdb9ba9);}return null;};}function patchUpdates(_0x37b485){return function(_0x444e6c){try{jsonpatch[_0xff66('0x1f')](_0x444e6c,_0x37b485,!![]);}catch(_0x17bef7){return BPromise[_0xff66('0x20')](_0x17bef7);}return _0x444e6c[_0xff66('0x21')]();};}function saveUpdates(_0x16c433,_0x2fb3de){return function(_0x26f5f5){if(_0x26f5f5){return _0x26f5f5[_0xff66('0x22')](_0x16c433)[_0xff66('0x23')](function(_0x3ad748){return _0x3ad748;});}return null;};}function removeEntity(_0x53256b,_0x4d0034){return function(_0x5c4efc){if(_0x5c4efc){return _0x5c4efc[_0xff66('0x24')]()[_0xff66('0x23')](function(){var _0x16fc22=_0x5c4efc[_0xff66('0x25')]({'plain':!![]});var _0x4bf21f=_0xff66('0x26');return db['UserProfileResource'][_0xff66('0x24')]({'where':{'type':_0x4bf21f,'resourceId':_0x16fc22['id']}})[_0xff66('0x23')](function(){return _0x5c4efc;});})[_0xff66('0x23')](function(){_0x53256b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x118f0c,_0xf1f400){return function(_0x7132fb){if(!_0x7132fb){_0x118f0c['sendStatus'](0x194);}return _0x7132fb;};}function handleError(_0x403a9c,_0x2c1149){_0x2c1149=_0x2c1149||0x1f4;return function(_0x382c03){logger[_0xff66('0x27')](_0x382c03['stack']);if(_0x382c03[_0xff66('0x28')]){delete _0x382c03['name'];}_0x403a9c[_0xff66('0x17')](_0x2c1149)[_0xff66('0x29')](_0x382c03);};}exports['index']=function(_0xe7ff2d,_0x4a8829){var _0x190e35={},_0x44e773={},_0x5c0bbe={'count':0x0,'rows':[]};var _0x1681fa=_[_0xff66('0x2a')](db[_0xff66('0x2b')]['rawAttributes'],function(_0x46363a){return{'name':_0x46363a[_0xff66('0x2c')],'type':_0x46363a[_0xff66('0x2d')][_0xff66('0x2e')]};});_0x44e773[_0xff66('0x2f')]=_['map'](_0x1681fa,_0xff66('0x28'));_0x44e773[_0xff66('0x30')]=_['keys'](_0xe7ff2d[_0xff66('0x30')]);_0x44e773[_0xff66('0x31')]=_[_0xff66('0x32')](_0x44e773[_0xff66('0x2f')],_0x44e773[_0xff66('0x30')]);_0x190e35[_0xff66('0x33')]=_[_0xff66('0x32')](_0x44e773[_0xff66('0x2f')],qs[_0xff66('0x34')](_0xe7ff2d['query'][_0xff66('0x34')]));_0x190e35['attributes']=_0x190e35[_0xff66('0x33')]['length']?_0x190e35[_0xff66('0x33')]:_0x44e773[_0xff66('0x2f')];if(!_0xe7ff2d[_0xff66('0x30')][_0xff66('0x35')](_0xff66('0x36'))){_0x190e35[_0xff66('0x1a')]=qs[_0xff66('0x1a')](_0xe7ff2d['query'][_0xff66('0x1a')]);_0x190e35['offset']=qs['offset'](_0xe7ff2d[_0xff66('0x30')][_0xff66('0x18')]);}_0x190e35['order']=qs[_0xff66('0x37')](_0xe7ff2d[_0xff66('0x30')][_0xff66('0x37')]);_0x190e35[_0xff66('0x38')]=qs['filters'](_[_0xff66('0x39')](_0xe7ff2d[_0xff66('0x30')],_0x44e773[_0xff66('0x31')]),_0x1681fa);if(_0xe7ff2d[_0xff66('0x30')][_0xff66('0x3a')]){_0x190e35[_0xff66('0x38')]=_[_0xff66('0x3b')](_0x190e35[_0xff66('0x38')],{'$or':_[_0xff66('0x2a')](_0x1681fa,function(_0xc530de){if(_0xc530de[_0xff66('0x2d')]!==_0xff66('0x3c')){var _0x503bd0={};_0x503bd0[_0xc530de[_0xff66('0x28')]]={'$like':'%'+_0xe7ff2d[_0xff66('0x30')][_0xff66('0x3a')]+'%'};return _0x503bd0;}})});}_0x190e35=_[_0xff66('0x3b')]({},_0x190e35,_0xe7ff2d['options']);var _0x5b59f2={'where':_0x190e35[_0xff66('0x38')]};return db[_0xff66('0x2b')][_0xff66('0x1b')](_0x5b59f2)[_0xff66('0x23')](function(_0x29754a){_0x5c0bbe[_0xff66('0x1b')]=_0x29754a;if(_0xe7ff2d[_0xff66('0x30')]['includeAll']){_0x190e35[_0xff66('0x3d')]=[{'all':!![]}];}return db[_0xff66('0x2b')][_0xff66('0x3e')](_0x190e35);})[_0xff66('0x23')](function(_0x3b022c){_0x5c0bbe['rows']=_0x3b022c;return _0x5c0bbe;})[_0xff66('0x23')](respondWithFilteredResult(_0x4a8829,_0x190e35))[_0xff66('0x3f')](handleError(_0x4a8829,null));};exports[_0xff66('0x40')]=function(_0x4b3ceb,_0x1ca504){var _0x2269c3={'raw':!![],'where':{'id':_0x4b3ceb[_0xff66('0x41')]['id']}},_0x4ce8ca={};_0x4ce8ca['model']=_['keys'](db['SquareOdbc'][_0xff66('0x42')]);_0x4ce8ca[_0xff66('0x30')]=_['keys'](_0x4b3ceb[_0xff66('0x30')]);_0x4ce8ca['filters']=_[_0xff66('0x32')](_0x4ce8ca[_0xff66('0x2f')],_0x4ce8ca['query']);_0x2269c3['attributes']=_[_0xff66('0x32')](_0x4ce8ca[_0xff66('0x2f')],qs[_0xff66('0x34')](_0x4b3ceb[_0xff66('0x30')][_0xff66('0x34')]));_0x2269c3[_0xff66('0x33')]=_0x2269c3[_0xff66('0x33')]['length']?_0x2269c3[_0xff66('0x33')]:_0x4ce8ca[_0xff66('0x2f')];if(_0x4b3ceb[_0xff66('0x30')][_0xff66('0x43')]){_0x2269c3['include']=[{'all':!![]}];}_0x2269c3=_[_0xff66('0x3b')]({},_0x2269c3,_0x4b3ceb[_0xff66('0x44')]);return db[_0xff66('0x2b')][_0xff66('0x45')](_0x2269c3)[_0xff66('0x23')](handleEntityNotFound(_0x1ca504,null))['then'](respondWithResult(_0x1ca504,null))[_0xff66('0x3f')](handleError(_0x1ca504,null));};exports[_0xff66('0x46')]=function(_0x4c0c6b,_0xb3e6bf){return db[_0xff66('0x2b')]['create'](_0x4c0c6b[_0xff66('0x47')],{})[_0xff66('0x23')](function(_0x4fe881){var _0x5eb66b=_0x4c0c6b['user'][_0xff66('0x25')]({'plain':!![]});if(!_0x5eb66b)throw new Error(_0xff66('0x48'));if(_0x5eb66b[_0xff66('0x49')]===_0xff66('0x4a')){var _0x40bfce=_0x4fe881[_0xff66('0x25')]({'plain':!![]});var _0x41975b='ODBC';return db[_0xff66('0x4b')]['find']({'where':{'name':_0x41975b,'userProfileId':_0x5eb66b['userProfileId']},'raw':!![]})[_0xff66('0x23')](function(_0x58fcf6){if(_0x58fcf6&&_0x58fcf6['autoAssociation']===0x0){return db[_0xff66('0x4c')][_0xff66('0x46')]({'name':_0x40bfce['name'],'resourceId':_0x40bfce['id'],'type':_0x58fcf6['name'],'sectionId':_0x58fcf6['id']},{})[_0xff66('0x23')](function(){return _0x4fe881;});}else{return _0x4fe881;}})[_0xff66('0x3f')](function(_0x1a8d1c){logger[_0xff66('0x27')](_0xff66('0x4d'),_0x1a8d1c);throw _0x1a8d1c;});}return _0x4fe881;})[_0xff66('0x23')](respondWithResult(_0xb3e6bf,0xc9))[_0xff66('0x3f')](handleError(_0xb3e6bf,null));};exports[_0xff66('0x22')]=function(_0xfdbf,_0x13a9de){if(_0xfdbf[_0xff66('0x47')]['id']){delete _0xfdbf[_0xff66('0x47')]['id'];}return db[_0xff66('0x2b')][_0xff66('0x45')]({'where':{'id':_0xfdbf[_0xff66('0x41')]['id']}})['then'](handleEntityNotFound(_0x13a9de,null))['then'](saveUpdates(_0xfdbf[_0xff66('0x47')],null))[_0xff66('0x23')](respondWithResult(_0x13a9de,null))[_0xff66('0x3f')](handleError(_0x13a9de,null));};exports[_0xff66('0x24')]=function(_0x394af9,_0x3b4069){return db['SquareOdbc'][_0xff66('0x45')]({'where':{'id':_0x394af9[_0xff66('0x41')]['id']}})[_0xff66('0x23')](handleEntityNotFound(_0x3b4069,null))[_0xff66('0x23')](removeEntity(_0x3b4069,null))[_0xff66('0x3f')](handleError(_0x3b4069,null));};exports[_0xff66('0x4e')]=function(_0x451440,_0x27b673,_0x4a801c){var _0x932119;return db[_0xff66('0x2b')][_0xff66('0x45')]({'where':{'id':_0x451440[_0xff66('0x41')]['id']},'attributes':['id',_0xff66('0x4f')]})[_0xff66('0x23')](handleEntityNotFound(_0x27b673,null))[_0xff66('0x23')](function(_0x2a2f45){if(_0x2a2f45){var _0x396d4b=require(_0xff66('0x50'))();_0x396d4b['openSync'](_0x2a2f45[_0xff66('0x4f')]);_0x396d4b['closeSync']();return _0x2a2f45;}})[_0xff66('0x23')](respondWithResult(_0x27b673,null))[_0xff66('0x3f')](handleError(_0x27b673,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c72282a..27693e1 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 _0x83df=['exports','define','SquareOdbc','util','../../config/logger','bluebird','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x5c51b2,_0x577f30){var _0x3970eb=function(_0x43327b){while(--_0x43327b){_0x5c51b2['push'](_0x5c51b2['shift']());}};_0x3970eb(++_0x577f30);}(_0x83df,0x159));var _0xf83d=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0x83df[_0x16eb11];return _0x3ae7ef;};'use strict';var _=require('lodash');var util=require(_0xf83d('0x0'));var logger=require(_0xf83d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf83d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf83d('0x3'));var config=require(_0xf83d('0x4'));var attributes=require(_0xf83d('0x5'));module[_0xf83d('0x6')]=function(_0x2ae173,_0x2fa92f){return _0x2ae173[_0xf83d('0x7')](_0xf83d('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb21=['request-promise','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird'];(function(_0x54a5fb,_0x2df3e2){var _0x538f68=function(_0x4f9be4){while(--_0x4f9be4){_0x54a5fb['push'](_0x54a5fb['shift']());}};_0x538f68(++_0x2df3e2);}(_0xcb21,0x159));var _0x1cb2=function(_0x2da61b,_0xd52a4c){_0x2da61b=_0x2da61b-0x0;var _0x3e01fc=_0xcb21[_0x2da61b];return _0x3e01fc;};'use strict';var _=require(_0x1cb2('0x0'));var util=require(_0x1cb2('0x1'));var logger=require(_0x1cb2('0x2'))(_0x1cb2('0x3'));var moment=require('moment');var BPromise=require(_0x1cb2('0x4'));var rp=require(_0x1cb2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1cb2('0x6'));module[_0x1cb2('0x7')]=function(_0x5ade6a,_0x7a7b25){return _0x5ade6a['define'](_0x1cb2('0x8'),attributes,{'tableName':_0x1cb2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 0f44279..5e8573c 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 _0x33f0=['../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b5e13,_0x376b25){var _0x1a6fba=function(_0x423e0f){while(--_0x423e0f){_0x4b5e13['push'](_0x4b5e13['shift']());}};_0x1a6fba(++_0x376b25);}(_0x33f0,0x19e));var _0x033f=function(_0x4bcd80,_0x8a825a){_0x4bcd80=_0x4bcd80-0x0;var _0x1d31a3=_0x33f0[_0x4bcd80];return _0x1d31a3;};'use strict';var _=require('lodash');var util=require(_0x033f('0x0'));var moment=require(_0x033f('0x1'));var BPromise=require(_0x033f('0x2'));var rs=require(_0x033f('0x3'));var fs=require('fs');var Redis=require(_0x033f('0x4'));var db=require(_0x033f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x033f('0x6'));var jayson=require(_0x033f('0x7'));var client=jayson[_0x033f('0x8')][_0x033f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46b093,_0x5940a9,_0x594aa8){return new BPromise(function(_0x4f125d,_0x652273){return client[_0x033f('0xa')](_0x46b093,_0x594aa8)[_0x033f('0xb')](function(_0x3073a0){logger[_0x033f('0xc')](_0x033f('0xd'),_0x5940a9,'request\x20sent');logger[_0x033f('0xe')](_0x033f('0xf'),_0x5940a9,_0x033f('0x10'),JSON['stringify'](_0x3073a0));if(_0x3073a0['error']){if(_0x3073a0[_0x033f('0x11')]['code']===0x1f4){logger[_0x033f('0x11')](_0x033f('0xd'),_0x5940a9,_0x3073a0[_0x033f('0x11')][_0x033f('0x12')]);return _0x652273(_0x3073a0[_0x033f('0x11')][_0x033f('0x12')]);}logger[_0x033f('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x5940a9,_0x3073a0[_0x033f('0x11')]['message']);return _0x4f125d(_0x3073a0[_0x033f('0x11')][_0x033f('0x12')]);}else{logger[_0x033f('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x5940a9,_0x033f('0x10'));_0x4f125d(_0x3073a0['result'][_0x033f('0x12')]);}})['catch'](function(_0x4eef4a){logger['error'](_0x033f('0xd'),_0x5940a9,_0x4eef4a);_0x652273(_0x4eef4a);});});}exports[_0x033f('0x13')]=function(_0x56e14a){var _0x514598=this;return new Promise(function(_0x17f62e,_0x56592e){return db['SquareOdbc'][_0x033f('0x14')]({'raw':_0x56e14a[_0x033f('0x15')]?_0x56e14a[_0x033f('0x15')][_0x033f('0x16')]===undefined?!![]:![]:!![],'where':_0x56e14a['options']?_0x56e14a[_0x033f('0x15')][_0x033f('0x17')]||null:null,'attributes':_0x56e14a[_0x033f('0x15')]?_0x56e14a[_0x033f('0x15')][_0x033f('0x18')]||null:null,'include':_0x56e14a[_0x033f('0x15')]?_0x56e14a[_0x033f('0x15')][_0x033f('0x19')]?_[_0x033f('0x1a')](_0x56e14a[_0x033f('0x15')][_0x033f('0x19')],function(_0x35f6ab){return{'model':db[_0x35f6ab[_0x033f('0x1b')]],'as':_0x35f6ab['as'],'attributes':_0x35f6ab[_0x033f('0x18')],'include':_0x35f6ab[_0x033f('0x19')]?_['map'](_0x35f6ab[_0x033f('0x19')],function(_0x4780ee){return{'model':db[_0x4780ee['model']],'as':_0x4780ee['as'],'attributes':_0x4780ee[_0x033f('0x18')],'include':_0x4780ee['include']?_['map'](_0x4780ee[_0x033f('0x19')],function(_0x17f63f){return{'model':db[_0x17f63f[_0x033f('0x1b')]],'as':_0x17f63f['as'],'attributes':_0x17f63f[_0x033f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x033f('0xb')](function(_0x91027c){logger[_0x033f('0xc')]('ShowSquareOdbc',_0x56e14a);logger[_0x033f('0xe')]('ShowSquareOdbc',_0x56e14a,JSON[_0x033f('0x1c')](_0x91027c));_0x17f62e(_0x91027c);})[_0x033f('0x1d')](function(_0x5254f5){logger[_0x033f('0x11')](_0x033f('0x13'),_0x5254f5[_0x033f('0x12')],_0x56e14a);_0x56592e(_0x514598[_0x033f('0x11')](0x1f4,_0x5254f5[_0x033f('0x12')]));});});}; \ No newline at end of file +var _0x789d=['options','raw','where','attributes','include','map','model','lodash','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find'];(function(_0x1830ce,_0x305798){var _0x2bce9f=function(_0x9ea7dc){while(--_0x9ea7dc){_0x1830ce['push'](_0x1830ce['shift']());}};_0x2bce9f(++_0x305798);}(_0x789d,0x1f4));var _0xd789=function(_0x4d9834,_0x2f2391){_0x4d9834=_0x4d9834-0x0;var _0xcccf5c=_0x789d[_0x4d9834];return _0xcccf5c;};'use strict';var _=require(_0xd789('0x0'));var util=require('util');var moment=require(_0xd789('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd789('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd789('0x3'))(_0xd789('0x4'));var config=require(_0xd789('0x5'));var jayson=require(_0xd789('0x6'));var client=jayson[_0xd789('0x7')][_0xd789('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14a613,_0x2fe71c,_0x4a26d2){return new BPromise(function(_0xde6d5d,_0x292f56){return client[_0xd789('0x9')](_0x14a613,_0x4a26d2)['then'](function(_0x332fc2){logger[_0xd789('0xa')](_0xd789('0xb'),_0x2fe71c,_0xd789('0xc'));logger['debug'](_0xd789('0xd'),_0x2fe71c,_0xd789('0xc'),JSON[_0xd789('0xe')](_0x332fc2));if(_0x332fc2[_0xd789('0xf')]){if(_0x332fc2['error'][_0xd789('0x10')]===0x1f4){logger['error'](_0xd789('0xb'),_0x2fe71c,_0x332fc2['error'][_0xd789('0x11')]);return _0x292f56(_0x332fc2[_0xd789('0xf')][_0xd789('0x11')]);}logger[_0xd789('0xf')](_0xd789('0xb'),_0x2fe71c,_0x332fc2['error'][_0xd789('0x11')]);return _0xde6d5d(_0x332fc2[_0xd789('0xf')][_0xd789('0x11')]);}else{logger['info'](_0xd789('0xb'),_0x2fe71c,_0xd789('0xc'));_0xde6d5d(_0x332fc2[_0xd789('0x12')][_0xd789('0x11')]);}})[_0xd789('0x13')](function(_0x4e5faa){logger[_0xd789('0xf')](_0xd789('0xb'),_0x2fe71c,_0x4e5faa);_0x292f56(_0x4e5faa);});});}exports[_0xd789('0x14')]=function(_0x8c08ec){var _0x3dbf0f=this;return new Promise(function(_0x2befcc,_0x185b07){return db['SquareOdbc'][_0xd789('0x15')]({'raw':_0x8c08ec['options']?_0x8c08ec[_0xd789('0x16')][_0xd789('0x17')]===undefined?!![]:![]:!![],'where':_0x8c08ec[_0xd789('0x16')]?_0x8c08ec[_0xd789('0x16')][_0xd789('0x18')]||null:null,'attributes':_0x8c08ec['options']?_0x8c08ec[_0xd789('0x16')][_0xd789('0x19')]||null:null,'include':_0x8c08ec['options']?_0x8c08ec[_0xd789('0x16')][_0xd789('0x1a')]?_[_0xd789('0x1b')](_0x8c08ec['options'][_0xd789('0x1a')],function(_0x1ba896){return{'model':db[_0x1ba896[_0xd789('0x1c')]],'as':_0x1ba896['as'],'attributes':_0x1ba896['attributes'],'include':_0x1ba896[_0xd789('0x1a')]?_[_0xd789('0x1b')](_0x1ba896['include'],function(_0x13dfb3){return{'model':db[_0x13dfb3[_0xd789('0x1c')]],'as':_0x13dfb3['as'],'attributes':_0x13dfb3[_0xd789('0x19')],'include':_0x13dfb3[_0xd789('0x1a')]?_[_0xd789('0x1b')](_0x13dfb3['include'],function(_0x20889f){return{'model':db[_0x20889f[_0xd789('0x1c')]],'as':_0x20889f['as'],'attributes':_0x20889f[_0xd789('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdebae0){logger['info']('ShowSquareOdbc',_0x8c08ec);logger['debug']('ShowSquareOdbc',_0x8c08ec,JSON[_0xd789('0xe')](_0xdebae0));_0x2befcc(_0xdebae0);})['catch'](function(_0x4eff4c){logger[_0xd789('0xf')](_0xd789('0x14'),_0x4eff4c['message'],_0x8c08ec);_0x185b07(_0x3dbf0f['error'](0x1f4,_0x4eff4c[_0xd789('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f8a439b..765856a 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 _0x720a=['/:id','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','get','post','isAuthenticated','create','put'];(function(_0x3c0a36,_0x8e2f2b){var _0x5ac4cb=function(_0x42b695){while(--_0x42b695){_0x3c0a36['push'](_0x3c0a36['shift']());}};_0x5ac4cb(++_0x8e2f2b);}(_0x720a,0x17d));var _0xa720=function(_0x54e0c5,_0x40fd32){_0x54e0c5=_0x54e0c5-0x0;var _0x13a1d5=_0x720a[_0x54e0c5];return _0x13a1d5;};'use strict';var multer=require(_0xa720('0x0'));var util=require(_0xa720('0x1'));var path=require('path');var timeout=require(_0xa720('0x2'));var express=require(_0xa720('0x3'));var router=express[_0xa720('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa720('0x5'));var interaction=require(_0xa720('0x6'));var config=require(_0xa720('0x7'));var controller=require(_0xa720('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa720('0x9')]);router[_0xa720('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa720('0xb')]('/',auth[_0xa720('0xc')](),controller[_0xa720('0xd')]);router[_0xa720('0xe')](_0xa720('0xf'),auth['isAuthenticated'](),controller[_0xa720('0x10')]);router[_0xa720('0x11')](_0xa720('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbfa5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x14f16e,_0x75f5fc){var _0x39f46b=function(_0x19ab98){while(--_0x19ab98){_0x14f16e['push'](_0x14f16e['shift']());}};_0x39f46b(++_0x75f5fc);}(_0xbfa5,0x140));var _0x5bfa=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xbfa5[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x5bfa('0x0'));var util=require('util');var path=require(_0x5bfa('0x1'));var timeout=require(_0x5bfa('0x2'));var express=require(_0x5bfa('0x3'));var router=express[_0x5bfa('0x4')]();var fs_extra=require(_0x5bfa('0x5'));var auth=require(_0x5bfa('0x6'));var interaction=require(_0x5bfa('0x7'));var config=require('../../config/environment');var controller=require(_0x5bfa('0x8'));router[_0x5bfa('0x9')]('/',auth[_0x5bfa('0xa')](),controller[_0x5bfa('0xb')]);router['get']('/:id',auth[_0x5bfa('0xa')](),controller['show']);router['post']('/',auth[_0x5bfa('0xa')](),controller[_0x5bfa('0xc')]);router[_0x5bfa('0xd')](_0x5bfa('0xe'),auth['isAuthenticated'](),controller[_0x5bfa('0xf')]);router[_0x5bfa('0x10')](_0x5bfa('0xe'),auth[_0x5bfa('0xa')](),controller['destroy']);module[_0x5bfa('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4d6f582..19ddba8 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 _0x9ec0=['name','TEXT','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING'];(function(_0x29caf3,_0x88a317){var _0x3dc931=function(_0x228469){while(--_0x228469){_0x29caf3['push'](_0x29caf3['shift']());}};_0x3dc931(++_0x88a317);}(_0x9ec0,0x1b9));var _0x09ec=function(_0x3f8965,_0x3c80b9){_0x3f8965=_0x3f8965-0x0;var _0xcdf5c9=_0x9ec0[_0x3f8965];return _0xcdf5c9;};'use strict';var Sequelize=require(_0x09ec('0x0'));module[_0x09ec('0x1')]={'name':{'type':Sequelize[_0x09ec('0x2')],'unique':_0x09ec('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x09ec('0x2')]},'notes':{'type':Sequelize[_0x09ec('0x4')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x09ec('0x5')](_0x09ec('0x6'))){return this['getDataValue'](_0x09ec('0x6'))[_0x09ec('0x7')](_0x09ec('0x8'));}}},'production':{'type':Sequelize[_0x09ec('0x9')]('long'),'get':function(){if(this[_0x09ec('0x5')](_0x09ec('0xa'))){return this[_0x09ec('0x5')](_0x09ec('0xa'))[_0x09ec('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0x09ec('0xb')]},'publishedAt':{'type':Sequelize[_0x09ec('0xb')]}}; \ No newline at end of file +var _0x36e0=['STRING','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','name'];(function(_0x131489,_0x5be21c){var _0x22dddf=function(_0xb9d818){while(--_0xb9d818){_0x131489['push'](_0x131489['shift']());}};_0x22dddf(++_0x5be21c);}(_0x36e0,0x15c));var _0x036e=function(_0x28e72a,_0xb4eb35){_0x28e72a=_0x28e72a-0x0;var _0x750255=_0x36e0[_0x28e72a];return _0x750255;};'use strict';var Sequelize=require(_0x036e('0x0'));module[_0x036e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x036e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x036e('0x3')]},'notes':{'type':Sequelize[_0x036e('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x036e('0x5')),'get':function(){if(this[_0x036e('0x6')]('preproduction')){return this[_0x036e('0x6')](_0x036e('0x7'))[_0x036e('0x8')](_0x036e('0x9'));}}},'production':{'type':Sequelize[_0x036e('0xa')](_0x036e('0x5')),'get':function(){if(this[_0x036e('0x6')]('production')){return this['getDataValue'](_0x036e('0xb'))[_0x036e('0x8')](_0x036e('0x9'));}}},'savedAt':{'type':Sequelize[_0x036e('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ff79011..e785de6 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 _0x66a6=['update','then','SquareProjects','UserProfileResource','destroy','publish','stringify','end','sendStatus','name','status','send','index','map','SquareProject','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','user','get','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','agi','pick','production','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','json','undefined','limit','count','set','Content-Range'];(function(_0x43b4b5,_0x3efc1b){var _0x2df432=function(_0x10b3bb){while(--_0x10b3bb){_0x43b4b5['push'](_0x43b4b5['shift']());}};_0x2df432(++_0x3efc1b);}(_0x66a6,0x1c0));var _0x666a=function(_0x2378ce,_0x1ae0fb){_0x2378ce=_0x2378ce-0x0;var _0x18cfa8=_0x66a6[_0x2378ce];return _0x18cfa8;};'use strict';var _=require(_0x666a('0x0'));var Redis=require('ioredis');var qs=require(_0x666a('0x1'));var logger=require(_0x666a('0x2'))('api');var config=require(_0x666a('0x3'));var db=require(_0x666a('0x4'))['db'];config[_0x666a('0x5')]=_[_0x666a('0x6')](config[_0x666a('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x666a('0x5')]));require(_0x666a('0x7'))['register'](socket);function respondWithResult(_0x28694f,_0x5d1190){_0x5d1190=_0x5d1190||0xc8;return function(_0x157faa){if(_0x157faa){return _0x28694f['status'](_0x5d1190)[_0x666a('0x8')](_0x157faa);}};}function respondWithFilteredResult(_0x4964e9,_0x2272ba){return function(_0x11e170){if(_0x11e170){var _0x14aef8=typeof _0x2272ba['offset']===_0x666a('0x9')&&typeof _0x2272ba[_0x666a('0xa')]===_0x666a('0x9');var _0x37e13a=_0x11e170[_0x666a('0xb')];var _0x349f55=_0x14aef8?0x0:_0x2272ba['offset'];var _0x295809=_0x14aef8?_0x11e170[_0x666a('0xb')]:_0x2272ba['offset']+_0x2272ba['limit'];var _0x34d008;if(_0x295809>=_0x37e13a){_0x295809=_0x37e13a;_0x34d008=0xc8;}else{_0x34d008=0xce;}_0x4964e9['status'](_0x34d008);return _0x4964e9[_0x666a('0xc')](_0x666a('0xd'),_0x349f55+'-'+_0x295809+'/'+_0x37e13a)['json'](_0x11e170);}return null;};}function saveUpdates(_0x310009){return function(_0x4a4a1b){if(_0x4a4a1b){return _0x4a4a1b[_0x666a('0xe')](_0x310009)['then'](function(_0x639dd2){return _0x639dd2;});}return null;};}function removeEntity(_0x507df8){return function(_0x14fb3b){if(_0x14fb3b){return _0x14fb3b['destroy']()[_0x666a('0xf')](function(){var _0x2dd00f=_0x14fb3b['get']({'plain':!![]});var _0x3db5ce=_0x666a('0x10');return db[_0x666a('0x11')][_0x666a('0x12')]({'where':{'type':_0x3db5ce,'resourceId':_0x2dd00f['id']}})[_0x666a('0xf')](function(){return _0x14fb3b;});})[_0x666a('0xf')](function(){var _0x4b7b4a=new Redis(config[_0x666a('0x5')]);_0x4b7b4a[_0x666a('0x13')]('agi',JSON[_0x666a('0x14')]({'id':_0x14fb3b['id'],'deleted':!![]}));})['then'](function(){_0x507df8['status'](0xcc)[_0x666a('0x15')]();});}};}function handleEntityNotFound(_0x4c6412){return function(_0x348420){if(!_0x348420){_0x4c6412[_0x666a('0x16')](0x194);}return _0x348420;};}function handleError(_0x1f1cea,_0x4487c8){_0x4487c8=_0x4487c8||0x1f4;return function(_0x546b01){logger['error'](_0x546b01['stack']);if(_0x546b01[_0x666a('0x17')]){delete _0x546b01[_0x666a('0x17')];}_0x1f1cea[_0x666a('0x18')](_0x4487c8)[_0x666a('0x19')](_0x546b01);};}exports[_0x666a('0x1a')]=function(_0x20d27f,_0x4cc909){var _0x2af91b={},_0x41df5f={},_0x5cda41={'count':0x0,'rows':[]};var _0x4e5b9a=_[_0x666a('0x1b')](db[_0x666a('0x1c')][_0x666a('0x1d')],function(_0x3e0dd1){return{'name':_0x3e0dd1['fieldName'],'type':_0x3e0dd1['type'][_0x666a('0x1e')]};});_0x41df5f[_0x666a('0x1f')]=_[_0x666a('0x1b')](_0x4e5b9a,'name');_0x41df5f[_0x666a('0x20')]=_['keys'](_0x20d27f[_0x666a('0x20')]);_0x41df5f[_0x666a('0x21')]=_[_0x666a('0x22')](_0x41df5f['model'],_0x41df5f[_0x666a('0x20')]);_0x2af91b[_0x666a('0x23')]=_[_0x666a('0x22')](_0x41df5f['model'],qs[_0x666a('0x24')](_0x20d27f[_0x666a('0x20')][_0x666a('0x24')]));_0x2af91b['attributes']=_0x2af91b[_0x666a('0x23')][_0x666a('0x25')]?_0x2af91b[_0x666a('0x23')]:_0x41df5f[_0x666a('0x1f')];if(!_0x20d27f[_0x666a('0x20')][_0x666a('0x26')]('nolimit')){_0x2af91b[_0x666a('0xa')]=qs[_0x666a('0xa')](_0x20d27f['query'][_0x666a('0xa')]);_0x2af91b['offset']=qs['offset'](_0x20d27f['query'][_0x666a('0x27')]);}_0x2af91b[_0x666a('0x28')]=qs[_0x666a('0x29')](_0x20d27f['query']['sort']);_0x2af91b[_0x666a('0x2a')]=qs[_0x666a('0x21')](_['pick'](_0x20d27f['query'],_0x41df5f['filters']),_0x4e5b9a);if(_0x20d27f[_0x666a('0x20')][_0x666a('0x2b')]){_0x2af91b[_0x666a('0x2a')]=_[_0x666a('0x2c')](_0x2af91b['where'],{'$or':_['map'](_0x4e5b9a,function(_0x6569e0){if(_0x6569e0[_0x666a('0x2d')]!==_0x666a('0x2e')){var _0x2a0e51={};_0x2a0e51[_0x6569e0[_0x666a('0x17')]]={'$like':'%'+_0x20d27f['query'][_0x666a('0x2b')]+'%'};return _0x2a0e51;}})});}_0x2af91b=_[_0x666a('0x2c')]({},_0x2af91b,_0x20d27f[_0x666a('0x2f')]);var _0x29adf5={'where':_0x2af91b[_0x666a('0x2a')]};return db[_0x666a('0x1c')]['count'](_0x29adf5)['then'](function(_0x5c3aff){_0x5cda41[_0x666a('0xb')]=_0x5c3aff;if(_0x20d27f[_0x666a('0x20')][_0x666a('0x30')]){_0x2af91b[_0x666a('0x31')]=[{'all':!![]}];}return db[_0x666a('0x1c')]['findAll'](_0x2af91b);})[_0x666a('0xf')](function(_0x57b404){_0x5cda41[_0x666a('0x32')]=_0x57b404;return _0x5cda41;})[_0x666a('0xf')](respondWithFilteredResult(_0x4cc909,_0x2af91b))[_0x666a('0x33')](handleError(_0x4cc909,null));};exports[_0x666a('0x34')]=function(_0x3aa157,_0x18265f){var _0x320adb={'raw':![],'where':{'id':_0x3aa157['params']['id']}},_0x2468e7={};_0x2468e7[_0x666a('0x1f')]=_[_0x666a('0x35')](db['SquareProject'][_0x666a('0x1d')]);_0x2468e7[_0x666a('0x20')]=_[_0x666a('0x35')](_0x3aa157['query']);_0x2468e7[_0x666a('0x21')]=_[_0x666a('0x22')](_0x2468e7[_0x666a('0x1f')],_0x2468e7['query']);_0x320adb[_0x666a('0x23')]=_['intersection'](_0x2468e7[_0x666a('0x1f')],qs[_0x666a('0x24')](_0x3aa157[_0x666a('0x20')]['fields']));_0x320adb[_0x666a('0x23')]=_0x320adb[_0x666a('0x23')]['length']?_0x320adb[_0x666a('0x23')]:_0x2468e7[_0x666a('0x1f')];if(_0x3aa157[_0x666a('0x20')][_0x666a('0x30')]){_0x320adb[_0x666a('0x31')]=[{'all':!![]}];}_0x320adb=_[_0x666a('0x2c')]({},_0x320adb,_0x3aa157['options']);return db[_0x666a('0x1c')][_0x666a('0x36')](_0x320adb)[_0x666a('0xf')](handleEntityNotFound(_0x18265f,null))[_0x666a('0xf')](respondWithResult(_0x18265f,null))[_0x666a('0x33')](handleError(_0x18265f,null));};exports['create']=function(_0x37857e,_0x1139d4){return db[_0x666a('0x1c')]['create'](_0x37857e['body'],{})['then'](function(_0x18689a){var _0x26f023=_0x37857e[_0x666a('0x37')][_0x666a('0x38')]({'plain':!![]});if(!_0x26f023)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26f023[_0x666a('0x39')]==='user'){var _0x389260=_0x18689a['get']({'plain':!![]});var _0x51cc8a=_0x666a('0x10');return db['UserProfileSection']['find']({'where':{'name':_0x51cc8a,'userProfileId':_0x26f023['userProfileId']},'raw':!![]})[_0x666a('0xf')](function(_0x411abb){if(_0x411abb&&_0x411abb[_0x666a('0x3a')]===0x0){return db['UserProfileResource'][_0x666a('0x3b')]({'name':_0x389260['name'],'resourceId':_0x389260['id'],'type':_0x411abb['name'],'sectionId':_0x411abb['id']},{})[_0x666a('0xf')](function(){return _0x18689a;});}else{return _0x18689a;}})[_0x666a('0x33')](function(_0x4c2654){logger['error'](_0x666a('0x3c'),_0x4c2654);throw _0x4c2654;});}return _0x18689a;})[_0x666a('0xf')](respondWithResult(_0x1139d4,0xc9))[_0x666a('0x33')](handleError(_0x1139d4,null));};exports[_0x666a('0xe')]=function(_0xa2516b,_0x2c08d6){if(_0xa2516b['body']['id']){delete _0xa2516b['body']['id'];}return db[_0x666a('0x1c')][_0x666a('0x36')]({'where':{'id':_0xa2516b[_0x666a('0x3d')]['id']}})[_0x666a('0xf')](handleEntityNotFound(_0x2c08d6,null))[_0x666a('0xf')](saveUpdates(_0xa2516b[_0x666a('0x3e')],null))[_0x666a('0xf')](function(_0x2d0df1){if(!_0x2d0df1)return;var _0x5d0965=_0x2d0df1[_0x666a('0x38')]({'plain':!![]});return _0x5d0965;})[_0x666a('0xf')](function(_0x3e8b52){var _0x26fa8c=new Redis(config[_0x666a('0x5')]);_0x26fa8c[_0x666a('0x13')](_0x666a('0x3f'),JSON[_0x666a('0x14')](_[_0x666a('0x40')](_0x3e8b52,['id',_0x666a('0x17'),_0x666a('0x41')])));return _0x3e8b52;})[_0x666a('0xf')](respondWithResult(_0x2c08d6,null))[_0x666a('0x33')](handleError(_0x2c08d6,null));};exports[_0x666a('0x12')]=function(_0x318825,_0x1e8041){return db[_0x666a('0x1c')]['find']({'where':{'id':_0x318825['params']['id']}})['then'](handleEntityNotFound(_0x1e8041,null))[_0x666a('0xf')](removeEntity(_0x1e8041,null))[_0x666a('0x33')](handleError(_0x1e8041,null));}; \ No newline at end of file +var _0x5dd0=['agi','stringify','end','sendStatus','stack','name','send','SquareProject','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','params','publish','production','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','register','status','json','offset','undefined','limit','count','set','update','destroy','get','SquareProjects','UserProfileResource','then'];(function(_0x1f7f41,_0x1a0e96){var _0x344bae=function(_0x3fcbde){while(--_0x3fcbde){_0x1f7f41['push'](_0x1f7f41['shift']());}};_0x344bae(++_0x1a0e96);}(_0x5dd0,0x183));var _0x05dd=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5dd0[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var Redis=require(_0x05dd('0x0'));var qs=require(_0x05dd('0x1'));var logger=require(_0x05dd('0x2'))('api');var config=require(_0x05dd('0x3'));var db=require(_0x05dd('0x4'))['db'];config[_0x05dd('0x5')]=_[_0x05dd('0x6')](config[_0x05dd('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05dd('0x5')]));require('./squareProject.socket')[_0x05dd('0x7')](socket);function respondWithResult(_0x3f915e,_0x22450f){_0x22450f=_0x22450f||0xc8;return function(_0x3355d4){if(_0x3355d4){return _0x3f915e[_0x05dd('0x8')](_0x22450f)[_0x05dd('0x9')](_0x3355d4);}};}function respondWithFilteredResult(_0x2f5d8e,_0x36a4b0){return function(_0x3952e7){if(_0x3952e7){var _0x1f27ef=typeof _0x36a4b0[_0x05dd('0xa')]===_0x05dd('0xb')&&typeof _0x36a4b0[_0x05dd('0xc')]===_0x05dd('0xb');var _0x35908e=_0x3952e7['count'];var _0x5ad5e2=_0x1f27ef?0x0:_0x36a4b0['offset'];var _0x321bf4=_0x1f27ef?_0x3952e7[_0x05dd('0xd')]:_0x36a4b0['offset']+_0x36a4b0['limit'];var _0x524974;if(_0x321bf4>=_0x35908e){_0x321bf4=_0x35908e;_0x524974=0xc8;}else{_0x524974=0xce;}_0x2f5d8e[_0x05dd('0x8')](_0x524974);return _0x2f5d8e[_0x05dd('0xe')]('Content-Range',_0x5ad5e2+'-'+_0x321bf4+'/'+_0x35908e)[_0x05dd('0x9')](_0x3952e7);}return null;};}function saveUpdates(_0xd1b1d1){return function(_0xe3a4fc){if(_0xe3a4fc){return _0xe3a4fc[_0x05dd('0xf')](_0xd1b1d1)['then'](function(_0x1ad25e){return _0x1ad25e;});}return null;};}function removeEntity(_0x204ab8){return function(_0x303138){if(_0x303138){return _0x303138[_0x05dd('0x10')]()['then'](function(){var _0x55684f=_0x303138[_0x05dd('0x11')]({'plain':!![]});var _0x10975a=_0x05dd('0x12');return db[_0x05dd('0x13')][_0x05dd('0x10')]({'where':{'type':_0x10975a,'resourceId':_0x55684f['id']}})[_0x05dd('0x14')](function(){return _0x303138;});})[_0x05dd('0x14')](function(){var _0x41274f=new Redis(config['redis']);_0x41274f['publish'](_0x05dd('0x15'),JSON[_0x05dd('0x16')]({'id':_0x303138['id'],'deleted':!![]}));})['then'](function(){_0x204ab8[_0x05dd('0x8')](0xcc)[_0x05dd('0x17')]();});}};}function handleEntityNotFound(_0x63d9f0){return function(_0x49d580){if(!_0x49d580){_0x63d9f0[_0x05dd('0x18')](0x194);}return _0x49d580;};}function handleError(_0x2cc2ba,_0x200c25){_0x200c25=_0x200c25||0x1f4;return function(_0x23c49a){logger['error'](_0x23c49a[_0x05dd('0x19')]);if(_0x23c49a[_0x05dd('0x1a')]){delete _0x23c49a[_0x05dd('0x1a')];}_0x2cc2ba[_0x05dd('0x8')](_0x200c25)[_0x05dd('0x1b')](_0x23c49a);};}exports['index']=function(_0x2c01ad,_0x51f743){var _0x31e2bd={},_0x582bd7={},_0x463ec6={'count':0x0,'rows':[]};var _0x1995e6=_['map'](db[_0x05dd('0x1c')][_0x05dd('0x1d')],function(_0x26d469){return{'name':_0x26d469[_0x05dd('0x1e')],'type':_0x26d469['type'][_0x05dd('0x1f')]};});_0x582bd7[_0x05dd('0x20')]=_[_0x05dd('0x21')](_0x1995e6,_0x05dd('0x1a'));_0x582bd7[_0x05dd('0x22')]=_['keys'](_0x2c01ad[_0x05dd('0x22')]);_0x582bd7[_0x05dd('0x23')]=_[_0x05dd('0x24')](_0x582bd7[_0x05dd('0x20')],_0x582bd7[_0x05dd('0x22')]);_0x31e2bd[_0x05dd('0x25')]=_[_0x05dd('0x24')](_0x582bd7[_0x05dd('0x20')],qs[_0x05dd('0x26')](_0x2c01ad['query'][_0x05dd('0x26')]));_0x31e2bd[_0x05dd('0x25')]=_0x31e2bd[_0x05dd('0x25')][_0x05dd('0x27')]?_0x31e2bd[_0x05dd('0x25')]:_0x582bd7[_0x05dd('0x20')];if(!_0x2c01ad[_0x05dd('0x22')][_0x05dd('0x28')]('nolimit')){_0x31e2bd['limit']=qs['limit'](_0x2c01ad[_0x05dd('0x22')]['limit']);_0x31e2bd['offset']=qs[_0x05dd('0xa')](_0x2c01ad['query'][_0x05dd('0xa')]);}_0x31e2bd[_0x05dd('0x29')]=qs['sort'](_0x2c01ad['query']['sort']);_0x31e2bd[_0x05dd('0x2a')]=qs[_0x05dd('0x23')](_[_0x05dd('0x2b')](_0x2c01ad[_0x05dd('0x22')],_0x582bd7[_0x05dd('0x23')]),_0x1995e6);if(_0x2c01ad[_0x05dd('0x22')]['filter']){_0x31e2bd[_0x05dd('0x2a')]=_[_0x05dd('0x2c')](_0x31e2bd['where'],{'$or':_[_0x05dd('0x21')](_0x1995e6,function(_0x54574a){if(_0x54574a[_0x05dd('0x2d')]!==_0x05dd('0x2e')){var _0x350641={};_0x350641[_0x54574a[_0x05dd('0x1a')]]={'$like':'%'+_0x2c01ad['query'][_0x05dd('0x2f')]+'%'};return _0x350641;}})});}_0x31e2bd=_['merge']({},_0x31e2bd,_0x2c01ad[_0x05dd('0x30')]);var _0x4c0699={'where':_0x31e2bd[_0x05dd('0x2a')]};return db[_0x05dd('0x1c')]['count'](_0x4c0699)['then'](function(_0x16a6df){_0x463ec6[_0x05dd('0xd')]=_0x16a6df;if(_0x2c01ad['query'][_0x05dd('0x31')]){_0x31e2bd['include']=[{'all':!![]}];}return db[_0x05dd('0x1c')][_0x05dd('0x32')](_0x31e2bd);})['then'](function(_0x243add){_0x463ec6[_0x05dd('0x33')]=_0x243add;return _0x463ec6;})['then'](respondWithFilteredResult(_0x51f743,_0x31e2bd))[_0x05dd('0x34')](handleError(_0x51f743,null));};exports[_0x05dd('0x35')]=function(_0x45abcf,_0x2351d6){var _0x515ce4={'raw':![],'where':{'id':_0x45abcf['params']['id']}},_0x40321d={};_0x40321d[_0x05dd('0x20')]=_[_0x05dd('0x36')](db['SquareProject'][_0x05dd('0x1d')]);_0x40321d[_0x05dd('0x22')]=_[_0x05dd('0x36')](_0x45abcf[_0x05dd('0x22')]);_0x40321d[_0x05dd('0x23')]=_['intersection'](_0x40321d[_0x05dd('0x20')],_0x40321d[_0x05dd('0x22')]);_0x515ce4[_0x05dd('0x25')]=_[_0x05dd('0x24')](_0x40321d[_0x05dd('0x20')],qs[_0x05dd('0x26')](_0x45abcf['query'][_0x05dd('0x26')]));_0x515ce4['attributes']=_0x515ce4['attributes'][_0x05dd('0x27')]?_0x515ce4[_0x05dd('0x25')]:_0x40321d[_0x05dd('0x20')];if(_0x45abcf[_0x05dd('0x22')][_0x05dd('0x31')]){_0x515ce4[_0x05dd('0x37')]=[{'all':!![]}];}_0x515ce4=_[_0x05dd('0x2c')]({},_0x515ce4,_0x45abcf[_0x05dd('0x30')]);return db['SquareProject'][_0x05dd('0x38')](_0x515ce4)[_0x05dd('0x14')](handleEntityNotFound(_0x2351d6,null))[_0x05dd('0x14')](respondWithResult(_0x2351d6,null))[_0x05dd('0x34')](handleError(_0x2351d6,null));};exports[_0x05dd('0x39')]=function(_0x53909d,_0x2a2d35){return db['SquareProject'][_0x05dd('0x39')](_0x53909d[_0x05dd('0x3a')],{})['then'](function(_0x2f0ac2){var _0x25b052=_0x53909d[_0x05dd('0x3b')][_0x05dd('0x11')]({'plain':!![]});if(!_0x25b052)throw new Error(_0x05dd('0x3c'));if(_0x25b052[_0x05dd('0x3d')]===_0x05dd('0x3b')){var _0x11780e=_0x2f0ac2['get']({'plain':!![]});var _0x58d51b=_0x05dd('0x12');return db['UserProfileSection'][_0x05dd('0x38')]({'where':{'name':_0x58d51b,'userProfileId':_0x25b052[_0x05dd('0x3e')]},'raw':!![]})[_0x05dd('0x14')](function(_0x421f16){if(_0x421f16&&_0x421f16[_0x05dd('0x3f')]===0x0){return db[_0x05dd('0x13')][_0x05dd('0x39')]({'name':_0x11780e[_0x05dd('0x1a')],'resourceId':_0x11780e['id'],'type':_0x421f16[_0x05dd('0x1a')],'sectionId':_0x421f16['id']},{})['then'](function(){return _0x2f0ac2;});}else{return _0x2f0ac2;}})[_0x05dd('0x34')](function(_0x1df17e){logger[_0x05dd('0x40')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1df17e);throw _0x1df17e;});}return _0x2f0ac2;})[_0x05dd('0x14')](respondWithResult(_0x2a2d35,0xc9))['catch'](handleError(_0x2a2d35,null));};exports[_0x05dd('0xf')]=function(_0x29bd13,_0x413055){if(_0x29bd13[_0x05dd('0x3a')]['id']){delete _0x29bd13['body']['id'];}return db[_0x05dd('0x1c')][_0x05dd('0x38')]({'where':{'id':_0x29bd13[_0x05dd('0x41')]['id']}})[_0x05dd('0x14')](handleEntityNotFound(_0x413055,null))['then'](saveUpdates(_0x29bd13[_0x05dd('0x3a')],null))['then'](function(_0x3bc395){if(!_0x3bc395)return;var _0x55d8b9=_0x3bc395[_0x05dd('0x11')]({'plain':!![]});return _0x55d8b9;})[_0x05dd('0x14')](function(_0x193ba0){var _0x2ff920=new Redis(config[_0x05dd('0x5')]);_0x2ff920[_0x05dd('0x42')](_0x05dd('0x15'),JSON['stringify'](_[_0x05dd('0x2b')](_0x193ba0,['id','name',_0x05dd('0x43')])));return _0x193ba0;})[_0x05dd('0x14')](respondWithResult(_0x413055,null))[_0x05dd('0x34')](handleError(_0x413055,null));};exports[_0x05dd('0x10')]=function(_0x57370b,_0x3e92d2){return db[_0x05dd('0x1c')][_0x05dd('0x38')]({'where':{'id':_0x57370b['params']['id']}})[_0x05dd('0x14')](handleEntityNotFound(_0x3e92d2,null))[_0x05dd('0x14')](removeEntity(_0x3e92d2,null))[_0x05dd('0x34')](handleError(_0x3e92d2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ab4cf42..d852d22 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 _0xe2e0=['exports','save','update','remove','emit','hook'];(function(_0x1fc26d,_0x5c78ce){var _0x36c777=function(_0xaf61f2){while(--_0xaf61f2){_0x1fc26d['push'](_0x1fc26d['shift']());}};_0x36c777(++_0x5c78ce);}(_0xe2e0,0x18d));var _0x0e2e=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0xe2e0[_0x28278f];return _0x3d9f74;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e2e('0x0'),'afterUpdate':_0x0e2e('0x1'),'afterDestroy':_0x0e2e('0x2')};function emitEvent(_0x417fb0){return function(_0x38a32,_0x48cadf,_0x15670c){SquareProjectEvents[_0x0e2e('0x3')](_0x417fb0+':'+_0x38a32['id'],_0x38a32);SquareProjectEvents['emit'](_0x417fb0,_0x38a32);_0x15670c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x0e2e('0x4')](e,emitEvent(event));}}module[_0x0e2e('0x5')]=SquareProjectEvents; \ No newline at end of file +var _0xb820=['hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners','remove','emit'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb820,0x8b));var _0x0b82=function(_0x6f9a2c,_0x37293d){_0x6f9a2c=_0x6f9a2c-0x0;var _0x2ec740=_0xb820[_0x6f9a2c];return _0x2ec740;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x0b82('0x0'))['db'][_0x0b82('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0b82('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0b82('0x3')};function emitEvent(_0x613e6e){return function(_0x3728ec,_0x48ef61,_0x363fda){SquareProjectEvents[_0x0b82('0x4')](_0x613e6e+':'+_0x3728ec['id'],_0x3728ec);SquareProjectEvents[_0x0b82('0x4')](_0x613e6e,_0x3728ec);_0x363fda(null);};}for(var e in events){if(events[_0x0b82('0x5')](e)){var event=events[e];SquareProject[_0x0b82('0x6')](e,emitEvent(event));}}module[_0x0b82('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 061ae1d..f228687 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 _0x5f70=['savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','util','../../config/logger','api','bluebird','path','./squareProject.attributes','exports','SquareProject','square_projects','changed'];(function(_0x18ce6e,_0x1eff3a){var _0x533bc9=function(_0x2286b4){while(--_0x2286b4){_0x18ce6e['push'](_0x18ce6e['shift']());}};_0x533bc9(++_0x1eff3a);}(_0x5f70,0xc8));var _0x05f7=function(_0x127bed,_0x50c9b3){_0x127bed=_0x127bed-0x0;var _0x5ca418=_0x5f70[_0x127bed];return _0x5ca418;};'use strict';var _=require('lodash');var util=require(_0x05f7('0x0'));var logger=require(_0x05f7('0x1'))(_0x05f7('0x2'));var moment=require('moment');var BPromise=require(_0x05f7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x05f7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x05f7('0x5'));module[_0x05f7('0x6')]=function(_0xedcba2,_0xc2d2){return _0xedcba2['define'](_0x05f7('0x7'),attributes,{'tableName':_0x05f7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dc3fd,_0x25e73f,_0x1de6ce){if(_0x1dc3fd[_0x05f7('0x9')]('preproduction')){_0x1dc3fd[_0x05f7('0xa')]=moment()['format'](_0x05f7('0xb'));}if(_0x1dc3fd[_0x05f7('0x9')](_0x05f7('0xc'))){_0x1dc3fd[_0x05f7('0xd')]=moment()[_0x05f7('0xe')](_0x05f7('0xb'));}_0x1de6ce(null,_0x1dc3fd);}}});}; \ No newline at end of file +var _0x76e2=['rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','api','moment','bluebird'];(function(_0x16e385,_0x22d5bd){var _0x143317=function(_0x10aa0f){while(--_0x10aa0f){_0x16e385['push'](_0x16e385['shift']());}};_0x143317(++_0x22d5bd);}(_0x76e2,0x1dc));var _0x276e=function(_0x181b81,_0x3508d1){_0x181b81=_0x181b81-0x0;var _0x2756ee=_0x76e2[_0x181b81];return _0x2756ee;};'use strict';var _=require(_0x276e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x276e('0x1'));var moment=require(_0x276e('0x2'));var BPromise=require(_0x276e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x276e('0x4'));var config=require(_0x276e('0x5'));var attributes=require(_0x276e('0x6'));module[_0x276e('0x7')]=function(_0x40d358,_0x8cc1a8){return _0x40d358[_0x276e('0x8')]('SquareProject',attributes,{'tableName':_0x276e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29fe13,_0x15ba03,_0x2d445c){if(_0x29fe13['changed'](_0x276e('0xa'))){_0x29fe13['savedAt']=moment()[_0x276e('0xb')](_0x276e('0xc'));}if(_0x29fe13[_0x276e('0xd')](_0x276e('0xe'))){_0x29fe13[_0x276e('0xf')]=moment()[_0x276e('0xb')](_0x276e('0xc'));}_0x2d445c(null,_0x29fe13);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 333877b..0ba24a5 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 _0x6349=['catch','lodash','ioredis','rpc','redis','localhost','socket.io-emitter','register','GetSquareProjects','findAll','options','where','attributes','limit','include','map','model','then','info','debug','error','message','ShowSquareProject','SquareProject','raw','stringify'];(function(_0x5c804e,_0x583316){var _0x317514=function(_0x266b66){while(--_0x266b66){_0x5c804e['push'](_0x5c804e['shift']());}};_0x317514(++_0x583316);}(_0x6349,0xeb));var _0x9634=function(_0x11a3d1,_0x48935a){_0x11a3d1=_0x11a3d1-0x0;var _0x3ea618=_0x6349[_0x11a3d1];return _0x3ea618;};'use strict';var _=require(_0x9634('0x0'));var Redis=require(_0x9634('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x9634('0x2'));var config=require('../../config/environment');config[_0x9634('0x3')]=_['defaults'](config[_0x9634('0x3')],{'host':_0x9634('0x4'),'port':0x18eb});var socket=require(_0x9634('0x5'))(new Redis(config['redis']));require('./squareProject.socket')[_0x9634('0x6')](socket);exports[_0x9634('0x7')]=function(_0x60182b){var _0x36e8fd=this;return new Promise(function(_0x186753,_0x4b9984){return db['SquareProject'][_0x9634('0x8')]({'raw':_0x60182b[_0x9634('0x9')]?_0x60182b['options']['raw']===undefined?!![]:![]:!![],'where':_0x60182b[_0x9634('0x9')]?_0x60182b[_0x9634('0x9')][_0x9634('0xa')]||null:null,'attributes':_0x60182b[_0x9634('0x9')]?_0x60182b[_0x9634('0x9')][_0x9634('0xb')]||null:null,'limit':_0x60182b['options']?_0x60182b[_0x9634('0x9')][_0x9634('0xc')]||null:null,'include':_0x60182b[_0x9634('0x9')]?_0x60182b[_0x9634('0x9')][_0x9634('0xd')]?_[_0x9634('0xe')](_0x60182b[_0x9634('0x9')]['include'],function(_0xd541e2){return{'model':db[_0xd541e2[_0x9634('0xf')]],'as':_0xd541e2['as'],'attributes':_0xd541e2[_0x9634('0xb')],'include':_0xd541e2['include']?_[_0x9634('0xe')](_0xd541e2[_0x9634('0xd')],function(_0x459da0){return{'model':db[_0x459da0[_0x9634('0xf')]],'as':_0x459da0['as'],'attributes':_0x459da0[_0x9634('0xb')],'include':_0x459da0['include']?_[_0x9634('0xe')](_0x459da0[_0x9634('0xd')],function(_0x4b57ee){return{'model':db[_0x4b57ee[_0x9634('0xf')]],'as':_0x4b57ee['as'],'attributes':_0x4b57ee[_0x9634('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9634('0x10')](function(_0xc0ee87){logger[_0x9634('0x11')](_0x9634('0x7'),_0x60182b);logger[_0x9634('0x12')](_0x9634('0x7'),_0x60182b,JSON['stringify'](_0xc0ee87));_0x186753(_0xc0ee87);})['catch'](function(_0xd34bd9){logger[_0x9634('0x13')](_0x9634('0x7'),_0xd34bd9[_0x9634('0x14')],_0x60182b);_0x4b9984(_0x36e8fd['error'](0x1f4,_0xd34bd9[_0x9634('0x14')]));});});};exports[_0x9634('0x15')]=function(_0x1721ff){var _0x4f80b3=this;return new Promise(function(_0x4e77c7,_0x20f863){return db[_0x9634('0x16')]['find']({'raw':_0x1721ff['options']?_0x1721ff['options'][_0x9634('0x17')]===undefined?!![]:![]:!![],'where':_0x1721ff[_0x9634('0x9')]?_0x1721ff[_0x9634('0x9')][_0x9634('0xa')]||null:null,'attributes':_0x1721ff[_0x9634('0x9')]?_0x1721ff[_0x9634('0x9')][_0x9634('0xb')]||null:null,'include':_0x1721ff[_0x9634('0x9')]?_0x1721ff[_0x9634('0x9')][_0x9634('0xd')]?_[_0x9634('0xe')](_0x1721ff['options'][_0x9634('0xd')],function(_0xcf4f7b){return{'model':db[_0xcf4f7b[_0x9634('0xf')]],'as':_0xcf4f7b['as'],'attributes':_0xcf4f7b[_0x9634('0xb')],'include':_0xcf4f7b[_0x9634('0xd')]?_['map'](_0xcf4f7b[_0x9634('0xd')],function(_0x296511){return{'model':db[_0x296511[_0x9634('0xf')]],'as':_0x296511['as'],'attributes':_0x296511['attributes'],'include':_0x296511[_0x9634('0xd')]?_[_0x9634('0xe')](_0x296511[_0x9634('0xd')],function(_0x10ea45){return{'model':db[_0x10ea45['model']],'as':_0x10ea45['as'],'attributes':_0x10ea45[_0x9634('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9634('0x10')](function(_0x3404d2){logger[_0x9634('0x11')](_0x9634('0x15'),_0x1721ff);logger[_0x9634('0x12')](_0x9634('0x15'),_0x1721ff,JSON[_0x9634('0x18')](_0x3404d2));_0x4e77c7(_0x3404d2);})[_0x9634('0x19')](function(_0x1ec409){logger[_0x9634('0x13')](_0x9634('0x15'),_0x1ec409['message'],_0x1721ff);_0x20f863(_0x4f80b3[_0x9634('0x13')](0x1f4,_0x1ec409[_0x9634('0x14')]));});});}; \ No newline at end of file +var _0xffb9=['rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','options','where','attributes','limit','include','model','map','then','debug','catch','message','error','ShowSquareProject','find','info','../../mysqldb','../../config/logger'];(function(_0x15787e,_0xa3ac41){var _0x5b2e16=function(_0x5b7e47){while(--_0x5b7e47){_0x15787e['push'](_0x15787e['shift']());}};_0x5b2e16(++_0xa3ac41);}(_0xffb9,0x80));var _0x9ffb=function(_0x34b3d3,_0x571a67){_0x34b3d3=_0x34b3d3-0x0;var _0x264e81=_0xffb9[_0x34b3d3];return _0x264e81;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x9ffb('0x0'))['db'];var logger=require(_0x9ffb('0x1'))(_0x9ffb('0x2'));var config=require(_0x9ffb('0x3'));config[_0x9ffb('0x4')]=_[_0x9ffb('0x5')](config[_0x9ffb('0x4')],{'host':_0x9ffb('0x6'),'port':0x18eb});var socket=require(_0x9ffb('0x7'))(new Redis(config[_0x9ffb('0x4')]));require('./squareProject.socket')[_0x9ffb('0x8')](socket);exports[_0x9ffb('0x9')]=function(_0x20d4ff){var _0x3a7711=this;return new Promise(function(_0x57d256,_0x4dd994){return db[_0x9ffb('0xa')]['findAll']({'raw':_0x20d4ff['options']?_0x20d4ff[_0x9ffb('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x20d4ff['options']?_0x20d4ff[_0x9ffb('0xb')][_0x9ffb('0xc')]||null:null,'attributes':_0x20d4ff['options']?_0x20d4ff['options'][_0x9ffb('0xd')]||null:null,'limit':_0x20d4ff[_0x9ffb('0xb')]?_0x20d4ff[_0x9ffb('0xb')][_0x9ffb('0xe')]||null:null,'include':_0x20d4ff[_0x9ffb('0xb')]?_0x20d4ff[_0x9ffb('0xb')][_0x9ffb('0xf')]?_['map'](_0x20d4ff[_0x9ffb('0xb')][_0x9ffb('0xf')],function(_0x4e971e){return{'model':db[_0x4e971e[_0x9ffb('0x10')]],'as':_0x4e971e['as'],'attributes':_0x4e971e[_0x9ffb('0xd')],'include':_0x4e971e[_0x9ffb('0xf')]?_[_0x9ffb('0x11')](_0x4e971e[_0x9ffb('0xf')],function(_0x373785){return{'model':db[_0x373785['model']],'as':_0x373785['as'],'attributes':_0x373785[_0x9ffb('0xd')],'include':_0x373785[_0x9ffb('0xf')]?_[_0x9ffb('0x11')](_0x373785[_0x9ffb('0xf')],function(_0x86b568){return{'model':db[_0x86b568[_0x9ffb('0x10')]],'as':_0x86b568['as'],'attributes':_0x86b568[_0x9ffb('0xd')]};}):[]};}):[]};}):[]:[]})[_0x9ffb('0x12')](function(_0x359ac7){logger['info'](_0x9ffb('0x9'),_0x20d4ff);logger[_0x9ffb('0x13')](_0x9ffb('0x9'),_0x20d4ff,JSON['stringify'](_0x359ac7));_0x57d256(_0x359ac7);})[_0x9ffb('0x14')](function(_0x38b6e9){logger['error'](_0x9ffb('0x9'),_0x38b6e9[_0x9ffb('0x15')],_0x20d4ff);_0x4dd994(_0x3a7711[_0x9ffb('0x16')](0x1f4,_0x38b6e9['message']));});});};exports[_0x9ffb('0x17')]=function(_0x4e0698){var _0x1131f5=this;return new Promise(function(_0x499adc,_0x545be6){return db['SquareProject'][_0x9ffb('0x18')]({'raw':_0x4e0698[_0x9ffb('0xb')]?_0x4e0698[_0x9ffb('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x4e0698[_0x9ffb('0xb')]?_0x4e0698['options']['where']||null:null,'attributes':_0x4e0698['options']?_0x4e0698[_0x9ffb('0xb')][_0x9ffb('0xd')]||null:null,'include':_0x4e0698['options']?_0x4e0698[_0x9ffb('0xb')][_0x9ffb('0xf')]?_[_0x9ffb('0x11')](_0x4e0698[_0x9ffb('0xb')][_0x9ffb('0xf')],function(_0xd56fe5){return{'model':db[_0xd56fe5[_0x9ffb('0x10')]],'as':_0xd56fe5['as'],'attributes':_0xd56fe5[_0x9ffb('0xd')],'include':_0xd56fe5['include']?_[_0x9ffb('0x11')](_0xd56fe5['include'],function(_0x558a2c){return{'model':db[_0x558a2c['model']],'as':_0x558a2c['as'],'attributes':_0x558a2c[_0x9ffb('0xd')],'include':_0x558a2c[_0x9ffb('0xf')]?_[_0x9ffb('0x11')](_0x558a2c['include'],function(_0x3cbd4a){return{'model':db[_0x3cbd4a[_0x9ffb('0x10')]],'as':_0x3cbd4a['as'],'attributes':_0x3cbd4a[_0x9ffb('0xd')]};}):[]};}):[]};}):[]:[]})[_0x9ffb('0x12')](function(_0x261223){logger[_0x9ffb('0x19')](_0x9ffb('0x17'),_0x4e0698);logger[_0x9ffb('0x13')]('ShowSquareProject',_0x4e0698,JSON['stringify'](_0x261223));_0x499adc(_0x261223);})[_0x9ffb('0x14')](function(_0x245094){logger['error'](_0x9ffb('0x17'),_0x245094[_0x9ffb('0x15')],_0x4e0698);_0x545be6(_0x1131f5[_0x9ffb('0x16')](0x1f4,_0x245094[_0x9ffb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d4b6dc8..a36e8a2 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 _0x7fd3=['squareProject:','update','emit','removeListener'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7fd3,0xd9));var _0x37fd=function(_0x2f3c2a,_0x4b83fb){_0x2f3c2a=_0x2f3c2a-0x0;var _0x30d632=_0x7fd3[_0x2f3c2a];return _0x30d632;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove',_0x37fd('0x0')];function createListener(_0x49a6ba,_0x13ef23){return function(_0x377ba8){_0x13ef23[_0x37fd('0x1')](_0x49a6ba,_0x377ba8);};}function removeListener(_0x5c186f,_0x11efac){return function(){SquareProjectEvents[_0x37fd('0x2')](_0x5c186f,_0x11efac);};}exports['register']=function(_0x592eef){for(var _0x54bcf9=0x0,_0x4bbb2a=events['length'];_0x54bcf9<_0x4bbb2a;_0x54bcf9++){var _0x16db1c=events[_0x54bcf9];var _0x4bec2f=createListener(_0x37fd('0x3')+_0x16db1c,_0x592eef);SquareProjectEvents['on'](_0x16db1c,_0x4bec2f);}}; \ No newline at end of file +var _0x62c5=['save','remove','update','emit','removeListener','register','squareProject:','./squareProject.events'];(function(_0x429ea7,_0x5b9672){var _0x37f7de=function(_0x1c42b1){while(--_0x1c42b1){_0x429ea7['push'](_0x429ea7['shift']());}};_0x37f7de(++_0x5b9672);}(_0x62c5,0xcf));var _0x562c=function(_0xe61544,_0x30b2d2){_0xe61544=_0xe61544-0x0;var _0x58cc3e=_0x62c5[_0xe61544];return _0x58cc3e;};'use strict';var SquareProjectEvents=require(_0x562c('0x0'));var events=[_0x562c('0x1'),_0x562c('0x2'),_0x562c('0x3')];function createListener(_0x571a62,_0x1204a9){return function(_0x40b452){_0x1204a9[_0x562c('0x4')](_0x571a62,_0x40b452);};}function removeListener(_0x443b00,_0x270478){return function(){SquareProjectEvents[_0x562c('0x5')](_0x443b00,_0x270478);};}exports[_0x562c('0x6')]=function(_0x407a53){for(var _0x1b4982=0x0,_0x5ed7ea=events['length'];_0x1b4982<_0x5ed7ea;_0x1b4982++){var _0xe7788f=events[_0x1b4982];var _0x3331eb=createListener(_0x562c('0x7')+_0xe7788f,_0x407a53);SquareProjectEvents['on'](_0xe7788f,_0x3331eb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ea38b69..9f56f38 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x433e3f,_0xfa4126){var _0x49b364=function(_0x37b57e){while(--_0x37b57e){_0x433e3f['push'](_0x433e3f['shift']());}};_0x49b364(++_0xfa4126);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x56a490,_0x5a34db){var _0x47e774=function(_0xc36c4f){while(--_0xc36c4f){_0x56a490['push'](_0x56a490['shift']());}};_0x47e774(++_0x5a34db);}(_0x1261,0x144));var _0x1126=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0x1261[_0x512e72];return _0x143086;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a7887fd..d203873 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 _0xd6d6=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x533c47,_0xe3e2fa){var _0x476709=function(_0x477fba){while(--_0x477fba){_0x533c47['push'](_0x533c47['shift']());}};_0x476709(++_0xe3e2fa);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x13a150,_0x10756f){_0x13a150=_0x13a150-0x0;var _0x3bbe00=_0xd6d6[_0x13a150];return _0x3bbe00;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'callerid':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6d6d('0x2')]},'extension':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'dnid':{'type':Sequelize[_0x6d6d('0x2')]},'projectName':{'type':Sequelize[_0x6d6d('0x2')]},'saveName':{'type':Sequelize[_0x6d6d('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x6d6d('0x2')]},'format':{'type':Sequelize[_0x6d6d('0x3')],'get':function(){var _0x44f83d='';var _0x18f824=this[_0x6d6d('0x4')](_0x6d6d('0x5'));if(_0x18f824){_0x44f83d=_0x18f824[_0x6d6d('0x6')](_0x18f824['lastIndexOf']('.'));}return _0x44f83d;}}}; \ No newline at end of file +var _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x5fd74b,_0x3edaa6){var _0x3d3f58=function(_0x5b17ca){while(--_0x5b17ca){_0x5fd74b['push'](_0x5fd74b['shift']());}};_0x3d3f58(++_0x3edaa6);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'extension':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7721('0x1')]},'projectName':{'type':Sequelize[_0x7721('0x1')]},'saveName':{'type':Sequelize[_0x7721('0x1')]},'filename':{'type':Sequelize[_0x7721('0x1')]},'savePath':{'type':Sequelize[_0x7721('0x1')]},'format':{'type':Sequelize[_0x7721('0x2')],'get':function(){var _0x18ab6b='';var _0x21f680=this[_0x7721('0x3')](_0x7721('0x4'));if(_0x21f680){_0x18ab6b=_0x21f680[_0x7721('0x5')](_0x21f680[_0x7721('0x6')]('.'));}return _0x18ab6b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 93e372a..c379412 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 _0xae85=['cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','end','sendStatus','error','stack','name','index','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','download','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found'];(function(_0x2d17b7,_0x349746){var _0x57e94e=function(_0x39256e){while(--_0x39256e){_0x2d17b7['push'](_0x2d17b7['shift']());}};_0x57e94e(++_0x349746);}(_0xae85,0x13e));var _0x5ae8=function(_0x4ee7ad,_0x30b922){_0x4ee7ad=_0x4ee7ad-0x0;var _0x4d8d34=_0xae85[_0x4ee7ad];return _0x4d8d34;};'use strict';var emlformat=require(_0x5ae8('0x0'));var rimraf=require(_0x5ae8('0x1'));var zipdir=require(_0x5ae8('0x2'));var jsonpatch=require(_0x5ae8('0x3'));var rp=require(_0x5ae8('0x4'));var moment=require('moment');var BPromise=require(_0x5ae8('0x5'));var Mustache=require(_0x5ae8('0x6'));var util=require('util');var path=require(_0x5ae8('0x7'));var sox=require(_0x5ae8('0x8'));var csv=require(_0x5ae8('0x9'));var ejs=require(_0x5ae8('0xa'));var fs=require('fs');var fs_extra=require(_0x5ae8('0xb'));var _=require(_0x5ae8('0xc'));var squel=require(_0x5ae8('0xd'));var crypto=require('crypto');var jsforce=require(_0x5ae8('0xe'));var deskjs=require(_0x5ae8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5ae8('0x10'));var Papa=require(_0x5ae8('0x11'));var Redis=require(_0x5ae8('0x12'));var authService=require(_0x5ae8('0x13'));var qs=require(_0x5ae8('0x14'));var as=require(_0x5ae8('0x15'));var hardwareService=require(_0x5ae8('0x16'));var logger=require('../../config/logger')(_0x5ae8('0x17'));var utils=require(_0x5ae8('0x18'));var config=require(_0x5ae8('0x19'));var licenseUtil=require(_0x5ae8('0x1a'));var db=require(_0x5ae8('0x1b'))['db'];function respondWithStatusCode(_0x18d9cf,_0x11fae0){_0x11fae0=_0x11fae0||0xcc;return function(_0x495978){if(_0x495978){return _0x18d9cf['sendStatus'](_0x11fae0);}return _0x18d9cf[_0x5ae8('0x1c')](_0x11fae0)['end']();};}function respondWithResult(_0x477067,_0xa9591c){_0xa9591c=_0xa9591c||0xc8;return function(_0x111dd8){if(_0x111dd8){return _0x477067[_0x5ae8('0x1c')](_0xa9591c)[_0x5ae8('0x1d')](_0x111dd8);}};}function respondWithFilteredResult(_0x145e5d,_0x25c0d0){return function(_0x55f2c0){if(_0x55f2c0){var _0x4bc8e4=typeof _0x25c0d0[_0x5ae8('0x1e')]==='undefined'&&typeof _0x25c0d0['limit']===_0x5ae8('0x1f');var _0x50175f=_0x55f2c0[_0x5ae8('0x20')];var _0x9a4ced=_0x4bc8e4?0x0:_0x25c0d0[_0x5ae8('0x1e')];var _0x13cbfc=_0x4bc8e4?_0x55f2c0['count']:_0x25c0d0[_0x5ae8('0x1e')]+_0x25c0d0[_0x5ae8('0x21')];var _0x22011f;if(_0x13cbfc>=_0x50175f){_0x13cbfc=_0x50175f;_0x22011f=0xc8;}else{_0x22011f=0xce;}_0x145e5d[_0x5ae8('0x1c')](_0x22011f);return _0x145e5d[_0x5ae8('0x22')](_0x5ae8('0x23'),_0x9a4ced+'-'+_0x13cbfc+'/'+_0x50175f)[_0x5ae8('0x1d')](_0x55f2c0);}return null;};}function patchUpdates(_0x3e705f){return function(_0x1bcf82){try{jsonpatch['apply'](_0x1bcf82,_0x3e705f,!![]);}catch(_0x5a7af7){return BPromise[_0x5ae8('0x24')](_0x5a7af7);}return _0x1bcf82[_0x5ae8('0x25')]();};}function saveUpdates(_0x7fdc90,_0x364d78){return function(_0xa0f04c){if(_0xa0f04c){return _0xa0f04c['update'](_0x7fdc90)[_0x5ae8('0x26')](function(_0x3fc57f){return _0x3fc57f;});}return null;};}function removeEntity(_0x3c99e8,_0x46f0cf){return function(_0x106c3b){if(_0x106c3b){return _0x106c3b['destroy']()[_0x5ae8('0x26')](function(){_0x3c99e8['status'](0xcc)[_0x5ae8('0x27')]();});}};}function handleEntityNotFound(_0x1fda87,_0x52f59d){return function(_0x5b866b){if(!_0x5b866b){_0x1fda87[_0x5ae8('0x28')](0x194);}return _0x5b866b;};}function handleError(_0x226fe7,_0x336ade){_0x336ade=_0x336ade||0x1f4;return function(_0x5ad92e){logger[_0x5ae8('0x29')](_0x5ad92e[_0x5ae8('0x2a')]);if(_0x5ad92e['name']){delete _0x5ad92e[_0x5ae8('0x2b')];}_0x226fe7[_0x5ae8('0x1c')](_0x336ade)['send'](_0x5ad92e);};}exports[_0x5ae8('0x2c')]=function(_0x2146a4,_0x263203){var _0x27de9a={},_0x40bc4e={},_0x317bb3={'count':0x0,'rows':[]};var _0x296bec=_['map'](db[_0x5ae8('0x2d')][_0x5ae8('0x2e')],function(_0x5bf8b6){return{'name':_0x5bf8b6['fieldName'],'type':_0x5bf8b6[_0x5ae8('0x2f')][_0x5ae8('0x30')]};});_0x40bc4e[_0x5ae8('0x31')]=_['map'](_0x296bec,_0x5ae8('0x2b'));_0x40bc4e[_0x5ae8('0x32')]=_[_0x5ae8('0x33')](_0x2146a4[_0x5ae8('0x32')]);_0x40bc4e[_0x5ae8('0x34')]=_[_0x5ae8('0x35')](_0x40bc4e[_0x5ae8('0x31')],_0x40bc4e['query']);_0x27de9a[_0x5ae8('0x36')]=_['intersection'](_0x40bc4e['model'],qs[_0x5ae8('0x37')](_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x37')]));_0x27de9a[_0x5ae8('0x36')]=_0x27de9a[_0x5ae8('0x36')][_0x5ae8('0x38')]?_0x27de9a[_0x5ae8('0x36')]:_0x40bc4e[_0x5ae8('0x31')];if(!_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x39')](_0x5ae8('0x3a'))){_0x27de9a[_0x5ae8('0x21')]=qs['limit'](_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x21')]);_0x27de9a[_0x5ae8('0x1e')]=qs[_0x5ae8('0x1e')](_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x1e')]);}_0x27de9a[_0x5ae8('0x3b')]=qs['sort'](_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x3c')]);_0x27de9a[_0x5ae8('0x3d')]=qs[_0x5ae8('0x34')](_[_0x5ae8('0x3e')](_0x2146a4[_0x5ae8('0x32')],_0x40bc4e['filters']),_0x296bec);if(_0x2146a4[_0x5ae8('0x32')][_0x5ae8('0x3f')]){_0x27de9a['where']=_[_0x5ae8('0x40')](_0x27de9a['where'],{'$or':_['map'](_0x296bec,function(_0x15795e){if(_0x15795e[_0x5ae8('0x2f')]!==_0x5ae8('0x41')){var _0x335598={};_0x335598[_0x15795e[_0x5ae8('0x2b')]]={'$like':'%'+_0x2146a4[_0x5ae8('0x32')]['filter']+'%'};return _0x335598;}})});}_0x27de9a=_[_0x5ae8('0x40')]({},_0x27de9a,_0x2146a4[_0x5ae8('0x42')]);var _0x26a8ed={'where':_0x27de9a[_0x5ae8('0x3d')]};return db['SquareRecording'][_0x5ae8('0x20')](_0x26a8ed)['then'](function(_0x581ab6){_0x317bb3[_0x5ae8('0x20')]=_0x581ab6;if(_0x2146a4[_0x5ae8('0x32')]['includeAll']){_0x27de9a[_0x5ae8('0x43')]=[{'all':!![]}];}return db['SquareRecording'][_0x5ae8('0x44')](_0x27de9a);})[_0x5ae8('0x26')](function(_0x26191d){_0x317bb3[_0x5ae8('0x45')]=_0x26191d;return _0x317bb3;})[_0x5ae8('0x26')](respondWithFilteredResult(_0x263203,_0x27de9a))[_0x5ae8('0x46')](handleError(_0x263203,null));};exports[_0x5ae8('0x47')]=function(_0x330a6f,_0x384cd0){var _0x5df369={'raw':!![],'where':{'id':_0x330a6f[_0x5ae8('0x48')]['id']}},_0x139303={};_0x139303[_0x5ae8('0x31')]=_[_0x5ae8('0x33')](db[_0x5ae8('0x2d')][_0x5ae8('0x2e')]);_0x139303[_0x5ae8('0x32')]=_[_0x5ae8('0x33')](_0x330a6f['query']);_0x139303['filters']=_[_0x5ae8('0x35')](_0x139303[_0x5ae8('0x31')],_0x139303[_0x5ae8('0x32')]);_0x5df369[_0x5ae8('0x36')]=_[_0x5ae8('0x35')](_0x139303[_0x5ae8('0x31')],qs[_0x5ae8('0x37')](_0x330a6f[_0x5ae8('0x32')][_0x5ae8('0x37')]));_0x5df369[_0x5ae8('0x36')]=_0x5df369['attributes'][_0x5ae8('0x38')]?_0x5df369[_0x5ae8('0x36')]:_0x139303[_0x5ae8('0x31')];if(_0x330a6f[_0x5ae8('0x32')][_0x5ae8('0x49')]){_0x5df369[_0x5ae8('0x43')]=[{'all':!![]}];}_0x5df369=_[_0x5ae8('0x40')]({},_0x5df369,_0x330a6f['options']);return db['SquareRecording'][_0x5ae8('0x4a')](_0x5df369)['then'](handleEntityNotFound(_0x384cd0,null))[_0x5ae8('0x26')](respondWithResult(_0x384cd0,null))[_0x5ae8('0x46')](handleError(_0x384cd0,null));};exports[_0x5ae8('0x4b')]=function(_0x57946d,_0x36c1f5){return db[_0x5ae8('0x2d')][_0x5ae8('0x4b')](_0x57946d[_0x5ae8('0x4c')],{})[_0x5ae8('0x26')](respondWithResult(_0x36c1f5,0xc9))[_0x5ae8('0x46')](handleError(_0x36c1f5,null));};exports[_0x5ae8('0x4d')]=function(_0x54b4b1,_0xd222c8){if(_0x54b4b1[_0x5ae8('0x4c')]['id']){delete _0x54b4b1['body']['id'];}return db[_0x5ae8('0x2d')][_0x5ae8('0x4a')]({'where':{'id':_0x54b4b1[_0x5ae8('0x48')]['id']}})['then'](handleEntityNotFound(_0xd222c8,null))['then'](saveUpdates(_0x54b4b1[_0x5ae8('0x4c')],null))['then'](respondWithResult(_0xd222c8,null))['catch'](handleError(_0xd222c8,null));};exports[_0x5ae8('0x4e')]=function(_0x5012a9,_0x577b63,_0x37c45a){var _0xc6cf89=require(_0x5ae8('0x4f'));var _0x4c73f8=![];var _0x5c98d6={};if(_0x5012a9[_0x5ae8('0x32')][_0x5ae8('0x2f')]&&_0x5012a9[_0x5ae8('0x32')][_0x5ae8('0x2f')]===_0x5ae8('0x50')){_0x5c98d6[_0x5ae8('0x50')]=_0x5012a9[_0x5ae8('0x48')]['id'];}else{_0x5c98d6['id']=_0x5012a9[_0x5ae8('0x48')]['id'];}return db['SquareRecording'][_0x5ae8('0x4a')]({'where':_0x5c98d6,'attributes':['id','savePath',_0x5ae8('0x51')],'raw':!![]})[_0x5ae8('0x26')](handleEntityNotFound(_0x577b63,null))['then'](function(_0x50d67d){if(_0x50d67d){var _0xbfb37b=_0x50d67d[_0x5ae8('0x52')];var _0xb75141=util[_0x5ae8('0x53')]('%s.cypher',_0xbfb37b);if(fs[_0x5ae8('0x54')](_0xb75141)){_0x4c73f8=!![];return _0xc6cf89[_0x5ae8('0x55')](_0xb75141,_0xbfb37b,config[_0x5ae8('0x56')][_0x5ae8('0x57')])[_0x5ae8('0x26')](function(){return _0x50d67d;});}return _0x50d67d;}})[_0x5ae8('0x26')](function(_0x3b46a3){if(_0x3b46a3){var _0xa6b114=_0x3b46a3[_0x5ae8('0x52')];if(!fs['existsSync'](_0xa6b114)){throw new db['Sequelize'][(_0x5ae8('0x58'))](_0x5ae8('0x59'));}if(_0x3b46a3['filename']){return _0x577b63[_0x5ae8('0x4e')](_0xa6b114,_0x3b46a3[_0x5ae8('0x51')]+path[_0x5ae8('0x5a')](_0xa6b114),function(){if(_0x4c73f8){fs[_0x5ae8('0x5b')](_0xa6b114);}});}else{return _0x577b63[_0x5ae8('0x4e')](_0xa6b114,function(_0x4468c8){if(_0x4c73f8){fs[_0x5ae8('0x5b')](_0xa6b114);}});}}})['catch'](function(_0x476f46){if(_0x476f46[_0x5ae8('0x5c')]===_0x5ae8('0x59')){_0x577b63[_0x5ae8('0x1c')](0x194)[_0x5ae8('0x5d')](_0x5ae8('0x5e'));}else{return handleError(_0x577b63,null);}});};exports[_0x5ae8('0x5f')]=function(_0x42b337,_0x3215a6){return db['SquareRecording']['find']({'where':{'id':_0x42b337[_0x5ae8('0x48')]['id']}})[_0x5ae8('0x26')](function(_0x43ec94){if(_[_0x5ae8('0x60')](_0x43ec94)){throw new ReferenceError(_0x5ae8('0x61'));}return _0x43ec94;})[_0x5ae8('0x26')](function(_0x13aaea){var _0xf28f53=_0x13aaea['savePath'];logger['info'](_0x5ae8('0x62'),_0xf28f53);if(!_[_0x5ae8('0x60')](_0x13aaea[_0x5ae8('0x52')])&&fs[_0x5ae8('0x54')](_0xf28f53)){logger[_0x5ae8('0x63')](_0x5ae8('0x64')+_0xf28f53+_0x5ae8('0x65'));fs[_0x5ae8('0x66')](_0xf28f53);}_0xf28f53=_0xf28f53+_0x5ae8('0x67');if(!_[_0x5ae8('0x60')](_0x13aaea[_0x5ae8('0x52')])&&fs[_0x5ae8('0x54')](_0xf28f53)){logger[_0x5ae8('0x63')](_0x5ae8('0x64')+_0xf28f53+_0x5ae8('0x65'));fs[_0x5ae8('0x66')](_0xf28f53);}return _0x13aaea;})[_0x5ae8('0x26')](function(_0x55981b){if(!_0x55981b)throw new InternalError();return _0x55981b[_0x5ae8('0x5f')]();})['then'](function(){_0x3215a6[_0x5ae8('0x1c')](0xcc)[_0x5ae8('0x27')]();})[_0x5ae8('0x46')](handleError(_0x3215a6,null));}; \ No newline at end of file +var _0xfc20=['extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','rows','show','params','keys','length','options','SquareRecording','find','catch','create','body','download','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename'];(function(_0x7ff9e4,_0x19e358){var _0x468415=function(_0x32f8f5){while(--_0x32f8f5){_0x7ff9e4['push'](_0x7ff9e4['shift']());}};_0x468415(++_0x19e358);}(_0xfc20,0x198));var _0x0fc2=function(_0x15c922,_0x538013){_0x15c922=_0x15c922-0x0;var _0xa4df75=_0xfc20[_0x15c922];return _0xa4df75;};'use strict';var emlformat=require(_0x0fc2('0x0'));var rimraf=require(_0x0fc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fc2('0x2'));var moment=require('moment');var BPromise=require(_0x0fc2('0x3'));var Mustache=require(_0x0fc2('0x4'));var util=require(_0x0fc2('0x5'));var path=require(_0x0fc2('0x6'));var sox=require(_0x0fc2('0x7'));var csv=require(_0x0fc2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0fc2('0x9'));var _=require(_0x0fc2('0xa'));var squel=require(_0x0fc2('0xb'));var crypto=require(_0x0fc2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0fc2('0xd'));var toCsv=require(_0x0fc2('0x8'));var querystring=require(_0x0fc2('0xe'));var Papa=require(_0x0fc2('0xf'));var Redis=require(_0x0fc2('0x10'));var authService=require(_0x0fc2('0x11'));var qs=require(_0x0fc2('0x12'));var as=require(_0x0fc2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fc2('0x14'))(_0x0fc2('0x15'));var utils=require(_0x0fc2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0fc2('0x17'));var db=require(_0x0fc2('0x18'))['db'];function respondWithStatusCode(_0x1e9573,_0x1dccad){_0x1dccad=_0x1dccad||0xcc;return function(_0x3048c6){if(_0x3048c6){return _0x1e9573[_0x0fc2('0x19')](_0x1dccad);}return _0x1e9573[_0x0fc2('0x1a')](_0x1dccad)[_0x0fc2('0x1b')]();};}function respondWithResult(_0x22871c,_0x13cd90){_0x13cd90=_0x13cd90||0xc8;return function(_0x3f3e12){if(_0x3f3e12){return _0x22871c[_0x0fc2('0x1a')](_0x13cd90)[_0x0fc2('0x1c')](_0x3f3e12);}};}function respondWithFilteredResult(_0x5096c6,_0x27632e){return function(_0x36f4e5){if(_0x36f4e5){var _0xac31cf=typeof _0x27632e[_0x0fc2('0x1d')]===_0x0fc2('0x1e')&&typeof _0x27632e[_0x0fc2('0x1f')]==='undefined';var _0x34bbae=_0x36f4e5['count'];var _0x19e81c=_0xac31cf?0x0:_0x27632e[_0x0fc2('0x1d')];var _0x1ee41c=_0xac31cf?_0x36f4e5[_0x0fc2('0x20')]:_0x27632e[_0x0fc2('0x1d')]+_0x27632e[_0x0fc2('0x1f')];var _0x18b4fe;if(_0x1ee41c>=_0x34bbae){_0x1ee41c=_0x34bbae;_0x18b4fe=0xc8;}else{_0x18b4fe=0xce;}_0x5096c6[_0x0fc2('0x1a')](_0x18b4fe);return _0x5096c6['set'](_0x0fc2('0x21'),_0x19e81c+'-'+_0x1ee41c+'/'+_0x34bbae)[_0x0fc2('0x1c')](_0x36f4e5);}return null;};}function patchUpdates(_0x41a39c){return function(_0x2394e8){try{jsonpatch[_0x0fc2('0x22')](_0x2394e8,_0x41a39c,!![]);}catch(_0x17ee48){return BPromise[_0x0fc2('0x23')](_0x17ee48);}return _0x2394e8['save']();};}function saveUpdates(_0x201938,_0x4f1096){return function(_0x15621e){if(_0x15621e){return _0x15621e[_0x0fc2('0x24')](_0x201938)[_0x0fc2('0x25')](function(_0x1370d5){return _0x1370d5;});}return null;};}function removeEntity(_0x5238db,_0x24cc20){return function(_0x15ec18){if(_0x15ec18){return _0x15ec18[_0x0fc2('0x26')]()[_0x0fc2('0x25')](function(){_0x5238db[_0x0fc2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3788,_0x3daa7d){return function(_0x5b63a8){if(!_0x5b63a8){_0x1f3788[_0x0fc2('0x19')](0x194);}return _0x5b63a8;};}function handleError(_0x1f2935,_0xee9dc4){_0xee9dc4=_0xee9dc4||0x1f4;return function(_0x1ee9b4){logger[_0x0fc2('0x27')](_0x1ee9b4[_0x0fc2('0x28')]);if(_0x1ee9b4['name']){delete _0x1ee9b4[_0x0fc2('0x29')];}_0x1f2935[_0x0fc2('0x1a')](_0xee9dc4)[_0x0fc2('0x2a')](_0x1ee9b4);};}exports[_0x0fc2('0x2b')]=function(_0x1f1dc2,_0x1d4c13){var _0x250e79={},_0x424439={},_0x655611={'count':0x0,'rows':[]};var _0x3fb811=_['map'](db['SquareRecording'][_0x0fc2('0x2c')],function(_0x2a440d){return{'name':_0x2a440d[_0x0fc2('0x2d')],'type':_0x2a440d[_0x0fc2('0x2e')][_0x0fc2('0x2f')]};});_0x424439[_0x0fc2('0x30')]=_['map'](_0x3fb811,_0x0fc2('0x29'));_0x424439['query']=_['keys'](_0x1f1dc2[_0x0fc2('0x31')]);_0x424439[_0x0fc2('0x32')]=_[_0x0fc2('0x33')](_0x424439[_0x0fc2('0x30')],_0x424439[_0x0fc2('0x31')]);_0x250e79['attributes']=_[_0x0fc2('0x33')](_0x424439[_0x0fc2('0x30')],qs['fields'](_0x1f1dc2['query'][_0x0fc2('0x34')]));_0x250e79['attributes']=_0x250e79[_0x0fc2('0x35')]['length']?_0x250e79[_0x0fc2('0x35')]:_0x424439['model'];if(!_0x1f1dc2[_0x0fc2('0x31')]['hasOwnProperty'](_0x0fc2('0x36'))){_0x250e79[_0x0fc2('0x1f')]=qs[_0x0fc2('0x1f')](_0x1f1dc2[_0x0fc2('0x31')][_0x0fc2('0x1f')]);_0x250e79[_0x0fc2('0x1d')]=qs['offset'](_0x1f1dc2[_0x0fc2('0x31')][_0x0fc2('0x1d')]);}_0x250e79['order']=qs[_0x0fc2('0x37')](_0x1f1dc2[_0x0fc2('0x31')][_0x0fc2('0x37')]);_0x250e79[_0x0fc2('0x38')]=qs[_0x0fc2('0x32')](_[_0x0fc2('0x39')](_0x1f1dc2[_0x0fc2('0x31')],_0x424439[_0x0fc2('0x32')]),_0x3fb811);if(_0x1f1dc2['query'][_0x0fc2('0x3a')]){_0x250e79['where']=_[_0x0fc2('0x3b')](_0x250e79[_0x0fc2('0x38')],{'$or':_[_0x0fc2('0x3c')](_0x3fb811,function(_0x3978bd){if(_0x3978bd[_0x0fc2('0x2e')]!==_0x0fc2('0x3d')){var _0x2857fc={};_0x2857fc[_0x3978bd[_0x0fc2('0x29')]]={'$like':'%'+_0x1f1dc2[_0x0fc2('0x31')]['filter']+'%'};return _0x2857fc;}})});}_0x250e79=_[_0x0fc2('0x3b')]({},_0x250e79,_0x1f1dc2['options']);var _0x1f422e={'where':_0x250e79[_0x0fc2('0x38')]};return db['SquareRecording'][_0x0fc2('0x20')](_0x1f422e)[_0x0fc2('0x25')](function(_0x392be7){_0x655611[_0x0fc2('0x20')]=_0x392be7;if(_0x1f1dc2[_0x0fc2('0x31')][_0x0fc2('0x3e')]){_0x250e79[_0x0fc2('0x3f')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x250e79);})[_0x0fc2('0x25')](function(_0x3f2f59){_0x655611[_0x0fc2('0x40')]=_0x3f2f59;return _0x655611;})[_0x0fc2('0x25')](respondWithFilteredResult(_0x1d4c13,_0x250e79))['catch'](handleError(_0x1d4c13,null));};exports[_0x0fc2('0x41')]=function(_0x443415,_0x120ed8){var _0x274b2f={'raw':!![],'where':{'id':_0x443415[_0x0fc2('0x42')]['id']}},_0x347fc5={};_0x347fc5[_0x0fc2('0x30')]=_[_0x0fc2('0x43')](db['SquareRecording'][_0x0fc2('0x2c')]);_0x347fc5['query']=_[_0x0fc2('0x43')](_0x443415[_0x0fc2('0x31')]);_0x347fc5['filters']=_[_0x0fc2('0x33')](_0x347fc5[_0x0fc2('0x30')],_0x347fc5[_0x0fc2('0x31')]);_0x274b2f[_0x0fc2('0x35')]=_[_0x0fc2('0x33')](_0x347fc5[_0x0fc2('0x30')],qs[_0x0fc2('0x34')](_0x443415[_0x0fc2('0x31')][_0x0fc2('0x34')]));_0x274b2f['attributes']=_0x274b2f[_0x0fc2('0x35')][_0x0fc2('0x44')]?_0x274b2f[_0x0fc2('0x35')]:_0x347fc5[_0x0fc2('0x30')];if(_0x443415[_0x0fc2('0x31')]['includeAll']){_0x274b2f[_0x0fc2('0x3f')]=[{'all':!![]}];}_0x274b2f=_[_0x0fc2('0x3b')]({},_0x274b2f,_0x443415[_0x0fc2('0x45')]);return db[_0x0fc2('0x46')][_0x0fc2('0x47')](_0x274b2f)[_0x0fc2('0x25')](handleEntityNotFound(_0x120ed8,null))[_0x0fc2('0x25')](respondWithResult(_0x120ed8,null))[_0x0fc2('0x48')](handleError(_0x120ed8,null));};exports[_0x0fc2('0x49')]=function(_0x213c66,_0x41c446){return db['SquareRecording']['create'](_0x213c66[_0x0fc2('0x4a')],{})[_0x0fc2('0x25')](respondWithResult(_0x41c446,0xc9))[_0x0fc2('0x48')](handleError(_0x41c446,null));};exports[_0x0fc2('0x24')]=function(_0x14e917,_0x5867a4){if(_0x14e917[_0x0fc2('0x4a')]['id']){delete _0x14e917['body']['id'];}return db[_0x0fc2('0x46')][_0x0fc2('0x47')]({'where':{'id':_0x14e917[_0x0fc2('0x42')]['id']}})[_0x0fc2('0x25')](handleEntityNotFound(_0x5867a4,null))[_0x0fc2('0x25')](saveUpdates(_0x14e917[_0x0fc2('0x4a')],null))['then'](respondWithResult(_0x5867a4,null))[_0x0fc2('0x48')](handleError(_0x5867a4,null));};exports[_0x0fc2('0x4b')]=function(_0x1c20c0,_0x34e454,_0x24ba17){var _0x569bb2=require('../../components/encryptor');var _0xfe6779=![];var _0x13bd85={};if(_0x1c20c0[_0x0fc2('0x31')][_0x0fc2('0x2e')]&&_0x1c20c0[_0x0fc2('0x31')]['type']==='uniqueid'){_0x13bd85['uniqueid']=_0x1c20c0['params']['id'];}else{_0x13bd85['id']=_0x1c20c0[_0x0fc2('0x42')]['id'];}return db[_0x0fc2('0x46')][_0x0fc2('0x47')]({'where':_0x13bd85,'attributes':['id',_0x0fc2('0x4c'),'filename'],'raw':!![]})[_0x0fc2('0x25')](handleEntityNotFound(_0x34e454,null))[_0x0fc2('0x25')](function(_0x3e8f36){if(_0x3e8f36){var _0x36598f=_0x3e8f36[_0x0fc2('0x4c')];var _0x29e27f=util[_0x0fc2('0x4d')](_0x0fc2('0x4e'),_0x36598f);if(fs[_0x0fc2('0x4f')](_0x29e27f)){_0xfe6779=!![];return _0x569bb2[_0x0fc2('0x50')](_0x29e27f,_0x36598f,config[_0x0fc2('0x51')][_0x0fc2('0x52')])[_0x0fc2('0x25')](function(){return _0x3e8f36;});}return _0x3e8f36;}})[_0x0fc2('0x25')](function(_0x2a916e){if(_0x2a916e){var _0x4b6a3e=_0x2a916e[_0x0fc2('0x4c')];if(!fs['existsSync'](_0x4b6a3e)){throw new db[(_0x0fc2('0x53'))][(_0x0fc2('0x54'))](_0x0fc2('0x55'));}if(_0x2a916e[_0x0fc2('0x56')]){return _0x34e454[_0x0fc2('0x4b')](_0x4b6a3e,_0x2a916e[_0x0fc2('0x56')]+path[_0x0fc2('0x57')](_0x4b6a3e),function(){if(_0xfe6779){fs[_0x0fc2('0x58')](_0x4b6a3e);}});}else{return _0x34e454[_0x0fc2('0x4b')](_0x4b6a3e,function(_0x44faf1){if(_0xfe6779){fs['unlink'](_0x4b6a3e);}});}}})[_0x0fc2('0x48')](function(_0x40f1dc){if(_0x40f1dc[_0x0fc2('0x59')]===_0x0fc2('0x55')){_0x34e454[_0x0fc2('0x1a')](0x194)[_0x0fc2('0x2a')](_0x0fc2('0x5a'));}else{return handleError(_0x34e454,null);}});};exports['destroy']=function(_0xaa3aed,_0x2cac3e){return db[_0x0fc2('0x46')][_0x0fc2('0x47')]({'where':{'id':_0xaa3aed[_0x0fc2('0x42')]['id']}})['then'](function(_0x234420){if(_[_0x0fc2('0x5b')](_0x234420)){throw new ReferenceError(_0x0fc2('0x5c'));}return _0x234420;})['then'](function(_0x3f619d){var _0x23de45=_0x3f619d[_0x0fc2('0x4c')];logger[_0x0fc2('0x5d')](_0x0fc2('0x5e'),_0x23de45);if(!_[_0x0fc2('0x5b')](_0x3f619d[_0x0fc2('0x4c')])&&fs[_0x0fc2('0x4f')](_0x23de45)){logger[_0x0fc2('0x5d')](_0x0fc2('0x5f')+_0x23de45+_0x0fc2('0x60'));fs[_0x0fc2('0x61')](_0x23de45);}_0x23de45=_0x23de45+_0x0fc2('0x62');if(!_['isNil'](_0x3f619d[_0x0fc2('0x4c')])&&fs[_0x0fc2('0x4f')](_0x23de45)){logger[_0x0fc2('0x5d')](_0x0fc2('0x5f')+_0x23de45+_0x0fc2('0x60'));fs['unlinkSync'](_0x23de45);}return _0x3f619d;})[_0x0fc2('0x25')](function(_0x590a38){if(!_0x590a38)throw new InternalError();return _0x590a38[_0x0fc2('0x26')]();})[_0x0fc2('0x25')](function(){_0x2cac3e[_0x0fc2('0x1a')](0xcc)[_0x0fc2('0x1b')]();})['catch'](handleError(_0x2cac3e,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f0caf57..dd449e2 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 _0x0eeb=['../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0eeb[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('SquareRecording',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb470=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0xb470,0x75));var _0x0b47=function(_0x6e3e51,_0x217246){_0x6e3e51=_0x6e3e51-0x0;var _0x285c68=_0xb470[_0x6e3e51];return _0x285c68;};'use strict';var _=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var logger=require(_0x0b47('0x2'))(_0x0b47('0x3'));var moment=require('moment');var BPromise=require(_0x0b47('0x4'));var rp=require(_0x0b47('0x5'));var fs=require('fs');var path=require(_0x0b47('0x6'));var rimraf=require('rimraf');var config=require(_0x0b47('0x7'));var attributes=require(_0x0b47('0x8'));module[_0x0b47('0x9')]=function(_0x7cb3c9,_0xc1211c){return _0x7cb3c9[_0x0b47('0xa')](_0x0b47('0xb'),attributes,{'tableName':_0x0b47('0xc'),'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 eeb8f48..e79fbbf 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 _0x0e93=['client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x0e93,0x158));var _0x30e9=function(_0x1e59b0,_0x3bfdd8){_0x1e59b0=_0x1e59b0-0x0;var _0x56c55b=_0x0e93[_0x1e59b0];return _0x56c55b;};'use strict';var _=require(_0x30e9('0x0'));var util=require(_0x30e9('0x1'));var moment=require(_0x30e9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x30e9('0x4'));var logger=require(_0x30e9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x30e9('0x6')][_0x30e9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42ac44,_0x3d66b7,_0x12460b){return new BPromise(function(_0x3eaad9,_0x77566f){return client[_0x30e9('0x8')](_0x42ac44,_0x12460b)['then'](function(_0x17ddd3){logger[_0x30e9('0x9')](_0x30e9('0xa'),_0x3d66b7,_0x30e9('0xb'));logger[_0x30e9('0xc')](_0x30e9('0xd'),_0x3d66b7,_0x30e9('0xb'),JSON[_0x30e9('0xe')](_0x17ddd3));if(_0x17ddd3[_0x30e9('0xf')]){if(_0x17ddd3['error']['code']===0x1f4){logger[_0x30e9('0xf')](_0x30e9('0xa'),_0x3d66b7,_0x17ddd3[_0x30e9('0xf')]['message']);return _0x77566f(_0x17ddd3[_0x30e9('0xf')]['message']);}logger[_0x30e9('0xf')](_0x30e9('0xa'),_0x3d66b7,_0x17ddd3[_0x30e9('0xf')][_0x30e9('0x10')]);return _0x3eaad9(_0x17ddd3[_0x30e9('0xf')]['message']);}else{logger[_0x30e9('0x9')](_0x30e9('0xa'),_0x3d66b7,'request\x20sent');_0x3eaad9(_0x17ddd3[_0x30e9('0x11')][_0x30e9('0x10')]);}})[_0x30e9('0x12')](function(_0x3286f8){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3d66b7,_0x3286f8);_0x77566f(_0x3286f8);});});}exports[_0x30e9('0x13')]=function(_0x23bff3){var _0x2a7cc1=this;return new Promise(function(_0x3d9272,_0x53609b){return db[_0x30e9('0x14')]['create'](_0x23bff3[_0x30e9('0x15')],{'raw':_0x23bff3[_0x30e9('0x16')]?_0x23bff3['options'][_0x30e9('0x17')]===undefined?!![]:![]:!![]})[_0x30e9('0x18')](function(_0x190aad){logger[_0x30e9('0x9')](_0x30e9('0x13'),_0x23bff3);logger[_0x30e9('0xc')]('CreateSquareRecording',_0x23bff3,JSON[_0x30e9('0xe')](_0x190aad));_0x3d9272(_0x190aad);})[_0x30e9('0x12')](function(_0x1a7422){logger['error'](_0x30e9('0x13'),_0x1a7422['message'],_0x23bff3);_0x53609b(_0x2a7cc1[_0x30e9('0xf')](0x1f4,_0x1a7422[_0x30e9('0x10')]));});});}; \ No newline at end of file +var _0x7035=['body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create'];(function(_0x1cd5b1,_0x58dd23){var _0x25b4c7=function(_0x272195){while(--_0x272195){_0x1cd5b1['push'](_0x1cd5b1['shift']());}};_0x25b4c7(++_0x58dd23);}(_0x7035,0x1b7));var _0x5703=function(_0x32d9e0,_0x5eb745){_0x32d9e0=_0x32d9e0-0x0;var _0x501b23=_0x7035[_0x32d9e0];return _0x501b23;};'use strict';var _=require(_0x5703('0x0'));var util=require(_0x5703('0x1'));var moment=require(_0x5703('0x2'));var BPromise=require(_0x5703('0x3'));var rs=require(_0x5703('0x4'));var fs=require('fs');var Redis=require(_0x5703('0x5'));var db=require(_0x5703('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5703('0x7'))('rpc');var config=require(_0x5703('0x8'));var jayson=require(_0x5703('0x9'));var client=jayson['client'][_0x5703('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274b5b,_0x3f49ce,_0x1e0077){return new BPromise(function(_0x33c51d,_0x595053){return client['request'](_0x274b5b,_0x1e0077)[_0x5703('0xb')](function(_0x347acf){logger[_0x5703('0xc')](_0x5703('0xd'),_0x3f49ce,'request\x20sent');logger[_0x5703('0xe')](_0x5703('0xf'),_0x3f49ce,'request\x20sent',JSON['stringify'](_0x347acf));if(_0x347acf[_0x5703('0x10')]){if(_0x347acf['error'][_0x5703('0x11')]===0x1f4){logger['error'](_0x5703('0xd'),_0x3f49ce,_0x347acf[_0x5703('0x10')][_0x5703('0x12')]);return _0x595053(_0x347acf[_0x5703('0x10')]['message']);}logger[_0x5703('0x10')](_0x5703('0xd'),_0x3f49ce,_0x347acf[_0x5703('0x10')]['message']);return _0x33c51d(_0x347acf[_0x5703('0x10')][_0x5703('0x12')]);}else{logger['info'](_0x5703('0xd'),_0x3f49ce,_0x5703('0x13'));_0x33c51d(_0x347acf[_0x5703('0x14')][_0x5703('0x12')]);}})[_0x5703('0x15')](function(_0x17766c){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3f49ce,_0x17766c);_0x595053(_0x17766c);});});}exports[_0x5703('0x16')]=function(_0x3daccf){var _0x15c23=this;return new Promise(function(_0xfdd4c6,_0x972596){return db[_0x5703('0x17')][_0x5703('0x18')](_0x3daccf[_0x5703('0x19')],{'raw':_0x3daccf[_0x5703('0x1a')]?_0x3daccf['options'][_0x5703('0x1b')]===undefined?!![]:![]:!![]})[_0x5703('0xb')](function(_0x5f2d53){logger[_0x5703('0xc')](_0x5703('0x16'),_0x3daccf);logger[_0x5703('0xe')](_0x5703('0x16'),_0x3daccf,JSON[_0x5703('0x1c')](_0x5f2d53));_0xfdd4c6(_0x5f2d53);})['catch'](function(_0x2789ce){logger['error'](_0x5703('0x16'),_0x2789ce[_0x5703('0x12')],_0x3daccf);_0x972596(_0x15c23[_0x5703('0x10')](0x1f4,_0x2789ce['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 077398e..5e087de 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(_0x80591,_0x576439){var _0x4e9466=function(_0x2b2452){while(--_0x2b2452){_0x80591['push'](_0x80591['shift']());}};_0x4e9466(++_0x576439);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 8b344b9..8b8cc5e 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 _0x42e7=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x40912e,_0x4ed6be){var _0x222657=function(_0x225bf1){while(--_0x225bf1){_0x40912e['push'](_0x40912e['shift']());}};_0x222657(++_0x4ed6be);}(_0x42e7,0xb7));var _0x742e=function(_0x4a6f6a,_0x2e2051){_0x4a6f6a=_0x4a6f6a-0x0;var _0x2b3860=_0x42e7[_0x4a6f6a];return _0x2b3860;};'use strict';var Sequelize=require(_0x742e('0x0'));module['exports']={'network':{'type':Sequelize[_0x742e('0x1')]},'network_script':{'type':Sequelize[_0x742e('0x1')]},'request':{'type':Sequelize[_0x742e('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x742e('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x742e('0x1')]},'version':{'type':Sequelize[_0x742e('0x1')]},'callerid':{'type':Sequelize[_0x742e('0x1')]},'calleridname':{'type':Sequelize[_0x742e('0x1')]},'callingpres':{'type':Sequelize[_0x742e('0x1')]},'callingani2':{'type':Sequelize[_0x742e('0x1')]},'callington':{'type':Sequelize[_0x742e('0x1')]},'callingtns':{'type':Sequelize[_0x742e('0x1')]},'dnid':{'type':Sequelize[_0x742e('0x1')]},'rdnis':{'type':Sequelize[_0x742e('0x1')]},'context':{'type':Sequelize[_0x742e('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x742e('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x742e('0x1')]},'threadid':{'type':Sequelize[_0x742e('0x1')]},'project_name':{'type':Sequelize[_0x742e('0x1')]},'joinAt':{'type':Sequelize[_0x742e('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x742e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x84e0=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x144e7a,_0x31f7cc){var _0xf3aad5=function(_0x5c12be){while(--_0x5c12be){_0x144e7a['push'](_0x144e7a['shift']());}};_0xf3aad5(++_0x31f7cc);}(_0x84e0,0x1c9));var _0x084e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x084e('0x0'));module[_0x084e('0x1')]={'network':{'type':Sequelize[_0x084e('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x084e('0x2')]},'channel':{'type':Sequelize[_0x084e('0x2')]},'language':{'type':Sequelize[_0x084e('0x2')]},'type':{'type':Sequelize[_0x084e('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x084e('0x2')]},'callerid':{'type':Sequelize[_0x084e('0x2')]},'calleridname':{'type':Sequelize[_0x084e('0x2')]},'callingpres':{'type':Sequelize[_0x084e('0x2')]},'callingani2':{'type':Sequelize[_0x084e('0x2')]},'callington':{'type':Sequelize[_0x084e('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x084e('0x2')]},'rdnis':{'type':Sequelize[_0x084e('0x2')]},'context':{'type':Sequelize[_0x084e('0x2')]},'extension':{'type':Sequelize[_0x084e('0x2')]},'priority':{'type':Sequelize[_0x084e('0x2')]},'enhanced':{'type':Sequelize[_0x084e('0x2')]},'accountcode':{'type':Sequelize[_0x084e('0x2')]},'threadid':{'type':Sequelize[_0x084e('0x2')]},'project_name':{'type':Sequelize[_0x084e('0x2')]},'joinAt':{'type':Sequelize[_0x084e('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x084e('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index dfbc913..1550cf4 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 _0x749c=['../../config/environment','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','SquareReport','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','update','find','describe','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','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x26efb1,_0x15548c){var _0x23643a=function(_0x44c542){while(--_0x44c542){_0x26efb1['push'](_0x26efb1['shift']());}};_0x23643a(++_0x15548c);}(_0x749c,0x1a5));var _0xc749=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x749c[_0x5ce8b9];return _0xe34be0;};'use strict';var emlformat=require(_0xc749('0x0'));var rimraf=require(_0xc749('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc749('0x2'));var rp=require(_0xc749('0x3'));var moment=require(_0xc749('0x4'));var BPromise=require(_0xc749('0x5'));var Mustache=require(_0xc749('0x6'));var util=require(_0xc749('0x7'));var path=require(_0xc749('0x8'));var sox=require(_0xc749('0x9'));var csv=require(_0xc749('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc749('0xb'));var _=require(_0xc749('0xc'));var squel=require('squel');var crypto=require(_0xc749('0xd'));var jsforce=require(_0xc749('0xe'));var deskjs=require(_0xc749('0xf'));var toCsv=require(_0xc749('0xa'));var querystring=require(_0xc749('0x10'));var Papa=require(_0xc749('0x11'));var Redis=require(_0xc749('0x12'));var authService=require(_0xc749('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc749('0x14'));var logger=require(_0xc749('0x15'))('api');var utils=require(_0xc749('0x16'));var config=require(_0xc749('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c7657,_0x520370){_0x520370=_0x520370||0xcc;return function(_0x24409e){if(_0x24409e){return _0x1c7657['sendStatus'](_0x520370);}return _0x1c7657[_0xc749('0x18')](_0x520370)[_0xc749('0x19')]();};}function respondWithResult(_0x82c5c,_0x17b165){_0x17b165=_0x17b165||0xc8;return function(_0x4a96fc){if(_0x4a96fc){return _0x82c5c['status'](_0x17b165)[_0xc749('0x1a')](_0x4a96fc);}};}function respondWithFilteredResult(_0x2b8399,_0x2d9a13){return function(_0x370baf){if(_0x370baf){var _0x580c06=typeof _0x2d9a13['offset']==='undefined'&&typeof _0x2d9a13[_0xc749('0x1b')]===_0xc749('0x1c');var _0xb7e565=_0x370baf[_0xc749('0x1d')];var _0x1569ef=_0x580c06?0x0:_0x2d9a13[_0xc749('0x1e')];var _0x261cc3=_0x580c06?_0x370baf['count']:_0x2d9a13['offset']+_0x2d9a13['limit'];var _0x471e80;if(_0x261cc3>=_0xb7e565){_0x261cc3=_0xb7e565;_0x471e80=0xc8;}else{_0x471e80=0xce;}_0x2b8399[_0xc749('0x18')](_0x471e80);return _0x2b8399[_0xc749('0x1f')](_0xc749('0x20'),_0x1569ef+'-'+_0x261cc3+'/'+_0xb7e565)['json'](_0x370baf);}return null;};}function patchUpdates(_0x522e62){return function(_0x2d8570){try{jsonpatch[_0xc749('0x21')](_0x2d8570,_0x522e62,!![]);}catch(_0x477579){return BPromise[_0xc749('0x22')](_0x477579);}return _0x2d8570[_0xc749('0x23')]();};}function saveUpdates(_0x49dab7,_0x3469ab){return function(_0x34c3c0){if(_0x34c3c0){return _0x34c3c0['update'](_0x49dab7)[_0xc749('0x24')](function(_0xf4cf70){return _0xf4cf70;});}return null;};}function removeEntity(_0x5f2ee3,_0x21001b){return function(_0x5ced62){if(_0x5ced62){return _0x5ced62[_0xc749('0x25')]()[_0xc749('0x24')](function(){_0x5f2ee3[_0xc749('0x18')](0xcc)[_0xc749('0x19')]();});}};}function handleEntityNotFound(_0x24caa8,_0x58c012){return function(_0x4ae925){if(!_0x4ae925){_0x24caa8['sendStatus'](0x194);}return _0x4ae925;};}function handleError(_0x4bc1bd,_0x30015a){_0x30015a=_0x30015a||0x1f4;return function(_0x2ba311){logger['error'](_0x2ba311[_0xc749('0x26')]);if(_0x2ba311[_0xc749('0x27')]){delete _0x2ba311[_0xc749('0x27')];}_0x4bc1bd['status'](_0x30015a)[_0xc749('0x28')](_0x2ba311);};}exports['index']=function(_0x2f9952,_0x53dce6){var _0x8c6416={},_0x28a12d={},_0x1b6c60={'count':0x0,'rows':[]};var _0x7b3f5f=_['map'](db[_0xc749('0x29')][_0xc749('0x2a')],function(_0x223f4f){return{'name':_0x223f4f['fieldName'],'type':_0x223f4f[_0xc749('0x2b')][_0xc749('0x2c')]};});_0x28a12d[_0xc749('0x2d')]=_[_0xc749('0x2e')](_0x7b3f5f,'name');_0x28a12d[_0xc749('0x2f')]=_[_0xc749('0x30')](_0x2f9952['query']);_0x28a12d[_0xc749('0x31')]=_['intersection'](_0x28a12d['model'],_0x28a12d[_0xc749('0x2f')]);_0x8c6416[_0xc749('0x32')]=_[_0xc749('0x33')](_0x28a12d['model'],qs[_0xc749('0x34')](_0x2f9952[_0xc749('0x2f')][_0xc749('0x34')]));_0x8c6416['attributes']=_0x8c6416[_0xc749('0x32')][_0xc749('0x35')]?_0x8c6416[_0xc749('0x32')]:_0x28a12d[_0xc749('0x2d')];if(!_0x2f9952[_0xc749('0x2f')]['hasOwnProperty'](_0xc749('0x36'))){_0x8c6416['limit']=qs[_0xc749('0x1b')](_0x2f9952[_0xc749('0x2f')][_0xc749('0x1b')]);_0x8c6416[_0xc749('0x1e')]=qs[_0xc749('0x1e')](_0x2f9952[_0xc749('0x2f')]['offset']);}_0x8c6416[_0xc749('0x37')]=qs['sort'](_0x2f9952[_0xc749('0x2f')]['sort']);_0x8c6416[_0xc749('0x38')]=qs[_0xc749('0x31')](_[_0xc749('0x39')](_0x2f9952['query'],_0x28a12d[_0xc749('0x31')]),_0x7b3f5f);if(_0x2f9952['query'][_0xc749('0x3a')]){_0x8c6416['where']=_[_0xc749('0x3b')](_0x8c6416[_0xc749('0x38')],{'$or':_['map'](_0x7b3f5f,function(_0x18fc29){if(_0x18fc29[_0xc749('0x2b')]!==_0xc749('0x3c')){var _0x21e2eb={};_0x21e2eb[_0x18fc29[_0xc749('0x27')]]={'$like':'%'+_0x2f9952[_0xc749('0x2f')][_0xc749('0x3a')]+'%'};return _0x21e2eb;}})});}_0x8c6416=_[_0xc749('0x3b')]({},_0x8c6416,_0x2f9952['options']);var _0x5bea79={'where':_0x8c6416[_0xc749('0x38')]};return db[_0xc749('0x29')][_0xc749('0x1d')](_0x5bea79)[_0xc749('0x24')](function(_0x3d48c0){_0x1b6c60[_0xc749('0x1d')]=_0x3d48c0;if(_0x2f9952['query'][_0xc749('0x3d')]){_0x8c6416[_0xc749('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0xc749('0x3f')](_0x8c6416);})[_0xc749('0x24')](function(_0x6464db){_0x1b6c60[_0xc749('0x40')]=_0x6464db;return _0x1b6c60;})[_0xc749('0x24')](respondWithFilteredResult(_0x53dce6,_0x8c6416))['catch'](handleError(_0x53dce6,null));};exports[_0xc749('0x41')]=function(_0x57c2f8,_0x531164){var _0x2771e2={'raw':!![],'where':{'id':_0x57c2f8[_0xc749('0x42')]['id']}},_0x2124ef={};_0x2124ef[_0xc749('0x2d')]=_[_0xc749('0x30')](db[_0xc749('0x29')][_0xc749('0x2a')]);_0x2124ef['query']=_[_0xc749('0x30')](_0x57c2f8[_0xc749('0x2f')]);_0x2124ef[_0xc749('0x31')]=_[_0xc749('0x33')](_0x2124ef[_0xc749('0x2d')],_0x2124ef[_0xc749('0x2f')]);_0x2771e2[_0xc749('0x32')]=_[_0xc749('0x33')](_0x2124ef[_0xc749('0x2d')],qs[_0xc749('0x34')](_0x57c2f8[_0xc749('0x2f')][_0xc749('0x34')]));_0x2771e2['attributes']=_0x2771e2[_0xc749('0x32')][_0xc749('0x35')]?_0x2771e2[_0xc749('0x32')]:_0x2124ef[_0xc749('0x2d')];if(_0x57c2f8['query'][_0xc749('0x3d')]){_0x2771e2[_0xc749('0x3e')]=[{'all':!![]}];}_0x2771e2=_['merge']({},_0x2771e2,_0x57c2f8[_0xc749('0x43')]);return db[_0xc749('0x29')]['find'](_0x2771e2)[_0xc749('0x24')](handleEntityNotFound(_0x531164,null))[_0xc749('0x24')](respondWithResult(_0x531164,null))[_0xc749('0x44')](handleError(_0x531164,null));};exports[_0xc749('0x45')]=function(_0x5a4ce4,_0x3667f3){return db[_0xc749('0x29')][_0xc749('0x45')](_0x5a4ce4[_0xc749('0x46')],{})['then'](respondWithResult(_0x3667f3,0xc9))[_0xc749('0x44')](handleError(_0x3667f3,null));};exports[_0xc749('0x47')]=function(_0x19ad53,_0x1eda8c){if(_0x19ad53['body']['id']){delete _0x19ad53[_0xc749('0x46')]['id'];}return db[_0xc749('0x29')][_0xc749('0x48')]({'where':{'id':_0x19ad53[_0xc749('0x42')]['id']}})['then'](handleEntityNotFound(_0x1eda8c,null))[_0xc749('0x24')](saveUpdates(_0x19ad53[_0xc749('0x46')],null))[_0xc749('0x24')](respondWithResult(_0x1eda8c,null))[_0xc749('0x44')](handleError(_0x1eda8c,null));};exports[_0xc749('0x25')]=function(_0x257121,_0x2b8f87){return db['SquareReport']['find']({'where':{'id':_0x257121[_0xc749('0x42')]['id']}})[_0xc749('0x24')](handleEntityNotFound(_0x2b8f87,null))[_0xc749('0x24')](removeEntity(_0x2b8f87,null))[_0xc749('0x44')](handleError(_0x2b8f87,null));};exports['describe']=function(_0x44a771,_0x6b75ab){return db[_0xc749('0x29')][_0xc749('0x49')]()[_0xc749('0x24')](respondWithResult(_0x6b75ab,null))[_0xc749('0x44')](handleError(_0x6b75ab,null));}; \ No newline at end of file +var _0x310a=['then','destroy','sendStatus','stack','name','send','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','SquareReport','include','findAll','show','params','rawAttributes','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject'];(function(_0x682037,_0x72778a){var _0x375c3e=function(_0x157b87){while(--_0x157b87){_0x682037['push'](_0x682037['shift']());}};_0x375c3e(++_0x72778a);}(_0x310a,0x75));var _0xa310=function(_0x22a97c,_0x1c252e){_0x22a97c=_0x22a97c-0x0;var _0x519de5=_0x310a[_0x22a97c];return _0x519de5;};'use strict';var emlformat=require(_0xa310('0x0'));var rimraf=require(_0xa310('0x1'));var zipdir=require(_0xa310('0x2'));var jsonpatch=require(_0xa310('0x3'));var rp=require(_0xa310('0x4'));var moment=require(_0xa310('0x5'));var BPromise=require(_0xa310('0x6'));var Mustache=require(_0xa310('0x7'));var util=require(_0xa310('0x8'));var path=require(_0xa310('0x9'));var sox=require(_0xa310('0xa'));var csv=require(_0xa310('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa310('0xc'));var _=require(_0xa310('0xd'));var squel=require(_0xa310('0xe'));var crypto=require('crypto');var jsforce=require(_0xa310('0xf'));var deskjs=require(_0xa310('0x10'));var toCsv=require(_0xa310('0xb'));var querystring=require(_0xa310('0x11'));var Papa=require(_0xa310('0x12'));var Redis=require(_0xa310('0x13'));var authService=require(_0xa310('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa310('0x15'));var hardwareService=require(_0xa310('0x16'));var logger=require(_0xa310('0x17'))(_0xa310('0x18'));var utils=require(_0xa310('0x19'));var config=require(_0xa310('0x1a'));var licenseUtil=require(_0xa310('0x1b'));var db=require(_0xa310('0x1c'))['db'];function respondWithStatusCode(_0x4c549b,_0x4bbb5b){_0x4bbb5b=_0x4bbb5b||0xcc;return function(_0x1732e1){if(_0x1732e1){return _0x4c549b['sendStatus'](_0x4bbb5b);}return _0x4c549b[_0xa310('0x1d')](_0x4bbb5b)[_0xa310('0x1e')]();};}function respondWithResult(_0xf2c164,_0x2d2adb){_0x2d2adb=_0x2d2adb||0xc8;return function(_0x5dc5b5){if(_0x5dc5b5){return _0xf2c164[_0xa310('0x1d')](_0x2d2adb)['json'](_0x5dc5b5);}};}function respondWithFilteredResult(_0x18941b,_0x4b5186){return function(_0x29ffb9){if(_0x29ffb9){var _0x4172f9=typeof _0x4b5186[_0xa310('0x1f')]===_0xa310('0x20')&&typeof _0x4b5186[_0xa310('0x21')]===_0xa310('0x20');var _0x366cae=_0x29ffb9[_0xa310('0x22')];var _0xf030e5=_0x4172f9?0x0:_0x4b5186['offset'];var _0x67e6fd=_0x4172f9?_0x29ffb9['count']:_0x4b5186[_0xa310('0x1f')]+_0x4b5186['limit'];var _0x53bb35;if(_0x67e6fd>=_0x366cae){_0x67e6fd=_0x366cae;_0x53bb35=0xc8;}else{_0x53bb35=0xce;}_0x18941b[_0xa310('0x1d')](_0x53bb35);return _0x18941b[_0xa310('0x23')](_0xa310('0x24'),_0xf030e5+'-'+_0x67e6fd+'/'+_0x366cae)[_0xa310('0x25')](_0x29ffb9);}return null;};}function patchUpdates(_0x100405){return function(_0x263c5c){try{jsonpatch['apply'](_0x263c5c,_0x100405,!![]);}catch(_0x296768){return BPromise[_0xa310('0x26')](_0x296768);}return _0x263c5c['save']();};}function saveUpdates(_0x3be698,_0x414368){return function(_0x5b97e3){if(_0x5b97e3){return _0x5b97e3['update'](_0x3be698)[_0xa310('0x27')](function(_0x586591){return _0x586591;});}return null;};}function removeEntity(_0xfe11cf,_0x4dd328){return function(_0x413ba4){if(_0x413ba4){return _0x413ba4[_0xa310('0x28')]()['then'](function(){_0xfe11cf[_0xa310('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ebd7e,_0x17c477){return function(_0x1e9d1e){if(!_0x1e9d1e){_0x2ebd7e[_0xa310('0x29')](0x194);}return _0x1e9d1e;};}function handleError(_0x29ec78,_0x4e0122){_0x4e0122=_0x4e0122||0x1f4;return function(_0x2ff20f){logger['error'](_0x2ff20f[_0xa310('0x2a')]);if(_0x2ff20f[_0xa310('0x2b')]){delete _0x2ff20f[_0xa310('0x2b')];}_0x29ec78[_0xa310('0x1d')](_0x4e0122)[_0xa310('0x2c')](_0x2ff20f);};}exports['index']=function(_0x3b2e71,_0x22ddbb){var _0xc72c0a={},_0x5041e7={},_0xee832a={'count':0x0,'rows':[]};var _0x170f25=_['map'](db['SquareReport']['rawAttributes'],function(_0x411cd2){return{'name':_0x411cd2[_0xa310('0x2d')],'type':_0x411cd2[_0xa310('0x2e')][_0xa310('0x2f')]};});_0x5041e7[_0xa310('0x30')]=_[_0xa310('0x31')](_0x170f25,_0xa310('0x2b'));_0x5041e7[_0xa310('0x32')]=_[_0xa310('0x33')](_0x3b2e71[_0xa310('0x32')]);_0x5041e7[_0xa310('0x34')]=_['intersection'](_0x5041e7[_0xa310('0x30')],_0x5041e7[_0xa310('0x32')]);_0xc72c0a[_0xa310('0x35')]=_[_0xa310('0x36')](_0x5041e7['model'],qs[_0xa310('0x37')](_0x3b2e71['query']['fields']));_0xc72c0a[_0xa310('0x35')]=_0xc72c0a[_0xa310('0x35')][_0xa310('0x38')]?_0xc72c0a[_0xa310('0x35')]:_0x5041e7[_0xa310('0x30')];if(!_0x3b2e71[_0xa310('0x32')][_0xa310('0x39')](_0xa310('0x3a'))){_0xc72c0a[_0xa310('0x21')]=qs['limit'](_0x3b2e71[_0xa310('0x32')][_0xa310('0x21')]);_0xc72c0a[_0xa310('0x1f')]=qs[_0xa310('0x1f')](_0x3b2e71[_0xa310('0x32')][_0xa310('0x1f')]);}_0xc72c0a[_0xa310('0x3b')]=qs['sort'](_0x3b2e71[_0xa310('0x32')][_0xa310('0x3c')]);_0xc72c0a[_0xa310('0x3d')]=qs[_0xa310('0x34')](_[_0xa310('0x3e')](_0x3b2e71['query'],_0x5041e7[_0xa310('0x34')]),_0x170f25);if(_0x3b2e71[_0xa310('0x32')]['filter']){_0xc72c0a[_0xa310('0x3d')]=_[_0xa310('0x3f')](_0xc72c0a[_0xa310('0x3d')],{'$or':_[_0xa310('0x31')](_0x170f25,function(_0x3d7260){if(_0x3d7260[_0xa310('0x2e')]!=='VIRTUAL'){var _0x5de8ca={};_0x5de8ca[_0x3d7260[_0xa310('0x2b')]]={'$like':'%'+_0x3b2e71[_0xa310('0x32')][_0xa310('0x40')]+'%'};return _0x5de8ca;}})});}_0xc72c0a=_['merge']({},_0xc72c0a,_0x3b2e71[_0xa310('0x41')]);var _0x150b56={'where':_0xc72c0a[_0xa310('0x3d')]};return db[_0xa310('0x42')][_0xa310('0x22')](_0x150b56)[_0xa310('0x27')](function(_0xa1d40f){_0xee832a['count']=_0xa1d40f;if(_0x3b2e71[_0xa310('0x32')]['includeAll']){_0xc72c0a[_0xa310('0x43')]=[{'all':!![]}];}return db[_0xa310('0x42')][_0xa310('0x44')](_0xc72c0a);})['then'](function(_0x3778a1){_0xee832a['rows']=_0x3778a1;return _0xee832a;})[_0xa310('0x27')](respondWithFilteredResult(_0x22ddbb,_0xc72c0a))['catch'](handleError(_0x22ddbb,null));};exports[_0xa310('0x45')]=function(_0x92f2e9,_0xcd7633){var _0x4d6c39={'raw':!![],'where':{'id':_0x92f2e9[_0xa310('0x46')]['id']}},_0x402c3e={};_0x402c3e['model']=_[_0xa310('0x33')](db['SquareReport'][_0xa310('0x47')]);_0x402c3e[_0xa310('0x32')]=_['keys'](_0x92f2e9[_0xa310('0x32')]);_0x402c3e['filters']=_[_0xa310('0x36')](_0x402c3e[_0xa310('0x30')],_0x402c3e[_0xa310('0x32')]);_0x4d6c39[_0xa310('0x35')]=_[_0xa310('0x36')](_0x402c3e[_0xa310('0x30')],qs['fields'](_0x92f2e9['query'][_0xa310('0x37')]));_0x4d6c39[_0xa310('0x35')]=_0x4d6c39[_0xa310('0x35')][_0xa310('0x38')]?_0x4d6c39[_0xa310('0x35')]:_0x402c3e[_0xa310('0x30')];if(_0x92f2e9[_0xa310('0x32')]['includeAll']){_0x4d6c39[_0xa310('0x43')]=[{'all':!![]}];}_0x4d6c39=_[_0xa310('0x3f')]({},_0x4d6c39,_0x92f2e9[_0xa310('0x41')]);return db[_0xa310('0x42')][_0xa310('0x48')](_0x4d6c39)[_0xa310('0x27')](handleEntityNotFound(_0xcd7633,null))[_0xa310('0x27')](respondWithResult(_0xcd7633,null))[_0xa310('0x49')](handleError(_0xcd7633,null));};exports[_0xa310('0x4a')]=function(_0xfec9cd,_0x12c778){return db[_0xa310('0x42')][_0xa310('0x4a')](_0xfec9cd[_0xa310('0x4b')],{})[_0xa310('0x27')](respondWithResult(_0x12c778,0xc9))[_0xa310('0x49')](handleError(_0x12c778,null));};exports[_0xa310('0x4c')]=function(_0x7da6c2,_0x2d861e){if(_0x7da6c2[_0xa310('0x4b')]['id']){delete _0x7da6c2[_0xa310('0x4b')]['id'];}return db['SquareReport'][_0xa310('0x48')]({'where':{'id':_0x7da6c2[_0xa310('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d861e,null))[_0xa310('0x27')](saveUpdates(_0x7da6c2[_0xa310('0x4b')],null))['then'](respondWithResult(_0x2d861e,null))['catch'](handleError(_0x2d861e,null));};exports['destroy']=function(_0x4f98b1,_0x30b650){return db[_0xa310('0x42')][_0xa310('0x48')]({'where':{'id':_0x4f98b1[_0xa310('0x46')]['id']}})[_0xa310('0x27')](handleEntityNotFound(_0x30b650,null))[_0xa310('0x27')](removeEntity(_0x30b650,null))[_0xa310('0x49')](handleError(_0x30b650,null));};exports[_0xa310('0x4d')]=function(_0x9ce8de,_0x395884){return db['SquareReport']['describe']()[_0xa310('0x27')](respondWithResult(_0x395884,null))[_0xa310('0x49')](handleError(_0x395884,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d655ec5..411750d 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 _0xf6e6=['util','../../config/logger','api','moment','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xf6e6,0x1dc));var _0x6f6e=function(_0x3023b9,_0x556a){_0x3023b9=_0x3023b9-0x0;var _0x5a7787=_0xf6e6[_0x3023b9];return _0x5a7787;};'use strict';var _=require('lodash');var util=require(_0x6f6e('0x0'));var logger=require(_0x6f6e('0x1'))(_0x6f6e('0x2'));var moment=require(_0x6f6e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f6e('0x4'));var config=require(_0x6f6e('0x5'));var attributes=require(_0x6f6e('0x6'));module[_0x6f6e('0x7')]=function(_0x3439ea,_0x3b73f0){return _0x3439ea['define'](_0x6f6e('0x8'),attributes,{'tableName':_0x6f6e('0x9'),'paranoid':![],'indexes':[{'name':_0x6f6e('0xa'),'fields':[_0x6f6e('0xb'),_0x6f6e('0xc')]},{'name':_0x6f6e('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xee33=['path','rimraf','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','leaveAt','../../config/logger','bluebird','request-promise'];(function(_0x9709ce,_0x5765af){var _0x414c87=function(_0x51149b){while(--_0x51149b){_0x9709ce['push'](_0x9709ce['shift']());}};_0x414c87(++_0x5765af);}(_0xee33,0x105));var _0x3ee3=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xee33[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3ee3('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3ee3('0x1'));var rp=require(_0x3ee3('0x2'));var fs=require('fs');var path=require(_0x3ee3('0x3'));var rimraf=require(_0x3ee3('0x4'));var config=require('../../config/environment');var attributes=require(_0x3ee3('0x5'));module['exports']=function(_0xf8030f,_0x4cdc82){return _0xf8030f[_0x3ee3('0x6')](_0x3ee3('0x7'),attributes,{'tableName':_0x3ee3('0x8'),'paranoid':![],'indexes':[{'name':_0x3ee3('0x9'),'fields':[_0x3ee3('0xa'),'project_name']},{'name':'leaveAt','fields':[_0x3ee3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a99e9ea..0920eb4 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 _0x6da6=['limit','UpdateSquareReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','SquareReport','body','options','CreateSquareReport','catch','update','attributes'];(function(_0x2d615a,_0x105110){var _0x56720f=function(_0x419394){while(--_0x419394){_0x2d615a['push'](_0x2d615a['shift']());}};_0x56720f(++_0x105110);}(_0x6da6,0x110));var _0x66da=function(_0x2f4069,_0x74eb6c){_0x2f4069=_0x2f4069-0x0;var _0x4e5d90=_0x6da6[_0x2f4069];return _0x4e5d90;};'use strict';var _=require(_0x66da('0x0'));var util=require('util');var moment=require(_0x66da('0x1'));var BPromise=require(_0x66da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66da('0x3'));var db=require(_0x66da('0x4'))['db'];var utils=require(_0x66da('0x5'));var logger=require(_0x66da('0x6'))(_0x66da('0x7'));var config=require('../../config/environment');var jayson=require(_0x66da('0x8'));var client=jayson[_0x66da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556617,_0x5b2004,_0x3c37ae){return new BPromise(function(_0xb1d778,_0x17ea0e){return client['request'](_0x556617,_0x3c37ae)[_0x66da('0xa')](function(_0x438acd){logger[_0x66da('0xb')]('SquareReport,\x20%s,\x20%s',_0x5b2004,_0x66da('0xc'));logger[_0x66da('0xd')](_0x66da('0xe'),_0x5b2004,'request\x20sent',JSON[_0x66da('0xf')](_0x438acd));if(_0x438acd[_0x66da('0x10')]){if(_0x438acd[_0x66da('0x10')][_0x66da('0x11')]===0x1f4){logger[_0x66da('0x10')](_0x66da('0x12'),_0x5b2004,_0x438acd[_0x66da('0x10')][_0x66da('0x13')]);return _0x17ea0e(_0x438acd[_0x66da('0x10')]['message']);}logger[_0x66da('0x10')](_0x66da('0x12'),_0x5b2004,_0x438acd[_0x66da('0x10')][_0x66da('0x13')]);return _0xb1d778(_0x438acd[_0x66da('0x10')]['message']);}else{logger[_0x66da('0xb')](_0x66da('0x12'),_0x5b2004,_0x66da('0xc'));_0xb1d778(_0x438acd[_0x66da('0x14')][_0x66da('0x13')]);}})['catch'](function(_0x4e83b1){logger[_0x66da('0x10')](_0x66da('0x12'),_0x5b2004,_0x4e83b1);_0x17ea0e(_0x4e83b1);});});}exports['CreateSquareReport']=function(_0x8f498){var _0x3d4c30=this;return new Promise(function(_0xf5d533,_0x3a6e98){return db[_0x66da('0x15')]['create'](_0x8f498[_0x66da('0x16')],{'raw':_0x8f498[_0x66da('0x17')]?_0x8f498[_0x66da('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3505d1){logger[_0x66da('0xb')]('CreateSquareReport',_0x8f498);logger['debug'](_0x66da('0x18'),_0x8f498,JSON[_0x66da('0xf')](_0x3505d1));_0xf5d533(_0x3505d1);})[_0x66da('0x19')](function(_0x2bd57e){logger[_0x66da('0x10')](_0x66da('0x18'),_0x2bd57e[_0x66da('0x13')],_0x8f498);_0x3a6e98(_0x3d4c30[_0x66da('0x10')](0x1f4,_0x2bd57e['message']));});});};exports['UpdateSquareReport']=function(_0x4255c6){var _0x1c7ddb=this;return new Promise(function(_0x927c3e,_0x212217){return db['SquareReport'][_0x66da('0x1a')](_0x4255c6[_0x66da('0x16')],{'raw':_0x4255c6[_0x66da('0x17')]?_0x4255c6[_0x66da('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4255c6['options']?_0x4255c6[_0x66da('0x17')]['where']||null:null,'attributes':_0x4255c6[_0x66da('0x17')]?_0x4255c6[_0x66da('0x17')][_0x66da('0x1b')]||null:null,'limit':_0x4255c6[_0x66da('0x17')]?_0x4255c6['options'][_0x66da('0x1c')]||null:null})[_0x66da('0xa')](function(_0x366595){logger[_0x66da('0xb')]('UpdateSquareReport',_0x4255c6);logger[_0x66da('0xd')](_0x66da('0x1d'),_0x4255c6,JSON['stringify'](_0x366595));_0x927c3e(_0x366595);})['catch'](function(_0x1ff028){logger[_0x66da('0x10')](_0x66da('0x1d'),_0x1ff028[_0x66da('0x13')],_0x4255c6);_0x212217(_0x1c7ddb[_0x66da('0x10')](0x1f4,_0x1ff028[_0x66da('0x13')]));});});}; \ No newline at end of file +var _0x6adb=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','where','attributes','lodash','util','moment'];(function(_0x369ccb,_0x21d986){var _0xec718c=function(_0x43369c){while(--_0x43369c){_0x369ccb['push'](_0x369ccb['shift']());}};_0xec718c(++_0x21d986);}(_0x6adb,0x105));var _0xb6ad=function(_0x235112,_0x5b5018){_0x235112=_0x235112-0x0;var _0xec8fa=_0x6adb[_0x235112];return _0xec8fa;};'use strict';var _=require(_0xb6ad('0x0'));var util=require(_0xb6ad('0x1'));var moment=require(_0xb6ad('0x2'));var BPromise=require(_0xb6ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6ad('0x4'));var db=require(_0xb6ad('0x5'))['db'];var utils=require(_0xb6ad('0x6'));var logger=require(_0xb6ad('0x7'))('rpc');var config=require(_0xb6ad('0x8'));var jayson=require(_0xb6ad('0x9'));var client=jayson[_0xb6ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x500116,_0x17925a,_0x3ee33d){return new BPromise(function(_0x5a2216,_0x5d8472){return client[_0xb6ad('0xb')](_0x500116,_0x3ee33d)[_0xb6ad('0xc')](function(_0xb949aa){logger[_0xb6ad('0xd')](_0xb6ad('0xe'),_0x17925a,'request\x20sent');logger[_0xb6ad('0xf')](_0xb6ad('0x10'),_0x17925a,_0xb6ad('0x11'),JSON[_0xb6ad('0x12')](_0xb949aa));if(_0xb949aa[_0xb6ad('0x13')]){if(_0xb949aa['error'][_0xb6ad('0x14')]===0x1f4){logger[_0xb6ad('0x13')](_0xb6ad('0xe'),_0x17925a,_0xb949aa[_0xb6ad('0x13')][_0xb6ad('0x15')]);return _0x5d8472(_0xb949aa[_0xb6ad('0x13')][_0xb6ad('0x15')]);}logger['error'](_0xb6ad('0xe'),_0x17925a,_0xb949aa[_0xb6ad('0x13')][_0xb6ad('0x15')]);return _0x5a2216(_0xb949aa[_0xb6ad('0x13')][_0xb6ad('0x15')]);}else{logger[_0xb6ad('0xd')](_0xb6ad('0xe'),_0x17925a,_0xb6ad('0x11'));_0x5a2216(_0xb949aa['result'][_0xb6ad('0x15')]);}})[_0xb6ad('0x16')](function(_0xf6aa3c){logger[_0xb6ad('0x13')](_0xb6ad('0xe'),_0x17925a,_0xf6aa3c);_0x5d8472(_0xf6aa3c);});});}exports['CreateSquareReport']=function(_0x324170){var _0x52ae1e=this;return new Promise(function(_0x131041,_0x447299){return db[_0xb6ad('0x17')][_0xb6ad('0x18')](_0x324170[_0xb6ad('0x19')],{'raw':_0x324170[_0xb6ad('0x1a')]?_0x324170['options'][_0xb6ad('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5f118a){logger[_0xb6ad('0xd')](_0xb6ad('0x1c'),_0x324170);logger[_0xb6ad('0xf')](_0xb6ad('0x1c'),_0x324170,JSON[_0xb6ad('0x12')](_0x5f118a));_0x131041(_0x5f118a);})[_0xb6ad('0x16')](function(_0x5eb698){logger[_0xb6ad('0x13')](_0xb6ad('0x1c'),_0x5eb698[_0xb6ad('0x15')],_0x324170);_0x447299(_0x52ae1e['error'](0x1f4,_0x5eb698['message']));});});};exports[_0xb6ad('0x1d')]=function(_0x37b2c8){var _0x40b556=this;return new Promise(function(_0x2db1d7,_0x1fac7d){return db[_0xb6ad('0x17')][_0xb6ad('0x1e')](_0x37b2c8['body'],{'raw':_0x37b2c8[_0xb6ad('0x1a')]?_0x37b2c8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37b2c8['options']?_0x37b2c8[_0xb6ad('0x1a')][_0xb6ad('0x1f')]||null:null,'attributes':_0x37b2c8['options']?_0x37b2c8[_0xb6ad('0x1a')][_0xb6ad('0x20')]||null:null,'limit':_0x37b2c8[_0xb6ad('0x1a')]?_0x37b2c8[_0xb6ad('0x1a')]['limit']||null:null})[_0xb6ad('0xc')](function(_0x538742){logger[_0xb6ad('0xd')](_0xb6ad('0x1d'),_0x37b2c8);logger['debug'](_0xb6ad('0x1d'),_0x37b2c8,JSON[_0xb6ad('0x12')](_0x538742));_0x2db1d7(_0x538742);})[_0xb6ad('0x16')](function(_0x1843d){logger['error'](_0xb6ad('0x1d'),_0x1843d[_0xb6ad('0x15')],_0x37b2c8);_0x1fac7d(_0x40b556[_0xb6ad('0x13')](0x1f4,_0x1843d[_0xb6ad('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index edf01a4..2d31228 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 _0xf375=['./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','show','create','/:id','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x147b99,_0x5103a4){var _0x367e29=function(_0x3ea7f4){while(--_0x3ea7f4){_0x147b99['push'](_0x147b99['shift']());}};_0x367e29(++_0x5103a4);}(_0xf375,0xd1));var _0x5f37=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf375[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x5f37('0x0'));var util=require(_0x5f37('0x1'));var path=require('path');var timeout=require(_0x5f37('0x2'));var express=require(_0x5f37('0x3'));var router=express[_0x5f37('0x4')]();var fs_extra=require(_0x5f37('0x5'));var auth=require(_0x5f37('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5f37('0x7'));router['get']('/',auth[_0x5f37('0x8')](),controller[_0x5f37('0x9')]);router[_0x5f37('0xa')](_0x5f37('0xb'),auth['isAuthenticated'](),controller[_0x5f37('0xc')]);router[_0x5f37('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5f37('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5f37('0xe')]);router['put'](_0x5f37('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x5f37('0x10')](_0x5f37('0xf'),auth[_0x5f37('0x8')](),controller[_0x5f37('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd6d7=['exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd6d7,0x1c3));var _0x7d6d=function(_0x5513dc,_0x347bd5){_0x5513dc=_0x5513dc-0x0;var _0x1ba8dc=_0xd6d7[_0x5513dc];return _0x1ba8dc;};'use strict';var multer=require('multer');var util=require(_0x7d6d('0x0'));var path=require(_0x7d6d('0x1'));var timeout=require(_0x7d6d('0x2'));var express=require('express');var router=express[_0x7d6d('0x3')]();var fs_extra=require(_0x7d6d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7d6d('0x5'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x7d6d('0x6')](),controller[_0x7d6d('0x7')]);router[_0x7d6d('0x8')](_0x7d6d('0x9'),auth[_0x7d6d('0x6')](),controller[_0x7d6d('0xa')]);router[_0x7d6d('0x8')](_0x7d6d('0xb'),auth[_0x7d6d('0x6')](),controller[_0x7d6d('0xc')]);router[_0x7d6d('0xd')]('/',auth[_0x7d6d('0x6')](),controller['create']);router[_0x7d6d('0xe')](_0x7d6d('0xb'),auth['isAuthenticated'](),controller[_0x7d6d('0xf')]);router[_0x7d6d('0x10')](_0x7d6d('0xb'),auth[_0x7d6d('0x6')](),controller['destroy']);module[_0x7d6d('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 90d7e79..f824778 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 _0xe3b9=['TEXT','sequelize','exports','STRING'];(function(_0x19db4a,_0x39f04d){var _0x274fd4=function(_0x558813){while(--_0x558813){_0x19db4a['push'](_0x19db4a['shift']());}};_0x274fd4(++_0x39f04d);}(_0xe3b9,0x1b9));var _0x9e3b=function(_0x3fad30,_0x46e13a){_0x3fad30=_0x3fad30-0x0;var _0x3e92e9=_0xe3b9[_0x3fad30];return _0x3e92e9;};'use strict';var Sequelize=require(_0x9e3b('0x0'));module[_0x9e3b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x9e3b('0x2')]},'application':{'type':Sequelize[_0x9e3b('0x2')]},'data':{'type':Sequelize[_0x9e3b('0x3')]},'project_name':{'type':Sequelize[_0x9e3b('0x2')]},'callerid':{'type':Sequelize[_0x9e3b('0x2')]}}; \ No newline at end of file +var _0x09c0=['sequelize','exports','STRING','TEXT'];(function(_0x342a85,_0x441803){var _0x325aad=function(_0x37945e){while(--_0x37945e){_0x342a85['push'](_0x342a85['shift']());}};_0x325aad(++_0x441803);}(_0x09c0,0x13c));var _0x009c=function(_0x25feb7,_0x18a25c){_0x25feb7=_0x25feb7-0x0;var _0x259fa7=_0x09c0[_0x25feb7];return _0x259fa7;};'use strict';var Sequelize=require(_0x009c('0x0'));module[_0x009c('0x1')]={'uniqueid':{'type':Sequelize[_0x009c('0x2')]},'node':{'type':Sequelize[_0x009c('0x2')]},'application':{'type':Sequelize[_0x009c('0x2')]},'data':{'type':Sequelize[_0x009c('0x3')]},'project_name':{'type':Sequelize[_0x009c('0x2')]},'callerid':{'type':Sequelize[_0x009c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 505ba9d..45a0f12 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 _0x1a11=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x228960,_0x262175){var _0x24f5ec=function(_0x3dc7f8){while(--_0x3dc7f8){_0x228960['push'](_0x228960['shift']());}};_0x24f5ec(++_0x262175);}(_0x1a11,0x17b));var _0x11a1=function(_0x970261,_0x3dfa10){_0x970261=_0x970261-0x0;var _0x5a2068=_0x1a11[_0x970261];return _0x5a2068;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x11a1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11a1('0x1'));var rp=require(_0x11a1('0x2'));var moment=require(_0x11a1('0x3'));var BPromise=require(_0x11a1('0x4'));var Mustache=require(_0x11a1('0x5'));var util=require(_0x11a1('0x6'));var path=require(_0x11a1('0x7'));var sox=require(_0x11a1('0x8'));var csv=require(_0x11a1('0x9'));var ejs=require(_0x11a1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11a1('0xb'));var squel=require(_0x11a1('0xc'));var crypto=require('crypto');var jsforce=require(_0x11a1('0xd'));var deskjs=require(_0x11a1('0xe'));var toCsv=require(_0x11a1('0x9'));var querystring=require(_0x11a1('0xf'));var Papa=require(_0x11a1('0x10'));var Redis=require(_0x11a1('0x11'));var authService=require(_0x11a1('0x12'));var qs=require(_0x11a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11a1('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x11a1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56329c,_0x3698cf){_0x3698cf=_0x3698cf||0xcc;return function(_0x420bfc){if(_0x420bfc){return _0x56329c['sendStatus'](_0x3698cf);}return _0x56329c['status'](_0x3698cf)[_0x11a1('0x16')]();};}function respondWithResult(_0x239d2d,_0x45b6d7){_0x45b6d7=_0x45b6d7||0xc8;return function(_0x37f799){if(_0x37f799){return _0x239d2d['status'](_0x45b6d7)[_0x11a1('0x17')](_0x37f799);}};}function respondWithFilteredResult(_0x356855,_0x498ef3){return function(_0x30f9be){if(_0x30f9be){var _0x1b9d3c=typeof _0x498ef3[_0x11a1('0x18')]===_0x11a1('0x19')&&typeof _0x498ef3['limit']===_0x11a1('0x19');var _0x114171=_0x30f9be[_0x11a1('0x1a')];var _0xf6290e=_0x1b9d3c?0x0:_0x498ef3['offset'];var _0x5b7fc8=_0x1b9d3c?_0x30f9be['count']:_0x498ef3[_0x11a1('0x18')]+_0x498ef3[_0x11a1('0x1b')];var _0x3d31ec;if(_0x5b7fc8>=_0x114171){_0x5b7fc8=_0x114171;_0x3d31ec=0xc8;}else{_0x3d31ec=0xce;}_0x356855[_0x11a1('0x1c')](_0x3d31ec);return _0x356855[_0x11a1('0x1d')](_0x11a1('0x1e'),_0xf6290e+'-'+_0x5b7fc8+'/'+_0x114171)['json'](_0x30f9be);}return null;};}function patchUpdates(_0x4fd2a1){return function(_0x2d4924){try{jsonpatch[_0x11a1('0x1f')](_0x2d4924,_0x4fd2a1,!![]);}catch(_0x570914){return BPromise[_0x11a1('0x20')](_0x570914);}return _0x2d4924[_0x11a1('0x21')]();};}function saveUpdates(_0x305edd,_0x38de5f){return function(_0x3bdb64){if(_0x3bdb64){return _0x3bdb64['update'](_0x305edd)[_0x11a1('0x22')](function(_0x2169c5){return _0x2169c5;});}return null;};}function removeEntity(_0x25b011,_0x2c45ac){return function(_0x543a2e){if(_0x543a2e){return _0x543a2e[_0x11a1('0x23')]()['then'](function(){_0x25b011[_0x11a1('0x1c')](0xcc)[_0x11a1('0x16')]();});}};}function handleEntityNotFound(_0x481985,_0x4e69e4){return function(_0x5bbd26){if(!_0x5bbd26){_0x481985['sendStatus'](0x194);}return _0x5bbd26;};}function handleError(_0x3f207b,_0x4c7c78){_0x4c7c78=_0x4c7c78||0x1f4;return function(_0x54c961){logger['error'](_0x54c961[_0x11a1('0x24')]);if(_0x54c961[_0x11a1('0x25')]){delete _0x54c961[_0x11a1('0x25')];}_0x3f207b[_0x11a1('0x1c')](_0x4c7c78)[_0x11a1('0x26')](_0x54c961);};}exports[_0x11a1('0x27')]=function(_0x546a1e,_0x679161){var _0x340cd4={},_0x1aa159={},_0x5ac202={'count':0x0,'rows':[]};var _0x5c55a9=_[_0x11a1('0x28')](db[_0x11a1('0x29')][_0x11a1('0x2a')],function(_0x1417ac){return{'name':_0x1417ac[_0x11a1('0x2b')],'type':_0x1417ac[_0x11a1('0x2c')][_0x11a1('0x2d')]};});_0x1aa159['model']=_['map'](_0x5c55a9,_0x11a1('0x25'));_0x1aa159[_0x11a1('0x2e')]=_[_0x11a1('0x2f')](_0x546a1e[_0x11a1('0x2e')]);_0x1aa159[_0x11a1('0x30')]=_[_0x11a1('0x31')](_0x1aa159[_0x11a1('0x32')],_0x1aa159[_0x11a1('0x2e')]);_0x340cd4[_0x11a1('0x33')]=_[_0x11a1('0x31')](_0x1aa159[_0x11a1('0x32')],qs['fields'](_0x546a1e[_0x11a1('0x2e')]['fields']));_0x340cd4[_0x11a1('0x33')]=_0x340cd4[_0x11a1('0x33')][_0x11a1('0x34')]?_0x340cd4[_0x11a1('0x33')]:_0x1aa159[_0x11a1('0x32')];if(!_0x546a1e[_0x11a1('0x2e')][_0x11a1('0x35')](_0x11a1('0x36'))){_0x340cd4[_0x11a1('0x1b')]=qs[_0x11a1('0x1b')](_0x546a1e['query'][_0x11a1('0x1b')]);_0x340cd4['offset']=qs[_0x11a1('0x18')](_0x546a1e[_0x11a1('0x2e')][_0x11a1('0x18')]);}_0x340cd4['order']=qs[_0x11a1('0x37')](_0x546a1e[_0x11a1('0x2e')][_0x11a1('0x37')]);_0x340cd4[_0x11a1('0x38')]=qs[_0x11a1('0x30')](_[_0x11a1('0x39')](_0x546a1e[_0x11a1('0x2e')],_0x1aa159[_0x11a1('0x30')]),_0x5c55a9);if(_0x546a1e['query'][_0x11a1('0x3a')]){_0x340cd4[_0x11a1('0x38')]=_[_0x11a1('0x3b')](_0x340cd4[_0x11a1('0x38')],{'$or':_['map'](_0x5c55a9,function(_0x1a8266){if(_0x1a8266[_0x11a1('0x2c')]!==_0x11a1('0x3c')){var _0x5bc8aa={};_0x5bc8aa[_0x1a8266[_0x11a1('0x25')]]={'$like':'%'+_0x546a1e[_0x11a1('0x2e')][_0x11a1('0x3a')]+'%'};return _0x5bc8aa;}})});}_0x340cd4=_[_0x11a1('0x3b')]({},_0x340cd4,_0x546a1e[_0x11a1('0x3d')]);var _0x3d6c4b={'where':_0x340cd4[_0x11a1('0x38')]};return db[_0x11a1('0x29')]['count'](_0x3d6c4b)[_0x11a1('0x22')](function(_0x24fe8c){_0x5ac202[_0x11a1('0x1a')]=_0x24fe8c;if(_0x546a1e['query'][_0x11a1('0x3e')]){_0x340cd4[_0x11a1('0x3f')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x340cd4);})[_0x11a1('0x22')](function(_0x2efc18){_0x5ac202[_0x11a1('0x40')]=_0x2efc18;return _0x5ac202;})['then'](respondWithFilteredResult(_0x679161,_0x340cd4))[_0x11a1('0x41')](handleError(_0x679161,null));};exports[_0x11a1('0x42')]=function(_0x267fb5,_0xad5a11){var _0x2fa378={'raw':!![],'where':{'id':_0x267fb5[_0x11a1('0x43')]['id']}},_0xa9c282={};_0xa9c282[_0x11a1('0x32')]=_['keys'](db[_0x11a1('0x29')]['rawAttributes']);_0xa9c282[_0x11a1('0x2e')]=_[_0x11a1('0x2f')](_0x267fb5[_0x11a1('0x2e')]);_0xa9c282[_0x11a1('0x30')]=_[_0x11a1('0x31')](_0xa9c282['model'],_0xa9c282['query']);_0x2fa378[_0x11a1('0x33')]=_[_0x11a1('0x31')](_0xa9c282[_0x11a1('0x32')],qs[_0x11a1('0x44')](_0x267fb5['query'][_0x11a1('0x44')]));_0x2fa378[_0x11a1('0x33')]=_0x2fa378[_0x11a1('0x33')]['length']?_0x2fa378[_0x11a1('0x33')]:_0xa9c282[_0x11a1('0x32')];if(_0x267fb5[_0x11a1('0x2e')][_0x11a1('0x3e')]){_0x2fa378['include']=[{'all':!![]}];}_0x2fa378=_[_0x11a1('0x3b')]({},_0x2fa378,_0x267fb5[_0x11a1('0x3d')]);return db[_0x11a1('0x29')]['find'](_0x2fa378)[_0x11a1('0x22')](handleEntityNotFound(_0xad5a11,null))['then'](respondWithResult(_0xad5a11,null))[_0x11a1('0x41')](handleError(_0xad5a11,null));};exports['create']=function(_0x4afe4f,_0xadef9){return db[_0x11a1('0x29')][_0x11a1('0x45')](_0x4afe4f[_0x11a1('0x46')],{})[_0x11a1('0x22')](respondWithResult(_0xadef9,0xc9))[_0x11a1('0x41')](handleError(_0xadef9,null));};exports['update']=function(_0x5c8f92,_0x3c7e85){if(_0x5c8f92[_0x11a1('0x46')]['id']){delete _0x5c8f92['body']['id'];}return db[_0x11a1('0x29')]['find']({'where':{'id':_0x5c8f92['params']['id']}})[_0x11a1('0x22')](handleEntityNotFound(_0x3c7e85,null))[_0x11a1('0x22')](saveUpdates(_0x5c8f92[_0x11a1('0x46')],null))[_0x11a1('0x22')](respondWithResult(_0x3c7e85,null))[_0x11a1('0x41')](handleError(_0x3c7e85,null));};exports[_0x11a1('0x23')]=function(_0x24b80a,_0x506f76){return db[_0x11a1('0x29')][_0x11a1('0x47')]({'where':{'id':_0x24b80a[_0x11a1('0x43')]['id']}})[_0x11a1('0x22')](handleEntityNotFound(_0x506f76,null))['then'](removeEntity(_0x506f76,null))['catch'](handleError(_0x506f76,null));};exports[_0x11a1('0x48')]=function(_0x1fbd51,_0x50352a){return db[_0x11a1('0x29')][_0x11a1('0x48')]()[_0x11a1('0x22')](respondWithResult(_0x50352a,null))[_0x11a1('0x41')](handleError(_0x50352a,null));}; \ No newline at end of file +var _0x51a2=['../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','then','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x4b1513,_0x4689a6){var _0x290af7=function(_0x39296c){while(--_0x39296c){_0x4b1513['push'](_0x4b1513['shift']());}};_0x290af7(++_0x4689a6);}(_0x51a2,0xca));var _0x251a=function(_0x3f5bc5,_0x378fde){_0x3f5bc5=_0x3f5bc5-0x0;var _0x25979c=_0x51a2[_0x3f5bc5];return _0x25979c;};'use strict';var emlformat=require(_0x251a('0x0'));var rimraf=require(_0x251a('0x1'));var zipdir=require(_0x251a('0x2'));var jsonpatch=require(_0x251a('0x3'));var rp=require(_0x251a('0x4'));var moment=require(_0x251a('0x5'));var BPromise=require(_0x251a('0x6'));var Mustache=require(_0x251a('0x7'));var util=require(_0x251a('0x8'));var path=require('path');var sox=require(_0x251a('0x9'));var csv=require(_0x251a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x251a('0xb'));var _=require('lodash');var squel=require(_0x251a('0xc'));var crypto=require(_0x251a('0xd'));var jsforce=require(_0x251a('0xe'));var deskjs=require(_0x251a('0xf'));var toCsv=require(_0x251a('0xa'));var querystring=require(_0x251a('0x10'));var Papa=require('papaparse');var Redis=require(_0x251a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x251a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x251a('0x13'));var logger=require(_0x251a('0x14'))(_0x251a('0x15'));var utils=require(_0x251a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cd2d4,_0xe68b3b){_0xe68b3b=_0xe68b3b||0xcc;return function(_0x2de72e){if(_0x2de72e){return _0x1cd2d4[_0x251a('0x17')](_0xe68b3b);}return _0x1cd2d4[_0x251a('0x18')](_0xe68b3b)[_0x251a('0x19')]();};}function respondWithResult(_0x2ae413,_0x2740fe){_0x2740fe=_0x2740fe||0xc8;return function(_0x1bac6e){if(_0x1bac6e){return _0x2ae413[_0x251a('0x18')](_0x2740fe)['json'](_0x1bac6e);}};}function respondWithFilteredResult(_0x15b5d0,_0x1d2900){return function(_0x1faeee){if(_0x1faeee){var _0x3aecd4=typeof _0x1d2900[_0x251a('0x1a')]===_0x251a('0x1b')&&typeof _0x1d2900[_0x251a('0x1c')]===_0x251a('0x1b');var _0x12752a=_0x1faeee[_0x251a('0x1d')];var _0x410c64=_0x3aecd4?0x0:_0x1d2900['offset'];var _0x7e51a7=_0x3aecd4?_0x1faeee[_0x251a('0x1d')]:_0x1d2900['offset']+_0x1d2900[_0x251a('0x1c')];var _0x1bd251;if(_0x7e51a7>=_0x12752a){_0x7e51a7=_0x12752a;_0x1bd251=0xc8;}else{_0x1bd251=0xce;}_0x15b5d0[_0x251a('0x18')](_0x1bd251);return _0x15b5d0[_0x251a('0x1e')](_0x251a('0x1f'),_0x410c64+'-'+_0x7e51a7+'/'+_0x12752a)['json'](_0x1faeee);}return null;};}function patchUpdates(_0x377596){return function(_0x16b176){try{jsonpatch['apply'](_0x16b176,_0x377596,!![]);}catch(_0x4fd57f){return BPromise[_0x251a('0x20')](_0x4fd57f);}return _0x16b176[_0x251a('0x21')]();};}function saveUpdates(_0x298912,_0x219fc2){return function(_0x367ceb){if(_0x367ceb){return _0x367ceb[_0x251a('0x22')](_0x298912)['then'](function(_0x1b50d2){return _0x1b50d2;});}return null;};}function removeEntity(_0x159631,_0x23d9b7){return function(_0x211eaf){if(_0x211eaf){return _0x211eaf[_0x251a('0x23')]()['then'](function(){_0x159631[_0x251a('0x18')](0xcc)[_0x251a('0x19')]();});}};}function handleEntityNotFound(_0x13fa1e,_0x415279){return function(_0x3fa775){if(!_0x3fa775){_0x13fa1e['sendStatus'](0x194);}return _0x3fa775;};}function handleError(_0x1bde06,_0x37eff2){_0x37eff2=_0x37eff2||0x1f4;return function(_0xf6659d){logger[_0x251a('0x24')](_0xf6659d[_0x251a('0x25')]);if(_0xf6659d['name']){delete _0xf6659d[_0x251a('0x26')];}_0x1bde06[_0x251a('0x18')](_0x37eff2)[_0x251a('0x27')](_0xf6659d);};}exports[_0x251a('0x28')]=function(_0x51998d,_0x2baac9){var _0x4dd9dc={},_0x52ba3f={},_0x5914e2={'count':0x0,'rows':[]};var _0x579ebb=_[_0x251a('0x29')](db[_0x251a('0x2a')][_0x251a('0x2b')],function(_0x325753){return{'name':_0x325753[_0x251a('0x2c')],'type':_0x325753[_0x251a('0x2d')]['key']};});_0x52ba3f[_0x251a('0x2e')]=_[_0x251a('0x29')](_0x579ebb,'name');_0x52ba3f[_0x251a('0x2f')]=_[_0x251a('0x30')](_0x51998d['query']);_0x52ba3f[_0x251a('0x31')]=_[_0x251a('0x32')](_0x52ba3f[_0x251a('0x2e')],_0x52ba3f[_0x251a('0x2f')]);_0x4dd9dc[_0x251a('0x33')]=_['intersection'](_0x52ba3f[_0x251a('0x2e')],qs[_0x251a('0x34')](_0x51998d[_0x251a('0x2f')][_0x251a('0x34')]));_0x4dd9dc['attributes']=_0x4dd9dc[_0x251a('0x33')][_0x251a('0x35')]?_0x4dd9dc[_0x251a('0x33')]:_0x52ba3f[_0x251a('0x2e')];if(!_0x51998d[_0x251a('0x2f')][_0x251a('0x36')](_0x251a('0x37'))){_0x4dd9dc['limit']=qs['limit'](_0x51998d[_0x251a('0x2f')][_0x251a('0x1c')]);_0x4dd9dc[_0x251a('0x1a')]=qs[_0x251a('0x1a')](_0x51998d['query'][_0x251a('0x1a')]);}_0x4dd9dc[_0x251a('0x38')]=qs[_0x251a('0x39')](_0x51998d[_0x251a('0x2f')][_0x251a('0x39')]);_0x4dd9dc[_0x251a('0x3a')]=qs[_0x251a('0x31')](_[_0x251a('0x3b')](_0x51998d['query'],_0x52ba3f[_0x251a('0x31')]),_0x579ebb);if(_0x51998d[_0x251a('0x2f')]['filter']){_0x4dd9dc[_0x251a('0x3a')]=_['merge'](_0x4dd9dc[_0x251a('0x3a')],{'$or':_[_0x251a('0x29')](_0x579ebb,function(_0x252af9){if(_0x252af9[_0x251a('0x2d')]!==_0x251a('0x3c')){var _0x3d46fd={};_0x3d46fd[_0x252af9[_0x251a('0x26')]]={'$like':'%'+_0x51998d[_0x251a('0x2f')][_0x251a('0x3d')]+'%'};return _0x3d46fd;}})});}_0x4dd9dc=_['merge']({},_0x4dd9dc,_0x51998d[_0x251a('0x3e')]);var _0x39f53a={'where':_0x4dd9dc[_0x251a('0x3a')]};return db['SquareDetailsReport'][_0x251a('0x1d')](_0x39f53a)['then'](function(_0x5ab7e7){_0x5914e2['count']=_0x5ab7e7;if(_0x51998d['query'][_0x251a('0x3f')]){_0x4dd9dc[_0x251a('0x40')]=[{'all':!![]}];}return db[_0x251a('0x2a')][_0x251a('0x41')](_0x4dd9dc);})[_0x251a('0x42')](function(_0x27216f){_0x5914e2['rows']=_0x27216f;return _0x5914e2;})[_0x251a('0x42')](respondWithFilteredResult(_0x2baac9,_0x4dd9dc))['catch'](handleError(_0x2baac9,null));};exports[_0x251a('0x43')]=function(_0xc47e76,_0x7f4e0e){var _0xfc9642={'raw':!![],'where':{'id':_0xc47e76[_0x251a('0x44')]['id']}},_0x459e1b={};_0x459e1b[_0x251a('0x2e')]=_['keys'](db['SquareDetailsReport'][_0x251a('0x2b')]);_0x459e1b[_0x251a('0x2f')]=_[_0x251a('0x30')](_0xc47e76['query']);_0x459e1b[_0x251a('0x31')]=_[_0x251a('0x32')](_0x459e1b[_0x251a('0x2e')],_0x459e1b[_0x251a('0x2f')]);_0xfc9642['attributes']=_[_0x251a('0x32')](_0x459e1b[_0x251a('0x2e')],qs[_0x251a('0x34')](_0xc47e76['query'][_0x251a('0x34')]));_0xfc9642[_0x251a('0x33')]=_0xfc9642[_0x251a('0x33')][_0x251a('0x35')]?_0xfc9642[_0x251a('0x33')]:_0x459e1b[_0x251a('0x2e')];if(_0xc47e76['query'][_0x251a('0x3f')]){_0xfc9642[_0x251a('0x40')]=[{'all':!![]}];}_0xfc9642=_['merge']({},_0xfc9642,_0xc47e76[_0x251a('0x3e')]);return db[_0x251a('0x2a')][_0x251a('0x45')](_0xfc9642)[_0x251a('0x42')](handleEntityNotFound(_0x7f4e0e,null))['then'](respondWithResult(_0x7f4e0e,null))[_0x251a('0x46')](handleError(_0x7f4e0e,null));};exports[_0x251a('0x47')]=function(_0x23f50b,_0x35c2dc){return db[_0x251a('0x2a')]['create'](_0x23f50b[_0x251a('0x48')],{})[_0x251a('0x42')](respondWithResult(_0x35c2dc,0xc9))[_0x251a('0x46')](handleError(_0x35c2dc,null));};exports[_0x251a('0x22')]=function(_0x1530aa,_0x1241bf){if(_0x1530aa[_0x251a('0x48')]['id']){delete _0x1530aa[_0x251a('0x48')]['id'];}return db[_0x251a('0x2a')][_0x251a('0x45')]({'where':{'id':_0x1530aa['params']['id']}})[_0x251a('0x42')](handleEntityNotFound(_0x1241bf,null))['then'](saveUpdates(_0x1530aa[_0x251a('0x48')],null))[_0x251a('0x42')](respondWithResult(_0x1241bf,null))['catch'](handleError(_0x1241bf,null));};exports['destroy']=function(_0x5b5858,_0x4da9ff){return db[_0x251a('0x2a')][_0x251a('0x45')]({'where':{'id':_0x5b5858[_0x251a('0x44')]['id']}})[_0x251a('0x42')](handleEntityNotFound(_0x4da9ff,null))[_0x251a('0x42')](removeEntity(_0x4da9ff,null))[_0x251a('0x46')](handleError(_0x4da9ff,null));};exports[_0x251a('0x49')]=function(_0x23952e,_0x1afc77){return db[_0x251a('0x2a')][_0x251a('0x49')]()[_0x251a('0x42')](respondWithResult(_0x1afc77,null))[_0x251a('0x46')](handleError(_0x1afc77,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 64c9f48..14c605b 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 _0x21c7=['./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0xc7144d,_0x5c332c){var _0x3a4323=function(_0x588d92){while(--_0x588d92){_0xc7144d['push'](_0xc7144d['shift']());}};_0x3a4323(++_0x5c332c);}(_0x21c7,0xb4));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x721c('0x0'));var util=require(_0x721c('0x1'));var logger=require(_0x721c('0x2'))(_0x721c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x721c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x721c('0x5'));var config=require(_0x721c('0x6'));var attributes=require(_0x721c('0x7'));module[_0x721c('0x8')]=function(_0x55de12,_0x391efa){return _0x55de12[_0x721c('0x9')]('SquareDetailsReport',attributes,{'tableName':_0x721c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x283c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x283c,0xfb));var _0xc283=function(_0x3eb5a4,_0x3b3b35){_0x3eb5a4=_0x3eb5a4-0x0;var _0x470200=_0x283c[_0x3eb5a4];return _0x470200;};'use strict';var _=require(_0xc283('0x0'));var util=require(_0xc283('0x1'));var logger=require(_0xc283('0x2'))(_0xc283('0x3'));var moment=require(_0xc283('0x4'));var BPromise=require(_0xc283('0x5'));var rp=require(_0xc283('0x6'));var fs=require('fs');var path=require(_0xc283('0x7'));var rimraf=require(_0xc283('0x8'));var config=require(_0xc283('0x9'));var attributes=require('./squareReportDetail.attributes');module[_0xc283('0xa')]=function(_0x59df7d,_0xbe5ef3){return _0x59df7d[_0xc283('0xb')](_0xc283('0xc'),attributes,{'tableName':_0xc283('0xd'),'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 24ae882..79de6dc 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 _0xccde=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','create','body','options','raw','debug','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x2cf094,_0x2e9087){var _0x8e3eec=function(_0x257876){while(--_0x257876){_0x2cf094['push'](_0x2cf094['shift']());}};_0x8e3eec(++_0x2e9087);}(_0xccde,0x1e1));var _0xeccd=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xccde[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var moment=require(_0xeccd('0x1'));var BPromise=require('bluebird');var rs=require(_0xeccd('0x2'));var fs=require('fs');var Redis=require(_0xeccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeccd('0x4'))(_0xeccd('0x5'));var config=require(_0xeccd('0x6'));var jayson=require(_0xeccd('0x7'));var client=jayson[_0xeccd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338742,_0x130f1c,_0x1b622f){return new BPromise(function(_0x1eebfb,_0x4b068e){return client[_0xeccd('0x9')](_0x338742,_0x1b622f)[_0xeccd('0xa')](function(_0x9dccd){logger[_0xeccd('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,'request\x20sent');logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'),JSON[_0xeccd('0xd')](_0x9dccd));if(_0x9dccd[_0xeccd('0xe')]){if(_0x9dccd[_0xeccd('0xe')][_0xeccd('0xf')]===0x1f4){logger['error'](_0xeccd('0x10'),_0x130f1c,_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);return _0x4b068e(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}logger[_0xeccd('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,_0x9dccd['error'][_0xeccd('0x11')]);return _0x1eebfb(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}else{logger[_0xeccd('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'));_0x1eebfb(_0x9dccd[_0xeccd('0x12')]['message']);}})['catch'](function(_0x42e47e){logger[_0xeccd('0xe')](_0xeccd('0x10'),_0x130f1c,_0x42e47e);_0x4b068e(_0x42e47e);});});}exports[_0xeccd('0x13')]=function(_0xb0fad7){var _0x360d25=this;return new Promise(function(_0x466d98,_0x17596a){return db['SquareDetailsReport'][_0xeccd('0x14')](_0xb0fad7[_0xeccd('0x15')],{'raw':_0xb0fad7[_0xeccd('0x16')]?_0xb0fad7[_0xeccd('0x16')][_0xeccd('0x17')]===undefined?!![]:![]:!![]})[_0xeccd('0xa')](function(_0x508439){logger['info']('CreateSquareDetailsReport',_0xb0fad7);logger[_0xeccd('0x18')]('CreateSquareDetailsReport',_0xb0fad7,JSON[_0xeccd('0xd')](_0x508439));_0x466d98(_0x508439);})[_0xeccd('0x19')](function(_0x54083d){logger[_0xeccd('0xe')]('CreateSquareDetailsReport',_0x54083d[_0xeccd('0x11')],_0xb0fad7);_0x17596a(_0x360d25[_0xeccd('0xe')](0x1f4,_0x54083d[_0xeccd('0x11')]));});});}; \ No newline at end of file +var _0xd237=['info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd237,0x14f));var _0x7d23=function(_0x42805a,_0x1278da){_0x42805a=_0x42805a-0x0;var _0x5b0d65=_0xd237[_0x42805a];return _0x5b0d65;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var moment=require(_0x7d23('0x2'));var BPromise=require(_0x7d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d23('0x4'));var db=require(_0x7d23('0x5'))['db'];var utils=require(_0x7d23('0x6'));var logger=require(_0x7d23('0x7'))(_0x7d23('0x8'));var config=require(_0x7d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca126,_0x48358f,_0xc43371){return new BPromise(function(_0x42c334,_0x6ce28d){return client[_0x7d23('0xb')](_0x5ca126,_0xc43371)[_0x7d23('0xc')](function(_0x23f1d6){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x48358f,'request\x20sent');logger[_0x7d23('0xf')](_0x7d23('0x10'),_0x48358f,_0x7d23('0x11'),JSON['stringify'](_0x23f1d6));if(_0x23f1d6[_0x7d23('0x12')]){if(_0x23f1d6['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x6ce28d(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x42c334(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}else{logger['info'](_0x7d23('0xe'),_0x48358f,'request\x20sent');_0x42c334(_0x23f1d6[_0x7d23('0x15')]['message']);}})[_0x7d23('0x16')](function(_0x46a35b){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x46a35b);_0x6ce28d(_0x46a35b);});});}exports[_0x7d23('0x17')]=function(_0x506a3b){var _0x313471=this;return new Promise(function(_0x3d6a7b,_0x49ce32){return db[_0x7d23('0x18')][_0x7d23('0x19')](_0x506a3b[_0x7d23('0x1a')],{'raw':_0x506a3b['options']?_0x506a3b['options'][_0x7d23('0x1b')]===undefined?!![]:![]:!![]})[_0x7d23('0xc')](function(_0x56b0ba){logger[_0x7d23('0xd')]('CreateSquareDetailsReport',_0x506a3b);logger[_0x7d23('0xf')]('CreateSquareDetailsReport',_0x506a3b,JSON[_0x7d23('0x1c')](_0x56b0ba));_0x3d6a7b(_0x56b0ba);})[_0x7d23('0x16')](function(_0x59522b){logger[_0x7d23('0x12')](_0x7d23('0x17'),_0x59522b[_0x7d23('0x14')],_0x506a3b);_0x49ce32(_0x313471['error'](0x1f4,_0x59522b[_0x7d23('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index fabbbd3..88d33fa 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 _0x41ea=['./system.controller','get','index','/process/:pid/kill','exports','express','Router','../../components/auth/service'];(function(_0x5dc3e3,_0x172b8e){var _0x32cd73=function(_0x31efb3){while(--_0x31efb3){_0x5dc3e3['push'](_0x5dc3e3['shift']());}};_0x32cd73(++_0x172b8e);}(_0x41ea,0x85));var _0xa41e=function(_0x4a8323,_0x1aecc){_0x4a8323=_0x4a8323-0x0;var _0x4ac909=_0x41ea[_0x4a8323];return _0x4ac909;};'use strict';var express=require(_0xa41e('0x0'));var router=express[_0xa41e('0x1')]();var auth=require(_0xa41e('0x2'));var controller=require(_0xa41e('0x3'));router[_0xa41e('0x4')]('/',auth['isAuthenticated'](),controller[_0xa41e('0x5')]);router[_0xa41e('0x4')](_0xa41e('0x6'),auth['isAuthenticated'](),controller['killProcess']);module[_0xa41e('0x7')]=router; \ No newline at end of file +var _0xcd1e=['isAuthenticated','index','/process/:pid/kill','express','Router','../../components/auth/service','get'];(function(_0x57cc7a,_0x1e738d){var _0x5d6159=function(_0xb455d5){while(--_0xb455d5){_0x57cc7a['push'](_0x57cc7a['shift']());}};_0x5d6159(++_0x1e738d);}(_0xcd1e,0x8f));var _0xecd1=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xcd1e[_0x126558];return _0x1f6d14;};'use strict';var express=require(_0xecd1('0x0'));var router=express[_0xecd1('0x1')]();var auth=require(_0xecd1('0x2'));var controller=require('./system.controller');router[_0xecd1('0x3')]('/',auth[_0xecd1('0x4')](),controller[_0xecd1('0x5')]);router['get'](_0xecd1('0x6'),auth[_0xecd1('0x4')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 4bf1672..1e5f3ec 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 _0x37f9=['catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','../../config/logger','error','inspect','name','status','index','then','json'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x37f9,0x7a));var _0x937f=function(_0xdf3852,_0x88c1be){_0xdf3852=_0xdf3852-0x0;var _0x44ffe3=_0x37f9[_0xdf3852];return _0x44ffe3;};'use strict';var info=require(_0x937f('0x0'));var exec=require(_0x937f('0x1'))['exec'];var logger=require(_0x937f('0x2'))('api');var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x17fb04,_0x4f02cf,_0x31043b){_0x4f02cf=_0x4f02cf||0x1f4;return function(_0xc010f4){logger[_0x937f('0x3')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x31043b,_0x4f02cf,util[_0x937f('0x4')](_0xc010f4,{'showHidden':![],'depth':null}));delete _0xc010f4[_0x937f('0x5')];_0x17fb04[_0x937f('0x6')](_0x4f02cf)['send'](_0xc010f4);};}exports[_0x937f('0x7')]=function(_0x20552b,_0x1691f1){return info['getAllData']()[_0x937f('0x8')](function(_0x223087){return _0x1691f1[_0x937f('0x6')](0xc8)[_0x937f('0x9')](_0x223087);})[_0x937f('0xa')](function(_0x551bb6){return _0x1691f1[_0x937f('0x6')](0x1f4)[_0x937f('0x9')](_0x551bb6);});};exports['killProcess']=function(_0x1b8ef6,_0x59e8da){var _0x2f7b55=[_0x937f('0xb')];return new BPromise(function(_0x1d8d23,_0x50001c){return exec(util[_0x937f('0xc')](_0x937f('0xd'),_0x1b8ef6['params'][_0x937f('0xe')]),function(_0x4dd264,_0x97ecb3,_0x2bd741){if(_0x4dd264){return _0x50001c(_0x4dd264);}return _0x1d8d23(_0x97ecb3);});})[_0x937f('0x8')](function(_0x36790d){var _0xc25d7c=![];var _0x1be344=_0x36790d[_0x937f('0xf')](/\n/);for(var _0x4d4b3e=0x0,_0x31c98f=_0x2f7b55['length'];_0x4d4b3e<_0x31c98f,_0xc25d7c===![];_0x4d4b3e+=0x1){if(_0x36790d[_0x937f('0x10')](_0x2f7b55[_0x4d4b3e])>=0x0){_0xc25d7c=!![];}}if(!_0xc25d7c){throw new Error(util['format'](_0x937f('0x11'),_0x1b8ef6[_0x937f('0x12')][_0x937f('0xe')]));}process[_0x937f('0x13')](_0x1b8ef6[_0x937f('0x12')][_0x937f('0xe')],'SIGINT');return _0x59e8da[_0x937f('0x6')](0xc8)['json']({'message':util['format'](_0x937f('0x14'),_0x1b8ef6[_0x937f('0x12')][_0x937f('0xe')])});})[_0x937f('0xa')](handleError(_0x59e8da,null,_0x937f('0x15')));}; \ No newline at end of file +var _0xd03c=['../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec'];(function(_0x4f66d6,_0x3d87b5){var _0x312ff0=function(_0x5a09d4){while(--_0x5a09d4){_0x4f66d6['push'](_0x4f66d6['shift']());}};_0x312ff0(++_0x3d87b5);}(_0xd03c,0x10c));var _0xcd03=function(_0x3014e4,_0x495f68){_0x3014e4=_0x3014e4-0x0;var _0x4feea9=_0xd03c[_0x3014e4];return _0x4feea9;};'use strict';var info=require(_0xcd03('0x0'));var exec=require('child_process')[_0xcd03('0x1')];var logger=require(_0xcd03('0x2'))(_0xcd03('0x3'));var util=require(_0xcd03('0x4'));var BPromise=require(_0xcd03('0x5'));var _=require(_0xcd03('0x6'));function handleError(_0x31353b,_0x4090cf,_0x3fe309){_0x4090cf=_0x4090cf||0x1f4;return function(_0xb138b5){logger[_0xcd03('0x7')](_0xcd03('0x8'),_0x3fe309,_0x4090cf,util[_0xcd03('0x9')](_0xb138b5,{'showHidden':![],'depth':null}));delete _0xb138b5[_0xcd03('0xa')];_0x31353b[_0xcd03('0xb')](_0x4090cf)[_0xcd03('0xc')](_0xb138b5);};}exports['index']=function(_0x2b9831,_0xa3b2fb){return info[_0xcd03('0xd')]()[_0xcd03('0xe')](function(_0x28230a){return _0xa3b2fb[_0xcd03('0xb')](0xc8)[_0xcd03('0xf')](_0x28230a);})['catch'](function(_0x62cf31){return _0xa3b2fb['status'](0x1f4)['json'](_0x62cf31);});};exports['killProcess']=function(_0x41f3d4,_0xc223c3){var _0x17c8fe=[_0xcd03('0x10')];return new BPromise(function(_0x452e4f,_0x3a4b64){return exec(util[_0xcd03('0x11')](_0xcd03('0x12'),_0x41f3d4[_0xcd03('0x13')][_0xcd03('0x14')]),function(_0x500d12,_0x440099,_0x3b930e){if(_0x500d12){return _0x3a4b64(_0x500d12);}return _0x452e4f(_0x440099);});})[_0xcd03('0xe')](function(_0x47dd02){var _0x907ed9=![];var _0x1f5f84=_0x47dd02[_0xcd03('0x15')](/\n/);for(var _0x366368=0x0,_0xc35dd1=_0x17c8fe[_0xcd03('0x16')];_0x366368<_0xc35dd1,_0x907ed9===![];_0x366368+=0x1){if(_0x47dd02[_0xcd03('0x17')](_0x17c8fe[_0x366368])>=0x0){_0x907ed9=!![];}}if(!_0x907ed9){throw new Error(util['format'](_0xcd03('0x18'),_0x41f3d4[_0xcd03('0x13')]['pid']));}process[_0xcd03('0x19')](_0x41f3d4[_0xcd03('0x13')][_0xcd03('0x14')],'SIGINT');return _0xc223c3[_0xcd03('0xb')](0xc8)['json']({'message':util['format'](_0xcd03('0x1a'),_0x41f3d4['params'][_0xcd03('0x14')])});})['catch'](handleError(_0xc223c3,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ce588e8..32c576f 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 _0x0e85=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./tag.controller','get','isAuthenticated','index'];(function(_0x535963,_0x326515){var _0x3975f6=function(_0x2e624f){while(--_0x2e624f){_0x535963['push'](_0x535963['shift']());}};_0x3975f6(++_0x326515);}(_0x0e85,0x7c));var _0x50e8=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x0e85[_0x20ef64];return _0x3707d8;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['show']);router[_0x50e8('0xc')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x50e8('0x11')]);module[_0x50e8('0x12')]=router; \ No newline at end of file +var _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xbd50,0x196));var _0x0bd5=function(_0x344eb8,_0x12a8a5){_0x344eb8=_0x344eb8-0x0;var _0x3f197c=_0xbd50[_0x344eb8];return _0x3f197c;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 09e86f2..d01b976 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 _0xc893=['STRING','#0091EA','exports'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc893,0x194));var _0x3c89=function(_0x52f4dd,_0x20e395){_0x52f4dd=_0x52f4dd-0x0;var _0x17f16a=_0xc893[_0x52f4dd];return _0x17f16a;};'use strict';var Sequelize=require('sequelize');module[_0x3c89('0x0')]={'name':{'type':Sequelize[_0x3c89('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x3c89('0x2')},'description':{'type':Sequelize[_0x3c89('0x1')]}}; \ No newline at end of file +var _0xdd6e=['sequelize','exports','STRING','name','#0091EA'];(function(_0x402dce,_0x58820b){var _0x5d6f0f=function(_0x283848){while(--_0x283848){_0x402dce['push'](_0x402dce['shift']());}};_0x5d6f0f(++_0x58820b);}(_0xdd6e,0xa5));var _0xedd6=function(_0x1f3015,_0x141e1f){_0x1f3015=_0x1f3015-0x0;var _0x1c9349=_0xdd6e[_0x1f3015];return _0x1c9349;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'name':{'type':Sequelize[_0xedd6('0x2')],'unique':_0xedd6('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xedd6('0x4')},'description':{'type':Sequelize[_0xedd6('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 682c452..9e466ae 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 _0xcf79=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','show','Tag','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','fieldName','type'];(function(_0x3703a5,_0xbaf317){var _0xdd9d92=function(_0x41f1de){while(--_0x41f1de){_0x3703a5['push'](_0x3703a5['shift']());}};_0xdd9d92(++_0xbaf317);}(_0xcf79,0x73));var _0x9cf7=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcf79[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x9cf7('0x0'));var rimraf=require(_0x9cf7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cf7('0x2'));var rp=require('request-promise');var moment=require(_0x9cf7('0x3'));var BPromise=require(_0x9cf7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9cf7('0x5'));var csv=require(_0x9cf7('0x6'));var ejs=require(_0x9cf7('0x7'));var fs=require('fs');var fs_extra=require(_0x9cf7('0x8'));var _=require('lodash');var squel=require(_0x9cf7('0x9'));var crypto=require(_0x9cf7('0xa'));var jsforce=require(_0x9cf7('0xb'));var deskjs=require(_0x9cf7('0xc'));var toCsv=require(_0x9cf7('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9cf7('0xd'));var hardwareService=require(_0x9cf7('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9cf7('0xf'));var licenseUtil=require(_0x9cf7('0x10'));var db=require(_0x9cf7('0x11'))['db'];function respondWithStatusCode(_0x1d8f0d,_0x4b6d94){_0x4b6d94=_0x4b6d94||0xcc;return function(_0x1779e6){if(_0x1779e6){return _0x1d8f0d[_0x9cf7('0x12')](_0x4b6d94);}return _0x1d8f0d[_0x9cf7('0x13')](_0x4b6d94)[_0x9cf7('0x14')]();};}function respondWithResult(_0x46a130,_0x28a6f4){_0x28a6f4=_0x28a6f4||0xc8;return function(_0x24f59f){if(_0x24f59f){return _0x46a130[_0x9cf7('0x13')](_0x28a6f4)[_0x9cf7('0x15')](_0x24f59f);}};}function respondWithFilteredResult(_0x1cfc22,_0x39c36c){return function(_0x31ec07){if(_0x31ec07){var _0x277422=typeof _0x39c36c['offset']===_0x9cf7('0x16')&&typeof _0x39c36c[_0x9cf7('0x17')]===_0x9cf7('0x16');var _0x4f0f28=_0x31ec07[_0x9cf7('0x18')];var _0x5718cf=_0x277422?0x0:_0x39c36c[_0x9cf7('0x19')];var _0x1bbd6e=_0x277422?_0x31ec07['count']:_0x39c36c[_0x9cf7('0x19')]+_0x39c36c[_0x9cf7('0x17')];var _0x588d92;if(_0x1bbd6e>=_0x4f0f28){_0x1bbd6e=_0x4f0f28;_0x588d92=0xc8;}else{_0x588d92=0xce;}_0x1cfc22[_0x9cf7('0x13')](_0x588d92);return _0x1cfc22[_0x9cf7('0x1a')](_0x9cf7('0x1b'),_0x5718cf+'-'+_0x1bbd6e+'/'+_0x4f0f28)[_0x9cf7('0x15')](_0x31ec07);}return null;};}function patchUpdates(_0x1d2865){return function(_0x4cdcc4){try{jsonpatch[_0x9cf7('0x1c')](_0x4cdcc4,_0x1d2865,!![]);}catch(_0x4d83a2){return BPromise['reject'](_0x4d83a2);}return _0x4cdcc4[_0x9cf7('0x1d')]();};}function saveUpdates(_0x40c983,_0x32c33b){return function(_0x3c013d){if(_0x3c013d){return _0x3c013d[_0x9cf7('0x1e')](_0x40c983)[_0x9cf7('0x1f')](function(_0x11a627){return _0x11a627;});}return null;};}function removeEntity(_0x59a539,_0x543d8d){return function(_0x3aa000){if(_0x3aa000){return _0x3aa000[_0x9cf7('0x20')]()[_0x9cf7('0x1f')](function(){var _0x5587f0=_0x3aa000[_0x9cf7('0x21')]({'plain':!![]});var _0x2955d8='Tags';return db[_0x9cf7('0x22')][_0x9cf7('0x20')]({'where':{'type':_0x2955d8,'resourceId':_0x5587f0['id']}})['then'](function(){return _0x3aa000;});})[_0x9cf7('0x1f')](function(){_0x59a539['status'](0xcc)[_0x9cf7('0x14')]();});}};}function handleEntityNotFound(_0x2df803,_0x353497){return function(_0x2b8baa){if(!_0x2b8baa){_0x2df803[_0x9cf7('0x12')](0x194);}return _0x2b8baa;};}function handleError(_0x11037b,_0x57436f){_0x57436f=_0x57436f||0x1f4;return function(_0x3a0afa){logger[_0x9cf7('0x23')](_0x3a0afa[_0x9cf7('0x24')]);if(_0x3a0afa[_0x9cf7('0x25')]){delete _0x3a0afa['name'];}_0x11037b[_0x9cf7('0x13')](_0x57436f)['send'](_0x3a0afa);};}exports['index']=function(_0x59e16f,_0x26d2d9){var _0x43dcf4={},_0x3b2dcf={},_0x5bd8dd={'count':0x0,'rows':[]};var _0x48fe25=_[_0x9cf7('0x26')](db['Tag']['rawAttributes'],function(_0x151645){return{'name':_0x151645[_0x9cf7('0x27')],'type':_0x151645[_0x9cf7('0x28')]['key']};});_0x3b2dcf[_0x9cf7('0x29')]=_[_0x9cf7('0x26')](_0x48fe25,_0x9cf7('0x25'));_0x3b2dcf[_0x9cf7('0x2a')]=_[_0x9cf7('0x2b')](_0x59e16f['query']);_0x3b2dcf[_0x9cf7('0x2c')]=_[_0x9cf7('0x2d')](_0x3b2dcf[_0x9cf7('0x29')],_0x3b2dcf[_0x9cf7('0x2a')]);_0x43dcf4[_0x9cf7('0x2e')]=_[_0x9cf7('0x2d')](_0x3b2dcf[_0x9cf7('0x29')],qs[_0x9cf7('0x2f')](_0x59e16f[_0x9cf7('0x2a')]['fields']));_0x43dcf4[_0x9cf7('0x2e')]=_0x43dcf4['attributes'][_0x9cf7('0x30')]?_0x43dcf4['attributes']:_0x3b2dcf[_0x9cf7('0x29')];if(!_0x59e16f[_0x9cf7('0x2a')][_0x9cf7('0x31')]('nolimit')){_0x43dcf4[_0x9cf7('0x17')]=qs[_0x9cf7('0x17')](_0x59e16f[_0x9cf7('0x2a')][_0x9cf7('0x17')]);_0x43dcf4[_0x9cf7('0x19')]=qs['offset'](_0x59e16f[_0x9cf7('0x2a')][_0x9cf7('0x19')]);}_0x43dcf4[_0x9cf7('0x32')]=qs['sort'](_0x59e16f['query'][_0x9cf7('0x33')]);_0x43dcf4['where']=qs[_0x9cf7('0x2c')](_[_0x9cf7('0x34')](_0x59e16f['query'],_0x3b2dcf[_0x9cf7('0x2c')]),_0x48fe25);if(_0x59e16f['query'][_0x9cf7('0x35')]){_0x43dcf4['where']=_[_0x9cf7('0x36')](_0x43dcf4[_0x9cf7('0x37')],{'$or':_['map'](_0x48fe25,function(_0x5116ae){if(_0x5116ae[_0x9cf7('0x28')]!==_0x9cf7('0x38')){var _0x509b15={};_0x509b15[_0x5116ae[_0x9cf7('0x25')]]={'$like':'%'+_0x59e16f['query'][_0x9cf7('0x35')]+'%'};return _0x509b15;}})});}_0x43dcf4=_[_0x9cf7('0x36')]({},_0x43dcf4,_0x59e16f[_0x9cf7('0x39')]);var _0x3a19db={'where':_0x43dcf4[_0x9cf7('0x37')]};return db['Tag'][_0x9cf7('0x18')](_0x3a19db)[_0x9cf7('0x1f')](function(_0x37a8f5){_0x5bd8dd[_0x9cf7('0x18')]=_0x37a8f5;if(_0x59e16f[_0x9cf7('0x2a')]['includeAll']){_0x43dcf4['include']=[{'all':!![]}];}return db['Tag'][_0x9cf7('0x3a')](_0x43dcf4);})[_0x9cf7('0x1f')](function(_0x1bef4c){_0x5bd8dd[_0x9cf7('0x3b')]=_0x1bef4c;return _0x5bd8dd;})[_0x9cf7('0x1f')](respondWithFilteredResult(_0x26d2d9,_0x43dcf4))['catch'](handleError(_0x26d2d9,null));};exports[_0x9cf7('0x3c')]=function(_0x151f7,_0x4815ea){var _0x5cd71d={'raw':!![],'where':{'id':_0x151f7['params']['id']}},_0x31216b={};_0x31216b[_0x9cf7('0x29')]=_[_0x9cf7('0x2b')](db[_0x9cf7('0x3d')][_0x9cf7('0x3e')]);_0x31216b[_0x9cf7('0x2a')]=_[_0x9cf7('0x2b')](_0x151f7['query']);_0x31216b['filters']=_[_0x9cf7('0x2d')](_0x31216b[_0x9cf7('0x29')],_0x31216b[_0x9cf7('0x2a')]);_0x5cd71d[_0x9cf7('0x2e')]=_[_0x9cf7('0x2d')](_0x31216b[_0x9cf7('0x29')],qs[_0x9cf7('0x2f')](_0x151f7[_0x9cf7('0x2a')][_0x9cf7('0x2f')]));_0x5cd71d['attributes']=_0x5cd71d[_0x9cf7('0x2e')][_0x9cf7('0x30')]?_0x5cd71d[_0x9cf7('0x2e')]:_0x31216b[_0x9cf7('0x29')];if(_0x151f7[_0x9cf7('0x2a')][_0x9cf7('0x3f')]){_0x5cd71d[_0x9cf7('0x40')]=[{'all':!![]}];}_0x5cd71d=_['merge']({},_0x5cd71d,_0x151f7[_0x9cf7('0x39')]);return db[_0x9cf7('0x3d')][_0x9cf7('0x41')](_0x5cd71d)[_0x9cf7('0x1f')](handleEntityNotFound(_0x4815ea,null))[_0x9cf7('0x1f')](respondWithResult(_0x4815ea,null))['catch'](handleError(_0x4815ea,null));};exports[_0x9cf7('0x42')]=function(_0x2015e5,_0x124e44){return db[_0x9cf7('0x3d')]['create'](_0x2015e5[_0x9cf7('0x43')],{})['then'](function(_0x526878){var _0x579234=_0x2015e5[_0x9cf7('0x44')][_0x9cf7('0x21')]({'plain':!![]});if(!_0x579234)throw new Error(_0x9cf7('0x45'));if(_0x579234[_0x9cf7('0x46')]===_0x9cf7('0x44')){var _0x5cdf8e=_0x526878[_0x9cf7('0x21')]({'plain':!![]});var _0x524075='Tags';return db[_0x9cf7('0x47')][_0x9cf7('0x41')]({'where':{'name':_0x524075,'userProfileId':_0x579234[_0x9cf7('0x48')]},'raw':!![]})[_0x9cf7('0x1f')](function(_0x2dd9d5){if(_0x2dd9d5&&_0x2dd9d5[_0x9cf7('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x5cdf8e['name'],'resourceId':_0x5cdf8e['id'],'type':_0x2dd9d5[_0x9cf7('0x25')],'sectionId':_0x2dd9d5['id']},{})[_0x9cf7('0x1f')](function(){return _0x526878;});}else{return _0x526878;}})[_0x9cf7('0x4a')](function(_0xc50ad){logger[_0x9cf7('0x23')](_0x9cf7('0x4b'),_0xc50ad);throw _0xc50ad;});}return _0x526878;})[_0x9cf7('0x1f')](respondWithResult(_0x124e44,0xc9))[_0x9cf7('0x4a')](handleError(_0x124e44,null));};exports['update']=function(_0x493d49,_0x565161){if(_0x493d49['body']['id']){delete _0x493d49[_0x9cf7('0x43')]['id'];}return db[_0x9cf7('0x3d')][_0x9cf7('0x41')]({'where':{'id':_0x493d49['params']['id']}})['then'](handleEntityNotFound(_0x565161,null))[_0x9cf7('0x1f')](saveUpdates(_0x493d49[_0x9cf7('0x43')],null))['then'](respondWithResult(_0x565161,null))['catch'](handleError(_0x565161,null));};exports['destroy']=function(_0x381139,_0xdd251c){return db[_0x9cf7('0x3d')][_0x9cf7('0x41')]({'where':{'id':_0x381139[_0x9cf7('0x4c')]['id']}})[_0x9cf7('0x1f')](handleEntityNotFound(_0xdd251c,null))[_0x9cf7('0x1f')](removeEntity(_0xdd251c,null))[_0x9cf7('0x4a')](handleError(_0xdd251c,null));};exports[_0x9cf7('0x4d')]=function(_0x44879f,_0x3a2f87){return db['Tag'][_0x9cf7('0x4d')]()[_0x9cf7('0x1f')](respondWithResult(_0x3a2f87,null))[_0x9cf7('0x4a')](handleError(_0x3a2f87,null));}; \ No newline at end of file +var _0xbc9b=['path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','index','map','Tag','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x48c042,_0x1328a9){var _0x277066=function(_0x3eafaf){while(--_0x3eafaf){_0x48c042['push'](_0x48c042['shift']());}};_0x277066(++_0x1328a9);}(_0xbc9b,0x9e));var _0xbbc9=function(_0xe01cbb,_0x14c9f5){_0xe01cbb=_0xe01cbb-0x0;var _0x215b4a=_0xbc9b[_0xe01cbb];return _0x215b4a;};'use strict';var emlformat=require(_0xbbc9('0x0'));var rimraf=require(_0xbbc9('0x1'));var zipdir=require(_0xbbc9('0x2'));var jsonpatch=require(_0xbbc9('0x3'));var rp=require('request-promise');var moment=require(_0xbbc9('0x4'));var BPromise=require(_0xbbc9('0x5'));var Mustache=require(_0xbbc9('0x6'));var util=require(_0xbbc9('0x7'));var path=require(_0xbbc9('0x8'));var sox=require('sox');var csv=require(_0xbbc9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbc9('0xa'));var _=require(_0xbbc9('0xb'));var squel=require(_0xbbc9('0xc'));var crypto=require(_0xbbc9('0xd'));var jsforce=require(_0xbbc9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbbc9('0x9'));var querystring=require(_0xbbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbbc9('0x10'));var qs=require(_0xbbc9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbc9('0x12'))(_0xbbc9('0x13'));var utils=require(_0xbbc9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbbc9('0x15'));var db=require(_0xbbc9('0x16'))['db'];function respondWithStatusCode(_0x5a55c5,_0x5d506a){_0x5d506a=_0x5d506a||0xcc;return function(_0x5422c0){if(_0x5422c0){return _0x5a55c5[_0xbbc9('0x17')](_0x5d506a);}return _0x5a55c5[_0xbbc9('0x18')](_0x5d506a)['end']();};}function respondWithResult(_0x57903d,_0x1ec99f){_0x1ec99f=_0x1ec99f||0xc8;return function(_0x13e1c2){if(_0x13e1c2){return _0x57903d[_0xbbc9('0x18')](_0x1ec99f)[_0xbbc9('0x19')](_0x13e1c2);}};}function respondWithFilteredResult(_0x1d9ee3,_0x1574a8){return function(_0x577a93){if(_0x577a93){var _0x3e19f6=typeof _0x1574a8['offset']==='undefined'&&typeof _0x1574a8[_0xbbc9('0x1a')]===_0xbbc9('0x1b');var _0x32e391=_0x577a93[_0xbbc9('0x1c')];var _0x4b76df=_0x3e19f6?0x0:_0x1574a8[_0xbbc9('0x1d')];var _0x43eb26=_0x3e19f6?_0x577a93['count']:_0x1574a8[_0xbbc9('0x1d')]+_0x1574a8[_0xbbc9('0x1a')];var _0x1d075e;if(_0x43eb26>=_0x32e391){_0x43eb26=_0x32e391;_0x1d075e=0xc8;}else{_0x1d075e=0xce;}_0x1d9ee3[_0xbbc9('0x18')](_0x1d075e);return _0x1d9ee3[_0xbbc9('0x1e')](_0xbbc9('0x1f'),_0x4b76df+'-'+_0x43eb26+'/'+_0x32e391)[_0xbbc9('0x19')](_0x577a93);}return null;};}function patchUpdates(_0x1d9591){return function(_0x129a4b){try{jsonpatch[_0xbbc9('0x20')](_0x129a4b,_0x1d9591,!![]);}catch(_0x1fa2ef){return BPromise[_0xbbc9('0x21')](_0x1fa2ef);}return _0x129a4b[_0xbbc9('0x22')]();};}function saveUpdates(_0x133dba,_0x4a3308){return function(_0x5b5fe7){if(_0x5b5fe7){return _0x5b5fe7[_0xbbc9('0x23')](_0x133dba)[_0xbbc9('0x24')](function(_0x245fa6){return _0x245fa6;});}return null;};}function removeEntity(_0x38af5a,_0x590dfb){return function(_0x108639){if(_0x108639){return _0x108639['destroy']()[_0xbbc9('0x24')](function(){var _0x398df8=_0x108639[_0xbbc9('0x25')]({'plain':!![]});var _0x963a39='Tags';return db[_0xbbc9('0x26')][_0xbbc9('0x27')]({'where':{'type':_0x963a39,'resourceId':_0x398df8['id']}})[_0xbbc9('0x24')](function(){return _0x108639;});})[_0xbbc9('0x24')](function(){_0x38af5a['status'](0xcc)[_0xbbc9('0x28')]();});}};}function handleEntityNotFound(_0x4ab97e,_0x3ace37){return function(_0x405c21){if(!_0x405c21){_0x4ab97e[_0xbbc9('0x17')](0x194);}return _0x405c21;};}function handleError(_0x555364,_0x41a8c4){_0x41a8c4=_0x41a8c4||0x1f4;return function(_0x443eb6){logger[_0xbbc9('0x29')](_0x443eb6[_0xbbc9('0x2a')]);if(_0x443eb6[_0xbbc9('0x2b')]){delete _0x443eb6[_0xbbc9('0x2b')];}_0x555364[_0xbbc9('0x18')](_0x41a8c4)['send'](_0x443eb6);};}exports[_0xbbc9('0x2c')]=function(_0x187a4e,_0x2a9d73){var _0x388245={},_0x2a6056={},_0x2c508c={'count':0x0,'rows':[]};var _0x386e10=_[_0xbbc9('0x2d')](db[_0xbbc9('0x2e')][_0xbbc9('0x2f')],function(_0x385142){return{'name':_0x385142['fieldName'],'type':_0x385142[_0xbbc9('0x30')]['key']};});_0x2a6056[_0xbbc9('0x31')]=_[_0xbbc9('0x2d')](_0x386e10,_0xbbc9('0x2b'));_0x2a6056[_0xbbc9('0x32')]=_[_0xbbc9('0x33')](_0x187a4e[_0xbbc9('0x32')]);_0x2a6056['filters']=_[_0xbbc9('0x34')](_0x2a6056[_0xbbc9('0x31')],_0x2a6056['query']);_0x388245['attributes']=_[_0xbbc9('0x34')](_0x2a6056[_0xbbc9('0x31')],qs[_0xbbc9('0x35')](_0x187a4e[_0xbbc9('0x32')][_0xbbc9('0x35')]));_0x388245[_0xbbc9('0x36')]=_0x388245[_0xbbc9('0x36')][_0xbbc9('0x37')]?_0x388245[_0xbbc9('0x36')]:_0x2a6056[_0xbbc9('0x31')];if(!_0x187a4e[_0xbbc9('0x32')]['hasOwnProperty']('nolimit')){_0x388245[_0xbbc9('0x1a')]=qs[_0xbbc9('0x1a')](_0x187a4e[_0xbbc9('0x32')][_0xbbc9('0x1a')]);_0x388245[_0xbbc9('0x1d')]=qs[_0xbbc9('0x1d')](_0x187a4e[_0xbbc9('0x32')][_0xbbc9('0x1d')]);}_0x388245['order']=qs[_0xbbc9('0x38')](_0x187a4e[_0xbbc9('0x32')][_0xbbc9('0x38')]);_0x388245['where']=qs['filters'](_[_0xbbc9('0x39')](_0x187a4e[_0xbbc9('0x32')],_0x2a6056[_0xbbc9('0x3a')]),_0x386e10);if(_0x187a4e[_0xbbc9('0x32')][_0xbbc9('0x3b')]){_0x388245[_0xbbc9('0x3c')]=_[_0xbbc9('0x3d')](_0x388245[_0xbbc9('0x3c')],{'$or':_[_0xbbc9('0x2d')](_0x386e10,function(_0x2d6beb){if(_0x2d6beb[_0xbbc9('0x30')]!==_0xbbc9('0x3e')){var _0x7d8f83={};_0x7d8f83[_0x2d6beb['name']]={'$like':'%'+_0x187a4e[_0xbbc9('0x32')][_0xbbc9('0x3b')]+'%'};return _0x7d8f83;}})});}_0x388245=_[_0xbbc9('0x3d')]({},_0x388245,_0x187a4e[_0xbbc9('0x3f')]);var _0x767289={'where':_0x388245['where']};return db[_0xbbc9('0x2e')]['count'](_0x767289)[_0xbbc9('0x24')](function(_0x514e13){_0x2c508c[_0xbbc9('0x1c')]=_0x514e13;if(_0x187a4e['query'][_0xbbc9('0x40')]){_0x388245['include']=[{'all':!![]}];}return db['Tag'][_0xbbc9('0x41')](_0x388245);})[_0xbbc9('0x24')](function(_0x4d6779){_0x2c508c[_0xbbc9('0x42')]=_0x4d6779;return _0x2c508c;})['then'](respondWithFilteredResult(_0x2a9d73,_0x388245))[_0xbbc9('0x43')](handleError(_0x2a9d73,null));};exports[_0xbbc9('0x44')]=function(_0x36cc36,_0x7f49ef){var _0x3de5b8={'raw':!![],'where':{'id':_0x36cc36[_0xbbc9('0x45')]['id']}},_0x30da7b={};_0x30da7b[_0xbbc9('0x31')]=_[_0xbbc9('0x33')](db[_0xbbc9('0x2e')][_0xbbc9('0x2f')]);_0x30da7b[_0xbbc9('0x32')]=_[_0xbbc9('0x33')](_0x36cc36[_0xbbc9('0x32')]);_0x30da7b['filters']=_['intersection'](_0x30da7b[_0xbbc9('0x31')],_0x30da7b[_0xbbc9('0x32')]);_0x3de5b8[_0xbbc9('0x36')]=_['intersection'](_0x30da7b['model'],qs['fields'](_0x36cc36['query'][_0xbbc9('0x35')]));_0x3de5b8[_0xbbc9('0x36')]=_0x3de5b8[_0xbbc9('0x36')]['length']?_0x3de5b8[_0xbbc9('0x36')]:_0x30da7b['model'];if(_0x36cc36[_0xbbc9('0x32')][_0xbbc9('0x40')]){_0x3de5b8[_0xbbc9('0x46')]=[{'all':!![]}];}_0x3de5b8=_['merge']({},_0x3de5b8,_0x36cc36[_0xbbc9('0x3f')]);return db[_0xbbc9('0x2e')]['find'](_0x3de5b8)['then'](handleEntityNotFound(_0x7f49ef,null))[_0xbbc9('0x24')](respondWithResult(_0x7f49ef,null))['catch'](handleError(_0x7f49ef,null));};exports['create']=function(_0x251516,_0x325808){return db[_0xbbc9('0x2e')][_0xbbc9('0x47')](_0x251516[_0xbbc9('0x48')],{})[_0xbbc9('0x24')](function(_0x4cb89a){var _0x54065e=_0x251516[_0xbbc9('0x49')][_0xbbc9('0x25')]({'plain':!![]});if(!_0x54065e)throw new Error(_0xbbc9('0x4a'));if(_0x54065e[_0xbbc9('0x4b')]==='user'){var _0x141e97=_0x4cb89a[_0xbbc9('0x25')]({'plain':!![]});var _0x56d742=_0xbbc9('0x4c');return db[_0xbbc9('0x4d')][_0xbbc9('0x4e')]({'where':{'name':_0x56d742,'userProfileId':_0x54065e[_0xbbc9('0x4f')]},'raw':!![]})[_0xbbc9('0x24')](function(_0xd321c8){if(_0xd321c8&&_0xd321c8[_0xbbc9('0x50')]===0x0){return db[_0xbbc9('0x26')][_0xbbc9('0x47')]({'name':_0x141e97[_0xbbc9('0x2b')],'resourceId':_0x141e97['id'],'type':_0xd321c8[_0xbbc9('0x2b')],'sectionId':_0xd321c8['id']},{})[_0xbbc9('0x24')](function(){return _0x4cb89a;});}else{return _0x4cb89a;}})[_0xbbc9('0x43')](function(_0x33f13b){logger[_0xbbc9('0x29')](_0xbbc9('0x51'),_0x33f13b);throw _0x33f13b;});}return _0x4cb89a;})[_0xbbc9('0x24')](respondWithResult(_0x325808,0xc9))[_0xbbc9('0x43')](handleError(_0x325808,null));};exports[_0xbbc9('0x23')]=function(_0x5926a1,_0x21c6ff){if(_0x5926a1['body']['id']){delete _0x5926a1['body']['id'];}return db[_0xbbc9('0x2e')]['find']({'where':{'id':_0x5926a1[_0xbbc9('0x45')]['id']}})['then'](handleEntityNotFound(_0x21c6ff,null))[_0xbbc9('0x24')](saveUpdates(_0x5926a1[_0xbbc9('0x48')],null))[_0xbbc9('0x24')](respondWithResult(_0x21c6ff,null))[_0xbbc9('0x43')](handleError(_0x21c6ff,null));};exports[_0xbbc9('0x27')]=function(_0x39f071,_0x334799){return db[_0xbbc9('0x2e')][_0xbbc9('0x4e')]({'where':{'id':_0x39f071['params']['id']}})[_0xbbc9('0x24')](handleEntityNotFound(_0x334799,null))[_0xbbc9('0x24')](removeEntity(_0x334799,null))[_0xbbc9('0x43')](handleError(_0x334799,null));};exports[_0xbbc9('0x52')]=function(_0x114169,_0x2f720b){return db['Tag'][_0xbbc9('0x52')]()[_0xbbc9('0x24')](respondWithResult(_0x2f720b,null))[_0xbbc9('0x43')](handleError(_0x2f720b,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 254ee75..e551b39 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 _0x7d98=['moment','request-promise','./tag.attributes','exports','Tag','lodash','../../config/logger','api'];(function(_0x429be8,_0x12c1bd){var _0xae578a=function(_0x573902){while(--_0x573902){_0x429be8['push'](_0x429be8['shift']());}};_0xae578a(++_0x12c1bd);}(_0x7d98,0x75));var _0x87d9=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x7d98[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var logger=require(_0x87d9('0x1'))(_0x87d9('0x2'));var moment=require(_0x87d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x87d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x87d9('0x5'));module[_0x87d9('0x6')]=function(_0x2bc9fd,_0x23a797){return _0x2bc9fd['define'](_0x87d9('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5ed=['lodash','util','../../config/logger','api','bluebird','path','exports','define','Tag','tools_tags'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xb5ed,0x1a4));var _0xdb5e=function(_0x1de527,_0x16b90e){_0x1de527=_0x1de527-0x0;var _0x1d62c8=_0xb5ed[_0x1de527];return _0x1d62c8;};'use strict';var _=require(_0xdb5e('0x0'));var util=require(_0xdb5e('0x1'));var logger=require(_0xdb5e('0x2'))(_0xdb5e('0x3'));var moment=require('moment');var BPromise=require(_0xdb5e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb5e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xdb5e('0x6')]=function(_0x1269bc,_0x12a4ea){return _0x1269bc[_0xdb5e('0x7')](_0xdb5e('0x8'),attributes,{'tableName':_0xdb5e('0x9'),'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 bf6d830..c2ac025 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 _0xb647=['request','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x3545b2,_0x1b5535){var _0x4056bf=function(_0x557823){while(--_0x557823){_0x3545b2['push'](_0x3545b2['shift']());}};_0x4056bf(++_0x1b5535);}(_0xb647,0xdb));var _0x7b64=function(_0x46321f,_0xf8b0b0){_0x46321f=_0x46321f-0x0;var _0x42f002=_0xb647[_0x46321f];return _0x42f002;};'use strict';var _=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var moment=require(_0x7b64('0x2'));var BPromise=require(_0x7b64('0x3'));var rs=require(_0x7b64('0x4'));var fs=require('fs');var Redis=require(_0x7b64('0x5'));var db=require(_0x7b64('0x6'))['db'];var utils=require(_0x7b64('0x7'));var logger=require('../../config/logger')(_0x7b64('0x8'));var config=require('../../config/environment');var jayson=require(_0x7b64('0x9'));var client=jayson[_0x7b64('0xa')][_0x7b64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x80721a,_0xcdec41,_0x22eca3){return new BPromise(function(_0x727684,_0x2ff650){return client[_0x7b64('0xc')](_0x80721a,_0x22eca3)['then'](function(_0x1b8b2a){logger['info'](_0x7b64('0xd'),_0xcdec41,'request\x20sent');logger['debug'](_0x7b64('0xe'),_0xcdec41,_0x7b64('0xf'),JSON['stringify'](_0x1b8b2a));if(_0x1b8b2a[_0x7b64('0x10')]){if(_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x11')]===0x1f4){logger[_0x7b64('0x10')](_0x7b64('0xd'),_0xcdec41,_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);return _0x2ff650(_0x1b8b2a['error'][_0x7b64('0x12')]);}logger['error']('Tag,\x20%s,\x20%s',_0xcdec41,_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);return _0x727684(_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);}else{logger[_0x7b64('0x13')](_0x7b64('0xd'),_0xcdec41,_0x7b64('0xf'));_0x727684(_0x1b8b2a['result'][_0x7b64('0x12')]);}})[_0x7b64('0x14')](function(_0x16ff72){logger[_0x7b64('0x10')](_0x7b64('0xd'),_0xcdec41,_0x16ff72);_0x2ff650(_0x16ff72);});});} \ No newline at end of file +var _0xe5b3=['request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s'];(function(_0x3c60ae,_0x4fbf8e){var _0xdaf38d=function(_0x230c9e){while(--_0x230c9e){_0x3c60ae['push'](_0x3c60ae['shift']());}};_0xdaf38d(++_0x4fbf8e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x277607,_0x345a06){_0x277607=_0x277607-0x0;var _0x15fe23=_0xe5b3[_0x277607];return _0x15fe23;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('Tag,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('Tag,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 911481f..1e4cea5 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 214a0e2..837d4c3 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0xc1d1d3,_0x14747f){var _0x2e2abe=function(_0x2b3e5a){while(--_0x2b3e5a){_0xc1d1d3['push'](_0xc1d1d3['shift']());}};_0x2e2abe(++_0x14747f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 41d8f67..1f4afd9 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 _0xf90b=['moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','error','stack','name','send','index','map','Team','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','then','catch','show','params','rawAttributes','length','find','create','body','user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','options','Queues','isValidChannel','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','get','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','VoicePrefixId','isArray','Whatsapp','removeAgents','Queue:remove','TeamVoicePrefix','order','getAgents','eml-format','rimraf','zip-dir','request-promise'];(function(_0x2a2ab1,_0x12b676){var _0x113b6d=function(_0x337df1){while(--_0x337df1){_0x2a2ab1['push'](_0x2a2ab1['shift']());}};_0x113b6d(++_0x12b676);}(_0xf90b,0x99));var _0xbf90=function(_0x17ba33,_0x331b6e){_0x17ba33=_0x17ba33-0x0;var _0x4cdc93=_0xf90b[_0x17ba33];return _0x4cdc93;};'use strict';var emlformat=require(_0xbf90('0x0'));var rimraf=require(_0xbf90('0x1'));var zipdir=require(_0xbf90('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf90('0x3'));var moment=require(_0xbf90('0x4'));var BPromise=require(_0xbf90('0x5'));var Mustache=require(_0xbf90('0x6'));var util=require(_0xbf90('0x7'));var path=require(_0xbf90('0x8'));var sox=require('sox');var csv=require(_0xbf90('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf90('0xa'));var _=require('lodash');var squel=require(_0xbf90('0xb'));var crypto=require(_0xbf90('0xc'));var jsforce=require(_0xbf90('0xd'));var deskjs=require(_0xbf90('0xe'));var toCsv=require(_0xbf90('0x9'));var querystring=require(_0xbf90('0xf'));var Papa=require(_0xbf90('0x10'));var Redis=require(_0xbf90('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbf90('0x12'));var hardwareService=require(_0xbf90('0x13'));var logger=require(_0xbf90('0x14'))(_0xbf90('0x15'));var utils=require(_0xbf90('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf90('0x17'))['db'];config[_0xbf90('0x18')]=_[_0xbf90('0x19')](config[_0xbf90('0x18')],{'host':_0xbf90('0x1a'),'port':0x18eb});var socket=require(_0xbf90('0x1b'))(new Redis(config[_0xbf90('0x18')]));require(_0xbf90('0x1c'))[_0xbf90('0x1d')](socket);function respondWithStatusCode(_0x3e0a0d,_0x22bbd9){_0x22bbd9=_0x22bbd9||0xcc;return function(_0x55f60b){if(_0x55f60b){return _0x3e0a0d[_0xbf90('0x1e')](_0x22bbd9);}return _0x3e0a0d[_0xbf90('0x1f')](_0x22bbd9)[_0xbf90('0x20')]();};}function respondWithResult(_0x1e4119,_0x5597e8){_0x5597e8=_0x5597e8||0xc8;return function(_0x227501){if(_0x227501){return _0x1e4119[_0xbf90('0x1f')](_0x5597e8)['json'](_0x227501);}};}function respondWithFilteredResult(_0x1655fb,_0x331680){return function(_0x513702){if(_0x513702){var _0x3c8713=typeof _0x331680['offset']===_0xbf90('0x21')&&typeof _0x331680[_0xbf90('0x22')]==='undefined';var _0x406b90=_0x513702[_0xbf90('0x23')];var _0x5eb593=_0x3c8713?0x0:_0x331680[_0xbf90('0x24')];var _0x437821=_0x3c8713?_0x513702[_0xbf90('0x23')]:_0x331680[_0xbf90('0x24')]+_0x331680[_0xbf90('0x22')];var _0x1d09bd;if(_0x437821>=_0x406b90){_0x437821=_0x406b90;_0x1d09bd=0xc8;}else{_0x1d09bd=0xce;}_0x1655fb['status'](_0x1d09bd);return _0x1655fb[_0xbf90('0x25')](_0xbf90('0x26'),_0x5eb593+'-'+_0x437821+'/'+_0x406b90)[_0xbf90('0x27')](_0x513702);}return null;};}function patchUpdates(_0x64c601){return function(_0x47ce2c){try{jsonpatch[_0xbf90('0x28')](_0x47ce2c,_0x64c601,!![]);}catch(_0x4b2ad3){return BPromise[_0xbf90('0x29')](_0x4b2ad3);}return _0x47ce2c[_0xbf90('0x2a')]();};}function saveUpdates(_0x46ee74,_0x59a9e0){return function(_0xb09ce7){if(_0xb09ce7){return _0xb09ce7['update'](_0x46ee74)['then'](function(_0x35842c){return _0x35842c;});}return null;};}function handleEntityNotFound(_0x3ec0e0,_0x481c3d){return function(_0x1c57ce){if(!_0x1c57ce){_0x3ec0e0[_0xbf90('0x1e')](0x194);}return _0x1c57ce;};}function handleError(_0x3fd91d,_0x28581e){_0x28581e=_0x28581e||0x1f4;return function(_0x55e76d){logger[_0xbf90('0x2b')](_0x55e76d[_0xbf90('0x2c')]);if(_0x55e76d[_0xbf90('0x2d')]){delete _0x55e76d[_0xbf90('0x2d')];}_0x3fd91d['status'](_0x28581e)[_0xbf90('0x2e')](_0x55e76d);};}exports[_0xbf90('0x2f')]=function(_0x228d98,_0x101f54){var _0x5d943b={},_0x2a970e={},_0x437c12={'count':0x0,'rows':[]};var _0x4a314d=_[_0xbf90('0x30')](db[_0xbf90('0x31')]['rawAttributes'],function(_0x14ef41){return{'name':_0x14ef41['fieldName'],'type':_0x14ef41['type'][_0xbf90('0x32')]};});_0x2a970e[_0xbf90('0x33')]=_['map'](_0x4a314d,_0xbf90('0x2d'));_0x2a970e['query']=_[_0xbf90('0x34')](_0x228d98['query']);_0x2a970e[_0xbf90('0x35')]=_[_0xbf90('0x36')](_0x2a970e[_0xbf90('0x33')],_0x2a970e['query']);_0x5d943b[_0xbf90('0x37')]=_['intersection'](_0x2a970e[_0xbf90('0x33')],qs[_0xbf90('0x38')](_0x228d98[_0xbf90('0x39')][_0xbf90('0x38')]));_0x5d943b[_0xbf90('0x37')]=_0x5d943b[_0xbf90('0x37')]['length']?_0x5d943b[_0xbf90('0x37')]:_0x2a970e[_0xbf90('0x33')];if(!_0x228d98['query'][_0xbf90('0x3a')](_0xbf90('0x3b'))){_0x5d943b[_0xbf90('0x22')]=qs['limit'](_0x228d98[_0xbf90('0x39')]['limit']);_0x5d943b[_0xbf90('0x24')]=qs['offset'](_0x228d98[_0xbf90('0x39')][_0xbf90('0x24')]);}_0x5d943b['order']=qs[_0xbf90('0x3c')](_0x228d98[_0xbf90('0x39')][_0xbf90('0x3c')]);_0x5d943b[_0xbf90('0x3d')]=qs[_0xbf90('0x35')](_[_0xbf90('0x3e')](_0x228d98[_0xbf90('0x39')],_0x2a970e['filters']),_0x4a314d);if(_0x228d98[_0xbf90('0x39')][_0xbf90('0x3f')]){_0x5d943b[_0xbf90('0x3d')]=_[_0xbf90('0x40')](_0x5d943b[_0xbf90('0x3d')],{'$or':_[_0xbf90('0x30')](_0x4a314d,function(_0x24904a){if(_0x24904a['type']!=='VIRTUAL'){var _0x498a5f={};_0x498a5f[_0x24904a[_0xbf90('0x2d')]]={'$like':'%'+_0x228d98[_0xbf90('0x39')][_0xbf90('0x3f')]+'%'};return _0x498a5f;}})});}_0x5d943b=_[_0xbf90('0x40')]({},_0x5d943b,_0x228d98['options']);var _0x1283b5={'where':_0x5d943b[_0xbf90('0x3d')]};return db['Team'][_0xbf90('0x23')](_0x1283b5)['then'](function(_0x5d3a66){_0x437c12[_0xbf90('0x23')]=_0x5d3a66;if(_0x228d98[_0xbf90('0x39')][_0xbf90('0x41')]){_0x5d943b[_0xbf90('0x42')]=[{'all':!![]}];}return db[_0xbf90('0x31')][_0xbf90('0x43')](_0x5d943b);})[_0xbf90('0x44')](function(_0x2109ca){_0x437c12['rows']=_0x2109ca;return _0x437c12;})[_0xbf90('0x44')](respondWithFilteredResult(_0x101f54,_0x5d943b))[_0xbf90('0x45')](handleError(_0x101f54,null));};exports[_0xbf90('0x46')]=function(_0x30efbe,_0x151ad5){var _0x7d5946={'raw':![],'where':{'id':_0x30efbe[_0xbf90('0x47')]['id']}},_0x6c93a1={};_0x6c93a1[_0xbf90('0x33')]=_[_0xbf90('0x34')](db['Team'][_0xbf90('0x48')]);_0x6c93a1[_0xbf90('0x39')]=_['keys'](_0x30efbe[_0xbf90('0x39')]);_0x6c93a1['filters']=_['intersection'](_0x6c93a1[_0xbf90('0x33')],_0x6c93a1[_0xbf90('0x39')]);_0x7d5946[_0xbf90('0x37')]=_['intersection'](_0x6c93a1[_0xbf90('0x33')],qs[_0xbf90('0x38')](_0x30efbe['query'][_0xbf90('0x38')]));_0x7d5946[_0xbf90('0x37')]=_0x7d5946[_0xbf90('0x37')][_0xbf90('0x49')]?_0x7d5946[_0xbf90('0x37')]:_0x6c93a1[_0xbf90('0x33')];if(_0x30efbe[_0xbf90('0x39')][_0xbf90('0x41')]){_0x7d5946[_0xbf90('0x42')]=[{'all':!![]}];}_0x7d5946=_[_0xbf90('0x40')]({},_0x7d5946,_0x30efbe['options']);return db[_0xbf90('0x31')][_0xbf90('0x4a')](_0x7d5946)[_0xbf90('0x44')](handleEntityNotFound(_0x151ad5,null))[_0xbf90('0x44')](respondWithResult(_0x151ad5,null))[_0xbf90('0x45')](handleError(_0x151ad5,null));};exports[_0xbf90('0x4b')]=function(_0x16465a,_0x2192d4){return db[_0xbf90('0x31')][_0xbf90('0x4b')](_0x16465a[_0xbf90('0x4c')],{})[_0xbf90('0x44')](function(_0x16d9b2){var _0x304e5b=_0x16465a[_0xbf90('0x4d')]['get']({'plain':!![]});if(!_0x304e5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x304e5b[_0xbf90('0x4e')]===_0xbf90('0x4d')){var _0x3d89b1=_0x16d9b2['get']({'plain':!![]});var _0x1f2d1b=_0xbf90('0x4f');return db[_0xbf90('0x50')][_0xbf90('0x4a')]({'where':{'name':_0x1f2d1b,'userProfileId':_0x304e5b[_0xbf90('0x51')]},'raw':!![]})[_0xbf90('0x44')](function(_0x1da88c){if(_0x1da88c&&_0x1da88c[_0xbf90('0x52')]===0x0){return db[_0xbf90('0x53')][_0xbf90('0x4b')]({'name':_0x3d89b1['name'],'resourceId':_0x3d89b1['id'],'type':_0x1da88c['name'],'sectionId':_0x1da88c['id']},{})[_0xbf90('0x44')](function(){return _0x16d9b2;});}else{return _0x16d9b2;}})[_0xbf90('0x45')](function(_0x50e8ed){logger[_0xbf90('0x2b')](_0xbf90('0x54'),_0x50e8ed);throw _0x50e8ed;});}return _0x16d9b2;})[_0xbf90('0x44')](respondWithResult(_0x2192d4,0xc9))[_0xbf90('0x45')](handleError(_0x2192d4,null));};exports['update']=function(_0x3ee3dd,_0xb847fb){if(_0x3ee3dd[_0xbf90('0x4c')]['id']){delete _0x3ee3dd[_0xbf90('0x4c')]['id'];}return db[_0xbf90('0x31')][_0xbf90('0x4a')]({'where':{'id':_0x3ee3dd['params']['id']}})[_0xbf90('0x44')](handleEntityNotFound(_0xb847fb,null))[_0xbf90('0x44')](saveUpdates(_0x3ee3dd['body'],null))['then'](respondWithResult(_0xb847fb,null))[_0xbf90('0x45')](handleError(_0xb847fb,null));};exports[_0xbf90('0x55')]=function(_0x29815c,_0x1e6f15){var _0x37ab44=_0x29815c[_0xbf90('0x47')]['id'];var _0x228eaf=[];return db[_0xbf90('0x56')]['transaction'](function(_0x1bd10b){var _0x427564='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x427564,{'type':db[_0xbf90('0x57')]['QueryTypes'][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b})[_0xbf90('0x44')](function(_0x37fd47){_0x228eaf=_[_0xbf90('0x30')](_0x37fd47,function(_0x3a1499){return Number(_0x3a1499[_0xbf90('0x59')]);});})[_0xbf90('0x44')](function(){var _0x369ba1=_0xbf90('0x5a')+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x369ba1,{'type':db[_0xbf90('0x57')][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x3f102d){var _0x394e03=_[_0xbf90('0x30')](_0x3f102d,function(_0x49ec43){return Number(_0x49ec43[_0xbf90('0x5c')]);});return db['UserVoiceQueue'][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'VoiceQueueId':{'$in':_0x394e03}},'transaction':_0x1bd10b});})['then'](function(){var _0x275f33=_0xbf90('0x5d')+_0x37ab44;return db[_0xbf90('0x56')]['query'](_0x275f33,{'type':db[_0xbf90('0x57')]['QueryTypes'][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})['then'](function(_0x265d97){var _0x5d266e=_[_0xbf90('0x30')](_0x265d97,function(_0x48b3c9){return Number(_0x48b3c9[_0xbf90('0x5e')]);});return db[_0xbf90('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x228eaf},'MailQueueId':{'$in':_0x5d266e}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){var _0x1c4e68=_0xbf90('0x60')+_0x37ab44;return db[_0xbf90('0x56')]['query'](_0x1c4e68,{'type':db[_0xbf90('0x57')]['QueryTypes'][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x373fb6){var _0x5c7354=_[_0xbf90('0x30')](_0x373fb6,function(_0x17465d){return Number(_0x17465d[_0xbf90('0x61')]);});return db[_0xbf90('0x62')][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'SmsQueueId':{'$in':_0x5c7354}},'transaction':_0x1bd10b});})['then'](function(){var _0x456980=_0xbf90('0x63')+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x456980,{'type':db[_0xbf90('0x57')][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x4ad683){var _0x4785f1=_[_0xbf90('0x30')](_0x4ad683,function(_0x218537){return Number(_0x218537[_0xbf90('0x64')]);});return db[_0xbf90('0x65')]['destroy']({'where':{'UserId':{'$in':_0x228eaf},'ChatQueueId':{'$in':_0x4785f1}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){var _0x3fb63c=_0xbf90('0x66')+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x3fb63c,{'type':db[_0xbf90('0x57')][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})['then'](function(_0x9e9049){var _0x443a62=_[_0xbf90('0x30')](_0x9e9049,function(_0x5cc50a){return Number(_0x5cc50a[_0xbf90('0x67')]);});return db['UserFaxQueue'][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'FaxQueueId':{'$in':_0x443a62}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){var _0x25fed4='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x37ab44;return db[_0xbf90('0x56')][_0xbf90('0x39')](_0x25fed4,{'type':db[_0xbf90('0x57')][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x373a85){var _0x5070e0=_[_0xbf90('0x30')](_0x373a85,function(_0x38bf6b){return Number(_0x38bf6b[_0xbf90('0x68')]);});return db[_0xbf90('0x69')][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'OpenchannelQueueId':{'$in':_0x5070e0}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){var _0x24724a=_0xbf90('0x6a')+_0x37ab44;return db['sequelize'][_0xbf90('0x39')](_0x24724a,{'type':db['Sequelize'][_0xbf90('0x5b')][_0xbf90('0x58')],'raw':!![],'transaction':_0x1bd10b});})['then'](function(_0x42f847){var _0x4891c8=_['map'](_0x42f847,function(_0x472592){return Number(_0x472592[_0xbf90('0x6b')]);});return db[_0xbf90('0x6c')][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'WhatsappQueueId':{'$in':_0x4891c8}},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x37ab44}});})['then'](function(_0x4345ff){if(_0x4345ff===null){return;}return db['UserVoicePrefix'][_0xbf90('0x55')]({'where':{'UserId':{'$in':_0x228eaf},'VoicePrefixId':_0x4345ff['VoicePrefixId']},'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(){return db[_0xbf90('0x31')][_0xbf90('0x55')]({'where':{'id':_0x37ab44},'cascade':!![],'transaction':_0x1bd10b});})[_0xbf90('0x44')](function(_0x42280d){if(_0x42280d===0x0){_0x1e6f15[_0xbf90('0x1e')](0x194);}else{return db[_0xbf90('0x53')]['destroy']({'where':{'type':'Teams','resourceId':_0x37ab44},'cascade':!![],'transaction':_0x1bd10b})['then'](function(){_0x1e6f15[_0xbf90('0x1f')](0xcc)[_0xbf90('0x20')]();});}})['catch'](function(_0x41cf07){_0x1e6f15[_0xbf90('0x1f')](0x1f4)['send'](_0x41cf07);});});};exports[_0xbf90('0x6d')]=function(_0x12efcf,_0x10d89e,_0x47ebd3){return db[_0xbf90('0x31')][_0xbf90('0x6e')]({'where':{'id':_0x12efcf[_0xbf90('0x47')]['id']}})[_0xbf90('0x44')](handleEntityNotFound(_0x10d89e,null))[_0xbf90('0x44')](function(_0x27c877){if(!_0x12efcf[_0xbf90('0x39')]['channel']||!utils['isValidChannel'](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x6f')])){throw new db[(_0xbf90('0x57'))][(_0xbf90('0x70'))](_0xbf90('0x71'));}var _0x4ae288={};var _0x263fca={};_0x263fca[_0xbf90('0x33')]=_[_0xbf90('0x34')](db[_[_0xbf90('0x72')](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x6f')][_0xbf90('0x73')]())+'Queue']['rawAttributes']);_0x263fca[_0xbf90('0x39')]=_['keys'](_0x12efcf[_0xbf90('0x39')]);_0x263fca[_0xbf90('0x35')]=_[_0xbf90('0x36')](_0x263fca['model'],_0x263fca['query']);_0x4ae288[_0xbf90('0x37')]=_[_0xbf90('0x36')](_0x263fca[_0xbf90('0x33')],qs[_0xbf90('0x38')](_0x12efcf['query']['fields']));_0x4ae288['attributes']=_0x4ae288[_0xbf90('0x37')][_0xbf90('0x49')]?_0x4ae288[_0xbf90('0x37')]:_0x263fca[_0xbf90('0x33')];_0x4ae288[_0xbf90('0x22')]=qs[_0xbf90('0x22')](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x22')]);_0x4ae288[_0xbf90('0x24')]=qs[_0xbf90('0x24')](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x24')]);_0x4ae288['order']=qs['sort'](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x3c')]);_0x4ae288[_0xbf90('0x3d')]=qs[_0xbf90('0x35')](_[_0xbf90('0x3e')](_0x12efcf[_0xbf90('0x39')],_0x263fca[_0xbf90('0x35')]));_0x4ae288=_['merge']({},_0x4ae288,_0x12efcf[_0xbf90('0x74')]);return _0x27c877['get'+_['capitalize'](_0x12efcf[_0xbf90('0x39')][_0xbf90('0x6f')][_0xbf90('0x73')]())+_0xbf90('0x75')](_0x4ae288);})[_0xbf90('0x44')](respondWithResult(_0x10d89e,null))[_0xbf90('0x45')](handleError(_0x10d89e,null));};exports['addQueues']=function(_0x562a43,_0x172b0e,_0x54dda8){return db[_0xbf90('0x31')][_0xbf90('0x6e')]({'where':{'id':_0x562a43[_0xbf90('0x47')]['id']}})[_0xbf90('0x44')](function(_0xaf7929){if(_0xaf7929){if(!_0x562a43[_0xbf90('0x4c')]['channel']||!utils[_0xbf90('0x76')](_0x562a43['body'][_0xbf90('0x6f')])){throw new db[(_0xbf90('0x57'))][(_0xbf90('0x70'))](_0xbf90('0x71'));}return _0xaf7929['add'+_[_0xbf90('0x72')](_0x562a43['body'][_0xbf90('0x6f')][_0xbf90('0x73')]())+_0xbf90('0x75')](_0x562a43[_0xbf90('0x4c')][_0xbf90('0x77')]);}return null;})[_0xbf90('0x44')](handleEntityNotFound(_0x172b0e,null))['then'](respondWithStatusCode(_0x172b0e,null))['catch'](handleError(_0x172b0e,null));};exports[_0xbf90('0x78')]=function(_0x28846c,_0x20410f,_0x11c096){return db[_0xbf90('0x31')]['findOne']({'where':{'id':_0x28846c[_0xbf90('0x47')]['id']}})[_0xbf90('0x44')](function(_0x4c2139){if(_0x4c2139){if(!_0x28846c[_0xbf90('0x39')][_0xbf90('0x6f')]||!utils[_0xbf90('0x76')](_0x28846c[_0xbf90('0x39')]['channel'])){throw new db[(_0xbf90('0x57'))][(_0xbf90('0x70'))](_0xbf90('0x71'));}return _0x4c2139[_0xbf90('0x79')+_[_0xbf90('0x72')](_0x28846c[_0xbf90('0x39')][_0xbf90('0x6f')][_0xbf90('0x73')]())+_0xbf90('0x75')](_0x28846c['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x20410f,null))[_0xbf90('0x44')](respondWithStatusCode(_0x20410f,null))[_0xbf90('0x45')](handleError(_0x20410f,null));};exports[_0xbf90('0x7a')]=function(_0x15527e,_0x3311b5){var _0x31b72f=_['isArray'](_0x15527e[_0xbf90('0x4c')][_0xbf90('0x77')])?_0x15527e[_0xbf90('0x4c')][_0xbf90('0x77')]:[_0x15527e['body']['ids']];var _0x5a18b6=_0x15527e['params']['id'];return db[_0xbf90('0x31')][_0xbf90('0x4a')]({'where':{'id':_0x5a18b6}})['then'](handleEntityNotFound(_0x3311b5,null))[_0xbf90('0x44')](function(_0x3a71a7){if(_0x3a71a7){var _0x54fc3e=[_0xbf90('0x7b'),_0xbf90('0x7c'),_0xbf90('0x7d'),_0xbf90('0x7e'),_0xbf90('0x7f'),_0xbf90('0x80'),'Whatsapp'];return db[_0xbf90('0x56')]['transaction'](function(_0xcccec0){var _0x99cc83=_[_0xbf90('0x30')](_0x54fc3e,function(_0x48ea9f){var _0x283998={'attributes':['id',_0xbf90('0x2d')]};if(_0x48ea9f==='Voice'){_0x283998[_0xbf90('0x81')]={'attributes':[_0xbf90('0x82')]};}return _0x3a71a7[_0xbf90('0x83')+_0x48ea9f+_0xbf90('0x75')](_0x283998)[_0xbf90('0x44')](function(_0x1f32fc){var _0x12ccda=_[_0xbf90('0x30')](_0x1f32fc,function(_0x51f17e){var _0xb3a438=_['map'](_0x31b72f,function(_0xd9c27c){var _0x2e2eb6={'where':{'UserId':_0xd9c27c,[_0x48ea9f+_0xbf90('0x84')]:_0x51f17e['id']},'transaction':_0xcccec0};if(_0x48ea9f==='Voice'){_0x2e2eb6[_0xbf90('0x19')]={'penalty':_0x51f17e[_0xbf90('0x85')][_0xbf90('0x82')]};}return db[_0xbf90('0x86')+_0x48ea9f+_0xbf90('0x87')][_0xbf90('0x88')](_0x2e2eb6)[_0xbf90('0x44')](function(){socket[_0xbf90('0x89')](_0xbf90('0x4d')+_0x48ea9f+_0xbf90('0x8a'),{'UserId':_0xd9c27c,[_0x48ea9f+'QueueId']:_0x51f17e['id']});if(_0x48ea9f!==_0xbf90('0x7b')){return;}return db['User'][_0xbf90('0x43')]({'where':{'id':_0x31b72f,'online':0x1},'attributes':['id',_0xbf90('0x2d'),_0xbf90('0x8b'),_0xbf90('0x8c'),_0xbf90('0x8d')],'raw':!![]})[_0xbf90('0x44')](function(_0x42a8f5){var _0x1bb5b0=_[_0xbf90('0x30')](_0x42a8f5,function(_0x46c650){return db[_0xbf90('0x8e')][_0xbf90('0x8f')]({'membername':_0x46c650[_0xbf90('0x2d')],'UserId':_0x46c650['id'],'queue_name':_0x51f17e[_0xbf90('0x2d')],'VoiceQueueId':_0x51f17e['id'],'interface':_[_0xbf90('0x90')](_0x46c650[_0xbf90('0x8d')])?util[_0xbf90('0x91')](_0xbf90('0x92'),_0x46c650[_0xbf90('0x2d')]):_0x46c650[_0xbf90('0x8d')],'paused':_0x46c650[_0xbf90('0x8c')]||![],'penalty':_0x51f17e[_0xbf90('0x85')][_0xbf90('0x82')]},{'transaction':_0xcccec0});});return Promise['all'](_0x1bb5b0);});});});return Promise[_0xbf90('0x93')](_0xb3a438);});return Promise[_0xbf90('0x93')](_0x12ccda);})[_0xbf90('0x44')](function(){return db['TeamVoicePrefix'][_0xbf90('0x6e')]({'where':{'teamId':_0x5a18b6}})[_0xbf90('0x44')](function(_0x438266){if(_0x438266){var _0x555340=_[_0xbf90('0x30')](_0x31b72f,function(_0x5b176a){db[_0xbf90('0x94')][_0xbf90('0x8f')]({'UserId':_0x5b176a,'VoicePrefixId':_0x438266[_0xbf90('0x95')]});});return Promise[_0xbf90('0x93')](_0x555340);}});});});return Promise[_0xbf90('0x93')](_0x99cc83)[_0xbf90('0x44')](function(){return _0x3a71a7[_0xbf90('0x7a')](_0x31b72f,{'transaction':_0xcccec0})['spread'](function(_0x4ee217){return _0x4ee217;});});});}})[_0xbf90('0x44')](respondWithResult(_0x3311b5,null))[_0xbf90('0x45')](handleError(_0x3311b5,null));};exports['removeAgents']=function(_0x43ff38,_0x3262f0){var _0x197a6d=_[_0xbf90('0x96')](_0x43ff38[_0xbf90('0x39')][_0xbf90('0x77')])?_0x43ff38[_0xbf90('0x39')][_0xbf90('0x77')]:[_0x43ff38[_0xbf90('0x39')][_0xbf90('0x77')]];var _0x4b0321=_0x43ff38[_0xbf90('0x47')]['id'];return db[_0xbf90('0x31')][_0xbf90('0x4a')]({'where':{'id':_0x4b0321}})[_0xbf90('0x44')](handleEntityNotFound(_0x3262f0,null))[_0xbf90('0x44')](function(_0x350d46){if(_0x350d46){var _0x28de53=[_0xbf90('0x7b'),_0xbf90('0x7c'),_0xbf90('0x7d'),_0xbf90('0x7e'),_0xbf90('0x7f'),_0xbf90('0x80'),_0xbf90('0x97')];return db[_0xbf90('0x56')]['transaction'](function(_0xed1898){var _0x2f58ab=_['map'](_0x28de53,function(_0x423bb1){var _0x90041c={'attributes':['id',_0xbf90('0x2d')]};return _0x350d46[_0xbf90('0x83')+_0x423bb1+_0xbf90('0x75')](_0x90041c)['then'](function(_0x14262c){var _0xc544e3=_[_0xbf90('0x30')](_0x14262c,function(_0x310f05){return _0x310f05[_0xbf90('0x98')](_0x197a6d,{'transaction':_0xed1898})[_0xbf90('0x44')](function(){var _0x3d04f1=_[_0xbf90('0x30')](_0x197a6d,function(_0x26be3a){socket[_0xbf90('0x89')]('user'+_0x423bb1+_0xbf90('0x99'),{'UserId':Number(_0x26be3a),[_0x423bb1+_0xbf90('0x84')]:_0x310f05['id']});if(_0x423bb1!==_0xbf90('0x7b')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x310f05['id'],'UserId':_0x26be3a},'transaction':_0xed1898});});return Promise[_0xbf90('0x93')](_0x3d04f1);});});return Promise[_0xbf90('0x93')](_0xc544e3);});});return Promise[_0xbf90('0x93')](_0x2f58ab)[_0xbf90('0x44')](function(){return _0x350d46[_0xbf90('0x98')](_0x197a6d,{'transaction':_0xed1898});})['then'](function(){return db[_0xbf90('0x9a')]['findOne']({'where':{'teamId':_0x4b0321}})[_0xbf90('0x44')](function(_0x463537){if(_0x463537){var _0x1cdbdc=_[_0xbf90('0x30')](_0x197a6d,function(_0x349c8e){db[_0xbf90('0x94')]['destroy']({'where':{'UserId':_0x349c8e,'VoicePrefixId':_0x463537['VoicePrefixId']}});});return Promise['all'](_0x1cdbdc);}});});});}})[_0xbf90('0x44')](respondWithStatusCode(_0x3262f0,null))[_0xbf90('0x45')](handleError(_0x3262f0,null));};exports['getAgents']=function(_0x37a374,_0x26775e,_0x584ab9){var _0x3a24b1={};var _0x5e015a={};var _0x10f528;var _0x1418c0;return db['Team'][_0xbf90('0x6e')]({'where':{'id':_0x37a374[_0xbf90('0x47')]['id']}})[_0xbf90('0x44')](handleEntityNotFound(_0x26775e,null))['then'](function(_0x3f2d51){if(_0x3f2d51){_0x10f528=_0x3f2d51;_0x5e015a[_0xbf90('0x33')]=_['keys'](db['User'][_0xbf90('0x48')]);_0x5e015a['query']=_[_0xbf90('0x34')](_0x37a374[_0xbf90('0x39')]);_0x5e015a['filters']=_['intersection'](_0x5e015a[_0xbf90('0x33')],_0x5e015a['query']);_0x3a24b1[_0xbf90('0x37')]=_[_0xbf90('0x36')](_0x5e015a[_0xbf90('0x33')],qs[_0xbf90('0x38')](_0x37a374[_0xbf90('0x39')][_0xbf90('0x38')]));_0x3a24b1['attributes']=_0x3a24b1[_0xbf90('0x37')][_0xbf90('0x49')]?_0x3a24b1['attributes']:_0x5e015a[_0xbf90('0x33')];_0x3a24b1[_0xbf90('0x9b')]=qs[_0xbf90('0x3c')](_0x37a374[_0xbf90('0x39')][_0xbf90('0x3c')]);_0x3a24b1[_0xbf90('0x3d')]=qs['filters'](_['pick'](_0x37a374[_0xbf90('0x39')],_0x5e015a[_0xbf90('0x35')]));if(_0x37a374[_0xbf90('0x39')][_0xbf90('0x3f')]){_0x3a24b1[_0xbf90('0x3d')]=_[_0xbf90('0x40')](_0x3a24b1[_0xbf90('0x3d')],{'$or':_[_0xbf90('0x30')](_0x3a24b1[_0xbf90('0x37')],function(_0x4bc157){var _0x2947d3={};_0x2947d3[_0x4bc157]={'$like':'%'+_0x37a374[_0xbf90('0x39')][_0xbf90('0x3f')]+'%'};return _0x2947d3;})});}_0x3a24b1=_[_0xbf90('0x40')]({},_0x3a24b1,_0x37a374['options']);return _0x10f528['getAgents'](_0x3a24b1);}})[_0xbf90('0x44')](function(_0x40dab4){if(_0x40dab4){_0x1418c0=_0x40dab4[_0xbf90('0x49')];if(!_0x37a374[_0xbf90('0x39')][_0xbf90('0x3a')](_0xbf90('0x3b'))){_0x3a24b1[_0xbf90('0x22')]=qs[_0xbf90('0x22')](_0x37a374[_0xbf90('0x39')][_0xbf90('0x22')]);_0x3a24b1[_0xbf90('0x24')]=qs[_0xbf90('0x24')](_0x37a374[_0xbf90('0x39')][_0xbf90('0x24')]);}return _0x10f528[_0xbf90('0x9c')](_0x3a24b1);}})['then'](function(_0xf4ff66){if(_0xf4ff66){return _0xf4ff66?{'count':_0x1418c0,'rows':_0xf4ff66}:null;}})[_0xbf90('0x44')](respondWithResult(_0x26775e,null))['catch'](handleError(_0x26775e,null));}; \ No newline at end of file +var _0x82ed=['channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','defaults','User','findOrCreate','emit','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','spread','removeAgents','isArray','Queue:remove','getAgents','nolimit','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','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','status','end','offset','undefined','limit','count','json','apply','reject','save','update','sendStatus','error','name','send','index','map','Team','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','then','includeAll','findAll','catch','show','params','include','find','create','body','get','user','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','destroy','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne'];(function(_0x36ad44,_0x390c18){var _0x5bb132=function(_0x4e1488){while(--_0x4e1488){_0x36ad44['push'](_0x36ad44['shift']());}};_0x5bb132(++_0x390c18);}(_0x82ed,0xc7));var _0xd82e=function(_0x2fdaff,_0x27a994){_0x2fdaff=_0x2fdaff-0x0;var _0x3cf2e2=_0x82ed[_0x2fdaff];return _0x3cf2e2;};'use strict';var emlformat=require(_0xd82e('0x0'));var rimraf=require(_0xd82e('0x1'));var zipdir=require(_0xd82e('0x2'));var jsonpatch=require(_0xd82e('0x3'));var rp=require(_0xd82e('0x4'));var moment=require(_0xd82e('0x5'));var BPromise=require(_0xd82e('0x6'));var Mustache=require(_0xd82e('0x7'));var util=require(_0xd82e('0x8'));var path=require(_0xd82e('0x9'));var sox=require(_0xd82e('0xa'));var csv=require(_0xd82e('0xb'));var ejs=require(_0xd82e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd82e('0xd'));var squel=require(_0xd82e('0xe'));var crypto=require(_0xd82e('0xf'));var jsforce=require(_0xd82e('0x10'));var deskjs=require(_0xd82e('0x11'));var toCsv=require(_0xd82e('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd82e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd82e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd82e('0x14'))('api');var utils=require(_0xd82e('0x15'));var config=require(_0xd82e('0x16'));var licenseUtil=require(_0xd82e('0x17'));var db=require(_0xd82e('0x18'))['db'];config[_0xd82e('0x19')]=_['defaults'](config['redis'],{'host':_0xd82e('0x1a'),'port':0x18eb});var socket=require(_0xd82e('0x1b'))(new Redis(config[_0xd82e('0x19')]));require(_0xd82e('0x1c'))[_0xd82e('0x1d')](socket);function respondWithStatusCode(_0x2214f0,_0x164256){_0x164256=_0x164256||0xcc;return function(_0x2e5eec){if(_0x2e5eec){return _0x2214f0['sendStatus'](_0x164256);}return _0x2214f0[_0xd82e('0x1e')](_0x164256)[_0xd82e('0x1f')]();};}function respondWithResult(_0x522cda,_0x6337d5){_0x6337d5=_0x6337d5||0xc8;return function(_0x4416e2){if(_0x4416e2){return _0x522cda[_0xd82e('0x1e')](_0x6337d5)['json'](_0x4416e2);}};}function respondWithFilteredResult(_0x509302,_0x3e5366){return function(_0x1ad541){if(_0x1ad541){var _0x519b30=typeof _0x3e5366[_0xd82e('0x20')]===_0xd82e('0x21')&&typeof _0x3e5366[_0xd82e('0x22')]===_0xd82e('0x21');var _0xa2797e=_0x1ad541[_0xd82e('0x23')];var _0x267261=_0x519b30?0x0:_0x3e5366['offset'];var _0x50d39d=_0x519b30?_0x1ad541[_0xd82e('0x23')]:_0x3e5366['offset']+_0x3e5366['limit'];var _0x32a7b8;if(_0x50d39d>=_0xa2797e){_0x50d39d=_0xa2797e;_0x32a7b8=0xc8;}else{_0x32a7b8=0xce;}_0x509302[_0xd82e('0x1e')](_0x32a7b8);return _0x509302['set']('Content-Range',_0x267261+'-'+_0x50d39d+'/'+_0xa2797e)[_0xd82e('0x24')](_0x1ad541);}return null;};}function patchUpdates(_0x3eba14){return function(_0x5a595a){try{jsonpatch[_0xd82e('0x25')](_0x5a595a,_0x3eba14,!![]);}catch(_0x73286a){return BPromise[_0xd82e('0x26')](_0x73286a);}return _0x5a595a[_0xd82e('0x27')]();};}function saveUpdates(_0x3e6d79,_0x108d1a){return function(_0x15e0cb){if(_0x15e0cb){return _0x15e0cb[_0xd82e('0x28')](_0x3e6d79)['then'](function(_0x32af19){return _0x32af19;});}return null;};}function handleEntityNotFound(_0x36c444,_0x898976){return function(_0x4ac364){if(!_0x4ac364){_0x36c444[_0xd82e('0x29')](0x194);}return _0x4ac364;};}function handleError(_0x13438e,_0x17ad1d){_0x17ad1d=_0x17ad1d||0x1f4;return function(_0x33c3ef){logger[_0xd82e('0x2a')](_0x33c3ef['stack']);if(_0x33c3ef['name']){delete _0x33c3ef[_0xd82e('0x2b')];}_0x13438e['status'](_0x17ad1d)[_0xd82e('0x2c')](_0x33c3ef);};}exports[_0xd82e('0x2d')]=function(_0x5d1cee,_0x10ffb6){var _0x1985cc={},_0x3ab1b6={},_0x5c30fd={'count':0x0,'rows':[]};var _0x2cb736=_[_0xd82e('0x2e')](db[_0xd82e('0x2f')][_0xd82e('0x30')],function(_0x35f752){return{'name':_0x35f752['fieldName'],'type':_0x35f752['type'][_0xd82e('0x31')]};});_0x3ab1b6['model']=_[_0xd82e('0x2e')](_0x2cb736,_0xd82e('0x2b'));_0x3ab1b6[_0xd82e('0x32')]=_[_0xd82e('0x33')](_0x5d1cee[_0xd82e('0x32')]);_0x3ab1b6[_0xd82e('0x34')]=_['intersection'](_0x3ab1b6[_0xd82e('0x35')],_0x3ab1b6[_0xd82e('0x32')]);_0x1985cc[_0xd82e('0x36')]=_[_0xd82e('0x37')](_0x3ab1b6[_0xd82e('0x35')],qs[_0xd82e('0x38')](_0x5d1cee['query'][_0xd82e('0x38')]));_0x1985cc[_0xd82e('0x36')]=_0x1985cc[_0xd82e('0x36')][_0xd82e('0x39')]?_0x1985cc['attributes']:_0x3ab1b6[_0xd82e('0x35')];if(!_0x5d1cee[_0xd82e('0x32')][_0xd82e('0x3a')]('nolimit')){_0x1985cc[_0xd82e('0x22')]=qs[_0xd82e('0x22')](_0x5d1cee[_0xd82e('0x32')][_0xd82e('0x22')]);_0x1985cc[_0xd82e('0x20')]=qs[_0xd82e('0x20')](_0x5d1cee[_0xd82e('0x32')][_0xd82e('0x20')]);}_0x1985cc['order']=qs[_0xd82e('0x3b')](_0x5d1cee['query']['sort']);_0x1985cc[_0xd82e('0x3c')]=qs[_0xd82e('0x34')](_[_0xd82e('0x3d')](_0x5d1cee['query'],_0x3ab1b6['filters']),_0x2cb736);if(_0x5d1cee[_0xd82e('0x32')]['filter']){_0x1985cc[_0xd82e('0x3c')]=_['merge'](_0x1985cc['where'],{'$or':_[_0xd82e('0x2e')](_0x2cb736,function(_0x219dfb){if(_0x219dfb['type']!==_0xd82e('0x3e')){var _0x3a3def={};_0x3a3def[_0x219dfb[_0xd82e('0x2b')]]={'$like':'%'+_0x5d1cee['query'][_0xd82e('0x3f')]+'%'};return _0x3a3def;}})});}_0x1985cc=_[_0xd82e('0x40')]({},_0x1985cc,_0x5d1cee[_0xd82e('0x41')]);var _0x30b095={'where':_0x1985cc[_0xd82e('0x3c')]};return db[_0xd82e('0x2f')][_0xd82e('0x23')](_0x30b095)[_0xd82e('0x42')](function(_0x59a904){_0x5c30fd[_0xd82e('0x23')]=_0x59a904;if(_0x5d1cee[_0xd82e('0x32')][_0xd82e('0x43')]){_0x1985cc['include']=[{'all':!![]}];}return db[_0xd82e('0x2f')][_0xd82e('0x44')](_0x1985cc);})[_0xd82e('0x42')](function(_0x315f17){_0x5c30fd['rows']=_0x315f17;return _0x5c30fd;})[_0xd82e('0x42')](respondWithFilteredResult(_0x10ffb6,_0x1985cc))[_0xd82e('0x45')](handleError(_0x10ffb6,null));};exports[_0xd82e('0x46')]=function(_0x4d1faf,_0x10a4ef){var _0x1d3ba7={'raw':![],'where':{'id':_0x4d1faf[_0xd82e('0x47')]['id']}},_0x1a4c72={};_0x1a4c72[_0xd82e('0x35')]=_['keys'](db[_0xd82e('0x2f')]['rawAttributes']);_0x1a4c72[_0xd82e('0x32')]=_['keys'](_0x4d1faf['query']);_0x1a4c72[_0xd82e('0x34')]=_['intersection'](_0x1a4c72[_0xd82e('0x35')],_0x1a4c72[_0xd82e('0x32')]);_0x1d3ba7[_0xd82e('0x36')]=_[_0xd82e('0x37')](_0x1a4c72['model'],qs['fields'](_0x4d1faf[_0xd82e('0x32')][_0xd82e('0x38')]));_0x1d3ba7[_0xd82e('0x36')]=_0x1d3ba7[_0xd82e('0x36')]['length']?_0x1d3ba7[_0xd82e('0x36')]:_0x1a4c72[_0xd82e('0x35')];if(_0x4d1faf[_0xd82e('0x32')]['includeAll']){_0x1d3ba7[_0xd82e('0x48')]=[{'all':!![]}];}_0x1d3ba7=_[_0xd82e('0x40')]({},_0x1d3ba7,_0x4d1faf[_0xd82e('0x41')]);return db[_0xd82e('0x2f')][_0xd82e('0x49')](_0x1d3ba7)[_0xd82e('0x42')](handleEntityNotFound(_0x10a4ef,null))[_0xd82e('0x42')](respondWithResult(_0x10a4ef,null))['catch'](handleError(_0x10a4ef,null));};exports['create']=function(_0x1a21eb,_0x36471d){return db[_0xd82e('0x2f')][_0xd82e('0x4a')](_0x1a21eb[_0xd82e('0x4b')],{})[_0xd82e('0x42')](function(_0x140b37){var _0x2576cd=_0x1a21eb['user'][_0xd82e('0x4c')]({'plain':!![]});if(!_0x2576cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2576cd['role']===_0xd82e('0x4d')){var _0x32c441=_0x140b37['get']({'plain':!![]});var _0x2f1f76=_0xd82e('0x4e');return db[_0xd82e('0x4f')][_0xd82e('0x49')]({'where':{'name':_0x2f1f76,'userProfileId':_0x2576cd[_0xd82e('0x50')]},'raw':!![]})[_0xd82e('0x42')](function(_0x40ec41){if(_0x40ec41&&_0x40ec41['autoAssociation']===0x0){return db[_0xd82e('0x51')]['create']({'name':_0x32c441['name'],'resourceId':_0x32c441['id'],'type':_0x40ec41[_0xd82e('0x2b')],'sectionId':_0x40ec41['id']},{})[_0xd82e('0x42')](function(){return _0x140b37;});}else{return _0x140b37;}})[_0xd82e('0x45')](function(_0x29dcfa){logger[_0xd82e('0x2a')](_0xd82e('0x52'),_0x29dcfa);throw _0x29dcfa;});}return _0x140b37;})[_0xd82e('0x42')](respondWithResult(_0x36471d,0xc9))[_0xd82e('0x45')](handleError(_0x36471d,null));};exports[_0xd82e('0x28')]=function(_0x1c13dc,_0x504178){if(_0x1c13dc[_0xd82e('0x4b')]['id']){delete _0x1c13dc['body']['id'];}return db[_0xd82e('0x2f')]['find']({'where':{'id':_0x1c13dc['params']['id']}})['then'](handleEntityNotFound(_0x504178,null))['then'](saveUpdates(_0x1c13dc[_0xd82e('0x4b')],null))[_0xd82e('0x42')](respondWithResult(_0x504178,null))[_0xd82e('0x45')](handleError(_0x504178,null));};exports['destroy']=function(_0x43c175,_0x3ef95f){var _0x5c31b9=_0x43c175['params']['id'];var _0x2325f9=[];return db['sequelize'][_0xd82e('0x53')](function(_0xbce4be){var _0x19bb14=_0xd82e('0x54')+_0x5c31b9;return db[_0xd82e('0x55')][_0xd82e('0x32')](_0x19bb14,{'type':db[_0xd82e('0x56')][_0xd82e('0x57')][_0xd82e('0x58')],'raw':!![],'transaction':_0xbce4be})['then'](function(_0xaaf442){_0x2325f9=_[_0xd82e('0x2e')](_0xaaf442,function(_0x222d1d){return Number(_0x222d1d[_0xd82e('0x59')]);});})[_0xd82e('0x42')](function(){var _0x4eb3f0=_0xd82e('0x5a')+_0x5c31b9;return db['sequelize'][_0xd82e('0x32')](_0x4eb3f0,{'type':db[_0xd82e('0x56')][_0xd82e('0x57')][_0xd82e('0x58')],'raw':!![],'transaction':_0xbce4be});})[_0xd82e('0x42')](function(_0x1a71be){var _0x26159e=_[_0xd82e('0x2e')](_0x1a71be,function(_0xdf4e4c){return Number(_0xdf4e4c[_0xd82e('0x5b')]);});return db[_0xd82e('0x5c')]['destroy']({'where':{'UserId':{'$in':_0x2325f9},'VoiceQueueId':{'$in':_0x26159e}},'transaction':_0xbce4be});})[_0xd82e('0x42')](function(){var _0x513b66=_0xd82e('0x5d')+_0x5c31b9;return db['sequelize'][_0xd82e('0x32')](_0x513b66,{'type':db[_0xd82e('0x56')][_0xd82e('0x57')][_0xd82e('0x58')],'raw':!![],'transaction':_0xbce4be});})[_0xd82e('0x42')](function(_0x12fab8){var _0x43c8fc=_[_0xd82e('0x2e')](_0x12fab8,function(_0x463e40){return Number(_0x463e40[_0xd82e('0x5e')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x2325f9},'MailQueueId':{'$in':_0x43c8fc}},'transaction':_0xbce4be});})['then'](function(){var _0x158f23=_0xd82e('0x5f')+_0x5c31b9;return db[_0xd82e('0x55')][_0xd82e('0x32')](_0x158f23,{'type':db['Sequelize']['QueryTypes'][_0xd82e('0x58')],'raw':!![],'transaction':_0xbce4be});})[_0xd82e('0x42')](function(_0x47e3e4){var _0x5aa19a=_['map'](_0x47e3e4,function(_0xcabe5c){return Number(_0xcabe5c[_0xd82e('0x60')]);});return db[_0xd82e('0x61')][_0xd82e('0x62')]({'where':{'UserId':{'$in':_0x2325f9},'SmsQueueId':{'$in':_0x5aa19a}},'transaction':_0xbce4be});})[_0xd82e('0x42')](function(){var _0x3fda2e='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5c31b9;return db['sequelize'][_0xd82e('0x32')](_0x3fda2e,{'type':db[_0xd82e('0x56')][_0xd82e('0x57')][_0xd82e('0x58')],'raw':!![],'transaction':_0xbce4be});})[_0xd82e('0x42')](function(_0x425e65){var _0x127ade=_[_0xd82e('0x2e')](_0x425e65,function(_0x1646c8){return Number(_0x1646c8[_0xd82e('0x63')]);});return db['UserChatQueue'][_0xd82e('0x62')]({'where':{'UserId':{'$in':_0x2325f9},'ChatQueueId':{'$in':_0x127ade}},'transaction':_0xbce4be});})[_0xd82e('0x42')](function(){var _0x273f46=_0xd82e('0x64')+_0x5c31b9;return db[_0xd82e('0x55')][_0xd82e('0x32')](_0x273f46,{'type':db[_0xd82e('0x56')][_0xd82e('0x57')]['SELECT'],'raw':!![],'transaction':_0xbce4be});})[_0xd82e('0x42')](function(_0x26a6da){var _0x461c02=_[_0xd82e('0x2e')](_0x26a6da,function(_0x1be409){return Number(_0x1be409[_0xd82e('0x65')]);});return db['UserFaxQueue'][_0xd82e('0x62')]({'where':{'UserId':{'$in':_0x2325f9},'FaxQueueId':{'$in':_0x461c02}},'transaction':_0xbce4be});})[_0xd82e('0x42')](function(){var _0x5273c9=_0xd82e('0x66')+_0x5c31b9;return db[_0xd82e('0x55')][_0xd82e('0x32')](_0x5273c9,{'type':db['Sequelize'][_0xd82e('0x57')][_0xd82e('0x58')],'raw':!![],'transaction':_0xbce4be});})[_0xd82e('0x42')](function(_0xa2018d){var _0x13f193=_[_0xd82e('0x2e')](_0xa2018d,function(_0x12aa2f){return Number(_0x12aa2f[_0xd82e('0x67')]);});return db[_0xd82e('0x68')]['destroy']({'where':{'UserId':{'$in':_0x2325f9},'OpenchannelQueueId':{'$in':_0x13f193}},'transaction':_0xbce4be});})[_0xd82e('0x42')](function(){var _0x1ea20c=_0xd82e('0x69')+_0x5c31b9;return db[_0xd82e('0x55')][_0xd82e('0x32')](_0x1ea20c,{'type':db[_0xd82e('0x56')][_0xd82e('0x57')][_0xd82e('0x58')],'raw':!![],'transaction':_0xbce4be});})[_0xd82e('0x42')](function(_0x54a310){var _0x3d97f5=_[_0xd82e('0x2e')](_0x54a310,function(_0x7e772f){return Number(_0x7e772f[_0xd82e('0x6a')]);});return db[_0xd82e('0x6b')][_0xd82e('0x62')]({'where':{'UserId':{'$in':_0x2325f9},'WhatsappQueueId':{'$in':_0x3d97f5}},'transaction':_0xbce4be});})['then'](function(){return db[_0xd82e('0x6c')][_0xd82e('0x49')]({'where':{'TeamId':_0x5c31b9}});})[_0xd82e('0x42')](function(_0x448db5){if(_0x448db5===null){return;}return db[_0xd82e('0x6d')][_0xd82e('0x62')]({'where':{'UserId':{'$in':_0x2325f9},'VoicePrefixId':_0x448db5[_0xd82e('0x6e')]},'transaction':_0xbce4be});})[_0xd82e('0x42')](function(){return db['Team']['destroy']({'where':{'id':_0x5c31b9},'cascade':!![],'transaction':_0xbce4be});})[_0xd82e('0x42')](function(_0x54b6ad){if(_0x54b6ad===0x0){_0x3ef95f[_0xd82e('0x29')](0x194);}else{return db[_0xd82e('0x51')][_0xd82e('0x62')]({'where':{'type':'Teams','resourceId':_0x5c31b9},'cascade':!![],'transaction':_0xbce4be})[_0xd82e('0x42')](function(){_0x3ef95f[_0xd82e('0x1e')](0xcc)[_0xd82e('0x1f')]();});}})[_0xd82e('0x45')](function(_0x523aef){_0x3ef95f['status'](0x1f4)['send'](_0x523aef);});});};exports[_0xd82e('0x6f')]=function(_0x1fc74c,_0x4ed3fa,_0x10bae6){return db[_0xd82e('0x2f')][_0xd82e('0x70')]({'where':{'id':_0x1fc74c['params']['id']}})[_0xd82e('0x42')](handleEntityNotFound(_0x4ed3fa,null))[_0xd82e('0x42')](function(_0x57ce52){if(!_0x1fc74c[_0xd82e('0x32')][_0xd82e('0x71')]||!utils[_0xd82e('0x72')](_0x1fc74c[_0xd82e('0x32')][_0xd82e('0x71')])){throw new db[(_0xd82e('0x56'))][(_0xd82e('0x73'))](_0xd82e('0x74'));}var _0x4f92c5={};var _0x2175d4={};_0x2175d4[_0xd82e('0x35')]=_[_0xd82e('0x33')](db[_[_0xd82e('0x75')](_0x1fc74c['query'][_0xd82e('0x71')][_0xd82e('0x76')]())+_0xd82e('0x77')][_0xd82e('0x30')]);_0x2175d4[_0xd82e('0x32')]=_['keys'](_0x1fc74c['query']);_0x2175d4[_0xd82e('0x34')]=_[_0xd82e('0x37')](_0x2175d4['model'],_0x2175d4[_0xd82e('0x32')]);_0x4f92c5[_0xd82e('0x36')]=_[_0xd82e('0x37')](_0x2175d4[_0xd82e('0x35')],qs[_0xd82e('0x38')](_0x1fc74c['query'][_0xd82e('0x38')]));_0x4f92c5[_0xd82e('0x36')]=_0x4f92c5['attributes'][_0xd82e('0x39')]?_0x4f92c5[_0xd82e('0x36')]:_0x2175d4[_0xd82e('0x35')];_0x4f92c5[_0xd82e('0x22')]=qs[_0xd82e('0x22')](_0x1fc74c[_0xd82e('0x32')]['limit']);_0x4f92c5[_0xd82e('0x20')]=qs['offset'](_0x1fc74c[_0xd82e('0x32')][_0xd82e('0x20')]);_0x4f92c5[_0xd82e('0x78')]=qs[_0xd82e('0x3b')](_0x1fc74c[_0xd82e('0x32')][_0xd82e('0x3b')]);_0x4f92c5[_0xd82e('0x3c')]=qs[_0xd82e('0x34')](_[_0xd82e('0x3d')](_0x1fc74c[_0xd82e('0x32')],_0x2175d4[_0xd82e('0x34')]));_0x4f92c5=_[_0xd82e('0x40')]({},_0x4f92c5,_0x1fc74c[_0xd82e('0x41')]);return _0x57ce52[_0xd82e('0x4c')+_[_0xd82e('0x75')](_0x1fc74c[_0xd82e('0x32')][_0xd82e('0x71')]['toLowerCase']())+'Queues'](_0x4f92c5);})[_0xd82e('0x42')](respondWithResult(_0x4ed3fa,null))[_0xd82e('0x45')](handleError(_0x4ed3fa,null));};exports['addQueues']=function(_0x46df36,_0x476ca7,_0x1b6c7d){return db[_0xd82e('0x2f')][_0xd82e('0x70')]({'where':{'id':_0x46df36[_0xd82e('0x47')]['id']}})[_0xd82e('0x42')](function(_0x2ed9eb){if(_0x2ed9eb){if(!_0x46df36['body'][_0xd82e('0x71')]||!utils[_0xd82e('0x72')](_0x46df36[_0xd82e('0x4b')][_0xd82e('0x71')])){throw new db[(_0xd82e('0x56'))][(_0xd82e('0x73'))](_0xd82e('0x74'));}return _0x2ed9eb[_0xd82e('0x79')+_['capitalize'](_0x46df36[_0xd82e('0x4b')]['channel'][_0xd82e('0x76')]())+_0xd82e('0x7a')](_0x46df36[_0xd82e('0x4b')][_0xd82e('0x7b')]);}return null;})[_0xd82e('0x42')](handleEntityNotFound(_0x476ca7,null))[_0xd82e('0x42')](respondWithStatusCode(_0x476ca7,null))[_0xd82e('0x45')](handleError(_0x476ca7,null));};exports[_0xd82e('0x7c')]=function(_0x3a9d0e,_0x392a7c,_0x4b6a05){return db['Team'][_0xd82e('0x70')]({'where':{'id':_0x3a9d0e[_0xd82e('0x47')]['id']}})[_0xd82e('0x42')](function(_0x1e2ed8){if(_0x1e2ed8){if(!_0x3a9d0e[_0xd82e('0x32')][_0xd82e('0x71')]||!utils[_0xd82e('0x72')](_0x3a9d0e['query'][_0xd82e('0x71')])){throw new db[(_0xd82e('0x56'))][(_0xd82e('0x73'))](_0xd82e('0x74'));}return _0x1e2ed8[_0xd82e('0x7d')+_[_0xd82e('0x75')](_0x3a9d0e['query']['channel'][_0xd82e('0x76')]())+_0xd82e('0x7a')](_0x3a9d0e[_0xd82e('0x32')]['ids']);}return null;})['then'](handleEntityNotFound(_0x392a7c,null))[_0xd82e('0x42')](respondWithStatusCode(_0x392a7c,null))[_0xd82e('0x45')](handleError(_0x392a7c,null));};exports[_0xd82e('0x7e')]=function(_0x303638,_0x42f11a){var _0xa78e02=_['isArray'](_0x303638[_0xd82e('0x4b')][_0xd82e('0x7b')])?_0x303638[_0xd82e('0x4b')][_0xd82e('0x7b')]:[_0x303638[_0xd82e('0x4b')][_0xd82e('0x7b')]];var _0x28e934=_0x303638[_0xd82e('0x47')]['id'];return db[_0xd82e('0x2f')]['find']({'where':{'id':_0x28e934}})[_0xd82e('0x42')](handleEntityNotFound(_0x42f11a,null))[_0xd82e('0x42')](function(_0x3aa79b){if(_0x3aa79b){var _0x4f9bc6=[_0xd82e('0x7f'),_0xd82e('0x80'),_0xd82e('0x81'),_0xd82e('0x82'),'Fax',_0xd82e('0x83'),_0xd82e('0x84')];return db[_0xd82e('0x55')][_0xd82e('0x53')](function(_0x1168c4){var _0xf9acd6=_['map'](_0x4f9bc6,function(_0x4f0b1e){var _0x9acd4c={'attributes':['id','name']};if(_0x4f0b1e==='Voice'){_0x9acd4c[_0xd82e('0x85')]={'attributes':[_0xd82e('0x86')]};}return _0x3aa79b[_0xd82e('0x4c')+_0x4f0b1e+_0xd82e('0x7a')](_0x9acd4c)[_0xd82e('0x42')](function(_0x5e7383){var _0x3989ae=_[_0xd82e('0x2e')](_0x5e7383,function(_0xd065f3){var _0x25f4db=_[_0xd82e('0x2e')](_0xa78e02,function(_0x11dcf7){var _0x9b782b={'where':{'UserId':_0x11dcf7,[_0x4f0b1e+_0xd82e('0x87')]:_0xd065f3['id']},'transaction':_0x1168c4};if(_0x4f0b1e===_0xd82e('0x7f')){_0x9b782b[_0xd82e('0x88')]={'penalty':_0xd065f3['TeamVoiceQueue'][_0xd82e('0x86')]};}return db[_0xd82e('0x89')+_0x4f0b1e+_0xd82e('0x77')][_0xd82e('0x8a')](_0x9b782b)['then'](function(){socket[_0xd82e('0x8b')]('user'+_0x4f0b1e+'Queue:save',{'UserId':_0x11dcf7,[_0x4f0b1e+_0xd82e('0x87')]:_0xd065f3['id']});if(_0x4f0b1e!==_0xd82e('0x7f')){return;}return db['User']['findAll']({'where':{'id':_0xa78e02,'online':0x1},'attributes':['id',_0xd82e('0x2b'),_0xd82e('0x8c'),_0xd82e('0x8d'),_0xd82e('0x8e')],'raw':!![]})['then'](function(_0x4be0eb){var _0x49a48b=_['map'](_0x4be0eb,function(_0x34f0db){return db[_0xd82e('0x8f')][_0xd82e('0x90')]({'membername':_0x34f0db[_0xd82e('0x2b')],'UserId':_0x34f0db['id'],'queue_name':_0xd065f3[_0xd82e('0x2b')],'VoiceQueueId':_0xd065f3['id'],'interface':_[_0xd82e('0x91')](_0x34f0db[_0xd82e('0x8e')])?util[_0xd82e('0x92')](_0xd82e('0x93'),_0x34f0db[_0xd82e('0x2b')]):_0x34f0db['interface'],'paused':_0x34f0db[_0xd82e('0x8d')]||![],'penalty':_0xd065f3[_0xd82e('0x94')]['penalty']},{'transaction':_0x1168c4});});return Promise[_0xd82e('0x95')](_0x49a48b);});});});return Promise[_0xd82e('0x95')](_0x25f4db);});return Promise[_0xd82e('0x95')](_0x3989ae);})[_0xd82e('0x42')](function(){return db[_0xd82e('0x6c')]['findOne']({'where':{'teamId':_0x28e934}})[_0xd82e('0x42')](function(_0x590cb9){if(_0x590cb9){var _0x3a431a=_[_0xd82e('0x2e')](_0xa78e02,function(_0x5b3363){db['UserVoicePrefix'][_0xd82e('0x90')]({'UserId':_0x5b3363,'VoicePrefixId':_0x590cb9[_0xd82e('0x6e')]});});return Promise['all'](_0x3a431a);}});});});return Promise[_0xd82e('0x95')](_0xf9acd6)[_0xd82e('0x42')](function(){return _0x3aa79b[_0xd82e('0x7e')](_0xa78e02,{'transaction':_0x1168c4})[_0xd82e('0x96')](function(_0x6470d0){return _0x6470d0;});});});}})[_0xd82e('0x42')](respondWithResult(_0x42f11a,null))[_0xd82e('0x45')](handleError(_0x42f11a,null));};exports[_0xd82e('0x97')]=function(_0x3760a9,_0x20bfdb){var _0x2da623=_[_0xd82e('0x98')](_0x3760a9['query'][_0xd82e('0x7b')])?_0x3760a9['query'][_0xd82e('0x7b')]:[_0x3760a9[_0xd82e('0x32')][_0xd82e('0x7b')]];var _0x7b23ff=_0x3760a9[_0xd82e('0x47')]['id'];return db[_0xd82e('0x2f')][_0xd82e('0x49')]({'where':{'id':_0x7b23ff}})[_0xd82e('0x42')](handleEntityNotFound(_0x20bfdb,null))['then'](function(_0x5d0d41){if(_0x5d0d41){var _0x558b28=[_0xd82e('0x7f'),_0xd82e('0x80'),_0xd82e('0x81'),_0xd82e('0x82'),'Fax',_0xd82e('0x83'),_0xd82e('0x84')];return db['sequelize']['transaction'](function(_0x51ea29){var _0x15362c=_[_0xd82e('0x2e')](_0x558b28,function(_0xbd48cd){var _0x39cab4={'attributes':['id',_0xd82e('0x2b')]};return _0x5d0d41['get'+_0xbd48cd+_0xd82e('0x7a')](_0x39cab4)[_0xd82e('0x42')](function(_0x7903aa){var _0xfd0dc1=_[_0xd82e('0x2e')](_0x7903aa,function(_0x21297e){return _0x21297e[_0xd82e('0x97')](_0x2da623,{'transaction':_0x51ea29})[_0xd82e('0x42')](function(){var _0xd6ccc7=_[_0xd82e('0x2e')](_0x2da623,function(_0x23f425){socket[_0xd82e('0x8b')]('user'+_0xbd48cd+_0xd82e('0x99'),{'UserId':Number(_0x23f425),[_0xbd48cd+_0xd82e('0x87')]:_0x21297e['id']});if(_0xbd48cd!=='Voice'){return;}return db[_0xd82e('0x8f')][_0xd82e('0x62')]({'where':{'VoiceQueueId':_0x21297e['id'],'UserId':_0x23f425},'transaction':_0x51ea29});});return Promise[_0xd82e('0x95')](_0xd6ccc7);});});return Promise[_0xd82e('0x95')](_0xfd0dc1);});});return Promise[_0xd82e('0x95')](_0x15362c)['then'](function(){return _0x5d0d41[_0xd82e('0x97')](_0x2da623,{'transaction':_0x51ea29});})[_0xd82e('0x42')](function(){return db[_0xd82e('0x6c')][_0xd82e('0x70')]({'where':{'teamId':_0x7b23ff}})[_0xd82e('0x42')](function(_0x4c370a){if(_0x4c370a){var _0xb5e764=_[_0xd82e('0x2e')](_0x2da623,function(_0x38b165){db[_0xd82e('0x6d')][_0xd82e('0x62')]({'where':{'UserId':_0x38b165,'VoicePrefixId':_0x4c370a[_0xd82e('0x6e')]}});});return Promise[_0xd82e('0x95')](_0xb5e764);}});});});}})[_0xd82e('0x42')](respondWithStatusCode(_0x20bfdb,null))['catch'](handleError(_0x20bfdb,null));};exports['getAgents']=function(_0x1abf31,_0x1e054e,_0x5a91ff){var _0x463c73={};var _0x819c07={};var _0x56a9ae;var _0x277a98;return db[_0xd82e('0x2f')][_0xd82e('0x70')]({'where':{'id':_0x1abf31['params']['id']}})[_0xd82e('0x42')](handleEntityNotFound(_0x1e054e,null))[_0xd82e('0x42')](function(_0x1ae1a6){if(_0x1ae1a6){_0x56a9ae=_0x1ae1a6;_0x819c07[_0xd82e('0x35')]=_['keys'](db[_0xd82e('0x89')]['rawAttributes']);_0x819c07['query']=_[_0xd82e('0x33')](_0x1abf31['query']);_0x819c07['filters']=_[_0xd82e('0x37')](_0x819c07[_0xd82e('0x35')],_0x819c07[_0xd82e('0x32')]);_0x463c73[_0xd82e('0x36')]=_[_0xd82e('0x37')](_0x819c07[_0xd82e('0x35')],qs['fields'](_0x1abf31['query'][_0xd82e('0x38')]));_0x463c73['attributes']=_0x463c73[_0xd82e('0x36')][_0xd82e('0x39')]?_0x463c73['attributes']:_0x819c07['model'];_0x463c73[_0xd82e('0x78')]=qs[_0xd82e('0x3b')](_0x1abf31[_0xd82e('0x32')][_0xd82e('0x3b')]);_0x463c73[_0xd82e('0x3c')]=qs[_0xd82e('0x34')](_[_0xd82e('0x3d')](_0x1abf31[_0xd82e('0x32')],_0x819c07[_0xd82e('0x34')]));if(_0x1abf31[_0xd82e('0x32')][_0xd82e('0x3f')]){_0x463c73[_0xd82e('0x3c')]=_[_0xd82e('0x40')](_0x463c73[_0xd82e('0x3c')],{'$or':_['map'](_0x463c73[_0xd82e('0x36')],function(_0x2c8c29){var _0xf1d513={};_0xf1d513[_0x2c8c29]={'$like':'%'+_0x1abf31[_0xd82e('0x32')]['filter']+'%'};return _0xf1d513;})});}_0x463c73=_['merge']({},_0x463c73,_0x1abf31[_0xd82e('0x41')]);return _0x56a9ae[_0xd82e('0x9a')](_0x463c73);}})[_0xd82e('0x42')](function(_0x3b4c8c){if(_0x3b4c8c){_0x277a98=_0x3b4c8c[_0xd82e('0x39')];if(!_0x1abf31['query'][_0xd82e('0x3a')](_0xd82e('0x9b'))){_0x463c73[_0xd82e('0x22')]=qs[_0xd82e('0x22')](_0x1abf31[_0xd82e('0x32')][_0xd82e('0x22')]);_0x463c73[_0xd82e('0x20')]=qs[_0xd82e('0x20')](_0x1abf31['query']['offset']);}return _0x56a9ae['getAgents'](_0x463c73);}})['then'](function(_0x27c46c){if(_0x27c46c){return _0x27c46c?{'count':_0x277a98,'rows':_0x27c46c}:null;}})[_0xd82e('0x42')](respondWithResult(_0x1e054e,null))[_0xd82e('0x45')](handleError(_0x1e054e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index fb8e6ca..b2517a0 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 _0xd61a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x3b17ac,_0x2232bc){var _0x16cacc=function(_0x4ba380){while(--_0x4ba380){_0x3b17ac['push'](_0x3b17ac['shift']());}};_0x16cacc(++_0x2232bc);}(_0xd61a,0x1eb));var _0xad61=function(_0x24c14e,_0x55fc09){_0x24c14e=_0x24c14e-0x0;var _0x589035=_0xd61a[_0x24c14e];return _0x589035;};'use strict';var EventEmitter=require(_0xad61('0x0'));var Team=require(_0xad61('0x1'))['db'][_0xad61('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xad61('0x3')](0x0);var events={'afterCreate':_0xad61('0x4'),'afterUpdate':_0xad61('0x5'),'afterDestroy':_0xad61('0x6')};function emitEvent(_0x8fba69){return function(_0x282a04,_0x429a26,_0xb3aeb0){TeamEvents[_0xad61('0x7')](_0x8fba69+':'+_0x282a04['id'],_0x282a04);TeamEvents[_0xad61('0x7')](_0x8fba69,_0x282a04);_0xb3aeb0(null);};}for(var e in events){if(events[_0xad61('0x8')](e)){var event=events[e];Team[_0xad61('0x9')](e,emitEvent(event));}}module[_0xad61('0xa')]=TeamEvents; \ No newline at end of file +var _0x7623=['Team','setMaxListeners','save','update','remove','emit','exports','../../mysqldb'];(function(_0x250071,_0x301941){var _0x34e574=function(_0x567186){while(--_0x567186){_0x250071['push'](_0x250071['shift']());}};_0x34e574(++_0x301941);}(_0x7623,0x17f));var _0x3762=function(_0x3bb21a,_0x353b56){_0x3bb21a=_0x3bb21a-0x0;var _0x5f3983=_0x7623[_0x3bb21a];return _0x5f3983;};'use strict';var EventEmitter=require('events');var Team=require(_0x3762('0x0'))['db'][_0x3762('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x3762('0x2')](0x0);var events={'afterCreate':_0x3762('0x3'),'afterUpdate':_0x3762('0x4'),'afterDestroy':_0x3762('0x5')};function emitEvent(_0x47850a){return function(_0x41a5e4,_0x5bb540,_0x472cdc){TeamEvents['emit'](_0x47850a+':'+_0x41a5e4['id'],_0x41a5e4);TeamEvents[_0x3762('0x6')](_0x47850a,_0x41a5e4);_0x472cdc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x3762('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 598ac75..a9d9788 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 _0xe68b=['map','setDataValue','channel','catch','exports','Team','teams','Fax','Voice','Whatsapp','then','all','./team.attributes','get','Queues'];(function(_0x24f107,_0x3c6c88){var _0x5116ab=function(_0x2b4985){while(--_0x2b4985){_0x24f107['push'](_0x24f107['shift']());}};_0x5116ab(++_0x3c6c88);}(_0xe68b,0x165));var _0xbe68=function(_0x30bc1f,_0xaa2a4a){_0x30bc1f=_0x30bc1f-0x0;var _0x176de3=_0xe68b[_0x30bc1f];return _0x176de3;};'use strict';var _=require('lodash');var attributes=require(_0xbe68('0x0'));function getQueuesByChannel(_0x3fd072,_0x5d4c93){var _0x2c54ba=_0xbe68('0x1')+_0x5d4c93+_0xbe68('0x2');return _0x3fd072[_0x2c54ba]()['then'](function(_0x4c928f){return _[_0xbe68('0x3')](_0x4c928f,function(_0x2fcea8){_0x2fcea8[_0xbe68('0x4')](_0xbe68('0x5'),_0x5d4c93);return _0x2fcea8;});})[_0xbe68('0x6')](function(_0x3c9a5f){throw _0x3c9a5f;});}module[_0xbe68('0x7')]=function(_0x39df4d){return _0x39df4d['define'](_0xbe68('0x8'),attributes,{'tableName':_0xbe68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1a8d8b=this;var _0xa0b006=['Chat',_0xbe68('0xa'),'Mail','Openchannel','Sms',_0xbe68('0xb'),_0xbe68('0xc')];return Promise['resolve']()[_0xbe68('0xd')](function(){var _0x195caf=_[_0xbe68('0x3')](_0xa0b006,function(_0x272c3a){return getQueuesByChannel(_0x1a8d8b,_0x272c3a);});return Promise[_0xbe68('0xe')](_0x195caf);})['catch'](function(_0x16f738){throw _0x16f738;});}}});}; \ No newline at end of file +var _0xf88b=['catch','get','Queues','then','map','setDataValue','define','Team','teams','Chat','Mail','Openchannel','Sms','Voice','all'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0xf88b,0xd3));var _0xbf88=function(_0x182d40,_0x3426c0){_0x182d40=_0x182d40-0x0;var _0x1fbcd1=_0xf88b[_0x182d40];return _0x1fbcd1;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0xabf424,_0x1b2ee2){var _0x43c09d=_0xbf88('0x0')+_0x1b2ee2+_0xbf88('0x1');return _0xabf424[_0x43c09d]()[_0xbf88('0x2')](function(_0x4cdf81){return _[_0xbf88('0x3')](_0x4cdf81,function(_0x1c246c){_0x1c246c[_0xbf88('0x4')]('channel',_0x1b2ee2);return _0x1c246c;});})['catch'](function(_0x5024f8){throw _0x5024f8;});}module['exports']=function(_0x4e7a4b){return _0x4e7a4b[_0xbf88('0x5')](_0xbf88('0x6'),attributes,{'tableName':_0xbf88('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x26908f=this;var _0x4441b3=[_0xbf88('0x8'),'Fax',_0xbf88('0x9'),_0xbf88('0xa'),_0xbf88('0xb'),_0xbf88('0xc'),'Whatsapp'];return Promise['resolve']()[_0xbf88('0x2')](function(){var _0x59e139=_[_0xbf88('0x3')](_0x4441b3,function(_0x18713c){return getQueuesByChannel(_0x26908f,_0x18713c);});return Promise[_0xbf88('0xd')](_0x59e139);})[_0xbf88('0xe')](function(_0x275346){throw _0x275346;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d57c4f5..1a61515 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 _0xa95d=['lodash','util','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x2b8ebe,_0x4d4c78){var _0x536480=function(_0x3379fb){while(--_0x3379fb){_0x2b8ebe['push'](_0x2b8ebe['shift']());}};_0x536480(++_0x4d4c78);}(_0xa95d,0xb8));var _0xda95=function(_0x4d1ce8,_0x1a778e){_0x4d1ce8=_0x4d1ce8-0x0;var _0x129384=_0xa95d[_0x4d1ce8];return _0x129384;};'use strict';var _=require(_0xda95('0x0'));var util=require(_0xda95('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xda95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xda95('0x3'));var logger=require(_0xda95('0x4'))(_0xda95('0x5'));var config=require('../../config/environment');var jayson=require(_0xda95('0x6'));var client=jayson[_0xda95('0x7')][_0xda95('0x8')]({'port':0x232a});config[_0xda95('0x9')]=_['defaults'](config['redis'],{'host':_0xda95('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda95('0x9')]));require(_0xda95('0xb'))[_0xda95('0xc')](socket);function respondWithRpcPromise(_0x51743f,_0x14aa74,_0x1667b1){return new BPromise(function(_0x1f9444,_0x13108a){return client[_0xda95('0xd')](_0x51743f,_0x1667b1)[_0xda95('0xe')](function(_0x30bc5e){logger['info'](_0xda95('0xf'),_0x14aa74,_0xda95('0x10'));logger[_0xda95('0x11')](_0xda95('0x12'),_0x14aa74,'request\x20sent',JSON['stringify'](_0x30bc5e));if(_0x30bc5e[_0xda95('0x13')]){if(_0x30bc5e[_0xda95('0x13')][_0xda95('0x14')]===0x1f4){logger[_0xda95('0x13')](_0xda95('0xf'),_0x14aa74,_0x30bc5e[_0xda95('0x13')][_0xda95('0x15')]);return _0x13108a(_0x30bc5e[_0xda95('0x13')][_0xda95('0x15')]);}logger['error']('Team,\x20%s,\x20%s',_0x14aa74,_0x30bc5e[_0xda95('0x13')][_0xda95('0x15')]);return _0x1f9444(_0x30bc5e[_0xda95('0x13')][_0xda95('0x15')]);}else{logger[_0xda95('0x16')]('Team,\x20%s,\x20%s',_0x14aa74,_0xda95('0x10'));_0x1f9444(_0x30bc5e['result'][_0xda95('0x15')]);}})['catch'](function(_0x485923){logger[_0xda95('0x13')](_0xda95('0xf'),_0x14aa74,_0x485923);_0x13108a(_0x485923);});});} \ No newline at end of file +var _0xdb29=['request','then','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','Team,\x20%s,\x20%s','message','error','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x3bcf04,_0x35aae7){var _0x4fdc23=function(_0x2f7806){while(--_0x2f7806){_0x3bcf04['push'](_0x3bcf04['shift']());}};_0x4fdc23(++_0x35aae7);}(_0xdb29,0x73));var _0x9db2=function(_0x218dc0,_0x246a3a){_0x218dc0=_0x218dc0-0x0;var _0x344c66=_0xdb29[_0x218dc0];return _0x344c66;};'use strict';var _=require(_0x9db2('0x0'));var util=require(_0x9db2('0x1'));var moment=require('moment');var BPromise=require(_0x9db2('0x2'));var rs=require(_0x9db2('0x3'));var fs=require('fs');var Redis=require(_0x9db2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9db2('0x5'));var logger=require(_0x9db2('0x6'))(_0x9db2('0x7'));var config=require('../../config/environment');var jayson=require(_0x9db2('0x8'));var client=jayson[_0x9db2('0x9')][_0x9db2('0xa')]({'port':0x232a});config[_0x9db2('0xb')]=_['defaults'](config[_0x9db2('0xb')],{'host':_0x9db2('0xc'),'port':0x18eb});var socket=require(_0x9db2('0xd'))(new Redis(config['redis']));require('./team.socket')[_0x9db2('0xe')](socket);function respondWithRpcPromise(_0x55bc94,_0x369beb,_0x2ed9dc){return new BPromise(function(_0x4e2b67,_0xf231ba){return client[_0x9db2('0xf')](_0x55bc94,_0x2ed9dc)[_0x9db2('0x10')](function(_0x4ce7ea){logger['info']('Team,\x20%s,\x20%s',_0x369beb,'request\x20sent');logger[_0x9db2('0x11')](_0x9db2('0x12'),_0x369beb,_0x9db2('0x13'),JSON[_0x9db2('0x14')](_0x4ce7ea));if(_0x4ce7ea['error']){if(_0x4ce7ea['error']['code']===0x1f4){logger['error'](_0x9db2('0x15'),_0x369beb,_0x4ce7ea['error'][_0x9db2('0x16')]);return _0xf231ba(_0x4ce7ea[_0x9db2('0x17')]['message']);}logger['error'](_0x9db2('0x15'),_0x369beb,_0x4ce7ea[_0x9db2('0x17')]['message']);return _0x4e2b67(_0x4ce7ea[_0x9db2('0x17')][_0x9db2('0x16')]);}else{logger[_0x9db2('0x18')](_0x9db2('0x15'),_0x369beb,_0x9db2('0x13'));_0x4e2b67(_0x4ce7ea[_0x9db2('0x19')][_0x9db2('0x16')]);}})['catch'](function(_0x45c4ab){logger[_0x9db2('0x17')]('Team,\x20%s,\x20%s',_0x369beb,_0x45c4ab);_0xf231ba(_0x45c4ab);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4066a4d..0177008 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 _0x70f9=['removeListener','register','length','team:','remove','update'];(function(_0x51401d,_0x3f6d69){var _0x5651a9=function(_0xd35984){while(--_0xd35984){_0x51401d['push'](_0x51401d['shift']());}};_0x5651a9(++_0x3f6d69);}(_0x70f9,0x14e));var _0x970f=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x70f9[_0x710815];return _0x5b3b89;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x970f('0x0'),_0x970f('0x1')];function createListener(_0x36648e,_0x5339cd){return function(_0xaf70c9){_0x5339cd['emit'](_0x36648e,_0xaf70c9);};}function removeListener(_0x3265ad,_0x5a3196){return function(){TeamEvents[_0x970f('0x2')](_0x3265ad,_0x5a3196);};}exports[_0x970f('0x3')]=function(_0x27d07a){for(var _0x570d56=0x0,_0x1ba95f=events[_0x970f('0x4')];_0x570d56<_0x1ba95f;_0x570d56++){var _0x23a131=events[_0x570d56];var _0x39c068=createListener(_0x970f('0x5')+_0x23a131,_0x27d07a);TeamEvents['on'](_0x23a131,_0x39c068);}}; \ No newline at end of file +var _0xdafb=['team:','./team.events','save','remove','update','emit','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdafb,0x1a9));var _0xbdaf=function(_0x5ca5f2,_0x5e1b01){_0x5ca5f2=_0x5ca5f2-0x0;var _0x233f90=_0xdafb[_0x5ca5f2];return _0x233f90;};'use strict';var TeamEvents=require(_0xbdaf('0x0'));var events=[_0xbdaf('0x1'),_0xbdaf('0x2'),_0xbdaf('0x3')];function createListener(_0x166175,_0x46bcad){return function(_0x13946b){_0x46bcad[_0xbdaf('0x4')](_0x166175,_0x13946b);};}function removeListener(_0x5a53e0,_0x5416ef){return function(){TeamEvents['removeListener'](_0x5a53e0,_0x5416ef);};}exports[_0xbdaf('0x5')]=function(_0x3d1367){for(var _0x52ecad=0x0,_0x43f837=events[_0xbdaf('0x6')];_0x52ecad<_0x43f837;_0x52ecad++){var _0x171a1b=events[_0x52ecad];var _0xa70bb6=createListener(_0xbdaf('0x7')+_0x171a1b,_0x3d1367);TeamEvents['on'](_0x171a1b,_0xa70bb6);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 7a0e029..cc003de 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 _0x4fef=['INTEGER','sequelize','exports'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x4fef,0x10f));var _0xf4fe=function(_0x4a6a53,_0x1c68bd){_0x4a6a53=_0x4a6a53-0x0;var _0x28beee=_0x4fef[_0x4a6a53];return _0x28beee;};'use strict';var Sequelize=require(_0xf4fe('0x0'));module[_0xf4fe('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xf4fe('0x2')]}}; \ No newline at end of file +var _0x1491=['INTEGER','sequelize','exports'];(function(_0x61f017,_0x7c5068){var _0x3ecd1e=function(_0x3e2f78){while(--_0x3e2f78){_0x61f017['push'](_0x61f017['shift']());}};_0x3ecd1e(++_0x7c5068);}(_0x1491,0x1b1));var _0x1149=function(_0x30986c,_0x39ce58){_0x30986c=_0x30986c-0x0;var _0x57c209=_0x1491[_0x30986c];return _0x57c209;};'use strict';var Sequelize=require(_0x1149('0x0'));module[_0x1149('0x1')]={'TeamId':{'type':Sequelize[_0x1149('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1149('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index d5fb80a..6934214 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 _0xb09d=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x2d4290,_0x39514c){var _0x3d6902=function(_0x45c399){while(--_0x45c399){_0x2d4290['push'](_0x2d4290['shift']());}};_0x3d6902(++_0x39514c);}(_0xb09d,0xed));var _0xdb09=function(_0x1a2908,_0x44db3a){_0x1a2908=_0x1a2908-0x0;var _0x4ed05c=_0xb09d[_0x1a2908];return _0x4ed05c;};'use strict';var _=require(_0xdb09('0x0'));var util=require(_0xdb09('0x1'));var logger=require(_0xdb09('0x2'))(_0xdb09('0x3'));var moment=require(_0xdb09('0x4'));var BPromise=require(_0xdb09('0x5'));var rp=require(_0xdb09('0x6'));var fs=require('fs');var path=require(_0xdb09('0x7'));var rimraf=require('rimraf');var config=require(_0xdb09('0x8'));var attributes=require(_0xdb09('0x9'));module[_0xdb09('0xa')]=function(_0xd2e98f,_0x181d74){return _0xd2e98f[_0xdb09('0xb')](_0xdb09('0xc'),attributes,{'tableName':_0xdb09('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0dd=['request-promise','path','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment','bluebird'];(function(_0x5c4637,_0x48f7ec){var _0x32b116=function(_0x2157e0){while(--_0x2157e0){_0x5c4637['push'](_0x5c4637['shift']());}};_0x32b116(++_0x48f7ec);}(_0xe0dd,0x163));var _0xde0d=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0xe0dd[_0x3fa296];return _0x10b19f;};'use strict';var _=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var logger=require('../../config/logger')(_0xde0d('0x2'));var moment=require(_0xde0d('0x3'));var BPromise=require(_0xde0d('0x4'));var rp=require(_0xde0d('0x5'));var fs=require('fs');var path=require(_0xde0d('0x6'));var rimraf=require(_0xde0d('0x7'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xde0d('0x8')]=function(_0x1c7bda,_0x5c58e5){return _0x1c7bda[_0xde0d('0x9')](_0xde0d('0xa'),attributes,{'tableName':_0xde0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 13b742b..7e83de9 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x235ad6,_0x5e4437){var _0x2885d9=function(_0x3e55ba){while(--_0x3e55ba){_0x235ad6['push'](_0x235ad6['shift']());}};_0x2885d9(++_0x5e4437);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x300dbb,_0xd7fd5b){var _0x1a4120=function(_0x10d5d0){while(--_0x10d5d0){_0x300dbb['push'](_0x300dbb['shift']());}};_0x1a4120(++_0xd7fd5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 0255620..18fcca7 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 _0xcd59=['INTEGER','sequelize','exports'];(function(_0x4d3cf6,_0x533fe5){var _0x1a13f9=function(_0x1bd491){while(--_0x1bd491){_0x4d3cf6['push'](_0x4d3cf6['shift']());}};_0x1a13f9(++_0x533fe5);}(_0xcd59,0x14b));var _0x9cd5=function(_0x23c651,_0x143982){_0x23c651=_0x23c651-0x0;var _0xbe7bdb=_0xcd59[_0x23c651];return _0xbe7bdb;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'penalty':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf18c=['sequelize','exports'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0xf18c,0xa8));var _0xcf18=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xf18c[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0xcf18('0x0'));module[_0xcf18('0x1')]={'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 b92c1cb..b559faa 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 _0x402f=['exports','define','TeamVoiceQueue','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x36abd4,_0x541c66){var _0x193d37=function(_0x12c8af){while(--_0x12c8af){_0x36abd4['push'](_0x36abd4['shift']());}};_0x193d37(++_0x541c66);}(_0x402f,0x6f));var _0xf402=function(_0x1910cc,_0x44014b){_0x1910cc=_0x1910cc-0x0;var _0x135b43=_0x402f[_0x1910cc];return _0x135b43;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var logger=require(_0xf402('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf402('0x2'));var rp=require(_0xf402('0x3'));var fs=require('fs');var path=require(_0xf402('0x4'));var rimraf=require('rimraf');var config=require(_0xf402('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0xf402('0x6')]=function(_0x270766,_0x3a1d11){return _0x270766[_0xf402('0x7')](_0xf402('0x8'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd13e=['bluebird','path','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x15392b,_0x3dbbc0){var _0x18fa7b=function(_0x26e00d){while(--_0x26e00d){_0x15392b['push'](_0x15392b['shift']());}};_0x18fa7b(++_0x3dbbc0);}(_0xd13e,0x193));var _0xed13=function(_0x155021,_0x3c865f){_0x155021=_0x155021-0x0;var _0x2cce15=_0xd13e[_0x155021];return _0x2cce15;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var logger=require(_0xed13('0x2'))(_0xed13('0x3'));var moment=require('moment');var BPromise=require(_0xed13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed13('0x5'));var rimraf=require('rimraf');var config=require(_0xed13('0x6'));var attributes=require(_0xed13('0x7'));module['exports']=function(_0x50de44,_0x5142bd){return _0x50de44[_0xed13('0x8')](_0xed13('0x9'),attributes,{'tableName':_0xed13('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 171aeae..8614884 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 _0xf31a=['info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','then'];(function(_0x2f2948,_0x29670e){var _0x3fec51=function(_0x43b5be){while(--_0x43b5be){_0x2f2948['push'](_0x2f2948['shift']());}};_0x3fec51(++_0x29670e);}(_0xf31a,0xaa));var _0xaf31=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xf31a[_0x1a36a5];return _0x746243;};'use strict';var _=require('lodash');var util=require(_0xaf31('0x0'));var moment=require(_0xaf31('0x1'));var BPromise=require(_0xaf31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf31('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf31('0x4'))(_0xaf31('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf31('0x6')][_0xaf31('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f2da3,_0x1ce3bf,_0xc89c79){return new BPromise(function(_0x501641,_0x1efd02){return client[_0xaf31('0x8')](_0x3f2da3,_0xc89c79)[_0xaf31('0x9')](function(_0x1949f7){logger[_0xaf31('0xa')](_0xaf31('0xb'),_0x1ce3bf,_0xaf31('0xc'));logger['debug'](_0xaf31('0xd'),_0x1ce3bf,_0xaf31('0xc'),JSON[_0xaf31('0xe')](_0x1949f7));if(_0x1949f7[_0xaf31('0xf')]){if(_0x1949f7['error'][_0xaf31('0x10')]===0x1f4){logger[_0xaf31('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1ce3bf,_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);return _0x1efd02(_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);}logger[_0xaf31('0xf')](_0xaf31('0xb'),_0x1ce3bf,_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);return _0x501641(_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);}else{logger[_0xaf31('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1ce3bf,_0xaf31('0xc'));_0x501641(_0x1949f7[_0xaf31('0x12')][_0xaf31('0x11')]);}})[_0xaf31('0x13')](function(_0x2b3e42){logger['error'](_0xaf31('0xb'),_0x1ce3bf,_0x2b3e42);_0x1efd02(_0x2b3e42);});});} \ No newline at end of file +var _0x36f4=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0x36f4,0xb3));var _0x436f=function(_0x468882,_0x1691c0){_0x468882=_0x468882-0x0;var _0x537a46=_0x36f4[_0x468882];return _0x537a46;};'use strict';var _=require('lodash');var util=require(_0x436f('0x0'));var moment=require(_0x436f('0x1'));var BPromise=require(_0x436f('0x2'));var rs=require(_0x436f('0x3'));var fs=require('fs');var Redis=require(_0x436f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x436f('0x5'))(_0x436f('0x6'));var config=require(_0x436f('0x7'));var jayson=require(_0x436f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d27a2,_0x58fae8,_0x374425){return new BPromise(function(_0x5cd749,_0xd56d48){return client[_0x436f('0x9')](_0x1d27a2,_0x374425)[_0x436f('0xa')](function(_0x3dab1c){logger[_0x436f('0xb')](_0x436f('0xc'),_0x58fae8,_0x436f('0xd'));logger[_0x436f('0xe')](_0x436f('0xf'),_0x58fae8,_0x436f('0xd'),JSON['stringify'](_0x3dab1c));if(_0x3dab1c[_0x436f('0x10')]){if(_0x3dab1c[_0x436f('0x10')][_0x436f('0x11')]===0x1f4){logger[_0x436f('0x10')](_0x436f('0xc'),_0x58fae8,_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);return _0xd56d48(_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);}logger[_0x436f('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x58fae8,_0x3dab1c['error'][_0x436f('0x12')]);return _0x5cd749(_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);}else{logger[_0x436f('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x58fae8,'request\x20sent');_0x5cd749(_0x3dab1c[_0x436f('0x13')]['message']);}})[_0x436f('0x14')](function(_0x5b55b5){logger[_0x436f('0x10')](_0x436f('0xc'),_0x58fae8,_0x5b55b5);_0xd56d48(_0x5b55b5);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 79b3bcc..49c5e70 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 _0xed20=['isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2e9341,_0x530359){var _0x2bc2e4=function(_0x5c3c35){while(--_0x5c3c35){_0x2e9341['push'](_0x2e9341['shift']());}};_0x2bc2e4(++_0x530359);}(_0xed20,0xce));var _0x0ed2=function(_0x15fc8c,_0x207742){_0x15fc8c=_0x15fc8c-0x0;var _0x205ba4=_0xed20[_0x15fc8c];return _0x205ba4;};'use strict';var multer=require(_0x0ed2('0x0'));var util=require(_0x0ed2('0x1'));var path=require(_0x0ed2('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ed2('0x3'));var router=express[_0x0ed2('0x4')]();var fs_extra=require(_0x0ed2('0x5'));var auth=require(_0x0ed2('0x6'));var interaction=require(_0x0ed2('0x7'));var config=require(_0x0ed2('0x8'));var controller=require('./template.controller');router[_0x0ed2('0x9')]('/',auth[_0x0ed2('0xa')](),controller['index']);router[_0x0ed2('0x9')](_0x0ed2('0xb'),auth[_0x0ed2('0xa')](),controller[_0x0ed2('0xc')]);router['post']('/',auth[_0x0ed2('0xa')](),controller[_0x0ed2('0xd')]);router[_0x0ed2('0xe')](_0x0ed2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0ed2('0xf')](_0x0ed2('0xb'),auth[_0x0ed2('0xa')](),controller[_0x0ed2('0x10')]);module[_0x0ed2('0x11')]=router; \ No newline at end of file +var _0xcd2f=['destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xcd2f[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfcd2('0x0'));var express=require(_0xfcd2('0x1'));var router=express[_0xfcd2('0x2')]();var fs_extra=require(_0xfcd2('0x3'));var auth=require(_0xfcd2('0x4'));var interaction=require(_0xfcd2('0x5'));var config=require(_0xfcd2('0x6'));var controller=require(_0xfcd2('0x7'));router['get']('/',auth[_0xfcd2('0x8')](),controller[_0xfcd2('0x9')]);router[_0xfcd2('0xa')](_0xfcd2('0xb'),auth[_0xfcd2('0x8')](),controller[_0xfcd2('0xc')]);router[_0xfcd2('0xd')]('/',auth[_0xfcd2('0x8')](),controller[_0xfcd2('0xe')]);router[_0xfcd2('0xf')](_0xfcd2('0xb'),auth['isAuthenticated'](),controller[_0xfcd2('0x10')]);router[_0xfcd2('0x11')](_0xfcd2('0xb'),auth[_0xfcd2('0x8')](),controller[_0xfcd2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 9734ff0..4d7a0d1 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 _0x26f9=['TEXT','sequelize','exports','STRING'];(function(_0xdc31de,_0x351c71){var _0x539a73=function(_0x5e78b1){while(--_0x5e78b1){_0xdc31de['push'](_0xdc31de['shift']());}};_0x539a73(++_0x351c71);}(_0x26f9,0x10d));var _0x926f=function(_0x59c1be,_0xba160a){_0x59c1be=_0x59c1be-0x0;var _0x47c031=_0x26f9[_0x59c1be];return _0x47c031;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'name':{'type':Sequelize[_0x926f('0x2')]},'description':{'type':Sequelize[_0x926f('0x2')]},'html':{'type':Sequelize[_0x926f('0x3')]}}; \ No newline at end of file +var _0x6d7f=['STRING','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6d7f,0xfd));var _0xf6d7=function(_0x26abbd,_0x386344){_0x26abbd=_0x26abbd-0x0;var _0x12abbb=_0x6d7f[_0x26abbd];return _0x12abbb;};'use strict';var Sequelize=require(_0xf6d7('0x0'));module[_0xf6d7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf6d7('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 5407214..698dbab 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 _0xe5ca=['status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xe5ca,0xe9));var _0xae5c=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0xe5ca[_0x5c78d9];return _0x69ae1f;};'use strict';var emlformat=require(_0xae5c('0x0'));var rimraf=require(_0xae5c('0x1'));var zipdir=require(_0xae5c('0x2'));var jsonpatch=require(_0xae5c('0x3'));var rp=require(_0xae5c('0x4'));var moment=require(_0xae5c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xae5c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xae5c('0x7'));var csv=require(_0xae5c('0x8'));var ejs=require(_0xae5c('0x9'));var fs=require('fs');var fs_extra=require(_0xae5c('0xa'));var _=require(_0xae5c('0xb'));var squel=require(_0xae5c('0xc'));var crypto=require(_0xae5c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xae5c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xae5c('0xf'));var Papa=require(_0xae5c('0x10'));var Redis=require(_0xae5c('0x11'));var authService=require(_0xae5c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xae5c('0x13'));var hardwareService=require(_0xae5c('0x14'));var logger=require(_0xae5c('0x15'))(_0xae5c('0x16'));var utils=require(_0xae5c('0x17'));var config=require(_0xae5c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xae5c('0x19'))['db'];function respondWithStatusCode(_0x3b3af3,_0x247ba8){_0x247ba8=_0x247ba8||0xcc;return function(_0x4a8a6d){if(_0x4a8a6d){return _0x3b3af3[_0xae5c('0x1a')](_0x247ba8);}return _0x3b3af3['status'](_0x247ba8)[_0xae5c('0x1b')]();};}function respondWithResult(_0x28eb4a,_0x13efb8){_0x13efb8=_0x13efb8||0xc8;return function(_0x47daa8){if(_0x47daa8){return _0x28eb4a[_0xae5c('0x1c')](_0x13efb8)[_0xae5c('0x1d')](_0x47daa8);}};}function respondWithFilteredResult(_0x41282c,_0x373b2f){return function(_0xe2a184){if(_0xe2a184){var _0x1f2bb4=typeof _0x373b2f[_0xae5c('0x1e')]===_0xae5c('0x1f')&&typeof _0x373b2f[_0xae5c('0x20')]==='undefined';var _0x176156=_0xe2a184['count'];var _0x10ac18=_0x1f2bb4?0x0:_0x373b2f[_0xae5c('0x1e')];var _0x13d1c5=_0x1f2bb4?_0xe2a184['count']:_0x373b2f[_0xae5c('0x1e')]+_0x373b2f[_0xae5c('0x20')];var _0x518039;if(_0x13d1c5>=_0x176156){_0x13d1c5=_0x176156;_0x518039=0xc8;}else{_0x518039=0xce;}_0x41282c['status'](_0x518039);return _0x41282c[_0xae5c('0x21')](_0xae5c('0x22'),_0x10ac18+'-'+_0x13d1c5+'/'+_0x176156)[_0xae5c('0x1d')](_0xe2a184);}return null;};}function patchUpdates(_0x2e96b5){return function(_0x5efb14){try{jsonpatch['apply'](_0x5efb14,_0x2e96b5,!![]);}catch(_0x8158c1){return BPromise[_0xae5c('0x23')](_0x8158c1);}return _0x5efb14[_0xae5c('0x24')]();};}function saveUpdates(_0x506728,_0x65824b){return function(_0x491cd8){if(_0x491cd8){return _0x491cd8[_0xae5c('0x25')](_0x506728)[_0xae5c('0x26')](function(_0x1fead7){return _0x1fead7;});}return null;};}function removeEntity(_0x1abaf7,_0x492161){return function(_0x5df0e6){if(_0x5df0e6){return _0x5df0e6[_0xae5c('0x27')]()[_0xae5c('0x26')](function(){var _0xffdf78=_0x5df0e6[_0xae5c('0x28')]({'plain':!![]});var _0x573d1c=_0xae5c('0x29');return db[_0xae5c('0x2a')][_0xae5c('0x27')]({'where':{'type':_0x573d1c,'resourceId':_0xffdf78['id']}})[_0xae5c('0x26')](function(){return _0x5df0e6;});})['then'](function(){_0x1abaf7[_0xae5c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f5a9,_0x3ecd8b){return function(_0x1bdb0c){if(!_0x1bdb0c){_0x50f5a9[_0xae5c('0x1a')](0x194);}return _0x1bdb0c;};}function handleError(_0x301f95,_0x2eb776){_0x2eb776=_0x2eb776||0x1f4;return function(_0x343111){logger[_0xae5c('0x2b')](_0x343111[_0xae5c('0x2c')]);if(_0x343111[_0xae5c('0x2d')]){delete _0x343111['name'];}_0x301f95[_0xae5c('0x1c')](_0x2eb776)[_0xae5c('0x2e')](_0x343111);};}exports[_0xae5c('0x2f')]=function(_0x4ce274,_0x527cb7){var _0x3905b5={},_0x291e57={},_0x126976={'count':0x0,'rows':[]};var _0xfea033=_[_0xae5c('0x30')](db[_0xae5c('0x31')][_0xae5c('0x32')],function(_0xd52567){return{'name':_0xd52567[_0xae5c('0x33')],'type':_0xd52567[_0xae5c('0x34')]['key']};});_0x291e57[_0xae5c('0x35')]=_[_0xae5c('0x30')](_0xfea033,'name');_0x291e57[_0xae5c('0x36')]=_['keys'](_0x4ce274[_0xae5c('0x36')]);_0x291e57['filters']=_[_0xae5c('0x37')](_0x291e57[_0xae5c('0x35')],_0x291e57[_0xae5c('0x36')]);_0x3905b5[_0xae5c('0x38')]=_[_0xae5c('0x37')](_0x291e57[_0xae5c('0x35')],qs['fields'](_0x4ce274[_0xae5c('0x36')][_0xae5c('0x39')]));_0x3905b5['attributes']=_0x3905b5[_0xae5c('0x38')][_0xae5c('0x3a')]?_0x3905b5[_0xae5c('0x38')]:_0x291e57[_0xae5c('0x35')];if(!_0x4ce274[_0xae5c('0x36')][_0xae5c('0x3b')](_0xae5c('0x3c'))){_0x3905b5[_0xae5c('0x20')]=qs[_0xae5c('0x20')](_0x4ce274[_0xae5c('0x36')][_0xae5c('0x20')]);_0x3905b5[_0xae5c('0x1e')]=qs[_0xae5c('0x1e')](_0x4ce274[_0xae5c('0x36')][_0xae5c('0x1e')]);}_0x3905b5[_0xae5c('0x3d')]=qs[_0xae5c('0x3e')](_0x4ce274[_0xae5c('0x36')][_0xae5c('0x3e')]);_0x3905b5[_0xae5c('0x3f')]=qs[_0xae5c('0x40')](_['pick'](_0x4ce274[_0xae5c('0x36')],_0x291e57[_0xae5c('0x40')]),_0xfea033);if(_0x4ce274[_0xae5c('0x36')][_0xae5c('0x41')]){_0x3905b5[_0xae5c('0x3f')]=_[_0xae5c('0x42')](_0x3905b5[_0xae5c('0x3f')],{'$or':_['map'](_0xfea033,function(_0x518e94){if(_0x518e94[_0xae5c('0x34')]!==_0xae5c('0x43')){var _0x7f04e3={};_0x7f04e3[_0x518e94[_0xae5c('0x2d')]]={'$like':'%'+_0x4ce274[_0xae5c('0x36')][_0xae5c('0x41')]+'%'};return _0x7f04e3;}})});}_0x3905b5=_['merge']({},_0x3905b5,_0x4ce274[_0xae5c('0x44')]);var _0x554353={'where':_0x3905b5[_0xae5c('0x3f')]};return db['Template']['count'](_0x554353)[_0xae5c('0x26')](function(_0x13b850){_0x126976[_0xae5c('0x45')]=_0x13b850;if(_0x4ce274[_0xae5c('0x36')][_0xae5c('0x46')]){_0x3905b5[_0xae5c('0x47')]=[{'all':!![]}];}return db[_0xae5c('0x31')][_0xae5c('0x48')](_0x3905b5);})['then'](function(_0x13f521){_0x126976[_0xae5c('0x49')]=_0x13f521;return _0x126976;})[_0xae5c('0x26')](respondWithFilteredResult(_0x527cb7,_0x3905b5))[_0xae5c('0x4a')](handleError(_0x527cb7,null));};exports[_0xae5c('0x4b')]=function(_0x5e8506,_0x15d3a2){var _0xa9e632={'raw':!![],'where':{'id':_0x5e8506[_0xae5c('0x4c')]['id']}},_0x338ca9={};_0x338ca9[_0xae5c('0x35')]=_[_0xae5c('0x4d')](db[_0xae5c('0x31')]['rawAttributes']);_0x338ca9[_0xae5c('0x36')]=_[_0xae5c('0x4d')](_0x5e8506[_0xae5c('0x36')]);_0x338ca9['filters']=_['intersection'](_0x338ca9[_0xae5c('0x35')],_0x338ca9[_0xae5c('0x36')]);_0xa9e632[_0xae5c('0x38')]=_[_0xae5c('0x37')](_0x338ca9[_0xae5c('0x35')],qs[_0xae5c('0x39')](_0x5e8506[_0xae5c('0x36')][_0xae5c('0x39')]));_0xa9e632[_0xae5c('0x38')]=_0xa9e632[_0xae5c('0x38')][_0xae5c('0x3a')]?_0xa9e632[_0xae5c('0x38')]:_0x338ca9['model'];if(_0x5e8506[_0xae5c('0x36')]['includeAll']){_0xa9e632['include']=[{'all':!![]}];}_0xa9e632=_[_0xae5c('0x42')]({},_0xa9e632,_0x5e8506['options']);return db['Template'][_0xae5c('0x4e')](_0xa9e632)['then'](handleEntityNotFound(_0x15d3a2,null))[_0xae5c('0x26')](respondWithResult(_0x15d3a2,null))[_0xae5c('0x4a')](handleError(_0x15d3a2,null));};exports['create']=function(_0x490cf6,_0x237548){return db['Template'][_0xae5c('0x4f')](_0x490cf6['body'],{})['then'](function(_0x55cd73){var _0x2a4f8f=_0x490cf6[_0xae5c('0x50')][_0xae5c('0x28')]({'plain':!![]});if(!_0x2a4f8f)throw new Error(_0xae5c('0x51'));if(_0x2a4f8f['role']===_0xae5c('0x50')){var _0x3e3e89=_0x55cd73[_0xae5c('0x28')]({'plain':!![]});var _0x41136c=_0xae5c('0x29');return db[_0xae5c('0x52')]['find']({'where':{'name':_0x41136c,'userProfileId':_0x2a4f8f[_0xae5c('0x53')]},'raw':!![]})[_0xae5c('0x26')](function(_0xc5bd29){if(_0xc5bd29&&_0xc5bd29[_0xae5c('0x54')]===0x0){return db[_0xae5c('0x2a')]['create']({'name':_0x3e3e89[_0xae5c('0x2d')],'resourceId':_0x3e3e89['id'],'type':_0xc5bd29['name'],'sectionId':_0xc5bd29['id']},{})[_0xae5c('0x26')](function(){return _0x55cd73;});}else{return _0x55cd73;}})[_0xae5c('0x4a')](function(_0x200056){logger[_0xae5c('0x2b')](_0xae5c('0x55'),_0x200056);throw _0x200056;});}return _0x55cd73;})[_0xae5c('0x26')](respondWithResult(_0x237548,0xc9))['catch'](handleError(_0x237548,null));};exports[_0xae5c('0x25')]=function(_0x50ff26,_0x10ddbb){if(_0x50ff26[_0xae5c('0x56')]['id']){delete _0x50ff26[_0xae5c('0x56')]['id'];}return db[_0xae5c('0x31')][_0xae5c('0x4e')]({'where':{'id':_0x50ff26[_0xae5c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x10ddbb,null))[_0xae5c('0x26')](saveUpdates(_0x50ff26['body'],null))['then'](respondWithResult(_0x10ddbb,null))[_0xae5c('0x4a')](handleError(_0x10ddbb,null));};exports[_0xae5c('0x27')]=function(_0x2155d9,_0x3ba301){return db[_0xae5c('0x31')]['find']({'where':{'id':_0x2155d9[_0xae5c('0x4c')]['id']}})[_0xae5c('0x26')](handleEntityNotFound(_0x3ba301,null))[_0xae5c('0x26')](removeEntity(_0x3ba301,null))[_0xae5c('0x4a')](handleError(_0x3ba301,null));}; \ No newline at end of file +var _0x3477=['filter','options','include','Template','findAll','rows','catch','show','params','fields','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0x3477,0x115));var _0x7347=function(_0x227e48,_0x5546b2){_0x227e48=_0x227e48-0x0;var _0x2e7cf6=_0x3477[_0x227e48];return _0x2e7cf6;};'use strict';var emlformat=require(_0x7347('0x0'));var rimraf=require(_0x7347('0x1'));var zipdir=require(_0x7347('0x2'));var jsonpatch=require(_0x7347('0x3'));var rp=require(_0x7347('0x4'));var moment=require(_0x7347('0x5'));var BPromise=require(_0x7347('0x6'));var Mustache=require('mustache');var util=require(_0x7347('0x7'));var path=require(_0x7347('0x8'));var sox=require(_0x7347('0x9'));var csv=require('to-csv');var ejs=require(_0x7347('0xa'));var fs=require('fs');var fs_extra=require(_0x7347('0xb'));var _=require('lodash');var squel=require(_0x7347('0xc'));var crypto=require(_0x7347('0xd'));var jsforce=require(_0x7347('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7347('0xf'));var Papa=require(_0x7347('0x10'));var Redis=require(_0x7347('0x11'));var authService=require(_0x7347('0x12'));var qs=require(_0x7347('0x13'));var as=require(_0x7347('0x14'));var hardwareService=require(_0x7347('0x15'));var logger=require(_0x7347('0x16'))(_0x7347('0x17'));var utils=require(_0x7347('0x18'));var config=require(_0x7347('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7347('0x1a'))['db'];function respondWithStatusCode(_0x2de409,_0x505ba9){_0x505ba9=_0x505ba9||0xcc;return function(_0x5ab97a){if(_0x5ab97a){return _0x2de409['sendStatus'](_0x505ba9);}return _0x2de409[_0x7347('0x1b')](_0x505ba9)['end']();};}function respondWithResult(_0x2ac5eb,_0x81684b){_0x81684b=_0x81684b||0xc8;return function(_0x4aa81f){if(_0x4aa81f){return _0x2ac5eb['status'](_0x81684b)[_0x7347('0x1c')](_0x4aa81f);}};}function respondWithFilteredResult(_0x15a8b4,_0x5befa2){return function(_0x224adc){if(_0x224adc){var _0x7f1ea1=typeof _0x5befa2['offset']===_0x7347('0x1d')&&typeof _0x5befa2[_0x7347('0x1e')]===_0x7347('0x1d');var _0x142441=_0x224adc['count'];var _0x4f4794=_0x7f1ea1?0x0:_0x5befa2[_0x7347('0x1f')];var _0x13c651=_0x7f1ea1?_0x224adc[_0x7347('0x20')]:_0x5befa2[_0x7347('0x1f')]+_0x5befa2[_0x7347('0x1e')];var _0x4c97dd;if(_0x13c651>=_0x142441){_0x13c651=_0x142441;_0x4c97dd=0xc8;}else{_0x4c97dd=0xce;}_0x15a8b4[_0x7347('0x1b')](_0x4c97dd);return _0x15a8b4[_0x7347('0x21')](_0x7347('0x22'),_0x4f4794+'-'+_0x13c651+'/'+_0x142441)[_0x7347('0x1c')](_0x224adc);}return null;};}function patchUpdates(_0x227253){return function(_0x4c4773){try{jsonpatch[_0x7347('0x23')](_0x4c4773,_0x227253,!![]);}catch(_0x734dbc){return BPromise[_0x7347('0x24')](_0x734dbc);}return _0x4c4773[_0x7347('0x25')]();};}function saveUpdates(_0x38807f,_0x308cf4){return function(_0x170a2a){if(_0x170a2a){return _0x170a2a[_0x7347('0x26')](_0x38807f)[_0x7347('0x27')](function(_0x49ca77){return _0x49ca77;});}return null;};}function removeEntity(_0x2d0a2d,_0x29517d){return function(_0x16d86a){if(_0x16d86a){return _0x16d86a[_0x7347('0x28')]()['then'](function(){var _0x4bd2d6=_0x16d86a[_0x7347('0x29')]({'plain':!![]});var _0x1834d5=_0x7347('0x2a');return db['UserProfileResource'][_0x7347('0x28')]({'where':{'type':_0x1834d5,'resourceId':_0x4bd2d6['id']}})['then'](function(){return _0x16d86a;});})[_0x7347('0x27')](function(){_0x2d0a2d[_0x7347('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e9a0c,_0x5ccd0a){return function(_0x358255){if(!_0x358255){_0x6e9a0c['sendStatus'](0x194);}return _0x358255;};}function handleError(_0x23a6e8,_0x1b2f43){_0x1b2f43=_0x1b2f43||0x1f4;return function(_0x3fbba1){logger['error'](_0x3fbba1[_0x7347('0x2b')]);if(_0x3fbba1[_0x7347('0x2c')]){delete _0x3fbba1[_0x7347('0x2c')];}_0x23a6e8[_0x7347('0x1b')](_0x1b2f43)[_0x7347('0x2d')](_0x3fbba1);};}exports[_0x7347('0x2e')]=function(_0xa66b08,_0x121b6d){var _0x397759={},_0x3f2425={},_0x492f78={'count':0x0,'rows':[]};var _0x3caf57=_[_0x7347('0x2f')](db['Template'][_0x7347('0x30')],function(_0x1a9607){return{'name':_0x1a9607['fieldName'],'type':_0x1a9607[_0x7347('0x31')]['key']};});_0x3f2425[_0x7347('0x32')]=_['map'](_0x3caf57,_0x7347('0x2c'));_0x3f2425[_0x7347('0x33')]=_[_0x7347('0x34')](_0xa66b08[_0x7347('0x33')]);_0x3f2425[_0x7347('0x35')]=_[_0x7347('0x36')](_0x3f2425[_0x7347('0x32')],_0x3f2425[_0x7347('0x33')]);_0x397759[_0x7347('0x37')]=_[_0x7347('0x36')](_0x3f2425[_0x7347('0x32')],qs['fields'](_0xa66b08[_0x7347('0x33')]['fields']));_0x397759[_0x7347('0x37')]=_0x397759[_0x7347('0x37')]['length']?_0x397759[_0x7347('0x37')]:_0x3f2425[_0x7347('0x32')];if(!_0xa66b08[_0x7347('0x33')][_0x7347('0x38')]('nolimit')){_0x397759[_0x7347('0x1e')]=qs['limit'](_0xa66b08[_0x7347('0x33')][_0x7347('0x1e')]);_0x397759[_0x7347('0x1f')]=qs[_0x7347('0x1f')](_0xa66b08[_0x7347('0x33')][_0x7347('0x1f')]);}_0x397759[_0x7347('0x39')]=qs[_0x7347('0x3a')](_0xa66b08[_0x7347('0x33')][_0x7347('0x3a')]);_0x397759[_0x7347('0x3b')]=qs[_0x7347('0x35')](_[_0x7347('0x3c')](_0xa66b08['query'],_0x3f2425[_0x7347('0x35')]),_0x3caf57);if(_0xa66b08['query']['filter']){_0x397759[_0x7347('0x3b')]=_[_0x7347('0x3d')](_0x397759[_0x7347('0x3b')],{'$or':_[_0x7347('0x2f')](_0x3caf57,function(_0x19f419){if(_0x19f419[_0x7347('0x31')]!==_0x7347('0x3e')){var _0x3fbeba={};_0x3fbeba[_0x19f419['name']]={'$like':'%'+_0xa66b08[_0x7347('0x33')][_0x7347('0x3f')]+'%'};return _0x3fbeba;}})});}_0x397759=_[_0x7347('0x3d')]({},_0x397759,_0xa66b08[_0x7347('0x40')]);var _0x2588e4={'where':_0x397759[_0x7347('0x3b')]};return db['Template']['count'](_0x2588e4)[_0x7347('0x27')](function(_0x3241eb){_0x492f78[_0x7347('0x20')]=_0x3241eb;if(_0xa66b08[_0x7347('0x33')]['includeAll']){_0x397759[_0x7347('0x41')]=[{'all':!![]}];}return db[_0x7347('0x42')][_0x7347('0x43')](_0x397759);})[_0x7347('0x27')](function(_0x2970a7){_0x492f78[_0x7347('0x44')]=_0x2970a7;return _0x492f78;})[_0x7347('0x27')](respondWithFilteredResult(_0x121b6d,_0x397759))[_0x7347('0x45')](handleError(_0x121b6d,null));};exports[_0x7347('0x46')]=function(_0x29e946,_0x469261){var _0x5ebb25={'raw':!![],'where':{'id':_0x29e946[_0x7347('0x47')]['id']}},_0xe5acde={};_0xe5acde[_0x7347('0x32')]=_[_0x7347('0x34')](db[_0x7347('0x42')][_0x7347('0x30')]);_0xe5acde[_0x7347('0x33')]=_['keys'](_0x29e946['query']);_0xe5acde[_0x7347('0x35')]=_[_0x7347('0x36')](_0xe5acde[_0x7347('0x32')],_0xe5acde[_0x7347('0x33')]);_0x5ebb25[_0x7347('0x37')]=_[_0x7347('0x36')](_0xe5acde[_0x7347('0x32')],qs[_0x7347('0x48')](_0x29e946[_0x7347('0x33')][_0x7347('0x48')]));_0x5ebb25[_0x7347('0x37')]=_0x5ebb25['attributes'][_0x7347('0x49')]?_0x5ebb25[_0x7347('0x37')]:_0xe5acde[_0x7347('0x32')];if(_0x29e946['query'][_0x7347('0x4a')]){_0x5ebb25[_0x7347('0x41')]=[{'all':!![]}];}_0x5ebb25=_[_0x7347('0x3d')]({},_0x5ebb25,_0x29e946[_0x7347('0x40')]);return db[_0x7347('0x42')][_0x7347('0x4b')](_0x5ebb25)[_0x7347('0x27')](handleEntityNotFound(_0x469261,null))[_0x7347('0x27')](respondWithResult(_0x469261,null))[_0x7347('0x45')](handleError(_0x469261,null));};exports[_0x7347('0x4c')]=function(_0x2a94db,_0x289832){return db[_0x7347('0x42')][_0x7347('0x4c')](_0x2a94db[_0x7347('0x4d')],{})['then'](function(_0x865ddd){var _0x44ef01=_0x2a94db['user']['get']({'plain':!![]});if(!_0x44ef01)throw new Error(_0x7347('0x4e'));if(_0x44ef01[_0x7347('0x4f')]===_0x7347('0x50')){var _0x5295e5=_0x865ddd[_0x7347('0x29')]({'plain':!![]});var _0x394cc1='Templates';return db[_0x7347('0x51')][_0x7347('0x4b')]({'where':{'name':_0x394cc1,'userProfileId':_0x44ef01['userProfileId']},'raw':!![]})[_0x7347('0x27')](function(_0xbd24d9){if(_0xbd24d9&&_0xbd24d9['autoAssociation']===0x0){return db[_0x7347('0x52')][_0x7347('0x4c')]({'name':_0x5295e5[_0x7347('0x2c')],'resourceId':_0x5295e5['id'],'type':_0xbd24d9[_0x7347('0x2c')],'sectionId':_0xbd24d9['id']},{})[_0x7347('0x27')](function(){return _0x865ddd;});}else{return _0x865ddd;}})[_0x7347('0x45')](function(_0x8f7824){logger[_0x7347('0x53')](_0x7347('0x54'),_0x8f7824);throw _0x8f7824;});}return _0x865ddd;})[_0x7347('0x27')](respondWithResult(_0x289832,0xc9))[_0x7347('0x45')](handleError(_0x289832,null));};exports[_0x7347('0x26')]=function(_0x1e2b65,_0x32ff0e){if(_0x1e2b65[_0x7347('0x4d')]['id']){delete _0x1e2b65[_0x7347('0x4d')]['id'];}return db[_0x7347('0x42')][_0x7347('0x4b')]({'where':{'id':_0x1e2b65[_0x7347('0x47')]['id']}})[_0x7347('0x27')](handleEntityNotFound(_0x32ff0e,null))[_0x7347('0x27')](saveUpdates(_0x1e2b65[_0x7347('0x4d')],null))[_0x7347('0x27')](respondWithResult(_0x32ff0e,null))['catch'](handleError(_0x32ff0e,null));};exports[_0x7347('0x28')]=function(_0x5388ca,_0x24b18b){return db[_0x7347('0x42')]['find']({'where':{'id':_0x5388ca['params']['id']}})[_0x7347('0x27')](handleEntityNotFound(_0x24b18b,null))[_0x7347('0x27')](removeEntity(_0x24b18b,null))[_0x7347('0x45')](handleError(_0x24b18b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3902a2b..c9dd2de 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 _0xa7c7=['moment','bluebird','path','rimraf','../../config/environment','define','tools_templates','lodash','util','../../config/logger','api'];(function(_0x54ed23,_0x137310){var _0x51df35=function(_0x16cc4e){while(--_0x16cc4e){_0x54ed23['push'](_0x54ed23['shift']());}};_0x51df35(++_0x137310);}(_0xa7c7,0x75));var _0x7a7c=function(_0x43625c,_0x1960e8){_0x43625c=_0x43625c-0x0;var _0x2db50e=_0xa7c7[_0x43625c];return _0x2db50e;};'use strict';var _=require(_0x7a7c('0x0'));var util=require(_0x7a7c('0x1'));var logger=require(_0x7a7c('0x2'))(_0x7a7c('0x3'));var moment=require(_0x7a7c('0x4'));var BPromise=require(_0x7a7c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a7c('0x6'));var rimraf=require(_0x7a7c('0x7'));var config=require(_0x7a7c('0x8'));var attributes=require('./template.attributes');module['exports']=function(_0x45957,_0x73ebcb){return _0x45957[_0x7a7c('0x9')]('Template',attributes,{'tableName':_0x7a7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1279=['exports','define','lodash','util','api','path','rimraf','../../config/environment'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x1279,0xb2));var _0x9127=function(_0x287a45,_0x2b7547){_0x287a45=_0x287a45-0x0;var _0x3d5f39=_0x1279[_0x287a45];return _0x3d5f39;};'use strict';var _=require(_0x9127('0x0'));var util=require(_0x9127('0x1'));var logger=require('../../config/logger')(_0x9127('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9127('0x3'));var rimraf=require(_0x9127('0x4'));var config=require(_0x9127('0x5'));var attributes=require('./template.attributes');module[_0x9127('0x6')]=function(_0x191a82,_0x310716){return _0x191a82[_0x9127('0x7')]('Template',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 058386b..1767d46 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 _0x7dd1=['debug','stringify','error','message','info','Template,\x20%s,\x20%s','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','then','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','request\x20sent'];(function(_0x374907,_0x291c19){var _0x1746cc=function(_0x49ae5c){while(--_0x49ae5c){_0x374907['push'](_0x374907['shift']());}};_0x1746cc(++_0x291c19);}(_0x7dd1,0x169));var _0x17dd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7dd1[_0x432682];return _0x463d05;};'use strict';var _=require(_0x17dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x17dd('0x1'));var rs=require(_0x17dd('0x2'));var fs=require('fs');var Redis=require(_0x17dd('0x3'));var db=require(_0x17dd('0x4'))['db'];var utils=require(_0x17dd('0x5'));var logger=require(_0x17dd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x17dd('0x7'));var client=jayson['client'][_0x17dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b9038,_0x591bbf,_0x44a3ed){return new BPromise(function(_0x29b28f,_0x5b1bd4){return client[_0x17dd('0x9')](_0x1b9038,_0x44a3ed)['then'](function(_0x4122db){logger['info']('Template,\x20%s,\x20%s',_0x591bbf,_0x17dd('0xa'));logger[_0x17dd('0xb')]('Template,\x20%s,\x20%s,\x20%s',_0x591bbf,_0x17dd('0xa'),JSON[_0x17dd('0xc')](_0x4122db));if(_0x4122db[_0x17dd('0xd')]){if(_0x4122db['error']['code']===0x1f4){logger[_0x17dd('0xd')]('Template,\x20%s,\x20%s',_0x591bbf,_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);return _0x5b1bd4(_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);}logger[_0x17dd('0xd')]('Template,\x20%s,\x20%s',_0x591bbf,_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);return _0x29b28f(_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);}else{logger[_0x17dd('0xf')](_0x17dd('0x10'),_0x591bbf,'request\x20sent');_0x29b28f(_0x4122db[_0x17dd('0x11')]['message']);}})['catch'](function(_0x2ccde7){logger[_0x17dd('0xd')]('Template,\x20%s,\x20%s',_0x591bbf,_0x2ccde7);_0x5b1bd4(_0x2ccde7);});});}exports[_0x17dd('0x12')]=function(_0x3345c5){var _0x5c0342=this;return new Promise(function(_0x41b9f2,_0x15ae11){return db[_0x17dd('0x13')][_0x17dd('0x14')]({'raw':_0x3345c5[_0x17dd('0x15')]?_0x3345c5[_0x17dd('0x15')][_0x17dd('0x16')]===undefined?!![]:![]:!![],'where':_0x3345c5[_0x17dd('0x15')]?_0x3345c5['options'][_0x17dd('0x17')]||null:null,'attributes':_0x3345c5[_0x17dd('0x15')]?_0x3345c5['options'][_0x17dd('0x18')]||null:null,'limit':_0x3345c5[_0x17dd('0x15')]?_0x3345c5[_0x17dd('0x15')][_0x17dd('0x19')]||null:null,'include':_0x3345c5[_0x17dd('0x15')]?_0x3345c5[_0x17dd('0x15')]['include']?_[_0x17dd('0x1a')](_0x3345c5[_0x17dd('0x15')][_0x17dd('0x1b')],function(_0x3a899f){return{'model':db[_0x3a899f[_0x17dd('0x1c')]],'as':_0x3a899f['as'],'attributes':_0x3a899f[_0x17dd('0x18')],'include':_0x3a899f[_0x17dd('0x1b')]?_['map'](_0x3a899f[_0x17dd('0x1b')],function(_0x3da60c){return{'model':db[_0x3da60c[_0x17dd('0x1c')]],'as':_0x3da60c['as'],'attributes':_0x3da60c[_0x17dd('0x18')],'include':_0x3da60c[_0x17dd('0x1b')]?_[_0x17dd('0x1a')](_0x3da60c[_0x17dd('0x1b')],function(_0xca2ef8){return{'model':db[_0xca2ef8[_0x17dd('0x1c')]],'as':_0xca2ef8['as'],'attributes':_0xca2ef8[_0x17dd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17dd('0x1d')](function(_0xb38ccb){logger[_0x17dd('0xf')]('GetTemplate',_0x3345c5);logger[_0x17dd('0xb')](_0x17dd('0x12'),_0x3345c5,JSON[_0x17dd('0xc')](_0xb38ccb));_0x41b9f2(_0xb38ccb);})[_0x17dd('0x1e')](function(_0x2910c7){logger[_0x17dd('0xd')](_0x17dd('0x12'),_0x2910c7[_0x17dd('0xe')],_0x3345c5);_0x15ae11(_0x5c0342[_0x17dd('0xd')](0x1f4,_0x2910c7[_0x17dd('0xe')]));});});}; \ No newline at end of file +var _0x34ce=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTemplate','findAll','options','raw','include','map','model','attributes','then','info','stringify','catch','util','moment'];(function(_0x4edc47,_0x4b8da3){var _0x46ab88=function(_0x22cc89){while(--_0x22cc89){_0x4edc47['push'](_0x4edc47['shift']());}};_0x46ab88(++_0x4b8da3);}(_0x34ce,0x191));var _0xe34c=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x34ce[_0x79cd47];return _0x3b9484;};'use strict';var _=require('lodash');var util=require(_0xe34c('0x0'));var moment=require(_0xe34c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe34c('0x2'));var fs=require('fs');var Redis=require(_0xe34c('0x3'));var db=require(_0xe34c('0x4'))['db'];var utils=require(_0xe34c('0x5'));var logger=require('../../config/logger')(_0xe34c('0x6'));var config=require('../../config/environment');var jayson=require(_0xe34c('0x7'));var client=jayson[_0xe34c('0x8')][_0xe34c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x216f72,_0x23a8df,_0x3c0035){return new BPromise(function(_0x3e9c6b,_0xb69626){return client[_0xe34c('0xa')](_0x216f72,_0x3c0035)['then'](function(_0x56e5f4){logger['info'](_0xe34c('0xb'),_0x23a8df,_0xe34c('0xc'));logger[_0xe34c('0xd')](_0xe34c('0xe'),_0x23a8df,_0xe34c('0xc'),JSON['stringify'](_0x56e5f4));if(_0x56e5f4[_0xe34c('0xf')]){if(_0x56e5f4[_0xe34c('0xf')][_0xe34c('0x10')]===0x1f4){logger['error'](_0xe34c('0xb'),_0x23a8df,_0x56e5f4[_0xe34c('0xf')][_0xe34c('0x11')]);return _0xb69626(_0x56e5f4[_0xe34c('0xf')]['message']);}logger[_0xe34c('0xf')](_0xe34c('0xb'),_0x23a8df,_0x56e5f4[_0xe34c('0xf')][_0xe34c('0x11')]);return _0x3e9c6b(_0x56e5f4[_0xe34c('0xf')][_0xe34c('0x11')]);}else{logger['info'](_0xe34c('0xb'),_0x23a8df,_0xe34c('0xc'));_0x3e9c6b(_0x56e5f4[_0xe34c('0x12')][_0xe34c('0x11')]);}})['catch'](function(_0x2ab100){logger[_0xe34c('0xf')](_0xe34c('0xb'),_0x23a8df,_0x2ab100);_0xb69626(_0x2ab100);});});}exports[_0xe34c('0x13')]=function(_0x52316e){var _0xa6d70b=this;return new Promise(function(_0x3ef33b,_0x4a7cf0){return db['Template'][_0xe34c('0x14')]({'raw':_0x52316e[_0xe34c('0x15')]?_0x52316e[_0xe34c('0x15')][_0xe34c('0x16')]===undefined?!![]:![]:!![],'where':_0x52316e['options']?_0x52316e['options']['where']||null:null,'attributes':_0x52316e[_0xe34c('0x15')]?_0x52316e[_0xe34c('0x15')]['attributes']||null:null,'limit':_0x52316e[_0xe34c('0x15')]?_0x52316e[_0xe34c('0x15')]['limit']||null:null,'include':_0x52316e[_0xe34c('0x15')]?_0x52316e[_0xe34c('0x15')][_0xe34c('0x17')]?_[_0xe34c('0x18')](_0x52316e[_0xe34c('0x15')][_0xe34c('0x17')],function(_0x6e54b1){return{'model':db[_0x6e54b1[_0xe34c('0x19')]],'as':_0x6e54b1['as'],'attributes':_0x6e54b1[_0xe34c('0x1a')],'include':_0x6e54b1[_0xe34c('0x17')]?_[_0xe34c('0x18')](_0x6e54b1['include'],function(_0x22551d){return{'model':db[_0x22551d['model']],'as':_0x22551d['as'],'attributes':_0x22551d[_0xe34c('0x1a')],'include':_0x22551d[_0xe34c('0x17')]?_[_0xe34c('0x18')](_0x22551d[_0xe34c('0x17')],function(_0x1c01c3){return{'model':db[_0x1c01c3[_0xe34c('0x19')]],'as':_0x1c01c3['as'],'attributes':_0x1c01c3[_0xe34c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe34c('0x1b')](function(_0x9ce8d3){logger[_0xe34c('0x1c')](_0xe34c('0x13'),_0x52316e);logger[_0xe34c('0xd')](_0xe34c('0x13'),_0x52316e,JSON[_0xe34c('0x1d')](_0x9ce8d3));_0x3ef33b(_0x9ce8d3);})[_0xe34c('0x1e')](function(_0x77bd8d){logger[_0xe34c('0xf')](_0xe34c('0x13'),_0x77bd8d[_0xe34c('0x11')],_0x52316e);_0x4a7cf0(_0xa6d70b['error'](0x1f4,_0x77bd8d['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6b7f9e7..a470be9 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 _0x2032=['getActions','create','post','addAction','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions'];(function(_0xe7890a,_0x50d72f){var _0x3f1b52=function(_0x2129ee){while(--_0x2129ee){_0xe7890a['push'](_0xe7890a['shift']());}};_0x3f1b52(++_0x50d72f);}(_0x2032,0xd9));var _0x2203=function(_0x5e12a3,_0x58cabb){_0x5e12a3=_0x5e12a3-0x0;var _0x2ec84a=_0x2032[_0x5e12a3];return _0x2ec84a;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router['post'](_0x2203('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x2203('0x13')](_0x2203('0x10'),auth[_0x2203('0x9')](),controller[_0x2203('0x14')]);router[_0x2203('0x15')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x18')]);module[_0x2203('0x19')]=router; \ No newline at end of file +var _0xd8e6=['show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAllCondition','addAnyCondition','addAction','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id'];(function(_0x555bfc,_0x41407f){var _0x4f9746=function(_0x42c73c){while(--_0x42c73c){_0x555bfc['push'](_0x555bfc['shift']());}};_0x4f9746(++_0x41407f);}(_0xd8e6,0xb7));var _0x6d8e=function(_0x477b7b,_0x5ad383){_0x477b7b=_0x477b7b-0x0;var _0x465f7e=_0xd8e6[_0x477b7b];return _0x465f7e;};'use strict';var multer=require(_0x6d8e('0x0'));var util=require(_0x6d8e('0x1'));var path=require(_0x6d8e('0x2'));var timeout=require(_0x6d8e('0x3'));var express=require(_0x6d8e('0x4'));var router=express['Router']();var fs_extra=require(_0x6d8e('0x5'));var auth=require(_0x6d8e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6d8e('0x7'));var controller=require(_0x6d8e('0x8'));router[_0x6d8e('0x9')]('/',auth[_0x6d8e('0xa')](),controller[_0x6d8e('0xb')]);router[_0x6d8e('0x9')](_0x6d8e('0xc'),auth[_0x6d8e('0xa')](),controller[_0x6d8e('0xd')]);router[_0x6d8e('0x9')](_0x6d8e('0xe'),auth[_0x6d8e('0xa')](),controller[_0x6d8e('0xf')]);router[_0x6d8e('0x9')](_0x6d8e('0x10'),auth[_0x6d8e('0xa')](),controller[_0x6d8e('0x11')]);router[_0x6d8e('0x9')](_0x6d8e('0x12'),auth[_0x6d8e('0xa')](),controller['getActions']);router['post']('/',auth[_0x6d8e('0xa')](),controller[_0x6d8e('0x13')]);router[_0x6d8e('0x14')](_0x6d8e('0xe'),auth['isAuthenticated'](),controller[_0x6d8e('0x15')]);router[_0x6d8e('0x14')](_0x6d8e('0x10'),auth[_0x6d8e('0xa')](),controller[_0x6d8e('0x16')]);router[_0x6d8e('0x14')](_0x6d8e('0x12'),auth[_0x6d8e('0xa')](),controller[_0x6d8e('0x17')]);router[_0x6d8e('0x18')](_0x6d8e('0xc'),auth[_0x6d8e('0xa')](),controller[_0x6d8e('0x19')]);router[_0x6d8e('0x1a')](_0x6d8e('0xc'),auth[_0x6d8e('0xa')](),controller['destroy']);module[_0x6d8e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index dbd1a8f..33ca14c 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 _0xf99c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5cc53f,_0x2652f8){var _0x3a0d7c=function(_0x12623b){while(--_0x12623b){_0x5cc53f['push'](_0x5cc53f['shift']());}};_0x3a0d7c(++_0x2652f8);}(_0xf99c,0x1b6));var _0xcf99=function(_0xb2c817,_0x52d3c4){_0xb2c817=_0xb2c817-0x0;var _0x2a0899=_0xf99c[_0xb2c817];return _0x2a0899;};'use strict';var Sequelize=require(_0xcf99('0x0'));module[_0xcf99('0x1')]={'name':{'type':Sequelize[_0xcf99('0x2')]},'channel':{'type':Sequelize[_0xcf99('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xcf99('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4380=['sequelize','STRING'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x4380,0xb6));var _0x0438=function(_0x358f0f,_0x463951){_0x358f0f=_0x358f0f-0x0;var _0x3a5b9c=_0x4380[_0x358f0f];return _0x3a5b9c;};'use strict';var Sequelize=require(_0x0438('0x0'));module['exports']={'name':{'type':Sequelize[_0x0438('0x1')]},'channel':{'type':Sequelize[_0x0438('0x1')]},'description':{'type':Sequelize[_0x0438('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 3c18560..462081f 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 _0x0ca4=['query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','TriggerId','getActions','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','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','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model'];(function(_0x9d8096,_0x4f1910){var _0x4fdd3a=function(_0x58c873){while(--_0x58c873){_0x9d8096['push'](_0x9d8096['shift']());}};_0x4fdd3a(++_0x4f1910);}(_0x0ca4,0x8b));var _0x40ca=function(_0x4634d8,_0x11a66c){_0x4634d8=_0x4634d8-0x0;var _0x5c41d8=_0x0ca4[_0x4634d8];return _0x5c41d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40ca('0x0'));var zipdir=require(_0x40ca('0x1'));var jsonpatch=require(_0x40ca('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40ca('0x3'));var Mustache=require('mustache');var util=require(_0x40ca('0x4'));var path=require('path');var sox=require(_0x40ca('0x5'));var csv=require(_0x40ca('0x6'));var ejs=require(_0x40ca('0x7'));var fs=require('fs');var fs_extra=require(_0x40ca('0x8'));var _=require(_0x40ca('0x9'));var squel=require(_0x40ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x40ca('0x6'));var querystring=require(_0x40ca('0xb'));var Papa=require(_0x40ca('0xc'));var Redis=require(_0x40ca('0xd'));var authService=require(_0x40ca('0xe'));var qs=require(_0x40ca('0xf'));var as=require(_0x40ca('0x10'));var hardwareService=require(_0x40ca('0x11'));var logger=require(_0x40ca('0x12'))('api');var utils=require(_0x40ca('0x13'));var config=require(_0x40ca('0x14'));var licenseUtil=require(_0x40ca('0x15'));var db=require(_0x40ca('0x16'))['db'];function respondWithStatusCode(_0x375add,_0x4b7556){_0x4b7556=_0x4b7556||0xcc;return function(_0x294b16){if(_0x294b16){return _0x375add[_0x40ca('0x17')](_0x4b7556);}return _0x375add[_0x40ca('0x18')](_0x4b7556)[_0x40ca('0x19')]();};}function respondWithResult(_0x35569c,_0x417f99){_0x417f99=_0x417f99||0xc8;return function(_0x5a3f39){if(_0x5a3f39){return _0x35569c[_0x40ca('0x18')](_0x417f99)['json'](_0x5a3f39);}};}function respondWithFilteredResult(_0x5568a3,_0x2877d1){return function(_0x406418){if(_0x406418){var _0xc81e0a=typeof _0x2877d1[_0x40ca('0x1a')]===_0x40ca('0x1b')&&typeof _0x2877d1[_0x40ca('0x1c')]==='undefined';var _0x14cbb1=_0x406418[_0x40ca('0x1d')];var _0x5265e6=_0xc81e0a?0x0:_0x2877d1[_0x40ca('0x1a')];var _0x3106b3=_0xc81e0a?_0x406418['count']:_0x2877d1[_0x40ca('0x1a')]+_0x2877d1[_0x40ca('0x1c')];var _0x5c140f;if(_0x3106b3>=_0x14cbb1){_0x3106b3=_0x14cbb1;_0x5c140f=0xc8;}else{_0x5c140f=0xce;}_0x5568a3[_0x40ca('0x18')](_0x5c140f);return _0x5568a3[_0x40ca('0x1e')](_0x40ca('0x1f'),_0x5265e6+'-'+_0x3106b3+'/'+_0x14cbb1)[_0x40ca('0x20')](_0x406418);}return null;};}function patchUpdates(_0x428d32){return function(_0x5ede25){try{jsonpatch[_0x40ca('0x21')](_0x5ede25,_0x428d32,!![]);}catch(_0xf126af){return BPromise['reject'](_0xf126af);}return _0x5ede25[_0x40ca('0x22')]();};}function saveUpdates(_0x7b24a3,_0x4a8f6a){return function(_0x5e78ea){if(_0x5e78ea){return _0x5e78ea['update'](_0x7b24a3)['then'](function(_0x3e306a){return _0x3e306a;});}return null;};}function removeEntity(_0x2b68a9,_0x2ab628){return function(_0x3ac424){if(_0x3ac424){return _0x3ac424[_0x40ca('0x23')]()['then'](function(){var _0x1ada61=_0x3ac424[_0x40ca('0x24')]({'plain':!![]});var _0x1e37f2='Triggers';return db[_0x40ca('0x25')][_0x40ca('0x23')]({'where':{'type':_0x1e37f2,'resourceId':_0x1ada61['id']}})['then'](function(){return _0x3ac424;});})[_0x40ca('0x26')](function(){_0x2b68a9[_0x40ca('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x130eb6,_0x2e3f59){return function(_0x599c5d){if(!_0x599c5d){_0x130eb6[_0x40ca('0x17')](0x194);}return _0x599c5d;};}function handleError(_0x2946b5,_0x1d8bb1){_0x1d8bb1=_0x1d8bb1||0x1f4;return function(_0x1dea0a){logger[_0x40ca('0x27')](_0x1dea0a[_0x40ca('0x28')]);if(_0x1dea0a['name']){delete _0x1dea0a[_0x40ca('0x29')];}_0x2946b5[_0x40ca('0x18')](_0x1d8bb1)[_0x40ca('0x2a')](_0x1dea0a);};}exports[_0x40ca('0x2b')]=function(_0x6ceb0,_0x15d5fc){var _0x328fef={},_0x785dbc={},_0x50cb8c={'count':0x0,'rows':[]};var _0x29919a=_[_0x40ca('0x2c')](db[_0x40ca('0x2d')][_0x40ca('0x2e')],function(_0x17fd18){return{'name':_0x17fd18[_0x40ca('0x2f')],'type':_0x17fd18[_0x40ca('0x30')][_0x40ca('0x31')]};});_0x785dbc[_0x40ca('0x32')]=_[_0x40ca('0x2c')](_0x29919a,_0x40ca('0x29'));_0x785dbc[_0x40ca('0x33')]=_['keys'](_0x6ceb0[_0x40ca('0x33')]);_0x785dbc[_0x40ca('0x34')]=_[_0x40ca('0x35')](_0x785dbc[_0x40ca('0x32')],_0x785dbc['query']);_0x328fef[_0x40ca('0x36')]=_[_0x40ca('0x35')](_0x785dbc['model'],qs[_0x40ca('0x37')](_0x6ceb0[_0x40ca('0x33')][_0x40ca('0x37')]));_0x328fef[_0x40ca('0x36')]=_0x328fef[_0x40ca('0x36')][_0x40ca('0x38')]?_0x328fef[_0x40ca('0x36')]:_0x785dbc[_0x40ca('0x32')];if(!_0x6ceb0[_0x40ca('0x33')]['hasOwnProperty'](_0x40ca('0x39'))){_0x328fef[_0x40ca('0x1c')]=qs[_0x40ca('0x1c')](_0x6ceb0['query'][_0x40ca('0x1c')]);_0x328fef[_0x40ca('0x1a')]=qs[_0x40ca('0x1a')](_0x6ceb0[_0x40ca('0x33')]['offset']);}_0x328fef[_0x40ca('0x3a')]=qs[_0x40ca('0x3b')](_0x6ceb0['query'][_0x40ca('0x3b')]);_0x328fef[_0x40ca('0x3c')]=qs[_0x40ca('0x34')](_[_0x40ca('0x3d')](_0x6ceb0[_0x40ca('0x33')],_0x785dbc[_0x40ca('0x34')]),_0x29919a);if(_0x6ceb0[_0x40ca('0x33')][_0x40ca('0x3e')]){_0x328fef[_0x40ca('0x3c')]=_[_0x40ca('0x3f')](_0x328fef[_0x40ca('0x3c')],{'$or':_[_0x40ca('0x2c')](_0x29919a,function(_0x142897){if(_0x142897[_0x40ca('0x30')]!==_0x40ca('0x40')){var _0x303307={};_0x303307[_0x142897['name']]={'$like':'%'+_0x6ceb0[_0x40ca('0x33')][_0x40ca('0x3e')]+'%'};return _0x303307;}})});}_0x328fef=_['merge']({},_0x328fef,_0x6ceb0[_0x40ca('0x41')]);var _0x32b52f={'where':_0x328fef[_0x40ca('0x3c')]};return db['Trigger'][_0x40ca('0x1d')](_0x32b52f)[_0x40ca('0x26')](function(_0x278a62){_0x50cb8c[_0x40ca('0x1d')]=_0x278a62;if(_0x6ceb0[_0x40ca('0x33')][_0x40ca('0x42')]){_0x328fef[_0x40ca('0x43')]=[{'all':!![]}];}return db[_0x40ca('0x2d')][_0x40ca('0x44')](_0x328fef);})['then'](function(_0x20d9e2){_0x50cb8c[_0x40ca('0x45')]=_0x20d9e2;return _0x50cb8c;})[_0x40ca('0x26')](respondWithFilteredResult(_0x15d5fc,_0x328fef))['catch'](handleError(_0x15d5fc,null));};exports[_0x40ca('0x46')]=function(_0x417538,_0x413f04){var _0x41b83e={'raw':![],'where':{'id':_0x417538[_0x40ca('0x47')]['id']}},_0x449f60={};_0x449f60[_0x40ca('0x32')]=_[_0x40ca('0x48')](db[_0x40ca('0x2d')]['rawAttributes']);_0x449f60['query']=_[_0x40ca('0x48')](_0x417538[_0x40ca('0x33')]);_0x449f60['filters']=_['intersection'](_0x449f60['model'],_0x449f60[_0x40ca('0x33')]);_0x41b83e['attributes']=_[_0x40ca('0x35')](_0x449f60['model'],qs[_0x40ca('0x37')](_0x417538['query'][_0x40ca('0x37')]));_0x41b83e[_0x40ca('0x36')]=_0x41b83e[_0x40ca('0x36')]['length']?_0x41b83e[_0x40ca('0x36')]:_0x449f60['model'];if(_0x417538['query']['includeAll']){_0x41b83e['include']=[{'all':!![]}];}_0x41b83e=_[_0x40ca('0x3f')]({},_0x41b83e,_0x417538['options']);return db[_0x40ca('0x2d')]['find'](_0x41b83e)[_0x40ca('0x26')](handleEntityNotFound(_0x413f04,null))['then'](respondWithResult(_0x413f04,null))[_0x40ca('0x49')](handleError(_0x413f04,null));};exports['create']=function(_0x1c536b,_0x486db){return db['Trigger'][_0x40ca('0x4a')](_0x1c536b['body'],{})[_0x40ca('0x26')](function(_0xa110ee){var _0x2c69b3=_0x1c536b[_0x40ca('0x4b')][_0x40ca('0x24')]({'plain':!![]});if(!_0x2c69b3)throw new Error(_0x40ca('0x4c'));if(_0x2c69b3[_0x40ca('0x4d')]==='user'){var _0x3351ad=_0xa110ee[_0x40ca('0x24')]({'plain':!![]});var _0xc9a932=_0x40ca('0x4e');return db[_0x40ca('0x4f')][_0x40ca('0x50')]({'where':{'name':_0xc9a932,'userProfileId':_0x2c69b3[_0x40ca('0x51')]},'raw':!![]})[_0x40ca('0x26')](function(_0x192c0a){if(_0x192c0a&&_0x192c0a[_0x40ca('0x52')]===0x0){return db[_0x40ca('0x25')][_0x40ca('0x4a')]({'name':_0x3351ad[_0x40ca('0x29')],'resourceId':_0x3351ad['id'],'type':_0x192c0a['name'],'sectionId':_0x192c0a['id']},{})[_0x40ca('0x26')](function(){return _0xa110ee;});}else{return _0xa110ee;}})[_0x40ca('0x49')](function(_0xbb6662){logger[_0x40ca('0x27')](_0x40ca('0x53'),_0xbb6662);throw _0xbb6662;});}return _0xa110ee;})[_0x40ca('0x26')](respondWithResult(_0x486db,0xc9))[_0x40ca('0x49')](handleError(_0x486db,null));};exports[_0x40ca('0x54')]=function(_0xa4c27a,_0xb21d3d){if(_0xa4c27a[_0x40ca('0x55')]['id']){delete _0xa4c27a[_0x40ca('0x55')]['id'];}return db[_0x40ca('0x2d')][_0x40ca('0x50')]({'where':{'id':_0xa4c27a[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0xb21d3d,null))[_0x40ca('0x26')](saveUpdates(_0xa4c27a['body'],null))['then'](respondWithResult(_0xb21d3d,null))['catch'](handleError(_0xb21d3d,null));};exports[_0x40ca('0x23')]=function(_0x30c05e,_0x2d15a3){return db[_0x40ca('0x2d')]['find']({'where':{'id':_0x30c05e[_0x40ca('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d15a3,null))['then'](removeEntity(_0x2d15a3,null))[_0x40ca('0x49')](handleError(_0x2d15a3,null));};exports['addAllCondition']=function(_0x3fc62c,_0x34262e,_0x1a87e5){if(_0x3fc62c['body']['id']){delete _0x3fc62c[_0x40ca('0x55')]['id'];}return db[_0x40ca('0x2d')]['find']({'where':{'id':_0x3fc62c['params']['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x34262e,null))['then'](function(_0x3ba1af){if(_0x3ba1af){_0x3fc62c[_0x40ca('0x55')][_0x40ca('0x56')]=_0x3ba1af['id'];return db[_0x40ca('0x57')][_0x40ca('0x4a')](_0x3fc62c[_0x40ca('0x55')]);}})['then'](respondWithResult(_0x34262e,null))['catch'](handleError(_0x34262e,null));};exports['addAnyCondition']=function(_0xdb2d9e,_0x3575a7,_0x3660f8){if(_0xdb2d9e[_0x40ca('0x55')]['id']){delete _0xdb2d9e['body']['id'];}return db['Trigger'][_0x40ca('0x50')]({'where':{'id':_0xdb2d9e[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x3575a7,null))['then'](function(_0x462d11){if(_0x462d11){_0xdb2d9e[_0x40ca('0x55')][_0x40ca('0x58')]=_0x462d11['id'];return db[_0x40ca('0x57')]['create'](_0xdb2d9e[_0x40ca('0x55')]);}})[_0x40ca('0x26')](respondWithResult(_0x3575a7,null))[_0x40ca('0x49')](handleError(_0x3575a7,null));};exports[_0x40ca('0x59')]=function(_0x2a407c,_0x58f634,_0x4acdb4){var _0x375d49={};var _0x561c8a={};var _0x4922ba;var _0x69b139;return db['Trigger'][_0x40ca('0x5a')]({'where':{'id':_0x2a407c[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x58f634,null))[_0x40ca('0x26')](function(_0x3bebe5){if(_0x3bebe5){_0x4922ba=_0x3bebe5;_0x561c8a[_0x40ca('0x32')]=_[_0x40ca('0x48')](db[_0x40ca('0x57')]['rawAttributes']);_0x561c8a[_0x40ca('0x33')]=_[_0x40ca('0x48')](_0x2a407c[_0x40ca('0x33')]);_0x561c8a['filters']=_[_0x40ca('0x35')](_0x561c8a[_0x40ca('0x32')],_0x561c8a['query']);_0x375d49[_0x40ca('0x36')]=_[_0x40ca('0x35')](_0x561c8a[_0x40ca('0x32')],qs[_0x40ca('0x37')](_0x2a407c[_0x40ca('0x33')][_0x40ca('0x37')]));_0x375d49['attributes']=_0x375d49[_0x40ca('0x36')]['length']?_0x375d49[_0x40ca('0x36')]:_0x561c8a['model'];_0x375d49[_0x40ca('0x3a')]=qs['sort'](_0x2a407c['query'][_0x40ca('0x3b')]);_0x375d49[_0x40ca('0x3c')]=qs[_0x40ca('0x34')](_[_0x40ca('0x3d')](_0x2a407c[_0x40ca('0x33')],_0x561c8a['filters']));if(_0x2a407c['query']['filter']){_0x375d49['where']=_['merge'](_0x375d49[_0x40ca('0x3c')],{'$or':_['map'](_0x375d49[_0x40ca('0x36')],function(_0xc20dd7){var _0x4ba3a6={};_0x4ba3a6[_0xc20dd7]={'$like':'%'+_0x2a407c[_0x40ca('0x33')]['filter']+'%'};return _0x4ba3a6;})});}_0x375d49=_['merge']({},_0x375d49,_0x2a407c[_0x40ca('0x41')]);return _0x4922ba[_0x40ca('0x59')](_0x375d49);}})[_0x40ca('0x26')](function(_0x536bf8){if(_0x536bf8){_0x69b139=_0x536bf8[_0x40ca('0x38')];if(!_0x2a407c[_0x40ca('0x33')][_0x40ca('0x5b')](_0x40ca('0x39'))){_0x375d49[_0x40ca('0x1c')]=qs[_0x40ca('0x1c')](_0x2a407c[_0x40ca('0x33')][_0x40ca('0x1c')]);_0x375d49['offset']=qs[_0x40ca('0x1a')](_0x2a407c['query'][_0x40ca('0x1a')]);}return _0x4922ba[_0x40ca('0x59')](_0x375d49);}})[_0x40ca('0x26')](function(_0x113b1e){if(_0x113b1e){return _0x113b1e?{'count':_0x69b139,'rows':_0x113b1e}:null;}})[_0x40ca('0x26')](respondWithResult(_0x58f634,null))[_0x40ca('0x49')](handleError(_0x58f634,null));};exports[_0x40ca('0x5c')]=function(_0x38b391,_0x54eb5d,_0x4577a4){var _0xbbe759={};var _0x202495={};var _0x345b2b;var _0x13df6d;return db['Trigger'][_0x40ca('0x5a')]({'where':{'id':_0x38b391[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x54eb5d,null))[_0x40ca('0x26')](function(_0x516ea9){if(_0x516ea9){_0x345b2b=_0x516ea9;_0x202495[_0x40ca('0x32')]=_[_0x40ca('0x48')](db[_0x40ca('0x57')][_0x40ca('0x2e')]);_0x202495[_0x40ca('0x33')]=_['keys'](_0x38b391[_0x40ca('0x33')]);_0x202495[_0x40ca('0x34')]=_['intersection'](_0x202495['model'],_0x202495['query']);_0xbbe759['attributes']=_['intersection'](_0x202495[_0x40ca('0x32')],qs['fields'](_0x38b391['query'][_0x40ca('0x37')]));_0xbbe759[_0x40ca('0x36')]=_0xbbe759[_0x40ca('0x36')][_0x40ca('0x38')]?_0xbbe759[_0x40ca('0x36')]:_0x202495[_0x40ca('0x32')];_0xbbe759[_0x40ca('0x3a')]=qs[_0x40ca('0x3b')](_0x38b391[_0x40ca('0x33')]['sort']);_0xbbe759[_0x40ca('0x3c')]=qs[_0x40ca('0x34')](_[_0x40ca('0x3d')](_0x38b391[_0x40ca('0x33')],_0x202495['filters']));if(_0x38b391[_0x40ca('0x33')]['filter']){_0xbbe759[_0x40ca('0x3c')]=_[_0x40ca('0x3f')](_0xbbe759[_0x40ca('0x3c')],{'$or':_['map'](_0xbbe759[_0x40ca('0x36')],function(_0x2257ff){var _0x349d7e={};_0x349d7e[_0x2257ff]={'$like':'%'+_0x38b391[_0x40ca('0x33')][_0x40ca('0x3e')]+'%'};return _0x349d7e;})});}_0xbbe759=_[_0x40ca('0x3f')]({},_0xbbe759,_0x38b391[_0x40ca('0x41')]);return _0x345b2b['getAnyConditions'](_0xbbe759);}})[_0x40ca('0x26')](function(_0x83c28c){if(_0x83c28c){_0x13df6d=_0x83c28c[_0x40ca('0x38')];if(!_0x38b391[_0x40ca('0x33')][_0x40ca('0x5b')]('nolimit')){_0xbbe759[_0x40ca('0x1c')]=qs['limit'](_0x38b391[_0x40ca('0x33')][_0x40ca('0x1c')]);_0xbbe759['offset']=qs[_0x40ca('0x1a')](_0x38b391[_0x40ca('0x33')][_0x40ca('0x1a')]);}return _0x345b2b['getAnyConditions'](_0xbbe759);}})[_0x40ca('0x26')](function(_0x7cb507){if(_0x7cb507){return _0x7cb507?{'count':_0x13df6d,'rows':_0x7cb507}:null;}})[_0x40ca('0x26')](respondWithResult(_0x54eb5d,null))['catch'](handleError(_0x54eb5d,null));};exports['addAction']=function(_0x3cf82c,_0x24752a,_0x59f5b1){if(_0x3cf82c[_0x40ca('0x55')]['id']){delete _0x3cf82c['body']['id'];}return db[_0x40ca('0x2d')][_0x40ca('0x50')]({'where':{'id':_0x3cf82c[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0x24752a,null))[_0x40ca('0x26')](function(_0x5d63b5){if(_0x5d63b5){_0x3cf82c[_0x40ca('0x55')][_0x40ca('0x5d')]=_0x5d63b5['id'];return db['Action'][_0x40ca('0x4a')](_0x3cf82c[_0x40ca('0x55')]);}})['then'](respondWithResult(_0x24752a,null))['catch'](handleError(_0x24752a,null));};exports[_0x40ca('0x5e')]=function(_0x4dcc7f,_0xa1304,_0x2c5160){var _0x193bfd={};var _0x409a63={};var _0x1fe26a;var _0x860b09;return db[_0x40ca('0x2d')]['findOne']({'where':{'id':_0x4dcc7f[_0x40ca('0x47')]['id']}})[_0x40ca('0x26')](handleEntityNotFound(_0xa1304,null))[_0x40ca('0x26')](function(_0x5bdb8b){if(_0x5bdb8b){_0x1fe26a=_0x5bdb8b;_0x409a63[_0x40ca('0x32')]=_[_0x40ca('0x48')](db['Action'][_0x40ca('0x2e')]);_0x409a63[_0x40ca('0x33')]=_[_0x40ca('0x48')](_0x4dcc7f[_0x40ca('0x33')]);_0x409a63[_0x40ca('0x34')]=_[_0x40ca('0x35')](_0x409a63['model'],_0x409a63[_0x40ca('0x33')]);_0x193bfd[_0x40ca('0x36')]=_['intersection'](_0x409a63[_0x40ca('0x32')],qs[_0x40ca('0x37')](_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x37')]));_0x193bfd['attributes']=_0x193bfd[_0x40ca('0x36')][_0x40ca('0x38')]?_0x193bfd[_0x40ca('0x36')]:_0x409a63['model'];_0x193bfd[_0x40ca('0x3a')]=qs['sort'](_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x3b')]);_0x193bfd['where']=qs[_0x40ca('0x34')](_[_0x40ca('0x3d')](_0x4dcc7f[_0x40ca('0x33')],_0x409a63['filters']));if(_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x3e')]){_0x193bfd[_0x40ca('0x3c')]=_['merge'](_0x193bfd['where'],{'$or':_[_0x40ca('0x2c')](_0x193bfd['attributes'],function(_0x4ce571){var _0xbc5510={};_0xbc5510[_0x4ce571]={'$like':'%'+_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x3e')]+'%'};return _0xbc5510;})});}_0x193bfd=_[_0x40ca('0x3f')]({},_0x193bfd,_0x4dcc7f[_0x40ca('0x41')]);return _0x1fe26a[_0x40ca('0x5e')](_0x193bfd);}})[_0x40ca('0x26')](function(_0x467e54){if(_0x467e54){_0x860b09=_0x467e54[_0x40ca('0x38')];if(!_0x4dcc7f['query'][_0x40ca('0x5b')]('nolimit')){_0x193bfd[_0x40ca('0x1c')]=qs[_0x40ca('0x1c')](_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x1c')]);_0x193bfd['offset']=qs['offset'](_0x4dcc7f[_0x40ca('0x33')][_0x40ca('0x1a')]);}return _0x1fe26a[_0x40ca('0x5e')](_0x193bfd);}})[_0x40ca('0x26')](function(_0xf44dd3){if(_0xf44dd3){return _0xf44dd3?{'count':_0x860b09,'rows':_0xf44dd3}:null;}})['then'](respondWithResult(_0xa1304,null))[_0x40ca('0x49')](handleError(_0xa1304,null));}; \ No newline at end of file +var _0x3308=['offset','undefined','count','limit','status','set','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','length','includeAll','find','catch','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','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','addAction','getActions','findOne','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json'];(function(_0x432744,_0x3ccc79){var _0x2dcf6d=function(_0x17bac6){while(--_0x17bac6){_0x432744['push'](_0x432744['shift']());}};_0x2dcf6d(++_0x3ccc79);}(_0x3308,0xa6));var _0x8330=function(_0x2ecd04,_0x8c68f4){_0x2ecd04=_0x2ecd04-0x0;var _0x133971=_0x3308[_0x2ecd04];return _0x133971;};'use strict';var emlformat=require(_0x8330('0x0'));var rimraf=require(_0x8330('0x1'));var zipdir=require(_0x8330('0x2'));var jsonpatch=require(_0x8330('0x3'));var rp=require(_0x8330('0x4'));var moment=require(_0x8330('0x5'));var BPromise=require(_0x8330('0x6'));var Mustache=require('mustache');var util=require(_0x8330('0x7'));var path=require('path');var sox=require(_0x8330('0x8'));var csv=require(_0x8330('0x9'));var ejs=require(_0x8330('0xa'));var fs=require('fs');var fs_extra=require(_0x8330('0xb'));var _=require(_0x8330('0xc'));var squel=require('squel');var crypto=require(_0x8330('0xd'));var jsforce=require(_0x8330('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8330('0x9'));var querystring=require(_0x8330('0xf'));var Papa=require(_0x8330('0x10'));var Redis=require(_0x8330('0x11'));var authService=require(_0x8330('0x12'));var qs=require(_0x8330('0x13'));var as=require(_0x8330('0x14'));var hardwareService=require(_0x8330('0x15'));var logger=require(_0x8330('0x16'))('api');var utils=require(_0x8330('0x17'));var config=require(_0x8330('0x18'));var licenseUtil=require(_0x8330('0x19'));var db=require(_0x8330('0x1a'))['db'];function respondWithStatusCode(_0x53504b,_0x72b5d0){_0x72b5d0=_0x72b5d0||0xcc;return function(_0x572ca0){if(_0x572ca0){return _0x53504b[_0x8330('0x1b')](_0x72b5d0);}return _0x53504b['status'](_0x72b5d0)[_0x8330('0x1c')]();};}function respondWithResult(_0x452026,_0x4bc91b){_0x4bc91b=_0x4bc91b||0xc8;return function(_0x274c8f){if(_0x274c8f){return _0x452026['status'](_0x4bc91b)[_0x8330('0x1d')](_0x274c8f);}};}function respondWithFilteredResult(_0x3fe519,_0x344f4d){return function(_0x578f74){if(_0x578f74){var _0x4065b0=typeof _0x344f4d[_0x8330('0x1e')]==='undefined'&&typeof _0x344f4d['limit']===_0x8330('0x1f');var _0x48d589=_0x578f74[_0x8330('0x20')];var _0x45ab7e=_0x4065b0?0x0:_0x344f4d[_0x8330('0x1e')];var _0x2358cb=_0x4065b0?_0x578f74[_0x8330('0x20')]:_0x344f4d[_0x8330('0x1e')]+_0x344f4d[_0x8330('0x21')];var _0x4f9de7;if(_0x2358cb>=_0x48d589){_0x2358cb=_0x48d589;_0x4f9de7=0xc8;}else{_0x4f9de7=0xce;}_0x3fe519[_0x8330('0x22')](_0x4f9de7);return _0x3fe519[_0x8330('0x23')]('Content-Range',_0x45ab7e+'-'+_0x2358cb+'/'+_0x48d589)[_0x8330('0x1d')](_0x578f74);}return null;};}function patchUpdates(_0x57f356){return function(_0x2bb557){try{jsonpatch[_0x8330('0x24')](_0x2bb557,_0x57f356,!![]);}catch(_0x1f2340){return BPromise[_0x8330('0x25')](_0x1f2340);}return _0x2bb557[_0x8330('0x26')]();};}function saveUpdates(_0x2ff795,_0xe0e14e){return function(_0x577f72){if(_0x577f72){return _0x577f72[_0x8330('0x27')](_0x2ff795)[_0x8330('0x28')](function(_0x3883cc){return _0x3883cc;});}return null;};}function removeEntity(_0x3ab889,_0x5ca9cf){return function(_0x1daafd){if(_0x1daafd){return _0x1daafd[_0x8330('0x29')]()[_0x8330('0x28')](function(){var _0x120fc0=_0x1daafd[_0x8330('0x2a')]({'plain':!![]});var _0x48b649='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x48b649,'resourceId':_0x120fc0['id']}})[_0x8330('0x28')](function(){return _0x1daafd;});})[_0x8330('0x28')](function(){_0x3ab889[_0x8330('0x22')](0xcc)[_0x8330('0x1c')]();});}};}function handleEntityNotFound(_0xadb31c,_0x238088){return function(_0x290895){if(!_0x290895){_0xadb31c[_0x8330('0x1b')](0x194);}return _0x290895;};}function handleError(_0x292314,_0x19cf41){_0x19cf41=_0x19cf41||0x1f4;return function(_0xd6ee58){logger[_0x8330('0x2b')](_0xd6ee58[_0x8330('0x2c')]);if(_0xd6ee58[_0x8330('0x2d')]){delete _0xd6ee58[_0x8330('0x2d')];}_0x292314['status'](_0x19cf41)[_0x8330('0x2e')](_0xd6ee58);};}exports[_0x8330('0x2f')]=function(_0x59fca3,_0x22f406){var _0x5a1b0a={},_0x1c2c79={},_0x173caa={'count':0x0,'rows':[]};var _0x38864a=_[_0x8330('0x30')](db[_0x8330('0x31')][_0x8330('0x32')],function(_0xbf9b77){return{'name':_0xbf9b77[_0x8330('0x33')],'type':_0xbf9b77[_0x8330('0x34')]['key']};});_0x1c2c79[_0x8330('0x35')]=_[_0x8330('0x30')](_0x38864a,_0x8330('0x2d'));_0x1c2c79[_0x8330('0x36')]=_[_0x8330('0x37')](_0x59fca3['query']);_0x1c2c79[_0x8330('0x38')]=_[_0x8330('0x39')](_0x1c2c79[_0x8330('0x35')],_0x1c2c79['query']);_0x5a1b0a[_0x8330('0x3a')]=_['intersection'](_0x1c2c79[_0x8330('0x35')],qs[_0x8330('0x3b')](_0x59fca3[_0x8330('0x36')]['fields']));_0x5a1b0a[_0x8330('0x3a')]=_0x5a1b0a[_0x8330('0x3a')]['length']?_0x5a1b0a[_0x8330('0x3a')]:_0x1c2c79[_0x8330('0x35')];if(!_0x59fca3[_0x8330('0x36')][_0x8330('0x3c')](_0x8330('0x3d'))){_0x5a1b0a['limit']=qs['limit'](_0x59fca3['query'][_0x8330('0x21')]);_0x5a1b0a[_0x8330('0x1e')]=qs[_0x8330('0x1e')](_0x59fca3[_0x8330('0x36')][_0x8330('0x1e')]);}_0x5a1b0a[_0x8330('0x3e')]=qs['sort'](_0x59fca3[_0x8330('0x36')][_0x8330('0x3f')]);_0x5a1b0a['where']=qs[_0x8330('0x38')](_[_0x8330('0x40')](_0x59fca3[_0x8330('0x36')],_0x1c2c79[_0x8330('0x38')]),_0x38864a);if(_0x59fca3[_0x8330('0x36')][_0x8330('0x41')]){_0x5a1b0a[_0x8330('0x42')]=_[_0x8330('0x43')](_0x5a1b0a[_0x8330('0x42')],{'$or':_[_0x8330('0x30')](_0x38864a,function(_0x13615f){if(_0x13615f[_0x8330('0x34')]!==_0x8330('0x44')){var _0x1c53c3={};_0x1c53c3[_0x13615f[_0x8330('0x2d')]]={'$like':'%'+_0x59fca3['query'][_0x8330('0x41')]+'%'};return _0x1c53c3;}})});}_0x5a1b0a=_['merge']({},_0x5a1b0a,_0x59fca3[_0x8330('0x45')]);var _0x2798b3={'where':_0x5a1b0a[_0x8330('0x42')]};return db[_0x8330('0x31')][_0x8330('0x20')](_0x2798b3)[_0x8330('0x28')](function(_0x46488b){_0x173caa[_0x8330('0x20')]=_0x46488b;if(_0x59fca3[_0x8330('0x36')]['includeAll']){_0x5a1b0a[_0x8330('0x46')]=[{'all':!![]}];}return db['Trigger'][_0x8330('0x47')](_0x5a1b0a);})[_0x8330('0x28')](function(_0x9466d0){_0x173caa['rows']=_0x9466d0;return _0x173caa;})[_0x8330('0x28')](respondWithFilteredResult(_0x22f406,_0x5a1b0a))['catch'](handleError(_0x22f406,null));};exports[_0x8330('0x48')]=function(_0x2ff835,_0x19fe31){var _0x22b6c3={'raw':![],'where':{'id':_0x2ff835[_0x8330('0x49')]['id']}},_0x178331={};_0x178331[_0x8330('0x35')]=_['keys'](db[_0x8330('0x31')][_0x8330('0x32')]);_0x178331[_0x8330('0x36')]=_[_0x8330('0x37')](_0x2ff835[_0x8330('0x36')]);_0x178331[_0x8330('0x38')]=_[_0x8330('0x39')](_0x178331['model'],_0x178331[_0x8330('0x36')]);_0x22b6c3[_0x8330('0x3a')]=_[_0x8330('0x39')](_0x178331['model'],qs['fields'](_0x2ff835['query'][_0x8330('0x3b')]));_0x22b6c3[_0x8330('0x3a')]=_0x22b6c3['attributes'][_0x8330('0x4a')]?_0x22b6c3['attributes']:_0x178331[_0x8330('0x35')];if(_0x2ff835[_0x8330('0x36')][_0x8330('0x4b')]){_0x22b6c3[_0x8330('0x46')]=[{'all':!![]}];}_0x22b6c3=_[_0x8330('0x43')]({},_0x22b6c3,_0x2ff835[_0x8330('0x45')]);return db['Trigger'][_0x8330('0x4c')](_0x22b6c3)[_0x8330('0x28')](handleEntityNotFound(_0x19fe31,null))[_0x8330('0x28')](respondWithResult(_0x19fe31,null))[_0x8330('0x4d')](handleError(_0x19fe31,null));};exports[_0x8330('0x4e')]=function(_0x20e3cd,_0x3e75e0){return db['Trigger'][_0x8330('0x4e')](_0x20e3cd[_0x8330('0x4f')],{})['then'](function(_0x2b511f){var _0x535930=_0x20e3cd[_0x8330('0x50')][_0x8330('0x2a')]({'plain':!![]});if(!_0x535930)throw new Error(_0x8330('0x51'));if(_0x535930[_0x8330('0x52')]==='user'){var _0x16541b=_0x2b511f['get']({'plain':!![]});var _0x44afbf='Triggers';return db[_0x8330('0x53')]['find']({'where':{'name':_0x44afbf,'userProfileId':_0x535930[_0x8330('0x54')]},'raw':!![]})[_0x8330('0x28')](function(_0x49e583){if(_0x49e583&&_0x49e583[_0x8330('0x55')]===0x0){return db[_0x8330('0x56')]['create']({'name':_0x16541b[_0x8330('0x2d')],'resourceId':_0x16541b['id'],'type':_0x49e583[_0x8330('0x2d')],'sectionId':_0x49e583['id']},{})[_0x8330('0x28')](function(){return _0x2b511f;});}else{return _0x2b511f;}})[_0x8330('0x4d')](function(_0x5ca730){logger[_0x8330('0x2b')](_0x8330('0x57'),_0x5ca730);throw _0x5ca730;});}return _0x2b511f;})['then'](respondWithResult(_0x3e75e0,0xc9))['catch'](handleError(_0x3e75e0,null));};exports[_0x8330('0x27')]=function(_0x413bd2,_0x5f0e79){if(_0x413bd2['body']['id']){delete _0x413bd2[_0x8330('0x4f')]['id'];}return db[_0x8330('0x31')]['find']({'where':{'id':_0x413bd2[_0x8330('0x49')]['id']}})[_0x8330('0x28')](handleEntityNotFound(_0x5f0e79,null))[_0x8330('0x28')](saveUpdates(_0x413bd2[_0x8330('0x4f')],null))[_0x8330('0x28')](respondWithResult(_0x5f0e79,null))[_0x8330('0x4d')](handleError(_0x5f0e79,null));};exports['destroy']=function(_0x4978c3,_0x50ccc3){return db['Trigger']['find']({'where':{'id':_0x4978c3[_0x8330('0x49')]['id']}})['then'](handleEntityNotFound(_0x50ccc3,null))[_0x8330('0x28')](removeEntity(_0x50ccc3,null))[_0x8330('0x4d')](handleError(_0x50ccc3,null));};exports[_0x8330('0x58')]=function(_0x4252ea,_0x3920eb,_0x40ffa3){if(_0x4252ea['body']['id']){delete _0x4252ea['body']['id'];}return db[_0x8330('0x31')][_0x8330('0x4c')]({'where':{'id':_0x4252ea[_0x8330('0x49')]['id']}})[_0x8330('0x28')](handleEntityNotFound(_0x3920eb,null))[_0x8330('0x28')](function(_0x449a8a){if(_0x449a8a){_0x4252ea['body']['TriggerAllId']=_0x449a8a['id'];return db['Condition'][_0x8330('0x4e')](_0x4252ea['body']);}})['then'](respondWithResult(_0x3920eb,null))[_0x8330('0x4d')](handleError(_0x3920eb,null));};exports[_0x8330('0x59')]=function(_0x1ac0fc,_0x429dc8,_0x12d467){if(_0x1ac0fc[_0x8330('0x4f')]['id']){delete _0x1ac0fc['body']['id'];}return db[_0x8330('0x31')][_0x8330('0x4c')]({'where':{'id':_0x1ac0fc[_0x8330('0x49')]['id']}})[_0x8330('0x28')](handleEntityNotFound(_0x429dc8,null))[_0x8330('0x28')](function(_0x2e50dd){if(_0x2e50dd){_0x1ac0fc['body'][_0x8330('0x5a')]=_0x2e50dd['id'];return db[_0x8330('0x5b')]['create'](_0x1ac0fc[_0x8330('0x4f')]);}})[_0x8330('0x28')](respondWithResult(_0x429dc8,null))['catch'](handleError(_0x429dc8,null));};exports[_0x8330('0x5c')]=function(_0x1556e1,_0x1513dd,_0x4a96e7){var _0x434af3={};var _0x6286b3={};var _0x1fd410;var _0x1736e7;return db[_0x8330('0x31')]['findOne']({'where':{'id':_0x1556e1[_0x8330('0x49')]['id']}})[_0x8330('0x28')](handleEntityNotFound(_0x1513dd,null))['then'](function(_0x1f83b7){if(_0x1f83b7){_0x1fd410=_0x1f83b7;_0x6286b3[_0x8330('0x35')]=_['keys'](db[_0x8330('0x5b')][_0x8330('0x32')]);_0x6286b3[_0x8330('0x36')]=_[_0x8330('0x37')](_0x1556e1[_0x8330('0x36')]);_0x6286b3[_0x8330('0x38')]=_[_0x8330('0x39')](_0x6286b3['model'],_0x6286b3[_0x8330('0x36')]);_0x434af3[_0x8330('0x3a')]=_[_0x8330('0x39')](_0x6286b3[_0x8330('0x35')],qs[_0x8330('0x3b')](_0x1556e1[_0x8330('0x36')][_0x8330('0x3b')]));_0x434af3['attributes']=_0x434af3[_0x8330('0x3a')][_0x8330('0x4a')]?_0x434af3[_0x8330('0x3a')]:_0x6286b3[_0x8330('0x35')];_0x434af3[_0x8330('0x3e')]=qs[_0x8330('0x3f')](_0x1556e1[_0x8330('0x36')]['sort']);_0x434af3['where']=qs['filters'](_['pick'](_0x1556e1[_0x8330('0x36')],_0x6286b3['filters']));if(_0x1556e1[_0x8330('0x36')][_0x8330('0x41')]){_0x434af3['where']=_['merge'](_0x434af3['where'],{'$or':_[_0x8330('0x30')](_0x434af3[_0x8330('0x3a')],function(_0x48ed71){var _0x565e56={};_0x565e56[_0x48ed71]={'$like':'%'+_0x1556e1[_0x8330('0x36')][_0x8330('0x41')]+'%'};return _0x565e56;})});}_0x434af3=_[_0x8330('0x43')]({},_0x434af3,_0x1556e1[_0x8330('0x45')]);return _0x1fd410[_0x8330('0x5c')](_0x434af3);}})[_0x8330('0x28')](function(_0x34378c){if(_0x34378c){_0x1736e7=_0x34378c[_0x8330('0x4a')];if(!_0x1556e1[_0x8330('0x36')]['hasOwnProperty'](_0x8330('0x3d'))){_0x434af3[_0x8330('0x21')]=qs['limit'](_0x1556e1['query'][_0x8330('0x21')]);_0x434af3[_0x8330('0x1e')]=qs['offset'](_0x1556e1[_0x8330('0x36')][_0x8330('0x1e')]);}return _0x1fd410[_0x8330('0x5c')](_0x434af3);}})[_0x8330('0x28')](function(_0x4d48a8){if(_0x4d48a8){return _0x4d48a8?{'count':_0x1736e7,'rows':_0x4d48a8}:null;}})[_0x8330('0x28')](respondWithResult(_0x1513dd,null))[_0x8330('0x4d')](handleError(_0x1513dd,null));};exports[_0x8330('0x5d')]=function(_0x347dbf,_0x47cd23,_0x10e41c){var _0x34b5fb={};var _0x24fba0={};var _0x459b56;var _0x5a8026;return db[_0x8330('0x31')]['findOne']({'where':{'id':_0x347dbf[_0x8330('0x49')]['id']}})[_0x8330('0x28')](handleEntityNotFound(_0x47cd23,null))['then'](function(_0x4e7cd9){if(_0x4e7cd9){_0x459b56=_0x4e7cd9;_0x24fba0[_0x8330('0x35')]=_['keys'](db[_0x8330('0x5b')]['rawAttributes']);_0x24fba0[_0x8330('0x36')]=_[_0x8330('0x37')](_0x347dbf[_0x8330('0x36')]);_0x24fba0[_0x8330('0x38')]=_[_0x8330('0x39')](_0x24fba0[_0x8330('0x35')],_0x24fba0[_0x8330('0x36')]);_0x34b5fb['attributes']=_[_0x8330('0x39')](_0x24fba0['model'],qs['fields'](_0x347dbf[_0x8330('0x36')]['fields']));_0x34b5fb[_0x8330('0x3a')]=_0x34b5fb[_0x8330('0x3a')][_0x8330('0x4a')]?_0x34b5fb[_0x8330('0x3a')]:_0x24fba0[_0x8330('0x35')];_0x34b5fb[_0x8330('0x3e')]=qs['sort'](_0x347dbf[_0x8330('0x36')]['sort']);_0x34b5fb[_0x8330('0x42')]=qs[_0x8330('0x38')](_['pick'](_0x347dbf['query'],_0x24fba0[_0x8330('0x38')]));if(_0x347dbf['query'][_0x8330('0x41')]){_0x34b5fb[_0x8330('0x42')]=_['merge'](_0x34b5fb[_0x8330('0x42')],{'$or':_[_0x8330('0x30')](_0x34b5fb['attributes'],function(_0x282e75){var _0x240116={};_0x240116[_0x282e75]={'$like':'%'+_0x347dbf[_0x8330('0x36')]['filter']+'%'};return _0x240116;})});}_0x34b5fb=_[_0x8330('0x43')]({},_0x34b5fb,_0x347dbf[_0x8330('0x45')]);return _0x459b56[_0x8330('0x5d')](_0x34b5fb);}})[_0x8330('0x28')](function(_0x580632){if(_0x580632){_0x5a8026=_0x580632[_0x8330('0x4a')];if(!_0x347dbf[_0x8330('0x36')][_0x8330('0x3c')]('nolimit')){_0x34b5fb[_0x8330('0x21')]=qs[_0x8330('0x21')](_0x347dbf[_0x8330('0x36')][_0x8330('0x21')]);_0x34b5fb[_0x8330('0x1e')]=qs['offset'](_0x347dbf[_0x8330('0x36')][_0x8330('0x1e')]);}return _0x459b56[_0x8330('0x5d')](_0x34b5fb);}})[_0x8330('0x28')](function(_0x4421e2){if(_0x4421e2){return _0x4421e2?{'count':_0x5a8026,'rows':_0x4421e2}:null;}})[_0x8330('0x28')](respondWithResult(_0x47cd23,null))[_0x8330('0x4d')](handleError(_0x47cd23,null));};exports[_0x8330('0x5e')]=function(_0x11dfbc,_0x4643c0,_0x20a6fc){if(_0x11dfbc['body']['id']){delete _0x11dfbc[_0x8330('0x4f')]['id'];}return db[_0x8330('0x31')][_0x8330('0x4c')]({'where':{'id':_0x11dfbc[_0x8330('0x49')]['id']}})[_0x8330('0x28')](handleEntityNotFound(_0x4643c0,null))[_0x8330('0x28')](function(_0xcb862e){if(_0xcb862e){_0x11dfbc[_0x8330('0x4f')]['TriggerId']=_0xcb862e['id'];return db['Action']['create'](_0x11dfbc[_0x8330('0x4f')]);}})[_0x8330('0x28')](respondWithResult(_0x4643c0,null))[_0x8330('0x4d')](handleError(_0x4643c0,null));};exports[_0x8330('0x5f')]=function(_0xe509d5,_0x3d0a05,_0x177642){var _0x295634={};var _0x574547={};var _0x2a0919;var _0x16fb5c;return db[_0x8330('0x31')][_0x8330('0x60')]({'where':{'id':_0xe509d5['params']['id']}})['then'](handleEntityNotFound(_0x3d0a05,null))['then'](function(_0x5cb5c7){if(_0x5cb5c7){_0x2a0919=_0x5cb5c7;_0x574547[_0x8330('0x35')]=_[_0x8330('0x37')](db[_0x8330('0x61')][_0x8330('0x32')]);_0x574547[_0x8330('0x36')]=_[_0x8330('0x37')](_0xe509d5[_0x8330('0x36')]);_0x574547[_0x8330('0x38')]=_[_0x8330('0x39')](_0x574547[_0x8330('0x35')],_0x574547[_0x8330('0x36')]);_0x295634[_0x8330('0x3a')]=_[_0x8330('0x39')](_0x574547[_0x8330('0x35')],qs[_0x8330('0x3b')](_0xe509d5[_0x8330('0x36')][_0x8330('0x3b')]));_0x295634[_0x8330('0x3a')]=_0x295634[_0x8330('0x3a')][_0x8330('0x4a')]?_0x295634[_0x8330('0x3a')]:_0x574547['model'];_0x295634[_0x8330('0x3e')]=qs['sort'](_0xe509d5[_0x8330('0x36')][_0x8330('0x3f')]);_0x295634[_0x8330('0x42')]=qs[_0x8330('0x38')](_['pick'](_0xe509d5[_0x8330('0x36')],_0x574547['filters']));if(_0xe509d5['query'][_0x8330('0x41')]){_0x295634[_0x8330('0x42')]=_['merge'](_0x295634[_0x8330('0x42')],{'$or':_[_0x8330('0x30')](_0x295634['attributes'],function(_0x36e532){var _0xecb897={};_0xecb897[_0x36e532]={'$like':'%'+_0xe509d5[_0x8330('0x36')]['filter']+'%'};return _0xecb897;})});}_0x295634=_[_0x8330('0x43')]({},_0x295634,_0xe509d5['options']);return _0x2a0919[_0x8330('0x5f')](_0x295634);}})[_0x8330('0x28')](function(_0x5037d5){if(_0x5037d5){_0x16fb5c=_0x5037d5[_0x8330('0x4a')];if(!_0xe509d5[_0x8330('0x36')][_0x8330('0x3c')](_0x8330('0x3d'))){_0x295634[_0x8330('0x21')]=qs['limit'](_0xe509d5['query']['limit']);_0x295634[_0x8330('0x1e')]=qs[_0x8330('0x1e')](_0xe509d5[_0x8330('0x36')][_0x8330('0x1e')]);}return _0x2a0919[_0x8330('0x5f')](_0x295634);}})[_0x8330('0x28')](function(_0x1293f1){if(_0x1293f1){return _0x1293f1?{'count':_0x16fb5c,'rows':_0x1293f1}:null;}})[_0x8330('0x28')](respondWithResult(_0x3d0a05,null))[_0x8330('0x4d')](handleError(_0x3d0a05,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 33d80cd..d7300ab 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 _0x7c22=['lodash','util','api','moment','request-promise','path','./trigger.attributes','define','Trigger'];(function(_0x3ce56e,_0x124432){var _0x4d2348=function(_0x4645a7){while(--_0x4645a7){_0x3ce56e['push'](_0x3ce56e['shift']());}};_0x4d2348(++_0x124432);}(_0x7c22,0x6c));var _0x27c2=function(_0x39cdb9,_0x4c64ac){_0x39cdb9=_0x39cdb9-0x0;var _0x4381b6=_0x7c22[_0x39cdb9];return _0x4381b6;};'use strict';var _=require(_0x27c2('0x0'));var util=require(_0x27c2('0x1'));var logger=require('../../config/logger')(_0x27c2('0x2'));var moment=require(_0x27c2('0x3'));var BPromise=require('bluebird');var rp=require(_0x27c2('0x4'));var fs=require('fs');var path=require(_0x27c2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x27c2('0x6'));module['exports']=function(_0x28548d,_0x5006bd){return _0x28548d[_0x27c2('0x7')](_0x27c2('0x8'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15cb=['exports','define','Trigger','tools_triggers','util','api','bluebird','request-promise','path','rimraf','./trigger.attributes'];(function(_0x31fd55,_0x1eb555){var _0x5900c7=function(_0x46bf6f){while(--_0x46bf6f){_0x31fd55['push'](_0x31fd55['shift']());}};_0x5900c7(++_0x1eb555);}(_0x15cb,0x16f));var _0xb15c=function(_0x2aff49,_0x52862a){_0x2aff49=_0x2aff49-0x0;var _0xaaef21=_0x15cb[_0x2aff49];return _0xaaef21;};'use strict';var _=require('lodash');var util=require(_0xb15c('0x0'));var logger=require('../../config/logger')(_0xb15c('0x1'));var moment=require('moment');var BPromise=require(_0xb15c('0x2'));var rp=require(_0xb15c('0x3'));var fs=require('fs');var path=require(_0xb15c('0x4'));var rimraf=require(_0xb15c('0x5'));var config=require('../../config/environment');var attributes=require(_0xb15c('0x6'));module[_0xb15c('0x7')]=function(_0x50ea76,_0x5a1b40){return _0x50ea76[_0xb15c('0x8')](_0xb15c('0x9'),attributes,{'tableName':_0xb15c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index cd2ecfa..5b16b47 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 _0xdadc=['ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','code','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','include','map','model','then','GetTrigger','stringify'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0xdadc,0x1ca));var _0xcdad=function(_0x4b8d9e,_0x408d0f){_0x4b8d9e=_0x4b8d9e-0x0;var _0x4595e9=_0xdadc[_0x4b8d9e];return _0x4595e9;};'use strict';var _=require(_0xcdad('0x0'));var util=require(_0xcdad('0x1'));var moment=require(_0xcdad('0x2'));var BPromise=require(_0xcdad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdad('0x4'));var db=require(_0xcdad('0x5'))['db'];var utils=require(_0xcdad('0x6'));var logger=require(_0xcdad('0x7'))(_0xcdad('0x8'));var config=require(_0xcdad('0x9'));var jayson=require(_0xcdad('0xa'));var client=jayson[_0xcdad('0xb')][_0xcdad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x107e99,_0x48b060,_0x331a83){return new BPromise(function(_0x504c9e,_0x87ea5d){return client[_0xcdad('0xd')](_0x107e99,_0x331a83)['then'](function(_0x48d483){logger[_0xcdad('0xe')]('Trigger,\x20%s,\x20%s',_0x48b060,_0xcdad('0xf'));logger[_0xcdad('0x10')](_0xcdad('0x11'),_0x48b060,_0xcdad('0xf'),JSON['stringify'](_0x48d483));if(_0x48d483['error']){if(_0x48d483['error'][_0xcdad('0x12')]===0x1f4){logger[_0xcdad('0x13')](_0xcdad('0x14'),_0x48b060,_0x48d483[_0xcdad('0x13')][_0xcdad('0x15')]);return _0x87ea5d(_0x48d483[_0xcdad('0x13')]['message']);}logger[_0xcdad('0x13')]('Trigger,\x20%s,\x20%s',_0x48b060,_0x48d483[_0xcdad('0x13')][_0xcdad('0x15')]);return _0x504c9e(_0x48d483[_0xcdad('0x13')]['message']);}else{logger[_0xcdad('0xe')]('Trigger,\x20%s,\x20%s',_0x48b060,'request\x20sent');_0x504c9e(_0x48d483[_0xcdad('0x16')][_0xcdad('0x15')]);}})[_0xcdad('0x17')](function(_0x1507ad){logger[_0xcdad('0x13')](_0xcdad('0x14'),_0x48b060,_0x1507ad);_0x87ea5d(_0x1507ad);});});}exports['GetTrigger']=function(_0x54b084){var _0x31c255=this;return new Promise(function(_0x152e1a,_0x395fac){return db[_0xcdad('0x18')][_0xcdad('0x19')]({'raw':_0x54b084[_0xcdad('0x1a')]?_0x54b084['options'][_0xcdad('0x1b')]===undefined?!![]:![]:!![],'where':_0x54b084['options']?_0x54b084['options'][_0xcdad('0x1c')]||null:null,'attributes':_0x54b084[_0xcdad('0x1a')]?_0x54b084[_0xcdad('0x1a')][_0xcdad('0x1d')]||null:null,'limit':_0x54b084[_0xcdad('0x1a')]?_0x54b084['options']['limit']||null:null,'include':_0x54b084['options']?_0x54b084['options'][_0xcdad('0x1e')]?_[_0xcdad('0x1f')](_0x54b084[_0xcdad('0x1a')][_0xcdad('0x1e')],function(_0x5dbcc5){return{'model':db[_0x5dbcc5['model']],'as':_0x5dbcc5['as'],'attributes':_0x5dbcc5[_0xcdad('0x1d')],'include':_0x5dbcc5[_0xcdad('0x1e')]?_['map'](_0x5dbcc5[_0xcdad('0x1e')],function(_0x2867f3){return{'model':db[_0x2867f3[_0xcdad('0x20')]],'as':_0x2867f3['as'],'attributes':_0x2867f3['attributes'],'include':_0x2867f3[_0xcdad('0x1e')]?_[_0xcdad('0x1f')](_0x2867f3['include'],function(_0x3b4421){return{'model':db[_0x3b4421['model']],'as':_0x3b4421['as'],'attributes':_0x3b4421[_0xcdad('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdad('0x21')](function(_0x4d447e){logger[_0xcdad('0xe')](_0xcdad('0x22'),_0x54b084);logger[_0xcdad('0x10')](_0xcdad('0x22'),_0x54b084,JSON[_0xcdad('0x23')](_0x4d447e));_0x152e1a(_0x4d447e);})[_0xcdad('0x17')](function(_0x4617dd){logger['error']('GetTrigger',_0x4617dd['message'],_0x54b084);_0x395fac(_0x31c255[_0xcdad('0x13')](0x1f4,_0x4617dd['message']));});});};exports[_0xcdad('0x24')]=function(_0x91dc5a){var _0x4a24d1=this;return new Promise(function(_0x3d5bbd,_0x5dbed1){return db[_0xcdad('0x18')][_0xcdad('0x25')]({'raw':_0x91dc5a[_0xcdad('0x1a')]?_0x91dc5a[_0xcdad('0x1a')][_0xcdad('0x1b')]===undefined?!![]:![]:!![],'where':_0x91dc5a[_0xcdad('0x1a')]?_0x91dc5a['options'][_0xcdad('0x1c')]||null:null,'attributes':_0x91dc5a[_0xcdad('0x1a')]?_0x91dc5a[_0xcdad('0x1a')][_0xcdad('0x1d')]||null:null,'include':_0x91dc5a[_0xcdad('0x1a')]?_0x91dc5a['options'][_0xcdad('0x1e')]?_[_0xcdad('0x1f')](_0x91dc5a[_0xcdad('0x1a')]['include'],function(_0x4f60e8){return{'model':db[_0x4f60e8[_0xcdad('0x20')]],'as':_0x4f60e8['as'],'attributes':_0x4f60e8[_0xcdad('0x1d')],'include':_0x4f60e8[_0xcdad('0x1e')]?_['map'](_0x4f60e8[_0xcdad('0x1e')],function(_0x365192){return{'model':db[_0x365192[_0xcdad('0x20')]],'as':_0x365192['as'],'attributes':_0x365192['attributes'],'include':_0x365192['include']?_[_0xcdad('0x1f')](_0x365192[_0xcdad('0x1e')],function(_0x254b1e){return{'model':db[_0x254b1e[_0xcdad('0x20')]],'as':_0x254b1e['as'],'attributes':_0x254b1e[_0xcdad('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdad('0x21')](function(_0x18a12c){logger[_0xcdad('0xe')]('ShowTrigger',_0x91dc5a);logger[_0xcdad('0x10')](_0xcdad('0x24'),_0x91dc5a,JSON[_0xcdad('0x23')](_0x18a12c));_0x3d5bbd(_0x18a12c);})[_0xcdad('0x17')](function(_0x4ad4bb){logger[_0xcdad('0x13')](_0xcdad('0x24'),_0x4ad4bb[_0xcdad('0x15')],_0x91dc5a);_0x5dbed1(_0x4a24d1[_0xcdad('0x13')](0x1f4,_0x4ad4bb['message']));});});}; \ No newline at end of file +var _0x8b0d=['catch','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','Trigger,\x20%s,\x20%s','request\x20sent','GetTrigger','Trigger','findAll','options','raw','where','attributes','model','include','map','info'];(function(_0x49cf77,_0x194cdf){var _0x2f955a=function(_0x4ab3ad){while(--_0x4ab3ad){_0x49cf77['push'](_0x49cf77['shift']());}};_0x2f955a(++_0x194cdf);}(_0x8b0d,0xf8));var _0xd8b0=function(_0x872672,_0x2e0333){_0x872672=_0x872672-0x0;var _0xad34cb=_0x8b0d[_0x872672];return _0xad34cb;};'use strict';var _=require(_0xd8b0('0x0'));var util=require(_0xd8b0('0x1'));var moment=require(_0xd8b0('0x2'));var BPromise=require(_0xd8b0('0x3'));var rs=require(_0xd8b0('0x4'));var fs=require('fs');var Redis=require(_0xd8b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8b0('0x6'));var logger=require(_0xd8b0('0x7'))(_0xd8b0('0x8'));var config=require('../../config/environment');var jayson=require(_0xd8b0('0x9'));var client=jayson[_0xd8b0('0xa')][_0xd8b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3248e2,_0xeb69ea,_0x13ec13){return new BPromise(function(_0x2f9a59,_0x33ea3d){return client[_0xd8b0('0xc')](_0x3248e2,_0x13ec13)[_0xd8b0('0xd')](function(_0x297dda){logger['info']('Trigger,\x20%s,\x20%s',_0xeb69ea,'request\x20sent');logger[_0xd8b0('0xe')](_0xd8b0('0xf'),_0xeb69ea,'request\x20sent',JSON[_0xd8b0('0x10')](_0x297dda));if(_0x297dda[_0xd8b0('0x11')]){if(_0x297dda[_0xd8b0('0x11')]['code']===0x1f4){logger[_0xd8b0('0x11')]('Trigger,\x20%s,\x20%s',_0xeb69ea,_0x297dda[_0xd8b0('0x11')]['message']);return _0x33ea3d(_0x297dda['error'][_0xd8b0('0x12')]);}logger[_0xd8b0('0x11')](_0xd8b0('0x13'),_0xeb69ea,_0x297dda['error']['message']);return _0x2f9a59(_0x297dda[_0xd8b0('0x11')]['message']);}else{logger['info'](_0xd8b0('0x13'),_0xeb69ea,_0xd8b0('0x14'));_0x2f9a59(_0x297dda['result']['message']);}})['catch'](function(_0x2b79a5){logger[_0xd8b0('0x11')](_0xd8b0('0x13'),_0xeb69ea,_0x2b79a5);_0x33ea3d(_0x2b79a5);});});}exports[_0xd8b0('0x15')]=function(_0xcd5bb1){var _0xc73282=this;return new Promise(function(_0x258fdf,_0x58dc5f){return db[_0xd8b0('0x16')][_0xd8b0('0x17')]({'raw':_0xcd5bb1[_0xd8b0('0x18')]?_0xcd5bb1[_0xd8b0('0x18')][_0xd8b0('0x19')]===undefined?!![]:![]:!![],'where':_0xcd5bb1[_0xd8b0('0x18')]?_0xcd5bb1[_0xd8b0('0x18')][_0xd8b0('0x1a')]||null:null,'attributes':_0xcd5bb1[_0xd8b0('0x18')]?_0xcd5bb1['options'][_0xd8b0('0x1b')]||null:null,'limit':_0xcd5bb1['options']?_0xcd5bb1['options']['limit']||null:null,'include':_0xcd5bb1['options']?_0xcd5bb1[_0xd8b0('0x18')]['include']?_['map'](_0xcd5bb1[_0xd8b0('0x18')]['include'],function(_0x369890){return{'model':db[_0x369890[_0xd8b0('0x1c')]],'as':_0x369890['as'],'attributes':_0x369890['attributes'],'include':_0x369890[_0xd8b0('0x1d')]?_['map'](_0x369890[_0xd8b0('0x1d')],function(_0x119098){return{'model':db[_0x119098[_0xd8b0('0x1c')]],'as':_0x119098['as'],'attributes':_0x119098[_0xd8b0('0x1b')],'include':_0x119098[_0xd8b0('0x1d')]?_[_0xd8b0('0x1e')](_0x119098['include'],function(_0x8a8099){return{'model':db[_0x8a8099[_0xd8b0('0x1c')]],'as':_0x8a8099['as'],'attributes':_0x8a8099[_0xd8b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd8b0('0xd')](function(_0x5644bb){logger[_0xd8b0('0x1f')](_0xd8b0('0x15'),_0xcd5bb1);logger[_0xd8b0('0xe')]('GetTrigger',_0xcd5bb1,JSON['stringify'](_0x5644bb));_0x258fdf(_0x5644bb);})[_0xd8b0('0x20')](function(_0x1594ca){logger[_0xd8b0('0x11')]('GetTrigger',_0x1594ca[_0xd8b0('0x12')],_0xcd5bb1);_0x58dc5f(_0xc73282[_0xd8b0('0x11')](0x1f4,_0x1594ca['message']));});});};exports[_0xd8b0('0x21')]=function(_0x2e342e){var _0x1b422f=this;return new Promise(function(_0x2b9ed2,_0x2d023d){return db[_0xd8b0('0x16')][_0xd8b0('0x22')]({'raw':_0x2e342e['options']?_0x2e342e[_0xd8b0('0x18')][_0xd8b0('0x19')]===undefined?!![]:![]:!![],'where':_0x2e342e[_0xd8b0('0x18')]?_0x2e342e[_0xd8b0('0x18')][_0xd8b0('0x1a')]||null:null,'attributes':_0x2e342e[_0xd8b0('0x18')]?_0x2e342e[_0xd8b0('0x18')][_0xd8b0('0x1b')]||null:null,'include':_0x2e342e[_0xd8b0('0x18')]?_0x2e342e[_0xd8b0('0x18')][_0xd8b0('0x1d')]?_[_0xd8b0('0x1e')](_0x2e342e[_0xd8b0('0x18')][_0xd8b0('0x1d')],function(_0x5bd57e){return{'model':db[_0x5bd57e[_0xd8b0('0x1c')]],'as':_0x5bd57e['as'],'attributes':_0x5bd57e['attributes'],'include':_0x5bd57e[_0xd8b0('0x1d')]?_[_0xd8b0('0x1e')](_0x5bd57e[_0xd8b0('0x1d')],function(_0x3a8c8d){return{'model':db[_0x3a8c8d[_0xd8b0('0x1c')]],'as':_0x3a8c8d['as'],'attributes':_0x3a8c8d[_0xd8b0('0x1b')],'include':_0x3a8c8d[_0xd8b0('0x1d')]?_[_0xd8b0('0x1e')](_0x3a8c8d[_0xd8b0('0x1d')],function(_0x4205a0){return{'model':db[_0x4205a0[_0xd8b0('0x1c')]],'as':_0x4205a0['as'],'attributes':_0x4205a0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd8b0('0xd')](function(_0x1d1548){logger['info']('ShowTrigger',_0x2e342e);logger[_0xd8b0('0xe')](_0xd8b0('0x21'),_0x2e342e,JSON[_0xd8b0('0x10')](_0x1d1548));_0x2b9ed2(_0x1d1548);})[_0xd8b0('0x20')](function(_0x438914){logger['error'](_0xd8b0('0x21'),_0x438914['message'],_0x2e342e);_0x2d023d(_0x1b422f['error'](0x1f4,_0x438914[_0xd8b0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dc9143a..5ef4418 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 _0xff2a=['show','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff2a,0x1ab));var _0xaff2=function(_0x3e4285,_0x83a4f0){_0x3e4285=_0x3e4285-0x0;var _0xce09e7=_0xff2a[_0x3e4285];return _0xce09e7;};'use strict';var multer=require(_0xaff2('0x0'));var util=require(_0xaff2('0x1'));var path=require(_0xaff2('0x2'));var timeout=require(_0xaff2('0x3'));var express=require(_0xaff2('0x4'));var router=express['Router']();var fs_extra=require(_0xaff2('0x5'));var auth=require(_0xaff2('0x6'));var interaction=require(_0xaff2('0x7'));var config=require(_0xaff2('0x8'));var controller=require('./trunk.controller');router[_0xaff2('0x9')]('/',auth[_0xaff2('0xa')](),controller[_0xaff2('0xb')]);router[_0xaff2('0x9')](_0xaff2('0xc'),auth[_0xaff2('0xa')](),controller[_0xaff2('0xd')]);router[_0xaff2('0xe')](_0xaff2('0xf'),auth[_0xaff2('0xa')](),controller[_0xaff2('0x10')]);router[_0xaff2('0xe')]('/',auth[_0xaff2('0xa')](),controller['create']);router[_0xaff2('0x11')]('/:id',auth[_0xaff2('0xa')](),controller[_0xaff2('0x12')]);router[_0xaff2('0x13')](_0xaff2('0xc'),auth['isAuthenticated'](),controller[_0xaff2('0x14')]);module[_0xaff2('0x15')]=router; \ No newline at end of file +var _0x452c=['connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','clone','create','put','update','delete','exports','multer','util'];(function(_0x2bef18,_0x441ab1){var _0x34c78f=function(_0x2c554d){while(--_0x2c554d){_0x2bef18['push'](_0x2bef18['shift']());}};_0x34c78f(++_0x441ab1);}(_0x452c,0x19c));var _0xc452=function(_0xc9b08a,_0x2d976e){_0xc9b08a=_0xc9b08a-0x0;var _0x313e74=_0x452c[_0xc9b08a];return _0x313e74;};'use strict';var multer=require(_0xc452('0x0'));var util=require(_0xc452('0x1'));var path=require('path');var timeout=require(_0xc452('0x2'));var express=require('express');var router=express[_0xc452('0x3')]();var fs_extra=require(_0xc452('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc452('0x5'));var controller=require('./trunk.controller');router[_0xc452('0x6')]('/',auth[_0xc452('0x7')](),controller[_0xc452('0x8')]);router[_0xc452('0x6')](_0xc452('0x9'),auth[_0xc452('0x7')](),controller[_0xc452('0xa')]);router[_0xc452('0xb')]('/:id/clone',auth[_0xc452('0x7')](),controller[_0xc452('0xc')]);router[_0xc452('0xb')]('/',auth[_0xc452('0x7')](),controller[_0xc452('0xd')]);router[_0xc452('0xe')](_0xc452('0x9'),auth[_0xc452('0x7')](),controller[_0xc452('0xf')]);router[_0xc452('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc452('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2d4ad78..2cb7312 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 _0x5c3f=['passive','actpass','dynamic','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','nonat','update','outgoing','yes','force_rport,comedia','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai','certificate'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x5c3f,0x1ee));var _0xf5c3=function(_0x5a88eb,_0xf1fb8e){_0x5a88eb=_0x5a88eb-0x0;var _0x9e01b2=_0x5c3f[_0x5a88eb];return _0x9e01b2;};'use strict';var Sequelize=require(_0xf5c3('0x0'));module[_0xf5c3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf5c3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x4'),_0xf5c3('0x5'),_0xf5c3('0x6')),'allowNull':![],'defaultValue':_0xf5c3('0x4')},'context':{'type':Sequelize[_0xf5c3('0x7')],'allowNull':![],'defaultValue':_0xf5c3('0x8')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xf5c3('0x9'),_0xf5c3('0xa'),_0xf5c3('0xb'),_0xf5c3('0xc'),_0xf5c3('0xd'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xf5c3('0x7')]},'permit':{'type':Sequelize[_0xf5c3('0x7')]},'secret':{'type':Sequelize[_0xf5c3('0x7')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xf5c3('0xe'),'set':function(_0x3b7687){this[_0xf5c3('0xf')]('transport',_0x3b7687?_0x3b7687[_0xf5c3('0x10')](','):null);},'get':function(){return this[_0xf5c3('0x11')](_0xf5c3('0x12'))?this[_0xf5c3('0x11')](_0xf5c3('0x12'))[_0xf5c3('0x13')](','):null;},'comment':_0xf5c3('0x14')},'dtmfmode':{'type':Sequelize[_0xf5c3('0x3')]('rfc2833',_0xf5c3('0x15'),_0xf5c3('0x16'),'inband',_0xf5c3('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf5c3('0x3')]('yes','no',_0xf5c3('0x18'),_0xf5c3('0x19'),_0xf5c3('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf5c3('0x7')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':_0xf5c3('0x1c'),'set':function(_0x511b23){this[_0xf5c3('0xf')]('nat',_0x511b23?_0x511b23[_0xf5c3('0x10')](','):null);},'get':function(){return this[_0xf5c3('0x11')]('nat')?this['getDataValue']('nat')[_0xf5c3('0x13')](','):null;},'comment':_0xf5c3('0x1d')},'callgroup':{'type':Sequelize[_0xf5c3('0x7')]},'namedcallgroup':{'type':Sequelize[_0xf5c3('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf5c3('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf5c3('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf5c3('0x7')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x6a8346){this[_0xf5c3('0xf')](_0xf5c3('0x1e'),_0x6a8346?_0x6a8346['join'](';'):_0xf5c3('0x1f'));},'get':function(){return this['getDataValue'](_0xf5c3('0x1e'))?this[_0xf5c3('0x11')]('allow')['split'](';'):null;},'comment':_0xf5c3('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no')},'insecure':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':_0xf5c3('0x21'),'set':function(_0x4d5580){this[_0xf5c3('0xf')]('insecure',_0x4d5580?_0x4d5580[_0xf5c3('0x10')](','):null);},'get':function(){return this[_0xf5c3('0x11')]('insecure')?this[_0xf5c3('0x11')](_0xf5c3('0x22'))[_0xf5c3('0x13')](','):null;},'comment':_0xf5c3('0x23')},'trustrpid':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no',_0xf5c3('0x24'))},'promiscredir':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'accountcode':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':_0xf5c3('0x26')},'amaflags':{'type':Sequelize[_0xf5c3('0x7')]},'callcounter':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no'),'defaultValue':_0xf5c3('0x1b')},'busylevel':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf5c3('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xf5c3('0x7')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x27'),_0xf5c3('0x28'),'originate')},'session_expires':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x29'),_0xf5c3('0x2a')),'defaultValue':_0xf5c3('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xf5c3('0x7')]},'fromdomain':{'type':Sequelize[_0xf5c3('0x7')]},'fromuser':{'type':Sequelize[_0xf5c3('0x7')]},'port':{'type':Sequelize[_0xf5c3('0x25')](0x5)},'qualify':{'type':Sequelize[_0xf5c3('0x3')]('yes','no'),'defaultValue':_0xf5c3('0x1b')},'keepalive':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xf5c3('0x7')]},'defaultuser':{'type':Sequelize[_0xf5c3('0x7')]},'rtptimeout':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xf5c3('0x3')]('yes','no',_0xf5c3('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf5c3('0x7')]},'callbackextension':{'type':Sequelize[_0xf5c3('0x7')]},'timert1':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'timerb':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xf5c3('0x7')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xf5c3('0x7')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xf5c3('0x7')]},'maxforwards':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'encryption':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'icesupport':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0xf5c3('0x3')](_0xf5c3('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xf5c3('0x3')]('yes','no','fingerprint',_0xf5c3('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xf5c3('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf5c3('0x7')]},'dtlsprivatekey':{'type':Sequelize[_0xf5c3('0x7')]},'dtlscipher':{'type':Sequelize[_0xf5c3('0x7')]},'dtlscafile':{'type':Sequelize[_0xf5c3('0x7')]},'dtlscapath':{'type':Sequelize[_0xf5c3('0x7')]},'dtlssetup':{'type':Sequelize[_0xf5c3('0x3')]('active',_0xf5c3('0x2d'),_0xf5c3('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf5c3('0x7')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xf5c3('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xf5c3('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xf5c3('0x3')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xf5c3('0x7')]},'mohsuggest':{'type':Sequelize[_0xf5c3('0x7')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5c3('0x7')]},'host':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':_0xf5c3('0x2f')},'canreinvite':{'type':Sequelize[_0xf5c3('0x3')]('yes','no',_0xf5c3('0x18'),_0xf5c3('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf5c3('0x7')]},'otherFields':{'type':Sequelize[_0xf5c3('0x7')]},'active':{'type':Sequelize[_0xf5c3('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf5c3('0x7')],'defaultValue':'no'}}; \ No newline at end of file +var _0x6563=['PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED'];(function(_0x25bb1c,_0x44c49a){var _0x23aa45=function(_0x443afd){while(--_0x443afd){_0x25bb1c['push'](_0x25bb1c['shift']());}};_0x23aa45(++_0x44c49a);}(_0x6563,0x102));var _0x3656=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0x6563[_0x47408e];return _0x1636bc;};'use strict';var Sequelize=require(_0x3656('0x0'));module[_0x3656('0x1')]={'name':{'type':Sequelize[_0x3656('0x2')],'allowNull':![],'unique':_0x3656('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x5'),_0x3656('0x6'),_0x3656('0x7')),'allowNull':![],'defaultValue':_0x3656('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3656('0x8')},'callingpres':{'type':Sequelize[_0x3656('0x4')]('ALLOWED_NOT_SCREENED',_0x3656('0x9'),_0x3656('0xa'),_0x3656('0xb'),_0x3656('0xc'),'PROHIB_PASSED_SCREEN',_0x3656('0xd'),_0x3656('0xe'))},'deny':{'type':Sequelize[_0x3656('0x2')]},'permit':{'type':Sequelize[_0x3656('0x2')]},'secret':{'type':Sequelize[_0x3656('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x3656('0x2')]},'transport':{'type':Sequelize[_0x3656('0x2')],'defaultValue':_0x3656('0xf'),'set':function(_0x4dd4de){this['setDataValue']('transport',_0x4dd4de?_0x4dd4de[_0x3656('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x3656('0x11'))?this['getDataValue']('transport')[_0x3656('0x12')](','):null;},'comment':_0x3656('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x3656('0x14'),'info',_0x3656('0x15'),_0x3656('0x16'),_0x3656('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x3656('0x18'),_0x3656('0x19'),_0x3656('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3656('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x3656('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x3656('0x1c'),'set':function(_0x33c099){this[_0x3656('0x1d')](_0x3656('0x1e'),_0x33c099?_0x33c099[_0x3656('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x3656('0x1e'))?this[_0x3656('0x1f')](_0x3656('0x1e'))[_0x3656('0x12')](','):null;},'comment':_0x3656('0x20')},'callgroup':{'type':Sequelize[_0x3656('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3656('0x2')]},'pickupgroup':{'type':Sequelize[_0x3656('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3656('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3656('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3656('0x2')],'defaultValue':_0x3656('0x21')},'allow':{'type':Sequelize[_0x3656('0x2')],'allowNull':![],'defaultValue':_0x3656('0x22'),'set':function(_0x358963){this['setDataValue'](_0x3656('0x23'),_0x358963?_0x358963['join'](';'):_0x3656('0x22'));},'get':function(){return this[_0x3656('0x1f')]('allow')?this[_0x3656('0x1f')](_0x3656('0x23'))[_0x3656('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'insecure':{'type':Sequelize[_0x3656('0x2')],'defaultValue':_0x3656('0x24'),'set':function(_0x490216){this[_0x3656('0x1d')](_0x3656('0x25'),_0x490216?_0x490216[_0x3656('0x10')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x3656('0x1f')](_0x3656('0x25'))[_0x3656('0x12')](','):null;},'comment':_0x3656('0x26')},'trustrpid':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3656('0x4')]('yes','no',_0x3656('0x27'))},'promiscredir':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3656('0x1b'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x3656('0x2')]},'callerid':{'type':Sequelize[_0x3656('0x2')],'defaultValue':_0x3656('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no'),'defaultValue':_0x3656('0x1b')},'busylevel':{'type':Sequelize[_0x3656('0x29')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3656('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x3656('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3656('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x3656('0x2')]},'template':{'type':Sequelize[_0x3656('0x2')]},'videosupport':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no',_0x3656('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x3656('0x2')]},'session_timers':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x2b'),'refuse',_0x3656('0x2c'))},'session_expires':{'type':Sequelize[_0x3656('0x29')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x2d'),_0x3656('0x2e')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3656('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x3656('0x2')]},'fromuser':{'type':Sequelize[_0x3656('0x2')]},'port':{'type':Sequelize[_0x3656('0x29')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x3656('0x1b'),'no'),'defaultValue':_0x3656('0x1b')},'keepalive':{'type':Sequelize[_0x3656('0x29')](0xb)},'defaultip':{'type':Sequelize[_0x3656('0x2')]},'defaultuser':{'type':Sequelize[_0x3656('0x2')]},'rtptimeout':{'type':Sequelize[_0x3656('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3656('0x29')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3656('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x3656('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3656('0x29')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x3656('0x2')]},'contactacl':{'type':Sequelize[_0x3656('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3656('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x3656('0x29')](0xb)},'encryption':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3656('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x3656('0x1b'),'no',_0x3656('0x2f'),_0x3656('0x30'))},'dtlsrekey':{'type':Sequelize[_0x3656('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3656('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3656('0x2')]},'dtlscipher':{'type':Sequelize[_0x3656('0x2')]},'dtlscafile':{'type':Sequelize[_0x3656('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x31'),_0x3656('0x32'),_0x3656('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3656('0x2')]},'usereqphone':{'type':Sequelize[_0x3656('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x3656('0x4')](_0x3656('0x1b'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x3656('0x2')]},'parkinglot':{'type':Sequelize[_0x3656('0x2')]},'description':{'type':Sequelize[_0x3656('0x2')]},'host':{'type':Sequelize[_0x3656('0x2')],'defaultValue':_0x3656('0x34')},'canreinvite':{'type':Sequelize['ENUM'](_0x3656('0x1b'),'no',_0x3656('0x18'),_0x3656('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3656('0x2')]},'otherFields':{'type':Sequelize[_0x3656('0x2')]},'active':{'type':Sequelize[_0x3656('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3656('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 5d36ab7..d62a337 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 _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x4caf4f,_0x1f9d37){var _0xf64dd9=function(_0x37507){while(--_0x37507){_0x4caf4f['push'](_0x4caf4f['shift']());}};_0xf64dd9(++_0x1f9d37);}(_0x34e8,0x12c));var _0x834e=function(_0x25e5a2,_0x274b6a){_0x25e5a2=_0x25e5a2-0x0;var _0x2baa6b=_0x34e8[_0x25e5a2];return _0x2baa6b;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file +var _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x99f2a0,_0x53b2bb){var _0x34d315=function(_0x21b4d3){while(--_0x21b4d3){_0x99f2a0['push'](_0x99f2a0['shift']());}};_0x34d315(++_0x53b2bb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4606a8,_0x341e4d){_0x4606a8=_0x4606a8-0x0;var _0x42efc3=_0x8ef6[_0x4606a8];return _0x42efc3;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b9555de..a1bd8b9 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 _0x0ec3=['../../config/environment','./trunk.attributes','exports','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xda0086,_0x2868b6){var _0x1120ec=function(_0x2f4b31){while(--_0x2f4b31){_0xda0086['push'](_0xda0086['shift']());}};_0x1120ec(++_0x2868b6);}(_0x0ec3,0xd5));var _0x30ec=function(_0x52d215,_0x16472f){_0x52d215=_0x52d215-0x0;var _0x4c0678=_0x0ec3[_0x52d215];return _0x4c0678;};'use strict';var _=require(_0x30ec('0x0'));var util=require(_0x30ec('0x1'));var logger=require(_0x30ec('0x2'))(_0x30ec('0x3'));var moment=require(_0x30ec('0x4'));var BPromise=require(_0x30ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x30ec('0x6'));var config=require(_0x30ec('0x7'));var attributes=require(_0x30ec('0x8'));module[_0x30ec('0x9')]=function(_0x226724,_0x2da11e){return _0x226724['define']('Trunk',attributes,{'tableName':_0x30ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbc7=['exports','define','Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./trunk.attributes'];(function(_0x2e9948,_0x27a272){var _0x1167ca=function(_0x22d3f4){while(--_0x22d3f4){_0x2e9948['push'](_0x2e9948['shift']());}};_0x1167ca(++_0x27a272);}(_0xbbc7,0x190));var _0x7bbc=function(_0x3f6733,_0x3d1cc0){_0x3f6733=_0x3f6733-0x0;var _0x16576a=_0xbbc7[_0x3f6733];return _0x16576a;};'use strict';var _=require('lodash');var util=require(_0x7bbc('0x0'));var logger=require(_0x7bbc('0x1'))(_0x7bbc('0x2'));var moment=require(_0x7bbc('0x3'));var BPromise=require(_0x7bbc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bbc('0x5'));var rimraf=require('rimraf');var config=require(_0x7bbc('0x6'));var attributes=require(_0x7bbc('0x7'));module[_0x7bbc('0x8')]=function(_0x140c24,_0x33ffdb){return _0x140c24[_0x7bbc('0x9')](_0x7bbc('0xa'),attributes,{'tableName':_0x7bbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index d21e86d..486dc0d 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 _0xbd2c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','ShowTrunk','find','lodash','moment','bluebird','randomstring'];(function(_0x979fbf,_0x466353){var _0x15ac2e=function(_0x53a942){while(--_0x53a942){_0x979fbf['push'](_0x979fbf['shift']());}};_0x15ac2e(++_0x466353);}(_0xbd2c,0x1c3));var _0xcbd2=function(_0xc78792,_0x4d5294){_0xc78792=_0xc78792-0x0;var _0x24f87e=_0xbd2c[_0xc78792];return _0x24f87e;};'use strict';var _=require(_0xcbd2('0x0'));var util=require('util');var moment=require(_0xcbd2('0x1'));var BPromise=require(_0xcbd2('0x2'));var rs=require(_0xcbd2('0x3'));var fs=require('fs');var Redis=require(_0xcbd2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbd2('0x5'));var logger=require(_0xcbd2('0x6'))(_0xcbd2('0x7'));var config=require(_0xcbd2('0x8'));var jayson=require(_0xcbd2('0x9'));var client=jayson['client'][_0xcbd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e8c3,_0x557011,_0xe4c047){return new BPromise(function(_0x1d28a7,_0x312188){return client[_0xcbd2('0xb')](_0x27e8c3,_0xe4c047)[_0xcbd2('0xc')](function(_0x176679){logger[_0xcbd2('0xd')](_0xcbd2('0xe'),_0x557011,_0xcbd2('0xf'));logger[_0xcbd2('0x10')](_0xcbd2('0x11'),_0x557011,_0xcbd2('0xf'),JSON[_0xcbd2('0x12')](_0x176679));if(_0x176679[_0xcbd2('0x13')]){if(_0x176679[_0xcbd2('0x13')][_0xcbd2('0x14')]===0x1f4){logger[_0xcbd2('0x13')](_0xcbd2('0xe'),_0x557011,_0x176679[_0xcbd2('0x13')][_0xcbd2('0x15')]);return _0x312188(_0x176679[_0xcbd2('0x13')][_0xcbd2('0x15')]);}logger[_0xcbd2('0x13')]('Trunk,\x20%s,\x20%s',_0x557011,_0x176679['error'][_0xcbd2('0x15')]);return _0x1d28a7(_0x176679[_0xcbd2('0x13')]['message']);}else{logger[_0xcbd2('0xd')]('Trunk,\x20%s,\x20%s',_0x557011,_0xcbd2('0xf'));_0x1d28a7(_0x176679['result'][_0xcbd2('0x15')]);}})[_0xcbd2('0x16')](function(_0x5cf4b9){logger['error'](_0xcbd2('0xe'),_0x557011,_0x5cf4b9);_0x312188(_0x5cf4b9);});});}exports[_0xcbd2('0x17')]=function(_0x247b68){var _0x56c13f=this;return new Promise(function(_0x4baee3,_0x96dddf){return db[_0xcbd2('0x18')][_0xcbd2('0x19')]({'raw':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1c')]||null:null,'attributes':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1d')]||null:null,'limit':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')]['limit']||null:null,'include':_0x247b68[_0xcbd2('0x1a')]?_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1e')]?_[_0xcbd2('0x1f')](_0x247b68[_0xcbd2('0x1a')][_0xcbd2('0x1e')],function(_0x40329a){return{'model':db[_0x40329a[_0xcbd2('0x20')]],'as':_0x40329a['as'],'attributes':_0x40329a[_0xcbd2('0x1d')],'include':_0x40329a['include']?_['map'](_0x40329a['include'],function(_0x232f98){return{'model':db[_0x232f98[_0xcbd2('0x20')]],'as':_0x232f98['as'],'attributes':_0x232f98[_0xcbd2('0x1d')],'include':_0x232f98['include']?_[_0xcbd2('0x1f')](_0x232f98['include'],function(_0xccdb71){return{'model':db[_0xccdb71[_0xcbd2('0x20')]],'as':_0xccdb71['as'],'attributes':_0xccdb71[_0xcbd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcbd2('0xc')](function(_0x394081){logger[_0xcbd2('0xd')](_0xcbd2('0x17'),_0x247b68);logger[_0xcbd2('0x10')](_0xcbd2('0x17'),_0x247b68,JSON[_0xcbd2('0x12')](_0x394081));_0x4baee3(_0x394081);})[_0xcbd2('0x16')](function(_0x205a00){logger[_0xcbd2('0x13')](_0xcbd2('0x17'),_0x205a00['message'],_0x247b68);_0x96dddf(_0x56c13f['error'](0x1f4,_0x205a00['message']));});});};exports[_0xcbd2('0x21')]=function(_0x3ebf0d){var _0x5a9371=this;return new Promise(function(_0x5dbda4,_0x380d81){return db[_0xcbd2('0x18')][_0xcbd2('0x22')]({'raw':_0x3ebf0d[_0xcbd2('0x1a')]?_0x3ebf0d['options'][_0xcbd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ebf0d[_0xcbd2('0x1a')]?_0x3ebf0d[_0xcbd2('0x1a')][_0xcbd2('0x1c')]||null:null,'attributes':_0x3ebf0d[_0xcbd2('0x1a')]?_0x3ebf0d[_0xcbd2('0x1a')][_0xcbd2('0x1d')]||null:null,'include':_0x3ebf0d['options']?_0x3ebf0d['options'][_0xcbd2('0x1e')]?_[_0xcbd2('0x1f')](_0x3ebf0d[_0xcbd2('0x1a')][_0xcbd2('0x1e')],function(_0x120de9){return{'model':db[_0x120de9[_0xcbd2('0x20')]],'as':_0x120de9['as'],'attributes':_0x120de9[_0xcbd2('0x1d')],'include':_0x120de9[_0xcbd2('0x1e')]?_[_0xcbd2('0x1f')](_0x120de9['include'],function(_0x89232c){return{'model':db[_0x89232c[_0xcbd2('0x20')]],'as':_0x89232c['as'],'attributes':_0x89232c[_0xcbd2('0x1d')],'include':_0x89232c[_0xcbd2('0x1e')]?_['map'](_0x89232c[_0xcbd2('0x1e')],function(_0x34bdfb){return{'model':db[_0x34bdfb[_0xcbd2('0x20')]],'as':_0x34bdfb['as'],'attributes':_0x34bdfb[_0xcbd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcbd2('0xc')](function(_0x341964){logger['info'](_0xcbd2('0x21'),_0x3ebf0d);logger[_0xcbd2('0x10')](_0xcbd2('0x21'),_0x3ebf0d,JSON[_0xcbd2('0x12')](_0x341964));_0x5dbda4(_0x341964);})[_0xcbd2('0x16')](function(_0x3f679a){logger[_0xcbd2('0x13')](_0xcbd2('0x21'),_0x3f679a[_0xcbd2('0x15')],_0x3ebf0d);_0x380d81(_0x5a9371[_0xcbd2('0x13')](0x1f4,_0x3f679a[_0xcbd2('0x15')]));});});}; \ No newline at end of file +var _0x14c2=['client','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','limit','include','map','model','attributes','then','ShowTrunk','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x587ac1,_0x69f166){var _0x5c1471=function(_0x1ca4f6){while(--_0x1ca4f6){_0x587ac1['push'](_0x587ac1['shift']());}};_0x5c1471(++_0x69f166);}(_0x14c2,0xbc));var _0x214c=function(_0x7372d6,_0x539351){_0x7372d6=_0x7372d6-0x0;var _0x33165d=_0x14c2[_0x7372d6];return _0x33165d;};'use strict';var _=require(_0x214c('0x0'));var util=require(_0x214c('0x1'));var moment=require(_0x214c('0x2'));var BPromise=require(_0x214c('0x3'));var rs=require(_0x214c('0x4'));var fs=require('fs');var Redis=require(_0x214c('0x5'));var db=require(_0x214c('0x6'))['db'];var utils=require(_0x214c('0x7'));var logger=require(_0x214c('0x8'))(_0x214c('0x9'));var config=require(_0x214c('0xa'));var jayson=require(_0x214c('0xb'));var client=jayson[_0x214c('0xc')][_0x214c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4dbb14,_0x326a69,_0x470f7f){return new BPromise(function(_0x4a5054,_0x508bf0){return client[_0x214c('0xe')](_0x4dbb14,_0x470f7f)['then'](function(_0x421073){logger[_0x214c('0xf')](_0x214c('0x10'),_0x326a69,'request\x20sent');logger[_0x214c('0x11')](_0x214c('0x12'),_0x326a69,_0x214c('0x13'),JSON[_0x214c('0x14')](_0x421073));if(_0x421073[_0x214c('0x15')]){if(_0x421073[_0x214c('0x15')][_0x214c('0x16')]===0x1f4){logger['error'](_0x214c('0x10'),_0x326a69,_0x421073[_0x214c('0x15')][_0x214c('0x17')]);return _0x508bf0(_0x421073[_0x214c('0x15')][_0x214c('0x17')]);}logger[_0x214c('0x15')](_0x214c('0x10'),_0x326a69,_0x421073['error'][_0x214c('0x17')]);return _0x4a5054(_0x421073[_0x214c('0x15')][_0x214c('0x17')]);}else{logger[_0x214c('0xf')](_0x214c('0x10'),_0x326a69,_0x214c('0x13'));_0x4a5054(_0x421073[_0x214c('0x18')][_0x214c('0x17')]);}})[_0x214c('0x19')](function(_0x42bd56){logger['error']('Trunk,\x20%s,\x20%s',_0x326a69,_0x42bd56);_0x508bf0(_0x42bd56);});});}exports[_0x214c('0x1a')]=function(_0x5c3c17){var _0x56f9c3=this;return new Promise(function(_0x3c6c4f,_0x1b40ed){return db[_0x214c('0x1b')][_0x214c('0x1c')]({'raw':_0x5c3c17[_0x214c('0x1d')]?_0x5c3c17[_0x214c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c3c17['options']?_0x5c3c17[_0x214c('0x1d')]['where']||null:null,'attributes':_0x5c3c17[_0x214c('0x1d')]?_0x5c3c17[_0x214c('0x1d')]['attributes']||null:null,'limit':_0x5c3c17[_0x214c('0x1d')]?_0x5c3c17['options'][_0x214c('0x1e')]||null:null,'include':_0x5c3c17['options']?_0x5c3c17[_0x214c('0x1d')][_0x214c('0x1f')]?_[_0x214c('0x20')](_0x5c3c17[_0x214c('0x1d')][_0x214c('0x1f')],function(_0x2bc121){return{'model':db[_0x2bc121[_0x214c('0x21')]],'as':_0x2bc121['as'],'attributes':_0x2bc121[_0x214c('0x22')],'include':_0x2bc121[_0x214c('0x1f')]?_['map'](_0x2bc121['include'],function(_0x1518a4){return{'model':db[_0x1518a4['model']],'as':_0x1518a4['as'],'attributes':_0x1518a4[_0x214c('0x22')],'include':_0x1518a4['include']?_[_0x214c('0x20')](_0x1518a4[_0x214c('0x1f')],function(_0x2f1867){return{'model':db[_0x2f1867['model']],'as':_0x2f1867['as'],'attributes':_0x2f1867['attributes']};}):[]};}):[]};}):[]:[]})[_0x214c('0x23')](function(_0x572d5d){logger['info'](_0x214c('0x1a'),_0x5c3c17);logger['debug'](_0x214c('0x1a'),_0x5c3c17,JSON[_0x214c('0x14')](_0x572d5d));_0x3c6c4f(_0x572d5d);})['catch'](function(_0xf91cb2){logger[_0x214c('0x15')](_0x214c('0x1a'),_0xf91cb2[_0x214c('0x17')],_0x5c3c17);_0x1b40ed(_0x56f9c3[_0x214c('0x15')](0x1f4,_0xf91cb2[_0x214c('0x17')]));});});};exports[_0x214c('0x24')]=function(_0x5d1b99){var _0x5f4e9e=this;return new Promise(function(_0x18e4c7,_0x230227){return db[_0x214c('0x1b')][_0x214c('0x25')]({'raw':_0x5d1b99['options']?_0x5d1b99['options'][_0x214c('0x26')]===undefined?!![]:![]:!![],'where':_0x5d1b99['options']?_0x5d1b99[_0x214c('0x1d')][_0x214c('0x27')]||null:null,'attributes':_0x5d1b99[_0x214c('0x1d')]?_0x5d1b99['options'][_0x214c('0x22')]||null:null,'include':_0x5d1b99[_0x214c('0x1d')]?_0x5d1b99[_0x214c('0x1d')][_0x214c('0x1f')]?_[_0x214c('0x20')](_0x5d1b99[_0x214c('0x1d')][_0x214c('0x1f')],function(_0x24c286){return{'model':db[_0x24c286[_0x214c('0x21')]],'as':_0x24c286['as'],'attributes':_0x24c286[_0x214c('0x22')],'include':_0x24c286[_0x214c('0x1f')]?_[_0x214c('0x20')](_0x24c286[_0x214c('0x1f')],function(_0x1d6504){return{'model':db[_0x1d6504['model']],'as':_0x1d6504['as'],'attributes':_0x1d6504[_0x214c('0x22')],'include':_0x1d6504[_0x214c('0x1f')]?_['map'](_0x1d6504['include'],function(_0x1ed58a){return{'model':db[_0x1ed58a['model']],'as':_0x1ed58a['as'],'attributes':_0x1ed58a[_0x214c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x214c('0x23')](function(_0x11a2f0){logger[_0x214c('0xf')](_0x214c('0x24'),_0x5d1b99);logger['debug']('ShowTrunk',_0x5d1b99,JSON['stringify'](_0x11a2f0));_0x18e4c7(_0x11a2f0);})['catch'](function(_0x340716){logger[_0x214c('0x15')]('ShowTrunk',_0x340716[_0x214c('0x17')],_0x5d1b99);_0x230227(_0x5f4e9e[_0x214c('0x15')](0x1f4,_0x340716[_0x214c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index bdb48c9..f0569b6 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bc=['../../components/auth/service','put','/:id','isAuthenticated','update','exports'];(function(_0x5e5d39,_0x45c2e9){var _0x499861=function(_0x86c335){while(--_0x86c335){_0x5e5d39['push'](_0x5e5d39['shift']());}};_0x499861(++_0x45c2e9);}(_0x81bc,0x72));var _0xc81b=function(_0x576139,_0x4d401d){_0x576139=_0x576139-0x0;var _0x3519cc=_0x81bc[_0x576139];return _0x3519cc;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xc81b('0x0'));var controller=require('./user-setting.controller');router[_0xc81b('0x1')](_0xc81b('0x2'),auth[_0xc81b('0x3')](),controller[_0xc81b('0x4')]);module[_0xc81b('0x5')]=router; \ No newline at end of file +var _0x789e=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x789e,0x16f));var _0xe789=function(_0x1eb2bc,_0x2902ac){_0x1eb2bc=_0x1eb2bc-0x0;var _0x598886=_0x789e[_0x1eb2bc];return _0x598886;};'use strict';var express=require('express');var router=express[_0xe789('0x0')]();var auth=require(_0xe789('0x1'));var controller=require(_0xe789('0x2'));router[_0xe789('0x3')](_0xe789('0x4'),auth[_0xe789('0x5')](),controller[_0xe789('0x6')]);module[_0xe789('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index de5335f..7a1eebd 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x795f=['INTEGER','UserId','sequelize','error','info','debug','exports','ENUM','TEXT'];(function(_0x44a8ed,_0x1b05be){var _0x291cc9=function(_0x52088b){while(--_0x52088b){_0x44a8ed['push'](_0x44a8ed['shift']());}};_0x291cc9(++_0x1b05be);}(_0x795f,0x9b));var _0xf795=function(_0x15e235,_0x4b3879){_0x15e235=_0x15e235-0x0;var _0x1042a3=_0x795f[_0x15e235];return _0x1042a3;};'use strict';var Sequelize=require(_0xf795('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf795('0x1'),'warning',_0xf795('0x2'),_0xf795('0x3')];module[_0xf795('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xf795('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xf795('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf795('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf795('0x7')],'unique':_0xf795('0x8')}}; \ No newline at end of file +var _0x0170=['UserId','sequelize','error','warning','debug','exports','ENUM','BOOLEAN','DATE','INTEGER'];(function(_0xc69348,_0x4def5f){var _0x33296f=function(_0x19aac5){while(--_0x19aac5){_0xc69348['push'](_0xc69348['shift']());}};_0x33296f(++_0x4def5f);}(_0x0170,0x1e1));var _0x0017=function(_0x28e5d6,_0x2a2e4f){_0x28e5d6=_0x28e5d6-0x0;var _0x32d5cf=_0x0170[_0x28e5d6];return _0x32d5cf;};'use strict';var Sequelize=require(_0x0017('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0017('0x1'),_0x0017('0x2'),'info',_0x0017('0x3')];module[_0x0017('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x0017('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0017('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0017('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0017('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x0017('0x8')],'unique':_0x0017('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index e83809c..a9f599a 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde9d=['api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','defaults','status','json','error','stack','name','send','update','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','then','lodash','ioredis','../../config/logger'];(function(_0x27ddde,_0x4007cb){var _0x5f2fb5=function(_0x130aac){while(--_0x130aac){_0x27ddde['push'](_0x27ddde['shift']());}};_0x5f2fb5(++_0x4007cb);}(_0xde9d,0x156));var _0xdde9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xde9d[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xdde9('0x0'));var Redis=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var config=require(_0xdde9('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0xdde9('0x5'))(new Redis(config[_0xdde9('0x6')]));require(_0xdde9('0x7'))['register'](socket);config[_0xdde9('0x6')]=_[_0xdde9('0x8')](config[_0xdde9('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x289ccb,_0x1431f0){_0x1431f0=_0x1431f0||0xc8;return function(_0x229168){if(_0x229168){return _0x289ccb[_0xdde9('0x9')](_0x1431f0)[_0xdde9('0xa')](_0x229168);}};}function saveUpdates(_0x5539c4){return function(_0x19b039){if(_0x19b039){return _0x19b039['update'](_0x5539c4)['then'](function(_0x259849){return _0x259849;});}return null;};}function handleEntityNotFound(_0x29c882){return function(_0x2b7e77){if(!_0x2b7e77){_0x29c882['sendStatus'](0x194);}return _0x2b7e77;};}function handleError(_0x15f74d,_0x49a420){_0x49a420=_0x49a420||0x1f4;return function(_0x478bec){logger[_0xdde9('0xb')](_0x478bec[_0xdde9('0xc')]);if(_0x478bec[_0xdde9('0xd')]){delete _0x478bec['name'];}_0x15f74d['status'](_0x49a420)[_0xdde9('0xe')](_0x478bec);};}exports[_0xdde9('0xf')]=function(_0x5ba2e9,_0x506802){if(_0x5ba2e9[_0xdde9('0x10')][_0xdde9('0x11')]!=='admin')throw new Error(_0xdde9('0x12'));if(isNaN(Number(_0x5ba2e9[_0xdde9('0x13')]['id'])))throw new Error(_0xdde9('0x14'));return db['UserSetting'][_0xdde9('0x15')]({'where':{'id':_0x5ba2e9['params']['id']}})['then'](handleEntityNotFound(_0x506802,null))[_0xdde9('0x16')](saveUpdates(_0x5ba2e9['body'],null))['then'](respondWithResult(_0x506802,null))['catch'](handleError(_0x506802,null));}; \ No newline at end of file +var _0x0cfa=['find','params','body','lodash','ioredis','../../config/logger','api','redis','register','defaults','json','update','then','error','name','status','send','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting'];(function(_0x123c8b,_0x15fbfb){var _0x504004=function(_0x134087){while(--_0x134087){_0x123c8b['push'](_0x123c8b['shift']());}};_0x504004(++_0x15fbfb);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x12c6ec,_0x4e5895){_0x12c6ec=_0x12c6ec-0x0;var _0x5a23f5=_0x0cfa[_0x12c6ec];return _0x5a23f5;};'use strict';var _=require(_0xa0cf('0x0'));var Redis=require(_0xa0cf('0x1'));var logger=require(_0xa0cf('0x2'))(_0xa0cf('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xa0cf('0x4')]));require('./user-setting.socket')[_0xa0cf('0x5')](socket);config[_0xa0cf('0x4')]=_[_0xa0cf('0x6')](config[_0xa0cf('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x27eb15,_0x5d9035){_0x5d9035=_0x5d9035||0xc8;return function(_0x232245){if(_0x232245){return _0x27eb15['status'](_0x5d9035)[_0xa0cf('0x7')](_0x232245);}};}function saveUpdates(_0x4855d0){return function(_0xaf0993){if(_0xaf0993){return _0xaf0993[_0xa0cf('0x8')](_0x4855d0)[_0xa0cf('0x9')](function(_0x544364){return _0x544364;});}return null;};}function handleEntityNotFound(_0x318f36){return function(_0x327033){if(!_0x327033){_0x318f36['sendStatus'](0x194);}return _0x327033;};}function handleError(_0x47fef5,_0xe98d2a){_0xe98d2a=_0xe98d2a||0x1f4;return function(_0x31f6a7){logger[_0xa0cf('0xa')](_0x31f6a7['stack']);if(_0x31f6a7[_0xa0cf('0xb')]){delete _0x31f6a7[_0xa0cf('0xb')];}_0x47fef5[_0xa0cf('0xc')](_0xe98d2a)[_0xa0cf('0xd')](_0x31f6a7);};}exports[_0xa0cf('0x8')]=function(_0x30c045,_0x235c2f){if(_0x30c045['user'][_0xa0cf('0xe')]!==_0xa0cf('0xf'))throw new Error(_0xa0cf('0x10'));if(isNaN(Number(_0x30c045['params']['id'])))throw new Error(_0xa0cf('0x11'));return db[_0xa0cf('0x12')][_0xa0cf('0x13')]({'where':{'id':_0x30c045[_0xa0cf('0x14')]['id']}})[_0xa0cf('0x9')](handleEntityNotFound(_0x235c2f,null))['then'](saveUpdates(_0x30c045[_0xa0cf('0x15')],null))[_0xa0cf('0x9')](respondWithResult(_0x235c2f,null))['catch'](handleError(_0x235c2f,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 44efcae..79928b5 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc89c=['setMaxListeners','emit','hasOwnProperty','exports','events','../../mysqldb','UserSetting'];(function(_0xc3720b,_0x1e8732){var _0x464ec7=function(_0x3cd8ce){while(--_0x3cd8ce){_0xc3720b['push'](_0xc3720b['shift']());}};_0x464ec7(++_0x1e8732);}(_0xc89c,0x1e7));var _0xcc89=function(_0x1884be,_0x183e81){_0x1884be=_0x1884be-0x0;var _0x52bafe=_0xc89c[_0x1884be];return _0x52bafe;};'use strict';var EventEmitter=require(_0xcc89('0x0'));var UserSetting=require(_0xcc89('0x1'))['db'][_0xcc89('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xcc89('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e6f4c){return function(_0x3db8d8,_0x1340a8,_0x5ca7a9){UserSettingEvents[_0xcc89('0x4')](_0x2e6f4c+':'+_0x3db8d8['id'],_0x3db8d8);UserSettingEvents[_0xcc89('0x4')](_0x2e6f4c,_0x3db8d8);_0x5ca7a9(null);};}for(var e in events){if(events[_0xcc89('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xcc89('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xad8d=['remove','emit','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','update'];(function(_0x1895df,_0x33744c){var _0xc3ec1c=function(_0x37cd76){while(--_0x37cd76){_0x1895df['push'](_0x1895df['shift']());}};_0xc3ec1c(++_0x33744c);}(_0xad8d,0x175));var _0xdad8=function(_0x146cb9,_0x349d0b){_0x146cb9=_0x146cb9-0x0;var _0x2dbc9a=_0xad8d[_0x146cb9];return _0x2dbc9a;};'use strict';var EventEmitter=require(_0xdad8('0x0'));var UserSetting=require(_0xdad8('0x1'))['db'][_0xdad8('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xdad8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdad8('0x4'),'afterDestroy':_0xdad8('0x5')};function emitEvent(_0x25c75c){return function(_0x3aaea7,_0x4dc073,_0xb8f187){UserSettingEvents['emit'](_0x25c75c+':'+_0x3aaea7['id'],_0x3aaea7);UserSettingEvents[_0xdad8('0x6')](_0x25c75c,_0x3aaea7);_0xb8f187(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xdad8('0x7')](e,emitEvent(event));}}module[_0xdad8('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index c217f66..5f46515 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa902=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x2ae24f,_0x3f258f){var _0x41535d=function(_0x568158){while(--_0x568158){_0x2ae24f['push'](_0x2ae24f['shift']());}};_0x41535d(++_0x3f258f);}(_0xa902,0x8d));var _0x2a90=function(_0x91718e,_0x42d1f4){_0x91718e=_0x91718e-0x0;var _0x4226b6=_0xa902[_0x91718e];return _0x4226b6;};'use strict';var attributes=require(_0x2a90('0x0'));module[_0x2a90('0x1')]=function(_0x416198){return _0x416198[_0x2a90('0x2')](_0x2a90('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2da982){if(!_0x2da982['clientSideLoggingEnabled'])_0x2da982['clientSideLoggingEnabledSince']=null;else if(_0x2da982[_0x2a90('0x4')]===null)_0x2da982[_0x2a90('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xb74d=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting'];(function(_0x4bd6e2,_0x497fe0){var _0x392cba=function(_0x390191){while(--_0x390191){_0x4bd6e2['push'](_0x4bd6e2['shift']());}};_0x392cba(++_0x497fe0);}(_0xb74d,0x16e));var _0xdb74=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0xb74d[_0x810025];return _0x4dbc81;};'use strict';var attributes=require(_0xdb74('0x0'));module['exports']=function(_0x350d0d){return _0x350d0d['define'](_0xdb74('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ba155){if(!_0x1ba155[_0xdb74('0x2')])_0x1ba155[_0xdb74('0x3')]=null;else if(_0x1ba155['clientSideLoggingEnabledSince']===null)_0x1ba155[_0xdb74('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 2456dc0..d7db003 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a63=['user-setting:update','user-setting:update:user-','UserId','length','user-setting:','./user-setting.events','save','remove','update'];(function(_0x1fa19c,_0x5c740b){var _0x5b332d=function(_0x289cb8){while(--_0x289cb8){_0x1fa19c['push'](_0x1fa19c['shift']());}};_0x5b332d(++_0x5c740b);}(_0x7a63,0x1ac));var _0x37a6=function(_0x575856,_0x1fd0ef){_0x575856=_0x575856-0x0;var _0x26ba4c=_0x7a63[_0x575856];return _0x26ba4c;};'use strict';var UserSettingEvents=require(_0x37a6('0x0'));var events=[_0x37a6('0x1'),_0x37a6('0x2'),_0x37a6('0x3')];function createListener(_0x3129a0,_0x14166d){return function(_0xc29885){_0x14166d['emit'](_0x3129a0,_0xc29885);if(_0x3129a0===_0x37a6('0x4')){_0x14166d['emit'](_0x37a6('0x5')+_0xc29885[_0x37a6('0x6')],_0xc29885);}};}exports['register']=function(_0xa128e){for(var _0x5f3a6b=0x0,_0x2bc1f4=events[_0x37a6('0x7')];_0x5f3a6b<_0x2bc1f4;_0x5f3a6b++){var _0x50a25=events[_0x5f3a6b];var _0x2b2b72=createListener(_0x37a6('0x8')+_0x50a25,_0xa128e);UserSettingEvents['on'](_0x50a25,_0x2b2b72);}}; \ No newline at end of file +var _0xa7ea=['user-setting:','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','length'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0xa7ea,0x91));var _0xaa7e=function(_0x212452,_0x2a8feb){_0x212452=_0x212452-0x0;var _0x20d534=_0xa7ea[_0x212452];return _0x20d534;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xaa7e('0x0'),_0xaa7e('0x1'),_0xaa7e('0x2')];function createListener(_0x43a9b2,_0x469e0b){return function(_0x2ee987){_0x469e0b[_0xaa7e('0x3')](_0x43a9b2,_0x2ee987);if(_0x43a9b2===_0xaa7e('0x4')){_0x469e0b[_0xaa7e('0x3')](_0xaa7e('0x5')+_0x2ee987[_0xaa7e('0x6')],_0x2ee987);}};}exports['register']=function(_0x28bf30){for(var _0x5cbbb6=0x0,_0x47f58c=events[_0xaa7e('0x7')];_0x5cbbb6<_0x47f58c;_0x5cbbb6++){var _0x109161=events[_0x5cbbb6];var _0x2a6719=createListener(_0xaa7e('0x8')+_0x109161,_0x28bf30);UserSettingEvents['on'](_0x109161,_0x2a6719);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 6381797..3860b80 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 _0x518c=['isAuthenticated','describe','/whoami','whoami','/presence','getPresence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','/:id/contacts','addContacts','post','create','addQueues','root','server/files/images/','format','%s-%s','now','originalname','single','login','/:id/logout','/:id/pause','pause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','delete','/:id/queues','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','index'];(function(_0x2bf97a,_0xf4a738){var _0x33698a=function(_0x248f2d){while(--_0x248f2d){_0x2bf97a['push'](_0x2bf97a['shift']());}};_0x33698a(++_0xf4a738);}(_0x518c,0xd8));var _0xc518=function(_0x4c821e,_0x4fb789){_0x4c821e=_0x4c821e-0x0;var _0xe298d3=_0x518c[_0x4c821e];return _0xe298d3;};'use strict';var multer=require(_0xc518('0x0'));var util=require(_0xc518('0x1'));var path=require(_0xc518('0x2'));var timeout=require('connect-timeout');var express=require(_0xc518('0x3'));var router=express[_0xc518('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc518('0x5'));var config=require(_0xc518('0x6'));var controller=require(_0xc518('0x7'));router[_0xc518('0x8')]('/',auth['isAuthenticated'](),controller[_0xc518('0x9')]);router[_0xc518('0x8')]('/describe',auth[_0xc518('0xa')](),controller[_0xc518('0xb')]);router['get'](_0xc518('0xc'),auth[_0xc518('0xa')](),controller[_0xc518('0xd')]);router[_0xc518('0x8')](_0xc518('0xe'),auth[_0xc518('0xa')](),controller[_0xc518('0xf')]);router[_0xc518('0x8')]('/:id',auth[_0xc518('0xa')](),controller[_0xc518('0x10')]);router[_0xc518('0x8')](_0xc518('0x11'),controller['getAvatar']);router['get'](_0xc518('0x12'),auth[_0xc518('0xa')](),controller[_0xc518('0x13')]);router[_0xc518('0x8')]('/:id/contacts',auth[_0xc518('0xa')](),controller['getContacts']);router[_0xc518('0x8')]('/:id/queues',auth[_0xc518('0xa')](),controller['getQueues']);router[_0xc518('0x8')](_0xc518('0x14'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0xc518('0x15')]);router['get'](_0xc518('0x16'),auth['isAuthenticated'](),controller[_0xc518('0x17')]);router[_0xc518('0x8')](_0xc518('0x18'),auth[_0xc518('0xa')](),controller[_0xc518('0x19')]);router['get']('/:id/chat/interactions',auth[_0xc518('0xa')](),controller[_0xc518('0x1a')]);router[_0xc518('0x8')](_0xc518('0x1b'),auth[_0xc518('0xa')](),controller['getOpenchannelInteractions']);router[_0xc518('0x8')]('/:id/mail/interactions',auth[_0xc518('0xa')](),controller['getMailInteractions']);router[_0xc518('0x8')](_0xc518('0x1c'),auth[_0xc518('0xa')](),controller[_0xc518('0x1d')]);router[_0xc518('0x8')](_0xc518('0x1e'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xc518('0x8')](_0xc518('0x1f'),auth[_0xc518('0xa')](),controller[_0xc518('0x20')]);router[_0xc518('0x8')]('/:id/teams',auth[_0xc518('0xa')](),controller[_0xc518('0x21')]);router[_0xc518('0x8')](_0xc518('0x22'),auth[_0xc518('0xa')](),controller[_0xc518('0x23')]);router['get'](_0xc518('0x24'),auth[_0xc518('0xa')](),controller[_0xc518('0x25')]);router[_0xc518('0x8')](_0xc518('0x26'),auth[_0xc518('0xa')](),controller[_0xc518('0x27')]);router['get'](_0xc518('0x28'),auth[_0xc518('0xa')](),controller['getFaxAccounts']);router[_0xc518('0x8')](_0xc518('0x29'),auth[_0xc518('0xa')](),controller[_0xc518('0x2a')]);router['get']('/:id/openchannel_accounts',auth[_0xc518('0xa')](),controller[_0xc518('0x2b')]);router['get']('/:id/sms_accounts',auth[_0xc518('0xa')](),controller[_0xc518('0x2c')]);router[_0xc518('0x8')](_0xc518('0x2d'),auth[_0xc518('0xa')](),controller[_0xc518('0x2e')]);router[_0xc518('0x8')](_0xc518('0x2f'),auth[_0xc518('0xa')](),controller[_0xc518('0x30')]);router[_0xc518('0x8')](_0xc518('0x31'),auth[_0xc518('0xa')](),controller[_0xc518('0x32')]);router[_0xc518('0x8')](_0xc518('0x33'),auth[_0xc518('0xa')](),controller[_0xc518('0x34')]);router['post'](_0xc518('0x35'),auth[_0xc518('0xa')](),controller[_0xc518('0x36')]);router[_0xc518('0x37')]('/',auth[_0xc518('0xa')](),controller[_0xc518('0x38')]);router['post']('/create_many',auth[_0xc518('0xa')](),controller['bulkCreate']);router[_0xc518('0x37')]('/:id/queues',auth[_0xc518('0xa')](),controller[_0xc518('0x39')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1137e2,_0x42bcef,_0x4a4998){_0x4a4998(null,path['join'](config[_0xc518('0x3a')],_0xc518('0x3b')));},'filename':function(_0x56f8e7,_0x47e4ee,_0x35eff5){_0x35eff5(null,util[_0xc518('0x3c')](_0xc518('0x3d'),Date[_0xc518('0x3e')](),_0x47e4ee[_0xc518('0x3f')]));}})});router['post'](_0xc518('0x11'),upload[_0xc518('0x40')]('file'),controller['addAvatar']);router['post']('/:id/login',auth[_0xc518('0xa')](),controller[_0xc518('0x41')]);router[_0xc518('0x37')](_0xc518('0x42'),auth[_0xc518('0xa')](),controller['logout']);router[_0xc518('0x37')](_0xc518('0x43'),auth[_0xc518('0xa')](),controller[_0xc518('0x44')]);router[_0xc518('0x37')]('/:id/unpause',auth[_0xc518('0xa')](),controller['unpause']);router[_0xc518('0x37')](_0xc518('0x45'),auth['isAuthenticated'](),controller[_0xc518('0x46')]);router['post'](_0xc518('0x47'),auth[_0xc518('0xa')](),controller[_0xc518('0x48')]);router[_0xc518('0x37')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xc518('0x49')]);router[_0xc518('0x37')](_0xc518('0x4a'),auth['isAuthenticated'](),controller[_0xc518('0x4b')]);router[_0xc518('0x37')](_0xc518('0x4c'),auth[_0xc518('0xa')](),controller[_0xc518('0x4d')]);router[_0xc518('0x37')](_0xc518('0x4e'),auth[_0xc518('0xa')](),controller['addOpenchannelInteractions']);router[_0xc518('0x37')](_0xc518('0x4f'),auth['isAuthenticated'](),controller[_0xc518('0x50')]);router[_0xc518('0x37')](_0xc518('0x28'),auth['isAuthenticated'](),controller[_0xc518('0x51')]);router[_0xc518('0x37')](_0xc518('0x29'),auth[_0xc518('0xa')](),controller[_0xc518('0x52')]);router[_0xc518('0x37')](_0xc518('0x53'),auth[_0xc518('0xa')](),controller[_0xc518('0x54')]);router['post']('/:id/sms_accounts',auth[_0xc518('0xa')](),controller[_0xc518('0x55')]);router[_0xc518('0x37')](_0xc518('0x2d'),auth[_0xc518('0xa')](),controller[_0xc518('0x56')]);router[_0xc518('0x37')](_0xc518('0x2f'),auth['isAuthenticated'](),controller[_0xc518('0x57')]);router[_0xc518('0x37')](_0xc518('0x33'),auth['isAuthenticated'](),controller['createApiKey']);router[_0xc518('0x58')](_0xc518('0x59'),auth['isAuthenticated'](),controller[_0xc518('0x5a')]);router[_0xc518('0x58')](_0xc518('0x5b'),auth[_0xc518('0xa')](),controller[_0xc518('0x5c')]);router[_0xc518('0x5d')](_0xc518('0x5e'),auth[_0xc518('0xa')](),controller[_0xc518('0x5f')]);router['delete']('/:id/teams',auth[_0xc518('0xa')](),controller[_0xc518('0x60')]);router[_0xc518('0x5d')]('/:id',auth[_0xc518('0xa')](),controller[_0xc518('0x61')]);router[_0xc518('0x5d')]('/:id/chat_interactions',auth[_0xc518('0xa')](),controller[_0xc518('0x62')]);router['delete'](_0xc518('0x63'),auth[_0xc518('0xa')](),controller[_0xc518('0x64')]);router[_0xc518('0x5d')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xc518('0x65')]);router['delete'](_0xc518('0x4c'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0xc518('0x4e'),auth[_0xc518('0xa')](),controller[_0xc518('0x66')]);router[_0xc518('0x5d')]('/:id/whatsapp_interactions',auth[_0xc518('0xa')](),controller[_0xc518('0x67')]);router[_0xc518('0x5d')]('/:id/fax_accounts',auth[_0xc518('0xa')](),controller[_0xc518('0x68')]);router[_0xc518('0x5d')](_0xc518('0x29'),auth[_0xc518('0xa')](),controller[_0xc518('0x69')]);router[_0xc518('0x5d')](_0xc518('0x53'),auth[_0xc518('0xa')](),controller[_0xc518('0x6a')]);router[_0xc518('0x5d')](_0xc518('0x6b'),auth[_0xc518('0xa')](),controller[_0xc518('0x6c')]);router[_0xc518('0x5d')](_0xc518('0x2d'),auth[_0xc518('0xa')](),controller['removeChatWebsites']);router[_0xc518('0x5d')](_0xc518('0x2f'),auth[_0xc518('0xa')](),controller[_0xc518('0x6d')]);router['delete'](_0xc518('0x33'),auth[_0xc518('0xa')](),controller[_0xc518('0x6e')]);router[_0xc518('0x37')](_0xc518('0x6f'),auth[_0xc518('0xa')](),controller[_0xc518('0x70')]);module['exports']=router; \ No newline at end of file +var _0x4c4a=['/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/whoami','/presence','getPresence','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','/:id','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x19dcdc,_0x1a9e3c){_0x19dcdc=_0x19dcdc-0x0;var _0x2eb6ed=_0x4c4a[_0x19dcdc];return _0x2eb6ed;};'use strict';var multer=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var path=require(_0xa4c4('0x2'));var timeout=require('connect-timeout');var express=require(_0xa4c4('0x3'));var router=express[_0xa4c4('0x4')]();var fs_extra=require(_0xa4c4('0x5'));var auth=require(_0xa4c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa4c4('0x7'));var controller=require('./user.controller');router[_0xa4c4('0x8')]('/',auth[_0xa4c4('0x9')](),controller['index']);router['get'](_0xa4c4('0xa'),auth['isAuthenticated'](),controller[_0xa4c4('0xb')]);router[_0xa4c4('0x8')](_0xa4c4('0xc'),auth['isAuthenticated'](),controller['whoami']);router[_0xa4c4('0x8')](_0xa4c4('0xd'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0xe')]);router[_0xa4c4('0x8')]('/:id',auth[_0xa4c4('0x9')](),controller['show']);router[_0xa4c4('0x8')](_0xa4c4('0xf'),controller[_0xa4c4('0x10')]);router[_0xa4c4('0x8')](_0xa4c4('0x11'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x12')]);router[_0xa4c4('0x8')](_0xa4c4('0x13'),auth['isAuthenticated'](),controller[_0xa4c4('0x14')]);router[_0xa4c4('0x8')](_0xa4c4('0x15'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x16')]);router[_0xa4c4('0x8')](_0xa4c4('0x17'),auth['isAuthenticated'](),controller[_0xa4c4('0x18')]);router[_0xa4c4('0x8')]('/:id/groups',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x19')]);router[_0xa4c4('0x8')](_0xa4c4('0x1a'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x1b')]);router[_0xa4c4('0x8')](_0xa4c4('0x1c'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x1d')]);router[_0xa4c4('0x8')](_0xa4c4('0x1e'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x1f')]);router[_0xa4c4('0x8')](_0xa4c4('0x20'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x21')]);router[_0xa4c4('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xa4c4('0x22')]);router[_0xa4c4('0x8')](_0xa4c4('0x23'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x24')]);router[_0xa4c4('0x8')]('/:id/fax/interactions',auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xa4c4('0x8')](_0xa4c4('0x25'),auth[_0xa4c4('0x9')](),controller['getWhatsappInteractions']);router[_0xa4c4('0x8')](_0xa4c4('0x26'),auth[_0xa4c4('0x9')](),controller['getTeams']);router[_0xa4c4('0x8')](_0xa4c4('0x27'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x28')]);router[_0xa4c4('0x8')]('/:id/agents',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x29')]);router[_0xa4c4('0x8')](_0xa4c4('0x2a'),auth[_0xa4c4('0x9')](),controller['getVoicePrefixes']);router[_0xa4c4('0x8')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['getFaxAccounts']);router['get'](_0xa4c4('0x2b'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x2c')]);router[_0xa4c4('0x8')](_0xa4c4('0x2d'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0xa4c4('0x2e'),auth[_0xa4c4('0x9')](),controller['getSmsAccounts']);router[_0xa4c4('0x8')](_0xa4c4('0x2f'),auth['isAuthenticated'](),controller[_0xa4c4('0x30')]);router[_0xa4c4('0x8')]('/:id/whatsapp_accounts',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x31')]);router[_0xa4c4('0x8')](_0xa4c4('0x32'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x33')]);router['get'](_0xa4c4('0x34'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x35')]);router[_0xa4c4('0x36')](_0xa4c4('0x13'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x37')]);router[_0xa4c4('0x36')]('/',auth['isAuthenticated'](),controller[_0xa4c4('0x38')]);router['post'](_0xa4c4('0x39'),auth[_0xa4c4('0x9')](),controller['bulkCreate']);router[_0xa4c4('0x36')](_0xa4c4('0x15'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x3a')]);var upload=multer({'storage':multer[_0xa4c4('0x3b')]({'destination':function(_0x227d10,_0x4cef59,_0xdd3751){_0xdd3751(null,path[_0xa4c4('0x3c')](config['root'],_0xa4c4('0x3d')));},'filename':function(_0x3f8a62,_0x34f1e7,_0x183023){_0x183023(null,util[_0xa4c4('0x3e')](_0xa4c4('0x3f'),Date[_0xa4c4('0x40')](),_0x34f1e7[_0xa4c4('0x41')]));}})});router[_0xa4c4('0x36')](_0xa4c4('0xf'),upload[_0xa4c4('0x42')](_0xa4c4('0x43')),controller['addAvatar']);router[_0xa4c4('0x36')](_0xa4c4('0x44'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x45')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0xa4c4('0x46')]);router['post'](_0xa4c4('0x47'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x48')]);router[_0xa4c4('0x36')](_0xa4c4('0x49'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x4a')]);router[_0xa4c4('0x36')](_0xa4c4('0x26'),auth[_0xa4c4('0x9')](),controller['addTeams']);router[_0xa4c4('0x36')](_0xa4c4('0x4b'),auth['isAuthenticated'](),controller[_0xa4c4('0x4c')]);router[_0xa4c4('0x36')](_0xa4c4('0x4d'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x4e')]);router[_0xa4c4('0x36')](_0xa4c4('0x4f'),auth['isAuthenticated'](),controller[_0xa4c4('0x50')]);router[_0xa4c4('0x36')](_0xa4c4('0x51'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x52')]);router[_0xa4c4('0x36')](_0xa4c4('0x53'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x54')]);router[_0xa4c4('0x36')]('/:id/whatsapp_interactions',auth[_0xa4c4('0x9')](),controller['addWhatsappInteractions']);router[_0xa4c4('0x36')](_0xa4c4('0x55'),auth[_0xa4c4('0x9')](),controller['addFaxAccounts']);router[_0xa4c4('0x36')](_0xa4c4('0x2b'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x56')]);router[_0xa4c4('0x36')](_0xa4c4('0x2d'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x57')]);router[_0xa4c4('0x36')](_0xa4c4('0x2e'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x58')]);router[_0xa4c4('0x36')](_0xa4c4('0x2f'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x59')]);router[_0xa4c4('0x36')](_0xa4c4('0x5a'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x5b')]);router[_0xa4c4('0x36')]('/:id/api_key',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x5c')]);router['put'](_0xa4c4('0x5d'),auth['isAuthenticated'](),controller['update']);router[_0xa4c4('0x5e')](_0xa4c4('0x5f'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x60')]);router[_0xa4c4('0x61')](_0xa4c4('0x15'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x62')]);router[_0xa4c4('0x61')](_0xa4c4('0x26'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x63')]);router['delete'](_0xa4c4('0x5d'),auth['isAuthenticated'](),controller[_0xa4c4('0x64')]);router[_0xa4c4('0x61')]('/:id/chat_interactions',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x65')]);router[_0xa4c4('0x61')](_0xa4c4('0x4d'),auth['isAuthenticated'](),controller[_0xa4c4('0x66')]);router[_0xa4c4('0x61')](_0xa4c4('0x4f'),auth['isAuthenticated'](),controller[_0xa4c4('0x67')]);router['delete'](_0xa4c4('0x51'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x68')]);router['delete'](_0xa4c4('0x53'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x69')]);router['delete'](_0xa4c4('0x6a'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x6b')]);router[_0xa4c4('0x61')](_0xa4c4('0x55'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xa4c4('0x61')](_0xa4c4('0x2b'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x6c')]);router[_0xa4c4('0x61')](_0xa4c4('0x2d'),auth[_0xa4c4('0x9')](),controller['removeOpenchannelAccounts']);router[_0xa4c4('0x61')](_0xa4c4('0x2e'),auth['isAuthenticated'](),controller[_0xa4c4('0x6d')]);router['delete']('/:id/chat_websites',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x6e')]);router['delete']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xa4c4('0x6f')]);router['delete']('/:id/api_key',auth['isAuthenticated'](),controller[_0xa4c4('0x70')]);router[_0xa4c4('0x36')](_0xa4c4('0x71'),auth[_0xa4c4('0x9')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8278677..508d9cb 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 _0x754d=['phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','telephone','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','join','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]','never','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','TEXT','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL'];(function(_0x2db94e,_0x326e66){var _0x985aca=function(_0x5c4cf6){while(--_0x5c4cf6){_0x2db94e['push'](_0x2db94e['shift']());}};_0x985aca(++_0x326e66);}(_0x754d,0x1c4));var _0xd754=function(_0x4fb6c1,_0x1fcc9a){_0x4fb6c1=_0x4fb6c1-0x0;var _0x5f413b=_0x754d[_0x4fb6c1];return _0x5f413b;};'use strict';var Sequelize=require(_0xd754('0x0'));var moment=require(_0xd754('0x1'));var util=require(_0xd754('0x2'));var _=require('lodash');module[_0xd754('0x3')]={'name':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'unique':_0xd754('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x34c70a){this[_0xd754('0x6')](_0xd754('0x5'),_0x34c70a);this[_0xd754('0x6')](_0xd754('0x7'),_0x34c70a);},'comment':_0xd754('0x8')},'fullname':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'set':function(_0x17d9cd){this[_0xd754('0x6')]('fullname',_0x17d9cd);this[_0xd754('0x6')](_0xd754('0x9'),util[_0xd754('0xa')](_0xd754('0xb'),_0x17d9cd,this['getDataValue'](_0xd754('0xc'))));}},'alias':{'type':Sequelize[_0xd754('0x4')]},'email':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'unique':_0xd754('0xd'),'validate':{'isEmail':!![]},'set':function(_0x43140a){if(_0x43140a){this['setDataValue'](_0xd754('0xd'),_0x43140a[_0xd754('0xe')]());}}},'role':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x10'),_0xd754('0x11'),'agent',_0xd754('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':![],'unique':_0xd754('0xc'),'set':function(_0x30ed65){this[_0xd754('0x6')](_0xd754('0xc'),_0x30ed65);this['setDataValue'](_0xd754('0x14'),_0x30ed65);this[_0xd754('0x6')](_0xd754('0x9'),util[_0xd754('0xa')](_0xd754('0xb'),this['getDataValue'](_0xd754('0x15')),_0x30ed65));}},'salt':{'type':Sequelize[_0xd754('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd754('0x4')]},'address':{'type':Sequelize[_0xd754('0x4')]},'zipcode':{'type':Sequelize[_0xd754('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xd754('0x4')]},'country':{'type':Sequelize[_0xd754('0x4')]},'online':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd754('0x17')]},'voicePause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xd754('0x17')]},'chatCapacity':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd754('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd754('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![],'defaultValue':_0xd754('0x18')},'ipaddr':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xd754('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x19'),_0xd754('0x11'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd754('0x1a')},'callingpres':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x1b'),_0xd754('0x1c'),_0xd754('0x1d'),'ALLOWED',_0xd754('0x1e'),_0xd754('0x1f'),_0xd754('0x20'),_0xd754('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![],'defaultValue':_0xd754('0x22'),'set':function(_0x41681e){this[_0xd754('0x6')](_0xd754('0x23'),_0x41681e?_0x41681e['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xd754('0x24')](_0xd754('0x23'))[_0xd754('0x25')](','):null;},'comment':_0xd754('0x26')},'dtmfmode':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x27'),_0xd754('0x28'),'shortinfo',_0xd754('0x29'),_0xd754('0x2a')),'allowNull':!![],'defaultValue':_0xd754('0x27')},'directmedia':{'type':Sequelize[_0xd754('0xf')]('yes','no',_0xd754('0x2b'),_0xd754('0x2c'),_0xd754('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd754('0x2f'),'set':function(_0x204644){this[_0xd754('0x6')]('nat',_0x204644?_0x204644[_0xd754('0x30')](','):null);},'get':function(){return this[_0xd754('0x24')](_0xd754('0x31'))?this[_0xd754('0x24')](_0xd754('0x31'))[_0xd754('0x25')](','):null;},'comment':_0xd754('0x32')},'callgroup':{'type':Sequelize[_0xd754('0x4')]},'namedcallgroup':{'type':Sequelize[_0xd754('0x4')]},'pickupgroup':{'type':Sequelize[_0xd754('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xd754('0x4')]},'language':{'type':Sequelize[_0xd754('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd754('0x4')]},'disallow':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'defaultValue':_0xd754('0x33')},'allow':{'type':Sequelize[_0xd754('0x4')],'allowNull':![],'defaultValue':_0xd754('0x34'),'set':function(_0x4a7201){this['setDataValue'](_0xd754('0x35'),_0x4a7201?_0x4a7201[_0xd754('0x30')](';'):_0xd754('0x34'));},'get':function(){return this[_0xd754('0x24')](_0xd754('0x35'))?this[_0xd754('0x24')]('allow')[_0xd754('0x25')](';'):null;},'comment':_0xd754('0x36')},'autoframing':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![],'set':function(_0x7a7dfc){this[_0xd754('0x6')]('insecure',_0x7a7dfc?_0x7a7dfc[_0xd754('0x30')](','):null);},'get':function(){return this[_0xd754('0x24')]('insecure')?this[_0xd754('0x24')]('insecure')[_0xd754('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no',_0xd754('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xd754('0x2e')},'busylevel':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd754('0x38'),_0xd754('0x39'),_0xd754('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd754('0xf')]('uac',_0xd754('0x3b')),'allowNull':!![],'defaultValue':_0xd754('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xd754('0x2e')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no',_0xd754('0x3c'),_0xd754('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xd754('0x3e'),_0xd754('0x3f'),_0xd754('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xd754('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd754('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd754('0xf')](_0xd754('0x2e'),'no','nonat',_0xd754('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xd754('0x17')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd754('0x41')]},'showWebBar':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0,'set':function(_0xbb0c1b){this[_0xd754('0x6')]('showWebBar',_0xbb0c1b);var _0x1393c4=this['get']({'plain':!![]});switch(_0xbb0c1b){case 0x0:case 0x1:var _0x78cde3=_0x1393c4[_0xd754('0x23')]?_['isArray'](_0x1393c4['transport'])?_0x1393c4['transport'][_0xd754('0x30')]():_0x1393c4['transport']:'udp';if(_0x78cde3==='wss'){_0x78cde3=_0xd754('0x22');}this[_0xd754('0x6')]('transport',_0x78cde3);this['setDataValue'](_0xd754('0x42'),'no');this[_0xd754('0x6')](_0xd754('0x43'),null);this[_0xd754('0x6')](_0xd754('0x44'),null);this[_0xd754('0x6')](_0xd754('0x45'),null);this['setDataValue'](_0xd754('0x46'),null);this[_0xd754('0x6')](_0xd754('0x47'),null);this[_0xd754('0x6')](_0xd754('0x48'),null);this[_0xd754('0x6')](_0xd754('0x49'),null);this[_0xd754('0x6')](_0xd754('0x4a'),null);this[_0xd754('0x6')](_0xd754('0x4b'),'no');break;case 0x2:this[_0xd754('0x6')](_0xd754('0x23'),_0xd754('0x4c'));this[_0xd754('0x6')](_0xd754('0x42'),'yes');this['setDataValue'](_0xd754('0x43'),_0xd754('0x2e'));this[_0xd754('0x6')]('force_avp',_0xd754('0x2e'));this[_0xd754('0x6')]('icesupport',_0xd754('0x2e'));this[_0xd754('0x6')](_0xd754('0x46'),_0xd754('0x2e'));this[_0xd754('0x6')](_0xd754('0x47'),'no');this['setDataValue']('dtlssetup','actpass');this[_0xd754('0x6')](_0xd754('0x49'),_0x1393c4[_0xd754('0x49')]||_0xd754('0x4d'));this[_0xd754('0x6')]('dtlsprivatekey',_0x1393c4[_0xd754('0x4a')]||_0xd754('0x4e'));this[_0xd754('0x6')](_0xd754('0x4b'),_0xd754('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xd754('0x41')],'set':function(_0x4f71b2){this[_0xd754('0x6')](_0xd754('0x4f'),_0x4f71b2?_0x4f71b2['join'](','):[]);},'get':function(){return this[_0xd754('0x24')]('permissions')?_[_0xd754('0x50')](this[_0xd754('0x24')](_0xd754('0x4f'))['split'](','),function(_0x370c3c){return parseInt(_0x370c3c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd754('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd754('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xd754('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd754('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd754('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd754('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd754('0x51')],'get':function(){return this['getDataValue'](_0xd754('0x52'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xd754('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xd754('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![],'set':function(_0x3eaf4d){if(typeof _0x3eaf4d==='string'){var _0x48a0a7=_0x3eaf4d==='1'?!![]:_0x3eaf4d==='0'?![]:_0x3eaf4d==='true'?!![]:_0x3eaf4d===_0xd754('0x53')?![]:![];this[_0xd754('0x6')]('screenrecording',_0x48a0a7);}else{this[_0xd754('0x6')](_0xd754('0x54'),_0x3eaf4d);}}},'blocked':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![],'set':function(_0x13beaa){this[_0xd754('0x6')](_0xd754('0x55'),_0x13beaa);if(_0x13beaa===!![]){this['setDataValue'](_0xd754('0x56'),moment());this[_0xd754('0x6')](_0xd754('0x57'),0x0);}else{this[_0xd754('0x6')](_0xd754('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xd754('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd754('0x13')](0x5)[_0xd754('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd754('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xd754('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xd754('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xae2c=['loginAttempts','UNSIGNED','moment','util','STRING','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','user','agent','telephone','INTEGER','getDataValue','BOOLEAN','DATE','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','update','outgoing','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','isArray','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','avpf','actpass','/etc/pki/tls/certs/motion.crt','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt'];(function(_0x3e2e04,_0x54e9ec){var _0x5020bd=function(_0x133fcf){while(--_0x133fcf){_0x3e2e04['push'](_0x3e2e04['shift']());}};_0x5020bd(++_0x54e9ec);}(_0xae2c,0x1ba));var _0xcae2=function(_0x110b52,_0x7c04e5){_0x110b52=_0x110b52-0x0;var _0x473323=_0xae2c[_0x110b52];return _0x473323;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcae2('0x0'));var util=require(_0xcae2('0x1'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xcae2('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4dc26c){this[_0xcae2('0x3')]('name',_0x4dc26c);this[_0xcae2('0x3')](_0xcae2('0x4'),_0x4dc26c);},'comment':_0xcae2('0x5')},'fullname':{'type':Sequelize[_0xcae2('0x2')],'allowNull':![],'set':function(_0x18e6d9){this[_0xcae2('0x3')](_0xcae2('0x6'),_0x18e6d9);this[_0xcae2('0x3')](_0xcae2('0x7'),util[_0xcae2('0x8')](_0xcae2('0x9'),_0x18e6d9,this['getDataValue'](_0xcae2('0xa'))));}},'alias':{'type':Sequelize[_0xcae2('0x2')]},'email':{'type':Sequelize[_0xcae2('0x2')],'allowNull':![],'unique':_0xcae2('0xb'),'validate':{'isEmail':!![]},'set':function(_0x1b30a0){if(_0x1b30a0){this['setDataValue'](_0xcae2('0xb'),_0x1b30a0[_0xcae2('0xc')]());}}},'role':{'type':Sequelize[_0xcae2('0xd')]('admin',_0xcae2('0xe'),_0xcae2('0xf'),_0xcae2('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xcae2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':![],'unique':_0xcae2('0xa'),'set':function(_0x3bdc3f){this[_0xcae2('0x3')](_0xcae2('0xa'),_0x3bdc3f);this[_0xcae2('0x3')]('accountcode',_0x3bdc3f);this['setDataValue'](_0xcae2('0x7'),util[_0xcae2('0x8')](_0xcae2('0x9'),this[_0xcae2('0x12')](_0xcae2('0x6')),_0x3bdc3f));}},'salt':{'type':Sequelize[_0xcae2('0x2')]},'phone':{'type':Sequelize[_0xcae2('0x2')]},'mobile':{'type':Sequelize[_0xcae2('0x2')]},'address':{'type':Sequelize[_0xcae2('0x2')]},'zipcode':{'type':Sequelize[_0xcae2('0x2')]},'userpic':{'type':Sequelize[_0xcae2('0x2')]},'city':{'type':Sequelize[_0xcae2('0x2')]},'country':{'type':Sequelize[_0xcae2('0x2')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xcae2('0x14')]},'chatCapacity':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xcae2('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcae2('0x15')},'ipaddr':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0xcae2('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xcae2('0xd')]('friend',_0xcae2('0xe'),_0xcae2('0x16')),'allowNull':!![],'defaultValue':_0xcae2('0x17')},'context':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![],'defaultValue':_0xcae2('0x18')},'callingpres':{'type':Sequelize['ENUM'](_0xcae2('0x19'),_0xcae2('0x1a'),_0xcae2('0x1b'),'ALLOWED','PROHIB_NOT_SCREENED',_0xcae2('0x1c'),_0xcae2('0x1d'),_0xcae2('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcae2('0x1f'),'set':function(_0xd12755){this[_0xcae2('0x3')]('transport',_0xd12755?_0xd12755['join'](','):null);},'get':function(){return this[_0xcae2('0x12')]('transport')?this[_0xcae2('0x12')](_0xcae2('0x20'))[_0xcae2('0x21')](','):null;},'comment':_0xcae2('0x22')},'dtmfmode':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x23'),'info','shortinfo',_0xcae2('0x24'),_0xcae2('0x25')),'allowNull':!![],'defaultValue':_0xcae2('0x23')},'directmedia':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no','nonat',_0xcae2('0x27'),_0xcae2('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcae2('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![],'defaultValue':_0xcae2('0x29'),'set':function(_0x3c2d3f){this['setDataValue']('nat',_0x3c2d3f?_0x3c2d3f[_0xcae2('0x2a')](','):null);},'get':function(){return this[_0xcae2('0x12')](_0xcae2('0x2b'))?this[_0xcae2('0x12')](_0xcae2('0x2b'))[_0xcae2('0x21')](','):null;},'comment':_0xcae2('0x2c')},'callgroup':{'type':Sequelize[_0xcae2('0x2')]},'namedcallgroup':{'type':Sequelize[_0xcae2('0x2')]},'pickupgroup':{'type':Sequelize[_0xcae2('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcae2('0x2')]},'disallow':{'type':Sequelize[_0xcae2('0x2')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xcae2('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x55f2eb){this[_0xcae2('0x3')](_0xcae2('0x2d'),_0x55f2eb?_0x55f2eb['join'](';'):_0xcae2('0x2e'));},'get':function(){return this[_0xcae2('0x12')]('allow')?this[_0xcae2('0x12')](_0xcae2('0x2d'))[_0xcae2('0x21')](';'):null;},'comment':_0xcae2('0x2f')},'autoframing':{'type':Sequelize['ENUM'](_0xcae2('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![],'set':function(_0x5b5df0){this['setDataValue'](_0xcae2('0x30'),_0x5b5df0?_0x5b5df0[_0xcae2('0x2a')](','):null);},'get':function(){return this[_0xcae2('0x12')](_0xcae2('0x30'))?this[_0xcae2('0x12')](_0xcae2('0x30'))[_0xcae2('0x21')](','):null;},'comment':_0xcae2('0x31')},'trustrpid':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no',_0xcae2('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![],'defaultValue':_0xcae2('0x33')},'amaflags':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![],'defaultValue':_0xcae2('0x26')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xcae2('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xcae2('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x35'),_0xcae2('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x37'),_0xcae2('0x38')),'allowNull':!![],'defaultValue':_0xcae2('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![],'defaultValue':_0xcae2('0x26')},'keepalive':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xcae2('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xcae2('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcae2('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xcae2('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xcae2('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no',_0xcae2('0x39'),_0xcae2('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xcae2('0xd')]('active',_0xcae2('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xcae2('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xcae2('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xcae2('0xd')](_0xcae2('0x26'),'no','nonat',_0xcae2('0x27'),_0xcae2('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xcae2('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0xcae2('0x14')]},'passwordResetAt':{'type':Sequelize[_0xcae2('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x1bfedc){this[_0xcae2('0x3')](_0xcae2('0x3d'),_0x1bfedc);var _0x54e92d=this[_0xcae2('0x3e')]({'plain':!![]});switch(_0x1bfedc){case 0x0:case 0x1:var _0x5e2312=_0x54e92d['transport']?_[_0xcae2('0x3f')](_0x54e92d[_0xcae2('0x20')])?_0x54e92d[_0xcae2('0x20')][_0xcae2('0x2a')]():_0x54e92d[_0xcae2('0x20')]:'udp';if(_0x5e2312==='wss'){_0x5e2312=_0xcae2('0x1f');}this[_0xcae2('0x3')](_0xcae2('0x20'),_0x5e2312);this[_0xcae2('0x3')](_0xcae2('0x40'),'no');this[_0xcae2('0x3')]('avpf',null);this['setDataValue'](_0xcae2('0x41'),null);this[_0xcae2('0x3')](_0xcae2('0x42'),null);this[_0xcae2('0x3')](_0xcae2('0x43'),null);this[_0xcae2('0x3')](_0xcae2('0x44'),null);this[_0xcae2('0x3')](_0xcae2('0x45'),null);this[_0xcae2('0x3')](_0xcae2('0x46'),null);this['setDataValue'](_0xcae2('0x47'),null);this[_0xcae2('0x3')](_0xcae2('0x48'),'no');break;case 0x2:this['setDataValue'](_0xcae2('0x20'),_0xcae2('0x49'));this[_0xcae2('0x3')](_0xcae2('0x40'),_0xcae2('0x26'));this[_0xcae2('0x3')](_0xcae2('0x4a'),_0xcae2('0x26'));this[_0xcae2('0x3')]('force_avp','yes');this[_0xcae2('0x3')](_0xcae2('0x42'),_0xcae2('0x26'));this[_0xcae2('0x3')](_0xcae2('0x43'),_0xcae2('0x26'));this['setDataValue']('dtlsverify','no');this[_0xcae2('0x3')](_0xcae2('0x45'),_0xcae2('0x4b'));this['setDataValue'](_0xcae2('0x46'),_0x54e92d[_0xcae2('0x46')]||_0xcae2('0x4c'));this[_0xcae2('0x3')](_0xcae2('0x47'),_0x54e92d['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xcae2('0x3')]('rtcp_mux',_0xcae2('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0xcae2('0x4d')],'set':function(_0x40bbb8){this[_0xcae2('0x3')](_0xcae2('0x4e'),_0x40bbb8?_0x40bbb8[_0xcae2('0x2a')](','):[]);},'get':function(){return this['getDataValue'](_0xcae2('0x4e'))?_['map'](this['getDataValue']('permissions')[_0xcae2('0x21')](','),function(_0x41fd07){return parseInt(_0x41fd07,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xcae2('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xcae2('0x2')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xcae2('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xcae2('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xcae2('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xcae2('0x4f')],'get':function(){return this[_0xcae2('0x12')](_0xcae2('0x50'))?this['getDataValue'](_0xcae2('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xcae2('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![],'set':function(_0x5c50d0){if(typeof _0x5c50d0==='string'){var _0x5edff0=_0x5c50d0==='1'?!![]:_0x5c50d0==='0'?![]:_0x5c50d0===_0xcae2('0x51')?!![]:_0x5c50d0===_0xcae2('0x52')?![]:![];this['setDataValue'](_0xcae2('0x53'),_0x5edff0);}else{this[_0xcae2('0x3')]('screenrecording',_0x5c50d0);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x13d0b2){this[_0xcae2('0x3')](_0xcae2('0x54'),_0x13d0b2);if(_0x13d0b2===!![]){this['setDataValue'](_0xcae2('0x55'),moment());this[_0xcae2('0x3')](_0xcae2('0x56'),0x0);}else{this[_0xcae2('0x3')](_0xcae2('0x55'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xcae2('0x11')](0x5)[_0xcae2('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xcae2('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xcae2('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index dc8e778..a773249 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 _0xd67d=['oldPassword','newPassword','authenticate','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','validatePasswordHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','emit','Queue:save','voice','findAll','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','getOptions','CmList','List','color','tag','getQueues','model','keys','filters','intersection','fields','order','sort','pick','Queue','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','MemberReport','LOGININPAUSE','logout','pause','QueuePause','type','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','Team','getTeams','resolve','getAssociatedQueues','flattenDeep','addAgent','Voice','penalty','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','TeamVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$lt','$lte','$ne','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','firstName','CmContact','Contact','VoiceQueue','getApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','token','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','toString','col','asc','substring','uniqBy','orderBy','getRealtimeAgents','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','messengerSoundNotification','enabled','moment','util','path','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','http','sendStatus','end','status','offset','undefined','limit','count','json','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','role','userNotification:recalc:','get','Users','Agents','agent','Telephones','filter','ignore','map','value','includes','find','name','UserProfileResource','destroy','stack','send','rawAttributes','fieldName','key','salt','previousPasswords','resetPasswordToken','md5secret','where','User','query','include','true','UserSetting','userSetting','attributes','rows','push','dataValues','fax','mail','openchannel','whatsapp','all','show','params','includeAll','merge','options','chat','sms','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','password','max','isNil','min_internal','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)','sequelize','QueryTypes','SELECT','length','from','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','105','107','100','111','115','create','Unauthorized','user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','telephone','UserProfileSection','isEmpty','changePassword'];(function(_0x11e707,_0x1a8a3f){var _0x431464=function(_0x55b9d3){while(--_0x55b9d3){_0x11e707['push'](_0x11e707['shift']());}};_0x431464(++_0x1a8a3f);}(_0xd67d,0xfa));var _0xdd67=function(_0x571852,_0x34ae1f){_0x571852=_0x571852-0x0;var _0x1ec365=_0xd67d[_0x571852];return _0x1ec365;};'use strict';var moment=require(_0xdd67('0x0'));var util=require(_0xdd67('0x1'));var path=require(_0xdd67('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdd67('0x3'));var Redis=require(_0xdd67('0x4'));var jayson=require('jayson/promise');var authService=require(_0xdd67('0x5'));var contacts=require(_0xdd67('0x6'));var qs=require(_0xdd67('0x7'));var rta=require(_0xdd67('0x8'));var logger=require('../../config/logger')('api');var utils=require(_0xdd67('0x9'));var config=require('../../config/environment');var licenseUtil=require(_0xdd67('0xa'));var APIBadRequestError=require(_0xdd67('0xb'))[_0xdd67('0xc')];var APINotFoundError=require('../../errors/api')[_0xdd67('0xd')];var APIForbiddenError=require(_0xdd67('0xb'))[_0xdd67('0xe')];var APIHandleError=require(_0xdd67('0xb'))[_0xdd67('0xf')];var db=require(_0xdd67('0x10'))['db'];var socket=require(_0xdd67('0x11'))(new Redis(config['redis']));require(_0xdd67('0x12'))[_0xdd67('0x13')](socket);config[_0xdd67('0x14')]=_[_0xdd67('0x15')](config[_0xdd67('0x14')],{'host':_0xdd67('0x16'),'port':0x18eb});var amiClient=jayson['client'][_0xdd67('0x17')]({'port':0x232a});var values;function respondWithStatusCode(_0x410519,_0x3ed9b7){_0x3ed9b7=_0x3ed9b7||0xcc;return function(_0x4ac5b9){if(_0x4ac5b9){return _0x410519[_0xdd67('0x18')](_0x3ed9b7);}return _0x410519['status'](_0x3ed9b7)[_0xdd67('0x19')]();};}function respondWithResult(_0x2a4978,_0x318322){_0x318322=_0x318322||0xc8;return function(_0x4a60c1){if(_0x4a60c1){return _0x2a4978[_0xdd67('0x1a')](_0x318322)['json'](_0x4a60c1);}};}function respondWithFilteredResult(_0x843772,_0x216e5f){return function(_0x1ca71d){if(_0x1ca71d){var _0x29bd9b=typeof _0x216e5f[_0xdd67('0x1b')]===_0xdd67('0x1c')&&typeof _0x216e5f[_0xdd67('0x1d')]===_0xdd67('0x1c');var _0x40726d=_0x1ca71d[_0xdd67('0x1e')];var _0x461f4d=_0x29bd9b?0x0:_0x216e5f[_0xdd67('0x1b')];var _0x46b85b=_0x29bd9b?_0x1ca71d[_0xdd67('0x1e')]:_0x216e5f[_0xdd67('0x1b')]+_0x216e5f[_0xdd67('0x1d')];var _0x421432;if(_0x46b85b>=_0x40726d){_0x46b85b=_0x40726d;_0x421432=0xc8;}else{_0x421432=0xce;}_0x843772[_0xdd67('0x1a')](_0x421432);return _0x843772['set']('Content-Range',_0x461f4d+'-'+_0x46b85b+'/'+_0x40726d)[_0xdd67('0x1f')](_0x1ca71d);}return null;};}function respondWithRpcPromise(_0x4c7535,_0x1cf007,_0x1625b1,_0xcdbc68){return new Promise(function(_0x567153,_0xd19a06){var _0x4e5718=_0xcdbc68||amiClient;return _0x4e5718[_0xdd67('0x20')](_0x4c7535,_0x1625b1)[_0xdd67('0x21')](function(_0x13cfb9){logger[_0xdd67('0x22')](_0xdd67('0x23'),_0x1cf007,'request\x20sent');logger[_0xdd67('0x24')](_0xdd67('0x25'),_0x1cf007,_0xdd67('0x26'),JSON[_0xdd67('0x27')](_0x13cfb9));if(_0x13cfb9['error']){if(_0x13cfb9[_0xdd67('0x28')][_0xdd67('0x29')]===0x1f4){logger['error'](_0xdd67('0x23'),_0x1cf007,_0x13cfb9[_0xdd67('0x28')]['message']);return _0xd19a06(_0x13cfb9[_0xdd67('0x28')][_0xdd67('0x2a')]);}logger[_0xdd67('0x28')](_0xdd67('0x23'),_0x1cf007,_0x13cfb9['error']['message']);return _0x567153(_0x13cfb9['error'][_0xdd67('0x2a')]);}else{logger[_0xdd67('0x22')](_0xdd67('0x23'),_0x1cf007,'request\x20sent');_0x567153(_0x13cfb9[_0xdd67('0x2b')][_0xdd67('0x2a')]);}})[_0xdd67('0x2c')](function(_0x231f52){logger[_0xdd67('0x28')]('User,\x20%s,\x20%s',_0x1cf007,_0x231f52);_0xd19a06(_0x231f52);});});}function saveUpdates(_0xc18a01){return function(_0xcb6ceb){if(_0xcb6ceb){return _0xcb6ceb[_0xdd67('0x2d')](_0xc18a01)[_0xdd67('0x21')](function(_0x1444d5){if(_0x1444d5[_0xdd67('0x2e')]==='agent'){socket['emit'](_0xdd67('0x2f')+_0x1444d5['id'],_0x1444d5);}return _0x1444d5;});}return null;};}function removeEntity(_0x26cd92,_0x426983){return function(_0x2d8d04){if(_0x2d8d04){return _0x2d8d04['destroy']({'transaction':_0x426983})['then'](function(){var _0x34f9e4=_0x2d8d04[_0xdd67('0x30')]({'plain':!![]});if(_0x34f9e4['role']==='admin')return;var _0x524483=[{'name':_0xdd67('0x31'),'value':'user','ignore':!![]},{'name':_0xdd67('0x32'),'value':_0xdd67('0x33'),'ignore':![]},{'name':_0xdd67('0x34'),'value':'telephone','ignore':![]}];var _0xd51125=_(_0x524483)[_0xdd67('0x35')](_0xdd67('0x36'))[_0xdd67('0x37')]('value')[_0xdd67('0x38')]();if(_[_0xdd67('0x39')](_0xd51125,_0x34f9e4[_0xdd67('0x2e')])){return;}var _0x1b404e=_[_0xdd67('0x3a')](_0x524483,['value',_0x34f9e4[_0xdd67('0x2e')]])[_0xdd67('0x3b')];return db[_0xdd67('0x3c')][_0xdd67('0x3d')]({'where':{'type':_0x1b404e,'resourceId':_0x34f9e4['id']},'transaction':_0x426983})[_0xdd67('0x21')](function(){return _0x2d8d04;});})[_0xdd67('0x21')](function(){_0x26cd92[_0xdd67('0x1a')](0xcc)[_0xdd67('0x19')]();});}};}function handleEntityNotFound(_0x1164bc){return function(_0x1079a4){if(!_0x1079a4){_0x1164bc[_0xdd67('0x18')](0x194);}return _0x1079a4;};}function handleError(_0x91081b,_0x4252ed){_0x4252ed=_0x4252ed||0x1f4;return function(_0x46b58c){logger['error'](_0x46b58c[_0xdd67('0x3e')]);if(_0x46b58c['name']){delete _0x46b58c[_0xdd67('0x3b')];}_0x91081b[_0xdd67('0x1a')](_0x4252ed)[_0xdd67('0x3f')](_0x46b58c);};}function getUserAttributes(){return _(db['User'][_0xdd67('0x40')])[_0xdd67('0x37')](function(_0x4f5c54){return{'name':_0x4f5c54[_0xdd67('0x41')],'type':_0x4f5c54['type'][_0xdd67('0x42')]};})[_0xdd67('0x35')](function(_0x324868){return!['password',_0xdd67('0x43'),_0xdd67('0x44'),_0xdd67('0x45'),'resetPasswordExpires',_0xdd67('0x46')]['includes'](_0x324868[_0xdd67('0x3b')]);})[_0xdd67('0x38')]();}exports['index']=function(_0x192eee,_0x4808ed){var _0x11cb2a={},_0x466ca7={'count':0x0,'rows':[]};var _0x382bbf=getUserAttributes();_0x11cb2a=qs['getOptions'](_0x382bbf,_0x192eee);var _0x358fc1={'where':_0x11cb2a[_0xdd67('0x47')]};return db[_0xdd67('0x48')][_0xdd67('0x1e')](_0x358fc1)[_0xdd67('0x21')](function(_0x4f93ff){_0x466ca7[_0xdd67('0x1e')]=_0x4f93ff;if(_0x192eee[_0xdd67('0x49')]['includeAll']){_0x11cb2a[_0xdd67('0x4a')]=[{'all':!![]}];}if(_0x192eee[_0xdd67('0x49')]['userSetting']===_0xdd67('0x4b')){_0x11cb2a['include']=[{'model':db[_0xdd67('0x4c')],'as':_0xdd67('0x4d')}];}if(!_['includes'](_0x11cb2a[_0xdd67('0x4e')],'id')){_0x11cb2a[_0xdd67('0x4e')]['push']('id');}return db[_0xdd67('0x48')]['findAll'](_0x11cb2a);})[_0xdd67('0x21')](function(_0x2eb66e){_0x466ca7[_0xdd67('0x4f')]=_0x2eb66e;if(_0x192eee[_0xdd67('0x49')]['openTabs']===_0xdd67('0x4b')){var _0x2f8c09=[];for(var _0x2d3303=0x0;_0x2d3303<_0x466ca7[_0xdd67('0x4f')]['length'];_0x2d3303++){_0x2f8c09[_0xdd67('0x50')](get_open_tabs('chat',_0x466ca7['rows'][_0x2d3303]['dataValues']));_0x2f8c09[_0xdd67('0x50')](get_open_tabs('sms',_0x466ca7[_0xdd67('0x4f')][_0x2d3303][_0xdd67('0x51')]));_0x2f8c09[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x52'),_0x466ca7[_0xdd67('0x4f')][_0x2d3303][_0xdd67('0x51')]));_0x2f8c09[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x53'),_0x466ca7[_0xdd67('0x4f')][_0x2d3303][_0xdd67('0x51')]));_0x2f8c09[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x54'),_0x466ca7[_0xdd67('0x4f')][_0x2d3303][_0xdd67('0x51')]));_0x2f8c09[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x55'),_0x466ca7['rows'][_0x2d3303][_0xdd67('0x51')]));}return Promise[_0xdd67('0x56')](_0x2f8c09)[_0xdd67('0x21')](function(){return _0x466ca7;});}else{return _0x466ca7;}})['then'](respondWithFilteredResult(_0x4808ed,_0x11cb2a))[_0xdd67('0x2c')](handleError(_0x4808ed,null));};exports[_0xdd67('0x57')]=function(_0x240690,_0x42a4a3){var _0x4d4963=getUserAttributes();_0x240690[_0xdd67('0x49')]['id']=_0x240690[_0xdd67('0x58')]['id'];var _0x391108=qs['getOptions'](_0x4d4963,_0x240690);if(_0x240690[_0xdd67('0x49')][_0xdd67('0x59')]){_0x391108[_0xdd67('0x4a')]=[{'all':!![]}];}if(_0x240690[_0xdd67('0x49')][_0xdd67('0x4d')]===_0xdd67('0x4b')){_0x391108[_0xdd67('0x4a')]=[{'model':db[_0xdd67('0x4c')],'as':_0xdd67('0x4d')}];}_0x391108=_[_0xdd67('0x5a')]({},_0x391108,_0x240690[_0xdd67('0x5b')]);if(!_[_0xdd67('0x39')](_0x391108['attributes'],'id')){_0x391108[_0xdd67('0x4e')][_0xdd67('0x50')]('id');}return db[_0xdd67('0x48')][_0xdd67('0x3a')](_0x391108)[_0xdd67('0x21')](handleEntityNotFound(_0x42a4a3,null))[_0xdd67('0x21')](function(_0x57faab){var _0x5b4180=[];values=_0x57faab;if(_0x240690['query']['openTabs']==='true'){_0x5b4180[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x5c'),_0x57faab[_0xdd67('0x51')]));_0x5b4180['push'](get_open_tabs(_0xdd67('0x5d'),_0x57faab[_0xdd67('0x51')]));_0x5b4180['push'](get_open_tabs(_0xdd67('0x54'),_0x57faab[_0xdd67('0x51')]));_0x5b4180[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x55'),_0x57faab['dataValues']));_0x5b4180['push'](get_open_tabs(_0xdd67('0x52'),_0x57faab[_0xdd67('0x51')]));_0x5b4180[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x53'),_0x57faab[_0xdd67('0x51')]));return Promise[_0xdd67('0x56')](_0x5b4180);}else{return values;}})[_0xdd67('0x21')](function(){return values;})[_0xdd67('0x21')](respondWithResult(_0x42a4a3,null))[_0xdd67('0x2c')](handleError(_0x42a4a3,null));};exports[_0xdd67('0x2d')]=function(_0x5f5cad,_0x443216){if(_0x5f5cad[_0xdd67('0x5e')]['id']){delete _0x5f5cad['body']['id'];}delete _0x5f5cad[_0xdd67('0x5e')]['role'];return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x5f5cad[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x443216,null))[_0xdd67('0x21')](saveUpdates(_0x5f5cad[_0xdd67('0x5e')],null))['then'](respondWithResult(_0x443216,null))[_0xdd67('0x2c')](handleError(_0x443216,null));};exports[_0xdd67('0x5f')]=function(_0x3d3f62,_0x526c71){return db[_0xdd67('0x48')][_0xdd67('0x5f')]()[_0xdd67('0x21')](respondWithResult(_0x526c71,null))[_0xdd67('0x2c')](handleError(_0x526c71,null));};exports[_0xdd67('0x60')]=function(_0x3a275c,_0x555868){return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x3a275c[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x555868,null))[_0xdd67('0x21')](function(_0x3edff3){if(_0x3edff3){return _0x3edff3[_0xdd67('0x60')](_0x3a275c[_0xdd67('0x5e')]['ids'],_[_0xdd67('0x61')](_0x3a275c[_0xdd67('0x5e')],[_0xdd67('0x62'),'id'])||{});}})[_0xdd67('0x21')](respondWithResult(_0x555868,null))[_0xdd67('0x2c')](handleError(_0x555868,null));};function validateUser(_0x423fd4){return new Promise(function(_0x28ba7f,_0x2bd5f2){if(_0x423fd4[_0xdd67('0x63')])return _0x28ba7f(_0x423fd4);return db[_0xdd67('0x64')][_0xdd67('0x65')](0x1)['then'](function(_0x43f518){if(_0x43f518[_0xdd67('0x66')])authService[_0xdd67('0x67')](_0x423fd4[_0xdd67('0x68')]);db[_0xdd67('0x48')][_0xdd67('0x69')](_0xdd67('0x63'))['then'](function(_0x38ef1a){if(_[_0xdd67('0x6a')](_0x38ef1a)){_0x423fd4[_0xdd67('0x63')]=_0x43f518[_0xdd67('0x6b')]||0x1;return;}if(_[_0xdd67('0x6a')](_0x43f518[_0xdd67('0x6b')])||_0x43f518[_0xdd67('0x6b')]===_0x38ef1a){_0x423fd4[_0xdd67('0x63')]=_0x38ef1a+0x1;return;}if(_0x43f518['min_internal']>_0x38ef1a){_0x423fd4[_0xdd67('0x63')]=_0x43f518[_0xdd67('0x6b')];return;}return db['sequelize'][_0xdd67('0x49')](_0xdd67('0x6c'),{'type':db[_0xdd67('0x6d')][_0xdd67('0x6e')][_0xdd67('0x6f')]})[_0xdd67('0x21')](function(_0xfa9c21){if(_0xfa9c21&&_0xfa9c21[_0xdd67('0x70')]){for(var _0x2ecf80=0x0,_0x4bb53e=_0xfa9c21[_0xdd67('0x70')];_0x2ecf80<_0x4bb53e&&_[_0xdd67('0x6a')](_0x423fd4[_0xdd67('0x63')]);_0x2ecf80++){if(_0x43f518[_0xdd67('0x6b')]<=_0xfa9c21[_0x2ecf80][_0xdd67('0x71')]){_0x423fd4[_0xdd67('0x63')]=_0xfa9c21[_0x2ecf80][_0xdd67('0x71')];}else if(_0x43f518[_0xdd67('0x6b')]>_0xfa9c21[_0x2ecf80]['from']&&_0x43f518[_0xdd67('0x6b')]<=_0xfa9c21[_0x2ecf80]['to']){_0x423fd4[_0xdd67('0x63')]=_0x43f518[_0xdd67('0x6b')];}}}if(_['isNil'](_0x423fd4[_0xdd67('0x63')])){_0x423fd4[_0xdd67('0x63')]=_0x38ef1a+0x1;}return _0x28ba7f(_0x423fd4);});});})[_0xdd67('0x2c')](function(_0x2b8f2b){_0x2bd5f2(_0x2b8f2b);});});}function updateUser(_0x16133e){return new Promise(function(_0x5dc69e,_0x505ca1){try{if(_0x16133e['voicemail']){_0x16133e[_0xdd67('0x72')]=_0x16133e[_0xdd67('0x63')];_0x16133e[_0xdd67('0x73')]={'mailbox':_0x16133e[_0xdd67('0x63')],'password':_0x16133e[_0xdd67('0x68')],'fullname':_0x16133e[_0xdd67('0x74')],'email':_0x16133e[_0xdd67('0x75')]};}if(_0x16133e[_0xdd67('0x2e')]===_0xdd67('0x33')){if(!_0x16133e[_0xdd67('0x76')])_0x16133e[_0xdd67('0x76')]=[_0xdd67('0x77'),_0xdd67('0x78'),_0xdd67('0x79'),_0xdd67('0x7a'),_0xdd67('0x7b'),'104',_0xdd67('0x7c'),'106',_0xdd67('0x7d'),'108','109',_0xdd67('0x7e'),_0xdd67('0x7f'),'114',_0xdd67('0x80')];}_0x5dc69e(_0x16133e);}catch(_0x5a61b2){_0x505ca1(_0x5a61b2);}});}exports[_0xdd67('0x81')]=function(_0x25dd57,_0x4c1092){if(_0x25dd57['user'][_0xdd67('0x2e')]===_0xdd67('0x33'))throw new Error(_0xdd67('0x82'));if(_0x25dd57['body'][_0xdd67('0x2e')]==='user'&&_0x25dd57[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x84')){throw new Error(_0xdd67('0x85'));}if(_0x25dd57['body'][_0xdd67('0x2e')]===_0xdd67('0x84')&&_0x25dd57[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x84')){throw new Error(_0xdd67('0x86'));}return licenseUtil['checkUserLimits']([_0x25dd57[_0xdd67('0x5e')]])['then'](function(){return validateUser(_0x25dd57[_0xdd67('0x5e')]);})[_0xdd67('0x21')](function(_0xde2922){return updateUser(_0xde2922)['then'](function(_0x1730f4){if(_0x1730f4[_0xdd67('0x2e')]===_0xdd67('0x84')){_0x1730f4[_0xdd67('0x87')]=_0x25dd57[_0xdd67('0x83')]['settingsEnabled'];delete _0x1730f4[_0xdd67('0x88')];}return _0x1730f4;});})[_0xdd67('0x21')](function(_0x1f0d04){return db[_0xdd67('0x48')]['create'](_0x1f0d04,{'include':[{'model':db[_0xdd67('0x73')],'as':'VoiceMail'}]});})[_0xdd67('0x21')](function(_0x18a854){if(_0x25dd57['body'][_0xdd67('0x2e')]==='user')return _0x18a854;if(_0x25dd57[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x83'))return _0x18a854;return db['UserProfileSection']['find']({'where':{'name':_0x18a854[_0xdd67('0x2e')]==='agent'?_0xdd67('0x32'):'Telephones','userProfileId':_0x25dd57[_0xdd67('0x83')][_0xdd67('0x88')]},'raw':!![]})['then'](function(_0x4d2728){if(!_0x4d2728||_0x4d2728[_0xdd67('0x89')]!=0x0)return _0x18a854;return db['UserProfileResource'][_0xdd67('0x81')]({'name':_0x18a854['name'],'resourceId':_0x18a854['id'],'type':_0x4d2728[_0xdd67('0x3b')],'sectionId':_0x4d2728['id']},{})[_0xdd67('0x21')](function(){return _0x18a854;});})['catch'](function(_0x4281f2){logger[_0xdd67('0x28')](_0xdd67('0x8a'),_0x4281f2);throw _0x4281f2;});})[_0xdd67('0x21')](respondWithResult(_0x4c1092,0xc9))['catch'](handleError(_0x4c1092,null));};exports[_0xdd67('0x8b')]=function(_0x1f5459,_0x34300e){var _0x46eacb=_0x1f5459['body'];var _0x1e984b=[];if(_0x1f5459[_0xdd67('0x83')][_0xdd67('0x2e')]===_0xdd67('0x33'))throw new Error(_0xdd67('0x82'));if(_[_0xdd67('0x8c')](_0x46eacb,[_0xdd67('0x2e'),'user'])&&_0x1f5459['user']['role']!==_0xdd67('0x84')){throw new Error(_0xdd67('0x85'));}if(_[_0xdd67('0x8c')](_0x46eacb,[_0xdd67('0x2e'),_0xdd67('0x84')])&&_0x1f5459[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x84')){throw new Error(_0xdd67('0x8d'));}return licenseUtil[_0xdd67('0x8e')](_0x46eacb)[_0xdd67('0x21')](function(){return validateUser(_0x46eacb[0x0]);})[_0xdd67('0x21')](function(){for(var _0x3a7a6b=0x1;_0x3a7a6b<_0x46eacb[_0xdd67('0x70')];_0x3a7a6b++){var _0x535f01=_0x46eacb[_0x3a7a6b-0x1][_0xdd67('0x63')];if(!_0x46eacb[_0x3a7a6b]['internal'])_0x46eacb[_0x3a7a6b][_0xdd67('0x63')]=_0x535f01+0x1;_0x1e984b[_0xdd67('0x50')](validateUser(_0x46eacb[_0x3a7a6b]));}return Promise[_0xdd67('0x56')](_0x1e984b);})[_0xdd67('0x21')](function(){_0x1e984b=[];for(var _0xfd0b36=0x0;_0xfd0b36<_0x46eacb['length'];_0xfd0b36++){_0x1e984b['push'](updateUser(_0x46eacb[_0xfd0b36]));}return Promise[_0xdd67('0x56')](_0x1e984b);})[_0xdd67('0x21')](function(){_0x1e984b=_0x46eacb['map'](function(_0xc27002){return db['User']['create'](_0xc27002,{'include':[{'model':db[_0xdd67('0x73')],'as':'VoiceMail'}]})[_0xdd67('0x21')](function(_0x57d4c2){_0xc27002['id']=_0x57d4c2['id'];return _0xc27002;});});return Promise[_0xdd67('0x56')](_0x1e984b);})[_0xdd67('0x21')](function(_0x641cac){if(_0x1f5459['body'][_0xdd67('0x2e')]===_0xdd67('0x83'))return _0x641cac;if(_0x1f5459[_0xdd67('0x83')][_0xdd67('0x2e')]!==_0xdd67('0x83'))return _0x641cac;var _0x4a67bf=_[_0xdd67('0x8c')](_0x641cac,function(_0x4a5d68){return _0x4a5d68[_0xdd67('0x2e')]===_0xdd67('0x33')||_0x4a5d68[_0xdd67('0x2e')]===_0xdd67('0x8f');});if(!_0x4a67bf)return _0x641cac;return db[_0xdd67('0x90')]['findAll']({'where':{'name':{'$or':[_0xdd67('0x32'),'Telephones']},'userProfileId':_0x1f5459[_0xdd67('0x83')][_0xdd67('0x88')]},'raw':!![]})['then'](function(_0x48f105){if(_[_0xdd67('0x91')](_0x48f105)||!_[_0xdd67('0x8c')](_0x48f105,[_0xdd67('0x89'),0x0]))return _0x641cac;_0x1e984b=[];var _0x598ff5=_(_0x48f105)[_0xdd67('0x37')](function(_0x2e45ff){if(_0x2e45ff[_0xdd67('0x89')]===0x1)return;return _0x2e45ff['name']===_0xdd67('0x32')?'agent':_0xdd67('0x8f');})['compact']()[_0xdd67('0x38')]();for(var _0x239f0d=0x0;_0x239f0d<_0x641cac[_0xdd67('0x70')];_0x239f0d++){if(!_[_0xdd67('0x39')](_0x598ff5,_0x641cac[_0x239f0d]['role']))return;var _0x2c6d7c=_0x641cac[_0x239f0d][_0xdd67('0x2e')]===_0xdd67('0x33')?_0xdd67('0x32'):_0xdd67('0x34');_0x1e984b[_0xdd67('0x50')](db[_0xdd67('0x3c')][_0xdd67('0x81')]({'name':_0x641cac[_0x239f0d][_0xdd67('0x3b')],'resourceId':_0x641cac[_0x239f0d]['id'],'type':_0x2c6d7c,'sectionId':_['find'](_0x48f105,[_0xdd67('0x3b'),_0x2c6d7c])['id']},{}));}return Promise['all'](_0x1e984b);});})[_0xdd67('0x21')](respondWithResult(_0x34300e,0xc9))[_0xdd67('0x2c')](handleError(_0x34300e,null));};exports[_0xdd67('0x92')]=function(_0x50e097,_0x1f6112){if(_0x50e097[_0xdd67('0x5e')]['id']){delete _0x50e097[_0xdd67('0x5e')]['id'];}return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x50e097[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](function(_0x3ae203){if(!_0x3ae203)return null;if(_0x3ae203['id']===_0x50e097[_0xdd67('0x83')]['id']){if(!_0x50e097[_0xdd67('0x5e')][_0xdd67('0x93')]||!_0x50e097[_0xdd67('0x5e')][_0xdd67('0x94')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3ae203[_0xdd67('0x95')](_0x50e097[_0xdd67('0x5e')][_0xdd67('0x93')])){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0x98'));}if(_0x50e097[_0xdd67('0x5e')][_0xdd67('0x93')]===_0x50e097[_0xdd67('0x5e')][_0xdd67('0x94')]){throw new db['Sequelize'][(_0xdd67('0x97'))](_0xdd67('0x99'));}}else if(_0x50e097[_0xdd67('0x83')][_0xdd67('0x2e')]==='admin'){if(!_0x50e097[_0xdd67('0x5e')][_0xdd67('0x94')]){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0x9a'));}}else if(_0x50e097[_0xdd67('0x83')][_0xdd67('0x2e')]===_0xdd67('0x83')){if(!_0x50e097[_0xdd67('0x5e')]['newPassword']){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0x9a'));}if(_0x3ae203[_0xdd67('0x2e')]!==_0xdd67('0x33')){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0x82'));}}else{throw new db['Sequelize'][(_0xdd67('0x97'))](_0xdd67('0x82'));}return _0x3ae203;})[_0xdd67('0x21')](handleEntityNotFound(_0x1f6112,null))[_0xdd67('0x21')](function(_0x155259){return db[_0xdd67('0x64')][_0xdd67('0x9b')]({'attributes':['id','securePassword',_0xdd67('0x9c'),'passwordHistoryLimit']})['then'](function(_0x4fb3e4){if(_0x4fb3e4[_0xdd67('0x66')])authService[_0xdd67('0x67')](_0x50e097['body'][_0xdd67('0x94')]);if(!_0x4fb3e4[_0xdd67('0x9c')]||!_0x155259[_0xdd67('0x44')])return _0x155259;authService[_0xdd67('0x9d')](_0x50e097['body']['newPassword'],_0x155259[_0xdd67('0x44')],_0x4fb3e4['passwordHistoryLimit']);return _0x155259;})[_0xdd67('0x21')](saveUpdates({'password':_0x50e097['body'][_0xdd67('0x94')],'passwordResetAt':_0x50e097[_0xdd67('0x83')]['id']==_0x50e097[_0xdd67('0x58')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x50e097[_0xdd67('0x5e')]['newPassword'],_0x155259[_0xdd67('0x44')])},null));})[_0xdd67('0x21')](respondWithResult(_0x1f6112,null))[_0xdd67('0x2c')](handleError(_0x1f6112,null));};exports[_0xdd67('0x9e')]=function(_0x111d48,_0x2849b8){var _0x2353df=_0x111d48['body']['channel'];return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x111d48[_0xdd67('0x58')]['id']},'attributes':['id','name',_0xdd67('0x2e'),_0xdd67('0x9f'),_0xdd67('0xa0'),_0xdd67('0xa1'),_0xdd67('0xa2')]})[_0xdd67('0x21')](handleEntityNotFound(_0x2849b8,null))['then'](function(_0x4d11c3){if(_0x4d11c3){if(!utils[_0xdd67('0xa3')](_0x2353df)){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0xa4'));}return _0x4d11c3[_0xdd67('0xa5')+_[_0xdd67('0xa6')](_0x2353df[_0xdd67('0xa7')]())+_0xdd67('0xa8')](_0x111d48[_0xdd67('0x5e')][_0xdd67('0x62')],{'penalty':_0x111d48[_0xdd67('0x5e')]['penalty']||0x0})[_0xdd67('0xa9')](function(_0x55e37b){for(var _0x1734e2=0x0;_0x1734e2<_0x111d48[_0xdd67('0x5e')][_0xdd67('0x62')][_0xdd67('0x70')];_0x1734e2+=0x1){var _0x51e4af={'UserId':Number(_0x111d48[_0xdd67('0x58')]['id'])};_0x51e4af[_[_0xdd67('0xa6')](_0x2353df[_0xdd67('0xa7')]())+_0xdd67('0xaa')]=Number(_0x111d48[_0xdd67('0x5e')]['ids'][_0x1734e2]);socket[_0xdd67('0xab')](_0xdd67('0x83')+_[_0xdd67('0xa6')](_0x2353df['toLowerCase']())+_0xdd67('0xac'),_0x51e4af);}return _0x55e37b;})[_0xdd67('0x21')](function(){if(_0x2353df===_0xdd67('0xad')){return db['VoiceQueue'][_0xdd67('0xae')]({'where':{'id':_0x111d48[_0xdd67('0x5e')][_0xdd67('0x62')]||[]},'raw':!![],'attributes':['id',_0xdd67('0x3b')]});}})['then'](function(_0x40330a){var _0x26ed6c=_0x4d11c3[_0xdd67('0x30')]({'plain':!![]});var _0x480dc8=[];if(_0x2353df==='voice'&&_0x26ed6c[_0xdd67('0x2e')]===_0xdd67('0x33')&&_0x26ed6c[_0xdd67('0x9f')]){for(let _0x4a9139=0x0;_0x4a9139<_0x40330a[_0xdd67('0x70')];_0x4a9139+=0x1){_0x480dc8['push']({'membername':_0x26ed6c[_0xdd67('0x3b')],'UserId':_0x26ed6c['id'],'queue_name':_0x40330a[_0x4a9139][_0xdd67('0x3b')],'VoiceQueueId':_0x40330a[_0x4a9139]['id'],'interface':_['isNil'](_0x26ed6c['interface'])?util[_0xdd67('0xaf')](_0xdd67('0xb0'),_0x26ed6c[_0xdd67('0x3b')]):_0x26ed6c[_0xdd67('0xa2')],'paused':_0x26ed6c[_0xdd67('0xa1')]||![],'penalty':_0x111d48[_0xdd67('0x5e')]['penalty']||0x0});}return Promise[_0xdd67('0x56')](_0x480dc8[_0xdd67('0x37')](function(_0x5f5194){return db[_0xdd67('0xb1')][_0xdd67('0xb2')](_0x5f5194);}));}return _0x4d11c3;});}})[_0xdd67('0x21')](respondWithStatusCode(_0x2849b8,null))['catch'](handleError(_0x2849b8,null));};exports[_0xdd67('0xb3')]=function(_0x5a7a0a,_0x4e811b){var _0x3f2822,_0xa8af10;return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x5a7a0a[_0xdd67('0x58')]['id']},'attributes':['id',_0xdd67('0x3b'),_0xdd67('0x2e')]})['then'](handleEntityNotFound(_0x4e811b,null))[_0xdd67('0x21')](function(_0x39ae81){if(_0x39ae81){_0x3f2822=_0x39ae81;if(!_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')]||!utils[_0xdd67('0xa3')](_0x5a7a0a['query']['channel'])){throw new db['Sequelize']['ValidationError'](_0xdd67('0xa4'));}return _0x39ae81[_0xdd67('0xb5')+_['capitalize'](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')][_0xdd67('0xa7')]())+_0xdd67('0xa8')](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')]);}})[_0xdd67('0x21')](function(_0x5a9925){if(_[_0xdd67('0xb6')](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')])){for(var _0x1a4e62=0x0;_0x1a4e62<_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')][_0xdd67('0x70')];_0x1a4e62+=0x1){_0xa8af10={'UserId':Number(_0x5a7a0a[_0xdd67('0x58')]['id'])};_0xa8af10[_['capitalize'](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')]['toLowerCase']())+'QueueId']=Number(_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')][_0x1a4e62]);socket[_0xdd67('0xab')](_0xdd67('0x83')+_[_0xdd67('0xa6')](_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')]['toLowerCase']())+'Queue:remove',_0xa8af10);}}else{_0xa8af10={'UserId':Number(_0x5a7a0a[_0xdd67('0x58')]['id'])};_0xa8af10[_[_0xdd67('0xa6')](_0x5a7a0a[_0xdd67('0x49')]['channel'][_0xdd67('0xa7')]())+_0xdd67('0xaa')]=Number(_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')]);socket[_0xdd67('0xab')](_0xdd67('0x83')+_[_0xdd67('0xa6')](_0x5a7a0a[_0xdd67('0x49')]['channel']['toLowerCase']())+_0xdd67('0xb7'),_0xa8af10);}return _0x5a9925;})['then'](function(){if(_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0xb4')]==='voice'){return db['UserVoiceQueueRt'][_0xdd67('0x3d')]({'where':{'UserId':_0x5a7a0a['params']['id'],'VoiceQueueId':_0x5a7a0a[_0xdd67('0x49')][_0xdd67('0x62')]},'individualHooks':!![]})[_0xdd67('0x21')](function(){return _0x3f2822;});}return _0x3f2822;})[_0xdd67('0x21')](respondWithStatusCode(_0x4e811b,null))[_0xdd67('0x2c')](handleError(_0x4e811b,null));};exports[_0xdd67('0xb8')]=function(_0x10f0df,_0x141f36){_0x10f0df['body'][_0xdd67('0xb9')]=_0x10f0df[_0xdd67('0xba')][_0xdd67('0xbb')];return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x10f0df[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x141f36,null))[_0xdd67('0x21')](saveUpdates(_0x10f0df[_0xdd67('0x5e')],null))[_0xdd67('0x21')](respondWithResult(_0x141f36,null))[_0xdd67('0x2c')](handleError(_0x141f36,null));};exports[_0xdd67('0xbc')]=function(_0x2dfc8f,_0x36741f){var _0x26113=path[_0xdd67('0xbd')](config[_0xdd67('0xbe')],_0xdd67('0xbf'));return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x2dfc8f[_0xdd67('0x58')]['id']},'attributes':['id',_0xdd67('0xb9')],'raw':!![]})[_0xdd67('0x21')](handleEntityNotFound(_0x36741f,null))[_0xdd67('0x21')](function(_0x3f64e3){if(_0x3f64e3){if(_[_0xdd67('0x6a')](_0x3f64e3[_0xdd67('0xb9')])){return _0x36741f[_0xdd67('0xc0')](_0x26113);}else{if(!fs['existsSync'](path['join'](config[_0xdd67('0xbe')],_0xdd67('0xc1'),_0x3f64e3[_0xdd67('0xb9')]))){return _0x36741f[_0xdd67('0xc0')](_0x26113);}return _0x36741f[_0xdd67('0xc0')](path[_0xdd67('0xbd')](config['root'],_0xdd67('0xc1'),_0x3f64e3[_0xdd67('0xb9')]));}}})[_0xdd67('0x2c')](handleError(_0x36741f,null));};exports[_0xdd67('0xc2')]=function(_0x163054,_0x397dc9){return db[_0xdd67('0x48')]['find']({'where':{'id':_0x163054[_0xdd67('0x58')]['id']},'attributes':['id']})[_0xdd67('0x21')](handleEntityNotFound(_0x397dc9,null))[_0xdd67('0x21')](function(_0x448ff4){var _0x302239=[];values=_0x448ff4[_0xdd67('0x51')];_0x302239[_0xdd67('0x50')](get_open_tabs('chat',_0x448ff4[_0xdd67('0x51')]));_0x302239['push'](get_open_tabs('sms',_0x448ff4['dataValues']));_0x302239[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x54'),_0x448ff4[_0xdd67('0x51')]));_0x302239[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x55'),_0x448ff4[_0xdd67('0x51')]));_0x302239[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x52'),_0x448ff4[_0xdd67('0x51')]));_0x302239[_0xdd67('0x50')](get_open_tabs(_0xdd67('0x53'),_0x448ff4[_0xdd67('0x51')]));return Promise[_0xdd67('0x56')](_0x302239);})[_0xdd67('0x21')](function(_0x5c188d){if(_0x5c188d){var _0x485d24=_['map'](values[_0xdd67('0xc3')],function(_0x29fc95){return{'channel':_0xdd67('0xc4'),'id':_0x29fc95['id'],'createdAt':_0x29fc95[_0xdd67('0xc5')]};});var _0x150986=_['map'](values['FaxOpenTabs'],function(_0x1ec5e2){return{'channel':_0xdd67('0xc6'),'id':_0x1ec5e2['id'],'createdAt':_0x1ec5e2[_0xdd67('0xc5')]};});var _0x4890ac=_[_0xdd67('0x37')](values[_0xdd67('0xc7')],function(_0xa2581a){return{'channel':_0xdd67('0xc8'),'id':_0xa2581a['id'],'createdAt':_0xa2581a[_0xdd67('0xc5')]};});var _0x3231ef=_['map'](values[_0xdd67('0xc9')],function(_0x456426){return{'channel':_0xdd67('0xca'),'id':_0x456426['id'],'createdAt':_0x456426[_0xdd67('0xc5')]};});var _0x5c57d1=_[_0xdd67('0x37')](values[_0xdd67('0xcb')],function(_0xdb2b39){return{'channel':'SMS','id':_0xdb2b39['id'],'createdAt':_0xdb2b39[_0xdd67('0xc5')]};});var _0x13ecec=_[_0xdd67('0x37')](values[_0xdd67('0xcc')],function(_0x5483bd){return{'channel':_0xdd67('0xcd'),'id':_0x5483bd['id'],'createdAt':_0x5483bd[_0xdd67('0xc5')]};});var _0x17099e=_[_0xdd67('0xce')](_0x485d24,_0x150986,_0x4890ac,_0x3231ef,_0x5c57d1,_0x13ecec);var _0x354f16={'count':_0x17099e[_0xdd67('0x70')],'rows':_0x17099e};return _0x354f16;}else return null;})['then'](respondWithResult(_0x397dc9,null))[_0xdd67('0x2c')](handleError(_0x397dc9,null));};exports[_0xdd67('0xcf')]=function(_0xef60f0,_0xa96d78){var _0x194c90={};return db['User'][_0xdd67('0x9b')]({'where':{'id':_0xef60f0['params']['id']}})[_0xdd67('0x21')](function(_0x56c3b5){if(!_0x56c3b5){throw new APINotFoundError(util[_0xdd67('0xaf')](_0xdd67('0xd0'),_0xef60f0[_0xdd67('0x58')]['id']));}return contacts[_0xdd67('0x5f')]();})[_0xdd67('0x21')](function(_0x4e9866){_0xef60f0[_0xdd67('0x49')][_0xdd67('0x48')]=_0xef60f0['params']['id'];_0x194c90=qs[_0xdd67('0xd1')](_0x4e9866,_0xef60f0);if(_0xef60f0['query']['hasOwnProperty'](_0xdd67('0x59'))){_0x194c90['include']=[{'model':db[_0xdd67('0xd2')],'as':_0xdd67('0xd3'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xdd67('0x3b'),_0xdd67('0xd4')],'where':_0xef60f0['query'][_0xdd67('0xd5')]?{'id':_0xef60f0[_0xdd67('0x49')]['tag']}:undefined,'required':_0xef60f0[_0xdd67('0x49')][_0xdd67('0xd5')]?!![]:![]}];}return contacts['findAll'](_0xef60f0[_0xdd67('0x49')],_0xef60f0['user'],_0x194c90,_0x4e9866);})[_0xdd67('0x21')](respondWithFilteredResult(_0xa96d78,_0x194c90))[_0xdd67('0x2c')](APIHandleError(_0xa96d78));};exports[_0xdd67('0xd6')]=function(_0x242d33,_0x35b3f7){var _0x5c706b;var _0x1c0a2f={};var _0x2c97ce;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x242d33[_0xdd67('0x58')]['id']},'attributes':['id',_0xdd67('0x3b'),'role']})[_0xdd67('0x21')](handleEntityNotFound(_0x35b3f7,null))[_0xdd67('0x21')](function(_0x24f42b){if(!utils['isValidChannel'](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])){throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))]('Unknown\x20channel');}_0x5c706b=_0x24f42b;var _0x3f8010={};_0x3f8010[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_[_0xdd67('0xa6')](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])+'Queue'][_0xdd67('0x40')]);_0x3f8010[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x242d33[_0xdd67('0x49')]);_0x3f8010[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x3f8010[_0xdd67('0xd7')],_0x3f8010['query']);_0x1c0a2f[_0xdd67('0x4e')]=_['intersection'](_0x3f8010[_0xdd67('0xd7')],qs['fields'](_0x242d33['query'][_0xdd67('0xdb')]));_0x1c0a2f['attributes']=_0x1c0a2f[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x1c0a2f['attributes']:_0x3f8010[_0xdd67('0xd7')];_0x1c0a2f[_0xdd67('0xdc')]=qs['sort'](_0x242d33[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x1c0a2f[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x242d33[_0xdd67('0x49')],_0x3f8010[_0xdd67('0xd9')]));if(_0x242d33[_0xdd67('0x49')][_0xdd67('0x35')]){_0x1c0a2f[_0xdd67('0x47')]=_['merge'](_0x1c0a2f[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x1c0a2f[_0xdd67('0x4e')],function(_0x29eb8b){var _0x4a2e9b={};_0x4a2e9b[_0x29eb8b]={'$like':'%'+_0x242d33['query']['filter']+'%'};return _0x4a2e9b;})});}_0x1c0a2f=_['merge']({},_0x1c0a2f,_0x242d33[_0xdd67('0x5b')]);switch(_0x5c706b[_0xdd67('0x2e')]){case _0xdd67('0x84'):return db[_[_0xdd67('0xa6')](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])+_0xdd67('0xdf')][_0xdd67('0xae')](_0x1c0a2f);case _0xdd67('0x83'):case _0xdd67('0x33'):return _0x5c706b['get'+_[_0xdd67('0xa6')](_0x242d33['query']['channel'])+_0xdd67('0xa8')](_0x1c0a2f);default:throw new db[(_0xdd67('0x96'))][(_0xdd67('0x97'))](_0xdd67('0xe0'));}})['then'](function(_0xad4d08){_0x2c97ce=_0xad4d08[_0xdd67('0x70')];if(!_0x242d33[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x1c0a2f[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x242d33[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x1c0a2f[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x242d33[_0xdd67('0x49')]['offset']);}switch(_0x5c706b[_0xdd67('0x2e')]){case _0xdd67('0x84'):return db[_[_0xdd67('0xa6')](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])+_0xdd67('0xdf')][_0xdd67('0xae')](_0x1c0a2f);case _0xdd67('0x83'):case _0xdd67('0x33'):return _0x5c706b[_0xdd67('0x30')+_[_0xdd67('0xa6')](_0x242d33[_0xdd67('0x49')][_0xdd67('0xb4')])+'Queues'](_0x1c0a2f);}})[_0xdd67('0x21')](function(_0x520204){return{'count':_0x2c97ce,'rows':_0x520204};})['then'](respondWithResult(_0x35b3f7,null))[_0xdd67('0x2c')](handleError(_0x35b3f7,null));};exports['getVoiceQueuesRt']=function(_0x2ac7e1,_0x50a037){var _0x5b5697={};var _0x108cd2={};var _0x4beb23;var _0x43e020;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x2ac7e1[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x50a037,null))['then'](function(_0x1269a9){if(_0x1269a9){_0x4beb23=_0x1269a9;_0x108cd2['model']=_[_0xdd67('0xd8')](db[_0xdd67('0xb1')][_0xdd67('0x40')]);_0x108cd2['query']=_[_0xdd67('0xd8')](_0x2ac7e1[_0xdd67('0x49')]);_0x108cd2[_0xdd67('0xd9')]=_['intersection'](_0x108cd2[_0xdd67('0xd7')],_0x108cd2[_0xdd67('0x49')]);_0x5b5697[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x108cd2[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x2ac7e1['query'][_0xdd67('0xdb')]));_0x5b5697['attributes']=_0x5b5697[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x5b5697['attributes']:_0x108cd2[_0xdd67('0xd7')];_0x5b5697[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x2ac7e1['query'][_0xdd67('0xdd')]);_0x5b5697[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x2ac7e1[_0xdd67('0x49')],_0x108cd2[_0xdd67('0xd9')]));if(_0x2ac7e1[_0xdd67('0x49')][_0xdd67('0x35')]){_0x5b5697['where']=_[_0xdd67('0x5a')](_0x5b5697[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x5b5697[_0xdd67('0x4e')],function(_0x42e4c4){var _0x2cb66c={};_0x2cb66c[_0x42e4c4]={'$like':'%'+_0x2ac7e1[_0xdd67('0x49')]['filter']+'%'};return _0x2cb66c;})});}_0x5b5697=_[_0xdd67('0x5a')]({},_0x5b5697,_0x2ac7e1[_0xdd67('0x5b')]);return _0x4beb23[_0xdd67('0xe3')](_0x5b5697);}})[_0xdd67('0x21')](function(_0x41427a){if(_0x41427a){_0x43e020=_0x41427a[_0xdd67('0x70')];if(!_0x2ac7e1[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x5b5697[_0xdd67('0x1d')]=qs['limit'](_0x2ac7e1[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x5b5697[_0xdd67('0x1b')]=qs['offset'](_0x2ac7e1['query'][_0xdd67('0x1b')]);}return _0x4beb23[_0xdd67('0xe3')](_0x5b5697);}})[_0xdd67('0x21')](function(_0x343c5a){if(_0x343c5a){return _0x343c5a?{'count':_0x43e020,'rows':_0x343c5a}:null;}})[_0xdd67('0x21')](respondWithResult(_0x50a037,null))[_0xdd67('0x2c')](handleError(_0x50a037,null));};exports[_0xdd67('0xe4')]=function(_0x2244b1,_0x53e86b){var _0x5c60ad={};var _0x3b8eb7={};var _0x5f2a64;var _0x1b684d;return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x2244b1[_0xdd67('0x58')]['id']}})['then'](handleEntityNotFound(_0x53e86b,null))['then'](function(_0x5495a7){if(_0x5495a7){_0x5f2a64=_0x5495a7;_0x3b8eb7[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xe5')][_0xdd67('0x40')]);_0x3b8eb7['query']=_['keys'](_0x2244b1[_0xdd67('0x49')]);_0x3b8eb7[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x3b8eb7[_0xdd67('0xd7')],_0x3b8eb7[_0xdd67('0x49')]);_0x5c60ad[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x3b8eb7['model'],qs[_0xdd67('0xdb')](_0x2244b1['query'][_0xdd67('0xdb')]));_0x5c60ad['attributes']=_0x5c60ad[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x5c60ad[_0xdd67('0x4e')]:_0x3b8eb7[_0xdd67('0xd7')];_0x5c60ad[_0xdd67('0xdc')]=qs['sort'](_0x2244b1[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x5c60ad['where']=qs['filters'](_[_0xdd67('0xde')](_0x2244b1['query'],_0x3b8eb7[_0xdd67('0xd9')]));if(_0x2244b1[_0xdd67('0x49')][_0xdd67('0x35')]){_0x5c60ad[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x5c60ad[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x5c60ad['attributes'],function(_0x3cd8b9){var _0x4ce875={};_0x4ce875[_0x3cd8b9]={'$like':'%'+_0x2244b1['query'][_0xdd67('0x35')]+'%'};return _0x4ce875;})});}_0x5c60ad=_[_0xdd67('0x5a')]({},_0x5c60ad,_0x2244b1['options']);return _0x5f2a64[_0xdd67('0xe4')](_0x5c60ad);}})[_0xdd67('0x21')](function(_0x361a2c){if(_0x361a2c){_0x1b684d=_0x361a2c[_0xdd67('0x70')];if(!_0x2244b1[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x5c60ad[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x2244b1[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x5c60ad[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x2244b1[_0xdd67('0x49')]['offset']);}return _0x5f2a64[_0xdd67('0xe4')](_0x5c60ad);}})[_0xdd67('0x21')](function(_0x133a63){if(_0x133a63){return _0x133a63?{'count':_0x1b684d,'rows':_0x133a63}:null;}})['then'](respondWithResult(_0x53e86b,null))[_0xdd67('0x2c')](handleError(_0x53e86b,null));};exports[_0xdd67('0xe6')]=function(_0x53e659,_0x41342c){var _0x388b17={'raw':!![],'where':{}};var _0x2baa94={};var _0xe34e={'count':0x0,'rows':[]};return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x53e659['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x41342c,null))[_0xdd67('0x21')](function(_0x3e4744){if(_0x3e4744){_0x2baa94[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xe7')][_0xdd67('0x40')]);_0x2baa94['query']=_[_0xdd67('0xd8')](_0x53e659[_0xdd67('0x49')]);_0x2baa94[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x2baa94[_0xdd67('0xd7')],_0x2baa94[_0xdd67('0x49')]);_0x388b17[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x2baa94[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x53e659['query'][_0xdd67('0xdb')]));_0x388b17[_0xdd67('0x4e')]=_0x388b17['attributes'][_0xdd67('0x70')]?_0x388b17[_0xdd67('0x4e')]:_0x2baa94['model'];if(!_0x53e659[_0xdd67('0x49')][_0xdd67('0xe1')]('nolimit')){_0x388b17[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x53e659[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x388b17['offset']=qs[_0xdd67('0x1b')](_0x53e659[_0xdd67('0x49')]['offset']);}_0x388b17[_0xdd67('0xdc')]=qs['sort'](_0x53e659[_0xdd67('0x49')]['sort']);_0x388b17[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x53e659[_0xdd67('0x49')],_0x2baa94['filters']));_0x388b17[_0xdd67('0x47')][_0xdd67('0xe8')]=_0x3e4744['id'];if(_0x53e659['query'][_0xdd67('0x35')]){_0x388b17[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x388b17[_0xdd67('0x47')],{'$or':_['map'](_0x388b17[_0xdd67('0x4e')],function(_0x1b47ea){var _0x3b61ad={};_0x3b61ad[_0x1b47ea]={'$like':'%'+_0x53e659[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x3b61ad;})});}_0x388b17=_[_0xdd67('0x5a')]({},_0x388b17,_0x53e659[_0xdd67('0x5b')]);return db['VoiceRecording'][_0xdd67('0x1e')]({'where':_0x388b17['where']})['then'](function(_0x5ae2bd){_0xe34e[_0xdd67('0x1e')]=_0x5ae2bd;if(_0x53e659['query']['includeAll']){_0x388b17[_0xdd67('0x4a')]=[{'all':!![]}];}return db['VoiceRecording'][_0xdd67('0xae')](_0x388b17);})[_0xdd67('0x21')](function(_0x5a5b90){_0xe34e[_0xdd67('0x4f')]=_0x5a5b90;return _0xe34e;});}})['then'](respondWithFilteredResult(_0x41342c,_0x388b17))['catch'](handleError(_0x41342c,null));};exports[_0xdd67('0xe9')]=function(_0x21ca64,_0x38070c){var _0x208b22={'raw':!![],'where':{}};var _0x46d5d8={};var _0x24675f={'count':0x0,'rows':[]};return db[_0xdd67('0x48')]['findOne']({'where':{'id':_0x21ca64[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x38070c,null))[_0xdd67('0x21')](function(_0x305b59){if(_0x305b59){_0x46d5d8['model']=_[_0xdd67('0xd8')](db[_0xdd67('0xea')][_0xdd67('0x40')]);_0x46d5d8['query']=_[_0xdd67('0xd8')](_0x21ca64['query']);_0x46d5d8[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x46d5d8[_0xdd67('0xd7')],_0x46d5d8[_0xdd67('0x49')]);_0x208b22[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x46d5d8[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x21ca64[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x208b22['attributes']=_0x208b22['attributes'][_0xdd67('0x70')]?_0x208b22['attributes']:_0x46d5d8[_0xdd67('0xd7')];if(!_0x21ca64[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x208b22[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x21ca64[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x208b22[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x21ca64[_0xdd67('0x49')][_0xdd67('0x1b')]);}_0x208b22['order']=qs[_0xdd67('0xdd')](_0x21ca64[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x208b22[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x21ca64[_0xdd67('0x49')],_0x46d5d8[_0xdd67('0xd9')]));_0x208b22[_0xdd67('0x47')][_0xdd67('0xe8')]=_0x305b59['id'];if(_0x21ca64[_0xdd67('0x49')]['filter']){_0x208b22['where']=_[_0xdd67('0x5a')](_0x208b22[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x208b22[_0xdd67('0x4e')],function(_0xda6de7){var _0x28a5ff={};_0x28a5ff[_0xda6de7]={'$like':'%'+_0x21ca64[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x28a5ff;})});}_0x208b22=_[_0xdd67('0x5a')]({},_0x208b22,_0x21ca64[_0xdd67('0x5b')]);return db[_0xdd67('0xea')][_0xdd67('0x1e')]({'where':_0x208b22[_0xdd67('0x47')]})['then'](function(_0x347c15){_0x24675f[_0xdd67('0x1e')]=_0x347c15;if(_0x21ca64[_0xdd67('0x49')]['includeAll']){_0x208b22[_0xdd67('0x4a')]=[{'all':!![]}];}return db[_0xdd67('0xea')][_0xdd67('0xae')](_0x208b22);})[_0xdd67('0x21')](function(_0x468db1){_0x24675f[_0xdd67('0x4f')]=_0x468db1;return _0x24675f;});}})[_0xdd67('0x21')](respondWithFilteredResult(_0x38070c,_0x208b22))[_0xdd67('0x2c')](handleError(_0x38070c,null));};exports['getChatInteractions']=function(_0x1eea01,_0x199169){var _0x34af22={};var _0x15e62a={};var _0x21fd24;var _0x37f1ae;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x1eea01['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x199169,null))[_0xdd67('0x21')](function(_0x5f1824){if(_0x5f1824){_0x21fd24=_0x5f1824;_0x15e62a[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db['ChatInteraction']['rawAttributes']);_0x15e62a[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x1eea01[_0xdd67('0x49')]);_0x15e62a[_0xdd67('0xd9')]=_['intersection'](_0x15e62a['model'],_0x15e62a[_0xdd67('0x49')]);_0x34af22['attributes']=_['intersection'](_0x15e62a['model'],qs[_0xdd67('0xdb')](_0x1eea01['query'][_0xdd67('0xdb')]));_0x34af22[_0xdd67('0x4e')]=_0x34af22[_0xdd67('0x4e')]['length']?_0x34af22[_0xdd67('0x4e')]:_0x15e62a[_0xdd67('0xd7')];_0x34af22[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x1eea01[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x34af22[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x1eea01[_0xdd67('0x49')],_0x15e62a[_0xdd67('0xd9')]));if(_0x1eea01[_0xdd67('0x49')]['filter']){_0x34af22[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x34af22[_0xdd67('0x47')],{'$or':_['map'](_0x34af22[_0xdd67('0x4e')],function(_0x2ad201){var _0x47fc77={};_0x47fc77[_0x2ad201]={'$like':'%'+_0x1eea01['query'][_0xdd67('0x35')]+'%'};return _0x47fc77;})});}_0x34af22=_[_0xdd67('0x5a')]({},_0x34af22,_0x1eea01[_0xdd67('0x5b')]);return _0x21fd24[_0xdd67('0xeb')](_0x34af22);}})['then'](function(_0x4339a8){if(_0x4339a8){_0x37f1ae=_0x4339a8['length'];if(!_0x1eea01[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x34af22['limit']=qs[_0xdd67('0x1d')](_0x1eea01['query'][_0xdd67('0x1d')]);_0x34af22['offset']=qs[_0xdd67('0x1b')](_0x1eea01[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x21fd24[_0xdd67('0xeb')](_0x34af22);}})['then'](function(_0x2b8bc0){if(_0x2b8bc0){return _0x2b8bc0?{'count':_0x37f1ae,'rows':_0x2b8bc0}:null;}})[_0xdd67('0x21')](respondWithResult(_0x199169,null))['catch'](handleError(_0x199169,null));};exports[_0xdd67('0xec')]=function(_0x29c204,_0x36c8a9){var _0x527223={};var _0x321253={};var _0x293e5e;var _0x1c24df;return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x29c204[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x36c8a9,null))[_0xdd67('0x21')](function(_0x378a8f){if(_0x378a8f){_0x293e5e=_0x378a8f;_0x321253[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xed')][_0xdd67('0x40')]);_0x321253[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x29c204[_0xdd67('0x49')]);_0x321253[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x321253[_0xdd67('0xd7')],_0x321253[_0xdd67('0x49')]);_0x527223[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x321253[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x29c204[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x527223[_0xdd67('0x4e')]=_0x527223[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x527223['attributes']:_0x321253['model'];_0x527223[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x29c204['query'][_0xdd67('0xdd')]);_0x527223[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_['pick'](_0x29c204[_0xdd67('0x49')],_0x321253[_0xdd67('0xd9')]));if(_0x29c204['query'][_0xdd67('0x35')]){_0x527223[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x527223[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x527223['attributes'],function(_0x142800){var _0x2d5f92={};_0x2d5f92[_0x142800]={'$like':'%'+_0x29c204[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x2d5f92;})});}_0x527223=_[_0xdd67('0x5a')]({},_0x527223,_0x29c204[_0xdd67('0x5b')]);return _0x293e5e[_0xdd67('0xec')](_0x527223);}})[_0xdd67('0x21')](function(_0x437058){if(_0x437058){_0x1c24df=_0x437058[_0xdd67('0x70')];if(!_0x29c204[_0xdd67('0x49')][_0xdd67('0xe1')]('nolimit')){_0x527223[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x29c204[_0xdd67('0x49')]['limit']);_0x527223[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x29c204[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x293e5e[_0xdd67('0xec')](_0x527223);}})['then'](function(_0x3e9e34){if(_0x3e9e34){return _0x3e9e34?{'count':_0x1c24df,'rows':_0x3e9e34}:null;}})['then'](respondWithResult(_0x36c8a9,null))['catch'](handleError(_0x36c8a9,null));};exports['getMailInteractions']=function(_0x2ef4ca,_0x4fa73d){var _0x348815={'raw':!![],'where':{}};var _0xd9fe7d={};var _0x5b3d68={'count':0x0,'rows':[]};return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x2ef4ca[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x4fa73d,null))['then'](function(_0x571240){if(_0x571240){_0xd9fe7d[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xee')][_0xdd67('0x40')]);_0xd9fe7d[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x2ef4ca[_0xdd67('0x49')]);_0xd9fe7d[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0xd9fe7d[_0xdd67('0xd7')],_0xd9fe7d[_0xdd67('0x49')]);_0x348815[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0xd9fe7d[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x348815['attributes']=_0x348815[_0xdd67('0x4e')]['length']?_0x348815[_0xdd67('0x4e')]:_0xd9fe7d['model'];if(!_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0xe1')]('nolimit')){_0x348815[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x348815['offset']=qs[_0xdd67('0x1b')](_0x2ef4ca[_0xdd67('0x49')]['offset']);}_0x348815['order']=qs[_0xdd67('0xdd')](_0x2ef4ca[_0xdd67('0x49')]['sort']);_0x348815[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x2ef4ca[_0xdd67('0x49')],_0xd9fe7d[_0xdd67('0xd9')]));_0x348815[_0xdd67('0x47')][_0xdd67('0xe8')]=_0x571240['id'];if(_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0x35')]){_0x348815[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x348815['where'],{'$or':_[_0xdd67('0x37')](_0x348815[_0xdd67('0x4e')],function(_0x1dcdae){var _0x2a09b7={};_0x2a09b7[_0x1dcdae]={'$like':'%'+_0x2ef4ca[_0xdd67('0x49')]['filter']+'%'};return _0x2a09b7;})});}_0x348815=_[_0xdd67('0x5a')]({},_0x348815,_0x2ef4ca[_0xdd67('0x5b')]);return db['MailInteraction'][_0xdd67('0x1e')]({'where':_0x348815[_0xdd67('0x47')]})[_0xdd67('0x21')](function(_0x402dcc){_0x5b3d68['count']=_0x402dcc;if(_0x2ef4ca[_0xdd67('0x49')][_0xdd67('0x59')]){_0x348815[_0xdd67('0x4a')]=[{'all':!![]}];}return db[_0xdd67('0xee')][_0xdd67('0xae')](_0x348815);})[_0xdd67('0x21')](function(_0xdd50ec){_0x5b3d68[_0xdd67('0x4f')]=_0xdd50ec;return _0x5b3d68;});}})[_0xdd67('0x21')](respondWithFilteredResult(_0x4fa73d,_0x348815))[_0xdd67('0x2c')](handleError(_0x4fa73d,null));};exports[_0xdd67('0xef')]=function(_0x1ad4e9,_0x202431){var _0x5ce229={};var _0x1b4c07={};var _0x2c66ad;var _0x371c65;return db[_0xdd67('0x48')]['findOne']({'where':{'id':_0x1ad4e9[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x202431,null))[_0xdd67('0x21')](function(_0x580c64){if(_0x580c64){_0x2c66ad=_0x580c64;_0x1b4c07[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db['SmsInteraction'][_0xdd67('0x40')]);_0x1b4c07[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x1ad4e9[_0xdd67('0x49')]);_0x1b4c07[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x1b4c07['model'],_0x1b4c07[_0xdd67('0x49')]);_0x5ce229[_0xdd67('0x4e')]=_[_0xdd67('0xda')](_0x1b4c07['model'],qs[_0xdd67('0xdb')](_0x1ad4e9['query'][_0xdd67('0xdb')]));_0x5ce229[_0xdd67('0x4e')]=_0x5ce229['attributes'][_0xdd67('0x70')]?_0x5ce229[_0xdd67('0x4e')]:_0x1b4c07[_0xdd67('0xd7')];_0x5ce229['order']=qs[_0xdd67('0xdd')](_0x1ad4e9['query']['sort']);_0x5ce229[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x1ad4e9[_0xdd67('0x49')],_0x1b4c07[_0xdd67('0xd9')]));if(_0x1ad4e9[_0xdd67('0x49')][_0xdd67('0x35')]){_0x5ce229[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x5ce229[_0xdd67('0x47')],{'$or':_['map'](_0x5ce229[_0xdd67('0x4e')],function(_0x474e36){var _0x3152bf={};_0x3152bf[_0x474e36]={'$like':'%'+_0x1ad4e9[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x3152bf;})});}_0x5ce229=_['merge']({},_0x5ce229,_0x1ad4e9[_0xdd67('0x5b')]);return _0x2c66ad[_0xdd67('0xef')](_0x5ce229);}})[_0xdd67('0x21')](function(_0x1d105a){if(_0x1d105a){_0x371c65=_0x1d105a[_0xdd67('0x70')];if(!_0x1ad4e9[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x5ce229['limit']=qs[_0xdd67('0x1d')](_0x1ad4e9[_0xdd67('0x49')]['limit']);_0x5ce229[_0xdd67('0x1b')]=qs[_0xdd67('0x1b')](_0x1ad4e9['query'][_0xdd67('0x1b')]);}return _0x2c66ad['getSmsInteractions'](_0x5ce229);}})[_0xdd67('0x21')](function(_0x44cefd){if(_0x44cefd){return _0x44cefd?{'count':_0x371c65,'rows':_0x44cefd}:null;}})[_0xdd67('0x21')](respondWithResult(_0x202431,null))[_0xdd67('0x2c')](handleError(_0x202431,null));};exports[_0xdd67('0xf0')]=function(_0x2e1bae,_0x6ac100){var _0xd1fdaf={};var _0x2fc016={};var _0x1ccc3f;var _0xdeba0f;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x2e1bae[_0xdd67('0x58')]['id']}})['then'](handleEntityNotFound(_0x6ac100,null))[_0xdd67('0x21')](function(_0x165264){if(_0x165264){_0x1ccc3f=_0x165264;_0x2fc016[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xf1')]['rawAttributes']);_0x2fc016[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x2e1bae[_0xdd67('0x49')]);_0x2fc016[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x2fc016['model'],_0x2fc016['query']);_0xd1fdaf['attributes']=_[_0xdd67('0xda')](_0x2fc016[_0xdd67('0xd7')],qs['fields'](_0x2e1bae['query']['fields']));_0xd1fdaf['attributes']=_0xd1fdaf[_0xdd67('0x4e')][_0xdd67('0x70')]?_0xd1fdaf['attributes']:_0x2fc016['model'];_0xd1fdaf[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x2e1bae[_0xdd67('0x49')]['sort']);_0xd1fdaf[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x2e1bae[_0xdd67('0x49')],_0x2fc016[_0xdd67('0xd9')]));if(_0x2e1bae['query'][_0xdd67('0x35')]){_0xd1fdaf[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0xd1fdaf[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0xd1fdaf[_0xdd67('0x4e')],function(_0x5d4585){var _0x4445c7={};_0x4445c7[_0x5d4585]={'$like':'%'+_0x2e1bae[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x4445c7;})});}_0xd1fdaf=_[_0xdd67('0x5a')]({},_0xd1fdaf,_0x2e1bae[_0xdd67('0x5b')]);return _0x1ccc3f[_0xdd67('0xf0')](_0xd1fdaf);}})['then'](function(_0x2256a9){if(_0x2256a9){_0xdeba0f=_0x2256a9[_0xdd67('0x70')];if(!_0x2e1bae[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0xd1fdaf['limit']=qs[_0xdd67('0x1d')](_0x2e1bae[_0xdd67('0x49')][_0xdd67('0x1d')]);_0xd1fdaf[_0xdd67('0x1b')]=qs['offset'](_0x2e1bae[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x1ccc3f[_0xdd67('0xf0')](_0xd1fdaf);}})['then'](function(_0x2ab204){if(_0x2ab204){return _0x2ab204?{'count':_0xdeba0f,'rows':_0x2ab204}:null;}})[_0xdd67('0x21')](respondWithResult(_0x6ac100,null))['catch'](handleError(_0x6ac100,null));};exports[_0xdd67('0xf2')]=function(_0x58694c,_0x5bd17c){var _0x594229={};var _0x2fe05f={};var _0x350ecb;var _0x4154f8;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x58694c[_0xdd67('0x58')]['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x5bd17c,null))['then'](function(_0x23c2ff){if(_0x23c2ff){_0x350ecb=_0x23c2ff;_0x2fe05f[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0xf3')][_0xdd67('0x40')]);_0x2fe05f[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x58694c['query']);_0x2fe05f[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x2fe05f['model'],_0x2fe05f['query']);_0x594229['attributes']=_[_0xdd67('0xda')](_0x2fe05f[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x58694c['query']['fields']));_0x594229[_0xdd67('0x4e')]=_0x594229[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x594229[_0xdd67('0x4e')]:_0x2fe05f[_0xdd67('0xd7')];_0x594229[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x58694c[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x594229['where']=qs['filters'](_['pick'](_0x58694c[_0xdd67('0x49')],_0x2fe05f[_0xdd67('0xd9')]));if(_0x58694c[_0xdd67('0x49')][_0xdd67('0x35')]){_0x594229[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x594229[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x594229['attributes'],function(_0x40b3f7){var _0x3b096f={};_0x3b096f[_0x40b3f7]={'$like':'%'+_0x58694c[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x3b096f;})});}_0x594229=_[_0xdd67('0x5a')]({},_0x594229,_0x58694c[_0xdd67('0x5b')]);return _0x350ecb[_0xdd67('0xf2')](_0x594229);}})[_0xdd67('0x21')](function(_0x4e2ae5){if(_0x4e2ae5){_0x4154f8=_0x4e2ae5[_0xdd67('0x70')];if(!_0x58694c[_0xdd67('0x49')][_0xdd67('0xe1')](_0xdd67('0xe2'))){_0x594229[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x58694c[_0xdd67('0x49')][_0xdd67('0x1d')]);_0x594229['offset']=qs[_0xdd67('0x1b')](_0x58694c[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x350ecb['getWhatsappInteractions'](_0x594229);}})[_0xdd67('0x21')](function(_0x45e295){if(_0x45e295){return _0x45e295?{'count':_0x4154f8,'rows':_0x45e295}:null;}})[_0xdd67('0x21')](respondWithResult(_0x5bd17c,null))[_0xdd67('0x2c')](handleError(_0x5bd17c,null));};exports[_0xdd67('0xf4')]=function(_0x706e07,_0xe52347,_0x10309b){var _0x4c12d8;var _0x16dfbc;var _0x2f4442;var _0x3e6976=!_[_0xdd67('0x6a')](_0x706e07['params']['id'])?_0x706e07['params']['id']:!_[_0xdd67('0x6a')](_0x706e07['user']['id'])?_0x706e07['user']['id']:null;return db[_0xdd67('0x48')]['find']({'where':{'id':_0x3e6976,'role':{'$or':[_0xdd67('0x84'),_0xdd67('0x83'),'agent']}},'attributes':['id','name',_0xdd67('0xf5'),'mobile',_0xdd67('0x2e'),_0xdd67('0x63'),_0xdd67('0xa0')]})['then'](function(_0x3dac28){if(_0x3dac28){if(_0x3dac28[_0xdd67('0x2e')]===_0xdd67('0x33')){_0x4c12d8=_0x3dac28;if(_0x706e07[_0xdd67('0x5e')][_0xdd67('0xa2')]){_0x2f4442=util['format'](_0xdd67('0xf6'),_0x4c12d8[_0x706e07['body'][_0xdd67('0xa2')]]);}else if(_0x706e07[_0xdd67('0x5e')][_0xdd67('0xf7')]){_0x2f4442=util[_0xdd67('0xaf')](_0xdd67('0xb0'),_0x706e07[_0xdd67('0x5e')][_0xdd67('0xf7')]);}else{_0x2f4442=util[_0xdd67('0xaf')]('SIP/%s',_0x4c12d8['name']);}socket['to'](util[_0xdd67('0xaf')](_0xdd67('0xf8'),_0x4c12d8[_0xdd67('0x3b')]))['emit'](_0xdd67('0xf9'),{'user':{'id':_0x4c12d8['id'],'name':_0x4c12d8[_0xdd67('0x3b')]},'ip':_0x706e07['headers'][_0xdd67('0xfa')]||_0x706e07[_0xdd67('0xfb')][_0xdd67('0xfc')]||_0x706e07[_0xdd67('0xfd')][_0xdd67('0xfc')]||_0x706e07[_0xdd67('0xfb')]['socket']['remoteAddress']});return new Promise(function(_0x11a9d6,_0x394642){db['sequelize'][_0xdd67('0xfe')]()[_0xdd67('0x21')](_0xb6d60b=>{db[_0xdd67('0xb1')][_0xdd67('0x3d')]({'where':{'membername':_0x4c12d8[_0xdd67('0x3b')]},'individualHooks':!![]},{'transaction':_0xb6d60b})[_0xdd67('0x21')](function(){return _0xb6d60b[_0xdd67('0xff')]();})[_0xdd67('0x21')](_0x11a9d6)['catch'](_0x394642);});});}}else{throw new db['Sequelize'][(_0xdd67('0x97'))](_0xdd67('0x100'));}})[_0xdd67('0x21')](function(){if(_0x4c12d8){return _0x4c12d8[_0xdd67('0x101')]({'raw':!![]});}})[_0xdd67('0x21')](function(_0x4055cf){if(_0x4c12d8){if(_0x4055cf){_0x16dfbc=_0x4055cf;if(_0x16dfbc[_0xdd67('0x70')]){var _0x3458e3=_0x16dfbc[_0xdd67('0x37')](function(_0x1e23a7){return{'membername':_0x4c12d8[_0xdd67('0x3b')],'UserId':_0x4c12d8['id'],'queue_name':_0x1e23a7[_0xdd67('0x3b')],'VoiceQueueId':_0x1e23a7['id'],'interface':_0x2f4442,'paused':_0x4c12d8[_0xdd67('0xa0')]||![],'penalty':_0x1e23a7[_0xdd67('0x102')]||0x0};});return db[_0xdd67('0xb1')][_0xdd67('0x8b')](_0x3458e3);}}}})[_0xdd67('0x21')](function(){if(_0x4c12d8){return db['MemberReport'][_0xdd67('0xae')]({'where':{'membername':_0x4c12d8[_0xdd67('0x3b')],'exitAt':null}});}})[_0xdd67('0x21')](function(_0x104fc9){if(_0x4c12d8){var _0x3f468b=[];_0x104fc9[_0xdd67('0x103')](function(_0x95534d){_0x3f468b[_0xdd67('0x50')](_0x95534d[_0xdd67('0x2d')]({'exitAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104'))}));});return Promise[_0xdd67('0x56')](_0x3f468b);}})[_0xdd67('0x21')](function(){if(_0x4c12d8){var _0xa42f9d=[];var _0x2e0c1a=[];var _0x3a6ee9=utils[_0xdd67('0x105')]();var _0x1cb7fe={'membername':_0x4c12d8[_0xdd67('0x3b')],'interface':_0x2f4442,'enterAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104')),'role':_0x4c12d8[_0xdd67('0x2e')],'internal':_0x4c12d8[_0xdd67('0x63')]};_0x3a6ee9['forEach'](function(_0xc4f7ec){_0xa42f9d['push'](_[_0xdd67('0x5a')]({'channel':_0xc4f7ec,'type':'LOGIN','data1':_0x706e07['body'][_0xdd67('0x106')],'data2':_0x2f4442},_0x1cb7fe));if(_0x4c12d8[_0xdd67('0xa0')]){_0x2e0c1a[_0xdd67('0x50')](_[_0xdd67('0x5a')]({'channel':_0xc4f7ec,'type':_0xdd67('0x107'),'data1':'LOGININPAUSE'},_0x1cb7fe));}});return db[_0xdd67('0x108')][_0xdd67('0x8b')](_0xa42f9d['concat'](_0x2e0c1a),{'individualHooks':!![]});}})[_0xdd67('0x21')](function(){if(_0x4c12d8){return _0x4c12d8['update']({'online':!![],'lastLoginAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104')),'voicePause':_0x4c12d8[_0xdd67('0xa0')]||![],'mailPause':_0x4c12d8[_0xdd67('0xa0')]||![],'chatPause':_0x4c12d8['loginInPause']||![],'faxPause':_0x4c12d8[_0xdd67('0xa0')]||![],'smsPause':_0x4c12d8[_0xdd67('0xa0')]||![],'openchannelPause':_0x4c12d8['loginInPause']||![],'whatsappPause':_0x4c12d8[_0xdd67('0xa0')]||![],'pauseType':_0x4c12d8[_0xdd67('0xa0')]?_0xdd67('0x109'):null,'interface':_0x2f4442,'lastPauseAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104'))});}})[_0xdd67('0x21')](function(_0x164d76){if(_0x706e07['isMiddleware']){return _0x10309b();}else{return Promise['resolve'](_0x164d76)['then'](respondWithResult(_0xe52347,null));}})[_0xdd67('0x2c')](handleError(_0xe52347,null));};exports[_0xdd67('0x10a')]=function(_0x23b034,_0x1bc2d6){var _0x1ef3df;return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x23b034[_0xdd67('0x58')]['id'],'role':_0xdd67('0x33')},'attributes':['id',_0xdd67('0x3b'),_0xdd67('0x2e')]})[_0xdd67('0x21')](handleEntityNotFound(_0x1bc2d6,null))[_0xdd67('0x21')](function(_0x4a9cf6){if(_0x4a9cf6){_0x1ef3df=_0x4a9cf6;return db[_0xdd67('0xb1')][_0xdd67('0x3d')]({'where':{'membername':_0x1ef3df[_0xdd67('0x3b')]},'individualHooks':!![]});}})[_0xdd67('0x21')](function(){return db[_0xdd67('0x108')][_0xdd67('0xae')]({'where':{'membername':_0x1ef3df[_0xdd67('0x3b')],'exitAt':null}});})[_0xdd67('0x21')](function(_0x119036){var _0x376106=[];_0x119036[_0xdd67('0x103')](function(_0x2da0c5){_0x376106['push'](_0x2da0c5[_0xdd67('0x2d')]({'exitAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104'))}));});return Promise[_0xdd67('0x56')](_0x376106);})[_0xdd67('0x21')](function(){return _0x1ef3df[_0xdd67('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xdd67('0x21')](respondWithResult(_0x1bc2d6,null))[_0xdd67('0x2c')](handleError(_0x1bc2d6,null));};exports[_0xdd67('0x10b')]=function(_0x239c67,_0x3e93f7){var _0x5aa642;return db['UserVoiceQueueRt'][_0xdd67('0x2d')]({'paused':0x1},{'where':{'UserId':_0x239c67[_0xdd67('0x58')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xdd67('0x48')][_0xdd67('0x3a')]({'where':{'id':_0x239c67[_0xdd67('0x58')]['id'],'role':_0xdd67('0x33')},'attributes':['id','name',_0xdd67('0x2e'),_0xdd67('0x63'),_0xdd67('0xa2'),_0xdd67('0x9f')]});})[_0xdd67('0x21')](handleEntityNotFound(_0x3e93f7,null))['then'](function(_0x15ff0b){if(_0x15ff0b){_0x5aa642=_0x15ff0b;return respondWithRpcPromise(_0xdd67('0x10c'),'pause',{'id':_0x5aa642['id'],'name':_0x5aa642['name'],'pause':!![]});}})[_0xdd67('0x21')](function(){if(_0x5aa642){return db[_0xdd67('0x108')][_0xdd67('0xae')]({'where':{'membername':_0x5aa642[_0xdd67('0x3b')],'type':'PAUSE','exitAt':null}});}})[_0xdd67('0x21')](function(_0x31ce77){if(_0x31ce77[_0xdd67('0x70')]){var _0x5da93f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x12237f=0x0,_0x4a4235=_0x31ce77[_0xdd67('0x70')];_0x12237f<_0x4a4235;_0x12237f++){_0x31ce77[_0x12237f]['updateAttributes']({'exitAt':_0x5da93f});}}})[_0xdd67('0x21')](function(){var _0x340f96=[];var _0x3a6ae5=utils['getChannels']();_0x3a6ae5[_0xdd67('0x103')](function(_0x4cf719){_0x340f96[_0xdd67('0x50')]({'channel':_0x4cf719,'membername':_0x5aa642[_0xdd67('0x3b')],'interface':_['isNil'](_0x5aa642[_0xdd67('0xa2')])?util[_0xdd67('0xaf')](_0xdd67('0xb0'),_0x5aa642[_0xdd67('0x3b')]):_0x5aa642['interface'],'type':_0xdd67('0x107'),'enterAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104')),'data1':_0x239c67[_0xdd67('0x5e')][_0xdd67('0x10d')]||_0xdd67('0x10e'),'role':_0x5aa642[_0xdd67('0x2e')],'internal':_0x5aa642[_0xdd67('0x63')]});});return db['MemberReport']['bulkCreate'](_0x340f96,{'individualHooks':!![]});})[_0xdd67('0x21')](function(){return _0x5aa642['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x239c67[_0xdd67('0x5e')][_0xdd67('0x10d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xdd67('0xaf')](_0xdd67('0x104'))});})[_0xdd67('0x21')](respondWithResult(_0x3e93f7,null))['catch'](handleError(_0x3e93f7,null));};exports[_0xdd67('0x10f')]=function(_0x4a716d,_0x126fc8){if(_0x4a716d[_0xdd67('0x5e')]['channel']&&!utils['isValidChannel'](_0x4a716d[_0xdd67('0x5e')]['channel'])){throw new APIBadRequestError(util[_0xdd67('0xaf')](_0xdd67('0x110'),_0x4a716d['body'][_0xdd67('0xb4')]));}return db['User'][_0xdd67('0x3a')]({'where':{'id':_0x4a716d[_0xdd67('0x58')]['id']},'attributes':['id',_0xdd67('0x3b'),_0xdd67('0x2e'),_0xdd67('0x63'),_0xdd67('0xa2'),_0xdd67('0x9f'),_0xdd67('0xa1'),_0xdd67('0x111'),_0xdd67('0x112'),'faxPause',_0xdd67('0x113'),_0xdd67('0x114'),_0xdd67('0x115'),'pauseType',_0xdd67('0x116')]})[_0xdd67('0x21')](function(_0x5b9977){if(!_0x5b9977){throw new APINotFoundError(util['format'](_0xdd67('0xd0'),_0x4a716d['params']['id']));}return _0x5b9977[_0xdd67('0x10f')](_0x4a716d[_0xdd67('0x5e')][_0xdd67('0xb4')]);})[_0xdd67('0x21')](respondWithResult(_0x126fc8,null))[_0xdd67('0x2c')](APIHandleError(_0x126fc8));};exports['getTeams']=function(_0x4607ae,_0x275c9e){var _0x29b830={};var _0xddfa33={};var _0x46eaa7;var _0x2886ff;return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x4607ae['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x275c9e,null))['then'](function(_0x7ced8d){if(_0x7ced8d){_0x46eaa7=_0x7ced8d;_0xddfa33[_0xdd67('0xd7')]=_['keys'](db[_0xdd67('0x117')][_0xdd67('0x40')]);_0xddfa33[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x4607ae[_0xdd67('0x49')]);_0xddfa33[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0xddfa33[_0xdd67('0xd7')],_0xddfa33[_0xdd67('0x49')]);_0x29b830[_0xdd67('0x4e')]=_['intersection'](_0xddfa33[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x4607ae[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x29b830[_0xdd67('0x4e')]=_0x29b830[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x29b830[_0xdd67('0x4e')]:_0xddfa33[_0xdd67('0xd7')];_0x29b830[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x4607ae[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x29b830[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x4607ae[_0xdd67('0x49')],_0xddfa33[_0xdd67('0xd9')]));if(_0x4607ae[_0xdd67('0x49')][_0xdd67('0x35')]){_0x29b830[_0xdd67('0x47')]=_[_0xdd67('0x5a')](_0x29b830[_0xdd67('0x47')],{'$or':_['map'](_0x29b830['attributes'],function(_0x4019d9){var _0x3330e8={};_0x3330e8[_0x4019d9]={'$like':'%'+_0x4607ae[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x3330e8;})});}_0x29b830=_['merge']({},_0x29b830,_0x4607ae[_0xdd67('0x5b')]);return _0x46eaa7[_0xdd67('0x118')](_0x29b830);}})[_0xdd67('0x21')](function(_0x3adda4){if(_0x3adda4){_0x2886ff=_0x3adda4[_0xdd67('0x70')];if(!_0x4607ae['query'][_0xdd67('0xe1')]('nolimit')){_0x29b830[_0xdd67('0x1d')]=qs['limit'](_0x4607ae['query'][_0xdd67('0x1d')]);_0x29b830['offset']=qs[_0xdd67('0x1b')](_0x4607ae[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x46eaa7[_0xdd67('0x118')](_0x29b830);}})[_0xdd67('0x21')](function(_0x5cb9f6){if(_0x5cb9f6){return _0x5cb9f6?{'count':_0x2886ff,'rows':_0x5cb9f6}:null;}})[_0xdd67('0x21')](respondWithResult(_0x275c9e,null))[_0xdd67('0x2c')](handleError(_0x275c9e,null));};exports['addTeams']=function(_0x20c9ef,_0x1cddf9){var _0x1c51da=_0x20c9ef[_0xdd67('0x58')]['id'];var _0x1feb0a=_0x20c9ef[_0xdd67('0x5e')]?_0x20c9ef[_0xdd67('0x5e')][_0xdd67('0x62')]:null;var _0x34969e=[];return Promise[_0xdd67('0x119')]()[_0xdd67('0x21')](function(){if(!_0x1feb0a)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xdd67('0x21')](function(){return db['User'][_0xdd67('0x9b')]({'where':{'id':_0x1c51da}});})[_0xdd67('0x21')](function(_0x39d929){if(!_0x39d929)throw new APINotFoundError(util['format'](_0xdd67('0xd0'),_0x20c9ef[_0xdd67('0x58')]['id']));return db[_0xdd67('0x6d')]['transaction'](function(_0xfe3432){return _0x39d929['addTeams'](_0x1feb0a,{'transaction':_0xfe3432})['then'](function(){return db[_0xdd67('0x117')][_0xdd67('0xae')]({'where':{'id':{'$in':_0x1feb0a}}});})['then'](function(_0x558163){var _0x2505e2=_['map'](_0x558163,function(_0x3769ae){return _0x3769ae[_0xdd67('0x11a')]();});return Promise[_0xdd67('0x56')](_0x2505e2);})[_0xdd67('0x21')](function(_0x40ecc2){_0x34969e=_[_0xdd67('0x11b')](_0x40ecc2);var _0x851043=_['map'](_0x34969e,function(_0x44f7de){return _0x44f7de[_0xdd67('0x11c')](_0x39d929['id'],{'transaction':_0xfe3432});});return Promise[_0xdd67('0x56')](_0x851043);})[_0xdd67('0x21')](function(){if(!_0x39d929[_0xdd67('0x9f')])return;var _0x3760e7=_[_0xdd67('0x35')](_0x34969e,function(_0x99012f){return _0x99012f['getDataValue'](_0xdd67('0xb4'))===_0xdd67('0x11d');});var _0x49dca4=_[_0xdd67('0x37')](_0x3760e7,function(_0x2d08bc){return db[_0xdd67('0xb1')][_0xdd67('0xb2')]({'membername':_0x39d929[_0xdd67('0x3b')],'UserId':_0x39d929['id'],'queue_name':_0x2d08bc[_0xdd67('0x3b')],'VoiceQueueId':_0x2d08bc['id'],'interface':_[_0xdd67('0x6a')](_0x39d929['interface'])?util[_0xdd67('0xaf')](_0xdd67('0xb0'),_0x39d929[_0xdd67('0x3b')]):_0x39d929['interface'],'paused':_0x39d929['voicePause']||![],'penalty':_0x39d929[_0xdd67('0x11e')]},{'transaction':_0xfe3432});});return Promise['all'](_0x49dca4);})[_0xdd67('0x21')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x1feb0a}}});})[_0xdd67('0x21')](function(_0xeb8214){var _0x39d6da=_[_0xdd67('0x37')](_0xeb8214,function(_0x10ee0d){return db[_0xdd67('0x11f')]['create']({'UserId':_0x39d929['id'],'VoicePrefixId':_0x10ee0d[_0xdd67('0x120')]},{'transaction':_0xfe3432});});return Promise[_0xdd67('0x56')](_0x39d6da);});});})[_0xdd67('0x21')](function(){for(var _0x31cd21=0x0;_0x31cd21<_0x34969e[_0xdd67('0x70')];_0x31cd21++){var _0x32a09f=_0x34969e[_0x31cd21][_0xdd67('0x121')]('channel');var _0x18ae49=_0x32a09f+_0xdd67('0xaa');socket['emit']('user'+_0x32a09f+'Queue:save',{'UserId':_0x1c51da,['queueField']:_0x34969e[_0x31cd21]['id']});}})[_0xdd67('0x21')](respondWithStatusCode(_0x1cddf9,null))[_0xdd67('0x2c')](APIHandleError(_0x1cddf9));};exports[_0xdd67('0x122')]=function(_0x38b592,_0x2b83d4){var _0x32d3d7=_0x38b592[_0xdd67('0x58')]['id'];var _0x5468d8=null;if(_0x38b592[_0xdd67('0x49')][_0xdd67('0x62')]){_0x5468d8=_[_0xdd67('0xb6')](_0x38b592[_0xdd67('0x49')][_0xdd67('0x62')])?_0x38b592[_0xdd67('0x49')][_0xdd67('0x62')]:[_0x38b592[_0xdd67('0x49')][_0xdd67('0x62')]];}var _0x1a4cbc=[];return Promise['resolve']()[_0xdd67('0x21')](function(){if(!_0x5468d8)throw new APIBadRequestError(_0xdd67('0x123'));})[_0xdd67('0x21')](function(){return db[_0xdd67('0x48')]['findOne']({'where':{'id':_0x32d3d7}});})['then'](function(_0x294b31){if(!_0x294b31)throw new APINotFoundError(util[_0xdd67('0xaf')](_0xdd67('0xd0'),_0x38b592['params']['id']));return db[_0xdd67('0x6d')][_0xdd67('0xfe')](function(_0x3ff66c){return _0x294b31['removeTeams'](_0x5468d8,{'transaction':_0x3ff66c})[_0xdd67('0x21')](function(){return db['Team'][_0xdd67('0xae')]({'where':{'id':{'$in':_0x5468d8}}});})['then'](function(_0x1814d6){var _0x1a169b=_['map'](_0x1814d6,function(_0x506eef){return _0x506eef['getAssociatedQueues']();});return Promise[_0xdd67('0x56')](_0x1a169b);})[_0xdd67('0x21')](function(_0x205db8){_0x1a4cbc=_['flattenDeep'](_0x205db8);var _0x35f8b7=_['map'](_0x1a4cbc,function(_0x10dec1){return _0x10dec1['removeAgent'](_0x294b31['id'],{'transaction':_0x3ff66c});});return Promise[_0xdd67('0x56')](_0x35f8b7);})[_0xdd67('0x21')](function(){if(!_0x294b31[_0xdd67('0x9f')])return;var _0x262eb2=_['filter'](_0x1a4cbc,function(_0x1af9a){return _0x1af9a['getDataValue'](_0xdd67('0xb4'))==='Voice';});var _0x3fd4e5=_['map'](_0x262eb2,function(_0xf27308){return db[_0xdd67('0xb1')][_0xdd67('0x3d')]({'where':{'VoiceQueueId':_0xf27308['id'],'UserId':_0x294b31['id']},'transaction':_0x3ff66c});});return Promise[_0xdd67('0x56')](_0x3fd4e5);})[_0xdd67('0x21')](function(){return db[_0xdd67('0x124')][_0xdd67('0xae')]({'where':{'teamId':{'$in':_0x5468d8}}});})[_0xdd67('0x21')](function(_0x2f62b5){var _0x461522=_[_0xdd67('0x37')](_0x2f62b5,function(_0x4a2d78){return db['UserVoicePrefix'][_0xdd67('0x3d')]({'where':{'UserId':_0x294b31['id'],'VoicePrefixId':_0x4a2d78[_0xdd67('0x120')]}},{'transaction':_0x3ff66c});});return Promise['all'](_0x461522);});});})[_0xdd67('0x21')](function(){for(var _0x7040dc=0x0;_0x7040dc<_0x1a4cbc[_0xdd67('0x70')];_0x7040dc++){var _0x175185=_0x1a4cbc[_0x7040dc]['getDataValue']('channel');var _0x2f595f=_0x175185+'QueueId';socket[_0xdd67('0xab')](_0xdd67('0x83')+_0x175185+_0xdd67('0xb7'),{'UserId':_0x32d3d7,['queueField']:_0x1a4cbc[_0x7040dc]['id']});}})[_0xdd67('0x21')](respondWithStatusCode(_0x2b83d4,null))[_0xdd67('0x2c')](APIHandleError(_0x2b83d4));};exports['getLists']=function(_0x4f888c,_0x261428){var _0x417a5d={};var _0x889963={};var _0x4e88d4;var _0x11959b;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x4f888c['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x261428,null))[_0xdd67('0x21')](function(_0x2abae5){if(_0x2abae5){_0x4e88d4=_0x2abae5;_0x889963['model']=_[_0xdd67('0xd8')](db['CmList'][_0xdd67('0x40')]);_0x889963['query']=_[_0xdd67('0xd8')](_0x4f888c[_0xdd67('0x49')]);_0x889963['filters']=_['intersection'](_0x889963['model'],_0x889963[_0xdd67('0x49')]);_0x417a5d[_0xdd67('0x4e')]=_['intersection'](_0x889963['model'],qs[_0xdd67('0xdb')](_0x4f888c[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x417a5d[_0xdd67('0x4e')]=_0x417a5d[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x417a5d['attributes']:_0x889963[_0xdd67('0xd7')];_0x417a5d[_0xdd67('0xdc')]=qs['sort'](_0x4f888c[_0xdd67('0x49')][_0xdd67('0xdd')]);_0x417a5d[_0xdd67('0x47')]=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x4f888c['query'],_0x889963['filters']));if(_0x4f888c[_0xdd67('0x49')][_0xdd67('0x35')]){_0x417a5d['where']=_[_0xdd67('0x5a')](_0x417a5d[_0xdd67('0x47')],{'$or':_[_0xdd67('0x37')](_0x417a5d[_0xdd67('0x4e')],function(_0x217bfb){var _0x354b4b={};_0x354b4b[_0x217bfb]={'$like':'%'+_0x4f888c[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x354b4b;})});}_0x417a5d=_[_0xdd67('0x5a')]({},_0x417a5d,_0x4f888c['options']);return _0x4e88d4['getLists'](_0x417a5d);}})[_0xdd67('0x21')](function(_0x4b09c6){if(_0x4b09c6){_0x11959b=_0x4b09c6['length'];if(!_0x4f888c[_0xdd67('0x49')][_0xdd67('0xe1')]('nolimit')){_0x417a5d['limit']=qs[_0xdd67('0x1d')](_0x4f888c[_0xdd67('0x49')]['limit']);_0x417a5d[_0xdd67('0x1b')]=qs['offset'](_0x4f888c[_0xdd67('0x49')][_0xdd67('0x1b')]);}return _0x4e88d4[_0xdd67('0x125')](_0x417a5d);}})[_0xdd67('0x21')](function(_0x2e21a2){if(_0x2e21a2){return _0x2e21a2?{'count':_0x11959b,'rows':_0x2e21a2}:null;}})['then'](respondWithResult(_0x261428,null))['catch'](handleError(_0x261428,null));};exports[_0xdd67('0x126')]=function(_0x41ccc3,_0x25a1a1){var _0x2d2db3={};var _0x1b3cf9={};var _0x49e8bc;return db[_0xdd67('0x48')][_0xdd67('0x9b')]({'where':{'id':_0x41ccc3['params']['id']}})[_0xdd67('0x21')](handleEntityNotFound(_0x25a1a1,null))[_0xdd67('0x21')](function(_0x558199){if(_0x558199){_0x49e8bc=_0x558199;_0x1b3cf9[_0xdd67('0xd7')]=_[_0xdd67('0xd8')](db[_0xdd67('0x48')][_0xdd67('0x40')]);_0x1b3cf9[_0xdd67('0x49')]=_[_0xdd67('0xd8')](_0x41ccc3[_0xdd67('0x49')]);_0x1b3cf9[_0xdd67('0xd9')]=_[_0xdd67('0xda')](_0x1b3cf9[_0xdd67('0xd7')],_0x1b3cf9[_0xdd67('0x49')]);_0x2d2db3['attributes']=_[_0xdd67('0xda')](_0x1b3cf9[_0xdd67('0xd7')],qs[_0xdd67('0xdb')](_0x41ccc3[_0xdd67('0x49')][_0xdd67('0xdb')]));_0x2d2db3[_0xdd67('0x4e')]=_0x2d2db3[_0xdd67('0x4e')][_0xdd67('0x70')]?_0x2d2db3[_0xdd67('0x4e')]:_0x1b3cf9[_0xdd67('0xd7')];_0x2d2db3[_0xdd67('0xdc')]=qs[_0xdd67('0xdd')](_0x41ccc3['query'][_0xdd67('0xdd')]);_0x2d2db3['where']=qs[_0xdd67('0xd9')](_[_0xdd67('0xde')](_0x41ccc3[_0xdd67('0x49')],_0x1b3cf9[_0xdd67('0xd9')]));if(_0x41ccc3[_0xdd67('0x49')][_0xdd67('0x35')]){_0x2d2db3['where']=_[_0xdd67('0x5a')](_0x2d2db3['where'],{'$or':_['map'](_0x2d2db3[_0xdd67('0x4e')],function(_0x362881){var _0x553dca={};_0x553dca[_0x362881]={'$like':'%'+_0x41ccc3[_0xdd67('0x49')][_0xdd67('0x35')]+'%'};return _0x553dca;})});}_0x2d2db3[_0xdd67('0xd7')]=db[_0xdd67('0x48')];_0x2d2db3['as']='Agents';_0x2d2db3=_[_0xdd67('0x5a')]({},_0x2d2db3,_0x41ccc3[_0xdd67('0x5b')]);return _0x49e8bc[_0xdd67('0x101')]({'include':[_0x2d2db3]});}})[_0xdd67('0x21')](function(_0x4fbf43){if(_0x4fbf43){var _0x500e43={},_0x2d4b58=[];for(var _0x3300e4=0x0;_0x3300e4<_0x4fbf43[_0xdd67('0x70')];_0x3300e4+=0x1){for(var _0x2b4c8e=0x0,_0x39cb19;_0x2b4c8e<_0x4fbf43[_0x3300e4]['Agents'][_0xdd67('0x70')];_0x2b4c8e+=0x1){_0x39cb19=_0x4fbf43[_0x3300e4][_0xdd67('0x32')][_0x2b4c8e][_0xdd67('0x30')]({'plain':!![]});_0x500e43[_0x39cb19['id']]=_0x39cb19;}}_0x500e43=_[_0xdd67('0x127')](_0x500e43);for(var _0x1448ce=qs[_0xdd67('0x1b')](_0x41ccc3[_0xdd67('0x49')]['offset']);_0x1448ce<_0x500e43[_0xdd67('0x70')]&&_0x2d4b58['length']=_0x466078){_0x4885b5=_0x466078;_0x53f2db=0xc8;}else{_0x53f2db=0xce;}_0x10842d[_0x2d62('0x21')](_0x53f2db);return _0x10842d[_0x2d62('0x22')]('Content-Range',_0x584104+'-'+_0x4885b5+'/'+_0x466078)['json'](_0x3f5c2e);}return null;};}function respondWithRpcPromise(_0x2da3ee,_0xccd517,_0x42b11c,_0x4154a0){return new Promise(function(_0xd08500,_0x467131){var _0x325f4b=_0x4154a0||amiClient;return _0x325f4b[_0x2d62('0x23')](_0x2da3ee,_0x42b11c)[_0x2d62('0x24')](function(_0x496070){logger['info']('User,\x20%s,\x20%s',_0xccd517,_0x2d62('0x25'));logger['debug'](_0x2d62('0x26'),_0xccd517,_0x2d62('0x25'),JSON[_0x2d62('0x27')](_0x496070));if(_0x496070[_0x2d62('0x28')]){if(_0x496070[_0x2d62('0x28')][_0x2d62('0x29')]===0x1f4){logger[_0x2d62('0x28')]('User,\x20%s,\x20%s',_0xccd517,_0x496070[_0x2d62('0x28')][_0x2d62('0x2a')]);return _0x467131(_0x496070[_0x2d62('0x28')]['message']);}logger[_0x2d62('0x28')](_0x2d62('0x2b'),_0xccd517,_0x496070[_0x2d62('0x28')][_0x2d62('0x2a')]);return _0xd08500(_0x496070[_0x2d62('0x28')][_0x2d62('0x2a')]);}else{logger[_0x2d62('0x2c')](_0x2d62('0x2b'),_0xccd517,_0x2d62('0x25'));_0xd08500(_0x496070[_0x2d62('0x2d')][_0x2d62('0x2a')]);}})[_0x2d62('0x2e')](function(_0x1294c0){logger['error'](_0x2d62('0x2b'),_0xccd517,_0x1294c0);_0x467131(_0x1294c0);});});}function saveUpdates(_0x33262d){return function(_0x3e4d0a){if(_0x3e4d0a){return _0x3e4d0a[_0x2d62('0x2f')](_0x33262d)[_0x2d62('0x24')](function(_0x409ef9){if(_0x409ef9[_0x2d62('0x30')]==='agent'){socket[_0x2d62('0x31')](_0x2d62('0x32')+_0x409ef9['id'],_0x409ef9);}return _0x409ef9;});}return null;};}function removeEntity(_0x559272,_0x47b365){return function(_0x4a7a53){if(_0x4a7a53){return _0x4a7a53['destroy']({'transaction':_0x47b365})[_0x2d62('0x24')](function(){var _0x5f5a4b=_0x4a7a53[_0x2d62('0x33')]({'plain':!![]});if(_0x5f5a4b[_0x2d62('0x30')]===_0x2d62('0x34'))return;var _0x2c3ca3=[{'name':_0x2d62('0x35'),'value':_0x2d62('0x36'),'ignore':!![]},{'name':_0x2d62('0x37'),'value':'agent','ignore':![]},{'name':_0x2d62('0x38'),'value':'telephone','ignore':![]}];var _0x58041e=_(_0x2c3ca3)['filter']('ignore')[_0x2d62('0x39')](_0x2d62('0x3a'))[_0x2d62('0x3a')]();if(_[_0x2d62('0x3b')](_0x58041e,_0x5f5a4b[_0x2d62('0x30')])){return;}var _0x5b6aa=_[_0x2d62('0x3c')](_0x2c3ca3,['value',_0x5f5a4b['role']])[_0x2d62('0x3d')];return db[_0x2d62('0x3e')][_0x2d62('0x3f')]({'where':{'type':_0x5b6aa,'resourceId':_0x5f5a4b['id']},'transaction':_0x47b365})[_0x2d62('0x24')](function(){return _0x4a7a53;});})['then'](function(){_0x559272['status'](0xcc)[_0x2d62('0x40')]();});}};}function handleEntityNotFound(_0x533ca5){return function(_0x4c9256){if(!_0x4c9256){_0x533ca5[_0x2d62('0x1b')](0x194);}return _0x4c9256;};}function handleError(_0x145045,_0x10e8d5){_0x10e8d5=_0x10e8d5||0x1f4;return function(_0x3ff6a5){logger[_0x2d62('0x28')](_0x3ff6a5[_0x2d62('0x41')]);if(_0x3ff6a5['name']){delete _0x3ff6a5[_0x2d62('0x3d')];}_0x145045[_0x2d62('0x21')](_0x10e8d5)['send'](_0x3ff6a5);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0x2d62('0x39')](function(_0x4ed7fb){return{'name':_0x4ed7fb[_0x2d62('0x42')],'type':_0x4ed7fb[_0x2d62('0x43')][_0x2d62('0x44')]};})[_0x2d62('0x45')](function(_0x323eb0){return![_0x2d62('0x46'),'salt','previousPasswords',_0x2d62('0x47'),'resetPasswordExpires','md5secret'][_0x2d62('0x3b')](_0x323eb0[_0x2d62('0x3d')]);})[_0x2d62('0x3a')]();}exports['index']=function(_0x285930,_0x5b5d1d){var _0x1b5a86={},_0x1a466d={'count':0x0,'rows':[]};var _0x18eb18=getUserAttributes();_0x1b5a86=qs['getOptions'](_0x18eb18,_0x285930);var _0xd2a21f={'where':_0x1b5a86[_0x2d62('0x48')]};return db[_0x2d62('0x49')][_0x2d62('0x20')](_0xd2a21f)[_0x2d62('0x24')](function(_0xd65a37){_0x1a466d[_0x2d62('0x20')]=_0xd65a37;if(_0x285930[_0x2d62('0x4a')]['includeAll']){_0x1b5a86[_0x2d62('0x4b')]=[{'all':!![]}];}if(_0x285930[_0x2d62('0x4a')][_0x2d62('0x4c')]===_0x2d62('0x4d')){_0x1b5a86[_0x2d62('0x4b')]=[{'model':db[_0x2d62('0x4e')],'as':'userSetting'}];}if(!_[_0x2d62('0x3b')](_0x1b5a86[_0x2d62('0x4f')],'id')){_0x1b5a86['attributes'][_0x2d62('0x50')]('id');}return db[_0x2d62('0x49')][_0x2d62('0x51')](_0x1b5a86);})['then'](function(_0x57c9be){_0x1a466d[_0x2d62('0x52')]=_0x57c9be;if(_0x285930[_0x2d62('0x4a')]['openTabs']==='true'){var _0x13eb39=[];for(var _0x4de471=0x0;_0x4de471<_0x1a466d[_0x2d62('0x52')]['length'];_0x4de471++){_0x13eb39[_0x2d62('0x50')](get_open_tabs('chat',_0x1a466d[_0x2d62('0x52')][_0x4de471][_0x2d62('0x53')]));_0x13eb39[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x54'),_0x1a466d['rows'][_0x4de471][_0x2d62('0x53')]));_0x13eb39[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x55'),_0x1a466d[_0x2d62('0x52')][_0x4de471][_0x2d62('0x53')]));_0x13eb39[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x56'),_0x1a466d[_0x2d62('0x52')][_0x4de471][_0x2d62('0x53')]));_0x13eb39['push'](get_open_tabs(_0x2d62('0x57'),_0x1a466d[_0x2d62('0x52')][_0x4de471][_0x2d62('0x53')]));_0x13eb39['push'](get_open_tabs(_0x2d62('0x58'),_0x1a466d['rows'][_0x4de471][_0x2d62('0x53')]));}return Promise[_0x2d62('0x59')](_0x13eb39)[_0x2d62('0x24')](function(){return _0x1a466d;});}else{return _0x1a466d;}})['then'](respondWithFilteredResult(_0x5b5d1d,_0x1b5a86))[_0x2d62('0x2e')](handleError(_0x5b5d1d,null));};exports[_0x2d62('0x5a')]=function(_0xe65a4e,_0x105ca5){var _0x518502=getUserAttributes();_0xe65a4e[_0x2d62('0x4a')]['id']=_0xe65a4e['params']['id'];var _0x2d0126=qs['getOptions'](_0x518502,_0xe65a4e);if(_0xe65a4e[_0x2d62('0x4a')][_0x2d62('0x5b')]){_0x2d0126['include']=[{'all':!![]}];}if(_0xe65a4e[_0x2d62('0x4a')]['userSetting']==='true'){_0x2d0126[_0x2d62('0x4b')]=[{'model':db[_0x2d62('0x4e')],'as':_0x2d62('0x4c')}];}_0x2d0126=_['merge']({},_0x2d0126,_0xe65a4e['options']);if(!_[_0x2d62('0x3b')](_0x2d0126[_0x2d62('0x4f')],'id')){_0x2d0126['attributes'][_0x2d62('0x50')]('id');}return db['User'][_0x2d62('0x3c')](_0x2d0126)[_0x2d62('0x24')](handleEntityNotFound(_0x105ca5,null))[_0x2d62('0x24')](function(_0x33e198){var _0x23fa2b=[];values=_0x33e198;if(_0xe65a4e[_0x2d62('0x4a')][_0x2d62('0x5c')]==='true'){_0x23fa2b[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x5d'),_0x33e198[_0x2d62('0x53')]));_0x23fa2b[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x54'),_0x33e198['dataValues']));_0x23fa2b[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x57'),_0x33e198[_0x2d62('0x53')]));_0x23fa2b['push'](get_open_tabs('whatsapp',_0x33e198['dataValues']));_0x23fa2b[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x55'),_0x33e198[_0x2d62('0x53')]));_0x23fa2b[_0x2d62('0x50')](get_open_tabs('mail',_0x33e198['dataValues']));return Promise[_0x2d62('0x59')](_0x23fa2b);}else{return values;}})[_0x2d62('0x24')](function(){return values;})[_0x2d62('0x24')](respondWithResult(_0x105ca5,null))[_0x2d62('0x2e')](handleError(_0x105ca5,null));};exports['update']=function(_0x2067e7,_0x8407d8){if(_0x2067e7['body']['id']){delete _0x2067e7[_0x2d62('0x5e')]['id'];}delete _0x2067e7[_0x2d62('0x5e')][_0x2d62('0x30')];return db[_0x2d62('0x49')][_0x2d62('0x3c')]({'where':{'id':_0x2067e7['params']['id']}})['then'](handleEntityNotFound(_0x8407d8,null))['then'](saveUpdates(_0x2067e7[_0x2d62('0x5e')],null))[_0x2d62('0x24')](respondWithResult(_0x8407d8,null))['catch'](handleError(_0x8407d8,null));};exports[_0x2d62('0x5f')]=function(_0x512772,_0x82e6f6){return db['User']['describe']()[_0x2d62('0x24')](respondWithResult(_0x82e6f6,null))['catch'](handleError(_0x82e6f6,null));};exports[_0x2d62('0x60')]=function(_0x3890f5,_0x307ec8){return db[_0x2d62('0x49')][_0x2d62('0x3c')]({'where':{'id':_0x3890f5[_0x2d62('0x61')]['id']}})['then'](handleEntityNotFound(_0x307ec8,null))['then'](function(_0x110b36){if(_0x110b36){return _0x110b36[_0x2d62('0x60')](_0x3890f5[_0x2d62('0x5e')][_0x2d62('0x62')],_['omit'](_0x3890f5[_0x2d62('0x5e')],['ids','id'])||{});}})[_0x2d62('0x24')](respondWithResult(_0x307ec8,null))['catch'](handleError(_0x307ec8,null));};function validateUser(_0x525920){return new Promise(function(_0x51fd84,_0x10edfd){if(_0x525920[_0x2d62('0x63')])return _0x51fd84(_0x525920);return db[_0x2d62('0x64')][_0x2d62('0x65')](0x1)[_0x2d62('0x24')](function(_0x4d5f99){if(_0x4d5f99['securePassword'])authService[_0x2d62('0x66')](_0x525920['password']);db['User']['max'](_0x2d62('0x63'))[_0x2d62('0x24')](function(_0x4885e0){if(_['isNil'](_0x4885e0)){_0x525920[_0x2d62('0x63')]=_0x4d5f99['min_internal']||0x1;return;}if(_[_0x2d62('0x67')](_0x4d5f99['min_internal'])||_0x4d5f99[_0x2d62('0x68')]===_0x4885e0){_0x525920[_0x2d62('0x63')]=_0x4885e0+0x1;return;}if(_0x4d5f99[_0x2d62('0x68')]>_0x4885e0){_0x525920[_0x2d62('0x63')]=_0x4d5f99[_0x2d62('0x68')];return;}return db['sequelize']['query'](_0x2d62('0x69'),{'type':db[_0x2d62('0x6a')][_0x2d62('0x6b')][_0x2d62('0x6c')]})['then'](function(_0x2740de){if(_0x2740de&&_0x2740de[_0x2d62('0x6d')]){for(var _0x57a77e=0x0,_0x7cc507=_0x2740de[_0x2d62('0x6d')];_0x57a77e<_0x7cc507&&_['isNil'](_0x525920[_0x2d62('0x63')]);_0x57a77e++){if(_0x4d5f99['min_internal']<=_0x2740de[_0x57a77e][_0x2d62('0x6e')]){_0x525920[_0x2d62('0x63')]=_0x2740de[_0x57a77e][_0x2d62('0x6e')];}else if(_0x4d5f99[_0x2d62('0x68')]>_0x2740de[_0x57a77e][_0x2d62('0x6e')]&&_0x4d5f99[_0x2d62('0x68')]<=_0x2740de[_0x57a77e]['to']){_0x525920[_0x2d62('0x63')]=_0x4d5f99[_0x2d62('0x68')];}}}if(_[_0x2d62('0x67')](_0x525920[_0x2d62('0x63')])){_0x525920[_0x2d62('0x63')]=_0x4885e0+0x1;}return _0x51fd84(_0x525920);});});})[_0x2d62('0x2e')](function(_0x71cd1b){_0x10edfd(_0x71cd1b);});});}function updateUser(_0x4e73a0){return new Promise(function(_0x226008,_0x23be3d){try{if(_0x4e73a0[_0x2d62('0x6f')]){_0x4e73a0[_0x2d62('0x70')]=_0x4e73a0[_0x2d62('0x63')];_0x4e73a0[_0x2d62('0x71')]={'mailbox':_0x4e73a0[_0x2d62('0x63')],'password':_0x4e73a0[_0x2d62('0x46')],'fullname':_0x4e73a0[_0x2d62('0x72')],'email':_0x4e73a0['email']};}if(_0x4e73a0[_0x2d62('0x30')]===_0x2d62('0x73')){if(!_0x4e73a0[_0x2d62('0x74')])_0x4e73a0['permissions']=['101',_0x2d62('0x75'),_0x2d62('0x76'),_0x2d62('0x77'),_0x2d62('0x78'),_0x2d62('0x79'),'105',_0x2d62('0x7a'),_0x2d62('0x7b'),_0x2d62('0x7c'),'109',_0x2d62('0x7d'),'111',_0x2d62('0x7e'),'115'];}_0x226008(_0x4e73a0);}catch(_0x1f5520){_0x23be3d(_0x1f5520);}});}exports[_0x2d62('0x7f')]=function(_0x583842,_0x207944){if(_0x583842['user']['role']===_0x2d62('0x73'))throw new Error(_0x2d62('0x80'));if(_0x583842[_0x2d62('0x5e')][_0x2d62('0x30')]===_0x2d62('0x36')&&_0x583842[_0x2d62('0x36')][_0x2d62('0x30')]!==_0x2d62('0x34')){throw new Error(_0x2d62('0x81'));}if(_0x583842[_0x2d62('0x5e')][_0x2d62('0x30')]===_0x2d62('0x34')&&_0x583842[_0x2d62('0x36')][_0x2d62('0x30')]!==_0x2d62('0x34')){throw new Error(_0x2d62('0x82'));}return licenseUtil[_0x2d62('0x83')]([_0x583842[_0x2d62('0x5e')]])['then'](function(){return validateUser(_0x583842[_0x2d62('0x5e')]);})[_0x2d62('0x24')](function(_0x3987f3){return updateUser(_0x3987f3)[_0x2d62('0x24')](function(_0x29e6bc){if(_0x29e6bc['role']===_0x2d62('0x34')){_0x29e6bc[_0x2d62('0x84')]=_0x583842[_0x2d62('0x36')][_0x2d62('0x84')];delete _0x29e6bc[_0x2d62('0x85')];}return _0x29e6bc;});})[_0x2d62('0x24')](function(_0x583340){return db['User'][_0x2d62('0x7f')](_0x583340,{'include':[{'model':db['VoiceMail'],'as':_0x2d62('0x71')}]});})['then'](function(_0x24e606){if(_0x583842['body'][_0x2d62('0x30')]===_0x2d62('0x36'))return _0x24e606;if(_0x583842[_0x2d62('0x36')][_0x2d62('0x30')]!==_0x2d62('0x36'))return _0x24e606;return db[_0x2d62('0x86')][_0x2d62('0x3c')]({'where':{'name':_0x24e606[_0x2d62('0x30')]==='agent'?_0x2d62('0x37'):'Telephones','userProfileId':_0x583842[_0x2d62('0x36')][_0x2d62('0x85')]},'raw':!![]})['then'](function(_0xc4d358){if(!_0xc4d358||_0xc4d358[_0x2d62('0x87')]!=0x0)return _0x24e606;return db[_0x2d62('0x3e')]['create']({'name':_0x24e606[_0x2d62('0x3d')],'resourceId':_0x24e606['id'],'type':_0xc4d358['name'],'sectionId':_0xc4d358['id']},{})['then'](function(){return _0x24e606;});})['catch'](function(_0x1cc40b){logger[_0x2d62('0x28')](_0x2d62('0x88'),_0x1cc40b);throw _0x1cc40b;});})[_0x2d62('0x24')](respondWithResult(_0x207944,0xc9))[_0x2d62('0x2e')](handleError(_0x207944,null));};exports[_0x2d62('0x89')]=function(_0x2c88a7,_0x118021){var _0x459770=_0x2c88a7[_0x2d62('0x5e')];var _0x5e24f0=[];if(_0x2c88a7[_0x2d62('0x36')][_0x2d62('0x30')]===_0x2d62('0x73'))throw new Error(_0x2d62('0x80'));if(_[_0x2d62('0x8a')](_0x459770,[_0x2d62('0x30'),'user'])&&_0x2c88a7[_0x2d62('0x36')][_0x2d62('0x30')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x2d62('0x8a')](_0x459770,[_0x2d62('0x30'),'admin'])&&_0x2c88a7[_0x2d62('0x36')][_0x2d62('0x30')]!=='admin'){throw new Error(_0x2d62('0x8b'));}return licenseUtil[_0x2d62('0x83')](_0x459770)['then'](function(){return validateUser(_0x459770[0x0]);})[_0x2d62('0x24')](function(){for(var _0x42a42a=0x1;_0x42a42a<_0x459770[_0x2d62('0x6d')];_0x42a42a++){var _0x16e54f=_0x459770[_0x42a42a-0x1][_0x2d62('0x63')];if(!_0x459770[_0x42a42a]['internal'])_0x459770[_0x42a42a][_0x2d62('0x63')]=_0x16e54f+0x1;_0x5e24f0[_0x2d62('0x50')](validateUser(_0x459770[_0x42a42a]));}return Promise['all'](_0x5e24f0);})[_0x2d62('0x24')](function(){_0x5e24f0=[];for(var _0x38b626=0x0;_0x38b626<_0x459770[_0x2d62('0x6d')];_0x38b626++){_0x5e24f0['push'](updateUser(_0x459770[_0x38b626]));}return Promise[_0x2d62('0x59')](_0x5e24f0);})[_0x2d62('0x24')](function(){_0x5e24f0=_0x459770[_0x2d62('0x39')](function(_0x216e0f){return db[_0x2d62('0x49')]['create'](_0x216e0f,{'include':[{'model':db[_0x2d62('0x71')],'as':_0x2d62('0x71')}]})[_0x2d62('0x24')](function(_0x5084f9){_0x216e0f['id']=_0x5084f9['id'];return _0x216e0f;});});return Promise['all'](_0x5e24f0);})['then'](function(_0x4d891f){if(_0x2c88a7[_0x2d62('0x5e')]['role']===_0x2d62('0x36'))return _0x4d891f;if(_0x2c88a7[_0x2d62('0x36')]['role']!=='user')return _0x4d891f;var _0xac38be=_[_0x2d62('0x8a')](_0x4d891f,function(_0x5cdc92){return _0x5cdc92[_0x2d62('0x30')]==='agent'||_0x5cdc92[_0x2d62('0x30')]===_0x2d62('0x8c');});if(!_0xac38be)return _0x4d891f;return db[_0x2d62('0x86')][_0x2d62('0x51')]({'where':{'name':{'$or':[_0x2d62('0x37'),_0x2d62('0x38')]},'userProfileId':_0x2c88a7['user'][_0x2d62('0x85')]},'raw':!![]})[_0x2d62('0x24')](function(_0x4fccf6){if(_['isEmpty'](_0x4fccf6)||!_[_0x2d62('0x8a')](_0x4fccf6,[_0x2d62('0x87'),0x0]))return _0x4d891f;_0x5e24f0=[];var _0x348956=_(_0x4fccf6)[_0x2d62('0x39')](function(_0x567a32){if(_0x567a32['autoAssociation']===0x1)return;return _0x567a32[_0x2d62('0x3d')]==='Agents'?_0x2d62('0x73'):_0x2d62('0x8c');})[_0x2d62('0x8d')]()[_0x2d62('0x3a')]();for(var _0x3ddcc9=0x0;_0x3ddcc9<_0x4d891f[_0x2d62('0x6d')];_0x3ddcc9++){if(!_['includes'](_0x348956,_0x4d891f[_0x3ddcc9][_0x2d62('0x30')]))return;var _0x166e1b=_0x4d891f[_0x3ddcc9]['role']===_0x2d62('0x73')?_0x2d62('0x37'):_0x2d62('0x38');_0x5e24f0['push'](db[_0x2d62('0x3e')][_0x2d62('0x7f')]({'name':_0x4d891f[_0x3ddcc9][_0x2d62('0x3d')],'resourceId':_0x4d891f[_0x3ddcc9]['id'],'type':_0x166e1b,'sectionId':_['find'](_0x4fccf6,['name',_0x166e1b])['id']},{}));}return Promise[_0x2d62('0x59')](_0x5e24f0);});})['then'](respondWithResult(_0x118021,0xc9))[_0x2d62('0x2e')](handleError(_0x118021,null));};exports[_0x2d62('0x8e')]=function(_0x57c69f,_0x129e22){if(_0x57c69f[_0x2d62('0x5e')]['id']){delete _0x57c69f['body']['id'];}return db[_0x2d62('0x49')][_0x2d62('0x3c')]({'where':{'id':_0x57c69f[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](function(_0x27218e){if(!_0x27218e)return null;if(_0x27218e['id']===_0x57c69f[_0x2d62('0x36')]['id']){if(!_0x57c69f['body']['oldPassword']||!_0x57c69f[_0x2d62('0x5e')]['newPassword']){throw new db[(_0x2d62('0x8f'))][(_0x2d62('0x90'))](_0x2d62('0x91'));}if(!_0x27218e['authenticate'](_0x57c69f['body'][_0x2d62('0x92')])){throw new db['Sequelize'][(_0x2d62('0x90'))](_0x2d62('0x93'));}if(_0x57c69f[_0x2d62('0x5e')]['oldPassword']===_0x57c69f[_0x2d62('0x5e')][_0x2d62('0x94')]){throw new db['Sequelize'][(_0x2d62('0x90'))](_0x2d62('0x95'));}}else if(_0x57c69f[_0x2d62('0x36')]['role']===_0x2d62('0x34')){if(!_0x57c69f[_0x2d62('0x5e')][_0x2d62('0x94')]){throw new db[(_0x2d62('0x8f'))][(_0x2d62('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x57c69f[_0x2d62('0x36')][_0x2d62('0x30')]===_0x2d62('0x36')){if(!_0x57c69f[_0x2d62('0x5e')]['newPassword']){throw new db[(_0x2d62('0x8f'))][(_0x2d62('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x27218e['role']!==_0x2d62('0x73')){throw new db['Sequelize'][(_0x2d62('0x90'))](_0x2d62('0x80'));}}else{throw new db[(_0x2d62('0x8f'))][(_0x2d62('0x90'))](_0x2d62('0x80'));}return _0x27218e;})[_0x2d62('0x24')](handleEntityNotFound(_0x129e22,null))['then'](function(_0x1301ec){return db[_0x2d62('0x64')][_0x2d62('0x96')]({'attributes':['id',_0x2d62('0x97'),_0x2d62('0x98'),'passwordHistoryLimit']})[_0x2d62('0x24')](function(_0x391277){if(_0x391277[_0x2d62('0x97')])authService['validatePasswordPattern'](_0x57c69f['body'][_0x2d62('0x94')]);if(!_0x391277[_0x2d62('0x98')]||!_0x1301ec['previousPasswords'])return _0x1301ec;authService['validatePasswordHistory'](_0x57c69f[_0x2d62('0x5e')]['newPassword'],_0x1301ec['previousPasswords'],_0x391277['passwordHistoryLimit']);return _0x1301ec;})[_0x2d62('0x24')](saveUpdates({'password':_0x57c69f[_0x2d62('0x5e')][_0x2d62('0x94')],'passwordResetAt':_0x57c69f[_0x2d62('0x36')]['id']==_0x57c69f[_0x2d62('0x61')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x57c69f[_0x2d62('0x5e')][_0x2d62('0x94')],_0x1301ec[_0x2d62('0x99')])},null));})['then'](respondWithResult(_0x129e22,null))[_0x2d62('0x2e')](handleError(_0x129e22,null));};exports[_0x2d62('0x9a')]=function(_0x23088e,_0x5228ec){var _0x574130=_0x23088e[_0x2d62('0x5e')]['channel'];return db[_0x2d62('0x49')][_0x2d62('0x3c')]({'where':{'id':_0x23088e[_0x2d62('0x61')]['id']},'attributes':['id',_0x2d62('0x3d'),_0x2d62('0x30'),_0x2d62('0x9b'),_0x2d62('0x9c'),'voicePause',_0x2d62('0x9d')]})['then'](handleEntityNotFound(_0x5228ec,null))[_0x2d62('0x24')](function(_0xa8aec4){if(_0xa8aec4){if(!utils[_0x2d62('0x9e')](_0x574130)){throw new db[(_0x2d62('0x8f'))][(_0x2d62('0x90'))](_0x2d62('0x9f'));}return _0xa8aec4[_0x2d62('0xa0')+_[_0x2d62('0xa1')](_0x574130['toLowerCase']())+_0x2d62('0xa2')](_0x23088e[_0x2d62('0x5e')]['ids'],{'penalty':_0x23088e[_0x2d62('0x5e')][_0x2d62('0xa3')]||0x0})['spread'](function(_0x21b00e){for(var _0x338847=0x0;_0x338847<_0x23088e[_0x2d62('0x5e')][_0x2d62('0x62')][_0x2d62('0x6d')];_0x338847+=0x1){var _0x29fcd7={'UserId':Number(_0x23088e[_0x2d62('0x61')]['id'])};_0x29fcd7[_['capitalize'](_0x574130['toLowerCase']())+_0x2d62('0xa4')]=Number(_0x23088e[_0x2d62('0x5e')][_0x2d62('0x62')][_0x338847]);socket[_0x2d62('0x31')]('user'+_[_0x2d62('0xa1')](_0x574130[_0x2d62('0xa5')]())+_0x2d62('0xa6'),_0x29fcd7);}return _0x21b00e;})[_0x2d62('0x24')](function(){if(_0x574130===_0x2d62('0xa7')){return db[_0x2d62('0xa8')][_0x2d62('0x51')]({'where':{'id':_0x23088e[_0x2d62('0x5e')][_0x2d62('0x62')]||[]},'raw':!![],'attributes':['id',_0x2d62('0x3d')]});}})['then'](function(_0x35bb62){var _0x157014=_0xa8aec4[_0x2d62('0x33')]({'plain':!![]});var _0xd6361f=[];if(_0x574130===_0x2d62('0xa7')&&_0x157014[_0x2d62('0x30')]==='agent'&&_0x157014['online']){for(let _0x299bb4=0x0;_0x299bb4<_0x35bb62['length'];_0x299bb4+=0x1){_0xd6361f[_0x2d62('0x50')]({'membername':_0x157014[_0x2d62('0x3d')],'UserId':_0x157014['id'],'queue_name':_0x35bb62[_0x299bb4][_0x2d62('0x3d')],'VoiceQueueId':_0x35bb62[_0x299bb4]['id'],'interface':_[_0x2d62('0x67')](_0x157014[_0x2d62('0x9d')])?util[_0x2d62('0xa9')]('SIP/%s',_0x157014['name']):_0x157014[_0x2d62('0x9d')],'paused':_0x157014[_0x2d62('0xaa')]||![],'penalty':_0x23088e['body'][_0x2d62('0xa3')]||0x0});}return Promise[_0x2d62('0x59')](_0xd6361f[_0x2d62('0x39')](function(_0x46f751){return db[_0x2d62('0xab')][_0x2d62('0xac')](_0x46f751);}));}return _0xa8aec4;});}})[_0x2d62('0x24')](respondWithStatusCode(_0x5228ec,null))[_0x2d62('0x2e')](handleError(_0x5228ec,null));};exports['removeQueues']=function(_0x3e0018,_0x1700bd){var _0x286bb6,_0x1f90d7;return db[_0x2d62('0x49')]['find']({'where':{'id':_0x3e0018[_0x2d62('0x61')]['id']},'attributes':['id',_0x2d62('0x3d'),_0x2d62('0x30')]})['then'](handleEntityNotFound(_0x1700bd,null))[_0x2d62('0x24')](function(_0x441d6c){if(_0x441d6c){_0x286bb6=_0x441d6c;if(!_0x3e0018[_0x2d62('0x4a')][_0x2d62('0xad')]||!utils[_0x2d62('0x9e')](_0x3e0018[_0x2d62('0x4a')][_0x2d62('0xad')])){throw new db[(_0x2d62('0x8f'))]['ValidationError'](_0x2d62('0x9f'));}return _0x441d6c[_0x2d62('0xae')+_['capitalize'](_0x3e0018[_0x2d62('0x4a')][_0x2d62('0xad')]['toLowerCase']())+_0x2d62('0xa2')](_0x3e0018[_0x2d62('0x4a')][_0x2d62('0x62')]);}})['then'](function(_0x5e7e9d){if(_[_0x2d62('0xaf')](_0x3e0018['query']['ids'])){for(var _0x14c3c8=0x0;_0x14c3c8<_0x3e0018[_0x2d62('0x4a')]['ids'][_0x2d62('0x6d')];_0x14c3c8+=0x1){_0x1f90d7={'UserId':Number(_0x3e0018[_0x2d62('0x61')]['id'])};_0x1f90d7[_[_0x2d62('0xa1')](_0x3e0018[_0x2d62('0x4a')][_0x2d62('0xad')][_0x2d62('0xa5')]())+'QueueId']=Number(_0x3e0018[_0x2d62('0x4a')][_0x2d62('0x62')][_0x14c3c8]);socket[_0x2d62('0x31')](_0x2d62('0x36')+_['capitalize'](_0x3e0018['query'][_0x2d62('0xad')][_0x2d62('0xa5')]())+_0x2d62('0xb0'),_0x1f90d7);}}else{_0x1f90d7={'UserId':Number(_0x3e0018[_0x2d62('0x61')]['id'])};_0x1f90d7[_[_0x2d62('0xa1')](_0x3e0018['query'][_0x2d62('0xad')][_0x2d62('0xa5')]())+'QueueId']=Number(_0x3e0018[_0x2d62('0x4a')][_0x2d62('0x62')]);socket[_0x2d62('0x31')](_0x2d62('0x36')+_[_0x2d62('0xa1')](_0x3e0018[_0x2d62('0x4a')][_0x2d62('0xad')]['toLowerCase']())+'Queue:remove',_0x1f90d7);}return _0x5e7e9d;})[_0x2d62('0x24')](function(){if(_0x3e0018['query'][_0x2d62('0xad')]===_0x2d62('0xa7')){return db[_0x2d62('0xab')]['destroy']({'where':{'UserId':_0x3e0018['params']['id'],'VoiceQueueId':_0x3e0018['query'][_0x2d62('0x62')]},'individualHooks':!![]})[_0x2d62('0x24')](function(){return _0x286bb6;});}return _0x286bb6;})[_0x2d62('0x24')](respondWithStatusCode(_0x1700bd,null))[_0x2d62('0x2e')](handleError(_0x1700bd,null));};exports[_0x2d62('0xb1')]=function(_0x37556d,_0x6338ca){_0x37556d['body']['userpic']=_0x37556d[_0x2d62('0xb2')]['filename'];return db['User'][_0x2d62('0x3c')]({'where':{'id':_0x37556d[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x6338ca,null))[_0x2d62('0x24')](saveUpdates(_0x37556d[_0x2d62('0x5e')],null))['then'](respondWithResult(_0x6338ca,null))[_0x2d62('0x2e')](handleError(_0x6338ca,null));};exports[_0x2d62('0xb3')]=function(_0x47802f,_0x407190){var _0x2f9790=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x2d62('0x49')][_0x2d62('0x3c')]({'where':{'id':_0x47802f[_0x2d62('0x61')]['id']},'attributes':['id',_0x2d62('0xb4')],'raw':!![]})[_0x2d62('0x24')](handleEntityNotFound(_0x407190,null))[_0x2d62('0x24')](function(_0x359eff){if(_0x359eff){if(_['isNil'](_0x359eff[_0x2d62('0xb4')])){return _0x407190[_0x2d62('0xb5')](_0x2f9790);}else{if(!fs[_0x2d62('0xb6')](path[_0x2d62('0xb7')](config['root'],_0x2d62('0xb8'),_0x359eff[_0x2d62('0xb4')]))){return _0x407190[_0x2d62('0xb5')](_0x2f9790);}return _0x407190[_0x2d62('0xb5')](path[_0x2d62('0xb7')](config[_0x2d62('0xb9')],'server/files/images/',_0x359eff[_0x2d62('0xb4')]));}}})[_0x2d62('0x2e')](handleError(_0x407190,null));};exports[_0x2d62('0xba')]=function(_0x49fa41,_0x411640){return db[_0x2d62('0x49')]['find']({'where':{'id':_0x49fa41[_0x2d62('0x61')]['id']},'attributes':['id']})[_0x2d62('0x24')](handleEntityNotFound(_0x411640,null))[_0x2d62('0x24')](function(_0x582708){var _0x497bd1=[];values=_0x582708[_0x2d62('0x53')];_0x497bd1[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x5d'),_0x582708[_0x2d62('0x53')]));_0x497bd1[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x54'),_0x582708[_0x2d62('0x53')]));_0x497bd1[_0x2d62('0x50')](get_open_tabs(_0x2d62('0x57'),_0x582708['dataValues']));_0x497bd1['push'](get_open_tabs('whatsapp',_0x582708[_0x2d62('0x53')]));_0x497bd1['push'](get_open_tabs(_0x2d62('0x55'),_0x582708[_0x2d62('0x53')]));_0x497bd1[_0x2d62('0x50')](get_open_tabs('mail',_0x582708[_0x2d62('0x53')]));return Promise[_0x2d62('0x59')](_0x497bd1);})[_0x2d62('0x24')](function(_0x582bbe){if(_0x582bbe){var _0x11bd78=_[_0x2d62('0x39')](values[_0x2d62('0xbb')],function(_0x111186){return{'channel':'CHAT','id':_0x111186['id'],'createdAt':_0x111186['createdAt']};});var _0x561876=_[_0x2d62('0x39')](values[_0x2d62('0xbc')],function(_0x184641){return{'channel':'FAX','id':_0x184641['id'],'createdAt':_0x184641['createdAt']};});var _0x4305fd=_[_0x2d62('0x39')](values['OpenchannelOpenTabs'],function(_0x1cf843){return{'channel':'OPENCHANNEL','id':_0x1cf843['id'],'createdAt':_0x1cf843[_0x2d62('0xbd')]};});var _0x2c7533=_[_0x2d62('0x39')](values[_0x2d62('0xbe')],function(_0x451dee){return{'channel':_0x2d62('0xbf'),'id':_0x451dee['id'],'createdAt':_0x451dee['createdAt']};});var _0x58a45c=_[_0x2d62('0x39')](values[_0x2d62('0xc0')],function(_0x5310bc){return{'channel':_0x2d62('0xc1'),'id':_0x5310bc['id'],'createdAt':_0x5310bc[_0x2d62('0xbd')]};});var _0x1409cb=_[_0x2d62('0x39')](values[_0x2d62('0xc2')],function(_0xc31deb){return{'channel':_0x2d62('0xc3'),'id':_0xc31deb['id'],'createdAt':_0xc31deb[_0x2d62('0xbd')]};});var _0x40c41e=_[_0x2d62('0xc4')](_0x11bd78,_0x561876,_0x4305fd,_0x2c7533,_0x58a45c,_0x1409cb);var _0x957c47={'count':_0x40c41e['length'],'rows':_0x40c41e};return _0x957c47;}else return null;})['then'](respondWithResult(_0x411640,null))['catch'](handleError(_0x411640,null));};exports[_0x2d62('0xc5')]=function(_0x1e34ee,_0x4f36c2){var _0x848fe={};return db['User'][_0x2d62('0x96')]({'where':{'id':_0x1e34ee[_0x2d62('0x61')]['id']}})['then'](function(_0xc5b02a){if(!_0xc5b02a){throw new APINotFoundError(util[_0x2d62('0xa9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1e34ee[_0x2d62('0x61')]['id']));}return contacts[_0x2d62('0x5f')]();})[_0x2d62('0x24')](function(_0xdb9760){_0x1e34ee[_0x2d62('0x4a')][_0x2d62('0x49')]=_0x1e34ee[_0x2d62('0x61')]['id'];_0x848fe=qs['getOptions'](_0xdb9760,_0x1e34ee);if(_0x1e34ee[_0x2d62('0x4a')][_0x2d62('0xc6')](_0x2d62('0x5b'))){_0x848fe[_0x2d62('0x4b')]=[{'model':db[_0x2d62('0xc7')],'as':_0x2d62('0xc8'),'required':![]},{'model':db['Tag'],'as':_0x2d62('0xc9'),'attributes':['id','name',_0x2d62('0xca')],'where':_0x1e34ee['query'][_0x2d62('0xcb')]?{'id':_0x1e34ee[_0x2d62('0x4a')][_0x2d62('0xcb')]}:undefined,'required':_0x1e34ee[_0x2d62('0x4a')][_0x2d62('0xcb')]?!![]:![]}];}return contacts[_0x2d62('0x51')](_0x1e34ee['query'],_0x1e34ee[_0x2d62('0x36')],_0x848fe,_0xdb9760);})[_0x2d62('0x24')](respondWithFilteredResult(_0x4f36c2,_0x848fe))[_0x2d62('0x2e')](APIHandleError(_0x4f36c2));};exports[_0x2d62('0xcc')]=function(_0xe27ddb,_0x3bd333){var _0x1e6e96;var _0xca8086={};var _0xe413dc;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0xe27ddb[_0x2d62('0x61')]['id']},'attributes':['id',_0x2d62('0x3d'),'role']})[_0x2d62('0x24')](handleEntityNotFound(_0x3bd333,null))[_0x2d62('0x24')](function(_0x207481){if(!utils[_0x2d62('0x9e')](_0xe27ddb[_0x2d62('0x4a')][_0x2d62('0xad')])){throw new db['Sequelize']['ValidationError'](_0x2d62('0x9f'));}_0x1e6e96=_0x207481;var _0x343f82={};_0x343f82[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db[_[_0x2d62('0xa1')](_0xe27ddb[_0x2d62('0x4a')][_0x2d62('0xad')])+'Queue']['rawAttributes']);_0x343f82['query']=_[_0x2d62('0xce')](_0xe27ddb[_0x2d62('0x4a')]);_0x343f82[_0x2d62('0xcf')]=_[_0x2d62('0xd0')](_0x343f82['model'],_0x343f82[_0x2d62('0x4a')]);_0xca8086[_0x2d62('0x4f')]=_[_0x2d62('0xd0')](_0x343f82[_0x2d62('0xcd')],qs[_0x2d62('0xd1')](_0xe27ddb[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0xca8086[_0x2d62('0x4f')]=_0xca8086['attributes'][_0x2d62('0x6d')]?_0xca8086[_0x2d62('0x4f')]:_0x343f82[_0x2d62('0xcd')];_0xca8086[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0xe27ddb['query'][_0x2d62('0xd3')]);_0xca8086['where']=qs[_0x2d62('0xcf')](_['pick'](_0xe27ddb[_0x2d62('0x4a')],_0x343f82['filters']));if(_0xe27ddb['query'][_0x2d62('0x45')]){_0xca8086[_0x2d62('0x48')]=_['merge'](_0xca8086[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0xca8086['attributes'],function(_0x3efddd){var _0x72d772={};_0x72d772[_0x3efddd]={'$like':'%'+_0xe27ddb['query'][_0x2d62('0x45')]+'%'};return _0x72d772;})});}_0xca8086=_[_0x2d62('0xd4')]({},_0xca8086,_0xe27ddb['options']);switch(_0x1e6e96[_0x2d62('0x30')]){case'admin':return db[_[_0x2d62('0xa1')](_0xe27ddb[_0x2d62('0x4a')]['channel'])+_0x2d62('0xd5')][_0x2d62('0x51')](_0xca8086);case _0x2d62('0x36'):case _0x2d62('0x73'):return _0x1e6e96[_0x2d62('0x33')+_[_0x2d62('0xa1')](_0xe27ddb[_0x2d62('0x4a')][_0x2d62('0xad')])+_0x2d62('0xa2')](_0xca8086);default:throw new db[(_0x2d62('0x8f'))]['ValidationError'](_0x2d62('0xd6'));}})['then'](function(_0x3fc3ae){_0xe413dc=_0x3fc3ae[_0x2d62('0x6d')];if(!_0xe27ddb['query'][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0xca8086[_0x2d62('0x1f')]=qs['limit'](_0xe27ddb[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0xca8086['offset']=qs['offset'](_0xe27ddb[_0x2d62('0x4a')][_0x2d62('0x1d')]);}switch(_0x1e6e96[_0x2d62('0x30')]){case _0x2d62('0x34'):return db[_[_0x2d62('0xa1')](_0xe27ddb[_0x2d62('0x4a')]['channel'])+_0x2d62('0xd5')][_0x2d62('0x51')](_0xca8086);case _0x2d62('0x36'):case _0x2d62('0x73'):return _0x1e6e96[_0x2d62('0x33')+_['capitalize'](_0xe27ddb[_0x2d62('0x4a')]['channel'])+'Queues'](_0xca8086);}})[_0x2d62('0x24')](function(_0xb543d4){return{'count':_0xe413dc,'rows':_0xb543d4};})[_0x2d62('0x24')](respondWithResult(_0x3bd333,null))[_0x2d62('0x2e')](handleError(_0x3bd333,null));};exports[_0x2d62('0xd8')]=function(_0x1978cd,_0x283627){var _0x50fa3d={};var _0x3db85c={};var _0x146c13;var _0x20e5b6;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x1978cd[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x283627,null))['then'](function(_0x217b08){if(_0x217b08){_0x146c13=_0x217b08;_0x3db85c[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db[_0x2d62('0xab')][_0x2d62('0xd9')]);_0x3db85c[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x1978cd[_0x2d62('0x4a')]);_0x3db85c[_0x2d62('0xcf')]=_[_0x2d62('0xd0')](_0x3db85c[_0x2d62('0xcd')],_0x3db85c[_0x2d62('0x4a')]);_0x50fa3d[_0x2d62('0x4f')]=_[_0x2d62('0xd0')](_0x3db85c[_0x2d62('0xcd')],qs[_0x2d62('0xd1')](_0x1978cd[_0x2d62('0x4a')]['fields']));_0x50fa3d[_0x2d62('0x4f')]=_0x50fa3d['attributes']['length']?_0x50fa3d[_0x2d62('0x4f')]:_0x3db85c[_0x2d62('0xcd')];_0x50fa3d[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x1978cd[_0x2d62('0x4a')][_0x2d62('0xd3')]);_0x50fa3d[_0x2d62('0x48')]=qs[_0x2d62('0xcf')](_['pick'](_0x1978cd['query'],_0x3db85c[_0x2d62('0xcf')]));if(_0x1978cd[_0x2d62('0x4a')]['filter']){_0x50fa3d['where']=_[_0x2d62('0xd4')](_0x50fa3d['where'],{'$or':_[_0x2d62('0x39')](_0x50fa3d[_0x2d62('0x4f')],function(_0x54fa43){var _0x1230ac={};_0x1230ac[_0x54fa43]={'$like':'%'+_0x1978cd[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x1230ac;})});}_0x50fa3d=_[_0x2d62('0xd4')]({},_0x50fa3d,_0x1978cd[_0x2d62('0xda')]);return _0x146c13[_0x2d62('0xd8')](_0x50fa3d);}})[_0x2d62('0x24')](function(_0x2d8d40){if(_0x2d8d40){_0x20e5b6=_0x2d8d40[_0x2d62('0x6d')];if(!_0x1978cd[_0x2d62('0x4a')][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0x50fa3d[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x1978cd[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0x50fa3d['offset']=qs[_0x2d62('0x1d')](_0x1978cd[_0x2d62('0x4a')][_0x2d62('0x1d')]);}return _0x146c13[_0x2d62('0xd8')](_0x50fa3d);}})[_0x2d62('0x24')](function(_0x76bd79){if(_0x76bd79){return _0x76bd79?{'count':_0x20e5b6,'rows':_0x76bd79}:null;}})['then'](respondWithResult(_0x283627,null))[_0x2d62('0x2e')](handleError(_0x283627,null));};exports['getGroups']=function(_0xb91fa8,_0x3ea35d){var _0x173228={};var _0x5e7599={};var _0x44a60f;var _0x31c86e;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0xb91fa8[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x3ea35d,null))[_0x2d62('0x24')](function(_0x511b18){if(_0x511b18){_0x44a60f=_0x511b18;_0x5e7599[_0x2d62('0xcd')]=_['keys'](db[_0x2d62('0xdb')][_0x2d62('0xd9')]);_0x5e7599[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0xb91fa8[_0x2d62('0x4a')]);_0x5e7599[_0x2d62('0xcf')]=_[_0x2d62('0xd0')](_0x5e7599['model'],_0x5e7599[_0x2d62('0x4a')]);_0x173228[_0x2d62('0x4f')]=_[_0x2d62('0xd0')](_0x5e7599[_0x2d62('0xcd')],qs['fields'](_0xb91fa8['query']['fields']));_0x173228['attributes']=_0x173228[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0x173228[_0x2d62('0x4f')]:_0x5e7599[_0x2d62('0xcd')];_0x173228[_0x2d62('0xd2')]=qs['sort'](_0xb91fa8[_0x2d62('0x4a')]['sort']);_0x173228[_0x2d62('0x48')]=qs[_0x2d62('0xcf')](_[_0x2d62('0xdc')](_0xb91fa8[_0x2d62('0x4a')],_0x5e7599['filters']));if(_0xb91fa8[_0x2d62('0x4a')][_0x2d62('0x45')]){_0x173228[_0x2d62('0x48')]=_['merge'](_0x173228['where'],{'$or':_['map'](_0x173228[_0x2d62('0x4f')],function(_0xfe70c1){var _0x2e7e86={};_0x2e7e86[_0xfe70c1]={'$like':'%'+_0xb91fa8[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x2e7e86;})});}_0x173228=_[_0x2d62('0xd4')]({},_0x173228,_0xb91fa8['options']);return _0x44a60f[_0x2d62('0xdd')](_0x173228);}})[_0x2d62('0x24')](function(_0x32c58b){if(_0x32c58b){_0x31c86e=_0x32c58b[_0x2d62('0x6d')];if(!_0xb91fa8['query'][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0x173228['limit']=qs[_0x2d62('0x1f')](_0xb91fa8[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0x173228[_0x2d62('0x1d')]=qs['offset'](_0xb91fa8[_0x2d62('0x4a')][_0x2d62('0x1d')]);}return _0x44a60f[_0x2d62('0xdd')](_0x173228);}})[_0x2d62('0x24')](function(_0x53c72d){if(_0x53c72d){return _0x53c72d?{'count':_0x31c86e,'rows':_0x53c72d}:null;}})['then'](respondWithResult(_0x3ea35d,null))[_0x2d62('0x2e')](handleError(_0x3ea35d,null));};exports[_0x2d62('0xde')]=function(_0x58b51e,_0x1eae34){var _0xdc10ba={'raw':!![],'where':{}};var _0x4a0a1d={};var _0x2eeaa0={'count':0x0,'rows':[]};return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x58b51e[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x1eae34,null))[_0x2d62('0x24')](function(_0x1eebef){if(_0x1eebef){_0x4a0a1d[_0x2d62('0xcd')]=_['keys'](db[_0x2d62('0xdf')][_0x2d62('0xd9')]);_0x4a0a1d[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x58b51e[_0x2d62('0x4a')]);_0x4a0a1d['filters']=_[_0x2d62('0xd0')](_0x4a0a1d[_0x2d62('0xcd')],_0x4a0a1d[_0x2d62('0x4a')]);_0xdc10ba['attributes']=_[_0x2d62('0xd0')](_0x4a0a1d['model'],qs[_0x2d62('0xd1')](_0x58b51e[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0xdc10ba['attributes']=_0xdc10ba[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0xdc10ba['attributes']:_0x4a0a1d[_0x2d62('0xcd')];if(!_0x58b51e[_0x2d62('0x4a')][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0xdc10ba[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x58b51e[_0x2d62('0x4a')]['limit']);_0xdc10ba['offset']=qs[_0x2d62('0x1d')](_0x58b51e[_0x2d62('0x4a')][_0x2d62('0x1d')]);}_0xdc10ba[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x58b51e[_0x2d62('0x4a')][_0x2d62('0xd3')]);_0xdc10ba[_0x2d62('0x48')]=qs[_0x2d62('0xcf')](_[_0x2d62('0xdc')](_0x58b51e[_0x2d62('0x4a')],_0x4a0a1d[_0x2d62('0xcf')]));_0xdc10ba['where'][_0x2d62('0xe0')]=_0x1eebef['id'];if(_0x58b51e[_0x2d62('0x4a')][_0x2d62('0x45')]){_0xdc10ba['where']=_[_0x2d62('0xd4')](_0xdc10ba[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0xdc10ba[_0x2d62('0x4f')],function(_0x30bee6){var _0x370144={};_0x370144[_0x30bee6]={'$like':'%'+_0x58b51e[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x370144;})});}_0xdc10ba=_['merge']({},_0xdc10ba,_0x58b51e[_0x2d62('0xda')]);return db[_0x2d62('0xdf')][_0x2d62('0x20')]({'where':_0xdc10ba[_0x2d62('0x48')]})['then'](function(_0x3e6e6c){_0x2eeaa0[_0x2d62('0x20')]=_0x3e6e6c;if(_0x58b51e[_0x2d62('0x4a')]['includeAll']){_0xdc10ba[_0x2d62('0x4b')]=[{'all':!![]}];}return db[_0x2d62('0xdf')][_0x2d62('0x51')](_0xdc10ba);})[_0x2d62('0x24')](function(_0x111c0a){_0x2eeaa0[_0x2d62('0x52')]=_0x111c0a;return _0x2eeaa0;});}})['then'](respondWithFilteredResult(_0x1eae34,_0xdc10ba))[_0x2d62('0x2e')](handleError(_0x1eae34,null));};exports[_0x2d62('0xe1')]=function(_0x5bb8a6,_0x5a4496){var _0xa329de={'raw':!![],'where':{}};var _0x47ef7d={};var _0x427ee0={'count':0x0,'rows':[]};return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x5bb8a6[_0x2d62('0x61')]['id']}})['then'](handleEntityNotFound(_0x5a4496,null))['then'](function(_0x3d2dba){if(_0x3d2dba){_0x47ef7d[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db['ScreenRecording']['rawAttributes']);_0x47ef7d[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x5bb8a6['query']);_0x47ef7d[_0x2d62('0xcf')]=_[_0x2d62('0xd0')](_0x47ef7d[_0x2d62('0xcd')],_0x47ef7d['query']);_0xa329de[_0x2d62('0x4f')]=_[_0x2d62('0xd0')](_0x47ef7d[_0x2d62('0xcd')],qs[_0x2d62('0xd1')](_0x5bb8a6[_0x2d62('0x4a')]['fields']));_0xa329de['attributes']=_0xa329de['attributes'][_0x2d62('0x6d')]?_0xa329de[_0x2d62('0x4f')]:_0x47ef7d['model'];if(!_0x5bb8a6[_0x2d62('0x4a')]['hasOwnProperty'](_0x2d62('0xd7'))){_0xa329de[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x5bb8a6[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0xa329de[_0x2d62('0x1d')]=qs[_0x2d62('0x1d')](_0x5bb8a6[_0x2d62('0x4a')][_0x2d62('0x1d')]);}_0xa329de[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x5bb8a6['query'][_0x2d62('0xd3')]);_0xa329de[_0x2d62('0x48')]=qs['filters'](_[_0x2d62('0xdc')](_0x5bb8a6[_0x2d62('0x4a')],_0x47ef7d['filters']));_0xa329de[_0x2d62('0x48')][_0x2d62('0xe0')]=_0x3d2dba['id'];if(_0x5bb8a6[_0x2d62('0x4a')][_0x2d62('0x45')]){_0xa329de[_0x2d62('0x48')]=_['merge'](_0xa329de[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0xa329de['attributes'],function(_0x342a70){var _0x5188ad={};_0x5188ad[_0x342a70]={'$like':'%'+_0x5bb8a6[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x5188ad;})});}_0xa329de=_[_0x2d62('0xd4')]({},_0xa329de,_0x5bb8a6[_0x2d62('0xda')]);return db[_0x2d62('0xe2')][_0x2d62('0x20')]({'where':_0xa329de[_0x2d62('0x48')]})['then'](function(_0x34b469){_0x427ee0[_0x2d62('0x20')]=_0x34b469;if(_0x5bb8a6['query'][_0x2d62('0x5b')]){_0xa329de[_0x2d62('0x4b')]=[{'all':!![]}];}return db[_0x2d62('0xe2')][_0x2d62('0x51')](_0xa329de);})['then'](function(_0x1e0f59){_0x427ee0[_0x2d62('0x52')]=_0x1e0f59;return _0x427ee0;});}})['then'](respondWithFilteredResult(_0x5a4496,_0xa329de))['catch'](handleError(_0x5a4496,null));};exports[_0x2d62('0xe3')]=function(_0xad006e,_0x5c47e4){var _0x4d3492={};var _0x52be2d={};var _0x5a1723;var _0x5779fe;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0xad006e['params']['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x5c47e4,null))[_0x2d62('0x24')](function(_0x55d12f){if(_0x55d12f){_0x5a1723=_0x55d12f;_0x52be2d[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db['ChatInteraction'][_0x2d62('0xd9')]);_0x52be2d[_0x2d62('0x4a')]=_['keys'](_0xad006e[_0x2d62('0x4a')]);_0x52be2d['filters']=_[_0x2d62('0xd0')](_0x52be2d[_0x2d62('0xcd')],_0x52be2d[_0x2d62('0x4a')]);_0x4d3492['attributes']=_[_0x2d62('0xd0')](_0x52be2d[_0x2d62('0xcd')],qs['fields'](_0xad006e[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0x4d3492[_0x2d62('0x4f')]=_0x4d3492[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0x4d3492[_0x2d62('0x4f')]:_0x52be2d['model'];_0x4d3492[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0xad006e[_0x2d62('0x4a')][_0x2d62('0xd3')]);_0x4d3492['where']=qs[_0x2d62('0xcf')](_[_0x2d62('0xdc')](_0xad006e[_0x2d62('0x4a')],_0x52be2d[_0x2d62('0xcf')]));if(_0xad006e['query'][_0x2d62('0x45')]){_0x4d3492[_0x2d62('0x48')]=_['merge'](_0x4d3492[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0x4d3492[_0x2d62('0x4f')],function(_0x25a458){var _0x1073a9={};_0x1073a9[_0x25a458]={'$like':'%'+_0xad006e[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x1073a9;})});}_0x4d3492=_[_0x2d62('0xd4')]({},_0x4d3492,_0xad006e[_0x2d62('0xda')]);return _0x5a1723[_0x2d62('0xe3')](_0x4d3492);}})['then'](function(_0xf45a6c){if(_0xf45a6c){_0x5779fe=_0xf45a6c[_0x2d62('0x6d')];if(!_0xad006e[_0x2d62('0x4a')][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0x4d3492['limit']=qs['limit'](_0xad006e['query'][_0x2d62('0x1f')]);_0x4d3492[_0x2d62('0x1d')]=qs[_0x2d62('0x1d')](_0xad006e[_0x2d62('0x4a')]['offset']);}return _0x5a1723[_0x2d62('0xe3')](_0x4d3492);}})[_0x2d62('0x24')](function(_0x3ee894){if(_0x3ee894){return _0x3ee894?{'count':_0x5779fe,'rows':_0x3ee894}:null;}})['then'](respondWithResult(_0x5c47e4,null))['catch'](handleError(_0x5c47e4,null));};exports[_0x2d62('0xe4')]=function(_0x28e045,_0xba15ab){var _0xa553ed={};var _0x44c64e={};var _0x8327b;var _0x3a2a59;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x28e045['params']['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0xba15ab,null))['then'](function(_0x55610a){if(_0x55610a){_0x8327b=_0x55610a;_0x44c64e[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db[_0x2d62('0xe5')][_0x2d62('0xd9')]);_0x44c64e[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x28e045[_0x2d62('0x4a')]);_0x44c64e['filters']=_[_0x2d62('0xd0')](_0x44c64e['model'],_0x44c64e[_0x2d62('0x4a')]);_0xa553ed['attributes']=_[_0x2d62('0xd0')](_0x44c64e[_0x2d62('0xcd')],qs[_0x2d62('0xd1')](_0x28e045[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0xa553ed[_0x2d62('0x4f')]=_0xa553ed[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0xa553ed['attributes']:_0x44c64e[_0x2d62('0xcd')];_0xa553ed[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x28e045['query'][_0x2d62('0xd3')]);_0xa553ed[_0x2d62('0x48')]=qs[_0x2d62('0xcf')](_['pick'](_0x28e045['query'],_0x44c64e[_0x2d62('0xcf')]));if(_0x28e045['query'][_0x2d62('0x45')]){_0xa553ed['where']=_['merge'](_0xa553ed[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0xa553ed[_0x2d62('0x4f')],function(_0x2ba612){var _0x21c9f1={};_0x21c9f1[_0x2ba612]={'$like':'%'+_0x28e045[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x21c9f1;})});}_0xa553ed=_['merge']({},_0xa553ed,_0x28e045[_0x2d62('0xda')]);return _0x8327b[_0x2d62('0xe4')](_0xa553ed);}})['then'](function(_0x41b450){if(_0x41b450){_0x3a2a59=_0x41b450[_0x2d62('0x6d')];if(!_0x28e045[_0x2d62('0x4a')][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0xa553ed[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x28e045[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0xa553ed[_0x2d62('0x1d')]=qs[_0x2d62('0x1d')](_0x28e045[_0x2d62('0x4a')][_0x2d62('0x1d')]);}return _0x8327b['getOpenchannelInteractions'](_0xa553ed);}})['then'](function(_0x374727){if(_0x374727){return _0x374727?{'count':_0x3a2a59,'rows':_0x374727}:null;}})['then'](respondWithResult(_0xba15ab,null))[_0x2d62('0x2e')](handleError(_0xba15ab,null));};exports[_0x2d62('0xe6')]=function(_0x161f72,_0x4eb4e4){var _0x161c9f={'raw':!![],'where':{}};var _0x1a7ac2={};var _0x809e6={'count':0x0,'rows':[]};return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x161f72[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x4eb4e4,null))[_0x2d62('0x24')](function(_0x2473f7){if(_0x2473f7){_0x1a7ac2[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db['MailInteraction'][_0x2d62('0xd9')]);_0x1a7ac2[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x161f72[_0x2d62('0x4a')]);_0x1a7ac2['filters']=_['intersection'](_0x1a7ac2[_0x2d62('0xcd')],_0x1a7ac2[_0x2d62('0x4a')]);_0x161c9f[_0x2d62('0x4f')]=_[_0x2d62('0xd0')](_0x1a7ac2[_0x2d62('0xcd')],qs[_0x2d62('0xd1')](_0x161f72[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0x161c9f[_0x2d62('0x4f')]=_0x161c9f[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0x161c9f[_0x2d62('0x4f')]:_0x1a7ac2['model'];if(!_0x161f72['query'][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0x161c9f['limit']=qs[_0x2d62('0x1f')](_0x161f72['query']['limit']);_0x161c9f[_0x2d62('0x1d')]=qs[_0x2d62('0x1d')](_0x161f72[_0x2d62('0x4a')][_0x2d62('0x1d')]);}_0x161c9f[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x161f72['query'][_0x2d62('0xd3')]);_0x161c9f[_0x2d62('0x48')]=qs['filters'](_[_0x2d62('0xdc')](_0x161f72[_0x2d62('0x4a')],_0x1a7ac2[_0x2d62('0xcf')]));_0x161c9f['where'][_0x2d62('0xe0')]=_0x2473f7['id'];if(_0x161f72[_0x2d62('0x4a')]['filter']){_0x161c9f[_0x2d62('0x48')]=_[_0x2d62('0xd4')](_0x161c9f[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0x161c9f['attributes'],function(_0x4b4c8a){var _0xe68442={};_0xe68442[_0x4b4c8a]={'$like':'%'+_0x161f72[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0xe68442;})});}_0x161c9f=_['merge']({},_0x161c9f,_0x161f72[_0x2d62('0xda')]);return db[_0x2d62('0xe7')][_0x2d62('0x20')]({'where':_0x161c9f['where']})[_0x2d62('0x24')](function(_0x33f7e4){_0x809e6[_0x2d62('0x20')]=_0x33f7e4;if(_0x161f72['query'][_0x2d62('0x5b')]){_0x161c9f['include']=[{'all':!![]}];}return db[_0x2d62('0xe7')]['findAll'](_0x161c9f);})[_0x2d62('0x24')](function(_0x53c490){_0x809e6[_0x2d62('0x52')]=_0x53c490;return _0x809e6;});}})[_0x2d62('0x24')](respondWithFilteredResult(_0x4eb4e4,_0x161c9f))[_0x2d62('0x2e')](handleError(_0x4eb4e4,null));};exports[_0x2d62('0xe8')]=function(_0x5b8688,_0x3a381e){var _0x4fb2b8={};var _0x2ba155={};var _0x4093b4;var _0x348beb;return db[_0x2d62('0x49')]['findOne']({'where':{'id':_0x5b8688[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x3a381e,null))['then'](function(_0x7bcead){if(_0x7bcead){_0x4093b4=_0x7bcead;_0x2ba155[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db[_0x2d62('0xe9')][_0x2d62('0xd9')]);_0x2ba155[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x5b8688[_0x2d62('0x4a')]);_0x2ba155[_0x2d62('0xcf')]=_['intersection'](_0x2ba155[_0x2d62('0xcd')],_0x2ba155[_0x2d62('0x4a')]);_0x4fb2b8['attributes']=_[_0x2d62('0xd0')](_0x2ba155[_0x2d62('0xcd')],qs['fields'](_0x5b8688[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0x4fb2b8[_0x2d62('0x4f')]=_0x4fb2b8[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0x4fb2b8[_0x2d62('0x4f')]:_0x2ba155[_0x2d62('0xcd')];_0x4fb2b8[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x5b8688['query'][_0x2d62('0xd3')]);_0x4fb2b8[_0x2d62('0x48')]=qs[_0x2d62('0xcf')](_['pick'](_0x5b8688['query'],_0x2ba155['filters']));if(_0x5b8688[_0x2d62('0x4a')]['filter']){_0x4fb2b8[_0x2d62('0x48')]=_[_0x2d62('0xd4')](_0x4fb2b8[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0x4fb2b8[_0x2d62('0x4f')],function(_0x145936){var _0x14da69={};_0x14da69[_0x145936]={'$like':'%'+_0x5b8688[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x14da69;})});}_0x4fb2b8=_[_0x2d62('0xd4')]({},_0x4fb2b8,_0x5b8688[_0x2d62('0xda')]);return _0x4093b4[_0x2d62('0xe8')](_0x4fb2b8);}})[_0x2d62('0x24')](function(_0x14a6f2){if(_0x14a6f2){_0x348beb=_0x14a6f2['length'];if(!_0x5b8688[_0x2d62('0x4a')][_0x2d62('0xc6')]('nolimit')){_0x4fb2b8[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x5b8688[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0x4fb2b8[_0x2d62('0x1d')]=qs[_0x2d62('0x1d')](_0x5b8688['query'][_0x2d62('0x1d')]);}return _0x4093b4[_0x2d62('0xe8')](_0x4fb2b8);}})[_0x2d62('0x24')](function(_0x1e4830){if(_0x1e4830){return _0x1e4830?{'count':_0x348beb,'rows':_0x1e4830}:null;}})[_0x2d62('0x24')](respondWithResult(_0x3a381e,null))['catch'](handleError(_0x3a381e,null));};exports[_0x2d62('0xea')]=function(_0x57d26f,_0x10732c){var _0x32d839={};var _0x5a90dd={};var _0x213963;var _0xad75ea;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x57d26f[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x10732c,null))['then'](function(_0x5235d3){if(_0x5235d3){_0x213963=_0x5235d3;_0x5a90dd[_0x2d62('0xcd')]=_['keys'](db[_0x2d62('0xeb')][_0x2d62('0xd9')]);_0x5a90dd[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x57d26f['query']);_0x5a90dd[_0x2d62('0xcf')]=_[_0x2d62('0xd0')](_0x5a90dd[_0x2d62('0xcd')],_0x5a90dd[_0x2d62('0x4a')]);_0x32d839[_0x2d62('0x4f')]=_[_0x2d62('0xd0')](_0x5a90dd[_0x2d62('0xcd')],qs[_0x2d62('0xd1')](_0x57d26f[_0x2d62('0x4a')]['fields']));_0x32d839[_0x2d62('0x4f')]=_0x32d839[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0x32d839[_0x2d62('0x4f')]:_0x5a90dd[_0x2d62('0xcd')];_0x32d839['order']=qs[_0x2d62('0xd3')](_0x57d26f[_0x2d62('0x4a')][_0x2d62('0xd3')]);_0x32d839[_0x2d62('0x48')]=qs[_0x2d62('0xcf')](_[_0x2d62('0xdc')](_0x57d26f[_0x2d62('0x4a')],_0x5a90dd[_0x2d62('0xcf')]));if(_0x57d26f[_0x2d62('0x4a')]['filter']){_0x32d839['where']=_[_0x2d62('0xd4')](_0x32d839['where'],{'$or':_[_0x2d62('0x39')](_0x32d839['attributes'],function(_0x261d07){var _0x1a412f={};_0x1a412f[_0x261d07]={'$like':'%'+_0x57d26f['query']['filter']+'%'};return _0x1a412f;})});}_0x32d839=_[_0x2d62('0xd4')]({},_0x32d839,_0x57d26f[_0x2d62('0xda')]);return _0x213963[_0x2d62('0xea')](_0x32d839);}})['then'](function(_0x3fd23b){if(_0x3fd23b){_0xad75ea=_0x3fd23b['length'];if(!_0x57d26f['query'][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0x32d839[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x57d26f[_0x2d62('0x4a')]['limit']);_0x32d839['offset']=qs[_0x2d62('0x1d')](_0x57d26f[_0x2d62('0x4a')][_0x2d62('0x1d')]);}return _0x213963[_0x2d62('0xea')](_0x32d839);}})[_0x2d62('0x24')](function(_0x36acf0){if(_0x36acf0){return _0x36acf0?{'count':_0xad75ea,'rows':_0x36acf0}:null;}})['then'](respondWithResult(_0x10732c,null))[_0x2d62('0x2e')](handleError(_0x10732c,null));};exports[_0x2d62('0xec')]=function(_0x3f3718,_0x209f5d){var _0x5f35ac={};var _0x3bd2a8={};var _0x5347c5;var _0x1d8a7;return db['User'][_0x2d62('0x96')]({'where':{'id':_0x3f3718[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x209f5d,null))[_0x2d62('0x24')](function(_0x4547dd){if(_0x4547dd){_0x5347c5=_0x4547dd;_0x3bd2a8[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db[_0x2d62('0xed')][_0x2d62('0xd9')]);_0x3bd2a8[_0x2d62('0x4a')]=_['keys'](_0x3f3718[_0x2d62('0x4a')]);_0x3bd2a8[_0x2d62('0xcf')]=_[_0x2d62('0xd0')](_0x3bd2a8[_0x2d62('0xcd')],_0x3bd2a8[_0x2d62('0x4a')]);_0x5f35ac[_0x2d62('0x4f')]=_['intersection'](_0x3bd2a8['model'],qs[_0x2d62('0xd1')](_0x3f3718[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0x5f35ac['attributes']=_0x5f35ac['attributes'][_0x2d62('0x6d')]?_0x5f35ac[_0x2d62('0x4f')]:_0x3bd2a8[_0x2d62('0xcd')];_0x5f35ac[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x3f3718[_0x2d62('0x4a')][_0x2d62('0xd3')]);_0x5f35ac[_0x2d62('0x48')]=qs['filters'](_[_0x2d62('0xdc')](_0x3f3718[_0x2d62('0x4a')],_0x3bd2a8[_0x2d62('0xcf')]));if(_0x3f3718['query'][_0x2d62('0x45')]){_0x5f35ac['where']=_[_0x2d62('0xd4')](_0x5f35ac[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0x5f35ac[_0x2d62('0x4f')],function(_0x1a2f30){var _0x5e03fe={};_0x5e03fe[_0x1a2f30]={'$like':'%'+_0x3f3718[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x5e03fe;})});}_0x5f35ac=_[_0x2d62('0xd4')]({},_0x5f35ac,_0x3f3718['options']);return _0x5347c5['getWhatsappInteractions'](_0x5f35ac);}})[_0x2d62('0x24')](function(_0x247a4d){if(_0x247a4d){_0x1d8a7=_0x247a4d['length'];if(!_0x3f3718[_0x2d62('0x4a')][_0x2d62('0xc6')]('nolimit')){_0x5f35ac[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x3f3718[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0x5f35ac['offset']=qs[_0x2d62('0x1d')](_0x3f3718['query']['offset']);}return _0x5347c5[_0x2d62('0xec')](_0x5f35ac);}})[_0x2d62('0x24')](function(_0x38fbf9){if(_0x38fbf9){return _0x38fbf9?{'count':_0x1d8a7,'rows':_0x38fbf9}:null;}})['then'](respondWithResult(_0x209f5d,null))[_0x2d62('0x2e')](handleError(_0x209f5d,null));};exports['login']=function(_0x1890d4,_0x47c775,_0x3b10f7){var _0x40f99f;var _0x2f95c7;var _0x10116d;var _0x3686e4=!_['isNil'](_0x1890d4['params']['id'])?_0x1890d4['params']['id']:!_[_0x2d62('0x67')](_0x1890d4[_0x2d62('0x36')]['id'])?_0x1890d4[_0x2d62('0x36')]['id']:null;return db[_0x2d62('0x49')][_0x2d62('0x3c')]({'where':{'id':_0x3686e4,'role':{'$or':['admin','user',_0x2d62('0x73')]}},'attributes':['id',_0x2d62('0x3d'),'phone',_0x2d62('0xee'),_0x2d62('0x30'),_0x2d62('0x63'),_0x2d62('0x9c')]})[_0x2d62('0x24')](function(_0x3d6273){if(_0x3d6273){if(_0x3d6273[_0x2d62('0x30')]===_0x2d62('0x73')){_0x40f99f=_0x3d6273;if(_0x1890d4['body'][_0x2d62('0x9d')]){_0x10116d=util[_0x2d62('0xa9')](_0x2d62('0xef'),_0x40f99f[_0x1890d4[_0x2d62('0x5e')][_0x2d62('0x9d')]]);}else if(_0x1890d4[_0x2d62('0x5e')]['intrf']){_0x10116d=util[_0x2d62('0xa9')](_0x2d62('0xf0'),_0x1890d4[_0x2d62('0x5e')]['intrf']);}else{_0x10116d=util[_0x2d62('0xa9')](_0x2d62('0xf0'),_0x40f99f['name']);}socket['to'](util[_0x2d62('0xa9')](_0x2d62('0xf1'),_0x40f99f[_0x2d62('0x3d')]))[_0x2d62('0x31')](_0x2d62('0xf2'),{'user':{'id':_0x40f99f['id'],'name':_0x40f99f[_0x2d62('0x3d')]},'ip':_0x1890d4[_0x2d62('0xf3')][_0x2d62('0xf4')]||_0x1890d4[_0x2d62('0xf5')][_0x2d62('0xf6')]||_0x1890d4[_0x2d62('0xf7')]['remoteAddress']||_0x1890d4[_0x2d62('0xf5')]['socket'][_0x2d62('0xf6')]});return new Promise(function(_0x51d44d,_0x344f1c){db[_0x2d62('0x6a')][_0x2d62('0xf8')]()[_0x2d62('0x24')](_0x309db0=>{db['UserVoiceQueueRt'][_0x2d62('0x3f')]({'where':{'membername':_0x40f99f['name']},'individualHooks':!![]},{'transaction':_0x309db0})[_0x2d62('0x24')](function(){return _0x309db0[_0x2d62('0xf9')]();})[_0x2d62('0x24')](_0x51d44d)['catch'](_0x344f1c);});});}}else{throw new db[(_0x2d62('0x8f'))][(_0x2d62('0x90'))](_0x2d62('0xfa'));}})['then'](function(){if(_0x40f99f){return _0x40f99f[_0x2d62('0xfb')]({'raw':!![]});}})[_0x2d62('0x24')](function(_0x12729d){if(_0x40f99f){if(_0x12729d){_0x2f95c7=_0x12729d;if(_0x2f95c7[_0x2d62('0x6d')]){var _0x4a1a49=_0x2f95c7[_0x2d62('0x39')](function(_0x52608a){return{'membername':_0x40f99f[_0x2d62('0x3d')],'UserId':_0x40f99f['id'],'queue_name':_0x52608a[_0x2d62('0x3d')],'VoiceQueueId':_0x52608a['id'],'interface':_0x10116d,'paused':_0x40f99f[_0x2d62('0x9c')]||![],'penalty':_0x52608a[_0x2d62('0xfc')]||0x0};});return db[_0x2d62('0xab')][_0x2d62('0x89')](_0x4a1a49);}}}})['then'](function(){if(_0x40f99f){return db[_0x2d62('0xfd')][_0x2d62('0x51')]({'where':{'membername':_0x40f99f[_0x2d62('0x3d')],'exitAt':null}});}})[_0x2d62('0x24')](function(_0x14e0e0){if(_0x40f99f){var _0x159031=[];_0x14e0e0[_0x2d62('0xfe')](function(_0x4e1e8a){_0x159031[_0x2d62('0x50')](_0x4e1e8a[_0x2d62('0x2f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x159031);}})[_0x2d62('0x24')](function(){if(_0x40f99f){var _0xc22e00=[];var _0x2b6d17=[];var _0x471846=utils[_0x2d62('0xff')]();var _0x59816a={'membername':_0x40f99f[_0x2d62('0x3d')],'interface':_0x10116d,'enterAt':moment()['format'](_0x2d62('0x100')),'role':_0x40f99f[_0x2d62('0x30')],'internal':_0x40f99f[_0x2d62('0x63')]};_0x471846['forEach'](function(_0xeace3b){_0xc22e00[_0x2d62('0x50')](_['merge']({'channel':_0xeace3b,'type':_0x2d62('0x101'),'data1':_0x1890d4[_0x2d62('0x5e')][_0x2d62('0x102')],'data2':_0x10116d},_0x59816a));if(_0x40f99f['loginInPause']){_0x2b6d17[_0x2d62('0x50')](_[_0x2d62('0xd4')]({'channel':_0xeace3b,'type':_0x2d62('0x103'),'data1':_0x2d62('0x104')},_0x59816a));}});return db['MemberReport'][_0x2d62('0x89')](_0xc22e00['concat'](_0x2b6d17),{'individualHooks':!![]});}})['then'](function(){if(_0x40f99f){return _0x40f99f[_0x2d62('0x2f')]({'online':!![],'lastLoginAt':moment()['format'](_0x2d62('0x100')),'voicePause':_0x40f99f[_0x2d62('0x9c')]||![],'mailPause':_0x40f99f[_0x2d62('0x9c')]||![],'chatPause':_0x40f99f['loginInPause']||![],'faxPause':_0x40f99f[_0x2d62('0x9c')]||![],'smsPause':_0x40f99f[_0x2d62('0x9c')]||![],'openchannelPause':_0x40f99f['loginInPause']||![],'whatsappPause':_0x40f99f[_0x2d62('0x9c')]||![],'pauseType':_0x40f99f['loginInPause']?_0x2d62('0x104'):null,'interface':_0x10116d,'lastPauseAt':moment()[_0x2d62('0xa9')](_0x2d62('0x100'))});}})[_0x2d62('0x24')](function(_0x26d590){if(_0x1890d4['isMiddleware']){return _0x3b10f7();}else{return Promise['resolve'](_0x26d590)[_0x2d62('0x24')](respondWithResult(_0x47c775,null));}})[_0x2d62('0x2e')](handleError(_0x47c775,null));};exports[_0x2d62('0x105')]=function(_0x47ce44,_0x459190){var _0x3dc47f;return db['User'][_0x2d62('0x3c')]({'where':{'id':_0x47ce44[_0x2d62('0x61')]['id'],'role':_0x2d62('0x73')},'attributes':['id',_0x2d62('0x3d'),_0x2d62('0x30')]})[_0x2d62('0x24')](handleEntityNotFound(_0x459190,null))[_0x2d62('0x24')](function(_0x1442c0){if(_0x1442c0){_0x3dc47f=_0x1442c0;return db[_0x2d62('0xab')]['destroy']({'where':{'membername':_0x3dc47f[_0x2d62('0x3d')]},'individualHooks':!![]});}})[_0x2d62('0x24')](function(){return db['MemberReport'][_0x2d62('0x51')]({'where':{'membername':_0x3dc47f[_0x2d62('0x3d')],'exitAt':null}});})['then'](function(_0x301340){var _0x98a91f=[];_0x301340[_0x2d62('0xfe')](function(_0x11d847){_0x98a91f[_0x2d62('0x50')](_0x11d847['update']({'exitAt':moment()[_0x2d62('0xa9')](_0x2d62('0x100'))}));});return Promise[_0x2d62('0x59')](_0x98a91f);})[_0x2d62('0x24')](function(){return _0x3dc47f['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x459190,null))['catch'](handleError(_0x459190,null));};exports[_0x2d62('0x106')]=function(_0x343ff0,_0x280d5f){var _0x3e9e78;return db[_0x2d62('0xab')][_0x2d62('0x2f')]({'paused':0x1},{'where':{'UserId':_0x343ff0[_0x2d62('0x61')]['id']},'individualHooks':!![]})[_0x2d62('0x24')](function(){return db['User']['find']({'where':{'id':_0x343ff0['params']['id'],'role':_0x2d62('0x73')},'attributes':['id',_0x2d62('0x3d'),_0x2d62('0x30'),_0x2d62('0x63'),'interface',_0x2d62('0x9b')]});})[_0x2d62('0x24')](handleEntityNotFound(_0x280d5f,null))[_0x2d62('0x24')](function(_0x52f29c){if(_0x52f29c){_0x3e9e78=_0x52f29c;return respondWithRpcPromise(_0x2d62('0x107'),_0x2d62('0x106'),{'id':_0x3e9e78['id'],'name':_0x3e9e78['name'],'pause':!![]});}})['then'](function(){if(_0x3e9e78){return db['MemberReport']['findAll']({'where':{'membername':_0x3e9e78[_0x2d62('0x3d')],'type':_0x2d62('0x103'),'exitAt':null}});}})[_0x2d62('0x24')](function(_0x3f2629){if(_0x3f2629['length']){var _0x3dadce=moment()[_0x2d62('0xa9')](_0x2d62('0x100'));for(var _0x5c42e5=0x0,_0x106320=_0x3f2629[_0x2d62('0x6d')];_0x5c42e5<_0x106320;_0x5c42e5++){_0x3f2629[_0x5c42e5][_0x2d62('0x108')]({'exitAt':_0x3dadce});}}})['then'](function(){var _0x39da97=[];var _0xc353d6=utils[_0x2d62('0xff')]();_0xc353d6[_0x2d62('0xfe')](function(_0x244071){_0x39da97[_0x2d62('0x50')]({'channel':_0x244071,'membername':_0x3e9e78['name'],'interface':_[_0x2d62('0x67')](_0x3e9e78[_0x2d62('0x9d')])?util[_0x2d62('0xa9')](_0x2d62('0xf0'),_0x3e9e78[_0x2d62('0x3d')]):_0x3e9e78[_0x2d62('0x9d')],'type':'PAUSE','enterAt':moment()['format'](_0x2d62('0x100')),'data1':_0x343ff0[_0x2d62('0x5e')][_0x2d62('0x43')]||'DEFAULT\x20PAUSE','role':_0x3e9e78[_0x2d62('0x30')],'internal':_0x3e9e78[_0x2d62('0x63')]});});return db[_0x2d62('0xfd')][_0x2d62('0x89')](_0x39da97,{'individualHooks':!![]});})[_0x2d62('0x24')](function(){return _0x3e9e78[_0x2d62('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x343ff0[_0x2d62('0x5e')]['type']||_0x2d62('0x109'),'lastPauseAt':moment()[_0x2d62('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2d62('0x24')](respondWithResult(_0x280d5f,null))[_0x2d62('0x2e')](handleError(_0x280d5f,null));};exports[_0x2d62('0x10a')]=function(_0x1a16ee,_0x3a124a){if(_0x1a16ee['body'][_0x2d62('0xad')]&&!utils[_0x2d62('0x9e')](_0x1a16ee['body'][_0x2d62('0xad')])){throw new APIBadRequestError(util['format'](_0x2d62('0x10b'),_0x1a16ee[_0x2d62('0x5e')][_0x2d62('0xad')]));}return db[_0x2d62('0x49')][_0x2d62('0x3c')]({'where':{'id':_0x1a16ee[_0x2d62('0x61')]['id']},'attributes':['id',_0x2d62('0x3d'),_0x2d62('0x30'),_0x2d62('0x63'),_0x2d62('0x9d'),'online',_0x2d62('0xaa'),'mailPause','chatPause',_0x2d62('0x10c'),_0x2d62('0x10d'),_0x2d62('0x10e'),_0x2d62('0x10f'),_0x2d62('0x110'),_0x2d62('0x111')]})[_0x2d62('0x24')](function(_0x183388){if(!_0x183388){throw new APINotFoundError(util[_0x2d62('0xa9')](_0x2d62('0x112'),_0x1a16ee['params']['id']));}return _0x183388['unpause'](_0x1a16ee[_0x2d62('0x5e')][_0x2d62('0xad')]);})['then'](respondWithResult(_0x3a124a,null))[_0x2d62('0x2e')](APIHandleError(_0x3a124a));};exports[_0x2d62('0x113')]=function(_0x11fb32,_0x1f374d){var _0x569aa8={};var _0x268618={};var _0x10f200;var _0x557db1;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x11fb32[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x1f374d,null))[_0x2d62('0x24')](function(_0x33d0f2){if(_0x33d0f2){_0x10f200=_0x33d0f2;_0x268618[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db[_0x2d62('0x114')][_0x2d62('0xd9')]);_0x268618[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x11fb32[_0x2d62('0x4a')]);_0x268618[_0x2d62('0xcf')]=_['intersection'](_0x268618[_0x2d62('0xcd')],_0x268618[_0x2d62('0x4a')]);_0x569aa8[_0x2d62('0x4f')]=_[_0x2d62('0xd0')](_0x268618[_0x2d62('0xcd')],qs[_0x2d62('0xd1')](_0x11fb32['query'][_0x2d62('0xd1')]));_0x569aa8[_0x2d62('0x4f')]=_0x569aa8[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0x569aa8['attributes']:_0x268618['model'];_0x569aa8[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x11fb32[_0x2d62('0x4a')][_0x2d62('0xd3')]);_0x569aa8[_0x2d62('0x48')]=qs[_0x2d62('0xcf')](_[_0x2d62('0xdc')](_0x11fb32[_0x2d62('0x4a')],_0x268618[_0x2d62('0xcf')]));if(_0x11fb32[_0x2d62('0x4a')][_0x2d62('0x45')]){_0x569aa8['where']=_[_0x2d62('0xd4')](_0x569aa8[_0x2d62('0x48')],{'$or':_['map'](_0x569aa8[_0x2d62('0x4f')],function(_0x5e4f48){var _0x3f4358={};_0x3f4358[_0x5e4f48]={'$like':'%'+_0x11fb32['query']['filter']+'%'};return _0x3f4358;})});}_0x569aa8=_[_0x2d62('0xd4')]({},_0x569aa8,_0x11fb32[_0x2d62('0xda')]);return _0x10f200[_0x2d62('0x113')](_0x569aa8);}})['then'](function(_0x290941){if(_0x290941){_0x557db1=_0x290941[_0x2d62('0x6d')];if(!_0x11fb32[_0x2d62('0x4a')][_0x2d62('0xc6')](_0x2d62('0xd7'))){_0x569aa8[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x11fb32[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0x569aa8['offset']=qs[_0x2d62('0x1d')](_0x11fb32[_0x2d62('0x4a')]['offset']);}return _0x10f200[_0x2d62('0x113')](_0x569aa8);}})[_0x2d62('0x24')](function(_0x68d132){if(_0x68d132){return _0x68d132?{'count':_0x557db1,'rows':_0x68d132}:null;}})[_0x2d62('0x24')](respondWithResult(_0x1f374d,null))[_0x2d62('0x2e')](handleError(_0x1f374d,null));};exports['addTeams']=function(_0x4e418a,_0x2a8bd2){var _0x2e0681=_0x4e418a[_0x2d62('0x61')]['id'];var _0x53dc4c=_0x4e418a[_0x2d62('0x5e')]?_0x4e418a[_0x2d62('0x5e')][_0x2d62('0x62')]:null;var _0x1e36fa=[];return Promise[_0x2d62('0x115')]()[_0x2d62('0x24')](function(){if(!_0x53dc4c)throw new APIBadRequestError(_0x2d62('0x116'));})[_0x2d62('0x24')](function(){return db['User'][_0x2d62('0x96')]({'where':{'id':_0x2e0681}});})['then'](function(_0x4922d8){if(!_0x4922d8)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4e418a[_0x2d62('0x61')]['id']));return db[_0x2d62('0x6a')]['transaction'](function(_0x3ad763){return _0x4922d8[_0x2d62('0x117')](_0x53dc4c,{'transaction':_0x3ad763})[_0x2d62('0x24')](function(){return db[_0x2d62('0x114')][_0x2d62('0x51')]({'where':{'id':{'$in':_0x53dc4c}}});})[_0x2d62('0x24')](function(_0x47d785){var _0x4050b6=_[_0x2d62('0x39')](_0x47d785,function(_0x34acd5){return _0x34acd5[_0x2d62('0x118')]();});return Promise['all'](_0x4050b6);})[_0x2d62('0x24')](function(_0x394bc9){_0x1e36fa=_[_0x2d62('0x119')](_0x394bc9);var _0x514c88=_['map'](_0x1e36fa,function(_0x3264e7){return _0x3264e7['addAgent'](_0x4922d8['id'],{'transaction':_0x3ad763});});return Promise[_0x2d62('0x59')](_0x514c88);})[_0x2d62('0x24')](function(){if(!_0x4922d8[_0x2d62('0x9b')])return;var _0x5e5480=_[_0x2d62('0x45')](_0x1e36fa,function(_0x4f54ec){return _0x4f54ec['getDataValue']('channel')==='Voice';});var _0x4e917d=_[_0x2d62('0x39')](_0x5e5480,function(_0x2dde1e){return db[_0x2d62('0xab')][_0x2d62('0xac')]({'membername':_0x4922d8['name'],'UserId':_0x4922d8['id'],'queue_name':_0x2dde1e[_0x2d62('0x3d')],'VoiceQueueId':_0x2dde1e['id'],'interface':_[_0x2d62('0x67')](_0x4922d8['interface'])?util[_0x2d62('0xa9')]('SIP/%s',_0x4922d8[_0x2d62('0x3d')]):_0x4922d8[_0x2d62('0x9d')],'paused':_0x4922d8[_0x2d62('0xaa')]||![],'penalty':_0x4922d8[_0x2d62('0xa3')]},{'transaction':_0x3ad763});});return Promise[_0x2d62('0x59')](_0x4e917d);})['then'](function(){return db[_0x2d62('0x11a')][_0x2d62('0x51')]({'where':{'teamId':{'$in':_0x53dc4c}}});})[_0x2d62('0x24')](function(_0xd31e44){var _0xc32dc1=_[_0x2d62('0x39')](_0xd31e44,function(_0x3e28fe){return db[_0x2d62('0x11b')][_0x2d62('0x7f')]({'UserId':_0x4922d8['id'],'VoicePrefixId':_0x3e28fe[_0x2d62('0x11c')]},{'transaction':_0x3ad763});});return Promise[_0x2d62('0x59')](_0xc32dc1);});});})[_0x2d62('0x24')](function(){for(var _0x95c139=0x0;_0x95c139<_0x1e36fa['length'];_0x95c139++){var _0x54aad3=_0x1e36fa[_0x95c139][_0x2d62('0x11d')]('channel');var _0x5c8977=_0x54aad3+_0x2d62('0xa4');socket[_0x2d62('0x31')](_0x2d62('0x36')+_0x54aad3+'Queue:save',{'UserId':_0x2e0681,['queueField']:_0x1e36fa[_0x95c139]['id']});}})['then'](respondWithStatusCode(_0x2a8bd2,null))[_0x2d62('0x2e')](APIHandleError(_0x2a8bd2));};exports[_0x2d62('0x11e')]=function(_0x4047f7,_0x25167a){var _0x50a262=_0x4047f7[_0x2d62('0x61')]['id'];var _0x3e8669=null;if(_0x4047f7['query']['ids']){_0x3e8669=_[_0x2d62('0xaf')](_0x4047f7[_0x2d62('0x4a')][_0x2d62('0x62')])?_0x4047f7[_0x2d62('0x4a')][_0x2d62('0x62')]:[_0x4047f7[_0x2d62('0x4a')][_0x2d62('0x62')]];}var _0x4db98b=[];return Promise[_0x2d62('0x115')]()[_0x2d62('0x24')](function(){if(!_0x3e8669)throw new APIBadRequestError(_0x2d62('0x11f'));})[_0x2d62('0x24')](function(){return db[_0x2d62('0x49')]['findOne']({'where':{'id':_0x50a262}});})[_0x2d62('0x24')](function(_0x14f5f4){if(!_0x14f5f4)throw new APINotFoundError(util['format'](_0x2d62('0x112'),_0x4047f7['params']['id']));return db[_0x2d62('0x6a')]['transaction'](function(_0x580a7c){return _0x14f5f4['removeTeams'](_0x3e8669,{'transaction':_0x580a7c})[_0x2d62('0x24')](function(){return db[_0x2d62('0x114')][_0x2d62('0x51')]({'where':{'id':{'$in':_0x3e8669}}});})['then'](function(_0x37dd2f){var _0x38e240=_[_0x2d62('0x39')](_0x37dd2f,function(_0x1ef6fe){return _0x1ef6fe[_0x2d62('0x118')]();});return Promise[_0x2d62('0x59')](_0x38e240);})[_0x2d62('0x24')](function(_0x4c016a){_0x4db98b=_['flattenDeep'](_0x4c016a);var _0x12d8c9=_[_0x2d62('0x39')](_0x4db98b,function(_0x20d069){return _0x20d069[_0x2d62('0x120')](_0x14f5f4['id'],{'transaction':_0x580a7c});});return Promise['all'](_0x12d8c9);})[_0x2d62('0x24')](function(){if(!_0x14f5f4[_0x2d62('0x9b')])return;var _0x16694f=_[_0x2d62('0x45')](_0x4db98b,function(_0x311f19){return _0x311f19[_0x2d62('0x11d')](_0x2d62('0xad'))===_0x2d62('0x121');});var _0x14918d=_[_0x2d62('0x39')](_0x16694f,function(_0x2f5976){return db[_0x2d62('0xab')]['destroy']({'where':{'VoiceQueueId':_0x2f5976['id'],'UserId':_0x14f5f4['id']},'transaction':_0x580a7c});});return Promise[_0x2d62('0x59')](_0x14918d);})[_0x2d62('0x24')](function(){return db[_0x2d62('0x11a')][_0x2d62('0x51')]({'where':{'teamId':{'$in':_0x3e8669}}});})[_0x2d62('0x24')](function(_0x5457d8){var _0xa8d07=_[_0x2d62('0x39')](_0x5457d8,function(_0x5161a4){return db['UserVoicePrefix'][_0x2d62('0x3f')]({'where':{'UserId':_0x14f5f4['id'],'VoicePrefixId':_0x5161a4['VoicePrefixId']}},{'transaction':_0x580a7c});});return Promise[_0x2d62('0x59')](_0xa8d07);});});})[_0x2d62('0x24')](function(){for(var _0x1bfec2=0x0;_0x1bfec2<_0x4db98b['length'];_0x1bfec2++){var _0x5f2624=_0x4db98b[_0x1bfec2][_0x2d62('0x11d')]('channel');var _0x5817a2=_0x5f2624+_0x2d62('0xa4');socket['emit'](_0x2d62('0x36')+_0x5f2624+_0x2d62('0xb0'),{'UserId':_0x50a262,['queueField']:_0x4db98b[_0x1bfec2]['id']});}})[_0x2d62('0x24')](respondWithStatusCode(_0x25167a,null))[_0x2d62('0x2e')](APIHandleError(_0x25167a));};exports[_0x2d62('0x122')]=function(_0x2009db,_0x357965){var _0x49d8ce={};var _0x559407={};var _0x28239d;var _0x26323c;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x2009db[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x357965,null))[_0x2d62('0x24')](function(_0x35efa9){if(_0x35efa9){_0x28239d=_0x35efa9;_0x559407[_0x2d62('0xcd')]=_['keys'](db[_0x2d62('0xc7')]['rawAttributes']);_0x559407[_0x2d62('0x4a')]=_[_0x2d62('0xce')](_0x2009db[_0x2d62('0x4a')]);_0x559407['filters']=_[_0x2d62('0xd0')](_0x559407['model'],_0x559407['query']);_0x49d8ce['attributes']=_[_0x2d62('0xd0')](_0x559407[_0x2d62('0xcd')],qs[_0x2d62('0xd1')](_0x2009db[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0x49d8ce['attributes']=_0x49d8ce[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0x49d8ce['attributes']:_0x559407[_0x2d62('0xcd')];_0x49d8ce[_0x2d62('0xd2')]=qs[_0x2d62('0xd3')](_0x2009db[_0x2d62('0x4a')][_0x2d62('0xd3')]);_0x49d8ce[_0x2d62('0x48')]=qs[_0x2d62('0xcf')](_['pick'](_0x2009db[_0x2d62('0x4a')],_0x559407[_0x2d62('0xcf')]));if(_0x2009db['query'][_0x2d62('0x45')]){_0x49d8ce[_0x2d62('0x48')]=_[_0x2d62('0xd4')](_0x49d8ce['where'],{'$or':_['map'](_0x49d8ce[_0x2d62('0x4f')],function(_0x262418){var _0x183a1b={};_0x183a1b[_0x262418]={'$like':'%'+_0x2009db[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x183a1b;})});}_0x49d8ce=_[_0x2d62('0xd4')]({},_0x49d8ce,_0x2009db[_0x2d62('0xda')]);return _0x28239d[_0x2d62('0x122')](_0x49d8ce);}})[_0x2d62('0x24')](function(_0x1afe14){if(_0x1afe14){_0x26323c=_0x1afe14[_0x2d62('0x6d')];if(!_0x2009db[_0x2d62('0x4a')][_0x2d62('0xc6')]('nolimit')){_0x49d8ce[_0x2d62('0x1f')]=qs[_0x2d62('0x1f')](_0x2009db[_0x2d62('0x4a')][_0x2d62('0x1f')]);_0x49d8ce[_0x2d62('0x1d')]=qs['offset'](_0x2009db[_0x2d62('0x4a')][_0x2d62('0x1d')]);}return _0x28239d[_0x2d62('0x122')](_0x49d8ce);}})[_0x2d62('0x24')](function(_0x51b8a9){if(_0x51b8a9){return _0x51b8a9?{'count':_0x26323c,'rows':_0x51b8a9}:null;}})['then'](respondWithResult(_0x357965,null))['catch'](handleError(_0x357965,null));};exports[_0x2d62('0x123')]=function(_0x1af6d9,_0x25e83f){var _0x5e41ab={};var _0x2b8e05={};var _0x463fc5;return db[_0x2d62('0x49')][_0x2d62('0x96')]({'where':{'id':_0x1af6d9[_0x2d62('0x61')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x25e83f,null))[_0x2d62('0x24')](function(_0x4bf655){if(_0x4bf655){_0x463fc5=_0x4bf655;_0x2b8e05[_0x2d62('0xcd')]=_[_0x2d62('0xce')](db['User'][_0x2d62('0xd9')]);_0x2b8e05['query']=_[_0x2d62('0xce')](_0x1af6d9[_0x2d62('0x4a')]);_0x2b8e05['filters']=_[_0x2d62('0xd0')](_0x2b8e05[_0x2d62('0xcd')],_0x2b8e05[_0x2d62('0x4a')]);_0x5e41ab[_0x2d62('0x4f')]=_[_0x2d62('0xd0')](_0x2b8e05[_0x2d62('0xcd')],qs['fields'](_0x1af6d9[_0x2d62('0x4a')][_0x2d62('0xd1')]));_0x5e41ab['attributes']=_0x5e41ab[_0x2d62('0x4f')][_0x2d62('0x6d')]?_0x5e41ab[_0x2d62('0x4f')]:_0x2b8e05[_0x2d62('0xcd')];_0x5e41ab['order']=qs['sort'](_0x1af6d9[_0x2d62('0x4a')][_0x2d62('0xd3')]);_0x5e41ab[_0x2d62('0x48')]=qs['filters'](_[_0x2d62('0xdc')](_0x1af6d9[_0x2d62('0x4a')],_0x2b8e05[_0x2d62('0xcf')]));if(_0x1af6d9[_0x2d62('0x4a')][_0x2d62('0x45')]){_0x5e41ab[_0x2d62('0x48')]=_[_0x2d62('0xd4')](_0x5e41ab[_0x2d62('0x48')],{'$or':_[_0x2d62('0x39')](_0x5e41ab[_0x2d62('0x4f')],function(_0x140e6e){var _0x45e5f9={};_0x45e5f9[_0x140e6e]={'$like':'%'+_0x1af6d9[_0x2d62('0x4a')][_0x2d62('0x45')]+'%'};return _0x45e5f9;})});}_0x5e41ab[_0x2d62('0xcd')]=db[_0x2d62('0x49')];_0x5e41ab['as']='Agents';_0x5e41ab=_[_0x2d62('0xd4')]({},_0x5e41ab,_0x1af6d9['options']);return _0x463fc5[_0x2d62('0xfb')]({'include':[_0x5e41ab]});}})[_0x2d62('0x24')](function(_0x2caf89){if(_0x2caf89){var _0x3fa4bb={},_0x26ce70=[];for(var _0x117531=0x0;_0x117531<_0x2caf89['length'];_0x117531+=0x1){for(var _0x5d6910=0x0,_0x3991bf;_0x5d6910<_0x2caf89[_0x117531]['Agents'][_0x2d62('0x6d')];_0x5d6910+=0x1){_0x3991bf=_0x2caf89[_0x117531]['Agents'][_0x5d6910]['get']({'plain':!![]});_0x3fa4bb[_0x3991bf['id']]=_0x3991bf;}}_0x3fa4bb=_[_0x2d62('0x124')](_0x3fa4bb);for(var _0x1e8404=qs[_0x2d62('0x1d')](_0x1af6d9[_0x2d62('0x4a')][_0x2d62('0x1d')]);_0x1e8404<_0x3fa4bb['length']&&_0x26ce70['length']=_0x4b019f[_0x41aa('0x4b')]){throw new Error(_0x41aa('0x4c'));}})[_0x41aa('0x13')](function(){if(_0x40aba8){return db[_0x41aa('0x23')][_0x41aa('0x4d')]({'where':{'membername':_0x40aba8[_0x41aa('0x26')]},'individualHooks':!![]});}})[_0x41aa('0x13')](function(){if(_0x40aba8){return _0x40aba8[_0x41aa('0x4e')]({'raw':!![]});}})[_0x41aa('0x13')](function(_0x2d696e){if(_0x40aba8){if(_0x2d696e){var _0x34e324=[];_0x1db4f2=_0x2d696e;if(_0x1db4f2['length']){for(var _0x4abd74=0x0;_0x4abd74<_0x1db4f2['length'];_0x4abd74++){_0x34e324[_0x41aa('0x2c')](db[_0x41aa('0x23')][_0x41aa('0x4f')]({'membername':_0x40aba8[_0x41aa('0x26')],'UserId':_0x40aba8['id'],'queue_name':_0x1db4f2[_0x4abd74]['name'],'VoiceQueueId':_0x1db4f2[_0x4abd74]['id'],'interface':_0x130260,'paused':_0x40aba8['loginInPause']||![],'penalty':_0x1db4f2[_0x4abd74][_0x41aa('0x50')]||0x0}));}return BPromise[_0x41aa('0x43')](_0x34e324);}}}})['then'](function(){if(_0x40aba8){return db[_0x41aa('0x25')][_0x41aa('0x51')]({'where':{'membername':_0x40aba8[_0x41aa('0x26')],'exitAt':null}});}})[_0x41aa('0x13')](function(_0x1f6315){if(_0x40aba8){if(_0x1f6315&&_0x1f6315['length']){var _0x4b3703=[];_0x1f6315[_0x41aa('0x2b')](function(_0x447937){_0x4b3703[_0x41aa('0x2c')](_0x447937[_0x41aa('0x24')]({'exitAt':moment()[_0x41aa('0x20')](_0x41aa('0x2e'))}));});return BPromise[_0x41aa('0x43')](_0x4b3703);}}})[_0x41aa('0x13')](function(){if(_0x40aba8){var _0x135667=[];var _0x568215=[];var _0x5d2bbe=utils['getChannels']();var _0x1fb661={'membername':_0x40aba8[_0x41aa('0x26')],'interface':_0x130260,'enterAt':moment()[_0x41aa('0x20')](_0x41aa('0x2e')),'role':_0x40aba8[_0x41aa('0x1d')],'internal':_0x40aba8[_0x41aa('0x1e')]};_0x5d2bbe[_0x41aa('0x2b')](function(_0xa0fde4){_0x135667[_0x41aa('0x2c')](_[_0x41aa('0x52')]({'channel':_0xa0fde4,'type':_0x41aa('0x53'),'data1':_0x41aa('0x54'),'data2':_0x130260},_0x1fb661));if(_0x40aba8[_0x41aa('0x55')]){_0x568215[_0x41aa('0x2c')](_[_0x41aa('0x52')]({'channel':_0xa0fde4,'type':_0x41aa('0x27'),'data1':_0x41aa('0x56')},_0x1fb661));}});return db['MemberReport']['bulkCreate'](_0x135667[_0x41aa('0x57')](_0x568215),{'individualHooks':!![]});}})[_0x41aa('0x13')](function(){if(_0x40aba8){return _0x40aba8[_0x41aa('0x24')]({'online':!![],'lastLoginAt':moment()[_0x41aa('0x20')](_0x41aa('0x2e')),'voicePause':_0x40aba8[_0x41aa('0x55')]||![],'mailPause':_0x40aba8[_0x41aa('0x55')]||![],'chatPause':_0x40aba8['loginInPause']||![],'faxPause':_0x40aba8[_0x41aa('0x55')]||![],'smsPause':_0x40aba8[_0x41aa('0x55')]||![],'openchannelPause':_0x40aba8[_0x41aa('0x55')]||![],'pauseType':_0x40aba8['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x41aa('0x2e')),'interface':_0x130260});}})['then'](function(_0x220817){_0x383730(_0x220817);})[_0x41aa('0x16')](function(_0x25bfc2){_0x3464c5(_0x158009[_0x41aa('0x17')](0x1f4,_0x25bfc2[_0x41aa('0x18')]));});});}; \ No newline at end of file +var _0x004d=['PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','SIP/%s','type','DEFAULT\x20PAUSE','internal','body','uniqueid','bulkCreate','update','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','faxPause','pauseType','params','system','LogoutUser','all','LoginUser','mobile','phone','loginInPause','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','rpc','../../config/environment','defaults','redis','socket.io-emitter','./user.socket','GetUser','User','findAll','options','where','attributes','limit','include','model','map','info','error','message','ShowUser','find','raw','then','catch','PauseUser','name','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','MemberReport'];(function(_0x23bbaa,_0x3ea8be){var _0x2cc4fa=function(_0x59a4a1){while(--_0x59a4a1){_0x23bbaa['push'](_0x23bbaa['shift']());}};_0x2cc4fa(++_0x3ea8be);}(_0x004d,0x1b2));var _0xd004=function(_0x264d16,_0x4b44ec){_0x264d16=_0x264d16-0x0;var _0x14dab5=_0x004d[_0x264d16];return _0x14dab5;};'use strict';var _=require(_0xd004('0x0'));var util=require('util');var moment=require(_0xd004('0x1'));var BPromise=require('bluebird');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd004('0x2'));var config=require(_0xd004('0x3'));config['redis']=_[_0xd004('0x4')](config[_0xd004('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xd004('0x6'))(new Redis(config['redis']));require(_0xd004('0x7'))['register'](socket);exports[_0xd004('0x8')]=function(_0x47eac1){var _0x1566ee=this;return new Promise(function(_0x1d0ee6,_0xc9ce49){return db[_0xd004('0x9')][_0xd004('0xa')]({'raw':_0x47eac1[_0xd004('0xb')]?_0x47eac1[_0xd004('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x47eac1[_0xd004('0xb')]?_0x47eac1['options'][_0xd004('0xc')]||null:null,'attributes':_0x47eac1['options']?_0x47eac1[_0xd004('0xb')][_0xd004('0xd')]||null:null,'limit':_0x47eac1[_0xd004('0xb')]?_0x47eac1[_0xd004('0xb')][_0xd004('0xe')]||null:null,'include':_0x47eac1[_0xd004('0xb')]?_0x47eac1[_0xd004('0xb')][_0xd004('0xf')]?_['map'](_0x47eac1[_0xd004('0xb')][_0xd004('0xf')],function(_0x49671f){return{'model':db[_0x49671f[_0xd004('0x10')]],'as':_0x49671f['as'],'attributes':_0x49671f[_0xd004('0xd')],'include':_0x49671f[_0xd004('0xf')]?_[_0xd004('0x11')](_0x49671f['include'],function(_0x58728d){return{'model':db[_0x58728d['model']],'as':_0x58728d['as'],'attributes':_0x58728d['attributes'],'include':_0x58728d['include']?_[_0xd004('0x11')](_0x58728d[_0xd004('0xf')],function(_0x55a740){return{'model':db[_0x55a740[_0xd004('0x10')]],'as':_0x55a740['as'],'attributes':_0x55a740[_0xd004('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a9234){logger[_0xd004('0x12')](_0xd004('0x8'),_0x47eac1);logger['debug'](_0xd004('0x8'),_0x47eac1,JSON['stringify'](_0x1a9234));_0x1d0ee6(_0x1a9234);})['catch'](function(_0x3a1aaf){logger[_0xd004('0x13')]('GetUser',_0x3a1aaf[_0xd004('0x14')],_0x47eac1);_0xc9ce49(_0x1566ee[_0xd004('0x13')](0x1f4,_0x3a1aaf[_0xd004('0x14')]));});});};exports[_0xd004('0x15')]=function(_0x3616df){var _0x4de58c=this;return new Promise(function(_0x1052d0,_0x43b1a1){return db[_0xd004('0x9')][_0xd004('0x16')]({'raw':_0x3616df[_0xd004('0xb')]?_0x3616df[_0xd004('0xb')][_0xd004('0x17')]===undefined?!![]:![]:!![],'where':_0x3616df[_0xd004('0xb')]?_0x3616df[_0xd004('0xb')][_0xd004('0xc')]||null:null,'attributes':_0x3616df['options']?_0x3616df[_0xd004('0xb')][_0xd004('0xd')]||null:null,'include':_0x3616df[_0xd004('0xb')]?_0x3616df[_0xd004('0xb')][_0xd004('0xf')]?_['map'](_0x3616df['options']['include'],function(_0x5e1417){return{'model':db[_0x5e1417[_0xd004('0x10')]],'as':_0x5e1417['as'],'attributes':_0x5e1417[_0xd004('0xd')],'include':_0x5e1417[_0xd004('0xf')]?_[_0xd004('0x11')](_0x5e1417[_0xd004('0xf')],function(_0x19bc5e){return{'model':db[_0x19bc5e['model']],'as':_0x19bc5e['as'],'attributes':_0x19bc5e[_0xd004('0xd')],'include':_0x19bc5e[_0xd004('0xf')]?_[_0xd004('0x11')](_0x19bc5e[_0xd004('0xf')],function(_0x250763){return{'model':db[_0x250763['model']],'as':_0x250763['as'],'attributes':_0x250763[_0xd004('0xd')]};}):[]};}):[]};}):[]:[]})[_0xd004('0x18')](function(_0x2f5315){logger[_0xd004('0x12')]('ShowUser',_0x3616df);logger['debug']('ShowUser',_0x3616df,JSON['stringify'](_0x2f5315));_0x1052d0(_0x2f5315);})[_0xd004('0x19')](function(_0x1e8986){logger[_0xd004('0x13')]('ShowUser',_0x1e8986[_0xd004('0x14')],_0x3616df);_0x43b1a1(_0x4de58c[_0xd004('0x13')](0x1f4,_0x1e8986[_0xd004('0x14')]));});});};exports[_0xd004('0x1a')]=function(_0x1a80d8){var _0x4b24eb;return db[_0xd004('0x9')][_0xd004('0x16')]({'where':_0x1a80d8[_0xd004('0xb')]['where']||{},'attributes':['id',_0xd004('0x1b'),_0xd004('0x1c'),'internal',_0xd004('0x1d')]})[_0xd004('0x18')](function(_0xda66a7){if(!_0xda66a7){throw new Error(util[_0xd004('0x1e')](_0xd004('0x1f'),_0x1a80d8['params']['id']));}_0x4b24eb=_0xda66a7;return db[_0xd004('0x20')]['update']({'paused':0x1},{'where':{'UserId':_0x4b24eb['id']},'individualHooks':!![]});})[_0xd004('0x18')](function(){return db[_0xd004('0x21')]['findAll']({'where':{'membername':_0x4b24eb['name'],'type':_0xd004('0x22'),'exitAt':null}});})['then'](function(_0x52f742){if(_0x52f742&&_0x52f742[_0xd004('0x23')]){var _0x54f5ee=moment()['format'](_0xd004('0x24'));for(var _0x557a5c=0x0,_0x29b9c5=_0x52f742[_0xd004('0x23')];_0x557a5c<_0x29b9c5;_0x557a5c++){_0x52f742[_0x557a5c]['updateAttributes']({'exitAt':_0x54f5ee});}}})[_0xd004('0x18')](function(){var _0x4cb311=[];var _0xed97f8=utils[_0xd004('0x25')]();_0xed97f8[_0xd004('0x26')](function(_0x50ab27){_0x4cb311[_0xd004('0x27')]({'channel':_0x50ab27,'membername':_0x4b24eb[_0xd004('0x1b')],'interface':_[_0xd004('0x28')](_0x4b24eb[_0xd004('0x1d')])?util[_0xd004('0x1e')](_0xd004('0x29'),_0x4b24eb[_0xd004('0x1b')]):_0x4b24eb[_0xd004('0x1d')],'type':_0xd004('0x22'),'enterAt':moment()[_0xd004('0x1e')](_0xd004('0x24')),'data1':_0x1a80d8['body'][_0xd004('0x2a')]||_0xd004('0x2b'),'role':_0x4b24eb[_0xd004('0x1c')],'internal':_0x4b24eb[_0xd004('0x2c')],'uniqueid':_0x1a80d8[_0xd004('0x2d')][_0xd004('0x2e')]||null});});return db[_0xd004('0x21')][_0xd004('0x2f')](_0x4cb311,{'individualHooks':!![]});})[_0xd004('0x18')](function(){return _0x4b24eb[_0xd004('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1a80d8[_0xd004('0x2d')]['type']||_0xd004('0x2b'),'lastPauseAt':moment()[_0xd004('0x1e')](_0xd004('0x24'))});})['catch'](function(_0x3ee261){throw _0x3ee261;});};exports[_0xd004('0x31')]=function(_0x5f231f){return Promise['resolve']()[_0xd004('0x18')](function(){if(_0x5f231f[_0xd004('0x2d')][_0xd004('0x32')]&&!utils[_0xd004('0x33')](_0x5f231f[_0xd004('0x2d')][_0xd004('0x32')])){throw new Error(util['format'](_0xd004('0x34'),_0x5f231f['body'][_0xd004('0x32')]));}return db['User'][_0xd004('0x35')]({'where':_0x5f231f[_0xd004('0xb')][_0xd004('0xc')]||{},'attributes':['id','name','role',_0xd004('0x2c'),'interface',_0xd004('0x36'),_0xd004('0x37'),'mailPause','chatPause',_0xd004('0x38'),'openchannelPause','smsPause','whatsappPause',_0xd004('0x39'),'lastPauseAt']});})[_0xd004('0x18')](function(_0x8e58a3){if(!_0x8e58a3){throw new Error(util[_0xd004('0x1e')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5f231f[_0xd004('0x3a')]['id']));}return _0x8e58a3['unpause'](_0x5f231f['body']['channel'],_0xd004('0x3b'));})[_0xd004('0x19')](function(_0x55d8d4){throw _0x55d8d4;});};exports[_0xd004('0x3c')]=function(_0x582388){var _0x1a73ff=this;return new Promise(function(_0x57eb14,_0x188192){var _0x284172;return db[_0xd004('0x9')][_0xd004('0x35')]({'where':_0x582388[_0xd004('0xb')][_0xd004('0xc')]||{},'attributes':['id','name']})[_0xd004('0x18')](function(_0xd3d121){if(_0xd3d121){_0x284172=_0xd3d121;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x284172['name']},'individualHooks':!![]});}})['then'](function(){if(_0x284172){return db[_0xd004('0x21')][_0xd004('0xa')]({'where':{'membername':_0x284172[_0xd004('0x1b')],'exitAt':null}});}})['then'](function(_0x5c93d5){if(_0x284172){if(_0x5c93d5&&_0x5c93d5[_0xd004('0x23')]){var _0x4c8231=[];_0x5c93d5[_0xd004('0x26')](function(_0x3cb8f3){_0x4c8231[_0xd004('0x27')](_0x3cb8f3[_0xd004('0x30')]({'exitAt':moment()[_0xd004('0x1e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd004('0x3d')](_0x4c8231);}}})['then'](function(){if(_0x284172){return _0x284172[_0xd004('0x30')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd004('0x18')](function(_0x1070ca){_0x57eb14(_0x1070ca);})['catch'](function(_0x2fd19d){_0x188192(_0x1a73ff[_0xd004('0x13')](0x1f4,_0x2fd19d['message']));});});};exports[_0xd004('0x3e')]=function(_0x528f4f){var _0x47c7d3=this;return new Promise(function(_0x334e84,_0x2d1c87){var _0x566d4e;var _0xb3164f;var _0x44f00d;var _0x4b9644;return db[_0xd004('0x9')][_0xd004('0x35')]({'where':_0x528f4f['options'][_0xd004('0xc')]||{},'attributes':['id',_0xd004('0x1b'),_0xd004('0x1c'),_0xd004('0x3f'),_0xd004('0x40'),_0xd004('0x2c'),_0xd004('0x41'),_0xd004('0x1d')]})[_0xd004('0x18')](function(_0xa24fb0){if(_0xa24fb0){_0x566d4e=_0xa24fb0;_0x4b9644=_0x528f4f[_0xd004('0x2d')][_0xd004('0x1d')]?_0x528f4f['body'][_0xd004('0x1d')]:util[_0xd004('0x1e')](_0xd004('0x29'),_0x566d4e[_0xd004('0x1b')]);return db[_0xd004('0x9')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x566d4e['id']}}});}})[_0xd004('0x18')](function(_0x1ab361){if(_0x1ab361){_0x44f00d=_0x1ab361;return require(_0xd004('0x42'))[_0xd004('0x43')]();}})[_0xd004('0x18')](function(_0x4a1fcc){if(_0x4a1fcc&&_0x4a1fcc[_0xd004('0x44')]&&_0x44f00d>=_0x4a1fcc['agents']){throw new Error(_0xd004('0x45'));}})[_0xd004('0x18')](function(){if(_0x566d4e){return db['UserVoiceQueueRt'][_0xd004('0x46')]({'where':{'membername':_0x566d4e[_0xd004('0x1b')]},'individualHooks':!![]});}})[_0xd004('0x18')](function(){if(_0x566d4e){return _0x566d4e[_0xd004('0x47')]({'raw':!![]});}})[_0xd004('0x18')](function(_0x911f83){if(_0x566d4e){if(_0x911f83){var _0x52956c=[];_0xb3164f=_0x911f83;if(_0xb3164f[_0xd004('0x23')]){for(var _0x3e2529=0x0;_0x3e2529<_0xb3164f['length'];_0x3e2529++){_0x52956c[_0xd004('0x27')](db[_0xd004('0x20')][_0xd004('0x48')]({'membername':_0x566d4e[_0xd004('0x1b')],'UserId':_0x566d4e['id'],'queue_name':_0xb3164f[_0x3e2529]['name'],'VoiceQueueId':_0xb3164f[_0x3e2529]['id'],'interface':_0x4b9644,'paused':_0x566d4e[_0xd004('0x41')]||![],'penalty':_0xb3164f[_0x3e2529]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd004('0x3d')](_0x52956c);}}}})[_0xd004('0x18')](function(){if(_0x566d4e){return db[_0xd004('0x21')][_0xd004('0xa')]({'where':{'membername':_0x566d4e['name'],'exitAt':null}});}})[_0xd004('0x18')](function(_0x406d90){if(_0x566d4e){if(_0x406d90&&_0x406d90[_0xd004('0x23')]){var _0x4e4462=[];_0x406d90[_0xd004('0x26')](function(_0x181bc7){_0x4e4462[_0xd004('0x27')](_0x181bc7['update']({'exitAt':moment()[_0xd004('0x1e')](_0xd004('0x24'))}));});return BPromise[_0xd004('0x3d')](_0x4e4462);}}})[_0xd004('0x18')](function(){if(_0x566d4e){var _0x440de4=[];var _0x3e2dc8=[];var _0x3f0500=utils[_0xd004('0x25')]();var _0x5bcb50={'membername':_0x566d4e[_0xd004('0x1b')],'interface':_0x4b9644,'enterAt':moment()[_0xd004('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x566d4e[_0xd004('0x1c')],'internal':_0x566d4e[_0xd004('0x2c')]};_0x3f0500['forEach'](function(_0x1e37f2){_0x440de4['push'](_[_0xd004('0x49')]({'channel':_0x1e37f2,'type':_0xd004('0x4a'),'data1':_0xd004('0x4b'),'data2':_0x4b9644},_0x5bcb50));if(_0x566d4e[_0xd004('0x41')]){_0x3e2dc8['push'](_[_0xd004('0x49')]({'channel':_0x1e37f2,'type':_0xd004('0x22'),'data1':_0xd004('0x4c')},_0x5bcb50));}});return db[_0xd004('0x21')]['bulkCreate'](_0x440de4[_0xd004('0x4d')](_0x3e2dc8),{'individualHooks':!![]});}})[_0xd004('0x18')](function(){if(_0x566d4e){return _0x566d4e[_0xd004('0x30')]({'online':!![],'lastLoginAt':moment()[_0xd004('0x1e')](_0xd004('0x24')),'voicePause':_0x566d4e[_0xd004('0x41')]||![],'mailPause':_0x566d4e[_0xd004('0x41')]||![],'chatPause':_0x566d4e[_0xd004('0x41')]||![],'faxPause':_0x566d4e[_0xd004('0x41')]||![],'smsPause':_0x566d4e[_0xd004('0x41')]||![],'openchannelPause':_0x566d4e[_0xd004('0x41')]||![],'pauseType':_0x566d4e[_0xd004('0x41')]?_0xd004('0x4c'):null,'lastPauseAt':moment()[_0xd004('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4b9644});}})[_0xd004('0x18')](function(_0x5c8834){_0x334e84(_0x5c8834);})['catch'](function(_0x32bb97){_0x2d1c87(_0x47c7d3[_0xd004('0x13')](0x1f4,_0x32bb97['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index b17fedd..0eea5fe 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 _0x1cbf=['remove','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x16c0c2,_0x3f7818){var _0x5c1442=function(_0x131d92){while(--_0x131d92){_0x16c0c2['push'](_0x16c0c2['shift']());}};_0x5c1442(++_0x3f7818);}(_0x1cbf,0xce));var _0xf1cb=function(_0x324edb,_0x8f30fd){_0x324edb=_0x324edb-0x0;var _0x231778=_0x1cbf[_0x324edb];return _0x231778;};'use strict';var UserEvents=require(_0xf1cb('0x0'));var events=[_0xf1cb('0x1'),_0xf1cb('0x2'),'update'];function createListener(_0x5160d,_0x216e1a){return function(_0x224ec3){_0x216e1a[_0xf1cb('0x3')](_0x5160d,_0x224ec3);};}function removeListener(_0x2f5728,_0x2e5009){return function(){UserEvents[_0xf1cb('0x4')](_0x2f5728,_0x2e5009);};}exports[_0xf1cb('0x5')]=function(_0x288d0a){for(var _0x196870=0x0,_0x4762e6=events[_0xf1cb('0x6')];_0x196870<_0x4762e6;_0x196870++){var _0x2375d6=events[_0x196870];var _0x248f72=createListener(_0xf1cb('0x7')+_0x2375d6,_0x288d0a);UserEvents['on'](_0x2375d6,_0x248f72);}}; \ No newline at end of file +var _0x3ff7=['./user.events','remove','update','emit','removeListener','register','user:'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x3ff7,0x7e));var _0x73ff=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x3ff7[_0x1dd82f];return _0x353ca4;};'use strict';var UserEvents=require(_0x73ff('0x0'));var events=['save',_0x73ff('0x1'),_0x73ff('0x2')];function createListener(_0x14cd2c,_0x423e1c){return function(_0x1bb81e){_0x423e1c[_0x73ff('0x3')](_0x14cd2c,_0x1bb81e);};}function removeListener(_0x64e607,_0x1c5266){return function(){UserEvents[_0x73ff('0x4')](_0x64e607,_0x1c5266);};}exports[_0x73ff('0x5')]=function(_0x31ab2f){for(var _0x517a5d=0x0,_0x1ad7b7=events['length'];_0x517a5d<_0x1ad7b7;_0x517a5d++){var _0x4c7765=events[_0x517a5d];var _0x1c789b=createListener(_0x73ff('0x6')+_0x4c7765,_0x31ab2f);UserEvents['on'](_0x4c7765,_0x1c789b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 89df883..49e61ab 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3c4d2a,_0x1e5816){var _0x596a0b=function(_0x1ace1c){while(--_0x1ace1c){_0x3c4d2a['push'](_0x3c4d2a['shift']());}};_0x596a0b(++_0x1e5816);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x12f7a8,_0x2a1024){var _0x382d1c=function(_0x1dec56){while(--_0x1dec56){_0x12f7a8['push'](_0x12f7a8['shift']());}};_0x382d1c(++_0x2a1024);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index bf5c538..c91d6ca 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 _0x6631=['exports','INTEGER','sequelize'];(function(_0x30fb13,_0x19860d){var _0x26f7d4=function(_0x4859b8){while(--_0x4859b8){_0x30fb13['push'](_0x30fb13['shift']());}};_0x26f7d4(++_0x19860d);}(_0x6631,0x134));var _0x1663=function(_0x27e2b8,_0x48b167){_0x27e2b8=_0x27e2b8-0x0;var _0x2201e0=_0x6631[_0x27e2b8];return _0x2201e0;};'use strict';var Sequelize=require(_0x1663('0x0'));module[_0x1663('0x1')]={'penalty':{'type':Sequelize[_0x1663('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd80a=['INTEGER','exports'];(function(_0x38848e,_0x18110e){var _0x1f2005=function(_0x295d2f){while(--_0x295d2f){_0x38848e['push'](_0x38848e['shift']());}};_0x1f2005(++_0x18110e);}(_0xd80a,0x7f));var _0xad80=function(_0x5e9f5e,_0x238a90){_0x5e9f5e=_0x5e9f5e-0x0;var _0x1e62c2=_0xd80a[_0x5e9f5e];return _0x1e62c2;};'use strict';var Sequelize=require('sequelize');module[_0xad80('0x0')]={'penalty':{'type':Sequelize[_0xad80('0x1')],'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 c33ef51..08d3052 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 _0xe8e9=['exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe8e9,0x13b));var _0x9e8e=function(_0x5a20ee,_0x1172e4){_0x5a20ee=_0x5a20ee-0x0;var _0x407879=_0xe8e9[_0x5a20ee];return _0x407879;};'use strict';var _=require(_0x9e8e('0x0'));var util=require(_0x9e8e('0x1'));var logger=require(_0x9e8e('0x2'))('api');var moment=require(_0x9e8e('0x3'));var BPromise=require(_0x9e8e('0x4'));var rp=require(_0x9e8e('0x5'));var fs=require('fs');var path=require(_0x9e8e('0x6'));var rimraf=require(_0x9e8e('0x7'));var config=require(_0x9e8e('0x8'));var attributes=require(_0x9e8e('0x9'));module[_0x9e8e('0xa')]=function(_0x1b951b,_0x3bf779){return _0x1b951b['define'](_0x9e8e('0xb'),attributes,{'tableName':_0x9e8e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8df7=['UserChatQueue','util','../../config/logger','bluebird','request-promise','./userChatQueue.attributes','exports'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x8df7,0xc5));var _0x78df=function(_0x550a21,_0x4a5d64){_0x550a21=_0x550a21-0x0;var _0x1fbd31=_0x8df7[_0x550a21];return _0x1fbd31;};'use strict';var _=require('lodash');var util=require(_0x78df('0x0'));var logger=require(_0x78df('0x1'))('api');var moment=require('moment');var BPromise=require(_0x78df('0x2'));var rp=require(_0x78df('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x78df('0x4'));module[_0x78df('0x5')]=function(_0x35edb1,_0x4643ef){return _0x35edb1['define'](_0x78df('0x6'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 155c977..91bc1c4 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 _0x9b6a=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x7f7364,_0x59e59a){var _0x2271ab=function(_0x3591cb){while(--_0x3591cb){_0x7f7364['push'](_0x7f7364['shift']());}};_0x2271ab(++_0x59e59a);}(_0x9b6a,0xe7));var _0xa9b6=function(_0x1f8ec0,_0x933b58){_0x1f8ec0=_0x1f8ec0-0x0;var _0x5f4c0e=_0x9b6a[_0x1f8ec0];return _0x5f4c0e;};'use strict';var _=require('lodash');var util=require(_0xa9b6('0x0'));var moment=require(_0xa9b6('0x1'));var BPromise=require(_0xa9b6('0x2'));var rs=require(_0xa9b6('0x3'));var fs=require('fs');var Redis=require(_0xa9b6('0x4'));var db=require(_0xa9b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9b6('0x6'));var config=require(_0xa9b6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51a85c,_0x19b233,_0x943549){return new BPromise(function(_0x2bfbb1,_0x3fb0b6){return client['request'](_0x51a85c,_0x943549)['then'](function(_0x12ee4f){logger[_0xa9b6('0x9')](_0xa9b6('0xa'),_0x19b233,_0xa9b6('0xb'));logger[_0xa9b6('0xc')](_0xa9b6('0xd'),_0x19b233,_0xa9b6('0xb'),JSON[_0xa9b6('0xe')](_0x12ee4f));if(_0x12ee4f['error']){if(_0x12ee4f[_0xa9b6('0xf')][_0xa9b6('0x10')]===0x1f4){logger[_0xa9b6('0xf')](_0xa9b6('0xa'),_0x19b233,_0x12ee4f[_0xa9b6('0xf')]['message']);return _0x3fb0b6(_0x12ee4f[_0xa9b6('0xf')]['message']);}logger['error'](_0xa9b6('0xa'),_0x19b233,_0x12ee4f[_0xa9b6('0xf')]['message']);return _0x2bfbb1(_0x12ee4f[_0xa9b6('0xf')][_0xa9b6('0x11')]);}else{logger['info'](_0xa9b6('0xa'),_0x19b233,_0xa9b6('0xb'));_0x2bfbb1(_0x12ee4f['result'][_0xa9b6('0x11')]);}})['catch'](function(_0x2cf42f){logger[_0xa9b6('0xf')](_0xa9b6('0xa'),_0x19b233,_0x2cf42f);_0x3fb0b6(_0x2cf42f);});});} \ No newline at end of file +var _0x871b=['UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info'];(function(_0x490014,_0x519ad6){var _0x289bee=function(_0x44fcc8){while(--_0x44fcc8){_0x490014['push'](_0x490014['shift']());}};_0x289bee(++_0x519ad6);}(_0x871b,0xb2));var _0xb871=function(_0x578dc5,_0x4fc5b2){_0x578dc5=_0x578dc5-0x0;var _0x1e5409=_0x871b[_0x578dc5];return _0x1e5409;};'use strict';var _=require('lodash');var util=require(_0xb871('0x0'));var moment=require(_0xb871('0x1'));var BPromise=require(_0xb871('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb871('0x3'));var db=require(_0xb871('0x4'))['db'];var utils=require(_0xb871('0x5'));var logger=require(_0xb871('0x6'))('rpc');var config=require(_0xb871('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb871('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x691b34,_0x1dbfd9,_0x2234fb){return new BPromise(function(_0x5cd149,_0x5ac4b8){return client[_0xb871('0x9')](_0x691b34,_0x2234fb)[_0xb871('0xa')](function(_0x3e3d6d){logger[_0xb871('0xb')](_0xb871('0xc'),_0x1dbfd9,_0xb871('0xd'));logger['debug'](_0xb871('0xe'),_0x1dbfd9,'request\x20sent',JSON[_0xb871('0xf')](_0x3e3d6d));if(_0x3e3d6d[_0xb871('0x10')]){if(_0x3e3d6d[_0xb871('0x10')][_0xb871('0x11')]===0x1f4){logger[_0xb871('0x10')](_0xb871('0xc'),_0x1dbfd9,_0x3e3d6d[_0xb871('0x10')][_0xb871('0x12')]);return _0x5ac4b8(_0x3e3d6d[_0xb871('0x10')][_0xb871('0x12')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x1dbfd9,_0x3e3d6d['error'][_0xb871('0x12')]);return _0x5cd149(_0x3e3d6d['error']['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1dbfd9,'request\x20sent');_0x5cd149(_0x3e3d6d['result'][_0xb871('0x12')]);}})['catch'](function(_0x34b00e){logger[_0xb871('0x10')](_0xb871('0xc'),_0x1dbfd9,_0x34b00e);_0x5ac4b8(_0x34b00e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index b38044d..78f02c8 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x20927b,_0x308bbf){var _0x1f1de0=function(_0x963c89){while(--_0x963c89){_0x20927b['push'](_0x20927b['shift']());}};_0x1f1de0(++_0x308bbf);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x7c1a5d,_0x4bcb22){var _0x1cceb3=function(_0x3b235d){while(--_0x3b235d){_0x7c1a5d['push'](_0x7c1a5d['shift']());}};_0x1cceb3(++_0x4bcb22);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 9a969cf..50cbc28 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 _0x6227=['INTEGER','exports'];(function(_0x886b04,_0x4598b3){var _0x18e6c2=function(_0x460dd5){while(--_0x460dd5){_0x886b04['push'](_0x886b04['shift']());}};_0x18e6c2(++_0x4598b3);}(_0x6227,0xe9));var _0x7622=function(_0x3697ed,_0x5dcf33){_0x3697ed=_0x3697ed-0x0;var _0x5196f8=_0x6227[_0x3697ed];return _0x5196f8;};'use strict';var Sequelize=require('sequelize');module[_0x7622('0x0')]={'penalty':{'type':Sequelize[_0x7622('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x533c=['sequelize','exports','INTEGER'];(function(_0x40ad1f,_0x2d2dd2){var _0x3174bb=function(_0x47b0dd){while(--_0x47b0dd){_0x40ad1f['push'](_0x40ad1f['shift']());}};_0x3174bb(++_0x2d2dd2);}(_0x533c,0x189));var _0xc533=function(_0x5a6a94,_0x111d18){_0x5a6a94=_0x5a6a94-0x0;var _0x5f138f=_0x533c[_0x5a6a94];return _0x5f138f;};'use strict';var Sequelize=require(_0xc533('0x0'));module[_0xc533('0x1')]={'penalty':{'type':Sequelize[_0xc533('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc533('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 7865d12..535d908 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 _0x5c4b=['user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x420fc1,_0x4d1d8d){var _0x50b8d6=function(_0x4360ff){while(--_0x4360ff){_0x420fc1['push'](_0x420fc1['shift']());}};_0x50b8d6(++_0x4d1d8d);}(_0x5c4b,0x112));var _0xb5c4=function(_0x1f8210,_0x3e15af){_0x1f8210=_0x1f8210-0x0;var _0x13cca6=_0x5c4b[_0x1f8210];return _0x13cca6;};'use strict';var _=require(_0xb5c4('0x0'));var util=require(_0xb5c4('0x1'));var logger=require(_0xb5c4('0x2'))(_0xb5c4('0x3'));var moment=require('moment');var BPromise=require(_0xb5c4('0x4'));var rp=require(_0xb5c4('0x5'));var fs=require('fs');var path=require(_0xb5c4('0x6'));var rimraf=require(_0xb5c4('0x7'));var config=require(_0xb5c4('0x8'));var attributes=require(_0xb5c4('0x9'));module[_0xb5c4('0xa')]=function(_0x31f669,_0x3ef850){return _0x31f669[_0xb5c4('0xb')]('UserFaxQueue',attributes,{'tableName':_0xb5c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab26=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','util','api','moment','bluebird'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xab26,0xff));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var logger=require('../../config/logger')(_0x6ab2('0x2'));var moment=require(_0x6ab2('0x3'));var BPromise=require(_0x6ab2('0x4'));var rp=require(_0x6ab2('0x5'));var fs=require('fs');var path=require(_0x6ab2('0x6'));var rimraf=require(_0x6ab2('0x7'));var config=require(_0x6ab2('0x8'));var attributes=require(_0x6ab2('0x9'));module[_0x6ab2('0xa')]=function(_0x582670,_0x6c523b){return _0x582670[_0x6ab2('0xb')]('UserFaxQueue',attributes,{'tableName':_0x6ab2('0xc'),'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 4c0bb70..c4e0de9 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 _0x273d=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x463f91,_0x26ec38){var _0x552e15=function(_0x1fae37){while(--_0x1fae37){_0x463f91['push'](_0x463f91['shift']());}};_0x552e15(++_0x26ec38);}(_0x273d,0x149));var _0xd273=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x273d[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xd273('0x0'));var util=require('util');var moment=require(_0xd273('0x1'));var BPromise=require(_0xd273('0x2'));var rs=require(_0xd273('0x3'));var fs=require('fs');var Redis=require(_0xd273('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd273('0x5'));var logger=require(_0xd273('0x6'))('rpc');var config=require(_0xd273('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd273('0x8')][_0xd273('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13e25d,_0x3f18a3,_0x1295a4){return new BPromise(function(_0x32cf20,_0x490484){return client[_0xd273('0xa')](_0x13e25d,_0x1295a4)[_0xd273('0xb')](function(_0x329b71){logger[_0xd273('0xc')](_0xd273('0xd'),_0x3f18a3,_0xd273('0xe'));logger[_0xd273('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3f18a3,_0xd273('0xe'),JSON[_0xd273('0x10')](_0x329b71));if(_0x329b71['error']){if(_0x329b71[_0xd273('0x11')][_0xd273('0x12')]===0x1f4){logger['error'](_0xd273('0xd'),_0x3f18a3,_0x329b71['error'][_0xd273('0x13')]);return _0x490484(_0x329b71['error'][_0xd273('0x13')]);}logger[_0xd273('0x11')](_0xd273('0xd'),_0x3f18a3,_0x329b71[_0xd273('0x11')][_0xd273('0x13')]);return _0x32cf20(_0x329b71[_0xd273('0x11')][_0xd273('0x13')]);}else{logger[_0xd273('0xc')](_0xd273('0xd'),_0x3f18a3,_0xd273('0xe'));_0x32cf20(_0x329b71[_0xd273('0x14')][_0xd273('0x13')]);}})[_0xd273('0x15')](function(_0x54b964){logger[_0xd273('0x11')](_0xd273('0xd'),_0x3f18a3,_0x54b964);_0x490484(_0x54b964);});});} \ No newline at end of file +var _0x17ea=['stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x55d002,_0x150566){var _0x4e1d00=function(_0x37437d){while(--_0x37437d){_0x55d002['push'](_0x55d002['shift']());}};_0x4e1d00(++_0x150566);}(_0x17ea,0xd8));var _0xa17e=function(_0x10f65f,_0x535fa5){_0x10f65f=_0x10f65f-0x0;var _0x396b49=_0x17ea[_0x10f65f];return _0x396b49;};'use strict';var _=require(_0xa17e('0x0'));var util=require('util');var moment=require(_0xa17e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa17e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa17e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa17e('0x4'))(_0xa17e('0x5'));var config=require(_0xa17e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa17e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7cd2a3,_0x53f5cf,_0x3f6fce){return new BPromise(function(_0x2bab8c,_0x277c60){return client[_0xa17e('0x8')](_0x7cd2a3,_0x3f6fce)[_0xa17e('0x9')](function(_0x4edda6){logger[_0xa17e('0xa')](_0xa17e('0xb'),_0x53f5cf,_0xa17e('0xc'));logger[_0xa17e('0xd')](_0xa17e('0xe'),_0x53f5cf,_0xa17e('0xc'),JSON[_0xa17e('0xf')](_0x4edda6));if(_0x4edda6[_0xa17e('0x10')]){if(_0x4edda6[_0xa17e('0x10')][_0xa17e('0x11')]===0x1f4){logger['error'](_0xa17e('0xb'),_0x53f5cf,_0x4edda6[_0xa17e('0x10')][_0xa17e('0x12')]);return _0x277c60(_0x4edda6['error'][_0xa17e('0x12')]);}logger['error'](_0xa17e('0xb'),_0x53f5cf,_0x4edda6[_0xa17e('0x10')][_0xa17e('0x12')]);return _0x2bab8c(_0x4edda6[_0xa17e('0x10')][_0xa17e('0x12')]);}else{logger[_0xa17e('0xa')](_0xa17e('0xb'),_0x53f5cf,_0xa17e('0xc'));_0x2bab8c(_0x4edda6[_0xa17e('0x13')]['message']);}})[_0xa17e('0x14')](function(_0x3c43f7){logger[_0xa17e('0x10')](_0xa17e('0xb'),_0x53f5cf,_0x3c43f7);_0x277c60(_0x3c43f7);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 285ab89..9f46c93 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4b238e,_0x26e123){var _0x420380=function(_0x307bc2){while(--_0x307bc2){_0x4b238e['push'](_0x4b238e['shift']());}};_0x420380(++_0x26e123);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xcb91[_0x3e2fcf];return _0x497db7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xd04b4f,_0x58ffa8){var _0x105dc1=function(_0x505c1d){while(--_0x505c1d){_0xd04b4f['push'](_0xd04b4f['shift']());}};_0x105dc1(++_0x58ffa8);}(_0x70e0,0x17b));var _0x070e=function(_0x37460e,_0x411eb2){_0x37460e=_0x37460e-0x0;var _0xd57da0=_0x70e0[_0x37460e];return _0xd57da0;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9006424..56b889e 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf318=['sequelize'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xf318,0x18d));var _0x8f31=function(_0x1ae834,_0xe9659c){_0x1ae834=_0x1ae834-0x0;var _0x52736b=_0xf318[_0x1ae834];return _0x52736b;};'use strict';var Sequelize=require(_0x8f31('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 4867b73..7896c7c 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 _0x632f=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x29231b,_0x30c95f){var _0xb65c00=function(_0x50e904){while(--_0x50e904){_0x29231b['push'](_0x29231b['shift']());}};_0xb65c00(++_0x30c95f);}(_0x632f,0xdc));var _0xf632=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x632f[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xf632('0x0'));var util=require('util');var logger=require(_0xf632('0x1'))(_0xf632('0x2'));var moment=require(_0xf632('0x3'));var BPromise=require(_0xf632('0x4'));var rp=require(_0xf632('0x5'));var fs=require('fs');var path=require(_0xf632('0x6'));var rimraf=require('rimraf');var config=require(_0xf632('0x7'));var attributes=require(_0xf632('0x8'));module[_0xf632('0x9')]=function(_0x17574e,_0x128686){return _0x17574e[_0xf632('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x721a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash'];(function(_0x1548c0,_0x21fbda){var _0x51bcc1=function(_0x2b6fb8){while(--_0x2b6fb8){_0x1548c0['push'](_0x1548c0['shift']());}};_0x51bcc1(++_0x21fbda);}(_0x721a,0x197));var _0xa721=function(_0x541926,_0x1cf19d){_0x541926=_0x541926-0x0;var _0x4c4754=_0x721a[_0x541926];return _0x4c4754;};'use strict';var _=require(_0xa721('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa721('0x1'));var moment=require(_0xa721('0x2'));var BPromise=require(_0xa721('0x3'));var rp=require(_0xa721('0x4'));var fs=require('fs');var path=require(_0xa721('0x5'));var rimraf=require(_0xa721('0x6'));var config=require(_0xa721('0x7'));var attributes=require(_0xa721('0x8'));module[_0xa721('0x9')]=function(_0x28f9b9,_0x55c4cf){return _0x28f9b9[_0xa721('0xa')](_0xa721('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 1b35b15..1b8a0e7 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x4dacd1,_0x498edb){var _0xe4321f=function(_0x5dd9c0){while(--_0x5dd9c0){_0x4dacd1['push'](_0x4dacd1['shift']());}};_0xe4321f(++_0x498edb);}(_0xe14b,0x93));var _0xbe14=function(_0x1ca840,_0x4acf63){_0x1ca840=_0x1ca840-0x0;var _0x240aae=_0xe14b[_0x1ca840];return _0x240aae;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x2f4d06,_0x5b338f){var _0x5c0730=function(_0x10c96e){while(--_0x10c96e){_0x2f4d06['push'](_0x2f4d06['shift']());}};_0x5c0730(++_0x5b338f);}(_0x55ca,0x126));var _0xa55c=function(_0x304c47,_0x4e0e20){_0x304c47=_0x304c47-0x0;var _0x2dbd2c=_0x55ca[_0x304c47];return _0x2dbd2c;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index aa7a770..55597e5 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 _0x097f=['express','fs-extra','../../components/auth/service','./userNotification.controller','post','isAuthenticated','exports','util','path','connect-timeout'];(function(_0x407071,_0x491886){var _0x53fcd7=function(_0x146279){while(--_0x146279){_0x407071['push'](_0x407071['shift']());}};_0x53fcd7(++_0x491886);}(_0x097f,0xc5));var _0xf097=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x097f[_0x55ff79];return _0x579067;};'use strict';var multer=require('multer');var util=require(_0xf097('0x0'));var path=require(_0xf097('0x1'));var timeout=require(_0xf097('0x2'));var express=require(_0xf097('0x3'));var router=express['Router']();var fs_extra=require(_0xf097('0x4'));var auth=require(_0xf097('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf097('0x6'));router[_0xf097('0x7')]('/',auth[_0xf097('0x8')](),controller['sendUserNotification']);module[_0xf097('0x9')]=router; \ No newline at end of file +var _0xf951=['sendUserNotification','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xf951,0xb6));var _0x1f95=function(_0x2d304d,_0x462fb5){_0x2d304d=_0x2d304d-0x0;var _0x16be9a=_0xf951[_0x2d304d];return _0x16be9a;};'use strict';var multer=require('multer');var util=require(_0x1f95('0x0'));var path=require(_0x1f95('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f95('0x2'));var router=express[_0x1f95('0x3')]();var fs_extra=require(_0x1f95('0x4'));var auth=require(_0x1f95('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1f95('0x6'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x1f95('0x7')](),controller[_0x1f95('0x8')]);module[_0x1f95('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7d1fed0..6aa7f8c 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 _0x9aae=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x1a8f15,_0x3711af){var _0x76f217=function(_0x188900){while(--_0x188900){_0x1a8f15['push'](_0x1a8f15['shift']());}};_0x76f217(++_0x3711af);}(_0x9aae,0x108));var _0xe9aa=function(_0xe00662,_0x51cf75){_0xe00662=_0xe00662-0x0;var _0x5ebbd8=_0x9aae[_0xe00662];return _0x5ebbd8;};'use strict';var Sequelize=require(_0xe9aa('0x0'));module[_0xe9aa('0x1')]={'body':{'type':Sequelize[_0xe9aa('0x2')]},'senderName':{'type':Sequelize[_0xe9aa('0x3')]},'recipientsId':{'type':Sequelize[_0xe9aa('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe9aa('0x3')]},'beep':{'type':Sequelize[_0xe9aa('0x4')]}}; \ No newline at end of file +var _0xef92=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0xfecb63,_0x486fc7){var _0x4ba065=function(_0x1df314){while(--_0x1df314){_0xfecb63['push'](_0xfecb63['shift']());}};_0x4ba065(++_0x486fc7);}(_0xef92,0x123));var _0x2ef9=function(_0x11596f,_0x2c9652){_0x11596f=_0x11596f-0x0;var _0x235607=_0xef92[_0x11596f];return _0x235607;};'use strict';var Sequelize=require(_0x2ef9('0x0'));module[_0x2ef9('0x1')]={'body':{'type':Sequelize[_0x2ef9('0x2')]},'senderName':{'type':Sequelize[_0x2ef9('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2ef9('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 40c998e..bfcb038 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 _0x0df0=['json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','queue','Queue','ids','push','all','findOne','map','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end'];(function(_0x4467dc,_0x10d02e){var _0x41f03f=function(_0x315638){while(--_0x315638){_0x4467dc['push'](_0x4467dc['shift']());}};_0x41f03f(++_0x10d02e);}(_0x0df0,0x1d0));var _0x00df=function(_0x36da00,_0x5b533b){_0x36da00=_0x36da00-0x0;var _0x4b72c5=_0x0df0[_0x36da00];return _0x4b72c5;};'use strict';var emlformat=require(_0x00df('0x0'));var rimraf=require(_0x00df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00df('0x2'));var rp=require(_0x00df('0x3'));var moment=require('moment');var BPromise=require(_0x00df('0x4'));var Mustache=require(_0x00df('0x5'));var util=require(_0x00df('0x6'));var path=require(_0x00df('0x7'));var sox=require(_0x00df('0x8'));var csv=require('to-csv');var ejs=require(_0x00df('0x9'));var fs=require('fs');var fs_extra=require(_0x00df('0xa'));var _=require(_0x00df('0xb'));var squel=require(_0x00df('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x00df('0xd'));var toCsv=require(_0x00df('0xe'));var querystring=require(_0x00df('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x00df('0x10'));var qs=require(_0x00df('0x11'));var as=require(_0x00df('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00df('0x13'))(_0x00df('0x14'));var utils=require(_0x00df('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x00df('0x16'))['db'];config[_0x00df('0x17')]=_[_0x00df('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x00df('0x19'))(new Redis(config[_0x00df('0x17')]));require(_0x00df('0x1a'))[_0x00df('0x1b')](socket);function respondWithStatusCode(_0x57231c,_0x21264b){_0x21264b=_0x21264b||0xcc;return function(_0x59fcfc){if(_0x59fcfc){return _0x57231c[_0x00df('0x1c')](_0x21264b);}return _0x57231c[_0x00df('0x1d')](_0x21264b)[_0x00df('0x1e')]();};}function respondWithResult(_0x1b5ed1,_0x5941fb){_0x5941fb=_0x5941fb||0xc8;return function(_0x114a61){if(_0x114a61){return _0x1b5ed1[_0x00df('0x1d')](_0x5941fb)[_0x00df('0x1f')](_0x114a61);}};}function respondWithFilteredResult(_0x1ce2be,_0x308e02){return function(_0xba48f5){if(_0xba48f5){var _0x2a45bf=typeof _0x308e02['offset']===_0x00df('0x20')&&typeof _0x308e02[_0x00df('0x21')]===_0x00df('0x20');var _0x446295=_0xba48f5[_0x00df('0x22')];var _0x524e49=_0x2a45bf?0x0:_0x308e02['offset'];var _0x26986d=_0x2a45bf?_0xba48f5[_0x00df('0x22')]:_0x308e02[_0x00df('0x23')]+_0x308e02[_0x00df('0x21')];var _0x4b44d5;if(_0x26986d>=_0x446295){_0x26986d=_0x446295;_0x4b44d5=0xc8;}else{_0x4b44d5=0xce;}_0x1ce2be[_0x00df('0x1d')](_0x4b44d5);return _0x1ce2be[_0x00df('0x24')](_0x00df('0x25'),_0x524e49+'-'+_0x26986d+'/'+_0x446295)[_0x00df('0x1f')](_0xba48f5);}return null;};}function patchUpdates(_0x545c8b){return function(_0x95d033){try{jsonpatch[_0x00df('0x26')](_0x95d033,_0x545c8b,!![]);}catch(_0x2f46fd){return BPromise['reject'](_0x2f46fd);}return _0x95d033[_0x00df('0x27')]();};}function saveUpdates(_0xcbdd0c,_0x20289e){return function(_0x499fba){if(_0x499fba){return _0x499fba[_0x00df('0x28')](_0xcbdd0c)['then'](function(_0x183f70){return _0x183f70;});}return null;};}function removeEntity(_0xd0632c,_0x34eed0){return function(_0x1e4121){if(_0x1e4121){return _0x1e4121[_0x00df('0x29')]()[_0x00df('0x2a')](function(){_0xd0632c[_0x00df('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ce97f,_0x254001){return function(_0x55624b){if(!_0x55624b){_0x3ce97f[_0x00df('0x1c')](0x194);}return _0x55624b;};}function handleError(_0x1a186a,_0x451605){_0x451605=_0x451605||0x1f4;return function(_0x3a9b8a){logger[_0x00df('0x2b')](_0x3a9b8a[_0x00df('0x2c')]);if(_0x3a9b8a[_0x00df('0x2d')]){delete _0x3a9b8a[_0x00df('0x2d')];}_0x1a186a[_0x00df('0x1d')](_0x451605)[_0x00df('0x2e')](_0x3a9b8a);};}exports[_0x00df('0x2f')]=function(_0x1375fe,_0x506a33,_0x5c1d3a){if(!_0x1375fe['body'][_0x00df('0x30')]('text')&&!_0x1375fe[_0x00df('0x31')][_0x00df('0x30')](_0x00df('0x32'))){throw new db['Sequelize'][(_0x00df('0x33'))](_0x00df('0x34'));}else{if(_0x1375fe[_0x00df('0x31')][_0x00df('0x30')](_0x00df('0x32'))&&!_0x1375fe['body'][_0x00df('0x30')](_0x00df('0x35'))){throw new db['Sequelize'][(_0x00df('0x33'))](_0x00df('0x36'));}if(!_0x1375fe['body'][_0x00df('0x30')](_0x00df('0x37'))){throw new db[(_0x00df('0x38'))]['ValidationError'](_0x00df('0x39'));}else{try{var _0x5607aa=JSON[_0x00df('0x3a')](_0x1375fe[_0x00df('0x31')]['recipients']);}catch(_0x4171d3){logger[_0x00df('0x2b')](_0x4171d3);throw new db[(_0x00df('0x38'))][(_0x00df('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x1b4dcd=[_0x00df('0x3b'),_0x00df('0x3c'),_0x00df('0x3d'),_0x00df('0x3e'),'smsqueue','voicequeue',_0x00df('0x3f'),_0x00df('0x40'),_0x00df('0x41')];if(_[_0x00df('0x42')](_0x5607aa,function(_0x201b74){return!_[_0x00df('0x43')](_0x1b4dcd,_0x201b74[_0x00df('0x44')][_0x00df('0x45')]());})){throw new db[(_0x00df('0x38'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5cd46f={};_0x5cd46f[_0x00df('0x46')]=_0x1375fe['body'][_0x00df('0x30')]('senderName')?_0x1375fe['body'][_0x00df('0x46')]:_0x1375fe[_0x00df('0x41')]['fullname'];_0x5cd46f[_0x00df('0x47')]=_[_0x00df('0x48')](_0x1375fe[_0x00df('0x31')][_0x00df('0x47')])?null:_0x1375fe[_0x00df('0x31')]['recipientsDescription'];_0x5cd46f[_0x00df('0x49')]=_0x1375fe[_0x00df('0x31')]['beep']||![];_0x5cd46f[_0x00df('0x4a')]=_0x1375fe[_0x00df('0x41')]['id'];return getContent(_0x1375fe['body'])[_0x00df('0x2a')](function(_0x53fd2c){_0x5cd46f[_0x00df('0x31')]=_0x53fd2c;return getRecipients(_0x5607aa);})[_0x00df('0x2a')](function(_0x27dda5){_0x5cd46f[_0x00df('0x4b')]=_[_0x00df('0x4c')](_0x27dda5)[_0x00df('0x4d')](',');return db[_0x00df('0x4e')][_0x00df('0x4f')](function(_0x4abb3c){return db[_0x00df('0x50')]['create'](_0x5cd46f,{'raw':!![],'transaction':_0x4abb3c})[_0x00df('0x2a')](function(_0x5747f8){var _0x433fb2={'sender':_0x5cd46f[_0x00df('0x46')],'description':_0x5cd46f[_0x00df('0x47')],'content':_0x5cd46f[_0x00df('0x31')],'beep':_0x5cd46f[_0x00df('0x49')]};_0x27dda5['forEach'](function(_0x36d19c){_0x433fb2[_0x00df('0x51')]=_0x36d19c;socket[_0x00df('0x52')](_0x00df('0x53'),_0x433fb2);});return _0x5747f8;});});})['then'](respondWithResult(_0x506a33,0xc9))[_0x00df('0x54')](handleError(_0x506a33,null));};function getContent(_0x5e88e3){return new BPromise(function(_0xbd8913,_0x35517d){if(_0x5e88e3[_0x00df('0x55')]){_0xbd8913(_0x5e88e3[_0x00df('0x55')]);return;}return db[_0x00df('0x56')]['findOne']({'attributes':[_0x00df('0x57')],'where':{'id':_0x5e88e3[_0x00df('0x32')]},'raw':!![]})[_0x00df('0x2a')](function(_0x12e439){if(!_0x12e439)throw new db[(_0x00df('0x38'))][(_0x00df('0x33'))](_0x00df('0x58'));var _0x163c60=Mustache[_0x00df('0x59')](_0x12e439[_0x00df('0x57')],_0x5e88e3[_0x00df('0x35')]);_0xbd8913(_0x163c60);})[_0x00df('0x54')](function(_0x4184fc){_0x35517d(_0x4184fc);});});}function getRecipients(_0x54f5b6){return new BPromise(function(_0x23b055,_0x2f02ae){var _0x2fee48=[];var _0x33cf48=[];_0x54f5b6[_0x00df('0x5a')](function(_0x1592a6){var _0x6b8277=_[_0x00df('0x5b')](_0x1592a6[_0x00df('0x44')]['toLowerCase']());if(_0x6b8277==='User'){_0x2fee48=_['union'](_0x2fee48,_0x1592a6['ids']);}else{if(_[_0x00df('0x43')](_0x6b8277,_0x00df('0x5c')))_0x6b8277=_0x6b8277['replace'](_0x00df('0x5c'),_0x00df('0x5d'));_0x1592a6[_0x00df('0x5e')][_0x00df('0x5a')](function(_0x460b4d){_0x33cf48[_0x00df('0x5f')](getAgents(_0x6b8277,_0x460b4d));});}});return BPromise[_0x00df('0x60')](_0x33cf48)[_0x00df('0x2a')](function(_0x3d6304){_0x2fee48=_['union'](_0x2fee48,_['flatten'](_0x3d6304));_0x23b055(_0x2fee48);})[_0x00df('0x54')](function(_0x49f7b9){_0x2f02ae(_0x49f7b9);});});}function getAgents(_0x3bc661,_0x28eafd){return new BPromise(function(_0x46c73d,_0x4160ec){return db[_0x3bc661][_0x00df('0x61')]({'where':{'id':_0x28eafd}})[_0x00df('0x2a')](function(_0x3e7676){return _0x3e7676['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x2ebe18){var _0x53cc92=_[_0x00df('0x62')](_0x2ebe18,'id');_0x46c73d(_0x53cc92);});})[_0x00df('0x54')](function(_0x102363){_0x4160ec(_0x102363);});});} \ No newline at end of file +var _0x3230=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','ids','replace','queue','Queue','push','all','flatten','findOne','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0xd908ff,_0x292d8f){var _0x41ddd2=function(_0xc1ec78){while(--_0xc1ec78){_0xd908ff['push'](_0xd908ff['shift']());}};_0x41ddd2(++_0x292d8f);}(_0x3230,0x121));var _0x0323=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3230[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x0323('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0323('0x1'));var jsonpatch=require(_0x0323('0x2'));var rp=require(_0x0323('0x3'));var moment=require('moment');var BPromise=require(_0x0323('0x4'));var Mustache=require(_0x0323('0x5'));var util=require(_0x0323('0x6'));var path=require(_0x0323('0x7'));var sox=require(_0x0323('0x8'));var csv=require(_0x0323('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0323('0xa'));var crypto=require(_0x0323('0xb'));var jsforce=require(_0x0323('0xc'));var deskjs=require(_0x0323('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0323('0xe'));var Redis=require(_0x0323('0xf'));var authService=require(_0x0323('0x10'));var qs=require(_0x0323('0x11'));var as=require(_0x0323('0x12'));var hardwareService=require(_0x0323('0x13'));var logger=require(_0x0323('0x14'))(_0x0323('0x15'));var utils=require('../../config/utils');var config=require(_0x0323('0x16'));var licenseUtil=require(_0x0323('0x17'));var db=require(_0x0323('0x18'))['db'];config[_0x0323('0x19')]=_[_0x0323('0x1a')](config[_0x0323('0x19')],{'host':_0x0323('0x1b'),'port':0x18eb});var socket=require(_0x0323('0x1c'))(new Redis(config[_0x0323('0x19')]));require(_0x0323('0x1d'))[_0x0323('0x1e')](socket);function respondWithStatusCode(_0x3eceb6,_0x4b49c3){_0x4b49c3=_0x4b49c3||0xcc;return function(_0x52677c){if(_0x52677c){return _0x3eceb6[_0x0323('0x1f')](_0x4b49c3);}return _0x3eceb6[_0x0323('0x20')](_0x4b49c3)['end']();};}function respondWithResult(_0x3b8647,_0x11b2dd){_0x11b2dd=_0x11b2dd||0xc8;return function(_0x5b93ba){if(_0x5b93ba){return _0x3b8647[_0x0323('0x20')](_0x11b2dd)[_0x0323('0x21')](_0x5b93ba);}};}function respondWithFilteredResult(_0x2e5711,_0x16a46b){return function(_0x27b9d7){if(_0x27b9d7){var _0x3fc722=typeof _0x16a46b[_0x0323('0x22')]===_0x0323('0x23')&&typeof _0x16a46b[_0x0323('0x24')]===_0x0323('0x23');var _0x2aecd3=_0x27b9d7[_0x0323('0x25')];var _0x57093e=_0x3fc722?0x0:_0x16a46b[_0x0323('0x22')];var _0x1080f6=_0x3fc722?_0x27b9d7[_0x0323('0x25')]:_0x16a46b[_0x0323('0x22')]+_0x16a46b[_0x0323('0x24')];var _0x1c99a8;if(_0x1080f6>=_0x2aecd3){_0x1080f6=_0x2aecd3;_0x1c99a8=0xc8;}else{_0x1c99a8=0xce;}_0x2e5711[_0x0323('0x20')](_0x1c99a8);return _0x2e5711[_0x0323('0x26')](_0x0323('0x27'),_0x57093e+'-'+_0x1080f6+'/'+_0x2aecd3)[_0x0323('0x21')](_0x27b9d7);}return null;};}function patchUpdates(_0x3df02a){return function(_0x285609){try{jsonpatch[_0x0323('0x28')](_0x285609,_0x3df02a,!![]);}catch(_0x1ba9c5){return BPromise[_0x0323('0x29')](_0x1ba9c5);}return _0x285609['save']();};}function saveUpdates(_0x4b3685,_0x29700f){return function(_0x16bc40){if(_0x16bc40){return _0x16bc40[_0x0323('0x2a')](_0x4b3685)['then'](function(_0x3a3a66){return _0x3a3a66;});}return null;};}function removeEntity(_0x27cece,_0x15e6fd){return function(_0x1f5a0a){if(_0x1f5a0a){return _0x1f5a0a[_0x0323('0x2b')]()[_0x0323('0x2c')](function(){_0x27cece[_0x0323('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d5ac,_0x3a8682){return function(_0x2fb5c3){if(!_0x2fb5c3){_0x13d5ac['sendStatus'](0x194);}return _0x2fb5c3;};}function handleError(_0x5801d6,_0x5acdbd){_0x5acdbd=_0x5acdbd||0x1f4;return function(_0x56c050){logger[_0x0323('0x2d')](_0x56c050['stack']);if(_0x56c050['name']){delete _0x56c050['name'];}_0x5801d6[_0x0323('0x20')](_0x5acdbd)[_0x0323('0x2e')](_0x56c050);};}exports[_0x0323('0x2f')]=function(_0x3e30ac,_0x2338e1,_0x15c8e9){if(!_0x3e30ac[_0x0323('0x30')][_0x0323('0x31')](_0x0323('0x32'))&&!_0x3e30ac[_0x0323('0x30')][_0x0323('0x31')](_0x0323('0x33'))){throw new db[(_0x0323('0x34'))]['ValidationError'](_0x0323('0x35'));}else{if(_0x3e30ac[_0x0323('0x30')]['hasOwnProperty'](_0x0323('0x33'))&&!_0x3e30ac[_0x0323('0x30')][_0x0323('0x31')](_0x0323('0x36'))){throw new db['Sequelize'][(_0x0323('0x37'))](_0x0323('0x38'));}if(!_0x3e30ac[_0x0323('0x30')][_0x0323('0x31')](_0x0323('0x39'))){throw new db[(_0x0323('0x34'))][(_0x0323('0x37'))](_0x0323('0x3a'));}else{try{var _0x42126d=JSON['parse'](_0x3e30ac['body']['recipients']);}catch(_0x412b2a){logger[_0x0323('0x2d')](_0x412b2a);throw new db[(_0x0323('0x34'))][(_0x0323('0x37'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x19da54=[_0x0323('0x3b'),_0x0323('0x3c'),_0x0323('0x3d'),_0x0323('0x3e'),_0x0323('0x3f'),_0x0323('0x40'),_0x0323('0x41'),'team',_0x0323('0x42')];if(_[_0x0323('0x43')](_0x42126d,function(_0x3afdf8){return!_[_0x0323('0x44')](_0x19da54,_0x3afdf8[_0x0323('0x45')][_0x0323('0x46')]());})){throw new db[(_0x0323('0x34'))][(_0x0323('0x37'))](_0x0323('0x47'));}}}var _0x208281={};_0x208281[_0x0323('0x48')]=_0x3e30ac['body'][_0x0323('0x31')](_0x0323('0x48'))?_0x3e30ac[_0x0323('0x30')][_0x0323('0x48')]:_0x3e30ac[_0x0323('0x42')][_0x0323('0x49')];_0x208281[_0x0323('0x4a')]=_[_0x0323('0x4b')](_0x3e30ac[_0x0323('0x30')]['recipientsDescription'])?null:_0x3e30ac[_0x0323('0x30')][_0x0323('0x4a')];_0x208281['beep']=_0x3e30ac[_0x0323('0x30')][_0x0323('0x4c')]||![];_0x208281['SenderId']=_0x3e30ac[_0x0323('0x42')]['id'];return getContent(_0x3e30ac[_0x0323('0x30')])['then'](function(_0x2edec2){_0x208281[_0x0323('0x30')]=_0x2edec2;return getRecipients(_0x42126d);})[_0x0323('0x2c')](function(_0x6ebbb7){_0x208281['recipientsId']=_[_0x0323('0x4d')](_0x6ebbb7)[_0x0323('0x4e')](',');return db[_0x0323('0x4f')][_0x0323('0x50')](function(_0x32c082){return db['UserNotification'][_0x0323('0x51')](_0x208281,{'raw':!![],'transaction':_0x32c082})[_0x0323('0x2c')](function(_0x536cb4){var _0x5694fd={'sender':_0x208281['senderName'],'description':_0x208281[_0x0323('0x4a')],'content':_0x208281[_0x0323('0x30')],'beep':_0x208281[_0x0323('0x4c')]};_0x6ebbb7[_0x0323('0x52')](function(_0x1022c2){_0x5694fd[_0x0323('0x53')]=_0x1022c2;socket[_0x0323('0x54')]('userNotification:send',_0x5694fd);});return _0x536cb4;});});})['then'](respondWithResult(_0x2338e1,0xc9))['catch'](handleError(_0x2338e1,null));};function getContent(_0x1915bb){return new BPromise(function(_0x368e9f,_0x7f311f){if(_0x1915bb[_0x0323('0x32')]){_0x368e9f(_0x1915bb[_0x0323('0x32')]);return;}return db[_0x0323('0x55')]['findOne']({'attributes':[_0x0323('0x56')],'where':{'id':_0x1915bb[_0x0323('0x33')]},'raw':!![]})[_0x0323('0x2c')](function(_0x292ab6){if(!_0x292ab6)throw new db['Sequelize'][(_0x0323('0x37'))](_0x0323('0x57'));var _0x4bbdd2=Mustache[_0x0323('0x58')](_0x292ab6[_0x0323('0x56')],_0x1915bb['view']);_0x368e9f(_0x4bbdd2);})[_0x0323('0x59')](function(_0x276f22){_0x7f311f(_0x276f22);});});}function getRecipients(_0x756fe9){return new BPromise(function(_0x4951fd,_0x454c48){var _0x2b8619=[];var _0x386a31=[];_0x756fe9[_0x0323('0x52')](function(_0x1aa02b){var _0x320d30=_[_0x0323('0x5a')](_0x1aa02b[_0x0323('0x45')][_0x0323('0x46')]());if(_0x320d30===_0x0323('0x5b')){_0x2b8619=_[_0x0323('0x5c')](_0x2b8619,_0x1aa02b[_0x0323('0x5d')]);}else{if(_[_0x0323('0x44')](_0x320d30,'queue'))_0x320d30=_0x320d30[_0x0323('0x5e')](_0x0323('0x5f'),_0x0323('0x60'));_0x1aa02b[_0x0323('0x5d')]['forEach'](function(_0x2c8e16){_0x386a31[_0x0323('0x61')](getAgents(_0x320d30,_0x2c8e16));});}});return BPromise[_0x0323('0x62')](_0x386a31)[_0x0323('0x2c')](function(_0x220699){_0x2b8619=_[_0x0323('0x5c')](_0x2b8619,_[_0x0323('0x63')](_0x220699));_0x4951fd(_0x2b8619);})[_0x0323('0x59')](function(_0x350906){_0x454c48(_0x350906);});});}function getAgents(_0x1a0ca4,_0x20efa5){return new BPromise(function(_0x36cdf2,_0x51f759){return db[_0x1a0ca4][_0x0323('0x64')]({'where':{'id':_0x20efa5}})[_0x0323('0x2c')](function(_0x254619){return _0x254619[_0x0323('0x65')]({'attributes':['id'],'raw':!![]})[_0x0323('0x2c')](function(_0x46ddb6){var _0x357bfe=_['map'](_0x46ddb6,'id');_0x36cdf2(_0x357bfe);});})[_0x0323('0x59')](function(_0x109006){_0x51f759(_0x109006);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f82de62..60cec3f 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 _0x8149=['hasOwnProperty','exports','events','../../mysqldb','UserNotification','save','update','remove','emit'];(function(_0x24d77f,_0x68202b){var _0x1c2063=function(_0x220c98){while(--_0x220c98){_0x24d77f['push'](_0x24d77f['shift']());}};_0x1c2063(++_0x68202b);}(_0x8149,0x107));var _0x9814=function(_0x59f2db,_0x1f935f){_0x59f2db=_0x59f2db-0x0;var _0x5ba49f=_0x8149[_0x59f2db];return _0x5ba49f;};'use strict';var EventEmitter=require(_0x9814('0x0'));var UserNotification=require(_0x9814('0x1'))['db'][_0x9814('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9814('0x3'),'afterUpdate':_0x9814('0x4'),'afterDestroy':_0x9814('0x5')};function emitEvent(_0x33b265){return function(_0x4380e9,_0x4d23a0,_0x26de8){UserNotificationEvents[_0x9814('0x6')](_0x33b265+':'+_0x4380e9['id'],_0x4380e9);UserNotificationEvents['emit'](_0x33b265,_0x4380e9);_0x26de8(null);};}for(var e in events){if(events[_0x9814('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9814('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xbb13=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x48b6b0,_0x45bc12){var _0x40f4be=function(_0x48bab8){while(--_0x48bab8){_0x48b6b0['push'](_0x48b6b0['shift']());}};_0x40f4be(++_0x45bc12);}(_0xbb13,0xe3));var _0x3bb1=function(_0x31c75a,_0x39089d){_0x31c75a=_0x31c75a-0x0;var _0x11a8f7=_0xbb13[_0x31c75a];return _0x11a8f7;};'use strict';var EventEmitter=require(_0x3bb1('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3bb1('0x1')](0x0);var events={'afterCreate':_0x3bb1('0x2'),'afterUpdate':_0x3bb1('0x3'),'afterDestroy':_0x3bb1('0x4')};function emitEvent(_0x35e2a3){return function(_0x311ad6,_0x29eb92,_0x3f99b6){UserNotificationEvents['emit'](_0x35e2a3+':'+_0x311ad6['id'],_0x311ad6);UserNotificationEvents['emit'](_0x35e2a3,_0x311ad6);_0x3f99b6(null);};}for(var e in events){if(events[_0x3bb1('0x5')](e)){var event=events[e];UserNotification[_0x3bb1('0x6')](e,emitEvent(event));}}module[_0x3bb1('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 7de6fb0..4bfa1fb 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 _0x240e=['util','../../config/logger','api','moment','bluebird','request-promise','path','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x18de46,_0x15e5fe){var _0x1546d7=function(_0x58ab66){while(--_0x58ab66){_0x18de46['push'](_0x18de46['shift']());}};_0x1546d7(++_0x15e5fe);}(_0x240e,0x12b));var _0xe240=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x240e[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0xe240('0x0'));var logger=require(_0xe240('0x1'))(_0xe240('0x2'));var moment=require(_0xe240('0x3'));var BPromise=require(_0xe240('0x4'));var rp=require(_0xe240('0x5'));var fs=require('fs');var path=require(_0xe240('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe240('0x7'));module[_0xe240('0x8')]=function(_0x390b9d,_0x1cf75){return _0x390b9d[_0xe240('0x9')]('UserNotification',attributes,{'tableName':_0xe240('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe240('0xb'),'collate':_0xe240('0xc')});}; \ No newline at end of file +var _0x52ae=['lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','utf8mb4','utf8mb4_unicode_ci'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x52ae,0xc0));var _0xe52a=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x52ae[_0x5ff517];return _0x19a245;};'use strict';var _=require(_0xe52a('0x0'));var util=require(_0xe52a('0x1'));var logger=require(_0xe52a('0x2'))('api');var moment=require(_0xe52a('0x3'));var BPromise=require(_0xe52a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe52a('0x5'));var config=require(_0xe52a('0x6'));var attributes=require(_0xe52a('0x7'));module['exports']=function(_0x297ac3,_0x2468a0){return _0x297ac3[_0xe52a('0x8')](_0xe52a('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe52a('0xa'),'collate':_0xe52a('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index da5d210..0ddcd05 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 _0x9802=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x3f9320,_0x3c85d9){var _0x31b557=function(_0x2d3125){while(--_0x2d3125){_0x3f9320['push'](_0x3f9320['shift']());}};_0x31b557(++_0x3c85d9);}(_0x9802,0x9d));var _0x2980=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x9802[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x2980('0x0'));var util=require(_0x2980('0x1'));var moment=require(_0x2980('0x2'));var BPromise=require(_0x2980('0x3'));var rs=require(_0x2980('0x4'));var fs=require('fs');var Redis=require(_0x2980('0x5'));var db=require(_0x2980('0x6'))['db'];var utils=require(_0x2980('0x7'));var logger=require(_0x2980('0x8'))(_0x2980('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2980('0xa')][_0x2980('0xb')]({'port':0x232a});config[_0x2980('0xc')]=_[_0x2980('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2980('0xe'))(new Redis(config[_0x2980('0xc')]));require(_0x2980('0xf'))[_0x2980('0x10')](socket);function respondWithRpcPromise(_0x279bf8,_0x213418,_0x349d85){return new BPromise(function(_0x299b8c,_0x9b59f1){return client[_0x2980('0x11')](_0x279bf8,_0x349d85)[_0x2980('0x12')](function(_0x1f3255){logger['info'](_0x2980('0x13'),_0x213418,_0x2980('0x14'));logger[_0x2980('0x15')](_0x2980('0x16'),_0x213418,_0x2980('0x14'),JSON[_0x2980('0x17')](_0x1f3255));if(_0x1f3255[_0x2980('0x18')]){if(_0x1f3255[_0x2980('0x18')][_0x2980('0x19')]===0x1f4){logger[_0x2980('0x18')]('UserNotification,\x20%s,\x20%s',_0x213418,_0x1f3255[_0x2980('0x18')][_0x2980('0x1a')]);return _0x9b59f1(_0x1f3255[_0x2980('0x18')]['message']);}logger['error'](_0x2980('0x13'),_0x213418,_0x1f3255['error'][_0x2980('0x1a')]);return _0x299b8c(_0x1f3255[_0x2980('0x18')][_0x2980('0x1a')]);}else{logger[_0x2980('0x1b')](_0x2980('0x13'),_0x213418,_0x2980('0x14'));_0x299b8c(_0x1f3255[_0x2980('0x1c')]['message']);}})[_0x2980('0x1d')](function(_0x1fcd47){logger[_0x2980('0x18')](_0x2980('0x13'),_0x213418,_0x1fcd47);_0x9b59f1(_0x1fcd47);});});} \ No newline at end of file +var _0xe3e1=['UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','defaults','localhost','redis','./userNotification.socket','register','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3e1,0x178));var _0x1e3e=function(_0x32d308,_0x53c67d){_0x32d308=_0x32d308-0x0;var _0x1b800f=_0xe3e1[_0x32d308];return _0x1b800f;};'use strict';var _=require('lodash');var util=require(_0x1e3e('0x0'));var moment=require(_0x1e3e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e3e('0x2'));var fs=require('fs');var Redis=require(_0x1e3e('0x3'));var db=require(_0x1e3e('0x4'))['db'];var utils=require(_0x1e3e('0x5'));var logger=require(_0x1e3e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1e3e('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x1e3e('0x8')](config['redis'],{'host':_0x1e3e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e3e('0xa')]));require(_0x1e3e('0xb'))[_0x1e3e('0xc')](socket);function respondWithRpcPromise(_0x3dd777,_0x7b1da7,_0x3a94b8){return new BPromise(function(_0x339c7,_0x188f2c){return client['request'](_0x3dd777,_0x3a94b8)[_0x1e3e('0xd')](function(_0x4b5cee){logger[_0x1e3e('0xe')](_0x1e3e('0xf'),_0x7b1da7,_0x1e3e('0x10'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x7b1da7,_0x1e3e('0x10'),JSON[_0x1e3e('0x11')](_0x4b5cee));if(_0x4b5cee[_0x1e3e('0x12')]){if(_0x4b5cee[_0x1e3e('0x12')][_0x1e3e('0x13')]===0x1f4){logger[_0x1e3e('0x12')](_0x1e3e('0xf'),_0x7b1da7,_0x4b5cee[_0x1e3e('0x12')][_0x1e3e('0x14')]);return _0x188f2c(_0x4b5cee[_0x1e3e('0x12')][_0x1e3e('0x14')]);}logger[_0x1e3e('0x12')](_0x1e3e('0xf'),_0x7b1da7,_0x4b5cee['error']['message']);return _0x339c7(_0x4b5cee[_0x1e3e('0x12')][_0x1e3e('0x14')]);}else{logger['info'](_0x1e3e('0xf'),_0x7b1da7,_0x1e3e('0x10'));_0x339c7(_0x4b5cee[_0x1e3e('0x15')][_0x1e3e('0x14')]);}})[_0x1e3e('0x16')](function(_0x3bd0cc){logger[_0x1e3e('0x12')](_0x1e3e('0xf'),_0x7b1da7,_0x3bd0cc);_0x188f2c(_0x3bd0cc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 18bc304..8b1d74f 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 _0x78e1=['length','userNotification:','./userNotification.events','save','update','removeListener','register'];(function(_0x349823,_0x380ae9){var _0x3ce632=function(_0x111988){while(--_0x111988){_0x349823['push'](_0x349823['shift']());}};_0x3ce632(++_0x380ae9);}(_0x78e1,0x11a));var _0x178e=function(_0x1c7167,_0xf0d493){_0x1c7167=_0x1c7167-0x0;var _0xe332e2=_0x78e1[_0x1c7167];return _0xe332e2;};'use strict';var UserNotificationEvents=require(_0x178e('0x0'));var events=[_0x178e('0x1'),'remove',_0x178e('0x2')];function createListener(_0x981f23,_0x196d35){return function(_0x21cb86){_0x196d35['emit'](_0x981f23,_0x21cb86);};}function removeListener(_0x2efa28,_0x4fbe61){return function(){UserNotificationEvents[_0x178e('0x3')](_0x2efa28,_0x4fbe61);};}exports[_0x178e('0x4')]=function(_0x365395){for(var _0x5e3853=0x0,_0x14c928=events[_0x178e('0x5')];_0x5e3853<_0x14c928;_0x5e3853++){var _0x7f9c9a=events[_0x5e3853];var _0x5da1c5=createListener(_0x178e('0x6')+_0x7f9c9a,_0x365395);UserNotificationEvents['on'](_0x7f9c9a,_0x5da1c5);}}; \ No newline at end of file +var _0xd26f=['update','emit','removeListener','./userNotification.events','save','remove'];(function(_0xc676e9,_0x36d662){var _0x55ba34=function(_0x1da0b4){while(--_0x1da0b4){_0xc676e9['push'](_0xc676e9['shift']());}};_0x55ba34(++_0x36d662);}(_0xd26f,0x81));var _0xfd26=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd26f[_0x3bf83f];return _0x22c4a9;};'use strict';var UserNotificationEvents=require(_0xfd26('0x0'));var events=[_0xfd26('0x1'),_0xfd26('0x2'),_0xfd26('0x3')];function createListener(_0x2b2b99,_0x247c7a){return function(_0x191f4f){_0x247c7a[_0xfd26('0x4')](_0x2b2b99,_0x191f4f);};}function removeListener(_0x50d2d6,_0xef0314){return function(){UserNotificationEvents[_0xfd26('0x5')](_0x50d2d6,_0xef0314);};}exports['register']=function(_0x1f2d69){for(var _0x7ae95f=0x0,_0xf04182=events['length'];_0x7ae95f<_0xf04182;_0x7ae95f++){var _0x112875=events[_0x7ae95f];var _0x453ca5=createListener('userNotification:'+_0x112875,_0x1f2d69);UserNotificationEvents['on'](_0x112875,_0x453ca5);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c905121..eca0a7e 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xf32355,_0xd4d4a){var _0x5ce960=function(_0x48ebee){while(--_0x48ebee){_0xf32355['push'](_0xf32355['shift']());}};_0x5ce960(++_0xd4d4a);}(_0x70e0,0x17b));var _0x070e=function(_0x2c7e33,_0x303e50){_0x2c7e33=_0x2c7e33-0x0;var _0x430158=_0x70e0[_0x2c7e33];return _0x430158;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f8258,_0x13f264){var _0x458e1e=function(_0x592cf7){while(--_0x592cf7){_0x2f8258['push'](_0x2f8258['shift']());}};_0x458e1e(++_0x13f264);}(_0xe706,0xa3));var _0x6e70=function(_0x41a3af,_0x5b49fb){_0x41a3af=_0x41a3af-0x0;var _0x5698f0=_0xe706[_0x41a3af];return _0x5698f0;};'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 6a48f1c..14dc333 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 _0xef6d=['exports','INTEGER'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xef6d,0x12c));var _0xdef6=function(_0x28ac78,_0x4c9641){_0x28ac78=_0x28ac78-0x0;var _0x55227f=_0xef6d[_0x28ac78];return _0x55227f;};'use strict';var Sequelize=require('sequelize');module[_0xdef6('0x0')]={'penalty':{'type':Sequelize[_0xdef6('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x192f=['exports','INTEGER','sequelize'];(function(_0x1e44a4,_0x4040bf){var _0x3b75c6=function(_0x1e7429){while(--_0x1e7429){_0x1e44a4['push'](_0x1e44a4['shift']());}};_0x3b75c6(++_0x4040bf);}(_0x192f,0x19a));var _0xf192=function(_0x2c7076,_0x1e7b51){_0x2c7076=_0x2c7076-0x0;var _0x514fb8=_0x192f[_0x2c7076];return _0x514fb8;};'use strict';var Sequelize=require(_0xf192('0x0'));module[_0xf192('0x1')]={'penalty':{'type':Sequelize[_0xf192('0x2')],'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 eff5b34..47fe166 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 _0x186e=['request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','api','moment','bluebird'];(function(_0xa385fe,_0x311337){var _0x8f16a3=function(_0x2f75d3){while(--_0x2f75d3){_0xa385fe['push'](_0xa385fe['shift']());}};_0x8f16a3(++_0x311337);}(_0x186e,0x128));var _0xe186=function(_0x2643a1,_0x47a4a3){_0x2643a1=_0x2643a1-0x0;var _0x57e909=_0x186e[_0x2643a1];return _0x57e909;};'use strict';var _=require('lodash');var util=require(_0xe186('0x0'));var logger=require('../../config/logger')(_0xe186('0x1'));var moment=require(_0xe186('0x2'));var BPromise=require(_0xe186('0x3'));var rp=require(_0xe186('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe186('0x5'));var config=require(_0xe186('0x6'));var attributes=require(_0xe186('0x7'));module[_0xe186('0x8')]=function(_0x30f7b7,_0x514db3){return _0x30f7b7[_0xe186('0x9')](_0xe186('0xa'),attributes,{'tableName':_0xe186('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f4=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0xf4f4,0x1d4));var _0x4f4f=function(_0x4ff949,_0x5c45e2){_0x4ff949=_0x4ff949-0x0;var _0x363fe9=_0xf4f4[_0x4ff949];return _0x363fe9;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require(_0x4f4f('0x2'))(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require('bluebird');var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require(_0x4f4f('0x7'));var config=require(_0x4f4f('0x8'));var attributes=require(_0x4f4f('0x9'));module['exports']=function(_0x3e9c9d,_0x1622d5){return _0x3e9c9d[_0x4f4f('0xa')](_0x4f4f('0xb'),attributes,{'tableName':_0x4f4f('0xc'),'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 6192e79..365b917 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 _0x92f5=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3203b8,_0x7d5ec8){var _0x2c4512=function(_0x7606c2){while(--_0x7606c2){_0x3203b8['push'](_0x3203b8['shift']());}};_0x2c4512(++_0x7d5ec8);}(_0x92f5,0x8b));var _0x592f=function(_0x4fb955,_0x481977){_0x4fb955=_0x4fb955-0x0;var _0x4f9797=_0x92f5[_0x4fb955];return _0x4f9797;};'use strict';var _=require(_0x592f('0x0'));var util=require(_0x592f('0x1'));var moment=require(_0x592f('0x2'));var BPromise=require(_0x592f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x592f('0x4'));var logger=require(_0x592f('0x5'))('rpc');var config=require(_0x592f('0x6'));var jayson=require(_0x592f('0x7'));var client=jayson[_0x592f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1585dc,_0x183a2f,_0x3e099d){return new BPromise(function(_0x5d5779,_0x245524){return client['request'](_0x1585dc,_0x3e099d)[_0x592f('0x9')](function(_0x160b67){logger['info'](_0x592f('0xa'),_0x183a2f,_0x592f('0xb'));logger['debug'](_0x592f('0xc'),_0x183a2f,_0x592f('0xb'),JSON[_0x592f('0xd')](_0x160b67));if(_0x160b67[_0x592f('0xe')]){if(_0x160b67[_0x592f('0xe')]['code']===0x1f4){logger[_0x592f('0xe')](_0x592f('0xa'),_0x183a2f,_0x160b67[_0x592f('0xe')]['message']);return _0x245524(_0x160b67[_0x592f('0xe')][_0x592f('0xf')]);}logger[_0x592f('0xe')](_0x592f('0xa'),_0x183a2f,_0x160b67[_0x592f('0xe')][_0x592f('0xf')]);return _0x5d5779(_0x160b67[_0x592f('0xe')][_0x592f('0xf')]);}else{logger[_0x592f('0x10')](_0x592f('0xa'),_0x183a2f,_0x592f('0xb'));_0x5d5779(_0x160b67[_0x592f('0x11')][_0x592f('0xf')]);}})[_0x592f('0x12')](function(_0x3256e2){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x183a2f,_0x3256e2);_0x245524(_0x3256e2);});});} \ No newline at end of file +var _0xd955=['jayson/promise','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserOpenchannelQueue,\x20%s,\x20%s','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc51378,_0x3b04e4){var _0x40cefc=function(_0xd52ce7){while(--_0xd52ce7){_0xc51378['push'](_0xc51378['shift']());}};_0x40cefc(++_0x3b04e4);}(_0xd955,0x152));var _0x5d95=function(_0x16e36b,_0x4ee944){_0x16e36b=_0x16e36b-0x0;var _0x3d10e7=_0xd955[_0x16e36b];return _0x3d10e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5d95('0x0'));var BPromise=require('bluebird');var rs=require(_0x5d95('0x1'));var fs=require('fs');var Redis=require(_0x5d95('0x2'));var db=require(_0x5d95('0x3'))['db'];var utils=require(_0x5d95('0x4'));var logger=require(_0x5d95('0x5'))(_0x5d95('0x6'));var config=require('../../config/environment');var jayson=require(_0x5d95('0x7'));var client=jayson[_0x5d95('0x8')][_0x5d95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x561d5c,_0x4261a4,_0x3ec725){return new BPromise(function(_0x20d876,_0x563b80){return client[_0x5d95('0xa')](_0x561d5c,_0x3ec725)[_0x5d95('0xb')](function(_0x46a2d9){logger[_0x5d95('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4261a4,_0x5d95('0xd'));logger[_0x5d95('0xe')](_0x5d95('0xf'),_0x4261a4,_0x5d95('0xd'),JSON[_0x5d95('0x10')](_0x46a2d9));if(_0x46a2d9['error']){if(_0x46a2d9['error'][_0x5d95('0x11')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4261a4,_0x46a2d9[_0x5d95('0x12')][_0x5d95('0x13')]);return _0x563b80(_0x46a2d9['error'][_0x5d95('0x13')]);}logger[_0x5d95('0x12')](_0x5d95('0x14'),_0x4261a4,_0x46a2d9[_0x5d95('0x12')][_0x5d95('0x13')]);return _0x20d876(_0x46a2d9[_0x5d95('0x12')][_0x5d95('0x13')]);}else{logger[_0x5d95('0xc')](_0x5d95('0x14'),_0x4261a4,_0x5d95('0xd'));_0x20d876(_0x46a2d9[_0x5d95('0x15')][_0x5d95('0x13')]);}})[_0x5d95('0x16')](function(_0xc26c04){logger[_0x5d95('0x12')](_0x5d95('0x14'),_0x4261a4,_0xc26c04);_0x563b80(_0xc26c04);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 90e5c42..e0f85ac 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 _0xf3a7=['get','/describe','describe','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index'];(function(_0x73ea6d,_0x57d5bd){var _0x4c3a66=function(_0xb3ffd1){while(--_0xb3ffd1){_0x73ea6d['push'](_0x73ea6d['shift']());}};_0x4c3a66(++_0x57d5bd);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7f3a('0x0'));var path=require(_0x7f3a('0x1'));var timeout=require(_0x7f3a('0x2'));var express=require(_0x7f3a('0x3'));var router=express[_0x7f3a('0x4')]();var fs_extra=require(_0x7f3a('0x5'));var auth=require(_0x7f3a('0x6'));var interaction=require(_0x7f3a('0x7'));var config=require(_0x7f3a('0x8'));var controller=require(_0x7f3a('0x9'));router['get']('/',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xb')]);router[_0x7f3a('0xc')](_0x7f3a('0xd'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xe')]);router[_0x7f3a('0xc')]('/:id',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xf')]);router['get']('/:id/sections',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x10')]);router['get'](_0x7f3a('0x11'),auth['isAuthenticated'](),controller[_0x7f3a('0x12')]);router['post']('/',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x13')]);router[_0x7f3a('0x14')](_0x7f3a('0x15'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x16')]);router[_0x7f3a('0x14')](_0x7f3a('0x17'),auth[_0x7f3a('0xa')](),controller['addSections']);router[_0x7f3a('0x14')]('/:id/resources',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x18')]);router[_0x7f3a('0x19')](_0x7f3a('0x1a'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1b')]);router[_0x7f3a('0x1c')]('/:id',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1d')]);router['delete'](_0x7f3a('0x17'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1e')]);router[_0x7f3a('0x1c')]('/:id/resources',auth['isAuthenticated'](),controller[_0x7f3a('0x1f')]);module[_0x7f3a('0x20')]=router; \ No newline at end of file +var _0x8546=['path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','removeSections','exports','multer'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8546,0x6b));var _0x6854=function(_0x42bcce,_0x241eda){_0x42bcce=_0x42bcce-0x0;var _0x54a43c=_0x8546[_0x42bcce];return _0x54a43c;};'use strict';var multer=require(_0x6854('0x0'));var util=require('util');var path=require(_0x6854('0x1'));var timeout=require('connect-timeout');var express=require(_0x6854('0x2'));var router=express[_0x6854('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6854('0x4'));var config=require(_0x6854('0x5'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x6854('0x6')](),controller[_0x6854('0x7')]);router[_0x6854('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6854('0x9')]);router[_0x6854('0x8')](_0x6854('0xa'),auth[_0x6854('0x6')](),controller[_0x6854('0xb')]);router[_0x6854('0x8')](_0x6854('0xc'),auth[_0x6854('0x6')](),controller[_0x6854('0xd')]);router[_0x6854('0x8')](_0x6854('0xe'),auth[_0x6854('0x6')](),controller[_0x6854('0xf')]);router[_0x6854('0x10')]('/',auth['isAuthenticated'](),controller[_0x6854('0x11')]);router[_0x6854('0x10')](_0x6854('0x12'),auth[_0x6854('0x6')](),controller['clone']);router[_0x6854('0x10')]('/:id/sections',auth[_0x6854('0x6')](),controller[_0x6854('0x13')]);router[_0x6854('0x10')](_0x6854('0xe'),auth[_0x6854('0x6')](),controller[_0x6854('0x14')]);router[_0x6854('0x15')](_0x6854('0xa'),auth[_0x6854('0x6')](),controller[_0x6854('0x16')]);router[_0x6854('0x17')](_0x6854('0xa'),auth['isAuthenticated'](),controller[_0x6854('0x18')]);router[_0x6854('0x17')](_0x6854('0xc'),auth[_0x6854('0x6')](),controller[_0x6854('0x19')]);router[_0x6854('0x17')](_0x6854('0xe'),auth['isAuthenticated'](),controller['removeResources']);module[_0x6854('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4121cdc..5329886 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 _0x54fb=['name','crudPermissions','getDataValue','BOOLEAN','sequelize','STRING'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x54fb,0x124));var _0xb54f=function(_0x2af3e7,_0x46f551){_0x2af3e7=_0x2af3e7-0x0;var _0xc28eb8=_0x54fb[_0x2af3e7];return _0xc28eb8;};'use strict';var Sequelize=require(_0xb54f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb54f('0x1')],'allowNull':![],'unique':_0xb54f('0x2')},'crudPermissions':{'type':Sequelize[_0xb54f('0x1')],'set':function(_0x1793b1){this['setDataValue'](_0xb54f('0x3'),_0x1793b1?_0x1793b1['join'](''):[]);},'get':function(){return this[_0xb54f('0x4')]('crudPermissions')?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb54f('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb54f('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe0ac=['BOOLEAN','sequelize','setDataValue','crudPermissions','getDataValue','split','STRING'];(function(_0x4c060b,_0x4c5e75){var _0x5b9790=function(_0x32e525){while(--_0x32e525){_0x4c060b['push'](_0x4c060b['shift']());}};_0x5b9790(++_0x4c5e75);}(_0xe0ac,0x1f2));var _0xce0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0ac[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xce0a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x194cdd){this[_0xce0a('0x1')](_0xce0a('0x2'),_0x194cdd?_0x194cdd['join'](''):[]);},'get':function(){return this[_0xce0a('0x3')](_0xce0a('0x2'))?this[_0xce0a('0x3')]('crudPermissions')[_0xce0a('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xce0a('0x5')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xce0a('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xce0a('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xce0a('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xce0a('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xce0a('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xce0a('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2f7d9dd..6c9fd75 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 _0xb39a=['create','clone','omit','createdAt','crudPermissions','body','updatedAt','sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','find','describe','addSections','push','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','UserProfile','findAll','rows','catch','show','params','keys','include'];(function(_0xc3cc9e,_0x4cbdab){var _0x8e4267=function(_0x242aca){while(--_0x242aca){_0xc3cc9e['push'](_0xc3cc9e['shift']());}};_0x8e4267(++_0x4cbdab);}(_0xb39a,0x186));var _0xab39=function(_0x466bfd,_0x56f4bb){_0x466bfd=_0x466bfd-0x0;var _0x29293d=_0xb39a[_0x466bfd];return _0x29293d;};'use strict';var emlformat=require(_0xab39('0x0'));var rimraf=require(_0xab39('0x1'));var zipdir=require(_0xab39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab39('0x3'));var moment=require(_0xab39('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab39('0x5'));var util=require(_0xab39('0x6'));var path=require(_0xab39('0x7'));var sox=require('sox');var csv=require(_0xab39('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab39('0x9'));var _=require(_0xab39('0xa'));var squel=require(_0xab39('0xb'));var crypto=require(_0xab39('0xc'));var jsforce=require(_0xab39('0xd'));var deskjs=require(_0xab39('0xe'));var toCsv=require(_0xab39('0x8'));var querystring=require(_0xab39('0xf'));var Papa=require('papaparse');var Redis=require(_0xab39('0x10'));var authService=require(_0xab39('0x11'));var qs=require(_0xab39('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab39('0x13'));var logger=require('../../config/logger')(_0xab39('0x14'));var utils=require(_0xab39('0x15'));var config=require(_0xab39('0x16'));var licenseUtil=require(_0xab39('0x17'));var db=require(_0xab39('0x18'))['db'];config[_0xab39('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xab39('0x1a'))(new Redis(config[_0xab39('0x19')]));require(_0xab39('0x1b'))[_0xab39('0x1c')](socket);function respondWithStatusCode(_0xe4632c,_0x119ec9){_0x119ec9=_0x119ec9||0xcc;return function(_0x55eb01){if(_0x55eb01){return _0xe4632c[_0xab39('0x1d')](_0x119ec9);}return _0xe4632c[_0xab39('0x1e')](_0x119ec9)['end']();};}function respondWithResult(_0x2795ef,_0x29ba4e){_0x29ba4e=_0x29ba4e||0xc8;return function(_0x478f0c){if(_0x478f0c){return _0x2795ef[_0xab39('0x1e')](_0x29ba4e)[_0xab39('0x1f')](_0x478f0c);}};}function respondWithFilteredResult(_0x5212cb,_0x42d4a3){return function(_0x496ed7){if(_0x496ed7){var _0x6805ec=typeof _0x42d4a3['offset']===_0xab39('0x20')&&typeof _0x42d4a3['limit']===_0xab39('0x20');var _0x207ab9=_0x496ed7['count'];var _0x553363=_0x6805ec?0x0:_0x42d4a3['offset'];var _0x2902b4=_0x6805ec?_0x496ed7[_0xab39('0x21')]:_0x42d4a3[_0xab39('0x22')]+_0x42d4a3[_0xab39('0x23')];var _0x30e0f3;if(_0x2902b4>=_0x207ab9){_0x2902b4=_0x207ab9;_0x30e0f3=0xc8;}else{_0x30e0f3=0xce;}_0x5212cb[_0xab39('0x1e')](_0x30e0f3);return _0x5212cb['set'](_0xab39('0x24'),_0x553363+'-'+_0x2902b4+'/'+_0x207ab9)[_0xab39('0x1f')](_0x496ed7);}return null;};}function patchUpdates(_0x5b15ab){return function(_0xa6399c){try{jsonpatch[_0xab39('0x25')](_0xa6399c,_0x5b15ab,!![]);}catch(_0x19e9cf){return BPromise[_0xab39('0x26')](_0x19e9cf);}return _0xa6399c[_0xab39('0x27')]();};}function saveUpdates(_0x468a4e,_0x4c2f07){return function(_0xa0cec2){if(_0xa0cec2){return _0xa0cec2['update'](_0x468a4e)['then'](function(_0x25a690){return _0x25a690;});}return null;};}function removeEntity(_0x5d4feb,_0x43a1d9){return function(_0x5cc585){if(_0x5cc585){return _0x5cc585[_0xab39('0x28')]()[_0xab39('0x29')](function(){_0x5d4feb[_0xab39('0x1e')](0xcc)[_0xab39('0x2a')]();});}};}function handleEntityNotFound(_0x5aeef0,_0x41050f){return function(_0x3e916c){if(!_0x3e916c){_0x5aeef0['sendStatus'](0x194);}return _0x3e916c;};}function handleError(_0x389a3a,_0x3f15a3){_0x3f15a3=_0x3f15a3||0x1f4;return function(_0x47d27b){logger[_0xab39('0x2b')](_0x47d27b[_0xab39('0x2c')]);if(_0x47d27b[_0xab39('0x2d')]){delete _0x47d27b[_0xab39('0x2d')];}_0x389a3a[_0xab39('0x1e')](_0x3f15a3)[_0xab39('0x2e')](_0x47d27b);};}exports[_0xab39('0x2f')]=function(_0x44c86b,_0x33d64b){var _0x50ffb9={},_0x1f07dd={},_0x54c6be={'count':0x0,'rows':[]};var _0x8aebee=_[_0xab39('0x30')](db['UserProfile'][_0xab39('0x31')],function(_0x10b96c){return{'name':_0x10b96c[_0xab39('0x32')],'type':_0x10b96c[_0xab39('0x33')][_0xab39('0x34')]};});_0x1f07dd['model']=_[_0xab39('0x30')](_0x8aebee,_0xab39('0x2d'));_0x1f07dd[_0xab39('0x35')]=_['keys'](_0x44c86b[_0xab39('0x35')]);_0x1f07dd['filters']=_[_0xab39('0x36')](_0x1f07dd[_0xab39('0x37')],_0x1f07dd[_0xab39('0x35')]);_0x50ffb9[_0xab39('0x38')]=_[_0xab39('0x36')](_0x1f07dd['model'],qs[_0xab39('0x39')](_0x44c86b[_0xab39('0x35')][_0xab39('0x39')]));_0x50ffb9[_0xab39('0x38')]=_0x50ffb9[_0xab39('0x38')][_0xab39('0x3a')]?_0x50ffb9[_0xab39('0x38')]:_0x1f07dd[_0xab39('0x37')];if(!_0x44c86b[_0xab39('0x35')]['hasOwnProperty'](_0xab39('0x3b'))){_0x50ffb9[_0xab39('0x23')]=qs[_0xab39('0x23')](_0x44c86b[_0xab39('0x35')]['limit']);_0x50ffb9['offset']=qs[_0xab39('0x22')](_0x44c86b['query'][_0xab39('0x22')]);}_0x50ffb9[_0xab39('0x3c')]=qs['sort'](_0x44c86b[_0xab39('0x35')][_0xab39('0x3d')]);_0x50ffb9[_0xab39('0x3e')]=qs[_0xab39('0x3f')](_[_0xab39('0x40')](_0x44c86b[_0xab39('0x35')],_0x1f07dd[_0xab39('0x3f')]),_0x8aebee);if(_0x44c86b[_0xab39('0x35')][_0xab39('0x41')]){_0x50ffb9['where']=_[_0xab39('0x42')](_0x50ffb9[_0xab39('0x3e')],{'$or':_[_0xab39('0x30')](_0x8aebee,function(_0x3e986e){if(_0x3e986e['type']!==_0xab39('0x43')){var _0x2d8d7c={};_0x2d8d7c[_0x3e986e[_0xab39('0x2d')]]={'$like':'%'+_0x44c86b[_0xab39('0x35')]['filter']+'%'};return _0x2d8d7c;}})});}_0x50ffb9=_[_0xab39('0x42')]({},_0x50ffb9,_0x44c86b[_0xab39('0x44')]);var _0x103aab={'where':_0x50ffb9['where']};return db['UserProfile'][_0xab39('0x21')](_0x103aab)[_0xab39('0x29')](function(_0x5e4599){_0x54c6be[_0xab39('0x21')]=_0x5e4599;if(_0x44c86b[_0xab39('0x35')][_0xab39('0x45')]){_0x50ffb9['include']=[{'all':!![]}];}return db[_0xab39('0x46')][_0xab39('0x47')](_0x50ffb9);})['then'](function(_0x1c9639){_0x54c6be[_0xab39('0x48')]=_0x1c9639;return _0x54c6be;})['then'](respondWithFilteredResult(_0x33d64b,_0x50ffb9))[_0xab39('0x49')](handleError(_0x33d64b,null));};exports[_0xab39('0x4a')]=function(_0x903884,_0x329e94){var _0x22bd95={'raw':![],'where':{'id':_0x903884[_0xab39('0x4b')]['id']}},_0x369bcf={};_0x369bcf[_0xab39('0x37')]=_[_0xab39('0x4c')](db[_0xab39('0x46')][_0xab39('0x31')]);_0x369bcf[_0xab39('0x35')]=_[_0xab39('0x4c')](_0x903884[_0xab39('0x35')]);_0x369bcf[_0xab39('0x3f')]=_['intersection'](_0x369bcf[_0xab39('0x37')],_0x369bcf[_0xab39('0x35')]);_0x22bd95[_0xab39('0x38')]=_[_0xab39('0x36')](_0x369bcf[_0xab39('0x37')],qs[_0xab39('0x39')](_0x903884[_0xab39('0x35')][_0xab39('0x39')]));_0x22bd95[_0xab39('0x38')]=_0x22bd95['attributes'][_0xab39('0x3a')]?_0x22bd95[_0xab39('0x38')]:_0x369bcf[_0xab39('0x37')];if(_0x903884['query'][_0xab39('0x45')]){_0x22bd95[_0xab39('0x4d')]=[{'all':!![]}];}_0x22bd95=_[_0xab39('0x42')]({},_0x22bd95,_0x903884[_0xab39('0x44')]);return db[_0xab39('0x46')]['find'](_0x22bd95)[_0xab39('0x29')](handleEntityNotFound(_0x329e94,null))['then'](respondWithResult(_0x329e94,null))['catch'](handleError(_0x329e94,null));};exports['create']=function(_0x3ee741,_0x41bf80){return db[_0xab39('0x46')][_0xab39('0x4e')](_0x3ee741['body'],{})[_0xab39('0x29')](respondWithResult(_0x41bf80,0xc9))[_0xab39('0x49')](handleError(_0x41bf80,null));};exports[_0xab39('0x4f')]=function(_0x5c0316,_0x296b55){var _0x3e426b={'where':{'id':_0x5c0316[_0xab39('0x4b')]['id']}},_0x54e0a8={};_0x54e0a8[_0xab39('0x37')]=_[_0xab39('0x4c')](db[_0xab39('0x46')][_0xab39('0x31')]);_0x3e426b['attributes']=_[_0xab39('0x36')](_0x54e0a8['model'],qs[_0xab39('0x39')](_0x5c0316[_0xab39('0x35')]['fields']));_0x3e426b[_0xab39('0x38')]=_0x3e426b['attributes']['length']?_0x3e426b[_0xab39('0x38')]:_0x54e0a8[_0xab39('0x37')];if(_0x5c0316[_0xab39('0x35')]['includeAll']){_0x3e426b[_0xab39('0x4d')]=[{'all':!![]}];}_0x3e426b=_['merge']({},_0x3e426b,_0x5c0316[_0xab39('0x44')]);return db[_0xab39('0x46')]['find'](_0x3e426b)[_0xab39('0x29')](handleEntityNotFound(_0x296b55,null))[_0xab39('0x29')](function(_0x3d58f2){if(_0x3d58f2){var _0x42a953=_0x3d58f2['get']({'plain':!![]});_0x42a953=qs[_0xab39('0x50')](_0x42a953,['id',_0xab39('0x51'),'updatedAt',_0xab39('0x52')]);_0x5c0316[_0xab39('0x53')]=_['omit'](_0x5c0316[_0xab39('0x53')],['id','createdAt',_0xab39('0x54')]);return db[_0xab39('0x55')][_0xab39('0x56')](function(_0x392856){return db['UserProfile'][_0xab39('0x4e')](_[_0xab39('0x42')](_0x42a953,_0x5c0316[_0xab39('0x53')]),{'include':_0x5c0316['query'][_0xab39('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x392856})[_0xab39('0x29')](function(_0x223dab){var _0x3b5dc2=_0x223dab[_0xab39('0x57')]({'plain':!![]});return db['UserProfileSection'][_0xab39('0x47')]({'where':{'userProfileId':_0x5c0316['params']['id']},'raw':!![]})['then'](function(_0x5ec1ec){if(_0x5ec1ec){return BPromise[_0xab39('0x58')](_0x5ec1ec,function(_0x22dc2f){return new BPromise(function(_0x400598,_0x33fb06){if(_0x22dc2f[_0xab39('0x59')]===null||_0x22dc2f[_0xab39('0x59')]===0x1)_0x400598(null);return db[_0xab39('0x5a')][_0xab39('0x47')]({'where':{'sectionId':_0x22dc2f['id']},'raw':!![]})[_0xab39('0x29')](function(_0x2429f5){var _0x7c4d3d=_[_0xab39('0x30')](_0x2429f5,function(_0x18e11b){return qs[_0xab39('0x50')](_0x18e11b,['id',_0xab39('0x51'),'updatedAt',_0xab39('0x5b')]);});_0x400598(_0x7c4d3d);})['catch'](function(_0x571a2c){_0x33fb06(_0x571a2c);});})[_0xab39('0x29')](function(_0x31401d){var _0x402a49=qs['omit'](_0x22dc2f,['id',_0xab39('0x51'),_0xab39('0x54')]);_0x402a49[_0xab39('0x5c')]=_0x3b5dc2['id'];if(_0x31401d)_0x402a49[_0xab39('0x5d')]=_0x31401d;return _0x402a49;})[_0xab39('0x29')](function(_0x38b15f){return db[_0xab39('0x5e')][_0xab39('0x4e')](_0x38b15f,{'include':[{'model':db[_0xab39('0x5a')],'as':_0xab39('0x5d')}],'raw':!![],'transaction':_0x392856});});})['then'](function(){return _0x3b5dc2;});}});});});}})[_0xab39('0x29')](respondWithResult(_0x296b55,0xc9))[_0xab39('0x49')](handleError(_0x296b55,null));};exports[_0xab39('0x5f')]=function(_0xea4858,_0xe7ff01){if(_0xea4858[_0xab39('0x53')]['id']){delete _0xea4858[_0xab39('0x53')]['id'];}return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0xea4858[_0xab39('0x4b')]['id']}})[_0xab39('0x29')](handleEntityNotFound(_0xe7ff01,null))['then'](saveUpdates(_0xea4858[_0xab39('0x53')],null))[_0xab39('0x29')](respondWithResult(_0xe7ff01,null))[_0xab39('0x49')](handleError(_0xe7ff01,null));};exports[_0xab39('0x28')]=function(_0x4bfedb,_0x4e7368){return db['UserProfile'][_0xab39('0x60')]({'where':{'id':_0x4bfedb[_0xab39('0x4b')]['id']}})[_0xab39('0x29')](handleEntityNotFound(_0x4e7368,null))[_0xab39('0x29')](removeEntity(_0x4e7368,null))['catch'](handleError(_0x4e7368,null));};exports[_0xab39('0x61')]=function(_0x4864c1,_0x2b6c58){return db[_0xab39('0x46')][_0xab39('0x61')]()[_0xab39('0x29')](respondWithResult(_0x2b6c58,null))['catch'](handleError(_0x2b6c58,null));};exports[_0xab39('0x62')]=function(_0x388c05,_0x1ca9d1){var _0x169c14=_0x388c05['body'];return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0x388c05['params']['id']}})['then'](handleEntityNotFound(_0x1ca9d1,null))[_0xab39('0x29')](function(_0xf4c3aa){if(_0xf4c3aa){return db[_0xab39('0x55')][_0xab39('0x56')](function(_0x103d54){return db[_0xab39('0x5e')][_0xab39('0x28')]({'where':{'userProfileId':_0x388c05[_0xab39('0x4b')]['id'],'sectionId':_[_0xab39('0x30')](_0x169c14,function(_0x1921b0){return _0x1921b0[_0xab39('0x5b')];})},'transaction':_0x103d54})['then'](function(){var _0x40a9db=_[_0xab39('0x30')](_0x169c14,function(_0x3b7237){_0x3b7237[_0xab39('0x5c')]=_0x388c05[_0xab39('0x4b')]['id'];return _0x3b7237;});var _0x532e54=[];return BPromise[_0xab39('0x58')](_0x40a9db,function(_0x458da3){return db['UserProfileSection'][_0xab39('0x4e')](_0x458da3,{'include':[{'model':db[_0xab39('0x5a')],'as':_0xab39('0x5d')}],'raw':!![],'transaction':_0x103d54})[_0xab39('0x29')](function(_0x1fb50d){_0x532e54[_0xab39('0x63')](_0x1fb50d[_0xab39('0x57')]({'plain':!![]}));});})[_0xab39('0x29')](function(){return _0x532e54;});});});}})['then'](function(_0xd6c9d1){return _0xd6c9d1;})[_0xab39('0x29')](respondWithResult(_0x1ca9d1,null))[_0xab39('0x49')](handleError(_0x1ca9d1,null));};exports['removeSections']=function(_0x5ed279,_0x13c5d7){var _0x4bb2bf;return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0x5ed279[_0xab39('0x4b')]['id']},'attributes':['id',_0xab39('0x2d')]})[_0xab39('0x29')](handleEntityNotFound(_0x13c5d7,null))['then'](function(_0x4f0275){if(_0x4f0275){_0x4bb2bf=_0x4f0275;return db[_0xab39('0x5e')]['destroy']({'where':{'userProfileId':_0x5ed279['params']['id'],'sectionId':_0x5ed279[_0xab39('0x35')][_0xab39('0x64')]}});}})[_0xab39('0x29')](function(){return _0x4bb2bf;})[_0xab39('0x29')](respondWithStatusCode(_0x13c5d7,null))['catch'](handleError(_0x13c5d7,null));};exports[_0xab39('0x65')]=function(_0xd1d1bf,_0x374c5f){var _0x4ea68e=[];var _0x538514=[];return db[_0xab39('0x5e')][_0xab39('0x47')]({'where':{'userProfileId':_0xd1d1bf[_0xab39('0x4b')]['id']},'raw':!![]})[_0xab39('0x29')](function(_0x5a619f){_0x4ea68e=_['filter'](_0x5a619f,function(_0x46cad9){return _0x46cad9[_0xab39('0x66')]===0x1||_[_0xab39('0x67')]([0x3eb,0x709],_0x46cad9[_0xab39('0x5b')]);});if(!_['isEmpty'](_0x4ea68e)){return _[_0xab39('0x30')](_0x4ea68e,function(_0xf76730){return _0xf76730[_0xab39('0x5b')];});}else{return;}})[_0xab39('0x29')](function(_0x4a3c16){if(_0x4a3c16)_0x538514=_0x4a3c16;if(_['includes'](_0x538514,0x64)){var _0x45987d=_[_0xab39('0x60')](_0x4ea68e,{'sectionId':0x64});return hasDefaultDashboard(_0x45987d)[_0xab39('0x29')](function(_0x1db523){return _[_0xab39('0x30')](_0x4ea68e,function(_0x1adeea){if(_0x1adeea['sectionId']===0x64){_0x1adeea[_0xab39('0x68')]=_0x1db523;}return _0x1adeea;});});}else{return;}})['then'](function(_0x279fd0){if(_0x279fd0)_0x4ea68e=_0x279fd0;if(_['includes'](_0x538514,0x3eb)){var _0x326b60=_[_0xab39('0x60')](_0x4ea68e,{'sectionId':0x3eb});return getCustomDashboards(_0x326b60)[_0xab39('0x29')](function(_0x18a86d){return _[_0xab39('0x30')](_0x4ea68e,function(_0x585d31){if(_0x326b60[_0xab39('0x66')]){if(_0x585d31[_0xab39('0x5b')]===0x3eb){_0x585d31[_0xab39('0x68')]=_0x18a86d;}}else{if(_0x585d31['sectionId']===0x64){if(!_0x585d31[_0xab39('0x68')]){_0x585d31[_0xab39('0x68')]=[];}_0x585d31[_0xab39('0x68')]=_0x585d31[_0xab39('0x68')][_0xab39('0x69')](_0x18a86d);}}return _0x585d31;});});}else{return;}})[_0xab39('0x29')](function(_0x45c287){if(_0x45c287)_0x4ea68e=_0x45c287;if(_['includes'](_0x538514,0x709)){var _0x5650db=_[_0xab39('0x60')](_0x4ea68e,{'sectionId':0x709});return getPlugins(_0x5650db)[_0xab39('0x29')](function(_0x37a0cc){if(_0x5650db[_0xab39('0x66')]){return _[_0xab39('0x30')](_0x4ea68e,function(_0x1009f2){if(_0x1009f2['sectionId']===0x709){_0x1009f2[_0xab39('0x68')]=_0x37a0cc;}return _0x1009f2;});}else{var _0x8d4a34={'sectionId':0x76c,'enabled':0x1,'subsections':_0x37a0cc};var _0x34383c=_['map'](_0x4ea68e);_0x34383c[_0xab39('0x63')](_0x8d4a34);return _0x34383c;}});}else{return;}})[_0xab39('0x29')](function(_0x3d11c0){if(_0x3d11c0)_0x4ea68e=_0x3d11c0;return _[_0xab39('0x41')](_0x4ea68e,[_0xab39('0x66'),0x1]);})['then'](respondWithResult(_0x374c5f,null))[_0xab39('0x49')](handleError(_0x374c5f,null));};function hasDefaultDashboard(_0x385427){var _0x7fb46e=[0x65];return new BPromise(function(_0x17f5aa,_0x16137e){try{if(_0x385427[_0xab39('0x59')]){_0x17f5aa(_0x7fb46e);}else{return db[_0xab39('0x5a')][_0xab39('0x6a')]({'where':{'sectionId':_0x385427['id']},'raw':!![]})[_0xab39('0x29')](function(_0x330300){_0x330300?_0x17f5aa(_0x7fb46e):_0x17f5aa();});}}catch(_0x5613ad){_0x16137e(_0x5613ad);}});}function getCustomDashboards(_0x14282d){var _0xfed7e4=[];return new BPromise(function(_0x6e65d0,_0x3f9bca){try{if(_0x14282d[_0xab39('0x59')]){return db[_0xab39('0x6b')][_0xab39('0x47')]({'raw':!![]})[_0xab39('0x29')](function(_0xe71923){_0xe71923[_0xab39('0x6c')](function(_0x3da3ee){_0xfed7e4['push'](_0x3da3ee['id']+0x1869f);});_0x6e65d0(_0xfed7e4);});}else{return db[_0xab39('0x5a')][_0xab39('0x47')]({'where':{'sectionId':_0x14282d['id']},'raw':!![]})[_0xab39('0x29')](function(_0x23927e){_0x23927e[_0xab39('0x6c')](function(_0x113464){_0xfed7e4[_0xab39('0x63')](_0x113464[_0xab39('0x6d')]+0x1869f);});_0x6e65d0(_0xfed7e4);});}}catch(_0x2f2045){_0x3f9bca(_0x2f2045);}});}function getPlugins(_0xc1d474){var _0x7621e7=[];return new BPromise(function(_0x14e288,_0x5b8910){try{if(_0xc1d474[_0xab39('0x59')]){return db['Plugin']['findAll']({'raw':!![]})[_0xab39('0x29')](function(_0x15cac9){_0x15cac9['forEach'](function(_0x2a0cd1){_0x7621e7[_0xab39('0x63')](_0x2a0cd1['id']+0x15b38);});_0x14e288(_0x7621e7);});}else{return db[_0xab39('0x5a')][_0xab39('0x47')]({'where':{'sectionId':_0xc1d474['id']},'raw':!![]})[_0xab39('0x29')](function(_0xc6c2b9){_0xc6c2b9[_0xab39('0x6c')](function(_0x260292){_0x7621e7['push'](_0x260292[_0xab39('0x6d')]+0x15b38);});_0x14e288(_0x7621e7);});}}catch(_0x1bc2c5){_0x5b8910(_0x1bc2c5);}});}exports[_0xab39('0x6e')]=function(_0x216403,_0x1b487a){return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0x216403[_0xab39('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1b487a,null))[_0xab39('0x29')](function(_0x43488e){if(_0x43488e){return db['sequelize']['transaction'](function(_0x48c81b){return db[_0xab39('0x5e')]['findAll']({'where':{'userProfileId':_0x216403[_0xab39('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xab39('0x29')](function(_0x50d28b){if(_0x50d28b){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x216403[_0xab39('0x4b')]['id'],'id':_[_0xab39('0x30')](_0x50d28b,function(_0x1606b7){return _0x1606b7['id'];})},'transaction':_0x48c81b});}})['then'](function(_0x54d96c){var _0x4b5688=_[_0xab39('0x30')](_0x216403[_0xab39('0x53')],function(_0x2f193f){_0x2f193f[_0xab39('0x5c')]=_0x216403[_0xab39('0x4b')]['id'];return _0x2f193f;});return db[_0xab39('0x5e')][_0xab39('0x6f')](_0x4b5688,{'raw':!![],'transaction':_0x48c81b});})['then'](function(_0x4304f5){var _0x552ff5=_['filter'](_[_0xab39('0x30')](_0x4304f5,function(_0x2467eb){return _0x2467eb[_0xab39('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x552ff5){return db[_0xab39('0x5e')][_0xab39('0x47')]({'where':{'userProfileId':_0x216403[_0xab39('0x4b')]['id'],'sectionId':_[_0xab39('0x30')](_0x552ff5,function(_0x2c0c7d){return _0x2c0c7d[_0xab39('0x5b')];})},'attributes':['id',_0xab39('0x5b')],'raw':!![]})[_0xab39('0x29')](function(_0x393aaa){var _0x5a1c9b=_['map'](_0x216403[_0xab39('0x53')],function(_0x11ead9){_0x11ead9[_0xab39('0x5c')]=_0x216403['params']['id'];return _0x11ead9;});return db[_0xab39('0x5a')][_0xab39('0x6f')](_0x5a1c9b,{'raw':!![],'transaction':_0x48c81b});});}})[_0xab39('0x49')](handleError(_0x1b487a,null));});}})[_0xab39('0x29')](function(_0x310270){var _0xc1cd71=_['map'](_0x310270,function(_0x247f79){return _0x247f79[_0xab39('0x57')]({'plain':!![]});});})[_0xab39('0x29')](respondWithResult(_0x1b487a,null))[_0xab39('0x49')](handleError(_0x1b487a,null));};exports['removeResources']=function(_0x5820b4,_0x50ab23,_0x439471){return db[_0xab39('0x46')][_0xab39('0x60')]({'where':{'id':_0x5820b4[_0xab39('0x4b')]['id']}})[_0xab39('0x29')](handleEntityNotFound(_0x50ab23,null))[_0xab39('0x29')](function(_0x4000bc){if(_0x4000bc){return _0x4000bc['removeResources'](_0x5820b4[_0xab39('0x35')][_0xab39('0x64')]);}})[_0xab39('0x29')](respondWithStatusCode(_0x50ab23,null))['catch'](handleError(_0x50ab23,null));};exports[_0xab39('0x70')]=function(_0x156897,_0x3bd1db){var _0x59321f={};if(!_0x156897[_0xab39('0x35')][_0xab39('0x71')])throw new Error(_0xab39('0x72'));if(!_0x156897[_0xab39('0x35')][_0xab39('0x73')](_0xab39('0x3b'))){_0x59321f[_0xab39('0x23')]=qs[_0xab39('0x23')](_0x156897[_0xab39('0x35')]['limit']);_0x59321f[_0xab39('0x22')]=qs['offset'](_0x156897['query']['offset']);}return db[_0xab39('0x46')]['find']({'where':{'id':_0x156897[_0xab39('0x4b')]['id']}})[_0xab39('0x29')](function(_0x37acd4){if(!_0x37acd4)throw new Error(_0xab39('0x74')+_0x156897[_0xab39('0x4b')]['id']);return db[_0xab39('0x46')]['getResources'](_0x156897);})['then'](respondWithFilteredResult(_0x3bd1db,_0x59321f))[_0xab39('0x49')](handleError(_0x3bd1db,null));}; \ No newline at end of file +var _0xdedf=['omit','sectionId','userProfileId','UserProfileSection','Resources','update','describe','addSections','each','push','removeSections','ids','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','get','createdAt','updatedAt','sequelize','transaction','autoAssociation','UserProfileResource'];(function(_0x3ba3c4,_0x23e672){var _0x4883f7=function(_0x3b16e8){while(--_0x3b16e8){_0x3ba3c4['push'](_0x3ba3c4['shift']());}};_0x4883f7(++_0x23e672);}(_0xdedf,0x82));var _0xfded=function(_0xccef71,_0x103402){_0xccef71=_0xccef71-0x0;var _0x522df3=_0xdedf[_0xccef71];return _0x522df3;};'use strict';var emlformat=require(_0xfded('0x0'));var rimraf=require(_0xfded('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfded('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfded('0x3'));var Mustache=require(_0xfded('0x4'));var util=require(_0xfded('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfded('0x6'));var _=require(_0xfded('0x7'));var squel=require(_0xfded('0x8'));var crypto=require(_0xfded('0x9'));var jsforce=require(_0xfded('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfded('0xb'));var querystring=require(_0xfded('0xc'));var Papa=require(_0xfded('0xd'));var Redis=require(_0xfded('0xe'));var authService=require(_0xfded('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfded('0x10'));var hardwareService=require(_0xfded('0x11'));var logger=require('../../config/logger')(_0xfded('0x12'));var utils=require(_0xfded('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfded('0x14'))['db'];config[_0xfded('0x15')]=_[_0xfded('0x16')](config[_0xfded('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xfded('0x17'))(new Redis(config['redis']));require(_0xfded('0x18'))['register'](socket);function respondWithStatusCode(_0x425f7a,_0x399495){_0x399495=_0x399495||0xcc;return function(_0x4862ff){if(_0x4862ff){return _0x425f7a[_0xfded('0x19')](_0x399495);}return _0x425f7a[_0xfded('0x1a')](_0x399495)[_0xfded('0x1b')]();};}function respondWithResult(_0x2b2d3c,_0x1557fd){_0x1557fd=_0x1557fd||0xc8;return function(_0x45eb33){if(_0x45eb33){return _0x2b2d3c[_0xfded('0x1a')](_0x1557fd)[_0xfded('0x1c')](_0x45eb33);}};}function respondWithFilteredResult(_0x3331bf,_0x48ab3a){return function(_0x4ef21d){if(_0x4ef21d){var _0x4decc2=typeof _0x48ab3a[_0xfded('0x1d')]===_0xfded('0x1e')&&typeof _0x48ab3a['limit']===_0xfded('0x1e');var _0x584814=_0x4ef21d[_0xfded('0x1f')];var _0x196d1c=_0x4decc2?0x0:_0x48ab3a[_0xfded('0x1d')];var _0xc45d47=_0x4decc2?_0x4ef21d[_0xfded('0x1f')]:_0x48ab3a[_0xfded('0x1d')]+_0x48ab3a[_0xfded('0x20')];var _0x7ce46;if(_0xc45d47>=_0x584814){_0xc45d47=_0x584814;_0x7ce46=0xc8;}else{_0x7ce46=0xce;}_0x3331bf['status'](_0x7ce46);return _0x3331bf['set'](_0xfded('0x21'),_0x196d1c+'-'+_0xc45d47+'/'+_0x584814)[_0xfded('0x1c')](_0x4ef21d);}return null;};}function patchUpdates(_0x544faf){return function(_0x39b516){try{jsonpatch[_0xfded('0x22')](_0x39b516,_0x544faf,!![]);}catch(_0x383c9b){return BPromise[_0xfded('0x23')](_0x383c9b);}return _0x39b516['save']();};}function saveUpdates(_0x202bfb,_0x432847){return function(_0xa4a794){if(_0xa4a794){return _0xa4a794['update'](_0x202bfb)[_0xfded('0x24')](function(_0x2993e8){return _0x2993e8;});}return null;};}function removeEntity(_0xe9d250,_0xa30523){return function(_0x4762c1){if(_0x4762c1){return _0x4762c1[_0xfded('0x25')]()[_0xfded('0x24')](function(){_0xe9d250[_0xfded('0x1a')](0xcc)[_0xfded('0x1b')]();});}};}function handleEntityNotFound(_0x2675e7,_0x5da3f6){return function(_0x26593c){if(!_0x26593c){_0x2675e7[_0xfded('0x19')](0x194);}return _0x26593c;};}function handleError(_0xaf4319,_0x5773e0){_0x5773e0=_0x5773e0||0x1f4;return function(_0x1f89ed){logger[_0xfded('0x26')](_0x1f89ed[_0xfded('0x27')]);if(_0x1f89ed[_0xfded('0x28')]){delete _0x1f89ed[_0xfded('0x28')];}_0xaf4319['status'](_0x5773e0)[_0xfded('0x29')](_0x1f89ed);};}exports[_0xfded('0x2a')]=function(_0x4d5070,_0x209acf){var _0x31614e={},_0x2ce4c0={},_0x50e5b8={'count':0x0,'rows':[]};var _0x576711=_[_0xfded('0x2b')](db[_0xfded('0x2c')][_0xfded('0x2d')],function(_0x40f472){return{'name':_0x40f472[_0xfded('0x2e')],'type':_0x40f472[_0xfded('0x2f')][_0xfded('0x30')]};});_0x2ce4c0[_0xfded('0x31')]=_[_0xfded('0x2b')](_0x576711,_0xfded('0x28'));_0x2ce4c0[_0xfded('0x32')]=_[_0xfded('0x33')](_0x4d5070[_0xfded('0x32')]);_0x2ce4c0['filters']=_['intersection'](_0x2ce4c0[_0xfded('0x31')],_0x2ce4c0[_0xfded('0x32')]);_0x31614e[_0xfded('0x34')]=_[_0xfded('0x35')](_0x2ce4c0[_0xfded('0x31')],qs[_0xfded('0x36')](_0x4d5070['query'][_0xfded('0x36')]));_0x31614e['attributes']=_0x31614e[_0xfded('0x34')]['length']?_0x31614e[_0xfded('0x34')]:_0x2ce4c0[_0xfded('0x31')];if(!_0x4d5070[_0xfded('0x32')][_0xfded('0x37')](_0xfded('0x38'))){_0x31614e['limit']=qs[_0xfded('0x20')](_0x4d5070['query'][_0xfded('0x20')]);_0x31614e[_0xfded('0x1d')]=qs[_0xfded('0x1d')](_0x4d5070['query'][_0xfded('0x1d')]);}_0x31614e[_0xfded('0x39')]=qs['sort'](_0x4d5070[_0xfded('0x32')]['sort']);_0x31614e['where']=qs[_0xfded('0x3a')](_['pick'](_0x4d5070[_0xfded('0x32')],_0x2ce4c0[_0xfded('0x3a')]),_0x576711);if(_0x4d5070[_0xfded('0x32')][_0xfded('0x3b')]){_0x31614e['where']=_['merge'](_0x31614e['where'],{'$or':_[_0xfded('0x2b')](_0x576711,function(_0x45f0b6){if(_0x45f0b6[_0xfded('0x2f')]!==_0xfded('0x3c')){var _0x408c6e={};_0x408c6e[_0x45f0b6['name']]={'$like':'%'+_0x4d5070[_0xfded('0x32')][_0xfded('0x3b')]+'%'};return _0x408c6e;}})});}_0x31614e=_[_0xfded('0x3d')]({},_0x31614e,_0x4d5070[_0xfded('0x3e')]);var _0x53eb68={'where':_0x31614e['where']};return db[_0xfded('0x2c')]['count'](_0x53eb68)[_0xfded('0x24')](function(_0x16064d){_0x50e5b8[_0xfded('0x1f')]=_0x16064d;if(_0x4d5070['query'][_0xfded('0x3f')]){_0x31614e[_0xfded('0x40')]=[{'all':!![]}];}return db[_0xfded('0x2c')][_0xfded('0x41')](_0x31614e);})[_0xfded('0x24')](function(_0x354232){_0x50e5b8['rows']=_0x354232;return _0x50e5b8;})[_0xfded('0x24')](respondWithFilteredResult(_0x209acf,_0x31614e))[_0xfded('0x42')](handleError(_0x209acf,null));};exports[_0xfded('0x43')]=function(_0x253a6e,_0xba528e){var _0x1a6569={'raw':![],'where':{'id':_0x253a6e[_0xfded('0x44')]['id']}},_0x534f68={};_0x534f68[_0xfded('0x31')]=_[_0xfded('0x33')](db[_0xfded('0x2c')][_0xfded('0x2d')]);_0x534f68[_0xfded('0x32')]=_[_0xfded('0x33')](_0x253a6e['query']);_0x534f68[_0xfded('0x3a')]=_[_0xfded('0x35')](_0x534f68['model'],_0x534f68[_0xfded('0x32')]);_0x1a6569[_0xfded('0x34')]=_['intersection'](_0x534f68['model'],qs[_0xfded('0x36')](_0x253a6e[_0xfded('0x32')]['fields']));_0x1a6569[_0xfded('0x34')]=_0x1a6569['attributes'][_0xfded('0x45')]?_0x1a6569[_0xfded('0x34')]:_0x534f68[_0xfded('0x31')];if(_0x253a6e['query'][_0xfded('0x3f')]){_0x1a6569[_0xfded('0x40')]=[{'all':!![]}];}_0x1a6569=_[_0xfded('0x3d')]({},_0x1a6569,_0x253a6e[_0xfded('0x3e')]);return db[_0xfded('0x2c')][_0xfded('0x46')](_0x1a6569)[_0xfded('0x24')](handleEntityNotFound(_0xba528e,null))[_0xfded('0x24')](respondWithResult(_0xba528e,null))[_0xfded('0x42')](handleError(_0xba528e,null));};exports['create']=function(_0x42324a,_0x2518bd){return db[_0xfded('0x2c')][_0xfded('0x47')](_0x42324a[_0xfded('0x48')],{})[_0xfded('0x24')](respondWithResult(_0x2518bd,0xc9))['catch'](handleError(_0x2518bd,null));};exports['clone']=function(_0x2cb882,_0x511a87){var _0x3f1014={'where':{'id':_0x2cb882[_0xfded('0x44')]['id']}},_0x29da13={};_0x29da13['model']=_[_0xfded('0x33')](db[_0xfded('0x2c')][_0xfded('0x2d')]);_0x3f1014['attributes']=_['intersection'](_0x29da13[_0xfded('0x31')],qs[_0xfded('0x36')](_0x2cb882['query'][_0xfded('0x36')]));_0x3f1014['attributes']=_0x3f1014[_0xfded('0x34')][_0xfded('0x45')]?_0x3f1014[_0xfded('0x34')]:_0x29da13[_0xfded('0x31')];if(_0x2cb882[_0xfded('0x32')][_0xfded('0x3f')]){_0x3f1014[_0xfded('0x40')]=[{'all':!![]}];}_0x3f1014=_[_0xfded('0x3d')]({},_0x3f1014,_0x2cb882[_0xfded('0x3e')]);return db[_0xfded('0x2c')]['find'](_0x3f1014)[_0xfded('0x24')](handleEntityNotFound(_0x511a87,null))['then'](function(_0x399821){if(_0x399821){var _0x268dfb=_0x399821[_0xfded('0x49')]({'plain':!![]});_0x268dfb=qs['omit'](_0x268dfb,['id',_0xfded('0x4a'),'updatedAt','crudPermissions']);_0x2cb882['body']=_['omit'](_0x2cb882[_0xfded('0x48')],['id','createdAt',_0xfded('0x4b')]);return db[_0xfded('0x4c')][_0xfded('0x4d')](function(_0x4a5ce7){return db[_0xfded('0x2c')][_0xfded('0x47')](_[_0xfded('0x3d')](_0x268dfb,_0x2cb882['body']),{'include':_0x2cb882[_0xfded('0x32')][_0xfded('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x4a5ce7})[_0xfded('0x24')](function(_0x1cfda9){var _0x16b031=_0x1cfda9[_0xfded('0x49')]({'plain':!![]});return db['UserProfileSection'][_0xfded('0x41')]({'where':{'userProfileId':_0x2cb882['params']['id']},'raw':!![]})[_0xfded('0x24')](function(_0xfd7a21){if(_0xfd7a21){return BPromise['each'](_0xfd7a21,function(_0x57d483){return new BPromise(function(_0x36161d,_0x50eaf4){if(_0x57d483[_0xfded('0x4e')]===null||_0x57d483[_0xfded('0x4e')]===0x1)_0x36161d(null);return db[_0xfded('0x4f')][_0xfded('0x41')]({'where':{'sectionId':_0x57d483['id']},'raw':!![]})['then'](function(_0x1dd1e2){var _0x5d3ce1=_[_0xfded('0x2b')](_0x1dd1e2,function(_0x4ca266){return qs[_0xfded('0x50')](_0x4ca266,['id','createdAt',_0xfded('0x4b'),_0xfded('0x51')]);});_0x36161d(_0x5d3ce1);})[_0xfded('0x42')](function(_0x1f67c5){_0x50eaf4(_0x1f67c5);});})[_0xfded('0x24')](function(_0x3d7b9f){var _0x41dbc2=qs['omit'](_0x57d483,['id',_0xfded('0x4a'),_0xfded('0x4b')]);_0x41dbc2[_0xfded('0x52')]=_0x16b031['id'];if(_0x3d7b9f)_0x41dbc2['Resources']=_0x3d7b9f;return _0x41dbc2;})[_0xfded('0x24')](function(_0x4ef24a){return db[_0xfded('0x53')][_0xfded('0x47')](_0x4ef24a,{'include':[{'model':db[_0xfded('0x4f')],'as':_0xfded('0x54')}],'raw':!![],'transaction':_0x4a5ce7});});})[_0xfded('0x24')](function(){return _0x16b031;});}});});});}})[_0xfded('0x24')](respondWithResult(_0x511a87,0xc9))['catch'](handleError(_0x511a87,null));};exports[_0xfded('0x55')]=function(_0x11d4fd,_0xe61b57){if(_0x11d4fd[_0xfded('0x48')]['id']){delete _0x11d4fd[_0xfded('0x48')]['id'];}return db[_0xfded('0x2c')][_0xfded('0x46')]({'where':{'id':_0x11d4fd[_0xfded('0x44')]['id']}})[_0xfded('0x24')](handleEntityNotFound(_0xe61b57,null))[_0xfded('0x24')](saveUpdates(_0x11d4fd['body'],null))['then'](respondWithResult(_0xe61b57,null))[_0xfded('0x42')](handleError(_0xe61b57,null));};exports[_0xfded('0x25')]=function(_0x4ffb0c,_0x4e4c9c){return db['UserProfile'][_0xfded('0x46')]({'where':{'id':_0x4ffb0c[_0xfded('0x44')]['id']}})[_0xfded('0x24')](handleEntityNotFound(_0x4e4c9c,null))[_0xfded('0x24')](removeEntity(_0x4e4c9c,null))[_0xfded('0x42')](handleError(_0x4e4c9c,null));};exports[_0xfded('0x56')]=function(_0x5af582,_0x273cc5){return db[_0xfded('0x2c')][_0xfded('0x56')]()[_0xfded('0x24')](respondWithResult(_0x273cc5,null))[_0xfded('0x42')](handleError(_0x273cc5,null));};exports[_0xfded('0x57')]=function(_0x345142,_0x48b05b){var _0x31061e=_0x345142[_0xfded('0x48')];return db[_0xfded('0x2c')][_0xfded('0x46')]({'where':{'id':_0x345142['params']['id']}})[_0xfded('0x24')](handleEntityNotFound(_0x48b05b,null))[_0xfded('0x24')](function(_0x259c09){if(_0x259c09){return db[_0xfded('0x4c')][_0xfded('0x4d')](function(_0xbcc403){return db[_0xfded('0x53')]['destroy']({'where':{'userProfileId':_0x345142[_0xfded('0x44')]['id'],'sectionId':_[_0xfded('0x2b')](_0x31061e,function(_0x5bf84a){return _0x5bf84a['sectionId'];})},'transaction':_0xbcc403})[_0xfded('0x24')](function(){var _0x25bd4d=_[_0xfded('0x2b')](_0x31061e,function(_0x39cc00){_0x39cc00[_0xfded('0x52')]=_0x345142[_0xfded('0x44')]['id'];return _0x39cc00;});var _0x3fc499=[];return BPromise[_0xfded('0x58')](_0x25bd4d,function(_0x1ba7c0){return db[_0xfded('0x53')][_0xfded('0x47')](_0x1ba7c0,{'include':[{'model':db[_0xfded('0x4f')],'as':_0xfded('0x54')}],'raw':!![],'transaction':_0xbcc403})['then'](function(_0x23cead){_0x3fc499[_0xfded('0x59')](_0x23cead[_0xfded('0x49')]({'plain':!![]}));});})[_0xfded('0x24')](function(){return _0x3fc499;});});});}})[_0xfded('0x24')](function(_0x490da0){return _0x490da0;})[_0xfded('0x24')](respondWithResult(_0x48b05b,null))['catch'](handleError(_0x48b05b,null));};exports[_0xfded('0x5a')]=function(_0x1238e3,_0x2d5928){var _0x5c1540;return db[_0xfded('0x2c')][_0xfded('0x46')]({'where':{'id':_0x1238e3[_0xfded('0x44')]['id']},'attributes':['id',_0xfded('0x28')]})[_0xfded('0x24')](handleEntityNotFound(_0x2d5928,null))['then'](function(_0x9a7762){if(_0x9a7762){_0x5c1540=_0x9a7762;return db['UserProfileSection'][_0xfded('0x25')]({'where':{'userProfileId':_0x1238e3[_0xfded('0x44')]['id'],'sectionId':_0x1238e3['query'][_0xfded('0x5b')]}});}})[_0xfded('0x24')](function(){return _0x5c1540;})[_0xfded('0x24')](respondWithStatusCode(_0x2d5928,null))['catch'](handleError(_0x2d5928,null));};exports['getSections']=function(_0x40ee23,_0x2bdbe4){var _0x3704a6=[];var _0x34f5ca=[];return db[_0xfded('0x53')][_0xfded('0x41')]({'where':{'userProfileId':_0x40ee23[_0xfded('0x44')]['id']},'raw':!![]})[_0xfded('0x24')](function(_0x5900af){_0x3704a6=_[_0xfded('0x3b')](_0x5900af,function(_0x5b6a64){return _0x5b6a64['enabled']===0x1||_[_0xfded('0x5c')]([0x3eb,0x709],_0x5b6a64[_0xfded('0x51')]);});if(!_[_0xfded('0x5d')](_0x3704a6)){return _['map'](_0x3704a6,function(_0x4b0fe2){return _0x4b0fe2[_0xfded('0x51')];});}else{return;}})[_0xfded('0x24')](function(_0x417dfb){if(_0x417dfb)_0x34f5ca=_0x417dfb;if(_[_0xfded('0x5c')](_0x34f5ca,0x64)){var _0x52a9dd=_[_0xfded('0x46')](_0x3704a6,{'sectionId':0x64});return hasDefaultDashboard(_0x52a9dd)['then'](function(_0x4ff794){return _[_0xfded('0x2b')](_0x3704a6,function(_0x54af78){if(_0x54af78[_0xfded('0x51')]===0x64){_0x54af78[_0xfded('0x5e')]=_0x4ff794;}return _0x54af78;});});}else{return;}})[_0xfded('0x24')](function(_0x1e57d0){if(_0x1e57d0)_0x3704a6=_0x1e57d0;if(_['includes'](_0x34f5ca,0x3eb)){var _0x3406b4=_[_0xfded('0x46')](_0x3704a6,{'sectionId':0x3eb});return getCustomDashboards(_0x3406b4)[_0xfded('0x24')](function(_0x5eb83e){return _[_0xfded('0x2b')](_0x3704a6,function(_0x28e902){if(_0x3406b4[_0xfded('0x5f')]){if(_0x28e902[_0xfded('0x51')]===0x3eb){_0x28e902['subsections']=_0x5eb83e;}}else{if(_0x28e902[_0xfded('0x51')]===0x64){if(!_0x28e902[_0xfded('0x5e')]){_0x28e902[_0xfded('0x5e')]=[];}_0x28e902[_0xfded('0x5e')]=_0x28e902[_0xfded('0x5e')]['concat'](_0x5eb83e);}}return _0x28e902;});});}else{return;}})['then'](function(_0x3d10fc){if(_0x3d10fc)_0x3704a6=_0x3d10fc;if(_[_0xfded('0x5c')](_0x34f5ca,0x709)){var _0x1abce7=_[_0xfded('0x46')](_0x3704a6,{'sectionId':0x709});return getPlugins(_0x1abce7)[_0xfded('0x24')](function(_0x2d8bae){if(_0x1abce7[_0xfded('0x5f')]){return _['map'](_0x3704a6,function(_0x5013e9){if(_0x5013e9[_0xfded('0x51')]===0x709){_0x5013e9['subsections']=_0x2d8bae;}return _0x5013e9;});}else{var _0x8be3ae={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2d8bae};var _0x34d2a6=_['map'](_0x3704a6);_0x34d2a6['push'](_0x8be3ae);return _0x34d2a6;}});}else{return;}})[_0xfded('0x24')](function(_0x46aee6){if(_0x46aee6)_0x3704a6=_0x46aee6;return _['filter'](_0x3704a6,[_0xfded('0x5f'),0x1]);})[_0xfded('0x24')](respondWithResult(_0x2bdbe4,null))['catch'](handleError(_0x2bdbe4,null));};function hasDefaultDashboard(_0x10cd4a){var _0x1d8229=[0x65];return new BPromise(function(_0x464653,_0x32a955){try{if(_0x10cd4a[_0xfded('0x4e')]){_0x464653(_0x1d8229);}else{return db[_0xfded('0x4f')][_0xfded('0x60')]({'where':{'sectionId':_0x10cd4a['id']},'raw':!![]})[_0xfded('0x24')](function(_0x48be8b){_0x48be8b?_0x464653(_0x1d8229):_0x464653();});}}catch(_0x4ee137){_0x32a955(_0x4ee137);}});}function getCustomDashboards(_0xbf64c3){var _0x1ba0c2=[];return new BPromise(function(_0x16ec6f,_0x471f4c){try{if(_0xbf64c3[_0xfded('0x4e')]){return db[_0xfded('0x61')][_0xfded('0x41')]({'raw':!![]})[_0xfded('0x24')](function(_0x349147){_0x349147['forEach'](function(_0x430a71){_0x1ba0c2[_0xfded('0x59')](_0x430a71['id']+0x1869f);});_0x16ec6f(_0x1ba0c2);});}else{return db[_0xfded('0x4f')]['findAll']({'where':{'sectionId':_0xbf64c3['id']},'raw':!![]})[_0xfded('0x24')](function(_0x266402){_0x266402[_0xfded('0x62')](function(_0x4f14f5){_0x1ba0c2[_0xfded('0x59')](_0x4f14f5[_0xfded('0x63')]+0x1869f);});_0x16ec6f(_0x1ba0c2);});}}catch(_0x294987){_0x471f4c(_0x294987);}});}function getPlugins(_0x2094f4){var _0x28a5c0=[];return new BPromise(function(_0x14a7e4,_0xdae58e){try{if(_0x2094f4[_0xfded('0x4e')]){return db['Plugin'][_0xfded('0x41')]({'raw':!![]})['then'](function(_0x42b04c){_0x42b04c[_0xfded('0x62')](function(_0x5a7df9){_0x28a5c0[_0xfded('0x59')](_0x5a7df9['id']+0x15b38);});_0x14a7e4(_0x28a5c0);});}else{return db['UserProfileResource'][_0xfded('0x41')]({'where':{'sectionId':_0x2094f4['id']},'raw':!![]})[_0xfded('0x24')](function(_0x5dc4b9){_0x5dc4b9[_0xfded('0x62')](function(_0x34ea0e){_0x28a5c0[_0xfded('0x59')](_0x34ea0e[_0xfded('0x63')]+0x15b38);});_0x14a7e4(_0x28a5c0);});}}catch(_0x36aac6){_0xdae58e(_0x36aac6);}});}exports['addResources']=function(_0x354c06,_0x345bc8){return db[_0xfded('0x2c')][_0xfded('0x46')]({'where':{'id':_0x354c06[_0xfded('0x44')]['id']}})[_0xfded('0x24')](handleEntityNotFound(_0x345bc8,null))[_0xfded('0x24')](function(_0xb22c60){if(_0xb22c60){return db['sequelize']['transaction'](function(_0x467323){return db[_0xfded('0x53')][_0xfded('0x41')]({'where':{'userProfileId':_0x354c06[_0xfded('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0xfded('0x24')](function(_0x4d7399){if(_0x4d7399){return db[_0xfded('0x53')][_0xfded('0x25')]({'where':{'userProfileId':_0x354c06[_0xfded('0x44')]['id'],'id':_['map'](_0x4d7399,function(_0x2e373b){return _0x2e373b['id'];})},'transaction':_0x467323});}})['then'](function(_0x2ae9a4){var _0x43ff77=_[_0xfded('0x2b')](_0x354c06[_0xfded('0x48')],function(_0x651179){_0x651179[_0xfded('0x52')]=_0x354c06[_0xfded('0x44')]['id'];return _0x651179;});return db['UserProfileSection'][_0xfded('0x64')](_0x43ff77,{'raw':!![],'transaction':_0x467323});})['then'](function(_0x45dd1c){var _0x58d60b=_[_0xfded('0x3b')](_[_0xfded('0x2b')](_0x45dd1c,function(_0x111b6c){return _0x111b6c['get']({'plain':!![]});}),{'includeAll':![]});if(_0x58d60b){return db[_0xfded('0x53')][_0xfded('0x41')]({'where':{'userProfileId':_0x354c06[_0xfded('0x44')]['id'],'sectionId':_[_0xfded('0x2b')](_0x58d60b,function(_0x273be9){return _0x273be9[_0xfded('0x51')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xfded('0x24')](function(_0x2c4a54){var _0x475785=_[_0xfded('0x2b')](_0x354c06[_0xfded('0x48')],function(_0x3e7beb){_0x3e7beb['userProfileId']=_0x354c06[_0xfded('0x44')]['id'];return _0x3e7beb;});return db['UserProfileResource'][_0xfded('0x64')](_0x475785,{'raw':!![],'transaction':_0x467323});});}})[_0xfded('0x42')](handleError(_0x345bc8,null));});}})['then'](function(_0x481c71){var _0x2f1560=_[_0xfded('0x2b')](_0x481c71,function(_0x4e6709){return _0x4e6709[_0xfded('0x49')]({'plain':!![]});});})[_0xfded('0x24')](respondWithResult(_0x345bc8,null))[_0xfded('0x42')](handleError(_0x345bc8,null));};exports['removeResources']=function(_0x163f2d,_0x6a321e,_0x550eb4){return db[_0xfded('0x2c')]['find']({'where':{'id':_0x163f2d['params']['id']}})[_0xfded('0x24')](handleEntityNotFound(_0x6a321e,null))[_0xfded('0x24')](function(_0x1a305c){if(_0x1a305c){return _0x1a305c[_0xfded('0x65')](_0x163f2d[_0xfded('0x32')][_0xfded('0x5b')]);}})[_0xfded('0x24')](respondWithStatusCode(_0x6a321e,null))[_0xfded('0x42')](handleError(_0x6a321e,null));};exports['getResources']=function(_0x53c3e8,_0x402968){var _0x316c9e={};if(!_0x53c3e8['query'][_0xfded('0x66')])throw new Error('Missing\x20section\x20parameter');if(!_0x53c3e8['query']['hasOwnProperty'](_0xfded('0x38'))){_0x316c9e[_0xfded('0x20')]=qs['limit'](_0x53c3e8['query'][_0xfded('0x20')]);_0x316c9e[_0xfded('0x1d')]=qs['offset'](_0x53c3e8[_0xfded('0x32')][_0xfded('0x1d')]);}return db['UserProfile'][_0xfded('0x46')]({'where':{'id':_0x53c3e8[_0xfded('0x44')]['id']}})[_0xfded('0x24')](function(_0x1d157c){if(!_0x1d157c)throw new Error(_0xfded('0x67')+_0x53c3e8[_0xfded('0x44')]['id']);return db[_0xfded('0x2c')][_0xfded('0x68')](_0x53c3e8);})[_0xfded('0x24')](respondWithFilteredResult(_0x402968,_0x316c9e))['catch'](handleError(_0x402968,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index b4d05e1..43b8b98 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 _0x2581=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x2581,0xcb));var _0x1258=function(_0x286480,_0x9181e8){_0x286480=_0x286480-0x0;var _0x26907b=_0x2581[_0x286480];return _0x26907b;};'use strict';var EventEmitter=require(_0x1258('0x0'));var UserProfile=require(_0x1258('0x1'))['db'][_0x1258('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1258('0x3')](0x0);var events={'afterCreate':_0x1258('0x4'),'afterUpdate':'update','afterDestroy':_0x1258('0x5')};function emitEvent(_0x1235e5){return function(_0x339891,_0xb54644,_0x3ad6b0){UserProfileEvents[_0x1258('0x6')](_0x1235e5+':'+_0x339891['id'],_0x339891);UserProfileEvents[_0x1258('0x6')](_0x1235e5,_0x339891);_0x3ad6b0(null);};}for(var e in events){if(events[_0x1258('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1258('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x7da6=['save','update','emit','hook','UserProfile','setMaxListeners'];(function(_0x5162e9,_0x55c047){var _0xea59da=function(_0x5e71ed){while(--_0x5e71ed){_0x5162e9['push'](_0x5162e9['shift']());}};_0xea59da(++_0x55c047);}(_0x7da6,0x124));var _0x67da=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x7da6[_0x3b56c0];return _0x377efe;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x67da('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x67da('0x1')](0x0);var events={'afterCreate':_0x67da('0x2'),'afterUpdate':_0x67da('0x3'),'afterDestroy':'remove'};function emitEvent(_0x42a2f3){return function(_0x282a52,_0x37ef9d,_0x2d4937){UserProfileEvents[_0x67da('0x4')](_0x42a2f3+':'+_0x282a52['id'],_0x282a52);UserProfileEvents[_0x67da('0x4')](_0x42a2f3,_0x282a52);_0x2d4937(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x67da('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d63ed68..0d70348 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 _0xfcff=['color','tag','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','exports','models','filter','field','value','findAll','associatedResources','map','model','name','catch','resolve','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','VoiceChanSpy','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','agents','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','pauses','sounds','Sound','Tag','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','then','define','user_profiles','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','include','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','CmContact','Tags'];(function(_0x24946d,_0x10ca22){var _0x536210=function(_0x3ec3c3){while(--_0x3ec3c3){_0x24946d['push'](_0x24946d['shift']());}};_0x536210(++_0x10ca22);}(_0xfcff,0x17f));var _0xffcf=function(_0x49f307,_0x3c77e3){_0x49f307=_0x49f307-0x0;var _0x23932a=_0xfcff[_0x49f307];return _0x23932a;};'use strict';var _=require('lodash');var attributes=require(_0xffcf('0x0'));var squel=require('squel');module[_0xffcf('0x1')]=function(_0x419f12){var _0x3ac320=_0x419f12[_0xffcf('0x2')];function _0x42a764(_0x2bad22,_0x124aa8){return new Promise(function(_0x558f53,_0x3a0d4e){if(!_0x124aa8)return _0x558f53(null);var _0x549e25=_0x124aa8[_0xffcf('0x3')]?{[_0x124aa8[_0xffcf('0x3')][_0xffcf('0x4')]]:_0x124aa8[_0xffcf('0x3')][_0xffcf('0x5')]}:undefined;return _0x3ac320[_0x2bad22][_0xffcf('0x6')]({'where':_0x549e25,'raw':!![]})['then'](function(_0x4c6db2){_0x124aa8[_0xffcf('0x7')]=_[_0xffcf('0x8')](_0x4c6db2,'id');_0x558f53(_0x124aa8);})['catch'](function(_0x4b8092){_0x3a0d4e(_0x4b8092);});});}function _0x3c2135(_0x230fd8,_0x3d788f){return new Promise(function(_0x3927c5,_0x3edbcf){var _0x46ac20=_0x230fd8[_0xffcf('0x3')]?{[_0x230fd8[_0xffcf('0x3')][_0xffcf('0x4')]]:_0x230fd8[_0xffcf('0x3')]['value']}:undefined;return _0x3ac320[_0x230fd8[_0xffcf('0x9')]]['findAll']({'where':_0x46ac20,'raw':!![]})['then'](function(_0x29bb91){_0x3d788f[_0xffcf('0x7')]=_[_0xffcf('0x8')](_0x29bb91,function(_0x14212e){return _0x14212e[_0xffcf('0xa')];});_0x3927c5(_0x3d788f);})[_0xffcf('0xb')](function(_0x253126){_0x3edbcf(_0x253126);});});}function _0xd44f34(_0x5a01f3,_0x5c692a,_0x386427){if(!_0x5c692a)return Promise[_0xffcf('0xc')](null);return new Promise(function(_0x3ebc64,_0x7ec093){return _0x3ac320['UserProfileResource'][_0xffcf('0x6')]({'where':{'sectionId':_0x5c692a['id']},'raw':!![]})['then'](function(_0x1759bb){if(_0x5a01f3[_0xffcf('0x4')]&&_0x5a01f3[_0xffcf('0x4')]!=='id'){_0x5c692a['associatedResources']=_[_0xffcf('0x8')](_0x1759bb,function(_0x29b0e5){return _0x29b0e5[_0x5a01f3[_0xffcf('0x4')]];});}else{if(_0x386427==='AnalyticExtractedReport'){_0x5c692a[_0xffcf('0x7')]=_[_0xffcf('0x8')](_0x1759bb,function(_0x17bfdc){return{'id':_0x17bfdc[_0xffcf('0xd')],'type':_0x17bfdc[_0xffcf('0xe')]};});}else{_0x5c692a[_0xffcf('0x7')]=_[_0xffcf('0x8')](_0x1759bb,function(_0x236de6){return _0x236de6[_0xffcf('0xd')];});}}_0x3ebc64(_0x5c692a);})[_0xffcf('0xb')](function(_0x18e2f8){_0x7ec093(_0x18e2f8);});});}function _0x17385c(_0x20df11,_0x5f2fec){var _0x5c51e4={'parentSections':[]};switch(_0x20df11[_0xffcf('0xf')]()){case _0xffcf('0x10'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x12');break;case _0xffcf('0x13'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x14');break;case'squarerecordings':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x15');_0x5c51e4[_0xffcf('0x16')]=[{'name':_0xffcf('0x17'),'field':_0xffcf('0xa'),'foreignKey':'projectName'}];break;case _0xffcf('0x18'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x19');break;case'contacts':_0x5c51e4[_0xffcf('0x11')]='CmContact';_0x5c51e4[_0xffcf('0x16')]=[{'name':_0xffcf('0x1a'),'field':'id','foreignKey':_0xffcf('0x1b')}];break;case _0xffcf('0x1c'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x1d');break;case _0xffcf('0x1e'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x1f');break;case'globalcustomfields':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x20');break;case _0xffcf('0x21'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x22');break;case _0xffcf('0x23'):_0x5c51e4['childModel']=_0xffcf('0x24');break;case _0xffcf('0x25'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x26');break;case _0xffcf('0x27'):_0x5c51e4['childModel']=_0xffcf('0x28');break;case _0xffcf('0x29'):case _0xffcf('0x2a'):case'outboundroutes':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x2b');break;case _0xffcf('0x2c'):_0x5c51e4[_0xffcf('0x11')]='VoiceContext';break;case'voicemails':_0x5c51e4['childModel']=_0xffcf('0x2d');break;case _0xffcf('0x2e'):_0x5c51e4['childModel']=_0xffcf('0x2f');_0x5c51e4[_0xffcf('0x16')]=[{'name':_0xffcf('0x30'),'field':'name','foreignKey':'membername','model':_0xffcf('0x31'),'filter':{'field':'role','value':[_0xffcf('0x32')]}},{'name':_0xffcf('0x33'),'field':_0xffcf('0xa'),'foreignKey':_0xffcf('0x34'),'model':'User','filter':{'field':_0xffcf('0x35'),'value':['telephone']}},{'name':_0xffcf('0x36'),'field':'name','foreignKey':_0xffcf('0x37'),'model':_0xffcf('0x38'),'filter':{'field':_0xffcf('0xe'),'value':[_0xffcf('0x39')]}},{'name':_0xffcf('0x3a'),'field':_0xffcf('0xa'),'foreignKey':_0xffcf('0x37'),'model':_0xffcf('0x38'),'filter':{'field':_0xffcf('0xe'),'value':['outbound']}}];break;case _0xffcf('0x3b'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x3c');break;case'chanspies':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x3d');break;case'voiceprefixes':_0x5c51e4[_0xffcf('0x11')]='VoicePrefix';break;case _0xffcf('0x3e'):_0x5c51e4[_0xffcf('0x11')]='Campaign';break;case'mailqueues':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x3f');break;case _0xffcf('0x40'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x41');break;case _0xffcf('0x42'):_0x5c51e4['childModel']=_0xffcf('0x43');break;case _0xffcf('0x44'):_0x5c51e4['childModel']=_0xffcf('0x45');break;case'openchannelaccounts':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x46');break;case _0xffcf('0x47'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x48');break;case'smsaccounts':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x49');break;case'whatsappqueues':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x4a');break;case _0xffcf('0x4b'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x4c');break;case _0xffcf('0x4d'):_0x5c51e4[_0xffcf('0x11')]='Team';break;case'voicequeues':case _0xffcf('0x4e'):_0x5c51e4[_0xffcf('0x11')]='VoiceQueue';if(_0x5f2fec){_0x5c51e4['parentSections']=[{'name':'VoiceQueues'},{'name':_0xffcf('0x3a')}];}break;case'users':case _0xffcf('0x4f'):case'telephones':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x31');if(_0x5f2fec){_0x5c51e4[_0xffcf('0x16')]=[{'name':'Users','filter':{'field':_0xffcf('0x35'),'value':[_0xffcf('0x50'),_0xffcf('0x51')]},'ignore':!![]},{'name':_0xffcf('0x30')},{'name':'Telephones'}];}break;case _0xffcf('0x52'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x53');break;case _0xffcf('0x54'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x55');break;case _0xffcf('0x56'):_0x5c51e4['childModel']=_0xffcf('0x57');break;case _0xffcf('0x58'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x59');break;case _0xffcf('0x5a'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x5b');break;case'zohoaccounts':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x5c');break;case'vtigeraccounts':_0x5c51e4[_0xffcf('0x11')]='User';break;case _0xffcf('0x5d'):_0x5c51e4['childModel']=_0xffcf('0x5e');break;case _0xffcf('0x5f'):_0x5c51e4['childModel']='Disposition';break;case _0xffcf('0x60'):_0x5c51e4[_0xffcf('0x11')]='Dashboard';break;case _0xffcf('0x61'):_0x5c51e4[_0xffcf('0x11')]='Interval';break;case _0xffcf('0x62'):_0x5c51e4[_0xffcf('0x11')]='Pause';break;case'scheduler':_0x5c51e4[_0xffcf('0x11')]='Schedule';break;case _0xffcf('0x63'):_0x5c51e4['childModel']=_0xffcf('0x64');break;case'tags':_0x5c51e4['childModel']=_0xffcf('0x65');break;case'templates':_0x5c51e4[_0xffcf('0x11')]='Template';break;case'triggers':_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x66');break;case _0xffcf('0x67'):_0x5c51e4['childModel']=_0xffcf('0x68');break;case _0xffcf('0x69'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x6a');break;case _0xffcf('0x6b'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x6c');break;case _0xffcf('0x6d'):_0x5c51e4[_0xffcf('0x11')]='AnalyticExtractedReport';_0x5c51e4[_0xffcf('0x16')]=[{'name':_0xffcf('0x6e'),'field':'id','foreignKey':_0xffcf('0x6f')}];break;case _0xffcf('0x70'):_0x5c51e4[_0xffcf('0x11')]=_0xffcf('0x71');break;}return _0x5c51e4;}function _0x2e08ef(_0x535f64,_0x4b9550){var _0x471839=_0x535f64[_0xffcf('0x72')](0x0)[_0xffcf('0x73')]()+_0x535f64['slice'](0x1);var _0x52993b={'type':_0x3ac320[_0xffcf('0x74')][_0xffcf('0x75')][_0xffcf('0x76')],'raw':!![]};return new Promise(function(_0x1501e0,_0x57a51e){var _0x272246=squel[_0xffcf('0x77')]()[_0xffcf('0x4')](_0xffcf('0x78')+_0x471839+_0xffcf('0x79'),'id')[_0xffcf('0x4')](_0xffcf('0x7a'))[_0xffcf('0x7b')](_0xffcf('0x7c')+_0x535f64+_0xffcf('0x7d'),'ui')[_0xffcf('0x7e')](_0xffcf('0x7f'),_0x4b9550['id']);return _0x3ac320[_0xffcf('0x80')][_0xffcf('0x81')](_0x272246[_0xffcf('0x82')](),_0x52993b)[_0xffcf('0x83')](function(_0x49aa0f){_0x4b9550[_0x471839+'OpenTabs']=_0x49aa0f;_0x1501e0(_0x49aa0f);})[_0xffcf('0xb')](function(_0x7cf145){_0x57a51e(_0x7cf145);});});}return _0x419f12[_0xffcf('0x84')]('UserProfile',attributes,{'tableName':_0xffcf('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x590759){var _0x4221e0=require('../../components/parsers/qs');var _0x477985={'raw':_0x590759[_0xffcf('0x81')]['raw'],'where':{}};var _0x68182c={};var _0x598b03={'count':0x0,'rows':[]};var _0x15f839=_0x590759[_0xffcf('0x81')][_0xffcf('0x86')];var _0x16af8a=_0x590759[_0xffcf('0x81')]['mergeResources']||![];var _0x6936f2=_0x17385c(_0x15f839,_0x16af8a);if(!_0x6936f2['childModel'])throw new Error(_0xffcf('0x87')+_0x15f839+'\x27');var _0x165f11=[{'name':_0x15f839}];if(!_[_0xffcf('0x88')](_0x6936f2[_0xffcf('0x16')]))_0x165f11=_0x6936f2['parentSections'];var _0x194bf4=[];for(var _0x9ee69a=0x0;_0x9ee69a<_0x165f11[_0xffcf('0x89')];_0x9ee69a++){_0x194bf4[_0xffcf('0x8a')](_0x3ac320[_0xffcf('0x8b')][_0xffcf('0x8c')]({'where':{'userProfileId':_0x590759[_0xffcf('0x8d')]['id'],'name':_0x165f11[_0x9ee69a][_0xffcf('0xa')]},'raw':!![]}));}return Promise[_0xffcf('0x8e')](_0x194bf4)[_0xffcf('0x83')](function(_0x900b68){var _0x40c6f6=_[_0xffcf('0x3')](_0x900b68,function(_0x53d61f){return _0x53d61f?_0x53d61f:undefined;});var _0x142239=_['filter'](_0x165f11,[_0xffcf('0x8f'),!![]]);var _0x1ee6c2=_[_0xffcf('0x88')](_0x40c6f6)&&_[_0xffcf('0x88')](_0x142239)?null:_['union'](_0x142239,_0x40c6f6);if(!_0x1ee6c2)return null;var _0x55c369=[];for(var _0x5c151a=0x0;_0x5c151a<_0x1ee6c2[_0xffcf('0x89')];_0x5c151a++){var _0x26a45b=_[_0xffcf('0x8c')](_0x165f11,function(_0x5b34c3){return _0x1ee6c2[_0x5c151a]?_0x5b34c3[_0xffcf('0xa')]===_0x1ee6c2[_0x5c151a]['name']:null;});if(_0x26a45b){if(_0x1ee6c2[_0x5c151a][_0xffcf('0x8f')]){_0x55c369['push'](_0x42a764(_0x6936f2[_0xffcf('0x11')],_0x1ee6c2[_0x5c151a]));}else{if(!_0x1ee6c2[_0x5c151a][_0xffcf('0x90')]){_0x55c369['push'](_0xd44f34(_0x26a45b,_0x1ee6c2[_0x5c151a],_0x6936f2[_0xffcf('0x11')]));}else{if(_0x26a45b[_0xffcf('0x9')]){_0x55c369['push'](_0x3c2135(_0x26a45b,_0x1ee6c2[_0x5c151a]));}}}}}return Promise['all'](_0x55c369);})[_0xffcf('0x83')](function(_0x427c01){var _0x2cb9a8=_0x427c01;var _0x3b4cf8=null;if(_0x2cb9a8){_0x3b4cf8=_0x2cb9a8[_0xffcf('0x89')]===0x1?_0x2cb9a8[0x0]:null;}if(!_0x3b4cf8&&!_0x2cb9a8)return _0x598b03;var _0x28d8d2=_0x3ac320[_0x6936f2[_0xffcf('0x11')]][_0xffcf('0x91')];_0x68182c[_0xffcf('0x9')]=_[_0xffcf('0x92')](_0x28d8d2);_0x68182c['query']=_[_0xffcf('0x92')](_0x590759[_0xffcf('0x81')]);_0x68182c['filters']=_[_0xffcf('0x93')](_0x68182c[_0xffcf('0x9')],_0x68182c['query']);_0x477985[_0xffcf('0x94')]=_['intersection'](_0x68182c[_0xffcf('0x9')],_0x4221e0[_0xffcf('0x95')](_0x590759['query']['fields']));_0x477985['attributes']=_0x477985['attributes']['length']?_0x477985['attributes']:_0x68182c[_0xffcf('0x9')];if(!_0x590759['query'][_0xffcf('0x96')]('nolimit')){_0x477985['limit']=_0x4221e0[_0xffcf('0x97')](_0x590759[_0xffcf('0x81')]['limit']);_0x477985[_0xffcf('0x98')]=_0x4221e0[_0xffcf('0x98')](_0x590759[_0xffcf('0x81')][_0xffcf('0x98')]);}_0x477985[_0xffcf('0x99')]=_0x4221e0['sort'](_0x590759['query'][_0xffcf('0x9a')]);_0x477985['where']=_0x4221e0[_0xffcf('0x9b')](_[_0xffcf('0x9c')](_0x590759[_0xffcf('0x81')],_0x68182c[_0xffcf('0x9b')]));if(_0x590759[_0xffcf('0x81')]['filter']){_0x477985[_0xffcf('0x7e')]=_[_0xffcf('0x9d')](_0x477985[_0xffcf('0x7e')],{'$or':_[_0xffcf('0x8')](_0x28d8d2,function(_0x142f08){if(_0x142f08[_0xffcf('0xe')][_0xffcf('0x9e')]!==_0xffcf('0x9f')){var _0x16b875={};_0x16b875[_0x142f08[_0xffcf('0x4')]]={'$like':'%'+_0x590759[_0xffcf('0x81')][_0xffcf('0x3')]+'%'};return _0x16b875;}})});}var _0x24ff0c=[];var _0xf07489=null;var _0x231640={};if(_0x3b4cf8){_0xf07489=_[_0xffcf('0x8c')](_0x165f11,[_0xffcf('0xa'),_0x3b4cf8[_0xffcf('0xa')]]);if(_0xf07489['field']){_0x231640={};if(_0x6936f2['childModel']===_0xffcf('0xa0')){_0x231640[_0xf07489[_0xffcf('0xa1')]]=_[_0xffcf('0x8')](_0x3b4cf8[_0xffcf('0x7')],'id');}else{_0x231640[_0xf07489[_0xffcf('0xa1')]]=_0x3b4cf8['associatedResources'];}_0x24ff0c[_0xffcf('0x8a')](_0x231640);}else{_0x477985[_0xffcf('0x7e')]['id']=_0x3b4cf8['associatedResources'];}}else{for(var _0x296df7=0x0;_0x296df7<_0x2cb9a8[_0xffcf('0x89')];_0x296df7++){_0xf07489=_['find'](_0x165f11,[_0xffcf('0xa'),_0x2cb9a8[_0x296df7][_0xffcf('0xa')]]);if(_0xf07489[_0xffcf('0x4')]){_0x231640={};_0x231640[_0xf07489[_0xffcf('0xa1')]]=_0x2cb9a8[_0x296df7]['associatedResources'];_0x24ff0c[_0xffcf('0x8a')](_0x231640);}else{if(!_0x477985[_0xffcf('0x7e')]['id'])_0x477985['where']['id']=[];_0x2cb9a8[_0x296df7][_0xffcf('0x7')][_0xffcf('0xa2')](function(_0x2668fe){_0x477985[_0xffcf('0x7e')]['id'][_0xffcf('0x8a')](_0x2668fe);});}}}if(!_[_0xffcf('0x88')](_0x24ff0c)){_0x477985[_0xffcf('0x7e')]=_['merge'](_0x477985['where'],{'$and':{'$or':_0x24ff0c}});}_0x477985=_[_0xffcf('0x9d')]({},_0x477985,_0x590759[_0xffcf('0xa3')]);if(_0x3b4cf8&&!_0x3b4cf8[_0xffcf('0x90')]&&_0x6936f2['childModel']===_0xffcf('0xa0')){if(_0x590759[_0xffcf('0x81')]['includeAll']){_0x477985[_0xffcf('0xa4')]=[{'all':!![]}];}return _0x3ac320[_0x6936f2[_0xffcf('0x11')]][_0xffcf('0x6')](_0x477985)[_0xffcf('0x83')](function(_0x370027){var _0x378977=[];_0x370027[_0xffcf('0xa2')](function(_0xd07bd0){var _0x5df169;switch(_0xd07bd0['reportType']){case'default':_0x5df169=_['find'](_0x3b4cf8['associatedResources'],function(_0x36511f){return _0x36511f['id']===_0xd07bd0['reportId']&&_0x36511f['type']===_0xffcf('0xa5');});break;case _0xffcf('0xa6'):_0x5df169=_[_0xffcf('0x8c')](_0x3b4cf8[_0xffcf('0x7')],function(_0x1f6c33){return _0x1f6c33['id']===_0xd07bd0['reportId']&&_0x1f6c33[_0xffcf('0xe')]===_0xffcf('0xa7');});break;}if(_0x5df169)_0x378977[_0xffcf('0x8a')](_0xd07bd0);});_0x598b03['count']=_0x378977[_0xffcf('0x89')];_0x598b03[_0xffcf('0xa8')]=_0x378977;return _0x598b03;});}else{if(!_[_0xffcf('0x88')](_0x590759[_0xffcf('0x81')][_0xffcf('0xa9')])){_0x477985[_0xffcf('0x7e')]['id']=_0x477985[_0xffcf('0x7e')]['id']?_[_0xffcf('0x93')](_0x477985[_0xffcf('0x7e')]['id'],_0x590759[_0xffcf('0x81')][_0xffcf('0xa9')]):_0x590759[_0xffcf('0x81')][_0xffcf('0xa9')];if(_0x590759[_0xffcf('0x81')]['customSorting']){_0x477985['order']=_0x590759[_0xffcf('0x81')][_0xffcf('0xaa')];}}if(_0x590759[_0xffcf('0x81')][_0xffcf('0xab')]){_0x477985[_0xffcf('0x7e')]=_[_0xffcf('0x9d')](_0x477985['where'],{'$and':_0x590759[_0xffcf('0x81')]['extraQueryConditions']});}return _0x3ac320[_0x6936f2[_0xffcf('0x11')]][_0xffcf('0xac')]({'where':_0x477985[_0xffcf('0x7e')]})[_0xffcf('0x83')](function(_0xa917d7){_0x598b03[_0xffcf('0xac')]=_0xa917d7;if(_0x590759[_0xffcf('0x81')]['includeAll']){if(_0x6936f2['childModel']===_0xffcf('0xad')){_0x477985[_0xffcf('0xa4')]=[{'model':_0x3ac320[_0xffcf('0x65')],'as':_0xffcf('0xae'),'attributes':['id',_0xffcf('0xa'),'color'],'required':_0x590759['query']['tag']?!![]:![]},{'model':_0x3ac320[_0xffcf('0x65')],'as':'ThroughTags','attributes':['id','name',_0xffcf('0xaf')],'through':_0x590759['query'][_0xffcf('0xb0')]?{'attributes':[],'where':{'TagId':_0x590759[_0xffcf('0x81')]['tag']||undefined}}:{},'required':_0x590759['query']['tag']?!![]:![]}];}else{_0x477985[_0xffcf('0xa4')]=[{'all':!![]}];}}return _0x3ac320[_0x6936f2[_0xffcf('0x11')]][_0xffcf('0x6')](_0x477985);})[_0xffcf('0x83')](function(_0x1e4223){_0x598b03[_0xffcf('0xa8')]=_0x1e4223;if(_0x15f839==='Agents'&&_0x590759[_0xffcf('0x81')][_0xffcf('0xb1')]===_0xffcf('0xb2')){var _0xb99881=[];for(var _0x7b495a=0x0;_0x7b495a<_0x598b03['rows'][_0xffcf('0x89')];_0x7b495a++){_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb3'),_0x598b03[_0xffcf('0xa8')][_0x7b495a]['dataValues']));_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb4'),_0x598b03['rows'][_0x7b495a][_0xffcf('0xb5')]));_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb6'),_0x598b03[_0xffcf('0xa8')][_0x7b495a][_0xffcf('0xb5')]));_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb7'),_0x598b03[_0xffcf('0xa8')][_0x7b495a]['dataValues']));_0xb99881['push'](_0x2e08ef(_0xffcf('0xb8'),_0x598b03[_0xffcf('0xa8')][_0x7b495a]['dataValues']));_0xb99881[_0xffcf('0x8a')](_0x2e08ef(_0xffcf('0xb9'),_0x598b03[_0xffcf('0xa8')][_0x7b495a][_0xffcf('0xb5')]));}return Promise[_0xffcf('0x8e')](_0xb99881)[_0xffcf('0x83')](function(){return _0x598b03;});}return _0x598b03;});}});}}});}; \ No newline at end of file +var _0xdfe9=['field','model','map','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','Users','admin','user','Telephones','ZendeskAccount','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','scheduler','sounds','Sound','tags','templates','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','define','user_profiles','../../components/parsers/qs','raw','section','mergeResources','isEmpty','push','UserProfileSection','params','all','ignore','union','length','find','rawAttributes','keys','filters','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','foreignKey','merge','options','autoAssociation','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','rows','ids','extraQueryConditions','count','CmContact','Tag','Tags','tag','ThroughTags','color','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','value','findAll','then','associatedResources'];(function(_0x1dc30b,_0x56f3a8){var _0x113ce3=function(_0xad8c59){while(--_0xad8c59){_0x1dc30b['push'](_0x1dc30b['shift']());}};_0x113ce3(++_0x56f3a8);}(_0xdfe9,0x171));var _0x9dfe=function(_0x9f3229,_0x586422){_0x9f3229=_0x9f3229-0x0;var _0x387891=_0xdfe9[_0x9f3229];return _0x387891;};'use strict';var _=require(_0x9dfe('0x0'));var attributes=require(_0x9dfe('0x1'));var squel=require(_0x9dfe('0x2'));module[_0x9dfe('0x3')]=function(_0x4dcfc0){var _0x4a7f81=_0x4dcfc0['models'];function _0x283246(_0x42f0d6,_0x28fb14){return new Promise(function(_0x11517a,_0x69801b){if(!_0x28fb14)return _0x11517a(null);var _0x33a386=_0x28fb14['filter']?{[_0x28fb14[_0x9dfe('0x4')]['field']]:_0x28fb14[_0x9dfe('0x4')][_0x9dfe('0x5')]}:undefined;return _0x4a7f81[_0x42f0d6][_0x9dfe('0x6')]({'where':_0x33a386,'raw':!![]})[_0x9dfe('0x7')](function(_0x47709f){_0x28fb14[_0x9dfe('0x8')]=_['map'](_0x47709f,'id');_0x11517a(_0x28fb14);})['catch'](function(_0x14ba2a){_0x69801b(_0x14ba2a);});});}function _0x317c26(_0x368b47,_0x51cc0c){return new Promise(function(_0xc22943,_0x30d29f){var _0x2b2c17=_0x368b47[_0x9dfe('0x4')]?{[_0x368b47['filter'][_0x9dfe('0x9')]]:_0x368b47[_0x9dfe('0x4')][_0x9dfe('0x5')]}:undefined;return _0x4a7f81[_0x368b47[_0x9dfe('0xa')]]['findAll']({'where':_0x2b2c17,'raw':!![]})[_0x9dfe('0x7')](function(_0x54d3f3){_0x51cc0c['associatedResources']=_[_0x9dfe('0xb')](_0x54d3f3,function(_0x5393d9){return _0x5393d9['name'];});_0xc22943(_0x51cc0c);})['catch'](function(_0x3eac2c){_0x30d29f(_0x3eac2c);});});}function _0x2299a1(_0x45d1e4,_0x38654a,_0x3f4008){if(!_0x38654a)return Promise[_0x9dfe('0xc')](null);return new Promise(function(_0x5e2723,_0x2c7003){return _0x4a7f81[_0x9dfe('0xd')][_0x9dfe('0x6')]({'where':{'sectionId':_0x38654a['id']},'raw':!![]})['then'](function(_0x2eb34f){if(_0x45d1e4[_0x9dfe('0x9')]&&_0x45d1e4[_0x9dfe('0x9')]!=='id'){_0x38654a[_0x9dfe('0x8')]=_[_0x9dfe('0xb')](_0x2eb34f,function(_0x1d6653){return _0x1d6653[_0x45d1e4[_0x9dfe('0x9')]];});}else{if(_0x3f4008===_0x9dfe('0xe')){_0x38654a['associatedResources']=_[_0x9dfe('0xb')](_0x2eb34f,function(_0x50a867){return{'id':_0x50a867[_0x9dfe('0xf')],'type':_0x50a867[_0x9dfe('0x10')]};});}else{_0x38654a[_0x9dfe('0x8')]=_[_0x9dfe('0xb')](_0x2eb34f,function(_0x18ea02){return _0x18ea02[_0x9dfe('0xf')];});}}_0x5e2723(_0x38654a);})['catch'](function(_0xeee61c){_0x2c7003(_0xeee61c);});});}function _0x40fd90(_0x5799df,_0x1bb74a){var _0x1eaf4a={'parentSections':[]};switch(_0x5799df[_0x9dfe('0x11')]()){case _0x9dfe('0x12'):_0x1eaf4a[_0x9dfe('0x13')]='SquareProject';break;case _0x9dfe('0x14'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x15');break;case'squarerecordings':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x16');_0x1eaf4a[_0x9dfe('0x17')]=[{'name':_0x9dfe('0x18'),'field':_0x9dfe('0x19'),'foreignKey':_0x9dfe('0x1a')}];break;case _0x9dfe('0x1b'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x1c');break;case _0x9dfe('0x1d'):_0x1eaf4a[_0x9dfe('0x13')]='CmContact';_0x1eaf4a['parentSections']=[{'name':_0x9dfe('0x1e'),'field':'id','foreignKey':_0x9dfe('0x1f')}];break;case _0x9dfe('0x20'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x21');break;case _0x9dfe('0x22'):_0x1eaf4a['childModel']='CmCompany';break;case'globalcustomfields':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x23');break;case _0x9dfe('0x24'):_0x1eaf4a['childModel']=_0x9dfe('0x25');break;case'chatwebsites':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x26');break;case _0x9dfe('0x27'):_0x1eaf4a[_0x9dfe('0x13')]='FaxQueue';break;case _0x9dfe('0x28'):_0x1eaf4a['childModel']=_0x9dfe('0x29');break;case'inboundroutes':case _0x9dfe('0x2a'):case _0x9dfe('0x2b'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x2c');break;case _0x9dfe('0x2d'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x2e');break;case _0x9dfe('0x2f'):_0x1eaf4a[_0x9dfe('0x13')]='VoiceMail';break;case _0x9dfe('0x30'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x31');_0x1eaf4a['parentSections']=[{'name':_0x9dfe('0x32'),'field':_0x9dfe('0x19'),'foreignKey':_0x9dfe('0x33'),'model':_0x9dfe('0x34'),'filter':{'field':_0x9dfe('0x35'),'value':['agent']}},{'name':'Telephones','field':_0x9dfe('0x19'),'foreignKey':_0x9dfe('0x33'),'model':_0x9dfe('0x34'),'filter':{'field':_0x9dfe('0x35'),'value':[_0x9dfe('0x36')]}},{'name':_0x9dfe('0x37'),'field':'name','foreignKey':_0x9dfe('0x38'),'model':_0x9dfe('0x39'),'filter':{'field':_0x9dfe('0x10'),'value':[_0x9dfe('0x3a')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x9dfe('0x38'),'model':_0x9dfe('0x39'),'filter':{'field':_0x9dfe('0x10'),'value':[_0x9dfe('0x3b')]}}];break;case'musiconholds':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x3c');break;case _0x9dfe('0x3d'):_0x1eaf4a['childModel']=_0x9dfe('0x3e');break;case _0x9dfe('0x3f'):_0x1eaf4a['childModel']=_0x9dfe('0x40');break;case _0x9dfe('0x41'):_0x1eaf4a['childModel']='Campaign';break;case'mailqueues':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x42');break;case _0x9dfe('0x43'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x44');break;case'mailsubstatuses':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x45');break;case'openchannelqueues':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x46');break;case _0x9dfe('0x47'):_0x1eaf4a['childModel']='OpenchannelAccount';break;case'smsqueues':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x48');break;case _0x9dfe('0x49'):_0x1eaf4a['childModel']='SmsAccount';break;case _0x9dfe('0x4a'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x4b');break;case _0x9dfe('0x4c'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x4d');break;case _0x9dfe('0x4e'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x4f');break;case _0x9dfe('0x50'):case _0x9dfe('0x51'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x39');if(_0x1bb74a){_0x1eaf4a[_0x9dfe('0x17')]=[{'name':_0x9dfe('0x37')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case'telephones':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x34');if(_0x1bb74a){_0x1eaf4a[_0x9dfe('0x17')]=[{'name':_0x9dfe('0x52'),'filter':{'field':_0x9dfe('0x35'),'value':[_0x9dfe('0x53'),_0x9dfe('0x54')]},'ignore':!![]},{'name':_0x9dfe('0x32')},{'name':_0x9dfe('0x55')}];}break;case'zendeskaccounts':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x56');break;case _0x9dfe('0x57'):_0x1eaf4a['childModel']='SalesforceAccount';break;case _0x9dfe('0x58'):_0x1eaf4a[_0x9dfe('0x13')]='FreshdeskAccount';break;case _0x9dfe('0x59'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x5a');break;case _0x9dfe('0x5b'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x5c');break;case _0x9dfe('0x5d'):_0x1eaf4a[_0x9dfe('0x13')]='ZohoAccount';break;case _0x9dfe('0x5e'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x34');break;case'cannedanswers':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x5f');break;case _0x9dfe('0x60'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x61');break;case _0x9dfe('0x62'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x63');break;case _0x9dfe('0x64'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x65');break;case'pauses':_0x1eaf4a['childModel']='Pause';break;case _0x9dfe('0x66'):_0x1eaf4a[_0x9dfe('0x13')]='Schedule';break;case _0x9dfe('0x67'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x68');break;case _0x9dfe('0x69'):_0x1eaf4a[_0x9dfe('0x13')]='Tag';break;case _0x9dfe('0x6a'):_0x1eaf4a[_0x9dfe('0x13')]='Template';break;case'triggers':_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x6b');break;case _0x9dfe('0x6c'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x6d');break;case _0x9dfe('0x6e'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x6f');break;case _0x9dfe('0x70'):_0x1eaf4a[_0x9dfe('0x13')]='Plugin';break;case'extractedreports':_0x1eaf4a['childModel']=_0x9dfe('0xe');_0x1eaf4a[_0x9dfe('0x17')]=[{'name':_0x9dfe('0x71'),'field':'id','foreignKey':_0x9dfe('0x72')}];break;case _0x9dfe('0x73'):_0x1eaf4a[_0x9dfe('0x13')]=_0x9dfe('0x74');break;}return _0x1eaf4a;}function _0x2edba4(_0x2d56b0,_0x31edf4){var _0x324725=_0x2d56b0[_0x9dfe('0x75')](0x0)['toUpperCase']()+_0x2d56b0[_0x9dfe('0x76')](0x1);var _0x3045c3={'type':_0x4a7f81[_0x9dfe('0x77')][_0x9dfe('0x78')]['SELECT'],'raw':!![]};return new Promise(function(_0x4f708a,_0x4a6b9a){var _0x29b41d=squel[_0x9dfe('0x79')]()[_0x9dfe('0x9')](_0x9dfe('0x7a')+_0x324725+_0x9dfe('0x7b'),'id')[_0x9dfe('0x9')](_0x9dfe('0x7c'))[_0x9dfe('0x7d')](_0x9dfe('0x7e')+_0x2d56b0+_0x9dfe('0x7f'),'ui')[_0x9dfe('0x80')](_0x9dfe('0x81'),_0x31edf4['id']);return _0x4a7f81[_0x9dfe('0x82')][_0x9dfe('0x83')](_0x29b41d['toString'](),_0x3045c3)['then'](function(_0x26b7b4){_0x31edf4[_0x324725+'OpenTabs']=_0x26b7b4;_0x4f708a(_0x26b7b4);})['catch'](function(_0x4b8c0c){_0x4a6b9a(_0x4b8c0c);});});}return _0x4dcfc0[_0x9dfe('0x84')]('UserProfile',attributes,{'tableName':_0x9dfe('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x102c7c){var _0x1eebc9=require(_0x9dfe('0x86'));var _0x4b054a={'raw':_0x102c7c['query'][_0x9dfe('0x87')],'where':{}};var _0x47c148={};var _0x5ef7c0={'count':0x0,'rows':[]};var _0x5d097d=_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0x88')];var _0x4c57e1=_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0x89')]||![];var _0x27ddc2=_0x40fd90(_0x5d097d,_0x4c57e1);if(!_0x27ddc2[_0x9dfe('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x5d097d+'\x27');var _0x2172ad=[{'name':_0x5d097d}];if(!_[_0x9dfe('0x8a')](_0x27ddc2[_0x9dfe('0x17')]))_0x2172ad=_0x27ddc2['parentSections'];var _0x51264d=[];for(var _0x145de6=0x0;_0x145de6<_0x2172ad['length'];_0x145de6++){_0x51264d[_0x9dfe('0x8b')](_0x4a7f81[_0x9dfe('0x8c')]['find']({'where':{'userProfileId':_0x102c7c[_0x9dfe('0x8d')]['id'],'name':_0x2172ad[_0x145de6][_0x9dfe('0x19')]},'raw':!![]}));}return Promise[_0x9dfe('0x8e')](_0x51264d)[_0x9dfe('0x7')](function(_0x211a25){var _0x557d00=_[_0x9dfe('0x4')](_0x211a25,function(_0x4c2a82){return _0x4c2a82?_0x4c2a82:undefined;});var _0x200806=_['filter'](_0x2172ad,[_0x9dfe('0x8f'),!![]]);var _0x7cbf2f=_['isEmpty'](_0x557d00)&&_[_0x9dfe('0x8a')](_0x200806)?null:_[_0x9dfe('0x90')](_0x200806,_0x557d00);if(!_0x7cbf2f)return null;var _0x41adbe=[];for(var _0x2e11a3=0x0;_0x2e11a3<_0x7cbf2f[_0x9dfe('0x91')];_0x2e11a3++){var _0x47121f=_[_0x9dfe('0x92')](_0x2172ad,function(_0xdae4f3){return _0x7cbf2f[_0x2e11a3]?_0xdae4f3[_0x9dfe('0x19')]===_0x7cbf2f[_0x2e11a3][_0x9dfe('0x19')]:null;});if(_0x47121f){if(_0x7cbf2f[_0x2e11a3][_0x9dfe('0x8f')]){_0x41adbe[_0x9dfe('0x8b')](_0x283246(_0x27ddc2[_0x9dfe('0x13')],_0x7cbf2f[_0x2e11a3]));}else{if(!_0x7cbf2f[_0x2e11a3]['autoAssociation']){_0x41adbe[_0x9dfe('0x8b')](_0x2299a1(_0x47121f,_0x7cbf2f[_0x2e11a3],_0x27ddc2[_0x9dfe('0x13')]));}else{if(_0x47121f['model']){_0x41adbe[_0x9dfe('0x8b')](_0x317c26(_0x47121f,_0x7cbf2f[_0x2e11a3]));}}}}}return Promise[_0x9dfe('0x8e')](_0x41adbe);})[_0x9dfe('0x7')](function(_0x4c0951){var _0x342ddc=_0x4c0951;var _0x13e1f2=null;if(_0x342ddc){_0x13e1f2=_0x342ddc['length']===0x1?_0x342ddc[0x0]:null;}if(!_0x13e1f2&&!_0x342ddc)return _0x5ef7c0;var _0x2d2457=_0x4a7f81[_0x27ddc2[_0x9dfe('0x13')]][_0x9dfe('0x93')];_0x47c148[_0x9dfe('0xa')]=_[_0x9dfe('0x94')](_0x2d2457);_0x47c148[_0x9dfe('0x83')]=_[_0x9dfe('0x94')](_0x102c7c[_0x9dfe('0x83')]);_0x47c148[_0x9dfe('0x95')]=_[_0x9dfe('0x96')](_0x47c148[_0x9dfe('0xa')],_0x47c148[_0x9dfe('0x83')]);_0x4b054a['attributes']=_[_0x9dfe('0x96')](_0x47c148[_0x9dfe('0xa')],_0x1eebc9['fields'](_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0x97')]));_0x4b054a[_0x9dfe('0x98')]=_0x4b054a[_0x9dfe('0x98')][_0x9dfe('0x91')]?_0x4b054a[_0x9dfe('0x98')]:_0x47c148[_0x9dfe('0xa')];if(!_0x102c7c[_0x9dfe('0x83')]['hasOwnProperty'](_0x9dfe('0x99'))){_0x4b054a[_0x9dfe('0x9a')]=_0x1eebc9[_0x9dfe('0x9a')](_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0x9a')]);_0x4b054a[_0x9dfe('0x9b')]=_0x1eebc9[_0x9dfe('0x9b')](_0x102c7c[_0x9dfe('0x83')]['offset']);}_0x4b054a[_0x9dfe('0x9c')]=_0x1eebc9[_0x9dfe('0x9d')](_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0x9d')]);_0x4b054a[_0x9dfe('0x80')]=_0x1eebc9['filters'](_[_0x9dfe('0x9e')](_0x102c7c[_0x9dfe('0x83')],_0x47c148[_0x9dfe('0x95')]));if(_0x102c7c[_0x9dfe('0x83')]['filter']){_0x4b054a['where']=_['merge'](_0x4b054a[_0x9dfe('0x80')],{'$or':_[_0x9dfe('0xb')](_0x2d2457,function(_0x11fdc5){if(_0x11fdc5['type']['key']!=='VIRTUAL'){var _0x790e35={};_0x790e35[_0x11fdc5[_0x9dfe('0x9')]]={'$like':'%'+_0x102c7c[_0x9dfe('0x83')]['filter']+'%'};return _0x790e35;}})});}var _0xe738ad=[];var _0x591001=null;var _0xcb4686={};if(_0x13e1f2){_0x591001=_['find'](_0x2172ad,[_0x9dfe('0x19'),_0x13e1f2[_0x9dfe('0x19')]]);if(_0x591001[_0x9dfe('0x9')]){_0xcb4686={};if(_0x27ddc2[_0x9dfe('0x13')]===_0x9dfe('0xe')){_0xcb4686[_0x591001[_0x9dfe('0x9f')]]=_['map'](_0x13e1f2[_0x9dfe('0x8')],'id');}else{_0xcb4686[_0x591001[_0x9dfe('0x9f')]]=_0x13e1f2[_0x9dfe('0x8')];}_0xe738ad['push'](_0xcb4686);}else{_0x4b054a['where']['id']=_0x13e1f2[_0x9dfe('0x8')];}}else{for(var _0x14a3f5=0x0;_0x14a3f5<_0x342ddc[_0x9dfe('0x91')];_0x14a3f5++){_0x591001=_[_0x9dfe('0x92')](_0x2172ad,[_0x9dfe('0x19'),_0x342ddc[_0x14a3f5]['name']]);if(_0x591001[_0x9dfe('0x9')]){_0xcb4686={};_0xcb4686[_0x591001[_0x9dfe('0x9f')]]=_0x342ddc[_0x14a3f5][_0x9dfe('0x8')];_0xe738ad[_0x9dfe('0x8b')](_0xcb4686);}else{if(!_0x4b054a['where']['id'])_0x4b054a[_0x9dfe('0x80')]['id']=[];_0x342ddc[_0x14a3f5][_0x9dfe('0x8')]['forEach'](function(_0x25f96f){_0x4b054a[_0x9dfe('0x80')]['id'][_0x9dfe('0x8b')](_0x25f96f);});}}}if(!_['isEmpty'](_0xe738ad)){_0x4b054a[_0x9dfe('0x80')]=_[_0x9dfe('0xa0')](_0x4b054a['where'],{'$and':{'$or':_0xe738ad}});}_0x4b054a=_[_0x9dfe('0xa0')]({},_0x4b054a,_0x102c7c[_0x9dfe('0xa1')]);if(_0x13e1f2&&!_0x13e1f2[_0x9dfe('0xa2')]&&_0x27ddc2[_0x9dfe('0x13')]===_0x9dfe('0xe')){if(_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xa3')]){_0x4b054a[_0x9dfe('0xa4')]=[{'all':!![]}];}return _0x4a7f81[_0x27ddc2['childModel']][_0x9dfe('0x6')](_0x4b054a)[_0x9dfe('0x7')](function(_0x3e7bf2){var _0x6ba4d3=[];_0x3e7bf2[_0x9dfe('0xa5')](function(_0x3b891b){var _0x341392;switch(_0x3b891b[_0x9dfe('0xa6')]){case _0x9dfe('0xa7'):_0x341392=_['find'](_0x13e1f2['associatedResources'],function(_0x4f0c5b){return _0x4f0c5b['id']===_0x3b891b[_0x9dfe('0x72')]&&_0x4f0c5b['type']===_0x9dfe('0xa8');});break;case _0x9dfe('0xa9'):_0x341392=_[_0x9dfe('0x92')](_0x13e1f2['associatedResources'],function(_0x376770){return _0x376770['id']===_0x3b891b[_0x9dfe('0x72')]&&_0x376770[_0x9dfe('0x10')]===_0x9dfe('0xaa');});break;}if(_0x341392)_0x6ba4d3['push'](_0x3b891b);});_0x5ef7c0['count']=_0x6ba4d3[_0x9dfe('0x91')];_0x5ef7c0[_0x9dfe('0xab')]=_0x6ba4d3;return _0x5ef7c0;});}else{if(!_['isEmpty'](_0x102c7c['query'][_0x9dfe('0xac')])){_0x4b054a[_0x9dfe('0x80')]['id']=_0x4b054a['where']['id']?_['intersection'](_0x4b054a[_0x9dfe('0x80')]['id'],_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xac')]):_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xac')];if(_0x102c7c[_0x9dfe('0x83')]['customSorting']){_0x4b054a[_0x9dfe('0x9c')]=_0x102c7c[_0x9dfe('0x83')]['customSorting'];}}if(_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xad')]){_0x4b054a[_0x9dfe('0x80')]=_[_0x9dfe('0xa0')](_0x4b054a['where'],{'$and':_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xad')]});}return _0x4a7f81[_0x27ddc2[_0x9dfe('0x13')]][_0x9dfe('0xae')]({'where':_0x4b054a[_0x9dfe('0x80')]})[_0x9dfe('0x7')](function(_0x5a0b5e){_0x5ef7c0[_0x9dfe('0xae')]=_0x5a0b5e;if(_0x102c7c['query'][_0x9dfe('0xa3')]){if(_0x27ddc2['childModel']===_0x9dfe('0xaf')){_0x4b054a['include']=[{'model':_0x4a7f81[_0x9dfe('0xb0')],'as':_0x9dfe('0xb1'),'attributes':['id',_0x9dfe('0x19'),'color'],'required':_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xb2')]?!![]:![]},{'model':_0x4a7f81['Tag'],'as':_0x9dfe('0xb3'),'attributes':['id',_0x9dfe('0x19'),_0x9dfe('0xb4')],'through':_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xb2')]?{'attributes':[],'where':{'TagId':_0x102c7c[_0x9dfe('0x83')]['tag']||undefined}}:{},'required':_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xb2')]?!![]:![]}];}else{_0x4b054a[_0x9dfe('0xa4')]=[{'all':!![]}];}}return _0x4a7f81[_0x27ddc2['childModel']][_0x9dfe('0x6')](_0x4b054a);})[_0x9dfe('0x7')](function(_0x3546f9){_0x5ef7c0['rows']=_0x3546f9;if(_0x5d097d===_0x9dfe('0x32')&&_0x102c7c[_0x9dfe('0x83')][_0x9dfe('0xb5')]==='true'){var _0xf3266e=[];for(var _0x367268=0x0;_0x367268<_0x5ef7c0[_0x9dfe('0xab')][_0x9dfe('0x91')];_0x367268++){_0xf3266e[_0x9dfe('0x8b')](_0x2edba4(_0x9dfe('0xb6'),_0x5ef7c0[_0x9dfe('0xab')][_0x367268][_0x9dfe('0xb7')]));_0xf3266e[_0x9dfe('0x8b')](_0x2edba4(_0x9dfe('0xb8'),_0x5ef7c0[_0x9dfe('0xab')][_0x367268][_0x9dfe('0xb7')]));_0xf3266e['push'](_0x2edba4(_0x9dfe('0xb9'),_0x5ef7c0[_0x9dfe('0xab')][_0x367268][_0x9dfe('0xb7')]));_0xf3266e[_0x9dfe('0x8b')](_0x2edba4(_0x9dfe('0xba'),_0x5ef7c0[_0x9dfe('0xab')][_0x367268][_0x9dfe('0xb7')]));_0xf3266e[_0x9dfe('0x8b')](_0x2edba4(_0x9dfe('0xbb'),_0x5ef7c0[_0x9dfe('0xab')][_0x367268][_0x9dfe('0xb7')]));_0xf3266e[_0x9dfe('0x8b')](_0x2edba4(_0x9dfe('0xbc'),_0x5ef7c0[_0x9dfe('0xab')][_0x367268][_0x9dfe('0xb7')]));}return Promise[_0x9dfe('0x8e')](_0xf3266e)['then'](function(){return _0x5ef7c0;});}return _0x5ef7c0;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index c2d8319..618ce58 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 _0xbc36=['register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./userProfile.socket'];(function(_0x85a333,_0x425aa7){var _0x36f553=function(_0x21d96b){while(--_0x21d96b){_0x85a333['push'](_0x85a333['shift']());}};_0x36f553(++_0x425aa7);}(_0xbc36,0x169));var _0x6bc3=function(_0x223ed6,_0x137718){_0x223ed6=_0x223ed6-0x0;var _0x12f224=_0xbc36[_0x223ed6];return _0x12f224;};'use strict';var _=require(_0x6bc3('0x0'));var util=require('util');var moment=require(_0x6bc3('0x1'));var BPromise=require(_0x6bc3('0x2'));var rs=require(_0x6bc3('0x3'));var fs=require('fs');var Redis=require(_0x6bc3('0x4'));var db=require(_0x6bc3('0x5'))['db'];var utils=require(_0x6bc3('0x6'));var logger=require(_0x6bc3('0x7'))(_0x6bc3('0x8'));var config=require(_0x6bc3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6bc3('0xa')][_0x6bc3('0xb')]({'port':0x232a});config['redis']=_[_0x6bc3('0xc')](config[_0x6bc3('0xd')],{'host':_0x6bc3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6bc3('0xd')]));require(_0x6bc3('0xf'))[_0x6bc3('0x10')](socket);function respondWithRpcPromise(_0x16ccf6,_0x558d65,_0x257cf7){return new BPromise(function(_0x1008f7,_0x39b63c){return client[_0x6bc3('0x11')](_0x16ccf6,_0x257cf7)[_0x6bc3('0x12')](function(_0x11cf76){logger[_0x6bc3('0x13')](_0x6bc3('0x14'),_0x558d65,_0x6bc3('0x15'));logger['debug'](_0x6bc3('0x16'),_0x558d65,'request\x20sent',JSON[_0x6bc3('0x17')](_0x11cf76));if(_0x11cf76['error']){if(_0x11cf76[_0x6bc3('0x18')][_0x6bc3('0x19')]===0x1f4){logger['error'](_0x6bc3('0x14'),_0x558d65,_0x11cf76['error']['message']);return _0x39b63c(_0x11cf76[_0x6bc3('0x18')][_0x6bc3('0x1a')]);}logger[_0x6bc3('0x18')](_0x6bc3('0x14'),_0x558d65,_0x11cf76[_0x6bc3('0x18')][_0x6bc3('0x1a')]);return _0x1008f7(_0x11cf76[_0x6bc3('0x18')]['message']);}else{logger[_0x6bc3('0x13')](_0x6bc3('0x14'),_0x558d65,'request\x20sent');_0x1008f7(_0x11cf76[_0x6bc3('0x1b')][_0x6bc3('0x1a')]);}})[_0x6bc3('0x1c')](function(_0x2ad222){logger[_0x6bc3('0x18')](_0x6bc3('0x14'),_0x558d65,_0x2ad222);_0x39b63c(_0x2ad222);});});} \ No newline at end of file +var _0x806b=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x95b3d,_0x399269){var _0x1cb5fc=function(_0x323fec){while(--_0x323fec){_0x95b3d['push'](_0x95b3d['shift']());}};_0x1cb5fc(++_0x399269);}(_0x806b,0x163));var _0xb806=function(_0x42a7d6,_0x489a3f){_0x42a7d6=_0x42a7d6-0x0;var _0x5241c2=_0x806b[_0x42a7d6];return _0x5241c2;};'use strict';var _=require(_0xb806('0x0'));var util=require(_0xb806('0x1'));var moment=require(_0xb806('0x2'));var BPromise=require(_0xb806('0x3'));var rs=require(_0xb806('0x4'));var fs=require('fs');var Redis=require(_0xb806('0x5'));var db=require(_0xb806('0x6'))['db'];var utils=require(_0xb806('0x7'));var logger=require('../../config/logger')(_0xb806('0x8'));var config=require(_0xb806('0x9'));var jayson=require(_0xb806('0xa'));var client=jayson[_0xb806('0xb')]['http']({'port':0x232a});config[_0xb806('0xc')]=_[_0xb806('0xd')](config['redis'],{'host':_0xb806('0xe'),'port':0x18eb});var socket=require(_0xb806('0xf'))(new Redis(config[_0xb806('0xc')]));require(_0xb806('0x10'))['register'](socket);function respondWithRpcPromise(_0x2b38df,_0x554c82,_0x466e0f){return new BPromise(function(_0x4cd6b4,_0x355422){return client['request'](_0x2b38df,_0x466e0f)[_0xb806('0x11')](function(_0x30c60f){logger[_0xb806('0x12')]('UserProfile,\x20%s,\x20%s',_0x554c82,_0xb806('0x13'));logger[_0xb806('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x554c82,_0xb806('0x13'),JSON[_0xb806('0x15')](_0x30c60f));if(_0x30c60f['error']){if(_0x30c60f[_0xb806('0x16')][_0xb806('0x17')]===0x1f4){logger['error'](_0xb806('0x18'),_0x554c82,_0x30c60f[_0xb806('0x16')][_0xb806('0x19')]);return _0x355422(_0x30c60f[_0xb806('0x16')][_0xb806('0x19')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x554c82,_0x30c60f[_0xb806('0x16')]['message']);return _0x4cd6b4(_0x30c60f[_0xb806('0x16')][_0xb806('0x19')]);}else{logger[_0xb806('0x12')](_0xb806('0x18'),_0x554c82,'request\x20sent');_0x4cd6b4(_0x30c60f[_0xb806('0x1a')][_0xb806('0x19')]);}})[_0xb806('0x1b')](function(_0x226945){logger[_0xb806('0x16')](_0xb806('0x18'),_0x554c82,_0x226945);_0x355422(_0x226945);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index cffe40e..19d2051 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 _0x9124=['userProfile:','remove','update','removeListener','register','length'];(function(_0x20c82a,_0x2a4294){var _0x585004=function(_0xe317e8){while(--_0xe317e8){_0x20c82a['push'](_0x20c82a['shift']());}};_0x585004(++_0x2a4294);}(_0x9124,0x6d));var _0x4912=function(_0x44821e,_0x2075d6){_0x44821e=_0x44821e-0x0;var _0x4b08a2=_0x9124[_0x44821e];return _0x4b08a2;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x4912('0x0'),_0x4912('0x1')];function createListener(_0xb45099,_0x27ffe2){return function(_0x2f1b98){_0x27ffe2['emit'](_0xb45099,_0x2f1b98);};}function removeListener(_0x3cca1f,_0x4088ac){return function(){UserProfileEvents[_0x4912('0x2')](_0x3cca1f,_0x4088ac);};}exports[_0x4912('0x3')]=function(_0x1cac45){for(var _0x5d5aa1=0x0,_0x5df441=events[_0x4912('0x4')];_0x5d5aa1<_0x5df441;_0x5d5aa1++){var _0x5a0ac7=events[_0x5d5aa1];var _0x2e0e89=createListener(_0x4912('0x5')+_0x5a0ac7,_0x1cac45);UserProfileEvents['on'](_0x5a0ac7,_0x2e0e89);}}; \ No newline at end of file +var _0x9ddb=['./userProfile.events','save','remove','update','emit','removeListener','register','length','userProfile:'];(function(_0x31667d,_0x2384d2){var _0x32644f=function(_0x5bd3a5){while(--_0x5bd3a5){_0x31667d['push'](_0x31667d['shift']());}};_0x32644f(++_0x2384d2);}(_0x9ddb,0x1d4));var _0xb9dd=function(_0x116538,_0x1d9449){_0x116538=_0x116538-0x0;var _0x521263=_0x9ddb[_0x116538];return _0x521263;};'use strict';var UserProfileEvents=require(_0xb9dd('0x0'));var events=[_0xb9dd('0x1'),_0xb9dd('0x2'),_0xb9dd('0x3')];function createListener(_0x278d16,_0x20fd62){return function(_0x4e434d){_0x20fd62[_0xb9dd('0x4')](_0x278d16,_0x4e434d);};}function removeListener(_0x19d659,_0x636620){return function(){UserProfileEvents[_0xb9dd('0x5')](_0x19d659,_0x636620);};}exports[_0xb9dd('0x6')]=function(_0x2c4856){for(var _0x16269f=0x0,_0x59ee27=events[_0xb9dd('0x7')];_0x16269f<_0x59ee27;_0x16269f++){var _0xa3c4f6=events[_0x16269f];var _0x6eff29=createListener(_0xb9dd('0x8')+_0xa3c4f6,_0x2c4856);UserProfileEvents['on'](_0xa3c4f6,_0x6eff29);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f69a517..0d6cae2 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 _0x9fc5=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x286410,_0x3944a7){var _0x390f3a=function(_0x75d153){while(--_0x75d153){_0x286410['push'](_0x286410['shift']());}};_0x390f3a(++_0x3944a7);}(_0x9fc5,0x84));var _0x59fc=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x9fc5[_0x141e03];return _0x2074e3;};'use strict';var multer=require('multer');var util=require(_0x59fc('0x0'));var path=require(_0x59fc('0x1'));var timeout=require(_0x59fc('0x2'));var express=require('express');var router=express[_0x59fc('0x3')]();var fs_extra=require(_0x59fc('0x4'));var auth=require(_0x59fc('0x5'));var interaction=require(_0x59fc('0x6'));var config=require(_0x59fc('0x7'));var controller=require('./userProfileResource.controller');router[_0x59fc('0x8')]('/',auth[_0x59fc('0x9')](),controller['index']);router[_0x59fc('0x8')](_0x59fc('0xa'),auth[_0x59fc('0x9')](),controller[_0x59fc('0xb')]);router[_0x59fc('0x8')](_0x59fc('0xc'),auth['isAuthenticated'](),controller[_0x59fc('0xd')]);router[_0x59fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x59fc('0xf')]);router[_0x59fc('0x10')](_0x59fc('0xc'),auth[_0x59fc('0x9')](),controller[_0x59fc('0x11')]);router[_0x59fc('0x12')](_0x59fc('0xc'),auth[_0x59fc('0x9')](),controller['destroy']);module[_0x59fc('0x13')]=router; \ No newline at end of file +var _0x6131=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','create','update','delete','destroy','util'];(function(_0x3cb57d,_0x55e87a){var _0x3febba=function(_0x4000c2){while(--_0x4000c2){_0x3cb57d['push'](_0x3cb57d['shift']());}};_0x3febba(++_0x55e87a);}(_0x6131,0x18b));var _0x1613=function(_0x10de7a,_0x222aab){_0x10de7a=_0x10de7a-0x0;var _0x30d1b0=_0x6131[_0x10de7a];return _0x30d1b0;};'use strict';var multer=require('multer');var util=require(_0x1613('0x0'));var path=require(_0x1613('0x1'));var timeout=require(_0x1613('0x2'));var express=require(_0x1613('0x3'));var router=express[_0x1613('0x4')]();var fs_extra=require(_0x1613('0x5'));var auth=require(_0x1613('0x6'));var interaction=require(_0x1613('0x7'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router['get']('/',auth[_0x1613('0x8')](),controller[_0x1613('0x9')]);router[_0x1613('0xa')](_0x1613('0xb'),auth[_0x1613('0x8')](),controller[_0x1613('0xc')]);router[_0x1613('0xa')](_0x1613('0xd'),auth[_0x1613('0x8')](),controller['show']);router['post']('/',auth[_0x1613('0x8')](),controller[_0x1613('0xe')]);router['put']('/:id',auth[_0x1613('0x8')](),controller[_0x1613('0xf')]);router[_0x1613('0x10')](_0x1613('0xd'),auth['isAuthenticated'](),controller[_0x1613('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3b663b6..70fae93 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 _0x3578=['STRING','sequelize','exports'];(function(_0x41b22a,_0xae2411){var _0x30841d=function(_0x5d017a){while(--_0x5d017a){_0x41b22a['push'](_0x41b22a['shift']());}};_0x30841d(++_0xae2411);}(_0x3578,0x184));var _0x8357=function(_0x48befb,_0x502bb7){_0x48befb=_0x48befb-0x0;var _0x45eb9b=_0x3578[_0x48befb];return _0x45eb9b;};'use strict';var Sequelize=require(_0x8357('0x0'));module[_0x8357('0x1')]={'name':{'type':Sequelize[_0x8357('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x8357('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3e1b=['STRING','INTEGER'];(function(_0x5ca70f,_0x203f6f){var _0x604b20=function(_0x5939f2){while(--_0x5939f2){_0x5ca70f['push'](_0x5ca70f['shift']());}};_0x604b20(++_0x203f6f);}(_0x3e1b,0x16a));var _0xb3e1=function(_0x189a3e,_0x1955da){_0x189a3e=_0x189a3e-0x0;var _0x1607ed=_0x3e1b[_0x189a3e];return _0x1607ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb3e1('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb3e1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb3e1('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0888141..4f389c3 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 _0x4888=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','UserProfileResource','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4888,0x198));var _0x8488=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x4888[_0x3ec122];return _0x4ecf41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));};exports[_0x8488('0x46')]=function(_0x313e00,_0x186747){return db[_0x8488('0x3a')]['describe']()[_0x8488('0x21')](respondWithResult(_0x186747,null))[_0x8488('0x3e')](handleError(_0x186747,null));}; \ No newline at end of file +var _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','UserProfileResource','includeAll','rows','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x34a9f0,_0x2ea303){var _0x58064d=function(_0x5d10a6){while(--_0x5d10a6){_0x34a9f0['push'](_0x34a9f0['shift']());}};_0x58064d(++_0x2ea303);}(_0x90b1,0x1bb));var _0x190b=function(_0x6604ba,_0x2a8142){_0x6604ba=_0x6604ba-0x0;var _0x39fb08=_0x90b1[_0x6604ba];return _0x39fb08;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));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(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['UserProfileResource'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['UserProfileResource'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 109b78d..9650b45 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 _0x40b3=['lodash','api','moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId'];(function(_0x4ebc89,_0x163696){var _0x133a0c=function(_0x28fbed){while(--_0x28fbed){_0x4ebc89['push'](_0x4ebc89['shift']());}};_0x133a0c(++_0x163696);}(_0x40b3,0x1ee));var _0x340b=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x40b3[_0x4d9bb2];return _0x3179fe;};'use strict';var _=require(_0x340b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x340b('0x1'));var moment=require(_0x340b('0x2'));var BPromise=require(_0x340b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x340b('0x4'));var config=require(_0x340b('0x5'));var attributes=require(_0x340b('0x6'));module[_0x340b('0x7')]=function(_0x1f815c,_0x2f9947){return _0x1f815c[_0x340b('0x8')](_0x340b('0x9'),attributes,{'tableName':_0x340b('0xa'),'paranoid':![],'indexes':[{'name':_0x340b('0xb'),'fields':['resourceId',_0x340b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5238=['request-promise','rimraf','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x594357,_0x3e5754){var _0x553687=function(_0x36a31d){while(--_0x36a31d){_0x594357['push'](_0x594357['shift']());}};_0x553687(++_0x3e5754);}(_0x5238,0x1e4));var _0x8523=function(_0x7e0f88,_0x2fbc94){_0x7e0f88=_0x7e0f88-0x0;var _0x577c8f=_0x5238[_0x7e0f88];return _0x577c8f;};'use strict';var _=require(_0x8523('0x0'));var util=require(_0x8523('0x1'));var logger=require(_0x8523('0x2'))(_0x8523('0x3'));var moment=require(_0x8523('0x4'));var BPromise=require(_0x8523('0x5'));var rp=require(_0x8523('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8523('0x7'));var config=require('../../config/environment');var attributes=require(_0x8523('0x8'));module[_0x8523('0x9')]=function(_0x9bd8f1,_0x253df7){return _0x9bd8f1[_0x8523('0xa')]('UserProfileResource',attributes,{'tableName':_0x8523('0xb'),'paranoid':![],'indexes':[{'name':_0x8523('0xc'),'fields':['resourceId',_0x8523('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e3d0b5e..e437b66 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 _0x8c69=['then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5d7610,_0x2a3fca){var _0x4058ce=function(_0x438cf8){while(--_0x438cf8){_0x5d7610['push'](_0x5d7610['shift']());}};_0x4058ce(++_0x2a3fca);}(_0x8c69,0x8f));var _0x98c6=function(_0x5442af,_0x358aa8){_0x5442af=_0x5442af-0x0;var _0x22c0db=_0x8c69[_0x5442af];return _0x22c0db;};'use strict';var _=require(_0x98c6('0x0'));var util=require(_0x98c6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x98c6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x98c6('0x3'));var logger=require(_0x98c6('0x4'))(_0x98c6('0x5'));var config=require(_0x98c6('0x6'));var jayson=require(_0x98c6('0x7'));var client=jayson[_0x98c6('0x8')][_0x98c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4529f2,_0x52e755,_0x3f561f){return new BPromise(function(_0x2b1a41,_0x58c482){return client[_0x98c6('0xa')](_0x4529f2,_0x3f561f)[_0x98c6('0xb')](function(_0x2b2dd3){logger['info'](_0x98c6('0xc'),_0x52e755,'request\x20sent');logger[_0x98c6('0xd')](_0x98c6('0xe'),_0x52e755,'request\x20sent',JSON[_0x98c6('0xf')](_0x2b2dd3));if(_0x2b2dd3[_0x98c6('0x10')]){if(_0x2b2dd3[_0x98c6('0x10')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x52e755,_0x2b2dd3[_0x98c6('0x10')][_0x98c6('0x11')]);return _0x58c482(_0x2b2dd3['error']['message']);}logger[_0x98c6('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x52e755,_0x2b2dd3[_0x98c6('0x10')][_0x98c6('0x11')]);return _0x2b1a41(_0x2b2dd3['error']['message']);}else{logger[_0x98c6('0x12')](_0x98c6('0xc'),_0x52e755,_0x98c6('0x13'));_0x2b1a41(_0x2b2dd3[_0x98c6('0x14')][_0x98c6('0x11')]);}})[_0x98c6('0x15')](function(_0x3b95e3){logger['error'](_0x98c6('0xc'),_0x52e755,_0x3b95e3);_0x58c482(_0x3b95e3);});});} \ No newline at end of file +var _0x8a56=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8a56,0x131));var _0x68a5=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0x8a56[_0x4b9978];return _0x42f0e5;};'use strict';var _=require(_0x68a5('0x0'));var util=require(_0x68a5('0x1'));var moment=require(_0x68a5('0x2'));var BPromise=require(_0x68a5('0x3'));var rs=require(_0x68a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68a5('0x5'))['db'];var utils=require(_0x68a5('0x6'));var logger=require(_0x68a5('0x7'))('rpc');var config=require(_0x68a5('0x8'));var jayson=require(_0x68a5('0x9'));var client=jayson[_0x68a5('0xa')][_0x68a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e5e44,_0x2b6f69,_0x3152f2){return new BPromise(function(_0x45580a,_0x53b374){return client['request'](_0x5e5e44,_0x3152f2)['then'](function(_0xbf94bb){logger['info'](_0x68a5('0xc'),_0x2b6f69,_0x68a5('0xd'));logger[_0x68a5('0xe')](_0x68a5('0xf'),_0x2b6f69,'request\x20sent',JSON[_0x68a5('0x10')](_0xbf94bb));if(_0xbf94bb['error']){if(_0xbf94bb[_0x68a5('0x11')]['code']===0x1f4){logger[_0x68a5('0x11')](_0x68a5('0xc'),_0x2b6f69,_0xbf94bb[_0x68a5('0x11')]['message']);return _0x53b374(_0xbf94bb[_0x68a5('0x11')]['message']);}logger['error'](_0x68a5('0xc'),_0x2b6f69,_0xbf94bb[_0x68a5('0x11')][_0x68a5('0x12')]);return _0x45580a(_0xbf94bb[_0x68a5('0x11')][_0x68a5('0x12')]);}else{logger[_0x68a5('0x13')](_0x68a5('0xc'),_0x2b6f69,'request\x20sent');_0x45580a(_0xbf94bb[_0x68a5('0x14')][_0x68a5('0x12')]);}})[_0x68a5('0x15')](function(_0x3f4965){logger[_0x68a5('0x11')](_0x68a5('0xc'),_0x2b6f69,_0x3f4965);_0x53b374(_0x3f4965);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 32d118c..b82614c 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 _0xa7c5=['/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put'];(function(_0x4dc35f,_0x377c51){var _0x1f8820=function(_0x37c340){while(--_0x37c340){_0x4dc35f['push'](_0x4dc35f['shift']());}};_0x1f8820(++_0x377c51);}(_0xa7c5,0x146));var _0x5a7c=function(_0x1bf779,_0x25d800){_0x1bf779=_0x1bf779-0x0;var _0xcdf3d7=_0xa7c5[_0x1bf779];return _0xcdf3d7;};'use strict';var multer=require(_0x5a7c('0x0'));var util=require(_0x5a7c('0x1'));var path=require(_0x5a7c('0x2'));var timeout=require(_0x5a7c('0x3'));var express=require('express');var router=express[_0x5a7c('0x4')]();var fs_extra=require(_0x5a7c('0x5'));var auth=require(_0x5a7c('0x6'));var interaction=require(_0x5a7c('0x7'));var config=require(_0x5a7c('0x8'));var controller=require(_0x5a7c('0x9'));router[_0x5a7c('0xa')]('/',auth[_0x5a7c('0xb')](),controller[_0x5a7c('0xc')]);router[_0x5a7c('0xa')](_0x5a7c('0xd'),auth['isAuthenticated'](),controller[_0x5a7c('0xe')]);router[_0x5a7c('0xa')]('/:id',auth[_0x5a7c('0xb')](),controller[_0x5a7c('0xf')]);router[_0x5a7c('0x10')]('/',auth['isAuthenticated'](),controller[_0x5a7c('0x11')]);router[_0x5a7c('0x12')](_0x5a7c('0x13'),auth['isAuthenticated'](),controller[_0x5a7c('0x14')]);router['delete'](_0x5a7c('0x13'),auth['isAuthenticated'](),controller[_0x5a7c('0x15')]);module[_0x5a7c('0x16')]=router; \ No newline at end of file +var _0xe302=['/describe','describe','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe302,0x1a9));var _0x2e30=function(_0x3bff3b,_0x3010be){_0x3bff3b=_0x3bff3b-0x0;var _0x2964a1=_0xe302[_0x3bff3b];return _0x2964a1;};'use strict';var multer=require('multer');var util=require(_0x2e30('0x0'));var path=require(_0x2e30('0x1'));var timeout=require(_0x2e30('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2e30('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2e30('0x4'));var controller=require('./userProfileSection.controller');router[_0x2e30('0x5')]('/',auth[_0x2e30('0x6')](),controller['index']);router[_0x2e30('0x5')](_0x2e30('0x7'),auth[_0x2e30('0x6')](),controller[_0x2e30('0x8')]);router[_0x2e30('0x5')](_0x2e30('0x9'),auth[_0x2e30('0x6')](),controller[_0x2e30('0xa')]);router[_0x2e30('0xb')]('/',auth[_0x2e30('0x6')](),controller[_0x2e30('0xc')]);router['put'](_0x2e30('0x9'),auth[_0x2e30('0x6')](),controller[_0x2e30('0xd')]);router[_0x2e30('0xe')](_0x2e30('0x9'),auth[_0x2e30('0x6')](),controller[_0x2e30('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d936731..24d62e2 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 _0x5eb8=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x5dfd95,_0x2c4aea){var _0x2d2ff4=function(_0x535ae5){while(--_0x535ae5){_0x5dfd95['push'](_0x5dfd95['shift']());}};_0x2d2ff4(++_0x2c4aea);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x5eb8[_0x4c5c97];return _0xd5d2cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x85eb('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x85eb('0x0')],'set':function(_0x13b1df){this[_0x85eb('0x3')](_0x85eb('0x4'),_0x13b1df?_0x13b1df[_0x85eb('0x5')](''):[]);},'get':function(){return this[_0x85eb('0x6')](_0x85eb('0x4'))?this['getDataValue'](_0x85eb('0x4'))[_0x85eb('0x7')](''):[];}}}; \ No newline at end of file +var _0xb78e=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x842ad5,_0x266bbf){var _0x55e54b=function(_0x57dc24){while(--_0x57dc24){_0x842ad5['push'](_0x842ad5['shift']());}};_0x55e54b(++_0x266bbf);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5ad0c8,_0x15aaee){_0x5ad0c8=_0x5ad0c8-0x0;var _0x5818ec=_0xb78e[_0x5ad0c8];return _0x5818ec;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb78('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb78('0x2')],'set':function(_0x308d12){this[_0xeb78('0x5')](_0xeb78('0x6'),_0x308d12?_0x308d12['join'](''):[]);},'get':function(){return this[_0xeb78('0x7')](_0xeb78('0x6'))?this[_0xeb78('0x7')](_0xeb78('0x6'))[_0xeb78('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a1592f3..b7a6d30 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 _0xd419=['where','merge','type','VIRTUAL','filter','include','catch','show','includeAll','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfileSection','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xd419,0x9d));var _0x9d41=function(_0x344995,_0x3bebe4){_0x344995=_0x344995-0x0;var _0x5b0c47=_0xd419[_0x344995];return _0x5b0c47;};'use strict';var emlformat=require(_0x9d41('0x0'));var rimraf=require(_0x9d41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d41('0x2'));var rp=require(_0x9d41('0x3'));var moment=require(_0x9d41('0x4'));var BPromise=require(_0x9d41('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d41('0x6'));var sox=require(_0x9d41('0x7'));var csv=require('to-csv');var ejs=require(_0x9d41('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d41('0x9'));var squel=require('squel');var crypto=require(_0x9d41('0xa'));var jsforce=require(_0x9d41('0xb'));var deskjs=require(_0x9d41('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9d41('0xd'));var Papa=require('papaparse');var Redis=require(_0x9d41('0xe'));var authService=require(_0x9d41('0xf'));var qs=require(_0x9d41('0x10'));var as=require(_0x9d41('0x11'));var hardwareService=require(_0x9d41('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9d41('0x13'));var config=require(_0x9d41('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d41('0x15'))['db'];function respondWithStatusCode(_0x24b29,_0x58d438){_0x58d438=_0x58d438||0xcc;return function(_0x495aee){if(_0x495aee){return _0x24b29['sendStatus'](_0x58d438);}return _0x24b29[_0x9d41('0x16')](_0x58d438)[_0x9d41('0x17')]();};}function respondWithResult(_0x190591,_0x1b5f0c){_0x1b5f0c=_0x1b5f0c||0xc8;return function(_0x3bfd20){if(_0x3bfd20){return _0x190591[_0x9d41('0x16')](_0x1b5f0c)[_0x9d41('0x18')](_0x3bfd20);}};}function respondWithFilteredResult(_0x4e41b7,_0x26f43f){return function(_0x57cc35){if(_0x57cc35){var _0xb25c77=typeof _0x26f43f['offset']===_0x9d41('0x19')&&typeof _0x26f43f[_0x9d41('0x1a')]===_0x9d41('0x19');var _0x1379ba=_0x57cc35[_0x9d41('0x1b')];var _0x5a4565=_0xb25c77?0x0:_0x26f43f[_0x9d41('0x1c')];var _0x382f90=_0xb25c77?_0x57cc35[_0x9d41('0x1b')]:_0x26f43f[_0x9d41('0x1c')]+_0x26f43f[_0x9d41('0x1a')];var _0x1385b1;if(_0x382f90>=_0x1379ba){_0x382f90=_0x1379ba;_0x1385b1=0xc8;}else{_0x1385b1=0xce;}_0x4e41b7[_0x9d41('0x16')](_0x1385b1);return _0x4e41b7[_0x9d41('0x1d')]('Content-Range',_0x5a4565+'-'+_0x382f90+'/'+_0x1379ba)[_0x9d41('0x18')](_0x57cc35);}return null;};}function patchUpdates(_0x1b5553){return function(_0xd7ffb6){try{jsonpatch['apply'](_0xd7ffb6,_0x1b5553,!![]);}catch(_0xfae6b3){return BPromise[_0x9d41('0x1e')](_0xfae6b3);}return _0xd7ffb6[_0x9d41('0x1f')]();};}function saveUpdates(_0x3b3f7c,_0x47c858){return function(_0x10d065){if(_0x10d065){return _0x10d065[_0x9d41('0x20')](_0x3b3f7c)[_0x9d41('0x21')](function(_0xf27fd4){return _0xf27fd4;});}return null;};}function removeEntity(_0x3d039a,_0x25cc79){return function(_0x19d403){if(_0x19d403){return _0x19d403[_0x9d41('0x22')]()[_0x9d41('0x21')](function(){_0x3d039a[_0x9d41('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b253,_0x49a71d){return function(_0x5e7213){if(!_0x5e7213){_0x46b253[_0x9d41('0x23')](0x194);}return _0x5e7213;};}function handleError(_0x80baae,_0x24c17b){_0x24c17b=_0x24c17b||0x1f4;return function(_0x3d13c5){logger[_0x9d41('0x24')](_0x3d13c5[_0x9d41('0x25')]);if(_0x3d13c5[_0x9d41('0x26')]){delete _0x3d13c5[_0x9d41('0x26')];}_0x80baae[_0x9d41('0x16')](_0x24c17b)['send'](_0x3d13c5);};}exports[_0x9d41('0x27')]=function(_0x571061,_0x3a90f4){var _0x28e580={},_0x13f5ce={},_0x13bea6={'count':0x0,'rows':[]};var _0x2fba15=_[_0x9d41('0x28')](db[_0x9d41('0x29')][_0x9d41('0x2a')],function(_0xc41963){return{'name':_0xc41963['fieldName'],'type':_0xc41963['type'][_0x9d41('0x2b')]};});_0x13f5ce['model']=_[_0x9d41('0x28')](_0x2fba15,'name');_0x13f5ce[_0x9d41('0x2c')]=_[_0x9d41('0x2d')](_0x571061[_0x9d41('0x2c')]);_0x13f5ce[_0x9d41('0x2e')]=_[_0x9d41('0x2f')](_0x13f5ce[_0x9d41('0x30')],_0x13f5ce[_0x9d41('0x2c')]);_0x28e580[_0x9d41('0x31')]=_[_0x9d41('0x2f')](_0x13f5ce[_0x9d41('0x30')],qs[_0x9d41('0x32')](_0x571061[_0x9d41('0x2c')][_0x9d41('0x32')]));_0x28e580[_0x9d41('0x31')]=_0x28e580[_0x9d41('0x31')][_0x9d41('0x33')]?_0x28e580['attributes']:_0x13f5ce[_0x9d41('0x30')];if(!_0x571061[_0x9d41('0x2c')][_0x9d41('0x34')](_0x9d41('0x35'))){_0x28e580[_0x9d41('0x1a')]=qs[_0x9d41('0x1a')](_0x571061[_0x9d41('0x2c')][_0x9d41('0x1a')]);_0x28e580[_0x9d41('0x1c')]=qs['offset'](_0x571061[_0x9d41('0x2c')][_0x9d41('0x1c')]);}_0x28e580['order']=qs[_0x9d41('0x36')](_0x571061['query'][_0x9d41('0x36')]);_0x28e580['where']=qs[_0x9d41('0x2e')](_[_0x9d41('0x37')](_0x571061[_0x9d41('0x2c')],_0x13f5ce[_0x9d41('0x2e')]),_0x2fba15);if(_0x571061[_0x9d41('0x2c')]['filter']){_0x28e580[_0x9d41('0x38')]=_[_0x9d41('0x39')](_0x28e580['where'],{'$or':_[_0x9d41('0x28')](_0x2fba15,function(_0xfbe768){if(_0xfbe768[_0x9d41('0x3a')]!==_0x9d41('0x3b')){var _0x5e4ba4={};_0x5e4ba4[_0xfbe768[_0x9d41('0x26')]]={'$like':'%'+_0x571061['query'][_0x9d41('0x3c')]+'%'};return _0x5e4ba4;}})});}_0x28e580=_[_0x9d41('0x39')]({},_0x28e580,_0x571061['options']);var _0xa3717c={'where':_0x28e580[_0x9d41('0x38')]};return db[_0x9d41('0x29')][_0x9d41('0x1b')](_0xa3717c)[_0x9d41('0x21')](function(_0x1b9b30){_0x13bea6[_0x9d41('0x1b')]=_0x1b9b30;if(_0x571061['query']['includeAll']){_0x28e580[_0x9d41('0x3d')]=[{'all':!![]}];}return db[_0x9d41('0x29')]['findAll'](_0x28e580);})[_0x9d41('0x21')](function(_0x5d2620){_0x13bea6['rows']=_0x5d2620;return _0x13bea6;})[_0x9d41('0x21')](respondWithFilteredResult(_0x3a90f4,_0x28e580))[_0x9d41('0x3e')](handleError(_0x3a90f4,null));};exports[_0x9d41('0x3f')]=function(_0x1c7f18,_0x478cac){var _0x5da61b={'raw':![],'where':{'id':_0x1c7f18['params']['id']}},_0x1a7ea1={};_0x1a7ea1['model']=_[_0x9d41('0x2d')](db['UserProfileSection'][_0x9d41('0x2a')]);_0x1a7ea1[_0x9d41('0x2c')]=_[_0x9d41('0x2d')](_0x1c7f18[_0x9d41('0x2c')]);_0x1a7ea1[_0x9d41('0x2e')]=_[_0x9d41('0x2f')](_0x1a7ea1[_0x9d41('0x30')],_0x1a7ea1['query']);_0x5da61b['attributes']=_[_0x9d41('0x2f')](_0x1a7ea1['model'],qs[_0x9d41('0x32')](_0x1c7f18['query']['fields']));_0x5da61b[_0x9d41('0x31')]=_0x5da61b[_0x9d41('0x31')]['length']?_0x5da61b[_0x9d41('0x31')]:_0x1a7ea1['model'];if(_0x1c7f18[_0x9d41('0x2c')][_0x9d41('0x40')]){_0x5da61b[_0x9d41('0x3d')]=[{'all':!![]}];}_0x5da61b=_['merge']({},_0x5da61b,_0x1c7f18[_0x9d41('0x41')]);return db[_0x9d41('0x29')]['find'](_0x5da61b)[_0x9d41('0x21')](handleEntityNotFound(_0x478cac,null))[_0x9d41('0x21')](respondWithResult(_0x478cac,null))[_0x9d41('0x3e')](handleError(_0x478cac,null));};exports['create']=function(_0x10c936,_0x7cf384){return db[_0x9d41('0x29')][_0x9d41('0x42')](_0x10c936[_0x9d41('0x43')],{})[_0x9d41('0x21')](respondWithResult(_0x7cf384,0xc9))['catch'](handleError(_0x7cf384,null));};exports[_0x9d41('0x20')]=function(_0x479397,_0x2a3b9d){if(_0x479397[_0x9d41('0x43')]['id']){delete _0x479397[_0x9d41('0x43')]['id'];}return db[_0x9d41('0x29')][_0x9d41('0x44')]({'where':{'id':_0x479397[_0x9d41('0x45')]['id']}})[_0x9d41('0x21')](handleEntityNotFound(_0x2a3b9d,null))[_0x9d41('0x21')](saveUpdates(_0x479397[_0x9d41('0x43')],null))['then'](respondWithResult(_0x2a3b9d,null))[_0x9d41('0x3e')](handleError(_0x2a3b9d,null));};exports[_0x9d41('0x22')]=function(_0x282fdd,_0x384979){return db['UserProfileSection'][_0x9d41('0x44')]({'where':{'id':_0x282fdd['params']['id']}})[_0x9d41('0x21')](handleEntityNotFound(_0x384979,null))[_0x9d41('0x21')](removeEntity(_0x384979,null))[_0x9d41('0x3e')](handleError(_0x384979,null));};exports[_0x9d41('0x46')]=function(_0x289e79,_0xeb562a){return db[_0x9d41('0x29')][_0x9d41('0x46')]()[_0x9d41('0x21')](respondWithResult(_0xeb562a,null))['catch'](handleError(_0xeb562a,null));}; \ No newline at end of file +var _0x3a19=['bluebird','path','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','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','count','set','json','apply','reject','save','update','then','destroy','status','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x21c48,_0x49ac0a){var _0x1f2cea=function(_0x51a5eb){while(--_0x51a5eb){_0x21c48['push'](_0x21c48['shift']());}};_0x1f2cea(++_0x49ac0a);}(_0x3a19,0x169));var _0x93a1=function(_0x255174,_0x392f52){_0x255174=_0x255174-0x0;var _0x42f9e6=_0x3a19[_0x255174];return _0x42f9e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93a1('0x0'));var zipdir=require(_0x93a1('0x1'));var jsonpatch=require(_0x93a1('0x2'));var rp=require(_0x93a1('0x3'));var moment=require('moment');var BPromise=require(_0x93a1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x93a1('0x5'));var sox=require(_0x93a1('0x6'));var csv=require(_0x93a1('0x7'));var ejs=require(_0x93a1('0x8'));var fs=require('fs');var fs_extra=require(_0x93a1('0x9'));var _=require('lodash');var squel=require(_0x93a1('0xa'));var crypto=require(_0x93a1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x93a1('0xc'));var toCsv=require(_0x93a1('0x7'));var querystring=require(_0x93a1('0xd'));var Papa=require(_0x93a1('0xe'));var Redis=require(_0x93a1('0xf'));var authService=require(_0x93a1('0x10'));var qs=require(_0x93a1('0x11'));var as=require(_0x93a1('0x12'));var hardwareService=require(_0x93a1('0x13'));var logger=require(_0x93a1('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x93a1('0x15'));var db=require(_0x93a1('0x16'))['db'];function respondWithStatusCode(_0x142c50,_0x27ce13){_0x27ce13=_0x27ce13||0xcc;return function(_0x1595b0){if(_0x1595b0){return _0x142c50[_0x93a1('0x17')](_0x27ce13);}return _0x142c50['status'](_0x27ce13)[_0x93a1('0x18')]();};}function respondWithResult(_0x16d9bb,_0x13438d){_0x13438d=_0x13438d||0xc8;return function(_0x8c7af8){if(_0x8c7af8){return _0x16d9bb['status'](_0x13438d)['json'](_0x8c7af8);}};}function respondWithFilteredResult(_0x295418,_0x46023f){return function(_0x190ae0){if(_0x190ae0){var _0x38ad34=typeof _0x46023f[_0x93a1('0x19')]==='undefined'&&typeof _0x46023f[_0x93a1('0x1a')]==='undefined';var _0x593304=_0x190ae0[_0x93a1('0x1b')];var _0x31aee5=_0x38ad34?0x0:_0x46023f[_0x93a1('0x19')];var _0x3ddf68=_0x38ad34?_0x190ae0[_0x93a1('0x1b')]:_0x46023f[_0x93a1('0x19')]+_0x46023f['limit'];var _0x21ea84;if(_0x3ddf68>=_0x593304){_0x3ddf68=_0x593304;_0x21ea84=0xc8;}else{_0x21ea84=0xce;}_0x295418['status'](_0x21ea84);return _0x295418[_0x93a1('0x1c')]('Content-Range',_0x31aee5+'-'+_0x3ddf68+'/'+_0x593304)[_0x93a1('0x1d')](_0x190ae0);}return null;};}function patchUpdates(_0x5c553d){return function(_0x4961cd){try{jsonpatch[_0x93a1('0x1e')](_0x4961cd,_0x5c553d,!![]);}catch(_0x2461d7){return BPromise[_0x93a1('0x1f')](_0x2461d7);}return _0x4961cd[_0x93a1('0x20')]();};}function saveUpdates(_0x449408,_0x2a8665){return function(_0x1aeb42){if(_0x1aeb42){return _0x1aeb42[_0x93a1('0x21')](_0x449408)[_0x93a1('0x22')](function(_0x203463){return _0x203463;});}return null;};}function removeEntity(_0x4d3225,_0x257022){return function(_0x27473c){if(_0x27473c){return _0x27473c[_0x93a1('0x23')]()[_0x93a1('0x22')](function(){_0x4d3225[_0x93a1('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7fcedb,_0x4913ea){return function(_0x89f9f2){if(!_0x89f9f2){_0x7fcedb[_0x93a1('0x17')](0x194);}return _0x89f9f2;};}function handleError(_0x37b928,_0x1d1d13){_0x1d1d13=_0x1d1d13||0x1f4;return function(_0x445ba7){logger[_0x93a1('0x25')](_0x445ba7['stack']);if(_0x445ba7['name']){delete _0x445ba7[_0x93a1('0x26')];}_0x37b928['status'](_0x1d1d13)[_0x93a1('0x27')](_0x445ba7);};}exports[_0x93a1('0x28')]=function(_0x1d8647,_0x36dff3){var _0x560e2c={},_0x3a819d={},_0x3966a4={'count':0x0,'rows':[]};var _0x51eedb=_[_0x93a1('0x29')](db[_0x93a1('0x2a')][_0x93a1('0x2b')],function(_0x32d544){return{'name':_0x32d544[_0x93a1('0x2c')],'type':_0x32d544[_0x93a1('0x2d')][_0x93a1('0x2e')]};});_0x3a819d[_0x93a1('0x2f')]=_[_0x93a1('0x29')](_0x51eedb,_0x93a1('0x26'));_0x3a819d[_0x93a1('0x30')]=_[_0x93a1('0x31')](_0x1d8647[_0x93a1('0x30')]);_0x3a819d[_0x93a1('0x32')]=_[_0x93a1('0x33')](_0x3a819d[_0x93a1('0x2f')],_0x3a819d[_0x93a1('0x30')]);_0x560e2c[_0x93a1('0x34')]=_['intersection'](_0x3a819d[_0x93a1('0x2f')],qs[_0x93a1('0x35')](_0x1d8647[_0x93a1('0x30')][_0x93a1('0x35')]));_0x560e2c[_0x93a1('0x34')]=_0x560e2c[_0x93a1('0x34')][_0x93a1('0x36')]?_0x560e2c[_0x93a1('0x34')]:_0x3a819d[_0x93a1('0x2f')];if(!_0x1d8647[_0x93a1('0x30')][_0x93a1('0x37')](_0x93a1('0x38'))){_0x560e2c[_0x93a1('0x1a')]=qs[_0x93a1('0x1a')](_0x1d8647['query'][_0x93a1('0x1a')]);_0x560e2c['offset']=qs['offset'](_0x1d8647[_0x93a1('0x30')][_0x93a1('0x19')]);}_0x560e2c['order']=qs['sort'](_0x1d8647[_0x93a1('0x30')]['sort']);_0x560e2c[_0x93a1('0x39')]=qs['filters'](_[_0x93a1('0x3a')](_0x1d8647[_0x93a1('0x30')],_0x3a819d[_0x93a1('0x32')]),_0x51eedb);if(_0x1d8647['query'][_0x93a1('0x3b')]){_0x560e2c[_0x93a1('0x39')]=_[_0x93a1('0x3c')](_0x560e2c['where'],{'$or':_[_0x93a1('0x29')](_0x51eedb,function(_0x360f09){if(_0x360f09[_0x93a1('0x2d')]!==_0x93a1('0x3d')){var _0x52646d={};_0x52646d[_0x360f09['name']]={'$like':'%'+_0x1d8647[_0x93a1('0x30')]['filter']+'%'};return _0x52646d;}})});}_0x560e2c=_[_0x93a1('0x3c')]({},_0x560e2c,_0x1d8647['options']);var _0x23ddfd={'where':_0x560e2c[_0x93a1('0x39')]};return db[_0x93a1('0x2a')]['count'](_0x23ddfd)[_0x93a1('0x22')](function(_0x3f3f95){_0x3966a4['count']=_0x3f3f95;if(_0x1d8647[_0x93a1('0x30')][_0x93a1('0x3e')]){_0x560e2c[_0x93a1('0x3f')]=[{'all':!![]}];}return db[_0x93a1('0x2a')][_0x93a1('0x40')](_0x560e2c);})[_0x93a1('0x22')](function(_0x3dde63){_0x3966a4[_0x93a1('0x41')]=_0x3dde63;return _0x3966a4;})[_0x93a1('0x22')](respondWithFilteredResult(_0x36dff3,_0x560e2c))[_0x93a1('0x42')](handleError(_0x36dff3,null));};exports[_0x93a1('0x43')]=function(_0x277edb,_0x5ed087){var _0x43159b={'raw':![],'where':{'id':_0x277edb[_0x93a1('0x44')]['id']}},_0x4084e6={};_0x4084e6[_0x93a1('0x2f')]=_[_0x93a1('0x31')](db[_0x93a1('0x2a')][_0x93a1('0x2b')]);_0x4084e6[_0x93a1('0x30')]=_[_0x93a1('0x31')](_0x277edb[_0x93a1('0x30')]);_0x4084e6[_0x93a1('0x32')]=_[_0x93a1('0x33')](_0x4084e6[_0x93a1('0x2f')],_0x4084e6['query']);_0x43159b[_0x93a1('0x34')]=_[_0x93a1('0x33')](_0x4084e6[_0x93a1('0x2f')],qs[_0x93a1('0x35')](_0x277edb[_0x93a1('0x30')][_0x93a1('0x35')]));_0x43159b['attributes']=_0x43159b['attributes']['length']?_0x43159b['attributes']:_0x4084e6[_0x93a1('0x2f')];if(_0x277edb[_0x93a1('0x30')][_0x93a1('0x3e')]){_0x43159b['include']=[{'all':!![]}];}_0x43159b=_[_0x93a1('0x3c')]({},_0x43159b,_0x277edb['options']);return db[_0x93a1('0x2a')][_0x93a1('0x45')](_0x43159b)[_0x93a1('0x22')](handleEntityNotFound(_0x5ed087,null))[_0x93a1('0x22')](respondWithResult(_0x5ed087,null))[_0x93a1('0x42')](handleError(_0x5ed087,null));};exports[_0x93a1('0x46')]=function(_0x34c541,_0x4687e7){return db['UserProfileSection'][_0x93a1('0x46')](_0x34c541[_0x93a1('0x47')],{})[_0x93a1('0x22')](respondWithResult(_0x4687e7,0xc9))['catch'](handleError(_0x4687e7,null));};exports[_0x93a1('0x21')]=function(_0x5f442f,_0x589a21){if(_0x5f442f[_0x93a1('0x47')]['id']){delete _0x5f442f['body']['id'];}return db[_0x93a1('0x2a')]['find']({'where':{'id':_0x5f442f[_0x93a1('0x44')]['id']}})[_0x93a1('0x22')](handleEntityNotFound(_0x589a21,null))[_0x93a1('0x22')](saveUpdates(_0x5f442f[_0x93a1('0x47')],null))[_0x93a1('0x22')](respondWithResult(_0x589a21,null))[_0x93a1('0x42')](handleError(_0x589a21,null));};exports['destroy']=function(_0x1d90ff,_0x54b5c3){return db[_0x93a1('0x2a')][_0x93a1('0x45')]({'where':{'id':_0x1d90ff[_0x93a1('0x44')]['id']}})[_0x93a1('0x22')](handleEntityNotFound(_0x54b5c3,null))[_0x93a1('0x22')](removeEntity(_0x54b5c3,null))['catch'](handleError(_0x54b5c3,null));};exports[_0x93a1('0x48')]=function(_0x1b1fa2,_0x151759){return db[_0x93a1('0x2a')]['describe']()[_0x93a1('0x22')](respondWithResult(_0x151759,null))['catch'](handleError(_0x151759,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a923b14..5c10aea 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 _0x68a7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','userProfileId'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x68a7,0xb4));var _0x768a=function(_0x574aa3,_0x500410){_0x574aa3=_0x574aa3-0x0;var _0x56d2e0=_0x68a7[_0x574aa3];return _0x56d2e0;};'use strict';var _=require(_0x768a('0x0'));var util=require(_0x768a('0x1'));var logger=require(_0x768a('0x2'))(_0x768a('0x3'));var moment=require(_0x768a('0x4'));var BPromise=require(_0x768a('0x5'));var rp=require(_0x768a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x768a('0x7'));var config=require(_0x768a('0x8'));var attributes=require(_0x768a('0x9'));module[_0x768a('0xa')]=function(_0x23cdb2,_0xbcdaad){return _0x23cdb2[_0x768a('0xb')](_0x768a('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x768a('0xd'),'fields':['sectionId',_0x768a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88d5=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','../../config/logger','bluebird','path','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x3410e5,_0x2c4396){var _0x11ad5d=function(_0x16f019){while(--_0x16f019){_0x3410e5['push'](_0x3410e5['shift']());}};_0x11ad5d(++_0x2c4396);}(_0x88d5,0x1c1));var _0x588d=function(_0x45bde5,_0x53a679){_0x45bde5=_0x45bde5-0x0;var _0x59a384=_0x88d5[_0x45bde5];return _0x59a384;};'use strict';var _=require(_0x588d('0x0'));var util=require('util');var logger=require(_0x588d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x588d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x588d('0x3'));var rimraf=require('rimraf');var config=require(_0x588d('0x4'));var attributes=require(_0x588d('0x5'));module[_0x588d('0x6')]=function(_0x179766,_0x24fb37){return _0x179766['define'](_0x588d('0x7'),attributes,{'tableName':_0x588d('0x8'),'paranoid':![],'indexes':[{'name':_0x588d('0x9'),'fields':[_0x588d('0xa'),_0x588d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 8d9a6f8..3034f6f 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 _0xeab5=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x410147,_0x23d579){var _0x56e597=function(_0x3fe37f){while(--_0x3fe37f){_0x410147['push'](_0x410147['shift']());}};_0x56e597(++_0x23d579);}(_0xeab5,0xd4));var _0x5eab=function(_0x28abc4,_0x13b4c1){_0x28abc4=_0x28abc4-0x0;var _0x5f5ca6=_0xeab5[_0x28abc4];return _0x5f5ca6;};'use strict';var _=require(_0x5eab('0x0'));var util=require(_0x5eab('0x1'));var moment=require(_0x5eab('0x2'));var BPromise=require(_0x5eab('0x3'));var rs=require(_0x5eab('0x4'));var fs=require('fs');var Redis=require(_0x5eab('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5eab('0x6'));var config=require(_0x5eab('0x7'));var jayson=require(_0x5eab('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4777,_0x5647ec,_0x35b53c){return new BPromise(function(_0x20f6af,_0x3c67a5){return client[_0x5eab('0x9')](_0x4d4777,_0x35b53c)[_0x5eab('0xa')](function(_0x26ada0){logger[_0x5eab('0xb')](_0x5eab('0xc'),_0x5647ec,_0x5eab('0xd'));logger[_0x5eab('0xe')](_0x5eab('0xf'),_0x5647ec,_0x5eab('0xd'),JSON[_0x5eab('0x10')](_0x26ada0));if(_0x26ada0['error']){if(_0x26ada0['error'][_0x5eab('0x11')]===0x1f4){logger[_0x5eab('0x12')](_0x5eab('0xc'),_0x5647ec,_0x26ada0[_0x5eab('0x12')]['message']);return _0x3c67a5(_0x26ada0[_0x5eab('0x12')]['message']);}logger[_0x5eab('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x5647ec,_0x26ada0['error'][_0x5eab('0x13')]);return _0x20f6af(_0x26ada0['error']['message']);}else{logger[_0x5eab('0xb')](_0x5eab('0xc'),_0x5647ec,_0x5eab('0xd'));_0x20f6af(_0x26ada0['result']['message']);}})[_0x5eab('0x14')](function(_0x26504a){logger[_0x5eab('0x12')](_0x5eab('0xc'),_0x5647ec,_0x26504a);_0x3c67a5(_0x26504a);});});} \ No newline at end of file +var _0xec18=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x2fefdc,_0x8160c9){var _0xf3823a=function(_0x118d21){while(--_0x118d21){_0x2fefdc['push'](_0x2fefdc['shift']());}};_0xf3823a(++_0x8160c9);}(_0xec18,0xa5));var _0x8ec1=function(_0x15d67e,_0x1b825e){_0x15d67e=_0x15d67e-0x0;var _0x1eb989=_0xec18[_0x15d67e];return _0x1eb989;};'use strict';var _=require(_0x8ec1('0x0'));var util=require(_0x8ec1('0x1'));var moment=require(_0x8ec1('0x2'));var BPromise=require(_0x8ec1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ec1('0x4'));var db=require(_0x8ec1('0x5'))['db'];var utils=require(_0x8ec1('0x6'));var logger=require(_0x8ec1('0x7'))(_0x8ec1('0x8'));var config=require(_0x8ec1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8ec1('0xa')][_0x8ec1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b370d,_0x53ef62,_0x1dbe3a){return new BPromise(function(_0x645b59,_0x5e8f88){return client[_0x8ec1('0xc')](_0x2b370d,_0x1dbe3a)[_0x8ec1('0xd')](function(_0x5bc502){logger[_0x8ec1('0xe')](_0x8ec1('0xf'),_0x53ef62,_0x8ec1('0x10'));logger[_0x8ec1('0x11')](_0x8ec1('0x12'),_0x53ef62,'request\x20sent',JSON['stringify'](_0x5bc502));if(_0x5bc502[_0x8ec1('0x13')]){if(_0x5bc502[_0x8ec1('0x13')][_0x8ec1('0x14')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x53ef62,_0x5bc502[_0x8ec1('0x13')]['message']);return _0x5e8f88(_0x5bc502[_0x8ec1('0x13')][_0x8ec1('0x15')]);}logger[_0x8ec1('0x13')](_0x8ec1('0xf'),_0x53ef62,_0x5bc502[_0x8ec1('0x13')]['message']);return _0x645b59(_0x5bc502[_0x8ec1('0x13')][_0x8ec1('0x15')]);}else{logger['info'](_0x8ec1('0xf'),_0x53ef62,_0x8ec1('0x10'));_0x645b59(_0x5bc502['result'][_0x8ec1('0x15')]);}})[_0x8ec1('0x16')](function(_0x1cb764){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x53ef62,_0x1cb764);_0x5e8f88(_0x1cb764);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 62fa98b..7964484 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(_0x87bade,_0x28aa5c){var _0x8ce695=function(_0x318ed6){while(--_0x318ed6){_0x87bade['push'](_0x87bade['shift']());}};_0x8ce695(++_0x28aa5c);}(_0xe706,0xa3));var _0x6e70=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe706[_0x3ff085];return _0x2b68c3;};'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(_0x432afd,_0x2fe037){var _0x5c83f8=function(_0x2ce83a){while(--_0x2ce83a){_0x432afd['push'](_0x432afd['shift']());}};_0x5c83f8(++_0x2fe037);}(_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 84f4134..f55fba5 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 _0x6a26=['exports','INTEGER','sequelize'];(function(_0x4f56d0,_0xbfb7da){var _0x3b0c9d=function(_0x5057df){while(--_0x5057df){_0x4f56d0['push'](_0x4f56d0['shift']());}};_0x3b0c9d(++_0xbfb7da);}(_0x6a26,0x14f));var _0x66a2=function(_0x3d7169,_0x40db5e){_0x3d7169=_0x3d7169-0x0;var _0x39bc66=_0x6a26[_0x3d7169];return _0x39bc66;};'use strict';var Sequelize=require(_0x66a2('0x0'));module[_0x66a2('0x1')]={'penalty':{'type':Sequelize[_0x66a2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1738=['sequelize','exports'];(function(_0x2fa695,_0x9c46d3){var _0x5e03a4=function(_0x8f2258){while(--_0x8f2258){_0x2fa695['push'](_0x2fa695['shift']());}};_0x5e03a4(++_0x9c46d3);}(_0x1738,0x1bc));var _0x8173=function(_0x46d459,_0x10dc2b){_0x46d459=_0x46d459-0x0;var _0x2fa982=_0x1738[_0x46d459];return _0x2fa982;};'use strict';var Sequelize=require(_0x8173('0x0'));module[_0x8173('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 02f41f3..4951946 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 _0x4c60=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','./userSmsQueue.attributes','exports'];(function(_0x107ad7,_0x5a6dc5){var _0x324a92=function(_0x3b6e21){while(--_0x3b6e21){_0x107ad7['push'](_0x107ad7['shift']());}};_0x324a92(++_0x5a6dc5);}(_0x4c60,0xc1));var _0x04c6=function(_0x598063,_0x4552d0){_0x598063=_0x598063-0x0;var _0x330657=_0x4c60[_0x598063];return _0x330657;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf98=['moment','bluebird','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api'];(function(_0x3b1caf,_0x8a35c5){var _0x416b17=function(_0x105e1b){while(--_0x105e1b){_0x3b1caf['push'](_0x3b1caf['shift']());}};_0x416b17(++_0x8a35c5);}(_0xcf98,0x8d));var _0x8cf9=function(_0x12011d,_0x46d3da){_0x12011d=_0x12011d-0x0;var _0x47db9c=_0xcf98[_0x12011d];return _0x47db9c;};'use strict';var _=require('lodash');var util=require(_0x8cf9('0x0'));var logger=require(_0x8cf9('0x1'))(_0x8cf9('0x2'));var moment=require(_0x8cf9('0x3'));var BPromise=require(_0x8cf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var attributes=require(_0x8cf9('0x7'));module[_0x8cf9('0x8')]=function(_0x784c17,_0x3a5463){return _0x784c17[_0x8cf9('0x9')](_0x8cf9('0xa'),attributes,{'tableName':_0x8cf9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index c5224fb..804b65a 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 _0x30d5=['UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug'];(function(_0x2ce038,_0x20a76f){var _0x32976b=function(_0x3ccfb6){while(--_0x3ccfb6){_0x2ce038['push'](_0x2ce038['shift']());}};_0x32976b(++_0x20a76f);}(_0x30d5,0xa9));var _0x530d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x30d5[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x530d('0x0'));var moment=require(_0x530d('0x1'));var BPromise=require(_0x530d('0x2'));var rs=require(_0x530d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x530d('0x4'))['db'];var utils=require(_0x530d('0x5'));var logger=require('../../config/logger')(_0x530d('0x6'));var config=require('../../config/environment');var jayson=require(_0x530d('0x7'));var client=jayson[_0x530d('0x8')][_0x530d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43608a,_0x164615,_0x2559b0){return new BPromise(function(_0x490a56,_0x1dc69f){return client[_0x530d('0xa')](_0x43608a,_0x2559b0)[_0x530d('0xb')](function(_0x5e2990){logger[_0x530d('0xc')](_0x530d('0xd'),_0x164615,'request\x20sent');logger[_0x530d('0xe')](_0x530d('0xf'),_0x164615,_0x530d('0x10'),JSON[_0x530d('0x11')](_0x5e2990));if(_0x5e2990['error']){if(_0x5e2990[_0x530d('0x12')][_0x530d('0x13')]===0x1f4){logger['error'](_0x530d('0xd'),_0x164615,_0x5e2990[_0x530d('0x12')]['message']);return _0x1dc69f(_0x5e2990[_0x530d('0x12')]['message']);}logger[_0x530d('0x12')](_0x530d('0xd'),_0x164615,_0x5e2990[_0x530d('0x12')]['message']);return _0x490a56(_0x5e2990[_0x530d('0x12')][_0x530d('0x14')]);}else{logger[_0x530d('0xc')](_0x530d('0xd'),_0x164615,_0x530d('0x10'));_0x490a56(_0x5e2990[_0x530d('0x15')]['message']);}})[_0x530d('0x16')](function(_0x4e6dea){logger[_0x530d('0x12')](_0x530d('0xd'),_0x164615,_0x4e6dea);_0x1dc69f(_0x4e6dea);});});} \ No newline at end of file +var _0x91c5=['moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x50a064,_0x13bb41){var _0x219623=function(_0x460be0){while(--_0x460be0){_0x50a064['push'](_0x50a064['shift']());}};_0x219623(++_0x13bb41);}(_0x91c5,0x70));var _0x591c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x91c5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x591c('0x0'));var BPromise=require(_0x591c('0x1'));var rs=require(_0x591c('0x2'));var fs=require('fs');var Redis=require(_0x591c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x591c('0x4'))('rpc');var config=require(_0x591c('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x591c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2196f6,_0x4de996,_0x3a7512){return new BPromise(function(_0x403ac3,_0x1b3888){return client['request'](_0x2196f6,_0x3a7512)[_0x591c('0x7')](function(_0x219e68){logger[_0x591c('0x8')](_0x591c('0x9'),_0x4de996,_0x591c('0xa'));logger['debug'](_0x591c('0xb'),_0x4de996,_0x591c('0xa'),JSON[_0x591c('0xc')](_0x219e68));if(_0x219e68[_0x591c('0xd')]){if(_0x219e68[_0x591c('0xd')]['code']===0x1f4){logger[_0x591c('0xd')](_0x591c('0x9'),_0x4de996,_0x219e68[_0x591c('0xd')][_0x591c('0xe')]);return _0x1b3888(_0x219e68[_0x591c('0xd')][_0x591c('0xe')]);}logger[_0x591c('0xd')](_0x591c('0x9'),_0x4de996,_0x219e68[_0x591c('0xd')][_0x591c('0xe')]);return _0x403ac3(_0x219e68[_0x591c('0xd')][_0x591c('0xe')]);}else{logger[_0x591c('0x8')](_0x591c('0x9'),_0x4de996,_0x591c('0xa'));_0x403ac3(_0x219e68[_0x591c('0xf')]['message']);}})['catch'](function(_0xe335b){logger[_0x591c('0xd')](_0x591c('0x9'),_0x4de996,_0xe335b);_0x1b3888(_0xe335b);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 7655706..fb46f72 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 _0x5975=['sequelize','exports','INTEGER'];(function(_0x458dd7,_0xe5602b){var _0x2a12f3=function(_0x547dee){while(--_0x547dee){_0x458dd7['push'](_0x458dd7['shift']());}};_0x2a12f3(++_0xe5602b);}(_0x5975,0xe1));var _0x5597=function(_0x70835e,_0xc6224b){_0x70835e=_0x70835e-0x0;var _0x3dd38f=_0x5975[_0x70835e];return _0x3dd38f;};'use strict';var Sequelize=require(_0x5597('0x0'));module[_0x5597('0x1')]={'UserId':{'type':Sequelize[_0x5597('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5597('0x2')]}}; \ No newline at end of file +var _0x977e=['INTEGER','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x977e,0xf7));var _0xe977=function(_0x192cb7,_0x2cda13){_0x192cb7=_0x192cb7-0x0;var _0x4aad48=_0x977e[_0x192cb7];return _0x4aad48;};'use strict';var Sequelize=require('sequelize');module[_0xe977('0x0')]={'UserId':{'type':Sequelize[_0xe977('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xe977('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 6fa18ff..56ae542 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(_0x452961,_0x20ac26){var _0x2c4d19=function(_0x5b7607){while(--_0x5b7607){_0x452961['push'](_0x452961['shift']());}};_0x2c4d19(++_0x20ac26);}(_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 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(_0x28eaf6,_0x81a58c){var _0x540fcb=function(_0x57a0fa){while(--_0x57a0fa){_0x28eaf6['push'](_0x28eaf6['shift']());}};_0x540fcb(++_0x81a58c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 89dc05c..b6764d9 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x23f1ef,_0x565763){var _0x100409=function(_0x4c5a4b){while(--_0x4c5a4b){_0x23f1ef['push'](_0x23f1ef['shift']());}};_0x100409(++_0x565763);}(_0xe706,0xa3));var _0x6e70=function(_0x17e315,_0x361db6){_0x17e315=_0x17e315-0x0;var _0x3e7afb=_0xe706[_0x17e315];return _0x3e7afb;};'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(_0x37a244,_0x104ee3){var _0x130f03=function(_0xf8299e){while(--_0xf8299e){_0x37a244['push'](_0x37a244['shift']());}};_0x130f03(++_0x104ee3);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 838b753..2f35fde 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 _0xf481=['INTEGER','sequelize','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf481,0x18a));var _0x1f48=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xf481[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0x1f48('0x0'));module[_0x1f48('0x1')]={'penalty':{'type':Sequelize[_0x1f48('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc7d9=['sequelize','INTEGER'];(function(_0x328139,_0x5610c8){var _0x5ec1be=function(_0x21a2c4){while(--_0x21a2c4){_0x328139['push'](_0x328139['shift']());}};_0x5ec1be(++_0x5610c8);}(_0xc7d9,0x1cc));var _0x9c7d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc7d9[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x9c7d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9c7d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 99df4dd..db51b7f 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 _0xb0ce=['path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3cca1d,_0xc1bf9){var _0x2b8761=function(_0x50898d){while(--_0x50898d){_0x3cca1d['push'](_0x3cca1d['shift']());}};_0x2b8761(++_0xc1bf9);}(_0xb0ce,0x10e));var _0xeb0c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb0ce[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xeb0c('0x0'));var util=require('util');var logger=require(_0xeb0c('0x1'))(_0xeb0c('0x2'));var moment=require(_0xeb0c('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb0c('0x4'));var fs=require('fs');var path=require(_0xeb0c('0x5'));var rimraf=require('rimraf');var config=require(_0xeb0c('0x6'));var attributes=require(_0xeb0c('0x7'));module[_0xeb0c('0x8')]=function(_0x485229,_0x2bc19d){return _0x485229['define'](_0xeb0c('0x9'),attributes,{'tableName':_0xeb0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8a2=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','path','../../config/environment','./userVoiceQueue.attributes'];(function(_0x12e641,_0x50c4d4){var _0x27855c=function(_0x39d1e8){while(--_0x39d1e8){_0x12e641['push'](_0x12e641['shift']());}};_0x27855c(++_0x50c4d4);}(_0xe8a2,0xbf));var _0x2e8a=function(_0x5c6b8,_0x12a3f1){_0x5c6b8=_0x5c6b8-0x0;var _0x56c091=_0xe8a2[_0x5c6b8];return _0x56c091;};'use strict';var _=require(_0x2e8a('0x0'));var util=require(_0x2e8a('0x1'));var logger=require('../../config/logger')(_0x2e8a('0x2'));var moment=require(_0x2e8a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e8a('0x4'));var rimraf=require('rimraf');var config=require(_0x2e8a('0x5'));var attributes=require(_0x2e8a('0x6'));module[_0x2e8a('0x7')]=function(_0x120778,_0x320d6a){return _0x120778[_0x2e8a('0x8')](_0x2e8a('0x9'),attributes,{'tableName':_0x2e8a('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 87cfed8..af7ce6a 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 _0xe52d=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x1ce446,_0x413ebf){var _0xdfc5ae=function(_0xb79181){while(--_0xb79181){_0x1ce446['push'](_0x1ce446['shift']());}};_0xdfc5ae(++_0x413ebf);}(_0xe52d,0x6d));var _0xde52=function(_0x3a1f69,_0x33f8b7){_0x3a1f69=_0x3a1f69-0x0;var _0xb5be23=_0xe52d[_0x3a1f69];return _0xb5be23;};'use strict';var _=require('lodash');var util=require(_0xde52('0x0'));var moment=require(_0xde52('0x1'));var BPromise=require(_0xde52('0x2'));var rs=require(_0xde52('0x3'));var fs=require('fs');var Redis=require(_0xde52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xde52('0x5'));var logger=require(_0xde52('0x6'))(_0xde52('0x7'));var config=require(_0xde52('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xde52('0x9')][_0xde52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d9eb6,_0x25d75b,_0x21fdcb){return new BPromise(function(_0x35cbdc,_0x39063b){return client['request'](_0x1d9eb6,_0x21fdcb)[_0xde52('0xb')](function(_0x303f6e){logger[_0xde52('0xc')](_0xde52('0xd'),_0x25d75b,_0xde52('0xe'));logger['debug'](_0xde52('0xf'),_0x25d75b,_0xde52('0xe'),JSON[_0xde52('0x10')](_0x303f6e));if(_0x303f6e[_0xde52('0x11')]){if(_0x303f6e[_0xde52('0x11')][_0xde52('0x12')]===0x1f4){logger[_0xde52('0x11')](_0xde52('0xd'),_0x25d75b,_0x303f6e[_0xde52('0x11')][_0xde52('0x13')]);return _0x39063b(_0x303f6e[_0xde52('0x11')]['message']);}logger[_0xde52('0x11')](_0xde52('0xd'),_0x25d75b,_0x303f6e[_0xde52('0x11')][_0xde52('0x13')]);return _0x35cbdc(_0x303f6e[_0xde52('0x11')][_0xde52('0x13')]);}else{logger[_0xde52('0xc')](_0xde52('0xd'),_0x25d75b,_0xde52('0xe'));_0x35cbdc(_0x303f6e[_0xde52('0x14')][_0xde52('0x13')]);}})[_0xde52('0x15')](function(_0x562715){logger[_0xde52('0x11')](_0xde52('0xd'),_0x25d75b,_0x562715);_0x39063b(_0x562715);});});} \ No newline at end of file +var _0x0879=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','lodash','util','moment','randomstring'];(function(_0xd8b89f,_0x6312f4){var _0x3c6e90=function(_0x182d8a){while(--_0x182d8a){_0xd8b89f['push'](_0xd8b89f['shift']());}};_0x3c6e90(++_0x6312f4);}(_0x0879,0xec));var _0x9087=function(_0x22c7ce,_0x2a13e8){_0x22c7ce=_0x22c7ce-0x0;var _0x5dcfda=_0x0879[_0x22c7ce];return _0x5dcfda;};'use strict';var _=require(_0x9087('0x0'));var util=require(_0x9087('0x1'));var moment=require(_0x9087('0x2'));var BPromise=require('bluebird');var rs=require(_0x9087('0x3'));var fs=require('fs');var Redis=require(_0x9087('0x4'));var db=require(_0x9087('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9087('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9087('0x7'));var client=jayson[_0x9087('0x8')][_0x9087('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x397b04,_0x40592d,_0x3a7a02){return new BPromise(function(_0x5d67c3,_0x57e1c0){return client['request'](_0x397b04,_0x3a7a02)[_0x9087('0xa')](function(_0x14a5ce){logger[_0x9087('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x40592d,_0x9087('0xc'));logger[_0x9087('0xd')](_0x9087('0xe'),_0x40592d,'request\x20sent',JSON[_0x9087('0xf')](_0x14a5ce));if(_0x14a5ce[_0x9087('0x10')]){if(_0x14a5ce[_0x9087('0x10')][_0x9087('0x11')]===0x1f4){logger[_0x9087('0x10')](_0x9087('0x12'),_0x40592d,_0x14a5ce[_0x9087('0x10')][_0x9087('0x13')]);return _0x57e1c0(_0x14a5ce[_0x9087('0x10')][_0x9087('0x13')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x40592d,_0x14a5ce[_0x9087('0x10')][_0x9087('0x13')]);return _0x5d67c3(_0x14a5ce[_0x9087('0x10')]['message']);}else{logger[_0x9087('0xb')](_0x9087('0x12'),_0x40592d,'request\x20sent');_0x5d67c3(_0x14a5ce['result'][_0x9087('0x13')]);}})['catch'](function(_0x34eb8){logger[_0x9087('0x10')](_0x9087('0x12'),_0x40592d,_0x34eb8);_0x57e1c0(_0x34eb8);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 76899b5..f10d307 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x19fd3e,_0x340446){var _0x31802e=function(_0x2911f6){while(--_0x2911f6){_0x19fd3e['push'](_0x19fd3e['shift']());}};_0x31802e(++_0x340446);}(_0xedd9,0xfc));var _0x9edd=function(_0x452dd8,_0x54746b){_0x452dd8=_0x452dd8-0x0;var _0x3ab92c=_0xedd9[_0x452dd8];return _0x3ab92c;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x31fc03,_0x56561b){var _0x124789=function(_0xa372ce){while(--_0xa372ce){_0x31fc03['push'](_0x31fc03['shift']());}};_0x124789(++_0x56561b);}(_0xe706,0xa3));var _0x6e70=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0xe706[_0x273f88];return _0x177ca1;};'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 26d8023..2ea2ddf 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 _0x4e99=['queue_interface','STRING','sequelize','exports','Required\x20by\x20Asterisk','INTEGER'];(function(_0x56e790,_0x5bec09){var _0x4fa9fa=function(_0x513862){while(--_0x513862){_0x56e790['push'](_0x56e790['shift']());}};_0x4fa9fa(++_0x5bec09);}(_0x4e99,0x110));var _0x94e9=function(_0x2f862e,_0xaa4c6a){_0x2f862e=_0x2f862e-0x0;var _0x592005=_0x4e99[_0x2f862e];return _0x592005;};'use strict';var Sequelize=require(_0x94e9('0x0'));module[_0x94e9('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x94e9('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x94e9('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94e9('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x94e9('0x5')],'allowNull':![],'unique':'queue_interface','comment':_0x94e9('0x2')},'penalty':{'type':Sequelize[_0x94e9('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x94e9('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xcb5e=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3f884e,_0x16d1e3){var _0x561980=function(_0x47d643){while(--_0x47d643){_0x3f884e['push'](_0x3f884e['shift']());}};_0x561980(++_0x16d1e3);}(_0xcb5e,0xb4));var _0xecb5=function(_0x4df5f3,_0x8571b7){_0x4df5f3=_0x4df5f3-0x0;var _0xc42399=_0xcb5e[_0x4df5f3];return _0xc42399;};'use strict';var Sequelize=require('sequelize');module[_0xecb5('0x0')]={'uniqueid':{'type':Sequelize[_0xecb5('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xecb5('0x2')},'membername':{'type':Sequelize[_0xecb5('0x3')],'allowNull':![],'comment':_0xecb5('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xecb5('0x3')],'allowNull':![],'unique':_0xecb5('0x4'),'comment':_0xecb5('0x2')},'VoiceQueueId':{'type':Sequelize[_0xecb5('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xecb5('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xecb5('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xecb5('0x2')},'paused':{'type':Sequelize[_0xecb5('0x1')](0xb),'defaultValue':0x0,'comment':_0xecb5('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index dfc9b76..47748f5 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 _0x18fd=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2bb3f6,_0x25fde0){var _0x62b339=function(_0x53e014){while(--_0x53e014){_0x2bb3f6['push'](_0x2bb3f6['shift']());}};_0x62b339(++_0x25fde0);}(_0x18fd,0x90));var _0xd18f=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x18fd[_0x2adfb1];return _0xa52d45;};'use strict';var EventEmitter=require(_0xd18f('0x0'));var UserVoiceQueueRt=require(_0xd18f('0x1'))['db'][_0xd18f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd18f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd18f('0x4'),'afterDestroy':_0xd18f('0x5')};function emitEvent(_0x5f01bc){return function(_0x5d6a18,_0x2f83a1,_0x467bf3){UserVoiceQueueRtEvents['emit'](_0x5f01bc+':'+_0x5d6a18['id'],_0x5d6a18);UserVoiceQueueRtEvents[_0xd18f('0x6')](_0x5f01bc,_0x5d6a18);_0x467bf3(null);};}for(var e in events){if(events[_0xd18f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xd18f('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xac65=['update','remove','emit','hasOwnProperty','../../mysqldb','UserVoiceQueueRt','save'];(function(_0x3fe65b,_0x13ac2e){var _0x32de12=function(_0x1612d5){while(--_0x1612d5){_0x3fe65b['push'](_0x3fe65b['shift']());}};_0x32de12(++_0x13ac2e);}(_0xac65,0x169));var _0x5ac6=function(_0x3cef31,_0x3eb5e7){_0x3cef31=_0x3cef31-0x0;var _0x44620d=_0xac65[_0x3cef31];return _0x44620d;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x5ac6('0x0'))['db'][_0x5ac6('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ac6('0x2'),'afterUpdate':_0x5ac6('0x3'),'afterDestroy':_0x5ac6('0x4')};function emitEvent(_0x3434be){return function(_0x21ea34,_0x1d3ef6,_0x13502f){UserVoiceQueueRtEvents[_0x5ac6('0x5')](_0x3434be+':'+_0x21ea34['id'],_0x21ea34);UserVoiceQueueRtEvents['emit'](_0x3434be,_0x21ea34);_0x13502f(null);};}for(var e in events){if(events[_0x5ac6('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 2328a8d..097649d 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 _0xd4b4=['api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger'];(function(_0x341315,_0x62f2e1){var _0x4a1136=function(_0x2d9d14){while(--_0x2d9d14){_0x341315['push'](_0x341315['shift']());}};_0x4a1136(++_0x62f2e1);}(_0xd4b4,0x184));var _0x4d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4d4b('0x0'));var logger=require(_0x4d4b('0x1'))(_0x4d4b('0x2'));var moment=require(_0x4d4b('0x3'));var BPromise=require(_0x4d4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d4b('0x5'));var rimraf=require(_0x4d4b('0x6'));var config=require(_0x4d4b('0x7'));var attributes=require(_0x4d4b('0x8'));module[_0x4d4b('0x9')]=function(_0x2f5bf7,_0x4d5c4f){return _0x2f5bf7[_0x4d4b('0xa')](_0x4d4b('0xb'),attributes,{'tableName':_0x4d4b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b54=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0x24050a,_0x1ce736){var _0x4d27aa=function(_0x77c99a){while(--_0x77c99a){_0x24050a['push'](_0x24050a['shift']());}};_0x4d27aa(++_0x1ce736);}(_0x4b54,0x9a));var _0x44b5=function(_0x3b5e02,_0x535469){_0x3b5e02=_0x3b5e02-0x0;var _0x59464c=_0x4b54[_0x3b5e02];return _0x59464c;};'use strict';var _=require(_0x44b5('0x0'));var util=require('util');var logger=require(_0x44b5('0x1'))('api');var moment=require(_0x44b5('0x2'));var BPromise=require(_0x44b5('0x3'));var rp=require(_0x44b5('0x4'));var fs=require('fs');var path=require(_0x44b5('0x5'));var rimraf=require(_0x44b5('0x6'));var config=require(_0x44b5('0x7'));var attributes=require(_0x44b5('0x8'));module[_0x44b5('0x9')]=function(_0x1a06b5,_0x3cb5ab){return _0x1a06b5[_0x44b5('0xa')](_0x44b5('0xb'),attributes,{'tableName':_0x44b5('0xc'),'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 ebb9779..cff036d 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 _0x069d=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize'];(function(_0x21e90d,_0x10e377){var _0x56e02b=function(_0x3c423f){while(--_0x3c423f){_0x21e90d['push'](_0x21e90d['shift']());}};_0x56e02b(++_0x10e377);}(_0x069d,0x75));var _0xd069=function(_0x3ea5e3,_0x300bb3){_0x3ea5e3=_0x3ea5e3-0x0;var _0x29dcec=_0x069d[_0x3ea5e3];return _0x29dcec;};'use strict';var _=require(_0xd069('0x0'));var util=require(_0xd069('0x1'));var moment=require('moment');var BPromise=require(_0xd069('0x2'));var rs=require(_0xd069('0x3'));var fs=require('fs');var Redis=require(_0xd069('0x4'));var db=require(_0xd069('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd069('0x6'))(_0xd069('0x7'));var config=require(_0xd069('0x8'));var jayson=require(_0xd069('0x9'));var client=jayson[_0xd069('0xa')][_0xd069('0xb')]({'port':0x232a});config[_0xd069('0xc')]=_[_0xd069('0xd')](config[_0xd069('0xc')],{'host':_0xd069('0xe'),'port':0x18eb});var socket=require(_0xd069('0xf'))(new Redis(config['redis']));require(_0xd069('0x10'))[_0xd069('0x11')](socket);function respondWithRpcPromise(_0x5d4457,_0x2c6f63,_0x21c428){return new BPromise(function(_0x329483,_0x375460){return client[_0xd069('0x12')](_0x5d4457,_0x21c428)[_0xd069('0x13')](function(_0x1630b9){logger['info'](_0xd069('0x14'),_0x2c6f63,_0xd069('0x15'));logger[_0xd069('0x16')](_0xd069('0x17'),_0x2c6f63,_0xd069('0x15'),JSON['stringify'](_0x1630b9));if(_0x1630b9[_0xd069('0x18')]){if(_0x1630b9['error'][_0xd069('0x19')]===0x1f4){logger[_0xd069('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c6f63,_0x1630b9[_0xd069('0x18')][_0xd069('0x1a')]);return _0x375460(_0x1630b9[_0xd069('0x18')][_0xd069('0x1a')]);}logger['error'](_0xd069('0x14'),_0x2c6f63,_0x1630b9[_0xd069('0x18')]['message']);return _0x329483(_0x1630b9[_0xd069('0x18')][_0xd069('0x1a')]);}else{logger[_0xd069('0x1b')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c6f63,'request\x20sent');_0x329483(_0x1630b9['result']['message']);}})[_0xd069('0x1c')](function(_0x49a462){logger['error'](_0xd069('0x14'),_0x2c6f63,_0x49a462);_0x375460(_0x49a462);});});}exports[_0xd069('0x1d')]=function(_0x1f8279){var _0x18f27b=this;return new Promise(function(_0x51aac0,_0x2042c1){return db[_0xd069('0x1e')]['findAll']({'raw':_0x1f8279[_0xd069('0x1f')]?_0x1f8279[_0xd069('0x1f')][_0xd069('0x20')]===undefined?!![]:![]:!![],'where':_0x1f8279[_0xd069('0x1f')]?_0x1f8279[_0xd069('0x1f')][_0xd069('0x21')]||null:null,'attributes':[[db[_0xd069('0x22')]['fn'](_0xd069('0x23'),db[_0xd069('0x22')]['fn']('IF',db[_0xd069('0x22')][_0xd069('0x24')](_0xd069('0x25')))),'outboundQueuePauses']]})[_0xd069('0x13')](function(_0x2d2728){logger['info'](_0xd069('0x1d'),_0x1f8279);logger[_0xd069('0x16')](_0xd069('0x1d'),_0x1f8279,JSON['stringify'](_0x2d2728));_0x51aac0(_0x2d2728);})[_0xd069('0x1c')](function(_0x5d16a9){logger[_0xd069('0x18')](_0xd069('0x1d'),_0x5d16a9['message'],_0x1f8279);_0x2042c1(_0x18f27b[_0xd069('0x18')](0x1f4,_0x5d16a9[_0xd069('0x1a')]));});});}; \ No newline at end of file +var _0xcb46=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent'];(function(_0x198259,_0x3bec76){var _0x80ad5d=function(_0x43effe){while(--_0x43effe){_0x198259['push'](_0x198259['shift']());}};_0x80ad5d(++_0x3bec76);}(_0xcb46,0x19d));var _0x6cb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb46[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6cb4('0x0'));var moment=require('moment');var BPromise=require(_0x6cb4('0x1'));var rs=require(_0x6cb4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cb4('0x3'))['db'];var utils=require(_0x6cb4('0x4'));var logger=require('../../config/logger')(_0x6cb4('0x5'));var config=require(_0x6cb4('0x6'));var jayson=require(_0x6cb4('0x7'));var client=jayson[_0x6cb4('0x8')][_0x6cb4('0x9')]({'port':0x232a});config[_0x6cb4('0xa')]=_['defaults'](config[_0x6cb4('0xa')],{'host':_0x6cb4('0xb'),'port':0x18eb});var socket=require(_0x6cb4('0xc'))(new Redis(config[_0x6cb4('0xa')]));require(_0x6cb4('0xd'))[_0x6cb4('0xe')](socket);function respondWithRpcPromise(_0x399fb4,_0x58374d,_0x5774ea){return new BPromise(function(_0x38a3ea,_0x1e749b){return client[_0x6cb4('0xf')](_0x399fb4,_0x5774ea)[_0x6cb4('0x10')](function(_0x4358c6){logger[_0x6cb4('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x58374d,_0x6cb4('0x12'));logger[_0x6cb4('0x13')](_0x6cb4('0x14'),_0x58374d,_0x6cb4('0x12'),JSON[_0x6cb4('0x15')](_0x4358c6));if(_0x4358c6[_0x6cb4('0x16')]){if(_0x4358c6[_0x6cb4('0x16')][_0x6cb4('0x17')]===0x1f4){logger[_0x6cb4('0x16')](_0x6cb4('0x18'),_0x58374d,_0x4358c6[_0x6cb4('0x16')][_0x6cb4('0x19')]);return _0x1e749b(_0x4358c6[_0x6cb4('0x16')][_0x6cb4('0x19')]);}logger['error'](_0x6cb4('0x18'),_0x58374d,_0x4358c6[_0x6cb4('0x16')]['message']);return _0x38a3ea(_0x4358c6['error']['message']);}else{logger[_0x6cb4('0x11')](_0x6cb4('0x18'),_0x58374d,_0x6cb4('0x12'));_0x38a3ea(_0x4358c6['result']['message']);}})['catch'](function(_0x5ebdc6){logger['error'](_0x6cb4('0x18'),_0x58374d,_0x5ebdc6);_0x1e749b(_0x5ebdc6);});});}exports[_0x6cb4('0x1a')]=function(_0x1a7d13){var _0x2cdc7f=this;return new Promise(function(_0x308779,_0x248d89){return db[_0x6cb4('0x1b')][_0x6cb4('0x1c')]({'raw':_0x1a7d13[_0x6cb4('0x1d')]?_0x1a7d13[_0x6cb4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7d13[_0x6cb4('0x1d')]?_0x1a7d13['options'][_0x6cb4('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6cb4('0x1f'),db[_0x6cb4('0x20')]['fn']('IF',db[_0x6cb4('0x20')][_0x6cb4('0x21')](_0x6cb4('0x22')))),_0x6cb4('0x23')]]})['then'](function(_0x3857ca){logger[_0x6cb4('0x11')](_0x6cb4('0x1a'),_0x1a7d13);logger[_0x6cb4('0x13')]('GetVoiceQueueRtPauses',_0x1a7d13,JSON[_0x6cb4('0x15')](_0x3857ca));_0x308779(_0x3857ca);})['catch'](function(_0x3292c5){logger[_0x6cb4('0x16')](_0x6cb4('0x1a'),_0x3292c5['message'],_0x1a7d13);_0x248d89(_0x2cdc7f[_0x6cb4('0x16')](0x1f4,_0x3292c5[_0x6cb4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a467d23..a9528b5 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 _0x5a5a=['emit','length','userVoiceQueueRt:','save','remove','update'];(function(_0x56a314,_0x26aed2){var _0x2b542e=function(_0x1aa53b){while(--_0x1aa53b){_0x56a314['push'](_0x56a314['shift']());}};_0x2b542e(++_0x26aed2);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x10dfdf,_0xd11233){_0x10dfdf=_0x10dfdf-0x0;var _0x2ff0c7=_0x5a5a[_0x10dfdf];return _0x2ff0c7;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa5a5('0x0'),_0xa5a5('0x1'),_0xa5a5('0x2')];function createListener(_0x2552b1,_0x42cf19){return function(_0x50c2ad){_0x42cf19[_0xa5a5('0x3')](_0x2552b1,_0x50c2ad);};}function removeListener(_0x3307f1,_0x1fd3f0){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3307f1,_0x1fd3f0);};}exports['register']=function(_0x43943d){for(var _0x1fe96d=0x0,_0x5691f1=events[_0xa5a5('0x4')];_0x1fe96d<_0x5691f1;_0x1fe96d++){var _0xf2ea20=events[_0x1fe96d];var _0x1234c2=createListener(_0xa5a5('0x5')+_0xf2ea20,_0x43943d);UserVoiceQueueRtEvents['on'](_0xf2ea20,_0x1234c2);}}; \ No newline at end of file +var _0x2c8f=['register','userVoiceQueueRt:','save','emit','removeListener'];(function(_0x3b136d,_0x43c898){var _0x10e2b0=function(_0x5d13fe){while(--_0x5d13fe){_0x3b136d['push'](_0x3b136d['shift']());}};_0x10e2b0(++_0x43c898);}(_0x2c8f,0x192));var _0xf2c8=function(_0x27a956,_0x3d4aa8){_0x27a956=_0x27a956-0x0;var _0x3899ba=_0x2c8f[_0x27a956];return _0x3899ba;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xf2c8('0x0'),'remove','update'];function createListener(_0x488a77,_0x3d45c0){return function(_0x26503c){_0x3d45c0[_0xf2c8('0x1')](_0x488a77,_0x26503c);};}function removeListener(_0x56296e,_0x5e4234){return function(){UserVoiceQueueRtEvents[_0xf2c8('0x2')](_0x56296e,_0x5e4234);};}exports[_0xf2c8('0x3')]=function(_0x182b73){for(var _0x3ad7a0=0x0,_0x2785ee=events['length'];_0x3ad7a0<_0x2785ee;_0x3ad7a0++){var _0x475616=events[_0x3ad7a0];var _0x28cc0d=createListener(_0xf2c8('0x4')+_0x475616,_0x182b73);UserVoiceQueueRtEvents['on'](_0x475616,_0x28cc0d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 41a2b0e..2c4e3d4 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x29ec32,_0x292c7a){var _0x1a60a5=function(_0x10bf41){while(--_0x10bf41){_0x29ec32['push'](_0x29ec32['shift']());}};_0x1a60a5(++_0x292c7a);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4e6d1c,_0x52b8a4){var _0x421559=function(_0x3a95e8){while(--_0x3a95e8){_0x4e6d1c['push'](_0x4e6d1c['shift']());}};_0x421559(++_0x52b8a4);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9f7ea6a..9abe24d 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 _0xde5f=['INTEGER','sequelize'];(function(_0x1e2f5b,_0x60bf47){var _0x2bb7bc=function(_0x1ddf91){while(--_0x1ddf91){_0x1e2f5b['push'](_0x1e2f5b['shift']());}};_0x2bb7bc(++_0x60bf47);}(_0xde5f,0x83));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfde5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xfde5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf957=['exports','INTEGER','sequelize'];(function(_0x156da6,_0x1522a7){var _0x3ab3a7=function(_0x106a79){while(--_0x106a79){_0x156da6['push'](_0x156da6['shift']());}};_0x3ab3a7(++_0x1522a7);}(_0xf957,0xb6));var _0x7f95=function(_0x39aa80,_0x436758){_0x39aa80=_0x39aa80-0x0;var _0x11c159=_0xf957[_0x39aa80];return _0x11c159;};'use strict';var Sequelize=require(_0x7f95('0x0'));module[_0x7f95('0x1')]={'penalty':{'type':Sequelize[_0x7f95('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 7f17a97..a4c0950 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 _0x0042=['rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2ac46d,_0x30d6e0){var _0x30509e=function(_0x1873f1){while(--_0x1873f1){_0x2ac46d['push'](_0x2ac46d['shift']());}};_0x30509e(++_0x30d6e0);}(_0x0042,0x14a));var _0x2004=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0x0042[_0x112fe3];return _0x1ec903;};'use strict';var _=require(_0x2004('0x0'));var util=require(_0x2004('0x1'));var logger=require(_0x2004('0x2'))(_0x2004('0x3'));var moment=require(_0x2004('0x4'));var BPromise=require('bluebird');var rp=require(_0x2004('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2004('0x6'));var config=require(_0x2004('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x2004('0x8')]=function(_0x5be9b1,_0x1d1107){return _0x5be9b1[_0x2004('0x9')](_0x2004('0xa'),attributes,{'tableName':_0x2004('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa425=['user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x173a87,_0x1f797b){var _0x5450d2=function(_0x33ba7e){while(--_0x33ba7e){_0x173a87['push'](_0x173a87['shift']());}};_0x5450d2(++_0x1f797b);}(_0xa425,0x83));var _0x5a42=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa425[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require('lodash');var util=require(_0x5a42('0x0'));var logger=require(_0x5a42('0x1'))(_0x5a42('0x2'));var moment=require(_0x5a42('0x3'));var BPromise=require(_0x5a42('0x4'));var rp=require(_0x5a42('0x5'));var fs=require('fs');var path=require(_0x5a42('0x6'));var rimraf=require(_0x5a42('0x7'));var config=require('../../config/environment');var attributes=require(_0x5a42('0x8'));module[_0x5a42('0x9')]=function(_0x2482a9,_0xf09ff2){return _0x2482a9[_0x5a42('0xa')](_0x5a42('0xb'),attributes,{'tableName':_0x5a42('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 7dd93a6..86d4e42 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 _0xa429=['jayson/promise','client','http','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x5c81d1,_0x3e1d94){var _0x275777=function(_0x3db1e7){while(--_0x3db1e7){_0x5c81d1['push'](_0x5c81d1['shift']());}};_0x275777(++_0x3e1d94);}(_0xa429,0x189));var _0x9a42=function(_0x292f02,_0x5e8d21){_0x292f02=_0x292f02-0x0;var _0xa199c8=_0xa429[_0x292f02];return _0xa199c8;};'use strict';var _=require(_0x9a42('0x0'));var util=require('util');var moment=require(_0x9a42('0x1'));var BPromise=require(_0x9a42('0x2'));var rs=require(_0x9a42('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a42('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a42('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a42('0x6'));var client=jayson[_0x9a42('0x7')][_0x9a42('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7f0a59,_0x46954,_0x51ce9e){return new BPromise(function(_0x282a93,_0x378a49){return client['request'](_0x7f0a59,_0x51ce9e)['then'](function(_0x241e96){logger[_0x9a42('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x46954,_0x9a42('0xa'));logger[_0x9a42('0xb')](_0x9a42('0xc'),_0x46954,_0x9a42('0xa'),JSON[_0x9a42('0xd')](_0x241e96));if(_0x241e96[_0x9a42('0xe')]){if(_0x241e96[_0x9a42('0xe')][_0x9a42('0xf')]===0x1f4){logger[_0x9a42('0xe')](_0x9a42('0x10'),_0x46954,_0x241e96[_0x9a42('0xe')]['message']);return _0x378a49(_0x241e96[_0x9a42('0xe')][_0x9a42('0x11')]);}logger[_0x9a42('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x46954,_0x241e96[_0x9a42('0xe')][_0x9a42('0x11')]);return _0x282a93(_0x241e96['error'][_0x9a42('0x11')]);}else{logger[_0x9a42('0x9')](_0x9a42('0x10'),_0x46954,'request\x20sent');_0x282a93(_0x241e96[_0x9a42('0x12')]['message']);}})['catch'](function(_0x2afd14){logger[_0x9a42('0xe')](_0x9a42('0x10'),_0x46954,_0x2afd14);_0x378a49(_0x2afd14);});});} \ No newline at end of file +var _0x32df=['http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x4df756,_0x5da001){var _0x4373dc=function(_0x345ea2){while(--_0x345ea2){_0x4df756['push'](_0x4df756['shift']());}};_0x4373dc(++_0x5da001);}(_0x32df,0x107));var _0xf32d=function(_0x2a25cf,_0x2bc090){_0x2a25cf=_0x2a25cf-0x0;var _0x479173=_0x32df[_0x2a25cf];return _0x479173;};'use strict';var _=require(_0xf32d('0x0'));var util=require(_0xf32d('0x1'));var moment=require(_0xf32d('0x2'));var BPromise=require(_0xf32d('0x3'));var rs=require(_0xf32d('0x4'));var fs=require('fs');var Redis=require(_0xf32d('0x5'));var db=require(_0xf32d('0x6'))['db'];var utils=require(_0xf32d('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf32d('0x8'));var client=jayson[_0xf32d('0x9')][_0xf32d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b192,_0x86f4ab,_0x1ba87f){return new BPromise(function(_0x5e3925,_0x1af7b1){return client['request'](_0x50b192,_0x1ba87f)[_0xf32d('0xb')](function(_0xb90383){logger[_0xf32d('0xc')](_0xf32d('0xd'),_0x86f4ab,_0xf32d('0xe'));logger[_0xf32d('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x86f4ab,_0xf32d('0xe'),JSON[_0xf32d('0x10')](_0xb90383));if(_0xb90383[_0xf32d('0x11')]){if(_0xb90383['error'][_0xf32d('0x12')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x86f4ab,_0xb90383[_0xf32d('0x11')][_0xf32d('0x13')]);return _0x1af7b1(_0xb90383['error'][_0xf32d('0x13')]);}logger['error'](_0xf32d('0xd'),_0x86f4ab,_0xb90383[_0xf32d('0x11')][_0xf32d('0x13')]);return _0x5e3925(_0xb90383[_0xf32d('0x11')][_0xf32d('0x13')]);}else{logger['info'](_0xf32d('0xd'),_0x86f4ab,_0xf32d('0xe'));_0x5e3925(_0xb90383['result'][_0xf32d('0x13')]);}})[_0xf32d('0x14')](function(_0x5af97d){logger[_0xf32d('0x11')](_0xf32d('0xd'),_0x86f4ab,_0x5af97d);_0x1af7b1(_0x5af97d);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8e496d2..6754fd1 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 _0x8a1b=['get','index','/:id','isAuthenticated','show','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0xa89eba,_0x3c7334){var _0x4404cc=function(_0x3bbdba){while(--_0x3bbdba){_0xa89eba['push'](_0xa89eba['shift']());}};_0x4404cc(++_0x3c7334);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x46b090,_0x44800d){_0x46b090=_0x46b090-0x0;var _0x3e4f47=_0x8a1b[_0x46b090];return _0x3e4f47;};'use strict';var multer=require(_0xb8a1('0x0'));var util=require(_0xb8a1('0x1'));var path=require('path');var timeout=require(_0xb8a1('0x2'));var express=require(_0xb8a1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8a1('0x4'));var interaction=require(_0xb8a1('0x5'));var config=require(_0xb8a1('0x6'));var controller=require(_0xb8a1('0x7'));router[_0xb8a1('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8a1('0x9')]);router[_0xb8a1('0x8')](_0xb8a1('0xa'),auth[_0xb8a1('0xb')](),controller[_0xb8a1('0xc')]);router['post']('/',auth[_0xb8a1('0xb')](),controller['create']);router['put'](_0xb8a1('0xa'),auth[_0xb8a1('0xb')](),controller['update']);router[_0xb8a1('0xd')]('/:id',auth[_0xb8a1('0xb')](),controller[_0xb8a1('0xe')]);module[_0xb8a1('0xf')]=router; \ No newline at end of file +var _0x5640=['../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x5640,0x111));var _0x0564=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5640[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0564('0x0'));var util=require('util');var path=require(_0x0564('0x1'));var timeout=require(_0x0564('0x2'));var express=require(_0x0564('0x3'));var router=express[_0x0564('0x4')]();var fs_extra=require(_0x0564('0x5'));var auth=require(_0x0564('0x6'));var interaction=require(_0x0564('0x7'));var config=require(_0x0564('0x8'));var controller=require(_0x0564('0x9'));router[_0x0564('0xa')]('/',auth[_0x0564('0xb')](),controller[_0x0564('0xc')]);router[_0x0564('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0564('0xd')]);router[_0x0564('0xe')]('/',auth[_0x0564('0xb')](),controller[_0x0564('0xf')]);router['put'](_0x0564('0x10'),auth[_0x0564('0xb')](),controller['update']);router[_0x0564('0x11')](_0x0564('0x10'),auth['isAuthenticated'](),controller[_0x0564('0x12')]);module[_0x0564('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index cb1fd99..9224e99 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 _0xba6e=['name','STRING','sequelize','exports'];(function(_0x1d5470,_0x1a0b8a){var _0x47923d=function(_0x2c1ca3){while(--_0x2c1ca3){_0x1d5470['push'](_0x1d5470['shift']());}};_0x47923d(++_0x1a0b8a);}(_0xba6e,0x12a));var _0xeba6=function(_0x1615de,_0x3294c8){_0x1615de=_0x1615de-0x0;var _0x5b8cdb=_0xba6e[_0x1615de];return _0x5b8cdb;};'use strict';var Sequelize=require(_0xeba6('0x0'));module[_0xeba6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xeba6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeba6('0x3')]}}; \ No newline at end of file +var _0x0096=['name','sequelize','exports','STRING'];(function(_0xf427da,_0x2ed980){var _0x2408e9=function(_0x153ac9){while(--_0x153ac9){_0xf427da['push'](_0xf427da['shift']());}};_0x2408e9(++_0x2ed980);}(_0x0096,0xd1));var _0x6009=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x0096[_0x460150];return _0x340677;};'use strict';var Sequelize=require(_0x6009('0x0'));module[_0x6009('0x1')]={'name':{'type':Sequelize[_0x6009('0x2')],'unique':_0x6009('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d93c9bc..461e533 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 _0xa29b=['hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','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','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x86cca5,_0x464179){var _0xb99e8a=function(_0x5e4ab9){while(--_0x5e4ab9){_0x86cca5['push'](_0x86cca5['shift']());}};_0xb99e8a(++_0x464179);}(_0xa29b,0x174));var _0xba29=function(_0x32c57d,_0x4b455a){_0x32c57d=_0x32c57d-0x0;var _0x353d7f=_0xa29b[_0x32c57d];return _0x353d7f;};'use strict';var emlformat=require(_0xba29('0x0'));var rimraf=require(_0xba29('0x1'));var zipdir=require(_0xba29('0x2'));var jsonpatch=require(_0xba29('0x3'));var rp=require(_0xba29('0x4'));var moment=require(_0xba29('0x5'));var BPromise=require(_0xba29('0x6'));var Mustache=require(_0xba29('0x7'));var util=require(_0xba29('0x8'));var path=require(_0xba29('0x9'));var sox=require(_0xba29('0xa'));var csv=require(_0xba29('0xb'));var ejs=require(_0xba29('0xc'));var fs=require('fs');var fs_extra=require(_0xba29('0xd'));var _=require(_0xba29('0xe'));var squel=require(_0xba29('0xf'));var crypto=require('crypto');var jsforce=require(_0xba29('0x10'));var deskjs=require(_0xba29('0x11'));var toCsv=require(_0xba29('0xb'));var querystring=require(_0xba29('0x12'));var Papa=require(_0xba29('0x13'));var Redis=require(_0xba29('0x14'));var authService=require(_0xba29('0x15'));var qs=require(_0xba29('0x16'));var as=require(_0xba29('0x17'));var hardwareService=require(_0xba29('0x18'));var logger=require('../../config/logger')(_0xba29('0x19'));var utils=require('../../config/utils');var config=require(_0xba29('0x1a'));var licenseUtil=require(_0xba29('0x1b'));var db=require(_0xba29('0x1c'))['db'];function respondWithStatusCode(_0x236378,_0x2d103d){_0x2d103d=_0x2d103d||0xcc;return function(_0x2c5d37){if(_0x2c5d37){return _0x236378[_0xba29('0x1d')](_0x2d103d);}return _0x236378[_0xba29('0x1e')](_0x2d103d)[_0xba29('0x1f')]();};}function respondWithResult(_0x42f3e1,_0x3a3d34){_0x3a3d34=_0x3a3d34||0xc8;return function(_0x1948b9){if(_0x1948b9){return _0x42f3e1['status'](_0x3a3d34)[_0xba29('0x20')](_0x1948b9);}};}function respondWithFilteredResult(_0x15ba0d,_0x292805){return function(_0x49817f){if(_0x49817f){var _0x4093d3=typeof _0x292805[_0xba29('0x21')]===_0xba29('0x22')&&typeof _0x292805[_0xba29('0x23')]===_0xba29('0x22');var _0x36dd81=_0x49817f[_0xba29('0x24')];var _0xf37d77=_0x4093d3?0x0:_0x292805[_0xba29('0x21')];var _0x3041e3=_0x4093d3?_0x49817f[_0xba29('0x24')]:_0x292805[_0xba29('0x21')]+_0x292805['limit'];var _0x4de53b;if(_0x3041e3>=_0x36dd81){_0x3041e3=_0x36dd81;_0x4de53b=0xc8;}else{_0x4de53b=0xce;}_0x15ba0d['status'](_0x4de53b);return _0x15ba0d['set'](_0xba29('0x25'),_0xf37d77+'-'+_0x3041e3+'/'+_0x36dd81)[_0xba29('0x20')](_0x49817f);}return null;};}function patchUpdates(_0x2833c5){return function(_0x2c5969){try{jsonpatch['apply'](_0x2c5969,_0x2833c5,!![]);}catch(_0x5cc556){return BPromise[_0xba29('0x26')](_0x5cc556);}return _0x2c5969[_0xba29('0x27')]();};}function saveUpdates(_0x408fa9,_0x4ce714){return function(_0x161e4d){if(_0x161e4d){return _0x161e4d[_0xba29('0x28')](_0x408fa9)[_0xba29('0x29')](function(_0x3e2ad3){return _0x3e2ad3;});}return null;};}function removeEntity(_0x26ce86,_0x30d888){return function(_0x5d9f95){if(_0x5d9f95){return _0x5d9f95[_0xba29('0x2a')]()['then'](function(){var _0xc89452=_0x5d9f95[_0xba29('0x2b')]({'plain':!![]});var _0x1cc9ea=_0xba29('0x2c');return db[_0xba29('0x2d')][_0xba29('0x2a')]({'where':{'type':_0x1cc9ea,'resourceId':_0xc89452['id']}})[_0xba29('0x29')](function(){return _0x5d9f95;});})[_0xba29('0x29')](function(){_0x26ce86['status'](0xcc)[_0xba29('0x1f')]();});}};}function handleEntityNotFound(_0x4610e4,_0x4404b0){return function(_0x3fef92){if(!_0x3fef92){_0x4610e4[_0xba29('0x1d')](0x194);}return _0x3fef92;};}function handleError(_0xa5e111,_0x2fe859){_0x2fe859=_0x2fe859||0x1f4;return function(_0x14b9ff){logger[_0xba29('0x2e')](_0x14b9ff[_0xba29('0x2f')]);if(_0x14b9ff[_0xba29('0x30')]){delete _0x14b9ff[_0xba29('0x30')];}_0xa5e111[_0xba29('0x1e')](_0x2fe859)[_0xba29('0x31')](_0x14b9ff);};}exports[_0xba29('0x32')]=function(_0x37104f,_0x5a08f9){var _0x1f1548={},_0x170cc5={},_0x13a0be={'count':0x0,'rows':[]};var _0x4f10df=_[_0xba29('0x33')](db[_0xba29('0x34')]['rawAttributes'],function(_0xb75da1){return{'name':_0xb75da1[_0xba29('0x35')],'type':_0xb75da1[_0xba29('0x36')]['key']};});_0x170cc5[_0xba29('0x37')]=_[_0xba29('0x33')](_0x4f10df,_0xba29('0x30'));_0x170cc5[_0xba29('0x38')]=_[_0xba29('0x39')](_0x37104f['query']);_0x170cc5[_0xba29('0x3a')]=_[_0xba29('0x3b')](_0x170cc5[_0xba29('0x37')],_0x170cc5[_0xba29('0x38')]);_0x1f1548['attributes']=_[_0xba29('0x3b')](_0x170cc5[_0xba29('0x37')],qs[_0xba29('0x3c')](_0x37104f[_0xba29('0x38')][_0xba29('0x3c')]));_0x1f1548['attributes']=_0x1f1548[_0xba29('0x3d')][_0xba29('0x3e')]?_0x1f1548[_0xba29('0x3d')]:_0x170cc5['model'];if(!_0x37104f[_0xba29('0x38')][_0xba29('0x3f')]('nolimit')){_0x1f1548[_0xba29('0x23')]=qs[_0xba29('0x23')](_0x37104f[_0xba29('0x38')]['limit']);_0x1f1548['offset']=qs['offset'](_0x37104f['query'][_0xba29('0x21')]);}_0x1f1548[_0xba29('0x40')]=qs[_0xba29('0x41')](_0x37104f[_0xba29('0x38')][_0xba29('0x41')]);_0x1f1548[_0xba29('0x42')]=qs[_0xba29('0x3a')](_[_0xba29('0x43')](_0x37104f[_0xba29('0x38')],_0x170cc5[_0xba29('0x3a')]),_0x4f10df);if(_0x37104f['query'][_0xba29('0x44')]){_0x1f1548[_0xba29('0x42')]=_['merge'](_0x1f1548[_0xba29('0x42')],{'$or':_[_0xba29('0x33')](_0x4f10df,function(_0x236c68){if(_0x236c68[_0xba29('0x36')]!==_0xba29('0x45')){var _0x5c59be={};_0x5c59be[_0x236c68[_0xba29('0x30')]]={'$like':'%'+_0x37104f[_0xba29('0x38')]['filter']+'%'};return _0x5c59be;}})});}_0x1f1548=_[_0xba29('0x46')]({},_0x1f1548,_0x37104f[_0xba29('0x47')]);var _0x17f8d8={'where':_0x1f1548['where']};return db['Variable'][_0xba29('0x24')](_0x17f8d8)[_0xba29('0x29')](function(_0x201579){_0x13a0be[_0xba29('0x24')]=_0x201579;if(_0x37104f['query'][_0xba29('0x48')]){_0x1f1548['include']=[{'all':!![]}];}return db[_0xba29('0x34')][_0xba29('0x49')](_0x1f1548);})[_0xba29('0x29')](function(_0x490e5a){_0x13a0be[_0xba29('0x4a')]=_0x490e5a;return _0x13a0be;})[_0xba29('0x29')](respondWithFilteredResult(_0x5a08f9,_0x1f1548))[_0xba29('0x4b')](handleError(_0x5a08f9,null));};exports[_0xba29('0x4c')]=function(_0x58d38f,_0x4f314e){var _0x26e4a7={'raw':!![],'where':{'id':_0x58d38f[_0xba29('0x4d')]['id']}},_0x426eb3={};_0x426eb3['model']=_[_0xba29('0x39')](db[_0xba29('0x34')][_0xba29('0x4e')]);_0x426eb3['query']=_[_0xba29('0x39')](_0x58d38f[_0xba29('0x38')]);_0x426eb3[_0xba29('0x3a')]=_[_0xba29('0x3b')](_0x426eb3[_0xba29('0x37')],_0x426eb3[_0xba29('0x38')]);_0x26e4a7[_0xba29('0x3d')]=_[_0xba29('0x3b')](_0x426eb3['model'],qs[_0xba29('0x3c')](_0x58d38f['query'][_0xba29('0x3c')]));_0x26e4a7[_0xba29('0x3d')]=_0x26e4a7[_0xba29('0x3d')][_0xba29('0x3e')]?_0x26e4a7[_0xba29('0x3d')]:_0x426eb3['model'];if(_0x58d38f['query']['includeAll']){_0x26e4a7['include']=[{'all':!![]}];}_0x26e4a7=_[_0xba29('0x46')]({},_0x26e4a7,_0x58d38f[_0xba29('0x47')]);return db[_0xba29('0x34')][_0xba29('0x4f')](_0x26e4a7)[_0xba29('0x29')](handleEntityNotFound(_0x4f314e,null))['then'](respondWithResult(_0x4f314e,null))[_0xba29('0x4b')](handleError(_0x4f314e,null));};exports[_0xba29('0x50')]=function(_0x94d81c,_0x2385b8){return db['Variable'][_0xba29('0x50')](_0x94d81c[_0xba29('0x51')],{})[_0xba29('0x29')](function(_0x3685db){var _0x1ce564=_0x94d81c[_0xba29('0x52')]['get']({'plain':!![]});if(!_0x1ce564)throw new Error(_0xba29('0x53'));if(_0x1ce564['role']===_0xba29('0x52')){var _0x4e19e9=_0x3685db[_0xba29('0x2b')]({'plain':!![]});var _0x4661be=_0xba29('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x4661be,'userProfileId':_0x1ce564[_0xba29('0x54')]},'raw':!![]})[_0xba29('0x29')](function(_0x1659d9){if(_0x1659d9&&_0x1659d9[_0xba29('0x55')]===0x0){return db[_0xba29('0x2d')]['create']({'name':_0x4e19e9['name'],'resourceId':_0x4e19e9['id'],'type':_0x1659d9[_0xba29('0x30')],'sectionId':_0x1659d9['id']},{})['then'](function(){return _0x3685db;});}else{return _0x3685db;}})['catch'](function(_0x2c48c5){logger['error'](_0xba29('0x56'),_0x2c48c5);throw _0x2c48c5;});}return _0x3685db;})['then'](respondWithResult(_0x2385b8,0xc9))['catch'](handleError(_0x2385b8,null));};exports[_0xba29('0x28')]=function(_0x4d7df3,_0x3e3366){if(_0x4d7df3[_0xba29('0x51')]['id']){delete _0x4d7df3['body']['id'];}return db['Variable']['find']({'where':{'id':_0x4d7df3[_0xba29('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e3366,null))[_0xba29('0x29')](saveUpdates(_0x4d7df3[_0xba29('0x51')],null))[_0xba29('0x29')](respondWithResult(_0x3e3366,null))[_0xba29('0x4b')](handleError(_0x3e3366,null));};exports['destroy']=function(_0x18a195,_0x37f87b){return db[_0xba29('0x34')]['find']({'where':{'id':_0x18a195['params']['id']}})[_0xba29('0x29')](handleEntityNotFound(_0x37f87b,null))[_0xba29('0x29')](removeEntity(_0x37f87b,null))['catch'](handleError(_0x37f87b,null));}; \ No newline at end of file +var _0x5832=['user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','Variable','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x25750d,_0x1dd3f1){var _0x510e4c=function(_0x5e7463){while(--_0x5e7463){_0x25750d['push'](_0x25750d['shift']());}};_0x510e4c(++_0x1dd3f1);}(_0x5832,0xb7));var _0x2583=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x5832[_0x2b0a86];return _0x955940;};'use strict';var emlformat=require(_0x2583('0x0'));var rimraf=require(_0x2583('0x1'));var zipdir=require(_0x2583('0x2'));var jsonpatch=require(_0x2583('0x3'));var rp=require('request-promise');var moment=require(_0x2583('0x4'));var BPromise=require(_0x2583('0x5'));var Mustache=require('mustache');var util=require(_0x2583('0x6'));var path=require(_0x2583('0x7'));var sox=require(_0x2583('0x8'));var csv=require(_0x2583('0x9'));var ejs=require(_0x2583('0xa'));var fs=require('fs');var fs_extra=require(_0x2583('0xb'));var _=require(_0x2583('0xc'));var squel=require(_0x2583('0xd'));var crypto=require(_0x2583('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2583('0xf'));var toCsv=require(_0x2583('0x9'));var querystring=require(_0x2583('0x10'));var Papa=require(_0x2583('0x11'));var Redis=require(_0x2583('0x12'));var authService=require(_0x2583('0x13'));var qs=require(_0x2583('0x14'));var as=require(_0x2583('0x15'));var hardwareService=require(_0x2583('0x16'));var logger=require(_0x2583('0x17'))(_0x2583('0x18'));var utils=require(_0x2583('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2583('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x323454,_0x4327d2){_0x4327d2=_0x4327d2||0xcc;return function(_0x872148){if(_0x872148){return _0x323454[_0x2583('0x1b')](_0x4327d2);}return _0x323454[_0x2583('0x1c')](_0x4327d2)[_0x2583('0x1d')]();};}function respondWithResult(_0xd19c11,_0x47c88e){_0x47c88e=_0x47c88e||0xc8;return function(_0x32de14){if(_0x32de14){return _0xd19c11[_0x2583('0x1c')](_0x47c88e)['json'](_0x32de14);}};}function respondWithFilteredResult(_0x2cb8ec,_0x2b8ffd){return function(_0x23aad1){if(_0x23aad1){var _0x5e0afb=typeof _0x2b8ffd[_0x2583('0x1e')]===_0x2583('0x1f')&&typeof _0x2b8ffd[_0x2583('0x20')]===_0x2583('0x1f');var _0x57e8b4=_0x23aad1['count'];var _0x324822=_0x5e0afb?0x0:_0x2b8ffd['offset'];var _0x1fd93a=_0x5e0afb?_0x23aad1[_0x2583('0x21')]:_0x2b8ffd[_0x2583('0x1e')]+_0x2b8ffd['limit'];var _0x219d93;if(_0x1fd93a>=_0x57e8b4){_0x1fd93a=_0x57e8b4;_0x219d93=0xc8;}else{_0x219d93=0xce;}_0x2cb8ec['status'](_0x219d93);return _0x2cb8ec[_0x2583('0x22')](_0x2583('0x23'),_0x324822+'-'+_0x1fd93a+'/'+_0x57e8b4)[_0x2583('0x24')](_0x23aad1);}return null;};}function patchUpdates(_0x435fa3){return function(_0x1f3914){try{jsonpatch[_0x2583('0x25')](_0x1f3914,_0x435fa3,!![]);}catch(_0x29aef2){return BPromise[_0x2583('0x26')](_0x29aef2);}return _0x1f3914['save']();};}function saveUpdates(_0x2914d9,_0x2e8ae4){return function(_0x63e69){if(_0x63e69){return _0x63e69[_0x2583('0x27')](_0x2914d9)[_0x2583('0x28')](function(_0x5daf70){return _0x5daf70;});}return null;};}function removeEntity(_0x157ed2,_0x5dfd81){return function(_0x7c740b){if(_0x7c740b){return _0x7c740b['destroy']()['then'](function(){var _0x50694e=_0x7c740b[_0x2583('0x29')]({'plain':!![]});var _0x37f644='Variables';return db[_0x2583('0x2a')][_0x2583('0x2b')]({'where':{'type':_0x37f644,'resourceId':_0x50694e['id']}})[_0x2583('0x28')](function(){return _0x7c740b;});})['then'](function(){_0x157ed2[_0x2583('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c070,_0x2236cb){return function(_0x3337ed){if(!_0x3337ed){_0x41c070[_0x2583('0x1b')](0x194);}return _0x3337ed;};}function handleError(_0x310292,_0xfeae40){_0xfeae40=_0xfeae40||0x1f4;return function(_0x31a1d9){logger[_0x2583('0x2c')](_0x31a1d9[_0x2583('0x2d')]);if(_0x31a1d9['name']){delete _0x31a1d9[_0x2583('0x2e')];}_0x310292['status'](_0xfeae40)['send'](_0x31a1d9);};}exports[_0x2583('0x2f')]=function(_0x3f7ae4,_0x1bfb27){var _0x47b9f8={},_0x22ffed={},_0x5757bb={'count':0x0,'rows':[]};var _0x2ada35=_[_0x2583('0x30')](db[_0x2583('0x31')][_0x2583('0x32')],function(_0x449c56){return{'name':_0x449c56[_0x2583('0x33')],'type':_0x449c56['type'][_0x2583('0x34')]};});_0x22ffed[_0x2583('0x35')]=_[_0x2583('0x30')](_0x2ada35,_0x2583('0x2e'));_0x22ffed[_0x2583('0x36')]=_[_0x2583('0x37')](_0x3f7ae4[_0x2583('0x36')]);_0x22ffed[_0x2583('0x38')]=_[_0x2583('0x39')](_0x22ffed[_0x2583('0x35')],_0x22ffed[_0x2583('0x36')]);_0x47b9f8[_0x2583('0x3a')]=_[_0x2583('0x39')](_0x22ffed[_0x2583('0x35')],qs['fields'](_0x3f7ae4[_0x2583('0x36')]['fields']));_0x47b9f8[_0x2583('0x3a')]=_0x47b9f8['attributes'][_0x2583('0x3b')]?_0x47b9f8[_0x2583('0x3a')]:_0x22ffed['model'];if(!_0x3f7ae4[_0x2583('0x36')][_0x2583('0x3c')](_0x2583('0x3d'))){_0x47b9f8[_0x2583('0x20')]=qs[_0x2583('0x20')](_0x3f7ae4[_0x2583('0x36')][_0x2583('0x20')]);_0x47b9f8['offset']=qs['offset'](_0x3f7ae4[_0x2583('0x36')][_0x2583('0x1e')]);}_0x47b9f8[_0x2583('0x3e')]=qs[_0x2583('0x3f')](_0x3f7ae4['query'][_0x2583('0x3f')]);_0x47b9f8['where']=qs[_0x2583('0x38')](_[_0x2583('0x40')](_0x3f7ae4['query'],_0x22ffed['filters']),_0x2ada35);if(_0x3f7ae4['query'][_0x2583('0x41')]){_0x47b9f8[_0x2583('0x42')]=_['merge'](_0x47b9f8['where'],{'$or':_[_0x2583('0x30')](_0x2ada35,function(_0x130443){if(_0x130443[_0x2583('0x43')]!==_0x2583('0x44')){var _0x5cb172={};_0x5cb172[_0x130443['name']]={'$like':'%'+_0x3f7ae4[_0x2583('0x36')][_0x2583('0x41')]+'%'};return _0x5cb172;}})});}_0x47b9f8=_[_0x2583('0x45')]({},_0x47b9f8,_0x3f7ae4[_0x2583('0x46')]);var _0x5690a2={'where':_0x47b9f8[_0x2583('0x42')]};return db[_0x2583('0x31')]['count'](_0x5690a2)[_0x2583('0x28')](function(_0x56fba2){_0x5757bb['count']=_0x56fba2;if(_0x3f7ae4[_0x2583('0x36')][_0x2583('0x47')]){_0x47b9f8[_0x2583('0x48')]=[{'all':!![]}];}return db[_0x2583('0x31')][_0x2583('0x49')](_0x47b9f8);})[_0x2583('0x28')](function(_0x1855ab){_0x5757bb[_0x2583('0x4a')]=_0x1855ab;return _0x5757bb;})[_0x2583('0x28')](respondWithFilteredResult(_0x1bfb27,_0x47b9f8))[_0x2583('0x4b')](handleError(_0x1bfb27,null));};exports[_0x2583('0x4c')]=function(_0x3cd5a8,_0x3b4b05){var _0x4a87d4={'raw':!![],'where':{'id':_0x3cd5a8[_0x2583('0x4d')]['id']}},_0x5680b1={};_0x5680b1['model']=_[_0x2583('0x37')](db['Variable'][_0x2583('0x32')]);_0x5680b1[_0x2583('0x36')]=_['keys'](_0x3cd5a8['query']);_0x5680b1[_0x2583('0x38')]=_[_0x2583('0x39')](_0x5680b1['model'],_0x5680b1[_0x2583('0x36')]);_0x4a87d4[_0x2583('0x3a')]=_[_0x2583('0x39')](_0x5680b1[_0x2583('0x35')],qs[_0x2583('0x4e')](_0x3cd5a8['query'][_0x2583('0x4e')]));_0x4a87d4[_0x2583('0x3a')]=_0x4a87d4[_0x2583('0x3a')][_0x2583('0x3b')]?_0x4a87d4[_0x2583('0x3a')]:_0x5680b1[_0x2583('0x35')];if(_0x3cd5a8['query']['includeAll']){_0x4a87d4[_0x2583('0x48')]=[{'all':!![]}];}_0x4a87d4=_[_0x2583('0x45')]({},_0x4a87d4,_0x3cd5a8[_0x2583('0x46')]);return db[_0x2583('0x31')][_0x2583('0x4f')](_0x4a87d4)[_0x2583('0x28')](handleEntityNotFound(_0x3b4b05,null))[_0x2583('0x28')](respondWithResult(_0x3b4b05,null))[_0x2583('0x4b')](handleError(_0x3b4b05,null));};exports[_0x2583('0x50')]=function(_0x543a9e,_0xab2c31){return db[_0x2583('0x31')][_0x2583('0x50')](_0x543a9e[_0x2583('0x51')],{})[_0x2583('0x28')](function(_0x118f0e){var _0x401851=_0x543a9e['user'][_0x2583('0x29')]({'plain':!![]});if(!_0x401851)throw new Error(_0x2583('0x52'));if(_0x401851[_0x2583('0x53')]===_0x2583('0x54')){var _0x5972bb=_0x118f0e[_0x2583('0x29')]({'plain':!![]});var _0x209764='Variables';return db[_0x2583('0x55')][_0x2583('0x4f')]({'where':{'name':_0x209764,'userProfileId':_0x401851[_0x2583('0x56')]},'raw':!![]})[_0x2583('0x28')](function(_0x57a32f){if(_0x57a32f&&_0x57a32f[_0x2583('0x57')]===0x0){return db[_0x2583('0x2a')][_0x2583('0x50')]({'name':_0x5972bb[_0x2583('0x2e')],'resourceId':_0x5972bb['id'],'type':_0x57a32f['name'],'sectionId':_0x57a32f['id']},{})[_0x2583('0x28')](function(){return _0x118f0e;});}else{return _0x118f0e;}})[_0x2583('0x4b')](function(_0xdf3c89){logger['error'](_0x2583('0x58'),_0xdf3c89);throw _0xdf3c89;});}return _0x118f0e;})[_0x2583('0x28')](respondWithResult(_0xab2c31,0xc9))[_0x2583('0x4b')](handleError(_0xab2c31,null));};exports[_0x2583('0x27')]=function(_0x4e9e4d,_0x4fb6ef){if(_0x4e9e4d[_0x2583('0x51')]['id']){delete _0x4e9e4d['body']['id'];}return db[_0x2583('0x31')][_0x2583('0x4f')]({'where':{'id':_0x4e9e4d[_0x2583('0x4d')]['id']}})[_0x2583('0x28')](handleEntityNotFound(_0x4fb6ef,null))[_0x2583('0x28')](saveUpdates(_0x4e9e4d[_0x2583('0x51')],null))[_0x2583('0x28')](respondWithResult(_0x4fb6ef,null))[_0x2583('0x4b')](handleError(_0x4fb6ef,null));};exports[_0x2583('0x2b')]=function(_0xec2b7a,_0xeeb1a6){return db[_0x2583('0x31')][_0x2583('0x4f')]({'where':{'id':_0xec2b7a['params']['id']}})[_0x2583('0x28')](handleEntityNotFound(_0xeeb1a6,null))[_0x2583('0x28')](removeEntity(_0xeeb1a6,null))[_0x2583('0x4b')](handleError(_0xeeb1a6,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index dac6ddc..856ef5d 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 _0x1c61=['Variable','tools_variables','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0xe261ee,_0x2a2183){var _0x1e06b3=function(_0x41fdf6){while(--_0x41fdf6){_0xe261ee['push'](_0xe261ee['shift']());}};_0x1e06b3(++_0x2a2183);}(_0x1c61,0x9c));var _0x11c6=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x1c61[_0x502953];return _0x2fa32d;};'use strict';var _=require('lodash');var util=require(_0x11c6('0x0'));var logger=require('../../config/logger')(_0x11c6('0x1'));var moment=require(_0x11c6('0x2'));var BPromise=require(_0x11c6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11c6('0x4'));var rimraf=require(_0x11c6('0x5'));var config=require(_0x11c6('0x6'));var attributes=require('./variable.attributes');module[_0x11c6('0x7')]=function(_0x5e6c28,_0x4c86ca){return _0x5e6c28[_0x11c6('0x8')](_0x11c6('0x9'),attributes,{'tableName':_0x11c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90fd=['lodash','util','../../config/logger','api','moment','request-promise','path','define','Variable','tools_variables'];(function(_0x4fdcf7,_0x504ea7){var _0x4055e2=function(_0x1757c2){while(--_0x1757c2){_0x4fdcf7['push'](_0x4fdcf7['shift']());}};_0x4055e2(++_0x504ea7);}(_0x90fd,0x1cc));var _0xd90f=function(_0x4b1859,_0x2def7f){_0x4b1859=_0x4b1859-0x0;var _0x54590a=_0x90fd[_0x4b1859];return _0x54590a;};'use strict';var _=require(_0xd90f('0x0'));var util=require(_0xd90f('0x1'));var logger=require(_0xd90f('0x2'))(_0xd90f('0x3'));var moment=require(_0xd90f('0x4'));var BPromise=require('bluebird');var rp=require(_0xd90f('0x5'));var fs=require('fs');var path=require(_0xd90f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module['exports']=function(_0xa930f1,_0x2b94aa){return _0xa930f1[_0xd90f('0x7')](_0xd90f('0x8'),attributes,{'tableName':_0xd90f('0x9'),'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 05f50d7..eb0c6b1 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x49ed32,_0x573235){var _0x5f04c1=function(_0x35e88b){while(--_0x35e88b){_0x49ed32['push'](_0x49ed32['shift']());}};_0x5f04c1(++_0x573235);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4b84[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x35a810,_0x5075ae){var _0x53692c=function(_0xcada29){while(--_0xcada29){_0x35a810['push'](_0x35a810['shift']());}};_0x53692c(++_0x5075ae);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e7b80ef..71a0759 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 _0x6861=['./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','/migrations','migrations','express','Router'];(function(_0xb260f8,_0xc008c5){var _0x63096d=function(_0x27fb13){while(--_0x27fb13){_0xb260f8['push'](_0xb260f8['shift']());}};_0x63096d(++_0xc008c5);}(_0x6861,0x10f));var _0x1686=function(_0x54c4f4,_0x186a48){_0x54c4f4=_0x54c4f4-0x0;var _0x30f393=_0x6861[_0x54c4f4];return _0x30f393;};'use strict';var express=require(_0x1686('0x0'));var router=express[_0x1686('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x1686('0x2'));router[_0x1686('0x3')]('/',controller[_0x1686('0x4')]);router[_0x1686('0x3')](_0x1686('0x5'),auth[_0x1686('0x6')](),auth[_0x1686('0x7')](),controller['fetch']);router[_0x1686('0x3')](_0x1686('0x8'),auth[_0x1686('0x6')](),auth['canUpdate'](),controller[_0x1686('0x9')]);router[_0x1686('0x3')](_0x1686('0xa'),auth[_0x1686('0x6')](),auth[_0x1686('0x7')](),controller['pull']);router[_0x1686('0x3')]('/restart',auth[_0x1686('0x6')](),controller['restart']);router[_0x1686('0x3')](_0x1686('0xb'),controller[_0x1686('0xc')]);module['exports']=router; \ No newline at end of file +var _0xdfe5=['express','../../components/auth/service','./version.controller','get','/fetch','canUpdate','fetch','reset','/pull','isAuthenticated','pull','/restart','restart','/migrations','migrations','exports'];(function(_0x2055b9,_0x20b1ce){var _0x42a3b9=function(_0x54c7aa){while(--_0x54c7aa){_0x2055b9['push'](_0x2055b9['shift']());}};_0x42a3b9(++_0x20b1ce);}(_0xdfe5,0x150));var _0x5dfe=function(_0x56ef7e,_0x64908a){_0x56ef7e=_0x56ef7e-0x0;var _0x35cf58=_0xdfe5[_0x56ef7e];return _0x35cf58;};'use strict';var express=require(_0x5dfe('0x0'));var router=express['Router']();var auth=require(_0x5dfe('0x1'));var controller=require(_0x5dfe('0x2'));router[_0x5dfe('0x3')]('/',controller['index']);router[_0x5dfe('0x3')](_0x5dfe('0x4'),auth['isAuthenticated'](),auth[_0x5dfe('0x5')](),controller[_0x5dfe('0x6')]);router[_0x5dfe('0x3')]('/reset',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x5dfe('0x7')]);router[_0x5dfe('0x3')](_0x5dfe('0x8'),auth[_0x5dfe('0x9')](),auth['canUpdate'](),controller[_0x5dfe('0xa')]);router[_0x5dfe('0x3')](_0x5dfe('0xb'),auth[_0x5dfe('0x9')](),controller[_0x5dfe('0xc')]);router[_0x5dfe('0x3')](_0x5dfe('0xd'),controller[_0x5dfe('0xe')]);module[_0x5dfe('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 b9ef889..c482531 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 _0x0616=['FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','version','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','pkginfo','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','json','origin','error','info','git\x20fetch','status','reset','--hard'];(function(_0x2ce9c3,_0x20a165){var _0x109b3a=function(_0xfd90e2){while(--_0xfd90e2){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0x109b3a(++_0x20a165);}(_0x0616,0x18f));var _0x6061=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x0616[_0x11f0e3];return _0x2892e8;};'use strict';var Umzug=require(_0x6061('0x0'));var path=require(_0x6061('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6061('0x2'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x6061('0x3'))[_0x6061('0x4')];var db=require(_0x6061('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x6061('0x6'));var logger=require(_0x6061('0x7'))(_0x6061('0x8'));var git=require(_0x6061('0x9'))(config[_0x6061('0xa')]);exports[_0x6061('0xb')]=function(_0x3e796f,_0x43f3c5){var _0x1e429b={'current':module[_0x6061('0xc')]['version'],'phonebar':0x2};if(_0x3e796f[_0x6061('0xd')]&&_0x3e796f['query'][_0x6061('0xe')]){return git[_0x6061('0xf')]()[_0x6061('0x10')](function(_0x4fd0f7,_0x5cb1ea){_0x1e429b[_0x6061('0xe')]=(_0x4fd0f7?module[_0x6061('0xc')]['version']:_0x5cb1ea['latest'])||'2.0.0';return _0x43f3c5['status'](0xc8)[_0x6061('0x11')](_0x1e429b);});}else{return _0x43f3c5['status'](0xc8)[_0x6061('0x11')](_0x1e429b);}};exports[_0x6061('0xf')]=function(_0x421499,_0x15b388){return git[_0x6061('0xf')]([_0x6061('0x12'),'master'],function(_0x4b29d9){if(_0x4b29d9){logger[_0x6061('0x13')](_0x4b29d9);return _0x15b388['status'](0x1f4)['json'](_0x4b29d9);}logger[_0x6061('0x14')](_0x6061('0x15'));return _0x15b388[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x6061('0x17')]=function(_0x24b0b7,_0x2a7567){return git['reset']([_0x6061('0x18'),_0x6061('0x19')],function(_0x3cd135){if(_0x3cd135){logger[_0x6061('0x13')](_0x3cd135);return _0x2a7567['status'](0x1f4)[_0x6061('0x11')](_0x3cd135);}logger[_0x6061('0x14')](_0x6061('0x1a'));return _0x2a7567['status'](0xc8)[_0x6061('0x11')]({'output':_0x6061('0x1b')});});};exports[_0x6061('0x1c')]=function(_0x15ac7d,_0x58a7af){exec(_0x6061('0x1d'),function(_0x301e2d,_0x4b36f9,_0x3e506d){logger[_0x6061('0x14')](_0x4b36f9);logger[_0x6061('0x14')](_0x3e506d);if(_0x301e2d){logger[_0x6061('0x13')](_0x301e2d);return _0x58a7af[_0x6061('0x16')](0x1f4)[_0x6061('0x11')](_0x301e2d);}return _0x58a7af[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':_0x4b36f9});});};exports['restart']=function(_0x1562f1,_0xc12544){return pm2[_0x6061('0x1e')](_0x6061('0x1f'))[_0x6061('0x20')](function(_0x4a0242){logger[_0x6061('0x14')](_0x6061('0x21'),_0x4a0242);return _0xc12544[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':_0x6061('0x22')});})[_0x6061('0x23')](function(_0x211215){logger[_0x6061('0x13')](_0x211215);return _0xc12544[_0x6061('0x16')](0x1f4)[_0x6061('0x11')](_0x211215);});};exports['migrations']=function(_0x503bb0,_0x1a8ce8){var _0x22fd23=fs[_0x6061('0x24')](path[_0x6061('0x25')](config[_0x6061('0xa')],_0x6061('0x26'),_0x6061('0x27')));var _0x5b1fc7=[];for(var _0x354201=0x0;_0x354201<_0x22fd23[_0x6061('0x28')];_0x354201++){var _0x32a315=_0x22fd23[_0x354201][_0x6061('0x29')](_0x6061('0x2a'),'');if(compareVersions(module[_0x6061('0xc')][_0x6061('0x2b')],_0x32a315)===-0x1){_0x5b1fc7['push'](_0x32a315);}}if(_0x5b1fc7['length']){var _0x5efaa9=_0x5b1fc7[_0x6061('0x2c')](compareVersions);var _0xd1709=new Umzug({'storage':_0x6061('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0x6061('0x2e'),'columnName':_0x6061('0x2b')},'migrations':{'params':[db[_0x6061('0x2d')][_0x6061('0x2f')](),db[_0x6061('0x2d')][_0x6061('0x30')],function(){throw new Error(_0x6061('0x31'));}],'path':path['join'](config['root'],_0x6061('0x26'),_0x6061('0x27')),'pattern':/\.js$/}});_0xd1709['up']({'migrations':_['map'](_0x5efaa9,function(_0x3af7fb){return _0x3af7fb+_0x6061('0x2a');})})['then'](function(){return _0x1a8ce8[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x6061('0xc')]['version']+_0x6061('0x32')+_[_0x6061('0x33')](_0x5efaa9),'migrations':_[_0x6061('0x25')](_0x5efaa9)});})[_0x6061('0x23')](function(_0x194ce0){if(_0x194ce0 instanceof db['sequelize']['UniqueConstraintError']){return _0x1a8ce8[_0x6061('0x16')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1a8ce8[_0x6061('0x16')](0x1f4)[_0x6061('0x11')](_0x194ce0);}});}else{return _0x1a8ce8[_0x6061('0x16')](0xc8)[_0x6061('0x11')]({'output':_0x6061('0x34')});}}; \ No newline at end of file +var _0x070d=['simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','json','status','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger'];(function(_0x161c36,_0x2a6839){var _0x4fed87=function(_0x2b94cf){while(--_0x2b94cf){_0x161c36['push'](_0x161c36['shift']());}};_0x4fed87(++_0x2a6839);}(_0x070d,0x14c));var _0xd070=function(_0x566c40,_0x3c2178){_0x566c40=_0x566c40-0x0;var _0x5152ec=_0x070d[_0x566c40];return _0x5152ec;};'use strict';var Umzug=require(_0xd070('0x0'));var path=require(_0xd070('0x1'));var fs=require('fs');var _=require(_0xd070('0x2'));var pkginfo=require(_0xd070('0x3'))(module,_0xd070('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xd070('0x5'))[_0xd070('0x6')];var db=require(_0xd070('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xd070('0x8'));var logger=require(_0xd070('0x9'))('update');var git=require(_0xd070('0xa'))(config[_0xd070('0xb')]);exports[_0xd070('0xc')]=function(_0x31e3f4,_0x23f08a){var _0x59d60c={'current':module[_0xd070('0xd')][_0xd070('0x4')],'phonebar':0x2};if(_0x31e3f4['query']&&_0x31e3f4[_0xd070('0xe')][_0xd070('0xf')]){return git[_0xd070('0x10')]()[_0xd070('0x11')](function(_0x3b7a50,_0x4d6f96){_0x59d60c[_0xd070('0xf')]=(_0x3b7a50?module[_0xd070('0xd')][_0xd070('0x4')]:_0x4d6f96[_0xd070('0xf')])||_0xd070('0x12');return _0x23f08a['status'](0xc8)[_0xd070('0x13')](_0x59d60c);});}else{return _0x23f08a[_0xd070('0x14')](0xc8)[_0xd070('0x13')](_0x59d60c);}};exports[_0xd070('0x10')]=function(_0x3ad3da,_0x42add1){return git[_0xd070('0x10')](['origin',_0xd070('0x15')],function(_0x2e3a28){if(_0x2e3a28){logger[_0xd070('0x16')](_0x2e3a28);return _0x42add1[_0xd070('0x14')](0x1f4)[_0xd070('0x13')](_0x2e3a28);}logger[_0xd070('0x17')](_0xd070('0x18'));return _0x42add1[_0xd070('0x14')](0xc8)[_0xd070('0x13')]({'output':_0xd070('0x19')});});};exports[_0xd070('0x1a')]=function(_0x5503e3,_0x2fcddb){return git[_0xd070('0x1a')]([_0xd070('0x1b'),_0xd070('0x1c')],function(_0x4723da){if(_0x4723da){logger[_0xd070('0x16')](_0x4723da);return _0x2fcddb[_0xd070('0x14')](0x1f4)['json'](_0x4723da);}logger[_0xd070('0x17')](_0xd070('0x1d'));return _0x2fcddb[_0xd070('0x14')](0xc8)[_0xd070('0x13')]({'output':_0xd070('0x1e')});});};exports[_0xd070('0x1f')]=function(_0x397170,_0xed8e2b){exec(_0xd070('0x20'),function(_0x3061bb,_0x4ac99d,_0x520998){logger['info'](_0x4ac99d);logger[_0xd070('0x17')](_0x520998);if(_0x3061bb){logger[_0xd070('0x16')](_0x3061bb);return _0xed8e2b[_0xd070('0x14')](0x1f4)['json'](_0x3061bb);}return _0xed8e2b['status'](0xc8)[_0xd070('0x13')]({'output':_0x4ac99d});});};exports[_0xd070('0x21')]=function(_0x11aa1b,_0x588894){return pm2[_0xd070('0x21')](_0xd070('0x22'))[_0xd070('0x23')](function(_0x39b7f8){logger[_0xd070('0x17')](_0xd070('0x24'),_0x39b7f8);return _0x588894[_0xd070('0x14')](0xc8)[_0xd070('0x13')]({'output':_0xd070('0x25')});})[_0xd070('0x26')](function(_0x906319){logger[_0xd070('0x16')](_0x906319);return _0x588894[_0xd070('0x14')](0x1f4)[_0xd070('0x13')](_0x906319);});};exports[_0xd070('0x27')]=function(_0x470d17,_0x35aa01){var _0x38b372=fs[_0xd070('0x28')](path[_0xd070('0x29')](config[_0xd070('0xb')],_0xd070('0x2a'),_0xd070('0x27')));var _0x40751c=[];for(var _0x30647a=0x0;_0x30647a<_0x38b372[_0xd070('0x2b')];_0x30647a++){var _0x702287=_0x38b372[_0x30647a][_0xd070('0x2c')](_0xd070('0x2d'),'');if(compareVersions(module['exports']['version'],_0x702287)===-0x1){_0x40751c[_0xd070('0x2e')](_0x702287);}}if(_0x40751c[_0xd070('0x2b')]){var _0x1a630f=_0x40751c[_0xd070('0x2f')](compareVersions);var _0x13e1a7=new Umzug({'storage':_0xd070('0x30'),'storageOptions':{'model':db[_0xd070('0x31')],'modelName':_0xd070('0x31'),'columnName':'version'},'migrations':{'params':[db[_0xd070('0x30')]['getQueryInterface'](),db[_0xd070('0x30')][_0xd070('0x32')],function(){throw new Error(_0xd070('0x33'));}],'path':path[_0xd070('0x29')](config['root'],_0xd070('0x2a'),_0xd070('0x27')),'pattern':/\.js$/}});_0x13e1a7['up']({'migrations':_[_0xd070('0x34')](_0x1a630f,function(_0x4d3026){return _0x4d3026+_0xd070('0x2d');})})[_0xd070('0x23')](function(){return _0x35aa01[_0xd070('0x14')](0xc8)[_0xd070('0x13')]({'output':_0xd070('0x35')+module[_0xd070('0xd')][_0xd070('0x4')]+_0xd070('0x36')+_['last'](_0x1a630f),'migrations':_[_0xd070('0x29')](_0x1a630f)});})['catch'](function(_0x49f401){if(_0x49f401 instanceof db[_0xd070('0x30')][_0xd070('0x37')]){return _0x35aa01[_0xd070('0x14')](0xc8)[_0xd070('0x13')]({'output':_0xd070('0x38')});}else{return _0x35aa01[_0xd070('0x14')](0x1f4)['json'](_0x49f401);}});}else{return _0x35aa01[_0xd070('0x14')](0xc8)['json']({'output':_0xd070('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index afe0802..a87e167 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 _0x4788=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4788,0x110));var _0x8478=function(_0x12ca7a,_0x3295bf){_0x12ca7a=_0x12ca7a-0x0;var _0x2249df=_0x4788[_0x12ca7a];return _0x2249df;};'use strict';var multer=require(_0x8478('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8478('0x1'));var router=express[_0x8478('0x2')]();var fs_extra=require(_0x8478('0x3'));var auth=require(_0x8478('0x4'));var interaction=require(_0x8478('0x5'));var config=require(_0x8478('0x6'));var controller=require(_0x8478('0x7'));router[_0x8478('0x8')]('/',auth[_0x8478('0x9')](),controller[_0x8478('0xa')]);router[_0x8478('0x8')](_0x8478('0xb'),auth[_0x8478('0x9')](),controller[_0x8478('0xc')]);router[_0x8478('0x8')]('/:id',auth[_0x8478('0x9')](),controller[_0x8478('0xd')]);router[_0x8478('0xe')]('/',auth[_0x8478('0x9')](),controller[_0x8478('0xf')]);router[_0x8478('0x10')](_0x8478('0x11'),auth[_0x8478('0x9')](),controller['update']);router[_0x8478('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8478('0x13')]);module[_0x8478('0x14')]=router; \ No newline at end of file +var _0xf717=['describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe'];(function(_0x34473f,_0x2b9c5c){var _0x25cf6f=function(_0x4214a2){while(--_0x4214a2){_0x34473f['push'](_0x34473f['shift']());}};_0x25cf6f(++_0x2b9c5c);}(_0xf717,0x65));var _0x7f71=function(_0xec84e,_0x3a4944){_0xec84e=_0xec84e-0x0;var _0x21b7f9=_0xf717[_0xec84e];return _0x21b7f9;};'use strict';var multer=require(_0x7f71('0x0'));var util=require(_0x7f71('0x1'));var path=require(_0x7f71('0x2'));var timeout=require(_0x7f71('0x3'));var express=require('express');var router=express[_0x7f71('0x4')]();var fs_extra=require(_0x7f71('0x5'));var auth=require(_0x7f71('0x6'));var interaction=require(_0x7f71('0x7'));var config=require(_0x7f71('0x8'));var controller=require(_0x7f71('0x9'));router[_0x7f71('0xa')]('/',auth[_0x7f71('0xb')](),controller[_0x7f71('0xc')]);router[_0x7f71('0xa')](_0x7f71('0xd'),auth[_0x7f71('0xb')](),controller[_0x7f71('0xe')]);router['get']('/:id',auth[_0x7f71('0xb')](),controller[_0x7f71('0xf')]);router['post']('/',auth[_0x7f71('0xb')](),controller[_0x7f71('0x10')]);router[_0x7f71('0x11')](_0x7f71('0x12'),auth[_0x7f71('0xb')](),controller[_0x7f71('0x13')]);router[_0x7f71('0x14')](_0x7f71('0x12'),auth['isAuthenticated'](),controller[_0x7f71('0x15')]);module[_0x7f71('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 5e76c29..72f4fa7 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 _0x9ccd=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x11034c,_0x4248b9){var _0x37aa6a=function(_0x829549){while(--_0x829549){_0x11034c['push'](_0x11034c['shift']());}};_0x37aa6a(++_0x4248b9);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd9cc('0x0'));module['exports']={'type':{'type':Sequelize[_0xd9cc('0x1')]},'uniqueid':{'type':Sequelize[_0xd9cc('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd9cc('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd9cc('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd9cc('0x2')]},'agentconnectAt':{'type':Sequelize[_0xd9cc('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd9cc('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd9cc('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd9cc('0x2')]},'holdtime':{'type':Sequelize[_0xd9cc('0x3')]},'agentcomplete':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd9cc('0x3')]},'agentacw':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd9cc('0x3')]},'reason':{'type':Sequelize[_0xd9cc('0x1')]},'lastevent':{'type':Sequelize[_0xd9cc('0x1')]},'channel':{'type':Sequelize[_0xd9cc('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd9cc('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd9cc('0x1')]},'connectedlinename':{'type':Sequelize[_0xd9cc('0x1')]},'language':{'type':Sequelize[_0xd9cc('0x1')]},'accountcode':{'type':Sequelize[_0xd9cc('0x1')]},'context':{'type':Sequelize[_0xd9cc('0x1')]},'exten':{'type':Sequelize[_0xd9cc('0x1')]},'priority':{'type':Sequelize[_0xd9cc('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd9cc('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd9cc('0x1')]},'destaccountcode':{'type':Sequelize[_0xd9cc('0x1')]},'destcontext':{'type':Sequelize[_0xd9cc('0x1')]},'destexten':{'type':Sequelize[_0xd9cc('0x1')]},'destpriority':{'type':Sequelize[_0xd9cc('0x1')]},'destuniqueid':{'type':Sequelize[_0xd9cc('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd9cc('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd9cc('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd9cc('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd9cc('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd9cc('0x1')]},'agententerreason':{'type':Sequelize[_0xd9cc('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8580=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8580,0x1c7));var _0x0858=function(_0x2f1b2e,_0x4a6424){_0x2f1b2e=_0x2f1b2e-0x0;var _0x2bd02a=_0x8580[_0x2f1b2e];return _0x2bd02a;};'use strict';var Sequelize=require('sequelize');module[_0x0858('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0858('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0858('0x1')]},'interface':{'type':Sequelize[_0x0858('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0858('0x2')]},'agentconnectAt':{'type':Sequelize[_0x0858('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x0858('0x2')]},'agentdumpAt':{'type':Sequelize[_0x0858('0x2')]},'holdtime':{'type':Sequelize[_0x0858('0x3')]},'agentcomplete':{'type':Sequelize[_0x0858('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0858('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0858('0x3')]},'agentacw':{'type':Sequelize[_0x0858('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x0858('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x0858('0x3')]},'channelstatedesc':{'type':Sequelize[_0x0858('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0858('0x1')]},'connectedlinename':{'type':Sequelize[_0x0858('0x1')]},'language':{'type':Sequelize[_0x0858('0x1')]},'accountcode':{'type':Sequelize[_0x0858('0x1')]},'context':{'type':Sequelize[_0x0858('0x1')]},'exten':{'type':Sequelize[_0x0858('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0858('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x0858('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x0858('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0858('0x1')]},'destcontext':{'type':Sequelize[_0x0858('0x1')]},'destexten':{'type':Sequelize[_0x0858('0x1')]},'destpriority':{'type':Sequelize[_0x0858('0x1')]},'destuniqueid':{'type':Sequelize[_0x0858('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0858('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x0858('0x1')]},'transfer':{'type':Sequelize[_0x0858('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0858('0x1')],'comment':_0x0858('0x5')},'transferexten':{'type':Sequelize[_0x0858('0x1')]},'transferuniqueid':{'type':Sequelize[_0x0858('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 00a2968..2bcc598 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 db2b2d0..13b4889 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 _0x2494=['api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','define','report_agent','uniqueid','destuniqueid','lodash','../../config/logger'];(function(_0x12992b,_0x42b21b){var _0xa9fdde=function(_0x94f16d){while(--_0x94f16d){_0x12992b['push'](_0x12992b['shift']());}};_0xa9fdde(++_0x42b21b);}(_0x2494,0x82));var _0x4249=function(_0x21da34,_0x4b35b7){_0x21da34=_0x21da34-0x0;var _0x2b2f06=_0x2494[_0x21da34];return _0x2b2f06;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x4249('0x9'),'paranoid':![],'indexes':[{'fields':[_0x4249('0xa'),_0x4249('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['report_agent','util','../../config/logger','api','bluebird','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x038b,0x114));var _0xb038=function(_0xa64b6a,_0x2e7026){_0xa64b6a=_0xa64b6a-0x0;var _0x2e0ccb=_0x038b[_0xa64b6a];return _0x2e0ccb;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index fa99f5e..52022d0 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 _0xe23f=['debug','UpdateVoiceAgentReport','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw'];(function(_0x145815,_0xfe4fd2){var _0x1fa728=function(_0x13902e){while(--_0x13902e){_0x145815['push'](_0x145815['shift']());}};_0x1fa728(++_0xfe4fd2);}(_0xe23f,0x1d5));var _0xfe23=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe23f[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xfe23('0x0'));var util=require(_0xfe23('0x1'));var moment=require('moment');var BPromise=require(_0xfe23('0x2'));var rs=require(_0xfe23('0x3'));var fs=require('fs');var Redis=require(_0xfe23('0x4'));var db=require(_0xfe23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe23('0x6'))(_0xfe23('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfe23('0x8')][_0xfe23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29c9c8,_0x1c9022,_0x2f470b){return new BPromise(function(_0x2d14eb,_0x4d86d2){return client[_0xfe23('0xa')](_0x29c9c8,_0x2f470b)[_0xfe23('0xb')](function(_0x345a37){logger[_0xfe23('0xc')](_0xfe23('0xd'),_0x1c9022,_0xfe23('0xe'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1c9022,_0xfe23('0xe'),JSON[_0xfe23('0xf')](_0x345a37));if(_0x345a37['error']){if(_0x345a37['error'][_0xfe23('0x10')]===0x1f4){logger[_0xfe23('0x11')](_0xfe23('0xd'),_0x1c9022,_0x345a37['error'][_0xfe23('0x12')]);return _0x4d86d2(_0x345a37[_0xfe23('0x11')][_0xfe23('0x12')]);}logger[_0xfe23('0x11')](_0xfe23('0xd'),_0x1c9022,_0x345a37['error'][_0xfe23('0x12')]);return _0x2d14eb(_0x345a37[_0xfe23('0x11')][_0xfe23('0x12')]);}else{logger[_0xfe23('0xc')](_0xfe23('0xd'),_0x1c9022,_0xfe23('0xe'));_0x2d14eb(_0x345a37[_0xfe23('0x13')][_0xfe23('0x12')]);}})[_0xfe23('0x14')](function(_0x51c173){logger[_0xfe23('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x1c9022,_0x51c173);_0x4d86d2(_0x51c173);});});}exports[_0xfe23('0x15')]=function(_0x2b8530){var _0x4c694e=this;return new Promise(function(_0xa58ee6,_0x3d4255){return db[_0xfe23('0x16')][_0xfe23('0x17')](_0x2b8530[_0xfe23('0x18')],{'raw':_0x2b8530['options']?_0x2b8530['options'][_0xfe23('0x19')]===undefined?!![]:![]:!![]})[_0xfe23('0xb')](function(_0x2fed27){logger[_0xfe23('0xc')]('CreateVoiceAgentReport',_0x2b8530);logger[_0xfe23('0x1a')](_0xfe23('0x15'),_0x2b8530,JSON[_0xfe23('0xf')](_0x2fed27));_0xa58ee6(_0x2fed27);})['catch'](function(_0x415772){logger[_0xfe23('0x11')]('CreateVoiceAgentReport',_0x415772[_0xfe23('0x12')],_0x2b8530);_0x3d4255(_0x4c694e['error'](0x1f4,_0x415772[_0xfe23('0x12')]));});});};exports[_0xfe23('0x1b')]=function(_0x2c9bc9){var _0x2bc3b2=this;return new Promise(function(_0x8c32b9,_0x58bc49){return db[_0xfe23('0x16')][_0xfe23('0x1c')](_0x2c9bc9['body'],{'raw':_0x2c9bc9['options']?_0x2c9bc9[_0xfe23('0x1d')][_0xfe23('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9bc9[_0xfe23('0x1d')]?_0x2c9bc9[_0xfe23('0x1d')][_0xfe23('0x1e')]||null:null,'attributes':_0x2c9bc9['options']?_0x2c9bc9[_0xfe23('0x1d')][_0xfe23('0x1f')]||null:null,'limit':_0x2c9bc9['options']?_0x2c9bc9[_0xfe23('0x1d')][_0xfe23('0x20')]||null:null})[_0xfe23('0xb')](function(_0x34f853){logger[_0xfe23('0xc')](_0xfe23('0x1b'),_0x2c9bc9);logger['debug']('UpdateVoiceAgentReport',_0x2c9bc9,JSON['stringify'](_0x34f853));_0x8c32b9(_0x34f853);})[_0xfe23('0x14')](function(_0xd62a92){logger[_0xfe23('0x11')](_0xfe23('0x1b'),_0xd62a92['message'],_0x2c9bc9);_0x58bc49(_0x2bc3b2[_0xfe23('0x11')](0x1f4,_0xd62a92['message']));});});}; \ No newline at end of file +var _0xae50=['result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4f1fa5,_0x5d1941){var _0x33417e=function(_0x148333){while(--_0x148333){_0x4f1fa5['push'](_0x4f1fa5['shift']());}};_0x33417e(++_0x5d1941);}(_0xae50,0x136));var _0x0ae5=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xae50[_0x555b2f];return _0x81c0a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ae5('0x0'));var BPromise=require(_0x0ae5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ae5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ae5('0x3'));var logger=require(_0x0ae5('0x4'))(_0x0ae5('0x5'));var config=require(_0x0ae5('0x6'));var jayson=require(_0x0ae5('0x7'));var client=jayson[_0x0ae5('0x8')][_0x0ae5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x119be1,_0x15d73d,_0x543a19){return new BPromise(function(_0x326d80,_0x5e7521){return client[_0x0ae5('0xa')](_0x119be1,_0x543a19)[_0x0ae5('0xb')](function(_0x19bac7){logger[_0x0ae5('0xc')](_0x0ae5('0xd'),_0x15d73d,_0x0ae5('0xe'));logger[_0x0ae5('0xf')](_0x0ae5('0x10'),_0x15d73d,_0x0ae5('0xe'),JSON[_0x0ae5('0x11')](_0x19bac7));if(_0x19bac7[_0x0ae5('0x12')]){if(_0x19bac7[_0x0ae5('0x12')]['code']===0x1f4){logger[_0x0ae5('0x12')](_0x0ae5('0xd'),_0x15d73d,_0x19bac7[_0x0ae5('0x12')][_0x0ae5('0x13')]);return _0x5e7521(_0x19bac7[_0x0ae5('0x12')][_0x0ae5('0x13')]);}logger[_0x0ae5('0x12')](_0x0ae5('0xd'),_0x15d73d,_0x19bac7[_0x0ae5('0x12')]['message']);return _0x326d80(_0x19bac7['error'][_0x0ae5('0x13')]);}else{logger[_0x0ae5('0xc')](_0x0ae5('0xd'),_0x15d73d,_0x0ae5('0xe'));_0x326d80(_0x19bac7[_0x0ae5('0x14')][_0x0ae5('0x13')]);}})[_0x0ae5('0x15')](function(_0x32b9a2){logger[_0x0ae5('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x15d73d,_0x32b9a2);_0x5e7521(_0x32b9a2);});});}exports[_0x0ae5('0x16')]=function(_0xf3b529){var _0x135699=this;return new Promise(function(_0x3ced07,_0x3837aa){return db[_0x0ae5('0x17')][_0x0ae5('0x18')](_0xf3b529['body'],{'raw':_0xf3b529[_0x0ae5('0x19')]?_0xf3b529[_0x0ae5('0x19')][_0x0ae5('0x1a')]===undefined?!![]:![]:!![]})[_0x0ae5('0xb')](function(_0x1e896d){logger[_0x0ae5('0xc')]('CreateVoiceAgentReport',_0xf3b529);logger[_0x0ae5('0xf')](_0x0ae5('0x16'),_0xf3b529,JSON['stringify'](_0x1e896d));_0x3ced07(_0x1e896d);})[_0x0ae5('0x15')](function(_0x4e278f){logger[_0x0ae5('0x12')](_0x0ae5('0x16'),_0x4e278f[_0x0ae5('0x13')],_0xf3b529);_0x3837aa(_0x135699[_0x0ae5('0x12')](0x1f4,_0x4e278f['message']));});});};exports[_0x0ae5('0x1b')]=function(_0x2d17a0){var _0x3d33e3=this;return new Promise(function(_0x3dd848,_0x3d27cb){return db[_0x0ae5('0x17')][_0x0ae5('0x1c')](_0x2d17a0[_0x0ae5('0x1d')],{'raw':_0x2d17a0['options']?_0x2d17a0[_0x0ae5('0x19')][_0x0ae5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d17a0[_0x0ae5('0x19')]?_0x2d17a0[_0x0ae5('0x19')][_0x0ae5('0x1e')]||null:null,'attributes':_0x2d17a0['options']?_0x2d17a0['options'][_0x0ae5('0x1f')]||null:null,'limit':_0x2d17a0['options']?_0x2d17a0['options'][_0x0ae5('0x20')]||null:null})['then'](function(_0x13fbec){logger['info'](_0x0ae5('0x1b'),_0x2d17a0);logger['debug'](_0x0ae5('0x1b'),_0x2d17a0,JSON[_0x0ae5('0x11')](_0x13fbec));_0x3dd848(_0x13fbec);})[_0x0ae5('0x15')](function(_0xe4dced){logger[_0x0ae5('0x12')](_0x0ae5('0x1b'),_0xe4dced[_0x0ae5('0x13')],_0x2d17a0);_0x3d27cb(_0x3d33e3['error'](0x1f4,_0xe4dced[_0x0ae5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index af5eb3c..fdf35a8 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 _0xe748=['/with-retry/:id','updateWithRetry','delete','destroy','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe748,0x1e4));var _0x8e74=function(_0x1e4b72,_0x271fa6){_0x1e4b72=_0x1e4b72-0x0;var _0x53a48e=_0xe748[_0x1e4b72];return _0x53a48e;};'use strict';var express=require('express');var router=express[_0x8e74('0x0')]();var auth=require(_0x8e74('0x1'));var controller=require(_0x8e74('0x2'));router[_0x8e74('0x3')]('/',auth[_0x8e74('0x4')](),controller[_0x8e74('0x5')]);router[_0x8e74('0x3')](_0x8e74('0x6'),auth[_0x8e74('0x4')](),controller[_0x8e74('0x7')]);router[_0x8e74('0x3')](_0x8e74('0x8'),auth[_0x8e74('0x4')](),controller[_0x8e74('0x9')]);router[_0x8e74('0xa')]('/',auth[_0x8e74('0x4')](),controller['create']);router[_0x8e74('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8e74('0xb')](_0x8e74('0xc'),auth[_0x8e74('0x4')](),controller[_0x8e74('0xd')]);router[_0x8e74('0xe')](_0x8e74('0x8'),auth[_0x8e74('0x4')](),controller[_0x8e74('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6694=['post','create','put','update','updateWithRetry','delete','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x6694,0x181));var _0x4669=function(_0x48f5c6,_0x490997){_0x48f5c6=_0x48f5c6-0x0;var _0x2b1845=_0x6694[_0x48f5c6];return _0x2b1845;};'use strict';var express=require(_0x4669('0x0'));var router=express[_0x4669('0x1')]();var auth=require(_0x4669('0x2'));var controller=require(_0x4669('0x3'));router[_0x4669('0x4')]('/',auth[_0x4669('0x5')](),controller[_0x4669('0x6')]);router[_0x4669('0x4')](_0x4669('0x7'),auth['isAuthenticated'](),controller[_0x4669('0x8')]);router[_0x4669('0x4')](_0x4669('0x9'),auth[_0x4669('0x5')](),controller[_0x4669('0xa')]);router[_0x4669('0xb')]('/',auth['isAuthenticated'](),controller[_0x4669('0xc')]);router[_0x4669('0xd')](_0x4669('0x9'),auth[_0x4669('0x5')](),controller[_0x4669('0xe')]);router[_0x4669('0xd')]('/with-retry/:id',auth[_0x4669('0x5')](),controller[_0x4669('0xf')]);router[_0x4669('0x10')](_0x4669('0x9'),auth[_0x4669('0x5')](),controller['destroy']);module[_0x4669('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index eb558bf..6f527f0 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 _0x83d9=['DATE','INTEGER','exports','STRING','ENUM','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x3788c0,_0x4d393b){var _0x22d05b=function(_0x3fd26d){while(--_0x3fd26d){_0x3788c0['push'](_0x3788c0['shift']());}};_0x22d05b(++_0x4d393b);}(_0x83d9,0x134));var _0x983d=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x83d9[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');module[_0x983d('0x0')]={'uniqueid':{'type':Sequelize[_0x983d('0x1')]},'type':{'type':Sequelize[_0x983d('0x2')]('inbound','internal','outbound',_0x983d('0x3'),_0x983d('0x4'),_0x983d('0x5'))},'tag':{'type':Sequelize[_0x983d('0x1')]},'accountcode':{'type':Sequelize[_0x983d('0x1')]},'source':{'type':Sequelize[_0x983d('0x1')]},'destination':{'type':Sequelize[_0x983d('0x1')]},'destinationcontext':{'type':Sequelize[_0x983d('0x1')]},'callerid':{'type':Sequelize[_0x983d('0x1')]},'channel':{'type':Sequelize[_0x983d('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x983d('0x6')]},'starttime':{'type':Sequelize[_0x983d('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x983d('0x7')]},'endtime':{'type':Sequelize[_0x983d('0x7')]},'duration':{'type':Sequelize[_0x983d('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x983d('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x983d('0x1')]},'amaflags':{'type':Sequelize[_0x983d('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x983d('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x983d('0x1')]}}; \ No newline at end of file +var _0x5115=['sequelize','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0xcf0e,_0x1d3e15){var _0x8d0e30=function(_0x194735){while(--_0x194735){_0xcf0e['push'](_0xcf0e['shift']());}};_0x8d0e30(++_0x1d3e15);}(_0x5115,0x9a));var _0x5511=function(_0x580875,_0x340c6d){_0x580875=_0x580875-0x0;var _0x27c34d=_0x5115[_0x580875];return _0x27c34d;};'use strict';var Sequelize=require(_0x5511('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5511('0x1')](_0x5511('0x2'),_0x5511('0x3'),'outbound',_0x5511('0x4'),_0x5511('0x5'),_0x5511('0x6'))},'tag':{'type':Sequelize[_0x5511('0x7')]},'accountcode':{'type':Sequelize[_0x5511('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x5511('0x7')]},'callerid':{'type':Sequelize[_0x5511('0x7')]},'channel':{'type':Sequelize[_0x5511('0x7')]},'destinationchannel':{'type':Sequelize[_0x5511('0x7')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x5511('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x5511('0x9')]},'answertime':{'type':Sequelize[_0x5511('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x5511('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5511('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5511('0x7')]},'amaflags':{'type':Sequelize[_0x5511('0x7')]},'userfield':{'type':Sequelize[_0x5511('0x7')]},'userDisposition':{'type':Sequelize[_0x5511('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x5511('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5511('0x7')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x5511('0xa')]},'sipcallid':{'type':Sequelize[_0x5511('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3d643f2..aaed08a 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 _0xcefd=['send','map','VoiceCallReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','options','alias','User','rows','catch','params','rawAttributes','find','create','body','describe','update','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','promise-retry','status','json','offset','limit','undefined','count','Content-Range','destroy','then','end','sendStatus','error','name'];(function(_0x4c50da,_0x1b8eec){var _0x33add6=function(_0x278235){while(--_0x278235){_0x4c50da['push'](_0x4c50da['shift']());}};_0x33add6(++_0x1b8eec);}(_0xcefd,0x126));var _0xdcef=function(_0x25096c,_0x4b39ad){_0x25096c=_0x25096c-0x0;var _0x20319d=_0xcefd[_0x25096c];return _0x20319d;};'use strict';var _=require(_0xdcef('0x0'));var qs=require(_0xdcef('0x1'));var logger=require(_0xdcef('0x2'))('api');var db=require(_0xdcef('0x3'))['db'];const promiseRetry=require(_0xdcef('0x4'));function respondWithResult(_0x47794f,_0x4ad13c){_0x4ad13c=_0x4ad13c||0xc8;return function(_0x142261){if(_0x142261){return _0x47794f[_0xdcef('0x5')](_0x4ad13c)[_0xdcef('0x6')](_0x142261);}};}function respondWithFilteredResult(_0x47a1fd,_0x2043a4){return function(_0xcaa40a){if(_0xcaa40a){var _0x3fb1b7=typeof _0x2043a4[_0xdcef('0x7')]==='undefined'&&typeof _0x2043a4[_0xdcef('0x8')]===_0xdcef('0x9');var _0x2ad7b0=_0xcaa40a[_0xdcef('0xa')];var _0x5d601b=_0x3fb1b7?0x0:_0x2043a4[_0xdcef('0x7')];var _0x451606=_0x3fb1b7?_0xcaa40a[_0xdcef('0xa')]:_0x2043a4[_0xdcef('0x7')]+_0x2043a4[_0xdcef('0x8')];var _0x275513;if(_0x451606>=_0x2ad7b0){_0x451606=_0x2ad7b0;_0x275513=0xc8;}else{_0x275513=0xce;}_0x47a1fd['status'](_0x275513);return _0x47a1fd['set'](_0xdcef('0xb'),_0x5d601b+'-'+_0x451606+'/'+_0x2ad7b0)[_0xdcef('0x6')](_0xcaa40a);}return null;};}function saveUpdates(_0x5a9032){return function(_0x57d9b3){if(_0x57d9b3){return _0x57d9b3['update'](_0x5a9032)['then'](function(_0x1c2aae){return _0x1c2aae;});}return null;};}function removeEntity(_0x1dfbf1){return function(_0x28418f){if(_0x28418f){return _0x28418f[_0xdcef('0xc')]()[_0xdcef('0xd')](function(){_0x1dfbf1[_0xdcef('0x5')](0xcc)[_0xdcef('0xe')]();});}};}function handleEntityNotFound(_0x4227d8){return function(_0x5e8e31){if(!_0x5e8e31){_0x4227d8[_0xdcef('0xf')](0x194);}return _0x5e8e31;};}function handleError(_0x412680,_0x173fd8){_0x173fd8=_0x173fd8||0x1f4;return function(_0x5b7237){logger[_0xdcef('0x10')](_0x5b7237['stack']);if(_0x5b7237[_0xdcef('0x11')]){delete _0x5b7237[_0xdcef('0x11')];}_0x412680[_0xdcef('0x5')](_0x173fd8)[_0xdcef('0x12')](_0x5b7237);};}exports['index']=function(_0x4e320e,_0xe8e3a3){var _0x19283a={},_0x40e53e={},_0x3d5641={'count':0x0,'rows':[]};var _0x682052=_[_0xdcef('0x13')](db[_0xdcef('0x14')]['rawAttributes'],function(_0x417de7){return{'name':_0x417de7[_0xdcef('0x15')],'type':_0x417de7['type'][_0xdcef('0x16')]};});_0x40e53e[_0xdcef('0x17')]=_[_0xdcef('0x13')](_0x682052,_0xdcef('0x11'));_0x40e53e[_0xdcef('0x18')]=_[_0xdcef('0x19')](_0x4e320e[_0xdcef('0x18')]);_0x40e53e[_0xdcef('0x1a')]=_[_0xdcef('0x1b')](_0x40e53e[_0xdcef('0x17')],_0x40e53e[_0xdcef('0x18')]);_0x19283a[_0xdcef('0x1c')]=_[_0xdcef('0x1b')](_0x40e53e[_0xdcef('0x17')],qs['fields'](_0x4e320e[_0xdcef('0x18')][_0xdcef('0x1d')]));_0x19283a[_0xdcef('0x1c')]=_0x19283a[_0xdcef('0x1c')][_0xdcef('0x1e')]?_0x19283a[_0xdcef('0x1c')]:_0x40e53e[_0xdcef('0x17')];if(!_0x4e320e[_0xdcef('0x18')][_0xdcef('0x1f')](_0xdcef('0x20'))){_0x19283a['limit']=qs['limit'](_0x4e320e['query'][_0xdcef('0x8')]);_0x19283a[_0xdcef('0x7')]=qs[_0xdcef('0x7')](_0x4e320e[_0xdcef('0x18')][_0xdcef('0x7')]);}_0x19283a['order']=qs[_0xdcef('0x21')](_0x4e320e['query'][_0xdcef('0x21')]);_0x19283a[_0xdcef('0x22')]=qs[_0xdcef('0x1a')](_['pick'](_0x4e320e[_0xdcef('0x18')],_0x40e53e[_0xdcef('0x1a')]),_0x682052);if(_0x4e320e['query']['filter']){_0x19283a[_0xdcef('0x22')]=_[_0xdcef('0x23')](_0x19283a[_0xdcef('0x22')],{'$or':_[_0xdcef('0x13')](_0x682052,function(_0x3c1e51){if(_0x3c1e51[_0xdcef('0x24')]!=='VIRTUAL'){var _0xa099cf={};_0xa099cf[_0x3c1e51['name']]={'$like':'%'+_0x4e320e[_0xdcef('0x18')]['filter']+'%'};return _0xa099cf;}})});}_0x19283a=_['merge']({},_0x19283a,_0x4e320e[_0xdcef('0x25')]);var _0x307312={'where':_0x19283a[_0xdcef('0x22')]};return db[_0xdcef('0x14')]['count'](_0x307312)['then'](function(_0x4a0b37){_0x3d5641[_0xdcef('0xa')]=_0x4a0b37;if(_0x4e320e[_0xdcef('0x18')]['includeAll']){_0x19283a['include']=[{'attributes':['id',_0xdcef('0x11'),'fullname',_0xdcef('0x26')],'model':db[_0xdcef('0x27')],'as':_0xdcef('0x27')}];}return db[_0xdcef('0x14')]['findAll'](_0x19283a);})[_0xdcef('0xd')](function(_0x3f64f4){_0x3d5641[_0xdcef('0x28')]=_0x3f64f4;return _0x3d5641;})[_0xdcef('0xd')](respondWithFilteredResult(_0xe8e3a3,_0x19283a))[_0xdcef('0x29')](handleError(_0xe8e3a3,null));};exports['show']=function(_0x55d100,_0x41b760){var _0x395359={'raw':!![],'where':{'id':_0x55d100[_0xdcef('0x2a')]['id']}},_0x3b6cca={};_0x3b6cca[_0xdcef('0x17')]=_[_0xdcef('0x19')](db[_0xdcef('0x14')][_0xdcef('0x2b')]);_0x3b6cca[_0xdcef('0x18')]=_['keys'](_0x55d100[_0xdcef('0x18')]);_0x3b6cca[_0xdcef('0x1a')]=_[_0xdcef('0x1b')](_0x3b6cca['model'],_0x3b6cca[_0xdcef('0x18')]);_0x395359[_0xdcef('0x1c')]=_['intersection'](_0x3b6cca[_0xdcef('0x17')],qs['fields'](_0x55d100[_0xdcef('0x18')][_0xdcef('0x1d')]));_0x395359[_0xdcef('0x1c')]=_0x395359[_0xdcef('0x1c')][_0xdcef('0x1e')]?_0x395359[_0xdcef('0x1c')]:_0x3b6cca[_0xdcef('0x17')];if(_0x55d100[_0xdcef('0x18')]['includeAll']){_0x395359['include']=[{'all':!![]}];}_0x395359=_[_0xdcef('0x23')]({},_0x395359,_0x55d100[_0xdcef('0x25')]);return db[_0xdcef('0x14')][_0xdcef('0x2c')](_0x395359)['then'](handleEntityNotFound(_0x41b760,null))[_0xdcef('0xd')](respondWithResult(_0x41b760,null))[_0xdcef('0x29')](handleError(_0x41b760,null));};exports[_0xdcef('0x2d')]=function(_0xf89adc,_0x187abe){return db[_0xdcef('0x14')][_0xdcef('0x2d')](_0xf89adc[_0xdcef('0x2e')],{})[_0xdcef('0xd')](respondWithResult(_0x187abe,0xc9))[_0xdcef('0x29')](handleError(_0x187abe,null));};exports[_0xdcef('0xc')]=function(_0x333b3f,_0x3bcf49){return db[_0xdcef('0x14')][_0xdcef('0x2c')]({'where':{'id':_0x333b3f['params']['id']}})[_0xdcef('0xd')](handleEntityNotFound(_0x3bcf49,null))[_0xdcef('0xd')](removeEntity(_0x3bcf49,null))[_0xdcef('0x29')](handleError(_0x3bcf49,null));};exports[_0xdcef('0x2f')]=function(_0x45f71c,_0x45c1b6){return db[_0xdcef('0x14')][_0xdcef('0x2f')]()[_0xdcef('0xd')](respondWithResult(_0x45c1b6,null))[_0xdcef('0x29')](handleError(_0x45c1b6,null));};function findForUpdate(_0x31cdc5){return db[_0xdcef('0x14')]['find']({'where':{'uniqueid':_0x31cdc5[_0xdcef('0x2a')]['id'],'UserId':{'$or':[null,_0x31cdc5['user']['id']]}}});}exports[_0xdcef('0x30')]=function(_0x2febe5,_0x53be2e){if(_0x2febe5[_0xdcef('0x2e')][_0xdcef('0x31')]){delete _0x2febe5[_0xdcef('0x2e')]['uniqueid'];}return findForUpdate(_0x2febe5)[_0xdcef('0xd')](handleEntityNotFound(_0x53be2e,null))['then'](saveUpdates(_0x2febe5[_0xdcef('0x2e')],null))['then'](respondWithResult(_0x53be2e,null))['catch'](handleError(_0x53be2e,null));};exports[_0xdcef('0x32')]=function(_0x4a1aa1,_0x5df03e,_0x2a028c){if(_0x4a1aa1[_0xdcef('0x2e')][_0xdcef('0x31')]){delete _0x4a1aa1[_0xdcef('0x2e')][_0xdcef('0x31')];}promiseRetry(function(_0x1bf3e9){return findForUpdate(_0x4a1aa1)[_0xdcef('0xd')](function(_0x257023){if(_0x257023!==null){return _0x257023;}else{_0x1bf3e9(new Error(_0xdcef('0x33')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x4b4f5c){if(!_0x4b4f5c){return new Promise(function(_0x3e5694){_0x3e5694(handleEntityNotFound(_0x5df03e)());});}else{return _0x4b4f5c[_0xdcef('0x30')](_0x4a1aa1[_0xdcef('0x2e')])['then'](function(_0x5cb340){return respondWithResult(_0x5df03e)(_0x5cb340);});}},function(){handleEntityNotFound(_0x5df03e)();});}; \ No newline at end of file +var _0xeca8=['key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','VoiceCallReport','includeAll','include','fullname','alias','User','findAll','rows','show','params','find','body','destroy','describe','catch','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit','count','set','update','then','end','sendStatus','error','name','index','map','rawAttributes','fieldName','type'];(function(_0x1f4fea,_0x4e282f){var _0x3d3946=function(_0x27ed05){while(--_0x27ed05){_0x1f4fea['push'](_0x1f4fea['shift']());}};_0x3d3946(++_0x4e282f);}(_0xeca8,0x1f2));var _0x8eca=function(_0x33f874,_0xb741e6){_0x33f874=_0x33f874-0x0;var _0x27ea88=_0xeca8[_0x33f874];return _0x27ea88;};'use strict';var _=require(_0x8eca('0x0'));var qs=require(_0x8eca('0x1'));var logger=require(_0x8eca('0x2'))(_0x8eca('0x3'));var db=require(_0x8eca('0x4'))['db'];const promiseRetry=require(_0x8eca('0x5'));function respondWithResult(_0x5cfc0b,_0x20ea56){_0x20ea56=_0x20ea56||0xc8;return function(_0x5d425e){if(_0x5d425e){return _0x5cfc0b[_0x8eca('0x6')](_0x20ea56)[_0x8eca('0x7')](_0x5d425e);}};}function respondWithFilteredResult(_0x3dda1c,_0x599a26){return function(_0x46f257){if(_0x46f257){var _0x12c679=typeof _0x599a26[_0x8eca('0x8')]===_0x8eca('0x9')&&typeof _0x599a26[_0x8eca('0xa')]===_0x8eca('0x9');var _0x5314ea=_0x46f257[_0x8eca('0xb')];var _0x19208c=_0x12c679?0x0:_0x599a26[_0x8eca('0x8')];var _0x10184f=_0x12c679?_0x46f257[_0x8eca('0xb')]:_0x599a26[_0x8eca('0x8')]+_0x599a26[_0x8eca('0xa')];var _0x2653b7;if(_0x10184f>=_0x5314ea){_0x10184f=_0x5314ea;_0x2653b7=0xc8;}else{_0x2653b7=0xce;}_0x3dda1c[_0x8eca('0x6')](_0x2653b7);return _0x3dda1c[_0x8eca('0xc')]('Content-Range',_0x19208c+'-'+_0x10184f+'/'+_0x5314ea)[_0x8eca('0x7')](_0x46f257);}return null;};}function saveUpdates(_0x57d450){return function(_0xdbd075){if(_0xdbd075){return _0xdbd075[_0x8eca('0xd')](_0x57d450)['then'](function(_0x29560e){return _0x29560e;});}return null;};}function removeEntity(_0x5ac075){return function(_0x5b9f57){if(_0x5b9f57){return _0x5b9f57['destroy']()[_0x8eca('0xe')](function(){_0x5ac075[_0x8eca('0x6')](0xcc)[_0x8eca('0xf')]();});}};}function handleEntityNotFound(_0x2d6f5e){return function(_0x44f68d){if(!_0x44f68d){_0x2d6f5e[_0x8eca('0x10')](0x194);}return _0x44f68d;};}function handleError(_0xd23ac1,_0x4e390c){_0x4e390c=_0x4e390c||0x1f4;return function(_0x15be36){logger[_0x8eca('0x11')](_0x15be36['stack']);if(_0x15be36[_0x8eca('0x12')]){delete _0x15be36[_0x8eca('0x12')];}_0xd23ac1['status'](_0x4e390c)['send'](_0x15be36);};}exports[_0x8eca('0x13')]=function(_0x4dbb9f,_0x19b583){var _0x2fa2a2={},_0x41f0d9={},_0x3860df={'count':0x0,'rows':[]};var _0x5180c8=_[_0x8eca('0x14')](db['VoiceCallReport'][_0x8eca('0x15')],function(_0x536d40){return{'name':_0x536d40[_0x8eca('0x16')],'type':_0x536d40[_0x8eca('0x17')][_0x8eca('0x18')]};});_0x41f0d9[_0x8eca('0x19')]=_[_0x8eca('0x14')](_0x5180c8,_0x8eca('0x12'));_0x41f0d9['query']=_[_0x8eca('0x1a')](_0x4dbb9f['query']);_0x41f0d9['filters']=_[_0x8eca('0x1b')](_0x41f0d9[_0x8eca('0x19')],_0x41f0d9[_0x8eca('0x1c')]);_0x2fa2a2[_0x8eca('0x1d')]=_[_0x8eca('0x1b')](_0x41f0d9['model'],qs[_0x8eca('0x1e')](_0x4dbb9f['query'][_0x8eca('0x1e')]));_0x2fa2a2[_0x8eca('0x1d')]=_0x2fa2a2[_0x8eca('0x1d')][_0x8eca('0x1f')]?_0x2fa2a2[_0x8eca('0x1d')]:_0x41f0d9[_0x8eca('0x19')];if(!_0x4dbb9f[_0x8eca('0x1c')][_0x8eca('0x20')]('nolimit')){_0x2fa2a2[_0x8eca('0xa')]=qs[_0x8eca('0xa')](_0x4dbb9f[_0x8eca('0x1c')][_0x8eca('0xa')]);_0x2fa2a2[_0x8eca('0x8')]=qs[_0x8eca('0x8')](_0x4dbb9f[_0x8eca('0x1c')][_0x8eca('0x8')]);}_0x2fa2a2[_0x8eca('0x21')]=qs['sort'](_0x4dbb9f[_0x8eca('0x1c')][_0x8eca('0x22')]);_0x2fa2a2[_0x8eca('0x23')]=qs[_0x8eca('0x24')](_['pick'](_0x4dbb9f[_0x8eca('0x1c')],_0x41f0d9[_0x8eca('0x24')]),_0x5180c8);if(_0x4dbb9f[_0x8eca('0x1c')][_0x8eca('0x25')]){_0x2fa2a2[_0x8eca('0x23')]=_[_0x8eca('0x26')](_0x2fa2a2[_0x8eca('0x23')],{'$or':_[_0x8eca('0x14')](_0x5180c8,function(_0x285ddd){if(_0x285ddd['type']!=='VIRTUAL'){var _0x2cfbab={};_0x2cfbab[_0x285ddd[_0x8eca('0x12')]]={'$like':'%'+_0x4dbb9f[_0x8eca('0x1c')][_0x8eca('0x25')]+'%'};return _0x2cfbab;}})});}_0x2fa2a2=_[_0x8eca('0x26')]({},_0x2fa2a2,_0x4dbb9f[_0x8eca('0x27')]);var _0x220e33={'where':_0x2fa2a2[_0x8eca('0x23')]};return db[_0x8eca('0x28')][_0x8eca('0xb')](_0x220e33)['then'](function(_0x544aca){_0x3860df['count']=_0x544aca;if(_0x4dbb9f[_0x8eca('0x1c')][_0x8eca('0x29')]){_0x2fa2a2[_0x8eca('0x2a')]=[{'attributes':['id',_0x8eca('0x12'),_0x8eca('0x2b'),_0x8eca('0x2c')],'model':db[_0x8eca('0x2d')],'as':_0x8eca('0x2d')}];}return db[_0x8eca('0x28')][_0x8eca('0x2e')](_0x2fa2a2);})[_0x8eca('0xe')](function(_0x59c1e){_0x3860df[_0x8eca('0x2f')]=_0x59c1e;return _0x3860df;})[_0x8eca('0xe')](respondWithFilteredResult(_0x19b583,_0x2fa2a2))['catch'](handleError(_0x19b583,null));};exports[_0x8eca('0x30')]=function(_0x4cf45e,_0x2306bb){var _0x2664a8={'raw':!![],'where':{'id':_0x4cf45e[_0x8eca('0x31')]['id']}},_0x5c3ae4={};_0x5c3ae4['model']=_[_0x8eca('0x1a')](db[_0x8eca('0x28')][_0x8eca('0x15')]);_0x5c3ae4[_0x8eca('0x1c')]=_[_0x8eca('0x1a')](_0x4cf45e[_0x8eca('0x1c')]);_0x5c3ae4[_0x8eca('0x24')]=_[_0x8eca('0x1b')](_0x5c3ae4[_0x8eca('0x19')],_0x5c3ae4[_0x8eca('0x1c')]);_0x2664a8[_0x8eca('0x1d')]=_[_0x8eca('0x1b')](_0x5c3ae4[_0x8eca('0x19')],qs['fields'](_0x4cf45e[_0x8eca('0x1c')][_0x8eca('0x1e')]));_0x2664a8[_0x8eca('0x1d')]=_0x2664a8['attributes'][_0x8eca('0x1f')]?_0x2664a8['attributes']:_0x5c3ae4[_0x8eca('0x19')];if(_0x4cf45e['query']['includeAll']){_0x2664a8['include']=[{'all':!![]}];}_0x2664a8=_[_0x8eca('0x26')]({},_0x2664a8,_0x4cf45e['options']);return db[_0x8eca('0x28')][_0x8eca('0x32')](_0x2664a8)['then'](handleEntityNotFound(_0x2306bb,null))[_0x8eca('0xe')](respondWithResult(_0x2306bb,null))['catch'](handleError(_0x2306bb,null));};exports['create']=function(_0x4bdcc5,_0x569b60){return db[_0x8eca('0x28')]['create'](_0x4bdcc5[_0x8eca('0x33')],{})[_0x8eca('0xe')](respondWithResult(_0x569b60,0xc9))['catch'](handleError(_0x569b60,null));};exports[_0x8eca('0x34')]=function(_0x3324d1,_0x28b546){return db[_0x8eca('0x28')]['find']({'where':{'id':_0x3324d1[_0x8eca('0x31')]['id']}})[_0x8eca('0xe')](handleEntityNotFound(_0x28b546,null))[_0x8eca('0xe')](removeEntity(_0x28b546,null))['catch'](handleError(_0x28b546,null));};exports[_0x8eca('0x35')]=function(_0x463c40,_0xab615){return db[_0x8eca('0x28')][_0x8eca('0x35')]()['then'](respondWithResult(_0xab615,null))[_0x8eca('0x36')](handleError(_0xab615,null));};function findForUpdate(_0xf33e7c){return db[_0x8eca('0x28')][_0x8eca('0x32')]({'where':{'uniqueid':_0xf33e7c['params']['id'],'UserId':{'$or':[null,_0xf33e7c['user']['id']]}}});}exports['update']=function(_0x3c4929,_0x564180){if(_0x3c4929[_0x8eca('0x33')][_0x8eca('0x37')]){delete _0x3c4929['body'][_0x8eca('0x37')];}return findForUpdate(_0x3c4929)[_0x8eca('0xe')](handleEntityNotFound(_0x564180,null))['then'](saveUpdates(_0x3c4929[_0x8eca('0x33')],null))['then'](respondWithResult(_0x564180,null))[_0x8eca('0x36')](handleError(_0x564180,null));};exports[_0x8eca('0x38')]=function(_0x2bda36,_0xbbd29d,_0x5dd642){if(_0x2bda36['body']['uniqueid']){delete _0x2bda36[_0x8eca('0x33')]['uniqueid'];}promiseRetry(function(_0x5bea1c){return findForUpdate(_0x2bda36)[_0x8eca('0xe')](function(_0x101dcc){if(_0x101dcc!==null){return _0x101dcc;}else{_0x5bea1c(new Error(_0x8eca('0x39')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x8eca('0xe')](function(_0x8c58d7){if(!_0x8c58d7){return new Promise(function(_0x1be27f){_0x1be27f(handleEntityNotFound(_0xbbd29d)());});}else{return _0x8c58d7['update'](_0x2bda36[_0x8eca('0x33')])[_0x8eca('0xe')](function(_0x5839db){return respondWithResult(_0xbbd29d)(_0x5839db);});}},function(){handleEntityNotFound(_0xbbd29d)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b80ce79..998ff82 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 _0x2504=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','report_call','uniqueid'];(function(_0x15fb14,_0x1792ca){var _0x5e4e0c=function(_0x531d85){while(--_0x531d85){_0x15fb14['push'](_0x15fb14['shift']());}};_0x5e4e0c(++_0x1792ca);}(_0x2504,0xee));var _0x4250=function(_0x3579c6,_0x15f2cc){_0x3579c6=_0x3579c6-0x0;var _0x4e99b3=_0x2504[_0x3579c6];return _0x4e99b3;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var logger=require(_0x4250('0x2'))(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var BPromise=require(_0x4250('0x5'));var rp=require(_0x4250('0x6'));var fs=require('fs');var path=require(_0x4250('0x7'));var rimraf=require(_0x4250('0x8'));var config=require(_0x4250('0x9'));var attributes=require(_0x4250('0xa'));module[_0x4250('0xb')]=function(_0x493da9,_0x473cb8){return _0x493da9['define']('VoiceCallReport',attributes,{'tableName':_0x4250('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4250('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb99=['report_call','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceCallReport'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xfb99,0x1e1));var _0x9fb9=function(_0x539505,_0x570ec5){_0x539505=_0x539505-0x0;var _0x3ac150=_0xfb99[_0x539505];return _0x3ac150;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9fb9('0x0'))('api');var moment=require(_0x9fb9('0x1'));var BPromise=require(_0x9fb9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fb9('0x3'));var rimraf=require(_0x9fb9('0x4'));var config=require(_0x9fb9('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x9fb9('0x6')]=function(_0x40ec37,_0x3bfa3){return _0x40ec37[_0x9fb9('0x7')](_0x9fb9('0x8'),attributes,{'tableName':_0x9fb9('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 7a69711..cbf7ad3 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 _0xe2bc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceCallReport','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird'];(function(_0x3dc1e9,_0x20484c){var _0x1a8e32=function(_0x3248a1){while(--_0x3248a1){_0x3dc1e9['push'](_0x3dc1e9['shift']());}};_0x1a8e32(++_0x20484c);}(_0xe2bc,0x196));var _0xce2b=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe2bc[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xce2b('0x0'));var util=require(_0xce2b('0x1'));var moment=require(_0xce2b('0x2'));var BPromise=require(_0xce2b('0x3'));var rs=require(_0xce2b('0x4'));var fs=require('fs');var Redis=require(_0xce2b('0x5'));var db=require(_0xce2b('0x6'))['db'];var utils=require(_0xce2b('0x7'));var logger=require(_0xce2b('0x8'))('rpc');var config=require(_0xce2b('0x9'));var jayson=require(_0xce2b('0xa'));var client=jayson[_0xce2b('0xb')][_0xce2b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x194823,_0xc75057,_0x31c343){return new BPromise(function(_0x4fa3c4,_0x2e3771){return client[_0xce2b('0xd')](_0x194823,_0x31c343)['then'](function(_0x44573c){logger['info'](_0xce2b('0xe'),_0xc75057,'request\x20sent');logger[_0xce2b('0xf')](_0xce2b('0x10'),_0xc75057,_0xce2b('0x11'),JSON[_0xce2b('0x12')](_0x44573c));if(_0x44573c['error']){if(_0x44573c[_0xce2b('0x13')][_0xce2b('0x14')]===0x1f4){logger[_0xce2b('0x13')](_0xce2b('0xe'),_0xc75057,_0x44573c[_0xce2b('0x13')][_0xce2b('0x15')]);return _0x2e3771(_0x44573c[_0xce2b('0x13')][_0xce2b('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xc75057,_0x44573c[_0xce2b('0x13')][_0xce2b('0x15')]);return _0x4fa3c4(_0x44573c['error'][_0xce2b('0x15')]);}else{logger[_0xce2b('0x16')](_0xce2b('0xe'),_0xc75057,_0xce2b('0x11'));_0x4fa3c4(_0x44573c[_0xce2b('0x17')][_0xce2b('0x15')]);}})[_0xce2b('0x18')](function(_0x3be161){logger[_0xce2b('0x13')](_0xce2b('0xe'),_0xc75057,_0x3be161);_0x2e3771(_0x3be161);});});}exports['GetVoiceCallReport']=function(_0x84773d){var _0x15e57a=this;return new Promise(function(_0x38f5c9,_0x27cca7){return db[_0xce2b('0x19')][_0xce2b('0x1a')]({'raw':_0x84773d['options']?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x1c')]===undefined?!![]:![]:!![],'where':_0x84773d[_0xce2b('0x1b')]?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x1d')]||null:null,'attributes':_0x84773d['options']?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x1e')]||null:null,'limit':_0x84773d[_0xce2b('0x1b')]?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x1f')]||null:null,'include':_0x84773d[_0xce2b('0x1b')]?_0x84773d[_0xce2b('0x1b')][_0xce2b('0x20')]?_['map'](_0x84773d[_0xce2b('0x1b')][_0xce2b('0x20')],function(_0x1a2275){return{'model':db[_0x1a2275['model']],'as':_0x1a2275['as'],'attributes':_0x1a2275[_0xce2b('0x1e')],'include':_0x1a2275[_0xce2b('0x20')]?_[_0xce2b('0x21')](_0x1a2275[_0xce2b('0x20')],function(_0x2e6d83){return{'model':db[_0x2e6d83[_0xce2b('0x22')]],'as':_0x2e6d83['as'],'attributes':_0x2e6d83[_0xce2b('0x1e')],'include':_0x2e6d83[_0xce2b('0x20')]?_[_0xce2b('0x21')](_0x2e6d83[_0xce2b('0x20')],function(_0x1394db){return{'model':db[_0x1394db[_0xce2b('0x22')]],'as':_0x1394db['as'],'attributes':_0x1394db['attributes']};}):[]};}):[]};}):[]:[]})[_0xce2b('0x23')](function(_0x2aef29){logger[_0xce2b('0x16')]('GetVoiceCallReport',_0x84773d);logger[_0xce2b('0xf')](_0xce2b('0x24'),_0x84773d,JSON[_0xce2b('0x12')](_0x2aef29));_0x38f5c9(_0x2aef29);})[_0xce2b('0x18')](function(_0x2bfbc7){logger[_0xce2b('0x13')](_0xce2b('0x24'),_0x2bfbc7['message'],_0x84773d);_0x27cca7(_0x15e57a['error'](0x1f4,_0x2bfbc7[_0xce2b('0x15')]));});});};exports[_0xce2b('0x25')]=function(_0x7eebcd){var _0x41048f=this;return new Promise(function(_0xb1d1f5,_0xf960fa){return db[_0xce2b('0x19')]['create'](_0x7eebcd[_0xce2b('0x26')],{'raw':_0x7eebcd['options']?_0x7eebcd[_0xce2b('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xce2b('0x23')](function(_0x3e8f9a){logger[_0xce2b('0x16')](_0xce2b('0x25'),_0x7eebcd);logger['debug'](_0xce2b('0x25'),_0x7eebcd,JSON[_0xce2b('0x12')](_0x3e8f9a));_0xb1d1f5(_0x3e8f9a);})[_0xce2b('0x18')](function(_0x56b22e){logger['error'](_0xce2b('0x25'),_0x56b22e[_0xce2b('0x15')],_0x7eebcd);_0xf960fa(_0x41048f[_0xce2b('0x13')](0x1f4,_0x56b22e['message']));});});};exports[_0xce2b('0x27')]=function(_0x530f32){var _0x5d76a7=this;return new Promise(function(_0x13dc61,_0x4d0b9d){return db[_0xce2b('0x19')][_0xce2b('0x28')](_0x530f32[_0xce2b('0x26')],{'raw':_0x530f32[_0xce2b('0x1b')]?_0x530f32[_0xce2b('0x1b')][_0xce2b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x530f32['options']?_0x530f32['options']['where']||null:null,'attributes':_0x530f32['options']?_0x530f32[_0xce2b('0x1b')][_0xce2b('0x1e')]||null:null,'limit':_0x530f32[_0xce2b('0x1b')]?_0x530f32[_0xce2b('0x1b')]['limit']||null:null})[_0xce2b('0x23')](function(_0x4be9b1){logger[_0xce2b('0x16')](_0xce2b('0x27'),_0x530f32);logger[_0xce2b('0xf')]('UpdateVoiceCallReport',_0x530f32,JSON[_0xce2b('0x12')](_0x4be9b1));_0x13dc61(_0x4be9b1);})[_0xce2b('0x18')](function(_0x18de35){logger['error'](_0xce2b('0x27'),_0x18de35[_0xce2b('0x15')],_0x530f32);_0x4d0b9d(_0x5d76a7['error'](0x1f4,_0x18de35['message']));});});}; \ No newline at end of file +var _0xc369=['request\x20sent','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','map','model','attributes','info','catch','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xe60fdf,_0x41c67b){var _0x153c33=function(_0x3574c7){while(--_0x3574c7){_0xe60fdf['push'](_0xe60fdf['shift']());}};_0x153c33(++_0x41c67b);}(_0xc369,0x15c));var _0x9c36=function(_0x2fc3f0,_0x5b9ef3){_0x2fc3f0=_0x2fc3f0-0x0;var _0x44fa67=_0xc369[_0x2fc3f0];return _0x44fa67;};'use strict';var _=require('lodash');var util=require(_0x9c36('0x0'));var moment=require(_0x9c36('0x1'));var BPromise=require('bluebird');var rs=require(_0x9c36('0x2'));var fs=require('fs');var Redis=require(_0x9c36('0x3'));var db=require(_0x9c36('0x4'))['db'];var utils=require(_0x9c36('0x5'));var logger=require(_0x9c36('0x6'))(_0x9c36('0x7'));var config=require(_0x9c36('0x8'));var jayson=require(_0x9c36('0x9'));var client=jayson[_0x9c36('0xa')][_0x9c36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x825162,_0x421b12,_0x10de80){return new BPromise(function(_0xa507d0,_0x4090b2){return client[_0x9c36('0xc')](_0x825162,_0x10de80)[_0x9c36('0xd')](function(_0x5edd21){logger['info'](_0x9c36('0xe'),_0x421b12,'request\x20sent');logger[_0x9c36('0xf')](_0x9c36('0x10'),_0x421b12,'request\x20sent',JSON[_0x9c36('0x11')](_0x5edd21));if(_0x5edd21[_0x9c36('0x12')]){if(_0x5edd21['error'][_0x9c36('0x13')]===0x1f4){logger['error'](_0x9c36('0xe'),_0x421b12,_0x5edd21[_0x9c36('0x12')]['message']);return _0x4090b2(_0x5edd21[_0x9c36('0x12')][_0x9c36('0x14')]);}logger[_0x9c36('0x12')](_0x9c36('0xe'),_0x421b12,_0x5edd21[_0x9c36('0x12')][_0x9c36('0x14')]);return _0xa507d0(_0x5edd21[_0x9c36('0x12')][_0x9c36('0x14')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x421b12,_0x9c36('0x15'));_0xa507d0(_0x5edd21[_0x9c36('0x16')]['message']);}})['catch'](function(_0x409729){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x421b12,_0x409729);_0x4090b2(_0x409729);});});}exports[_0x9c36('0x17')]=function(_0x4afc1a){var _0x18521a=this;return new Promise(function(_0x9417bb,_0x9f111e){return db[_0x9c36('0x18')][_0x9c36('0x19')]({'raw':_0x4afc1a[_0x9c36('0x1a')]?_0x4afc1a['options'][_0x9c36('0x1b')]===undefined?!![]:![]:!![],'where':_0x4afc1a[_0x9c36('0x1a')]?_0x4afc1a[_0x9c36('0x1a')][_0x9c36('0x1c')]||null:null,'attributes':_0x4afc1a['options']?_0x4afc1a[_0x9c36('0x1a')]['attributes']||null:null,'limit':_0x4afc1a[_0x9c36('0x1a')]?_0x4afc1a[_0x9c36('0x1a')]['limit']||null:null,'include':_0x4afc1a['options']?_0x4afc1a[_0x9c36('0x1a')][_0x9c36('0x1d')]?_[_0x9c36('0x1e')](_0x4afc1a[_0x9c36('0x1a')][_0x9c36('0x1d')],function(_0x2c9464){return{'model':db[_0x2c9464[_0x9c36('0x1f')]],'as':_0x2c9464['as'],'attributes':_0x2c9464[_0x9c36('0x20')],'include':_0x2c9464['include']?_[_0x9c36('0x1e')](_0x2c9464['include'],function(_0x3a092e){return{'model':db[_0x3a092e['model']],'as':_0x3a092e['as'],'attributes':_0x3a092e[_0x9c36('0x20')],'include':_0x3a092e['include']?_[_0x9c36('0x1e')](_0x3a092e['include'],function(_0x272758){return{'model':db[_0x272758[_0x9c36('0x1f')]],'as':_0x272758['as'],'attributes':_0x272758['attributes']};}):[]};}):[]};}):[]:[]})[_0x9c36('0xd')](function(_0x49546a){logger[_0x9c36('0x21')](_0x9c36('0x17'),_0x4afc1a);logger[_0x9c36('0xf')](_0x9c36('0x17'),_0x4afc1a,JSON[_0x9c36('0x11')](_0x49546a));_0x9417bb(_0x49546a);})[_0x9c36('0x22')](function(_0x170621){logger[_0x9c36('0x12')](_0x9c36('0x17'),_0x170621[_0x9c36('0x14')],_0x4afc1a);_0x9f111e(_0x18521a['error'](0x1f4,_0x170621['message']));});});};exports['CreateVoiceCallReport']=function(_0xb6afb5){var _0x4b9a80=this;return new Promise(function(_0x48a043,_0x278049){return db['VoiceCallReport'][_0x9c36('0x23')](_0xb6afb5[_0x9c36('0x24')],{'raw':_0xb6afb5['options']?_0xb6afb5[_0x9c36('0x1a')][_0x9c36('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5f59c3){logger[_0x9c36('0x21')](_0x9c36('0x25'),_0xb6afb5);logger[_0x9c36('0xf')](_0x9c36('0x25'),_0xb6afb5,JSON[_0x9c36('0x11')](_0x5f59c3));_0x48a043(_0x5f59c3);})[_0x9c36('0x22')](function(_0x521657){logger['error'](_0x9c36('0x25'),_0x521657[_0x9c36('0x14')],_0xb6afb5);_0x278049(_0x4b9a80[_0x9c36('0x12')](0x1f4,_0x521657[_0x9c36('0x14')]));});});};exports[_0x9c36('0x26')]=function(_0x1414cb){var _0x2a9225=this;return new Promise(function(_0x3931f9,_0xfc509f){return db[_0x9c36('0x18')][_0x9c36('0x27')](_0x1414cb[_0x9c36('0x24')],{'raw':_0x1414cb[_0x9c36('0x1a')]?_0x1414cb[_0x9c36('0x1a')][_0x9c36('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1414cb[_0x9c36('0x1a')]?_0x1414cb[_0x9c36('0x1a')][_0x9c36('0x1c')]||null:null,'attributes':_0x1414cb['options']?_0x1414cb[_0x9c36('0x1a')][_0x9c36('0x20')]||null:null,'limit':_0x1414cb[_0x9c36('0x1a')]?_0x1414cb[_0x9c36('0x1a')][_0x9c36('0x28')]||null:null})['then'](function(_0x4e5c01){logger['info'](_0x9c36('0x26'),_0x1414cb);logger['debug'](_0x9c36('0x26'),_0x1414cb,JSON['stringify'](_0x4e5c01));_0x3931f9(_0x4e5c01);})[_0x9c36('0x22')](function(_0x3b0350){logger[_0x9c36('0x12')](_0x9c36('0x26'),_0x3b0350['message'],_0x1414cb);_0xfc509f(_0x2a9225['error'](0x1f4,_0x3b0350[_0x9c36('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 914e639..45b26ee 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 _0x7539=['show','post','isAuthenticated','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x5a3db1,_0x363264){var _0x17107b=function(_0x502f49){while(--_0x502f49){_0x5a3db1['push'](_0x5a3db1['shift']());}};_0x17107b(++_0x363264);}(_0x7539,0x180));var _0x9753=function(_0x266570,_0x3ee6ac){_0x266570=_0x266570-0x0;var _0x4794c2=_0x7539[_0x266570];return _0x4794c2;};'use strict';var multer=require(_0x9753('0x0'));var util=require('util');var path=require(_0x9753('0x1'));var timeout=require(_0x9753('0x2'));var express=require(_0x9753('0x3'));var router=express[_0x9753('0x4')]();var fs_extra=require(_0x9753('0x5'));var auth=require(_0x9753('0x6'));var interaction=require(_0x9753('0x7'));var config=require(_0x9753('0x8'));var controller=require('./voiceChanSpy.controller');router[_0x9753('0x9')]('/',auth['isAuthenticated'](),controller[_0x9753('0xa')]);router[_0x9753('0x9')](_0x9753('0xb'),auth['isAuthenticated'](),controller[_0x9753('0xc')]);router[_0x9753('0xd')]('/',auth[_0x9753('0xe')](),controller['create']);router[_0x9753('0xf')](_0x9753('0xb'),auth[_0x9753('0xe')](),controller[_0x9753('0x10')]);router['delete']('/:id',auth[_0x9753('0xe')](),controller['destroy']);module[_0x9753('0x11')]=router; \ No newline at end of file +var _0x44b4=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','multer','path'];(function(_0x6465b0,_0x45653a){var _0x4884fe=function(_0x427085){while(--_0x427085){_0x6465b0['push'](_0x6465b0['shift']());}};_0x4884fe(++_0x45653a);}(_0x44b4,0x185));var _0x444b=function(_0xd26bdb,_0x1db47a){_0xd26bdb=_0xd26bdb-0x0;var _0x3e3611=_0x44b4[_0xd26bdb];return _0x3e3611;};'use strict';var multer=require(_0x444b('0x0'));var util=require('util');var path=require(_0x444b('0x1'));var timeout=require(_0x444b('0x2'));var express=require('express');var router=express[_0x444b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x444b('0x4'));var interaction=require(_0x444b('0x5'));var config=require(_0x444b('0x6'));var controller=require(_0x444b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x444b('0x8')]);router[_0x444b('0x9')](_0x444b('0xa'),auth[_0x444b('0xb')](),controller[_0x444b('0xc')]);router[_0x444b('0xd')]('/',auth[_0x444b('0xb')](),controller[_0x444b('0xe')]);router[_0x444b('0xf')](_0x444b('0xa'),auth[_0x444b('0xb')](),controller[_0x444b('0x10')]);router['delete'](_0x444b('0xa'),auth[_0x444b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 72572c6..be91d7f 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 _0x7f10=['sequelize','exports','STRING','name','setDataValue','options','getDataValue','split','BOOLEAN'];(function(_0x3fa215,_0x3a749a){var _0x2b7668=function(_0x36082a){while(--_0x36082a){_0x3fa215['push'](_0x3fa215['shift']());}};_0x2b7668(++_0x3a749a);}(_0x7f10,0x195));var _0x07f1=function(_0x9f8d7e,_0x2d74b2){_0x9f8d7e=_0x9f8d7e-0x0;var _0x87c913=_0x7f10[_0x9f8d7e];return _0x87c913;};'use strict';var Sequelize=require(_0x07f1('0x0'));module[_0x07f1('0x1')]={'name':{'type':Sequelize[_0x07f1('0x2')]},'prefix':{'type':Sequelize[_0x07f1('0x2')],'unique':_0x07f1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x07f1('0x2')],'set':function(_0x19b3cb){this[_0x07f1('0x4')]('options',_0x19b3cb?_0x19b3cb['join'](''):[]);},'get':function(){return this['getDataValue'](_0x07f1('0x5'))?this[_0x07f1('0x6')](_0x07f1('0x5'))[_0x07f1('0x7')](''):[];}},'auth':{'type':Sequelize[_0x07f1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x07f1('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x07f1('0x2')]},'description':{'type':Sequelize[_0x07f1('0x2')]}}; \ No newline at end of file +var _0x08ef=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','join','getDataValue','split'];(function(_0xe679de,_0x56d513){var _0x1ba35f=function(_0x5db78b){while(--_0x5db78b){_0xe679de['push'](_0xe679de['shift']());}};_0x1ba35f(++_0x56d513);}(_0x08ef,0xf4));var _0xf08e=function(_0x4cb955,_0x47340b){_0x4cb955=_0x4cb955-0x0;var _0x46a650=_0x08ef[_0x4cb955];return _0x46a650;};'use strict';var Sequelize=require(_0xf08e('0x0'));module[_0xf08e('0x1')]={'name':{'type':Sequelize[_0xf08e('0x2')]},'prefix':{'type':Sequelize[_0xf08e('0x2')],'unique':_0xf08e('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xf08e('0x2')],'set':function(_0x3d2f8f){this[_0xf08e('0x4')]('options',_0x3d2f8f?_0x3d2f8f[_0xf08e('0x5')](''):[]);},'get':function(){return this[_0xf08e('0x6')]('options')?this['getDataValue']('options')[_0xf08e('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xf08e('0x2')]},'record':{'type':Sequelize[_0xf08e('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf08e('0x2')]},'description':{'type':Sequelize[_0xf08e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 48b2736..f8990d8 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 _0xcb91=['json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','VoiceChanSpy','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xcb91[_0x22ee1e];return _0x49a5c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){var _0x10a419=_0x55b232[_0x1cb9('0x24')]({'plain':!![]});var _0x69b4c8=_0x1cb9('0x25');return db[_0x1cb9('0x26')]['destroy']({'where':{'type':_0x69b4c8,'resourceId':_0x10a419['id']}})[_0x1cb9('0x22')](function(){return _0x55b232;});})[_0x1cb9('0x22')](function(){_0x27db16['status'](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x21effa,_0x41a9a0){return function(_0x1804fd){if(!_0x1804fd){_0x21effa[_0x1cb9('0x16')](0x194);}return _0x1804fd;};}function handleError(_0x21d6f5,_0x2e28fe){_0x2e28fe=_0x2e28fe||0x1f4;return function(_0xb644b3){logger[_0x1cb9('0x27')](_0xb644b3[_0x1cb9('0x28')]);if(_0xb644b3['name']){delete _0xb644b3[_0x1cb9('0x29')];}_0x21d6f5['status'](_0x2e28fe)[_0x1cb9('0x2a')](_0xb644b3);};}exports['index']=function(_0x278327,_0x41011c){var _0x3cd7f5={},_0x2038aa={},_0x561d89={'count':0x0,'rows':[]};var _0x1c701f=_['map'](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')],function(_0x4220d7){return{'name':_0x4220d7['fieldName'],'type':_0x4220d7[_0x1cb9('0x2d')]['key']};});_0x2038aa[_0x1cb9('0x2e')]=_['map'](_0x1c701f,_0x1cb9('0x29'));_0x2038aa[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x278327[_0x1cb9('0x2f')]);_0x2038aa['filters']=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],_0x2038aa[_0x1cb9('0x2f')]);_0x3cd7f5[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x3cd7f5[_0x1cb9('0x32')]=_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x3cd7f5[_0x1cb9('0x32')]:_0x2038aa['model'];if(!_0x278327['query'][_0x1cb9('0x35')](_0x1cb9('0x36'))){_0x3cd7f5[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x1c')]);_0x3cd7f5[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x278327['query'][_0x1cb9('0x1a')]);}_0x3cd7f5[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x278327['query'][_0x1cb9('0x38')]);_0x3cd7f5['where']=qs[_0x1cb9('0x39')](_['pick'](_0x278327[_0x1cb9('0x2f')],_0x2038aa[_0x1cb9('0x39')]),_0x1c701f);if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x3cd7f5[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](_0x3cd7f5[_0x1cb9('0x3b')],{'$or':_['map'](_0x1c701f,function(_0x4ca19e){if(_0x4ca19e[_0x1cb9('0x2d')]!==_0x1cb9('0x3d')){var _0x7a0d8b={};_0x7a0d8b[_0x4ca19e[_0x1cb9('0x29')]]={'$like':'%'+_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x7a0d8b;}})});}_0x3cd7f5=_[_0x1cb9('0x3c')]({},_0x3cd7f5,_0x278327['options']);var _0xbcaa32={'where':_0x3cd7f5['where']};return db['VoiceChanSpy']['count'](_0xbcaa32)[_0x1cb9('0x22')](function(_0x397ff9){_0x561d89[_0x1cb9('0x1d')]=_0x397ff9;if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x3cd7f5['include']=[{'all':!![]}];}return db[_0x1cb9('0x2b')]['findAll'](_0x3cd7f5);})[_0x1cb9('0x22')](function(_0x71db9d){_0x561d89[_0x1cb9('0x3f')]=_0x71db9d;return _0x561d89;})['then'](respondWithFilteredResult(_0x41011c,_0x3cd7f5))[_0x1cb9('0x40')](handleError(_0x41011c,null));};exports['show']=function(_0xda1a44,_0xbc36fc){var _0x51a898={'raw':![],'where':{'id':_0xda1a44[_0x1cb9('0x41')]['id']}},_0x5839aa={};_0x5839aa[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')]);_0x5839aa['query']=_[_0x1cb9('0x30')](_0xda1a44['query']);_0x5839aa['filters']=_['intersection'](_0x5839aa[_0x1cb9('0x2e')],_0x5839aa[_0x1cb9('0x2f')]);_0x51a898[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x5839aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x51a898[_0x1cb9('0x32')]=_0x51a898[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x51a898['attributes']:_0x5839aa[_0x1cb9('0x2e')];if(_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x51a898['include']=[{'all':!![]}];}_0x51a898=_[_0x1cb9('0x3c')]({},_0x51a898,_0xda1a44[_0x1cb9('0x42')]);return db[_0x1cb9('0x2b')][_0x1cb9('0x43')](_0x51a898)[_0x1cb9('0x22')](handleEntityNotFound(_0xbc36fc,null))['then'](respondWithResult(_0xbc36fc,null))[_0x1cb9('0x40')](handleError(_0xbc36fc,null));};exports['create']=function(_0x2eaa11,_0x4ac483){return db[_0x1cb9('0x2b')][_0x1cb9('0x44')](_0x2eaa11[_0x1cb9('0x45')],{})[_0x1cb9('0x22')](function(_0x56d0c5){var _0x298475=_0x2eaa11[_0x1cb9('0x46')][_0x1cb9('0x24')]({'plain':!![]});if(!_0x298475)throw new Error(_0x1cb9('0x47'));if(_0x298475[_0x1cb9('0x48')]===_0x1cb9('0x46')){var _0x17b92a=_0x56d0c5[_0x1cb9('0x24')]({'plain':!![]});var _0xbb500e=_0x1cb9('0x25');return db['UserProfileSection']['find']({'where':{'name':_0xbb500e,'userProfileId':_0x298475[_0x1cb9('0x49')]},'raw':!![]})[_0x1cb9('0x22')](function(_0x19e83a){if(_0x19e83a&&_0x19e83a[_0x1cb9('0x4a')]===0x0){return db[_0x1cb9('0x26')][_0x1cb9('0x44')]({'name':_0x17b92a[_0x1cb9('0x29')],'resourceId':_0x17b92a['id'],'type':_0x19e83a[_0x1cb9('0x29')],'sectionId':_0x19e83a['id']},{})[_0x1cb9('0x22')](function(){return _0x56d0c5;});}else{return _0x56d0c5;}})[_0x1cb9('0x40')](function(_0x4a4b87){logger[_0x1cb9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a4b87);throw _0x4a4b87;});}return _0x56d0c5;})[_0x1cb9('0x22')](respondWithResult(_0x4ac483,0xc9))['catch'](handleError(_0x4ac483,null));};exports[_0x1cb9('0x21')]=function(_0x53c002,_0x5e5174){if(_0x53c002[_0x1cb9('0x45')]['id']){delete _0x53c002[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x2b')]['find']({'where':{'id':_0x53c002[_0x1cb9('0x41')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x5e5174,null))['then'](saveUpdates(_0x53c002['body'],null))[_0x1cb9('0x22')](respondWithResult(_0x5e5174,null))[_0x1cb9('0x40')](handleError(_0x5e5174,null));};exports[_0x1cb9('0x23')]=function(_0x2b3f2a,_0x3de325){return db[_0x1cb9('0x2b')][_0x1cb9('0x43')]({'where':{'id':_0x2b3f2a['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x3de325,null))[_0x1cb9('0x22')](removeEntity(_0x3de325,null))[_0x1cb9('0x40')](handleError(_0x3de325,null));}; \ No newline at end of file +var _0xb010=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','length','hasOwnProperty','nolimit','where','pick','merge','type','VIRTUAL','filter','options','VoiceChanSpy','include','findAll','rows','catch','show','params','keys','attributes','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x26edc2,_0x12a906){var _0x34489e=function(_0x227193){while(--_0x227193){_0x26edc2['push'](_0x26edc2['shift']());}};_0x34489e(++_0x12a906);}(_0xb010,0x8b));var _0x0b01=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb010[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b01('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b01('0x1'));var rp=require('request-promise');var moment=require(_0x0b01('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0b01('0x3'));var util=require(_0x0b01('0x4'));var path=require(_0x0b01('0x5'));var sox=require(_0x0b01('0x6'));var csv=require(_0x0b01('0x7'));var ejs=require(_0x0b01('0x8'));var fs=require('fs');var fs_extra=require(_0x0b01('0x9'));var _=require(_0x0b01('0xa'));var squel=require(_0x0b01('0xb'));var crypto=require(_0x0b01('0xc'));var jsforce=require(_0x0b01('0xd'));var deskjs=require(_0x0b01('0xe'));var toCsv=require(_0x0b01('0x7'));var querystring=require('querystring');var Papa=require(_0x0b01('0xf'));var Redis=require(_0x0b01('0x10'));var authService=require(_0x0b01('0x11'));var qs=require(_0x0b01('0x12'));var as=require(_0x0b01('0x13'));var hardwareService=require(_0x0b01('0x14'));var logger=require(_0x0b01('0x15'))(_0x0b01('0x16'));var utils=require(_0x0b01('0x17'));var config=require(_0x0b01('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b01('0x19'))['db'];function respondWithStatusCode(_0x462720,_0x8834b5){_0x8834b5=_0x8834b5||0xcc;return function(_0x1da264){if(_0x1da264){return _0x462720[_0x0b01('0x1a')](_0x8834b5);}return _0x462720[_0x0b01('0x1b')](_0x8834b5)[_0x0b01('0x1c')]();};}function respondWithResult(_0x53372e,_0xfc0d4f){_0xfc0d4f=_0xfc0d4f||0xc8;return function(_0x3fc8cb){if(_0x3fc8cb){return _0x53372e[_0x0b01('0x1b')](_0xfc0d4f)[_0x0b01('0x1d')](_0x3fc8cb);}};}function respondWithFilteredResult(_0x4074c2,_0x2448a4){return function(_0x24c0d4){if(_0x24c0d4){var _0x2348ef=typeof _0x2448a4[_0x0b01('0x1e')]===_0x0b01('0x1f')&&typeof _0x2448a4[_0x0b01('0x20')]===_0x0b01('0x1f');var _0x55aceb=_0x24c0d4[_0x0b01('0x21')];var _0x21139b=_0x2348ef?0x0:_0x2448a4[_0x0b01('0x1e')];var _0x4a288c=_0x2348ef?_0x24c0d4['count']:_0x2448a4['offset']+_0x2448a4[_0x0b01('0x20')];var _0x217eac;if(_0x4a288c>=_0x55aceb){_0x4a288c=_0x55aceb;_0x217eac=0xc8;}else{_0x217eac=0xce;}_0x4074c2[_0x0b01('0x1b')](_0x217eac);return _0x4074c2[_0x0b01('0x22')](_0x0b01('0x23'),_0x21139b+'-'+_0x4a288c+'/'+_0x55aceb)[_0x0b01('0x1d')](_0x24c0d4);}return null;};}function patchUpdates(_0x5a68c1){return function(_0x29dae4){try{jsonpatch[_0x0b01('0x24')](_0x29dae4,_0x5a68c1,!![]);}catch(_0xc91328){return BPromise[_0x0b01('0x25')](_0xc91328);}return _0x29dae4[_0x0b01('0x26')]();};}function saveUpdates(_0x589324,_0x5f4cf1){return function(_0x3e966c){if(_0x3e966c){return _0x3e966c[_0x0b01('0x27')](_0x589324)[_0x0b01('0x28')](function(_0x220615){return _0x220615;});}return null;};}function removeEntity(_0x51bbaf,_0x5034fc){return function(_0x47f13a){if(_0x47f13a){return _0x47f13a[_0x0b01('0x29')]()['then'](function(){var _0x4af9f6=_0x47f13a['get']({'plain':!![]});var _0x2a165f=_0x0b01('0x2a');return db[_0x0b01('0x2b')][_0x0b01('0x29')]({'where':{'type':_0x2a165f,'resourceId':_0x4af9f6['id']}})[_0x0b01('0x28')](function(){return _0x47f13a;});})[_0x0b01('0x28')](function(){_0x51bbaf[_0x0b01('0x1b')](0xcc)[_0x0b01('0x1c')]();});}};}function handleEntityNotFound(_0x5cff03,_0xe33073){return function(_0x3d42e6){if(!_0x3d42e6){_0x5cff03[_0x0b01('0x1a')](0x194);}return _0x3d42e6;};}function handleError(_0x513f07,_0x53b17a){_0x53b17a=_0x53b17a||0x1f4;return function(_0x29799c){logger['error'](_0x29799c['stack']);if(_0x29799c[_0x0b01('0x2c')]){delete _0x29799c[_0x0b01('0x2c')];}_0x513f07[_0x0b01('0x1b')](_0x53b17a)['send'](_0x29799c);};}exports[_0x0b01('0x2d')]=function(_0x3ef977,_0x177bc1){var _0x1b9ecf={},_0x65488={},_0x2f5551={'count':0x0,'rows':[]};var _0x41e532=_[_0x0b01('0x2e')](db['VoiceChanSpy'][_0x0b01('0x2f')],function(_0x471897){return{'name':_0x471897[_0x0b01('0x30')],'type':_0x471897['type'][_0x0b01('0x31')]};});_0x65488['model']=_[_0x0b01('0x2e')](_0x41e532,'name');_0x65488[_0x0b01('0x32')]=_['keys'](_0x3ef977[_0x0b01('0x32')]);_0x65488[_0x0b01('0x33')]=_[_0x0b01('0x34')](_0x65488['model'],_0x65488[_0x0b01('0x32')]);_0x1b9ecf['attributes']=_[_0x0b01('0x34')](_0x65488[_0x0b01('0x35')],qs[_0x0b01('0x36')](_0x3ef977[_0x0b01('0x32')]['fields']));_0x1b9ecf['attributes']=_0x1b9ecf['attributes'][_0x0b01('0x37')]?_0x1b9ecf['attributes']:_0x65488[_0x0b01('0x35')];if(!_0x3ef977['query'][_0x0b01('0x38')](_0x0b01('0x39'))){_0x1b9ecf[_0x0b01('0x20')]=qs[_0x0b01('0x20')](_0x3ef977[_0x0b01('0x32')]['limit']);_0x1b9ecf['offset']=qs[_0x0b01('0x1e')](_0x3ef977[_0x0b01('0x32')][_0x0b01('0x1e')]);}_0x1b9ecf['order']=qs['sort'](_0x3ef977[_0x0b01('0x32')]['sort']);_0x1b9ecf[_0x0b01('0x3a')]=qs[_0x0b01('0x33')](_[_0x0b01('0x3b')](_0x3ef977['query'],_0x65488[_0x0b01('0x33')]),_0x41e532);if(_0x3ef977[_0x0b01('0x32')]['filter']){_0x1b9ecf[_0x0b01('0x3a')]=_[_0x0b01('0x3c')](_0x1b9ecf[_0x0b01('0x3a')],{'$or':_[_0x0b01('0x2e')](_0x41e532,function(_0x3e9fa2){if(_0x3e9fa2[_0x0b01('0x3d')]!==_0x0b01('0x3e')){var _0x41314f={};_0x41314f[_0x3e9fa2['name']]={'$like':'%'+_0x3ef977[_0x0b01('0x32')][_0x0b01('0x3f')]+'%'};return _0x41314f;}})});}_0x1b9ecf=_[_0x0b01('0x3c')]({},_0x1b9ecf,_0x3ef977[_0x0b01('0x40')]);var _0x4848f9={'where':_0x1b9ecf[_0x0b01('0x3a')]};return db[_0x0b01('0x41')][_0x0b01('0x21')](_0x4848f9)[_0x0b01('0x28')](function(_0x19e706){_0x2f5551['count']=_0x19e706;if(_0x3ef977['query']['includeAll']){_0x1b9ecf[_0x0b01('0x42')]=[{'all':!![]}];}return db[_0x0b01('0x41')][_0x0b01('0x43')](_0x1b9ecf);})[_0x0b01('0x28')](function(_0xa8d23c){_0x2f5551[_0x0b01('0x44')]=_0xa8d23c;return _0x2f5551;})[_0x0b01('0x28')](respondWithFilteredResult(_0x177bc1,_0x1b9ecf))[_0x0b01('0x45')](handleError(_0x177bc1,null));};exports[_0x0b01('0x46')]=function(_0xcbfeab,_0x3144ad){var _0x2e73d8={'raw':![],'where':{'id':_0xcbfeab[_0x0b01('0x47')]['id']}},_0x29085f={};_0x29085f['model']=_[_0x0b01('0x48')](db[_0x0b01('0x41')]['rawAttributes']);_0x29085f[_0x0b01('0x32')]=_[_0x0b01('0x48')](_0xcbfeab[_0x0b01('0x32')]);_0x29085f['filters']=_[_0x0b01('0x34')](_0x29085f[_0x0b01('0x35')],_0x29085f[_0x0b01('0x32')]);_0x2e73d8['attributes']=_[_0x0b01('0x34')](_0x29085f[_0x0b01('0x35')],qs['fields'](_0xcbfeab['query'][_0x0b01('0x36')]));_0x2e73d8[_0x0b01('0x49')]=_0x2e73d8[_0x0b01('0x49')]['length']?_0x2e73d8[_0x0b01('0x49')]:_0x29085f[_0x0b01('0x35')];if(_0xcbfeab[_0x0b01('0x32')][_0x0b01('0x4a')]){_0x2e73d8[_0x0b01('0x42')]=[{'all':!![]}];}_0x2e73d8=_['merge']({},_0x2e73d8,_0xcbfeab[_0x0b01('0x40')]);return db['VoiceChanSpy'][_0x0b01('0x4b')](_0x2e73d8)['then'](handleEntityNotFound(_0x3144ad,null))['then'](respondWithResult(_0x3144ad,null))['catch'](handleError(_0x3144ad,null));};exports[_0x0b01('0x4c')]=function(_0x5b1b17,_0x449320){return db[_0x0b01('0x41')][_0x0b01('0x4c')](_0x5b1b17[_0x0b01('0x4d')],{})[_0x0b01('0x28')](function(_0x589232){var _0x40a7f8=_0x5b1b17['user'][_0x0b01('0x4e')]({'plain':!![]});if(!_0x40a7f8)throw new Error(_0x0b01('0x4f'));if(_0x40a7f8['role']==='user'){var _0x85b840=_0x589232['get']({'plain':!![]});var _0x39702a=_0x0b01('0x2a');return db[_0x0b01('0x50')][_0x0b01('0x4b')]({'where':{'name':_0x39702a,'userProfileId':_0x40a7f8[_0x0b01('0x51')]},'raw':!![]})[_0x0b01('0x28')](function(_0x1fef69){if(_0x1fef69&&_0x1fef69[_0x0b01('0x52')]===0x0){return db[_0x0b01('0x2b')][_0x0b01('0x4c')]({'name':_0x85b840[_0x0b01('0x2c')],'resourceId':_0x85b840['id'],'type':_0x1fef69['name'],'sectionId':_0x1fef69['id']},{})[_0x0b01('0x28')](function(){return _0x589232;});}else{return _0x589232;}})[_0x0b01('0x45')](function(_0x3b743a){logger['error'](_0x0b01('0x53'),_0x3b743a);throw _0x3b743a;});}return _0x589232;})['then'](respondWithResult(_0x449320,0xc9))[_0x0b01('0x45')](handleError(_0x449320,null));};exports[_0x0b01('0x27')]=function(_0x29f9bf,_0x5caa90){if(_0x29f9bf[_0x0b01('0x4d')]['id']){delete _0x29f9bf[_0x0b01('0x4d')]['id'];}return db[_0x0b01('0x41')]['find']({'where':{'id':_0x29f9bf[_0x0b01('0x47')]['id']}})[_0x0b01('0x28')](handleEntityNotFound(_0x5caa90,null))['then'](saveUpdates(_0x29f9bf[_0x0b01('0x4d')],null))[_0x0b01('0x28')](respondWithResult(_0x5caa90,null))[_0x0b01('0x45')](handleError(_0x5caa90,null));};exports['destroy']=function(_0x2a4f64,_0x44633c){return db['VoiceChanSpy'][_0x0b01('0x4b')]({'where':{'id':_0x2a4f64[_0x0b01('0x47')]['id']}})['then'](handleEntityNotFound(_0x44633c,null))[_0x0b01('0x28')](removeEntity(_0x44633c,null))[_0x0b01('0x45')](handleError(_0x44633c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 8212711..3a83a80 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 _0x964e=['agent','catch','exports','models','voice_chanspy','then','bulkCreate','destroy','VoiceExtension','lodash','util','bluebird','from-sip','%s%s','prefix','push','merge','Set','format','CDR(type)=%s','record','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll'];(function(_0x3b2879,_0x4071fa){var _0x4f46f0=function(_0x1dc691){while(--_0x1dc691){_0x3b2879['push'](_0x3b2879['shift']());}};_0x4f46f0(++_0x4071fa);}(_0x964e,0x171));var _0xe964=function(_0x30fb62,_0x47f647){_0x30fb62=_0x30fb62-0x0;var _0x13ef16=_0x964e[_0x30fb62];return _0x13ef16;};'use strict';var _=require(_0xe964('0x0'));var util=require(_0xe964('0x1'));var BPromise=require(_0xe964('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x26087e,_0x4a3fb3,_0x4eabc1){var _0x4d5c0a=0x1;var _0x5017f8=[];var _0x1b449f={'context':_0x4a3fb3['context']||_0xe964('0x3'),'exten':util['format'](_0xe964('0x4'),_0x26087e[_0xe964('0x5')],_0x4eabc1),'type':'system','isApp':![],'ChanSpyId':_0x26087e['id'],'UserId':_0x4a3fb3['id']};_0x5017f8[_0xe964('0x6')](_[_0xe964('0x7')]({'app':_0xe964('0x8'),'appdata':util[_0xe964('0x9')](_0xe964('0xa'),'chanspy'),'priority':_0x4d5c0a++},_0x1b449f));if(_0x26087e[_0xe964('0xb')]){_0x5017f8[_0xe964('0x6')](_[_0xe964('0x7')]({'app':'MixMonitor','appdata':util[_0xe964('0x9')](_0xe964('0xc'),_0x26087e['recordingFormat']),'priority':_0x4d5c0a++},_0x1b449f));}if(_0x26087e[_0xe964('0xd')]){_0x5017f8[_0xe964('0x6')](_['merge']({'app':_0xe964('0xe'),'appdata':_0x26087e[_0xe964('0xf')],'priority':_0x4d5c0a++},_0x1b449f));}_0x5017f8[_0xe964('0x6')](_[_0xe964('0x7')]({'app':_0xe964('0x10'),'appdata':util[_0xe964('0x9')](_0xe964('0x11'),_0x4a3fb3[_0xe964('0x12')],_0x26087e[_0xe964('0x13')]?_0x26087e[_0xe964('0x13')][_0xe964('0x14')](''):''),'priority':_0x4d5c0a++},_0x1b449f));if(_0x26087e[_0xe964('0xb')]){_0x5017f8[_0xe964('0x6')](_[_0xe964('0x7')]({'app':_0xe964('0x15'),'priority':_0x4d5c0a++},_0x1b449f));}return _0x5017f8;};var getChanSpyApplications=function(_0x32e3f1,_0x1bbd99){var _0x3d24eb=[];for(var _0x375972=0x0,_0x392bdc=0x1;_0x375972<_0x1bbd99[_0xe964('0x16')];_0x375972++,_0x392bdc=0x1){_0x3d24eb=_0x3d24eb['concat'](getUserApplications(_0x32e3f1,_0x1bbd99[_0x375972],_0x1bbd99[_0x375972][_0xe964('0x17')]));if(_0x1bbd99[_0x375972]['internal']!=_0x1bbd99[_0x375972]['name']){_0x3d24eb=_0x3d24eb[_0xe964('0x18')](getUserApplications(_0x32e3f1,_0x1bbd99[_0x375972],_0x1bbd99[_0x375972]['name']));}}return _0x3d24eb;};var getChanSpyPromise=function(_0x1a5538,_0x1b3afd){return new BPromise(function(_0x5f0a17,_0x544152){return _0x1a5538[_0xe964('0x19')][_0xe964('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0xe964('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x234a5c){if(_0x234a5c){return _0x5f0a17(getChanSpyApplications(_0x1b3afd,_0x234a5c));}return _0x5f0a17([]);})[_0xe964('0x1c')](function(_0x1001f0){_0x544152(_0x1001f0);});});};module[_0xe964('0x1d')]=function(_0xd3e70b,_0x4a7282){var _0x214083=_0xd3e70b[_0xe964('0x1e')];return _0xd3e70b['define']('VoiceChanSpy',attributes,{'tableName':_0xe964('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x36b5d0,_0xcdff5a,_0x15f7bc){return getChanSpyPromise(_0x214083,_0x36b5d0)[_0xe964('0x20')](function(_0x17db9c){if(_0x17db9c&&_0x17db9c[_0xe964('0x16')]){return _0x214083['VoiceExtension'][_0xe964('0x21')](_0x17db9c);}})[_0xe964('0x20')](function(){_0x15f7bc();})['catch'](function(_0x105bc2){_0x15f7bc(_0x105bc2);});},'afterUpdate':function(_0x5b480f,_0x2ec251,_0x1477fc){return _0x214083['VoiceExtension'][_0xe964('0x22')]({'where':{'ChanSpyId':_0x5b480f['id']}})[_0xe964('0x20')](function(){return getChanSpyPromise(_0x214083,_0x5b480f);})[_0xe964('0x20')](function(_0x43c97d){if(_0x43c97d&&_0x43c97d['length']){return _0x214083[_0xe964('0x23')][_0xe964('0x21')](_0x43c97d);}})[_0xe964('0x20')](function(){_0x1477fc();})[_0xe964('0x1c')](function(_0x103eb1){_0x1477fc(_0x103eb1);});},'afterDestroy':function(_0x4c28e1,_0x530d7d,_0x5404e5){return _0x214083['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x4c28e1['id']}})[_0xe964('0x20')](function(){_0x5404e5();})[_0xe964('0x1c')](function(_0x1a7eb4){_0x5404e5(_0x1a7eb4);});}}});}; \ No newline at end of file +var _0x8e05=['concat','internal','User','agent','catch','exports','models','define','VoiceChanSpy','then','bulkCreate','destroy','VoiceExtension','lodash','bluebird','context','from-sip','format','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','recordingFormat','auth','Authenticate','ChanSpy','name','options','length'];(function(_0x363457,_0x57356d){var _0xacc24c=function(_0x50712d){while(--_0x50712d){_0x363457['push'](_0x363457['shift']());}};_0xacc24c(++_0x57356d);}(_0x8e05,0x1e9));var _0x58e0=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x8e05[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0x58e0('0x0'));var util=require('util');var BPromise=require(_0x58e0('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x19ef52,_0x384192,_0x37bcb4){var _0x1fc5e2=0x1;var _0x556a97=[];var _0x19009e={'context':_0x384192[_0x58e0('0x2')]||_0x58e0('0x3'),'exten':util[_0x58e0('0x4')]('%s%s',_0x19ef52[_0x58e0('0x5')],_0x37bcb4),'type':_0x58e0('0x6'),'isApp':![],'ChanSpyId':_0x19ef52['id'],'UserId':_0x384192['id']};_0x556a97[_0x58e0('0x7')](_['merge']({'app':_0x58e0('0x8'),'appdata':util[_0x58e0('0x4')](_0x58e0('0x9'),_0x58e0('0xa')),'priority':_0x1fc5e2++},_0x19009e));if(_0x19ef52[_0x58e0('0xb')]){_0x556a97[_0x58e0('0x7')](_[_0x58e0('0xc')]({'app':_0x58e0('0xd'),'appdata':util[_0x58e0('0x4')]('${UNIQUEID}.%s,a',_0x19ef52[_0x58e0('0xe')]),'priority':_0x1fc5e2++},_0x19009e));}if(_0x19ef52[_0x58e0('0xf')]){_0x556a97[_0x58e0('0x7')](_[_0x58e0('0xc')]({'app':_0x58e0('0x10'),'appdata':_0x19ef52['password'],'priority':_0x1fc5e2++},_0x19009e));}_0x556a97[_0x58e0('0x7')](_[_0x58e0('0xc')]({'app':_0x58e0('0x11'),'appdata':util[_0x58e0('0x4')]('SIP/%s,%s',_0x384192[_0x58e0('0x12')],_0x19ef52[_0x58e0('0x13')]?_0x19ef52['options']['join'](''):''),'priority':_0x1fc5e2++},_0x19009e));if(_0x19ef52[_0x58e0('0xb')]){_0x556a97['push'](_[_0x58e0('0xc')]({'app':'StopMixMonitor','priority':_0x1fc5e2++},_0x19009e));}return _0x556a97;};var getChanSpyApplications=function(_0x1d1335,_0x27edb1){var _0x1c4970=[];for(var _0x201270=0x0,_0x34086c=0x1;_0x201270<_0x27edb1[_0x58e0('0x14')];_0x201270++,_0x34086c=0x1){_0x1c4970=_0x1c4970[_0x58e0('0x15')](getUserApplications(_0x1d1335,_0x27edb1[_0x201270],_0x27edb1[_0x201270][_0x58e0('0x16')]));if(_0x27edb1[_0x201270][_0x58e0('0x16')]!=_0x27edb1[_0x201270][_0x58e0('0x12')]){_0x1c4970=_0x1c4970[_0x58e0('0x15')](getUserApplications(_0x1d1335,_0x27edb1[_0x201270],_0x27edb1[_0x201270]['name']));}}return _0x1c4970;};var getChanSpyPromise=function(_0x2ebd8c,_0x571282){return new BPromise(function(_0x103481,_0x2d5632){return _0x2ebd8c[_0x58e0('0x17')]['findAll']({'attributes':['id',_0x58e0('0x12'),'internal'],'where':{'role':_0x58e0('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0xbd52b0){if(_0xbd52b0){return _0x103481(getChanSpyApplications(_0x571282,_0xbd52b0));}return _0x103481([]);})[_0x58e0('0x19')](function(_0x5c46c5){_0x2d5632(_0x5c46c5);});});};module[_0x58e0('0x1a')]=function(_0x26d445,_0xa32abe){var _0x358c4f=_0x26d445[_0x58e0('0x1b')];return _0x26d445[_0x58e0('0x1c')](_0x58e0('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x119495,_0x541d54,_0x46e24a){return getChanSpyPromise(_0x358c4f,_0x119495)[_0x58e0('0x1e')](function(_0x148b67){if(_0x148b67&&_0x148b67['length']){return _0x358c4f['VoiceExtension'][_0x58e0('0x1f')](_0x148b67);}})[_0x58e0('0x1e')](function(){_0x46e24a();})[_0x58e0('0x19')](function(_0x19446a){_0x46e24a(_0x19446a);});},'afterUpdate':function(_0x1dab95,_0x544175,_0x35e847){return _0x358c4f['VoiceExtension'][_0x58e0('0x20')]({'where':{'ChanSpyId':_0x1dab95['id']}})[_0x58e0('0x1e')](function(){return getChanSpyPromise(_0x358c4f,_0x1dab95);})['then'](function(_0x49e3ff){if(_0x49e3ff&&_0x49e3ff[_0x58e0('0x14')]){return _0x358c4f[_0x58e0('0x21')][_0x58e0('0x1f')](_0x49e3ff);}})[_0x58e0('0x1e')](function(){_0x35e847();})[_0x58e0('0x19')](function(_0xc06b71){_0x35e847(_0xc06b71);});},'afterDestroy':function(_0xd4c5e2,_0x445ba0,_0x3b37da){return _0x358c4f[_0x58e0('0x21')]['destroy']({'where':{'ChanSpyId':_0xd4c5e2['id']}})[_0x58e0('0x1e')](function(){_0x3b37da();})['catch'](function(_0x4c2992){_0x3b37da(_0x4c2992);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5471811..f562e36 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 _0xee5b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xee5b,0x1f4));var _0xbee5=function(_0x30cce8,_0x469f47){_0x30cce8=_0x30cce8-0x0;var _0x10bc29=_0xee5b[_0x30cce8];return _0x10bc29;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});} \ No newline at end of file +var _0xb469=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0xf1440c,_0x2b1b87){var _0x40bee8=function(_0x259332){while(--_0x259332){_0xf1440c['push'](_0xf1440c['shift']());}};_0x40bee8(++_0x2b1b87);}(_0xb469,0x13b));var _0x9b46=function(_0x26b4f6,_0x199606){_0x26b4f6=_0x26b4f6-0x0;var _0x293c15=_0xb469[_0x26b4f6];return _0x293c15;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3265d30..fb54c50 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 _0xea9f=['show','post','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0xea9f,0x125));var _0xfea9=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xea9f[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0xfea9('0x0'));var util=require('util');var path=require(_0xfea9('0x1'));var timeout=require(_0xfea9('0x2'));var express=require(_0xfea9('0x3'));var router=express[_0xfea9('0x4')]();var fs_extra=require(_0xfea9('0x5'));var auth=require(_0xfea9('0x6'));var interaction=require(_0xfea9('0x7'));var config=require(_0xfea9('0x8'));var controller=require(_0xfea9('0x9'));router['get']('/',auth[_0xfea9('0xa')](),controller['index']);router[_0xfea9('0xb')](_0xfea9('0xc'),auth[_0xfea9('0xa')](),controller[_0xfea9('0xd')]);router[_0xfea9('0xe')]('/',auth[_0xfea9('0xa')](),controller['create']);router['put'](_0xfea9('0xc'),auth[_0xfea9('0xa')](),controller[_0xfea9('0xf')]);router['delete'](_0xfea9('0xc'),auth[_0xfea9('0xa')](),controller[_0xfea9('0x10')]);module[_0xfea9('0x11')]=router; \ No newline at end of file +var _0xb352=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','destroy'];(function(_0x138bc5,_0x125808){var _0x23c923=function(_0x3252b7){while(--_0x3252b7){_0x138bc5['push'](_0x138bc5['shift']());}};_0x23c923(++_0x125808);}(_0xb352,0x199));var _0x2b35=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb352[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0x2b35('0x0'));var util=require(_0x2b35('0x1'));var path=require(_0x2b35('0x2'));var timeout=require('connect-timeout');var express=require(_0x2b35('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b35('0x4'));var interaction=require(_0x2b35('0x5'));var config=require(_0x2b35('0x6'));var controller=require('./voiceContext.controller');router[_0x2b35('0x7')]('/',auth[_0x2b35('0x8')](),controller[_0x2b35('0x9')]);router[_0x2b35('0x7')](_0x2b35('0xa'),auth['isAuthenticated'](),controller[_0x2b35('0xb')]);router[_0x2b35('0xc')]('/',auth[_0x2b35('0x8')](),controller[_0x2b35('0xd')]);router[_0x2b35('0xe')](_0x2b35('0xa'),auth[_0x2b35('0x8')](),controller['update']);router['delete'](_0x2b35('0xa'),auth[_0x2b35('0x8')](),controller[_0x2b35('0xf')]);module[_0x2b35('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 afebcd2..ebe8226 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 _0x51bc=['exports','name','STRING','BOOLEAN','sequelize'];(function(_0x5531e9,_0x3e0c5b){var _0x6d67d0=function(_0x3a90f0){while(--_0x3a90f0){_0x5531e9['push'](_0x5531e9['shift']());}};_0x6d67d0(++_0x3e0c5b);}(_0x51bc,0x126));var _0xc51b=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x51bc[_0x2becba];return _0x90b5dd;};'use strict';var Sequelize=require(_0xc51b('0x0'));module[_0xc51b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc51b('0x2')},'description':{'type':Sequelize[_0xc51b('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc51b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3065=['sequelize','name','STRING','BOOLEAN'];(function(_0xf85dfb,_0x35b32b){var _0x8751fb=function(_0x43d844){while(--_0x43d844){_0xf85dfb['push'](_0xf85dfb['shift']());}};_0x8751fb(++_0x35b32b);}(_0x3065,0x84));var _0x5306=function(_0x642cff,_0x21ae44){_0x642cff=_0x642cff-0x0;var _0x2d7db7=_0x3065[_0x642cff];return _0x2d7db7;};'use strict';var Sequelize=require(_0x5306('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5306('0x1')},'description':{'type':Sequelize[_0x5306('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5306('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 0529534..f7b2af9 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 _0x2937=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','UserProfileResource','destroy','name','index','map','VoiceContext','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','body','findAll','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','create','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf'];(function(_0xa09a12,_0xbd3c8a){var _0x3a808f=function(_0x392cb4){while(--_0x392cb4){_0xa09a12['push'](_0xa09a12['shift']());}};_0x3a808f(++_0xbd3c8a);}(_0x2937,0x18e));var _0x7293=function(_0x4cfd6a,_0x256436){_0x4cfd6a=_0x4cfd6a-0x0;var _0x4d289f=_0x2937[_0x4cfd6a];return _0x4d289f;};'use strict';var emlformat=require(_0x7293('0x0'));var rimraf=require(_0x7293('0x1'));var zipdir=require(_0x7293('0x2'));var jsonpatch=require(_0x7293('0x3'));var rp=require(_0x7293('0x4'));var moment=require(_0x7293('0x5'));var BPromise=require(_0x7293('0x6'));var Mustache=require(_0x7293('0x7'));var util=require('util');var path=require(_0x7293('0x8'));var sox=require(_0x7293('0x9'));var csv=require(_0x7293('0xa'));var ejs=require(_0x7293('0xb'));var fs=require('fs');var fs_extra=require(_0x7293('0xc'));var _=require(_0x7293('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7293('0xa'));var querystring=require(_0x7293('0xe'));var Papa=require(_0x7293('0xf'));var Redis=require(_0x7293('0x10'));var authService=require(_0x7293('0x11'));var qs=require(_0x7293('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7293('0x13'));var logger=require(_0x7293('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7293('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7293('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x7293('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xd16b14,_0xed14dc,_0x3917ee,_0x25147b){return new BPromise(function(_0x3f0704,_0x43576c){var _0x7e467d=_0x25147b||client;return _0x7e467d['request'](_0xd16b14,_0x3917ee)[_0x7293('0x18')](function(_0x3773e6){logger[_0x7293('0x19')](_0x7293('0x1a'),_0xed14dc,_0x7293('0x1b'));logger[_0x7293('0x1c')](_0x7293('0x1d'),_0xed14dc,'request\x20sent',JSON[_0x7293('0x1e')](_0x3773e6));if(_0x3773e6[_0x7293('0x1f')]){if(_0x3773e6['error']['code']===0x1f4){logger[_0x7293('0x1f')](_0x7293('0x1a'),_0xed14dc,_0x3773e6[_0x7293('0x1f')][_0x7293('0x20')]);return _0x43576c(_0x3773e6[_0x7293('0x1f')][_0x7293('0x20')]);}logger[_0x7293('0x1f')](_0x7293('0x1a'),_0xed14dc,_0x3773e6[_0x7293('0x1f')][_0x7293('0x20')]);return _0x3f0704(_0x3773e6[_0x7293('0x1f')][_0x7293('0x20')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0xed14dc,_0x7293('0x1b'));_0x3f0704(_0x3773e6['result']['message']);}})[_0x7293('0x21')](function(_0x272223){logger[_0x7293('0x1f')](_0x7293('0x1a'),_0xed14dc,_0x272223);_0x43576c(_0x272223);});});}function respondWithStatusCode(_0x637f2,_0x5e7a37){_0x5e7a37=_0x5e7a37||0xcc;return function(_0x2a6456){if(_0x2a6456){return _0x637f2[_0x7293('0x22')](_0x5e7a37);}return _0x637f2[_0x7293('0x23')](_0x5e7a37)[_0x7293('0x24')]();};}function respondWithResult(_0x11802a,_0x52db24){_0x52db24=_0x52db24||0xc8;return function(_0x4c6202){if(_0x4c6202){return _0x11802a['status'](_0x52db24)[_0x7293('0x25')](_0x4c6202);}};}function respondWithFilteredResult(_0x50bacf,_0x5d9ddc){return function(_0x5c2958){if(_0x5c2958){var _0x3e8f2d=typeof _0x5d9ddc[_0x7293('0x26')]===_0x7293('0x27')&&typeof _0x5d9ddc[_0x7293('0x28')]===_0x7293('0x27');var _0x1bae0d=_0x5c2958[_0x7293('0x29')];var _0x2c9989=_0x3e8f2d?0x0:_0x5d9ddc[_0x7293('0x26')];var _0x55fa7f=_0x3e8f2d?_0x5c2958['count']:_0x5d9ddc[_0x7293('0x26')]+_0x5d9ddc['limit'];var _0x153659;if(_0x55fa7f>=_0x1bae0d){_0x55fa7f=_0x1bae0d;_0x153659=0xc8;}else{_0x153659=0xce;}_0x50bacf[_0x7293('0x23')](_0x153659);return _0x50bacf[_0x7293('0x2a')](_0x7293('0x2b'),_0x2c9989+'-'+_0x55fa7f+'/'+_0x1bae0d)[_0x7293('0x25')](_0x5c2958);}return null;};}function patchUpdates(_0x271836){return function(_0x4585c0){try{jsonpatch[_0x7293('0x2c')](_0x4585c0,_0x271836,!![]);}catch(_0x4c461e){return BPromise[_0x7293('0x2d')](_0x4c461e);}return _0x4585c0['save']();};}function saveUpdates(_0x236e97,_0x374f6d){return function(_0x4c51a5){if(_0x4c51a5){return _0x4c51a5[_0x7293('0x2e')](_0x236e97)[_0x7293('0x18')](function(_0x123bb5){return _0x123bb5;});}return null;};}function removeEntity(_0x2dbf77,_0x1af152){return function(_0x3addae){if(_0x3addae){return _0x3addae['destroy']()['then'](function(){var _0x3d7399=_0x3addae[_0x7293('0x2f')]({'plain':!![]});var _0x205141='Contexts';return db[_0x7293('0x30')][_0x7293('0x31')]({'where':{'type':_0x205141,'resourceId':_0x3d7399['id']}})[_0x7293('0x18')](function(){return _0x3addae;});})[_0x7293('0x18')](function(){_0x2dbf77[_0x7293('0x23')](0xcc)[_0x7293('0x24')]();});}};}function handleEntityNotFound(_0x344f69,_0x397030){return function(_0xfab023){if(!_0xfab023){_0x344f69[_0x7293('0x22')](0x194);}return _0xfab023;};}function handleError(_0x1399d6,_0x40c197){_0x40c197=_0x40c197||0x1f4;return function(_0x21c201){logger[_0x7293('0x1f')](_0x21c201['stack']);if(_0x21c201['name']){delete _0x21c201[_0x7293('0x32')];}_0x1399d6['status'](_0x40c197)['send'](_0x21c201);};}exports[_0x7293('0x33')]=function(_0x125ff6,_0x1c723f){var _0x437a93={},_0x3be947={},_0x23046c={'count':0x0,'rows':[]};var _0x32d7c9=_[_0x7293('0x34')](db[_0x7293('0x35')]['rawAttributes'],function(_0x44e4bc){return{'name':_0x44e4bc[_0x7293('0x36')],'type':_0x44e4bc[_0x7293('0x37')][_0x7293('0x38')]};});_0x3be947[_0x7293('0x39')]=_[_0x7293('0x34')](_0x32d7c9,_0x7293('0x32'));_0x3be947[_0x7293('0x3a')]=_[_0x7293('0x3b')](_0x125ff6['query']);_0x3be947['filters']=_[_0x7293('0x3c')](_0x3be947[_0x7293('0x39')],_0x3be947[_0x7293('0x3a')]);_0x437a93[_0x7293('0x3d')]=_[_0x7293('0x3c')](_0x3be947[_0x7293('0x39')],qs[_0x7293('0x3e')](_0x125ff6[_0x7293('0x3a')][_0x7293('0x3e')]));_0x437a93[_0x7293('0x3d')]=_0x437a93[_0x7293('0x3d')][_0x7293('0x3f')]?_0x437a93['attributes']:_0x3be947[_0x7293('0x39')];if(!_0x125ff6['query'][_0x7293('0x40')]('nolimit')){_0x437a93[_0x7293('0x28')]=qs[_0x7293('0x28')](_0x125ff6['query']['limit']);_0x437a93['offset']=qs[_0x7293('0x26')](_0x125ff6[_0x7293('0x3a')][_0x7293('0x26')]);}_0x437a93[_0x7293('0x41')]=qs[_0x7293('0x42')](_0x125ff6[_0x7293('0x3a')][_0x7293('0x42')]);_0x437a93[_0x7293('0x43')]=qs[_0x7293('0x44')](_['pick'](_0x125ff6[_0x7293('0x3a')],_0x3be947[_0x7293('0x44')]),_0x32d7c9);if(_0x125ff6[_0x7293('0x3a')][_0x7293('0x45')]){_0x437a93['where']=_[_0x7293('0x46')](_0x437a93[_0x7293('0x43')],{'$or':_[_0x7293('0x34')](_0x32d7c9,function(_0x86d6f3){if(_0x86d6f3[_0x7293('0x37')]!==_0x7293('0x47')){var _0xec200a={};_0xec200a[_0x86d6f3['name']]={'$like':'%'+_0x125ff6[_0x7293('0x3a')][_0x7293('0x45')]+'%'};return _0xec200a;}})});}_0x437a93=_['merge']({},_0x437a93,_0x125ff6[_0x7293('0x48')]);var _0x3fc175={'where':_0x437a93[_0x7293('0x43')]};return db[_0x7293('0x35')][_0x7293('0x29')](_0x3fc175)['then'](function(_0x5665fa){_0x23046c['count']=_0x5665fa;if(_0x125ff6['query'][_0x7293('0x49')]){_0x437a93[_0x7293('0x4a')]=[{'all':!![]}];}return db[_0x7293('0x35')]['findAll'](_0x437a93);})['then'](function(_0x5a0ed1){_0x23046c[_0x7293('0x4b')]=_0x5a0ed1;return _0x23046c;})['then'](respondWithFilteredResult(_0x1c723f,_0x437a93))[_0x7293('0x21')](handleError(_0x1c723f,null));};exports[_0x7293('0x4c')]=function(_0x13591f,_0x54d0fd){var _0x1a1e26={'raw':![],'where':{'id':_0x13591f[_0x7293('0x4d')]['id']}},_0x3b2575={};_0x3b2575['model']=_[_0x7293('0x3b')](db[_0x7293('0x35')][_0x7293('0x4e')]);_0x3b2575[_0x7293('0x3a')]=_[_0x7293('0x3b')](_0x13591f[_0x7293('0x3a')]);_0x3b2575['filters']=_[_0x7293('0x3c')](_0x3b2575[_0x7293('0x39')],_0x3b2575[_0x7293('0x3a')]);_0x1a1e26[_0x7293('0x3d')]=_[_0x7293('0x3c')](_0x3b2575[_0x7293('0x39')],qs[_0x7293('0x3e')](_0x13591f['query'][_0x7293('0x3e')]));_0x1a1e26[_0x7293('0x3d')]=_0x1a1e26[_0x7293('0x3d')][_0x7293('0x3f')]?_0x1a1e26['attributes']:_0x3b2575[_0x7293('0x39')];if(_0x13591f[_0x7293('0x3a')][_0x7293('0x49')]){_0x1a1e26['include']=[{'all':!![]}];}_0x1a1e26=_[_0x7293('0x46')]({},_0x1a1e26,_0x13591f[_0x7293('0x48')]);return db[_0x7293('0x35')]['find'](_0x1a1e26)['then'](handleEntityNotFound(_0x54d0fd,null))[_0x7293('0x18')](respondWithResult(_0x54d0fd,null))['catch'](handleError(_0x54d0fd,null));};exports['create']=function(_0x24a041,_0x3ab74d,_0x5b49fd){var _0x2fcf17;return db[_0x7293('0x35')]['create'](_0x24a041[_0x7293('0x4f')],{'raw':!![]})[_0x7293('0x18')](function(_0x5d357c){_0x2fcf17=_0x5d357c;return db['VoiceContext'][_0x7293('0x50')]({'raw':!![]});})[_0x7293('0x18')](function(_0x18eb9e){var _0xa05de9=fs[_0x7293('0x51')](path[_0x7293('0x52')](config['root'],_0x7293('0x53')),_0x7293('0x54'));var _0x3c5e50=ejs[_0x7293('0x55')](_0xa05de9,{'contexts':_0x18eb9e||[]});fs[_0x7293('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3c5e50);})[_0x7293('0x18')](function(){return respondWithRpcPromise(_0x7293('0x57'),_0x7293('0x58'),{'module':_0x7293('0x59')});})[_0x7293('0x18')](function(){var _0xbddb1a=_0x24a041[_0x7293('0x5a')][_0x7293('0x2f')]({'plain':!![]});if(!_0xbddb1a)throw new Error(_0x7293('0x5b'));if(_0xbddb1a[_0x7293('0x5c')]===_0x7293('0x5a')){var _0x15dbfa=_0x2fcf17[_0x7293('0x2f')]({'plain':!![]});return db['UserProfileSection'][_0x7293('0x5d')]({'where':{'name':_0x7293('0x5e'),'userProfileId':_0xbddb1a[_0x7293('0x5f')]},'raw':!![]})[_0x7293('0x18')](function(_0x259d94){if(_0x259d94&&_0x259d94[_0x7293('0x60')]===0x0){return db[_0x7293('0x30')][_0x7293('0x58')]({'name':_0x15dbfa[_0x7293('0x32')],'resourceId':_0x15dbfa['id'],'type':_0x259d94[_0x7293('0x32')],'sectionId':_0x259d94['id']},{})[_0x7293('0x18')](function(){return _0x2fcf17;});}else{return _0x2fcf17;}})[_0x7293('0x21')](function(_0x1181dd){logger[_0x7293('0x1f')](_0x7293('0x61'),_0x1181dd);throw _0x1181dd;});}return _0x2fcf17;})[_0x7293('0x18')](respondWithResult(_0x3ab74d,0xc9))[_0x7293('0x21')](handleError(_0x3ab74d,null));};exports[_0x7293('0x2e')]=function(_0x457d43,_0x3a28af,_0x208ca8){var _0x28073e;return db[_0x7293('0x35')][_0x7293('0x5d')]({'where':{'id':_0x457d43[_0x7293('0x4d')]['id']}})[_0x7293('0x18')](handleEntityNotFound(_0x3a28af,null))[_0x7293('0x18')](saveUpdates(_0x457d43[_0x7293('0x4f')],null))[_0x7293('0x18')](function(_0x383f1a){if(_0x383f1a){_0x28073e=_0x383f1a;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x7293('0x18')](function(_0x54650e){var _0x23cd05=fs[_0x7293('0x51')](path['join'](config[_0x7293('0x62')],_0x7293('0x53')),_0x7293('0x54'));var _0x173199=ejs[_0x7293('0x55')](_0x23cd05,{'contexts':_0x54650e||[]});fs['writeFileSync'](_0x7293('0x63'),_0x173199);})[_0x7293('0x18')](function(){return respondWithRpcPromise('Reload',_0x7293('0x2e'),{'module':_0x7293('0x59')});})[_0x7293('0x18')](function(){return _0x28073e;})[_0x7293('0x18')](respondWithResult(_0x3a28af,null))['catch'](handleError(_0x3a28af,null));};exports[_0x7293('0x31')]=function(_0x3820f0,_0x30e08c,_0x5cc0ce){var _0x11ba57;return db[_0x7293('0x35')][_0x7293('0x5d')]({'where':{'id':_0x3820f0['params']['id']}})[_0x7293('0x18')](handleEntityNotFound(_0x30e08c,null))[_0x7293('0x18')](removeEntity(_0x30e08c,null))[_0x7293('0x18')](function(){return db[_0x7293('0x35')][_0x7293('0x50')]({'raw':!![]});})['then'](function(_0x39f917){var _0x586fcc=fs[_0x7293('0x51')](path[_0x7293('0x52')](config[_0x7293('0x62')],_0x7293('0x53')),_0x7293('0x54'));var _0x3e8fb1=ejs[_0x7293('0x55')](_0x586fcc,{'contexts':_0x39f917});fs[_0x7293('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3e8fb1);return respondWithRpcPromise(_0x7293('0x57'),'destroy',{'module':_0x7293('0x59')});})['catch'](handleError(_0x30e08c,null));}; \ No newline at end of file +var _0xa570=['mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','undefined','count','offset','limit','Content-Range','save','destroy','Contexts','UserProfileResource','end','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','model','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Reload','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x230daa,_0x2d4dd0){var _0x210dc5=function(_0x455859){while(--_0x455859){_0x230daa['push'](_0x230daa['shift']());}};_0x210dc5(++_0x2d4dd0);}(_0xa570,0x18f));var _0x0a57=function(_0x359416,_0x43fe8c){_0x359416=_0x359416-0x0;var _0x5b1a16=_0xa570[_0x359416];return _0x5b1a16;};'use strict';var emlformat=require(_0x0a57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a57('0x1'));var jsonpatch=require(_0x0a57('0x2'));var rp=require(_0x0a57('0x3'));var moment=require(_0x0a57('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0a57('0x5'));var util=require(_0x0a57('0x6'));var path=require(_0x0a57('0x7'));var sox=require('sox');var csv=require(_0x0a57('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a57('0x9'));var _=require(_0x0a57('0xa'));var squel=require(_0x0a57('0xb'));var crypto=require(_0x0a57('0xc'));var jsforce=require(_0x0a57('0xd'));var deskjs=require(_0x0a57('0xe'));var toCsv=require(_0x0a57('0x8'));var querystring=require(_0x0a57('0xf'));var Papa=require('papaparse');var Redis=require(_0x0a57('0x10'));var authService=require(_0x0a57('0x11'));var qs=require(_0x0a57('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a57('0x13'));var logger=require(_0x0a57('0x14'))(_0x0a57('0x15'));var utils=require(_0x0a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0a57('0x17'))['db'];var jayson=require(_0x0a57('0x18'));var client=jayson[_0x0a57('0x19')][_0x0a57('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x464026,_0x42f06a,_0x1367d9,_0x527047){return new BPromise(function(_0x5e1da2,_0x55a539){var _0x384343=_0x527047||client;return _0x384343[_0x0a57('0x1b')](_0x464026,_0x1367d9)[_0x0a57('0x1c')](function(_0x2cbdc6){logger[_0x0a57('0x1d')](_0x0a57('0x1e'),_0x42f06a,_0x0a57('0x1f'));logger[_0x0a57('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x42f06a,'request\x20sent',JSON['stringify'](_0x2cbdc6));if(_0x2cbdc6[_0x0a57('0x21')]){if(_0x2cbdc6[_0x0a57('0x21')][_0x0a57('0x22')]===0x1f4){logger[_0x0a57('0x21')](_0x0a57('0x1e'),_0x42f06a,_0x2cbdc6['error'][_0x0a57('0x23')]);return _0x55a539(_0x2cbdc6[_0x0a57('0x21')][_0x0a57('0x23')]);}logger[_0x0a57('0x21')](_0x0a57('0x1e'),_0x42f06a,_0x2cbdc6[_0x0a57('0x21')][_0x0a57('0x23')]);return _0x5e1da2(_0x2cbdc6[_0x0a57('0x21')][_0x0a57('0x23')]);}else{logger[_0x0a57('0x1d')](_0x0a57('0x1e'),_0x42f06a,_0x0a57('0x1f'));_0x5e1da2(_0x2cbdc6[_0x0a57('0x24')][_0x0a57('0x23')]);}})[_0x0a57('0x25')](function(_0x4427b4){logger[_0x0a57('0x21')](_0x0a57('0x1e'),_0x42f06a,_0x4427b4);_0x55a539(_0x4427b4);});});}function respondWithStatusCode(_0x2c6cba,_0x47be7d){_0x47be7d=_0x47be7d||0xcc;return function(_0x74dddf){if(_0x74dddf){return _0x2c6cba['sendStatus'](_0x47be7d);}return _0x2c6cba[_0x0a57('0x26')](_0x47be7d)['end']();};}function respondWithResult(_0x4fc292,_0x4ae794){_0x4ae794=_0x4ae794||0xc8;return function(_0x487043){if(_0x487043){return _0x4fc292[_0x0a57('0x26')](_0x4ae794)['json'](_0x487043);}};}function respondWithFilteredResult(_0x239223,_0x5d9849){return function(_0x531731){if(_0x531731){var _0x3f84b1=typeof _0x5d9849['offset']==='undefined'&&typeof _0x5d9849['limit']===_0x0a57('0x27');var _0x38e0dc=_0x531731[_0x0a57('0x28')];var _0x22a7cb=_0x3f84b1?0x0:_0x5d9849['offset'];var _0x34d021=_0x3f84b1?_0x531731['count']:_0x5d9849[_0x0a57('0x29')]+_0x5d9849[_0x0a57('0x2a')];var _0xc3a95;if(_0x34d021>=_0x38e0dc){_0x34d021=_0x38e0dc;_0xc3a95=0xc8;}else{_0xc3a95=0xce;}_0x239223[_0x0a57('0x26')](_0xc3a95);return _0x239223['set'](_0x0a57('0x2b'),_0x22a7cb+'-'+_0x34d021+'/'+_0x38e0dc)['json'](_0x531731);}return null;};}function patchUpdates(_0x58cec9){return function(_0x2aaa4){try{jsonpatch['apply'](_0x2aaa4,_0x58cec9,!![]);}catch(_0x55241a){return BPromise['reject'](_0x55241a);}return _0x2aaa4[_0x0a57('0x2c')]();};}function saveUpdates(_0x3e026d,_0x194a70){return function(_0xf0233b){if(_0xf0233b){return _0xf0233b['update'](_0x3e026d)[_0x0a57('0x1c')](function(_0x1dfe14){return _0x1dfe14;});}return null;};}function removeEntity(_0x8bf14e,_0x513115){return function(_0x209816){if(_0x209816){return _0x209816[_0x0a57('0x2d')]()['then'](function(){var _0x29ea42=_0x209816['get']({'plain':!![]});var _0x94a5a9=_0x0a57('0x2e');return db[_0x0a57('0x2f')][_0x0a57('0x2d')]({'where':{'type':_0x94a5a9,'resourceId':_0x29ea42['id']}})['then'](function(){return _0x209816;});})['then'](function(){_0x8bf14e[_0x0a57('0x26')](0xcc)[_0x0a57('0x30')]();});}};}function handleEntityNotFound(_0x19bdbd,_0x5d16d5){return function(_0x181e35){if(!_0x181e35){_0x19bdbd[_0x0a57('0x31')](0x194);}return _0x181e35;};}function handleError(_0x5d630f,_0x4f07eb){_0x4f07eb=_0x4f07eb||0x1f4;return function(_0x5211ac){logger[_0x0a57('0x21')](_0x5211ac[_0x0a57('0x32')]);if(_0x5211ac['name']){delete _0x5211ac[_0x0a57('0x33')];}_0x5d630f[_0x0a57('0x26')](_0x4f07eb)[_0x0a57('0x34')](_0x5211ac);};}exports[_0x0a57('0x35')]=function(_0x29ebf0,_0x4e1a72){var _0x1c3c41={},_0x53722c={},_0x3575aa={'count':0x0,'rows':[]};var _0x2a0ffb=_[_0x0a57('0x36')](db[_0x0a57('0x37')][_0x0a57('0x38')],function(_0x1941d1){return{'name':_0x1941d1[_0x0a57('0x39')],'type':_0x1941d1[_0x0a57('0x3a')]['key']};});_0x53722c['model']=_[_0x0a57('0x36')](_0x2a0ffb,_0x0a57('0x33'));_0x53722c[_0x0a57('0x3b')]=_[_0x0a57('0x3c')](_0x29ebf0[_0x0a57('0x3b')]);_0x53722c['filters']=_[_0x0a57('0x3d')](_0x53722c['model'],_0x53722c[_0x0a57('0x3b')]);_0x1c3c41['attributes']=_[_0x0a57('0x3d')](_0x53722c['model'],qs['fields'](_0x29ebf0[_0x0a57('0x3b')][_0x0a57('0x3e')]));_0x1c3c41[_0x0a57('0x3f')]=_0x1c3c41[_0x0a57('0x3f')][_0x0a57('0x40')]?_0x1c3c41[_0x0a57('0x3f')]:_0x53722c['model'];if(!_0x29ebf0[_0x0a57('0x3b')][_0x0a57('0x41')](_0x0a57('0x42'))){_0x1c3c41[_0x0a57('0x2a')]=qs[_0x0a57('0x2a')](_0x29ebf0[_0x0a57('0x3b')]['limit']);_0x1c3c41['offset']=qs['offset'](_0x29ebf0[_0x0a57('0x3b')][_0x0a57('0x29')]);}_0x1c3c41[_0x0a57('0x43')]=qs[_0x0a57('0x44')](_0x29ebf0[_0x0a57('0x3b')][_0x0a57('0x44')]);_0x1c3c41[_0x0a57('0x45')]=qs[_0x0a57('0x46')](_[_0x0a57('0x47')](_0x29ebf0[_0x0a57('0x3b')],_0x53722c[_0x0a57('0x46')]),_0x2a0ffb);if(_0x29ebf0[_0x0a57('0x3b')]['filter']){_0x1c3c41[_0x0a57('0x45')]=_[_0x0a57('0x48')](_0x1c3c41[_0x0a57('0x45')],{'$or':_['map'](_0x2a0ffb,function(_0x52f7ca){if(_0x52f7ca[_0x0a57('0x3a')]!==_0x0a57('0x49')){var _0x3ad5c7={};_0x3ad5c7[_0x52f7ca[_0x0a57('0x33')]]={'$like':'%'+_0x29ebf0[_0x0a57('0x3b')]['filter']+'%'};return _0x3ad5c7;}})});}_0x1c3c41=_[_0x0a57('0x48')]({},_0x1c3c41,_0x29ebf0['options']);var _0x4dd6b9={'where':_0x1c3c41[_0x0a57('0x45')]};return db[_0x0a57('0x37')][_0x0a57('0x28')](_0x4dd6b9)['then'](function(_0x313fee){_0x3575aa[_0x0a57('0x28')]=_0x313fee;if(_0x29ebf0[_0x0a57('0x3b')][_0x0a57('0x4a')]){_0x1c3c41[_0x0a57('0x4b')]=[{'all':!![]}];}return db['VoiceContext'][_0x0a57('0x4c')](_0x1c3c41);})[_0x0a57('0x1c')](function(_0x339a3f){_0x3575aa[_0x0a57('0x4d')]=_0x339a3f;return _0x3575aa;})[_0x0a57('0x1c')](respondWithFilteredResult(_0x4e1a72,_0x1c3c41))[_0x0a57('0x25')](handleError(_0x4e1a72,null));};exports[_0x0a57('0x4e')]=function(_0x4f55e7,_0x447030){var _0x1bf84a={'raw':![],'where':{'id':_0x4f55e7[_0x0a57('0x4f')]['id']}},_0x34f6ff={};_0x34f6ff[_0x0a57('0x50')]=_[_0x0a57('0x3c')](db['VoiceContext']['rawAttributes']);_0x34f6ff[_0x0a57('0x3b')]=_['keys'](_0x4f55e7[_0x0a57('0x3b')]);_0x34f6ff['filters']=_['intersection'](_0x34f6ff[_0x0a57('0x50')],_0x34f6ff[_0x0a57('0x3b')]);_0x1bf84a[_0x0a57('0x3f')]=_[_0x0a57('0x3d')](_0x34f6ff['model'],qs[_0x0a57('0x3e')](_0x4f55e7[_0x0a57('0x3b')][_0x0a57('0x3e')]));_0x1bf84a[_0x0a57('0x3f')]=_0x1bf84a[_0x0a57('0x3f')][_0x0a57('0x40')]?_0x1bf84a[_0x0a57('0x3f')]:_0x34f6ff['model'];if(_0x4f55e7[_0x0a57('0x3b')][_0x0a57('0x4a')]){_0x1bf84a[_0x0a57('0x4b')]=[{'all':!![]}];}_0x1bf84a=_['merge']({},_0x1bf84a,_0x4f55e7['options']);return db[_0x0a57('0x37')][_0x0a57('0x51')](_0x1bf84a)['then'](handleEntityNotFound(_0x447030,null))[_0x0a57('0x1c')](respondWithResult(_0x447030,null))[_0x0a57('0x25')](handleError(_0x447030,null));};exports[_0x0a57('0x52')]=function(_0x3bccd7,_0xb797c4,_0x2a04bd){var _0xf2d1d8;return db['VoiceContext'][_0x0a57('0x52')](_0x3bccd7[_0x0a57('0x53')],{'raw':!![]})['then'](function(_0x5d6bb3){_0xf2d1d8=_0x5d6bb3;return db['VoiceContext'][_0x0a57('0x4c')]({'raw':!![]});})[_0x0a57('0x1c')](function(_0xfb3086){var _0x369f41=fs[_0x0a57('0x54')](path[_0x0a57('0x55')](config[_0x0a57('0x56')],_0x0a57('0x57')),_0x0a57('0x58'));var _0x4b92c7=ejs[_0x0a57('0x59')](_0x369f41,{'contexts':_0xfb3086||[]});fs['writeFileSync'](_0x0a57('0x5a'),_0x4b92c7);})[_0x0a57('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x0a57('0x1c')](function(){var _0x372dfa=_0x3bccd7[_0x0a57('0x5b')][_0x0a57('0x5c')]({'plain':!![]});if(!_0x372dfa)throw new Error(_0x0a57('0x5d'));if(_0x372dfa[_0x0a57('0x5e')]===_0x0a57('0x5b')){var _0x223915=_0xf2d1d8[_0x0a57('0x5c')]({'plain':!![]});return db[_0x0a57('0x5f')]['find']({'where':{'name':_0x0a57('0x2e'),'userProfileId':_0x372dfa[_0x0a57('0x60')]},'raw':!![]})['then'](function(_0x4534a1){if(_0x4534a1&&_0x4534a1['autoAssociation']===0x0){return db[_0x0a57('0x2f')][_0x0a57('0x52')]({'name':_0x223915[_0x0a57('0x33')],'resourceId':_0x223915['id'],'type':_0x4534a1[_0x0a57('0x33')],'sectionId':_0x4534a1['id']},{})['then'](function(){return _0xf2d1d8;});}else{return _0xf2d1d8;}})[_0x0a57('0x25')](function(_0x4fc548){logger[_0x0a57('0x21')](_0x0a57('0x61'),_0x4fc548);throw _0x4fc548;});}return _0xf2d1d8;})[_0x0a57('0x1c')](respondWithResult(_0xb797c4,0xc9))[_0x0a57('0x25')](handleError(_0xb797c4,null));};exports[_0x0a57('0x62')]=function(_0x38395f,_0x6010ee,_0x2006fe){var _0x5a3b46;return db[_0x0a57('0x37')][_0x0a57('0x51')]({'where':{'id':_0x38395f['params']['id']}})[_0x0a57('0x1c')](handleEntityNotFound(_0x6010ee,null))[_0x0a57('0x1c')](saveUpdates(_0x38395f[_0x0a57('0x53')],null))[_0x0a57('0x1c')](function(_0x2235a9){if(_0x2235a9){_0x5a3b46=_0x2235a9;return db[_0x0a57('0x37')]['findAll']({'raw':!![]});}})[_0x0a57('0x1c')](function(_0x5b420f){var _0x20f47f=fs[_0x0a57('0x54')](path[_0x0a57('0x55')](config[_0x0a57('0x56')],_0x0a57('0x57')),_0x0a57('0x58'));var _0x562bd3=ejs[_0x0a57('0x59')](_0x20f47f,{'contexts':_0x5b420f||[]});fs['writeFileSync'](_0x0a57('0x5a'),_0x562bd3);})[_0x0a57('0x1c')](function(){return respondWithRpcPromise(_0x0a57('0x63'),_0x0a57('0x62'),{'module':'chan_sip.so'});})[_0x0a57('0x1c')](function(){return _0x5a3b46;})[_0x0a57('0x1c')](respondWithResult(_0x6010ee,null))[_0x0a57('0x25')](handleError(_0x6010ee,null));};exports[_0x0a57('0x2d')]=function(_0x207f98,_0x6a8ee7,_0x4d25b7){var _0x1761d6;return db[_0x0a57('0x37')][_0x0a57('0x51')]({'where':{'id':_0x207f98[_0x0a57('0x4f')]['id']}})[_0x0a57('0x1c')](handleEntityNotFound(_0x6a8ee7,null))[_0x0a57('0x1c')](removeEntity(_0x6a8ee7,null))['then'](function(){return db[_0x0a57('0x37')][_0x0a57('0x4c')]({'raw':!![]});})[_0x0a57('0x1c')](function(_0x172196){var _0x1386a4=fs[_0x0a57('0x54')](path[_0x0a57('0x55')](config['root'],_0x0a57('0x57')),'utf8');var _0x33d2c3=ejs[_0x0a57('0x59')](_0x1386a4,{'contexts':_0x172196});fs[_0x0a57('0x64')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x33d2c3);return respondWithRpcPromise(_0x0a57('0x63'),_0x0a57('0x2d'),{'module':'chan_sip.so'});})[_0x0a57('0x25')](handleError(_0x6a8ee7,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f479227..41d764c 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 _0xb77a=['./voiceContext.attributes','VoiceContext','voice_contexts','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5dbc86,_0xcdbb86){var _0x1f80e3=function(_0x13ce76){while(--_0x13ce76){_0x5dbc86['push'](_0x5dbc86['shift']());}};_0x1f80e3(++_0xcdbb86);}(_0xb77a,0x11b));var _0xab77=function(_0x1f7f4d,_0x287409){_0x1f7f4d=_0x1f7f4d-0x0;var _0x42f333=_0xb77a[_0x1f7f4d];return _0x42f333;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab77('0x0'))(_0xab77('0x1'));var moment=require(_0xab77('0x2'));var BPromise=require(_0xab77('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab77('0x4'));var rimraf=require(_0xab77('0x5'));var config=require(_0xab77('0x6'));var attributes=require(_0xab77('0x7'));module['exports']=function(_0x44497a,_0x1a7576){return _0x44497a['define'](_0xab77('0x8'),attributes,{'tableName':_0xab77('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3527=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3527,0x171));var _0x7352=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0x3527[_0x24f862];return _0x198aa4;};'use strict';var _=require(_0x7352('0x0'));var util=require('util');var logger=require(_0x7352('0x1'))(_0x7352('0x2'));var moment=require('moment');var BPromise=require(_0x7352('0x3'));var rp=require(_0x7352('0x4'));var fs=require('fs');var path=require(_0x7352('0x5'));var rimraf=require(_0x7352('0x6'));var config=require(_0x7352('0x7'));var attributes=require(_0x7352('0x8'));module[_0x7352('0x9')]=function(_0x311bd6,_0x1b95c4){return _0x311bd6[_0x7352('0xa')](_0x7352('0xb'),attributes,{'tableName':_0x7352('0xc'),'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 61ef37b..77f66c9 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 _0xc4e1=['client','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x11be52,_0x2ef4f4){var _0x5b0bf8=function(_0x3659b6){while(--_0x3659b6){_0x11be52['push'](_0x11be52['shift']());}};_0x5b0bf8(++_0x2ef4f4);}(_0xc4e1,0x172));var _0x1c4e=function(_0x637007,_0x24f1f6){_0x637007=_0x637007-0x0;var _0x44dc4f=_0xc4e1[_0x637007];return _0x44dc4f;};'use strict';var _=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var moment=require(_0x1c4e('0x2'));var BPromise=require(_0x1c4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c4e('0x5'));var logger=require('../../config/logger')(_0x1c4e('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c4e('0x7'));var client=jayson[_0x1c4e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45bef5,_0x351366,_0x523405){return new BPromise(function(_0xa423ce,_0x4b6c34){return client['request'](_0x45bef5,_0x523405)[_0x1c4e('0x9')](function(_0x4d97eb){logger[_0x1c4e('0xa')]('VoiceContext,\x20%s,\x20%s',_0x351366,_0x1c4e('0xb'));logger['debug'](_0x1c4e('0xc'),_0x351366,'request\x20sent',JSON['stringify'](_0x4d97eb));if(_0x4d97eb['error']){if(_0x4d97eb[_0x1c4e('0xd')][_0x1c4e('0xe')]===0x1f4){logger[_0x1c4e('0xd')]('VoiceContext,\x20%s,\x20%s',_0x351366,_0x4d97eb[_0x1c4e('0xd')][_0x1c4e('0xf')]);return _0x4b6c34(_0x4d97eb['error']['message']);}logger['error'](_0x1c4e('0x10'),_0x351366,_0x4d97eb[_0x1c4e('0xd')]['message']);return _0xa423ce(_0x4d97eb[_0x1c4e('0xd')][_0x1c4e('0xf')]);}else{logger[_0x1c4e('0xa')](_0x1c4e('0x10'),_0x351366,_0x1c4e('0xb'));_0xa423ce(_0x4d97eb['result'][_0x1c4e('0xf')]);}})[_0x1c4e('0x11')](function(_0x508224){logger['error']('VoiceContext,\x20%s,\x20%s',_0x351366,_0x508224);_0x4b6c34(_0x508224);});});} \ No newline at end of file +var _0x45eb=['stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0x45eb,0xc4));var _0xb45e=function(_0x11b752,_0x38232b){_0x11b752=_0x11b752-0x0;var _0x13d21c=_0x45eb[_0x11b752];return _0x13d21c;};'use strict';var _=require(_0xb45e('0x0'));var util=require(_0xb45e('0x1'));var moment=require(_0xb45e('0x2'));var BPromise=require(_0xb45e('0x3'));var rs=require(_0xb45e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb45e('0x5'))['db'];var utils=require(_0xb45e('0x6'));var logger=require(_0xb45e('0x7'))(_0xb45e('0x8'));var config=require(_0xb45e('0x9'));var jayson=require(_0xb45e('0xa'));var client=jayson[_0xb45e('0xb')][_0xb45e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3169fe,_0x30ba23,_0xa12282){return new BPromise(function(_0x1a6bd8,_0xd00a31){return client[_0xb45e('0xd')](_0x3169fe,_0xa12282)[_0xb45e('0xe')](function(_0x3be950){logger[_0xb45e('0xf')](_0xb45e('0x10'),_0x30ba23,_0xb45e('0x11'));logger[_0xb45e('0x12')](_0xb45e('0x13'),_0x30ba23,_0xb45e('0x11'),JSON[_0xb45e('0x14')](_0x3be950));if(_0x3be950[_0xb45e('0x15')]){if(_0x3be950[_0xb45e('0x15')]['code']===0x1f4){logger[_0xb45e('0x15')](_0xb45e('0x10'),_0x30ba23,_0x3be950[_0xb45e('0x15')][_0xb45e('0x16')]);return _0xd00a31(_0x3be950[_0xb45e('0x15')]['message']);}logger['error'](_0xb45e('0x10'),_0x30ba23,_0x3be950[_0xb45e('0x15')][_0xb45e('0x16')]);return _0x1a6bd8(_0x3be950[_0xb45e('0x15')][_0xb45e('0x16')]);}else{logger[_0xb45e('0xf')](_0xb45e('0x10'),_0x30ba23,_0xb45e('0x11'));_0x1a6bd8(_0x3be950['result'][_0xb45e('0x16')]);}})[_0xb45e('0x17')](function(_0x1deef4){logger[_0xb45e('0x15')]('VoiceContext,\x20%s,\x20%s',_0x30ba23,_0x1deef4);_0xd00a31(_0x1deef4);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b0e771c..072546e 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 _0x67eb=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x392212,_0xaecbe3){var _0x5ab162=function(_0x16c0c4){while(--_0x16c0c4){_0x392212['push'](_0x392212['shift']());}};_0x5ab162(++_0xaecbe3);}(_0x67eb,0x15b));var _0xb67e=function(_0x192cdd,_0x542e38){_0x192cdd=_0x192cdd-0x0;var _0x581f30=_0x67eb[_0x192cdd];return _0x581f30;};'use strict';var multer=require(_0xb67e('0x0'));var util=require(_0xb67e('0x1'));var path=require(_0xb67e('0x2'));var timeout=require(_0xb67e('0x3'));var express=require(_0xb67e('0x4'));var router=express[_0xb67e('0x5')]();var fs_extra=require(_0xb67e('0x6'));var auth=require(_0xb67e('0x7'));var interaction=require(_0xb67e('0x8'));var config=require(_0xb67e('0x9'));var controller=require(_0xb67e('0xa'));router[_0xb67e('0xb')]('/',auth[_0xb67e('0xc')](),controller[_0xb67e('0xd')]);router['get'](_0xb67e('0xe'),auth['isAuthenticated'](),controller[_0xb67e('0xf')]);router[_0xb67e('0xb')](_0xb67e('0x10'),auth[_0xb67e('0xc')](),controller[_0xb67e('0x11')]);router['post']('/',auth[_0xb67e('0xc')](),controller['create']);router['put'](_0xb67e('0x10'),auth['isAuthenticated'](),controller[_0xb67e('0x12')]);router[_0xb67e('0x13')](_0xb67e('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xb67e('0x14')]=router; \ No newline at end of file +var _0xf492=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','get','show','create','/:id','update','delete','destroy','exports','multer','path'];(function(_0xa1e9a7,_0xcc5475){var _0x3dad5b=function(_0x1ac81c){while(--_0x1ac81c){_0xa1e9a7['push'](_0xa1e9a7['shift']());}};_0x3dad5b(++_0xcc5475);}(_0xf492,0xb2));var _0x2f49=function(_0x50eded,_0x50d070){_0x50eded=_0x50eded-0x0;var _0x2ae369=_0xf492[_0x50eded];return _0x2ae369;};'use strict';var multer=require(_0x2f49('0x0'));var util=require('util');var path=require(_0x2f49('0x1'));var timeout=require(_0x2f49('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f49('0x3'));var auth=require(_0x2f49('0x4'));var interaction=require(_0x2f49('0x5'));var config=require(_0x2f49('0x6'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2f49('0x7')]);router['get'](_0x2f49('0x8'),auth[_0x2f49('0x9')](),controller['describe']);router[_0x2f49('0xa')]('/:id',auth[_0x2f49('0x9')](),controller[_0x2f49('0xb')]);router['post']('/',auth[_0x2f49('0x9')](),controller[_0x2f49('0xc')]);router['put'](_0x2f49('0xd'),auth[_0x2f49('0x9')](),controller[_0x2f49('0xe')]);router[_0x2f49('0xf')]('/:id',auth[_0x2f49('0x9')](),controller[_0x2f49('0x10')]);module[_0x2f49('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b9fcf74..c7413bc 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 _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x26f00b,_0x58ce7f){var _0x52fd1b=function(_0x340fed){while(--_0x340fed){_0x26f00b['push'](_0x26f00b['shift']());}};_0x52fd1b(++_0x58ce7f);}(_0x55ca,0x126));var _0xa55c=function(_0x263999,_0x477176){_0x263999=_0x263999-0x0;var _0x336996=_0x55ca[_0x263999];return _0x336996;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x125e9a,_0x599244){var _0x1e3060=function(_0x2e9a2e){while(--_0x2e9a2e){_0x125e9a['push'](_0x125e9a['shift']());}};_0x1e3060(++_0x599244);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x274e0e,_0x3aace4){_0x274e0e=_0x274e0e-0x0;var _0x4ca356=_0x6f0d[_0x274e0e];return _0x4ca356;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6de7d12..edb0b1f 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 _0xa468=['bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','offset','count','set','Content-Range','reject','save','then','destroy','stack','name','index','map','VoiceDialReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xae42fe,_0x4f483b){var _0x1c60c3=function(_0x3d00b9){while(--_0x3d00b9){_0xae42fe['push'](_0xae42fe['shift']());}};_0x1c60c3(++_0x4f483b);}(_0xa468,0x8f));var _0x8a46=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa468[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a46('0x0'));var zipdir=require(_0x8a46('0x1'));var jsonpatch=require(_0x8a46('0x2'));var rp=require(_0x8a46('0x3'));var moment=require(_0x8a46('0x4'));var BPromise=require(_0x8a46('0x5'));var Mustache=require('mustache');var util=require(_0x8a46('0x6'));var path=require(_0x8a46('0x7'));var sox=require(_0x8a46('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a46('0x9'));var _=require(_0x8a46('0xa'));var squel=require(_0x8a46('0xb'));var crypto=require(_0x8a46('0xc'));var jsforce=require(_0x8a46('0xd'));var deskjs=require(_0x8a46('0xe'));var toCsv=require(_0x8a46('0xf'));var querystring=require(_0x8a46('0x10'));var Papa=require('papaparse');var Redis=require(_0x8a46('0x11'));var authService=require(_0x8a46('0x12'));var qs=require(_0x8a46('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a46('0x14'));var logger=require('../../config/logger')(_0x8a46('0x15'));var utils=require(_0x8a46('0x16'));var config=require(_0x8a46('0x17'));var licenseUtil=require(_0x8a46('0x18'));var db=require(_0x8a46('0x19'))['db'];function respondWithStatusCode(_0x3c9861,_0x509f6e){_0x509f6e=_0x509f6e||0xcc;return function(_0x7b7df2){if(_0x7b7df2){return _0x3c9861[_0x8a46('0x1a')](_0x509f6e);}return _0x3c9861['status'](_0x509f6e)[_0x8a46('0x1b')]();};}function respondWithResult(_0x32436d,_0x3801bb){_0x3801bb=_0x3801bb||0xc8;return function(_0x503b95){if(_0x503b95){return _0x32436d[_0x8a46('0x1c')](_0x3801bb)['json'](_0x503b95);}};}function respondWithFilteredResult(_0x4900ed,_0x1a06f1){return function(_0x4d1cdd){if(_0x4d1cdd){var _0x4034ed=typeof _0x1a06f1['offset']===_0x8a46('0x1d')&&typeof _0x1a06f1['limit']===_0x8a46('0x1d');var _0x57217c=_0x4d1cdd['count'];var _0x3bb0aa=_0x4034ed?0x0:_0x1a06f1[_0x8a46('0x1e')];var _0x1c2517=_0x4034ed?_0x4d1cdd[_0x8a46('0x1f')]:_0x1a06f1[_0x8a46('0x1e')]+_0x1a06f1['limit'];var _0x1ff427;if(_0x1c2517>=_0x57217c){_0x1c2517=_0x57217c;_0x1ff427=0xc8;}else{_0x1ff427=0xce;}_0x4900ed['status'](_0x1ff427);return _0x4900ed[_0x8a46('0x20')](_0x8a46('0x21'),_0x3bb0aa+'-'+_0x1c2517+'/'+_0x57217c)['json'](_0x4d1cdd);}return null;};}function patchUpdates(_0x1ccf21){return function(_0x4bdf06){try{jsonpatch['apply'](_0x4bdf06,_0x1ccf21,!![]);}catch(_0x3475be){return BPromise[_0x8a46('0x22')](_0x3475be);}return _0x4bdf06[_0x8a46('0x23')]();};}function saveUpdates(_0x5df7d0,_0x1e6cfd){return function(_0x30b8de){if(_0x30b8de){return _0x30b8de['update'](_0x5df7d0)[_0x8a46('0x24')](function(_0x45e205){return _0x45e205;});}return null;};}function removeEntity(_0x35afe5,_0xfb3bad){return function(_0x2ac717){if(_0x2ac717){return _0x2ac717[_0x8a46('0x25')]()[_0x8a46('0x24')](function(){_0x35afe5[_0x8a46('0x1c')](0xcc)[_0x8a46('0x1b')]();});}};}function handleEntityNotFound(_0x5073f9,_0x1e471d){return function(_0x3bef16){if(!_0x3bef16){_0x5073f9['sendStatus'](0x194);}return _0x3bef16;};}function handleError(_0x4a9a8d,_0x1383c3){_0x1383c3=_0x1383c3||0x1f4;return function(_0x4d7b23){logger['error'](_0x4d7b23[_0x8a46('0x26')]);if(_0x4d7b23[_0x8a46('0x27')]){delete _0x4d7b23[_0x8a46('0x27')];}_0x4a9a8d[_0x8a46('0x1c')](_0x1383c3)['send'](_0x4d7b23);};}exports[_0x8a46('0x28')]=function(_0x426d73,_0x2da029){var _0x4b7124={},_0x2e7b28={},_0x47f1ec={'count':0x0,'rows':[]};var _0x597e9e=_[_0x8a46('0x29')](db[_0x8a46('0x2a')][_0x8a46('0x2b')],function(_0x221b62){return{'name':_0x221b62['fieldName'],'type':_0x221b62[_0x8a46('0x2c')][_0x8a46('0x2d')]};});_0x2e7b28[_0x8a46('0x2e')]=_['map'](_0x597e9e,'name');_0x2e7b28['query']=_[_0x8a46('0x2f')](_0x426d73[_0x8a46('0x30')]);_0x2e7b28[_0x8a46('0x31')]=_[_0x8a46('0x32')](_0x2e7b28[_0x8a46('0x2e')],_0x2e7b28['query']);_0x4b7124[_0x8a46('0x33')]=_['intersection'](_0x2e7b28['model'],qs['fields'](_0x426d73['query'][_0x8a46('0x34')]));_0x4b7124[_0x8a46('0x33')]=_0x4b7124[_0x8a46('0x33')][_0x8a46('0x35')]?_0x4b7124[_0x8a46('0x33')]:_0x2e7b28[_0x8a46('0x2e')];if(!_0x426d73[_0x8a46('0x30')][_0x8a46('0x36')](_0x8a46('0x37'))){_0x4b7124[_0x8a46('0x38')]=qs['limit'](_0x426d73['query'][_0x8a46('0x38')]);_0x4b7124['offset']=qs[_0x8a46('0x1e')](_0x426d73['query'][_0x8a46('0x1e')]);}_0x4b7124[_0x8a46('0x39')]=qs[_0x8a46('0x3a')](_0x426d73[_0x8a46('0x30')][_0x8a46('0x3a')]);_0x4b7124[_0x8a46('0x3b')]=qs[_0x8a46('0x31')](_[_0x8a46('0x3c')](_0x426d73['query'],_0x2e7b28['filters']),_0x597e9e);if(_0x426d73[_0x8a46('0x30')][_0x8a46('0x3d')]){_0x4b7124[_0x8a46('0x3b')]=_[_0x8a46('0x3e')](_0x4b7124[_0x8a46('0x3b')],{'$or':_[_0x8a46('0x29')](_0x597e9e,function(_0x53a364){if(_0x53a364['type']!=='VIRTUAL'){var _0x21596a={};_0x21596a[_0x53a364[_0x8a46('0x27')]]={'$like':'%'+_0x426d73[_0x8a46('0x30')][_0x8a46('0x3d')]+'%'};return _0x21596a;}})});}_0x4b7124=_[_0x8a46('0x3e')]({},_0x4b7124,_0x426d73[_0x8a46('0x3f')]);var _0x5e87d4={'where':_0x4b7124['where']};return db[_0x8a46('0x2a')][_0x8a46('0x1f')](_0x5e87d4)[_0x8a46('0x24')](function(_0x591f1a){_0x47f1ec['count']=_0x591f1a;if(_0x426d73['query'][_0x8a46('0x40')]){_0x4b7124[_0x8a46('0x41')]=[{'all':!![]}];}return db[_0x8a46('0x2a')]['findAll'](_0x4b7124);})[_0x8a46('0x24')](function(_0x4874e8){_0x47f1ec[_0x8a46('0x42')]=_0x4874e8;return _0x47f1ec;})['then'](respondWithFilteredResult(_0x2da029,_0x4b7124))['catch'](handleError(_0x2da029,null));};exports[_0x8a46('0x43')]=function(_0x2a4bf7,_0x37adfc){var _0x5f2d49={'raw':!![],'where':{'id':_0x2a4bf7[_0x8a46('0x44')]['id']}},_0x4e88ba={};_0x4e88ba['model']=_[_0x8a46('0x2f')](db['VoiceDialReport'][_0x8a46('0x2b')]);_0x4e88ba[_0x8a46('0x30')]=_[_0x8a46('0x2f')](_0x2a4bf7[_0x8a46('0x30')]);_0x4e88ba['filters']=_[_0x8a46('0x32')](_0x4e88ba[_0x8a46('0x2e')],_0x4e88ba[_0x8a46('0x30')]);_0x5f2d49[_0x8a46('0x33')]=_[_0x8a46('0x32')](_0x4e88ba[_0x8a46('0x2e')],qs[_0x8a46('0x34')](_0x2a4bf7['query']['fields']));_0x5f2d49[_0x8a46('0x33')]=_0x5f2d49[_0x8a46('0x33')][_0x8a46('0x35')]?_0x5f2d49['attributes']:_0x4e88ba[_0x8a46('0x2e')];if(_0x2a4bf7[_0x8a46('0x30')][_0x8a46('0x40')]){_0x5f2d49[_0x8a46('0x41')]=[{'all':!![]}];}_0x5f2d49=_['merge']({},_0x5f2d49,_0x2a4bf7[_0x8a46('0x3f')]);return db[_0x8a46('0x2a')][_0x8a46('0x45')](_0x5f2d49)[_0x8a46('0x24')](handleEntityNotFound(_0x37adfc,null))[_0x8a46('0x24')](respondWithResult(_0x37adfc,null))[_0x8a46('0x46')](handleError(_0x37adfc,null));};exports['create']=function(_0x4dbdef,_0x4a3c54){return db[_0x8a46('0x2a')][_0x8a46('0x47')](_0x4dbdef[_0x8a46('0x48')],{})[_0x8a46('0x24')](respondWithResult(_0x4a3c54,0xc9))[_0x8a46('0x46')](handleError(_0x4a3c54,null));};exports['update']=function(_0x485384,_0x1bdcbe){if(_0x485384[_0x8a46('0x48')]['id']){delete _0x485384[_0x8a46('0x48')]['id'];}return db[_0x8a46('0x2a')][_0x8a46('0x45')]({'where':{'id':_0x485384['params']['id']}})['then'](handleEntityNotFound(_0x1bdcbe,null))[_0x8a46('0x24')](saveUpdates(_0x485384[_0x8a46('0x48')],null))['then'](respondWithResult(_0x1bdcbe,null))[_0x8a46('0x46')](handleError(_0x1bdcbe,null));};exports[_0x8a46('0x25')]=function(_0x35f57c,_0x3576c1){return db[_0x8a46('0x2a')][_0x8a46('0x45')]({'where':{'id':_0x35f57c[_0x8a46('0x44')]['id']}})[_0x8a46('0x24')](handleEntityNotFound(_0x3576c1,null))[_0x8a46('0x24')](removeEntity(_0x3576c1,null))[_0x8a46('0x46')](handleError(_0x3576c1,null));};exports[_0x8a46('0x49')]=function(_0x561e42,_0x2280e1){return db['VoiceDialReport'][_0x8a46('0x49')]()[_0x8a46('0x24')](respondWithResult(_0x2280e1,null))[_0x8a46('0x46')](handleError(_0x2280e1,null));}; \ No newline at end of file +var _0x59b7=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body'];(function(_0x28c4db,_0x2ccd05){var _0x5907ed=function(_0x1d83c2){while(--_0x1d83c2){_0x28c4db['push'](_0x28c4db['shift']());}};_0x5907ed(++_0x2ccd05);}(_0x59b7,0x9c));var _0x759b=function(_0x12acf7,_0xfb9ba){_0x12acf7=_0x12acf7-0x0;var _0x11050c=_0x59b7[_0x12acf7];return _0x11050c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x759b('0x0'));var zipdir=require(_0x759b('0x1'));var jsonpatch=require(_0x759b('0x2'));var rp=require(_0x759b('0x3'));var moment=require(_0x759b('0x4'));var BPromise=require(_0x759b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x759b('0x6'));var sox=require('sox');var csv=require(_0x759b('0x7'));var ejs=require(_0x759b('0x8'));var fs=require('fs');var fs_extra=require(_0x759b('0x9'));var _=require(_0x759b('0xa'));var squel=require('squel');var crypto=require(_0x759b('0xb'));var jsforce=require(_0x759b('0xc'));var deskjs=require(_0x759b('0xd'));var toCsv=require(_0x759b('0x7'));var querystring=require(_0x759b('0xe'));var Papa=require(_0x759b('0xf'));var Redis=require(_0x759b('0x10'));var authService=require(_0x759b('0x11'));var qs=require(_0x759b('0x12'));var as=require(_0x759b('0x13'));var hardwareService=require(_0x759b('0x14'));var logger=require(_0x759b('0x15'))(_0x759b('0x16'));var utils=require(_0x759b('0x17'));var config=require(_0x759b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115b44,_0x4cb8f2){_0x4cb8f2=_0x4cb8f2||0xcc;return function(_0x4023ed){if(_0x4023ed){return _0x115b44[_0x759b('0x19')](_0x4cb8f2);}return _0x115b44['status'](_0x4cb8f2)[_0x759b('0x1a')]();};}function respondWithResult(_0x30754b,_0x22742e){_0x22742e=_0x22742e||0xc8;return function(_0x4b6b9b){if(_0x4b6b9b){return _0x30754b['status'](_0x22742e)[_0x759b('0x1b')](_0x4b6b9b);}};}function respondWithFilteredResult(_0x431ed5,_0x413244){return function(_0x25932c){if(_0x25932c){var _0xd4947f=typeof _0x413244[_0x759b('0x1c')]===_0x759b('0x1d')&&typeof _0x413244[_0x759b('0x1e')]===_0x759b('0x1d');var _0x127388=_0x25932c['count'];var _0x512915=_0xd4947f?0x0:_0x413244[_0x759b('0x1c')];var _0x54a80a=_0xd4947f?_0x25932c[_0x759b('0x1f')]:_0x413244[_0x759b('0x1c')]+_0x413244[_0x759b('0x1e')];var _0x1cab6d;if(_0x54a80a>=_0x127388){_0x54a80a=_0x127388;_0x1cab6d=0xc8;}else{_0x1cab6d=0xce;}_0x431ed5[_0x759b('0x20')](_0x1cab6d);return _0x431ed5[_0x759b('0x21')](_0x759b('0x22'),_0x512915+'-'+_0x54a80a+'/'+_0x127388)[_0x759b('0x1b')](_0x25932c);}return null;};}function patchUpdates(_0x12a600){return function(_0xa7504d){try{jsonpatch[_0x759b('0x23')](_0xa7504d,_0x12a600,!![]);}catch(_0x5c53f7){return BPromise[_0x759b('0x24')](_0x5c53f7);}return _0xa7504d[_0x759b('0x25')]();};}function saveUpdates(_0x558c64,_0x5075fa){return function(_0x21e24a){if(_0x21e24a){return _0x21e24a[_0x759b('0x26')](_0x558c64)[_0x759b('0x27')](function(_0x34f7e6){return _0x34f7e6;});}return null;};}function removeEntity(_0x5151cf,_0x2b9cf8){return function(_0x24725e){if(_0x24725e){return _0x24725e[_0x759b('0x28')]()[_0x759b('0x27')](function(){_0x5151cf[_0x759b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f0f1c,_0x3f1f37){return function(_0x2835fc){if(!_0x2835fc){_0x1f0f1c['sendStatus'](0x194);}return _0x2835fc;};}function handleError(_0x45ac69,_0x44f88a){_0x44f88a=_0x44f88a||0x1f4;return function(_0x12fc69){logger[_0x759b('0x29')](_0x12fc69['stack']);if(_0x12fc69[_0x759b('0x2a')]){delete _0x12fc69[_0x759b('0x2a')];}_0x45ac69[_0x759b('0x20')](_0x44f88a)[_0x759b('0x2b')](_0x12fc69);};}exports[_0x759b('0x2c')]=function(_0x3f2422,_0x4d8bf7){var _0x338778={},_0x128217={},_0x46a2c6={'count':0x0,'rows':[]};var _0x5b686e=_[_0x759b('0x2d')](db[_0x759b('0x2e')][_0x759b('0x2f')],function(_0x307ad1){return{'name':_0x307ad1[_0x759b('0x30')],'type':_0x307ad1[_0x759b('0x31')][_0x759b('0x32')]};});_0x128217[_0x759b('0x33')]=_[_0x759b('0x2d')](_0x5b686e,_0x759b('0x2a'));_0x128217[_0x759b('0x34')]=_['keys'](_0x3f2422['query']);_0x128217[_0x759b('0x35')]=_[_0x759b('0x36')](_0x128217['model'],_0x128217[_0x759b('0x34')]);_0x338778['attributes']=_[_0x759b('0x36')](_0x128217['model'],qs[_0x759b('0x37')](_0x3f2422[_0x759b('0x34')]['fields']));_0x338778[_0x759b('0x38')]=_0x338778['attributes']['length']?_0x338778[_0x759b('0x38')]:_0x128217[_0x759b('0x33')];if(!_0x3f2422['query'][_0x759b('0x39')](_0x759b('0x3a'))){_0x338778['limit']=qs[_0x759b('0x1e')](_0x3f2422[_0x759b('0x34')][_0x759b('0x1e')]);_0x338778[_0x759b('0x1c')]=qs[_0x759b('0x1c')](_0x3f2422[_0x759b('0x34')][_0x759b('0x1c')]);}_0x338778[_0x759b('0x3b')]=qs['sort'](_0x3f2422[_0x759b('0x34')][_0x759b('0x3c')]);_0x338778[_0x759b('0x3d')]=qs[_0x759b('0x35')](_[_0x759b('0x3e')](_0x3f2422['query'],_0x128217[_0x759b('0x35')]),_0x5b686e);if(_0x3f2422[_0x759b('0x34')][_0x759b('0x3f')]){_0x338778[_0x759b('0x3d')]=_['merge'](_0x338778[_0x759b('0x3d')],{'$or':_[_0x759b('0x2d')](_0x5b686e,function(_0x504517){if(_0x504517['type']!==_0x759b('0x40')){var _0x300145={};_0x300145[_0x504517[_0x759b('0x2a')]]={'$like':'%'+_0x3f2422[_0x759b('0x34')]['filter']+'%'};return _0x300145;}})});}_0x338778=_[_0x759b('0x41')]({},_0x338778,_0x3f2422[_0x759b('0x42')]);var _0xbbb025={'where':_0x338778[_0x759b('0x3d')]};return db[_0x759b('0x2e')]['count'](_0xbbb025)[_0x759b('0x27')](function(_0x54e22d){_0x46a2c6['count']=_0x54e22d;if(_0x3f2422['query'][_0x759b('0x43')]){_0x338778[_0x759b('0x44')]=[{'all':!![]}];}return db[_0x759b('0x2e')]['findAll'](_0x338778);})['then'](function(_0x49bda8){_0x46a2c6[_0x759b('0x45')]=_0x49bda8;return _0x46a2c6;})[_0x759b('0x27')](respondWithFilteredResult(_0x4d8bf7,_0x338778))[_0x759b('0x46')](handleError(_0x4d8bf7,null));};exports[_0x759b('0x47')]=function(_0x27692d,_0x28ae83){var _0x4e4995={'raw':!![],'where':{'id':_0x27692d[_0x759b('0x48')]['id']}},_0x43007e={};_0x43007e[_0x759b('0x33')]=_['keys'](db['VoiceDialReport'][_0x759b('0x2f')]);_0x43007e[_0x759b('0x34')]=_[_0x759b('0x49')](_0x27692d[_0x759b('0x34')]);_0x43007e[_0x759b('0x35')]=_['intersection'](_0x43007e[_0x759b('0x33')],_0x43007e[_0x759b('0x34')]);_0x4e4995[_0x759b('0x38')]=_[_0x759b('0x36')](_0x43007e['model'],qs[_0x759b('0x37')](_0x27692d[_0x759b('0x34')]['fields']));_0x4e4995[_0x759b('0x38')]=_0x4e4995[_0x759b('0x38')][_0x759b('0x4a')]?_0x4e4995[_0x759b('0x38')]:_0x43007e['model'];if(_0x27692d['query']['includeAll']){_0x4e4995[_0x759b('0x44')]=[{'all':!![]}];}_0x4e4995=_[_0x759b('0x41')]({},_0x4e4995,_0x27692d[_0x759b('0x42')]);return db['VoiceDialReport'][_0x759b('0x4b')](_0x4e4995)['then'](handleEntityNotFound(_0x28ae83,null))['then'](respondWithResult(_0x28ae83,null))['catch'](handleError(_0x28ae83,null));};exports[_0x759b('0x4c')]=function(_0x29cd3d,_0x427637){return db[_0x759b('0x2e')][_0x759b('0x4c')](_0x29cd3d[_0x759b('0x4d')],{})['then'](respondWithResult(_0x427637,0xc9))['catch'](handleError(_0x427637,null));};exports[_0x759b('0x26')]=function(_0x52afa3,_0x3b7802){if(_0x52afa3['body']['id']){delete _0x52afa3[_0x759b('0x4d')]['id'];}return db['VoiceDialReport'][_0x759b('0x4b')]({'where':{'id':_0x52afa3[_0x759b('0x48')]['id']}})[_0x759b('0x27')](handleEntityNotFound(_0x3b7802,null))['then'](saveUpdates(_0x52afa3[_0x759b('0x4d')],null))[_0x759b('0x27')](respondWithResult(_0x3b7802,null))[_0x759b('0x46')](handleError(_0x3b7802,null));};exports[_0x759b('0x28')]=function(_0x472a42,_0x3a2d1f){return db[_0x759b('0x2e')][_0x759b('0x4b')]({'where':{'id':_0x472a42[_0x759b('0x48')]['id']}})[_0x759b('0x27')](handleEntityNotFound(_0x3a2d1f,null))[_0x759b('0x27')](removeEntity(_0x3a2d1f,null))[_0x759b('0x46')](handleError(_0x3a2d1f,null));};exports['describe']=function(_0x528840,_0xbf05bb){return db[_0x759b('0x2e')]['describe']()[_0x759b('0x27')](respondWithResult(_0xbf05bb,null))[_0x759b('0x46')](handleError(_0xbf05bb,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 68adcc5..236ee56 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 _0x0bb2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x0bb2,0x179));var _0x20bb=function(_0x3c714f,_0x49a110){_0x3c714f=_0x3c714f-0x0;var _0x224511=_0x0bb2[_0x3c714f];return _0x224511;};'use strict';var _=require('lodash');var util=require(_0x20bb('0x0'));var logger=require(_0x20bb('0x1'))(_0x20bb('0x2'));var moment=require(_0x20bb('0x3'));var BPromise=require(_0x20bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20bb('0x5'));var rimraf=require(_0x20bb('0x6'));var config=require(_0x20bb('0x7'));var attributes=require(_0x20bb('0x8'));module[_0x20bb('0x9')]=function(_0x53ff29,_0x11baf2){return _0x53ff29[_0x20bb('0xa')](_0x20bb('0xb'),attributes,{'tableName':_0x20bb('0xc'),'paranoid':![],'indexes':[{'fields':[_0x20bb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea81=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea81,0x1ed));var _0x1ea8=function(_0x26a095,_0x111586){_0x26a095=_0x26a095-0x0;var _0x26aa37=_0xea81[_0x26a095];return _0x26aa37;};'use strict';var _=require(_0x1ea8('0x0'));var util=require(_0x1ea8('0x1'));var logger=require(_0x1ea8('0x2'))(_0x1ea8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ea8('0x4'));var fs=require('fs');var path=require(_0x1ea8('0x5'));var rimraf=require(_0x1ea8('0x6'));var config=require(_0x1ea8('0x7'));var attributes=require(_0x1ea8('0x8'));module['exports']=function(_0x486b32,_0x5f4538){return _0x486b32[_0x1ea8('0x9')](_0x1ea8('0xa'),attributes,{'tableName':_0x1ea8('0xb'),'paranoid':![],'indexes':[{'fields':[_0x1ea8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0e02804..88a7da2 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 _0xe509=['result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','debug','body','attributes','limit','UpdateVoiceDialReport','catch','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','request\x20sent'];(function(_0x2465a9,_0x1dfc9a){var _0x2cf946=function(_0x1eefe5){while(--_0x1eefe5){_0x2465a9['push'](_0x2465a9['shift']());}};_0x2cf946(++_0x1dfc9a);}(_0xe509,0x84));var _0x9e50=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xe509[_0x1f71d8];return _0x10b045;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9e50('0x0'));var BPromise=require(_0x9e50('0x1'));var rs=require(_0x9e50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e50('0x3'));var logger=require('../../config/logger')(_0x9e50('0x4'));var config=require(_0x9e50('0x5'));var jayson=require(_0x9e50('0x6'));var client=jayson[_0x9e50('0x7')][_0x9e50('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29fbe1,_0x41226f,_0x1549ea){return new BPromise(function(_0x1a76bb,_0x4dbe2a){return client[_0x9e50('0x9')](_0x29fbe1,_0x1549ea)[_0x9e50('0xa')](function(_0x1b460f){logger[_0x9e50('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x41226f,'request\x20sent');logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x41226f,'request\x20sent',JSON[_0x9e50('0xc')](_0x1b460f));if(_0x1b460f[_0x9e50('0xd')]){if(_0x1b460f[_0x9e50('0xd')][_0x9e50('0xe')]===0x1f4){logger['error'](_0x9e50('0xf'),_0x41226f,_0x1b460f[_0x9e50('0xd')][_0x9e50('0x10')]);return _0x4dbe2a(_0x1b460f['error']['message']);}logger[_0x9e50('0xd')](_0x9e50('0xf'),_0x41226f,_0x1b460f[_0x9e50('0xd')][_0x9e50('0x10')]);return _0x1a76bb(_0x1b460f[_0x9e50('0xd')][_0x9e50('0x10')]);}else{logger[_0x9e50('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x41226f,_0x9e50('0x11'));_0x1a76bb(_0x1b460f[_0x9e50('0x12')][_0x9e50('0x10')]);}})['catch'](function(_0x17949d){logger[_0x9e50('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x41226f,_0x17949d);_0x4dbe2a(_0x17949d);});});}exports[_0x9e50('0x13')]=function(_0x844455){var _0x2ac64d=this;return new Promise(function(_0x44d091,_0x249865){return db[_0x9e50('0x14')][_0x9e50('0x15')](_0x844455['body'],{'raw':_0x844455['options']?_0x844455[_0x9e50('0x16')][_0x9e50('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x192b22){logger['info']('CreateVoiceDialReport',_0x844455);logger[_0x9e50('0x18')](_0x9e50('0x13'),_0x844455,JSON['stringify'](_0x192b22));_0x44d091(_0x192b22);})['catch'](function(_0x5c6af6){logger['error'](_0x9e50('0x13'),_0x5c6af6[_0x9e50('0x10')],_0x844455);_0x249865(_0x2ac64d[_0x9e50('0xd')](0x1f4,_0x5c6af6[_0x9e50('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x112db6){var _0x489821=this;return new Promise(function(_0xd53753,_0x14b386){return db[_0x9e50('0x14')]['update'](_0x112db6[_0x9e50('0x19')],{'raw':_0x112db6[_0x9e50('0x16')]?_0x112db6[_0x9e50('0x16')][_0x9e50('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x112db6[_0x9e50('0x16')]?_0x112db6['options']['where']||null:null,'attributes':_0x112db6[_0x9e50('0x16')]?_0x112db6[_0x9e50('0x16')][_0x9e50('0x1a')]||null:null,'limit':_0x112db6[_0x9e50('0x16')]?_0x112db6['options'][_0x9e50('0x1b')]||null:null})['then'](function(_0xab5407){logger[_0x9e50('0xb')](_0x9e50('0x1c'),_0x112db6);logger[_0x9e50('0x18')]('UpdateVoiceDialReport',_0x112db6,JSON[_0x9e50('0xc')](_0xab5407));_0xd53753(_0xab5407);})[_0x9e50('0x1d')](function(_0x14ccfb){logger[_0x9e50('0xd')]('UpdateVoiceDialReport',_0x14ccfb['message'],_0x112db6);_0x14b386(_0x489821[_0x9e50('0xd')](0x1f4,_0x14ccfb[_0x9e50('0x10')]));});});}; \ No newline at end of file +var _0x1cb6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash'];(function(_0x2eaec2,_0x3743d9){var _0x238e19=function(_0x3989bb){while(--_0x3989bb){_0x2eaec2['push'](_0x2eaec2['shift']());}};_0x238e19(++_0x3743d9);}(_0x1cb6,0xff));var _0x61cb=function(_0x3927cd,_0x2fbd20){_0x3927cd=_0x3927cd-0x0;var _0x22e966=_0x1cb6[_0x3927cd];return _0x22e966;};'use strict';var _=require(_0x61cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x61cb('0x1'));var rs=require(_0x61cb('0x2'));var fs=require('fs');var Redis=require(_0x61cb('0x3'));var db=require(_0x61cb('0x4'))['db'];var utils=require(_0x61cb('0x5'));var logger=require(_0x61cb('0x6'))(_0x61cb('0x7'));var config=require('../../config/environment');var jayson=require(_0x61cb('0x8'));var client=jayson[_0x61cb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26bc53,_0xe59def,_0x4deebb){return new BPromise(function(_0x35b5be,_0x108425){return client[_0x61cb('0xa')](_0x26bc53,_0x4deebb)[_0x61cb('0xb')](function(_0x22c204){logger[_0x61cb('0xc')](_0x61cb('0xd'),_0xe59def,_0x61cb('0xe'));logger[_0x61cb('0xf')](_0x61cb('0x10'),_0xe59def,_0x61cb('0xe'),JSON[_0x61cb('0x11')](_0x22c204));if(_0x22c204[_0x61cb('0x12')]){if(_0x22c204[_0x61cb('0x12')]['code']===0x1f4){logger[_0x61cb('0x12')](_0x61cb('0xd'),_0xe59def,_0x22c204[_0x61cb('0x12')]['message']);return _0x108425(_0x22c204['error'][_0x61cb('0x13')]);}logger[_0x61cb('0x12')](_0x61cb('0xd'),_0xe59def,_0x22c204['error'][_0x61cb('0x13')]);return _0x35b5be(_0x22c204[_0x61cb('0x12')][_0x61cb('0x13')]);}else{logger[_0x61cb('0xc')](_0x61cb('0xd'),_0xe59def,'request\x20sent');_0x35b5be(_0x22c204[_0x61cb('0x14')][_0x61cb('0x13')]);}})['catch'](function(_0xc123a4){logger[_0x61cb('0x12')](_0x61cb('0xd'),_0xe59def,_0xc123a4);_0x108425(_0xc123a4);});});}exports[_0x61cb('0x15')]=function(_0x1f04d5){var _0x23aa4f=this;return new Promise(function(_0x54ba84,_0x4e1eea){return db['VoiceDialReport'][_0x61cb('0x16')](_0x1f04d5[_0x61cb('0x17')],{'raw':_0x1f04d5[_0x61cb('0x18')]?_0x1f04d5[_0x61cb('0x18')][_0x61cb('0x19')]===undefined?!![]:![]:!![]})[_0x61cb('0xb')](function(_0x17a643){logger[_0x61cb('0xc')]('CreateVoiceDialReport',_0x1f04d5);logger[_0x61cb('0xf')](_0x61cb('0x15'),_0x1f04d5,JSON['stringify'](_0x17a643));_0x54ba84(_0x17a643);})[_0x61cb('0x1a')](function(_0x5cdc49){logger[_0x61cb('0x12')](_0x61cb('0x15'),_0x5cdc49[_0x61cb('0x13')],_0x1f04d5);_0x4e1eea(_0x23aa4f['error'](0x1f4,_0x5cdc49[_0x61cb('0x13')]));});});};exports[_0x61cb('0x1b')]=function(_0x2dc7f0){var _0x48d59a=this;return new Promise(function(_0x362113,_0x5b7cc6){return db['VoiceDialReport'][_0x61cb('0x1c')](_0x2dc7f0['body'],{'raw':_0x2dc7f0[_0x61cb('0x18')]?_0x2dc7f0[_0x61cb('0x18')][_0x61cb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dc7f0[_0x61cb('0x18')]?_0x2dc7f0['options'][_0x61cb('0x1d')]||null:null,'attributes':_0x2dc7f0['options']?_0x2dc7f0[_0x61cb('0x18')][_0x61cb('0x1e')]||null:null,'limit':_0x2dc7f0[_0x61cb('0x18')]?_0x2dc7f0[_0x61cb('0x18')][_0x61cb('0x1f')]||null:null})['then'](function(_0x31da53){logger[_0x61cb('0xc')](_0x61cb('0x1b'),_0x2dc7f0);logger['debug'](_0x61cb('0x1b'),_0x2dc7f0,JSON[_0x61cb('0x11')](_0x31da53));_0x362113(_0x31da53);})[_0x61cb('0x1a')](function(_0x2dbd01){logger[_0x61cb('0x12')](_0x61cb('0x1b'),_0x2dbd01['message'],_0x2dc7f0);_0x5b7cc6(_0x48d59a[_0x61cb('0x12')](0x1f4,_0x2dbd01[_0x61cb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 993aea9..590d41b 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 _0xe7bf=['fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','show','post','create','/:id/applications','addApplications','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7bf,0xab));var _0xfe7b=function(_0x393cc6,_0x5b290f){_0x393cc6=_0x393cc6-0x0;var _0x184656=_0xe7bf[_0x393cc6];return _0x184656;};'use strict';var multer=require('multer');var util=require(_0xfe7b('0x0'));var path=require(_0xfe7b('0x1'));var timeout=require(_0xfe7b('0x2'));var express=require(_0xfe7b('0x3'));var router=express[_0xfe7b('0x4')]();var fs_extra=require(_0xfe7b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfe7b('0x6'));var config=require(_0xfe7b('0x7'));var controller=require(_0xfe7b('0x8'));router[_0xfe7b('0x9')]('/',auth[_0xfe7b('0xa')](),controller['index']);router[_0xfe7b('0x9')]('/:id',auth[_0xfe7b('0xa')](),controller[_0xfe7b('0xb')]);router[_0xfe7b('0xc')]('/',auth[_0xfe7b('0xa')](),controller[_0xfe7b('0xd')]);router[_0xfe7b('0xc')](_0xfe7b('0xe'),auth[_0xfe7b('0xa')](),controller[_0xfe7b('0xf')]);router[_0xfe7b('0x10')](_0xfe7b('0x11'),auth[_0xfe7b('0xa')](),controller[_0xfe7b('0x12')]);router[_0xfe7b('0x13')](_0xfe7b('0x11'),auth[_0xfe7b('0xa')](),controller[_0xfe7b('0x14')]);module[_0xfe7b('0x15')]=router; \ No newline at end of file +var _0x7073=['index','/:id','show','post','create','/:id/applications','addApplications','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated'];(function(_0x2a715c,_0x5119e5){var _0x13761b=function(_0x93ca17){while(--_0x93ca17){_0x2a715c['push'](_0x2a715c['shift']());}};_0x13761b(++_0x5119e5);}(_0x7073,0x184));var _0x3707=function(_0xae763f,_0x393ad7){_0xae763f=_0xae763f-0x0;var _0x5f10e0=_0x7073[_0xae763f];return _0x5f10e0;};'use strict';var multer=require(_0x3707('0x0'));var util=require(_0x3707('0x1'));var path=require(_0x3707('0x2'));var timeout=require(_0x3707('0x3'));var express=require(_0x3707('0x4'));var router=express[_0x3707('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3707('0x6'));var interaction=require(_0x3707('0x7'));var config=require('../../config/environment');var controller=require(_0x3707('0x8'));router[_0x3707('0x9')]('/',auth[_0x3707('0xa')](),controller[_0x3707('0xb')]);router['get'](_0x3707('0xc'),auth[_0x3707('0xa')](),controller[_0x3707('0xd')]);router[_0x3707('0xe')]('/',auth[_0x3707('0xa')](),controller[_0x3707('0xf')]);router[_0x3707('0xe')](_0x3707('0x10'),auth[_0x3707('0xa')](),controller[_0x3707('0x11')]);router['put'](_0x3707('0xc'),auth[_0x3707('0xa')](),controller[_0x3707('0x12')]);router['delete'](_0x3707('0xc'),auth[_0x3707('0xa')](),controller[_0x3707('0x13')]);module[_0x3707('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 82b644f..65fe46d 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 _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0xd8b0=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d8b('0x2')},'priority':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0d8b('0x2')},'tag':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0d8b('0x4')](_0x0d8b('0x5'),_0x0d8b('0x6'),'internal',_0x0d8b('0x7'),_0x0d8b('0x8'),'system',_0x0d8b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0d8b('0x3')]},'interval':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':_0x0d8b('0xa')},'IntervalId':{'type':Sequelize[_0x0d8b('0xb')]},'isApp':{'type':Sequelize[_0x0d8b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d8b('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0xd')},'answer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 1a81ce1..ca37857 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 _0xe1ce=['Content-Range','json','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','ignore','map','value','type','find','name','UserProfileResource','then','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','rows','catch','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','ISOLATION_LEVELS','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','limit','undefined','count','offset'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0xe1ce,0xf5));var _0xee1c=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xe1ce[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0xee1c('0x0'));var Redis=require(_0xee1c('0x1'));var qs=require(_0xee1c('0x2'));var logger=require(_0xee1c('0x3'))(_0xee1c('0x4'));var config=require(_0xee1c('0x5'));var db=require('../../mysqldb')['db'];config[_0xee1c('0x6')]=_[_0xee1c('0x7')](config['redis'],{'host':_0xee1c('0x8'),'port':0x18eb});var socket=require(_0xee1c('0x9'))(new Redis(config['redis']));require(_0xee1c('0xa'))[_0xee1c('0xb')](socket);function respondWithStatusCode(_0x24c2b1,_0x13d571){_0x13d571=_0x13d571||0xcc;return function(_0x24dd86){if(_0x24dd86){return _0x24c2b1[_0xee1c('0xc')](_0x13d571);}return _0x24c2b1[_0xee1c('0xd')](_0x13d571)[_0xee1c('0xe')]();};}function respondWithResult(_0x3820af,_0x4dd04c){_0x4dd04c=_0x4dd04c||0xc8;return function(_0x27ed01){if(_0x27ed01){return _0x3820af[_0xee1c('0xd')](_0x4dd04c)['json'](_0x27ed01);}};}function respondWithFilteredResult(_0x1a4de6,_0x31cc53){return function(_0x570604){if(_0x570604){var _0x344806=typeof _0x31cc53['offset']==='undefined'&&typeof _0x31cc53[_0xee1c('0xf')]===_0xee1c('0x10');var _0x506f74=_0x570604[_0xee1c('0x11')];var _0x3dcb97=_0x344806?0x0:_0x31cc53[_0xee1c('0x12')];var _0x9f0141=_0x344806?_0x570604['count']:_0x31cc53[_0xee1c('0x12')]+_0x31cc53[_0xee1c('0xf')];var _0x3846fa;if(_0x9f0141>=_0x506f74){_0x9f0141=_0x506f74;_0x3846fa=0xc8;}else{_0x3846fa=0xce;}_0x1a4de6[_0xee1c('0xd')](_0x3846fa);return _0x1a4de6['set'](_0xee1c('0x13'),_0x3dcb97+'-'+_0x9f0141+'/'+_0x506f74)[_0xee1c('0x14')](_0x570604);}return null;};}function removeEntity(_0x4709ed){return function(_0x49ce22){if(_0x49ce22){return _0x49ce22[_0xee1c('0x15')]()['then'](function(){var _0x5c2d21=_0x49ce22[_0xee1c('0x16')]({'plain':!![]});var _0x2650da=[{'name':_0xee1c('0x17'),'value':_0xee1c('0x18'),'ignore':![]},{'name':_0xee1c('0x19'),'value':_0xee1c('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':_0xee1c('0x1b'),'ignore':![]}];var _0x484ec1=_(_0x2650da)['filter'](_0xee1c('0x1c'))[_0xee1c('0x1d')](_0xee1c('0x1e'))['value']();if(_['includes'](_0x484ec1,_0x5c2d21[_0xee1c('0x1f')])){return;}var _0x28d380=_[_0xee1c('0x20')](_0x2650da,[_0xee1c('0x1e'),_0x5c2d21[_0xee1c('0x1f')]])[_0xee1c('0x21')];return db[_0xee1c('0x22')][_0xee1c('0x15')]({'where':{'type':_0x28d380,'resourceId':_0x5c2d21['id']}})[_0xee1c('0x23')](function(){return _0x49ce22;});})[_0xee1c('0x23')](function(){_0x4709ed[_0xee1c('0xd')](0xcc)[_0xee1c('0xe')]();});}};}function handleEntityNotFound(_0x5e3807){return function(_0x128bef){if(!_0x128bef){_0x5e3807[_0xee1c('0xc')](0x194);}return _0x128bef;};}function handleError(_0x44ad7d,_0x3adde9){_0x3adde9=_0x3adde9||0x1f4;return function(_0x1e8b4d){logger['error'](_0x1e8b4d['stack']);if(_0x1e8b4d[_0xee1c('0x21')]){delete _0x1e8b4d[_0xee1c('0x21')];}_0x44ad7d[_0xee1c('0xd')](_0x3adde9)['send'](_0x1e8b4d);};}exports[_0xee1c('0x24')]=function(_0x296919,_0x3970f5){var _0x28d393={},_0x585a3c={},_0x3c97c2={'count':0x0,'rows':[]};var _0x4d47aa=_[_0xee1c('0x1d')](db[_0xee1c('0x25')][_0xee1c('0x26')],function(_0x50d570){return{'name':_0x50d570['fieldName'],'type':_0x50d570[_0xee1c('0x1f')][_0xee1c('0x27')]};});_0x585a3c[_0xee1c('0x28')]=_[_0xee1c('0x1d')](_0x4d47aa,_0xee1c('0x21'));_0x585a3c[_0xee1c('0x29')]=_[_0xee1c('0x2a')](_0x296919[_0xee1c('0x29')]);_0x585a3c[_0xee1c('0x2b')]=_[_0xee1c('0x2c')](_0x585a3c[_0xee1c('0x28')],_0x585a3c[_0xee1c('0x29')]);_0x28d393[_0xee1c('0x2d')]=_[_0xee1c('0x2c')](_0x585a3c[_0xee1c('0x28')],qs[_0xee1c('0x2e')](_0x296919[_0xee1c('0x29')][_0xee1c('0x2e')]));_0x28d393[_0xee1c('0x2d')]=_0x28d393[_0xee1c('0x2d')][_0xee1c('0x2f')]?_0x28d393['attributes']:_0x585a3c[_0xee1c('0x28')];if(!_0x296919['query'][_0xee1c('0x30')](_0xee1c('0x31'))){_0x28d393['limit']=qs[_0xee1c('0xf')](_0x296919[_0xee1c('0x29')][_0xee1c('0xf')]);_0x28d393[_0xee1c('0x12')]=qs[_0xee1c('0x12')](_0x296919[_0xee1c('0x29')][_0xee1c('0x12')]);}_0x28d393[_0xee1c('0x32')]=qs[_0xee1c('0x33')](_0x296919[_0xee1c('0x29')][_0xee1c('0x33')]);_0x28d393['where']=qs[_0xee1c('0x2b')](_[_0xee1c('0x34')](_0x296919['query'],_0x585a3c['filters']),_0x4d47aa);if(_0x296919['query'][_0xee1c('0x35')]){_0x28d393['where']=_[_0xee1c('0x36')](_0x28d393[_0xee1c('0x37')],{'$or':_[_0xee1c('0x1d')](_0x4d47aa,function(_0x986b10){if(_0x986b10[_0xee1c('0x1f')]!=='VIRTUAL'){var _0x1a7bfc={};_0x1a7bfc[_0x986b10[_0xee1c('0x21')]]={'$like':'%'+_0x296919[_0xee1c('0x29')][_0xee1c('0x35')]+'%'};return _0x1a7bfc;}})});}_0x28d393=_[_0xee1c('0x36')]({},_0x28d393,_0x296919[_0xee1c('0x38')]);var _0xd309b8={'where':_0x28d393['where']};return db[_0xee1c('0x25')]['count'](_0xd309b8)[_0xee1c('0x23')](function(_0x39d936){_0x3c97c2[_0xee1c('0x11')]=_0x39d936;if(_0x296919[_0xee1c('0x29')][_0xee1c('0x39')]){_0x28d393[_0xee1c('0x3a')]=[{'all':!![]}];}return db[_0xee1c('0x25')]['findAll'](_0x28d393);})['then'](function(_0x4f23af){_0x3c97c2[_0xee1c('0x3b')]=_0x4f23af;return _0x3c97c2;})[_0xee1c('0x23')](respondWithFilteredResult(_0x3970f5,_0x28d393))[_0xee1c('0x3c')](handleError(_0x3970f5,null));};exports['show']=function(_0x4cd5cb,_0x2b17a0){var _0x53409c={'raw':![],'where':{'id':_0x4cd5cb[_0xee1c('0x3d')]['id']}},_0x19d261={};_0x19d261[_0xee1c('0x28')]=_[_0xee1c('0x2a')](db[_0xee1c('0x25')][_0xee1c('0x26')]);_0x19d261['query']=_['keys'](_0x4cd5cb[_0xee1c('0x29')]);_0x19d261['filters']=_[_0xee1c('0x2c')](_0x19d261[_0xee1c('0x28')],_0x19d261['query']);_0x53409c[_0xee1c('0x2d')]=_[_0xee1c('0x2c')](_0x19d261[_0xee1c('0x28')],qs[_0xee1c('0x2e')](_0x4cd5cb[_0xee1c('0x29')][_0xee1c('0x2e')]));_0x53409c[_0xee1c('0x2d')]=_0x53409c[_0xee1c('0x2d')]['length']?_0x53409c['attributes']:_0x19d261[_0xee1c('0x28')];if(_0x4cd5cb['query'][_0xee1c('0x39')]){_0x53409c[_0xee1c('0x3a')]=[{'all':!![]}];}_0x53409c=_[_0xee1c('0x36')]({},_0x53409c,_0x4cd5cb['options']);return db[_0xee1c('0x25')][_0xee1c('0x20')](_0x53409c)[_0xee1c('0x23')](handleEntityNotFound(_0x2b17a0,null))[_0xee1c('0x23')](respondWithResult(_0x2b17a0,null))[_0xee1c('0x3c')](handleError(_0x2b17a0,null));};exports[_0xee1c('0x15')]=function(_0x55702f,_0x18a930){return db['VoiceExtension'][_0xee1c('0x20')]({'where':{'id':_0x55702f['params']['id']}})[_0xee1c('0x23')](handleEntityNotFound(_0x18a930,null))[_0xee1c('0x23')](removeEntity(_0x18a930,null))['catch'](handleError(_0x18a930,null));};exports[_0xee1c('0x3e')]=function(_0x131674,_0xfb58f1){if(_0x131674[_0xee1c('0x3f')][_0xee1c('0x1f')]===_0xee1c('0x1a')&&!_[_0xee1c('0x40')](_0x131674[_0xee1c('0x3f')][_0xee1c('0x41')],'_')){_0x131674['body'][_0xee1c('0x41')]='_'[_0xee1c('0x42')](_0x131674[_0xee1c('0x3f')][_0xee1c('0x41')]);}return db[_0xee1c('0x25')]['create'](_0x131674[_0xee1c('0x3f')],{'raw':![]})[_0xee1c('0x23')](function(_0xcb8329){var _0x24a1fd=_0x131674[_0xee1c('0x43')]['get']({'plain':!![]});if(!_0x24a1fd)throw new Error(_0xee1c('0x44'));if(_0x24a1fd[_0xee1c('0x45')]===_0xee1c('0x43')){var _0x14edbc=_0xcb8329[_0xee1c('0x16')]({'plain':!![]});var _0x2d767c=[{'name':'InboundRoutes','value':_0xee1c('0x18')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0xee1c('0x1b')}];var _0x554514=_[_0xee1c('0x20')](_0x2d767c,[_0xee1c('0x1e'),_0x14edbc[_0xee1c('0x1f')]])[_0xee1c('0x21')];return db[_0xee1c('0x46')]['find']({'where':{'name':_0x554514,'userProfileId':_0x24a1fd[_0xee1c('0x47')]},'raw':!![]})['then'](function(_0x1bd9de){if(_0x1bd9de&&_0x1bd9de['autoAssociation']===0x0){return db[_0xee1c('0x22')][_0xee1c('0x3e')]({'name':_0x14edbc[_0xee1c('0x21')],'resourceId':_0x14edbc['id'],'type':_0x1bd9de[_0xee1c('0x21')],'sectionId':_0x1bd9de['id']},{})[_0xee1c('0x23')](function(){return _0xcb8329;});}else{return _0xcb8329;}})[_0xee1c('0x3c')](function(_0x1ce263){logger['error'](_0xee1c('0x48'),_0x1ce263);throw _0x1ce263;});}return _0xcb8329;})[_0xee1c('0x23')](respondWithResult(_0xfb58f1,0xc9))[_0xee1c('0x3c')](handleError(_0xfb58f1,null));};exports['update']=function(_0x456299,_0x223d48){if(_0x456299[_0xee1c('0x3f')]['id']){delete _0x456299[_0xee1c('0x3f')]['id'];}return db[_0xee1c('0x25')][_0xee1c('0x20')]({'where':{'id':_0x456299[_0xee1c('0x3d')]['id']}})[_0xee1c('0x23')](handleEntityNotFound(_0x223d48,null))[_0xee1c('0x23')](function(_0x59951a){if(_0x59951a){return db[_0xee1c('0x25')]['update'](_[_0xee1c('0x34')](_0x456299['body'],['exten',_0xee1c('0x49'),'description',_0xee1c('0x4a'),_0xee1c('0x4b'),_0xee1c('0x4c'),_0xee1c('0x4d')]),{'where':{'context':_0x59951a['context'],'exten':_0x59951a[_0xee1c('0x41')]},'individualHooks':!![]})['then'](function(_0x5017ca){return _0x5017ca;});}return null;})[_0xee1c('0x23')](respondWithStatusCode(_0x223d48,null))['catch'](handleError(_0x223d48,null));};exports[_0xee1c('0x4e')]=function(_0x47fa41,_0x81f257){var _0x598558=_0x47fa41['params']['id'];var _0x22e3b2=_0x47fa41[_0xee1c('0x3f')];var _0x333766=0xc8;var _0x25e710=null;return db[_0xee1c('0x4f')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xee1c('0x50')]['READ_COMMITTED']},function(_0x388ecf){return db['VoiceExtension'][_0xee1c('0x51')]({'where':{'id':_0x598558},'transaction':_0x388ecf})[_0xee1c('0x23')](function(_0x30f5e5){if(_0x30f5e5){return db[_0xee1c('0x25')][_0xee1c('0x15')]({'where':{'VoiceExtensionId':_0x598558},'transaction':_0x388ecf})['then'](function(){var _0xf80d5a=_[_0xee1c('0x1d')](_0x22e3b2,function(_0x1fadc4){_0x1fadc4['VoiceExtensionId']=_0x598558;_0x1fadc4[_0xee1c('0x52')]=!![];return _0x1fadc4;});return _0x30f5e5['createRouting'](_0xf80d5a);})['then'](function(_0x48045c){return db[_0xee1c('0x25')][_0xee1c('0x53')](_0x48045c,{'transaction':_0x388ecf});});}else{_0x333766=0x194;_0x25e710=[];}});})[_0xee1c('0x23')](function(){if(_0x333766!==0x194){return db[_0xee1c('0x25')][_0xee1c('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x598558},'order':_0xee1c('0x55')})[_0xee1c('0x23')](function(_0x8b4bd4){_0x25e710=_0x8b4bd4;});}})['catch'](function(_0x4a0427){_0x333766=0x1f4;logger['error'](_0x4a0427[_0xee1c('0x56')]);if(_0x4a0427[_0xee1c('0x21')]){delete _0x4a0427[_0xee1c('0x21')];}_0x25e710=_0x4a0427;})['finally'](function(){if(_0x25e710===null){_0x81f257[_0xee1c('0xc')](_0x333766);}else{if(_0x333766===0x1f4){_0x81f257[_0xee1c('0xd')](_0x333766)[_0xee1c('0x57')](_0x25e710);}else{_0x81f257[_0xee1c('0xd')](_0x333766)[_0xee1c('0x14')](_0x25e710);}}});}; \ No newline at end of file +var _0x4525=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','options','includeAll','findAll','catch','show','params','include','merge','create','body','startsWith','concat','exten','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x4525,0x12a));var _0x5452=function(_0x3e6dc3,_0x21497d){_0x3e6dc3=_0x3e6dc3-0x0;var _0x5f4078=_0x4525[_0x3e6dc3];return _0x5f4078;};'use strict';var _=require(_0x5452('0x0'));var Redis=require(_0x5452('0x1'));var qs=require(_0x5452('0x2'));var logger=require(_0x5452('0x3'))(_0x5452('0x4'));var config=require('../../config/environment');var db=require(_0x5452('0x5'))['db'];config[_0x5452('0x6')]=_[_0x5452('0x7')](config[_0x5452('0x6')],{'host':_0x5452('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5452('0x6')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x1a79b9,_0x151ad6){_0x151ad6=_0x151ad6||0xcc;return function(_0x583a26){if(_0x583a26){return _0x1a79b9[_0x5452('0x9')](_0x151ad6);}return _0x1a79b9[_0x5452('0xa')](_0x151ad6)[_0x5452('0xb')]();};}function respondWithResult(_0x4246b2,_0x3ebae5){_0x3ebae5=_0x3ebae5||0xc8;return function(_0x1fbdb1){if(_0x1fbdb1){return _0x4246b2[_0x5452('0xa')](_0x3ebae5)['json'](_0x1fbdb1);}};}function respondWithFilteredResult(_0xdc3058,_0x3f2a52){return function(_0x307e24){if(_0x307e24){var _0x18ac2b=typeof _0x3f2a52[_0x5452('0xc')]===_0x5452('0xd')&&typeof _0x3f2a52[_0x5452('0xe')]===_0x5452('0xd');var _0x25a9aa=_0x307e24[_0x5452('0xf')];var _0x3e7a4b=_0x18ac2b?0x0:_0x3f2a52[_0x5452('0xc')];var _0x44fc2c=_0x18ac2b?_0x307e24[_0x5452('0xf')]:_0x3f2a52[_0x5452('0xc')]+_0x3f2a52['limit'];var _0x3efaaf;if(_0x44fc2c>=_0x25a9aa){_0x44fc2c=_0x25a9aa;_0x3efaaf=0xc8;}else{_0x3efaaf=0xce;}_0xdc3058[_0x5452('0xa')](_0x3efaaf);return _0xdc3058[_0x5452('0x10')](_0x5452('0x11'),_0x3e7a4b+'-'+_0x44fc2c+'/'+_0x25a9aa)[_0x5452('0x12')](_0x307e24);}return null;};}function removeEntity(_0xd5552d){return function(_0x1b5166){if(_0x1b5166){return _0x1b5166[_0x5452('0x13')]()[_0x5452('0x14')](function(){var _0x371024=_0x1b5166['get']({'plain':!![]});var _0x3cab38=[{'name':_0x5452('0x15'),'value':_0x5452('0x16'),'ignore':![]},{'name':_0x5452('0x17'),'value':'outbound','ignore':![]},{'name':_0x5452('0x18'),'value':_0x5452('0x19'),'ignore':![]}];var _0x1454ee=_(_0x3cab38)[_0x5452('0x1a')](_0x5452('0x1b'))[_0x5452('0x1c')](_0x5452('0x1d'))['value']();if(_[_0x5452('0x1e')](_0x1454ee,_0x371024[_0x5452('0x1f')])){return;}var _0x6e0f65=_[_0x5452('0x20')](_0x3cab38,[_0x5452('0x1d'),_0x371024[_0x5452('0x1f')]])[_0x5452('0x21')];return db[_0x5452('0x22')][_0x5452('0x13')]({'where':{'type':_0x6e0f65,'resourceId':_0x371024['id']}})[_0x5452('0x14')](function(){return _0x1b5166;});})['then'](function(){_0xd5552d[_0x5452('0xa')](0xcc)[_0x5452('0xb')]();});}};}function handleEntityNotFound(_0x58c60c){return function(_0x5b860e){if(!_0x5b860e){_0x58c60c[_0x5452('0x9')](0x194);}return _0x5b860e;};}function handleError(_0x4ed9bd,_0x1fae76){_0x1fae76=_0x1fae76||0x1f4;return function(_0xef1a5a){logger['error'](_0xef1a5a[_0x5452('0x23')]);if(_0xef1a5a[_0x5452('0x21')]){delete _0xef1a5a[_0x5452('0x21')];}_0x4ed9bd[_0x5452('0xa')](_0x1fae76)[_0x5452('0x24')](_0xef1a5a);};}exports[_0x5452('0x25')]=function(_0x4c2a9b,_0x288735){var _0x4a4416={},_0x1372a1={},_0x947993={'count':0x0,'rows':[]};var _0x204395=_[_0x5452('0x1c')](db[_0x5452('0x26')][_0x5452('0x27')],function(_0x3b957a){return{'name':_0x3b957a['fieldName'],'type':_0x3b957a[_0x5452('0x1f')][_0x5452('0x28')]};});_0x1372a1[_0x5452('0x29')]=_[_0x5452('0x1c')](_0x204395,_0x5452('0x21'));_0x1372a1['query']=_[_0x5452('0x2a')](_0x4c2a9b['query']);_0x1372a1['filters']=_[_0x5452('0x2b')](_0x1372a1[_0x5452('0x29')],_0x1372a1[_0x5452('0x2c')]);_0x4a4416['attributes']=_[_0x5452('0x2b')](_0x1372a1['model'],qs[_0x5452('0x2d')](_0x4c2a9b[_0x5452('0x2c')]['fields']));_0x4a4416[_0x5452('0x2e')]=_0x4a4416[_0x5452('0x2e')][_0x5452('0x2f')]?_0x4a4416[_0x5452('0x2e')]:_0x1372a1[_0x5452('0x29')];if(!_0x4c2a9b[_0x5452('0x2c')][_0x5452('0x30')](_0x5452('0x31'))){_0x4a4416[_0x5452('0xe')]=qs[_0x5452('0xe')](_0x4c2a9b[_0x5452('0x2c')]['limit']);_0x4a4416[_0x5452('0xc')]=qs[_0x5452('0xc')](_0x4c2a9b[_0x5452('0x2c')]['offset']);}_0x4a4416[_0x5452('0x32')]=qs['sort'](_0x4c2a9b[_0x5452('0x2c')][_0x5452('0x33')]);_0x4a4416['where']=qs[_0x5452('0x34')](_[_0x5452('0x35')](_0x4c2a9b[_0x5452('0x2c')],_0x1372a1[_0x5452('0x34')]),_0x204395);if(_0x4c2a9b['query']['filter']){_0x4a4416[_0x5452('0x36')]=_['merge'](_0x4a4416[_0x5452('0x36')],{'$or':_[_0x5452('0x1c')](_0x204395,function(_0x596385){if(_0x596385[_0x5452('0x1f')]!=='VIRTUAL'){var _0x37ae4d={};_0x37ae4d[_0x596385['name']]={'$like':'%'+_0x4c2a9b[_0x5452('0x2c')]['filter']+'%'};return _0x37ae4d;}})});}_0x4a4416=_['merge']({},_0x4a4416,_0x4c2a9b[_0x5452('0x37')]);var _0x3dbc40={'where':_0x4a4416[_0x5452('0x36')]};return db[_0x5452('0x26')][_0x5452('0xf')](_0x3dbc40)['then'](function(_0x3a4dac){_0x947993[_0x5452('0xf')]=_0x3a4dac;if(_0x4c2a9b[_0x5452('0x2c')][_0x5452('0x38')]){_0x4a4416['include']=[{'all':!![]}];}return db[_0x5452('0x26')][_0x5452('0x39')](_0x4a4416);})[_0x5452('0x14')](function(_0x46d426){_0x947993['rows']=_0x46d426;return _0x947993;})[_0x5452('0x14')](respondWithFilteredResult(_0x288735,_0x4a4416))[_0x5452('0x3a')](handleError(_0x288735,null));};exports[_0x5452('0x3b')]=function(_0x1bdfa3,_0x7db3ff){var _0x51ae29={'raw':![],'where':{'id':_0x1bdfa3[_0x5452('0x3c')]['id']}},_0x1e600d={};_0x1e600d['model']=_[_0x5452('0x2a')](db[_0x5452('0x26')]['rawAttributes']);_0x1e600d['query']=_[_0x5452('0x2a')](_0x1bdfa3[_0x5452('0x2c')]);_0x1e600d[_0x5452('0x34')]=_[_0x5452('0x2b')](_0x1e600d[_0x5452('0x29')],_0x1e600d[_0x5452('0x2c')]);_0x51ae29['attributes']=_[_0x5452('0x2b')](_0x1e600d[_0x5452('0x29')],qs[_0x5452('0x2d')](_0x1bdfa3['query'][_0x5452('0x2d')]));_0x51ae29[_0x5452('0x2e')]=_0x51ae29['attributes'][_0x5452('0x2f')]?_0x51ae29['attributes']:_0x1e600d[_0x5452('0x29')];if(_0x1bdfa3[_0x5452('0x2c')][_0x5452('0x38')]){_0x51ae29[_0x5452('0x3d')]=[{'all':!![]}];}_0x51ae29=_[_0x5452('0x3e')]({},_0x51ae29,_0x1bdfa3[_0x5452('0x37')]);return db[_0x5452('0x26')][_0x5452('0x20')](_0x51ae29)[_0x5452('0x14')](handleEntityNotFound(_0x7db3ff,null))[_0x5452('0x14')](respondWithResult(_0x7db3ff,null))['catch'](handleError(_0x7db3ff,null));};exports[_0x5452('0x13')]=function(_0x348e52,_0x4190c6){return db['VoiceExtension']['find']({'where':{'id':_0x348e52['params']['id']}})[_0x5452('0x14')](handleEntityNotFound(_0x4190c6,null))[_0x5452('0x14')](removeEntity(_0x4190c6,null))[_0x5452('0x3a')](handleError(_0x4190c6,null));};exports[_0x5452('0x3f')]=function(_0x1c3a46,_0xbb2af6){if(_0x1c3a46[_0x5452('0x40')]['type']==='outbound'&&!_[_0x5452('0x41')](_0x1c3a46['body']['exten'],'_')){_0x1c3a46[_0x5452('0x40')]['exten']='_'[_0x5452('0x42')](_0x1c3a46[_0x5452('0x40')][_0x5452('0x43')]);}return db[_0x5452('0x26')][_0x5452('0x3f')](_0x1c3a46[_0x5452('0x40')],{'raw':![]})['then'](function(_0x441372){var _0x55c94a=_0x1c3a46[_0x5452('0x44')][_0x5452('0x45')]({'plain':!![]});if(!_0x55c94a)throw new Error(_0x5452('0x46'));if(_0x55c94a[_0x5452('0x47')]===_0x5452('0x44')){var _0x6a94c4=_0x441372[_0x5452('0x45')]({'plain':!![]});var _0x40402c=[{'name':_0x5452('0x15'),'value':_0x5452('0x16')},{'name':_0x5452('0x17'),'value':_0x5452('0x48')},{'name':_0x5452('0x18'),'value':'internal'}];var _0x4d70f1=_[_0x5452('0x20')](_0x40402c,[_0x5452('0x1d'),_0x6a94c4[_0x5452('0x1f')]])[_0x5452('0x21')];return db[_0x5452('0x49')]['find']({'where':{'name':_0x4d70f1,'userProfileId':_0x55c94a[_0x5452('0x4a')]},'raw':!![]})[_0x5452('0x14')](function(_0x486a7b){if(_0x486a7b&&_0x486a7b[_0x5452('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x6a94c4[_0x5452('0x21')],'resourceId':_0x6a94c4['id'],'type':_0x486a7b[_0x5452('0x21')],'sectionId':_0x486a7b['id']},{})[_0x5452('0x14')](function(){return _0x441372;});}else{return _0x441372;}})['catch'](function(_0x4f27d0){logger[_0x5452('0x4c')](_0x5452('0x4d'),_0x4f27d0);throw _0x4f27d0;});}return _0x441372;})[_0x5452('0x14')](respondWithResult(_0xbb2af6,0xc9))['catch'](handleError(_0xbb2af6,null));};exports[_0x5452('0x4e')]=function(_0x2a8373,_0x334d5c){if(_0x2a8373[_0x5452('0x40')]['id']){delete _0x2a8373[_0x5452('0x40')]['id'];}return db[_0x5452('0x26')][_0x5452('0x20')]({'where':{'id':_0x2a8373[_0x5452('0x3c')]['id']}})[_0x5452('0x14')](handleEntityNotFound(_0x334d5c,null))['then'](function(_0xf0e404){if(_0xf0e404){return db[_0x5452('0x26')][_0x5452('0x4e')](_[_0x5452('0x35')](_0x2a8373[_0x5452('0x40')],[_0x5452('0x43'),_0x5452('0x4f'),'description',_0x5452('0x50'),_0x5452('0x51'),_0x5452('0x52'),'alias']),{'where':{'context':_0xf0e404[_0x5452('0x4f')],'exten':_0xf0e404[_0x5452('0x43')]},'individualHooks':!![]})['then'](function(_0x593262){return _0x593262;});}return null;})[_0x5452('0x14')](respondWithStatusCode(_0x334d5c,null))[_0x5452('0x3a')](handleError(_0x334d5c,null));};exports[_0x5452('0x53')]=function(_0x322cf5,_0x3232f4){var _0x25994f=_0x322cf5[_0x5452('0x3c')]['id'];var _0x2c606b=_0x322cf5[_0x5452('0x40')];var _0x54d5ee=0xc8;var _0x20dd28=null;return db[_0x5452('0x54')][_0x5452('0x55')]({'isolationLevel':db[_0x5452('0x54')][_0x5452('0x56')][_0x5452('0x57')][_0x5452('0x58')]},function(_0x233f70){return db[_0x5452('0x26')]['findOne']({'where':{'id':_0x25994f},'transaction':_0x233f70})['then'](function(_0x5aca95){if(_0x5aca95){return db[_0x5452('0x26')][_0x5452('0x13')]({'where':{'VoiceExtensionId':_0x25994f},'transaction':_0x233f70})[_0x5452('0x14')](function(){var _0x474c77=_[_0x5452('0x1c')](_0x2c606b,function(_0x396356){_0x396356[_0x5452('0x59')]=_0x25994f;_0x396356['isApp']=!![];return _0x396356;});return _0x5aca95['createRouting'](_0x474c77);})[_0x5452('0x14')](function(_0x239719){return db['VoiceExtension'][_0x5452('0x5a')](_0x239719,{'transaction':_0x233f70});});}else{_0x54d5ee=0x194;_0x20dd28=[];}});})[_0x5452('0x14')](function(){if(_0x54d5ee!==0x194){return db[_0x5452('0x26')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x25994f},'order':_0x5452('0x5b')})['then'](function(_0x29727c){_0x20dd28=_0x29727c;});}})[_0x5452('0x3a')](function(_0x46f844){_0x54d5ee=0x1f4;logger[_0x5452('0x4c')](_0x46f844[_0x5452('0x23')]);if(_0x46f844[_0x5452('0x21')]){delete _0x46f844['name'];}_0x20dd28=_0x46f844;})[_0x5452('0x5c')](function(){if(_0x20dd28===null){_0x3232f4[_0x5452('0x9')](_0x54d5ee);}else{if(_0x54d5ee===0x1f4){_0x3232f4[_0x5452('0xa')](_0x54d5ee)[_0x5452('0x24')](_0x20dd28);}else{_0x3232f4['status'](_0x54d5ee)[_0x5452('0x12')](_0x20dd28);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 38c4bf7..2b911dc 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 _0xb0bd=['remove','emit','hasOwnProperty','hook','events','VoiceExtension','setMaxListeners','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb0bd,0x164));var _0xdb0b=function(_0x2c8d76,_0x3c9f5a){_0x2c8d76=_0x2c8d76-0x0;var _0x333a23=_0xb0bd[_0x2c8d76];return _0x333a23;};'use strict';var EventEmitter=require(_0xdb0b('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xdb0b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdb0b('0x2')](0x0);var events={'afterCreate':_0xdb0b('0x3'),'afterUpdate':'update','afterDestroy':_0xdb0b('0x4')};function emitEvent(_0x918fbf){return function(_0x1cd3bc,_0x723506,_0x4b6514){VoiceExtensionEvents[_0xdb0b('0x5')](_0x918fbf+':'+_0x1cd3bc['id'],_0x1cd3bc);VoiceExtensionEvents[_0xdb0b('0x5')](_0x918fbf,_0x1cd3bc);_0x4b6514(null);};}for(var e in events){if(events[_0xdb0b('0x6')](e)){var event=events[e];VoiceExtension[_0xdb0b('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xe06e=['../../mysqldb','VoiceExtension','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x26df18,_0x5ac9da){var _0x1a7e1c=function(_0x1aa1f9){while(--_0x1aa1f9){_0x26df18['push'](_0x26df18['shift']());}};_0x1a7e1c(++_0x5ac9da);}(_0xe06e,0x143));var _0xee06=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0xe06e[_0x43a37c];return _0x5d1d40;};'use strict';var EventEmitter=require(_0xee06('0x0'));var VoiceExtension=require(_0xee06('0x1'))['db'][_0xee06('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xee06('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xee06('0x4')};function emitEvent(_0x2360cb){return function(_0x1a5fc1,_0x254928,_0x43e450){VoiceExtensionEvents[_0xee06('0x5')](_0x2360cb+':'+_0x1a5fc1['id'],_0x1a5fc1);VoiceExtensionEvents['emit'](_0x2360cb,_0x1a5fc1);_0x43e450(null);};}for(var e in events){if(events[_0xee06('0x6')](e)){var event=events[e];VoiceExtension[_0xee06('0x7')](e,emitEvent(event));}}module[_0xee06('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 2963cda..7fd680c 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 _0xab5b=['catch','VoiceExtension','voice_extensions','get','then','concat','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','${EXTEN:','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','split','length','name','param','phone','prefix','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','includes','app','answer','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','priority','last'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xab5b,0x147));var _0xbab5=function(_0x44e5bf,_0x204cfc){_0x44e5bf=_0x44e5bf-0x0;var _0x572a20=_0xab5b[_0x44e5bf];return _0x572a20;};'use strict';var _=require('lodash');var attributes=require(_0xbab5('0x0'));module[_0xbab5('0x1')]=function(_0x58d745){var _0x164770=_0x58d745[_0xbab5('0x2')];function _0x5eda57(_0x3ea320){var _0x145c4b=0x2;var _0x35052c=[{'type':_0x3ea320[_0xbab5('0x3')],'app':_0xbab5('0x4'),'appdata':_0xbab5('0x5')+_0x3ea320['type'],'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320[_0xbab5('0x7')],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']}];if(_0x3ea320[_0xbab5('0x3')]===_0xbab5('0x8')){_0x35052c[_0xbab5('0x9')]({'type':_0xbab5('0x8'),'app':'Set','appdata':_0xbab5('0xa')+_0x3ea320['id'],'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320[_0xbab5('0x7')],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']});}_0x35052c[_0xbab5('0x9')]({'type':_0x3ea320[_0xbab5('0x3')],'app':'Set','appdata':_0xbab5('0xb'),'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320['exten'],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']},{'type':_0x3ea320[_0xbab5('0x3')],'app':'Set','appdata':_0xbab5('0xc'),'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320[_0xbab5('0x7')],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']},{'type':_0x3ea320['type'],'app':_0xbab5('0x4'),'appdata':_0xbab5('0xd'),'context':_0x3ea320[_0xbab5('0x6')],'exten':_0x3ea320['exten'],'priority':_0x145c4b++,'VoiceExtensionId':_0x3ea320['id']});return _0x35052c;}function _0x1f4869(_0x35a57f){var _0xee47de=0x2;var _0x68bfd6=[{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':'CDR(type)=outbound','context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0xf')+(_0x35a57f['cutdigits']?_0xbab5('0x10')+_0x35a57f[_0xbab5('0x11')]+'}':'${EXTEN}'),'context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':'outbound','app':'Set','appdata':_0xbab5('0xa')+_0x35a57f['id'],'context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':'outbound','app':'ExecIf','appdata':_0xbab5('0x12')+(_0xee47de+0x2)+_0xbab5('0x13')+(_0xee47de+0x1)+')','context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0x35a57f['cutdigits']?_0xbab5('0x14')+_0x35a57f[_0xbab5('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x35a57f['context'],'exten':_0x35a57f['exten'],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0xc'),'context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f['exten'],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':'Set','appdata':_0xbab5('0xd'),'context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f['exten'],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0x15')+_0x35a57f['id'],'context':_0x35a57f['context'],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']}];if(_0x35a57f[_0xbab5('0x16')](_0xbab5('0x17'))&&_0x35a57f[_0xbab5('0x17')]!==_0xbab5('0x18')){_0x68bfd6[_0xbab5('0x9')]({'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0x19'),'context':_0x35a57f['context'],'exten':_0x35a57f[_0xbab5('0x7')],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']},{'type':_0xbab5('0xe'),'app':_0xbab5('0x4'),'appdata':_0xbab5('0x1a')+_0x35a57f[_0xbab5('0x17')]||'wav','context':_0x35a57f[_0xbab5('0x6')],'exten':_0x35a57f['exten'],'priority':_0xee47de++,'VoiceExtensionId':_0x35a57f['id']});}return _0x68bfd6;}function _0x2d34e1(_0x48450a,_0x540f8f){var _0x6375c6=[{'name':_0xbab5('0x1b'),'param':0x0},{'name':_0xbab5('0x1c'),'param':0x1},{'name':'options','param':0x2},{'name':_0xbab5('0x1d'),'param':0x3}];var _0x4ccc36={};var _0x2b9220=_0x540f8f[_0xbab5('0x1e')](',');var _0x2f3b91=[];for(var _0x207f1b=0x0;_0x207f1b<_0x6375c6[_0xbab5('0x1f')];_0x207f1b++){switch(_0x6375c6[_0x207f1b][_0xbab5('0x20')]){case _0xbab5('0x1b'):_0x4ccc36[_0xbab5('0x1b')]=_0x2b9220[_0x6375c6[_0x207f1b][_0xbab5('0x21')]][_0xbab5('0x1e')]('/')[0x1];_0x4ccc36[_0xbab5('0x22')]=_0x2b9220[_0x6375c6[_0x207f1b]['param']][_0xbab5('0x1e')]('/')[0x2];_0x4ccc36[_0xbab5('0x23')]=_0x4ccc36[_0xbab5('0x22')]?_0x4ccc36[_0xbab5('0x22')][_0xbab5('0x1e')]('$')[0x0]:undefined;_0x4ccc36[_0xbab5('0x22')]=_0x48450a[_0xbab5('0x11')]?(_0x4ccc36[_0xbab5('0x23')]||'')+_0xbab5('0x10')+_0x48450a[_0xbab5('0x11')]+'}':(_0x4ccc36[_0xbab5('0x23')]||'')+_0xbab5('0x24');_0x2f3b91[_0x6375c6[_0x207f1b][_0xbab5('0x21')]]=[_0xbab5('0x25'),_0x4ccc36['trunk'],_0x4ccc36[_0xbab5('0x22')]][_0xbab5('0x26')]('/');break;case'options':_0x4ccc36[_0xbab5('0x27')]=_0x2b9220[_0x6375c6[_0x207f1b]['param']];if(_0x48450a[_0xbab5('0x17')]!==_0xbab5('0x18')){if(_0x4ccc36[_0xbab5('0x27')][_0xbab5('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x4ccc36['options']+=_0xbab5('0x29');}}else{_0x4ccc36[_0xbab5('0x27')]=_0x4ccc36[_0xbab5('0x27')][_0xbab5('0x2a')](_0xbab5('0x29'),'');}_0x2f3b91[_0x6375c6[_0x207f1b][_0xbab5('0x21')]]=_0x4ccc36['options'];break;default:_0x2f3b91[_0x6375c6[_0x207f1b][_0xbab5('0x21')]]=_0x2b9220[_0x6375c6[_0x207f1b][_0xbab5('0x21')]];}}return _0x2f3b91[_0xbab5('0x26')](',');}function _0x5b25ca(_0x8d8a2c,_0x2e91fd,_0x2ef316){return new Promise(function(_0x1418a5,_0xfcc5c9){var _0xd715d3=[];if(_[_0xbab5('0x2b')](_0x2e91fd))return _0x1418a5(_0xd715d3);_0x164770[_0xbab5('0x2c')][_0xbab5('0x2d')]({'attributes':['id',_0xbab5('0x2e'),_0xbab5('0x2f')],'raw':!![]})['then'](function(_0x223d09){for(var _0x561bda=0x0,_0x23f1e7=0x0;_0x561bda<_0x2e91fd['length'];_0x561bda++,_0x23f1e7=0x0){var _0xc4b40=_0x2e91fd[_0x561bda];var _0x2c0578=[];var _0x105c61=[];delete _0xc4b40['id'];if(_0xc4b40[_0xbab5('0x2e')]!==_0xbab5('0x30')){_0xc4b40['intervals']=[_0xc4b40[_0xbab5('0x2e')]];}else{_0xc4b40[_0xbab5('0x31')]=_0xc4b40[_0xbab5('0x2f')]?_[_0xbab5('0x32')](_[_0xbab5('0x33')](_0x223d09,{'IntervalId':_0xc4b40[_0xbab5('0x2f')]}),_0xbab5('0x2e')):[];}_0xc4b40['context']=_0x8d8a2c[_0xbab5('0x6')];_0xc4b40[_0xbab5('0x7')]=_0x8d8a2c[_0xbab5('0x7')];if(_0xc4b40[_0xbab5('0x3')])_0xc4b40['type']=_0xc4b40[_0xbab5('0x3')][_0xbab5('0x34')]();if(_0x8d8a2c[_0xbab5('0x3')]===_0xbab5('0xe')){if(_0xc4b40[_0xbab5('0x16')](_0xbab5('0x35'))&&_0xc4b40[_0xbab5('0x35')]&&_0xc4b40[_0xbab5('0x35')]!=='--'){_0x2c0578[_0xbab5('0x9')]({'type':_0xc4b40['type'][_0xbab5('0x34')](),'app':_0xbab5('0x4'),'appdata':'CDR(tag)='+_0xc4b40['tag'],'context':_0x8d8a2c[_0xbab5('0x6')],'exten':_0x8d8a2c[_0xbab5('0x7')],'priority':_0xc4b40[_0xbab5('0x31')][_0xbab5('0x1f')]+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}_0x2c0578['push']({'type':_0xc4b40[_0xbab5('0x3')][_0xbab5('0x34')](),'app':'ExecIf','appdata':_0xbab5('0x36')+(_0xc4b40[_0xbab5('0x37')]?_0xbab5('0x38')+_0xc4b40[_0xbab5('0x37')]+')':_0xbab5('0x39')),'context':_0x8d8a2c[_0xbab5('0x6')],'exten':_0x8d8a2c[_0xbab5('0x7')],'priority':_0xc4b40['intervals'][_0xbab5('0x1f')]+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}else{if(_0xc4b40[_0xbab5('0x16')]('answer')){if(['queue','playback'][_0xbab5('0x3a')](_0xc4b40[_0xbab5('0x3b')][_0xbab5('0x34')]())&&_0xc4b40['appType']!=='custom'){if(_0xc4b40[_0xbab5('0x3c')]){_0x2c0578['push']({'type':_0xc4b40['type']['toLowerCase'](),'app':_0xbab5('0x3d'),'appdata':_0xbab5('0x3e'),'context':_0x8d8a2c['context'],'exten':_0x8d8a2c[_0xbab5('0x7')],'priority':_0xc4b40[_0xbab5('0x31')]['length']+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});_0x2c0578['push']({'type':_0xc4b40[_0xbab5('0x3')][_0xbab5('0x34')](),'app':_0xbab5('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x8d8a2c['context'],'exten':_0x8d8a2c[_0xbab5('0x7')],'priority':_0xc4b40[_0xbab5('0x31')]['length']+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}else{_0x2c0578[_0xbab5('0x9')]({'type':_0xc4b40[_0xbab5('0x3')]['toLowerCase'](),'app':_0xbab5('0x3d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x8d8a2c[_0xbab5('0x6')],'exten':_0x8d8a2c['exten'],'priority':_0xc4b40[_0xbab5('0x31')][_0xbab5('0x1f')]+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});_0x2c0578[_0xbab5('0x9')]({'type':_0xc4b40['type']['toLowerCase'](),'app':'Set','appdata':_0xbab5('0x3f'),'context':_0x8d8a2c['context'],'exten':_0x8d8a2c['exten'],'priority':_0xc4b40[_0xbab5('0x31')]['length']+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}}}}for(var _0x36eb15=0x0;_0x36eb15<_0xc4b40['intervals'][_0xbab5('0x1f')];_0x36eb15++){var _0x3080e0=_0x2ef316+_0xc4b40[_0xbab5('0x31')][_0xbab5('0x1f')];var _0x2ad590=_0x36eb15===_0xc4b40[_0xbab5('0x31')]['length']-0x1?_0x2ef316+_0x2c0578[_0xbab5('0x1f')]+_0x105c61['length']+0x2:_0x2ef316+_0x36eb15+0x1;_0x2c0578[_0xbab5('0x40')](_0x36eb15,0x0,{'type':_0x8d8a2c[_0xbab5('0x3')],'app':_0xbab5('0x41'),'appdata':_0xc4b40[_0xbab5('0x31')][_0x36eb15]+'?'+_0x8d8a2c[_0xbab5('0x6')]+',${EXTEN},'+_0x3080e0+':'+_0x8d8a2c['context']+_0xbab5('0x42')+_0x2ad590,'exten':_0x8d8a2c[_0xbab5('0x7')],'context':_0x8d8a2c[_0xbab5('0x6')],'priority':_0x2ef316+_0x36eb15,'VoiceExtensionId':_0x8d8a2c['id']});}if(_0xc4b40[_0xbab5('0x43')]===_0xbab5('0x44')){_0xc4b40[_0xbab5('0x45')]=_0x2d34e1(_0x8d8a2c,_0xc4b40['appdata']);}if(_0xc4b40['appType']===_0xbab5('0x46')){_0x2c0578[_0xbab5('0x9')]({'type':_0xc4b40[_0xbab5('0x3')][_0xbab5('0x34')](),'app':_0xbab5('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x8d8a2c['context'],'exten':_0x8d8a2c['exten'],'priority':_0xc4b40[_0xbab5('0x31')][_0xbab5('0x1f')]+_0x2ef316+_0x23f1e7++,'VoiceExtensionId':_0x8d8a2c['id']});}_0xc4b40[_0xbab5('0x47')]=_0x2c0578[_0xbab5('0x1f')]?_[_0xbab5('0x48')](_0x2c0578)['priority']+0x1:_0x2ef316;_0xd715d3=_['concat'](_0xd715d3,_0x2c0578,[_0xc4b40],_0x105c61);_0x2ef316=_[_0xbab5('0x48')](_0xd715d3)[_0xbab5('0x47')]+0x1;}return _0x1418a5(_0xd715d3);})[_0xbab5('0x49')](function(_0x359e4f){_0xfcc5c9(_0x359e4f);});});}return _0x58d745['define'](_0xbab5('0x4a'),attributes,{'tableName':_0xbab5('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44b268){var _0x1995ee=this[_0xbab5('0x4c')]({'plain':!![]});var _0x49c4af=_0x1995ee[_0xbab5('0x3')]===_0xbab5('0xe')?_0x1f4869(_0x1995ee):_0x5eda57(_0x1995ee);return _0x5b25ca(_0x1995ee,_0x44b268,_[_0xbab5('0x48')](_0x49c4af)[_0xbab5('0x47')]+0x1)[_0xbab5('0x4d')](function(_0x757d7f){var _0xc5802=_[_0xbab5('0x4e')](_0x49c4af,_0x757d7f);_0xc5802['push']({'type':_0x1995ee['type'],'app':_0xbab5('0x4f'),'exten':_0x1995ee['exten'],'context':_0x1995ee['context'],'priority':_[_0xbab5('0x48')](_0xc5802)[_0xbab5('0x47')]+0x1,'VoiceExtensionId':_0x1995ee['id']});return _0xc5802;});}}});}; \ No newline at end of file +var _0x1b78=['exports','models','type','Set','CDR(type)=','context','inbound','CDR(routeid)=','exten','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','cutdigits','outbound','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','phone','prefix','${EXTEN:','${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','IntervalId','interval','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','priority','last','concat','catch','voice_extensions','then','./voiceExtension.attributes'];(function(_0x4669c5,_0x1a08f3){var _0x13ff94=function(_0x378d59){while(--_0x378d59){_0x4669c5['push'](_0x4669c5['shift']());}};_0x13ff94(++_0x1a08f3);}(_0x1b78,0x13b));var _0x81b7=function(_0x202fe7,_0x49ccc4){_0x202fe7=_0x202fe7-0x0;var _0xb30bd1=_0x1b78[_0x202fe7];return _0xb30bd1;};'use strict';var _=require('lodash');var attributes=require(_0x81b7('0x0'));module[_0x81b7('0x1')]=function(_0x423bed){var _0x5b3940=_0x423bed[_0x81b7('0x2')];function _0x15aac2(_0x4a7878){var _0x5e6b22=0x2;var _0x53c9b6=[{'type':_0x4a7878[_0x81b7('0x3')],'app':_0x81b7('0x4'),'appdata':_0x81b7('0x5')+_0x4a7878['type'],'context':_0x4a7878[_0x81b7('0x6')],'exten':_0x4a7878['exten'],'priority':_0x5e6b22++,'VoiceExtensionId':_0x4a7878['id']}];if(_0x4a7878[_0x81b7('0x3')]==='inbound'){_0x53c9b6['push']({'type':_0x81b7('0x7'),'app':_0x81b7('0x4'),'appdata':_0x81b7('0x8')+_0x4a7878['id'],'context':_0x4a7878['context'],'exten':_0x4a7878[_0x81b7('0x9')],'priority':_0x5e6b22++,'VoiceExtensionId':_0x4a7878['id']});}_0x53c9b6[_0x81b7('0xa')]({'type':_0x4a7878[_0x81b7('0x3')],'app':_0x81b7('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4a7878[_0x81b7('0x6')],'exten':_0x4a7878[_0x81b7('0x9')],'priority':_0x5e6b22++,'VoiceExtensionId':_0x4a7878['id']},{'type':_0x4a7878[_0x81b7('0x3')],'app':_0x81b7('0x4'),'appdata':_0x81b7('0xb'),'context':_0x4a7878['context'],'exten':_0x4a7878[_0x81b7('0x9')],'priority':_0x5e6b22++,'VoiceExtensionId':_0x4a7878['id']},{'type':_0x4a7878[_0x81b7('0x3')],'app':_0x81b7('0x4'),'appdata':_0x81b7('0xc'),'context':_0x4a7878[_0x81b7('0x6')],'exten':_0x4a7878['exten'],'priority':_0x5e6b22++,'VoiceExtensionId':_0x4a7878['id']});return _0x53c9b6;}function _0xef00cf(_0x34b1a4){var _0xc94a49=0x2;var _0x19bd8f=[{'type':'outbound','app':_0x81b7('0x4'),'appdata':_0x81b7('0xd'),'context':_0x34b1a4['context'],'exten':_0x34b1a4['exten'],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':'outbound','app':_0x81b7('0x4'),'appdata':'CDR(destination)='+(_0x34b1a4[_0x81b7('0xe')]?'${EXTEN:'+_0x34b1a4[_0x81b7('0xe')]+'}':'${EXTEN}'),'context':_0x34b1a4[_0x81b7('0x6')],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':_0x81b7('0xf'),'app':'Set','appdata':_0x81b7('0x8')+_0x34b1a4['id'],'context':_0x34b1a4['context'],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':_0x81b7('0xf'),'app':_0x81b7('0x10'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xc94a49+0x2)+_0x81b7('0x11')+(_0xc94a49+0x1)+')','context':_0x34b1a4['context'],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':_0x81b7('0xf'),'app':_0x81b7('0x4'),'appdata':_0x34b1a4[_0x81b7('0xe')]?_0x81b7('0x12')+_0x34b1a4['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x34b1a4[_0x81b7('0x6')],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':_0x81b7('0xf'),'app':_0x81b7('0x4'),'appdata':_0x81b7('0x13'),'context':_0x34b1a4[_0x81b7('0x6')],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':_0x81b7('0xf'),'app':_0x81b7('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x34b1a4[_0x81b7('0x6')],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':'outbound','app':_0x81b7('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x34b1a4[_0x81b7('0x6')],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':_0x81b7('0xf'),'app':_0x81b7('0x4'),'appdata':_0x81b7('0x14')+_0x34b1a4['id'],'context':_0x34b1a4[_0x81b7('0x6')],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']}];if(_0x34b1a4['hasOwnProperty'](_0x81b7('0x15'))&&_0x34b1a4['recordingFormat']!==_0x81b7('0x16')){_0x19bd8f['push']({'type':_0x81b7('0xf'),'app':'Set','appdata':_0x81b7('0x17'),'context':_0x34b1a4[_0x81b7('0x6')],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']},{'type':_0x81b7('0xf'),'app':_0x81b7('0x4'),'appdata':_0x81b7('0x18')+_0x34b1a4[_0x81b7('0x15')]||_0x81b7('0x19'),'context':_0x34b1a4[_0x81b7('0x6')],'exten':_0x34b1a4[_0x81b7('0x9')],'priority':_0xc94a49++,'VoiceExtensionId':_0x34b1a4['id']});}return _0x19bd8f;}function _0x306e73(_0x329ca6,_0x2ae640){var _0x147780=[{'name':_0x81b7('0x1a'),'param':0x0},{'name':_0x81b7('0x1b'),'param':0x1},{'name':_0x81b7('0x1c'),'param':0x2},{'name':_0x81b7('0x1d'),'param':0x3}];var _0x1e673b={};var _0x49a227=_0x2ae640[_0x81b7('0x1e')](',');var _0x6916b9=[];for(var _0x109a8b=0x0;_0x109a8b<_0x147780['length'];_0x109a8b++){switch(_0x147780[_0x109a8b][_0x81b7('0x1f')]){case'trunk':_0x1e673b[_0x81b7('0x1a')]=_0x49a227[_0x147780[_0x109a8b][_0x81b7('0x20')]]['split']('/')[0x1];_0x1e673b[_0x81b7('0x21')]=_0x49a227[_0x147780[_0x109a8b][_0x81b7('0x20')]][_0x81b7('0x1e')]('/')[0x2];_0x1e673b[_0x81b7('0x22')]=_0x1e673b[_0x81b7('0x21')]?_0x1e673b[_0x81b7('0x21')][_0x81b7('0x1e')]('$')[0x0]:undefined;_0x1e673b['phone']=_0x329ca6[_0x81b7('0xe')]?(_0x1e673b[_0x81b7('0x22')]||'')+_0x81b7('0x23')+_0x329ca6[_0x81b7('0xe')]+'}':(_0x1e673b[_0x81b7('0x22')]||'')+_0x81b7('0x24');_0x6916b9[_0x147780[_0x109a8b][_0x81b7('0x20')]]=[_0x81b7('0x25'),_0x1e673b['trunk'],_0x1e673b[_0x81b7('0x21')]][_0x81b7('0x26')]('/');break;case'options':_0x1e673b[_0x81b7('0x1c')]=_0x49a227[_0x147780[_0x109a8b][_0x81b7('0x20')]];if(_0x329ca6[_0x81b7('0x15')]!==_0x81b7('0x16')){if(_0x1e673b['options'][_0x81b7('0x27')](_0x81b7('0x28'))<0x0){_0x1e673b['options']+=_0x81b7('0x28');}}else{_0x1e673b[_0x81b7('0x1c')]=_0x1e673b[_0x81b7('0x1c')][_0x81b7('0x29')](_0x81b7('0x28'),'');}_0x6916b9[_0x147780[_0x109a8b][_0x81b7('0x20')]]=_0x1e673b['options'];break;default:_0x6916b9[_0x147780[_0x109a8b][_0x81b7('0x20')]]=_0x49a227[_0x147780[_0x109a8b][_0x81b7('0x20')]];}}return _0x6916b9['join'](',');}function _0x8032b3(_0xa4e474,_0x49a5c1,_0x57a775){return new Promise(function(_0x48602c,_0x361252){var _0x363d64=[];if(_[_0x81b7('0x2a')](_0x49a5c1))return _0x48602c(_0x363d64);_0x5b3940[_0x81b7('0x2b')]['findAll']({'attributes':['id','interval',_0x81b7('0x2c')],'raw':!![]})['then'](function(_0x32f03a){for(var _0x4416e3=0x0,_0x2ae382=0x0;_0x4416e3<_0x49a5c1['length'];_0x4416e3++,_0x2ae382=0x0){var _0x50d460=_0x49a5c1[_0x4416e3];var _0x391862=[];var _0x2dff46=[];delete _0x50d460['id'];if(_0x50d460[_0x81b7('0x2d')]!=='*,*,*,*'){_0x50d460[_0x81b7('0x2e')]=[_0x50d460['interval']];}else{_0x50d460[_0x81b7('0x2e')]=_0x50d460[_0x81b7('0x2c')]?_[_0x81b7('0x2f')](_[_0x81b7('0x30')](_0x32f03a,{'IntervalId':_0x50d460[_0x81b7('0x2c')]}),'interval'):[];}_0x50d460['context']=_0xa4e474['context'];_0x50d460[_0x81b7('0x9')]=_0xa4e474['exten'];if(_0x50d460['type'])_0x50d460[_0x81b7('0x3')]=_0x50d460[_0x81b7('0x3')][_0x81b7('0x31')]();if(_0xa4e474[_0x81b7('0x3')]===_0x81b7('0xf')){if(_0x50d460[_0x81b7('0x32')](_0x81b7('0x33'))&&_0x50d460['tag']&&_0x50d460[_0x81b7('0x33')]!=='--'){_0x391862['push']({'type':_0x50d460['type']['toLowerCase'](),'app':_0x81b7('0x4'),'appdata':_0x81b7('0x34')+_0x50d460[_0x81b7('0x33')],'context':_0xa4e474[_0x81b7('0x6')],'exten':_0xa4e474['exten'],'priority':_0x50d460[_0x81b7('0x2e')][_0x81b7('0x35')]+_0x57a775+_0x2ae382++,'VoiceExtensionId':_0xa4e474['id']});}_0x391862[_0x81b7('0xa')]({'type':_0x50d460[_0x81b7('0x3')][_0x81b7('0x31')](),'app':'ExecIf','appdata':_0x81b7('0x36')+(_0x50d460[_0x81b7('0x37')]?_0x81b7('0x38')+_0x50d460[_0x81b7('0x37')]+')':'NoOp(No\x20number\x20available)'),'context':_0xa4e474[_0x81b7('0x6')],'exten':_0xa4e474[_0x81b7('0x9')],'priority':_0x50d460[_0x81b7('0x2e')][_0x81b7('0x35')]+_0x57a775+_0x2ae382++,'VoiceExtensionId':_0xa4e474['id']});}else{if(_0x50d460[_0x81b7('0x32')](_0x81b7('0x39'))){if([_0x81b7('0x3a'),_0x81b7('0x3b')][_0x81b7('0x3c')](_0x50d460[_0x81b7('0x3d')][_0x81b7('0x31')]())&&_0x50d460['appType']!==_0x81b7('0x3e')){if(_0x50d460[_0x81b7('0x39')]){_0x391862['push']({'type':_0x50d460[_0x81b7('0x3')][_0x81b7('0x31')](),'app':_0x81b7('0x10'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xa4e474['context'],'exten':_0xa4e474[_0x81b7('0x9')],'priority':_0x50d460[_0x81b7('0x2e')][_0x81b7('0x35')]+_0x57a775+_0x2ae382++,'VoiceExtensionId':_0xa4e474['id']});_0x391862['push']({'type':_0x50d460[_0x81b7('0x3')][_0x81b7('0x31')](),'app':_0x81b7('0x4'),'appdata':_0x81b7('0x3f'),'context':_0xa4e474['context'],'exten':_0xa4e474['exten'],'priority':_0x50d460[_0x81b7('0x2e')][_0x81b7('0x35')]+_0x57a775+_0x2ae382++,'VoiceExtensionId':_0xa4e474['id']});}else{_0x391862[_0x81b7('0xa')]({'type':_0x50d460[_0x81b7('0x3')][_0x81b7('0x31')](),'app':_0x81b7('0x10'),'appdata':_0x81b7('0x40'),'context':_0xa4e474[_0x81b7('0x6')],'exten':_0xa4e474[_0x81b7('0x9')],'priority':_0x50d460[_0x81b7('0x2e')]['length']+_0x57a775+_0x2ae382++,'VoiceExtensionId':_0xa4e474['id']});_0x391862[_0x81b7('0xa')]({'type':_0x50d460[_0x81b7('0x3')][_0x81b7('0x31')](),'app':_0x81b7('0x4'),'appdata':_0x81b7('0x41'),'context':_0xa4e474[_0x81b7('0x6')],'exten':_0xa4e474[_0x81b7('0x9')],'priority':_0x50d460[_0x81b7('0x2e')][_0x81b7('0x35')]+_0x57a775+_0x2ae382++,'VoiceExtensionId':_0xa4e474['id']});}}}}for(var _0x1fac9b=0x0;_0x1fac9b<_0x50d460[_0x81b7('0x2e')]['length'];_0x1fac9b++){var _0x59e42e=_0x57a775+_0x50d460[_0x81b7('0x2e')][_0x81b7('0x35')];var _0x4c9cd8=_0x1fac9b===_0x50d460['intervals'][_0x81b7('0x35')]-0x1?_0x57a775+_0x391862[_0x81b7('0x35')]+_0x2dff46['length']+0x2:_0x57a775+_0x1fac9b+0x1;_0x391862[_0x81b7('0x42')](_0x1fac9b,0x0,{'type':_0xa4e474['type'],'app':_0x81b7('0x43'),'appdata':_0x50d460[_0x81b7('0x2e')][_0x1fac9b]+'?'+_0xa4e474[_0x81b7('0x6')]+_0x81b7('0x44')+_0x59e42e+':'+_0xa4e474['context']+_0x81b7('0x44')+_0x4c9cd8,'exten':_0xa4e474['exten'],'context':_0xa4e474['context'],'priority':_0x57a775+_0x1fac9b,'VoiceExtensionId':_0xa4e474['id']});}if(_0x50d460[_0x81b7('0x45')]===_0x81b7('0x46')){_0x50d460[_0x81b7('0x47')]=_0x306e73(_0xa4e474,_0x50d460[_0x81b7('0x47')]);}if(_0x50d460[_0x81b7('0x45')]===_0x81b7('0x48')){_0x391862[_0x81b7('0xa')]({'type':_0x50d460[_0x81b7('0x3')]['toLowerCase'](),'app':_0x81b7('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0xa4e474[_0x81b7('0x6')],'exten':_0xa4e474['exten'],'priority':_0x50d460['intervals'][_0x81b7('0x35')]+_0x57a775+_0x2ae382++,'VoiceExtensionId':_0xa4e474['id']});}_0x50d460[_0x81b7('0x49')]=_0x391862[_0x81b7('0x35')]?_[_0x81b7('0x4a')](_0x391862)[_0x81b7('0x49')]+0x1:_0x57a775;_0x363d64=_[_0x81b7('0x4b')](_0x363d64,_0x391862,[_0x50d460],_0x2dff46);_0x57a775=_[_0x81b7('0x4a')](_0x363d64)[_0x81b7('0x49')]+0x1;}return _0x48602c(_0x363d64);})[_0x81b7('0x4c')](function(_0x516634){_0x361252(_0x516634);});});}return _0x423bed['define']('VoiceExtension',attributes,{'tableName':_0x81b7('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1cc341){var _0x198d3a=this['get']({'plain':!![]});var _0x4e31b6=_0x198d3a[_0x81b7('0x3')]===_0x81b7('0xf')?_0xef00cf(_0x198d3a):_0x15aac2(_0x198d3a);return _0x8032b3(_0x198d3a,_0x1cc341,_[_0x81b7('0x4a')](_0x4e31b6)['priority']+0x1)[_0x81b7('0x4e')](function(_0x37913c){var _0x370cb6=_[_0x81b7('0x4b')](_0x4e31b6,_0x37913c);_0x370cb6['push']({'type':_0x198d3a[_0x81b7('0x3')],'app':'Hangup','exten':_0x198d3a['exten'],'context':_0x198d3a['context'],'priority':_[_0x81b7('0x4a')](_0x370cb6)[_0x81b7('0x49')]+0x1,'VoiceExtensionId':_0x198d3a['id']});return _0x370cb6;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index b03b47c..f94e763 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 _0x5aaa=['request\x20sent','stringify','error','code','message','result','catch','VoiceExtension','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x2827c8,_0x42d8b9){var _0x2640b8=function(_0x1b924b){while(--_0x1b924b){_0x2827c8['push'](_0x2827c8['shift']());}};_0x2640b8(++_0x42d8b9);}(_0x5aaa,0xff));var _0xa5aa=function(_0x2953f1,_0x1a925d){_0x2953f1=_0x2953f1-0x0;var _0x3c194c=_0x5aaa[_0x2953f1];return _0x3c194c;};'use strict';var _=require(_0xa5aa('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(_0xa5aa('0x1'))['db'];var utils=require(_0xa5aa('0x2'));var logger=require(_0xa5aa('0x3'))('rpc');var config=require(_0xa5aa('0x4'));var jayson=require(_0xa5aa('0x5'));var client=jayson['client'][_0xa5aa('0x6')]({'port':0x232a});config[_0xa5aa('0x7')]=_[_0xa5aa('0x8')](config[_0xa5aa('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5aa('0x7')]));require(_0xa5aa('0x9'))[_0xa5aa('0xa')](socket);function respondWithRpcPromise(_0x5bb8cd,_0x51b854,_0x5769ca){return new BPromise(function(_0x119692,_0x5e23f2){return client[_0xa5aa('0xb')](_0x5bb8cd,_0x5769ca)[_0xa5aa('0xc')](function(_0x2b4b12){logger[_0xa5aa('0xd')](_0xa5aa('0xe'),_0x51b854,'request\x20sent');logger[_0xa5aa('0xf')](_0xa5aa('0x10'),_0x51b854,_0xa5aa('0x11'),JSON[_0xa5aa('0x12')](_0x2b4b12));if(_0x2b4b12['error']){if(_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x14')]===0x1f4){logger[_0xa5aa('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x51b854,_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x15')]);return _0x5e23f2(_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x15')]);}logger[_0xa5aa('0x13')](_0xa5aa('0xe'),_0x51b854,_0x2b4b12[_0xa5aa('0x13')]['message']);return _0x119692(_0x2b4b12[_0xa5aa('0x13')]['message']);}else{logger['info'](_0xa5aa('0xe'),_0x51b854,_0xa5aa('0x11'));_0x119692(_0x2b4b12[_0xa5aa('0x16')][_0xa5aa('0x15')]);}})[_0xa5aa('0x17')](function(_0x3977f2){logger[_0xa5aa('0x13')](_0xa5aa('0xe'),_0x51b854,_0x3977f2);_0x5e23f2(_0x3977f2);});});}exports['GetVoiceExtension']=function(_0x127eb7){var _0x1eede0=this;return new Promise(function(_0x554433,_0x1e0604){return db[_0xa5aa('0x18')]['findAll']({'raw':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1b')]||null:null,'attributes':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1c')]||null:null,'limit':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7['options'][_0xa5aa('0x1d')]||null:null,'include':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1e')]?_[_0xa5aa('0x1f')](_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1e')],function(_0x28dc46){return{'model':db[_0x28dc46[_0xa5aa('0x20')]],'as':_0x28dc46['as'],'attributes':_0x28dc46[_0xa5aa('0x1c')],'include':_0x28dc46[_0xa5aa('0x1e')]?_[_0xa5aa('0x1f')](_0x28dc46[_0xa5aa('0x1e')],function(_0x247f69){return{'model':db[_0x247f69[_0xa5aa('0x20')]],'as':_0x247f69['as'],'attributes':_0x247f69[_0xa5aa('0x1c')],'include':_0x247f69[_0xa5aa('0x1e')]?_['map'](_0x247f69['include'],function(_0x565f64){return{'model':db[_0x565f64['model']],'as':_0x565f64['as'],'attributes':_0x565f64[_0xa5aa('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bb923){logger['info'](_0xa5aa('0x21'),_0x127eb7);logger[_0xa5aa('0xf')](_0xa5aa('0x21'),_0x127eb7,JSON[_0xa5aa('0x12')](_0x4bb923));_0x554433(_0x4bb923);})['catch'](function(_0x4ab988){logger[_0xa5aa('0x13')]('GetVoiceExtension',_0x4ab988[_0xa5aa('0x15')],_0x127eb7);_0x1e0604(_0x1eede0[_0xa5aa('0x13')](0x1f4,_0x4ab988['message']));});});}; \ No newline at end of file +var _0xc92f=['then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','redis','socket.io-emitter','./voiceExtension.socket','request'];(function(_0x5c8d8d,_0x33897a){var _0x15237f=function(_0x46b3a8){while(--_0x46b3a8){_0x5c8d8d['push'](_0x5c8d8d['shift']());}};_0x15237f(++_0x33897a);}(_0xc92f,0xf3));var _0xfc92=function(_0x2f5a41,_0x18eb0b){_0x2f5a41=_0x2f5a41-0x0;var _0x13db57=_0xc92f[_0x2f5a41];return _0x13db57;};'use strict';var _=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var moment=require('moment');var BPromise=require(_0xfc92('0x2'));var rs=require(_0xfc92('0x3'));var fs=require('fs');var Redis=require(_0xfc92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc92('0x5'));var logger=require(_0xfc92('0x6'))(_0xfc92('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc92('0x8')]['http']({'port':0x232a});config[_0xfc92('0x9')]=_['defaults'](config[_0xfc92('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc92('0xa'))(new Redis(config[_0xfc92('0x9')]));require(_0xfc92('0xb'))['register'](socket);function respondWithRpcPromise(_0x18a53b,_0x379756,_0x213ed0){return new BPromise(function(_0x552eab,_0x66d993){return client[_0xfc92('0xc')](_0x18a53b,_0x213ed0)[_0xfc92('0xd')](function(_0x5dee97){logger[_0xfc92('0xe')](_0xfc92('0xf'),_0x379756,_0xfc92('0x10'));logger[_0xfc92('0x11')](_0xfc92('0x12'),_0x379756,_0xfc92('0x10'),JSON[_0xfc92('0x13')](_0x5dee97));if(_0x5dee97[_0xfc92('0x14')]){if(_0x5dee97['error']['code']===0x1f4){logger['error'](_0xfc92('0xf'),_0x379756,_0x5dee97[_0xfc92('0x14')]['message']);return _0x66d993(_0x5dee97[_0xfc92('0x14')][_0xfc92('0x15')]);}logger[_0xfc92('0x14')](_0xfc92('0xf'),_0x379756,_0x5dee97[_0xfc92('0x14')][_0xfc92('0x15')]);return _0x552eab(_0x5dee97['error'][_0xfc92('0x15')]);}else{logger[_0xfc92('0xe')](_0xfc92('0xf'),_0x379756,_0xfc92('0x10'));_0x552eab(_0x5dee97['result']['message']);}})[_0xfc92('0x16')](function(_0x328345){logger['error'](_0xfc92('0xf'),_0x379756,_0x328345);_0x66d993(_0x328345);});});}exports[_0xfc92('0x17')]=function(_0x597ea2){var _0x1f0b90=this;return new Promise(function(_0x5ec474,_0x376551){return db[_0xfc92('0x18')][_0xfc92('0x19')]({'raw':_0x597ea2[_0xfc92('0x1a')]?_0x597ea2[_0xfc92('0x1a')][_0xfc92('0x1b')]===undefined?!![]:![]:!![],'where':_0x597ea2['options']?_0x597ea2[_0xfc92('0x1a')]['where']||null:null,'attributes':_0x597ea2[_0xfc92('0x1a')]?_0x597ea2[_0xfc92('0x1a')][_0xfc92('0x1c')]||null:null,'limit':_0x597ea2['options']?_0x597ea2['options']['limit']||null:null,'include':_0x597ea2['options']?_0x597ea2[_0xfc92('0x1a')][_0xfc92('0x1d')]?_[_0xfc92('0x1e')](_0x597ea2[_0xfc92('0x1a')][_0xfc92('0x1d')],function(_0xa43f14){return{'model':db[_0xa43f14[_0xfc92('0x1f')]],'as':_0xa43f14['as'],'attributes':_0xa43f14[_0xfc92('0x1c')],'include':_0xa43f14['include']?_[_0xfc92('0x1e')](_0xa43f14[_0xfc92('0x1d')],function(_0x35cea1){return{'model':db[_0x35cea1['model']],'as':_0x35cea1['as'],'attributes':_0x35cea1[_0xfc92('0x1c')],'include':_0x35cea1[_0xfc92('0x1d')]?_['map'](_0x35cea1['include'],function(_0x25de92){return{'model':db[_0x25de92[_0xfc92('0x1f')]],'as':_0x25de92['as'],'attributes':_0x25de92['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc92('0xd')](function(_0x4d62fe){logger[_0xfc92('0xe')](_0xfc92('0x17'),_0x597ea2);logger['debug'](_0xfc92('0x17'),_0x597ea2,JSON[_0xfc92('0x13')](_0x4d62fe));_0x5ec474(_0x4d62fe);})[_0xfc92('0x16')](function(_0x3adb82){logger[_0xfc92('0x14')](_0xfc92('0x17'),_0x3adb82[_0xfc92('0x15')],_0x597ea2);_0x376551(_0x1f0b90[_0xfc92('0x14')](0x1f4,_0x3adb82[_0xfc92('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 85db215..239f4c2 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x1b33bd,_0x3fa103){var _0x556c93=function(_0x128e79){while(--_0x128e79){_0x1b33bd['push'](_0x1b33bd['shift']());}};_0x556c93(++_0x3fa103);}(_0x0295,0x1f0));var _0x5029=function(_0x477598,_0x4dab5c){_0x477598=_0x477598-0x0;var _0x4c7ffb=_0x0295[_0x477598];return _0x4c7ffb;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x53b11d,_0x48718f){var _0x1686f5=function(_0x4ff720){while(--_0x4ff720){_0x53b11d['push'](_0x53b11d['shift']());}};_0x1686f5(++_0x48718f);}(_0x1261,0x144));var _0x1126=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x1261[_0x1a89a1];return _0x3d5b46;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 7e3bcb3..7a38925 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 _0xed1c=['get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller'];(function(_0x19c1f4,_0x3a9e79){var _0x2a6b81=function(_0x532585){while(--_0x532585){_0x19c1f4['push'](_0x19c1f4['shift']());}};_0x2a6b81(++_0x3a9e79);}(_0xed1c,0xe4));var _0xced1=function(_0x5bd77f,_0x7ddf87){_0x5bd77f=_0x5bd77f-0x0;var _0x576de5=_0xed1c[_0x5bd77f];return _0x576de5;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/',auth['isAuthenticated'](),controller[_0xced1('0xe')]);router['put'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);router[_0xced1('0x10')](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe2fe=['show','/:id/messages','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x311e77,_0x49a459){var _0x559c54=function(_0x283a97){while(--_0x283a97){_0x311e77['push'](_0x311e77['shift']());}};_0x559c54(++_0x49a459);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./voiceMail.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['getMessages']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0e550ff..18b2d48 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 _0x3179=['STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports'];(function(_0x46aad3,_0x5c363f){var _0x20e425=function(_0x3980d2){while(--_0x3980d2){_0x46aad3['push'](_0x46aad3['shift']());}};_0x20e425(++_0x5c363f);}(_0x3179,0x1ca));var _0x9317=function(_0x3ae71b,_0x24338f){_0x3ae71b=_0x3ae71b-0x0;var _0x518d80=_0x3179[_0x3ae71b];return _0x518d80;};'use strict';var Sequelize=require(_0x9317('0x0'));module[_0x9317('0x1')]={'customer_id':{'type':Sequelize[_0x9317('0x2')]},'context':{'type':Sequelize[_0x9317('0x2')],'defaultValue':_0x9317('0x3'),'unique':_0x9317('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x9317('0x2')]},'fullname':{'type':Sequelize[_0x9317('0x2')]},'email':{'type':Sequelize[_0x9317('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3ddf35){this[_0x9317('0x5')](_0x9317('0x6'),typeof _0x3ddf35===_0x9317('0x7')&&_0x3ddf35[_0x9317('0x8')]()?_0x3ddf35[_0x9317('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x9317('0x2')],'defaultValue':_0x9317('0x9')},'attach':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':_0x9317('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':_0x9317('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9317('0x2')]},'callback':{'type':Sequelize[_0x9317('0x2')]},'review':{'type':Sequelize['ENUM'](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9317('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9317('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9317('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9317('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9317('0xa')](_0x9317('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9317('0xa')]('yes','no'),'defaultValue':_0x9317('0xb'),'allowNull':![]},'stamp':{'type':_0x9317('0xd')},'emailsubject':{'type':Sequelize[_0x9317('0x2')]},'emailbody':{'type':Sequelize[_0x9317('0x2')]},'maxsecs':{'type':Sequelize[_0x9317('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9317('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9317('0xf')],'get':function(){return this[_0x9317('0x10')](_0x9317('0x11'))+_0x9317('0x12')+this['getDataValue'](_0x9317('0x13'));}}}; \ No newline at end of file +var _0x7bbf=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','sequelize'];(function(_0x4a7f3c,_0x74b703){var _0x89d3ae=function(_0x1ae014){while(--_0x1ae014){_0x4a7f3c['push'](_0x4a7f3c['shift']());}};_0x89d3ae(++_0x74b703);}(_0x7bbf,0x149));var _0xf7bb=function(_0x291f38,_0x4c149){_0x291f38=_0x291f38-0x0;var _0x270be3=_0x7bbf[_0x291f38];return _0x270be3;};'use strict';var Sequelize=require(_0xf7bb('0x0'));module[_0xf7bb('0x1')]={'customer_id':{'type':Sequelize[_0xf7bb('0x2')]},'context':{'type':Sequelize[_0xf7bb('0x2')],'defaultValue':_0xf7bb('0x3'),'unique':_0xf7bb('0x4')},'mailbox':{'type':Sequelize[_0xf7bb('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf7bb('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf7bb('0x2')],'validate':{'isEmail':!![]},'set':function(_0x119d4a){this[_0xf7bb('0x5')]('email',typeof _0x119d4a===_0xf7bb('0x6')&&_0x119d4a[_0xf7bb('0x7')]()?_0x119d4a[_0xf7bb('0x7')]():null);}},'pager':{'type':Sequelize[_0xf7bb('0x2')]},'tz':{'type':Sequelize[_0xf7bb('0x2')],'defaultValue':_0xf7bb('0x8')},'attach':{'type':Sequelize[_0xf7bb('0x9')](_0xf7bb('0xa'),'no'),'defaultValue':_0xf7bb('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf7bb('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf7bb('0x9')](_0xf7bb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf7bb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xf7bb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xf7bb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xf7bb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf7bb('0x9')](_0xf7bb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xf7bb('0xa'),'no'),'defaultValue':_0xf7bb('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf7bb('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf7bb('0x9')](_0xf7bb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf7bb('0x9')](_0xf7bb('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xf7bb('0xb')},'emailsubject':{'type':Sequelize[_0xf7bb('0x2')]},'emailbody':{'type':Sequelize[_0xf7bb('0x2')]},'maxsecs':{'type':Sequelize[_0xf7bb('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xf7bb('0xd')]('fullname')+_0xf7bb('0xe')+this[_0xf7bb('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 84be1ec..8f2ce08 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 _0xb688=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','nolimit','filter','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','get','Voicemails','end','error','name','send','index','map','VoiceMail'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb688,0xcf));var _0x8b68=function(_0x1286e6,_0x5adbd6){_0x1286e6=_0x1286e6-0x0;var _0x201da3=_0xb688[_0x1286e6];return _0x201da3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){var _0x4ca77d=_0x59bb8a[_0x8b68('0x27')]({'plain':!![]});var _0x3cf8d2=_0x8b68('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cf8d2,'resourceId':_0x4ca77d['id']}})['then'](function(){return _0x59bb8a;});})[_0x8b68('0x25')](function(){_0x32ddc5[_0x8b68('0x1c')](0xcc)[_0x8b68('0x29')]();});}};}function handleEntityNotFound(_0x583476,_0x3311c7){return function(_0x53aaa2){if(!_0x53aaa2){_0x583476['sendStatus'](0x194);}return _0x53aaa2;};}function handleError(_0x3865ea,_0x59b3ce){_0x59b3ce=_0x59b3ce||0x1f4;return function(_0x26cad7){logger[_0x8b68('0x2a')](_0x26cad7['stack']);if(_0x26cad7['name']){delete _0x26cad7[_0x8b68('0x2b')];}_0x3865ea[_0x8b68('0x1c')](_0x59b3ce)[_0x8b68('0x2c')](_0x26cad7);};}exports[_0x8b68('0x2d')]=function(_0x210926,_0x2ad2df){var _0x460c37={},_0x5b7ed1={},_0x3b6d1b={'count':0x0,'rows':[]};var _0x50a1e9=_[_0x8b68('0x2e')](db[_0x8b68('0x2f')]['rawAttributes'],function(_0x216aa6){return{'name':_0x216aa6[_0x8b68('0x30')],'type':_0x216aa6[_0x8b68('0x31')]['key']};});_0x5b7ed1['model']=_[_0x8b68('0x2e')](_0x50a1e9,_0x8b68('0x2b'));_0x5b7ed1[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x210926[_0x8b68('0x32')]);_0x5b7ed1[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],_0x5b7ed1[_0x8b68('0x32')]);_0x460c37[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x210926[_0x8b68('0x32')][_0x8b68('0x38')]));_0x460c37[_0x8b68('0x37')]=_0x460c37[_0x8b68('0x37')][_0x8b68('0x39')]?_0x460c37[_0x8b68('0x37')]:_0x5b7ed1[_0x8b68('0x36')];if(!_0x210926[_0x8b68('0x32')][_0x8b68('0x3a')]('nolimit')){_0x460c37['limit']=qs[_0x8b68('0x1f')](_0x210926[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x460c37[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x210926[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x460c37[_0x8b68('0x3b')]=qs['sort'](_0x210926[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x460c37[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x210926[_0x8b68('0x32')],_0x5b7ed1[_0x8b68('0x34')]),_0x50a1e9);if(_0x210926[_0x8b68('0x32')]['filter']){_0x460c37[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x460c37[_0x8b68('0x3d')],{'$or':_[_0x8b68('0x2e')](_0x50a1e9,function(_0x3ecc60){if(_0x3ecc60[_0x8b68('0x31')]!==_0x8b68('0x40')){var _0x50a9c6={};_0x50a9c6[_0x3ecc60[_0x8b68('0x2b')]]={'$like':'%'+_0x210926[_0x8b68('0x32')]['filter']+'%'};return _0x50a9c6;}})});}_0x460c37=_[_0x8b68('0x3f')]({},_0x460c37,_0x210926[_0x8b68('0x41')]);var _0x50b2f1={'where':_0x460c37['where']};return db['VoiceMail']['count'](_0x50b2f1)[_0x8b68('0x25')](function(_0x23d24a){_0x3b6d1b['count']=_0x23d24a;if(_0x210926[_0x8b68('0x32')]['includeAll']){_0x460c37[_0x8b68('0x42')]=[{'all':!![]}];}return db[_0x8b68('0x2f')]['findAll'](_0x460c37);})[_0x8b68('0x25')](function(_0x5ae345){_0x3b6d1b['rows']=_0x5ae345;return _0x3b6d1b;})['then'](respondWithFilteredResult(_0x2ad2df,_0x460c37))[_0x8b68('0x43')](handleError(_0x2ad2df,null));};exports[_0x8b68('0x44')]=function(_0x3ba80e,_0xa70f60){var _0x50e425={'raw':!![],'where':{'id':_0x3ba80e['params']['id']}},_0x20162a={};_0x20162a[_0x8b68('0x36')]=_[_0x8b68('0x33')](db['VoiceMail'][_0x8b68('0x45')]);_0x20162a[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ba80e[_0x8b68('0x32')]);_0x20162a['filters']=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],_0x20162a[_0x8b68('0x32')]);_0x50e425[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x50e425[_0x8b68('0x37')]=_0x50e425[_0x8b68('0x37')][_0x8b68('0x39')]?_0x50e425[_0x8b68('0x37')]:_0x20162a[_0x8b68('0x36')];if(_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x46')]){_0x50e425['include']=[{'all':!![]}];}_0x50e425=_[_0x8b68('0x3f')]({},_0x50e425,_0x3ba80e[_0x8b68('0x41')]);return db['VoiceMail'][_0x8b68('0x47')](_0x50e425)['then'](handleEntityNotFound(_0xa70f60,null))['then'](respondWithResult(_0xa70f60,null))['catch'](handleError(_0xa70f60,null));};exports[_0x8b68('0x48')]=function(_0x35874b,_0x34047c){return db[_0x8b68('0x2f')]['create'](_0x35874b['body'],{})[_0x8b68('0x25')](function(_0x163fd5){var _0x1e900f=_0x35874b['user'][_0x8b68('0x27')]({'plain':!![]});if(!_0x1e900f)throw new Error(_0x8b68('0x49'));if(_0x1e900f['role']===_0x8b68('0x4a')){var _0xacac82=_0x163fd5['get']({'plain':!![]});var _0x18a9ae=_0x8b68('0x28');return db['UserProfileSection'][_0x8b68('0x47')]({'where':{'name':_0x18a9ae,'userProfileId':_0x1e900f[_0x8b68('0x4b')]},'raw':!![]})['then'](function(_0x543d74){if(_0x543d74&&_0x543d74['autoAssociation']===0x0){return db[_0x8b68('0x4c')][_0x8b68('0x48')]({'name':_0xacac82[_0x8b68('0x2b')],'resourceId':_0xacac82['id'],'type':_0x543d74[_0x8b68('0x2b')],'sectionId':_0x543d74['id']},{})['then'](function(){return _0x163fd5;});}else{return _0x163fd5;}})['catch'](function(_0x4492fd){logger[_0x8b68('0x2a')](_0x8b68('0x4d'),_0x4492fd);throw _0x4492fd;});}return _0x163fd5;})['then'](respondWithResult(_0x34047c,0xc9))[_0x8b68('0x43')](handleError(_0x34047c,null));};exports[_0x8b68('0x24')]=function(_0x3f9d34,_0x4dda69){if(_0x3f9d34[_0x8b68('0x4e')]['id']){delete _0x3f9d34['body']['id'];}return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x3f9d34['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x4dda69,null))[_0x8b68('0x25')](saveUpdates(_0x3f9d34[_0x8b68('0x4e')],null))[_0x8b68('0x25')](respondWithResult(_0x4dda69,null))[_0x8b68('0x43')](handleError(_0x4dda69,null));};exports['destroy']=function(_0x241166,_0x3f3e43){return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x241166[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x3f3e43,null))[_0x8b68('0x25')](removeEntity(_0x3f3e43,null))[_0x8b68('0x43')](handleError(_0x3f3e43,null));};exports['getMessages']=function(_0x3f423e,_0x1a85da,_0x1e8694){return db[_0x8b68('0x2f')][_0x8b68('0x50')]({'where':{'id':_0x3f423e[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x1a85da,null))[_0x8b68('0x25')](function(_0x6d63cb){var _0x271dbe;var _0x368c86={},_0x42871e={};_0x42871e[_0x8b68('0x36')]=_[_0x8b68('0x33')](db[_0x8b68('0x51')][_0x8b68('0x45')]);_0x42871e[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3f423e[_0x8b68('0x32')]);_0x42871e[_0x8b68('0x34')]=_['intersection'](_0x42871e[_0x8b68('0x36')],_0x42871e['query']);_0x368c86['attributes']=_[_0x8b68('0x35')](_0x42871e['model'],qs[_0x8b68('0x38')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x368c86['attributes']=_0x368c86[_0x8b68('0x37')][_0x8b68('0x39')]?_0x368c86[_0x8b68('0x37')]:_0x42871e[_0x8b68('0x36')];if(!_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3a')](_0x8b68('0x52'))){_0x368c86['limit']=qs['limit'](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x368c86[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x368c86[_0x8b68('0x3b')]=qs[_0x8b68('0x3c')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x368c86[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x3f423e[_0x8b68('0x32')],_0x42871e[_0x8b68('0x34')]));if(_0x3f423e[_0x8b68('0x32')][_0x8b68('0x53')]){_0x368c86[_0x8b68('0x3d')]=_['merge'](_0x368c86['where'],{'$or':_[_0x8b68('0x2e')](_0x368c86[_0x8b68('0x37')],function(_0x5bd581){var _0x48d57a={};_0x48d57a[_0x5bd581]={'$like':'%'+_0x3f423e['query'][_0x8b68('0x53')]+'%'};return _0x48d57a;})});}_0x368c86[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x368c86[_0x8b68('0x3d')],{'mailboxuser':_0x6d63cb[_0x8b68('0x54')]});_0x368c86=_['merge']({},_0x368c86,_0x3f423e[_0x8b68('0x41')]);return db[_0x8b68('0x51')]['findAndCountAll'](_0x368c86)[_0x8b68('0x25')](respondWithFilteredResult(_0x1a85da,_0x368c86));})['catch'](handleError(_0x1a85da,null));}; \ No newline at end of file +var _0x6e6c=['sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','length','find','create','user','UserProfileSection','autoAssociation','UserProfileResource','body','params','findOne','VoiceMailMessage','nolimit','mailbox','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','end','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order'];(function(_0x3b58e2,_0x4fbf5f){var _0x5a6677=function(_0x1bf45f){while(--_0x1bf45f){_0x3b58e2['push'](_0x3b58e2['shift']());}};_0x5a6677(++_0x4fbf5f);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];function respondWithStatusCode(_0x525d60,_0x3a30ce){_0x3a30ce=_0x3a30ce||0xcc;return function(_0x314d0f){if(_0x314d0f){return _0x525d60[_0xc6e6('0x17')](_0x3a30ce);}return _0x525d60[_0xc6e6('0x18')](_0x3a30ce)['end']();};}function respondWithResult(_0x149ac6,_0x2bfe7d){_0x2bfe7d=_0x2bfe7d||0xc8;return function(_0x13be73){if(_0x13be73){return _0x149ac6[_0xc6e6('0x18')](_0x2bfe7d)[_0xc6e6('0x19')](_0x13be73);}};}function respondWithFilteredResult(_0x4cdf15,_0x413cf8){return function(_0x178b34){if(_0x178b34){var _0x569474=typeof _0x413cf8[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x413cf8[_0xc6e6('0x1c')]==='undefined';var _0x51fd7c=_0x178b34['count'];var _0x3a1ccc=_0x569474?0x0:_0x413cf8['offset'];var _0x46e58f=_0x569474?_0x178b34[_0xc6e6('0x1d')]:_0x413cf8[_0xc6e6('0x1a')]+_0x413cf8[_0xc6e6('0x1c')];var _0x19e1e4;if(_0x46e58f>=_0x51fd7c){_0x46e58f=_0x51fd7c;_0x19e1e4=0xc8;}else{_0x19e1e4=0xce;}_0x4cdf15[_0xc6e6('0x18')](_0x19e1e4);return _0x4cdf15[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x3a1ccc+'-'+_0x46e58f+'/'+_0x51fd7c)[_0xc6e6('0x19')](_0x178b34);}return null;};}function patchUpdates(_0x3d734d){return function(_0x4a36b6){try{jsonpatch[_0xc6e6('0x20')](_0x4a36b6,_0x3d734d,!![]);}catch(_0x4ad70e){return BPromise[_0xc6e6('0x21')](_0x4ad70e);}return _0x4a36b6[_0xc6e6('0x22')]();};}function saveUpdates(_0x2be6fc,_0x2f69f1){return function(_0x4f1d68){if(_0x4f1d68){return _0x4f1d68[_0xc6e6('0x23')](_0x2be6fc)[_0xc6e6('0x24')](function(_0x3a96df){return _0x3a96df;});}return null;};}function removeEntity(_0x36ebfa,_0x107561){return function(_0x4c35ae){if(_0x4c35ae){return _0x4c35ae[_0xc6e6('0x25')]()['then'](function(){var _0x266786=_0x4c35ae[_0xc6e6('0x26')]({'plain':!![]});var _0x2e5e0e=_0xc6e6('0x27');return db['UserProfileResource'][_0xc6e6('0x25')]({'where':{'type':_0x2e5e0e,'resourceId':_0x266786['id']}})['then'](function(){return _0x4c35ae;});})[_0xc6e6('0x24')](function(){_0x36ebfa['status'](0xcc)[_0xc6e6('0x28')]();});}};}function handleEntityNotFound(_0x16dcd9,_0x348888){return function(_0x41e7c2){if(!_0x41e7c2){_0x16dcd9[_0xc6e6('0x17')](0x194);}return _0x41e7c2;};}function handleError(_0x5e34f6,_0x346480){_0x346480=_0x346480||0x1f4;return function(_0x1501bd){logger[_0xc6e6('0x29')](_0x1501bd[_0xc6e6('0x2a')]);if(_0x1501bd['name']){delete _0x1501bd[_0xc6e6('0x2b')];}_0x5e34f6['status'](_0x346480)[_0xc6e6('0x2c')](_0x1501bd);};}exports[_0xc6e6('0x2d')]=function(_0x12c616,_0xc578b3){var _0xd3b63={},_0x402598={},_0x43ff9c={'count':0x0,'rows':[]};var _0x337442=_[_0xc6e6('0x2e')](db[_0xc6e6('0x2f')][_0xc6e6('0x30')],function(_0x214d6a){return{'name':_0x214d6a[_0xc6e6('0x31')],'type':_0x214d6a[_0xc6e6('0x32')][_0xc6e6('0x33')]};});_0x402598[_0xc6e6('0x34')]=_[_0xc6e6('0x2e')](_0x337442,'name');_0x402598[_0xc6e6('0x35')]=_[_0xc6e6('0x36')](_0x12c616['query']);_0x402598['filters']=_[_0xc6e6('0x37')](_0x402598[_0xc6e6('0x34')],_0x402598[_0xc6e6('0x35')]);_0xd3b63[_0xc6e6('0x38')]=_[_0xc6e6('0x37')](_0x402598[_0xc6e6('0x34')],qs['fields'](_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x39')]));_0xd3b63[_0xc6e6('0x38')]=_0xd3b63['attributes']['length']?_0xd3b63[_0xc6e6('0x38')]:_0x402598[_0xc6e6('0x34')];if(!_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x3a')]('nolimit')){_0xd3b63['limit']=qs[_0xc6e6('0x1c')](_0x12c616['query'][_0xc6e6('0x1c')]);_0xd3b63['offset']=qs[_0xc6e6('0x1a')](_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x1a')]);}_0xd3b63[_0xc6e6('0x3b')]=qs['sort'](_0x12c616['query'][_0xc6e6('0x3c')]);_0xd3b63[_0xc6e6('0x3d')]=qs[_0xc6e6('0x3e')](_[_0xc6e6('0x3f')](_0x12c616['query'],_0x402598['filters']),_0x337442);if(_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x40')]){_0xd3b63[_0xc6e6('0x3d')]=_[_0xc6e6('0x41')](_0xd3b63['where'],{'$or':_[_0xc6e6('0x2e')](_0x337442,function(_0x46c3ef){if(_0x46c3ef['type']!=='VIRTUAL'){var _0x2b01fd={};_0x2b01fd[_0x46c3ef['name']]={'$like':'%'+_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x40')]+'%'};return _0x2b01fd;}})});}_0xd3b63=_['merge']({},_0xd3b63,_0x12c616[_0xc6e6('0x42')]);var _0x50c96d={'where':_0xd3b63[_0xc6e6('0x3d')]};return db['VoiceMail'][_0xc6e6('0x1d')](_0x50c96d)[_0xc6e6('0x24')](function(_0x247076){_0x43ff9c[_0xc6e6('0x1d')]=_0x247076;if(_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x43')]){_0xd3b63[_0xc6e6('0x44')]=[{'all':!![]}];}return db[_0xc6e6('0x2f')][_0xc6e6('0x45')](_0xd3b63);})['then'](function(_0x3e3da6){_0x43ff9c[_0xc6e6('0x46')]=_0x3e3da6;return _0x43ff9c;})[_0xc6e6('0x24')](respondWithFilteredResult(_0xc578b3,_0xd3b63))[_0xc6e6('0x47')](handleError(_0xc578b3,null));};exports['show']=function(_0xc5f4fb,_0x825640){var _0x3a46ee={'raw':!![],'where':{'id':_0xc5f4fb['params']['id']}},_0x2fa3c5={};_0x2fa3c5[_0xc6e6('0x34')]=_[_0xc6e6('0x36')](db[_0xc6e6('0x2f')][_0xc6e6('0x30')]);_0x2fa3c5[_0xc6e6('0x35')]=_['keys'](_0xc5f4fb[_0xc6e6('0x35')]);_0x2fa3c5['filters']=_[_0xc6e6('0x37')](_0x2fa3c5['model'],_0x2fa3c5[_0xc6e6('0x35')]);_0x3a46ee[_0xc6e6('0x38')]=_[_0xc6e6('0x37')](_0x2fa3c5[_0xc6e6('0x34')],qs[_0xc6e6('0x39')](_0xc5f4fb[_0xc6e6('0x35')][_0xc6e6('0x39')]));_0x3a46ee[_0xc6e6('0x38')]=_0x3a46ee['attributes'][_0xc6e6('0x48')]?_0x3a46ee[_0xc6e6('0x38')]:_0x2fa3c5[_0xc6e6('0x34')];if(_0xc5f4fb['query'][_0xc6e6('0x43')]){_0x3a46ee[_0xc6e6('0x44')]=[{'all':!![]}];}_0x3a46ee=_[_0xc6e6('0x41')]({},_0x3a46ee,_0xc5f4fb[_0xc6e6('0x42')]);return db[_0xc6e6('0x2f')][_0xc6e6('0x49')](_0x3a46ee)[_0xc6e6('0x24')](handleEntityNotFound(_0x825640,null))[_0xc6e6('0x24')](respondWithResult(_0x825640,null))[_0xc6e6('0x47')](handleError(_0x825640,null));};exports[_0xc6e6('0x4a')]=function(_0x3bfe85,_0x470167){return db[_0xc6e6('0x2f')][_0xc6e6('0x4a')](_0x3bfe85['body'],{})[_0xc6e6('0x24')](function(_0x5566df){var _0x2c48e7=_0x3bfe85[_0xc6e6('0x4b')]['get']({'plain':!![]});if(!_0x2c48e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c48e7['role']==='user'){var _0x531dca=_0x5566df[_0xc6e6('0x26')]({'plain':!![]});var _0x40bbe9=_0xc6e6('0x27');return db[_0xc6e6('0x4c')][_0xc6e6('0x49')]({'where':{'name':_0x40bbe9,'userProfileId':_0x2c48e7['userProfileId']},'raw':!![]})['then'](function(_0x335229){if(_0x335229&&_0x335229[_0xc6e6('0x4d')]===0x0){return db[_0xc6e6('0x4e')][_0xc6e6('0x4a')]({'name':_0x531dca['name'],'resourceId':_0x531dca['id'],'type':_0x335229[_0xc6e6('0x2b')],'sectionId':_0x335229['id']},{})[_0xc6e6('0x24')](function(){return _0x5566df;});}else{return _0x5566df;}})[_0xc6e6('0x47')](function(_0x286dcf){logger[_0xc6e6('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x286dcf);throw _0x286dcf;});}return _0x5566df;})[_0xc6e6('0x24')](respondWithResult(_0x470167,0xc9))[_0xc6e6('0x47')](handleError(_0x470167,null));};exports[_0xc6e6('0x23')]=function(_0x5113e3,_0x3df0db){if(_0x5113e3[_0xc6e6('0x4f')]['id']){delete _0x5113e3[_0xc6e6('0x4f')]['id'];}return db[_0xc6e6('0x2f')][_0xc6e6('0x49')]({'where':{'id':_0x5113e3['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3df0db,null))[_0xc6e6('0x24')](saveUpdates(_0x5113e3[_0xc6e6('0x4f')],null))[_0xc6e6('0x24')](respondWithResult(_0x3df0db,null))[_0xc6e6('0x47')](handleError(_0x3df0db,null));};exports['destroy']=function(_0x5a7391,_0x58b09b){return db[_0xc6e6('0x2f')][_0xc6e6('0x49')]({'where':{'id':_0x5a7391[_0xc6e6('0x50')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x58b09b,null))[_0xc6e6('0x24')](removeEntity(_0x58b09b,null))[_0xc6e6('0x47')](handleError(_0x58b09b,null));};exports['getMessages']=function(_0xcd3d5d,_0x50f52a,_0x26f0e0){return db[_0xc6e6('0x2f')][_0xc6e6('0x51')]({'where':{'id':_0xcd3d5d['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x50f52a,null))['then'](function(_0x3b6822){var _0x50ac31;var _0x4a3bb1={},_0x18e101={};_0x18e101['model']=_['keys'](db[_0xc6e6('0x52')][_0xc6e6('0x30')]);_0x18e101[_0xc6e6('0x35')]=_[_0xc6e6('0x36')](_0xcd3d5d[_0xc6e6('0x35')]);_0x18e101[_0xc6e6('0x3e')]=_[_0xc6e6('0x37')](_0x18e101[_0xc6e6('0x34')],_0x18e101['query']);_0x4a3bb1[_0xc6e6('0x38')]=_[_0xc6e6('0x37')](_0x18e101[_0xc6e6('0x34')],qs[_0xc6e6('0x39')](_0xcd3d5d['query'][_0xc6e6('0x39')]));_0x4a3bb1[_0xc6e6('0x38')]=_0x4a3bb1[_0xc6e6('0x38')]['length']?_0x4a3bb1['attributes']:_0x18e101[_0xc6e6('0x34')];if(!_0xcd3d5d['query']['hasOwnProperty'](_0xc6e6('0x53'))){_0x4a3bb1[_0xc6e6('0x1c')]=qs[_0xc6e6('0x1c')](_0xcd3d5d[_0xc6e6('0x35')][_0xc6e6('0x1c')]);_0x4a3bb1[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0xcd3d5d[_0xc6e6('0x35')][_0xc6e6('0x1a')]);}_0x4a3bb1[_0xc6e6('0x3b')]=qs[_0xc6e6('0x3c')](_0xcd3d5d['query']['sort']);_0x4a3bb1[_0xc6e6('0x3d')]=qs['filters'](_['pick'](_0xcd3d5d[_0xc6e6('0x35')],_0x18e101[_0xc6e6('0x3e')]));if(_0xcd3d5d[_0xc6e6('0x35')]['filter']){_0x4a3bb1[_0xc6e6('0x3d')]=_[_0xc6e6('0x41')](_0x4a3bb1['where'],{'$or':_['map'](_0x4a3bb1[_0xc6e6('0x38')],function(_0x31329c){var _0x9d69b5={};_0x9d69b5[_0x31329c]={'$like':'%'+_0xcd3d5d[_0xc6e6('0x35')][_0xc6e6('0x40')]+'%'};return _0x9d69b5;})});}_0x4a3bb1[_0xc6e6('0x3d')]=_['merge'](_0x4a3bb1[_0xc6e6('0x3d')],{'mailboxuser':_0x3b6822[_0xc6e6('0x54')]});_0x4a3bb1=_[_0xc6e6('0x41')]({},_0x4a3bb1,_0xcd3d5d[_0xc6e6('0x42')]);return db[_0xc6e6('0x52')]['findAndCountAll'](_0x4a3bb1)[_0xc6e6('0x24')](respondWithFilteredResult(_0x50f52a,_0x4a3bb1));})[_0xc6e6('0x47')](handleError(_0x50f52a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 23f3201..d29fd30 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 _0xad4d=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','context','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x373202,_0x1a1fd4){var _0x5e90ab=function(_0x20da9b){while(--_0x20da9b){_0x373202['push'](_0x373202['shift']());}};_0x5e90ab(++_0x1a1fd4);}(_0xad4d,0x16f));var _0xdad4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xad4d[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xdad4('0x0'));var util=require('util');var logger=require(_0xdad4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdad4('0x2'));var fs=require('fs');var path=require(_0xdad4('0x3'));var rimraf=require(_0xdad4('0x4'));var config=require(_0xdad4('0x5'));var attributes=require(_0xdad4('0x6'));module[_0xdad4('0x7')]=function(_0x3cfa5d,_0x23c099){return _0x3cfa5d[_0xdad4('0x8')](_0xdad4('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xdad4('0xa'),'fields':['mailbox',_0xdad4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9272=['rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','lodash','api','moment','bluebird','request-promise','path'];(function(_0xe06df3,_0x1bc3f3){var _0x3d580a=function(_0x4622cb){while(--_0x4622cb){_0xe06df3['push'](_0xe06df3['shift']());}};_0x3d580a(++_0x1bc3f3);}(_0x9272,0x120));var _0x2927=function(_0x1371fa,_0x17cf8d){_0x1371fa=_0x1371fa-0x0;var _0xe1e54f=_0x9272[_0x1371fa];return _0xe1e54f;};'use strict';var _=require(_0x2927('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2927('0x1'));var moment=require(_0x2927('0x2'));var BPromise=require(_0x2927('0x3'));var rp=require(_0x2927('0x4'));var fs=require('fs');var path=require(_0x2927('0x5'));var rimraf=require(_0x2927('0x6'));var config=require(_0x2927('0x7'));var attributes=require(_0x2927('0x8'));module[_0x2927('0x9')]=function(_0x5a800e,_0x11c3ba){return _0x5a800e[_0x2927('0xa')]('VoiceMail',attributes,{'tableName':_0x2927('0xb'),'paranoid':![],'indexes':[{'name':_0x2927('0xc'),'fields':[_0x2927('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 139a36c..1c4d7ea 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 _0xb677=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util'];(function(_0x458b15,_0x8dcc1d){var _0x3aee0c=function(_0x5d0af8){while(--_0x5d0af8){_0x458b15['push'](_0x458b15['shift']());}};_0x3aee0c(++_0x8dcc1d);}(_0xb677,0x83));var _0x7b67=function(_0x35dd06,_0x24cf34){_0x35dd06=_0x35dd06-0x0;var _0x2db3fd=_0xb677[_0x35dd06];return _0x2db3fd;};'use strict';var _=require('lodash');var util=require(_0x7b67('0x0'));var moment=require('moment');var BPromise=require(_0x7b67('0x1'));var rs=require(_0x7b67('0x2'));var fs=require('fs');var Redis=require(_0x7b67('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b67('0x4'));var config=require(_0x7b67('0x5'));var jayson=require(_0x7b67('0x6'));var client=jayson[_0x7b67('0x7')][_0x7b67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2905cd,_0x2fff04,_0x538c31){return new BPromise(function(_0x18cdf1,_0x96fdee){return client[_0x7b67('0x9')](_0x2905cd,_0x538c31)[_0x7b67('0xa')](function(_0x1d0de4){logger[_0x7b67('0xb')]('VoiceMail,\x20%s,\x20%s',_0x2fff04,_0x7b67('0xc'));logger[_0x7b67('0xd')](_0x7b67('0xe'),_0x2fff04,_0x7b67('0xc'),JSON[_0x7b67('0xf')](_0x1d0de4));if(_0x1d0de4['error']){if(_0x1d0de4[_0x7b67('0x10')][_0x7b67('0x11')]===0x1f4){logger[_0x7b67('0x10')](_0x7b67('0x12'),_0x2fff04,_0x1d0de4[_0x7b67('0x10')][_0x7b67('0x13')]);return _0x96fdee(_0x1d0de4['error'][_0x7b67('0x13')]);}logger[_0x7b67('0x10')](_0x7b67('0x12'),_0x2fff04,_0x1d0de4[_0x7b67('0x10')][_0x7b67('0x13')]);return _0x18cdf1(_0x1d0de4[_0x7b67('0x10')][_0x7b67('0x13')]);}else{logger[_0x7b67('0xb')](_0x7b67('0x12'),_0x2fff04,_0x7b67('0xc'));_0x18cdf1(_0x1d0de4[_0x7b67('0x14')]['message']);}})[_0x7b67('0x15')](function(_0x5f349e){logger[_0x7b67('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2fff04,_0x5f349e);_0x96fdee(_0x5f349e);});});} \ No newline at end of file +var _0x3f25=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x17f123,_0x454a02){var _0x7ecdb0=function(_0x44e674){while(--_0x44e674){_0x17f123['push'](_0x17f123['shift']());}};_0x7ecdb0(++_0x454a02);}(_0x3f25,0x178));var _0x53f2=function(_0x420bd4,_0x565ee9){_0x420bd4=_0x420bd4-0x0;var _0x128e3f=_0x3f25[_0x420bd4];return _0x128e3f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x53f2('0x0'));var BPromise=require(_0x53f2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53f2('0x2'));var db=require(_0x53f2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x53f2('0x4'))('rpc');var config=require(_0x53f2('0x5'));var jayson=require(_0x53f2('0x6'));var client=jayson[_0x53f2('0x7')][_0x53f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22e86f,_0x28e5e2,_0x1a203a){return new BPromise(function(_0x16895a,_0x4ff177){return client[_0x53f2('0x9')](_0x22e86f,_0x1a203a)[_0x53f2('0xa')](function(_0x166d96){logger[_0x53f2('0xb')]('VoiceMail,\x20%s,\x20%s',_0x28e5e2,_0x53f2('0xc'));logger[_0x53f2('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x28e5e2,_0x53f2('0xc'),JSON[_0x53f2('0xe')](_0x166d96));if(_0x166d96[_0x53f2('0xf')]){if(_0x166d96[_0x53f2('0xf')][_0x53f2('0x10')]===0x1f4){logger[_0x53f2('0xf')](_0x53f2('0x11'),_0x28e5e2,_0x166d96[_0x53f2('0xf')][_0x53f2('0x12')]);return _0x4ff177(_0x166d96[_0x53f2('0xf')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x28e5e2,_0x166d96['error'][_0x53f2('0x12')]);return _0x16895a(_0x166d96[_0x53f2('0xf')][_0x53f2('0x12')]);}else{logger[_0x53f2('0xb')](_0x53f2('0x11'),_0x28e5e2,_0x53f2('0xc'));_0x16895a(_0x166d96['result']['message']);}})[_0x53f2('0x13')](function(_0x2536ec){logger[_0x53f2('0xf')](_0x53f2('0x11'),_0x28e5e2,_0x2536ec);_0x4ff177(_0x2536ec);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index af4cfc9..28b2f7c 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 _0xedc7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','post','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xedc7,0x1a4));var _0x7edc=function(_0x46bf73,_0x266046){_0x46bf73=_0x46bf73-0x0;var _0x5c1dc6=_0xedc7[_0x46bf73];return _0x5c1dc6;};'use strict';var multer=require(_0x7edc('0x0'));var util=require(_0x7edc('0x1'));var path=require(_0x7edc('0x2'));var timeout=require(_0x7edc('0x3'));var express=require(_0x7edc('0x4'));var router=express[_0x7edc('0x5')]();var fs_extra=require(_0x7edc('0x6'));var auth=require(_0x7edc('0x7'));var interaction=require(_0x7edc('0x8'));var config=require(_0x7edc('0x9'));var controller=require(_0x7edc('0xa'));router[_0x7edc('0xb')]('/',auth[_0x7edc('0xc')](),controller[_0x7edc('0xd')]);router[_0x7edc('0xb')](_0x7edc('0xe'),auth[_0x7edc('0xc')](),controller['show']);router[_0x7edc('0xb')](_0x7edc('0xf'),auth[_0x7edc('0xc')](),controller['download']);router[_0x7edc('0x10')]('/',auth[_0x7edc('0xc')](),controller[_0x7edc('0x11')]);router[_0x7edc('0x12')](_0x7edc('0xe'),auth['isAuthenticated'](),controller[_0x7edc('0x13')]);router['delete'](_0x7edc('0xe'),auth[_0x7edc('0xc')](),controller[_0x7edc('0x14')]);module[_0x7edc('0x15')]=router; \ No newline at end of file +var _0x5eb4=['exports','multer','util','express','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','download','post','create','put','/:id','update','destroy'];(function(_0x1c4f5e,_0x5b672c){var _0x29213a=function(_0x11e4e7){while(--_0x11e4e7){_0x1c4f5e['push'](_0x1c4f5e['shift']());}};_0x29213a(++_0x5b672c);}(_0x5eb4,0x1b1));var _0x45eb=function(_0x5e27ca,_0x3de2a4){_0x5e27ca=_0x5e27ca-0x0;var _0x2d9d11=_0x5eb4[_0x5e27ca];return _0x2d9d11;};'use strict';var multer=require(_0x45eb('0x0'));var util=require(_0x45eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x45eb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x45eb('0x3'));var config=require('../../config/environment');var controller=require(_0x45eb('0x4'));router[_0x45eb('0x5')]('/',auth[_0x45eb('0x6')](),controller[_0x45eb('0x7')]);router[_0x45eb('0x5')]('/:id',auth[_0x45eb('0x6')](),controller['show']);router[_0x45eb('0x5')]('/:id/download',auth[_0x45eb('0x6')](),controller[_0x45eb('0x8')]);router[_0x45eb('0x9')]('/',auth[_0x45eb('0x6')](),controller[_0x45eb('0xa')]);router[_0x45eb('0xb')](_0x45eb('0xc'),auth[_0x45eb('0x6')](),controller[_0x45eb('0xd')]);router['delete'](_0x45eb('0xc'),auth[_0x45eb('0x6')](),controller[_0x45eb('0xe')]);module[_0x45eb('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a59b4b2..3c248bb 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 _0x155b=['INTEGER','STRING','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x155b,0x185));var _0xb155=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0x155b[_0x1ca29f];return _0x576c3b;};'use strict';var Sequelize=require('sequelize');module[_0xb155('0x0')]={'name':{'type':Sequelize[_0xb155('0x1')],'get':function(_0xb5becc){return this[_0xb155('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb155('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xb155('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xb155('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xb155('0x6'),'defaultValue':Sequelize['literal'](_0xb155('0x7'))}}; \ No newline at end of file +var _0xbdf3=['STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x39a7b3,_0x9c5210){var _0x1e25e2=function(_0x530d86){while(--_0x530d86){_0x39a7b3['push'](_0x39a7b3['shift']());}};_0x1e25e2(++_0x9c5210);}(_0xbdf3,0x1cf));var _0x3bdf=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xbdf3[_0x5d7227];return _0x15ac55;};'use strict';var Sequelize=require(_0x3bdf('0x0'));module[_0x3bdf('0x1')]={'name':{'type':Sequelize[_0x3bdf('0x2')],'get':function(_0x531ca1){return this[_0x3bdf('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x3bdf('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3bdf('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x3bdf('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3bdf('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x3bdf('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3bdf('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x3bdf('0x6')](_0x3bdf('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x3bdf('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3bdf('0x5')],'defaultValue':''},'stamp':{'type':_0x3bdf('0x8'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c922fdc..03309ac 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 _0xce6f=['create','body','find','download','recording','msg_id','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','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length'];(function(_0x373d4f,_0x33e53d){var _0x54054d=function(_0x389988){while(--_0x389988){_0x373d4f['push'](_0x373d4f['shift']());}};_0x54054d(++_0x33e53d);}(_0xce6f,0x15d));var _0xfce6=function(_0x5d6ecb,_0x45140a){_0x5d6ecb=_0x5d6ecb-0x0;var _0x3f6324=_0xce6f[_0x5d6ecb];return _0x3f6324;};'use strict';var emlformat=require(_0xfce6('0x0'));var rimraf=require(_0xfce6('0x1'));var zipdir=require(_0xfce6('0x2'));var jsonpatch=require(_0xfce6('0x3'));var rp=require(_0xfce6('0x4'));var moment=require('moment');var BPromise=require(_0xfce6('0x5'));var Mustache=require('mustache');var util=require(_0xfce6('0x6'));var path=require(_0xfce6('0x7'));var sox=require(_0xfce6('0x8'));var csv=require(_0xfce6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfce6('0xa'));var _=require('lodash');var squel=require(_0xfce6('0xb'));var crypto=require('crypto');var jsforce=require(_0xfce6('0xc'));var deskjs=require(_0xfce6('0xd'));var toCsv=require(_0xfce6('0x9'));var querystring=require('querystring');var Papa=require(_0xfce6('0xe'));var Redis=require(_0xfce6('0xf'));var authService=require(_0xfce6('0x10'));var qs=require(_0xfce6('0x11'));var as=require(_0xfce6('0x12'));var hardwareService=require(_0xfce6('0x13'));var logger=require('../../config/logger')(_0xfce6('0x14'));var utils=require(_0xfce6('0x15'));var config=require(_0xfce6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3db79c,_0x2807d3){_0x2807d3=_0x2807d3||0xcc;return function(_0x4d14d8){if(_0x4d14d8){return _0x3db79c[_0xfce6('0x17')](_0x2807d3);}return _0x3db79c[_0xfce6('0x18')](_0x2807d3)[_0xfce6('0x19')]();};}function respondWithResult(_0x1b8869,_0x360750){_0x360750=_0x360750||0xc8;return function(_0x3b0874){if(_0x3b0874){return _0x1b8869[_0xfce6('0x18')](_0x360750)[_0xfce6('0x1a')](_0x3b0874);}};}function respondWithFilteredResult(_0x4b69ee,_0x1eefe7){return function(_0x280f67){if(_0x280f67){var _0x179064=typeof _0x1eefe7[_0xfce6('0x1b')]===_0xfce6('0x1c')&&typeof _0x1eefe7['limit']===_0xfce6('0x1c');var _0x294870=_0x280f67[_0xfce6('0x1d')];var _0x35b662=_0x179064?0x0:_0x1eefe7[_0xfce6('0x1b')];var _0x4285f8=_0x179064?_0x280f67[_0xfce6('0x1d')]:_0x1eefe7[_0xfce6('0x1b')]+_0x1eefe7[_0xfce6('0x1e')];var _0x17dd88;if(_0x4285f8>=_0x294870){_0x4285f8=_0x294870;_0x17dd88=0xc8;}else{_0x17dd88=0xce;}_0x4b69ee['status'](_0x17dd88);return _0x4b69ee[_0xfce6('0x1f')](_0xfce6('0x20'),_0x35b662+'-'+_0x4285f8+'/'+_0x294870)[_0xfce6('0x1a')](_0x280f67);}return null;};}function patchUpdates(_0x3d70f2){return function(_0x19594f){try{jsonpatch[_0xfce6('0x21')](_0x19594f,_0x3d70f2,!![]);}catch(_0x28073b){return BPromise['reject'](_0x28073b);}return _0x19594f[_0xfce6('0x22')]();};}function saveUpdates(_0x15b875,_0x2b5aed){return function(_0x5ced53){if(_0x5ced53){return _0x5ced53[_0xfce6('0x23')](_0x15b875)['then'](function(_0x2fe21a){return _0x2fe21a;});}return null;};}function removeEntity(_0x1696f2,_0x303b8c){return function(_0x43268d){if(_0x43268d){return _0x43268d[_0xfce6('0x24')]()[_0xfce6('0x25')](function(){_0x1696f2[_0xfce6('0x18')](0xcc)[_0xfce6('0x19')]();});}};}function handleEntityNotFound(_0x1a133c,_0x1835b2){return function(_0x218dcb){if(!_0x218dcb){_0x1a133c[_0xfce6('0x17')](0x194);}return _0x218dcb;};}function handleError(_0x152cd2,_0x318b3a){_0x318b3a=_0x318b3a||0x1f4;return function(_0x5ac371){logger[_0xfce6('0x26')](_0x5ac371[_0xfce6('0x27')]);if(_0x5ac371[_0xfce6('0x28')]){delete _0x5ac371[_0xfce6('0x28')];}_0x152cd2['status'](_0x318b3a)[_0xfce6('0x29')](_0x5ac371);};}exports['index']=function(_0x34e77e,_0x1a6e8e){var _0x889917={},_0x18c581={},_0x58cdbf={'count':0x0,'rows':[]};var _0xb71100=_[_0xfce6('0x2a')](db[_0xfce6('0x2b')][_0xfce6('0x2c')],function(_0x361c5b){return{'name':_0x361c5b[_0xfce6('0x2d')],'type':_0x361c5b[_0xfce6('0x2e')][_0xfce6('0x2f')]};});_0x18c581[_0xfce6('0x30')]=_['differenceBy'](_[_0xfce6('0x2a')](_0xb71100,_0xfce6('0x28')),['name']);_0x18c581[_0xfce6('0x31')]=_['keys'](_0x34e77e['query']);_0x18c581[_0xfce6('0x32')]=_[_0xfce6('0x33')](_0x18c581[_0xfce6('0x30')],_0x18c581['query']);_0x889917[_0xfce6('0x34')]=_[_0xfce6('0x33')](_0x18c581['model'],qs[_0xfce6('0x35')](_0x34e77e[_0xfce6('0x31')][_0xfce6('0x35')]));_0x889917[_0xfce6('0x34')]=_0x889917[_0xfce6('0x34')]['length']?_0x889917[_0xfce6('0x34')]:_0x18c581[_0xfce6('0x30')];if(!_0x34e77e[_0xfce6('0x31')][_0xfce6('0x36')]('nolimit')){_0x889917[_0xfce6('0x1e')]=qs[_0xfce6('0x1e')](_0x34e77e[_0xfce6('0x31')]['limit']);_0x889917[_0xfce6('0x1b')]=qs[_0xfce6('0x1b')](_0x34e77e[_0xfce6('0x31')][_0xfce6('0x1b')]);}_0x889917[_0xfce6('0x37')]=qs['sort'](_0x34e77e['query'][_0xfce6('0x38')]);_0x889917[_0xfce6('0x39')]=qs[_0xfce6('0x32')](_['pick'](_0x34e77e[_0xfce6('0x31')],_0x18c581[_0xfce6('0x32')]),_0xb71100);if(_0x34e77e[_0xfce6('0x31')][_0xfce6('0x3a')]){_0x889917[_0xfce6('0x39')]=_[_0xfce6('0x3b')](_0x889917['where'],{'$or':_[_0xfce6('0x2a')](_0xb71100,function(_0x31b5df){if(_0x31b5df[_0xfce6('0x2e')]!==_0xfce6('0x3c')){var _0x51c78a={};_0x51c78a[_0x31b5df['name']]={'$like':'%'+_0x34e77e['query']['filter']+'%'};return _0x51c78a;}})});}_0x889917=_[_0xfce6('0x3b')]({},_0x889917,_0x34e77e[_0xfce6('0x3d')]);var _0x5e32b0={'where':_0x889917[_0xfce6('0x39')]};return db[_0xfce6('0x2b')][_0xfce6('0x1d')](_0x5e32b0)[_0xfce6('0x25')](function(_0x553f02){_0x58cdbf[_0xfce6('0x1d')]=_0x553f02;if(_0x34e77e['query'][_0xfce6('0x3e')]){_0x889917[_0xfce6('0x3f')]=[{'all':!![]}];}return db[_0xfce6('0x2b')][_0xfce6('0x40')](_0x889917);})[_0xfce6('0x25')](function(_0x27abf2){_0x58cdbf[_0xfce6('0x41')]=_0x27abf2;return _0x58cdbf;})[_0xfce6('0x25')](respondWithFilteredResult(_0x1a6e8e,_0x889917))[_0xfce6('0x42')](handleError(_0x1a6e8e,null));};exports[_0xfce6('0x43')]=function(_0x5f1277,_0x2730e2){var _0xa0ff38={'raw':!![],'where':{'id':_0x5f1277[_0xfce6('0x44')]['id']}},_0x3f40d8={};_0x3f40d8[_0xfce6('0x30')]=_[_0xfce6('0x45')](db['VoiceMailMessage'][_0xfce6('0x2c')]);_0x3f40d8[_0xfce6('0x31')]=_[_0xfce6('0x45')](_0x5f1277[_0xfce6('0x31')]);_0x3f40d8['filters']=_[_0xfce6('0x33')](_0x3f40d8[_0xfce6('0x30')],_0x3f40d8[_0xfce6('0x31')]);_0xa0ff38['attributes']=_[_0xfce6('0x33')](_0x3f40d8['model'],qs[_0xfce6('0x35')](_0x5f1277['query'][_0xfce6('0x35')]));_0xa0ff38[_0xfce6('0x34')]=_0xa0ff38[_0xfce6('0x34')][_0xfce6('0x46')]?_0xa0ff38[_0xfce6('0x34')]:_0x3f40d8[_0xfce6('0x30')];if(_0x5f1277[_0xfce6('0x31')][_0xfce6('0x3e')]){_0xa0ff38[_0xfce6('0x3f')]=[{'all':!![]}];}_0xa0ff38=_['merge']({},_0xa0ff38,_0x5f1277[_0xfce6('0x3d')]);return db[_0xfce6('0x2b')]['find'](_0xa0ff38)[_0xfce6('0x25')](handleEntityNotFound(_0x2730e2,null))[_0xfce6('0x25')](respondWithResult(_0x2730e2,null))[_0xfce6('0x42')](handleError(_0x2730e2,null));};exports[_0xfce6('0x47')]=function(_0x24356d,_0x81df70){return db[_0xfce6('0x2b')][_0xfce6('0x47')](_0x24356d[_0xfce6('0x48')],{})[_0xfce6('0x25')](respondWithResult(_0x81df70,0xc9))[_0xfce6('0x42')](handleError(_0x81df70,null));};exports['update']=function(_0x213b2f,_0x1b1a74){if(_0x213b2f[_0xfce6('0x48')]['id']){delete _0x213b2f[_0xfce6('0x48')]['id'];}return db[_0xfce6('0x2b')][_0xfce6('0x49')]({'where':{'id':_0x213b2f[_0xfce6('0x44')]['id']}})[_0xfce6('0x25')](handleEntityNotFound(_0x1b1a74,null))[_0xfce6('0x25')](saveUpdates(_0x213b2f['body'],null))[_0xfce6('0x25')](respondWithResult(_0x1b1a74,null))[_0xfce6('0x42')](handleError(_0x1b1a74,null));};exports[_0xfce6('0x24')]=function(_0x2e2f8c,_0xfea60){return db[_0xfce6('0x2b')][_0xfce6('0x49')]({'where':{'id':_0x2e2f8c['params']['id']}})['then'](handleEntityNotFound(_0xfea60,null))['then'](removeEntity(_0xfea60,null))[_0xfce6('0x42')](handleError(_0xfea60,null));};exports[_0xfce6('0x4a')]=function(_0x3471f8,_0x1b8162,_0xd0a6af){return db[_0xfce6('0x2b')][_0xfce6('0x49')]({'where':{'id':_0x3471f8[_0xfce6('0x44')]['id']},'attributes':['id',_0xfce6('0x4b'),_0xfce6('0x4c')]})[_0xfce6('0x25')](handleEntityNotFound(_0x1b8162,null))[_0xfce6('0x25')](function(_0x41b0ce){if(_0x41b0ce){if(!_0x41b0ce[_0xfce6('0x4b')]){throw new db[(_0xfce6('0x4d'))][(_0xfce6('0x4e'))](_0xfce6('0x4f'));}var _0xaa6309={'Content-Type':'audio/wav','Content-Disposition':_0xfce6('0x50')};if(_0x41b0ce['msg_id']){_0xaa6309[_0xfce6('0x51')]=_0xfce6('0x52')+_0x41b0ce[_0xfce6('0x4c')]+_0xfce6('0x53');}_0x1b8162[_0xfce6('0x1f')](_0xaa6309);return _0x1b8162['send'](new Buffer(_0x41b0ce[_0xfce6('0x4b')]));}})[_0xfce6('0x42')](handleError(_0x1b8162,null));}; \ No newline at end of file +var _0xdcef=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','merge','map','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','download','ValidationError','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','recording','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x244a56,_0x28be9c){var _0x215bcd=function(_0x2e37c1){while(--_0x2e37c1){_0x244a56['push'](_0x244a56['shift']());}};_0x215bcd(++_0x28be9c);}(_0xdcef,0xde));var _0xfdce=function(_0xab69b9,_0xfd9a33){_0xab69b9=_0xab69b9-0x0;var _0x5b78e7=_0xdcef[_0xab69b9];return _0x5b78e7;};'use strict';var emlformat=require(_0xfdce('0x0'));var rimraf=require(_0xfdce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdce('0x2'));var rp=require(_0xfdce('0x3'));var moment=require(_0xfdce('0x4'));var BPromise=require(_0xfdce('0x5'));var Mustache=require('mustache');var util=require(_0xfdce('0x6'));var path=require('path');var sox=require(_0xfdce('0x7'));var csv=require('to-csv');var ejs=require(_0xfdce('0x8'));var fs=require('fs');var fs_extra=require(_0xfdce('0x9'));var _=require(_0xfdce('0xa'));var squel=require(_0xfdce('0xb'));var crypto=require(_0xfdce('0xc'));var jsforce=require(_0xfdce('0xd'));var deskjs=require(_0xfdce('0xe'));var toCsv=require(_0xfdce('0xf'));var querystring=require('querystring');var Papa=require(_0xfdce('0x10'));var Redis=require(_0xfdce('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfdce('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdce('0x13'));var logger=require(_0xfdce('0x14'))('api');var utils=require(_0xfdce('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfdce('0x16'));var db=require(_0xfdce('0x17'))['db'];function respondWithStatusCode(_0x4c452f,_0x1f0add){_0x1f0add=_0x1f0add||0xcc;return function(_0x238385){if(_0x238385){return _0x4c452f[_0xfdce('0x18')](_0x1f0add);}return _0x4c452f[_0xfdce('0x19')](_0x1f0add)[_0xfdce('0x1a')]();};}function respondWithResult(_0x89509f,_0x2afdef){_0x2afdef=_0x2afdef||0xc8;return function(_0x4206f5){if(_0x4206f5){return _0x89509f[_0xfdce('0x19')](_0x2afdef)[_0xfdce('0x1b')](_0x4206f5);}};}function respondWithFilteredResult(_0x195a53,_0x410a60){return function(_0x3f33da){if(_0x3f33da){var _0x14fe1e=typeof _0x410a60[_0xfdce('0x1c')]===_0xfdce('0x1d')&&typeof _0x410a60[_0xfdce('0x1e')]===_0xfdce('0x1d');var _0x3af9b3=_0x3f33da[_0xfdce('0x1f')];var _0x36e7fd=_0x14fe1e?0x0:_0x410a60[_0xfdce('0x1c')];var _0x52905=_0x14fe1e?_0x3f33da[_0xfdce('0x1f')]:_0x410a60['offset']+_0x410a60[_0xfdce('0x1e')];var _0x5e8d6b;if(_0x52905>=_0x3af9b3){_0x52905=_0x3af9b3;_0x5e8d6b=0xc8;}else{_0x5e8d6b=0xce;}_0x195a53['status'](_0x5e8d6b);return _0x195a53[_0xfdce('0x20')](_0xfdce('0x21'),_0x36e7fd+'-'+_0x52905+'/'+_0x3af9b3)[_0xfdce('0x1b')](_0x3f33da);}return null;};}function patchUpdates(_0x3028e1){return function(_0x384339){try{jsonpatch[_0xfdce('0x22')](_0x384339,_0x3028e1,!![]);}catch(_0x393955){return BPromise[_0xfdce('0x23')](_0x393955);}return _0x384339[_0xfdce('0x24')]();};}function saveUpdates(_0xfdc119,_0x3aefd2){return function(_0x3645e0){if(_0x3645e0){return _0x3645e0[_0xfdce('0x25')](_0xfdc119)[_0xfdce('0x26')](function(_0xb49b97){return _0xb49b97;});}return null;};}function removeEntity(_0x41fe94,_0x546d13){return function(_0x528aa4){if(_0x528aa4){return _0x528aa4[_0xfdce('0x27')]()[_0xfdce('0x26')](function(){_0x41fe94['status'](0xcc)[_0xfdce('0x1a')]();});}};}function handleEntityNotFound(_0x2183b6,_0x2600fd){return function(_0x37d527){if(!_0x37d527){_0x2183b6[_0xfdce('0x18')](0x194);}return _0x37d527;};}function handleError(_0x29d0e0,_0x38ec0c){_0x38ec0c=_0x38ec0c||0x1f4;return function(_0x304053){logger[_0xfdce('0x28')](_0x304053[_0xfdce('0x29')]);if(_0x304053['name']){delete _0x304053['name'];}_0x29d0e0['status'](_0x38ec0c)[_0xfdce('0x2a')](_0x304053);};}exports['index']=function(_0x8b6b4a,_0x104485){var _0x1f801c={},_0x586a7c={},_0x55bd18={'count':0x0,'rows':[]};var _0x350b6d=_['map'](db[_0xfdce('0x2b')][_0xfdce('0x2c')],function(_0x4f1a78){return{'name':_0x4f1a78[_0xfdce('0x2d')],'type':_0x4f1a78[_0xfdce('0x2e')][_0xfdce('0x2f')]};});_0x586a7c[_0xfdce('0x30')]=_[_0xfdce('0x31')](_['map'](_0x350b6d,_0xfdce('0x32')),['name']);_0x586a7c[_0xfdce('0x33')]=_[_0xfdce('0x34')](_0x8b6b4a[_0xfdce('0x33')]);_0x586a7c[_0xfdce('0x35')]=_[_0xfdce('0x36')](_0x586a7c[_0xfdce('0x30')],_0x586a7c[_0xfdce('0x33')]);_0x1f801c[_0xfdce('0x37')]=_['intersection'](_0x586a7c[_0xfdce('0x30')],qs[_0xfdce('0x38')](_0x8b6b4a[_0xfdce('0x33')][_0xfdce('0x38')]));_0x1f801c[_0xfdce('0x37')]=_0x1f801c[_0xfdce('0x37')][_0xfdce('0x39')]?_0x1f801c[_0xfdce('0x37')]:_0x586a7c[_0xfdce('0x30')];if(!_0x8b6b4a[_0xfdce('0x33')][_0xfdce('0x3a')](_0xfdce('0x3b'))){_0x1f801c['limit']=qs[_0xfdce('0x1e')](_0x8b6b4a[_0xfdce('0x33')]['limit']);_0x1f801c[_0xfdce('0x1c')]=qs[_0xfdce('0x1c')](_0x8b6b4a[_0xfdce('0x33')]['offset']);}_0x1f801c['order']=qs['sort'](_0x8b6b4a[_0xfdce('0x33')]['sort']);_0x1f801c[_0xfdce('0x3c')]=qs['filters'](_['pick'](_0x8b6b4a[_0xfdce('0x33')],_0x586a7c['filters']),_0x350b6d);if(_0x8b6b4a[_0xfdce('0x33')]['filter']){_0x1f801c[_0xfdce('0x3c')]=_[_0xfdce('0x3d')](_0x1f801c['where'],{'$or':_[_0xfdce('0x3e')](_0x350b6d,function(_0x6b3d2e){if(_0x6b3d2e[_0xfdce('0x2e')]!==_0xfdce('0x3f')){var _0x4d80dd={};_0x4d80dd[_0x6b3d2e[_0xfdce('0x32')]]={'$like':'%'+_0x8b6b4a[_0xfdce('0x33')][_0xfdce('0x40')]+'%'};return _0x4d80dd;}})});}_0x1f801c=_['merge']({},_0x1f801c,_0x8b6b4a[_0xfdce('0x41')]);var _0x382eb5={'where':_0x1f801c[_0xfdce('0x3c')]};return db[_0xfdce('0x2b')][_0xfdce('0x1f')](_0x382eb5)[_0xfdce('0x26')](function(_0x314474){_0x55bd18[_0xfdce('0x1f')]=_0x314474;if(_0x8b6b4a[_0xfdce('0x33')]['includeAll']){_0x1f801c[_0xfdce('0x42')]=[{'all':!![]}];}return db[_0xfdce('0x2b')]['findAll'](_0x1f801c);})[_0xfdce('0x26')](function(_0x33ae18){_0x55bd18[_0xfdce('0x43')]=_0x33ae18;return _0x55bd18;})[_0xfdce('0x26')](respondWithFilteredResult(_0x104485,_0x1f801c))[_0xfdce('0x44')](handleError(_0x104485,null));};exports[_0xfdce('0x45')]=function(_0xf019b9,_0x3be9a5){var _0x3acbbc={'raw':!![],'where':{'id':_0xf019b9[_0xfdce('0x46')]['id']}},_0x11eb9f={};_0x11eb9f[_0xfdce('0x30')]=_[_0xfdce('0x34')](db[_0xfdce('0x2b')]['rawAttributes']);_0x11eb9f[_0xfdce('0x33')]=_[_0xfdce('0x34')](_0xf019b9[_0xfdce('0x33')]);_0x11eb9f['filters']=_[_0xfdce('0x36')](_0x11eb9f[_0xfdce('0x30')],_0x11eb9f[_0xfdce('0x33')]);_0x3acbbc['attributes']=_[_0xfdce('0x36')](_0x11eb9f['model'],qs[_0xfdce('0x38')](_0xf019b9[_0xfdce('0x33')]['fields']));_0x3acbbc[_0xfdce('0x37')]=_0x3acbbc[_0xfdce('0x37')]['length']?_0x3acbbc[_0xfdce('0x37')]:_0x11eb9f[_0xfdce('0x30')];if(_0xf019b9[_0xfdce('0x33')][_0xfdce('0x47')]){_0x3acbbc['include']=[{'all':!![]}];}_0x3acbbc=_[_0xfdce('0x3d')]({},_0x3acbbc,_0xf019b9[_0xfdce('0x41')]);return db[_0xfdce('0x2b')][_0xfdce('0x48')](_0x3acbbc)[_0xfdce('0x26')](handleEntityNotFound(_0x3be9a5,null))[_0xfdce('0x26')](respondWithResult(_0x3be9a5,null))[_0xfdce('0x44')](handleError(_0x3be9a5,null));};exports[_0xfdce('0x49')]=function(_0x51280e,_0x218648){return db[_0xfdce('0x2b')][_0xfdce('0x49')](_0x51280e[_0xfdce('0x4a')],{})[_0xfdce('0x26')](respondWithResult(_0x218648,0xc9))[_0xfdce('0x44')](handleError(_0x218648,null));};exports['update']=function(_0x4e2dbb,_0x426781){if(_0x4e2dbb[_0xfdce('0x4a')]['id']){delete _0x4e2dbb[_0xfdce('0x4a')]['id'];}return db[_0xfdce('0x2b')][_0xfdce('0x48')]({'where':{'id':_0x4e2dbb['params']['id']}})['then'](handleEntityNotFound(_0x426781,null))[_0xfdce('0x26')](saveUpdates(_0x4e2dbb['body'],null))[_0xfdce('0x26')](respondWithResult(_0x426781,null))[_0xfdce('0x44')](handleError(_0x426781,null));};exports[_0xfdce('0x27')]=function(_0x38de2a,_0xbd8957){return db[_0xfdce('0x2b')][_0xfdce('0x48')]({'where':{'id':_0x38de2a[_0xfdce('0x46')]['id']}})[_0xfdce('0x26')](handleEntityNotFound(_0xbd8957,null))['then'](removeEntity(_0xbd8957,null))[_0xfdce('0x44')](handleError(_0xbd8957,null));};exports[_0xfdce('0x4b')]=function(_0x2055f2,_0x55d1a4,_0x3197a0){return db[_0xfdce('0x2b')]['find']({'where':{'id':_0x2055f2[_0xfdce('0x46')]['id']},'attributes':['id','recording','msg_id']})[_0xfdce('0x26')](handleEntityNotFound(_0x55d1a4,null))[_0xfdce('0x26')](function(_0x4db36f){if(_0x4db36f){if(!_0x4db36f['recording']){throw new db['Sequelize'][(_0xfdce('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x5d8db5={'Content-Type':_0xfdce('0x4d'),'Content-Disposition':_0xfdce('0x4e')};if(_0x4db36f[_0xfdce('0x4f')]){_0x5d8db5[_0xfdce('0x50')]=_0xfdce('0x51')+_0x4db36f['msg_id']+'.wav\x22';}_0x55d1a4['set'](_0x5d8db5);return _0x55d1a4[_0xfdce('0x2a')](new Buffer(_0x4db36f[_0xfdce('0x52')]));}})[_0xfdce('0x44')](handleError(_0x55d1a4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c012c41..828f002 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 _0xc432=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes'];(function(_0x59e10e,_0x3c4734){var _0x2babd7=function(_0x2bd451){while(--_0x2bd451){_0x59e10e['push'](_0x59e10e['shift']());}};_0x2babd7(++_0x3c4734);}(_0xc432,0x15f));var _0x2c43=function(_0x4d30ec,_0x692b10){_0x4d30ec=_0x4d30ec-0x0;var _0x3717b6=_0xc432[_0x4d30ec];return _0x3717b6;};'use strict';var _=require(_0x2c43('0x0'));var util=require('util');var logger=require(_0x2c43('0x1'))(_0x2c43('0x2'));var moment=require(_0x2c43('0x3'));var BPromise=require(_0x2c43('0x4'));var rp=require(_0x2c43('0x5'));var fs=require('fs');var path=require(_0x2c43('0x6'));var rimraf=require(_0x2c43('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c43('0x8'));module['exports']=function(_0x834adf,_0x3b693c){return _0x834adf['define'](_0x2c43('0x9'),attributes,{'tableName':_0x2c43('0xa'),'paranoid':![],'indexes':[{'name':_0x2c43('0xb'),'fields':[_0x2c43('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4a21=['define','VoiceMailMessage','voice_voicemail_messages','dir','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x48e56b,_0x485a06){var _0x4dd14f=function(_0x28c6da){while(--_0x28c6da){_0x48e56b['push'](_0x48e56b['shift']());}};_0x4dd14f(++_0x485a06);}(_0x4a21,0x190));var _0x14a2=function(_0x203b5c,_0x2384f1){_0x203b5c=_0x203b5c-0x0;var _0x20a057=_0x4a21[_0x203b5c];return _0x20a057;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14a2('0x0'))(_0x14a2('0x1'));var moment=require(_0x14a2('0x2'));var BPromise=require('bluebird');var rp=require(_0x14a2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14a2('0x4'));var config=require(_0x14a2('0x5'));var attributes=require(_0x14a2('0x6'));module['exports']=function(_0x5df2a3,_0x372972){return _0x5df2a3[_0x14a2('0x7')](_0x14a2('0x8'),attributes,{'tableName':_0x14a2('0x9'),'paranoid':![],'indexes':[{'name':_0x14a2('0xa'),'fields':[_0x14a2('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f0ea43e..5ea9ea5 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 _0x392f=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x392f,0x163));var _0xf392=function(_0x3f758f,_0x302451){_0x3f758f=_0x3f758f-0x0;var _0x26e4ae=_0x392f[_0x3f758f];return _0x26e4ae;};'use strict';var _=require(_0xf392('0x0'));var util=require(_0xf392('0x1'));var moment=require(_0xf392('0x2'));var BPromise=require(_0xf392('0x3'));var rs=require(_0xf392('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf392('0x5'));var logger=require('../../config/logger')(_0xf392('0x6'));var config=require(_0xf392('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf392('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21e3dc,_0x599fd8,_0x211737){return new BPromise(function(_0x394ab6,_0x4b2933){return client[_0xf392('0x9')](_0x21e3dc,_0x211737)[_0xf392('0xa')](function(_0x2360a6){logger[_0xf392('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x599fd8,'request\x20sent');logger[_0xf392('0xc')](_0xf392('0xd'),_0x599fd8,_0xf392('0xe'),JSON['stringify'](_0x2360a6));if(_0x2360a6[_0xf392('0xf')]){if(_0x2360a6['error'][_0xf392('0x10')]===0x1f4){logger['error'](_0xf392('0x11'),_0x599fd8,_0x2360a6[_0xf392('0xf')]['message']);return _0x4b2933(_0x2360a6[_0xf392('0xf')][_0xf392('0x12')]);}logger[_0xf392('0xf')](_0xf392('0x11'),_0x599fd8,_0x2360a6['error']['message']);return _0x394ab6(_0x2360a6[_0xf392('0xf')][_0xf392('0x12')]);}else{logger[_0xf392('0xb')](_0xf392('0x11'),_0x599fd8,_0xf392('0xe'));_0x394ab6(_0x2360a6[_0xf392('0x13')][_0xf392('0x12')]);}})[_0xf392('0x14')](function(_0x42a61e){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x599fd8,_0x42a61e);_0x4b2933(_0x42a61e);});});} \ No newline at end of file +var _0x3592=['request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x560e4c,_0x29fbf3){var _0x90c330=function(_0x3b08b7){while(--_0x3b08b7){_0x560e4c['push'](_0x560e4c['shift']());}};_0x90c330(++_0x29fbf3);}(_0x3592,0x11c));var _0x2359=function(_0x259abe,_0x15721c){_0x259abe=_0x259abe-0x0;var _0x10d51c=_0x3592[_0x259abe];return _0x10d51c;};'use strict';var _=require(_0x2359('0x0'));var util=require(_0x2359('0x1'));var moment=require(_0x2359('0x2'));var BPromise=require(_0x2359('0x3'));var rs=require(_0x2359('0x4'));var fs=require('fs');var Redis=require(_0x2359('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2359('0x6'));var logger=require(_0x2359('0x7'))(_0x2359('0x8'));var config=require(_0x2359('0x9'));var jayson=require(_0x2359('0xa'));var client=jayson[_0x2359('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43929e,_0xff13d5,_0x48afb4){return new BPromise(function(_0x24961c,_0x2b5b31){return client['request'](_0x43929e,_0x48afb4)[_0x2359('0xc')](function(_0xf527be){logger[_0x2359('0xd')](_0x2359('0xe'),_0xff13d5,_0x2359('0xf'));logger[_0x2359('0x10')](_0x2359('0x11'),_0xff13d5,_0x2359('0xf'),JSON[_0x2359('0x12')](_0xf527be));if(_0xf527be['error']){if(_0xf527be[_0x2359('0x13')][_0x2359('0x14')]===0x1f4){logger[_0x2359('0x13')](_0x2359('0xe'),_0xff13d5,_0xf527be[_0x2359('0x13')][_0x2359('0x15')]);return _0x2b5b31(_0xf527be[_0x2359('0x13')][_0x2359('0x15')]);}logger['error'](_0x2359('0xe'),_0xff13d5,_0xf527be[_0x2359('0x13')][_0x2359('0x15')]);return _0x24961c(_0xf527be[_0x2359('0x13')]['message']);}else{logger['info'](_0x2359('0xe'),_0xff13d5,_0x2359('0xf'));_0x24961c(_0xf527be['result']['message']);}})[_0x2359('0x16')](function(_0x2a9a36){logger[_0x2359('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0xff13d5,_0x2a9a36);_0x2b5b31(_0x2a9a36);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e4cb179..d32a65a 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 _0xe260=['/:id/sounds/:id2','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','put','/:id','update','delete','destroy'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe260,0x1e5));var _0x0e26=function(_0xd945e9,_0x1613fb){_0xd945e9=_0xd945e9-0x0;var _0x1cc918=_0xe260[_0xd945e9];return _0x1cc918;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0e26('0x0'));var express=require(_0x0e26('0x1'));var router=express[_0x0e26('0x2')]();var fs_extra=require(_0x0e26('0x3'));var auth=require(_0x0e26('0x4'));var interaction=require(_0x0e26('0x5'));var config=require(_0x0e26('0x6'));var controller=require(_0x0e26('0x7'));router[_0x0e26('0x8')]('/',auth[_0x0e26('0x9')](),controller[_0x0e26('0xa')]);router[_0x0e26('0x8')]('/:id',auth[_0x0e26('0x9')](),controller[_0x0e26('0xb')]);router[_0x0e26('0x8')](_0x0e26('0xc'),auth['isAuthenticated'](),controller[_0x0e26('0xd')]);router[_0x0e26('0xe')]('/',auth[_0x0e26('0x9')](),controller[_0x0e26('0xf')]);router[_0x0e26('0xe')](_0x0e26('0xc'),auth['isAuthenticated'](),controller['addSound']);router[_0x0e26('0x10')](_0x0e26('0x11'),auth[_0x0e26('0x9')](),controller[_0x0e26('0x12')]);router[_0x0e26('0x13')](_0x0e26('0x11'),auth[_0x0e26('0x9')](),controller[_0x0e26('0x14')]);router[_0x0e26('0x13')](_0x0e26('0x15'),auth[_0x0e26('0x9')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0xaac1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x382b1f,_0x599e2d){var _0x1663d6=function(_0x37564e){while(--_0x37564e){_0x382b1f['push'](_0x382b1f['shift']());}};_0x1663d6(++_0x599e2d);}(_0xaac1,0x18f));var _0x1aac=function(_0x406c0e,_0x126ef1){_0x406c0e=_0x406c0e-0x0;var _0x52626a=_0xaac1[_0x406c0e];return _0x52626a;};'use strict';var multer=require(_0x1aac('0x0'));var util=require(_0x1aac('0x1'));var path=require(_0x1aac('0x2'));var timeout=require(_0x1aac('0x3'));var express=require('express');var router=express[_0x1aac('0x4')]();var fs_extra=require(_0x1aac('0x5'));var auth=require(_0x1aac('0x6'));var interaction=require(_0x1aac('0x7'));var config=require(_0x1aac('0x8'));var controller=require(_0x1aac('0x9'));router[_0x1aac('0xa')]('/',auth[_0x1aac('0xb')](),controller[_0x1aac('0xc')]);router['get'](_0x1aac('0xd'),auth['isAuthenticated'](),controller[_0x1aac('0xe')]);router[_0x1aac('0xa')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x1aac('0xf')]);router[_0x1aac('0x10')]('/',auth['isAuthenticated'](),controller[_0x1aac('0x11')]);router[_0x1aac('0x10')](_0x1aac('0x12'),auth['isAuthenticated'](),controller[_0x1aac('0x13')]);router[_0x1aac('0x14')](_0x1aac('0xd'),auth['isAuthenticated'](),controller[_0x1aac('0x15')]);router[_0x1aac('0x16')](_0x1aac('0xd'),auth['isAuthenticated'](),controller[_0x1aac('0x17')]);router['delete'](_0x1aac('0x18'),auth[_0x1aac('0xb')](),controller[_0x1aac('0x19')]);module[_0x1aac('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index fd3debc..c9e05e4 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 _0xcca5=['name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','sequelize','exports','STRING'];(function(_0x425143,_0x3b3a64){var _0x5bba0a=function(_0xaafdb9){while(--_0xaafdb9){_0x425143['push'](_0x425143['shift']());}};_0x5bba0a(++_0x3b3a64);}(_0xcca5,0x171));var _0x5cca=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0xcca5[_0x28e2cd];return _0x11fd46;};'use strict';var Sequelize=require(_0x5cca('0x0'));module[_0x5cca('0x1')]={'name':{'type':Sequelize[_0x5cca('0x2')],'allowNull':![],'unique':_0x5cca('0x3')},'mode':{'type':Sequelize[_0x5cca('0x4')](_0x5cca('0x5'),_0x5cca('0x6'),_0x5cca('0x7'),_0x5cca('0x8'),_0x5cca('0x9'),_0x5cca('0xa')),'allowNull':!![],'defaultValue':_0x5cca('0x6')},'directory':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![],'defaultValue':_0x5cca('0xb')},'format':{'type':Sequelize[_0x5cca('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xac76=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x5a3f93,_0x3cd13d){var _0x155ea2=function(_0x13fb57){while(--_0x13fb57){_0x5a3f93['push'](_0x5a3f93['shift']());}};_0x155ea2(++_0x3cd13d);}(_0xac76,0x189));var _0x6ac7=function(_0x246e1a,_0x30ee98){_0x246e1a=_0x246e1a-0x0;var _0x19a13c=_0xac76[_0x246e1a];return _0x19a13c;};'use strict';var Sequelize=require(_0x6ac7('0x0'));module[_0x6ac7('0x1')]={'name':{'type':Sequelize[_0x6ac7('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x6ac7('0x3')](_0x6ac7('0x4'),_0x6ac7('0x5'),_0x6ac7('0x6'),_0x6ac7('0x7'),_0x6ac7('0x8'),_0x6ac7('0x9')),'allowNull':!![],'defaultValue':_0x6ac7('0x5')},'directory':{'type':Sequelize[_0x6ac7('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x6ac7('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6ac7('0x2')],'allowNull':!![],'defaultValue':_0x6ac7('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x6ac7('0xb')},'defaultEntry':{'type':Sequelize[_0x6ac7('0xc')],'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 ebe42cc..b018428 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 _0x773d=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','length','include','find','catch','body','params','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','extname','symlinkSync','ValidationError','removeSound','id2','getSounds','eml-format','rimraf','zip-dir'];(function(_0x4e11fc,_0x2602e){var _0x398c4f=function(_0xa9e3dc){while(--_0xa9e3dc){_0x4e11fc['push'](_0x4e11fc['shift']());}};_0x398c4f(++_0x2602e);}(_0x773d,0x159));var _0xd773=function(_0x1decc0,_0x2b7dc6){_0x1decc0=_0x1decc0-0x0;var _0x23b8a7=_0x773d[_0x1decc0];return _0x23b8a7;};'use strict';var emlformat=require(_0xd773('0x0'));var rimraf=require(_0xd773('0x1'));var zipdir=require(_0xd773('0x2'));var jsonpatch=require(_0xd773('0x3'));var rp=require(_0xd773('0x4'));var moment=require(_0xd773('0x5'));var BPromise=require(_0xd773('0x6'));var Mustache=require(_0xd773('0x7'));var util=require(_0xd773('0x8'));var path=require(_0xd773('0x9'));var sox=require(_0xd773('0xa'));var csv=require(_0xd773('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd773('0xc'));var _=require('lodash');var squel=require(_0xd773('0xd'));var crypto=require(_0xd773('0xe'));var jsforce=require(_0xd773('0xf'));var deskjs=require(_0xd773('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd773('0x11'));var Redis=require(_0xd773('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd773('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd773('0x14'));var logger=require(_0xd773('0x15'))(_0xd773('0x16'));var utils=require(_0xd773('0x17'));var config=require(_0xd773('0x18'));var licenseUtil=require(_0xd773('0x19'));var db=require(_0xd773('0x1a'))['db'];function respondWithStatusCode(_0x31a1e8,_0x3f29a4){_0x3f29a4=_0x3f29a4||0xcc;return function(_0x31a3ba){if(_0x31a3ba){return _0x31a1e8[_0xd773('0x1b')](_0x3f29a4);}return _0x31a1e8['status'](_0x3f29a4)[_0xd773('0x1c')]();};}function respondWithResult(_0x329b22,_0x3636e5){_0x3636e5=_0x3636e5||0xc8;return function(_0x43c60b){if(_0x43c60b){return _0x329b22[_0xd773('0x1d')](_0x3636e5)[_0xd773('0x1e')](_0x43c60b);}};}function respondWithFilteredResult(_0xabcec6,_0x1a1954){return function(_0x4f4a54){if(_0x4f4a54){var _0x36683b=typeof _0x1a1954[_0xd773('0x1f')]==='undefined'&&typeof _0x1a1954[_0xd773('0x20')]===_0xd773('0x21');var _0x3848e7=_0x4f4a54['count'];var _0x3f54d6=_0x36683b?0x0:_0x1a1954[_0xd773('0x1f')];var _0x22b6f7=_0x36683b?_0x4f4a54['count']:_0x1a1954[_0xd773('0x1f')]+_0x1a1954[_0xd773('0x20')];var _0x4041e0;if(_0x22b6f7>=_0x3848e7){_0x22b6f7=_0x3848e7;_0x4041e0=0xc8;}else{_0x4041e0=0xce;}_0xabcec6['status'](_0x4041e0);return _0xabcec6[_0xd773('0x22')]('Content-Range',_0x3f54d6+'-'+_0x22b6f7+'/'+_0x3848e7)['json'](_0x4f4a54);}return null;};}function patchUpdates(_0x28d899){return function(_0x138418){try{jsonpatch[_0xd773('0x23')](_0x138418,_0x28d899,!![]);}catch(_0x4def8a){return BPromise[_0xd773('0x24')](_0x4def8a);}return _0x138418[_0xd773('0x25')]();};}function saveUpdates(_0x471c2a,_0x4ef4b5){return function(_0x55f22b){if(_0x55f22b){return _0x55f22b[_0xd773('0x26')](_0x471c2a)[_0xd773('0x27')](function(_0x38c007){return _0x38c007;});}return null;};}function removeEntity(_0xdacc29,_0x53261e){return function(_0x4dda7b){if(_0x4dda7b){return _0x4dda7b[_0xd773('0x28')]()['then'](function(){var _0x358df3=_0x4dda7b[_0xd773('0x29')]({'plain':!![]});var _0x399183=_0xd773('0x2a');return db[_0xd773('0x2b')]['destroy']({'where':{'type':_0x399183,'resourceId':_0x358df3['id']}})[_0xd773('0x27')](function(){return _0x4dda7b;});})[_0xd773('0x27')](function(){_0xdacc29[_0xd773('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c6d2a,_0x14612c){return function(_0x35359){if(!_0x35359){_0x4c6d2a[_0xd773('0x1b')](0x194);}return _0x35359;};}function handleError(_0x33fa3c,_0x389aac){_0x389aac=_0x389aac||0x1f4;return function(_0x3067a4){logger[_0xd773('0x2c')](_0x3067a4[_0xd773('0x2d')]);if(_0x3067a4[_0xd773('0x2e')]){delete _0x3067a4['name'];}_0x33fa3c['status'](_0x389aac)['send'](_0x3067a4);};}exports[_0xd773('0x2f')]=function(_0xdcd737,_0xb4dc0f){var _0x104f9e={},_0x3d3943={},_0x58e166={'count':0x0,'rows':[]};var _0xea5016=_[_0xd773('0x30')](db[_0xd773('0x31')][_0xd773('0x32')],function(_0x259cc8){return{'name':_0x259cc8[_0xd773('0x33')],'type':_0x259cc8[_0xd773('0x34')]['key']};});_0x3d3943[_0xd773('0x35')]=_[_0xd773('0x30')](_0xea5016,_0xd773('0x2e'));_0x3d3943[_0xd773('0x36')]=_[_0xd773('0x37')](_0xdcd737['query']);_0x3d3943[_0xd773('0x38')]=_[_0xd773('0x39')](_0x3d3943[_0xd773('0x35')],_0x3d3943[_0xd773('0x36')]);_0x104f9e[_0xd773('0x3a')]=_[_0xd773('0x39')](_0x3d3943['model'],qs[_0xd773('0x3b')](_0xdcd737[_0xd773('0x36')][_0xd773('0x3b')]));_0x104f9e['attributes']=_0x104f9e[_0xd773('0x3a')]['length']?_0x104f9e[_0xd773('0x3a')]:_0x3d3943[_0xd773('0x35')];if(!_0xdcd737[_0xd773('0x36')][_0xd773('0x3c')](_0xd773('0x3d'))){_0x104f9e[_0xd773('0x20')]=qs[_0xd773('0x20')](_0xdcd737[_0xd773('0x36')]['limit']);_0x104f9e[_0xd773('0x1f')]=qs[_0xd773('0x1f')](_0xdcd737[_0xd773('0x36')][_0xd773('0x1f')]);}_0x104f9e[_0xd773('0x3e')]=qs['sort'](_0xdcd737[_0xd773('0x36')]['sort']);delete _0xdcd737[_0xd773('0x36')][_0xd773('0x3f')];_0x104f9e[_0xd773('0x40')]=qs['filters'](_[_0xd773('0x41')](_0xdcd737[_0xd773('0x36')],_0x3d3943[_0xd773('0x38')]),_0xea5016);if(_0xdcd737['query'][_0xd773('0x42')]){_0x104f9e[_0xd773('0x40')]=_[_0xd773('0x43')](_0x104f9e[_0xd773('0x40')],{'$or':_[_0xd773('0x30')](_0xea5016,function(_0x53ccef){if(_0x53ccef[_0xd773('0x34')]!==_0xd773('0x44')){var _0x41de26={};_0x41de26[_0x53ccef[_0xd773('0x2e')]]={'$like':'%'+_0xdcd737[_0xd773('0x36')][_0xd773('0x42')]+'%'};return _0x41de26;}})});}_0x104f9e=_[_0xd773('0x43')]({},_0x104f9e,_0xdcd737[_0xd773('0x45')]);var _0x421ca2={'where':_0x104f9e[_0xd773('0x40')]};return db['VoiceMusicOnHold'][_0xd773('0x46')](_0x421ca2)[_0xd773('0x27')](function(_0xf5e10f){_0x58e166[_0xd773('0x46')]=_0xf5e10f;if(_0xdcd737[_0xd773('0x36')][_0xd773('0x47')]){_0x104f9e['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xd773('0x48')](_0x104f9e);})[_0xd773('0x27')](function(_0x5d79e5){_0x58e166[_0xd773('0x49')]=_0x5d79e5;return _0x58e166;})[_0xd773('0x27')](respondWithFilteredResult(_0xb4dc0f,_0x104f9e))['catch'](handleError(_0xb4dc0f,null));};exports[_0xd773('0x4a')]=function(_0x37c87f,_0x438350){var _0x267955={'raw':![],'where':{'id':_0x37c87f['params']['id']}},_0x41ceca={};_0x41ceca[_0xd773('0x35')]=_['keys'](db[_0xd773('0x31')][_0xd773('0x32')]);_0x41ceca[_0xd773('0x36')]=_[_0xd773('0x37')](_0x37c87f[_0xd773('0x36')]);_0x41ceca['filters']=_[_0xd773('0x39')](_0x41ceca['model'],_0x41ceca[_0xd773('0x36')]);_0x267955[_0xd773('0x3a')]=_[_0xd773('0x39')](_0x41ceca['model'],qs[_0xd773('0x3b')](_0x37c87f[_0xd773('0x36')][_0xd773('0x3b')]));_0x267955['attributes']=_0x267955[_0xd773('0x3a')][_0xd773('0x4b')]?_0x267955[_0xd773('0x3a')]:_0x41ceca[_0xd773('0x35')];if(_0x37c87f[_0xd773('0x36')][_0xd773('0x47')]){_0x267955[_0xd773('0x4c')]=[{'all':!![]}];}_0x267955=_[_0xd773('0x43')]({},_0x267955,_0x37c87f[_0xd773('0x45')]);return db[_0xd773('0x31')][_0xd773('0x4d')](_0x267955)[_0xd773('0x27')](handleEntityNotFound(_0x438350,null))[_0xd773('0x27')](respondWithResult(_0x438350,null))[_0xd773('0x4e')](handleError(_0x438350,null));};exports[_0xd773('0x26')]=function(_0x390e1e,_0x142ebb){if(_0x390e1e['body']['id']){delete _0x390e1e[_0xd773('0x4f')]['id'];}return db[_0xd773('0x31')][_0xd773('0x4d')]({'where':{'id':_0x390e1e[_0xd773('0x50')]['id']}})[_0xd773('0x27')](handleEntityNotFound(_0x142ebb,null))[_0xd773('0x27')](saveUpdates(_0x390e1e[_0xd773('0x4f')],null))[_0xd773('0x27')](respondWithResult(_0x142ebb,null))[_0xd773('0x4e')](handleError(_0x142ebb,null));};exports[_0xd773('0x51')]=function(_0x165cec,_0x18798a,_0x141a4f){return db[_0xd773('0x52')][_0xd773('0x53')](function(_0x3bae42){if(_0x165cec[_0xd773('0x4f')][_0xd773('0x54')]==='files'){_0x165cec['body'][_0xd773('0x55')]=path[_0xd773('0x56')](config[_0xd773('0x57')],_0xd773('0x58'),_0x165cec[_0xd773('0x4f')]['name']);}return db[_0xd773('0x31')][_0xd773('0x51')](_0x165cec[_0xd773('0x4f')],{'transaction':_0x3bae42})[_0xd773('0x27')](function(_0x1f2833){if(_0x165cec[_0xd773('0x4f')][_0xd773('0x54')]===_0xd773('0x59')){fs['mkdirSync'](_0x1f2833[_0xd773('0x55')],parseInt('0777',0x8));}var _0x55d863=_0x165cec[_0xd773('0x5a')][_0xd773('0x29')]({'plain':!![]});if(!_0x55d863)throw new Error(_0xd773('0x5b'));if(_0x55d863[_0xd773('0x5c')]===_0xd773('0x5a')){var _0x3c0989=_0x1f2833[_0xd773('0x29')]({'plain':!![]});return db[_0xd773('0x5d')][_0xd773('0x4d')]({'where':{'name':_0xd773('0x2a'),'userProfileId':_0x55d863[_0xd773('0x5e')]},'raw':!![]})[_0xd773('0x27')](function(_0x266c9c){if(_0x266c9c&&_0x266c9c['autoAssociation']===0x0){return db[_0xd773('0x2b')]['create']({'name':_0x3c0989['name'],'resourceId':_0x3c0989['id'],'type':_0x266c9c['name'],'sectionId':_0x266c9c['id']},{})['then'](function(){return _0x1f2833;});}else{return _0x1f2833;}})['catch'](function(_0x58f9da){logger[_0xd773('0x2c')](_0xd773('0x5f'),_0x58f9da);});}return _0x1f2833;});})['then'](respondWithResult(_0x18798a,0xc9))['catch'](handleError(_0x18798a,null));};exports[_0xd773('0x28')]=function(_0x3b526a,_0x3e63d5,_0x360b4c){var _0x5e0add;return db[_0xd773('0x31')][_0xd773('0x4d')]({'where':{'id':_0x3b526a[_0xd773('0x50')]['id']}})[_0xd773('0x27')](function(_0x4976b7){if(_0x4976b7){return db[_0xd773('0x52')][_0xd773('0x53')](function(_0x3c79af){return _0x4976b7[_0xd773('0x28')]({'transaction':_0x3c79af,'raw':!![]})[_0xd773('0x27')](function(_0xc17399){if(_0xc17399[_0xd773('0x55')]){fs[_0xd773('0x60')](_0xc17399['directory'])[_0xd773('0x61')](function(_0x10a53d){fs[_0xd773('0x62')](path[_0xd773('0x56')](_0xc17399[_0xd773('0x55')],_0x10a53d));});fs[_0xd773('0x63')](_0xc17399[_0xd773('0x55')]);}return _0xc17399;});})['catch'](function(_0x45effb){throw new db[(_0xd773('0x64'))]['ValidationError'](_0x45effb[_0xd773('0x65')]);});}})[_0xd773('0x27')](handleEntityNotFound(_0x3e63d5,null))[_0xd773('0x27')](removeEntity(_0x3e63d5,null))[_0xd773('0x4e')](handleError(_0x3e63d5,null));};exports['addSound']=function(_0xb40497,_0x7022e5,_0x2c2c05){return db[_0xd773('0x52')][_0xd773('0x53')](function(_0x1c594a){var _0x2d7170;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xb40497[_0xd773('0x50')]['id']}})['then'](function(_0x59ce36){if(_0x59ce36){_0x2d7170=_0x59ce36;return _0x59ce36[_0xd773('0x66')](_0xb40497[_0xd773('0x4f')]['id'],{'transaction':_0x1c594a});}})[_0xd773('0x27')](function(_0x3864ec){if(_0x3864ec){return db[_0xd773('0x67')][_0xd773('0x68')]({'where':{'id':_0xb40497[_0xd773('0x4f')]['id']},'attributes':['id','name',_0xd773('0x69'),_0xd773('0x6a'),_0xd773('0x6b')],'raw':!![]});}})[_0xd773('0x27')](function(_0x8c2589){if(_0x8c2589){var _0x511a8c=path['join'](config['root'],_0xd773('0x6c'),util['format'](_0xd773('0x6d'),path['basename'](_0x8c2589[_0xd773('0x69')],path[_0xd773('0x6e')](_0x8c2589['save_name'])),_0x8c2589['converted_format']));var _0x1d40cb=path[_0xd773('0x56')](config['root'],_0xd773('0x58'),_0x2d7170[_0xd773('0x2e')],util['format'](_0xd773('0x6d'),_0x8c2589[_0xd773('0x2e')],_0x8c2589[_0xd773('0x6a')]));fs[_0xd773('0x6f')](_0x511a8c,_0x1d40cb);return _0x8c2589;}})['catch'](function(_0x3941e6){throw new db['Sequelize'][(_0xd773('0x70'))](_0x3941e6[_0xd773('0x65')]);});})['then'](handleEntityNotFound(_0x7022e5,null))['then'](respondWithResult(_0x7022e5,0xc9))['catch'](handleError(_0x7022e5,null));};exports[_0xd773('0x71')]=function(_0x382a1a,_0x21a59e,_0x4f0f54){return db['sequelize'][_0xd773('0x53')](function(_0x37dacd){var _0x3b3988;return db[_0xd773('0x31')][_0xd773('0x68')]({'where':{'id':_0x382a1a[_0xd773('0x50')]['id']}})[_0xd773('0x27')](handleEntityNotFound(_0x21a59e,null))[_0xd773('0x27')](function(_0x17e515){if(_0x17e515){_0x3b3988=_0x17e515;return _0x17e515[_0xd773('0x71')](_0x382a1a[_0xd773('0x50')][_0xd773('0x72')]);}})[_0xd773('0x27')](function(_0x1fd0e1){if(_0x1fd0e1){return db[_0xd773('0x67')][_0xd773('0x68')]({'where':{'id':_0x382a1a['params'][_0xd773('0x72')]},'attributes':['id',_0xd773('0x2e'),_0xd773('0x69'),'converted_format','createdAt'],'raw':!![]});}})[_0xd773('0x27')](function(_0x5344f0){if(_0x5344f0){fs[_0xd773('0x62')](path[_0xd773('0x56')](_0x3b3988[_0xd773('0x55')],util['format'](_0xd773('0x6d'),_0x5344f0[_0xd773('0x2e')],_0x5344f0[_0xd773('0x6a')])));return _0x5344f0;}})[_0xd773('0x4e')](function(_0x4264a5){throw new db[(_0xd773('0x64'))]['ValidationError'](_0x4264a5[_0xd773('0x65')]);});})[_0xd773('0x27')](handleEntityNotFound(_0x21a59e,null))[_0xd773('0x27')](respondWithStatusCode(_0x21a59e,0xcc))[_0xd773('0x4e')](handleError(_0x21a59e,null));};exports['getSounds']=function(_0x5e3e45,_0x5d87a6,_0x16be6d){var _0x15078e={};var _0x3b01c8={};var _0x33588b;var _0x4ed705;return db[_0xd773('0x31')][_0xd773('0x68')]({'where':{'id':_0x5e3e45[_0xd773('0x50')]['id']}})[_0xd773('0x27')](handleEntityNotFound(_0x5d87a6,null))[_0xd773('0x27')](function(_0xef2a41){if(_0xef2a41){_0x33588b=_0xef2a41;_0x3b01c8[_0xd773('0x35')]=_['keys'](db[_0xd773('0x67')][_0xd773('0x32')]);_0x3b01c8[_0xd773('0x36')]=_[_0xd773('0x37')](_0x5e3e45[_0xd773('0x36')]);_0x3b01c8[_0xd773('0x38')]=_[_0xd773('0x39')](_0x3b01c8[_0xd773('0x35')],_0x3b01c8[_0xd773('0x36')]);_0x15078e[_0xd773('0x3a')]=_[_0xd773('0x39')](_0x3b01c8[_0xd773('0x35')],qs[_0xd773('0x3b')](_0x5e3e45['query'][_0xd773('0x3b')]));_0x15078e['attributes']=_0x15078e[_0xd773('0x3a')][_0xd773('0x4b')]?_0x15078e[_0xd773('0x3a')]:_0x3b01c8['model'];_0x15078e[_0xd773('0x3e')]=qs[_0xd773('0x3f')](_0x5e3e45[_0xd773('0x36')][_0xd773('0x3f')]);_0x15078e['where']=qs[_0xd773('0x38')](_[_0xd773('0x41')](_0x5e3e45[_0xd773('0x36')],_0x3b01c8['filters']));if(_0x5e3e45[_0xd773('0x36')][_0xd773('0x42')]){_0x15078e['where']=_[_0xd773('0x43')](_0x15078e[_0xd773('0x40')],{'$or':_[_0xd773('0x30')](_0x15078e[_0xd773('0x3a')],function(_0xf6fce7){var _0x5dbea3={};_0x5dbea3[_0xf6fce7]={'$like':'%'+_0x5e3e45['query']['filter']+'%'};return _0x5dbea3;})});}_0x15078e=_['merge']({},_0x15078e,_0x5e3e45['options']);return _0x33588b['getSounds'](_0x15078e);}})[_0xd773('0x27')](function(_0x5563e3){if(_0x5563e3){_0x4ed705=_0x5563e3[_0xd773('0x4b')];if(!_0x5e3e45[_0xd773('0x36')][_0xd773('0x3c')](_0xd773('0x3d'))){_0x15078e[_0xd773('0x20')]=qs[_0xd773('0x20')](_0x5e3e45[_0xd773('0x36')][_0xd773('0x20')]);_0x15078e[_0xd773('0x1f')]=qs[_0xd773('0x1f')](_0x5e3e45[_0xd773('0x36')]['offset']);}return _0x33588b[_0xd773('0x73')](_0x15078e);}})['then'](function(_0x40ea4b){if(_0x40ea4b){return _0x40ea4b?{'count':_0x4ed705,'rows':_0x40ea4b}:null;}})['then'](respondWithResult(_0x5d87a6,null))[_0xd773('0x4e')](handleError(_0x5d87a6,null));}; \ No newline at end of file +var _0x7eaf=['sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','MusicOnHolds','UserProfileResource','end','error','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','name','filter','includeAll','include','rows','catch','show','find','update','body','params','create','sequelize','transaction','mode','directory','root','server/files/moh','files','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','basename','extname','converted_format','%s.%s','symlinkSync','id2','unlinkSync','options','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x4e8c4a,_0x27639c){var _0x277103=function(_0x197597){while(--_0x197597){_0x4e8c4a['push'](_0x4e8c4a['shift']());}};_0x277103(++_0x27639c);}(_0x7eaf,0xdc));var _0xf7ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eaf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf7ea('0x0'));var rimraf=require(_0xf7ea('0x1'));var zipdir=require(_0xf7ea('0x2'));var jsonpatch=require(_0xf7ea('0x3'));var rp=require(_0xf7ea('0x4'));var moment=require('moment');var BPromise=require(_0xf7ea('0x5'));var Mustache=require('mustache');var util=require(_0xf7ea('0x6'));var path=require(_0xf7ea('0x7'));var sox=require(_0xf7ea('0x8'));var csv=require(_0xf7ea('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7ea('0xa'));var _=require(_0xf7ea('0xb'));var squel=require(_0xf7ea('0xc'));var crypto=require(_0xf7ea('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf7ea('0xe'));var toCsv=require(_0xf7ea('0x9'));var querystring=require(_0xf7ea('0xf'));var Papa=require('papaparse');var Redis=require(_0xf7ea('0x10'));var authService=require(_0xf7ea('0x11'));var qs=require(_0xf7ea('0x12'));var as=require(_0xf7ea('0x13'));var hardwareService=require(_0xf7ea('0x14'));var logger=require(_0xf7ea('0x15'))(_0xf7ea('0x16'));var utils=require('../../config/utils');var config=require(_0xf7ea('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41dd1d,_0x4be060){_0x4be060=_0x4be060||0xcc;return function(_0x1bdc47){if(_0x1bdc47){return _0x41dd1d[_0xf7ea('0x18')](_0x4be060);}return _0x41dd1d[_0xf7ea('0x19')](_0x4be060)['end']();};}function respondWithResult(_0x4fa1f0,_0x2cd07e){_0x2cd07e=_0x2cd07e||0xc8;return function(_0x742a83){if(_0x742a83){return _0x4fa1f0[_0xf7ea('0x19')](_0x2cd07e)[_0xf7ea('0x1a')](_0x742a83);}};}function respondWithFilteredResult(_0x152689,_0x11d055){return function(_0x138e93){if(_0x138e93){var _0x10f518=typeof _0x11d055[_0xf7ea('0x1b')]===_0xf7ea('0x1c')&&typeof _0x11d055['limit']===_0xf7ea('0x1c');var _0x40d535=_0x138e93['count'];var _0x1ff246=_0x10f518?0x0:_0x11d055[_0xf7ea('0x1b')];var _0x34123e=_0x10f518?_0x138e93[_0xf7ea('0x1d')]:_0x11d055[_0xf7ea('0x1b')]+_0x11d055[_0xf7ea('0x1e')];var _0x804612;if(_0x34123e>=_0x40d535){_0x34123e=_0x40d535;_0x804612=0xc8;}else{_0x804612=0xce;}_0x152689[_0xf7ea('0x19')](_0x804612);return _0x152689[_0xf7ea('0x1f')](_0xf7ea('0x20'),_0x1ff246+'-'+_0x34123e+'/'+_0x40d535)[_0xf7ea('0x1a')](_0x138e93);}return null;};}function patchUpdates(_0x41ba20){return function(_0x39f0a5){try{jsonpatch[_0xf7ea('0x21')](_0x39f0a5,_0x41ba20,!![]);}catch(_0x4e81da){return BPromise[_0xf7ea('0x22')](_0x4e81da);}return _0x39f0a5[_0xf7ea('0x23')]();};}function saveUpdates(_0x5c7bd3,_0x3bc3c0){return function(_0xf46b79){if(_0xf46b79){return _0xf46b79['update'](_0x5c7bd3)['then'](function(_0x543b77){return _0x543b77;});}return null;};}function removeEntity(_0x2890ef,_0x4f46f2){return function(_0x353cf3){if(_0x353cf3){return _0x353cf3[_0xf7ea('0x24')]()[_0xf7ea('0x25')](function(){var _0x4a27d7=_0x353cf3['get']({'plain':!![]});var _0x12d909=_0xf7ea('0x26');return db[_0xf7ea('0x27')]['destroy']({'where':{'type':_0x12d909,'resourceId':_0x4a27d7['id']}})[_0xf7ea('0x25')](function(){return _0x353cf3;});})[_0xf7ea('0x25')](function(){_0x2890ef['status'](0xcc)[_0xf7ea('0x28')]();});}};}function handleEntityNotFound(_0x429117,_0x124fa7){return function(_0x23f7e2){if(!_0x23f7e2){_0x429117['sendStatus'](0x194);}return _0x23f7e2;};}function handleError(_0x23ed6d,_0x30014f){_0x30014f=_0x30014f||0x1f4;return function(_0x4e19b8){logger[_0xf7ea('0x29')](_0x4e19b8['stack']);if(_0x4e19b8['name']){delete _0x4e19b8['name'];}_0x23ed6d['status'](_0x30014f)[_0xf7ea('0x2a')](_0x4e19b8);};}exports[_0xf7ea('0x2b')]=function(_0x58754f,_0x52a1c9){var _0x4a5257={},_0x4bd30f={},_0x5439a5={'count':0x0,'rows':[]};var _0x1c99fd=_[_0xf7ea('0x2c')](db[_0xf7ea('0x2d')][_0xf7ea('0x2e')],function(_0x1155b9){return{'name':_0x1155b9[_0xf7ea('0x2f')],'type':_0x1155b9['type'][_0xf7ea('0x30')]};});_0x4bd30f[_0xf7ea('0x31')]=_[_0xf7ea('0x2c')](_0x1c99fd,'name');_0x4bd30f[_0xf7ea('0x32')]=_[_0xf7ea('0x33')](_0x58754f[_0xf7ea('0x32')]);_0x4bd30f[_0xf7ea('0x34')]=_[_0xf7ea('0x35')](_0x4bd30f[_0xf7ea('0x31')],_0x4bd30f[_0xf7ea('0x32')]);_0x4a5257[_0xf7ea('0x36')]=_[_0xf7ea('0x35')](_0x4bd30f[_0xf7ea('0x31')],qs['fields'](_0x58754f[_0xf7ea('0x32')][_0xf7ea('0x37')]));_0x4a5257[_0xf7ea('0x36')]=_0x4a5257[_0xf7ea('0x36')][_0xf7ea('0x38')]?_0x4a5257[_0xf7ea('0x36')]:_0x4bd30f[_0xf7ea('0x31')];if(!_0x58754f[_0xf7ea('0x32')]['hasOwnProperty'](_0xf7ea('0x39'))){_0x4a5257[_0xf7ea('0x1e')]=qs[_0xf7ea('0x1e')](_0x58754f['query'][_0xf7ea('0x1e')]);_0x4a5257[_0xf7ea('0x1b')]=qs[_0xf7ea('0x1b')](_0x58754f[_0xf7ea('0x32')]['offset']);}_0x4a5257[_0xf7ea('0x3a')]=qs[_0xf7ea('0x3b')](_0x58754f['query'][_0xf7ea('0x3b')]);delete _0x58754f['query'][_0xf7ea('0x3b')];_0x4a5257[_0xf7ea('0x3c')]=qs['filters'](_[_0xf7ea('0x3d')](_0x58754f['query'],_0x4bd30f['filters']),_0x1c99fd);if(_0x58754f[_0xf7ea('0x32')]['filter']){_0x4a5257[_0xf7ea('0x3c')]=_[_0xf7ea('0x3e')](_0x4a5257['where'],{'$or':_['map'](_0x1c99fd,function(_0x39cf47){if(_0x39cf47[_0xf7ea('0x3f')]!==_0xf7ea('0x40')){var _0x52fb15={};_0x52fb15[_0x39cf47[_0xf7ea('0x41')]]={'$like':'%'+_0x58754f[_0xf7ea('0x32')][_0xf7ea('0x42')]+'%'};return _0x52fb15;}})});}_0x4a5257=_[_0xf7ea('0x3e')]({},_0x4a5257,_0x58754f['options']);var _0x4d5886={'where':_0x4a5257[_0xf7ea('0x3c')]};return db[_0xf7ea('0x2d')]['count'](_0x4d5886)[_0xf7ea('0x25')](function(_0x47aa13){_0x5439a5[_0xf7ea('0x1d')]=_0x47aa13;if(_0x58754f[_0xf7ea('0x32')][_0xf7ea('0x43')]){_0x4a5257[_0xf7ea('0x44')]=[{'all':!![]}];}return db[_0xf7ea('0x2d')]['findAll'](_0x4a5257);})['then'](function(_0x23a19e){_0x5439a5[_0xf7ea('0x45')]=_0x23a19e;return _0x5439a5;})[_0xf7ea('0x25')](respondWithFilteredResult(_0x52a1c9,_0x4a5257))[_0xf7ea('0x46')](handleError(_0x52a1c9,null));};exports[_0xf7ea('0x47')]=function(_0x45f9af,_0x41aa72){var _0x376054={'raw':![],'where':{'id':_0x45f9af['params']['id']}},_0x178620={};_0x178620[_0xf7ea('0x31')]=_[_0xf7ea('0x33')](db[_0xf7ea('0x2d')][_0xf7ea('0x2e')]);_0x178620['query']=_[_0xf7ea('0x33')](_0x45f9af[_0xf7ea('0x32')]);_0x178620[_0xf7ea('0x34')]=_[_0xf7ea('0x35')](_0x178620[_0xf7ea('0x31')],_0x178620['query']);_0x376054[_0xf7ea('0x36')]=_[_0xf7ea('0x35')](_0x178620[_0xf7ea('0x31')],qs['fields'](_0x45f9af[_0xf7ea('0x32')]['fields']));_0x376054[_0xf7ea('0x36')]=_0x376054[_0xf7ea('0x36')]['length']?_0x376054[_0xf7ea('0x36')]:_0x178620[_0xf7ea('0x31')];if(_0x45f9af['query']['includeAll']){_0x376054[_0xf7ea('0x44')]=[{'all':!![]}];}_0x376054=_[_0xf7ea('0x3e')]({},_0x376054,_0x45f9af['options']);return db[_0xf7ea('0x2d')][_0xf7ea('0x48')](_0x376054)[_0xf7ea('0x25')](handleEntityNotFound(_0x41aa72,null))['then'](respondWithResult(_0x41aa72,null))['catch'](handleError(_0x41aa72,null));};exports[_0xf7ea('0x49')]=function(_0x47fc42,_0x3b8616){if(_0x47fc42[_0xf7ea('0x4a')]['id']){delete _0x47fc42['body']['id'];}return db['VoiceMusicOnHold'][_0xf7ea('0x48')]({'where':{'id':_0x47fc42[_0xf7ea('0x4b')]['id']}})[_0xf7ea('0x25')](handleEntityNotFound(_0x3b8616,null))[_0xf7ea('0x25')](saveUpdates(_0x47fc42[_0xf7ea('0x4a')],null))[_0xf7ea('0x25')](respondWithResult(_0x3b8616,null))[_0xf7ea('0x46')](handleError(_0x3b8616,null));};exports[_0xf7ea('0x4c')]=function(_0x53fb35,_0x15511e,_0x13ed8c){return db[_0xf7ea('0x4d')][_0xf7ea('0x4e')](function(_0x33440a){if(_0x53fb35[_0xf7ea('0x4a')][_0xf7ea('0x4f')]==='files'){_0x53fb35[_0xf7ea('0x4a')][_0xf7ea('0x50')]=path['join'](config[_0xf7ea('0x51')],_0xf7ea('0x52'),_0x53fb35[_0xf7ea('0x4a')][_0xf7ea('0x41')]);}return db['VoiceMusicOnHold'][_0xf7ea('0x4c')](_0x53fb35[_0xf7ea('0x4a')],{'transaction':_0x33440a})['then'](function(_0x3cd1bd){if(_0x53fb35[_0xf7ea('0x4a')][_0xf7ea('0x4f')]===_0xf7ea('0x53')){fs[_0xf7ea('0x54')](_0x3cd1bd[_0xf7ea('0x50')],parseInt('0777',0x8));}var _0x1ea632=_0x53fb35[_0xf7ea('0x55')]['get']({'plain':!![]});if(!_0x1ea632)throw new Error(_0xf7ea('0x56'));if(_0x1ea632[_0xf7ea('0x57')]==='user'){var _0x992a5=_0x3cd1bd[_0xf7ea('0x58')]({'plain':!![]});return db[_0xf7ea('0x59')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x1ea632['userProfileId']},'raw':!![]})[_0xf7ea('0x25')](function(_0x2c862c){if(_0x2c862c&&_0x2c862c[_0xf7ea('0x5a')]===0x0){return db[_0xf7ea('0x27')][_0xf7ea('0x4c')]({'name':_0x992a5[_0xf7ea('0x41')],'resourceId':_0x992a5['id'],'type':_0x2c862c[_0xf7ea('0x41')],'sectionId':_0x2c862c['id']},{})[_0xf7ea('0x25')](function(){return _0x3cd1bd;});}else{return _0x3cd1bd;}})[_0xf7ea('0x46')](function(_0x180a76){logger[_0xf7ea('0x29')](_0xf7ea('0x5b'),_0x180a76);});}return _0x3cd1bd;});})[_0xf7ea('0x25')](respondWithResult(_0x15511e,0xc9))[_0xf7ea('0x46')](handleError(_0x15511e,null));};exports['destroy']=function(_0x1ca778,_0x17342b,_0x318d23){var _0x4a42fb;return db['VoiceMusicOnHold'][_0xf7ea('0x48')]({'where':{'id':_0x1ca778[_0xf7ea('0x4b')]['id']}})['then'](function(_0x4b7b71){if(_0x4b7b71){return db[_0xf7ea('0x4d')][_0xf7ea('0x4e')](function(_0x32bb7f){return _0x4b7b71[_0xf7ea('0x24')]({'transaction':_0x32bb7f,'raw':!![]})[_0xf7ea('0x25')](function(_0x574855){if(_0x574855['directory']){fs[_0xf7ea('0x5c')](_0x574855[_0xf7ea('0x50')])[_0xf7ea('0x5d')](function(_0x45fa0b){fs['unlinkSync'](path[_0xf7ea('0x5e')](_0x574855[_0xf7ea('0x50')],_0x45fa0b));});fs['rmdirSync'](_0x574855[_0xf7ea('0x50')]);}return _0x574855;});})[_0xf7ea('0x46')](function(_0x21b67a){throw new db[(_0xf7ea('0x5f'))][(_0xf7ea('0x60'))](_0x21b67a[_0xf7ea('0x61')]);});}})['then'](handleEntityNotFound(_0x17342b,null))['then'](removeEntity(_0x17342b,null))[_0xf7ea('0x46')](handleError(_0x17342b,null));};exports[_0xf7ea('0x62')]=function(_0x36486d,_0x3712ca,_0x27af55){return db['sequelize'][_0xf7ea('0x4e')](function(_0x39a712){var _0x244ada;return db['VoiceMusicOnHold'][_0xf7ea('0x48')]({'where':{'id':_0x36486d[_0xf7ea('0x4b')]['id']}})[_0xf7ea('0x25')](function(_0x5abf47){if(_0x5abf47){_0x244ada=_0x5abf47;return _0x5abf47[_0xf7ea('0x62')](_0x36486d[_0xf7ea('0x4a')]['id'],{'transaction':_0x39a712});}})[_0xf7ea('0x25')](function(_0x569607){if(_0x569607){return db[_0xf7ea('0x63')][_0xf7ea('0x64')]({'where':{'id':_0x36486d[_0xf7ea('0x4a')]['id']},'attributes':['id',_0xf7ea('0x41'),_0xf7ea('0x65'),'converted_format',_0xf7ea('0x66')],'raw':!![]});}})[_0xf7ea('0x25')](function(_0x8a61aa){if(_0x8a61aa){var _0x61854e=path[_0xf7ea('0x5e')](config[_0xf7ea('0x51')],_0xf7ea('0x67'),util[_0xf7ea('0x68')]('%s.%s',path[_0xf7ea('0x69')](_0x8a61aa[_0xf7ea('0x65')],path[_0xf7ea('0x6a')](_0x8a61aa[_0xf7ea('0x65')])),_0x8a61aa[_0xf7ea('0x6b')]));var _0xbaa433=path['join'](config[_0xf7ea('0x51')],_0xf7ea('0x52'),_0x244ada[_0xf7ea('0x41')],util['format'](_0xf7ea('0x6c'),_0x8a61aa[_0xf7ea('0x41')],_0x8a61aa[_0xf7ea('0x6b')]));fs[_0xf7ea('0x6d')](_0x61854e,_0xbaa433);return _0x8a61aa;}})['catch'](function(_0x10a0d1){throw new db['Sequelize'][(_0xf7ea('0x60'))](_0x10a0d1[_0xf7ea('0x61')]);});})['then'](handleEntityNotFound(_0x3712ca,null))[_0xf7ea('0x25')](respondWithResult(_0x3712ca,0xc9))[_0xf7ea('0x46')](handleError(_0x3712ca,null));};exports['removeSound']=function(_0x1a878f,_0x1ba834,_0x5a4900){return db[_0xf7ea('0x4d')][_0xf7ea('0x4e')](function(_0x3b3a6e){var _0x2dd2d6;return db[_0xf7ea('0x2d')]['findOne']({'where':{'id':_0x1a878f[_0xf7ea('0x4b')]['id']}})[_0xf7ea('0x25')](handleEntityNotFound(_0x1ba834,null))['then'](function(_0x451585){if(_0x451585){_0x2dd2d6=_0x451585;return _0x451585['removeSound'](_0x1a878f[_0xf7ea('0x4b')][_0xf7ea('0x6e')]);}})[_0xf7ea('0x25')](function(_0x4e8d9d){if(_0x4e8d9d){return db['Sound'][_0xf7ea('0x64')]({'where':{'id':_0x1a878f['params'][_0xf7ea('0x6e')]},'attributes':['id',_0xf7ea('0x41'),_0xf7ea('0x65'),'converted_format',_0xf7ea('0x66')],'raw':!![]});}})['then'](function(_0x7cb035){if(_0x7cb035){fs[_0xf7ea('0x6f')](path['join'](_0x2dd2d6[_0xf7ea('0x50')],util['format']('%s.%s',_0x7cb035[_0xf7ea('0x41')],_0x7cb035[_0xf7ea('0x6b')])));return _0x7cb035;}})[_0xf7ea('0x46')](function(_0x3d52e9){throw new db[(_0xf7ea('0x5f'))][(_0xf7ea('0x60'))](_0x3d52e9[_0xf7ea('0x61')]);});})[_0xf7ea('0x25')](handleEntityNotFound(_0x1ba834,null))['then'](respondWithStatusCode(_0x1ba834,0xcc))[_0xf7ea('0x46')](handleError(_0x1ba834,null));};exports['getSounds']=function(_0x1aca7b,_0x16165f,_0x2139b9){var _0x33ea74={};var _0x3ff56d={};var _0x4252b5;var _0x2d9274;return db['VoiceMusicOnHold'][_0xf7ea('0x64')]({'where':{'id':_0x1aca7b['params']['id']}})['then'](handleEntityNotFound(_0x16165f,null))['then'](function(_0x508fcf){if(_0x508fcf){_0x4252b5=_0x508fcf;_0x3ff56d[_0xf7ea('0x31')]=_[_0xf7ea('0x33')](db[_0xf7ea('0x63')][_0xf7ea('0x2e')]);_0x3ff56d[_0xf7ea('0x32')]=_['keys'](_0x1aca7b[_0xf7ea('0x32')]);_0x3ff56d[_0xf7ea('0x34')]=_[_0xf7ea('0x35')](_0x3ff56d[_0xf7ea('0x31')],_0x3ff56d['query']);_0x33ea74[_0xf7ea('0x36')]=_['intersection'](_0x3ff56d['model'],qs[_0xf7ea('0x37')](_0x1aca7b['query'][_0xf7ea('0x37')]));_0x33ea74[_0xf7ea('0x36')]=_0x33ea74[_0xf7ea('0x36')]['length']?_0x33ea74[_0xf7ea('0x36')]:_0x3ff56d[_0xf7ea('0x31')];_0x33ea74['order']=qs[_0xf7ea('0x3b')](_0x1aca7b[_0xf7ea('0x32')]['sort']);_0x33ea74[_0xf7ea('0x3c')]=qs[_0xf7ea('0x34')](_[_0xf7ea('0x3d')](_0x1aca7b[_0xf7ea('0x32')],_0x3ff56d[_0xf7ea('0x34')]));if(_0x1aca7b['query'][_0xf7ea('0x42')]){_0x33ea74[_0xf7ea('0x3c')]=_[_0xf7ea('0x3e')](_0x33ea74['where'],{'$or':_['map'](_0x33ea74[_0xf7ea('0x36')],function(_0x4ed20f){var _0x223500={};_0x223500[_0x4ed20f]={'$like':'%'+_0x1aca7b[_0xf7ea('0x32')][_0xf7ea('0x42')]+'%'};return _0x223500;})});}_0x33ea74=_[_0xf7ea('0x3e')]({},_0x33ea74,_0x1aca7b[_0xf7ea('0x70')]);return _0x4252b5[_0xf7ea('0x71')](_0x33ea74);}})[_0xf7ea('0x25')](function(_0x30fe36){if(_0x30fe36){_0x2d9274=_0x30fe36[_0xf7ea('0x38')];if(!_0x1aca7b[_0xf7ea('0x32')]['hasOwnProperty'](_0xf7ea('0x39'))){_0x33ea74[_0xf7ea('0x1e')]=qs['limit'](_0x1aca7b['query']['limit']);_0x33ea74['offset']=qs[_0xf7ea('0x1b')](_0x1aca7b[_0xf7ea('0x32')]['offset']);}return _0x4252b5[_0xf7ea('0x71')](_0x33ea74);}})[_0xf7ea('0x25')](function(_0x54305b){if(_0x54305b){return _0x54305b?{'count':_0x2d9274,'rows':_0x54305b}:null;}})[_0xf7ea('0x25')](respondWithResult(_0x16165f,null))[_0xf7ea('0x46')](handleError(_0x16165f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1778695..ce973e2 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 _0xd42d=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','rimraf','./voiceMusicOnHold.attributes'];(function(_0x8a4021,_0x12244b){var _0x38c47f=function(_0x26b2e4){while(--_0x26b2e4){_0x8a4021['push'](_0x8a4021['shift']());}};_0x38c47f(++_0x12244b);}(_0xd42d,0x72));var _0xdd42=function(_0xbcb6,_0x8e00a9){_0xbcb6=_0xbcb6-0x0;var _0x58899b=_0xd42d[_0xbcb6];return _0x58899b;};'use strict';var _=require(_0xdd42('0x0'));var util=require(_0xdd42('0x1'));var logger=require(_0xdd42('0x2'))(_0xdd42('0x3'));var moment=require('moment');var BPromise=require(_0xdd42('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdd42('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd42('0x6'));module[_0xdd42('0x7')]=function(_0x441795,_0x322db7){return _0x441795[_0xdd42('0x8')](_0xdd42('0x9'),attributes,{'tableName':_0xdd42('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8f7=['VoiceMusicOnHold','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x408192,_0x1cef10){var _0x29f138=function(_0x523971){while(--_0x523971){_0x408192['push'](_0x408192['shift']());}};_0x29f138(++_0x1cef10);}(_0xe8f7,0x112));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e8f('0x0'));var util=require(_0x7e8f('0x1'));var logger=require(_0x7e8f('0x2'))(_0x7e8f('0x3'));var moment=require('moment');var BPromise=require(_0x7e8f('0x4'));var rp=require(_0x7e8f('0x5'));var fs=require('fs');var path=require(_0x7e8f('0x6'));var rimraf=require(_0x7e8f('0x7'));var config=require(_0x7e8f('0x8'));var attributes=require(_0x7e8f('0x9'));module[_0x7e8f('0xa')]=function(_0x215ea0,_0x40de1f){return _0x215ea0[_0x7e8f('0xb')](_0x7e8f('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 b54d40e..f98ea01 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x29ff94,_0x2165e0){var _0x860794=function(_0x4d41cd){while(--_0x4d41cd){_0x29ff94['push'](_0x29ff94['shift']());}};_0x860794(++_0x2165e0);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x2e6d16,_0x1379fd){var _0x257f7c=function(_0x36b3a6){while(--_0x36b3a6){_0x2e6d16['push'](_0x2e6d16['shift']());}};_0x257f7c(++_0x1379fd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcb91[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 39c04aa..41541a3 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 _0xe893=['addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','/:id/users','/:id/teams','getTeams','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe893,0xbe));var _0x3e89=function(_0x21a9cf,_0x51f954){_0x21a9cf=_0x21a9cf-0x0;var _0x5d4ba7=_0xe893[_0x21a9cf];return _0x5d4ba7;};'use strict';var multer=require('multer');var util=require(_0x3e89('0x0'));var path=require(_0x3e89('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e89('0x2'));var router=express[_0x3e89('0x3')]();var fs_extra=require(_0x3e89('0x4'));var auth=require(_0x3e89('0x5'));var interaction=require(_0x3e89('0x6'));var config=require('../../config/environment');var controller=require(_0x3e89('0x7'));router[_0x3e89('0x8')]('/',auth[_0x3e89('0x9')](),controller['index']);router[_0x3e89('0x8')](_0x3e89('0xa'),auth[_0x3e89('0x9')](),controller[_0x3e89('0xb')]);router['get'](_0x3e89('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x3e89('0xd'),auth[_0x3e89('0x9')](),controller['getAgents']);router['get'](_0x3e89('0xe'),auth['isAuthenticated'](),controller[_0x3e89('0xf')]);router[_0x3e89('0x10')]('/',auth['isAuthenticated'](),controller[_0x3e89('0x11')]);router[_0x3e89('0x10')](_0x3e89('0xd'),auth['isAuthenticated'](),controller[_0x3e89('0x12')]);router[_0x3e89('0x10')](_0x3e89('0xe'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x13')]);router[_0x3e89('0x14')](_0x3e89('0xc'),auth['isAuthenticated'](),controller[_0x3e89('0x15')]);router[_0x3e89('0x16')]('/:id',auth[_0x3e89('0x9')](),controller[_0x3e89('0x17')]);router[_0x3e89('0x16')](_0x3e89('0xd'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x18')]);router[_0x3e89('0x16')](_0x3e89('0xe'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x19')]);module['exports']=router; \ No newline at end of file +var _0xf629=['isAuthenticated','describe','get','/:id','show','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','delete','destroy','/:id/users','removeAgents','removeTeams','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./voicePrefix.controller','index','/describe'];(function(_0x3c7ff6,_0x342b13){var _0x5e0082=function(_0x58d29f){while(--_0x58d29f){_0x3c7ff6['push'](_0x3c7ff6['shift']());}};_0x5e0082(++_0x342b13);}(_0xf629,0xd7));var _0x9f62=function(_0x3d29ec,_0x4f103f){_0x3d29ec=_0x3d29ec-0x0;var _0x10f26=_0xf629[_0x3d29ec];return _0x10f26;};'use strict';var multer=require(_0x9f62('0x0'));var util=require('util');var path=require(_0x9f62('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f62('0x2'));var router=express[_0x9f62('0x3')]();var fs_extra=require(_0x9f62('0x4'));var auth=require(_0x9f62('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f62('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9f62('0x7')]);router['get'](_0x9f62('0x8'),auth[_0x9f62('0x9')](),controller[_0x9f62('0xa')]);router[_0x9f62('0xb')](_0x9f62('0xc'),auth[_0x9f62('0x9')](),controller[_0x9f62('0xd')]);router[_0x9f62('0xb')]('/:id/users',auth[_0x9f62('0x9')](),controller[_0x9f62('0xe')]);router['get'](_0x9f62('0xf'),auth[_0x9f62('0x9')](),controller[_0x9f62('0x10')]);router[_0x9f62('0x11')]('/',auth['isAuthenticated'](),controller[_0x9f62('0x12')]);router['post']('/:id/users',auth[_0x9f62('0x9')](),controller[_0x9f62('0x13')]);router[_0x9f62('0x11')](_0x9f62('0xf'),auth[_0x9f62('0x9')](),controller[_0x9f62('0x14')]);router[_0x9f62('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9f62('0x16')]('/:id',auth[_0x9f62('0x9')](),controller[_0x9f62('0x17')]);router[_0x9f62('0x16')](_0x9f62('0x18'),auth[_0x9f62('0x9')](),controller[_0x9f62('0x19')]);router['delete'](_0x9f62('0xf'),auth[_0x9f62('0x9')](),controller[_0x9f62('0x1a')]);module[_0x9f62('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7bc862b..84c5645 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 _0x6285=['name','VIRTUAL','system-','getDataValue','exports','STRING'];(function(_0x1b810b,_0x324c7e){var _0x4f8e61=function(_0x46c93f){while(--_0x46c93f){_0x1b810b['push'](_0x1b810b['shift']());}};_0x4f8e61(++_0x324c7e);}(_0x6285,0xc4));var _0x5628=function(_0x2d2a36,_0x2f839){_0x2d2a36=_0x2d2a36-0x0;var _0x1f570a=_0x6285[_0x2d2a36];return _0x1f570a;};'use strict';var Sequelize=require('sequelize');module[_0x5628('0x0')]={'name':{'type':Sequelize[_0x5628('0x1')],'allowNull':![],'unique':_0x5628('0x2')},'prefix':{'type':Sequelize[_0x5628('0x3')],'get':function(_0x1e973b){return _0x5628('0x4')+this[_0x5628('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x5628('0x1')]},'callerIdAll':{'type':Sequelize[_0x5628('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf979=['exports','STRING','name','VIRTUAL','system-','getDataValue','sequelize'];(function(_0x2d020c,_0x2c1194){var _0x33d3cc=function(_0x3b9fd4){while(--_0x3b9fd4){_0x2d020c['push'](_0x2d020c['shift']());}};_0x33d3cc(++_0x2c1194);}(_0xf979,0xb5));var _0x9f97=function(_0x3eb022,_0x5a006c){_0x3eb022=_0x3eb022-0x0;var _0x3e2411=_0xf979[_0x3eb022];return _0x3e2411;};'use strict';var Sequelize=require(_0x9f97('0x0'));module[_0x9f97('0x1')]={'name':{'type':Sequelize[_0x9f97('0x2')],'allowNull':![],'unique':_0x9f97('0x3')},'prefix':{'type':Sequelize[_0x9f97('0x4')],'get':function(_0x157ef8){return _0x9f97('0x5')+this[_0x9f97('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x9f97('0x2')]},'callerIdAll':{'type':Sequelize[_0x9f97('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6862804..b5c60c4 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 _0xb574=['count','set','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','VoicePrefix','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','destroy','params','describe','sequelize','transaction','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','goto','charAt','body','system-','addAgents','spread','ids','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','forEach','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xb574,0x106));var _0x4b57=function(_0x53bfc0,_0x3109f0){_0x53bfc0=_0x53bfc0-0x0;var _0x19a511=_0xb574[_0x53bfc0];return _0x19a511;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];config[_0x4b57('0x16')]=_[_0x4b57('0x17')](config[_0x4b57('0x16')],{'host':_0x4b57('0x18'),'port':0x18eb});var socket=require(_0x4b57('0x19'))(new Redis(config[_0x4b57('0x16')]));require(_0x4b57('0x1a'))[_0x4b57('0x1b')](socket);function respondWithStatusCode(_0x4e15be,_0x4a58dc){_0x4a58dc=_0x4a58dc||0xcc;return function(_0x236c95){if(_0x236c95){return _0x4e15be[_0x4b57('0x1c')](_0x4a58dc);}return _0x4e15be[_0x4b57('0x1d')](_0x4a58dc)['end']();};}function respondWithResult(_0x284640,_0x48bd13){_0x48bd13=_0x48bd13||0xc8;return function(_0x159ce5){if(_0x159ce5){return _0x284640[_0x4b57('0x1d')](_0x48bd13)[_0x4b57('0x1e')](_0x159ce5);}};}function respondWithFilteredResult(_0x10eda5,_0x20cf5e){return function(_0xfb71cc){if(_0xfb71cc){var _0x4ede42=typeof _0x20cf5e[_0x4b57('0x1f')]===_0x4b57('0x20')&&typeof _0x20cf5e[_0x4b57('0x21')]===_0x4b57('0x20');var _0x4baaeb=_0xfb71cc[_0x4b57('0x22')];var _0x1ca49e=_0x4ede42?0x0:_0x20cf5e[_0x4b57('0x1f')];var _0x2682d6=_0x4ede42?_0xfb71cc[_0x4b57('0x22')]:_0x20cf5e[_0x4b57('0x1f')]+_0x20cf5e['limit'];var _0x4b504b;if(_0x2682d6>=_0x4baaeb){_0x2682d6=_0x4baaeb;_0x4b504b=0xc8;}else{_0x4b504b=0xce;}_0x10eda5[_0x4b57('0x1d')](_0x4b504b);return _0x10eda5[_0x4b57('0x23')]('Content-Range',_0x1ca49e+'-'+_0x2682d6+'/'+_0x4baaeb)[_0x4b57('0x1e')](_0xfb71cc);}return null;};}function patchUpdates(_0x4a34b2){return function(_0x286c7d){try{jsonpatch[_0x4b57('0x24')](_0x286c7d,_0x4a34b2,!![]);}catch(_0x56f017){return BPromise[_0x4b57('0x25')](_0x56f017);}return _0x286c7d[_0x4b57('0x26')]();};}function saveUpdates(_0x4d07c9,_0x3e7b96){return function(_0x12dedf){if(_0x12dedf){return _0x12dedf[_0x4b57('0x27')](_0x4d07c9)[_0x4b57('0x28')](function(_0x540eff){return _0x540eff;});}return null;};}function removeEntity(_0x156962,_0x51d0c3){return function(_0x131dab){if(_0x131dab){return _0x131dab['destroy']()[_0x4b57('0x28')](function(){var _0x2dc9d8=_0x131dab[_0x4b57('0x29')]({'plain':!![]});var _0x6584c4=_0x4b57('0x2a');return db[_0x4b57('0x2b')]['destroy']({'where':{'type':_0x6584c4,'resourceId':_0x2dc9d8['id']}})['then'](function(){return _0x131dab;});})[_0x4b57('0x28')](function(){_0x156962['status'](0xcc)[_0x4b57('0x2c')]();});}};}function handleEntityNotFound(_0x458f70,_0x874cf7){return function(_0x3af22f){if(!_0x3af22f){_0x458f70[_0x4b57('0x1c')](0x194);}return _0x3af22f;};}function handleError(_0x2c20d2,_0x49ba89){_0x49ba89=_0x49ba89||0x1f4;return function(_0xab365c){logger[_0x4b57('0x2d')](_0xab365c[_0x4b57('0x2e')]);if(_0xab365c[_0x4b57('0x2f')]){delete _0xab365c['name'];}_0x2c20d2[_0x4b57('0x1d')](_0x49ba89)[_0x4b57('0x30')](_0xab365c);};}exports['index']=function(_0xbfb420,_0xa5b5dc){var _0x4726a6={},_0x255c7d={},_0x492de8={'count':0x0,'rows':[]};var _0x5742a0=_['map'](db[_0x4b57('0x31')][_0x4b57('0x32')],function(_0xccc679){return{'name':_0xccc679[_0x4b57('0x33')],'type':_0xccc679[_0x4b57('0x34')]['key']};});_0x255c7d[_0x4b57('0x35')]=_[_0x4b57('0x36')](_0x5742a0,_0x4b57('0x2f'));_0x255c7d['query']=_[_0x4b57('0x37')](_0xbfb420[_0x4b57('0x38')]);_0x255c7d[_0x4b57('0x39')]=_['intersection'](_0x255c7d[_0x4b57('0x35')],_0x255c7d[_0x4b57('0x38')]);_0x4726a6['attributes']=_[_0x4b57('0x3a')](_0x255c7d[_0x4b57('0x35')],qs[_0x4b57('0x3b')](_0xbfb420[_0x4b57('0x38')][_0x4b57('0x3b')]));_0x4726a6[_0x4b57('0x3c')]=_0x4726a6['attributes'][_0x4b57('0x3d')]?_0x4726a6[_0x4b57('0x3c')]:_0x255c7d[_0x4b57('0x35')];if(!_0xbfb420[_0x4b57('0x38')][_0x4b57('0x3e')](_0x4b57('0x3f'))){_0x4726a6[_0x4b57('0x21')]=qs['limit'](_0xbfb420['query'][_0x4b57('0x21')]);_0x4726a6[_0x4b57('0x1f')]=qs[_0x4b57('0x1f')](_0xbfb420['query'][_0x4b57('0x1f')]);}_0x4726a6[_0x4b57('0x40')]=qs[_0x4b57('0x41')](_0xbfb420[_0x4b57('0x38')]['sort']);_0x4726a6[_0x4b57('0x42')]=qs[_0x4b57('0x39')](_[_0x4b57('0x43')](_0xbfb420[_0x4b57('0x38')],_0x255c7d['filters']),_0x5742a0);if(_0xbfb420['query']['filter']){_0x4726a6[_0x4b57('0x42')]=_[_0x4b57('0x44')](_0x4726a6[_0x4b57('0x42')],{'$or':_[_0x4b57('0x36')](_0x5742a0,function(_0x5f4971){if(_0x5f4971[_0x4b57('0x34')]!==_0x4b57('0x45')){var _0x286606={};_0x286606[_0x5f4971[_0x4b57('0x2f')]]={'$like':'%'+_0xbfb420[_0x4b57('0x38')][_0x4b57('0x46')]+'%'};return _0x286606;}})});}_0x4726a6=_[_0x4b57('0x44')]({},_0x4726a6,_0xbfb420[_0x4b57('0x47')]);var _0x1e222b={'where':_0x4726a6['where']};return db[_0x4b57('0x31')][_0x4b57('0x22')](_0x1e222b)[_0x4b57('0x28')](function(_0x5b2f50){_0x492de8[_0x4b57('0x22')]=_0x5b2f50;if(_0xbfb420['query'][_0x4b57('0x48')]){_0x4726a6[_0x4b57('0x49')]=[{'all':!![]}];}return db[_0x4b57('0x31')][_0x4b57('0x4a')](_0x4726a6);})[_0x4b57('0x28')](function(_0x477352){_0x492de8[_0x4b57('0x4b')]=_0x477352;return _0x492de8;})[_0x4b57('0x28')](respondWithFilteredResult(_0xa5b5dc,_0x4726a6))[_0x4b57('0x4c')](handleError(_0xa5b5dc,null));};exports[_0x4b57('0x4d')]=function(_0x9864b8,_0x423144){var _0x3a87a1={'raw':![],'where':{'id':_0x9864b8['params']['id']}},_0x4fbed3={};_0x4fbed3[_0x4b57('0x35')]=_[_0x4b57('0x37')](db[_0x4b57('0x31')][_0x4b57('0x32')]);_0x4fbed3['query']=_[_0x4b57('0x37')](_0x9864b8[_0x4b57('0x38')]);_0x4fbed3['filters']=_[_0x4b57('0x3a')](_0x4fbed3['model'],_0x4fbed3[_0x4b57('0x38')]);_0x3a87a1['attributes']=_['intersection'](_0x4fbed3[_0x4b57('0x35')],qs[_0x4b57('0x3b')](_0x9864b8['query'][_0x4b57('0x3b')]));_0x3a87a1[_0x4b57('0x3c')]=_0x3a87a1[_0x4b57('0x3c')][_0x4b57('0x3d')]?_0x3a87a1[_0x4b57('0x3c')]:_0x4fbed3[_0x4b57('0x35')];if(_0x9864b8['query'][_0x4b57('0x48')]){_0x3a87a1[_0x4b57('0x49')]=[{'all':!![]}];}_0x3a87a1=_['merge']({},_0x3a87a1,_0x9864b8[_0x4b57('0x47')]);return db[_0x4b57('0x31')][_0x4b57('0x4e')](_0x3a87a1)['then'](handleEntityNotFound(_0x423144,null))[_0x4b57('0x28')](respondWithResult(_0x423144,null))['catch'](handleError(_0x423144,null));};exports[_0x4b57('0x4f')]=function(_0xfbe7ed,_0x2ae205){return db[_0x4b57('0x31')][_0x4b57('0x4e')]({'where':{'id':_0xfbe7ed[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x2ae205,null))[_0x4b57('0x28')](removeEntity(_0x2ae205,null))['catch'](handleError(_0x2ae205,null));};exports[_0x4b57('0x51')]=function(_0x19349b,_0x3ad98f){return db['VoicePrefix'][_0x4b57('0x51')]()[_0x4b57('0x28')](respondWithResult(_0x3ad98f,null))[_0x4b57('0x4c')](handleError(_0x3ad98f,null));};exports['create']=function(_0x1579d1,_0x3d2336){var _0x343cec;return db[_0x4b57('0x52')][_0x4b57('0x53')](function(_0xb7c37c){return db[_0x4b57('0x31')]['create'](_0x1579d1['body'],{'transaction':_0xb7c37c})[_0x4b57('0x28')](function(_0x61a1ae){_0x343cec=_0x61a1ae[_0x4b57('0x29')]({'plain':!![]});return db[_0x4b57('0x54')]['find']({'where':{'id':_0x343cec[_0x4b57('0x55')]},'raw':!![]})[_0x4b57('0x28')](function(_0x41529e){return createVoicePrefixExtensions(_0x343cec,_0x41529e,_0xb7c37c);});});})[_0x4b57('0x28')](function(){var _0x4857c3=_0x1579d1['user'][_0x4b57('0x29')]({'plain':!![]});if(!_0x4857c3)throw new Error(_0x4b57('0x56'));if(_0x4857c3['role']==='user'){var _0x451737=_0x343cec;return db['UserProfileSection'][_0x4b57('0x4e')]({'where':{'name':_0x4b57('0x2a'),'userProfileId':_0x4857c3[_0x4b57('0x57')]},'raw':!![]})[_0x4b57('0x28')](function(_0x37d420){if(_0x37d420&&_0x37d420['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x451737['name'],'resourceId':_0x451737['id'],'type':_0x37d420[_0x4b57('0x2f')],'sectionId':_0x37d420['id']},{})[_0x4b57('0x28')](function(){return _0x343cec;});}else{return _0x343cec;}})['catch'](function(_0x34aa23){logger[_0x4b57('0x2d')](_0x4b57('0x58'),_0x34aa23);throw _0x34aa23;});}return _0x343cec;})[_0x4b57('0x28')](respondWithResult(_0x3d2336,null))[_0x4b57('0x4c')](handleError(_0x3d2336,null));};function Extension(_0x1fcc10,_0xf1bf63,_0x40cab4,_0x2c5289){this['context']=_0x4b57('0x59');this['exten']=_0x1fcc10;this[_0x4b57('0x5a')]=_0x40cab4;this[_0x4b57('0x34')]='system';this[_0x4b57('0x5b')]=_0x4b57('0x5c');this[_0x4b57('0x5d')]=_0xf1bf63;this[_0x4b57('0x5e')]=_0x2c5289;}function createVoicePrefixExtensions(_0x36f154,_0xc24706,_0xb58059){return new BPromise(function(_0xbe6f94,_0x3ed705){var _0x8851dd=new Extension(formatPrefixName(_0x36f154[_0x4b57('0x5f')]),0x1,_0x4b57('0x60'),'Voice\x20Prefix');_0x8851dd[_0x4b57('0x61')]=_0x36f154['id'];return db[_0x4b57('0x54')]['create'](_0x8851dd,{'transaction':_0xb58059})[_0x4b57('0x28')](function(_0x564792){var _0x566fec=_0x564792['get']({'plain':!![]});var _0x1004ac=_['map'](addVoicePrefixExtensions(_0x36f154,_0xc24706),function(_0x310db6){_0x310db6[_0x4b57('0x55')]=_0x566fec['id'];_0x310db6['VoicePrefixId']=_0x36f154['id'];return _0x310db6;});return db['VoiceExtension'][_0x4b57('0x62')](_0x1004ac,{'transaction':_0xb58059})[_0x4b57('0x28')](function(_0x431f24){if(!_0x431f24){return _0x3ed705('Extensions\x20creation\x20failed');}else{return _0xbe6f94(_0x431f24);}})[_0x4b57('0x4c')](function(_0x3619a1){return _0x3ed705(_0x3619a1);});});;});};function addVoicePrefixExtensions(_0x5f372d,_0x20172a){var _0x119933=[];var _0x5a0c38=formatPrefixName(_0x5f372d[_0x4b57('0x5f')]);_0x119933[_0x4b57('0x63')](new Extension(_0x5a0c38,0x2,_0x4b57('0x64'),_0x4b57('0x65')+_0x5f372d[_0x4b57('0x2f')]));if(_0x5f372d[_0x4b57('0x66')]){_0x119933[_0x4b57('0x63')](new Extension(_0x5a0c38,0x3,'Set','PREFIX-CALLERIDALL='+_0x5f372d[_0x4b57('0x66')]));}else{_0x119933[_0x4b57('0x63')](new Extension(_0x5a0c38,0x3,'NoOp','No\x20callerid\x20available'));}_0x119933[_0x4b57('0x63')](new Extension(_0x5a0c38,0x4,_0x4b57('0x67'),_0x20172a['context']+','+'${EXTEN:'+(0x8+_0x5f372d['name'][_0x4b57('0x3d')])+'}'+','+0x1));return _0x119933;}function formatPrefixName(_0x438f3e){var _0x243f4d='_';for(var _0x5976ce=0x0;_0x5976ce<_0x438f3e['length'];_0x5976ce++){if(_0x438f3e['charAt'](_0x5976ce)=='-'){_0x243f4d+=_0x438f3e[_0x4b57('0x68')](_0x5976ce);}else{_0x243f4d+='['+_0x438f3e['charAt'](_0x5976ce)+']';}}_0x243f4d+='.';return _0x243f4d;}exports[_0x4b57('0x27')]=function(_0x502313,_0x13c680,_0x425fe0){var _0x29b8ac=_0x502313[_0x4b57('0x69')];_0x29b8ac['prefix']=_0x4b57('0x6a')+_0x29b8ac['name']+'-';return db['sequelize'][_0x4b57('0x53')](function(_0x2a5bbd){return db['VoicePrefix'][_0x4b57('0x27')](_0x29b8ac,{'where':{'id':_0x29b8ac['id']},'transaction':_0x2a5bbd})[_0x4b57('0x28')](function(){return db[_0x4b57('0x54')][_0x4b57('0x4f')]({'where':{'VoicePrefixId':_0x29b8ac['id']},'transaction':_0x2a5bbd})[_0x4b57('0x28')](function(){return db[_0x4b57('0x54')]['find']({'where':{'id':_0x29b8ac[_0x4b57('0x55')]},'raw':!![]})[_0x4b57('0x28')](function(_0x3db213){return createVoicePrefixExtensions(_0x29b8ac,_0x3db213,_0x2a5bbd);});});});})[_0x4b57('0x28')](function(){return db[_0x4b57('0x31')]['findById'](_0x29b8ac['id']);})[_0x4b57('0x28')](respondWithResult(_0x13c680,null))[_0x4b57('0x4c')](handleError(_0x13c680,null));};exports[_0x4b57('0x6b')]=function(_0x24bd50,_0x5565f4,_0x4b17c3){return db[_0x4b57('0x31')][_0x4b57('0x4e')]({'where':{'id':_0x24bd50[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x5565f4,null))[_0x4b57('0x28')](function(_0x5c1679){if(_0x5c1679){return _0x5c1679[_0x4b57('0x6b')](_0x24bd50[_0x4b57('0x69')]['ids'],_['omit'](_0x24bd50[_0x4b57('0x69')],['ids','id'])||{})[_0x4b57('0x6c')](function(_0x428450){for(var _0x374d6f=0x0;_0x374d6f<_0x24bd50[_0x4b57('0x69')][_0x4b57('0x6d')]['length'];_0x374d6f+=0x1){socket[_0x4b57('0x6e')](_0x4b57('0x6f'),{'UserId':Number(_0x24bd50[_0x4b57('0x69')]['ids'][_0x374d6f]),'VoicePrefixId':Number(_0x24bd50['params']['id'])});}return _0x428450;});}})[_0x4b57('0x28')](respondWithResult(_0x5565f4,null))[_0x4b57('0x4c')](handleError(_0x5565f4,null));};exports['removeAgents']=function(_0x1ceb74,_0x1148ff,_0x5d4ff9){return db[_0x4b57('0x31')][_0x4b57('0x4e')]({'where':{'id':_0x1ceb74['params']['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x1148ff,null))[_0x4b57('0x28')](function(_0x36ab03){if(_0x36ab03){return _0x36ab03['removeAgents'](_0x1ceb74[_0x4b57('0x38')][_0x4b57('0x6d')])[_0x4b57('0x28')](function(){if(_[_0x4b57('0x70')](_0x1ceb74[_0x4b57('0x38')][_0x4b57('0x6d')])){for(var _0x3d15eb=0x0;_0x3d15eb<_0x1ceb74['query'][_0x4b57('0x6d')][_0x4b57('0x3d')];_0x3d15eb+=0x1){socket['emit'](_0x4b57('0x71'),{'UserId':Number(_0x1ceb74[_0x4b57('0x38')]['ids'][_0x3d15eb]),'VoicePrefixId':Number(_0x1ceb74[_0x4b57('0x50')]['id'])});}}else{socket[_0x4b57('0x6e')](_0x4b57('0x71'),{'UserId':Number(_0x1ceb74[_0x4b57('0x38')][_0x4b57('0x6d')]),'VoicePrefixId':Number(_0x1ceb74[_0x4b57('0x50')]['id'])});}});}})[_0x4b57('0x28')](respondWithStatusCode(_0x1148ff,null))[_0x4b57('0x4c')](handleError(_0x1148ff,null));};exports[_0x4b57('0x72')]=function(_0x830213,_0x87a28b,_0x3ab6b0){var _0x1dbfb8={};var _0x11f513={};var _0x185dab;var _0x4468fb;return db[_0x4b57('0x31')][_0x4b57('0x73')]({'where':{'id':_0x830213[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x87a28b,null))[_0x4b57('0x28')](function(_0x20da30){if(_0x20da30){_0x185dab=_0x20da30;_0x11f513[_0x4b57('0x35')]=_[_0x4b57('0x37')](db[_0x4b57('0x74')]['rawAttributes']);_0x11f513['query']=_['keys'](_0x830213['query']);_0x11f513[_0x4b57('0x39')]=_[_0x4b57('0x3a')](_0x11f513['model'],_0x11f513[_0x4b57('0x38')]);_0x1dbfb8[_0x4b57('0x3c')]=_['intersection'](_0x11f513[_0x4b57('0x35')],qs[_0x4b57('0x3b')](_0x830213['query']['fields']));_0x1dbfb8[_0x4b57('0x3c')]=_0x1dbfb8[_0x4b57('0x3c')][_0x4b57('0x3d')]?_0x1dbfb8[_0x4b57('0x3c')]:_0x11f513[_0x4b57('0x35')];_0x1dbfb8[_0x4b57('0x40')]=qs[_0x4b57('0x41')](_0x830213['query']['sort']);_0x1dbfb8[_0x4b57('0x42')]=qs[_0x4b57('0x39')](_[_0x4b57('0x43')](_0x830213[_0x4b57('0x38')],_0x11f513[_0x4b57('0x39')]));if(_0x830213[_0x4b57('0x38')][_0x4b57('0x46')]){_0x1dbfb8[_0x4b57('0x42')]=_[_0x4b57('0x44')](_0x1dbfb8['where'],{'$or':_[_0x4b57('0x36')](_0x1dbfb8[_0x4b57('0x3c')],function(_0x3dacb2){var _0x62df8b={};_0x62df8b[_0x3dacb2]={'$like':'%'+_0x830213['query']['filter']+'%'};return _0x62df8b;})});}_0x1dbfb8=_[_0x4b57('0x44')]({},_0x1dbfb8,_0x830213[_0x4b57('0x47')]);return _0x185dab['getAgents'](_0x1dbfb8);}})[_0x4b57('0x28')](function(_0x71a944){if(_0x71a944){_0x4468fb=_0x71a944['length'];if(!_0x830213[_0x4b57('0x38')]['hasOwnProperty']('nolimit')){_0x1dbfb8[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0x830213[_0x4b57('0x38')][_0x4b57('0x21')]);_0x1dbfb8[_0x4b57('0x1f')]=qs['offset'](_0x830213[_0x4b57('0x38')][_0x4b57('0x1f')]);}return _0x185dab[_0x4b57('0x72')](_0x1dbfb8);}})[_0x4b57('0x28')](function(_0x14c1d6){if(_0x14c1d6){return _0x14c1d6?{'count':_0x4468fb,'rows':_0x14c1d6}:null;}})[_0x4b57('0x28')](respondWithResult(_0x87a28b,null))[_0x4b57('0x4c')](handleError(_0x87a28b,null));};exports['getTeams']=function(_0xe1bf71,_0x5ea27c,_0x35a29b){var _0x181029={};var _0x3b5100={};var _0x53b4a5;var _0x5357a3;return db[_0x4b57('0x31')][_0x4b57('0x73')]({'where':{'id':_0xe1bf71[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ea27c,null))[_0x4b57('0x28')](function(_0x455949){if(_0x455949){_0x53b4a5=_0x455949;_0x3b5100['model']=_[_0x4b57('0x37')](db[_0x4b57('0x75')][_0x4b57('0x32')]);_0x3b5100[_0x4b57('0x38')]=_[_0x4b57('0x37')](_0xe1bf71[_0x4b57('0x38')]);_0x3b5100[_0x4b57('0x39')]=_[_0x4b57('0x3a')](_0x3b5100['model'],_0x3b5100[_0x4b57('0x38')]);_0x181029[_0x4b57('0x3c')]=_[_0x4b57('0x3a')](_0x3b5100['model'],qs[_0x4b57('0x3b')](_0xe1bf71['query']['fields']));_0x181029[_0x4b57('0x3c')]=_0x181029[_0x4b57('0x3c')][_0x4b57('0x3d')]?_0x181029[_0x4b57('0x3c')]:_0x3b5100[_0x4b57('0x35')];_0x181029[_0x4b57('0x40')]=qs[_0x4b57('0x41')](_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x41')]);_0x181029['where']=qs[_0x4b57('0x39')](_['pick'](_0xe1bf71[_0x4b57('0x38')],_0x3b5100['filters']));if(_0xe1bf71['query'][_0x4b57('0x46')]){_0x181029[_0x4b57('0x42')]=_[_0x4b57('0x44')](_0x181029[_0x4b57('0x42')],{'$or':_[_0x4b57('0x36')](_0x181029[_0x4b57('0x3c')],function(_0x30e3ab){var _0xca5674={};_0xca5674[_0x30e3ab]={'$like':'%'+_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x46')]+'%'};return _0xca5674;})});}_0x181029=_[_0x4b57('0x44')]({},_0x181029,_0xe1bf71[_0x4b57('0x47')]);return _0x53b4a5[_0x4b57('0x76')](_0x181029);}})[_0x4b57('0x28')](function(_0x52d476){if(_0x52d476){_0x5357a3=_0x52d476[_0x4b57('0x3d')];if(!_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x3e')]('nolimit')){_0x181029[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x21')]);_0x181029[_0x4b57('0x1f')]=qs['offset'](_0xe1bf71[_0x4b57('0x38')][_0x4b57('0x1f')]);}return _0x53b4a5[_0x4b57('0x76')](_0x181029);}})[_0x4b57('0x28')](function(_0x1c63c1){if(_0x1c63c1){return _0x1c63c1?{'count':_0x5357a3,'rows':_0x1c63c1}:null;}})[_0x4b57('0x28')](respondWithResult(_0x5ea27c,null))[_0x4b57('0x4c')](handleError(_0x5ea27c,null));};exports[_0x4b57('0x77')]=function(_0x20560b,_0x535ccc,_0x320a0a){var _0x2a2689=_0x20560b[_0x4b57('0x69')][_0x4b57('0x6d')];var _0x19e09a;return db[_0x4b57('0x75')][_0x4b57('0x4a')]({'where':{'id':_0x2a2689},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4b57('0x78'),'attributes':['id',_0x4b57('0x2f'),_0x4b57('0x79'),_0x4b57('0x7a'),_0x4b57('0x7b')],'raw':!![]}]})[_0x4b57('0x28')](function(_0x4c7fa8){if(_0x4c7fa8){_0x19e09a=_0x4c7fa8;var _0x46e1b0=_[_0x4b57('0x7c')](_0x4c7fa8,function(_0x448b3d){var _0x287c29=_0x448b3d[_0x4b57('0x29')]({'plain':!![]});return _0x287c29[_0x4b57('0x78')];});return db['VoicePrefix'][_0x4b57('0x4e')]({'where':{'id':_0x20560b[_0x4b57('0x50')]['id']}})['then'](function(_0x60d8d0){return db[_0x4b57('0x52')][_0x4b57('0x53')](function(_0x34d45d){return _0x60d8d0[_0x4b57('0x77')](_0x2a2689,{'transaction':_0x34d45d})[_0x4b57('0x28')](function(){return BPromise[_0x4b57('0x7d')](_0x19e09a,function(_0x50bbdc){return db[_0x4b57('0x7e')]['upsert']({'TeamId':_0x50bbdc['id'],'VoicePrefixId':_0x20560b[_0x4b57('0x50')]['id']},{'transaction':_0x34d45d});});})[_0x4b57('0x28')](function(){return BPromise[_0x4b57('0x7d')](_0x46e1b0,function(_0x46037e){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x46037e['id'],'VoicePrefixId':_0x20560b['params']['id']},'transaction':_0x34d45d});});})['then'](function(){_0x46e1b0[_0x4b57('0x7f')](function(_0x2e0bf0){socket['emit'](_0x4b57('0x6f'),{'UserId':_0x2e0bf0['id'],'VoicePrefixId':_0x60d8d0['id']});});});});});}})[_0x4b57('0x28')](respondWithStatusCode(_0x535ccc,null))[_0x4b57('0x4c')](handleError(_0x535ccc,null));};exports['removeTeams']=function(_0x5c4333,_0x4fff4a,_0x515113){return db[_0x4b57('0x75')][_0x4b57('0x4a')]({'where':{'id':_0x5c4333[_0x4b57('0x38')][_0x4b57('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x4b57('0x74')],'as':_0x4b57('0x78'),'attributes':['id'],'raw':!![]}]})[_0x4b57('0x28')](handleEntityNotFound(_0x4fff4a,null))[_0x4b57('0x28')](function(_0xa1ce41){var _0x191975=_['map'](_0xa1ce41,'id');var _0xd16e62=[];var _0x2115cf=[];var _0x4555dc=squel[_0x4b57('0x80')]();_0x4555dc[_0x4b57('0x81')](_0x4b57('0x82'))[_0x4b57('0x83')]('team_has_voice_prefixes','tq')[_0x4b57('0x84')](_0x4b57('0x85'),'ut',_0x4b57('0x86'))['where'](_0x4b57('0x87'),_0x5c4333[_0x4b57('0x50')]['id']);for(var _0x9eb896=0x0;_0x9eb896<_0xa1ce41[_0x4b57('0x3d')];_0x9eb896+=0x1){let _0x1f930b=_0xa1ce41[_0x9eb896];for(var _0x19d369=0x0;_0x19d369<_0x1f930b[_0x4b57('0x78')][_0x4b57('0x3d')];_0x19d369+=0x1){let _0x1e7f07=_0x1f930b[_0x4b57('0x78')][_0x19d369];var _0x51c328=_0x4555dc[_0x4b57('0x88')]();_0x51c328[_0x4b57('0x42')](_0x4b57('0x89'),_0x1e7f07['id']);_0x2115cf[_0x4b57('0x63')](db[_0x4b57('0x52')][_0x4b57('0x38')](_0x51c328[_0x4b57('0x8a')](),{'type':db[_0x4b57('0x52')][_0x4b57('0x8b')][_0x4b57('0x8c')]})[_0x4b57('0x28')](function(_0x307e53){if(_0x307e53['length']===0x1){return _0x1e7f07['id'];}else{var _0x365017=_[_0x4b57('0x8d')](_['map'](_0x307e53,_0x4b57('0x8e')),function(_0x5569e4){return _[_0x4b57('0x8f')](_0x191975,_0x5569e4);});if(_0x365017){return _0x1e7f07['id'];}}}));}}return BPromise[_0x4b57('0x90')](_0x2115cf)[_0x4b57('0x28')](function(_0x3b3373){_0xd16e62=_(_0xd16e62)['union'](_0x3b3373)[_0x4b57('0x91')]()[_0x4b57('0x92')]();return db[_0x4b57('0x31')][_0x4b57('0x4e')]({'where':{'id':_0x5c4333[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](function(_0x6083ae){return db['sequelize'][_0x4b57('0x53')](function(_0x29f8a1){return _0x6083ae[_0x4b57('0x93')](_0x5c4333['query']['ids'],{'transaction':_0x29f8a1})[_0x4b57('0x28')](function(){if(!_['isEmpty'](_0xd16e62)){return _0x6083ae['removeAgents'](_0xd16e62,{'transaction':_0x29f8a1});}})[_0x4b57('0x28')](function(){_0xd16e62[_0x4b57('0x7f')](function(_0x592b7d){socket[_0x4b57('0x6e')](_0x4b57('0x71'),{'UserId':_0x592b7d,'VoicePrefixId':_0x6083ae['id']});});});});});});})['then'](respondWithStatusCode(_0x4fff4a,null))['catch'](handleError(_0x4fff4a,null));}; \ No newline at end of file +var _0x8f4c=['save','update','destroy','then','VoicePrefixes','error','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','prefix','system-','VoiceExtensionId','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','findAll','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x1b05ba,_0x538196){var _0x4b8ffe=function(_0x370583){while(--_0x370583){_0x1b05ba['push'](_0x1b05ba['shift']());}};_0x4b8ffe(++_0x538196);}(_0x8f4c,0x113));var _0xc8f4=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x8f4c[_0x41bdd4];return _0x5c03a6;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];config[_0xc8f4('0x17')]=_[_0xc8f4('0x18')](config['redis'],{'host':_0xc8f4('0x19'),'port':0x18eb});var socket=require(_0xc8f4('0x1a'))(new Redis(config[_0xc8f4('0x17')]));require(_0xc8f4('0x1b'))[_0xc8f4('0x1c')](socket);function respondWithStatusCode(_0x411c5c,_0x4e3c36){_0x4e3c36=_0x4e3c36||0xcc;return function(_0x2bce00){if(_0x2bce00){return _0x411c5c[_0xc8f4('0x1d')](_0x4e3c36);}return _0x411c5c[_0xc8f4('0x1e')](_0x4e3c36)[_0xc8f4('0x1f')]();};}function respondWithResult(_0x22c08a,_0x56a25d){_0x56a25d=_0x56a25d||0xc8;return function(_0xac45d5){if(_0xac45d5){return _0x22c08a['status'](_0x56a25d)['json'](_0xac45d5);}};}function respondWithFilteredResult(_0x14bc02,_0x225b76){return function(_0x108076){if(_0x108076){var _0x7bb973=typeof _0x225b76[_0xc8f4('0x20')]===_0xc8f4('0x21')&&typeof _0x225b76[_0xc8f4('0x22')]===_0xc8f4('0x21');var _0x1982bb=_0x108076[_0xc8f4('0x23')];var _0x3cd90c=_0x7bb973?0x0:_0x225b76[_0xc8f4('0x20')];var _0x22236c=_0x7bb973?_0x108076['count']:_0x225b76[_0xc8f4('0x20')]+_0x225b76[_0xc8f4('0x22')];var _0x29e52d;if(_0x22236c>=_0x1982bb){_0x22236c=_0x1982bb;_0x29e52d=0xc8;}else{_0x29e52d=0xce;}_0x14bc02[_0xc8f4('0x1e')](_0x29e52d);return _0x14bc02[_0xc8f4('0x24')](_0xc8f4('0x25'),_0x3cd90c+'-'+_0x22236c+'/'+_0x1982bb)[_0xc8f4('0x26')](_0x108076);}return null;};}function patchUpdates(_0x43eb57){return function(_0x5e62aa){try{jsonpatch[_0xc8f4('0x27')](_0x5e62aa,_0x43eb57,!![]);}catch(_0x205c41){return BPromise[_0xc8f4('0x28')](_0x205c41);}return _0x5e62aa[_0xc8f4('0x29')]();};}function saveUpdates(_0x5d54a9,_0x39174f){return function(_0x4a44e0){if(_0x4a44e0){return _0x4a44e0[_0xc8f4('0x2a')](_0x5d54a9)['then'](function(_0x177a44){return _0x177a44;});}return null;};}function removeEntity(_0x3dd717,_0x5c94c6){return function(_0x41f4de){if(_0x41f4de){return _0x41f4de[_0xc8f4('0x2b')]()[_0xc8f4('0x2c')](function(){var _0x2fa052=_0x41f4de['get']({'plain':!![]});var _0x3db490=_0xc8f4('0x2d');return db['UserProfileResource'][_0xc8f4('0x2b')]({'where':{'type':_0x3db490,'resourceId':_0x2fa052['id']}})[_0xc8f4('0x2c')](function(){return _0x41f4de;});})[_0xc8f4('0x2c')](function(){_0x3dd717[_0xc8f4('0x1e')](0xcc)[_0xc8f4('0x1f')]();});}};}function handleEntityNotFound(_0x385e41,_0x4a25da){return function(_0x45f972){if(!_0x45f972){_0x385e41[_0xc8f4('0x1d')](0x194);}return _0x45f972;};}function handleError(_0x1ea3d9,_0x4dcd8f){_0x4dcd8f=_0x4dcd8f||0x1f4;return function(_0xf4a556){logger[_0xc8f4('0x2e')](_0xf4a556['stack']);if(_0xf4a556['name']){delete _0xf4a556['name'];}_0x1ea3d9[_0xc8f4('0x1e')](_0x4dcd8f)[_0xc8f4('0x2f')](_0xf4a556);};}exports[_0xc8f4('0x30')]=function(_0x28baa0,_0x273e73){var _0x2f9a80={},_0x3181af={},_0xffc7aa={'count':0x0,'rows':[]};var _0x4b4203=_[_0xc8f4('0x31')](db[_0xc8f4('0x32')][_0xc8f4('0x33')],function(_0x5cb6ce){return{'name':_0x5cb6ce[_0xc8f4('0x34')],'type':_0x5cb6ce[_0xc8f4('0x35')]['key']};});_0x3181af[_0xc8f4('0x36')]=_[_0xc8f4('0x31')](_0x4b4203,_0xc8f4('0x37'));_0x3181af['query']=_[_0xc8f4('0x38')](_0x28baa0[_0xc8f4('0x39')]);_0x3181af[_0xc8f4('0x3a')]=_['intersection'](_0x3181af[_0xc8f4('0x36')],_0x3181af[_0xc8f4('0x39')]);_0x2f9a80[_0xc8f4('0x3b')]=_[_0xc8f4('0x3c')](_0x3181af[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x2f9a80[_0xc8f4('0x3b')]=_0x2f9a80[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x2f9a80[_0xc8f4('0x3b')]:_0x3181af[_0xc8f4('0x36')];if(!_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x2f9a80['limit']=qs[_0xc8f4('0x22')](_0x28baa0['query'][_0xc8f4('0x22')]);_0x2f9a80['offset']=qs[_0xc8f4('0x20')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x20')]);}_0x2f9a80[_0xc8f4('0x41')]=qs[_0xc8f4('0x42')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x2f9a80['where']=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x28baa0[_0xc8f4('0x39')],_0x3181af[_0xc8f4('0x3a')]),_0x4b4203);if(_0x28baa0['query'][_0xc8f4('0x44')]){_0x2f9a80[_0xc8f4('0x45')]=_[_0xc8f4('0x46')](_0x2f9a80[_0xc8f4('0x45')],{'$or':_[_0xc8f4('0x31')](_0x4b4203,function(_0x1d7831){if(_0x1d7831[_0xc8f4('0x35')]!==_0xc8f4('0x47')){var _0x1eebbd={};_0x1eebbd[_0x1d7831[_0xc8f4('0x37')]]={'$like':'%'+_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x44')]+'%'};return _0x1eebbd;}})});}_0x2f9a80=_['merge']({},_0x2f9a80,_0x28baa0[_0xc8f4('0x48')]);var _0x32e067={'where':_0x2f9a80[_0xc8f4('0x45')]};return db[_0xc8f4('0x32')]['count'](_0x32e067)['then'](function(_0x413a55){_0xffc7aa[_0xc8f4('0x23')]=_0x413a55;if(_0x28baa0['query'][_0xc8f4('0x49')]){_0x2f9a80[_0xc8f4('0x4a')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x2f9a80);})[_0xc8f4('0x2c')](function(_0x342c28){_0xffc7aa[_0xc8f4('0x4b')]=_0x342c28;return _0xffc7aa;})[_0xc8f4('0x2c')](respondWithFilteredResult(_0x273e73,_0x2f9a80))[_0xc8f4('0x4c')](handleError(_0x273e73,null));};exports[_0xc8f4('0x4d')]=function(_0x4de3d1,_0x522f52){var _0x705792={'raw':![],'where':{'id':_0x4de3d1[_0xc8f4('0x4e')]['id']}},_0x8c82a5={};_0x8c82a5['model']=_['keys'](db['VoicePrefix']['rawAttributes']);_0x8c82a5['query']=_[_0xc8f4('0x38')](_0x4de3d1[_0xc8f4('0x39')]);_0x8c82a5[_0xc8f4('0x3a')]=_[_0xc8f4('0x3c')](_0x8c82a5[_0xc8f4('0x36')],_0x8c82a5[_0xc8f4('0x39')]);_0x705792['attributes']=_[_0xc8f4('0x3c')](_0x8c82a5[_0xc8f4('0x36')],qs['fields'](_0x4de3d1['query'][_0xc8f4('0x3d')]));_0x705792[_0xc8f4('0x3b')]=_0x705792[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x705792['attributes']:_0x8c82a5['model'];if(_0x4de3d1[_0xc8f4('0x39')][_0xc8f4('0x49')]){_0x705792[_0xc8f4('0x4a')]=[{'all':!![]}];}_0x705792=_[_0xc8f4('0x46')]({},_0x705792,_0x4de3d1[_0xc8f4('0x48')]);return db[_0xc8f4('0x32')]['find'](_0x705792)['then'](handleEntityNotFound(_0x522f52,null))[_0xc8f4('0x2c')](respondWithResult(_0x522f52,null))[_0xc8f4('0x4c')](handleError(_0x522f52,null));};exports[_0xc8f4('0x2b')]=function(_0x1b3744,_0x39b4a4){return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0x1b3744[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x39b4a4,null))['then'](removeEntity(_0x39b4a4,null))['catch'](handleError(_0x39b4a4,null));};exports[_0xc8f4('0x50')]=function(_0xc11ff5,_0x1e5932){return db[_0xc8f4('0x32')][_0xc8f4('0x50')]()[_0xc8f4('0x2c')](respondWithResult(_0x1e5932,null))[_0xc8f4('0x4c')](handleError(_0x1e5932,null));};exports[_0xc8f4('0x51')]=function(_0x197f3c,_0x189fae){var _0x15064a;return db[_0xc8f4('0x52')][_0xc8f4('0x53')](function(_0x4ec67d){return db[_0xc8f4('0x32')][_0xc8f4('0x51')](_0x197f3c[_0xc8f4('0x54')],{'transaction':_0x4ec67d})[_0xc8f4('0x2c')](function(_0x481dd2){_0x15064a=_0x481dd2[_0xc8f4('0x55')]({'plain':!![]});return db[_0xc8f4('0x56')]['find']({'where':{'id':_0x15064a['VoiceExtensionId']},'raw':!![]})[_0xc8f4('0x2c')](function(_0x5cc52d){return createVoicePrefixExtensions(_0x15064a,_0x5cc52d,_0x4ec67d);});});})[_0xc8f4('0x2c')](function(){var _0x29f8f4=_0x197f3c[_0xc8f4('0x57')][_0xc8f4('0x55')]({'plain':!![]});if(!_0x29f8f4)throw new Error(_0xc8f4('0x58'));if(_0x29f8f4[_0xc8f4('0x59')]===_0xc8f4('0x57')){var _0x1f7602=_0x15064a;return db[_0xc8f4('0x5a')][_0xc8f4('0x4f')]({'where':{'name':_0xc8f4('0x2d'),'userProfileId':_0x29f8f4['userProfileId']},'raw':!![]})[_0xc8f4('0x2c')](function(_0x1f983e){if(_0x1f983e&&_0x1f983e[_0xc8f4('0x5b')]===0x0){return db[_0xc8f4('0x5c')]['create']({'name':_0x1f7602[_0xc8f4('0x37')],'resourceId':_0x1f7602['id'],'type':_0x1f983e['name'],'sectionId':_0x1f983e['id']},{})['then'](function(){return _0x15064a;});}else{return _0x15064a;}})[_0xc8f4('0x4c')](function(_0x451a3e){logger[_0xc8f4('0x2e')](_0xc8f4('0x5d'),_0x451a3e);throw _0x451a3e;});}return _0x15064a;})[_0xc8f4('0x2c')](respondWithResult(_0x189fae,null))[_0xc8f4('0x4c')](handleError(_0x189fae,null));};function Extension(_0x5aba71,_0x562e89,_0x45fb1a,_0x2b558e){this[_0xc8f4('0x5e')]=_0xc8f4('0x5f');this[_0xc8f4('0x60')]=_0x5aba71;this[_0xc8f4('0x61')]=_0x45fb1a;this[_0xc8f4('0x35')]='system';this[_0xc8f4('0x62')]=_0xc8f4('0x63');this['priority']=_0x562e89;this[_0xc8f4('0x64')]=_0x2b558e;}function createVoicePrefixExtensions(_0x2da305,_0x9dbf80,_0x5b8bf4){return new BPromise(function(_0x368798,_0x3aa12d){var _0x33801b=new Extension(formatPrefixName(_0x2da305['prefix']),0x1,_0xc8f4('0x65'),_0xc8f4('0x66'));_0x33801b['VoicePrefixId']=_0x2da305['id'];return db['VoiceExtension'][_0xc8f4('0x51')](_0x33801b,{'transaction':_0x5b8bf4})['then'](function(_0x281b3a){var _0x44f603=_0x281b3a['get']({'plain':!![]});var _0x5f2781=_['map'](addVoicePrefixExtensions(_0x2da305,_0x9dbf80),function(_0x490b8b){_0x490b8b['VoiceExtensionId']=_0x44f603['id'];_0x490b8b['VoicePrefixId']=_0x2da305['id'];return _0x490b8b;});return db[_0xc8f4('0x56')]['bulkCreate'](_0x5f2781,{'transaction':_0x5b8bf4})[_0xc8f4('0x2c')](function(_0x357e45){if(!_0x357e45){return _0x3aa12d(_0xc8f4('0x67'));}else{return _0x368798(_0x357e45);}})[_0xc8f4('0x4c')](function(_0x5ea840){return _0x3aa12d(_0x5ea840);});});;});};function addVoicePrefixExtensions(_0x3f2596,_0x329c26){var _0x3ca2ca=[];var _0xb50e61=formatPrefixName(_0x3f2596['prefix']);_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x2,_0xc8f4('0x69'),_0xc8f4('0x6a')+_0x3f2596[_0xc8f4('0x37')]));if(_0x3f2596['callerIdAll']){_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x3,_0xc8f4('0x69'),'PREFIX-CALLERIDALL='+_0x3f2596[_0xc8f4('0x6b')]));}else{_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x3,_0xc8f4('0x65'),_0xc8f4('0x6c')));}_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x4,_0xc8f4('0x6d'),_0x329c26['context']+','+_0xc8f4('0x6e')+(0x8+_0x3f2596[_0xc8f4('0x37')][_0xc8f4('0x3e')])+'}'+','+0x1));return _0x3ca2ca;}function formatPrefixName(_0x5e5117){var _0x28db1f='_';for(var _0x2b6510=0x0;_0x2b6510<_0x5e5117[_0xc8f4('0x3e')];_0x2b6510++){if(_0x5e5117['charAt'](_0x2b6510)=='-'){_0x28db1f+=_0x5e5117[_0xc8f4('0x6f')](_0x2b6510);}else{_0x28db1f+='['+_0x5e5117[_0xc8f4('0x6f')](_0x2b6510)+']';}}_0x28db1f+='.';return _0x28db1f;}exports[_0xc8f4('0x2a')]=function(_0x1278f1,_0x5bf089,_0x8c8e43){var _0x9996da=_0x1278f1['body'];_0x9996da[_0xc8f4('0x70')]=_0xc8f4('0x71')+_0x9996da['name']+'-';return db[_0xc8f4('0x52')][_0xc8f4('0x53')](function(_0x437718){return db[_0xc8f4('0x32')][_0xc8f4('0x2a')](_0x9996da,{'where':{'id':_0x9996da['id']},'transaction':_0x437718})[_0xc8f4('0x2c')](function(){return db[_0xc8f4('0x56')][_0xc8f4('0x2b')]({'where':{'VoicePrefixId':_0x9996da['id']},'transaction':_0x437718})['then'](function(){return db[_0xc8f4('0x56')][_0xc8f4('0x4f')]({'where':{'id':_0x9996da[_0xc8f4('0x72')]},'raw':!![]})[_0xc8f4('0x2c')](function(_0xdc64f3){return createVoicePrefixExtensions(_0x9996da,_0xdc64f3,_0x437718);});});});})['then'](function(){return db[_0xc8f4('0x32')]['findById'](_0x9996da['id']);})[_0xc8f4('0x2c')](respondWithResult(_0x5bf089,null))[_0xc8f4('0x4c')](handleError(_0x5bf089,null));};exports[_0xc8f4('0x73')]=function(_0x30e155,_0xc6df8e,_0x9a7714){return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0x30e155[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0xc6df8e,null))[_0xc8f4('0x2c')](function(_0x4d7d74){if(_0x4d7d74){return _0x4d7d74[_0xc8f4('0x73')](_0x30e155[_0xc8f4('0x54')][_0xc8f4('0x74')],_[_0xc8f4('0x75')](_0x30e155['body'],['ids','id'])||{})[_0xc8f4('0x76')](function(_0x4cde06){for(var _0x205ed9=0x0;_0x205ed9<_0x30e155['body'][_0xc8f4('0x74')]['length'];_0x205ed9+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x30e155['body']['ids'][_0x205ed9]),'VoicePrefixId':Number(_0x30e155['params']['id'])});}return _0x4cde06;});}})[_0xc8f4('0x2c')](respondWithResult(_0xc6df8e,null))['catch'](handleError(_0xc6df8e,null));};exports[_0xc8f4('0x77')]=function(_0x3ad7dd,_0x3e22c2,_0x367d5e){return db[_0xc8f4('0x32')]['find']({'where':{'id':_0x3ad7dd[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x3e22c2,null))[_0xc8f4('0x2c')](function(_0x5b354d){if(_0x5b354d){return _0x5b354d[_0xc8f4('0x77')](_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')])[_0xc8f4('0x2c')](function(){if(_[_0xc8f4('0x78')](_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')])){for(var _0x1401f1=0x0;_0x1401f1<_0x3ad7dd['query'][_0xc8f4('0x74')][_0xc8f4('0x3e')];_0x1401f1+=0x1){socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':Number(_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')][_0x1401f1]),'VoicePrefixId':Number(_0x3ad7dd[_0xc8f4('0x4e')]['id'])});}}else{socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':Number(_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')]),'VoicePrefixId':Number(_0x3ad7dd['params']['id'])});}});}})[_0xc8f4('0x2c')](respondWithStatusCode(_0x3e22c2,null))[_0xc8f4('0x4c')](handleError(_0x3e22c2,null));};exports['getAgents']=function(_0x412695,_0x1921bc,_0x50f012){var _0x16ea62={};var _0x2bbf57={};var _0x57b97a;var _0x5bb6cc;return db[_0xc8f4('0x32')][_0xc8f4('0x7b')]({'where':{'id':_0x412695[_0xc8f4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1921bc,null))[_0xc8f4('0x2c')](function(_0xf1c31d){if(_0xf1c31d){_0x57b97a=_0xf1c31d;_0x2bbf57['model']=_['keys'](db[_0xc8f4('0x7c')][_0xc8f4('0x33')]);_0x2bbf57[_0xc8f4('0x39')]=_['keys'](_0x412695[_0xc8f4('0x39')]);_0x2bbf57[_0xc8f4('0x3a')]=_[_0xc8f4('0x3c')](_0x2bbf57['model'],_0x2bbf57[_0xc8f4('0x39')]);_0x16ea62[_0xc8f4('0x3b')]=_[_0xc8f4('0x3c')](_0x2bbf57[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x16ea62[_0xc8f4('0x3b')]=_0x16ea62[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x16ea62[_0xc8f4('0x3b')]:_0x2bbf57['model'];_0x16ea62[_0xc8f4('0x41')]=qs['sort'](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x16ea62[_0xc8f4('0x45')]=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x412695[_0xc8f4('0x39')],_0x2bbf57[_0xc8f4('0x3a')]));if(_0x412695[_0xc8f4('0x39')]['filter']){_0x16ea62[_0xc8f4('0x45')]=_['merge'](_0x16ea62['where'],{'$or':_[_0xc8f4('0x31')](_0x16ea62[_0xc8f4('0x3b')],function(_0x35a3db){var _0x4fedd9={};_0x4fedd9[_0x35a3db]={'$like':'%'+_0x412695['query'][_0xc8f4('0x44')]+'%'};return _0x4fedd9;})});}_0x16ea62=_[_0xc8f4('0x46')]({},_0x16ea62,_0x412695[_0xc8f4('0x48')]);return _0x57b97a['getAgents'](_0x16ea62);}})[_0xc8f4('0x2c')](function(_0x5ce8eb){if(_0x5ce8eb){_0x5bb6cc=_0x5ce8eb[_0xc8f4('0x3e')];if(!_0x412695[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x16ea62[_0xc8f4('0x22')]=qs['limit'](_0x412695[_0xc8f4('0x39')]['limit']);_0x16ea62[_0xc8f4('0x20')]=qs[_0xc8f4('0x20')](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x20')]);}return _0x57b97a[_0xc8f4('0x7d')](_0x16ea62);}})[_0xc8f4('0x2c')](function(_0x3f1852){if(_0x3f1852){return _0x3f1852?{'count':_0x5bb6cc,'rows':_0x3f1852}:null;}})[_0xc8f4('0x2c')](respondWithResult(_0x1921bc,null))[_0xc8f4('0x4c')](handleError(_0x1921bc,null));};exports[_0xc8f4('0x7e')]=function(_0x28bcf0,_0x53bd16,_0x526010){var _0x23890b={};var _0x20c759={};var _0x13a274;var _0xb813ba;return db[_0xc8f4('0x32')][_0xc8f4('0x7b')]({'where':{'id':_0x28bcf0[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x53bd16,null))[_0xc8f4('0x2c')](function(_0x7758c2){if(_0x7758c2){_0x13a274=_0x7758c2;_0x20c759[_0xc8f4('0x36')]=_[_0xc8f4('0x38')](db['Team']['rawAttributes']);_0x20c759[_0xc8f4('0x39')]=_['keys'](_0x28bcf0['query']);_0x20c759[_0xc8f4('0x3a')]=_['intersection'](_0x20c759['model'],_0x20c759['query']);_0x23890b['attributes']=_['intersection'](_0x20c759[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x23890b[_0xc8f4('0x3b')]=_0x23890b[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x23890b[_0xc8f4('0x3b')]:_0x20c759[_0xc8f4('0x36')];_0x23890b[_0xc8f4('0x41')]=qs[_0xc8f4('0x42')](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x23890b[_0xc8f4('0x45')]=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x28bcf0[_0xc8f4('0x39')],_0x20c759[_0xc8f4('0x3a')]));if(_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x44')]){_0x23890b[_0xc8f4('0x45')]=_[_0xc8f4('0x46')](_0x23890b[_0xc8f4('0x45')],{'$or':_['map'](_0x23890b['attributes'],function(_0xe8ff50){var _0x416ade={};_0x416ade[_0xe8ff50]={'$like':'%'+_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x44')]+'%'};return _0x416ade;})});}_0x23890b=_[_0xc8f4('0x46')]({},_0x23890b,_0x28bcf0[_0xc8f4('0x48')]);return _0x13a274[_0xc8f4('0x7e')](_0x23890b);}})[_0xc8f4('0x2c')](function(_0xe9d619){if(_0xe9d619){_0xb813ba=_0xe9d619[_0xc8f4('0x3e')];if(!_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x23890b[_0xc8f4('0x22')]=qs['limit'](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x22')]);_0x23890b[_0xc8f4('0x20')]=qs[_0xc8f4('0x20')](_0x28bcf0[_0xc8f4('0x39')]['offset']);}return _0x13a274[_0xc8f4('0x7e')](_0x23890b);}})[_0xc8f4('0x2c')](function(_0x5a5f87){if(_0x5a5f87){return _0x5a5f87?{'count':_0xb813ba,'rows':_0x5a5f87}:null;}})['then'](respondWithResult(_0x53bd16,null))[_0xc8f4('0x4c')](handleError(_0x53bd16,null));};exports[_0xc8f4('0x7f')]=function(_0xe771f7,_0x32c7c3,_0x3ecd2e){var _0x4b2876=_0xe771f7['body'][_0xc8f4('0x74')];var _0xe437e;return db['Team'][_0xc8f4('0x80')]({'where':{'id':_0x4b2876},'attributes':['id'],'include':[{'model':db[_0xc8f4('0x7c')],'as':_0xc8f4('0x81'),'attributes':['id',_0xc8f4('0x37'),_0xc8f4('0x82'),_0xc8f4('0x83'),_0xc8f4('0x84')],'raw':!![]}]})[_0xc8f4('0x2c')](function(_0x4a4ea5){if(_0x4a4ea5){_0xe437e=_0x4a4ea5;var _0x23177d=_[_0xc8f4('0x85')](_0x4a4ea5,function(_0x129d2a){var _0x4d63e1=_0x129d2a[_0xc8f4('0x55')]({'plain':!![]});return _0x4d63e1['Agents'];});return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0xe771f7[_0xc8f4('0x4e')]['id']}})['then'](function(_0x3a2f12){return db['sequelize'][_0xc8f4('0x53')](function(_0xfbf268){return _0x3a2f12[_0xc8f4('0x7f')](_0x4b2876,{'transaction':_0xfbf268})['then'](function(){return BPromise[_0xc8f4('0x86')](_0xe437e,function(_0x3a1a5a){return db[_0xc8f4('0x87')][_0xc8f4('0x88')]({'TeamId':_0x3a1a5a['id'],'VoicePrefixId':_0xe771f7['params']['id']},{'transaction':_0xfbf268});});})[_0xc8f4('0x2c')](function(){return BPromise['each'](_0x23177d,function(_0x2180a4){return db['UserVoicePrefix'][_0xc8f4('0x89')]({'where':{'UserId':_0x2180a4['id'],'VoicePrefixId':_0xe771f7[_0xc8f4('0x4e')]['id']},'transaction':_0xfbf268});});})['then'](function(){_0x23177d[_0xc8f4('0x8a')](function(_0x1b0146){socket[_0xc8f4('0x79')](_0xc8f4('0x8b'),{'UserId':_0x1b0146['id'],'VoicePrefixId':_0x3a2f12['id']});});});});});}})[_0xc8f4('0x2c')](respondWithStatusCode(_0x32c7c3,null))['catch'](handleError(_0x32c7c3,null));};exports[_0xc8f4('0x8c')]=function(_0x2a69de,_0xfe16,_0xac0f76){return db['Team'][_0xc8f4('0x80')]({'where':{'id':_0x2a69de[_0xc8f4('0x39')][_0xc8f4('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc8f4('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc8f4('0x2c')](handleEntityNotFound(_0xfe16,null))[_0xc8f4('0x2c')](function(_0x32258c){var _0x3e67d5=_[_0xc8f4('0x31')](_0x32258c,'id');var _0xbc97d=[];var _0x5b723a=[];var _0x9c5a78=squel[_0xc8f4('0x8d')]();_0x9c5a78['field'](_0xc8f4('0x8e'))[_0xc8f4('0x8f')](_0xc8f4('0x90'),'tq')[_0xc8f4('0x91')]('user_has_teams','ut',_0xc8f4('0x92'))['where'](_0xc8f4('0x93'),_0x2a69de[_0xc8f4('0x4e')]['id']);for(var _0x11c10f=0x0;_0x11c10f<_0x32258c['length'];_0x11c10f+=0x1){let _0x2e3221=_0x32258c[_0x11c10f];for(var _0x103c24=0x0;_0x103c24<_0x2e3221[_0xc8f4('0x81')][_0xc8f4('0x3e')];_0x103c24+=0x1){let _0x2e1a3b=_0x2e3221[_0xc8f4('0x81')][_0x103c24];var _0x3c0e05=_0x9c5a78['clone']();_0x3c0e05[_0xc8f4('0x45')](_0xc8f4('0x94'),_0x2e1a3b['id']);_0x5b723a[_0xc8f4('0x68')](db[_0xc8f4('0x52')][_0xc8f4('0x39')](_0x3c0e05[_0xc8f4('0x95')](),{'type':db[_0xc8f4('0x52')][_0xc8f4('0x96')][_0xc8f4('0x97')]})[_0xc8f4('0x2c')](function(_0x29d70c){if(_0x29d70c[_0xc8f4('0x3e')]===0x1){return _0x2e1a3b['id'];}else{var _0x10cc75=_[_0xc8f4('0x98')](_[_0xc8f4('0x31')](_0x29d70c,_0xc8f4('0x99')),function(_0x84dc88){return _[_0xc8f4('0x9a')](_0x3e67d5,_0x84dc88);});if(_0x10cc75){return _0x2e1a3b['id'];}}}));}}return BPromise[_0xc8f4('0x9b')](_0x5b723a)[_0xc8f4('0x2c')](function(_0x506950){_0xbc97d=_(_0xbc97d)['union'](_0x506950)[_0xc8f4('0x9c')]()['value']();return db['VoicePrefix'][_0xc8f4('0x4f')]({'where':{'id':_0x2a69de[_0xc8f4('0x4e')]['id']}})['then'](function(_0x4bba01){return db['sequelize']['transaction'](function(_0x27334b){return _0x4bba01['removeTeams'](_0x2a69de['query'][_0xc8f4('0x74')],{'transaction':_0x27334b})[_0xc8f4('0x2c')](function(){if(!_[_0xc8f4('0x9d')](_0xbc97d)){return _0x4bba01[_0xc8f4('0x77')](_0xbc97d,{'transaction':_0x27334b});}})[_0xc8f4('0x2c')](function(){_0xbc97d[_0xc8f4('0x8a')](function(_0x34a545){socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':_0x34a545,'VoicePrefixId':_0x4bba01['id']});});});});});});})[_0xc8f4('0x2c')](respondWithStatusCode(_0xfe16,null))['catch'](handleError(_0xfe16,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 17bdb6a..28e37a6 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 _0x921e=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x4bc78a,_0x17a88e){var _0x18698e=function(_0x9d14df){while(--_0x9d14df){_0x4bc78a['push'](_0x4bc78a['shift']());}};_0x18698e(++_0x17a88e);}(_0x921e,0x1df));var _0xe921=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x921e[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xe921('0x0'));var VoicePrefix=require(_0xe921('0x1'))['db'][_0xe921('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe921('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe921('0x4'),'afterDestroy':'remove'};function emitEvent(_0x240322){return function(_0x316879,_0xf3df68,_0x30e481){VoicePrefixEvents[_0xe921('0x5')](_0x240322+':'+_0x316879['id'],_0x316879);VoicePrefixEvents[_0xe921('0x5')](_0x240322,_0x316879);_0x30e481(null);};}for(var e in events){if(events[_0xe921('0x6')](e)){var event=events[e];VoicePrefix[_0xe921('0x7')](e,emitEvent(event));}}module[_0xe921('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xf496=['remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save'];(function(_0x1a90b5,_0x581654){var _0x4c079b=function(_0x2c5d35){while(--_0x2c5d35){_0x1a90b5['push'](_0x1a90b5['shift']());}};_0x4c079b(++_0x581654);}(_0xf496,0x10e));var _0x6f49=function(_0x554b27,_0x29fb64){_0x554b27=_0x554b27-0x0;var _0x3378d3=_0xf496[_0x554b27];return _0x3378d3;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x6f49('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6f49('0x1')](0x0);var events={'afterCreate':_0x6f49('0x2'),'afterUpdate':'update','afterDestroy':_0x6f49('0x3')};function emitEvent(_0x3fb254){return function(_0x32115c,_0xb16048,_0x381d9f){VoicePrefixEvents[_0x6f49('0x4')](_0x3fb254+':'+_0x32115c['id'],_0x32115c);VoicePrefixEvents['emit'](_0x3fb254,_0x32115c);_0x381d9f(null);};}for(var e in events){if(events[_0x6f49('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x6f49('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6d9faa4..d501ce9 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 _0xdebb=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_prefixes','util','../../config/logger','api','moment'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xdebb,0xa4));var _0xbdeb=function(_0x45b786,_0x35192d){_0x45b786=_0x45b786-0x0;var _0x421457=_0xdebb[_0x45b786];return _0x421457;};'use strict';var _=require('lodash');var util=require(_0xbdeb('0x0'));var logger=require(_0xbdeb('0x1'))(_0xbdeb('0x2'));var moment=require(_0xbdeb('0x3'));var BPromise=require(_0xbdeb('0x4'));var rp=require(_0xbdeb('0x5'));var fs=require('fs');var path=require(_0xbdeb('0x6'));var rimraf=require(_0xbdeb('0x7'));var config=require(_0xbdeb('0x8'));var attributes=require('./voicePrefix.attributes');module[_0xbdeb('0x9')]=function(_0x21fd63,_0x27f29d){return _0x21fd63[_0xbdeb('0xa')]('VoicePrefix',attributes,{'tableName':_0xbdeb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb9=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','define'];(function(_0x4f6839,_0x364a0d){var _0x3473ea=function(_0x25b0a7){while(--_0x25b0a7){_0x4f6839['push'](_0x4f6839['shift']());}};_0x3473ea(++_0x364a0d);}(_0x6cb9,0xe2));var _0x96cb=function(_0x506bec,_0x360e45){_0x506bec=_0x506bec-0x0;var _0x5dc9ee=_0x6cb9[_0x506bec];return _0x5dc9ee;};'use strict';var _=require(_0x96cb('0x0'));var util=require(_0x96cb('0x1'));var logger=require(_0x96cb('0x2'))(_0x96cb('0x3'));var moment=require(_0x96cb('0x4'));var BPromise=require(_0x96cb('0x5'));var rp=require(_0x96cb('0x6'));var fs=require('fs');var path=require(_0x96cb('0x7'));var rimraf=require(_0x96cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x96cb('0x9'));module[_0x96cb('0xa')]=function(_0x4c7929,_0x27392a){return _0x4c7929[_0x96cb('0xb')](_0x96cb('0xc'),attributes,{'tableName':_0x96cb('0xd'),'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 f400c50..91bb289 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 _0x0024=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x0024,0xa8));var _0x4002=function(_0x4dc8fc,_0x27d9a5){_0x4dc8fc=_0x4dc8fc-0x0;var _0x18d77f=_0x0024[_0x4dc8fc];return _0x18d77f;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var moment=require('moment');var BPromise=require(_0x4002('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4002('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4002('0x3'))(_0x4002('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4002('0x5')][_0x4002('0x6')]({'port':0x232a});config[_0x4002('0x7')]=_[_0x4002('0x8')](config['redis'],{'host':_0x4002('0x9'),'port':0x18eb});var socket=require(_0x4002('0xa'))(new Redis(config[_0x4002('0x7')]));require(_0x4002('0xb'))['register'](socket);function respondWithRpcPromise(_0x5f32c7,_0x21c971,_0x26fd5d){return new BPromise(function(_0x397864,_0x12c368){return client[_0x4002('0xc')](_0x5f32c7,_0x26fd5d)['then'](function(_0x53c0ef){logger['info'](_0x4002('0xd'),_0x21c971,_0x4002('0xe'));logger[_0x4002('0xf')](_0x4002('0x10'),_0x21c971,'request\x20sent',JSON[_0x4002('0x11')](_0x53c0ef));if(_0x53c0ef[_0x4002('0x12')]){if(_0x53c0ef[_0x4002('0x12')][_0x4002('0x13')]===0x1f4){logger[_0x4002('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x12c368(_0x53c0ef[_0x4002('0x12')][_0x4002('0x14')]);}logger[_0x4002('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x397864(_0x53c0ef['error'][_0x4002('0x14')]);}else{logger[_0x4002('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x21c971,_0x4002('0xe'));_0x397864(_0x53c0ef['result']['message']);}})['catch'](function(_0x22820f){logger[_0x4002('0x12')](_0x4002('0xd'),_0x21c971,_0x22820f);_0x12c368(_0x22820f);});});} \ No newline at end of file +var _0xd046=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent'];(function(_0xe3e5a8,_0x20af43){var _0x41ae83=function(_0xbe4335){while(--_0xbe4335){_0xe3e5a8['push'](_0xe3e5a8['shift']());}};_0x41ae83(++_0x20af43);}(_0xd046,0x129));var _0x6d04=function(_0x16dc97,_0x313340){_0x16dc97=_0x16dc97-0x0;var _0x206ee0=_0xd046[_0x16dc97];return _0x206ee0;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});config[_0x6d04('0x7')]=_['defaults'](config['redis'],{'host':_0x6d04('0x8'),'port':0x18eb});var socket=require(_0x6d04('0x9'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6d04('0xa')](socket);function respondWithRpcPromise(_0x4b5aae,_0x38bce9,_0x5876b8){return new BPromise(function(_0x5a2dbb,_0x4d3a31){return client[_0x6d04('0xb')](_0x4b5aae,_0x5876b8)[_0x6d04('0xc')](function(_0x3397ea){logger[_0x6d04('0xd')]('VoicePrefix,\x20%s,\x20%s',_0x38bce9,_0x6d04('0xe'));logger[_0x6d04('0xf')](_0x6d04('0x10'),_0x38bce9,_0x6d04('0xe'),JSON[_0x6d04('0x11')](_0x3397ea));if(_0x3397ea[_0x6d04('0x12')]){if(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x13')]===0x1f4){logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);return _0x4d3a31(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);}logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);return _0x5a2dbb(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);}else{logger[_0x6d04('0xd')](_0x6d04('0x14'),_0x38bce9,_0x6d04('0xe'));_0x5a2dbb(_0x3397ea[_0x6d04('0x16')]['message']);}})[_0x6d04('0x17')](function(_0x1dcd3d){logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x1dcd3d);_0x4d3a31(_0x1dcd3d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f95e9ff..21d4c1d 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 _0x4fef=['save','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x42a2e7,_0x1953c0){var _0x96be3d=function(_0x32e98e){while(--_0x32e98e){_0x42a2e7['push'](_0x42a2e7['shift']());}};_0x96be3d(++_0x1953c0);}(_0x4fef,0x10f));var _0xf4fe=function(_0x1f8eaa,_0x30f70c){_0x1f8eaa=_0x1f8eaa-0x0;var _0x36685c=_0x4fef[_0x1f8eaa];return _0x36685c;};'use strict';var VoicePrefixEvents=require(_0xf4fe('0x0'));var events=[_0xf4fe('0x1'),'remove',_0xf4fe('0x2')];function createListener(_0x5a2bd0,_0x40f4b2){return function(_0x14bf18){_0x40f4b2[_0xf4fe('0x3')](_0x5a2bd0,_0x14bf18);};}function removeListener(_0x1e5ec2,_0x5c5dbb){return function(){VoicePrefixEvents[_0xf4fe('0x4')](_0x1e5ec2,_0x5c5dbb);};}exports[_0xf4fe('0x5')]=function(_0x27c6c9){for(var _0x522427=0x0,_0x363096=events[_0xf4fe('0x6')];_0x522427<_0x363096;_0x522427++){var _0x4805b0=events[_0x522427];var _0x23b761=createListener(_0xf4fe('0x7')+_0x4805b0,_0x27c6c9);VoicePrefixEvents['on'](_0x4805b0,_0x23b761);}}; \ No newline at end of file +var _0x2ceb=['save','update','emit','removeListener','register','voicePrefix:','./voicePrefix.events'];(function(_0x3a2014,_0x20cd5d){var _0x1095ca=function(_0x4fff29){while(--_0x4fff29){_0x3a2014['push'](_0x3a2014['shift']());}};_0x1095ca(++_0x20cd5d);}(_0x2ceb,0x110));var _0xb2ce=function(_0x16a7d8,_0x326d5c){_0x16a7d8=_0x16a7d8-0x0;var _0xa4b589=_0x2ceb[_0x16a7d8];return _0xa4b589;};'use strict';var VoicePrefixEvents=require(_0xb2ce('0x0'));var events=[_0xb2ce('0x1'),'remove',_0xb2ce('0x2')];function createListener(_0x1bca5d,_0xc03973){return function(_0x1dbb1e){_0xc03973[_0xb2ce('0x3')](_0x1bca5d,_0x1dbb1e);};}function removeListener(_0x35242f,_0x58daad){return function(){VoicePrefixEvents[_0xb2ce('0x4')](_0x35242f,_0x58daad);};}exports[_0xb2ce('0x5')]=function(_0x550455){for(var _0x479153=0x0,_0x3dfaee=events['length'];_0x479153<_0x3dfaee;_0x479153++){var _0x39120a=events[_0x479153];var _0x9fb07c=createListener(_0xb2ce('0x6')+_0x39120a,_0x550455);VoicePrefixEvents['on'](_0x39120a,_0x9fb07c);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a8e1fb3..6238685 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(_0x2d6d08,_0x4c8f0c){var _0x4b8145=function(_0x309466){while(--_0x309466){_0x2d6d08['push'](_0x2d6d08['shift']());}};_0x4b8145(++_0x4c8f0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x9b11c9,_0x20548a){var _0x272265=function(_0x30b837){while(--_0x30b837){_0x9b11c9['push'](_0x9b11c9['shift']());}};_0x272265(++_0x20548a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index eb08ac7..ed05e7a 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 _0x8735=['wrandom','setDataValue','strategy','type','getDataValue','dialMethod','preview','booked','rrmemory','roundrobin','INTEGER','yes','all','once','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','wrapuptime','power','predictive','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','linear'];(function(_0x4b10d8,_0xbfb76){var _0x9f5151=function(_0x1c3f21){while(--_0x1c3f21){_0x4b10d8['push'](_0x4b10d8['shift']());}};_0x9f5151(++_0xbfb76);}(_0x8735,0x135));var _0x5873=function(_0x48681c,_0xa05edb){_0x48681c=_0x48681c-0x0;var _0x3dfdf1=_0x8735[_0x48681c];return _0x3dfdf1;};'use strict';var Sequelize=require('sequelize');module[_0x5873('0x0')]={'name':{'type':Sequelize[_0x5873('0x1')],'allowNull':![],'unique':_0x5873('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x4'),_0x5873('0x5')),'allowNull':![],'defaultValue':_0x5873('0x4')},'musiconhold':{'type':Sequelize[_0x5873('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x5873('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5873('0x3')]('rr',_0x5873('0x6'),_0x5873('0x7'),_0x5873('0x8'),_0x5873('0x9'),'rrmemory',_0x5873('0xa'),_0x5873('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0xf28823){this[_0x5873('0xc')](_0x5873('0xd'),_0xf28823?_0xf28823:'rrmemory');},'get':function(){var _0x86f515=this['getDataValue'](_0x5873('0xe'));var _0x41e681=this[_0x5873('0xf')](_0x5873('0x10'));var _0x1e54cd=this[_0x5873('0xf')](_0x5873('0xd'));if(_0x86f515===_0x5873('0x5')){if(_0x41e681===_0x5873('0x11')){return null;}if(_0x41e681===_0x5873('0x12')&&![_0x5873('0x13'),_0x5873('0x14')]['includes'](_0x1e54cd)){this[_0x5873('0xc')]('strategy',_0x5873('0x13'));}}return _0x1e54cd;}},'servicelevel':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5873('0x15')](0xb)},'timeout':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5873('0x1')]},'weight':{'type':Sequelize[_0x5873('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':_0x5873('0x16')},'autopause':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no',_0x5873('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5873('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5873('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5873('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x5873('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5873('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5873('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x5873('0x16'),'no'),'defaultValue':_0x5873('0x16')},'announce_holdtime':{'type':Sequelize[_0x5873('0x3')]('yes','no',_0x5873('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x5873('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5873('0x1')]},'queue_youarenext':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5873('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x5873('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x5873('0x1')]},'queue_less_than':{'type':Sequelize[_0x5873('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x5d855d){this['setDataValue']('periodic_announce',_0x5d855d?_0x5d855d['join'](','):[]);},'get':function(){return this[_0x5873('0xf')](_0x5873('0x19'))?this[_0x5873('0xf')]('periodic_announce')[_0x5873('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x5873('0x16'),'set':function(_0x15df1d){this[_0x5873('0xc')](_0x5873('0x1b'),_0x15df1d?_0x15df1d['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x5873('0x1b'))?this['getDataValue'](_0x5873('0x1b'))[_0x5873('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5873('0x1')],'defaultValue':'no','set':function(_0x458488){this[_0x5873('0xc')](_0x5873('0x1c'),_0x458488?_0x458488[_0x5873('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0x5873('0x1c'))?this[_0x5873('0xf')](_0x5873('0x1c'))[_0x5873('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x5873('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5873('0x1')]},'description':{'type':Sequelize[_0x5873('0x1')]},'acw':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':0x0,'set':function(_0x2e060d){this[_0x5873('0xc')]('acw',_0x2e060d);if(_0x2e060d){if(this['getDataValue'](_0x5873('0x1f'))<0x2){this[_0x5873('0xc')](_0x5873('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5873('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x5873('0x11'),'progressive',_0x5873('0x20'),_0x5873('0x21'),_0x5873('0x12')),'defaultValue':_0x5873('0x22'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x5873('0x15')](0x4)[_0x5873('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5873('0x24')},'dialLimitQueue':{'type':Sequelize[_0x5873('0x15')](0x4)[_0x5873('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5873('0x25')},'dialPowerLevel':{'type':Sequelize[_0x5873('0x26')](0x2)[_0x5873('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5873('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x28'),_0x5873('0x29')),'defaultValue':_0x5873('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5873('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5873('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5873('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5873('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x5873('0x1')],'defaultValue':_0x5873('0x2c'),'comment':_0x5873('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x2e')},'dialQueueProject':{'type':Sequelize[_0x5873('0x1')],'comment':_0x5873('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x30')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'comment':_0x5873('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x33')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5873('0x34')},'dialTimezone':{'type':Sequelize[_0x5873('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5873('0x1')],'defaultValue':_0x5873('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5873('0x36'),_0x5873('0x37'),_0x5873('0x38')),'defaultValue':_0x5873('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5873('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x5873('0x15')](0x9)[_0x5873('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5873('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x5873('0x15')](0x9)[_0x5873('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5873('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5873('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5873('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5873('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x5873('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5873('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5873('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5873('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5873('0x15')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5873('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5873('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5873('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5873('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x5873('0x15')](0x5)[_0x5873('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':0x0,'comment':_0x5873('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5873('0x3')](_0x5873('0x42'),_0x5873('0x43')),'defaultValue':_0x5873('0x42')},'dialQueueProject2':{'type':Sequelize[_0x5873('0x1')],'comment':_0x5873('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5873('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5873('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5873('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)[_0x5873('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5873('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5873('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5873('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5873('0x4d'),'set':function(_0x1d569e){if(!_0x1d569e)this[_0x5873('0xc')](_0x5873('0x4e'),null);this[_0x5873('0xc')](_0x5873('0x4f'),_0x1d569e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5873('0x15')](0x3)[_0x5873('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x5873('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0xc8c7=['dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','never','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\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)','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ENUM','ringall','fewestcalls','linear','rrordered','strategy','rrmemory','getDataValue','type','dialMethod','preview','includes','setDataValue','INTEGER','yes','all','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor'];(function(_0x4d9664,_0x1eb4ee){var _0x1714e5=function(_0x44acf4){while(--_0x44acf4){_0x4d9664['push'](_0x4d9664['shift']());}};_0x1714e5(++_0x1eb4ee);}(_0xc8c7,0x1ea));var _0x7c8c=function(_0x18ad00,_0x5bac78){_0x18ad00=_0x18ad00-0x0;var _0x4aea46=_0xc8c7[_0x18ad00];return _0x4aea46;};'use strict';var Sequelize=require(_0x7c8c('0x0'));module[_0x7c8c('0x1')]={'name':{'type':Sequelize[_0x7c8c('0x2')],'allowNull':![],'unique':_0x7c8c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x7c8c('0x4'),_0x7c8c('0x5')),'allowNull':![],'defaultValue':_0x7c8c('0x4')},'musiconhold':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':_0x7c8c('0x6')},'announce':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7c8c('0x7')]('rr',_0x7c8c('0x8'),'leastrecent',_0x7c8c('0x9'),'random','rrmemory',_0x7c8c('0xa'),'wrandom',_0x7c8c('0xb')),'allowNull':![],'defaultValue':_0x7c8c('0x8'),'set':function(_0x48c080){this['setDataValue'](_0x7c8c('0xc'),_0x48c080?_0x48c080:_0x7c8c('0xd'));},'get':function(){var _0x210ad5=this[_0x7c8c('0xe')](_0x7c8c('0xf'));var _0x40a8fd=this['getDataValue'](_0x7c8c('0x10'));var _0x47d7e3=this[_0x7c8c('0xe')](_0x7c8c('0xc'));if(_0x210ad5===_0x7c8c('0x5')){if(_0x40a8fd===_0x7c8c('0x11')){return null;}if(_0x40a8fd==='booked'&&![_0x7c8c('0xd'),'roundrobin'][_0x7c8c('0x12')](_0x47d7e3)){this[_0x7c8c('0x13')](_0x7c8c('0xc'),'rrmemory');}}return _0x47d7e3;}},'servicelevel':{'type':Sequelize[_0x7c8c('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7c8c('0x14')](0xb)},'timeout':{'type':Sequelize[_0x7c8c('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x7c8c('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':_0x7c8c('0x15')},'autopause':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no',_0x7c8c('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x7c8c('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7c8c('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7c8c('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7c8c('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7c8c('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':_0x7c8c('0x15')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x7c8c('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x7c8c('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x7c8c('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7c8c('0x2')]},'queue_youarenext':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7c8c('0x2')]},'queue_quantity1':{'type':Sequelize[_0x7c8c('0x2')]},'queue_quantity2':{'type':Sequelize[_0x7c8c('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x7c8c('0x2')]},'queue_less_than':{'type':Sequelize[_0x7c8c('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xf85a0){this['setDataValue']('periodic_announce',_0xf85a0?_0xf85a0[_0x7c8c('0x17')](','):[]);},'get':function(){return this[_0x7c8c('0xe')](_0x7c8c('0x18'))?this['getDataValue'](_0x7c8c('0x18'))[_0x7c8c('0x19')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x7c8c('0x15'),'set':function(_0x4f9881){this['setDataValue'](_0x7c8c('0x1a'),_0x4f9881?_0x4f9881['join'](','):undefined);},'get':function(){return this[_0x7c8c('0xe')](_0x7c8c('0x1a'))?this[_0x7c8c('0xe')](_0x7c8c('0x1a'))[_0x7c8c('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':'no','set':function(_0x5d5334){this[_0x7c8c('0x13')](_0x7c8c('0x1b'),_0x5d5334?_0x5d5334[_0x7c8c('0x17')](','):undefined);},'get':function(){return this[_0x7c8c('0xe')](_0x7c8c('0x1b'))?this[_0x7c8c('0xe')](_0x7c8c('0x1b'))[_0x7c8c('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7c8c('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7c8c('0x2')]},'description':{'type':Sequelize[_0x7c8c('0x2')]},'acw':{'type':Sequelize[_0x7c8c('0x1c')],'defaultValue':0x0,'set':function(_0x2f3688){this[_0x7c8c('0x13')](_0x7c8c('0x1d'),_0x2f3688);if(_0x2f3688){if(this['getDataValue'](_0x7c8c('0x1e'))<0x2){this[_0x7c8c('0x13')](_0x7c8c('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7c8c('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7c8c('0x1c')],'defaultValue':0x0,'comment':_0x7c8c('0x1f')},'dialMethod':{'type':Sequelize['ENUM']('preview','progressive',_0x7c8c('0x20'),_0x7c8c('0x21'),'booked'),'defaultValue':_0x7c8c('0x22'),'comment':_0x7c8c('0x23')},'dialLimitChannel':{'type':Sequelize[_0x7c8c('0x14')](0x4)[_0x7c8c('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7c8c('0x25')},'dialLimitQueue':{'type':Sequelize[_0x7c8c('0x14')](0x4)[_0x7c8c('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7c8c('0x26')},'dialPowerLevel':{'type':Sequelize[_0x7c8c('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7c8c('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x7c8c('0x29'),'dropRate'),'defaultValue':_0x7c8c('0x2a'),'comment':_0x7c8c('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7c8c('0x27')](0x2)[_0x7c8c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7c8c('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x7c8c('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7c8c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7c8c('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':_0x7c8c('0x2e'),'comment':_0x7c8c('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x7c8c('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c8c('0x30')},'dialQueueProject':{'type':Sequelize[_0x7c8c('0x2')],'comment':_0x7c8c('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7c8c('0x14')](0x3)[_0x7c8c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7c8c('0x14')](0x5)[_0x7c8c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c8c('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x7c8c('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7c8c('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c8c('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7c8c('0x14')](0x3)[_0x7c8c('0x24')],'defaultValue':0x3,'comment':_0x7c8c('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7c8c('0x14')](0x5)[_0x7c8c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c8c('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7c8c('0x14')](0x3)[_0x7c8c('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7c8c('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7c8c('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7c8c('0x7')]('always',_0x7c8c('0x37'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x7c8c('0x14')](0x9)[_0x7c8c('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7c8c('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x7c8c('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7c8c('0x14')](0x9)[_0x7c8c('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7c8c('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7c8c('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x7c8c('0x14')](0x9)[_0x7c8c('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7c8c('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7c8c('0x14')](0x9)[_0x7c8c('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7c8c('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7c8c('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7c8c('0x14')](0x5)[_0x7c8c('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7c8c('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7c8c('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x7c8c('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7c8c('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7c8c('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7c8c('0x7')](_0x7c8c('0x40'),_0x7c8c('0x41')),'defaultValue':_0x7c8c('0x40')},'dialQueueProject2':{'type':Sequelize[_0x7c8c('0x2')],'comment':_0x7c8c('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7c8c('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x7c8c('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7c8c('0x42')},'dialCutDigit':{'type':Sequelize[_0x7c8c('0x14')](0x3)[_0x7c8c('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7c8c('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c8c('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7c8c('0x14')](0x5)[_0x7c8c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c8c('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x7c8c('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7c8c('0x14')](0x5)[_0x7c8c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c8c('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7c8c('0x14')](0x3)[_0x7c8c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c8c('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7c8c('0x14')](0x5)[_0x7c8c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x7c8c('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x7c8c('0x14')](0x5)[_0x7c8c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c8c('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7c8c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c8c('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7c8c('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c8c('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c8c('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x346345){if(!_0x346345)this[_0x7c8c('0x13')](_0x7c8c('0x4a'),null);this[_0x7c8c('0x13')](_0x7c8c('0x4b'),_0x346345);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7c8c('0x14')](0x3)[_0x7c8c('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7c8c('0x14')](0x3)[_0x7c8c('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7c8c('0x14')](0x3)[_0x7c8c('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9781b79..584c237 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 _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x279964,_0x176d33){var _0x3a43e3=function(_0x17d457){while(--_0x17d457){_0x279964['push'](_0x279964['shift']());}};_0x3a43e3(++_0x176d33);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file +var _0x1cb9=['VoiceQueues','inbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','count','include','query','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','user','get','role','QueueCampaigns','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getHoppers','CmHopper','nolimit','order','sort','pick','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','options','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','addAgents','spread','emit','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','scheduledAt','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2848c2,_0x352cd1){_0x2848c2=_0x2848c2-0x0;var _0x5b54a8=_0x1cb9[_0x2848c2];return _0x5b54a8;};'use strict';var moment=require(_0x91cb('0x0'));var BPromise=require('bluebird');var util=require(_0x91cb('0x1'));var _=require(_0x91cb('0x2'));var squel=require(_0x91cb('0x3'));var Redis=require(_0x91cb('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x91cb('0x5'))(_0x91cb('0x6'));var config=require('../../config/environment');var db=require(_0x91cb('0x7'))['db'];config[_0x91cb('0x8')]=_[_0x91cb('0x9')](config[_0x91cb('0x8')],{'host':_0x91cb('0xa'),'port':0x18eb});var socket=require(_0x91cb('0xb'))(new Redis(config['redis']));require(_0x91cb('0xc'))['register'](socket);function respondWithStatusCode(_0x2fdfce,_0x4cf9ed){_0x4cf9ed=_0x4cf9ed||0xcc;return function(_0xa43e7a){if(_0xa43e7a){return _0x2fdfce[_0x91cb('0xd')](_0x4cf9ed);}return _0x2fdfce[_0x91cb('0xe')](_0x4cf9ed)[_0x91cb('0xf')]();};}function respondWithResult(_0x429928,_0x23ba9a){_0x23ba9a=_0x23ba9a||0xc8;return function(_0x21a0a5){if(_0x21a0a5){return _0x429928[_0x91cb('0xe')](_0x23ba9a)[_0x91cb('0x10')](_0x21a0a5);}};}function respondWithFilteredResult(_0x8c0097,_0x530d92){return function(_0x3c1f56){if(_0x3c1f56){var _0x366f09=typeof _0x530d92['offset']===_0x91cb('0x11')&&typeof _0x530d92[_0x91cb('0x12')]===_0x91cb('0x11');var _0x2c7d40=_0x3c1f56['count'];var _0x4cc6ef=_0x366f09?0x0:_0x530d92[_0x91cb('0x13')];var _0x3d22b7=_0x366f09?_0x3c1f56['count']:_0x530d92['offset']+_0x530d92[_0x91cb('0x12')];var _0xc3629e;if(_0x3d22b7>=_0x2c7d40){_0x3d22b7=_0x2c7d40;_0xc3629e=0xc8;}else{_0xc3629e=0xce;}_0x8c0097[_0x91cb('0xe')](_0xc3629e);return _0x8c0097['set'](_0x91cb('0x14'),_0x4cc6ef+'-'+_0x3d22b7+'/'+_0x2c7d40)[_0x91cb('0x10')](_0x3c1f56);}return null;};}function saveUpdates(_0x4f1554){return function(_0xc594e3){if(_0xc594e3){return _0xc594e3[_0x91cb('0x15')](_0x4f1554)[_0x91cb('0x16')](function(_0xcd1a78){return _0xcd1a78;});}return null;};}function removeEntity(_0x5cc1c3){return function(_0x3fba4f){if(_0x3fba4f){return _0x3fba4f[_0x91cb('0x17')]()['then'](function(){var _0x123847=_0x3fba4f['get']({'plain':!![]});var _0x55042a=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5b385a=_(_0x55042a)[_0x91cb('0x1a')](_0x91cb('0x1b'))[_0x91cb('0x1c')](_0x91cb('0x1d'))['value']();if(_[_0x91cb('0x1e')](_0x5b385a,_0x123847[_0x91cb('0x1f')])){return;}var _0x1fa837=_['find'](_0x55042a,[_0x91cb('0x1d'),_0x123847[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x21')][_0x91cb('0x17')]({'where':{'type':_0x1fa837,'resourceId':_0x123847['id']}})[_0x91cb('0x16')](function(){return _0x3fba4f;});})[_0x91cb('0x16')](function(){_0x5cc1c3[_0x91cb('0xe')](0xcc)[_0x91cb('0xf')]();});}};}function handleEntityNotFound(_0x4c8438){return function(_0x59bf3a){if(!_0x59bf3a){_0x4c8438[_0x91cb('0xd')](0x194);}return _0x59bf3a;};}function handleError(_0x554350,_0x1c67d2){_0x1c67d2=_0x1c67d2||0x1f4;return function(_0x34d372){logger[_0x91cb('0x22')](_0x34d372['stack']);if(_0x34d372[_0x91cb('0x20')]){delete _0x34d372['name'];}_0x554350[_0x91cb('0xe')](_0x1c67d2)[_0x91cb('0x23')](_0x34d372);};}exports[_0x91cb('0x24')]=function(_0x2fb473,_0x468908){var _0x504275={};var _0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x1c')](db[_0x91cb('0x25')][_0x91cb('0x26')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x27')],'type':_0x4944bd[_0x91cb('0x1f')][_0x91cb('0x28')]};});_0x504275=qs[_0x91cb('0x29')](_0x52670a,_0x2fb473);var _0xf296bc={'where':_0x504275[_0x91cb('0x2a')]};return db[_0x91cb('0x25')][_0x91cb('0x2b')](_0xf296bc)[_0x91cb('0x16')](function(_0x5e6ed3){_0x2f04a3[_0x91cb('0x2b')]=_0x5e6ed3;_0x504275[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x2fb473[_0x91cb('0x2d')]);return db[_0x91cb('0x25')]['findAll'](_0x504275);})[_0x91cb('0x16')](function(_0x74b443){_0x2f04a3[_0x91cb('0x2e')]=_0x74b443;return _0x2f04a3;})[_0x91cb('0x16')](respondWithFilteredResult(_0x468908,_0x504275))[_0x91cb('0x2f')](handleError(_0x468908,null));};exports['show']=function(_0x121c37,_0x5927cb){var _0x47fc17={'raw':![],'where':{'id':_0x121c37[_0x91cb('0x30')]['id']}},_0x479968={};_0x479968['model']=_[_0x91cb('0x31')](db['VoiceQueue']['rawAttributes']);_0x479968[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x121c37[_0x91cb('0x2d')]);_0x479968[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x479968['model'],_0x479968[_0x91cb('0x2d')]);_0x47fc17[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x479968[_0x91cb('0x35')],qs['fields'](_0x121c37['query'][_0x91cb('0x36')]));_0x47fc17[_0x91cb('0x34')]=_0x47fc17['attributes'][_0x91cb('0x37')]?_0x47fc17[_0x91cb('0x34')]:_0x479968['model'];if(_0x121c37[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x47fc17['include']=[{'all':!![]}];}_0x47fc17=_[_0x91cb('0x39')]({},_0x47fc17,_0x121c37['options']);return db[_0x91cb('0x25')][_0x91cb('0x3a')](_0x47fc17)[_0x91cb('0x16')](handleEntityNotFound(_0x5927cb,null))[_0x91cb('0x16')](respondWithResult(_0x5927cb,null))[_0x91cb('0x2f')](handleError(_0x5927cb,null));};exports[_0x91cb('0x3b')]=function(_0x5d0e37,_0xa90111){return db[_0x91cb('0x25')]['create'](_0x5d0e37[_0x91cb('0x3c')],{})['then'](function(_0x2c6102){var _0x2eac87=_0x5d0e37[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x2eac87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eac87[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0x2cf27e=_0x2c6102[_0x91cb('0x3e')]({'plain':!![]});var _0x42a7f3=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19')},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x3cc4c1=_['find'](_0x42a7f3,[_0x91cb('0x1d'),_0x2cf27e['type']])[_0x91cb('0x20')];return db['UserProfileSection'][_0x91cb('0x3a')]({'where':{'name':_0x3cc4c1,'userProfileId':_0x2eac87['userProfileId']},'raw':!![]})[_0x91cb('0x16')](function(_0x477131){if(_0x477131&&_0x477131[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0x2cf27e[_0x91cb('0x20')],'resourceId':_0x2cf27e['id'],'type':_0x477131[_0x91cb('0x20')],'sectionId':_0x477131['id']},{})['then'](function(){return _0x2c6102;});}else{return _0x2c6102;}})[_0x91cb('0x2f')](function(_0x2f1749){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x2f1749);throw _0x2f1749;});}return _0x2c6102;})[_0x91cb('0x16')](respondWithResult(_0xa90111,0xc9))[_0x91cb('0x2f')](handleError(_0xa90111,null));};exports[_0x91cb('0x44')]=function(_0x29d5a1,_0x396b81){var _0x4b26f6={'where':{'id':_0x29d5a1[_0x91cb('0x30')]['id']}},_0x7c22b3={};_0x7c22b3[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x25')][_0x91cb('0x26')]);_0x4b26f6[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x7c22b3['model'],qs[_0x91cb('0x36')](_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4b26f6[_0x91cb('0x34')]=_0x4b26f6['attributes'][_0x91cb('0x37')]?_0x4b26f6[_0x91cb('0x34')]:_0x7c22b3['model'];if(_0x29d5a1[_0x91cb('0x2d')]['includeAll']){_0x4b26f6[_0x91cb('0x2c')]=[{'all':!![]}];}_0x4b26f6=_['merge']({},_0x4b26f6,_0x29d5a1['options']);return db['VoiceQueue'][_0x91cb('0x3a')](_0x4b26f6)[_0x91cb('0x16')](handleEntityNotFound(_0x396b81,null))[_0x91cb('0x16')](function(_0x2f8384){if(_0x2f8384){var _0x333814=_0x2f8384['get']({'plain':!![]});_0x333814=qs['omit'](_0x333814,['id',_0x91cb('0x45'),_0x91cb('0x46')]);_0x29d5a1[_0x91cb('0x3c')]=_[_0x91cb('0x47')](_0x29d5a1['body'],['id','createdAt','updatedAt']);return db[_0x91cb('0x25')]['create'](_[_0x91cb('0x39')](_0x333814,_0x29d5a1['body']),{'include':_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x38')]?[{'all':!![]}]:undefined})[_0x91cb('0x16')](function(_0x649976){var _0x1884bc=_0x29d5a1[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x1884bc)throw new Error(_0x91cb('0x48'));if(_0x1884bc[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0xd8f7c2=_0x649976['get']({'plain':!![]});var _0x1e445a=[{'name':_0x91cb('0x18'),'value':'inbound'},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x4bab7d=_[_0x91cb('0x3a')](_0x1e445a,[_0x91cb('0x1d'),_0xd8f7c2[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x49')][_0x91cb('0x3a')]({'where':{'name':_0x4bab7d,'userProfileId':_0x1884bc[_0x91cb('0x4a')]},'raw':!![]})[_0x91cb('0x16')](function(_0x3320bd){if(_0x3320bd&&_0x3320bd[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0xd8f7c2[_0x91cb('0x20')],'resourceId':_0xd8f7c2['id'],'type':_0x3320bd['name'],'sectionId':_0x3320bd['id']},{})[_0x91cb('0x16')](function(){return _0x649976;});}else{return _0x649976;}})['catch'](function(_0x3dfff9){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x3dfff9);throw _0x3dfff9;});}return _0x649976;});}})['then'](respondWithResult(_0x396b81,0xc9))[_0x91cb('0x2f')](handleError(_0x396b81,null));};exports[_0x91cb('0x15')]=function(_0x48dcf7,_0xef4754){if(_0x48dcf7[_0x91cb('0x3c')]['id']){delete _0x48dcf7[_0x91cb('0x3c')]['id'];}return db[_0x91cb('0x25')]['find']({'where':{'id':_0x48dcf7[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0xef4754,null))[_0x91cb('0x16')](saveUpdates(_0x48dcf7[_0x91cb('0x3c')],null))['then'](respondWithResult(_0xef4754,null))[_0x91cb('0x2f')](handleError(_0xef4754,null));};exports[_0x91cb('0x17')]=function(_0x5c2c01,_0x492b09){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x5c2c01[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x492b09,null))['then'](removeEntity(_0x492b09,null))['catch'](handleError(_0x492b09,null));};exports[_0x91cb('0x4b')]=function(_0x5c468a,_0x1b69ce){var _0x961ebf={'raw':![],'where':{}};var _0x33de58={};var _0x551836={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x5c468a[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1b69ce,null))[_0x91cb('0x16')](function(_0x2c1911){if(_0x2c1911){_0x33de58['model']=_[_0x91cb('0x31')](db[_0x91cb('0x4c')][_0x91cb('0x26')]);_0x33de58[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x5c468a[_0x91cb('0x2d')]);_0x33de58[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x33de58[_0x91cb('0x35')],_0x33de58[_0x91cb('0x2d')]);_0x961ebf[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x33de58['model'],qs[_0x91cb('0x36')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x961ebf[_0x91cb('0x34')]=_0x961ebf[_0x91cb('0x34')][_0x91cb('0x37')]?_0x961ebf[_0x91cb('0x34')]:_0x33de58['model'];if(!_0x5c468a[_0x91cb('0x2d')]['hasOwnProperty'](_0x91cb('0x4d'))){_0x961ebf[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x5c468a[_0x91cb('0x2d')]['limit']);_0x961ebf[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x961ebf[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x5c468a['query'][_0x91cb('0x4f')]);_0x961ebf[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x5c468a[_0x91cb('0x2d')],_0x33de58[_0x91cb('0x32')]));_0x961ebf[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x2c1911['id'];if(_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x961ebf[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x961ebf[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x961ebf[_0x91cb('0x34')],function(_0x2605c3){var _0x1d9ded={};_0x1d9ded[_0x2605c3]={'$like':'%'+_0x5c468a['query'][_0x91cb('0x1a')]+'%'};return _0x1d9ded;})});}_0x961ebf=_[_0x91cb('0x39')]({},_0x961ebf,_0x5c468a['options']);return db[_0x91cb('0x4c')][_0x91cb('0x2b')]({'where':_0x961ebf[_0x91cb('0x2a')]})['then'](function(_0x45e26b){_0x551836[_0x91cb('0x2b')]=_0x45e26b;if(_0x5c468a['query']['includeAll']){_0x961ebf[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopper'][_0x91cb('0x52')](_0x961ebf);})[_0x91cb('0x16')](function(_0x4e11e3){_0x551836[_0x91cb('0x2e')]=_0x4e11e3;return _0x551836;});}})['then'](respondWithFilteredResult(_0x1b69ce,_0x961ebf))[_0x91cb('0x2f')](handleError(_0x1b69ce,null));};exports[_0x91cb('0x53')]=function(_0x4f827e,_0x5d8a7e){var _0x16a21f={'raw':!![],'where':{}};var _0x43be3e={};var _0x37666a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x91cb('0x54')]({'where':{'id':_0x4f827e[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x5d8a7e,null))[_0x91cb('0x16')](function(_0x570f6b){if(_0x570f6b){_0x43be3e[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x55')][_0x91cb('0x26')]);_0x43be3e[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x4f827e['query']);_0x43be3e['filters']=_[_0x91cb('0x33')](_0x43be3e['model'],_0x43be3e[_0x91cb('0x2d')]);_0x16a21f[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x43be3e[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x16a21f['attributes']=_0x16a21f[_0x91cb('0x34')][_0x91cb('0x37')]?_0x16a21f['attributes']:_0x43be3e[_0x91cb('0x35')];if(!_0x4f827e['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x16a21f[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x16a21f[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x16a21f[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x16a21f[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x4f827e[_0x91cb('0x2d')],_0x43be3e['filters']));_0x16a21f[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x570f6b['id'];if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x16a21f[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x16a21f[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x16a21f['attributes'],function(_0xb5c264){var _0xdee7f={};_0xdee7f[_0xb5c264]={'$like':'%'+_0x4f827e['query']['filter']+'%'};return _0xdee7f;})});}_0x16a21f=_[_0x91cb('0x39')]({},_0x16a21f,_0x4f827e['options']);return db['CmHopperHistory'][_0x91cb('0x2b')]({'where':_0x16a21f['where']})[_0x91cb('0x16')](function(_0x498382){_0x37666a[_0x91cb('0x2b')]=_0x498382;if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x16a21f[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x91cb('0x52')](_0x16a21f);})[_0x91cb('0x16')](function(_0x42d07b){_0x37666a[_0x91cb('0x2e')]=_0x42d07b;return _0x37666a;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x5d8a7e,_0x16a21f))[_0x91cb('0x2f')](handleError(_0x5d8a7e,null));};exports[_0x91cb('0x57')]=function(_0x3cf8c5,_0x21dfd3){var _0x24facc={'raw':!![],'where':{}};var _0xafda63={};var _0x32704d={'count':0x0,'rows':[]};return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x3cf8c5[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x21dfd3,null))[_0x91cb('0x16')](function(_0x39fce4){if(_0x39fce4){_0xafda63[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x58')][_0x91cb('0x26')]);_0xafda63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3cf8c5[_0x91cb('0x2d')]);_0xafda63['filters']=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],_0xafda63[_0x91cb('0x2d')]);_0x24facc[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x24facc[_0x91cb('0x34')]=_0x24facc[_0x91cb('0x34')]['length']?_0x24facc[_0x91cb('0x34')]:_0xafda63['model'];if(!_0x3cf8c5['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x24facc[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x24facc[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x24facc['order']=qs[_0x91cb('0x4f')](_0x3cf8c5[_0x91cb('0x2d')]['sort']);_0x24facc[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3cf8c5[_0x91cb('0x2d')],_0xafda63[_0x91cb('0x32')]));_0x24facc[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x39fce4['id'];if(_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x24facc[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x24facc[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x24facc[_0x91cb('0x34')],function(_0x378cd0){var _0x538a8c={};_0x538a8c[_0x378cd0]={'$like':'%'+_0x3cf8c5['query'][_0x91cb('0x1a')]+'%'};return _0x538a8c;})});}_0x24facc=_[_0x91cb('0x39')]({},_0x24facc,_0x3cf8c5[_0x91cb('0x59')]);return db[_0x91cb('0x58')][_0x91cb('0x2b')]({'where':_0x24facc[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x5ac5cc){_0x32704d[_0x91cb('0x2b')]=_0x5ac5cc;if(_0x3cf8c5['query'][_0x91cb('0x38')]){_0x24facc[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x58')][_0x91cb('0x52')](_0x24facc);})[_0x91cb('0x16')](function(_0x4ac4dd){_0x32704d[_0x91cb('0x2e')]=_0x4ac4dd;return _0x32704d;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x21dfd3,_0x24facc))[_0x91cb('0x2f')](handleError(_0x21dfd3,null));};exports[_0x91cb('0x5a')]=function(_0x3a213e,_0x4e4003){var _0x4003c9={'raw':!![],'where':{}};var _0x9cff8f={};var _0x25a779={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a213e['params']['id']}})['then'](handleEntityNotFound(_0x4e4003,null))[_0x91cb('0x16')](function(_0x182aa5){if(_0x182aa5){_0x9cff8f[_0x91cb('0x35')]=_[_0x91cb('0x31')](db['CmHopperBlack'][_0x91cb('0x26')]);_0x9cff8f[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3a213e[_0x91cb('0x2d')]);_0x9cff8f['filters']=_['intersection'](_0x9cff8f[_0x91cb('0x35')],_0x9cff8f[_0x91cb('0x2d')]);_0x4003c9[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9cff8f[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4003c9[_0x91cb('0x34')]=_0x4003c9[_0x91cb('0x34')][_0x91cb('0x37')]?_0x4003c9[_0x91cb('0x34')]:_0x9cff8f[_0x91cb('0x35')];if(!_0x3a213e['query']['hasOwnProperty'](_0x91cb('0x4d'))){_0x4003c9['limit']=qs[_0x91cb('0x12')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x4003c9[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x4003c9[_0x91cb('0x4e')]=qs['sort'](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x4003c9[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x3a213e['query'],_0x9cff8f[_0x91cb('0x32')]));_0x4003c9[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x182aa5['id'];if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x4003c9['where']=_[_0x91cb('0x39')](_0x4003c9[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x4003c9[_0x91cb('0x34')],function(_0x440ef4){var _0x2c2ed8={};_0x2c2ed8[_0x440ef4]={'$like':'%'+_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x2c2ed8;})});}_0x4003c9=_[_0x91cb('0x39')]({},_0x4003c9,_0x3a213e[_0x91cb('0x59')]);return db[_0x91cb('0x5b')][_0x91cb('0x2b')]({'where':_0x4003c9[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x7c84fc){_0x25a779[_0x91cb('0x2b')]=_0x7c84fc;if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x4003c9[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x5b')][_0x91cb('0x52')](_0x4003c9);})[_0x91cb('0x16')](function(_0x275c80){_0x25a779[_0x91cb('0x2e')]=_0x275c80;return _0x25a779;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x4e4003,_0x4003c9))[_0x91cb('0x2f')](handleError(_0x4e4003,null));};exports['getTeams']=function(_0x16cf02,_0x2b8634){var _0x1eb46e={};var _0x261a3a={};var _0x16f334;var _0x5ca377;return db['VoiceQueue']['findOne']({'where':{'id':_0x16cf02['params']['id']}})['then'](handleEntityNotFound(_0x2b8634,null))[_0x91cb('0x16')](function(_0x46a6cc){if(_0x46a6cc){_0x16f334=_0x46a6cc;_0x261a3a[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x5c')][_0x91cb('0x26')]);_0x261a3a[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x16cf02[_0x91cb('0x2d')]);_0x261a3a[_0x91cb('0x32')]=_['intersection'](_0x261a3a[_0x91cb('0x35')],_0x261a3a[_0x91cb('0x2d')]);_0x1eb46e['attributes']=_[_0x91cb('0x33')](_0x261a3a[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x1eb46e[_0x91cb('0x34')]=_0x1eb46e[_0x91cb('0x34')]['length']?_0x1eb46e[_0x91cb('0x34')]:_0x261a3a[_0x91cb('0x35')];_0x1eb46e[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x1eb46e[_0x91cb('0x2a')]=qs['filters'](_[_0x91cb('0x50')](_0x16cf02['query'],_0x261a3a[_0x91cb('0x32')]));if(_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x1eb46e[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x1eb46e[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x1eb46e[_0x91cb('0x34')],function(_0x1c7c10){var _0x570cf0={};_0x570cf0[_0x1c7c10]={'$like':'%'+_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x570cf0;})});}_0x1eb46e=_[_0x91cb('0x39')]({},_0x1eb46e,_0x16cf02[_0x91cb('0x59')]);return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x189a87){if(_0x189a87){_0x5ca377=_0x189a87[_0x91cb('0x37')];if(!_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x1eb46e[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x16cf02['query'][_0x91cb('0x12')]);_0x1eb46e['offset']=qs[_0x91cb('0x13')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x12da14){if(_0x12da14){return _0x12da14?{'count':_0x5ca377,'rows':_0x12da14}:null;}})[_0x91cb('0x16')](respondWithResult(_0x2b8634,null))[_0x91cb('0x2f')](handleError(_0x2b8634,null));};exports['addTeams']=function(_0x3353bf,_0x5b3658){var _0x3c1703=_0x3353bf[_0x91cb('0x3c')][_0x91cb('0x5e')];var _0x598663=_[_0x91cb('0x1c')](_0x3c1703,'id');return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x598663},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]}]})['then'](function(_0x469e62){if(_0x469e62){var _0x1e9441=_[_0x91cb('0x62')](_0x469e62,function(_0x1bb2de){var _0x129ea0=_0x1bb2de[_0x91cb('0x3e')]({'plain':!![]});_0x129ea0[_0x91cb('0x63')][_0x91cb('0x64')](function(_0x50b8d6){_0x50b8d6[_0x91cb('0x65')]=_[_0x91cb('0x3a')](_0x3c1703,{'id':_0x129ea0['id']})[_0x91cb('0x65')];});return _0x129ea0[_0x91cb('0x63')];});return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3353bf['params']['id']}})[_0x91cb('0x16')](function(_0x43b620){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x3b0bd5){return _0x43b620['addTeams'](_0x598663,{'transaction':_0x3b0bd5})[_0x91cb('0x16')](function(){return BPromise['each'](_0x3c1703,function(_0x58608e){return db[_0x91cb('0x68')][_0x91cb('0x69')]({'TeamId':_0x58608e['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id'],'penalty':_0x58608e[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise[_0x91cb('0x6a')](_0x1e9441,function(_0x20ef3d){return db[_0x91cb('0x6b')]['findOrCreate']({'where':{'UserId':_0x20ef3d['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id']},'defaults':{'penalty':_0x20ef3d[_0x91cb('0x65')]},'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise['each'](_['filter'](_0x1e9441,{'online':!![]}),function(_0x530565){return db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x530565[_0x91cb('0x20')],'UserId':_0x530565['id'],'queue_name':_0x43b620['name'],'VoiceQueueId':_0x43b620['id'],'interface':_[_0x91cb('0x6d')](_0x530565[_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x530565['name']):_0x530565[_0x91cb('0x61')],'paused':_0x530565[_0x91cb('0x60')]||![],'penalty':_0x530565[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){_0x1e9441[_0x91cb('0x64')](function(_0x3c788e){socket['emit'](_0x91cb('0x70'),{'UserId':_0x3c788e['id'],'VoiceQueueId':_0x43b620['id']});});});});});}})[_0x91cb('0x16')](respondWithStatusCode(_0x5b3658,null))[_0x91cb('0x2f')](handleError(_0x5b3658,null));};exports[_0x91cb('0x71')]=function(_0x3782cd,_0x4b290e){return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')]},'attributes':['id'],'include':[{'model':db[_0x91cb('0x73')],'as':_0x91cb('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b290e,null))[_0x91cb('0x16')](function(_0x2bafae){var _0x27472a=_['map'](_0x2bafae,'id');var _0x59cb69=[];var _0x5d0f96=[];var _0x174325=squel[_0x91cb('0x74')]();_0x174325[_0x91cb('0x75')](_0x91cb('0x76'))['from'](_0x91cb('0x77'),'tq')[_0x91cb('0x78')](_0x91cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91cb('0x2a')]('VoiceQueueId\x20=\x20?',_0x3782cd[_0x91cb('0x30')]['id']);for(var _0x43b2e7=0x0;_0x43b2e7<_0x2bafae['length'];_0x43b2e7+=0x1){let _0x1b47fe=_0x2bafae[_0x43b2e7];for(var _0x1853de=0x0;_0x1853de<_0x1b47fe[_0x91cb('0x63')][_0x91cb('0x37')];_0x1853de+=0x1){let _0x376426=_0x1b47fe['Agents'][_0x1853de];var _0x22a6e6=_0x174325[_0x91cb('0x44')]();_0x22a6e6[_0x91cb('0x2a')](_0x91cb('0x7a'),_0x376426['id']);_0x5d0f96['push'](db[_0x91cb('0x66')]['query'](_0x22a6e6['toString'](),{'type':db['sequelize'][_0x91cb('0x7b')][_0x91cb('0x7c')]})[_0x91cb('0x16')](function(_0x4972c3){if(_0x4972c3[_0x91cb('0x37')]===0x1){return _0x376426['id'];}else{var _0x53dbb2=_[_0x91cb('0x7d')](_[_0x91cb('0x1c')](_0x4972c3,_0x91cb('0x7e')),function(_0x2a2a71){return _[_0x91cb('0x1e')](_0x27472a,_0x2a2a71);});if(_0x53dbb2){return _0x376426['id'];}}}));}}return BPromise[_0x91cb('0x7f')](_0x5d0f96)['then'](function(_0x5bfd2c){_0x59cb69=_(_0x59cb69)[_0x91cb('0x80')](_0x5bfd2c)['compact']()[_0x91cb('0x1d')]();return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x3782cd[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(_0x51d431){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x18ec67){return _0x51d431['removeTeams'](_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')],{'transaction':_0x18ec67})['then'](function(){if(!_[_0x91cb('0x81')](_0x59cb69)){return _0x51d431[_0x91cb('0x82')](_0x59cb69,{'transaction':_0x18ec67})[_0x91cb('0x16')](function(){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0x3782cd[_0x91cb('0x30')]['id'],'UserId':_0x59cb69},'transaction':_0x18ec67});});}})['then'](function(){_0x59cb69[_0x91cb('0x64')](function(_0x5da781){socket['emit']('userVoiceQueue:remove',{'UserId':_0x5da781,'VoiceQueueId':_0x51d431['id']});});});});});});})[_0x91cb('0x16')](respondWithStatusCode(_0x4b290e,null))['catch'](handleError(_0x4b290e,null));};exports['addAgents']=function(_0x3c0211,_0x3710e9){var _0x395e21,_0x52b9af;return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3c0211[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x3710e9,null))[_0x91cb('0x16')](function(_0x3280a5){if(_0x3280a5){_0x52b9af=_0x3280a5;return _0x3280a5[_0x91cb('0x83')](_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x3c0211['body'],[_0x91cb('0x72'),'id'])||{})[_0x91cb('0x84')](function(_0x547b4d){for(var _0x1aef0b=0x0;_0x1aef0b<_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x91cb('0x37')];_0x1aef0b+=0x1){socket[_0x91cb('0x85')]('userVoiceQueue:save',{'UserId':Number(_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x1aef0b]),'VoiceQueueId':Number(_0x3c0211[_0x91cb('0x30')]['id'])});}return _0x547b4d;});}})['then'](function(_0x4ba088){_0x395e21=_0x4ba088||[];if(_0x52b9af){return db[_0x91cb('0x73')][_0x91cb('0x52')]({'where':{'id':_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')]},'attributes':['id',_0x91cb('0x20'),_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]});}})['then'](function(_0x33b7a7){if(!_[_0x91cb('0x81')](_0x33b7a7)){var _0x4ac7b9=[];for(var _0x41c3ff=0x0;_0x41c3ff<_0x33b7a7[_0x91cb('0x37')];_0x41c3ff++){if(_0x33b7a7[_0x41c3ff]['online']){_0x4ac7b9[_0x91cb('0x86')](db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x33b7a7[_0x41c3ff][_0x91cb('0x20')],'UserId':_0x33b7a7[_0x41c3ff]['id'],'queue_name':_0x52b9af[_0x91cb('0x20')],'VoiceQueueId':_0x52b9af['id'],'interface':_['isNil'](_0x33b7a7[_0x41c3ff][_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x33b7a7[_0x41c3ff][_0x91cb('0x20')]):_0x33b7a7[_0x41c3ff]['interface'],'paused':_0x33b7a7[_0x41c3ff][_0x91cb('0x60')]||![],'penalty':_0x3c0211['body'][_0x91cb('0x65')]||0x0}));}}return BPromise[_0x91cb('0x7f')](_0x4ac7b9);}})[_0x91cb('0x16')](function(){return _0x395e21;})[_0x91cb('0x16')](respondWithResult(_0x3710e9,null))[_0x91cb('0x2f')](handleError(_0x3710e9,null));};exports[_0x91cb('0x82')]=function(_0xd572bc,_0x1e7a48){return db[_0x91cb('0x25')]['find']({'where':{'id':_0xd572bc[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1e7a48,null))[_0x91cb('0x16')](function(_0x51ef1c){if(_0x51ef1c){return _0x51ef1c[_0x91cb('0x82')](_0xd572bc['query'][_0x91cb('0x72')])['then'](function(){if(_[_0x91cb('0x87')](_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')])){for(var _0x10fe63=0x0;_0x10fe63<_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x91cb('0x37')];_0x10fe63+=0x1){socket['emit'](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x10fe63]),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}}else{socket[_0x91cb('0x85')](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')]['ids']),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}});}})[_0x91cb('0x16')](function(_0x219b5f){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0xd572bc['params']['id'],'UserId':_0xd572bc['query']['ids']}})[_0x91cb('0x16')](function(){return _0x219b5f;});})[_0x91cb('0x16')](respondWithStatusCode(_0x1e7a48,null))['catch'](handleError(_0x1e7a48,null));};exports['getAgents']=function(_0x471c17,_0x6549a7){var _0x13564d={};var _0x3c1e63={};var _0x1f2d72;var _0x376adc;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x471c17['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x6549a7,null))[_0x91cb('0x16')](function(_0xf15400){if(_0xf15400){_0x1f2d72=_0xf15400;_0x3c1e63['model']=_[_0x91cb('0x31')](db[_0x91cb('0x73')][_0x91cb('0x26')]);_0x3c1e63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x471c17[_0x91cb('0x2d')]);_0x3c1e63[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x3c1e63['model'],_0x3c1e63['query']);_0x13564d[_0x91cb('0x34')]=_['intersection'](_0x3c1e63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x13564d['attributes']=_0x13564d[_0x91cb('0x34')][_0x91cb('0x37')]?_0x13564d[_0x91cb('0x34')]:_0x3c1e63[_0x91cb('0x35')];_0x13564d[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x13564d['where']=qs[_0x91cb('0x32')](_['pick'](_0x471c17[_0x91cb('0x2d')],_0x3c1e63[_0x91cb('0x32')]));if(_0x471c17['query'][_0x91cb('0x1a')]){_0x13564d[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x13564d[_0x91cb('0x2a')],{'$or':_['map'](_0x13564d[_0x91cb('0x34')],function(_0x1bef2b){var _0x5a38f7={};_0x5a38f7[_0x1bef2b]={'$like':'%'+_0x471c17[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x5a38f7;})});}_0x13564d=_[_0x91cb('0x39')]({},_0x13564d,_0x471c17[_0x91cb('0x59')]);return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x2f42ef){if(_0x2f42ef){_0x376adc=_0x2f42ef[_0x91cb('0x37')];if(!_0x471c17[_0x91cb('0x2d')][_0x91cb('0x56')]('nolimit')){_0x13564d[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x13564d[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x31cf76){if(_0x31cf76){return _0x31cf76?{'count':_0x376adc,'rows':_0x31cf76}:null;}})['then'](respondWithResult(_0x6549a7,null))[_0x91cb('0x2f')](handleError(_0x6549a7,null));};exports['getMembers']=function(_0x3a5022,_0x17141e){var _0x3e2c58={};var _0x11c67c={};var _0xf4b4ab;var _0x2fa5e3;return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a5022[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x17141e,null))[_0x91cb('0x16')](function(_0x4483fb){if(_0x4483fb){_0xf4b4ab=_0x4483fb;_0x11c67c['model']=_['keys'](db['UserVoiceQueueRt'][_0x91cb('0x26')]);_0x11c67c[_0x91cb('0x2d')]=_['keys'](_0x3a5022['query']);_0x11c67c['filters']=_[_0x91cb('0x33')](_0x11c67c[_0x91cb('0x35')],_0x11c67c['query']);_0x3e2c58['attributes']=_['intersection'](_0x11c67c[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a5022['query'][_0x91cb('0x36')]));_0x3e2c58[_0x91cb('0x34')]=_0x3e2c58['attributes']['length']?_0x3e2c58[_0x91cb('0x34')]:_0x11c67c[_0x91cb('0x35')];_0x3e2c58[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x3a5022[_0x91cb('0x2d')]['sort']);_0x3e2c58[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3a5022[_0x91cb('0x2d')],_0x11c67c[_0x91cb('0x32')]));if(_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x3e2c58[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x3e2c58[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x3e2c58[_0x91cb('0x34')],function(_0x1ea132){var _0x3b1d97={};_0x3b1d97[_0x1ea132]={'$like':'%'+_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x3b1d97;})});}_0x3e2c58=_[_0x91cb('0x39')]({},_0x3e2c58,_0x3a5022[_0x91cb('0x59')]);return _0xf4b4ab[_0x91cb('0x8a')](_0x3e2c58);}})[_0x91cb('0x16')](function(_0x5cf6df){if(_0x5cf6df){_0x2fa5e3=_0x5cf6df['length'];if(!_0x3a5022['query'][_0x91cb('0x56')]('nolimit')){_0x3e2c58[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x3e2c58[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0xf4b4ab['getMembers'](_0x3e2c58);}})['then'](function(_0x5f2de0){return _0x5f2de0?{'count':_0x2fa5e3,'rows':_0x5f2de0}:null;})[_0x91cb('0x16')](respondWithResult(_0x17141e,null))[_0x91cb('0x2f')](handleError(_0x17141e,null));};exports[_0x91cb('0x8b')]=function(_0x2b4e25,_0x4c044d){var _0x54c194={};var _0x3cfdcb={};var _0x1624b3;var _0x1e2acd;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2b4e25['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x4c044d,null))['then'](function(_0x1e979e){if(_0x1e979e){_0x1624b3=_0x1e979e;_0x3cfdcb[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x3cfdcb[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x2b4e25[_0x91cb('0x2d')]);_0x3cfdcb['filters']=_[_0x91cb('0x33')](_0x3cfdcb[_0x91cb('0x35')],_0x3cfdcb[_0x91cb('0x2d')]);_0x54c194[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x3cfdcb['model'],qs[_0x91cb('0x36')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x54c194['attributes']=_0x54c194['attributes'][_0x91cb('0x37')]?_0x54c194['attributes']:_0x3cfdcb[_0x91cb('0x35')];_0x54c194[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2b4e25[_0x91cb('0x2d')]['sort']);_0x54c194[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x2b4e25[_0x91cb('0x2d')],_0x3cfdcb[_0x91cb('0x32')]));if(_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x54c194[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x54c194['where'],{'$or':_[_0x91cb('0x1c')](_0x54c194['attributes'],function(_0x283743){var _0x44ffde={};_0x44ffde[_0x283743]={'$like':'%'+_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x44ffde;})});}_0x54c194=_['merge']({},_0x54c194,_0x2b4e25[_0x91cb('0x59')]);return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})[_0x91cb('0x16')](function(_0x5e629){if(_0x5e629){_0x1e2acd=_0x5e629[_0x91cb('0x37')];if(!_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x54c194[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x2b4e25['query'][_0x91cb('0x12')]);_0x54c194['offset']=qs[_0x91cb('0x13')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})['then'](function(_0x87f382){if(_0x87f382){return _0x87f382?{'count':_0x1e2acd,'rows':_0x87f382}:null;}})[_0x91cb('0x16')](respondWithResult(_0x4c044d,null))[_0x91cb('0x2f')](handleError(_0x4c044d,null));};exports['addLists']=function(_0x330123,_0x23bc13){var _0x175d85=moment()[_0x91cb('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x97ba8,_0x4bc382;return db[_0x91cb('0x25')]['find']({'where':{'id':_0x330123[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x23bc13,null))[_0x91cb('0x16')](function(_0x399012){if(_0x399012){_0x4bc382=_0x399012;return _0x399012[_0x91cb('0x8d')](_0x330123['body']['ids'],_[_0x91cb('0x47')](_0x330123[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x571a6f){var _0x19596b;_0x97ba8=_0x571a6f||[];var _0x5b4849=[];if(_0x571a6f){for(var _0x39a183=0x0;_0x39a183<_0x571a6f[_0x91cb('0x37')];_0x39a183+=0x1){var _0x693690=_0x571a6f[_0x39a183][_0x91cb('0x3e')]({'plain':!![]});_0x4bc382[_0x91cb('0x8e')]=_0x330123[_0x91cb('0x3c')][_0x91cb('0x8e')]?_0x330123[_0x91cb('0x3c')]['dialCheckDuplicateType']:_0x4bc382['dialCheckDuplicateType'];switch(_0x4bc382['dialCheckDuplicateType']){case'always':_0x19596b=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')](['phone','scheduledAt',_0x91cb('0x93'),'ListId',_0x91cb('0x51'),_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27','scheduledAt')[_0x91cb('0x75')]('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690[_0x91cb('0x95')]['toString'](),'ListId')['field'](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x9d'))[_0x91cb('0x97')](_0x91cb('0x9e'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id']['toString']()))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa0'))['from'](_0x91cb('0x91'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))['toString']();break;case _0x91cb('0xa1'):_0x19596b=squel[_0x91cb('0x8f')]()['into'](_0x91cb('0x91'))['fromQuery']([_0x91cb('0x94'),'scheduledAt',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))[_0x91cb('0x75')]('id',_0x91cb('0x93'))['field'](_0x693690[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0x91cb('0x97')]('cm_hopper')[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))[_0x91cb('0x96')]();break;default:_0x19596b=squel['insert']()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')]([_0x91cb('0x94'),_0x91cb('0xa3'),_0x91cb('0x93'),_0x91cb('0xa2'),'VoiceQueueId',_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()['field'](_0x91cb('0x94'),'phone')['field']('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))['field']('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690['CmListId'][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))['where'](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())['where'](_0x91cb('0x9b')))[_0x91cb('0x96')]();}_0x5b4849['push'](db[_0x91cb('0x66')]['query'](_0x19596b));}return BPromise[_0x91cb('0x7f')](_0x5b4849);}})['then'](function(){var _0x739447=[];var _0x2deed1=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xa4'))['fromQuery']([_0x91cb('0xa5'),_0x91cb('0x94'),'OrderBy','createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa6'))['field'](_0x91cb('0xa7'))[_0x91cb('0x75')](_0x91cb('0xa8'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))['from'](_0x91cb('0xa9'),'ci')[_0x91cb('0x78')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x91cb('0x2a')](_0x91cb('0xaa'),_0x175d85)[_0x91cb('0x2a')](_0x91cb('0xab'),_0x91cb('0xac')))[_0x91cb('0x96')]();_0x739447[_0x91cb('0x86')](db[_0x91cb('0x66')]['query'](_0x2deed1));return BPromise[_0x91cb('0x7f')](_0x739447);})[_0x91cb('0x16')](function(){return _0x97ba8;})[_0x91cb('0x16')](respondWithResult(_0x23bc13,null))[_0x91cb('0x2f')](handleError(_0x23bc13,null));};exports[_0x91cb('0xad')]=function(_0x554923,_0x2fe556){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x554923[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x2fe556,null))[_0x91cb('0x16')](function(_0x43958a){if(_0x43958a){return _0x43958a[_0x91cb('0xad')](_0x554923['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0x409a36){if(_0x409a36){return db[_0x91cb('0x4c')][_0x91cb('0x17')]({'where':{'ListId':_0x554923[_0x91cb('0x2d')][_0x91cb('0x72')],'VoiceQueueId':_0x554923[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(){return _0x409a36;});}})[_0x91cb('0x16')](respondWithStatusCode(_0x2fe556,null))['catch'](handleError(_0x2fe556,null));};exports[_0x91cb('0xae')]=function(_0x2d870d,_0x173761){var _0x2cf0d8={};var _0x9d63ff={};var _0x720de;var _0x80f0ba;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2d870d[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x173761,null))[_0x91cb('0x16')](function(_0x800860){if(_0x800860){_0x720de=_0x800860;_0x9d63ff[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x9d63ff['query']=_['keys'](_0x2d870d[_0x91cb('0x2d')]);_0x9d63ff[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x9d63ff['model'],_0x9d63ff[_0x91cb('0x2d')]);_0x2cf0d8[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9d63ff[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x2cf0d8[_0x91cb('0x34')]=_0x2cf0d8[_0x91cb('0x34')][_0x91cb('0x37')]?_0x2cf0d8[_0x91cb('0x34')]:_0x9d63ff[_0x91cb('0x35')];_0x2cf0d8[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x2cf0d8[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x2d870d['query'],_0x9d63ff[_0x91cb('0x32')]));if(_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x2cf0d8['where']=_['merge'](_0x2cf0d8['where'],{'$or':_[_0x91cb('0x1c')](_0x2cf0d8[_0x91cb('0x34')],function(_0x4370f6){var _0x5bc712={};_0x5bc712[_0x4370f6]={'$like':'%'+_0x2d870d['query'][_0x91cb('0x1a')]+'%'};return _0x5bc712;})});}_0x2cf0d8=_[_0x91cb('0x39')]({},_0x2cf0d8,_0x2d870d[_0x91cb('0x59')]);return _0x720de[_0x91cb('0xae')](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x182f2c){if(_0x182f2c){_0x80f0ba=_0x182f2c[_0x91cb('0x37')];if(!_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x2cf0d8['limit']=qs['limit'](_0x2d870d[_0x91cb('0x2d')]['limit']);_0x2cf0d8[_0x91cb('0x13')]=qs['offset'](_0x2d870d['query'][_0x91cb('0x13')]);}return _0x720de['getBlackLists'](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x2ac9df){if(_0x2ac9df){return _0x2ac9df?{'count':_0x80f0ba,'rows':_0x2ac9df}:null;}})['then'](respondWithResult(_0x173761,null))[_0x91cb('0x2f')](handleError(_0x173761,null));};exports[_0x91cb('0xaf')]=function(_0x331381,_0x52ce8c){var _0x534968;return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x331381['params']['id']}})['then'](handleEntityNotFound(_0x52ce8c,null))['then'](function(_0x397397){if(_0x397397){return _0x397397[_0x91cb('0xaf')](_0x331381[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x331381[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x2a0c3c){var _0x30ef98;_0x534968=_0x2a0c3c||[];var _0x27d0ab=[];if(_0x2a0c3c){for(var _0x547db7=0x0;_0x547db7<_0x2a0c3c['length'];_0x547db7+=0x1){var _0x38d608=_0x2a0c3c[_0x547db7][_0x91cb('0x3e')]({'plain':!![]});_0x30ef98=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xb0'))[_0x91cb('0x92')](['phone',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel['select']()[_0x91cb('0x75')](_0x91cb('0x94'),'phone')[_0x91cb('0x75')]('id','ContactId')[_0x91cb('0x75')](_0x38d608[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))['field'](_0x331381[_0x91cb('0x30')]['id']['toString'](),_0x91cb('0x51'))['field']('NOW()',_0x91cb('0x45'))[_0x91cb('0x75')](_0x91cb('0xb1'),_0x91cb('0x46'))[_0x91cb('0x97')]('cm_contacts')['where'](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x38d608['CmListId'][_0x91cb('0x96')]())[_0x91cb('0x2a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x27d0ab[_0x91cb('0x86')](db['sequelize'][_0x91cb('0x2d')](_0x30ef98));}return BPromise['all'](_0x27d0ab);}})['then'](function(){return _0x534968;})[_0x91cb('0x16')](respondWithResult(_0x52ce8c,null))[_0x91cb('0x2f')](handleError(_0x52ce8c,null));};exports[_0x91cb('0xb2')]=function(_0x4ef95b,_0x2f0269){return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x4ef95b[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x2f0269,null))['then'](function(_0x5e1b97){if(_0x5e1b97){return _0x5e1b97[_0x91cb('0xb2')](_0x4ef95b['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0xcb3114){if(_0xcb3114){return db[_0x91cb('0x5b')][_0x91cb('0x17')]({'where':{'ListId':_0x4ef95b['query'][_0x91cb('0x72')],'VoiceQueueId':_0x4ef95b['params']['id']}})[_0x91cb('0x16')](function(){return _0xcb3114;});}})['then'](respondWithStatusCode(_0x2f0269,null))[_0x91cb('0x2f')](handleError(_0x2f0269,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 83a43d9..61b910f 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 _0xead1=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5766b8,_0x3f562d){var _0x214b9f=function(_0x5ce922){while(--_0x5ce922){_0x5766b8['push'](_0x5766b8['shift']());}};_0x214b9f(++_0x3f562d);}(_0xead1,0x128));var _0x1ead=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xead1[_0x3e112d];return _0x531c31;};'use strict';var EventEmitter=require(_0x1ead('0x0'));var VoiceQueue=require(_0x1ead('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1ead('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ead('0x3'),'afterDestroy':_0x1ead('0x4')};function emitEvent(_0x4e3c1a){return function(_0x1cb84b,_0xc3097c,_0x4de671){VoiceQueueEvents[_0x1ead('0x5')](_0x4e3c1a+':'+_0x1cb84b['id'],_0x1cb84b);VoiceQueueEvents[_0x1ead('0x5')](_0x4e3c1a,_0x1cb84b);_0x4de671(null);};}for(var e in events){if(events[_0x1ead('0x6')](e)){var event=events[e];VoiceQueue[_0x1ead('0x7')](e,emitEvent(event));}}module[_0x1ead('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x779f=['remove','emit','hook','exports','events','save'];(function(_0x77b41f,_0x5d99f9){var _0x490c0d=function(_0x25c723){while(--_0x25c723){_0x77b41f['push'](_0x77b41f['shift']());}};_0x490c0d(++_0x5d99f9);}(_0x779f,0x6a));var _0xf779=function(_0x16f28f,_0xaf617d){_0x16f28f=_0x16f28f-0x0;var _0x168f05=_0x779f[_0x16f28f];return _0x168f05;};'use strict';var EventEmitter=require(_0xf779('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf779('0x1'),'afterUpdate':'update','afterDestroy':_0xf779('0x2')};function emitEvent(_0xe16c91){return function(_0x1da319,_0x3e43cc,_0x589caa){VoiceQueueEvents[_0xf779('0x3')](_0xe16c91+':'+_0x1da319['id'],_0x1da319);VoiceQueueEvents[_0xf779('0x3')](_0xe16c91,_0x1da319);_0x589caa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xf779('0x4')](e,emitEvent(event));}}module[_0xf779('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 5667d99..db0842e 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x37858a,_0x3b523f){var _0x1ff350=function(_0x13f59c){while(--_0x13f59c){_0x37858a['push'](_0x37858a['shift']());}};_0x1ff350(++_0x3b523f);}(_0x3e74,0x175));var _0x43e7=function(_0xea6fdf,_0x8ece6){_0xea6fdf=_0xea6fdf-0x0;var _0x50b946=_0x3e74[_0xea6fdf];return _0x50b946;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x4540a0,_0x4dad08){var _0x16f1c1=function(_0x243366){while(--_0x243366){_0x4540a0['push'](_0x4540a0['shift']());}};_0x16f1c1(++_0x4dad08);}(_0xedd9,0xfc));var _0x9edd=function(_0x15a62c,_0x53f412){_0x15a62c=_0x15a62c-0x0;var _0x1e2fec=_0xedd9[_0x15a62c];return _0x1e2fec;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index af246d9..65e9c04 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 _0x3e98=['model','attributes','GetVoiceQueue','ShowVoiceQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','include','map'];(function(_0x4d3577,_0x36df4f){var _0x29d8b6=function(_0x4f7fb1){while(--_0x4f7fb1){_0x4d3577['push'](_0x4d3577['shift']());}};_0x29d8b6(++_0x36df4f);}(_0x3e98,0x79));var _0x83e9=function(_0x1801e6,_0x3814c2){_0x1801e6=_0x1801e6-0x0;var _0x465eaa=_0x3e98[_0x1801e6];return _0x465eaa;};'use strict';var _=require(_0x83e9('0x0'));var util=require('util');var moment=require(_0x83e9('0x1'));var BPromise=require(_0x83e9('0x2'));var rs=require(_0x83e9('0x3'));var fs=require('fs');var Redis=require(_0x83e9('0x4'));var db=require(_0x83e9('0x5'))['db'];var utils=require(_0x83e9('0x6'));var logger=require(_0x83e9('0x7'))(_0x83e9('0x8'));var config=require('../../config/environment');var jayson=require(_0x83e9('0x9'));var client=jayson[_0x83e9('0xa')][_0x83e9('0xb')]({'port':0x232a});config[_0x83e9('0xc')]=_[_0x83e9('0xd')](config['redis'],{'host':_0x83e9('0xe'),'port':0x18eb});var socket=require(_0x83e9('0xf'))(new Redis(config[_0x83e9('0xc')]));require(_0x83e9('0x10'))[_0x83e9('0x11')](socket);function respondWithRpcPromise(_0x345589,_0x413edb,_0x58caab){return new BPromise(function(_0x152272,_0x7395a1){return client['request'](_0x345589,_0x58caab)[_0x83e9('0x12')](function(_0x11966d){logger[_0x83e9('0x13')](_0x83e9('0x14'),_0x413edb,_0x83e9('0x15'));logger[_0x83e9('0x16')](_0x83e9('0x17'),_0x413edb,_0x83e9('0x15'),JSON[_0x83e9('0x18')](_0x11966d));if(_0x11966d['error']){if(_0x11966d[_0x83e9('0x19')][_0x83e9('0x1a')]===0x1f4){logger['error'](_0x83e9('0x14'),_0x413edb,_0x11966d[_0x83e9('0x19')][_0x83e9('0x1b')]);return _0x7395a1(_0x11966d[_0x83e9('0x19')]['message']);}logger[_0x83e9('0x19')](_0x83e9('0x14'),_0x413edb,_0x11966d['error'][_0x83e9('0x1b')]);return _0x152272(_0x11966d[_0x83e9('0x19')][_0x83e9('0x1b')]);}else{logger[_0x83e9('0x13')](_0x83e9('0x14'),_0x413edb,_0x83e9('0x15'));_0x152272(_0x11966d[_0x83e9('0x1c')]['message']);}})['catch'](function(_0x15c6d1){logger[_0x83e9('0x19')](_0x83e9('0x14'),_0x413edb,_0x15c6d1);_0x7395a1(_0x15c6d1);});});}exports['GetVoiceQueue']=function(_0x5c3860){var _0x4b0d28=this;return new Promise(function(_0x5ba315,_0x2b3e9d){return db['VoiceQueue'][_0x83e9('0x1d')]({'raw':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')][_0x83e9('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')][_0x83e9('0x20')]||null:null,'attributes':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')]['attributes']||null:null,'limit':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')]['limit']||null:null,'include':_0x5c3860[_0x83e9('0x1e')]?_0x5c3860[_0x83e9('0x1e')][_0x83e9('0x21')]?_[_0x83e9('0x22')](_0x5c3860['options'][_0x83e9('0x21')],function(_0x1282f0){return{'model':db[_0x1282f0[_0x83e9('0x23')]],'as':_0x1282f0['as'],'attributes':_0x1282f0[_0x83e9('0x24')],'include':_0x1282f0[_0x83e9('0x21')]?_['map'](_0x1282f0[_0x83e9('0x21')],function(_0x620471){return{'model':db[_0x620471[_0x83e9('0x23')]],'as':_0x620471['as'],'attributes':_0x620471['attributes'],'include':_0x620471[_0x83e9('0x21')]?_['map'](_0x620471[_0x83e9('0x21')],function(_0x5b5c70){return{'model':db[_0x5b5c70[_0x83e9('0x23')]],'as':_0x5b5c70['as'],'attributes':_0x5b5c70['attributes']};}):[]};}):[]};}):[]:[]})[_0x83e9('0x12')](function(_0x4889ce){logger[_0x83e9('0x13')](_0x83e9('0x25'),_0x5c3860);logger['debug']('GetVoiceQueue',_0x5c3860,JSON[_0x83e9('0x18')](_0x4889ce));_0x5ba315(_0x4889ce);})['catch'](function(_0x51b639){logger[_0x83e9('0x19')](_0x83e9('0x25'),_0x51b639[_0x83e9('0x1b')],_0x5c3860);_0x2b3e9d(_0x4b0d28[_0x83e9('0x19')](0x1f4,_0x51b639[_0x83e9('0x1b')]));});});};exports[_0x83e9('0x26')]=function(_0xcb5892){var _0x53b72c=this;return new Promise(function(_0x5c173a,_0x5f4cfb){return db['VoiceQueue']['find']({'raw':_0xcb5892['options']?_0xcb5892[_0x83e9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xcb5892[_0x83e9('0x1e')]?_0xcb5892[_0x83e9('0x1e')][_0x83e9('0x20')]||null:null,'attributes':_0xcb5892[_0x83e9('0x1e')]?_0xcb5892[_0x83e9('0x1e')][_0x83e9('0x24')]||null:null,'include':_0xcb5892[_0x83e9('0x1e')]?_0xcb5892['options'][_0x83e9('0x21')]?_['map'](_0xcb5892['options'][_0x83e9('0x21')],function(_0x30a28f){return{'model':db[_0x30a28f[_0x83e9('0x23')]],'as':_0x30a28f['as'],'attributes':_0x30a28f[_0x83e9('0x24')],'include':_0x30a28f[_0x83e9('0x21')]?_[_0x83e9('0x22')](_0x30a28f[_0x83e9('0x21')],function(_0x5bb3fc){return{'model':db[_0x5bb3fc[_0x83e9('0x23')]],'as':_0x5bb3fc['as'],'attributes':_0x5bb3fc['attributes'],'include':_0x5bb3fc[_0x83e9('0x21')]?_[_0x83e9('0x22')](_0x5bb3fc['include'],function(_0x4fa790){return{'model':db[_0x4fa790[_0x83e9('0x23')]],'as':_0x4fa790['as'],'attributes':_0x4fa790[_0x83e9('0x24')]};}):[]};}):[]};}):[]:[]})[_0x83e9('0x12')](function(_0xa478e1){logger[_0x83e9('0x13')](_0x83e9('0x26'),_0xcb5892);logger[_0x83e9('0x16')](_0x83e9('0x26'),_0xcb5892,JSON['stringify'](_0xa478e1));_0x5c173a(_0xa478e1);})['catch'](function(_0x3f4292){logger['error'](_0x83e9('0x26'),_0x3f4292[_0x83e9('0x1b')],_0xcb5892);_0x5f4cfb(_0x53b72c['error'](0x1f4,_0x3f4292[_0x83e9('0x1b')]));});});}; \ No newline at end of file +var _0xff3b=['ShowVoiceQueue','find','stringify','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','localhost','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','catch'];(function(_0x2aba63,_0x29796f){var _0x47871f=function(_0x41bb05){while(--_0x41bb05){_0x2aba63['push'](_0x2aba63['shift']());}};_0x47871f(++_0x29796f);}(_0xff3b,0xe1));var _0xbff3=function(_0x12e86c,_0x2d3201){_0x12e86c=_0x12e86c-0x0;var _0xd1230d=_0xff3b[_0x12e86c];return _0xd1230d;};'use strict';var _=require('lodash');var util=require(_0xbff3('0x0'));var moment=require(_0xbff3('0x1'));var BPromise=require(_0xbff3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbff3('0x3'))['db'];var utils=require(_0xbff3('0x4'));var logger=require(_0xbff3('0x5'))(_0xbff3('0x6'));var config=require(_0xbff3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbff3('0x8')]['http']({'port':0x232a});config['redis']=_[_0xbff3('0x9')](config['redis'],{'host':_0xbff3('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0xbff3('0xb')](socket);function respondWithRpcPromise(_0x5e6feb,_0x184836,_0x33f3cc){return new BPromise(function(_0x35d223,_0x2aa262){return client['request'](_0x5e6feb,_0x33f3cc)[_0xbff3('0xc')](function(_0x3c8733){logger[_0xbff3('0xd')](_0xbff3('0xe'),_0x184836,_0xbff3('0xf'));logger['debug'](_0xbff3('0x10'),_0x184836,'request\x20sent',JSON['stringify'](_0x3c8733));if(_0x3c8733[_0xbff3('0x11')]){if(_0x3c8733[_0xbff3('0x11')][_0xbff3('0x12')]===0x1f4){logger[_0xbff3('0x11')](_0xbff3('0xe'),_0x184836,_0x3c8733[_0xbff3('0x11')][_0xbff3('0x13')]);return _0x2aa262(_0x3c8733[_0xbff3('0x11')]['message']);}logger[_0xbff3('0x11')](_0xbff3('0xe'),_0x184836,_0x3c8733[_0xbff3('0x11')][_0xbff3('0x13')]);return _0x35d223(_0x3c8733[_0xbff3('0x11')][_0xbff3('0x13')]);}else{logger[_0xbff3('0xd')]('VoiceQueue,\x20%s,\x20%s',_0x184836,_0xbff3('0xf'));_0x35d223(_0x3c8733[_0xbff3('0x14')]['message']);}})['catch'](function(_0x1999d8){logger[_0xbff3('0x11')](_0xbff3('0xe'),_0x184836,_0x1999d8);_0x2aa262(_0x1999d8);});});}exports[_0xbff3('0x15')]=function(_0x46564f){var _0x66dafc=this;return new Promise(function(_0x417edf,_0x2a2415){return db[_0xbff3('0x16')][_0xbff3('0x17')]({'raw':_0x46564f[_0xbff3('0x18')]?_0x46564f['options'][_0xbff3('0x19')]===undefined?!![]:![]:!![],'where':_0x46564f[_0xbff3('0x18')]?_0x46564f[_0xbff3('0x18')][_0xbff3('0x1a')]||null:null,'attributes':_0x46564f[_0xbff3('0x18')]?_0x46564f[_0xbff3('0x18')][_0xbff3('0x1b')]||null:null,'limit':_0x46564f[_0xbff3('0x18')]?_0x46564f[_0xbff3('0x18')][_0xbff3('0x1c')]||null:null,'include':_0x46564f['options']?_0x46564f[_0xbff3('0x18')]['include']?_[_0xbff3('0x1d')](_0x46564f[_0xbff3('0x18')][_0xbff3('0x1e')],function(_0x3a0676){return{'model':db[_0x3a0676[_0xbff3('0x1f')]],'as':_0x3a0676['as'],'attributes':_0x3a0676[_0xbff3('0x1b')],'include':_0x3a0676[_0xbff3('0x1e')]?_['map'](_0x3a0676[_0xbff3('0x1e')],function(_0x4e10eb){return{'model':db[_0x4e10eb[_0xbff3('0x1f')]],'as':_0x4e10eb['as'],'attributes':_0x4e10eb[_0xbff3('0x1b')],'include':_0x4e10eb[_0xbff3('0x1e')]?_[_0xbff3('0x1d')](_0x4e10eb[_0xbff3('0x1e')],function(_0x46c35c){return{'model':db[_0x46c35c['model']],'as':_0x46c35c['as'],'attributes':_0x46c35c['attributes']};}):[]};}):[]};}):[]:[]})[_0xbff3('0xc')](function(_0x10d225){logger[_0xbff3('0xd')](_0xbff3('0x15'),_0x46564f);logger[_0xbff3('0x20')](_0xbff3('0x15'),_0x46564f,JSON['stringify'](_0x10d225));_0x417edf(_0x10d225);})[_0xbff3('0x21')](function(_0x54a33f){logger[_0xbff3('0x11')](_0xbff3('0x15'),_0x54a33f[_0xbff3('0x13')],_0x46564f);_0x2a2415(_0x66dafc[_0xbff3('0x11')](0x1f4,_0x54a33f[_0xbff3('0x13')]));});});};exports[_0xbff3('0x22')]=function(_0x372ef6){var _0x36d1f0=this;return new Promise(function(_0x571188,_0x13c536){return db['VoiceQueue'][_0xbff3('0x23')]({'raw':_0x372ef6[_0xbff3('0x18')]?_0x372ef6[_0xbff3('0x18')][_0xbff3('0x19')]===undefined?!![]:![]:!![],'where':_0x372ef6[_0xbff3('0x18')]?_0x372ef6['options'][_0xbff3('0x1a')]||null:null,'attributes':_0x372ef6['options']?_0x372ef6[_0xbff3('0x18')][_0xbff3('0x1b')]||null:null,'include':_0x372ef6[_0xbff3('0x18')]?_0x372ef6[_0xbff3('0x18')][_0xbff3('0x1e')]?_['map'](_0x372ef6[_0xbff3('0x18')]['include'],function(_0x4267b0){return{'model':db[_0x4267b0[_0xbff3('0x1f')]],'as':_0x4267b0['as'],'attributes':_0x4267b0[_0xbff3('0x1b')],'include':_0x4267b0[_0xbff3('0x1e')]?_[_0xbff3('0x1d')](_0x4267b0['include'],function(_0x1831e9){return{'model':db[_0x1831e9['model']],'as':_0x1831e9['as'],'attributes':_0x1831e9[_0xbff3('0x1b')],'include':_0x1831e9[_0xbff3('0x1e')]?_['map'](_0x1831e9['include'],function(_0x1bb7b6){return{'model':db[_0x1bb7b6[_0xbff3('0x1f')]],'as':_0x1bb7b6['as'],'attributes':_0x1bb7b6[_0xbff3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbff3('0xc')](function(_0x10d11c){logger[_0xbff3('0xd')](_0xbff3('0x22'),_0x372ef6);logger['debug'](_0xbff3('0x22'),_0x372ef6,JSON[_0xbff3('0x24')](_0x10d11c));_0x571188(_0x10d11c);})[_0xbff3('0x21')](function(_0x1ac3e6){logger[_0xbff3('0x11')](_0xbff3('0x22'),_0x1ac3e6[_0xbff3('0x13')],_0x372ef6);_0x13c536(_0x36d1f0[_0xbff3('0x11')](0x1f4,_0x1ac3e6[_0xbff3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 566cfae..27080b9 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 _0x4231=['length','./voiceQueue.events','save','remove','update','removeListener','register'];(function(_0x5c03a4,_0x38d38e){var _0x1b5c9c=function(_0x73e85){while(--_0x73e85){_0x5c03a4['push'](_0x5c03a4['shift']());}};_0x1b5c9c(++_0x38d38e);}(_0x4231,0xcc));var _0x1423=function(_0x40cd61,_0x36162c){_0x40cd61=_0x40cd61-0x0;var _0x120ce8=_0x4231[_0x40cd61];return _0x120ce8;};'use strict';var VoiceQueueEvents=require(_0x1423('0x0'));var events=[_0x1423('0x1'),_0x1423('0x2'),_0x1423('0x3')];function createListener(_0x59036d,_0x2d63a9){return function(_0x4544a6){_0x2d63a9['emit'](_0x59036d,_0x4544a6);};}function removeListener(_0x15cabf,_0x40219d){return function(){VoiceQueueEvents[_0x1423('0x4')](_0x15cabf,_0x40219d);};}exports[_0x1423('0x5')]=function(_0x40df4d){for(var _0x3d6577=0x0,_0xae5c7b=events[_0x1423('0x6')];_0x3d6577<_0xae5c7b;_0x3d6577++){var _0x1ff3e5=events[_0x3d6577];var _0x43de0a=createListener('voiceQueue:'+_0x1ff3e5,_0x40df4d);VoiceQueueEvents['on'](_0x1ff3e5,_0x43de0a);}}; \ No newline at end of file +var _0x9025=['emit','length','voiceQueue:','./voiceQueue.events'];(function(_0x59ed1e,_0x5c4327){var _0x1ed695=function(_0x40c748){while(--_0x40c748){_0x59ed1e['push'](_0x59ed1e['shift']());}};_0x1ed695(++_0x5c4327);}(_0x9025,0xc7));var _0x5902=function(_0x58158d,_0x1ce17c){_0x58158d=_0x58158d-0x0;var _0xa31ba2=_0x9025[_0x58158d];return _0xa31ba2;};'use strict';var VoiceQueueEvents=require(_0x5902('0x0'));var events=['save','remove','update'];function createListener(_0x55b8c8,_0x4c9848){return function(_0xc296bc){_0x4c9848[_0x5902('0x1')](_0x55b8c8,_0xc296bc);};}function removeListener(_0x114ca2,_0x4ac48a){return function(){VoiceQueueEvents['removeListener'](_0x114ca2,_0x4ac48a);};}exports['register']=function(_0x5b9257){for(var _0x36444a=0x0,_0x1b15d4=events[_0x5902('0x2')];_0x36444a<_0x1b15d4;_0x36444a++){var _0x544623=events[_0x36444a];var _0x1f6232=createListener(_0x5902('0x3')+_0x544623,_0x5b9257);VoiceQueueEvents['on'](_0x544623,_0x1f6232);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 99fcd9d..7ac67e8 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 _0x1144=['/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','path','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x50d851,_0x127682){var _0x553ded=function(_0x2f6b27){while(--_0x2f6b27){_0x50d851['push'](_0x50d851['shift']());}};_0x553ded(++_0x127682);}(_0x1144,0x1eb));var _0x4114=function(_0x40ea3e,_0x1744ed){_0x40ea3e=_0x40ea3e-0x0;var _0x5ed6ba=_0x1144[_0x40ea3e];return _0x5ed6ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4114('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4114('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x4114('0x2'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x4114('0x3')]('/',auth[_0x4114('0x4')](),controller['index']);router['get'](_0x4114('0x5'),auth[_0x4114('0x4')](),controller[_0x4114('0x6')]);router[_0x4114('0x3')](_0x4114('0x7'),auth[_0x4114('0x4')](),controller[_0x4114('0x8')]);router[_0x4114('0x3')]('/:id',auth[_0x4114('0x4')](),controller[_0x4114('0x9')]);router[_0x4114('0xa')]('/',auth[_0x4114('0x4')](),controller[_0x4114('0xb')]);router[_0x4114('0xc')](_0x4114('0xd'),auth[_0x4114('0x4')](),controller[_0x4114('0xe')]);router[_0x4114('0xf')](_0x4114('0xd'),auth[_0x4114('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcdcd=['/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcdcd,0x1ae));var _0xdcdc=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0xcdcd[_0xf80b3];return _0x10c489;};'use strict';var multer=require('multer');var util=require(_0xdcdc('0x0'));var path=require(_0xdcdc('0x1'));var timeout=require(_0xdcdc('0x2'));var express=require(_0xdcdc('0x3'));var router=express[_0xdcdc('0x4')]();var fs_extra=require(_0xdcdc('0x5'));var auth=require(_0xdcdc('0x6'));var interaction=require(_0xdcdc('0x7'));var config=require(_0xdcdc('0x8'));var controller=require(_0xdcdc('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdcdc('0xa')](_0xdcdc('0xb'),auth[_0xdcdc('0xc')](),controller[_0xdcdc('0xd')]);router[_0xdcdc('0xa')](_0xdcdc('0xe'),auth[_0xdcdc('0xc')](),controller[_0xdcdc('0xf')]);router['get'](_0xdcdc('0x10'),auth['isAuthenticated'](),controller[_0xdcdc('0x11')]);router[_0xdcdc('0x12')]('/',auth[_0xdcdc('0xc')](),controller['create']);router[_0xdcdc('0x13')](_0xdcdc('0x10'),auth[_0xdcdc('0xc')](),controller[_0xdcdc('0x14')]);router['delete']('/:id',auth[_0xdcdc('0xc')](),controller['destroy']);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 dac369e..0449bcd 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 _0x99ac=['sequelize','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5d3d29,_0x42ac07){var _0x1e69bf=function(_0x55321a){while(--_0x55321a){_0x5d3d29['push'](_0x5d3d29['shift']());}};_0x1e69bf(++_0x42ac07);}(_0x99ac,0xa8));var _0xc99a=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x99ac[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0xc99a('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xc99a('0x1')]},'uniqueid':{'type':Sequelize[_0xc99a('0x1')]},'calleridnum':{'type':Sequelize[_0xc99a('0x1')]},'calleridname':{'type':Sequelize[_0xc99a('0x1')]},'queue':{'type':Sequelize[_0xc99a('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xc99a('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xc99a('0x2')],'set':function(_0x388499){var _0x3e9285=moment(_0x388499);var _0x55971b=moment(this['getDataValue'](_0xc99a('0x3')))['format'](_0xc99a('0x4'));var _0x58ca2f=_0x3e9285[_0xc99a('0x5')](_0x55971b,_0xc99a('0x6'));this['setDataValue']('queuecallerleaveAt',_0x388499);this[_0xc99a('0x7')]('holdtime',_0x58ca2f||null);}},'position':{'type':Sequelize[_0xc99a('0x8')]},'count':{'type':Sequelize[_0xc99a('0x8')]},'queuecallerabandon':{'type':Sequelize[_0xc99a('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc99a('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc99a('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xc99a('0x1')],'comment':_0xc99a('0xa')},'originalposition':{'type':Sequelize[_0xc99a('0x8')]},'channel':{'type':Sequelize[_0xc99a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc99a('0x1')]},'connectedlinename':{'type':Sequelize[_0xc99a('0x1')]},'accountcode':{'type':Sequelize[_0xc99a('0x1')]},'context':{'type':Sequelize[_0xc99a('0x1')]},'exten':{'type':Sequelize[_0xc99a('0x1')]},'priority':{'type':Sequelize[_0xc99a('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc99a('0x1')]},'transfer':{'type':Sequelize[_0xc99a('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc99a('0x1')],'comment':_0xc99a('0xb')},'transferexten':{'type':Sequelize[_0xc99a('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc99a('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc99a('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xc99a('0x1')]}}; \ No newline at end of file +var _0x82e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x2566ee,_0x201011){var _0x2b7260=function(_0x3096ab){while(--_0x3096ab){_0x2566ee['push'](_0x2566ee['shift']());}};_0x2b7260(++_0x201011);}(_0x82e7,0xf8));var _0x782e=function(_0x4c0511,_0x23721f){_0x4c0511=_0x4c0511-0x0;var _0xd4e76b=_0x82e7[_0x4c0511];return _0xd4e76b;};'use strict';var Sequelize=require(_0x782e('0x0'));var moment=require(_0x782e('0x1'));module[_0x782e('0x2')]={'type':{'type':Sequelize[_0x782e('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x782e('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x782e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x782e('0x4')],'set':function(_0x2a0aa3){var _0x54f41d=moment(_0x2a0aa3);var _0xa7cc80=moment(this['getDataValue'](_0x782e('0x5')))[_0x782e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x12a5c1=_0x54f41d['diff'](_0xa7cc80,'seconds');this[_0x782e('0x7')](_0x782e('0x8'),_0x2a0aa3);this[_0x782e('0x7')](_0x782e('0x9'),_0x12a5c1||null);}},'position':{'type':Sequelize[_0x782e('0xa')]},'count':{'type':Sequelize[_0x782e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x782e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x782e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x782e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x782e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x782e('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x782e('0xa')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x782e('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x782e('0x3')]},'holdtime':{'type':Sequelize[_0x782e('0xa')]},'mohtime':{'type':Sequelize[_0x782e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x782e('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x782e('0x3')],'comment':_0x782e('0xc')},'transferexten':{'type':Sequelize[_0x782e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x782e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x782e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x782e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x782e('0xa')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 094623e..1ae0c3c 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 _0x9c6f=['type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','VoiceQueueReport','includeAll','include','findAll','catch','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','filter','rows','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName'];(function(_0x1a325d,_0x10fe61){var _0x481d1e=function(_0x2b9e21){while(--_0x2b9e21){_0x1a325d['push'](_0x1a325d['shift']());}};_0x481d1e(++_0x10fe61);}(_0x9c6f,0x1af));var _0xf9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf9c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9c6('0x2'));var moment=require(_0xf9c6('0x3'));var BPromise=require(_0xf9c6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf9c6('0x5'));var csv=require(_0xf9c6('0x6'));var ejs=require(_0xf9c6('0x7'));var fs=require('fs');var fs_extra=require(_0xf9c6('0x8'));var _=require(_0xf9c6('0x9'));var squel=require(_0xf9c6('0xa'));var crypto=require(_0xf9c6('0xb'));var jsforce=require(_0xf9c6('0xc'));var deskjs=require(_0xf9c6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf9c6('0xe'));var Redis=require(_0xf9c6('0xf'));var authService=require(_0xf9c6('0x10'));var qs=require(_0xf9c6('0x11'));var as=require(_0xf9c6('0x12'));var hardwareService=require(_0xf9c6('0x13'));var logger=require('../../config/logger')(_0xf9c6('0x14'));var utils=require('../../config/utils');var config=require(_0xf9c6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9c6('0x16'))['db'];config[_0xf9c6('0x17')]=_[_0xf9c6('0x18')](config[_0xf9c6('0x17')],{'host':_0xf9c6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf9c6('0x1a'))['register'](socket);function respondWithStatusCode(_0x7c80e8,_0x230a89){_0x230a89=_0x230a89||0xcc;return function(_0x4cb4a2){if(_0x4cb4a2){return _0x7c80e8[_0xf9c6('0x1b')](_0x230a89);}return _0x7c80e8['status'](_0x230a89)[_0xf9c6('0x1c')]();};}function respondWithResult(_0x33bd86,_0x27d902){_0x27d902=_0x27d902||0xc8;return function(_0x12fcd9){if(_0x12fcd9){return _0x33bd86[_0xf9c6('0x1d')](_0x27d902)[_0xf9c6('0x1e')](_0x12fcd9);}};}function respondWithFilteredResult(_0x50c620,_0x449726){return function(_0x22cd69){if(_0x22cd69){var _0x234c17=typeof _0x449726[_0xf9c6('0x1f')]===_0xf9c6('0x20')&&typeof _0x449726[_0xf9c6('0x21')]===_0xf9c6('0x20');var _0x3a524b=_0x22cd69[_0xf9c6('0x22')];var _0x190eaf=_0x234c17?0x0:_0x449726[_0xf9c6('0x1f')];var _0x10d775=_0x234c17?_0x22cd69[_0xf9c6('0x22')]:_0x449726[_0xf9c6('0x1f')]+_0x449726[_0xf9c6('0x21')];var _0x3618c1;if(_0x10d775>=_0x3a524b){_0x10d775=_0x3a524b;_0x3618c1=0xc8;}else{_0x3618c1=0xce;}_0x50c620['status'](_0x3618c1);return _0x50c620[_0xf9c6('0x23')](_0xf9c6('0x24'),_0x190eaf+'-'+_0x10d775+'/'+_0x3a524b)[_0xf9c6('0x1e')](_0x22cd69);}return null;};}function patchUpdates(_0x114545){return function(_0x12df15){try{jsonpatch[_0xf9c6('0x25')](_0x12df15,_0x114545,!![]);}catch(_0x1d45e1){return BPromise[_0xf9c6('0x26')](_0x1d45e1);}return _0x12df15[_0xf9c6('0x27')]();};}function saveUpdates(_0x164331,_0x59e6a1){return function(_0x4b6bdf){if(_0x4b6bdf){return _0x4b6bdf[_0xf9c6('0x28')](_0x164331)[_0xf9c6('0x29')](function(_0x5e4a48){return _0x5e4a48;});}return null;};}function removeEntity(_0x1012e1,_0x5bb07b){return function(_0x7c2df8){if(_0x7c2df8){return _0x7c2df8[_0xf9c6('0x2a')]()[_0xf9c6('0x29')](function(){_0x1012e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12d517,_0x45986d){return function(_0x43e658){if(!_0x43e658){_0x12d517['sendStatus'](0x194);}return _0x43e658;};}function handleError(_0x213006,_0x5eb074){_0x5eb074=_0x5eb074||0x1f4;return function(_0x88e1bf){logger['error'](_0x88e1bf[_0xf9c6('0x2b')]);if(_0x88e1bf[_0xf9c6('0x2c')]){delete _0x88e1bf['name'];}_0x213006[_0xf9c6('0x1d')](_0x5eb074)[_0xf9c6('0x2d')](_0x88e1bf);};}exports[_0xf9c6('0x2e')]=function(_0x500b5e,_0x1c3556){var _0x45b528={},_0x109cdb={},_0x566959={'count':0x0,'rows':[]};var _0x43aa1b=_['map'](db['VoiceQueueReport'][_0xf9c6('0x2f')],function(_0x5e6443){return{'name':_0x5e6443[_0xf9c6('0x30')],'type':_0x5e6443[_0xf9c6('0x31')]['key']};});_0x109cdb[_0xf9c6('0x32')]=_[_0xf9c6('0x33')](_0x43aa1b,_0xf9c6('0x2c'));_0x109cdb[_0xf9c6('0x34')]=_[_0xf9c6('0x35')](_0x500b5e['query']);_0x109cdb[_0xf9c6('0x36')]=_[_0xf9c6('0x37')](_0x109cdb[_0xf9c6('0x32')],_0x109cdb[_0xf9c6('0x34')]);_0x45b528[_0xf9c6('0x38')]=_['intersection'](_0x109cdb[_0xf9c6('0x32')],qs[_0xf9c6('0x39')](_0x500b5e['query'][_0xf9c6('0x39')]));_0x45b528[_0xf9c6('0x38')]=_0x45b528['attributes'][_0xf9c6('0x3a')]?_0x45b528[_0xf9c6('0x38')]:_0x109cdb[_0xf9c6('0x32')];if(!_0x500b5e['query']['hasOwnProperty'](_0xf9c6('0x3b'))){_0x45b528[_0xf9c6('0x21')]=qs[_0xf9c6('0x21')](_0x500b5e[_0xf9c6('0x34')][_0xf9c6('0x21')]);_0x45b528[_0xf9c6('0x1f')]=qs[_0xf9c6('0x1f')](_0x500b5e[_0xf9c6('0x34')][_0xf9c6('0x1f')]);}_0x45b528[_0xf9c6('0x3c')]=qs[_0xf9c6('0x3d')](_0x500b5e[_0xf9c6('0x34')][_0xf9c6('0x3d')]);_0x45b528[_0xf9c6('0x3e')]=qs[_0xf9c6('0x36')](_[_0xf9c6('0x3f')](_0x500b5e[_0xf9c6('0x34')],_0x109cdb[_0xf9c6('0x36')]),_0x43aa1b);if(_0x500b5e['query']['filter']){_0x45b528[_0xf9c6('0x3e')]=_['merge'](_0x45b528[_0xf9c6('0x3e')],{'$or':_[_0xf9c6('0x33')](_0x43aa1b,function(_0x147e89){if(_0x147e89['type']!=='VIRTUAL'){var _0x24aeca={};_0x24aeca[_0x147e89[_0xf9c6('0x2c')]]={'$like':'%'+_0x500b5e[_0xf9c6('0x34')]['filter']+'%'};return _0x24aeca;}})});}_0x45b528=_[_0xf9c6('0x40')]({},_0x45b528,_0x500b5e[_0xf9c6('0x41')]);var _0x3445a4={'where':_0x45b528['where']};return db[_0xf9c6('0x42')][_0xf9c6('0x22')](_0x3445a4)[_0xf9c6('0x29')](function(_0x13a250){_0x566959[_0xf9c6('0x22')]=_0x13a250;if(_0x500b5e[_0xf9c6('0x34')][_0xf9c6('0x43')]){_0x45b528[_0xf9c6('0x44')]=[{'all':!![]}];}return db[_0xf9c6('0x42')][_0xf9c6('0x45')](_0x45b528);})[_0xf9c6('0x29')](function(_0x445432){_0x566959['rows']=_0x445432;return _0x566959;})[_0xf9c6('0x29')](respondWithFilteredResult(_0x1c3556,_0x45b528))[_0xf9c6('0x46')](handleError(_0x1c3556,null));};exports['show']=function(_0x514066,_0x2cc178){var _0x26694c={'raw':![],'where':{'id':_0x514066[_0xf9c6('0x47')]['id']}},_0x20cec7={};_0x20cec7[_0xf9c6('0x32')]=_[_0xf9c6('0x35')](db[_0xf9c6('0x42')][_0xf9c6('0x2f')]);_0x20cec7[_0xf9c6('0x34')]=_[_0xf9c6('0x35')](_0x514066[_0xf9c6('0x34')]);_0x20cec7[_0xf9c6('0x36')]=_[_0xf9c6('0x37')](_0x20cec7['model'],_0x20cec7['query']);_0x26694c[_0xf9c6('0x38')]=_[_0xf9c6('0x37')](_0x20cec7[_0xf9c6('0x32')],qs[_0xf9c6('0x39')](_0x514066[_0xf9c6('0x34')][_0xf9c6('0x39')]));_0x26694c[_0xf9c6('0x38')]=_0x26694c['attributes'][_0xf9c6('0x3a')]?_0x26694c[_0xf9c6('0x38')]:_0x20cec7['model'];if(_0x514066[_0xf9c6('0x34')][_0xf9c6('0x43')]){_0x26694c[_0xf9c6('0x44')]=[{'all':!![]}];}_0x26694c=_[_0xf9c6('0x40')]({},_0x26694c,_0x514066[_0xf9c6('0x41')]);return db[_0xf9c6('0x42')][_0xf9c6('0x48')](_0x26694c)[_0xf9c6('0x29')](handleEntityNotFound(_0x2cc178,null))[_0xf9c6('0x29')](respondWithResult(_0x2cc178,null))[_0xf9c6('0x46')](handleError(_0x2cc178,null));};exports[_0xf9c6('0x49')]=function(_0x40ad64,_0x59a58f){return db[_0xf9c6('0x42')][_0xf9c6('0x49')](_0x40ad64[_0xf9c6('0x4a')],{})[_0xf9c6('0x29')](respondWithResult(_0x59a58f,0xc9))[_0xf9c6('0x46')](handleError(_0x59a58f,null));};exports[_0xf9c6('0x28')]=function(_0x2a9651,_0x1f5038){if(_0x2a9651[_0xf9c6('0x4a')]['id']){delete _0x2a9651['body']['id'];}return db['VoiceQueueReport'][_0xf9c6('0x48')]({'where':{'id':_0x2a9651[_0xf9c6('0x47')]['id']}})[_0xf9c6('0x29')](handleEntityNotFound(_0x1f5038,null))[_0xf9c6('0x29')](saveUpdates(_0x2a9651['body'],null))['then'](respondWithResult(_0x1f5038,null))['catch'](handleError(_0x1f5038,null));};exports[_0xf9c6('0x2a')]=function(_0xd40197,_0x276528){return db[_0xf9c6('0x42')]['find']({'where':{'id':_0xd40197[_0xf9c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x276528,null))[_0xf9c6('0x29')](removeEntity(_0x276528,null))[_0xf9c6('0x46')](handleError(_0x276528,null));};exports[_0xf9c6('0x4b')]=function(_0x115866,_0x2aed88){return db[_0xf9c6('0x42')][_0xf9c6('0x4b')]()[_0xf9c6('0x29')](respondWithResult(_0x2aed88,null))[_0xf9c6('0x46')](handleError(_0x2aed88,null));};exports[_0xf9c6('0x4c')]=function(_0x51246e,_0x1c9836){var _0x17a473={},_0x683bba={},_0x377f4b={'count':0x0,'rows':[]};_0x683bba[_0xf9c6('0x32')]=_[_0xf9c6('0x35')](db[_0xf9c6('0x42')][_0xf9c6('0x2f')]);_0x683bba[_0xf9c6('0x34')]=_[_0xf9c6('0x35')](_0x51246e[_0xf9c6('0x34')]);_0x683bba[_0xf9c6('0x36')]=_['intersection'](_0x683bba[_0xf9c6('0x32')],_0x683bba[_0xf9c6('0x34')]);_0x17a473[_0xf9c6('0x38')]=_[_0xf9c6('0x37')](_0x683bba[_0xf9c6('0x32')],qs[_0xf9c6('0x39')](_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x39')]));_0x17a473[_0xf9c6('0x38')]=_0x17a473[_0xf9c6('0x38')][_0xf9c6('0x3a')]?_0x17a473['attributes']:_0x683bba['model'];if(!_0x51246e['query'][_0xf9c6('0x4d')]('nolimit')){_0x17a473[_0xf9c6('0x21')]=qs['limit'](_0x51246e['query']['limit']);_0x17a473[_0xf9c6('0x1f')]=qs[_0xf9c6('0x1f')](_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x1f')]);}_0x17a473['order']=qs['sort'](_0x51246e['query'][_0xf9c6('0x3d')]);_0x17a473[_0xf9c6('0x3e')]=qs['filters'](_['pick'](_0x51246e['query'],_0x683bba[_0xf9c6('0x36')]));if(_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x4e')]){_0x17a473[_0xf9c6('0x3e')]=_['merge'](_0x17a473[_0xf9c6('0x3e')],{'$or':_[_0xf9c6('0x33')](_0x17a473['attributes'],function(_0x3aa64c){var _0xedd4ee={};_0xedd4ee[_0x3aa64c]={'$like':'%'+_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x4e')]+'%'};return _0xedd4ee;})});}_0x17a473=_['merge']({},_0x17a473,_0x51246e['options']);var _0x25b767={'where':_0x17a473['where']};return db[_0xf9c6('0x42')][_0xf9c6('0x22')](_0x25b767)[_0xf9c6('0x29')](function(_0x415daa){_0x377f4b[_0xf9c6('0x22')]=_0x415daa;if(_0x51246e[_0xf9c6('0x34')][_0xf9c6('0x43')]){_0x17a473[_0xf9c6('0x44')]=[{'all':!![]}];}return db[_0xf9c6('0x42')]['findAll'](_0x17a473);})['then'](function(_0x4e1136){_0x377f4b[_0xf9c6('0x4f')]=_0x4e1136;return _0x377f4b;})['then'](respondWithFilteredResult(_0x1c9836,_0x17a473,_0xf9c6('0x4c')))[_0xf9c6('0x46')](handleError(_0x1c9836,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xa72d=['redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','stack','name','send','map','VoiceQueueReport','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','rawAttributes','intersection','includeAll','find','create','body','update','params','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5ec21d,_0x5d0772){var _0x43bde8=function(_0x1bfc7c){while(--_0x1bfc7c){_0x5ec21d['push'](_0x5ec21d['shift']());}};_0x43bde8(++_0x5d0772);}(_0xa72d,0x88));var _0xda72=function(_0x59507a,_0x551f4d){_0x59507a=_0x59507a-0x0;var _0x1484cc=_0xa72d[_0x59507a];return _0x1484cc;};'use strict';var emlformat=require(_0xda72('0x0'));var rimraf=require(_0xda72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda72('0x2'));var rp=require(_0xda72('0x3'));var moment=require('moment');var BPromise=require(_0xda72('0x4'));var Mustache=require(_0xda72('0x5'));var util=require(_0xda72('0x6'));var path=require(_0xda72('0x7'));var sox=require('sox');var csv=require(_0xda72('0x8'));var ejs=require(_0xda72('0x9'));var fs=require('fs');var fs_extra=require(_0xda72('0xa'));var _=require(_0xda72('0xb'));var squel=require(_0xda72('0xc'));var crypto=require(_0xda72('0xd'));var jsforce=require(_0xda72('0xe'));var deskjs=require(_0xda72('0xf'));var toCsv=require(_0xda72('0x8'));var querystring=require('querystring');var Papa=require(_0xda72('0x10'));var Redis=require(_0xda72('0x11'));var authService=require(_0xda72('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xda72('0x13'));var hardwareService=require(_0xda72('0x14'));var logger=require('../../config/logger')(_0xda72('0x15'));var utils=require(_0xda72('0x16'));var config=require(_0xda72('0x17'));var licenseUtil=require(_0xda72('0x18'));var db=require(_0xda72('0x19'))['db'];config[_0xda72('0x1a')]=_['defaults'](config[_0xda72('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xda72('0x1b'))(new Redis(config['redis']));require(_0xda72('0x1c'))[_0xda72('0x1d')](socket);function respondWithStatusCode(_0x3fa167,_0x2f02e3){_0x2f02e3=_0x2f02e3||0xcc;return function(_0x4a96dd){if(_0x4a96dd){return _0x3fa167[_0xda72('0x1e')](_0x2f02e3);}return _0x3fa167[_0xda72('0x1f')](_0x2f02e3)[_0xda72('0x20')]();};}function respondWithResult(_0x44fc29,_0x4ddc10){_0x4ddc10=_0x4ddc10||0xc8;return function(_0x46d37f){if(_0x46d37f){return _0x44fc29[_0xda72('0x1f')](_0x4ddc10)[_0xda72('0x21')](_0x46d37f);}};}function respondWithFilteredResult(_0x19fe2a,_0xa41224){return function(_0x297c58){if(_0x297c58){var _0x195629=typeof _0xa41224[_0xda72('0x22')]===_0xda72('0x23')&&typeof _0xa41224[_0xda72('0x24')]==='undefined';var _0x464e6f=_0x297c58[_0xda72('0x25')];var _0x517413=_0x195629?0x0:_0xa41224['offset'];var _0x8933e5=_0x195629?_0x297c58[_0xda72('0x25')]:_0xa41224[_0xda72('0x22')]+_0xa41224[_0xda72('0x24')];var _0x1ec11e;if(_0x8933e5>=_0x464e6f){_0x8933e5=_0x464e6f;_0x1ec11e=0xc8;}else{_0x1ec11e=0xce;}_0x19fe2a['status'](_0x1ec11e);return _0x19fe2a['set'](_0xda72('0x26'),_0x517413+'-'+_0x8933e5+'/'+_0x464e6f)[_0xda72('0x21')](_0x297c58);}return null;};}function patchUpdates(_0x120fd1){return function(_0x24f3c3){try{jsonpatch['apply'](_0x24f3c3,_0x120fd1,!![]);}catch(_0x361716){return BPromise[_0xda72('0x27')](_0x361716);}return _0x24f3c3[_0xda72('0x28')]();};}function saveUpdates(_0x1d4889,_0x51e6df){return function(_0x22ace1){if(_0x22ace1){return _0x22ace1['update'](_0x1d4889)[_0xda72('0x29')](function(_0x4d1be0){return _0x4d1be0;});}return null;};}function removeEntity(_0x242c2d,_0x480595){return function(_0x53cfc1){if(_0x53cfc1){return _0x53cfc1[_0xda72('0x2a')]()['then'](function(){_0x242c2d['status'](0xcc)[_0xda72('0x20')]();});}};}function handleEntityNotFound(_0x252e4b,_0xe9b3ae){return function(_0xde902){if(!_0xde902){_0x252e4b[_0xda72('0x1e')](0x194);}return _0xde902;};}function handleError(_0x38cc30,_0x2dd41e){_0x2dd41e=_0x2dd41e||0x1f4;return function(_0x45febe){logger['error'](_0x45febe[_0xda72('0x2b')]);if(_0x45febe[_0xda72('0x2c')]){delete _0x45febe[_0xda72('0x2c')];}_0x38cc30[_0xda72('0x1f')](_0x2dd41e)[_0xda72('0x2d')](_0x45febe);};}exports['index']=function(_0x560d38,_0x23bc4e){var _0x38ec14={},_0xd31fb1={},_0x5b62d1={'count':0x0,'rows':[]};var _0x212289=_[_0xda72('0x2e')](db[_0xda72('0x2f')]['rawAttributes'],function(_0x5a0225){return{'name':_0x5a0225[_0xda72('0x30')],'type':_0x5a0225['type']['key']};});_0xd31fb1[_0xda72('0x31')]=_[_0xda72('0x2e')](_0x212289,'name');_0xd31fb1[_0xda72('0x32')]=_[_0xda72('0x33')](_0x560d38[_0xda72('0x32')]);_0xd31fb1[_0xda72('0x34')]=_['intersection'](_0xd31fb1[_0xda72('0x31')],_0xd31fb1[_0xda72('0x32')]);_0x38ec14['attributes']=_['intersection'](_0xd31fb1['model'],qs[_0xda72('0x35')](_0x560d38[_0xda72('0x32')]['fields']));_0x38ec14[_0xda72('0x36')]=_0x38ec14[_0xda72('0x36')][_0xda72('0x37')]?_0x38ec14[_0xda72('0x36')]:_0xd31fb1[_0xda72('0x31')];if(!_0x560d38[_0xda72('0x32')][_0xda72('0x38')](_0xda72('0x39'))){_0x38ec14[_0xda72('0x24')]=qs[_0xda72('0x24')](_0x560d38[_0xda72('0x32')][_0xda72('0x24')]);_0x38ec14[_0xda72('0x22')]=qs[_0xda72('0x22')](_0x560d38[_0xda72('0x32')]['offset']);}_0x38ec14[_0xda72('0x3a')]=qs[_0xda72('0x3b')](_0x560d38['query'][_0xda72('0x3b')]);_0x38ec14[_0xda72('0x3c')]=qs[_0xda72('0x34')](_[_0xda72('0x3d')](_0x560d38[_0xda72('0x32')],_0xd31fb1['filters']),_0x212289);if(_0x560d38[_0xda72('0x32')][_0xda72('0x3e')]){_0x38ec14[_0xda72('0x3c')]=_[_0xda72('0x3f')](_0x38ec14['where'],{'$or':_[_0xda72('0x2e')](_0x212289,function(_0x58494){if(_0x58494[_0xda72('0x40')]!=='VIRTUAL'){var _0xc9a417={};_0xc9a417[_0x58494[_0xda72('0x2c')]]={'$like':'%'+_0x560d38[_0xda72('0x32')]['filter']+'%'};return _0xc9a417;}})});}_0x38ec14=_[_0xda72('0x3f')]({},_0x38ec14,_0x560d38[_0xda72('0x41')]);var _0x31fec6={'where':_0x38ec14[_0xda72('0x3c')]};return db[_0xda72('0x2f')][_0xda72('0x25')](_0x31fec6)[_0xda72('0x29')](function(_0xca24a){_0x5b62d1['count']=_0xca24a;if(_0x560d38[_0xda72('0x32')]['includeAll']){_0x38ec14[_0xda72('0x42')]=[{'all':!![]}];}return db[_0xda72('0x2f')][_0xda72('0x43')](_0x38ec14);})[_0xda72('0x29')](function(_0x4a1256){_0x5b62d1[_0xda72('0x44')]=_0x4a1256;return _0x5b62d1;})[_0xda72('0x29')](respondWithFilteredResult(_0x23bc4e,_0x38ec14))[_0xda72('0x45')](handleError(_0x23bc4e,null));};exports[_0xda72('0x46')]=function(_0x1633af,_0x5cdc66){var _0x49ba33={'raw':![],'where':{'id':_0x1633af['params']['id']}},_0x10ab3f={};_0x10ab3f[_0xda72('0x31')]=_[_0xda72('0x33')](db[_0xda72('0x2f')][_0xda72('0x47')]);_0x10ab3f['query']=_[_0xda72('0x33')](_0x1633af[_0xda72('0x32')]);_0x10ab3f[_0xda72('0x34')]=_[_0xda72('0x48')](_0x10ab3f[_0xda72('0x31')],_0x10ab3f['query']);_0x49ba33[_0xda72('0x36')]=_[_0xda72('0x48')](_0x10ab3f[_0xda72('0x31')],qs['fields'](_0x1633af[_0xda72('0x32')][_0xda72('0x35')]));_0x49ba33[_0xda72('0x36')]=_0x49ba33['attributes'][_0xda72('0x37')]?_0x49ba33[_0xda72('0x36')]:_0x10ab3f['model'];if(_0x1633af[_0xda72('0x32')][_0xda72('0x49')]){_0x49ba33[_0xda72('0x42')]=[{'all':!![]}];}_0x49ba33=_['merge']({},_0x49ba33,_0x1633af[_0xda72('0x41')]);return db[_0xda72('0x2f')][_0xda72('0x4a')](_0x49ba33)[_0xda72('0x29')](handleEntityNotFound(_0x5cdc66,null))[_0xda72('0x29')](respondWithResult(_0x5cdc66,null))[_0xda72('0x45')](handleError(_0x5cdc66,null));};exports[_0xda72('0x4b')]=function(_0x54ce92,_0x264e1f){return db[_0xda72('0x2f')]['create'](_0x54ce92[_0xda72('0x4c')],{})[_0xda72('0x29')](respondWithResult(_0x264e1f,0xc9))[_0xda72('0x45')](handleError(_0x264e1f,null));};exports[_0xda72('0x4d')]=function(_0x3bc45b,_0x5526c4){if(_0x3bc45b[_0xda72('0x4c')]['id']){delete _0x3bc45b[_0xda72('0x4c')]['id'];}return db[_0xda72('0x2f')]['find']({'where':{'id':_0x3bc45b['params']['id']}})[_0xda72('0x29')](handleEntityNotFound(_0x5526c4,null))[_0xda72('0x29')](saveUpdates(_0x3bc45b[_0xda72('0x4c')],null))[_0xda72('0x29')](respondWithResult(_0x5526c4,null))['catch'](handleError(_0x5526c4,null));};exports[_0xda72('0x2a')]=function(_0x560e1e,_0x81bcc9){return db['VoiceQueueReport']['find']({'where':{'id':_0x560e1e[_0xda72('0x4e')]['id']}})[_0xda72('0x29')](handleEntityNotFound(_0x81bcc9,null))[_0xda72('0x29')](removeEntity(_0x81bcc9,null))['catch'](handleError(_0x81bcc9,null));};exports[_0xda72('0x4f')]=function(_0x2e35f8,_0x363d88){return db['VoiceQueueReport'][_0xda72('0x4f')]()[_0xda72('0x29')](respondWithResult(_0x363d88,null))[_0xda72('0x45')](handleError(_0x363d88,null));};exports[_0xda72('0x50')]=function(_0x5dad5d,_0x42ac3b){var _0x3dc802={},_0x4cb87d={},_0x42b411={'count':0x0,'rows':[]};_0x4cb87d[_0xda72('0x31')]=_['keys'](db[_0xda72('0x2f')]['rawAttributes']);_0x4cb87d[_0xda72('0x32')]=_[_0xda72('0x33')](_0x5dad5d[_0xda72('0x32')]);_0x4cb87d[_0xda72('0x34')]=_[_0xda72('0x48')](_0x4cb87d[_0xda72('0x31')],_0x4cb87d['query']);_0x3dc802[_0xda72('0x36')]=_[_0xda72('0x48')](_0x4cb87d['model'],qs[_0xda72('0x35')](_0x5dad5d[_0xda72('0x32')]['fields']));_0x3dc802[_0xda72('0x36')]=_0x3dc802[_0xda72('0x36')][_0xda72('0x37')]?_0x3dc802[_0xda72('0x36')]:_0x4cb87d['model'];if(!_0x5dad5d['query'][_0xda72('0x38')](_0xda72('0x39'))){_0x3dc802[_0xda72('0x24')]=qs[_0xda72('0x24')](_0x5dad5d[_0xda72('0x32')]['limit']);_0x3dc802[_0xda72('0x22')]=qs[_0xda72('0x22')](_0x5dad5d[_0xda72('0x32')]['offset']);}_0x3dc802['order']=qs[_0xda72('0x3b')](_0x5dad5d[_0xda72('0x32')][_0xda72('0x3b')]);_0x3dc802[_0xda72('0x3c')]=qs['filters'](_['pick'](_0x5dad5d[_0xda72('0x32')],_0x4cb87d[_0xda72('0x34')]));if(_0x5dad5d[_0xda72('0x32')][_0xda72('0x3e')]){_0x3dc802[_0xda72('0x3c')]=_[_0xda72('0x3f')](_0x3dc802['where'],{'$or':_[_0xda72('0x2e')](_0x3dc802[_0xda72('0x36')],function(_0x25cf06){var _0x3cb82d={};_0x3cb82d[_0x25cf06]={'$like':'%'+_0x5dad5d[_0xda72('0x32')][_0xda72('0x3e')]+'%'};return _0x3cb82d;})});}_0x3dc802=_['merge']({},_0x3dc802,_0x5dad5d[_0xda72('0x41')]);var _0x26f47f={'where':_0x3dc802['where']};return db[_0xda72('0x2f')]['count'](_0x26f47f)[_0xda72('0x29')](function(_0x503597){_0x42b411[_0xda72('0x25')]=_0x503597;if(_0x5dad5d[_0xda72('0x32')][_0xda72('0x49')]){_0x3dc802['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x3dc802);})[_0xda72('0x29')](function(_0x39e4e8){_0x42b411[_0xda72('0x44')]=_0x39e4e8;return _0x42b411;})[_0xda72('0x29')](respondWithFilteredResult(_0x42ac3b,_0x3dc802,_0xda72('0x50')))[_0xda72('0x45')](handleError(_0x42ac3b,null,_0xda72('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 17b499b..a6e1d0a 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 _0xfe78=['events','VoiceQueueReport','setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x2af782,_0x1e8532){var _0x4f2ea6=function(_0x40ed58){while(--_0x40ed58){_0x2af782['push'](_0x2af782['shift']());}};_0x4f2ea6(++_0x1e8532);}(_0xfe78,0x90));var _0x8fe7=function(_0xb604d9,_0x2ca058){_0xb604d9=_0xb604d9-0x0;var _0x2c7828=_0xfe78[_0xb604d9];return _0x2c7828;};'use strict';var EventEmitter=require(_0x8fe7('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x8fe7('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8fe7('0x2')](0x0);var events={'afterCreate':_0x8fe7('0x3'),'afterUpdate':_0x8fe7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bc072){return function(_0x109487,_0x52f633,_0x240539){VoiceQueueReportEvents['emit'](_0x4bc072+':'+_0x109487['id'],_0x109487);VoiceQueueReportEvents['emit'](_0x4bc072,_0x109487);_0x240539(null);};}for(var e in events){if(events[_0x8fe7('0x5')](e)){var event=events[e];VoiceQueueReport[_0x8fe7('0x6')](e,emitEvent(event));}}module[_0x8fe7('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x5025=['exports','events','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3f36ab,_0x14d3d2){var _0x4e9cf2=function(_0xf0b3cf){while(--_0xf0b3cf){_0x3f36ab['push'](_0x3f36ab['shift']());}};_0x4e9cf2(++_0x14d3d2);}(_0x5025,0x119));var _0x5502=function(_0xec722a,_0x354472){_0xec722a=_0xec722a-0x0;var _0xbb0f9e=_0x5025[_0xec722a];return _0xbb0f9e;};'use strict';var EventEmitter=require(_0x5502('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5502('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5502('0x2'),'afterDestroy':_0x5502('0x3')};function emitEvent(_0x1043a1){return function(_0x32a996,_0x15ae47,_0x1c9bb0){VoiceQueueReportEvents[_0x5502('0x4')](_0x1043a1+':'+_0x32a996['id'],_0x32a996);VoiceQueueReportEvents[_0x5502('0x4')](_0x1043a1,_0x32a996);_0x1c9bb0(null);};}for(var e in events){if(events[_0x5502('0x5')](e)){var event=events[e];VoiceQueueReport[_0x5502('0x6')](e,emitEvent(event));}}module[_0x5502('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 1969001..055fc18 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 _0x72b3=['bluebird','request-promise','path','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','api','moment'];(function(_0x197174,_0x54f21c){var _0x1978b7=function(_0x4a54c9){while(--_0x4a54c9){_0x197174['push'](_0x197174['shift']());}};_0x1978b7(++_0x54f21c);}(_0x72b3,0x1aa));var _0x372b=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x72b3[_0x2bfe52];return _0x1cf649;};'use strict';var _=require(_0x372b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x372b('0x1'));var moment=require(_0x372b('0x2'));var BPromise=require(_0x372b('0x3'));var rp=require(_0x372b('0x4'));var fs=require('fs');var path=require(_0x372b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x372b('0x6')]=function(_0x50a3c0,_0x49e115){return _0x50a3c0['define'](_0x372b('0x7'),attributes,{'tableName':_0x372b('0x8'),'paranoid':![],'indexes':[{'fields':[_0x372b('0x9')]},{'fields':[_0x372b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9750=['moment','bluebird','rimraf','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','../../config/logger'];(function(_0x3b5d1e,_0x4d5b30){var _0x194f5b=function(_0x1891ce){while(--_0x1891ce){_0x3b5d1e['push'](_0x3b5d1e['shift']());}};_0x194f5b(++_0x4d5b30);}(_0x9750,0xe5));var _0x0975=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9750[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0975('0x0'))('api');var moment=require(_0x0975('0x1'));var BPromise=require(_0x0975('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0975('0x3'));var config=require('../../config/environment');var attributes=require(_0x0975('0x4'));module['exports']=function(_0x1c9786,_0x2b2b49){return _0x1c9786[_0x0975('0x5')](_0x0975('0x6'),attributes,{'tableName':_0x0975('0x7'),'paranoid':![],'indexes':[{'fields':[_0x0975('0x8')]},{'fields':[_0x0975('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 9b8d429..f42471b 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 _0x92ba=['attributes','include','map','model','info','catch','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','body','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92ba,0xaa));var _0xa92b=function(_0x40bf47,_0x56966){_0x40bf47=_0x40bf47-0x0;var _0x311180=_0x92ba[_0x40bf47];return _0x311180;};'use strict';var _=require(_0xa92b('0x0'));var util=require('util');var moment=require(_0xa92b('0x1'));var BPromise=require(_0xa92b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa92b('0x3'))['db'];var utils=require(_0xa92b('0x4'));var logger=require(_0xa92b('0x5'))(_0xa92b('0x6'));var config=require(_0xa92b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa92b('0x8')][_0xa92b('0x9')]({'port':0x232a});config[_0xa92b('0xa')]=_[_0xa92b('0xb')](config['redis'],{'host':_0xa92b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa92b('0xa')]));require(_0xa92b('0xd'))[_0xa92b('0xe')](socket);function respondWithRpcPromise(_0x5681d3,_0x3cd748,_0x469dc2){return new BPromise(function(_0x2ca693,_0x29e7af){return client[_0xa92b('0xf')](_0x5681d3,_0x469dc2)[_0xa92b('0x10')](function(_0x1f0199){logger['info'](_0xa92b('0x11'),_0x3cd748,_0xa92b('0x12'));logger[_0xa92b('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x3cd748,'request\x20sent',JSON[_0xa92b('0x14')](_0x1f0199));if(_0x1f0199[_0xa92b('0x15')]){if(_0x1f0199[_0xa92b('0x15')][_0xa92b('0x16')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x3cd748,_0x1f0199[_0xa92b('0x15')][_0xa92b('0x17')]);return _0x29e7af(_0x1f0199[_0xa92b('0x15')][_0xa92b('0x17')]);}logger[_0xa92b('0x15')](_0xa92b('0x11'),_0x3cd748,_0x1f0199[_0xa92b('0x15')][_0xa92b('0x17')]);return _0x2ca693(_0x1f0199[_0xa92b('0x15')][_0xa92b('0x17')]);}else{logger['info'](_0xa92b('0x11'),_0x3cd748,_0xa92b('0x12'));_0x2ca693(_0x1f0199[_0xa92b('0x18')][_0xa92b('0x17')]);}})['catch'](function(_0x18b6c7){logger[_0xa92b('0x15')](_0xa92b('0x11'),_0x3cd748,_0x18b6c7);_0x29e7af(_0x18b6c7);});});}exports[_0xa92b('0x19')]=function(_0x4c96c9){var _0x47dfbb=this;return new Promise(function(_0x559bcd,_0x579c80){return db[_0xa92b('0x1a')]['findAll']({'raw':_0x4c96c9[_0xa92b('0x1b')]?_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c96c9['options']?_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1d')]||null:null,'attributes':_0x4c96c9[_0xa92b('0x1b')]?_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1e')]||null:null,'limit':_0x4c96c9[_0xa92b('0x1b')]?_0x4c96c9[_0xa92b('0x1b')]['limit']||null:null,'include':_0x4c96c9['options']?_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1f')]?_[_0xa92b('0x20')](_0x4c96c9[_0xa92b('0x1b')][_0xa92b('0x1f')],function(_0x239f82){return{'model':db[_0x239f82[_0xa92b('0x21')]],'as':_0x239f82['as'],'attributes':_0x239f82[_0xa92b('0x1e')],'include':_0x239f82[_0xa92b('0x1f')]?_[_0xa92b('0x20')](_0x239f82[_0xa92b('0x1f')],function(_0x85008c){return{'model':db[_0x85008c[_0xa92b('0x21')]],'as':_0x85008c['as'],'attributes':_0x85008c['attributes'],'include':_0x85008c[_0xa92b('0x1f')]?_['map'](_0x85008c[_0xa92b('0x1f')],function(_0x132882){return{'model':db[_0x132882[_0xa92b('0x21')]],'as':_0x132882['as'],'attributes':_0x132882['attributes']};}):[]};}):[]};}):[]:[]})[_0xa92b('0x10')](function(_0x45038a){logger[_0xa92b('0x22')](_0xa92b('0x19'),_0x4c96c9);logger['debug'](_0xa92b('0x19'),_0x4c96c9,JSON[_0xa92b('0x14')](_0x45038a));_0x559bcd(_0x45038a);})[_0xa92b('0x23')](function(_0x312b2d){logger[_0xa92b('0x15')](_0xa92b('0x19'),_0x312b2d['message'],_0x4c96c9);_0x579c80(_0x47dfbb[_0xa92b('0x15')](0x1f4,_0x312b2d[_0xa92b('0x17')]));});});};exports[_0xa92b('0x24')]=function(_0x3a4400){var _0x550ab2=this;return new Promise(function(_0x346931,_0x467a60){return db[_0xa92b('0x1a')][_0xa92b('0x25')](_0x3a4400['body'],{'raw':_0x3a4400[_0xa92b('0x1b')]?_0x3a4400['options'][_0xa92b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3fe4b4){logger[_0xa92b('0x22')](_0xa92b('0x24'),_0x3a4400);logger[_0xa92b('0x13')](_0xa92b('0x24'),_0x3a4400,JSON[_0xa92b('0x14')](_0x3fe4b4));_0x346931(_0x3fe4b4);})['catch'](function(_0x29389a){logger[_0xa92b('0x15')](_0xa92b('0x24'),_0x29389a['message'],_0x3a4400);_0x467a60(_0x550ab2['error'](0x1f4,_0x29389a['message']));});});};exports[_0xa92b('0x26')]=function(_0x4f57a2){var _0x4ccf40=this;return new Promise(function(_0x42a371,_0x3713d5){return db['VoiceQueueReport']['update'](_0x4f57a2[_0xa92b('0x27')],{'raw':_0x4f57a2[_0xa92b('0x1b')]?_0x4f57a2[_0xa92b('0x1b')][_0xa92b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f57a2[_0xa92b('0x1b')]?_0x4f57a2[_0xa92b('0x1b')][_0xa92b('0x1d')]||null:null,'attributes':_0x4f57a2[_0xa92b('0x1b')]?_0x4f57a2['options'][_0xa92b('0x1e')]||null:null,'limit':_0x4f57a2[_0xa92b('0x1b')]?_0x4f57a2[_0xa92b('0x1b')]['limit']||null:null})[_0xa92b('0x10')](function(_0x3c5452){logger[_0xa92b('0x22')](_0xa92b('0x26'),_0x4f57a2);logger[_0xa92b('0x13')](_0xa92b('0x26'),_0x4f57a2,JSON['stringify'](_0x3c5452));_0x42a371(_0x3c5452);})[_0xa92b('0x23')](function(_0x43b6b1){logger['error'](_0xa92b('0x26'),_0x43b6b1[_0xa92b('0x17')],_0x4f57a2);_0x3713d5(_0x4ccf40['error'](0x1f4,_0x43b6b1[_0xa92b('0x17')]));});});}; \ No newline at end of file +var _0xceb1=['map','debug','catch','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','where','then','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','request','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','model'];(function(_0x5caeb0,_0x2692f3){var _0x3b561c=function(_0xa48224){while(--_0xa48224){_0x5caeb0['push'](_0x5caeb0['shift']());}};_0x3b561c(++_0x2692f3);}(_0xceb1,0x100));var _0x1ceb=function(_0x26ab71,_0x2819da){_0x26ab71=_0x26ab71-0x0;var _0x363770=_0xceb1[_0x26ab71];return _0x363770;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1ceb('0x0'));var rs=require(_0x1ceb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ceb('0x2'))['db'];var utils=require(_0x1ceb('0x3'));var logger=require(_0x1ceb('0x4'))(_0x1ceb('0x5'));var config=require(_0x1ceb('0x6'));var jayson=require(_0x1ceb('0x7'));var client=jayson[_0x1ceb('0x8')]['http']({'port':0x232a});config['redis']=_[_0x1ceb('0x9')](config[_0x1ceb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ceb('0xb'))(new Redis(config[_0x1ceb('0xa')]));require(_0x1ceb('0xc'))['register'](socket);function respondWithRpcPromise(_0x452de7,_0x4050dc,_0x41f102){return new BPromise(function(_0x377371,_0x573ab4){return client[_0x1ceb('0xd')](_0x452de7,_0x41f102)['then'](function(_0x406a52){logger[_0x1ceb('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x4050dc,_0x1ceb('0xf'));logger['debug'](_0x1ceb('0x10'),_0x4050dc,_0x1ceb('0xf'),JSON[_0x1ceb('0x11')](_0x406a52));if(_0x406a52[_0x1ceb('0x12')]){if(_0x406a52[_0x1ceb('0x12')]['code']===0x1f4){logger['error'](_0x1ceb('0x13'),_0x4050dc,_0x406a52[_0x1ceb('0x12')][_0x1ceb('0x14')]);return _0x573ab4(_0x406a52[_0x1ceb('0x12')]['message']);}logger[_0x1ceb('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x4050dc,_0x406a52[_0x1ceb('0x12')][_0x1ceb('0x14')]);return _0x377371(_0x406a52[_0x1ceb('0x12')][_0x1ceb('0x14')]);}else{logger[_0x1ceb('0xe')](_0x1ceb('0x13'),_0x4050dc,_0x1ceb('0xf'));_0x377371(_0x406a52[_0x1ceb('0x15')][_0x1ceb('0x14')]);}})['catch'](function(_0x3e5343){logger['error'](_0x1ceb('0x13'),_0x4050dc,_0x3e5343);_0x573ab4(_0x3e5343);});});}exports[_0x1ceb('0x16')]=function(_0x3ce9cf){var _0x500717=this;return new Promise(function(_0x366945,_0x557cca){return db[_0x1ceb('0x17')][_0x1ceb('0x18')]({'raw':_0x3ce9cf[_0x1ceb('0x19')]?_0x3ce9cf[_0x1ceb('0x19')][_0x1ceb('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ce9cf[_0x1ceb('0x19')]?_0x3ce9cf['options']['where']||null:null,'attributes':_0x3ce9cf[_0x1ceb('0x19')]?_0x3ce9cf[_0x1ceb('0x19')][_0x1ceb('0x1b')]||null:null,'limit':_0x3ce9cf[_0x1ceb('0x19')]?_0x3ce9cf[_0x1ceb('0x19')][_0x1ceb('0x1c')]||null:null,'include':_0x3ce9cf[_0x1ceb('0x19')]?_0x3ce9cf[_0x1ceb('0x19')][_0x1ceb('0x1d')]?_['map'](_0x3ce9cf[_0x1ceb('0x19')][_0x1ceb('0x1d')],function(_0x49dea5){return{'model':db[_0x49dea5[_0x1ceb('0x1e')]],'as':_0x49dea5['as'],'attributes':_0x49dea5[_0x1ceb('0x1b')],'include':_0x49dea5['include']?_[_0x1ceb('0x1f')](_0x49dea5[_0x1ceb('0x1d')],function(_0x17f5a0){return{'model':db[_0x17f5a0[_0x1ceb('0x1e')]],'as':_0x17f5a0['as'],'attributes':_0x17f5a0['attributes'],'include':_0x17f5a0['include']?_[_0x1ceb('0x1f')](_0x17f5a0['include'],function(_0xe8aaff){return{'model':db[_0xe8aaff[_0x1ceb('0x1e')]],'as':_0xe8aaff['as'],'attributes':_0xe8aaff['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf68e61){logger[_0x1ceb('0xe')](_0x1ceb('0x16'),_0x3ce9cf);logger[_0x1ceb('0x20')](_0x1ceb('0x16'),_0x3ce9cf,JSON[_0x1ceb('0x11')](_0xf68e61));_0x366945(_0xf68e61);})[_0x1ceb('0x21')](function(_0x1fae47){logger['error'](_0x1ceb('0x16'),_0x1fae47[_0x1ceb('0x14')],_0x3ce9cf);_0x557cca(_0x500717['error'](0x1f4,_0x1fae47[_0x1ceb('0x14')]));});});};exports[_0x1ceb('0x22')]=function(_0x54c56d){var _0x3b0ec4=this;return new Promise(function(_0x259246,_0x178c4a){return db[_0x1ceb('0x17')][_0x1ceb('0x23')](_0x54c56d['body'],{'raw':_0x54c56d[_0x1ceb('0x19')]?_0x54c56d[_0x1ceb('0x19')][_0x1ceb('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x193d9a){logger['info'](_0x1ceb('0x22'),_0x54c56d);logger[_0x1ceb('0x20')]('CreateVoiceQueueReport',_0x54c56d,JSON['stringify'](_0x193d9a));_0x259246(_0x193d9a);})['catch'](function(_0x4b107e){logger[_0x1ceb('0x12')](_0x1ceb('0x22'),_0x4b107e[_0x1ceb('0x14')],_0x54c56d);_0x178c4a(_0x3b0ec4['error'](0x1f4,_0x4b107e[_0x1ceb('0x14')]));});});};exports[_0x1ceb('0x24')]=function(_0x9feb63){var _0x4c00aa=this;return new Promise(function(_0xdca50,_0x4b805f){return db[_0x1ceb('0x17')][_0x1ceb('0x25')](_0x9feb63[_0x1ceb('0x26')],{'raw':_0x9feb63['options']?_0x9feb63[_0x1ceb('0x19')][_0x1ceb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9feb63[_0x1ceb('0x19')]?_0x9feb63[_0x1ceb('0x19')][_0x1ceb('0x27')]||null:null,'attributes':_0x9feb63[_0x1ceb('0x19')]?_0x9feb63[_0x1ceb('0x19')]['attributes']||null:null,'limit':_0x9feb63[_0x1ceb('0x19')]?_0x9feb63[_0x1ceb('0x19')][_0x1ceb('0x1c')]||null:null})[_0x1ceb('0x28')](function(_0x250df4){logger[_0x1ceb('0xe')]('UpdateVoiceQueueReport',_0x9feb63);logger[_0x1ceb('0x20')](_0x1ceb('0x24'),_0x9feb63,JSON[_0x1ceb('0x11')](_0x250df4));_0xdca50(_0x250df4);})[_0x1ceb('0x21')](function(_0x21a1c8){logger[_0x1ceb('0x12')](_0x1ceb('0x24'),_0x21a1c8[_0x1ceb('0x14')],_0x9feb63);_0x4b805f(_0x4c00aa[_0x1ceb('0x12')](0x1f4,_0x21a1c8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 31582ac..1ec2e5d 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 _0x74eb=['./voiceQueueReport.events','save','remove','emit','register'];(function(_0x5f2661,_0x4bb742){var _0x1a99b2=function(_0x366858){while(--_0x366858){_0x5f2661['push'](_0x5f2661['shift']());}};_0x1a99b2(++_0x4bb742);}(_0x74eb,0x13b));var _0xb74e=function(_0x2644fd,_0x4d79b2){_0x2644fd=_0x2644fd-0x0;var _0x41e462=_0x74eb[_0x2644fd];return _0x41e462;};'use strict';var VoiceQueueReportEvents=require(_0xb74e('0x0'));var events=[_0xb74e('0x1'),_0xb74e('0x2'),'update'];function createListener(_0x16f1d5,_0x228930){return function(_0x466de6){_0x228930[_0xb74e('0x3')](_0x16f1d5,_0x466de6);};}function removeListener(_0x11701d,_0x459811){return function(){VoiceQueueReportEvents['removeListener'](_0x11701d,_0x459811);};}exports[_0xb74e('0x4')]=function(_0x4f49f9){for(var _0x329dc1=0x0,_0x4307f8=events['length'];_0x329dc1<_0x4307f8;_0x329dc1++){var _0x2d0773=events[_0x329dc1];var _0x56483b=createListener('voiceQueueReport:'+_0x2d0773,_0x4f49f9);VoiceQueueReportEvents['on'](_0x2d0773,_0x56483b);}}; \ No newline at end of file +var _0x0ec6=['register','voiceQueueReport:','./voiceQueueReport.events','update','emit'];(function(_0x58b021,_0x29082f){var _0x5a791a=function(_0x5744fa){while(--_0x5744fa){_0x58b021['push'](_0x58b021['shift']());}};_0x5a791a(++_0x29082f);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x81c3d,_0x324db5){_0x81c3d=_0x81c3d-0x0;var _0x5a6a0c=_0x0ec6[_0x81c3d];return _0x5a6a0c;};'use strict';var VoiceQueueReportEvents=require(_0x60ec('0x0'));var events=['save','remove',_0x60ec('0x1')];function createListener(_0x21264a,_0x2ee4a3){return function(_0x13a3a5){_0x2ee4a3[_0x60ec('0x2')](_0x21264a,_0x13a3a5);};}function removeListener(_0x262ed6,_0x392a91){return function(){VoiceQueueReportEvents['removeListener'](_0x262ed6,_0x392a91);};}exports[_0x60ec('0x3')]=function(_0xb4a258){for(var _0x1d8fb5=0x0,_0x74adc4=events['length'];_0x1d8fb5<_0x74adc4;_0x1d8fb5++){var _0xcb974c=events[_0x1d8fb5];var _0x488ab8=createListener(_0x60ec('0x4')+_0xcb974c,_0xb4a258);VoiceQueueReportEvents['on'](_0xcb974c,_0x488ab8);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ab6e73b..f58449f 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 _0xec90=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x36b0c6,_0x582dac){var _0x1f51f5=function(_0x126cf8){while(--_0x126cf8){_0x36b0c6['push'](_0x36b0c6['shift']());}};_0x1f51f5(++_0x582dac);}(_0xec90,0x1a3));var _0x0ec9=function(_0x3a93b5,_0x2145bc){_0x3a93b5=_0x3a93b5-0x0;var _0x10cded=_0xec90[_0x3a93b5];return _0x10cded;};'use strict';var multer=require(_0x0ec9('0x0'));var util=require(_0x0ec9('0x1'));var path=require(_0x0ec9('0x2'));var timeout=require(_0x0ec9('0x3'));var express=require(_0x0ec9('0x4'));var router=express[_0x0ec9('0x5')]();var fs_extra=require(_0x0ec9('0x6'));var auth=require(_0x0ec9('0x7'));var interaction=require(_0x0ec9('0x8'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x0ec9('0x9')]('/',auth[_0x0ec9('0xa')](),controller['index']);router[_0x0ec9('0x9')](_0x0ec9('0xb'),auth[_0x0ec9('0xa')](),controller[_0x0ec9('0xc')]);router[_0x0ec9('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ec9('0xe')]);router[_0x0ec9('0xf')](_0x0ec9('0xb'),auth[_0x0ec9('0xa')](),controller[_0x0ec9('0x10')]);router[_0x0ec9('0x11')](_0x0ec9('0xb'),auth[_0x0ec9('0xa')](),controller[_0x0ec9('0x12')]);module[_0x0ec9('0x13')]=router; \ No newline at end of file +var _0xa942=['delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x4a59c2,_0x53ad41){var _0xec68f1=function(_0x11b9ae){while(--_0x11b9ae){_0x4a59c2['push'](_0x4a59c2['shift']());}};_0xec68f1(++_0x53ad41);}(_0xa942,0xc8));var _0x2a94=function(_0x3f657a,_0x787813){_0x3f657a=_0x3f657a-0x0;var _0x2dc525=_0xa942[_0x3f657a];return _0x2dc525;};'use strict';var multer=require(_0x2a94('0x0'));var util=require(_0x2a94('0x1'));var path=require(_0x2a94('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a94('0x3')]();var fs_extra=require(_0x2a94('0x4'));var auth=require(_0x2a94('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2a94('0x6'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2a94('0x7')]);router[_0x2a94('0x8')](_0x2a94('0x9'),auth[_0x2a94('0xa')](),controller[_0x2a94('0xb')]);router[_0x2a94('0xc')]('/',auth[_0x2a94('0xa')](),controller[_0x2a94('0xd')]);router[_0x2a94('0xe')](_0x2a94('0x9'),auth[_0x2a94('0xa')](),controller[_0x2a94('0xf')]);router[_0x2a94('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2a94('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 8bf3647..83aaeb0 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 _0x719c=['DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x2c6e82,_0x158dee){var _0x37df51=function(_0x19af99){while(--_0x19af99){_0x2c6e82['push'](_0x2c6e82['shift']());}};_0x37df51(++_0x158dee);}(_0x719c,0x1c4));var _0xc719=function(_0x153a02,_0x8f3af9){_0x153a02=_0x153a02-0x0;var _0x1f9522=_0x719c[_0x153a02];return _0x1f9522;};'use strict';var Sequelize=require(_0xc719('0x0'));var moment=require(_0xc719('0x1'));module[_0xc719('0x2')]={'time':{'type':Sequelize[_0xc719('0x3')]},'callid':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc719('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc719('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xc719('0x5'))}}; \ No newline at end of file +var _0x6e70=['DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING'];(function(_0x2d7392,_0x487947){var _0x1d4ebe=function(_0x1594ca){while(--_0x1594ca){_0x2d7392['push'](_0x2d7392['shift']());}};_0x1d4ebe(++_0x487947);}(_0x6e70,0x15b));var _0x06e7=function(_0x4d0c21,_0x2788a9){_0x4d0c21=_0x4d0c21-0x0;var _0xf4d1fb=_0x6e70[_0x4d0c21];return _0xf4d1fb;};'use strict';var Sequelize=require(_0x06e7('0x0'));var moment=require('moment');module[_0x06e7('0x1')]={'time':{'type':Sequelize[_0x06e7('0x2')]},'callid':{'type':Sequelize[_0x06e7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x06e7('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x06e7('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x06e7('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x06e7('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x06e7('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x06e7('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x06e7('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x06e7('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x06e7('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c3ccb02..5297f56 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 _0xc34d=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','VoiceQueuesLog','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc34d,0x108));var _0xdc34=function(_0x29ee5c,_0x176a4d){_0x29ee5c=_0x29ee5c-0x0;var _0x36c927=_0xc34d[_0x29ee5c];return _0x36c927;};'use strict';var emlformat=require(_0xdc34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc34('0x1'));var jsonpatch=require(_0xdc34('0x2'));var rp=require(_0xdc34('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdc34('0x4'));var util=require(_0xdc34('0x5'));var path=require(_0xdc34('0x6'));var sox=require(_0xdc34('0x7'));var csv=require(_0xdc34('0x8'));var ejs=require(_0xdc34('0x9'));var fs=require('fs');var fs_extra=require(_0xdc34('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdc34('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdc34('0xc'));var Papa=require(_0xdc34('0xd'));var Redis=require(_0xdc34('0xe'));var authService=require(_0xdc34('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdc34('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc34('0x11'))(_0xdc34('0x12'));var utils=require(_0xdc34('0x13'));var config=require(_0xdc34('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc34('0x15'))['db'];function respondWithStatusCode(_0x5bb745,_0x276c29){_0x276c29=_0x276c29||0xcc;return function(_0xa72c){if(_0xa72c){return _0x5bb745[_0xdc34('0x16')](_0x276c29);}return _0x5bb745[_0xdc34('0x17')](_0x276c29)[_0xdc34('0x18')]();};}function respondWithResult(_0x432bf5,_0x6720af){_0x6720af=_0x6720af||0xc8;return function(_0x58db1c){if(_0x58db1c){return _0x432bf5[_0xdc34('0x17')](_0x6720af)[_0xdc34('0x19')](_0x58db1c);}};}function respondWithFilteredResult(_0x4a9843,_0x229c9c){return function(_0x37de30){if(_0x37de30){var _0x579beb=typeof _0x229c9c[_0xdc34('0x1a')]===_0xdc34('0x1b')&&typeof _0x229c9c[_0xdc34('0x1c')]==='undefined';var _0x248b04=_0x37de30[_0xdc34('0x1d')];var _0x12b4bd=_0x579beb?0x0:_0x229c9c[_0xdc34('0x1a')];var _0x1fc144=_0x579beb?_0x37de30[_0xdc34('0x1d')]:_0x229c9c[_0xdc34('0x1a')]+_0x229c9c[_0xdc34('0x1c')];var _0x4d3b35;if(_0x1fc144>=_0x248b04){_0x1fc144=_0x248b04;_0x4d3b35=0xc8;}else{_0x4d3b35=0xce;}_0x4a9843[_0xdc34('0x17')](_0x4d3b35);return _0x4a9843['set'](_0xdc34('0x1e'),_0x12b4bd+'-'+_0x1fc144+'/'+_0x248b04)[_0xdc34('0x19')](_0x37de30);}return null;};}function patchUpdates(_0xe66232){return function(_0x262a01){try{jsonpatch['apply'](_0x262a01,_0xe66232,!![]);}catch(_0xe10aff){return BPromise['reject'](_0xe10aff);}return _0x262a01['save']();};}function saveUpdates(_0x50c250,_0x3fe8d4){return function(_0x4fb2ce){if(_0x4fb2ce){return _0x4fb2ce[_0xdc34('0x1f')](_0x50c250)[_0xdc34('0x20')](function(_0x47e8ba){return _0x47e8ba;});}return null;};}function removeEntity(_0x343466,_0x5871c6){return function(_0x2bbc14){if(_0x2bbc14){return _0x2bbc14[_0xdc34('0x21')]()[_0xdc34('0x20')](function(){_0x343466[_0xdc34('0x17')](0xcc)[_0xdc34('0x18')]();});}};}function handleEntityNotFound(_0x5e6256,_0x90ae59){return function(_0xf24266){if(!_0xf24266){_0x5e6256[_0xdc34('0x16')](0x194);}return _0xf24266;};}function handleError(_0x3daadc,_0x123e68){_0x123e68=_0x123e68||0x1f4;return function(_0x44afa8){logger[_0xdc34('0x22')](_0x44afa8[_0xdc34('0x23')]);if(_0x44afa8[_0xdc34('0x24')]){delete _0x44afa8[_0xdc34('0x24')];}_0x3daadc['status'](_0x123e68)[_0xdc34('0x25')](_0x44afa8);};}exports[_0xdc34('0x26')]=function(_0x57a2e8,_0x3ef55e){var _0x3bbaef={},_0x145920={},_0x62d718={'count':0x0,'rows':[]};var _0x3885e7=_[_0xdc34('0x27')](db['VoiceQueuesLog'][_0xdc34('0x28')],function(_0x1a99e2){return{'name':_0x1a99e2['fieldName'],'type':_0x1a99e2[_0xdc34('0x29')][_0xdc34('0x2a')]};});_0x145920['model']=_[_0xdc34('0x27')](_0x3885e7,'name');_0x145920[_0xdc34('0x2b')]=_['keys'](_0x57a2e8[_0xdc34('0x2b')]);_0x145920['filters']=_['intersection'](_0x145920[_0xdc34('0x2c')],_0x145920[_0xdc34('0x2b')]);_0x3bbaef[_0xdc34('0x2d')]=_[_0xdc34('0x2e')](_0x145920[_0xdc34('0x2c')],qs[_0xdc34('0x2f')](_0x57a2e8['query'][_0xdc34('0x2f')]));_0x3bbaef[_0xdc34('0x2d')]=_0x3bbaef[_0xdc34('0x2d')]['length']?_0x3bbaef['attributes']:_0x145920['model'];if(!_0x57a2e8['query'][_0xdc34('0x30')](_0xdc34('0x31'))){_0x3bbaef[_0xdc34('0x1c')]=qs[_0xdc34('0x1c')](_0x57a2e8[_0xdc34('0x2b')]['limit']);_0x3bbaef[_0xdc34('0x1a')]=qs[_0xdc34('0x1a')](_0x57a2e8[_0xdc34('0x2b')][_0xdc34('0x1a')]);}_0x3bbaef[_0xdc34('0x32')]=qs['sort'](_0x57a2e8[_0xdc34('0x2b')][_0xdc34('0x33')]);_0x3bbaef[_0xdc34('0x34')]=qs['filters'](_[_0xdc34('0x35')](_0x57a2e8[_0xdc34('0x2b')],_0x145920[_0xdc34('0x36')]),_0x3885e7);if(_0x57a2e8[_0xdc34('0x2b')][_0xdc34('0x37')]){_0x3bbaef['where']=_['merge'](_0x3bbaef[_0xdc34('0x34')],{'$or':_['map'](_0x3885e7,function(_0x471468){if(_0x471468['type']!==_0xdc34('0x38')){var _0x3511c8={};_0x3511c8[_0x471468['name']]={'$like':'%'+_0x57a2e8['query'][_0xdc34('0x37')]+'%'};return _0x3511c8;}})});}_0x3bbaef=_[_0xdc34('0x39')]({},_0x3bbaef,_0x57a2e8[_0xdc34('0x3a')]);var _0x4b4c7b={'where':_0x3bbaef[_0xdc34('0x34')]};return db[_0xdc34('0x3b')][_0xdc34('0x1d')](_0x4b4c7b)[_0xdc34('0x20')](function(_0x20c30d){_0x62d718[_0xdc34('0x1d')]=_0x20c30d;if(_0x57a2e8['query']['includeAll']){_0x3bbaef['include']=[{'all':!![]}];}return db[_0xdc34('0x3b')][_0xdc34('0x3c')](_0x3bbaef);})[_0xdc34('0x20')](function(_0x4e6507){_0x62d718[_0xdc34('0x3d')]=_0x4e6507;return _0x62d718;})['then'](respondWithFilteredResult(_0x3ef55e,_0x3bbaef))[_0xdc34('0x3e')](handleError(_0x3ef55e,null));};exports[_0xdc34('0x3f')]=function(_0x46805c,_0x48dac4){var _0x12c61f={'raw':!![],'where':{'id':_0x46805c[_0xdc34('0x40')]['id']}},_0x28db5c={};_0x28db5c[_0xdc34('0x2c')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0x28db5c[_0xdc34('0x2b')]=_[_0xdc34('0x41')](_0x46805c[_0xdc34('0x2b')]);_0x28db5c[_0xdc34('0x36')]=_[_0xdc34('0x2e')](_0x28db5c[_0xdc34('0x2c')],_0x28db5c[_0xdc34('0x2b')]);_0x12c61f[_0xdc34('0x2d')]=_['intersection'](_0x28db5c[_0xdc34('0x2c')],qs[_0xdc34('0x2f')](_0x46805c['query'][_0xdc34('0x2f')]));_0x12c61f[_0xdc34('0x2d')]=_0x12c61f[_0xdc34('0x2d')][_0xdc34('0x42')]?_0x12c61f['attributes']:_0x28db5c[_0xdc34('0x2c')];if(_0x46805c[_0xdc34('0x2b')]['includeAll']){_0x12c61f['include']=[{'all':!![]}];}_0x12c61f=_['merge']({},_0x12c61f,_0x46805c[_0xdc34('0x3a')]);return db[_0xdc34('0x3b')][_0xdc34('0x43')](_0x12c61f)[_0xdc34('0x20')](handleEntityNotFound(_0x48dac4,null))['then'](respondWithResult(_0x48dac4,null))[_0xdc34('0x3e')](handleError(_0x48dac4,null));};exports[_0xdc34('0x44')]=function(_0x36ed2a,_0x11d502){return db[_0xdc34('0x3b')][_0xdc34('0x44')](_0x36ed2a[_0xdc34('0x45')],{})[_0xdc34('0x20')](respondWithResult(_0x11d502,0xc9))[_0xdc34('0x3e')](handleError(_0x11d502,null));};exports[_0xdc34('0x1f')]=function(_0x438ca1,_0x3ce726){if(_0x438ca1[_0xdc34('0x45')]['id']){delete _0x438ca1[_0xdc34('0x45')]['id'];}return db[_0xdc34('0x3b')]['find']({'where':{'id':_0x438ca1['params']['id']}})[_0xdc34('0x20')](handleEntityNotFound(_0x3ce726,null))['then'](saveUpdates(_0x438ca1[_0xdc34('0x45')],null))[_0xdc34('0x20')](respondWithResult(_0x3ce726,null))[_0xdc34('0x3e')](handleError(_0x3ce726,null));};exports[_0xdc34('0x21')]=function(_0x19aaaa,_0x2216e5){return db[_0xdc34('0x3b')][_0xdc34('0x43')]({'where':{'id':_0x19aaaa[_0xdc34('0x40')]['id']}})['then'](handleEntityNotFound(_0x2216e5,null))[_0xdc34('0x20')](removeEntity(_0x2216e5,null))[_0xdc34('0x3e')](handleError(_0x2216e5,null));}; \ No newline at end of file +var _0xda1b=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceQueuesLog','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x461c41,_0x2e6d1c){var _0x509e12=function(_0x245f5d){while(--_0x245f5d){_0x461c41['push'](_0x461c41['shift']());}};_0x509e12(++_0x2e6d1c);}(_0xda1b,0x183));var _0xbda1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xda1b[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xbda1('0x0'));var rimraf=require(_0xbda1('0x1'));var zipdir=require(_0xbda1('0x2'));var jsonpatch=require(_0xbda1('0x3'));var rp=require('request-promise');var moment=require(_0xbda1('0x4'));var BPromise=require(_0xbda1('0x5'));var Mustache=require(_0xbda1('0x6'));var util=require(_0xbda1('0x7'));var path=require(_0xbda1('0x8'));var sox=require(_0xbda1('0x9'));var csv=require(_0xbda1('0xa'));var ejs=require(_0xbda1('0xb'));var fs=require('fs');var fs_extra=require(_0xbda1('0xc'));var _=require(_0xbda1('0xd'));var squel=require(_0xbda1('0xe'));var crypto=require(_0xbda1('0xf'));var jsforce=require(_0xbda1('0x10'));var deskjs=require(_0xbda1('0x11'));var toCsv=require(_0xbda1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbda1('0x12'));var authService=require(_0xbda1('0x13'));var qs=require(_0xbda1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbda1('0x15'));var logger=require(_0xbda1('0x16'))(_0xbda1('0x17'));var utils=require('../../config/utils');var config=require(_0xbda1('0x18'));var licenseUtil=require(_0xbda1('0x19'));var db=require(_0xbda1('0x1a'))['db'];function respondWithStatusCode(_0x4e6aed,_0x394082){_0x394082=_0x394082||0xcc;return function(_0x1a7c52){if(_0x1a7c52){return _0x4e6aed[_0xbda1('0x1b')](_0x394082);}return _0x4e6aed[_0xbda1('0x1c')](_0x394082)[_0xbda1('0x1d')]();};}function respondWithResult(_0xb054b4,_0x46674d){_0x46674d=_0x46674d||0xc8;return function(_0x2e7031){if(_0x2e7031){return _0xb054b4['status'](_0x46674d)['json'](_0x2e7031);}};}function respondWithFilteredResult(_0xf2d0e1,_0x59627c){return function(_0x323136){if(_0x323136){var _0x3b72b8=typeof _0x59627c[_0xbda1('0x1e')]===_0xbda1('0x1f')&&typeof _0x59627c[_0xbda1('0x20')]==='undefined';var _0x40d4bf=_0x323136[_0xbda1('0x21')];var _0x19aa2a=_0x3b72b8?0x0:_0x59627c[_0xbda1('0x1e')];var _0x3a13a7=_0x3b72b8?_0x323136['count']:_0x59627c[_0xbda1('0x1e')]+_0x59627c[_0xbda1('0x20')];var _0x108768;if(_0x3a13a7>=_0x40d4bf){_0x3a13a7=_0x40d4bf;_0x108768=0xc8;}else{_0x108768=0xce;}_0xf2d0e1[_0xbda1('0x1c')](_0x108768);return _0xf2d0e1[_0xbda1('0x22')](_0xbda1('0x23'),_0x19aa2a+'-'+_0x3a13a7+'/'+_0x40d4bf)[_0xbda1('0x24')](_0x323136);}return null;};}function patchUpdates(_0x37e01f){return function(_0x124291){try{jsonpatch[_0xbda1('0x25')](_0x124291,_0x37e01f,!![]);}catch(_0x3e329f){return BPromise['reject'](_0x3e329f);}return _0x124291[_0xbda1('0x26')]();};}function saveUpdates(_0xc7ace5,_0x4c2213){return function(_0x57e31a){if(_0x57e31a){return _0x57e31a[_0xbda1('0x27')](_0xc7ace5)[_0xbda1('0x28')](function(_0x1327c5){return _0x1327c5;});}return null;};}function removeEntity(_0x11ee81,_0x295819){return function(_0xfc4446){if(_0xfc4446){return _0xfc4446[_0xbda1('0x29')]()[_0xbda1('0x28')](function(){_0x11ee81['status'](0xcc)[_0xbda1('0x1d')]();});}};}function handleEntityNotFound(_0x69964c,_0x5ec0cc){return function(_0x4a4904){if(!_0x4a4904){_0x69964c['sendStatus'](0x194);}return _0x4a4904;};}function handleError(_0x33b0d2,_0x102908){_0x102908=_0x102908||0x1f4;return function(_0x3901c2){logger[_0xbda1('0x2a')](_0x3901c2[_0xbda1('0x2b')]);if(_0x3901c2['name']){delete _0x3901c2[_0xbda1('0x2c')];}_0x33b0d2[_0xbda1('0x1c')](_0x102908)[_0xbda1('0x2d')](_0x3901c2);};}exports['index']=function(_0x4fce1e,_0x1860d5){var _0x124038={},_0xcf39b9={},_0x66c8d8={'count':0x0,'rows':[]};var _0x5401cc=_[_0xbda1('0x2e')](db['VoiceQueuesLog'][_0xbda1('0x2f')],function(_0x31e1a7){return{'name':_0x31e1a7[_0xbda1('0x30')],'type':_0x31e1a7[_0xbda1('0x31')]['key']};});_0xcf39b9[_0xbda1('0x32')]=_[_0xbda1('0x2e')](_0x5401cc,_0xbda1('0x2c'));_0xcf39b9['query']=_[_0xbda1('0x33')](_0x4fce1e[_0xbda1('0x34')]);_0xcf39b9[_0xbda1('0x35')]=_[_0xbda1('0x36')](_0xcf39b9[_0xbda1('0x32')],_0xcf39b9[_0xbda1('0x34')]);_0x124038[_0xbda1('0x37')]=_[_0xbda1('0x36')](_0xcf39b9['model'],qs['fields'](_0x4fce1e[_0xbda1('0x34')][_0xbda1('0x38')]));_0x124038[_0xbda1('0x37')]=_0x124038[_0xbda1('0x37')][_0xbda1('0x39')]?_0x124038[_0xbda1('0x37')]:_0xcf39b9[_0xbda1('0x32')];if(!_0x4fce1e[_0xbda1('0x34')][_0xbda1('0x3a')](_0xbda1('0x3b'))){_0x124038[_0xbda1('0x20')]=qs[_0xbda1('0x20')](_0x4fce1e['query'][_0xbda1('0x20')]);_0x124038[_0xbda1('0x1e')]=qs[_0xbda1('0x1e')](_0x4fce1e['query'][_0xbda1('0x1e')]);}_0x124038[_0xbda1('0x3c')]=qs[_0xbda1('0x3d')](_0x4fce1e[_0xbda1('0x34')]['sort']);_0x124038['where']=qs['filters'](_[_0xbda1('0x3e')](_0x4fce1e[_0xbda1('0x34')],_0xcf39b9[_0xbda1('0x35')]),_0x5401cc);if(_0x4fce1e[_0xbda1('0x34')][_0xbda1('0x3f')]){_0x124038[_0xbda1('0x40')]=_[_0xbda1('0x41')](_0x124038[_0xbda1('0x40')],{'$or':_[_0xbda1('0x2e')](_0x5401cc,function(_0x27c09b){if(_0x27c09b[_0xbda1('0x31')]!==_0xbda1('0x42')){var _0xaf0ee2={};_0xaf0ee2[_0x27c09b['name']]={'$like':'%'+_0x4fce1e[_0xbda1('0x34')][_0xbda1('0x3f')]+'%'};return _0xaf0ee2;}})});}_0x124038=_[_0xbda1('0x41')]({},_0x124038,_0x4fce1e[_0xbda1('0x43')]);var _0x4ca689={'where':_0x124038[_0xbda1('0x40')]};return db[_0xbda1('0x44')]['count'](_0x4ca689)[_0xbda1('0x28')](function(_0x5cbde6){_0x66c8d8[_0xbda1('0x21')]=_0x5cbde6;if(_0x4fce1e[_0xbda1('0x34')]['includeAll']){_0x124038[_0xbda1('0x45')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xbda1('0x46')](_0x124038);})[_0xbda1('0x28')](function(_0x1e4c64){_0x66c8d8[_0xbda1('0x47')]=_0x1e4c64;return _0x66c8d8;})[_0xbda1('0x28')](respondWithFilteredResult(_0x1860d5,_0x124038))[_0xbda1('0x48')](handleError(_0x1860d5,null));};exports[_0xbda1('0x49')]=function(_0x4ad260,_0x26cb4a){var _0x7898b1={'raw':!![],'where':{'id':_0x4ad260[_0xbda1('0x4a')]['id']}},_0x49cf70={};_0x49cf70['model']=_[_0xbda1('0x33')](db[_0xbda1('0x44')][_0xbda1('0x2f')]);_0x49cf70[_0xbda1('0x34')]=_['keys'](_0x4ad260[_0xbda1('0x34')]);_0x49cf70[_0xbda1('0x35')]=_[_0xbda1('0x36')](_0x49cf70['model'],_0x49cf70['query']);_0x7898b1['attributes']=_[_0xbda1('0x36')](_0x49cf70[_0xbda1('0x32')],qs[_0xbda1('0x38')](_0x4ad260[_0xbda1('0x34')][_0xbda1('0x38')]));_0x7898b1[_0xbda1('0x37')]=_0x7898b1[_0xbda1('0x37')]['length']?_0x7898b1[_0xbda1('0x37')]:_0x49cf70[_0xbda1('0x32')];if(_0x4ad260[_0xbda1('0x34')][_0xbda1('0x4b')]){_0x7898b1[_0xbda1('0x45')]=[{'all':!![]}];}_0x7898b1=_[_0xbda1('0x41')]({},_0x7898b1,_0x4ad260['options']);return db[_0xbda1('0x44')][_0xbda1('0x4c')](_0x7898b1)[_0xbda1('0x28')](handleEntityNotFound(_0x26cb4a,null))['then'](respondWithResult(_0x26cb4a,null))[_0xbda1('0x48')](handleError(_0x26cb4a,null));};exports[_0xbda1('0x4d')]=function(_0x62f53,_0x4f5e96){return db[_0xbda1('0x44')][_0xbda1('0x4d')](_0x62f53[_0xbda1('0x4e')],{})['then'](respondWithResult(_0x4f5e96,0xc9))[_0xbda1('0x48')](handleError(_0x4f5e96,null));};exports[_0xbda1('0x27')]=function(_0x49cfc2,_0x3d9dcc){if(_0x49cfc2[_0xbda1('0x4e')]['id']){delete _0x49cfc2[_0xbda1('0x4e')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x49cfc2[_0xbda1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d9dcc,null))[_0xbda1('0x28')](saveUpdates(_0x49cfc2[_0xbda1('0x4e')],null))[_0xbda1('0x28')](respondWithResult(_0x3d9dcc,null))[_0xbda1('0x48')](handleError(_0x3d9dcc,null));};exports[_0xbda1('0x29')]=function(_0x476c97,_0x2454f7){return db[_0xbda1('0x44')][_0xbda1('0x4c')]({'where':{'id':_0x476c97[_0xbda1('0x4a')]['id']}})[_0xbda1('0x28')](handleEntityNotFound(_0x2454f7,null))['then'](removeEntity(_0x2454f7,null))['catch'](handleError(_0x2454f7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d9ea3fa..14c0439 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 _0x6812=['dtm','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6812,0x121));var _0x2681=function(_0x2964e6,_0x2717b6){_0x2964e6=_0x2964e6-0x0;var _0x1c56b6=_0x6812[_0x2964e6];return _0x1c56b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2681('0x0'));var moment=require('moment');var BPromise=require(_0x2681('0x1'));var rp=require(_0x2681('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2681('0x3'));var config=require(_0x2681('0x4'));var attributes=require(_0x2681('0x5'));module['exports']=function(_0x482c52,_0x507a2c){return _0x482c52[_0x2681('0x6')](_0x2681('0x7'),attributes,{'tableName':_0x2681('0x8'),'paranoid':![],'indexes':[{'name':_0x2681('0x9'),'fields':[_0x2681('0xa'),_0x2681('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0140=['rimraf','../../config/environment','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0140,0xa3));var _0x0014=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x0140[_0x284a61];return _0x220e3c;};'use strict';var _=require(_0x0014('0x0'));var util=require(_0x0014('0x1'));var logger=require('../../config/logger')(_0x0014('0x2'));var moment=require('moment');var BPromise=require(_0x0014('0x3'));var rp=require(_0x0014('0x4'));var fs=require('fs');var path=require(_0x0014('0x5'));var rimraf=require(_0x0014('0x6'));var config=require(_0x0014('0x7'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x205167,_0x5e90ce){return _0x205167[_0x0014('0x8')](_0x0014('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x0014('0xa'),'fields':[_0x0014('0xb'),_0x0014('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 68e1f1e..ef73648 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 _0x587e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x587e,0xa3));var _0xe587=function(_0x35035f,_0x3fdcd2){_0x35035f=_0x35035f-0x0;var _0x2d9248=_0x587e[_0x35035f];return _0x2d9248;};'use strict';var _=require(_0xe587('0x0'));var util=require(_0xe587('0x1'));var moment=require(_0xe587('0x2'));var BPromise=require(_0xe587('0x3'));var rs=require(_0xe587('0x4'));var fs=require('fs');var Redis=require(_0xe587('0x5'));var db=require(_0xe587('0x6'))['db'];var utils=require(_0xe587('0x7'));var logger=require('../../config/logger')(_0xe587('0x8'));var config=require(_0xe587('0x9'));var jayson=require(_0xe587('0xa'));var client=jayson[_0xe587('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc299d,_0x12f259,_0x17cfdc){return new BPromise(function(_0x59f7fb,_0x508a0c){return client['request'](_0xbc299d,_0x17cfdc)[_0xe587('0xc')](function(_0x4daed1){logger[_0xe587('0xd')](_0xe587('0xe'),_0x12f259,_0xe587('0xf'));logger[_0xe587('0x10')](_0xe587('0x11'),_0x12f259,_0xe587('0xf'),JSON['stringify'](_0x4daed1));if(_0x4daed1['error']){if(_0x4daed1[_0xe587('0x12')][_0xe587('0x13')]===0x1f4){logger[_0xe587('0x12')](_0xe587('0xe'),_0x12f259,_0x4daed1[_0xe587('0x12')]['message']);return _0x508a0c(_0x4daed1[_0xe587('0x12')][_0xe587('0x14')]);}logger[_0xe587('0x12')](_0xe587('0xe'),_0x12f259,_0x4daed1[_0xe587('0x12')][_0xe587('0x14')]);return _0x59f7fb(_0x4daed1[_0xe587('0x12')][_0xe587('0x14')]);}else{logger[_0xe587('0xd')](_0xe587('0xe'),_0x12f259,_0xe587('0xf'));_0x59f7fb(_0x4daed1[_0xe587('0x15')][_0xe587('0x14')]);}})[_0xe587('0x16')](function(_0x14d8a1){logger[_0xe587('0x12')](_0xe587('0xe'),_0x12f259,_0x14d8a1);_0x508a0c(_0x14d8a1);});});} \ No newline at end of file +var _0x70e0=['code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x380ada,_0x1e6fe8){var _0x449404=function(_0x375ed6){while(--_0x375ed6){_0x380ada['push'](_0x380ada['shift']());}};_0x449404(++_0x1e6fe8);}(_0x70e0,0x17b));var _0x070e=function(_0xe7f122,_0x3e7eb7){_0xe7f122=_0xe7f122-0x0;var _0x5e4636=_0x70e0[_0xe7f122];return _0x5e4636;};'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')]('VoiceQueuesLog,\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')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c61cc48..311cc27 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 _0x4c1f=['download','downloads','/:id/transcribe','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/download'];(function(_0x2fce18,_0x42cde1){var _0x363744=function(_0x275f4c){while(--_0x275f4c){_0x2fce18['push'](_0x2fce18['shift']());}};_0x363744(++_0x42cde1);}(_0x4c1f,0xc0));var _0xf4c1=function(_0x57d88f,_0x5f5922){_0x57d88f=_0x57d88f-0x0;var _0x22bf96=_0x4c1f[_0x57d88f];return _0x22bf96;};'use strict';var multer=require(_0xf4c1('0x0'));var util=require(_0xf4c1('0x1'));var path=require(_0xf4c1('0x2'));var timeout=require(_0xf4c1('0x3'));var express=require(_0xf4c1('0x4'));var router=express['Router']();var fs_extra=require(_0xf4c1('0x5'));var auth=require(_0xf4c1('0x6'));var interaction=require(_0xf4c1('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xf4c1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf4c1('0x9'),auth[_0xf4c1('0xa')](),controller[_0xf4c1('0xb')]);router['get'](_0xf4c1('0xc'),auth[_0xf4c1('0xa')](),controller[_0xf4c1('0xd')]);router[_0xf4c1('0x8')](_0xf4c1('0xe'),auth[_0xf4c1('0xa')](),controller[_0xf4c1('0xf')]);router[_0xf4c1('0x8')]('/:id/downloads',controller[_0xf4c1('0x10')]);router['get'](_0xf4c1('0x11'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xf4c1('0x12')]('/',auth[_0xf4c1('0xa')](),controller[_0xf4c1('0x13')]);router['post'](_0xf4c1('0x11'),auth[_0xf4c1('0xa')](),controller['runTranscribe']);router[_0xf4c1('0x14')](_0xf4c1('0xc'),auth[_0xf4c1('0xa')](),controller[_0xf4c1('0x15')]);router['delete'](_0xf4c1('0xc'),auth[_0xf4c1('0xa')](),controller['destroy']);module[_0xf4c1('0x16')]=router; \ No newline at end of file +var _0xa038=['/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show'];(function(_0x194e44,_0x31f0c8){var _0x26ee24=function(_0x112bfd){while(--_0x112bfd){_0x194e44['push'](_0x194e44['shift']());}};_0x26ee24(++_0x31f0c8);}(_0xa038,0x82));var _0x8a03=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xa038[_0x62c958];return _0x57ec61;};'use strict';var multer=require('multer');var util=require(_0x8a03('0x0'));var path=require(_0x8a03('0x1'));var timeout=require(_0x8a03('0x2'));var express=require(_0x8a03('0x3'));var router=express[_0x8a03('0x4')]();var fs_extra=require(_0x8a03('0x5'));var auth=require(_0x8a03('0x6'));var interaction=require(_0x8a03('0x7'));var config=require(_0x8a03('0x8'));var controller=require('./voiceRecording.controller');router[_0x8a03('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a03('0xa')]);router[_0x8a03('0x9')](_0x8a03('0xb'),auth[_0x8a03('0xc')](),controller[_0x8a03('0xd')]);router[_0x8a03('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8a03('0xe')]);router[_0x8a03('0x9')](_0x8a03('0xf'),auth[_0x8a03('0xc')](),controller[_0x8a03('0x10')]);router['get'](_0x8a03('0x11'),controller[_0x8a03('0x12')]);router[_0x8a03('0x9')]('/:id/transcribe',auth[_0x8a03('0xc')](),controller[_0x8a03('0x13')]);router[_0x8a03('0x14')]('/',auth[_0x8a03('0xc')](),controller[_0x8a03('0x15')]);router[_0x8a03('0x14')](_0x8a03('0x16'),auth[_0x8a03('0xc')](),controller[_0x8a03('0x17')]);router['put'](_0x8a03('0x18'),auth[_0x8a03('0xc')](),controller[_0x8a03('0x19')]);router[_0x8a03('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x8a03('0x1b')]);module[_0x8a03('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 84a2a67..9ec76f0 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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 e8feb6a..7d7b013 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 _0x6b0d=['path','to-csv','ejs','fs-extra','lodash','squel','querystring','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','VoiceRecording','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','show','keys','length','create','body','catch','find','params','describe','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','filename','unlink','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','token','$and','push','%s.cypher','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xb68002,_0x305f05){var _0x34ef54=function(_0x56f747){while(--_0x56f747){_0xb68002['push'](_0xb68002['shift']());}};_0x34ef54(++_0x305f05);}(_0x6b0d,0x1aa));var _0xd6b0=function(_0x1b089e,_0x2c21a3){_0x1b089e=_0x1b089e-0x0;var _0xd5329b=_0x6b0d[_0x1b089e];return _0xd5329b;};'use strict';var emlformat=require(_0xd6b0('0x0'));var rimraf=require(_0xd6b0('0x1'));var zipdir=require(_0xd6b0('0x2'));var jsonpatch=require(_0xd6b0('0x3'));var rp=require(_0xd6b0('0x4'));var moment=require(_0xd6b0('0x5'));var BPromise=require(_0xd6b0('0x6'));var Mustache=require(_0xd6b0('0x7'));var util=require(_0xd6b0('0x8'));var path=require(_0xd6b0('0x9'));var sox=require('sox');var csv=require(_0xd6b0('0xa'));var ejs=require(_0xd6b0('0xb'));var fs=require('fs');var fs_extra=require(_0xd6b0('0xc'));var _=require(_0xd6b0('0xd'));var squel=require(_0xd6b0('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd6b0('0xa'));var querystring=require(_0xd6b0('0xf'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xd6b0('0x10'));var Redis=require(_0xd6b0('0x11'));var authService=require(_0xd6b0('0x12'));var qs=require(_0xd6b0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6b0('0x14'))('api');var utils=require(_0xd6b0('0x15'));var config=require(_0xd6b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6b0('0x17'))['db'];function respondWithStatusCode(_0x56abaf,_0x13cea9){_0x13cea9=_0x13cea9||0xcc;return function(_0x14d783){if(_0x14d783){return _0x56abaf[_0xd6b0('0x18')](_0x13cea9);}return _0x56abaf[_0xd6b0('0x19')](_0x13cea9)['end']();};}function respondWithResult(_0x3f9912,_0x4bac71){_0x4bac71=_0x4bac71||0xc8;return function(_0x553a6a){if(_0x553a6a){return _0x3f9912['status'](_0x4bac71)[_0xd6b0('0x1a')](_0x553a6a);}};}function respondWithFilteredResult(_0x2ccfb6,_0x174885){return function(_0x14efcd){if(_0x14efcd){var _0x5e10ef=typeof _0x174885[_0xd6b0('0x1b')]===_0xd6b0('0x1c')&&typeof _0x174885['limit']==='undefined';var _0x1c3d5a=_0x14efcd[_0xd6b0('0x1d')];var _0x35c51e=_0x5e10ef?0x0:_0x174885[_0xd6b0('0x1b')];var _0x10a725=_0x5e10ef?_0x14efcd[_0xd6b0('0x1d')]:_0x174885[_0xd6b0('0x1b')]+_0x174885[_0xd6b0('0x1e')];var _0x396c7f;if(_0x10a725>=_0x1c3d5a){_0x10a725=_0x1c3d5a;_0x396c7f=0xc8;}else{_0x396c7f=0xce;}_0x2ccfb6[_0xd6b0('0x19')](_0x396c7f);return _0x2ccfb6['set'](_0xd6b0('0x1f'),_0x35c51e+'-'+_0x10a725+'/'+_0x1c3d5a)['json'](_0x14efcd);}return null;};}function patchUpdates(_0x593322){return function(_0x5801eb){try{jsonpatch[_0xd6b0('0x20')](_0x5801eb,_0x593322,!![]);}catch(_0x4e5215){return BPromise[_0xd6b0('0x21')](_0x4e5215);}return _0x5801eb['save']();};}function saveUpdates(_0x96e85c,_0x23ff01){return function(_0x4a54ee){if(_0x4a54ee){return _0x4a54ee[_0xd6b0('0x22')](_0x96e85c)[_0xd6b0('0x23')](function(_0x1245fe){return _0x1245fe;});}return null;};}function removeEntity(_0xfee94b,_0x10ae3c){return function(_0x3242be){if(_0x3242be){return _0x3242be[_0xd6b0('0x24')]()[_0xd6b0('0x23')](function(){_0xfee94b[_0xd6b0('0x19')](0xcc)[_0xd6b0('0x25')]();});}};}function handleEntityNotFound(_0x5241e4,_0x3ca6d0){return function(_0x2dc820){if(!_0x2dc820){_0x5241e4['sendStatus'](0x194);}return _0x2dc820;};}function handleError(_0x5da699,_0x563e5e){_0x563e5e=_0x563e5e||0x1f4;return function(_0x52433e){logger[_0xd6b0('0x26')](_0x52433e['stack']);if(_0x52433e[_0xd6b0('0x27')]){delete _0x52433e[_0xd6b0('0x27')];}_0x5da699[_0xd6b0('0x19')](_0x563e5e)[_0xd6b0('0x28')](_0x52433e);};}exports[_0xd6b0('0x29')]=function(_0x9c9b9b,_0x566214){var _0x140665={},_0x32592d={},_0xd8dbe8={'count':0x0,'rows':[]};var _0x503bf3=_[_0xd6b0('0x2a')](db[_0xd6b0('0x2b')][_0xd6b0('0x2c')],function(_0x1c1c7f){return{'name':_0x1c1c7f['fieldName'],'type':_0x1c1c7f[_0xd6b0('0x2d')]['key']};});_0x32592d['model']=_['differenceBy'](_[_0xd6b0('0x2a')](_0x503bf3,_0xd6b0('0x27')),['format']);_0x32592d[_0xd6b0('0x2e')]=_['keys'](_0x9c9b9b['query']);_0x32592d[_0xd6b0('0x2f')]=_[_0xd6b0('0x30')](_0x32592d[_0xd6b0('0x31')],_0x32592d[_0xd6b0('0x2e')]);_0x140665[_0xd6b0('0x32')]=_[_0xd6b0('0x30')](_0x32592d['model'],qs[_0xd6b0('0x33')](_0x9c9b9b['query'][_0xd6b0('0x33')]));_0x140665[_0xd6b0('0x32')]=_0x140665['attributes']['length']?_0x140665[_0xd6b0('0x32')]:_0x32592d[_0xd6b0('0x31')];if(!_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x34')](_0xd6b0('0x35'))){_0x140665[_0xd6b0('0x1e')]=qs[_0xd6b0('0x1e')](_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x1e')]);_0x140665[_0xd6b0('0x1b')]=qs['offset'](_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x1b')]);}_0x140665[_0xd6b0('0x36')]=qs[_0xd6b0('0x37')](_0x9c9b9b[_0xd6b0('0x2e')]['sort']);_0x140665['where']=qs[_0xd6b0('0x2f')](_[_0xd6b0('0x38')](_0x9c9b9b[_0xd6b0('0x2e')],_0x32592d['filters']),_0x503bf3);if(_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x39')]){_0x140665['where']=_[_0xd6b0('0x3a')](_0x140665[_0xd6b0('0x3b')],{'$or':_['map'](_0x503bf3,function(_0xb495d8){if(_0xb495d8['type']!==_0xd6b0('0x3c')){var _0x328925={};_0x328925[_0xb495d8['name']]={'$like':'%'+_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x39')]+'%'};return _0x328925;}})});}_0x140665=_[_0xd6b0('0x3a')]({},_0x140665,_0x9c9b9b[_0xd6b0('0x3d')]);var _0x193e22={'where':_0x140665[_0xd6b0('0x3b')]};return db[_0xd6b0('0x2b')]['count'](_0x193e22)[_0xd6b0('0x23')](function(_0x3c92df){_0xd8dbe8['count']=_0x3c92df;if(_0x9c9b9b[_0xd6b0('0x2e')][_0xd6b0('0x3e')]){_0x140665[_0xd6b0('0x3f')]=[{'all':!![]}];}return db[_0xd6b0('0x2b')]['findAll'](_0x140665);})[_0xd6b0('0x23')](function(_0x534720){_0xd8dbe8['rows']=_0x534720;return _0xd8dbe8;})['then'](respondWithFilteredResult(_0x566214,_0x140665))['catch'](handleError(_0x566214,null));};exports[_0xd6b0('0x40')]=function(_0x3ccc18,_0x4bc725){var _0x4385a7={'raw':![],'where':{'id':_0x3ccc18['params']['id']}},_0x1a4ff6={};_0x1a4ff6['model']=_[_0xd6b0('0x41')](db[_0xd6b0('0x2b')][_0xd6b0('0x2c')]);_0x1a4ff6[_0xd6b0('0x2e')]=_[_0xd6b0('0x41')](_0x3ccc18[_0xd6b0('0x2e')]);_0x1a4ff6[_0xd6b0('0x2f')]=_['intersection'](_0x1a4ff6[_0xd6b0('0x31')],_0x1a4ff6['query']);_0x4385a7[_0xd6b0('0x32')]=_['intersection'](_0x1a4ff6['model'],qs[_0xd6b0('0x33')](_0x3ccc18[_0xd6b0('0x2e')][_0xd6b0('0x33')]));_0x4385a7['attributes']=_0x4385a7[_0xd6b0('0x32')][_0xd6b0('0x42')]?_0x4385a7[_0xd6b0('0x32')]:_0x1a4ff6[_0xd6b0('0x31')];if(_0x3ccc18[_0xd6b0('0x2e')][_0xd6b0('0x3e')]){_0x4385a7['include']=[{'all':!![]}];}_0x4385a7=_['merge']({},_0x4385a7,_0x3ccc18['options']);return db['VoiceRecording']['find'](_0x4385a7)[_0xd6b0('0x23')](handleEntityNotFound(_0x4bc725,null))[_0xd6b0('0x23')](respondWithResult(_0x4bc725,null))['catch'](handleError(_0x4bc725,null));};exports[_0xd6b0('0x43')]=function(_0x2911c3,_0x218169){return db['VoiceRecording'][_0xd6b0('0x43')](_0x2911c3[_0xd6b0('0x44')],{})['then'](respondWithResult(_0x218169,0xc9))[_0xd6b0('0x45')](handleError(_0x218169,null));};exports[_0xd6b0('0x22')]=function(_0x484908,_0x4fbca1){if(_0x484908[_0xd6b0('0x44')]['id']){delete _0x484908[_0xd6b0('0x44')]['id'];}return db[_0xd6b0('0x2b')][_0xd6b0('0x46')]({'where':{'id':_0x484908[_0xd6b0('0x47')]['id']}})[_0xd6b0('0x23')](handleEntityNotFound(_0x4fbca1,null))['then'](saveUpdates(_0x484908[_0xd6b0('0x44')],null))[_0xd6b0('0x23')](respondWithResult(_0x4fbca1,null))[_0xd6b0('0x45')](handleError(_0x4fbca1,null));};exports[_0xd6b0('0x48')]=function(_0xd3a3,_0x2e457f){return db['VoiceRecording'][_0xd6b0('0x48')]()['then'](respondWithResult(_0x2e457f,null))[_0xd6b0('0x45')](handleError(_0x2e457f,null));};exports['download']=function(_0x512163,_0x4baef0,_0x9811ed){var _0x46e550=require(_0xd6b0('0x49'));var _0x1ccdf5=![];var _0x4eeb1e={};if(_0x512163['query'][_0xd6b0('0x2d')]&&_0x512163[_0xd6b0('0x2e')][_0xd6b0('0x2d')]==='uniqueid'){_0x4eeb1e[_0xd6b0('0x4a')]=_0x512163[_0xd6b0('0x47')]['id'];}else{_0x4eeb1e['id']=_0x512163[_0xd6b0('0x47')]['id'];}return db[_0xd6b0('0x2b')][_0xd6b0('0x46')]({'where':_0x4eeb1e,'attributes':['id',_0xd6b0('0x4b')],'raw':!![]})[_0xd6b0('0x23')](handleEntityNotFound(_0x4baef0,null))[_0xd6b0('0x23')](function(_0x4eb641){if(_0x4eb641){var _0x5e39da=_0x4eb641['value'];var _0x2aa640=util[_0xd6b0('0x4c')]('%s.cypher',_0x5e39da);if(fs[_0xd6b0('0x4d')](_0x2aa640)){_0x1ccdf5=!![];return _0x46e550[_0xd6b0('0x4e')](_0x2aa640,_0x5e39da,config[_0xd6b0('0x4f')][_0xd6b0('0x50')])[_0xd6b0('0x23')](function(){return _0x4eb641;});}return _0x4eb641;}})[_0xd6b0('0x23')](function(_0x34fe90){if(_0x34fe90){var _0x4d047b=_0x34fe90['value'];if(!fs[_0xd6b0('0x4d')](_0x4d047b)){throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x34fe90['filename']){return _0x4baef0[_0xd6b0('0x53')](_0x4d047b,_0x34fe90[_0xd6b0('0x54')]+path['extname'](_0x4d047b),function(){if(_0x1ccdf5){fs[_0xd6b0('0x55')](_0x4d047b);}});}else{return _0x4baef0[_0xd6b0('0x53')](_0x4d047b,function(_0x3f957f){if(_0x1ccdf5){fs[_0xd6b0('0x55')](_0x4d047b);}});}}})[_0xd6b0('0x45')](function(_0x3e0495){if(_0x3e0495['message']===_0xd6b0('0x56')){_0x4baef0['status'](0x194)[_0xd6b0('0x28')]('Not\x20found');}else{return handleError(_0x4baef0,null);}});};exports[_0xd6b0('0x57')]=function(_0x31b0a3,_0x54733b,_0xb9344){var _0x43c372=require(_0xd6b0('0x49'));var _0x1d97b2=![];var _0x12aa55={'$and':[db[_0xd6b0('0x58')][_0xd6b0('0x3b')](db[_0xd6b0('0x58')]['fn'](_0xd6b0('0x59'),db['sequelize']['col'](_0xd6b0('0x4a'))),_0x31b0a3[_0xd6b0('0x2e')][_0xd6b0('0x5a')])]};if(_0x31b0a3[_0xd6b0('0x2e')][_0xd6b0('0x2d')]&&_0x31b0a3['query'][_0xd6b0('0x2d')]==='uniqueid'){_0x12aa55[_0xd6b0('0x5b')]['push']({'uniqueid':_0x31b0a3[_0xd6b0('0x47')]['id']});}else{_0x12aa55[_0xd6b0('0x5b')][_0xd6b0('0x5c')]({'id':_0x31b0a3['params']['id']});}return db[_0xd6b0('0x2b')][_0xd6b0('0x46')]({'where':_0x12aa55,'attributes':['id',_0xd6b0('0x4b')],'raw':!![]})[_0xd6b0('0x23')](handleEntityNotFound(_0x54733b,null))[_0xd6b0('0x23')](function(_0x36f68b){if(_0x36f68b){var _0x4a97e1=util['format'](_0xd6b0('0x5d'),_0x36f68b[_0xd6b0('0x4b')]);if(fs['existsSync'](_0x4a97e1)){_0x1d97b2=!![];return _0x43c372[_0xd6b0('0x4e')](_0x4a97e1,_0x36f68b[_0xd6b0('0x4b')],config[_0xd6b0('0x4f')]['recording'])[_0xd6b0('0x23')](function(){return _0x36f68b;});}return _0x36f68b;}})[_0xd6b0('0x23')](function(_0x50ddc2){if(_0x50ddc2){if(!fs['existsSync'](_0x50ddc2['value'])){throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))](_0xd6b0('0x56'));}if(_0x50ddc2[_0xd6b0('0x54')]){return _0x54733b[_0xd6b0('0x53')](_0x50ddc2[_0xd6b0('0x4b')],_0x50ddc2[_0xd6b0('0x54')]+path['extname'](_0x50ddc2[_0xd6b0('0x4b')]),function(){if(_0x1d97b2){fs[_0xd6b0('0x55')](_0x50ddc2[_0xd6b0('0x4b')]);}});}else{return _0x54733b[_0xd6b0('0x53')](_0x50ddc2[_0xd6b0('0x4b')],function(_0xb5f601){if(_0x1d97b2){fs['unlink'](_0x50ddc2[_0xd6b0('0x4b')]);}});}}})[_0xd6b0('0x45')](handleError(_0x54733b,null));};exports[_0xd6b0('0x24')]=function(_0x499a74,_0x2e93cc){return db['VoiceRecording']['find']({'where':{'id':_0x499a74['params']['id']}})[_0xd6b0('0x23')](function(_0x5480a9){if(_[_0xd6b0('0x5e')](_0x5480a9)){throw new ReferenceError(_0xd6b0('0x5f'));}return _0x5480a9;})[_0xd6b0('0x23')](function(_0x382324){var _0x33a340=_0x382324[_0xd6b0('0x4b')];logger['info'](_0xd6b0('0x60'),_0x33a340);if(!_[_0xd6b0('0x5e')](_0x382324[_0xd6b0('0x4b')])&&fs[_0xd6b0('0x4d')](_0x33a340)){logger[_0xd6b0('0x61')](_0xd6b0('0x62')+_0x33a340+_0xd6b0('0x63'));fs['unlinkSync'](_0x33a340);}_0x33a340=_0x33a340+'.cypher';if(!_[_0xd6b0('0x5e')](_0x382324[_0xd6b0('0x4b')])&&fs['existsSync'](_0x33a340)){logger['info'](_0xd6b0('0x62')+_0x33a340+_0xd6b0('0x63'));fs[_0xd6b0('0x64')](_0x33a340);}return _0x382324;})[_0xd6b0('0x23')](function(_0x107cf2){if(!_0x107cf2)throw new InternalError();return _0x107cf2[_0xd6b0('0x24')]();})[_0xd6b0('0x23')](function(){_0x2e93cc[_0xd6b0('0x19')](0xcc)[_0xd6b0('0x25')]();})[_0xd6b0('0x45')](handleError(_0x2e93cc,null));};function getBucketslist(_0xc57b28,_0x2e34e7,_0x5d2e36){return new Promise(function(_0x19bae6,_0x1856bc){var _0x39dd79=new AWS['S3']({'accessKeyId':_0x2e34e7,'secretAccessKey':_0xc57b28,'region':_0x5d2e36});_0x39dd79[_0xd6b0('0x65')]({},function(_0x5789c0,_0x1b5247){if(_0x5789c0){return _0x1856bc(_0x5789c0);}else{return _0x19bae6(_0x1b5247);}});});}function createBucket(_0x56ec55,_0x4b6651,_0x37a90a,_0x262334){return new Promise(function(_0x317e52,_0x2f9ea){var _0x4e6ff4=new AWS['S3']({'accessKeyId':_0x4b6651,'secretAccessKey':_0x56ec55,'region':_0x37a90a});_0x4e6ff4[_0xd6b0('0x66')]({'Bucket':_0x262334},function(_0x2a6621,_0x72781c){if(_0x2a6621){return _0x2f9ea(_0x2a6621);}else{return _0x317e52(_0x72781c);}});});}function uploadFile(_0x1f3278,_0x2a7544,_0x5b0f8f,_0x2cc2a6,_0x403b65,_0x4729c6){return new Promise(function(_0x277025,_0x220015){var _0x44830e=new AWS['S3']({'accessKeyId':_0x2a7544,'secretAccessKey':_0x1f3278,'region':_0x5b0f8f});_0x44830e[_0xd6b0('0x67')]({'Bucket':_0x2cc2a6,'Key':_0x403b65,'Body':_0x4729c6},function(_0x54a139,_0x589dbc){if(_0x54a139){return _0x220015(_0x54a139);}else{return _0x277025(_0x589dbc);}});});}function startTranscribe(_0x3896c6,_0x8bdb94,_0x57d6fe,_0x53472f,_0x667c99,_0x1f7252){return new Promise(function(_0x53f27a,_0x354900){var _0x5ddd21=new AWS['TranscribeService']({'accessKeyId':_0x8bdb94,'secretAccessKey':_0x3896c6,'region':_0x57d6fe});_0x5ddd21[_0xd6b0('0x68')]({'TranscriptionJobName':_0x53472f,'LanguageCode':_0x667c99,'Media':{'MediaFileUri':_0x1f7252}},function(_0xfe0b3f,_0x352b16){if(_0xfe0b3f){return _0x354900(_0xfe0b3f);}else{return _0x53f27a(_0x352b16);}});});}function transcribe(_0x24cd43,_0x285715,_0x5d2528,_0x345a64,_0x1e8dc5,_0xe5435,_0xdc987b){return new Promise(function(_0x3e4986,_0x41180c){var _0x23f0d0={};logger[_0xd6b0('0x61')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x24cd43,_0x1e8dc5));return uploadFile(_0x285715,_0x5d2528,_0x345a64,_0x1e8dc5,path[_0xd6b0('0x69')](_0xe5435),fs[_0xd6b0('0x6a')](_0xe5435))[_0xd6b0('0x23')](function(_0x349b11){logger['info'](util['format'](_0xd6b0('0x6b'),_0x24cd43,_0x1e8dc5,_0x349b11[_0xd6b0('0x6c')]));_0x23f0d0[_0xd6b0('0x6d')]=_0x349b11[_0xd6b0('0x6e')];_0x23f0d0[_0xd6b0('0x6f')]=_0x349b11[_0xd6b0('0x6c')];logger[_0xd6b0('0x61')](util['format'](_0xd6b0('0x70'),_0x24cd43));return startTranscribe(_0x285715,_0x5d2528,_0x345a64,uuidv4(),_0xdc987b,_0x349b11[_0xd6b0('0x6c')]);})[_0xd6b0('0x23')](function(_0x46d68d){logger[_0xd6b0('0x61')](util[_0xd6b0('0x4c')](_0xd6b0('0x71'),_0x24cd43,_0x46d68d[_0xd6b0('0x72')]['TranscriptionJobName']));_0x23f0d0[_0xd6b0('0x73')]=_0x46d68d[_0xd6b0('0x72')]['TranscriptionJobName'];_0x23f0d0['transcribeStatus']=_0x46d68d[_0xd6b0('0x72')][_0xd6b0('0x74')];return _0x3e4986(_0x23f0d0);})[_0xd6b0('0x45')](function(_0x1a3ab5){return _0x41180c(_0x1a3ab5);});});}exports[_0xd6b0('0x75')]=function(_0x38e23c,_0x18b5d4,_0x1d78f3){var _0x19cd05;var _0x2e30b9;var _0x3b0709;var _0x4bf3e3=require('../../components/encryptor');return db[_0xd6b0('0x2b')][_0xd6b0('0x76')]({'where':{'id':_0x38e23c[_0xd6b0('0x47')]['id']}})[_0xd6b0('0x23')](function(_0x36873c){if(_0x36873c){var _0x528106=util[_0xd6b0('0x4c')](_0xd6b0('0x5d'),_0x36873c[_0xd6b0('0x4b')]);if(fs['existsSync'](_0x528106)){cypher=!![];return _0x4bf3e3[_0xd6b0('0x4e')](_0x528106,_0x36873c[_0xd6b0('0x4b')],config[_0xd6b0('0x4f')][_0xd6b0('0x50')])[_0xd6b0('0x23')](function(){return _0x36873c;});}return _0x36873c;}})[_0xd6b0('0x23')](function(_0x67c449){if(!_0x67c449){throw new db[(_0xd6b0('0x51'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x2e30b9=_0x67c449;return db[_0xd6b0('0x77')][_0xd6b0('0x76')]({'where':{'id':0x1}});})[_0xd6b0('0x23')](handleEntityNotFound(_0x18b5d4,null))[_0xd6b0('0x23')](function(_0xfd857d){if(_0xfd857d){_0x19cd05=_0xfd857d;if(!_0x19cd05[_0xd6b0('0x78')]||!_0x19cd05[_0xd6b0('0x79')]||!_0x19cd05[_0xd6b0('0x7a')]||!_0x19cd05[_0xd6b0('0x7b')]||!_0x19cd05[_0xd6b0('0x6d')]){throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))](_0xd6b0('0x7c'));}if(_0x38e23c[_0xd6b0('0x44')]['runSentiment']&&(!_0x19cd05[_0xd6b0('0x7d')]||!_0x19cd05[_0xd6b0('0x7e')]||!_0x19cd05[_0xd6b0('0x7f')]||!_0x19cd05[_0xd6b0('0x7b')]||!_0x19cd05[_0xd6b0('0x6d')])){throw new db[(_0xd6b0('0x51'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xd6b0('0x80')]['findOne']({'where':{'id':_0x19cd05[_0xd6b0('0x79')]}});}})[_0xd6b0('0x23')](function(_0x17b063){if(!_0x17b063){throw new db[(_0xd6b0('0x51'))]['ValidationError'](_0xd6b0('0x81'));}if(!_0x17b063[_0xd6b0('0x82')]||!_0x17b063[_0xd6b0('0x83')]){throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))]('Cloud\x20Provider\x20not\x20configured');}_0x3b0709=_0x17b063;return getBucketslist(_0x3b0709[_0xd6b0('0x82')],_0x3b0709[_0xd6b0('0x83')],_0x19cd05[_0xd6b0('0x7a')]);})[_0xd6b0('0x23')](function(_0x1feda7){if(_0x1feda7&&_0x1feda7[_0xd6b0('0x84')]){var _0x2523cd=_[_0xd6b0('0x46')](_0x1feda7[_0xd6b0('0x84')],function(_0x3bb276){return _0x3bb276[_0xd6b0('0x85')]===_0x19cd05[_0xd6b0('0x6d')];});if(!_0x2523cd){logger[_0xd6b0('0x61')](util[_0xd6b0('0x4c')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x38e23c[_0xd6b0('0x47')]['id'],_0x19cd05[_0xd6b0('0x6d')]));return createBucket(_0x3b0709['data1'],_0x3b0709[_0xd6b0('0x83')],_0x19cd05[_0xd6b0('0x7a')],_0x19cd05[_0xd6b0('0x6d')]);}logger['info'](util[_0xd6b0('0x4c')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x38e23c[_0xd6b0('0x47')]['id'],_0x19cd05[_0xd6b0('0x6d')]));return;}})[_0xd6b0('0x23')](function(_0x35c1d2){if(_0x2e30b9[_0xd6b0('0x86')]===_0xd6b0('0x87')){return transcribe(_0x38e23c[_0xd6b0('0x47')]['id'],_0x3b0709['data1'],_0x3b0709['data2'],_0x19cd05[_0xd6b0('0x7a')],_0x19cd05[_0xd6b0('0x6d')],_0x2e30b9[_0xd6b0('0x4b')],_0x19cd05[_0xd6b0('0x7b')]);}else{logger[_0xd6b0('0x61')](util['format'](_0xd6b0('0x88'),_0x38e23c['params']['id']));return{'transcribeStatus':_0xd6b0('0x89')};}})[_0xd6b0('0x23')](function(_0x4540cd){if(_0x4540cd){_0x4540cd[_0xd6b0('0x8a')]=_0x38e23c['body'][_0xd6b0('0x8b')];return _0x2e30b9['updateAttributes'](_0x4540cd);}})[_0xd6b0('0x23')](respondWithResult(_0x18b5d4,null))[_0xd6b0('0x45')](handleError(_0x18b5d4,null));};function writeFile(_0x4a69c4,_0x53c277){return new Promise(function(_0x5d498d,_0x2d10cb){fs['writeFile'](_0x53c277,_0x4a69c4,function(_0x222a85,_0x577575){if(_0x222a85){return _0x2d10cb(_0x222a85);}else{return _0x5d498d(_0x577575);}});});}exports['downloadTranscribe']=function(_0x8ddef0,_0x2252f8,_0x18128f){return db[_0xd6b0('0x2b')][_0xd6b0('0x76')]({'where':{'id':_0x8ddef0[_0xd6b0('0x47')]['id']}})['then'](handleEntityNotFound(_0x2252f8))[_0xd6b0('0x23')](function(_0x4488e4){if(_0x4488e4&&_0x4488e4['fileText']){var _0x2bf09a=_0x4488e4[_0xd6b0('0x8c')];var _0x26073a=config[_0xd6b0('0x8d')]+_0xd6b0('0x8e')+_0x4488e4['id']+_0xd6b0('0x8f');if(fs[_0xd6b0('0x4d')](_0x26073a)){return _0x26073a;}return writeFile(_0x2bf09a,_0x26073a)[_0xd6b0('0x23')](function(){return _0x26073a;});}else{throw new db[(_0xd6b0('0x51'))][(_0xd6b0('0x52'))](_0xd6b0('0x90'));}})['then'](function(_0x31e0f1){return _0x2252f8[_0xd6b0('0x53')](_0x31e0f1);})[_0xd6b0('0x45')](handleError(_0x2252f8));}; \ No newline at end of file +var _0xd851=['querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','body','describe','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','filename','extname','unlink','download','message','VoiceRecording\x20not\x20found','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','push','$and','recording','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x211f04,_0x828280){var _0x1eab0d=function(_0x36e9a3){while(--_0x36e9a3){_0x211f04['push'](_0x211f04['shift']());}};_0x1eab0d(++_0x828280);}(_0xd851,0x126));var _0x1d85=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0xd851[_0x2b737c];return _0x466ed5;};'use strict';var emlformat=require(_0x1d85('0x0'));var rimraf=require(_0x1d85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d85('0x2'));var rp=require(_0x1d85('0x3'));var moment=require(_0x1d85('0x4'));var BPromise=require(_0x1d85('0x5'));var Mustache=require(_0x1d85('0x6'));var util=require(_0x1d85('0x7'));var path=require(_0x1d85('0x8'));var sox=require(_0x1d85('0x9'));var csv=require(_0x1d85('0xa'));var ejs=require(_0x1d85('0xb'));var fs=require('fs');var fs_extra=require(_0x1d85('0xc'));var _=require(_0x1d85('0xd'));var squel=require(_0x1d85('0xe'));var crypto=require(_0x1d85('0xf'));var jsforce=require(_0x1d85('0x10'));var deskjs=require(_0x1d85('0x11'));var toCsv=require(_0x1d85('0xa'));var querystring=require(_0x1d85('0x12'));var Papa=require('papaparse');var AWS=require(_0x1d85('0x13'));var uuidv4=require(_0x1d85('0x14'));var Redis=require(_0x1d85('0x15'));var authService=require(_0x1d85('0x16'));var qs=require(_0x1d85('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d85('0x18'))(_0x1d85('0x19'));var utils=require(_0x1d85('0x1a'));var config=require(_0x1d85('0x1b'));var licenseUtil=require(_0x1d85('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbd35f7,_0x16bd23){_0x16bd23=_0x16bd23||0xcc;return function(_0x1e4254){if(_0x1e4254){return _0xbd35f7[_0x1d85('0x1d')](_0x16bd23);}return _0xbd35f7[_0x1d85('0x1e')](_0x16bd23)[_0x1d85('0x1f')]();};}function respondWithResult(_0x4d8d3b,_0x53c949){_0x53c949=_0x53c949||0xc8;return function(_0x367c73){if(_0x367c73){return _0x4d8d3b[_0x1d85('0x1e')](_0x53c949)['json'](_0x367c73);}};}function respondWithFilteredResult(_0x3672fa,_0x239441){return function(_0x4bdf2b){if(_0x4bdf2b){var _0x5db088=typeof _0x239441[_0x1d85('0x20')]===_0x1d85('0x21')&&typeof _0x239441[_0x1d85('0x22')]==='undefined';var _0x2923d9=_0x4bdf2b[_0x1d85('0x23')];var _0x6f5a81=_0x5db088?0x0:_0x239441['offset'];var _0x5ea833=_0x5db088?_0x4bdf2b[_0x1d85('0x23')]:_0x239441[_0x1d85('0x20')]+_0x239441[_0x1d85('0x22')];var _0xe5bef1;if(_0x5ea833>=_0x2923d9){_0x5ea833=_0x2923d9;_0xe5bef1=0xc8;}else{_0xe5bef1=0xce;}_0x3672fa[_0x1d85('0x1e')](_0xe5bef1);return _0x3672fa[_0x1d85('0x24')]('Content-Range',_0x6f5a81+'-'+_0x5ea833+'/'+_0x2923d9)[_0x1d85('0x25')](_0x4bdf2b);}return null;};}function patchUpdates(_0x2937b0){return function(_0x4ad920){try{jsonpatch[_0x1d85('0x26')](_0x4ad920,_0x2937b0,!![]);}catch(_0x5f5d3c){return BPromise[_0x1d85('0x27')](_0x5f5d3c);}return _0x4ad920[_0x1d85('0x28')]();};}function saveUpdates(_0x240b14,_0x24af58){return function(_0x3620ce){if(_0x3620ce){return _0x3620ce[_0x1d85('0x29')](_0x240b14)[_0x1d85('0x2a')](function(_0x5502e3){return _0x5502e3;});}return null;};}function removeEntity(_0x56117b,_0x148273){return function(_0x2b89a1){if(_0x2b89a1){return _0x2b89a1[_0x1d85('0x2b')]()[_0x1d85('0x2a')](function(){_0x56117b[_0x1d85('0x1e')](0xcc)[_0x1d85('0x1f')]();});}};}function handleEntityNotFound(_0x275e05,_0x2f308e){return function(_0x182d5b){if(!_0x182d5b){_0x275e05['sendStatus'](0x194);}return _0x182d5b;};}function handleError(_0x4e51d4,_0x4b5c05){_0x4b5c05=_0x4b5c05||0x1f4;return function(_0x558ea0){logger[_0x1d85('0x2c')](_0x558ea0[_0x1d85('0x2d')]);if(_0x558ea0['name']){delete _0x558ea0[_0x1d85('0x2e')];}_0x4e51d4[_0x1d85('0x1e')](_0x4b5c05)[_0x1d85('0x2f')](_0x558ea0);};}exports[_0x1d85('0x30')]=function(_0x4cb842,_0x43d66){var _0x178c3a={},_0xeae8d8={},_0x43092f={'count':0x0,'rows':[]};var _0x2f03f4=_[_0x1d85('0x31')](db[_0x1d85('0x32')][_0x1d85('0x33')],function(_0x5827bf){return{'name':_0x5827bf[_0x1d85('0x34')],'type':_0x5827bf[_0x1d85('0x35')][_0x1d85('0x36')]};});_0xeae8d8[_0x1d85('0x37')]=_['differenceBy'](_[_0x1d85('0x31')](_0x2f03f4,'name'),['format']);_0xeae8d8[_0x1d85('0x38')]=_[_0x1d85('0x39')](_0x4cb842[_0x1d85('0x38')]);_0xeae8d8[_0x1d85('0x3a')]=_[_0x1d85('0x3b')](_0xeae8d8[_0x1d85('0x37')],_0xeae8d8['query']);_0x178c3a[_0x1d85('0x3c')]=_[_0x1d85('0x3b')](_0xeae8d8[_0x1d85('0x37')],qs['fields'](_0x4cb842['query'][_0x1d85('0x3d')]));_0x178c3a[_0x1d85('0x3c')]=_0x178c3a[_0x1d85('0x3c')][_0x1d85('0x3e')]?_0x178c3a['attributes']:_0xeae8d8['model'];if(!_0x4cb842[_0x1d85('0x38')]['hasOwnProperty'](_0x1d85('0x3f'))){_0x178c3a[_0x1d85('0x22')]=qs[_0x1d85('0x22')](_0x4cb842['query']['limit']);_0x178c3a[_0x1d85('0x20')]=qs[_0x1d85('0x20')](_0x4cb842[_0x1d85('0x38')]['offset']);}_0x178c3a['order']=qs[_0x1d85('0x40')](_0x4cb842[_0x1d85('0x38')][_0x1d85('0x40')]);_0x178c3a['where']=qs[_0x1d85('0x3a')](_[_0x1d85('0x41')](_0x4cb842['query'],_0xeae8d8[_0x1d85('0x3a')]),_0x2f03f4);if(_0x4cb842['query'][_0x1d85('0x42')]){_0x178c3a[_0x1d85('0x43')]=_[_0x1d85('0x44')](_0x178c3a['where'],{'$or':_[_0x1d85('0x31')](_0x2f03f4,function(_0x332095){if(_0x332095[_0x1d85('0x35')]!==_0x1d85('0x45')){var _0x6496c4={};_0x6496c4[_0x332095[_0x1d85('0x2e')]]={'$like':'%'+_0x4cb842[_0x1d85('0x38')]['filter']+'%'};return _0x6496c4;}})});}_0x178c3a=_[_0x1d85('0x44')]({},_0x178c3a,_0x4cb842[_0x1d85('0x46')]);var _0x427554={'where':_0x178c3a[_0x1d85('0x43')]};return db['VoiceRecording'][_0x1d85('0x23')](_0x427554)[_0x1d85('0x2a')](function(_0x3678c2){_0x43092f[_0x1d85('0x23')]=_0x3678c2;if(_0x4cb842[_0x1d85('0x38')][_0x1d85('0x47')]){_0x178c3a['include']=[{'all':!![]}];}return db[_0x1d85('0x32')][_0x1d85('0x48')](_0x178c3a);})[_0x1d85('0x2a')](function(_0x103e32){_0x43092f['rows']=_0x103e32;return _0x43092f;})[_0x1d85('0x2a')](respondWithFilteredResult(_0x43d66,_0x178c3a))[_0x1d85('0x49')](handleError(_0x43d66,null));};exports[_0x1d85('0x4a')]=function(_0x4482ce,_0x263f32){var _0x232389={'raw':![],'where':{'id':_0x4482ce[_0x1d85('0x4b')]['id']}},_0xc29382={};_0xc29382['model']=_['keys'](db['VoiceRecording'][_0x1d85('0x33')]);_0xc29382['query']=_[_0x1d85('0x39')](_0x4482ce[_0x1d85('0x38')]);_0xc29382[_0x1d85('0x3a')]=_['intersection'](_0xc29382[_0x1d85('0x37')],_0xc29382[_0x1d85('0x38')]);_0x232389[_0x1d85('0x3c')]=_[_0x1d85('0x3b')](_0xc29382[_0x1d85('0x37')],qs[_0x1d85('0x3d')](_0x4482ce[_0x1d85('0x38')][_0x1d85('0x3d')]));_0x232389[_0x1d85('0x3c')]=_0x232389[_0x1d85('0x3c')][_0x1d85('0x3e')]?_0x232389['attributes']:_0xc29382[_0x1d85('0x37')];if(_0x4482ce[_0x1d85('0x38')]['includeAll']){_0x232389[_0x1d85('0x4c')]=[{'all':!![]}];}_0x232389=_['merge']({},_0x232389,_0x4482ce[_0x1d85('0x46')]);return db[_0x1d85('0x32')][_0x1d85('0x4d')](_0x232389)[_0x1d85('0x2a')](handleEntityNotFound(_0x263f32,null))[_0x1d85('0x2a')](respondWithResult(_0x263f32,null))[_0x1d85('0x49')](handleError(_0x263f32,null));};exports['create']=function(_0x2e8451,_0x522574){return db[_0x1d85('0x32')]['create'](_0x2e8451['body'],{})[_0x1d85('0x2a')](respondWithResult(_0x522574,0xc9))[_0x1d85('0x49')](handleError(_0x522574,null));};exports[_0x1d85('0x29')]=function(_0x44c46c,_0x4589b5){if(_0x44c46c[_0x1d85('0x4e')]['id']){delete _0x44c46c['body']['id'];}return db['VoiceRecording'][_0x1d85('0x4d')]({'where':{'id':_0x44c46c[_0x1d85('0x4b')]['id']}})[_0x1d85('0x2a')](handleEntityNotFound(_0x4589b5,null))[_0x1d85('0x2a')](saveUpdates(_0x44c46c['body'],null))[_0x1d85('0x2a')](respondWithResult(_0x4589b5,null))[_0x1d85('0x49')](handleError(_0x4589b5,null));};exports['describe']=function(_0x1d8c0a,_0x1f9bc1){return db[_0x1d85('0x32')][_0x1d85('0x4f')]()[_0x1d85('0x2a')](respondWithResult(_0x1f9bc1,null))[_0x1d85('0x49')](handleError(_0x1f9bc1,null));};exports['download']=function(_0x2a9905,_0x86a604,_0x421d0d){var _0x28854b=require('../../components/encryptor');var _0x1bf53f=![];var _0x38b847={};if(_0x2a9905[_0x1d85('0x38')][_0x1d85('0x35')]&&_0x2a9905[_0x1d85('0x38')][_0x1d85('0x35')]==='uniqueid'){_0x38b847[_0x1d85('0x50')]=_0x2a9905['params']['id'];}else{_0x38b847['id']=_0x2a9905[_0x1d85('0x4b')]['id'];}return db[_0x1d85('0x32')][_0x1d85('0x4d')]({'where':_0x38b847,'attributes':['id',_0x1d85('0x51')],'raw':!![]})[_0x1d85('0x2a')](handleEntityNotFound(_0x86a604,null))[_0x1d85('0x2a')](function(_0x51e067){if(_0x51e067){var _0x1f514c=_0x51e067[_0x1d85('0x51')];var _0x49d82f=util[_0x1d85('0x52')](_0x1d85('0x53'),_0x1f514c);if(fs[_0x1d85('0x54')](_0x49d82f)){_0x1bf53f=!![];return _0x28854b[_0x1d85('0x55')](_0x49d82f,_0x1f514c,config[_0x1d85('0x56')]['recording'])[_0x1d85('0x2a')](function(){return _0x51e067;});}return _0x51e067;}})['then'](function(_0x38b8ce){if(_0x38b8ce){var _0x166a1c=_0x38b8ce[_0x1d85('0x51')];if(!fs[_0x1d85('0x54')](_0x166a1c)){throw new db[(_0x1d85('0x57'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x38b8ce[_0x1d85('0x58')]){return _0x86a604['download'](_0x166a1c,_0x38b8ce[_0x1d85('0x58')]+path[_0x1d85('0x59')](_0x166a1c),function(){if(_0x1bf53f){fs[_0x1d85('0x5a')](_0x166a1c);}});}else{return _0x86a604[_0x1d85('0x5b')](_0x166a1c,function(_0x48a03e){if(_0x1bf53f){fs[_0x1d85('0x5a')](_0x166a1c);}});}}})[_0x1d85('0x49')](function(_0x42bc49){if(_0x42bc49[_0x1d85('0x5c')]===_0x1d85('0x5d')){_0x86a604[_0x1d85('0x1e')](0x194)[_0x1d85('0x2f')](_0x1d85('0x5e'));}else{return handleError(_0x86a604,null);}});};exports['downloads']=function(_0x10e43b,_0x5c54fe,_0xa04e7b){var _0xbcec15=require(_0x1d85('0x5f'));var _0x5d21af=![];var _0x255312={'$and':[db[_0x1d85('0x60')]['where'](db[_0x1d85('0x60')]['fn'](_0x1d85('0x61'),db[_0x1d85('0x60')][_0x1d85('0x62')](_0x1d85('0x50'))),_0x10e43b[_0x1d85('0x38')][_0x1d85('0x63')])]};if(_0x10e43b['query'][_0x1d85('0x35')]&&_0x10e43b['query'][_0x1d85('0x35')]===_0x1d85('0x50')){_0x255312['$and'][_0x1d85('0x64')]({'uniqueid':_0x10e43b[_0x1d85('0x4b')]['id']});}else{_0x255312[_0x1d85('0x65')][_0x1d85('0x64')]({'id':_0x10e43b[_0x1d85('0x4b')]['id']});}return db[_0x1d85('0x32')][_0x1d85('0x4d')]({'where':_0x255312,'attributes':['id',_0x1d85('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x5c54fe,null))[_0x1d85('0x2a')](function(_0x124a2f){if(_0x124a2f){var _0x4b2ad6=util['format']('%s.cypher',_0x124a2f[_0x1d85('0x51')]);if(fs[_0x1d85('0x54')](_0x4b2ad6)){_0x5d21af=!![];return _0xbcec15[_0x1d85('0x55')](_0x4b2ad6,_0x124a2f[_0x1d85('0x51')],config[_0x1d85('0x56')][_0x1d85('0x66')])[_0x1d85('0x2a')](function(){return _0x124a2f;});}return _0x124a2f;}})['then'](function(_0x126b86){if(_0x126b86){if(!fs[_0x1d85('0x54')](_0x126b86[_0x1d85('0x51')])){throw new db[(_0x1d85('0x57'))][(_0x1d85('0x67'))](_0x1d85('0x5d'));}if(_0x126b86[_0x1d85('0x58')]){return _0x5c54fe[_0x1d85('0x5b')](_0x126b86['value'],_0x126b86['filename']+path[_0x1d85('0x59')](_0x126b86[_0x1d85('0x51')]),function(){if(_0x5d21af){fs['unlink'](_0x126b86[_0x1d85('0x51')]);}});}else{return _0x5c54fe['download'](_0x126b86['value'],function(_0xc5c474){if(_0x5d21af){fs[_0x1d85('0x5a')](_0x126b86[_0x1d85('0x51')]);}});}}})[_0x1d85('0x49')](handleError(_0x5c54fe,null));};exports['destroy']=function(_0x47d1ab,_0x16d3b8){return db[_0x1d85('0x32')][_0x1d85('0x4d')]({'where':{'id':_0x47d1ab['params']['id']}})[_0x1d85('0x2a')](function(_0x47188f){if(_[_0x1d85('0x68')](_0x47188f)){throw new ReferenceError(_0x1d85('0x69'));}return _0x47188f;})[_0x1d85('0x2a')](function(_0x2e9f60){var _0x296657=_0x2e9f60[_0x1d85('0x51')];logger[_0x1d85('0x6a')](_0x1d85('0x6b'),_0x296657);if(!_['isNil'](_0x2e9f60['value'])&&fs[_0x1d85('0x54')](_0x296657)){logger[_0x1d85('0x6a')]('File:\x20\x22'+_0x296657+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1d85('0x6c')](_0x296657);}_0x296657=_0x296657+_0x1d85('0x6d');if(!_[_0x1d85('0x68')](_0x2e9f60[_0x1d85('0x51')])&&fs['existsSync'](_0x296657)){logger['info'](_0x1d85('0x6e')+_0x296657+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1d85('0x6c')](_0x296657);}return _0x2e9f60;})[_0x1d85('0x2a')](function(_0x3feb1b){if(!_0x3feb1b)throw new InternalError();return _0x3feb1b['destroy']();})[_0x1d85('0x2a')](function(){_0x16d3b8[_0x1d85('0x1e')](0xcc)[_0x1d85('0x1f')]();})[_0x1d85('0x49')](handleError(_0x16d3b8,null));};function getBucketslist(_0x8aac75,_0x2601b3,_0x117712){return new Promise(function(_0x14befe,_0x5a3e15){var _0x3bf327=new AWS['S3']({'accessKeyId':_0x2601b3,'secretAccessKey':_0x8aac75,'region':_0x117712});_0x3bf327[_0x1d85('0x6f')]({},function(_0x28cf96,_0x858c33){if(_0x28cf96){return _0x5a3e15(_0x28cf96);}else{return _0x14befe(_0x858c33);}});});}function createBucket(_0x4f973c,_0x25da29,_0x435738,_0x410f23){return new Promise(function(_0x15133e,_0x160ba7){var _0x2307d4=new AWS['S3']({'accessKeyId':_0x25da29,'secretAccessKey':_0x4f973c,'region':_0x435738});_0x2307d4[_0x1d85('0x70')]({'Bucket':_0x410f23},function(_0x2897a1,_0x346a0b){if(_0x2897a1){return _0x160ba7(_0x2897a1);}else{return _0x15133e(_0x346a0b);}});});}function uploadFile(_0x3da931,_0x58b75f,_0x1cdb3d,_0x1863be,_0x33e4ef,_0x178ccc){return new Promise(function(_0x594283,_0x3b26f8){var _0x1e0b53=new AWS['S3']({'accessKeyId':_0x58b75f,'secretAccessKey':_0x3da931,'region':_0x1cdb3d});_0x1e0b53[_0x1d85('0x71')]({'Bucket':_0x1863be,'Key':_0x33e4ef,'Body':_0x178ccc},function(_0x7a13d3,_0xc2e049){if(_0x7a13d3){return _0x3b26f8(_0x7a13d3);}else{return _0x594283(_0xc2e049);}});});}function startTranscribe(_0x5d41b7,_0x24fdb0,_0x2a6580,_0xd53d2b,_0x84a199,_0x1b81f3){return new Promise(function(_0x11bc90,_0x4b0178){var _0x605900=new AWS['TranscribeService']({'accessKeyId':_0x24fdb0,'secretAccessKey':_0x5d41b7,'region':_0x2a6580});_0x605900['startTranscriptionJob']({'TranscriptionJobName':_0xd53d2b,'LanguageCode':_0x84a199,'Media':{'MediaFileUri':_0x1b81f3}},function(_0x19d662,_0xe1e3c9){if(_0x19d662){return _0x4b0178(_0x19d662);}else{return _0x11bc90(_0xe1e3c9);}});});}function transcribe(_0x2a6af3,_0x23fd09,_0x4e0edb,_0x19b47e,_0xf42734,_0x12502e,_0x3ae4bc){return new Promise(function(_0x4b3242,_0x282efe){var _0x1e91a7={};logger[_0x1d85('0x6a')](util[_0x1d85('0x52')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2a6af3,_0xf42734));return uploadFile(_0x23fd09,_0x4e0edb,_0x19b47e,_0xf42734,path[_0x1d85('0x72')](_0x12502e),fs[_0x1d85('0x73')](_0x12502e))['then'](function(_0x2e4bec){logger[_0x1d85('0x6a')](util[_0x1d85('0x52')](_0x1d85('0x74'),_0x2a6af3,_0xf42734,_0x2e4bec[_0x1d85('0x75')]));_0x1e91a7[_0x1d85('0x76')]=_0x2e4bec[_0x1d85('0x77')];_0x1e91a7[_0x1d85('0x78')]=_0x2e4bec[_0x1d85('0x75')];logger[_0x1d85('0x6a')](util[_0x1d85('0x52')](_0x1d85('0x79'),_0x2a6af3));return startTranscribe(_0x23fd09,_0x4e0edb,_0x19b47e,uuidv4(),_0x3ae4bc,_0x2e4bec[_0x1d85('0x75')]);})[_0x1d85('0x2a')](function(_0x421976){logger[_0x1d85('0x6a')](util['format'](_0x1d85('0x7a'),_0x2a6af3,_0x421976[_0x1d85('0x7b')][_0x1d85('0x7c')]));_0x1e91a7[_0x1d85('0x7d')]=_0x421976[_0x1d85('0x7b')][_0x1d85('0x7c')];_0x1e91a7['transcribeStatus']=_0x421976[_0x1d85('0x7b')][_0x1d85('0x7e')];return _0x4b3242(_0x1e91a7);})['catch'](function(_0x1f1a9b){return _0x282efe(_0x1f1a9b);});});}exports[_0x1d85('0x7f')]=function(_0x2efd35,_0x494925,_0x2b92c6){var _0x1904af;var _0x4418e9;var _0x337ad4;var _0x3f3736=require('../../components/encryptor');return db[_0x1d85('0x32')][_0x1d85('0x80')]({'where':{'id':_0x2efd35['params']['id']}})[_0x1d85('0x2a')](function(_0x1d8622){if(_0x1d8622){var _0x1c94e6=util[_0x1d85('0x52')](_0x1d85('0x53'),_0x1d8622[_0x1d85('0x51')]);if(fs['existsSync'](_0x1c94e6)){cypher=!![];return _0x3f3736['decryptFile'](_0x1c94e6,_0x1d8622['value'],config['secrets'][_0x1d85('0x66')])[_0x1d85('0x2a')](function(){return _0x1d8622;});}return _0x1d8622;}})[_0x1d85('0x2a')](function(_0x4001f3){if(!_0x4001f3){throw new db['Sequelize'][(_0x1d85('0x67'))](_0x1d85('0x81'));}_0x4418e9=_0x4001f3;return db[_0x1d85('0x82')][_0x1d85('0x80')]({'where':{'id':0x1}});})[_0x1d85('0x2a')](handleEntityNotFound(_0x494925,null))[_0x1d85('0x2a')](function(_0x118904){if(_0x118904){_0x1904af=_0x118904;if(!_0x1904af['transcribe']||!_0x1904af[_0x1d85('0x83')]||!_0x1904af[_0x1d85('0x84')]||!_0x1904af[_0x1d85('0x85')]||!_0x1904af[_0x1d85('0x76')]){throw new db[(_0x1d85('0x57'))][(_0x1d85('0x67'))](_0x1d85('0x86'));}if(_0x2efd35[_0x1d85('0x4e')][_0x1d85('0x87')]&&(!_0x1904af[_0x1d85('0x88')]||!_0x1904af[_0x1d85('0x89')]||!_0x1904af[_0x1d85('0x8a')]||!_0x1904af[_0x1d85('0x85')]||!_0x1904af[_0x1d85('0x76')])){throw new db['Sequelize'][(_0x1d85('0x67'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x1d85('0x8b')]['findOne']({'where':{'id':_0x1904af[_0x1d85('0x83')]}});}})['then'](function(_0x502914){if(!_0x502914){throw new db[(_0x1d85('0x57'))][(_0x1d85('0x67'))](_0x1d85('0x8c'));}if(!_0x502914[_0x1d85('0x8d')]||!_0x502914[_0x1d85('0x8e')]){throw new db['Sequelize'][(_0x1d85('0x67'))](_0x1d85('0x8f'));}_0x337ad4=_0x502914;return getBucketslist(_0x337ad4['data1'],_0x337ad4[_0x1d85('0x8e')],_0x1904af['transcribeRegion']);})['then'](function(_0x575431){if(_0x575431&&_0x575431[_0x1d85('0x90')]){var _0x5d0f3b=_[_0x1d85('0x4d')](_0x575431['Buckets'],function(_0x204344){return _0x204344['Name']===_0x1904af['bucket'];});if(!_0x5d0f3b){logger[_0x1d85('0x6a')](util[_0x1d85('0x52')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x2efd35['params']['id'],_0x1904af['bucket']));return createBucket(_0x337ad4[_0x1d85('0x8d')],_0x337ad4['data2'],_0x1904af[_0x1d85('0x84')],_0x1904af[_0x1d85('0x76')]);}logger[_0x1d85('0x6a')](util[_0x1d85('0x52')](_0x1d85('0x91'),_0x2efd35[_0x1d85('0x4b')]['id'],_0x1904af[_0x1d85('0x76')]));return;}})[_0x1d85('0x2a')](function(_0x2ece76){if(_0x4418e9[_0x1d85('0x92')]===_0x1d85('0x93')){return transcribe(_0x2efd35['params']['id'],_0x337ad4[_0x1d85('0x8d')],_0x337ad4[_0x1d85('0x8e')],_0x1904af[_0x1d85('0x84')],_0x1904af[_0x1d85('0x76')],_0x4418e9[_0x1d85('0x51')],_0x1904af[_0x1d85('0x85')]);}else{logger[_0x1d85('0x6a')](util[_0x1d85('0x52')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x2efd35[_0x1d85('0x4b')]['id']));return{'transcribeStatus':_0x1d85('0x94')};}})[_0x1d85('0x2a')](function(_0x3ea646){if(_0x3ea646){_0x3ea646[_0x1d85('0x95')]=_0x2efd35[_0x1d85('0x4e')]['runSentiment'];return _0x4418e9[_0x1d85('0x96')](_0x3ea646);}})['then'](respondWithResult(_0x494925,null))[_0x1d85('0x49')](handleError(_0x494925,null));};function writeFile(_0x56b3de,_0x3445e0){return new Promise(function(_0x53d2d4,_0x25ea75){fs[_0x1d85('0x97')](_0x3445e0,_0x56b3de,function(_0x105693,_0x1708b8){if(_0x105693){return _0x25ea75(_0x105693);}else{return _0x53d2d4(_0x1708b8);}});});}exports['downloadTranscribe']=function(_0x4ac402,_0x529816,_0x14f339){return db['VoiceRecording'][_0x1d85('0x80')]({'where':{'id':_0x4ac402[_0x1d85('0x4b')]['id']}})[_0x1d85('0x2a')](handleEntityNotFound(_0x529816))['then'](function(_0x39d67b){if(_0x39d67b&&_0x39d67b[_0x1d85('0x98')]){var _0x18bacc=_0x39d67b['fileText'];var _0x26a9c7=config[_0x1d85('0x99')]+_0x1d85('0x9a')+_0x39d67b['id']+_0x1d85('0x9b');if(fs[_0x1d85('0x54')](_0x26a9c7)){return _0x26a9c7;}return writeFile(_0x18bacc,_0x26a9c7)['then'](function(){return _0x26a9c7;});}else{throw new db[(_0x1d85('0x57'))][(_0x1d85('0x67'))]('Transcript\x20not\x20available');}})[_0x1d85('0x2a')](function(_0x25b857){return _0x529816['download'](_0x25b857);})[_0x1d85('0x49')](handleError(_0x529816));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index af2dc9a..a5e6e74 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 _0xb4e6=['./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','transcribeStatus'];(function(_0x241d2d,_0xf2d330){var _0x21c5bd=function(_0x36f23c){while(--_0x36f23c){_0x241d2d['push'](_0x241d2d['shift']());}};_0x21c5bd(++_0xf2d330);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0xb4e6[_0x15fc7a];return _0x3aa9f4;};'use strict';var attributes=require(_0x6b4e('0x0'));module[_0x6b4e('0x1')]=function(_0x3c385b,_0x9babca){return _0x3c385b[_0x6b4e('0x2')](_0x6b4e('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x6b4e('0x4'),'fields':['uniqueid']},{'name':_0x6b4e('0x5'),'fields':[_0x6b4e('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x780f=['define','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x4ec072,_0x17fa5c){var _0x641d2b=function(_0x994344){while(--_0x994344){_0x4ec072['push'](_0x4ec072['shift']());}};_0x641d2b(++_0x17fa5c);}(_0x780f,0x6c));var _0xf780=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x780f[_0x456fb1];return _0x4083d6;};'use strict';var attributes=require(_0xf780('0x0'));module[_0xf780('0x1')]=function(_0x2dcf59,_0x30f072){return _0x2dcf59[_0xf780('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xf780('0x3'),'fields':[_0xf780('0x3')]},{'name':_0xf780('0x4'),'fields':[_0xf780('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d5b9909..ec98771 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 _0x6a55=['callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateVoiceRecording','update','body','options','where','limit','findOne'];(function(_0x5d570d,_0x2aeca4){var _0x485ea0=function(_0x1ec20c){while(--_0x1ec20c){_0x5d570d['push'](_0x5d570d['shift']());}};_0x485ea0(++_0x2aeca4);}(_0x6a55,0xdb));var _0x56a5=function(_0x4ca796,_0x10dc47){_0x4ca796=_0x4ca796-0x0;var _0x171f87=_0x6a55[_0x4ca796];return _0x171f87;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});}exports[_0x56a5('0x13')]=function(_0x28fe74){var _0x1ba472=this;return new Promise(function(_0x143f3d,_0x1dddec){return db['VoiceRecording'][_0x56a5('0x14')](_0x28fe74[_0x56a5('0x15')],{'raw':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x17')]||null:null,'attributes':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['attributes']||null:null,'limit':_0x28fe74['options']?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x18')]||null:null})['then'](function(_0x1556eb){logger[_0x56a5('0x8')](_0x56a5('0x13'),_0x28fe74);logger[_0x56a5('0xb')](_0x56a5('0x13'),_0x28fe74,JSON[_0x56a5('0xd')](_0x1556eb));_0x143f3d(_0x1556eb);})[_0x56a5('0x12')](function(_0x8431df){logger[_0x56a5('0xf')](_0x56a5('0x13'),_0x8431df[_0x56a5('0x10')],_0x28fe74);_0x1dddec(_0x1ba472[_0x56a5('0xf')](0x1f4,_0x8431df[_0x56a5('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5c76a7){var _0x2d8e68=this;return new Promise(function(_0x42cd45,_0x2706f9){var _0x43a815=require('../../components/encryptor');var _0x18e863;return db['Setting'][_0x56a5('0x19')]({'attributes':['id',_0x56a5('0x1a')],'where':{'id':0x1},'raw':!![]})[_0x56a5('0x7')](function(_0x284ee5){_0x18e863=_0x284ee5;return db['VoiceRecording'][_0x56a5('0x1b')](_0x5c76a7[_0x56a5('0x15')]);})[_0x56a5('0x7')](function(_0x51ef6f){if(_0x18e863[_0x56a5('0x1a')]&&fs[_0x56a5('0x1c')](_0x51ef6f[_0x56a5('0x1d')])){var _0x214649=util[_0x56a5('0x1e')]('%s.cypher',_0x51ef6f[_0x56a5('0x1d')]);return _0x43a815[_0x56a5('0x1f')](_0x51ef6f[_0x56a5('0x1d')],_0x214649,config[_0x56a5('0x20')][_0x56a5('0x21')])['then'](function(){fs['unlink'](_0x51ef6f[_0x56a5('0x1d')]);logger[_0x56a5('0x8')](_0x56a5('0x22'));return _0x51ef6f;});}return _0x51ef6f;})['then'](function(_0x1de021){logger[_0x56a5('0x8')]('CreateVoiceRecording',_0x5c76a7);logger['debug']('CreateVoiceRecording',_0x5c76a7,JSON['stringify'](_0x1de021));_0x42cd45(_0x1de021);})[_0x56a5('0x12')](function(_0x29c8f1){logger[_0x56a5('0xf')]('CreateVoiceRecording',_0x29c8f1[_0x56a5('0x10')],_0x5c76a7);_0x2706f9(_0x2d8e68['error'](0x1f4,_0x29c8f1[_0x56a5('0x10')]));});});}; \ No newline at end of file +var _0x524e=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','recording','unlink','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording','update','options','where','attributes','limit'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x524e,0x15e));var _0xe524=function(_0x124eef,_0x41038e){_0x124eef=_0x124eef-0x0;var _0x49b33d=_0x524e[_0x124eef];return _0x49b33d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['UpdateVoiceRecording']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')](_0x3a4027['body'],{'raw':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null})['then'](function(_0x7d1f92){logger['info']('UpdateVoiceRecording',_0x3a4027);logger[_0xe524('0x10')](_0xe524('0x1c'),_0x3a4027,JSON[_0xe524('0x12')](_0x7d1f92));_0x11b2a1(_0x7d1f92);})[_0xe524('0x1d')](function(_0x599d5d){logger[_0xe524('0x13')]('UpdateVoiceRecording',_0x599d5d[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb[_0xe524('0x13')](0x1f4,_0x599d5d[_0xe524('0x15')]));});});};exports[_0xe524('0x1e')]=function(_0x4102d9){var _0xfd5965=this;return new Promise(function(_0x2141db,_0x583cc3){var _0x58a896=require(_0xe524('0x1f'));var _0x45abad;return db[_0xe524('0x20')][_0xe524('0x21')]({'attributes':['id',_0xe524('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x52f140){_0x45abad=_0x52f140;return db[_0xe524('0x16')][_0xe524('0x23')](_0x4102d9[_0xe524('0x24')]);})[_0xe524('0xc')](function(_0x25c0a1){if(_0x45abad['callRecordingEncryption']&&fs[_0xe524('0x25')](_0x25c0a1[_0xe524('0x26')])){var _0x4a4e15=util['format'](_0xe524('0x27'),_0x25c0a1[_0xe524('0x26')]);return _0x58a896['encryptFile'](_0x25c0a1[_0xe524('0x26')],_0x4a4e15,config['secrets'][_0xe524('0x28')])['then'](function(){fs[_0xe524('0x29')](_0x25c0a1[_0xe524('0x26')]);logger[_0xe524('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x25c0a1;});}return _0x25c0a1;})[_0xe524('0xc')](function(_0x5238c9){logger[_0xe524('0xd')](_0xe524('0x1e'),_0x4102d9);logger[_0xe524('0x10')]('CreateVoiceRecording',_0x4102d9,JSON[_0xe524('0x12')](_0x5238c9));_0x2141db(_0x5238c9);})[_0xe524('0x1d')](function(_0x49c43e){logger[_0xe524('0x13')](_0xe524('0x1e'),_0x49c43e[_0xe524('0x15')],_0x4102d9);_0x583cc3(_0xfd5965[_0xe524('0x13')](0x1f4,_0x49c43e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 85e07ff..198603a 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 _0x4381=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceTransferReport.controller','index','get','/describe','isAuthenticated'];(function(_0x2db7b1,_0x52d9e5){var _0x5d0af4=function(_0x1351f1){while(--_0x1351f1){_0x2db7b1['push'](_0x2db7b1['shift']());}};_0x5d0af4(++_0x52d9e5);}(_0x4381,0x11a));var _0x1438=function(_0xe9aede,_0x1da244){_0xe9aede=_0xe9aede-0x0;var _0x23b020=_0x4381[_0xe9aede];return _0x23b020;};'use strict';var multer=require(_0x1438('0x0'));var util=require(_0x1438('0x1'));var path=require(_0x1438('0x2'));var timeout=require(_0x1438('0x3'));var express=require(_0x1438('0x4'));var router=express[_0x1438('0x5')]();var fs_extra=require(_0x1438('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1438('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1438('0x8')]);router[_0x1438('0x9')](_0x1438('0xa'),auth[_0x1438('0xb')](),controller['describe']);router[_0x1438('0x9')](_0x1438('0xc'),auth['isAuthenticated'](),controller[_0x1438('0xd')]);router[_0x1438('0xe')]('/',auth[_0x1438('0xb')](),controller[_0x1438('0xf')]);router[_0x1438('0x10')]('/:id',auth[_0x1438('0xb')](),controller[_0x1438('0x11')]);router[_0x1438('0x12')]('/:id',auth[_0x1438('0xb')](),controller[_0x1438('0x13')]);module[_0x1438('0x14')]=router; \ No newline at end of file +var _0x45a2=['./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2876a0,_0x5a09e3){var _0x5c4aae=function(_0x499cd2){while(--_0x499cd2){_0x2876a0['push'](_0x2876a0['shift']());}};_0x5c4aae(++_0x5a09e3);}(_0x45a2,0x16e));var _0x245a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x45a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x245a('0x0'));var util=require(_0x245a('0x1'));var path=require(_0x245a('0x2'));var timeout=require(_0x245a('0x3'));var express=require(_0x245a('0x4'));var router=express[_0x245a('0x5')]();var fs_extra=require(_0x245a('0x6'));var auth=require(_0x245a('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x245a('0x8'));router[_0x245a('0x9')]('/',auth[_0x245a('0xa')](),controller[_0x245a('0xb')]);router[_0x245a('0x9')](_0x245a('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x245a('0xd'),auth['isAuthenticated'](),controller[_0x245a('0xe')]);router[_0x245a('0xf')]('/',auth['isAuthenticated'](),controller[_0x245a('0x10')]);router[_0x245a('0x11')](_0x245a('0xd'),auth['isAuthenticated'](),controller[_0x245a('0x12')]);router[_0x245a('0x13')](_0x245a('0xd'),auth['isAuthenticated'](),controller[_0x245a('0x14')]);module[_0x245a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 0716091..73736a5 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 _0xff8e=['STRING','sequelize','moment','exports','blind'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0xff8e,0xd3));var _0xeff8=function(_0x59fa9d,_0x1f5959){_0x59fa9d=_0x59fa9d-0x0;var _0x214753=_0xff8e[_0x59fa9d];return _0x214753;};'use strict';var Sequelize=require(_0xeff8('0x0'));var moment=require(_0xeff8('0x1'));module[_0xeff8('0x2')]={'type':{'type':Sequelize['ENUM'](_0xeff8('0x3'),'attended')},'result':{'type':Sequelize[_0xeff8('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xeff8('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xeff8('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xeff8('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xeff8('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xeff8('0x4')]},'transfereechannel':{'type':Sequelize[_0xeff8('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xeff8('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xeff8('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xeff8('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xeff8('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xeff8('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xeff8('0x4')]},'extension':{'type':Sequelize[_0xeff8('0x4')]}}; \ No newline at end of file +var _0x5665=['blind','attended','STRING','ENUM','Yes','sequelize'];(function(_0x58bf72,_0x270672){var _0x5ac3aa=function(_0x5b6191){while(--_0x5b6191){_0x58bf72['push'](_0x58bf72['shift']());}};_0x5ac3aa(++_0x270672);}(_0x5665,0x1a3));var _0x5566=function(_0x4a538e,_0x4d02eb){_0x4a538e=_0x4a538e-0x0;var _0x15ab49=_0x5665[_0x4a538e];return _0x15ab49;};'use strict';var Sequelize=require(_0x5566('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0x5566('0x1'),_0x5566('0x2'))},'result':{'type':Sequelize[_0x5566('0x3')]},'transfererchannel':{'type':Sequelize[_0x5566('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x5566('0x3')]},'transferercalleridname':{'type':Sequelize[_0x5566('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x5566('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x5566('0x3')]},'transferercontext':{'type':Sequelize[_0x5566('0x3')]},'transfererexten':{'type':Sequelize[_0x5566('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x5566('0x3')]},'transfereechannel':{'type':Sequelize[_0x5566('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x5566('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x5566('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5566('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5566('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x5566('0x3')]},'transfereecontext':{'type':Sequelize[_0x5566('0x3')]},'transfereeexten':{'type':Sequelize[_0x5566('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x5566('0x4')](_0x5566('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5566('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 32c8f16..b0d043c 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 _0x69b8=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','count','includeAll','include','rows','catch','params','rawAttributes','options','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','undefined','limit','offset','set','Content-Range','json','apply','save','then','destroy','end','sendStatus','error','stack','send','index','VoiceTransferReport','key','model','map','keys','query','filters','intersection','attributes'];(function(_0x24a0c3,_0x5411c1){var _0x1b0829=function(_0x2ba89e){while(--_0x2ba89e){_0x24a0c3['push'](_0x24a0c3['shift']());}};_0x1b0829(++_0x5411c1);}(_0x69b8,0xf2));var _0x869b=function(_0x4539b6,_0x1643c9){_0x4539b6=_0x4539b6-0x0;var _0x5bb0c4=_0x69b8[_0x4539b6];return _0x5bb0c4;};'use strict';var emlformat=require(_0x869b('0x0'));var rimraf=require(_0x869b('0x1'));var zipdir=require(_0x869b('0x2'));var jsonpatch=require(_0x869b('0x3'));var rp=require(_0x869b('0x4'));var moment=require(_0x869b('0x5'));var BPromise=require(_0x869b('0x6'));var Mustache=require('mustache');var util=require(_0x869b('0x7'));var path=require(_0x869b('0x8'));var sox=require(_0x869b('0x9'));var csv=require(_0x869b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x869b('0xb'));var _=require(_0x869b('0xc'));var squel=require(_0x869b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x869b('0xa'));var querystring=require(_0x869b('0xe'));var Papa=require(_0x869b('0xf'));var Redis=require(_0x869b('0x10'));var authService=require(_0x869b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x869b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x869b('0x13'))(_0x869b('0x14'));var utils=require(_0x869b('0x15'));var config=require(_0x869b('0x16'));var licenseUtil=require(_0x869b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x261a88,_0x2a5fac){_0x2a5fac=_0x2a5fac||0xcc;return function(_0x2a08c3){if(_0x2a08c3){return _0x261a88['sendStatus'](_0x2a5fac);}return _0x261a88[_0x869b('0x18')](_0x2a5fac)['end']();};}function respondWithResult(_0x32c173,_0x457c11){_0x457c11=_0x457c11||0xc8;return function(_0x5c4ba8){if(_0x5c4ba8){return _0x32c173[_0x869b('0x18')](_0x457c11)['json'](_0x5c4ba8);}};}function respondWithFilteredResult(_0x2c4f65,_0x14cbd9){return function(_0x1fd100){if(_0x1fd100){var _0x49f191=typeof _0x14cbd9['offset']===_0x869b('0x19')&&typeof _0x14cbd9[_0x869b('0x1a')]===_0x869b('0x19');var _0x129737=_0x1fd100['count'];var _0x7716b2=_0x49f191?0x0:_0x14cbd9[_0x869b('0x1b')];var _0xf954=_0x49f191?_0x1fd100['count']:_0x14cbd9[_0x869b('0x1b')]+_0x14cbd9['limit'];var _0x2d0b2d;if(_0xf954>=_0x129737){_0xf954=_0x129737;_0x2d0b2d=0xc8;}else{_0x2d0b2d=0xce;}_0x2c4f65[_0x869b('0x18')](_0x2d0b2d);return _0x2c4f65[_0x869b('0x1c')](_0x869b('0x1d'),_0x7716b2+'-'+_0xf954+'/'+_0x129737)[_0x869b('0x1e')](_0x1fd100);}return null;};}function patchUpdates(_0x5e27be){return function(_0x17c8ca){try{jsonpatch[_0x869b('0x1f')](_0x17c8ca,_0x5e27be,!![]);}catch(_0xf5bb5c){return BPromise['reject'](_0xf5bb5c);}return _0x17c8ca[_0x869b('0x20')]();};}function saveUpdates(_0x4bc014,_0x23ecf5){return function(_0x2d1c00){if(_0x2d1c00){return _0x2d1c00['update'](_0x4bc014)[_0x869b('0x21')](function(_0x3747e8){return _0x3747e8;});}return null;};}function removeEntity(_0x2bae83,_0x1b672a){return function(_0x1bcaa6){if(_0x1bcaa6){return _0x1bcaa6[_0x869b('0x22')]()[_0x869b('0x21')](function(){_0x2bae83[_0x869b('0x18')](0xcc)[_0x869b('0x23')]();});}};}function handleEntityNotFound(_0x29c992,_0x34ed4f){return function(_0x215f15){if(!_0x215f15){_0x29c992[_0x869b('0x24')](0x194);}return _0x215f15;};}function handleError(_0x27d29f,_0x67e5ef){_0x67e5ef=_0x67e5ef||0x1f4;return function(_0x5567de){logger[_0x869b('0x25')](_0x5567de[_0x869b('0x26')]);if(_0x5567de['name']){delete _0x5567de['name'];}_0x27d29f['status'](_0x67e5ef)[_0x869b('0x27')](_0x5567de);};}exports[_0x869b('0x28')]=function(_0x38e7e1,_0x19a324){var _0x8b4663={},_0x156713={},_0x919ca7={'count':0x0,'rows':[]};var _0x3b7270=_['map'](db[_0x869b('0x29')]['rawAttributes'],function(_0x13c1b2){return{'name':_0x13c1b2['fieldName'],'type':_0x13c1b2['type'][_0x869b('0x2a')]};});_0x156713[_0x869b('0x2b')]=_[_0x869b('0x2c')](_0x3b7270,'name');_0x156713['query']=_[_0x869b('0x2d')](_0x38e7e1[_0x869b('0x2e')]);_0x156713[_0x869b('0x2f')]=_[_0x869b('0x30')](_0x156713[_0x869b('0x2b')],_0x156713[_0x869b('0x2e')]);_0x8b4663[_0x869b('0x31')]=_['intersection'](_0x156713[_0x869b('0x2b')],qs[_0x869b('0x32')](_0x38e7e1['query'][_0x869b('0x32')]));_0x8b4663['attributes']=_0x8b4663[_0x869b('0x31')][_0x869b('0x33')]?_0x8b4663[_0x869b('0x31')]:_0x156713['model'];if(!_0x38e7e1[_0x869b('0x2e')][_0x869b('0x34')](_0x869b('0x35'))){_0x8b4663['limit']=qs[_0x869b('0x1a')](_0x38e7e1[_0x869b('0x2e')][_0x869b('0x1a')]);_0x8b4663[_0x869b('0x1b')]=qs[_0x869b('0x1b')](_0x38e7e1['query'][_0x869b('0x1b')]);}_0x8b4663[_0x869b('0x36')]=qs[_0x869b('0x37')](_0x38e7e1[_0x869b('0x2e')][_0x869b('0x37')]);_0x8b4663[_0x869b('0x38')]=qs[_0x869b('0x2f')](_[_0x869b('0x39')](_0x38e7e1[_0x869b('0x2e')],_0x156713[_0x869b('0x2f')]),_0x3b7270);if(_0x38e7e1['query']['filter']){_0x8b4663[_0x869b('0x38')]=_[_0x869b('0x3a')](_0x8b4663[_0x869b('0x38')],{'$or':_[_0x869b('0x2c')](_0x3b7270,function(_0x14d135){if(_0x14d135[_0x869b('0x3b')]!=='VIRTUAL'){var _0x3d7e5b={};_0x3d7e5b[_0x14d135['name']]={'$like':'%'+_0x38e7e1['query'][_0x869b('0x3c')]+'%'};return _0x3d7e5b;}})});}_0x8b4663=_[_0x869b('0x3a')]({},_0x8b4663,_0x38e7e1['options']);var _0x2dbdb2={'where':_0x8b4663['where']};return db[_0x869b('0x29')][_0x869b('0x3d')](_0x2dbdb2)['then'](function(_0x2ab98f){_0x919ca7[_0x869b('0x3d')]=_0x2ab98f;if(_0x38e7e1[_0x869b('0x2e')][_0x869b('0x3e')]){_0x8b4663[_0x869b('0x3f')]=[{'all':!![]}];}return db[_0x869b('0x29')]['findAll'](_0x8b4663);})[_0x869b('0x21')](function(_0x2ef265){_0x919ca7[_0x869b('0x40')]=_0x2ef265;return _0x919ca7;})['then'](respondWithFilteredResult(_0x19a324,_0x8b4663))[_0x869b('0x41')](handleError(_0x19a324,null));};exports['show']=function(_0x235234,_0x544735){var _0x3176e4={'raw':!![],'where':{'id':_0x235234[_0x869b('0x42')]['id']}},_0x4e1565={};_0x4e1565[_0x869b('0x2b')]=_[_0x869b('0x2d')](db[_0x869b('0x29')][_0x869b('0x43')]);_0x4e1565[_0x869b('0x2e')]=_[_0x869b('0x2d')](_0x235234['query']);_0x4e1565[_0x869b('0x2f')]=_['intersection'](_0x4e1565[_0x869b('0x2b')],_0x4e1565['query']);_0x3176e4[_0x869b('0x31')]=_[_0x869b('0x30')](_0x4e1565[_0x869b('0x2b')],qs[_0x869b('0x32')](_0x235234['query'][_0x869b('0x32')]));_0x3176e4[_0x869b('0x31')]=_0x3176e4['attributes'][_0x869b('0x33')]?_0x3176e4[_0x869b('0x31')]:_0x4e1565[_0x869b('0x2b')];if(_0x235234['query']['includeAll']){_0x3176e4[_0x869b('0x3f')]=[{'all':!![]}];}_0x3176e4=_[_0x869b('0x3a')]({},_0x3176e4,_0x235234[_0x869b('0x44')]);return db['VoiceTransferReport'][_0x869b('0x45')](_0x3176e4)[_0x869b('0x21')](handleEntityNotFound(_0x544735,null))[_0x869b('0x21')](respondWithResult(_0x544735,null))[_0x869b('0x41')](handleError(_0x544735,null));};exports['create']=function(_0x34536d,_0x168568){return db[_0x869b('0x29')]['create'](_0x34536d[_0x869b('0x46')],{})['then'](respondWithResult(_0x168568,0xc9))[_0x869b('0x41')](handleError(_0x168568,null));};exports[_0x869b('0x47')]=function(_0x121471,_0x30cc0e){if(_0x121471[_0x869b('0x46')]['id']){delete _0x121471['body']['id'];}return db[_0x869b('0x29')][_0x869b('0x45')]({'where':{'id':_0x121471['params']['id']}})[_0x869b('0x21')](handleEntityNotFound(_0x30cc0e,null))[_0x869b('0x21')](saveUpdates(_0x121471[_0x869b('0x46')],null))['then'](respondWithResult(_0x30cc0e,null))[_0x869b('0x41')](handleError(_0x30cc0e,null));};exports[_0x869b('0x22')]=function(_0x28f7d3,_0x5be757){return db[_0x869b('0x29')][_0x869b('0x45')]({'where':{'id':_0x28f7d3[_0x869b('0x42')]['id']}})[_0x869b('0x21')](handleEntityNotFound(_0x5be757,null))[_0x869b('0x21')](removeEntity(_0x5be757,null))[_0x869b('0x41')](handleError(_0x5be757,null));};exports[_0x869b('0x48')]=function(_0x3cc9e8,_0x39592f){return db[_0x869b('0x29')][_0x869b('0x48')]()['then'](respondWithResult(_0x39592f,null))[_0x869b('0x41')](handleError(_0x39592f,null));}; \ No newline at end of file +var _0x15eb=['../../config/license/util','sendStatus','status','undefined','limit','count','offset','set','json','apply','update','then','destroy','stack','name','send','index','VoiceTransferReport','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x41a6b1,_0x33302b){var _0x26a187=function(_0x4fa33f){while(--_0x4fa33f){_0x41a6b1['push'](_0x41a6b1['shift']());}};_0x26a187(++_0x33302b);}(_0x15eb,0x199));var _0xb15e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x15eb[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xb15e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb15e('0x1'));var jsonpatch=require(_0xb15e('0x2'));var rp=require(_0xb15e('0x3'));var moment=require(_0xb15e('0x4'));var BPromise=require(_0xb15e('0x5'));var Mustache=require(_0xb15e('0x6'));var util=require('util');var path=require(_0xb15e('0x7'));var sox=require(_0xb15e('0x8'));var csv=require(_0xb15e('0x9'));var ejs=require(_0xb15e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb15e('0xb'));var crypto=require(_0xb15e('0xc'));var jsforce=require(_0xb15e('0xd'));var deskjs=require(_0xb15e('0xe'));var toCsv=require(_0xb15e('0x9'));var querystring=require(_0xb15e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb15e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb15e('0x11'));var hardwareService=require(_0xb15e('0x12'));var logger=require(_0xb15e('0x13'))(_0xb15e('0x14'));var utils=require(_0xb15e('0x15'));var config=require(_0xb15e('0x16'));var licenseUtil=require(_0xb15e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38d5f2,_0x4641bf){_0x4641bf=_0x4641bf||0xcc;return function(_0x158bbe){if(_0x158bbe){return _0x38d5f2[_0xb15e('0x18')](_0x4641bf);}return _0x38d5f2[_0xb15e('0x19')](_0x4641bf)['end']();};}function respondWithResult(_0x567e36,_0x328434){_0x328434=_0x328434||0xc8;return function(_0x58f52f){if(_0x58f52f){return _0x567e36[_0xb15e('0x19')](_0x328434)['json'](_0x58f52f);}};}function respondWithFilteredResult(_0x5e048a,_0x32ab05){return function(_0x4a9734){if(_0x4a9734){var _0x1ac224=typeof _0x32ab05['offset']===_0xb15e('0x1a')&&typeof _0x32ab05[_0xb15e('0x1b')]===_0xb15e('0x1a');var _0x36381c=_0x4a9734[_0xb15e('0x1c')];var _0x3c1a4f=_0x1ac224?0x0:_0x32ab05[_0xb15e('0x1d')];var _0x52288f=_0x1ac224?_0x4a9734[_0xb15e('0x1c')]:_0x32ab05[_0xb15e('0x1d')]+_0x32ab05['limit'];var _0x5895f6;if(_0x52288f>=_0x36381c){_0x52288f=_0x36381c;_0x5895f6=0xc8;}else{_0x5895f6=0xce;}_0x5e048a[_0xb15e('0x19')](_0x5895f6);return _0x5e048a[_0xb15e('0x1e')]('Content-Range',_0x3c1a4f+'-'+_0x52288f+'/'+_0x36381c)[_0xb15e('0x1f')](_0x4a9734);}return null;};}function patchUpdates(_0x37e59b){return function(_0x10e461){try{jsonpatch[_0xb15e('0x20')](_0x10e461,_0x37e59b,!![]);}catch(_0x4d99a9){return BPromise['reject'](_0x4d99a9);}return _0x10e461['save']();};}function saveUpdates(_0x2af3a0,_0x17b28d){return function(_0x1893be){if(_0x1893be){return _0x1893be[_0xb15e('0x21')](_0x2af3a0)[_0xb15e('0x22')](function(_0x5926c3){return _0x5926c3;});}return null;};}function removeEntity(_0x11fbee,_0xcd2bfa){return function(_0xd72432){if(_0xd72432){return _0xd72432[_0xb15e('0x23')]()[_0xb15e('0x22')](function(){_0x11fbee[_0xb15e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c749e,_0xfd44e2){return function(_0x294d23){if(!_0x294d23){_0x5c749e[_0xb15e('0x18')](0x194);}return _0x294d23;};}function handleError(_0x1db136,_0x486764){_0x486764=_0x486764||0x1f4;return function(_0x113227){logger['error'](_0x113227[_0xb15e('0x24')]);if(_0x113227[_0xb15e('0x25')]){delete _0x113227[_0xb15e('0x25')];}_0x1db136['status'](_0x486764)[_0xb15e('0x26')](_0x113227);};}exports[_0xb15e('0x27')]=function(_0x412d92,_0x4548f5){var _0xbf789f={},_0x48b566={},_0x5d1caf={'count':0x0,'rows':[]};var _0xd001ff=_['map'](db[_0xb15e('0x28')]['rawAttributes'],function(_0x5352a7){return{'name':_0x5352a7[_0xb15e('0x29')],'type':_0x5352a7['type'][_0xb15e('0x2a')]};});_0x48b566[_0xb15e('0x2b')]=_[_0xb15e('0x2c')](_0xd001ff,_0xb15e('0x25'));_0x48b566['query']=_[_0xb15e('0x2d')](_0x412d92[_0xb15e('0x2e')]);_0x48b566['filters']=_[_0xb15e('0x2f')](_0x48b566[_0xb15e('0x2b')],_0x48b566[_0xb15e('0x2e')]);_0xbf789f[_0xb15e('0x30')]=_[_0xb15e('0x2f')](_0x48b566[_0xb15e('0x2b')],qs['fields'](_0x412d92[_0xb15e('0x2e')][_0xb15e('0x31')]));_0xbf789f[_0xb15e('0x30')]=_0xbf789f[_0xb15e('0x30')][_0xb15e('0x32')]?_0xbf789f[_0xb15e('0x30')]:_0x48b566[_0xb15e('0x2b')];if(!_0x412d92[_0xb15e('0x2e')][_0xb15e('0x33')](_0xb15e('0x34'))){_0xbf789f['limit']=qs[_0xb15e('0x1b')](_0x412d92[_0xb15e('0x2e')][_0xb15e('0x1b')]);_0xbf789f[_0xb15e('0x1d')]=qs[_0xb15e('0x1d')](_0x412d92['query'][_0xb15e('0x1d')]);}_0xbf789f[_0xb15e('0x35')]=qs['sort'](_0x412d92[_0xb15e('0x2e')][_0xb15e('0x36')]);_0xbf789f[_0xb15e('0x37')]=qs[_0xb15e('0x38')](_['pick'](_0x412d92[_0xb15e('0x2e')],_0x48b566['filters']),_0xd001ff);if(_0x412d92[_0xb15e('0x2e')][_0xb15e('0x39')]){_0xbf789f[_0xb15e('0x37')]=_[_0xb15e('0x3a')](_0xbf789f[_0xb15e('0x37')],{'$or':_[_0xb15e('0x2c')](_0xd001ff,function(_0x445dd5){if(_0x445dd5[_0xb15e('0x3b')]!==_0xb15e('0x3c')){var _0x35b82a={};_0x35b82a[_0x445dd5[_0xb15e('0x25')]]={'$like':'%'+_0x412d92[_0xb15e('0x2e')][_0xb15e('0x39')]+'%'};return _0x35b82a;}})});}_0xbf789f=_[_0xb15e('0x3a')]({},_0xbf789f,_0x412d92[_0xb15e('0x3d')]);var _0x4b1fbf={'where':_0xbf789f[_0xb15e('0x37')]};return db['VoiceTransferReport'][_0xb15e('0x1c')](_0x4b1fbf)[_0xb15e('0x22')](function(_0x58312f){_0x5d1caf[_0xb15e('0x1c')]=_0x58312f;if(_0x412d92['query'][_0xb15e('0x3e')]){_0xbf789f['include']=[{'all':!![]}];}return db[_0xb15e('0x28')]['findAll'](_0xbf789f);})[_0xb15e('0x22')](function(_0x4c852a){_0x5d1caf['rows']=_0x4c852a;return _0x5d1caf;})[_0xb15e('0x22')](respondWithFilteredResult(_0x4548f5,_0xbf789f))[_0xb15e('0x3f')](handleError(_0x4548f5,null));};exports[_0xb15e('0x40')]=function(_0x2b140a,_0x38a2d9){var _0x3c715a={'raw':!![],'where':{'id':_0x2b140a[_0xb15e('0x41')]['id']}},_0x381c7d={};_0x381c7d[_0xb15e('0x2b')]=_[_0xb15e('0x2d')](db[_0xb15e('0x28')][_0xb15e('0x42')]);_0x381c7d[_0xb15e('0x2e')]=_['keys'](_0x2b140a[_0xb15e('0x2e')]);_0x381c7d['filters']=_['intersection'](_0x381c7d[_0xb15e('0x2b')],_0x381c7d['query']);_0x3c715a[_0xb15e('0x30')]=_[_0xb15e('0x2f')](_0x381c7d['model'],qs[_0xb15e('0x31')](_0x2b140a[_0xb15e('0x2e')][_0xb15e('0x31')]));_0x3c715a[_0xb15e('0x30')]=_0x3c715a[_0xb15e('0x30')][_0xb15e('0x32')]?_0x3c715a[_0xb15e('0x30')]:_0x381c7d[_0xb15e('0x2b')];if(_0x2b140a[_0xb15e('0x2e')][_0xb15e('0x3e')]){_0x3c715a[_0xb15e('0x43')]=[{'all':!![]}];}_0x3c715a=_[_0xb15e('0x3a')]({},_0x3c715a,_0x2b140a[_0xb15e('0x3d')]);return db[_0xb15e('0x28')][_0xb15e('0x44')](_0x3c715a)[_0xb15e('0x22')](handleEntityNotFound(_0x38a2d9,null))[_0xb15e('0x22')](respondWithResult(_0x38a2d9,null))[_0xb15e('0x3f')](handleError(_0x38a2d9,null));};exports[_0xb15e('0x45')]=function(_0x3c02bc,_0x106853){return db[_0xb15e('0x28')][_0xb15e('0x45')](_0x3c02bc['body'],{})[_0xb15e('0x22')](respondWithResult(_0x106853,0xc9))[_0xb15e('0x3f')](handleError(_0x106853,null));};exports[_0xb15e('0x21')]=function(_0x241487,_0x594d27){if(_0x241487[_0xb15e('0x46')]['id']){delete _0x241487[_0xb15e('0x46')]['id'];}return db[_0xb15e('0x28')][_0xb15e('0x44')]({'where':{'id':_0x241487['params']['id']}})['then'](handleEntityNotFound(_0x594d27,null))['then'](saveUpdates(_0x241487[_0xb15e('0x46')],null))[_0xb15e('0x22')](respondWithResult(_0x594d27,null))['catch'](handleError(_0x594d27,null));};exports[_0xb15e('0x23')]=function(_0x304ec3,_0x474913){return db['VoiceTransferReport'][_0xb15e('0x44')]({'where':{'id':_0x304ec3[_0xb15e('0x41')]['id']}})[_0xb15e('0x22')](handleEntityNotFound(_0x474913,null))[_0xb15e('0x22')](removeEntity(_0x474913,null))[_0xb15e('0x3f')](handleError(_0x474913,null));};exports[_0xb15e('0x47')]=function(_0x19bff5,_0x538ccf){return db[_0xb15e('0x28')][_0xb15e('0x47')]()[_0xb15e('0x22')](respondWithResult(_0x538ccf,null))[_0xb15e('0x3f')](handleError(_0x538ccf,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 0a653e2..b009313 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 _0xfd64=['path','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfd64,0x66));var _0x4fd6=function(_0x36409d,_0x563892){_0x36409d=_0x36409d-0x0;var _0x567b1d=_0xfd64[_0x36409d];return _0x567b1d;};'use strict';var _=require(_0x4fd6('0x0'));var util=require(_0x4fd6('0x1'));var logger=require(_0x4fd6('0x2'))(_0x4fd6('0x3'));var moment=require(_0x4fd6('0x4'));var BPromise=require(_0x4fd6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fd6('0x6'));var rimraf=require('rimraf');var config=require(_0x4fd6('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x4fd6('0x8')]=function(_0x38cefc,_0x1c7144){return _0x38cefc[_0x4fd6('0x9')](_0x4fd6('0xa'),attributes,{'tableName':_0x4fd6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb71=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0xb9f8a6,_0x565afa){var _0x347850=function(_0x5c8c4b){while(--_0x5c8c4b){_0xb9f8a6['push'](_0xb9f8a6['shift']());}};_0x347850(++_0x565afa);}(_0xcb71,0x167));var _0x1cb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1cb7('0x0'));var util=require(_0x1cb7('0x1'));var logger=require(_0x1cb7('0x2'))(_0x1cb7('0x3'));var moment=require(_0x1cb7('0x4'));var BPromise=require(_0x1cb7('0x5'));var rp=require(_0x1cb7('0x6'));var fs=require('fs');var path=require(_0x1cb7('0x7'));var rimraf=require(_0x1cb7('0x8'));var config=require(_0x1cb7('0x9'));var attributes=require(_0x1cb7('0xa'));module[_0x1cb7('0xb')]=function(_0x49fd31,_0x771301){return _0x49fd31['define'](_0x1cb7('0xc'),attributes,{'tableName':_0x1cb7('0xd'),'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 89fecfb..57d7b8d 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 _0x042e=['jayson/promise','client','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','result','VoiceTransferReport','body','options','raw','CreateVoiceTransferReport','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x146c7f,_0x29ac20){var _0x5d578a=function(_0x517200){while(--_0x517200){_0x146c7f['push'](_0x146c7f['shift']());}};_0x5d578a(++_0x29ac20);}(_0x042e,0x96));var _0xe042=function(_0x2538e7,_0x4adf9d){_0x2538e7=_0x2538e7-0x0;var _0x4df5db=_0x042e[_0x2538e7];return _0x4df5db;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe042('0x0'));var BPromise=require('bluebird');var rs=require(_0xe042('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe042('0x2'))['db'];var utils=require(_0xe042('0x3'));var logger=require(_0xe042('0x4'))(_0xe042('0x5'));var config=require('../../config/environment');var jayson=require(_0xe042('0x6'));var client=jayson[_0xe042('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cee72,_0x3b2c00,_0x38c97a){return new BPromise(function(_0xc4ca5d,_0x10ebbc){return client[_0xe042('0x8')](_0x1cee72,_0x38c97a)[_0xe042('0x9')](function(_0x1bad89){logger[_0xe042('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x3b2c00,'request\x20sent');logger[_0xe042('0xb')](_0xe042('0xc'),_0x3b2c00,'request\x20sent',JSON[_0xe042('0xd')](_0x1bad89));if(_0x1bad89['error']){if(_0x1bad89[_0xe042('0xe')][_0xe042('0xf')]===0x1f4){logger['error'](_0xe042('0x10'),_0x3b2c00,_0x1bad89[_0xe042('0xe')]['message']);return _0x10ebbc(_0x1bad89[_0xe042('0xe')]['message']);}logger[_0xe042('0xe')](_0xe042('0x10'),_0x3b2c00,_0x1bad89[_0xe042('0xe')][_0xe042('0x11')]);return _0xc4ca5d(_0x1bad89[_0xe042('0xe')][_0xe042('0x11')]);}else{logger[_0xe042('0xa')](_0xe042('0x10'),_0x3b2c00,_0xe042('0x12'));_0xc4ca5d(_0x1bad89[_0xe042('0x13')][_0xe042('0x11')]);}})['catch'](function(_0x554643){logger[_0xe042('0xe')](_0xe042('0x10'),_0x3b2c00,_0x554643);_0x10ebbc(_0x554643);});});}exports['CreateVoiceTransferReport']=function(_0x246fa6){var _0x154fef=this;return new Promise(function(_0x3be828,_0x4bb1d5){return db[_0xe042('0x14')]['create'](_0x246fa6[_0xe042('0x15')],{'raw':_0x246fa6[_0xe042('0x16')]?_0x246fa6[_0xe042('0x16')][_0xe042('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5a7d1f){logger[_0xe042('0xa')]('CreateVoiceTransferReport',_0x246fa6);logger[_0xe042('0xb')](_0xe042('0x18'),_0x246fa6,JSON[_0xe042('0xd')](_0x5a7d1f));_0x3be828(_0x5a7d1f);})[_0xe042('0x19')](function(_0x3e2949){logger['error'](_0xe042('0x18'),_0x3e2949['message'],_0x246fa6);_0x4bb1d5(_0x154fef[_0xe042('0xe')](0x1f4,_0x3e2949[_0xe042('0x11')]));});});}; \ No newline at end of file +var _0xcfcc=['debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceTransferReport','create','body','raw'];(function(_0x33d403,_0x3367d6){var _0x32db81=function(_0x3e6e04){while(--_0x3e6e04){_0x33d403['push'](_0x33d403['shift']());}};_0x32db81(++_0x3367d6);}(_0xcfcc,0xb7));var _0xccfc=function(_0x15a8cf,_0x428a81){_0x15a8cf=_0x15a8cf-0x0;var _0x335b5e=_0xcfcc[_0x15a8cf];return _0x335b5e;};'use strict';var _=require(_0xccfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xccfc('0x1'));var rs=require(_0xccfc('0x2'));var fs=require('fs');var Redis=require(_0xccfc('0x3'));var db=require(_0xccfc('0x4'))['db'];var utils=require(_0xccfc('0x5'));var logger=require(_0xccfc('0x6'))(_0xccfc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xccfc('0x8')][_0xccfc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbb97d5,_0x3b0c59,_0x5344b7){return new BPromise(function(_0xb60669,_0x3df87f){return client['request'](_0xbb97d5,_0x5344b7)[_0xccfc('0xa')](function(_0x340eb2){logger['info'](_0xccfc('0xb'),_0x3b0c59,_0xccfc('0xc'));logger['debug'](_0xccfc('0xd'),_0x3b0c59,'request\x20sent',JSON[_0xccfc('0xe')](_0x340eb2));if(_0x340eb2['error']){if(_0x340eb2[_0xccfc('0xf')][_0xccfc('0x10')]===0x1f4){logger[_0xccfc('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x3b0c59,_0x340eb2[_0xccfc('0xf')][_0xccfc('0x11')]);return _0x3df87f(_0x340eb2[_0xccfc('0xf')][_0xccfc('0x11')]);}logger[_0xccfc('0xf')](_0xccfc('0xb'),_0x3b0c59,_0x340eb2['error']['message']);return _0xb60669(_0x340eb2[_0xccfc('0xf')][_0xccfc('0x11')]);}else{logger[_0xccfc('0x12')](_0xccfc('0xb'),_0x3b0c59,_0xccfc('0xc'));_0xb60669(_0x340eb2[_0xccfc('0x13')][_0xccfc('0x11')]);}})[_0xccfc('0x14')](function(_0x851ef3){logger['error'](_0xccfc('0xb'),_0x3b0c59,_0x851ef3);_0x3df87f(_0x851ef3);});});}exports[_0xccfc('0x15')]=function(_0x45b577){var _0x2ac374=this;return new Promise(function(_0x381a97,_0x2ebace){return db['VoiceTransferReport'][_0xccfc('0x16')](_0x45b577[_0xccfc('0x17')],{'raw':_0x45b577['options']?_0x45b577['options'][_0xccfc('0x18')]===undefined?!![]:![]:!![]})[_0xccfc('0xa')](function(_0x51bfee){logger[_0xccfc('0x12')](_0xccfc('0x15'),_0x45b577);logger[_0xccfc('0x19')]('CreateVoiceTransferReport',_0x45b577,JSON[_0xccfc('0xe')](_0x51bfee));_0x381a97(_0x51bfee);})[_0xccfc('0x14')](function(_0x1363b6){logger['error'](_0xccfc('0x15'),_0x1363b6[_0xccfc('0x11')],_0x45b577);_0x2ebace(_0x2ac374['error'](0x1f4,_0x1363b6[_0xccfc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f10be3a..d4c08fc 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb43b,0x1b2));var _0xbb43=function(_0x41abd6,_0x443e05){_0x41abd6=_0x41abd6-0x0;var _0xdb89be=_0xb43b[_0x41abd6];return _0xdb89be;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0x36e678,_0x45cf20){var _0x71abb0=function(_0x453fe6){while(--_0x453fe6){_0x36e678['push'](_0x36e678['shift']());}};_0x71abb0(++_0x45cf20);}(_0x153f,0x15b));var _0xf153=function(_0x704c09,_0x2b8a74){_0x704c09=_0x704c09-0x0;var _0x26cf82=_0x153f[_0x704c09];return _0x26cf82;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 867a9ae..5c5ae06 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 _0xe284=['originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate'];(function(_0x5d2f52,_0x56463d){var _0xf1022a=function(_0x36c40a){while(--_0x36c40a){_0x5d2f52['push'](_0x5d2f52['shift']());}};_0xf1022a(++_0x56463d);}(_0xe284,0x1c8));var _0x4e28=function(_0x1e1943,_0x1a6d54){_0x1e1943=_0x1e1943-0x0;var _0x4989a9=_0xe284[_0x1e1943];return _0x4989a9;};'use strict';var path=require(_0x4e28('0x0'));var fs=require('fs');var _=require(_0x4e28('0x1'));var db=require(_0x4e28('0x2'))['db'];var config=require(_0x4e28('0x3'));var util=require(_0x4e28('0x4'));var BPromise=require(_0x4e28('0x5'));var jayson=require(_0x4e28('0x6'));var amiClient=jayson[_0x4e28('0x7')]['http']({'port':0x232a});var logger=require(_0x4e28('0x8'))(_0x4e28('0x9'));var Redis=require(_0x4e28('0xa'));config[_0x4e28('0xb')]=_[_0x4e28('0xc')](config[_0x4e28('0xb')],{'host':_0x4e28('0xd'),'port':0x18eb});var io=require(_0x4e28('0xe'))(new Redis(config[_0x4e28('0xb')]));var Schema=require(_0x4e28('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4e28('0x10')]},'callNumber':{'type':_0x4e28('0x11'),'required':[!![],_0x4e28('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4e28('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':_0x4e28('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':_0x4e28('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':'string','required':[!![],_0x4e28('0x14')]},'transferNumber':{'type':_0x4e28('0x11'),'required':[!![],_0x4e28('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':_0x4e28('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]},'sessionId':{'type':_0x4e28('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4e28('0x13'),'required':[!![],_0x4e28('0x10')]}});function emit(_0xfa59b4,_0x4f442f,_0x1950e9){logger[_0x4e28('0x16')](_0xfa59b4,_0x4f442f,JSON[_0x4e28('0x17')](_0x1950e9));io['to'](_0xfa59b4)[_0x4e28('0x18')](_0x4f442f,_0x1950e9);}function handleError(_0x2ba6e7){return function(_0x308889){console['log'](_0x4e28('0x19'),_0x308889,_0x308889 instanceof RangeError);logger['error'](_0x308889[_0x4e28('0x1a')]);if(_0x308889 instanceof RangeError){if(_0x308889['name']){delete _0x308889[_0x4e28('0x1b')];}_0x2ba6e7[_0x4e28('0x1c')](0x194)[_0x4e28('0x1d')](_0x308889);}else{if(_0x308889[_0x4e28('0x1b')]){delete _0x308889[_0x4e28('0x1b')];}_0x2ba6e7[_0x4e28('0x1c')](0x1f4)[_0x4e28('0x1d')](_0x308889);}};}function checkError(){return function(_0x592ae9){if(!_0x592ae9){throw new RangeError(_0x4e28('0x1e'));}return _0x592ae9;};}function respondWithRpcPromise(_0x496b9f,_0x4435e9){return new BPromise(function(_0x1c1a56,_0x4c4eb2){var _0xda53ff=amiClient;return _0xda53ff[_0x4e28('0x1f')](_0x496b9f,_0x4435e9)[_0x4e28('0x20')](function(_0x415a84){if(_0x415a84[_0x4e28('0x21')]){if(_0x415a84['error'][_0x4e28('0x22')]===0x1f4){return _0x4c4eb2(_0x415a84[_0x4e28('0x21')][_0x4e28('0x23')]);}return _0x1c1a56(_0x415a84['error'][_0x4e28('0x23')]);}else{_0x1c1a56(_0x415a84[_0x4e28('0x24')]);}})[_0x4e28('0x25')](function(_0x7390b3){_0x4c4eb2(_0x7390b3);});});}function getAgent(_0x2f4502){return db[_0x4e28('0x26')][_0x4e28('0x27')]({'where':{'id':_0x2f4502,'role':_0x4e28('0x28')}})['then'](checkError());}function getAgentCheckSession(_0x25f1a1,_0x47a3b2){return new BPromise(function(_0x247e63,_0x1555af){var _0x4fa9c1=respondWithRpcPromise(_0x4e28('0x29'));var _0x3283b6=getAgent(_0x25f1a1);Promise['all']([_0x4fa9c1,_0x3283b6])[_0x4e28('0x20')](function(_0x12c46f){var _0x47a21c=_0x12c46f[0x0];var _0x2ee4e4=_0x12c46f[0x1];var _0x1f12d9=_[_0x4e28('0x2a')](_0x47a21c['rows'],function(_0x33847d){return _0x33847d[_0x4e28('0x2b')]==_0x2ee4e4['id']&&_0x33847d[_0x4e28('0x2c')]==_0x47a3b2;});if(_0x1f12d9[_0x4e28('0x2d')]==0x1){_0x247e63(_0x2ee4e4);}else{_0x1555af(new RangeError(_0x4e28('0x2e')+_0x47a3b2+_0x4e28('0x2f')));}});});}exports[_0x4e28('0x30')]=function(_0x306b64,_0x256db9){logger['info'](_0x4e28('0x31'),_0x306b64[_0x4e28('0x32')]);var _0x300062=originateValidation[_0x4e28('0xf')](_0x306b64[_0x4e28('0x32')]);if(_0x300062[_0x4e28('0x2d')]>0x0){return _0x256db9[_0x4e28('0x1c')](0x190)[_0x4e28('0x33')](_0x300062);}var _0x16dccb=_0x306b64[_0x4e28('0x32')][_0x4e28('0x34')];var _0x3d297e=_0x306b64[_0x4e28('0x32')][_0x4e28('0x35')];var _0x3a2d9f=_0x306b64['body'][_0x4e28('0x36')];var _0x3167c3=_0x306b64[_0x4e28('0x32')][_0x4e28('0x37')];return getAgent(_0x16dccb)[_0x4e28('0x20')](function(_0x4b042d){logger[_0x4e28('0x16')](_0x4e28('0x38'),_0x4b042d['name']);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x4b042d['name']),_0x4e28('0x3b'),{'callNumber':_0x3d297e,'callerId':_0x3a2d9f,'callbackUrl':_0x3167c3});return _0x256db9[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x3c')});})[_0x4e28('0x25')](handleError(_0x256db9));};exports[_0x4e28('0x3d')]=function(_0x1822d4,_0x28dd5a){logger[_0x4e28('0x16')](_0x4e28('0x3e'),_0x1822d4[_0x4e28('0x32')]);var _0x5b752d=hangupValidation[_0x4e28('0xf')](_0x1822d4['body']);if(_0x5b752d[_0x4e28('0x2d')]>0x0){return _0x28dd5a[_0x4e28('0x1c')](0x190)[_0x4e28('0x33')](_0x5b752d);}var _0x16fc02=_0x1822d4[_0x4e28('0x32')][_0x4e28('0x34')];var _0x55aac0=_0x1822d4['body'][_0x4e28('0x2c')];return getAgent(_0x16fc02)[_0x4e28('0x20')](function(_0x49cbf9){logger[_0x4e28('0x16')]('entityFound:',_0x49cbf9[_0x4e28('0x1b')]);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x49cbf9[_0x4e28('0x1b')]),_0x4e28('0x3f'),{'sessionId':_0x55aac0});return _0x28dd5a[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x40')});})[_0x4e28('0x25')](handleError(_0x28dd5a));};exports[_0x4e28('0x41')]=function(_0xddf2ec,_0x2796d8){logger[_0x4e28('0x16')](_0x4e28('0x42'),_0xddf2ec[_0x4e28('0x32')]);var _0x29ddab=answerValidation['validate'](_0xddf2ec[_0x4e28('0x32')]);if(_0x29ddab[_0x4e28('0x2d')]>0x0){return _0x2796d8[_0x4e28('0x1c')](0x190)[_0x4e28('0x33')](_0x29ddab);}var _0x3fb833=_0xddf2ec['body'][_0x4e28('0x34')];var _0x1e788f=_0xddf2ec[_0x4e28('0x32')]['sessionId'];return getAgent(_0x3fb833)[_0x4e28('0x20')](function(_0x4bfae6){logger[_0x4e28('0x16')](_0x4e28('0x38'),_0x4bfae6['name']);emit(util[_0x4e28('0x39')]('user:%s',_0x4bfae6[_0x4e28('0x1b')]),_0x4e28('0x43'),{'sessionId':_0x1e788f});return _0x2796d8[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x44')});})[_0x4e28('0x25')](handleError(_0x2796d8));};exports[_0x4e28('0x45')]=function(_0x4169d6,_0x376f76){logger[_0x4e28('0x16')](_0x4e28('0x46'),_0x4169d6['body']);var _0x28f5de=holdValidation[_0x4e28('0xf')](_0x4169d6[_0x4e28('0x32')]);if(_0x28f5de[_0x4e28('0x2d')]>0x0){return _0x376f76['status'](0x190)[_0x4e28('0x33')](_0x28f5de);}var _0x18cd16=_0x4169d6['body'][_0x4e28('0x34')];var _0x517e31=_0x4169d6[_0x4e28('0x32')][_0x4e28('0x2c')];return getAgent(_0x18cd16)[_0x4e28('0x20')](function(_0x2a178f){logger['info'](_0x4e28('0x38'),_0x2a178f[_0x4e28('0x1b')]);emit(util[_0x4e28('0x39')]('user:%s',_0x2a178f[_0x4e28('0x1b')]),_0x4e28('0x47'),{'sessionId':_0x517e31});return _0x376f76[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x48')});})[_0x4e28('0x25')](handleError(_0x376f76));};exports[_0x4e28('0x49')]=function(_0x44e978,_0x35c507){logger['info']('unhold\x20fired:',_0x44e978[_0x4e28('0x32')]);var _0x892cb1=unholdValidation[_0x4e28('0xf')](_0x44e978[_0x4e28('0x32')]);if(_0x892cb1[_0x4e28('0x2d')]>0x0){return _0x35c507[_0x4e28('0x1c')](0x190)['json'](_0x892cb1);}var _0x12fa57=_0x44e978[_0x4e28('0x32')]['userId'];var _0x106db1=_0x44e978[_0x4e28('0x32')]['sessionId'];return getAgent(_0x12fa57)[_0x4e28('0x20')](function(_0x32c036){logger['info']('entityFound:',_0x32c036['name']);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x32c036['name']),_0x4e28('0x4a'),{'sessionId':_0x106db1});return _0x35c507[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x4b')});})[_0x4e28('0x25')](handleError(_0x35c507));};exports[_0x4e28('0x4c')]=function(_0x5239ab,_0x499c45){logger[_0x4e28('0x16')](_0x4e28('0x4d'),_0x499c45['body']);var _0x27b071=callsValidation[_0x4e28('0xf')](_0x5239ab[_0x4e28('0x32')]);if(_0x27b071['length']>0x0){return _0x499c45[_0x4e28('0x1c')](0x190)[_0x4e28('0x33')](_0x27b071);}var _0x4d268d=_0x5239ab['body']['userId'];var _0x3e4533=respondWithRpcPromise('VoiceChannels');var _0x2a6301=getAgent(_0x4d268d);return Promise['all']([_0x3e4533,_0x2a6301])[_0x4e28('0x20')](function(_0x5523aa){var _0x2011f0=_0x5523aa[0x0];var _0x511b9d=_0x5523aa[0x1];var _0x2482e5=_[_0x4e28('0x2a')](_0x2011f0[_0x4e28('0x4e')],function(_0x47d8ad){return _0x47d8ad[_0x4e28('0x2b')]==_0x511b9d['id'];});return _0x499c45[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'count':_0x2482e5['length'],'rows':_0x2482e5});})[_0x4e28('0x25')](handleError(_0x499c45));};exports['conference']=function(_0x58f015,_0xe16cc6){logger[_0x4e28('0x16')](_0x4e28('0x4f'),_0x58f015[_0x4e28('0x32')]);var _0x387b66=conferenceValidation[_0x4e28('0xf')](_0x58f015['body']);if(_0x387b66['length']>0x0){return _0xe16cc6['status'](0x190)[_0x4e28('0x33')](_0x387b66);}var _0x3fe20d=_0x58f015['body'][_0x4e28('0x34')];return getAgent(_0x3fe20d)['then'](function(_0x3430d4){logger['info'](_0x4e28('0x38'),_0x3430d4[_0x4e28('0x1b')]);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x3430d4[_0x4e28('0x1b')]),_0x4e28('0x50'));return _0xe16cc6[_0x4e28('0x1c')](0xc8)['json']({'error':![],'message':_0x4e28('0x51')});})[_0x4e28('0x25')](handleError(_0xe16cc6));};exports['transfer']=function(_0x1e99ba,_0x107a17){logger[_0x4e28('0x16')](_0x4e28('0x52'),_0x1e99ba[_0x4e28('0x32')]);var _0x1cd285=transferValidation['validate'](_0x1e99ba['body']);if(_0x1cd285[_0x4e28('0x2d')]>0x0){return _0x107a17['status'](0x190)[_0x4e28('0x33')](_0x1cd285);}var _0x27a848=_0x1e99ba['body'][_0x4e28('0x34')];var _0x5045e7=_0x1e99ba[_0x4e28('0x32')][_0x4e28('0x2c')];var _0x395b1f=_0x1e99ba[_0x4e28('0x32')][_0x4e28('0x53')];return getAgent(_0x27a848)['then'](function(_0x243a8f){logger[_0x4e28('0x16')](_0x4e28('0x38'),_0x243a8f[_0x4e28('0x1b')]);emit(util[_0x4e28('0x39')](_0x4e28('0x3a'),_0x243a8f['name']),_0x4e28('0x54'),{'sessionId':_0x5045e7,'transferNumber':_0x395b1f});return _0x107a17[_0x4e28('0x1c')](0xc8)[_0x4e28('0x33')]({'error':![],'message':_0x4e28('0x55')});})[_0x4e28('0x25')](handleError(_0x107a17));}; \ No newline at end of file +var _0xc1a9=['transferNumber\x20is\x20required','number','info','handleError:','error','stack','name','status','send','request','then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','callbackUrl','entityFound:','originate\x20executed!','hangup','hangup\x20fired:','sessionId','format','hangup\x20executed!','answer\x20fired:','userId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','user:%s','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xc1a9,0x16f));var _0x9c1a=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xc1a9[_0x439d59];return _0x3670c7;};'use strict';var path=require(_0x9c1a('0x0'));var fs=require('fs');var _=require(_0x9c1a('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x9c1a('0x2'));var util=require(_0x9c1a('0x3'));var BPromise=require('bluebird');var jayson=require(_0x9c1a('0x4'));var amiClient=jayson[_0x9c1a('0x5')][_0x9c1a('0x6')]({'port':0x232a});var logger=require(_0x9c1a('0x7'))(_0x9c1a('0x8'));var Redis=require(_0x9c1a('0x9'));config[_0x9c1a('0xa')]=_[_0x9c1a('0xb')](config[_0x9c1a('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x9c1a('0xc'))(new Redis(config[_0x9c1a('0xa')]));var Schema=require(_0x9c1a('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x9c1a('0xe')]},'callerId':{'type':_0x9c1a('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9c1a('0x10')]},'sessionId':{'type':_0x9c1a('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9c1a('0x10')]},'sessionId':{'type':_0x9c1a('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9c1a('0x10')]},'sessionId':{'type':_0x9c1a('0xf'),'required':[!![],_0x9c1a('0x11')]},'transferNumber':{'type':_0x9c1a('0xf'),'required':[!![],_0x9c1a('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x9c1a('0x13'),'required':[!![],_0x9c1a('0x10')]},'sessionId':{'type':_0x9c1a('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9c1a('0x13'),'required':[!![],_0x9c1a('0x10')]},'sessionId':{'type':_0x9c1a('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x9c1a('0x13'),'required':[!![],_0x9c1a('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9c1a('0x10')]}});function emit(_0x54c644,_0x49a876,_0x1a4c02){logger[_0x9c1a('0x14')](_0x54c644,_0x49a876,JSON['stringify'](_0x1a4c02));io['to'](_0x54c644)['emit'](_0x49a876,_0x1a4c02);}function handleError(_0x22d95b){return function(_0x299b82){console['log'](_0x9c1a('0x15'),_0x299b82,_0x299b82 instanceof RangeError);logger[_0x9c1a('0x16')](_0x299b82[_0x9c1a('0x17')]);if(_0x299b82 instanceof RangeError){if(_0x299b82[_0x9c1a('0x18')]){delete _0x299b82[_0x9c1a('0x18')];}_0x22d95b[_0x9c1a('0x19')](0x194)[_0x9c1a('0x1a')](_0x299b82);}else{if(_0x299b82[_0x9c1a('0x18')]){delete _0x299b82[_0x9c1a('0x18')];}_0x22d95b[_0x9c1a('0x19')](0x1f4)[_0x9c1a('0x1a')](_0x299b82);}};}function checkError(){return function(_0xa92266){if(!_0xa92266){throw new RangeError('NotFound');}return _0xa92266;};}function respondWithRpcPromise(_0x172a82,_0x40883f){return new BPromise(function(_0x4a7022,_0x17931a){var _0x47b1c4=amiClient;return _0x47b1c4[_0x9c1a('0x1b')](_0x172a82,_0x40883f)[_0x9c1a('0x1c')](function(_0x47fb72){if(_0x47fb72[_0x9c1a('0x16')]){if(_0x47fb72[_0x9c1a('0x16')][_0x9c1a('0x1d')]===0x1f4){return _0x17931a(_0x47fb72[_0x9c1a('0x16')]['message']);}return _0x4a7022(_0x47fb72[_0x9c1a('0x16')][_0x9c1a('0x1e')]);}else{_0x4a7022(_0x47fb72[_0x9c1a('0x1f')]);}})[_0x9c1a('0x20')](function(_0x38a6fb){_0x17931a(_0x38a6fb);});});}function getAgent(_0x24cd6b){return db[_0x9c1a('0x21')][_0x9c1a('0x22')]({'where':{'id':_0x24cd6b,'role':'agent'}})[_0x9c1a('0x1c')](checkError());}function getAgentCheckSession(_0x29ce22,_0x3c8a1a){return new BPromise(function(_0x35d4e3,_0x4e7dbd){var _0x172c50=respondWithRpcPromise(_0x9c1a('0x23'));var _0x1d6394=getAgent(_0x29ce22);Promise[_0x9c1a('0x24')]([_0x172c50,_0x1d6394])[_0x9c1a('0x1c')](function(_0x303b8d){var _0x596a0f=_0x303b8d[0x0];var _0x54b396=_0x303b8d[0x1];var _0xe6f011=_[_0x9c1a('0x25')](_0x596a0f[_0x9c1a('0x26')],function(_0x29282c){return _0x29282c[_0x9c1a('0x27')]==_0x54b396['id']&&_0x29282c['sessionId']==_0x3c8a1a;});if(_0xe6f011['length']==0x1){_0x35d4e3(_0x54b396);}else{_0x4e7dbd(new RangeError(_0x9c1a('0x28')+_0x3c8a1a+_0x9c1a('0x29')));}});});}exports[_0x9c1a('0x2a')]=function(_0x30cb06,_0x52669f){logger[_0x9c1a('0x14')](_0x9c1a('0x2b'),_0x30cb06[_0x9c1a('0x2c')]);var _0x3d11e9=originateValidation['validate'](_0x30cb06[_0x9c1a('0x2c')]);if(_0x3d11e9[_0x9c1a('0x2d')]>0x0){return _0x52669f['status'](0x190)[_0x9c1a('0x2e')](_0x3d11e9);}var _0x216b78=_0x30cb06[_0x9c1a('0x2c')]['userId'];var _0x5897a8=_0x30cb06[_0x9c1a('0x2c')]['callNumber'];var _0x24f5e3=_0x30cb06['body']['callerId'];var _0x1dc1ff=_0x30cb06[_0x9c1a('0x2c')][_0x9c1a('0x2f')];return getAgent(_0x216b78)[_0x9c1a('0x1c')](function(_0x355cb0){logger[_0x9c1a('0x14')](_0x9c1a('0x30'),_0x355cb0[_0x9c1a('0x18')]);emit(util['format']('user:%s',_0x355cb0[_0x9c1a('0x18')]),'webbar:originate',{'callNumber':_0x5897a8,'callerId':_0x24f5e3,'callbackUrl':_0x1dc1ff});return _0x52669f[_0x9c1a('0x19')](0xc8)[_0x9c1a('0x2e')]({'error':![],'message':_0x9c1a('0x31')});})[_0x9c1a('0x20')](handleError(_0x52669f));};exports[_0x9c1a('0x32')]=function(_0x312460,_0x1a21fd){logger['info'](_0x9c1a('0x33'),_0x312460['body']);var _0x13af55=hangupValidation[_0x9c1a('0xd')](_0x312460[_0x9c1a('0x2c')]);if(_0x13af55[_0x9c1a('0x2d')]>0x0){return _0x1a21fd[_0x9c1a('0x19')](0x190)[_0x9c1a('0x2e')](_0x13af55);}var _0x46624c=_0x312460['body']['userId'];var _0xac1ccc=_0x312460[_0x9c1a('0x2c')][_0x9c1a('0x34')];return getAgent(_0x46624c)[_0x9c1a('0x1c')](function(_0x3ba232){logger[_0x9c1a('0x14')](_0x9c1a('0x30'),_0x3ba232[_0x9c1a('0x18')]);emit(util[_0x9c1a('0x35')]('user:%s',_0x3ba232['name']),'webbar:hangup',{'sessionId':_0xac1ccc});return _0x1a21fd[_0x9c1a('0x19')](0xc8)['json']({'error':![],'message':_0x9c1a('0x36')});})['catch'](handleError(_0x1a21fd));};exports['answer']=function(_0x14cabe,_0x7b1fc8){logger['info'](_0x9c1a('0x37'),_0x14cabe[_0x9c1a('0x2c')]);var _0x46d573=answerValidation['validate'](_0x14cabe[_0x9c1a('0x2c')]);if(_0x46d573['length']>0x0){return _0x7b1fc8[_0x9c1a('0x19')](0x190)[_0x9c1a('0x2e')](_0x46d573);}var _0x104625=_0x14cabe['body'][_0x9c1a('0x38')];var _0x1413b4=_0x14cabe['body'][_0x9c1a('0x34')];return getAgent(_0x104625)[_0x9c1a('0x1c')](function(_0x3581b9){logger['info'](_0x9c1a('0x30'),_0x3581b9[_0x9c1a('0x18')]);emit(util[_0x9c1a('0x35')]('user:%s',_0x3581b9[_0x9c1a('0x18')]),_0x9c1a('0x39'),{'sessionId':_0x1413b4});return _0x7b1fc8[_0x9c1a('0x19')](0xc8)[_0x9c1a('0x2e')]({'error':![],'message':_0x9c1a('0x3a')});})['catch'](handleError(_0x7b1fc8));};exports[_0x9c1a('0x3b')]=function(_0x21cc9c,_0x157ca8){logger[_0x9c1a('0x14')](_0x9c1a('0x3c'),_0x21cc9c['body']);var _0x5d32bf=holdValidation['validate'](_0x21cc9c[_0x9c1a('0x2c')]);if(_0x5d32bf[_0x9c1a('0x2d')]>0x0){return _0x157ca8['status'](0x190)[_0x9c1a('0x2e')](_0x5d32bf);}var _0x1934f7=_0x21cc9c[_0x9c1a('0x2c')]['userId'];var _0x25756a=_0x21cc9c[_0x9c1a('0x2c')][_0x9c1a('0x34')];return getAgent(_0x1934f7)[_0x9c1a('0x1c')](function(_0x2ca9d9){logger[_0x9c1a('0x14')]('entityFound:',_0x2ca9d9[_0x9c1a('0x18')]);emit(util[_0x9c1a('0x35')](_0x9c1a('0x3d'),_0x2ca9d9[_0x9c1a('0x18')]),_0x9c1a('0x3e'),{'sessionId':_0x25756a});return _0x157ca8[_0x9c1a('0x19')](0xc8)['json']({'error':![],'message':_0x9c1a('0x3f')});})['catch'](handleError(_0x157ca8));};exports[_0x9c1a('0x40')]=function(_0x1ff906,_0x51965e){logger[_0x9c1a('0x14')](_0x9c1a('0x41'),_0x1ff906[_0x9c1a('0x2c')]);var _0x28258d=unholdValidation[_0x9c1a('0xd')](_0x1ff906[_0x9c1a('0x2c')]);if(_0x28258d[_0x9c1a('0x2d')]>0x0){return _0x51965e[_0x9c1a('0x19')](0x190)[_0x9c1a('0x2e')](_0x28258d);}var _0x15eae6=_0x1ff906[_0x9c1a('0x2c')][_0x9c1a('0x38')];var _0x55de97=_0x1ff906[_0x9c1a('0x2c')]['sessionId'];return getAgent(_0x15eae6)[_0x9c1a('0x1c')](function(_0x61f05){logger['info'](_0x9c1a('0x30'),_0x61f05[_0x9c1a('0x18')]);emit(util['format'](_0x9c1a('0x3d'),_0x61f05[_0x9c1a('0x18')]),_0x9c1a('0x42'),{'sessionId':_0x55de97});return _0x51965e[_0x9c1a('0x19')](0xc8)[_0x9c1a('0x2e')]({'error':![],'message':_0x9c1a('0x43')});})[_0x9c1a('0x20')](handleError(_0x51965e));};exports[_0x9c1a('0x44')]=function(_0x3fdaca,_0x5928c8){logger[_0x9c1a('0x14')](_0x9c1a('0x45'),_0x5928c8[_0x9c1a('0x2c')]);var _0x5d5975=callsValidation[_0x9c1a('0xd')](_0x3fdaca[_0x9c1a('0x2c')]);if(_0x5d5975[_0x9c1a('0x2d')]>0x0){return _0x5928c8['status'](0x190)['json'](_0x5d5975);}var _0x14d307=_0x3fdaca[_0x9c1a('0x2c')][_0x9c1a('0x38')];var _0x178ccc=respondWithRpcPromise(_0x9c1a('0x23'));var _0x2818ea=getAgent(_0x14d307);return Promise[_0x9c1a('0x24')]([_0x178ccc,_0x2818ea])[_0x9c1a('0x1c')](function(_0x3f2805){var _0xb334ef=_0x3f2805[0x0];var _0x285f0a=_0x3f2805[0x1];var _0x24f356=_['filter'](_0xb334ef['rows'],function(_0x2cfbde){return _0x2cfbde['UserId']==_0x285f0a['id'];});return _0x5928c8['status'](0xc8)[_0x9c1a('0x2e')]({'count':_0x24f356[_0x9c1a('0x2d')],'rows':_0x24f356});})[_0x9c1a('0x20')](handleError(_0x5928c8));};exports['conference']=function(_0x56aa30,_0xa22576){logger[_0x9c1a('0x14')](_0x9c1a('0x46'),_0x56aa30[_0x9c1a('0x2c')]);var _0xe69996=conferenceValidation[_0x9c1a('0xd')](_0x56aa30[_0x9c1a('0x2c')]);if(_0xe69996[_0x9c1a('0x2d')]>0x0){return _0xa22576[_0x9c1a('0x19')](0x190)['json'](_0xe69996);}var _0x15e556=_0x56aa30[_0x9c1a('0x2c')]['userId'];return getAgent(_0x15e556)[_0x9c1a('0x1c')](function(_0x250fa3){logger[_0x9c1a('0x14')](_0x9c1a('0x30'),_0x250fa3[_0x9c1a('0x18')]);emit(util[_0x9c1a('0x35')](_0x9c1a('0x3d'),_0x250fa3[_0x9c1a('0x18')]),_0x9c1a('0x47'));return _0xa22576[_0x9c1a('0x19')](0xc8)[_0x9c1a('0x2e')]({'error':![],'message':_0x9c1a('0x48')});})[_0x9c1a('0x20')](handleError(_0xa22576));};exports[_0x9c1a('0x49')]=function(_0x469ab2,_0x463acb){logger[_0x9c1a('0x14')]('transfer\x20fired:',_0x469ab2[_0x9c1a('0x2c')]);var _0x2efbe6=transferValidation[_0x9c1a('0xd')](_0x469ab2[_0x9c1a('0x2c')]);if(_0x2efbe6[_0x9c1a('0x2d')]>0x0){return _0x463acb[_0x9c1a('0x19')](0x190)[_0x9c1a('0x2e')](_0x2efbe6);}var _0x28d26d=_0x469ab2[_0x9c1a('0x2c')]['userId'];var _0x4e5ffa=_0x469ab2['body'][_0x9c1a('0x34')];var _0xa345ca=_0x469ab2[_0x9c1a('0x2c')][_0x9c1a('0x4a')];return getAgent(_0x28d26d)['then'](function(_0x2ab50b){logger[_0x9c1a('0x14')](_0x9c1a('0x30'),_0x2ab50b[_0x9c1a('0x18')]);emit(util[_0x9c1a('0x35')](_0x9c1a('0x3d'),_0x2ab50b[_0x9c1a('0x18')]),_0x9c1a('0x4b'),{'sessionId':_0x4e5ffa,'transferNumber':_0xa345ca});return _0x463acb['status'](0xc8)[_0x9c1a('0x2e')]({'error':![],'message':_0x9c1a('0x4c')});})[_0x9c1a('0x20')](handleError(_0x463acb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 88bbbdf..a667ecb 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 _0xcf2e=['connect-timeout','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAgents','addApplications','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x5ac1ea,_0xc4362b){var _0x6e545d=function(_0x42b9af){while(--_0x42b9af){_0x5ac1ea['push'](_0x5ac1ea['shift']());}};_0x6e545d(++_0xc4362b);}(_0xcf2e,0x18a));var _0xecf2=function(_0x37153e,_0x15c383){_0x37153e=_0x37153e-0x0;var _0x3d2981=_0xcf2e[_0x37153e];return _0x3d2981;};'use strict';var multer=require(_0xecf2('0x0'));var util=require(_0xecf2('0x1'));var path=require('path');var timeout=require(_0xecf2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xecf2('0x3'));var interaction=require(_0xecf2('0x4'));var config=require('../../config/environment');var controller=require(_0xecf2('0x5'));router[_0xecf2('0x6')]('/',auth[_0xecf2('0x7')](),controller[_0xecf2('0x8')]);router[_0xecf2('0x6')](_0xecf2('0x9'),auth[_0xecf2('0x7')](),controller['describe']);router['get'](_0xecf2('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xecf2('0xb'),auth[_0xecf2('0x7')](),controller[_0xecf2('0xc')]);router['get'](_0xecf2('0xd'),auth[_0xecf2('0x7')](),controller[_0xecf2('0xe')]);router[_0xecf2('0x6')](_0xecf2('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0xecf2('0x6')](_0xecf2('0x10'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x11')]);router['post']('/',auth[_0xecf2('0x7')](),controller['create']);router[_0xecf2('0x12')](_0xecf2('0xb'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x13')]);router['post'](_0xecf2('0xd'),auth[_0xecf2('0x7')](),controller['addAnswer']);router[_0xecf2('0x12')]('/:id/users',auth[_0xecf2('0x7')](),controller[_0xecf2('0x14')]);router[_0xecf2('0x12')](_0xecf2('0x10'),auth['isAuthenticated'](),controller[_0xecf2('0x15')]);router[_0xecf2('0x12')]('/:id/notify',controller[_0xecf2('0x16')]);router['post'](_0xecf2('0x17'),auth['isAuthenticated'](),controller[_0xecf2('0x18')]);router[_0xecf2('0x19')](_0xecf2('0xa'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x1a')]);router[_0xecf2('0x1b')](_0xecf2('0xa'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x1c')]);router[_0xecf2('0x1b')](_0xecf2('0xb'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x1d')]);router['delete'](_0xecf2('0xd'),auth[_0xecf2('0x7')](),controller[_0xecf2('0x1e')]);router[_0xecf2('0x1b')]('/:id/users',auth[_0xecf2('0x7')](),controller[_0xecf2('0x1f')]);module[_0xecf2('0x20')]=router; \ No newline at end of file +var _0xe745=['../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','addApplications','/:id/notify','notify','/:id/send','/:id','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0xa519c2,_0x5af9ad){var _0x4fff69=function(_0x4088ec){while(--_0x4088ec){_0xa519c2['push'](_0xa519c2['shift']());}};_0x4fff69(++_0x5af9ad);}(_0xe745,0x1a8));var _0x5e74=function(_0x125c32,_0x4253d1){_0x125c32=_0x125c32-0x0;var _0x4b4700=_0xe745[_0x125c32];return _0x4b4700;};'use strict';var multer=require('multer');var util=require(_0x5e74('0x0'));var path=require(_0x5e74('0x1'));var timeout=require(_0x5e74('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5e74('0x3'));var auth=require(_0x5e74('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5e74('0x5'));var controller=require(_0x5e74('0x6'));router[_0x5e74('0x7')]('/',auth[_0x5e74('0x8')](),controller[_0x5e74('0x9')]);router[_0x5e74('0x7')](_0x5e74('0xa'),auth[_0x5e74('0x8')](),controller[_0x5e74('0xb')]);router[_0x5e74('0x7')]('/:id',auth[_0x5e74('0x8')](),controller['show']);router[_0x5e74('0x7')](_0x5e74('0xc'),auth[_0x5e74('0x8')](),controller[_0x5e74('0xd')]);router[_0x5e74('0x7')](_0x5e74('0xe'),auth[_0x5e74('0x8')](),controller['getAnswers']);router[_0x5e74('0x7')]('/:id/users',auth[_0x5e74('0x8')](),controller[_0x5e74('0xf')]);router[_0x5e74('0x7')](_0x5e74('0x10'),auth[_0x5e74('0x8')](),controller[_0x5e74('0x11')]);router[_0x5e74('0x12')]('/',auth[_0x5e74('0x8')](),controller[_0x5e74('0x13')]);router[_0x5e74('0x12')](_0x5e74('0xc'),auth[_0x5e74('0x8')](),controller['addDisposition']);router[_0x5e74('0x12')](_0x5e74('0xe'),auth[_0x5e74('0x8')](),controller[_0x5e74('0x14')]);router[_0x5e74('0x12')]('/:id/users',auth[_0x5e74('0x8')](),controller['addAgents']);router[_0x5e74('0x12')](_0x5e74('0x10'),auth['isAuthenticated'](),controller[_0x5e74('0x15')]);router[_0x5e74('0x12')](_0x5e74('0x16'),controller[_0x5e74('0x17')]);router[_0x5e74('0x12')](_0x5e74('0x18'),auth[_0x5e74('0x8')](),controller['send']);router['put'](_0x5e74('0x19'),auth['isAuthenticated'](),controller['update']);router[_0x5e74('0x1a')](_0x5e74('0x19'),auth[_0x5e74('0x8')](),controller[_0x5e74('0x1b')]);router[_0x5e74('0x1a')](_0x5e74('0xc'),auth[_0x5e74('0x8')](),controller[_0x5e74('0x1c')]);router['delete'](_0x5e74('0xe'),auth[_0x5e74('0x8')](),controller[_0x5e74('0x1d')]);router[_0x5e74('0x1a')](_0x5e74('0x1e'),auth[_0x5e74('0x8')](),controller[_0x5e74('0x1f')]);module[_0x5e74('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5b0b1ae..b192e20 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 _0x8d40=['mandatoryDisposition','sequelize','exports','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue'];(function(_0x2e96a6,_0x3f9579){var _0x363593=function(_0x48d13c){while(--_0x48d13c){_0x2e96a6['push'](_0x2e96a6['shift']());}};_0x363593(++_0x3f9579);}(_0x8d40,0x9b));var _0x08d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d40[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x08d4('0x0'));var rs=require('randomstring');module[_0x08d4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x08d4('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x08d4('0x3')]();}},'phone':{'type':Sequelize[_0x08d4('0x2')]},'type':{'type':Sequelize[_0x08d4('0x4')](_0x08d4('0x5'),_0x08d4('0x6'))},'accountSid':{'type':Sequelize[_0x08d4('0x2')]},'baseUrl':{'type':Sequelize[_0x08d4('0x2')]},'authToken':{'type':Sequelize[_0x08d4('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x08d4('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x08d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x08d4('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x08d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x08d4('0x8')],'comment':_0x08d4('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x462c43){if(!_0x462c43){this['setDataValue'](_0x08d4('0xb'),null);}this[_0x08d4('0xc')](_0x08d4('0xd'),_0x462c43);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9dca=['twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM'];(function(_0x473180,_0x2d33a7){var _0x14a844=function(_0x5ec1cb){while(--_0x5ec1cb){_0x473180['push'](_0x473180['shift']());}};_0x14a844(++_0x2d33a7);}(_0x9dca,0x1da));var _0xa9dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dca[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa9dc('0x0'));var rs=require(_0xa9dc('0x1'));module['exports']={'name':{'type':Sequelize[_0xa9dc('0x2')],'unique':_0xa9dc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa9dc('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa9dc('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa9dc('0x2')],'defaultValue':function(){return rs[_0xa9dc('0x4')]();}},'phone':{'type':Sequelize[_0xa9dc('0x2')]},'type':{'type':Sequelize[_0xa9dc('0x5')](_0xa9dc('0x6'),_0xa9dc('0x7'))},'accountSid':{'type':Sequelize[_0xa9dc('0x2')]},'baseUrl':{'type':Sequelize[_0xa9dc('0x2')]},'authToken':{'type':Sequelize[_0xa9dc('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa9dc('0x8')],'defaultValue':function(){return _0xa9dc('0x9');}},'notificationSound':{'type':Sequelize[_0xa9dc('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa9dc('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa9dc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa9dc('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9dc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9dc('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9dc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9dc('0xb')],'comment':_0xa9dc('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xa9dc('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x40155e){if(!_0x40155e){this[_0xa9dc('0xd')](_0xa9dc('0xe'),null);}this['setDataValue'](_0xa9dc('0xf'),_0x40155e);}},'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 f5b7bee..5d64906 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 _0x89f5=['nolimit','removeAnswers','omit','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','receiveMessage','entity\x20found','debug','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','stack','name','send','index','WhatsappAccount','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','Pause','mandatoryDispositionPause','rawAttributes','includeAll','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89f5,0x118));var _0x589f=function(_0x1e107b,_0x2849cf){_0x1e107b=_0x1e107b-0x0;var _0x19ebec=_0x89f5[_0x1e107b];return _0x19ebec;};'use strict';var emlformat=require(_0x589f('0x0'));var rimraf=require(_0x589f('0x1'));var zipdir=require(_0x589f('0x2'));var jsonpatch=require(_0x589f('0x3'));var rp=require('request-promise');var moment=require(_0x589f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x589f('0x5'));var path=require(_0x589f('0x6'));var sox=require(_0x589f('0x7'));var csv=require(_0x589f('0x8'));var ejs=require(_0x589f('0x9'));var fs=require('fs');var fs_extra=require(_0x589f('0xa'));var _=require(_0x589f('0xb'));var squel=require(_0x589f('0xc'));var crypto=require(_0x589f('0xd'));var jsforce=require(_0x589f('0xe'));var deskjs=require(_0x589f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x589f('0x10'));var Redis=require(_0x589f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x589f('0x12'));var as=require(_0x589f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x589f('0x14'))(_0x589f('0x15'));var utils=require(_0x589f('0x16'));var config=require(_0x589f('0x17'));var licenseUtil=require(_0x589f('0x18'));var db=require('../../mysqldb')['db'];config[_0x589f('0x19')]=_[_0x589f('0x1a')](config[_0x589f('0x19')],{'host':_0x589f('0x1b'),'port':0x18eb});var socket=require(_0x589f('0x1c'))(new Redis(config[_0x589f('0x19')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x589f('0x1d'));var client=jayson['client'][_0x589f('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x15475c,_0x451dee,_0x1366bb,_0xa48556){return new BPromise(function(_0x283772,_0x2ac926){var _0x47ec3c=_0xa48556||client;return _0x47ec3c[_0x589f('0x1f')](_0x15475c,_0x1366bb)[_0x589f('0x20')](function(_0x1cd752){logger[_0x589f('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x451dee,'request\x20sent');logger['debug'](_0x589f('0x22'),_0x451dee,_0x589f('0x23'),JSON[_0x589f('0x24')](_0x1cd752));if(_0x1cd752[_0x589f('0x25')]){if(_0x1cd752[_0x589f('0x25')][_0x589f('0x26')]===0x1f4){logger[_0x589f('0x25')](_0x589f('0x27'),_0x451dee,_0x1cd752[_0x589f('0x25')][_0x589f('0x28')]);return _0x2ac926(_0x1cd752[_0x589f('0x25')][_0x589f('0x28')]);}logger['error'](_0x589f('0x27'),_0x451dee,_0x1cd752[_0x589f('0x25')][_0x589f('0x28')]);return _0x283772(_0x1cd752[_0x589f('0x25')][_0x589f('0x28')]);}else{logger[_0x589f('0x21')](_0x589f('0x27'),_0x451dee,_0x589f('0x23'));_0x283772(_0x1cd752[_0x589f('0x29')][_0x589f('0x28')]);}})[_0x589f('0x2a')](function(_0x52a065){logger[_0x589f('0x25')](_0x589f('0x27'),_0x451dee,_0x52a065);_0x2ac926(_0x52a065);});});}function respondWithStatusCode(_0x5bb8ac,_0x25e999){_0x25e999=_0x25e999||0xcc;return function(_0x352648){if(_0x352648){return _0x5bb8ac[_0x589f('0x2b')](_0x25e999);}return _0x5bb8ac[_0x589f('0x2c')](_0x25e999)[_0x589f('0x2d')]();};}function respondWithResult(_0x2dc5ba,_0x268c1b){_0x268c1b=_0x268c1b||0xc8;return function(_0x43b340){if(_0x43b340){return _0x2dc5ba[_0x589f('0x2c')](_0x268c1b)[_0x589f('0x2e')](_0x43b340);}};}function respondWithFilteredResult(_0x48b0c2,_0x360495){return function(_0x316859){if(_0x316859){var _0x388c50=typeof _0x360495[_0x589f('0x2f')]===_0x589f('0x30')&&typeof _0x360495[_0x589f('0x31')]===_0x589f('0x30');var _0x40b0ab=_0x316859['count'];var _0x39b288=_0x388c50?0x0:_0x360495['offset'];var _0x1ceca3=_0x388c50?_0x316859[_0x589f('0x32')]:_0x360495[_0x589f('0x2f')]+_0x360495[_0x589f('0x31')];var _0x38cd4d;if(_0x1ceca3>=_0x40b0ab){_0x1ceca3=_0x40b0ab;_0x38cd4d=0xc8;}else{_0x38cd4d=0xce;}_0x48b0c2['status'](_0x38cd4d);return _0x48b0c2['set'](_0x589f('0x33'),_0x39b288+'-'+_0x1ceca3+'/'+_0x40b0ab)['json'](_0x316859);}return null;};}function patchUpdates(_0x4b2155){return function(_0x3ec884){try{jsonpatch[_0x589f('0x34')](_0x3ec884,_0x4b2155,!![]);}catch(_0x292b9e){return BPromise[_0x589f('0x35')](_0x292b9e);}return _0x3ec884[_0x589f('0x36')]();};}function saveUpdates(_0x58a909,_0x324789){return function(_0x12a6aa){if(_0x12a6aa){return _0x12a6aa[_0x589f('0x37')](_0x58a909)['then'](function(_0xbe754c){return _0xbe754c;});}return null;};}function removeEntity(_0x24ba47,_0x3d5394){return function(_0x38b1b9){if(_0x38b1b9){return _0x38b1b9[_0x589f('0x38')]()[_0x589f('0x20')](function(){var _0x44686c=_0x38b1b9[_0x589f('0x39')]({'plain':!![]});var _0x59e973=_0x589f('0x3a');return db['UserProfileResource'][_0x589f('0x38')]({'where':{'type':_0x59e973,'resourceId':_0x44686c['id']}})[_0x589f('0x20')](function(){return _0x38b1b9;});})[_0x589f('0x20')](function(){_0x24ba47['status'](0xcc)[_0x589f('0x2d')]();});}};}function handleEntityNotFound(_0x2590b0,_0x419413){return function(_0x12cf87){if(!_0x12cf87){_0x2590b0['sendStatus'](0x194);}return _0x12cf87;};}function handleError(_0xe9f759,_0xe2c4c7){_0xe2c4c7=_0xe2c4c7||0x1f4;return function(_0x4d0839){logger['error'](_0x4d0839[_0x589f('0x3b')]);if(_0x4d0839[_0x589f('0x3c')]){delete _0x4d0839['name'];}_0xe9f759['status'](_0xe2c4c7)[_0x589f('0x3d')](_0x4d0839);};}exports[_0x589f('0x3e')]=function(_0x4590fa,_0x13400e){var _0xa81305={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4a700d={},_0x37d0e7={'count':0x0,'rows':[]};var _0x54b857=_['map'](db[_0x589f('0x3f')]['rawAttributes'],function(_0x26d684){return{'name':_0x26d684[_0x589f('0x40')],'type':_0x26d684[_0x589f('0x41')][_0x589f('0x42')]};});_0x4a700d[_0x589f('0x43')]=_[_0x589f('0x44')](_0x54b857,_0x589f('0x3c'));_0x4a700d['query']=_[_0x589f('0x45')](_0x4590fa['query']);_0x4a700d[_0x589f('0x46')]=_['intersection'](_0x4a700d['model'],_0x4a700d[_0x589f('0x47')]);_0xa81305[_0x589f('0x48')]=_[_0x589f('0x49')](_0x4a700d[_0x589f('0x43')],qs[_0x589f('0x4a')](_0x4590fa['query']['fields']));_0xa81305[_0x589f('0x48')]=_0xa81305['attributes'][_0x589f('0x4b')]?_0xa81305['attributes']:_0x4a700d[_0x589f('0x43')];if(!_0x4590fa[_0x589f('0x47')][_0x589f('0x4c')]('nolimit')){_0xa81305[_0x589f('0x31')]=qs['limit'](_0x4590fa[_0x589f('0x47')][_0x589f('0x31')]);_0xa81305[_0x589f('0x2f')]=qs[_0x589f('0x2f')](_0x4590fa[_0x589f('0x47')]['offset']);}_0xa81305[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x4590fa[_0x589f('0x47')][_0x589f('0x4e')]);_0xa81305[_0x589f('0x4f')]=qs['filters'](_[_0x589f('0x50')](_0x4590fa[_0x589f('0x47')],_0x4a700d[_0x589f('0x46')]),_0x54b857);if(_0x4590fa['query'][_0x589f('0x51')]){_0xa81305[_0x589f('0x4f')]=_['merge'](_0xa81305[_0x589f('0x4f')],{'$or':_[_0x589f('0x44')](_0x54b857,function(_0x244c47){if(_0x244c47[_0x589f('0x41')]!=='VIRTUAL'){var _0x42910b={};_0x42910b[_0x244c47[_0x589f('0x3c')]]={'$like':'%'+_0x4590fa[_0x589f('0x47')]['filter']+'%'};return _0x42910b;}})});}_0xa81305=_[_0x589f('0x52')]({},_0xa81305,_0x4590fa[_0x589f('0x53')]);var _0x2dc894={'where':_0xa81305[_0x589f('0x4f')]};return db['WhatsappAccount']['count'](_0x2dc894)[_0x589f('0x20')](function(_0x2ab358){_0x37d0e7[_0x589f('0x32')]=_0x2ab358;if(_0x4590fa[_0x589f('0x47')]['includeAll']){_0xa81305[_0x589f('0x54')]=[{'all':!![]}];}return db[_0x589f('0x3f')][_0x589f('0x55')](_0xa81305);})['then'](function(_0x343f76){_0x37d0e7[_0x589f('0x56')]=_0x343f76;return _0x37d0e7;})['then'](respondWithFilteredResult(_0x13400e,_0xa81305))[_0x589f('0x2a')](handleError(_0x13400e,null));};exports['show']=function(_0x38b711,_0x3dc44f){var _0x18b52a={'raw':![],'where':{'id':_0x38b711[_0x589f('0x57')]['id']},'include':[{'model':db[_0x589f('0x58')],'as':_0x589f('0x59')}]},_0x42fa89={};_0x42fa89[_0x589f('0x43')]=_[_0x589f('0x45')](db[_0x589f('0x3f')][_0x589f('0x5a')]);_0x42fa89[_0x589f('0x47')]=_['keys'](_0x38b711[_0x589f('0x47')]);_0x42fa89['filters']=_[_0x589f('0x49')](_0x42fa89[_0x589f('0x43')],_0x42fa89[_0x589f('0x47')]);_0x18b52a['attributes']=_[_0x589f('0x49')](_0x42fa89['model'],qs[_0x589f('0x4a')](_0x38b711[_0x589f('0x47')][_0x589f('0x4a')]));_0x18b52a['attributes']=_0x18b52a[_0x589f('0x48')][_0x589f('0x4b')]?_0x18b52a['attributes']:_0x42fa89[_0x589f('0x43')];if(_0x38b711[_0x589f('0x47')][_0x589f('0x5b')]){_0x18b52a[_0x589f('0x54')]=[{'all':!![]}];}_0x18b52a=_[_0x589f('0x52')]({},_0x18b52a,_0x38b711[_0x589f('0x53')]);return db['WhatsappAccount']['find'](_0x18b52a)['then'](handleEntityNotFound(_0x3dc44f,null))['then'](respondWithResult(_0x3dc44f,null))['catch'](handleError(_0x3dc44f,null));};exports['create']=function(_0x1d44a5,_0x31b44f){return db['WhatsappAccount'][_0x589f('0x5c')](_0x1d44a5[_0x589f('0x5d')],{})[_0x589f('0x20')](function(_0x95356e){var _0x5b8da6=_0x1d44a5[_0x589f('0x5e')]['get']({'plain':!![]});if(!_0x5b8da6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b8da6['role']===_0x589f('0x5e')){var _0x21cf76=_0x95356e[_0x589f('0x39')]({'plain':!![]});var _0x3c614f=_0x589f('0x3a');return db[_0x589f('0x5f')][_0x589f('0x60')]({'where':{'name':_0x3c614f,'userProfileId':_0x5b8da6[_0x589f('0x61')]},'raw':!![]})[_0x589f('0x20')](function(_0x3fa938){if(_0x3fa938&&_0x3fa938[_0x589f('0x62')]===0x0){return db[_0x589f('0x63')]['create']({'name':_0x21cf76[_0x589f('0x3c')],'resourceId':_0x21cf76['id'],'type':_0x3fa938[_0x589f('0x3c')],'sectionId':_0x3fa938['id']},{})[_0x589f('0x20')](function(){return _0x95356e;});}else{return _0x95356e;}})['catch'](function(_0x117d27){logger[_0x589f('0x25')](_0x589f('0x64'),_0x117d27);throw _0x117d27;});}return _0x95356e;})[_0x589f('0x20')](respondWithResult(_0x31b44f,0xc9))[_0x589f('0x2a')](handleError(_0x31b44f,null));};exports[_0x589f('0x37')]=function(_0x43b5be,_0x4217c3){if(_0x43b5be[_0x589f('0x5d')]['id']){delete _0x43b5be[_0x589f('0x5d')]['id'];}return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x43b5be[_0x589f('0x57')]['id']},'include':[{'model':db[_0x589f('0x58')],'as':_0x589f('0x59')}]})[_0x589f('0x20')](handleEntityNotFound(_0x4217c3,null))[_0x589f('0x20')](saveUpdates(_0x43b5be[_0x589f('0x5d')],null))['then'](respondWithResult(_0x4217c3,null))['catch'](handleError(_0x4217c3,null));};exports[_0x589f('0x38')]=function(_0x2ab7d6,_0x51a0d6){return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x2ab7d6[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x51a0d6,null))[_0x589f('0x20')](removeEntity(_0x51a0d6,null))[_0x589f('0x2a')](handleError(_0x51a0d6,null));};exports[_0x589f('0x65')]=function(_0xd11d20,_0x2b3044){return db[_0x589f('0x3f')][_0x589f('0x65')]()[_0x589f('0x20')](respondWithResult(_0x2b3044,null))[_0x589f('0x2a')](handleError(_0x2b3044,null));};exports[_0x589f('0x66')]=function(_0x3a7b89,_0x336ed4,_0x4f7f65){if(_0x3a7b89[_0x589f('0x5d')]['id']){delete _0x3a7b89[_0x589f('0x5d')]['id'];}return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x3a7b89[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x336ed4,null))['then'](function(_0x5a3c98){if(_0x5a3c98){_0x3a7b89[_0x589f('0x5d')][_0x589f('0x67')]=_0x5a3c98['id'];return db['Disposition'][_0x589f('0x5c')](_0x3a7b89[_0x589f('0x5d')]);}})[_0x589f('0x20')](respondWithResult(_0x336ed4,null))[_0x589f('0x2a')](handleError(_0x336ed4,null));};exports[_0x589f('0x68')]=function(_0x1bc5b4,_0x2cc457,_0x1dd128){var _0x2c6013={'raw':![],'where':{}};var _0x2772f8={};var _0x37801b={'count':0x0,'rows':[]};return db[_0x589f('0x3f')][_0x589f('0x69')]({'where':{'id':_0x1bc5b4[_0x589f('0x57')]['id']}})['then'](handleEntityNotFound(_0x2cc457,null))[_0x589f('0x20')](function(_0x45da04){if(_0x45da04){_0x2772f8[_0x589f('0x43')]=_[_0x589f('0x45')](db['Disposition'][_0x589f('0x5a')]);_0x2772f8[_0x589f('0x47')]=_[_0x589f('0x45')](_0x1bc5b4[_0x589f('0x47')]);_0x2772f8[_0x589f('0x46')]=_[_0x589f('0x49')](_0x2772f8[_0x589f('0x43')],_0x2772f8[_0x589f('0x47')]);_0x2c6013[_0x589f('0x48')]=_[_0x589f('0x49')](_0x2772f8['model'],qs['fields'](_0x1bc5b4[_0x589f('0x47')][_0x589f('0x4a')]));_0x2c6013[_0x589f('0x48')]=_0x2c6013['attributes'][_0x589f('0x4b')]?_0x2c6013['attributes']:_0x2772f8['model'];if(!_0x1bc5b4[_0x589f('0x47')][_0x589f('0x4c')]('nolimit')){_0x2c6013[_0x589f('0x31')]=qs[_0x589f('0x31')](_0x1bc5b4[_0x589f('0x47')]['limit']);_0x2c6013[_0x589f('0x2f')]=qs['offset'](_0x1bc5b4['query']['offset']);}_0x2c6013[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x1bc5b4[_0x589f('0x47')][_0x589f('0x4e')]);_0x2c6013[_0x589f('0x4f')]=qs[_0x589f('0x46')](_[_0x589f('0x50')](_0x1bc5b4[_0x589f('0x47')],_0x2772f8[_0x589f('0x46')]));_0x2c6013[_0x589f('0x4f')]['WhatsappAccountId']=_0x45da04['id'];if(_0x1bc5b4[_0x589f('0x47')][_0x589f('0x51')]){_0x2c6013['where']=_['merge'](_0x2c6013['where'],{'$or':_['map'](_0x2c6013[_0x589f('0x48')],function(_0xc25d3e){var _0x24f7ce={};_0x24f7ce[_0xc25d3e]={'$like':'%'+_0x1bc5b4[_0x589f('0x47')][_0x589f('0x51')]+'%'};return _0x24f7ce;})});}_0x2c6013=_[_0x589f('0x52')]({},_0x2c6013,_0x1bc5b4[_0x589f('0x53')]);return db[_0x589f('0x6a')][_0x589f('0x32')]({'where':_0x2c6013[_0x589f('0x4f')]})[_0x589f('0x20')](function(_0x462e19){_0x37801b[_0x589f('0x32')]=_0x462e19;if(_0x1bc5b4[_0x589f('0x47')][_0x589f('0x5b')]){_0x2c6013[_0x589f('0x54')]=[{'all':!![]}];}return db[_0x589f('0x6a')][_0x589f('0x55')](_0x2c6013);})[_0x589f('0x20')](function(_0x51f68d){_0x37801b[_0x589f('0x56')]=_0x51f68d;return _0x37801b;});}})[_0x589f('0x20')](respondWithFilteredResult(_0x2cc457,_0x2c6013))[_0x589f('0x2a')](handleError(_0x2cc457,null));};exports[_0x589f('0x6b')]=function(_0x1bbae1,_0x38944e,_0x199448){return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x1bbae1[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x38944e,null))[_0x589f('0x20')](function(_0x4830e3){if(_0x4830e3){return _0x4830e3[_0x589f('0x6b')](_0x1bbae1[_0x589f('0x47')][_0x589f('0x6c')]);}})['then'](respondWithStatusCode(_0x38944e,null))[_0x589f('0x2a')](handleError(_0x38944e,null));};exports[_0x589f('0x6d')]=function(_0x3dd068,_0x287d65,_0x42ba04){if(_0x3dd068['body']['id']){delete _0x3dd068['body']['id'];}return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x3dd068[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x287d65,null))[_0x589f('0x20')](function(_0x3232ed){if(_0x3232ed){_0x3dd068['body']['WhatsappAccountId']=_0x3232ed['id'];return db[_0x589f('0x6e')][_0x589f('0x5c')](_0x3dd068[_0x589f('0x5d')]);}})[_0x589f('0x20')](respondWithResult(_0x287d65,null))['catch'](handleError(_0x287d65,null));};exports[_0x589f('0x6f')]=function(_0x4e4371,_0x383937,_0x192f21){var _0x468bf2={'raw':![],'where':{}};var _0x388f59={};var _0x54dc65={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x589f('0x69')]({'where':{'id':_0x4e4371[_0x589f('0x57')]['id']}})['then'](handleEntityNotFound(_0x383937,null))[_0x589f('0x20')](function(_0x4981b7){if(_0x4981b7){_0x388f59[_0x589f('0x43')]=_[_0x589f('0x45')](db[_0x589f('0x6e')][_0x589f('0x5a')]);_0x388f59['query']=_[_0x589f('0x45')](_0x4e4371[_0x589f('0x47')]);_0x388f59[_0x589f('0x46')]=_[_0x589f('0x49')](_0x388f59[_0x589f('0x43')],_0x388f59[_0x589f('0x47')]);_0x468bf2[_0x589f('0x48')]=_[_0x589f('0x49')](_0x388f59[_0x589f('0x43')],qs[_0x589f('0x4a')](_0x4e4371[_0x589f('0x47')]['fields']));_0x468bf2['attributes']=_0x468bf2[_0x589f('0x48')][_0x589f('0x4b')]?_0x468bf2[_0x589f('0x48')]:_0x388f59[_0x589f('0x43')];if(!_0x4e4371[_0x589f('0x47')][_0x589f('0x4c')](_0x589f('0x70'))){_0x468bf2[_0x589f('0x31')]=qs[_0x589f('0x31')](_0x4e4371['query'][_0x589f('0x31')]);_0x468bf2['offset']=qs['offset'](_0x4e4371[_0x589f('0x47')][_0x589f('0x2f')]);}_0x468bf2[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x4e4371[_0x589f('0x47')]['sort']);_0x468bf2['where']=qs[_0x589f('0x46')](_[_0x589f('0x50')](_0x4e4371[_0x589f('0x47')],_0x388f59[_0x589f('0x46')]));_0x468bf2[_0x589f('0x4f')][_0x589f('0x67')]=_0x4981b7['id'];if(_0x4e4371[_0x589f('0x47')][_0x589f('0x51')]){_0x468bf2['where']=_[_0x589f('0x52')](_0x468bf2[_0x589f('0x4f')],{'$or':_[_0x589f('0x44')](_0x468bf2[_0x589f('0x48')],function(_0x2ce375){var _0x28bc3d={};_0x28bc3d[_0x2ce375]={'$like':'%'+_0x4e4371[_0x589f('0x47')]['filter']+'%'};return _0x28bc3d;})});}_0x468bf2=_[_0x589f('0x52')]({},_0x468bf2,_0x4e4371[_0x589f('0x53')]);return db[_0x589f('0x6e')][_0x589f('0x32')]({'where':_0x468bf2[_0x589f('0x4f')]})[_0x589f('0x20')](function(_0x282ce4){_0x54dc65[_0x589f('0x32')]=_0x282ce4;if(_0x4e4371[_0x589f('0x47')]['includeAll']){_0x468bf2[_0x589f('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x589f('0x55')](_0x468bf2);})[_0x589f('0x20')](function(_0x1fa7be){_0x54dc65[_0x589f('0x56')]=_0x1fa7be;return _0x54dc65;});}})[_0x589f('0x20')](respondWithFilteredResult(_0x383937,_0x468bf2))[_0x589f('0x2a')](handleError(_0x383937,null));};exports['removeAnswers']=function(_0x5b99c3,_0xd17186,_0x50d6ec){return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x5b99c3[_0x589f('0x57')]['id']}})['then'](handleEntityNotFound(_0xd17186,null))[_0x589f('0x20')](function(_0x251e24){if(_0x251e24){return _0x251e24[_0x589f('0x71')](_0x5b99c3['query']['ids']);}})[_0x589f('0x20')](respondWithStatusCode(_0xd17186,null))[_0x589f('0x2a')](handleError(_0xd17186,null));};exports['addAgents']=function(_0x4d335c,_0x2ee51d,_0x52a7d8){return db['WhatsappAccount'][_0x589f('0x60')]({'where':{'id':_0x4d335c[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x2ee51d,null))[_0x589f('0x20')](function(_0x344171){if(_0x344171){return _0x344171['addAgents'](_0x4d335c[_0x589f('0x5d')][_0x589f('0x6c')],_[_0x589f('0x72')](_0x4d335c[_0x589f('0x5d')],[_0x589f('0x6c'),'id'])||{})['spread'](function(_0x3b1054){for(var _0x4a4847=0x0;_0x4a4847<_0x4d335c[_0x589f('0x5d')]['ids']['length'];_0x4a4847+=0x1){socket[_0x589f('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x4d335c[_0x589f('0x5d')]['ids'][_0x4a4847]),'WhatsappAccountId':Number(_0x4d335c[_0x589f('0x57')]['id'])});}return _0x3b1054;});}})[_0x589f('0x20')](respondWithResult(_0x2ee51d,null))[_0x589f('0x2a')](handleError(_0x2ee51d,null));};exports[_0x589f('0x74')]=function(_0x4b1864,_0xf085ec,_0xabf27a){return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x4b1864['params']['id']}})[_0x589f('0x20')](handleEntityNotFound(_0xf085ec,null))[_0x589f('0x20')](function(_0x5197de){if(_0x5197de){return _0x5197de[_0x589f('0x74')](_0x4b1864['query'][_0x589f('0x6c')])[_0x589f('0x20')](function(){if(_['isArray'](_0x4b1864[_0x589f('0x47')][_0x589f('0x6c')])){for(var _0x57e173=0x0;_0x57e173<_0x4b1864[_0x589f('0x47')][_0x589f('0x6c')][_0x589f('0x4b')];_0x57e173+=0x1){socket['emit'](_0x589f('0x75'),{'UserId':Number(_0x4b1864[_0x589f('0x47')]['ids'][_0x57e173]),'WhatsappAccountId':Number(_0x4b1864[_0x589f('0x57')]['id'])});}}else{socket[_0x589f('0x73')](_0x589f('0x75'),{'UserId':Number(_0x4b1864[_0x589f('0x47')][_0x589f('0x6c')]),'WhatsappAccountId':Number(_0x4b1864[_0x589f('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0xf085ec,null))[_0x589f('0x2a')](handleError(_0xf085ec,null));};exports[_0x589f('0x76')]=function(_0x10f03a,_0x2a23ec,_0x16335e){var _0x129e9d={};var _0x4e7e38={};var _0x1db3d3;var _0x530f71;return db[_0x589f('0x3f')][_0x589f('0x69')]({'where':{'id':_0x10f03a[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x2a23ec,null))['then'](function(_0x24415f){if(_0x24415f){_0x1db3d3=_0x24415f;_0x4e7e38[_0x589f('0x43')]=_['keys'](db[_0x589f('0x77')]['rawAttributes']);_0x4e7e38[_0x589f('0x47')]=_[_0x589f('0x45')](_0x10f03a[_0x589f('0x47')]);_0x4e7e38[_0x589f('0x46')]=_['intersection'](_0x4e7e38[_0x589f('0x43')],_0x4e7e38[_0x589f('0x47')]);_0x129e9d[_0x589f('0x48')]=_['intersection'](_0x4e7e38[_0x589f('0x43')],qs[_0x589f('0x4a')](_0x10f03a[_0x589f('0x47')][_0x589f('0x4a')]));_0x129e9d['attributes']=_0x129e9d[_0x589f('0x48')]['length']?_0x129e9d[_0x589f('0x48')]:_0x4e7e38[_0x589f('0x43')];_0x129e9d[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x10f03a['query'][_0x589f('0x4e')]);_0x129e9d[_0x589f('0x4f')]=qs['filters'](_[_0x589f('0x50')](_0x10f03a[_0x589f('0x47')],_0x4e7e38[_0x589f('0x46')]));if(_0x10f03a[_0x589f('0x47')][_0x589f('0x51')]){_0x129e9d['where']=_[_0x589f('0x52')](_0x129e9d['where'],{'$or':_[_0x589f('0x44')](_0x129e9d['attributes'],function(_0x3f79c6){var _0x120c1e={};_0x120c1e[_0x3f79c6]={'$like':'%'+_0x10f03a[_0x589f('0x47')]['filter']+'%'};return _0x120c1e;})});}_0x129e9d=_['merge']({},_0x129e9d,_0x10f03a[_0x589f('0x53')]);return _0x1db3d3['getAgents'](_0x129e9d);}})[_0x589f('0x20')](function(_0x135bba){if(_0x135bba){_0x530f71=_0x135bba[_0x589f('0x4b')];if(!_0x10f03a[_0x589f('0x47')][_0x589f('0x4c')](_0x589f('0x70'))){_0x129e9d[_0x589f('0x31')]=qs['limit'](_0x10f03a[_0x589f('0x47')][_0x589f('0x31')]);_0x129e9d[_0x589f('0x2f')]=qs[_0x589f('0x2f')](_0x10f03a[_0x589f('0x47')][_0x589f('0x2f')]);}return _0x1db3d3[_0x589f('0x76')](_0x129e9d);}})[_0x589f('0x20')](function(_0x24ffb2){if(_0x24ffb2){return _0x24ffb2?{'count':_0x530f71,'rows':_0x24ffb2}:null;}})[_0x589f('0x20')](respondWithResult(_0x2a23ec,null))[_0x589f('0x2a')](handleError(_0x2a23ec,null));};exports[_0x589f('0x78')]=function(_0x29a935,_0x56d1dd){var _0xa249cf=_0x29a935['params']['id'];var _0x2e08f8=_0x29a935[_0x589f('0x5d')];var _0x730c85=0xc8;var _0x2dd339=null;return db[_0x589f('0x79')][_0x589f('0x7a')]({'isolationLevel':db[_0x589f('0x79')]['Transaction'][_0x589f('0x7b')][_0x589f('0x7c')]},function(_0x1d2bbb){return db[_0x589f('0x3f')][_0x589f('0x69')]({'where':{'id':_0xa249cf},'transaction':_0x1d2bbb})['then'](function(_0xde659){if(_0xde659){return db[_0x589f('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0xa249cf},'transaction':_0x1d2bbb})[_0x589f('0x20')](function(){var _0x8a3ae7=_['map'](_0x2e08f8,function(_0x3aef6f){_0x3aef6f[_0x589f('0x67')]=_0xa249cf;return _0x3aef6f;});return db[_0x589f('0x7d')][_0x589f('0x7e')](_0x8a3ae7,{'transaction':_0x1d2bbb});});}else{_0x730c85=0x194;_0x2dd339=[];}});})['then'](function(){if(_0x730c85!==0x194){return db[_0x589f('0x7d')][_0x589f('0x7f')]({'where':{'WhatsappAccountId':_0xa249cf},'order':_0x589f('0x80')})[_0x589f('0x20')](function(_0x3a45df){_0x2dd339=_0x3a45df;});}})['catch'](function(_0x5846ae){_0x730c85=0x1f4;logger[_0x589f('0x25')](_0x5846ae[_0x589f('0x3b')]);if(_0x5846ae['name']){delete _0x5846ae[_0x589f('0x3c')];}_0x2dd339=_0x5846ae;})[_0x589f('0x81')](function(){if(_0x2dd339===null){_0x56d1dd[_0x589f('0x2b')](_0x730c85);}else{if(_0x730c85===0x1f4){_0x56d1dd[_0x589f('0x2c')](_0x730c85)['send'](_0x2dd339);}else{_0x56d1dd[_0x589f('0x2c')](_0x730c85)[_0x589f('0x2e')](_0x2dd339);}}});};exports['getApplications']=function(_0x10c2dd,_0x5c47a7,_0x4b49da){var _0x387bf0={};var _0x74b195={};var _0x4a0e7f;var _0x55f198;return db[_0x589f('0x3f')]['findOne']({'where':{'id':_0x10c2dd[_0x589f('0x57')]['id']}})[_0x589f('0x20')](handleEntityNotFound(_0x5c47a7,null))[_0x589f('0x20')](function(_0x2ec975){if(_0x2ec975){_0x4a0e7f=_0x2ec975;_0x74b195['model']=_[_0x589f('0x45')](db[_0x589f('0x7d')][_0x589f('0x5a')]);_0x74b195[_0x589f('0x47')]=_[_0x589f('0x45')](_0x10c2dd[_0x589f('0x47')]);_0x74b195[_0x589f('0x46')]=_[_0x589f('0x49')](_0x74b195[_0x589f('0x43')],_0x74b195[_0x589f('0x47')]);_0x387bf0[_0x589f('0x48')]=_[_0x589f('0x49')](_0x74b195['model'],qs[_0x589f('0x4a')](_0x10c2dd[_0x589f('0x47')]['fields']));_0x387bf0[_0x589f('0x48')]=_0x387bf0[_0x589f('0x48')][_0x589f('0x4b')]?_0x387bf0['attributes']:_0x74b195[_0x589f('0x43')];_0x387bf0[_0x589f('0x4d')]=qs[_0x589f('0x4e')](_0x10c2dd['query'][_0x589f('0x4e')]);_0x387bf0['where']=qs[_0x589f('0x46')](_['pick'](_0x10c2dd[_0x589f('0x47')],_0x74b195['filters']));if(_0x10c2dd[_0x589f('0x47')]['filter']){_0x387bf0[_0x589f('0x4f')]=_['merge'](_0x387bf0[_0x589f('0x4f')],{'$or':_[_0x589f('0x44')](_0x387bf0[_0x589f('0x48')],function(_0x480051){var _0x2168fc={};_0x2168fc[_0x480051]={'$like':'%'+_0x10c2dd[_0x589f('0x47')][_0x589f('0x51')]+'%'};return _0x2168fc;})});}_0x387bf0=_[_0x589f('0x52')]({},_0x387bf0,_0x10c2dd[_0x589f('0x53')]);return _0x4a0e7f['getApplications'](_0x387bf0);}})[_0x589f('0x20')](function(_0x30847b){if(_0x30847b){_0x55f198=_0x30847b[_0x589f('0x4b')];if(!_0x10c2dd[_0x589f('0x47')]['hasOwnProperty'](_0x589f('0x70'))){_0x387bf0[_0x589f('0x31')]=qs['limit'](_0x10c2dd[_0x589f('0x47')][_0x589f('0x31')]);_0x387bf0[_0x589f('0x2f')]=qs[_0x589f('0x2f')](_0x10c2dd[_0x589f('0x47')][_0x589f('0x2f')]);}return _0x4a0e7f[_0x589f('0x82')](_0x387bf0);}})['then'](function(_0x2bdce7){if(_0x2bdce7){return _0x2bdce7?{'count':_0x55f198,'rows':_0x2bdce7}:null;}})['then'](respondWithResult(_0x5c47a7,null))[_0x589f('0x2a')](handleError(_0x5c47a7,null));};exports[_0x589f('0x83')]=function(_0x451ade,_0x21ef19,_0x357cf9){var _0x55b086={'channel':_0x589f('0x84')};var _0x28f99=[];var _0x1d0b55=[];var _0xf9a37d={};return db[_0x589f('0x3f')][_0x589f('0x60')]({'where':{'id':_0x451ade['params']['id']},'include':[{'model':db[_0x589f('0x7d')],'as':_0x589f('0x85')}]})['then'](handleEntityNotFound(_0x21ef19,null))[_0x589f('0x20')](function(_0x243f16){_0x55b086[_0x589f('0x86')]=_0x243f16;if(_0x55b086[_0x589f('0x86')]&&_0x55b086['account']['type']==='sinch'&&_0x451ade[_0x589f('0x5d')][_0x589f('0x87')]){if(_0x451ade['body'][_0x589f('0x87')][_0x589f('0x4b')]===0x0)return;if(_0x451ade[_0x589f('0x5d')][_0x589f('0x87')][0x0][_0x589f('0x88')]!==_0x589f('0x89'))return;return db[_0x589f('0x8a')][_0x589f('0x37')]({'read':!![],'readAt':_0x451ade[_0x589f('0x5d')][_0x589f('0x87')][0x0][_0x589f('0x8b')]},{'where':{'messageId':_0x451ade['body'][_0x589f('0x87')][0x0][_0x589f('0x8c')]},'individualHooks':!![]})[_0x589f('0x20')](function(_0x43fb69){return _0x21ef19[_0x589f('0x2c')](0xc8)['json'](_0x43fb69);});}_0x55b086[_0x589f('0x8d')]=_[_0x589f('0x8e')](_0x243f16[_0x589f('0x85')],[_0x589f('0x80')],[_0x589f('0x8f')]);if(_0x55b086[_0x589f('0x86')]['Applications']){delete _0x55b086[_0x589f('0x86')][_0x589f('0x85')];}return db[_0x589f('0x90')][_0x589f('0x65')]()[_0x589f('0x20')](function(_0x11bcda){if(!_0x11bcda){throw new db[(_0x589f('0x91'))][(_0x589f('0x92'))](_0x589f('0x93'));}_0x28f99=_[_0x589f('0x94')](_[_0x589f('0x45')](_0x11bcda),[_0x589f('0x95'),_0x589f('0x96')]);_0x1d0b55=_[_0x589f('0x94')](_[_0x589f('0x45')](_0x11bcda),[_0x589f('0x95'),_0x589f('0x96'),_0x589f('0x97'),_0x589f('0x98')]);_0x55b086[_0x589f('0x5d')]={'mapKey':'mobile'};if(_0x55b086[_0x589f('0x86')]&&_0x55b086[_0x589f('0x86')][_0x589f('0x41')]===_0x589f('0x99')){_0x55b086[_0x589f('0x5d')][_0x589f('0x9a')]=_0x451ade[_0x589f('0x5d')]['From']['replace'](_0x589f('0x9b'),'');_0x55b086[_0x589f('0x5d')][_0x589f('0x5d')]=_0x451ade[_0x589f('0x5d')][_0x589f('0x9c')];_0x55b086[_0x589f('0x5d')][_0x589f('0x9d')]=_0x451ade[_0x589f('0x5d')][_0x589f('0x9e')];}if(_0x55b086[_0x589f('0x86')]&&_0x55b086[_0x589f('0x86')][_0x589f('0x41')]==='sinch'){_0x55b086[_0x589f('0x5d')]['from']=_0x451ade[_0x589f('0x5d')][_0x589f('0x9f')][0x0][_0x589f('0x9a')];_0x55b086[_0x589f('0x5d')][_0x589f('0x5d')]=_0x451ade[_0x589f('0x5d')][_0x589f('0x9f')][0x0][_0x589f('0x28')][_0x589f('0x5d')];_0x55b086[_0x589f('0x5d')][_0x589f('0x9d')]=_0x451ade[_0x589f('0x5d')][_0x589f('0x9f')][0x0][_0x589f('0x8c')];}if(_0x55b086[_0x589f('0x5d')]['id']){delete _0x55b086[_0x589f('0x5d')]['id'];}if(_[_0x589f('0xa0')](_0x55b086[_0x589f('0x5d')][_0x589f('0x9a')])){throw new db[(_0x589f('0x91'))][(_0x589f('0x92'))](_0x589f('0xa1'));}if(_[_0x589f('0xa0')](_0x55b086[_0x589f('0x5d')][_0x589f('0x5d')])||_0x55b086['body'][_0x589f('0x5d')]===''){throw new db['Sequelize'][(_0x589f('0x92'))](_0x589f('0xa2'));}if(_[_0x589f('0xa0')](_0x55b086[_0x589f('0x5d')][_0x589f('0xa3')])){throw new db[(_0x589f('0x91'))][(_0x589f('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1d0b55);}if(!_[_0x589f('0xa4')](_0x1d0b55,_0x55b086[_0x589f('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x589f('0x92'))](_0x589f('0xa5')+_0x1d0b55);}_0xf9a37d[_0x55b086[_0x589f('0x5d')][_0x589f('0xa3')]]=_0x55b086['body'][_0x589f('0x9a')];return db[_0x589f('0xa6')][_0x589f('0x60')]({'where':{'id':_0x55b086[_0x589f('0x86')][_0x589f('0x98')]},'include':[{'model':db[_0x589f('0x90')],'as':_0x589f('0xa7'),'where':_0xf9a37d,'limit':0x1,'order':[[_0x589f('0x96'),_0x589f('0xa8')]]}]});})[_0x589f('0x20')](handleEntityNotFound(_0x21ef19,null))[_0x589f('0x20')](function(_0x2e630f){if(_0x2e630f){_0x55b086[_0x589f('0xa9')]=_[_0x589f('0x72')](_0x2e630f,[_0x589f('0xa7')]);if(_0x2e630f[_0x589f('0xa7')]['length']){return _0x2e630f[_0x589f('0xa7')][0x0];}var _0x1c82bf=_[_0x589f('0x1a')](_0x55b086[_0x589f('0x5d')],{'firstName':_0x55b086[_0x589f('0x5d')][_0x589f('0x9a')],'ListId':_0x2e630f['id']});_0x1c82bf[_0x55b086[_0x589f('0x5d')][_0x589f('0xa3')]]=_0x55b086[_0x589f('0x5d')]['from'];return db[_0x589f('0x90')]['create'](_0x1c82bf,{'fields':_0x28f99,'raw':!![]});}})[_0x589f('0x20')](handleEntityNotFound(_0x21ef19,null))['then'](function(_0x433076){if(_0x433076){_0x55b086['contact']=_0x433076;var _0x370718={'ContactId':_0x433076['id'],'phone':_0x55b086['body'][_0x589f('0x9a')],'WhatsappAccountId':_0x451ade['params']['id']};var _0xe410f8={'ContactId':_0x433076['id'],'WhatsappAccountId':_0x451ade[_0x589f('0x57')]['id'],'closed':![]};return db[_0x589f('0xaa')][_0x589f('0x60')]({'where':_0xe410f8})[_0x589f('0x20')](function(_0x5c3167){if(_0x5c3167){return[_0x5c3167,![]];}return db['WhatsappInteraction'][_0x589f('0x5c')](_0x370718)[_0x589f('0x20')](function(_0x73169e){return[_0x73169e,!![]];});});}})[_0x589f('0xab')](function(_0x652c57,_0x4c8f82){_0x55b086[_0x589f('0xac')]=_0x652c57[_0x589f('0x39')]({'plain':!![]});_0x55b086[_0x589f('0xac')][_0x589f('0xad')]=![];if(_0x4c8f82){if(_0x55b086[_0x589f('0x86')]['autoclose']){_0x55b086['applications']['push']({'id':0x0,'priority':_0x55b086[_0x589f('0x8d')][_0x589f('0x4b')]+0x1,'app':_0x589f('0xae'),'appdata':_0x589f('0xaf'),'interval':_0x589f('0xb0')});}_0x55b086[_0x589f('0xac')][_0x589f('0xad')]=!![];}return db['WhatsappMessage'][_0x589f('0x5c')]({'phone':_0x55b086[_0x589f('0x5d')]['from'],'messageId':_0x55b086[_0x589f('0x5d')]['messageId'],'body':_0x55b086[_0x589f('0x5d')][_0x589f('0x5d')],'WhatsappAccountId':_0x451ade[_0x589f('0x57')]['id'],'WhatsappInteractionId':_0x652c57['id'],'direction':'in','ContactId':_0x652c57[_0x589f('0xb1')],'AttachmentId':_0x55b086[_0x589f('0x5d')][_0x589f('0xb2')]});})['then'](function(_0x1bf8f4){_0x55b086[_0x589f('0x28')]=_0x1bf8f4;if(!_0x55b086['interaction'][_0x589f('0xb3')])return;return db[_0x589f('0x77')][_0x589f('0x60')]({'attributes':['id','name'],'where':{'id':_0x55b086['interaction'][_0x589f('0xb3')]}});})[_0x589f('0x20')](function(_0x51cf1f){if(_0x51cf1f){_0x55b086['applications'][_0x589f('0xb4')]({'id':0x0,'priority':0x0,'app':_0x589f('0xb5'),'appdata':_0x51cf1f[_0x589f('0x3c')]+','+(_0x55b086[_0x589f('0x86')][_0x589f('0xb6')]||0xa),'interval':_0x589f('0xb0')});}if(!_0x55b086[_0x589f('0xac')][_0x589f('0xb7')])return;return db[_0x589f('0xb8')][_0x589f('0x60')]({'attributes':['id',_0x589f('0x3c')],'where':{'id':_0x55b086[_0x589f('0xac')][_0x589f('0xb7')]}});})[_0x589f('0x20')](function(_0x1570b3){if(_0x1570b3){_0x55b086[_0x589f('0x8d')][_0x589f('0xb4')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1570b3['name']+','+(_0x55b086['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x589f('0xb0')});}return respondWithRpcPromise('Start','startRouting',_0x55b086);})['then'](function(_0x51e2ca){if(_0x51e2ca){var _0x1ab0da=0xc8;var _0x575722=_0x589f('0xb9');logger[_0x589f('0x21')](_0x589f('0x22'),_0x575722,_0x1ab0da,_0x589f('0xba'));logger[_0x589f('0xbb')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x575722,_0x1ab0da,_0x589f('0xba'),JSON[_0x589f('0x24')](_0x51e2ca));if(_0x55b086['account'][_0x589f('0x41')]==='twilio'){return _0x21ef19['status'](_0x1ab0da)['set']('Content-Type',_0x589f('0xbc'))[_0x589f('0x3d')](_0x589f('0xbd'));}else{return _0x21ef19[_0x589f('0x2c')](_0x1ab0da)[_0x589f('0x2e')](_0x51e2ca);}}});})[_0x589f('0x2a')](handleError(_0x21ef19,null));};exports[_0x589f('0x3d')]=function(_0x5657ed,_0x487c30,_0x5b0fa8){var _0x42d38f,_0x1651b7,_0x43159e;if(_[_0x589f('0xa0')](_0x5657ed['body'][_0x589f('0x5d')])||_0x5657ed[_0x589f('0x5d')]['body']===''){throw new db[(_0x589f('0x91'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x589f('0xa0')](_0x5657ed['body']['to'])){throw new db[(_0x589f('0x91'))][(_0x589f('0x92'))](_0x589f('0xbe'));}_0x42d38f=_0x5657ed[_0x589f('0x5d')]['to'];return db[_0x589f('0x3f')]['find']({'where':{'id':_0x5657ed[_0x589f('0x57')]['id']},'include':[{'model':db[_0x589f('0xa6')],'as':'List','include':[{'model':db[_0x589f('0x90')],'as':_0x589f('0xa7'),'where':{'mobile':_0x42d38f},'limit':0x1,'order':[['updatedAt',_0x589f('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x487c30,null))[_0x589f('0x20')](function(_0x45e3fd){if(_0x45e3fd&&_0x45e3fd[_0x589f('0xbf')]){_0x1651b7=_0x45e3fd[_0x589f('0x39')]({'plain':!![]});if(_0x1651b7[_0x589f('0xbf')]&&_0x1651b7[_0x589f('0xbf')][_0x589f('0xa7')]['length']){return _0x1651b7[_0x589f('0xbf')][_0x589f('0xa7')][0x0];}return db['CmContact']['create'](_['defaults'](_0x5657ed[_0x589f('0x5d')],{'firstName':_0x42d38f,'mobile':_0x42d38f,'phone':_0x42d38f,'ListId':_0x1651b7[_0x589f('0x98')]}));}})[_0x589f('0x20')](handleEntityNotFound(_0x487c30,null))['then'](function(_0x3e9aa2){if(_0x3e9aa2){_0x43159e=_0x3e9aa2;return db['WhatsappInteraction'][_0x589f('0x60')]({'where':{'ContactId':_0x43159e['id'],'closed':![],'WhatsappAccountId':_0x1651b7['id']}})[_0x589f('0x20')](function(_0x53a848){if(_0x53a848){return[_0x53a848,![]];}return db['WhatsappInteraction'][_0x589f('0x5c')]({'UserId':_0x5657ed[_0x589f('0x5e')]['id'],'ContactId':_0x43159e['id'],'WhatsappAccountId':_0x1651b7['id'],'phone':_0x42d38f,'firstMsgDirection':_0x589f('0xc0'),'Messages':[_['merge'](_0x5657ed[_0x589f('0x5d')],{'read':![],'body':_0x5657ed[_0x589f('0x5d')]['body'],'phone':_0x42d38f,'WhatsappAccountId':_0x1651b7['id'],'UserId':_0x5657ed[_0x589f('0x5e')]['id'],'ContactId':_0x43159e['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x589f('0xc1')}]})[_0x589f('0x20')](function(_0x529627){return[_0x529627,!![]];});});}})[_0x589f('0xab')](function(_0x52794e,_0x3bd0c0){if(_0x3bd0c0){return _0x52794e;}return db[_0x589f('0x8a')]['create'](_[_0x589f('0x52')](_0x5657ed[_0x589f('0x5d')],{'read':![],'body':_0x5657ed[_0x589f('0x5d')][_0x589f('0x5d')],'phone':_0x42d38f,'WhatsappAccountId':_0x1651b7['id'],'WhatsappInteractionId':_0x52794e['id'],'UserId':_0x5657ed[_0x589f('0x5e')]['id'],'ContactId':_0x43159e['id']}))[_0x589f('0x20')](function(_0x4baa73){_0x52794e[_0x589f('0xc2')][_0x589f('0xc1')]=[];_0x52794e[_0x589f('0xc2')][_0x589f('0xc1')][_0x589f('0xc3')](_0x4baa73[_0x589f('0xc2')]);return _0x52794e;});})[_0x589f('0x20')](respondWithResult(_0x487c30,null))[_0x589f('0x2a')](handleError(_0x487c30,null));}; \ No newline at end of file +var _0x5201=['isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','list','Contacts','contact','WhatsappInteraction','created','push','close','unmanaged','*,*,*,*','interaction','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','stack','name','send','index','Pause','WhatsappAccount','type','key','map','query','keys','model','attributes','fields','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','mandatoryDispositionPause','rawAttributes','intersection','include','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','describe','addDisposition','WhatsappAccountId','Disposition','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','isArray','getAgents','User','hasOwnProperty','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','statuses','state','timestamp','message_id','applications','orderBy','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','MessageSid','sinch','from','notifications','messageId'];(function(_0xba1445,_0x2eb4dc){var _0x2dde87=function(_0x157147){while(--_0x157147){_0xba1445['push'](_0xba1445['shift']());}};_0x2dde87(++_0x2eb4dc);}(_0x5201,0xf5));var _0x1520=function(_0x3ee242,_0x2aa354){_0x3ee242=_0x3ee242-0x0;var _0x57aba3=_0x5201[_0x3ee242];return _0x57aba3;};'use strict';var emlformat=require(_0x1520('0x0'));var rimraf=require(_0x1520('0x1'));var zipdir=require(_0x1520('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1520('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1520('0x4'));var util=require(_0x1520('0x5'));var path=require(_0x1520('0x6'));var sox=require(_0x1520('0x7'));var csv=require(_0x1520('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1520('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1520('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1520('0xb'));var Papa=require(_0x1520('0xc'));var Redis=require('ioredis');var authService=require(_0x1520('0xd'));var qs=require(_0x1520('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1520('0xf'));var logger=require(_0x1520('0x10'))('api');var utils=require(_0x1520('0x11'));var config=require(_0x1520('0x12'));var licenseUtil=require(_0x1520('0x13'));var db=require(_0x1520('0x14'))['db'];config[_0x1520('0x15')]=_[_0x1520('0x16')](config[_0x1520('0x15')],{'host':_0x1520('0x17'),'port':0x18eb});var socket=require(_0x1520('0x18'))(new Redis(config[_0x1520('0x15')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x1520('0x19'));var client=jayson['client'][_0x1520('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x5257a8,_0x248819,_0x5b59e7,_0x4d304c){return new BPromise(function(_0x17f208,_0x1d0d9b){var _0x4691ed=_0x4d304c||client;return _0x4691ed[_0x1520('0x1b')](_0x5257a8,_0x5b59e7)[_0x1520('0x1c')](function(_0x15a2a8){logger[_0x1520('0x1d')](_0x1520('0x1e'),_0x248819,'request\x20sent');logger['debug'](_0x1520('0x1f'),_0x248819,_0x1520('0x20'),JSON[_0x1520('0x21')](_0x15a2a8));if(_0x15a2a8[_0x1520('0x22')]){if(_0x15a2a8[_0x1520('0x22')]['code']===0x1f4){logger[_0x1520('0x22')](_0x1520('0x1e'),_0x248819,_0x15a2a8[_0x1520('0x22')][_0x1520('0x23')]);return _0x1d0d9b(_0x15a2a8[_0x1520('0x22')][_0x1520('0x23')]);}logger[_0x1520('0x22')](_0x1520('0x1e'),_0x248819,_0x15a2a8[_0x1520('0x22')][_0x1520('0x23')]);return _0x17f208(_0x15a2a8[_0x1520('0x22')][_0x1520('0x23')]);}else{logger[_0x1520('0x1d')](_0x1520('0x1e'),_0x248819,_0x1520('0x20'));_0x17f208(_0x15a2a8[_0x1520('0x24')][_0x1520('0x23')]);}})[_0x1520('0x25')](function(_0x44aabb){logger[_0x1520('0x22')](_0x1520('0x1e'),_0x248819,_0x44aabb);_0x1d0d9b(_0x44aabb);});});}function respondWithStatusCode(_0x3965e0,_0x2a8648){_0x2a8648=_0x2a8648||0xcc;return function(_0x14df29){if(_0x14df29){return _0x3965e0[_0x1520('0x26')](_0x2a8648);}return _0x3965e0[_0x1520('0x27')](_0x2a8648)[_0x1520('0x28')]();};}function respondWithResult(_0x3a22f7,_0x16f4b1){_0x16f4b1=_0x16f4b1||0xc8;return function(_0x135b52){if(_0x135b52){return _0x3a22f7[_0x1520('0x27')](_0x16f4b1)[_0x1520('0x29')](_0x135b52);}};}function respondWithFilteredResult(_0x45d6bd,_0x26f74c){return function(_0x47d45c){if(_0x47d45c){var _0x32ba7e=typeof _0x26f74c['offset']==='undefined'&&typeof _0x26f74c['limit']===_0x1520('0x2a');var _0x7bedb9=_0x47d45c[_0x1520('0x2b')];var _0x38cae8=_0x32ba7e?0x0:_0x26f74c[_0x1520('0x2c')];var _0xdfa189=_0x32ba7e?_0x47d45c['count']:_0x26f74c[_0x1520('0x2c')]+_0x26f74c['limit'];var _0x35c669;if(_0xdfa189>=_0x7bedb9){_0xdfa189=_0x7bedb9;_0x35c669=0xc8;}else{_0x35c669=0xce;}_0x45d6bd['status'](_0x35c669);return _0x45d6bd[_0x1520('0x2d')](_0x1520('0x2e'),_0x38cae8+'-'+_0xdfa189+'/'+_0x7bedb9)[_0x1520('0x29')](_0x47d45c);}return null;};}function patchUpdates(_0x290b0e){return function(_0x5afe87){try{jsonpatch[_0x1520('0x2f')](_0x5afe87,_0x290b0e,!![]);}catch(_0x18be5c){return BPromise[_0x1520('0x30')](_0x18be5c);}return _0x5afe87[_0x1520('0x31')]();};}function saveUpdates(_0x38a2a1,_0x164f7d){return function(_0x148eee){if(_0x148eee){return _0x148eee[_0x1520('0x32')](_0x38a2a1)[_0x1520('0x1c')](function(_0x370e3c){return _0x370e3c;});}return null;};}function removeEntity(_0x34c6ba,_0x5965fb){return function(_0x1a407a){if(_0x1a407a){return _0x1a407a[_0x1520('0x33')]()[_0x1520('0x1c')](function(){var _0xed7b3c=_0x1a407a[_0x1520('0x34')]({'plain':!![]});var _0x19ebc4='WhatsappAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x19ebc4,'resourceId':_0xed7b3c['id']}})[_0x1520('0x1c')](function(){return _0x1a407a;});})[_0x1520('0x1c')](function(){_0x34c6ba[_0x1520('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x809b1,_0xd0854f){return function(_0x40ddd6){if(!_0x40ddd6){_0x809b1[_0x1520('0x26')](0x194);}return _0x40ddd6;};}function handleError(_0x2dab53,_0x2ab53f){_0x2ab53f=_0x2ab53f||0x1f4;return function(_0x29c850){logger[_0x1520('0x22')](_0x29c850[_0x1520('0x35')]);if(_0x29c850[_0x1520('0x36')]){delete _0x29c850[_0x1520('0x36')];}_0x2dab53['status'](_0x2ab53f)[_0x1520('0x37')](_0x29c850);};}exports[_0x1520('0x38')]=function(_0x1b1e22,_0x1e91ba){var _0x21d9f3={'include':[{'model':db[_0x1520('0x39')],'as':'mandatoryDispositionPause'}]},_0x438702={},_0x4b3a2a={'count':0x0,'rows':[]};var _0x15a242=_['map'](db[_0x1520('0x3a')]['rawAttributes'],function(_0x342ed0){return{'name':_0x342ed0['fieldName'],'type':_0x342ed0[_0x1520('0x3b')][_0x1520('0x3c')]};});_0x438702['model']=_[_0x1520('0x3d')](_0x15a242,_0x1520('0x36'));_0x438702[_0x1520('0x3e')]=_[_0x1520('0x3f')](_0x1b1e22[_0x1520('0x3e')]);_0x438702['filters']=_['intersection'](_0x438702[_0x1520('0x40')],_0x438702['query']);_0x21d9f3[_0x1520('0x41')]=_['intersection'](_0x438702[_0x1520('0x40')],qs[_0x1520('0x42')](_0x1b1e22[_0x1520('0x3e')]['fields']));_0x21d9f3[_0x1520('0x41')]=_0x21d9f3[_0x1520('0x41')]['length']?_0x21d9f3[_0x1520('0x41')]:_0x438702[_0x1520('0x40')];if(!_0x1b1e22[_0x1520('0x3e')]['hasOwnProperty'](_0x1520('0x43'))){_0x21d9f3[_0x1520('0x44')]=qs[_0x1520('0x44')](_0x1b1e22['query'][_0x1520('0x44')]);_0x21d9f3['offset']=qs['offset'](_0x1b1e22[_0x1520('0x3e')][_0x1520('0x2c')]);}_0x21d9f3[_0x1520('0x45')]=qs[_0x1520('0x46')](_0x1b1e22['query'][_0x1520('0x46')]);_0x21d9f3[_0x1520('0x47')]=qs[_0x1520('0x48')](_[_0x1520('0x49')](_0x1b1e22[_0x1520('0x3e')],_0x438702[_0x1520('0x48')]),_0x15a242);if(_0x1b1e22[_0x1520('0x3e')]['filter']){_0x21d9f3[_0x1520('0x47')]=_['merge'](_0x21d9f3[_0x1520('0x47')],{'$or':_['map'](_0x15a242,function(_0x1c2db6){if(_0x1c2db6[_0x1520('0x3b')]!==_0x1520('0x4a')){var _0x52b07e={};_0x52b07e[_0x1c2db6[_0x1520('0x36')]]={'$like':'%'+_0x1b1e22[_0x1520('0x3e')][_0x1520('0x4b')]+'%'};return _0x52b07e;}})});}_0x21d9f3=_[_0x1520('0x4c')]({},_0x21d9f3,_0x1b1e22[_0x1520('0x4d')]);var _0x31c079={'where':_0x21d9f3[_0x1520('0x47')]};return db[_0x1520('0x3a')][_0x1520('0x2b')](_0x31c079)['then'](function(_0x528d03){_0x4b3a2a['count']=_0x528d03;if(_0x1b1e22['query'][_0x1520('0x4e')]){_0x21d9f3['include']=[{'all':!![]}];}return db[_0x1520('0x3a')][_0x1520('0x4f')](_0x21d9f3);})[_0x1520('0x1c')](function(_0x460394){_0x4b3a2a[_0x1520('0x50')]=_0x460394;return _0x4b3a2a;})[_0x1520('0x1c')](respondWithFilteredResult(_0x1e91ba,_0x21d9f3))[_0x1520('0x25')](handleError(_0x1e91ba,null));};exports['show']=function(_0x303286,_0x26629a){var _0x41de4f={'raw':![],'where':{'id':_0x303286['params']['id']},'include':[{'model':db[_0x1520('0x39')],'as':_0x1520('0x51')}]},_0x31b84e={};_0x31b84e[_0x1520('0x40')]=_[_0x1520('0x3f')](db['WhatsappAccount'][_0x1520('0x52')]);_0x31b84e[_0x1520('0x3e')]=_['keys'](_0x303286[_0x1520('0x3e')]);_0x31b84e[_0x1520('0x48')]=_['intersection'](_0x31b84e[_0x1520('0x40')],_0x31b84e['query']);_0x41de4f[_0x1520('0x41')]=_[_0x1520('0x53')](_0x31b84e['model'],qs[_0x1520('0x42')](_0x303286[_0x1520('0x3e')][_0x1520('0x42')]));_0x41de4f[_0x1520('0x41')]=_0x41de4f[_0x1520('0x41')]['length']?_0x41de4f[_0x1520('0x41')]:_0x31b84e[_0x1520('0x40')];if(_0x303286[_0x1520('0x3e')][_0x1520('0x4e')]){_0x41de4f[_0x1520('0x54')]=[{'all':!![]}];}_0x41de4f=_[_0x1520('0x4c')]({},_0x41de4f,_0x303286[_0x1520('0x4d')]);return db[_0x1520('0x3a')]['find'](_0x41de4f)['then'](handleEntityNotFound(_0x26629a,null))[_0x1520('0x1c')](respondWithResult(_0x26629a,null))[_0x1520('0x25')](handleError(_0x26629a,null));};exports[_0x1520('0x55')]=function(_0x3d9770,_0x1f575b){return db[_0x1520('0x3a')][_0x1520('0x55')](_0x3d9770[_0x1520('0x56')],{})[_0x1520('0x1c')](function(_0x13ba7a){var _0x9da6a8=_0x3d9770[_0x1520('0x57')][_0x1520('0x34')]({'plain':!![]});if(!_0x9da6a8)throw new Error(_0x1520('0x58'));if(_0x9da6a8[_0x1520('0x59')]===_0x1520('0x57')){var _0x35062b=_0x13ba7a[_0x1520('0x34')]({'plain':!![]});var _0x531492='WhatsappAccounts';return db[_0x1520('0x5a')][_0x1520('0x5b')]({'where':{'name':_0x531492,'userProfileId':_0x9da6a8[_0x1520('0x5c')]},'raw':!![]})[_0x1520('0x1c')](function(_0x5a6e4f){if(_0x5a6e4f&&_0x5a6e4f[_0x1520('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x35062b[_0x1520('0x36')],'resourceId':_0x35062b['id'],'type':_0x5a6e4f['name'],'sectionId':_0x5a6e4f['id']},{})[_0x1520('0x1c')](function(){return _0x13ba7a;});}else{return _0x13ba7a;}})[_0x1520('0x25')](function(_0x5ef7c1){logger[_0x1520('0x22')](_0x1520('0x5e'),_0x5ef7c1);throw _0x5ef7c1;});}return _0x13ba7a;})[_0x1520('0x1c')](respondWithResult(_0x1f575b,0xc9))[_0x1520('0x25')](handleError(_0x1f575b,null));};exports[_0x1520('0x32')]=function(_0xfc83fe,_0x442dc0){if(_0xfc83fe[_0x1520('0x56')]['id']){delete _0xfc83fe[_0x1520('0x56')]['id'];}return db[_0x1520('0x3a')][_0x1520('0x5b')]({'where':{'id':_0xfc83fe['params']['id']},'include':[{'model':db['Pause'],'as':_0x1520('0x51')}]})['then'](handleEntityNotFound(_0x442dc0,null))[_0x1520('0x1c')](saveUpdates(_0xfc83fe[_0x1520('0x56')],null))[_0x1520('0x1c')](respondWithResult(_0x442dc0,null))[_0x1520('0x25')](handleError(_0x442dc0,null));};exports['destroy']=function(_0x526ca8,_0x46c224){return db[_0x1520('0x3a')][_0x1520('0x5b')]({'where':{'id':_0x526ca8[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x46c224,null))[_0x1520('0x1c')](removeEntity(_0x46c224,null))['catch'](handleError(_0x46c224,null));};exports[_0x1520('0x60')]=function(_0x22c876,_0x3b7cca){return db[_0x1520('0x3a')][_0x1520('0x60')]()[_0x1520('0x1c')](respondWithResult(_0x3b7cca,null))['catch'](handleError(_0x3b7cca,null));};exports[_0x1520('0x61')]=function(_0x4a3c2f,_0x1eb4b6,_0x38c21e){if(_0x4a3c2f[_0x1520('0x56')]['id']){delete _0x4a3c2f[_0x1520('0x56')]['id'];}return db[_0x1520('0x3a')][_0x1520('0x5b')]({'where':{'id':_0x4a3c2f[_0x1520('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1eb4b6,null))[_0x1520('0x1c')](function(_0x1c5089){if(_0x1c5089){_0x4a3c2f['body'][_0x1520('0x62')]=_0x1c5089['id'];return db[_0x1520('0x63')]['create'](_0x4a3c2f[_0x1520('0x56')]);}})[_0x1520('0x1c')](respondWithResult(_0x1eb4b6,null))['catch'](handleError(_0x1eb4b6,null));};exports['getDispositions']=function(_0x57485c,_0x357c5f,_0x524ea1){var _0x285183={'raw':![],'where':{}};var _0x50808a={};var _0x20f2e6={'count':0x0,'rows':[]};return db[_0x1520('0x3a')][_0x1520('0x64')]({'where':{'id':_0x57485c[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x357c5f,null))[_0x1520('0x1c')](function(_0x498082){if(_0x498082){_0x50808a[_0x1520('0x40')]=_[_0x1520('0x3f')](db[_0x1520('0x63')]['rawAttributes']);_0x50808a['query']=_[_0x1520('0x3f')](_0x57485c[_0x1520('0x3e')]);_0x50808a[_0x1520('0x48')]=_[_0x1520('0x53')](_0x50808a[_0x1520('0x40')],_0x50808a[_0x1520('0x3e')]);_0x285183[_0x1520('0x41')]=_[_0x1520('0x53')](_0x50808a[_0x1520('0x40')],qs[_0x1520('0x42')](_0x57485c['query'][_0x1520('0x42')]));_0x285183[_0x1520('0x41')]=_0x285183['attributes'][_0x1520('0x65')]?_0x285183[_0x1520('0x41')]:_0x50808a[_0x1520('0x40')];if(!_0x57485c[_0x1520('0x3e')]['hasOwnProperty'](_0x1520('0x43'))){_0x285183[_0x1520('0x44')]=qs[_0x1520('0x44')](_0x57485c['query'][_0x1520('0x44')]);_0x285183[_0x1520('0x2c')]=qs[_0x1520('0x2c')](_0x57485c[_0x1520('0x3e')]['offset']);}_0x285183[_0x1520('0x45')]=qs[_0x1520('0x46')](_0x57485c[_0x1520('0x3e')][_0x1520('0x46')]);_0x285183[_0x1520('0x47')]=qs['filters'](_[_0x1520('0x49')](_0x57485c[_0x1520('0x3e')],_0x50808a[_0x1520('0x48')]));_0x285183['where']['WhatsappAccountId']=_0x498082['id'];if(_0x57485c[_0x1520('0x3e')][_0x1520('0x4b')]){_0x285183[_0x1520('0x47')]=_[_0x1520('0x4c')](_0x285183[_0x1520('0x47')],{'$or':_[_0x1520('0x3d')](_0x285183[_0x1520('0x41')],function(_0x19c74f){var _0x1c14e4={};_0x1c14e4[_0x19c74f]={'$like':'%'+_0x57485c[_0x1520('0x3e')][_0x1520('0x4b')]+'%'};return _0x1c14e4;})});}_0x285183=_[_0x1520('0x4c')]({},_0x285183,_0x57485c[_0x1520('0x4d')]);return db[_0x1520('0x63')][_0x1520('0x2b')]({'where':_0x285183[_0x1520('0x47')]})[_0x1520('0x1c')](function(_0x1714a0){_0x20f2e6[_0x1520('0x2b')]=_0x1714a0;if(_0x57485c[_0x1520('0x3e')][_0x1520('0x4e')]){_0x285183[_0x1520('0x54')]=[{'all':!![]}];}return db[_0x1520('0x63')][_0x1520('0x4f')](_0x285183);})[_0x1520('0x1c')](function(_0x493b0c){_0x20f2e6[_0x1520('0x50')]=_0x493b0c;return _0x20f2e6;});}})[_0x1520('0x1c')](respondWithFilteredResult(_0x357c5f,_0x285183))[_0x1520('0x25')](handleError(_0x357c5f,null));};exports['removeDispositions']=function(_0x7796d,_0x3acadc,_0x438921){return db[_0x1520('0x3a')]['find']({'where':{'id':_0x7796d[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x3acadc,null))[_0x1520('0x1c')](function(_0x33bf3f){if(_0x33bf3f){return _0x33bf3f[_0x1520('0x66')](_0x7796d[_0x1520('0x3e')][_0x1520('0x67')]);}})[_0x1520('0x1c')](respondWithStatusCode(_0x3acadc,null))['catch'](handleError(_0x3acadc,null));};exports[_0x1520('0x68')]=function(_0x3b8f51,_0x5944cf,_0x26b3dd){if(_0x3b8f51['body']['id']){delete _0x3b8f51[_0x1520('0x56')]['id'];}return db[_0x1520('0x3a')][_0x1520('0x5b')]({'where':{'id':_0x3b8f51[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x5944cf,null))[_0x1520('0x1c')](function(_0x5129ba){if(_0x5129ba){_0x3b8f51[_0x1520('0x56')][_0x1520('0x62')]=_0x5129ba['id'];return db[_0x1520('0x69')][_0x1520('0x55')](_0x3b8f51[_0x1520('0x56')]);}})[_0x1520('0x1c')](respondWithResult(_0x5944cf,null))[_0x1520('0x25')](handleError(_0x5944cf,null));};exports[_0x1520('0x6a')]=function(_0x2ad394,_0x52afee,_0x22edbe){var _0x531cc2={'raw':![],'where':{}};var _0x210fee={};var _0x2dd862={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1520('0x64')]({'where':{'id':_0x2ad394[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x52afee,null))['then'](function(_0x74a1e5){if(_0x74a1e5){_0x210fee[_0x1520('0x40')]=_[_0x1520('0x3f')](db[_0x1520('0x69')][_0x1520('0x52')]);_0x210fee[_0x1520('0x3e')]=_[_0x1520('0x3f')](_0x2ad394[_0x1520('0x3e')]);_0x210fee[_0x1520('0x48')]=_['intersection'](_0x210fee[_0x1520('0x40')],_0x210fee[_0x1520('0x3e')]);_0x531cc2[_0x1520('0x41')]=_[_0x1520('0x53')](_0x210fee[_0x1520('0x40')],qs['fields'](_0x2ad394[_0x1520('0x3e')]['fields']));_0x531cc2[_0x1520('0x41')]=_0x531cc2[_0x1520('0x41')][_0x1520('0x65')]?_0x531cc2[_0x1520('0x41')]:_0x210fee[_0x1520('0x40')];if(!_0x2ad394[_0x1520('0x3e')]['hasOwnProperty'](_0x1520('0x43'))){_0x531cc2[_0x1520('0x44')]=qs[_0x1520('0x44')](_0x2ad394[_0x1520('0x3e')][_0x1520('0x44')]);_0x531cc2[_0x1520('0x2c')]=qs['offset'](_0x2ad394['query'][_0x1520('0x2c')]);}_0x531cc2['order']=qs[_0x1520('0x46')](_0x2ad394[_0x1520('0x3e')]['sort']);_0x531cc2['where']=qs[_0x1520('0x48')](_[_0x1520('0x49')](_0x2ad394['query'],_0x210fee[_0x1520('0x48')]));_0x531cc2[_0x1520('0x47')]['WhatsappAccountId']=_0x74a1e5['id'];if(_0x2ad394['query'][_0x1520('0x4b')]){_0x531cc2[_0x1520('0x47')]=_['merge'](_0x531cc2[_0x1520('0x47')],{'$or':_[_0x1520('0x3d')](_0x531cc2[_0x1520('0x41')],function(_0x4e322b){var _0x4b07a8={};_0x4b07a8[_0x4e322b]={'$like':'%'+_0x2ad394[_0x1520('0x3e')][_0x1520('0x4b')]+'%'};return _0x4b07a8;})});}_0x531cc2=_[_0x1520('0x4c')]({},_0x531cc2,_0x2ad394[_0x1520('0x4d')]);return db[_0x1520('0x69')][_0x1520('0x2b')]({'where':_0x531cc2[_0x1520('0x47')]})['then'](function(_0x343619){_0x2dd862[_0x1520('0x2b')]=_0x343619;if(_0x2ad394[_0x1520('0x3e')][_0x1520('0x4e')]){_0x531cc2[_0x1520('0x54')]=[{'all':!![]}];}return db[_0x1520('0x69')][_0x1520('0x4f')](_0x531cc2);})[_0x1520('0x1c')](function(_0x54aee6){_0x2dd862[_0x1520('0x50')]=_0x54aee6;return _0x2dd862;});}})[_0x1520('0x1c')](respondWithFilteredResult(_0x52afee,_0x531cc2))[_0x1520('0x25')](handleError(_0x52afee,null));};exports[_0x1520('0x6b')]=function(_0x413de8,_0x3830ae,_0x3ac42c){return db[_0x1520('0x3a')]['find']({'where':{'id':_0x413de8[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x3830ae,null))[_0x1520('0x1c')](function(_0x41f629){if(_0x41f629){return _0x41f629[_0x1520('0x6b')](_0x413de8[_0x1520('0x3e')]['ids']);}})[_0x1520('0x1c')](respondWithStatusCode(_0x3830ae,null))[_0x1520('0x25')](handleError(_0x3830ae,null));};exports[_0x1520('0x6c')]=function(_0x2fe81f,_0x126155,_0x266e9b){return db[_0x1520('0x3a')]['find']({'where':{'id':_0x2fe81f['params']['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x126155,null))[_0x1520('0x1c')](function(_0xb72c55){if(_0xb72c55){return _0xb72c55['addAgents'](_0x2fe81f[_0x1520('0x56')][_0x1520('0x67')],_['omit'](_0x2fe81f[_0x1520('0x56')],[_0x1520('0x67'),'id'])||{})[_0x1520('0x6d')](function(_0x139ec4){for(var _0x443de9=0x0;_0x443de9<_0x2fe81f[_0x1520('0x56')][_0x1520('0x67')]['length'];_0x443de9+=0x1){socket[_0x1520('0x6e')](_0x1520('0x6f'),{'UserId':Number(_0x2fe81f[_0x1520('0x56')][_0x1520('0x67')][_0x443de9]),'WhatsappAccountId':Number(_0x2fe81f[_0x1520('0x5f')]['id'])});}return _0x139ec4;});}})[_0x1520('0x1c')](respondWithResult(_0x126155,null))[_0x1520('0x25')](handleError(_0x126155,null));};exports['removeAgents']=function(_0x571f35,_0x4b1ee7,_0x4ee9fa){return db[_0x1520('0x3a')]['find']({'where':{'id':_0x571f35[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x4b1ee7,null))['then'](function(_0xb533e8){if(_0xb533e8){return _0xb533e8['removeAgents'](_0x571f35[_0x1520('0x3e')][_0x1520('0x67')])[_0x1520('0x1c')](function(){if(_[_0x1520('0x70')](_0x571f35[_0x1520('0x3e')][_0x1520('0x67')])){for(var _0x40c5b9=0x0;_0x40c5b9<_0x571f35[_0x1520('0x3e')][_0x1520('0x67')]['length'];_0x40c5b9+=0x1){socket[_0x1520('0x6e')]('userWhatsappAccount:remove',{'UserId':Number(_0x571f35[_0x1520('0x3e')]['ids'][_0x40c5b9]),'WhatsappAccountId':Number(_0x571f35[_0x1520('0x5f')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x571f35['query']['ids']),'WhatsappAccountId':Number(_0x571f35[_0x1520('0x5f')]['id'])});}});}})[_0x1520('0x1c')](respondWithStatusCode(_0x4b1ee7,null))['catch'](handleError(_0x4b1ee7,null));};exports[_0x1520('0x71')]=function(_0x348062,_0x51bff4,_0x2cb144){var _0x19abe1={};var _0x5b795c={};var _0x19164c;var _0x1da9d9;return db[_0x1520('0x3a')]['findOne']({'where':{'id':_0x348062[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x51bff4,null))[_0x1520('0x1c')](function(_0x132386){if(_0x132386){_0x19164c=_0x132386;_0x5b795c[_0x1520('0x40')]=_['keys'](db[_0x1520('0x72')]['rawAttributes']);_0x5b795c[_0x1520('0x3e')]=_[_0x1520('0x3f')](_0x348062[_0x1520('0x3e')]);_0x5b795c['filters']=_[_0x1520('0x53')](_0x5b795c[_0x1520('0x40')],_0x5b795c[_0x1520('0x3e')]);_0x19abe1[_0x1520('0x41')]=_[_0x1520('0x53')](_0x5b795c[_0x1520('0x40')],qs['fields'](_0x348062[_0x1520('0x3e')][_0x1520('0x42')]));_0x19abe1[_0x1520('0x41')]=_0x19abe1[_0x1520('0x41')][_0x1520('0x65')]?_0x19abe1[_0x1520('0x41')]:_0x5b795c[_0x1520('0x40')];_0x19abe1[_0x1520('0x45')]=qs[_0x1520('0x46')](_0x348062['query']['sort']);_0x19abe1[_0x1520('0x47')]=qs[_0x1520('0x48')](_[_0x1520('0x49')](_0x348062['query'],_0x5b795c['filters']));if(_0x348062[_0x1520('0x3e')]['filter']){_0x19abe1[_0x1520('0x47')]=_['merge'](_0x19abe1['where'],{'$or':_[_0x1520('0x3d')](_0x19abe1[_0x1520('0x41')],function(_0x4c1b8d){var _0x23d82f={};_0x23d82f[_0x4c1b8d]={'$like':'%'+_0x348062[_0x1520('0x3e')][_0x1520('0x4b')]+'%'};return _0x23d82f;})});}_0x19abe1=_[_0x1520('0x4c')]({},_0x19abe1,_0x348062[_0x1520('0x4d')]);return _0x19164c[_0x1520('0x71')](_0x19abe1);}})[_0x1520('0x1c')](function(_0x3dfa96){if(_0x3dfa96){_0x1da9d9=_0x3dfa96[_0x1520('0x65')];if(!_0x348062[_0x1520('0x3e')][_0x1520('0x73')](_0x1520('0x43'))){_0x19abe1[_0x1520('0x44')]=qs[_0x1520('0x44')](_0x348062[_0x1520('0x3e')]['limit']);_0x19abe1[_0x1520('0x2c')]=qs[_0x1520('0x2c')](_0x348062['query'][_0x1520('0x2c')]);}return _0x19164c['getAgents'](_0x19abe1);}})[_0x1520('0x1c')](function(_0x13d07f){if(_0x13d07f){return _0x13d07f?{'count':_0x1da9d9,'rows':_0x13d07f}:null;}})[_0x1520('0x1c')](respondWithResult(_0x51bff4,null))[_0x1520('0x25')](handleError(_0x51bff4,null));};exports[_0x1520('0x74')]=function(_0x2d11a1,_0x4307ab){var _0x551409=_0x2d11a1[_0x1520('0x5f')]['id'];var _0x3697d8=_0x2d11a1['body'];var _0x26d8bc=0xc8;var _0x3cdc11=null;return db[_0x1520('0x75')][_0x1520('0x76')]({'isolationLevel':db[_0x1520('0x75')][_0x1520('0x77')]['ISOLATION_LEVELS'][_0x1520('0x78')]},function(_0x1a4f5b){return db['WhatsappAccount']['findOne']({'where':{'id':_0x551409},'transaction':_0x1a4f5b})['then'](function(_0x376b0f){if(_0x376b0f){return db[_0x1520('0x79')][_0x1520('0x33')]({'where':{'WhatsappAccountId':_0x551409},'transaction':_0x1a4f5b})[_0x1520('0x1c')](function(){var _0x179955=_['map'](_0x3697d8,function(_0x38882f){_0x38882f[_0x1520('0x62')]=_0x551409;return _0x38882f;});return db[_0x1520('0x79')][_0x1520('0x7a')](_0x179955,{'transaction':_0x1a4f5b});});}else{_0x26d8bc=0x194;_0x3cdc11=[];}});})[_0x1520('0x1c')](function(){if(_0x26d8bc!==0x194){return db['WhatsappApplication'][_0x1520('0x7b')]({'where':{'WhatsappAccountId':_0x551409},'order':_0x1520('0x7c')})[_0x1520('0x1c')](function(_0x436754){_0x3cdc11=_0x436754;});}})[_0x1520('0x25')](function(_0xc2af15){_0x26d8bc=0x1f4;logger['error'](_0xc2af15['stack']);if(_0xc2af15['name']){delete _0xc2af15[_0x1520('0x36')];}_0x3cdc11=_0xc2af15;})[_0x1520('0x7d')](function(){if(_0x3cdc11===null){_0x4307ab[_0x1520('0x26')](_0x26d8bc);}else{if(_0x26d8bc===0x1f4){_0x4307ab[_0x1520('0x27')](_0x26d8bc)[_0x1520('0x37')](_0x3cdc11);}else{_0x4307ab['status'](_0x26d8bc)[_0x1520('0x29')](_0x3cdc11);}}});};exports[_0x1520('0x7e')]=function(_0x2d8252,_0x1b4eb8,_0x4937a3){var _0x548b5b={};var _0x4d875f={};var _0x54113d;var _0x5733dd;return db[_0x1520('0x3a')][_0x1520('0x64')]({'where':{'id':_0x2d8252[_0x1520('0x5f')]['id']}})[_0x1520('0x1c')](handleEntityNotFound(_0x1b4eb8,null))[_0x1520('0x1c')](function(_0x15e1aa){if(_0x15e1aa){_0x54113d=_0x15e1aa;_0x4d875f['model']=_[_0x1520('0x3f')](db[_0x1520('0x79')][_0x1520('0x52')]);_0x4d875f[_0x1520('0x3e')]=_[_0x1520('0x3f')](_0x2d8252[_0x1520('0x3e')]);_0x4d875f[_0x1520('0x48')]=_['intersection'](_0x4d875f[_0x1520('0x40')],_0x4d875f[_0x1520('0x3e')]);_0x548b5b[_0x1520('0x41')]=_['intersection'](_0x4d875f[_0x1520('0x40')],qs[_0x1520('0x42')](_0x2d8252[_0x1520('0x3e')][_0x1520('0x42')]));_0x548b5b[_0x1520('0x41')]=_0x548b5b[_0x1520('0x41')][_0x1520('0x65')]?_0x548b5b['attributes']:_0x4d875f[_0x1520('0x40')];_0x548b5b[_0x1520('0x45')]=qs['sort'](_0x2d8252[_0x1520('0x3e')][_0x1520('0x46')]);_0x548b5b[_0x1520('0x47')]=qs[_0x1520('0x48')](_[_0x1520('0x49')](_0x2d8252[_0x1520('0x3e')],_0x4d875f['filters']));if(_0x2d8252[_0x1520('0x3e')][_0x1520('0x4b')]){_0x548b5b['where']=_[_0x1520('0x4c')](_0x548b5b[_0x1520('0x47')],{'$or':_[_0x1520('0x3d')](_0x548b5b['attributes'],function(_0x3ea3b6){var _0x35a67b={};_0x35a67b[_0x3ea3b6]={'$like':'%'+_0x2d8252[_0x1520('0x3e')][_0x1520('0x4b')]+'%'};return _0x35a67b;})});}_0x548b5b=_[_0x1520('0x4c')]({},_0x548b5b,_0x2d8252[_0x1520('0x4d')]);return _0x54113d[_0x1520('0x7e')](_0x548b5b);}})[_0x1520('0x1c')](function(_0x591b2e){if(_0x591b2e){_0x5733dd=_0x591b2e[_0x1520('0x65')];if(!_0x2d8252[_0x1520('0x3e')]['hasOwnProperty']('nolimit')){_0x548b5b[_0x1520('0x44')]=qs['limit'](_0x2d8252[_0x1520('0x3e')][_0x1520('0x44')]);_0x548b5b[_0x1520('0x2c')]=qs[_0x1520('0x2c')](_0x2d8252['query'][_0x1520('0x2c')]);}return _0x54113d[_0x1520('0x7e')](_0x548b5b);}})[_0x1520('0x1c')](function(_0xe7f9f0){if(_0xe7f9f0){return _0xe7f9f0?{'count':_0x5733dd,'rows':_0xe7f9f0}:null;}})[_0x1520('0x1c')](respondWithResult(_0x1b4eb8,null))['catch'](handleError(_0x1b4eb8,null));};exports[_0x1520('0x7f')]=function(_0x35552f,_0x59e35a,_0x2eba30){var _0x274aee={'channel':_0x1520('0x80')};var _0x57a588=[];var _0x34eb3d=[];var _0x4a6e31={};return db['WhatsappAccount']['find']({'where':{'id':_0x35552f[_0x1520('0x5f')]['id']},'include':[{'model':db[_0x1520('0x79')],'as':_0x1520('0x81')}]})[_0x1520('0x1c')](handleEntityNotFound(_0x59e35a,null))[_0x1520('0x1c')](function(_0xe4ce61){_0x274aee['account']=_0xe4ce61;if(_0x274aee['account']&&_0x274aee['account'][_0x1520('0x3b')]==='sinch'&&_0x35552f[_0x1520('0x56')]['statuses']){if(_0x35552f['body'][_0x1520('0x82')][_0x1520('0x65')]===0x0)return;if(_0x35552f[_0x1520('0x56')][_0x1520('0x82')][0x0][_0x1520('0x83')]!=='read')return;return db['WhatsappMessage'][_0x1520('0x32')]({'read':!![],'readAt':_0x35552f[_0x1520('0x56')][_0x1520('0x82')][0x0][_0x1520('0x84')]},{'where':{'messageId':_0x35552f[_0x1520('0x56')]['statuses'][0x0][_0x1520('0x85')]},'individualHooks':!![]})['then'](function(_0x13d174){return _0x59e35a[_0x1520('0x27')](0xc8)[_0x1520('0x29')](_0x13d174);});}_0x274aee[_0x1520('0x86')]=_[_0x1520('0x87')](_0xe4ce61[_0x1520('0x81')],['priority'],[_0x1520('0x88')]);if(_0x274aee[_0x1520('0x89')][_0x1520('0x81')]){delete _0x274aee[_0x1520('0x89')]['Applications'];}return db['CmContact'][_0x1520('0x60')]()[_0x1520('0x1c')](function(_0xab8b56){if(!_0xab8b56){throw new db[(_0x1520('0x8a'))][(_0x1520('0x8b'))](_0x1520('0x8c'));}_0x57a588=_[_0x1520('0x8d')](_[_0x1520('0x3f')](_0xab8b56),[_0x1520('0x8e'),_0x1520('0x8f')]);_0x34eb3d=_[_0x1520('0x8d')](_[_0x1520('0x3f')](_0xab8b56),['createdAt','updatedAt',_0x1520('0x90'),_0x1520('0x91')]);_0x274aee[_0x1520('0x56')]={'mapKey':_0x1520('0x92')};if(_0x274aee[_0x1520('0x89')]&&_0x274aee['account'][_0x1520('0x3b')]===_0x1520('0x93')){_0x274aee[_0x1520('0x56')]['from']=_0x35552f[_0x1520('0x56')][_0x1520('0x94')][_0x1520('0x95')](_0x1520('0x96'),'');_0x274aee['body'][_0x1520('0x56')]=_0x35552f[_0x1520('0x56')][_0x1520('0x97')];_0x274aee[_0x1520('0x56')]['messageId']=_0x35552f[_0x1520('0x56')][_0x1520('0x98')];}if(_0x274aee[_0x1520('0x89')]&&_0x274aee[_0x1520('0x89')][_0x1520('0x3b')]===_0x1520('0x99')){_0x274aee[_0x1520('0x56')][_0x1520('0x9a')]=_0x35552f[_0x1520('0x56')][_0x1520('0x9b')][0x0]['from'];_0x274aee[_0x1520('0x56')][_0x1520('0x56')]=_0x35552f[_0x1520('0x56')][_0x1520('0x9b')][0x0][_0x1520('0x23')][_0x1520('0x56')];_0x274aee[_0x1520('0x56')][_0x1520('0x9c')]=_0x35552f['body']['notifications'][0x0][_0x1520('0x85')];}if(_0x274aee[_0x1520('0x56')]['id']){delete _0x274aee[_0x1520('0x56')]['id'];}if(_[_0x1520('0x9d')](_0x274aee[_0x1520('0x56')][_0x1520('0x9a')])){throw new db[(_0x1520('0x8a'))][(_0x1520('0x8b'))](_0x1520('0x9e'));}if(_['isNil'](_0x274aee[_0x1520('0x56')][_0x1520('0x56')])||_0x274aee[_0x1520('0x56')][_0x1520('0x56')]===''){throw new db[(_0x1520('0x8a'))][(_0x1520('0x8b'))](_0x1520('0x9f'));}if(_[_0x1520('0x9d')](_0x274aee[_0x1520('0x56')][_0x1520('0xa0')])){throw new db[(_0x1520('0x8a'))][(_0x1520('0x8b'))](_0x1520('0xa1')+_0x34eb3d);}if(!_[_0x1520('0xa2')](_0x34eb3d,_0x274aee['body'][_0x1520('0xa0')])){throw new db[(_0x1520('0x8a'))][(_0x1520('0x8b'))](_0x1520('0xa3')+_0x34eb3d);}_0x4a6e31[_0x274aee[_0x1520('0x56')][_0x1520('0xa0')]]=_0x274aee[_0x1520('0x56')][_0x1520('0x9a')];return db[_0x1520('0xa4')]['find']({'where':{'id':_0x274aee['account'][_0x1520('0x91')]},'include':[{'model':db[_0x1520('0xa5')],'as':'Contacts','where':_0x4a6e31,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x59e35a,null))[_0x1520('0x1c')](function(_0x3b419f){if(_0x3b419f){_0x274aee[_0x1520('0xa6')]=_['omit'](_0x3b419f,['Contacts']);if(_0x3b419f[_0x1520('0xa7')][_0x1520('0x65')]){return _0x3b419f[_0x1520('0xa7')][0x0];}var _0x1844a8=_[_0x1520('0x16')](_0x274aee['body'],{'firstName':_0x274aee['body'][_0x1520('0x9a')],'ListId':_0x3b419f['id']});_0x1844a8[_0x274aee[_0x1520('0x56')][_0x1520('0xa0')]]=_0x274aee[_0x1520('0x56')][_0x1520('0x9a')];return db[_0x1520('0xa5')]['create'](_0x1844a8,{'fields':_0x57a588,'raw':!![]});}})[_0x1520('0x1c')](handleEntityNotFound(_0x59e35a,null))[_0x1520('0x1c')](function(_0x202e2c){if(_0x202e2c){_0x274aee[_0x1520('0xa8')]=_0x202e2c;var _0x5b8902={'ContactId':_0x202e2c['id'],'phone':_0x274aee[_0x1520('0x56')][_0x1520('0x9a')],'WhatsappAccountId':_0x35552f[_0x1520('0x5f')]['id']};var _0x247b32={'ContactId':_0x202e2c['id'],'WhatsappAccountId':_0x35552f[_0x1520('0x5f')]['id'],'closed':![]};return db[_0x1520('0xa9')][_0x1520('0x5b')]({'where':_0x247b32})[_0x1520('0x1c')](function(_0x40a999){if(_0x40a999){return[_0x40a999,![]];}return db[_0x1520('0xa9')][_0x1520('0x55')](_0x5b8902)[_0x1520('0x1c')](function(_0x53b173){return[_0x53b173,!![]];});});}})[_0x1520('0x6d')](function(_0x5ce3b7,_0x489b44){_0x274aee['interaction']=_0x5ce3b7[_0x1520('0x34')]({'plain':!![]});_0x274aee['interaction'][_0x1520('0xaa')]=![];if(_0x489b44){if(_0x274aee[_0x1520('0x89')]['autoclose']){_0x274aee[_0x1520('0x86')][_0x1520('0xab')]({'id':0x0,'priority':_0x274aee['applications'][_0x1520('0x65')]+0x1,'app':_0x1520('0xac'),'appdata':_0x1520('0xad'),'interval':_0x1520('0xae')});}_0x274aee[_0x1520('0xaf')]['created']=!![];}return db[_0x1520('0xb0')][_0x1520('0x55')]({'phone':_0x274aee[_0x1520('0x56')][_0x1520('0x9a')],'messageId':_0x274aee[_0x1520('0x56')][_0x1520('0x9c')],'body':_0x274aee[_0x1520('0x56')][_0x1520('0x56')],'WhatsappAccountId':_0x35552f['params']['id'],'WhatsappInteractionId':_0x5ce3b7['id'],'direction':'in','ContactId':_0x5ce3b7[_0x1520('0xb1')],'AttachmentId':_0x274aee[_0x1520('0x56')][_0x1520('0xb2')]});})[_0x1520('0x1c')](function(_0x3c03f6){_0x274aee[_0x1520('0x23')]=_0x3c03f6;if(!_0x274aee[_0x1520('0xaf')][_0x1520('0xb3')])return;return db[_0x1520('0x72')]['find']({'attributes':['id',_0x1520('0x36')],'where':{'id':_0x274aee[_0x1520('0xaf')][_0x1520('0xb3')]}});})['then'](function(_0x82d636){if(_0x82d636){_0x274aee['applications'][_0x1520('0xb4')]({'id':0x0,'priority':0x0,'app':_0x1520('0xb5'),'appdata':_0x82d636[_0x1520('0x36')]+','+(_0x274aee[_0x1520('0x89')][_0x1520('0xb6')]||0xa),'interval':_0x1520('0xae')});}if(!_0x274aee[_0x1520('0xaf')][_0x1520('0xb7')])return;return db[_0x1520('0xb8')][_0x1520('0x5b')]({'attributes':['id','name'],'where':{'id':_0x274aee[_0x1520('0xaf')][_0x1520('0xb7')]}});})['then'](function(_0x4e0676){if(_0x4e0676){_0x274aee[_0x1520('0x86')][_0x1520('0xb4')]({'id':0x0,'priority':0x1,'app':_0x1520('0xb9'),'appdata':_0x4e0676[_0x1520('0x36')]+','+(_0x274aee[_0x1520('0x89')][_0x1520('0xba')]||0x12c),'interval':_0x1520('0xae')});}return respondWithRpcPromise(_0x1520('0xbb'),_0x1520('0xbc'),_0x274aee);})[_0x1520('0x1c')](function(_0x1dd927){if(_0x1dd927){var _0x28db0d=0xc8;var _0x1e738f=_0x1520('0xbd');logger[_0x1520('0x1d')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1e738f,_0x28db0d,_0x1520('0xbe'));logger['debug'](_0x1520('0xbf'),_0x1e738f,_0x28db0d,'entity\x20found',JSON[_0x1520('0x21')](_0x1dd927));if(_0x274aee[_0x1520('0x89')]['type']===_0x1520('0x93')){return _0x59e35a[_0x1520('0x27')](_0x28db0d)['set'](_0x1520('0xc0'),_0x1520('0xc1'))[_0x1520('0x37')](_0x1520('0xc2'));}else{return _0x59e35a[_0x1520('0x27')](_0x28db0d)[_0x1520('0x29')](_0x1dd927);}}});})['catch'](handleError(_0x59e35a,null));};exports['send']=function(_0x738b4e,_0x42df52,_0x34173b){var _0x4ac929,_0x4ab1b5,_0x2f408b;if(_[_0x1520('0x9d')](_0x738b4e['body']['body'])||_0x738b4e[_0x1520('0x56')]['body']===''){throw new db[(_0x1520('0x8a'))][(_0x1520('0x8b'))](_0x1520('0x9f'));}if(_['isNil'](_0x738b4e[_0x1520('0x56')]['to'])){throw new db[(_0x1520('0x8a'))][(_0x1520('0x8b'))](_0x1520('0xc3'));}_0x4ac929=_0x738b4e['body']['to'];return db['WhatsappAccount'][_0x1520('0x5b')]({'where':{'id':_0x738b4e[_0x1520('0x5f')]['id']},'include':[{'model':db[_0x1520('0xa4')],'as':_0x1520('0xc4'),'include':[{'model':db[_0x1520('0xa5')],'as':'Contacts','where':{'mobile':_0x4ac929},'limit':0x1,'order':[[_0x1520('0x8f'),_0x1520('0xc5')]]}]}]})[_0x1520('0x1c')](handleEntityNotFound(_0x42df52,null))[_0x1520('0x1c')](function(_0x2de9b1){if(_0x2de9b1&&_0x2de9b1['List']){_0x4ab1b5=_0x2de9b1[_0x1520('0x34')]({'plain':!![]});if(_0x4ab1b5['List']&&_0x4ab1b5[_0x1520('0xc4')]['Contacts'][_0x1520('0x65')]){return _0x4ab1b5[_0x1520('0xc4')][_0x1520('0xa7')][0x0];}return db[_0x1520('0xa5')][_0x1520('0x55')](_[_0x1520('0x16')](_0x738b4e[_0x1520('0x56')],{'firstName':_0x4ac929,'mobile':_0x4ac929,'phone':_0x4ac929,'ListId':_0x4ab1b5[_0x1520('0x91')]}));}})['then'](handleEntityNotFound(_0x42df52,null))[_0x1520('0x1c')](function(_0x29b4c1){if(_0x29b4c1){_0x2f408b=_0x29b4c1;return db[_0x1520('0xa9')][_0x1520('0x5b')]({'where':{'ContactId':_0x2f408b['id'],'closed':![],'WhatsappAccountId':_0x4ab1b5['id']}})[_0x1520('0x1c')](function(_0x1f76ce){if(_0x1f76ce){return[_0x1f76ce,![]];}return db['WhatsappInteraction'][_0x1520('0x55')]({'UserId':_0x738b4e['user']['id'],'ContactId':_0x2f408b['id'],'WhatsappAccountId':_0x4ab1b5['id'],'phone':_0x4ac929,'firstMsgDirection':_0x1520('0xc6'),'Messages':[_['merge'](_0x738b4e[_0x1520('0x56')],{'read':![],'body':_0x738b4e[_0x1520('0x56')][_0x1520('0x56')],'phone':_0x4ac929,'WhatsappAccountId':_0x4ab1b5['id'],'UserId':_0x738b4e[_0x1520('0x57')]['id'],'ContactId':_0x2f408b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x1520('0xc7')}]})[_0x1520('0x1c')](function(_0x122a5c){return[_0x122a5c,!![]];});});}})[_0x1520('0x6d')](function(_0x1dd582,_0x281e64){if(_0x281e64){return _0x1dd582;}return db[_0x1520('0xb0')]['create'](_[_0x1520('0x4c')](_0x738b4e[_0x1520('0x56')],{'read':![],'body':_0x738b4e[_0x1520('0x56')]['body'],'phone':_0x4ac929,'WhatsappAccountId':_0x4ab1b5['id'],'WhatsappInteractionId':_0x1dd582['id'],'UserId':_0x738b4e[_0x1520('0x57')]['id'],'ContactId':_0x2f408b['id']}))[_0x1520('0x1c')](function(_0x2f1eb6){_0x1dd582[_0x1520('0xc8')]['Messages']=[];_0x1dd582[_0x1520('0xc8')][_0x1520('0xc7')][_0x1520('0xab')](_0x2f1eb6['dataValues']);return _0x1dd582;});})[_0x1520('0x1c')](respondWithResult(_0x42df52,null))[_0x1520('0x25')](handleError(_0x42df52,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 0b7f73d..0cfaed8 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 _0xfc5d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3a9818,_0x4b500f){var _0x33ab1e=function(_0x58f4a4){while(--_0x58f4a4){_0x3a9818['push'](_0x3a9818['shift']());}};_0x33ab1e(++_0x4b500f);}(_0xfc5d,0xd7));var _0xdfc5=function(_0x48d669,_0x2cddd4){_0x48d669=_0x48d669-0x0;var _0xa92ebb=_0xfc5d[_0x48d669];return _0xa92ebb;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xdfc5('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdfc5('0x1')](0x0);var events={'afterCreate':_0xdfc5('0x2'),'afterUpdate':_0xdfc5('0x3'),'afterDestroy':_0xdfc5('0x4')};function emitEvent(_0x11892c){return function(_0x226af7,_0x3e8952,_0x5d6c41){WhatsappAccountEvents[_0xdfc5('0x5')](_0x11892c+':'+_0x226af7['id'],_0x226af7);WhatsappAccountEvents[_0xdfc5('0x5')](_0x11892c,_0x226af7);_0x5d6c41(null);};}for(var e in events){if(events[_0xdfc5('0x6')](e)){var event=events[e];WhatsappAccount[_0xdfc5('0x7')](e,emitEvent(event));}}module[_0xdfc5('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x4d01=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x108654,_0xc227de){var _0x4d75d7=function(_0x2914a3){while(--_0x2914a3){_0x108654['push'](_0x108654['shift']());}};_0x4d75d7(++_0xc227de);}(_0x4d01,0x1be));var _0x14d0=function(_0x54b396,_0x3612ee){_0x54b396=_0x54b396-0x0;var _0x532e6d=_0x4d01[_0x54b396];return _0x532e6d;};'use strict';var EventEmitter=require(_0x14d0('0x0'));var WhatsappAccount=require(_0x14d0('0x1'))['db'][_0x14d0('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x14d0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x14d0('0x4'),'afterDestroy':_0x14d0('0x5')};function emitEvent(_0x4e010e){return function(_0x84f04c,_0x1ecf3a,_0x12b491){WhatsappAccountEvents[_0x14d0('0x6')](_0x4e010e+':'+_0x84f04c['id'],_0x84f04c);WhatsappAccountEvents[_0x14d0('0x6')](_0x4e010e,_0x84f04c);_0x12b491(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x14d0('0x7')](e,emitEvent(event));}}module[_0x14d0('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b8786d6..e085912 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 _0x6857=['request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3704c3,_0x53caaa){var _0xb1a8a=function(_0x41f8ed){while(--_0x41f8ed){_0x3704c3['push'](_0x3704c3['shift']());}};_0xb1a8a(++_0x53caaa);}(_0x6857,0x82));var _0x7685=function(_0x23b415,_0x361b54){_0x23b415=_0x23b415-0x0;var _0x43b347=_0x6857[_0x23b415];return _0x43b347;};'use strict';var _=require(_0x7685('0x0'));var util=require(_0x7685('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7685('0x2'));var fs=require('fs');var path=require(_0x7685('0x3'));var rimraf=require(_0x7685('0x4'));var config=require(_0x7685('0x5'));var attributes=require(_0x7685('0x6'));module[_0x7685('0x7')]=function(_0x45b799,_0x3d2fc6){return _0x45b799[_0x7685('0x8')](_0x7685('0x9'),attributes,{'tableName':_0x7685('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ca1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x1c149e,_0x3ac97b){var _0x3212f2=function(_0x20d14d){while(--_0x20d14d){_0x1c149e['push'](_0x1c149e['shift']());}};_0x3212f2(++_0x3ac97b);}(_0x3ca1,0xc9));var _0x13ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x13ca('0x0'));var util=require(_0x13ca('0x1'));var logger=require(_0x13ca('0x2'))(_0x13ca('0x3'));var moment=require(_0x13ca('0x4'));var BPromise=require(_0x13ca('0x5'));var rp=require(_0x13ca('0x6'));var fs=require('fs');var path=require(_0x13ca('0x7'));var rimraf=require(_0x13ca('0x8'));var config=require(_0x13ca('0x9'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x58d965,_0x4fc458){return _0x58d965['define'](_0x13ca('0xa'),attributes,{'tableName':_0x13ca('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 4ecd49c..bed7224 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 _0xaaba=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','model','map','then','lodash'];(function(_0x327375,_0x3f57be){var _0x12e6f3=function(_0x2581dd){while(--_0x2581dd){_0x327375['push'](_0x327375['shift']());}};_0x12e6f3(++_0x3f57be);}(_0xaaba,0x10f));var _0xaaab=function(_0x19651b,_0x3c150c){_0x19651b=_0x19651b-0x0;var _0x36d098=_0xaaba[_0x19651b];return _0x36d098;};'use strict';var _=require(_0xaaab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaaab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaab('0x2'));var db=require(_0xaaab('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaaab('0x4'));var config=require(_0xaaab('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xaaab('0x6')][_0xaaab('0x7')]({'port':0x232a});config[_0xaaab('0x8')]=_[_0xaaab('0x9')](config[_0xaaab('0x8')],{'host':_0xaaab('0xa'),'port':0x18eb});var socket=require(_0xaaab('0xb'))(new Redis(config[_0xaaab('0x8')]));require(_0xaaab('0xc'))[_0xaaab('0xd')](socket);function respondWithRpcPromise(_0x199860,_0xe72180,_0x3994f1){return new BPromise(function(_0x4ac286,_0x28d698){return client[_0xaaab('0xe')](_0x199860,_0x3994f1)['then'](function(_0x59c604){logger[_0xaaab('0xf')](_0xaaab('0x10'),_0xe72180,_0xaaab('0x11'));logger[_0xaaab('0x12')](_0xaaab('0x13'),_0xe72180,'request\x20sent',JSON['stringify'](_0x59c604));if(_0x59c604[_0xaaab('0x14')]){if(_0x59c604[_0xaaab('0x14')][_0xaaab('0x15')]===0x1f4){logger['error'](_0xaaab('0x10'),_0xe72180,_0x59c604[_0xaaab('0x14')]['message']);return _0x28d698(_0x59c604['error'][_0xaaab('0x16')]);}logger[_0xaaab('0x14')](_0xaaab('0x10'),_0xe72180,_0x59c604[_0xaaab('0x14')][_0xaaab('0x16')]);return _0x4ac286(_0x59c604['error'][_0xaaab('0x16')]);}else{logger[_0xaaab('0xf')](_0xaaab('0x10'),_0xe72180,'request\x20sent');_0x4ac286(_0x59c604['result'][_0xaaab('0x16')]);}})[_0xaaab('0x17')](function(_0x173548){logger['error'](_0xaaab('0x10'),_0xe72180,_0x173548);_0x28d698(_0x173548);});});}exports[_0xaaab('0x18')]=function(_0x47fa68){var _0x57fc4b=this;return new Promise(function(_0x57f3fb,_0x424cb8){return db[_0xaaab('0x19')]['find']({'raw':_0x47fa68[_0xaaab('0x1a')]?_0x47fa68[_0xaaab('0x1a')][_0xaaab('0x1b')]===undefined?!![]:![]:!![],'where':_0x47fa68[_0xaaab('0x1a')]?_0x47fa68[_0xaaab('0x1a')][_0xaaab('0x1c')]||null:null,'attributes':_0x47fa68['options']?_0x47fa68['options'][_0xaaab('0x1d')]||null:null,'include':_0x47fa68[_0xaaab('0x1a')]?_0x47fa68[_0xaaab('0x1a')][_0xaaab('0x1e')]?_['map'](_0x47fa68[_0xaaab('0x1a')][_0xaaab('0x1e')],function(_0x2b1c0a){return{'model':db[_0x2b1c0a[_0xaaab('0x1f')]],'as':_0x2b1c0a['as'],'attributes':_0x2b1c0a[_0xaaab('0x1d')],'include':_0x2b1c0a[_0xaaab('0x1e')]?_[_0xaaab('0x20')](_0x2b1c0a[_0xaaab('0x1e')],function(_0x175921){return{'model':db[_0x175921[_0xaaab('0x1f')]],'as':_0x175921['as'],'attributes':_0x175921[_0xaaab('0x1d')],'include':_0x175921[_0xaaab('0x1e')]?_[_0xaaab('0x20')](_0x175921[_0xaaab('0x1e')],function(_0x1d30f1){return{'model':db[_0x1d30f1[_0xaaab('0x1f')]],'as':_0x1d30f1['as'],'attributes':_0x1d30f1['attributes']};}):[]};}):[]};}):[]:[]})[_0xaaab('0x21')](function(_0x265f17){logger['info'](_0xaaab('0x18'),_0x47fa68);logger[_0xaaab('0x12')](_0xaaab('0x18'),_0x47fa68,JSON['stringify'](_0x265f17));_0x57f3fb(_0x265f17);})[_0xaaab('0x17')](function(_0x5c31db){logger[_0xaaab('0x14')](_0xaaab('0x18'),_0x5c31db[_0xaaab('0x16')],_0x47fa68);_0x424cb8(_0x57fc4b[_0xaaab('0x14')](0x1f4,_0x5c31db['message']));});});}; \ No newline at end of file +var _0x4959=['options','raw','attributes','include','map','model','ShowWhatsappAccount','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','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'];(function(_0x1a4cb0,_0x4f9dda){var _0x10e9ed=function(_0x25fac5){while(--_0x25fac5){_0x1a4cb0['push'](_0x1a4cb0['shift']());}};_0x10e9ed(++_0x4f9dda);}(_0x4959,0x9b));var _0x9495=function(_0x9adb61,_0x4aba88){_0x9adb61=_0x9adb61-0x0;var _0x305e14=_0x4959[_0x9adb61];return _0x305e14;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9495('0x0'));var BPromise=require(_0x9495('0x1'));var rs=require(_0x9495('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9495('0x3'))['db'];var utils=require(_0x9495('0x4'));var logger=require(_0x9495('0x5'))(_0x9495('0x6'));var config=require('../../config/environment');var jayson=require(_0x9495('0x7'));var client=jayson[_0x9495('0x8')][_0x9495('0x9')]({'port':0x232a});config[_0x9495('0xa')]=_[_0x9495('0xb')](config[_0x9495('0xa')],{'host':_0x9495('0xc'),'port':0x18eb});var socket=require(_0x9495('0xd'))(new Redis(config[_0x9495('0xa')]));require(_0x9495('0xe'))[_0x9495('0xf')](socket);function respondWithRpcPromise(_0x4f11ca,_0x184fc3,_0x579a7e){return new BPromise(function(_0x4b53aa,_0x4fb16d){return client['request'](_0x4f11ca,_0x579a7e)[_0x9495('0x10')](function(_0x5e15a3){logger[_0x9495('0x11')](_0x9495('0x12'),_0x184fc3,_0x9495('0x13'));logger[_0x9495('0x14')](_0x9495('0x15'),_0x184fc3,_0x9495('0x13'),JSON[_0x9495('0x16')](_0x5e15a3));if(_0x5e15a3[_0x9495('0x17')]){if(_0x5e15a3[_0x9495('0x17')][_0x9495('0x18')]===0x1f4){logger[_0x9495('0x17')](_0x9495('0x12'),_0x184fc3,_0x5e15a3[_0x9495('0x17')][_0x9495('0x19')]);return _0x4fb16d(_0x5e15a3['error'][_0x9495('0x19')]);}logger[_0x9495('0x17')](_0x9495('0x12'),_0x184fc3,_0x5e15a3[_0x9495('0x17')][_0x9495('0x19')]);return _0x4b53aa(_0x5e15a3['error'][_0x9495('0x19')]);}else{logger[_0x9495('0x11')](_0x9495('0x12'),_0x184fc3,_0x9495('0x13'));_0x4b53aa(_0x5e15a3[_0x9495('0x1a')]['message']);}})[_0x9495('0x1b')](function(_0x22e38d){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x184fc3,_0x22e38d);_0x4fb16d(_0x22e38d);});});}exports['ShowWhatsappAccount']=function(_0x4c0369){var _0x3f67c1=this;return new Promise(function(_0x185a86,_0x95e617){return db[_0x9495('0x1c')][_0x9495('0x1d')]({'raw':_0x4c0369[_0x9495('0x1e')]?_0x4c0369[_0x9495('0x1e')][_0x9495('0x1f')]===undefined?!![]:![]:!![],'where':_0x4c0369[_0x9495('0x1e')]?_0x4c0369[_0x9495('0x1e')]['where']||null:null,'attributes':_0x4c0369[_0x9495('0x1e')]?_0x4c0369[_0x9495('0x1e')][_0x9495('0x20')]||null:null,'include':_0x4c0369[_0x9495('0x1e')]?_0x4c0369[_0x9495('0x1e')][_0x9495('0x21')]?_[_0x9495('0x22')](_0x4c0369[_0x9495('0x1e')][_0x9495('0x21')],function(_0x5751c4){return{'model':db[_0x5751c4[_0x9495('0x23')]],'as':_0x5751c4['as'],'attributes':_0x5751c4[_0x9495('0x20')],'include':_0x5751c4[_0x9495('0x21')]?_[_0x9495('0x22')](_0x5751c4[_0x9495('0x21')],function(_0x371eea){return{'model':db[_0x371eea[_0x9495('0x23')]],'as':_0x371eea['as'],'attributes':_0x371eea[_0x9495('0x20')],'include':_0x371eea['include']?_[_0x9495('0x22')](_0x371eea[_0x9495('0x21')],function(_0x2438db){return{'model':db[_0x2438db[_0x9495('0x23')]],'as':_0x2438db['as'],'attributes':_0x2438db['attributes']};}):[]};}):[]};}):[]:[]})[_0x9495('0x10')](function(_0x36aac0){logger[_0x9495('0x11')]('ShowWhatsappAccount',_0x4c0369);logger[_0x9495('0x14')](_0x9495('0x24'),_0x4c0369,JSON[_0x9495('0x16')](_0x36aac0));_0x185a86(_0x36aac0);})[_0x9495('0x1b')](function(_0xcbfbee){logger[_0x9495('0x17')](_0x9495('0x24'),_0xcbfbee['message'],_0x4c0369);_0x95e617(_0x3f67c1[_0x9495('0x17')](0x1f4,_0xcbfbee[_0x9495('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3cd849a..5b6854a 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 _0x5e97=['update','emit','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x4c356d,_0x421ada){var _0x163889=function(_0x38f7bf){while(--_0x38f7bf){_0x4c356d['push'](_0x4c356d['shift']());}};_0x163889(++_0x421ada);}(_0x5e97,0x155));var _0x75e9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5e97[_0x2dafbe];return _0x58a45a;};'use strict';var WhatsappAccountEvents=require(_0x75e9('0x0'));var events=[_0x75e9('0x1'),'remove',_0x75e9('0x2')];function createListener(_0x15946e,_0x51596f){return function(_0xa5dea0){_0x51596f[_0x75e9('0x3')](_0x15946e,_0xa5dea0);};}function removeListener(_0x2222a7,_0x32341a){return function(){WhatsappAccountEvents['removeListener'](_0x2222a7,_0x32341a);};}exports[_0x75e9('0x4')]=function(_0x45bc15){for(var _0x39574f=0x0,_0x366a14=events[_0x75e9('0x5')];_0x39574f<_0x366a14;_0x39574f++){var _0x41fdb2=events[_0x39574f];var _0x7072e7=createListener(_0x75e9('0x6')+_0x41fdb2,_0x45bc15);WhatsappAccountEvents['on'](_0x41fdb2,_0x7072e7);}}; \ No newline at end of file +var _0x14c2=['register','whatsappAccount:','./whatsappAccount.events','save','update'];(function(_0x1ad68c,_0x524f21){var _0x3e5985=function(_0x3348b1){while(--_0x3348b1){_0x1ad68c['push'](_0x1ad68c['shift']());}};_0x3e5985(++_0x524f21);}(_0x14c2,0x19c));var _0x214c=function(_0xbcf7c0,_0x37a6a3){_0xbcf7c0=_0xbcf7c0-0x0;var _0x367cc1=_0x14c2[_0xbcf7c0];return _0x367cc1;};'use strict';var WhatsappAccountEvents=require(_0x214c('0x0'));var events=[_0x214c('0x1'),'remove',_0x214c('0x2')];function createListener(_0x32af95,_0x4014f0){return function(_0xa04b71){_0x4014f0['emit'](_0x32af95,_0xa04b71);};}function removeListener(_0x62fbdc,_0x29adf0){return function(){WhatsappAccountEvents['removeListener'](_0x62fbdc,_0x29adf0);};}exports[_0x214c('0x3')]=function(_0x135c63){for(var _0x50bf14=0x0,_0x59af29=events['length'];_0x50bf14<_0x59af29;_0x50bf14++){var _0x4a48e4=events[_0x50bf14];var _0x5d3857=createListener(_0x214c('0x4')+_0x4a48e4,_0x135c63);WhatsappAccountEvents['on'](_0x4a48e4,_0x5d3857);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 237d0b0..6ad2df5 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 _0x99c7=['./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x70ebc,_0x268bac){var _0x5a195c=function(_0x1a6da8){while(--_0x1a6da8){_0x70ebc['push'](_0x70ebc['shift']());}};_0x5a195c(++_0x268bac);}(_0x99c7,0xc8));var _0x799c=function(_0x35fde0,_0x10ef93){_0x35fde0=_0x35fde0-0x0;var _0x5e321b=_0x99c7[_0x35fde0];return _0x5e321b;};'use strict';var multer=require(_0x799c('0x0'));var util=require(_0x799c('0x1'));var path=require(_0x799c('0x2'));var timeout=require(_0x799c('0x3'));var express=require(_0x799c('0x4'));var router=express[_0x799c('0x5')]();var fs_extra=require(_0x799c('0x6'));var auth=require(_0x799c('0x7'));var interaction=require(_0x799c('0x8'));var config=require(_0x799c('0x9'));var controller=require(_0x799c('0xa'));router[_0x799c('0xb')]('/',auth[_0x799c('0xc')](),controller[_0x799c('0xd')]);router[_0x799c('0xb')]('/:id',auth[_0x799c('0xc')](),controller[_0x799c('0xe')]);router[_0x799c('0xf')]('/',auth[_0x799c('0xc')](),controller[_0x799c('0x10')]);router[_0x799c('0x11')](_0x799c('0x12'),auth[_0x799c('0xc')](),controller[_0x799c('0x13')]);router['delete'](_0x799c('0x12'),auth[_0x799c('0xc')](),controller[_0x799c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8345=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x58993e,_0x1f4e74){var _0x4c2076=function(_0xcf5fe8){while(--_0xcf5fe8){_0x58993e['push'](_0x58993e['shift']());}};_0x4c2076(++_0x1f4e74);}(_0x8345,0x1d6));var _0x5834=function(_0x32e94b,_0x38c7a7){_0x32e94b=_0x32e94b-0x0;var _0x3b1567=_0x8345[_0x32e94b];return _0x3b1567;};'use strict';var multer=require(_0x5834('0x0'));var util=require(_0x5834('0x1'));var path=require(_0x5834('0x2'));var timeout=require(_0x5834('0x3'));var express=require(_0x5834('0x4'));var router=express[_0x5834('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5834('0x6'));var config=require(_0x5834('0x7'));var controller=require(_0x5834('0x8'));router[_0x5834('0x9')]('/',auth[_0x5834('0xa')](),controller[_0x5834('0xb')]);router[_0x5834('0x9')](_0x5834('0xc'),auth[_0x5834('0xa')](),controller[_0x5834('0xd')]);router[_0x5834('0xe')]('/',auth[_0x5834('0xa')](),controller[_0x5834('0xf')]);router[_0x5834('0x10')](_0x5834('0xc'),auth[_0x5834('0xa')](),controller[_0x5834('0x11')]);router[_0x5834('0x12')](_0x5834('0xc'),auth['isAuthenticated'](),controller[_0x5834('0x13')]);module[_0x5834('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 6f39b17..6b5f565 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 _0x60ae=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x6bf8f4,_0x203808){var _0x25b4f6=function(_0x58f1ca){while(--_0x58f1ca){_0x6bf8f4['push'](_0x6bf8f4['shift']());}};_0x25b4f6(++_0x203808);}(_0x60ae,0x83));var _0xe60a=function(_0x314397,_0x550526){_0x314397=_0x314397-0x0;var _0x1ec45e=_0x60ae[_0x314397];return _0x1ec45e;};'use strict';var Sequelize=require(_0xe60a('0x0'));module[_0xe60a('0x1')]={'priority':{'type':Sequelize[_0xe60a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe60a('0x3')],'allowNull':![],'defaultValue':_0xe60a('0x4')},'appdata':{'type':Sequelize[_0xe60a('0x5')]()},'description':{'type':Sequelize[_0xe60a('0x3')]},'interval':{'type':Sequelize[_0xe60a('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xcc7c=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x2a13b7,_0x5e20ec){var _0x377273=function(_0x269ac6){while(--_0x269ac6){_0x2a13b7['push'](_0x2a13b7['shift']());}};_0x377273(++_0x5e20ec);}(_0xcc7c,0x195));var _0xccc7=function(_0x2cf5fe,_0x1a2470){_0x2cf5fe=_0x2cf5fe-0x0;var _0x606aab=_0xcc7c[_0x2cf5fe];return _0x606aab;};'use strict';var Sequelize=require(_0xccc7('0x0'));module[_0xccc7('0x1')]={'priority':{'type':Sequelize[_0xccc7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xccc7('0x3')],'allowNull':![],'defaultValue':_0xccc7('0x4')},'appdata':{'type':Sequelize[_0xccc7('0x5')]()},'description':{'type':Sequelize[_0xccc7('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index fe66deb..21cdaf6 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 _0x677a=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','WhatsappApplication','includeAll','include','findAll','catch','params','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x5a8f7a,_0x553e68){var _0x4775ce=function(_0x11414f){while(--_0x11414f){_0x5a8f7a['push'](_0x5a8f7a['shift']());}};_0x4775ce(++_0x553e68);}(_0x677a,0xd6));var _0xa677=function(_0x42bdba,_0x42f841){_0x42bdba=_0x42bdba-0x0;var _0x11be7f=_0x677a[_0x42bdba];return _0x11be7f;};'use strict';var emlformat=require(_0xa677('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa677('0x1'));var jsonpatch=require(_0xa677('0x2'));var rp=require(_0xa677('0x3'));var moment=require(_0xa677('0x4'));var BPromise=require(_0xa677('0x5'));var Mustache=require('mustache');var util=require(_0xa677('0x6'));var path=require(_0xa677('0x7'));var sox=require(_0xa677('0x8'));var csv=require(_0xa677('0x9'));var ejs=require(_0xa677('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa677('0xb'));var squel=require(_0xa677('0xc'));var crypto=require(_0xa677('0xd'));var jsforce=require(_0xa677('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa677('0xf'));var Redis=require('ioredis');var authService=require(_0xa677('0x10'));var qs=require(_0xa677('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa677('0x12'));var logger=require(_0xa677('0x13'))(_0xa677('0x14'));var utils=require(_0xa677('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa677('0x16'));var db=require(_0xa677('0x17'))['db'];function respondWithStatusCode(_0xb1d2b6,_0x14cd10){_0x14cd10=_0x14cd10||0xcc;return function(_0x4f1ca4){if(_0x4f1ca4){return _0xb1d2b6[_0xa677('0x18')](_0x14cd10);}return _0xb1d2b6['status'](_0x14cd10)[_0xa677('0x19')]();};}function respondWithResult(_0x2e5b2a,_0x155021){_0x155021=_0x155021||0xc8;return function(_0x4c68b4){if(_0x4c68b4){return _0x2e5b2a[_0xa677('0x1a')](_0x155021)[_0xa677('0x1b')](_0x4c68b4);}};}function respondWithFilteredResult(_0x268fa5,_0x4ffe4c){return function(_0x1feb0e){if(_0x1feb0e){var _0x230363=typeof _0x4ffe4c[_0xa677('0x1c')]===_0xa677('0x1d')&&typeof _0x4ffe4c[_0xa677('0x1e')]===_0xa677('0x1d');var _0x5957cb=_0x1feb0e[_0xa677('0x1f')];var _0x5db4d2=_0x230363?0x0:_0x4ffe4c['offset'];var _0x4e6b3d=_0x230363?_0x1feb0e[_0xa677('0x1f')]:_0x4ffe4c[_0xa677('0x1c')]+_0x4ffe4c[_0xa677('0x1e')];var _0x30fbfd;if(_0x4e6b3d>=_0x5957cb){_0x4e6b3d=_0x5957cb;_0x30fbfd=0xc8;}else{_0x30fbfd=0xce;}_0x268fa5['status'](_0x30fbfd);return _0x268fa5[_0xa677('0x20')](_0xa677('0x21'),_0x5db4d2+'-'+_0x4e6b3d+'/'+_0x5957cb)[_0xa677('0x1b')](_0x1feb0e);}return null;};}function patchUpdates(_0x44de05){return function(_0x3ffc76){try{jsonpatch[_0xa677('0x22')](_0x3ffc76,_0x44de05,!![]);}catch(_0x5cbea0){return BPromise[_0xa677('0x23')](_0x5cbea0);}return _0x3ffc76['save']();};}function saveUpdates(_0x470e0a,_0x1c63e8){return function(_0x45eb0f){if(_0x45eb0f){return _0x45eb0f['update'](_0x470e0a)[_0xa677('0x24')](function(_0x31acd3){return _0x31acd3;});}return null;};}function removeEntity(_0x395d33,_0x1c59e4){return function(_0x4e8e9e){if(_0x4e8e9e){return _0x4e8e9e[_0xa677('0x25')]()[_0xa677('0x24')](function(){_0x395d33['status'](0xcc)[_0xa677('0x19')]();});}};}function handleEntityNotFound(_0xe54876,_0x40cb21){return function(_0x3bb824){if(!_0x3bb824){_0xe54876[_0xa677('0x18')](0x194);}return _0x3bb824;};}function handleError(_0x3fcb1e,_0x54d892){_0x54d892=_0x54d892||0x1f4;return function(_0x34dee4){logger[_0xa677('0x26')](_0x34dee4[_0xa677('0x27')]);if(_0x34dee4[_0xa677('0x28')]){delete _0x34dee4[_0xa677('0x28')];}_0x3fcb1e[_0xa677('0x1a')](_0x54d892)['send'](_0x34dee4);};}exports[_0xa677('0x29')]=function(_0x124d7f,_0x4606f2){var _0x592718={},_0x2d1e6b={},_0x32c1b8={'count':0x0,'rows':[]};var _0x141767=_[_0xa677('0x2a')](db['WhatsappApplication'][_0xa677('0x2b')],function(_0x1f7811){return{'name':_0x1f7811[_0xa677('0x2c')],'type':_0x1f7811['type'][_0xa677('0x2d')]};});_0x2d1e6b[_0xa677('0x2e')]=_[_0xa677('0x2a')](_0x141767,_0xa677('0x28'));_0x2d1e6b[_0xa677('0x2f')]=_[_0xa677('0x30')](_0x124d7f[_0xa677('0x2f')]);_0x2d1e6b[_0xa677('0x31')]=_['intersection'](_0x2d1e6b[_0xa677('0x2e')],_0x2d1e6b['query']);_0x592718[_0xa677('0x32')]=_[_0xa677('0x33')](_0x2d1e6b[_0xa677('0x2e')],qs[_0xa677('0x34')](_0x124d7f[_0xa677('0x2f')][_0xa677('0x34')]));_0x592718[_0xa677('0x32')]=_0x592718[_0xa677('0x32')][_0xa677('0x35')]?_0x592718['attributes']:_0x2d1e6b[_0xa677('0x2e')];if(!_0x124d7f['query'][_0xa677('0x36')](_0xa677('0x37'))){_0x592718[_0xa677('0x1e')]=qs[_0xa677('0x1e')](_0x124d7f['query'][_0xa677('0x1e')]);_0x592718[_0xa677('0x1c')]=qs[_0xa677('0x1c')](_0x124d7f['query']['offset']);}_0x592718[_0xa677('0x38')]=qs[_0xa677('0x39')](_0x124d7f[_0xa677('0x2f')]['sort']);_0x592718['where']=qs[_0xa677('0x31')](_[_0xa677('0x3a')](_0x124d7f[_0xa677('0x2f')],_0x2d1e6b[_0xa677('0x31')]),_0x141767);if(_0x124d7f['query'][_0xa677('0x3b')]){_0x592718[_0xa677('0x3c')]=_['merge'](_0x592718['where'],{'$or':_[_0xa677('0x2a')](_0x141767,function(_0x2a98b5){if(_0x2a98b5['type']!==_0xa677('0x3d')){var _0x56b4e9={};_0x56b4e9[_0x2a98b5[_0xa677('0x28')]]={'$like':'%'+_0x124d7f[_0xa677('0x2f')]['filter']+'%'};return _0x56b4e9;}})});}_0x592718=_[_0xa677('0x3e')]({},_0x592718,_0x124d7f[_0xa677('0x3f')]);var _0x23ae91={'where':_0x592718[_0xa677('0x3c')]};return db[_0xa677('0x40')][_0xa677('0x1f')](_0x23ae91)[_0xa677('0x24')](function(_0x240c7b){_0x32c1b8[_0xa677('0x1f')]=_0x240c7b;if(_0x124d7f['query'][_0xa677('0x41')]){_0x592718[_0xa677('0x42')]=[{'all':!![]}];}return db[_0xa677('0x40')][_0xa677('0x43')](_0x592718);})['then'](function(_0x5ef1b8){_0x32c1b8['rows']=_0x5ef1b8;return _0x32c1b8;})[_0xa677('0x24')](respondWithFilteredResult(_0x4606f2,_0x592718))[_0xa677('0x44')](handleError(_0x4606f2,null));};exports['show']=function(_0x3052f7,_0x2bcb96){var _0x29ab9c={'raw':!![],'where':{'id':_0x3052f7[_0xa677('0x45')]['id']}},_0x592626={};_0x592626[_0xa677('0x2e')]=_[_0xa677('0x30')](db[_0xa677('0x40')][_0xa677('0x2b')]);_0x592626[_0xa677('0x2f')]=_[_0xa677('0x30')](_0x3052f7[_0xa677('0x2f')]);_0x592626[_0xa677('0x31')]=_[_0xa677('0x33')](_0x592626[_0xa677('0x2e')],_0x592626[_0xa677('0x2f')]);_0x29ab9c[_0xa677('0x32')]=_['intersection'](_0x592626['model'],qs[_0xa677('0x34')](_0x3052f7[_0xa677('0x2f')][_0xa677('0x34')]));_0x29ab9c[_0xa677('0x32')]=_0x29ab9c[_0xa677('0x32')][_0xa677('0x35')]?_0x29ab9c[_0xa677('0x32')]:_0x592626['model'];if(_0x3052f7[_0xa677('0x2f')]['includeAll']){_0x29ab9c[_0xa677('0x42')]=[{'all':!![]}];}_0x29ab9c=_[_0xa677('0x3e')]({},_0x29ab9c,_0x3052f7[_0xa677('0x3f')]);return db[_0xa677('0x40')][_0xa677('0x46')](_0x29ab9c)[_0xa677('0x24')](handleEntityNotFound(_0x2bcb96,null))[_0xa677('0x24')](respondWithResult(_0x2bcb96,null))[_0xa677('0x44')](handleError(_0x2bcb96,null));};exports[_0xa677('0x47')]=function(_0x16a934,_0x59a882){return db['WhatsappApplication'][_0xa677('0x47')](_0x16a934[_0xa677('0x48')],{})[_0xa677('0x24')](respondWithResult(_0x59a882,0xc9))[_0xa677('0x44')](handleError(_0x59a882,null));};exports[_0xa677('0x49')]=function(_0x39cbb1,_0x50d1f6){if(_0x39cbb1[_0xa677('0x48')]['id']){delete _0x39cbb1['body']['id'];}return db[_0xa677('0x40')][_0xa677('0x46')]({'where':{'id':_0x39cbb1['params']['id']}})['then'](handleEntityNotFound(_0x50d1f6,null))[_0xa677('0x24')](saveUpdates(_0x39cbb1[_0xa677('0x48')],null))['then'](respondWithResult(_0x50d1f6,null))[_0xa677('0x44')](handleError(_0x50d1f6,null));};exports[_0xa677('0x25')]=function(_0x282b62,_0xe5d6b2){return db[_0xa677('0x40')][_0xa677('0x46')]({'where':{'id':_0x282b62[_0xa677('0x45')]['id']}})[_0xa677('0x24')](handleEntityNotFound(_0xe5d6b2,null))[_0xa677('0x24')](removeEntity(_0xe5d6b2,null))[_0xa677('0x44')](handleError(_0xe5d6b2,null));}; \ No newline at end of file +var _0xdf5d=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','WhatsappApplication','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3255cd,_0xe018c7){var _0x4960c5=function(_0x94d88e){while(--_0x94d88e){_0x3255cd['push'](_0x3255cd['shift']());}};_0x4960c5(++_0xe018c7);}(_0xdf5d,0x126));var _0xddf5=function(_0x13b288,_0x812c83){_0x13b288=_0x13b288-0x0;var _0x3e1305=_0xdf5d[_0x13b288];return _0x3e1305;};'use strict';var emlformat=require(_0xddf5('0x0'));var rimraf=require(_0xddf5('0x1'));var zipdir=require(_0xddf5('0x2'));var jsonpatch=require(_0xddf5('0x3'));var rp=require(_0xddf5('0x4'));var moment=require(_0xddf5('0x5'));var BPromise=require(_0xddf5('0x6'));var Mustache=require(_0xddf5('0x7'));var util=require('util');var path=require(_0xddf5('0x8'));var sox=require(_0xddf5('0x9'));var csv=require(_0xddf5('0xa'));var ejs=require(_0xddf5('0xb'));var fs=require('fs');var fs_extra=require(_0xddf5('0xc'));var _=require(_0xddf5('0xd'));var squel=require(_0xddf5('0xe'));var crypto=require(_0xddf5('0xf'));var jsforce=require(_0xddf5('0x10'));var deskjs=require(_0xddf5('0x11'));var toCsv=require(_0xddf5('0xa'));var querystring=require(_0xddf5('0x12'));var Papa=require(_0xddf5('0x13'));var Redis=require(_0xddf5('0x14'));var authService=require(_0xddf5('0x15'));var qs=require(_0xddf5('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddf5('0x17'));var logger=require(_0xddf5('0x18'))(_0xddf5('0x19'));var utils=require(_0xddf5('0x1a'));var config=require(_0xddf5('0x1b'));var licenseUtil=require(_0xddf5('0x1c'));var db=require(_0xddf5('0x1d'))['db'];function respondWithStatusCode(_0x3779e4,_0x5607a2){_0x5607a2=_0x5607a2||0xcc;return function(_0x530521){if(_0x530521){return _0x3779e4[_0xddf5('0x1e')](_0x5607a2);}return _0x3779e4[_0xddf5('0x1f')](_0x5607a2)[_0xddf5('0x20')]();};}function respondWithResult(_0x3df24c,_0x6e876a){_0x6e876a=_0x6e876a||0xc8;return function(_0x149fef){if(_0x149fef){return _0x3df24c[_0xddf5('0x1f')](_0x6e876a)[_0xddf5('0x21')](_0x149fef);}};}function respondWithFilteredResult(_0x49cdfc,_0xe3e3e8){return function(_0x2b2dad){if(_0x2b2dad){var _0x3dd408=typeof _0xe3e3e8[_0xddf5('0x22')]===_0xddf5('0x23')&&typeof _0xe3e3e8['limit']===_0xddf5('0x23');var _0x53afba=_0x2b2dad[_0xddf5('0x24')];var _0x50c1ed=_0x3dd408?0x0:_0xe3e3e8[_0xddf5('0x22')];var _0x3d61df=_0x3dd408?_0x2b2dad[_0xddf5('0x24')]:_0xe3e3e8[_0xddf5('0x22')]+_0xe3e3e8['limit'];var _0x5429c8;if(_0x3d61df>=_0x53afba){_0x3d61df=_0x53afba;_0x5429c8=0xc8;}else{_0x5429c8=0xce;}_0x49cdfc[_0xddf5('0x1f')](_0x5429c8);return _0x49cdfc[_0xddf5('0x25')](_0xddf5('0x26'),_0x50c1ed+'-'+_0x3d61df+'/'+_0x53afba)[_0xddf5('0x21')](_0x2b2dad);}return null;};}function patchUpdates(_0x5e5537){return function(_0x52ecdb){try{jsonpatch[_0xddf5('0x27')](_0x52ecdb,_0x5e5537,!![]);}catch(_0x146e67){return BPromise[_0xddf5('0x28')](_0x146e67);}return _0x52ecdb['save']();};}function saveUpdates(_0x23aa35,_0x39212c){return function(_0x21c68b){if(_0x21c68b){return _0x21c68b[_0xddf5('0x29')](_0x23aa35)['then'](function(_0x2539f9){return _0x2539f9;});}return null;};}function removeEntity(_0x338a80,_0x496e16){return function(_0x300923){if(_0x300923){return _0x300923[_0xddf5('0x2a')]()[_0xddf5('0x2b')](function(){_0x338a80[_0xddf5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497382,_0xc75eb8){return function(_0x256ff0){if(!_0x256ff0){_0x497382[_0xddf5('0x1e')](0x194);}return _0x256ff0;};}function handleError(_0x99fd62,_0x4caa12){_0x4caa12=_0x4caa12||0x1f4;return function(_0x2caa8f){logger[_0xddf5('0x2c')](_0x2caa8f['stack']);if(_0x2caa8f['name']){delete _0x2caa8f[_0xddf5('0x2d')];}_0x99fd62[_0xddf5('0x1f')](_0x4caa12)[_0xddf5('0x2e')](_0x2caa8f);};}exports[_0xddf5('0x2f')]=function(_0x3be6f4,_0x1a476d){var _0x5a3548={},_0x26f43c={},_0x228073={'count':0x0,'rows':[]};var _0x5292c7=_[_0xddf5('0x30')](db[_0xddf5('0x31')][_0xddf5('0x32')],function(_0x5eb7dd){return{'name':_0x5eb7dd['fieldName'],'type':_0x5eb7dd['type'][_0xddf5('0x33')]};});_0x26f43c[_0xddf5('0x34')]=_[_0xddf5('0x30')](_0x5292c7,'name');_0x26f43c[_0xddf5('0x35')]=_['keys'](_0x3be6f4['query']);_0x26f43c['filters']=_[_0xddf5('0x36')](_0x26f43c[_0xddf5('0x34')],_0x26f43c[_0xddf5('0x35')]);_0x5a3548[_0xddf5('0x37')]=_[_0xddf5('0x36')](_0x26f43c['model'],qs[_0xddf5('0x38')](_0x3be6f4['query'][_0xddf5('0x38')]));_0x5a3548[_0xddf5('0x37')]=_0x5a3548['attributes'][_0xddf5('0x39')]?_0x5a3548[_0xddf5('0x37')]:_0x26f43c[_0xddf5('0x34')];if(!_0x3be6f4[_0xddf5('0x35')][_0xddf5('0x3a')]('nolimit')){_0x5a3548[_0xddf5('0x3b')]=qs['limit'](_0x3be6f4[_0xddf5('0x35')][_0xddf5('0x3b')]);_0x5a3548['offset']=qs[_0xddf5('0x22')](_0x3be6f4['query'][_0xddf5('0x22')]);}_0x5a3548['order']=qs['sort'](_0x3be6f4[_0xddf5('0x35')]['sort']);_0x5a3548[_0xddf5('0x3c')]=qs[_0xddf5('0x3d')](_[_0xddf5('0x3e')](_0x3be6f4[_0xddf5('0x35')],_0x26f43c[_0xddf5('0x3d')]),_0x5292c7);if(_0x3be6f4[_0xddf5('0x35')][_0xddf5('0x3f')]){_0x5a3548[_0xddf5('0x3c')]=_[_0xddf5('0x40')](_0x5a3548[_0xddf5('0x3c')],{'$or':_[_0xddf5('0x30')](_0x5292c7,function(_0x3cb25a){if(_0x3cb25a[_0xddf5('0x41')]!==_0xddf5('0x42')){var _0x485b67={};_0x485b67[_0x3cb25a[_0xddf5('0x2d')]]={'$like':'%'+_0x3be6f4[_0xddf5('0x35')][_0xddf5('0x3f')]+'%'};return _0x485b67;}})});}_0x5a3548=_['merge']({},_0x5a3548,_0x3be6f4[_0xddf5('0x43')]);var _0x25e6b9={'where':_0x5a3548[_0xddf5('0x3c')]};return db[_0xddf5('0x31')][_0xddf5('0x24')](_0x25e6b9)['then'](function(_0x529ee1){_0x228073['count']=_0x529ee1;if(_0x3be6f4[_0xddf5('0x35')]['includeAll']){_0x5a3548['include']=[{'all':!![]}];}return db[_0xddf5('0x31')][_0xddf5('0x44')](_0x5a3548);})[_0xddf5('0x2b')](function(_0x309211){_0x228073[_0xddf5('0x45')]=_0x309211;return _0x228073;})[_0xddf5('0x2b')](respondWithFilteredResult(_0x1a476d,_0x5a3548))[_0xddf5('0x46')](handleError(_0x1a476d,null));};exports[_0xddf5('0x47')]=function(_0x490a14,_0xd5c63d){var _0x5b4817={'raw':!![],'where':{'id':_0x490a14[_0xddf5('0x48')]['id']}},_0x5654c2={};_0x5654c2[_0xddf5('0x34')]=_['keys'](db['WhatsappApplication'][_0xddf5('0x32')]);_0x5654c2[_0xddf5('0x35')]=_[_0xddf5('0x49')](_0x490a14[_0xddf5('0x35')]);_0x5654c2['filters']=_['intersection'](_0x5654c2[_0xddf5('0x34')],_0x5654c2[_0xddf5('0x35')]);_0x5b4817['attributes']=_[_0xddf5('0x36')](_0x5654c2[_0xddf5('0x34')],qs['fields'](_0x490a14[_0xddf5('0x35')]['fields']));_0x5b4817[_0xddf5('0x37')]=_0x5b4817[_0xddf5('0x37')][_0xddf5('0x39')]?_0x5b4817['attributes']:_0x5654c2[_0xddf5('0x34')];if(_0x490a14[_0xddf5('0x35')][_0xddf5('0x4a')]){_0x5b4817[_0xddf5('0x4b')]=[{'all':!![]}];}_0x5b4817=_[_0xddf5('0x40')]({},_0x5b4817,_0x490a14[_0xddf5('0x43')]);return db['WhatsappApplication'][_0xddf5('0x4c')](_0x5b4817)[_0xddf5('0x2b')](handleEntityNotFound(_0xd5c63d,null))[_0xddf5('0x2b')](respondWithResult(_0xd5c63d,null))[_0xddf5('0x46')](handleError(_0xd5c63d,null));};exports['create']=function(_0x22f8ff,_0x2b6c51){return db[_0xddf5('0x31')][_0xddf5('0x4d')](_0x22f8ff['body'],{})[_0xddf5('0x2b')](respondWithResult(_0x2b6c51,0xc9))[_0xddf5('0x46')](handleError(_0x2b6c51,null));};exports['update']=function(_0x2ea645,_0x597f15){if(_0x2ea645[_0xddf5('0x4e')]['id']){delete _0x2ea645[_0xddf5('0x4e')]['id'];}return db[_0xddf5('0x31')][_0xddf5('0x4c')]({'where':{'id':_0x2ea645['params']['id']}})[_0xddf5('0x2b')](handleEntityNotFound(_0x597f15,null))[_0xddf5('0x2b')](saveUpdates(_0x2ea645['body'],null))[_0xddf5('0x2b')](respondWithResult(_0x597f15,null))['catch'](handleError(_0x597f15,null));};exports['destroy']=function(_0x9fbad6,_0x37e0c3){return db[_0xddf5('0x31')][_0xddf5('0x4c')]({'where':{'id':_0x9fbad6[_0xddf5('0x48')]['id']}})[_0xddf5('0x2b')](handleEntityNotFound(_0x37e0c3,null))['then'](removeEntity(_0x37e0c3,null))[_0xddf5('0x46')](handleError(_0x37e0c3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 32b2188..3e506a5 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 _0xdb94=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications'];(function(_0x429ff3,_0x47b6e8){var _0x4fe775=function(_0x15ba6e){while(--_0x15ba6e){_0x429ff3['push'](_0x429ff3['shift']());}};_0x4fe775(++_0x47b6e8);}(_0xdb94,0xe5));var _0x4db9=function(_0x2255e9,_0x59129d){_0x2255e9=_0x2255e9-0x0;var _0x297b6a=_0xdb94[_0x2255e9];return _0x297b6a;};'use strict';var _=require('lodash');var util=require(_0x4db9('0x0'));var logger=require(_0x4db9('0x1'))('api');var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var fs=require('fs');var path=require(_0x4db9('0x5'));var rimraf=require(_0x4db9('0x6'));var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x1d21a8,_0xc76bc1){return _0x1d21a8[_0x4db9('0x8')](_0x4db9('0x9'),attributes,{'tableName':_0x4db9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4db9('0xb')});}; \ No newline at end of file +var _0x294b=['exports','define','whatsapp_applications','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes'];(function(_0x5b4f09,_0x7c3ee8){var _0x5c5425=function(_0x15b4ee){while(--_0x15b4ee){_0x5b4f09['push'](_0x5b4f09['shift']());}};_0x5c5425(++_0x7c3ee8);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require('util');var logger=require(_0xb294('0x1'))(_0xb294('0x2'));var moment=require(_0xb294('0x3'));var BPromise=require(_0xb294('0x4'));var rp=require(_0xb294('0x5'));var fs=require('fs');var path=require(_0xb294('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb294('0x7'));module[_0xb294('0x8')]=function(_0xaa6a67,_0x181f5e){return _0xaa6a67[_0xb294('0x9')]('WhatsappApplication',attributes,{'tableName':_0xb294('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7913438..7853633 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 _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x5605f3,_0x45a175){var _0x6a5837=function(_0x323b62){while(--_0x323b62){_0x5605f3['push'](_0x5605f3['shift']());}};_0x6a5837(++_0x45a175);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3281b3,_0xaa6ceb){_0x3281b3=_0x3281b3-0x0;var _0xfa0bec=_0x6f0d[_0x3281b3];return _0xfa0bec;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0xb903=['http','request','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1eae1d,_0x4837d1){var _0x168cd5=function(_0x504e20){while(--_0x504e20){_0x1eae1d['push'](_0x1eae1d['shift']());}};_0x168cd5(++_0x4837d1);}(_0xb903,0x185));var _0x3b90=function(_0xe8ff51,_0x480407){_0xe8ff51=_0xe8ff51-0x0;var _0x7c1fc=_0xb903[_0xe8ff51];return _0x7c1fc;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index b134a98..560dc3c 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 _0x5fc3=['whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x1f42f4,_0x378821){var _0x316529=function(_0x5717c1){while(--_0x5717c1){_0x1f42f4['push'](_0x1f42f4['shift']());}};_0x316529(++_0x378821);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x5fc3[_0xd816e2];return _0x1f5924;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/messages',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['download']);router[_0x35fc('0x10')]('/',auth[_0x35fc('0xa')](),controller['create']);router['post'](_0x35fc('0x11'),auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x10')](_0x35fc('0x13'),auth[_0x35fc('0xa')](),interaction[_0x35fc('0x14')]('whatsapp','whatsappinteraction:addtags'),controller['addTags']);router['put'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),interaction[_0x35fc('0x14')](_0x35fc('0x15'),_0x35fc('0x16')),controller[_0x35fc('0x17')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),interaction['tracked'](_0x35fc('0x15'),_0x35fc('0x18')),controller[_0x35fc('0x19')]);router['delete'](_0x35fc('0x13'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xee3c=['index','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','whatsapp','whatsappinteraction:addtags','tracked','whatsappinteraction:update','update','destroy','delete','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xee3c,0x14a));var _0xcee3=function(_0x3154bf,_0x5577bb){_0x3154bf=_0x3154bf-0x0;var _0x41e6e5=_0xee3c[_0x3154bf];return _0x41e6e5;};'use strict';var multer=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var path=require(_0xcee3('0x2'));var timeout=require(_0xcee3('0x3'));var express=require(_0xcee3('0x4'));var router=express[_0xcee3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var controller=require(_0xcee3('0x8'));router[_0xcee3('0x9')]('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0xb')]);router[_0xcee3('0x9')](_0xcee3('0xc'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xd')]);router[_0xcee3('0x9')](_0xcee3('0xe'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xf')]);router[_0xcee3('0x9')]('/:id/messages',auth[_0xcee3('0xa')](),controller[_0xcee3('0x10')]);router[_0xcee3('0x9')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x12')]);router['post']('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0x13')]);router[_0xcee3('0x14')](_0xcee3('0x15'),auth[_0xcee3('0xa')](),controller['addMessage']);router[_0xcee3('0x14')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xcee3('0x16'),_0xcee3('0x17')),controller['addTags']);router['put'](_0xcee3('0xe'),auth['isAuthenticated'](),interaction[_0xcee3('0x18')]('whatsapp',_0xcee3('0x19')),controller[_0xcee3('0x1a')]);router['delete'](_0xcee3('0xe'),auth[_0xcee3('0xa')](),interaction[_0xcee3('0x18')](_0xcee3('0x16'),'whatsappinteraction:destroy'),controller[_0xcee3('0x1b')]);router[_0xcee3('0x1c')](_0xcee3('0x1d'),auth[_0xcee3('0xa')](),controller['removeTags']);module[_0xcee3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 96c30d3..ca6e8b9 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 _0x1681=['exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1168('0x0')]={'closed':{'type':Sequelize[_0x1168('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1168('0x2')]},'disposition':{'type':Sequelize[_0x1168('0x3')]},'secondDisposition':{'type':Sequelize[_0x1168('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1168('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1168('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1168('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1168('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1168('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1168('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb1fa=['ENUM','BOOLEAN','INTEGER','exports','DATE'];(function(_0x385ed5,_0x449f76){var _0x27f199=function(_0x47d08f){while(--_0x47d08f){_0x385ed5['push'](_0x385ed5['shift']());}};_0x27f199(++_0x449f76);}(_0xb1fa,0x9e));var _0xab1f=function(_0x2162b8,_0x5f0322){_0x2162b8=_0x2162b8-0x0;var _0x306d2f=_0xb1fa[_0x2162b8];return _0x306d2f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xab1f('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab1f('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xab1f('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xab1f('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xab1f('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xab1f('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 09b383f..9c3cd34 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 _0x6a6e=['update','then','error','stack','name','send','index','WhatsappInteraction','rawAttributes','type','key','findAll','query','user','show','params','model','keys','intersection','attributes','fields','include','merge','options','find','catch','create','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','filters','length','nolimit','order','pick','WhatsappInteractionId','filter','where','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','server','files','format','transcript-%d-%s.zip','User','push','CmContact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','read','Owner','fullname','get','Whatsapp','Account','N.A.','closed','closedAt','disposition','Messages','basename','createReadStream','pipe','createWriteStream','out','System','Contact','renderFile','root','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x6a6e,0xe3));var _0xe6a6=function(_0x44540d,_0x361ed2){_0x44540d=_0x44540d-0x0;var _0x3cb1e3=_0x6a6e[_0x44540d];return _0x3cb1e3;};'use strict';var rimraf=require(_0xe6a6('0x0'));var zipdir=require(_0xe6a6('0x1'));var moment=require('moment');var BPromise=require(_0xe6a6('0x2'));var util=require(_0xe6a6('0x3'));var path=require(_0xe6a6('0x4'));var ejs=require(_0xe6a6('0x5'));var fs=require('fs');var _=require(_0xe6a6('0x6'));var Redis=require(_0xe6a6('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xe6a6('0x8'));var logger=require(_0xe6a6('0x9'))(_0xe6a6('0xa'));var config=require(_0xe6a6('0xb'));var db=require(_0xe6a6('0xc'))['db'];config[_0xe6a6('0xd')]=_[_0xe6a6('0xe')](config[_0xe6a6('0xd')],{'host':_0xe6a6('0xf'),'port':0x18eb});var socket=require(_0xe6a6('0x10'))(new Redis(config[_0xe6a6('0xd')]));require(_0xe6a6('0x11'))[_0xe6a6('0x12')](socket);function respondWithStatusCode(_0x5594e3,_0x40c667){_0x40c667=_0x40c667||0xcc;return function(_0x20448a){if(_0x20448a){return _0x5594e3[_0xe6a6('0x13')](_0x40c667);}return _0x5594e3[_0xe6a6('0x14')](_0x40c667)[_0xe6a6('0x15')]();};}function respondWithResult(_0x1459a3,_0x44cbb6){_0x44cbb6=_0x44cbb6||0xc8;return function(_0x22dda5){if(_0x22dda5){return _0x1459a3[_0xe6a6('0x14')](_0x44cbb6)[_0xe6a6('0x16')](_0x22dda5);}};}function respondWithFilteredResult(_0x4d7adf,_0x3173b9){return function(_0x301501){if(_0x301501){var _0x4379fc=typeof _0x3173b9[_0xe6a6('0x17')]===_0xe6a6('0x18')&&typeof _0x3173b9['limit']==='undefined';var _0x11e531=_0x301501[_0xe6a6('0x19')];var _0x44c86b=_0x4379fc?0x0:_0x3173b9[_0xe6a6('0x17')];var _0x537aee=_0x4379fc?_0x301501['count']:_0x3173b9[_0xe6a6('0x17')]+_0x3173b9[_0xe6a6('0x1a')];var _0x39c473;if(_0x537aee>=_0x11e531){_0x537aee=_0x11e531;_0x39c473=0xc8;}else{_0x39c473=0xce;}_0x4d7adf['status'](_0x39c473);return _0x4d7adf[_0xe6a6('0x1b')](_0xe6a6('0x1c'),_0x44c86b+'-'+_0x537aee+'/'+_0x11e531)[_0xe6a6('0x16')](_0x301501);}return null;};}function saveUpdates(_0x121e42){return function(_0x4f358a){if(_0x4f358a){return _0x4f358a[_0xe6a6('0x1d')](_0x121e42)['then'](function(_0x384de8){return _0x384de8;});}return null;};}function removeEntity(_0x572427){return function(_0x11e4e8){if(_0x11e4e8){return _0x11e4e8['destroy']()[_0xe6a6('0x1e')](function(){_0x572427[_0xe6a6('0x14')](0xcc)[_0xe6a6('0x15')]();});}};}function handleEntityNotFound(_0x37e788){return function(_0x1c5cb0){if(!_0x1c5cb0){_0x37e788['sendStatus'](0x194);}return _0x1c5cb0;};}function handleError(_0x5e653f,_0x12f755){_0x12f755=_0x12f755||0x1f4;return function(_0x21b019){logger[_0xe6a6('0x1f')](_0x21b019[_0xe6a6('0x20')]);if(_0x21b019[_0xe6a6('0x21')]){delete _0x21b019['name'];}_0x5e653f[_0xe6a6('0x14')](_0x12f755)[_0xe6a6('0x22')](_0x21b019);};}exports[_0xe6a6('0x23')]=function(_0x2ce74c,_0x15f2e3){var _0x1db065={};var _0x5c2996=_['map'](db[_0xe6a6('0x24')][_0xe6a6('0x25')],function(_0x18b917){return{'name':_0x18b917['fieldName'],'type':_0x18b917[_0xe6a6('0x26')][_0xe6a6('0x27')]};});_0x1db065=qs['getOptions'](_0x5c2996,_0x2ce74c);return interaction[_0xe6a6('0x28')]('whatsapp',_0x2ce74c[_0xe6a6('0x29')],_0x2ce74c[_0xe6a6('0x2a')],_0x1db065,_0x5c2996)[_0xe6a6('0x1e')](respondWithFilteredResult(_0x15f2e3,_0x1db065))['catch'](handleError(_0x15f2e3,null));};exports[_0xe6a6('0x2b')]=function(_0x2ce97b,_0x5c1130){var _0x1c6da7={'raw':![],'where':{'id':_0x2ce97b[_0xe6a6('0x2c')]['id']}},_0x559cd8={};_0x559cd8[_0xe6a6('0x2d')]=_[_0xe6a6('0x2e')](db[_0xe6a6('0x24')][_0xe6a6('0x25')]);_0x559cd8[_0xe6a6('0x29')]=_['keys'](_0x2ce97b[_0xe6a6('0x29')]);_0x559cd8['filters']=_[_0xe6a6('0x2f')](_0x559cd8[_0xe6a6('0x2d')],_0x559cd8[_0xe6a6('0x29')]);_0x1c6da7[_0xe6a6('0x30')]=_[_0xe6a6('0x2f')](_0x559cd8['model'],qs[_0xe6a6('0x31')](_0x2ce97b[_0xe6a6('0x29')][_0xe6a6('0x31')]));_0x1c6da7[_0xe6a6('0x30')]=_0x1c6da7['attributes']['length']?_0x1c6da7[_0xe6a6('0x30')]:_0x559cd8[_0xe6a6('0x2d')];if(_0x2ce97b[_0xe6a6('0x29')]['includeAll']){_0x1c6da7[_0xe6a6('0x32')]=[{'all':!![]}];}_0x1c6da7=_[_0xe6a6('0x33')]({},_0x1c6da7,_0x2ce97b[_0xe6a6('0x34')]);return db['WhatsappInteraction'][_0xe6a6('0x35')](_0x1c6da7)[_0xe6a6('0x1e')](handleEntityNotFound(_0x5c1130,null))[_0xe6a6('0x1e')](respondWithResult(_0x5c1130,null))[_0xe6a6('0x36')](handleError(_0x5c1130,null));};exports['create']=function(_0x1a1c66,_0x5cc726){return db[_0xe6a6('0x24')][_0xe6a6('0x37')](_0x1a1c66[_0xe6a6('0x38')],{})[_0xe6a6('0x1e')](respondWithResult(_0x5cc726,0xc9))[_0xe6a6('0x36')](handleError(_0x5cc726,null));};exports[_0xe6a6('0x1d')]=function(_0xfbc52d,_0x9cd09a){if(_0xfbc52d[_0xe6a6('0x38')]['id']){delete _0xfbc52d['body']['id'];}return db[_0xe6a6('0x24')]['find']({'where':{'id':_0xfbc52d[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x9cd09a,null))[_0xe6a6('0x1e')](saveUpdates(_0xfbc52d[_0xe6a6('0x38')],null))['then'](respondWithResult(_0x9cd09a,null))[_0xe6a6('0x36')](handleError(_0x9cd09a,null));};exports['destroy']=function(_0x3ba239,_0x454abc){return db['WhatsappInteraction'][_0xe6a6('0x35')]({'where':{'id':_0x3ba239[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x454abc,null))['then'](removeEntity(_0x454abc,null))[_0xe6a6('0x36')](handleError(_0x454abc,null));};exports['describe']=function(_0x14292a,_0x35c183){return db[_0xe6a6('0x24')][_0xe6a6('0x39')]()[_0xe6a6('0x1e')](respondWithResult(_0x35c183,null))[_0xe6a6('0x36')](handleError(_0x35c183,null));};exports[_0xe6a6('0x3a')]=function(_0x33adde,_0x50ed89){return db['WhatsappMessage'][_0xe6a6('0x35')]({'where':{'id':_0x33adde['params']['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x50ed89,null))[_0xe6a6('0x1e')](function(_0x291763){if(_0x291763){return _0x291763[_0xe6a6('0x3a')](_0x33adde[_0xe6a6('0x38')][_0xe6a6('0x3b')],_[_0xe6a6('0x3c')](_0x33adde[_0xe6a6('0x38')],[_0xe6a6('0x3b'),'id'])||{});}})[_0xe6a6('0x1e')](respondWithResult(_0x50ed89,null))['catch'](handleError(_0x50ed89,null));};exports[_0xe6a6('0x3d')]=function(_0xd8edcc,_0x58166e){var _0x5e586e={'raw':![],'where':{}};var _0x251678={};var _0x43feaa={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe6a6('0x3e')]({'where':{'id':_0xd8edcc[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x58166e,null))['then'](function(_0x5e7403){if(_0x5e7403){_0x251678[_0xe6a6('0x2d')]=_[_0xe6a6('0x2e')](db[_0xe6a6('0x3f')][_0xe6a6('0x25')]);_0x251678[_0xe6a6('0x29')]=_[_0xe6a6('0x2e')](_0xd8edcc[_0xe6a6('0x29')]);_0x251678[_0xe6a6('0x40')]=_[_0xe6a6('0x2f')](_0x251678[_0xe6a6('0x2d')],_0x251678[_0xe6a6('0x29')]);_0x5e586e[_0xe6a6('0x30')]=_['intersection'](_0x251678[_0xe6a6('0x2d')],qs[_0xe6a6('0x31')](_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x31')]));_0x5e586e[_0xe6a6('0x30')]=_0x5e586e[_0xe6a6('0x30')][_0xe6a6('0x41')]?_0x5e586e['attributes']:_0x251678[_0xe6a6('0x2d')];if(!_0xd8edcc[_0xe6a6('0x29')]['hasOwnProperty'](_0xe6a6('0x42'))){_0x5e586e[_0xe6a6('0x1a')]=qs[_0xe6a6('0x1a')](_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x1a')]);_0x5e586e[_0xe6a6('0x17')]=qs[_0xe6a6('0x17')](_0xd8edcc[_0xe6a6('0x29')]['offset']);}_0x5e586e[_0xe6a6('0x43')]=qs['sort'](_0xd8edcc[_0xe6a6('0x29')]['sort']);_0x5e586e['where']=qs[_0xe6a6('0x40')](_[_0xe6a6('0x44')](_0xd8edcc[_0xe6a6('0x29')],_0x251678[_0xe6a6('0x40')]));_0x5e586e['where'][_0xe6a6('0x45')]=_0x5e7403['id'];if(_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x46')]){_0x5e586e[_0xe6a6('0x47')]=_[_0xe6a6('0x33')](_0x5e586e[_0xe6a6('0x47')],{'$or':_[_0xe6a6('0x48')](_0x5e586e['attributes'],function(_0xb171ff){var _0x27847e={};_0x27847e[_0xb171ff]={'$like':'%'+_0xd8edcc['query']['filter']+'%'};return _0x27847e;})});}if(_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x49')]){var _0x3f9f61=_0xd8edcc[_0xe6a6('0x29')][_0xe6a6('0x49')][_0xe6a6('0x4a')](',');var _0x39df14={};_0x39df14[_0x3f9f61[0x0]]={'$gte':moment(_0x3f9f61[0x1])['format'](_0xe6a6('0x4b'))};_0x5e586e[_0xe6a6('0x47')]=_[_0xe6a6('0x33')](_0x5e586e[_0xe6a6('0x47')],_0x39df14);}_0x5e586e=_[_0xe6a6('0x33')]({},_0x5e586e,_0xd8edcc[_0xe6a6('0x34')]);return db[_0xe6a6('0x3f')]['count']({'where':_0x5e586e[_0xe6a6('0x47')]})[_0xe6a6('0x1e')](function(_0x1b88f0){_0x43feaa[_0xe6a6('0x19')]=_0x1b88f0;if(_0xd8edcc[_0xe6a6('0x29')]['includeAll']){_0x5e586e[_0xe6a6('0x32')]=[{'all':!![]}];}return db[_0xe6a6('0x3f')][_0xe6a6('0x28')](_0x5e586e);})[_0xe6a6('0x1e')](function(_0x426835){_0x43feaa[_0xe6a6('0x4c')]=_0x426835;return _0x43feaa;});}})[_0xe6a6('0x1e')](respondWithFilteredResult(_0x58166e,_0x5e586e))[_0xe6a6('0x36')](handleError(_0x58166e,null));};exports[_0xe6a6('0x4d')]=function(_0x3ad7fb,_0x1afa49){return db[_0xe6a6('0x24')][_0xe6a6('0x35')]({'where':{'id':_0x3ad7fb[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x1afa49,null))[_0xe6a6('0x1e')](function(_0x165901){if(_0x165901){return _0x165901[_0xe6a6('0x4e')](_0x3ad7fb[_0xe6a6('0x38')][_0xe6a6('0x3b')],_[_0xe6a6('0x3c')](_0x3ad7fb['body'],[_0xe6a6('0x3b'),'id'])||{})[_0xe6a6('0x4f')](function(){return db[_0xe6a6('0x50')][_0xe6a6('0x28')]({'attributes':['id',_0xe6a6('0x21'),_0xe6a6('0x51')],'where':{'id':_0x3ad7fb[_0xe6a6('0x38')][_0xe6a6('0x3b')]}});})[_0xe6a6('0x1e')](function(_0x20563d){socket[_0xe6a6('0x52')]('whatsappInteractionTags:save',{'id':Number(_0x3ad7fb['params']['id']),'tags':_0x20563d||[]});return{'id':Number(_0x3ad7fb[_0xe6a6('0x2c')]['id']),'tags':_0x20563d||[]};});}})[_0xe6a6('0x1e')](respondWithResult(_0x1afa49,null))['catch'](handleError(_0x1afa49,null));};exports[_0xe6a6('0x53')]=function(_0x320307,_0x1c1721){return db[_0xe6a6('0x24')][_0xe6a6('0x35')]({'where':{'id':_0x320307[_0xe6a6('0x2c')]['id']}})[_0xe6a6('0x1e')](handleEntityNotFound(_0x1c1721,null))['then'](function(_0x128cf7){if(_0x128cf7){return _0x128cf7[_0xe6a6('0x53')](_0x320307[_0xe6a6('0x29')][_0xe6a6('0x3b')]);}})[_0xe6a6('0x1e')](respondWithStatusCode(_0x1c1721,null))[_0xe6a6('0x36')](handleError(_0x1c1721,null));};exports[_0xe6a6('0x54')]=function(_0x13fc6f,_0x1704e9){var _0x9e6ba4=moment()[_0xe6a6('0x55')]()[_0xe6a6('0x56')]();var _0x546503=path[_0xe6a6('0x57')](config['root'],_0xe6a6('0x58'),'files','tmp');var _0x448e02=path[_0xe6a6('0x57')](config['root'],_0xe6a6('0x58'),_0xe6a6('0x59'),'attachments');var _0x277fec=path['join'](_0x546503,_0x9e6ba4);var _0x17584e=util[_0xe6a6('0x5a')](_0xe6a6('0x5b'),_0x13fc6f[_0xe6a6('0x2c')]['id'],_0x9e6ba4);var _0x18e9c3=path[_0xe6a6('0x57')](_0x546503,_0x17584e);var _0x5c090e=[];_0x5c090e['push']({'model':db[_0xe6a6('0x5c')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5c090e[_0xe6a6('0x5d')]({'model':db[_0xe6a6('0x5e')],'as':'Contact','attributes':['id',_0xe6a6('0x5f'),_0xe6a6('0x60')],'raw':!![]});if(_0x13fc6f[_0xe6a6('0x29')][_0xe6a6('0x61')]){_0x5c090e[_0xe6a6('0x5d')]({'model':db[_0xe6a6('0x62')],'as':_0xe6a6('0x62'),'raw':!![]});}var _0x182dce=[{'model':db[_0xe6a6('0x3f')],'as':'Messages','attributes':['id',_0xe6a6('0x38'),_0xe6a6('0x63'),_0xe6a6('0x64'),_0xe6a6('0x65'),_0xe6a6('0x66')],'include':_0x5c090e}];_0x182dce[_0xe6a6('0x5d')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0xe6a6('0x21')]});_0x182dce[_0xe6a6('0x5d')]({'model':db[_0xe6a6('0x5c')],'as':_0xe6a6('0x67'),'attributes':['id',_0xe6a6('0x68')]});return db[_0xe6a6('0x24')][_0xe6a6('0x35')]({'where':{'id':_0x13fc6f['params']['id']},'include':_0x182dce})[_0xe6a6('0x1e')](handleEntityNotFound(_0x1704e9,null))[_0xe6a6('0x1e')](function(_0x18ee6f){if(_0x18ee6f){var _0x79638e=_0x18ee6f[_0xe6a6('0x69')]({'plain':!![]});fs['mkdirSync'](_0x277fec);var _0x59197e={'channel':_0xe6a6('0x6a'),'account':_0x79638e[_0xe6a6('0x6b')][_0xe6a6('0x21')],'agent':_0x79638e[_0xe6a6('0x67')]?_0x79638e[_0xe6a6('0x67')]['fullname']:_0xe6a6('0x6c'),'createdAt':moment(_0x79638e[_0xe6a6('0x63')])['format'](_0xe6a6('0x4b'))['toString'](),'closedAt':_0x79638e[_0xe6a6('0x6d')]?moment(_0x79638e[_0xe6a6('0x6e')])[_0xe6a6('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe6a6('0x56')]():'','disposition':_0x79638e[_0xe6a6('0x6f')],'messages':_(_0x79638e[_0xe6a6('0x70')])[_0xe6a6('0x46')]({'secret':![]})['map'](function(_0x5e4694){if(_0x5e4694[_0xe6a6('0x62')]){var _0x4fc699=path['join'](_0x448e02,_0x5e4694[_0xe6a6('0x62')][_0xe6a6('0x71')]);if(fs['existsSync'](_0x4fc699)){fs[_0xe6a6('0x72')](_0x4fc699)[_0xe6a6('0x73')](fs[_0xe6a6('0x74')](path['join'](_0x277fec,_0x5e4694[_0xe6a6('0x62')][_0xe6a6('0x71')])));}}return{'date':moment(_0x5e4694[_0xe6a6('0x63')])[_0xe6a6('0x5a')](_0xe6a6('0x4b'))[_0xe6a6('0x56')](),'sender':_0x5e4694['direction']===_0xe6a6('0x75')?_0x5e4694['User']?_0x5e4694[_0xe6a6('0x5c')][_0xe6a6('0x68')]:_0xe6a6('0x76'):_0x5e4694['Contact'][_0xe6a6('0x5f')]+(_0x5e4694[_0xe6a6('0x77')]['lastName']?'\x20'+_0x5e4694[_0xe6a6('0x77')][_0xe6a6('0x60')]:''),'body':_0x5e4694[_0xe6a6('0x62')]?_0x5e4694['Attachment'][_0xe6a6('0x71')]:_0x5e4694[_0xe6a6('0x38')],'direction':_0x5e4694[_0xe6a6('0x64')]==='out'?'A':'C','secret':_0x5e4694['secret'],'read':_0x5e4694[_0xe6a6('0x66')],'attachment':_0x5e4694['Attachment']};})['value']()};return ejs[_0xe6a6('0x78')](path['join'](config[_0xe6a6('0x79')],_0xe6a6('0x58'),'views',_0xe6a6('0x7a')),{'interaction':_0x59197e})[_0xe6a6('0x1e')](function(_0x5317e3){var _0x3fee86=path[_0xe6a6('0x57')](_0x277fec,'transcript-'+_0x79638e['id']+'-'+_0x9e6ba4+_0xe6a6('0x7b'));var _0x5214bd={'path':_0x3fee86,'channel':_0xe6a6('0x6a'),'interactionId':_0x79638e['id']};return pdf[_0xe6a6('0x7c')](_0x5317e3,_0x5214bd);})[_0xe6a6('0x1e')](function(){return new BPromise(function(_0x3db7f8,_0x26a5e4){zipdir(_0x277fec,{'saveTo':_0x18e9c3},function(_0x50b491,_0x40d110){if(_0x50b491)return _0x26a5e4(_0x50b491);return _0x3db7f8(_0x40d110);});})['then'](function(){return new BPromise(function(_0x4b2f99,_0x598a95){rimraf(_0x277fec,function(_0x44800f){if(_0x44800f)_0x598a95(_0x44800f);return _0x4b2f99();});});})[_0xe6a6('0x1e')](function(){return _0x1704e9[_0xe6a6('0x54')](_0x18e9c3,_0x17584e,function(_0x1bac1d){if(_0x1bac1d){console[_0xe6a6('0x7d')](_0xe6a6('0x7e'),_0x1bac1d);}else{fs[_0xe6a6('0x7f')](_0x18e9c3);}});});});}else{return _0x1704e9[_0xe6a6('0x13')](0xc8);}})['catch'](handleError(_0x1704e9,null));}; \ No newline at end of file +var _0xaf79=['name','send','map','WhatsappInteraction','type','key','findAll','whatsapp','query','user','catch','show','params','model','rawAttributes','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','body','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','options','rows','addTags','setTags','spread','Tag','color','emit','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','fullname','get','mkdirSync','Whatsapp','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','disposition','Messages','basename','existsSync','pipe','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack'];(function(_0x253f0e,_0x3d2fe7){var _0x5d231a=function(_0x1f7f33){while(--_0x1f7f33){_0x253f0e['push'](_0x253f0e['shift']());}};_0x5d231a(++_0x3d2fe7);}(_0xaf79,0xe4));var _0x9af7=function(_0x18665d,_0xfee701){_0x18665d=_0x18665d-0x0;var _0x13fbd1=_0xaf79[_0x18665d];return _0x13fbd1;};'use strict';var rimraf=require(_0x9af7('0x0'));var zipdir=require(_0x9af7('0x1'));var moment=require(_0x9af7('0x2'));var BPromise=require(_0x9af7('0x3'));var util=require(_0x9af7('0x4'));var path=require(_0x9af7('0x5'));var ejs=require(_0x9af7('0x6'));var fs=require('fs');var _=require(_0x9af7('0x7'));var Redis=require(_0x9af7('0x8'));var interaction=require(_0x9af7('0x9'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x9af7('0xa'));var config=require(_0x9af7('0xb'));var db=require(_0x9af7('0xc'))['db'];config[_0x9af7('0xd')]=_[_0x9af7('0xe')](config[_0x9af7('0xd')],{'host':_0x9af7('0xf'),'port':0x18eb});var socket=require(_0x9af7('0x10'))(new Redis(config[_0x9af7('0xd')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3c8d88,_0x5c303e){_0x5c303e=_0x5c303e||0xcc;return function(_0x101595){if(_0x101595){return _0x3c8d88[_0x9af7('0x11')](_0x5c303e);}return _0x3c8d88[_0x9af7('0x12')](_0x5c303e)[_0x9af7('0x13')]();};}function respondWithResult(_0x41e564,_0x147557){_0x147557=_0x147557||0xc8;return function(_0x51d5a7){if(_0x51d5a7){return _0x41e564[_0x9af7('0x12')](_0x147557)[_0x9af7('0x14')](_0x51d5a7);}};}function respondWithFilteredResult(_0x46105a,_0x1fb6ca){return function(_0x822772){if(_0x822772){var _0x318c87=typeof _0x1fb6ca[_0x9af7('0x15')]===_0x9af7('0x16')&&typeof _0x1fb6ca[_0x9af7('0x17')]===_0x9af7('0x16');var _0x30c8cb=_0x822772[_0x9af7('0x18')];var _0x5546c9=_0x318c87?0x0:_0x1fb6ca[_0x9af7('0x15')];var _0x10d96b=_0x318c87?_0x822772['count']:_0x1fb6ca[_0x9af7('0x15')]+_0x1fb6ca[_0x9af7('0x17')];var _0x336625;if(_0x10d96b>=_0x30c8cb){_0x10d96b=_0x30c8cb;_0x336625=0xc8;}else{_0x336625=0xce;}_0x46105a['status'](_0x336625);return _0x46105a[_0x9af7('0x19')](_0x9af7('0x1a'),_0x5546c9+'-'+_0x10d96b+'/'+_0x30c8cb)[_0x9af7('0x14')](_0x822772);}return null;};}function saveUpdates(_0x17da9c){return function(_0x32ac9e){if(_0x32ac9e){return _0x32ac9e[_0x9af7('0x1b')](_0x17da9c)[_0x9af7('0x1c')](function(_0x5efbcc){return _0x5efbcc;});}return null;};}function removeEntity(_0x55c969){return function(_0x1941fc){if(_0x1941fc){return _0x1941fc[_0x9af7('0x1d')]()[_0x9af7('0x1c')](function(){_0x55c969[_0x9af7('0x12')](0xcc)[_0x9af7('0x13')]();});}};}function handleEntityNotFound(_0x37709b){return function(_0xbd042d){if(!_0xbd042d){_0x37709b[_0x9af7('0x11')](0x194);}return _0xbd042d;};}function handleError(_0x33b4d8,_0x2c2e47){_0x2c2e47=_0x2c2e47||0x1f4;return function(_0x2f891a){logger[_0x9af7('0x1e')](_0x2f891a[_0x9af7('0x1f')]);if(_0x2f891a[_0x9af7('0x20')]){delete _0x2f891a[_0x9af7('0x20')];}_0x33b4d8[_0x9af7('0x12')](_0x2c2e47)[_0x9af7('0x21')](_0x2f891a);};}exports['index']=function(_0x105837,_0x5c587f){var _0x495738={};var _0x1713c6=_[_0x9af7('0x22')](db[_0x9af7('0x23')]['rawAttributes'],function(_0x148d09){return{'name':_0x148d09['fieldName'],'type':_0x148d09[_0x9af7('0x24')][_0x9af7('0x25')]};});_0x495738=qs['getOptions'](_0x1713c6,_0x105837);return interaction[_0x9af7('0x26')](_0x9af7('0x27'),_0x105837[_0x9af7('0x28')],_0x105837[_0x9af7('0x29')],_0x495738,_0x1713c6)[_0x9af7('0x1c')](respondWithFilteredResult(_0x5c587f,_0x495738))[_0x9af7('0x2a')](handleError(_0x5c587f,null));};exports[_0x9af7('0x2b')]=function(_0x1fed7e,_0x5c29b9){var _0x4fb57f={'raw':![],'where':{'id':_0x1fed7e[_0x9af7('0x2c')]['id']}},_0x1bc398={};_0x1bc398[_0x9af7('0x2d')]=_['keys'](db[_0x9af7('0x23')][_0x9af7('0x2e')]);_0x1bc398[_0x9af7('0x28')]=_[_0x9af7('0x2f')](_0x1fed7e[_0x9af7('0x28')]);_0x1bc398[_0x9af7('0x30')]=_['intersection'](_0x1bc398['model'],_0x1bc398[_0x9af7('0x28')]);_0x4fb57f[_0x9af7('0x31')]=_[_0x9af7('0x32')](_0x1bc398[_0x9af7('0x2d')],qs[_0x9af7('0x33')](_0x1fed7e['query']['fields']));_0x4fb57f[_0x9af7('0x31')]=_0x4fb57f[_0x9af7('0x31')][_0x9af7('0x34')]?_0x4fb57f[_0x9af7('0x31')]:_0x1bc398[_0x9af7('0x2d')];if(_0x1fed7e[_0x9af7('0x28')][_0x9af7('0x35')]){_0x4fb57f[_0x9af7('0x36')]=[{'all':!![]}];}_0x4fb57f=_[_0x9af7('0x37')]({},_0x4fb57f,_0x1fed7e['options']);return db[_0x9af7('0x23')]['find'](_0x4fb57f)[_0x9af7('0x1c')](handleEntityNotFound(_0x5c29b9,null))['then'](respondWithResult(_0x5c29b9,null))['catch'](handleError(_0x5c29b9,null));};exports['create']=function(_0x5b2e4d,_0x5d80cd){return db[_0x9af7('0x23')]['create'](_0x5b2e4d[_0x9af7('0x38')],{})[_0x9af7('0x1c')](respondWithResult(_0x5d80cd,0xc9))['catch'](handleError(_0x5d80cd,null));};exports[_0x9af7('0x1b')]=function(_0x406dd1,_0x6ce3bf){if(_0x406dd1[_0x9af7('0x38')]['id']){delete _0x406dd1['body']['id'];}return db[_0x9af7('0x23')][_0x9af7('0x39')]({'where':{'id':_0x406dd1[_0x9af7('0x2c')]['id']}})[_0x9af7('0x1c')](handleEntityNotFound(_0x6ce3bf,null))[_0x9af7('0x1c')](saveUpdates(_0x406dd1[_0x9af7('0x38')],null))['then'](respondWithResult(_0x6ce3bf,null))[_0x9af7('0x2a')](handleError(_0x6ce3bf,null));};exports['destroy']=function(_0x3b44c8,_0x3987ed){return db[_0x9af7('0x23')][_0x9af7('0x39')]({'where':{'id':_0x3b44c8[_0x9af7('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3987ed,null))[_0x9af7('0x1c')](removeEntity(_0x3987ed,null))[_0x9af7('0x2a')](handleError(_0x3987ed,null));};exports['describe']=function(_0x43a099,_0xf510d7){return db[_0x9af7('0x23')][_0x9af7('0x3a')]()[_0x9af7('0x1c')](respondWithResult(_0xf510d7,null))[_0x9af7('0x2a')](handleError(_0xf510d7,null));};exports[_0x9af7('0x3b')]=function(_0x2b2c07,_0x47769b){return db[_0x9af7('0x3c')][_0x9af7('0x39')]({'where':{'id':_0x2b2c07['params']['id']}})[_0x9af7('0x1c')](handleEntityNotFound(_0x47769b,null))[_0x9af7('0x1c')](function(_0x5384f4){if(_0x5384f4){return _0x5384f4[_0x9af7('0x3b')](_0x2b2c07[_0x9af7('0x38')][_0x9af7('0x3d')],_[_0x9af7('0x3e')](_0x2b2c07[_0x9af7('0x38')],[_0x9af7('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x47769b,null))[_0x9af7('0x2a')](handleError(_0x47769b,null));};exports[_0x9af7('0x3f')]=function(_0xa675a8,_0x589fc2){var _0x54ccc0={'raw':![],'where':{}};var _0x4081d9={};var _0xceaf8c={'count':0x0,'rows':[]};return db[_0x9af7('0x23')][_0x9af7('0x40')]({'where':{'id':_0xa675a8[_0x9af7('0x2c')]['id']}})[_0x9af7('0x1c')](handleEntityNotFound(_0x589fc2,null))[_0x9af7('0x1c')](function(_0x33cc59){if(_0x33cc59){_0x4081d9[_0x9af7('0x2d')]=_['keys'](db[_0x9af7('0x3c')][_0x9af7('0x2e')]);_0x4081d9[_0x9af7('0x28')]=_[_0x9af7('0x2f')](_0xa675a8['query']);_0x4081d9[_0x9af7('0x30')]=_[_0x9af7('0x32')](_0x4081d9[_0x9af7('0x2d')],_0x4081d9[_0x9af7('0x28')]);_0x54ccc0[_0x9af7('0x31')]=_[_0x9af7('0x32')](_0x4081d9[_0x9af7('0x2d')],qs['fields'](_0xa675a8[_0x9af7('0x28')]['fields']));_0x54ccc0[_0x9af7('0x31')]=_0x54ccc0[_0x9af7('0x31')][_0x9af7('0x34')]?_0x54ccc0[_0x9af7('0x31')]:_0x4081d9['model'];if(!_0xa675a8[_0x9af7('0x28')][_0x9af7('0x41')]('nolimit')){_0x54ccc0[_0x9af7('0x17')]=qs['limit'](_0xa675a8['query'][_0x9af7('0x17')]);_0x54ccc0[_0x9af7('0x15')]=qs['offset'](_0xa675a8['query'][_0x9af7('0x15')]);}_0x54ccc0[_0x9af7('0x42')]=qs[_0x9af7('0x43')](_0xa675a8['query'][_0x9af7('0x43')]);_0x54ccc0[_0x9af7('0x44')]=qs['filters'](_[_0x9af7('0x45')](_0xa675a8[_0x9af7('0x28')],_0x4081d9[_0x9af7('0x30')]));_0x54ccc0[_0x9af7('0x44')][_0x9af7('0x46')]=_0x33cc59['id'];if(_0xa675a8[_0x9af7('0x28')][_0x9af7('0x47')]){_0x54ccc0[_0x9af7('0x44')]=_[_0x9af7('0x37')](_0x54ccc0[_0x9af7('0x44')],{'$or':_[_0x9af7('0x22')](_0x54ccc0[_0x9af7('0x31')],function(_0x535944){var _0x143583={};_0x143583[_0x535944]={'$like':'%'+_0xa675a8[_0x9af7('0x28')][_0x9af7('0x47')]+'%'};return _0x143583;})});}if(_0xa675a8[_0x9af7('0x28')][_0x9af7('0x48')]){var _0x37e817=_0xa675a8['query'][_0x9af7('0x48')][_0x9af7('0x49')](',');var _0x4033e1={};_0x4033e1[_0x37e817[0x0]]={'$gte':moment(_0x37e817[0x1])[_0x9af7('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x54ccc0[_0x9af7('0x44')]=_[_0x9af7('0x37')](_0x54ccc0[_0x9af7('0x44')],_0x4033e1);}_0x54ccc0=_['merge']({},_0x54ccc0,_0xa675a8[_0x9af7('0x4b')]);return db['WhatsappMessage']['count']({'where':_0x54ccc0[_0x9af7('0x44')]})[_0x9af7('0x1c')](function(_0x157f27){_0xceaf8c[_0x9af7('0x18')]=_0x157f27;if(_0xa675a8[_0x9af7('0x28')]['includeAll']){_0x54ccc0[_0x9af7('0x36')]=[{'all':!![]}];}return db[_0x9af7('0x3c')][_0x9af7('0x26')](_0x54ccc0);})[_0x9af7('0x1c')](function(_0x56dbb8){_0xceaf8c[_0x9af7('0x4c')]=_0x56dbb8;return _0xceaf8c;});}})['then'](respondWithFilteredResult(_0x589fc2,_0x54ccc0))['catch'](handleError(_0x589fc2,null));};exports[_0x9af7('0x4d')]=function(_0x33a0c2,_0x29d3f9){return db[_0x9af7('0x23')][_0x9af7('0x39')]({'where':{'id':_0x33a0c2[_0x9af7('0x2c')]['id']}})[_0x9af7('0x1c')](handleEntityNotFound(_0x29d3f9,null))[_0x9af7('0x1c')](function(_0xe52da){if(_0xe52da){return _0xe52da[_0x9af7('0x4e')](_0x33a0c2[_0x9af7('0x38')][_0x9af7('0x3d')],_[_0x9af7('0x3e')](_0x33a0c2[_0x9af7('0x38')],[_0x9af7('0x3d'),'id'])||{})[_0x9af7('0x4f')](function(){return db[_0x9af7('0x50')][_0x9af7('0x26')]({'attributes':['id','name',_0x9af7('0x51')],'where':{'id':_0x33a0c2['body']['ids']}});})[_0x9af7('0x1c')](function(_0x266551){socket[_0x9af7('0x52')]('whatsappInteractionTags:save',{'id':Number(_0x33a0c2[_0x9af7('0x2c')]['id']),'tags':_0x266551||[]});return{'id':Number(_0x33a0c2[_0x9af7('0x2c')]['id']),'tags':_0x266551||[]};});}})['then'](respondWithResult(_0x29d3f9,null))['catch'](handleError(_0x29d3f9,null));};exports[_0x9af7('0x53')]=function(_0xc78e73,_0x5cc96b){return db[_0x9af7('0x23')][_0x9af7('0x39')]({'where':{'id':_0xc78e73[_0x9af7('0x2c')]['id']}})[_0x9af7('0x1c')](handleEntityNotFound(_0x5cc96b,null))[_0x9af7('0x1c')](function(_0x4a16bf){if(_0x4a16bf){return _0x4a16bf[_0x9af7('0x53')](_0xc78e73[_0x9af7('0x28')][_0x9af7('0x3d')]);}})[_0x9af7('0x1c')](respondWithStatusCode(_0x5cc96b,null))[_0x9af7('0x2a')](handleError(_0x5cc96b,null));};exports['download']=function(_0x1e8141,_0x523f9b){var _0x47827a=moment()[_0x9af7('0x54')]()['toString']();var _0x540be0=path[_0x9af7('0x55')](config[_0x9af7('0x56')],'server','files','tmp');var _0x4caf9b=path[_0x9af7('0x55')](config['root'],_0x9af7('0x57'),_0x9af7('0x58'),_0x9af7('0x59'));var _0x361633=path['join'](_0x540be0,_0x47827a);var _0x43a9e6=util[_0x9af7('0x4a')](_0x9af7('0x5a'),_0x1e8141[_0x9af7('0x2c')]['id'],_0x47827a);var _0x87d4bc=path[_0x9af7('0x55')](_0x540be0,_0x43a9e6);var _0x4a4007=[];_0x4a4007['push']({'model':db[_0x9af7('0x5b')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x4a4007[_0x9af7('0x5c')]({'model':db[_0x9af7('0x5d')],'as':_0x9af7('0x5e'),'attributes':['id',_0x9af7('0x5f'),_0x9af7('0x60')],'raw':!![]});if(_0x1e8141[_0x9af7('0x28')]['attachments']){_0x4a4007['push']({'model':db['Attachment'],'as':_0x9af7('0x61'),'raw':!![]});}var _0x4bd213=[{'model':db[_0x9af7('0x3c')],'as':'Messages','attributes':['id',_0x9af7('0x38'),_0x9af7('0x62'),_0x9af7('0x63'),_0x9af7('0x64'),_0x9af7('0x65')],'include':_0x4a4007}];_0x4bd213['push']({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x9af7('0x20')]});_0x4bd213['push']({'model':db[_0x9af7('0x5b')],'as':'Owner','attributes':['id',_0x9af7('0x66')]});return db['WhatsappInteraction'][_0x9af7('0x39')]({'where':{'id':_0x1e8141[_0x9af7('0x2c')]['id']},'include':_0x4bd213})['then'](handleEntityNotFound(_0x523f9b,null))[_0x9af7('0x1c')](function(_0x2218ce){if(_0x2218ce){var _0x387242=_0x2218ce[_0x9af7('0x67')]({'plain':!![]});fs[_0x9af7('0x68')](_0x361633);var _0x55783a={'channel':_0x9af7('0x69'),'account':_0x387242[_0x9af7('0x6a')]['name'],'agent':_0x387242[_0x9af7('0x6b')]?_0x387242[_0x9af7('0x6b')][_0x9af7('0x66')]:_0x9af7('0x6c'),'createdAt':moment(_0x387242[_0x9af7('0x62')])[_0x9af7('0x4a')](_0x9af7('0x6d'))[_0x9af7('0x6e')](),'closedAt':_0x387242['closed']?moment(_0x387242[_0x9af7('0x6f')])[_0x9af7('0x4a')](_0x9af7('0x6d'))[_0x9af7('0x6e')]():'','disposition':_0x387242[_0x9af7('0x70')],'messages':_(_0x387242[_0x9af7('0x71')])[_0x9af7('0x47')]({'secret':![]})[_0x9af7('0x22')](function(_0x41e67d){if(_0x41e67d[_0x9af7('0x61')]){var _0x2970f6=path['join'](_0x4caf9b,_0x41e67d[_0x9af7('0x61')][_0x9af7('0x72')]);if(fs[_0x9af7('0x73')](_0x2970f6)){fs['createReadStream'](_0x2970f6)[_0x9af7('0x74')](fs[_0x9af7('0x75')](path[_0x9af7('0x55')](_0x361633,_0x41e67d[_0x9af7('0x61')][_0x9af7('0x72')])));}}return{'date':moment(_0x41e67d[_0x9af7('0x62')])[_0x9af7('0x4a')](_0x9af7('0x6d'))[_0x9af7('0x6e')](),'sender':_0x41e67d[_0x9af7('0x63')]===_0x9af7('0x76')?_0x41e67d[_0x9af7('0x5b')]?_0x41e67d[_0x9af7('0x5b')][_0x9af7('0x66')]:_0x9af7('0x77'):_0x41e67d['Contact']['firstName']+(_0x41e67d['Contact'][_0x9af7('0x60')]?'\x20'+_0x41e67d['Contact']['lastName']:''),'body':_0x41e67d[_0x9af7('0x61')]?_0x41e67d[_0x9af7('0x61')]['basename']:_0x41e67d[_0x9af7('0x38')],'direction':_0x41e67d['direction']==='out'?'A':'C','secret':_0x41e67d[_0x9af7('0x64')],'read':_0x41e67d['read'],'attachment':_0x41e67d[_0x9af7('0x61')]};})[_0x9af7('0x78')]()};return ejs[_0x9af7('0x79')](path[_0x9af7('0x55')](config[_0x9af7('0x56')],_0x9af7('0x57'),_0x9af7('0x7a'),_0x9af7('0x7b')),{'interaction':_0x55783a})[_0x9af7('0x1c')](function(_0x1fd1df){var _0x5840e2=path[_0x9af7('0x55')](_0x361633,_0x9af7('0x7c')+_0x387242['id']+'-'+_0x47827a+'.pdf');var _0x4331b5={'path':_0x5840e2,'channel':'Whatsapp','interactionId':_0x387242['id']};return pdf[_0x9af7('0x7d')](_0x1fd1df,_0x4331b5);})[_0x9af7('0x1c')](function(){return new BPromise(function(_0x40cc84,_0x265ea4){zipdir(_0x361633,{'saveTo':_0x87d4bc},function(_0xd4fc64,_0x112f93){if(_0xd4fc64)return _0x265ea4(_0xd4fc64);return _0x40cc84(_0x112f93);});})[_0x9af7('0x1c')](function(){return new BPromise(function(_0x22f694,_0x206094){rimraf(_0x361633,function(_0x30068f){if(_0x30068f)_0x206094(_0x30068f);return _0x22f694();});});})[_0x9af7('0x1c')](function(){return _0x523f9b[_0x9af7('0x7e')](_0x87d4bc,_0x43a9e6,function(_0x4054d1){if(_0x4054d1){console[_0x9af7('0x7f')](_0x9af7('0x80'),_0x4054d1);}else{fs[_0x9af7('0x81')](_0x87d4bc);}});});});}else{return _0x523f9b[_0x9af7('0x11')](0xc8);}})[_0x9af7('0x2a')](handleError(_0x523f9b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5484fe3..efa0a2e 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 _0x7914=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x26dcae,_0x5be1cd){var _0x28fde8=function(_0x2e5b42){while(--_0x2e5b42){_0x26dcae['push'](_0x26dcae['shift']());}};_0x28fde8(++_0x5be1cd);}(_0x7914,0x107));var _0x4791=function(_0x12f026,_0x32fdc3){_0x12f026=_0x12f026-0x0;var _0x50efff=_0x7914[_0x12f026];return _0x50efff;};'use strict';var EventEmitter=require(_0x4791('0x0'));var WhatsappInteraction=require(_0x4791('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4791('0x1'))['db'][_0x4791('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4791('0x3')](0x0);var events={'afterCreate':_0x4791('0x4'),'afterUpdate':_0x4791('0x5'),'afterDestroy':_0x4791('0x6')};function emitEvent(_0x46c4f4){return function(_0x45f27a,_0x6eac92,_0x3ec3ea){_0x45f27a['getUsers']({'attributes':['id'],'raw':!![]})[_0x4791('0x7')](function(_0x559fc1){_0x45f27a[_0x4791('0x8')](_0x4791('0x9'),_0x559fc1[_0x4791('0xa')](function(_0x2d1b96){return{'id':_0x2d1b96['id']};}));return WhatsappMessage[_0x4791('0xb')]({'where':{'WhatsappInteractionId':_0x45f27a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4791('0x7')](function(_0x438679){_0x45f27a[_0x4791('0x8')]('unreadMessages',_0x438679[_0x4791('0xc')]);WhatsappInteractionEvents[_0x4791('0xd')](_0x46c4f4+':'+_0x45f27a['id'],_0x45f27a);WhatsappInteractionEvents[_0x4791('0xd')](_0x46c4f4,_0x45f27a);_0x3ec3ea(null);})[_0x4791('0xe')](_0x3ec3ea(null));};}for(var e in events){if(events[_0x4791('0xf')](e)){var event=events[e];WhatsappInteraction[_0x4791('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x502a=['events','../../mysqldb','WhatsappMessage','update','getUsers','setDataValue','findAll','unreadMessages','emit','catch','hook','exports'];(function(_0x3af6f8,_0x3f356c){var _0x1f36f7=function(_0x3b25e7){while(--_0x3b25e7){_0x3af6f8['push'](_0x3af6f8['shift']());}};_0x1f36f7(++_0x3f356c);}(_0x502a,0xd8));var _0xa502=function(_0x1efa82,_0x4437b7){_0x1efa82=_0x1efa82-0x0;var _0x5c3131=_0x502a[_0x1efa82];return _0x5c3131;};'use strict';var EventEmitter=require(_0xa502('0x0'));var WhatsappInteraction=require(_0xa502('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xa502('0x1'))['db'][_0xa502('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa502('0x3'),'afterDestroy':'remove'};function emitEvent(_0x13ee72){return function(_0x437bb8,_0x15e29f,_0x1cb2e4){_0x437bb8[_0xa502('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x329022){_0x437bb8[_0xa502('0x5')]('Users',_0x329022['map'](function(_0x13e991){return{'id':_0x13e991['id']};}));return WhatsappMessage[_0xa502('0x6')]({'where':{'WhatsappInteractionId':_0x437bb8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x31d6f0){_0x437bb8[_0xa502('0x5')](_0xa502('0x7'),_0x31d6f0['length']);WhatsappInteractionEvents[_0xa502('0x8')](_0x13ee72+':'+_0x437bb8['id'],_0x437bb8);WhatsappInteractionEvents[_0xa502('0x8')](_0x13ee72,_0x437bb8);_0x1cb2e4(null);})[_0xa502('0x9')](_0x1cb2e4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xa502('0xa')](e,emitEvent(event));}}module[_0xa502('0xb')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3644e62..4705004 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 _0xd2b0=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','lodash','../../config/logger','moment','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0xb69e5c,_0x294db7){var _0x594bc6=function(_0x429a24){while(--_0x429a24){_0xb69e5c['push'](_0xb69e5c['shift']());}};_0x594bc6(++_0x294db7);}(_0xd2b0,0x13a));var _0x0d2b=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xd2b0[_0x47408e];return _0x1636bc;};'use strict';var _=require(_0x0d2b('0x0'));var util=require('util');var logger=require(_0x0d2b('0x1'))('api');var moment=require(_0x0d2b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d2b('0x3'));var config=require(_0x0d2b('0x4'));var attributes=require(_0x0d2b('0x5'));module[_0x0d2b('0x6')]=function(_0xefacf5,_0x2d329b){return _0xefacf5[_0x0d2b('0x7')](_0x0d2b('0x8'),attributes,{'tableName':_0x0d2b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x282fec,_0x972db3,_0x2e0958){if(_0x282fec[_0x0d2b('0xa')](_0x0d2b('0xb'))){_0x282fec[_0x0d2b('0xc')]=moment()[_0x0d2b('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2e0958(null,_0x282fec);}}});}; \ No newline at end of file +var _0x84c9=['define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','lodash','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0xcd81b8,_0x18d9fd){var _0xc3ae18=function(_0x2bd4e0){while(--_0x2bd4e0){_0xcd81b8['push'](_0xcd81b8['shift']());}};_0xc3ae18(++_0x18d9fd);}(_0x84c9,0x66));var _0x984c=function(_0x3b8845,_0x322e2e){_0x3b8845=_0x3b8845-0x0;var _0x556970=_0x84c9[_0x3b8845];return _0x556970;};'use strict';var _=require(_0x984c('0x0'));var util=require('util');var logger=require(_0x984c('0x1'))(_0x984c('0x2'));var moment=require(_0x984c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x984c('0x4'));var config=require(_0x984c('0x5'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x52ea66,_0x3044bc){return _0x52ea66[_0x984c('0x6')](_0x984c('0x7'),attributes,{'tableName':_0x984c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf858b1,_0x1e0cd5,_0x1dc26e){if(_0xf858b1[_0x984c('0x9')](_0x984c('0xa'))){_0xf858b1[_0x984c('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1dc26e(null,_0xf858b1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 02e421e..dbdfcf7 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 _0x24fd=['addTags','omit','ids','spread','AddTags','catch','util','ioredis','../../mysqldb','client','http','defaults','localhost','redis','./whatsappInteraction.socket','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','find'];(function(_0x4fd544,_0x407d08){var _0x200dd2=function(_0x2f4e1b){while(--_0x2f4e1b){_0x4fd544['push'](_0x4fd544['shift']());}};_0x200dd2(++_0x407d08);}(_0x24fd,0x126));var _0xd24f=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x24fd[_0x166d93];return _0xba708;};'use strict';var _=require('lodash');var util=require(_0xd24f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd24f('0x1'));var db=require(_0xd24f('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd24f('0x3')][_0xd24f('0x4')]({'port':0x232a});config['redis']=_[_0xd24f('0x5')](config['redis'],{'host':_0xd24f('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd24f('0x7')]));require(_0xd24f('0x8'))[_0xd24f('0x9')](socket);function respondWithRpcPromise(_0x267755,_0x5156de,_0x5c759d){return new BPromise(function(_0x5c3257,_0xe1a0ac){return client['request'](_0x267755,_0x5c759d)[_0xd24f('0xa')](function(_0x5bf1f6){logger['info'](_0xd24f('0xb'),_0x5156de,_0xd24f('0xc'));logger[_0xd24f('0xd')](_0xd24f('0xe'),_0x5156de,_0xd24f('0xc'),JSON['stringify'](_0x5bf1f6));if(_0x5bf1f6['error']){if(_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x10')]===0x1f4){logger['error'](_0xd24f('0xb'),_0x5156de,_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x11')]);return _0xe1a0ac(_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x11')]);}logger[_0xd24f('0xf')](_0xd24f('0xb'),_0x5156de,_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x11')]);return _0x5c3257(_0x5bf1f6[_0xd24f('0xf')][_0xd24f('0x11')]);}else{logger[_0xd24f('0x12')](_0xd24f('0xb'),_0x5156de,'request\x20sent');_0x5c3257(_0x5bf1f6['result'][_0xd24f('0x11')]);}})['catch'](function(_0x198aa4){logger['error'](_0xd24f('0xb'),_0x5156de,_0x198aa4);_0xe1a0ac(_0x198aa4);});});}exports['UpdateWhatsappInteraction']=function(_0x5c92a6){var _0x20e730=this;return new Promise(function(_0x5a5473,_0x36e19f){return db['WhatsappInteraction'][_0xd24f('0x13')](_0x5c92a6[_0xd24f('0x14')],{'raw':_0x5c92a6[_0xd24f('0x15')]?_0x5c92a6[_0xd24f('0x15')][_0xd24f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c92a6['options']?_0x5c92a6[_0xd24f('0x15')][_0xd24f('0x17')]||null:null,'attributes':_0x5c92a6[_0xd24f('0x15')]?_0x5c92a6[_0xd24f('0x15')][_0xd24f('0x18')]||null:null,'limit':_0x5c92a6['options']?_0x5c92a6[_0xd24f('0x15')][_0xd24f('0x19')]||null:null})[_0xd24f('0xa')](function(_0x12feec){logger['info']('UpdateWhatsappInteraction',_0x5c92a6);logger[_0xd24f('0xd')](_0xd24f('0x1a'),_0x5c92a6,JSON[_0xd24f('0x1b')](_0x12feec));_0x5a5473(_0x12feec);})['catch'](function(_0x10ac9c){logger[_0xd24f('0xf')](_0xd24f('0x1a'),_0x10ac9c[_0xd24f('0x11')],_0x5c92a6);_0x36e19f(_0x20e730[_0xd24f('0xf')](0x1f4,_0x10ac9c['message']));});});};exports[_0xd24f('0x1c')]=function(_0x557f5d){return new Promise(function(_0x2e4907,_0x267d6e){return db['WhatsappInteraction'][_0xd24f('0x1d')]({'where':_0x557f5d[_0xd24f('0x15')]?_0x557f5d[_0xd24f('0x15')]['where']||null:null})[_0xd24f('0xa')](function(_0x26aa32){if(_0x26aa32){return _0x26aa32[_0xd24f('0x1e')](_0x557f5d[_0xd24f('0x14')]['ids'],_[_0xd24f('0x1f')](_0x557f5d[_0xd24f('0x14')],[_0xd24f('0x20'),'id'])||{});}})[_0xd24f('0x21')](function(_0x10116f){logger[_0xd24f('0x12')]('AddTags',_0x557f5d);logger[_0xd24f('0xd')](_0xd24f('0x22'),_0x557f5d,JSON['stringify'](_0x10116f));_0x2e4907(_0x10116f);})[_0xd24f('0x23')](function(_0x12c9ff){logger[_0xd24f('0xf')](_0xd24f('0x22'),_0x12c9ff['message'],_0x557f5d);_0x267d6e(_this[_0xd24f('0xf')](0x1f4,_0x12c9ff[_0xd24f('0x11')]));});});}; \ No newline at end of file +var _0x5892=['then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','limit','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./whatsappInteraction.socket','request'];(function(_0x5233e4,_0x2ddd1e){var _0x2a0b34=function(_0x1c391e){while(--_0x1c391e){_0x5233e4['push'](_0x5233e4['shift']());}};_0x2a0b34(++_0x2ddd1e);}(_0x5892,0x150));var _0x2589=function(_0x8114e9,_0xb9fc00){_0x8114e9=_0x8114e9-0x0;var _0x47d52f=_0x5892[_0x8114e9];return _0x47d52f;};'use strict';var _=require(_0x2589('0x0'));var util=require('util');var moment=require(_0x2589('0x1'));var BPromise=require(_0x2589('0x2'));var rs=require(_0x2589('0x3'));var fs=require('fs');var Redis=require(_0x2589('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2589('0x5'));var logger=require(_0x2589('0x6'))(_0x2589('0x7'));var config=require(_0x2589('0x8'));var jayson=require(_0x2589('0x9'));var client=jayson['client'][_0x2589('0xa')]({'port':0x232a});config[_0x2589('0xb')]=_[_0x2589('0xc')](config[_0x2589('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2589('0xb')]));require(_0x2589('0xd'))['register'](socket);function respondWithRpcPromise(_0x13229a,_0xdded70,_0x25e250){return new BPromise(function(_0x4b1bcb,_0x23b382){return client[_0x2589('0xe')](_0x13229a,_0x25e250)[_0x2589('0xf')](function(_0x141085){logger[_0x2589('0x10')](_0x2589('0x11'),_0xdded70,_0x2589('0x12'));logger[_0x2589('0x13')](_0x2589('0x14'),_0xdded70,_0x2589('0x12'),JSON[_0x2589('0x15')](_0x141085));if(_0x141085['error']){if(_0x141085[_0x2589('0x16')]['code']===0x1f4){logger[_0x2589('0x16')](_0x2589('0x11'),_0xdded70,_0x141085[_0x2589('0x16')][_0x2589('0x17')]);return _0x23b382(_0x141085[_0x2589('0x16')]['message']);}logger[_0x2589('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0xdded70,_0x141085[_0x2589('0x16')][_0x2589('0x17')]);return _0x4b1bcb(_0x141085[_0x2589('0x16')][_0x2589('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xdded70,_0x2589('0x12'));_0x4b1bcb(_0x141085[_0x2589('0x18')][_0x2589('0x17')]);}})['catch'](function(_0x2abae0){logger[_0x2589('0x16')](_0x2589('0x11'),_0xdded70,_0x2abae0);_0x23b382(_0x2abae0);});});}exports[_0x2589('0x19')]=function(_0x5a8421){var _0x30c323=this;return new Promise(function(_0xceeed2,_0x4434f9){return db[_0x2589('0x1a')]['update'](_0x5a8421[_0x2589('0x1b')],{'raw':_0x5a8421[_0x2589('0x1c')]?_0x5a8421['options'][_0x2589('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a8421['options']?_0x5a8421[_0x2589('0x1c')][_0x2589('0x1e')]||null:null,'attributes':_0x5a8421[_0x2589('0x1c')]?_0x5a8421[_0x2589('0x1c')]['attributes']||null:null,'limit':_0x5a8421['options']?_0x5a8421[_0x2589('0x1c')][_0x2589('0x1f')]||null:null})[_0x2589('0xf')](function(_0xd062d8){logger[_0x2589('0x10')](_0x2589('0x19'),_0x5a8421);logger[_0x2589('0x13')](_0x2589('0x19'),_0x5a8421,JSON[_0x2589('0x15')](_0xd062d8));_0xceeed2(_0xd062d8);})['catch'](function(_0x1c7260){logger[_0x2589('0x16')](_0x2589('0x19'),_0x1c7260[_0x2589('0x17')],_0x5a8421);_0x4434f9(_0x30c323['error'](0x1f4,_0x1c7260['message']));});});};exports[_0x2589('0x20')]=function(_0x11cb1a){return new Promise(function(_0x33aa46,_0x34fd79){return db[_0x2589('0x1a')][_0x2589('0x21')]({'where':_0x11cb1a['options']?_0x11cb1a[_0x2589('0x1c')]['where']||null:null})['then'](function(_0x5cf62d){if(_0x5cf62d){return _0x5cf62d[_0x2589('0x22')](_0x11cb1a['body'][_0x2589('0x23')],_['omit'](_0x11cb1a[_0x2589('0x1b')],[_0x2589('0x23'),'id'])||{});}})[_0x2589('0x24')](function(_0x5a0317){logger[_0x2589('0x10')](_0x2589('0x25'),_0x11cb1a);logger['debug'](_0x2589('0x25'),_0x11cb1a,JSON[_0x2589('0x15')](_0x5a0317));_0x33aa46(_0x5a0317);})[_0x2589('0x26')](function(_0x24c9ce){logger[_0x2589('0x16')]('AddTags',_0x24c9ce[_0x2589('0x17')],_0x11cb1a);_0x34fd79(_this['error'](0x1f4,_0x24c9ce[_0x2589('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 144ab2a..9d78a2b 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 _0xb1d7=['remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x1cff5c,_0xcd81ed){var _0xdb32c1=function(_0x38b288){while(--_0x38b288){_0x1cff5c['push'](_0x1cff5c['shift']());}};_0xdb32c1(++_0xcd81ed);}(_0xb1d7,0x7e));var _0x7b1d=function(_0x15cf3c,_0x1ec9f2){_0x15cf3c=_0x15cf3c-0x0;var _0x3b8451=_0xb1d7[_0x15cf3c];return _0x3b8451;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x7b1d('0x0'),_0x7b1d('0x1')];function createListener(_0x4126ed,_0x3029c2){return function(_0x3e9909){_0x3029c2[_0x7b1d('0x2')](_0x4126ed,_0x3e9909);};}function removeListener(_0x1856ea,_0x2143a5){return function(){WhatsappInteractionEvents[_0x7b1d('0x3')](_0x1856ea,_0x2143a5);};}exports[_0x7b1d('0x4')]=function(_0x53842f){for(var _0x4568b5=0x0,_0x1099c1=events[_0x7b1d('0x5')];_0x4568b5<_0x1099c1;_0x4568b5++){var _0x50b6c6=events[_0x4568b5];var _0x2b3b06=createListener(_0x7b1d('0x6')+_0x50b6c6,_0x53842f);WhatsappInteractionEvents['on'](_0x50b6c6,_0x2b3b06);}}; \ No newline at end of file +var _0x3aec=['whatsappInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0x5b7d57,_0x2ae07e){var _0x27af7c=function(_0xd56f79){while(--_0xd56f79){_0x5b7d57['push'](_0x5b7d57['shift']());}};_0x27af7c(++_0x2ae07e);}(_0x3aec,0x199));var _0xc3ae=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x3aec[_0x2b91c5];return _0xbd5531;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xc3ae('0x0'),_0xc3ae('0x1'),_0xc3ae('0x2')];function createListener(_0x5ed83d,_0x2418fc){return function(_0x4f7e6d){_0x2418fc[_0xc3ae('0x3')](_0x5ed83d,_0x4f7e6d);};}function removeListener(_0x26530a,_0x4a753c){return function(){WhatsappInteractionEvents[_0xc3ae('0x4')](_0x26530a,_0x4a753c);};}exports[_0xc3ae('0x5')]=function(_0x1eee47){for(var _0x56cf2a=0x0,_0x4f7b9a=events[_0xc3ae('0x6')];_0x56cf2a<_0x4f7b9a;_0x56cf2a++){var _0x4fb25a=events[_0x56cf2a];var _0x31d49f=createListener(_0xc3ae('0x7')+_0x4fb25a,_0x1eee47);WhatsappInteractionEvents['on'](_0x4fb25a,_0x31d49f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index c5d3039..7dc9573 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 _0x6208=['post','tracked','whatsapp','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x432792,_0x6a452a){var _0x27d7e8=function(_0x31df16){while(--_0x31df16){_0x432792['push'](_0x432792['shift']());}};_0x27d7e8(++_0x6a452a);}(_0x6208,0xf6));var _0x8620=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x6208[_0x59e862];return _0x1a25ee;};'use strict';var multer=require(_0x8620('0x0'));var util=require('util');var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require(_0x8620('0x3'));var router=express[_0x8620('0x4')]();var fs_extra=require(_0x8620('0x5'));var auth=require(_0x8620('0x6'));var interaction=require(_0x8620('0x7'));var config=require(_0x8620('0x8'));var controller=require('./whatsappMessage.controller');router[_0x8620('0x9')]('/',auth[_0x8620('0xa')](),controller[_0x8620('0xb')]);router[_0x8620('0x9')](_0x8620('0xc'),auth['isAuthenticated'](),controller[_0x8620('0xd')]);router[_0x8620('0x9')]('/:id',auth[_0x8620('0xa')](),controller['show']);router[_0x8620('0xe')]('/',auth[_0x8620('0xa')](),interaction[_0x8620('0xf')](_0x8620('0x10'),'whatsappmessage:create'),controller[_0x8620('0x11')]);router[_0x8620('0xe')]('/:id/status',controller[_0x8620('0x12')]);router[_0x8620('0x13')]('/:id',auth[_0x8620('0xa')](),controller['update']);router[_0x8620('0x13')](_0x8620('0x14'),auth[_0x8620('0xa')](),controller[_0x8620('0x15')]);router[_0x8620('0x13')](_0x8620('0x16'),auth[_0x8620('0xa')](),controller[_0x8620('0x17')]);router[_0x8620('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8620('0x19')]=router; \ No newline at end of file +var _0xfd7a=['describe','post','whatsapp','whatsappmessage:create','create','/:id/status','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x56634a,_0x33948d){var _0x236619=function(_0x1b8315){while(--_0x1b8315){_0x56634a['push'](_0x56634a['shift']());}};_0x236619(++_0x33948d);}(_0xfd7a,0x7a));var _0xafd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd7a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xafd7('0x0'));var util=require(_0xafd7('0x1'));var path=require(_0xafd7('0x2'));var timeout=require(_0xafd7('0x3'));var express=require(_0xafd7('0x4'));var router=express['Router']();var fs_extra=require(_0xafd7('0x5'));var auth=require(_0xafd7('0x6'));var interaction=require(_0xafd7('0x7'));var config=require('../../config/environment');var controller=require(_0xafd7('0x8'));router[_0xafd7('0x9')]('/',auth[_0xafd7('0xa')](),controller[_0xafd7('0xb')]);router['get'](_0xafd7('0xc'),auth[_0xafd7('0xa')](),controller[_0xafd7('0xd')]);router['get']('/:id',auth[_0xafd7('0xa')](),controller['show']);router[_0xafd7('0xe')]('/',auth[_0xafd7('0xa')](),interaction['tracked'](_0xafd7('0xf'),_0xafd7('0x10')),controller[_0xafd7('0x11')]);router['post'](_0xafd7('0x12'),controller['status']);router['put']('/:id',auth[_0xafd7('0xa')](),controller[_0xafd7('0x13')]);router[_0xafd7('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0xafd7('0x15')]);router[_0xafd7('0x14')](_0xafd7('0x16'),auth[_0xafd7('0xa')](),controller[_0xafd7('0x17')]);router[_0xafd7('0x18')]('/:id',auth[_0xafd7('0xa')](),controller[_0xafd7('0x19')]);module[_0xafd7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 70e5244..ce3a452 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 _0x77d9=['STRING','DATE','TEXT','BOOLEAN','ENUM','out'];(function(_0x5ba74f,_0x200bf4){var _0x534d79=function(_0x50521a){while(--_0x50521a){_0x5ba74f['push'](_0x5ba74f['shift']());}};_0x534d79(++_0x200bf4);}(_0x77d9,0x159));var _0x977d=function(_0xe1b102,_0x542a72){_0xe1b102=_0xe1b102-0x0;var _0xed6dcc=_0x77d9[_0xe1b102];return _0xed6dcc;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x977d('0x0')],'defaultValue':![]},'direction':{'type':Sequelize[_0x977d('0x1')]('in','out'),'defaultValue':_0x977d('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x977d('0x3')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x977d('0x4')]},'secret':{'type':Sequelize[_0x977d('0x0')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x977d('0x5')]}}; \ No newline at end of file +var _0x074c=['DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x074c,0x9b));var _0xc074=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0x074c[_0xb24fad];return _0x173226;};'use strict';var Sequelize=require(_0xc074('0x0'));module[_0xc074('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc074('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc074('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc074('0x4')]('in','out'),'defaultValue':_0xc074('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc074('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xc074('0x7')]},'secret':{'type':Sequelize[_0xc074('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc074('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 4bf5ad3..ee35b53 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 _0x872d=['findAll','rows','show','params','rawAttributes','include','create','body','update','find','describe','accept','whatsapp','reject','UserId','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','whatsapp-interactions','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappMessage','includeAll'];(function(_0x539c90,_0x3087ac){var _0x3656c9=function(_0x5bf35e){while(--_0x5bf35e){_0x539c90['push'](_0x539c90['shift']());}};_0x3656c9(++_0x3087ac);}(_0x872d,0x116));var _0xd872=function(_0x5c5b53,_0x5c8b34){_0x5c5b53=_0x5c5b53-0x0;var _0x549078=_0x872d[_0x5c5b53];return _0x549078;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0xd872('0x0'));var interactionService=require('../../components/interaction/service');var qs=require(_0xd872('0x1'));var logger=require(_0xd872('0x2'))(_0xd872('0x3'));var config=require(_0xd872('0x4'));var db=require(_0xd872('0x5'))['db'];config[_0xd872('0x6')]=_[_0xd872('0x7')](config['redis'],{'host':_0xd872('0x8'),'port':0x18eb});var socket=require(_0xd872('0x9'))(new Redis(config[_0xd872('0x6')]));require(_0xd872('0xa'))[_0xd872('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd872('0xc')][_0xd872('0xd')]({'port':0x232c});var client9002=jayson[_0xd872('0xc')]['http']({'port':0x232a});var interaction_log=require(_0xd872('0x2'))(_0xd872('0xe'));function respondWithRpcPromise(_0x86c3b,_0x4740ac,_0x179784,_0x6a54e8){return new Promise(function(_0x9782cb,_0x784504){var _0x43c25b=_0x6a54e8||client;return _0x43c25b['request'](_0x86c3b,_0x179784)['then'](function(_0x2db58a){logger['info'](_0xd872('0xf'),_0x4740ac,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4740ac,_0xd872('0x10'),JSON[_0xd872('0x11')](_0x2db58a));if(_0x2db58a[_0xd872('0x12')]){if(_0x2db58a[_0xd872('0x12')]['code']===0x1f4){logger[_0xd872('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x4740ac,_0x2db58a[_0xd872('0x12')][_0xd872('0x13')]);return _0x784504(_0x2db58a['error']['message']);}logger[_0xd872('0x12')](_0xd872('0xf'),_0x4740ac,_0x2db58a[_0xd872('0x12')][_0xd872('0x13')]);return _0x9782cb(_0x2db58a[_0xd872('0x12')][_0xd872('0x13')]);}else{logger[_0xd872('0x14')](_0xd872('0xf'),_0x4740ac,_0xd872('0x10'));_0x9782cb(_0x2db58a[_0xd872('0x15')]['message']);}})[_0xd872('0x16')](function(_0xcad24f){logger[_0xd872('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x4740ac,_0xcad24f);_0x784504(_0xcad24f);});});}function respondWithResult(_0x391520,_0x3abe88){_0x3abe88=_0x3abe88||0xc8;return function(_0x34d768){if(_0x34d768){return _0x391520[_0xd872('0x17')](_0x3abe88)[_0xd872('0x18')](_0x34d768);}};}function respondWithFilteredResult(_0x533866,_0x4a935b){return function(_0x387042){if(_0x387042){var _0x4cdcac=typeof _0x4a935b[_0xd872('0x19')]===_0xd872('0x1a')&&typeof _0x4a935b[_0xd872('0x1b')]===_0xd872('0x1a');var _0x48b65f=_0x387042[_0xd872('0x1c')];var _0x4a0a4c=_0x4cdcac?0x0:_0x4a935b['offset'];var _0x461a93=_0x4cdcac?_0x387042[_0xd872('0x1c')]:_0x4a935b[_0xd872('0x19')]+_0x4a935b[_0xd872('0x1b')];var _0x81e98a;if(_0x461a93>=_0x48b65f){_0x461a93=_0x48b65f;_0x81e98a=0xc8;}else{_0x81e98a=0xce;}_0x533866[_0xd872('0x17')](_0x81e98a);return _0x533866[_0xd872('0x1d')](_0xd872('0x1e'),_0x4a0a4c+'-'+_0x461a93+'/'+_0x48b65f)[_0xd872('0x18')](_0x387042);}return null;};}function saveUpdates(_0x13de12){return function(_0x566eff){if(_0x566eff){return _0x566eff['update'](_0x13de12)[_0xd872('0x1f')](function(_0x104cbd){return _0x104cbd;});}return null;};}function removeEntity(_0x28b6c3){return function(_0x3ba643){if(_0x3ba643){return _0x3ba643[_0xd872('0x20')]()['then'](function(){_0x28b6c3[_0xd872('0x17')](0xcc)[_0xd872('0x21')]();});}};}function handleEntityNotFound(_0x2b2bb8){return function(_0x5cdef7){if(!_0x5cdef7){_0x2b2bb8['sendStatus'](0x194);}return _0x5cdef7;};}function handleError(_0xb8a1b8,_0x152d9a){_0x152d9a=_0x152d9a||0x1f4;return function(_0x16d728){logger[_0xd872('0x12')](_0x16d728[_0xd872('0x22')]);if(_0x16d728[_0xd872('0x23')]){delete _0x16d728[_0xd872('0x23')];}_0xb8a1b8['status'](_0x152d9a)[_0xd872('0x24')](_0x16d728);};}exports[_0xd872('0x25')]=function(_0x1f21e0,_0x2fa246){var _0x1c19a9={},_0x4fdf8c={},_0x49781b={'count':0x0,'rows':[]};var _0x530f98=_[_0xd872('0x26')](db['WhatsappMessage']['rawAttributes'],function(_0x4b6c72){return{'name':_0x4b6c72['fieldName'],'type':_0x4b6c72['type'][_0xd872('0x27')]};});_0x4fdf8c[_0xd872('0x28')]=_[_0xd872('0x26')](_0x530f98,_0xd872('0x23'));_0x4fdf8c[_0xd872('0x29')]=_[_0xd872('0x2a')](_0x1f21e0[_0xd872('0x29')]);_0x4fdf8c[_0xd872('0x2b')]=_[_0xd872('0x2c')](_0x4fdf8c[_0xd872('0x28')],_0x4fdf8c[_0xd872('0x29')]);_0x1c19a9[_0xd872('0x2d')]=_[_0xd872('0x2c')](_0x4fdf8c[_0xd872('0x28')],qs[_0xd872('0x2e')](_0x1f21e0['query'][_0xd872('0x2e')]));_0x1c19a9[_0xd872('0x2d')]=_0x1c19a9[_0xd872('0x2d')][_0xd872('0x2f')]?_0x1c19a9[_0xd872('0x2d')]:_0x4fdf8c['model'];if(!_0x1f21e0[_0xd872('0x29')][_0xd872('0x30')](_0xd872('0x31'))){_0x1c19a9[_0xd872('0x1b')]=qs[_0xd872('0x1b')](_0x1f21e0[_0xd872('0x29')][_0xd872('0x1b')]);_0x1c19a9['offset']=qs[_0xd872('0x19')](_0x1f21e0[_0xd872('0x29')]['offset']);}_0x1c19a9[_0xd872('0x32')]=qs[_0xd872('0x33')](_0x1f21e0[_0xd872('0x29')]['sort']);_0x1c19a9[_0xd872('0x34')]=qs[_0xd872('0x2b')](_[_0xd872('0x35')](_0x1f21e0[_0xd872('0x29')],_0x4fdf8c[_0xd872('0x2b')]),_0x530f98);if(_0x1f21e0['query'][_0xd872('0x36')]){_0x1c19a9[_0xd872('0x34')]=_[_0xd872('0x37')](_0x1c19a9[_0xd872('0x34')],{'$or':_[_0xd872('0x26')](_0x530f98,function(_0x43199e){if(_0x43199e[_0xd872('0x38')]!==_0xd872('0x39')){var _0x5b6149={};_0x5b6149[_0x43199e[_0xd872('0x23')]]={'$like':'%'+_0x1f21e0['query'][_0xd872('0x36')]+'%'};return _0x5b6149;}})});}_0x1c19a9=_[_0xd872('0x37')]({},_0x1c19a9,_0x1f21e0[_0xd872('0x3a')]);var _0x4472d8={'where':_0x1c19a9[_0xd872('0x34')]};return db[_0xd872('0x3b')]['count'](_0x4472d8)[_0xd872('0x1f')](function(_0x2587f7){_0x49781b[_0xd872('0x1c')]=_0x2587f7;if(_0x1f21e0['query'][_0xd872('0x3c')]){_0x1c19a9['include']=[{'all':!![]}];}return db[_0xd872('0x3b')][_0xd872('0x3d')](_0x1c19a9);})[_0xd872('0x1f')](function(_0x4a7fd5){_0x49781b[_0xd872('0x3e')]=_0x4a7fd5;return _0x49781b;})[_0xd872('0x1f')](respondWithFilteredResult(_0x2fa246,_0x1c19a9))[_0xd872('0x16')](handleError(_0x2fa246,null));};exports[_0xd872('0x3f')]=function(_0x75deb9,_0x50cde3){var _0x4f8d0c={'raw':!![],'where':{'id':_0x75deb9[_0xd872('0x40')]['id']}},_0xca0550={};_0xca0550[_0xd872('0x28')]=_[_0xd872('0x2a')](db[_0xd872('0x3b')][_0xd872('0x41')]);_0xca0550['query']=_[_0xd872('0x2a')](_0x75deb9['query']);_0xca0550['filters']=_[_0xd872('0x2c')](_0xca0550[_0xd872('0x28')],_0xca0550[_0xd872('0x29')]);_0x4f8d0c[_0xd872('0x2d')]=_[_0xd872('0x2c')](_0xca0550[_0xd872('0x28')],qs[_0xd872('0x2e')](_0x75deb9[_0xd872('0x29')][_0xd872('0x2e')]));_0x4f8d0c[_0xd872('0x2d')]=_0x4f8d0c[_0xd872('0x2d')]['length']?_0x4f8d0c[_0xd872('0x2d')]:_0xca0550['model'];if(_0x75deb9[_0xd872('0x29')]['includeAll']){_0x4f8d0c[_0xd872('0x42')]=[{'all':!![]}];}_0x4f8d0c=_[_0xd872('0x37')]({},_0x4f8d0c,_0x75deb9['options']);return db[_0xd872('0x3b')]['find'](_0x4f8d0c)[_0xd872('0x1f')](handleEntityNotFound(_0x50cde3,null))[_0xd872('0x1f')](respondWithResult(_0x50cde3,null))[_0xd872('0x16')](handleError(_0x50cde3,null));};exports[_0xd872('0x43')]=function(_0x42689f,_0x5c7e57){return db[_0xd872('0x3b')][_0xd872('0x43')](_0x42689f[_0xd872('0x44')],{})[_0xd872('0x1f')](respondWithResult(_0x5c7e57,0xc9))[_0xd872('0x16')](handleError(_0x5c7e57,null));};exports[_0xd872('0x45')]=function(_0x3de605,_0x1bf72c){if(_0x3de605[_0xd872('0x44')]['id']){delete _0x3de605[_0xd872('0x44')]['id'];}return db['WhatsappMessage'][_0xd872('0x46')]({'where':{'id':_0x3de605[_0xd872('0x40')]['id']}})[_0xd872('0x1f')](handleEntityNotFound(_0x1bf72c,null))[_0xd872('0x1f')](saveUpdates(_0x3de605[_0xd872('0x44')],null))['then'](respondWithResult(_0x1bf72c,null))[_0xd872('0x16')](handleError(_0x1bf72c,null));};exports[_0xd872('0x20')]=function(_0x4e415a,_0x13c6bc){return db[_0xd872('0x3b')]['find']({'where':{'id':_0x4e415a[_0xd872('0x40')]['id']}})['then'](handleEntityNotFound(_0x13c6bc,null))[_0xd872('0x1f')](removeEntity(_0x13c6bc,null))[_0xd872('0x16')](handleError(_0x13c6bc,null));};exports[_0xd872('0x47')]=function(_0x296a41,_0x34a572){return db[_0xd872('0x3b')][_0xd872('0x47')]()[_0xd872('0x1f')](respondWithResult(_0x34a572,null))[_0xd872('0x16')](handleError(_0x34a572,null));};exports[_0xd872('0x48')]=function(_0x1f1d0b,_0x40f087){var _0x3c69be=_0xd872('0x49');return interactionService['acceptMessage'](_0x1f1d0b,_0x3c69be)[_0xd872('0x1f')](respondWithResult(_0x40f087,null))[_0xd872('0x16')](handleError(_0x40f087,null));};exports[_0xd872('0x4a')]=function(_0x1da5ae,_0x48ba15){var _0x4d14b7={'agent':{},'channel':_0xd872('0x49')};if(_0x1da5ae[_0xd872('0x44')]['id']){delete _0x1da5ae['body']['id'];}_0x1da5ae[_0xd872('0x44')][_0xd872('0x4b')]=_0x1da5ae[_0xd872('0x44')][_0xd872('0x4b')]||_0x1da5ae['user']['id'];_0x4d14b7['agent']['id']=_0x1da5ae['body'][_0xd872('0x4b')];return db[_0xd872('0x3b')][_0xd872('0x46')]({'where':{'id':_0x1da5ae[_0xd872('0x40')]['id'],'UserId':null}})[_0xd872('0x1f')](handleEntityNotFound(_0x48ba15,null))['then'](function(_0x3037ca){if(_0x3037ca){_0x4d14b7[_0xd872('0x13')]=_0x3037ca[_0xd872('0x4c')]({'plain':!![]});return db[_0xd872('0x4d')][_0xd872('0x46')]({'where':{'id':_0x3037ca[_0xd872('0x4e')]}});}return null;})['then'](handleEntityNotFound(_0x48ba15,null))['then'](function(_0x1add3d){if(_0x1add3d){_0x4d14b7[_0xd872('0x4f')]=_0x1add3d['get']({'plain':!![]});interaction_log['info'](_0xd872('0x50'),_0x1da5ae[_0xd872('0x51')]['id'],_0x1da5ae['user'][_0xd872('0x23')],_0x1da5ae['user'][_0xd872('0x52')],_0x4d14b7[_0xd872('0x4f')]['id'],_0x1da5ae[_0xd872('0x44')]?JSON[_0xd872('0x11')](_0x1da5ae['body']):_0xd872('0x53'));return respondWithRpcPromise(_0xd872('0x54'),_0xd872('0x55'),_0x4d14b7);}return null;})[_0xd872('0x1f')](function(_0x596d19){var _0x2d9cf6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x596d19['message'][_0xd872('0x56')];return db[_0xd872('0x57')][_0xd872('0x29')](_0x2d9cf6,{'type':db[_0xd872('0x58')][_0xd872('0x59')][_0xd872('0x5a')],'raw':!![]})[_0xd872('0x1f')](function(_0x158f52){return _0x158f52;});})['then'](function(_0x4e869f){if(_0x4e869f){_0x4d14b7['message'][_0xd872('0x5b')]=_0x4e869f[0x0];if(!_0x1da5ae[_0xd872('0x44')][_0xd872('0x4b')])return;return db[_0xd872('0x5c')]['find']({'where':{'id':_0x1da5ae[_0xd872('0x44')][_0xd872('0x4b')],'role':_0xd872('0x5d')},'attributes':['id',_0xd872('0x23'),'fullname','email',_0xd872('0x5e')],'raw':!![]});}return null;})[_0xd872('0x1f')](function(_0x4f0428){if(!_0x4f0428)return null;_0x4d14b7[_0xd872('0x13')][_0xd872('0x5d')]=_0x4f0428;return _0x4d14b7;})[_0xd872('0x1f')](function(_0x4e073a){if(_0x4e073a){_0x4e073a[_0xd872('0x13')][_0xd872('0x5f')]=util[_0xd872('0x60')](_0xd872('0x61'),_0x1da5ae[_0xd872('0x51')][_0xd872('0x23')]);_0x4e073a[_0xd872('0x13')][_0xd872('0x62')]=_0x4d14b7['channel'];_0x4e073a[_0xd872('0x13')][_0xd872('0x63')]=_0x4d14b7[_0xd872('0x62')];_0x4e073a['message'][_0xd872('0x64')]=_0xd872('0x4a');respondWithRpcPromise('EventManager',_0xd872('0x65'),{'event':_0xd872('0x66'),'message':_0x4e073a['message']},client9002);return _0x4d14b7;}return null;})[_0xd872('0x1f')](respondWithResult(_0x48ba15,null))[_0xd872('0x16')](handleError(_0x48ba15,null));};exports[_0xd872('0x17')]=function(_0x12779d,_0xd2b3b4){if(_0x12779d['body']['id']){delete _0x12779d[_0xd872('0x44')]['id'];}var _0x1d9ffe;return db[_0xd872('0x3b')][_0xd872('0x46')]({'where':{'id':_0x12779d[_0xd872('0x40')]['id']}})[_0xd872('0x1f')](handleEntityNotFound(_0xd2b3b4,null))[_0xd872('0x1f')](function(_0x2ca832){if(_0x2ca832){_0x1d9ffe=_0x2ca832;return db[_0xd872('0x67')][_0xd872('0x46')]({'where':{'id':_0x2ca832[_0xd872('0x68')]}});}})[_0xd872('0x1f')](handleEntityNotFound(_0xd2b3b4,null))['then'](function(_0x4a68bb){if(_0x4a68bb){logger[_0xd872('0x69')](_0xd872('0x6a'),_0xd872('0x17'),'received\x20delivery\x20report\x20from',_0x4a68bb['type'],util[_0xd872('0x6b')](_0x12779d[_0xd872('0x44')],{'showHidden':![],'depth':null}));switch(_0x4a68bb[_0xd872('0x38')]){case'twilio':if(_0x12779d['body']['MessageSid']&&_0x12779d['body']['MessageSid']===_0x1d9ffe[_0xd872('0x6c')]&&_0x12779d['body'][_0xd872('0x6d')]&&_0x12779d[_0xd872('0x44')][_0xd872('0x6d')]===_0xd872('0x6e')){return _0x1d9ffe[_0xd872('0x45')]({'read':!![]});}else{logger[_0xd872('0x12')](_0xd872('0x6f'),_0xd872('0x17'),_0xd872('0x70'),util['inspect'](_0x12779d[_0xd872('0x44')],{'showHidden':![],'depth':null}));}break;}return _0x1d9ffe;}})[_0xd872('0x1f')](respondWithResult(_0xd2b3b4,null))['catch'](handleError(_0xd2b3b4,null));}; \ No newline at end of file +var _0x8e6e=['client','http','../../config/logger','whatsapp-interactions','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','undefined','limit','count','offset','status','set','Content-Range','then','destroy','end','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','show','params','find','create','update','body','describe','acceptMessage','whatsapp','UserId','user','agent','WhatsappInteraction','interaction','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','email','internal','interface','format','SIP/%s','channel','event','EventManager','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','twilio','util','ioredis','../../components/interaction/service','redis','localhost','socket.io-emitter','register','jayson/promise'];(function(_0x1c4f81,_0xc5941){var _0x56e074=function(_0x363217){while(--_0x363217){_0x1c4f81['push'](_0x1c4f81['shift']());}};_0x56e074(++_0xc5941);}(_0x8e6e,0xc8));var _0xe8e6=function(_0x40d627,_0x1276e4){_0x40d627=_0x40d627-0x0;var _0x4c3ab7=_0x8e6e[_0x40d627];return _0x4c3ab7;};'use strict';var util=require(_0xe8e6('0x0'));var _=require('lodash');var Redis=require(_0xe8e6('0x1'));var interactionService=require(_0xe8e6('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe8e6('0x3')]=_['defaults'](config[_0xe8e6('0x3')],{'host':_0xe8e6('0x4'),'port':0x18eb});var socket=require(_0xe8e6('0x5'))(new Redis(config[_0xe8e6('0x3')]));require('./whatsappMessage.socket')[_0xe8e6('0x6')](socket);var jayson=require(_0xe8e6('0x7'));var client=jayson[_0xe8e6('0x8')]['http']({'port':0x232c});var client9002=jayson[_0xe8e6('0x8')][_0xe8e6('0x9')]({'port':0x232a});var interaction_log=require(_0xe8e6('0xa'))(_0xe8e6('0xb'));function respondWithRpcPromise(_0x2c85b8,_0x1037fa,_0x52bf5c,_0x7a47d6){return new Promise(function(_0x2f1673,_0x19528a){var _0x111fe5=_0x7a47d6||client;return _0x111fe5[_0xe8e6('0xc')](_0x2c85b8,_0x52bf5c)['then'](function(_0x38cbaa){logger[_0xe8e6('0xd')](_0xe8e6('0xe'),_0x1037fa,_0xe8e6('0xf'));logger[_0xe8e6('0x10')](_0xe8e6('0x11'),_0x1037fa,'request\x20sent',JSON['stringify'](_0x38cbaa));if(_0x38cbaa[_0xe8e6('0x12')]){if(_0x38cbaa[_0xe8e6('0x12')][_0xe8e6('0x13')]===0x1f4){logger[_0xe8e6('0x12')](_0xe8e6('0xe'),_0x1037fa,_0x38cbaa[_0xe8e6('0x12')]['message']);return _0x19528a(_0x38cbaa[_0xe8e6('0x12')][_0xe8e6('0x14')]);}logger[_0xe8e6('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x1037fa,_0x38cbaa[_0xe8e6('0x12')]['message']);return _0x2f1673(_0x38cbaa[_0xe8e6('0x12')][_0xe8e6('0x14')]);}else{logger[_0xe8e6('0xd')](_0xe8e6('0xe'),_0x1037fa,'request\x20sent');_0x2f1673(_0x38cbaa[_0xe8e6('0x15')][_0xe8e6('0x14')]);}})[_0xe8e6('0x16')](function(_0x3e3ab9){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1037fa,_0x3e3ab9);_0x19528a(_0x3e3ab9);});});}function respondWithResult(_0x451d66,_0x59fbca){_0x59fbca=_0x59fbca||0xc8;return function(_0x2ff44c){if(_0x2ff44c){return _0x451d66['status'](_0x59fbca)[_0xe8e6('0x17')](_0x2ff44c);}};}function respondWithFilteredResult(_0x47a9b4,_0x1537ff){return function(_0x57b201){if(_0x57b201){var _0x1a5697=typeof _0x1537ff['offset']===_0xe8e6('0x18')&&typeof _0x1537ff[_0xe8e6('0x19')]===_0xe8e6('0x18');var _0x394d9c=_0x57b201[_0xe8e6('0x1a')];var _0x4fad20=_0x1a5697?0x0:_0x1537ff[_0xe8e6('0x1b')];var _0x3efd39=_0x1a5697?_0x57b201[_0xe8e6('0x1a')]:_0x1537ff[_0xe8e6('0x1b')]+_0x1537ff[_0xe8e6('0x19')];var _0x50cb08;if(_0x3efd39>=_0x394d9c){_0x3efd39=_0x394d9c;_0x50cb08=0xc8;}else{_0x50cb08=0xce;}_0x47a9b4[_0xe8e6('0x1c')](_0x50cb08);return _0x47a9b4[_0xe8e6('0x1d')](_0xe8e6('0x1e'),_0x4fad20+'-'+_0x3efd39+'/'+_0x394d9c)[_0xe8e6('0x17')](_0x57b201);}return null;};}function saveUpdates(_0x1bda8b){return function(_0x39a812){if(_0x39a812){return _0x39a812['update'](_0x1bda8b)[_0xe8e6('0x1f')](function(_0xf0ebf2){return _0xf0ebf2;});}return null;};}function removeEntity(_0x14eba6){return function(_0x26f0d4){if(_0x26f0d4){return _0x26f0d4[_0xe8e6('0x20')]()[_0xe8e6('0x1f')](function(){_0x14eba6[_0xe8e6('0x1c')](0xcc)[_0xe8e6('0x21')]();});}};}function handleEntityNotFound(_0x3d35ee){return function(_0x1ea97c){if(!_0x1ea97c){_0x3d35ee[_0xe8e6('0x22')](0x194);}return _0x1ea97c;};}function handleError(_0x139e4f,_0x266438){_0x266438=_0x266438||0x1f4;return function(_0x4e607f){logger[_0xe8e6('0x12')](_0x4e607f[_0xe8e6('0x23')]);if(_0x4e607f[_0xe8e6('0x24')]){delete _0x4e607f[_0xe8e6('0x24')];}_0x139e4f[_0xe8e6('0x1c')](_0x266438)[_0xe8e6('0x25')](_0x4e607f);};}exports[_0xe8e6('0x26')]=function(_0x30f2a2,_0x13ff06){var _0x4816e7={},_0x509826={},_0x45571d={'count':0x0,'rows':[]};var _0x46e6bc=_[_0xe8e6('0x27')](db[_0xe8e6('0x28')][_0xe8e6('0x29')],function(_0x53c1b5){return{'name':_0x53c1b5['fieldName'],'type':_0x53c1b5[_0xe8e6('0x2a')]['key']};});_0x509826[_0xe8e6('0x2b')]=_['map'](_0x46e6bc,'name');_0x509826[_0xe8e6('0x2c')]=_[_0xe8e6('0x2d')](_0x30f2a2[_0xe8e6('0x2c')]);_0x509826[_0xe8e6('0x2e')]=_[_0xe8e6('0x2f')](_0x509826[_0xe8e6('0x2b')],_0x509826[_0xe8e6('0x2c')]);_0x4816e7['attributes']=_[_0xe8e6('0x2f')](_0x509826[_0xe8e6('0x2b')],qs[_0xe8e6('0x30')](_0x30f2a2[_0xe8e6('0x2c')]['fields']));_0x4816e7[_0xe8e6('0x31')]=_0x4816e7[_0xe8e6('0x31')][_0xe8e6('0x32')]?_0x4816e7['attributes']:_0x509826[_0xe8e6('0x2b')];if(!_0x30f2a2[_0xe8e6('0x2c')][_0xe8e6('0x33')](_0xe8e6('0x34'))){_0x4816e7[_0xe8e6('0x19')]=qs[_0xe8e6('0x19')](_0x30f2a2[_0xe8e6('0x2c')][_0xe8e6('0x19')]);_0x4816e7[_0xe8e6('0x1b')]=qs['offset'](_0x30f2a2[_0xe8e6('0x2c')][_0xe8e6('0x1b')]);}_0x4816e7[_0xe8e6('0x35')]=qs[_0xe8e6('0x36')](_0x30f2a2[_0xe8e6('0x2c')]['sort']);_0x4816e7[_0xe8e6('0x37')]=qs['filters'](_['pick'](_0x30f2a2[_0xe8e6('0x2c')],_0x509826['filters']),_0x46e6bc);if(_0x30f2a2[_0xe8e6('0x2c')][_0xe8e6('0x38')]){_0x4816e7['where']=_[_0xe8e6('0x39')](_0x4816e7['where'],{'$or':_['map'](_0x46e6bc,function(_0xd9d783){if(_0xd9d783[_0xe8e6('0x2a')]!=='VIRTUAL'){var _0x29eade={};_0x29eade[_0xd9d783['name']]={'$like':'%'+_0x30f2a2[_0xe8e6('0x2c')]['filter']+'%'};return _0x29eade;}})});}_0x4816e7=_[_0xe8e6('0x39')]({},_0x4816e7,_0x30f2a2[_0xe8e6('0x3a')]);var _0x3e0a42={'where':_0x4816e7['where']};return db[_0xe8e6('0x28')][_0xe8e6('0x1a')](_0x3e0a42)[_0xe8e6('0x1f')](function(_0x411518){_0x45571d['count']=_0x411518;if(_0x30f2a2[_0xe8e6('0x2c')][_0xe8e6('0x3b')]){_0x4816e7[_0xe8e6('0x3c')]=[{'all':!![]}];}return db[_0xe8e6('0x28')][_0xe8e6('0x3d')](_0x4816e7);})['then'](function(_0x5d82d7){_0x45571d['rows']=_0x5d82d7;return _0x45571d;})[_0xe8e6('0x1f')](respondWithFilteredResult(_0x13ff06,_0x4816e7))[_0xe8e6('0x16')](handleError(_0x13ff06,null));};exports[_0xe8e6('0x3e')]=function(_0x107848,_0x349a7e){var _0x479fb1={'raw':!![],'where':{'id':_0x107848[_0xe8e6('0x3f')]['id']}},_0x2634b0={};_0x2634b0[_0xe8e6('0x2b')]=_[_0xe8e6('0x2d')](db['WhatsappMessage']['rawAttributes']);_0x2634b0['query']=_[_0xe8e6('0x2d')](_0x107848[_0xe8e6('0x2c')]);_0x2634b0[_0xe8e6('0x2e')]=_['intersection'](_0x2634b0[_0xe8e6('0x2b')],_0x2634b0['query']);_0x479fb1[_0xe8e6('0x31')]=_['intersection'](_0x2634b0[_0xe8e6('0x2b')],qs[_0xe8e6('0x30')](_0x107848[_0xe8e6('0x2c')][_0xe8e6('0x30')]));_0x479fb1[_0xe8e6('0x31')]=_0x479fb1[_0xe8e6('0x31')][_0xe8e6('0x32')]?_0x479fb1[_0xe8e6('0x31')]:_0x2634b0['model'];if(_0x107848[_0xe8e6('0x2c')][_0xe8e6('0x3b')]){_0x479fb1[_0xe8e6('0x3c')]=[{'all':!![]}];}_0x479fb1=_[_0xe8e6('0x39')]({},_0x479fb1,_0x107848[_0xe8e6('0x3a')]);return db[_0xe8e6('0x28')][_0xe8e6('0x40')](_0x479fb1)['then'](handleEntityNotFound(_0x349a7e,null))[_0xe8e6('0x1f')](respondWithResult(_0x349a7e,null))['catch'](handleError(_0x349a7e,null));};exports[_0xe8e6('0x41')]=function(_0xe5ecb8,_0x55e7d1){return db['WhatsappMessage'][_0xe8e6('0x41')](_0xe5ecb8['body'],{})[_0xe8e6('0x1f')](respondWithResult(_0x55e7d1,0xc9))[_0xe8e6('0x16')](handleError(_0x55e7d1,null));};exports[_0xe8e6('0x42')]=function(_0x2c7846,_0x18db2e){if(_0x2c7846[_0xe8e6('0x43')]['id']){delete _0x2c7846['body']['id'];}return db[_0xe8e6('0x28')][_0xe8e6('0x40')]({'where':{'id':_0x2c7846[_0xe8e6('0x3f')]['id']}})[_0xe8e6('0x1f')](handleEntityNotFound(_0x18db2e,null))['then'](saveUpdates(_0x2c7846['body'],null))[_0xe8e6('0x1f')](respondWithResult(_0x18db2e,null))['catch'](handleError(_0x18db2e,null));};exports[_0xe8e6('0x20')]=function(_0x17591d,_0x4926dd){return db[_0xe8e6('0x28')][_0xe8e6('0x40')]({'where':{'id':_0x17591d['params']['id']}})[_0xe8e6('0x1f')](handleEntityNotFound(_0x4926dd,null))[_0xe8e6('0x1f')](removeEntity(_0x4926dd,null))['catch'](handleError(_0x4926dd,null));};exports[_0xe8e6('0x44')]=function(_0x1c7789,_0x5248ae){return db[_0xe8e6('0x28')][_0xe8e6('0x44')]()['then'](respondWithResult(_0x5248ae,null))[_0xe8e6('0x16')](handleError(_0x5248ae,null));};exports['accept']=function(_0x520fda,_0x50b498){var _0x3862f3='whatsapp';return interactionService[_0xe8e6('0x45')](_0x520fda,_0x3862f3)[_0xe8e6('0x1f')](respondWithResult(_0x50b498,null))['catch'](handleError(_0x50b498,null));};exports['reject']=function(_0x4ee74d,_0x14c350){var _0x3a4c80={'agent':{},'channel':_0xe8e6('0x46')};if(_0x4ee74d[_0xe8e6('0x43')]['id']){delete _0x4ee74d[_0xe8e6('0x43')]['id'];}_0x4ee74d[_0xe8e6('0x43')][_0xe8e6('0x47')]=_0x4ee74d[_0xe8e6('0x43')][_0xe8e6('0x47')]||_0x4ee74d[_0xe8e6('0x48')]['id'];_0x3a4c80[_0xe8e6('0x49')]['id']=_0x4ee74d['body']['UserId'];return db[_0xe8e6('0x28')][_0xe8e6('0x40')]({'where':{'id':_0x4ee74d[_0xe8e6('0x3f')]['id'],'UserId':null}})[_0xe8e6('0x1f')](handleEntityNotFound(_0x14c350,null))[_0xe8e6('0x1f')](function(_0x1887b7){if(_0x1887b7){_0x3a4c80[_0xe8e6('0x14')]=_0x1887b7['get']({'plain':!![]});return db[_0xe8e6('0x4a')][_0xe8e6('0x40')]({'where':{'id':_0x1887b7['WhatsappInteractionId']}});}return null;})[_0xe8e6('0x1f')](handleEntityNotFound(_0x14c350,null))[_0xe8e6('0x1f')](function(_0x21ed0c){if(_0x21ed0c){_0x3a4c80[_0xe8e6('0x4b')]=_0x21ed0c[_0xe8e6('0x4c')]({'plain':!![]});interaction_log['info'](_0xe8e6('0x4d'),_0x4ee74d[_0xe8e6('0x48')]['id'],_0x4ee74d['user'][_0xe8e6('0x24')],_0x4ee74d[_0xe8e6('0x48')][_0xe8e6('0x4e')],_0x3a4c80['interaction']['id'],_0x4ee74d['body']?JSON['stringify'](_0x4ee74d[_0xe8e6('0x43')]):'null');return respondWithRpcPromise(_0xe8e6('0x4f'),_0xe8e6('0x50'),_0x3a4c80);}return null;})[_0xe8e6('0x1f')](function(_0x3c8ff6){var _0x5931ff=_0xe8e6('0x51')+_0x3c8ff6['message'][_0xe8e6('0x52')];return db[_0xe8e6('0x53')]['query'](_0x5931ff,{'type':db[_0xe8e6('0x54')]['QueryTypes'][_0xe8e6('0x55')],'raw':!![]})['then'](function(_0x225592){return _0x225592;});})['then'](function(_0x298ea3){if(_0x298ea3){_0x3a4c80['message']['contact']=_0x298ea3[0x0];if(!_0x4ee74d[_0xe8e6('0x43')][_0xe8e6('0x47')])return;return db[_0xe8e6('0x56')]['find']({'where':{'id':_0x4ee74d['body']['UserId'],'role':'agent'},'attributes':['id',_0xe8e6('0x24'),'fullname',_0xe8e6('0x57'),_0xe8e6('0x58')],'raw':!![]});}return null;})['then'](function(_0x76f69c){if(!_0x76f69c)return null;_0x3a4c80['message'][_0xe8e6('0x49')]=_0x76f69c;return _0x3a4c80;})[_0xe8e6('0x1f')](function(_0x3bf84a){if(_0x3bf84a){_0x3bf84a['message'][_0xe8e6('0x59')]=util[_0xe8e6('0x5a')](_0xe8e6('0x5b'),_0x4ee74d[_0xe8e6('0x48')][_0xe8e6('0x24')]);_0x3bf84a[_0xe8e6('0x14')][_0xe8e6('0x5c')]=_0x3a4c80[_0xe8e6('0x5c')];_0x3bf84a[_0xe8e6('0x14')]['motionChannel']=_0x3a4c80[_0xe8e6('0x5c')];_0x3bf84a['message'][_0xe8e6('0x5d')]='reject';respondWithRpcPromise(_0xe8e6('0x5e'),_0xe8e6('0x5e'),{'event':'rejectmessage','message':_0x3bf84a[_0xe8e6('0x14')]},client9002);return _0x3a4c80;}return null;})['then'](respondWithResult(_0x14c350,null))[_0xe8e6('0x16')](handleError(_0x14c350,null));};exports[_0xe8e6('0x1c')]=function(_0x36bf0b,_0x12510c){if(_0x36bf0b['body']['id']){delete _0x36bf0b['body']['id'];}var _0x3221e8;return db[_0xe8e6('0x28')][_0xe8e6('0x40')]({'where':{'id':_0x36bf0b[_0xe8e6('0x3f')]['id']}})[_0xe8e6('0x1f')](handleEntityNotFound(_0x12510c,null))['then'](function(_0x45dd27){if(_0x45dd27){_0x3221e8=_0x45dd27;return db[_0xe8e6('0x5f')][_0xe8e6('0x40')]({'where':{'id':_0x45dd27[_0xe8e6('0x60')]}});}})[_0xe8e6('0x1f')](handleEntityNotFound(_0x12510c,null))['then'](function(_0x3c72fc){if(_0x3c72fc){logger[_0xe8e6('0x10')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xe8e6('0x1c'),_0xe8e6('0x61'),_0x3c72fc['type'],util[_0xe8e6('0x62')](_0x36bf0b[_0xe8e6('0x43')],{'showHidden':![],'depth':null}));switch(_0x3c72fc[_0xe8e6('0x2a')]){case'twilio':if(_0x36bf0b[_0xe8e6('0x43')]['MessageSid']&&_0x36bf0b[_0xe8e6('0x43')][_0xe8e6('0x63')]===_0x3221e8[_0xe8e6('0x64')]&&_0x36bf0b[_0xe8e6('0x43')]['MessageStatus']&&_0x36bf0b['body'][_0xe8e6('0x65')]===_0xe8e6('0x66')){return _0x3221e8['update']({'read':!![]});}else{logger[_0xe8e6('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe8e6('0x1c'),_0xe8e6('0x67'),util['inspect'](_0x36bf0b[_0xe8e6('0x43')],{'showHidden':![],'depth':null}));}break;}return _0x3221e8;}})['then'](respondWithResult(_0x12510c,null))[_0xe8e6('0x16')](handleError(_0x12510c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index f8e348d..453d726 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 _0x594d=['setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x5b23c9,_0x501087){var _0x3ebbc7=function(_0x1e2bcf){while(--_0x1e2bcf){_0x5b23c9['push'](_0x5b23c9['shift']());}};_0x3ebbc7(++_0x501087);}(_0x594d,0x92));var _0xd594=function(_0x3195a1,_0x412b38){_0x3195a1=_0x3195a1-0x0;var _0x114330=_0x594d[_0x3195a1];return _0x114330;};'use strict';var EventEmitter=require(_0xd594('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd594('0x1')](0x0);var events={'afterCreate':_0xd594('0x2'),'afterUpdate':_0xd594('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10f523){return function(_0x40d8fa,_0x10155d,_0x7f4ec6){WhatsappMessageEvents['emit'](_0x10f523+':'+_0x40d8fa['id'],_0x40d8fa);WhatsappMessageEvents[_0xd594('0x4')](_0x10f523,_0x40d8fa);_0x7f4ec6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xd594('0x5')](e,emitEvent(event));}}module[_0xd594('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0xa902=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xa902,0x8d));var _0x2a90=function(_0x5bd867,_0x138bbd){_0x5bd867=_0x5bd867-0x0;var _0x3e368e=_0xa902[_0x5bd867];return _0x3e368e;};'use strict';var EventEmitter=require(_0x2a90('0x0'));var WhatsappMessage=require(_0x2a90('0x1'))['db'][_0x2a90('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2a90('0x3')](0x0);var events={'afterCreate':_0x2a90('0x4'),'afterUpdate':'update','afterDestroy':_0x2a90('0x5')};function emitEvent(_0x5b4a40){return function(_0x4961c2,_0x169808,_0x2b40c0){WhatsappMessageEvents[_0x2a90('0x6')](_0x5b4a40+':'+_0x4961c2['id'],_0x4961c2);WhatsappMessageEvents[_0x2a90('0x6')](_0x5b4a40,_0x4961c2);_0x2b40c0(null);};}for(var e in events){if(events[_0x2a90('0x7')](e)){var event=events[e];WhatsappMessage[_0x2a90('0x8')](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 5e9821d..9390dcc 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 _0xe95f=['catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then'];(function(_0x37957c,_0x2be9fa){var _0x34a50e=function(_0x5cc0c7){while(--_0x5cc0c7){_0x37957c['push'](_0x37957c['shift']());}};_0x34a50e(++_0x2be9fa);}(_0xe95f,0x64));var _0xfe95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe95f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe95('0x0'));var util=require(_0xfe95('0x1'));var logger=require(_0xfe95('0x2'))(_0xfe95('0x3'));var moment=require(_0xfe95('0x4'));var BPromise=require(_0xfe95('0x5'));var rp=require(_0xfe95('0x6'));var fetch=require(_0xfe95('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe95('0x8'));var config=require(_0xfe95('0x9'));var attributes=require(_0xfe95('0xa'));module[_0xfe95('0xb')]=function(_0x406773,_0x45490a){return _0x406773['define'](_0xfe95('0xc'),attributes,{'tableName':_0xfe95('0xd'),'paranoid':![],'indexes':[{'name':_0xfe95('0xe'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xfe95('0xf')],'type':_0xfe95('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b10aa,_0x2a2cea,_0x258cdf){var _0x2ff69e=_0x406773[_0xfe95('0x11')];var _0x133fe0=_0x4b10aa[_0xfe95('0x12')]({'plain':!![]});if(_0x133fe0[_0xfe95('0x13')][_0xfe95('0x14')]()==='in'||_0x133fe0[_0xfe95('0x13')][_0xfe95('0x14')]()===_0xfe95('0x15')&&!_0x133fe0[_0xfe95('0x16')]&&!_[_0xfe95('0x17')](_0x133fe0[_0xfe95('0x18')])){_0x2ff69e['WhatsappInteraction'][_0xfe95('0x19')]({'where':{'id':_0x133fe0[_0xfe95('0x1a')]}})[_0xfe95('0x1b')](function(_0x3e83d8){if(_0x3e83d8){_0x3e83d8['update']({'lastMsgAt':_0x133fe0['createdAt'],'lastMsgDirection':_0x133fe0[_0xfe95('0x13')]['toLowerCase']()});}})[_0xfe95('0x1c')](function(_0x53d837){console[_0xfe95('0x1d')](_0x53d837);});}if(_0x133fe0[_0xfe95('0x13')]==='out'&&!_0x133fe0[_0xfe95('0x16')]){var _0x5b68b5;_0x2ff69e[_0xfe95('0x1e')][_0xfe95('0x1f')]({'where':{'id':_0x133fe0[_0xfe95('0x20')]},'raw':!![]})[_0xfe95('0x1b')](function(_0x2a59f2){_0x5b68b5=_0x2a59f2;if(_0x5b68b5&&_0x5b68b5['type']){switch(_0x5b68b5[_0xfe95('0x21')]){case _0xfe95('0x22'):var _0x25f8ba=require(_0xfe95('0x22'));if(_0x5b68b5[_0xfe95('0x23')]&&_0x5b68b5[_0xfe95('0x24')]&&_0x5b68b5[_0xfe95('0x25')]){var _0x10c6f8=new _0x25f8ba(_0x5b68b5['accountSid'],_0x5b68b5[_0xfe95('0x24')]);_0x10c6f8[_0xfe95('0x26')]['create']({'body':_0x133fe0[_0xfe95('0xf')],'to':_0xfe95('0x27')+_0x133fe0[_0xfe95('0x25')],'from':_0xfe95('0x27')+_0x5b68b5[_0xfe95('0x25')],'statusCallback':_0x5b68b5[_0xfe95('0x28')]+_0xfe95('0x29')+_0x133fe0['id']+_0xfe95('0x2a')+_0x5b68b5[_0xfe95('0x2b')]})['then'](function(_0x4418c0){if(_0x4418c0[_0xfe95('0x2c')]){return _0x4b10aa[_0xfe95('0x2d')]({'messageId':_0x4418c0[_0xfe95('0x2c')]});}})[_0xfe95('0x1c')](function(_0x83c53f){logger[_0xfe95('0x1d')](_0xfe95('0x2e'),_0xfe95('0x2f'),'twilio',util[_0xfe95('0x30')](_0x83c53f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfe95('0x2e'),'afterCreate','twilio',_0xfe95('0x31'));}break;case _0xfe95('0x32'):var _0x23caba=_0x5b68b5['accountSid'];var _0x59a69d=_0x5b68b5[_0xfe95('0x24')];var _0x2e9d7f=_0x5b68b5[_0xfe95('0x33')]+_0xfe95('0x34')+_0x23caba+_0xfe95('0x35');var _0x52623e={'to':[_0x133fe0[_0xfe95('0x25')]],'message':{'type':_0xfe95('0x36'),'text':_0x133fe0[_0xfe95('0xf')]}};var _0x286ccc={'method':_0xfe95('0x37'),'uri':_0x2e9d7f,'headers':{'Authorization':'Bearer\x20'+_0x59a69d,'Content-Type':_0xfe95('0x38')},'body':_0x52623e,'json':!![]};rp(_0x286ccc)[_0xfe95('0x1b')](function(_0x40c3cf){if(_0x40c3cf[_0xfe95('0x39')][0x0][_0xfe95('0x3a')]){return _0x4b10aa[_0xfe95('0x2d')]({'messageId':_0x40c3cf[_0xfe95('0x39')][0x0][_0xfe95('0x3a')]});}})[_0xfe95('0x1c')](function(_0xc3f3f8){logger[_0xfe95('0x3b')](_0xfe95('0x3c'),_0xc3f3f8);});break;}}})[_0xfe95('0x3d')](function(){_0x258cdf();});}else{_0x258cdf();}}},'charset':_0xfe95('0x3e'),'collate':_0xfe95('0x3f')});}; \ No newline at end of file +var _0x705a=['sinch','baseUrl','/whatsapp/v1/','text','application/json','statuses','message_id','catch','err','finally','utf8mb4','lodash','util','moment','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x851fa6,_0x23056e){var _0x30284=function(_0x2a503e){while(--_0x2a503e){_0x851fa6['push'](_0x851fa6['shift']());}};_0x30284(++_0x23056e);}(_0x705a,0x7d));var _0xa705=function(_0x4a207e,_0x69e57a){_0x4a207e=_0x4a207e-0x0;var _0x519c13=_0x705a[_0x4a207e];return _0x519c13;};'use strict';var _=require(_0xa705('0x0'));var util=require(_0xa705('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa705('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xa705('0x3'));var fs=require('fs');var path=require(_0xa705('0x4'));var rimraf=require('rimraf');var config=require(_0xa705('0x5'));var attributes=require(_0xa705('0x6'));module[_0xa705('0x7')]=function(_0x3ca76c,_0x5aac99){return _0x3ca76c[_0xa705('0x8')](_0xa705('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xa705('0xa'),'fields':[_0xa705('0xa')]},{'name':_0xa705('0xb'),'fields':[_0xa705('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6fb599,_0x3612c5,_0x6e9d31){var _0x1bbbf4=_0x3ca76c[_0xa705('0xd')];var _0x383db1=_0x6fb599[_0xa705('0xe')]({'plain':!![]});if(_0x383db1[_0xa705('0xf')]['toLowerCase']()==='in'||_0x383db1[_0xa705('0xf')][_0xa705('0x10')]()==='out'&&!_0x383db1[_0xa705('0x11')]&&!_[_0xa705('0x12')](_0x383db1[_0xa705('0x13')])){_0x1bbbf4[_0xa705('0x14')]['findOne']({'where':{'id':_0x383db1[_0xa705('0x15')]}})[_0xa705('0x16')](function(_0x4a2f37){if(_0x4a2f37){_0x4a2f37[_0xa705('0x17')]({'lastMsgAt':_0x383db1['createdAt'],'lastMsgDirection':_0x383db1['direction']['toLowerCase']()});}})['catch'](function(_0x54f107){console[_0xa705('0x18')](_0x54f107);});}if(_0x383db1[_0xa705('0xf')]===_0xa705('0x19')&&!_0x383db1[_0xa705('0x11')]){var _0x49a79c;_0x1bbbf4[_0xa705('0x1a')][_0xa705('0x1b')]({'where':{'id':_0x383db1[_0xa705('0x1c')]},'raw':!![]})[_0xa705('0x16')](function(_0x55c811){_0x49a79c=_0x55c811;if(_0x49a79c&&_0x49a79c[_0xa705('0x1d')]){switch(_0x49a79c[_0xa705('0x1d')]){case _0xa705('0x1e'):var _0x18ca3c=require(_0xa705('0x1e'));if(_0x49a79c['accountSid']&&_0x49a79c[_0xa705('0x1f')]&&_0x49a79c[_0xa705('0x20')]){var _0x480a93=new _0x18ca3c(_0x49a79c[_0xa705('0x21')],_0x49a79c[_0xa705('0x1f')]);_0x480a93[_0xa705('0x22')][_0xa705('0x23')]({'body':_0x383db1['body'],'to':_0xa705('0x24')+_0x383db1['phone'],'from':_0xa705('0x24')+_0x49a79c[_0xa705('0x20')],'statusCallback':_0x49a79c[_0xa705('0x25')]+_0xa705('0x26')+_0x383db1['id']+_0xa705('0x27')+_0x49a79c[_0xa705('0x28')]})[_0xa705('0x16')](function(_0x47dee9){if(_0x47dee9[_0xa705('0x29')]){return _0x6fb599[_0xa705('0x17')]({'messageId':_0x47dee9[_0xa705('0x29')]});}})['catch'](function(_0x4d01bc){logger['error'](_0xa705('0x2a'),'afterCreate',_0xa705('0x1e'),util[_0xa705('0x2b')](_0x4d01bc,{'showHidden':![],'depth':null}));});}else{logger[_0xa705('0x18')](_0xa705('0x2a'),_0xa705('0x2c'),_0xa705('0x1e'),_0xa705('0x2d'));}break;case _0xa705('0x2e'):var _0x4dd95e=_0x49a79c[_0xa705('0x21')];var _0x22612f=_0x49a79c[_0xa705('0x1f')];var _0x3b226b=_0x49a79c[_0xa705('0x2f')]+_0xa705('0x30')+_0x4dd95e+'/messages/';var _0x52f29d={'to':[_0x383db1[_0xa705('0x20')]],'message':{'type':_0xa705('0x31'),'text':_0x383db1['body']}};var _0x14c301={'method':'POST','uri':_0x3b226b,'headers':{'Authorization':'Bearer\x20'+_0x22612f,'Content-Type':_0xa705('0x32')},'body':_0x52f29d,'json':!![]};rp(_0x14c301)[_0xa705('0x16')](function(_0x22db11){if(_0x22db11[_0xa705('0x33')][0x0][_0xa705('0x34')]){return _0x6fb599[_0xa705('0x17')]({'messageId':_0x22db11[_0xa705('0x33')][0x0]['message_id']});}})[_0xa705('0x35')](function(_0x4966bb){logger[_0xa705('0x36')]('WhatsappMessage,\x20%s',_0x4966bb);});break;}}})[_0xa705('0x37')](function(){_0x6e9d31();});}else{_0x6e9d31();}}},'charset':_0xa705('0x38'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e722536..72e02d1 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 _0xe509=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','debug','lodash'];(function(_0x3d3317,_0x8bf60){var _0x46494e=function(_0x20f6df){while(--_0x20f6df){_0x3d3317['push'](_0x3d3317['shift']());}};_0x46494e(++_0x8bf60);}(_0xe509,0xa9));var _0x9e50=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0xe509[_0x151418];return _0x40e29a;};'use strict';var _=require(_0x9e50('0x0'));var util=require(_0x9e50('0x1'));var moment=require('moment');var BPromise=require(_0x9e50('0x2'));var rs=require(_0x9e50('0x3'));var fs=require('fs');var Redis=require(_0x9e50('0x4'));var db=require(_0x9e50('0x5'))['db'];var utils=require(_0x9e50('0x6'));var logger=require('../../config/logger')(_0x9e50('0x7'));var config=require(_0x9e50('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e50('0x9')][_0x9e50('0xa')]({'port':0x232a});config[_0x9e50('0xb')]=_[_0x9e50('0xc')](config['redis'],{'host':_0x9e50('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e50('0xb')]));require(_0x9e50('0xe'))[_0x9e50('0xf')](socket);function respondWithRpcPromise(_0x4c35a7,_0x3e2a51,_0x58d485){return new BPromise(function(_0x110313,_0x708825){return client[_0x9e50('0x10')](_0x4c35a7,_0x58d485)[_0x9e50('0x11')](function(_0x5cfabb){logger[_0x9e50('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x3e2a51,_0x9e50('0x13'));logger['debug'](_0x9e50('0x14'),_0x3e2a51,_0x9e50('0x13'),JSON[_0x9e50('0x15')](_0x5cfabb));if(_0x5cfabb[_0x9e50('0x16')]){if(_0x5cfabb[_0x9e50('0x16')][_0x9e50('0x17')]===0x1f4){logger[_0x9e50('0x16')](_0x9e50('0x18'),_0x3e2a51,_0x5cfabb['error'][_0x9e50('0x19')]);return _0x708825(_0x5cfabb[_0x9e50('0x16')][_0x9e50('0x19')]);}logger['error'](_0x9e50('0x18'),_0x3e2a51,_0x5cfabb[_0x9e50('0x16')][_0x9e50('0x19')]);return _0x110313(_0x5cfabb[_0x9e50('0x16')][_0x9e50('0x19')]);}else{logger[_0x9e50('0x12')](_0x9e50('0x18'),_0x3e2a51,_0x9e50('0x13'));_0x110313(_0x5cfabb[_0x9e50('0x1a')][_0x9e50('0x19')]);}})[_0x9e50('0x1b')](function(_0xfff9c8){logger['error'](_0x9e50('0x18'),_0x3e2a51,_0xfff9c8);_0x708825(_0xfff9c8);});});}exports[_0x9e50('0x1c')]=function(_0x36e0bd){var _0x526b17=this;return new Promise(function(_0x13c1d3,_0x2db2bd){return db[_0x9e50('0x1d')]['create'](_0x36e0bd[_0x9e50('0x1e')],{'raw':_0x36e0bd[_0x9e50('0x1f')]?_0x36e0bd[_0x9e50('0x1f')][_0x9e50('0x20')]===undefined?!![]:![]:!![]})[_0x9e50('0x11')](function(_0x23556e){logger[_0x9e50('0x12')]('CreateWhatsappMessage',_0x36e0bd);logger[_0x9e50('0x21')](_0x9e50('0x1c'),_0x36e0bd,JSON[_0x9e50('0x15')](_0x23556e));_0x13c1d3(_0x23556e);})[_0x9e50('0x1b')](function(_0x3b90c7){logger['error']('CreateWhatsappMessage',_0x3b90c7[_0x9e50('0x19')],_0x36e0bd);_0x2db2bd(_0x526b17[_0x9e50('0x16')](0x1f4,_0x3b90c7[_0x9e50('0x19')]));});});}; \ No newline at end of file +var _0x1b46=['./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateWhatsappMessage','create','body','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter'];(function(_0x16e349,_0x408086){var _0x367f55=function(_0x2e3e6a){while(--_0x2e3e6a){_0x16e349['push'](_0x16e349['shift']());}};_0x367f55(++_0x408086);}(_0x1b46,0x8f));var _0x61b4=function(_0x529f05,_0x32aba3){_0x529f05=_0x529f05-0x0;var _0x3d523e=_0x1b46[_0x529f05];return _0x3d523e;};'use strict';var _=require(_0x61b4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61b4('0x1'));var fs=require('fs');var Redis=require(_0x61b4('0x2'));var db=require(_0x61b4('0x3'))['db'];var utils=require(_0x61b4('0x4'));var logger=require(_0x61b4('0x5'))(_0x61b4('0x6'));var config=require(_0x61b4('0x7'));var jayson=require(_0x61b4('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x61b4('0x9')]=_[_0x61b4('0xa')](config[_0x61b4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x61b4('0xb'))(new Redis(config[_0x61b4('0x9')]));require(_0x61b4('0xc'))[_0x61b4('0xd')](socket);function respondWithRpcPromise(_0x5876f8,_0x40df04,_0x1a4e18){return new BPromise(function(_0x4603ad,_0x3d7a71){return client[_0x61b4('0xe')](_0x5876f8,_0x1a4e18)[_0x61b4('0xf')](function(_0x33ab5d){logger[_0x61b4('0x10')](_0x61b4('0x11'),_0x40df04,_0x61b4('0x12'));logger[_0x61b4('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x40df04,_0x61b4('0x12'),JSON[_0x61b4('0x14')](_0x33ab5d));if(_0x33ab5d['error']){if(_0x33ab5d['error'][_0x61b4('0x15')]===0x1f4){logger[_0x61b4('0x16')](_0x61b4('0x11'),_0x40df04,_0x33ab5d[_0x61b4('0x16')][_0x61b4('0x17')]);return _0x3d7a71(_0x33ab5d[_0x61b4('0x16')][_0x61b4('0x17')]);}logger[_0x61b4('0x16')](_0x61b4('0x11'),_0x40df04,_0x33ab5d[_0x61b4('0x16')][_0x61b4('0x17')]);return _0x4603ad(_0x33ab5d[_0x61b4('0x16')][_0x61b4('0x17')]);}else{logger['info'](_0x61b4('0x11'),_0x40df04,_0x61b4('0x12'));_0x4603ad(_0x33ab5d[_0x61b4('0x18')][_0x61b4('0x17')]);}})[_0x61b4('0x19')](function(_0x4f7ac1){logger[_0x61b4('0x16')](_0x61b4('0x11'),_0x40df04,_0x4f7ac1);_0x3d7a71(_0x4f7ac1);});});}exports[_0x61b4('0x1a')]=function(_0x51530b){var _0x5ce509=this;return new Promise(function(_0x3b7c11,_0x5bb691){return db['WhatsappMessage'][_0x61b4('0x1b')](_0x51530b[_0x61b4('0x1c')],{'raw':_0x51530b[_0x61b4('0x1d')]?_0x51530b['options'][_0x61b4('0x1e')]===undefined?!![]:![]:!![]})[_0x61b4('0xf')](function(_0x2b830c){logger[_0x61b4('0x10')](_0x61b4('0x1a'),_0x51530b);logger['debug'](_0x61b4('0x1a'),_0x51530b,JSON[_0x61b4('0x14')](_0x2b830c));_0x3b7c11(_0x2b830c);})[_0x61b4('0x19')](function(_0x40d4ff){logger[_0x61b4('0x16')](_0x61b4('0x1a'),_0x40d4ff[_0x61b4('0x17')],_0x51530b);_0x5bb691(_0x5ce509[_0x61b4('0x16')](0x1f4,_0x40d4ff[_0x61b4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 044e9f7..7d8a936 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 _0x3bcd=['removeListener','register','length','whatsappMessage:','save','emit'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x3bcd,0x82));var _0xd3bc=function(_0x3aa779,_0x4a18c5){_0x3aa779=_0x3aa779-0x0;var _0x2fd150=_0x3bcd[_0x3aa779];return _0x2fd150;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xd3bc('0x0'),'remove','update'];function createListener(_0x355bb8,_0x5dfeb9){return function(_0x2e7876){_0x5dfeb9[_0xd3bc('0x1')](_0x355bb8,_0x2e7876);};}function removeListener(_0x1346dc,_0x109b97){return function(){WhatsappMessageEvents[_0xd3bc('0x2')](_0x1346dc,_0x109b97);};}exports[_0xd3bc('0x3')]=function(_0x2555da){for(var _0x1b152e=0x0,_0x30fa92=events[_0xd3bc('0x4')];_0x1b152e<_0x30fa92;_0x1b152e++){var _0x44412f=events[_0x1b152e];var _0x4b731e=createListener(_0xd3bc('0x5')+_0x44412f,_0x2555da);WhatsappMessageEvents['on'](_0x44412f,_0x4b731e);}}; \ No newline at end of file +var _0xacd7=['whatsappMessage:','./whatsappMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x329274,_0x4d86b5){var _0xa01582=function(_0x570109){while(--_0x570109){_0x329274['push'](_0x329274['shift']());}};_0xa01582(++_0x4d86b5);}(_0xacd7,0x89));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x7acd('0x0'));var events=[_0x7acd('0x1'),_0x7acd('0x2'),'update'];function createListener(_0x1cb3d3,_0x3ffe49){return function(_0x2de0b3){_0x3ffe49[_0x7acd('0x3')](_0x1cb3d3,_0x2de0b3);};}function removeListener(_0x1de7e8,_0x655817){return function(){WhatsappMessageEvents[_0x7acd('0x4')](_0x1de7e8,_0x655817);};}exports[_0x7acd('0x5')]=function(_0x4fef2a){for(var _0x1ca4f5=0x0,_0x5e7671=events[_0x7acd('0x6')];_0x1ca4f5<_0x5e7671;_0x1ca4f5++){var _0x221c43=events[_0x1ca4f5];var _0x5dc826=createListener(_0x7acd('0x7')+_0x221c43,_0x4fef2a);WhatsappMessageEvents['on'](_0x221c43,_0x5dc826);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 165b0fb..868a938 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 _0xa096=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','express','../../components/interaction/service','./whatsappQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xa096,0xd7));var _0x6a09=function(_0x193b59,_0x1d3454){_0x193b59=_0x193b59-0x0;var _0x339e71=_0xa096[_0x193b59];return _0x339e71;};'use strict';var multer=require('multer');var util=require(_0x6a09('0x0'));var path=require(_0x6a09('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a09('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a09('0x3'));var config=require('../../config/environment');var controller=require(_0x6a09('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x6a09('0x5')]);router[_0x6a09('0x6')](_0x6a09('0x7'),auth[_0x6a09('0x8')](),controller[_0x6a09('0x9')]);router['get'](_0x6a09('0xa'),auth[_0x6a09('0x8')](),controller['show']);router[_0x6a09('0x6')](_0x6a09('0xb'),auth[_0x6a09('0x8')](),controller[_0x6a09('0xc')]);router[_0x6a09('0x6')](_0x6a09('0xd'),auth[_0x6a09('0x8')](),controller[_0x6a09('0xe')]);router[_0x6a09('0x6')](_0x6a09('0xf'),auth[_0x6a09('0x8')](),controller[_0x6a09('0x10')]);router['post']('/',auth[_0x6a09('0x8')](),controller['create']);router[_0x6a09('0x11')]('/:id/teams',auth[_0x6a09('0x8')](),controller[_0x6a09('0x12')]);router[_0x6a09('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x6a09('0x13')]);router[_0x6a09('0x14')]('/:id',auth[_0x6a09('0x8')](),controller[_0x6a09('0x15')]);router[_0x6a09('0x16')](_0x6a09('0xa'),auth['isAuthenticated'](),controller[_0x6a09('0x17')]);router[_0x6a09('0x16')]('/:id/teams',auth[_0x6a09('0x8')](),controller[_0x6a09('0x18')]);router[_0x6a09('0x16')](_0x6a09('0xf'),auth[_0x6a09('0x8')](),controller[_0x6a09('0x19')]);module['exports']=router; \ No newline at end of file +var _0x65da=['describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','destroy','delete','removeTeams','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','get','/describe','isAuthenticated'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x65da,0x152));var _0xa65d=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x65da[_0x599e60];return _0x468e19;};'use strict';var multer=require(_0xa65d('0x0'));var util=require('util');var path=require(_0xa65d('0x1'));var timeout=require(_0xa65d('0x2'));var express=require(_0xa65d('0x3'));var router=express['Router']();var fs_extra=require(_0xa65d('0x4'));var auth=require(_0xa65d('0x5'));var interaction=require(_0xa65d('0x6'));var config=require(_0xa65d('0x7'));var controller=require(_0xa65d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa65d('0x9')]);router[_0xa65d('0xa')](_0xa65d('0xb'),auth[_0xa65d('0xc')](),controller[_0xa65d('0xd')]);router[_0xa65d('0xa')](_0xa65d('0xe'),auth['isAuthenticated'](),controller[_0xa65d('0xf')]);router[_0xa65d('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0xa65d('0x10')]);router[_0xa65d('0xa')](_0xa65d('0x11'),auth[_0xa65d('0xc')](),controller['getTeams']);router[_0xa65d('0xa')](_0xa65d('0x12'),auth[_0xa65d('0xc')](),controller[_0xa65d('0x13')]);router[_0xa65d('0x14')]('/',auth[_0xa65d('0xc')](),controller['create']);router[_0xa65d('0x14')](_0xa65d('0x11'),auth['isAuthenticated'](),controller[_0xa65d('0x15')]);router['post'](_0xa65d('0x12'),auth['isAuthenticated'](),controller[_0xa65d('0x16')]);router['put'](_0xa65d('0xe'),auth[_0xa65d('0xc')](),controller['update']);router['delete'](_0xa65d('0xe'),auth[_0xa65d('0xc')](),controller[_0xa65d('0x17')]);router[_0xa65d('0x18')](_0xa65d('0x11'),auth[_0xa65d('0xc')](),controller[_0xa65d('0x19')]);router['delete'](_0xa65d('0x12'),auth[_0xa65d('0xc')](),controller['removeAgents']);module[_0xa65d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index bba53ca..3b9f96a 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 _0xb11e=['exports','STRING','name','INTEGER','beepall','roundrobin','sequelize'];(function(_0x53b72f,_0x3b97fa){var _0x201bea=function(_0x56ec1c){while(--_0x56ec1c){_0x53b72f['push'](_0x53b72f['shift']());}};_0x201bea(++_0x3b97fa);}(_0xb11e,0x7d));var _0xeb11=function(_0x1203d3,_0x197267){_0x1203d3=_0x1203d3-0x0;var _0x33d44c=_0xb11e[_0x1203d3];return _0x33d44c;};'use strict';var Sequelize=require(_0xeb11('0x0'));module[_0xeb11('0x1')]={'name':{'type':Sequelize[_0xeb11('0x2')],'unique':_0xeb11('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xeb11('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xeb11('0x5'),_0xeb11('0x6'))},'description':{'type':Sequelize[_0xeb11('0x2')]}}; \ No newline at end of file +var _0xbc8b=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xbc8b[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require('sequelize');module[_0xbbc8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbbc8('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xbbc8('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbbc8('0x3')](_0xbbc8('0x4'),_0xbbc8('0x5'),_0xbbc8('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 2c405fb..2991ec2 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 _0x51d3=['addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','removeAgents','addAgents','omit','userWhatsappQueue:remove','getAgents','pick','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','./whatsappQueue.socket','register','end','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','stack','name','send','index','map','WhatsappQueue','fieldName','getOptions','include','query','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','filter','where','options','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','getTeams','Team'];(function(_0x3718b8,_0xf154fc){var _0x268f84=function(_0x2ed965){while(--_0x2ed965){_0x3718b8['push'](_0x3718b8['shift']());}};_0x268f84(++_0xf154fc);}(_0x51d3,0x188));var _0x351d=function(_0x59103d,_0x203fea){_0x59103d=_0x59103d-0x0;var _0x3ba108=_0x51d3[_0x59103d];return _0x3ba108;};'use strict';var BPromise=require(_0x351d('0x0'));var util=require(_0x351d('0x1'));var _=require(_0x351d('0x2'));var squel=require(_0x351d('0x3'));var Redis=require('ioredis');var qs=require(_0x351d('0x4'));var logger=require(_0x351d('0x5'))(_0x351d('0x6'));var config=require('../../config/environment');var db=require(_0x351d('0x7'))['db'];config[_0x351d('0x8')]=_['defaults'](config[_0x351d('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x351d('0x8')]));require(_0x351d('0x9'))[_0x351d('0xa')](socket);function respondWithStatusCode(_0x34a9f6,_0x3a2649){_0x3a2649=_0x3a2649||0xcc;return function(_0x437d62){if(_0x437d62){return _0x34a9f6['sendStatus'](_0x3a2649);}return _0x34a9f6['status'](_0x3a2649)[_0x351d('0xb')]();};}function respondWithResult(_0x15fe14,_0x71149d){_0x71149d=_0x71149d||0xc8;return function(_0x4e0176){if(_0x4e0176){return _0x15fe14[_0x351d('0xc')](_0x71149d)[_0x351d('0xd')](_0x4e0176);}};}function respondWithFilteredResult(_0x42c146,_0x1b984a){return function(_0x43ffea){if(_0x43ffea){var _0x401929=typeof _0x1b984a['offset']===_0x351d('0xe')&&typeof _0x1b984a[_0x351d('0xf')]===_0x351d('0xe');var _0x23174a=_0x43ffea[_0x351d('0x10')];var _0x2432e6=_0x401929?0x0:_0x1b984a[_0x351d('0x11')];var _0x2bcf72=_0x401929?_0x43ffea[_0x351d('0x10')]:_0x1b984a[_0x351d('0x11')]+_0x1b984a[_0x351d('0xf')];var _0x274426;if(_0x2bcf72>=_0x23174a){_0x2bcf72=_0x23174a;_0x274426=0xc8;}else{_0x274426=0xce;}_0x42c146[_0x351d('0xc')](_0x274426);return _0x42c146[_0x351d('0x12')](_0x351d('0x13'),_0x2432e6+'-'+_0x2bcf72+'/'+_0x23174a)[_0x351d('0xd')](_0x43ffea);}return null;};}function saveUpdates(_0x39ea49){return function(_0x5b9f0b){if(_0x5b9f0b){return _0x5b9f0b[_0x351d('0x14')](_0x39ea49)['then'](function(_0x270cae){return _0x270cae;});}return null;};}function removeEntity(_0x438745){return function(_0x21e500){if(_0x21e500){return _0x21e500[_0x351d('0x15')]()[_0x351d('0x16')](function(){var _0xc0eb59=_0x21e500[_0x351d('0x17')]({'plain':!![]});var _0x5ae01e=_0x351d('0x18');return db[_0x351d('0x19')][_0x351d('0x15')]({'where':{'type':_0x5ae01e,'resourceId':_0xc0eb59['id']}})['then'](function(){return _0x21e500;});})[_0x351d('0x16')](function(){_0x438745[_0x351d('0xc')](0xcc)[_0x351d('0xb')]();});}};}function handleEntityNotFound(_0x27e819){return function(_0x5ccfa4){if(!_0x5ccfa4){_0x27e819[_0x351d('0x1a')](0x194);}return _0x5ccfa4;};}function handleError(_0x41c44e,_0x29d662){_0x29d662=_0x29d662||0x1f4;return function(_0x548db8){logger['error'](_0x548db8[_0x351d('0x1b')]);if(_0x548db8[_0x351d('0x1c')]){delete _0x548db8[_0x351d('0x1c')];}_0x41c44e[_0x351d('0xc')](_0x29d662)[_0x351d('0x1d')](_0x548db8);};}exports[_0x351d('0x1e')]=function(_0x1cb1a9,_0x422ea3){var _0xb37a1c={};var _0x5e8d54={'count':0x0,'rows':[]};var _0x3ee4a7=_[_0x351d('0x1f')](db[_0x351d('0x20')]['rawAttributes'],function(_0xf1d4d){return{'name':_0xf1d4d[_0x351d('0x21')],'type':_0xf1d4d['type']['key']};});_0xb37a1c=qs[_0x351d('0x22')](_0x3ee4a7,_0x1cb1a9);var _0xc8ded5={'where':_0xb37a1c['where']};return db[_0x351d('0x20')][_0x351d('0x10')](_0xc8ded5)['then'](function(_0x211186){_0x5e8d54[_0x351d('0x10')]=_0x211186;_0xb37a1c[_0x351d('0x23')]=qs[_0x351d('0x23')](_0x1cb1a9[_0x351d('0x24')]);return db[_0x351d('0x20')]['findAll'](_0xb37a1c);})[_0x351d('0x16')](function(_0x566797){_0x5e8d54[_0x351d('0x25')]=_0x566797;return _0x5e8d54;})[_0x351d('0x16')](respondWithFilteredResult(_0x422ea3,_0xb37a1c))['catch'](handleError(_0x422ea3,null));};exports[_0x351d('0x26')]=function(_0x3e5965,_0x334ff9){var _0x12f3c1={'raw':!![],'where':{'id':_0x3e5965['params']['id']}},_0xf0054a={};_0xf0054a[_0x351d('0x27')]=_[_0x351d('0x28')](db[_0x351d('0x20')][_0x351d('0x29')]);_0xf0054a[_0x351d('0x24')]=_[_0x351d('0x28')](_0x3e5965[_0x351d('0x24')]);_0xf0054a[_0x351d('0x2a')]=_[_0x351d('0x2b')](_0xf0054a[_0x351d('0x27')],_0xf0054a['query']);_0x12f3c1[_0x351d('0x2c')]=_[_0x351d('0x2b')](_0xf0054a[_0x351d('0x27')],qs[_0x351d('0x2d')](_0x3e5965[_0x351d('0x24')]['fields']));_0x12f3c1[_0x351d('0x2c')]=_0x12f3c1['attributes'][_0x351d('0x2e')]?_0x12f3c1[_0x351d('0x2c')]:_0xf0054a[_0x351d('0x27')];if(_0x3e5965[_0x351d('0x24')][_0x351d('0x2f')]){_0x12f3c1[_0x351d('0x23')]=[{'all':!![]}];}_0x12f3c1=_[_0x351d('0x30')]({},_0x12f3c1,_0x3e5965['options']);return db[_0x351d('0x20')][_0x351d('0x31')](_0x12f3c1)[_0x351d('0x16')](handleEntityNotFound(_0x334ff9,null))['then'](respondWithResult(_0x334ff9,null))['catch'](handleError(_0x334ff9,null));};exports['create']=function(_0x34092e,_0x2f54e1){return db[_0x351d('0x20')][_0x351d('0x32')](_0x34092e['body'],{})['then'](function(_0x1d14af){var _0x1ae5ad=_0x34092e[_0x351d('0x33')][_0x351d('0x17')]({'plain':!![]});if(!_0x1ae5ad)throw new Error(_0x351d('0x34'));if(_0x1ae5ad[_0x351d('0x35')]==='user'){var _0x345d55=_0x1d14af[_0x351d('0x17')]({'plain':!![]});var _0x53bcef=_0x351d('0x18');return db[_0x351d('0x36')][_0x351d('0x31')]({'where':{'name':_0x53bcef,'userProfileId':_0x1ae5ad[_0x351d('0x37')]},'raw':!![]})[_0x351d('0x16')](function(_0x4a35ca){if(_0x4a35ca&&_0x4a35ca[_0x351d('0x38')]===0x0){return db[_0x351d('0x19')][_0x351d('0x32')]({'name':_0x345d55[_0x351d('0x1c')],'resourceId':_0x345d55['id'],'type':_0x4a35ca['name'],'sectionId':_0x4a35ca['id']},{})[_0x351d('0x16')](function(){return _0x1d14af;});}else{return _0x1d14af;}})[_0x351d('0x39')](function(_0x3f0a3b){logger[_0x351d('0x3a')](_0x351d('0x3b'),_0x3f0a3b);throw _0x3f0a3b;});}return _0x1d14af;})[_0x351d('0x16')](respondWithResult(_0x2f54e1,0xc9))[_0x351d('0x39')](handleError(_0x2f54e1,null));};exports['update']=function(_0x1a2af0,_0xd30782){if(_0x1a2af0[_0x351d('0x3c')]['id']){delete _0x1a2af0[_0x351d('0x3c')]['id'];}return db[_0x351d('0x20')][_0x351d('0x31')]({'where':{'id':_0x1a2af0[_0x351d('0x3d')]['id']}})['then'](handleEntityNotFound(_0xd30782,null))[_0x351d('0x16')](saveUpdates(_0x1a2af0[_0x351d('0x3c')],null))[_0x351d('0x16')](respondWithResult(_0xd30782,null))['catch'](handleError(_0xd30782,null));};exports[_0x351d('0x15')]=function(_0x4b344f,_0x2ae1b3){return db['WhatsappQueue'][_0x351d('0x31')]({'where':{'id':_0x4b344f[_0x351d('0x3d')]['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x2ae1b3,null))[_0x351d('0x16')](removeEntity(_0x2ae1b3,null))[_0x351d('0x39')](handleError(_0x2ae1b3,null));};exports[_0x351d('0x3e')]=function(_0x99cb3b,_0x10cd8b){return db[_0x351d('0x20')][_0x351d('0x3e')]()[_0x351d('0x16')](respondWithResult(_0x10cd8b,null))['catch'](handleError(_0x10cd8b,null));};exports[_0x351d('0x3f')]=function(_0x1fc61b,_0x3715db){var _0x21cde4={'raw':!![],'where':{}},_0x46948a={},_0x2aafcc;return db[_0x351d('0x20')][_0x351d('0x40')]({'where':{'id':_0x1fc61b[_0x351d('0x3d')]['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x3715db,null))[_0x351d('0x16')](function(_0x5e9df5){if(_0x5e9df5){_0x2aafcc=_0x5e9df5[_0x351d('0x17')]({'plain':!![]});_0x46948a[_0x351d('0x27')]=_['keys'](db[_0x351d('0x41')][_0x351d('0x29')]);_0x46948a[_0x351d('0x24')]=_[_0x351d('0x28')](_0x1fc61b[_0x351d('0x24')]);_0x46948a[_0x351d('0x2a')]=_[_0x351d('0x2b')](_0x46948a[_0x351d('0x27')],_0x46948a[_0x351d('0x24')]);_0x21cde4['attributes']=_['intersection'](_0x46948a[_0x351d('0x27')],qs['fields'](_0x1fc61b[_0x351d('0x24')][_0x351d('0x2d')]));_0x21cde4['attributes']=_0x21cde4[_0x351d('0x2c')][_0x351d('0x2e')]?_0x21cde4[_0x351d('0x2c')]:_0x46948a[_0x351d('0x27')];if(!_0x1fc61b['query'][_0x351d('0x42')](_0x351d('0x43'))){_0x21cde4[_0x351d('0xf')]=qs['limit'](_0x1fc61b[_0x351d('0x24')][_0x351d('0xf')]);_0x21cde4[_0x351d('0x11')]=qs[_0x351d('0x11')](_0x1fc61b[_0x351d('0x24')][_0x351d('0x11')]);}_0x21cde4[_0x351d('0x44')]=qs['sort'](_0x1fc61b[_0x351d('0x24')][_0x351d('0x45')]);_0x21cde4['where']=qs[_0x351d('0x2a')](_['pick'](_0x1fc61b[_0x351d('0x24')],_0x46948a[_0x351d('0x2a')]));_0x21cde4['where']['WhatsappQueueId']=_0x5e9df5['id'];if(_0x1fc61b['query'][_0x351d('0x46')]){_0x21cde4['where']=_[_0x351d('0x30')](_0x21cde4[_0x351d('0x47')],{'$or':_[_0x351d('0x1f')](_0x21cde4[_0x351d('0x2c')],function(_0x4bbba1){var _0x17209d={};_0x17209d[_0x4bbba1]={'$like':'%'+_0x1fc61b['query'][_0x351d('0x46')]+'%'};return _0x17209d;})});}_0x21cde4=_[_0x351d('0x30')]({},_0x21cde4,_0x1fc61b[_0x351d('0x48')]);return db[_0x351d('0x41')][_0x351d('0x49')](_0x21cde4);}})[_0x351d('0x16')](function(_0x32064c){if(_0x32064c){return db[_0x351d('0x4a')][_0x351d('0x4b')]({'where':{'id':_['map'](_0x32064c,_0x351d('0x4c')),'role':_0x351d('0x4d')},'attributes':['id','name',_0x351d('0x4e'),_0x351d('0x4f'),_0x351d('0x50')]});}})[_0x351d('0x16')](function(_0x4f0233){if(_0x4f0233){return{'count':_0x4f0233[_0x351d('0x10')],'rows':_[_0x351d('0x1f')](_0x4f0233[_0x351d('0x25')],function(_0x4e8e37){return{'membername':_0x4e8e37[_0x351d('0x1c')],'UserId':_0x4e8e37['id'],'queue_name':_0x2aafcc['name'],'WhatsappQueueId':_0x2aafcc['id'],'interface':util[_0x351d('0x51')]('%s/%s','SIP',_0x4e8e37[_0x351d('0x1c')]),'penalty':0x0,'paused':_0x4e8e37[_0x351d('0x4e')],'createdAt':_0x4e8e37[_0x351d('0x50')],'updatedAt':_0x4e8e37[_0x351d('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x351d('0x16')](respondWithFilteredResult(_0x3715db,_0x21cde4))[_0x351d('0x39')](handleError(_0x3715db,null));};exports[_0x351d('0x52')]=function(_0xdcd757,_0x5a8724){var _0x888cb4={};var _0x2da2f0={};var _0x27986b;var _0x4cdaaa;return db['WhatsappQueue'][_0x351d('0x40')]({'where':{'id':_0xdcd757[_0x351d('0x3d')]['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x5a8724,null))[_0x351d('0x16')](function(_0x22309e){if(_0x22309e){_0x27986b=_0x22309e;_0x2da2f0[_0x351d('0x27')]=_['keys'](db[_0x351d('0x53')][_0x351d('0x29')]);_0x2da2f0[_0x351d('0x24')]=_[_0x351d('0x28')](_0xdcd757[_0x351d('0x24')]);_0x2da2f0[_0x351d('0x2a')]=_[_0x351d('0x2b')](_0x2da2f0['model'],_0x2da2f0[_0x351d('0x24')]);_0x888cb4[_0x351d('0x2c')]=_[_0x351d('0x2b')](_0x2da2f0[_0x351d('0x27')],qs[_0x351d('0x2d')](_0xdcd757['query']['fields']));_0x888cb4[_0x351d('0x2c')]=_0x888cb4[_0x351d('0x2c')]['length']?_0x888cb4[_0x351d('0x2c')]:_0x2da2f0[_0x351d('0x27')];_0x888cb4[_0x351d('0x44')]=qs[_0x351d('0x45')](_0xdcd757[_0x351d('0x24')][_0x351d('0x45')]);_0x888cb4[_0x351d('0x47')]=qs['filters'](_['pick'](_0xdcd757['query'],_0x2da2f0[_0x351d('0x2a')]));if(_0xdcd757['query'][_0x351d('0x46')]){_0x888cb4[_0x351d('0x47')]=_[_0x351d('0x30')](_0x888cb4[_0x351d('0x47')],{'$or':_['map'](_0x888cb4[_0x351d('0x2c')],function(_0x1d3952){var _0x156931={};_0x156931[_0x1d3952]={'$like':'%'+_0xdcd757[_0x351d('0x24')][_0x351d('0x46')]+'%'};return _0x156931;})});}_0x888cb4=_[_0x351d('0x30')]({},_0x888cb4,_0xdcd757['options']);return _0x27986b[_0x351d('0x52')](_0x888cb4);}})[_0x351d('0x16')](function(_0x503b66){if(_0x503b66){_0x4cdaaa=_0x503b66[_0x351d('0x2e')];if(!_0xdcd757['query'][_0x351d('0x42')](_0x351d('0x43'))){_0x888cb4['limit']=qs['limit'](_0xdcd757['query'][_0x351d('0xf')]);_0x888cb4['offset']=qs[_0x351d('0x11')](_0xdcd757[_0x351d('0x24')][_0x351d('0x11')]);}return _0x27986b[_0x351d('0x52')](_0x888cb4);}})[_0x351d('0x16')](function(_0x243bd2){if(_0x243bd2){return _0x243bd2?{'count':_0x4cdaaa,'rows':_0x243bd2}:null;}})[_0x351d('0x16')](respondWithResult(_0x5a8724,null))['catch'](handleError(_0x5a8724,null));};exports[_0x351d('0x54')]=function(_0x1ca16a,_0x15475e){var _0xba4a91=_0x1ca16a[_0x351d('0x3c')][_0x351d('0x55')];return db[_0x351d('0x53')][_0x351d('0x49')]({'where':{'id':_0xba4a91},'attributes':['id'],'include':[{'model':db[_0x351d('0x4a')],'as':_0x351d('0x56'),'attributes':['id',_0x351d('0x1c'),_0x351d('0x57'),_0x351d('0x58'),'interface'],'raw':!![]}]})[_0x351d('0x16')](function(_0xbf5469){if(_0xbf5469){var _0x2a546a=_[_0x351d('0x59')](_0xbf5469,function(_0x2f61cd){var _0x1593d8=_0x2f61cd['get']({'plain':!![]});return _0x1593d8['Agents'];});return db[_0x351d('0x20')]['find']({'where':{'id':_0x1ca16a[_0x351d('0x3d')]['id']}})['then'](function(_0x9097e4){return db[_0x351d('0x5a')][_0x351d('0x5b')](function(_0x1d12e3){return _0x9097e4[_0x351d('0x54')](_0xba4a91,{'transaction':_0x1d12e3})[_0x351d('0x16')](function(){return BPromise['each'](_0x2a546a,function(_0x1250df){return db[_0x351d('0x41')][_0x351d('0x5c')]({'where':{'UserId':_0x1250df['id'],'WhatsappQueueId':_0x1ca16a[_0x351d('0x3d')]['id']},'transaction':_0x1d12e3});});})[_0x351d('0x16')](function(){_0x2a546a[_0x351d('0x5d')](function(_0x461695){socket[_0x351d('0x5e')](_0x351d('0x5f'),{'UserId':_0x461695['id'],'WhatsappQueueId':_0x9097e4['id']});});});});});}})[_0x351d('0x16')](respondWithStatusCode(_0x15475e,null))[_0x351d('0x39')](handleError(_0x15475e,null));};exports[_0x351d('0x60')]=function(_0x52f2cc,_0x4d4615){return db[_0x351d('0x53')]['findAll']({'where':{'id':_0x52f2cc[_0x351d('0x24')][_0x351d('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x351d('0x56'),'attributes':['id'],'raw':!![]}]})[_0x351d('0x16')](handleEntityNotFound(_0x4d4615,null))[_0x351d('0x16')](function(_0xf9d645){var _0x851732=_[_0x351d('0x1f')](_0xf9d645,'id');var _0x3a151b=[];var _0x5ee8b0=[];var _0x42cb7c=squel[_0x351d('0x61')]();_0x42cb7c[_0x351d('0x62')](_0x351d('0x63'))['from']('team_has_whatsapp_queues','tq')[_0x351d('0x64')](_0x351d('0x65'),'ut',_0x351d('0x66'))[_0x351d('0x47')]('WhatsappQueueId\x20=\x20?',_0x52f2cc[_0x351d('0x3d')]['id']);for(var _0x1620eb=0x0;_0x1620eb<_0xf9d645[_0x351d('0x2e')];_0x1620eb+=0x1){let _0x2b4d38=_0xf9d645[_0x1620eb];for(var _0x5c3c2f=0x0;_0x5c3c2f<_0x2b4d38[_0x351d('0x56')]['length'];_0x5c3c2f+=0x1){let _0x248b3b=_0x2b4d38['Agents'][_0x5c3c2f];var _0x4d70aa=_0x42cb7c[_0x351d('0x67')]();_0x4d70aa[_0x351d('0x47')](_0x351d('0x68'),_0x248b3b['id']);_0x5ee8b0['push'](db[_0x351d('0x5a')][_0x351d('0x24')](_0x4d70aa[_0x351d('0x69')](),{'type':db[_0x351d('0x5a')][_0x351d('0x6a')][_0x351d('0x6b')]})[_0x351d('0x16')](function(_0x446beb){if(_0x446beb[_0x351d('0x2e')]===0x1){return _0x248b3b['id'];}else{var _0x27440a=_['every'](_['map'](_0x446beb,_0x351d('0x6c')),function(_0x3872eb){return _[_0x351d('0x6d')](_0x851732,_0x3872eb);});if(_0x27440a){return _0x248b3b['id'];}}}));}}return BPromise[_0x351d('0x6e')](_0x5ee8b0)[_0x351d('0x16')](function(_0x1af5db){_0x3a151b=_(_0x3a151b)[_0x351d('0x6f')](_0x1af5db)['compact']()[_0x351d('0x70')]();return db[_0x351d('0x20')][_0x351d('0x31')]({'where':{'id':_0x52f2cc[_0x351d('0x3d')]['id']}})['then'](function(_0x34b436){return db[_0x351d('0x5a')][_0x351d('0x5b')](function(_0x56f2f8){return _0x34b436[_0x351d('0x60')](_0x52f2cc['query'][_0x351d('0x55')],{'transaction':_0x56f2f8})[_0x351d('0x16')](function(){if(!_['isEmpty'](_0x3a151b)){return _0x34b436[_0x351d('0x71')](_0x3a151b,{'transaction':_0x56f2f8});}})[_0x351d('0x16')](function(){_0x3a151b[_0x351d('0x5d')](function(_0x51c8f8){socket[_0x351d('0x5e')]('userWhatsappQueue:remove',{'UserId':_0x51c8f8,'WhatsappQueueId':_0x34b436['id']});});});});});});})['then'](respondWithStatusCode(_0x4d4615,null))['catch'](handleError(_0x4d4615,null));};exports[_0x351d('0x72')]=function(_0x3f2ce3,_0x4f6f56){return db['WhatsappQueue'][_0x351d('0x31')]({'where':{'id':_0x3f2ce3[_0x351d('0x3d')]['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x4f6f56,null))[_0x351d('0x16')](function(_0x3b7b6c){if(_0x3b7b6c){return _0x3b7b6c[_0x351d('0x72')](_0x3f2ce3['body']['ids'],_[_0x351d('0x73')](_0x3f2ce3[_0x351d('0x3c')],[_0x351d('0x55'),'id'])||{})['spread'](function(_0x36076d){for(var _0x8e6251=0x0;_0x8e6251<_0x3f2ce3[_0x351d('0x3c')][_0x351d('0x55')][_0x351d('0x2e')];_0x8e6251+=0x1){socket[_0x351d('0x5e')](_0x351d('0x5f'),{'UserId':Number(_0x3f2ce3[_0x351d('0x3c')]['ids'][_0x8e6251]),'WhatsappQueueId':Number(_0x3f2ce3['params']['id'])});}return _0x36076d;});}})[_0x351d('0x16')](respondWithResult(_0x4f6f56,null))[_0x351d('0x39')](handleError(_0x4f6f56,null));};exports[_0x351d('0x71')]=function(_0x57bd4e,_0x4ae87e){return db[_0x351d('0x20')][_0x351d('0x31')]({'where':{'id':_0x57bd4e[_0x351d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4ae87e,null))[_0x351d('0x16')](function(_0xc9cf3c){if(_0xc9cf3c){return _0xc9cf3c[_0x351d('0x71')](_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')])['then'](function(){if(_['isArray'](_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')])){for(var _0x3bee4a=0x0;_0x3bee4a<_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')]['length'];_0x3bee4a+=0x1){socket[_0x351d('0x5e')](_0x351d('0x74'),{'UserId':Number(_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')][_0x3bee4a]),'WhatsappQueueId':Number(_0x57bd4e[_0x351d('0x3d')]['id'])});}}else{socket[_0x351d('0x5e')](_0x351d('0x74'),{'UserId':Number(_0x57bd4e[_0x351d('0x24')][_0x351d('0x55')]),'WhatsappQueueId':Number(_0x57bd4e[_0x351d('0x3d')]['id'])});}});}})[_0x351d('0x16')](respondWithStatusCode(_0x4ae87e,null))[_0x351d('0x39')](handleError(_0x4ae87e,null));};exports[_0x351d('0x75')]=function(_0x5649a8,_0x1efad3){var _0x5fa3ab={};var _0x47a566={};var _0x54b76b;var _0x2cbc53;return db[_0x351d('0x20')][_0x351d('0x40')]({'where':{'id':_0x5649a8['params']['id']}})[_0x351d('0x16')](handleEntityNotFound(_0x1efad3,null))[_0x351d('0x16')](function(_0x226a46){if(_0x226a46){_0x54b76b=_0x226a46;_0x47a566[_0x351d('0x27')]=_[_0x351d('0x28')](db[_0x351d('0x4a')][_0x351d('0x29')]);_0x47a566[_0x351d('0x24')]=_[_0x351d('0x28')](_0x5649a8[_0x351d('0x24')]);_0x47a566[_0x351d('0x2a')]=_[_0x351d('0x2b')](_0x47a566[_0x351d('0x27')],_0x47a566[_0x351d('0x24')]);_0x5fa3ab['attributes']=_[_0x351d('0x2b')](_0x47a566[_0x351d('0x27')],qs[_0x351d('0x2d')](_0x5649a8[_0x351d('0x24')]['fields']));_0x5fa3ab['attributes']=_0x5fa3ab[_0x351d('0x2c')][_0x351d('0x2e')]?_0x5fa3ab['attributes']:_0x47a566[_0x351d('0x27')];_0x5fa3ab[_0x351d('0x44')]=qs[_0x351d('0x45')](_0x5649a8['query'][_0x351d('0x45')]);_0x5fa3ab[_0x351d('0x47')]=qs[_0x351d('0x2a')](_[_0x351d('0x76')](_0x5649a8['query'],_0x47a566[_0x351d('0x2a')]));if(_0x5649a8[_0x351d('0x24')][_0x351d('0x46')]){_0x5fa3ab[_0x351d('0x47')]=_['merge'](_0x5fa3ab[_0x351d('0x47')],{'$or':_[_0x351d('0x1f')](_0x5fa3ab['attributes'],function(_0x13f6a8){var _0x3ef007={};_0x3ef007[_0x13f6a8]={'$like':'%'+_0x5649a8[_0x351d('0x24')][_0x351d('0x46')]+'%'};return _0x3ef007;})});}_0x5fa3ab=_[_0x351d('0x30')]({},_0x5fa3ab,_0x5649a8[_0x351d('0x48')]);return _0x54b76b[_0x351d('0x75')](_0x5fa3ab);}})[_0x351d('0x16')](function(_0x2d718e){if(_0x2d718e){_0x2cbc53=_0x2d718e[_0x351d('0x2e')];if(!_0x5649a8['query']['hasOwnProperty'](_0x351d('0x43'))){_0x5fa3ab[_0x351d('0xf')]=qs[_0x351d('0xf')](_0x5649a8[_0x351d('0x24')]['limit']);_0x5fa3ab[_0x351d('0x11')]=qs['offset'](_0x5649a8[_0x351d('0x24')][_0x351d('0x11')]);}return _0x54b76b[_0x351d('0x75')](_0x5fa3ab);}})[_0x351d('0x16')](function(_0x62f5b0){if(_0x62f5b0){return _0x62f5b0?{'count':_0x2cbc53,'rows':_0x62f5b0}:null;}})[_0x351d('0x16')](respondWithResult(_0x1efad3,null))[_0x351d('0x39')](handleError(_0x1efad3,null));}; \ No newline at end of file +var _0xe96c=['query','show','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','sort','pick','WhatsappQueueId','filter','map','options','UserWhatsappQueue','findAll','User','findAndCountAll','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','whatsappPause','getTeams','Team','order','hasOwnProperty','ids','Agents','voicePause','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','WhatsappQueueId\x20=\x20?','clone','push','SELECT','every','TeamId','includes','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','WhatsappQueue','fieldName','key','where','include'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe96c,0xc2));var _0xce96=function(_0x3dfd07,_0x4d71ed){_0x3dfd07=_0x3dfd07-0x0;var _0x178393=_0xe96c[_0x3dfd07];return _0x178393;};'use strict';var BPromise=require(_0xce96('0x0'));var util=require(_0xce96('0x1'));var _=require(_0xce96('0x2'));var squel=require(_0xce96('0x3'));var Redis=require('ioredis');var qs=require(_0xce96('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xce96('0x5'));var db=require(_0xce96('0x6'))['db'];config['redis']=_[_0xce96('0x7')](config[_0xce96('0x8')],{'host':_0xce96('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce96('0xa'))[_0xce96('0xb')](socket);function respondWithStatusCode(_0x5cb5cb,_0x2d5374){_0x2d5374=_0x2d5374||0xcc;return function(_0x218c48){if(_0x218c48){return _0x5cb5cb[_0xce96('0xc')](_0x2d5374);}return _0x5cb5cb[_0xce96('0xd')](_0x2d5374)[_0xce96('0xe')]();};}function respondWithResult(_0x141926,_0x4f95f2){_0x4f95f2=_0x4f95f2||0xc8;return function(_0x1458da){if(_0x1458da){return _0x141926[_0xce96('0xd')](_0x4f95f2)[_0xce96('0xf')](_0x1458da);}};}function respondWithFilteredResult(_0x66d7c5,_0xdf95a3){return function(_0x5589fa){if(_0x5589fa){var _0x188c97=typeof _0xdf95a3[_0xce96('0x10')]==='undefined'&&typeof _0xdf95a3[_0xce96('0x11')]===_0xce96('0x12');var _0x4ca730=_0x5589fa[_0xce96('0x13')];var _0xa8d2aa=_0x188c97?0x0:_0xdf95a3[_0xce96('0x10')];var _0x54ceae=_0x188c97?_0x5589fa[_0xce96('0x13')]:_0xdf95a3[_0xce96('0x10')]+_0xdf95a3[_0xce96('0x11')];var _0xc5a58f;if(_0x54ceae>=_0x4ca730){_0x54ceae=_0x4ca730;_0xc5a58f=0xc8;}else{_0xc5a58f=0xce;}_0x66d7c5[_0xce96('0xd')](_0xc5a58f);return _0x66d7c5[_0xce96('0x14')](_0xce96('0x15'),_0xa8d2aa+'-'+_0x54ceae+'/'+_0x4ca730)['json'](_0x5589fa);}return null;};}function saveUpdates(_0x22abb0){return function(_0x3dccdd){if(_0x3dccdd){return _0x3dccdd['update'](_0x22abb0)[_0xce96('0x16')](function(_0x48f763){return _0x48f763;});}return null;};}function removeEntity(_0x223acc){return function(_0x4d5848){if(_0x4d5848){return _0x4d5848['destroy']()[_0xce96('0x16')](function(){var _0xbb1cf=_0x4d5848[_0xce96('0x17')]({'plain':!![]});var _0x4f692b=_0xce96('0x18');return db[_0xce96('0x19')][_0xce96('0x1a')]({'where':{'type':_0x4f692b,'resourceId':_0xbb1cf['id']}})[_0xce96('0x16')](function(){return _0x4d5848;});})[_0xce96('0x16')](function(){_0x223acc['status'](0xcc)[_0xce96('0xe')]();});}};}function handleEntityNotFound(_0x2e030a){return function(_0x5b911d){if(!_0x5b911d){_0x2e030a[_0xce96('0xc')](0x194);}return _0x5b911d;};}function handleError(_0x2aef3f,_0x4f0b5a){_0x4f0b5a=_0x4f0b5a||0x1f4;return function(_0x3c8166){logger[_0xce96('0x1b')](_0x3c8166[_0xce96('0x1c')]);if(_0x3c8166[_0xce96('0x1d')]){delete _0x3c8166[_0xce96('0x1d')];}_0x2aef3f['status'](_0x4f0b5a)[_0xce96('0x1e')](_0x3c8166);};}exports['index']=function(_0x4def0f,_0x5cbf96){var _0x38bd37={};var _0x1f8e81={'count':0x0,'rows':[]};var _0x5394f5=_['map'](db[_0xce96('0x1f')]['rawAttributes'],function(_0x1ca12c){return{'name':_0x1ca12c[_0xce96('0x20')],'type':_0x1ca12c['type'][_0xce96('0x21')]};});_0x38bd37=qs['getOptions'](_0x5394f5,_0x4def0f);var _0x42538c={'where':_0x38bd37[_0xce96('0x22')]};return db[_0xce96('0x1f')][_0xce96('0x13')](_0x42538c)[_0xce96('0x16')](function(_0x522ade){_0x1f8e81[_0xce96('0x13')]=_0x522ade;_0x38bd37[_0xce96('0x23')]=qs['include'](_0x4def0f[_0xce96('0x24')]);return db[_0xce96('0x1f')]['findAll'](_0x38bd37);})[_0xce96('0x16')](function(_0x548d27){_0x1f8e81['rows']=_0x548d27;return _0x1f8e81;})[_0xce96('0x16')](respondWithFilteredResult(_0x5cbf96,_0x38bd37))['catch'](handleError(_0x5cbf96,null));};exports[_0xce96('0x25')]=function(_0x26f963,_0x15fc43){var _0x806c07={'raw':!![],'where':{'id':_0x26f963[_0xce96('0x26')]['id']}},_0x5f14b2={};_0x5f14b2[_0xce96('0x27')]=_[_0xce96('0x28')](db[_0xce96('0x1f')][_0xce96('0x29')]);_0x5f14b2['query']=_['keys'](_0x26f963['query']);_0x5f14b2[_0xce96('0x2a')]=_['intersection'](_0x5f14b2[_0xce96('0x27')],_0x5f14b2['query']);_0x806c07[_0xce96('0x2b')]=_[_0xce96('0x2c')](_0x5f14b2['model'],qs[_0xce96('0x2d')](_0x26f963[_0xce96('0x24')][_0xce96('0x2d')]));_0x806c07[_0xce96('0x2b')]=_0x806c07[_0xce96('0x2b')][_0xce96('0x2e')]?_0x806c07['attributes']:_0x5f14b2[_0xce96('0x27')];if(_0x26f963[_0xce96('0x24')][_0xce96('0x2f')]){_0x806c07[_0xce96('0x23')]=[{'all':!![]}];}_0x806c07=_[_0xce96('0x30')]({},_0x806c07,_0x26f963['options']);return db[_0xce96('0x1f')][_0xce96('0x31')](_0x806c07)[_0xce96('0x16')](handleEntityNotFound(_0x15fc43,null))[_0xce96('0x16')](respondWithResult(_0x15fc43,null))[_0xce96('0x32')](handleError(_0x15fc43,null));};exports[_0xce96('0x33')]=function(_0x13222d,_0x4f7adc){return db['WhatsappQueue'][_0xce96('0x33')](_0x13222d[_0xce96('0x34')],{})[_0xce96('0x16')](function(_0x2b3cb3){var _0x352a62=_0x13222d[_0xce96('0x35')][_0xce96('0x17')]({'plain':!![]});if(!_0x352a62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x352a62['role']===_0xce96('0x35')){var _0x5ccb2d=_0x2b3cb3[_0xce96('0x17')]({'plain':!![]});var _0x2e02ab='WhatsappQueues';return db[_0xce96('0x36')][_0xce96('0x31')]({'where':{'name':_0x2e02ab,'userProfileId':_0x352a62[_0xce96('0x37')]},'raw':!![]})[_0xce96('0x16')](function(_0xbb7041){if(_0xbb7041&&_0xbb7041['autoAssociation']===0x0){return db[_0xce96('0x19')]['create']({'name':_0x5ccb2d[_0xce96('0x1d')],'resourceId':_0x5ccb2d['id'],'type':_0xbb7041[_0xce96('0x1d')],'sectionId':_0xbb7041['id']},{})[_0xce96('0x16')](function(){return _0x2b3cb3;});}else{return _0x2b3cb3;}})[_0xce96('0x32')](function(_0x90794e){logger[_0xce96('0x1b')](_0xce96('0x38'),_0x90794e);throw _0x90794e;});}return _0x2b3cb3;})[_0xce96('0x16')](respondWithResult(_0x4f7adc,0xc9))[_0xce96('0x32')](handleError(_0x4f7adc,null));};exports[_0xce96('0x39')]=function(_0x5c1fd2,_0x250d70){if(_0x5c1fd2['body']['id']){delete _0x5c1fd2[_0xce96('0x34')]['id'];}return db[_0xce96('0x1f')][_0xce96('0x31')]({'where':{'id':_0x5c1fd2[_0xce96('0x26')]['id']}})[_0xce96('0x16')](handleEntityNotFound(_0x250d70,null))[_0xce96('0x16')](saveUpdates(_0x5c1fd2[_0xce96('0x34')],null))['then'](respondWithResult(_0x250d70,null))['catch'](handleError(_0x250d70,null));};exports[_0xce96('0x1a')]=function(_0xad9f60,_0x427362){return db[_0xce96('0x1f')][_0xce96('0x31')]({'where':{'id':_0xad9f60[_0xce96('0x26')]['id']}})[_0xce96('0x16')](handleEntityNotFound(_0x427362,null))[_0xce96('0x16')](removeEntity(_0x427362,null))[_0xce96('0x32')](handleError(_0x427362,null));};exports[_0xce96('0x3a')]=function(_0x428407,_0x2df11a){return db[_0xce96('0x1f')][_0xce96('0x3a')]()[_0xce96('0x16')](respondWithResult(_0x2df11a,null))['catch'](handleError(_0x2df11a,null));};exports[_0xce96('0x3b')]=function(_0x2b871f,_0x26873b){var _0x43a8a1={'raw':!![],'where':{}},_0x541954={},_0x5e51b7;return db[_0xce96('0x1f')][_0xce96('0x3c')]({'where':{'id':_0x2b871f[_0xce96('0x26')]['id']}})[_0xce96('0x16')](handleEntityNotFound(_0x26873b,null))[_0xce96('0x16')](function(_0x4c7ee4){if(_0x4c7ee4){_0x5e51b7=_0x4c7ee4[_0xce96('0x17')]({'plain':!![]});_0x541954['model']=_['keys'](db['UserWhatsappQueue']['rawAttributes']);_0x541954['query']=_[_0xce96('0x28')](_0x2b871f[_0xce96('0x24')]);_0x541954[_0xce96('0x2a')]=_[_0xce96('0x2c')](_0x541954['model'],_0x541954['query']);_0x43a8a1[_0xce96('0x2b')]=_['intersection'](_0x541954[_0xce96('0x27')],qs[_0xce96('0x2d')](_0x2b871f['query'][_0xce96('0x2d')]));_0x43a8a1[_0xce96('0x2b')]=_0x43a8a1[_0xce96('0x2b')][_0xce96('0x2e')]?_0x43a8a1[_0xce96('0x2b')]:_0x541954[_0xce96('0x27')];if(!_0x2b871f[_0xce96('0x24')]['hasOwnProperty'](_0xce96('0x3d'))){_0x43a8a1['limit']=qs[_0xce96('0x11')](_0x2b871f[_0xce96('0x24')][_0xce96('0x11')]);_0x43a8a1[_0xce96('0x10')]=qs[_0xce96('0x10')](_0x2b871f[_0xce96('0x24')]['offset']);}_0x43a8a1['order']=qs[_0xce96('0x3e')](_0x2b871f[_0xce96('0x24')][_0xce96('0x3e')]);_0x43a8a1[_0xce96('0x22')]=qs['filters'](_[_0xce96('0x3f')](_0x2b871f[_0xce96('0x24')],_0x541954[_0xce96('0x2a')]));_0x43a8a1[_0xce96('0x22')][_0xce96('0x40')]=_0x4c7ee4['id'];if(_0x2b871f[_0xce96('0x24')][_0xce96('0x41')]){_0x43a8a1['where']=_[_0xce96('0x30')](_0x43a8a1['where'],{'$or':_[_0xce96('0x42')](_0x43a8a1[_0xce96('0x2b')],function(_0x4561ad){var _0x22c0bb={};_0x22c0bb[_0x4561ad]={'$like':'%'+_0x2b871f['query']['filter']+'%'};return _0x22c0bb;})});}_0x43a8a1=_[_0xce96('0x30')]({},_0x43a8a1,_0x2b871f[_0xce96('0x43')]);return db[_0xce96('0x44')][_0xce96('0x45')](_0x43a8a1);}})[_0xce96('0x16')](function(_0x19e976){if(_0x19e976){return db[_0xce96('0x46')][_0xce96('0x47')]({'where':{'id':_['map'](_0x19e976,'UserId'),'role':_0xce96('0x48')},'attributes':['id','name','whatsappPause',_0xce96('0x49'),_0xce96('0x4a')]});}})[_0xce96('0x16')](function(_0x43030c){if(_0x43030c){return{'count':_0x43030c[_0xce96('0x13')],'rows':_[_0xce96('0x42')](_0x43030c[_0xce96('0x4b')],function(_0x422ee0){return{'membername':_0x422ee0[_0xce96('0x1d')],'UserId':_0x422ee0['id'],'queue_name':_0x5e51b7[_0xce96('0x1d')],'WhatsappQueueId':_0x5e51b7['id'],'interface':util[_0xce96('0x4c')](_0xce96('0x4d'),_0xce96('0x4e'),_0x422ee0[_0xce96('0x1d')]),'penalty':0x0,'paused':_0x422ee0[_0xce96('0x4f')],'createdAt':_0x422ee0[_0xce96('0x4a')],'updatedAt':_0x422ee0[_0xce96('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x26873b,_0x43a8a1))[_0xce96('0x32')](handleError(_0x26873b,null));};exports[_0xce96('0x50')]=function(_0x3e4b2e,_0x156e4f){var _0x1ed42c={};var _0x22c381={};var _0x1b10ad;var _0x46bb67;return db[_0xce96('0x1f')][_0xce96('0x3c')]({'where':{'id':_0x3e4b2e[_0xce96('0x26')]['id']}})[_0xce96('0x16')](handleEntityNotFound(_0x156e4f,null))[_0xce96('0x16')](function(_0x43d326){if(_0x43d326){_0x1b10ad=_0x43d326;_0x22c381[_0xce96('0x27')]=_['keys'](db[_0xce96('0x51')]['rawAttributes']);_0x22c381['query']=_[_0xce96('0x28')](_0x3e4b2e['query']);_0x22c381['filters']=_[_0xce96('0x2c')](_0x22c381['model'],_0x22c381['query']);_0x1ed42c[_0xce96('0x2b')]=_[_0xce96('0x2c')](_0x22c381[_0xce96('0x27')],qs[_0xce96('0x2d')](_0x3e4b2e[_0xce96('0x24')][_0xce96('0x2d')]));_0x1ed42c['attributes']=_0x1ed42c['attributes']['length']?_0x1ed42c[_0xce96('0x2b')]:_0x22c381[_0xce96('0x27')];_0x1ed42c[_0xce96('0x52')]=qs['sort'](_0x3e4b2e[_0xce96('0x24')][_0xce96('0x3e')]);_0x1ed42c[_0xce96('0x22')]=qs[_0xce96('0x2a')](_['pick'](_0x3e4b2e[_0xce96('0x24')],_0x22c381[_0xce96('0x2a')]));if(_0x3e4b2e['query'][_0xce96('0x41')]){_0x1ed42c[_0xce96('0x22')]=_[_0xce96('0x30')](_0x1ed42c[_0xce96('0x22')],{'$or':_[_0xce96('0x42')](_0x1ed42c[_0xce96('0x2b')],function(_0x3d80fb){var _0x315f18={};_0x315f18[_0x3d80fb]={'$like':'%'+_0x3e4b2e[_0xce96('0x24')]['filter']+'%'};return _0x315f18;})});}_0x1ed42c=_[_0xce96('0x30')]({},_0x1ed42c,_0x3e4b2e[_0xce96('0x43')]);return _0x1b10ad[_0xce96('0x50')](_0x1ed42c);}})[_0xce96('0x16')](function(_0x17d967){if(_0x17d967){_0x46bb67=_0x17d967[_0xce96('0x2e')];if(!_0x3e4b2e[_0xce96('0x24')][_0xce96('0x53')](_0xce96('0x3d'))){_0x1ed42c[_0xce96('0x11')]=qs[_0xce96('0x11')](_0x3e4b2e[_0xce96('0x24')][_0xce96('0x11')]);_0x1ed42c[_0xce96('0x10')]=qs[_0xce96('0x10')](_0x3e4b2e[_0xce96('0x24')][_0xce96('0x10')]);}return _0x1b10ad[_0xce96('0x50')](_0x1ed42c);}})[_0xce96('0x16')](function(_0x24d137){if(_0x24d137){return _0x24d137?{'count':_0x46bb67,'rows':_0x24d137}:null;}})[_0xce96('0x16')](respondWithResult(_0x156e4f,null))[_0xce96('0x32')](handleError(_0x156e4f,null));};exports['addTeams']=function(_0x31baa6,_0x4616c6){var _0x119dc7=_0x31baa6['body'][_0xce96('0x54')];return db['Team'][_0xce96('0x45')]({'where':{'id':_0x119dc7},'attributes':['id'],'include':[{'model':db[_0xce96('0x46')],'as':_0xce96('0x55'),'attributes':['id','name','online',_0xce96('0x56'),'interface'],'raw':!![]}]})['then'](function(_0x124221){if(_0x124221){var _0x3e493f=_[_0xce96('0x57')](_0x124221,function(_0x5de98c){var _0x22404f=_0x5de98c[_0xce96('0x17')]({'plain':!![]});return _0x22404f[_0xce96('0x55')];});return db[_0xce96('0x1f')][_0xce96('0x31')]({'where':{'id':_0x31baa6[_0xce96('0x26')]['id']}})['then'](function(_0x2185dd){return db[_0xce96('0x58')]['transaction'](function(_0x21813f){return _0x2185dd[_0xce96('0x59')](_0x119dc7,{'transaction':_0x21813f})[_0xce96('0x16')](function(){return BPromise[_0xce96('0x5a')](_0x3e493f,function(_0x44e87e){return db['UserWhatsappQueue'][_0xce96('0x5b')]({'where':{'UserId':_0x44e87e['id'],'WhatsappQueueId':_0x31baa6['params']['id']},'transaction':_0x21813f});});})[_0xce96('0x16')](function(){_0x3e493f[_0xce96('0x5c')](function(_0x3f3df2){socket[_0xce96('0x5d')](_0xce96('0x5e'),{'UserId':_0x3f3df2['id'],'WhatsappQueueId':_0x2185dd['id']});});});});});}})[_0xce96('0x16')](respondWithStatusCode(_0x4616c6,null))[_0xce96('0x32')](handleError(_0x4616c6,null));};exports[_0xce96('0x5f')]=function(_0x2093bd,_0x5c9cb4){return db[_0xce96('0x51')][_0xce96('0x45')]({'where':{'id':_0x2093bd[_0xce96('0x24')][_0xce96('0x54')]},'attributes':['id'],'include':[{'model':db[_0xce96('0x46')],'as':_0xce96('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5c9cb4,null))['then'](function(_0x4de147){var _0x1084df=_['map'](_0x4de147,'id');var _0x3fe757=[];var _0x3a18c8=[];var _0xd42924=squel[_0xce96('0x60')]();_0xd42924[_0xce96('0x61')](_0xce96('0x62'))['from'](_0xce96('0x63'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xce96('0x64'),_0x2093bd[_0xce96('0x26')]['id']);for(var _0x20ed5b=0x0;_0x20ed5b<_0x4de147['length'];_0x20ed5b+=0x1){let _0x4cb07e=_0x4de147[_0x20ed5b];for(var _0x33a027=0x0;_0x33a027<_0x4cb07e[_0xce96('0x55')][_0xce96('0x2e')];_0x33a027+=0x1){let _0x449a27=_0x4cb07e[_0xce96('0x55')][_0x33a027];var _0x15e4f1=_0xd42924[_0xce96('0x65')]();_0x15e4f1['where']('ut.UserId\x20=\x20?',_0x449a27['id']);_0x3a18c8[_0xce96('0x66')](db['sequelize'][_0xce96('0x24')](_0x15e4f1['toString'](),{'type':db[_0xce96('0x58')]['QueryTypes'][_0xce96('0x67')]})[_0xce96('0x16')](function(_0x479a5e){if(_0x479a5e[_0xce96('0x2e')]===0x1){return _0x449a27['id'];}else{var _0x8dc3b=_[_0xce96('0x68')](_[_0xce96('0x42')](_0x479a5e,_0xce96('0x69')),function(_0x1016e8){return _[_0xce96('0x6a')](_0x1084df,_0x1016e8);});if(_0x8dc3b){return _0x449a27['id'];}}}));}}return BPromise['all'](_0x3a18c8)[_0xce96('0x16')](function(_0x39fe8d){_0x3fe757=_(_0x3fe757)['union'](_0x39fe8d)['compact']()['value']();return db[_0xce96('0x1f')][_0xce96('0x31')]({'where':{'id':_0x2093bd['params']['id']}})[_0xce96('0x16')](function(_0x5e4c53){return db['sequelize']['transaction'](function(_0x14ad22){return _0x5e4c53['removeTeams'](_0x2093bd[_0xce96('0x24')][_0xce96('0x54')],{'transaction':_0x14ad22})['then'](function(){if(!_[_0xce96('0x6b')](_0x3fe757)){return _0x5e4c53[_0xce96('0x6c')](_0x3fe757,{'transaction':_0x14ad22});}})['then'](function(){_0x3fe757[_0xce96('0x5c')](function(_0x1bfda7){socket['emit'](_0xce96('0x6d'),{'UserId':_0x1bfda7,'WhatsappQueueId':_0x5e4c53['id']});});});});});});})['then'](respondWithStatusCode(_0x5c9cb4,null))[_0xce96('0x32')](handleError(_0x5c9cb4,null));};exports['addAgents']=function(_0x10b46a,_0x1451af){return db[_0xce96('0x1f')][_0xce96('0x31')]({'where':{'id':_0x10b46a[_0xce96('0x26')]['id']}})[_0xce96('0x16')](handleEntityNotFound(_0x1451af,null))['then'](function(_0x32459a){if(_0x32459a){return _0x32459a[_0xce96('0x6e')](_0x10b46a[_0xce96('0x34')][_0xce96('0x54')],_[_0xce96('0x6f')](_0x10b46a[_0xce96('0x34')],[_0xce96('0x54'),'id'])||{})[_0xce96('0x70')](function(_0x5cf6eb){for(var _0x5d5a4a=0x0;_0x5d5a4a<_0x10b46a[_0xce96('0x34')]['ids'][_0xce96('0x2e')];_0x5d5a4a+=0x1){socket[_0xce96('0x5d')]('userWhatsappQueue:save',{'UserId':Number(_0x10b46a[_0xce96('0x34')]['ids'][_0x5d5a4a]),'WhatsappQueueId':Number(_0x10b46a['params']['id'])});}return _0x5cf6eb;});}})[_0xce96('0x16')](respondWithResult(_0x1451af,null))[_0xce96('0x32')](handleError(_0x1451af,null));};exports[_0xce96('0x6c')]=function(_0x5d9687,_0x377ddb){return db['WhatsappQueue'][_0xce96('0x31')]({'where':{'id':_0x5d9687[_0xce96('0x26')]['id']}})[_0xce96('0x16')](handleEntityNotFound(_0x377ddb,null))[_0xce96('0x16')](function(_0x3d1d11){if(_0x3d1d11){return _0x3d1d11[_0xce96('0x6c')](_0x5d9687[_0xce96('0x24')][_0xce96('0x54')])[_0xce96('0x16')](function(){if(_[_0xce96('0x71')](_0x5d9687[_0xce96('0x24')][_0xce96('0x54')])){for(var _0x32d8c4=0x0;_0x32d8c4<_0x5d9687['query']['ids'][_0xce96('0x2e')];_0x32d8c4+=0x1){socket[_0xce96('0x5d')](_0xce96('0x6d'),{'UserId':Number(_0x5d9687['query'][_0xce96('0x54')][_0x32d8c4]),'WhatsappQueueId':Number(_0x5d9687[_0xce96('0x26')]['id'])});}}else{socket[_0xce96('0x5d')](_0xce96('0x6d'),{'UserId':Number(_0x5d9687[_0xce96('0x24')]['ids']),'WhatsappQueueId':Number(_0x5d9687[_0xce96('0x26')]['id'])});}});}})[_0xce96('0x16')](respondWithStatusCode(_0x377ddb,null))[_0xce96('0x32')](handleError(_0x377ddb,null));};exports[_0xce96('0x72')]=function(_0x5b56e9,_0x3398a0){var _0x5bfcda={};var _0x4ccf3d={};var _0x80e712;var _0x4f78d3;return db[_0xce96('0x1f')][_0xce96('0x3c')]({'where':{'id':_0x5b56e9['params']['id']}})['then'](handleEntityNotFound(_0x3398a0,null))[_0xce96('0x16')](function(_0xc610aa){if(_0xc610aa){_0x80e712=_0xc610aa;_0x4ccf3d[_0xce96('0x27')]=_[_0xce96('0x28')](db[_0xce96('0x46')][_0xce96('0x29')]);_0x4ccf3d['query']=_['keys'](_0x5b56e9[_0xce96('0x24')]);_0x4ccf3d[_0xce96('0x2a')]=_[_0xce96('0x2c')](_0x4ccf3d[_0xce96('0x27')],_0x4ccf3d[_0xce96('0x24')]);_0x5bfcda[_0xce96('0x2b')]=_[_0xce96('0x2c')](_0x4ccf3d[_0xce96('0x27')],qs[_0xce96('0x2d')](_0x5b56e9[_0xce96('0x24')][_0xce96('0x2d')]));_0x5bfcda[_0xce96('0x2b')]=_0x5bfcda['attributes'][_0xce96('0x2e')]?_0x5bfcda[_0xce96('0x2b')]:_0x4ccf3d[_0xce96('0x27')];_0x5bfcda[_0xce96('0x52')]=qs[_0xce96('0x3e')](_0x5b56e9['query'][_0xce96('0x3e')]);_0x5bfcda[_0xce96('0x22')]=qs['filters'](_['pick'](_0x5b56e9['query'],_0x4ccf3d[_0xce96('0x2a')]));if(_0x5b56e9['query'][_0xce96('0x41')]){_0x5bfcda[_0xce96('0x22')]=_[_0xce96('0x30')](_0x5bfcda['where'],{'$or':_[_0xce96('0x42')](_0x5bfcda[_0xce96('0x2b')],function(_0x4c52c2){var _0x2ce21f={};_0x2ce21f[_0x4c52c2]={'$like':'%'+_0x5b56e9[_0xce96('0x24')][_0xce96('0x41')]+'%'};return _0x2ce21f;})});}_0x5bfcda=_[_0xce96('0x30')]({},_0x5bfcda,_0x5b56e9[_0xce96('0x43')]);return _0x80e712['getAgents'](_0x5bfcda);}})[_0xce96('0x16')](function(_0x27de05){if(_0x27de05){_0x4f78d3=_0x27de05['length'];if(!_0x5b56e9['query'][_0xce96('0x53')](_0xce96('0x3d'))){_0x5bfcda[_0xce96('0x11')]=qs['limit'](_0x5b56e9[_0xce96('0x24')]['limit']);_0x5bfcda[_0xce96('0x10')]=qs[_0xce96('0x10')](_0x5b56e9[_0xce96('0x24')][_0xce96('0x10')]);}return _0x80e712[_0xce96('0x72')](_0x5bfcda);}})[_0xce96('0x16')](function(_0x1849c0){if(_0x1849c0){return _0x1849c0?{'count':_0x4f78d3,'rows':_0x1849c0}:null;}})[_0xce96('0x16')](respondWithResult(_0x3398a0,null))[_0xce96('0x32')](handleError(_0x3398a0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9407a8c..df143b1 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 _0xcba0=['../../mysqldb','save','remove','hasOwnProperty','exports','events'];(function(_0xa9aa2d,_0x233ded){var _0x5d253e=function(_0x407637){while(--_0x407637){_0xa9aa2d['push'](_0xa9aa2d['shift']());}};_0x5d253e(++_0x233ded);}(_0xcba0,0x1a3));var _0x0cba=function(_0x54a2f2,_0x59258f){_0x54a2f2=_0x54a2f2-0x0;var _0x24ebec=_0xcba0[_0x54a2f2];return _0x24ebec;};'use strict';var EventEmitter=require(_0x0cba('0x0'));var WhatsappQueue=require(_0x0cba('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0cba('0x2'),'afterUpdate':'update','afterDestroy':_0x0cba('0x3')};function emitEvent(_0x2b73de){return function(_0x484cb0,_0x1e90e7,_0x59c0b0){WhatsappQueueEvents['emit'](_0x2b73de+':'+_0x484cb0['id'],_0x484cb0);WhatsappQueueEvents['emit'](_0x2b73de,_0x484cb0);_0x59c0b0(null);};}for(var e in events){if(events[_0x0cba('0x4')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x0cba('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0xcb25=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','update'];(function(_0x5896bf,_0x6d3a11){var _0x1deca7=function(_0x465969){while(--_0x465969){_0x5896bf['push'](_0x5896bf['shift']());}};_0x1deca7(++_0x6d3a11);}(_0xcb25,0x124));var _0x5cb2=function(_0x338b15,_0x3202d8){_0x338b15=_0x338b15-0x0;var _0x466e43=_0xcb25[_0x338b15];return _0x466e43;};'use strict';var EventEmitter=require(_0x5cb2('0x0'));var WhatsappQueue=require(_0x5cb2('0x1'))['db'][_0x5cb2('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5cb2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5cb2('0x4'),'afterDestroy':_0x5cb2('0x5')};function emitEvent(_0x84613a){return function(_0x26f67d,_0x3ca854,_0x3474a2){WhatsappQueueEvents[_0x5cb2('0x6')](_0x84613a+':'+_0x26f67d['id'],_0x26f67d);WhatsappQueueEvents[_0x5cb2('0x6')](_0x84613a,_0x26f67d);_0x3474a2(null);};}for(var e in events){if(events[_0x5cb2('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5cb2('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 c2160d8..4666e02 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 _0x8c4b=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c4b,0xea));var _0xb8c4=function(_0x293023,_0x4ac622){_0x293023=_0x293023-0x0;var _0x49751d=_0x8c4b[_0x293023];return _0x49751d;};'use strict';var _=require('lodash');var util=require(_0xb8c4('0x0'));var logger=require(_0xb8c4('0x1'))(_0xb8c4('0x2'));var moment=require(_0xb8c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8c4('0x4'));var fs=require('fs');var path=require(_0xb8c4('0x5'));var rimraf=require('rimraf');var config=require(_0xb8c4('0x6'));var attributes=require(_0xb8c4('0x7'));module[_0xb8c4('0x8')]=function(_0x56b44b,_0x342230){return _0x56b44b[_0xb8c4('0x9')](_0xb8c4('0xa'),attributes,{'tableName':_0xb8c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7070=['define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./whatsappQueue.attributes','exports'];(function(_0x5bacec,_0x1bc748){var _0x4c82b1=function(_0x281745){while(--_0x281745){_0x5bacec['push'](_0x5bacec['shift']());}};_0x4c82b1(++_0x1bc748);}(_0x7070,0x18f));var _0x0707=function(_0x2cab3a,_0x15491e){_0x2cab3a=_0x2cab3a-0x0;var _0x415463=_0x7070[_0x2cab3a];return _0x415463;};'use strict';var _=require(_0x0707('0x0'));var util=require(_0x0707('0x1'));var logger=require(_0x0707('0x2'))(_0x0707('0x3'));var moment=require(_0x0707('0x4'));var BPromise=require('bluebird');var rp=require(_0x0707('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0707('0x6'));var config=require('../../config/environment');var attributes=require(_0x0707('0x7'));module[_0x0707('0x8')]=function(_0x49ed7f,_0x577081){return _0x49ed7f[_0x0707('0x9')](_0x0707('0xa'),attributes,{'tableName':_0x0707('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 8e25711..85a8cb7 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 _0x5dc0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','model','attributes','map','then','ShowWhatsappQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1c75e0,_0x4ee297){var _0x5beb72=function(_0x4f50a1){while(--_0x4f50a1){_0x1c75e0['push'](_0x1c75e0['shift']());}};_0x5beb72(++_0x4ee297);}(_0x5dc0,0xcc));var _0x05dc=function(_0x5be7ad,_0x3ced91){_0x5be7ad=_0x5be7ad-0x0;var _0x497c61=_0x5dc0[_0x5be7ad];return _0x497c61;};'use strict';var _=require(_0x05dc('0x0'));var util=require(_0x05dc('0x1'));var moment=require(_0x05dc('0x2'));var BPromise=require(_0x05dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05dc('0x4'));var db=require(_0x05dc('0x5'))['db'];var utils=require(_0x05dc('0x6'));var logger=require(_0x05dc('0x7'))(_0x05dc('0x8'));var config=require(_0x05dc('0x9'));var jayson=require(_0x05dc('0xa'));var client=jayson['client'][_0x05dc('0xb')]({'port':0x232a});config[_0x05dc('0xc')]=_[_0x05dc('0xd')](config[_0x05dc('0xc')],{'host':_0x05dc('0xe'),'port':0x18eb});var socket=require(_0x05dc('0xf'))(new Redis(config['redis']));require(_0x05dc('0x10'))[_0x05dc('0x11')](socket);function respondWithRpcPromise(_0x3f1b76,_0x1436d2,_0x73a43e){return new BPromise(function(_0x4ca50f,_0x3fa260){return client[_0x05dc('0x12')](_0x3f1b76,_0x73a43e)['then'](function(_0x5ad956){logger[_0x05dc('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x1436d2,_0x05dc('0x14'));logger[_0x05dc('0x15')](_0x05dc('0x16'),_0x1436d2,'request\x20sent',JSON[_0x05dc('0x17')](_0x5ad956));if(_0x5ad956[_0x05dc('0x18')]){if(_0x5ad956[_0x05dc('0x18')][_0x05dc('0x19')]===0x1f4){logger[_0x05dc('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x1436d2,_0x5ad956[_0x05dc('0x18')][_0x05dc('0x1a')]);return _0x3fa260(_0x5ad956['error'][_0x05dc('0x1a')]);}logger[_0x05dc('0x18')](_0x05dc('0x1b'),_0x1436d2,_0x5ad956[_0x05dc('0x18')][_0x05dc('0x1a')]);return _0x4ca50f(_0x5ad956[_0x05dc('0x18')][_0x05dc('0x1a')]);}else{logger[_0x05dc('0x13')](_0x05dc('0x1b'),_0x1436d2,_0x05dc('0x14'));_0x4ca50f(_0x5ad956['result'][_0x05dc('0x1a')]);}})[_0x05dc('0x1c')](function(_0x5d3dc5){logger[_0x05dc('0x18')](_0x05dc('0x1b'),_0x1436d2,_0x5d3dc5);_0x3fa260(_0x5d3dc5);});});}exports[_0x05dc('0x1d')]=function(_0x38f2e5){var _0x16b721=this;return new Promise(function(_0x10f58e,_0x35be17){return db[_0x05dc('0x1e')]['findAll']({'raw':_0x38f2e5['options']?_0x38f2e5[_0x05dc('0x1f')][_0x05dc('0x20')]===undefined?!![]:![]:!![],'where':_0x38f2e5[_0x05dc('0x1f')]?_0x38f2e5['options'][_0x05dc('0x21')]||null:null,'attributes':_0x38f2e5[_0x05dc('0x1f')]?_0x38f2e5[_0x05dc('0x1f')]['attributes']||null:null,'limit':_0x38f2e5['options']?_0x38f2e5[_0x05dc('0x1f')][_0x05dc('0x22')]||null:null,'include':_0x38f2e5['options']?_0x38f2e5['options'][_0x05dc('0x23')]?_['map'](_0x38f2e5[_0x05dc('0x1f')]['include'],function(_0x99b952){return{'model':db[_0x99b952[_0x05dc('0x24')]],'as':_0x99b952['as'],'attributes':_0x99b952[_0x05dc('0x25')],'include':_0x99b952[_0x05dc('0x23')]?_[_0x05dc('0x26')](_0x99b952[_0x05dc('0x23')],function(_0x51713a){return{'model':db[_0x51713a[_0x05dc('0x24')]],'as':_0x51713a['as'],'attributes':_0x51713a['attributes'],'include':_0x51713a[_0x05dc('0x23')]?_[_0x05dc('0x26')](_0x51713a['include'],function(_0x388fb9){return{'model':db[_0x388fb9['model']],'as':_0x388fb9['as'],'attributes':_0x388fb9[_0x05dc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x05dc('0x27')](function(_0x40430c){logger[_0x05dc('0x13')](_0x05dc('0x1d'),_0x38f2e5);logger[_0x05dc('0x15')](_0x05dc('0x1d'),_0x38f2e5,JSON[_0x05dc('0x17')](_0x40430c));_0x10f58e(_0x40430c);})['catch'](function(_0x83003d){logger[_0x05dc('0x18')](_0x05dc('0x1d'),_0x83003d[_0x05dc('0x1a')],_0x38f2e5);_0x35be17(_0x16b721[_0x05dc('0x18')](0x1f4,_0x83003d[_0x05dc('0x1a')]));});});};exports[_0x05dc('0x28')]=function(_0x2608a0){var _0x4378b9=this;return new Promise(function(_0x755a96,_0x2f6bc0){return db[_0x05dc('0x1e')][_0x05dc('0x29')]({'raw':_0x2608a0[_0x05dc('0x1f')]?_0x2608a0[_0x05dc('0x1f')][_0x05dc('0x20')]===undefined?!![]:![]:!![],'where':_0x2608a0[_0x05dc('0x1f')]?_0x2608a0[_0x05dc('0x1f')][_0x05dc('0x21')]||null:null,'attributes':_0x2608a0['options']?_0x2608a0[_0x05dc('0x1f')][_0x05dc('0x25')]||null:null,'include':_0x2608a0[_0x05dc('0x1f')]?_0x2608a0[_0x05dc('0x1f')][_0x05dc('0x23')]?_[_0x05dc('0x26')](_0x2608a0[_0x05dc('0x1f')]['include'],function(_0x2ca114){return{'model':db[_0x2ca114[_0x05dc('0x24')]],'as':_0x2ca114['as'],'attributes':_0x2ca114[_0x05dc('0x25')],'include':_0x2ca114[_0x05dc('0x23')]?_[_0x05dc('0x26')](_0x2ca114[_0x05dc('0x23')],function(_0x3bb165){return{'model':db[_0x3bb165[_0x05dc('0x24')]],'as':_0x3bb165['as'],'attributes':_0x3bb165[_0x05dc('0x25')],'include':_0x3bb165['include']?_[_0x05dc('0x26')](_0x3bb165[_0x05dc('0x23')],function(_0x545848){return{'model':db[_0x545848[_0x05dc('0x24')]],'as':_0x545848['as'],'attributes':_0x545848['attributes']};}):[]};}):[]};}):[]:[]})[_0x05dc('0x27')](function(_0x5ddbdb){logger[_0x05dc('0x13')](_0x05dc('0x28'),_0x2608a0);logger[_0x05dc('0x15')](_0x05dc('0x28'),_0x2608a0,JSON[_0x05dc('0x17')](_0x5ddbdb));_0x755a96(_0x5ddbdb);})[_0x05dc('0x1c')](function(_0x1a4af5){logger[_0x05dc('0x18')](_0x05dc('0x28'),_0x1a4af5[_0x05dc('0x1a')],_0x2608a0);_0x2f6bc0(_0x4378b9[_0x05dc('0x18')](0x1f4,_0x1a4af5[_0x05dc('0x1a')]));});});}; \ No newline at end of file +var _0x3f2d=['http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','map','attributes','model','stringify','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x50faaa,_0x59d114){var _0x48300e=function(_0x4cdf0f){while(--_0x4cdf0f){_0x50faaa['push'](_0x50faaa['shift']());}};_0x48300e(++_0x59d114);}(_0x3f2d,0xc7));var _0xd3f2=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x3f2d[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xd3f2('0x0'));var util=require(_0xd3f2('0x1'));var moment=require(_0xd3f2('0x2'));var BPromise=require(_0xd3f2('0x3'));var rs=require(_0xd3f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3f2('0x5'))['db'];var utils=require(_0xd3f2('0x6'));var logger=require(_0xd3f2('0x7'))(_0xd3f2('0x8'));var config=require(_0xd3f2('0x9'));var jayson=require(_0xd3f2('0xa'));var client=jayson['client'][_0xd3f2('0xb')]({'port':0x232a});config[_0xd3f2('0xc')]=_[_0xd3f2('0xd')](config['redis'],{'host':_0xd3f2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd3f2('0xf'))[_0xd3f2('0x10')](socket);function respondWithRpcPromise(_0x55f22c,_0x199f02,_0x1be678){return new BPromise(function(_0x149e8f,_0x51c956){return client[_0xd3f2('0x11')](_0x55f22c,_0x1be678)[_0xd3f2('0x12')](function(_0x5ceb72){logger[_0xd3f2('0x13')](_0xd3f2('0x14'),_0x199f02,_0xd3f2('0x15'));logger[_0xd3f2('0x16')](_0xd3f2('0x17'),_0x199f02,'request\x20sent',JSON['stringify'](_0x5ceb72));if(_0x5ceb72['error']){if(_0x5ceb72[_0xd3f2('0x18')][_0xd3f2('0x19')]===0x1f4){logger[_0xd3f2('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x199f02,_0x5ceb72['error']['message']);return _0x51c956(_0x5ceb72['error'][_0xd3f2('0x1a')]);}logger[_0xd3f2('0x18')](_0xd3f2('0x14'),_0x199f02,_0x5ceb72[_0xd3f2('0x18')]['message']);return _0x149e8f(_0x5ceb72[_0xd3f2('0x18')][_0xd3f2('0x1a')]);}else{logger['info'](_0xd3f2('0x14'),_0x199f02,_0xd3f2('0x15'));_0x149e8f(_0x5ceb72[_0xd3f2('0x1b')][_0xd3f2('0x1a')]);}})[_0xd3f2('0x1c')](function(_0x3d8cb5){logger['error'](_0xd3f2('0x14'),_0x199f02,_0x3d8cb5);_0x51c956(_0x3d8cb5);});});}exports[_0xd3f2('0x1d')]=function(_0x1b7baf){var _0x3ed8d0=this;return new Promise(function(_0x55bd64,_0x53a297){return db[_0xd3f2('0x1e')]['findAll']({'raw':_0x1b7baf[_0xd3f2('0x1f')]?_0x1b7baf[_0xd3f2('0x1f')][_0xd3f2('0x20')]===undefined?!![]:![]:!![],'where':_0x1b7baf[_0xd3f2('0x1f')]?_0x1b7baf[_0xd3f2('0x1f')][_0xd3f2('0x21')]||null:null,'attributes':_0x1b7baf[_0xd3f2('0x1f')]?_0x1b7baf['options']['attributes']||null:null,'limit':_0x1b7baf['options']?_0x1b7baf[_0xd3f2('0x1f')][_0xd3f2('0x22')]||null:null,'include':_0x1b7baf[_0xd3f2('0x1f')]?_0x1b7baf['options'][_0xd3f2('0x23')]?_[_0xd3f2('0x24')](_0x1b7baf['options'][_0xd3f2('0x23')],function(_0x44889d){return{'model':db[_0x44889d['model']],'as':_0x44889d['as'],'attributes':_0x44889d[_0xd3f2('0x25')],'include':_0x44889d['include']?_[_0xd3f2('0x24')](_0x44889d['include'],function(_0x2a0110){return{'model':db[_0x2a0110[_0xd3f2('0x26')]],'as':_0x2a0110['as'],'attributes':_0x2a0110['attributes'],'include':_0x2a0110[_0xd3f2('0x23')]?_['map'](_0x2a0110[_0xd3f2('0x23')],function(_0x5c8cc0){return{'model':db[_0x5c8cc0['model']],'as':_0x5c8cc0['as'],'attributes':_0x5c8cc0[_0xd3f2('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd3f2('0x12')](function(_0x4dc7eb){logger[_0xd3f2('0x13')]('GetWhatsappQueue',_0x1b7baf);logger[_0xd3f2('0x16')]('GetWhatsappQueue',_0x1b7baf,JSON[_0xd3f2('0x27')](_0x4dc7eb));_0x55bd64(_0x4dc7eb);})[_0xd3f2('0x1c')](function(_0x144149){logger['error']('GetWhatsappQueue',_0x144149['message'],_0x1b7baf);_0x53a297(_0x3ed8d0[_0xd3f2('0x18')](0x1f4,_0x144149['message']));});});};exports[_0xd3f2('0x28')]=function(_0x5c4b01){var _0x528d90=this;return new Promise(function(_0x3a5e0f,_0x538481){return db[_0xd3f2('0x1e')][_0xd3f2('0x29')]({'raw':_0x5c4b01[_0xd3f2('0x1f')]?_0x5c4b01[_0xd3f2('0x1f')][_0xd3f2('0x20')]===undefined?!![]:![]:!![],'where':_0x5c4b01[_0xd3f2('0x1f')]?_0x5c4b01[_0xd3f2('0x1f')][_0xd3f2('0x21')]||null:null,'attributes':_0x5c4b01[_0xd3f2('0x1f')]?_0x5c4b01['options'][_0xd3f2('0x25')]||null:null,'include':_0x5c4b01[_0xd3f2('0x1f')]?_0x5c4b01[_0xd3f2('0x1f')][_0xd3f2('0x23')]?_[_0xd3f2('0x24')](_0x5c4b01['options'][_0xd3f2('0x23')],function(_0xd90fe){return{'model':db[_0xd90fe[_0xd3f2('0x26')]],'as':_0xd90fe['as'],'attributes':_0xd90fe[_0xd3f2('0x25')],'include':_0xd90fe[_0xd3f2('0x23')]?_['map'](_0xd90fe[_0xd3f2('0x23')],function(_0x15aed5){return{'model':db[_0x15aed5[_0xd3f2('0x26')]],'as':_0x15aed5['as'],'attributes':_0x15aed5[_0xd3f2('0x25')],'include':_0x15aed5[_0xd3f2('0x23')]?_[_0xd3f2('0x24')](_0x15aed5[_0xd3f2('0x23')],function(_0x3f5d04){return{'model':db[_0x3f5d04[_0xd3f2('0x26')]],'as':_0x3f5d04['as'],'attributes':_0x3f5d04['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58d8fb){logger[_0xd3f2('0x13')]('ShowWhatsappQueue',_0x5c4b01);logger[_0xd3f2('0x16')](_0xd3f2('0x28'),_0x5c4b01,JSON[_0xd3f2('0x27')](_0x58d8fb));_0x3a5e0f(_0x58d8fb);})[_0xd3f2('0x1c')](function(_0x4a98c5){logger[_0xd3f2('0x18')](_0xd3f2('0x28'),_0x4a98c5[_0xd3f2('0x1a')],_0x5c4b01);_0x538481(_0x528d90[_0xd3f2('0x18')](0x1f4,_0x4a98c5[_0xd3f2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c120032..6fcb0d8 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 _0xc80a=['register','length','save','remove','update','emit','removeListener'];(function(_0x375e92,_0x5965d4){var _0x2ddeeb=function(_0x4bba14){while(--_0x4bba14){_0x375e92['push'](_0x375e92['shift']());}};_0x2ddeeb(++_0x5965d4);}(_0xc80a,0x6b));var _0xac80=function(_0x2c8972,_0x1aff63){_0x2c8972=_0x2c8972-0x0;var _0x5d1e22=_0xc80a[_0x2c8972];return _0x5d1e22;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xac80('0x0'),_0xac80('0x1'),_0xac80('0x2')];function createListener(_0x54cf6c,_0x164ec5){return function(_0x1f53b8){_0x164ec5[_0xac80('0x3')](_0x54cf6c,_0x1f53b8);};}function removeListener(_0x30c196,_0x1cac8d){return function(){WhatsappQueueEvents[_0xac80('0x4')](_0x30c196,_0x1cac8d);};}exports[_0xac80('0x5')]=function(_0x9de8a7){for(var _0x266e7a=0x0,_0x11e4cf=events[_0xac80('0x6')];_0x266e7a<_0x11e4cf;_0x266e7a++){var _0x2ae1b0=events[_0x266e7a];var _0x4c818b=createListener('whatsappQueue:'+_0x2ae1b0,_0x9de8a7);WhatsappQueueEvents['on'](_0x2ae1b0,_0x4c818b);}}; \ No newline at end of file +var _0x2e6e=['length','whatsappQueue:','./whatsappQueue.events','save','update','emit','removeListener','register'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x2e6e,0x14a));var _0xe2e6=function(_0x1515c9,_0x3db945){_0x1515c9=_0x1515c9-0x0;var _0x3e9c59=_0x2e6e[_0x1515c9];return _0x3e9c59;};'use strict';var WhatsappQueueEvents=require(_0xe2e6('0x0'));var events=[_0xe2e6('0x1'),'remove',_0xe2e6('0x2')];function createListener(_0x3ee13f,_0xa08d54){return function(_0x4b09a0){_0xa08d54[_0xe2e6('0x3')](_0x3ee13f,_0x4b09a0);};}function removeListener(_0x197cda,_0x19a910){return function(){WhatsappQueueEvents[_0xe2e6('0x4')](_0x197cda,_0x19a910);};}exports[_0xe2e6('0x5')]=function(_0x1766dc){for(var _0xa699a2=0x0,_0x2a87ce=events[_0xe2e6('0x6')];_0xa699a2<_0x2a87ce;_0xa699a2++){var _0x59b067=events[_0xa699a2];var _0x53b1f7=createListener(_0xe2e6('0x7')+_0x59b067,_0x1766dc);WhatsappQueueEvents['on'](_0x59b067,_0x53b1f7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 01c59a5..ebec461 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 _0xd86c=['express','fs-extra','../../config/environment','./whatsappQueueReport.controller','index','get','/describe','describe','isAuthenticated','post','put','/:id','update','delete','multer','util','path','connect-timeout'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xd86c,0xb0));var _0xcd86=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xd86c[_0x35af23];return _0x340506;};'use strict';var multer=require(_0xcd86('0x0'));var util=require(_0xcd86('0x1'));var path=require(_0xcd86('0x2'));var timeout=require(_0xcd86('0x3'));var express=require(_0xcd86('0x4'));var router=express['Router']();var fs_extra=require(_0xcd86('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd86('0x6'));var controller=require(_0xcd86('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcd86('0x8')]);router[_0xcd86('0x9')](_0xcd86('0xa'),auth['isAuthenticated'](),controller[_0xcd86('0xb')]);router['get']('/:id',auth[_0xcd86('0xc')](),controller['show']);router[_0xcd86('0xd')]('/',auth[_0xcd86('0xc')](),controller['create']);router[_0xcd86('0xe')](_0xcd86('0xf'),auth['isAuthenticated'](),controller[_0xcd86('0x10')]);router[_0xcd86('0x11')](_0xcd86('0xf'),auth[_0xcd86('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x633b=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index'];(function(_0x4f5226,_0x518f6c){var _0x42fdd5=function(_0x565397){while(--_0x565397){_0x4f5226['push'](_0x4f5226['shift']());}};_0x42fdd5(++_0x518f6c);}(_0x633b,0xf1));var _0xb633=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x633b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb633('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb633('0x1'));var express=require(_0xb633('0x2'));var router=express[_0xb633('0x3')]();var fs_extra=require(_0xb633('0x4'));var auth=require(_0xb633('0x5'));var interaction=require(_0xb633('0x6'));var config=require(_0xb633('0x7'));var controller=require(_0xb633('0x8'));router[_0xb633('0x9')]('/',auth[_0xb633('0xa')](),controller[_0xb633('0xb')]);router[_0xb633('0x9')](_0xb633('0xc'),auth['isAuthenticated'](),controller[_0xb633('0xd')]);router[_0xb633('0x9')](_0xb633('0xe'),auth[_0xb633('0xa')](),controller[_0xb633('0xf')]);router[_0xb633('0x10')]('/',auth['isAuthenticated'](),controller[_0xb633('0x11')]);router[_0xb633('0x12')](_0xb633('0xe'),auth['isAuthenticated'](),controller[_0xb633('0x13')]);router[_0xb633('0x14')](_0xb633('0xe'),auth[_0xb633('0xa')](),controller[_0xb633('0x15')]);module[_0xb633('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5769126..69e03ab 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3109f5,_0x21bc95){var _0x409a59=function(_0x14991c){while(--_0x14991c){_0x3109f5['push'](_0x3109f5['shift']());}};_0x409a59(++_0x21bc95);}(_0x7a54,0x106));var _0x47a5=function(_0x4256b6,_0x3fa25a){_0x4256b6=_0x4256b6-0x0;var _0x170960=_0x7a54[_0x4256b6];return _0x170960;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x571f87,_0x59c9c4){var _0x13d37a=function(_0x55054a){while(--_0x55054a){_0x571f87['push'](_0x571f87['shift']());}};_0x13d37a(++_0x59c9c4);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 75bd480..0e66de7 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 _0x3423=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','keys','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2561ca,_0x2bf01c){var _0x3a6490=function(_0x15b9a2){while(--_0x15b9a2){_0x2561ca['push'](_0x2561ca['shift']());}};_0x3a6490(++_0x2bf01c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x716d80,_0x36e1f4){_0x36e1f4=_0x36e1f4||0xcc;return function(_0x592ba8){if(_0x592ba8){return _0x716d80[_0x3342('0x16')](_0x36e1f4);}return _0x716d80[_0x3342('0x17')](_0x36e1f4)[_0x3342('0x18')]();};}function respondWithResult(_0xe4689e,_0x61fcc0){_0x61fcc0=_0x61fcc0||0xc8;return function(_0x104077){if(_0x104077){return _0xe4689e[_0x3342('0x17')](_0x61fcc0)['json'](_0x104077);}};}function respondWithFilteredResult(_0x3e44f3,_0x19bd71){return function(_0x49afe3){if(_0x49afe3){var _0x40d609=typeof _0x19bd71[_0x3342('0x19')]==='undefined'&&typeof _0x19bd71['limit']===_0x3342('0x1a');var _0x143cf1=_0x49afe3[_0x3342('0x1b')];var _0x2075cb=_0x40d609?0x0:_0x19bd71[_0x3342('0x19')];var _0x156c24=_0x40d609?_0x49afe3[_0x3342('0x1b')]:_0x19bd71[_0x3342('0x19')]+_0x19bd71[_0x3342('0x1c')];var _0x4f4c2a;if(_0x156c24>=_0x143cf1){_0x156c24=_0x143cf1;_0x4f4c2a=0xc8;}else{_0x4f4c2a=0xce;}_0x3e44f3[_0x3342('0x17')](_0x4f4c2a);return _0x3e44f3[_0x3342('0x1d')](_0x3342('0x1e'),_0x2075cb+'-'+_0x156c24+'/'+_0x143cf1)['json'](_0x49afe3);}return null;};}function patchUpdates(_0x3cb86f){return function(_0x463324){try{jsonpatch['apply'](_0x463324,_0x3cb86f,!![]);}catch(_0xe774b7){return BPromise[_0x3342('0x1f')](_0xe774b7);}return _0x463324['save']();};}function saveUpdates(_0x4e1b19,_0x5a0658){return function(_0x3f271c){if(_0x3f271c){return _0x3f271c[_0x3342('0x20')](_0x4e1b19)[_0x3342('0x21')](function(_0x2dbad1){return _0x2dbad1;});}return null;};}function removeEntity(_0xd2b87d,_0x2925a2){return function(_0x26eb87){if(_0x26eb87){return _0x26eb87[_0x3342('0x22')]()['then'](function(){_0xd2b87d[_0x3342('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51cf45,_0x986ab0){return function(_0x52ba65){if(!_0x52ba65){_0x51cf45['sendStatus'](0x194);}return _0x52ba65;};}function handleError(_0x247ee4,_0x58f0f5){_0x58f0f5=_0x58f0f5||0x1f4;return function(_0x37df78){logger['error'](_0x37df78['stack']);if(_0x37df78['name']){delete _0x37df78[_0x3342('0x23')];}_0x247ee4[_0x3342('0x17')](_0x58f0f5)[_0x3342('0x24')](_0x37df78);};}exports['index']=function(_0xc275a1,_0x1275e2){var _0x1cc542={},_0x272a52={},_0x4fbfb7={'count':0x0,'rows':[]};var _0x27e25b=_[_0x3342('0x25')](db[_0x3342('0x26')][_0x3342('0x27')],function(_0xf82530){return{'name':_0xf82530[_0x3342('0x28')],'type':_0xf82530[_0x3342('0x29')]['key']};});_0x272a52[_0x3342('0x2a')]=_['map'](_0x27e25b,_0x3342('0x23'));_0x272a52[_0x3342('0x2b')]=_['keys'](_0xc275a1[_0x3342('0x2b')]);_0x272a52[_0x3342('0x2c')]=_[_0x3342('0x2d')](_0x272a52[_0x3342('0x2a')],_0x272a52['query']);_0x1cc542[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0x272a52[_0x3342('0x2a')],qs[_0x3342('0x2f')](_0xc275a1[_0x3342('0x2b')][_0x3342('0x2f')]));_0x1cc542[_0x3342('0x2e')]=_0x1cc542[_0x3342('0x2e')][_0x3342('0x30')]?_0x1cc542[_0x3342('0x2e')]:_0x272a52[_0x3342('0x2a')];if(!_0xc275a1[_0x3342('0x2b')]['hasOwnProperty']('nolimit')){_0x1cc542[_0x3342('0x1c')]=qs['limit'](_0xc275a1[_0x3342('0x2b')][_0x3342('0x1c')]);_0x1cc542[_0x3342('0x19')]=qs[_0x3342('0x19')](_0xc275a1[_0x3342('0x2b')][_0x3342('0x19')]);}_0x1cc542[_0x3342('0x31')]=qs['sort'](_0xc275a1[_0x3342('0x2b')][_0x3342('0x32')]);_0x1cc542[_0x3342('0x33')]=qs[_0x3342('0x2c')](_[_0x3342('0x34')](_0xc275a1['query'],_0x272a52[_0x3342('0x2c')]),_0x27e25b);if(_0xc275a1['query'][_0x3342('0x35')]){_0x1cc542[_0x3342('0x33')]=_[_0x3342('0x36')](_0x1cc542[_0x3342('0x33')],{'$or':_['map'](_0x27e25b,function(_0x370cfa){if(_0x370cfa['type']!==_0x3342('0x37')){var _0x128657={};_0x128657[_0x370cfa[_0x3342('0x23')]]={'$like':'%'+_0xc275a1[_0x3342('0x2b')][_0x3342('0x35')]+'%'};return _0x128657;}})});}_0x1cc542=_[_0x3342('0x36')]({},_0x1cc542,_0xc275a1[_0x3342('0x38')]);var _0x52cdc0={'where':_0x1cc542[_0x3342('0x33')]};return db[_0x3342('0x26')]['count'](_0x52cdc0)[_0x3342('0x21')](function(_0x1f336c){_0x4fbfb7['count']=_0x1f336c;if(_0xc275a1[_0x3342('0x2b')][_0x3342('0x39')]){_0x1cc542['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x1cc542);})[_0x3342('0x21')](function(_0x41e727){_0x4fbfb7['rows']=_0x41e727;return _0x4fbfb7;})[_0x3342('0x21')](respondWithFilteredResult(_0x1275e2,_0x1cc542))[_0x3342('0x3a')](handleError(_0x1275e2,null));};exports[_0x3342('0x3b')]=function(_0x17fd01,_0x126ee4){var _0x308363={'raw':!![],'where':{'id':_0x17fd01[_0x3342('0x3c')]['id']}},_0x34de7b={};_0x34de7b['model']=_['keys'](db[_0x3342('0x26')][_0x3342('0x27')]);_0x34de7b[_0x3342('0x2b')]=_[_0x3342('0x3d')](_0x17fd01[_0x3342('0x2b')]);_0x34de7b[_0x3342('0x2c')]=_['intersection'](_0x34de7b[_0x3342('0x2a')],_0x34de7b[_0x3342('0x2b')]);_0x308363[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0x34de7b[_0x3342('0x2a')],qs[_0x3342('0x2f')](_0x17fd01['query'][_0x3342('0x2f')]));_0x308363['attributes']=_0x308363[_0x3342('0x2e')][_0x3342('0x30')]?_0x308363[_0x3342('0x2e')]:_0x34de7b[_0x3342('0x2a')];if(_0x17fd01['query'][_0x3342('0x39')]){_0x308363[_0x3342('0x3e')]=[{'all':!![]}];}_0x308363=_['merge']({},_0x308363,_0x17fd01[_0x3342('0x38')]);return db[_0x3342('0x26')][_0x3342('0x3f')](_0x308363)[_0x3342('0x21')](handleEntityNotFound(_0x126ee4,null))['then'](respondWithResult(_0x126ee4,null))[_0x3342('0x3a')](handleError(_0x126ee4,null));};exports[_0x3342('0x40')]=function(_0x56b465,_0x1fc491){return db['WhatsappQueueReport']['create'](_0x56b465[_0x3342('0x41')],{})[_0x3342('0x21')](respondWithResult(_0x1fc491,0xc9))[_0x3342('0x3a')](handleError(_0x1fc491,null));};exports[_0x3342('0x20')]=function(_0x23925e,_0x171387){if(_0x23925e[_0x3342('0x41')]['id']){delete _0x23925e['body']['id'];}return db['WhatsappQueueReport'][_0x3342('0x3f')]({'where':{'id':_0x23925e['params']['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x171387,null))['then'](saveUpdates(_0x23925e['body'],null))['then'](respondWithResult(_0x171387,null))[_0x3342('0x3a')](handleError(_0x171387,null));};exports[_0x3342('0x22')]=function(_0x29ccb6,_0x186a2a){return db['WhatsappQueueReport'][_0x3342('0x3f')]({'where':{'id':_0x29ccb6[_0x3342('0x3c')]['id']}})['then'](handleEntityNotFound(_0x186a2a,null))[_0x3342('0x21')](removeEntity(_0x186a2a,null))[_0x3342('0x3a')](handleError(_0x186a2a,null));};exports[_0x3342('0x42')]=function(_0x4c0dc0,_0x189b68){return db[_0x3342('0x26')][_0x3342('0x42')]()[_0x3342('0x21')](respondWithResult(_0x189b68,null))[_0x3342('0x3a')](handleError(_0x189b68,null));}; \ No newline at end of file +var _0x351d=['includeAll','include','catch','show','params','rawAttributes','create','body','find','describe','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','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','destroy','then','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappQueueReport'];(function(_0x21d1da,_0x1d9f57){var _0x428b96=function(_0x9e3c38){while(--_0x9e3c38){_0x21d1da['push'](_0x21d1da['shift']());}};_0x428b96(++_0x1d9f57);}(_0x351d,0x90));var _0xd351=function(_0x5f5b5a,_0x229d78){_0x5f5b5a=_0x5f5b5a-0x0;var _0x2fb01f=_0x351d[_0x5f5b5a];return _0x2fb01f;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb40c,_0x15549a){_0x15549a=_0x15549a||0xcc;return function(_0x23445f){if(_0x23445f){return _0x3eb40c[_0xd351('0x13')](_0x15549a);}return _0x3eb40c['status'](_0x15549a)[_0xd351('0x14')]();};}function respondWithResult(_0x316cf6,_0x597d7c){_0x597d7c=_0x597d7c||0xc8;return function(_0xc5a145){if(_0xc5a145){return _0x316cf6[_0xd351('0x15')](_0x597d7c)[_0xd351('0x16')](_0xc5a145);}};}function respondWithFilteredResult(_0xf1c285,_0x3867fb){return function(_0x4d238c){if(_0x4d238c){var _0x9f790f=typeof _0x3867fb['offset']==='undefined'&&typeof _0x3867fb[_0xd351('0x17')]==='undefined';var _0x21e591=_0x4d238c[_0xd351('0x18')];var _0x4e0164=_0x9f790f?0x0:_0x3867fb['offset'];var _0x1e1a3c=_0x9f790f?_0x4d238c[_0xd351('0x18')]:_0x3867fb[_0xd351('0x19')]+_0x3867fb[_0xd351('0x17')];var _0x51f265;if(_0x1e1a3c>=_0x21e591){_0x1e1a3c=_0x21e591;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0xf1c285[_0xd351('0x15')](_0x51f265);return _0xf1c285['set']('Content-Range',_0x4e0164+'-'+_0x1e1a3c+'/'+_0x21e591)[_0xd351('0x16')](_0x4d238c);}return null;};}function patchUpdates(_0x4a427b){return function(_0x33b1e5){try{jsonpatch[_0xd351('0x1a')](_0x33b1e5,_0x4a427b,!![]);}catch(_0x3634c9){return BPromise[_0xd351('0x1b')](_0x3634c9);}return _0x33b1e5[_0xd351('0x1c')]();};}function saveUpdates(_0x53e729,_0x18625b){return function(_0xbbc58){if(_0xbbc58){return _0xbbc58[_0xd351('0x1d')](_0x53e729)['then'](function(_0x1ce7f7){return _0x1ce7f7;});}return null;};}function removeEntity(_0x2d9aa0,_0x365bbc){return function(_0x59fb6d){if(_0x59fb6d){return _0x59fb6d[_0xd351('0x1e')]()[_0xd351('0x1f')](function(){_0x2d9aa0[_0xd351('0x15')](0xcc)[_0xd351('0x14')]();});}};}function handleEntityNotFound(_0x489c9a,_0x40f7f3){return function(_0x483c92){if(!_0x483c92){_0x489c9a[_0xd351('0x13')](0x194);}return _0x483c92;};}function handleError(_0x8ad0a6,_0x54f471){_0x54f471=_0x54f471||0x1f4;return function(_0x2648d0){logger['error'](_0x2648d0['stack']);if(_0x2648d0[_0xd351('0x20')]){delete _0x2648d0['name'];}_0x8ad0a6['status'](_0x54f471)[_0xd351('0x21')](_0x2648d0);};}exports['index']=function(_0x38471c,_0x2ddae8){var _0x407b50={},_0x4d3f48={},_0x71ce9c={'count':0x0,'rows':[]};var _0x4aa902=_[_0xd351('0x22')](db['WhatsappQueueReport']['rawAttributes'],function(_0xeb4da9){return{'name':_0xeb4da9[_0xd351('0x23')],'type':_0xeb4da9[_0xd351('0x24')][_0xd351('0x25')]};});_0x4d3f48['model']=_[_0xd351('0x22')](_0x4aa902,_0xd351('0x20'));_0x4d3f48[_0xd351('0x26')]=_[_0xd351('0x27')](_0x38471c[_0xd351('0x26')]);_0x4d3f48[_0xd351('0x28')]=_[_0xd351('0x29')](_0x4d3f48[_0xd351('0x2a')],_0x4d3f48[_0xd351('0x26')]);_0x407b50['attributes']=_[_0xd351('0x29')](_0x4d3f48[_0xd351('0x2a')],qs[_0xd351('0x2b')](_0x38471c[_0xd351('0x26')]['fields']));_0x407b50[_0xd351('0x2c')]=_0x407b50[_0xd351('0x2c')][_0xd351('0x2d')]?_0x407b50[_0xd351('0x2c')]:_0x4d3f48[_0xd351('0x2a')];if(!_0x38471c[_0xd351('0x26')][_0xd351('0x2e')](_0xd351('0x2f'))){_0x407b50[_0xd351('0x17')]=qs['limit'](_0x38471c['query'][_0xd351('0x17')]);_0x407b50[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x38471c[_0xd351('0x26')][_0xd351('0x19')]);}_0x407b50[_0xd351('0x30')]=qs['sort'](_0x38471c['query'][_0xd351('0x31')]);_0x407b50['where']=qs[_0xd351('0x28')](_[_0xd351('0x32')](_0x38471c[_0xd351('0x26')],_0x4d3f48[_0xd351('0x28')]),_0x4aa902);if(_0x38471c[_0xd351('0x26')][_0xd351('0x33')]){_0x407b50[_0xd351('0x34')]=_[_0xd351('0x35')](_0x407b50[_0xd351('0x34')],{'$or':_[_0xd351('0x22')](_0x4aa902,function(_0x2b7170){if(_0x2b7170['type']!==_0xd351('0x36')){var _0x5f0b1c={};_0x5f0b1c[_0x2b7170[_0xd351('0x20')]]={'$like':'%'+_0x38471c[_0xd351('0x26')][_0xd351('0x33')]+'%'};return _0x5f0b1c;}})});}_0x407b50=_[_0xd351('0x35')]({},_0x407b50,_0x38471c[_0xd351('0x37')]);var _0x3db72a={'where':_0x407b50['where']};return db[_0xd351('0x38')][_0xd351('0x18')](_0x3db72a)['then'](function(_0x2e1219){_0x71ce9c[_0xd351('0x18')]=_0x2e1219;if(_0x38471c[_0xd351('0x26')][_0xd351('0x39')]){_0x407b50[_0xd351('0x3a')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x407b50);})[_0xd351('0x1f')](function(_0x3935aa){_0x71ce9c['rows']=_0x3935aa;return _0x71ce9c;})['then'](respondWithFilteredResult(_0x2ddae8,_0x407b50))[_0xd351('0x3b')](handleError(_0x2ddae8,null));};exports[_0xd351('0x3c')]=function(_0x4ff06a,_0x570d57){var _0x46af23={'raw':!![],'where':{'id':_0x4ff06a[_0xd351('0x3d')]['id']}},_0x18f9d1={};_0x18f9d1[_0xd351('0x2a')]=_[_0xd351('0x27')](db[_0xd351('0x38')][_0xd351('0x3e')]);_0x18f9d1[_0xd351('0x26')]=_[_0xd351('0x27')](_0x4ff06a['query']);_0x18f9d1['filters']=_[_0xd351('0x29')](_0x18f9d1[_0xd351('0x2a')],_0x18f9d1[_0xd351('0x26')]);_0x46af23[_0xd351('0x2c')]=_[_0xd351('0x29')](_0x18f9d1[_0xd351('0x2a')],qs[_0xd351('0x2b')](_0x4ff06a[_0xd351('0x26')][_0xd351('0x2b')]));_0x46af23[_0xd351('0x2c')]=_0x46af23[_0xd351('0x2c')][_0xd351('0x2d')]?_0x46af23[_0xd351('0x2c')]:_0x18f9d1[_0xd351('0x2a')];if(_0x4ff06a[_0xd351('0x26')][_0xd351('0x39')]){_0x46af23['include']=[{'all':!![]}];}_0x46af23=_[_0xd351('0x35')]({},_0x46af23,_0x4ff06a[_0xd351('0x37')]);return db[_0xd351('0x38')]['find'](_0x46af23)[_0xd351('0x1f')](handleEntityNotFound(_0x570d57,null))[_0xd351('0x1f')](respondWithResult(_0x570d57,null))[_0xd351('0x3b')](handleError(_0x570d57,null));};exports[_0xd351('0x3f')]=function(_0xbb92d4,_0x5bc86a){return db[_0xd351('0x38')]['create'](_0xbb92d4[_0xd351('0x40')],{})[_0xd351('0x1f')](respondWithResult(_0x5bc86a,0xc9))['catch'](handleError(_0x5bc86a,null));};exports['update']=function(_0x1bd727,_0x444206){if(_0x1bd727[_0xd351('0x40')]['id']){delete _0x1bd727['body']['id'];}return db[_0xd351('0x38')][_0xd351('0x41')]({'where':{'id':_0x1bd727['params']['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x444206,null))['then'](saveUpdates(_0x1bd727[_0xd351('0x40')],null))[_0xd351('0x1f')](respondWithResult(_0x444206,null))['catch'](handleError(_0x444206,null));};exports['destroy']=function(_0x25ea1e,_0x58ce5a){return db[_0xd351('0x38')][_0xd351('0x41')]({'where':{'id':_0x25ea1e[_0xd351('0x3d')]['id']}})['then'](handleEntityNotFound(_0x58ce5a,null))[_0xd351('0x1f')](removeEntity(_0x58ce5a,null))['catch'](handleError(_0x58ce5a,null));};exports['describe']=function(_0x48c287,_0x7e4bad){return db[_0xd351('0x38')][_0xd351('0x42')]()['then'](respondWithResult(_0x7e4bad,null))['catch'](handleError(_0x7e4bad,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 223487e..d8bde3c 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 _0x9b6f=['exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x258717,_0x31ea23){var _0x21e418=function(_0x4fca35){while(--_0x4fca35){_0x258717['push'](_0x258717['shift']());}};_0x21e418(++_0x31ea23);}(_0x9b6f,0x163));var _0xf9b6=function(_0x53ed8a,_0x404ca5){_0x53ed8a=_0x53ed8a-0x0;var _0x2fccb7=_0x9b6f[_0x53ed8a];return _0x2fccb7;};'use strict';var _=require(_0xf9b6('0x0'));var util=require(_0xf9b6('0x1'));var logger=require(_0xf9b6('0x2'))(_0xf9b6('0x3'));var moment=require(_0xf9b6('0x4'));var BPromise=require(_0xf9b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf9b6('0x6'));var rimraf=require('rimraf');var config=require(_0xf9b6('0x7'));var attributes=require(_0xf9b6('0x8'));module[_0xf9b6('0x9')]=function(_0x4cb4bc,_0xb53121){return _0x4cb4bc[_0xf9b6('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0xf9b6('0xb'),'paranoid':![],'indexes':[{'name':_0xf9b6('0xc'),'fields':[_0xf9b6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8057=['util','../../config/logger','api','moment','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash'];(function(_0x1ffd39,_0x3c602c){var _0x261b4c=function(_0x1d4d44){while(--_0x1d4d44){_0x1ffd39['push'](_0x1ffd39['shift']());}};_0x261b4c(++_0x3c602c);}(_0x8057,0x180));var _0x7805=function(_0xb01552,_0x5b4ecb){_0xb01552=_0xb01552-0x0;var _0x2299c2=_0x8057[_0xb01552];return _0x2299c2;};'use strict';var _=require(_0x7805('0x0'));var util=require(_0x7805('0x1'));var logger=require(_0x7805('0x2'))(_0x7805('0x3'));var moment=require(_0x7805('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7805('0x5'));var config=require('../../config/environment');var attributes=require(_0x7805('0x6'));module[_0x7805('0x7')]=function(_0x1fb060,_0x32c8d1){return _0x1fb060[_0x7805('0x8')](_0x7805('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x7805('0xa'),'fields':[_0x7805('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 05d65f5..e6c323b 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 _0x3c57=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','UpdateWhatsappQueueReport','update','raw','where'];(function(_0x5adf4d,_0xdfd7ef){var _0x17b2db=function(_0x5a9a2f){while(--_0x5a9a2f){_0x5adf4d['push'](_0x5adf4d['shift']());}};_0x17b2db(++_0xdfd7ef);}(_0x3c57,0x187));var _0x73c5=function(_0x30dffd,_0x332b43){_0x30dffd=_0x30dffd-0x0;var _0x5877f8=_0x3c57[_0x30dffd];return _0x5877f8;};'use strict';var _=require(_0x73c5('0x0'));var util=require(_0x73c5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x73c5('0x2'));var fs=require('fs');var Redis=require(_0x73c5('0x3'));var db=require(_0x73c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x73c5('0x5'))(_0x73c5('0x6'));var config=require('../../config/environment');var jayson=require(_0x73c5('0x7'));var client=jayson[_0x73c5('0x8')][_0x73c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5925c1,_0x354e5c,_0x4145e8){return new BPromise(function(_0x5c6c5d,_0x10414c){return client[_0x73c5('0xa')](_0x5925c1,_0x4145e8)[_0x73c5('0xb')](function(_0x2cf139){logger[_0x73c5('0xc')](_0x73c5('0xd'),_0x354e5c,_0x73c5('0xe'));logger[_0x73c5('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x354e5c,_0x73c5('0xe'),JSON[_0x73c5('0x10')](_0x2cf139));if(_0x2cf139[_0x73c5('0x11')]){if(_0x2cf139[_0x73c5('0x11')][_0x73c5('0x12')]===0x1f4){logger[_0x73c5('0x11')](_0x73c5('0xd'),_0x354e5c,_0x2cf139[_0x73c5('0x11')][_0x73c5('0x13')]);return _0x10414c(_0x2cf139[_0x73c5('0x11')]['message']);}logger[_0x73c5('0x11')](_0x73c5('0xd'),_0x354e5c,_0x2cf139['error'][_0x73c5('0x13')]);return _0x5c6c5d(_0x2cf139[_0x73c5('0x11')][_0x73c5('0x13')]);}else{logger['info'](_0x73c5('0xd'),_0x354e5c,_0x73c5('0xe'));_0x5c6c5d(_0x2cf139[_0x73c5('0x14')][_0x73c5('0x13')]);}})['catch'](function(_0x34652d){logger[_0x73c5('0x11')](_0x73c5('0xd'),_0x354e5c,_0x34652d);_0x10414c(_0x34652d);});});}exports[_0x73c5('0x15')]=function(_0x192c53){var _0x260422=this;return new Promise(function(_0x2391da,_0x17ab6b){return db[_0x73c5('0x16')][_0x73c5('0x17')](_0x192c53['body'],{'raw':_0x192c53[_0x73c5('0x18')]?_0x192c53['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x42769e){logger[_0x73c5('0xc')]('CreateWhatsappQueueReport',_0x192c53);logger[_0x73c5('0xf')](_0x73c5('0x15'),_0x192c53,JSON[_0x73c5('0x10')](_0x42769e));_0x2391da(_0x42769e);})['catch'](function(_0x2708a3){logger[_0x73c5('0x11')](_0x73c5('0x15'),_0x2708a3['message'],_0x192c53);_0x17ab6b(_0x260422['error'](0x1f4,_0x2708a3[_0x73c5('0x13')]));});});};exports[_0x73c5('0x19')]=function(_0x37133e){var _0x1efef5=this;return new Promise(function(_0x3ed78b,_0x1ce775){return db[_0x73c5('0x16')][_0x73c5('0x1a')](_0x37133e['body'],{'raw':_0x37133e[_0x73c5('0x18')]?_0x37133e[_0x73c5('0x18')][_0x73c5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37133e[_0x73c5('0x18')]?_0x37133e[_0x73c5('0x18')][_0x73c5('0x1c')]||null:null,'attributes':_0x37133e[_0x73c5('0x18')]?_0x37133e[_0x73c5('0x18')]['attributes']||null:null,'limit':_0x37133e[_0x73c5('0x18')]?_0x37133e[_0x73c5('0x18')]['limit']||null:null})[_0x73c5('0xb')](function(_0x2c37e8){logger[_0x73c5('0xc')](_0x73c5('0x19'),_0x37133e);logger['debug'](_0x73c5('0x19'),_0x37133e,JSON[_0x73c5('0x10')](_0x2c37e8));_0x3ed78b(_0x2c37e8);})[_0x73c5('0x1d')](function(_0x939643){logger[_0x73c5('0x11')](_0x73c5('0x19'),_0x939643[_0x73c5('0x13')],_0x37133e);_0x1ce775(_0x1efef5['error'](0x1f4,_0x939643['message']));});});}; \ No newline at end of file +var _0x33bb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util'];(function(_0x20b85e,_0x50d027){var _0x35ebc6=function(_0x2d7199){while(--_0x2d7199){_0x20b85e['push'](_0x20b85e['shift']());}};_0x35ebc6(++_0x50d027);}(_0x33bb,0xf3));var _0xb33b=function(_0x28d80b,_0x15979a){_0x28d80b=_0x28d80b-0x0;var _0x550ea7=_0x33bb[_0x28d80b];return _0x550ea7;};'use strict';var _=require(_0xb33b('0x0'));var util=require(_0xb33b('0x1'));var moment=require('moment');var BPromise=require(_0xb33b('0x2'));var rs=require(_0xb33b('0x3'));var fs=require('fs');var Redis=require(_0xb33b('0x4'));var db=require(_0xb33b('0x5'))['db'];var utils=require(_0xb33b('0x6'));var logger=require('../../config/logger')(_0xb33b('0x7'));var config=require(_0xb33b('0x8'));var jayson=require(_0xb33b('0x9'));var client=jayson[_0xb33b('0xa')][_0xb33b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50bcff,_0x306327,_0x2d1095){return new BPromise(function(_0x3cf9e2,_0x321db9){return client[_0xb33b('0xc')](_0x50bcff,_0x2d1095)[_0xb33b('0xd')](function(_0x1ade80){logger[_0xb33b('0xe')](_0xb33b('0xf'),_0x306327,'request\x20sent');logger[_0xb33b('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x306327,_0xb33b('0x11'),JSON[_0xb33b('0x12')](_0x1ade80));if(_0x1ade80[_0xb33b('0x13')]){if(_0x1ade80[_0xb33b('0x13')][_0xb33b('0x14')]===0x1f4){logger[_0xb33b('0x13')](_0xb33b('0xf'),_0x306327,_0x1ade80[_0xb33b('0x13')][_0xb33b('0x15')]);return _0x321db9(_0x1ade80[_0xb33b('0x13')][_0xb33b('0x15')]);}logger[_0xb33b('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x306327,_0x1ade80[_0xb33b('0x13')][_0xb33b('0x15')]);return _0x3cf9e2(_0x1ade80['error'][_0xb33b('0x15')]);}else{logger[_0xb33b('0xe')](_0xb33b('0xf'),_0x306327,'request\x20sent');_0x3cf9e2(_0x1ade80[_0xb33b('0x16')]['message']);}})[_0xb33b('0x17')](function(_0x48ab9f){logger[_0xb33b('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x306327,_0x48ab9f);_0x321db9(_0x48ab9f);});});}exports[_0xb33b('0x18')]=function(_0x268ae1){var _0x14ea2b=this;return new Promise(function(_0x5ceeb4,_0x5d045f){return db[_0xb33b('0x19')][_0xb33b('0x1a')](_0x268ae1[_0xb33b('0x1b')],{'raw':_0x268ae1[_0xb33b('0x1c')]?_0x268ae1[_0xb33b('0x1c')][_0xb33b('0x1d')]===undefined?!![]:![]:!![]})[_0xb33b('0xd')](function(_0x2c605e){logger[_0xb33b('0xe')](_0xb33b('0x18'),_0x268ae1);logger[_0xb33b('0x10')](_0xb33b('0x18'),_0x268ae1,JSON['stringify'](_0x2c605e));_0x5ceeb4(_0x2c605e);})[_0xb33b('0x17')](function(_0x36cfe2){logger[_0xb33b('0x13')](_0xb33b('0x18'),_0x36cfe2[_0xb33b('0x15')],_0x268ae1);_0x5d045f(_0x14ea2b['error'](0x1f4,_0x36cfe2['message']));});});};exports[_0xb33b('0x1e')]=function(_0x2c8568){var _0xb705ef=this;return new Promise(function(_0x2cefff,_0x1b7147){return db[_0xb33b('0x19')][_0xb33b('0x1f')](_0x2c8568[_0xb33b('0x1b')],{'raw':_0x2c8568[_0xb33b('0x1c')]?_0x2c8568[_0xb33b('0x1c')][_0xb33b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c8568[_0xb33b('0x1c')]?_0x2c8568['options'][_0xb33b('0x20')]||null:null,'attributes':_0x2c8568[_0xb33b('0x1c')]?_0x2c8568['options'][_0xb33b('0x21')]||null:null,'limit':_0x2c8568['options']?_0x2c8568[_0xb33b('0x1c')][_0xb33b('0x22')]||null:null})['then'](function(_0x570482){logger[_0xb33b('0xe')](_0xb33b('0x1e'),_0x2c8568);logger[_0xb33b('0x10')]('UpdateWhatsappQueueReport',_0x2c8568,JSON[_0xb33b('0x12')](_0x570482));_0x2cefff(_0x570482);})[_0xb33b('0x17')](function(_0x11afc1){logger[_0xb33b('0x13')](_0xb33b('0x1e'),_0x11afc1[_0xb33b('0x15')],_0x2c8568);_0x1b7147(_0xb705ef[_0xb33b('0x13')](0x1f4,_0x11afc1[_0xb33b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2d4e0ee..8960b6c 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 _0xbc59=['../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x38d8e2,_0x48603c){var _0x5afbee=function(_0x2eca5e){while(--_0x2eca5e){_0x38d8e2['push'](_0x38d8e2['shift']());}};_0x5afbee(++_0x48603c);}(_0xbc59,0x162));var _0x9bc5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbc59[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x9bc5('0x0'));var util=require(_0x9bc5('0x1'));var path=require(_0x9bc5('0x2'));var timeout=require(_0x9bc5('0x3'));var express=require(_0x9bc5('0x4'));var router=express[_0x9bc5('0x5')]();var fs_extra=require(_0x9bc5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9bc5('0x7'));var config=require('../../config/environment');var controller=require(_0x9bc5('0x8'));router[_0x9bc5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9bc5('0x9')]('/describe',auth[_0x9bc5('0xa')](),controller[_0x9bc5('0xb')]);router[_0x9bc5('0x9')](_0x9bc5('0xc'),auth[_0x9bc5('0xa')](),controller[_0x9bc5('0xd')]);router[_0x9bc5('0xe')]('/',auth[_0x9bc5('0xa')](),controller['create']);router[_0x9bc5('0xf')](_0x9bc5('0xc'),auth[_0x9bc5('0xa')](),controller[_0x9bc5('0x10')]);router[_0x9bc5('0x11')](_0x9bc5('0xc'),auth[_0x9bc5('0xa')](),controller[_0x9bc5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3744=['isAuthenticated','describe','/:id','put','update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','index','get','/describe'];(function(_0x51b839,_0x5e18a3){var _0x22a6f4=function(_0x34aab3){while(--_0x34aab3){_0x51b839['push'](_0x51b839['shift']());}};_0x22a6f4(++_0x5e18a3);}(_0x3744,0x1ed));var _0x4374=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3744[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4374('0x0'));var timeout=require(_0x4374('0x1'));var express=require(_0x4374('0x2'));var router=express['Router']();var fs_extra=require(_0x4374('0x3'));var auth=require(_0x4374('0x4'));var interaction=require(_0x4374('0x5'));var config=require(_0x4374('0x6'));var controller=require(_0x4374('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4374('0x8')]);router[_0x4374('0x9')](_0x4374('0xa'),auth[_0x4374('0xb')](),controller[_0x4374('0xc')]);router['get'](_0x4374('0xd'),auth[_0x4374('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4374('0xe')](_0x4374('0xd'),auth[_0x4374('0xb')](),controller[_0x4374('0xf')]);router['delete']('/:id',auth[_0x4374('0xb')](),controller[_0x4374('0x10')]);module[_0x4374('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 231f471..58f9faa 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 _0x94e6=['ENUM','account','agent','queue','DATE','sequelize','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x94e6,0x194));var _0x694e=function(_0x379cd0,_0x1a7776){_0x379cd0=_0x379cd0-0x0;var _0x415097=_0x94e6[_0x379cd0];return _0x415097;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x694e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x694e('0x2')](_0x694e('0x3'),_0x694e('0x4'),_0x694e('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x694e('0x6')]}}; \ No newline at end of file +var _0x72fa=['sequelize','exports','ENUM','account','agent'];(function(_0x4555c2,_0x138d83){var _0x492d1d=function(_0x55a0c5){while(--_0x55a0c5){_0x4555c2['push'](_0x4555c2['shift']());}};_0x492d1d(++_0x138d83);}(_0x72fa,0x78));var _0xa72f=function(_0x1e3f14,_0x18c586){_0x1e3f14=_0x1e3f14-0x0;var _0x60e5b5=_0x72fa[_0x1e3f14];return _0x60e5b5;};'use strict';var Sequelize=require(_0xa72f('0x0'));module[_0xa72f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa72f('0x2')](_0xa72f('0x3'),_0xa72f('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 d5d717e..0d2aead 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 _0x7eee=['../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','end','error','stack','name','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','keys','length','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x277d53,_0x2ce9ce){var _0x2f1272=function(_0x2951c3){while(--_0x2951c3){_0x277d53['push'](_0x277d53['shift']());}};_0x2f1272(++_0x2ce9ce);}(_0x7eee,0x14c));var _0xe7ee=function(_0x24749c,_0x1bcb74){_0x24749c=_0x24749c-0x0;var _0x210f5d=_0x7eee[_0x24749c];return _0x210f5d;};'use strict';var emlformat=require(_0xe7ee('0x0'));var rimraf=require(_0xe7ee('0x1'));var zipdir=require(_0xe7ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7ee('0x3'));var moment=require(_0xe7ee('0x4'));var BPromise=require(_0xe7ee('0x5'));var Mustache=require(_0xe7ee('0x6'));var util=require(_0xe7ee('0x7'));var path=require('path');var sox=require(_0xe7ee('0x8'));var csv=require(_0xe7ee('0x9'));var ejs=require(_0xe7ee('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7ee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe7ee('0xc'));var deskjs=require(_0xe7ee('0xd'));var toCsv=require(_0xe7ee('0x9'));var querystring=require('querystring');var Papa=require(_0xe7ee('0xe'));var Redis=require(_0xe7ee('0xf'));var authService=require(_0xe7ee('0x10'));var qs=require(_0xe7ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe7ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe7ee('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5699ab,_0x7820ef){_0x7820ef=_0x7820ef||0xcc;return function(_0x1e8786){if(_0x1e8786){return _0x5699ab[_0xe7ee('0x14')](_0x7820ef);}return _0x5699ab[_0xe7ee('0x15')](_0x7820ef)['end']();};}function respondWithResult(_0x35d606,_0x450808){_0x450808=_0x450808||0xc8;return function(_0x144335){if(_0x144335){return _0x35d606['status'](_0x450808)[_0xe7ee('0x16')](_0x144335);}};}function respondWithFilteredResult(_0x53cdfb,_0x2e7999){return function(_0xb0638){if(_0xb0638){var _0x3615f5=typeof _0x2e7999[_0xe7ee('0x17')]===_0xe7ee('0x18')&&typeof _0x2e7999[_0xe7ee('0x19')]===_0xe7ee('0x18');var _0x5e4638=_0xb0638['count'];var _0x2d3198=_0x3615f5?0x0:_0x2e7999[_0xe7ee('0x17')];var _0x38b598=_0x3615f5?_0xb0638[_0xe7ee('0x1a')]:_0x2e7999[_0xe7ee('0x17')]+_0x2e7999['limit'];var _0x1a090e;if(_0x38b598>=_0x5e4638){_0x38b598=_0x5e4638;_0x1a090e=0xc8;}else{_0x1a090e=0xce;}_0x53cdfb[_0xe7ee('0x15')](_0x1a090e);return _0x53cdfb['set'](_0xe7ee('0x1b'),_0x2d3198+'-'+_0x38b598+'/'+_0x5e4638)['json'](_0xb0638);}return null;};}function patchUpdates(_0x14a514){return function(_0x3c11bf){try{jsonpatch[_0xe7ee('0x1c')](_0x3c11bf,_0x14a514,!![]);}catch(_0x5ed89d){return BPromise[_0xe7ee('0x1d')](_0x5ed89d);}return _0x3c11bf[_0xe7ee('0x1e')]();};}function saveUpdates(_0x11ae63,_0x22401b){return function(_0x3811dc){if(_0x3811dc){return _0x3811dc[_0xe7ee('0x1f')](_0x11ae63)['then'](function(_0x3095d3){return _0x3095d3;});}return null;};}function removeEntity(_0x530b3c,_0x2b0888){return function(_0xce11c8){if(_0xce11c8){return _0xce11c8['destroy']()['then'](function(){_0x530b3c[_0xe7ee('0x15')](0xcc)[_0xe7ee('0x20')]();});}};}function handleEntityNotFound(_0x5885d2,_0x2505b7){return function(_0x3f9af2){if(!_0x3f9af2){_0x5885d2[_0xe7ee('0x14')](0x194);}return _0x3f9af2;};}function handleError(_0x2a562e,_0x4c847a){_0x4c847a=_0x4c847a||0x1f4;return function(_0x3a7c5c){logger[_0xe7ee('0x21')](_0x3a7c5c[_0xe7ee('0x22')]);if(_0x3a7c5c[_0xe7ee('0x23')]){delete _0x3a7c5c[_0xe7ee('0x23')];}_0x2a562e['status'](_0x4c847a)['send'](_0x3a7c5c);};}exports['index']=function(_0x20cb05,_0x25ce52){var _0x1cc914={},_0x3a165c={},_0x3f20c8={'count':0x0,'rows':[]};var _0x38ca6d=_[_0xe7ee('0x24')](db[_0xe7ee('0x25')][_0xe7ee('0x26')],function(_0x736e4c){return{'name':_0x736e4c[_0xe7ee('0x27')],'type':_0x736e4c[_0xe7ee('0x28')][_0xe7ee('0x29')]};});_0x3a165c[_0xe7ee('0x2a')]=_[_0xe7ee('0x24')](_0x38ca6d,_0xe7ee('0x23'));_0x3a165c[_0xe7ee('0x2b')]=_['keys'](_0x20cb05['query']);_0x3a165c[_0xe7ee('0x2c')]=_[_0xe7ee('0x2d')](_0x3a165c['model'],_0x3a165c['query']);_0x1cc914[_0xe7ee('0x2e')]=_['intersection'](_0x3a165c['model'],qs[_0xe7ee('0x2f')](_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x2f')]));_0x1cc914[_0xe7ee('0x2e')]=_0x1cc914[_0xe7ee('0x2e')]['length']?_0x1cc914['attributes']:_0x3a165c[_0xe7ee('0x2a')];if(!_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x30')]('nolimit')){_0x1cc914[_0xe7ee('0x19')]=qs[_0xe7ee('0x19')](_0x20cb05[_0xe7ee('0x2b')]['limit']);_0x1cc914[_0xe7ee('0x17')]=qs[_0xe7ee('0x17')](_0x20cb05['query'][_0xe7ee('0x17')]);}_0x1cc914[_0xe7ee('0x31')]=qs[_0xe7ee('0x32')](_0x20cb05[_0xe7ee('0x2b')]['sort']);_0x1cc914[_0xe7ee('0x33')]=qs[_0xe7ee('0x2c')](_[_0xe7ee('0x34')](_0x20cb05['query'],_0x3a165c['filters']),_0x38ca6d);if(_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x35')]){_0x1cc914[_0xe7ee('0x33')]=_[_0xe7ee('0x36')](_0x1cc914['where'],{'$or':_[_0xe7ee('0x24')](_0x38ca6d,function(_0x268ade){if(_0x268ade[_0xe7ee('0x28')]!==_0xe7ee('0x37')){var _0x3d6882={};_0x3d6882[_0x268ade[_0xe7ee('0x23')]]={'$like':'%'+_0x20cb05['query'][_0xe7ee('0x35')]+'%'};return _0x3d6882;}})});}_0x1cc914=_[_0xe7ee('0x36')]({},_0x1cc914,_0x20cb05[_0xe7ee('0x38')]);var _0x4c1844={'where':_0x1cc914[_0xe7ee('0x33')]};return db[_0xe7ee('0x25')][_0xe7ee('0x1a')](_0x4c1844)[_0xe7ee('0x39')](function(_0x67b047){_0x3f20c8[_0xe7ee('0x1a')]=_0x67b047;if(_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x3a')]){_0x1cc914[_0xe7ee('0x3b')]=[{'all':!![]}];}return db[_0xe7ee('0x25')][_0xe7ee('0x3c')](_0x1cc914);})[_0xe7ee('0x39')](function(_0x53ebc7){_0x3f20c8[_0xe7ee('0x3d')]=_0x53ebc7;return _0x3f20c8;})[_0xe7ee('0x39')](respondWithFilteredResult(_0x25ce52,_0x1cc914))[_0xe7ee('0x3e')](handleError(_0x25ce52,null));};exports['show']=function(_0x275640,_0x4342fd){var _0x2b821c={'raw':!![],'where':{'id':_0x275640['params']['id']}},_0x4afe03={};_0x4afe03[_0xe7ee('0x2a')]=_[_0xe7ee('0x3f')](db[_0xe7ee('0x25')]['rawAttributes']);_0x4afe03['query']=_['keys'](_0x275640['query']);_0x4afe03[_0xe7ee('0x2c')]=_[_0xe7ee('0x2d')](_0x4afe03[_0xe7ee('0x2a')],_0x4afe03[_0xe7ee('0x2b')]);_0x2b821c[_0xe7ee('0x2e')]=_[_0xe7ee('0x2d')](_0x4afe03[_0xe7ee('0x2a')],qs[_0xe7ee('0x2f')](_0x275640[_0xe7ee('0x2b')][_0xe7ee('0x2f')]));_0x2b821c[_0xe7ee('0x2e')]=_0x2b821c[_0xe7ee('0x2e')][_0xe7ee('0x40')]?_0x2b821c['attributes']:_0x4afe03[_0xe7ee('0x2a')];if(_0x275640[_0xe7ee('0x2b')][_0xe7ee('0x3a')]){_0x2b821c[_0xe7ee('0x3b')]=[{'all':!![]}];}_0x2b821c=_['merge']({},_0x2b821c,_0x275640[_0xe7ee('0x38')]);return db[_0xe7ee('0x25')]['find'](_0x2b821c)['then'](handleEntityNotFound(_0x4342fd,null))[_0xe7ee('0x39')](respondWithResult(_0x4342fd,null))[_0xe7ee('0x3e')](handleError(_0x4342fd,null));};exports[_0xe7ee('0x41')]=function(_0x5d8f18,_0x497343){return db[_0xe7ee('0x25')]['create'](_0x5d8f18[_0xe7ee('0x42')],{})[_0xe7ee('0x39')](respondWithResult(_0x497343,0xc9))[_0xe7ee('0x3e')](handleError(_0x497343,null));};exports['update']=function(_0x4cadaa,_0x4452a6){if(_0x4cadaa[_0xe7ee('0x42')]['id']){delete _0x4cadaa['body']['id'];}return db[_0xe7ee('0x25')][_0xe7ee('0x43')]({'where':{'id':_0x4cadaa[_0xe7ee('0x44')]['id']}})[_0xe7ee('0x39')](handleEntityNotFound(_0x4452a6,null))[_0xe7ee('0x39')](saveUpdates(_0x4cadaa[_0xe7ee('0x42')],null))['then'](respondWithResult(_0x4452a6,null))[_0xe7ee('0x3e')](handleError(_0x4452a6,null));};exports['destroy']=function(_0x26e57b,_0x5a63c1){return db[_0xe7ee('0x25')]['find']({'where':{'id':_0x26e57b[_0xe7ee('0x44')]['id']}})[_0xe7ee('0x39')](handleEntityNotFound(_0x5a63c1,null))[_0xe7ee('0x39')](removeEntity(_0x5a63c1,null))['catch'](handleError(_0x5a63c1,null));};exports[_0xe7ee('0x45')]=function(_0x362f98,_0x1c880c){return db[_0xe7ee('0x25')][_0xe7ee('0x45')]()['then'](respondWithResult(_0x1c880c,null))[_0xe7ee('0x3e')](handleError(_0x1c880c,null));}; \ No newline at end of file +var _0x9153=['mustache','util','path','sox','ejs','squel','crypto','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','status','json','offset','undefined','count','set','Content-Range','reject','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','keys','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','include','findAll','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2fdac5,_0x552b2f){var _0x2d5cbe=function(_0x49c6e3){while(--_0x49c6e3){_0x2fdac5['push'](_0x2fdac5['shift']());}};_0x2d5cbe(++_0x552b2f);}(_0x9153,0xd8));var _0x3915=function(_0x5930df,_0x160b43){_0x5930df=_0x5930df-0x0;var _0x32da5c=_0x9153[_0x5930df];return _0x32da5c;};'use strict';var emlformat=require(_0x3915('0x0'));var rimraf=require(_0x3915('0x1'));var zipdir=require(_0x3915('0x2'));var jsonpatch=require(_0x3915('0x3'));var rp=require(_0x3915('0x4'));var moment=require(_0x3915('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3915('0x6'));var util=require(_0x3915('0x7'));var path=require(_0x3915('0x8'));var sox=require(_0x3915('0x9'));var csv=require('to-csv');var ejs=require(_0x3915('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3915('0xb'));var crypto=require(_0x3915('0xc'));var jsforce=require(_0x3915('0xd'));var deskjs=require(_0x3915('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3915('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3915('0x10'));var qs=require(_0x3915('0x11'));var as=require(_0x3915('0x12'));var hardwareService=require(_0x3915('0x13'));var logger=require(_0x3915('0x14'))(_0x3915('0x15'));var utils=require(_0x3915('0x16'));var config=require(_0x3915('0x17'));var licenseUtil=require(_0x3915('0x18'));var db=require(_0x3915('0x19'))['db'];function respondWithStatusCode(_0x4d3877,_0x3ad7ab){_0x3ad7ab=_0x3ad7ab||0xcc;return function(_0x22d231){if(_0x22d231){return _0x4d3877['sendStatus'](_0x3ad7ab);}return _0x4d3877[_0x3915('0x1a')](_0x3ad7ab)['end']();};}function respondWithResult(_0x5d8ab4,_0x24f5e9){_0x24f5e9=_0x24f5e9||0xc8;return function(_0x30d85a){if(_0x30d85a){return _0x5d8ab4[_0x3915('0x1a')](_0x24f5e9)[_0x3915('0x1b')](_0x30d85a);}};}function respondWithFilteredResult(_0x4af9a2,_0xca4a4a){return function(_0x3b6224){if(_0x3b6224){var _0x39981a=typeof _0xca4a4a[_0x3915('0x1c')]===_0x3915('0x1d')&&typeof _0xca4a4a['limit']===_0x3915('0x1d');var _0x44266c=_0x3b6224[_0x3915('0x1e')];var _0x1ac327=_0x39981a?0x0:_0xca4a4a[_0x3915('0x1c')];var _0x473eb4=_0x39981a?_0x3b6224['count']:_0xca4a4a[_0x3915('0x1c')]+_0xca4a4a['limit'];var _0x596773;if(_0x473eb4>=_0x44266c){_0x473eb4=_0x44266c;_0x596773=0xc8;}else{_0x596773=0xce;}_0x4af9a2['status'](_0x596773);return _0x4af9a2[_0x3915('0x1f')](_0x3915('0x20'),_0x1ac327+'-'+_0x473eb4+'/'+_0x44266c)[_0x3915('0x1b')](_0x3b6224);}return null;};}function patchUpdates(_0x55e896){return function(_0x2160d3){try{jsonpatch['apply'](_0x2160d3,_0x55e896,!![]);}catch(_0x38428b){return BPromise[_0x3915('0x21')](_0x38428b);}return _0x2160d3['save']();};}function saveUpdates(_0x42ae2d,_0x400601){return function(_0x3d2df2){if(_0x3d2df2){return _0x3d2df2[_0x3915('0x22')](_0x42ae2d)[_0x3915('0x23')](function(_0x54fe09){return _0x54fe09;});}return null;};}function removeEntity(_0x26b001,_0x4b2fe8){return function(_0x8a2184){if(_0x8a2184){return _0x8a2184['destroy']()[_0x3915('0x23')](function(){_0x26b001[_0x3915('0x1a')](0xcc)[_0x3915('0x24')]();});}};}function handleEntityNotFound(_0x404532,_0x28ec1d){return function(_0x54afa8){if(!_0x54afa8){_0x404532['sendStatus'](0x194);}return _0x54afa8;};}function handleError(_0x16d999,_0xa83d37){_0xa83d37=_0xa83d37||0x1f4;return function(_0x3e6102){logger[_0x3915('0x25')](_0x3e6102[_0x3915('0x26')]);if(_0x3e6102[_0x3915('0x27')]){delete _0x3e6102['name'];}_0x16d999['status'](_0xa83d37)[_0x3915('0x28')](_0x3e6102);};}exports['index']=function(_0x3652b2,_0x2d735d){var _0x323ced={},_0x4233c5={},_0x4c04a4={'count':0x0,'rows':[]};var _0x2a98be=_[_0x3915('0x29')](db['WhatsappTransferReport'][_0x3915('0x2a')],function(_0x30818b){return{'name':_0x30818b[_0x3915('0x2b')],'type':_0x30818b[_0x3915('0x2c')]['key']};});_0x4233c5['model']=_[_0x3915('0x29')](_0x2a98be,_0x3915('0x27'));_0x4233c5['query']=_[_0x3915('0x2d')](_0x3652b2['query']);_0x4233c5['filters']=_[_0x3915('0x2e')](_0x4233c5['model'],_0x4233c5[_0x3915('0x2f')]);_0x323ced[_0x3915('0x30')]=_[_0x3915('0x2e')](_0x4233c5[_0x3915('0x31')],qs[_0x3915('0x32')](_0x3652b2[_0x3915('0x2f')][_0x3915('0x32')]));_0x323ced['attributes']=_0x323ced[_0x3915('0x30')]['length']?_0x323ced[_0x3915('0x30')]:_0x4233c5[_0x3915('0x31')];if(!_0x3652b2[_0x3915('0x2f')][_0x3915('0x33')](_0x3915('0x34'))){_0x323ced['limit']=qs[_0x3915('0x35')](_0x3652b2['query'][_0x3915('0x35')]);_0x323ced[_0x3915('0x1c')]=qs[_0x3915('0x1c')](_0x3652b2[_0x3915('0x2f')][_0x3915('0x1c')]);}_0x323ced['order']=qs[_0x3915('0x36')](_0x3652b2['query'][_0x3915('0x36')]);_0x323ced[_0x3915('0x37')]=qs[_0x3915('0x38')](_[_0x3915('0x39')](_0x3652b2[_0x3915('0x2f')],_0x4233c5[_0x3915('0x38')]),_0x2a98be);if(_0x3652b2[_0x3915('0x2f')][_0x3915('0x3a')]){_0x323ced[_0x3915('0x37')]=_[_0x3915('0x3b')](_0x323ced[_0x3915('0x37')],{'$or':_[_0x3915('0x29')](_0x2a98be,function(_0xda86c4){if(_0xda86c4[_0x3915('0x2c')]!==_0x3915('0x3c')){var _0x43fd0b={};_0x43fd0b[_0xda86c4[_0x3915('0x27')]]={'$like':'%'+_0x3652b2[_0x3915('0x2f')]['filter']+'%'};return _0x43fd0b;}})});}_0x323ced=_[_0x3915('0x3b')]({},_0x323ced,_0x3652b2[_0x3915('0x3d')]);var _0x22c8bb={'where':_0x323ced[_0x3915('0x37')]};return db[_0x3915('0x3e')]['count'](_0x22c8bb)[_0x3915('0x23')](function(_0x469d97){_0x4c04a4[_0x3915('0x1e')]=_0x469d97;if(_0x3652b2[_0x3915('0x2f')]['includeAll']){_0x323ced[_0x3915('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x3915('0x40')](_0x323ced);})[_0x3915('0x23')](function(_0x5b885f){_0x4c04a4['rows']=_0x5b885f;return _0x4c04a4;})[_0x3915('0x23')](respondWithFilteredResult(_0x2d735d,_0x323ced))[_0x3915('0x41')](handleError(_0x2d735d,null));};exports[_0x3915('0x42')]=function(_0xca63f4,_0x1d689b){var _0x11746f={'raw':!![],'where':{'id':_0xca63f4[_0x3915('0x43')]['id']}},_0x5cc10c={};_0x5cc10c[_0x3915('0x31')]=_[_0x3915('0x2d')](db['WhatsappTransferReport'][_0x3915('0x2a')]);_0x5cc10c[_0x3915('0x2f')]=_[_0x3915('0x2d')](_0xca63f4[_0x3915('0x2f')]);_0x5cc10c[_0x3915('0x38')]=_[_0x3915('0x2e')](_0x5cc10c[_0x3915('0x31')],_0x5cc10c[_0x3915('0x2f')]);_0x11746f[_0x3915('0x30')]=_[_0x3915('0x2e')](_0x5cc10c[_0x3915('0x31')],qs[_0x3915('0x32')](_0xca63f4['query'][_0x3915('0x32')]));_0x11746f[_0x3915('0x30')]=_0x11746f[_0x3915('0x30')]['length']?_0x11746f[_0x3915('0x30')]:_0x5cc10c['model'];if(_0xca63f4[_0x3915('0x2f')][_0x3915('0x44')]){_0x11746f[_0x3915('0x3f')]=[{'all':!![]}];}_0x11746f=_[_0x3915('0x3b')]({},_0x11746f,_0xca63f4['options']);return db[_0x3915('0x3e')][_0x3915('0x45')](_0x11746f)[_0x3915('0x23')](handleEntityNotFound(_0x1d689b,null))['then'](respondWithResult(_0x1d689b,null))[_0x3915('0x41')](handleError(_0x1d689b,null));};exports[_0x3915('0x46')]=function(_0x5dd4d4,_0x4d340a){return db[_0x3915('0x3e')][_0x3915('0x46')](_0x5dd4d4[_0x3915('0x47')],{})[_0x3915('0x23')](respondWithResult(_0x4d340a,0xc9))[_0x3915('0x41')](handleError(_0x4d340a,null));};exports[_0x3915('0x22')]=function(_0x399ece,_0x342cec){if(_0x399ece[_0x3915('0x47')]['id']){delete _0x399ece[_0x3915('0x47')]['id'];}return db[_0x3915('0x3e')]['find']({'where':{'id':_0x399ece[_0x3915('0x43')]['id']}})[_0x3915('0x23')](handleEntityNotFound(_0x342cec,null))[_0x3915('0x23')](saveUpdates(_0x399ece[_0x3915('0x47')],null))[_0x3915('0x23')](respondWithResult(_0x342cec,null))[_0x3915('0x41')](handleError(_0x342cec,null));};exports[_0x3915('0x48')]=function(_0x1e3242,_0x1c5542){return db[_0x3915('0x3e')][_0x3915('0x45')]({'where':{'id':_0x1e3242[_0x3915('0x43')]['id']}})[_0x3915('0x23')](handleEntityNotFound(_0x1c5542,null))['then'](removeEntity(_0x1c5542,null))[_0x3915('0x41')](handleError(_0x1c5542,null));};exports[_0x3915('0x49')]=function(_0x4bc240,_0x25c2b5){return db['WhatsappTransferReport'][_0x3915('0x49')]()[_0x3915('0x23')](respondWithResult(_0x25c2b5,null))['catch'](handleError(_0x25c2b5,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e7151a0..a5d21c3 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 _0x5279=['api','moment','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x3614e8,_0x489e37){var _0x29a5b5=function(_0x2a2bdc){while(--_0x2a2bdc){_0x3614e8['push'](_0x3614e8['shift']());}};_0x29a5b5(++_0x489e37);}(_0x5279,0x1ea));var _0x9527=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x5279[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0x9527('0x0'));var util=require(_0x9527('0x1'));var logger=require('../../config/logger')(_0x9527('0x2'));var moment=require(_0x9527('0x3'));var BPromise=require('bluebird');var rp=require(_0x9527('0x4'));var fs=require('fs');var path=require(_0x9527('0x5'));var rimraf=require(_0x9527('0x6'));var config=require('../../config/environment');var attributes=require(_0x9527('0x7'));module[_0x9527('0x8')]=function(_0x481015,_0x5a9978){return _0x481015[_0x9527('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x9527('0xa'),'paranoid':![],'indexes':[{'name':_0x9527('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b24=['api','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util'];(function(_0x2872ab,_0xfec43c){var _0x5066e6=function(_0x217a98){while(--_0x217a98){_0x2872ab['push'](_0x2872ab['shift']());}};_0x5066e6(++_0xfec43c);}(_0x6b24,0xd0));var _0x46b2=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x6b24[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var logger=require('../../config/logger')(_0x46b2('0x1'));var moment=require('moment');var BPromise=require(_0x46b2('0x2'));var rp=require(_0x46b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46b2('0x4'));var config=require(_0x46b2('0x5'));var attributes=require(_0x46b2('0x6'));module[_0x46b2('0x7')]=function(_0x108022,_0x16c953){return _0x108022['define'](_0x46b2('0x8'),attributes,{'tableName':_0x46b2('0x9'),'paranoid':![],'indexes':[{'name':_0x46b2('0xa'),'fields':[_0x46b2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e93b91c..e0be81c 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 _0x89c2=['client','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x23a191,_0x352efa){var _0x1e9b62=function(_0x56a2f3){while(--_0x56a2f3){_0x23a191['push'](_0x23a191['shift']());}};_0x1e9b62(++_0x352efa);}(_0x89c2,0x80));var _0x289c=function(_0x1c7fee,_0x431afa){_0x1c7fee=_0x1c7fee-0x0;var _0x239281=_0x89c2[_0x1c7fee];return _0x239281;};'use strict';var _=require(_0x289c('0x0'));var util=require(_0x289c('0x1'));var moment=require(_0x289c('0x2'));var BPromise=require(_0x289c('0x3'));var rs=require(_0x289c('0x4'));var fs=require('fs');var Redis=require(_0x289c('0x5'));var db=require(_0x289c('0x6'))['db'];var utils=require(_0x289c('0x7'));var logger=require(_0x289c('0x8'))(_0x289c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x289c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101264,_0x2f3c14,_0x51ff59){return new BPromise(function(_0x2e925b,_0x58b8a3){return client[_0x289c('0xb')](_0x101264,_0x51ff59)['then'](function(_0x5ad7ce){logger[_0x289c('0xc')](_0x289c('0xd'),_0x2f3c14,_0x289c('0xe'));logger[_0x289c('0xf')](_0x289c('0x10'),_0x2f3c14,_0x289c('0xe'),JSON[_0x289c('0x11')](_0x5ad7ce));if(_0x5ad7ce[_0x289c('0x12')]){if(_0x5ad7ce[_0x289c('0x12')][_0x289c('0x13')]===0x1f4){logger[_0x289c('0x12')](_0x289c('0xd'),_0x2f3c14,_0x5ad7ce[_0x289c('0x12')][_0x289c('0x14')]);return _0x58b8a3(_0x5ad7ce[_0x289c('0x12')][_0x289c('0x14')]);}logger[_0x289c('0x12')](_0x289c('0xd'),_0x2f3c14,_0x5ad7ce[_0x289c('0x12')][_0x289c('0x14')]);return _0x2e925b(_0x5ad7ce[_0x289c('0x12')][_0x289c('0x14')]);}else{logger[_0x289c('0xc')](_0x289c('0xd'),_0x2f3c14,_0x289c('0xe'));_0x2e925b(_0x5ad7ce[_0x289c('0x15')][_0x289c('0x14')]);}})[_0x289c('0x16')](function(_0x268b35){logger[_0x289c('0x12')](_0x289c('0xd'),_0x2f3c14,_0x268b35);_0x58b8a3(_0x268b35);});});} \ No newline at end of file +var _0xfe36=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x40a4d1,_0x1a7dd8){var _0x19a711=function(_0x2e47d2){while(--_0x2e47d2){_0x40a4d1['push'](_0x40a4d1['shift']());}};_0x19a711(++_0x1a7dd8);}(_0xfe36,0x142));var _0x6fe3=function(_0x7df72,_0x1d6141){_0x7df72=_0x7df72-0x0;var _0x29e911=_0xfe36[_0x7df72];return _0x29e911;};'use strict';var _=require(_0x6fe3('0x0'));var util=require(_0x6fe3('0x1'));var moment=require('moment');var BPromise=require(_0x6fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fe3('0x3'))['db'];var utils=require(_0x6fe3('0x4'));var logger=require(_0x6fe3('0x5'))(_0x6fe3('0x6'));var config=require(_0x6fe3('0x7'));var jayson=require(_0x6fe3('0x8'));var client=jayson['client'][_0x6fe3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x353f14,_0x2d6a9a,_0x31194f){return new BPromise(function(_0x271901,_0x366578){return client[_0x6fe3('0xa')](_0x353f14,_0x31194f)[_0x6fe3('0xb')](function(_0x182ce6){logger['info'](_0x6fe3('0xc'),_0x2d6a9a,_0x6fe3('0xd'));logger['debug'](_0x6fe3('0xe'),_0x2d6a9a,_0x6fe3('0xd'),JSON[_0x6fe3('0xf')](_0x182ce6));if(_0x182ce6[_0x6fe3('0x10')]){if(_0x182ce6[_0x6fe3('0x10')]['code']===0x1f4){logger['error'](_0x6fe3('0xc'),_0x2d6a9a,_0x182ce6[_0x6fe3('0x10')][_0x6fe3('0x11')]);return _0x366578(_0x182ce6[_0x6fe3('0x10')][_0x6fe3('0x11')]);}logger[_0x6fe3('0x10')](_0x6fe3('0xc'),_0x2d6a9a,_0x182ce6[_0x6fe3('0x10')]['message']);return _0x271901(_0x182ce6['error'][_0x6fe3('0x11')]);}else{logger['info'](_0x6fe3('0xc'),_0x2d6a9a,_0x6fe3('0xd'));_0x271901(_0x182ce6[_0x6fe3('0x12')][_0x6fe3('0x11')]);}})[_0x6fe3('0x13')](function(_0x2a589c){logger['error'](_0x6fe3('0xc'),_0x2d6a9a,_0x2a589c);_0x366578(_0x2a589c);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 4bda579..206c7c5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc999=['filter','status','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./config/pm2','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','Offline\x20apps:'];(function(_0x40a869,_0x3aed54){var _0x535bd4=function(_0x5f0b95){while(--_0x5f0b95){_0x40a869['push'](_0x40a869['shift']());}};_0x535bd4(++_0x3aed54);}(_0xc999,0x176));var _0x9c99=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0xc999[_0x56138f];return _0x1acaf7;};'use strict';var _=require('lodash');var db=require(_0x9c99('0x0'))['db'];var seedDb=require(_0x9c99('0x1'));var checkLicense=require(_0x9c99('0x2'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require(_0x9c99('0x3'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x9c99('0x4'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x9c99('0x5'));var transcribe=require(_0x9c99('0x6'));var provider=require(_0x9c99('0x7'));function main(){return db['sequelize'][_0x9c99('0x8')]()[_0x9c99('0x9')](function(){if(config[_0x9c99('0xa')]){return seedDb[_0x9c99('0xb')]();}})[_0x9c99('0x9')](function(){return checkLicense[_0x9c99('0xb')]();})['then'](function(){return rpc[_0x9c99('0xc')]();})[_0x9c99('0x9')](function(_0x1e34b5){logger[_0x9c99('0xd')](_0x1e34b5);return chat['start']();})[_0x9c99('0x9')](function(){return whatsapp[_0x9c99('0xe')]();})[_0x9c99('0x9')](function(){return schedule['start']();})[_0x9c99('0x9')](function(){return transcribe['start']();})['then'](function(){return provider[_0x9c99('0xe')]();})[_0x9c99('0x9')](function(_0x2d4c9a){logger[_0x9c99('0xd')](_0x2d4c9a);return pm2['start'](pm2Config);})[_0x9c99('0x9')](function(_0x5bc391){var _0x5db87b=_0x5bc391['filter'](function(_0xedd35){return typeof _0xedd35[_0x9c99('0xf')]==='number'&&_0xedd35[_0x9c99('0xf')]>=0x0;});if(_0x5db87b['length']>0x0){throw new Error(_0x5db87b['length']+_0x9c99('0x10')+_[_0x9c99('0x11')](_0x5db87b,function(_0x5c0023){return'\x22'+_0x5c0023[_0x9c99('0x12')][_0x9c99('0x13')]+'\x22';}));}logger['info'](_0x9c99('0x14'),_[_0x9c99('0x11')](_['filter'](_0x5bc391,{'status':'online'}),'name')['join']());logger[_0x9c99('0xd')](_0x9c99('0x15'),_[_0x9c99('0x11')](_[_0x9c99('0x16')](_0x5bc391,function(_0x3628ba){return _0x3628ba[_0x9c99('0x17')]!=='online';}),_0x9c99('0x13'))[_0x9c99('0x18')]()||_0x9c99('0x19'));console[_0x9c99('0x1a')](_0x9c99('0x1b'));})[_0x9c99('0x1c')](function(_0x35e342){console[_0x9c99('0x1a')](_0x9c99('0x1d'),_0x35e342);logger[_0x9c99('0x1e')](_0x9c99('0x1f'),_0x35e342);process[_0x9c99('0x20')](0x1);});}main(); \ No newline at end of file +var _0xa9b1=['./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/schedule/chat','./config/schedule/whatsapp'];(function(_0x35c5c4,_0x29a383){var _0x3d49a5=function(_0x557c3d){while(--_0x557c3d){_0x35c5c4['push'](_0x35c5c4['shift']());}};_0x3d49a5(++_0x29a383);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0x1a9b('0x0'));var checkLicense=require(_0x1a9b('0x1'));var rpc=require(_0x1a9b('0x2'));var config=require(_0x1a9b('0x3'));var logger=require(_0x1a9b('0x4'))(_0x1a9b('0x5'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x1a9b('0x6'));var whatsapp=require(_0x1a9b('0x7'));var transcribe=require(_0x1a9b('0x8'));var provider=require(_0x1a9b('0x9'));function main(){return db[_0x1a9b('0xa')][_0x1a9b('0xb')]()[_0x1a9b('0xc')](function(){if(config[_0x1a9b('0xd')]){return seedDb[_0x1a9b('0xe')]();}})[_0x1a9b('0xc')](function(){return checkLicense[_0x1a9b('0xe')]();})[_0x1a9b('0xc')](function(){return rpc['listen']();})['then'](function(_0x3f0e5f){logger[_0x1a9b('0xf')](_0x3f0e5f);return chat[_0x1a9b('0x10')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x1a9b('0x10')]();})[_0x1a9b('0xc')](function(){return transcribe[_0x1a9b('0x10')]();})[_0x1a9b('0xc')](function(){return provider[_0x1a9b('0x10')]();})[_0x1a9b('0xc')](function(_0x5ab149){logger[_0x1a9b('0xf')](_0x5ab149);return pm2[_0x1a9b('0x10')](pm2Config);})[_0x1a9b('0xc')](function(_0x53c725){var _0x439646=_0x53c725[_0x1a9b('0x11')](function(_0x55a00d){return typeof _0x55a00d[_0x1a9b('0x12')]==='number'&&_0x55a00d[_0x1a9b('0x12')]>=0x0;});if(_0x439646[_0x1a9b('0x13')]>0x0){throw new Error(_0x439646[_0x1a9b('0x13')]+_0x1a9b('0x14')+_[_0x1a9b('0x15')](_0x439646,function(_0x20b8dc){return'\x22'+_0x20b8dc[_0x1a9b('0x16')][_0x1a9b('0x17')]+'\x22';}));}logger[_0x1a9b('0xf')](_0x1a9b('0x18'),_['map'](_[_0x1a9b('0x11')](_0x53c725,{'status':_0x1a9b('0x19')}),_0x1a9b('0x17'))[_0x1a9b('0x1a')]());logger['info'](_0x1a9b('0x1b'),_[_0x1a9b('0x15')](_['filter'](_0x53c725,function(_0x23e327){return _0x23e327[_0x1a9b('0x1c')]!==_0x1a9b('0x19');}),_0x1a9b('0x17'))[_0x1a9b('0x1a')]()||'None');console[_0x1a9b('0x1d')](_0x1a9b('0x1e'));})[_0x1a9b('0x1f')](function(_0x3f827e){console[_0x1a9b('0x1d')](_0x1a9b('0x20'),_0x3f827e);logger[_0x1a9b('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3f827e);process[_0x1a9b('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ca71e9f..1a869b8 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 _0x3032=['find','sub','Setting','findOne','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','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~!@#$%^&-_=+[{]}.','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','email','userpic','md5secret','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','query','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','then','authenticate','json','Bearer','Unknown\x20authorization\x20format','getUuid','apikey'];(function(_0x39733b,_0x40e4f0){var _0x1e5113=function(_0x3f3aaa){while(--_0x3f3aaa){_0x39733b['push'](_0x39733b['shift']());}};_0x1e5113(++_0x40e4f0);}(_0x3032,0x1d6));var _0x2303=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3032[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0x2303('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x2303('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x2303('0x2'));var _=require(_0x2303('0x3'));var jwt=require(_0x2303('0x4'));var expressJwt=require(_0x2303('0x5'));var compose=require(_0x2303('0x6'));var basicAuth=require(_0x2303('0x7'));var crypto=require(_0x2303('0x8'));var BPromise=require(_0x2303('0x9'));var util=require(_0x2303('0xa'));var moment=require(_0x2303('0xb'));var validateJwt=expressJwt({'secret':config[_0x2303('0xc')]['session']});var userAttributes=['id',_0x2303('0xd'),_0x2303('0xe'),_0x2303('0xf'),_0x2303('0x10'),_0x2303('0x11'),_0x2303('0x12'),'permissions',_0x2303('0x13'),'voicePause',_0x2303('0x14'),'mailPause',_0x2303('0x15'),_0x2303('0x16'),_0x2303('0x17'),_0x2303('0x18'),_0x2303('0x19'),'lastLoginAt',_0x2303('0x1a'),_0x2303('0x1b'),_0x2303('0x1c'),_0x2303('0x1d'),_0x2303('0x1e'),_0x2303('0x1f'),'phoneBarAutoAnswerDelay',_0x2303('0x20'),_0x2303('0x21'),'phoneBarEnableDtmfTone','phoneBarEnableSettings',_0x2303('0x22'),_0x2303('0x23'),_0x2303('0x24'),_0x2303('0x25'),'hotdesk',_0x2303('0x26'),_0x2303('0x27'),'privacyEnabled',_0x2303('0x28'),'wssPort',_0x2303('0x29'),_0x2303('0x2a'),_0x2303('0x2b'),_0x2303('0x2c'),'selectRecallMeCampaign',_0x2303('0x2d'),_0x2303('0x2e'),_0x2303('0x2f'),_0x2303('0x30'),_0x2303('0x31'),_0x2303('0x32'),'openchannelAutoanswer',_0x2303('0x33'),_0x2303('0x34'),_0x2303('0x35'),_0x2303('0x36'),_0x2303('0x37'),_0x2303('0x38')];exports['isChatInteractionAuthorized']=function(){return this[_0x2303('0x39')](!![])[_0x2303('0x3a')](function(_0x45f3ff,_0x895ce0,_0x559e11){if(_0x45f3ff[_0x2303('0x3b')]){_0x559e11();}else{return db[_0x2303('0x3c')]['findOne']({'where':{'id':_0x45f3ff[_0x2303('0x3d')]['id']},'attributes':['id',_0x2303('0x3e'),_0x2303('0x3f')],'raw':!![]})['then'](function(_0x14fb59){if(_0x14fb59&&_0x14fb59['closed']&&!_0x45f3ff[_0x2303('0x40')]['forceDownload']){return _0x895ce0[_0x2303('0x41')](_0x14fb59[_0x2303('0x3f')]===_0x2303('0x42')?0x195:0x193)['json']({'message':_0x14fb59['disposition']===_0x2303('0x42')?_0x2303('0x43'):_0x2303('0x44')});}else{_0x559e11();}})[_0x2303('0x45')](function(_0x2196ee){_0x559e11(_0x2196ee);});}});};exports[_0x2303('0x39')]=function isAuthenticated(_0x2162d0){return compose()[_0x2303('0x3a')](function(_0x16a9e1,_0x45aaf3,_0x5a3b03){var _0x56bb61;if(_0x16a9e1[_0x2303('0x46')][_0x2303('0x47')]){if(_[_0x2303('0x48')](_0x16a9e1['headers'][_0x2303('0x47')],_0x2303('0x49'))){var _0x381be8=basicAuth(_0x16a9e1);db[_0x2303('0x4a')]['find']({'where':{'name':_0x381be8[_0x2303('0xf')]}})[_0x2303('0x4b')](function(_0x58efda){if(!_0x58efda||!_0x58efda[_0x2303('0x4c')](_0x381be8['pass'])){return _0x45aaf3[_0x2303('0x41')](0x191)[_0x2303('0x4d')]({'message':'Wrong\x20credentials.'});}_0x16a9e1[_0x2303('0x3b')]={'id':_0x58efda['id']};_0x5a3b03();})[_0x2303('0x45')](function(_0x555fe3){_0x5a3b03(_0x555fe3);});}else if(_[_0x2303('0x48')](_0x16a9e1[_0x2303('0x46')][_0x2303('0x47')],_0x2303('0x4e'))){validateJwt(_0x16a9e1,_0x45aaf3,_0x5a3b03);}else{if(_0x2162d0){_0x5a3b03();}else{return _0x45aaf3[_0x2303('0x41')](0x193)[_0x2303('0x4d')]({'message':_0x2303('0x4f')});}}}else if(_0x16a9e1[_0x2303('0x40')]['apikey']){try{var _0x1dc557={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2303('0x50')]()};verifyJwt(_0x16a9e1[_0x2303('0x40')][_0x2303('0x51')],_0x1dc557)['then'](function(_0x214de5){return db['User'][_0x2303('0x52')]({'where':{'id':_0x214de5[_0x2303('0x53')]}})[_0x2303('0x4b')](function(_0x34ca99){_0x56bb61=_0x34ca99;return db[_0x2303('0x54')][_0x2303('0x55')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})['then'](function(_0x43696a){if(!_0x56bb61||!_[_0x2303('0x56')](_0x56bb61[_0x2303('0x57')],_0x214de5['nonce'])){return _0x45aaf3['status'](0x191)['json']({'message':_0x2303('0x58')});}if(_0x56bb61['disabled']){return _0x45aaf3[_0x2303('0x41')](0x191)[_0x2303('0x4d')]({'message':_0x2303('0x59')});}if(_0x56bb61[_0x2303('0x5a')]){if(_0x43696a[_0x2303('0x5b')]>0x0){if(moment(_0x56bb61[_0x2303('0x5c')])[_0x2303('0x5d')](_0x43696a[_0x2303('0x5b')],_0x2303('0x5e'))>moment()){return _0x45aaf3['status'](0x191)[_0x2303('0x4d')]({'message':_0x2303('0x59')});}}else{return _0x45aaf3[_0x2303('0x41')](0x191)[_0x2303('0x4d')]({'message':_0x2303('0x59')});}}_0x16a9e1[_0x2303('0x3b')]={'id':_0x56bb61['id']};_0x5a3b03();});})[_0x2303('0x45')](function(){return _0x45aaf3[_0x2303('0x41')](0x191)['json']({'message':_0x2303('0x59')});});}catch(_0x5ea3cb){_0x5a3b03(_0x5ea3cb);}}else if(_0x2162d0){_0x5a3b03();}else{return _0x45aaf3[_0x2303('0x41')](0x193)[_0x2303('0x4d')]({'message':_0x2303('0x4f')});}})[_0x2303('0x3a')](function(_0x17c883,_0x2ada25,_0x2ef53b){if(_0x17c883[_0x2303('0x3b')]){db['User'][_0x2303('0x52')]({'where':{'id':_0x17c883[_0x2303('0x3b')]['id']},'attributes':userAttributes})[_0x2303('0x4b')](function(_0x4a228f){if(!_0x4a228f){return _0x2ada25[_0x2303('0x41')](0x194)['json']({'message':_0x2303('0x5f')});}_0x17c883['user']=_0x4a228f;_0x2ef53b();})['catch'](function(_0x33b03f){_0x2ef53b(_0x33b03f);});}else if(_0x2162d0){_0x2ef53b();}else{return _0x2ada25[_0x2303('0x41')](0x194)[_0x2303('0x4d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2303('0x60')]=function canUpdate(){return compose()[_0x2303('0x3a')](function(_0x3fd51b,_0x167c36,_0xb4825d){return licenseUtil[_0x2303('0x61')]()['then'](function(_0x55d262){if(_0x55d262['update']){_0xb4825d();}else{return _0x167c36[_0x2303('0x41')](0x193)[_0x2303('0x4d')]({'message':_0x2303('0x62')});}})[_0x2303('0x45')](function(_0x507e85){_0xb4825d(_0x507e85);});});};exports[_0x2303('0x63')]=function isWebrtcLicence(){return compose()[_0x2303('0x3a')](function(_0x43d65e,_0x139dea,_0x4d8933){return licenseUtil[_0x2303('0x61')]()[_0x2303('0x4b')](function(_0x295ead){if(_0x295ead['webrtc']){_0x4d8933();}else{return _0x139dea[_0x2303('0x41')](0x193)[_0x2303('0x4d')]({'message':_0x2303('0x62')});}})['catch'](function(_0x569404){_0x4d8933(_0x569404);});});};exports[_0x2303('0x64')]=function(_0x3f98ff,_0x196ce5,_0x4c6cb7){_0x3f98ff['isMiddleware']=!![];return _0x4c6cb7();};exports[_0x2303('0x65')]=function signToken(_0x158dcc){return signJwt(_0x158dcc);};exports[_0x2303('0x66')]=function(_0x5db98f,_0xbf4d56){if(!_0x5db98f[_0x2303('0x3b')]){return _0xbf4d56[_0x2303('0x41')](0x194)[_0x2303('0x4d')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x35e5e3={'payload':{'id':_0x5db98f[_0x2303('0x3b')]['id'],'role':_0x5db98f[_0x2303('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x35e5e3)[_0x2303('0x4b')](function(_0x494629){_0xbf4d56[_0x2303('0x67')](_0x2303('0x68'),_0x494629);_0xbf4d56[_0x2303('0x69')](_0x2303('0x6a'));})[_0x2303('0x45')](function(_0x59db94){return _0xbf4d56[_0x2303('0x41')](0x1f4)[_0x2303('0x6b')](_0x59db94);});};exports[_0x2303('0x6c')]=function(_0x258245){if(_[_0x2303('0x6d')](_0x258245[_0x2303('0x57')])||_[_0x2303('0x6d')](_0x258245[_0x2303('0x6e')])){return null;}else{return createJwt(_0x258245);}};exports[_0x2303('0x6f')]=function(_0x4e2cf1){_0x4e2cf1['apiKeyNonce']=generateNonce();_0x4e2cf1[_0x2303('0x6e')]=generateIssuedAt();return createJwt(_0x4e2cf1);};exports[_0x2303('0x70')]=function(_0x1f4ebe,_0x51efad){var _0x1d7a22=_0x1f4ebe[_0x2303('0x40')][_0x2303('0x51')];if(_0x1d7a22){var _0x5cdee2={'nonce':_0x51efad[_0x2303('0x57')],'iat':_0x51efad['apiKeyIat'],'audience':hardwareConf[_0x2303('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x1d7a22,_0x5cdee2)[_0x2303('0x4b')](function(){return generateApiKey(_0x51efad);});}else{throw{'message':_0x2303('0x71')};}};exports['validatePasswordPattern']=function(_0x7ec490){var _0x412aa5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x412aa5[_0x2303('0x72')](_0x7ec490))throw new db['Sequelize'][(_0x2303('0x73'))](_0x2303('0x74'));return;};exports['validatePasswordHistory']=function(_0x164011,_0x23f6e4,_0x9a5404){var _0x1827ef=encryptor['decryptString'](_0x23f6e4)[_0x2303('0x75')](',');for(var _0x368bb2=0x0;_0x368bb2<_0x9a5404;_0x368bb2++){if(!_0x1827ef[_0x368bb2])break;if(_0x164011[_0x2303('0x76')]()===_0x1827ef[_0x368bb2][_0x2303('0x76')]()){var _0x4f9452=util[_0x2303('0x77')](_0x2303('0x78'),_0x9a5404);if(_0x9a5404===0x1){_0x4f9452='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2303('0x79'))]['ValidationError'](_0x4f9452);}}return;};exports[_0x2303('0x7a')]=function(_0x107fa6,_0x1a3e13){var _0x24d23d=_0x1a3e13?encryptor[_0x2303('0x7b')](_0x1a3e13)[_0x2303('0x75')](','):[];if(_0x24d23d['length']===0x5){_0x24d23d[_0x2303('0x7c')](-0x1,0x1);}_0x24d23d[_0x2303('0x7d')](_0x107fa6);return encryptor[_0x2303('0x7e')](_0x24d23d[_0x2303('0x7f')](','));};function signJwt(_0x2086ea){var _0x5bd5ad=BPromise[_0x2303('0x80')](jwt[_0x2303('0x81')],{'context':jwt});var _0x49df3f=_0x2086ea[_0x2303('0x82')]||config[_0x2303('0xc')][_0x2303('0x83')];return new BPromise(function(_0x4f4348,_0x30b3c3){_0x5bd5ad(_0x2086ea[_0x2303('0x84')],_0x49df3f,_0x2086ea['options'])['then'](function(_0x41d19e){_0x4f4348(_0x41d19e);})[_0x2303('0x45')](function(_0x5741c5){_0x30b3c3(_0x5741c5);});});}function verifyJwt(_0x5a6bf2,_0x3c073d,_0x3854f9){var _0x296f4e=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0xd4144c=_0x3854f9||config[_0x2303('0xc')][_0x2303('0x83')];return new BPromise(function(_0x2a5bad,_0x275a2a){_0x296f4e(_0x5a6bf2,_0xd4144c,_0x3c073d)[_0x2303('0x4b')](function(_0x5dcfe8){_0x2a5bad(_0x5dcfe8);})[_0x2303('0x45')](function(_0x30d2b5){_0x275a2a(_0x30d2b5);});});}function generateNonce(){return crypto[_0x2303('0x85')](0x10)[_0x2303('0x86')](_0x2303('0x87'));}function generateIssuedAt(){return Math[_0x2303('0x88')](Date[_0x2303('0x89')]()/0x3e8)[_0x2303('0x86')]();}function createJwt(_0x16a4ce){var _0x2e3c4d={'payload':{'iat':_0x16a4ce[_0x2303('0x6e')],'nonce':_0x16a4ce[_0x2303('0x57')]},'options':{'algorithm':'HS512','subject':_0x16a4ce['id']['toString'](),'issuer':hardwareConf[_0x2303('0x50')](),'audience':hardwareConf[_0x2303('0x50')]()}};return signJwt(_0x2e3c4d)['then'](function(_0x3e7e6a){return{'iat':_0x16a4ce[_0x2303('0x6e')],'nonce':_0x16a4ce[_0x2303('0x57')],'token':_0x3e7e6a};});} \ No newline at end of file +var _0x9c17=['ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','then','closed','query','forceDownload','status','disposition','unmanaged','catch','use','headers','authorization','startsWith','find','authenticate','pass','Bearer','json','apikey','getUuid','User','sub','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','Invalid\x20API\x20access\x20key','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','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','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','session','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','role','internal','userpic','voicePause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments'];(function(_0x392dbf,_0x268afa){var _0x29a315=function(_0x41c7b8){while(--_0x41c7b8){_0x392dbf['push'](_0x392dbf['shift']());}};_0x29a315(++_0x268afa);}(_0x9c17,0xe1));var _0x79c1=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0x9c17[_0x500785];return _0x1f8bcc;};'use strict';var db=require(_0x79c1('0x0'))['db'];var config=require(_0x79c1('0x1'));var hardwareConf=require(_0x79c1('0x2'));var licenseUtil=require(_0x79c1('0x3'));var encryptor=require('../encryptor');var _=require(_0x79c1('0x4'));var jwt=require(_0x79c1('0x5'));var expressJwt=require(_0x79c1('0x6'));var compose=require(_0x79c1('0x7'));var basicAuth=require(_0x79c1('0x8'));var crypto=require('crypto');var BPromise=require(_0x79c1('0x9'));var util=require(_0x79c1('0xa'));var moment=require(_0x79c1('0xb'));var validateJwt=expressJwt({'secret':config[_0x79c1('0xc')]['session']});var userAttributes=['id',_0x79c1('0xd'),'fullname','name',_0x79c1('0xe'),'email',_0x79c1('0xf'),'permissions','md5secret',_0x79c1('0x10'),'chatPause',_0x79c1('0x11'),_0x79c1('0x12'),_0x79c1('0x13'),_0x79c1('0x14'),'pauseType',_0x79c1('0x15'),_0x79c1('0x16'),_0x79c1('0x17'),_0x79c1('0x18'),_0x79c1('0x19'),_0x79c1('0x1a'),_0x79c1('0x1b'),'phoneBarAutoAnswer',_0x79c1('0x1c'),_0x79c1('0x1d'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x79c1('0x1e'),_0x79c1('0x1f'),_0x79c1('0x20'),_0x79c1('0x21'),'phoneBarRemoteControlPort','hotdesk',_0x79c1('0x22'),'userProfileId',_0x79c1('0x23'),'settingsEnabled','wssPort',_0x79c1('0x24'),_0x79c1('0x25'),_0x79c1('0x26'),_0x79c1('0x27'),'selectRecallMeCampaign',_0x79c1('0x28'),_0x79c1('0x29'),'emailAutoanswer',_0x79c1('0x2a'),_0x79c1('0x2b'),_0x79c1('0x2c'),_0x79c1('0x2d'),_0x79c1('0x2e'),_0x79c1('0x2f'),_0x79c1('0x30'),_0x79c1('0x31'),_0x79c1('0x32'),_0x79c1('0x33')];exports[_0x79c1('0x34')]=function(){return this[_0x79c1('0x35')](!![])['use'](function(_0x4fb1d8,_0x5be2b0,_0x6b8915){if(_0x4fb1d8[_0x79c1('0x36')]){_0x6b8915();}else{return db[_0x79c1('0x37')]['findOne']({'where':{'id':_0x4fb1d8[_0x79c1('0x38')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x79c1('0x39')](function(_0x3ab619){if(_0x3ab619&&_0x3ab619[_0x79c1('0x3a')]&&!_0x4fb1d8[_0x79c1('0x3b')][_0x79c1('0x3c')]){return _0x5be2b0[_0x79c1('0x3d')](_0x3ab619[_0x79c1('0x3e')]===_0x79c1('0x3f')?0x195:0x193)['json']({'message':_0x3ab619['disposition']===_0x79c1('0x3f')?'Unmanaged.':'Forbidden.'});}else{_0x6b8915();}})[_0x79c1('0x40')](function(_0x2f303b){_0x6b8915(_0x2f303b);});}});};exports[_0x79c1('0x35')]=function isAuthenticated(_0x4c401d){return compose()[_0x79c1('0x41')](function(_0x3b21ad,_0x45562f,_0x24570d){var _0x3c78b2;if(_0x3b21ad[_0x79c1('0x42')][_0x79c1('0x43')]){if(_[_0x79c1('0x44')](_0x3b21ad[_0x79c1('0x42')][_0x79c1('0x43')],'Basic')){var _0x2a3f6b=basicAuth(_0x3b21ad);db['User'][_0x79c1('0x45')]({'where':{'name':_0x2a3f6b['name']}})[_0x79c1('0x39')](function(_0x27e6bd){if(!_0x27e6bd||!_0x27e6bd[_0x79c1('0x46')](_0x2a3f6b[_0x79c1('0x47')])){return _0x45562f['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x3b21ad[_0x79c1('0x36')]={'id':_0x27e6bd['id']};_0x24570d();})[_0x79c1('0x40')](function(_0x27e2a9){_0x24570d(_0x27e2a9);});}else if(_[_0x79c1('0x44')](_0x3b21ad['headers'][_0x79c1('0x43')],_0x79c1('0x48'))){validateJwt(_0x3b21ad,_0x45562f,_0x24570d);}else{if(_0x4c401d){_0x24570d();}else{return _0x45562f['status'](0x193)[_0x79c1('0x49')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3b21ad[_0x79c1('0x3b')][_0x79c1('0x4a')]){try{var _0x2472f2={'audience':hardwareConf[_0x79c1('0x4b')](),'issuer':hardwareConf[_0x79c1('0x4b')]()};verifyJwt(_0x3b21ad['query'][_0x79c1('0x4a')],_0x2472f2)[_0x79c1('0x39')](function(_0x26e5d3){return db[_0x79c1('0x4c')]['find']({'where':{'id':_0x26e5d3[_0x79c1('0x4d')]}})['then'](function(_0x3524fd){_0x3c78b2=_0x3524fd;return db['Setting'][_0x79c1('0x4e')]({'where':{'id':0x1},'attributes':[_0x79c1('0x4f'),_0x79c1('0x50')],'raw':!![]});})[_0x79c1('0x39')](function(_0x1fd0e3){if(!_0x3c78b2||!_[_0x79c1('0x51')](_0x3c78b2[_0x79c1('0x52')],_0x26e5d3['nonce'])){return _0x45562f[_0x79c1('0x3d')](0x191)[_0x79c1('0x49')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3c78b2['disabled']){return _0x45562f[_0x79c1('0x3d')](0x191)['json']({'message':_0x79c1('0x53')});}if(_0x3c78b2['blocked']){if(_0x1fd0e3[_0x79c1('0x50')]>0x0){if(moment(_0x3c78b2['blockedAt'])[_0x79c1('0x54')](_0x1fd0e3[_0x79c1('0x50')],_0x79c1('0x55'))>moment()){return _0x45562f[_0x79c1('0x3d')](0x191)[_0x79c1('0x49')]({'message':_0x79c1('0x53')});}}else{return _0x45562f[_0x79c1('0x3d')](0x191)[_0x79c1('0x49')]({'message':_0x79c1('0x53')});}}_0x3b21ad[_0x79c1('0x36')]={'id':_0x3c78b2['id']};_0x24570d();});})[_0x79c1('0x40')](function(){return _0x45562f[_0x79c1('0x3d')](0x191)[_0x79c1('0x49')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x241415){_0x24570d(_0x241415);}}else if(_0x4c401d){_0x24570d();}else{return _0x45562f[_0x79c1('0x3d')](0x193)[_0x79c1('0x49')]({'message':_0x79c1('0x56')});}})[_0x79c1('0x41')](function(_0x1ee483,_0xb437fd,_0x470dde){if(_0x1ee483[_0x79c1('0x36')]){db[_0x79c1('0x4c')][_0x79c1('0x45')]({'where':{'id':_0x1ee483['user']['id']},'attributes':userAttributes})[_0x79c1('0x39')](function(_0x4d8315){if(!_0x4d8315){return _0xb437fd['status'](0x194)[_0x79c1('0x49')]({'message':_0x79c1('0x57')});}_0x1ee483['user']=_0x4d8315;_0x470dde();})[_0x79c1('0x40')](function(_0x4a3487){_0x470dde(_0x4a3487);});}else if(_0x4c401d){_0x470dde();}else{return _0xb437fd['status'](0x194)['json']({'message':_0x79c1('0x58')});}});};exports[_0x79c1('0x59')]=function canUpdate(){return compose()[_0x79c1('0x41')](function(_0x1c31e8,_0x4c25d4,_0x2f47ff){return licenseUtil['getLicense']()[_0x79c1('0x39')](function(_0x1d73a9){if(_0x1d73a9[_0x79c1('0x5a')]){_0x2f47ff();}else{return _0x4c25d4[_0x79c1('0x3d')](0x193)[_0x79c1('0x49')]({'message':_0x79c1('0x5b')});}})[_0x79c1('0x40')](function(_0x375061){_0x2f47ff(_0x375061);});});};exports[_0x79c1('0x5c')]=function isWebrtcLicence(){return compose()[_0x79c1('0x41')](function(_0x5a48e8,_0x566dd7,_0x52cfa3){return licenseUtil[_0x79c1('0x5d')]()[_0x79c1('0x39')](function(_0x358d29){if(_0x358d29[_0x79c1('0x5e')]){_0x52cfa3();}else{return _0x566dd7[_0x79c1('0x3d')](0x193)[_0x79c1('0x49')]({'message':'Forbidden'});}})[_0x79c1('0x40')](function(_0x36684a){_0x52cfa3(_0x36684a);});});};exports['isMiddleware']=function(_0x377ed8,_0x40d997,_0x1d5f1d){_0x377ed8['isMiddleware']=!![];return _0x1d5f1d();};exports[_0x79c1('0x5f')]=function signToken(_0x2adcff){return signJwt(_0x2adcff);};exports[_0x79c1('0x60')]=function(_0x1a37b2,_0x2a41ad){if(!_0x1a37b2['user']){return _0x2a41ad[_0x79c1('0x3d')](0x194)[_0x79c1('0x49')]({'message':_0x79c1('0x61')});}var _0x25d54e={'payload':{'id':_0x1a37b2[_0x79c1('0x36')]['id'],'role':_0x1a37b2['user'][_0x79c1('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x25d54e)[_0x79c1('0x39')](function(_0x118582){_0x2a41ad[_0x79c1('0x62')](_0x79c1('0x63'),_0x118582);_0x2a41ad['redirect'](_0x79c1('0x64'));})[_0x79c1('0x40')](function(_0x3b1386){return _0x2a41ad['status'](0x1f4)['send'](_0x3b1386);});};exports[_0x79c1('0x65')]=function(_0x345b8b){if(_['isNil'](_0x345b8b[_0x79c1('0x52')])||_[_0x79c1('0x66')](_0x345b8b[_0x79c1('0x67')])){return null;}else{return createJwt(_0x345b8b);}};exports['generateApiKey']=function(_0x3ed7ca){_0x3ed7ca['apiKeyNonce']=generateNonce();_0x3ed7ca[_0x79c1('0x67')]=generateIssuedAt();return createJwt(_0x3ed7ca);};exports[_0x79c1('0x68')]=function(_0x149272,_0x2aa516){var _0x66d12a=_0x149272[_0x79c1('0x3b')][_0x79c1('0x4a')];if(_0x66d12a){var _0x2e0ec6={'nonce':_0x2aa516[_0x79c1('0x52')],'iat':_0x2aa516['apiKeyIat'],'audience':hardwareConf[_0x79c1('0x4b')](),'issuer':hardwareConf[_0x79c1('0x4b')]()};return verifyJwt(_0x66d12a,_0x2e0ec6)[_0x79c1('0x39')](function(){return generateApiKey(_0x2aa516);});}else{throw{'message':_0x79c1('0x69')};}};exports['validatePasswordPattern']=function(_0x2b7079){var _0x382ae3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x382ae3[_0x79c1('0x6a')](_0x2b7079))throw new db[(_0x79c1('0x6b'))]['ValidationError'](_0x79c1('0x6c'));return;};exports[_0x79c1('0x6d')]=function(_0x449263,_0x4c9040,_0x1f395e){var _0x4363bb=encryptor[_0x79c1('0x6e')](_0x4c9040)[_0x79c1('0x6f')](',');for(var _0xe8f00b=0x0;_0xe8f00b<_0x1f395e;_0xe8f00b++){if(!_0x4363bb[_0xe8f00b])break;if(_0x449263['toLowerCase']()===_0x4363bb[_0xe8f00b][_0x79c1('0x70')]()){var _0x237f28=util[_0x79c1('0x71')](_0x79c1('0x72'),_0x1f395e);if(_0x1f395e===0x1){_0x237f28='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x79c1('0x6b'))][(_0x79c1('0x73'))](_0x237f28);}}return;};exports[_0x79c1('0x74')]=function(_0x2b7957,_0x3bee60){var _0x1e0b7a=_0x3bee60?encryptor['decryptString'](_0x3bee60)['split'](','):[];if(_0x1e0b7a[_0x79c1('0x75')]===0x5){_0x1e0b7a[_0x79c1('0x76')](-0x1,0x1);}_0x1e0b7a[_0x79c1('0x77')](_0x2b7957);return encryptor[_0x79c1('0x78')](_0x1e0b7a[_0x79c1('0x79')](','));};function signJwt(_0xa94a4f){var _0x192be5=BPromise[_0x79c1('0x7a')](jwt[_0x79c1('0x7b')],{'context':jwt});var _0x1dd191=_0xa94a4f[_0x79c1('0x7c')]||config['secrets']['session'];return new BPromise(function(_0xc9d762,_0x410240){_0x192be5(_0xa94a4f[_0x79c1('0x7d')],_0x1dd191,_0xa94a4f['options'])[_0x79c1('0x39')](function(_0x5a6773){_0xc9d762(_0x5a6773);})[_0x79c1('0x40')](function(_0x4bd59c){_0x410240(_0x4bd59c);});});}function verifyJwt(_0x406ec4,_0x5d4472,_0x2442a2){var _0x244c59=BPromise[_0x79c1('0x7a')](jwt['verify'],{'context':jwt});var _0x5e593f=_0x2442a2||config[_0x79c1('0xc')][_0x79c1('0x7e')];return new BPromise(function(_0x1db275,_0x59472c){_0x244c59(_0x406ec4,_0x5e593f,_0x5d4472)[_0x79c1('0x39')](function(_0x2710fc){_0x1db275(_0x2710fc);})['catch'](function(_0x4e9e38){_0x59472c(_0x4e9e38);});});}function generateNonce(){return crypto[_0x79c1('0x7f')](0x10)[_0x79c1('0x80')](_0x79c1('0x81'));}function generateIssuedAt(){return Math[_0x79c1('0x82')](Date['now']()/0x3e8)[_0x79c1('0x80')]();}function createJwt(_0x54aa9a){var _0x2c79bd={'payload':{'iat':_0x54aa9a[_0x79c1('0x67')],'nonce':_0x54aa9a[_0x79c1('0x52')]},'options':{'algorithm':_0x79c1('0x83'),'subject':_0x54aa9a['id'][_0x79c1('0x80')](),'issuer':hardwareConf[_0x79c1('0x4b')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2c79bd)[_0x79c1('0x39')](function(_0x2e09c0){return{'iat':_0x54aa9a[_0x79c1('0x67')],'nonce':_0x54aa9a[_0x79c1('0x52')],'token':_0x2e09c0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index f2e9b67..a6a2bbc 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f9f=['countFilteredContacts','count','User','buildContactsQuery','fields','rows','catch','describe','CmContact','startsWith','map','findOne','all','length','type','keys','lodash','./sql-utils','../../mysqldb','findAll','resolve','search','parseQueryParameters','then','where','default','user','clause','checkListsRestrictions','ids','tag'];(function(_0xde085d,_0x573b71){var _0x1fee75=function(_0x518a2f){while(--_0x518a2f){_0xde085d['push'](_0xde085d['shift']());}};_0x1fee75(++_0x573b71);}(_0x9f9f,0xe9));var _0xf9f9=function(_0x571884,_0x2e5542){_0x571884=_0x571884-0x0;var _0xaf29f5=_0x9f9f[_0x571884];return _0xaf29f5;};'use strict';var _=require(_0xf9f9('0x0'));var sqlUtils=require(_0xf9f9('0x1'));var db=require(_0xf9f9('0x2'))['db'];exports[_0xf9f9('0x3')]=function(_0x33bb96,_0x42dd3f,_0x47ad98,_0x349805){var _0x238101={'count':0x0,'rows':[]};var _0x2a3b3f=sqlUtils['skipContactsQuery'](_0x42dd3f,_0x33bb96);if(_0x2a3b3f){return Promise['resolve'](_0x238101);}var _0x3bac84=sqlUtils['getContactsSubquery']();var _0x2a8a2f={};var _0x392df3=![];var _0x59d1ed=![];return Promise[_0xf9f9('0x4')]()['then'](function(){if(_0x33bb96[_0xf9f9('0x5')]){return sqlUtils['parseAdvancedSearchFilter'](_0x33bb96['search'],_0x349805);}else{return sqlUtils[_0xf9f9('0x6')](_0x33bb96,_0x349805);}})[_0xf9f9('0x7')](function(_0x11519d){_0x3bac84[_0xf9f9('0x8')](_0x11519d[_0xf9f9('0x9')]);_0x3bac84[_0xf9f9('0x8')](_0x11519d['fields']);_0x3bac84[_0xf9f9('0x8')](_0x11519d['filter']);_0x3bac84[_0xf9f9('0x8')](_0x11519d[_0xf9f9('0xa')][_0xf9f9('0xb')]);_0x2a8a2f=_0x11519d['tags'];_0x59d1ed=_0x11519d['user']['skip'];return sqlUtils[_0xf9f9('0xc')](_0x42dd3f,_0x33bb96,_0x59d1ed);})[_0xf9f9('0x7')](function(_0x1cbf51){_0x3bac84[_0xf9f9('0x8')](_0x1cbf51);var _0x2c66e9=_0x33bb96[_0xf9f9('0x5')]?_0x2a8a2f[_0xf9f9('0xd')]:_0x33bb96[_0xf9f9('0xe')];_0x392df3=_0x2c66e9?!![]:![];return sqlUtils[_0xf9f9('0xf')](_0x3bac84,_0x2c66e9);})[_0xf9f9('0x7')](function(_0x224b02){_0x238101[_0xf9f9('0x10')]=_0x224b02;if(_0x238101[_0xf9f9('0x10')]===0x0){return;}if(_0x33bb96[_0xf9f9('0x11')]){_0x59d1ed=!![];}return sqlUtils[_0xf9f9('0x12')](_0x3bac84,_0x33bb96[_0xf9f9('0x13')],_0x47ad98,_0x392df3,_0x2a8a2f[_0xf9f9('0xb')],_0x59d1ed);})[_0xf9f9('0x7')](function(_0x45b81c){if(!_0x45b81c){return[];}return sqlUtils['getFilteredContacts'](_0x45b81c,_0x33bb96,_0x47ad98);})[_0xf9f9('0x7')](function(_0xa32b0c){_0x238101[_0xf9f9('0x14')]=_0xa32b0c;return _0x238101;})[_0xf9f9('0x15')](function(_0x5dd4e1){throw _0x5dd4e1;});};exports[_0xf9f9('0x16')]=function(){var _0x4cec16={};var _0x489454=[];return db[_0xf9f9('0x17')][_0xf9f9('0x16')]()['then'](function(_0x31fc82){_0x4cec16=_0x31fc82;var _0x1b4aeb=Object['keys'](_0x4cec16)['filter'](function(_0x486343){return _[_0xf9f9('0x18')](_0x486343,'cf_')?_0x486343:undefined;});var _0x2b4c2e=_0x1b4aeb[_0xf9f9('0x19')](function(_0x4dead7){return db['CmCustomField'][_0xf9f9('0x1a')]({'where':{'id':_0x4dead7['slice'](0x3)},'raw':!![]});});return Promise[_0xf9f9('0x1b')](_0x2b4c2e);})[_0xf9f9('0x7')](function(_0x41be58){for(var _0x2691eb=0x0;_0x2691eb<_0x41be58[_0xf9f9('0x1c')];_0x2691eb++){if(_0x41be58[_0x2691eb]){var _0x4729cf='cf_'+_0x41be58[_0x2691eb]['id'];_0x4cec16[_0x4729cf]['fieldType']=_0x41be58[_0x2691eb][_0xf9f9('0x1d')];}}_0x489454=_[_0xf9f9('0x19')](Object[_0xf9f9('0x1e')](_0x4cec16),function(_0x45cf74){return{'name':_0x45cf74,'type':_0x4cec16[_0x45cf74]['type']};});return _0x489454;})[_0xf9f9('0x15')](function(_0x39a638){throw _0x39a638;});}; \ No newline at end of file +var _0x284f=['buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','cf_','CmCustomField','findOne','slice','all','type','map','./sql-utils','findAll','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','User'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x284f,0x161));var _0xf284=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x284f[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var sqlUtils=require(_0xf284('0x0'));var db=require('../../mysqldb')['db'];exports[_0xf284('0x1')]=function(_0x4d3720,_0x434c9a,_0x159448,_0x170901){var _0x54626e={'count':0x0,'rows':[]};var _0x2c0b1e=sqlUtils['skipContactsQuery'](_0x434c9a,_0x4d3720);if(_0x2c0b1e){return Promise['resolve'](_0x54626e);}var _0x4867d0=sqlUtils[_0xf284('0x2')]();var _0x4666ed={};var _0x58557d=![];var _0x45868b=![];return Promise[_0xf284('0x3')]()[_0xf284('0x4')](function(){if(_0x4d3720[_0xf284('0x5')]){return sqlUtils[_0xf284('0x6')](_0x4d3720[_0xf284('0x5')],_0x170901);}else{return sqlUtils[_0xf284('0x7')](_0x4d3720,_0x170901);}})[_0xf284('0x4')](function(_0x16c183){_0x4867d0[_0xf284('0x8')](_0x16c183[_0xf284('0x9')]);_0x4867d0[_0xf284('0x8')](_0x16c183[_0xf284('0xa')]);_0x4867d0[_0xf284('0x8')](_0x16c183[_0xf284('0xb')]);_0x4867d0[_0xf284('0x8')](_0x16c183[_0xf284('0xc')][_0xf284('0xd')]);_0x4666ed=_0x16c183[_0xf284('0xe')];_0x45868b=_0x16c183['user'][_0xf284('0xf')];return sqlUtils[_0xf284('0x10')](_0x434c9a,_0x4d3720,_0x45868b);})[_0xf284('0x4')](function(_0x3d9eab){_0x4867d0[_0xf284('0x8')](_0x3d9eab);var _0x1183fe=_0x4d3720[_0xf284('0x5')]?_0x4666ed[_0xf284('0x11')]:_0x4d3720['tag'];_0x58557d=_0x1183fe?!![]:![];return sqlUtils[_0xf284('0x12')](_0x4867d0,_0x1183fe);})[_0xf284('0x4')](function(_0x52b759){_0x54626e[_0xf284('0x13')]=_0x52b759;if(_0x54626e[_0xf284('0x13')]===0x0){return;}if(_0x4d3720[_0xf284('0x14')]){_0x45868b=!![];}return sqlUtils[_0xf284('0x15')](_0x4867d0,_0x4d3720[_0xf284('0xa')],_0x159448,_0x58557d,_0x4666ed[_0xf284('0xd')],_0x45868b);})[_0xf284('0x4')](function(_0x5a5341){if(!_0x5a5341){return[];}return sqlUtils[_0xf284('0x16')](_0x5a5341,_0x4d3720,_0x159448);})['then'](function(_0x2d1cec){_0x54626e[_0xf284('0x17')]=_0x2d1cec;return _0x54626e;})[_0xf284('0x18')](function(_0x359322){throw _0x359322;});};exports[_0xf284('0x19')]=function(){var _0x49a181={};var _0xb126=[];return db['CmContact']['describe']()['then'](function(_0x334caa){_0x49a181=_0x334caa;var _0x43914d=Object[_0xf284('0x1a')](_0x49a181)[_0xf284('0xb')](function(_0x41bef1){return _['startsWith'](_0x41bef1,_0xf284('0x1b'))?_0x41bef1:undefined;});var _0x34a731=_0x43914d['map'](function(_0x1270ce){return db[_0xf284('0x1c')][_0xf284('0x1d')]({'where':{'id':_0x1270ce[_0xf284('0x1e')](0x3)},'raw':!![]});});return Promise[_0xf284('0x1f')](_0x34a731);})[_0xf284('0x4')](function(_0x2b2e83){for(var _0xf73f2f=0x0;_0xf73f2f<_0x2b2e83['length'];_0xf73f2f++){if(_0x2b2e83[_0xf73f2f]){var _0x5cd64c=_0xf284('0x1b')+_0x2b2e83[_0xf73f2f]['id'];_0x49a181[_0x5cd64c]['fieldType']=_0x2b2e83[_0xf73f2f][_0xf284('0x20')];}}_0xb126=_[_0xf284('0x21')](Object[_0xf284('0x1a')](_0x49a181),function(_0x69344c){return{'name':_0x69344c,'type':_0x49a181[_0x69344c][_0xf284('0x20')]};});return _0xb126;})['catch'](function(_0x458db9){throw _0x458db9;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 75d98cf..2e41797 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ccb=['TagIds','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','name','dateOfBirth','castTo','buildExpression','type','value','Tag','split','map','tags','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','and','\x20=\x20?','resolve','then','clause','filter','role','getLists','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','order','DESC','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','COUNT(*)','exports','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','search','ListId','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt'];(function(_0x5e761b,_0x355e38){var _0x98502c=function(_0x4e52d5){while(--_0x4e52d5){_0x5e761b['push'](_0x5e761b['shift']());}};_0x98502c(++_0x355e38);}(_0x1ccb,0x105));var _0xb1cc=function(_0x5a2cd9,_0x98dcd2){_0x5a2cd9=_0x5a2cd9-0x0;var _0x306d2f=_0x1ccb[_0x5a2cd9];return _0x306d2f;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0xb1cc('0x0'));var qs=require(_0xb1cc('0x1'));var utils=require(_0xb1cc('0x2'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x30cb74,_0x438aac){var _0x44f519=![];if(_0x30cb74['role']===_0xb1cc('0x3')&&!_0x438aac[_0xb1cc('0x4')]&&!_0x438aac[_0xb1cc('0x5')]&&_0x438aac['autocomplete']!=='true'){_0x44f519=!![];}return _0x44f519;}function getContactsSubquery(){return squel[_0xb1cc('0x6')]()[_0xb1cc('0x7')](_0xb1cc('0x8'),'c')[_0xb1cc('0x9')](_0xb1cc('0xa'));}function applyJoinClauses(_0x2946ef,_0x33d3a3){var _0x536511=_0x33d3a3?'c':_0xb1cc('0xb');_0x2946ef[_0xb1cc('0xc')](_0xb1cc('0xd'),'uc','uc.CmContactId\x20=\x20'+_0x536511+_0xb1cc('0xe'))[_0xb1cc('0xc')](_0xb1cc('0xf'),'ct',_0xb1cc('0x10')+_0x536511+_0xb1cc('0xe'))[_0xb1cc('0xc')](_0xb1cc('0x11'),'t',_0xb1cc('0x12'));return _0x2946ef;}function addFieldsToQuery(_0xdd2823,_0xa67a05,_0x5710b9,_0x2669e0,_0x2c0205){var _0x4b660c=_0x2c0205?'c':_0xb1cc('0xb');if(!_0xa67a05){_0xa67a05=['id','firstName',_0xb1cc('0x13'),_0xb1cc('0x14'),_0xb1cc('0x15'),_0xb1cc('0x16'),_0xb1cc('0x17'),_0xb1cc('0x5'),'CompanyId',_0xb1cc('0x18'),_0xb1cc('0x19'),_0xb1cc('0x1a'),_0xb1cc('0x1b')];}else if(!_0xa67a05['includes']('id')){_0xa67a05['push']('id');}var _0x196cd5=_0x5710b9&&_0x2c0205||!_0x5710b9&&!_0x2c0205;if(_0x2669e0){_0x196cd5=_0x2669e0&&_0x2c0205||!_0x2669e0&&!_0x2c0205;}_0xa67a05[_0xb1cc('0x1c')](function(_0x2f5b44){if(_0x2f5b44==='TagIds'){if(_0x196cd5){_0xdd2823[_0xb1cc('0x1d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2f5b44);}else if(_0x5710b9||_0x2669e0){_0xdd2823[_0xb1cc('0x1d')](_0x4b660c+'.'+_0x2f5b44);}}else{_0xdd2823[_0xb1cc('0x1d')](_0x4b660c+'.'+_0x2f5b44);}});return _0xdd2823;}function getSqlClauses(){var _0x540c6d={'default':squel['expr'](),'fields':squel[_0xb1cc('0x1e')](),'filter':squel[_0xb1cc('0x1e')](),'tags':{'clause':squel[_0xb1cc('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x540c6d;}function parseTagParameter(_0x4810a0){var _0x1a30ed=squel['expr']();if(_0x4810a0){var _0x2e3091=utils[_0xb1cc('0x1f')](_0x4810a0);_0x2e3091[_0xb1cc('0x1c')](function(_0x54b6e9){_0x1a30ed['or'](_0xb1cc('0x20'),'%,'+_0x54b6e9+',%');});}return _0x1a30ed;}function parseSearchFilter(_0x384608){var _0x12c42b=squel[_0xb1cc('0x1e')]();if(_0x384608){var _0xf24fea=_0x384608[_0xb1cc('0x21')]('\x5c','\x5c\x5c')[_0xb1cc('0x21')](/'/g,'\x27\x27');var _0xc8678b=qs['escapeLIKESpecialChars'](_0xf24fea);if(_0xf24fea['split']('\x20')['length']>0x1){_0x12c42b['or'](_0xb1cc('0x22'),qs['getFullTextValue'](_0xf24fea,!![]),null);}else{if(qs[_0xb1cc('0x23')](_0xf24fea)){_0x12c42b['or']('c.id\x20LIKE\x20?',_0xc8678b+'%');_0x12c42b['or'](_0xb1cc('0x24'),_0xc8678b+'%');_0x12c42b['or'](_0xb1cc('0x25'),_0xc8678b+'%');_0x12c42b['or']('c.fax\x20LIKE\x20?',_0xc8678b+'%');}else if(qs[_0xb1cc('0x26')](_0xf24fea)){_0x12c42b['or'](_0xb1cc('0x27'),_0xc8678b+'%');}else{_0x12c42b['or'](_0xb1cc('0x28'),'%'+_0xc8678b+'%');_0x12c42b['or'](_0xb1cc('0x29'),'%'+_0xc8678b+'%');_0x12c42b['or'](_0xb1cc('0x27'),'%'+_0xc8678b+'%');}}}return _0x12c42b;}function parseAdvancedSearchFilter(_0x3686ec,_0x8e4515){var _0x1b82c5=getSqlClauses();var _0x13aacc=as[_0xb1cc('0x2a')](_0x3686ec);var _0xfb5388=_0x13aacc[_0xb1cc('0x2b')];for(var _0x5258a4=0x0;_0x5258a4<_0x13aacc[_0xb1cc('0x2c')][_0xb1cc('0x2d')];_0x5258a4++){var _0x36c35f=_0x13aacc[_0xb1cc('0x2c')][_0x5258a4];var _0x2fde65='c';var _0x5501f3=_['find'](_0x8e4515,[_0xb1cc('0x2e'),_0x36c35f[_0xb1cc('0x1d')]]);if(_0x5501f3){if(_0x36c35f[_0xb1cc('0x1d')]===_0xb1cc('0x2f')||_0x5501f3['fieldType']==='datetime'){_0x36c35f[_0xb1cc('0x30')]='DATE';}var _0x29714c=as[_0xb1cc('0x31')](_0x2fde65,_0x5501f3[_0xb1cc('0x32')],_0x36c35f);_0x1b82c5['default'][_0xfb5388](_0x29714c['text'],_0x29714c['value']['start'],_0x29714c[_0xb1cc('0x33')]['end']);}else{if(_0x36c35f[_0xb1cc('0x1d')]===_0xb1cc('0x34')){var _0x4e734b=_0x36c35f['value'][_0xb1cc('0x35')](',')[_0xb1cc('0x36')](function(_0x19d90d){return Number(_0x19d90d);});var _0xd7c8ab=parseTagParameter(_0x4e734b);_0x1b82c5[_0xb1cc('0x37')]['clause']['and'](_0xd7c8ab);_0x1b82c5[_0xb1cc('0x37')]['ids']=_0x4e734b;}else if(_0x36c35f[_0xb1cc('0x1d')]===_0xb1cc('0x38')){_0x1b82c5[_0xb1cc('0x39')]['clause']['and'](_0xb1cc('0x3a'),_0x36c35f['value']);_0x1b82c5['user'][_0xb1cc('0x3b')]=!![];}}}return _0x1b82c5;}function parseModelFields(_0x49f7cd,_0xfd8a3f){var _0x1a4d47=squel[_0xb1cc('0x1e')]();var _0x17242a=_(_0x49f7cd)[_0xb1cc('0x3c')]()[_0xb1cc('0x36')](function(_0x904907){return _[_0xb1cc('0x3d')](_0xfd8a3f,['name',_0x904907])?_0x904907:undefined;})[_0xb1cc('0x3e')]()[_0xb1cc('0x33')]();if(_0x49f7cd[_0xb1cc('0x3f')]){_0x17242a[_0xb1cc('0x40')]('Contact');}if(_0x49f7cd[_0xb1cc('0x38')]){_0x17242a['push'](_0xb1cc('0x38'));}if(_0x17242a[_0xb1cc('0x2d')]>0x0){_0x17242a['forEach'](function(_0xebb88f){if(_0xebb88f===_0xb1cc('0x5')){_0x1a4d47['and'](_0xb1cc('0x41'),[][_0xb1cc('0x42')](_0x49f7cd[_0xebb88f]));}else if(_0xebb88f==='Contact'){var _0x46ba81='%'+_0x49f7cd[_0xebb88f]+'%';_0x1a4d47[_0xb1cc('0x43')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x46ba81);}else if(_0xebb88f===_0xb1cc('0x38')){_0x1a4d47['and'](_0xb1cc('0x3a'),_0x49f7cd[_0xebb88f]);}else{_0x1a4d47[_0xb1cc('0x43')]('c.'+_0xebb88f+_0xb1cc('0x44'),_0x49f7cd[_0xebb88f]);}});}return _0x1a4d47;}function parseQueryParameters(_0x3cee56,_0x3e73f7){var _0x4d570d=getSqlClauses();return Promise[_0xb1cc('0x45')]()[_0xb1cc('0x46')](function(){return parseModelFields(_0x3cee56,_0x3e73f7);})[_0xb1cc('0x46')](function(_0x46a742){_0x4d570d['fields'][_0xb1cc('0x43')](_0x46a742);return parseTagParameter(_0x3cee56['tag']);})[_0xb1cc('0x46')](function(_0x1cebf5){_0x4d570d[_0xb1cc('0x37')][_0xb1cc('0x47')][_0xb1cc('0x43')](_0x1cebf5);return parseSearchFilter(_0x3cee56['filter']);})[_0xb1cc('0x46')](function(_0x1f8568){_0x4d570d[_0xb1cc('0x48')]=_0x1f8568;return _0x4d570d;});}function checkListsRestrictions(_0x144036,_0x82776d,_0x115868){var _0xfb0b60=squel[_0xb1cc('0x1e')]();return Promise[_0xb1cc('0x45')]()['then'](function(){if(_0x82776d[_0xb1cc('0x4')]&&_0x144036[_0xb1cc('0x49')]==='agent'&&!_0x115868){return _0x144036[_0xb1cc('0x4a')]({'attributes':['id'],'raw':!![]});}})[_0xb1cc('0x46')](function(_0x5c580a){if(_0x5c580a){if(_0x5c580a['length']===0x0){_0xfb0b60[_0xb1cc('0x43')](_0xb1cc('0x4b'));}else{_0xfb0b60[_0xb1cc('0x43')](_0xb1cc('0x41'),_['map'](_0x5c580a,'id'));}}})['then'](function(){return _0xfb0b60;});}function buildContactsQuery(_0x15d070,_0x321cc8,_0x1f5df8,_0x2be644,_0x38ee09,_0x23bef8){if(_0x321cc8){_0x321cc8=_0x1f5df8['attributes'];}_0x15d070=addFieldsToQuery(_0x15d070,_0x321cc8,_0x2be644,_0x23bef8,!![]);var _0x21b3a8=squel[_0xb1cc('0x6')]();_0x21b3a8=addFieldsToQuery(_0x21b3a8,_0x321cc8,_0x2be644,_0x23bef8,![]);if(_0x2be644||_0x23bef8){_0x15d070=applyJoinClauses(_0x15d070,!![]);_0x15d070[_0xb1cc('0x4c')](_0xb1cc('0x4d'));if(_0x1f5df8[_0xb1cc('0x4e')]){_0x21b3a8[_0xb1cc('0x4e')](_0x1f5df8[_0xb1cc('0x4e')]);}if(_0x1f5df8[_0xb1cc('0x4f')]){_0x21b3a8[_0xb1cc('0x4f')](_0x1f5df8[_0xb1cc('0x4f')]);}}else{_0x21b3a8=applyJoinClauses(_0x21b3a8,![]);_0x21b3a8['group']('subqry.id');if(_0x1f5df8[_0xb1cc('0x4e')]){_0x15d070[_0xb1cc('0x4e')](_0x1f5df8[_0xb1cc('0x4e')]);}if(_0x1f5df8[_0xb1cc('0x4f')]){_0x15d070[_0xb1cc('0x4f')](_0x1f5df8[_0xb1cc('0x4f')]);}}_0x21b3a8['having'](_0x38ee09);if(_0x1f5df8[_0xb1cc('0x50')]){_0x1f5df8[_0xb1cc('0x50')][_0xb1cc('0x1c')](function(_0x8dbe5c){_0x15d070['order']('c.'+_0x8dbe5c[0x0],_0x8dbe5c[0x1]==='DESC'?![]:!![]);_0x21b3a8[_0xb1cc('0x50')]('subqry.'+_0x8dbe5c[0x0],_0x8dbe5c[0x1]===_0xb1cc('0x51')?![]:!![]);});}_0x21b3a8[_0xb1cc('0x7')](_0x15d070,_0xb1cc('0xb'));return _0x21b3a8;}function getFilteredContacts(_0x4682da){var _0x4a5ac2=[];return db[_0xb1cc('0x34')][_0xb1cc('0x52')]({'attributes':['id',_0xb1cc('0x2e'),_0xb1cc('0x53')],'raw':!![]})[_0xb1cc('0x46')](function(_0x2506ae){_0x4a5ac2=_[_0xb1cc('0x54')](_0x2506ae,'id');var _0x48ff1e={'type':db['Sequelize'][_0xb1cc('0x55')][_0xb1cc('0x56')],'model':db[_0xb1cc('0x57')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb1cc('0x58')]['query'](_0x4682da[_0xb1cc('0x59')](),_0x48ff1e);})['then'](function(_0x2ac3e7){_0x2ac3e7[_0xb1cc('0x1c')](function(_0x15988a){if(_0x15988a['TagIds']){_0x15988a[_0xb1cc('0x5a')]=[];_0x15988a[_0xb1cc('0x1b')][_0xb1cc('0x35')](',')[_0xb1cc('0x1c')](function(_0xb93ce6){_0x15988a[_0xb1cc('0x5a')][_0xb1cc('0x40')](_0x4a5ac2[_0xb93ce6]);});}delete _0x15988a['TagIds'];});return _0x2ac3e7;});}function countFilteredContacts(_0x37b8d3,_0x3c5802){var _0x17566b=_0x37b8d3[_0xb1cc('0x5b')]();_0x17566b[_0xb1cc('0x1d')]('COUNT(*)');_0x17566b=applyJoinClauses(_0x17566b,!![]);_0x37b8d3[_0xb1cc('0x4c')](_0xb1cc('0x4d'));var _0x41f7db=utils['getSelectedTags'](_0x3c5802);if(!_[_0xb1cc('0x5c')](_0x41f7db)){_0x17566b[_0xb1cc('0x9')](_0xb1cc('0x5d'),_0x41f7db);}var _0x49945c={'type':db['Sequelize'][_0xb1cc('0x55')][_0xb1cc('0x56')],'raw':!![]};return db[_0xb1cc('0x58')]['query'](_0x17566b[_0xb1cc('0x59')](),_0x49945c)['then'](function(_0x25cb31){return _0x25cb31[0x0][_0xb1cc('0x5e')];});}module[_0xb1cc('0x5f')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x9463=['resolve','then','fields','tag','filter','attributes','group','limit','offset','subqry.id','having','order','DESC','keyBy','QueryTypes','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','where','t.id\x20IN\x20?','Sequelize','exports','lodash','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','lastName','fax','ListId','CompanyId','createdAt','updatedAt','TagIds','includes','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','DATE','default','value','start','end','Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','map','some','push','Contact','length','c.ListId\x20IN\x20?','concat','\x20=\x20?'];(function(_0x4b92f0,_0x5255d3){var _0x1626a3=function(_0x3bf2a4){while(--_0x3bf2a4){_0x4b92f0['push'](_0x4b92f0['shift']());}};_0x1626a3(++_0x5255d3);}(_0x9463,0x1a6));var _0x3946=function(_0x5dd43c,_0x15fa60){_0x5dd43c=_0x5dd43c-0x0;var _0x1facec=_0x9463[_0x5dd43c];return _0x1facec;};'use strict';var _=require(_0x3946('0x0'));var squel=require('squel');var as=require(_0x3946('0x1'));var qs=require('../parsers/qs');var utils=require(_0x3946('0x2'));var db=require(_0x3946('0x3'))['db'];function skipContactsQuery(_0x3b315f,_0x4118ac){var _0x2a7e78=![];if(_0x3b315f[_0x3946('0x4')]===_0x3946('0x5')&&!_0x4118ac[_0x3946('0x6')]&&!_0x4118ac['ListId']&&_0x4118ac[_0x3946('0x7')]!==_0x3946('0x8')){_0x2a7e78=!![];}return _0x2a7e78;}function getContactsSubquery(){return squel[_0x3946('0x9')]()[_0x3946('0xa')](_0x3946('0xb'),'c')['where'](_0x3946('0xc'));}function applyJoinClauses(_0x5a3a35,_0x3e6866){var _0x3a4e43=_0x3e6866?'c':_0x3946('0xd');_0x5a3a35[_0x3946('0xe')]('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x3a4e43+_0x3946('0xf'))['left_join'](_0x3946('0x10'),'ct','ct.CmContactId\x20=\x20'+_0x3a4e43+_0x3946('0xf'))[_0x3946('0xe')](_0x3946('0x11'),'t',_0x3946('0x12'));return _0x5a3a35;}function addFieldsToQuery(_0x73ba34,_0x32a1c4,_0x5f7a88,_0x375dbb,_0x725ba1){var _0x515bd3=_0x725ba1?'c':'subqry';if(!_0x32a1c4){_0x32a1c4=['id','firstName',_0x3946('0x13'),'phone','mobile',_0x3946('0x14'),'email',_0x3946('0x15'),_0x3946('0x16'),_0x3946('0x17'),_0x3946('0x18'),'deletedAt',_0x3946('0x19')];}else if(!_0x32a1c4[_0x3946('0x1a')]('id')){_0x32a1c4['push']('id');}var _0x5f502e=_0x5f7a88&&_0x725ba1||!_0x5f7a88&&!_0x725ba1;if(_0x375dbb){_0x5f502e=_0x375dbb&&_0x725ba1||!_0x375dbb&&!_0x725ba1;}_0x32a1c4[_0x3946('0x1b')](function(_0xa2b2e){if(_0xa2b2e==='TagIds'){if(_0x5f502e){_0x73ba34[_0x3946('0x1c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa2b2e);}else if(_0x5f7a88||_0x375dbb){_0x73ba34[_0x3946('0x1c')](_0x515bd3+'.'+_0xa2b2e);}}else{_0x73ba34[_0x3946('0x1c')](_0x515bd3+'.'+_0xa2b2e);}});return _0x73ba34;}function getSqlClauses(){var _0x513587={'default':squel[_0x3946('0x1d')](),'fields':squel[_0x3946('0x1d')](),'filter':squel[_0x3946('0x1d')](),'tags':{'clause':squel[_0x3946('0x1d')](),'ids':null},'user':{'clause':squel[_0x3946('0x1d')](),'skip':![]}};return _0x513587;}function parseTagParameter(_0x437d54){var _0x15a17b=squel[_0x3946('0x1d')]();if(_0x437d54){var _0x4ef420=utils[_0x3946('0x1e')](_0x437d54);_0x4ef420[_0x3946('0x1b')](function(_0xada0bf){_0x15a17b['or'](_0x3946('0x1f'),'%,'+_0xada0bf+',%');});}return _0x15a17b;}function parseSearchFilter(_0x3d75c9){var _0x2daf73=squel[_0x3946('0x1d')]();if(_0x3d75c9){var _0x5bc4b5=_0x3d75c9[_0x3946('0x20')]('\x5c','\x5c\x5c')[_0x3946('0x20')](/'/g,'\x27\x27');var _0x2f3d2c=qs[_0x3946('0x21')](_0x5bc4b5);if(_0x5bc4b5[_0x3946('0x22')]('\x20')['length']>0x1){_0x2daf73['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3946('0x23')](_0x5bc4b5,!![]),null);}else{if(qs[_0x3946('0x24')](_0x5bc4b5)){_0x2daf73['or'](_0x3946('0x25'),_0x2f3d2c+'%');_0x2daf73['or'](_0x3946('0x26'),_0x2f3d2c+'%');_0x2daf73['or'](_0x3946('0x27'),_0x2f3d2c+'%');_0x2daf73['or'](_0x3946('0x28'),_0x2f3d2c+'%');}else if(qs[_0x3946('0x29')](_0x5bc4b5)){_0x2daf73['or'](_0x3946('0x2a'),_0x2f3d2c+'%');}else{_0x2daf73['or'](_0x3946('0x2b'),'%'+_0x2f3d2c+'%');_0x2daf73['or'](_0x3946('0x2c'),'%'+_0x2f3d2c+'%');_0x2daf73['or'](_0x3946('0x2a'),'%'+_0x2f3d2c+'%');}}}return _0x2daf73;}function parseAdvancedSearchFilter(_0x385b63,_0x33a96){var _0x5513c6=getSqlClauses();var _0xf9188e=as[_0x3946('0x2d')](_0x385b63);var _0x362e73=_0xf9188e[_0x3946('0x2e')];for(var _0x27f134=0x0;_0x27f134<_0xf9188e[_0x3946('0x2f')]['length'];_0x27f134++){var _0x54337b=_0xf9188e[_0x3946('0x2f')][_0x27f134];var _0x3681b9='c';var _0x201a5d=_['find'](_0x33a96,[_0x3946('0x30'),_0x54337b[_0x3946('0x1c')]]);if(_0x201a5d){if(_0x54337b[_0x3946('0x1c')]===_0x3946('0x31')||_0x201a5d[_0x3946('0x32')]===_0x3946('0x33')){_0x54337b['castTo']=_0x3946('0x34');}var _0x2d2195=as['buildExpression'](_0x3681b9,_0x201a5d['type'],_0x54337b);_0x5513c6[_0x3946('0x35')][_0x362e73](_0x2d2195['text'],_0x2d2195[_0x3946('0x36')][_0x3946('0x37')],_0x2d2195['value'][_0x3946('0x38')]);}else{if(_0x54337b[_0x3946('0x1c')]===_0x3946('0x39')){var _0x516392=_0x54337b[_0x3946('0x36')]['split'](',')['map'](function(_0x5de88f){return Number(_0x5de88f);});var _0x23eb2e=parseTagParameter(_0x516392);_0x5513c6[_0x3946('0x3a')][_0x3946('0x3b')][_0x3946('0x3c')](_0x23eb2e);_0x5513c6[_0x3946('0x3a')][_0x3946('0x3d')]=_0x516392;}else if(_0x54337b['field']===_0x3946('0x3e')){_0x5513c6[_0x3946('0x3f')][_0x3946('0x3b')][_0x3946('0x3c')](_0x3946('0x40'),_0x54337b[_0x3946('0x36')]);_0x5513c6['user']['skip']=!![];}}}return _0x5513c6;}function parseModelFields(_0x16de45,_0x50bdef){var _0x386478=squel[_0x3946('0x1d')]();var _0x18e526=_(_0x16de45)['keys']()[_0x3946('0x41')](function(_0x5bff2a){return _[_0x3946('0x42')](_0x50bdef,[_0x3946('0x30'),_0x5bff2a])?_0x5bff2a:undefined;})['compact']()['value']();if(_0x16de45['Contact']){_0x18e526[_0x3946('0x43')](_0x3946('0x44'));}if(_0x16de45[_0x3946('0x3e')]){_0x18e526['push'](_0x3946('0x3e'));}if(_0x18e526[_0x3946('0x45')]>0x0){_0x18e526[_0x3946('0x1b')](function(_0xcb4b03){if(_0xcb4b03==='ListId'){_0x386478['and'](_0x3946('0x46'),[][_0x3946('0x47')](_0x16de45[_0xcb4b03]));}else if(_0xcb4b03==='Contact'){var _0x408cf1='%'+_0x16de45[_0xcb4b03]+'%';_0x386478[_0x3946('0x3c')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x408cf1);}else if(_0xcb4b03===_0x3946('0x3e')){_0x386478[_0x3946('0x3c')]('uc.UserId\x20=\x20?',_0x16de45[_0xcb4b03]);}else{_0x386478[_0x3946('0x3c')]('c.'+_0xcb4b03+_0x3946('0x48'),_0x16de45[_0xcb4b03]);}});}return _0x386478;}function parseQueryParameters(_0x3f5080,_0x164ba0){var _0x52fa5b=getSqlClauses();return Promise[_0x3946('0x49')]()[_0x3946('0x4a')](function(){return parseModelFields(_0x3f5080,_0x164ba0);})[_0x3946('0x4a')](function(_0x1a34ed){_0x52fa5b[_0x3946('0x4b')][_0x3946('0x3c')](_0x1a34ed);return parseTagParameter(_0x3f5080[_0x3946('0x4c')]);})[_0x3946('0x4a')](function(_0x25e2b5){_0x52fa5b['tags'][_0x3946('0x3b')][_0x3946('0x3c')](_0x25e2b5);return parseSearchFilter(_0x3f5080['filter']);})['then'](function(_0x2f6606){_0x52fa5b[_0x3946('0x4d')]=_0x2f6606;return _0x52fa5b;});}function checkListsRestrictions(_0x599fd9,_0x408d62,_0x3c1b82){var _0x2570af=squel[_0x3946('0x1d')]();return Promise[_0x3946('0x49')]()['then'](function(){if(_0x408d62[_0x3946('0x6')]&&_0x599fd9[_0x3946('0x4')]===_0x3946('0x5')&&!_0x3c1b82){return _0x599fd9['getLists']({'attributes':['id'],'raw':!![]});}})[_0x3946('0x4a')](function(_0x6b1960){if(_0x6b1960){if(_0x6b1960[_0x3946('0x45')]===0x0){_0x2570af[_0x3946('0x3c')]('c.ListId\x20IS\x20NULL');}else{_0x2570af[_0x3946('0x3c')](_0x3946('0x46'),_[_0x3946('0x41')](_0x6b1960,'id'));}}})['then'](function(){return _0x2570af;});}function buildContactsQuery(_0x3542be,_0x3d6e9f,_0x538c2d,_0xdd9743,_0x1470c5,_0x1fcc0e){if(_0x3d6e9f){_0x3d6e9f=_0x538c2d[_0x3946('0x4e')];}_0x3542be=addFieldsToQuery(_0x3542be,_0x3d6e9f,_0xdd9743,_0x1fcc0e,!![]);var _0x534124=squel[_0x3946('0x9')]();_0x534124=addFieldsToQuery(_0x534124,_0x3d6e9f,_0xdd9743,_0x1fcc0e,![]);if(_0xdd9743||_0x1fcc0e){_0x3542be=applyJoinClauses(_0x3542be,!![]);_0x3542be[_0x3946('0x4f')]('c.id');if(_0x538c2d[_0x3946('0x50')]){_0x534124[_0x3946('0x50')](_0x538c2d[_0x3946('0x50')]);}if(_0x538c2d[_0x3946('0x51')]){_0x534124['offset'](_0x538c2d[_0x3946('0x51')]);}}else{_0x534124=applyJoinClauses(_0x534124,![]);_0x534124[_0x3946('0x4f')](_0x3946('0x52'));if(_0x538c2d[_0x3946('0x50')]){_0x3542be['limit'](_0x538c2d[_0x3946('0x50')]);}if(_0x538c2d[_0x3946('0x51')]){_0x3542be[_0x3946('0x51')](_0x538c2d[_0x3946('0x51')]);}}_0x534124[_0x3946('0x53')](_0x1470c5);if(_0x538c2d['order']){_0x538c2d[_0x3946('0x54')][_0x3946('0x1b')](function(_0x23b2de){_0x3542be['order']('c.'+_0x23b2de[0x0],_0x23b2de[0x1]===_0x3946('0x55')?![]:!![]);_0x534124[_0x3946('0x54')]('subqry.'+_0x23b2de[0x0],_0x23b2de[0x1]===_0x3946('0x55')?![]:!![]);});}_0x534124[_0x3946('0xa')](_0x3542be,_0x3946('0xd'));return _0x534124;}function getFilteredContacts(_0x98d053){var _0x3be57c=[];return db[_0x3946('0x39')]['findAll']({'attributes':['id',_0x3946('0x30'),'color'],'raw':!![]})['then'](function(_0x3fbd9d){_0x3be57c=_[_0x3946('0x56')](_0x3fbd9d,'id');var _0x45013a={'type':db['Sequelize'][_0x3946('0x57')][_0x3946('0x58')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x3946('0x59')][_0x3946('0x5a')](_0x98d053[_0x3946('0x5b')](),_0x45013a);})[_0x3946('0x4a')](function(_0x5d17f8){_0x5d17f8['forEach'](function(_0x3dce0f){if(_0x3dce0f[_0x3946('0x19')]){_0x3dce0f['Tags']=[];_0x3dce0f[_0x3946('0x19')]['split'](',')['forEach'](function(_0x46c271){_0x3dce0f[_0x3946('0x5c')][_0x3946('0x43')](_0x3be57c[_0x46c271]);});}delete _0x3dce0f['TagIds'];});return _0x5d17f8;});}function countFilteredContacts(_0x31188f,_0x455899){var _0x175cf4=_0x31188f[_0x3946('0x5d')]();_0x175cf4['field'](_0x3946('0x5e'));_0x175cf4=applyJoinClauses(_0x175cf4,!![]);_0x31188f[_0x3946('0x4f')]('c.id');var _0x69f797=utils[_0x3946('0x1e')](_0x455899);if(!_['isEmpty'](_0x69f797)){_0x175cf4[_0x3946('0x5f')](_0x3946('0x60'),_0x69f797);}var _0x341c26={'type':db[_0x3946('0x61')][_0x3946('0x57')][_0x3946('0x58')],'raw':!![]};return db['sequelize'][_0x3946('0x5a')](_0x175cf4[_0x3946('0x5b')](),_0x341c26)[_0x3946('0x4a')](function(_0x27c607){return _0x27c607[0x0][_0x3946('0x5e')];});}module[_0x3946('0x62')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e55195e..2fbdffa 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 _0xd8a4=['final','binary','write','close','unlink','decryptFile','createWriteStream','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','algorithm','encrypt','join','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','end'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0xd8a4,0x99));var _0x4d8a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd8a4[_0x2dafbe];return _0x58a45a;};'use strict';var crypto=require(_0x4d8a('0x0'));var fs=require('fs');var BPromise=require(_0x4d8a('0x1'));var _=require(_0x4d8a('0x2'));var config=require('../../config/environment');var logger=require(_0x4d8a('0x3'))(_0x4d8a('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4d8a('0x5')][_0x4d8a('0x6')],'algorithm':_0x4d8a('0x7')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config['encrypt'][_0x4d8a('0x8')]){var isSupported=isAlgorithmSupported(config[_0x4d8a('0x9')]['algorithm']);if(isSupported){fileOptions[_0x4d8a('0x8')]=config[_0x4d8a('0x9')][_0x4d8a('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4d8a('0xa')](',\x20');logger['error'](config['encrypt'][_0x4d8a('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x5a4bac){return AES_SUPPORTED_RX[_0x4d8a('0xb')](_0x5a4bac);}function getSupportedCiphers(){return crypto[_0x4d8a('0xc')]()[_0x4d8a('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x5169ec){return getSupportedCiphers()[_0x4d8a('0xe')](_0x5169ec)>-0x1;}function combineOptions(_0x425bdb){var _0x50905e={};for(var _0x4a22d4 in fileOptions){if(fileOptions[_0x4d8a('0xf')](_0x4a22d4)){_0x50905e[_0x4a22d4]=fileOptions[_0x4a22d4];}}if(_0x425bdb){for(var _0x17156a in _0x425bdb){if(_0x425bdb[_0x4d8a('0xf')](_0x17156a)){_0x50905e[_0x17156a]=_0x425bdb[_0x17156a];}}}return _0x50905e;}exports[_0x4d8a('0x10')]=function(_0x1b5fd3,_0x535ff9,_0x12b9b2,_0x31b033){return new BPromise(function(_0x42803b,_0x127e83){_0x31b033=combineOptions(_0x31b033);var _0x2ded65=new Buffer(_0x12b9b2);var _0x20dac1=fs[_0x4d8a('0x11')](_0x1b5fd3);var _0x5d8ef6=fs['createWriteStream'](_0x535ff9);var _0x4f2790=crypto[_0x4d8a('0x12')](_0x31b033[_0x4d8a('0x8')],_0x2ded65);_0x20dac1['on'](_0x4d8a('0x13'),function(_0x1c807a){var _0x5bb090=new Buffer(_0x4f2790[_0x4d8a('0x14')](_0x1c807a),'binary');_0x5d8ef6['write'](_0x5bb090);});_0x20dac1['on'](_0x4d8a('0x15'),function(){try{var _0x23dda8=new Buffer(_0x4f2790[_0x4d8a('0x16')]('binary'),_0x4d8a('0x17'));_0x5d8ef6[_0x4d8a('0x18')](_0x23dda8);_0x5d8ef6[_0x4d8a('0x15')]();_0x5d8ef6['on'](_0x4d8a('0x19'),function(){return _0x42803b(_0x535ff9);});}catch(_0x27a8cb){fs[_0x4d8a('0x1a')](_0x535ff9);return _0x127e83(_0x27a8cb);}});});};exports[_0x4d8a('0x1b')]=function(_0x5d5f3e,_0x58a4bc,_0x569544,_0x9c08c2){return new BPromise(function(_0x5f0be9,_0x4c54c2){_0x9c08c2=combineOptions(_0x9c08c2);var _0x319ce5=new Buffer(_0x569544);var _0x1c34b0=fs[_0x4d8a('0x11')](_0x5d5f3e);var _0x151319=fs[_0x4d8a('0x1c')](_0x58a4bc);var _0x2e6a3b=crypto[_0x4d8a('0x1d')](_0x9c08c2['algorithm'],_0x319ce5);_0x1c34b0['on'](_0x4d8a('0x13'),function(_0x16c030){var _0x558479=new Buffer(_0x2e6a3b[_0x4d8a('0x14')](_0x16c030),_0x4d8a('0x17'));_0x151319[_0x4d8a('0x18')](_0x558479);});_0x1c34b0['on'](_0x4d8a('0x15'),function(){try{var _0x1c266a=new Buffer(_0x2e6a3b[_0x4d8a('0x16')](_0x4d8a('0x17')),_0x4d8a('0x17'));_0x151319['write'](_0x1c266a);_0x151319[_0x4d8a('0x15')]();_0x151319['on']('close',function(){return _0x5f0be9(_0x58a4bc);});}catch(_0x36b570){fs[_0x4d8a('0x1a')](_0x58a4bc);return _0x4c54c2(_0x36b570);}});});};exports[_0x4d8a('0x1e')]=function(_0x2b0ad0,_0x32d335,_0x59efb1){var _0x148b6e=_0x59efb1||stringOptions['algorithm'];var _0x46062a=_0x32d335||stringOptions[_0x4d8a('0x1f')];var _0x2418f2=crypto[_0x4d8a('0x12')](_0x148b6e,_0x46062a);var _0x4e9062=_0x2418f2[_0x4d8a('0x14')](_0x2b0ad0,_0x4d8a('0x20'),_0x4d8a('0x21'));_0x4e9062+=_0x2418f2['final'](_0x4d8a('0x21'));return _0x4e9062;};exports[_0x4d8a('0x22')]=function(_0x76c2c1,_0x10b626,_0x4fd43c){var _0x5bd68b=_0x4fd43c||stringOptions[_0x4d8a('0x8')];var _0x552b1f=_0x10b626||stringOptions['secret'];var _0x4db48c=crypto[_0x4d8a('0x1d')](_0x5bd68b,_0x552b1f);var _0x21c768=_0x4db48c[_0x4d8a('0x14')](_0x76c2c1,'base64','utf8');_0x21c768+=_0x4db48c['final']('utf8');return _0x21c768;}; \ No newline at end of file +var _0x3282=['app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','binary','end','final','write','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger'];(function(_0x500a96,_0x1280c8){var _0x36fb55=function(_0x1b4e7b){while(--_0x1b4e7b){_0x500a96['push'](_0x500a96['shift']());}};_0x36fb55(++_0x1280c8);}(_0x3282,0x17c));var _0x2328=function(_0x402565,_0x431efa){_0x402565=_0x402565-0x0;var _0x2ed987=_0x3282[_0x402565];return _0x2ed987;};'use strict';var crypto=require(_0x2328('0x0'));var fs=require('fs');var BPromise=require(_0x2328('0x1'));var _=require(_0x2328('0x2'));var config=require(_0x2328('0x3'));var logger=require(_0x2328('0x4'))(_0x2328('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2328('0x6')]['session'],'algorithm':_0x2328('0x7')};const fileOptions={'algorithm':_0x2328('0x8')};if(config['encrypt']&&config[_0x2328('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x2328('0x9')][_0x2328('0xa')]);if(isSupported){fileOptions[_0x2328('0xa')]=config[_0x2328('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2328('0xb')](',\x20');logger['error'](config[_0x2328('0x9')]['algorithm'],_0x2328('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x6a2a18){return AES_SUPPORTED_RX[_0x2328('0xd')](_0x6a2a18);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x2328('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x1bf8c3){return getSupportedCiphers()[_0x2328('0xf')](_0x1bf8c3)>-0x1;}function combineOptions(_0x1d3d7b){var _0x52c1f0={};for(var _0xcb255d in fileOptions){if(fileOptions[_0x2328('0x10')](_0xcb255d)){_0x52c1f0[_0xcb255d]=fileOptions[_0xcb255d];}}if(_0x1d3d7b){for(var _0x237a66 in _0x1d3d7b){if(_0x1d3d7b[_0x2328('0x10')](_0x237a66)){_0x52c1f0[_0x237a66]=_0x1d3d7b[_0x237a66];}}}return _0x52c1f0;}exports['encryptFile']=function(_0x1e5012,_0xb8d561,_0x4785f8,_0x5f3138){return new BPromise(function(_0x702f55,_0x1c5817){_0x5f3138=combineOptions(_0x5f3138);var _0x3ebb2c=new Buffer(_0x4785f8);var _0x25d60d=fs[_0x2328('0x11')](_0x1e5012);var _0x48adc8=fs[_0x2328('0x12')](_0xb8d561);var _0x20ac39=crypto[_0x2328('0x13')](_0x5f3138[_0x2328('0xa')],_0x3ebb2c);_0x25d60d['on'](_0x2328('0x14'),function(_0x56d711){var _0x63a54e=new Buffer(_0x20ac39[_0x2328('0x15')](_0x56d711),_0x2328('0x16'));_0x48adc8['write'](_0x63a54e);});_0x25d60d['on'](_0x2328('0x17'),function(){try{var _0x55cfbf=new Buffer(_0x20ac39[_0x2328('0x18')](_0x2328('0x16')),_0x2328('0x16'));_0x48adc8[_0x2328('0x19')](_0x55cfbf);_0x48adc8[_0x2328('0x17')]();_0x48adc8['on'](_0x2328('0x1a'),function(){return _0x702f55(_0xb8d561);});}catch(_0x1d2dde){fs[_0x2328('0x1b')](_0xb8d561);return _0x1c5817(_0x1d2dde);}});});};exports[_0x2328('0x1c')]=function(_0x4d4acc,_0x8ebd66,_0x4ee260,_0x3fc1df){return new BPromise(function(_0x1394e7,_0x251949){_0x3fc1df=combineOptions(_0x3fc1df);var _0x52626e=new Buffer(_0x4ee260);var _0x572120=fs[_0x2328('0x11')](_0x4d4acc);var _0x3f6f36=fs[_0x2328('0x12')](_0x8ebd66);var _0x186ad0=crypto[_0x2328('0x1d')](_0x3fc1df[_0x2328('0xa')],_0x52626e);_0x572120['on'](_0x2328('0x14'),function(_0x4e3b9b){var _0x96ef5e=new Buffer(_0x186ad0['update'](_0x4e3b9b),'binary');_0x3f6f36[_0x2328('0x19')](_0x96ef5e);});_0x572120['on'](_0x2328('0x17'),function(){try{var _0x11d6b0=new Buffer(_0x186ad0[_0x2328('0x18')](_0x2328('0x16')),_0x2328('0x16'));_0x3f6f36[_0x2328('0x19')](_0x11d6b0);_0x3f6f36[_0x2328('0x17')]();_0x3f6f36['on'](_0x2328('0x1a'),function(){return _0x1394e7(_0x8ebd66);});}catch(_0x4fff76){fs[_0x2328('0x1b')](_0x8ebd66);return _0x251949(_0x4fff76);}});});};exports[_0x2328('0x1e')]=function(_0x5c9e1b,_0x93eb7f,_0x4c6fd0){var _0x1059e6=_0x4c6fd0||stringOptions[_0x2328('0xa')];var _0x16de15=_0x93eb7f||stringOptions[_0x2328('0x1f')];var _0x3ad5a3=crypto[_0x2328('0x13')](_0x1059e6,_0x16de15);var _0x351f9f=_0x3ad5a3[_0x2328('0x15')](_0x5c9e1b,_0x2328('0x20'),_0x2328('0x21'));_0x351f9f+=_0x3ad5a3['final'](_0x2328('0x21'));return _0x351f9f;};exports[_0x2328('0x22')]=function(_0x4936c3,_0x52fb55,_0x6bbc1e){var _0x5b7fe3=_0x6bbc1e||stringOptions[_0x2328('0xa')];var _0x32ceb6=_0x52fb55||stringOptions[_0x2328('0x1f')];var _0x32a5ab=crypto[_0x2328('0x1d')](_0x5b7fe3,_0x32ceb6);var _0x573925=_0x32a5ab['update'](_0x4936c3,_0x2328('0x21'),'utf8');_0x573925+=_0x32a5ab[_0x2328('0x18')](_0x2328('0x20'));return _0x573925;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 82b53d8..7634034 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 _0xfb53=['argv','update','info','format','CSV','find','split','splitSizeCsv','then','sequelize','QueryTypes','SELECT','num','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip\x20finished','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','bluebird','rimraf','../../mysqldb','../../config/logger','analytics'];(function(_0x5bf8b5,_0x38ff2a){var _0x2991cd=function(_0x2f19a8){while(--_0x2f19a8){_0x5bf8b5['push'](_0x5bf8b5['shift']());}};_0x2991cd(++_0x38ff2a);}(_0xfb53,0xcf));var _0x3fb5=function(_0x12f1fc,_0x49ff81){_0x12f1fc=_0x12f1fc-0x0;var _0x9e308e=_0xfb53[_0x12f1fc];return _0x9e308e;};'use strict';var util=require(_0x3fb5('0x0'));var path=require(_0x3fb5('0x1'));var _=require(_0x3fb5('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x3fb5('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x3fb5('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x3fb5('0x5'))['dbH'];var logger=require(_0x3fb5('0x6'))(_0x3fb5('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3fb5('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x33b2c5,_0x39ec3a){var _0x37ba04={'status':_0x33b2c5};var _0x283831={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x39ec3a){_0x37ba04['savename']=_0x39ec3a;}return db['AnalyticExtractedReport'][_0x3fb5('0x9')](_0x37ba04,_0x283831);}function main(){var _0xe219dc=0x1388;var _0x151d3b;logger[_0x3fb5('0xa')](util[_0x3fb5('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3fb5('0xc')));return db['Setting'][_0x3fb5('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3fb5('0xe'),_0x3fb5('0xf')]})['then'](function(_0x1cac24){if(_0x1cac24){_0x151d3b=_0x1cac24;_0xe219dc=_0x151d3b[_0x3fb5('0xf')]||0x1388;}})[_0x3fb5('0x10')](function(){return dbH[_0x3fb5('0x11')]['query'](util[_0x3fb5('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3fb5('0x11')][_0x3fb5('0x12')][_0x3fb5('0x13')]});})['then'](function(_0x16443d){if(!_0x16443d[0x0][_0x3fb5('0x14')]){return analyticExtractedReport('Empty');}var _0x4fbeb7=[];var _0x18b81a=0x0;if(_0x151d3b['split']){if(_0x16443d&&_0x16443d[_0x3fb5('0x15')]){var _0x517b6c=_['range'](_0x16443d[0x0][_0x3fb5('0x14')]/_0xe219dc);var _0x102092=Number[_0x3fb5('0x16')](_0x16443d[0x0][_0x3fb5('0x14')]/_0xe219dc)?_0x16443d[0x0][_0x3fb5('0x14')]%_0xe219dc:0x0;_0x517b6c[_0x3fb5('0x17')](function(_0x5eae03){if(_0x5eae03>0x0){_0x18b81a+=_0xe219dc;}_0x4fbeb7['push'](dbH[_0x3fb5('0x11')][_0x3fb5('0x18')](util[_0x3fb5('0xb')](_0x3fb5('0x19'),QUERY,_0xe219dc,_0x18b81a),{'type':dbH['sequelize'][_0x3fb5('0x12')][_0x3fb5('0x13')]}));});if(_0x102092>0x0){_0x18b81a+=_0xe219dc;_0x4fbeb7['push'](dbH[_0x3fb5('0x11')][_0x3fb5('0x18')](util[_0x3fb5('0xb')](_0x3fb5('0x19'),QUERY,_0x102092,_0x18b81a),{'type':dbH[_0x3fb5('0x11')][_0x3fb5('0x12')][_0x3fb5('0x13')]}));}}}else{_0x4fbeb7[_0x3fb5('0x1a')](dbH[_0x3fb5('0x11')][_0x3fb5('0x18')](QUERY,{'type':dbH[_0x3fb5('0x11')][_0x3fb5('0x12')][_0x3fb5('0x13')]}));}var _0xed8c44=path[_0x3fb5('0x1b')](PATH);var _0x405b9b=path[_0x3fb5('0x1c')](PATH,'.csv');var _0x4a3f75=_0x151d3b[_0x3fb5('0xe')]&&_0x4fbeb7['length']>0x1;var _0x5ce569=[];if(!fs[_0x3fb5('0x1d')](path[_0x3fb5('0x1e')](_0xed8c44,_0x405b9b))&&_0x4a3f75){fs[_0x3fb5('0x1f')](path[_0x3fb5('0x1e')](_0xed8c44,_0x405b9b));}return BPromise[_0x3fb5('0x20')](_0x4fbeb7,function(_0x336fc1){_0x5ce569[_0x3fb5('0x1a')](_0x336fc1);})[_0x3fb5('0x10')](function(){for(var _0x39ac8d=0x0;_0x39ac8d<_0x5ce569[_0x3fb5('0x15')];_0x39ac8d+=0x1){var _0x3b5a16;var _0x2e4df8=_0x5ce569[_0x39ac8d];if(_0x4a3f75){_0x3b5a16=path['join'](_0xed8c44,_0x405b9b,util['format'](_0x3fb5('0x21'),_0x405b9b,_0x39ac8d,_0x3fb5('0x22')));}else{_0x3b5a16=path['join'](_0xed8c44,util[_0x3fb5('0xb')]('%s.%s',_0x405b9b,_0x3fb5('0x22')));}fs['writeFileSync'](_0x3b5a16,csv(_0x2e4df8));}})['then'](function(){if(_0x4a3f75){return new Promise(function(_0x451240){zipdir(path['join'](_0xed8c44,_0x405b9b),{'saveTo':path[_0x3fb5('0x1e')](_0xed8c44,util[_0x3fb5('0xb')](_0x3fb5('0x23'),_0x405b9b,'zip'))},function(_0x5d9da9,_0x3abdd7){rimraf(path[_0x3fb5('0x1e')](_0xed8c44,_0x405b9b),function(){});_0x451240(_0x3fb5('0x24'));});});}})[_0x3fb5('0x10')](function(){logger[_0x3fb5('0xa')](util[_0x3fb5('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3fb5('0xc')));return analyticExtractedReport('Completed',_0x4a3f75?util[_0x3fb5('0xb')](_0x3fb5('0x23'),_0x405b9b,_0x4a3f75?_0x3fb5('0x25'):'csv'):null);});})[_0x3fb5('0x26')](function(_0xe15701){logger[_0x3fb5('0xa')](util[_0x3fb5('0xb')](_0x3fb5('0x27'),EXTRACTED_REPORT_ID,_0x3fb5('0xc')),util[_0x3fb5('0x28')](_0xe15701,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3fb5('0x29'));})['finally'](function(){process[_0x3fb5('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4ffe=['writeFileSync','zip','zip\x20finished','info','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','mkdirSync','join','each','csv','%s.%s'];(function(_0x44238d,_0x1aab34){var _0x429b71=function(_0x1d4ca0){while(--_0x1d4ca0){_0x44238d['push'](_0x44238d['shift']());}};_0x429b71(++_0x1aab34);}(_0x4ffe,0xd2));var _0xe4ff=function(_0x460264,_0x51ddff){_0x460264=_0x460264-0x0;var _0x2d75a1=_0x4ffe[_0x460264];return _0x2d75a1;};'use strict';var util=require(_0xe4ff('0x0'));var path=require(_0xe4ff('0x1'));var _=require(_0xe4ff('0x2'));var csv=require(_0xe4ff('0x3'));var fs=require('fs');var BPromise=require(_0xe4ff('0x4'));var zipdir=require(_0xe4ff('0x5'));var rimraf=require(_0xe4ff('0x6'));var db=require(_0xe4ff('0x7'))['db'];var dbH=require(_0xe4ff('0x7'))[_0xe4ff('0x8')];var logger=require('../../config/logger')(_0xe4ff('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe4ff('0xa')][0x2]);var QUERY=process[_0xe4ff('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x42b3b5,_0x39fb6b){var _0x1d72d2={'status':_0x42b3b5};var _0x45845a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x39fb6b){_0x1d72d2[_0xe4ff('0xb')]=_0x39fb6b;}return db[_0xe4ff('0xc')]['update'](_0x1d72d2,_0x45845a);}function main(){var _0x42275d=0x1388;var _0x5531a8;logger['info'](util[_0xe4ff('0xd')](_0xe4ff('0xe'),EXTRACTED_REPORT_ID,_0xe4ff('0xf')));return db['Setting'][_0xe4ff('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe4ff('0x11'),_0xe4ff('0x12')]})[_0xe4ff('0x13')](function(_0x483d0c){if(_0x483d0c){_0x5531a8=_0x483d0c;_0x42275d=_0x5531a8[_0xe4ff('0x12')]||0x1388;}})['then'](function(){return dbH[_0xe4ff('0x14')]['query'](util[_0xe4ff('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe4ff('0x14')][_0xe4ff('0x15')][_0xe4ff('0x16')]});})[_0xe4ff('0x13')](function(_0x4d280c){if(!_0x4d280c[0x0]['num']){return analyticExtractedReport(_0xe4ff('0x17'));}var _0x5ee0c9=[];var _0x4c7d4c=0x0;if(_0x5531a8[_0xe4ff('0x11')]){if(_0x4d280c&&_0x4d280c[_0xe4ff('0x18')]){var _0x15480e=_[_0xe4ff('0x19')](_0x4d280c[0x0][_0xe4ff('0x1a')]/_0x42275d);var _0xe5f0ec=Number[_0xe4ff('0x1b')](_0x4d280c[0x0][_0xe4ff('0x1a')]/_0x42275d)?_0x4d280c[0x0][_0xe4ff('0x1a')]%_0x42275d:0x0;_0x15480e[_0xe4ff('0x1c')](function(_0x33b5ac){if(_0x33b5ac>0x0){_0x4c7d4c+=_0x42275d;}_0x5ee0c9[_0xe4ff('0x1d')](dbH[_0xe4ff('0x14')][_0xe4ff('0x1e')](util[_0xe4ff('0xd')](_0xe4ff('0x1f'),QUERY,_0x42275d,_0x4c7d4c),{'type':dbH[_0xe4ff('0x14')]['QueryTypes'][_0xe4ff('0x16')]}));});if(_0xe5f0ec>0x0){_0x4c7d4c+=_0x42275d;_0x5ee0c9[_0xe4ff('0x1d')](dbH[_0xe4ff('0x14')][_0xe4ff('0x1e')](util['format'](_0xe4ff('0x1f'),QUERY,_0xe5f0ec,_0x4c7d4c),{'type':dbH[_0xe4ff('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x5ee0c9['push'](dbH[_0xe4ff('0x14')]['query'](QUERY,{'type':dbH[_0xe4ff('0x14')][_0xe4ff('0x15')][_0xe4ff('0x16')]}));}var _0x448419=path[_0xe4ff('0x20')](PATH);var _0x126994=path[_0xe4ff('0x21')](PATH,_0xe4ff('0x22'));var _0x303601=_0x5531a8[_0xe4ff('0x11')]&&_0x5ee0c9[_0xe4ff('0x18')]>0x1;var _0x536b34=[];if(!fs['existsSync'](path['join'](_0x448419,_0x126994))&&_0x303601){fs[_0xe4ff('0x23')](path[_0xe4ff('0x24')](_0x448419,_0x126994));}return BPromise[_0xe4ff('0x25')](_0x5ee0c9,function(_0x32f5b7){_0x536b34[_0xe4ff('0x1d')](_0x32f5b7);})[_0xe4ff('0x13')](function(){for(var _0x4b655f=0x0;_0x4b655f<_0x536b34[_0xe4ff('0x18')];_0x4b655f+=0x1){var _0x451ced;var _0x34dca0=_0x536b34[_0x4b655f];if(_0x303601){_0x451ced=path[_0xe4ff('0x24')](_0x448419,_0x126994,util[_0xe4ff('0xd')]('%s%d.%s',_0x126994,_0x4b655f,_0xe4ff('0x26')));}else{_0x451ced=path[_0xe4ff('0x24')](_0x448419,util[_0xe4ff('0xd')](_0xe4ff('0x27'),_0x126994,'csv'));}fs[_0xe4ff('0x28')](_0x451ced,csv(_0x34dca0));}})[_0xe4ff('0x13')](function(){if(_0x303601){return new Promise(function(_0x2bb8a1){zipdir(path['join'](_0x448419,_0x126994),{'saveTo':path['join'](_0x448419,util[_0xe4ff('0xd')](_0xe4ff('0x27'),_0x126994,_0xe4ff('0x29')))},function(_0x259c06,_0x4f23bd){rimraf(path[_0xe4ff('0x24')](_0x448419,_0x126994),function(){});_0x2bb8a1(_0xe4ff('0x2a'));});});}})[_0xe4ff('0x13')](function(){logger[_0xe4ff('0x2b')](util[_0xe4ff('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe4ff('0xf')));return analyticExtractedReport(_0xe4ff('0x2c'),_0x303601?util['format'](_0xe4ff('0x27'),_0x126994,_0x303601?'zip':'csv'):null);});})['catch'](function(_0xde7b59){logger[_0xe4ff('0x2b')](util[_0xe4ff('0xd')](_0xe4ff('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util[_0xe4ff('0x2e')](_0xde7b59,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe4ff('0x2f'));})[_0xe4ff('0x30')](function(){process[_0xe4ff('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7901279..d92b41f 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 _0x2380=['%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','error','end','createPdfFromHTML','path','lodash','moment','zip-dir','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','length','pageBreak','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','split','then','splitSizePdf','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all'];(function(_0x220bc4,_0x2b0008){var _0x3f41ad=function(_0x5f57b6){while(--_0x5f57b6){_0x220bc4['push'](_0x220bc4['shift']());}};_0x3f41ad(++_0x2b0008);}(_0x2380,0xce));var _0x0238=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x2380[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x0238('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x0238('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x0238('0x2'));var rimraf=require('rimraf');var JSDOM=require(_0x0238('0x3'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x0238('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x0238('0x5'))[_0x0238('0x6')];var logger=require(_0x0238('0x7'))(_0x0238('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0238('0x9')][0x3];var PATH=process[_0x0238('0x9')][0x4];var NAME=process[_0x0238('0x9')][0x5];var FORMAT=_0x0238('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xb78593,_0x11c708){var _0x383a37={'status':_0xb78593};var _0x53f8f3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11c708){_0x383a37[_0x0238('0xb')]=_0x11c708;}return db[_0x0238('0xc')][_0x0238('0xd')](_0x383a37,_0x53f8f3);}function getHeaders(_0x15fc29){return _[_0x0238('0xe')](_0x15fc29,function(_0x2d26f2){return{'text':_0x2d26f2,'style':_0x0238('0xf')};});}function getRows(_0x36dabf,_0x2cc9e3){return _[_0x0238('0xe')](_0x2cc9e3,function(_0x3950f5){return _(_0x3950f5)[_0x0238('0x10')](_0x36dabf)[_0x0238('0xe')](function(_0x256733){return _0x256733?_[_0x0238('0x11')](_0x256733):'';})[_0x0238('0x12')]();});}function createTable(_0x2ef300,_0x329842){var _0x1b977a={'widths':_[_0x0238('0x13')](Array(_0x2ef300['length']),0x91),'heights':function(_0x43471c){return _0x43471c===0x0?_0x0238('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xa19e2=getHeaders(_0x2ef300);_0x1b977a[_0x0238('0x15')][_0x0238('0x16')](_0xa19e2);var _0x3b8042=getRows(_0x2ef300,_0x329842);_0x1b977a['body']=_0x1b977a['body'][_0x0238('0x17')](_0x3b8042);return _0x1b977a;}function createTables(_0x4eca6c){var _0x4b82d5=[];var _0xee8e46=_[_0x0238('0x18')](Object[_0x0238('0x19')](_0x4eca6c[0x0]),0x5);_0xee8e46['forEach'](function(_0x4f6532){_0x4b82d5['push'](createTable(_0x4f6532,_0x4eca6c));});return _0x4b82d5;}function getPDFDocDefinition(_0xb9d01a){var _0x45a6dd=util[_0x0238('0x1a')](_0x0238('0x1b'),NAME,EXTRACTED_REPORT[_0x0238('0x1c')],moment(EXTRACTED_REPORT[_0x0238('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x0238('0x1a')](FORMAT));var _0x551d40=[];for(var _0x509b33=0x0;_0x509b33<_0xb9d01a[_0x0238('0x1e')];_0x509b33++){var _0x58bc6f=[];if(_0x509b33===0x0){_0x58bc6f[_0x0238('0x16')]({'text':_0x45a6dd,'style':'header'});}var _0x12ae58={'table':_0xb9d01a[_0x509b33]};if(_0x509b33>0x0){_0x12ae58[_0x0238('0x1f')]='before';_0x12ae58['margin']=[0x0,0x46,0x0,0x0];}_0x58bc6f['push'](_0x12ae58);_0x551d40[_0x0238('0x16')](_0x58bc6f);}return{'pageSize':'A4','pageOrientation':_0x0238('0x20'),'content':_0x551d40,'footer':function(_0x1178c7,_0x21e69a){return{'text':_0x1178c7[_0x0238('0x11')]()+_0x0238('0x21')+_0x21e69a,'style':_0x0238('0x22')};},'defaultStyle':{'font':_0x0238('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x0238('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x71dcf7){var _0x2aa6c0=0x1388;var _0x4917fa;if(!_0x71dcf7[0x0][_0x0238('0x25')]){return analyticExtractedReport(_0x0238('0x26'));}return db[_0x0238('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0238('0x28'),'splitSizePdf']})[_0x0238('0x29')](function(_0x52208c){if(_0x52208c){_0x4917fa=_0x52208c;_0x2aa6c0=_0x4917fa[_0x0238('0x2a')]||0x3e8;}})[_0x0238('0x29')](function(){var _0x3e88cc=[];var _0x334fac=0x0;if(_0x4917fa[_0x0238('0x28')]){if(_0x71dcf7&&_0x71dcf7['length']){var _0x59942d=_[_0x0238('0x2b')](_0x71dcf7[0x0][_0x0238('0x25')]/_0x2aa6c0);var _0x290485=Number[_0x0238('0x2c')](_0x71dcf7[0x0][_0x0238('0x25')]/_0x2aa6c0)?_0x71dcf7[0x0][_0x0238('0x25')]%_0x2aa6c0:0x0;_0x59942d[_0x0238('0x2d')](function(_0x592eac){if(_0x592eac>0x0){_0x334fac+=_0x2aa6c0;}_0x3e88cc['push'](dbH['sequelize'][_0x0238('0x2e')](util['format'](_0x0238('0x2f'),QUERY,_0x2aa6c0,_0x334fac),{'type':dbH[_0x0238('0x30')]['QueryTypes'][_0x0238('0x31')]}));});if(_0x290485>0x0){_0x334fac+=_0x2aa6c0;_0x3e88cc['push'](dbH['sequelize'][_0x0238('0x2e')](util['format'](_0x0238('0x2f'),QUERY,_0x290485,_0x334fac),{'type':dbH[_0x0238('0x30')]['QueryTypes'][_0x0238('0x31')]}));}}}else{_0x3e88cc[_0x0238('0x16')](dbH[_0x0238('0x30')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x0238('0x31')]}));}var _0x138de1=path[_0x0238('0x32')](PATH);var _0x51be9a=path[_0x0238('0x33')](PATH,_0x0238('0x34'));var _0x4e4f0c=_0x4917fa['split']&&_0x3e88cc[_0x0238('0x1e')]>0x1;var _0x103977=[];if(!fs[_0x0238('0x35')](path[_0x0238('0x36')](_0x138de1,_0x51be9a))&&_0x4e4f0c){fs['mkdirSync'](path['join'](_0x138de1,_0x51be9a));}return BPromise[_0x0238('0x37')](_0x3e88cc,function(_0x56e740){_0x103977[_0x0238('0x16')](_0x56e740);})[_0x0238('0x29')](function(){var _0x25647b=[];for(var _0x565093=0x0;_0x565093<_0x103977['length'];_0x565093+=0x1){var _0x412c69=_0x103977[_0x565093];var _0x1a8f2e=createTables(_[_0x0238('0x38')](_0x412c69));var _0x413772;var _0x13c2c0=getPDFDocDefinition(_0x1a8f2e);var _0x1efe52=getPDFPrinter();var _0x287fae=_0x1efe52[_0x0238('0x39')](_0x13c2c0);if(_0x4e4f0c){_0x413772=path['join'](_0x138de1,_0x51be9a,util[_0x0238('0x1a')](_0x0238('0x3a'),_0x51be9a,_0x565093,_0x0238('0x3b')));}else{_0x413772=path['join'](_0x138de1,util[_0x0238('0x1a')]('%s.%s',_0x51be9a,_0x0238('0x3b')));}_0x25647b[_0x0238('0x16')](writePDFDocument(_0x287fae,_0x413772));}return Promise[_0x0238('0x3c')](_0x25647b);})['then'](function(){if(_0x4e4f0c){return new Promise(function(_0x398a4e){zipdir(path[_0x0238('0x36')](_0x138de1,_0x51be9a),{'saveTo':path[_0x0238('0x36')](_0x138de1,util[_0x0238('0x1a')](_0x0238('0x3d'),_0x51be9a,_0x0238('0x3e')))},function(){rimraf(path[_0x0238('0x36')](_0x138de1,_0x51be9a),function(){});_0x398a4e(_0x0238('0x3f'));});});}})[_0x0238('0x29')](function(){if(!_0x4e4f0c)return;rimraf(path[_0x0238('0x36')](_0x138de1,_0x51be9a),function(){});})['then'](function(){logger[_0x0238('0x40')](util[_0x0238('0x1a')](_0x0238('0x41'),EXTRACTED_REPORT_ID,_0x0238('0x42')));return analyticExtractedReport(_0x0238('0x43'),_0x4e4f0c?util[_0x0238('0x1a')](_0x0238('0x3d'),_0x51be9a,_0x4e4f0c?_0x0238('0x3e'):_0x0238('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x0238('0x40')](util[_0x0238('0x1a')](_0x0238('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x0238('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0238('0x29')](function(_0x44a345){EXTRACTED_REPORT=_0x44a345;return dbH[_0x0238('0x30')][_0x0238('0x2e')](util[_0x0238('0x1a')](_0x0238('0x45'),QUERY),{'type':dbH[_0x0238('0x30')]['QueryTypes'][_0x0238('0x31')]});})[_0x0238('0x29')](extractReport)[_0x0238('0x46')](function(_0xea47cc){logger[_0x0238('0x40')](util['format'](_0x0238('0x47'),EXTRACTED_REPORT_ID,'PDF'),util[_0x0238('0x48')](_0xea47cc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0238('0x49'));})['finally'](function(){process[_0x0238('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x44c880=new PdfPrinter({'Arial':{'normal':__dirname+_0x0238('0x4b'),'bold':__dirname+_0x0238('0x4c'),'italics':__dirname+_0x0238('0x4d'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x44c880;}function getPDFDocDefinitionFromHTML(_0x3f2e8b,_0x4c96b2){var _0x5cf2d4=util[_0x0238('0x1a')](_0x0238('0x4e'),_0x4c96b2[_0x0238('0x4f')],_0x4c96b2[_0x0238('0x50')]);var _0x4b3967=moment()['format'](_0x0238('0x51'))[_0x0238('0x11')]();var _0x506cfc=htmlToPdfmake(_0x3f2e8b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x506cfc],'defaultStyle':{'font':_0x0238('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x0238('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x0238('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x0238('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x10443f,_0x55b9d7){return[{'text':util[_0x0238('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x5cf2d4,_0x10443f,_0x55b9d7,_0x4b3967),'style':_0x0238('0x22')}];}};}function writePDFDocument(_0xff4d46,_0x11e3b4){return new Promise(function(_0x2468ff,_0x3a3ef5){var _0x4fbc91=_0xff4d46[_0x0238('0x53')](fs[_0x0238('0x54')](_0x11e3b4));_0x4fbc91['on']('finish',function(){_0x2468ff('finish');});_0x4fbc91['on'](_0x0238('0x55'),function(_0x3effe5){_0x3a3ef5(_0x3effe5);});_0xff4d46[_0x0238('0x56')]();});}exports[_0x0238('0x57')]=function(_0x1ae4e0,_0x58d96b){var _0xcd8ba1=getPDFPrinter();var _0x5c8e13=getPDFDocDefinitionFromHTML(_0x1ae4e0,_0x58d96b);var _0x543cbf=_0xcd8ba1[_0x0238('0x39')](_0x5c8e13);return writePDFDocument(_0x543cbf,_0x58d96b[_0x0238('0x58')])['catch'](function(_0x5d0aed){throw _0x5d0aed;});}; \ No newline at end of file +var _0x2f52=['zip\x20finished','info','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','Empty','Setting','find','split','splitSizePdf','then','range','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip'];(function(_0x27f38c,_0x78024e){var _0x373579=function(_0x412df7){while(--_0x412df7){_0x27f38c['push'](_0x27f38c['shift']());}};_0x373579(++_0x78024e);}(_0x2f52,0x1ef));var _0x22f5=function(_0x52af16,_0x59cb6f){_0x52af16=_0x52af16-0x0;var _0x7e642c=_0x2f52[_0x52af16];return _0x7e642c;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x22f5('0x0'));var path=require(_0x22f5('0x1'));var moment=require(_0x22f5('0x2'));var htmlToPdfmake=require(_0x22f5('0x3'));var PdfPrinter=require(_0x22f5('0x4'));var zipdir=require(_0x22f5('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x22f5('0x6'))[_0x22f5('0x7')];var window=new JSDOM('')[_0x22f5('0x8')];var BPromise=require(_0x22f5('0x9'));var db=require(_0x22f5('0xa'))['db'];var dbH=require(_0x22f5('0xa'))[_0x22f5('0xb')];var logger=require('../../config/logger')(_0x22f5('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x22f5('0xd')][0x3];var PATH=process[_0x22f5('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x22f5('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x359bd1,_0x4d2395){var _0x1680b2={'status':_0x359bd1};var _0x53b654={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d2395){_0x1680b2[_0x22f5('0xf')]=_0x4d2395;}return db[_0x22f5('0x10')][_0x22f5('0x11')](_0x1680b2,_0x53b654);}function getHeaders(_0xdf15fa){return _[_0x22f5('0x12')](_0xdf15fa,function(_0x29ffe8){return{'text':_0x29ffe8,'style':_0x22f5('0x13')};});}function getRows(_0x151161,_0x10544e){return _[_0x22f5('0x12')](_0x10544e,function(_0x5b1ae0){return _(_0x5b1ae0)[_0x22f5('0x14')](_0x151161)[_0x22f5('0x12')](function(_0x5f110c){return _0x5f110c?_[_0x22f5('0x15')](_0x5f110c):'';})[_0x22f5('0x16')]();});}function createTable(_0x4bc9b7,_0x33fddf){var _0x336b83={'widths':_['fill'](Array(_0x4bc9b7[_0x22f5('0x17')]),0x91),'heights':function(_0x20e71a){return _0x20e71a===0x0?_0x22f5('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5010b7=getHeaders(_0x4bc9b7);_0x336b83[_0x22f5('0x19')][_0x22f5('0x1a')](_0x5010b7);var _0x4d6710=getRows(_0x4bc9b7,_0x33fddf);_0x336b83['body']=_0x336b83['body']['concat'](_0x4d6710);return _0x336b83;}function createTables(_0x5a6101){var _0x488a9a=[];var _0xdf6b56=_[_0x22f5('0x1b')](Object['keys'](_0x5a6101[0x0]),0x5);_0xdf6b56[_0x22f5('0x1c')](function(_0x14b4c4){_0x488a9a['push'](createTable(_0x14b4c4,_0x5a6101));});return _0x488a9a;}function getPDFDocDefinition(_0x556d78){var _0xa57f22=util[_0x22f5('0x1d')](_0x22f5('0x1e'),NAME,EXTRACTED_REPORT[_0x22f5('0x1f')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x22f5('0x20')])[_0x22f5('0x1d')](FORMAT));var _0x43fb80=[];for(var _0x47f195=0x0;_0x47f195<_0x556d78['length'];_0x47f195++){var _0x450eee=[];if(_0x47f195===0x0){_0x450eee[_0x22f5('0x1a')]({'text':_0xa57f22,'style':_0x22f5('0x21')});}var _0x48cc3c={'table':_0x556d78[_0x47f195]};if(_0x47f195>0x0){_0x48cc3c[_0x22f5('0x22')]=_0x22f5('0x23');_0x48cc3c[_0x22f5('0x24')]=[0x0,0x46,0x0,0x0];}_0x450eee[_0x22f5('0x1a')](_0x48cc3c);_0x43fb80[_0x22f5('0x1a')](_0x450eee);}return{'pageSize':'A4','pageOrientation':_0x22f5('0x25'),'content':_0x43fb80,'footer':function(_0x204109,_0x3fc7b8){return{'text':_0x204109['toString']()+_0x22f5('0x26')+_0x3fc7b8,'style':_0x22f5('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x22f5('0x28')},'footer':{'alignment':_0x22f5('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4c1615){var _0x298015=0x1388;var _0x4ac7fa;if(!_0x4c1615[0x0]['num']){return analyticExtractedReport(_0x22f5('0x2a'));}return db[_0x22f5('0x2b')][_0x22f5('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x22f5('0x2d'),_0x22f5('0x2e')]})[_0x22f5('0x2f')](function(_0x49fd6e){if(_0x49fd6e){_0x4ac7fa=_0x49fd6e;_0x298015=_0x4ac7fa[_0x22f5('0x2e')]||0x3e8;}})['then'](function(){var _0x16522d=[];var _0x289a52=0x0;if(_0x4ac7fa[_0x22f5('0x2d')]){if(_0x4c1615&&_0x4c1615['length']){var _0x27ce19=_[_0x22f5('0x30')](_0x4c1615[0x0]['num']/_0x298015);var _0x114964=Number['isInteger'](_0x4c1615[0x0][_0x22f5('0x31')]/_0x298015)?_0x4c1615[0x0]['num']%_0x298015:0x0;_0x27ce19['forEach'](function(_0x44a99d){if(_0x44a99d>0x0){_0x289a52+=_0x298015;}_0x16522d[_0x22f5('0x1a')](dbH[_0x22f5('0x32')][_0x22f5('0x33')](util['format'](_0x22f5('0x34'),QUERY,_0x298015,_0x289a52),{'type':dbH[_0x22f5('0x32')][_0x22f5('0x35')][_0x22f5('0x36')]}));});if(_0x114964>0x0){_0x289a52+=_0x298015;_0x16522d[_0x22f5('0x1a')](dbH[_0x22f5('0x32')][_0x22f5('0x33')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x114964,_0x289a52),{'type':dbH[_0x22f5('0x32')][_0x22f5('0x35')][_0x22f5('0x36')]}));}}}else{_0x16522d[_0x22f5('0x1a')](dbH[_0x22f5('0x32')][_0x22f5('0x33')](QUERY,{'type':dbH[_0x22f5('0x32')][_0x22f5('0x35')]['SELECT']}));}var _0x362441=path[_0x22f5('0x37')](PATH);var _0x5861b2=path[_0x22f5('0x38')](PATH,_0x22f5('0x39'));var _0x51f13d=_0x4ac7fa['split']&&_0x16522d['length']>0x1;var _0x3f9c49=[];if(!fs[_0x22f5('0x3a')](path[_0x22f5('0x3b')](_0x362441,_0x5861b2))&&_0x51f13d){fs[_0x22f5('0x3c')](path['join'](_0x362441,_0x5861b2));}return BPromise[_0x22f5('0x3d')](_0x16522d,function(_0x381c83){_0x3f9c49['push'](_0x381c83);})[_0x22f5('0x2f')](function(){var _0x2c7a7f=[];for(var _0x453e68=0x0;_0x453e68<_0x3f9c49[_0x22f5('0x17')];_0x453e68+=0x1){var _0x1b12f7=_0x3f9c49[_0x453e68];var _0x1870b7=createTables(_[_0x22f5('0x3e')](_0x1b12f7));var _0x3e3fe8;var _0x4d4a6c=getPDFDocDefinition(_0x1870b7);var _0x1648a6=getPDFPrinter();var _0x38d98c=_0x1648a6[_0x22f5('0x3f')](_0x4d4a6c);if(_0x51f13d){_0x3e3fe8=path[_0x22f5('0x3b')](_0x362441,_0x5861b2,util[_0x22f5('0x1d')](_0x22f5('0x40'),_0x5861b2,_0x453e68,_0x22f5('0x41')));}else{_0x3e3fe8=path[_0x22f5('0x3b')](_0x362441,util[_0x22f5('0x1d')](_0x22f5('0x42'),_0x5861b2,_0x22f5('0x41')));}_0x2c7a7f[_0x22f5('0x1a')](writePDFDocument(_0x38d98c,_0x3e3fe8));}return Promise[_0x22f5('0x43')](_0x2c7a7f);})[_0x22f5('0x2f')](function(){if(_0x51f13d){return new Promise(function(_0x4353c0){zipdir(path[_0x22f5('0x3b')](_0x362441,_0x5861b2),{'saveTo':path[_0x22f5('0x3b')](_0x362441,util[_0x22f5('0x1d')](_0x22f5('0x42'),_0x5861b2,_0x22f5('0x44')))},function(){rimraf(path['join'](_0x362441,_0x5861b2),function(){});_0x4353c0(_0x22f5('0x45'));});});}})[_0x22f5('0x2f')](function(){if(!_0x51f13d)return;rimraf(path[_0x22f5('0x3b')](_0x362441,_0x5861b2),function(){});})['then'](function(){logger[_0x22f5('0x46')](util[_0x22f5('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x22f5('0x47')));return analyticExtractedReport(_0x22f5('0x48'),_0x51f13d?util[_0x22f5('0x1d')](_0x22f5('0x42'),_0x5861b2,_0x51f13d?_0x22f5('0x44'):_0x22f5('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x22f5('0x46')](util[_0x22f5('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x22f5('0x47')));return db['AnalyticExtractedReport'][_0x22f5('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x22f5('0x2f')](function(_0x252af1){EXTRACTED_REPORT=_0x252af1;return dbH[_0x22f5('0x32')][_0x22f5('0x33')](util[_0x22f5('0x1d')](_0x22f5('0x4a'),QUERY),{'type':dbH[_0x22f5('0x32')][_0x22f5('0x35')]['SELECT']});})[_0x22f5('0x2f')](extractReport)[_0x22f5('0x4b')](function(_0x3efdcd){logger['info'](util[_0x22f5('0x1d')](_0x22f5('0x4c'),EXTRACTED_REPORT_ID,_0x22f5('0x47')),util['inspect'](_0x3efdcd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x22f5('0x4d'));})['finally'](function(){process[_0x22f5('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x43c97f=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x22f5('0x4f'),'italics':__dirname+_0x22f5('0x50'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x43c97f;}function getPDFDocDefinitionFromHTML(_0x4082f5,_0x23c5a1){var _0x4fd475=util[_0x22f5('0x1d')](_0x22f5('0x51'),_0x23c5a1['channel'],_0x23c5a1[_0x22f5('0x52')]);var _0xe7cf81=moment()['format'](_0x22f5('0x53'))[_0x22f5('0x15')]();var _0x127349=htmlToPdfmake(_0x4082f5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x127349],'defaultStyle':{'font':_0x22f5('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x22f5('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x22f5('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x22f5('0x55')}},'header':function(){return[{'text':_0x22f5('0x56'),'style':_0x22f5('0x21')}];},'footer':function(_0xb23d97,_0x55ac56){return[{'text':util[_0x22f5('0x1d')](_0x22f5('0x57'),_0x4fd475,_0xb23d97,_0x55ac56,_0xe7cf81),'style':_0x22f5('0x27')}];}};}function writePDFDocument(_0x39170f,_0x2e0fa7){return new Promise(function(_0x2fa9a2,_0x318e0f){var _0x28436b=_0x39170f[_0x22f5('0x58')](fs[_0x22f5('0x59')](_0x2e0fa7));_0x28436b['on'](_0x22f5('0x5a'),function(){_0x2fa9a2(_0x22f5('0x5a'));});_0x28436b['on'](_0x22f5('0x5b'),function(_0x2d4f1a){_0x318e0f(_0x2d4f1a);});_0x39170f[_0x22f5('0x5c')]();});}exports[_0x22f5('0x5d')]=function(_0x54eba5,_0x4838a9){var _0x3e4e7b=getPDFPrinter();var _0xdefee4=getPDFDocDefinitionFromHTML(_0x54eba5,_0x4838a9);var _0x33be63=_0x3e4e7b[_0x22f5('0x3f')](_0xdefee4);return writePDFDocument(_0x33be63,_0x4838a9[_0x22f5('0x1')])[_0x22f5('0x4b')](function(_0x56853a){throw _0x56853a;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c17af57..b724704 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 _0xfaa6=['../../mysqldb','dbH','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','binary','XLSX','xlsx','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xfaa6,0xbd));var _0x6faa=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xfaa6[_0x469ac7];return _0x22f3b0;};'use strict';var util=require(_0x6faa('0x0'));var path=require(_0x6faa('0x1'));var _=require(_0x6faa('0x2'));var fs=require('fs');var json2xls=require(_0x6faa('0x3'));var BPromise=require(_0x6faa('0x4'));var zipdir=require(_0x6faa('0x5'));var rimraf=require(_0x6faa('0x6'));var db=require(_0x6faa('0x7'))['db'];var dbH=require(_0x6faa('0x7'))[_0x6faa('0x8')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6faa('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6faa('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x325fc7,_0x27195c){var _0x874022={'status':_0x325fc7};var _0x23311b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27195c){_0x874022['savename']=_0x27195c;}return db[_0x6faa('0xa')][_0x6faa('0xb')](_0x874022,_0x23311b);}function main(){var _0x3af018=0x1388;var _0x31fc9a;logger[_0x6faa('0xc')](util[_0x6faa('0xd')](_0x6faa('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x6faa('0xf')][_0x6faa('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6faa('0x11'),'splitSizeXlsx']})[_0x6faa('0x12')](function(_0x2d06c1){if(_0x2d06c1){_0x31fc9a=_0x2d06c1;_0x3af018=_0x31fc9a[_0x6faa('0x13')]||0x1388;}})[_0x6faa('0x12')](function(){return dbH[_0x6faa('0x14')][_0x6faa('0x15')](util[_0x6faa('0xd')](_0x6faa('0x16'),QUERY),{'type':dbH[_0x6faa('0x14')]['QueryTypes']['SELECT']});})[_0x6faa('0x12')](function(_0xe102e8){if(!_0xe102e8[0x0][_0x6faa('0x17')]){return analyticExtractedReport(_0x6faa('0x18'));}var _0x38b5f9=[];var _0x38f4dd=0x0;if(_0x31fc9a[_0x6faa('0x11')]){if(_0xe102e8&&_0xe102e8['length']){var _0x59c342=_['range'](_0xe102e8[0x0]['num']/_0x3af018);var _0x4b9320=Number[_0x6faa('0x19')](_0xe102e8[0x0][_0x6faa('0x17')]/_0x3af018)?_0xe102e8[0x0][_0x6faa('0x17')]%_0x3af018:0x0;_0x59c342['forEach'](function(_0x24b19f){if(_0x24b19f>0x0){_0x38f4dd+=_0x3af018;}_0x38b5f9[_0x6faa('0x1a')](dbH[_0x6faa('0x14')]['query'](util['format'](_0x6faa('0x1b'),QUERY,_0x3af018,_0x38f4dd),{'type':dbH[_0x6faa('0x14')][_0x6faa('0x1c')][_0x6faa('0x1d')]}));});if(_0x4b9320>0x0){_0x38f4dd+=_0x3af018;_0x38b5f9[_0x6faa('0x1a')](dbH[_0x6faa('0x14')][_0x6faa('0x15')](util[_0x6faa('0xd')](_0x6faa('0x1b'),QUERY,_0x4b9320,_0x38f4dd),{'type':dbH[_0x6faa('0x14')][_0x6faa('0x1c')][_0x6faa('0x1d')]}));}}}else{_0x38b5f9[_0x6faa('0x1a')](dbH[_0x6faa('0x14')][_0x6faa('0x15')](QUERY,{'type':dbH[_0x6faa('0x14')][_0x6faa('0x1c')][_0x6faa('0x1d')]}));}var _0x3b0fae=path[_0x6faa('0x1e')](PATH);var _0x22965f=path[_0x6faa('0x1f')](PATH,_0x6faa('0x20'));var _0x2c6687=_0x31fc9a['split']&&_0x38b5f9[_0x6faa('0x21')]>0x1;var _0x48aad8=[];if(!fs[_0x6faa('0x22')](path[_0x6faa('0x23')](_0x3b0fae,_0x22965f))&&_0x2c6687){fs[_0x6faa('0x24')](path[_0x6faa('0x23')](_0x3b0fae,_0x22965f));}return BPromise[_0x6faa('0x25')](_0x38b5f9,function(_0x4c2e2c){_0x48aad8['push'](_0x4c2e2c);})[_0x6faa('0x12')](function(){for(var _0xf20193=0x0;_0xf20193<_0x48aad8[_0x6faa('0x21')];_0xf20193+=0x1){var _0x2cf427;var _0x19f768=_0x48aad8[_0xf20193];if(_0x2c6687){_0x2cf427=path[_0x6faa('0x23')](_0x3b0fae,_0x22965f,util[_0x6faa('0xd')](_0x6faa('0x26'),_0x22965f,_0xf20193,'xlsx'));}else{_0x2cf427=path[_0x6faa('0x23')](_0x3b0fae,util[_0x6faa('0xd')](_0x6faa('0x27'),_0x22965f,'xlsx'));}fs[_0x6faa('0x28')](_0x2cf427,json2xls(_0x19f768),_0x6faa('0x29'));}})[_0x6faa('0x12')](function(){if(_0x2c6687){return new Promise(function(_0x255caa){zipdir(path[_0x6faa('0x23')](_0x3b0fae,_0x22965f),{'saveTo':path[_0x6faa('0x23')](_0x3b0fae,util[_0x6faa('0xd')](_0x6faa('0x27'),_0x22965f,'zip'))},function(_0x1b7778,_0x1b740e){rimraf(path[_0x6faa('0x23')](_0x3b0fae,_0x22965f),function(){});_0x255caa('zip\x20finished');});});}})[_0x6faa('0x12')](function(){logger[_0x6faa('0xc')](util[_0x6faa('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6faa('0x2a')));return analyticExtractedReport('Completed',_0x2c6687?util[_0x6faa('0xd')](_0x6faa('0x27'),_0x22965f,_0x2c6687?'zip':_0x6faa('0x2b')):null);});})['catch'](function(_0x34e20c){logger[_0x6faa('0xc')](util[_0x6faa('0xd')](_0x6faa('0x2c'),EXTRACTED_REPORT_ID,_0x6faa('0x2a')),util[_0x6faa('0x2d')](_0x34e20c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6faa('0x2e'));})[_0x6faa('0x2f')](function(){process[_0x6faa('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x719a=['%s\x20limit\x20%d\x20OFFSET\x20%d','query','QueryTypes','dirname','.xlsx','existsSync','join','mkdirSync','each','push','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','json2xls','bluebird','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','format','XLSX','Setting','find','split','then','splitSizeXlsx','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','length','range','forEach'];(function(_0x1a8be3,_0xa1d303){var _0xac9769=function(_0x3e5ccb){while(--_0x3e5ccb){_0x1a8be3['push'](_0x1a8be3['shift']());}};_0xac9769(++_0xa1d303);}(_0x719a,0x139));var _0xa719=function(_0x29cb25,_0x3c8ab4){_0x29cb25=_0x29cb25-0x0;var _0x4f43b5=_0x719a[_0x29cb25];return _0x4f43b5;};'use strict';var util=require('util');var path=require(_0xa719('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xa719('0x1'));var BPromise=require(_0xa719('0x2'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xa719('0x3'))['db'];var dbH=require(_0xa719('0x3'))[_0xa719('0x4')];var logger=require('../../config/logger')(_0xa719('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0xa719('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa719('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x93cd3f,_0xa9e35a){var _0xbeef24={'status':_0x93cd3f};var _0x24d39c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa9e35a){_0xbeef24[_0xa719('0x7')]=_0xa9e35a;}return db[_0xa719('0x8')]['update'](_0xbeef24,_0x24d39c);}function main(){var _0x1d6725=0x1388;var _0x522595;logger['info'](util[_0xa719('0x9')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa719('0xa')));return db[_0xa719('0xb')][_0xa719('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa719('0xd'),'splitSizeXlsx']})[_0xa719('0xe')](function(_0x39ce3c){if(_0x39ce3c){_0x522595=_0x39ce3c;_0x1d6725=_0x522595[_0xa719('0xf')]||0x1388;}})[_0xa719('0xe')](function(){return dbH['sequelize']['query'](util['format'](_0xa719('0x10'),QUERY),{'type':dbH[_0xa719('0x11')]['QueryTypes'][_0xa719('0x12')]});})[_0xa719('0xe')](function(_0x3297f8){if(!_0x3297f8[0x0][_0xa719('0x13')]){return analyticExtractedReport('Empty');}var _0x179fc7=[];var _0x3ed6d4=0x0;if(_0x522595[_0xa719('0xd')]){if(_0x3297f8&&_0x3297f8[_0xa719('0x14')]){var _0x3c953e=_[_0xa719('0x15')](_0x3297f8[0x0]['num']/_0x1d6725);var _0x3eacf4=Number['isInteger'](_0x3297f8[0x0][_0xa719('0x13')]/_0x1d6725)?_0x3297f8[0x0][_0xa719('0x13')]%_0x1d6725:0x0;_0x3c953e[_0xa719('0x16')](function(_0x5eb707){if(_0x5eb707>0x0){_0x3ed6d4+=_0x1d6725;}_0x179fc7['push'](dbH['sequelize']['query'](util['format'](_0xa719('0x17'),QUERY,_0x1d6725,_0x3ed6d4),{'type':dbH[_0xa719('0x11')]['QueryTypes']['SELECT']}));});if(_0x3eacf4>0x0){_0x3ed6d4+=_0x1d6725;_0x179fc7['push'](dbH[_0xa719('0x11')][_0xa719('0x18')](util[_0xa719('0x9')](_0xa719('0x17'),QUERY,_0x3eacf4,_0x3ed6d4),{'type':dbH[_0xa719('0x11')][_0xa719('0x19')][_0xa719('0x12')]}));}}}else{_0x179fc7['push'](dbH[_0xa719('0x11')][_0xa719('0x18')](QUERY,{'type':dbH[_0xa719('0x11')][_0xa719('0x19')][_0xa719('0x12')]}));}var _0x327dc9=path[_0xa719('0x1a')](PATH);var _0x20f770=path['basename'](PATH,_0xa719('0x1b'));var _0x47425c=_0x522595[_0xa719('0xd')]&&_0x179fc7[_0xa719('0x14')]>0x1;var _0x2a493b=[];if(!fs[_0xa719('0x1c')](path[_0xa719('0x1d')](_0x327dc9,_0x20f770))&&_0x47425c){fs[_0xa719('0x1e')](path['join'](_0x327dc9,_0x20f770));}return BPromise[_0xa719('0x1f')](_0x179fc7,function(_0x3fafb6){_0x2a493b[_0xa719('0x20')](_0x3fafb6);})['then'](function(){for(var _0x242aa5=0x0;_0x242aa5<_0x2a493b['length'];_0x242aa5+=0x1){var _0x55e44b;var _0x12e0b6=_0x2a493b[_0x242aa5];if(_0x47425c){_0x55e44b=path['join'](_0x327dc9,_0x20f770,util[_0xa719('0x9')](_0xa719('0x21'),_0x20f770,_0x242aa5,'xlsx'));}else{_0x55e44b=path['join'](_0x327dc9,util['format'](_0xa719('0x22'),_0x20f770,_0xa719('0x23')));}fs[_0xa719('0x24')](_0x55e44b,json2xls(_0x12e0b6),_0xa719('0x25'));}})[_0xa719('0xe')](function(){if(_0x47425c){return new Promise(function(_0x1a36c4){zipdir(path[_0xa719('0x1d')](_0x327dc9,_0x20f770),{'saveTo':path[_0xa719('0x1d')](_0x327dc9,util[_0xa719('0x9')]('%s.%s',_0x20f770,_0xa719('0x26')))},function(_0x5c0692,_0x1bc731){rimraf(path[_0xa719('0x1d')](_0x327dc9,_0x20f770),function(){});_0x1a36c4(_0xa719('0x27'));});});}})[_0xa719('0xe')](function(){logger[_0xa719('0x28')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xa719('0x29'),_0x47425c?util[_0xa719('0x9')](_0xa719('0x22'),_0x20f770,_0x47425c?_0xa719('0x26'):_0xa719('0x23')):null);});})[_0xa719('0x2a')](function(_0x1e095d){logger['info'](util[_0xa719('0x9')](_0xa719('0x2b'),EXTRACTED_REPORT_ID,_0xa719('0xa')),util[_0xa719('0x2c')](_0x1e095d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa719('0x2d'));})[_0xa719('0x2e')](function(){process[_0xa719('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 0c109b0..ead773c 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 _0x422c=['custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','filter','intervals','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x422c,0xa0));var _0xc422=function(_0x1ded7e,_0x3ef2b0){_0x1ded7e=_0x1ded7e-0x0;var _0x4b3b7e=_0x422c[_0x1ded7e];return _0x4b3b7e;};'use strict';var _=require(_0xc422('0x0'));var util=require(_0xc422('0x1'));function rewrite(_0x125065,_0x14d9b1){var _0xa4b705=this;return _0x125065[_0xc422('0x2')][_0xc422('0x3')][_0xc422('0x4')]({'raw':!![]})[_0xc422('0x5')](function(_0x42ea0b){_0xa4b705['intervals']=_0x42ea0b;return _0x125065[_0xc422('0x2')][_0xc422('0x6')]['findAll']({'where':{'IntervalId':_0x14d9b1[_0xc422('0x7')]},'raw':!![]});})[_0xc422('0x5')](function(_0x5320bf){return _0x125065[_0xc422('0x2')][_0xc422('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xc422('0x8')](_0x5320bf,_0xc422('0x9')))}},'order':[{'raw':_0xc422('0xa')}],'raw':!![]});})[_0xc422('0x5')](function(_0x31abd4){var _0x12dca0=_['filter'](_0x31abd4,{'priority':'1'});var _0x2c5ba6=_['filter'](_0x31abd4,{'isApp':0x1});var _0x3fd1b6=_[_0xc422('0xb')](_0x2c5ba6,_0xc422('0x9'));var _0x2c7a3b=[_0xc422('0xc'),_0xc422('0xd')];var _0x39835e=[];var _0x56b095=[];for(var _0x221ef5 in _0x3fd1b6){if(_0x3fd1b6[_0xc422('0xe')](_0x221ef5)){_0xa4b705[_0xc422('0xf')]=0x2;_0xa4b705['extensions']=[];_0xa4b705[_0xc422('0x10')]=_[_0xc422('0x11')](_0x12dca0,{'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')]});_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0]['type'],'app':_0xc422('0x14'),'appdata':util[_0xc422('0x15')](_0xc422('0x16'),_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')]),'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});if(_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')]===_0xc422('0x1a')){_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':'Set','appdata':'CDR(routeid)='+_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')],'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});}else if(_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')]==='outbound'){if(_0xa4b705['extension']){_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xc422('0x1b')+(_0xa4b705[_0xc422('0x10')][_0xc422('0x1c')]?_0xc422('0x1d')+_0xa4b705[_0xc422('0x10')][_0xc422('0x1c')]+'}':'${EXTEN}'),'context':_0x3fd1b6[_0x221ef5][0x0]['context'],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});}_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':'Set','appdata':_0xc422('0x1e')+_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')],'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});var _0x292d5a=_0xa4b705['priority']++;_0xa4b705[_0xc422('0x12')]['push']({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x1f'),'appdata':_0xc422('0x20')+(_0x292d5a+0x2)+_0xc422('0x21')+(_0x292d5a+0x1)+')','context':_0x3fd1b6[_0x221ef5][0x0]['context'],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0x292d5a,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});if(_0xa4b705['extension']){_0xa4b705[_0xc422('0x12')]['push']({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xa4b705[_0xc422('0x10')]['cutdigits']?_0xc422('0x22')+_0xa4b705[_0xc422('0x10')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705['priority']++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0]['VoiceExtensionId']});}_0xa4b705[_0xc422('0x12')]['push']({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xc422('0x23')+_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')],'context':_0x3fd1b6[_0x221ef5][0x0]['context'],'exten':_0x3fd1b6[_0x221ef5][0x0]['exten'],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});if(_0xa4b705[_0xc422('0x10')]&&_0xa4b705[_0xc422('0x10')][_0xc422('0xe')](_0xc422('0x24'))&&_0xa4b705[_0xc422('0x10')]['recordingFormat']!==_0xc422('0x25')){_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705['priority']++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0]['type'],'app':_0xc422('0x14'),'appdata':_0xc422('0x26')+_0xa4b705[_0xc422('0x10')][_0xc422('0x24')]||_0xc422('0x27'),'context':_0x3fd1b6[_0x221ef5][0x0]['context'],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});}}_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});_0xa4b705[_0xc422('0x12')][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xc422('0x28'),'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0]['exten'],'priority':_0xa4b705[_0xc422('0xf')]++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});_0xa4b705['extensions']['push']({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':'Set','appdata':_0xc422('0x29'),'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'exten':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x9')],'priority':_0xa4b705['priority']++,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0]['VoiceExtensionId']});for(var _0x349c19=0x0,_0x17f76e=0x0;_0x349c19<_0x3fd1b6[_0x221ef5][_0xc422('0x2a')];_0x349c19+=0x1,_0x17f76e=0x0){var _0xe9f8b1=_0x3fd1b6[_0x221ef5][_0x349c19];if(_0xe9f8b1[_0xc422('0x17')]){_0xe9f8b1['type']=_0xe9f8b1[_0xc422('0x17')][_0xc422('0x2b')]();}var _0x1276c2=[];var _0x459e78=[];delete _0xe9f8b1['id'];delete _0xe9f8b1[_0xc422('0x2c')];delete _0xe9f8b1[_0xc422('0x2d')];var _0x37bfa8=_0xe9f8b1['interval']!==_0xc422('0x2e')?[_0xe9f8b1[_0xc422('0x2f')]]:_0xe9f8b1[_0xc422('0x7')]?_['map'](_[_0xc422('0x30')](_0xa4b705[_0xc422('0x31')],{'IntervalId':_0xe9f8b1[_0xc422('0x7')]}),'interval'):[];if(_0xe9f8b1[_0xc422('0xe')]('tag')){if(_0xe9f8b1[_0xc422('0x32')]&&_0xe9f8b1['tag']!=='--'){_0x1276c2['push']({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':_0xc422('0x33')+_0xe9f8b1[_0xc422('0x32')],'context':_0xe9f8b1['context'],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705['priority']+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});}}if(_0xe9f8b1[_0xc422('0x17')]===_0xc422('0x34')&&_0xe9f8b1[_0xc422('0xe')]('callerID')){if(_0xe9f8b1[_0xc422('0x35')]){_0x1276c2['push']({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x1f'),'appdata':_0xc422('0x36')+_0xe9f8b1[_0xc422('0x35')]+')','context':_0xe9f8b1['context'],'exten':_0xe9f8b1['exten'],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});}else{_0x1276c2[_0xc422('0x13')]({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x1f'),'appdata':_0xc422('0x37'),'context':_0xe9f8b1[_0xc422('0x18')],'exten':_0xe9f8b1['exten'],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});}}if(_0xe9f8b1[_0xc422('0xe')](_0xc422('0x38'))){if(_0x2c7a3b[_0xc422('0x39')](_0xe9f8b1['app'][_0xc422('0x2b')]())>=0x0&&_0xe9f8b1[_0xc422('0x3a')]!==_0xc422('0x3b')){if(_0xe9f8b1[_0xc422('0x38')]){_0x1276c2[_0xc422('0x13')]({'type':_0xe9f8b1['type'],'app':'ExecIf','appdata':_0xc422('0x3c'),'context':_0xe9f8b1[_0xc422('0x18')],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});_0x1276c2[_0xc422('0x13')]({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xe9f8b1[_0xc422('0x18')],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1['VoiceExtensionId']});}else{_0x1276c2[_0xc422('0x13')]({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x1f'),'appdata':_0xc422('0x3d'),'context':_0xe9f8b1[_0xc422('0x18')],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705[_0xc422('0xf')]+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});_0x1276c2['push']({'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xe9f8b1['context'],'exten':_0xe9f8b1[_0xc422('0x9')],'priority':_0x37bfa8[_0xc422('0x2a')]+_0xa4b705['priority']+_0x17f76e++,'VoiceExtensionId':_0xe9f8b1[_0xc422('0x19')]});}}}for(var _0x173259=0x0;_0x173259<_0x37bfa8[_0xc422('0x2a')];_0x173259+=0x1){var _0x4cea26=_0xa4b705[_0xc422('0xf')]+_0x37bfa8[_0xc422('0x2a')];var _0x2089ad=_0x173259===_0x37bfa8['length']-0x1?_0xa4b705['priority']+_0x1276c2['length']+_0x459e78[_0xc422('0x2a')]+0x2:_0xa4b705[_0xc422('0xf')]+_0x173259+0x1;_0x1276c2[_0xc422('0x3e')](_0x173259,0x0,{'type':_0xe9f8b1[_0xc422('0x17')],'app':_0xc422('0x3f'),'appdata':_0x37bfa8[_0x173259]+'?'+_0xe9f8b1['context']+_0xc422('0x40')+_0x4cea26+':'+_0xe9f8b1[_0xc422('0x18')]+',${EXTEN},'+_0x2089ad,'exten':_0xe9f8b1['exten'],'context':_0xe9f8b1[_0xc422('0x18')],'priority':_0xa4b705[_0xc422('0xf')]+_0x173259,'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});}_0xe9f8b1[_0xc422('0xf')]=_0x1276c2[_0xc422('0x2a')]?_[_0xc422('0x41')](_0x1276c2)[_0xc422('0xf')]+0x1:_0xa4b705['priority'];_0xa4b705[_0xc422('0xf')]=(_0x459e78[_0xc422('0x2a')]?_[_0xc422('0x41')](_0x459e78)[_0xc422('0xf')]:_0xe9f8b1[_0xc422('0xf')])+0x1;_0xa4b705[_0xc422('0x12')]=_[_0xc422('0x42')](_0xa4b705[_0xc422('0x12')],_0x1276c2,[_0xe9f8b1],_0x459e78);}_0xa4b705['extensions'][_0xc422('0x13')]({'type':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x17')],'app':'Hangup','exten':_0x3fd1b6[_0x221ef5][0x0]['exten'],'context':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x18')],'priority':_0xa4b705[_0xc422('0xf')],'VoiceExtensionId':_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]});_0x39835e[_0xc422('0x13')](_0x3fd1b6[_0x221ef5][0x0][_0xc422('0x19')]);_0x56b095=_[_0xc422('0x42')](_0x56b095,_0xa4b705['extensions']);}}return _0x125065[_0xc422('0x43')](function(_0xe100fb){return _0x125065['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x39835e}},'transaction':_0xe100fb})[_0xc422('0x5')](function(_0x25762d){return _0x125065[_0xc422('0x2')]['VoiceExtension'][_0xc422('0x44')](_[_0xc422('0x45')](_0x56b095,'priority'),{'transaction':_0xe100fb});});});})[_0xc422('0x46')](function(_0x35a7bd){console[_0xc422('0x47')](_0x35a7bd);});}exports[_0xc422('0x48')]=rewrite; \ No newline at end of file +var _0x9785=['wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','$[${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','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','priority','extensions','find','push','type','Set','format','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT='];(function(_0xebd8ca,_0x524046){var _0x26535a=function(_0x5487ad){while(--_0x5487ad){_0xebd8ca['push'](_0xebd8ca['shift']());}};_0x26535a(++_0x524046);}(_0x9785,0xb1));var _0x5978=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x9785[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0x5978('0x0'));var util=require(_0x5978('0x1'));function rewrite(_0x31db7d,_0x4c1072){var _0xdda21d=this;return _0x31db7d[_0x5978('0x2')][_0x5978('0x3')][_0x5978('0x4')]({'raw':!![]})[_0x5978('0x5')](function(_0x129f08){_0xdda21d[_0x5978('0x6')]=_0x129f08;return _0x31db7d[_0x5978('0x2')]['VoiceExtension'][_0x5978('0x4')]({'where':{'IntervalId':_0x4c1072[_0x5978('0x7')]},'raw':!![]});})[_0x5978('0x5')](function(_0x26e272){return _0x31db7d['models'][_0x5978('0x8')]['findAll']({'where':{'exten':{'$in':_[_0x5978('0x9')](_[_0x5978('0xa')](_0x26e272,_0x5978('0xb')))}},'order':[{'raw':_0x5978('0xc')}],'raw':!![]});})[_0x5978('0x5')](function(_0x52dbe0){var _0x26ab57=_[_0x5978('0xd')](_0x52dbe0,{'priority':'1'});var _0x4dcf5f=_[_0x5978('0xd')](_0x52dbe0,{'isApp':0x1});var _0x429e7a=_['groupBy'](_0x4dcf5f,'exten');var _0x47ea43=[_0x5978('0xe'),_0x5978('0xf')];var _0x10e98c=[];var _0x2a4167=[];for(var _0x4a323b in _0x429e7a){if(_0x429e7a['hasOwnProperty'](_0x4a323b)){_0xdda21d[_0x5978('0x10')]=0x2;_0xdda21d[_0x5978('0x11')]=[];_0xdda21d['extension']=_[_0x5978('0x12')](_0x26ab57,{'exten':_0x429e7a[_0x4a323b][0x0]['exten']});_0xdda21d['extensions'][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':_0x5978('0x15'),'appdata':util[_0x5978('0x16')](_0x5978('0x17'),_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')]),'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0]['VoiceExtensionId']});if(_0x429e7a[_0x4a323b][0x0]['type']===_0x5978('0x19')){_0xdda21d['extensions'][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':_0x5978('0x15'),'appdata':_0x5978('0x1a')+_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')],'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});}else if(_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')]===_0x5978('0x1c')){if(_0xdda21d[_0x5978('0x1d')]){_0xdda21d[_0x5978('0x11')][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':_0x5978('0x15'),'appdata':_0x5978('0x1e')+(_0xdda21d['extension'][_0x5978('0x1f')]?'${EXTEN:'+_0xdda21d['extension']['cutdigits']+'}':_0x5978('0x20')),'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});}_0xdda21d[_0x5978('0x11')][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':'Set','appdata':_0x5978('0x1a')+_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')],'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});var _0x4b5cb0=_0xdda21d[_0x5978('0x10')]++;_0xdda21d['extensions']['push']({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':_0x5978('0x21'),'appdata':_0x5978('0x22')+(_0x4b5cb0+0x2)+'):Goto('+(_0x4b5cb0+0x1)+')','context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0x4b5cb0,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});if(_0xdda21d[_0x5978('0x1d')]){_0xdda21d[_0x5978('0x11')][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':'Set','appdata':_0xdda21d['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0xdda21d['extension']['cutdigits']+'}':_0x5978('0x23'),'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});}_0xdda21d['extensions'][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0]['type'],'app':_0x5978('0x15'),'appdata':_0x5978('0x24')+_0x429e7a[_0x4a323b][0x0]['VoiceExtensionId'],'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0]['exten'],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});if(_0xdda21d[_0x5978('0x1d')]&&_0xdda21d[_0x5978('0x1d')][_0x5978('0x25')](_0x5978('0x26'))&&_0xdda21d[_0x5978('0x1d')]['recordingFormat']!==_0x5978('0x27')){_0xdda21d[_0x5978('0x11')][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':'Set','appdata':_0x5978('0x28'),'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0xdda21d['priority']++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});_0xdda21d['extensions'][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':_0x5978('0x15'),'appdata':_0x5978('0x29')+_0xdda21d[_0x5978('0x1d')][_0x5978('0x26')]||_0x5978('0x2a'),'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});}}_0xdda21d[_0x5978('0x11')][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':'Set','appdata':_0x5978('0x2b'),'context':_0x429e7a[_0x4a323b][0x0]['context'],'exten':_0x429e7a[_0x4a323b][0x0]['exten'],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});_0xdda21d['extensions'][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0][_0x5978('0x14')],'app':'Set','appdata':_0x5978('0x2c'),'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0][_0x5978('0xb')],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});_0xdda21d[_0x5978('0x11')][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0]['type'],'app':_0x5978('0x15'),'appdata':_0x5978('0x2d'),'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'exten':_0x429e7a[_0x4a323b][0x0]['exten'],'priority':_0xdda21d[_0x5978('0x10')]++,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0]['VoiceExtensionId']});for(var _0x12a8f9=0x0,_0x2cb15a=0x0;_0x12a8f9<_0x429e7a[_0x4a323b][_0x5978('0x2e')];_0x12a8f9+=0x1,_0x2cb15a=0x0){var _0x445de2=_0x429e7a[_0x4a323b][_0x12a8f9];if(_0x445de2[_0x5978('0x14')]){_0x445de2[_0x5978('0x14')]=_0x445de2[_0x5978('0x14')][_0x5978('0x2f')]();}var _0x197486=[];var _0xc52aa6=[];delete _0x445de2['id'];delete _0x445de2[_0x5978('0x30')];delete _0x445de2['updatedAt'];var _0xdaa8b=_0x445de2[_0x5978('0x31')]!==_0x5978('0x32')?[_0x445de2[_0x5978('0x31')]]:_0x445de2[_0x5978('0x7')]?_[_0x5978('0xa')](_[_0x5978('0xd')](_0xdda21d[_0x5978('0x6')],{'IntervalId':_0x445de2[_0x5978('0x7')]}),_0x5978('0x31')):[];if(_0x445de2['hasOwnProperty'](_0x5978('0x33'))){if(_0x445de2[_0x5978('0x33')]&&_0x445de2[_0x5978('0x33')]!=='--'){_0x197486[_0x5978('0x13')]({'type':_0x445de2[_0x5978('0x14')],'app':'Set','appdata':_0x5978('0x34')+_0x445de2[_0x5978('0x33')],'context':_0x445de2[_0x5978('0x18')],'exten':_0x445de2[_0x5978('0xb')],'priority':_0xdaa8b[_0x5978('0x2e')]+_0xdda21d[_0x5978('0x10')]+_0x2cb15a++,'VoiceExtensionId':_0x445de2[_0x5978('0x1b')]});}}if(_0x445de2[_0x5978('0x14')]===_0x5978('0x1c')&&_0x445de2[_0x5978('0x25')]('callerID')){if(_0x445de2['callerID']){_0x197486[_0x5978('0x13')]({'type':_0x445de2[_0x5978('0x14')],'app':'ExecIf','appdata':_0x5978('0x35')+_0x445de2['callerID']+')','context':_0x445de2[_0x5978('0x18')],'exten':_0x445de2['exten'],'priority':_0xdaa8b[_0x5978('0x2e')]+_0xdda21d[_0x5978('0x10')]+_0x2cb15a++,'VoiceExtensionId':_0x445de2['VoiceExtensionId']});}else{_0x197486[_0x5978('0x13')]({'type':_0x445de2[_0x5978('0x14')],'app':_0x5978('0x21'),'appdata':_0x5978('0x36'),'context':_0x445de2[_0x5978('0x18')],'exten':_0x445de2['exten'],'priority':_0xdaa8b[_0x5978('0x2e')]+_0xdda21d[_0x5978('0x10')]+_0x2cb15a++,'VoiceExtensionId':_0x445de2[_0x5978('0x1b')]});}}if(_0x445de2[_0x5978('0x25')](_0x5978('0x37'))){if(_0x47ea43['indexOf'](_0x445de2[_0x5978('0x38')][_0x5978('0x2f')]())>=0x0&&_0x445de2['appType']!==_0x5978('0x39')){if(_0x445de2[_0x5978('0x37')]){_0x197486[_0x5978('0x13')]({'type':_0x445de2['type'],'app':'ExecIf','appdata':_0x5978('0x3a'),'context':_0x445de2[_0x5978('0x18')],'exten':_0x445de2[_0x5978('0xb')],'priority':_0xdaa8b[_0x5978('0x2e')]+_0xdda21d[_0x5978('0x10')]+_0x2cb15a++,'VoiceExtensionId':_0x445de2[_0x5978('0x1b')]});_0x197486[_0x5978('0x13')]({'type':_0x445de2[_0x5978('0x14')],'app':_0x5978('0x15'),'appdata':_0x5978('0x3b'),'context':_0x445de2['context'],'exten':_0x445de2['exten'],'priority':_0xdaa8b[_0x5978('0x2e')]+_0xdda21d[_0x5978('0x10')]+_0x2cb15a++,'VoiceExtensionId':_0x445de2[_0x5978('0x1b')]});}else{_0x197486[_0x5978('0x13')]({'type':_0x445de2[_0x5978('0x14')],'app':_0x5978('0x21'),'appdata':_0x5978('0x3c'),'context':_0x445de2['context'],'exten':_0x445de2[_0x5978('0xb')],'priority':_0xdaa8b[_0x5978('0x2e')]+_0xdda21d['priority']+_0x2cb15a++,'VoiceExtensionId':_0x445de2[_0x5978('0x1b')]});_0x197486[_0x5978('0x13')]({'type':_0x445de2['type'],'app':_0x5978('0x15'),'appdata':_0x5978('0x3d'),'context':_0x445de2['context'],'exten':_0x445de2[_0x5978('0xb')],'priority':_0xdaa8b[_0x5978('0x2e')]+_0xdda21d[_0x5978('0x10')]+_0x2cb15a++,'VoiceExtensionId':_0x445de2[_0x5978('0x1b')]});}}}for(var _0x2b3198=0x0;_0x2b3198<_0xdaa8b[_0x5978('0x2e')];_0x2b3198+=0x1){var _0x5e3ebb=_0xdda21d[_0x5978('0x10')]+_0xdaa8b[_0x5978('0x2e')];var _0x288b7f=_0x2b3198===_0xdaa8b[_0x5978('0x2e')]-0x1?_0xdda21d[_0x5978('0x10')]+_0x197486[_0x5978('0x2e')]+_0xc52aa6[_0x5978('0x2e')]+0x2:_0xdda21d[_0x5978('0x10')]+_0x2b3198+0x1;_0x197486['splice'](_0x2b3198,0x0,{'type':_0x445de2[_0x5978('0x14')],'app':'GotoIfTime','appdata':_0xdaa8b[_0x2b3198]+'?'+_0x445de2[_0x5978('0x18')]+_0x5978('0x3e')+_0x5e3ebb+':'+_0x445de2['context']+_0x5978('0x3e')+_0x288b7f,'exten':_0x445de2[_0x5978('0xb')],'context':_0x445de2[_0x5978('0x18')],'priority':_0xdda21d[_0x5978('0x10')]+_0x2b3198,'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0]['VoiceExtensionId']});}_0x445de2[_0x5978('0x10')]=_0x197486[_0x5978('0x2e')]?_[_0x5978('0x3f')](_0x197486)[_0x5978('0x10')]+0x1:_0xdda21d['priority'];_0xdda21d['priority']=(_0xc52aa6[_0x5978('0x2e')]?_[_0x5978('0x3f')](_0xc52aa6)[_0x5978('0x10')]:_0x445de2[_0x5978('0x10')])+0x1;_0xdda21d[_0x5978('0x11')]=_['concat'](_0xdda21d['extensions'],_0x197486,[_0x445de2],_0xc52aa6);}_0xdda21d['extensions'][_0x5978('0x13')]({'type':_0x429e7a[_0x4a323b][0x0]['type'],'app':_0x5978('0x40'),'exten':_0x429e7a[_0x4a323b][0x0]['exten'],'context':_0x429e7a[_0x4a323b][0x0][_0x5978('0x18')],'priority':_0xdda21d[_0x5978('0x10')],'VoiceExtensionId':_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]});_0x10e98c['push'](_0x429e7a[_0x4a323b][0x0][_0x5978('0x1b')]);_0x2a4167=_[_0x5978('0x41')](_0x2a4167,_0xdda21d['extensions']);}}return _0x31db7d[_0x5978('0x42')](function(_0x44a591){return _0x31db7d[_0x5978('0x2')][_0x5978('0x8')][_0x5978('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x10e98c}},'transaction':_0x44a591})[_0x5978('0x5')](function(_0x4dbdca){return _0x31db7d['models']['VoiceExtension'][_0x5978('0x44')](_[_0x5978('0x45')](_0x2a4167,'priority'),{'transaction':_0x44a591});});});})[_0x5978('0x46')](function(_0x393d97){console[_0x5978('0x47')](_0x393d97);});}exports[_0x5978('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8439813..9f41a72 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 _0x3409=['cm_hopper','phone','scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','calleridnum','id\x20IN\x20?','cm_hopper_black','fromQuery','str','findAll','dialCheckDuplicateType','CmList','Lists','get','sequelize','VoiceQueueId','query','all','VoiceQueue','outbound','BlackLists','Campaign','always','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','into'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x3409,0x1f1));var _0x9340=function(_0x1086ea,_0x35841d){_0x1086ea=_0x1086ea-0x0;var _0x4d617a=_0x3409[_0x1086ea];return _0x4d617a;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x9340('0x0'));var Papa=require(_0x9340('0x1'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x9340('0x2'));var logger=require(_0x9340('0x3'))(_0x9340('0x4'));config[_0x9340('0x5')]=_[_0x9340('0x6')](config[_0x9340('0x5')],{'host':_0x9340('0x7'),'port':0x18eb});var socket=require(_0x9340('0x8'))(new Redis(config[_0x9340('0x5')]));require(_0x9340('0x9'))[_0x9340('0xa')](socket);try{if(!process[_0x9340('0xb')][0x2]||process[_0x9340('0xb')][0x2]==='undefined'||process[_0x9340('0xb')][0x2]===_0x9340('0xc')){throw new Error(_0x9340('0xd'));}var FILEPATH=process[_0x9340('0xb')][0x2];if(!process[_0x9340('0xb')][0x3]||process['argv'][0x3]==='undefined'||process[_0x9340('0xb')][0x3]===_0x9340('0xc')||!process[_0x9340('0xb')][0x4]||process[_0x9340('0xb')][0x4]===_0x9340('0xe')||process[_0x9340('0xb')][0x4]===_0x9340('0xc')){throw new Error(_0x9340('0xf'));}var FIELDS=_[_0x9340('0x10')](process[_0x9340('0xb')][0x3][_0x9340('0x11')](','),process['argv'][0x4]['split'](','));if(!process[_0x9340('0xb')][0x5]||process['argv'][0x5]===_0x9340('0xe')||process[_0x9340('0xb')][0x5]===_0x9340('0xc')){throw new Error(_0x9340('0x12'));}var LISTID=process[_0x9340('0xb')][0x5];var COMPANYID=process[_0x9340('0xb')][0x6]&&process['argv'][0x6]!==_0x9340('0xe')&&process['argv'][0x6]!=='null'?process[_0x9340('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x9340('0xb')][0x7]!==_0x9340('0xe')&&process['argv'][0x7]!==_0x9340('0xc')?process['argv'][0x7]:null;if(!process[_0x9340('0xb')][0x8]||process[_0x9340('0xb')][0x8]===_0x9340('0xe')||process[_0x9340('0xb')][0x8]===_0x9340('0xc')){throw new Error(_0x9340('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x451173){logger['error'](_0x451173);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(_0x57bcfe,_0x384500,_0x22a9a9,_0x4bbe54){var _0x463d54={'message':_0x384500};_0x463d54[_0x57bcfe]=!![];if(_0x22a9a9){_0x463d54['contact']=_0x22a9a9;}if(_0x4bbe54){_0x463d54[_0x9340('0x14')]=_0x4bbe54;}return _0x463d54;}function isEmail(_0x2f8b3a){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))*$/[_0x9340('0x15')](_0x2f8b3a);}function checkRow(_0x50ca8c,_0x1fb502,_0xe36545){return new BPromise(function(_0x51d03c,_0x2f485b){if(_[_0x9340('0x16')](_0x50ca8c)){return _0x2f485b(handleCheckRowError(_0x9340('0x17'),_0x9340('0x18'),null,_0xe36545));}if(_0x50ca8c[_0x9340('0x19')]&&_0x50ca8c[_0x9340('0x19')]['length']){var _0x4cff36=_[_0x9340('0x1a')](_0x50ca8c[_0x9340('0x19')],_0x9340('0x1b'))[_0x9340('0x1c')](';');return _0x2f485b(handleCheckRowError(_0x9340('0x17'),_0x4cff36,null,_0xe36545));}var _0xae827b={};for(var _0x372f89 in FIELDS){if(FIELDS[_0x9340('0x1d')](_0x372f89)&&FIELDS[_0x372f89]){_0xae827b[_0x372f89]=_0x50ca8c[_0x9340('0x1e')][0x0][FIELDS[_0x372f89]]||_0x50ca8c[_0x9340('0x1e')][0x0]['\ufeff'+FIELDS[_0x372f89]];}}if(!_0xae827b[_0x9340('0x1f')]){return _0x2f485b(handleCheckRowError('error',_0x9340('0x20'),null,_0xe36545));}if(!_0xae827b['phone']){return _0x2f485b(handleCheckRowError(_0x9340('0x17'),_0x9340('0x21'),null,_0xe36545));}if(_0xae827b['birthDate']){var _0x1f50a0=moment(_0xae827b['birthDate'],_0x9340('0x22'));if(!_0x1f50a0['isValid']()){return _0x2f485b(handleCheckRowError('error',_0x9340('0x23'),null,_0xe36545));}}if(_0xae827b[_0x9340('0x24')]){if(!isEmail(_0xae827b[_0x9340('0x24')])){return _0x2f485b(handleCheckRowError(_0x9340('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0xe36545));}}_0xae827b[_0x9340('0x25')]=LISTID;_0xae827b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9340('0x26')]&&_0x1fb502){var _0x1a0fef={};for(var _0x2fbd4c=0x0,_0x34ad97=DUPLICATES['length'];_0x2fbd4c<_0x34ad97;_0x2fbd4c+=0x1){_0x1a0fef[DUPLICATES[_0x2fbd4c]]=_0xae827b[DUPLICATES[_0x2fbd4c]];}var _0x4a9694=_[_0x9340('0x27')](_0x1fb502,_0x1a0fef);if(_0x4a9694){return _0x2f485b(handleCheckRowError(_0x9340('0x28'),_0x9340('0x29'),_0x4a9694,_0xe36545));}}return db[_0x9340('0x2a')][_0x9340('0x2b')](_0xae827b,{'raw':!![],'hooks':![],'fields':_[_0x9340('0x2c')](_0xae827b)})[_0x9340('0x2d')](function(_0x4b5af6){if(DUPLICATES&&DUPLICATES[_0x9340('0x26')]&&_0x1fb502){_0x1fb502[_0x9340('0x2e')](_['pick'](_0xae827b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4b5af6['id'];return _0x51d03c();})[_0x9340('0x2f')](function(_0x34f567){return _0x2f485b(handleCheckRowError(_0x9340('0x17'),_0x9340('0x30')+(_0x34f567[_0x9340('0x1b')]||JSON['stringify'](_0x34f567)),null,_0xe36545));});});}function checkHopper(){function _0x53c95b(){return function(_0x2c2848){logger[_0x9340('0x17')](_0x9340('0x31'),_0x9340('0x32'),util[_0x9340('0x33')](_0x2c2848,{'showHidden':![],'depth':null}));};}var _0x4e82ee=function(_0x29c50b,_0x309270){var _0x5ef8ab=squel['insert']()[_0x9340('0x34')](_0x9340('0x35'))['fromQuery']([_0x9340('0x36'),_0x9340('0x37'),_0x9340('0x38'),_0x9340('0x25'),_0x309270,_0x9340('0x39'),_0x9340('0x3a')],squel[_0x9340('0x3b')]()['field']('phone',_0x9340('0x36'))['field'](_0x9340('0x3c'),_0x9340('0x37'))[_0x9340('0x3d')]('id','ContactId')[_0x9340('0x3d')](LISTID[_0x9340('0x3e')](),_0x9340('0x25'))['field'](_0x29c50b['id'][_0x9340('0x3e')](),_0x309270)[_0x9340('0x3d')](_0x9340('0x3c'),_0x9340('0x39'))[_0x9340('0x3d')]('NOW()',_0x9340('0x3a'))[_0x9340('0x3f')](_0x9340('0x40'))[_0x9340('0x41')](_0x9340('0x42'))[_0x9340('0x41')](_0x9340('0x43'),LISTID['toString']())['where'](_0x9340('0x44'))['where'](_0x9340('0x45'),squel[_0x9340('0x3b')]()[_0x9340('0x3d')]('phone')['from'](_0x9340('0x35'))[_0x9340('0x41')](_0x309270+_0x9340('0x46'),_0x29c50b['id'][_0x9340('0x3e')]())))[_0x9340('0x3e')]();return _0x5ef8ab;};var _0x1779ae=function(_0x1cca0e,_0xd2dfe1){var _0x4148e6=squel[_0x9340('0x47')]()['into']('cm_hopper')['fromQuery']([_0x9340('0x36'),_0x9340('0x37'),_0x9340('0x38'),_0x9340('0x25'),_0xd2dfe1,_0x9340('0x39'),_0x9340('0x3a')],squel[_0x9340('0x3b')]()['field'](_0x9340('0x36'),'phone')[_0x9340('0x3d')]('NOW()',_0x9340('0x37'))[_0x9340('0x3d')]('id',_0x9340('0x38'))[_0x9340('0x3d')](LISTID[_0x9340('0x3e')](),_0x9340('0x25'))[_0x9340('0x3d')](_0x1cca0e['id']['toString'](),_0xd2dfe1)[_0x9340('0x3d')]('NOW()',_0x9340('0x39'))['field']('NOW()',_0x9340('0x3a'))[_0x9340('0x3f')]('cm_contacts')[_0x9340('0x41')](_0x9340('0x42'))[_0x9340('0x41')](_0x9340('0x43'),LISTID[_0x9340('0x3e')]())[_0x9340('0x41')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x9340('0x41')](_0x9340('0x44'))[_0x9340('0x41')](_0x9340('0x45'),squel['select']()[_0x9340('0x3d')](_0x9340('0x48'))[_0x9340('0x3f')]('cm_hopper_final')[_0x9340('0x41')](_0xd2dfe1+_0x9340('0x46'),_0x1cca0e['id']['toString']()))[_0x9340('0x41')](_0x9340('0x45'),squel[_0x9340('0x3b')]()[_0x9340('0x3d')]('phone')['from'](_0x9340('0x35'))[_0x9340('0x41')](_0xd2dfe1+_0x9340('0x46'),_0x1cca0e['id'][_0x9340('0x3e')]())))['toString']();return _0x4148e6;};function _0xf86423(_0x4aa628,_0x3729f8){var _0x3f69f2=squel[_0x9340('0x47')]()[_0x9340('0x34')]('cm_hopper')['fromQuery'](['phone',_0x9340('0x37'),_0x9340('0x38'),_0x9340('0x25'),_0x3729f8,_0x9340('0x39'),'updatedAt'],squel[_0x9340('0x3b')]()[_0x9340('0x3d')](_0x9340('0x36'),_0x9340('0x36'))['field'](_0x9340('0x3c'),_0x9340('0x37'))['field']('id',_0x9340('0x38'))['field'](LISTID[_0x9340('0x3e')](),_0x9340('0x25'))[_0x9340('0x3d')](_0x4aa628['id'][_0x9340('0x3e')](),_0x3729f8)[_0x9340('0x3d')](_0x9340('0x3c'),_0x9340('0x39'))['field']('NOW()',_0x9340('0x3a'))[_0x9340('0x3f')]('cm_contacts')[_0x9340('0x41')](_0x9340('0x42'))[_0x9340('0x41')]('ListId\x20=\x20?',LISTID[_0x9340('0x3e')]())[_0x9340('0x41')](_0x9340('0x49'),squel['str'](hopperContacts))[_0x9340('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x9340('0x3e')]();return _0x3f69f2;}function _0x188c84(_0x2eaee1,_0x290f74){var _0x127c78=squel[_0x9340('0x47')]()[_0x9340('0x34')](_0x9340('0x4a'))[_0x9340('0x4b')]([_0x9340('0x36'),_0x9340('0x38'),_0x9340('0x25'),_0x290f74,'createdAt',_0x9340('0x3a')],squel[_0x9340('0x3b')]()['field'](_0x9340('0x36'),_0x9340('0x36'))[_0x9340('0x3d')]('id','ContactId')[_0x9340('0x3d')](LISTID[_0x9340('0x3e')](),'ListId')[_0x9340('0x3d')](_0x2eaee1['id'][_0x9340('0x3e')](),_0x290f74)[_0x9340('0x3d')](_0x9340('0x3c'),_0x9340('0x39'))[_0x9340('0x3d')](_0x9340('0x3c'),'updatedAt')['from']('cm_contacts')['where'](_0x9340('0x42'))[_0x9340('0x41')](_0x9340('0x43'),LISTID[_0x9340('0x3e')]())[_0x9340('0x41')](_0x9340('0x49'),squel[_0x9340('0x4c')](hopperContacts))[_0x9340('0x41')](_0x9340('0x44')))[_0x9340('0x3e')]();return _0x127c78;}return db['VoiceQueue'][_0x9340('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0x9340('0x4e')],'include':[{'model':db[_0x9340('0x4f')],'as':_0x9340('0x50'),'where':{'id':LISTID}}]})[_0x9340('0x2d')](function(_0xbe23dd){var _0x56a7ba=[];if(_0xbe23dd){var _0x42060d;for(var _0x5935b3=0x0,_0x6162fc;_0x5935b3<_0xbe23dd[_0x9340('0x26')];_0x5935b3+=0x1){_0x6162fc=_0xbe23dd[_0x5935b3][_0x9340('0x51')]({'plain':!![]});switch(_0x6162fc['dialCheckDuplicateType']){case'always':_0x56a7ba[_0x9340('0x2e')](db[_0x9340('0x52')]['query'](_0x1779ae(_0x6162fc,_0x9340('0x53')))[_0x9340('0x2d')](function(){})[_0x9340('0x2f')](_0x53c95b()));break;case'onlyIfOpen':_0x56a7ba[_0x9340('0x2e')](db[_0x9340('0x52')]['query'](_0x4e82ee(_0x6162fc,_0x9340('0x53')))['then'](function(){})['catch'](_0x53c95b()));break;default:_0x56a7ba[_0x9340('0x2e')](db['sequelize'][_0x9340('0x54')](_0xf86423(_0x6162fc,_0x9340('0x53')))[_0x9340('0x2d')](function(){})['catch'](_0x53c95b()));}}}return _0x56a7ba;})[_0x9340('0x55')]()[_0x9340('0x2d')](function(){return db[_0x9340('0x56')][_0x9340('0x4d')]({'where':{'type':_0x9340('0x57')},'attributes':['id'],'include':[{'model':db[_0x9340('0x4f')],'as':_0x9340('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x22d739){var _0x4d3ad1=[];if(_0x22d739){var _0x318255;for(var _0x4e842e=0x0,_0x21219e;_0x4e842e<_0x22d739[_0x9340('0x26')];_0x4e842e+=0x1){_0x21219e=_0x22d739[_0x4e842e][_0x9340('0x51')]({'plain':!![]});_0x4d3ad1[_0x9340('0x2e')](db[_0x9340('0x52')][_0x9340('0x54')](_0x188c84(_0x21219e,'VoiceQueueId'))[_0x9340('0x2d')](function(){})[_0x9340('0x2f')](_0x53c95b()));}}return _0x4d3ad1;})[_0x9340('0x55')]();})['then'](function(){return db[_0x9340('0x59')]['findAll']({'attributes':['id',_0x9340('0x4e')],'include':[{'model':db[_0x9340('0x4f')],'as':_0x9340('0x50'),'where':{'id':LISTID}}]})[_0x9340('0x2d')](function(_0x18cedc){var _0x426903=[];if(_0x18cedc){for(var _0x89b151=0x0,_0x3c7fec;_0x89b151<_0x18cedc[_0x9340('0x26')];_0x89b151+=0x1){_0x3c7fec=_0x18cedc[_0x89b151][_0x9340('0x51')]({'plain':!![]});switch(_0x3c7fec[_0x9340('0x4e')]){case _0x9340('0x5a'):_0x426903['push'](db[_0x9340('0x52')]['query'](_0x1779ae(_0x3c7fec,_0x9340('0x5b')))[_0x9340('0x2d')](function(){})[_0x9340('0x2f')](_0x53c95b()));break;case _0x9340('0x5c'):_0x426903['push'](db[_0x9340('0x52')][_0x9340('0x54')](_0x4e82ee(_0x3c7fec,_0x9340('0x5b')))[_0x9340('0x2d')](function(){})['catch'](_0x53c95b()));break;default:_0x426903['push'](db['sequelize']['query'](_0xf86423(_0x3c7fec,_0x9340('0x5b')))[_0x9340('0x2d')](function(){})['catch'](_0x53c95b()));}}}return _0x426903;})[_0x9340('0x55')]();})['then'](function(){return db['Campaign'][_0x9340('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x9340('0x4f')],'as':_0x9340('0x58'),'where':{'id':LISTID}}]})[_0x9340('0x2d')](function(_0x46cb27){var _0x41e587=[];if(_0x46cb27){for(var _0x358f69=0x0,_0x2bec4c;_0x358f69<_0x46cb27[_0x9340('0x26')];_0x358f69+=0x1){_0x2bec4c=_0x46cb27[_0x358f69]['get']({'plain':!![]});_0x41e587[_0x9340('0x2e')](db[_0x9340('0x52')][_0x9340('0x54')](_0x188c84(_0x2bec4c,_0x9340('0x5b')))[_0x9340('0x2d')](function(){})['catch'](_0x53c95b()));}}return _0x41e587;})[_0x9340('0x55')]();})[_0x9340('0x2f')](function(_0x18056b){logger[_0x9340('0x17')](_0x9340('0x5d'),_0x9340('0x5e'),_0x18056b['message']);});}var processPromises=function(_0x355720){return BPromise[_0x9340('0x55')](promises)[_0x9340('0x2d')](function(_0x10ef6d){})[_0x9340('0x2f')](function(_0x456692){logger['error'](_0x9340('0x5f'),JSON[_0x9340('0x60')](_0x456692));})[_0x9340('0x61')](function(){socket['emit'](_0x9340('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x355720){return _0x355720[_0x9340('0x63')]();}});};var endCsv=function(){return BPromise[_0x9340('0x64')]()[_0x9340('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x9340('0x65')](_0x9340('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1a426a){logger[_0x9340('0x17')](_0x9340('0x66'),JSON['stringify'](_0x1a426a));}finally{process[_0x9340('0x67')](0x0);}});};process['on'](_0x9340('0x68'),function(){logger[_0x9340('0x69')](_0x9340('0x6a'));endCsv();});function main(){return BPromise[_0x9340('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x9340('0x11')](',');return db[_0x9340('0x2a')][_0x9340('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1fcff6){var _0x2c4eba=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c4eba,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bebe6,_0x3bef2e){total+=0x1;var _0x3c9f00=total;promises[_0x9340('0x2e')](checkRow(_0x1bebe6,_0x1fcff6,_0x3c9f00)[_0x9340('0x2d')](function(){success+=0x1;})[_0x9340('0x2f')](function(_0x5547dd){if(_0x5547dd['error']){errors+=0x1;delete _0x5547dd[_0x9340('0x17')];}else if(_0x5547dd[_0x9340('0x28')]){duplicates+=0x1;delete _0x5547dd['duplicate'];}rows[_0x9340('0x2e')](_0x5547dd);}));if(total%0xc8===0x0){_0x3bef2e[_0x9340('0x6b')]();return processPromises(_0x3bef2e);}},'complete':function(){return processPromises()[_0x9340('0x2d')](function(){logger[_0x9340('0x69')](_0x9340('0x6c'));endCsv();});},'error':function(_0x504cc2,_0x2c3643){logger[_0x9340('0x69')]('CSV\x20parse\x20error',JSON[_0x9340('0x60')](_0x504cc2));endCsv();}});})[_0x9340('0x2f')](function(_0x42da5d){logger[_0x9340('0x17')](_0x9340('0x6d'),JSON[_0x9340('0x60')](_0x42da5d));});}main(); \ No newline at end of file +var _0xb708=['query','VoiceQueueId','onlyIfOpen','catch','VoiceQueue','outbound','BlackLists','all','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','map','message','join','hasOwnProperty','data','firstName','phone','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','str','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','Lists','get','sequelize'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb708,0x8b));var _0x8b70=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0xb708[_0xd8a8af];return _0x5b7278;};'use strict';var BPromise=require(_0x8b70('0x0'));var util=require(_0x8b70('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x8b70('0x2'));var Papa=require('papaparse');var Redis=require(_0x8b70('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x8b70('0x4'));var logger=require(_0x8b70('0x5'))(_0x8b70('0x6'));config[_0x8b70('0x7')]=_[_0x8b70('0x8')](config[_0x8b70('0x7')],{'host':_0x8b70('0x9'),'port':0x18eb});var socket=require(_0x8b70('0xa'))(new Redis(config[_0x8b70('0x7')]));require(_0x8b70('0xb'))[_0x8b70('0xc')](socket);try{if(!process[_0x8b70('0xd')][0x2]||process[_0x8b70('0xd')][0x2]==='undefined'||process[_0x8b70('0xd')][0x2]===_0x8b70('0xe')){throw new Error(_0x8b70('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0x8b70('0xd')][0x3]||process[_0x8b70('0xd')][0x3]===_0x8b70('0x10')||process[_0x8b70('0xd')][0x3]===_0x8b70('0xe')||!process[_0x8b70('0xd')][0x4]||process['argv'][0x4]===_0x8b70('0x10')||process[_0x8b70('0xd')][0x4]===_0x8b70('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x8b70('0x11')](process['argv'][0x3]['split'](','),process[_0x8b70('0xd')][0x4][_0x8b70('0x12')](','));if(!process[_0x8b70('0xd')][0x5]||process[_0x8b70('0xd')][0x5]===_0x8b70('0x10')||process['argv'][0x5]===_0x8b70('0xe')){throw new Error(_0x8b70('0x13'));}var LISTID=process[_0x8b70('0xd')][0x5];var COMPANYID=process[_0x8b70('0xd')][0x6]&&process[_0x8b70('0xd')][0x6]!==_0x8b70('0x10')&&process[_0x8b70('0xd')][0x6]!==_0x8b70('0xe')?process[_0x8b70('0xd')][0x6]:null;var DUPLICATES=process[_0x8b70('0xd')][0x7]&&process[_0x8b70('0xd')][0x7]!=='undefined'&&process['argv'][0x7]!=='null'?process[_0x8b70('0xd')][0x7]:null;if(!process[_0x8b70('0xd')][0x8]||process[_0x8b70('0xd')][0x8]===_0x8b70('0x10')||process['argv'][0x8]===_0x8b70('0xe')){throw new Error(_0x8b70('0x14'));}var SOCKET_TIMESTAMP=process[_0x8b70('0xd')][0x8];}catch(_0x1dd4f8){logger[_0x8b70('0x15')](_0x1dd4f8);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(_0x584513,_0x3a97c1,_0x4490c3,_0x25e538){var _0x36fac2={'message':_0x3a97c1};_0x36fac2[_0x584513]=!![];if(_0x4490c3){_0x36fac2[_0x8b70('0x16')]=_0x4490c3;}if(_0x25e538){_0x36fac2[_0x8b70('0x17')]=_0x25e538;}return _0x36fac2;}function isEmail(_0x57d274){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))*$/[_0x8b70('0x18')](_0x57d274);}function checkRow(_0x1c4c14,_0x18e066,_0x3908fd){return new BPromise(function(_0x15b975,_0x56ad34){if(_[_0x8b70('0x19')](_0x1c4c14)){return _0x56ad34(handleCheckRowError(_0x8b70('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3908fd));}if(_0x1c4c14[_0x8b70('0x1a')]&&_0x1c4c14[_0x8b70('0x1a')]['length']){var _0x7d53a8=_[_0x8b70('0x1b')](_0x1c4c14[_0x8b70('0x1a')],_0x8b70('0x1c'))[_0x8b70('0x1d')](';');return _0x56ad34(handleCheckRowError(_0x8b70('0x15'),_0x7d53a8,null,_0x3908fd));}var _0x3c93ab={};for(var _0x10ce62 in FIELDS){if(FIELDS[_0x8b70('0x1e')](_0x10ce62)&&FIELDS[_0x10ce62]){_0x3c93ab[_0x10ce62]=_0x1c4c14[_0x8b70('0x1f')][0x0][FIELDS[_0x10ce62]]||_0x1c4c14[_0x8b70('0x1f')][0x0]['\ufeff'+FIELDS[_0x10ce62]];}}if(!_0x3c93ab[_0x8b70('0x20')]){return _0x56ad34(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x3908fd));}if(!_0x3c93ab[_0x8b70('0x21')]){return _0x56ad34(handleCheckRowError(_0x8b70('0x15'),'phone\x20not\x20specified!',null,_0x3908fd));}if(_0x3c93ab['birthDate']){var _0x5a7d3a=moment(_0x3c93ab['birthDate'],_0x8b70('0x22'));if(!_0x5a7d3a[_0x8b70('0x23')]()){return _0x56ad34(handleCheckRowError(_0x8b70('0x15'),_0x8b70('0x24'),null,_0x3908fd));}}if(_0x3c93ab[_0x8b70('0x25')]){if(!isEmail(_0x3c93ab[_0x8b70('0x25')])){return _0x56ad34(handleCheckRowError(_0x8b70('0x15'),_0x8b70('0x26'),null,_0x3908fd));}}_0x3c93ab['ListId']=LISTID;_0x3c93ab[_0x8b70('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8b70('0x28')]&&_0x18e066){var _0x2b843e={};for(var _0x2bb982=0x0,_0x23bc96=DUPLICATES[_0x8b70('0x28')];_0x2bb982<_0x23bc96;_0x2bb982+=0x1){_0x2b843e[DUPLICATES[_0x2bb982]]=_0x3c93ab[DUPLICATES[_0x2bb982]];}var _0x35b1d9=_['find'](_0x18e066,_0x2b843e);if(_0x35b1d9){return _0x56ad34(handleCheckRowError(_0x8b70('0x29'),_0x8b70('0x2a'),_0x35b1d9,_0x3908fd));}}return db['CmContact'][_0x8b70('0x2b')](_0x3c93ab,{'raw':!![],'hooks':![],'fields':_[_0x8b70('0x2c')](_0x3c93ab)})[_0x8b70('0x2d')](function(_0x245987){if(DUPLICATES&&DUPLICATES[_0x8b70('0x28')]&&_0x18e066){_0x18e066[_0x8b70('0x2e')](_[_0x8b70('0x2f')](_0x3c93ab,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x245987['id'];return _0x15b975();})['catch'](function(_0x451650){return _0x56ad34(handleCheckRowError('error',_0x8b70('0x30')+(_0x451650[_0x8b70('0x1c')]||JSON[_0x8b70('0x31')](_0x451650)),null,_0x3908fd));});});}function checkHopper(){function _0x31d138(){return function(_0x472fb3){logger[_0x8b70('0x15')](_0x8b70('0x32'),_0x8b70('0x33'),util[_0x8b70('0x34')](_0x472fb3,{'showHidden':![],'depth':null}));};}var _0x38d90b=function(_0x259f21,_0xf43724){var _0x476fda=squel[_0x8b70('0x35')]()['into'](_0x8b70('0x36'))[_0x8b70('0x37')]([_0x8b70('0x21'),_0x8b70('0x38'),_0x8b70('0x39'),_0x8b70('0x3a'),_0xf43724,_0x8b70('0x3b'),_0x8b70('0x3c')],squel[_0x8b70('0x3d')]()[_0x8b70('0x3e')]('phone','phone')[_0x8b70('0x3e')](_0x8b70('0x3f'),'scheduledAt')[_0x8b70('0x3e')]('id','ContactId')['field'](LISTID[_0x8b70('0x40')](),_0x8b70('0x3a'))['field'](_0x259f21['id'][_0x8b70('0x40')](),_0xf43724)[_0x8b70('0x3e')]('NOW()',_0x8b70('0x3b'))[_0x8b70('0x3e')](_0x8b70('0x3f'),_0x8b70('0x3c'))[_0x8b70('0x41')](_0x8b70('0x42'))[_0x8b70('0x43')](_0x8b70('0x44'))['where'](_0x8b70('0x45'),LISTID[_0x8b70('0x40')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x8b70('0x43')](_0x8b70('0x46'),squel['select']()[_0x8b70('0x3e')]('phone')[_0x8b70('0x41')](_0x8b70('0x36'))[_0x8b70('0x43')](_0xf43724+_0x8b70('0x47'),_0x259f21['id']['toString']())))[_0x8b70('0x40')]();return _0x476fda;};var _0x534229=function(_0x23db5b,_0x2d723b){var _0x2ffc48=squel[_0x8b70('0x35')]()[_0x8b70('0x48')](_0x8b70('0x36'))['fromQuery'](['phone',_0x8b70('0x38'),_0x8b70('0x39'),_0x8b70('0x3a'),_0x2d723b,_0x8b70('0x3b'),'updatedAt'],squel[_0x8b70('0x3d')]()[_0x8b70('0x3e')](_0x8b70('0x21'),_0x8b70('0x21'))[_0x8b70('0x3e')](_0x8b70('0x3f'),'scheduledAt')[_0x8b70('0x3e')]('id',_0x8b70('0x39'))['field'](LISTID[_0x8b70('0x40')](),_0x8b70('0x3a'))[_0x8b70('0x3e')](_0x23db5b['id'][_0x8b70('0x40')](),_0x2d723b)[_0x8b70('0x3e')](_0x8b70('0x3f'),_0x8b70('0x3b'))[_0x8b70('0x3e')]('NOW()',_0x8b70('0x3c'))['from']('cm_contacts')['where'](_0x8b70('0x44'))[_0x8b70('0x43')]('ListId\x20=\x20?',LISTID[_0x8b70('0x40')]())[_0x8b70('0x43')](_0x8b70('0x49'),squel['str'](hopperContacts))[_0x8b70('0x43')](_0x8b70('0x4a'))[_0x8b70('0x43')](_0x8b70('0x46'),squel['select']()[_0x8b70('0x3e')](_0x8b70('0x4b'))[_0x8b70('0x41')](_0x8b70('0x4c'))[_0x8b70('0x43')](_0x2d723b+_0x8b70('0x47'),_0x23db5b['id']['toString']()))[_0x8b70('0x43')](_0x8b70('0x46'),squel[_0x8b70('0x3d')]()[_0x8b70('0x3e')](_0x8b70('0x21'))[_0x8b70('0x41')](_0x8b70('0x36'))['where'](_0x2d723b+'\x20=\x20?',_0x23db5b['id'][_0x8b70('0x40')]())))[_0x8b70('0x40')]();return _0x2ffc48;};function _0x3ee589(_0x443782,_0x44c82f){var _0x5ace88=squel[_0x8b70('0x35')]()[_0x8b70('0x48')](_0x8b70('0x36'))['fromQuery']([_0x8b70('0x21'),'scheduledAt','ContactId',_0x8b70('0x3a'),_0x44c82f,_0x8b70('0x3b'),_0x8b70('0x3c')],squel[_0x8b70('0x3d')]()['field']('phone',_0x8b70('0x21'))['field'](_0x8b70('0x3f'),_0x8b70('0x38'))[_0x8b70('0x3e')]('id',_0x8b70('0x39'))[_0x8b70('0x3e')](LISTID[_0x8b70('0x40')](),_0x8b70('0x3a'))[_0x8b70('0x3e')](_0x443782['id'][_0x8b70('0x40')](),_0x44c82f)[_0x8b70('0x3e')]('NOW()','createdAt')[_0x8b70('0x3e')](_0x8b70('0x3f'),_0x8b70('0x3c'))['from'](_0x8b70('0x42'))[_0x8b70('0x43')]('deletedAt\x20IS\x20NULL')['where'](_0x8b70('0x45'),LISTID[_0x8b70('0x40')]())[_0x8b70('0x43')]('id\x20IN\x20?',squel[_0x8b70('0x4d')](hopperContacts))[_0x8b70('0x43')](_0x8b70('0x4a')))[_0x8b70('0x40')]();return _0x5ace88;}function _0x52e7cd(_0x2d80e8,_0x16007c){var _0x50700f=squel[_0x8b70('0x35')]()[_0x8b70('0x48')](_0x8b70('0x4e'))[_0x8b70('0x37')](['phone',_0x8b70('0x39'),'ListId',_0x16007c,_0x8b70('0x3b'),'updatedAt'],squel[_0x8b70('0x3d')]()[_0x8b70('0x3e')](_0x8b70('0x21'),_0x8b70('0x21'))['field']('id','ContactId')[_0x8b70('0x3e')](LISTID[_0x8b70('0x40')](),_0x8b70('0x3a'))[_0x8b70('0x3e')](_0x2d80e8['id'][_0x8b70('0x40')](),_0x16007c)[_0x8b70('0x3e')]('NOW()',_0x8b70('0x3b'))[_0x8b70('0x3e')](_0x8b70('0x3f'),'updatedAt')[_0x8b70('0x41')](_0x8b70('0x42'))[_0x8b70('0x43')](_0x8b70('0x44'))['where'](_0x8b70('0x45'),LISTID[_0x8b70('0x40')]())[_0x8b70('0x43')](_0x8b70('0x49'),squel[_0x8b70('0x4d')](hopperContacts))['where'](_0x8b70('0x4a')))[_0x8b70('0x40')]();return _0x50700f;}return db['VoiceQueue'][_0x8b70('0x4f')]({'where':{'type':'outbound'},'attributes':['id',_0x8b70('0x50')],'include':[{'model':db[_0x8b70('0x51')],'as':_0x8b70('0x52'),'where':{'id':LISTID}}]})[_0x8b70('0x2d')](function(_0x53c06f){var _0x4c5af8=[];if(_0x53c06f){var _0x2cfde2;for(var _0x5f4f6f=0x0,_0x554b01;_0x5f4f6f<_0x53c06f[_0x8b70('0x28')];_0x5f4f6f+=0x1){_0x554b01=_0x53c06f[_0x5f4f6f][_0x8b70('0x53')]({'plain':!![]});switch(_0x554b01[_0x8b70('0x50')]){case'always':_0x4c5af8[_0x8b70('0x2e')](db[_0x8b70('0x54')][_0x8b70('0x55')](_0x534229(_0x554b01,_0x8b70('0x56')))[_0x8b70('0x2d')](function(){})['catch'](_0x31d138()));break;case _0x8b70('0x57'):_0x4c5af8[_0x8b70('0x2e')](db[_0x8b70('0x54')][_0x8b70('0x55')](_0x38d90b(_0x554b01,_0x8b70('0x56')))[_0x8b70('0x2d')](function(){})[_0x8b70('0x58')](_0x31d138()));break;default:_0x4c5af8['push'](db['sequelize'][_0x8b70('0x55')](_0x3ee589(_0x554b01,_0x8b70('0x56')))[_0x8b70('0x2d')](function(){})[_0x8b70('0x58')](_0x31d138()));}}}return _0x4c5af8;})['all']()[_0x8b70('0x2d')](function(){return db[_0x8b70('0x59')][_0x8b70('0x4f')]({'where':{'type':_0x8b70('0x5a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x8b70('0x5b'),'where':{'id':LISTID}}]})[_0x8b70('0x2d')](function(_0x45eaef){var _0x3ae798=[];if(_0x45eaef){var _0x1cdaf3;for(var _0x43b5cb=0x0,_0x5aa248;_0x43b5cb<_0x45eaef[_0x8b70('0x28')];_0x43b5cb+=0x1){_0x5aa248=_0x45eaef[_0x43b5cb][_0x8b70('0x53')]({'plain':!![]});_0x3ae798[_0x8b70('0x2e')](db[_0x8b70('0x54')]['query'](_0x52e7cd(_0x5aa248,_0x8b70('0x56')))['then'](function(){})['catch'](_0x31d138()));}}return _0x3ae798;})[_0x8b70('0x5c')]();})[_0x8b70('0x2d')](function(){return db[_0x8b70('0x5d')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8b70('0x51')],'as':_0x8b70('0x52'),'where':{'id':LISTID}}]})[_0x8b70('0x2d')](function(_0x2d3c50){var _0x131fd0=[];if(_0x2d3c50){for(var _0x1af09c=0x0,_0x3ba7bb;_0x1af09c<_0x2d3c50[_0x8b70('0x28')];_0x1af09c+=0x1){_0x3ba7bb=_0x2d3c50[_0x1af09c][_0x8b70('0x53')]({'plain':!![]});switch(_0x3ba7bb['dialCheckDuplicateType']){case _0x8b70('0x5e'):_0x131fd0['push'](db['sequelize'][_0x8b70('0x55')](_0x534229(_0x3ba7bb,_0x8b70('0x5f')))[_0x8b70('0x2d')](function(){})[_0x8b70('0x58')](_0x31d138()));break;case'onlyIfOpen':_0x131fd0[_0x8b70('0x2e')](db[_0x8b70('0x54')][_0x8b70('0x55')](_0x38d90b(_0x3ba7bb,_0x8b70('0x5f')))[_0x8b70('0x2d')](function(){})[_0x8b70('0x58')](_0x31d138()));break;default:_0x131fd0[_0x8b70('0x2e')](db[_0x8b70('0x54')][_0x8b70('0x55')](_0x3ee589(_0x3ba7bb,_0x8b70('0x5f')))[_0x8b70('0x2d')](function(){})[_0x8b70('0x58')](_0x31d138()));}}}return _0x131fd0;})[_0x8b70('0x5c')]();})[_0x8b70('0x2d')](function(){return db[_0x8b70('0x5d')][_0x8b70('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x8b70('0x51')],'as':_0x8b70('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0xa9a707){var _0x44fcc1=[];if(_0xa9a707){for(var _0x1774ff=0x0,_0xa1385;_0x1774ff<_0xa9a707[_0x8b70('0x28')];_0x1774ff+=0x1){_0xa1385=_0xa9a707[_0x1774ff][_0x8b70('0x53')]({'plain':!![]});_0x44fcc1[_0x8b70('0x2e')](db[_0x8b70('0x54')]['query'](_0x52e7cd(_0xa1385,_0x8b70('0x5f')))[_0x8b70('0x2d')](function(){})[_0x8b70('0x58')](_0x31d138()));}}return _0x44fcc1;})[_0x8b70('0x5c')]();})['catch'](function(_0x505aaf){logger[_0x8b70('0x15')](_0x8b70('0x60'),'generalCheckHopper',_0x505aaf[_0x8b70('0x1c')]);});}var processPromises=function(_0x5bfe16){return BPromise[_0x8b70('0x5c')](promises)[_0x8b70('0x2d')](function(_0x5114a9){})[_0x8b70('0x58')](function(_0x2aad33){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x8b70('0x31')](_0x2aad33));})[_0x8b70('0x61')](function(){socket[_0x8b70('0x62')](_0x8b70('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5bfe16){return _0x5bfe16[_0x8b70('0x64')]();}});};var endCsv=function(){return BPromise[_0x8b70('0x65')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x8b70('0x62')](_0x8b70('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8b70('0x66')](FILEPATH);}catch(_0x276cfe){logger[_0x8b70('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x8b70('0x31')](_0x276cfe));}finally{process[_0x8b70('0x67')](0x0);}});};process['on'](_0x8b70('0x68'),function(){logger[_0x8b70('0x69')](_0x8b70('0x6a'));endCsv();});function main(){return BPromise[_0x8b70('0x65')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0x8b70('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8b70('0x2d')](function(_0x5c0879){var _0x5ea1da=fs[_0x8b70('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x5ea1da,{'header':!![],'skipEmptyLines':!![],'step':function(_0x69e7fe,_0x5a8a61){total+=0x1;var _0x250596=total;promises[_0x8b70('0x2e')](checkRow(_0x69e7fe,_0x5c0879,_0x250596)[_0x8b70('0x2d')](function(){success+=0x1;})[_0x8b70('0x58')](function(_0x310436){if(_0x310436[_0x8b70('0x15')]){errors+=0x1;delete _0x310436[_0x8b70('0x15')];}else if(_0x310436['duplicate']){duplicates+=0x1;delete _0x310436['duplicate'];}rows[_0x8b70('0x2e')](_0x310436);}));if(total%0xc8===0x0){_0x5a8a61[_0x8b70('0x6c')]();return processPromises(_0x5a8a61);}},'complete':function(){return processPromises()[_0x8b70('0x2d')](function(){logger['info'](_0x8b70('0x6d'));endCsv();});},'error':function(_0x1772e6,_0x28e048){logger[_0x8b70('0x69')](_0x8b70('0x6e'),JSON[_0x8b70('0x31')](_0x1772e6));endCsv();}});})[_0x8b70('0x58')](function(_0x32a7cb){logger[_0x8b70('0x15')](_0x8b70('0x6f'),JSON[_0x8b70('0x31')](_0x32a7cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d704c0e..3e52a93 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 _0xbc77=['campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment/shared','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','AdditionalPhones','then','length','push','all','split','filter','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','ContactId','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','priority','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','message','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','findAll','name','_description','writeFileSync','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists'];(function(_0x5bc76f,_0x2ed7e1){var _0x76152f=function(_0x265e63){while(--_0x265e63){_0x5bc76f['push'](_0x5bc76f['shift']());}};_0x76152f(++_0x2ed7e1);}(_0xbc77,0xc2));var _0x7bc7=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xbc77[_0x237f8b];return _0x423f94;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x7bc7('0x0'));var util=require(_0x7bc7('0x1'));var BPromise=require(_0x7bc7('0x2'));var moment=require(_0x7bc7('0x3'));var squel=require(_0x7bc7('0x4'));var Redis=require(_0x7bc7('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x7bc7('0x6'));var logger=require('../../../config/logger')(_0x7bc7('0x7'));config[_0x7bc7('0x8')]=_['defaults'](config[_0x7bc7('0x8')],{'host':_0x7bc7('0x9'),'port':0x18eb});var socket=require(_0x7bc7('0xa'))(new Redis(config[_0x7bc7('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7bc7('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7bc7('0xc'));function isEmail(_0x16fe67){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))*$/[_0x7bc7('0xd')](_0x16fe67);}function selectNotIn(_0x26de62,_0x55fae2,_0x397afd,_0x512427,_0x14bbc3){return squel[_0x7bc7('0xe')]()[_0x7bc7('0xf')]('phone')[_0x7bc7('0x10')](_0x512427)['join'](_0x55fae2,null,_0x55fae2+_0x7bc7('0x11')+_0x512427+'.'+_0x397afd)[_0x7bc7('0x12')](_0x512427+'.'+_0x397afd+'\x20=\x20'+_0x26de62+'.'+_0x397afd)[_0x7bc7('0x12')](_0x55fae2+_0x7bc7('0x13')+_0x14bbc3[_0x7bc7('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1a7f1c,_0x5cd19a){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x7bc7('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7bc7('0x16')](function(_0x1182da){if(_0x1182da!==null){var _0x1aaab8=[];for(var _0x2ce905=0x0;_0x2ce905<_0x1182da[_0x7bc7('0x17')];_0x2ce905++){var _0x2d25f3=_0x1182da[_0x2ce905];_0x1aaab8[_0x7bc7('0x18')](insertAdditionalPhones(_0x2d25f3));}}Promise[_0x7bc7('0x19')](_0x1aaab8)[_0x7bc7('0x16')](function(){_0x1a7f1c({'val':0x1});});});});}function insertAdditionalPhones(_0x240483){return new Promise(function(_0x5d6b31,_0xa5fa7e){var _0x5c3897=_0x240483[_0x7bc7('0x15')];var _0x418747=_0x5c3897[_0x7bc7('0x1a')](';');var _0x31c2cc=[];orderBy=0x0;for(var _0x43dc80=0x0;_0x43dc80<_0x418747[_0x7bc7('0x17')];_0x43dc80++){_0x31c2cc['push'](splitAdditionalPhone(_0x240483['id'],_0x418747[_0x43dc80]));}Promise[_0x7bc7('0x19')](_0x31c2cc)[_0x7bc7('0x16')](function(){_0x5d6b31({'val':_0x418747[_0x7bc7('0x17')]});});});}function splitAdditionalPhone(_0x476595,_0x3b521b){return new Promise(function(_0x16cdba,_0x3b8851){var _0x309655=_0x3b521b[_0x7bc7('0x1a')](':');var _0x236043=_0x309655[0x0];var _0xf8ff10=_0x309655[0x1];if(!_['isNil'](_0xf8ff10)){var _0x2ec898=_0xf8ff10[_0x7bc7('0x1a')]('|');var _0x293d67=[];for(var _0x5c6bbc=0x0;_0x5c6bbc<_0x2ec898[_0x7bc7('0x17')];_0x5c6bbc++){if(_0x2ec898[_0x5c6bbc]!==''){var _0x2834ca=_[_0x7bc7('0x1b')](promisesAdditionalPhones,{'contactId':_0x476595,'phone':_0x2ec898[_0x5c6bbc]});if(_0x2834ca[_0x7bc7('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x7bc7('0x18')]({'contactId':_0x476595,'contactTypeId':_0x236043,'phone':_0x2ec898[_0x5c6bbc],'orderBy':orderBy});}}}_0x16cdba({'ok':0x1});}else _0x16cdba({'res':0x0});});}function createAdditionalPhone(_0x4c8d5e,_0x37f857,_0x384e51,_0x39968e){var _0x2f04d4='';var _0x40b5a5='';var _0x3b04ac=_0x384e51[_0x7bc7('0x1a')]('§');_0x2f04d4=_0x3b04ac[0x0];if(_0x3b04ac[_0x7bc7('0x17')]==0x2)_0x40b5a5=_0x3b04ac[0x1];return new Promise(function(_0x1e55d1,_0x3b27b8){return db[_0x7bc7('0x1c')][_0x7bc7('0x1d')]({'where':{'CmContactId':_0x4c8d5e,'item':_0x2f04d4}})[_0x7bc7('0x16')](function(_0x1d5300){if(_0x1d5300){return db[_0x7bc7('0x1c')][_0x7bc7('0x1e')]({'ItemTypeId':_0x37f857,'description':_0x40b5a5,'OrderBy':_0x39968e},{'where':{'CmContactId':_0x4c8d5e,'item':_0x2f04d4}})[_0x7bc7('0x16')](function(_0x3288c6){_0x1e55d1({'res':_0x7bc7('0x1f')});});}else{return db[_0x7bc7('0x1c')][_0x7bc7('0x20')]({'CmContactId':_0x4c8d5e,'item':_0x2f04d4,'description':_0x40b5a5,'ItemTypeId':_0x37f857,'OrderBy':_0x39968e,'ItemClass':'PHONE'})[_0x7bc7('0x16')](function(_0x5be076){_0x1e55d1({'res':_0x7bc7('0x21')});});}});});}function insertCmHopper(_0x3eca97,_0x15b3d3,_0x1dcad2,_0x4ab852,_0x405625){var _0x35e3cc=[_0x7bc7('0x22'),_0x7bc7('0x23'),_0x7bc7('0x24'),_0x7bc7('0x25'),_0x15b3d3+'.'+_0x4ab852,'cm_contacts.createdAt',_0x7bc7('0x26'),_0x7bc7('0x27'),_0x7bc7('0x28'),'\x22'+_0x405625+'\x22'];return squel[_0x7bc7('0x29')]()[_0x7bc7('0x2a')](_0x7bc7('0x2b'))[_0x7bc7('0x2c')]([_0x7bc7('0x2d'),_0x7bc7('0x2e'),'ContactId',_0x7bc7('0x2f'),_0x4ab852,_0x7bc7('0x30'),_0x7bc7('0x31'),'priority',_0x7bc7('0x32'),_0x7bc7('0x33')],squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x35e3cc)['from'](_0x15b3d3)[_0x7bc7('0x14')](_0x7bc7('0x35'),null,_0x7bc7('0x36')+_0x15b3d3+_0x7bc7('0x37'))[_0x7bc7('0x14')](_0x1dcad2,null,_0x1dcad2+_0x7bc7('0x11')+_0x15b3d3+'.'+_0x4ab852)[_0x7bc7('0x12')](_0x15b3d3+_0x7bc7('0x38'),_0x3eca97)[_0x7bc7('0x12')](_0x7bc7('0x39'),NOW)[_0x7bc7('0x12')](_0x7bc7('0x3a'),selectNotIn(_0x15b3d3,_0x1dcad2,_0x4ab852,'cm_hopper',[_0x7bc7('0x3b'),_0x7bc7('0x3c')]))[_0x7bc7('0x12')](_0x7bc7('0x3a'),selectNotIn(_0x15b3d3,_0x1dcad2,_0x4ab852,_0x7bc7('0x2b'),[_0x7bc7('0x3b')])))[_0x7bc7('0x3d')]();}function insertCmHopperBlack(_0x565579,_0x1c4e60,_0x92bf7f,_0x38b33d){var _0x52c722=[_0x7bc7('0x22'),_0x7bc7('0x24'),_0x7bc7('0x25'),_0x1c4e60+'.'+_0x38b33d,_0x7bc7('0x3e'),_0x7bc7('0x26')];return squel['insert']()[_0x7bc7('0x2a')](_0x7bc7('0x3f'))['fromQuery']([_0x7bc7('0x2d'),_0x7bc7('0x40'),'ListId',_0x38b33d,_0x7bc7('0x30'),_0x7bc7('0x31')],squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x52c722)[_0x7bc7('0x10')](_0x1c4e60)['join'](_0x7bc7('0x35'),null,_0x7bc7('0x36')+_0x1c4e60+_0x7bc7('0x37'))[_0x7bc7('0x14')](_0x92bf7f,null,_0x92bf7f+_0x7bc7('0x11')+_0x1c4e60+'.'+_0x38b33d)[_0x7bc7('0x12')](_0x1c4e60+_0x7bc7('0x38'),_0x565579)['where'](_0x7bc7('0x39'),NOW)[_0x7bc7('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7bc7('0xe')]()[_0x7bc7('0xf')]('phone')[_0x7bc7('0x10')](_0x7bc7('0x3f'))['where']('ListId\x20=\x20?',_0x565579)[_0x7bc7('0x12')](_0x38b33d+_0x7bc7('0x41')+_0x1c4e60+'.'+_0x38b33d)))[_0x7bc7('0x3d')]();}function insertTzCmHopper(_0x30582f,_0x287c5a,_0x2f29a7,_0x134e29,_0x11b463,_0xa6b9ad){var _0x51fda5=[_0x7bc7('0x22'),_0x7bc7('0x42')+_0xa6b9ad+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x7bc7('0x25'),_0x287c5a+'.'+_0x134e29,_0x7bc7('0x3e'),_0x7bc7('0x26'),_0x7bc7('0x27'),_0x7bc7('0x28'),'\x22'+_0x11b463+'\x22'];var _0x485fe8=squel['insert']()[_0x7bc7('0x2a')](_0x7bc7('0x2b'))[_0x7bc7('0x2c')](['phone','scheduledat',_0x7bc7('0x40'),_0x7bc7('0x2f'),_0x134e29,_0x7bc7('0x30'),_0x7bc7('0x31'),_0x7bc7('0x43'),_0x7bc7('0x32'),'recallme'],squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x51fda5)[_0x7bc7('0x10')](_0x287c5a)['join'](_0x7bc7('0x35'),null,_0x7bc7('0x36')+_0x287c5a+_0x7bc7('0x37'))[_0x7bc7('0x14')](_0x2f29a7,null,_0x2f29a7+_0x7bc7('0x11')+_0x287c5a+'.'+_0x134e29)[_0x7bc7('0x14')](_0xa6b9ad,null,_0xa6b9ad+_0x7bc7('0x11')+_0x287c5a+'.'+_0x134e29)[_0x7bc7('0x12')](_0x287c5a+_0x7bc7('0x38'),_0x30582f)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7bc7('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x287c5a,_0x2f29a7,_0x134e29,_0x7bc7('0x2b'),[_0x7bc7('0x3b'),_0x7bc7('0x3c')]))[_0x7bc7('0x12')](_0x7bc7('0x3a'),selectNotIn(_0x287c5a,_0x2f29a7,_0x134e29,_0x7bc7('0x2b'),[_0x7bc7('0x3b')])))[_0x7bc7('0x3d')]();return _0x485fe8;}function insertTzCmHopperBlack(_0x16a952,_0x153662,_0x552093,_0x3a72d2){var _0x399965=['cm_contacts.phone',_0x7bc7('0x24'),_0x7bc7('0x25'),_0x153662+'.'+_0x3a72d2,_0x7bc7('0x3e'),'cm_contacts.updatedAt'];return squel[_0x7bc7('0x29')]()[_0x7bc7('0x2a')]('cm_hopper_black')[_0x7bc7('0x2c')](['phone',_0x7bc7('0x40'),_0x7bc7('0x2f'),_0x3a72d2,_0x7bc7('0x30'),_0x7bc7('0x31')],squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x399965)[_0x7bc7('0x10')](_0x153662)['join'](_0x7bc7('0x35'),null,_0x7bc7('0x36')+_0x153662+_0x7bc7('0x37'))[_0x7bc7('0x14')](_0x552093,null,_0x552093+'.id\x20=\x20'+_0x153662+'.'+_0x3a72d2)['where'](_0x153662+_0x7bc7('0x38'),_0x16a952)[_0x7bc7('0x12')](_0x7bc7('0x39'),NOW)[_0x7bc7('0x12')](_0x7bc7('0x3a'),squel[_0x7bc7('0xe')]()[_0x7bc7('0xf')](_0x7bc7('0x2d'))[_0x7bc7('0x10')](_0x7bc7('0x3f'))[_0x7bc7('0x12')](_0x7bc7('0x44'),_0x16a952)[_0x7bc7('0x12')](_0x3a72d2+_0x7bc7('0x41')+_0x153662+'.'+_0x3a72d2)))[_0x7bc7('0x3d')]();}function insertCmHopperAdditionalPhones(_0x530c12){var _0x5d6ad8=[_0x7bc7('0x45'),_0x7bc7('0x46'),'cm_contact_has_items.OrderBy',_0x7bc7('0x47'),'cm_contact_has_items.updatedAt'];return squel[_0x7bc7('0x29')]()[_0x7bc7('0x2a')](_0x7bc7('0x48'))[_0x7bc7('0x2c')]([_0x7bc7('0x49'),'phone',_0x7bc7('0x4a'),_0x7bc7('0x30'),_0x7bc7('0x31')],squel[_0x7bc7('0xe')]()['fields'](_0x5d6ad8)[_0x7bc7('0x10')](_0x7bc7('0x2b'))[_0x7bc7('0x14')](_0x7bc7('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join']('cm_contact_has_items',null,_0x7bc7('0x4b'))['where'](_0x7bc7('0x4c'),_0x530c12)[_0x7bc7('0x12')](_0x7bc7('0x39'),NOW))['toString']();}function insertCmContact(_0x5cba5b,_0x33a040,_0x4ec0f2,_0x8dff91){var _0x23ae47=_[_0x7bc7('0x4d')](_[_0x7bc7('0x4e')](_0x8dff91),[_0x7bc7('0x2f'),'CompanyId',_0x7bc7('0x30'),_0x7bc7('0x31'),_0x7bc7('0x4f')]);return squel[_0x7bc7('0x29')]()[_0x7bc7('0x2a')](_0x7bc7('0x35'))[_0x7bc7('0x2c')](_0x23ae47,squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](_0x23ae47)[_0x7bc7('0x10')](_0x33a040)[_0x7bc7('0x12')]('('+_0x4ec0f2[_0x7bc7('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0x7bc7('0xe')]()['fields'](_0x4ec0f2)[_0x7bc7('0x10')](_0x7bc7('0x35'))[_0x7bc7('0x12')](_0x7bc7('0x44'),_0x5cba5b)[_0x7bc7('0x12')](_0x7bc7('0x50')))[_0x7bc7('0x12')](_0x7bc7('0x51'),squel[_0x7bc7('0xe')]()['field'](_0x7bc7('0x52'),'min_id')['from'](_0x33a040)['group'](_0x4ec0f2[_0x7bc7('0x14')](','))))[_0x7bc7('0x3d')]();}function handleStop(){logger[_0x7bc7('0x53')](_0x7bc7('0x54'));stopped=!![];}function handleUncaughtException(_0x9a3bc2){logger[_0x7bc7('0x55')](_0x9a3bc2[_0x7bc7('0x56')]);process['exit'](0x1);}function handleError(_0xb0e23b,_0xae7792){stats[_0x7bc7('0x57')][_0x7bc7('0x18')]({'name':_0xae7792[_0x7bc7('0x58')],'message':_0xae7792['message'],'row':_0xb0e23b});}function handleQuery(_0x57441e){logger[_0x7bc7('0x53')](_0x57441e);return db[_0x7bc7('0x59')][_0x7bc7('0x5a')](_0x57441e)[_0x7bc7('0x5b')](function(_0x4f9ef1){results[_0x7bc7('0x18')](_0x4f9ef1);})[_0x7bc7('0x5c')](function(_0x39ca94){logger[_0x7bc7('0x55')](_0x39ca94['message']);});}function updateTzCampaigns(_0x19a430){return new Promise(function(_0x39f970,_0x28db6f){var _0x26061d=squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')]([_0x7bc7('0x5d'),_0x7bc7('0x5e')])[_0x7bc7('0x10')]('campaigns')['join']('campaigns_has_cm_lists',null,_0x7bc7('0x5f'))[_0x7bc7('0x12')](_0x7bc7('0x60')+_0x19a430);db['sequelize']['query'](_0x26061d['toString']())['spread'](function(_0x597ca3){var _0x4e8fe0=[];for(var _0x5e1287=0x0;_0x5e1287<_0x597ca3['length'];_0x5e1287++){_0x4e8fe0['push'](getTimezoneData(_0x597ca3[_0x5e1287],tmp_campaigns));}BPromise[_0x7bc7('0x19')](_0x4e8fe0)['then'](function(){_0x39f970({'val':0x1});});})[_0x7bc7('0x5c')](function(_0x3bd03e){logger[_0x7bc7('0x55')](_0x3bd03e[_0x7bc7('0x56')]);_0x39f970({'val':0x0});});});}function updateTzVoiceQueues(_0x1a0815){return new Promise(function(_0x506a21,_0x5b3a18){var _0x4add8d=squel[_0x7bc7('0xe')]()[_0x7bc7('0x34')](['voice_queues.id','voice_queues.dialTimezone'])[_0x7bc7('0x10')](_0x7bc7('0x61'))[_0x7bc7('0x14')](_0x7bc7('0x62'),null,_0x7bc7('0x63'))['where']('voice_queues_has_cm_lists.CmListId='+_0x1a0815);db[_0x7bc7('0x59')][_0x7bc7('0x5a')](_0x4add8d['toString']())['spread'](function(_0x2df78d){var _0x208a87=[];for(var _0x5633a1=0x0;_0x5633a1<_0x2df78d[_0x7bc7('0x17')];_0x5633a1++){_0x208a87[_0x7bc7('0x18')](getTimezoneData(_0x2df78d[_0x5633a1],tmp_voice_queues));}BPromise[_0x7bc7('0x19')](_0x208a87)['then'](function(){_0x506a21({'val':0x1});});})[_0x7bc7('0x5c')](function(_0x5a6f84){logger[_0x7bc7('0x55')](_0x5a6f84[_0x7bc7('0x56')]);_0x506a21({'val':0x0});});});}function getTimezoneData(_0x267263,_0x28663b){return new Promise(function(_0xc76a4f,_0x3f0880){var _0x2db253=shared[_0x7bc7('0x64')];var _0x3c5d9c=_0x2db253[_0x267263[_0x7bc7('0x65')]];if(_[_0x7bc7('0x66')](_0x3c5d9c)){_0xc76a4f({'ret':0x1});}else{var _0x7d0e4c=_0x3c5d9c[_0x7bc7('0x67')];var _0x4d2fde=squel[_0x7bc7('0x29')]()['into'](_0x28663b)[_0x7bc7('0x68')]('id',_0x267263['id'])[_0x7bc7('0x68')](_0x7bc7('0x69'),_0x7d0e4c)['set']('dialTimezone',_0x267263[_0x7bc7('0x65')])[_0x7bc7('0x3d')]();return db['sequelize'][_0x7bc7('0x5a')](_0x4d2fde)['spread'](function(_0xddb2b1){_0xc76a4f({'ret':0x1});})[_0x7bc7('0x5c')](function(_0x4176bf){logger['error'](_0x4176bf[_0x7bc7('0x56')]);_0x3f0880({'ret':0x1});});}});}function handleTZQuery(_0x565dd9){logger[_0x7bc7('0x53')](_0x565dd9);return db['sequelize'][_0x7bc7('0x5a')](_0x565dd9)[_0x7bc7('0x5b')](function(_0xd7c076){})[_0x7bc7('0x5c')](function(_0x41b128){logger[_0x7bc7('0x55')](_0x41b128['message']);});}function main(_0x349490,_0x1299d4,_0xa6dc6,_0x425c97){logger['info'](_0x7bc7('0x6a'),_0x349490,JSON[_0x7bc7('0x6b')](_0x1299d4));process['send'](_0x7bc7('0x6c'));var _0x323412=_0x1299d4['binding'];var _0x89df6e=_[_0x7bc7('0x6d')](_0x323412);var _0x580a57=_0x1299d4[_0x7bc7('0x6e')];var _0x4f1d4b=path['join'](config[_0x7bc7('0x6f')],_0x7bc7('0x70'),_0x580a57+_0x7bc7('0x71'));hasTZ=_[_0x7bc7('0x4e')](_0x323412)[_0x7bc7('0x72')]('dialTimezone');var _0x2c1c75=_[_0x7bc7('0x4e')](_0x323412)['join']();logger[_0x7bc7('0x53')](_0x7bc7('0x73'),_0x2c1c75);db['ContactItemType'][_0x7bc7('0x74')]({'raw':!![],'attributes':['id',_0x7bc7('0x75')]})[_0x7bc7('0x16')](function(_0xdfac1b){for(var _0x20188d=0x0;_0x20188d<_0xdfac1b[_0x7bc7('0x17')];_0x20188d++){if(_0xdfac1b[_0x20188d][_0x7bc7('0x75')]in _0x323412){contactItemTypes[_0x7bc7('0x18')](_0xdfac1b[_0x20188d]);delete _0x89df6e[_0xdfac1b[_0x20188d]['name']];hasAdditionalPhones=!![];}for(var _0x4ea6aa in _0x323412){if(_0xdfac1b[_0x20188d][_0x7bc7('0x75')]+_0x7bc7('0x76')===_0x4ea6aa){phoneDescriptions[_0x7bc7('0x18')]({'itemTypeId':_0xdfac1b[_0x20188d]['id'],'description':_0x4ea6aa});delete _0x89df6e[_0x4ea6aa];}}}if(hasAdditionalPhones)_0x89df6e[_0x7bc7('0x15')]='';var _0x43e42e=_[_0x7bc7('0x4e')](_0x89df6e)[_0x7bc7('0x14')]();logger[_0x7bc7('0x53')](_0x7bc7('0x73'),_0x43e42e);fs[_0x7bc7('0x77')](_0x4f1d4b,_0x43e42e+'\x0a');Papa['parse'](fs['createReadStream'](_0x349490),{'header':!![],'skipEmptyLines':!![],'step':function(_0x482a4e,_0x315391){try{for(var _0x27b76b=0x0,_0x47f36b=[];_0x27b76b<_0x482a4e[_0x7bc7('0x78')]['length'];_0x27b76b++){stats[_0x7bc7('0x79')]+=0x1;if(_0x482a4e[_0x7bc7('0x57')][_0x27b76b]){handleError(_0x482a4e[_0x7bc7('0x78')][_0x27b76b],_0x482a4e[_0x7bc7('0x57')][_0x27b76b]);}else{var _0x37ecc9=[];var _0x45e2ea=[];var _0x5614f9={};for(var _0x37b33a in _0x323412){let _0x867a59=contactItemTypes[_0x7bc7('0x7a')](_0x48a0dc=>_0x48a0dc[_0x7bc7('0x75')]===_0x37b33a);let _0x306b04=contactItemTypes[_0x7bc7('0x7a')](_0x5e1db5=>_0x5e1db5[_0x7bc7('0x75')]+_0x7bc7('0x76')===_0x37b33a);if(_[_0x7bc7('0x66')](_0x867a59)&&_[_0x7bc7('0x66')](_0x306b04)){if(_0x323412[_0x7bc7('0x7b')](_0x37b33a)){if(_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x37b33a]]){var _0x3738ee=_[_0x7bc7('0x7c')](_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x37b33a]][_0x7bc7('0x7d')](/"/g,'\x27'));switch(_0x37b33a){case _0x7bc7('0x2e'):var _0x18930c=moment(_0x3738ee,_0x7bc7('0xc'),!![]);if(_0x18930c[_0x7bc7('0x7e')]()){_0x47f36b['push']('\x22'+_0x3738ee+'\x22');}else{_0x37ecc9[_0x7bc7('0x18')](_0x7bc7('0x7f'));}break;case _0x7bc7('0x43'):var _0x59bf0c=parseInt(_0x3738ee);_0x3738ee=_[_0x7bc7('0x80')](_0x59bf0c)||_0x59bf0c<0x0||_0x59bf0c>0x4?_0x425c97?0x3:0x2:_0x59bf0c;_0x47f36b['push']('\x22'+_0x3738ee+'\x22');break;case'UserId':var _0x4eb4d3=parseInt(_0x3738ee);if(_['isNumber'](_0x4eb4d3)&&_['includes'](_0xa6dc6,_0x4eb4d3)){_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x4eb4d3+'\x22');}else{_0x37ecc9['push'](_0x7bc7('0x81'));}break;case _0x7bc7('0x82'):if(isEmail(_0x3738ee)){_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x3738ee+'\x22');}else{_0x37ecc9[_0x7bc7('0x18')](_0x7bc7('0x83'));}break;case _0x7bc7('0x84'):var _0x14b6dc=moment(_0x3738ee,_0x7bc7('0x85'),!![]);if(_0x14b6dc[_0x7bc7('0x7e')]()){_0x47f36b['push']('\x22'+_0x3738ee+'\x22');}else{_0x37ecc9[_0x7bc7('0x18')](_0x7bc7('0x86'));}break;case _0x7bc7('0x65'):var _0x53e3f9=shared[_0x7bc7('0x64')];var _0x294e9a=_0x53e3f9[_0x3738ee];if(!_[_0x7bc7('0x66')](_0x294e9a)){var _0x3a02fb=_0x294e9a[_0x7bc7('0x67')];_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x3738ee+'\x22');_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x3a02fb+'\x22');}break;default:_0x47f36b['push']('\x22'+_0x3738ee+'\x22');}}else{switch(_0x37b33a){case _0x7bc7('0x87'):case _0x7bc7('0x2d'):_0x37ecc9['push'](_0x37b33a+_0x7bc7('0x88'));break;default:_0x47f36b[_0x7bc7('0x18')]('\x22\x22');}}}}else{var _0x126b68='';if(!_[_0x7bc7('0x66')](_0x867a59)){if(!_0x5614f9[_0x7bc7('0x7b')](_0x867a59['id'])){if(!_[_0x7bc7('0x66')](_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x37b33a]])){var _0x3738ee=_['trim'](_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x37b33a]][_0x7bc7('0x7d')](/"/g,'\x27'));var _0x4c55f7=phoneDescriptions[_0x7bc7('0x7a')](_0x48b475=>_0x48b475[_0x7bc7('0x89')]===_0x867a59['id']);if(!_['isNil'](_0x4c55f7)){var _0xbb978=_[_0x7bc7('0x7c')](_0x482a4e[_0x7bc7('0x78')][_0x27b76b][_0x323412[_0x4c55f7[_0x7bc7('0x8a')]]]['replace'](/"/g,'\x27'));if(!_[_0x7bc7('0x66')](_0xbb978))_0x3738ee=_0x3738ee+'§'+_0xbb978;}if(_0x126b68=='')_0x126b68=_0x3738ee;else _0x126b68+='|'+_0x3738ee;}_0x45e2ea['push'](_0x867a59['id']+':'+_0x126b68);_0x5614f9[_0x867a59['id']]=0x1;}}}}if(hasAdditionalPhones){_0x47f36b[_0x7bc7('0x18')]('\x22'+_0x45e2ea['join'](';')+'\x22');}if(_0x37ecc9[_0x7bc7('0x17')]){handleError(_0x482a4e['data'][_0x27b76b],{'code':'SystemRow','message':_0x37ecc9['join']()});}else{fs[_0x7bc7('0x8b')](_0x4f1d4b,_0x47f36b['join']()+'\x0a');}_0x47f36b=[];}if(!(stats[_0x7bc7('0x79')]%0xc8)){socket[_0x7bc7('0x8c')](_0x7bc7('0x8d')+_0x580a57,stats);stats[_0x7bc7('0x57')]=[];}}if(stopped){logger[_0x7bc7('0x53')](_0x7bc7('0x8e'));_0x315391[_0x7bc7('0x8f')]();}}catch(_0x6ab4f2){handleError(_0x482a4e['data'][_0x27b76b],{'code':'SystemError','message':_0x6ab4f2[_0x7bc7('0x56')]});logger[_0x7bc7('0x55')]('step',_0x6ab4f2['message']);}},'complete':function(){try{var _0x341ee5=[];var _0x80ef6=[];var _0x5321bc=_0x7bc7('0x35');if(_0x1299d4[_0x7bc7('0x90')]&&_0x1299d4[_0x7bc7('0x90')]['length']){_0x5321bc='cm_contacts_'+_0x580a57;_0x341ee5[_0x7bc7('0x18')](_0x7bc7('0x91')+_0x5321bc+_0x7bc7('0x92'));}tmp_campaigns=_0x7bc7('0x93')+_0x580a57;tmp_voice_queues='voice_queues_'+_0x580a57;_0x80ef6[_0x7bc7('0x18')](_0x7bc7('0x91')+tmp_campaigns+_0x7bc7('0x94'));_0x80ef6['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x7bc7('0x94'));BPromise['each'](_0x80ef6,handleTZQuery)[_0x7bc7('0x16')](function(_0x5180d4){updateTzCampaigns(_0x1299d4[_0x7bc7('0x2f')])['then'](function(_0x51c30e){updateTzVoiceQueues(_0x1299d4[_0x7bc7('0x2f')])[_0x7bc7('0x16')](function(_0x586f0d){if(hasTZ)_0x43e42e=_0x43e42e[_0x7bc7('0x7d')]('dialTimezone',_0x7bc7('0x95'));var _0x4a56f6=util['format']('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',_0x4f1d4b,_0x5321bc,_0x43e42e,_0x1299d4['ListId'],_0x1299d4['CompanyId']||null,NOW,NOW);if(_[_0x7bc7('0x66')](_0x323412[_0x7bc7('0x2e')])){_0x4a56f6+=_0x7bc7('0x96');}_0x341ee5['push'](_0x4a56f6);if(_0x1299d4[_0x7bc7('0x90')]&&_0x1299d4[_0x7bc7('0x90')][_0x7bc7('0x17')]){_0x341ee5[_0x7bc7('0x18')](insertCmContact(_0x1299d4[_0x7bc7('0x2f')],_0x5321bc,_0x1299d4['duplicates'],_0x323412));_0x341ee5[_0x7bc7('0x18')](_0x7bc7('0x97')+_0x5321bc+';');}BPromise[_0x7bc7('0x98')](_0x341ee5,handleQuery)[_0x7bc7('0x16')](function(_0x18752e){BPromise[_0x7bc7('0x19')]([handleAdditionalPhones()])[_0x7bc7('0x16')](function(){_0x341ee5=[];for(var _0x5c7460=0x0;_0x5c7460\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment/shared','import','redis','socket.io-emitter','format'];(function(_0x579c82,_0x1c2561){var _0x385dcb=function(_0x8ff973){while(--_0x8ff973){_0x579c82['push'](_0x579c82['shift']());}};_0x385dcb(++_0x1c2561);}(_0xe275,0xa9));var _0x5e27=function(_0x2c41a4,_0x599e70){_0x2c41a4=_0x2c41a4-0x0;var _0x2fcd56=_0xe275[_0x2c41a4];return _0x2fcd56;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x5e27('0x0'));var Papa=require(_0x5e27('0x1'));var util=require(_0x5e27('0x2'));var BPromise=require(_0x5e27('0x3'));var moment=require('moment');var squel=require(_0x5e27('0x4'));var Redis=require(_0x5e27('0x5'));var db=require(_0x5e27('0x6'))['db'];var config=require('../../../config/environment');var shared=require(_0x5e27('0x7'));var logger=require('../../../config/logger')(_0x5e27('0x8'));config[_0x5e27('0x9')]=_['defaults'](config[_0x5e27('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e27('0xa'))(new Redis(config[_0x5e27('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5e27('0xb')](_0x5e27('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5e27('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4e05f3){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))*$/[_0x5e27('0xd')](_0x4e05f3);}function selectNotIn(_0x4b5bcd,_0x70aec8,_0x33df46,_0x3872cb,_0x53b35e){return squel[_0x5e27('0xe')]()[_0x5e27('0xf')](_0x5e27('0x10'))[_0x5e27('0x11')](_0x3872cb)[_0x5e27('0x12')](_0x70aec8,null,_0x70aec8+_0x5e27('0x13')+_0x3872cb+'.'+_0x33df46)[_0x5e27('0x14')](_0x3872cb+'.'+_0x33df46+'\x20=\x20'+_0x4b5bcd+'.'+_0x33df46)['where'](_0x70aec8+_0x5e27('0x15')+_0x53b35e[_0x5e27('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x58599b,_0x360a3a){promisesAdditionalPhones=[];return db['CmContact'][_0x5e27('0x16')]({'raw':!![],'attributes':['id',_0x5e27('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5e27('0x18')](function(_0x3ce1fe){if(_0x3ce1fe!==null){var _0x22377f=[];for(var _0x3dfef2=0x0;_0x3dfef2<_0x3ce1fe[_0x5e27('0x19')];_0x3dfef2++){var _0x4642e2=_0x3ce1fe[_0x3dfef2];_0x22377f[_0x5e27('0x1a')](insertAdditionalPhones(_0x4642e2));}}Promise[_0x5e27('0x1b')](_0x22377f)[_0x5e27('0x18')](function(){_0x58599b({'val':0x1});});});});}function insertAdditionalPhones(_0x7bac88){return new Promise(function(_0x5c3f48,_0x5f3f83){var _0x4ff4cd=_0x7bac88[_0x5e27('0x17')];var _0x918f73=_0x4ff4cd[_0x5e27('0x1c')](';');var _0x49cd5e=[];orderBy=0x0;for(var _0x34e971=0x0;_0x34e971<_0x918f73[_0x5e27('0x19')];_0x34e971++){_0x49cd5e['push'](splitAdditionalPhone(_0x7bac88['id'],_0x918f73[_0x34e971]));}Promise['all'](_0x49cd5e)[_0x5e27('0x18')](function(){_0x5c3f48({'val':_0x918f73['length']});});});}function splitAdditionalPhone(_0x414cbe,_0x109829){return new Promise(function(_0x1353fe,_0x4a1fb4){var _0x27481a=_0x109829['split'](':');var _0x21e778=_0x27481a[0x0];var _0x8b9f72=_0x27481a[0x1];if(!_[_0x5e27('0x1d')](_0x8b9f72)){var _0x41864b=_0x8b9f72['split']('|');var _0x3cd965=[];for(var _0x3cba2c=0x0;_0x3cba2c<_0x41864b[_0x5e27('0x19')];_0x3cba2c++){if(_0x41864b[_0x3cba2c]!==''){var _0x537793=_[_0x5e27('0x1e')](promisesAdditionalPhones,{'contactId':_0x414cbe,'phone':_0x41864b[_0x3cba2c]});if(_0x537793[_0x5e27('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x5e27('0x1a')]({'contactId':_0x414cbe,'contactTypeId':_0x21e778,'phone':_0x41864b[_0x3cba2c],'orderBy':orderBy});}}}_0x1353fe({'ok':0x1});}else _0x1353fe({'res':0x0});});}function createAdditionalPhone(_0x38aeaf,_0x6cbb4f,_0x1fc9c3,_0x826358){var _0x3e48df='';var _0x3fb3cb='';var _0x731fa=_0x1fc9c3[_0x5e27('0x1c')]('§');_0x3e48df=_0x731fa[0x0];if(_0x731fa[_0x5e27('0x19')]==0x2)_0x3fb3cb=_0x731fa[0x1];return new Promise(function(_0x321538,_0x40e07d){return db['CmContactHasItem'][_0x5e27('0x1f')]({'where':{'CmContactId':_0x38aeaf,'item':_0x3e48df}})['then'](function(_0x248023){if(_0x248023){return db[_0x5e27('0x20')][_0x5e27('0x21')]({'ItemTypeId':_0x6cbb4f,'description':_0x3fb3cb,'OrderBy':_0x826358},{'where':{'CmContactId':_0x38aeaf,'item':_0x3e48df}})[_0x5e27('0x18')](function(_0x1e01be){_0x321538({'res':'updated'});});}else{return db[_0x5e27('0x20')][_0x5e27('0x22')]({'CmContactId':_0x38aeaf,'item':_0x3e48df,'description':_0x3fb3cb,'ItemTypeId':_0x6cbb4f,'OrderBy':_0x826358,'ItemClass':_0x5e27('0x23')})[_0x5e27('0x18')](function(_0x4f1ae9){_0x321538({'res':_0x5e27('0x24')});});}});});}function insertCmHopper(_0x4ce1a3,_0x32d83a,_0x5053a3,_0x37ca63,_0x2d5ac3){var _0x42511c=[_0x5e27('0x25'),'cm_contacts.scheduledat',_0x5e27('0x26'),_0x5e27('0x27'),_0x32d83a+'.'+_0x37ca63,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x5e27('0x28'),_0x5e27('0x29'),'\x22'+_0x2d5ac3+'\x22'];return squel[_0x5e27('0x2a')]()['into'](_0x5e27('0x2b'))[_0x5e27('0x2c')]([_0x5e27('0x10'),_0x5e27('0x2d'),_0x5e27('0x2e'),'ListId',_0x37ca63,_0x5e27('0x2f'),_0x5e27('0x30'),'priority',_0x5e27('0x31'),'recallme'],squel[_0x5e27('0xe')]()[_0x5e27('0x32')](_0x42511c)[_0x5e27('0x11')](_0x32d83a)[_0x5e27('0x12')](_0x5e27('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x32d83a+'.CmListId')[_0x5e27('0x12')](_0x5053a3,null,_0x5053a3+_0x5e27('0x13')+_0x32d83a+'.'+_0x37ca63)[_0x5e27('0x14')](_0x32d83a+_0x5e27('0x34'),_0x4ce1a3)['where'](_0x5e27('0x35'),NOW)[_0x5e27('0x14')](_0x5e27('0x36'),selectNotIn(_0x32d83a,_0x5053a3,_0x37ca63,_0x5e27('0x2b'),['\x22always\x22',_0x5e27('0x37')]))[_0x5e27('0x14')](_0x5e27('0x36'),selectNotIn(_0x32d83a,_0x5053a3,_0x37ca63,_0x5e27('0x2b'),[_0x5e27('0x38')])))[_0x5e27('0x39')]();}function insertCmHopperBlack(_0x5218e5,_0x399eea,_0x29ddcd,_0x1b633e){var _0x115ead=['cm_contacts.phone',_0x5e27('0x26'),_0x5e27('0x27'),_0x399eea+'.'+_0x1b633e,_0x5e27('0x3a'),_0x5e27('0x3b')];return squel[_0x5e27('0x2a')]()[_0x5e27('0x3c')](_0x5e27('0x3d'))[_0x5e27('0x2c')]([_0x5e27('0x10'),_0x5e27('0x2e'),'ListId',_0x1b633e,_0x5e27('0x2f'),_0x5e27('0x30')],squel['select']()[_0x5e27('0x32')](_0x115ead)['from'](_0x399eea)[_0x5e27('0x12')](_0x5e27('0x33'),null,_0x5e27('0x3e')+_0x399eea+_0x5e27('0x3f'))['join'](_0x29ddcd,null,_0x29ddcd+'.id\x20=\x20'+_0x399eea+'.'+_0x1b633e)['where'](_0x399eea+_0x5e27('0x34'),_0x5218e5)[_0x5e27('0x14')](_0x5e27('0x35'),NOW)[_0x5e27('0x14')](_0x5e27('0x36'),squel['select']()['field']('phone')[_0x5e27('0x11')](_0x5e27('0x3d'))['where'](_0x5e27('0x40'),_0x5218e5)[_0x5e27('0x14')](_0x1b633e+_0x5e27('0x41')+_0x399eea+'.'+_0x1b633e)))['toString']();}function insertTzCmHopper(_0x5a4cb4,_0x98c815,_0x69ae34,_0x3a7c43,_0x5c3d91,_0x3d07b3){var _0x2abf1b=[_0x5e27('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x3d07b3+_0x5e27('0x42'),_0x5e27('0x26'),_0x5e27('0x27'),_0x98c815+'.'+_0x3a7c43,_0x5e27('0x3a'),_0x5e27('0x3b'),_0x5e27('0x28'),'cm_contacts.UserId','\x22'+_0x5c3d91+'\x22'];var _0x7e59e2=squel[_0x5e27('0x2a')]()[_0x5e27('0x3c')]('cm_hopper')['fromQuery'](['phone',_0x5e27('0x2d'),_0x5e27('0x2e'),'ListId',_0x3a7c43,_0x5e27('0x2f'),_0x5e27('0x30'),'priority',_0x5e27('0x31'),'recallme'],squel[_0x5e27('0xe')]()[_0x5e27('0x32')](_0x2abf1b)['from'](_0x98c815)[_0x5e27('0x12')]('cm_contacts',null,_0x5e27('0x3e')+_0x98c815+_0x5e27('0x3f'))['join'](_0x69ae34,null,_0x69ae34+'.id\x20=\x20'+_0x98c815+'.'+_0x3a7c43)[_0x5e27('0x12')](_0x3d07b3,null,_0x3d07b3+_0x5e27('0x13')+_0x98c815+'.'+_0x3a7c43)[_0x5e27('0x14')](_0x98c815+'.CmListId\x20=\x20?',_0x5a4cb4)[_0x5e27('0x14')](_0x5e27('0x35'),NOW)['where'](_0x5e27('0x36'),selectNotIn(_0x98c815,_0x69ae34,_0x3a7c43,'cm_hopper',[_0x5e27('0x38'),_0x5e27('0x37')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x98c815,_0x69ae34,_0x3a7c43,_0x5e27('0x2b'),[_0x5e27('0x38')])))[_0x5e27('0x39')]();return _0x7e59e2;}function insertTzCmHopperBlack(_0x14c5cc,_0x1f4eee,_0x55269e,_0x27ee54){var _0x210bc1=[_0x5e27('0x25'),_0x5e27('0x26'),_0x5e27('0x27'),_0x1f4eee+'.'+_0x27ee54,_0x5e27('0x3a'),'cm_contacts.updatedAt'];return squel[_0x5e27('0x2a')]()[_0x5e27('0x3c')](_0x5e27('0x3d'))[_0x5e27('0x2c')](['phone','ContactId','ListId',_0x27ee54,_0x5e27('0x2f'),'updatedAt'],squel[_0x5e27('0xe')]()[_0x5e27('0x32')](_0x210bc1)['from'](_0x1f4eee)[_0x5e27('0x12')](_0x5e27('0x33'),null,_0x5e27('0x3e')+_0x1f4eee+'.CmListId')[_0x5e27('0x12')](_0x55269e,null,_0x55269e+_0x5e27('0x13')+_0x1f4eee+'.'+_0x27ee54)['where'](_0x1f4eee+_0x5e27('0x34'),_0x14c5cc)['where'](_0x5e27('0x35'),NOW)[_0x5e27('0x14')](_0x5e27('0x36'),squel[_0x5e27('0xe')]()['field'](_0x5e27('0x10'))[_0x5e27('0x11')](_0x5e27('0x3d'))[_0x5e27('0x14')](_0x5e27('0x40'),_0x14c5cc)['where'](_0x27ee54+_0x5e27('0x41')+_0x1f4eee+'.'+_0x27ee54)))['toString']();}function insertCmHopperAdditionalPhones(_0x39a954){var _0x381ecf=[_0x5e27('0x43'),_0x5e27('0x44'),_0x5e27('0x45'),_0x5e27('0x46'),_0x5e27('0x47')];return squel[_0x5e27('0x2a')]()[_0x5e27('0x3c')](_0x5e27('0x48'))['fromQuery'](['CmHopperId',_0x5e27('0x10'),_0x5e27('0x49'),_0x5e27('0x2f'),_0x5e27('0x30')],squel[_0x5e27('0xe')]()[_0x5e27('0x32')](_0x381ecf)[_0x5e27('0x11')](_0x5e27('0x2b'))[_0x5e27('0x12')](_0x5e27('0x33'),null,_0x5e27('0x4a'))[_0x5e27('0x12')](_0x5e27('0x4b'),null,_0x5e27('0x4c'))[_0x5e27('0x14')](_0x5e27('0x4d'),_0x39a954)['where'](_0x5e27('0x35'),NOW))[_0x5e27('0x39')]();}function insertCmContact(_0x243455,_0x2f50c9,_0x549feb,_0x369e96){var _0x56ba84=_[_0x5e27('0x4e')](_[_0x5e27('0x4f')](_0x369e96),[_0x5e27('0x50'),_0x5e27('0x51'),_0x5e27('0x2f'),_0x5e27('0x30'),_0x5e27('0x52')]);return squel['insert']()[_0x5e27('0x3c')]('cm_contacts')[_0x5e27('0x2c')](_0x56ba84,squel['select']()[_0x5e27('0x32')](_0x56ba84)['from'](_0x2f50c9)['where']('('+_0x549feb[_0x5e27('0x12')](',')+_0x5e27('0x53'),squel['select']()[_0x5e27('0x32')](_0x549feb)['from'](_0x5e27('0x33'))[_0x5e27('0x14')]('ListId\x20=\x20?',_0x243455)['where'](_0x5e27('0x54')))[_0x5e27('0x14')](_0x5e27('0x55'),squel[_0x5e27('0xe')]()[_0x5e27('0xf')]('MIN(id)',_0x5e27('0x56'))[_0x5e27('0x11')](_0x2f50c9)[_0x5e27('0x57')](_0x549feb[_0x5e27('0x12')](','))))[_0x5e27('0x39')]();}function handleStop(){logger[_0x5e27('0x58')](_0x5e27('0x59'));stopped=!![];}function handleUncaughtException(_0x1bb7f1){logger[_0x5e27('0x5a')](_0x1bb7f1[_0x5e27('0x5b')]);process[_0x5e27('0x5c')](0x1);}function handleError(_0x41a0b5,_0x1276b9){stats[_0x5e27('0x5d')][_0x5e27('0x1a')]({'name':_0x1276b9[_0x5e27('0x5e')],'message':_0x1276b9[_0x5e27('0x5b')],'row':_0x41a0b5});}function handleQuery(_0x111538){logger[_0x5e27('0x58')](_0x111538);return db[_0x5e27('0x5f')][_0x5e27('0x60')](_0x111538)[_0x5e27('0x61')](function(_0x6f084c){results['push'](_0x6f084c);})[_0x5e27('0x62')](function(_0x59c5b5){logger[_0x5e27('0x5a')](_0x59c5b5['message']);});}function updateTzCampaigns(_0x89f4e0){return new Promise(function(_0x1cee30,_0x2234f1){var _0xfe8d20=squel[_0x5e27('0xe')]()[_0x5e27('0x32')]([_0x5e27('0x63'),'campaigns.dialTimezone'])['from']('campaigns')[_0x5e27('0x12')](_0x5e27('0x64'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x5e27('0x14')](_0x5e27('0x65')+_0x89f4e0);db[_0x5e27('0x5f')][_0x5e27('0x60')](_0xfe8d20[_0x5e27('0x39')]())[_0x5e27('0x61')](function(_0x460318){var _0x44f157=[];for(var _0x24148b=0x0;_0x24148b<_0x460318[_0x5e27('0x19')];_0x24148b++){_0x44f157[_0x5e27('0x1a')](getTimezoneData(_0x460318[_0x24148b],tmp_campaigns));}BPromise[_0x5e27('0x1b')](_0x44f157)[_0x5e27('0x18')](function(){_0x1cee30({'val':0x1});});})['catch'](function(_0x3ba37f){logger[_0x5e27('0x5a')](_0x3ba37f[_0x5e27('0x5b')]);_0x1cee30({'val':0x0});});});}function updateTzVoiceQueues(_0x404c6c){return new Promise(function(_0xc8eb8d,_0xc05430){var _0x255b8f=squel[_0x5e27('0xe')]()['fields']([_0x5e27('0x66'),_0x5e27('0x67')])[_0x5e27('0x11')](_0x5e27('0x68'))[_0x5e27('0x12')](_0x5e27('0x69'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x5e27('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x404c6c);db[_0x5e27('0x5f')][_0x5e27('0x60')](_0x255b8f[_0x5e27('0x39')]())[_0x5e27('0x61')](function(_0x1cd80d){var _0x53f295=[];for(var _0x3e3f58=0x0;_0x3e3f58<_0x1cd80d[_0x5e27('0x19')];_0x3e3f58++){_0x53f295[_0x5e27('0x1a')](getTimezoneData(_0x1cd80d[_0x3e3f58],tmp_voice_queues));}BPromise[_0x5e27('0x1b')](_0x53f295)[_0x5e27('0x18')](function(){_0xc8eb8d({'val':0x1});});})[_0x5e27('0x62')](function(_0x4ee78c){logger['error'](_0x4ee78c['message']);_0xc8eb8d({'val':0x0});});});}function getTimezoneData(_0x30e404,_0x5b4bf1){return new Promise(function(_0x3a3e61,_0x6297ef){var _0x4d581b=shared[_0x5e27('0x6a')];var _0x11988e=_0x4d581b[_0x30e404[_0x5e27('0x6b')]];if(_['isNil'](_0x11988e)){_0x3a3e61({'ret':0x1});}else{var _0x47ac14=_0x11988e[_0x5e27('0x6c')];var _0x45c80b=squel[_0x5e27('0x2a')]()[_0x5e27('0x3c')](_0x5b4bf1)[_0x5e27('0x6d')]('id',_0x30e404['id'])[_0x5e27('0x6d')](_0x5e27('0x6e'),_0x47ac14)[_0x5e27('0x6d')]('dialTimezone',_0x30e404[_0x5e27('0x6b')])[_0x5e27('0x39')]();return db[_0x5e27('0x5f')][_0x5e27('0x60')](_0x45c80b)[_0x5e27('0x61')](function(_0xea20b6){_0x3a3e61({'ret':0x1});})[_0x5e27('0x62')](function(_0x5185ad){logger[_0x5e27('0x5a')](_0x5185ad['message']);_0x6297ef({'ret':0x1});});}});}function handleTZQuery(_0x3c3dcf){logger[_0x5e27('0x58')](_0x3c3dcf);return db[_0x5e27('0x5f')][_0x5e27('0x60')](_0x3c3dcf)['spread'](function(_0x523ac8){})['catch'](function(_0x5860d3){logger['error'](_0x5860d3['message']);});}function main(_0x4c0e60,_0x16a806,_0x4cfb26,_0x6f9549){logger[_0x5e27('0x58')]('main',_0x4c0e60,JSON[_0x5e27('0x6f')](_0x16a806));process[_0x5e27('0x70')](_0x5e27('0x71'));var _0x579d2c=_0x16a806[_0x5e27('0x72')];var _0x54ccaa=_[_0x5e27('0x73')](_0x579d2c);var _0x472c95=_0x16a806[_0x5e27('0x74')];var _0x4609de=path[_0x5e27('0x12')](config[_0x5e27('0x75')],_0x5e27('0x76'),_0x472c95+_0x5e27('0x77'));hasTZ=_[_0x5e27('0x4f')](_0x579d2c)[_0x5e27('0x78')]('dialTimezone');var _0x3f535e=_['keys'](_0x579d2c)[_0x5e27('0x12')]();logger[_0x5e27('0x58')](_0x5e27('0x79'),_0x3f535e);db[_0x5e27('0x7a')][_0x5e27('0x16')]({'raw':!![],'attributes':['id',_0x5e27('0x7b')]})[_0x5e27('0x18')](function(_0x5e875b){for(var _0x21ae61=0x0;_0x21ae61<_0x5e875b[_0x5e27('0x19')];_0x21ae61++){if(_0x5e875b[_0x21ae61][_0x5e27('0x7b')]in _0x579d2c){contactItemTypes[_0x5e27('0x1a')](_0x5e875b[_0x21ae61]);delete _0x54ccaa[_0x5e875b[_0x21ae61]['name']];hasAdditionalPhones=!![];}for(var _0x10a3c2 in _0x579d2c){if(_0x5e875b[_0x21ae61][_0x5e27('0x7b')]+_0x5e27('0x7c')===_0x10a3c2){phoneDescriptions['push']({'itemTypeId':_0x5e875b[_0x21ae61]['id'],'description':_0x10a3c2});delete _0x54ccaa[_0x10a3c2];}}}if(hasAdditionalPhones)_0x54ccaa[_0x5e27('0x17')]='';var _0xd17b95=_[_0x5e27('0x4f')](_0x54ccaa)[_0x5e27('0x12')]();logger[_0x5e27('0x58')]('header',_0xd17b95);fs['writeFileSync'](_0x4609de,_0xd17b95+'\x0a');Papa[_0x5e27('0x7d')](fs[_0x5e27('0x7e')](_0x4c0e60),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1018bf,_0x1e8dcd){try{for(var _0x3808f2=0x0,_0x3457b4=[];_0x3808f2<_0x1018bf['data']['length'];_0x3808f2++){stats[_0x5e27('0x7f')]+=0x1;if(_0x1018bf[_0x5e27('0x5d')][_0x3808f2]){handleError(_0x1018bf['data'][_0x3808f2],_0x1018bf[_0x5e27('0x5d')][_0x3808f2]);}else{var _0x3018d2=[];var _0x5d3db1=[];var _0x46aa60={};for(var _0x1e4c92 in _0x579d2c){let _0x979517=contactItemTypes[_0x5e27('0x80')](_0xa9a132=>_0xa9a132[_0x5e27('0x7b')]===_0x1e4c92);let _0x296555=contactItemTypes['find'](_0x1ac304=>_0x1ac304['name']+'_description'===_0x1e4c92);if(_['isNil'](_0x979517)&&_[_0x5e27('0x1d')](_0x296555)){if(_0x579d2c[_0x5e27('0x81')](_0x1e4c92)){if(_0x1018bf[_0x5e27('0x82')][_0x3808f2][_0x579d2c[_0x1e4c92]]){var _0x5826c0=_[_0x5e27('0x83')](_0x1018bf['data'][_0x3808f2][_0x579d2c[_0x1e4c92]][_0x5e27('0x84')](/"/g,'\x27'));switch(_0x1e4c92){case _0x5e27('0x2d'):var _0x1b37c1=moment(_0x5826c0,_0x5e27('0xc'),!![]);if(_0x1b37c1[_0x5e27('0x85')]()){_0x3457b4[_0x5e27('0x1a')]('\x22'+_0x5826c0+'\x22');}else{_0x3018d2[_0x5e27('0x1a')](_0x5e27('0x86'));}break;case'priority':var _0x7da82=parseInt(_0x5826c0);_0x5826c0=_[_0x5e27('0x87')](_0x7da82)||_0x7da82<0x0||_0x7da82>0x4?_0x6f9549?0x3:0x2:_0x7da82;_0x3457b4['push']('\x22'+_0x5826c0+'\x22');break;case'UserId':var _0x29595e=parseInt(_0x5826c0);if(_[_0x5e27('0x88')](_0x29595e)&&_[_0x5e27('0x78')](_0x4cfb26,_0x29595e)){_0x3457b4[_0x5e27('0x1a')]('\x22'+_0x29595e+'\x22');}else{_0x3018d2[_0x5e27('0x1a')](_0x5e27('0x89'));}break;case _0x5e27('0x8a'):if(isEmail(_0x5826c0)){_0x3457b4[_0x5e27('0x1a')]('\x22'+_0x5826c0+'\x22');}else{_0x3018d2['push'](_0x5e27('0x8b'));}break;case'dateOfBirth':var _0x2abf16=moment(_0x5826c0,_0x5e27('0x8c'),!![]);if(_0x2abf16['isValid']()){_0x3457b4[_0x5e27('0x1a')]('\x22'+_0x5826c0+'\x22');}else{_0x3018d2[_0x5e27('0x1a')](_0x5e27('0x8d'));}break;case'dialTimezone':var _0x3d6dc8=shared[_0x5e27('0x6a')];var _0x5740b8=_0x3d6dc8[_0x5826c0];if(!_['isNil'](_0x5740b8)){var _0xab91c5=_0x5740b8[_0x5e27('0x6c')];_0x3457b4[_0x5e27('0x1a')]('\x22'+_0x5826c0+'\x22');_0x3457b4[_0x5e27('0x1a')]('\x22'+_0xab91c5+'\x22');}break;default:_0x3457b4[_0x5e27('0x1a')]('\x22'+_0x5826c0+'\x22');}}else{switch(_0x1e4c92){case _0x5e27('0x8e'):case _0x5e27('0x10'):_0x3018d2[_0x5e27('0x1a')](_0x1e4c92+_0x5e27('0x8f'));break;default:_0x3457b4[_0x5e27('0x1a')]('\x22\x22');}}}}else{var _0x77bbeb='';if(!_[_0x5e27('0x1d')](_0x979517)){if(!_0x46aa60[_0x5e27('0x81')](_0x979517['id'])){if(!_[_0x5e27('0x1d')](_0x1018bf[_0x5e27('0x82')][_0x3808f2][_0x579d2c[_0x1e4c92]])){var _0x5826c0=_['trim'](_0x1018bf['data'][_0x3808f2][_0x579d2c[_0x1e4c92]][_0x5e27('0x84')](/"/g,'\x27'));var _0x17504c=phoneDescriptions[_0x5e27('0x80')](_0x45f892=>_0x45f892[_0x5e27('0x90')]===_0x979517['id']);if(!_[_0x5e27('0x1d')](_0x17504c)){var _0xf50bc6=_[_0x5e27('0x83')](_0x1018bf[_0x5e27('0x82')][_0x3808f2][_0x579d2c[_0x17504c['description']]]['replace'](/"/g,'\x27'));if(!_[_0x5e27('0x1d')](_0xf50bc6))_0x5826c0=_0x5826c0+'§'+_0xf50bc6;}if(_0x77bbeb=='')_0x77bbeb=_0x5826c0;else _0x77bbeb+='|'+_0x5826c0;}_0x5d3db1[_0x5e27('0x1a')](_0x979517['id']+':'+_0x77bbeb);_0x46aa60[_0x979517['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3457b4[_0x5e27('0x1a')]('\x22'+_0x5d3db1[_0x5e27('0x12')](';')+'\x22');}if(_0x3018d2['length']){handleError(_0x1018bf[_0x5e27('0x82')][_0x3808f2],{'code':_0x5e27('0x91'),'message':_0x3018d2['join']()});}else{fs['appendFileSync'](_0x4609de,_0x3457b4[_0x5e27('0x12')]()+'\x0a');}_0x3457b4=[];}if(!(stats[_0x5e27('0x7f')]%0xc8)){socket[_0x5e27('0x92')]('contact:import:'+_0x472c95,stats);stats[_0x5e27('0x5d')]=[];}}if(stopped){logger[_0x5e27('0x58')](_0x5e27('0x93'));_0x1e8dcd[_0x5e27('0x94')]();}}catch(_0x1076a4){handleError(_0x1018bf['data'][_0x3808f2],{'code':'SystemError','message':_0x1076a4['message']});logger[_0x5e27('0x5a')](_0x5e27('0x95'),_0x1076a4[_0x5e27('0x5b')]);}},'complete':function(){try{var _0x16992d=[];var _0x34b8f5=[];var _0x2a4e84=_0x5e27('0x33');if(_0x16a806[_0x5e27('0x96')]&&_0x16a806[_0x5e27('0x96')]['length']){_0x2a4e84=_0x5e27('0x97')+_0x472c95;_0x16992d[_0x5e27('0x1a')](_0x5e27('0x98')+_0x2a4e84+_0x5e27('0x99'));}tmp_campaigns='campaigns_'+_0x472c95;tmp_voice_queues='voice_queues_'+_0x472c95;_0x34b8f5[_0x5e27('0x1a')](_0x5e27('0x98')+tmp_campaigns+_0x5e27('0x9a'));_0x34b8f5[_0x5e27('0x1a')](_0x5e27('0x98')+tmp_voice_queues+_0x5e27('0x9a'));BPromise[_0x5e27('0x9b')](_0x34b8f5,handleTZQuery)[_0x5e27('0x18')](function(_0x1d7034){updateTzCampaigns(_0x16a806[_0x5e27('0x50')])['then'](function(_0x4c656b){updateTzVoiceQueues(_0x16a806[_0x5e27('0x50')])['then'](function(_0x185664){if(hasTZ)_0xd17b95=_0xd17b95[_0x5e27('0x84')](_0x5e27('0x6b'),_0x5e27('0x9c'));var _0x2ea523=util[_0x5e27('0xb')]('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',_0x4609de,_0x2a4e84,_0xd17b95,_0x16a806['ListId'],_0x16a806[_0x5e27('0x51')]||null,NOW,NOW);if(_['isNil'](_0x579d2c[_0x5e27('0x2d')])){_0x2ea523+=_0x5e27('0x9d');}_0x16992d['push'](_0x2ea523);if(_0x16a806[_0x5e27('0x96')]&&_0x16a806[_0x5e27('0x96')][_0x5e27('0x19')]){_0x16992d[_0x5e27('0x1a')](insertCmContact(_0x16a806[_0x5e27('0x50')],_0x2a4e84,_0x16a806['duplicates'],_0x579d2c));_0x16992d[_0x5e27('0x1a')]('DROP\x20TABLE\x20'+_0x2a4e84+';');}BPromise[_0x5e27('0x9b')](_0x16992d,handleQuery)['then'](function(_0x2ee63a){BPromise[_0x5e27('0x1b')]([handleAdditionalPhones()])[_0x5e27('0x18')](function(){_0x16992d=[];for(var _0x3c5ef1=0x0;_0x3c5ef1\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','import','defaults','localhost','socket.io-emitter','format','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error','message','split','filter','CmContactHasItem','findOne','then','updated','create','inserted','update','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.id','into','cm_hopper_black','.CmListId','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','info','query','main','start','socket_timestamp','root'];(function(_0x281eb5,_0x120187){var _0x544e51=function(_0x4e4081){while(--_0x4e4081){_0x281eb5['push'](_0x281eb5['shift']());}};_0x544e51(++_0x120187);}(_0x1a85,0x178));var _0x51a8=function(_0x2a92a4,_0x5ca2ec){_0x2a92a4=_0x2a92a4-0x0;var _0x383acc=_0x1a85[_0x2a92a4];return _0x383acc;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x51a8('0x0'));var util=require(_0x51a8('0x1'));var BPromise=require(_0x51a8('0x2'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x51a8('0x3'));var db=require(_0x51a8('0x4'))['db'];var config=require(_0x51a8('0x5'));var logger=require('../../../config/logger')(_0x51a8('0x6'));config['redis']=_[_0x51a8('0x7')](config['redis'],{'host':_0x51a8('0x8'),'port':0x18eb});var socket=require(_0x51a8('0x9'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x51a8('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x51a8('0xa')](_0x51a8('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1a476d){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))*$/[_0x51a8('0xc')](_0x1a476d);}function selectNotIn(_0x418f06,_0x421fa4,_0x3f93c7,_0x273a3f,_0x34c887){return squel[_0x51a8('0xd')]()[_0x51a8('0xe')](_0x51a8('0xf'))[_0x51a8('0x10')](_0x273a3f)[_0x51a8('0x11')](_0x421fa4,null,_0x421fa4+_0x51a8('0x12')+_0x273a3f+'.'+_0x3f93c7)[_0x51a8('0x13')](_0x273a3f+'.'+_0x3f93c7+_0x51a8('0x14')+_0x418f06+'.'+_0x3f93c7)['where'](_0x421fa4+_0x51a8('0x15')+_0x34c887[_0x51a8('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xaec066,_0x50d992){promisesAdditionalPhones=[];promisesContact=[];return db[_0x51a8('0x16')]['query'](_0x51a8('0x17')+tempTableName)[_0x51a8('0x18')](function(_0x39cd45){if(_0x39cd45!==null){var _0x2b0521=[];for(var _0x3fbd02=0x0;_0x3fbd02<_0x39cd45[_0x51a8('0x19')];_0x3fbd02++){var _0x1f49ee=_0x39cd45[_0x3fbd02];if(!_['isNil'](_0x1f49ee[_0x51a8('0xf')])){if(!_[_0x51a8('0x1a')](_0x1f49ee[_0x51a8('0x1b')]))_0x2b0521[_0x51a8('0x1c')](insertAdditionalPhones(_0x1f49ee));promisesContact[_0x51a8('0x1c')]({'contact':_0x1f49ee});}}}Promise[_0x51a8('0x1d')](_0x2b0521)['then'](function(){_0xaec066({'val':0x1});});})[_0x51a8('0x1e')](function(_0x3b7e7e){logger[_0x51a8('0x1f')](_0x3b7e7e[_0x51a8('0x20')]);});});}function insertAdditionalPhones(_0x2a4c4c){return new Promise(function(_0x3bc044,_0x28aea0){var _0x3bf5b6=_0x2a4c4c['AdditionalPhones'];if(_[_0x51a8('0x1a')](_0x3bf5b6))_0x28aea0({'val':0x0});else{var _0x53438c=_0x3bf5b6[_0x51a8('0x21')](';');var _0x12c029=[];orderBy=0x0;for(var _0x8bda40=0x0;_0x8bda40<_0x53438c[_0x51a8('0x19')];_0x8bda40++){_0x12c029['push'](splitAdditionalPhone(_0x2a4c4c['id'],_0x53438c[_0x8bda40]));}Promise[_0x51a8('0x1d')](_0x12c029)['then'](function(){_0x3bc044({'val':_0x53438c['length']});});}});}function splitAdditionalPhone(_0x23d26a,_0x52e503){return new Promise(function(_0x384d25,_0x78d3d6){var _0x20ef8b=_0x52e503[_0x51a8('0x21')](':');var _0x157554=_0x20ef8b[0x0];var _0x2f2f05=_0x20ef8b[0x1];if(_0x2f2f05!==''){var _0x291ed6=_0x2f2f05[_0x51a8('0x21')]('|');var _0x5b3f49=[];for(var _0x273ce2=0x0;_0x273ce2<_0x291ed6[_0x51a8('0x19')];_0x273ce2++){if(_0x291ed6[_0x273ce2]!==''){var _0xca5746=_[_0x51a8('0x22')](promisesAdditionalPhones,{'contactId':_0x23d26a,'phone':_0x291ed6[_0x273ce2]});if(_0xca5746[_0x51a8('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x51a8('0x1c')]({'contactId':_0x23d26a,'contactTypeId':_0x157554,'phone':_0x291ed6[_0x273ce2],'orderBy':orderBy});}}}_0x384d25({'ok':0x1});}else _0x384d25({'res':0x0});});}function createAdditionalPhone(_0x1a886f,_0x2742f5,_0xec08ae,_0x4b5cda){var _0x20c6b5='';var _0x347a02='';var _0x4a1548=_0xec08ae[_0x51a8('0x21')]('§');_0x20c6b5=_0x4a1548[0x0];if(_0x4a1548['length']==0x2)_0x347a02=_0x4a1548[0x1];return new Promise(function(_0x276424,_0x3bc19a){return db[_0x51a8('0x23')][_0x51a8('0x24')]({'where':{'CmContactId':_0x1a886f,'item':_0x20c6b5}})[_0x51a8('0x25')](function(_0x4ea271){if(_0x4ea271){return db[_0x51a8('0x23')]['update']({'ItemTypeId':_0x2742f5,'description':_0x347a02,'OrderBy':_0x4b5cda},{'where':{'CmContactId':_0x1a886f,'item':_0x20c6b5}})[_0x51a8('0x25')](function(_0x24b39a){_0x276424({'res':_0x51a8('0x26')});});}else{return db['CmContactHasItem'][_0x51a8('0x27')]({'CmContactId':_0x1a886f,'item':_0x20c6b5,'ItemTypeId':_0x2742f5,'description':_0x347a02,'OrderBy':_0x4b5cda,'ItemClass':'PHONE'})[_0x51a8('0x25')](function(_0x192ac4){_0x276424({'res':_0x51a8('0x28')});});}});});}function updateContact(_0x224099){return new Promise(function(_0x193e0f,_0x50195b){var _0x1167b8=_0x224099['id'];delete _0x224099['id'];return db['CmContact'][_0x51a8('0x29')](_0x224099,{'where':{'id':_0x1167b8}})[_0x51a8('0x25')](function(_0x41561a){updatedRows+=0x1;return db['CmHopper'][_0x51a8('0x29')]({'phone':_0x224099[_0x51a8('0xf')]},{'where':{'ContactId':_0x1167b8}})[_0x51a8('0x25')](function(_0x2429f8){_0x193e0f({'ret':'OK'});});});});}function insertCmHopper(_0x41c020,_0x49ab37,_0x4c2b3d,_0x4d3114,_0x21b871){var _0x299001=['cm_contacts.phone',_0x51a8('0x2a'),'cm_contacts.id',_0x51a8('0x2b'),_0x49ab37+'.'+_0x4d3114,_0x51a8('0x2c'),_0x51a8('0x2d'),_0x51a8('0x2e'),_0x51a8('0x2f'),'\x22'+_0x21b871+'\x22'];return squel[_0x51a8('0x30')]()['into']('cm_hopper')[_0x51a8('0x31')](['phone','scheduledat','ContactId',_0x51a8('0x32'),_0x4d3114,_0x51a8('0x33'),_0x51a8('0x34'),'priority',_0x51a8('0x35'),_0x51a8('0x36')],squel[_0x51a8('0xd')]()[_0x51a8('0x37')](_0x299001)['from'](_0x49ab37)[_0x51a8('0x11')](_0x51a8('0x38'),null,_0x51a8('0x39')+_0x49ab37+'.CmListId')[_0x51a8('0x11')](_0x4c2b3d,null,_0x4c2b3d+'.id\x20=\x20'+_0x49ab37+'.'+_0x4d3114)[_0x51a8('0x13')](_0x49ab37+_0x51a8('0x3a'),_0x41c020)[_0x51a8('0x13')](_0x51a8('0x3b'),NOW)['where'](_0x51a8('0x3c'),selectNotIn(_0x49ab37,_0x4c2b3d,_0x4d3114,_0x51a8('0x3d'),[_0x51a8('0x3e'),_0x51a8('0x3f')]))[_0x51a8('0x13')](_0x51a8('0x3c'),selectNotIn(_0x49ab37,_0x4c2b3d,_0x4d3114,_0x51a8('0x3d'),[_0x51a8('0x3e')])))[_0x51a8('0x40')]();}function insertCmHopperBlack(_0x4b8467,_0x22e6e6,_0x2afb74,_0x4c7c67){var _0x53409d=[_0x51a8('0x41'),_0x51a8('0x42'),_0x51a8('0x2b'),_0x22e6e6+'.'+_0x4c7c67,_0x51a8('0x2c'),_0x51a8('0x2d')];return squel[_0x51a8('0x30')]()[_0x51a8('0x43')](_0x51a8('0x44'))[_0x51a8('0x31')]([_0x51a8('0xf'),'ContactId',_0x51a8('0x32'),_0x4c7c67,_0x51a8('0x33'),_0x51a8('0x34')],squel[_0x51a8('0xd')]()[_0x51a8('0x37')](_0x53409d)[_0x51a8('0x10')](_0x22e6e6)['join'](_0x51a8('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x22e6e6+_0x51a8('0x45'))[_0x51a8('0x11')](_0x2afb74,null,_0x2afb74+_0x51a8('0x12')+_0x22e6e6+'.'+_0x4c7c67)[_0x51a8('0x13')](_0x22e6e6+_0x51a8('0x3a'),_0x4b8467)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x51a8('0x13')](_0x51a8('0x3c'),squel[_0x51a8('0xd')]()[_0x51a8('0xe')](_0x51a8('0xf'))['from']('cm_hopper_black')[_0x51a8('0x13')](_0x51a8('0x46'),_0x4b8467)[_0x51a8('0x13')](_0x4c7c67+_0x51a8('0x47'),_0x22e6e6+'.'+_0x4c7c67)))[_0x51a8('0x40')]();}function insertCmHopperAdditionalPhones(_0x1cf058){var _0x15e5a2=[_0x51a8('0x48'),_0x51a8('0x49'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x51a8('0x30')]()[_0x51a8('0x43')](_0x51a8('0x4a'))['fromQuery']([_0x51a8('0x4b'),_0x51a8('0xf'),'OrderBy',_0x51a8('0x33'),'updatedAt'],squel['select']()[_0x51a8('0x37')](_0x15e5a2)[_0x51a8('0x10')](_0x51a8('0x3d'))['join']('cm_contacts',null,_0x51a8('0x4c'))['join'](_0x51a8('0x4d'),null,_0x51a8('0x4e'))[_0x51a8('0x13')](_0x51a8('0x4f'),_0x1cf058)[_0x51a8('0x13')](_0x51a8('0x3b'),NOW))[_0x51a8('0x40')]();}function insertCmContact(_0x406a87,_0x29d31e,_0x530ad0,_0x2eda9c){var _0xe4518d=_[_0x51a8('0x50')](_[_0x51a8('0x51')](_0x2eda9c),['ListId',_0x51a8('0x52'),'createdAt',_0x51a8('0x34')]);return squel[_0x51a8('0x30')]()['into']('cm_contacts')[_0x51a8('0x31')](_0xe4518d,squel[_0x51a8('0xd')]()[_0x51a8('0x37')](_0xe4518d)[_0x51a8('0x10')](_0x29d31e)[_0x51a8('0x13')]('('+_0x530ad0['join'](',')+_0x51a8('0x53'),squel[_0x51a8('0xd')]()[_0x51a8('0x37')](_0x530ad0)[_0x51a8('0x10')](_0x51a8('0x38'))['where'](_0x51a8('0x46'),_0x406a87))[_0x51a8('0x13')](_0x51a8('0x54'),squel[_0x51a8('0xd')]()[_0x51a8('0xe')](_0x51a8('0x55'),'min_id')['from'](_0x29d31e)['group'](_0x530ad0['join'](','))))[_0x51a8('0x40')]();}function handleStop(){logger[_0x51a8('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x7ac0ae){logger['error'](_0x7ac0ae[_0x51a8('0x20')]);process['exit'](0x1);}function handleError(_0x3947e1,_0x472fdb){stats['errors']['push']({'name':_0x472fdb['code'],'message':_0x472fdb[_0x51a8('0x20')],'row':_0x3947e1});}function handleQuery(_0x1ead77){logger[_0x51a8('0x56')](_0x1ead77);return db[_0x51a8('0x16')][_0x51a8('0x57')](_0x1ead77)[_0x51a8('0x18')](function(_0x3fd347){results[_0x51a8('0x1c')](_0x3fd347);})['catch'](function(_0x43c2ad){logger[_0x51a8('0x1f')](_0x43c2ad['message']);});}function main(_0xd48a5c,_0x315231,_0xf24966,_0x390c25){logger[_0x51a8('0x56')](_0x51a8('0x58'),_0xd48a5c,JSON['stringify'](_0x315231));process['send'](_0x51a8('0x59'));var _0x53f25e=_0x315231['binding'];var _0x50a6ad=_['clone'](_0x53f25e);var _0x483a5a=_0x315231[_0x51a8('0x5a')];var _0x529b2f=path[_0x51a8('0x11')](config[_0x51a8('0x5b')],_0x51a8('0x5c'),_0x483a5a+_0x51a8('0x5d'));logger[_0x51a8('0x56')](_0x51a8('0x5e'),_0x315231);db[_0x51a8('0x5f')][_0x51a8('0x60')]({'raw':!![],'attributes':['id',_0x51a8('0x61')]})[_0x51a8('0x25')](function(_0x48affc){for(var _0x3e66d0=0x0;_0x3e66d0<_0x48affc[_0x51a8('0x19')];_0x3e66d0++){if(_0x48affc[_0x3e66d0][_0x51a8('0x61')]in _0x53f25e){contactItemTypes['push'](_0x48affc[_0x3e66d0]);delete _0x50a6ad[_0x48affc[_0x3e66d0]['name']];hasAdditionalPhones=!![];}for(var _0x5e6bf8 in _0x53f25e){if(_0x48affc[_0x3e66d0][_0x51a8('0x61')]+_0x51a8('0x62')===_0x5e6bf8){phoneDescriptions[_0x51a8('0x1c')]({'itemTypeId':_0x48affc[_0x3e66d0]['id'],'description':_0x5e6bf8});delete _0x50a6ad[_0x5e6bf8];}}}if(hasAdditionalPhones)_0x50a6ad[_0x51a8('0x1b')]='';var _0x2efb36=_[_0x51a8('0x51')](_0x50a6ad)[_0x51a8('0x11')]();logger[_0x51a8('0x56')](_0x51a8('0x63'),_0x2efb36);fs[_0x51a8('0x64')](_0x529b2f,_0x2efb36+'\x0a');Papa[_0x51a8('0x65')](fs[_0x51a8('0x66')](_0xd48a5c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x934ea9,_0x531995){try{for(var _0x5aa50d=0x0,_0x8b9b1b=[];_0x5aa50d<_0x934ea9['data'][_0x51a8('0x19')];_0x5aa50d++){stats['rows']+=0x1;if(_0x934ea9['errors'][_0x5aa50d]){handleError(_0x934ea9['data'][_0x5aa50d],_0x934ea9[_0x51a8('0x67')][_0x5aa50d]);}else{var _0x385878=[];var _0xb480ec=[];var _0x283385={};for(var _0x156eab in _0x53f25e){let _0x1f036b=contactItemTypes[_0x51a8('0x68')](_0x5a37c1=>_0x5a37c1['name']===_0x156eab);let _0x51b004=contactItemTypes[_0x51a8('0x68')](_0x1fed32=>_0x1fed32[_0x51a8('0x61')]+_0x51a8('0x62')===_0x156eab);if(_[_0x51a8('0x1a')](_0x1f036b)&&_[_0x51a8('0x1a')](_0x51b004)){if(_0x53f25e['hasOwnProperty'](_0x156eab)){if(_0x934ea9[_0x51a8('0x69')][_0x5aa50d][_0x53f25e[_0x156eab]]){var _0x1325ca=_[_0x51a8('0x6a')](_0x934ea9[_0x51a8('0x69')][_0x5aa50d][_0x53f25e[_0x156eab]][_0x51a8('0x6b')](/"/g,'\x27'));switch(_0x156eab){case _0x51a8('0x6c'):var _0x149a40=moment(_0x1325ca,_0x51a8('0x6d'),!![]);if(_0x149a40[_0x51a8('0x6e')]()){_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x1325ca+'\x22');}else{_0x385878[_0x51a8('0x1c')](_0x51a8('0x6f'));}break;case _0x51a8('0x70'):var _0x55b9a0=parseInt(_0x1325ca);_0x1325ca=_['isNaN'](_0x55b9a0)||_0x55b9a0<0x0||_0x55b9a0>0x4?_0x390c25?0x3:0x2:_0x55b9a0;_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x1325ca+'\x22');break;case _0x51a8('0x35'):var _0x156b0c=parseInt(_0x1325ca);if(_[_0x51a8('0x71')](_0x156b0c)&&_['includes'](_0xf24966,_0x156b0c)){_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x156b0c+'\x22');}else{_0x385878['push'](_0x51a8('0x72'));}break;case _0x51a8('0x73'):if(isEmail(_0x1325ca)){_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x1325ca+'\x22');}else{_0x385878[_0x51a8('0x1c')](_0x51a8('0x74'));}break;case _0x51a8('0x75'):var _0x19e12b=moment(_0x1325ca,_0x51a8('0x76'),!![]);if(_0x19e12b[_0x51a8('0x6e')]()){_0x8b9b1b['push']('\x22'+_0x1325ca+'\x22');}else{_0x385878[_0x51a8('0x1c')](_0x51a8('0x77'));}break;default:_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0x1325ca+'\x22');}}else{switch(_0x156eab){case _0x51a8('0x78'):case'phone':_0x385878['push'](_0x156eab+_0x51a8('0x79'));break;default:_0x8b9b1b['push']('\x22\x22');}}}}else{var _0x572bea='';if(!_['isNil'](_0x1f036b)){if(!_0x283385[_0x51a8('0x7a')](_0x1f036b['id'])){for(var _0x5934ef=0x0;_0x5934ef<_0x53f25e[_0x156eab]['length'];_0x5934ef++){var _0x1325ca=_[_0x51a8('0x6a')](_0x934ea9[_0x51a8('0x69')][_0x5aa50d][_0x53f25e[_0x156eab][_0x5934ef]]['replace'](/"/g,'\x27'));var _0x847b0a=phoneDescriptions[_0x51a8('0x68')](_0x43f6f0=>_0x43f6f0['itemTypeId']===_0x1f036b['id']);if(!_[_0x51a8('0x1a')](_0x847b0a)){var _0x2a0fc6=_[_0x51a8('0x6a')](_0x934ea9[_0x51a8('0x69')][_0x5aa50d][_0x53f25e[_0x847b0a[_0x51a8('0x7b')]][0x0]][_0x51a8('0x6b')](/"/g,'\x27'));if(!_[_0x51a8('0x1a')](_0x2a0fc6))_0x1325ca=_0x1325ca+'§'+_0x2a0fc6;}if(_0x572bea=='')_0x572bea=_0x1325ca;else _0x572bea+='|'+_0x1325ca;}_0xb480ec[_0x51a8('0x1c')](_0x1f036b['id']+':'+_0x572bea);_0x283385[_0x1f036b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x8b9b1b[_0x51a8('0x1c')]('\x22'+_0xb480ec['join'](';')+'\x22');}if(_0x385878[_0x51a8('0x19')]){handleError(_0x934ea9[_0x51a8('0x69')][_0x5aa50d],{'code':'SystemRow','message':_0x385878[_0x51a8('0x11')]()});}else{fs[_0x51a8('0x7c')](_0x529b2f,_0x8b9b1b['join']()+'\x0a');}_0x8b9b1b=[];}if(!(stats[_0x51a8('0x7d')]%0xc8)){socket[_0x51a8('0x7e')](_0x51a8('0x7f')+_0x483a5a,stats);stats[_0x51a8('0x67')]=[];}}if(stopped){logger[_0x51a8('0x56')]('Abort\x20parser');_0x531995[_0x51a8('0x80')]();}}catch(_0x1e7f04){handleError(_0x934ea9[_0x51a8('0x69')][_0x5aa50d],{'code':_0x51a8('0x81'),'message':_0x1e7f04['message']});logger[_0x51a8('0x1f')](_0x51a8('0x82'),_0x1e7f04[_0x51a8('0x20')]);}},'complete':function(){try{var _0x37f253=[];var _0x6cd464=tempTableName;_0x37f253[_0x51a8('0x1c')](_0x51a8('0x83')+_0x6cd464+_0x51a8('0x84'));logger['info'](_0x51a8('0x85'),contactItemTypes[_0x51a8('0x19')]);var _0x5c04b4=util[_0x51a8('0xa')](_0x51a8('0x86'),_0x529b2f,_0x6cd464,_0x2efb36,_0x315231['ListId'],_0x315231[_0x51a8('0x52')]||null,NOW,NOW);if(_['isNil'](_0x53f25e['scheduledat'])){_0x5c04b4+=_0x51a8('0x87');}_0x37f253[_0x51a8('0x1c')](_0x5c04b4);BPromise[_0x51a8('0x88')](_0x37f253,handleQuery)['then'](function(_0x585d4e){BPromise[_0x51a8('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x37f253=[];for(var _0x30c1be=0x0;_0x30c1be\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','all','then','error','message','split','length','push','filter','CmContactHasItem','findOne','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','into','cm_hopper_additional_phones','CmHopperId','cm_hopper','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','exit','errors','code','binding','clone','socket_timestamp','root','.csv','body','ContactItemType','findAll','name','_description','data','find','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','rows','emit','SystemError','CREATE\x20TABLE\x20','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink'];(function(_0x946779,_0x31cd75){var _0x40292f=function(_0x246706){while(--_0x246706){_0x946779['push'](_0x946779['shift']());}};_0x40292f(++_0x31cd75);}(_0x9f89,0x13d));var _0x99f8=function(_0x277289,_0x40e94c){_0x277289=_0x277289-0x0;var _0x2e3dba=_0x9f89[_0x277289];return _0x2e3dba;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x99f8('0x0'));var Papa=require('papaparse');var util=require(_0x99f8('0x1'));var BPromise=require(_0x99f8('0x2'));var moment=require(_0x99f8('0x3'));var squel=require(_0x99f8('0x4'));var Redis=require(_0x99f8('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x99f8('0x6'));var logger=require(_0x99f8('0x7'))(_0x99f8('0x8'));config[_0x99f8('0x9')]=_[_0x99f8('0xa')](config[_0x99f8('0x9')],{'host':_0x99f8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99f8('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x99f8('0xc')](_0x99f8('0xd'));var tempTableName=_0x99f8('0xe')+moment()['format'](_0x99f8('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2f1ce7){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))*$/[_0x99f8('0x10')](_0x2f1ce7);}function selectNotIn(_0xd7fbc7,_0x4f312b,_0xaea62f,_0x4d2b7b,_0x12259a){return squel[_0x99f8('0x11')]()[_0x99f8('0x12')](_0x99f8('0x13'))[_0x99f8('0x14')](_0x4d2b7b)[_0x99f8('0x15')](_0x4f312b,null,_0x4f312b+_0x99f8('0x16')+_0x4d2b7b+'.'+_0xaea62f)[_0x99f8('0x17')](_0x4d2b7b+'.'+_0xaea62f+_0x99f8('0x18')+_0xd7fbc7+'.'+_0xaea62f)['where'](_0x4f312b+_0x99f8('0x19')+_0x12259a[_0x99f8('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4973d6,_0x135957){promisesAdditionalPhones=[];promisesContact=[];return db[_0x99f8('0x1a')][_0x99f8('0x1b')](_0x99f8('0x1c')+tempTableName)[_0x99f8('0x1d')](function(_0x29750c){if(_0x29750c!==null){var _0x1efc83=[];for(var _0x3b1579=0x0;_0x3b1579<_0x29750c['length'];_0x3b1579++){var _0x40ef78=_0x29750c[_0x3b1579];if(!_[_0x99f8('0x1e')](_0x40ef78['phone'])){if(!_[_0x99f8('0x1e')](_0x40ef78[_0x99f8('0x1f')]))_0x1efc83['push'](insertAdditionalPhones(_0x40ef78));promisesContact['push']({'contact':_0x40ef78});}}}Promise[_0x99f8('0x20')](_0x1efc83)[_0x99f8('0x21')](function(){_0x4973d6({'val':0x1});});})['catch'](function(_0x826fca){logger[_0x99f8('0x22')](_0x826fca[_0x99f8('0x23')]);});});}function insertAdditionalPhones(_0xf595a){return new Promise(function(_0x55c821,_0x1eb794){var _0x17c65e=_0xf595a['AdditionalPhones'];if(_[_0x99f8('0x1e')](_0x17c65e))_0x1eb794({'val':0x0});else{var _0xe458a8=_0x17c65e[_0x99f8('0x24')](';');var _0x1e59c9=[];orderBy=0x0;for(var _0x38731e=0x0;_0x38731e<_0xe458a8[_0x99f8('0x25')];_0x38731e++){_0x1e59c9[_0x99f8('0x26')](splitAdditionalPhone(_0xf595a['id'],_0xe458a8[_0x38731e]));}Promise[_0x99f8('0x20')](_0x1e59c9)[_0x99f8('0x21')](function(){_0x55c821({'val':_0xe458a8[_0x99f8('0x25')]});});}});}function splitAdditionalPhone(_0x5ecb10,_0x16ea3){return new Promise(function(_0xf78543,_0x2ed3e4){var _0x1efc1a=_0x16ea3['split'](':');var _0x40f210=_0x1efc1a[0x0];var _0xde7280=_0x1efc1a[0x1];if(_0xde7280!==''){var _0x151e04=_0xde7280[_0x99f8('0x24')]('|');var _0x262337=[];for(var _0x1e86eb=0x0;_0x1e86eb<_0x151e04['length'];_0x1e86eb++){if(_0x151e04[_0x1e86eb]!==''){var _0xa6728e=_[_0x99f8('0x27')](promisesAdditionalPhones,{'contactId':_0x5ecb10,'phone':_0x151e04[_0x1e86eb]});if(_0xa6728e['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5ecb10,'contactTypeId':_0x40f210,'phone':_0x151e04[_0x1e86eb],'orderBy':orderBy});}}}_0xf78543({'ok':0x1});}else _0xf78543({'res':0x0});});}function createAdditionalPhone(_0x5dff29,_0x4ebfe5,_0x55343e,_0x3599e5){var _0x3545e9='';var _0x8c35ff='';var _0x59e2e2=_0x55343e['split']('§');_0x3545e9=_0x59e2e2[0x0];if(_0x59e2e2['length']==0x2)_0x8c35ff=_0x59e2e2[0x1];return new Promise(function(_0x22261b,_0x16b350){return db[_0x99f8('0x28')][_0x99f8('0x29')]({'where':{'CmContactId':_0x5dff29,'item':_0x3545e9}})[_0x99f8('0x21')](function(_0x2e7032){if(_0x2e7032){return db[_0x99f8('0x28')][_0x99f8('0x2a')]({'ItemTypeId':_0x4ebfe5,'description':_0x8c35ff,'OrderBy':_0x3599e5},{'where':{'CmContactId':_0x5dff29,'item':_0x3545e9}})[_0x99f8('0x21')](function(_0x1a446c){_0x22261b({'res':_0x99f8('0x2b')});});}else{return db['CmContactHasItem'][_0x99f8('0x2c')]({'CmContactId':_0x5dff29,'item':_0x3545e9,'ItemTypeId':_0x4ebfe5,'description':_0x8c35ff,'OrderBy':_0x3599e5,'ItemClass':'PHONE'})[_0x99f8('0x21')](function(_0x4e0f7f){_0x22261b({'res':_0x99f8('0x2d')});});}});});}function updateContact(_0x9362e2){return new Promise(function(_0x18c209,_0x421ace){var _0x121930=_0x9362e2['id'];delete _0x9362e2['id'];return db[_0x99f8('0x2e')][_0x99f8('0x2a')](_0x9362e2,{'where':{'id':_0x121930}})['then'](function(_0x22a5f8){updatedRows+=0x1;return db[_0x99f8('0x2f')][_0x99f8('0x2a')]({'phone':_0x9362e2[_0x99f8('0x13')]},{'where':{'ContactId':_0x121930}})[_0x99f8('0x21')](function(_0x1e36e8){_0x18c209({'ret':'OK'});});});});}function insertCmHopper(_0x514275,_0x5177d1,_0x332cfe,_0xf36408,_0x44f871){var _0x54a9b2=[_0x99f8('0x30'),'cm_contacts.scheduledat','cm_contacts.id',_0x99f8('0x31'),_0x5177d1+'.'+_0xf36408,_0x99f8('0x32'),_0x99f8('0x33'),'cm_contacts.priority',_0x99f8('0x34'),'\x22'+_0x44f871+'\x22'];return squel['insert']()['into']('cm_hopper')[_0x99f8('0x35')](['phone',_0x99f8('0x36'),_0x99f8('0x37'),_0x99f8('0x38'),_0xf36408,_0x99f8('0x39'),_0x99f8('0x3a'),'priority',_0x99f8('0x3b'),_0x99f8('0x3c')],squel[_0x99f8('0x11')]()[_0x99f8('0x3d')](_0x54a9b2)[_0x99f8('0x14')](_0x5177d1)[_0x99f8('0x15')](_0x99f8('0x3e'),null,_0x99f8('0x3f')+_0x5177d1+_0x99f8('0x40'))['join'](_0x332cfe,null,_0x332cfe+_0x99f8('0x16')+_0x5177d1+'.'+_0xf36408)[_0x99f8('0x17')](_0x5177d1+_0x99f8('0x41'),_0x514275)['where'](_0x99f8('0x42'),NOW)[_0x99f8('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5177d1,_0x332cfe,_0xf36408,'cm_hopper',[_0x99f8('0x43'),_0x99f8('0x44')]))[_0x99f8('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5177d1,_0x332cfe,_0xf36408,'cm_hopper',['\x22always\x22'])))[_0x99f8('0x45')]();}function insertCmHopperBlack(_0x1a2955,_0x5b0323,_0x6d42e0,_0x3a9cd5){var _0x361e37=['cm_contacts.phone','cm_contacts.id',_0x99f8('0x31'),_0x5b0323+'.'+_0x3a9cd5,_0x99f8('0x32'),_0x99f8('0x33')];return squel[_0x99f8('0x46')]()['into']('cm_hopper_black')[_0x99f8('0x35')](['phone',_0x99f8('0x37'),_0x99f8('0x38'),_0x3a9cd5,_0x99f8('0x39'),_0x99f8('0x3a')],squel[_0x99f8('0x11')]()['fields'](_0x361e37)[_0x99f8('0x14')](_0x5b0323)[_0x99f8('0x15')](_0x99f8('0x3e'),null,_0x99f8('0x3f')+_0x5b0323+_0x99f8('0x40'))[_0x99f8('0x15')](_0x6d42e0,null,_0x6d42e0+_0x99f8('0x16')+_0x5b0323+'.'+_0x3a9cd5)[_0x99f8('0x17')](_0x5b0323+_0x99f8('0x41'),_0x1a2955)[_0x99f8('0x17')](_0x99f8('0x42'),NOW)['where'](_0x99f8('0x47'),squel[_0x99f8('0x11')]()[_0x99f8('0x12')](_0x99f8('0x13'))['from']('cm_hopper_black')[_0x99f8('0x17')](_0x99f8('0x48'),_0x1a2955)[_0x99f8('0x17')](_0x3a9cd5+'\x20=\x20?',_0x5b0323+'.'+_0x3a9cd5)))[_0x99f8('0x45')]();}function insertCmHopperAdditionalPhones(_0x1a43b8){var _0x2ea25d=[_0x99f8('0x49'),_0x99f8('0x4a'),_0x99f8('0x4b'),_0x99f8('0x4c'),_0x99f8('0x4d')];return squel[_0x99f8('0x46')]()[_0x99f8('0x4e')](_0x99f8('0x4f'))[_0x99f8('0x35')]([_0x99f8('0x50'),_0x99f8('0x13'),'OrderBy',_0x99f8('0x39'),_0x99f8('0x3a')],squel[_0x99f8('0x11')]()[_0x99f8('0x3d')](_0x2ea25d)[_0x99f8('0x14')](_0x99f8('0x51'))[_0x99f8('0x15')]('cm_contacts',null,_0x99f8('0x52'))[_0x99f8('0x15')](_0x99f8('0x53'),null,_0x99f8('0x54'))[_0x99f8('0x17')](_0x99f8('0x55'),_0x1a43b8)[_0x99f8('0x17')](_0x99f8('0x42'),NOW))[_0x99f8('0x45')]();}function insertCmContact(_0x1cc0ec,_0x453ebc,_0x5ec3a4,_0x2701bf){var _0x188248=_['concat'](_[_0x99f8('0x56')](_0x2701bf),['ListId',_0x99f8('0x57'),_0x99f8('0x39'),_0x99f8('0x3a')]);return squel[_0x99f8('0x46')]()[_0x99f8('0x4e')](_0x99f8('0x3e'))[_0x99f8('0x35')](_0x188248,squel[_0x99f8('0x11')]()[_0x99f8('0x3d')](_0x188248)['from'](_0x453ebc)[_0x99f8('0x17')]('('+_0x5ec3a4[_0x99f8('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0x99f8('0x11')]()['fields'](_0x5ec3a4)[_0x99f8('0x14')](_0x99f8('0x3e'))[_0x99f8('0x17')](_0x99f8('0x48'),_0x1cc0ec))['where'](_0x99f8('0x58'),squel['select']()['field'](_0x99f8('0x59'),'min_id')[_0x99f8('0x14')](_0x453ebc)[_0x99f8('0x5a')](_0x5ec3a4[_0x99f8('0x15')](','))))[_0x99f8('0x45')]();}function handleStop(){logger[_0x99f8('0x5b')](_0x99f8('0x5c'));stopped=!![];}function handleUncaughtException(_0x5e3d25){logger[_0x99f8('0x22')](_0x5e3d25[_0x99f8('0x23')]);process[_0x99f8('0x5d')](0x1);}function handleError(_0x6262b8,_0x233713){stats[_0x99f8('0x5e')]['push']({'name':_0x233713[_0x99f8('0x5f')],'message':_0x233713[_0x99f8('0x23')],'row':_0x6262b8});}function handleQuery(_0x1a202d){logger[_0x99f8('0x5b')](_0x1a202d);return db[_0x99f8('0x1a')][_0x99f8('0x1b')](_0x1a202d)['spread'](function(_0x1019c7){results[_0x99f8('0x26')](_0x1019c7);})['catch'](function(_0x6966b){logger[_0x99f8('0x22')](_0x6966b['message']);});}function main(_0x4694d4,_0x9959b9,_0x127290,_0x2357e4){logger[_0x99f8('0x5b')]('main',_0x4694d4,JSON['stringify'](_0x9959b9));process['send']('start');var _0x4ef100=_0x9959b9[_0x99f8('0x60')];var _0x5d1b54=_[_0x99f8('0x61')](_0x4ef100);var _0x18eb6a=_0x9959b9[_0x99f8('0x62')];var _0x4e9908=path[_0x99f8('0x15')](config[_0x99f8('0x63')],'server/files/tmp',_0x18eb6a+_0x99f8('0x64'));logger[_0x99f8('0x5b')](_0x99f8('0x65'),_0x9959b9);db[_0x99f8('0x66')][_0x99f8('0x67')]({'raw':!![],'attributes':['id','name']})[_0x99f8('0x21')](function(_0x810bf8){for(var _0xb48f2b=0x0;_0xb48f2b<_0x810bf8[_0x99f8('0x25')];_0xb48f2b++){if(_0x810bf8[_0xb48f2b][_0x99f8('0x68')]in _0x4ef100){contactItemTypes['push'](_0x810bf8[_0xb48f2b]);delete _0x5d1b54[_0x810bf8[_0xb48f2b][_0x99f8('0x68')]];hasAdditionalPhones=!![];}for(var _0x2b09ab in _0x4ef100){if(_0x810bf8[_0xb48f2b][_0x99f8('0x68')]+_0x99f8('0x69')===_0x2b09ab){phoneDescriptions[_0x99f8('0x26')]({'itemTypeId':_0x810bf8[_0xb48f2b]['id'],'description':_0x2b09ab});delete _0x5d1b54[_0x2b09ab];}}}if(hasAdditionalPhones)_0x5d1b54[_0x99f8('0x1f')]='';var _0x3ebdcd=_[_0x99f8('0x56')](_0x5d1b54)[_0x99f8('0x15')]();logger[_0x99f8('0x5b')]('header',_0x3ebdcd);fs['writeFileSync'](_0x4e9908,_0x3ebdcd+'\x0a');Papa['parse'](fs['createReadStream'](_0x4694d4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x541433,_0x1a865c){try{for(var _0x366255=0x0,_0x5df654=[];_0x366255<_0x541433[_0x99f8('0x6a')][_0x99f8('0x25')];_0x366255++){stats['rows']+=0x1;if(_0x541433[_0x99f8('0x5e')][_0x366255]){handleError(_0x541433['data'][_0x366255],_0x541433[_0x99f8('0x5e')][_0x366255]);}else{var _0x42a41c=[];var _0x573ec0=[];var _0x1f195b={};for(var _0xc0c66d in _0x4ef100){let _0x499b37=contactItemTypes[_0x99f8('0x6b')](_0x112fd9=>_0x112fd9['name']===_0xc0c66d);let _0x33b262=contactItemTypes['find'](_0x23d7b3=>_0x23d7b3['name']+_0x99f8('0x69')===_0xc0c66d);if(_[_0x99f8('0x1e')](_0x499b37)&&_['isNil'](_0x33b262)){if(_0x4ef100['hasOwnProperty'](_0xc0c66d)){if(_0x541433[_0x99f8('0x6a')][_0x366255][_0x4ef100[_0xc0c66d]]){var _0x161a72=_[_0x99f8('0x6c')](_0x541433[_0x99f8('0x6a')][_0x366255][_0x4ef100[_0xc0c66d]][_0x99f8('0x6d')](/"/g,'\x27'));switch(_0xc0c66d){case _0x99f8('0x36'):var _0x5b2f47=moment(_0x161a72,_0x99f8('0xd'),!![]);if(_0x5b2f47['isValid']()){_0x5df654[_0x99f8('0x26')]('\x22'+_0x161a72+'\x22');}else{_0x42a41c[_0x99f8('0x26')](_0x99f8('0x6e'));}break;case _0x99f8('0x6f'):var _0x2f4ed9=parseInt(_0x161a72);_0x161a72=_[_0x99f8('0x70')](_0x2f4ed9)||_0x2f4ed9<0x0||_0x2f4ed9>0x4?_0x2357e4?0x3:0x2:_0x2f4ed9;_0x5df654[_0x99f8('0x26')]('\x22'+_0x161a72+'\x22');break;case _0x99f8('0x3b'):var _0x31d48b=parseInt(_0x161a72);if(_['isNumber'](_0x31d48b)&&_['includes'](_0x127290,_0x31d48b)){_0x5df654[_0x99f8('0x26')]('\x22'+_0x31d48b+'\x22');}else{_0x42a41c[_0x99f8('0x26')](_0x99f8('0x71'));}break;case _0x99f8('0x72'):if(isEmail(_0x161a72)){_0x5df654['push']('\x22'+_0x161a72+'\x22');}else{_0x42a41c['push'](_0x99f8('0x73'));}break;case _0x99f8('0x74'):var _0x4070f0=moment(_0x161a72,_0x99f8('0x75'),!![]);if(_0x4070f0['isValid']()){_0x5df654['push']('\x22'+_0x161a72+'\x22');}else{_0x42a41c[_0x99f8('0x26')](_0x99f8('0x76'));}break;default:_0x5df654[_0x99f8('0x26')]('\x22'+_0x161a72+'\x22');}}else{switch(_0xc0c66d){case _0x99f8('0x77'):case _0x99f8('0x13'):_0x42a41c['push'](_0xc0c66d+_0x99f8('0x78'));break;default:_0x5df654[_0x99f8('0x26')]('\x22\x22');}}}}else{var _0x1794be='';if(!_['isNil'](_0x499b37)){if(!_0x1f195b[_0x99f8('0x79')](_0x499b37['id'])){for(var _0x217616=0x0;_0x217616<_0x4ef100[_0xc0c66d]['length'];_0x217616++){var _0x161a72=_[_0x99f8('0x6c')](_0x541433[_0x99f8('0x6a')][_0x366255][_0x4ef100[_0xc0c66d][_0x217616]][_0x99f8('0x6d')](/"/g,'\x27'));var _0x30f28c=phoneDescriptions[_0x99f8('0x6b')](_0x238362=>_0x238362[_0x99f8('0x7a')]===_0x499b37['id']);if(!_['isNil'](_0x30f28c)){var _0x735c02=_[_0x99f8('0x6c')](_0x541433[_0x99f8('0x6a')][_0x366255][_0x4ef100[_0x30f28c[_0x99f8('0x7b')]][0x0]][_0x99f8('0x6d')](/"/g,'\x27'));if(!_[_0x99f8('0x1e')](_0x735c02))_0x161a72=_0x161a72+'§'+_0x735c02;}if(_0x1794be=='')_0x1794be=_0x161a72;else _0x1794be+='|'+_0x161a72;}_0x573ec0[_0x99f8('0x26')](_0x499b37['id']+':'+_0x1794be);_0x1f195b[_0x499b37['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5df654[_0x99f8('0x26')]('\x22'+_0x573ec0[_0x99f8('0x15')](';')+'\x22');}if(_0x42a41c[_0x99f8('0x25')]){handleError(_0x541433[_0x99f8('0x6a')][_0x366255],{'code':_0x99f8('0x7c'),'message':_0x42a41c['join']()});}else{fs[_0x99f8('0x7d')](_0x4e9908,_0x5df654[_0x99f8('0x15')]()+'\x0a');}_0x5df654=[];}if(!(stats[_0x99f8('0x7e')]%0xc8)){socket[_0x99f8('0x7f')]('contact:import:'+_0x18eb6a,stats);stats[_0x99f8('0x5e')]=[];}}if(stopped){logger[_0x99f8('0x5b')]('Abort\x20parser');_0x1a865c['abort']();}}catch(_0x46b208){handleError(_0x541433[_0x99f8('0x6a')][_0x366255],{'code':_0x99f8('0x80'),'message':_0x46b208[_0x99f8('0x23')]});logger[_0x99f8('0x22')]('step',_0x46b208[_0x99f8('0x23')]);}},'complete':function(){try{var _0x1a8341=[];var _0x3a2a40=tempTableName;_0x1a8341[_0x99f8('0x26')](_0x99f8('0x81')+_0x3a2a40+'\x20LIKE\x20cm_contacts;');logger[_0x99f8('0x5b')](_0x99f8('0x82'),contactItemTypes['length']);var _0xea1ff8=util['format'](_0x99f8('0x83'),_0x4e9908,_0x3a2a40,_0x3ebdcd,_0x9959b9[_0x99f8('0x38')],_0x9959b9[_0x99f8('0x57')]||null,NOW,NOW);if(_[_0x99f8('0x1e')](_0x4ef100[_0x99f8('0x36')])){_0xea1ff8+=_0x99f8('0x84');}_0x1a8341[_0x99f8('0x26')](_0xea1ff8);BPromise[_0x99f8('0x85')](_0x1a8341,handleQuery)[_0x99f8('0x21')](function(_0x5c91df){BPromise[_0x99f8('0x20')]([handleAdditionalPhones()])[_0x99f8('0x21')](function(){_0x1a8341=[];for(var _0x470c09=0x0;_0x470c09\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','buildExpression','type','default','text','value','start','read','and','Contact','operator','split','contact','find','ContactId','end','Tag','tags','ids','User','$substring','user','UserId','body','plainBody','some','compact','\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','clause','filter','get','capitalize','chat','Websites','Accounts','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join'];(function(_0x51ebad,_0x1e546f){var _0x20f39f=function(_0x4e26e4){while(--_0x4e26e4){_0x51ebad['push'](_0x51ebad['shift']());}};_0x20f39f(++_0x1e546f);}(_0xa460,0xe4));var _0x0a46=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0xa460[_0x3dc538];return _0x72c2fd;};'use strict';var _=require(_0x0a46('0x0'));var squel=require(_0x0a46('0x1'));var as=require(_0x0a46('0x2'));var qs=require(_0x0a46('0x3'));var updateInteraction=require(_0x0a46('0x4'))[_0x0a46('0x5')];var utils=require(_0x0a46('0x6'));var db=require(_0x0a46('0x7'))['db'];function skipInteractionsQuery(_0x352547,_0x160da8,_0x48e5aa){var _0x10b1dc=![];var _0x104127=utils[_0x0a46('0x8')](_0x352547);if(_0x160da8[_0x0a46('0x9')]===_0x0a46('0xa')&&!_0x48e5aa[_0x0a46('0xb')]&&!_0x48e5aa[_0x104127]){_0x10b1dc=!![];}return _0x10b1dc;}function getTagsQuery(){return squel[_0x0a46('0xc')]()['field']('id')[_0x0a46('0xd')](_0x0a46('0xe'))['field'](_0x0a46('0xf'))[_0x0a46('0x10')](_0x0a46('0x11'));}function getUsersQuery(_0x2a2574,_0x40457e){var _0x8e454d=utils[_0x0a46('0x12')](_0x2a2574);var _0xf6f23e=_0x0a46('0x13')+_0x2a2574+_0x0a46('0x14');var _0x4a3ab8=squel[_0x0a46('0xc')]()[_0x0a46('0xd')](_0x0a46('0x15'))['field'](_0x0a46('0x16'))[_0x0a46('0xd')](_0x0a46('0x17')+_0x8e454d)[_0x0a46('0x10')](_0xf6f23e,'ui')[_0x0a46('0x18')](_0x0a46('0x19'),'u',_0x0a46('0x1a'));if(_0x40457e[_0x0a46('0x1b')]>0x0){_0x4a3ab8[_0x0a46('0x1c')](_0x0a46('0x17')+_0x8e454d+'\x20IN\x20?',_[_0x0a46('0x1d')](_0x40457e,'id'));}return _0x4a3ab8;}function getInteractionsQuery(_0x85d4d2){var _0x10ecb1=utils[_0x0a46('0x1e')](_0x85d4d2);var _0x2a0c5b=utils[_0x0a46('0x8')](_0x85d4d2);var _0x35b9a2=utils['getInteractionFK'](_0x85d4d2);return squel[_0x0a46('0xc')]()[_0x0a46('0x10')](_0x10ecb1[_0x0a46('0x1f')],'i')[_0x0a46('0x18')](_0x0a46('0x20'),'c',_0x0a46('0x21'))[_0x0a46('0x18')](_0x0a46('0x19'),'o',_0x0a46('0x22'))['left_join'](_0x10ecb1[_0x0a46('0x23')],'a',_0x0a46('0x24')+_0x2a0c5b)[_0x0a46('0x18')](_0x10ecb1[_0x0a46('0x25')],'me',_0x0a46('0x26')+_0x35b9a2+_0x0a46('0x27'))['left_join'](_0x10ecb1['interactionsTags'],'it',_0x0a46('0x28')+_0x35b9a2+_0x0a46('0x27'))[_0x0a46('0x18')](_0x0a46('0x11'),'t',_0x0a46('0x29'));}function getSqlClauses(){var _0x242ced={'body':squel[_0x0a46('0x2a')](),'contact':squel[_0x0a46('0x2a')](),'default':squel[_0x0a46('0x2a')](),'fields':squel[_0x0a46('0x2a')](),'filter':squel['expr'](),'read':squel[_0x0a46('0x2a')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x242ced;}function parseTagParameter(_0x3bc952){var _0x26c509=squel[_0x0a46('0x2a')]();if(_0x3bc952){var _0x3fc827=utils[_0x0a46('0x2b')](_0x3bc952);_0x3fc827[_0x0a46('0x2c')](function(_0x101232){_0x26c509['or'](_0x0a46('0x2d'),'%,'+_0x101232+',%');});}return _0x26c509;}function parseReadParameter(_0x45ecb6){var _0x1796e6='';if(_0x45ecb6){_0x1796e6='unreadMessages\x20{OPERATOR}\x200';if(_0x45ecb6==='1'){_0x1796e6=_0x1796e6['replace'](_0x0a46('0x2e'),'=');}else{_0x1796e6=_0x1796e6['replace'](_0x0a46('0x2e'),'>');}}return _0x1796e6;}function parseSearchFilter(_0x34b797,_0xaf843c){var _0x36ed22=squel['expr']();if(_0xaf843c){var _0x110d66=_0xaf843c[_0x0a46('0x2f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x24098b=qs[_0x0a46('0x30')](_0x110d66);if(qs[_0x0a46('0x31')](_0x110d66)){_0x36ed22['or'](_0x0a46('0x32'),_0x24098b+'%');if([_0x0a46('0x33'),_0x0a46('0x34')][_0x0a46('0x35')](_0x34b797)){_0x36ed22['or'](_0x0a46('0x36'),_0x24098b+'%');}else if(_0x34b797===_0x0a46('0x37')){_0x36ed22['or'](_0x0a46('0x38'),_0x24098b+'%');}else if(_0x34b797===_0x0a46('0x39')){_0x36ed22['or']('i.from\x20LIKE\x20?',_0x24098b+'%');}}else if(_0x34b797===_0x0a46('0x3a')&&qs['isEmail'](_0x110d66)){_0x36ed22['or'](_0x0a46('0x3b'),_0x24098b+'%');}else{if(_0x34b797==='mail'){_0x36ed22['or'](_0x0a46('0x3c'),qs['getFullTextValue'](_0x110d66,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a46('0x3d')](_0x110d66));}else if(_0x34b797!==_0x0a46('0x37')){_0x36ed22['or'](_0x0a46('0x3e'),qs['getFullTextValue'](_0x110d66));}_0x36ed22['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a46('0x3d')](_0x110d66,!![]),null);}}return _0x36ed22;}function parseAdvancedSearchFilter(_0x1d02dd,_0x13c385){var _0x203f5d=getSqlClauses();var _0x18d96b=as[_0x0a46('0x3f')](_0x1d02dd);var _0x55050e=_0x18d96b[_0x0a46('0x40')];for(var _0x64a364=0x0;_0x64a364<_0x18d96b[_0x0a46('0x41')][_0x0a46('0x1b')];_0x64a364++){var _0x2b8ce3=_0x18d96b[_0x0a46('0x41')][_0x64a364];var _0xd8728a='i';var _0x440e27=_['find'](_0x13c385,[_0x0a46('0xe'),_0x2b8ce3[_0x0a46('0xd')]]);if(_0x440e27){var _0x347453=as[_0x0a46('0x42')](_0xd8728a,_0x440e27[_0x0a46('0x43')],_0x2b8ce3);_0x203f5d[_0x0a46('0x44')][_0x55050e](_0x347453[_0x0a46('0x45')],_0x347453[_0x0a46('0x46')][_0x0a46('0x47')],_0x347453['value']['end']);}else{switch(_0x2b8ce3[_0x0a46('0xd')]){case'unreadMessages':var _0x2ed64a=parseReadParameter(_0x2b8ce3[_0x0a46('0x46')]);_0x203f5d[_0x0a46('0x48')][_0x0a46('0x49')](_0x2ed64a);break;case _0x0a46('0x4a'):if(_0x2b8ce3[_0x0a46('0x4b')]==='$substring'){if(_0x2b8ce3[_0x0a46('0x46')][_0x0a46('0x4c')]('\x20')[_0x0a46('0x1b')]>0x1){_0x203f5d[_0x0a46('0x4d')][_0x55050e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2b8ce3[_0x0a46('0x46')],!![]),null);}else{var _0x189e99='%'+_0x2b8ce3[_0x0a46('0x46')]+'%';_0x203f5d['contact'][_0x55050e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x189e99,_0x189e99,_0x189e99);}}else{_0x440e27=_[_0x0a46('0x4e')](_0x13c385,[_0x0a46('0xe'),'ContactId']);_0x2b8ce3[_0x0a46('0xd')]=_0x0a46('0x4f');_0x347453=as[_0x0a46('0x42')](_0xd8728a,_0x440e27[_0x0a46('0x43')],_0x2b8ce3);_0x203f5d['contact'][_0x55050e](_0x347453['text'],_0x347453[_0x0a46('0x46')][_0x0a46('0x47')],_0x347453['value'][_0x0a46('0x50')]);}break;case _0x0a46('0x51'):var _0x3d502a=_0x2b8ce3[_0x0a46('0x46')]['split'](',')[_0x0a46('0x1d')](function(_0x268700){return Number(_0x268700);});var _0x397454=parseTagParameter(_0x3d502a);_0x203f5d[_0x0a46('0x52')]['clause']['and'](_0x397454);_0x203f5d[_0x0a46('0x52')][_0x0a46('0x53')]=_0x3d502a;break;case _0x0a46('0x54'):if(_0x2b8ce3[_0x0a46('0x4b')]===_0x0a46('0x55')){_0x203f5d[_0x0a46('0x56')][_0x55050e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x2b8ce3['value']+'%',null);}else{_0x440e27=_[_0x0a46('0x4e')](_0x13c385,[_0x0a46('0xe'),_0x0a46('0x57')]);_0x2b8ce3['field']='UserId';_0x347453=as[_0x0a46('0x42')](_0xd8728a,_0x440e27[_0x0a46('0x43')],_0x2b8ce3);_0x203f5d['user'][_0x55050e](_0x347453['text'],_0x347453[_0x0a46('0x46')][_0x0a46('0x47')],_0x347453[_0x0a46('0x46')]['end']);}break;case _0x0a46('0x58'):case _0x0a46('0x59'):_0x347453=as[_0x0a46('0x42')]('me',null,_0x2b8ce3);_0x203f5d[_0x0a46('0x58')][_0x55050e](_0x347453['text'],_0x347453[_0x0a46('0x46')][_0x0a46('0x47')],_0x347453[_0x0a46('0x46')]['end']);break;}}}return _0x203f5d;}function parseModelFields(_0x3e9e9a,_0x4efc52,_0x19c207){var _0x33ab3a=utils[_0x0a46('0x8')](_0x3e9e9a);var _0xb9b6bb=squel[_0x0a46('0x2a')]();var _0x4421bb=_(_0x4efc52)['keys']()['map'](function(_0x2bb9b6){return _[_0x0a46('0x5a')](_0x19c207,['name',_0x2bb9b6])?_0x2bb9b6:undefined;})[_0x0a46('0x5b')]()['value']();if(_0x4421bb['length']>0x0){_0x4421bb[_0x0a46('0x2c')](function(_0x243db3){if(_0x243db3===_0x33ab3a){_0xb9b6bb[_0x0a46('0x49')]('i.'+_0x33ab3a+_0x0a46('0x5c'),[]['concat'](_0x4efc52[_0x243db3]));}else if(_0x243db3===_0x0a46('0x5d')){var _0x4e70d1=JSON[_0x0a46('0x5e')](_0x4efc52[_0x243db3])[_0x0a46('0x5f')];var _0x7d75d1=JSON['parse'](_0x4efc52[_0x243db3])[_0x0a46('0x60')];_0xb9b6bb[_0x0a46('0x49')](_0x0a46('0x61'),_0x4e70d1,_0x7d75d1);}else{if(_0x4efc52[_0x243db3]==='null'){_0xb9b6bb['and']('i.'+_0x243db3+_0x0a46('0x62'));}else{_0xb9b6bb['and']('i.'+_0x243db3+_0x0a46('0x63'),_0x4efc52[_0x243db3]);}}});}return _0xb9b6bb;}function parseQueryParameters(_0x3d4101,_0x3502df,_0x12d9b1){var _0x1de156=getSqlClauses();return Promise[_0x0a46('0x64')]()[_0x0a46('0x65')](function(){return parseModelFields(_0x3d4101,_0x3502df,_0x12d9b1);})['then'](function(_0x4c12fc){_0x1de156[_0x0a46('0x66')][_0x0a46('0x49')](_0x4c12fc);return parseReadParameter(_0x3502df[_0x0a46('0x48')]);})[_0x0a46('0x65')](function(_0x511c72){_0x1de156[_0x0a46('0x48')][_0x0a46('0x49')](_0x511c72);return parseTagParameter(_0x3502df[_0x0a46('0x67')]);})['then'](function(_0x350fcc){_0x1de156[_0x0a46('0x52')][_0x0a46('0x68')][_0x0a46('0x49')](_0x350fcc);return parseSearchFilter(_0x3d4101,_0x3502df[_0x0a46('0x69')]);})['then'](function(_0x1d1617){_0x1de156['filter']=_0x1d1617;return _0x1de156;});}function checkAccountsRestrictions(_0x2b3c0f,_0x34265a,_0xf57446){var _0x56176b=utils['getAccountFK'](_0x2b3c0f);var _0x2c739b=_0x0a46('0x6a')+_[_0x0a46('0x6b')](_0x2b3c0f)+(_0x2b3c0f===_0x0a46('0x6c')?_0x0a46('0x6d'):_0x0a46('0x6e'));var _0x29ab85=squel[_0x0a46('0x2a')]();return Promise[_0x0a46('0x64')]()['then'](function(){if(_0xf57446[_0x0a46('0xb')]&&_0x34265a[_0x0a46('0x9')]==='agent'){return _0x34265a[_0x2c739b]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x11609f){if(_0x11609f){if(_0x11609f[_0x0a46('0x1b')]===0x0){_0x29ab85['and']('i.'+_0x56176b+_0x0a46('0x62'));}else{_0x29ab85[_0x0a46('0x49')]('i.'+_0x56176b+_0x0a46('0x5c'),_['map'](_0x11609f,'id'));}}else if(!_0xf57446[_0x56176b]){_0x29ab85[_0x0a46('0x49')]('i.'+_0x56176b+'\x20IS\x20NOT\x20NULL');}})[_0x0a46('0x65')](function(){return _0x29ab85;});}function getClosedOrderClause(_0x354291,_0x56cbdb){var _0x31ac16='';var _0x14c61e=['i.thirdDisposition',_0x0a46('0x6f'),_0x0a46('0x70')];if(_0x354291===_0x0a46('0x3a')){_0x14c61e[_0x0a46('0x71')](_0x0a46('0x72'));}if(_0x56cbdb['closed']==='0'&&_0x354291===_0x0a46('0x3a')){_0x31ac16='i.substatus';}else{if(_0x56cbdb[_0x0a46('0x73')]==='1'){_0x14c61e['shift']();}_0x31ac16=_0x0a46('0x74')+_0x14c61e[_0x0a46('0x75')](',\x20')+')';}return _0x31ac16;}function getFilteredInteractions(_0x2f65ac,_0x3839c9,_0x49d7d3,_0x16ed73){var _0x38d606=utils[_0x0a46('0x12')](_0x2f65ac);var _0x1f65d0=_[_0x0a46('0x6b')](_0x2f65ac)+_0x0a46('0x76');var _0x54de2a=[];var _0x31e2e5=getTagsQuery();var _0xe536b9={'type':db[_0x0a46('0x77')][_0x0a46('0x78')][_0x0a46('0x79')],'raw':!![]};var _0x381588=[];var _0x4abf7d=[];return db[_0x0a46('0x7a')][_0x0a46('0x7b')](_0x31e2e5[_0x0a46('0x7c')](),_0xe536b9)[_0x0a46('0x65')](function(_0x403abe){_0x54de2a=_['keyBy'](_0x403abe,'id');_0xe536b9=_[_0x0a46('0x7d')](_0xe536b9,{'model':db[_0x1f65d0],'mapToModel':!![],'nest':!![]});if(_0x49d7d3[_0x0a46('0x66')]){_0x16ed73[_0x0a46('0x7e')][_0x0a46('0x2c')](function(_0x39e960){_0x3839c9['field']('i.'+_0x39e960);});}else{_0x3839c9[_0x0a46('0xd')](_0x0a46('0x7f'),_0x0a46('0x80'));_0x3839c9[_0x0a46('0xd')]('a.key',_0x0a46('0x81'));_0x3839c9['field'](_0x0a46('0x82'),_0x0a46('0x83'));if(_0x2f65ac===_0x0a46('0x3a')){_0x3839c9[_0x0a46('0xd')]('a.email',_0x0a46('0x84'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x85'),_0x0a46('0x86'));_0x3839c9['field']('i.id');_0x3839c9[_0x0a46('0xd')](_0x0a46('0x87'));_0x3839c9['field'](_0x0a46('0x88'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x89'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x8a'));_0x3839c9['field'](_0x0a46('0x8b'));_0x3839c9[_0x0a46('0xd')]('i.lastMsgAt');_0x3839c9[_0x0a46('0xd')](_0x0a46('0x8c'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x8d'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x70'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x6f'));_0x3839c9['field'](_0x0a46('0x8e'));_0x3839c9[_0x0a46('0xd')]('i.substatus');_0x3839c9['field'](_0x0a46('0x8f'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x90'));_0x3839c9['field'](_0x0a46('0x91'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x92'));}else if(_0x2f65ac===_0x0a46('0x39')){_0x3839c9[_0x0a46('0xd')](_0x0a46('0x93'),'contactName');}else{_0x3839c9[_0x0a46('0xd')](_0x0a46('0x94'),_0x0a46('0x86'));}if(_0x2f65ac!=='mail'){_0x3839c9['field'](_0x0a46('0x95'));}_0x3839c9['field'](_0x0a46('0x96'),_0x0a46('0x97'));_0x3839c9['field'](_0x0a46('0x98'),_0x0a46('0x99'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x9a'),_0x0a46('0x9b'));_0x3839c9['field'](_0x0a46('0x9c'),_0x0a46('0x9d'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0x9e'),_0x0a46('0x9f'));_0x3839c9[_0x0a46('0xd')]('c.fax','Contact.fax');_0x3839c9[_0x0a46('0xd')]('o.fullname',_0x0a46('0xa0'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0xa1'),_0x0a46('0xa2'));_0x3839c9[_0x0a46('0xd')](_0x0a46('0xa3'),'TagIds');}if(_0x16ed73['limit']){_0x3839c9[_0x0a46('0xa4')](_0x16ed73['limit']);}if(_0x16ed73['offset']){_0x3839c9['offset'](_0x16ed73[_0x0a46('0xa5')]);}return db[_0x0a46('0x7a')][_0x0a46('0x7b')](_0x3839c9['toString'](),_0xe536b9);})[_0x0a46('0x65')](function(_0xaca27f){_0x381588=_0xaca27f;var _0x51c883=getUsersQuery(_0x2f65ac,_0x381588);return db[_0x0a46('0x7a')][_0x0a46('0x7b')](_0x51c883[_0x0a46('0x7c')](),_0xe536b9);})['then'](function(_0x492c02){_0x4abf7d=_['groupBy'](_0x492c02,_0x38d606);if(_0x2f65ac==='mail'){return db[_0x0a46('0xa6')][_0x0a46('0xa7')]({'attributes':[_0x0a46('0xa8')],'raw':!![]});}})[_0x0a46('0x65')](function(_0x5c7335){var _0x7a33ec=_0x5c7335?_0x5c7335['enableEmailPreview']:undefined;var _0x4a15c0=_0x381588[_0x0a46('0x1d')](function(_0x4322d3){return updateInteraction(_0x4322d3,_0x54de2a,_0x4abf7d,_0x7a33ec);});return Promise[_0x0a46('0xa9')](_0x4a15c0);});}function countFilteredInteractions(_0x40006f,_0x2b3613){var _0x5d7ade=_0x40006f[_0x0a46('0xaa')]();_0x5d7ade[_0x0a46('0xd')](_0x0a46('0xab'));_0x5d7ade[_0x0a46('0xd')](_0x0a46('0x7f'),_0x0a46('0x80'));var _0xf8bd7=utils[_0x0a46('0x2b')](_0x2b3613);if(!_[_0x0a46('0xac')](_0xf8bd7)){_0x5d7ade[_0x0a46('0x1c')]('t.id\x20IN\x20?',_0xf8bd7);}var _0x99e18d={'type':db[_0x0a46('0x77')]['QueryTypes'][_0x0a46('0x79')],'raw':!![]};return db[_0x0a46('0x7a')][_0x0a46('0x7b')](_0x5d7ade[_0x0a46('0x7c')](),_0x99e18d);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xd4e7=['select','field','name','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','where','ui.','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','length','conditions','find','type','start','value','read','and','Contact','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','tags','clause','ids','User','operator','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','end','body','plainBody','text','keys','some','compact','forEach','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','capitalize','chat','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.createdAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.to','i.MailAccountId','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.*','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','unreadMessages','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','search'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0xd4e7,0x9c));var _0x7d4e=function(_0x57bec8,_0x5b886b){_0x57bec8=_0x57bec8-0x0;var _0x20d7cb=_0xd4e7[_0x57bec8];return _0x20d7cb;};'use strict';var _=require(_0x7d4e('0x0'));var squel=require(_0x7d4e('0x1'));var as=require(_0x7d4e('0x2'));var qs=require(_0x7d4e('0x3'));var updateInteraction=require(_0x7d4e('0x4'))[_0x7d4e('0x5')];var utils=require(_0x7d4e('0x6'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x898a29,_0x580d1d,_0x48ace0){var _0x3d5dbc=![];var _0x1b7063=utils[_0x7d4e('0x7')](_0x898a29);if(_0x580d1d[_0x7d4e('0x8')]==='agent'&&!_0x48ace0[_0x7d4e('0x9')]&&!_0x48ace0[_0x1b7063]){_0x3d5dbc=!![];}return _0x3d5dbc;}function getTagsQuery(){return squel[_0x7d4e('0xa')]()[_0x7d4e('0xb')]('id')[_0x7d4e('0xb')](_0x7d4e('0xc'))[_0x7d4e('0xb')]('color')[_0x7d4e('0xd')](_0x7d4e('0xe'));}function getUsersQuery(_0x15f011,_0x213b7d){var _0x4445cc=utils[_0x7d4e('0xf')](_0x15f011);var _0x727d71='user_has_'+_0x15f011+_0x7d4e('0x10');var _0x22ff2a=squel['select']()[_0x7d4e('0xb')](_0x7d4e('0x11'))[_0x7d4e('0xb')](_0x7d4e('0x12'))[_0x7d4e('0xb')]('ui.'+_0x4445cc)[_0x7d4e('0xd')](_0x727d71,'ui')[_0x7d4e('0x13')](_0x7d4e('0x14'),'u',_0x7d4e('0x15'));if(_0x213b7d['length']>0x0){_0x22ff2a[_0x7d4e('0x16')](_0x7d4e('0x17')+_0x4445cc+_0x7d4e('0x18'),_[_0x7d4e('0x19')](_0x213b7d,'id'));}return _0x22ff2a;}function getInteractionsQuery(_0x171843){var _0x53c93f=utils[_0x7d4e('0x1a')](_0x171843);var _0x465682=utils[_0x7d4e('0x7')](_0x171843);var _0x8fd540=utils[_0x7d4e('0xf')](_0x171843);return squel['select']()['from'](_0x53c93f[_0x7d4e('0x1b')],'i')[_0x7d4e('0x13')](_0x7d4e('0x1c'),'c',_0x7d4e('0x1d'))['left_join']('users','o',_0x7d4e('0x1e'))[_0x7d4e('0x13')](_0x53c93f['accounts'],'a',_0x7d4e('0x1f')+_0x465682)[_0x7d4e('0x13')](_0x53c93f[_0x7d4e('0x20')],'me',_0x7d4e('0x21')+_0x8fd540+_0x7d4e('0x22'))[_0x7d4e('0x13')](_0x53c93f[_0x7d4e('0x23')],'it','it.'+_0x8fd540+_0x7d4e('0x22'))[_0x7d4e('0x13')](_0x7d4e('0xe'),'t',_0x7d4e('0x24'));}function getSqlClauses(){var _0x43372e={'body':squel[_0x7d4e('0x25')](),'contact':squel['expr'](),'default':squel[_0x7d4e('0x25')](),'fields':squel[_0x7d4e('0x25')](),'filter':squel[_0x7d4e('0x25')](),'read':squel[_0x7d4e('0x25')](),'tags':{'clause':squel[_0x7d4e('0x25')](),'ids':null},'user':squel[_0x7d4e('0x25')]()};return _0x43372e;}function parseTagParameter(_0x40de31){var _0x11a923=squel[_0x7d4e('0x25')]();if(_0x40de31){var _0xf3f80a=utils[_0x7d4e('0x26')](_0x40de31);_0xf3f80a['forEach'](function(_0x4bbb0d){_0x11a923['or'](_0x7d4e('0x27'),'%,'+_0x4bbb0d+',%');});}return _0x11a923;}function parseReadParameter(_0x11dfc4){var _0x3c119d='';if(_0x11dfc4){_0x3c119d='unreadMessages\x20{OPERATOR}\x200';if(_0x11dfc4==='1'){_0x3c119d=_0x3c119d[_0x7d4e('0x28')](_0x7d4e('0x29'),'=');}else{_0x3c119d=_0x3c119d[_0x7d4e('0x28')](_0x7d4e('0x29'),'>');}}return _0x3c119d;}function parseSearchFilter(_0x307e92,_0x46440d){var _0x93b851=squel['expr']();if(_0x46440d){var _0x4a3576=_0x46440d['replace']('\x5c','\x5c\x5c')[_0x7d4e('0x28')](/'/g,'\x27\x27');var _0x53cee5=qs[_0x7d4e('0x2a')](_0x4a3576);if(qs[_0x7d4e('0x2b')](_0x4a3576)){_0x93b851['or'](_0x7d4e('0x2c'),_0x53cee5+'%');if([_0x7d4e('0x2d'),_0x7d4e('0x2e')][_0x7d4e('0x2f')](_0x307e92)){_0x93b851['or'](_0x7d4e('0x30'),_0x53cee5+'%');}else if(_0x307e92===_0x7d4e('0x31')){_0x93b851['or'](_0x7d4e('0x32'),_0x53cee5+'%');}else if(_0x307e92===_0x7d4e('0x33')){_0x93b851['or']('i.from\x20LIKE\x20?',_0x53cee5+'%');}}else if(_0x307e92==='mail'&&qs[_0x7d4e('0x34')](_0x4a3576)){_0x93b851['or'](_0x7d4e('0x35'),_0x53cee5+'%');}else{if(_0x307e92===_0x7d4e('0x36')){_0x93b851['or'](_0x7d4e('0x37'),qs['getFullTextValue'](_0x4a3576,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7d4e('0x38')](_0x4a3576));}else if(_0x307e92!==_0x7d4e('0x31')){_0x93b851['or'](_0x7d4e('0x39'),qs['getFullTextValue'](_0x4a3576));}_0x93b851['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7d4e('0x38')](_0x4a3576,!![]),null);}}return _0x93b851;}function parseAdvancedSearchFilter(_0x2469f1,_0x144905){var _0x12c5c8=getSqlClauses();var _0x158c14=as[_0x7d4e('0x3a')](_0x2469f1);var _0x5ba336=_0x158c14[_0x7d4e('0x3b')];for(var _0x24c5ba=0x0;_0x24c5ba<_0x158c14['conditions'][_0x7d4e('0x3c')];_0x24c5ba++){var _0x19dbc2=_0x158c14[_0x7d4e('0x3d')][_0x24c5ba];var _0x2d08a1='i';var _0x17ccff=_[_0x7d4e('0x3e')](_0x144905,[_0x7d4e('0xc'),_0x19dbc2[_0x7d4e('0xb')]]);if(_0x17ccff){var _0x3144cd=as['buildExpression'](_0x2d08a1,_0x17ccff[_0x7d4e('0x3f')],_0x19dbc2);_0x12c5c8['default'][_0x5ba336](_0x3144cd['text'],_0x3144cd['value'][_0x7d4e('0x40')],_0x3144cd[_0x7d4e('0x41')]['end']);}else{switch(_0x19dbc2[_0x7d4e('0xb')]){case'unreadMessages':var _0x168fca=parseReadParameter(_0x19dbc2[_0x7d4e('0x41')]);_0x12c5c8[_0x7d4e('0x42')][_0x7d4e('0x43')](_0x168fca);break;case _0x7d4e('0x44'):if(_0x19dbc2['operator']==='$substring'){if(_0x19dbc2['value'][_0x7d4e('0x45')]('\x20')['length']>0x1){_0x12c5c8[_0x7d4e('0x46')][_0x5ba336](_0x7d4e('0x47'),qs[_0x7d4e('0x38')](_0x19dbc2[_0x7d4e('0x41')],!![]),null);}else{var _0x725e68='%'+_0x19dbc2[_0x7d4e('0x41')]+'%';_0x12c5c8[_0x7d4e('0x46')][_0x5ba336](_0x7d4e('0x48'),_0x725e68,_0x725e68,_0x725e68);}}else{_0x17ccff=_[_0x7d4e('0x3e')](_0x144905,[_0x7d4e('0xc'),_0x7d4e('0x49')]);_0x19dbc2[_0x7d4e('0xb')]=_0x7d4e('0x49');_0x3144cd=as[_0x7d4e('0x4a')](_0x2d08a1,_0x17ccff[_0x7d4e('0x3f')],_0x19dbc2);_0x12c5c8['contact'][_0x5ba336](_0x3144cd['text'],_0x3144cd['value'][_0x7d4e('0x40')],_0x3144cd[_0x7d4e('0x41')]['end']);}break;case _0x7d4e('0x4b'):var _0x529b27=_0x19dbc2[_0x7d4e('0x41')][_0x7d4e('0x45')](',')[_0x7d4e('0x19')](function(_0x437507){return Number(_0x437507);});var _0x3dbc58=parseTagParameter(_0x529b27);_0x12c5c8[_0x7d4e('0x4c')][_0x7d4e('0x4d')]['and'](_0x3dbc58);_0x12c5c8[_0x7d4e('0x4c')][_0x7d4e('0x4e')]=_0x529b27;break;case _0x7d4e('0x4f'):if(_0x19dbc2[_0x7d4e('0x50')]===_0x7d4e('0x51')){_0x12c5c8[_0x7d4e('0x52')][_0x5ba336](_0x7d4e('0x53'),'%'+_0x19dbc2[_0x7d4e('0x41')]+'%',null);}else{_0x17ccff=_['find'](_0x144905,[_0x7d4e('0xc'),_0x7d4e('0x54')]);_0x19dbc2[_0x7d4e('0xb')]=_0x7d4e('0x54');_0x3144cd=as[_0x7d4e('0x4a')](_0x2d08a1,_0x17ccff[_0x7d4e('0x3f')],_0x19dbc2);_0x12c5c8[_0x7d4e('0x52')][_0x5ba336](_0x3144cd['text'],_0x3144cd[_0x7d4e('0x41')][_0x7d4e('0x40')],_0x3144cd['value'][_0x7d4e('0x55')]);}break;case _0x7d4e('0x56'):case _0x7d4e('0x57'):_0x3144cd=as[_0x7d4e('0x4a')]('me',null,_0x19dbc2);_0x12c5c8[_0x7d4e('0x56')][_0x5ba336](_0x3144cd[_0x7d4e('0x58')],_0x3144cd[_0x7d4e('0x41')]['start'],_0x3144cd['value'][_0x7d4e('0x55')]);break;}}}return _0x12c5c8;}function parseModelFields(_0x4288cc,_0x3a99bb,_0x44ea7b){var _0x212d2d=utils['getAccountFK'](_0x4288cc);var _0x54268f=squel[_0x7d4e('0x25')]();var _0x2d4160=_(_0x3a99bb)[_0x7d4e('0x59')]()[_0x7d4e('0x19')](function(_0xe7851c){return _[_0x7d4e('0x5a')](_0x44ea7b,['name',_0xe7851c])?_0xe7851c:undefined;})[_0x7d4e('0x5b')]()['value']();if(_0x2d4160['length']>0x0){_0x2d4160[_0x7d4e('0x5c')](function(_0x1bdca4){if(_0x1bdca4===_0x212d2d){_0x54268f[_0x7d4e('0x43')]('i.'+_0x212d2d+_0x7d4e('0x18'),[]['concat'](_0x3a99bb[_0x1bdca4]));}else if(_0x1bdca4===_0x7d4e('0x5d')){var _0x1a1f73=JSON[_0x7d4e('0x5e')](_0x3a99bb[_0x1bdca4])[_0x7d4e('0x5f')];var _0xea55f3=JSON[_0x7d4e('0x5e')](_0x3a99bb[_0x1bdca4])[_0x7d4e('0x60')];_0x54268f[_0x7d4e('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a1f73,_0xea55f3);}else{if(_0x3a99bb[_0x1bdca4]===_0x7d4e('0x61')){_0x54268f['and']('i.'+_0x1bdca4+_0x7d4e('0x62'));}else{_0x54268f[_0x7d4e('0x43')]('i.'+_0x1bdca4+_0x7d4e('0x63'),_0x3a99bb[_0x1bdca4]);}}});}return _0x54268f;}function parseQueryParameters(_0x5e5123,_0x27bb06,_0x3d58d7){var _0x970ff8=getSqlClauses();return Promise['resolve']()[_0x7d4e('0x64')](function(){return parseModelFields(_0x5e5123,_0x27bb06,_0x3d58d7);})[_0x7d4e('0x64')](function(_0x171167){_0x970ff8[_0x7d4e('0x65')][_0x7d4e('0x43')](_0x171167);return parseReadParameter(_0x27bb06['read']);})[_0x7d4e('0x64')](function(_0x3692cd){_0x970ff8[_0x7d4e('0x42')]['and'](_0x3692cd);return parseTagParameter(_0x27bb06[_0x7d4e('0x66')]);})[_0x7d4e('0x64')](function(_0x127163){_0x970ff8[_0x7d4e('0x4c')][_0x7d4e('0x4d')]['and'](_0x127163);return parseSearchFilter(_0x5e5123,_0x27bb06[_0x7d4e('0x67')]);})['then'](function(_0x23999d){_0x970ff8[_0x7d4e('0x67')]=_0x23999d;return _0x970ff8;});}function checkAccountsRestrictions(_0x3d4996,_0x43ecd9,_0x429e73){var _0x22710f=utils[_0x7d4e('0x7')](_0x3d4996);var _0x59d324='get'+_[_0x7d4e('0x68')](_0x3d4996)+(_0x3d4996===_0x7d4e('0x69')?'Websites':_0x7d4e('0x6a'));var _0x5a2ae6=squel[_0x7d4e('0x25')]();return Promise[_0x7d4e('0x6b')]()[_0x7d4e('0x64')](function(){if(_0x429e73['search']&&_0x43ecd9[_0x7d4e('0x8')]==='agent'){return _0x43ecd9[_0x59d324]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x50e0d0){if(_0x50e0d0){if(_0x50e0d0[_0x7d4e('0x3c')]===0x0){_0x5a2ae6[_0x7d4e('0x43')]('i.'+_0x22710f+_0x7d4e('0x62'));}else{_0x5a2ae6[_0x7d4e('0x43')]('i.'+_0x22710f+'\x20IN\x20?',_['map'](_0x50e0d0,'id'));}}else if(!_0x429e73[_0x22710f]){_0x5a2ae6['and']('i.'+_0x22710f+_0x7d4e('0x6c'));}})[_0x7d4e('0x64')](function(){return _0x5a2ae6;});}function getClosedOrderClause(_0x5ad7a8,_0x1e2c87){var _0x43924c='';var _0x401783=[_0x7d4e('0x6d'),_0x7d4e('0x6e'),_0x7d4e('0x6f')];if(_0x5ad7a8===_0x7d4e('0x36')){_0x401783[_0x7d4e('0x70')](_0x7d4e('0x71'));}if(_0x1e2c87[_0x7d4e('0x72')]==='0'&&_0x5ad7a8===_0x7d4e('0x36')){_0x43924c='i.substatus';}else{if(_0x1e2c87['closed']==='1'){_0x401783[_0x7d4e('0x73')]();}_0x43924c=_0x7d4e('0x74')+_0x401783[_0x7d4e('0x75')](',\x20')+')';}return _0x43924c;}function getFilteredInteractions(_0x10498b,_0xc5be21,_0x34ca61,_0x5bd0b9){var _0x2b6311=utils[_0x7d4e('0xf')](_0x10498b);var _0x3180b3=_[_0x7d4e('0x68')](_0x10498b)+_0x7d4e('0x76');var _0x474099=[];var _0x495973=getTagsQuery();var _0x23e344={'type':db[_0x7d4e('0x77')][_0x7d4e('0x78')][_0x7d4e('0x79')],'raw':!![]};var _0x1ec20f=[];var _0x2b2964=[];return db[_0x7d4e('0x7a')][_0x7d4e('0x7b')](_0x495973[_0x7d4e('0x7c')](),_0x23e344)['then'](function(_0x431b93){_0x474099=_[_0x7d4e('0x7d')](_0x431b93,'id');_0x23e344=_[_0x7d4e('0x7e')](_0x23e344,{'model':db[_0x3180b3],'mapToModel':!![],'nest':!![]});if(_0x34ca61[_0x7d4e('0x65')]){_0x5bd0b9[_0x7d4e('0x7f')][_0x7d4e('0x5c')](function(_0x10fafa){_0xc5be21['field']('i.'+_0x10fafa);});}else{_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x80'),'unreadMessages');_0xc5be21['field']('a.key',_0x7d4e('0x81'));_0xc5be21['field'](_0x7d4e('0x82'),_0x7d4e('0x83'));if(_0x10498b==='mail'){_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x84'),_0x7d4e('0x85'));_0xc5be21[_0x7d4e('0xb')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x7d4e('0x86'));_0xc5be21[_0x7d4e('0xb')]('i.id');_0xc5be21['field'](_0x7d4e('0x87'));_0xc5be21[_0x7d4e('0xb')]('i.updatedAt');_0xc5be21[_0x7d4e('0xb')]('i.closed');_0xc5be21['field'](_0x7d4e('0x88'));_0xc5be21[_0x7d4e('0xb')]('i.attach');_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x89'));_0xc5be21['field'](_0x7d4e('0x8a'));_0xc5be21['field']('i.subject');_0xc5be21['field'](_0x7d4e('0x6f'));_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x6e'));_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x6d'));_0xc5be21[_0x7d4e('0xb')]('i.substatus');_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x8b'));_0xc5be21[_0x7d4e('0xb')]('i.ContactId');_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x8c'));_0xc5be21['field']('i.UserId');}else if(_0x10498b===_0x7d4e('0x33')){_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x8d'),_0x7d4e('0x86'));}else{_0xc5be21[_0x7d4e('0xb')]('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',_0x7d4e('0x86'));}if(_0x10498b!=='mail'){_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x8e'));}_0xc5be21[_0x7d4e('0xb')]('c.firstName',_0x7d4e('0x8f'));_0xc5be21[_0x7d4e('0xb')]('c.lastName',_0x7d4e('0x90'));_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x91'),'Contact.email');_0xc5be21['field'](_0x7d4e('0x92'),_0x7d4e('0x93'));_0xc5be21[_0x7d4e('0xb')]('c.mobile','Contact.mobile');_0xc5be21[_0x7d4e('0xb')]('c.fax',_0x7d4e('0x94'));_0xc5be21[_0x7d4e('0xb')](_0x7d4e('0x95'),'Owner.fullname');_0xc5be21['field'](_0x7d4e('0x96'),_0x7d4e('0x97'));_0xc5be21['field'](_0x7d4e('0x98'),'TagIds');}if(_0x5bd0b9[_0x7d4e('0x99')]){_0xc5be21['limit'](_0x5bd0b9['limit']);}if(_0x5bd0b9[_0x7d4e('0x9a')]){_0xc5be21[_0x7d4e('0x9a')](_0x5bd0b9['offset']);}return db[_0x7d4e('0x7a')][_0x7d4e('0x7b')](_0xc5be21[_0x7d4e('0x7c')](),_0x23e344);})[_0x7d4e('0x64')](function(_0x2e4631){_0x1ec20f=_0x2e4631;var _0x58c446=getUsersQuery(_0x10498b,_0x1ec20f);return db[_0x7d4e('0x7a')]['query'](_0x58c446[_0x7d4e('0x7c')](),_0x23e344);})[_0x7d4e('0x64')](function(_0x16c464){_0x2b2964=_[_0x7d4e('0x9b')](_0x16c464,_0x2b6311);if(_0x10498b===_0x7d4e('0x36')){return db[_0x7d4e('0x9c')][_0x7d4e('0x9d')]({'attributes':[_0x7d4e('0x9e')],'raw':!![]});}})['then'](function(_0x532539){var _0x18d97d=_0x532539?_0x532539['enableEmailPreview']:undefined;var _0x142d64=_0x1ec20f[_0x7d4e('0x19')](function(_0x20e497){return updateInteraction(_0x20e497,_0x474099,_0x2b2964,_0x18d97d);});return Promise[_0x7d4e('0x9f')](_0x142d64);});}function countFilteredInteractions(_0x490b46,_0x45a99f){var _0x508ef3=_0x490b46[_0x7d4e('0xa0')]();_0x508ef3['field'](_0x7d4e('0xa1'));_0x508ef3['field'](_0x7d4e('0x80'),_0x7d4e('0xa2'));var _0x120327=utils[_0x7d4e('0x26')](_0x45a99f);if(!_[_0x7d4e('0xa3')](_0x120327)){_0x508ef3[_0x7d4e('0x16')](_0x7d4e('0xa4'),_0x120327);}var _0x2b0df2={'type':db[_0x7d4e('0x77')][_0x7d4e('0x78')][_0x7d4e('0x79')],'raw':!![]};return db['sequelize'][_0x7d4e('0x7b')](_0x508ef3[_0x7d4e('0x7c')](),_0x2b0df2);}module[_0x7d4e('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index de6dc06..829f392 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0461=['talking','answered','unmanaged','abandoned','total','disposition','UserId','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','../../mysqldb','map','fullname','split','waiting'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0x0461,0x193));var _0x1046=function(_0xca3a5a,_0x17c9f1){_0xca3a5a=_0xca3a5a-0x0;var _0x4403e2=_0x0461[_0xca3a5a];return _0x4403e2;};'use strict';var _=require('lodash');var db=require(_0x1046('0x0'))['db'];function getInteractionUsers(_0x28ec8c,_0x37ff6f){return new Promise(function(_0x35c743,_0x513c1f){try{var _0xf56a4=[];if(_0x37ff6f[_0x28ec8c]){_0xf56a4=_0x37ff6f[_0x28ec8c][_0x1046('0x1')](function(_0x12fd2b){return{'id':_0x12fd2b['id'],'fullname':_0x12fd2b[_0x1046('0x2')]};});}return _0x35c743(_0xf56a4);}catch(_0x55258d){_0x513c1f(_0x55258d);}});}function getInteractionTags(_0x1d0d43,_0x8b113a){var _0x2097f1=[];if(_0x1d0d43){_0x1d0d43[_0x1046('0x3')](',')['forEach'](function(_0x2565bd){_0x2097f1['push'](_0x8b113a[_0x2565bd]);});}return _0x2097f1;}function updateWaitingCounter(_0x3a03d7){if(_0x3a03d7[_0x1046('0x4')]){_0x3a03d7[_0x1046('0x4')]-=0x1;}}function updateInteractionCounters(_0xc5ea7e){_0xc5ea7e[_0x1046('0x4')]=0x0;_0xc5ea7e[_0x1046('0x5')]=0x0;_0xc5ea7e[_0x1046('0x6')]=0x0;_0xc5ea7e[_0x1046('0x7')]=0x0;_0xc5ea7e[_0x1046('0x8')]=0x0;_0xc5ea7e[_0x1046('0x9')]=0x0;if(_0xc5ea7e['closed']){if(_0xc5ea7e[_0x1046('0xa')]===_0x1046('0x8')){_0xc5ea7e[_0x1046('0x8')]+=0x1;updateWaitingCounter(_0xc5ea7e);}if(_0xc5ea7e['UserId']){_0xc5ea7e[_0x1046('0x6')]+=0x1;if(_0xc5ea7e['talking']){_0xc5ea7e[_0x1046('0x5')]-=0x1;}}else{if(_0xc5ea7e[_0x1046('0xa')]){_0xc5ea7e['unmanaged']+=0x1;updateWaitingCounter(_0xc5ea7e);}}}else{if(!_0xc5ea7e['UserId']){_0xc5ea7e[_0x1046('0x4')]+=0x1;}if(_0xc5ea7e[_0x1046('0xb')]){_0xc5ea7e[_0x1046('0x5')]+=0x1;updateWaitingCounter(_0xc5ea7e);}}_0xc5ea7e[_0x1046('0x9')]+=0x1;return _0xc5ea7e;}function getLastMessageText(_0x3d305e){return db['MailMessage'][_0x1046('0xc')]({'where':{'$and':[{'MailInteractionId':_0x3d305e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1046('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1046('0xe')],'order':_0x1046('0xf'),'raw':!![]})['then'](function(_0x5a5b0a){if(_0x5a5b0a&&_0x5a5b0a[_0x1046('0xe')]){_0x3d305e[_0x1046('0x10')]=_[_0x1046('0x11')](_0x5a5b0a[_0x1046('0xe')]);}return _0x3d305e;})[_0x1046('0x12')](function(_0x447acb){throw _0x447acb;});}exports[_0x1046('0x13')]=function(_0x3b524f,_0x16fb8c,_0x258e4a,_0xb28c1e){return new Promise(function(_0x584213,_0x243f7b){return getInteractionUsers(_0x3b524f['id'],_0x258e4a)[_0x1046('0x14')](function(_0x23c723){_0x3b524f[_0x1046('0x15')]=_0x23c723;return getInteractionTags(_0x3b524f[_0x1046('0x16')],_0x16fb8c);})[_0x1046('0x14')](function(_0x952016){_0x3b524f[_0x1046('0x17')]=_0x952016;delete _0x3b524f[_0x1046('0x16')];return updateInteractionCounters(_0x3b524f);})[_0x1046('0x14')](function(_0x1a12f6){if(_0xb28c1e){return getLastMessageText(_0x1a12f6);}else{return _0x1a12f6;}})[_0x1046('0x14')](function(_0x2aa090){_0x584213(_0x2aa090);})[_0x1046('0x12')](function(_0x5af23c){_0x243f7b(_0x5af23c);});});}; \ No newline at end of file +var _0x40d6=['forEach','push','waiting','unmanaged','abandoned','total','closed','disposition','answered','talking','UserId','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','map','split'];(function(_0x13d4a3,_0x93a9d1){var _0x1a3e98=function(_0x51e8bd){while(--_0x51e8bd){_0x13d4a3['push'](_0x13d4a3['shift']());}};_0x1a3e98(++_0x93a9d1);}(_0x40d6,0x1bc));var _0x640d=function(_0xbb7df6,_0x2740c0){_0xbb7df6=_0xbb7df6-0x0;var _0x356804=_0x40d6[_0xbb7df6];return _0x356804;};'use strict';var _=require(_0x640d('0x0'));var db=require(_0x640d('0x1'))['db'];function getInteractionUsers(_0x42740a,_0x20f4a9){return new Promise(function(_0x1b4344,_0x11b9b8){try{var _0x5198a2=[];if(_0x20f4a9[_0x42740a]){_0x5198a2=_0x20f4a9[_0x42740a][_0x640d('0x2')](function(_0x28d01d){return{'id':_0x28d01d['id'],'fullname':_0x28d01d['fullname']};});}return _0x1b4344(_0x5198a2);}catch(_0x4a5e48){_0x11b9b8(_0x4a5e48);}});}function getInteractionTags(_0x38b542,_0x557f26){var _0x5c5903=[];if(_0x38b542){_0x38b542[_0x640d('0x3')](',')[_0x640d('0x4')](function(_0x170892){_0x5c5903[_0x640d('0x5')](_0x557f26[_0x170892]);});}return _0x5c5903;}function updateWaitingCounter(_0x2ace0b){if(_0x2ace0b[_0x640d('0x6')]){_0x2ace0b[_0x640d('0x6')]-=0x1;}}function updateInteractionCounters(_0x4066b0){_0x4066b0[_0x640d('0x6')]=0x0;_0x4066b0['talking']=0x0;_0x4066b0['answered']=0x0;_0x4066b0[_0x640d('0x7')]=0x0;_0x4066b0[_0x640d('0x8')]=0x0;_0x4066b0[_0x640d('0x9')]=0x0;if(_0x4066b0[_0x640d('0xa')]){if(_0x4066b0[_0x640d('0xb')]===_0x640d('0x8')){_0x4066b0[_0x640d('0x8')]+=0x1;updateWaitingCounter(_0x4066b0);}if(_0x4066b0['UserId']){_0x4066b0[_0x640d('0xc')]+=0x1;if(_0x4066b0['talking']){_0x4066b0[_0x640d('0xd')]-=0x1;}}else{if(_0x4066b0[_0x640d('0xb')]){_0x4066b0[_0x640d('0x7')]+=0x1;updateWaitingCounter(_0x4066b0);}}}else{if(!_0x4066b0[_0x640d('0xe')]){_0x4066b0['waiting']+=0x1;}if(_0x4066b0[_0x640d('0xe')]){_0x4066b0[_0x640d('0xd')]+=0x1;updateWaitingCounter(_0x4066b0);}}_0x4066b0[_0x640d('0x9')]+=0x1;return _0x4066b0;}function getLastMessageText(_0x45c1e5){return db[_0x640d('0xf')][_0x640d('0x10')]({'where':{'$and':[{'MailInteractionId':_0x45c1e5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x640d('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x640d('0x12')],'order':_0x640d('0x13'),'raw':!![]})[_0x640d('0x14')](function(_0x475b0){if(_0x475b0&&_0x475b0['plainBody']){_0x45c1e5[_0x640d('0x15')]=_[_0x640d('0x16')](_0x475b0[_0x640d('0x12')]);}return _0x45c1e5;})[_0x640d('0x17')](function(_0x985d88){throw _0x985d88;});}exports[_0x640d('0x18')]=function(_0x1d61a1,_0x2fd1a5,_0x1bc9f3,_0xb1f77e){return new Promise(function(_0x46bedf,_0x49fb30){return getInteractionUsers(_0x1d61a1['id'],_0x1bc9f3)[_0x640d('0x14')](function(_0x283db2){_0x1d61a1[_0x640d('0x19')]=_0x283db2;return getInteractionTags(_0x1d61a1[_0x640d('0x1a')],_0x2fd1a5);})[_0x640d('0x14')](function(_0x44dfca){_0x1d61a1[_0x640d('0x1b')]=_0x44dfca;delete _0x1d61a1[_0x640d('0x1a')];return updateInteractionCounters(_0x1d61a1);})[_0x640d('0x14')](function(_0x181184){if(_0xb1f77e){return getLastMessageText(_0x181184);}else{return _0x181184;}})[_0x640d('0x14')](function(_0x2c38aa){_0x46bedf(_0x2c38aa);})[_0x640d('0x17')](function(_0x4209e5){_0x49fb30(_0x4209e5);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index df8f991..aafde43 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e35=['../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','Interaction','findOne','then','catch','error','toLowerCase','stringify','info','MESSAGE:ACCEPT]\x20id=','\x20role=','exports','lodash','../../mysqldb'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0e35,0xc4));var _0x50e3=function(_0x2401b3,_0xbc525b){_0x2401b3=_0x2401b3-0x0;var _0x10870e=_0x0e35[_0x2401b3];return _0x10870e;};'use strict';var _=require(_0x50e3('0x0'));var db=require(_0x50e3('0x1'))['db'];var loggers={'openchannel':require(_0x50e3('0x2'))(_0x50e3('0x3')),'mail':require(_0x50e3('0x2'))(_0x50e3('0x4')),'fax':require('../../config/logger')(_0x50e3('0x5')),'sms':require(_0x50e3('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0x50e3('0x6')),'whatsapp':require('../../config/logger')(_0x50e3('0x7'))};function getAccountFK(_0x11e46b){return _[_0x50e3('0x8')](_0x11e46b)+(_0x11e46b===_0x50e3('0x9')?_0x50e3('0xa'):'Account')+'Id';}function getInteractionFK(_0x4a0bf1){return _['capitalize'](_0x4a0bf1)+_0x50e3('0xb');}function getInteractionId(_0xb34531,_0x17ad35,_0x216389){if(_0xb34531&&_0xb34531[_[_0x50e3('0xc')](_0x216389)+_0x50e3('0xb')]){return _0xb34531[_['upperFirst'](_0x216389)+_0x50e3('0xb')];}else if(_0xb34531&&_0xb34531['id']){return _0xb34531['id'];}else if(_0x17ad35&&_0x17ad35['id']){return _0x17ad35['id'];}else{return _0x50e3('0xd');}}function getInteractionsTables(_0x35c685){return{'accounts':_0x35c685+'_'+(_0x35c685===_0x50e3('0x9')?_0x50e3('0xe'):_0x50e3('0xf')),'interactions':_0x35c685+_0x50e3('0x10'),'interactionsTags':_0x35c685+_0x50e3('0x11'),'messages':_0x35c685+'_messages','userInteractions':'user_has_'+_0x35c685+_0x50e3('0x10')};}function getSelectedTags(_0x2765a2){var _0x448348=[];if(_0x2765a2){_0x448348=Array['isArray'](_0x2765a2)?_0x2765a2:[_0x2765a2];}return _0x448348;}function log(_0x4cc3cd,_0x50ecf3,_0x3527f3,_0x220a9b,_0x9b2090,_0x2a45df){loggers[_0x9b2090['toLowerCase']()][_0x4cc3cd](_0x50e3('0x12'),_0x2a45df[_0x50e3('0x13')](),_0x50ecf3?_0x50ecf3['id']:null,_0x50ecf3?_0x50ecf3['name']:null,_0x50ecf3?_0x50ecf3[_0x50e3('0x14')]:null,getInteractionId(_0x3527f3,_0x220a9b,_0x9b2090),_0x3527f3?JSON['stringify'](_0x3527f3):_0x50e3('0x15'));}function updateUser(_0x5aee3d,_0x1f6338,_0x52d4ce,_0x579e2d,_0x248cd0){db[_['upperFirst'](_0x579e2d)+_0x50e3('0x16')][_0x50e3('0x17')]({'where':{'id':getInteractionId(_0x1f6338,_0x52d4ce,_0x579e2d)}})[_0x50e3('0x18')](function(_0x335bbc){if(_0x335bbc){return _0x335bbc['update']({'UserId':_0x5aee3d?_0x5aee3d['id']:null});}})[_0x50e3('0x18')](function(_0x2d9dad){if(_0x2d9dad){log('info',_0x5aee3d,_0x1f6338,_0x52d4ce,_0x579e2d,_0x248cd0);}})[_0x50e3('0x19')](function(){log(_0x50e3('0x1a'),_0x5aee3d,_0x1f6338,_0x52d4ce,_0x579e2d,_0x248cd0);});}function logAcceptMessage(_0x4743b8,_0x2f1890,_0x1cc3c3,_0x53975d){var _0x2dc7bf=loggers[_0x4743b8[_0x50e3('0x1b')]()];var _0x123bcb=_0x2f1890['id'];var _0x1432ef=_0x2f1890['name'];var _0x219704=_0x2f1890['role'];var _0x33ee50=JSON[_0x50e3('0x1c')](_0x53975d||null);_0x2dc7bf[_0x50e3('0x1d')]('['+_0x4743b8[_0x50e3('0x13')]()+_0x50e3('0x1e')+_0x123bcb+'\x20name='+_0x1432ef+_0x50e3('0x1f')+_0x219704+'\x20interaction='+_0x1cc3c3+'\x20body='+_0x33ee50);}module[_0x50e3('0x20')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0xc403=['openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','../../config/logger','whatsapp-interactions','capitalize','Website','Account','upperFirst','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','Interaction','findOne','then','update','info','catch','toUpperCase','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20interaction=','lodash'];(function(_0x39de31,_0x2497a1){var _0x4d6787=function(_0x57e9dd){while(--_0x57e9dd){_0x39de31['push'](_0x39de31['shift']());}};_0x4d6787(++_0x2497a1);}(_0xc403,0x173));var _0x3c40=function(_0x5c0c1e,_0x1a4695){_0x5c0c1e=_0x5c0c1e-0x0;var _0x5462ca=_0xc403[_0x5c0c1e];return _0x5462ca;};'use strict';var _=require(_0x3c40('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x3c40('0x1')),'mail':require('../../config/logger')(_0x3c40('0x2')),'fax':require('../../config/logger')(_0x3c40('0x3')),'sms':require('../../config/logger')(_0x3c40('0x4')),'chat':require(_0x3c40('0x5'))('chat-interactions'),'whatsapp':require(_0x3c40('0x5'))(_0x3c40('0x6'))};function getAccountFK(_0x4f2dc2){return _[_0x3c40('0x7')](_0x4f2dc2)+(_0x4f2dc2==='chat'?_0x3c40('0x8'):_0x3c40('0x9'))+'Id';}function getInteractionFK(_0x9bd792){return _[_0x3c40('0x7')](_0x9bd792)+'InteractionId';}function getInteractionId(_0x4e212a,_0x367233,_0x1d7759){if(_0x4e212a&&_0x4e212a[_[_0x3c40('0xa')](_0x1d7759)+'InteractionId']){return _0x4e212a[_[_0x3c40('0xa')](_0x1d7759)+'InteractionId'];}else if(_0x4e212a&&_0x4e212a['id']){return _0x4e212a['id'];}else if(_0x367233&&_0x367233['id']){return _0x367233['id'];}else{return'unknown';}}function getInteractionsTables(_0x1c6dff){return{'accounts':_0x1c6dff+'_'+(_0x1c6dff==='chat'?_0x3c40('0xb'):_0x3c40('0xc')),'interactions':_0x1c6dff+_0x3c40('0xd'),'interactionsTags':_0x1c6dff+_0x3c40('0xe'),'messages':_0x1c6dff+_0x3c40('0xf'),'userInteractions':_0x3c40('0x10')+_0x1c6dff+_0x3c40('0xd')};}function getSelectedTags(_0xc97aae){var _0x26209e=[];if(_0xc97aae){_0x26209e=Array['isArray'](_0xc97aae)?_0xc97aae:[_0xc97aae];}return _0x26209e;}function log(_0x46f091,_0x2e1c26,_0x58f57d,_0x9b9736,_0x153aa4,_0x296215){loggers[_0x153aa4[_0x3c40('0x11')]()][_0x46f091](_0x3c40('0x12'),_0x296215['toUpperCase'](),_0x2e1c26?_0x2e1c26['id']:null,_0x2e1c26?_0x2e1c26['name']:null,_0x2e1c26?_0x2e1c26['role']:null,getInteractionId(_0x58f57d,_0x9b9736,_0x153aa4),_0x58f57d?JSON[_0x3c40('0x13')](_0x58f57d):_0x3c40('0x14'));}function updateUser(_0x402a82,_0x1862c0,_0x557c70,_0x35c447,_0x21f9f6){db[_[_0x3c40('0xa')](_0x35c447)+_0x3c40('0x15')][_0x3c40('0x16')]({'where':{'id':getInteractionId(_0x1862c0,_0x557c70,_0x35c447)}})[_0x3c40('0x17')](function(_0x2589aa){if(_0x2589aa){return _0x2589aa[_0x3c40('0x18')]({'UserId':_0x402a82?_0x402a82['id']:null});}})[_0x3c40('0x17')](function(_0x2e2e1a){if(_0x2e2e1a){log(_0x3c40('0x19'),_0x402a82,_0x1862c0,_0x557c70,_0x35c447,_0x21f9f6);}})[_0x3c40('0x1a')](function(){log('error',_0x402a82,_0x1862c0,_0x557c70,_0x35c447,_0x21f9f6);});}function logAcceptMessage(_0x156ba3,_0x1f2f0a,_0x399ac0,_0x14aa6e){var _0xb79715=loggers[_0x156ba3[_0x3c40('0x11')]()];var _0x6b32a8=_0x1f2f0a['id'];var _0x5129f1=_0x1f2f0a['name'];var _0x20165d=_0x1f2f0a['role'];var _0x4982ed=JSON[_0x3c40('0x13')](_0x14aa6e||null);_0xb79715[_0x3c40('0x19')]('['+_0x156ba3[_0x3c40('0x1b')]()+_0x3c40('0x1c')+_0x6b32a8+_0x3c40('0x1d')+_0x5129f1+'\x20role='+_0x20165d+_0x3c40('0x1e')+_0x399ac0+'\x20body='+_0x4982ed);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index dde3741..f31e64b 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 _0x505d=['status','format','catch','User','admin','user','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','base64','final','License','findOne','then'];(function(_0x48fa19,_0x449238){var _0x3bacdf=function(_0x2b7979){while(--_0x2b7979){_0x48fa19['push'](_0x48fa19['shift']());}};_0x3bacdf(++_0x449238);}(_0x505d,0x93));var _0xd505=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x505d[_0x3c4f1f];return _0x19cb69;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xd505('0x0'));var db=require(_0xd505('0x1'))['db'];var config=require(_0xd505('0x2'));function getValueFromLicense(_0x19ea83,_0x217d1b){if(_0x19ea83&&_0x217d1b){if(_0x217d1b['data1']&&_0x217d1b[_0xd505('0x3')]){var _0x8d7475=_0x217d1b[_0xd505('0x4')];var _0x1bd434=_0x217d1b['license'];var _0x3a2863=_0x8d7475['split']('-')[0x4];var _0x2bc4e7=_0x8d7475[_0xd505('0x5')]('-')[0x0];var _0x543c42=crypto[_0xd505('0x6')](_0xd505('0x7'),util['format']('%s:%s:%s',_0x3a2863,_0x8d7475,_0x2bc4e7));var _0x378dd2=_0x543c42['update'](_0x1bd434,_0xd505('0x8'),'utf8');_0x378dd2+=_0x543c42[_0xd505('0x9')]('utf8');var _0x2bb3d8=JSON['parse'](_0x378dd2);return _0x2bb3d8['hasOwnProperty'](_0x19ea83)?_0x2bb3d8[_0x19ea83]:null;}}return null;}function isLimit(_0x5a4179,_0x40d201,_0x52eafa,_0x477f1b){var _0x2a292e=_0x40d201;return compose()['use'](function(_0x47a6ab,_0x712b99,_0x39cd89){return db[_0xd505('0xa')][_0xd505('0xb')]({'where':{'id':0x1},'raw':!![]})[_0xd505('0xc')](function(_0xe9bea6){var _0x366df6=getValueFromLicense(_0x5a4179,_0xe9bea6);return _0x366df6?_0x366df6:_0x2a292e;})[_0xd505('0xc')](function(_0x20088a){_0x2a292e=_0x20088a;return _0x52eafa['count'](_0x477f1b);})[_0xd505('0xc')](function(_0xf71091){if(_0xf71091>=_0x2a292e){return _0x712b99[_0xd505('0xd')](0x193)['json']({'message':util[_0xd505('0xe')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5a4179)});}_0x39cd89();})[_0xd505('0xf')](function(_0x3b03cb){_0x39cd89(_0x3b03cb);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xd505('0x10')],{'where':{'$or':[{'role':_0xd505('0x11')},{'role':_0xd505('0x12')}]}});}exports[_0xd505('0x13')]=isUserLimit; \ No newline at end of file +var _0x0db4=['crypto','util','../../mysqldb','../../config/environment','data1','license','split','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','count','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','isUserLimit'];(function(_0x5c3c06,_0x4bb70a){var _0x1019c2=function(_0x5b36de){while(--_0x5b36de){_0x5c3c06['push'](_0x5c3c06['shift']());}};_0x1019c2(++_0x4bb70a);}(_0x0db4,0x120));var _0x40db=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x0db4[_0x503950];return _0x1657a9;};'use strict';var crypto=require(_0x40db('0x0'));var util=require(_0x40db('0x1'));var compose=require('composable-middleware');var db=require(_0x40db('0x2'))['db'];var config=require(_0x40db('0x3'));function getValueFromLicense(_0xa0cc14,_0x1ead1e){if(_0xa0cc14&&_0x1ead1e){if(_0x1ead1e[_0x40db('0x4')]&&_0x1ead1e[_0x40db('0x5')]){var _0x520448=_0x1ead1e['data1'];var _0x320f6c=_0x1ead1e[_0x40db('0x5')];var _0x803a17=_0x520448['split']('-')[0x4];var _0x5926b5=_0x520448[_0x40db('0x6')]('-')[0x0];var _0x2335d3=crypto['createDecipher']('aes-256-ctr',util[_0x40db('0x7')](_0x40db('0x8'),_0x803a17,_0x520448,_0x5926b5));var _0x33cea4=_0x2335d3['update'](_0x320f6c,_0x40db('0x9'),_0x40db('0xa'));_0x33cea4+=_0x2335d3[_0x40db('0xb')](_0x40db('0xa'));var _0x2e1c36=JSON[_0x40db('0xc')](_0x33cea4);return _0x2e1c36[_0x40db('0xd')](_0xa0cc14)?_0x2e1c36[_0xa0cc14]:null;}}return null;}function isLimit(_0x626452,_0x287961,_0x4c7086,_0x354f05){var _0x1dc912=_0x287961;return compose()[_0x40db('0xe')](function(_0x13c35b,_0x43ddbb,_0x54bba0){return db[_0x40db('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3f3c07){var _0x26e7b9=getValueFromLicense(_0x626452,_0x3f3c07);return _0x26e7b9?_0x26e7b9:_0x1dc912;})['then'](function(_0x40cbf9){_0x1dc912=_0x40cbf9;return _0x4c7086[_0x40db('0x10')](_0x354f05);})[_0x40db('0x11')](function(_0x52ae49){if(_0x52ae49>=_0x1dc912){return _0x43ddbb[_0x40db('0x12')](0x193)[_0x40db('0x13')]({'message':util[_0x40db('0x7')](_0x40db('0x14'),_0x626452)});}_0x54bba0();})['catch'](function(_0xb5627d){_0x54bba0(_0xb5627d);});});}function isUserLimit(){return isLimit(_0x40db('0x15'),0x1,db[_0x40db('0x16')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x40db('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 168af69..d87a9cc 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 _0x4dbd=['slice','forEach','split','match','filter','map','push','buildExpression','DATE','$eq','$between','value','includes','$gt','operator','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','start','shift','pop','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','and','length'];(function(_0x27e952,_0x3578f2){var _0x3c1811=function(_0x53e445){while(--_0x53e445){_0x27e952['push'](_0x27e952['shift']());}};_0x3c1811(++_0x3578f2);}(_0x4dbd,0x165));var _0xd4db=function(_0x4ac301,_0x117c0b){_0x4ac301=_0x4ac301-0x0;var _0x5321b3=_0x4dbd[_0x4ac301];return _0x5321b3;};'use strict';var _=require(_0xd4db('0x0'));var moment=require(_0xd4db('0x1'));exports[_0xd4db('0x2')]=function(_0x89f280){var _0x4dba41={'conditions':[]};_0x4dba41[_0xd4db('0x3')]=_[_0xd4db('0x4')](_0x89f280,'[$or]')?'or':_0xd4db('0x5');var _0x1e8b63=_0x89f280['replace']('[$and]','')['replace']('[$or]','')['split']('||');for(var _0x4ede2f=0x0;_0x4ede2f<_0x1e8b63[_0xd4db('0x6')];_0x4ede2f++){var _0x5705b0=_0x1e8b63[_0x4ede2f]['split'](':=');var _0x4ee4fb=_0x5705b0[0x0];var _0x4ea174=_0x5705b0[_0xd4db('0x7')](0x1);_0x4ea174[_0xd4db('0x8')](function(_0x4c47b5){var _0x3a0333=_0x4c47b5[_0xd4db('0x9')]('[')['shift']();var _0x3800be=_0x4c47b5[_0xd4db('0xa')](/\[(.*?)\]/g);_0x3800be['forEach'](function(_0x41e972){var _0x5f5860=_0x41e972[_0xd4db('0x9')]('[')[_0xd4db('0xb')](function(_0x34657e){return _0x34657e['indexOf'](']')>-0x1;})[_0xd4db('0xc')](function(_0x504011){return _0x504011[_0xd4db('0x9')](']')[0x0];})[0x0];_0x4dba41['conditions'][_0xd4db('0xd')]({'field':_0x4ee4fb,'operator':_0x3a0333,'value':_0x5f5860});});});}return _0x4dba41;};exports[_0xd4db('0xe')]=function(_0x51695f,_0x2090d1,_0x215113){var _0x1efb1d={};if(_0x2090d1===_0xd4db('0xf')){if(_0x215113['operator']===_0xd4db('0x10')){_0x215113['operator']=_0xd4db('0x11');_0x215113['value']+=','+_0x215113[_0xd4db('0x12')];}else if(_[_0xd4db('0x13')]([_0xd4db('0x14'),'$lte'],_0x215113[_0xd4db('0x15')])){_0x215113[_0xd4db('0x12')]=moment(_0x215113[_0xd4db('0x12')])[_0xd4db('0x16')](0x1,'days')[_0xd4db('0x17')](_0xd4db('0x18'));}}if(_0x215113[_0xd4db('0x19')]){_0x2090d1=_0x215113['castTo'];_0x1efb1d[_0xd4db('0x1a')]=_0xd4db('0x1b')+_0x51695f+'.'+_0x215113[_0xd4db('0x1c')]+_0xd4db('0x1d')+_0x215113[_0xd4db('0x19')]+')\x20'+parseOperator(_0x215113[_0xd4db('0x15')]);}else{_0x1efb1d[_0xd4db('0x1a')]=_0x51695f+'.'+_0x215113['field']+'\x20'+parseOperator(_0x215113[_0xd4db('0x15')]);}if(_['includes']([_0xd4db('0x1e'),_0xd4db('0x1f')],_0x215113[_0xd4db('0x15')]))_0x1efb1d[_0xd4db('0x1a')]='('+_0x1efb1d[_0xd4db('0x1a')]+_0xd4db('0x20')+_0x51695f+'.'+_0x215113['field']+_0xd4db('0x21');_0x1efb1d[_0xd4db('0x12')]=parseValue(_0x2090d1,_0x215113[_0xd4db('0x15')],_0x215113[_0xd4db('0x12')]);return _0x1efb1d;};function parseOperator(_0x3a3866){var _0xe20add;switch(_0x3a3866){case _0xd4db('0x22'):_0xe20add=_0xd4db('0x23');break;case _0xd4db('0x1f'):_0xe20add=_0xd4db('0x24');break;case'$eq':_0xe20add='=\x20?';break;case _0xd4db('0x1e'):_0xe20add=_0xd4db('0x25');break;case _0xd4db('0x26'):case _0xd4db('0x27'):case _0xd4db('0x28'):_0xe20add=_0xd4db('0x29');break;case _0xd4db('0x2a'):_0xe20add=_0xd4db('0x2b');break;case'$gt':_0xe20add=_0xd4db('0x2c');break;case'$lte':_0xe20add='<=\x20?';break;case _0xd4db('0x2d'):_0xe20add='>=\x20?';break;case'$between':_0xe20add='BETWEEN\x20?\x20AND\x20?';break;}return _0xe20add;}function parseValue(_0x52185e,_0x4afad0,_0x2e9794){var _0x5369f2={'start':undefined,'end':undefined};switch(_0x4afad0){case _0xd4db('0x22'):case _0xd4db('0x1f'):_0x5369f2[_0xd4db('0x2e')]=_0x2e9794[_0xd4db('0x9')](',');break;case _0xd4db('0x26'):_0x5369f2[_0xd4db('0x2e')]='%'+_0x2e9794+'%';break;case _0xd4db('0x27'):_0x5369f2[_0xd4db('0x2e')]=_0x2e9794+'%';break;case _0xd4db('0x28'):_0x5369f2[_0xd4db('0x2e')]='%'+_0x2e9794;break;case _0xd4db('0x11'):var _0x52c550=_0x2e9794['split'](',');var _0x2e9794=_0x52c550[_0xd4db('0x2f')]();var _0x23f2ea=_0x52c550[_0xd4db('0x30')]();if(_0x52185e===_0xd4db('0xf')){_0x2e9794=moment(_0x2e9794)[_0xd4db('0x31')](0x0,!![])[_0xd4db('0x17')]();_0x23f2ea=moment(_0x23f2ea)[_0xd4db('0x31')](0x0,!![])[_0xd4db('0x16')](0x17,_0xd4db('0x32'))['add'](0x3b,_0xd4db('0x33'))[_0xd4db('0x16')](0x3b,'seconds')[_0xd4db('0x17')]();}_0x5369f2={'start':_0x2e9794,'end':_0x23f2ea};break;default:_0x5369f2['start']=_0x2e9794;break;}return _0x5369f2;} \ No newline at end of file +var _0x8594=['includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','\x20AS\x20','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','utcOffset','hours','minutes','add','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','split','length','slice','forEach','match','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value'];(function(_0xf23808,_0x2aa8db){var _0x3db44f=function(_0x1235e3){while(--_0x1235e3){_0xf23808['push'](_0xf23808['shift']());}};_0x3db44f(++_0x2aa8db);}(_0x8594,0x151));var _0x4859=function(_0x515e4e,_0x44a91f){_0x515e4e=_0x515e4e-0x0;var _0x27eb5f=_0x8594[_0x515e4e];return _0x27eb5f;};'use strict';var _=require('lodash');var moment=require(_0x4859('0x0'));exports[_0x4859('0x1')]=function(_0xf7e65d){var _0xb6e990={'conditions':[]};_0xb6e990[_0x4859('0x2')]=_[_0x4859('0x3')](_0xf7e65d,_0x4859('0x4'))?'or':'and';var _0x6c5c4d=_0xf7e65d[_0x4859('0x5')]('[$and]','')[_0x4859('0x5')](_0x4859('0x4'),'')[_0x4859('0x6')]('||');for(var _0x435e47=0x0;_0x435e47<_0x6c5c4d[_0x4859('0x7')];_0x435e47++){var _0x496cf2=_0x6c5c4d[_0x435e47][_0x4859('0x6')](':=');var _0x4f7588=_0x496cf2[0x0];var _0x25f993=_0x496cf2[_0x4859('0x8')](0x1);_0x25f993[_0x4859('0x9')](function(_0x3472bb){var _0x49990d=_0x3472bb[_0x4859('0x6')]('[')['shift']();var _0x4035c8=_0x3472bb[_0x4859('0xa')](/\[(.*?)\]/g);_0x4035c8[_0x4859('0x9')](function(_0x4f8f82){var _0x5c4287=_0x4f8f82[_0x4859('0x6')]('[')['filter'](function(_0x25b39a){return _0x25b39a['indexOf'](']')>-0x1;})[_0x4859('0xb')](function(_0x20d66a){return _0x20d66a[_0x4859('0x6')](']')[0x0];})[0x0];_0xb6e990[_0x4859('0xc')][_0x4859('0xd')]({'field':_0x4f7588,'operator':_0x49990d,'value':_0x5c4287});});});}return _0xb6e990;};exports[_0x4859('0xe')]=function(_0xbee93f,_0x49cb34,_0x3e2ae6){var _0x1b9fd8={};if(_0x49cb34===_0x4859('0xf')){if(_0x3e2ae6[_0x4859('0x10')]===_0x4859('0x11')){_0x3e2ae6[_0x4859('0x10')]=_0x4859('0x12');_0x3e2ae6[_0x4859('0x13')]+=','+_0x3e2ae6['value'];}else if(_[_0x4859('0x14')]([_0x4859('0x15'),_0x4859('0x16')],_0x3e2ae6[_0x4859('0x10')])){_0x3e2ae6[_0x4859('0x13')]=moment(_0x3e2ae6[_0x4859('0x13')])['add'](0x1,_0x4859('0x17'))[_0x4859('0x18')](_0x4859('0x19'));}}if(_0x3e2ae6[_0x4859('0x1a')]){_0x49cb34=_0x3e2ae6[_0x4859('0x1a')];_0x1b9fd8[_0x4859('0x1b')]='CAST('+_0xbee93f+'.'+_0x3e2ae6['field']+_0x4859('0x1c')+_0x3e2ae6[_0x4859('0x1a')]+')\x20'+parseOperator(_0x3e2ae6[_0x4859('0x10')]);}else{_0x1b9fd8[_0x4859('0x1b')]=_0xbee93f+'.'+_0x3e2ae6['field']+'\x20'+parseOperator(_0x3e2ae6[_0x4859('0x10')]);}if(_[_0x4859('0x14')]([_0x4859('0x1d'),_0x4859('0x1e')],_0x3e2ae6['operator']))_0x1b9fd8[_0x4859('0x1b')]='('+_0x1b9fd8[_0x4859('0x1b')]+_0x4859('0x1f')+_0xbee93f+'.'+_0x3e2ae6[_0x4859('0x20')]+_0x4859('0x21');_0x1b9fd8['value']=parseValue(_0x49cb34,_0x3e2ae6[_0x4859('0x10')],_0x3e2ae6[_0x4859('0x13')]);return _0x1b9fd8;};function parseOperator(_0x12c54f){var _0x3b1d4c;switch(_0x12c54f){case'$in':_0x3b1d4c='IN\x20?';break;case _0x4859('0x1e'):_0x3b1d4c=_0x4859('0x22');break;case _0x4859('0x11'):_0x3b1d4c='=\x20?';break;case _0x4859('0x1d'):_0x3b1d4c=_0x4859('0x23');break;case _0x4859('0x24'):case _0x4859('0x25'):case _0x4859('0x26'):_0x3b1d4c=_0x4859('0x27');break;case'$lt':_0x3b1d4c=_0x4859('0x28');break;case _0x4859('0x15'):_0x3b1d4c=_0x4859('0x29');break;case'$lte':_0x3b1d4c='<=\x20?';break;case _0x4859('0x2a'):_0x3b1d4c=_0x4859('0x2b');break;case'$between':_0x3b1d4c=_0x4859('0x2c');break;}return _0x3b1d4c;}function parseValue(_0x2303d3,_0x1e4d95,_0x5c49d9){var _0x56403a={'start':undefined,'end':undefined};switch(_0x1e4d95){case _0x4859('0x2d'):case _0x4859('0x1e'):_0x56403a[_0x4859('0x2e')]=_0x5c49d9[_0x4859('0x6')](',');break;case _0x4859('0x24'):_0x56403a[_0x4859('0x2e')]='%'+_0x5c49d9+'%';break;case'$startsWith':_0x56403a[_0x4859('0x2e')]=_0x5c49d9+'%';break;case _0x4859('0x26'):_0x56403a[_0x4859('0x2e')]='%'+_0x5c49d9;break;case'$between':var _0x350c15=_0x5c49d9[_0x4859('0x6')](',');var _0x5c49d9=_0x350c15['shift']();var _0x1f5925=_0x350c15['pop']();if(_0x2303d3===_0x4859('0xf')){_0x5c49d9=moment(_0x5c49d9)[_0x4859('0x2f')](0x0,!![])[_0x4859('0x18')]();_0x1f5925=moment(_0x1f5925)[_0x4859('0x2f')](0x0,!![])['add'](0x17,_0x4859('0x30'))['add'](0x3b,_0x4859('0x31'))[_0x4859('0x32')](0x3b,'seconds')[_0x4859('0x18')]();}_0x56403a={'start':_0x5c49d9,'end':_0x1f5925};break;default:_0x56403a[_0x4859('0x2e')]=_0x5c49d9;break;}return _0x56403a;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 818cdad..8469f29 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 _0x5253=['includes','parse','model','alias','fields','raw','filters','isEmpty','forOwn','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isString','unset','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','push','join','getOptions','query','$id','attributes','intersection','hasOwnProperty','nolimit','where','pick','filter','columns','value','merge','type','lower','include','escapeLIKESpecialChars','sequelize','moment','../../mysqldb','keys'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0x5253,0x7a));var _0x3525=function(_0x486cdd,_0x42fe40){_0x486cdd=_0x486cdd-0x0;var _0x933640=_0x5253[_0x486cdd];return _0x933640;};'use strict';var _=require('lodash');var sequelize=require(_0x3525('0x0'));var moment=require(_0x3525('0x1'));var db=require(_0x3525('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2fb95b){var _0x461b23=['ne'];try{var _0x246f1c=JSON['parse'](_0x2fb95b);var _0x3f1555=Object[_0x3525('0x3')](_0x246f1c)[0x0];return _0x461b23[_0x3525('0x4')](_0x3f1555);}catch(_0x4c292e){return![];}}function getOperatorValue(_0x566b91){var _0x5c358a=JSON[_0x3525('0x5')](_0x566b91);var _0x3d6e11=Object['keys'](_0x5c358a)[0x0];var _0x3e480a=_0x5c358a[_0x3d6e11];return{['$'+_0x3d6e11]:_0x3e480a};}function parseIncludeModel(_0x577fc6){var _0x180d6b=JSON['parse'](_0x577fc6);return{'model':db[_0x180d6b[_0x3525('0x6')]],'as':_0x180d6b[_0x3525('0x7')],'attributes':_0x180d6b[_0x3525('0x8')],'raw':_0x180d6b[_0x3525('0x9')]};}exports['fields']=function(_0x2cf5c6){var _0x3f2ba4=null;if(_0x2cf5c6){_0x3f2ba4=_0x2cf5c6['split'](',');}return _0x3f2ba4;};exports[_0x3525('0xa')]=function(_0x387c88,_0xf09d17){var _0x26e28a={};if(!_[_0x3525('0xb')](_0x387c88)){_[_0x3525('0xc')](_0x387c88,function(_0x48676f,_0x2f7137){try{if(_0xf09d17){var _0x257a2a=_['find'](_0xf09d17,{'name':_0x2f7137})||{};if(hasSequelizeOperator(_0x48676f)){_0x26e28a[_0x2f7137]=getOperatorValue(_0x48676f);}else if(_0x257a2a['type']==='DATE'&&_[_0x3525('0xd')](_0x48676f)){var _0xe62b73=JSON['parse'](_0x48676f);var _0x3267a9={'$gte':moment(moment(_0xe62b73['$gte'])[_0x3525('0xe')](_0x3525('0xf')))[_0x3525('0x10')]()[_0x3525('0xe')](),'$lte':moment(moment(_0xe62b73[_0x3525('0x11')])['format'](_0x3525('0xf')))[_0x3525('0x10')]()[_0x3525('0x12')](0x1,'s')['format']()};_0x26e28a[_0x2f7137]=_0x3267a9;}else if(_0x257a2a[_0x3525('0x13')]==='uniqueid'){_0x26e28a[_0x2f7137]=_0x48676f;}else{_0x26e28a[_0x2f7137]=_['isArray'](_0x48676f)?_0x48676f:JSON[_0x3525('0x5')](_0x48676f);}}else{_0x26e28a[_0x2f7137]=_[_0x3525('0x14')](_0x48676f)?_0x48676f:JSON[_0x3525('0x5')](_0x48676f);}}catch(_0x800747){_0x26e28a[_0x2f7137]=_0x48676f[_0x3525('0x15')](',');}});}return _0x26e28a;};exports[_0x3525('0x16')]=function(_0x520454){_0x520454=parseInt(_0x520454,0xa);if(!_0x520454||_0x520454<0x0){_0x520454=LIMIT_VALUE;}return _0x520454;};exports[_0x3525('0x17')]=function(_0x26db75){_0x26db75=parseInt(_0x26db75,0xa);if(!_0x26db75||_0x26db75<0x0){_0x26db75=0x0;}return _0x26db75;};exports[_0x3525('0x18')]=function(_0x41eb70){var _0x1bfd21,_0x42e010=null;if(_0x41eb70){_0x1bfd21=_0x41eb70[_0x3525('0x15')](',');_0x42e010=_[_0x3525('0x19')](_0x1bfd21,function(_0x346167){if(_0x346167[_0x3525('0x1a')]('-')===0x0){return[_0x346167===_0x3525('0x1b')?sequelize[_0x3525('0x1c')](sequelize[_0x3525('0x1d')]('priority'),_0x3525('0x1e')):_0x346167[_0x3525('0x1f')](0x1),_0x3525('0x20')];}else{return[_0x346167===_0x3525('0x1b')?sequelize[_0x3525('0x1c')](sequelize[_0x3525('0x1d')](_0x3525('0x1b')),_0x3525('0x1e')):_0x346167,_0x3525('0x21')];}});}return _0x42e010;};exports[_0x3525('0x22')]=function(_0x47fb20,_0x468e03){if(_[_0x3525('0xb')](_0x47fb20)){return _0x47fb20;}if(_[_0x3525('0x14')](_0x47fb20)){for(var _0x1c756a=0x0;_0x1c756a<_0x47fb20['length'];_0x1c756a+=0x1){_0x47fb20[_0x1c756a]=this[_0x3525('0x22')](_0x47fb20[_0x1c756a],_0x468e03);}return _0x47fb20;}if(!_['isObject'](_0x47fb20)){return _0x47fb20;}if(_[_0x3525('0x23')](_0x468e03)){_0x468e03=[_0x468e03];}if(!_[_0x3525('0x14')](_0x468e03)){return _0x47fb20;}for(var _0x41d5fe=0x0;_0x41d5fe<_0x468e03['length'];_0x41d5fe+=0x1){_[_0x3525('0x24')](_0x47fb20,_0x468e03[_0x41d5fe]);}for(var _0x33a6a2 in _0x47fb20){if(_0x47fb20['hasOwnProperty'](_0x33a6a2)){_0x47fb20[_0x33a6a2]=this['omit'](_0x47fb20[_0x33a6a2],_0x468e03);}}return _0x47fb20;};exports['isNumeric']=function(_0x4f2dff){return _0x4f2dff[_0x3525('0x25')](RegExp(_0x3525('0x26')))?!![]:![];};exports[_0x3525('0x27')]=function(_0x399073){return _0x399073['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x3525('0x28')]=function(_0x58d31f,_0x45cdfb){var _0x37c756=[];var _0x9d29fd=/([^:]")"+/g;var _0x1a8d81=/[*<>~@-]/g;var _0x5dfcce=/[ `!@#$%^&*()_\-?~<>]/;var _0x1e2462=/[ ,]+/;var _0x45533c=_0x45cdfb?_0x3525('0x29'):_0x3525('0x2a');if(_0x45cdfb){_0x58d31f=_0x58d31f[_0x3525('0x2b')](_0x1a8d81,'\x20')['trim']();}_0x58d31f[_0x3525('0x15')](_0x1e2462)['forEach'](function(_0x47b38b){_0x47b38b=_0x47b38b[_0x3525('0x2b')](_0x9d29fd,'$1');_0x47b38b='+'+_0x47b38b+'*';var _0x4f2d21=_0x47b38b[_0x3525('0x25')](_0x5dfcce);if(_0x4f2d21){_0x47b38b='\x22'+_0x47b38b+'\x22';}_0x37c756[_0x3525('0x2c')](_0x47b38b);});_0x45533c=_0x45533c[_0x3525('0x2b')]('{EXPR}',_0x37c756[_0x3525('0x2d')]('\x20'));return _0x45533c;};exports[_0x3525('0x2e')]=function(_0x19b10f,_0x14a1e1,_0x2c7346){var _0x625a5e={},_0x1bb7ec={};if(_0x14a1e1[_0x3525('0x2f')][_0x3525('0x30')]){_0x14a1e1[_0x3525('0x2f')]['id']=_0x14a1e1[_0x3525('0x2f')][_0x3525('0x30')];delete _0x14a1e1[_0x3525('0x2f')][_0x3525('0x30')];}_0x625a5e[_0x3525('0x6')]=_[_0x3525('0x19')](_0x19b10f,_0x3525('0x13'));_0x625a5e[_0x3525('0x2f')]=_[_0x3525('0x3')](_0x14a1e1[_0x3525('0x2f')]);_0x625a5e['filters']=_['intersection'](_0x625a5e[_0x3525('0x6')],_0x625a5e[_0x3525('0x2f')]);_0x1bb7ec[_0x3525('0x31')]=_[_0x3525('0x32')](_0x625a5e['model'],this[_0x3525('0x8')](_0x14a1e1[_0x3525('0x2f')][_0x3525('0x8')]));_0x1bb7ec[_0x3525('0x31')]=_0x1bb7ec[_0x3525('0x31')]['length']?_0x1bb7ec[_0x3525('0x31')]:_0x625a5e[_0x3525('0x6')];if(!_0x14a1e1[_0x3525('0x2f')][_0x3525('0x33')](_0x3525('0x34'))){_0x1bb7ec[_0x3525('0x16')]=this[_0x3525('0x16')](_0x14a1e1['query'][_0x3525('0x16')]);_0x1bb7ec[_0x3525('0x17')]=this[_0x3525('0x17')](_0x14a1e1[_0x3525('0x2f')]['offset']);}_0x1bb7ec['order']=this[_0x3525('0x18')](_0x14a1e1[_0x3525('0x2f')]['sort']);_0x1bb7ec[_0x3525('0x35')]=this['filters'](_[_0x3525('0x36')](_0x14a1e1[_0x3525('0x2f')],_0x625a5e[_0x3525('0xa')]),_0x19b10f);if(_0x14a1e1[_0x3525('0x2f')][_0x3525('0x37')]){var _0x7896d3=_0x19b10f;var _0x15e373=_0x14a1e1[_0x3525('0x2f')][_0x3525('0x37')];if(typeof _0x15e373==='object'){_0x7896d3=_[_0x3525('0x37')](_0x19b10f,function(_0x323b4c){return _[_0x3525('0x4')](_0x15e373[_0x3525('0x38')],_0x323b4c[_0x3525('0x13')]);});_0x15e373=_0x15e373[_0x3525('0x39')];}_0x1bb7ec[_0x3525('0x35')]=_[_0x3525('0x3a')](_0x1bb7ec[_0x3525('0x35')],{'$or':_[_0x3525('0x19')](_0x7896d3,function(_0x193089){if(_0x193089[_0x3525('0x3b')]!=='VIRTUAL'){if(_0x2c7346){return sequelize[_0x3525('0x35')](sequelize['fn'](_0x3525('0x3c'),sequelize[_0x3525('0x1d')](_0x193089[_0x3525('0x13')])),{'$like':sequelize['fn'](_0x3525('0x3c'),'%'+_0x14a1e1[_0x3525('0x2f')]['filter']+'%')});}else{var _0x386a84={};_0x386a84[_0x193089[_0x3525('0x13')]]={'$like':'%'+_0x14a1e1[_0x3525('0x2f')][_0x3525('0x37')]+'%'};return _0x386a84;}}})});}_0x1bb7ec=_[_0x3525('0x3a')]({},_0x1bb7ec,_0x14a1e1['options']);return _0x1bb7ec;};exports[_0x3525('0x3d')]=function(_0x18f33d){var _0x61fbf9=[];if(_0x18f33d['includeAll']){_0x61fbf9[_0x3525('0x2c')]({'all':!![]});}else if(_0x18f33d[_0x3525('0x3d')]){if(Array[_0x3525('0x14')](_0x18f33d[_0x3525('0x3d')])){_0x61fbf9=Object[_0x3525('0x3')](_0x18f33d[_0x3525('0x3d')])[_0x3525('0x19')](function(_0x2f20c0){return parseIncludeModel(_0x18f33d[_0x3525('0x3d')][_0x2f20c0]);});}else{var _0x71ab74=parseIncludeModel(_0x18f33d[_0x3525('0x3d')]);_0x61fbf9[_0x3525('0x2c')](_0x71ab74);}}return _0x61fbf9;};exports[_0x3525('0x3e')]=function(_0x375b52){return _0x375b52['replace'](/[%_^-]/g,function(_0xc8afff){return'\x5c'+_0xc8afff;});}; \ No newline at end of file +var _0x327c=['keys','includes','model','fields','raw','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','utc','isArray','offset','sort','map','indexOf','cast','col','priority','unsigned','DESC','length','omit','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','trim','forEach','replace','join','getOptions','query','$id','name','attributes','nolimit','limit','order','pick','filter','object','columns','value','where','merge','type','VIRTUAL','lower','options','include','escapeLIKESpecialChars','../../mysqldb','parse'];(function(_0x1ca3b1,_0x4046e5){var _0x1b8512=function(_0x344005){while(--_0x344005){_0x1ca3b1['push'](_0x1ca3b1['shift']());}};_0x1b8512(++_0x4046e5);}(_0x327c,0xfa));var _0xc327=function(_0x5d168a,_0x448a01){_0x5d168a=_0x5d168a-0x0;var _0x5814a7=_0x327c[_0x5d168a];return _0x5814a7;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var db=require(_0xc327('0x0'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b5476){var _0x1646cf=['ne'];try{var _0x7f0c6c=JSON[_0xc327('0x1')](_0x1b5476);var _0x5d7e98=Object[_0xc327('0x2')](_0x7f0c6c)[0x0];return _0x1646cf[_0xc327('0x3')](_0x5d7e98);}catch(_0x6a1ff1){return![];}}function getOperatorValue(_0x591876){var _0x262fc0=JSON[_0xc327('0x1')](_0x591876);var _0x327613=Object['keys'](_0x262fc0)[0x0];var _0x9917ce=_0x262fc0[_0x327613];return{['$'+_0x327613]:_0x9917ce};}function parseIncludeModel(_0x3f2214){var _0x2d52f2=JSON['parse'](_0x3f2214);return{'model':db[_0x2d52f2[_0xc327('0x4')]],'as':_0x2d52f2['alias'],'attributes':_0x2d52f2[_0xc327('0x5')],'raw':_0x2d52f2[_0xc327('0x6')]};}exports[_0xc327('0x5')]=function(_0x11f49b){var _0x11f8fb=null;if(_0x11f49b){_0x11f8fb=_0x11f49b[_0xc327('0x7')](',');}return _0x11f8fb;};exports[_0xc327('0x8')]=function(_0x331763,_0x31dd8c){var _0x469f51={};if(!_[_0xc327('0x9')](_0x331763)){_[_0xc327('0xa')](_0x331763,function(_0x4c4cac,_0x23deb6){try{if(_0x31dd8c){var _0x12b457=_[_0xc327('0xb')](_0x31dd8c,{'name':_0x23deb6})||{};if(hasSequelizeOperator(_0x4c4cac)){_0x469f51[_0x23deb6]=getOperatorValue(_0x4c4cac);}else if(_0x12b457['type']===_0xc327('0xc')&&_[_0xc327('0xd')](_0x4c4cac)){var _0x5513f2=JSON[_0xc327('0x1')](_0x4c4cac);var _0x197ba6={'$gte':moment(moment(_0x5513f2[_0xc327('0xe')])[_0xc327('0xf')]('YYYY-MM-DD'))[_0xc327('0x10')]()[_0xc327('0xf')](),'$lte':moment(moment(_0x5513f2['$lte'])[_0xc327('0xf')]('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0xc327('0xf')]()};_0x469f51[_0x23deb6]=_0x197ba6;}else if(_0x12b457['name']==='uniqueid'){_0x469f51[_0x23deb6]=_0x4c4cac;}else{_0x469f51[_0x23deb6]=_[_0xc327('0x11')](_0x4c4cac)?_0x4c4cac:JSON[_0xc327('0x1')](_0x4c4cac);}}else{_0x469f51[_0x23deb6]=_['isArray'](_0x4c4cac)?_0x4c4cac:JSON['parse'](_0x4c4cac);}}catch(_0xf13b4a){_0x469f51[_0x23deb6]=_0x4c4cac[_0xc327('0x7')](',');}});}return _0x469f51;};exports['limit']=function(_0xfc342a){_0xfc342a=parseInt(_0xfc342a,0xa);if(!_0xfc342a||_0xfc342a<0x0){_0xfc342a=LIMIT_VALUE;}return _0xfc342a;};exports[_0xc327('0x12')]=function(_0x3c0330){_0x3c0330=parseInt(_0x3c0330,0xa);if(!_0x3c0330||_0x3c0330<0x0){_0x3c0330=0x0;}return _0x3c0330;};exports[_0xc327('0x13')]=function(_0x227469){var _0x318e3a,_0x35ae8a=null;if(_0x227469){_0x318e3a=_0x227469[_0xc327('0x7')](',');_0x35ae8a=_[_0xc327('0x14')](_0x318e3a,function(_0x382fe2){if(_0x382fe2[_0xc327('0x15')]('-')===0x0){return[_0x382fe2==='priority'?sequelize[_0xc327('0x16')](sequelize[_0xc327('0x17')](_0xc327('0x18')),_0xc327('0x19')):_0x382fe2['substr'](0x1),_0xc327('0x1a')];}else{return[_0x382fe2===_0xc327('0x18')?sequelize['cast'](sequelize['col'](_0xc327('0x18')),_0xc327('0x19')):_0x382fe2,'ASC'];}});}return _0x35ae8a;};exports['omit']=function(_0x1bcf7d,_0x3e70a9){if(_[_0xc327('0x9')](_0x1bcf7d)){return _0x1bcf7d;}if(_[_0xc327('0x11')](_0x1bcf7d)){for(var _0x21190b=0x0;_0x21190b<_0x1bcf7d[_0xc327('0x1b')];_0x21190b+=0x1){_0x1bcf7d[_0x21190b]=this[_0xc327('0x1c')](_0x1bcf7d[_0x21190b],_0x3e70a9);}return _0x1bcf7d;}if(!_['isObject'](_0x1bcf7d)){return _0x1bcf7d;}if(_[_0xc327('0x1d')](_0x3e70a9)){_0x3e70a9=[_0x3e70a9];}if(!_[_0xc327('0x11')](_0x3e70a9)){return _0x1bcf7d;}for(var _0x35e869=0x0;_0x35e869<_0x3e70a9['length'];_0x35e869+=0x1){_[_0xc327('0x1e')](_0x1bcf7d,_0x3e70a9[_0x35e869]);}for(var _0x589f14 in _0x1bcf7d){if(_0x1bcf7d[_0xc327('0x1f')](_0x589f14)){_0x1bcf7d[_0x589f14]=this[_0xc327('0x1c')](_0x1bcf7d[_0x589f14],_0x3e70a9);}}return _0x1bcf7d;};exports['isNumeric']=function(_0x512766){return _0x512766[_0xc327('0x20')](RegExp(_0xc327('0x21')))?!![]:![];};exports[_0xc327('0x22')]=function(_0x5201e9){return _0x5201e9[_0xc327('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xc327('0x23')]=function(_0x580ed9,_0x3ef2e5){var _0x1b7ac1=[];var _0x4ac8d4=/([^:]")"+/g;var _0x551067=/[*<>~@-]/g;var _0x2d7bf5=/[ `!@#$%^&*()_\-?~<>]/;var _0xb4f76f=/[ ,]+/;var _0x1523bf=_0x3ef2e5?_0xc327('0x24'):_0xc327('0x25');if(_0x3ef2e5){_0x580ed9=_0x580ed9['replace'](_0x551067,'\x20')[_0xc327('0x26')]();}_0x580ed9['split'](_0xb4f76f)[_0xc327('0x27')](function(_0x209820){_0x209820=_0x209820[_0xc327('0x28')](_0x4ac8d4,'$1');_0x209820='+'+_0x209820+'*';var _0x468ffb=_0x209820['match'](_0x2d7bf5);if(_0x468ffb){_0x209820='\x22'+_0x209820+'\x22';}_0x1b7ac1['push'](_0x209820);});_0x1523bf=_0x1523bf['replace'](_0xc327('0x25'),_0x1b7ac1[_0xc327('0x29')]('\x20'));return _0x1523bf;};exports[_0xc327('0x2a')]=function(_0x3fe179,_0x4cc271,_0x3f6184){var _0x21fc50={},_0x910338={};if(_0x4cc271[_0xc327('0x2b')][_0xc327('0x2c')]){_0x4cc271[_0xc327('0x2b')]['id']=_0x4cc271['query']['$id'];delete _0x4cc271['query'][_0xc327('0x2c')];}_0x21fc50[_0xc327('0x4')]=_['map'](_0x3fe179,_0xc327('0x2d'));_0x21fc50[_0xc327('0x2b')]=_[_0xc327('0x2')](_0x4cc271[_0xc327('0x2b')]);_0x21fc50[_0xc327('0x8')]=_['intersection'](_0x21fc50[_0xc327('0x4')],_0x21fc50[_0xc327('0x2b')]);_0x910338[_0xc327('0x2e')]=_['intersection'](_0x21fc50[_0xc327('0x4')],this[_0xc327('0x5')](_0x4cc271['query']['fields']));_0x910338[_0xc327('0x2e')]=_0x910338[_0xc327('0x2e')]['length']?_0x910338[_0xc327('0x2e')]:_0x21fc50[_0xc327('0x4')];if(!_0x4cc271[_0xc327('0x2b')][_0xc327('0x1f')](_0xc327('0x2f'))){_0x910338['limit']=this['limit'](_0x4cc271[_0xc327('0x2b')][_0xc327('0x30')]);_0x910338['offset']=this['offset'](_0x4cc271[_0xc327('0x2b')]['offset']);}_0x910338[_0xc327('0x31')]=this[_0xc327('0x13')](_0x4cc271[_0xc327('0x2b')][_0xc327('0x13')]);_0x910338['where']=this['filters'](_[_0xc327('0x32')](_0x4cc271[_0xc327('0x2b')],_0x21fc50[_0xc327('0x8')]),_0x3fe179);if(_0x4cc271[_0xc327('0x2b')][_0xc327('0x33')]){var _0x18dddf=_0x3fe179;var _0x1eb9b6=_0x4cc271[_0xc327('0x2b')]['filter'];if(typeof _0x1eb9b6===_0xc327('0x34')){_0x18dddf=_['filter'](_0x3fe179,function(_0x2643bb){return _['includes'](_0x1eb9b6[_0xc327('0x35')],_0x2643bb[_0xc327('0x2d')]);});_0x1eb9b6=_0x1eb9b6[_0xc327('0x36')];}_0x910338[_0xc327('0x37')]=_[_0xc327('0x38')](_0x910338[_0xc327('0x37')],{'$or':_[_0xc327('0x14')](_0x18dddf,function(_0x1fbf40){if(_0x1fbf40[_0xc327('0x39')]!==_0xc327('0x3a')){if(_0x3f6184){return sequelize[_0xc327('0x37')](sequelize['fn'](_0xc327('0x3b'),sequelize[_0xc327('0x17')](_0x1fbf40[_0xc327('0x2d')])),{'$like':sequelize['fn'](_0xc327('0x3b'),'%'+_0x4cc271['query'][_0xc327('0x33')]+'%')});}else{var _0x481c2b={};_0x481c2b[_0x1fbf40[_0xc327('0x2d')]]={'$like':'%'+_0x4cc271['query'][_0xc327('0x33')]+'%'};return _0x481c2b;}}})});}_0x910338=_[_0xc327('0x38')]({},_0x910338,_0x4cc271[_0xc327('0x3c')]);return _0x910338;};exports[_0xc327('0x3d')]=function(_0x44ee49){var _0xa3de82=[];if(_0x44ee49['includeAll']){_0xa3de82['push']({'all':!![]});}else if(_0x44ee49[_0xc327('0x3d')]){if(Array[_0xc327('0x11')](_0x44ee49[_0xc327('0x3d')])){_0xa3de82=Object[_0xc327('0x2')](_0x44ee49[_0xc327('0x3d')])[_0xc327('0x14')](function(_0x185cfc){return parseIncludeModel(_0x44ee49['include'][_0x185cfc]);});}else{var _0x1228fb=parseIncludeModel(_0x44ee49['include']);_0xa3de82['push'](_0x1228fb);}}return _0xa3de82;};exports[_0xc327('0x3e')]=function(_0x57aa9f){return _0x57aa9f['replace'](/[%_^-]/g,function(_0x46cb5b){return'\x5c'+_0x46cb5b;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index dd51ee1..caa6ac0 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x753c=['globalStatus','getSortedAgentsIdsByStatus','split','fields','includes','startsWith','DESC','ASC','internal','substring','indexOf','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatus','mailStatus','smsStatus','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','pick','filterAgentAttributes','lastPauseAt','chatStatusTime','faxStatusTime','smsStatusTime','faxCurrentCapacity','screenrecording','getRealtimeAgentsQueryFields','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','faxStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','getAgentIdsByStatus','resolve','User','findAll','name','fullname','find'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x753c,0x96));var _0xc753=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x753c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var jayson=require(_0xc753('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xc753('0x1')][_0xc753('0x2')]({'port':0x232a});var routingClient=jayson[_0xc753('0x1')][_0xc753('0x2')]({'port':0x232c});function isAgentPaused(_0x3f5dc4,_0x44ff14){var _0x3990bd=[_0x3f5dc4[_0xc753('0x3')],_0x3f5dc4[_0xc753('0x4')],_0x3f5dc4[_0xc753('0x5')],_0x3f5dc4[_0xc753('0x6')],_0x3f5dc4[_0xc753('0x7')],_0x3f5dc4[_0xc753('0x8')],_0x3f5dc4[_0xc753('0x9')]];if(!_0x44ff14)return _[_0xc753('0xa')](_0x3990bd);var _0x3866e8=_[_0xc753('0xb')](_0x3990bd);return _0x3866e8[_0xc753('0xc')]>0x0&&_0x3866e8[_0xc753('0xc')]<_0x3990bd[_0xc753('0xc')]?!![]:![];}function isIdle(_0x1fe61c){return _0x1fe61c===_0xc753('0xd')||_0x1fe61c===_0xc753('0xe')||_0x1fe61c===_0xc753('0xf')||_0x1fe61c==='ringing'||_[_0xc753('0x10')](_0x1fe61c);}function isAgentIdle(_0x366591){if(_0x366591['voiceStatus']!==_0xc753('0xd')&&_0x366591['voicePause']){_0x366591[_0xc753('0x11')]=_0xc753('0x12');return![];}return _[_0xc753('0xa')]([_0x366591['chatStatus'],_0x366591[_0xc753('0x13')],_0x366591['mailStatus'],_0x366591[_0xc753('0x14')],_0x366591['smsStatus'],_0x366591[_0xc753('0x11')],_0x366591[_0xc753('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xc753('0x16')](_0xc753('0x17'),{})[_0xc753('0x18')](function(_0x4fae9f){if(_0x4fae9f[_0xc753('0x19')]){throw new Error(_0xc753('0x1a'));}var _0x1f94f9=_0x4fae9f[_0xc753('0x1b')];return routingClient[_0xc753('0x16')](_0xc753('0x17'),{})[_0xc753('0x18')](function(_0x387fbf){if(_0x387fbf['error']){throw new Error(_0xc753('0x1c'));}var _0x3feebb=_0x387fbf[_0xc753('0x1b')];return _[_0xc753('0x1d')]({},_0x1f94f9,_0x3feebb);});})[_0xc753('0x1e')](function(_0xc612dc){throw _0xc612dc;});}exports[_0xc753('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x42a222){var _0xaf6367=_0xc753('0xe');if(isAgentPaused(_0x42a222))_0xaf6367=_0xc753('0x12');else if(isAgentPaused(_0x42a222,!![]))_0xaf6367=_0xc753('0x20');else if(isAgentIdle(_0x42a222))_0xaf6367=_0xc753('0xd');else _0xaf6367=_0xc753('0x21');return _0xaf6367;}exports[_0xc753('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x9899e6,_0x4f167b){var _0x2c04d4=_[_0xc753('0x23')](_0x9899e6)?_0x9899e6:[_0x9899e6];var _0x5158ee=_['startCase'](_0x4f167b)+_0xc753('0x24');var _0x3aeda8=_[_0xc753('0x25')](_0x2c04d4,function(_0x22b06a){return db[_0x5158ee][_0xc753('0x26')]({'where':{'id':_0x22b06a}})['then'](function(_0x3521ba){if(!_0x3521ba)return[];return _0x3521ba[_0xc753('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc753('0x28')](_0x3aeda8)[_0xc753('0x18')](function(_0x1ede62){var _0x4d6cf4=_(_0x1ede62)[_0xc753('0x29')]()['map']('id')[_0xc753('0x2a')]()[_0xc753('0x2b')]();return _0x4d6cf4;});}exports[_0xc753('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2f5c9f,_0x51b460,_0x209bbb){try{if(_0x51b460[_0xc753('0xc')]>0x0){_0x2f5c9f=_0x2f5c9f['filter'](function(_0x20bf00){return _0x51b460['includes'](_0x20bf00['id']);});}var _0xed387e=_0x2f5c9f['filter'](function(_0x5ec317){var _0x32c188=_0xc753('0x21');if(isAgentIdle(_0x5ec317)){_0x32c188='idle';}return _0x32c188===_0x209bbb;});return _[_0xc753('0x25')](_0xed387e,'id');}catch(_0x86cb0d){throw _0x86cb0d;}}exports[_0xc753('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x207c85,_0x3af826,_0x49691d){return Promise[_0xc753('0x2e')]()['then'](function(){if(_0x3af826[_0xc753('0xc')]>0x0){_0x207c85=_0x207c85[_0xc753('0xb')](function(_0x35e1f0){return _0x3af826['includes'](_0x35e1f0['id']);});}return _0x207c85;})[_0xc753('0x18')](function(){return db[_0xc753('0x2f')][_0xc753('0x30')]({'attributes':['id',_0xc753('0x31'),_0xc753('0x32'),_0xc753('0x3'),_0xc753('0x4'),_0xc753('0x5'),'openchannelPause',_0xc753('0x7'),_0xc753('0x8'),_0xc753('0x9'),'pauseType'],'where':{'id':{'$in':_[_0xc753('0x25')](_0x207c85,'id')}},'raw':!![]});})['then'](function(_0x197224){return _0x197224[_0xc753('0x25')](function(_0x32397e){var _0x213dc4=_[_0xc753('0x33')](_0x207c85,['id',_0x32397e['id']]);var _0x3b11d1=filterAgentAttributes(_0x213dc4);_[_0xc753('0x1d')](_0x32397e,_0x3b11d1);_0x32397e[_0xc753('0x34')]=getAgentStatus(_0x32397e);return _0x32397e;});})[_0xc753('0x18')](function(_0x551b5c){var _0x1f4afd=sortAgentsByStatus(_0x551b5c,_0x49691d);return _['map'](_0x1f4afd,'id');})['catch'](function(_0x1c5925){throw _0x1c5925;});}exports[_0xc753('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5e32e4){var _0x376cb9={'fields':[],'order':null};var _0x344d49=_0x5e32e4[_0xc753('0x36')](',');_0x376cb9[_0xc753('0x37')]=_[_0xc753('0xb')](_0x344d49,function(_0x1b164d){if(!_0x1b164d[_0xc753('0x38')]('globalStatus')){return!![];}_0x376cb9['order']=_[_0xc753('0x39')](_0x1b164d,'-')?_0xc753('0x3a'):_0xc753('0x3b');return![];});return _0x376cb9;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x4fa6bc){if(!_0x4fa6bc){_0x4fa6bc='fullname,internal';}if(_0x4fa6bc[_0xc753('0x38')](_0xc753('0x32'))&&!_0x4fa6bc[_0xc753('0x38')](_0xc753('0x3c'))){var _0x4907bf=_0x4fa6bc[_0xc753('0x3d')](0x0,_0x4fa6bc[_0xc753('0x3e')](_0xc753('0x32')));_0x4fa6bc+=','+_0x4907bf+'internal';}return _0x4fa6bc;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x259238,_0x8ce6a4){var _0x211f59=_0x259238[_0xc753('0x3f')](function(_0x4bf6f1,_0x4daaef){if(_0x4bf6f1[_0xc753('0x34')]===_0x4daaef['globalStatus']){if(_0x4bf6f1[_0xc753('0x34')]===_0xc753('0x12')){if(_0x8ce6a4===_0xc753('0x3a')){return(_0x4bf6f1[_0xc753('0x40')]||'')<(_0x4daaef[_0xc753('0x40')]||'')||_0x4bf6f1['fullname'][_0xc753('0x41')]()>_0x4daaef[_0xc753('0x32')][_0xc753('0x41')]()?0x1:-0x1;}else{return(_0x4bf6f1[_0xc753('0x40')]||'')<(_0x4daaef[_0xc753('0x40')]||'')||_0x4bf6f1[_0xc753('0x32')]['toLowerCase']()>_0x4daaef[_0xc753('0x32')][_0xc753('0x41')]()?-0x1:0x1;}}else{if(_0x8ce6a4===_0xc753('0x3a')){return _0x4bf6f1[_0xc753('0x32')][_0xc753('0x41')]()<_0x4daaef[_0xc753('0x32')][_0xc753('0x41')]()?0x1:-0x1;}else{return _0x4bf6f1[_0xc753('0x32')]['toLowerCase']()<_0x4daaef[_0xc753('0x32')][_0xc753('0x41')]()?-0x1:0x1;}}}else{if(_0x8ce6a4===_0xc753('0x3a')){return _0x4bf6f1[_0xc753('0x34')]<_0x4daaef['globalStatus']?0x1:-0x1;}else{return _0x4bf6f1[_0xc753('0x34')]<_0x4daaef[_0xc753('0x34')]?-0x1:0x1;}}});return _0x211f59;}exports[_0xc753('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x11b1a3){var _0x50013a=[_0xc753('0x43'),'online',_0xc753('0x44'),'lastPauseAt','pauseType','lastPauseAt',_0xc753('0x3c'),_0xc753('0x45'),_0xc753('0x3'),_0xc753('0x6'),_0xc753('0x5'),_0xc753('0x7'),_0xc753('0x9'),_0xc753('0x4'),'voicePause',_0xc753('0x46'),_0xc753('0x47'),_0xc753('0x48'),_0xc753('0x49'),_0xc753('0x4a'),_0xc753('0x4b'),'chatCurrentCapacity','openchannelCurrentCapacity',_0xc753('0x4c'),_0xc753('0x4d'),_0xc753('0x4e'),'faxCurrentCapacity',_0xc753('0x4f'),_0xc753('0x14'),_0xc753('0x50'),_0xc753('0x51'),'whatsappStatus',_0xc753('0x13'),_0xc753('0x11'),'chatStatusTime',_0xc753('0x52'),_0xc753('0x53'),'smsStatusTime',_0xc753('0x54'),'faxStatusTime',_0xc753('0x55'),_0xc753('0x56'),_0xc753('0x57'),'screenrecording',_0xc753('0x58'),_0xc753('0x59')];var _0x1eebf0=[_0xc753('0x3'),'openchannelPause',_0xc753('0x5'),_0xc753('0x7'),_0xc753('0x9'),_0xc753('0x4'),_0xc753('0x8'),_0xc753('0x5a')];var _0x33c085=_(_0x11b1a3)[_0xc753('0x5b')](_0x1eebf0)[_0xc753('0x5c')](_0x50013a)['value']();return _0x33c085;}exports[_0xc753('0x5d')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xc753('0x32'),'role',_0xc753('0x3c'),'online',_0xc753('0x34'),'userpic',_0xc753('0x44'),_0xc753('0x40'),_0xc753('0x5e'),_0xc753('0x4'),_0xc753('0x3'),_0xc753('0x5'),_0xc753('0x6'),_0xc753('0x7'),'voicePause','whatsappPause',_0xc753('0x4f'),_0xc753('0x13'),_0xc753('0x50'),_0xc753('0x14'),_0xc753('0x51'),'voiceStatus',_0xc753('0x15'),_0xc753('0x5f'),_0xc753('0x60'),'mailStatusTime',_0xc753('0x52'),_0xc753('0x61'),_0xc753('0x55'),'whatsappStatusTime',_0xc753('0x46'),_0xc753('0x4b'),_0xc753('0x48'),_0xc753('0x47'),_0xc753('0x49'),'whatsappCapacity','chatCurrentCapacity',_0xc753('0x62'),_0xc753('0x4c'),'openchannelCurrentCapacity',_0xc753('0x4d'),'whatsappCurrentCapacity',_0xc753('0x58'),_0xc753('0x59'),_0xc753('0x57'),'onhold','queue',_0xc753('0x63')];}exports[_0xc753('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x5458=['flatten','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','name','fullname','chatPause','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','substring','indexOf','internal','validateSortParameter','sort','pauseType','toLowerCase','userpic','online','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','pick','value','role','whatsappStatusTime','chatCurrentCapacity','faxCurrentCapacity','phoneBarEnableAutomaticScreenRecording','onhold','queue','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','filter','length','idle','unknown','ringing','isNil','voicePause','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents'];(function(_0x938050,_0x5591e9){var _0x43da16=function(_0x16ac1f){while(--_0x16ac1f){_0x938050['push'](_0x938050['shift']());}};_0x43da16(++_0x5591e9);}(_0x5458,0x1c7));var _0x8545=function(_0x3699b0,_0x485ab1){_0x3699b0=_0x3699b0-0x0;var _0x454067=_0x5458[_0x3699b0];return _0x454067;};'use strict';var _=require(_0x8545('0x0'));var jayson=require(_0x8545('0x1'));var db=require(_0x8545('0x2'))['db'];var amiClient=jayson['client'][_0x8545('0x3')]({'port':0x232a});var routingClient=jayson[_0x8545('0x4')]['http']({'port':0x232c});function isAgentPaused(_0x35d361,_0x1d3a7b){var _0x31e7cf=[_0x35d361['chatPause'],_0x35d361[_0x8545('0x5')],_0x35d361[_0x8545('0x6')],_0x35d361[_0x8545('0x7')],_0x35d361[_0x8545('0x8')],_0x35d361['voicePause'],_0x35d361[_0x8545('0x9')]];if(!_0x1d3a7b)return _['every'](_0x31e7cf);var _0x2cc4f4=_[_0x8545('0xa')](_0x31e7cf);return _0x2cc4f4[_0x8545('0xb')]>0x0&&_0x2cc4f4[_0x8545('0xb')]<_0x31e7cf[_0x8545('0xb')]?!![]:![];}function isIdle(_0x36a6d8){return _0x36a6d8===_0x8545('0xc')||_0x36a6d8===_0x8545('0xd')||_0x36a6d8==='unavailable'||_0x36a6d8===_0x8545('0xe')||_[_0x8545('0xf')](_0x36a6d8);}function isAgentIdle(_0x200177){if(_0x200177['voiceStatus']!==_0x8545('0xc')&&_0x200177[_0x8545('0x10')]){_0x200177[_0x8545('0x11')]=_0x8545('0x12');return![];}return _[_0x8545('0x13')]([_0x200177[_0x8545('0x14')],_0x200177[_0x8545('0x15')],_0x200177[_0x8545('0x16')],_0x200177[_0x8545('0x17')],_0x200177['smsStatus'],_0x200177[_0x8545('0x11')],_0x200177[_0x8545('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x8545('0x19'),{})[_0x8545('0x1a')](function(_0x1dae89){if(_0x1dae89['error']){throw new Error(_0x8545('0x1b'));}var _0x310933=_0x1dae89[_0x8545('0x1c')];return routingClient['request']('Agents',{})[_0x8545('0x1a')](function(_0x122a4c){if(_0x122a4c['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x564d3f=_0x122a4c[_0x8545('0x1c')];return _[_0x8545('0x1d')]({},_0x310933,_0x564d3f);});})[_0x8545('0x1e')](function(_0x2dd896){throw _0x2dd896;});}exports[_0x8545('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x228d7f){var _0x29d29a=_0x8545('0xd');if(isAgentPaused(_0x228d7f))_0x29d29a='pause';else if(isAgentPaused(_0x228d7f,!![]))_0x29d29a=_0x8545('0x20');else if(isAgentIdle(_0x228d7f))_0x29d29a=_0x8545('0xc');else _0x29d29a=_0x8545('0x21');return _0x29d29a;}exports[_0x8545('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x174ed3,_0xc6c75a){var _0x57b3d7=_[_0x8545('0x23')](_0x174ed3)?_0x174ed3:[_0x174ed3];var _0x593810=_['startCase'](_0xc6c75a)+_0x8545('0x24');var _0x20d2d9=_[_0x8545('0x25')](_0x57b3d7,function(_0x4efe7e){return db[_0x593810][_0x8545('0x26')]({'where':{'id':_0x4efe7e}})[_0x8545('0x1a')](function(_0x1e4d32){if(!_0x1e4d32)return[];return _0x1e4d32[_0x8545('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x20d2d9)[_0x8545('0x1a')](function(_0x2b0a00){var _0x2ad4d7=_(_0x2b0a00)[_0x8545('0x28')]()['map']('id')['uniq']()['value']();return _0x2ad4d7;});}exports[_0x8545('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2f244d,_0x31e7c2,_0x5a1b43){try{if(_0x31e7c2['length']>0x0){_0x2f244d=_0x2f244d[_0x8545('0xa')](function(_0x38e877){return _0x31e7c2[_0x8545('0x2a')](_0x38e877['id']);});}var _0x2ec6d6=_0x2f244d[_0x8545('0xa')](function(_0x31bb13){var _0x2c60ab=_0x8545('0x21');if(isAgentIdle(_0x31bb13)){_0x2c60ab=_0x8545('0xc');}return _0x2c60ab===_0x5a1b43;});return _[_0x8545('0x25')](_0x2ec6d6,'id');}catch(_0x576048){throw _0x576048;}}exports[_0x8545('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3b9659,_0x375289,_0x5413af){return Promise['resolve']()[_0x8545('0x1a')](function(){if(_0x375289[_0x8545('0xb')]>0x0){_0x3b9659=_0x3b9659[_0x8545('0xa')](function(_0x16c8d7){return _0x375289[_0x8545('0x2a')](_0x16c8d7['id']);});}return _0x3b9659;})[_0x8545('0x1a')](function(){return db[_0x8545('0x2c')][_0x8545('0x2d')]({'attributes':['id',_0x8545('0x2e'),_0x8545('0x2f'),_0x8545('0x30'),_0x8545('0x5'),_0x8545('0x6'),_0x8545('0x7'),_0x8545('0x8'),'voicePause',_0x8545('0x9'),'pauseType'],'where':{'id':{'$in':_['map'](_0x3b9659,'id')}},'raw':!![]});})[_0x8545('0x1a')](function(_0x49c328){return _0x49c328[_0x8545('0x25')](function(_0x5bbc71){var _0x316309=_[_0x8545('0x31')](_0x3b9659,['id',_0x5bbc71['id']]);var _0x58285e=filterAgentAttributes(_0x316309);_[_0x8545('0x1d')](_0x5bbc71,_0x58285e);_0x5bbc71['globalStatus']=getAgentStatus(_0x5bbc71);return _0x5bbc71;});})['then'](function(_0x367a40){var _0x1e1468=sortAgentsByStatus(_0x367a40,_0x5413af);return _[_0x8545('0x25')](_0x1e1468,'id');})['catch'](function(_0xba3103){throw _0xba3103;});}exports[_0x8545('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2bf475){var _0x4dee9e={'fields':[],'order':null};var _0x169bb9=_0x2bf475[_0x8545('0x33')](',');_0x4dee9e[_0x8545('0x34')]=_[_0x8545('0xa')](_0x169bb9,function(_0x4cc5e7){if(!_0x4cc5e7[_0x8545('0x2a')](_0x8545('0x35'))){return!![];}_0x4dee9e[_0x8545('0x36')]=_[_0x8545('0x37')](_0x4cc5e7,'-')?_0x8545('0x38'):_0x8545('0x39');return![];});return _0x4dee9e;}exports[_0x8545('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x5a3095){if(!_0x5a3095){_0x5a3095=_0x8545('0x3b');}if(_0x5a3095[_0x8545('0x2a')]('fullname')&&!_0x5a3095[_0x8545('0x2a')]('internal')){var _0x4e08ce=_0x5a3095[_0x8545('0x3c')](0x0,_0x5a3095[_0x8545('0x3d')]('fullname'));_0x5a3095+=','+_0x4e08ce+_0x8545('0x3e');}return _0x5a3095;}exports[_0x8545('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x5b9433,_0x2fcb6d){var _0x5bdf95=_0x5b9433[_0x8545('0x40')](function(_0x92ac63,_0x1028a2){if(_0x92ac63[_0x8545('0x35')]===_0x1028a2['globalStatus']){if(_0x92ac63[_0x8545('0x35')]===_0x8545('0x12')){if(_0x2fcb6d===_0x8545('0x38')){return(_0x92ac63[_0x8545('0x41')]||'')<(_0x1028a2[_0x8545('0x41')]||'')||_0x92ac63[_0x8545('0x2f')][_0x8545('0x42')]()>_0x1028a2[_0x8545('0x2f')][_0x8545('0x42')]()?0x1:-0x1;}else{return(_0x92ac63[_0x8545('0x41')]||'')<(_0x1028a2[_0x8545('0x41')]||'')||_0x92ac63[_0x8545('0x2f')][_0x8545('0x42')]()>_0x1028a2[_0x8545('0x2f')][_0x8545('0x42')]()?-0x1:0x1;}}else{if(_0x2fcb6d==='DESC'){return _0x92ac63['fullname'][_0x8545('0x42')]()<_0x1028a2[_0x8545('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return _0x92ac63[_0x8545('0x2f')][_0x8545('0x42')]()<_0x1028a2[_0x8545('0x2f')][_0x8545('0x42')]()?-0x1:0x1;}}}else{if(_0x2fcb6d==='DESC'){return _0x92ac63[_0x8545('0x35')]<_0x1028a2[_0x8545('0x35')]?0x1:-0x1;}else{return _0x92ac63[_0x8545('0x35')]<_0x1028a2[_0x8545('0x35')]?-0x1:0x1;}}});return _0x5bdf95;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x2d5941){var _0x367f74=[_0x8545('0x43'),_0x8545('0x44'),'lastLoginAt','lastPauseAt',_0x8545('0x41'),'lastPauseAt',_0x8545('0x3e'),_0x8545('0x45'),_0x8545('0x30'),_0x8545('0x7'),_0x8545('0x6'),_0x8545('0x8'),_0x8545('0x9'),_0x8545('0x5'),_0x8545('0x10'),_0x8545('0x46'),_0x8545('0x47'),_0x8545('0x48'),_0x8545('0x49'),_0x8545('0x4a'),_0x8545('0x4b'),'chatCurrentCapacity',_0x8545('0x4c'),_0x8545('0x4d'),_0x8545('0x4e'),_0x8545('0x4f'),'faxCurrentCapacity',_0x8545('0x14'),_0x8545('0x17'),'mailStatus',_0x8545('0x50'),_0x8545('0x18'),'faxStatus',_0x8545('0x11'),_0x8545('0x51'),_0x8545('0x52'),_0x8545('0x53'),_0x8545('0x54'),'whatsappStatusTime',_0x8545('0x55'),'voiceStatusTime','queue',_0x8545('0x56'),'screenrecording',_0x8545('0x57'),'phoneBarEnableAutomaticScreenRecording'];var _0xe5a4e8=[_0x8545('0x30'),'openchannelPause',_0x8545('0x6'),_0x8545('0x8'),'whatsappPause',_0x8545('0x5'),_0x8545('0x10'),_0x8545('0x44')];var _0x3bef1d=_(_0x2d5941)['omit'](_0xe5a4e8)[_0x8545('0x58')](_0x367f74)[_0x8545('0x59')]();return _0x3bef1d;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x8545('0x2e'),_0x8545('0x2f'),_0x8545('0x5a'),_0x8545('0x3e'),_0x8545('0x44'),_0x8545('0x35'),_0x8545('0x43'),'lastLoginAt','pauseType','lastPauseAt',_0x8545('0x5'),_0x8545('0x30'),'mailPause','openchannelPause',_0x8545('0x8'),_0x8545('0x10'),_0x8545('0x9'),'chatStatus',_0x8545('0x15'),_0x8545('0x16'),_0x8545('0x17'),_0x8545('0x50'),'voiceStatus',_0x8545('0x18'),_0x8545('0x51'),_0x8545('0x55'),_0x8545('0x53'),_0x8545('0x52'),'smsStatusTime','voiceStatusTime',_0x8545('0x5b'),_0x8545('0x46'),_0x8545('0x4b'),_0x8545('0x48'),_0x8545('0x47'),'smsCapacity',_0x8545('0x4a'),_0x8545('0x5c'),_0x8545('0x5d'),_0x8545('0x4d'),_0x8545('0x4c'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x8545('0x57'),_0x8545('0x5e'),'destconnectedlinenum',_0x8545('0x5f'),_0x8545('0x60'),_0x8545('0x61')];}exports[_0x8545('0x62')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index f1207c0..966a2cd 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3f8=['inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','Trunk','startPredictive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','waiting','merge','pick','initializeQueues','lodash','util','client','http','available','loggedIn','paused','busy'];(function(_0x3ab116,_0x22a648){var _0x4d1843=function(_0x333ea0){while(--_0x333ea0){_0x3ab116['push'](_0x3ab116['shift']());}};_0x4d1843(++_0x22a648);}(_0xd3f8,0x130));var _0x8d3f=function(_0x7447ec,_0x2f4711){_0x7447ec=_0x7447ec-0x0;var _0x2eef5b=_0xd3f8[_0x7447ec];return _0x2eef5b;};'use strict';var _=require(_0x8d3f('0x0'));var jayson=require('jayson/promise');var util=require(_0x8d3f('0x1'));var amiClient=jayson[_0x8d3f('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x8d3f('0x2')][_0x8d3f('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8d3f('0x4'),_0x8d3f('0x5'),_0x8d3f('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x8d3f('0x7'),_0x8d3f('0x8'),_0x8d3f('0x9'),_0x8d3f('0xa'),_0x8d3f('0xb'),_0x8d3f('0xc'),_0x8d3f('0xd'),_0x8d3f('0xe'),_0x8d3f('0xf'),_0x8d3f('0x10'),_0x8d3f('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8d3f('0x12'),_0x8d3f('0x13'),_0x8d3f('0x14'),_0x8d3f('0x15'),_0x8d3f('0x16'),'dialMethod',_0x8d3f('0x17'),_0x8d3f('0x18'),'startProgressive','erlangCalls',_0x8d3f('0x19'),_0x8d3f('0x1a'),'erlangBusyFactor',_0x8d3f('0x1b'),_0x8d3f('0x1c'),_0x8d3f('0x1d'),'predictiveIntervalAvailable',_0x8d3f('0x1e'),_0x8d3f('0x1f'),_0x8d3f('0x20'),_0x8d3f('0x21'),_0x8d3f('0x22'),_0x8d3f('0x23')];function getRealtimeQueues(_0x5331e4,_0x2795c4){var _0x5d94fd=_0x2795c4===_0x8d3f('0x24')?amiClient:routingClient;return _0x5d94fd['request'](_['startCase'](_0x2795c4)+_0x8d3f('0x25'),_0x5331e4)[_0x8d3f('0x26')](function(_0x5870b3){if(_0x5870b3[_0x8d3f('0x27')])throw new Error(util[_0x8d3f('0x28')](_0x8d3f('0x29'),_0x2795c4));return _0x5870b3[_0x8d3f('0x2a')];})['catch'](function(_0x36e94c){throw _0x36e94c;});}exports[_0x8d3f('0x2b')]=getRealtimeQueues;function initializeQueues(_0x4c78db,_0x57dc45,_0x14896e,_0x327532){var _0x323bb6=DEFAULT_QUEUE_ATTRIBUTES;if(_0x14896e===_0x8d3f('0x24')){if(_0x327532===_0x8d3f('0x2c')){_0x323bb6=_0x323bb6[_0x8d3f('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x327532===_0x8d3f('0x2e')){_0x323bb6=_0x323bb6['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4c78db[_0x8d3f('0x2f')](function(_0x2669bc){var _0x25279c=_0x2669bc['get']({'plain':!![]});_0x25279c[_0x8d3f('0x6')]=0x0;_0x25279c['loggedInDb']=0x0;_0x25279c[_0x8d3f('0x5')]=0x0;_0x25279c[_0x8d3f('0x4')]=0x0;_0x25279c[_0x8d3f('0x30')]=0x0;if(_0x14896e===_0x8d3f('0x24')){_0x25279c[_0x8d3f('0xf')]=0x0;_0x25279c[_0x8d3f('0x7')]=0x0;if(_0x327532==='outbound'){_0x25279c[_0x8d3f('0x12')]=0x0;_0x25279c[_0x8d3f('0x13')]=0x0;}}var _0x545685=_['find'](_0x57dc45,['id',_0x25279c['id']]);if(_0x545685){_[_0x8d3f('0x31')](_0x25279c,_[_0x8d3f('0x32')](_0x545685,_0x323bb6));}return _0x25279c;});}exports[_0x8d3f('0x33')]=initializeQueues; \ No newline at end of file +var _0xb80f=['http','client','available','loggedIn','waiting','busy','invalid','loggedInDb','notInUse','onHold','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound','concat','outbound','map','get','paused','talking','find','merge','lodash','jayson/promise','util'];(function(_0x30d835,_0x46e2d8){var _0x4bf3bf=function(_0xf95c19){while(--_0xf95c19){_0x30d835['push'](_0x30d835['shift']());}};_0x4bf3bf(++_0x46e2d8);}(_0xb80f,0x12f));var _0xfb80=function(_0x24a124,_0x3364d3){_0x24a124=_0x24a124-0x0;var _0x14c0e2=_0xb80f[_0x24a124];return _0x14c0e2;};'use strict';var _=require(_0xfb80('0x0'));var jayson=require(_0xfb80('0x1'));var util=require(_0xfb80('0x2'));var amiClient=jayson['client'][_0xfb80('0x3')]({'port':0x232a});var routingClient=jayson[_0xfb80('0x4')][_0xfb80('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xfb80('0x5'),_0xfb80('0x6'),'paused',_0xfb80('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xfb80('0x8'),'inUse',_0xfb80('0x9'),_0xfb80('0xa'),_0xfb80('0xb'),_0xfb80('0xc'),'ringing','ringInUse','talking',_0xfb80('0xd'),_0xfb80('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xfb80('0xf'),_0xfb80('0x10'),_0xfb80('0x11'),_0xfb80('0x12'),_0xfb80('0x13'),_0xfb80('0x14'),_0xfb80('0x15'),'startPredictive',_0xfb80('0x16'),_0xfb80('0x17'),_0xfb80('0x18'),_0xfb80('0x19'),_0xfb80('0x1a'),'dialPredictiveInterval',_0xfb80('0x1b'),_0xfb80('0x1c'),'predictiveIntervalAvailable',_0xfb80('0x1d'),_0xfb80('0x1e'),_0xfb80('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0xfb80('0x20'),_0xfb80('0x21')];function getRealtimeQueues(_0x5f2bcd,_0x384134){var _0x169d47=_0x384134==='voice'?amiClient:routingClient;return _0x169d47['request'](_['startCase'](_0x384134)+_0xfb80('0x22'),_0x5f2bcd)[_0xfb80('0x23')](function(_0x4c33bf){if(_0x4c33bf['error'])throw new Error(util[_0xfb80('0x24')](_0xfb80('0x25'),_0x384134));return _0x4c33bf[_0xfb80('0x26')];})[_0xfb80('0x27')](function(_0x3ef1f4){throw _0x3ef1f4;});}exports[_0xfb80('0x28')]=getRealtimeQueues;function initializeQueues(_0xb03d03,_0x56e98c,_0x3e8973,_0x38d8b5){var _0x406dc8=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3e8973===_0xfb80('0x29')){if(_0x38d8b5===_0xfb80('0x2a')){_0x406dc8=_0x406dc8[_0xfb80('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x38d8b5===_0xfb80('0x2c')){_0x406dc8=_0x406dc8[_0xfb80('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xb03d03[_0xfb80('0x2d')](function(_0x581f29){var _0x7de6d4=_0x581f29[_0xfb80('0x2e')]({'plain':!![]});_0x7de6d4[_0xfb80('0x2f')]=0x0;_0x7de6d4['loggedInDb']=0x0;_0x7de6d4[_0xfb80('0x6')]=0x0;_0x7de6d4['available']=0x0;_0x7de6d4['waiting']=0x0;if(_0x3e8973===_0xfb80('0x29')){_0x7de6d4[_0xfb80('0x30')]=0x0;_0x7de6d4[_0xfb80('0x8')]=0x0;if(_0x38d8b5===_0xfb80('0x2c')){_0x7de6d4[_0xfb80('0xf')]=0x0;_0x7de6d4[_0xfb80('0x10')]=0x0;}}var _0x3ecfb5=_[_0xfb80('0x31')](_0x56e98c,['id',_0x7de6d4['id']]);if(_0x3ecfb5){_[_0xfb80('0x32')](_0x7de6d4,_['pick'](_0x3ecfb5,_0x406dc8));}return _0x7de6d4;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index fd407e8..127371d 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x165360,_0x5ca20b){var _0x5acc59=function(_0x4f9d07){while(--_0x4f9d07){_0x165360['push'](_0x165360['shift']());}};_0x5acc59(++_0x5ca20b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x35af98,_0x103f33){var _0x5f5a62=function(_0x1b1eea){while(--_0x1b1eea){_0x35af98['push'](_0x35af98['shift']());}};_0x5f5a62(++_0x103f33);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0d4cbfe..4d07a3b 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 _0x0ea0=['crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','map','join','createHash','md5','update','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','digest','hex','substring','lodash'];(function(_0x4c5a90,_0x39edaf){var _0x8e83e8=function(_0xce4f7e){while(--_0xce4f7e){_0x4c5a90['push'](_0x4c5a90['shift']());}};_0x8e83e8(++_0x39edaf);}(_0x0ea0,0x6b));var _0x00ea=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x0ea0[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require(_0x00ea('0x0'));var os=require('os');var crypto=require(_0x00ea('0x1'));var machine=require(_0x00ea('0x2'));var exec=require(_0x00ea('0x3'))[_0x00ea('0x4')];var config=require(_0x00ea('0x5'));function getInterfaces(){var _0x5c0d4d=[];var _0x300d6c=os[_0x00ea('0x6')]();var _0xfe2b26=_['orderBy'](_[_0x00ea('0x7')](_0x300d6c));for(var _0x593de7=0x0;_0x593de7<_0xfe2b26[_0x00ea('0x8')];_0x593de7++){var _0xc24e19=_0x300d6c[_0xfe2b26[_0x593de7]][_0x00ea('0x9')](function(_0x5f43c5){return _0x5f43c5['family']===_0x00ea('0xa')&&_0x5f43c5[_0x00ea('0xb')]===![];});_0x5c0d4d=_0x5c0d4d[_0x00ea('0xc')](_0xc24e19);}return _0x5c0d4d;}function getFirstInterface(){var _0x5edab6=_[_0x00ea('0xd')](getInterfaces());return{'macAddress':_0x5edab6&&_0x5edab6[_0x00ea('0xe')]?_0x5edab6['mac']:_0x00ea('0xf'),'ipAddress':_0x5edab6&&_0x5edab6[_0x00ea('0x10')]?_0x5edab6[_0x00ea('0x10')]:_0x00ea('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2fe504=_[_0x00ea('0x12')](os['cpus']()[_0x00ea('0x13')](function(_0x5b8c43){return _0x5b8c43['model'];}))[_0x00ea('0x14')](':');return crypto[_0x00ea('0x15')](_0x00ea('0x16'))[_0x00ea('0x17')](_0x2fe504)['digest']('hex');}exports[_0x00ea('0x18')]=function(){var _0x4a4a47=os[_0x00ea('0x19')]();var _0x5c991d=/[0-9a-f-]{36}/;if(config[_0x00ea('0x1a')]&&_0x5c991d[_0x00ea('0x1b')](config['licenseToken'])){return config[_0x00ea('0x1a')];}else if(_0x4a4a47===_0x00ea('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x00ea('0x1d')})[_0x00ea('0x1e')]('\x0d\x0a','');}else{var _0x389408=getFirstInterface();var _0x25ef27=getCPUhash();var _0x23e373=_0x25ef27+'|'+os[_0x00ea('0x1f')]()+'|'+_0x389408['macAddress']+'|'+_0x389408[_0x00ea('0x20')];var _0x39a719=crypto['createHash']('md5')[_0x00ea('0x17')](_0x23e373)[_0x00ea('0x21')](_0x00ea('0x22'));return _0x39a719[_0x00ea('0x23')](0x0,0x8)+'-'+_0x39a719[_0x00ea('0x23')](0x8,0xc)+'-'+_0x39a719['substring'](0xc,0x10)+'-'+_0x39a719[_0x00ea('0x23')](0x10,0x14)+'-'+_0x39a719[_0x00ea('0x23')](0x14);}}; \ No newline at end of file +var _0x8a3d=['licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','createHash','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','md5','update','digest','getUuid'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8a3d,0x133));var _0xd8a3=function(_0x129d7f,_0x5c22bb){_0x129d7f=_0x129d7f-0x0;var _0x1a52af=_0x8a3d[_0x129d7f];return _0x1a52af;};'use strict';var _=require(_0xd8a3('0x0'));var os=require('os');var crypto=require(_0xd8a3('0x1'));var machine=require(_0xd8a3('0x2'));var exec=require(_0xd8a3('0x3'))[_0xd8a3('0x4')];var config=require(_0xd8a3('0x5'));function getInterfaces(){var _0x3680e4=[];var _0x3ab564=os[_0xd8a3('0x6')]();var _0x3d052a=_[_0xd8a3('0x7')](_['keys'](_0x3ab564));for(var _0x1f3874=0x0;_0x1f3874<_0x3d052a['length'];_0x1f3874++){var _0x2466a7=_0x3ab564[_0x3d052a[_0x1f3874]][_0xd8a3('0x8')](function(_0x340096){return _0x340096[_0xd8a3('0x9')]===_0xd8a3('0xa')&&_0x340096[_0xd8a3('0xb')]===![];});_0x3680e4=_0x3680e4[_0xd8a3('0xc')](_0x2466a7);}return _0x3680e4;}function getFirstInterface(){var _0x70c597=_[_0xd8a3('0xd')](getInterfaces());return{'macAddress':_0x70c597&&_0x70c597[_0xd8a3('0xe')]?_0x70c597[_0xd8a3('0xe')]:_0xd8a3('0xf'),'ipAddress':_0x70c597&&_0x70c597[_0xd8a3('0x10')]?_0x70c597['address']:_0xd8a3('0x11')};}exports[_0xd8a3('0x12')]=getFirstInterface;function getCPUhash(){var _0x2c8eaf=_[_0xd8a3('0x7')](os[_0xd8a3('0x13')]()[_0xd8a3('0x14')](function(_0x2786ed){return _0x2786ed['model'];}))[_0xd8a3('0x15')](':');return crypto['createHash'](_0xd8a3('0x16'))[_0xd8a3('0x17')](_0x2c8eaf)[_0xd8a3('0x18')]('hex');}exports[_0xd8a3('0x19')]=function(){var _0x550292=os['platform']();var _0x1f3994=/[0-9a-f-]{36}/;if(config[_0xd8a3('0x1a')]&&_0x1f3994[_0xd8a3('0x1b')](config[_0xd8a3('0x1a')])){return config['licenseToken'];}else if(_0x550292===_0xd8a3('0x1c')){return exec(_0xd8a3('0x1d'),{'encoding':'utf8'})[_0xd8a3('0x1e')]('\x0d\x0a','');}else{var _0x1049ee=getFirstInterface();var _0x61322d=getCPUhash();var _0x3785b9=_0x61322d+'|'+os[_0xd8a3('0x1f')]()+'|'+_0x1049ee[_0xd8a3('0x20')]+'|'+_0x1049ee[_0xd8a3('0x21')];var _0x31d3c5=crypto[_0xd8a3('0x22')](_0xd8a3('0x16'))[_0xd8a3('0x17')](_0x3785b9)[_0xd8a3('0x18')](_0xd8a3('0x23'));return _0x31d3c5[_0xd8a3('0x24')](0x0,0x8)+'-'+_0x31d3c5[_0xd8a3('0x24')](0x8,0xc)+'-'+_0x31d3c5[_0xd8a3('0x24')](0xc,0x10)+'-'+_0x31d3c5[_0xd8a3('0x24')](0x10,0x14)+'-'+_0x31d3c5[_0xd8a3('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2f3ada4..0aede6b 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 _0xd18e=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x28d31d,_0x57a4e6){var _0x2df7c1=function(_0x52601d){while(--_0x52601d){_0x28d31d['push'](_0x28d31d['shift']());}};_0x2df7c1(++_0x57a4e6);}(_0xd18e,0x113));var _0xed18=function(_0x416def,_0x26324c){_0x416def=_0x416def-0x0;var _0x164e7e=_0xd18e[_0x416def];return _0x164e7e;};'use strict';var util=require(_0xed18('0x0'));var moment=require(_0xed18('0x1'));var rp=require(_0xed18('0x2'));var BPromise=require(_0xed18('0x3'));var pkginfo=require(_0xed18('0x4'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xed18('0x5'));var hardware=require(_0xed18('0x6'));var logger=require('../logger')(_0xed18('0x7'));var HOST=_0xed18('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1a0202){return new BPromise(function(_0x588ca5,_0x2c866f){var _0x338668=util[_0xed18('0x9')](_0xed18('0xa'),HOST,_0x1a0202,module[_0xed18('0xb')]['version']);if(oldToken){_0x338668=util[_0xed18('0x9')](_0xed18('0xc'),HOST,_0x1a0202,module[_0xed18('0xb')][_0xed18('0xd')],oldToken);}var _0x2fc2b3={'uri':_0x338668,'method':_0xed18('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2fc2b3)[_0xed18('0xf')](function(_0x4cc088){_0x588ca5(_0x4cc088);})[_0xed18('0x10')](function(_0x320c0a){_0x2c866f(_0x320c0a);});});}function manageLicense(_0x4bea89,_0x55f9b3){var _0x1f5e29=_0x55f9b3[_0xed18('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x1f5e29[_0xed18('0x12')]!==_0x4bea89&&!_0x1f5e29[_0xed18('0x13')]){oldToken=_0x1f5e29[_0xed18('0x12')];}httpRequest(_0x4bea89)[_0xed18('0xf')](function(_0x46289a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x46289a[_0xed18('0x14')]){isOldTokenSent=![];if(!_0x1f5e29[_0xed18('0x7')]&&_0x1f5e29[_0xed18('0x7')]!=_0x46289a[_0xed18('0x7')]||_0x1f5e29[_0xed18('0x7')]&&_0x1f5e29[_0xed18('0x13')]){logger[_0xed18('0x15')](_0xed18('0x16'));}if(_0x1f5e29[_0xed18('0x7')]&&!_0x1f5e29[_0xed18('0x13')]&&_0x1f5e29[_0xed18('0x7')]!=_0x46289a[_0xed18('0x7')]){logger[_0xed18('0x15')](_0xed18('0x17'));}if(_0x1f5e29[_0xed18('0x7')]&&!_0x1f5e29[_0xed18('0x13')]&&_0x1f5e29[_0xed18('0x7')]==_0x46289a[_0xed18('0x7')]){return _0x55f9b3;}return _0x55f9b3['update']({'data1':_0x4bea89,'data2':null,'license':_0x46289a[_0xed18('0x7')]});}else{if(_0x46289a[_0xed18('0x7')]||_0x1f5e29[_0xed18('0x7')]){if(!_0x1f5e29[_0xed18('0x13')]){if(_0x1f5e29['data1']==_0x4bea89){GRAY_PERIOD_REASON=_0xed18('0x18');logger[_0xed18('0x15')](_0xed18('0x19'));}else{GRAY_PERIOD_REASON=_0xed18('0x1a');logger[_0xed18('0x15')](_0xed18('0x1b'),_0x1f5e29['data1'],_0x4bea89);}logger[_0xed18('0x15')](_0xed18('0x1c'),GRAY_PERIOD_REASON[_0xed18('0x1d')](),moment()[_0xed18('0x9')](_0xed18('0x1e')));return _0x55f9b3[_0xed18('0x1f')]({'data2':encryptor[_0xed18('0x20')](moment()[_0xed18('0x9')](_0xed18('0x1e')))});}else{if(moment()[_0xed18('0x21')](encryptor[_0xed18('0x22')](_0x1f5e29[_0xed18('0x13')]),'days')>DAYS){logger[_0xed18('0x15')](_0xed18('0x23'),moment()[_0xed18('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x55f9b3[_0xed18('0x1f')]({'data1':_0x4bea89,'data2':null,'license':null});}}}else{if(_0x1f5e29[_0xed18('0x12')]!=_0x4bea89){logger[_0xed18('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1f5e29[_0xed18('0x12')],_0x4bea89);return _0x55f9b3[_0xed18('0x1f')]({'data1':_0x4bea89,'data2':null,'license':null});}}}return _0x55f9b3;})[_0xed18('0xf')](function(_0x17ad13){_0x55f9b3=_0x17ad13;})[_0xed18('0x10')](function(_0x383a93){logger[_0xed18('0x24')](_0x383a93[_0xed18('0x25')]);})[_0xed18('0x26')](function(){setTimeout(function(){manageLicense(hardware[_0xed18('0x27')](),_0x55f9b3);},TIME);});}function defaultLicense(){var _0x3c199d=hardware[_0xed18('0x27')]();if(_0x3c199d){return db['License'][_0xed18('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x3c199d}})['spread'](function(_0x3f8c6f,_0x3b1b0a){logger['info'](_0xed18('0x29'),_0x3c199d);manageLicense(_0x3c199d,_0x3f8c6f);})[_0xed18('0x10')](function(_0x317b73){logger[_0xed18('0x24')](_0x317b73['message']);});}}exports[_0xed18('0x2a')]=defaultLicense; \ No newline at end of file +var _0x07ef=['../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data2','data1','then','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','error','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07ef,0x157));var _0xf07e=function(_0x2dee2f,_0x19572f){_0x2dee2f=_0x2dee2f-0x0;var _0x327c18=_0x07ef[_0x2dee2f];return _0x327c18;};'use strict';var util=require(_0xf07e('0x0'));var moment=require('moment');var rp=require(_0xf07e('0x1'));var BPromise=require(_0xf07e('0x2'));var pkginfo=require(_0xf07e('0x3'))(module,_0xf07e('0x4'));var db=require(_0xf07e('0x5'))['db'];var encryptor=require(_0xf07e('0x6'));var hardware=require(_0xf07e('0x7'));var logger=require(_0xf07e('0x8'))(_0xf07e('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4cd30e){return new BPromise(function(_0x1c3a3a,_0x12578a){var _0x338216=util[_0xf07e('0xa')](_0xf07e('0xb'),HOST,_0x4cd30e,module[_0xf07e('0xc')][_0xf07e('0x4')]);if(oldToken){_0x338216=util['format'](_0xf07e('0xd'),HOST,_0x4cd30e,module['exports'][_0xf07e('0x4')],oldToken);}var _0x203eb2={'uri':_0x338216,'method':_0xf07e('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x203eb2)['then'](function(_0x20f235){_0x1c3a3a(_0x20f235);})[_0xf07e('0xf')](function(_0x11ffd9){_0x12578a(_0x11ffd9);});});}function manageLicense(_0x680c06,_0x11d5c1){var _0x2d679d=_0x11d5c1['get']({'plain':!![]});if(!isOldTokenSent&&_0x2d679d['data1']!==_0x680c06&&!_0x2d679d[_0xf07e('0x10')]){oldToken=_0x2d679d[_0xf07e('0x11')];}httpRequest(_0x680c06)[_0xf07e('0x12')](function(_0x2ecdd3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2ecdd3[_0xf07e('0x13')]){isOldTokenSent=![];if(!_0x2d679d['license']&&_0x2d679d['license']!=_0x2ecdd3['license']||_0x2d679d['license']&&_0x2d679d[_0xf07e('0x10')]){logger['info'](_0xf07e('0x14'));}if(_0x2d679d[_0xf07e('0x9')]&&!_0x2d679d[_0xf07e('0x10')]&&_0x2d679d['license']!=_0x2ecdd3[_0xf07e('0x9')]){logger['info'](_0xf07e('0x15'));}if(_0x2d679d[_0xf07e('0x9')]&&!_0x2d679d[_0xf07e('0x10')]&&_0x2d679d[_0xf07e('0x9')]==_0x2ecdd3[_0xf07e('0x9')]){return _0x11d5c1;}return _0x11d5c1[_0xf07e('0x16')]({'data1':_0x680c06,'data2':null,'license':_0x2ecdd3[_0xf07e('0x9')]});}else{if(_0x2ecdd3[_0xf07e('0x9')]||_0x2d679d[_0xf07e('0x9')]){if(!_0x2d679d[_0xf07e('0x10')]){if(_0x2d679d['data1']==_0x680c06){GRAY_PERIOD_REASON='Disabled';logger[_0xf07e('0x17')](_0xf07e('0x18'));}else{GRAY_PERIOD_REASON=_0xf07e('0x19');logger[_0xf07e('0x17')](_0xf07e('0x1a'),_0x2d679d[_0xf07e('0x11')],_0x680c06);}logger['info'](_0xf07e('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xf07e('0xa')](_0xf07e('0x1c')));return _0x11d5c1[_0xf07e('0x16')]({'data2':encryptor[_0xf07e('0x1d')](moment()['format'](_0xf07e('0x1c')))});}else{if(moment()['diff'](encryptor[_0xf07e('0x1e')](_0x2d679d[_0xf07e('0x10')]),_0xf07e('0x1f'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0xf07e('0x1c')));isOldTokenSent=![];return _0x11d5c1[_0xf07e('0x16')]({'data1':_0x680c06,'data2':null,'license':null});}}}else{if(_0x2d679d['data1']!=_0x680c06){logger[_0xf07e('0x17')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2d679d[_0xf07e('0x11')],_0x680c06);return _0x11d5c1[_0xf07e('0x16')]({'data1':_0x680c06,'data2':null,'license':null});}}}return _0x11d5c1;})['then'](function(_0x466d35){_0x11d5c1=_0x466d35;})[_0xf07e('0xf')](function(_0x35e124){logger[_0xf07e('0x20')](_0x35e124[_0xf07e('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xf07e('0x22')](),_0x11d5c1);},TIME);});}function defaultLicense(){var _0x1494f6=hardware[_0xf07e('0x22')]();if(_0x1494f6){return db['License'][_0xf07e('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x1494f6}})[_0xf07e('0x24')](function(_0x1e2c79,_0x3c9ac9){logger[_0xf07e('0x17')](_0xf07e('0x25'),_0x1494f6);manageLicense(_0x1494f6,_0x1e2c79);})[_0xf07e('0xf')](function(_0x38d8ae){logger[_0xf07e('0x20')](_0x38d8ae[_0xf07e('0x21')]);});}}exports[_0xf07e('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 4cb0e59..e9df4de 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 _0xc77c=['forEach','role','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','then','catch','uuid','license','isEmpty','data1','data2','split','decryptString','parse','machineUuid','gray','add','days','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','count','admin','telephone','users','telephones'];(function(_0x3a16d4,_0x221ae7){var _0x48310b=function(_0x462be1){while(--_0x462be1){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x48310b(++_0x221ae7);}(_0xc77c,0xdd));var _0xcc77=function(_0x2d54ba,_0x3d5c1a){_0x2d54ba=_0x2d54ba-0x0;var _0x445649=_0xc77c[_0x2d54ba];return _0x445649;};'use strict';var util=require(_0xcc77('0x0'));var _=require(_0xcc77('0x1'));var moment=require(_0xcc77('0x2'));var BPromise=require('bluebird');var hardware=require(_0xcc77('0x3'));var encryptor=require(_0xcc77('0x4'));var db=require(_0xcc77('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcc77('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcc77('0x7'),'machineUuid':hardware[_0xcc77('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xcc77('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x220f02){return new BPromise(function(_0x37c2a4,_0x335356){return db['License']['find'](_['defaults'](_0x220f02,{'raw':!![],'where':{'id':0x1}}))[_0xcc77('0x9')](function(_0x51f44e){return checkLicense(_0x51f44e,null);})[_0xcc77('0x9')](function(_0x46a8c6){_0x37c2a4(_0x46a8c6);return;})[_0xcc77('0xa')](function(_0x50128a){_0x335356(_0x50128a);});});}function checkLicense(_0x5ba931,_0x81422){if(!_0x5ba931){demoLicense[_0xcc77('0xb')]=_0x5ba931['data1'];return demoLicense;}try{var _0x53dc69=_0x81422||_0x5ba931[_0xcc77('0xc')];if(_[_0xcc77('0xd')](_0x53dc69)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xa32a84=_0x5ba931[_0xcc77('0xe')];var _0x1a4882=_0x5ba931[_0xcc77('0xf')];var _0x142041=_0xa32a84['split']('-')[0x4];var _0x376714=_0xa32a84[_0xcc77('0x10')]('-')[0x0];var _0xc750f1=encryptor[_0xcc77('0x11')](_0x53dc69,util['format']('%s:%s:%s',_0x142041,_0xa32a84,_0x376714));var _0x3f4a84=JSON[_0xcc77('0x12')](_0xc750f1);_0x3f4a84['demo']=![];_0x3f4a84[_0xcc77('0xb')]=_0xa32a84;_0x3f4a84[_0xcc77('0x13')]=hardware[_0xcc77('0x8')]();if(_0x1a4882){var _0x272660=encryptor[_0xcc77('0x11')](_0x1a4882);_0x3f4a84[_0xcc77('0x14')]=_0x272660;_0x3f4a84['deadline']=moment(_0x272660)[_0xcc77('0x15')](0x7,_0xcc77('0x16'))['format']();_0x3f4a84[_0xcc77('0x17')]=_0x3f4a84[_0xcc77('0xb')]!=_0x3f4a84['machineUuid']?_0xcc77('0x18'):_0xcc77('0x19');}return _0x3f4a84;}catch(_0xc9b551){breakingLicense['uuid']=_0x5ba931[_0xcc77('0xe')];breakingLicense[_0xcc77('0x1a')]=_0xc9b551['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x51eb07,_0x3f4d1e){getLicense()[_0xcc77('0x9')](function(_0x3e6c00){return db[_0xcc77('0x1b')][_0xcc77('0x1c')]({'attributes':['role',[db[_0xcc77('0x1d')]['fn'](_0xcc77('0x1e'),db[_0xcc77('0x1d')][_0xcc77('0x1f')]('role')),_0xcc77('0x20')]],'group':'role','where':{'role':{'$or':[_0xcc77('0x21'),'user',_0xcc77('0x22')]}},'raw':!![]})[_0xcc77('0x9')](function(_0x59df84){var _0x2773bd={'user':_0x3e6c00[_0xcc77('0x23')]||0x0,'telephone':_0x3e6c00[_0xcc77('0x24')]||0x0};_0x59df84[_0xcc77('0x25')](function(_0x5a2c4c){var _0x5eb2e1=_0x5a2c4c[_0xcc77('0x26')]===_0xcc77('0x21')?'user':_0x5a2c4c[_0xcc77('0x26')];_0x2773bd[_0x5eb2e1]-=_0x5a2c4c[_0xcc77('0x20')];if(_0x2773bd[_0x5eb2e1]<0x0)_0x2773bd[_0x5eb2e1]=0x0;});_0x51eb07(_0x2773bd);return;});})[_0xcc77('0xa')](function(_0x4b78c6){_0x3f4d1e(_0x4b78c6);});});}function checkUserLimits(_0x1c34fd){return new BPromise(function(_0x4f3091,_0x4349db){getLimits()['then'](function(_0x2ff378){var _0x372b3d=_['pick'](_['countBy'](_0x1c34fd,_0xcc77('0x26')),['admin','user',_0xcc77('0x22')]);var _0x390be9=(_0x372b3d[_0xcc77('0x21')]||0x0)+(_0x372b3d[_0xcc77('0x27')]||0x0);var _0x9079cf=_0x372b3d['telephone']||0x0;if(_0x390be9>_0x2ff378[_0xcc77('0x27')])return _0x4349db(_0xcc77('0x28'));if(_0x9079cf>_0x2ff378['telephone'])return _0x4349db(_0xcc77('0x29'));return _0x4f3091();})['catch'](function(_0xa716ee){_0x4349db(_0xa716ee);});});}module[_0xcc77('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0353=['demo','machineUuid','deadline','days','format','grayReason','changed','message','User','role','sequelize','COUNT','col','count','admin','user','users','forEach','pick','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','uuid','isEmpty','data1','split','%s:%s:%s','parse'];(function(_0x15810a,_0x17affc){var _0x297f9e=function(_0x3c7f81){while(--_0x3c7f81){_0x15810a['push'](_0x15810a['shift']());}};_0x297f9e(++_0x17affc);}(_0x0353,0x91));var _0x3035=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x0353[_0x11a220];return _0x20d8fe;};'use strict';var util=require(_0x3035('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x3035('0x1'));var hardware=require(_0x3035('0x2'));var encryptor=require(_0x3035('0x3'));var db=require(_0x3035('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3035('0x5'),'machineUuid':hardware[_0x3035('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3035('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3035('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2ca0f7){return new BPromise(function(_0x5ea8e2,_0x28f92d){return db[_0x3035('0x9')][_0x3035('0xa')](_['defaults'](_0x2ca0f7,{'raw':!![],'where':{'id':0x1}}))[_0x3035('0xb')](function(_0x51446b){return checkLicense(_0x51446b,null);})[_0x3035('0xb')](function(_0x568a84){_0x5ea8e2(_0x568a84);return;})[_0x3035('0xc')](function(_0xb3537){_0x28f92d(_0xb3537);});});}function checkLicense(_0x2c681a,_0x48cc9a){if(!_0x2c681a){demoLicense[_0x3035('0xd')]=_0x2c681a['data1'];return demoLicense;}try{var _0x3fdda6=_0x48cc9a||_0x2c681a['license'];if(_[_0x3035('0xe')](_0x3fdda6)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5e2cde=_0x2c681a[_0x3035('0xf')];var _0x14e045=_0x2c681a['data2'];var _0x5bb470=_0x5e2cde[_0x3035('0x10')]('-')[0x4];var _0x4036b5=_0x5e2cde['split']('-')[0x0];var _0x253acd=encryptor['decryptString'](_0x3fdda6,util['format'](_0x3035('0x11'),_0x5bb470,_0x5e2cde,_0x4036b5));var _0x38fefe=JSON[_0x3035('0x12')](_0x253acd);_0x38fefe[_0x3035('0x13')]=![];_0x38fefe['uuid']=_0x5e2cde;_0x38fefe[_0x3035('0x14')]=hardware[_0x3035('0x6')]();if(_0x14e045){var _0x558bac=encryptor['decryptString'](_0x14e045);_0x38fefe['gray']=_0x558bac;_0x38fefe[_0x3035('0x15')]=moment(_0x558bac)['add'](0x7,_0x3035('0x16'))[_0x3035('0x17')]();_0x38fefe[_0x3035('0x18')]=_0x38fefe[_0x3035('0xd')]!=_0x38fefe[_0x3035('0x14')]?_0x3035('0x19'):'disabled';}return _0x38fefe;}catch(_0x50d368){breakingLicense[_0x3035('0xd')]=_0x2c681a[_0x3035('0xf')];breakingLicense[_0x3035('0x1a')]=_0x50d368[_0x3035('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x16a899,_0x3162ec){getLicense()[_0x3035('0xb')](function(_0x5ee646){return db[_0x3035('0x1b')]['findAll']({'attributes':[_0x3035('0x1c'),[db[_0x3035('0x1d')]['fn'](_0x3035('0x1e'),db[_0x3035('0x1d')][_0x3035('0x1f')](_0x3035('0x1c'))),_0x3035('0x20')]],'group':_0x3035('0x1c'),'where':{'role':{'$or':[_0x3035('0x21'),_0x3035('0x22'),'telephone']}},'raw':!![]})[_0x3035('0xb')](function(_0x5e933c){var _0x4cdb4c={'user':_0x5ee646[_0x3035('0x23')]||0x0,'telephone':_0x5ee646['telephones']||0x0};_0x5e933c[_0x3035('0x24')](function(_0x40e8d5){var _0xeddb26=_0x40e8d5['role']===_0x3035('0x21')?_0x3035('0x22'):_0x40e8d5[_0x3035('0x1c')];_0x4cdb4c[_0xeddb26]-=_0x40e8d5['count'];if(_0x4cdb4c[_0xeddb26]<0x0)_0x4cdb4c[_0xeddb26]=0x0;});_0x16a899(_0x4cdb4c);return;});})['catch'](function(_0x5abbd0){_0x3162ec(_0x5abbd0);});});}function checkUserLimits(_0x12dc42){return new BPromise(function(_0x750029,_0x10e307){getLimits()[_0x3035('0xb')](function(_0x1155ec){var _0xb57b8=_[_0x3035('0x25')](_['countBy'](_0x12dc42,'role'),[_0x3035('0x21'),_0x3035('0x22'),_0x3035('0x26')]);var _0x6b9aab=(_0xb57b8['admin']||0x0)+(_0xb57b8[_0x3035('0x22')]||0x0);var _0x2d25a2=_0xb57b8['telephone']||0x0;if(_0x6b9aab>_0x1155ec[_0x3035('0x22')])return _0x10e307('License\x20limit\x20reached\x20for\x20users');if(_0x2d25a2>_0x1155ec[_0x3035('0x26')])return _0x10e307(_0x3035('0x27'));return _0x750029();})[_0x3035('0xc')](function(_0x98a1f2){_0x10e307(_0x98a1f2);});});}module[_0x3035('0x28')]={'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 6731f00..1c26073 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 _0xc2c7=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x361654,_0x2180f2){var _0x161d3c=function(_0xfcd29f){while(--_0xfcd29f){_0x361654['push'](_0x361654['shift']());}};_0x161d3c(++_0x2180f2);}(_0xc2c7,0x134));var _0x7c2c=function(_0x478a67,_0x38214e){_0x478a67=_0x478a67-0x0;var _0x4cd8a4=_0xc2c7[_0x478a67];return _0x4cd8a4;};'use strict';module['exports']={'DOMAIN':_0x7c2c('0x0'),'SESSION_SECRET':_0x7c2c('0x1'),'GOOGLE_ID':_0x7c2c('0x2'),'GOOGLE_SECRET':_0x7c2c('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xcf66=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcf66,0x71));var _0x6cf6=function(_0x5b91e2,_0x2685f2){_0x5b91e2=_0x5b91e2-0x0;var _0x3779e3=_0xcf66[_0x5b91e2];return _0x3779e3;};'use strict';module[_0x6cf6('0x0')]={'DOMAIN':_0x6cf6('0x1'),'SESSION_SECRET':_0x6cf6('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x6cf6('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index eadd224..d27a987 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da1=['fileLogger','../utils/loggers'];(function(_0x4fbc52,_0x1a547){var _0x474551=function(_0x406af1){while(--_0x406af1){_0x4fbc52['push'](_0x4fbc52['shift']());}};_0x474551(++_0x1a547);}(_0x7da1,0x171));var _0x17da=function(_0x57b5b3,_0x2e1ff9){_0x57b5b3=_0x57b5b3-0x0;var _0x46f985=_0x7da1[_0x57b5b3];return _0x46f985;};'use strict';var fileLogger=require(_0x17da('0x0'))[_0x17da('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xcecc=['exports'];(function(_0x458bc8,_0x419550){var _0x20f166=function(_0xa4bf39){while(--_0xa4bf39){_0x458bc8['push'](_0x458bc8['shift']());}};_0x20f166(++_0x419550);}(_0xcecc,0x1e9));var _0xccec=function(_0x38078e,_0x227e10){_0x38078e=_0x38078e-0x0;var _0x1d5bca=_0xcecc[_0x38078e];return _0x1d5bca;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0xccec('0x0')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 9279903..e1b1761 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 _0x18a5=['routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x5f2e12,_0x45491f){var _0x142184=function(_0x11bb02){while(--_0x11bb02){_0x5f2e12['push'](_0x5f2e12['shift']());}};_0x142184(++_0x45491f);}(_0x18a5,0x100));var _0x518a=function(_0x5198b2,_0x590c84){_0x5198b2=_0x5198b2-0x0;var _0x57959a=_0x18a5[_0x5198b2];return _0x57959a;};'use strict';var path=require(_0x518a('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0x518a('0x1')](cfg[_0x518a('0x2')],_0x518a('0x3')))};var pm2config={'apps':[{'name':_0x518a('0x4'),'script':path[_0x518a('0x1')](__dirname,_0x518a('0x5')),'env':env},{'name':'ami','script':path[_0x518a('0x1')](__dirname,_0x518a('0x6')),'env':env},{'name':_0x518a('0x7'),'script':path[_0x518a('0x1')](__dirname,_0x518a('0x8')),'env':env},{'name':'email','script':path[_0x518a('0x1')](__dirname,_0x518a('0x9')),'env':env},{'name':_0x518a('0xa'),'script':path['join'](__dirname,_0x518a('0xb')),'env':env},{'name':'xdr','script':path['join'](__dirname,_0x518a('0xc')),'env':env}]};module[_0x518a('0xd')]=pm2config; \ No newline at end of file +var _0xe06f=['../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','express','ami','agi'];(function(_0x451f88,_0x5c061a){var _0x2cc2b7=function(_0x5bb6ce){while(--_0x5bb6ce){_0x451f88['push'](_0x451f88['shift']());}};_0x2cc2b7(++_0x5c061a);}(_0xe06f,0xbb));var _0xfe06=function(_0x8923e4,_0x2e7c2f){_0x8923e4=_0x8923e4-0x0;var _0x217a2f=_0xe06f[_0x8923e4];return _0x217a2f;};'use strict';var path=require(_0xfe06('0x0'));var cfg=require(_0xfe06('0x1'));var env={'NODE_PATH':path[_0xfe06('0x2')](path[_0xfe06('0x3')](cfg[_0xfe06('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xfe06('0x5'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xfe06('0x6'),'script':path[_0xfe06('0x3')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xfe06('0x7'),'script':path[_0xfe06('0x3')](__dirname,_0xfe06('0x8')),'env':env},{'name':_0xfe06('0x9'),'script':path[_0xfe06('0x3')](__dirname,_0xfe06('0xa')),'env':env},{'name':_0xfe06('0xb'),'script':path['join'](__dirname,_0xfe06('0xc')),'env':env},{'name':'xdr','script':path['join'](__dirname,_0xfe06('0xd')),'env':env}]};module[_0xfe06('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 37e5a5c..9879069 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 _0xab26=['./config','connect','connected','start','disconnect','stop','then','list','describe','delete','dump','saved','pm2'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xab26,0x1c6));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var pm2=require(_0x6ab2('0x0'));var BPromise=require('bluebird');var config=require(_0x6ab2('0x1'));function connect(){return new BPromise(function(_0x12dff8,_0x5af0b9){return pm2[_0x6ab2('0x2')](function(_0x2a53e7){if(_0x2a53e7){return _0x5af0b9(_0x2a53e7);}return _0x12dff8(_0x6ab2('0x3'));});});};exports[_0x6ab2('0x4')]=function(_0xf9fcef){return connect()['then'](function(){return new BPromise(function(_0x1d9902,_0x52e94b){return pm2['start'](_0xf9fcef,function(_0x259b54,_0x1edb23){if(_0x259b54){return _0x52e94b(_0x259b54);}pm2[_0x6ab2('0x5')]();return _0x1d9902(_0x1edb23);});});});};exports[_0x6ab2('0x6')]=function(_0x20927f){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x40ea07,_0x2b2cce){return pm2[_0x6ab2('0x6')](_0x20927f,function(_0x1e2710,_0xe5fb2c){if(_0x1e2710){return _0x2b2cce(_0x1e2710);}pm2[_0x6ab2('0x5')]();return _0x40ea07(_0xe5fb2c);});});});};exports['restart']=function(_0x41edb9){return connect()['then'](function(){return new BPromise(function(_0x7fd1ba,_0x1fed71){return pm2['restart'](_0x41edb9,function(_0x1db56a,_0x49e21b){if(_0x1db56a){return _0x1fed71(_0x1db56a);}pm2[_0x6ab2('0x5')]();return _0x7fd1ba(_0x49e21b);});});});};exports[_0x6ab2('0x8')]=function(){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x3be010,_0x52cccd){return pm2[_0x6ab2('0x8')](function(_0x3ce898,_0xc58582){if(_0x3ce898){return _0x52cccd(_0x3ce898);}pm2[_0x6ab2('0x5')]();return _0x3be010(_0xc58582);});});});};exports['describe']=function(_0x468460){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x585abe,_0x4cb905){return pm2[_0x6ab2('0x9')](_0x468460,function(_0x2f7dc9,_0x2e13b4){if(_0x2f7dc9){return _0x4cb905(_0x2f7dc9);}pm2[_0x6ab2('0x5')]();return _0x585abe(_0x2e13b4);});});});};exports[_0x6ab2('0xa')]=function(_0x287157){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x53fc23,_0x252a97){return pm2['delete'](_0x287157,function(_0x1a2539,_0x351898){if(_0x1a2539){return _0x252a97(_0x1a2539);}pm2[_0x6ab2('0x5')]();return _0x53fc23(_0x351898);});});});};exports[_0x6ab2('0xb')]=function(){return connect()[_0x6ab2('0x7')](function(){return new BPromise(function(_0x1684b7,_0x20129a){return pm2['dump'](function(_0x5f00de){if(_0x5f00de){return _0x20129a(_0x5f00de);}return _0x1684b7(_0x6ab2('0xc'));});});});}; \ No newline at end of file +var _0x9ad5=['disconnect','stop','restart','describe','delete','dump','saved','pm2','./config','connect','start','then'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9ad5,0xf7));var _0x59ad=function(_0x38e569,_0x59efb2){_0x38e569=_0x38e569-0x0;var _0x4e13e6=_0x9ad5[_0x38e569];return _0x4e13e6;};'use strict';var pm2=require(_0x59ad('0x0'));var BPromise=require('bluebird');var config=require(_0x59ad('0x1'));function connect(){return new BPromise(function(_0xa11e56,_0x5e6b6d){return pm2[_0x59ad('0x2')](function(_0x4848ad){if(_0x4848ad){return _0x5e6b6d(_0x4848ad);}return _0xa11e56('connected');});});};exports[_0x59ad('0x3')]=function(_0x3d59c0){return connect()[_0x59ad('0x4')](function(){return new BPromise(function(_0x1d02c8,_0x3f6227){return pm2[_0x59ad('0x3')](_0x3d59c0,function(_0xfbbbc2,_0x2b3bd0){if(_0xfbbbc2){return _0x3f6227(_0xfbbbc2);}pm2[_0x59ad('0x5')]();return _0x1d02c8(_0x2b3bd0);});});});};exports['stop']=function(_0x546404){return connect()[_0x59ad('0x4')](function(){return new BPromise(function(_0x3ba85d,_0x954a8b){return pm2[_0x59ad('0x6')](_0x546404,function(_0x304c67,_0x49b42c){if(_0x304c67){return _0x954a8b(_0x304c67);}pm2[_0x59ad('0x5')]();return _0x3ba85d(_0x49b42c);});});});};exports[_0x59ad('0x7')]=function(_0x67cac4){return connect()[_0x59ad('0x4')](function(){return new BPromise(function(_0x20cb5f,_0x4f9e91){return pm2[_0x59ad('0x7')](_0x67cac4,function(_0x150493,_0x36174d){if(_0x150493){return _0x4f9e91(_0x150493);}pm2[_0x59ad('0x5')]();return _0x20cb5f(_0x36174d);});});});};exports['list']=function(){return connect()[_0x59ad('0x4')](function(){return new BPromise(function(_0x5da510,_0x5ddc06){return pm2['list'](function(_0x51794e,_0x22905c){if(_0x51794e){return _0x5ddc06(_0x51794e);}pm2[_0x59ad('0x5')]();return _0x5da510(_0x22905c);});});});};exports[_0x59ad('0x8')]=function(_0x4be8f3){return connect()['then'](function(){return new BPromise(function(_0x19dc42,_0x18a00c){return pm2[_0x59ad('0x8')](_0x4be8f3,function(_0x4f40af,_0x1408e3){if(_0x4f40af){return _0x18a00c(_0x4f40af);}pm2['disconnect']();return _0x19dc42(_0x1408e3);});});});};exports[_0x59ad('0x9')]=function(_0x4c7614){return connect()[_0x59ad('0x4')](function(){return new BPromise(function(_0x12058c,_0x22a56d){return pm2[_0x59ad('0x9')](_0x4c7614,function(_0x103bd9,_0x235676){if(_0x103bd9){return _0x22a56d(_0x103bd9);}pm2[_0x59ad('0x5')]();return _0x12058c(_0x235676);});});});};exports['dump']=function(){return connect()[_0x59ad('0x4')](function(){return new BPromise(function(_0x350b49,_0x246468){return pm2[_0x59ad('0xa')](function(_0x7a68f5){if(_0x7a68f5){return _0x246468(_0x7a68f5);}return _0x350b49(_0x59ad('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 244102e..94d6b45 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 _0xc614=['util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','ChatInteraction','update','timeout','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment'];(function(_0x38a1c5,_0x3773ee){var _0x2bddf5=function(_0x4ee0cb){while(--_0x4ee0cb){_0x38a1c5['push'](_0x38a1c5['shift']());}};_0x2bddf5(++_0x3773ee);}(_0xc614,0x135));var _0x4c61=function(_0x34d067,_0x13d2fe){_0x34d067=_0x34d067-0x0;var _0x308b9a=_0xc614[_0x34d067];return _0x308b9a;};'use strict';var _=require('lodash');var moment=require(_0x4c61('0x0'));var Redis=require('ioredis');var util=require(_0x4c61('0x1'));var config=require(_0x4c61('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x4c61('0x3'))(_0x4c61('0x4'));config[_0x4c61('0x5')]=_[_0x4c61('0x6')](config[_0x4c61('0x5')],{'host':_0x4c61('0x7'),'port':0x18eb});var io=require(_0x4c61('0x8'))(new Redis(config[_0x4c61('0x5')]));function closeInteractions(){var _0xcc5ee=0x0;var _0xa9e53a=[];return db[_0x4c61('0x9')][_0x4c61('0xa')]({'raw':!![],'attributes':['id',_0x4c61('0xb')],'where':{'id':0x1}})[_0x4c61('0xc')](function(_0x41275f){_0xcc5ee=_0x41275f[_0x4c61('0xb')];if(_0xcc5ee){return db['ChatInteraction'][_0x4c61('0xd')]({'raw':!![],'attributes':['id',_0x4c61('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4c61('0xf')](_0x41275f[_0x4c61('0xb')],_0x4c61('0x10'))}}});}else{return[];}})[_0x4c61('0xc')](function(_0x54abfa){if(_0x54abfa&&_0x54abfa[_0x4c61('0x11')]){_0xa9e53a=_[_0x4c61('0x12')](_0x54abfa||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0xa9e53a['join']());return db[_0x4c61('0x13')][_0x4c61('0x14')]({'closeReason':'system','disposition':_0x4c61('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xa9e53a}});}})[_0x4c61('0xc')](function(){if(_0xa9e53a&&_0xa9e53a[_0x4c61('0x11')]){logger[_0x4c61('0x16')](_0x4c61('0x17'),_0xa9e53a[_0x4c61('0x18')]());for(var _0xe6a164=0x0;_0xe6a164<_0xa9e53a[_0x4c61('0x11')];_0xe6a164++){io[_0x4c61('0x19')](_0x4c61('0x1a'),{'id':_0xa9e53a[_0xe6a164],'closed':!![]});}}})[_0x4c61('0x1b')](function(_0x3c13b6){logger[_0x4c61('0x1c')](_0x4c61('0x1d'),_0x3c13b6?util['inspect'](_0x3c13b6,{'showHidden':![],'depth':null}):'');});}exports[_0x4c61('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2273=['util','../../config/environment','../../mysqldb','schedule','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','findAll','lastMsgAt','subtract','minutes','then','info','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','inspect','start','lodash','moment','ioredis'];(function(_0x292cd4,_0x1fdced){var _0x4cd4e9=function(_0x161427){while(--_0x161427){_0x292cd4['push'](_0x292cd4['shift']());}};_0x4cd4e9(++_0x1fdced);}(_0x2273,0x11f));var _0x3227=function(_0x410d33,_0x58ab08){_0x410d33=_0x410d33-0x0;var _0x2862df=_0x2273[_0x410d33];return _0x2862df;};'use strict';var _=require(_0x3227('0x0'));var moment=require(_0x3227('0x1'));var Redis=require(_0x3227('0x2'));var util=require(_0x3227('0x3'));var config=require(_0x3227('0x4'));var db=require(_0x3227('0x5'))['db'];var logger=require('../logger')(_0x3227('0x6'));config[_0x3227('0x7')]=_[_0x3227('0x8')](config[_0x3227('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3227('0x9'))(new Redis(config[_0x3227('0x7')]));function closeInteractions(){var _0x2972a9=0x0;var _0x39b3f3=[];return db[_0x3227('0xa')][_0x3227('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x11ec42){_0x2972a9=_0x11ec42[_0x3227('0xc')];if(_0x2972a9){return db['ChatInteraction'][_0x3227('0xd')]({'raw':!![],'attributes':['id',_0x3227('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3227('0xf')](_0x11ec42['chatTimeout'],_0x3227('0x10'))}}});}else{return[];}})[_0x3227('0x11')](function(_0x1c4d11){if(_0x1c4d11&&_0x1c4d11['length']){_0x39b3f3=_['map'](_0x1c4d11||[],'id');logger[_0x3227('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x39b3f3['join']());return db[_0x3227('0x13')][_0x3227('0x14')]({'closeReason':_0x3227('0x15'),'disposition':_0x3227('0x16'),'closed':!![],'closedAt':moment()[_0x3227('0x17')](_0x3227('0x18'))},{'where':{'id':_0x39b3f3}});}})[_0x3227('0x11')](function(){if(_0x39b3f3&&_0x39b3f3['length']){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x39b3f3['join']());for(var _0x391fed=0x0;_0x391fed<_0x39b3f3[_0x3227('0x19')];_0x391fed++){io[_0x3227('0x1a')]('chatInteraction:update',{'id':_0x39b3f3[_0x391fed],'closed':!![]});}}})['catch'](function(_0x35bd77){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x35bd77?util[_0x3227('0x1b')](_0x35bd77,{'showHidden':![],'depth':null}):'');});}exports[_0x3227('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 7491a70..9008664 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa74=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x265021,_0x455fa5){var _0x106a05=function(_0x43ef38){while(--_0x43ef38){_0x265021['push'](_0x265021['shift']());}};_0x106a05(++_0x455fa5);}(_0xfa74,0x1bd));var _0x4fa7=function(_0x569fac,_0x24dce9){_0x569fac=_0x569fac-0x0;var _0x1a6c38=_0xfa74[_0x569fac];return _0x1a6c38;};'use strict';function start(){var _0x44d452=require(_0x4fa7('0x0'));return _0x44d452[_0x4fa7('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xe87d=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xe87d,0xc2));var _0xde87=function(_0x91a578,_0x19e97b){_0x91a578=_0x91a578-0x0;var _0x541f19=_0xe87d[_0x91a578];return _0x541f19;};'use strict';function start(){var _0x169cf2=require(_0xde87('0x0'));return _0x169cf2[_0xde87('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 8827fe7..c3e209c 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 _0xfe06=['add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','number','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','entity','dataValues','attempt','report\x20status:','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','intersection','length','exists','deleteJob','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start'];(function(_0x1b2808,_0x35a0dc){var _0x2ca622=function(_0x43a52c){while(--_0x43a52c){_0x1b2808['push'](_0x1b2808['shift']());}};_0x2ca622(++_0x35a0dc);}(_0xfe06,0x6f));var _0x6fe0=function(_0x1b74cc,_0x32eb3a){_0x1b74cc=_0x1b74cc-0x0;var _0xb57de7=_0xfe06[_0x1b74cc];return _0xb57de7;};'use strict';var fs=require('fs');var util=require(_0x6fe0('0x0'));var path=require(_0x6fe0('0x1'));var _=require(_0x6fe0('0x2'));var moment=require(_0x6fe0('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x6fe0('0x4'));var BPromise=require(_0x6fe0('0x5'));var logger=require('../logger')('schedule');var db=require(_0x6fe0('0x6'))['db'];const retry=require(_0x6fe0('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x6fe0('0x8'));var client=jayson[_0x6fe0('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x57f6a6){const _0x6a5581={};if(typeof _0x57f6a6===_0x6fe0('0xa')){_0x6a5581['id']=_0x57f6a6;}return db['AnalyticExtractedReport']['findOne']({'where':_0x6a5581})[_0x6fe0('0xb')](function(_0x30a4ad){return _0x30a4ad;})[_0x6fe0('0xc')](function(_0x68a6b6){logger[_0x6fe0('0xd')](_0x68a6b6);});}function handleSendEmail(_0x2b4781,_0x58a790){logger[_0x6fe0('0xe')](_0x6fe0('0xf'),_0x2b4781[_0x6fe0('0x10')]);var _0x2a1c5c=!![];var _0x1dc29b=_0x2b4781[_0x6fe0('0x11')][_0x6fe0('0x12')]();var _0x3ee5bd={'account':_0x1dc29b,'message':{'from':util[_0x6fe0('0x13')](_0x6fe0('0x14'),_0x2b4781[_0x6fe0('0x11')]['name'],_0x2b4781['MailAccount'][_0x6fe0('0x10')]||_0x2b4781[_0x6fe0('0x11')][_0x6fe0('0x15')]['user']),'to':_0x2b4781['email'],'cc':_0x2b4781['cc'],'bcc':_0x2b4781[_0x6fe0('0x16')],'subject':util[_0x6fe0('0x13')](_0x6fe0('0x17'),_0x58a790[_0x6fe0('0x18')],_0x2b4781[_0x6fe0('0x19')],_0x2b4781[_0x6fe0('0x1a')])}};var _0x458868=path['join'](__dirname,_0x6fe0('0x1b'));var _0x2de946=_0x58a790[_0x6fe0('0x1c')];var _0xa17f55=util['format'](_0x6fe0('0x1d'),path['basename'](_0x58a790['savename'],path[_0x6fe0('0x1e')](_0x58a790[_0x6fe0('0x1c')])),_0x6fe0('0x1f'));var _0x2ca9be=path[_0x6fe0('0x20')](_0x458868,_0x2de946);var _0x709f7=path[_0x6fe0('0x20')](_0x458868,_0xa17f55);if(fs[_0x6fe0('0x21')](_0x2ca9be)){_0x58a790[_0x6fe0('0x22')]='Sent';_0x3ee5bd[_0x6fe0('0x23')][_0x6fe0('0x24')]=[{'filename':_0x2de946,'path':_0x2ca9be}];_0x3ee5bd['message']['text']=util['format'](_0x6fe0('0x25'),JSON[_0x6fe0('0x26')](_0x58a790,null,0x2));}else if(fs[_0x6fe0('0x21')](_0x709f7)){_0x58a790[_0x6fe0('0x22')]='Sent';_0x3ee5bd[_0x6fe0('0x23')][_0x6fe0('0x24')]=[{'filename':_0xa17f55,'path':_0x709f7}];}else{if(_0x58a790[_0x6fe0('0x22')]==='Empty'){_0x3ee5bd['message'][_0x6fe0('0x27')]=_0x6fe0('0x28');if(!_0x2b4781['sendIfEmpty']){_0x2a1c5c=![];logger[_0x6fe0('0xe')](_0x6fe0('0x29'));}}else if(_0x58a790['status']===_0x6fe0('0x2a')){_0x3ee5bd[_0x6fe0('0x23')]['text']=_0x6fe0('0x2b');}else if(_0x58a790[_0x6fe0('0x22')]===_0x6fe0('0x2c')){_0x3ee5bd[_0x6fe0('0x23')][_0x6fe0('0x27')]=_0x6fe0('0x2d');}else if(_0x58a790['status']===_0x6fe0('0x2e')){_0x3ee5bd[_0x6fe0('0x23')]['text']=_0x6fe0('0x2f');}else{logger[_0x6fe0('0xd')](_0x6fe0('0x30'),_0x58a790['status']);}}if(_0x2a1c5c){return client[_0x6fe0('0x31')](_0x6fe0('0x32'),_0x3ee5bd)['then'](function(_0x44363d){if(_0x44363d[_0x6fe0('0xd')]){return logger['error'](_0x6fe0('0x33'),JSON[_0x6fe0('0x26')](_0x44363d));}return logger[_0x6fe0('0xe')](_0x6fe0('0x34'));})['catch'](function(_0x364c95){return logger['error'](_0x6fe0('0x33'),JSON[_0x6fe0('0x26')](_0x364c95));});}}function handleError(){return function(_0x322ec1){return logger[_0x6fe0('0xd')](JSON[_0x6fe0('0x26')](_0x322ec1));};}function loading(_0x427077){logger[_0x6fe0('0xe')](_0x6fe0('0x35'));if(_0x427077[_0x6fe0('0x36')]===_0x427077[_0x6fe0('0x37')][_0x6fe0('0x38')]){handleSendEmail(_0x427077[_0x6fe0('0x39')],_0x427077[_0x6fe0('0x3a')]);_0x427077[_0x6fe0('0x3b')][_0x6fe0('0x3c')]();}else{_0x427077[_0x6fe0('0x3b')][_0x6fe0('0x7')](_0x6fe0('0x3d'));}}function completed(_0x486d95){logger[_0x6fe0('0xe')](_0x6fe0('0x3e'));handleSendEmail(_0x486d95[_0x6fe0('0x39')],_0x486d95[_0x6fe0('0x3a')]);_0x486d95['operation']['stop']();}function empty(_0x12bc85){logger[_0x6fe0('0xe')](_0x6fe0('0x3f'));handleSendEmail(_0x12bc85[_0x6fe0('0x39')],_0x12bc85[_0x6fe0('0x3a')]);_0x12bc85[_0x6fe0('0x3b')][_0x6fe0('0x3c')]();}function failed(_0xff2883){logger['info']('case\x20failed');handleSendEmail(_0xff2883['job'],_0xff2883[_0x6fe0('0x3a')]);_0xff2883[_0x6fe0('0x3b')][_0x6fe0('0x3c')]();}function urecognized(_0x2e5f57){logger[_0x6fe0('0xd')]('Unrecognized\x20status:',_0x2e5f57[_0x6fe0('0x40')][_0x6fe0('0x41')][_0x6fe0('0x22')]);_0x2e5f57[_0x6fe0('0x3b')][_0x6fe0('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5d9faa,_0xd9756f){const _0x261187={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x47ced5=retry[_0x6fe0('0x3b')](_0x261187);_0x47ced5[_0x6fe0('0x42')](_0x5b3d5e=>{logger[_0x6fe0('0xe')]('Job\x20ID\x20'+_0x5d9faa['id']+'\x20Attempt\x20#:'+_0x5b3d5e);try{getReportData(_0xd9756f['id'])['then'](function(_0x54bd62){_0xd9756f=_0x54bd62;logger['info'](_0x6fe0('0x43'),_0x54bd62[_0x6fe0('0x41')][_0x6fe0('0x22')]);if(!reportStatusStrategies[_0x54bd62[_0x6fe0('0x41')]['status']]){logger[_0x6fe0('0xd')]('report\x20status:',_0x54bd62['dataValues'][_0x6fe0('0x22')]);_0x47ced5[_0x6fe0('0x7')]();}reportStatusStrategies[_0x54bd62[_0x6fe0('0x41')][_0x6fe0('0x22')]]({'operation':_0x47ced5,'currentAttempt':_0x5b3d5e,'retryOptions':_0x261187,'job':_0x5d9faa,'data':_0xd9756f,'entity':_0x54bd62});});}catch(_0x2389db){_0x47ced5[_0x6fe0('0x7')](_0x2389db);}});}function handleResult(_0x548896){return function(_0x459f8b){if(_0x548896['sendMail']&&_0x548896[_0x6fe0('0x11')]&&_0x548896[_0x6fe0('0x11')][_0x6fe0('0x15')]&&!_[_0x6fe0('0x44')](_0x548896[_0x6fe0('0x10')])){retryer(_0x548896,_0x459f8b);}};}function handleJob(_0x334a13){return function(){try{if(_['isNil'](_0x334a13[_0x6fe0('0x19')])){return logger[_0x6fe0('0xe')](_0x6fe0('0x45'));}if(_[_0x6fe0('0x44')](_0x334a13[_0x6fe0('0x1a')])){return logger[_0x6fe0('0xe')](_0x6fe0('0x46'));}var _0x3656b5={'startDate':moment()[_0x6fe0('0x47')](_0x334a13[_0x6fe0('0x19')],_0x334a13['subtractUnit'])[_0x6fe0('0x13')](_0x6fe0('0x48')),'endDate':moment()['format'](_0x6fe0('0x48')),'type':_0x6fe0('0x49'),'output':_0x334a13[_0x6fe0('0x4a')],'name':_0x334a13[_0x6fe0('0x18')]};if(!_[_0x6fe0('0x44')](_0x334a13['DefaultReportId'])){logger['info'](_0x6fe0('0x4b'),_0x334a13[_0x6fe0('0x4c')]);return analyticDefaultReportController['runReport']({'id':_0x334a13[_0x6fe0('0x4c')]},_0x3656b5)['then'](handleResult(_0x334a13))[_0x6fe0('0xc')](handleError());}if(!_[_0x6fe0('0x44')](_0x334a13[_0x6fe0('0x4d')])){logger[_0x6fe0('0xe')]('exec\x20custom\x20report\x20id:%s',_0x334a13[_0x6fe0('0x4d')]);return analyticCustomReportController[_0x6fe0('0x4e')]({'id':_0x334a13[_0x6fe0('0x4d')]},_0x3656b5)[_0x6fe0('0xb')](handleResult(_0x334a13))[_0x6fe0('0xc')](handleError());}}catch(_0x281874){logger['error'](JSON[_0x6fe0('0x26')](_0x281874));}return logger['info'](_0x6fe0('0x4f'));};}function getJobs(_0x50801e){var _0x5493a7={};if(_0x50801e){_0x5493a7['id']=_0x50801e;}return db[_0x6fe0('0x50')][_0x6fe0('0x51')]({'where':_0x5493a7,'include':[{'model':db[_0x6fe0('0x11')],'attributes':['id',_0x6fe0('0x18'),_0x6fe0('0x10')],'include':[{'model':db[_0x6fe0('0x52')],'as':_0x6fe0('0x15'),'include':[{'model':db[_0x6fe0('0x53')],'as':_0x6fe0('0x53')}]}]}]})[_0x6fe0('0xb')](function(_0x5bb1f3){var _0x11c067=_[_0x6fe0('0x54')](manager['jobs']);var _0x96d845=_[_0x6fe0('0x55')](_0x5bb1f3,function(_0x4957f6){return _0x4957f6['id'][_0x6fe0('0x56')]();});var _0x375f89=_['keyBy'](_0x5bb1f3,function(_0x5bfb49){return _0x5bfb49['id']['toString']();});var _0x4f9627=_0x50801e?_0x96d845:_['difference'](_0x96d845,_0x11c067);var _0x48967a=_[_0x6fe0('0x57')](_0x96d845,_0x11c067);var _0x21e6b1=_['difference'](_0x11c067,_0x96d845);var _0x3766ce;var _0x1c2c2a;for(_0x3766ce=0x0;_0x3766ce<_0x21e6b1[_0x6fe0('0x58')]&&!_0x50801e;_0x3766ce+=0x1){_0x1c2c2a=_0x21e6b1[_0x3766ce]['toString']();if(manager[_0x6fe0('0x59')](_0x1c2c2a)){manager[_0x6fe0('0x3c')](_0x1c2c2a);manager[_0x6fe0('0x5a')](_0x1c2c2a);logger[_0x6fe0('0xe')]('delete\x20cron',_0x1c2c2a);}}logger[_0x6fe0('0xe')](_0x6fe0('0x5b'),JSON[_0x6fe0('0x26')](_0x4f9627));for(_0x3766ce=0x0;_0x3766ce<_0x4f9627[_0x6fe0('0x58')];_0x3766ce+=0x1){_0x1c2c2a=_0x4f9627[_0x3766ce][_0x6fe0('0x56')]();if(_0x50801e){logger[_0x6fe0('0xe')](JSON['stringify'](_0x375f89[_0x1c2c2a]));BPromise[_0x6fe0('0x5c')]()[_0x6fe0('0xb')](handleJob(_0x375f89[_0x1c2c2a]));logger[_0x6fe0('0xe')](_0x6fe0('0x5d'),_0x375f89[_0x1c2c2a][_0x6fe0('0x18')],_0x375f89[_0x1c2c2a]['cron']);}else if(_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]&&_0x375f89[_0x1c2c2a][_0x6fe0('0x5f')]&&moment()[_0x6fe0('0x60')](_0x375f89[_0x1c2c2a][_0x6fe0('0x61')],_0x375f89[_0x1c2c2a][_0x6fe0('0x62')])){manager[_0x6fe0('0x63')](_0x1c2c2a,_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')],handleJob(_0x375f89[_0x1c2c2a]));manager[_0x6fe0('0x64')](_0x1c2c2a);logger['info'](_0x6fe0('0x65'),_0x375f89[_0x1c2c2a][_0x6fe0('0x18')],_0x375f89[_0x1c2c2a]['cron']);}else if(manager['exists'](_0x1c2c2a)){manager['stop'](_0x1c2c2a);manager['deleteJob'](_0x1c2c2a);logger[_0x6fe0('0xe')](_0x6fe0('0x66'),_0x375f89[_0x1c2c2a][_0x6fe0('0x18')],_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]);}}for(_0x3766ce=0x0,_0x1c2c2a;_0x3766ce<_0x48967a['length']&&!_0x50801e;_0x3766ce+=0x1){_0x1c2c2a=_0x48967a[_0x3766ce][_0x6fe0('0x56')]();if(manager[_0x6fe0('0x59')](_0x1c2c2a)){if(_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]&&_0x375f89[_0x1c2c2a]['active']&&moment()[_0x6fe0('0x60')](_0x375f89[_0x1c2c2a][_0x6fe0('0x61')],_0x375f89[_0x1c2c2a][_0x6fe0('0x62')])){manager[_0x6fe0('0x67')](_0x1c2c2a,_0x375f89[_0x1c2c2a]['cron'],handleJob(_0x375f89[_0x1c2c2a]));logger[_0x6fe0('0xe')](_0x6fe0('0x68'),_0x375f89[_0x1c2c2a]['name'],_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]);}else{manager[_0x6fe0('0x3c')](_0x1c2c2a);manager[_0x6fe0('0x5a')](_0x1c2c2a);logger[_0x6fe0('0xe')]('stop\x20cron',_0x375f89[_0x1c2c2a][_0x6fe0('0x18')],_0x375f89[_0x1c2c2a][_0x6fe0('0x5e')]);}}}})[_0x6fe0('0xc')](function(_0x4994c1){logger['error'](JSON[_0x6fe0('0x26')](_0x4994c1));});}exports[_0x6fe0('0x69')]=function(_0x182a22){return getJobs(_0x182a22);};exports[_0x6fe0('0x64')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x68b1=['retries','job','data','operation','stop','retry','still\x20loading','case\x20empty','case\x20failed','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','jobs','toString','keyBy','length','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','exists','update\x20cron','stop\x20cron','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','findOne','then','catch','error','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','%s.%s','basename','zip','join','existsSync','status','Sent','message','attachments','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','text','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x68b1,0xff));var _0x168b=function(_0x11f9ac,_0xcb2915){_0x11f9ac=_0x11f9ac-0x0;var _0x269817=_0x68b1[_0x11f9ac];return _0x269817;};'use strict';var fs=require('fs');var util=require(_0x168b('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x168b('0x1'));var CronJobManager=require(_0x168b('0x2'));var jayson=require(_0x168b('0x3'));var BPromise=require(_0x168b('0x4'));var logger=require(_0x168b('0x5'))(_0x168b('0x6'));var db=require(_0x168b('0x7'))['db'];const retry=require('retry');var analyticCustomReportController=require(_0x168b('0x8'));var analyticDefaultReportController=require(_0x168b('0x9'));var client=jayson['client'][_0x168b('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x5120c8){const _0x2bbb10={};if(typeof _0x5120c8===_0x168b('0xb')){_0x2bbb10['id']=_0x5120c8;}return db['AnalyticExtractedReport'][_0x168b('0xc')]({'where':_0x2bbb10})[_0x168b('0xd')](function(_0x21a698){return _0x21a698;})[_0x168b('0xe')](function(_0x5c748e){logger[_0x168b('0xf')](_0x5c748e);});}function handleSendEmail(_0xeaa6b6,_0x51bca2){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0xeaa6b6[_0x168b('0x10')]);var _0x557dff=!![];var _0x1bf216=_0xeaa6b6[_0x168b('0x11')][_0x168b('0x12')]();var _0xb2c33f={'account':_0x1bf216,'message':{'from':util['format'](_0x168b('0x13'),_0xeaa6b6['MailAccount'][_0x168b('0x14')],_0xeaa6b6['MailAccount'][_0x168b('0x10')]||_0xeaa6b6[_0x168b('0x11')][_0x168b('0x15')][_0x168b('0x16')]),'to':_0xeaa6b6[_0x168b('0x10')],'cc':_0xeaa6b6['cc'],'bcc':_0xeaa6b6[_0x168b('0x17')],'subject':util[_0x168b('0x18')](_0x168b('0x19'),_0x51bca2[_0x168b('0x14')],_0xeaa6b6[_0x168b('0x1a')],_0xeaa6b6[_0x168b('0x1b')])}};var _0x379605=path['join'](__dirname,'../../files/reports');var _0x35d76f=_0x51bca2[_0x168b('0x1c')];var _0x415e63=util[_0x168b('0x18')](_0x168b('0x1d'),path[_0x168b('0x1e')](_0x51bca2['savename'],path['extname'](_0x51bca2[_0x168b('0x1c')])),_0x168b('0x1f'));var _0x2f5c26=path[_0x168b('0x20')](_0x379605,_0x35d76f);var _0x47c0ca=path['join'](_0x379605,_0x415e63);if(fs[_0x168b('0x21')](_0x2f5c26)){_0x51bca2[_0x168b('0x22')]=_0x168b('0x23');_0xb2c33f[_0x168b('0x24')][_0x168b('0x25')]=[{'filename':_0x35d76f,'path':_0x2f5c26}];_0xb2c33f[_0x168b('0x24')]['text']=util[_0x168b('0x18')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x168b('0x26')](_0x51bca2,null,0x2));}else if(fs[_0x168b('0x21')](_0x47c0ca)){_0x51bca2['status']=_0x168b('0x23');_0xb2c33f[_0x168b('0x24')][_0x168b('0x25')]=[{'filename':_0x415e63,'path':_0x47c0ca}];}else{if(_0x51bca2[_0x168b('0x22')]==='Empty'){_0xb2c33f['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xeaa6b6[_0x168b('0x27')]){_0x557dff=![];logger[_0x168b('0x28')](_0x168b('0x29'));}}else if(_0x51bca2[_0x168b('0x22')]==='Loading'){_0xb2c33f[_0x168b('0x24')][_0x168b('0x2a')]=_0x168b('0x2b');}else if(_0x51bca2[_0x168b('0x22')]===_0x168b('0x2c')){_0xb2c33f['message'][_0x168b('0x2a')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x51bca2[_0x168b('0x22')]==='Failed'){_0xb2c33f[_0x168b('0x24')][_0x168b('0x2a')]=_0x168b('0x2d');}else{logger[_0x168b('0xf')](_0x168b('0x2e'),_0x51bca2[_0x168b('0x22')]);}}if(_0x557dff){return client[_0x168b('0x2f')](_0x168b('0x30'),_0xb2c33f)['then'](function(_0x587ee0){if(_0x587ee0[_0x168b('0xf')]){return logger[_0x168b('0xf')](_0x168b('0x31'),JSON['stringify'](_0x587ee0));}return logger[_0x168b('0x28')](_0x168b('0x32'));})['catch'](function(_0x5d61ea){return logger[_0x168b('0xf')]('error\x20mail',JSON[_0x168b('0x26')](_0x5d61ea));});}}function handleError(){return function(_0x495894){return logger[_0x168b('0xf')](JSON[_0x168b('0x26')](_0x495894));};}function loading(_0x4c6f0a){logger[_0x168b('0x28')](_0x168b('0x33'));if(_0x4c6f0a[_0x168b('0x34')]===_0x4c6f0a[_0x168b('0x35')][_0x168b('0x36')]){handleSendEmail(_0x4c6f0a[_0x168b('0x37')],_0x4c6f0a[_0x168b('0x38')]);_0x4c6f0a[_0x168b('0x39')][_0x168b('0x3a')]();}else{_0x4c6f0a['operation'][_0x168b('0x3b')](_0x168b('0x3c'));}}function completed(_0x16e92b){logger[_0x168b('0x28')]('case\x20completed');handleSendEmail(_0x16e92b['job'],_0x16e92b[_0x168b('0x38')]);_0x16e92b[_0x168b('0x39')]['stop']();}function empty(_0x1829f1){logger[_0x168b('0x28')](_0x168b('0x3d'));handleSendEmail(_0x1829f1[_0x168b('0x37')],_0x1829f1['data']);_0x1829f1[_0x168b('0x39')]['stop']();}function failed(_0x116e3a){logger[_0x168b('0x28')](_0x168b('0x3e'));handleSendEmail(_0x116e3a[_0x168b('0x37')],_0x116e3a[_0x168b('0x38')]);_0x116e3a[_0x168b('0x39')]['stop']();}function urecognized(_0x4d2a33){logger['error']('Unrecognized\x20status:',_0x4d2a33[_0x168b('0x3f')][_0x168b('0x40')]['status']);_0x4d2a33[_0x168b('0x39')][_0x168b('0x3a')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5e74e5,_0x11c2f5){const _0x587385={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x94dd3e=retry[_0x168b('0x39')](_0x587385);_0x94dd3e['attempt'](_0xaae1af=>{logger['info'](_0x168b('0x41')+_0x5e74e5['id']+_0x168b('0x42')+_0xaae1af);try{getReportData(_0x11c2f5['id'])[_0x168b('0xd')](function(_0x2e68ae){_0x11c2f5=_0x2e68ae;logger[_0x168b('0x28')](_0x168b('0x43'),_0x2e68ae[_0x168b('0x40')][_0x168b('0x22')]);if(!reportStatusStrategies[_0x2e68ae[_0x168b('0x40')][_0x168b('0x22')]]){logger[_0x168b('0xf')](_0x168b('0x43'),_0x2e68ae[_0x168b('0x40')][_0x168b('0x22')]);_0x94dd3e['retry']();}reportStatusStrategies[_0x2e68ae[_0x168b('0x40')]['status']]({'operation':_0x94dd3e,'currentAttempt':_0xaae1af,'retryOptions':_0x587385,'job':_0x5e74e5,'data':_0x11c2f5,'entity':_0x2e68ae});});}catch(_0x206d09){_0x94dd3e[_0x168b('0x3b')](_0x206d09);}});}function handleResult(_0x5ac745){return function(_0x3236d9){if(_0x5ac745[_0x168b('0x44')]&&_0x5ac745['MailAccount']&&_0x5ac745[_0x168b('0x11')][_0x168b('0x15')]&&!_['isNil'](_0x5ac745['email'])){retryer(_0x5ac745,_0x3236d9);}};}function handleJob(_0x1d8892){return function(){try{if(_[_0x168b('0x45')](_0x1d8892[_0x168b('0x1a')])){return logger[_0x168b('0x28')](_0x168b('0x46'));}if(_[_0x168b('0x45')](_0x1d8892[_0x168b('0x1b')])){return logger[_0x168b('0x28')](_0x168b('0x47'));}var _0x259c81={'startDate':moment()[_0x168b('0x48')](_0x1d8892[_0x168b('0x1a')],_0x1d8892[_0x168b('0x1b')])[_0x168b('0x18')](_0x168b('0x49')),'endDate':moment()[_0x168b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x1d8892[_0x168b('0x4a')],'name':_0x1d8892['name']};if(!_[_0x168b('0x45')](_0x1d8892[_0x168b('0x4b')])){logger[_0x168b('0x28')](_0x168b('0x4c'),_0x1d8892[_0x168b('0x4b')]);return analyticDefaultReportController[_0x168b('0x4d')]({'id':_0x1d8892[_0x168b('0x4b')]},_0x259c81)['then'](handleResult(_0x1d8892))['catch'](handleError());}if(!_[_0x168b('0x45')](_0x1d8892[_0x168b('0x4e')])){logger[_0x168b('0x28')](_0x168b('0x4f'),_0x1d8892[_0x168b('0x4e')]);return analyticCustomReportController[_0x168b('0x4d')]({'id':_0x1d8892[_0x168b('0x4e')]},_0x259c81)[_0x168b('0xd')](handleResult(_0x1d8892))[_0x168b('0xe')](handleError());}}catch(_0x43c13f){logger['error'](JSON['stringify'](_0x43c13f));}return logger['info'](_0x168b('0x50'));};}function getJobs(_0x277584){var _0x38ca6e={};if(_0x277584){_0x38ca6e['id']=_0x277584;}return db[_0x168b('0x51')][_0x168b('0x52')]({'where':_0x38ca6e,'include':[{'model':db[_0x168b('0x11')],'attributes':['id',_0x168b('0x14'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x168b('0x15'),'include':[{'model':db[_0x168b('0x53')],'as':_0x168b('0x53')}]}]}]})[_0x168b('0xd')](function(_0x4fa089){var _0x37e034=_['keys'](manager[_0x168b('0x54')]);var _0x39ef32=_['map'](_0x4fa089,function(_0x15916f){return _0x15916f['id'][_0x168b('0x55')]();});var _0x2704aa=_[_0x168b('0x56')](_0x4fa089,function(_0x1f015c){return _0x1f015c['id'][_0x168b('0x55')]();});var _0x34cf5d=_0x277584?_0x39ef32:_['difference'](_0x39ef32,_0x37e034);var _0x22dd95=_['intersection'](_0x39ef32,_0x37e034);var _0x76aec3=_['difference'](_0x37e034,_0x39ef32);var _0x5c8053;var _0x1a98fb;for(_0x5c8053=0x0;_0x5c8053<_0x76aec3[_0x168b('0x57')]&&!_0x277584;_0x5c8053+=0x1){_0x1a98fb=_0x76aec3[_0x5c8053]['toString']();if(manager['exists'](_0x1a98fb)){manager[_0x168b('0x3a')](_0x1a98fb);manager[_0x168b('0x58')](_0x1a98fb);logger[_0x168b('0x28')](_0x168b('0x59'),_0x1a98fb);}}logger[_0x168b('0x28')](_0x168b('0x5a'),JSON[_0x168b('0x26')](_0x34cf5d));for(_0x5c8053=0x0;_0x5c8053<_0x34cf5d[_0x168b('0x57')];_0x5c8053+=0x1){_0x1a98fb=_0x34cf5d[_0x5c8053][_0x168b('0x55')]();if(_0x277584){logger[_0x168b('0x28')](JSON[_0x168b('0x26')](_0x2704aa[_0x1a98fb]));BPromise[_0x168b('0x5b')]()[_0x168b('0xd')](handleJob(_0x2704aa[_0x1a98fb]));logger[_0x168b('0x28')](_0x168b('0x5c'),_0x2704aa[_0x1a98fb][_0x168b('0x14')],_0x2704aa[_0x1a98fb]['cron']);}else if(_0x2704aa[_0x1a98fb][_0x168b('0x5d')]&&_0x2704aa[_0x1a98fb][_0x168b('0x5e')]&&moment()[_0x168b('0x5f')](_0x2704aa[_0x1a98fb][_0x168b('0x60')],_0x2704aa[_0x1a98fb][_0x168b('0x61')])){manager['add'](_0x1a98fb,_0x2704aa[_0x1a98fb][_0x168b('0x5d')],handleJob(_0x2704aa[_0x1a98fb]));manager[_0x168b('0x62')](_0x1a98fb);logger[_0x168b('0x28')](_0x168b('0x63'),_0x2704aa[_0x1a98fb][_0x168b('0x14')],_0x2704aa[_0x1a98fb][_0x168b('0x5d')]);}else if(manager['exists'](_0x1a98fb)){manager[_0x168b('0x3a')](_0x1a98fb);manager['deleteJob'](_0x1a98fb);logger[_0x168b('0x28')]('stop\x20cron',_0x2704aa[_0x1a98fb][_0x168b('0x14')],_0x2704aa[_0x1a98fb][_0x168b('0x5d')]);}}for(_0x5c8053=0x0,_0x1a98fb;_0x5c8053<_0x22dd95[_0x168b('0x57')]&&!_0x277584;_0x5c8053+=0x1){_0x1a98fb=_0x22dd95[_0x5c8053][_0x168b('0x55')]();if(manager[_0x168b('0x64')](_0x1a98fb)){if(_0x2704aa[_0x1a98fb]['cron']&&_0x2704aa[_0x1a98fb][_0x168b('0x5e')]&&moment()['isBetween'](_0x2704aa[_0x1a98fb][_0x168b('0x60')],_0x2704aa[_0x1a98fb][_0x168b('0x61')])){manager['update'](_0x1a98fb,_0x2704aa[_0x1a98fb][_0x168b('0x5d')],handleJob(_0x2704aa[_0x1a98fb]));logger['info'](_0x168b('0x65'),_0x2704aa[_0x1a98fb][_0x168b('0x14')],_0x2704aa[_0x1a98fb][_0x168b('0x5d')]);}else{manager[_0x168b('0x3a')](_0x1a98fb);manager[_0x168b('0x58')](_0x1a98fb);logger[_0x168b('0x28')](_0x168b('0x66'),_0x2704aa[_0x1a98fb]['name'],_0x2704aa[_0x1a98fb][_0x168b('0x5d')]);}}}})[_0x168b('0xe')](function(_0x46de7a){logger[_0x168b('0xf')](JSON[_0x168b('0x26')](_0x46de7a));});}exports['run']=function(_0x2d5e5f){return getJobs(_0x2d5e5f);};exports[_0x168b('0x62')]=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 5be85f7..1f9c171 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 _0x500c=['update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','SentimentScore','Positive','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length'];(function(_0xc177,_0x5bac47){var _0x1ad055=function(_0x4da002){while(--_0x4da002){_0xc177['push'](_0xc177['shift']());}};_0x1ad055(++_0x5bac47);}(_0x500c,0x188));var _0xc500=function(_0x297373,_0x25366e){_0x297373=_0x297373-0x0;var _0x580df8=_0x500c[_0x297373];return _0x580df8;};var _=require(_0xc500('0x0'));var AWS=require(_0xc500('0x1'));var rp=require(_0xc500('0x2'));var util=require(_0xc500('0x3'));var BPromise=require(_0xc500('0x4'));var db=require(_0xc500('0x5'))['db'];var logger=require(_0xc500('0x6'))(_0xc500('0x7'));function getTranscriptionJob(_0xf06e0f,_0x1107bb,_0x81acf6,_0x37ae10){return new Promise(function(_0x39a572,_0x1390ec){var _0x3bc410=new AWS['TranscribeService']({'accessKeyId':_0x1107bb,'secretAccessKey':_0xf06e0f,'region':_0x81acf6});_0x3bc410[_0xc500('0x8')]({'TranscriptionJobName':_0x37ae10},function(_0x480a10,_0x3cf7f9){if(_0x480a10){return _0x1390ec(_0x480a10);}else{return _0x39a572(_0x3cf7f9);}});});}function sentiment(_0x3312f6,_0x2982e7,_0x3b40f2,_0x198a32,_0x311826){return new Promise(function(_0x47b778,_0x3a35af){var _0x58887b=new AWS[(_0xc500('0x9'))]({'accessKeyId':_0x2982e7,'secretAccessKey':_0x3312f6,'region':_0x3b40f2});_0x58887b['detectSentiment']({'Text':_0x198a32,'LanguageCode':_0x311826['substring'](0x0,0x2)},function(_0xea3f01,_0x1edbae){if(_0xea3f01){return _0x3a35af(_0xea3f01);}else{return _0x47b778(_0x1edbae);}});});}function checkTranscribeJob(_0x597624,_0x45331c,_0x3274ba){var _0x3221b7;return new BPromise(function(_0x1c6fdc,_0x4513b9){logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0xc'),_0x597624['id'],_0x597624['transcribeName']));return getTranscriptionJob(_0x3274ba[_0xc500('0xd')],_0x3274ba[_0xc500('0xe')],_0x45331c['transcribeRegion'],_0x597624[_0xc500('0xf')])[_0xc500('0x10')](function(_0x387d54){logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x11'),_0x597624['id'],_0x597624[_0xc500('0xf')],_0x387d54['TranscriptionJob'][_0xc500('0x12')]));if(!_0x597624[_0xc500('0x13')]){switch(_0x387d54[_0xc500('0x14')][_0xc500('0x12')]){case _0xc500('0x15'):var _0xa2388d={'transcribeStatus':_0x387d54[_0xc500('0x14')]['TranscriptionJobStatus'],'fileUri':_0x387d54['TranscriptionJob']['Transcript'][_0xc500('0x16')]};logger['info'](util[_0xc500('0xb')](_0xc500('0x17'),_0x597624['id']));return rp({'uri':_0x387d54['TranscriptionJob'][_0xc500('0x18')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x1b5a19){logger['info'](util[_0xc500('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x597624['id']));if(_0x1b5a19&&_0x1b5a19['results']&&_0x1b5a19[_0xc500('0x19')][_0xc500('0x1a')]&&_0x1b5a19[_0xc500('0x19')][_0xc500('0x1a')][_0xc500('0x1b')]){_0xa2388d[_0xc500('0x13')]='';for(var _0x15540a=0x0;_0x15540a<_0x1b5a19[_0xc500('0x19')][_0xc500('0x1a')][_0xc500('0x1b')];_0x15540a++){_0xa2388d[_0xc500('0x13')]+=_0x1b5a19[_0xc500('0x19')][_0xc500('0x1a')][_0x15540a]['transcript']+'';}}return _0x597624[_0xc500('0x1c')](_0xa2388d);})['then'](function(){logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x1d'),_0x597624['id']));if(!_0x597624[_0xc500('0x1e')]){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x45331c[_0xc500('0x21')]||!_0x45331c[_0xc500('0x22')]||!_0x45331c[_0xc500('0x23')]||!_0x45331c[_0xc500('0x24')]||!_0x45331c['bucket']){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x25'));}if(!_0xa2388d[_0xc500('0x13')]){throw new Error(_0xc500('0x26'));}if(_0x45331c[_0xc500('0x22')]===_0x3274ba['id']){return _0x3274ba;}else{return db[_0xc500('0x27')][_0xc500('0x28')]({'where':{'id':_settings[_0xc500('0x22')]}});}})[_0xc500('0x10')](function(_0x36f35c){if(!_0x36f35c){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x29'));}if(!_0x36f35c[_0xc500('0xd')]||!_0x36f35c[_0xc500('0xe')]){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x2a'));}_0x3221b7=_0x36f35c;logger['info'](util[_0xc500('0xb')](_0xc500('0x2b'),_0x597624['id']));return sentiment(_0x3221b7[_0xc500('0xd')],_0x3221b7[_0xc500('0xe')],_0x45331c['sentimentRegion'],_0xa2388d[_0xc500('0x13')],_0x45331c['language']);})[_0xc500('0x10')](function(_0x2435d7){logger[_0xc500('0xa')](util[_0xc500('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x597624['id']));return _0x597624[_0xc500('0x1c')]({'sentiment':_0x2435d7['Sentiment'],'sPositive':_0x2435d7[_0xc500('0x2c')][_0xc500('0x2d')],'sNegative':_0x2435d7['SentimentScore'][_0xc500('0x2e')],'sMixed':_0x2435d7[_0xc500('0x2c')]['Mixed'],'sNeutral':_0x2435d7[_0xc500('0x2c')][_0xc500('0x2f')]});})['then'](function(){logger[_0xc500('0xa')](util[_0xc500('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x597624['id']));_0x1c6fdc();});case _0xc500('0x30'):return _0x597624[_0xc500('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x387d54[_0xc500('0x14')]['FailureReason']})[_0xc500('0x10')](function(){logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x1d'),_0x597624['id']));_0x1c6fdc();});default:logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x31'),_0x597624['id']));break;}}else{return BPromise[_0xc500('0x32')]()['then'](function(){if(!_0x597624[_0xc500('0x1e')]){throw new db['Sequelize']['ValidationError'](_0xc500('0x33'));}if(!_0x45331c[_0xc500('0x21')]||!_0x45331c['sentimentAccountId']||!_0x45331c['sentimentRegion']||!_0x45331c[_0xc500('0x24')]||!_0x45331c[_0xc500('0x34')]){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x25'));}if(!_0x597624[_0xc500('0x13')]){throw new Error(_0xc500('0x26'));}if(_0x45331c[_0xc500('0x22')]===_0x3274ba['id']){return _0x3274ba;}else{return db[_0xc500('0x27')][_0xc500('0x28')]({'where':{'id':_settings[_0xc500('0x22')]}});}})[_0xc500('0x10')](function(_0x415f0f){if(!_0x415f0f){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x415f0f['data1']||!_0x415f0f[_0xc500('0xe')]){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x2a'));}_0x3221b7=_0x415f0f;logger[_0xc500('0xa')](util[_0xc500('0xb')](_0xc500('0x2b'),_0x597624['id']));return sentiment(_0x3221b7[_0xc500('0xd')],_0x3221b7[_0xc500('0xe')],_0x45331c[_0xc500('0x23')],_0x597624['fileText'],_0x45331c[_0xc500('0x24')]);})[_0xc500('0x10')](function(_0x8c5177){logger['info'](util['format'](_0xc500('0x35'),_0x597624['id']));return _0x597624[_0xc500('0x1c')]({'sentiment':_0x8c5177['Sentiment'],'sPositive':_0x8c5177[_0xc500('0x2c')][_0xc500('0x2d')],'sNegative':_0x8c5177[_0xc500('0x2c')]['Negative'],'sMixed':_0x8c5177['SentimentScore'][_0xc500('0x36')],'sNeutral':_0x8c5177[_0xc500('0x2c')][_0xc500('0x2f')],'transcribeStatus':_0xc500('0x15')});})[_0xc500('0x10')](function(){logger['info'](util[_0xc500('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x597624['id']));_0x1c6fdc();});}})[_0xc500('0x37')](function(_0x52b27a){if(_0x52b27a){if(!_0x52b27a[_0xc500('0x38')]||_0x52b27a[_0xc500('0x38')]!==_0xc500('0x39')){logger[_0xc500('0x3a')](util[_0xc500('0xb')](_0xc500('0x3b'),_0x597624['id']),util[_0xc500('0x3c')](_0x52b27a,{'showHidden':![],'depth':null}));}}_0x1c6fdc();});});}function checkTranscribe(){var _0x3a2cd8;var _0x3d8ecc;var _0x39f065;return db['VoiceRecording'][_0xc500('0x3d')]({'where':{'transcribeStatus':_0xc500('0x3e')}})['then'](function(_0x15c427){if(!_0x15c427||!_0x15c427['length']){throw new db['Sequelize'][(_0xc500('0x20'))](_0xc500('0x3f'));}_0x3a2cd8=_0x15c427;return db[_0xc500('0x40')]['findOne']({'where':{'id':0x1}});})[_0xc500('0x10')](function(_0x1a7df9){if(!_0x1a7df9){throw new db[(_0xc500('0x1f'))]['ValidationError']('Settings\x20not\x20available');}_0x3d8ecc=_0x1a7df9;if(!_0x3d8ecc[_0xc500('0x7')]||!_0x3d8ecc[_0xc500('0x41')]||!_0x3d8ecc[_0xc500('0x42')]||!_0x3d8ecc[_0xc500('0x24')]||!_0x3d8ecc['bucket']){throw new db[(_0xc500('0x1f'))][(_0xc500('0x20'))](_0xc500('0x43'));}return db[_0xc500('0x27')]['findOne']({'where':{'id':_0x3d8ecc[_0xc500('0x41')]}});})[_0xc500('0x10')](function(_0x33f746){if(!_0x33f746){throw new db[(_0xc500('0x1f'))]['ValidationError'](_0xc500('0x29'));}if(!_0x33f746[_0xc500('0xd')]||!_0x33f746[_0xc500('0xe')]){throw new db['Sequelize'][(_0xc500('0x20'))](_0xc500('0x2a'));}_0x39f065=_0x33f746;var _0x9fb2e0=[];_0x3a2cd8[_0xc500('0x44')](function(_0x2d5bf9){_0x9fb2e0[_0xc500('0x45')](checkTranscribeJob(_0x2d5bf9,_0x3d8ecc,_0x39f065));});return BPromise['all'](_0x9fb2e0);})[_0xc500('0x37')](function(_0x242109){if(_0x242109){if(!_0x242109[_0xc500('0x38')]||_0x242109[_0xc500('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0xc500('0x3c')](_0x242109,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8533=['SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x8533,0x141));var _0x3853=function(_0x5eaef0,_0x14201a){_0x5eaef0=_0x5eaef0-0x0;var _0x9bc773=_0x8533[_0x5eaef0];return _0x9bc773;};var _=require(_0x3853('0x0'));var AWS=require(_0x3853('0x1'));var rp=require(_0x3853('0x2'));var util=require('util');var BPromise=require(_0x3853('0x3'));var db=require(_0x3853('0x4'))['db'];var logger=require('../../config/logger')(_0x3853('0x5'));function getTranscriptionJob(_0x4d9944,_0x116a07,_0x4fa9de,_0x1f4e98){return new Promise(function(_0x4644ba,_0x630746){var _0x2d95dc=new AWS['TranscribeService']({'accessKeyId':_0x116a07,'secretAccessKey':_0x4d9944,'region':_0x4fa9de});_0x2d95dc[_0x3853('0x6')]({'TranscriptionJobName':_0x1f4e98},function(_0xe1273c,_0x4597d1){if(_0xe1273c){return _0x630746(_0xe1273c);}else{return _0x4644ba(_0x4597d1);}});});}function sentiment(_0x4d8bc1,_0x5cd88c,_0x153baa,_0x1bf72b,_0x291038){return new Promise(function(_0x46bfee,_0x55c43c){var _0x2243d4=new AWS[(_0x3853('0x7'))]({'accessKeyId':_0x5cd88c,'secretAccessKey':_0x4d8bc1,'region':_0x153baa});_0x2243d4[_0x3853('0x8')]({'Text':_0x1bf72b,'LanguageCode':_0x291038[_0x3853('0x9')](0x0,0x2)},function(_0x20a3e3,_0x249273){if(_0x20a3e3){return _0x55c43c(_0x20a3e3);}else{return _0x46bfee(_0x249273);}});});}function checkTranscribeJob(_0x5d1228,_0x1ddbfe,_0x1927d8){var _0x330363;return new BPromise(function(_0x43611c,_0x5eabc7){logger[_0x3853('0xa')](util[_0x3853('0xb')](_0x3853('0xc'),_0x5d1228['id'],_0x5d1228[_0x3853('0xd')]));return getTranscriptionJob(_0x1927d8['data1'],_0x1927d8['data2'],_0x1ddbfe['transcribeRegion'],_0x5d1228[_0x3853('0xd')])[_0x3853('0xe')](function(_0x378431){logger[_0x3853('0xa')](util[_0x3853('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5d1228['id'],_0x5d1228[_0x3853('0xd')],_0x378431['TranscriptionJob'][_0x3853('0xf')]));if(!_0x5d1228[_0x3853('0x10')]){switch(_0x378431[_0x3853('0x11')][_0x3853('0xf')]){case _0x3853('0x12'):var _0x454e76={'transcribeStatus':_0x378431['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x378431[_0x3853('0x11')]['Transcript'][_0x3853('0x13')]};logger[_0x3853('0xa')](util['format'](_0x3853('0x14'),_0x5d1228['id']));return rp({'uri':_0x378431[_0x3853('0x11')][_0x3853('0x15')][_0x3853('0x13')],'json':!![]})[_0x3853('0xe')](function(_0x54252e){logger[_0x3853('0xa')](util[_0x3853('0xb')](_0x3853('0x16'),_0x5d1228['id']));if(_0x54252e&&_0x54252e[_0x3853('0x17')]&&_0x54252e[_0x3853('0x17')][_0x3853('0x18')]&&_0x54252e[_0x3853('0x17')]['transcripts'][_0x3853('0x19')]){_0x454e76['fileText']='';for(var _0x3cdbab=0x0;_0x3cdbab<_0x54252e['results']['transcripts'][_0x3853('0x19')];_0x3cdbab++){_0x454e76[_0x3853('0x10')]+=_0x54252e[_0x3853('0x17')][_0x3853('0x18')][_0x3cdbab][_0x3853('0x1a')]+'';}}return _0x5d1228['update'](_0x454e76);})[_0x3853('0xe')](function(){logger[_0x3853('0xa')](util['format'](_0x3853('0x1b'),_0x5d1228['id']));if(!_0x5d1228['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x3853('0x1c'));}if(!_0x1ddbfe[_0x3853('0x1d')]||!_0x1ddbfe[_0x3853('0x1e')]||!_0x1ddbfe['sentimentRegion']||!_0x1ddbfe[_0x3853('0x1f')]||!_0x1ddbfe[_0x3853('0x20')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x454e76[_0x3853('0x10')]){throw new Error(_0x3853('0x21'));}if(_0x1ddbfe[_0x3853('0x1e')]===_0x1927d8['id']){return _0x1927d8;}else{return db[_0x3853('0x22')][_0x3853('0x23')]({'where':{'id':_settings[_0x3853('0x1e')]}});}})[_0x3853('0xe')](function(_0x2bee7b){if(!_0x2bee7b){throw new db['Sequelize'][(_0x3853('0x24'))](_0x3853('0x25'));}if(!_0x2bee7b['data1']||!_0x2bee7b[_0x3853('0x26')]){throw new db['Sequelize'][(_0x3853('0x24'))](_0x3853('0x27'));}_0x330363=_0x2bee7b;logger[_0x3853('0xa')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5d1228['id']));return sentiment(_0x330363[_0x3853('0x28')],_0x330363['data2'],_0x1ddbfe[_0x3853('0x29')],_0x454e76[_0x3853('0x10')],_0x1ddbfe[_0x3853('0x1f')]);})[_0x3853('0xe')](function(_0x5ebb4e){logger[_0x3853('0xa')](util[_0x3853('0xb')](_0x3853('0x2a'),_0x5d1228['id']));return _0x5d1228[_0x3853('0x2b')]({'sentiment':_0x5ebb4e[_0x3853('0x2c')],'sPositive':_0x5ebb4e[_0x3853('0x2d')]['Positive'],'sNegative':_0x5ebb4e[_0x3853('0x2d')][_0x3853('0x2e')],'sMixed':_0x5ebb4e[_0x3853('0x2d')]['Mixed'],'sNeutral':_0x5ebb4e[_0x3853('0x2d')][_0x3853('0x2f')]});})['then'](function(){logger[_0x3853('0xa')](util[_0x3853('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5d1228['id']));_0x43611c();});case _0x3853('0x30'):return _0x5d1228[_0x3853('0x2b')]({'transcribeStatus':_0x3853('0x30'),'failureReason':_0x378431[_0x3853('0x11')][_0x3853('0x31')]})[_0x3853('0xe')](function(){logger[_0x3853('0xa')](util['format'](_0x3853('0x1b'),_0x5d1228['id']));_0x43611c();});default:logger[_0x3853('0xa')](util['format'](_0x3853('0x32'),_0x5d1228['id']));break;}}else{return BPromise[_0x3853('0x33')]()[_0x3853('0xe')](function(){if(!_0x5d1228[_0x3853('0x34')]){throw new db[(_0x3853('0x35'))]['ValidationError'](_0x3853('0x1c'));}if(!_0x1ddbfe[_0x3853('0x1d')]||!_0x1ddbfe[_0x3853('0x1e')]||!_0x1ddbfe[_0x3853('0x29')]||!_0x1ddbfe[_0x3853('0x1f')]||!_0x1ddbfe[_0x3853('0x20')]){throw new db['Sequelize'][(_0x3853('0x24'))](_0x3853('0x36'));}if(!_0x5d1228[_0x3853('0x10')]){throw new Error('Transcript\x20not\x20available');}if(_0x1ddbfe[_0x3853('0x1e')]===_0x1927d8['id']){return _0x1927d8;}else{return db[_0x3853('0x22')][_0x3853('0x23')]({'where':{'id':_settings[_0x3853('0x1e')]}});}})[_0x3853('0xe')](function(_0x5a1d18){if(!_0x5a1d18){throw new db[(_0x3853('0x35'))][(_0x3853('0x24'))](_0x3853('0x25'));}if(!_0x5a1d18[_0x3853('0x28')]||!_0x5a1d18['data2']){throw new db[(_0x3853('0x35'))][(_0x3853('0x24'))](_0x3853('0x27'));}_0x330363=_0x5a1d18;logger[_0x3853('0xa')](util[_0x3853('0xb')](_0x3853('0x37'),_0x5d1228['id']));return sentiment(_0x330363[_0x3853('0x28')],_0x330363[_0x3853('0x26')],_0x1ddbfe[_0x3853('0x29')],_0x5d1228[_0x3853('0x10')],_0x1ddbfe[_0x3853('0x1f')]);})['then'](function(_0xea2e6c){logger[_0x3853('0xa')](util[_0x3853('0xb')](_0x3853('0x2a'),_0x5d1228['id']));return _0x5d1228['update']({'sentiment':_0xea2e6c['Sentiment'],'sPositive':_0xea2e6c[_0x3853('0x2d')][_0x3853('0x38')],'sNegative':_0xea2e6c[_0x3853('0x2d')][_0x3853('0x2e')],'sMixed':_0xea2e6c['SentimentScore']['Mixed'],'sNeutral':_0xea2e6c[_0x3853('0x2d')][_0x3853('0x2f')],'transcribeStatus':'COMPLETED'});})[_0x3853('0xe')](function(){logger[_0x3853('0xa')](util[_0x3853('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5d1228['id']));_0x43611c();});}})[_0x3853('0x39')](function(_0x531e9e){if(_0x531e9e){if(!_0x531e9e[_0x3853('0x3a')]||_0x531e9e[_0x3853('0x3a')]!==_0x3853('0x3b')){logger[_0x3853('0x3c')](util[_0x3853('0xb')](_0x3853('0x3d'),_0x5d1228['id']),util[_0x3853('0x3e')](_0x531e9e,{'showHidden':![],'depth':null}));}}_0x43611c();});});}function checkTranscribe(){var _0x59a854;var _0x14c928;var _0x34db04;return db[_0x3853('0x3f')][_0x3853('0x40')]({'where':{'transcribeStatus':_0x3853('0x41')}})[_0x3853('0xe')](function(_0x2d47d3){if(!_0x2d47d3||!_0x2d47d3['length']){throw new db[(_0x3853('0x35'))][(_0x3853('0x24'))](_0x3853('0x42'));}_0x59a854=_0x2d47d3;return db[_0x3853('0x43')][_0x3853('0x23')]({'where':{'id':0x1}});})['then'](function(_0x2e8ad0){if(!_0x2e8ad0){throw new db['Sequelize'][(_0x3853('0x24'))](_0x3853('0x44'));}_0x14c928=_0x2e8ad0;if(!_0x14c928[_0x3853('0x5')]||!_0x14c928[_0x3853('0x45')]||!_0x14c928[_0x3853('0x46')]||!_0x14c928[_0x3853('0x1f')]||!_0x14c928[_0x3853('0x20')]){throw new db[(_0x3853('0x35'))][(_0x3853('0x24'))](_0x3853('0x47'));}return db[_0x3853('0x22')][_0x3853('0x23')]({'where':{'id':_0x14c928[_0x3853('0x45')]}});})[_0x3853('0xe')](function(_0x2dc19f){if(!_0x2dc19f){throw new db['Sequelize']['ValidationError'](_0x3853('0x25'));}if(!_0x2dc19f[_0x3853('0x28')]||!_0x2dc19f[_0x3853('0x26')]){throw new db[(_0x3853('0x35'))][(_0x3853('0x24'))](_0x3853('0x27'));}_0x34db04=_0x2dc19f;var _0x394aa5=[];_0x59a854[_0x3853('0x48')](function(_0x2ec836){_0x394aa5[_0x3853('0x49')](checkTranscribeJob(_0x2ec836,_0x14c928,_0x34db04));});return BPromise[_0x3853('0x4a')](_0x394aa5);})[_0x3853('0x39')](function(_0x2ab63d){if(_0x2ab63d){if(!_0x2ab63d[_0x3853('0x3a')]||_0x2ab63d[_0x3853('0x3a')]!==_0x3853('0x3b')){logger[_0x3853('0x3c')](util[_0x3853('0x3e')](_0x2ab63d,{'showHidden':![],'depth':null}));}}});}exports[_0x3853('0x4b')]=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 a21910c..04e85bd 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 _0x5b5f=['join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x428b38,_0x1dc7c2){var _0x59adf8=function(_0x4506bf){while(--_0x4506bf){_0x428b38['push'](_0x428b38['shift']());}};_0x59adf8(++_0x1dc7c2);}(_0x5b5f,0x1a7));var _0xf5b5=function(_0x5acf1d,_0x17f4d3){_0x5acf1d=_0x5acf1d-0x0;var _0x380572=_0x5b5f[_0x5acf1d];return _0x380572;};'use strict';var _=require(_0xf5b5('0x0'));var moment=require(_0xf5b5('0x1'));var Redis=require(_0xf5b5('0x2'));var util=require(_0xf5b5('0x3'));var config=require('../../config/environment');var db=require(_0xf5b5('0x4'))['db'];var logger=require(_0xf5b5('0x5'))(_0xf5b5('0x6'));config[_0xf5b5('0x7')]=_[_0xf5b5('0x8')](config[_0xf5b5('0x7')],{'host':_0xf5b5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x20eafe=[];return db[_0xf5b5('0xa')][_0xf5b5('0xb')]({'raw':!![],'attributes':['id',_0xf5b5('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf5b5('0xd')](0x18,_0xf5b5('0xe'))}}})['then'](function(_0xb5c3ad){if(_0xb5c3ad&&_0xb5c3ad[_0xf5b5('0xf')]){_0x20eafe=_[_0xf5b5('0x10')](_0xb5c3ad||[],'id');logger[_0xf5b5('0x11')](_0xf5b5('0x12'),_0x20eafe[_0xf5b5('0x13')]());return db['WhatsappInteraction'][_0xf5b5('0x14')]({'closeReason':_0xf5b5('0x15'),'disposition':_0xf5b5('0x16'),'closed':!![],'closedAt':moment()[_0xf5b5('0x17')](_0xf5b5('0x18'))},{'where':{'id':_0x20eafe}});}})[_0xf5b5('0x19')](function(){if(_0x20eafe&&_0x20eafe['length']){logger[_0xf5b5('0x11')](_0xf5b5('0x1a'),_0x20eafe[_0xf5b5('0x13')]());for(var _0x35770a=0x0;_0x35770a<_0x20eafe[_0xf5b5('0xf')];_0x35770a++){io[_0xf5b5('0x1b')](_0xf5b5('0x1c'),{'id':_0x20eafe[_0x35770a],'closed':!![]});}}})[_0xf5b5('0x1d')](function(_0x4e0b49){logger[_0xf5b5('0x1e')](_0xf5b5('0x1f'),_0x4e0b49?util[_0xf5b5('0x20')](_0x4e0b49,{'showHidden':![],'depth':null}):'');});}exports[_0xf5b5('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1aac=['moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash'];(function(_0x419ffd,_0x10bdfe){var _0xb0b19d=function(_0x335815){while(--_0x335815){_0x419ffd['push'](_0x419ffd['shift']());}};_0xb0b19d(++_0x10bdfe);}(_0x1aac,0xca));var _0xc1aa=function(_0x2a3991,_0x416bbb){_0x2a3991=_0x2a3991-0x0;var _0xa5d3e7=_0x1aac[_0x2a3991];return _0xa5d3e7;};'use strict';var _=require(_0xc1aa('0x0'));var moment=require(_0xc1aa('0x1'));var Redis=require(_0xc1aa('0x2'));var util=require(_0xc1aa('0x3'));var config=require(_0xc1aa('0x4'));var db=require(_0xc1aa('0x5'))['db'];var logger=require('../logger')(_0xc1aa('0x6'));config[_0xc1aa('0x7')]=_[_0xc1aa('0x8')](config[_0xc1aa('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xc1aa('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x4b1575=[];return db[_0xc1aa('0xa')][_0xc1aa('0xb')]({'raw':!![],'attributes':['id',_0xc1aa('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xc1aa('0xd')](function(_0x5939b4){if(_0x5939b4&&_0x5939b4[_0xc1aa('0xe')]){_0x4b1575=_[_0xc1aa('0xf')](_0x5939b4||[],'id');logger['info'](_0xc1aa('0x10'),_0x4b1575[_0xc1aa('0x11')]());return db['WhatsappInteraction'][_0xc1aa('0x12')]({'closeReason':_0xc1aa('0x13'),'disposition':_0xc1aa('0x14'),'closed':!![],'closedAt':moment()[_0xc1aa('0x15')](_0xc1aa('0x16'))},{'where':{'id':_0x4b1575}});}})[_0xc1aa('0xd')](function(){if(_0x4b1575&&_0x4b1575[_0xc1aa('0xe')]){logger[_0xc1aa('0x17')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4b1575['join']());for(var _0xd6cca4=0x0;_0xd6cca4<_0x4b1575[_0xc1aa('0xe')];_0xd6cca4++){io[_0xc1aa('0x18')](_0xc1aa('0x19'),{'id':_0x4b1575[_0xd6cca4],'closed':!![]});}}})['catch'](function(_0xcbf3d1){logger['error'](_0xc1aa('0x1a'),_0xcbf3d1?util[_0xc1aa('0x1b')](_0xcbf3d1,{'showHidden':![],'depth':null}):'');});}exports[_0xc1aa('0x1c')]=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 fdebb14..06fba73 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdd4=['finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','CmContact','destroy','bulkCreate','then','log'];(function(_0x366f97,_0x64754a){var _0x5c0c44=function(_0x35deaf){while(--_0x35deaf){_0x366f97['push'](_0x366f97['shift']());}};_0x5c0c44(++_0x64754a);}(_0xbdd4,0x138));var _0x4bdd=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xbdd4[_0x47b58b];return _0x46bebe;};'use strict';var util=require('util');var db=require(_0x4bdd('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4bdd('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4bdd('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4bdd('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4bdd('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x4bdd('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4bdd('0x1')]({'id':i,'firstName':_0x4bdd('0x5')+i,'lastName':_0x4bdd('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4bdd('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4bdd('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4bdd('0x4')](),'updatedAt':Date[_0x4bdd('0x4')]()});}db[_0x4bdd('0x6')][_0x4bdd('0x7')]({'where':{}})['then'](function(){return db[_0x4bdd('0x6')][_0x4bdd('0x8')](contacts);})[_0x4bdd('0x9')](function(){console[_0x4bdd('0xa')](_0x4bdd('0xb'),_0x4bdd('0xc'));return db[_0x4bdd('0xd')][_0x4bdd('0x7')]({'where':{}});})[_0x4bdd('0x9')](function(){return db[_0x4bdd('0xd')][_0x4bdd('0x8')](hopper);})[_0x4bdd('0x9')](function(){console['log'](_0x4bdd('0xb'),_0x4bdd('0xe'));return db['CmContact'][_0x4bdd('0x8')](contacts2);})[_0x4bdd('0x9')](function(){console[_0x4bdd('0xa')](_0x4bdd('0xb'),_0x4bdd('0xf'));return db['CmHopper'][_0x4bdd('0x8')](hopper2);})[_0x4bdd('0x9')](function(){console[_0x4bdd('0xa')](_0x4bdd('0xb'),_0x4bdd('0x10'));})['catch'](function(_0x17aa50){console[_0x4bdd('0xa')](_0x17aa50);}); \ No newline at end of file +var _0xe2b0=['finished\x20populating','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','log','contacts1','CmHopper','destroy','bulkCreate'];(function(_0x23f74f,_0x129e9c){var _0x481c26=function(_0xc2eccf){while(--_0xc2eccf){_0x23f74f['push'](_0x23f74f['shift']());}};_0x481c26(++_0x129e9c);}(_0xe2b0,0x148));var _0x0e2b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2b0[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x0e2b('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x0e2b('0x1')]({'id':i,'firstName':_0x0e2b('0x2')+i,'lastName':_0x0e2b('0x3')+i,'phone':0xf879fb460+i,'email':_0x0e2b('0x4')+i+_0x0e2b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0e2b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x0e2b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0e2b('0x6')](),'updatedAt':Date[_0x0e2b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x0e2b('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0e2b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x0e2b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0e2b('0x6')](),'updatedAt':Date[_0x0e2b('0x6')]()});}db[_0x0e2b('0x7')]['destroy']({'where':{}})[_0x0e2b('0x8')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0x0e2b('0x9')]('finished\x20populating',_0x0e2b('0xa'));return db[_0x0e2b('0xb')][_0x0e2b('0xc')]({'where':{}});})[_0x0e2b('0x8')](function(){return db[_0x0e2b('0xb')][_0x0e2b('0xd')](hopper);})[_0x0e2b('0x8')](function(){console[_0x0e2b('0x9')](_0x0e2b('0xe'),_0x0e2b('0xf'));return db[_0x0e2b('0x7')][_0x0e2b('0xd')](contacts2);})[_0x0e2b('0x8')](function(){console[_0x0e2b('0x9')](_0x0e2b('0xe'),_0x0e2b('0x10'));return db[_0x0e2b('0xb')][_0x0e2b('0xd')](hopper2);})[_0x0e2b('0x8')](function(){console[_0x0e2b('0x9')](_0x0e2b('0xe'),_0x0e2b('0x11'));})[_0x0e2b('0x12')](function(_0x463616){console[_0x0e2b('0x9')](_0x463616);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index da3948b..7e32740 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x245d=['then','catch','log','../mysqldb','format','%s%s','agent','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x120787,_0x3f5934){var _0xc757a3=function(_0x57a091){while(--_0x57a091){_0x120787['push'](_0x120787['shift']());}};_0xc757a3(++_0x3f5934);}(_0x245d,0x159));var _0xd245=function(_0xe66db3,_0x343054){_0xe66db3=_0xe66db3-0x0;var _0xd035a7=_0x245d[_0xe66db3];return _0xd035a7;};'use strict';var util=require('util');var db=require(_0xd245('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xd245('0x1')](_0xd245('0x2'),_0xd245('0x3'),i),'fullname':util[_0xd245('0x1')](_0xd245('0x2'),_0xd245('0x3'),i),'email':util['format']('%s%s@xcally.com','agent',i),'role':_0xd245('0x3'),'password':_0xd245('0x4'),'internal':0xfa0+i,'type':_0xd245('0x5'),'transport':[_0xd245('0x6'),'ws',_0xd245('0x7')],'disallow':['all'],'allow':[_0xd245('0x8')],'defaultuser':util[_0xd245('0x1')]('%s%s','agent',i),'encryption':_0xd245('0x9'),'avpf':_0xd245('0x9'),'force_avp':_0xd245('0x9'),'icesupport':_0xd245('0x9'),'dtlsenable':_0xd245('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xd245('0xa'),'dtlssetup':_0xd245('0xb'),'callerid':util[_0xd245('0x1')](_0xd245('0xc'),util['format']('%s%s',_0xd245('0x3'),i),0xfa0+i)});}db[_0xd245('0xd')][_0xd245('0xe')](users)[_0xd245('0xf')](function(){console['log']('add\x20user');})[_0xd245('0x10')](function(_0x14d713){console[_0xd245('0x11')](_0x14d713);}); \ No newline at end of file +var _0xdaea=['all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','udp','wss'];(function(_0x3b0b33,_0x2991d7){var _0x46e7af=function(_0x5465b3){while(--_0x5465b3){_0x3b0b33['push'](_0x3b0b33['shift']());}};_0x46e7af(++_0x2991d7);}(_0xdaea,0x14e));var _0xadae=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0xdaea[_0x5a4b42];return _0x5e81d6;};'use strict';var util=require(_0xadae('0x0'));var db=require(_0xadae('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xadae('0x2')]('%s%s','agent',i),'fullname':util[_0xadae('0x2')](_0xadae('0x3'),_0xadae('0x4'),i),'email':util['format'](_0xadae('0x5'),_0xadae('0x4'),i),'role':_0xadae('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xadae('0x6'),'ws',_0xadae('0x7')],'disallow':[_0xadae('0x8')],'allow':['ulaw'],'defaultuser':util[_0xadae('0x2')](_0xadae('0x3'),_0xadae('0x4'),i),'encryption':_0xadae('0x9'),'avpf':'yes','force_avp':'yes','icesupport':'yes','dtlsenable':_0xadae('0x9'),'dtlsverify':'no','dtlscertfile':_0xadae('0xa'),'dtlsprivatekey':_0xadae('0xb'),'dtlssetup':_0xadae('0xc'),'callerid':util[_0xadae('0x2')](_0xadae('0xd'),util[_0xadae('0x2')](_0xadae('0x3'),_0xadae('0x4'),i),0xfa0+i)});}db[_0xadae('0xe')][_0xadae('0xf')](users)['then'](function(){console[_0xadae('0x10')](_0xadae('0x11'));})[_0xadae('0x12')](function(_0x1f34d6){console['log'](_0x1f34d6);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f55558f..341ef82 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x046b=['user_has_chat_interactions:remove','leave','removeMailInteractions','emit','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:outbound','SmsQueues','MailQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','map','removeChatInteractions'];(function(_0x2b9594,_0x1f439b){var _0x58a5d1=function(_0xd289a1){while(--_0xd289a1){_0x2b9594['push'](_0x2b9594['shift']());}};_0x58a5d1(++_0x1f439b);}(_0x046b,0x1ba));var _0xb046=function(_0x46fa5e,_0x3973d7){_0x46fa5e=_0x46fa5e-0x0;var _0x2a9360=_0x046b[_0x46fa5e];return _0x2a9360;};'use strict';var _=require(_0xb046('0x0'));var util=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var db=require(_0xb046('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xb046('0x4')],'include':[{'as':_0xb046('0x5'),'model':db['User'],'attributes':['id',_0xb046('0x4'),_0xb046('0x6')],'raw':!![],'where':{'role':_0xb046('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb046('0x4')],'where':{'role':_0xb046('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb046('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb046('0x4')],'where':{'role':_0xb046('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb046('0x4'),_0xb046('0x9')],'where':{'type':_0xb046('0xa')}};function getAssociatedResources(_0x48f38d,_0x37eef0,_0x53c263){return db[_0xb046('0xb')][_0xb046('0xc')]({'where':{'name':_0x48f38d,'userProfileId':_0x37eef0},'raw':!![]})[_0xb046('0xd')](function(_0x322324){if(_0x322324){if(_0x322324[_0xb046('0xe')]){switch(_0x48f38d){case'VoiceQueues':case _0xb046('0xf'):case _0xb046('0x10'):case'SmsQueues':case'MailQueues':case _0xb046('0x11'):case _0xb046('0x12'):return db[_0x53c263][_0xb046('0x13')](queryQueues);case _0xb046('0x14'):return db[_0x53c263][_0xb046('0x13')](queryTelephones);case _0xb046('0x15'):return db[_0x53c263][_0xb046('0x13')](queryTrunks);case _0xb046('0x16'):return db[_0x53c263][_0xb046('0x13')](queryCampaigns);}}else{return db[_0xb046('0x17')]['findAll']({'attributes':[_0xb046('0x18')],'where':{'sectionId':_0x322324['id']},'raw':!![]})[_0xb046('0xd')](function(_0x4fd90c){if(_0x4fd90c){var _0x2b0d1e={'where':{'id':_['map'](_0x4fd90c,_0xb046('0x18'))},'raw':!![]};switch(_0x53c263){case _0xb046('0x19'):_0x2b0d1e[_0xb046('0x1a')][_0xb046('0x6')]=_0xb046('0x8');break;case _0xb046('0x1b'):_0x2b0d1e['where']['type']=_0xb046('0xa');break;}return db[_0x53c263][_0xb046('0x13')](_0x2b0d1e);}else{return[];}});}}else{return[];}})[_0xb046('0xd')](function(_0x4cd3c1){return _0x4cd3c1;});}function joinOrLeaveQueues(_0x541283,_0x1d617c,_0x5e5594,_0x144022){_0x541283[_0x1d617c](util['format'](_0xb046('0x1c'),_0x5e5594,_0x144022[_0xb046('0x4')]));if(_0x144022[_0xb046('0x5')]){for(var _0x324dba=0x0;_0x324dba<_0x144022['Agents']['length'];_0x324dba+=0x1){_0x541283[_0x1d617c](util['format'](_0xb046('0x1d'),_0x144022[_0xb046('0x5')][_0x324dba][_0xb046('0x4')]));}}}function joinOrLeave(_0x471c65,_0xc3c99a,_0x433526){var _0x51c65d;if(_0x471c65[_0xb046('0x1e')]['query']['id']){db['User'][_0xb046('0x1f')]({'attributes':['id',_0xb046('0x4'),_0xb046('0x6'),_0xb046('0x20')],'where':{'id':_0x471c65[_0xb046('0x1e')][_0xb046('0x21')]['id']},'include':[{'model':db[_0xb046('0x22')],'as':_0xb046('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x25')],'as':_0xb046('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x27')],'as':_0xb046('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x29')],'as':_0xb046('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xb046('0xd')](function(_0x333dbe){if(_0x333dbe){_0x51c65d=_0x333dbe;_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x1d'),_0x333dbe[_0xb046('0x4')]));var _0x4706ab=[];switch(_0x333dbe[_0xb046('0x6')]){case'admin':_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a]('voice:outbound');if(queryQueues[_0xb046('0x2d')](_0xb046('0x2e'))){delete queryQueues[_0xb046('0x2e')];}_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x30')]['findAll'](queryQueues));_0x4706ab['push'](db[_0xb046('0x31')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x32')]['findAll'](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x33')][_0xb046('0x13')](queryQueues));_0x4706ab['push'](db[_0xb046('0x34')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x35')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db['WhatsappQueue']['findAll'](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x19')][_0xb046('0x13')](queryTelephones));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x36')]['findAll'](queryTrunks));_0x4706ab[_0xb046('0x2f')](db['Campaign'][_0xb046('0x13')](queryCampaigns));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x19')][_0xb046('0x13')](queryAgents));break;case _0xb046('0x37'):_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a](_0xb046('0x38'));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('VoiceQueues',_0x333dbe[_0xb046('0x20')],_0xb046('0x30')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('ChatQueues',_0x333dbe['userProfileId'],'ChatQueue'));_0x4706ab['push'](getAssociatedResources(_0xb046('0x10'),_0x333dbe[_0xb046('0x20')],'FaxQueue'));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x39'),_0x333dbe[_0xb046('0x20')],_0xb046('0x33')));_0x4706ab['push'](getAssociatedResources(_0xb046('0x3a'),_0x333dbe['userProfileId'],_0xb046('0x34')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x11'),_0x333dbe[_0xb046('0x20')],_0xb046('0x35')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x12'),_0x333dbe[_0xb046('0x20')],_0xb046('0x3b')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x14'),_0x333dbe[_0xb046('0x20')],_0xb046('0x19')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('Trunks',_0x333dbe[_0xb046('0x20')],_0xb046('0x36')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x16'),_0x333dbe[_0xb046('0x20')],_0xb046('0x1b')));_0x4706ab['push'](db['User'][_0xb046('0x13')](queryAgents));break;case _0xb046('0x7'):_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a](_0xb046('0x38'));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x3c')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3d')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3e')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3f')]({'attributes':['id','name']}));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x40')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x41')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x42')]({'attributes':['id',_0xb046('0x4')]}));break;}return BPromise['all'](_0x4706ab);}})['then'](function(_0x5b81f1){if(_0x5b81f1&&_0x5b81f1[_0xb046('0x43')]){for(var _0x7004b4=0x0;_0x7004b4<_0x5b81f1[_0xb046('0x43')];_0x7004b4+=0x1){for(var _0x33a6fd=0x0;_0x33a6fd<_0x5b81f1[_0x7004b4][_0xb046('0x43')];_0x33a6fd+=0x1){switch(_0x7004b4){case 0x0:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x44'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x1:joinOrLeaveQueues(_0x471c65,_0xc3c99a,'chat',_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x2:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x45'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x3:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x46'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x4:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x47'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x5:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x48'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x6:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x49'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x7:if(_0x51c65d[_0xb046('0x6')]!==_0xb046('0x7'))_0x471c65[_0xc3c99a](util[_0xb046('0x2b')]('telephone:%s',_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;case 0x8:if(_0x51c65d[_0xb046('0x6')]!==_0xb046('0x7'))_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x4a'),_0x5b81f1[_0x7004b4][_0x33a6fd]['name']));break;case 0x9:if(_0x51c65d[_0xb046('0x6')]!=='agent')_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x4b'),_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x9')],_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;case 0xa:_0x471c65[_0xc3c99a](util['format'](_0xb046('0x1d'),_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;}}}}})[_0xb046('0xd')](function(){if(_0xc3c99a==='leave'){var _0x474b65=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x23')],'id');return _0x51c65d[_0xb046('0x4d')](_0x474b65)[_0xb046('0xd')](function(){for(var _0x248097=0x0;_0x248097<_0x474b65[_0xb046('0x43')];_0x248097+=0x1){_0x433526['emit'](_0xb046('0x4e'),{'ChatInteractionId':Number(_0x474b65[_0x248097]),'UserId':Number(_0x51c65d['id'])});}});}})['then'](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x41e3a8=_['map'](_0x51c65d['MailInteractions'],'id');return _0x51c65d[_0xb046('0x50')](_0x41e3a8)[_0xb046('0xd')](function(){for(var _0x27692a=0x0;_0x27692a<_0x41e3a8['length'];_0x27692a+=0x1){_0x433526[_0xb046('0x51')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x41e3a8[_0x27692a]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x4dd0f7=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x52')],'id');return _0x51c65d[_0xb046('0x53')](_0x4dd0f7)['then'](function(){for(var _0x10ed02=0x0;_0x10ed02<_0x4dd0f7[_0xb046('0x43')];_0x10ed02+=0x1){_0x433526['emit'](_0xb046('0x54'),{'FaxInteractionId':Number(_0x4dd0f7[_0x10ed02]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x22adbf=_['map'](_0x51c65d['SmsInteractions'],'id');return _0x51c65d[_0xb046('0x55')](_0x22adbf)[_0xb046('0xd')](function(){for(var _0x5d3fbb=0x0;_0x5d3fbb<_0x22adbf[_0xb046('0x43')];_0x5d3fbb+=0x1){_0x433526[_0xb046('0x51')](_0xb046('0x56'),{'SmsInteractionId':Number(_0x22adbf[_0x5d3fbb]),'UserId':Number(_0x51c65d['id'])});}});}})['then'](function(){if(_0xc3c99a==='leave'){var _0x262cde=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x28')],'id');return _0x51c65d[_0xb046('0x57')](_0x262cde)[_0xb046('0xd')](function(){for(var _0x3aff1a=0x0;_0x3aff1a<_0x262cde[_0xb046('0x43')];_0x3aff1a+=0x1){_0x433526[_0xb046('0x51')](_0xb046('0x58'),{'OpenchannelInteractionId':Number(_0x262cde[_0x3aff1a]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x28cce4=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x2a')],'id');return _0x51c65d[_0xb046('0x59')](_0x28cce4)['then'](function(){for(var _0x519d2d=0x0;_0x519d2d<_0x28cce4[_0xb046('0x43')];_0x519d2d+=0x1){_0x433526['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x28cce4[_0x519d2d]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0x5a')](function(_0x2c6782){_0x471c65[_0xb046('0x5b')](_0x2c6782);});}}function onDisconnect(_0x237cbe,_0x2fe60b){joinOrLeave(_0x237cbe,_0xb046('0x4f'),_0x2fe60b);}function onConnect(_0x21735d){joinOrLeave(_0x21735d,_0xb046('0x5c'));}exports[_0xb046('0x5d')]=function(_0x119754){_0x119754['on'](_0xb046('0x5e'),function(_0x4caa5a){_0x4caa5a[_0xb046('0x5f')](0x0);_0x4caa5a[_0xb046('0x60')]=_0x4caa5a[_0xb046('0x61')][_0xb046('0x5e')][_0xb046('0x62')]+':'+_0x4caa5a[_0xb046('0x61')][_0xb046('0x5e')]['remotePort'];_0x4caa5a['connectedAt']=new Date();_0x4caa5a['log']=function(_0x555b8a){console[_0xb046('0x5b')](_0xb046('0x63')+_0x4caa5a[_0xb046('0x64')][_0xb046('0x4')]+'['+_0x4caa5a['address']+']',_0x555b8a);};_0x4caa5a['on'](_0xb046('0x65'),function(){onDisconnect(_0x4caa5a,_0x119754);_0x4caa5a[_0xb046('0x5b')](_0xb046('0x66'));});onConnect(_0x4caa5a);_0x4caa5a[_0xb046('0x5b')](_0xb046('0x67'));});}; \ No newline at end of file +var _0x4cf5=['DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','User','name','role','agent','type','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','Campaign','where','format','%s:queue:%s','Agents','user:%s','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','VoiceQueues','FaxQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect'];(function(_0x314c1f,_0x53f85d){var _0x49bcca=function(_0x462004){while(--_0x462004){_0x314c1f['push'](_0x314c1f['shift']());}};_0x49bcca(++_0x53f85d);}(_0x4cf5,0x12e));var _0x54cf=function(_0x1a31c7,_0x333968){_0x1a31c7=_0x1a31c7-0x0;var _0x54d3a4=_0x4cf5[_0x1a31c7];return _0x54d3a4;};'use strict';var _=require(_0x54cf('0x0'));var util=require(_0x54cf('0x1'));var BPromise=require(_0x54cf('0x2'));var db=require(_0x54cf('0x3'))['db'];var config=require(_0x54cf('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x54cf('0x5')],'attributes':['id',_0x54cf('0x6'),_0x54cf('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x54cf('0x6')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x54cf('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x54cf('0x6')],'where':{'role':_0x54cf('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x54cf('0x6'),_0x54cf('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x49c505,_0x4f0002,_0x3cca5e){return db['UserProfileSection'][_0x54cf('0xa')]({'where':{'name':_0x49c505,'userProfileId':_0x4f0002},'raw':!![]})[_0x54cf('0xb')](function(_0x24f27d){if(_0x24f27d){if(_0x24f27d[_0x54cf('0xc')]){switch(_0x49c505){case'VoiceQueues':case _0x54cf('0xd'):case _0x54cf('0xe'):case _0x54cf('0xf'):case _0x54cf('0x10'):case _0x54cf('0x11'):case _0x54cf('0x12'):return db[_0x3cca5e]['findAll'](queryQueues);case _0x54cf('0x13'):return db[_0x3cca5e][_0x54cf('0x14')](queryTelephones);case _0x54cf('0x15'):return db[_0x3cca5e][_0x54cf('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x3cca5e][_0x54cf('0x14')](queryCampaigns);}}else{return db[_0x54cf('0x16')][_0x54cf('0x14')]({'attributes':[_0x54cf('0x17')],'where':{'sectionId':_0x24f27d['id']},'raw':!![]})['then'](function(_0x2f3722){if(_0x2f3722){var _0x14d3c6={'where':{'id':_['map'](_0x2f3722,_0x54cf('0x17'))},'raw':!![]};switch(_0x3cca5e){case _0x54cf('0x5'):_0x14d3c6['where']['role']='telephone';break;case _0x54cf('0x18'):_0x14d3c6[_0x54cf('0x19')][_0x54cf('0x9')]='ivr';break;}return db[_0x3cca5e][_0x54cf('0x14')](_0x14d3c6);}else{return[];}});}}else{return[];}})['then'](function(_0x17ab8d){return _0x17ab8d;});}function joinOrLeaveQueues(_0x1b8b8c,_0x56d0ee,_0x51628f,_0x2a279e){_0x1b8b8c[_0x56d0ee](util[_0x54cf('0x1a')](_0x54cf('0x1b'),_0x51628f,_0x2a279e['name']));if(_0x2a279e[_0x54cf('0x1c')]){for(var _0x163188=0x0;_0x163188<_0x2a279e[_0x54cf('0x1c')]['length'];_0x163188+=0x1){_0x1b8b8c[_0x56d0ee](util['format'](_0x54cf('0x1d'),_0x2a279e[_0x54cf('0x1c')][_0x163188][_0x54cf('0x6')]));}}}function joinOrLeave(_0x3bd7f6,_0x439c61,_0x3c23f0){var _0x581795;if(_0x3bd7f6['handshake'][_0x54cf('0x1e')]['id']){db['User']['find']({'attributes':['id',_0x54cf('0x6'),_0x54cf('0x7'),_0x54cf('0x1f')],'where':{'id':_0x3bd7f6[_0x54cf('0x20')]['query']['id']},'include':[{'model':db[_0x54cf('0x21')],'as':_0x54cf('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x54cf('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x54cf('0x24')],'as':_0x54cf('0x25'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x54cf('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x54cf('0x27')],'as':_0x54cf('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x54cf('0x29')],'as':_0x54cf('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xdeba42){if(_0xdeba42){_0x581795=_0xdeba42;_0x3bd7f6[_0x439c61](util['format'](_0x54cf('0x1d'),_0xdeba42[_0x54cf('0x6')]));var _0x1df7a8=[];switch(_0xdeba42['role']){case _0x54cf('0x2b'):_0x3bd7f6[_0x439c61](_0x54cf('0x2c'));_0x3bd7f6[_0x439c61]('voice:outbound');if(queryQueues[_0x54cf('0x2d')](_0x54cf('0x2e'))){delete queryQueues['include'];}_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x30')][_0x54cf('0x14')](queryQueues));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x31')]['findAll'](queryQueues));_0x1df7a8[_0x54cf('0x2f')](db['FaxQueue'][_0x54cf('0x14')](queryQueues));_0x1df7a8['push'](db[_0x54cf('0x32')][_0x54cf('0x14')](queryQueues));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x33')][_0x54cf('0x14')](queryQueues));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x34')]['findAll'](queryQueues));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x35')][_0x54cf('0x14')](queryQueues));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x5')][_0x54cf('0x14')](queryTelephones));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x36')][_0x54cf('0x14')](queryTrunks));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x18')]['findAll'](queryCampaigns));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x5')][_0x54cf('0x14')](queryAgents));break;case'user':_0x3bd7f6[_0x439c61](_0x54cf('0x2c'));_0x3bd7f6[_0x439c61](_0x54cf('0x37'));_0x1df7a8[_0x54cf('0x2f')](getAssociatedResources(_0x54cf('0x38'),_0xdeba42[_0x54cf('0x1f')],'VoiceQueue'));_0x1df7a8['push'](getAssociatedResources(_0x54cf('0xd'),_0xdeba42['userProfileId'],_0x54cf('0x31')));_0x1df7a8[_0x54cf('0x2f')](getAssociatedResources(_0x54cf('0xe'),_0xdeba42['userProfileId'],_0x54cf('0x39')));_0x1df7a8['push'](getAssociatedResources(_0x54cf('0xf'),_0xdeba42[_0x54cf('0x1f')],_0x54cf('0x32')));_0x1df7a8[_0x54cf('0x2f')](getAssociatedResources(_0x54cf('0x10'),_0xdeba42[_0x54cf('0x1f')],_0x54cf('0x33')));_0x1df7a8[_0x54cf('0x2f')](getAssociatedResources(_0x54cf('0x11'),_0xdeba42[_0x54cf('0x1f')],_0x54cf('0x34')));_0x1df7a8['push'](getAssociatedResources('WhatsappQueues',_0xdeba42[_0x54cf('0x1f')],_0x54cf('0x35')));_0x1df7a8['push'](getAssociatedResources(_0x54cf('0x13'),_0xdeba42[_0x54cf('0x1f')],_0x54cf('0x5')));_0x1df7a8[_0x54cf('0x2f')](getAssociatedResources('Trunks',_0xdeba42['userProfileId'],'Trunk'));_0x1df7a8[_0x54cf('0x2f')](getAssociatedResources('IvrCampaigns',_0xdeba42[_0x54cf('0x1f')],_0x54cf('0x18')));_0x1df7a8[_0x54cf('0x2f')](db[_0x54cf('0x5')][_0x54cf('0x14')](queryAgents));break;case _0x54cf('0x8'):_0x3bd7f6[_0x439c61]('voice:inbound');_0x3bd7f6[_0x439c61]('voice:outbound');_0x1df7a8[_0x54cf('0x2f')](_0xdeba42[_0x54cf('0x3a')]({'attributes':['id',_0x54cf('0x6')]}));_0x1df7a8[_0x54cf('0x2f')](_0xdeba42[_0x54cf('0x3b')]({'attributes':['id',_0x54cf('0x6')]}));_0x1df7a8['push'](_0xdeba42[_0x54cf('0x3c')]({'attributes':['id','name']}));_0x1df7a8[_0x54cf('0x2f')](_0xdeba42[_0x54cf('0x3d')]({'attributes':['id',_0x54cf('0x6')]}));_0x1df7a8[_0x54cf('0x2f')](_0xdeba42[_0x54cf('0x3e')]({'attributes':['id','name']}));_0x1df7a8[_0x54cf('0x2f')](_0xdeba42[_0x54cf('0x3f')]({'attributes':['id',_0x54cf('0x6')]}));_0x1df7a8[_0x54cf('0x2f')](_0xdeba42['getWhatsappQueues']({'attributes':['id',_0x54cf('0x6')]}));break;}return BPromise['all'](_0x1df7a8);}})[_0x54cf('0xb')](function(_0x5cb9cb){if(_0x5cb9cb&&_0x5cb9cb['length']){for(var _0x5c4c42=0x0;_0x5c4c42<_0x5cb9cb['length'];_0x5c4c42+=0x1){for(var _0x4dd57d=0x0;_0x4dd57d<_0x5cb9cb[_0x5c4c42][_0x54cf('0x40')];_0x4dd57d+=0x1){switch(_0x5c4c42){case 0x0:joinOrLeaveQueues(_0x3bd7f6,_0x439c61,_0x54cf('0x41'),_0x5cb9cb[_0x5c4c42][_0x4dd57d]);break;case 0x1:joinOrLeaveQueues(_0x3bd7f6,_0x439c61,_0x54cf('0x42'),_0x5cb9cb[_0x5c4c42][_0x4dd57d]);break;case 0x2:joinOrLeaveQueues(_0x3bd7f6,_0x439c61,_0x54cf('0x43'),_0x5cb9cb[_0x5c4c42][_0x4dd57d]);break;case 0x3:joinOrLeaveQueues(_0x3bd7f6,_0x439c61,_0x54cf('0x44'),_0x5cb9cb[_0x5c4c42][_0x4dd57d]);break;case 0x4:joinOrLeaveQueues(_0x3bd7f6,_0x439c61,_0x54cf('0x45'),_0x5cb9cb[_0x5c4c42][_0x4dd57d]);break;case 0x5:joinOrLeaveQueues(_0x3bd7f6,_0x439c61,_0x54cf('0x46'),_0x5cb9cb[_0x5c4c42][_0x4dd57d]);break;case 0x6:joinOrLeaveQueues(_0x3bd7f6,_0x439c61,_0x54cf('0x47'),_0x5cb9cb[_0x5c4c42][_0x4dd57d]);break;case 0x7:if(_0x581795['role']!==_0x54cf('0x8'))_0x3bd7f6[_0x439c61](util['format']('telephone:%s',_0x5cb9cb[_0x5c4c42][_0x4dd57d][_0x54cf('0x6')]));break;case 0x8:if(_0x581795[_0x54cf('0x7')]!==_0x54cf('0x8'))_0x3bd7f6[_0x439c61](util[_0x54cf('0x1a')](_0x54cf('0x48'),_0x5cb9cb[_0x5c4c42][_0x4dd57d][_0x54cf('0x6')]));break;case 0x9:if(_0x581795[_0x54cf('0x7')]!==_0x54cf('0x8'))_0x3bd7f6[_0x439c61](util[_0x54cf('0x1a')](_0x54cf('0x49'),_0x5cb9cb[_0x5c4c42][_0x4dd57d][_0x54cf('0x9')],_0x5cb9cb[_0x5c4c42][_0x4dd57d][_0x54cf('0x6')]));break;case 0xa:_0x3bd7f6[_0x439c61](util[_0x54cf('0x1a')]('user:%s',_0x5cb9cb[_0x5c4c42][_0x4dd57d][_0x54cf('0x6')]));break;}}}}})[_0x54cf('0xb')](function(){if(_0x439c61===_0x54cf('0x4a')){var _0x15085a=_[_0x54cf('0x4b')](_0x581795[_0x54cf('0x22')],'id');return _0x581795[_0x54cf('0x4c')](_0x15085a)[_0x54cf('0xb')](function(){for(var _0x21e803=0x0;_0x21e803<_0x15085a[_0x54cf('0x40')];_0x21e803+=0x1){_0x3c23f0[_0x54cf('0x4d')](_0x54cf('0x4e'),{'ChatInteractionId':Number(_0x15085a[_0x21e803]),'UserId':Number(_0x581795['id'])});}});}})['then'](function(){if(_0x439c61===_0x54cf('0x4a')){var _0x301883=_[_0x54cf('0x4b')](_0x581795[_0x54cf('0x23')],'id');return _0x581795[_0x54cf('0x4f')](_0x301883)[_0x54cf('0xb')](function(){for(var _0x2b4613=0x0;_0x2b4613<_0x301883[_0x54cf('0x40')];_0x2b4613+=0x1){_0x3c23f0['emit'](_0x54cf('0x50'),{'MailInteractionId':Number(_0x301883[_0x2b4613]),'UserId':Number(_0x581795['id'])});}});}})[_0x54cf('0xb')](function(){if(_0x439c61===_0x54cf('0x4a')){var _0xe09c34=_[_0x54cf('0x4b')](_0x581795[_0x54cf('0x25')],'id');return _0x581795['removeFaxInteractions'](_0xe09c34)[_0x54cf('0xb')](function(){for(var _0x1f3a3a=0x0;_0x1f3a3a<_0xe09c34['length'];_0x1f3a3a+=0x1){_0x3c23f0[_0x54cf('0x4d')](_0x54cf('0x51'),{'FaxInteractionId':Number(_0xe09c34[_0x1f3a3a]),'UserId':Number(_0x581795['id'])});}});}})['then'](function(){if(_0x439c61===_0x54cf('0x4a')){var _0x415095=_[_0x54cf('0x4b')](_0x581795[_0x54cf('0x26')],'id');return _0x581795[_0x54cf('0x52')](_0x415095)[_0x54cf('0xb')](function(){for(var _0xe7f64e=0x0;_0xe7f64e<_0x415095[_0x54cf('0x40')];_0xe7f64e+=0x1){_0x3c23f0[_0x54cf('0x4d')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x415095[_0xe7f64e]),'UserId':Number(_0x581795['id'])});}});}})['then'](function(){if(_0x439c61==='leave'){var _0x594025=_[_0x54cf('0x4b')](_0x581795[_0x54cf('0x28')],'id');return _0x581795[_0x54cf('0x53')](_0x594025)[_0x54cf('0xb')](function(){for(var _0x1d3892=0x0;_0x1d3892<_0x594025[_0x54cf('0x40')];_0x1d3892+=0x1){_0x3c23f0[_0x54cf('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x594025[_0x1d3892]),'UserId':Number(_0x581795['id'])});}});}})[_0x54cf('0xb')](function(){if(_0x439c61==='leave'){var _0x562b45=_[_0x54cf('0x4b')](_0x581795['WhatsappInteractions'],'id');return _0x581795[_0x54cf('0x54')](_0x562b45)[_0x54cf('0xb')](function(){for(var _0x1f3317=0x0;_0x1f3317<_0x562b45[_0x54cf('0x40')];_0x1f3317+=0x1){_0x3c23f0[_0x54cf('0x4d')](_0x54cf('0x55'),{'WhatsappInteractionId':Number(_0x562b45[_0x1f3317]),'UserId':Number(_0x581795['id'])});}});}})['catch'](function(_0x47b3e6){_0x3bd7f6[_0x54cf('0x56')](_0x47b3e6);});}}function onDisconnect(_0x3cde4e,_0xb96078){joinOrLeave(_0x3cde4e,_0x54cf('0x4a'),_0xb96078);}function onConnect(_0xf4f958){joinOrLeave(_0xf4f958,_0x54cf('0x57'));}exports[_0x54cf('0x58')]=function(_0x1f4efc){_0x1f4efc['on']('connection',function(_0x2729df){_0x2729df[_0x54cf('0x59')](0x0);_0x2729df[_0x54cf('0x5a')]=_0x2729df[_0x54cf('0x5b')][_0x54cf('0x5c')][_0x54cf('0x5d')]+':'+_0x2729df[_0x54cf('0x5b')][_0x54cf('0x5c')][_0x54cf('0x5e')];_0x2729df[_0x54cf('0x5f')]=new Date();_0x2729df[_0x54cf('0x56')]=function(_0x105e7d){console[_0x54cf('0x56')](_0x54cf('0x60')+_0x2729df['nsp']['name']+'['+_0x2729df[_0x54cf('0x5a')]+']',_0x105e7d);};_0x2729df['on'](_0x54cf('0x61'),function(){onDisconnect(_0x2729df,_0x1f4efc);_0x2729df[_0x54cf('0x56')](_0x54cf('0x62'));});onConnect(_0x2729df);_0x2729df[_0x54cf('0x56')](_0x54cf('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index da874e4..5a9cf04 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 _0x84d2=['fullname','email','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','client','http','Chat','newinteraction','ChatInteraction','afterUpdate','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','closedinteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','motionChannel','event','resolve','ContactId','undefined','query','Sequelize','QueryTypes','contact','UserId','interface','format','SIP/%s','name','agent','channel','outgoingmessage','AfterCreateMessage','offlineMessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','changed','closed','substatus','sequelize','SELECT','AfterUpdate','User','find'];(function(_0x544cd7,_0x20f588){var _0x43c000=function(_0x3d71cf){while(--_0x3d71cf){_0x544cd7['push'](_0x544cd7['shift']());}};_0x43c000(++_0x20f588);}(_0x84d2,0x1cc));var _0x284d=function(_0x1615d0,_0x13820d){_0x1615d0=_0x1615d0-0x0;var _0xa5ce6c=_0x84d2[_0x1615d0];return _0xa5ce6c;};'use strict';var util=require('util');var db=require(_0x284d('0x0'))['db'];var jayson=require(_0x284d('0x1'));var logger=require(_0x284d('0x2'))('triggers');var client=jayson[_0x284d('0x3')][_0x284d('0x4')]({'port':0x232a});var triggers=[{'channel':_0x284d('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':_0x284d('0x6'),'callback':afterCreate},{'channel':_0x284d('0x5'),'model':_0x284d('0x7'),'event':_0x284d('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x284d('0x5'),'model':'ChatMessage','event':_0x284d('0x9'),'condition':_0x284d('0xa'),'callback':afterCreateMessage},{'channel':_0x284d('0x5'),'model':_0x284d('0xb'),'event':'afterCreate','condition':_0x284d('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x284d('0xc'),'model':_0x284d('0xd'),'event':_0x284d('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x284d('0xc'),'model':_0x284d('0xd'),'event':_0x284d('0x8'),'condition':_0x284d('0xe'),'callback':afterUpdate},{'channel':_0x284d('0xc'),'model':_0x284d('0xf'),'event':_0x284d('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x284d('0x10'),'event':_0x284d('0x9'),'condition':_0x284d('0x6'),'callback':afterCreate},{'channel':_0x284d('0x11'),'model':_0x284d('0x10'),'event':_0x284d('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x284d('0x12'),'event':'afterCreate','condition':_0x284d('0xa'),'callback':afterCreateMessage},{'channel':_0x284d('0x13'),'model':_0x284d('0x14'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x284d('0x8'),'condition':_0x284d('0xe'),'callback':afterUpdate},{'channel':_0x284d('0x13'),'model':_0x284d('0x15'),'event':_0x284d('0x9'),'condition':_0x284d('0xa'),'callback':afterCreateMessage},{'channel':_0x284d('0x16'),'model':'MailInteraction','event':'afterCreate','condition':_0x284d('0x6'),'callback':afterCreate},{'channel':_0x284d('0x16'),'model':_0x284d('0x17'),'event':'afterUpdate','condition':_0x284d('0xe'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x284d('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x284d('0x18'),'event':'afterCreate','condition':_0x284d('0x6'),'callback':afterCreate},{'channel':_0x284d('0x19'),'model':_0x284d('0x18'),'event':_0x284d('0x8'),'condition':_0x284d('0xe'),'callback':afterUpdate},{'channel':_0x284d('0x19'),'model':_0x284d('0x1a'),'event':_0x284d('0x9'),'condition':_0x284d('0xa'),'callback':afterCreateMessage}];function request(_0x1c75e1){return client[_0x284d('0x1b')](_0x284d('0x1c'),_0x1c75e1)[_0x284d('0x1d')](function(_0x531db3){logger[_0x284d('0x1e')](_0x284d('0x1f'),_0x284d('0x1c'),_0x531db3);if(_0x531db3[_0x284d('0x20')]){if(_0x531db3[_0x284d('0x20')][_0x284d('0x21')]===0x1f4){logger[_0x284d('0x20')](_0x284d('0x1f'),_0x284d('0x1c'),_0x531db3[_0x284d('0x20')]);}}})[_0x284d('0x22')](function(_0x2ec205){logger[_0x284d('0x20')](_0x284d('0x1f'),_0x284d('0x1c'),_0x2ec205);});}function afterCreateMessage(_0x138182){return function(_0x393205){_0x393205=_0x393205[_0x284d('0x23')]({'plain':!![]});_0x393205['channel']=_0x138182;_0x393205[_0x284d('0x24')]=_0x138182;_0x393205[_0x284d('0x25')]=_0x393205['direction'];Promise[_0x284d('0x26')]()['then'](function(){if(typeof _0x393205[_0x284d('0x27')]===_0x284d('0x28'))return null;var _0x3dd768='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x393205[_0x284d('0x27')];return db['sequelize'][_0x284d('0x29')](_0x3dd768,{'type':db[_0x284d('0x2a')][_0x284d('0x2b')]['SELECT'],'raw':!![]});})['then'](function(_0x10a8fe){if(_0x10a8fe){_0x393205[_0x284d('0x2c')]=_0x10a8fe[0x0];}if(typeof _0x393205[_0x284d('0x2d')]===_0x284d('0x28'))return;return getAgent(_0x393205[_0x284d('0x2d')]);})[_0x284d('0x1d')](function(_0x5bf736){if(_0x5bf736){_0x393205[_0x284d('0x2e')]=util[_0x284d('0x2f')](_0x284d('0x30'),_0x5bf736[_0x284d('0x31')]);_0x393205[_0x284d('0x32')]=_0x5bf736;_0x393205[_0x284d('0x33')]=_0x138182;return request({'event':'incomingmessage','message':_0x393205});}else{return request({'event':_0x284d('0x34'),'message':_0x393205});}})[_0x284d('0x22')](function(_0xb5c745){logger[_0x284d('0x20')](_0x284d('0x1f'),_0x284d('0x35'),_0xb5c745);});};}function afterCreateOfflineMessage(_0x14b65e){return function(_0x51a053){_0x51a053=_0x51a053['get']({'plain':!![]});_0x51a053[_0x284d('0x33')]=_0x14b65e;_0x51a053[_0x284d('0x24')]=_0x14b65e;_0x51a053['event']=_0x284d('0x36');return request({'event':_0x51a053['event'],'message':_0x51a053});};}function afterCreate(_0x199c24,_0x2a2a0c){return function(_0x51d0f5){var _0x58e35a=_0x51d0f5[_0x284d('0x23')]({'plain':!![]});_0x58e35a['channel']=_0x199c24;_0x58e35a[_0x284d('0x24')]=_0x199c24;_0x58e35a[_0x284d('0x25')]=_0x284d('0x37');Promise['resolve']()[_0x284d('0x1d')](function(){var _0x23d1d1=_0x284d('0x38')+_0x58e35a['ContactId'];return db['sequelize'][_0x284d('0x29')](_0x23d1d1,{'type':db[_0x284d('0x2a')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x284d('0x1d')](function(_0x51769c){if(_0x51769c){_0x58e35a[_0x284d('0x2c')]=_0x51769c[0x0];}if(_0x58e35a['UserId']){return getAgent(_0x58e35a['UserId']);}return;})[_0x284d('0x1d')](function(_0x1bd110){if(_0x1bd110){_0x58e35a[_0x284d('0x2e')]=util[_0x284d('0x2f')]('SIP/%s',_0x1bd110[_0x284d('0x31')]);_0x58e35a[_0x284d('0x32')]=_0x1bd110;}return request({'event':_0x2a2a0c,'message':_0x58e35a});})[_0x284d('0x22')](function(_0x25925a){logger['error'](_0x284d('0x1f'),'AfterCreate',_0x25925a);});};}function afterUpdate(_0x275e4e){return function(_0x15efdc){var _0x4838d5=_0x15efdc[_0x284d('0x39')](_0x284d('0x3a'))&&_0x15efdc[_0x284d('0x3a')];var _0xbd1875=_0x15efdc[_0x284d('0x39')](_0x284d('0x3b'));if(_0x4838d5||_0xbd1875){var _0x596b05=_0x4838d5?_0x284d('0xe'):_0x284d('0x3b');var _0x4975b9=_0x15efdc['get']({'plain':!![]});_0x4975b9[_0x284d('0x33')]=_0x275e4e;_0x4975b9[_0x284d('0x24')]=_0x275e4e;_0x4975b9[_0x284d('0x25')]=_0x4838d5?_0x284d('0x3a'):_0x284d('0x3b');var _0x4a63af=_0x284d('0x38')+_0x4975b9[_0x284d('0x27')];return db[_0x284d('0x3c')][_0x284d('0x29')](_0x4a63af,{'type':db[_0x284d('0x2a')]['QueryTypes'][_0x284d('0x3d')],'raw':!![]})[_0x284d('0x1d')](function(_0xa91e42){if(_0xa91e42){_0x4975b9[_0x284d('0x2c')]=_0xa91e42[0x0];}if(typeof _0x4975b9[_0x284d('0x2d')]===_0x284d('0x28'))return;return getAgent(_0x4975b9['UserId']);})[_0x284d('0x1d')](function(_0xfa1423){if(_0xfa1423){_0x4975b9[_0x284d('0x2e')]=util['format'](_0x284d('0x30'),_0xfa1423[_0x284d('0x31')]);_0x4975b9[_0x284d('0x32')]=_0xfa1423;}return request({'event':_0x596b05,'message':_0x4975b9});})[_0x284d('0x22')](function(_0x412618){logger['error'](_0x284d('0x1f'),_0x284d('0x3e'),_0x412618);});}};}function getAgent(_0x562a43){return db[_0x284d('0x3f')][_0x284d('0x40')]({'where':{'id':_0x562a43},'attributes':['id',_0x284d('0x31'),_0x284d('0x41'),_0x284d('0x42'),'internal'],'raw':!![]})['then'](function(_0x26c093){return _0x26c093;});}exports[_0x284d('0x43')]=function(){for(var _0xd1f89a=0x0;_0xd1f89a=_0x4a8fdf['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5468e9(_0x5baae7);})[_0x8711('0x14')](function(_0x4da071){_0x4cfb1a(_0x4da071);});});}; \ No newline at end of file +var _0xae6e=['then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','mail','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','isUndefined','updateAttributes','getLicense','role','agent','count'];(function(_0x58f190,_0x39da0a){var _0x4926d6=function(_0x418a7c){while(--_0x418a7c){_0x58f190['push'](_0x58f190['shift']());}};_0x4926d6(++_0x39da0a);}(_0xae6e,0xb4));var _0xeae6=function(_0x571348,_0x5904c4){_0x571348=_0x571348-0x0;var _0x95e03b=_0xae6e[_0x571348];return _0x95e03b;};'use strict';var _=require(_0xeae6('0x0'));var BPromise=require(_0xeae6('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xeae6('0x2'));var channels=[_0xeae6('0x3'),_0xeae6('0x4'),_0xeae6('0x5'),'fax',_0xeae6('0x6'),_0xeae6('0x7'),_0xeae6('0x8')];exports[_0xeae6('0x9')]=function(){return channels;};exports[_0xeae6('0xa')]=function(_0x1180e2){_0x1180e2=_0x1180e2['toLowerCase']();return _[_0xeae6('0xb')](channels,_0x1180e2);};exports['clearBlockUser']=function(_0x2300b4,_0x1bae3c,_0x244577,_0xa7f037){var _0x59dceb={'loginAttempts':_0x1bae3c,'blocked':_0x244577};if(!_[_0xeae6('0xc')](_0xa7f037)){_0x59dceb['blockedAt']=_0xa7f037;}return _0x2300b4[_0xeae6('0xd')](_0x59dceb);};exports[_0xeae6('0xe')]=function(_0x175b19){return new BPromise(function(_0x2b4c37,_0x41ee16){var _0x21e9fe=0x0;if(_0x175b19[_0xeae6('0xf')]!==_0xeae6('0x10')){_0x2b4c37(_0x175b19);}db['User'][_0xeae6('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x175b19['id']}}})['then'](function(_0x5573ad){_0x21e9fe=_0x5573ad;return util[_0xeae6('0xe')]();})[_0xeae6('0x12')](function(_0x46e95c){if(_0x46e95c&&_0x46e95c['agents']&&_0x21e9fe>=_0x46e95c[_0xeae6('0x13')]){throw Error(_0xeae6('0x14'));}_0x2b4c37(_0x175b19);})[_0xeae6('0x15')](function(_0x1f05fa){_0x41ee16(_0x1f05fa);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index d96c673..326827d 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71e0=['OutOfInterval','Conflict','stack','statusMessage','send','../config/logger','api','inherits','message','Bad\x20Request','name','Forbidden','Not\x20Found','Out\x20Of\x20Interval','code'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x71e0,0x15e));var _0x071e=function(_0x251598,_0x5a0a1b){_0x251598=_0x251598-0x0;var _0x46b489=_0x71e0[_0x251598];return _0x46b489;};'use strict';var util=require('util');var logger=require(_0x071e('0x0'))(_0x071e('0x1'));var APIError=function(_0x264e0d,_0x379dfc){this['message']=_0x264e0d||'Internal\x20Server\x20Error';this['name']=_0x379dfc||'Error';util[_0x071e('0x2')](APIError,Error);};var APIBadRequestError=function(_0x299c6d){this[_0x071e('0x3')]=_0x299c6d||_0x071e('0x4');this[_0x071e('0x5')]=_0x071e('0x4');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xc9f614){this[_0x071e('0x3')]=_0xc9f614||_0x071e('0x6');this[_0x071e('0x5')]=_0x071e('0x6');util[_0x071e('0x2')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x115447){this['message']=_0x115447||'Entity\x20not\x20found';this[_0x071e('0x5')]=_0x071e('0x7');util[_0x071e('0x2')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2cffbd){this[_0x071e('0x3')]=_0x2cffbd||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x071e('0x5')]=_0x071e('0x8');this[_0x071e('0x9')]=0x193;this['details']={'type':_0x071e('0xa')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x463d63){this[_0x071e('0x3')]=_0x463d63||'Resource\x20Conflict';this[_0x071e('0x5')]=_0x071e('0xb');util[_0x071e('0x2')](APIBadRequestError,APIError);};function getStatusCode(_0x576233){switch(_0x576233){case _0x071e('0x4'):return 0x190;case _0x071e('0x6'),_0x071e('0x8'):return 0x193;case'Not\x20Found':return 0x194;case _0x071e('0xb'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1230a9){if(_0x1230a9==='Out\x20Of\x20Interval')return _0x1230a9;return null;}function handleError(_0xb3094a){return function(_0x185a9f){logger['error'](_0x185a9f[_0x071e('0xc')]);var _0x40905d=getStatusCode(_0x185a9f['name']);var _0x244199=getCustomStatusMessage(_0x185a9f[_0x071e('0x5')]);if(_0x185a9f['name']){delete _0x185a9f[_0x071e('0x5')];}if(_0x244199){_0xb3094a[_0x071e('0xd')]=_0x244199;}return _0xb3094a['status'](_0x40905d)[_0x071e('0xe')](_0x185a9f);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xe2bc=['error','stack','statusMessage','status','send','exports','../config/logger','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','inherits','Forbidden','Not\x20Found','Out\x20Of\x20Interval','code','details','Resource\x20Conflict','Conflict'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2bc,0x1e6));var _0xce2b=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xe2bc[_0x1b7368];return _0x25d54c;};'use strict';var util=require('util');var logger=require(_0xce2b('0x0'))('api');var APIError=function(_0x8d7223,_0x33c964){this[_0xce2b('0x1')]=_0x8d7223||_0xce2b('0x2');this[_0xce2b('0x3')]=_0x33c964||_0xce2b('0x4');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x46dfd4){this[_0xce2b('0x1')]=_0x46dfd4||_0xce2b('0x5');this[_0xce2b('0x3')]=_0xce2b('0x5');util[_0xce2b('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x42d409){this[_0xce2b('0x1')]=_0x42d409||_0xce2b('0x7');this[_0xce2b('0x3')]=_0xce2b('0x7');util[_0xce2b('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x2715f3){this['message']=_0x2715f3||'Entity\x20not\x20found';this['name']=_0xce2b('0x8');util[_0xce2b('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21dff8){this[_0xce2b('0x1')]=_0x21dff8||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xce2b('0x3')]=_0xce2b('0x9');this[_0xce2b('0xa')]=0x193;this[_0xce2b('0xb')]={'type':'OutOfInterval'};util[_0xce2b('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x253ad4){this[_0xce2b('0x1')]=_0x253ad4||_0xce2b('0xc');this[_0xce2b('0x3')]='Conflict';util[_0xce2b('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x412b76){switch(_0x412b76){case _0xce2b('0x5'):return 0x190;case _0xce2b('0x7'),_0xce2b('0x9'):return 0x193;case _0xce2b('0x8'):return 0x194;case _0xce2b('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x15a0e3){if(_0x15a0e3==='Out\x20Of\x20Interval')return _0x15a0e3;return null;}function handleError(_0x341f85){return function(_0xae93a3){logger[_0xce2b('0xe')](_0xae93a3[_0xce2b('0xf')]);var _0x43dc8b=getStatusCode(_0xae93a3['name']);var _0x1b2bc1=getCustomStatusMessage(_0xae93a3[_0xce2b('0x3')]);if(_0xae93a3[_0xce2b('0x3')]){delete _0xae93a3[_0xce2b('0x3')];}if(_0x1b2bc1){_0x341f85[_0xce2b('0x10')]=_0x1b2bc1;}return _0x341f85[_0xce2b('0x11')](_0x43dc8b)[_0xce2b('0x12')](_0xae93a3);};}module[_0xce2b('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 24dd679..02d2337 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa130=['exports','404','status'];(function(_0x1416fc,_0x72e155){var _0x3a4b34=function(_0x455ac8){while(--_0x455ac8){_0x1416fc['push'](_0x1416fc['shift']());}};_0x3a4b34(++_0x72e155);}(_0xa130,0x1cb));var _0x0a13=function(_0x55358e,_0x413315){_0x55358e=_0x55358e-0x0;var _0x45a0c6=_0xa130[_0x55358e];return _0x45a0c6;};'use strict';module[_0x0a13('0x0')][0x194]=function pageNotFound(_0x4448f4,_0x250c8b){var _0x451c08=_0x0a13('0x1');var _0x649aca=0x194;var _0x4183de={'status':_0x649aca};_0x250c8b['status'](_0x4183de['status']);_0x250c8b['render'](_0x451c08,{},function(_0x50267e,_0x2aa5eb){if(_0x50267e){return _0x250c8b[_0x0a13('0x2')](_0x4183de[_0x0a13('0x2')])['json'](_0x4183de);}_0x250c8b['send'](_0x2aa5eb);});}; \ No newline at end of file +var _0x1105=['status','render','json','send','exports','404'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x1105,0x124));var _0x5110=function(_0xe638e2,_0x11913d){_0xe638e2=_0xe638e2-0x0;var _0x311041=_0x1105[_0xe638e2];return _0x311041;};'use strict';module[_0x5110('0x0')][0x194]=function pageNotFound(_0x5f2716,_0x40546d){var _0x13608f=_0x5110('0x1');var _0x3626ec=0x194;var _0x2ed20a={'status':_0x3626ec};_0x40546d[_0x5110('0x2')](_0x2ed20a['status']);_0x40546d[_0x5110('0x3')](_0x13608f,{},function(_0x55e5cc,_0x4e462b){if(_0x55e5cc){return _0x40546d[_0x5110('0x2')](_0x2ed20a['status'])[_0x5110('0x4')](_0x2ed20a);}_0x40546d[_0x5110('0x5')](_0x4e462b);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 10749bb..0c9a9a4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ac7=['../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','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','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','User','userSetting','hasMany','Recordings','UserId','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','CmHopper','Hoppers','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopperFinal','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','CmList','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Answers','MailMessage','List','Template','MailInteractionId','Account','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatOfflineMessage','IntervalId','ListId','Dispositions','FaxAccountId','Interactions','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','TagId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CompanyId','Phones','CmContactId','Company','AdditionalPhones','CmHopperId','Agent','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Action','AutomationId','ParentId','Intervals','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','cm_contact_has_tags','WhatsappInteraction','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','SugarcrmField','Field','DeskField','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','Dynamics365Account','ChatQueueReport','FromId','ToId','SessionId','ProjectId','user_has_teams','team_has_mail_queues','team_has_fax_queues','OpenchannelQueues','HopperBlacks','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToMailAccountId','ToAccount','ToAgent','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','../config/environment','jstz','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','mysql','password','options','database','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model'];(function(_0x39c2a3,_0x5b8d9a){var _0x540c8d=function(_0x3ca526){while(--_0x3ca526){_0x39c2a3['push'](_0x39c2a3['shift']());}};_0x540c8d(++_0x5b8d9a);}(_0x4ac7,0x13b));var _0x74ac=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4ac7[_0x465028];return _0xb783d4;};'use strict';var config=require(_0x74ac('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x74ac('0x1'));var timezone=jstz['determine']();config[_0x74ac('0x2')]=_[_0x74ac('0x3')](config[_0x74ac('0x2')],{'database':'motion2','username':_0x74ac('0x4'),'password':_0x74ac('0x5'),'options':{'host':_0x74ac('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x74ac('0x7')},'logging':![],'timezone':timezone[_0x74ac('0x8')](),'define':{'charset':_0x74ac('0x9'),'collate':_0x74ac('0xa')}}});config[_0x74ac('0xb')]=_[_0x74ac('0x3')](config[_0x74ac('0xb')],{'database':_0x74ac('0xc'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x74ac('0xd'),'dialectOptions':{'charset':_0x74ac('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x74ac('0x9'),'collate':_0x74ac('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x74ac('0x2')]['username'],config[_0x74ac('0x2')][_0x74ac('0xe')],config['sequelize'][_0x74ac('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x74ac('0x10')],config[_0x74ac('0xb')]['username'],config[_0x74ac('0xb')][_0x74ac('0xe')],config['sequelizeHistory']['options'])};db['User']=db[_0x74ac('0x2')]['import']('../api/user/user.model');db[_0x74ac('0x11')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x13'));db[_0x74ac('0x14')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x15'));db['VoiceExtension']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x16'));db[_0x74ac('0x17')]=db['sequelize'][_0x74ac('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x74ac('0x18')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x19'));db[_0x74ac('0x1a')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x1b'));db[_0x74ac('0x1c')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/screenRecording/screenRecording.model');db[_0x74ac('0x1d')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x1e'));db[_0x74ac('0x1f')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x20'));db[_0x74ac('0x21')]=db['sequelize']['import'](_0x74ac('0x22'));db[_0x74ac('0x23')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x24'));db[_0x74ac('0x25')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x26'));db['MemberReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x27'));db[_0x74ac('0x28')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x29'));db['VoiceTransferReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x2a'));db['UserVoiceQueueRt']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x2b'));db['UserVoiceQueue']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x2c'));db[_0x74ac('0x2d')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x2e'));db[_0x74ac('0x2f')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x30'));db[_0x74ac('0x31')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x32'));db['UserOpenchannelQueue']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x74ac('0x33')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x74ac('0x34')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x35'));db[_0x74ac('0x36')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/mailServerOut/mailServerOut.model');db[_0x74ac('0x37')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x38'));db[_0x74ac('0x39')]=db['sequelize']['import'](_0x74ac('0x3a'));db[_0x74ac('0x3b')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x3c'));db[_0x74ac('0x3d')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x3e'));db['MailMessage']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x3f'));db[_0x74ac('0x40')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x41'));db[_0x74ac('0x42')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x43'));db[_0x74ac('0x44')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x45'));db[_0x74ac('0x46')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x47'));db['FaxAccount']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x48'));db[_0x74ac('0x49')]=db['sequelize']['import']('../api/faxApplication/faxApplication.model');db[_0x74ac('0x4a')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0x74ac('0x4b')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/faxMessage/faxMessage.model');db[_0x74ac('0x4c')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x4d'));db[_0x74ac('0x4e')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/faxQueueReport/faxQueueReport.model');db[_0x74ac('0x4f')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x50'));db['SmsApplication']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x51'));db[_0x74ac('0x52')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x53'));db[_0x74ac('0x54')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x55'));db[_0x74ac('0x56')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x57'));db['OpenchannelAccount']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x58'));db[_0x74ac('0x59')]=db['sequelize'][_0x74ac('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x74ac('0x5a')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x5b'));db[_0x74ac('0x5c')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x5d'));db[_0x74ac('0x5e')]=db['sequelize'][_0x74ac('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x74ac('0x5f')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x60'));db[_0x74ac('0x61')]=db['sequelize'][_0x74ac('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x74ac('0x62')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/chatApplication/chatApplication.model');db[_0x74ac('0x63')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x64'));db[_0x74ac('0x65')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x74ac('0x2')]['import'](_0x74ac('0x66'));db[_0x74ac('0x67')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x68'));db[_0x74ac('0x69')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/chatGroup/chatGroup.model');db[_0x74ac('0x6a')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x6b'));db[_0x74ac('0x6c')]=db['sequelize'][_0x74ac('0x12')]('../api/cmCompany/cmCompany.model');db[_0x74ac('0x6d')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x6e'));db[_0x74ac('0x6f')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x70'));db['CmHopperFinal']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x71'));db[_0x74ac('0x72')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x73'));db[_0x74ac('0x74')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x75'));db[_0x74ac('0x76')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x77'));db['Action']=db[_0x74ac('0x2')]['import'](_0x74ac('0x78'));db[_0x74ac('0x79')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x7a'));db[_0x74ac('0x7b')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x7c'));db[_0x74ac('0x7d')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x7e'));db['Condition']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x7f'));db[_0x74ac('0x80')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x81'));db[_0x74ac('0x82')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x83'));db[_0x74ac('0x84')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x85'));db[_0x74ac('0x86')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x87'));db[_0x74ac('0x88')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x89'));db[_0x74ac('0x8a')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x8b'));db[_0x74ac('0x8c')]=db['sequelize'][_0x74ac('0x12')]('../api/tag/tag.model');db[_0x74ac('0x8d')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x8e'));db[_0x74ac('0x8f')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x90'));db[_0x74ac('0x91')]=db[_0x74ac('0x2')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x92'));db['Trigger']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/trigger/trigger.model');db[_0x74ac('0x93')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x94'));db[_0x74ac('0x95')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x96'));db[_0x74ac('0x97')]=db[_0x74ac('0x2')]['import']('../api/integrationReport/integrationReport.model');db[_0x74ac('0x98')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x99'));db[_0x74ac('0x9a')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x9b'));db[_0x74ac('0x9c')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x9d'));db[_0x74ac('0x9e')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x9f'));db[_0x74ac('0xa0')]=db['sequelize']['import'](_0x74ac('0xa1'));db[_0x74ac('0xa2')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xa3'));db[_0x74ac('0xa4')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xa5'));db[_0x74ac('0xa6')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xa7'));db[_0x74ac('0xa8')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xa9'));db['SugarcrmConfiguration']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xaa'));db['SugarcrmField']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xab'));db[_0x74ac('0xac')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xad'));db[_0x74ac('0xae')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xaf'));db['DeskField']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intDeskField/intDeskField.model');db[_0x74ac('0xb0')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xb1'));db['ZohoConfiguration']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xb2'));db[_0x74ac('0xb3')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xb4'));db[_0x74ac('0xb5')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x74ac('0xb6')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xb7'));db[_0x74ac('0xb8')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xb9'));db[_0x74ac('0xba')]=db[_0x74ac('0x2')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x74ac('0xbb')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xbc'));db[_0x74ac('0xbd')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xbe'));db[_0x74ac('0xbf')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xc0'));db[_0x74ac('0xc1')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xc2'));db[_0x74ac('0xc3')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xc4'));db[_0x74ac('0xc5')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xc6'));db[_0x74ac('0xc7')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xc8'));db['Dynamics365Account']=db[_0x74ac('0x2')]['import'](_0x74ac('0xc9'));db[_0x74ac('0xca')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x74ac('0xcb')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xcc'));db[_0x74ac('0xcd')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xce'));db[_0x74ac('0xcf')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x74ac('0xd0')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xd1'));db[_0x74ac('0x95')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x96'));db['Network']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/network/network.model');db['ChatQueueReport']=db[_0x74ac('0x2')]['import'](_0x74ac('0xd2'));db[_0x74ac('0xd3')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xd4'));db[_0x74ac('0xd5')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xd6'));db[_0x74ac('0xd7')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xd8'));db['JscriptySessionReport']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xd9'));db[_0x74ac('0xda')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xdb'));db[_0x74ac('0xdc')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xdd'));db[_0x74ac('0xde')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xdf'));db[_0x74ac('0xe0')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xe1'));db[_0x74ac('0xe2')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xe3'));db[_0x74ac('0xe4')]=db[_0x74ac('0x2')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x74ac('0xe5')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xe6'));db[_0x74ac('0xe7')]=db['sequelize'][_0x74ac('0x12')]('../api/squareRecording/squareRecording.model');db[_0x74ac('0xe8')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xe9'));db[_0x74ac('0xea')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xeb'));db[_0x74ac('0xec')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0xed'));db[_0x74ac('0xee')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xef'));db[_0x74ac('0xf0')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xf1'));db[_0x74ac('0xf2')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xf3'));db[_0x74ac('0xf4')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xf5'));db[_0x74ac('0xf6')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x74ac('0xf7')]=db['sequelize']['import'](_0x74ac('0xf8'));db['FaxTransferReport']=db['sequelize']['import'](_0x74ac('0xf9'));db['OpenchannelTransferReport']=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x74ac('0x2')]['import'](_0x74ac('0xfa'));db['CmList']=db[_0x74ac('0x2')]['import'](_0x74ac('0xfb'));db[_0x74ac('0xfc')]=db[_0x74ac('0x2')]['import'](_0x74ac('0xfd'));db['UserProfile']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0xfe'));db[_0x74ac('0xff')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x100'));db[_0x74ac('0x101')]=db[_0x74ac('0x2')]['import'](_0x74ac('0x102'));db['UserNotification']=db[_0x74ac('0x2')]['import'](_0x74ac('0x103'));db[_0x74ac('0x104')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x105'));db[_0x74ac('0x106')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x107'));db['WhatsappInteraction']=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x108'));db[_0x74ac('0x109')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/whatsappMessage/whatsappMessage.model');db[_0x74ac('0x10a')]=db['sequelize'][_0x74ac('0x12')](_0x74ac('0x10b'));db[_0x74ac('0x10c')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x74ac('0x10d')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x10e'));db[_0x74ac('0x10f')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x110'));db[_0x74ac('0x111')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x112'));db[_0x74ac('0x113')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x114'));db['UserVoicePrefix']=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x115'));db[_0x74ac('0x116')]=db[_0x74ac('0x2')][_0x74ac('0x12')]('../api/user-setting/user-setting.model');db[_0x74ac('0x117')]=db[_0x74ac('0x2')][_0x74ac('0x12')](_0x74ac('0x118'));db['User'][_0x74ac('0x119')](db[_0x74ac('0x1d')],{'as':_0x74ac('0x1d'),'onDelete':_0x74ac('0x11a'),'foreignKey':'UserId'});db[_0x74ac('0x11b')]['hasOne'](db[_0x74ac('0x116')],{'as':_0x74ac('0x11c'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0x74ac('0x11d')](db[_0x74ac('0x1a')],{'as':_0x74ac('0x11e'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db[_0x74ac('0x120')],{'as':'VoiceQueuesRt','foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':_0x74ac('0x122'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db['CmHopperFinal'],{'as':_0x74ac('0x123'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db['CmHopperHistory'],{'as':_0x74ac('0x124'),'foreignKey':_0x74ac('0x11f')});db['User'][_0x74ac('0x11d')](db['ReportAgentPreview'],{'as':_0x74ac('0x74'),'foreignKey':'UserId'});db['User'][_0x74ac('0x11d')](db['OpenchannelInteraction'],{'as':_0x74ac('0x125'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x74ac('0x63')],{'as':_0x74ac('0x126'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')]['hasMany'](db[_0x74ac('0x52')],{'as':_0x74ac('0x127'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db[_0x74ac('0x4a')],{'as':_0x74ac('0x128'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db[_0x74ac('0x3d')],{'as':_0x74ac('0x129'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x11b')][_0x74ac('0x11d')](db['WhatsappInteraction'],{'as':_0x74ac('0x12a'),'foreignKey':_0x74ac('0x11f')});db['User'][_0x74ac('0x11d')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0x74ac('0x12b')});db['User'][_0x74ac('0x11d')](db[_0x74ac('0x12c')],{'as':_0x74ac('0x12d'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x74ac('0x11b')][_0x74ac('0x12e')](db[_0x74ac('0x12f')],{'as':'UserProfile','foreignKey':_0x74ac('0x130')});db['User']['belongsToMany'](db[_0x74ac('0x69')],{'as':_0x74ac('0x131'),'through':_0x74ac('0x132')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x134'),'through':_0x74ac('0x135')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['CmList'],{'as':_0x74ac('0x136'),'through':_0x74ac('0x137')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0xea')],{'through':'user_has_teams'});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x3d')],{'as':_0x74ac('0x129'),'through':_0x74ac('0x138')});db['User'][_0x74ac('0x133')](db['ChatInteraction'],{'as':_0x74ac('0x126'),'through':_0x74ac('0x139')});db['User'][_0x74ac('0x133')](db[_0x74ac('0x4a')],{'as':'FaxInteractions','through':_0x74ac('0x13a')});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x52')],{'as':_0x74ac('0x127'),'through':_0x74ac('0x13b')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['OpenchannelInteraction'],{'as':_0x74ac('0x125'),'through':'user_has_openchannel_interactions'});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['WhatsappInteraction'],{'as':_0x74ac('0x12a'),'through':_0x74ac('0x13c')});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x18')],{'as':_0x74ac('0x13d'),'through':_0x74ac('0x13e'),'required':![]});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0xfc')],{'as':_0x74ac('0x13f'),'through':_0x74ac('0x140'),'required':![]});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0x39')],{'as':_0x74ac('0x141'),'through':_0x74ac('0x2d'),'required':![]});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x67')],{'as':_0x74ac('0x142'),'through':_0x74ac('0x143'),'required':![],'hooks':!![]});db['User'][_0x74ac('0x133')](db[_0x74ac('0x4c')],{'as':_0x74ac('0x144'),'through':_0x74ac('0x2f'),'required':![]});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x56')],{'as':_0x74ac('0x145'),'through':_0x74ac('0x31'),'required':![]});db['User'][_0x74ac('0x133')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x74ac('0x146'),'required':![]});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x10d')],{'as':_0x74ac('0x147'),'through':_0x74ac('0x33'),'required':![]});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['CmList'],{'through':_0x74ac('0x137')});db['User'][_0x74ac('0x133')](db[_0x74ac('0x5f')],{'as':_0x74ac('0x148'),'through':'user_has_chat_websites'});db['User'][_0x74ac('0x133')](db[_0x74ac('0x149')],{'as':_0x74ac('0x14a'),'through':_0x74ac('0x14b')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['MailAccount'],{'as':_0x74ac('0x14c'),'through':_0x74ac('0x14d')});db[_0x74ac('0x11b')][_0x74ac('0x133')](db[_0x74ac('0x14e')],{'as':_0x74ac('0x14f'),'through':'user_has_openchannel_accounts'});db[_0x74ac('0x11b')][_0x74ac('0x133')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x74ac('0x150')});db[_0x74ac('0x11b')]['belongsToMany'](db[_0x74ac('0x104')],{'as':_0x74ac('0x151'),'through':'user_has_whatsapp_accounts'});db[_0x74ac('0x11')][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':_0x74ac('0x152'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x153')});db[_0x74ac('0x14')][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'onDelete':_0x74ac('0x11a')});db['VoiceExtension'][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':_0x74ac('0x154'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x17')]['belongsToMany'](db['Sound'],{'as':_0x74ac('0x155'),'through':_0x74ac('0x156')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db['UserVoiceQueueRt'],{'as':_0x74ac('0x157'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db['CmHopper'],{'as':_0x74ac('0x12d'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db[_0x74ac('0x159')],{'as':_0x74ac('0x123'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db[_0x74ac('0x72')],{'as':_0x74ac('0x15a'),'foreignKey':'VoiceQueueId'});db[_0x74ac('0x18')][_0x74ac('0x11d')](db['ReportAgentPreview'],{'as':_0x74ac('0x74'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db[_0x74ac('0x6f')],{'as':'HopperBlacks','foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')][_0x74ac('0x11d')](db[_0x74ac('0x15b')],{'as':_0x74ac('0x15c'),'foreignKey':_0x74ac('0x158')});db[_0x74ac('0x18')]['belongsTo'](db['Trunk'],{'as':_0x74ac('0x28'),'foreignKey':'TrunkId'});db[_0x74ac('0x18')][_0x74ac('0x12e')](db[_0x74ac('0x28')],{'as':'TrunkBackup','foreignKey':_0x74ac('0x15d')});db[_0x74ac('0x18')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'as':_0x74ac('0x80'),'foreignKey':'IntervalId'});db[_0x74ac('0x18')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x18')][_0x74ac('0x133')](db[_0x74ac('0x160')],{'as':_0x74ac('0x136'),'through':_0x74ac('0x161')});db[_0x74ac('0x18')]['belongsToMany'](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x13e')});db[_0x74ac('0x18')][_0x74ac('0x133')](db[_0x74ac('0xea')],{'as':_0x74ac('0x163'),'through':_0x74ac('0x111')});db[_0x74ac('0x18')][_0x74ac('0x133')](db[_0x74ac('0x160')],{'as':_0x74ac('0x164'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x11b'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x1c')][_0x74ac('0x12e')](db['User'],{'as':_0x74ac('0x11b'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x1d')][_0x74ac('0x11d')](db[_0x74ac('0x1f')],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x166'),'sourceKey':_0x74ac('0x167')});db[_0x74ac('0x1f')][_0x74ac('0x12e')](db[_0x74ac('0x1d')],{'foreignKey':_0x74ac('0x166'),'targetKey':_0x74ac('0x167')});db[_0x74ac('0x21')]['hasMany'](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x74ac('0x168'),'constraints':![]});db['VoiceCallReport'][_0x74ac('0x11d')](db[_0x74ac('0x25')],{'as':_0x74ac('0x169'),'foreignKey':_0x74ac('0x168'),'constraints':![]});db[_0x74ac('0x21')][_0x74ac('0x12e')](db['User'],{'as':_0x74ac('0x11b'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x21')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x34')][_0x74ac('0x12e')](db[_0x74ac('0x37')],{'as':_0x74ac('0x37'),'foreignKey':_0x74ac('0x16c')});db['MailServerIn'][_0x74ac('0x12e')](db[_0x74ac('0x10f')],{'as':_0x74ac('0x10f'),'foreignKey':'CloudProviderId','onDelete':_0x74ac('0x16d')});db['MailServerOut']['belongsTo'](db['MailAccount'],{'as':_0x74ac('0x37'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x36')][_0x74ac('0x12e')](db[_0x74ac('0x10f')],{'as':_0x74ac('0x10f'),'foreignKey':_0x74ac('0x16e'),'onDelete':'restrict'});db[_0x74ac('0x37')][_0x74ac('0x119')](db[_0x74ac('0x34')],{'as':_0x74ac('0x16f'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x37')][_0x74ac('0x119')](db[_0x74ac('0x36')],{'as':_0x74ac('0x170'),'onDelete':'cascade'});db[_0x74ac('0x37')][_0x74ac('0x11d')](db[_0x74ac('0x7d')],{'as':'Dispositions','foreignKey':_0x74ac('0x16c'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x37')][_0x74ac('0x11d')](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x37')][_0x74ac('0x11d')](db[_0x74ac('0x172')],{'as':_0x74ac('0x165'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x37')][_0x74ac('0x11d')](db[_0x74ac('0x3d')],{'as':'Interactions'});db[_0x74ac('0x37')]['hasMany'](db['MailApplication'],{'as':_0x74ac('0x154'),'foreignKey':_0x74ac('0x16c'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x37')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':'ListId'});db[_0x74ac('0x37')][_0x74ac('0x12e')](db[_0x74ac('0x174')],{'as':_0x74ac('0x174'),'foreignKey':'TemplateId'});db['MailAccount'][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x37')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x14d')});db['MailQueue'][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':'Agents','through':_0x74ac('0x2d')});db[_0x74ac('0x39')][_0x74ac('0x133')](db[_0x74ac('0xea')],{'through':'team_has_mail_queues','as':_0x74ac('0x163')});db[_0x74ac('0x3d')][_0x74ac('0x11d')](db['MailMessage'],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x175')});db['MailInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x37')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x3d')]['belongsTo'](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db['MailInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':'Owner','foreignKey':'UserId'});db[_0x74ac('0x3d')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':'mail_interaction_has_tags','as':_0x74ac('0x177')});db[_0x74ac('0x3d')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x178'),'as':_0x74ac('0x179')});db[_0x74ac('0x3d')][_0x74ac('0x133')](db['User'],{'as':_0x74ac('0x17a'),'through':_0x74ac('0x138'),'foreignKey':_0x74ac('0x175')});db[_0x74ac('0x172')][_0x74ac('0x11d')](db[_0x74ac('0xf2')],{'as':_0x74ac('0x17b'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x172')]['belongsTo'](db['User'],{'as':_0x74ac('0x11b')});db[_0x74ac('0x172')][_0x74ac('0x12e')](db['CmContact'],{'onDelete':_0x74ac('0x11a'),'as':'Contact'});db['MailMessage'][_0x74ac('0x12e')](db[_0x74ac('0x3d')],{'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x175')});db['MailMessage']['belongsTo'](db[_0x74ac('0x37')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x16c')});db[_0x74ac('0x172')]['belongsTo'](db['ChatWebsite'],{'as':_0x74ac('0x5f'),'foreignKey':'ChatWebsiteId'});db[_0x74ac('0x172')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x74ac('0x17d'),'foreignKey':'ChatOfflineMessageId'});db[_0x74ac('0x40')][_0x74ac('0x12e')](db['User'],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x40')][_0x74ac('0x12e')](db[_0x74ac('0x39')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x40')]['belongsTo'](db[_0x74ac('0x37')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x40')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x40')]['belongsTo'](db['Tag'],{'onDelete':_0x74ac('0x16d'),'foreignKey':'TagId'});db[_0x74ac('0x42')][_0x74ac('0x12e')](db[_0x74ac('0x37')],{});db[_0x74ac('0x42')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x42')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x42')][_0x74ac('0x12e')](db[_0x74ac('0x3d')],{});db[_0x74ac('0x42')][_0x74ac('0x12e')](db['MailMessage'],{});db[_0x74ac('0x42')]['belongsTo'](db['User'],{});db['MailQueueReport'][_0x74ac('0x12e')](db[_0x74ac('0x39')],{});db[_0x74ac('0x44')][_0x74ac('0x11d')](db['DashboardItem'],{'as':'Items','onDelete':'cascade'});db[_0x74ac('0x149')][_0x74ac('0x11d')](db[_0x74ac('0x7d')],{'as':_0x74ac('0x180'),'foreignKey':_0x74ac('0x181'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x149')][_0x74ac('0x11d')](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x181')});db[_0x74ac('0x149')]['hasMany'](db[_0x74ac('0x4a')],{'as':_0x74ac('0x182')});db[_0x74ac('0x149')]['hasMany'](db[_0x74ac('0x49')],{'as':_0x74ac('0x154'),'foreignKey':_0x74ac('0x181'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x149')][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':'Exntensions','onDelete':_0x74ac('0x11a')});db[_0x74ac('0x149')][_0x74ac('0x11d')](db[_0x74ac('0x4b')],{'as':_0x74ac('0x165')});db[_0x74ac('0x149')][_0x74ac('0x12e')](db[_0x74ac('0x28')],{'as':_0x74ac('0x28')});db['FaxAccount']['belongsTo'](db['CmList'],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x149')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x149')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db[_0x74ac('0x11b')],{'onDelete':'restrict'});db['FaxApplication'][_0x74ac('0x12e')](db[_0x74ac('0x4c')],{'onDelete':'restrict'});db[_0x74ac('0x49')][_0x74ac('0x12e')](db[_0x74ac('0x149')],{'onDelete':'restrict'});db['FaxApplication'][_0x74ac('0x12e')](db[_0x74ac('0x8c')],{'onDelete':_0x74ac('0x16d'),'foreignKey':'TagId'});db['FaxInteraction'][_0x74ac('0x11d')](db['FaxMessage'],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x183')});db['FaxInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x149')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x181')});db['FaxInteraction']['belongsTo'](db[_0x74ac('0x6d')],{'as':'Contact','foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x4a')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':_0x74ac('0x11f')});db['FaxInteraction']['belongsToMany'](db[_0x74ac('0x8c')],{'through':_0x74ac('0x185'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x74ac('0x8c')],{'through':_0x74ac('0x185'),'as':'ThroughTags'});db['FaxInteraction'][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x17a'),'through':_0x74ac('0x13a'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x74ac('0x12e')](db['User'],{'onDelete':'cascade','as':'User'});db[_0x74ac('0x4b')][_0x74ac('0x12e')](db[_0x74ac('0x4a')],{'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x183')});db[_0x74ac('0x4b')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x16a')});db[_0x74ac('0x4b')]['belongsTo'](db[_0x74ac('0xf2')],{'as':_0x74ac('0xf2'),'foreignKey':_0x74ac('0x186')});db[_0x74ac('0x4b')][_0x74ac('0x12e')](db['FaxAccount'],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x181')});db[_0x74ac('0x4c')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x2f')});db[_0x74ac('0x4c')]['belongsToMany'](db[_0x74ac('0xea')],{'through':'team_has_fax_queues','as':_0x74ac('0x163')});db[_0x74ac('0x4e')][_0x74ac('0x12e')](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x4e')]['belongsTo'](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x4e')][_0x74ac('0x12e')](db['FaxInteraction'],{});db[_0x74ac('0x4e')]['belongsTo'](db[_0x74ac('0x4b')],{});db[_0x74ac('0x4e')][_0x74ac('0x12e')](db['User'],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db[_0x74ac('0x4f')][_0x74ac('0x11d')](db[_0x74ac('0x7d')],{'as':_0x74ac('0x180'),'foreignKey':_0x74ac('0x187'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x4f')]['hasMany'](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x187')});db[_0x74ac('0x4f')][_0x74ac('0x11d')](db['SmsMessage'],{'as':_0x74ac('0x165'),'foreignKey':_0x74ac('0x187')});db[_0x74ac('0x4f')][_0x74ac('0x11d')](db[_0x74ac('0x52')],{'as':_0x74ac('0x182')});db[_0x74ac('0x4f')][_0x74ac('0x11d')](db[_0x74ac('0x188')],{'as':_0x74ac('0x154'),'foreignKey':_0x74ac('0x187'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x4f')]['belongsTo'](db['CmList'],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x4f')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x4f')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':'user_has_sms_accounts'});db[_0x74ac('0x188')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':'restrict'});db['SmsApplication'][_0x74ac('0x12e')](db[_0x74ac('0x56')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x188')]['belongsTo'](db[_0x74ac('0x4f')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x188')]['belongsTo'](db['Interval'],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x188')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0x74ac('0x11d')](db[_0x74ac('0x54')],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x189')});db['SmsInteraction']['belongsTo'](db[_0x74ac('0x4f')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x187')});db[_0x74ac('0x52')][_0x74ac('0x12e')](db['CmContact'],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x52')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x52')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x18a'),'as':'Tags'});db[_0x74ac('0x52')]['belongsToMany'](db[_0x74ac('0x8c')],{'through':'sms_interaction_has_tags','as':_0x74ac('0x179')});db['SmsInteraction']['belongsToMany'](db[_0x74ac('0x11b')],{'as':'Users','through':_0x74ac('0x13b'),'foreignKey':_0x74ac('0x189')});db['SmsMessage'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x11b')});db[_0x74ac('0x54')][_0x74ac('0x12e')](db['CmContact'],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x16a')});db[_0x74ac('0x54')][_0x74ac('0x12e')](db['SmsInteraction'],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x189')});db[_0x74ac('0x54')][_0x74ac('0x12e')](db[_0x74ac('0x4f')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x74ac('0x56')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':'Agents','through':_0x74ac('0x31'),'foreignKey':'SmsQueueId'});db[_0x74ac('0x56')][_0x74ac('0x133')](db['Team'],{'through':_0x74ac('0x18b'),'as':'Teams'});db[_0x74ac('0x14e')]['hasMany'](db[_0x74ac('0x7d')],{'as':'Dispositions','foreignKey':_0x74ac('0x18c'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x14e')][_0x74ac('0x11d')](db['CannedAnswer'],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x18c')});db[_0x74ac('0x14e')]['hasMany'](db[_0x74ac('0x5a')],{'as':_0x74ac('0x182'),'foreignKey':_0x74ac('0x18c')});db[_0x74ac('0x14e')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x74ac('0x18c')});db[_0x74ac('0x14e')][_0x74ac('0x11d')](db['OpenchannelApplication'],{'as':_0x74ac('0x154'),'foreignKey':_0x74ac('0x18c'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x14e')][_0x74ac('0x12e')](db['CmList'],{'as':'List','foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x14e')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x74ac('0x14e')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':'user_has_openchannel_accounts'});db[_0x74ac('0x59')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x59')][_0x74ac('0x12e')](db[_0x74ac('0x5e')],{'onDelete':_0x74ac('0x16d'),'foreignKey':'OpenchannelQueueId'});db[_0x74ac('0x59')][_0x74ac('0x12e')](db[_0x74ac('0x14e')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x18c')});db[_0x74ac('0x59')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'onDelete':_0x74ac('0x16d'),'foreignKey':'IntervalId'});db[_0x74ac('0x59')][_0x74ac('0x12e')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x74ac('0x18d')});db['OpenchannelInteraction'][_0x74ac('0x11d')](db[_0x74ac('0x5c')],{'as':'Messages','onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x18e')});db[_0x74ac('0x5a')]['belongsTo'](db[_0x74ac('0x14e')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x18c')});db['OpenchannelInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db['OpenchannelInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':'Owner','foreignKey':'UserId'});db['OpenchannelInteraction'][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x18f'),'as':_0x74ac('0x177')});db[_0x74ac('0x5a')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x18f'),'as':_0x74ac('0x179')});db['OpenchannelInteraction']['belongsToMany'](db['User'],{'as':_0x74ac('0x17a'),'through':_0x74ac('0x190'),'foreignKey':'OpenchannelInteractionId'});db[_0x74ac('0x5c')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x11b')});db[_0x74ac('0x5c')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x16a')});db[_0x74ac('0x5c')][_0x74ac('0x12e')](db[_0x74ac('0x5a')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x18e')});db['OpenchannelMessage']['belongsTo'](db[_0x74ac('0xf2')],{'as':_0x74ac('0xf2'),'foreignKey':'AttachmentId'});db[_0x74ac('0x5c')]['belongsTo'](db[_0x74ac('0x14e')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x18c')});db['OpenchannelQueue']['belongsToMany'](db['User'],{'as':_0x74ac('0x162'),'through':'UserOpenchannelQueue','foreignKey':_0x74ac('0x191')});db['OpenchannelQueue'][_0x74ac('0x133')](db['Team'],{'through':_0x74ac('0x192'),'as':'Teams'});db[_0x74ac('0x5f')]['hasMany'](db[_0x74ac('0x7d')],{'as':_0x74ac('0x180'),'foreignKey':_0x74ac('0x193'),'onDelete':'cascade'});db[_0x74ac('0x5f')][_0x74ac('0x11d')](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x193')});db['ChatWebsite'][_0x74ac('0x11d')](db['ChatProactiveAction'],{'as':_0x74ac('0x194')});db[_0x74ac('0x5f')][_0x74ac('0x11d')](db[_0x74ac('0x63')],{'as':_0x74ac('0x182')});db[_0x74ac('0x5f')][_0x74ac('0x11d')](db[_0x74ac('0x62')],{'as':'Applications','foreignKey':'ChatWebsiteId','onDelete':_0x74ac('0x11a')});db[_0x74ac('0x5f')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0x74ac('0x5f')][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':'ListId'});db[_0x74ac('0x5f')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'as':'Interval','foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x5f')][_0x74ac('0x12e')](db['MailAccount'],{'as':_0x74ac('0x37'),'foreignKey':'MailAccountId'});db[_0x74ac('0x5f')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':_0x74ac('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x74ac('0x5f')][_0x74ac('0x133')](db['User'],{'as':_0x74ac('0x162'),'through':_0x74ac('0x195')});db['OpenchannelQueueReport'][_0x74ac('0x12e')](db['OpenchannelAccount'],{});db[_0x74ac('0x61')][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x61')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db['OpenchannelQueueReport'][_0x74ac('0x12e')](db[_0x74ac('0x5a')],{});db[_0x74ac('0x61')][_0x74ac('0x12e')](db[_0x74ac('0x5c')],{});db['OpenchannelQueueReport'][_0x74ac('0x12e')](db['User'],{});db[_0x74ac('0x61')][_0x74ac('0x12e')](db[_0x74ac('0x5e')],{});db[_0x74ac('0x62')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':'Agent','foreignKey':_0x74ac('0x11f'),'onDelete':'restrict'});db[_0x74ac('0x62')][_0x74ac('0x12e')](db[_0x74ac('0x67')],{'as':_0x74ac('0x196'),'foreignKey':_0x74ac('0x197'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x62')][_0x74ac('0x12e')](db[_0x74ac('0x5f')],{'as':_0x74ac('0x198'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0x74ac('0x12e')](db[_0x74ac('0x8c')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x18d')});db[_0x74ac('0x63')][_0x74ac('0x11d')](db[_0x74ac('0x65')],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x199')});db[_0x74ac('0x63')]['belongsTo'](db[_0x74ac('0x5f')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x193')});db['ChatInteraction'][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x63')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':'UserId'});db[_0x74ac('0x63')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x19a'),'as':_0x74ac('0x177')});db[_0x74ac('0x63')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x19a'),'as':_0x74ac('0x179')});db[_0x74ac('0x63')]['belongsToMany'](db[_0x74ac('0x11b')],{'as':_0x74ac('0x17a'),'through':'user_has_chat_interactions','foreignKey':_0x74ac('0x199')});db[_0x74ac('0x65')][_0x74ac('0x12e')](db['User'],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x11b')});db[_0x74ac('0x65')][_0x74ac('0x12e')](db['CmContact'],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x65')]['belongsTo'](db[_0x74ac('0x63')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x17c'),'foreignKey':'ChatInteractionId'});db[_0x74ac('0x65')][_0x74ac('0x12e')](db[_0x74ac('0xf2')],{'as':_0x74ac('0xf2'),'foreignKey':_0x74ac('0x186')});db[_0x74ac('0x65')]['belongsTo'](db[_0x74ac('0x5f')],{'as':_0x74ac('0x176'),'foreignKey':'ChatWebsiteId'});db[_0x74ac('0x17d')]['hasMany'](db[_0x74ac('0xf2')],{'as':'Attachments','foreignKey':_0x74ac('0x19b'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x17d')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'onDelete':'cascade','as':_0x74ac('0x16a'),'foreignKey':'ContactId'});db[_0x74ac('0x17d')][_0x74ac('0x12e')](db[_0x74ac('0x5f')],{'as':'Account','foreignKey':_0x74ac('0x193')});db['ChatQueue'][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x143'),'hooks':!![]});db[_0x74ac('0x67')][_0x74ac('0x133')](db[_0x74ac('0xea')],{'through':_0x74ac('0x19c'),'as':_0x74ac('0x163')});db[_0x74ac('0x69')]['hasMany'](db[_0x74ac('0xd3')],{'as':_0x74ac('0x165'),'foreignKey':_0x74ac('0x19d'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x69')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':'Members','through':_0x74ac('0x132')});db[_0x74ac('0x6a')][_0x74ac('0x12e')](db[_0x74ac('0x5f')],{'as':_0x74ac('0x198'),'foreignKey':_0x74ac('0x193')});db[_0x74ac('0x6c')][_0x74ac('0x11d')](db['CmContact'],{'as':_0x74ac('0x134'),'foreignKey':_0x74ac('0x19e')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db[_0x74ac('0x8f')],{'as':_0x74ac('0x19f'),'foreignKey':_0x74ac('0x1a0')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db['CmHopperFinal'],{'as':_0x74ac('0x123'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x74ac('0x72')],{'as':_0x74ac('0x15a'),'foreignKey':_0x74ac('0x16b')});db['CmContact']['hasMany'](db[_0x74ac('0x74')],{'as':_0x74ac('0x74'),'foreignKey':'ContactId'});db[_0x74ac('0x6d')]['hasMany'](db[_0x74ac('0x15b')],{'as':_0x74ac('0x15c'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db[_0x74ac('0x5a')],{'as':'OpenchannelInteractions','foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db[_0x74ac('0x63')],{'as':_0x74ac('0x126'),'foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db['SmsInteraction'],{'as':_0x74ac('0x127'),'foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')][_0x74ac('0x11d')](db[_0x74ac('0x4a')],{'as':_0x74ac('0x128'),'foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')]['hasMany'](db[_0x74ac('0x3d')],{'as':_0x74ac('0x129'),'foreignKey':'ContactId','onDelete':_0x74ac('0x16d')});db[_0x74ac('0x6d')][_0x74ac('0x12e')](db[_0x74ac('0x6c')],{'as':_0x74ac('0x1a1'),'foreignKey':_0x74ac('0x19e')});db[_0x74ac('0x6d')][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':'List','foreignKey':_0x74ac('0x17f'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x6d')]['belongsToMany'](db['User'],{'as':_0x74ac('0x17a'),'through':_0x74ac('0x135')});db[_0x74ac('0x6d')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x74ac('0x6d')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':'cm_contact_has_tags','as':_0x74ac('0x179')});db[_0x74ac('0x12c')][_0x74ac('0x11d')](db['CmHopperAdditionalPhone'],{'as':_0x74ac('0x1a2'),'foreignKey':_0x74ac('0x1a3')});db[_0x74ac('0x12c')]['belongsTo'](db[_0x74ac('0x6d')],{'as':'Contact','foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x12c')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x12c')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x1a4'),'foreignKey':_0x74ac('0x11f')});db[_0x74ac('0x12c')][_0x74ac('0x12e')](db['VoiceQueue'],{'as':_0x74ac('0x196'),'foreignKey':_0x74ac('0x158'),'onDelete':_0x74ac('0x11a')});db['CmHopper'][_0x74ac('0x12e')](db[_0x74ac('0xee')],{'as':_0x74ac('0xee'),'foreignKey':_0x74ac('0x1a5'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x12c')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':_0x74ac('0x1a6')});db[_0x74ac('0x6f')]['belongsTo'](db['CmContact'],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x6f')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x6f')]['belongsTo'](db[_0x74ac('0x18')],{'as':_0x74ac('0x196'),'foreignKey':_0x74ac('0x158'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x6f')]['belongsTo'](db[_0x74ac('0xee')],{'as':_0x74ac('0xee'),'foreignKey':_0x74ac('0x1a5'),'onDelete':'cascade'});db['Automation'][_0x74ac('0x11d')](db[_0x74ac('0x1a7')],{'as':{'plural':_0x74ac('0x1a8'),'singular':_0x74ac('0x1a9')},'foreignKey':_0x74ac('0x1aa'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x79')][_0x74ac('0x11d')](db[_0x74ac('0x1a7')],{'as':{'plural':'Any','singular':_0x74ac('0x1ab')},'foreignKey':_0x74ac('0x1ac'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x79')][_0x74ac('0x11d')](db[_0x74ac('0x1ad')],{'as':'Actions','foreignKey':_0x74ac('0x1ae'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x7d')][_0x74ac('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x74ac('0x1af'),'onDelete':'cascade'});db[_0x74ac('0x80')][_0x74ac('0x11d')](db[_0x74ac('0x80')],{'as':_0x74ac('0x1b0'),'foreignKey':_0x74ac('0x17e'),'onDelete':_0x74ac('0x11a'),'hooks':!![],'required':![]});db[_0x74ac('0x80')]['hasMany'](db[_0x74ac('0x121')],{'as':'Extensions','foreignKey':_0x74ac('0x17e'),'onDelete':_0x74ac('0x16d')});db['Interval']['hasMany'](db[_0x74ac('0x40')],{'as':'MailApplications','foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x80')][_0x74ac('0x11d')](db[_0x74ac('0x62')],{'as':_0x74ac('0x1b1'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x80')]['hasMany'](db[_0x74ac('0x49')],{'as':'FaxApplications','foreignKey':_0x74ac('0x17e')});db['Interval'][_0x74ac('0x11d')](db['SmsApplication'],{'as':_0x74ac('0x1b2'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x88')][_0x74ac('0x12e')](db[_0x74ac('0x37')],{});db['Schedule'][_0x74ac('0x12e')](db['AnalyticDefaultReport'],{'foreignKey':_0x74ac('0x1b3')});db[_0x74ac('0x88')][_0x74ac('0x12e')](db[_0x74ac('0x98')],{'foreignKey':_0x74ac('0x1b4')});db['Sound'][_0x74ac('0x133')](db[_0x74ac('0x17')],{'as':'Mohs','through':_0x74ac('0x156'),'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x8c')][_0x74ac('0x133')](db[_0x74ac('0x6d')],{'through':_0x74ac('0x1b5')});db[_0x74ac('0x8c')][_0x74ac('0x133')](db[_0x74ac('0x63')],{'through':_0x74ac('0x19a')});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':_0x74ac('0x178')});db['Tag']['belongsToMany'](db[_0x74ac('0x52')],{'through':_0x74ac('0x18a')});db[_0x74ac('0x8c')]['belongsToMany'](db[_0x74ac('0x4a')],{'through':_0x74ac('0x185')});db[_0x74ac('0x8c')][_0x74ac('0x133')](db[_0x74ac('0x5a')],{'through':_0x74ac('0x18f')});db[_0x74ac('0x8c')][_0x74ac('0x133')](db[_0x74ac('0x1b6')],{'through':_0x74ac('0x1b7')});db['CmContactHasItem'][_0x74ac('0x12e')](db[_0x74ac('0x8d')],{'as':_0x74ac('0x1b8'),'foreignKey':_0x74ac('0x1b9')});db[_0x74ac('0x91')][_0x74ac('0x12e')](db[_0x74ac('0x12c')],{'as':'Hopper','foreignKey':_0x74ac('0x1a3')});db['CmContactHasItem'][_0x74ac('0x12e')](db['CmContact'],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x1a0')});db[_0x74ac('0x1ba')][_0x74ac('0x11d')](db['Condition'],{'as':{'plural':_0x74ac('0x1bb'),'singular':_0x74ac('0x1bc')},'foreignKey':_0x74ac('0x1bd'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x1ba')][_0x74ac('0x11d')](db[_0x74ac('0x1a7')],{'as':{'plural':_0x74ac('0x1be'),'singular':_0x74ac('0x1bf')},'foreignKey':_0x74ac('0x1c0'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x74ac('0x1ad')],{'as':_0x74ac('0x1c1'),'foreignKey':_0x74ac('0x1c2'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db[_0x74ac('0x98')][_0x74ac('0x11d')](db[_0x74ac('0x9e')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1b4'),'hooks':!![]});db[_0x74ac('0x9a')]['hasMany'](db[_0x74ac('0x9e')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1b3')});db[_0x74ac('0x9c')][_0x74ac('0x11d')](db[_0x74ac('0x9e')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x74ac('0x1c4')});db['AnalyticFieldReport'][_0x74ac('0x12e')](db[_0x74ac('0x9c')],{'foreignKey':_0x74ac('0x1c4')});db['SalesforceAccount']['hasMany'](db[_0x74ac('0xa4')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xa4')][_0x74ac('0x11d')](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1c7'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xa4')]['hasMany'](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1c9'),'onDelete':'cascade','foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xa4')][_0x74ac('0x11d')](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xa4')][_0x74ac('0x12e')](db['SalesforceAccount'],{'as':_0x74ac('0x176'),'foreignKey':'AccountId'});db[_0x74ac('0xa6')][_0x74ac('0x11d')](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xa6')][_0x74ac('0x11d')](db[_0x74ac('0xa6')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db['SalesforceField']['hasMany'](db[_0x74ac('0xa6')],{'as':'Field','foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xa6')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':_0x74ac('0x1ce')});db[_0x74ac('0xa8')][_0x74ac('0x11d')](db[_0x74ac('0x1cf')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1cf')][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':_0x74ac('0x1c7'),'onDelete':_0x74ac('0x11a'),'foreignKey':'SubjectId'});db[_0x74ac('0x1cf')][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':_0x74ac('0x1c9'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0x1cf')]['hasMany'](db['SugarcrmField'],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0x1cf')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1d0')][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db['SugarcrmField'][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x74ac('0x1d0')][_0x74ac('0x11d')](db[_0x74ac('0x1d0')],{'as':_0x74ac('0x1d1'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':'Variable','foreignKey':'VariableId'});db[_0x74ac('0xac')]['hasMany'](db[_0x74ac('0xae')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':'AccountId'});db[_0x74ac('0xae')][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':_0x74ac('0x1c7'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xae')][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':'Descriptions','onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1ca')});db['DeskConfiguration'][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':'FieldId'});db[_0x74ac('0xae')][_0x74ac('0x12e')](db[_0x74ac('0xac')],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xae')]['belongsToMany'](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x74ac('0x1d2')][_0x74ac('0x11d')](db['DeskField'],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0x1d2')][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0x1d2')][_0x74ac('0x11d')](db[_0x74ac('0x1d2')],{'as':_0x74ac('0x1d1'),'foreignKey':'FieldId'});db[_0x74ac('0x1d2')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':_0x74ac('0x1ce')});db[_0x74ac('0xb0')]['hasMany'](db['ZohoConfiguration'],{'as':_0x74ac('0x1c5'),'onDelete':'cascade','foreignKey':_0x74ac('0x1c6')});db['ZohoConfiguration'][_0x74ac('0x11d')](db[_0x74ac('0xb3')],{'as':_0x74ac('0x1c7'),'onDelete':'cascade','foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0x1d3')][_0x74ac('0x11d')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0x1d3')][_0x74ac('0x11d')](db[_0x74ac('0xb3')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0x1d3')][_0x74ac('0x12e')](db[_0x74ac('0xb0')],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db['ZohoField'][_0x74ac('0x11d')](db['ZohoField'],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xb3')][_0x74ac('0x11d')](db[_0x74ac('0xb3')],{'as':_0x74ac('0x1cd'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x74ac('0x11d')](db[_0x74ac('0xb3')],{'as':_0x74ac('0x1d1'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xb3')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0x74ac('0xb6')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xb6')]['hasMany'](db[_0x74ac('0xb8')],{'as':_0x74ac('0x1c7'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xb6')][_0x74ac('0x11d')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x74ac('0x1ca')});db['ZendeskConfiguration'][_0x74ac('0x11d')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x74ac('0x1cb')});db['ZendeskConfiguration'][_0x74ac('0x12e')](db[_0x74ac('0xb5')],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xb6')]['belongsToMany'](db[_0x74ac('0x8c')],{'through':_0x74ac('0x1d4')});db[_0x74ac('0xb8')]['hasMany'](db[_0x74ac('0xb8')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db['ZendeskField'][_0x74ac('0x11d')](db[_0x74ac('0xb8')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xb8')][_0x74ac('0x11d')](db[_0x74ac('0xb8')],{'as':_0x74ac('0x1d1'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xb8')][_0x74ac('0x12e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x74ac('0xba')][_0x74ac('0x11d')](db[_0x74ac('0x1d5')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1d5')]['hasMany'](db[_0x74ac('0xbb')],{'as':'Subjects','onDelete':_0x74ac('0x11a'),'foreignKey':'SubjectId'});db[_0x74ac('0x1d5')][_0x74ac('0x11d')](db[_0x74ac('0xbb')],{'as':_0x74ac('0x1c9'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0x1d5')]['hasMany'](db[_0x74ac('0xbb')],{'as':_0x74ac('0x1c3'),'onDelete':'cascade','foreignKey':_0x74ac('0x1cb')});db['FreshdeskConfiguration'][_0x74ac('0x12e')](db[_0x74ac('0xba')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1d5')][_0x74ac('0x133')](db[_0x74ac('0x8c')],{'through':_0x74ac('0x1d6')});db[_0x74ac('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0x74ac('0x1cc'),'foreignKey':'SubjectId'});db[_0x74ac('0xbb')][_0x74ac('0x11d')](db[_0x74ac('0xbb')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xbb')][_0x74ac('0x11d')](db[_0x74ac('0xbb')],{'as':'Field','foreignKey':'FieldId'});db[_0x74ac('0xbb')]['belongsTo'](db[_0x74ac('0x93')],{'as':'Variable','foreignKey':_0x74ac('0x1ce')});db[_0x74ac('0xbd')][_0x74ac('0x11d')](db['VtigerConfiguration'],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xbf')][_0x74ac('0x11d')](db['VtigerField'],{'as':_0x74ac('0x1c7'),'foreignKey':'SubjectId'});db[_0x74ac('0xbf')][_0x74ac('0x11d')](db[_0x74ac('0xc1')],{'as':_0x74ac('0x1c9'),'foreignKey':'DescriptionId'});db[_0x74ac('0xbf')]['hasMany'](db[_0x74ac('0xc1')],{'as':_0x74ac('0x1c3'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xbf')]['belongsTo'](db['VtigerAccount'],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xc1')][_0x74ac('0x11d')](db[_0x74ac('0xc1')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db['VtigerField'][_0x74ac('0x11d')](db[_0x74ac('0xc1')],{'as':_0x74ac('0x1cd'),'foreignKey':'DescriptionId'});db[_0x74ac('0xc1')]['hasMany'](db[_0x74ac('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0x74ac('0xc1')][_0x74ac('0x12e')](db['Variable'],{'as':_0x74ac('0x93'),'foreignKey':_0x74ac('0x1ce')});db['ServicenowAccount'][_0x74ac('0x11d')](db[_0x74ac('0xc5')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xc5')][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':'Descriptions','foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xc5')][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':'Fields','foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xc5')]['belongsTo'](db[_0x74ac('0xc3')],{'as':_0x74ac('0x176'),'foreignKey':'AccountId'});db[_0x74ac('0xc7')][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':_0x74ac('0x1cc'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0x74ac('0xc7')],{'as':_0x74ac('0x1cd'),'foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xc7')][_0x74ac('0x11d')](db[_0x74ac('0xc7')],{'as':_0x74ac('0x1d1'),'foreignKey':'FieldId'});db[_0x74ac('0xc7')]['belongsTo'](db['Variable'],{'as':_0x74ac('0x93'),'foreignKey':_0x74ac('0x1ce')});db['Dynamics365Account'][_0x74ac('0x11d')](db[_0x74ac('0xca')],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0x1d7')][_0x74ac('0x12e')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x74ac('0x16e')});db['Dynamics365Configuration'][_0x74ac('0x11d')](db[_0x74ac('0xcb')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xca')]['hasMany'](db[_0x74ac('0xcb')],{'as':'Descriptions','onDelete':_0x74ac('0x11a'),'foreignKey':'DescriptionId'});db[_0x74ac('0xca')][_0x74ac('0x11d')](db[_0x74ac('0xcb')],{'as':_0x74ac('0x1c3'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xca')][_0x74ac('0x12e')](db[_0x74ac('0x1d7')],{'as':_0x74ac('0x176'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xcb')][_0x74ac('0x11d')](db[_0x74ac('0xcb')],{'as':_0x74ac('0x1cc'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xcb')]['hasMany'](db[_0x74ac('0xcb')],{'as':'Description','foreignKey':_0x74ac('0x1ca')});db[_0x74ac('0xcb')]['hasMany'](db[_0x74ac('0xcb')],{'as':'Field','foreignKey':'FieldId'});db[_0x74ac('0xcb')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':'VariableId'});db[_0x74ac('0xcd')][_0x74ac('0x11d')](db['FreshsalesConfiguration'],{'as':_0x74ac('0x1c5'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xcf')][_0x74ac('0x11d')](db[_0x74ac('0xd0')],{'as':_0x74ac('0x1c7'),'foreignKey':_0x74ac('0x1c8')});db[_0x74ac('0xcf')][_0x74ac('0x11d')](db[_0x74ac('0xd0')],{'as':_0x74ac('0x1c9'),'foreignKey':'DescriptionId'});db[_0x74ac('0xcf')]['hasMany'](db[_0x74ac('0xd0')],{'as':_0x74ac('0x1c3'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xcf')][_0x74ac('0x12e')](db[_0x74ac('0xcd')],{'as':'Account','foreignKey':_0x74ac('0x1c6')});db[_0x74ac('0xd0')][_0x74ac('0x11d')](db[_0x74ac('0xd0')],{'as':'Subject','foreignKey':_0x74ac('0x1c8')});db['FreshsalesField']['hasMany'](db[_0x74ac('0xd0')],{'as':'Description','foreignKey':_0x74ac('0x1ca')});db['FreshsalesField'][_0x74ac('0x11d')](db[_0x74ac('0xd0')],{'as':_0x74ac('0x1d1'),'foreignKey':_0x74ac('0x1cb')});db[_0x74ac('0xd0')][_0x74ac('0x12e')](db[_0x74ac('0x93')],{'as':_0x74ac('0x93'),'foreignKey':'VariableId'});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db[_0x74ac('0x5f')],{});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':'ContactId'});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db['ChatInteraction'],{});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db[_0x74ac('0x65')],{});db[_0x74ac('0x1d8')][_0x74ac('0x12e')](db['User'],{});db['ChatQueueReport'][_0x74ac('0x12e')](db[_0x74ac('0x67')],{});db[_0x74ac('0xd3')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1d9')});db[_0x74ac('0xd3')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1da')});db[_0x74ac('0x15b')]['hasMany'](db[_0x74ac('0xd7')],{'foreignKey':_0x74ac('0x1db'),'onDelete':'cascade'});db[_0x74ac('0x15b')]['hasMany'](db[_0x74ac('0xd5')],{'foreignKey':_0x74ac('0x1db'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0xda')]['belongsTo'](db['SmsAccount'],{});db[_0x74ac('0xda')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':'ListId'});db[_0x74ac('0xda')][_0x74ac('0x12e')](db['CmContact'],{'as':_0x74ac('0x16a'),'foreignKey':'ContactId'});db[_0x74ac('0xda')]['belongsTo'](db['SmsInteraction'],{});db[_0x74ac('0xda')][_0x74ac('0x12e')](db[_0x74ac('0x54')],{});db[_0x74ac('0xda')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{});db[_0x74ac('0xda')]['belongsTo'](db[_0x74ac('0x56')],{});db[_0x74ac('0xe0')]['hasMany'](db[_0x74ac('0x15b')],{'foreignKey':_0x74ac('0x1dc')});db['JscriptyProject']['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x74ac('0x1dc')});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x1dd')});db[_0x74ac('0xea')]['belongsToMany'](db[_0x74ac('0x18')],{'through':'TeamVoiceQueue','as':_0x74ac('0x13d')});db[_0x74ac('0xea')][_0x74ac('0x133')](db['MailQueue'],{'through':_0x74ac('0x1de'),'as':_0x74ac('0x141')});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x67')],{'through':_0x74ac('0x19c'),'as':_0x74ac('0x142')});db['Team']['belongsToMany'](db[_0x74ac('0x4c')],{'through':_0x74ac('0x1df'),'as':'FaxQueues'});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x56')],{'through':_0x74ac('0x18b'),'as':_0x74ac('0x145')});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x5e')],{'through':_0x74ac('0x192'),'as':_0x74ac('0x1e0')});db[_0x74ac('0xea')][_0x74ac('0x133')](db[_0x74ac('0x10d')],{'through':'team_has_whatsapp_queues','as':_0x74ac('0x147')});db[_0x74ac('0xea')][_0x74ac('0x133')](db['VoicePrefix'],{'through':_0x74ac('0x113'),'as':_0x74ac('0x13f')});db[_0x74ac('0xee')][_0x74ac('0x11d')](db[_0x74ac('0x12c')],{'as':_0x74ac('0x12d'),'foreignKey':_0x74ac('0x1a5')});db['Campaign']['hasMany'](db[_0x74ac('0x159')],{'as':'HopperFinals','foreignKey':_0x74ac('0x1a5')});db['Campaign'][_0x74ac('0x11d')](db[_0x74ac('0x72')],{'as':_0x74ac('0x15a'),'foreignKey':_0x74ac('0x1a5')});db[_0x74ac('0xee')][_0x74ac('0x11d')](db['CmHopperBlack'],{'as':_0x74ac('0x1e1'),'foreignKey':_0x74ac('0x1a5')});db[_0x74ac('0xee')][_0x74ac('0x12e')](db['Trunk'],{'as':_0x74ac('0x28'),'foreignKey':'TrunkId'});db['Campaign']['belongsTo'](db[_0x74ac('0x28')],{'as':_0x74ac('0x1e2'),'foreignKey':'TrunkBackupId'});db[_0x74ac('0xee')][_0x74ac('0x12e')](db[_0x74ac('0x80')],{'as':_0x74ac('0x80'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0xee')][_0x74ac('0x12e')](db[_0x74ac('0xe5')],{'as':'SquareProject','foreignKey':_0x74ac('0x1e3')});db[_0x74ac('0xee')][_0x74ac('0x133')](db[_0x74ac('0x160')],{'as':_0x74ac('0x136'),'through':'campaigns_has_cm_lists'});db[_0x74ac('0xee')][_0x74ac('0x133')](db[_0x74ac('0x160')],{'as':_0x74ac('0x164'),'through':_0x74ac('0x1e4')});db[_0x74ac('0xf2')][_0x74ac('0x12e')](db[_0x74ac('0x17d')],{'as':'ChatOfflineMessage','foreignKey':_0x74ac('0x19b')});db['MailTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x172')],{});db[_0x74ac('0xf6')]['belongsTo'](db[_0x74ac('0x3d')],{});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0x74ac('0x1e5'),'as':_0x74ac('0x1e6')});db[_0x74ac('0xf6')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0xf6')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':'ToAgent'});db[_0x74ac('0xf6')][_0x74ac('0x12e')](db['MailQueue'],{'foreignKey':_0x74ac('0x1ea'),'as':'ToQueue'});db[_0x74ac('0xf6')][_0x74ac('0x12e')](db[_0x74ac('0x37')],{'foreignKey':_0x74ac('0x1eb'),'as':_0x74ac('0x1ec')});db['ChatTransferReport'][_0x74ac('0x12e')](db['ChatMessage'],{});db['ChatTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x63')],{});db[_0x74ac('0xf7')][_0x74ac('0x12e')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x74ac('0xf7')]['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0xf7')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':_0x74ac('0x1ed')});db[_0x74ac('0xf7')][_0x74ac('0x12e')](db[_0x74ac('0x67')],{'foreignKey':'ToChatQueueId','as':_0x74ac('0x1ee')});db[_0x74ac('0xf7')]['belongsTo'](db[_0x74ac('0x5f')],{'foreignKey':_0x74ac('0x1ef'),'as':'ToAccount'});db[_0x74ac('0x1f0')]['belongsTo'](db[_0x74ac('0x4b')],{});db[_0x74ac('0x1f0')][_0x74ac('0x12e')](db[_0x74ac('0x4a')],{});db[_0x74ac('0x1f0')][_0x74ac('0x12e')](db[_0x74ac('0x149')],{'foreignKey':_0x74ac('0x1f1'),'as':_0x74ac('0x1e6')});db[_0x74ac('0x1f0')][_0x74ac('0x12e')](db['User'],{'foreignKey':_0x74ac('0x1e7'),'as':'FromAgent'});db['FaxTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':'ToAgent'});db['FaxTransferReport'][_0x74ac('0x12e')](db['FaxQueue'],{'foreignKey':_0x74ac('0x1f2'),'as':_0x74ac('0x1ee')});db[_0x74ac('0x1f0')]['belongsTo'](db[_0x74ac('0x149')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x74ac('0x1f3')][_0x74ac('0x12e')](db[_0x74ac('0x5c')],{});db['OpenchannelTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x5a')],{});db[_0x74ac('0x1f3')]['belongsTo'](db[_0x74ac('0x14e')],{'foreignKey':'FromOpenchannelAccountId','as':_0x74ac('0x1e6')});db['OpenchannelTransferReport']['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0x1f3')]['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x74ac('0x1f3')][_0x74ac('0x12e')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x74ac('0x1ee')});db['OpenchannelTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x14e')],{'foreignKey':_0x74ac('0x1f4'),'as':'ToAccount'});db[_0x74ac('0x1f5')][_0x74ac('0x12e')](db[_0x74ac('0x54')],{});db['SmsTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x52')],{});db['SmsTransferReport'][_0x74ac('0x12e')](db['SmsAccount'],{'foreignKey':_0x74ac('0x1f6'),'as':_0x74ac('0x1e6')});db[_0x74ac('0x1f5')]['belongsTo'](db['User'],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0x1f5')]['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':'ToAgent'});db[_0x74ac('0x1f5')][_0x74ac('0x12e')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x74ac('0x1ee')});db[_0x74ac('0x1f5')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x74ac('0x1f7'),'as':_0x74ac('0x1ec')});db[_0x74ac('0x160')][_0x74ac('0x11d')](db['Disposition'],{'as':_0x74ac('0x180'),'foreignKey':'ListId','onDelete':_0x74ac('0x11a')});db['CmList']['hasMany'](db[_0x74ac('0x76')],{'as':_0x74ac('0x1f8'),'foreignKey':_0x74ac('0x17f')});db['CmList']['hasMany'](db[_0x74ac('0x6d')],{'as':_0x74ac('0x134'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x160')][_0x74ac('0x11d')](db[_0x74ac('0x159')],{'as':_0x74ac('0x123'),'foreignKey':'ListId'});db[_0x74ac('0x160')]['hasMany'](db[_0x74ac('0x72')],{'as':_0x74ac('0x124'),'foreignKey':'ListId'});db[_0x74ac('0x160')][_0x74ac('0x11d')](db[_0x74ac('0x74')],{'as':_0x74ac('0x74'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x160')][_0x74ac('0x133')](db[_0x74ac('0x18')],{'as':_0x74ac('0x1f9'),'through':_0x74ac('0x161')});db[_0x74ac('0x160')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x137')});db['VoicePrefix'][_0x74ac('0x11d')](db[_0x74ac('0x121')],{'as':_0x74ac('0x122'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0xfc')][_0x74ac('0x133')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x162'),'through':_0x74ac('0x140')});db['VoicePrefix'][_0x74ac('0x133')](db[_0x74ac('0xea')],{'through':_0x74ac('0x113'),'as':_0x74ac('0x163')});db[_0x74ac('0x12f')][_0x74ac('0x11d')](db['User'],{'as':_0x74ac('0x17a'),'foreignKey':_0x74ac('0x130')});db[_0x74ac('0x12f')][_0x74ac('0x11d')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x74ac('0x130'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0xff')][_0x74ac('0x11d')](db[_0x74ac('0x101')],{'as':_0x74ac('0x1fa'),'foreignKey':_0x74ac('0x1fb'),'onDelete':_0x74ac('0x11a')});db[_0x74ac('0x104')][_0x74ac('0x11d')](db[_0x74ac('0x7d')],{'as':_0x74ac('0x180'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x74ac('0x104')][_0x74ac('0x11d')](db[_0x74ac('0x7b')],{'as':_0x74ac('0x171'),'foreignKey':_0x74ac('0x1fc')});db[_0x74ac('0x104')]['hasMany'](db[_0x74ac('0x109')],{'as':_0x74ac('0x165'),'foreignKey':_0x74ac('0x1fc')});db[_0x74ac('0x104')]['hasMany'](db[_0x74ac('0x1b6')],{'as':_0x74ac('0x182')});db[_0x74ac('0x104')][_0x74ac('0x11d')](db[_0x74ac('0x106')],{'as':'Applications','foreignKey':_0x74ac('0x1fc'),'onDelete':_0x74ac('0x11a')});db['WhatsappAccount'][_0x74ac('0x12e')](db[_0x74ac('0x160')],{'as':'List','foreignKey':'ListId'});db[_0x74ac('0x104')][_0x74ac('0x12e')](db[_0x74ac('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x74ac('0x15f')});db[_0x74ac('0x104')][_0x74ac('0x133')](db['User'],{'as':_0x74ac('0x162'),'through':_0x74ac('0x1fd')});db[_0x74ac('0x106')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x106')]['belongsTo'](db[_0x74ac('0x10d')],{'onDelete':_0x74ac('0x16d')});db[_0x74ac('0x106')][_0x74ac('0x12e')](db[_0x74ac('0x104')],{'onDelete':'restrict'});db[_0x74ac('0x106')]['belongsTo'](db[_0x74ac('0x80')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x17e')});db[_0x74ac('0x106')][_0x74ac('0x12e')](db[_0x74ac('0x8c')],{'onDelete':_0x74ac('0x16d'),'foreignKey':_0x74ac('0x18d')});db[_0x74ac('0x1b6')][_0x74ac('0x11d')](db['WhatsappMessage'],{'as':_0x74ac('0x165'),'onDelete':_0x74ac('0x11a'),'foreignKey':_0x74ac('0x1fe')});db[_0x74ac('0x1b6')]['belongsTo'](db['WhatsappAccount'],{'as':_0x74ac('0x176'),'foreignKey':'WhatsappAccountId'});db[_0x74ac('0x1b6')]['belongsTo'](db[_0x74ac('0x6d')],{'as':'Contact','foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x1b6')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x184'),'foreignKey':'UserId'});db[_0x74ac('0x1b6')]['belongsToMany'](db[_0x74ac('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0x74ac('0x177')});db[_0x74ac('0x1b6')][_0x74ac('0x133')](db['Tag'],{'through':_0x74ac('0x1b7'),'as':_0x74ac('0x179')});db['WhatsappInteraction']['belongsToMany'](db[_0x74ac('0x11b')],{'as':'Users','through':_0x74ac('0x13c'),'foreignKey':_0x74ac('0x1fe')});db[_0x74ac('0x109')][_0x74ac('0x12e')](db['User'],{'as':_0x74ac('0x11b')});db[_0x74ac('0x109')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'onDelete':'cascade','as':_0x74ac('0x16a')});db[_0x74ac('0x109')]['belongsTo'](db[_0x74ac('0x1b6')],{'onDelete':_0x74ac('0x11a'),'as':_0x74ac('0x17c'),'foreignKey':_0x74ac('0x1fe')});db[_0x74ac('0x109')]['belongsTo'](db[_0x74ac('0x104')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x74ac('0x10a')]['belongsTo'](db[_0x74ac('0x104')],{});db[_0x74ac('0x10a')]['belongsTo'](db[_0x74ac('0x160')],{'as':_0x74ac('0x173'),'foreignKey':_0x74ac('0x17f')});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x6d')],{'as':_0x74ac('0x16a'),'foreignKey':_0x74ac('0x16b')});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x1b6')],{});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x10d')],{});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x109')],{});db[_0x74ac('0x10a')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{});db['WhatsappTransferReport'][_0x74ac('0x12e')](db[_0x74ac('0x109')],{});db[_0x74ac('0x10c')][_0x74ac('0x12e')](db[_0x74ac('0x1b6')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x74ac('0x104')],{'foreignKey':_0x74ac('0x1ff'),'as':_0x74ac('0x1e6')});db[_0x74ac('0x10c')][_0x74ac('0x12e')](db[_0x74ac('0x104')],{'foreignKey':'ToWhatsappAccountId','as':_0x74ac('0x1ec')});db['WhatsappTransferReport']['belongsTo'](db[_0x74ac('0x10d')],{'foreignKey':_0x74ac('0x200'),'as':'ToQueue'});db[_0x74ac('0x10c')]['belongsTo'](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e7'),'as':_0x74ac('0x1e8')});db[_0x74ac('0x10c')][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'foreignKey':_0x74ac('0x1e9'),'as':_0x74ac('0x1ed')});db[_0x74ac('0x10d')]['belongsToMany'](db['User'],{'as':_0x74ac('0x162'),'through':'UserWhatsappQueue','foreignKey':_0x74ac('0x201')});db[_0x74ac('0x10d')]['belongsToMany'](db['Team'],{'through':_0x74ac('0x202'),'as':_0x74ac('0x163')});db['UserSetting'][_0x74ac('0x12e')](db[_0x74ac('0x11b')],{'as':_0x74ac('0x203'),'foreignKey':_0x74ac('0x11f'),'onDelete':_0x74ac('0x11a'),'hooks':!![]});db['CloudProvider'][_0x74ac('0x119')](db[_0x74ac('0x1d7')],{'as':_0x74ac('0x1d7'),'onDelete':'restrict'});db[_0x74ac('0x10f')][_0x74ac('0x119')](db[_0x74ac('0x34')],{'as':_0x74ac('0x16f'),'onDelete':'restrict'});db[_0x74ac('0x10f')][_0x74ac('0x119')](db[_0x74ac('0x36')],{'as':'Smtp','onDelete':_0x74ac('0x16d')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x5eee=['Sounds','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','MailAccountId','Answers','MailMessage','Messages','Interactions','Applications','List','ListId','Template','TemplateId','user_has_mail_accounts','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Interaction','ChatOfflineMessageId','Items','FaxAccountId','FaxApplication','FaxQueue','TagId','fax_interaction_has_tags','Users','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','sms_interaction_has_tags','Tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','Website','CompanyId','Phones','CmContactId','HopperHistories','CmCompany','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Extensions','MailApplications','ChatApplications','SmsApplications','Schedule','DefaultReportId','Mohs','whatsapp_interaction_has_tags','ItemType','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','Subject','Field','FieldId','VariableId','Descriptions','Description','DeskField','int_desk_configuration_has_tags','ZendeskAccount','FreshdeskConfiguration','ServicenowField','ChatQueueReport','ChatInternalMessage','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','team_has_whatsapp_queues','TeamVoicePrefix','SquareProject','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToUserId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CmCustomField','CustomFields','HopperHistory','Queues','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','utf8mb4','name','options','database','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','Network','../api/network/network.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','cascade','hasOne','userSetting','UserId','hasMany','VoiceQueuesRt','VoiceExtension','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','CmHopper','Hoppers','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','MailInteraction','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','FaxAccount','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId'];(function(_0x17a782,_0x2b11fb){var _0x412b1d=function(_0x5b105c){while(--_0x5b105c){_0x17a782['push'](_0x17a782['shift']());}};_0x412b1d(++_0x2b11fb);}(_0x5eee,0xb9));var _0xe5ee=function(_0x8a0879,_0x50c8c4){_0x8a0879=_0x8a0879-0x0;var _0x4db852=_0x5eee[_0x8a0879];return _0x4db852;};'use strict';var config=require(_0xe5ee('0x0'));var Sequelize=require(_0xe5ee('0x1'));var _=require(_0xe5ee('0x2'));var jstz=require(_0xe5ee('0x3'));var timezone=jstz[_0xe5ee('0x4')]();config[_0xe5ee('0x1')]=_[_0xe5ee('0x5')](config[_0xe5ee('0x1')],{'database':_0xe5ee('0x6'),'username':_0xe5ee('0x7'),'password':'xC@LL1234','options':{'host':_0xe5ee('0x8'),'port':0xcea,'dialect':_0xe5ee('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe5ee('0xa'),'collate':_0xe5ee('0xb')}}});config[_0xe5ee('0xc')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0xe5ee('0x6'),'username':_0xe5ee('0x7'),'password':'xC@LL1234','options':{'host':_0xe5ee('0x8'),'port':0xcea,'dialect':_0xe5ee('0x9'),'dialectOptions':{'charset':_0xe5ee('0xd')},'logging':![],'timezone':timezone[_0xe5ee('0xe')](),'define':{'charset':'utf8','collate':_0xe5ee('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe5ee('0x1')]['database'],config['sequelize']['username'],config[_0xe5ee('0x1')]['password'],config['sequelize'][_0xe5ee('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe5ee('0xc')][_0xe5ee('0x10')],config[_0xe5ee('0xc')]['username'],config['sequelizeHistory'][_0xe5ee('0x11')],config[_0xe5ee('0xc')][_0xe5ee('0xf')])};db[_0xe5ee('0x12')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x14'));db[_0xe5ee('0x15')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x16'));db[_0xe5ee('0x17')]=db[_0xe5ee('0x1')]['import']('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x18'));db[_0xe5ee('0x19')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x1a'));db['VoiceQueue']=db['sequelize']['import'](_0xe5ee('0x1b'));db[_0xe5ee('0x1c')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x1d'));db['ScreenRecording']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x1e'));db[_0xe5ee('0x1f')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/voiceMail/voiceMail.model');db[_0xe5ee('0x20')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe5ee('0x21')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x22'));db[_0xe5ee('0x23')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x24'));db[_0xe5ee('0x25')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x26'));db[_0xe5ee('0x27')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x28'));db[_0xe5ee('0x29')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x2a'));db[_0xe5ee('0x2b')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x2c'));db[_0xe5ee('0x2d')]=db['sequelize']['import'](_0xe5ee('0x2e'));db['UserVoiceQueueRt']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x2f'));db[_0xe5ee('0x30')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x31'));db[_0xe5ee('0x32')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x33'));db[_0xe5ee('0x34')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0xe5ee('0x35')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x36'));db[_0xe5ee('0x37')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x38'));db[_0xe5ee('0x39')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x3a'));db[_0xe5ee('0x3b')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x3c'));db[_0xe5ee('0x3d')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x3e'));db[_0xe5ee('0x3f')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x40'));db[_0xe5ee('0x41')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x42'));db['MailQueue']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x43'));db[_0xe5ee('0x44')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x45'));db['MailInteraction']=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x46'));db['MailMessage']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x47'));db[_0xe5ee('0x48')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x49'));db[_0xe5ee('0x4a')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x4b'));db[_0xe5ee('0x4c')]=db['sequelize']['import'](_0xe5ee('0x4d'));db[_0xe5ee('0x4e')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x4f'));db['FaxAccount']=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/faxApplication/faxApplication.model');db[_0xe5ee('0x50')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x51'));db[_0xe5ee('0x52')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x53'));db['FaxQueue']=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x54'));db[_0xe5ee('0x55')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x56'));db[_0xe5ee('0x57')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x58'));db['SmsApplication']=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x59'));db['SmsInteraction']=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x5a'));db[_0xe5ee('0x5b')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x5c'));db[_0xe5ee('0x5d')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x5e'));db[_0xe5ee('0x5f')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x60'));db[_0xe5ee('0x61')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x62'));db['OpenchannelInteraction']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x63'));db[_0xe5ee('0x64')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x65'));db[_0xe5ee('0x66')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0xe5ee('0x67')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x68'));db[_0xe5ee('0x69')]=db['sequelize']['import'](_0xe5ee('0x6a'));db[_0xe5ee('0x6b')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x6c'));db[_0xe5ee('0x6d')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x6e'));db[_0xe5ee('0x6f')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x70'));db[_0xe5ee('0x71')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x72'));db[_0xe5ee('0x73')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x74'));db[_0xe5ee('0x75')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/chatGroup/chatGroup.model');db[_0xe5ee('0x76')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x77'));db['CmCompany']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x78'));db[_0xe5ee('0x79')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x7a'));db['CmHopper']=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x7b'));db[_0xe5ee('0x7c')]=db[_0xe5ee('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0xe5ee('0x7d')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x7e'));db[_0xe5ee('0x7f')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x80'));db[_0xe5ee('0x81')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x82'));db['CmCustomField']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x83'));db[_0xe5ee('0x84')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/action/action.model');db[_0xe5ee('0x85')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x86'));db[_0xe5ee('0x87')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x88'));db['Disposition']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x89'));db[_0xe5ee('0x8a')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x8b'));db[_0xe5ee('0x8c')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x8d'));db[_0xe5ee('0x8e')]=db['sequelize']['import'](_0xe5ee('0x8f'));db[_0xe5ee('0x90')]=db['sequelize']['import'](_0xe5ee('0x91'));db[_0xe5ee('0x92')]=db[_0xe5ee('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x93'));db[_0xe5ee('0x94')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x95'));db[_0xe5ee('0x96')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x97'));db[_0xe5ee('0x98')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x99'));db[_0xe5ee('0x9a')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x9b'));db[_0xe5ee('0x9c')]=db['sequelize'][_0xe5ee('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x9d'));db[_0xe5ee('0x9e')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x9f'));db[_0xe5ee('0xa0')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0xa1'));db[_0xe5ee('0xa2')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0xa3'));db[_0xe5ee('0xa4')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/integrationReport/integrationReport.model');db[_0xe5ee('0xa5')]=db['sequelize'][_0xe5ee('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xe5ee('0xa6')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xa7'));db['AnalyticExtractedReport']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xa8'));db[_0xe5ee('0xa9')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xaa'));db[_0xe5ee('0xab')]=db['sequelize'][_0xe5ee('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xe5ee('0xac')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xad'));db[_0xe5ee('0xae')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0xaf'));db[_0xe5ee('0xb0')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xb1'));db[_0xe5ee('0xb2')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xb3'));db[_0xe5ee('0xb4')]=db['sequelize'][_0xe5ee('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xe5ee('0xb5')]=db[_0xe5ee('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xe5ee('0xb6')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xe5ee('0xb7')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0xe5ee('0xb8')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0xb9'));db['DeskField']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xba'));db[_0xe5ee('0xbb')]=db[_0xe5ee('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xe5ee('0xbc')]=db['sequelize'][_0xe5ee('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xe5ee('0xbd')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize'][_0xe5ee('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xe5ee('0xbe')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xbf'));db[_0xe5ee('0xc0')]=db['sequelize']['import'](_0xe5ee('0xc1'));db[_0xe5ee('0xc2')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0xc3'));db['FreshdeskConfiguration']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xc4'));db[_0xe5ee('0xc5')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0xc6'));db[_0xe5ee('0xc7')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xc8'));db[_0xe5ee('0xc9')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0xca'));db[_0xe5ee('0xcb')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0xe5ee('0xcc')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xcd'));db[_0xe5ee('0xce')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xcf'));db['ServicenowField']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xd0'));db[_0xe5ee('0xd1')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0xd2'));db[_0xe5ee('0xd3')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xe5ee('0xd4')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0xd5'));db[_0xe5ee('0xd6')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xd7'));db[_0xe5ee('0xd8')]=db[_0xe5ee('0x1')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xe5ee('0xd9')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xe5ee('0xa2')]=db[_0xe5ee('0x1')]['import']('../api/integration/integration.model');db[_0xe5ee('0xda')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xdb'));db['ChatQueueReport']=db[_0xe5ee('0x1')]['import']('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xe5ee('0xdc')]=db['sequelize'][_0xe5ee('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0xdd'));db[_0xe5ee('0xde')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xdf'));db[_0xe5ee('0xe0')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0xe1'));db[_0xe5ee('0xe2')]=db['sequelize']['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xe3'));db['JscriptyProject']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xe4'));db[_0xe5ee('0xe5')]=db['sequelize']['import'](_0xe5ee('0xe6'));db[_0xe5ee('0xe7')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xe8'));db['SquareProject']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xe9'));db[_0xe5ee('0xea')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xeb'));db[_0xe5ee('0xec')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xed'));db[_0xe5ee('0xee')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/team/team.model');db[_0xe5ee('0xef')]=db['sequelize']['import'](_0xe5ee('0xf0'));db[_0xe5ee('0xf1')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xf2'));db[_0xe5ee('0xf3')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0xf4'));db[_0xe5ee('0xf5')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xf6'));db[_0xe5ee('0xf7')]=db[_0xe5ee('0x1')]['import']('../api/plugin/plugin.model');db[_0xe5ee('0xf8')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xf9'));db['ChatTransferReport']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xfa'));db['FaxTransferReport']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0xfb'));db[_0xe5ee('0xfc')]=db['sequelize']['import'](_0xe5ee('0xfd'));db['SmsTransferReport']=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0xfe'));db[_0xe5ee('0xff')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x100'));db[_0xe5ee('0x101')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x102'));db[_0xe5ee('0x103')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x104'));db[_0xe5ee('0x105')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x106'));db[_0xe5ee('0x107')]=db['sequelize'][_0xe5ee('0x13')](_0xe5ee('0x108'));db[_0xe5ee('0x109')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x10a'));db['WhatsappAccount']=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x10b'));db[_0xe5ee('0x10c')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x10d'));db[_0xe5ee('0x10e')]=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xe5ee('0x10f')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0xe5ee('0x110')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x111'));db['WhatsappTransferReport']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x112'));db[_0xe5ee('0x113')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x114'));db[_0xe5ee('0x115')]=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x116'));db[_0xe5ee('0x117')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x118'));db['TeamVoicePrefix']=db[_0xe5ee('0x1')][_0xe5ee('0x13')](_0xe5ee('0x119'));db[_0xe5ee('0x11a')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x11b'));db[_0xe5ee('0x11c')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x11d'));db[_0xe5ee('0x11e')]=db[_0xe5ee('0x1')]['import'](_0xe5ee('0x11f'));db[_0xe5ee('0x12')]['hasOne'](db['VoiceMail'],{'as':_0xe5ee('0x1f'),'onDelete':_0xe5ee('0x120'),'foreignKey':'UserId'});db['User'][_0xe5ee('0x121')](db[_0xe5ee('0x11c')],{'as':_0xe5ee('0x122'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')]['hasMany'](db[_0xe5ee('0x1c')],{'as':'Recordings','foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db['UserVoiceQueueRt'],{'as':_0xe5ee('0x125'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xe5ee('0x126')],{'as':'Extensions','onDelete':_0xe5ee('0x120'),'hooks':!![]});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x7d')],{'as':_0xe5ee('0x127'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')]['hasMany'](db[_0xe5ee('0x7f')],{'as':'HopperHistory','foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x81')],{'as':_0xe5ee('0x81'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x128')],{'as':_0xe5ee('0x129'),'foreignKey':'UserId'});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x6d')],{'as':_0xe5ee('0x12a'),'foreignKey':'UserId'});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x12b')],{'as':_0xe5ee('0x12c'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x50')],{'as':_0xe5ee('0x12d'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')]['hasMany'](db['MailInteraction'],{'as':_0xe5ee('0x12e'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x10e')],{'as':_0xe5ee('0x12f'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x109')],{'as':_0xe5ee('0x130'),'foreignKey':'SenderId'});db[_0xe5ee('0x12')][_0xe5ee('0x124')](db[_0xe5ee('0x131')],{'as':_0xe5ee('0x132'),'foreignKey':_0xe5ee('0x123'),'onDelete':'SET\x20NULL'});db[_0xe5ee('0x12')][_0xe5ee('0x133')](db[_0xe5ee('0x103')],{'as':_0xe5ee('0x103'),'foreignKey':_0xe5ee('0x134')});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db[_0xe5ee('0x75')],{'as':_0xe5ee('0x136'),'through':_0xe5ee('0x137')});db['User']['belongsToMany'](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x138'),'through':_0xe5ee('0x139')});db[_0xe5ee('0x12')]['belongsToMany'](db['CmList'],{'as':_0xe5ee('0x13a'),'through':_0xe5ee('0x13b')});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db[_0xe5ee('0xee')],{'through':'user_has_teams'});db['User'][_0xe5ee('0x135')](db[_0xe5ee('0x13c')],{'as':'MailInteractions','through':_0xe5ee('0x13d')});db[_0xe5ee('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0xe5ee('0x12a'),'through':_0xe5ee('0x13e')});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0xe5ee('0x135')](db[_0xe5ee('0x12b')],{'as':'SmsInteractions','through':_0xe5ee('0x13f')});db['User']['belongsToMany'](db[_0xe5ee('0x128')],{'as':_0xe5ee('0x129'),'through':_0xe5ee('0x140')});db['User'][_0xe5ee('0x135')](db[_0xe5ee('0x10e')],{'as':_0xe5ee('0x12f'),'through':'user_has_whatsapp_interactions'});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db[_0xe5ee('0x141')],{'as':_0xe5ee('0x142'),'through':_0xe5ee('0x30'),'required':![]});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db[_0xe5ee('0x101')],{'as':_0xe5ee('0x143'),'through':_0xe5ee('0x11a'),'required':![]});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db[_0xe5ee('0x144')],{'as':_0xe5ee('0x145'),'through':_0xe5ee('0x34'),'required':![]});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db['ChatQueue'],{'as':_0xe5ee('0x146'),'through':_0xe5ee('0x32'),'required':![],'hooks':!![]});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db['FaxQueue'],{'as':_0xe5ee('0x147'),'through':_0xe5ee('0x35'),'required':![]});db[_0xe5ee('0x12')]['belongsToMany'](db[_0xe5ee('0x5d')],{'as':_0xe5ee('0x148'),'through':_0xe5ee('0x37'),'required':![]});db[_0xe5ee('0x12')]['belongsToMany'](db['OpenchannelQueue'],{'as':_0xe5ee('0x149'),'through':_0xe5ee('0x39'),'required':![]});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db['WhatsappQueue'],{'as':_0xe5ee('0x14a'),'through':_0xe5ee('0x3b'),'required':![]});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db[_0xe5ee('0xff')],{'through':'cm_user_has_lists'});db[_0xe5ee('0x12')]['belongsToMany'](db[_0xe5ee('0x67')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User'][_0xe5ee('0x135')](db[_0xe5ee('0x14b')],{'as':_0xe5ee('0x14c'),'through':_0xe5ee('0x14d')});db[_0xe5ee('0x12')]['belongsToMany'](db[_0xe5ee('0x41')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db['User']['belongsToMany'](db[_0xe5ee('0x5f')],{'as':_0xe5ee('0x14e'),'through':_0xe5ee('0x14f')});db[_0xe5ee('0x12')][_0xe5ee('0x135')](db[_0xe5ee('0x57')],{'as':_0xe5ee('0x150'),'through':_0xe5ee('0x151')});db['User'][_0xe5ee('0x135')](db[_0xe5ee('0x152')],{'as':'WhatsappAccounts','through':_0xe5ee('0x153')});db[_0xe5ee('0x15')][_0xe5ee('0x124')](db['VoiceExtension'],{'as':_0xe5ee('0x154'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x155')});db[_0xe5ee('0x17')][_0xe5ee('0x124')](db['VoiceExtension'],{'onDelete':_0xe5ee('0x120')});db['VoiceExtension']['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x19')][_0xe5ee('0x135')](db[_0xe5ee('0x94')],{'as':_0xe5ee('0x156'),'through':_0xe5ee('0x157')});db[_0xe5ee('0x141')][_0xe5ee('0x124')](db['UserVoiceQueueRt'],{'as':_0xe5ee('0x158'),'foreignKey':'VoiceQueueId'});db[_0xe5ee('0x141')][_0xe5ee('0x124')](db['CmHopper'],{'as':_0xe5ee('0x132'),'foreignKey':_0xe5ee('0x159')});db[_0xe5ee('0x141')][_0xe5ee('0x124')](db[_0xe5ee('0x7d')],{'as':_0xe5ee('0x127'),'foreignKey':'VoiceQueueId'});db[_0xe5ee('0x141')][_0xe5ee('0x124')](db[_0xe5ee('0x7f')],{'as':'HopperHistories','foreignKey':_0xe5ee('0x159')});db['VoiceQueue'][_0xe5ee('0x124')](db[_0xe5ee('0x81')],{'as':'ReportAgentPreview','foreignKey':_0xe5ee('0x159')});db[_0xe5ee('0x141')]['hasMany'](db['CmHopperBlack'],{'as':_0xe5ee('0x15a'),'foreignKey':_0xe5ee('0x159')});db['VoiceQueue'][_0xe5ee('0x124')](db['JscriptySessionReport'],{'as':_0xe5ee('0x15b'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xe5ee('0x133')](db[_0xe5ee('0x2b')],{'as':_0xe5ee('0x2b'),'foreignKey':_0xe5ee('0x15c')});db[_0xe5ee('0x141')][_0xe5ee('0x133')](db[_0xe5ee('0x2b')],{'as':_0xe5ee('0x15d'),'foreignKey':_0xe5ee('0x15e')});db['VoiceQueue'][_0xe5ee('0x133')](db[_0xe5ee('0x8c')],{'as':'Interval','foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0x141')][_0xe5ee('0x133')](db['Pause'],{'as':_0xe5ee('0x160'),'foreignKey':_0xe5ee('0x161')});db['VoiceQueue'][_0xe5ee('0x135')](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x13a'),'through':_0xe5ee('0x162')});db[_0xe5ee('0x141')]['belongsToMany'](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':_0xe5ee('0x30')});db['VoiceQueue'][_0xe5ee('0x135')](db[_0xe5ee('0xee')],{'as':_0xe5ee('0x164'),'through':_0xe5ee('0x117')});db[_0xe5ee('0x141')][_0xe5ee('0x135')](db[_0xe5ee('0xff')],{'as':'BlackLists','through':_0xe5ee('0x165')});db[_0xe5ee('0x1c')][_0xe5ee('0x133')](db['User'],{'as':_0xe5ee('0x12'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x166')]['belongsTo'](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x12'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x1f')][_0xe5ee('0x124')](db[_0xe5ee('0x20')],{'as':'Messages','onDelete':_0xe5ee('0x120'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage'][_0xe5ee('0x133')](db[_0xe5ee('0x1f')],{'foreignKey':_0xe5ee('0x167'),'targetKey':_0xe5ee('0x168')});db[_0xe5ee('0x21')]['hasMany'](db[_0xe5ee('0x27')],{'as':_0xe5ee('0x169'),'foreignKey':_0xe5ee('0x16a'),'constraints':![]});db[_0xe5ee('0x21')][_0xe5ee('0x124')](db[_0xe5ee('0x25')],{'as':_0xe5ee('0x16b'),'foreignKey':_0xe5ee('0x16a'),'constraints':![]});db[_0xe5ee('0x21')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x12'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x21')][_0xe5ee('0x133')](db['CmContact'],{'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x16d')});db['MailServerIn']['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xe5ee('0x3d')]['belongsTo'](db['CloudProvider'],{'as':_0xe5ee('0x115'),'foreignKey':_0xe5ee('0x16e'),'onDelete':_0xe5ee('0x16f')});db['MailServerOut']['belongsTo'](db[_0xe5ee('0x41')],{'as':_0xe5ee('0x41'),'foreignKey':'MailAccountId'});db[_0xe5ee('0x3f')]['belongsTo'](db[_0xe5ee('0x115')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0xe5ee('0x16f')});db['MailAccount'][_0xe5ee('0x121')](db[_0xe5ee('0x3d')],{'as':_0xe5ee('0x170'),'onDelete':_0xe5ee('0x120')});db['MailAccount'][_0xe5ee('0x121')](db[_0xe5ee('0x3f')],{'as':_0xe5ee('0x171'),'onDelete':_0xe5ee('0x120')});db['MailAccount'][_0xe5ee('0x124')](db[_0xe5ee('0x172')],{'as':_0xe5ee('0x173'),'foreignKey':_0xe5ee('0x174'),'onDelete':'cascade'});db[_0xe5ee('0x41')][_0xe5ee('0x124')](db[_0xe5ee('0x87')],{'as':_0xe5ee('0x175'),'foreignKey':_0xe5ee('0x174')});db[_0xe5ee('0x41')]['hasMany'](db[_0xe5ee('0x176')],{'as':_0xe5ee('0x177'),'foreignKey':_0xe5ee('0x174')});db[_0xe5ee('0x41')][_0xe5ee('0x124')](db[_0xe5ee('0x13c')],{'as':_0xe5ee('0x178')});db[_0xe5ee('0x41')]['hasMany'](db[_0xe5ee('0x48')],{'as':_0xe5ee('0x179'),'foreignKey':_0xe5ee('0x174'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x41')]['belongsTo'](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x17a'),'foreignKey':_0xe5ee('0x17b')});db['MailAccount'][_0xe5ee('0x133')](db[_0xe5ee('0x17c')],{'as':'Template','foreignKey':_0xe5ee('0x17d')});db[_0xe5ee('0x41')][_0xe5ee('0x133')](db['Pause'],{'as':_0xe5ee('0x160'),'foreignKey':_0xe5ee('0x161')});db['MailAccount']['belongsToMany'](db['User'],{'as':_0xe5ee('0x163'),'through':_0xe5ee('0x17e')});db['MailQueue']['belongsToMany'](db[_0xe5ee('0x12')],{'as':'Agents','through':_0xe5ee('0x34')});db['MailQueue'][_0xe5ee('0x135')](db[_0xe5ee('0xee')],{'through':'team_has_mail_queues','as':'Teams'});db[_0xe5ee('0x13c')][_0xe5ee('0x124')](db['MailMessage'],{'as':'Messages','onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x17f')});db[_0xe5ee('0x13c')][_0xe5ee('0x133')](db[_0xe5ee('0x41')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x174')});db[_0xe5ee('0x13c')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':'Contact','foreignKey':_0xe5ee('0x16d')});db[_0xe5ee('0x13c')][_0xe5ee('0x133')](db['User'],{'as':_0xe5ee('0x181'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x13c')]['belongsToMany'](db[_0xe5ee('0x96')],{'through':_0xe5ee('0x182'),'as':'Tags'});db['MailInteraction'][_0xe5ee('0x135')](db['Tag'],{'through':_0xe5ee('0x182'),'as':_0xe5ee('0x183')});db[_0xe5ee('0x13c')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':'Users','through':_0xe5ee('0x13d'),'foreignKey':_0xe5ee('0x17f')});db['MailMessage'][_0xe5ee('0x124')](db[_0xe5ee('0xf5')],{'as':'Attachments','onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x176')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x12')});db[_0xe5ee('0x176')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'onDelete':_0xe5ee('0x120'),'as':'Contact'});db['MailMessage'][_0xe5ee('0x133')](db['MailInteraction'],{'as':_0xe5ee('0x184'),'foreignKey':_0xe5ee('0x17f')});db[_0xe5ee('0x176')]['belongsTo'](db[_0xe5ee('0x41')],{'as':'Account','foreignKey':_0xe5ee('0x174')});db[_0xe5ee('0x176')][_0xe5ee('0x133')](db[_0xe5ee('0x67')],{'as':_0xe5ee('0x67'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0xe5ee('0x133')](db[_0xe5ee('0x71')],{'as':_0xe5ee('0x71'),'foreignKey':_0xe5ee('0x185')});db[_0xe5ee('0x48')][_0xe5ee('0x133')](db['User'],{'onDelete':'restrict'});db[_0xe5ee('0x48')]['belongsTo'](db[_0xe5ee('0x144')],{'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x48')][_0xe5ee('0x133')](db[_0xe5ee('0x41')],{'onDelete':'restrict'});db[_0xe5ee('0x48')][_0xe5ee('0x133')](db[_0xe5ee('0x8c')],{'onDelete':_0xe5ee('0x16f'),'foreignKey':'IntervalId'});db[_0xe5ee('0x48')][_0xe5ee('0x133')](db['Tag'],{'onDelete':_0xe5ee('0x16f'),'foreignKey':'TagId'});db['MailQueueReport'][_0xe5ee('0x133')](db[_0xe5ee('0x41')],{});db[_0xe5ee('0x4a')][_0xe5ee('0x133')](db['CmList'],{'as':_0xe5ee('0x17a'),'foreignKey':_0xe5ee('0x17b')});db[_0xe5ee('0x4a')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x16d')});db[_0xe5ee('0x4a')]['belongsTo'](db['MailInteraction'],{});db[_0xe5ee('0x4a')]['belongsTo'](db[_0xe5ee('0x176')],{});db[_0xe5ee('0x4a')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{});db[_0xe5ee('0x4a')][_0xe5ee('0x133')](db[_0xe5ee('0x144')],{});db[_0xe5ee('0x4c')][_0xe5ee('0x124')](db[_0xe5ee('0x4e')],{'as':_0xe5ee('0x186'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x14b')]['hasMany'](db[_0xe5ee('0x172')],{'as':_0xe5ee('0x173'),'foreignKey':_0xe5ee('0x187'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x14b')]['hasMany'](db['CannedAnswer'],{'as':_0xe5ee('0x175'),'foreignKey':'FaxAccountId'});db[_0xe5ee('0x14b')]['hasMany'](db[_0xe5ee('0x50')],{'as':_0xe5ee('0x178')});db[_0xe5ee('0x14b')][_0xe5ee('0x124')](db[_0xe5ee('0x188')],{'as':_0xe5ee('0x179'),'foreignKey':_0xe5ee('0x187'),'onDelete':'cascade'});db['FaxAccount'][_0xe5ee('0x124')](db[_0xe5ee('0x126')],{'as':'Exntensions','onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x14b')][_0xe5ee('0x124')](db[_0xe5ee('0x52')],{'as':_0xe5ee('0x177')});db['FaxAccount'][_0xe5ee('0x133')](db['Trunk'],{'as':_0xe5ee('0x2b')});db[_0xe5ee('0x14b')]['belongsTo'](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x17a'),'foreignKey':_0xe5ee('0x17b')});db[_0xe5ee('0x14b')][_0xe5ee('0x133')](db[_0xe5ee('0x8e')],{'as':_0xe5ee('0x160'),'foreignKey':_0xe5ee('0x161')});db[_0xe5ee('0x14b')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':_0xe5ee('0x14d')});db[_0xe5ee('0x188')]['belongsTo'](db[_0xe5ee('0x12')],{'onDelete':'restrict'});db[_0xe5ee('0x188')][_0xe5ee('0x133')](db[_0xe5ee('0x189')],{'onDelete':_0xe5ee('0x16f')});db['FaxApplication'][_0xe5ee('0x133')](db[_0xe5ee('0x14b')],{'onDelete':'restrict'});db[_0xe5ee('0x188')][_0xe5ee('0x133')](db[_0xe5ee('0x96')],{'onDelete':'restrict','foreignKey':_0xe5ee('0x18a')});db['FaxInteraction'][_0xe5ee('0x124')](db[_0xe5ee('0x52')],{'as':'Messages','onDelete':_0xe5ee('0x120'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0xe5ee('0x133')](db[_0xe5ee('0x14b')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x187')});db[_0xe5ee('0x50')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':'Contact','foreignKey':_0xe5ee('0x16d')});db[_0xe5ee('0x50')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x181'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x50')][_0xe5ee('0x135')](db[_0xe5ee('0x96')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0xe5ee('0x50')]['belongsToMany'](db[_0xe5ee('0x96')],{'through':_0xe5ee('0x18b'),'as':_0xe5ee('0x183')});db[_0xe5ee('0x50')]['belongsToMany'](db['User'],{'as':_0xe5ee('0x18c'),'through':_0xe5ee('0x18d'),'foreignKey':_0xe5ee('0x18e')});db[_0xe5ee('0x52')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x12')});db[_0xe5ee('0x52')][_0xe5ee('0x133')](db[_0xe5ee('0x50')],{'as':_0xe5ee('0x184'),'foreignKey':_0xe5ee('0x18e')});db['FaxMessage'][_0xe5ee('0x133')](db['CmContact'],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x16c')});db[_0xe5ee('0x52')]['belongsTo'](db[_0xe5ee('0xf5')],{'as':_0xe5ee('0xf5'),'foreignKey':_0xe5ee('0x18f')});db[_0xe5ee('0x52')][_0xe5ee('0x133')](db[_0xe5ee('0x14b')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x187')});db[_0xe5ee('0x189')][_0xe5ee('0x135')](db['User'],{'as':_0xe5ee('0x163'),'through':'UserFaxQueue'});db[_0xe5ee('0x189')]['belongsToMany'](db['Team'],{'through':_0xe5ee('0x190'),'as':_0xe5ee('0x164')});db[_0xe5ee('0x55')][_0xe5ee('0x133')](db[_0xe5ee('0x14b')],{});db[_0xe5ee('0x55')][_0xe5ee('0x133')](db['CmList'],{'as':_0xe5ee('0x17a'),'foreignKey':_0xe5ee('0x17b')});db[_0xe5ee('0x55')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':'ContactId'});db[_0xe5ee('0x55')][_0xe5ee('0x133')](db[_0xe5ee('0x50')],{});db[_0xe5ee('0x55')]['belongsTo'](db[_0xe5ee('0x52')],{});db[_0xe5ee('0x55')]['belongsTo'](db[_0xe5ee('0x12')],{});db['FaxQueueReport'][_0xe5ee('0x133')](db[_0xe5ee('0x189')],{});db[_0xe5ee('0x57')]['hasMany'](db['Disposition'],{'as':_0xe5ee('0x173'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0xe5ee('0x57')][_0xe5ee('0x124')](db[_0xe5ee('0x87')],{'as':_0xe5ee('0x175'),'foreignKey':_0xe5ee('0x191')});db['SmsAccount'][_0xe5ee('0x124')](db[_0xe5ee('0x5b')],{'as':_0xe5ee('0x177'),'foreignKey':_0xe5ee('0x191')});db[_0xe5ee('0x57')][_0xe5ee('0x124')](db['SmsInteraction'],{'as':_0xe5ee('0x178')});db[_0xe5ee('0x57')]['hasMany'](db[_0xe5ee('0x192')],{'as':_0xe5ee('0x179'),'foreignKey':_0xe5ee('0x191'),'onDelete':'cascade'});db['SmsAccount'][_0xe5ee('0x133')](db[_0xe5ee('0xff')],{'as':'List','foreignKey':'ListId'});db[_0xe5ee('0x57')][_0xe5ee('0x133')](db['Pause'],{'as':_0xe5ee('0x160'),'foreignKey':_0xe5ee('0x161')});db[_0xe5ee('0x57')]['belongsToMany'](db[_0xe5ee('0x12')],{'as':'Agents','through':'user_has_sms_accounts'});db['SmsApplication']['belongsTo'](db[_0xe5ee('0x12')],{'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x192')][_0xe5ee('0x133')](db[_0xe5ee('0x5d')],{'onDelete':'restrict'});db[_0xe5ee('0x192')][_0xe5ee('0x133')](db[_0xe5ee('0x57')],{'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x192')][_0xe5ee('0x133')](db[_0xe5ee('0x8c')],{'onDelete':_0xe5ee('0x16f'),'foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0x192')][_0xe5ee('0x133')](db['Tag'],{'onDelete':_0xe5ee('0x16f'),'foreignKey':'TagId'});db[_0xe5ee('0x12b')]['hasMany'](db[_0xe5ee('0x5b')],{'as':_0xe5ee('0x177'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xe5ee('0x12b')][_0xe5ee('0x133')](db[_0xe5ee('0x57')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x191')});db[_0xe5ee('0x12b')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':'Contact','foreignKey':_0xe5ee('0x16d')});db[_0xe5ee('0x12b')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':'Owner','foreignKey':'UserId'});db['SmsInteraction'][_0xe5ee('0x135')](db['Tag'],{'through':_0xe5ee('0x193'),'as':_0xe5ee('0x194')});db['SmsInteraction'][_0xe5ee('0x135')](db['Tag'],{'through':_0xe5ee('0x193'),'as':'ThroughTags'});db['SmsInteraction'][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x18c'),'through':_0xe5ee('0x13f'),'foreignKey':_0xe5ee('0x195')});db['SmsMessage']['belongsTo'](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x12')});db[_0xe5ee('0x5b')]['belongsTo'](db[_0xe5ee('0x79')],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x16c')});db['SmsMessage'][_0xe5ee('0x133')](db[_0xe5ee('0x12b')],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x184'),'foreignKey':_0xe5ee('0x195')});db[_0xe5ee('0x5b')]['belongsTo'](db[_0xe5ee('0x57')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x191')});db['SmsQueue'][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0xe5ee('0x196')});db['SmsQueue'][_0xe5ee('0x135')](db['Team'],{'through':_0xe5ee('0x197'),'as':_0xe5ee('0x164')});db[_0xe5ee('0x5f')][_0xe5ee('0x124')](db['Disposition'],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xe5ee('0x120')});db['OpenchannelAccount'][_0xe5ee('0x124')](db[_0xe5ee('0x87')],{'as':_0xe5ee('0x175'),'foreignKey':'OpenchannelAccountId'});db[_0xe5ee('0x5f')][_0xe5ee('0x124')](db[_0xe5ee('0x128')],{'as':_0xe5ee('0x178'),'foreignKey':_0xe5ee('0x198')});db['OpenchannelAccount'][_0xe5ee('0x124')](db[_0xe5ee('0x64')],{'as':_0xe5ee('0x177'),'foreignKey':_0xe5ee('0x198')});db['OpenchannelAccount'][_0xe5ee('0x124')](db[_0xe5ee('0x61')],{'as':_0xe5ee('0x179'),'foreignKey':_0xe5ee('0x198'),'onDelete':'cascade'});db[_0xe5ee('0x5f')][_0xe5ee('0x133')](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x17a'),'foreignKey':'ListId'});db[_0xe5ee('0x5f')]['belongsTo'](db[_0xe5ee('0x8e')],{'as':_0xe5ee('0x160'),'foreignKey':_0xe5ee('0x161')});db[_0xe5ee('0x5f')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':_0xe5ee('0x14f')});db[_0xe5ee('0x61')]['belongsTo'](db[_0xe5ee('0x12')],{'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x61')][_0xe5ee('0x133')](db[_0xe5ee('0x66')],{'onDelete':_0xe5ee('0x16f'),'foreignKey':_0xe5ee('0x199')});db[_0xe5ee('0x61')][_0xe5ee('0x133')](db[_0xe5ee('0x5f')],{'onDelete':_0xe5ee('0x16f'),'foreignKey':_0xe5ee('0x198')});db[_0xe5ee('0x61')][_0xe5ee('0x133')](db[_0xe5ee('0x8c')],{'onDelete':_0xe5ee('0x16f'),'foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0x61')]['belongsTo'](db[_0xe5ee('0x96')],{'onDelete':_0xe5ee('0x16f'),'foreignKey':'TagId'});db[_0xe5ee('0x128')][_0xe5ee('0x124')](db[_0xe5ee('0x64')],{'as':_0xe5ee('0x177'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xe5ee('0x128')][_0xe5ee('0x133')](db[_0xe5ee('0x5f')],{'as':'Account','foreignKey':_0xe5ee('0x198')});db[_0xe5ee('0x128')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x16d')});db['OpenchannelInteraction'][_0xe5ee('0x133')](db['User'],{'as':_0xe5ee('0x181'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0xe5ee('0x135')](db[_0xe5ee('0x96')],{'through':_0xe5ee('0x19a'),'as':'Tags'});db[_0xe5ee('0x128')][_0xe5ee('0x135')](db['Tag'],{'through':_0xe5ee('0x19a'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x18c'),'through':_0xe5ee('0x140'),'foreignKey':_0xe5ee('0x19b')});db['OpenchannelMessage'][_0xe5ee('0x133')](db['User'],{'onDelete':'cascade','as':_0xe5ee('0x12')});db['OpenchannelMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x16c')});db['OpenchannelMessage'][_0xe5ee('0x133')](db[_0xe5ee('0x128')],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x184'),'foreignKey':'OpenchannelInteractionId'});db[_0xe5ee('0x64')]['belongsTo'](db['Attachment'],{'as':_0xe5ee('0xf5'),'foreignKey':_0xe5ee('0x18f')});db[_0xe5ee('0x64')][_0xe5ee('0x133')](db['OpenchannelAccount'],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x198')});db[_0xe5ee('0x66')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':_0xe5ee('0x39'),'foreignKey':_0xe5ee('0x199')});db[_0xe5ee('0x66')][_0xe5ee('0x135')](db[_0xe5ee('0xee')],{'through':_0xe5ee('0x19c'),'as':'Teams'});db[_0xe5ee('0x67')][_0xe5ee('0x124')](db[_0xe5ee('0x172')],{'as':'Dispositions','foreignKey':_0xe5ee('0x19d'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x67')]['hasMany'](db[_0xe5ee('0x87')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xe5ee('0x124')](db[_0xe5ee('0x76')],{'as':_0xe5ee('0x19e')});db[_0xe5ee('0x67')][_0xe5ee('0x124')](db[_0xe5ee('0x6d')],{'as':_0xe5ee('0x178')});db[_0xe5ee('0x67')][_0xe5ee('0x124')](db[_0xe5ee('0x6b')],{'as':_0xe5ee('0x179'),'foreignKey':_0xe5ee('0x19d'),'onDelete':'cascade'});db[_0xe5ee('0x67')][_0xe5ee('0x124')](db[_0xe5ee('0x6f')],{'as':_0xe5ee('0x177')});db[_0xe5ee('0x67')]['belongsTo'](db[_0xe5ee('0xff')],{'as':'List','foreignKey':_0xe5ee('0x17b')});db['ChatWebsite'][_0xe5ee('0x133')](db['Interval'],{'as':'Interval','foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0x67')][_0xe5ee('0x133')](db[_0xe5ee('0x41')],{'as':'MailAccount','foreignKey':_0xe5ee('0x174')});db[_0xe5ee('0x67')][_0xe5ee('0x133')](db[_0xe5ee('0x8e')],{'as':_0xe5ee('0x160'),'foreignKey':_0xe5ee('0x161')});db['ChatWebsite'][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':_0xe5ee('0x19f')});db[_0xe5ee('0x69')]['belongsTo'](db[_0xe5ee('0x5f')],{});db[_0xe5ee('0x69')][_0xe5ee('0x133')](db['CmList'],{'as':_0xe5ee('0x17a'),'foreignKey':_0xe5ee('0x17b')});db[_0xe5ee('0x69')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x16d')});db[_0xe5ee('0x69')][_0xe5ee('0x133')](db[_0xe5ee('0x128')],{});db[_0xe5ee('0x69')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xe5ee('0x69')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{});db[_0xe5ee('0x69')][_0xe5ee('0x133')](db[_0xe5ee('0x66')],{});db[_0xe5ee('0x6b')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x1a0'),'foreignKey':_0xe5ee('0x123'),'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x6b')][_0xe5ee('0x133')](db[_0xe5ee('0x73')],{'as':'Queue','foreignKey':_0xe5ee('0x1a1'),'onDelete':_0xe5ee('0x16f')});db['ChatApplication'][_0xe5ee('0x133')](db[_0xe5ee('0x67')],{'as':'Website','foreignKey':_0xe5ee('0x19d'),'onDelete':_0xe5ee('0x16f')});db['ChatApplication'][_0xe5ee('0x133')](db[_0xe5ee('0x96')],{'onDelete':_0xe5ee('0x16f'),'foreignKey':_0xe5ee('0x18a')});db[_0xe5ee('0x6d')][_0xe5ee('0x124')](db[_0xe5ee('0x6f')],{'as':_0xe5ee('0x177'),'onDelete':'cascade','foreignKey':_0xe5ee('0x1a2')});db[_0xe5ee('0x6d')][_0xe5ee('0x133')](db[_0xe5ee('0x67')],{'as':_0xe5ee('0x180'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':'Contact','foreignKey':_0xe5ee('0x16d')});db['ChatInteraction'][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':'Owner','foreignKey':_0xe5ee('0x123')});db['ChatInteraction'][_0xe5ee('0x135')](db[_0xe5ee('0x96')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xe5ee('0x6d')][_0xe5ee('0x135')](db[_0xe5ee('0x96')],{'through':_0xe5ee('0x1a3'),'as':'ThroughTags'});db[_0xe5ee('0x6d')]['belongsToMany'](db['User'],{'as':_0xe5ee('0x18c'),'through':_0xe5ee('0x13e'),'foreignKey':_0xe5ee('0x1a2')});db['ChatMessage'][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x12')});db[_0xe5ee('0x6f')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x16d')});db[_0xe5ee('0x6f')][_0xe5ee('0x133')](db[_0xe5ee('0x6d')],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x184'),'foreignKey':_0xe5ee('0x1a2')});db['ChatMessage'][_0xe5ee('0x133')](db[_0xe5ee('0xf5')],{'as':_0xe5ee('0xf5'),'foreignKey':_0xe5ee('0x18f')});db[_0xe5ee('0x6f')][_0xe5ee('0x133')](db[_0xe5ee('0x67')],{'as':'Account','foreignKey':_0xe5ee('0x19d')});db['ChatOfflineMessage'][_0xe5ee('0x124')](db[_0xe5ee('0xf5')],{'as':_0xe5ee('0x1a4'),'foreignKey':_0xe5ee('0x185'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'onDelete':_0xe5ee('0x120'),'as':'Contact','foreignKey':'ContactId'});db[_0xe5ee('0x71')][_0xe5ee('0x133')](db[_0xe5ee('0x67')],{'as':_0xe5ee('0x180'),'foreignKey':'ChatWebsiteId'});db[_0xe5ee('0x73')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':'UserChatQueue','hooks':!![]});db[_0xe5ee('0x73')][_0xe5ee('0x135')](db[_0xe5ee('0xee')],{'through':_0xe5ee('0x1a5'),'as':_0xe5ee('0x164')});db[_0xe5ee('0x75')][_0xe5ee('0x124')](db['ChatInternalMessage'],{'as':_0xe5ee('0x177'),'foreignKey':'ChatGroupId','onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x75')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x158'),'through':_0xe5ee('0x137')});db[_0xe5ee('0x76')][_0xe5ee('0x133')](db[_0xe5ee('0x67')],{'as':_0xe5ee('0x1a6'),'foreignKey':_0xe5ee('0x19d')});db['CmCompany'][_0xe5ee('0x124')](db['CmContact'],{'as':_0xe5ee('0x138'),'foreignKey':_0xe5ee('0x1a7')});db[_0xe5ee('0x79')][_0xe5ee('0x124')](db[_0xe5ee('0x9a')],{'as':_0xe5ee('0x1a8'),'foreignKey':_0xe5ee('0x1a9')});db['CmContact'][_0xe5ee('0x124')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xe5ee('0x16d')});db[_0xe5ee('0x79')][_0xe5ee('0x124')](db[_0xe5ee('0x7d')],{'as':'HopperFinals','foreignKey':'ContactId'});db['CmContact'][_0xe5ee('0x124')](db[_0xe5ee('0x7f')],{'as':_0xe5ee('0x1aa'),'foreignKey':_0xe5ee('0x16d')});db['CmContact'][_0xe5ee('0x124')](db[_0xe5ee('0x81')],{'as':'ReportAgentPreview','foreignKey':_0xe5ee('0x16d')});db['CmContact'][_0xe5ee('0x124')](db[_0xe5ee('0xde')],{'as':_0xe5ee('0x15b'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0xe5ee('0x129'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xe5ee('0x79')][_0xe5ee('0x124')](db[_0xe5ee('0x6d')],{'as':_0xe5ee('0x12a'),'foreignKey':'ContactId','onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x79')][_0xe5ee('0x124')](db['SmsInteraction'],{'as':_0xe5ee('0x12c'),'foreignKey':_0xe5ee('0x16d'),'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x79')][_0xe5ee('0x124')](db[_0xe5ee('0x50')],{'as':'FaxInteractions','foreignKey':_0xe5ee('0x16d'),'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x79')][_0xe5ee('0x124')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xe5ee('0x16d'),'onDelete':_0xe5ee('0x16f')});db['CmContact'][_0xe5ee('0x133')](db[_0xe5ee('0x1ab')],{'as':'Company','foreignKey':_0xe5ee('0x1a7')});db['CmContact']['belongsTo'](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x17a'),'foreignKey':'ListId','onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x79')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':'Users','through':_0xe5ee('0x139')});db[_0xe5ee('0x79')][_0xe5ee('0x135')](db[_0xe5ee('0x96')],{'as':'Tags','through':_0xe5ee('0x1ac')});db['CmContact'][_0xe5ee('0x135')](db[_0xe5ee('0x96')],{'through':'cm_contact_has_tags','as':_0xe5ee('0x183')});db['CmHopper'][_0xe5ee('0x124')](db[_0xe5ee('0x9c')],{'as':_0xe5ee('0x1ad'),'foreignKey':_0xe5ee('0x1ae')});db[_0xe5ee('0x131')][_0xe5ee('0x133')](db['CmContact'],{'as':_0xe5ee('0x16c'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xe5ee('0x131')][_0xe5ee('0x133')](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x17a'),'foreignKey':'ListId','onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x131')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x1a0'),'foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x131')][_0xe5ee('0x133')](db['VoiceQueue'],{'as':_0xe5ee('0x1af'),'foreignKey':_0xe5ee('0x159'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x131')][_0xe5ee('0x133')](db[_0xe5ee('0xf1')],{'as':'Campaign','foreignKey':_0xe5ee('0x1b0'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x131')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x181'),'foreignKey':'OwnerId'});db[_0xe5ee('0x7c')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x16d'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x7c')][_0xe5ee('0x133')](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x17a'),'foreignKey':_0xe5ee('0x17b'),'onDelete':_0xe5ee('0x120')});db['CmHopperBlack'][_0xe5ee('0x133')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xe5ee('0x159'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db['Campaign'],{'as':_0xe5ee('0xf1'),'foreignKey':_0xe5ee('0x1b0'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x85')]['hasMany'](db[_0xe5ee('0x8a')],{'as':{'plural':_0xe5ee('0x1b1'),'singular':_0xe5ee('0x1b2')},'foreignKey':_0xe5ee('0x1b3'),'onDelete':_0xe5ee('0x120'),'hooks':!![]});db[_0xe5ee('0x85')][_0xe5ee('0x124')](db[_0xe5ee('0x8a')],{'as':{'plural':_0xe5ee('0x1b4'),'singular':_0xe5ee('0x1b5')},'foreignKey':_0xe5ee('0x1b6'),'onDelete':'cascade','hooks':!![]});db[_0xe5ee('0x85')][_0xe5ee('0x124')](db[_0xe5ee('0x84')],{'as':_0xe5ee('0x1b7'),'foreignKey':_0xe5ee('0x1b8'),'onDelete':_0xe5ee('0x120'),'hooks':!![]});db[_0xe5ee('0x172')][_0xe5ee('0x124')](db['Disposition'],{'as':_0xe5ee('0x173'),'foreignKey':_0xe5ee('0x1b9'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x8c')][_0xe5ee('0x124')](db['Interval'],{'as':'Intervals','foreignKey':_0xe5ee('0x15f'),'onDelete':_0xe5ee('0x120'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xe5ee('0x126')],{'as':_0xe5ee('0x1ba'),'foreignKey':_0xe5ee('0x15f'),'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x8c')][_0xe5ee('0x124')](db[_0xe5ee('0x48')],{'as':_0xe5ee('0x1bb'),'foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0x8c')][_0xe5ee('0x124')](db[_0xe5ee('0x6b')],{'as':_0xe5ee('0x1bc'),'foreignKey':_0xe5ee('0x15f')});db['Interval']['hasMany'](db[_0xe5ee('0x188')],{'as':'FaxApplications','foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0x8c')]['hasMany'](db['SmsApplication'],{'as':_0xe5ee('0x1bd'),'foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0x1be')][_0xe5ee('0x133')](db[_0xe5ee('0x41')],{});db[_0xe5ee('0x1be')][_0xe5ee('0x133')](db[_0xe5ee('0xa6')],{'foreignKey':_0xe5ee('0x1bf')});db[_0xe5ee('0x1be')][_0xe5ee('0x133')](db[_0xe5ee('0xa5')],{'foreignKey':'CustomReportId'});db['Sound'][_0xe5ee('0x135')](db[_0xe5ee('0x19')],{'as':_0xe5ee('0x1c0'),'through':'moh_has_sounds','onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x96')][_0xe5ee('0x135')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xe5ee('0x96')][_0xe5ee('0x135')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xe5ee('0x96')][_0xe5ee('0x135')](db[_0xe5ee('0x13c')],{'through':_0xe5ee('0x182')});db['Tag'][_0xe5ee('0x135')](db[_0xe5ee('0x12b')],{'through':_0xe5ee('0x193')});db[_0xe5ee('0x96')]['belongsToMany'](db['FaxInteraction'],{'through':_0xe5ee('0x18b')});db[_0xe5ee('0x96')][_0xe5ee('0x135')](db[_0xe5ee('0x128')],{'through':_0xe5ee('0x19a')});db[_0xe5ee('0x96')][_0xe5ee('0x135')](db[_0xe5ee('0x10e')],{'through':_0xe5ee('0x1c1')});db[_0xe5ee('0x9a')][_0xe5ee('0x133')](db[_0xe5ee('0x98')],{'as':_0xe5ee('0x1c2'),'foreignKey':'ItemTypeId'});db[_0xe5ee('0x9c')][_0xe5ee('0x133')](db[_0xe5ee('0x131')],{'as':_0xe5ee('0x1c3'),'foreignKey':'CmHopperId'});db[_0xe5ee('0x9a')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x1a9')});db[_0xe5ee('0x9e')][_0xe5ee('0x124')](db[_0xe5ee('0x8a')],{'as':{'plural':_0xe5ee('0x1c4'),'singular':_0xe5ee('0x1c5')},'foreignKey':_0xe5ee('0x1c6'),'onDelete':_0xe5ee('0x120'),'hooks':!![]});db[_0xe5ee('0x9e')][_0xe5ee('0x124')](db['Condition'],{'as':{'plural':_0xe5ee('0x1c7'),'singular':'AnyCondition'},'foreignKey':_0xe5ee('0x1c8'),'onDelete':_0xe5ee('0x120'),'hooks':!![]});db[_0xe5ee('0x9e')][_0xe5ee('0x124')](db[_0xe5ee('0x84')],{'as':_0xe5ee('0x1b7'),'foreignKey':_0xe5ee('0x1c9'),'onDelete':_0xe5ee('0x120'),'hooks':!![]});db[_0xe5ee('0xa5')][_0xe5ee('0x124')](db['AnalyticFieldReport'],{'as':_0xe5ee('0x1ca'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1cb'),'hooks':!![]});db['AnalyticDefaultReport'][_0xe5ee('0x124')](db[_0xe5ee('0xab')],{'as':'Fields','onDelete':_0xe5ee('0x120'),'foreignKey':'DefaultReportId'});db[_0xe5ee('0xa9')]['hasMany'](db[_0xe5ee('0xab')],{'as':_0xe5ee('0x1ca'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1cc')});db['AnalyticFieldReport']['belongsTo'](db[_0xe5ee('0xa9')],{'foreignKey':_0xe5ee('0x1cc')});db['SalesforceAccount'][_0xe5ee('0x124')](db['SalesforceConfiguration'],{'as':_0xe5ee('0x1cd'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xb0')][_0xe5ee('0x124')](db[_0xe5ee('0xb2')],{'as':_0xe5ee('0x1cf'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xb0')][_0xe5ee('0x124')](db[_0xe5ee('0xb2')],{'as':'Descriptions','onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xb0')][_0xe5ee('0x124')](db[_0xe5ee('0xb2')],{'as':_0xe5ee('0x1ca'),'onDelete':_0xe5ee('0x120'),'foreignKey':'FieldId'});db[_0xe5ee('0xb0')][_0xe5ee('0x133')](db[_0xe5ee('0xae')],{'as':_0xe5ee('0x180'),'foreignKey':'AccountId'});db[_0xe5ee('0xb2')][_0xe5ee('0x124')](db[_0xe5ee('0xb2')],{'as':_0xe5ee('0x1d2'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xb2')][_0xe5ee('0x124')](db[_0xe5ee('0xb2')],{'as':'Description','foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xb2')][_0xe5ee('0x124')](db[_0xe5ee('0xb2')],{'as':_0xe5ee('0x1d3'),'foreignKey':_0xe5ee('0x1d4')});db['SalesforceField'][_0xe5ee('0x133')](db['Variable'],{'as':_0xe5ee('0xa0'),'foreignKey':_0xe5ee('0x1d5')});db[_0xe5ee('0xb4')][_0xe5ee('0x124')](db[_0xe5ee('0xb5')],{'as':'Configurations','onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xb5')][_0xe5ee('0x124')](db[_0xe5ee('0xb6')],{'as':_0xe5ee('0x1cf'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xb5')]['hasMany'](db[_0xe5ee('0xb6')],{'as':_0xe5ee('0x1d6'),'onDelete':_0xe5ee('0x120'),'foreignKey':'DescriptionId'});db[_0xe5ee('0xb5')][_0xe5ee('0x124')](db[_0xe5ee('0xb6')],{'as':_0xe5ee('0x1ca'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0xb5')][_0xe5ee('0x133')](db[_0xe5ee('0xb4')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xb6')][_0xe5ee('0x124')](db[_0xe5ee('0xb6')],{'as':'Subject','foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xb6')][_0xe5ee('0x124')](db[_0xe5ee('0xb6')],{'as':_0xe5ee('0x1d7'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xb6')][_0xe5ee('0x124')](db['SugarcrmField'],{'as':_0xe5ee('0x1d3'),'foreignKey':'FieldId'});db[_0xe5ee('0xb6')][_0xe5ee('0x133')](db[_0xe5ee('0xa0')],{'as':'Variable','foreignKey':_0xe5ee('0x1d5')});db['DeskAccount']['hasMany'](db[_0xe5ee('0xb8')],{'as':_0xe5ee('0x1cd'),'onDelete':'cascade','foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xb8')][_0xe5ee('0x124')](db['DeskField'],{'as':'Subjects','onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d0')});db['DeskConfiguration'][_0xe5ee('0x124')](db['DeskField'],{'as':_0xe5ee('0x1d6'),'onDelete':_0xe5ee('0x120'),'foreignKey':'DescriptionId'});db[_0xe5ee('0xb8')][_0xe5ee('0x124')](db[_0xe5ee('0x1d8')],{'as':_0xe5ee('0x1ca'),'onDelete':_0xe5ee('0x120'),'foreignKey':'FieldId'});db[_0xe5ee('0xb8')][_0xe5ee('0x133')](db[_0xe5ee('0xb7')],{'as':'Account','foreignKey':'AccountId'});db[_0xe5ee('0xb8')][_0xe5ee('0x135')](db['Tag'],{'through':_0xe5ee('0x1d9')});db[_0xe5ee('0x1d8')][_0xe5ee('0x124')](db[_0xe5ee('0x1d8')],{'as':'Subject','foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0x1d8')][_0xe5ee('0x124')](db['DeskField'],{'as':_0xe5ee('0x1d7'),'foreignKey':_0xe5ee('0x1d1')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0xe5ee('0x1d3'),'foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0x1d8')][_0xe5ee('0x133')](db['Variable'],{'as':'Variable','foreignKey':_0xe5ee('0x1d5')});db[_0xe5ee('0xbb')][_0xe5ee('0x124')](db['ZohoConfiguration'],{'as':_0xe5ee('0x1cd'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xbc')]['hasMany'](db[_0xe5ee('0xbd')],{'as':_0xe5ee('0x1cf'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xbc')][_0xe5ee('0x124')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xbc')][_0xe5ee('0x124')](db['ZohoField'],{'as':_0xe5ee('0x1ca'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0xbc')][_0xe5ee('0x133')](db[_0xe5ee('0xbb')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xbd')][_0xe5ee('0x124')](db[_0xe5ee('0xbd')],{'as':_0xe5ee('0x1d2'),'foreignKey':_0xe5ee('0x1d0')});db['ZohoField'][_0xe5ee('0x124')](db[_0xe5ee('0xbd')],{'as':_0xe5ee('0x1d7'),'foreignKey':'DescriptionId'});db[_0xe5ee('0xbd')]['hasMany'](db[_0xe5ee('0xbd')],{'as':'Field','foreignKey':_0xe5ee('0x1d4')});db['ZohoField'][_0xe5ee('0x133')](db[_0xe5ee('0xa0')],{'as':_0xe5ee('0xa0'),'foreignKey':_0xe5ee('0x1d5')});db[_0xe5ee('0x1da')][_0xe5ee('0x124')](db[_0xe5ee('0xbe')],{'as':_0xe5ee('0x1cd'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xbe')][_0xe5ee('0x124')](db['ZendeskField'],{'as':_0xe5ee('0x1cf'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xbe')][_0xe5ee('0x124')](db[_0xe5ee('0xc0')],{'as':'Descriptions','foreignKey':_0xe5ee('0x1d1')});db['ZendeskConfiguration']['hasMany'](db[_0xe5ee('0xc0')],{'as':_0xe5ee('0x1ca'),'foreignKey':_0xe5ee('0x1d4')});db['ZendeskConfiguration'][_0xe5ee('0x133')](db[_0xe5ee('0x1da')],{'as':'Account','foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xbe')][_0xe5ee('0x135')](db[_0xe5ee('0x96')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0xe5ee('0x124')](db['ZendeskField'],{'as':_0xe5ee('0x1d2'),'foreignKey':'SubjectId'});db[_0xe5ee('0xc0')][_0xe5ee('0x124')](db['ZendeskField'],{'as':_0xe5ee('0x1d7'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xc0')]['hasMany'](db[_0xe5ee('0xc0')],{'as':_0xe5ee('0x1d3'),'foreignKey':'FieldId'});db[_0xe5ee('0xc0')][_0xe5ee('0x133')](db[_0xe5ee('0xa0')],{'as':_0xe5ee('0xa0'),'foreignKey':_0xe5ee('0x1d5')});db[_0xe5ee('0xc2')][_0xe5ee('0x124')](db[_0xe5ee('0x1db')],{'as':_0xe5ee('0x1cd'),'onDelete':_0xe5ee('0x120'),'foreignKey':'AccountId'});db[_0xe5ee('0x1db')][_0xe5ee('0x124')](db['FreshdeskField'],{'as':_0xe5ee('0x1cf'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0x1db')][_0xe5ee('0x124')](db['FreshdeskField'],{'as':_0xe5ee('0x1d6'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d1')});db['FreshdeskConfiguration'][_0xe5ee('0x124')](db[_0xe5ee('0xc5')],{'as':_0xe5ee('0x1ca'),'onDelete':_0xe5ee('0x120'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xe5ee('0x133')](db[_0xe5ee('0xc2')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x1ce')});db['FreshdeskConfiguration'][_0xe5ee('0x135')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0xe5ee('0xc5')][_0xe5ee('0x124')](db[_0xe5ee('0xc5')],{'as':_0xe5ee('0x1d2'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xc5')][_0xe5ee('0x124')](db[_0xe5ee('0xc5')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0xe5ee('0x124')](db[_0xe5ee('0xc5')],{'as':_0xe5ee('0x1d3'),'foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0xc5')][_0xe5ee('0x133')](db[_0xe5ee('0xa0')],{'as':_0xe5ee('0xa0'),'foreignKey':_0xe5ee('0x1d5')});db['VtigerAccount'][_0xe5ee('0x124')](db[_0xe5ee('0xc9')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xe5ee('0xc9')]['hasMany'](db['VtigerField'],{'as':_0xe5ee('0x1cf'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xc9')]['hasMany'](db['VtigerField'],{'as':_0xe5ee('0x1d6'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xe5ee('0x124')](db[_0xe5ee('0xcb')],{'as':'Fields','foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0xc9')][_0xe5ee('0x133')](db[_0xe5ee('0xc7')],{'as':'Account','foreignKey':_0xe5ee('0x1ce')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0xe5ee('0x1d0')});db['VtigerField']['hasMany'](db[_0xe5ee('0xcb')],{'as':_0xe5ee('0x1d7'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xcb')]['hasMany'](db[_0xe5ee('0xcb')],{'as':_0xe5ee('0x1d3'),'foreignKey':'FieldId'});db[_0xe5ee('0xcb')]['belongsTo'](db[_0xe5ee('0xa0')],{'as':_0xe5ee('0xa0'),'foreignKey':_0xe5ee('0x1d5')});db[_0xe5ee('0xcc')]['hasMany'](db['ServicenowConfiguration'],{'as':_0xe5ee('0x1cd'),'onDelete':'cascade','foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xce')][_0xe5ee('0x124')](db['ServicenowField'],{'as':_0xe5ee('0x1cf'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xe5ee('0x124')](db[_0xe5ee('0x1dc')],{'as':_0xe5ee('0x1d6'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xce')]['hasMany'](db[_0xe5ee('0x1dc')],{'as':_0xe5ee('0x1ca'),'foreignKey':'FieldId'});db[_0xe5ee('0xce')][_0xe5ee('0x133')](db[_0xe5ee('0xcc')],{'as':_0xe5ee('0x180'),'foreignKey':'AccountId'});db[_0xe5ee('0x1dc')][_0xe5ee('0x124')](db[_0xe5ee('0x1dc')],{'as':_0xe5ee('0x1d2'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0x1dc')][_0xe5ee('0x124')](db['ServicenowField'],{'as':_0xe5ee('0x1d7'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0x1dc')][_0xe5ee('0x124')](db['ServicenowField'],{'as':_0xe5ee('0x1d3'),'foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0x1dc')]['belongsTo'](db[_0xe5ee('0xa0')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe5ee('0xd1')]['hasMany'](db[_0xe5ee('0xd3')],{'as':_0xe5ee('0x1cd'),'onDelete':_0xe5ee('0x120'),'foreignKey':'AccountId'});db[_0xe5ee('0xd1')][_0xe5ee('0x133')](db[_0xe5ee('0x115')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db[_0xe5ee('0xd3')]['hasMany'](db[_0xe5ee('0xd4')],{'as':'Subjects','onDelete':_0xe5ee('0x120'),'foreignKey':'SubjectId'});db[_0xe5ee('0xd3')]['hasMany'](db[_0xe5ee('0xd4')],{'as':_0xe5ee('0x1d6'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xd3')]['hasMany'](db['Dynamics365Field'],{'as':_0xe5ee('0x1ca'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1d4')});db['Dynamics365Configuration']['belongsTo'](db[_0xe5ee('0xd1')],{'as':'Account','foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xd4')][_0xe5ee('0x124')](db[_0xe5ee('0xd4')],{'as':_0xe5ee('0x1d2'),'foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xd4')]['hasMany'](db[_0xe5ee('0xd4')],{'as':_0xe5ee('0x1d7'),'foreignKey':'DescriptionId'});db[_0xe5ee('0xd4')][_0xe5ee('0x124')](db[_0xe5ee('0xd4')],{'as':_0xe5ee('0x1d3'),'foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0xd4')][_0xe5ee('0x133')](db['Variable'],{'as':_0xe5ee('0xa0'),'foreignKey':'VariableId'});db[_0xe5ee('0xd6')]['hasMany'](db[_0xe5ee('0xd8')],{'as':_0xe5ee('0x1cd'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1ce')});db[_0xe5ee('0xd8')][_0xe5ee('0x124')](db[_0xe5ee('0xd9')],{'as':_0xe5ee('0x1cf'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xe5ee('0x124')](db[_0xe5ee('0xd9')],{'as':_0xe5ee('0x1d6'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0xe5ee('0x124')](db[_0xe5ee('0xd9')],{'as':_0xe5ee('0x1ca'),'foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0xd8')][_0xe5ee('0x133')](db['FreshsalesAccount'],{'as':_0xe5ee('0x180'),'foreignKey':'AccountId'});db[_0xe5ee('0xd9')][_0xe5ee('0x124')](db[_0xe5ee('0xd9')],{'as':'Subject','foreignKey':_0xe5ee('0x1d0')});db[_0xe5ee('0xd9')]['hasMany'](db[_0xe5ee('0xd9')],{'as':_0xe5ee('0x1d7'),'foreignKey':_0xe5ee('0x1d1')});db[_0xe5ee('0xd9')][_0xe5ee('0x124')](db['FreshsalesField'],{'as':_0xe5ee('0x1d3'),'foreignKey':_0xe5ee('0x1d4')});db[_0xe5ee('0xd9')]['belongsTo'](db['Variable'],{'as':_0xe5ee('0xa0'),'foreignKey':_0xe5ee('0x1d5')});db[_0xe5ee('0x1dd')][_0xe5ee('0x133')](db['ChatWebsite'],{});db[_0xe5ee('0x1dd')][_0xe5ee('0x133')](db['CmList'],{'as':_0xe5ee('0x17a'),'foreignKey':_0xe5ee('0x17b')});db['ChatQueueReport'][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x16d')});db[_0xe5ee('0x1dd')][_0xe5ee('0x133')](db['ChatInteraction'],{});db[_0xe5ee('0x1dd')][_0xe5ee('0x133')](db[_0xe5ee('0x6f')],{});db['ChatQueueReport'][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{});db['ChatQueueReport'][_0xe5ee('0x133')](db['ChatQueue'],{});db[_0xe5ee('0x1de')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x1df')});db['ChatInternalMessage'][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'onDelete':'cascade','foreignKey':_0xe5ee('0x1e0')});db[_0xe5ee('0xde')][_0xe5ee('0x124')](db[_0xe5ee('0x1e1')],{'foreignKey':'SessionId','onDelete':_0xe5ee('0x120')});db['JscriptySessionReport']['hasMany'](db[_0xe5ee('0xdc')],{'foreignKey':_0xe5ee('0x1e2'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0xe0')][_0xe5ee('0x133')](db['SmsAccount'],{});db[_0xe5ee('0xe0')][_0xe5ee('0x133')](db[_0xe5ee('0xff')],{'as':'List','foreignKey':_0xe5ee('0x17b')});db['SmsQueueReport'][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':_0xe5ee('0x16d')});db['SmsQueueReport'][_0xe5ee('0x133')](db[_0xe5ee('0x12b')],{});db['SmsQueueReport'][_0xe5ee('0x133')](db[_0xe5ee('0x5b')],{});db[_0xe5ee('0xe0')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{});db[_0xe5ee('0xe0')]['belongsTo'](db[_0xe5ee('0x5d')],{});db[_0xe5ee('0x1e3')][_0xe5ee('0x124')](db['JscriptySessionReport'],{'foreignKey':_0xe5ee('0x1e4')});db[_0xe5ee('0x1e3')][_0xe5ee('0x124')](db[_0xe5ee('0x1e1')],{'foreignKey':'ProjectId'});db[_0xe5ee('0x1e3')][_0xe5ee('0x124')](db['JscriptyAnswerReport'],{'foreignKey':_0xe5ee('0x1e4')});db['Team']['belongsToMany'](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':'user_has_teams'});db[_0xe5ee('0xee')]['belongsToMany'](db[_0xe5ee('0x141')],{'through':'TeamVoiceQueue','as':_0xe5ee('0x142')});db['Team'][_0xe5ee('0x135')](db[_0xe5ee('0x144')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team'][_0xe5ee('0x135')](db[_0xe5ee('0x73')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xe5ee('0xee')][_0xe5ee('0x135')](db[_0xe5ee('0x189')],{'through':_0xe5ee('0x190'),'as':_0xe5ee('0x147')});db[_0xe5ee('0xee')][_0xe5ee('0x135')](db[_0xe5ee('0x5d')],{'through':_0xe5ee('0x197'),'as':_0xe5ee('0x148')});db[_0xe5ee('0xee')][_0xe5ee('0x135')](db[_0xe5ee('0x66')],{'through':_0xe5ee('0x19c'),'as':'OpenchannelQueues'});db[_0xe5ee('0xee')][_0xe5ee('0x135')](db[_0xe5ee('0x113')],{'through':_0xe5ee('0x1e5'),'as':_0xe5ee('0x14a')});db['Team'][_0xe5ee('0x135')](db[_0xe5ee('0x101')],{'through':_0xe5ee('0x1e6'),'as':_0xe5ee('0x143')});db[_0xe5ee('0xf1')][_0xe5ee('0x124')](db[_0xe5ee('0x131')],{'as':_0xe5ee('0x132'),'foreignKey':_0xe5ee('0x1b0')});db[_0xe5ee('0xf1')][_0xe5ee('0x124')](db[_0xe5ee('0x7d')],{'as':_0xe5ee('0x127'),'foreignKey':_0xe5ee('0x1b0')});db[_0xe5ee('0xf1')][_0xe5ee('0x124')](db['CmHopperHistory'],{'as':_0xe5ee('0x1aa'),'foreignKey':'CampaignId'});db['Campaign'][_0xe5ee('0x124')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xe5ee('0x1b0')});db[_0xe5ee('0xf1')][_0xe5ee('0x133')](db[_0xe5ee('0x2b')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xe5ee('0xf1')][_0xe5ee('0x133')](db[_0xe5ee('0x2b')],{'as':_0xe5ee('0x15d'),'foreignKey':_0xe5ee('0x15e')});db[_0xe5ee('0xf1')][_0xe5ee('0x133')](db[_0xe5ee('0x8c')],{'as':_0xe5ee('0x8c'),'foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0xf1')][_0xe5ee('0x133')](db[_0xe5ee('0x1e7')],{'as':_0xe5ee('0x1e7'),'foreignKey':_0xe5ee('0x1e8')});db['Campaign'][_0xe5ee('0x135')](db[_0xe5ee('0xff')],{'as':'Lists','through':_0xe5ee('0x1e9')});db[_0xe5ee('0xf1')]['belongsToMany'](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x1ea'),'through':'campaigns_has_cm_blacklists'});db[_0xe5ee('0xf5')][_0xe5ee('0x133')](db[_0xe5ee('0x71')],{'as':_0xe5ee('0x71'),'foreignKey':_0xe5ee('0x185')});db[_0xe5ee('0xf8')][_0xe5ee('0x133')](db[_0xe5ee('0x176')],{});db['MailTransferReport'][_0xe5ee('0x133')](db[_0xe5ee('0x13c')],{});db[_0xe5ee('0xf8')]['belongsTo'](db[_0xe5ee('0x41')],{'foreignKey':_0xe5ee('0x1eb'),'as':_0xe5ee('0x1ec')});db[_0xe5ee('0xf8')]['belongsTo'](db['User'],{'foreignKey':_0xe5ee('0x1ed'),'as':_0xe5ee('0x1ee')});db[_0xe5ee('0xf8')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'foreignKey':'ToUserId','as':_0xe5ee('0x1ef')});db[_0xe5ee('0xf8')][_0xe5ee('0x133')](db[_0xe5ee('0x144')],{'foreignKey':_0xe5ee('0x1f0'),'as':'ToQueue'});db['MailTransferReport'][_0xe5ee('0x133')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0xe5ee('0x1f1')});db[_0xe5ee('0x1f2')][_0xe5ee('0x133')](db[_0xe5ee('0x6f')],{});db['ChatTransferReport']['belongsTo'](db[_0xe5ee('0x6d')],{});db[_0xe5ee('0x1f2')][_0xe5ee('0x133')](db[_0xe5ee('0x67')],{'foreignKey':_0xe5ee('0x1f3'),'as':_0xe5ee('0x1ec')});db[_0xe5ee('0x1f2')]['belongsTo'](db[_0xe5ee('0x12')],{'foreignKey':'FromUserId','as':_0xe5ee('0x1ee')});db[_0xe5ee('0x1f2')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'foreignKey':_0xe5ee('0x1f4'),'as':_0xe5ee('0x1ef')});db[_0xe5ee('0x1f2')][_0xe5ee('0x133')](db[_0xe5ee('0x73')],{'foreignKey':'ToChatQueueId','as':_0xe5ee('0x1f5')});db[_0xe5ee('0x1f2')][_0xe5ee('0x133')](db[_0xe5ee('0x67')],{'foreignKey':_0xe5ee('0x1f6'),'as':_0xe5ee('0x1f1')});db[_0xe5ee('0x1f7')][_0xe5ee('0x133')](db[_0xe5ee('0x52')],{});db['FaxTransferReport'][_0xe5ee('0x133')](db['FaxInteraction'],{});db[_0xe5ee('0x1f7')][_0xe5ee('0x133')](db[_0xe5ee('0x14b')],{'foreignKey':_0xe5ee('0x1f8'),'as':_0xe5ee('0x1ec')});db['FaxTransferReport'][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'foreignKey':_0xe5ee('0x1ed'),'as':_0xe5ee('0x1ee')});db['FaxTransferReport'][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'foreignKey':_0xe5ee('0x1f4'),'as':'ToAgent'});db[_0xe5ee('0x1f7')][_0xe5ee('0x133')](db[_0xe5ee('0x189')],{'foreignKey':_0xe5ee('0x1f9'),'as':_0xe5ee('0x1f5')});db[_0xe5ee('0x1f7')][_0xe5ee('0x133')](db[_0xe5ee('0x14b')],{'foreignKey':'ToFaxAccountId','as':_0xe5ee('0x1f1')});db['OpenchannelTransferReport'][_0xe5ee('0x133')](db[_0xe5ee('0x64')],{});db[_0xe5ee('0xfc')][_0xe5ee('0x133')](db[_0xe5ee('0x128')],{});db['OpenchannelTransferReport'][_0xe5ee('0x133')](db[_0xe5ee('0x5f')],{'foreignKey':_0xe5ee('0x1fa'),'as':_0xe5ee('0x1ec')});db[_0xe5ee('0xfc')]['belongsTo'](db['User'],{'foreignKey':_0xe5ee('0x1ed'),'as':_0xe5ee('0x1ee')});db[_0xe5ee('0xfc')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'foreignKey':_0xe5ee('0x1f4'),'as':_0xe5ee('0x1ef')});db['OpenchannelTransferReport'][_0xe5ee('0x133')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db['OpenchannelTransferReport'][_0xe5ee('0x133')](db[_0xe5ee('0x5f')],{'foreignKey':_0xe5ee('0x1fb'),'as':_0xe5ee('0x1f1')});db[_0xe5ee('0x1fc')][_0xe5ee('0x133')](db['SmsMessage'],{});db[_0xe5ee('0x1fc')]['belongsTo'](db[_0xe5ee('0x12b')],{});db[_0xe5ee('0x1fc')][_0xe5ee('0x133')](db[_0xe5ee('0x57')],{'foreignKey':_0xe5ee('0x1fd'),'as':_0xe5ee('0x1ec')});db[_0xe5ee('0x1fc')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe5ee('0x1fc')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'foreignKey':'ToUserId','as':_0xe5ee('0x1ef')});db[_0xe5ee('0x1fc')][_0xe5ee('0x133')](db['SmsQueue'],{'foreignKey':_0xe5ee('0x1fe'),'as':'ToQueue'});db[_0xe5ee('0x1fc')][_0xe5ee('0x133')](db[_0xe5ee('0x57')],{'foreignKey':'ToSmsAccountId','as':_0xe5ee('0x1f1')});db[_0xe5ee('0xff')][_0xe5ee('0x124')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe5ee('0x17b'),'onDelete':_0xe5ee('0x120')});db['CmList']['hasMany'](db[_0xe5ee('0x1ff')],{'as':_0xe5ee('0x200'),'foreignKey':_0xe5ee('0x17b')});db['CmList'][_0xe5ee('0x124')](db['CmContact'],{'as':'Contacts','onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x17b')});db['CmList'][_0xe5ee('0x124')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ListId'});db[_0xe5ee('0xff')]['hasMany'](db[_0xe5ee('0x7f')],{'as':_0xe5ee('0x201'),'foreignKey':_0xe5ee('0x17b')});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':_0xe5ee('0x81'),'foreignKey':_0xe5ee('0x17b')});db[_0xe5ee('0xff')][_0xe5ee('0x135')](db['VoiceQueue'],{'as':_0xe5ee('0x202'),'through':'voice_queues_has_cm_lists'});db[_0xe5ee('0xff')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xe5ee('0x101')][_0xe5ee('0x124')](db[_0xe5ee('0x126')],{'as':_0xe5ee('0x1ba'),'onDelete':_0xe5ee('0x120')});db['VoicePrefix'][_0xe5ee('0x135')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0xe5ee('0x101')][_0xe5ee('0x135')](db[_0xe5ee('0xee')],{'through':'TeamVoicePrefix','as':_0xe5ee('0x164')});db[_0xe5ee('0x103')][_0xe5ee('0x124')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x18c'),'foreignKey':_0xe5ee('0x134')});db[_0xe5ee('0x103')][_0xe5ee('0x124')](db[_0xe5ee('0x105')],{'as':_0xe5ee('0x203'),'foreignKey':_0xe5ee('0x134'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x105')][_0xe5ee('0x124')](db[_0xe5ee('0x107')],{'as':'Resources','foreignKey':_0xe5ee('0x204'),'onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x152')][_0xe5ee('0x124')](db[_0xe5ee('0x172')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0xe5ee('0x120')});db[_0xe5ee('0x152')][_0xe5ee('0x124')](db[_0xe5ee('0x87')],{'as':_0xe5ee('0x175'),'foreignKey':'WhatsappAccountId'});db[_0xe5ee('0x152')]['hasMany'](db['WhatsappMessage'],{'as':_0xe5ee('0x177'),'foreignKey':_0xe5ee('0x205')});db[_0xe5ee('0x152')][_0xe5ee('0x124')](db[_0xe5ee('0x10e')],{'as':'Interactions'});db[_0xe5ee('0x152')][_0xe5ee('0x124')](db['WhatsappApplication'],{'as':'Applications','foreignKey':_0xe5ee('0x205'),'onDelete':'cascade'});db[_0xe5ee('0x152')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xe5ee('0x17b')});db[_0xe5ee('0x152')][_0xe5ee('0x133')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xe5ee('0x161')});db[_0xe5ee('0x152')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':_0xe5ee('0x153')});db[_0xe5ee('0x10c')]['belongsTo'](db[_0xe5ee('0x12')],{'onDelete':'restrict'});db[_0xe5ee('0x10c')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0xe5ee('0x16f')});db['WhatsappApplication'][_0xe5ee('0x133')](db[_0xe5ee('0x152')],{'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x10c')]['belongsTo'](db[_0xe5ee('0x8c')],{'onDelete':'restrict','foreignKey':_0xe5ee('0x15f')});db[_0xe5ee('0x10c')][_0xe5ee('0x133')](db['Tag'],{'onDelete':_0xe5ee('0x16f'),'foreignKey':'TagId'});db[_0xe5ee('0x10e')][_0xe5ee('0x124')](db[_0xe5ee('0x10f')],{'as':_0xe5ee('0x177'),'onDelete':_0xe5ee('0x120'),'foreignKey':_0xe5ee('0x206')});db[_0xe5ee('0x10e')]['belongsTo'](db[_0xe5ee('0x152')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x205')});db[_0xe5ee('0x10e')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':'ContactId'});db[_0xe5ee('0x10e')][_0xe5ee('0x133')](db['User'],{'as':'Owner','foreignKey':_0xe5ee('0x123')});db[_0xe5ee('0x10e')][_0xe5ee('0x135')](db[_0xe5ee('0x96')],{'through':_0xe5ee('0x1c1'),'as':_0xe5ee('0x194')});db[_0xe5ee('0x10e')]['belongsToMany'](db[_0xe5ee('0x96')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xe5ee('0x10e')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x18c'),'through':_0xe5ee('0x207'),'foreignKey':_0xe5ee('0x206')});db[_0xe5ee('0x10f')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db[_0xe5ee('0x79')],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x16c')});db[_0xe5ee('0x10f')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0xe5ee('0x120'),'as':_0xe5ee('0x184'),'foreignKey':_0xe5ee('0x206')});db[_0xe5ee('0x10f')][_0xe5ee('0x133')](db[_0xe5ee('0x152')],{'as':_0xe5ee('0x180'),'foreignKey':_0xe5ee('0x205')});db[_0xe5ee('0x110')][_0xe5ee('0x133')](db[_0xe5ee('0x152')],{});db['WhatsappQueueReport'][_0xe5ee('0x133')](db[_0xe5ee('0xff')],{'as':_0xe5ee('0x17a'),'foreignKey':_0xe5ee('0x17b')});db[_0xe5ee('0x110')][_0xe5ee('0x133')](db[_0xe5ee('0x79')],{'as':_0xe5ee('0x16c'),'foreignKey':'ContactId'});db[_0xe5ee('0x110')][_0xe5ee('0x133')](db[_0xe5ee('0x10e')],{});db[_0xe5ee('0x110')][_0xe5ee('0x133')](db['WhatsappQueue'],{});db[_0xe5ee('0x110')][_0xe5ee('0x133')](db[_0xe5ee('0x10f')],{});db[_0xe5ee('0x110')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{});db[_0xe5ee('0x208')]['belongsTo'](db[_0xe5ee('0x10f')],{});db[_0xe5ee('0x208')]['belongsTo'](db[_0xe5ee('0x10e')],{});db[_0xe5ee('0x208')][_0xe5ee('0x133')](db['WhatsappAccount'],{'foreignKey':_0xe5ee('0x209'),'as':_0xe5ee('0x1ec')});db[_0xe5ee('0x208')][_0xe5ee('0x133')](db[_0xe5ee('0x152')],{'foreignKey':_0xe5ee('0x20a'),'as':_0xe5ee('0x1f1')});db[_0xe5ee('0x208')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0xe5ee('0x20b'),'as':_0xe5ee('0x1f5')});db[_0xe5ee('0x208')][_0xe5ee('0x133')](db['User'],{'foreignKey':_0xe5ee('0x1ed'),'as':_0xe5ee('0x1ee')});db[_0xe5ee('0x208')][_0xe5ee('0x133')](db[_0xe5ee('0x12')],{'foreignKey':_0xe5ee('0x1f4'),'as':_0xe5ee('0x1ef')});db[_0xe5ee('0x113')][_0xe5ee('0x135')](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x163'),'through':_0xe5ee('0x3b'),'foreignKey':_0xe5ee('0x20c')});db['WhatsappQueue'][_0xe5ee('0x135')](db[_0xe5ee('0xee')],{'through':_0xe5ee('0x1e5'),'as':_0xe5ee('0x164')});db[_0xe5ee('0x11c')]['belongsTo'](db[_0xe5ee('0x12')],{'as':_0xe5ee('0x20d'),'foreignKey':_0xe5ee('0x123'),'onDelete':_0xe5ee('0x120'),'hooks':!![]});db[_0xe5ee('0x115')][_0xe5ee('0x121')](db[_0xe5ee('0xd1')],{'as':_0xe5ee('0xd1'),'onDelete':'restrict'});db[_0xe5ee('0x115')][_0xe5ee('0x121')](db['MailServerIn'],{'as':_0xe5ee('0x170'),'onDelete':_0xe5ee('0x16f')});db[_0xe5ee('0x115')][_0xe5ee('0x121')](db[_0xe5ee('0x3f')],{'as':_0xe5ee('0x171'),'onDelete':_0xe5ee('0x16f')});module[_0xe5ee('0x20e')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 186b140..e1c60ea 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68a5=['./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','3.12.2','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','path','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers'];(function(_0x2ed434,_0x57663e){var _0x1e20f3=function(_0x3ca3a6){while(--_0x3ca3a6){_0x2ed434['push'](_0x2ed434['shift']());}};_0x1e20f3(++_0x57663e);}(_0x68a5,0xfc));var _0x568a=function(_0x457efb,_0x38bea9){_0x457efb=_0x457efb-0x0;var _0x210f00=_0x68a5[_0x457efb];return _0x210f00;};'use strict';var path=require(_0x568a('0x0'));var express=require('express');var errors=require(_0x568a('0x1'));var config=require(_0x568a('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x568a('0x3')];var clientSideLogs=require(_0x568a('0x4'));exports[_0x568a('0x5')]=function(_0x2d4dce){return setupLoggers(_0x2d4dce)['then'](function(){_0x2d4dce[_0x568a('0x6')]('/api/users',require(_0x568a('0x7')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x8'),require(_0x568a('0x9')));_0x2d4dce['use'](_0x568a('0xa'),require('./api/voiceContext'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xb'),require(_0x568a('0xc')));_0x2d4dce[_0x568a('0x6')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd'),require('./api/voiceQueue'));_0x2d4dce[_0x568a('0x6')]('/api/voice/recordings',require(_0x568a('0xe')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xf'),require(_0x568a('0x10')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x11'),require(_0x568a('0x12')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x13'),require(_0x568a('0x14')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x15'),require(_0x568a('0x16')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x17'),require(_0x568a('0x18')));_0x2d4dce[_0x568a('0x6')]('/api/voice/agents/reports',require(_0x568a('0x19')));_0x2d4dce['use'](_0x568a('0x1a'),require(_0x568a('0x1b')));_0x2d4dce['use'](_0x568a('0x1c'),require('./api/memberReport'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x1d'),require(_0x568a('0x1e')));_0x2d4dce[_0x568a('0x6')]('/api/voice/transfers/reports',require(_0x568a('0x1f')));_0x2d4dce['use'](_0x568a('0x20'),require(_0x568a('0x21')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x22'),require(_0x568a('0x23')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x24'),require(_0x568a('0x25')));_0x2d4dce['use'](_0x568a('0x26'),require(_0x568a('0x27')));_0x2d4dce['use'](_0x568a('0x28'),require(_0x568a('0x29')));_0x2d4dce[_0x568a('0x6')]('/api/mail/messages',require(_0x568a('0x2a')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x2b'),require(_0x568a('0x2c')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x2d'),require(_0x568a('0x2e')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x2f'),require('./api/dashboard'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x30'),require(_0x568a('0x31')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x32'),require(_0x568a('0x33')));_0x2d4dce['use'](_0x568a('0x34'),require(_0x568a('0x35')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x36'),require(_0x568a('0x37')));_0x2d4dce['use'](_0x568a('0x38'),require(_0x568a('0x39')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x3a'),require(_0x568a('0x3b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x3c'),require(_0x568a('0x3d')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x3e'),require('./api/smsAccount'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x3f'),require(_0x568a('0x40')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x41'),require(_0x568a('0x42')));_0x2d4dce['use']('/api/sms/messages',require('./api/smsMessage'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x43'),require(_0x568a('0x44')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x45'),require('./api/openchannelAccount'));_0x2d4dce['use'](_0x568a('0x46'),require(_0x568a('0x47')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x48'),require(_0x568a('0x49')));_0x2d4dce['use'](_0x568a('0x4a'),require('./api/openchannelMessage'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x4b'),require('./api/openchannelQueue'));_0x2d4dce[_0x568a('0x6')]('/api/chat/websites',require(_0x568a('0x4c')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x4d'),require('./api/openchannelQueueReport'));_0x2d4dce['use'](_0x568a('0x4e'),require(_0x568a('0x4f')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x50'),require(_0x568a('0x51')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x52'),require('./api/chatMessage'));_0x2d4dce['use'](_0x568a('0x53'),require(_0x568a('0x54')));_0x2d4dce[_0x568a('0x6')]('/api/chat/queues',require('./api/chatQueue'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x55'),require('./api/chatGroup'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x56'),require('./api/chatProactiveAction'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x57'),require(_0x568a('0x58')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x59'),require(_0x568a('0x5a')));_0x2d4dce['use']('/api/cm/hopper',require(_0x568a('0x5b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x5c'),require(_0x568a('0x5d')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x5e'),require(_0x568a('0x5f')));_0x2d4dce[_0x568a('0x6')]('/api/cm/hopper_history',require(_0x568a('0x60')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x61'),require(_0x568a('0x62')));_0x2d4dce[_0x568a('0x6')]('/api/actions',require(_0x568a('0x63')));_0x2d4dce['use'](_0x568a('0x64'),require(_0x568a('0x65')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x66'),require(_0x568a('0x67')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x68'),require('./api/disposition'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x69'),require(_0x568a('0x6a')));_0x2d4dce['use'](_0x568a('0x6b'),require('./api/interval'));_0x2d4dce['use'](_0x568a('0x6c'),require('./api/pause'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x6d'),require('./api/cdr'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x6e'),require(_0x568a('0x6f')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x70'),require('./api/schedule'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x71'),require('./api/sound'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x72'),require(_0x568a('0x73')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x74'),require(_0x568a('0x75')));_0x2d4dce[_0x568a('0x6')]('/api/cm_contact_has_items',require(_0x568a('0x76')));_0x2d4dce[_0x568a('0x6')]('/api/cm_hopper_additional_phones',require(_0x568a('0x77')));_0x2d4dce[_0x568a('0x6')]('/api/templates',require(_0x568a('0x78')));_0x2d4dce['use'](_0x568a('0x79'),require(_0x568a('0x7a')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x7b'),require(_0x568a('0x7c')));_0x2d4dce['use'](_0x568a('0x7d'),require(_0x568a('0x7e')));_0x2d4dce['use'](_0x568a('0x7f'),require(_0x568a('0x80')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x81'),require('./api/analyticCustomReport'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x82'),require(_0x568a('0x83')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x84'),require(_0x568a('0x85')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x86'),require('./api/analyticMetric'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x87'),require(_0x568a('0x88')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x89'),require('./api/analyticTreeReport'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x8a'),require(_0x568a('0x8b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x8c'),require(_0x568a('0x8d')));_0x2d4dce['use'](_0x568a('0x8e'),require(_0x568a('0x8f')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x90'),require(_0x568a('0x91')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x92'),require(_0x568a('0x93')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x94'),require(_0x568a('0x95')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x96'),require(_0x568a('0x97')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x98'),require(_0x568a('0x99')));_0x2d4dce['use'](_0x568a('0x9a'),require('./api/intDeskField'));_0x2d4dce[_0x568a('0x6')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x2d4dce[_0x568a('0x6')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x2d4dce[_0x568a('0x6')]('/api/integrations/zoho/fields',require(_0x568a('0x9b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x9c'),require(_0x568a('0x9d')));_0x2d4dce['use'](_0x568a('0x9e'),require(_0x568a('0x9f')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa0'),require('./api/intZendeskField'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa1'),require(_0x568a('0xa2')));_0x2d4dce['use']('/api/integrations/freshdesk/configurations',require(_0x568a('0xa3')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa4'),require('./api/intFreshdeskField'));_0x2d4dce['use'](_0x568a('0xa5'),require('./api/intVtigerAccount'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa6'),require('./api/intVtigerConfiguration'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa7'),require(_0x568a('0xa8')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xa9'),require(_0x568a('0xaa')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xab'),require(_0x568a('0xac')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xad'),require('./api/intServicenowField'));_0x2d4dce[_0x568a('0x6')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xae'),require('./api/intDynamics365Configuration'));_0x2d4dce['use'](_0x568a('0xaf'),require('./api/intDynamics365Field'));_0x2d4dce['use'](_0x568a('0xb0'),require(_0x568a('0xb1')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xb2'),require(_0x568a('0xb3')));_0x2d4dce['use'](_0x568a('0xb4'),require('./api/intFreshsalesField'));_0x2d4dce[_0x568a('0x6')]('/api/networks',require(_0x568a('0xb5')));_0x2d4dce[_0x568a('0x6')]('/api/chat/reports/queue',require(_0x568a('0xb6')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xb7'),require(_0x568a('0xb8')));_0x2d4dce['use'](_0x568a('0xb9'),require(_0x568a('0xba')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xbb'),require(_0x568a('0xbc')));_0x2d4dce[_0x568a('0x6')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x2d4dce['use'](_0x568a('0xbd'),require(_0x568a('0xbe')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xbf'),require(_0x568a('0xc0')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xc1'),require(_0x568a('0xc2')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xc3'),require(_0x568a('0xc4')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xc5'),require('./api/setting'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xc6'),require('./api/squareOdbc'));_0x2d4dce['use'](_0x568a('0xc7'),require(_0x568a('0xc8')));_0x2d4dce['use'](_0x568a('0xc9'),require(_0x568a('0xca')));_0x2d4dce['use']('/api/square/messages',require(_0x568a('0xcb')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xcc'),require(_0x568a('0xcd')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xce'),require(_0x568a('0xcf')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd0'),require(_0x568a('0xd1')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd2'),require(_0x568a('0xd3')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd4'),require(_0x568a('0xd5')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd6'),require(_0x568a('0xd7')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xd8'),require(_0x568a('0xd9')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xda'),require(_0x568a('0xdb')));_0x2d4dce['use']('/api/fax/reports/transfer',require(_0x568a('0xdc')));_0x2d4dce['use'](_0x568a('0xdd'),require(_0x568a('0xde')));_0x2d4dce[_0x568a('0x6')]('/api/sms/reports/transfer',require(_0x568a('0xdf')));_0x2d4dce['use'](_0x568a('0xe0'),require(_0x568a('0xe1')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xe2'),require(_0x568a('0xe3')));_0x2d4dce[_0x568a('0x6')]('/api/userProfiles',require(_0x568a('0xe4')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xe5'),require('./api/userProfileSection'));_0x2d4dce[_0x568a('0x6')](_0x568a('0xe6'),require(_0x568a('0xe7')));_0x2d4dce['use'](_0x568a('0xe8'),require(_0x568a('0xe9')));_0x2d4dce['use'](_0x568a('0xea'),require(_0x568a('0xeb')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xec'),require(_0x568a('0xed')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xee'),require(_0x568a('0xef')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xf0'),require(_0x568a('0xf1')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xf2'),require(_0x568a('0xf3')));_0x2d4dce[_0x568a('0x6')]('/api/whatsapp/reports/transfer',require(_0x568a('0xf4')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xf5'),require(_0x568a('0xf6')));_0x2d4dce['use'](_0x568a('0xf7'),require(_0x568a('0xf8')));_0x2d4dce['use'](_0x568a('0xf9'),require(_0x568a('0xfa')));_0x2d4dce['use']('/api/user-settings',require(_0x568a('0xfb')));_0x2d4dce[_0x568a('0x6')](_0x568a('0xfc'),require(_0x568a('0xfd')));_0x2d4dce['use'](_0x568a('0xfe'),require(_0x568a('0xff')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x100'),require('./api/authGoogle'));_0x2d4dce[_0x568a('0x6')](_0x568a('0x101'),require(_0x568a('0x102')));_0x2d4dce[_0x568a('0x6')]('/api/jira',require(_0x568a('0x103')));_0x2d4dce['use'](_0x568a('0x104'),require(_0x568a('0x105')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x106'),require(_0x568a('0x107')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x108'),require(_0x568a('0x109')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x10a'),require(_0x568a('0x10b')));_0x2d4dce[_0x568a('0x6')](_0x568a('0x10c'),require(_0x568a('0x10d')));_0x2d4dce['use']('/api/logs',clientSideLogs);_0x2d4dce[_0x568a('0x6')](_0x568a('0x10e'),express[_0x568a('0x10f')](path[_0x568a('0x110')](config[_0x568a('0x111')],_0x568a('0x10e'))));_0x2d4dce[_0x568a('0x6')](_0x568a('0x112'),express[_0x568a('0x10f')](path[_0x568a('0x110')](config[_0x568a('0x111')],_0x568a('0x112'))));_0x2d4dce[_0x568a('0x6')](_0x568a('0x113'),express[_0x568a('0x10f')](path[_0x568a('0x110')](config['root'],_0x568a('0x113'))));_0x2d4dce['use']('/snippet',express[_0x568a('0x10f')](path['join'](config[_0x568a('0x111')],_0x568a('0x114'),_0x568a('0x115'))));_0x2d4dce[_0x568a('0x6')](_0x568a('0x116'),express['static'](path['join'](config[_0x568a('0x111')],_0x568a('0x117'))));_0x2d4dce[_0x568a('0x118')](_0x568a('0x119'))['get'](errors[0x194]);_0x2d4dce[_0x568a('0x118')]('/*')[_0x568a('0x11a')](function(_0x52967f,_0x568944){_0x568944['sendFile'](path[_0x568a('0x11b')](_0x2d4dce[_0x568a('0x11a')](_0x568a('0x11c'))+'/index.html'));});return _0x2d4dce;});}; \ No newline at end of file +var _0xe9ef=['/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/user-settings','/api/mail_interaction_has_tags','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','3.12.2','/plugins','route','get','appPath','path','./errors','./config/environment','setupLoggers','default','then','use','./api/user','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField'];(function(_0x32e54a,_0x59fc0d){var _0x109af4=function(_0x564be8){while(--_0x564be8){_0x32e54a['push'](_0x32e54a['shift']());}};_0x109af4(++_0x59fc0d);}(_0xe9ef,0x16e));var _0xfe9e=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0xe9ef[_0xf04c6d];return _0x4a804e;};'use strict';var path=require(_0xfe9e('0x0'));var express=require('express');var errors=require(_0xfe9e('0x1'));var config=require(_0xfe9e('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0xfe9e('0x3')];var clientSideLogs=require('./api/client-side-logs');exports[_0xfe9e('0x4')]=function(_0x45bf15){return setupLoggers(_0x45bf15)[_0xfe9e('0x5')](function(){_0x45bf15[_0xfe9e('0x6')]('/api/users',require(_0xfe9e('0x7')));_0x45bf15[_0xfe9e('0x6')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x45bf15[_0xfe9e('0x6')]('/api/voice/contexts',require(_0xfe9e('0x8')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x9'),require('./api/voiceExtension'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xa'),require(_0xfe9e('0xb')));_0x45bf15['use'](_0xfe9e('0xc'),require('./api/voiceQueue'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xd'),require(_0xfe9e('0xe')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xf'),require(_0xfe9e('0x10')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x11'),require(_0xfe9e('0x12')));_0x45bf15['use'](_0xfe9e('0x13'),require(_0xfe9e('0x14')));_0x45bf15['use'](_0xfe9e('0x15'),require(_0xfe9e('0x16')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x17'),require('./api/voiceDialReport'));_0x45bf15['use'](_0xfe9e('0x18'),require(_0xfe9e('0x19')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x1a'),require('./api/voiceQueueReport'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x1b'),require(_0xfe9e('0x1c')));_0x45bf15[_0xfe9e('0x6')]('/api/trunks',require(_0xfe9e('0x1d')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x1e'),require(_0xfe9e('0x1f')));_0x45bf15[_0xfe9e('0x6')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x20'),require(_0xfe9e('0x21')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x22'),require(_0xfe9e('0x23')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x24'),require(_0xfe9e('0x25')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x26'),require(_0xfe9e('0x27')));_0x45bf15['use'](_0xfe9e('0x28'),require(_0xfe9e('0x29')));_0x45bf15['use'](_0xfe9e('0x2a'),require('./api/mailApplication'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x2b'),require('./api/mailQueueReport'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x2c'),require(_0xfe9e('0x2d')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x2e'),require(_0xfe9e('0x2f')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x30'),require(_0xfe9e('0x31')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x32'),require(_0xfe9e('0x33')));_0x45bf15[_0xfe9e('0x6')]('/api/fax/interactions',require('./api/faxInteraction'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x34'),require(_0xfe9e('0x35')));_0x45bf15[_0xfe9e('0x6')]('/api/fax/queues',require(_0xfe9e('0x36')));_0x45bf15['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x37'),require(_0xfe9e('0x38')));_0x45bf15['use']('/api/sms/applications',require(_0xfe9e('0x39')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x3a'),require(_0xfe9e('0x3b')));_0x45bf15[_0xfe9e('0x6')]('/api/sms/messages',require('./api/smsMessage'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x3c'),require(_0xfe9e('0x3d')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x3e'),require(_0xfe9e('0x3f')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x40'),require('./api/openchannelApplication'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x41'),require(_0xfe9e('0x42')));_0x45bf15['use'](_0xfe9e('0x43'),require(_0xfe9e('0x44')));_0x45bf15['use']('/api/openchannel/queues',require(_0xfe9e('0x45')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x46'),require(_0xfe9e('0x47')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x48'),require(_0xfe9e('0x49')));_0x45bf15['use']('/api/chat/applications',require(_0xfe9e('0x4a')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x4b'),require(_0xfe9e('0x4c')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x4d'),require(_0xfe9e('0x4e')));_0x45bf15['use'](_0xfe9e('0x4f'),require('./api/chatOfflineMessage'));_0x45bf15[_0xfe9e('0x6')]('/api/chat/queues',require(_0xfe9e('0x50')));_0x45bf15['use'](_0xfe9e('0x51'),require(_0xfe9e('0x52')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x53'),require(_0xfe9e('0x54')));_0x45bf15[_0xfe9e('0x6')]('/api/cm/companies',require('./api/cmCompany'));_0x45bf15[_0xfe9e('0x6')]('/api/cm/contacts',require(_0xfe9e('0x55')));_0x45bf15[_0xfe9e('0x6')]('/api/cm/hopper',require(_0xfe9e('0x56')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x57'),require(_0xfe9e('0x58')));_0x45bf15[_0xfe9e('0x6')]('/api/cm/hopper_final',require(_0xfe9e('0x59')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x5a'),require(_0xfe9e('0x5b')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x5c'),require(_0xfe9e('0x5d')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x5e'),require('./api/action'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x5f'),require(_0xfe9e('0x60')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x61'),require('./api/cannedAnswer'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x62'),require(_0xfe9e('0x63')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x64'),require('./api/condition'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x65'),require(_0xfe9e('0x66')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x67'),require(_0xfe9e('0x68')));_0x45bf15['use']('/api/cdr',require(_0xfe9e('0x69')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x6a'),require(_0xfe9e('0x6b')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x6c'),require('./api/schedule'));_0x45bf15['use'](_0xfe9e('0x6d'),require(_0xfe9e('0x6e')));_0x45bf15[_0xfe9e('0x6')]('/api/tags',require(_0xfe9e('0x6f')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x70'),require(_0xfe9e('0x71')));_0x45bf15['use'](_0xfe9e('0x72'),require(_0xfe9e('0x73')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x74'),require(_0xfe9e('0x75')));_0x45bf15['use'](_0xfe9e('0x76'),require(_0xfe9e('0x77')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x78'),require('./api/trigger'));_0x45bf15['use'](_0xfe9e('0x79'),require(_0xfe9e('0x7a')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x7b'),require(_0xfe9e('0x7c')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x7d'),require(_0xfe9e('0x7e')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x7f'),require(_0xfe9e('0x80')));_0x45bf15[_0xfe9e('0x6')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x45bf15[_0xfe9e('0x6')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x81'),require(_0xfe9e('0x82')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x83'),require(_0xfe9e('0x84')));_0x45bf15['use']('/api/analytics/tree_reports',require(_0xfe9e('0x85')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x86'),require(_0xfe9e('0x87')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x88'),require(_0xfe9e('0x89')));_0x45bf15[_0xfe9e('0x6')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x8a'),require(_0xfe9e('0x8b')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x8c'),require(_0xfe9e('0x8d')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x8e'),require(_0xfe9e('0x8f')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x90'),require(_0xfe9e('0x91')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x92'),require(_0xfe9e('0x93')));_0x45bf15[_0xfe9e('0x6')]('/api/integrations/desk/fields',require(_0xfe9e('0x94')));_0x45bf15[_0xfe9e('0x6')]('/api/integrations/zoho/accounts',require(_0xfe9e('0x95')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x96'),require(_0xfe9e('0x97')));_0x45bf15['use'](_0xfe9e('0x98'),require('./api/intZohoField'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x99'),require(_0xfe9e('0x9a')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x9b'),require('./api/intZendeskConfiguration'));_0x45bf15['use'](_0xfe9e('0x9c'),require('./api/intZendeskField'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x9d'),require(_0xfe9e('0x9e')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x9f'),require(_0xfe9e('0xa0')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xa1'),require(_0xfe9e('0xa2')));_0x45bf15['use'](_0xfe9e('0xa3'),require('./api/intVtigerAccount'));_0x45bf15['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x45bf15[_0xfe9e('0x6')]('/api/integrations/vtiger/fields',require(_0xfe9e('0xa4')));_0x45bf15['use']('/api/integrations/servicenow/accounts',require(_0xfe9e('0xa5')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xa6'),require(_0xfe9e('0xa7')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xa8'),require(_0xfe9e('0xa9')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xaa'),require(_0xfe9e('0xab')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xac'),require(_0xfe9e('0xad')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xae'),require(_0xfe9e('0xaf')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xb0'),require(_0xfe9e('0xb1')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xb2'),require(_0xfe9e('0xb3')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xb4'),require(_0xfe9e('0xb5')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xb6'),require(_0xfe9e('0xb7')));_0x45bf15['use'](_0xfe9e('0xb8'),require('./api/chatQueueReport'));_0x45bf15[_0xfe9e('0x6')]('/api/chat/internal/messages',require(_0xfe9e('0xb9')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xba'),require(_0xfe9e('0xbb')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xbc'),require('./api/jscriptyQuestionReport'));_0x45bf15[_0xfe9e('0x6')]('/api/jscripty/sessions/reports',require(_0xfe9e('0xbd')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xbe'),require('./api/smsQueueReport'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xbf'),require(_0xfe9e('0xc0')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xc1'),require(_0xfe9e('0xc2')));_0x45bf15[_0xfe9e('0x6')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xc3'),require('./api/setting'));_0x45bf15['use'](_0xfe9e('0xc4'),require(_0xfe9e('0xc5')));_0x45bf15['use'](_0xfe9e('0xc6'),require(_0xfe9e('0xc7')));_0x45bf15['use']('/api/square/recordings',require('./api/squareRecording'));_0x45bf15['use']('/api/square/messages',require('./api/squareMessage'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xc8'),require(_0xfe9e('0xc9')));_0x45bf15[_0xfe9e('0x6')]('/api/license',require(_0xfe9e('0xca')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xcb'),require(_0xfe9e('0xcc')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xcd'),require(_0xfe9e('0xce')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xcf'),require(_0xfe9e('0xd0')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xd1'),require('./api/plugin'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xd2'),require(_0xfe9e('0xd3')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xd4'),require(_0xfe9e('0xd5')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xd6'),require('./api/faxTransferReport'));_0x45bf15['use'](_0xfe9e('0xd7'),require(_0xfe9e('0xd8')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xd9'),require('./api/smsTransferReport'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xda'),require(_0xfe9e('0xdb')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xdc'),require(_0xfe9e('0xdd')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xde'),require('./api/userProfile'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xdf'),require(_0xfe9e('0xe0')));_0x45bf15[_0xfe9e('0x6')]('/api/userProfile/resources',require(_0xfe9e('0xe1')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xe2'),require(_0xfe9e('0xe3')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xe4'),require('./api/whatsappAccount'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xe5'),require(_0xfe9e('0xe6')));_0x45bf15[_0xfe9e('0x6')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x45bf15[_0xfe9e('0x6')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xe7'),require(_0xfe9e('0xe8')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xe9'),require(_0xfe9e('0xea')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xeb'),require(_0xfe9e('0xec')));_0x45bf15[_0xfe9e('0x6')]('/api/cloudProviders',require(_0xfe9e('0xed')));_0x45bf15[_0xfe9e('0x6')]('/api/realtime',require(_0xfe9e('0xee')));_0x45bf15['use'](_0xfe9e('0xef'),require('./api/user-setting'));_0x45bf15['use'](_0xfe9e('0xf0'),require('./api/mailInteractionHasTag'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xf1'),require(_0xfe9e('0xf2')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xf3'),require(_0xfe9e('0xf4')));_0x45bf15['use'](_0xfe9e('0xf5'),require(_0xfe9e('0xf6')));_0x45bf15[_0xfe9e('0x6')]('/api/jira',require('./api/jira'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xf7'),require(_0xfe9e('0xf8')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xf9'),require('./api/version'));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0xfa'),require(_0xfe9e('0xfb')));_0x45bf15['use'](_0xfe9e('0xfc'),require(_0xfe9e('0xfd')));_0x45bf15['use'](_0xfe9e('0xfe'),require(_0xfe9e('0xff')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x100'),clientSideLogs);_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x101'),express['static'](path[_0xfe9e('0x102')](config[_0xfe9e('0x103')],'/apidoc')));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x104'),express[_0xfe9e('0x105')](path['join'](config[_0xfe9e('0x103')],_0xfe9e('0x104'))));_0x45bf15['use'](_0xfe9e('0x106'),express[_0xfe9e('0x105')](path[_0xfe9e('0x102')](config['root'],_0xfe9e('0x106'))));_0x45bf15[_0xfe9e('0x6')]('/snippet',express['static'](path['join'](config['root'],'snippet',_0xfe9e('0x107'))));_0x45bf15[_0xfe9e('0x6')](_0xfe9e('0x108'),express[_0xfe9e('0x105')](path[_0xfe9e('0x102')](config[_0xfe9e('0x103')],'/server/files/plugins')));_0x45bf15[_0xfe9e('0x109')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xfe9e('0x10a')](errors[0x194]);_0x45bf15[_0xfe9e('0x109')]('/*')[_0xfe9e('0x10a')](function(_0x293998,_0x44187c){_0x44187c['sendFile'](path['resolve'](_0x45bf15[_0xfe9e('0x10a')](_0xfe9e('0x10b'))+'/index.html'));});return _0x45bf15;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a963921..554492f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb85f=['../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc'];(function(_0x19aaa9,_0x9d0bb6){var _0x465463=function(_0x3a96db){while(--_0x3a96db){_0x19aaa9['push'](_0x19aaa9['shift']());}};_0x465463(++_0x9d0bb6);}(_0xb85f,0x132));var _0xfb85=function(_0x4a16a2,_0x3cbf1c){_0x4a16a2=_0x4a16a2-0x0;var _0x564b20=_0xb85f[_0x4a16a2];return _0x564b20;};'use strict';var jayson=require('jayson/promise');var _=require(_0xfb85('0x0'));var config=require(_0xfb85('0x1'));exports[_0xfb85('0x2')]=function(){return new Promise(function(_0x5b75a6,_0x935fd0){var _0x50f7c7={};_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x3')));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/voiceExtension/voiceExtension.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x5')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x6')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x7')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x8')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x9')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/memberReport/memberReport.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0xa')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0xb')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0xc')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0xd')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/mailAccount/mailAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0xe')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0xf')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x10')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x11')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x12')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/faxApplication/faxApplication.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x13')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/faxMessage/faxMessage.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x14')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x15')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x16')));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/smsInteraction/smsInteraction.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x17')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/smsQueue/smsQueue.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x18')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x19')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x1a')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x1b')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x1c')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x1d')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x1e')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/cmHopper/cmHopper.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x1f')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x20')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x21')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x22')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x23')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x24')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x25')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x26')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x27')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x28')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x29')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2a')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2b')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x2c')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2d')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2e')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x2f')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x30')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x31')));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/setting/setting.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x32')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/squareProject/squareProject.rpc'));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x33')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x34')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x35')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x36')));_0x50f7c7=_['merge'](_0x50f7c7,require(_0xfb85('0x37')));_0x50f7c7=_['merge'](_0x50f7c7,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x38')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x39')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require(_0xfb85('0x3a')));_0x50f7c7=_[_0xfb85('0x4')](_0x50f7c7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x30fb56=jayson[_0xfb85('0x3b')](_0x50f7c7)[_0xfb85('0x3c')]();var _0x1a3e79=config[_0xfb85('0x3d')][_0xfb85('0x3e')]||config['port']+0x1;var _0x82e1b1=config[_0xfb85('0x3d')]['ip']||_0xfb85('0x3f');_0x30fb56['on'](_0xfb85('0x40'),function(_0x4eda45){return _0x935fd0(_0x4eda45);});_0x30fb56[_0xfb85('0x2')](_0x1a3e79,_0x82e1b1,function(){console['log'](_0xfb85('0x41'),_0x82e1b1,_0x1a3e79);require('../config/triggers')[_0xfb85('0x42')]();return _0x5b75a6(_0xfb85('0x43')+_0x82e1b1+':'+_0x1a3e79);});});}; \ No newline at end of file +var _0x01ad=['localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','../config/environment','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port'];(function(_0x424893,_0x5099b2){var _0x226408=function(_0x3e0110){while(--_0x3e0110){_0x424893['push'](_0x424893['shift']());}};_0x226408(++_0x5099b2);}(_0x01ad,0xd2));var _0xd01a=function(_0x582e57,_0x85fded){_0x582e57=_0x582e57-0x0;var _0xfef0e6=_0x01ad[_0x582e57];return _0xfef0e6;};'use strict';var jayson=require(_0xd01a('0x0'));var _=require('lodash');var config=require(_0xd01a('0x1'));exports['listen']=function(){return new Promise(function(_0x4a6305,_0x6f4e7d){var _0xf17e74={};_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x2')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x4')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/voiceQueue/voiceQueue.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x5')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x6')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x7')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x8')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x9')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0xa')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0xb')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0xc')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/mailAccount/mailAccount.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0xd')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0xe')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0xf')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x10')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x11')));_0xf17e74=_['merge'](_0xf17e74,require('../api/faxAccount/faxAccount.rpc'));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x12')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x13')));_0xf17e74=_['merge'](_0xf17e74,require('../api/faxMessage/faxMessage.rpc'));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x14')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x15')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/smsAccount/smsAccount.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x16')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/smsMessage/smsMessage.rpc'));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x17')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x18')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x19')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x1a')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xf17e74=_['merge'](_0xf17e74,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x1b')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/chatMessage/chatMessage.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x1c')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x1d')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/cmHopper/cmHopper.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x1e')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x1f')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x20')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x21')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/pause/pause.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/sound/sound.rpc'));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x22')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x23')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x24')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x25')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x26')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x27')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x28')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x29')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x2a')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x2b')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x2c')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x2d')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x2e')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x2f')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x30')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x31')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x32')));_0xf17e74=_['merge'](_0xf17e74,require('../api/setting/setting.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x33')));_0xf17e74=_['merge'](_0xf17e74,require(_0xd01a('0x34')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/squareRecording/squareRecording.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x35')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x36')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/attachment/attachment.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/plugin/plugin.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x37')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x38')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x39')));_0xf17e74=_[_0xd01a('0x3')](_0xf17e74,require(_0xd01a('0x3a')));var _0x545ed5=jayson[_0xd01a('0x3b')](_0xf17e74)['http']();var _0x66cfc5=config[_0xd01a('0x3c')]['port']||config[_0xd01a('0x3d')]+0x1;var _0xee4d71=config['rpc']['ip']||_0xd01a('0x3e');_0x545ed5['on'](_0xd01a('0x3f'),function(_0x18896e){return _0x6f4e7d(_0x18896e);});_0x545ed5[_0xd01a('0x40')](_0x66cfc5,_0xee4d71,function(){console[_0xd01a('0x41')](_0xd01a('0x42'),_0xee4d71,_0x66cfc5);require('../config/triggers')[_0xd01a('0x43')]();return _0x4a6305('RPC\x20listening\x20on\x20'+_0xee4d71+':'+_0x66cfc5);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 34d6064..8b4a3cb 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 _0xbb59=['destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','EventEmitter','./reply','./error','setTimeout','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xbb59,0x167));var _0x9bb5=function(_0x5b921b,_0x37ee51){_0x5b921b=_0x5b921b-0x0;var _0xb83ee6=_0xbb59[_0x5b921b];return _0xb83ee6;};'use strict';var util=require('util');var _=require(_0x9bb5('0x0'));var EventEmitter=require(_0x9bb5('0x1'))[_0x9bb5('0x2')];var AGIReply=require(_0x9bb5('0x3'));var AGIError=require(_0x9bb5('0x4'));function AGIChannel(_0x435269){var _0x1f288d=this,_0x304809=new AGIReply(),_0x35a697=![],_0x311401={};EventEmitter['call'](_0x1f288d);_0x435269['setEncoding']('utf8');_0x435269[_0x9bb5('0x5')](0x8*0x3c*0x3c*0x3e8);_0x304809[_0x9bb5('0x6')](_0x9bb5('0x7'));_0x304809['on'](_0x9bb5('0x8'),function(_0x389120){for(var _0x338b8a in _0x389120){_0x1f288d[_0x338b8a]=_0x389120[_0x338b8a];}_0x1f288d[_0x9bb5('0x9')](_0x9bb5('0xa'));});_0x304809['on'](_0x9bb5('0xb'),function(_0x17a011){if(_0x17a011[_0x9bb5('0xc')]()==_0x9bb5('0xd')){_0x1f288d[_0x9bb5('0x9')]('hangup');return;}if(_0x17a011['substring'](0x0,0xb)==_0x9bb5('0xe')){_0x35a697=!![];}if(_0x35a697){_0x311401['rx']+=_0x17a011+'\x0a';if(_0x17a011['search']('520\x20End\x20of\x20proper')!=-0x1){_0x35a697=![];}}else{_0x311401['rx']=_0x17a011;}if(_0x35a697){return;}if(typeof _0x311401['cb']=='function'){var _0x1a32b1=_0x311401['rx'][_0x9bb5('0xf')](0x0,0x3),_0x2025b7=null,_0x2edd65=null;_0x1a32b1=parseInt(_0x1a32b1);if(isNaN(_0x1a32b1)){_0x311401['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9bb5('0x10')});return;}if(_0x1a32b1!=0xc8){_0x311401['cb'](null,{'code':_0x1a32b1,'result':-0x1,'extra':'KO'});return;}_0x2025b7=_0x311401['rx'][_0x9bb5('0xf')](0x4)[_0x9bb5('0x11')](_0x9bb5('0x12'),'');if(_0x2025b7[_0x9bb5('0x13')]('\x20')!=-0x1){_0x2025b7=_0x2025b7[_0x9bb5('0x14')](0x0,_0x2025b7[_0x9bb5('0x13')]('\x20'));}if(_[_0x9bb5('0x15')](_0x2025b7,'-1')){_0x2025b7=parseInt(_0x2025b7);}_0x2edd65=_0x311401['rx'][_0x9bb5('0x16')]('\x20');if(_0x2edd65[_0x9bb5('0x17')]==0x3){_0x2edd65=_0x2edd65[0x2][_0x9bb5('0xf')](0x1,_0x2edd65[0x2]['length']-0x1);}else if(_0x2edd65[_0x9bb5('0x17')]>0x3){var _0x53920b=/\((.+)\)/;var _0x587187=_0x311401['rx'][_0x9bb5('0x18')](_0x53920b);if(_0x587187){_0x2edd65=_0x587187[0x1];}else{_0x2edd65=null;}}else{_0x2edd65=null;}_0x311401['cb'](null,{'code':_0x1a32b1,'result':_0x2025b7,'extra':_0x2edd65});}});_0x435269['on'](_0x9bb5('0x19'),function(_0x11e4dd){_0x1f288d[_0x9bb5('0x9')](_0x9bb5('0x19'),new AGIError(_0x9bb5('0x1a'),_0x11e4dd[_0x9bb5('0x1b')]));});_0x435269['on'](_0x9bb5('0x1c'),function(){_0x1f288d[_0x9bb5('0x9')](_0x9bb5('0x1c'),new AGIError(_0x9bb5('0x1d')));});_0x435269['on'](_0x9bb5('0x1e'),function(){_0x1f288d[_0x9bb5('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x435269[_0x9bb5('0x1f')]();});_0x435269[_0x9bb5('0x20')](_0x304809);this[_0x9bb5('0x21')]=function(_0x5781d2,_0x43e18d){var _0x5781d2=_0x5781d2||'',_0x43e18d=typeof _0x43e18d=='function'?_0x43e18d:new Function();_0x311401={'tx':_0x5781d2,'rx':'','cb':_0x43e18d};_0x435269[_0x9bb5('0x22')](_0x5781d2+'\x0a');},this[_0x9bb5('0x1c')]=function(){_0x435269[_0x9bb5('0x1f')]();};}util[_0x9bb5('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x25')]=function(_0x37a0a0){return this[_0x9bb5('0x21')][_0x9bb5('0x26')](this,_0x37a0a0);};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x27')]=function(){return this[_0x9bb5('0x25')](_0x9bb5('0x28'));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x29')]=function(_0x3edfa5,_0x254ff4,_0x10b9f4){_0x3edfa5=_0x3edfa5===undefined?_0x9bb5('0x2a'):_0x3edfa5;_0x254ff4=_0x254ff4===undefined?'5':_0x254ff4;_0x10b9f4=_0x10b9f4===undefined?'1':_0x10b9f4;return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x2c'),_0x3edfa5,_0x254ff4*0x3e8,_0x10b9f4));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x2d')]=function(_0x52a6d7){_0x52a6d7=_0x52a6d7||_0x9bb5('0x2e');return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')]('VERBOSE\x20\x22%s\x22',_0x52a6d7));};AGIChannel['prototype']['exec']=function(_0x45268e,_0x40ba10){if(_[_0x9bb5('0x2f')](_0x40ba10)){return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')]('EXEC\x20%s\x20%s',_0x45268e,_0x40ba10['join'](',')));}return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x30'),_0x45268e,_0x40ba10));};AGIChannel['prototype']['setContext']=function(_0x11f337){return this['sendRequest'](util[_0x9bb5('0x2b')](_0x9bb5('0x31'),_0x11f337));};AGIChannel[_0x9bb5('0x24')]['setExtension']=function(_0x534750){return this['sendRequest'](util['format'](_0x9bb5('0x32'),_0x534750));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x33')]=function(_0x39c474){return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x34'),_0x39c474));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0xd')]=function(){return this[_0x9bb5('0x25')](_0x9bb5('0x35'));};AGIChannel[_0x9bb5('0x24')]['setVariable']=function(_0x2b96d9,_0x4a8ca2){var _0x30b784=_['isBoolean'](_0x4a8ca2)||_[_0x9bb5('0x36')](_0x4a8ca2)?_0x4a8ca2['toString']():_0x4a8ca2;return this[_0x9bb5('0x25')](util['format'](_0x9bb5('0x37'),_0x2b96d9,_0x30b784?_0x30b784[_0x9bb5('0x38')]()[_0x9bb5('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x39')]=function(_0x30162a,_0x2a68d5){return this['sendRequest'](util[_0x9bb5('0x2b')](_0x9bb5('0x3a'),_0x30162a,_0x2a68d5));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x3b')]=function(_0x1cac45,_0x24dc0c){return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x3c'),_0x1cac45,_0x24dc0c));};AGIChannel[_0x9bb5('0x24')]['sayPhonetic']=function(_0x483353,_0x5d8635){return this[_0x9bb5('0x25')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x483353,_0x5d8635));};AGIChannel['prototype'][_0x9bb5('0x3d')]=function(_0x5be18c,_0x3f2ea3,_0x10085e){_0x3f2ea3=_0x3f2ea3||this[_0x9bb5('0x3e')];_0x10085e=_0x10085e||0x1;this[_0x9bb5('0x3f')](_0x5be18c);this['setExtension'](_0x3f2ea3);this[_0x9bb5('0x33')](_0x10085e);return this[_0x9bb5('0x2d')](util[_0x9bb5('0x2b')](_0x9bb5('0x40'),_0x5be18c,_0x3f2ea3,_0x10085e));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x41')]=function(_0x7eec49){return this['sendRequest'](util[_0x9bb5('0x2b')](_0x9bb5('0x42'),_0x7eec49));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x43')]=function(_0x30cc06,_0x2f5985,_0x45b2b3,_0x141224,_0x23f9a3,_0x5a8829){_0x2f5985=_0x2f5985||_0x9bb5('0x44');_0x45b2b3=_0x45b2b3||'';_0x141224=_0x141224===undefined?-0x1:_0x141224==='-1'?-0x1:_0x141224*0x3e8;_0x23f9a3=_0x23f9a3===undefined?'':'s='+_0x23f9a3;_0x5a8829=_0x5a8829?_0x9bb5('0x45'):'';return this[_0x9bb5('0x25')](util[_0x9bb5('0x2b')](_0x9bb5('0x46'),_0x30cc06,_0x2f5985,_0x45b2b3,_0x141224,_0x5a8829,_0x23f9a3));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x47')]=function(_0x5568e8,_0x473dbc){_0x473dbc=_0x473dbc||'';return this[_0x9bb5('0x25')](util['format'](_0x9bb5('0x48'),_0x5568e8,_0x473dbc));};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x49')]=function(_0x2564f4){return this[_0x9bb5('0x4a')]('AGI',_0x2564f4);};AGIChannel[_0x9bb5('0x24')]['wait']=function(_0xc514cc){return this['exec'](_0x9bb5('0x4b'),_0xc514cc);};AGIChannel[_0x9bb5('0x24')][_0x9bb5('0x19')]=function(_0x3bc433,_0x431132){this[_0x9bb5('0x2d')](util['format'](_0x9bb5('0x4c'),_0x3bc433['id'],_0x3bc433[_0x9bb5('0x4d')],_0x431132));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x639a=['exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','recordFile','wav','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','exports','util','lodash','./reply','./error','setEncoding','setTimeout','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sync','answer','sendRequest','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22'];(function(_0x1c0aa3,_0x10702d){var _0x8be512=function(_0x5f0ba4){while(--_0x5f0ba4){_0x1c0aa3['push'](_0x1c0aa3['shift']());}};_0x8be512(++_0x10702d);}(_0x639a,0x1e8));var _0xa639=function(_0x18decb,_0x28b1c7){_0x18decb=_0x18decb-0x0;var _0x361a53=_0x639a[_0x18decb];return _0x361a53;};'use strict';var util=require(_0xa639('0x0'));var _=require(_0xa639('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0xa639('0x2'));var AGIError=require(_0xa639('0x3'));function AGIChannel(_0x4990ab){var _0x43c5a2=this,_0x252c3f=new AGIReply(),_0x255d5a=![],_0x4070ad={};EventEmitter['call'](_0x43c5a2);_0x4990ab[_0xa639('0x4')]('utf8');_0x4990ab[_0xa639('0x5')](0x8*0x3c*0x3c*0x3e8);_0x252c3f[_0xa639('0x4')](_0xa639('0x6'));_0x252c3f['on'](_0xa639('0x7'),function(_0x41a185){for(var _0x53a5f3 in _0x41a185){_0x43c5a2[_0x53a5f3]=_0x41a185[_0x53a5f3];}_0x43c5a2[_0xa639('0x8')](_0xa639('0x9'));});_0x252c3f['on'](_0xa639('0xa'),function(_0x5c03b5){if(_0x5c03b5[_0xa639('0xb')]()==_0xa639('0xc')){_0x43c5a2['emit'](_0xa639('0xc'));return;}if(_0x5c03b5[_0xa639('0xd')](0x0,0xb)=='520-Invalid'){_0x255d5a=!![];}if(_0x255d5a){_0x4070ad['rx']+=_0x5c03b5+'\x0a';if(_0x5c03b5[_0xa639('0xe')](_0xa639('0xf'))!=-0x1){_0x255d5a=![];}}else{_0x4070ad['rx']=_0x5c03b5;}if(_0x255d5a){return;}if(typeof _0x4070ad['cb']=='function'){var _0x450aa7=_0x4070ad['rx'][_0xa639('0xd')](0x0,0x3),_0x1a666e=null,_0x110488=null;_0x450aa7=parseInt(_0x450aa7);if(isNaN(_0x450aa7)){_0x4070ad['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa639('0x10')});return;}if(_0x450aa7!=0xc8){_0x4070ad['cb'](null,{'code':_0x450aa7,'result':-0x1,'extra':'KO'});return;}_0x1a666e=_0x4070ad['rx'][_0xa639('0xd')](0x4)[_0xa639('0x11')]('result=','');if(_0x1a666e[_0xa639('0x12')]('\x20')!=-0x1){_0x1a666e=_0x1a666e[_0xa639('0x13')](0x0,_0x1a666e[_0xa639('0x12')]('\x20'));}if(_[_0xa639('0x14')](_0x1a666e,'-1')){_0x1a666e=parseInt(_0x1a666e);}_0x110488=_0x4070ad['rx'][_0xa639('0x15')]('\x20');if(_0x110488[_0xa639('0x16')]==0x3){_0x110488=_0x110488[0x2][_0xa639('0xd')](0x1,_0x110488[0x2][_0xa639('0x16')]-0x1);}else if(_0x110488[_0xa639('0x16')]>0x3){var _0x58eded=/\((.+)\)/;var _0x3a894c=_0x4070ad['rx'][_0xa639('0x17')](_0x58eded);if(_0x3a894c){_0x110488=_0x3a894c[0x1];}else{_0x110488=null;}}else{_0x110488=null;}_0x4070ad['cb'](null,{'code':_0x450aa7,'result':_0x1a666e,'extra':_0x110488});}});_0x4990ab['on']('error',function(_0x15002b){_0x43c5a2[_0xa639('0x8')](_0xa639('0x18'),new AGIError(_0xa639('0x19'),_0x15002b['code']));});_0x4990ab['on'](_0xa639('0x1a'),function(){_0x43c5a2[_0xa639('0x8')](_0xa639('0x1a'),new AGIError(_0xa639('0x1b')));});_0x4990ab['on']('timeout',function(){_0x43c5a2[_0xa639('0x8')](_0xa639('0x1c'),new AGIError(_0xa639('0x1d')));_0x4990ab[_0xa639('0x1e')]();});_0x4990ab[_0xa639('0x1f')](_0x252c3f);this['command']=function(_0x3d90b4,_0x1180f1){var _0x3d90b4=_0x3d90b4||'',_0x1180f1=typeof _0x1180f1=='function'?_0x1180f1:new Function();_0x4070ad={'tx':_0x3d90b4,'rx':'','cb':_0x1180f1};_0x4990ab[_0xa639('0x20')](_0x3d90b4+'\x0a');},this['close']=function(){_0x4990ab[_0xa639('0x1e')]();};}util[_0xa639('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xa639('0x22')]['sendRequest']=function(_0x41eec4){return this['command'][_0xa639('0x23')](this,_0x41eec4);};AGIChannel[_0xa639('0x22')][_0xa639('0x24')]=function(){return this[_0xa639('0x25')]('ANSWER');};AGIChannel[_0xa639('0x22')][_0xa639('0x26')]=function(_0x1414be,_0x7c2648,_0x5f0dd0){_0x1414be=_0x1414be===undefined?_0xa639('0x27'):_0x1414be;_0x7c2648=_0x7c2648===undefined?'5':_0x7c2648;_0x5f0dd0=_0x5f0dd0===undefined?'1':_0x5f0dd0;return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x29'),_0x1414be,_0x7c2648*0x3e8,_0x5f0dd0));};AGIChannel[_0xa639('0x22')][_0xa639('0x2a')]=function(_0x4cf740){_0x4cf740=_0x4cf740||'NO\x20MESSAGE';return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x2b'),_0x4cf740));};AGIChannel[_0xa639('0x22')][_0xa639('0x2c')]=function(_0x561103,_0x5151a1){if(_[_0xa639('0x2d')](_0x5151a1)){return this['sendRequest'](util[_0xa639('0x28')]('EXEC\x20%s\x20%s',_0x561103,_0x5151a1[_0xa639('0x2e')](',')));}return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x2f'),_0x561103,_0x5151a1));};AGIChannel[_0xa639('0x22')][_0xa639('0x30')]=function(_0x23748a){return this[_0xa639('0x25')](util['format'](_0xa639('0x31'),_0x23748a));};AGIChannel['prototype'][_0xa639('0x32')]=function(_0x263a22){return this['sendRequest'](util[_0xa639('0x28')](_0xa639('0x33'),_0x263a22));};AGIChannel['prototype']['setPriority']=function(_0x3a53a9){return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x34'),_0x3a53a9));};AGIChannel[_0xa639('0x22')][_0xa639('0xc')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0xa639('0x22')][_0xa639('0x35')]=function(_0x5bf392,_0x191417){var _0x246f75=_[_0xa639('0x36')](_0x191417)||_[_0xa639('0x37')](_0x191417)?_0x191417['toString']():_0x191417;return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x38'),_0x5bf392,_0x246f75?_0x246f75[_0xa639('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa639('0x22')][_0xa639('0x3a')]=function(_0xdfc5ab,_0x2ec9d0){return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x3b'),_0xdfc5ab,_0x2ec9d0));};AGIChannel[_0xa639('0x22')][_0xa639('0x3c')]=function(_0x2d10cc,_0x1256a1){return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x3d'),_0x2d10cc,_0x1256a1));};AGIChannel[_0xa639('0x22')][_0xa639('0x3e')]=function(_0x563c70,_0x419fc6){return this[_0xa639('0x25')](util[_0xa639('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x563c70,_0x419fc6));};AGIChannel[_0xa639('0x22')][_0xa639('0x3f')]=function(_0x2bc1df,_0x118e94,_0xbc674){_0x118e94=_0x118e94||this[_0xa639('0x40')];_0xbc674=_0xbc674||0x1;this[_0xa639('0x30')](_0x2bc1df);this['setExtension'](_0x118e94);this[_0xa639('0x41')](_0xbc674);return this[_0xa639('0x2a')](util[_0xa639('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x2bc1df,_0x118e94,_0xbc674));};AGIChannel['prototype']['getVariable']=function(_0x16e342){return this[_0xa639('0x25')](util[_0xa639('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x16e342));};AGIChannel['prototype'][_0xa639('0x42')]=function(_0x115e19,_0x4d691a,_0x420e02,_0x527bfb,_0x48a3fc,_0x265c46){_0x4d691a=_0x4d691a||_0xa639('0x43');_0x420e02=_0x420e02||'';_0x527bfb=_0x527bfb===undefined?-0x1:_0x527bfb==='-1'?-0x1:_0x527bfb*0x3e8;_0x48a3fc=_0x48a3fc===undefined?'':'s='+_0x48a3fc;_0x265c46=_0x265c46?'BEEP':'';return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x44'),_0x115e19,_0x4d691a,_0x420e02,_0x527bfb,_0x265c46,_0x48a3fc));};AGIChannel[_0xa639('0x22')][_0xa639('0x45')]=function(_0x3ad417,_0x3eb23f){_0x3eb23f=_0x3eb23f||'';return this[_0xa639('0x25')](util[_0xa639('0x28')](_0xa639('0x46'),_0x3ad417,_0x3eb23f));};AGIChannel[_0xa639('0x22')]['agi']=function(_0x132ea0){return this['exec'](_0xa639('0x47'),_0x132ea0);};AGIChannel[_0xa639('0x22')][_0xa639('0x48')]=function(_0x3e7885){return this[_0xa639('0x2c')](_0xa639('0x49'),_0x3e7885);};AGIChannel[_0xa639('0x22')]['error']=function(_0x5d954d,_0x4d0edd){this[_0xa639('0x2a')](util[_0xa639('0x28')](_0xa639('0x4a'),_0x5d954d['id'],_0x5d954d['label'],_0x4d0edd));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa639('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 3f90c0f..0ffad51 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 _0x8f5a=['exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x3c1d48,_0x361ab3){var _0x359de5=function(_0x59d45b){while(--_0x59d45b){_0x3c1d48['push'](_0x3c1d48['shift']());}};_0x359de5(++_0x361ab3);}(_0x8f5a,0x171));var _0xa8f5=function(_0x426e9b,_0x50cc93){_0x426e9b=_0x426e9b-0x0;var _0x1dc9dd=_0x8f5a[_0x426e9b];return _0x1dc9dd;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xa8f5('0x0'),'E_AGI_ARGUMENT_PORT':_0xa8f5('0x1'),'E_AGI_SERVER_ERROR':_0xa8f5('0x2'),'E_AGI_SERVER_CLOSE':_0xa8f5('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa8f5('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa8f5('0x5'),'E_AGI_SOCKET_CLOSE':_0xa8f5('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xa8f5('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa8f5('0x8'),'E_AGI_IVR_ENTRY':_0xa8f5('0x9')};function AGIError(_0x580f0b){var _0x580f0b=_0x580f0b||null,_0x454fb1=_0x454fb1||[],_0x29a50f=0x1,_0x91ccea='';if(!error[_0x580f0b]){_0x580f0b=_0xa8f5('0xa');}_0x454fb1['push'](error[_0x580f0b]);while(arguments[_0x29a50f]){_0x454fb1[_0xa8f5('0xb')](arguments[_0x29a50f]);_0x29a50f++;}_0x91ccea=util[_0xa8f5('0xc')][_0xa8f5('0xd')](util,_0x454fb1);this[_0xa8f5('0xe')]=_0x91ccea;this['name']=_0x580f0b;}module[_0xa8f5('0xf')]=AGIError; \ No newline at end of file +var _0xc8b7=['format','apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0xcac0dd,_0x31d63d){var _0x5ece6f=function(_0x3b295a){while(--_0x3b295a){_0xcac0dd['push'](_0xcac0dd['shift']());}};_0x5ece6f(++_0x31d63d);}(_0xc8b7,0x170));var _0x7c8b=function(_0x356aff,_0x2fa9a7){_0x356aff=_0x356aff-0x0;var _0x3922d4=_0xc8b7[_0x356aff];return _0x3922d4;};'use strict';var util=require(_0x7c8b('0x0'));var error={'E_AGI_UNDEFINED':_0x7c8b('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x7c8b('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x7c8b('0x3'),'E_AGI_SOCKET_ERROR':_0x7c8b('0x4'),'E_AGI_SOCKET_CLOSE':_0x7c8b('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x7c8b('0x6'),'E_AGI_COMMAND_EMPTY':_0x7c8b('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x7c8b('0x8')};function AGIError(_0x2247d2){var _0x2247d2=_0x2247d2||null,_0x2ee913=_0x2ee913||[],_0x4be783=0x1,_0x3f8fe1='';if(!error[_0x2247d2]){_0x2247d2='E_AGI_UNDEFINED';}_0x2ee913['push'](error[_0x2247d2]);while(arguments[_0x4be783]){_0x2ee913['push'](arguments[_0x4be783]);_0x4be783++;}_0x3f8fe1=util[_0x7c8b('0x9')][_0x7c8b('0xa')](util,_0x2ee913);this[_0x7c8b('0xb')]=_0x3f8fe1;this['name']=_0x2247d2;}module[_0x7c8b('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index baf816e..b7ac7a5 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd151=['redis','defaults','localhost','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','events','ioredis'];(function(_0xdc250d,_0x49433b){var _0x5e0da5=function(_0x1721c8){while(--_0x1721c8){_0xdc250d['push'](_0xdc250d['shift']());}};_0x5e0da5(++_0x49433b);}(_0xd151,0xbe));var _0x1d15=function(_0x41e3e5,_0x441240){_0x41e3e5=_0x41e3e5-0x0;var _0x4b5b5c=_0xd151[_0x41e3e5];return _0x4b5b5c;};'use strict';var _=require('lodash');var EventEmitter=require(_0x1d15('0x0'))['EventEmitter'];var Redis=require(_0x1d15('0x1'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x1d15('0x2')]=_[_0x1d15('0x3')](config[_0x1d15('0x2')],{'host':_0x1d15('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1d15('0x2')]);sub['subscribe']('agi',function(_0x20e8ef){if(_0x20e8ef)return eventEmitter[_0x1d15('0x5')](_0x1d15('0x6'),new AGIError(_0x1d15('0x7'),_0x20e8ef));});sub['on'](_0x1d15('0x8'),function(_0x551cfc,_0x323b40){if(_0x551cfc!=='agi')return;try{var _0x476d0d=JSON[_0x1d15('0x9')](_0x323b40);eventEmitter[_0x1d15('0x5')](_0x1d15('0xa'),_0x476d0d);}catch(_0x1bd132){eventEmitter[_0x1d15('0x5')](_0x1d15('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x1bd132));}});module[_0x1d15('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x3f4e=['defaults','localhost','agi','emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis'];(function(_0x2ddf36,_0x4b8395){var _0x2b6953=function(_0x3c3566){while(--_0x3c3566){_0x2ddf36['push'](_0x2ddf36['shift']());}};_0x2b6953(++_0x4b8395);}(_0x3f4e,0x70));var _0xe3f4=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x3f4e[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0xe3f4('0x0'));var EventEmitter=require(_0xe3f4('0x1'))[_0xe3f4('0x2')];var Redis=require(_0xe3f4('0x3'));var AGIError=require(_0xe3f4('0x4'));var config=require(_0xe3f4('0x5'));config[_0xe3f4('0x6')]=_[_0xe3f4('0x7')](config[_0xe3f4('0x6')],{'host':_0xe3f4('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe3f4('0x6')]);sub['subscribe'](_0xe3f4('0x9'),function(_0x171a3c){if(_0x171a3c)return eventEmitter[_0xe3f4('0xa')]('error',new AGIError(_0xe3f4('0xb'),_0x171a3c));});sub['on'](_0xe3f4('0xc'),function(_0x95b893,_0xcc9a63){if(_0x95b893!==_0xe3f4('0x9'))return;try{var _0x3a7f3f=JSON[_0xe3f4('0xd')](_0xcc9a63);eventEmitter[_0xe3f4('0xa')](_0xe3f4('0xe'),_0x3a7f3f);}catch(_0xa5a26e){eventEmitter['emit'](_0xe3f4('0xf'),new AGIError(_0xe3f4('0xb'),_0xa5a26e));}});module[_0xe3f4('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2756f78..9665451 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 _0xfd74=['length','condition','split','vswitch','target','default','agicommand','menu','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','../../../config/logger','agi','getdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse'];(function(_0x36d831,_0x6c602a){var _0x5bc013=function(_0x1b0e7f){while(--_0x1b0e7f){_0x36d831['push'](_0x36d831['shift']());}};_0x5bc013(++_0x6c602a);}(_0xfd74,0x193));var _0x4fd7=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xfd74[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var logger=require(_0x4fd7('0x0'))(_0x4fd7('0x1'));var verticesWithRetry=['menu',_0x4fd7('0x2'),'getsecretdigits'];var Graph=function(){this[_0x4fd7('0x3')]={};this[_0x4fd7('0x4')]={};this[_0x4fd7('0x5')]=0x0;};Graph[_0x4fd7('0x6')][_0x4fd7('0x7')]=function(_0xb264bd){this[_0x4fd7('0x3')][_0xb264bd['id']]=_0xb264bd;this[_0x4fd7('0x4')][_0xb264bd['id']]=[];};Graph['prototype'][_0x4fd7('0x8')]=function(_0xeb9b9a,_0x3b9f4c,_0x4ff1a8){this[_0x4fd7('0x4')][_0xeb9b9a][_0x4fd7('0x9')]({'target':_0x3b9f4c,'condition':_0x4ff1a8});this[_0x4fd7('0x5')]+=0x1;};Graph[_0x4fd7('0x6')]['size']=function(){return _[_0x4fd7('0xa')](this['vertices']);};Graph[_0x4fd7('0x6')][_0x4fd7('0xb')]=function(){return this[_0x4fd7('0x5')];};Graph[_0x4fd7('0x6')][_0x4fd7('0xc')]=function(_0x2ef4a0){return this['vertices'][_0x2ef4a0];};Graph[_0x4fd7('0x6')][_0x4fd7('0xd')]=function(_0x1e59c3,_0x37aef9){if(!this[_0x4fd7('0x3')][_0x1e59c3]){return logger['info'](_0x4fd7('0xe'));}var _0x2563b9=_0x37aef9(this['vertices'][_0x1e59c3]);if(!_0x2563b9){return logger[_0x4fd7('0xf')](_0x4fd7('0x10'));}if(this[_0x4fd7('0x4')][_0x1e59c3][_0x4fd7('0x11')]===0x0){return logger[_0x4fd7('0xf')]('no\x20edge/s\x20available');}for(var _0x5fab62=0x0,_0x5b9132=[],_0x18d3b3=![];_0x5fab62\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','createSquareReport','then','catch','agi_','substring','stringify','close','timeout','hangup','find','production','initialize'];(function(_0x49ac39,_0x583aa2){var _0x45ee5e=function(_0x44d62e){while(--_0x44d62e){_0x49ac39['push'](_0x49ac39['shift']());}};_0x45ee5e(++_0x583aa2);}(_0xb0c5,0x18a));var _0x5b0c=function(_0x41a333,_0x4e19e3){_0x41a333=_0x41a333-0x0;var _0x5938f2=_0xb0c5[_0x41a333];return _0x5938f2;};'use strict';var _=require(_0x5b0c('0x0'));var syncho=require('syncho');var util=require(_0x5b0c('0x1'));var config=require(_0x5b0c('0x2'));var logger=require('../../config/logger')(_0x5b0c('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0x5b0c('0x4'));var Project=require(_0x5b0c('0x5'));var AGIEmitter=require(_0x5b0c('0x6'))[_0x5b0c('0x7')];var projects=[];config[_0x5b0c('0x3')]=_[_0x5b0c('0x8')](config[_0x5b0c('0x3')],{'ip':_0x5b0c('0x9'),'port':0x11dd});AGIEmitter['on'](_0x5b0c('0xa'),projectUpdateHandler);function connectionHandler(_0x129f7b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x129f7b);agiHandler(_0x129f7b);}catch(_0x9dab3c){logger[_0x5b0c('0xb')](_0x9dab3c[_0x5b0c('0xc')]);}});});}function projectUpdateHandler(_0x5f032e){try{var _0x4b2fc9=_['findIndex'](projects,['id',_0x5f032e['id']]);if(_0x4b2fc9>-0x1){if(_0x5f032e['deleted']===!![]){projects[_0x5b0c('0xd')](_0x4b2fc9,0x1);}else{projects[_0x4b2fc9]=_0x5f032e;}}else{projects[_0x5b0c('0xe')](_0x5f032e);}}catch(_0x375317){logger['error'](_0x375317['stack']);}}function listeningHandler(){var _0x36c461=config[_0x5b0c('0xf')]==='production'||![];console[_0x5b0c('0x10')](_0x5b0c('0x11'),config[_0x5b0c('0x3')][_0x5b0c('0x12')]);logger[_0x5b0c('0x13')](util[_0x5b0c('0x14')](_0x5b0c('0x15'),_0x36c461?config['agi']['ip']:'host.docker.internal',config[_0x5b0c('0x3')][_0x5b0c('0x12')]));}function errorHandler(_0x4856ab){if(_0x4856ab&&_0x4856ab[_0x5b0c('0x16')]&&_0x4856ab[_0x5b0c('0x17')]){logger[_0x5b0c('0xb')](util['format'](_0x5b0c('0x18'),_0x4856ab[_0x5b0c('0x16')],_0x4856ab['message']));}else{logger[_0x5b0c('0xb')](util[_0x5b0c('0x14')](_0x5b0c('0x19'),_0x4856ab[_0x5b0c('0xc')]));}}function closeHandler(){logger[_0x5b0c('0x13')](util[_0x5b0c('0x14')](_0x5b0c('0x1a'),this[_0x5b0c('0x1b')],this[_0x5b0c('0x1c')],this[_0x5b0c('0x1d')],this[_0x5b0c('0x1e')],this[_0x5b0c('0x1f')]));try{createSquareReport(this);}catch(_0x4da96b){logger[_0x5b0c('0xb')](_0x4da96b[_0x5b0c('0xc')]);}}function timeoutHandler(){logger['info'](util[_0x5b0c('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x5b0c('0x1c')],this[_0x5b0c('0x1d')],this[_0x5b0c('0x1e')],this[_0x5b0c('0x1f')]));}function hangupHandler(){logger[_0x5b0c('0x13')](util['format'](_0x5b0c('0x20'),this[_0x5b0c('0x1b')],this[_0x5b0c('0x1c')],this[_0x5b0c('0x1d')],this[_0x5b0c('0x1e')],this[_0x5b0c('0x1f')]));this[_0x5b0c('0x21')]=!![];}function createSquareReport(_0x5f183f,_0x3fb904){rpc[_0x5b0c('0x22')](_0x5f183f)[_0x5b0c('0x23')](function(_0x5489cf){if(_0x3fb904){_0x3fb904(null,_0x5489cf);}})[_0x5b0c('0x24')](function(_0x31e05a){if(_0x3fb904){_0x3fb904(null,_0x31e05a);}});}function setChannelVariables(_0x4c3c04){for(var _0x39570 in _0x4c3c04){if(_0x4c3c04['hasOwnProperty'](_0x39570)){if(_0x39570['indexOf'](_0x5b0c('0x25'))===0x0){_0x4c3c04[_0x39570[_0x5b0c('0x26')](0x4)]=_0x4c3c04[_0x39570];delete _0x4c3c04[_0x39570];}}}}function agiHandler(_0x22dc44){logger['debug']('variables',JSON[_0x5b0c('0x27')](_0x22dc44,null,0x2));logger[_0x5b0c('0x13')](util[_0x5b0c('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x22dc44[_0x5b0c('0x1b')],_0x22dc44[_0x5b0c('0x1c')],_0x22dc44['callerid'],_0x22dc44[_0x5b0c('0x1e')],_0x22dc44[_0x5b0c('0x1f')]));_0x22dc44['on']('error',errorHandler);_0x22dc44['on'](_0x5b0c('0x28'),closeHandler);_0x22dc44['on'](_0x5b0c('0x29'),timeoutHandler);_0x22dc44[_0x5b0c('0x21')]=![];_0x22dc44['on'](_0x5b0c('0x2a'),hangupHandler);var _0x5222df=_[_0x5b0c('0x2b')](projects,[_0x5b0c('0x16'),_0x22dc44[_0x5b0c('0x1b')]]);if(!_0x5222df)return Project['handleNotFound'](_0x22dc44);if(!_0x5222df[_0x5b0c('0x2c')])return Project['handleUnpublished'](_0x22dc44);return Project[_0x5b0c('0x2d')](_0x5222df,_0x22dc44);}function main(){var _0x23396c;return utilLicense[_0x5b0c('0x2e')]()['then'](function(_0x518ae9){if(!_0x518ae9)return;if(_0x518ae9[_0x5b0c('0x2f')]){if(_0x518ae9['callysquare']&&_0x518ae9[_0x5b0c('0x30')]>0x0){logger['info'](util[_0x5b0c('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x518ae9[_0x5b0c('0x30')]));_0x23396c=_0x518ae9[_0x5b0c('0x30')];}else{logger[_0x5b0c('0x13')](_0x5b0c('0x31'));}}else{logger[_0x5b0c('0x13')](_0x5b0c('0x32'));_0x23396c=-0x1;}})['then'](function(){return Project[_0x5b0c('0x33')]();})[_0x5b0c('0x23')](function(_0x5eb908){projects=_0x5eb908;return;})[_0x5b0c('0x24')](function(_0x3e6fe6){logger['error']('[LICENSE]',_0x3e6fe6['stack']);})['finally'](function(){var _0x5af9cf=require(_0x5b0c('0x34'))(config['agi'][_0x5b0c('0x12')],config['agi']['ip'],_0x23396c);_0x5af9cf['on'](_0x5b0c('0xb'),errorHandler);_0x5af9cf['on'](_0x5b0c('0x35'),listeningHandler);_0x5af9cf['on'](_0x5b0c('0x36'),connectionHandler);_0x5af9cf['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x7d92=['projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','env','production','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','initialize','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','127.0.0.1'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x7d92,0xe2));var _0x27d9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7d92[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x27d9('0x0'));var syncho=require(_0x27d9('0x1'));var util=require('util');var config=require(_0x27d9('0x2'));var logger=require(_0x27d9('0x3'))(_0x27d9('0x4'));var utilLicense=require(_0x27d9('0x5'));var rpc=require(_0x27d9('0x6'));var Project=require('./project');var AGIEmitter=require(_0x27d9('0x7'))[_0x27d9('0x8')];var projects=[];config[_0x27d9('0x4')]=_['defaults'](config[_0x27d9('0x4')],{'ip':_0x27d9('0x9'),'port':0x11dd});AGIEmitter['on'](_0x27d9('0xa'),projectUpdateHandler);function connectionHandler(_0x547b3e){process[_0x27d9('0xb')](function(){syncho(function(){try{setChannelVariables(_0x547b3e);agiHandler(_0x547b3e);}catch(_0x588ee5){logger[_0x27d9('0xc')](_0x588ee5[_0x27d9('0xd')]);}});});}function projectUpdateHandler(_0x4d7df2){try{var _0x3a58bd=_[_0x27d9('0xe')](projects,['id',_0x4d7df2['id']]);if(_0x3a58bd>-0x1){if(_0x4d7df2[_0x27d9('0xf')]===!![]){projects[_0x27d9('0x10')](_0x3a58bd,0x1);}else{projects[_0x3a58bd]=_0x4d7df2;}}else{projects[_0x27d9('0x11')](_0x4d7df2);}}catch(_0x18077b){logger['error'](_0x18077b[_0x27d9('0xd')]);}}function listeningHandler(){var _0x3c3ccf=config[_0x27d9('0x12')]===_0x27d9('0x13')||![];console['log'](_0x27d9('0x14'),config[_0x27d9('0x4')][_0x27d9('0x15')]);logger[_0x27d9('0x16')](util[_0x27d9('0x17')](_0x27d9('0x18'),_0x3c3ccf?config[_0x27d9('0x4')]['ip']:_0x27d9('0x19'),config[_0x27d9('0x4')][_0x27d9('0x15')]));}function errorHandler(_0x26af0c){if(_0x26af0c&&_0x26af0c[_0x27d9('0x1a')]&&_0x26af0c[_0x27d9('0x1b')]){logger[_0x27d9('0xc')](util[_0x27d9('0x17')]('[%s]\x20%s',_0x26af0c['name'],_0x26af0c[_0x27d9('0x1b')]));}else{logger[_0x27d9('0xc')](util[_0x27d9('0x17')](_0x27d9('0x1c'),_0x26af0c['stack']));}}function closeHandler(){logger[_0x27d9('0x16')](util[_0x27d9('0x17')](_0x27d9('0x1d'),this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this[_0x27d9('0x1e')]));try{createSquareReport(this);}catch(_0x131c7d){logger[_0x27d9('0xc')](_0x131c7d['stack']);}}function timeoutHandler(){logger[_0x27d9('0x16')](util[_0x27d9('0x17')](_0x27d9('0x1f'),this[_0x27d9('0x20')],this[_0x27d9('0x21')],this[_0x27d9('0x22')],this[_0x27d9('0x23')],this['uniqueid']));}function hangupHandler(){logger[_0x27d9('0x16')](util[_0x27d9('0x17')](_0x27d9('0x24'),this[_0x27d9('0x20')],this[_0x27d9('0x21')],this['callerid'],this[_0x27d9('0x23')],this[_0x27d9('0x1e')]));this[_0x27d9('0x25')]=!![];}function createSquareReport(_0x3ec992,_0x121556){rpc['createSquareReport'](_0x3ec992)[_0x27d9('0x26')](function(_0x12af76){if(_0x121556){_0x121556(null,_0x12af76);}})['catch'](function(_0x2b4c36){if(_0x121556){_0x121556(null,_0x2b4c36);}});}function setChannelVariables(_0x484940){for(var _0x4e084d in _0x484940){if(_0x484940['hasOwnProperty'](_0x4e084d)){if(_0x4e084d[_0x27d9('0x27')](_0x27d9('0x28'))===0x0){_0x484940[_0x4e084d[_0x27d9('0x29')](0x4)]=_0x484940[_0x4e084d];delete _0x484940[_0x4e084d];}}}}function agiHandler(_0x3cb2d4){logger[_0x27d9('0x2a')](_0x27d9('0x2b'),JSON[_0x27d9('0x2c')](_0x3cb2d4,null,0x2));logger[_0x27d9('0x16')](util['format'](_0x27d9('0x2d'),_0x3cb2d4['arg_1'],_0x3cb2d4['calleridname'],_0x3cb2d4[_0x27d9('0x22')],_0x3cb2d4[_0x27d9('0x23')],_0x3cb2d4[_0x27d9('0x1e')]));_0x3cb2d4['on'](_0x27d9('0xc'),errorHandler);_0x3cb2d4['on'](_0x27d9('0x2e'),closeHandler);_0x3cb2d4['on'](_0x27d9('0x2f'),timeoutHandler);_0x3cb2d4[_0x27d9('0x25')]=![];_0x3cb2d4['on']('hangup',hangupHandler);var _0x573828=_['find'](projects,[_0x27d9('0x1a'),_0x3cb2d4[_0x27d9('0x20')]]);if(!_0x573828)return Project[_0x27d9('0x30')](_0x3cb2d4);if(!_0x573828['production'])return Project['handleUnpublished'](_0x3cb2d4);return Project[_0x27d9('0x31')](_0x573828,_0x3cb2d4);}function main(){var _0x4df5b7;return utilLicense['getLicense']()[_0x27d9('0x26')](function(_0x5c496a){if(!_0x5c496a)return;if(_0x5c496a['voice']){if(_0x5c496a[_0x27d9('0x32')]&&_0x5c496a[_0x27d9('0x32')]>0x0){logger[_0x27d9('0x16')](util[_0x27d9('0x17')](_0x27d9('0x33'),_0x5c496a[_0x27d9('0x32')]));_0x4df5b7=_0x5c496a[_0x27d9('0x32')];}else{logger[_0x27d9('0x16')](_0x27d9('0x34'));}}else{logger[_0x27d9('0x16')](_0x27d9('0x35'));_0x4df5b7=-0x1;}})['then'](function(){return Project[_0x27d9('0x36')]();})['then'](function(_0x25c4e2){projects=_0x25c4e2;return;})['catch'](function(_0x481fd5){logger[_0x27d9('0xc')]('[LICENSE]',_0x481fd5[_0x27d9('0xd')]);})[_0x27d9('0x37')](function(){var _0x5c9c55=require(_0x27d9('0x38'))(config['agi'][_0x27d9('0x15')],config[_0x27d9('0x4')]['ip'],_0x4df5b7);_0x5c9c55['on'](_0x27d9('0xc'),errorHandler);_0x5c9c55['on'](_0x27d9('0x39'),listeningHandler);_0x5c9c55['on'](_0x27d9('0x3a'),connectionHandler);_0x5c9c55['on'](_0x27d9('0x2e'),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 4057aba..8707de6 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 _0x5217=['result','sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x505c9a,_0x3c0087){var _0x3ddae6=function(_0xce0893){while(--_0xce0893){_0x505c9a['push'](_0x505c9a['shift']());}};_0x3ddae6(++_0x3c0087);}(_0x5217,0x7a));var _0x7521=function(_0x17f94f,_0x977aa){_0x17f94f=_0x17f94f-0x0;var _0x63c583=_0x5217[_0x17f94f];return _0x63c583;};'use strict';var BPromise=require(_0x7521('0x0'));var jayson=require(_0x7521('0x1'));var client=jayson[_0x7521('0x2')][_0x7521('0x3')]({'port':0x232b});function request(_0x4e8101,_0x2b3af9){return new BPromise(function(_0x51d987,_0x343445){return client[_0x7521('0x4')](_0x4e8101,_0x2b3af9)[_0x7521('0x5')](function(_0x97c157){if(_0x97c157[_0x7521('0x6')]){return _0x343445(_0x97c157[_0x7521('0x6')][_0x7521('0x7')]);}else{return _0x51d987(_0x97c157[_0x7521('0x8')]);}})['catch'](function(_0x497e1e){return _0x343445(_0x497e1e);});});}exports[_0x7521('0x9')]=function(_0x302be2,_0x57b182){return request('SendMail',{'account':_0x302be2,'message':_0x57b182});}; \ No newline at end of file +var _0xce42=['bluebird','jayson/promise','client','http','request','then','error','message','sendMailMessage','SendMail'];(function(_0x2bb24b,_0x421886){var _0x24ac0f=function(_0x2386f3){while(--_0x2386f3){_0x2bb24b['push'](_0x2bb24b['shift']());}};_0x24ac0f(++_0x421886);}(_0xce42,0x17c));var _0x2ce4=function(_0x391932,_0x3c1b9f){_0x391932=_0x391932-0x0;var _0x49ca90=_0xce42[_0x391932];return _0x49ca90;};'use strict';var BPromise=require(_0x2ce4('0x0'));var jayson=require(_0x2ce4('0x1'));var client=jayson[_0x2ce4('0x2')][_0x2ce4('0x3')]({'port':0x232b});function request(_0x14b470,_0x575b7d){return new BPromise(function(_0x51f451,_0x286678){return client[_0x2ce4('0x4')](_0x14b470,_0x575b7d)[_0x2ce4('0x5')](function(_0x24fe23){if(_0x24fe23['error']){return _0x286678(_0x24fe23[_0x2ce4('0x6')][_0x2ce4('0x7')]);}else{return _0x51f451(_0x24fe23['result']);}})['catch'](function(_0x3f50e2){return _0x286678(_0x3f50e2);});});}exports[_0x2ce4('0x8')]=function(_0x4e304d,_0x337742){return request(_0x2ce4('0x9'),{'account':_0x4e304d,'message':_0x337742});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index c92e18b..04e5f0c 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf462=['isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','toString','agicommand\x20not\x20found','stack','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','finally'];(function(_0x335f37,_0x37302b){var _0x1768f4=function(_0x3ce316){while(--_0x3ce316){_0x335f37['push'](_0x335f37['shift']());}};_0x1768f4(++_0x37302b);}(_0xf462,0xc5));var _0x2f46=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xf462[_0x26a906];return _0x495575;};'use strict';var _=require('lodash');var moment=require(_0x2f46('0x0'));var parser=require(_0x2f46('0x1'));var util=require(_0x2f46('0x2'));var logger=require(_0x2f46('0x3'))(_0x2f46('0x4'));var rpc=require(_0x2f46('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x2f46('0x6'));var Vertices=require(_0x2f46('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2f46('0x8')]()['catch'](function(_0x8efd68){logger[_0x2f46('0x9')](_0x2f46('0xa'),_0x8efd68['stack']);return[];});}function addVertex(_0xce4152,_0xa3b28d,_0x4894a7){_0xa3b28d[_0x2f46('0xb')]=_0x4894a7;if(_0xa3b28d[_0x2f46('0xc')](_0x2f46('0xd'))){_0xa3b28d['maxRetry']=parseInt(_0xa3b28d[_0x2f46('0xd')],0xa);}_0xce4152[_0x2f46('0xe')](_[_0x2f46('0xf')](_0xa3b28d,_0x2f46('0x10')));}function initGraph(_0x1cee95,_0x293d3f){var _0x4f13f4=new Graph();for(var _0x47fc31 in _0x1cee95){if(_0x1cee95[_0x2f46('0xc')](_0x47fc31)){if(_[_0x2f46('0x11')](_0x1cee95[_0x47fc31])){for(var _0x17cd03=0x0;_0x17cd03<_0x1cee95[_0x47fc31][_0x2f46('0x12')];_0x17cd03+=0x1){addVertex(_0x4f13f4,_0x1cee95[_0x47fc31][_0x17cd03],_0x47fc31);}}else{addVertex(_0x4f13f4,_0x1cee95[_0x47fc31],_0x47fc31);}}}for(var _0x25f60e=0x0;_0x25f60e<_0x293d3f[_0x2f46('0x12')];_0x25f60e+=0x1){if(_0x293d3f[_0x25f60e][_0x2f46('0x13')]&&_0x293d3f[_0x25f60e][_0x2f46('0x14')]){_0x4f13f4['addEdge'](_0x293d3f[_0x25f60e][_0x2f46('0x13')],_0x293d3f[_0x25f60e][_0x2f46('0x14')],_0x293d3f[_0x25f60e][_0x2f46('0x15')]);}}return _0x4f13f4;}function getRoot(_0xf3f9c0){return parser[_0x2f46('0x16')](_0xf3f9c0,{'object':!![]})[_0x2f46('0x17')][_0x2f46('0x18')];}function inspect(_0x3dd41d){return util[_0x2f46('0x19')](_0x3dd41d,{'showHidden':![],'depth':null});}function initialize(_0x544c83,_0x5af25d){var _0x59e053=getRoot(_0x544c83[_0x2f46('0x1a')]);if(!_0x59e053||!_0x59e053[_0x2f46('0x1b')])return;var _0x2f9d94,_0x46e79a,_0x20e222;logger[_0x2f46('0x1c')]('root',JSON[_0x2f46('0x1d')](_0x59e053,null,0x2));_0x5af25d[_0x2f46('0x1e')]=moment()[_0x2f46('0x1f')](_0x2f46('0x20'));_0x2f9d94=initGraph(_[_0x2f46('0xf')](_0x59e053,_0x2f46('0x10')),_0x59e053[_0x2f46('0x10')]);_0x46e79a=new Vertices(_0x5af25d,rpc,mailRpc);logger[_0x2f46('0x21')](util[_0x2f46('0x1f')](_0x2f46('0x22'),_0x5af25d[_0x2f46('0x23')],_0x5af25d[_0x2f46('0x24')],_0x5af25d[_0x2f46('0x25')],_0x5af25d[_0x2f46('0x26')],_0x5af25d['uniqueid']));_0x2f9d94[_0x2f46('0x27')](_0x59e053[_0x2f46('0x1b')]['id'],function(_0x49680c){try{_0x49680c=_0x46e79a['clear'](_0x49680c);logger['debug'](_0x2f46('0x28'),JSON[_0x2f46('0x1d')](_0x49680c,null,0x2));if(_0x49680c[_0x2f46('0xb')]==='gotoc'){logger[_0x2f46('0x21')](_0x2f46('0x29'));_0x5af25d[_0x2f46('0x2a')]=_0x49680c[_0x2f46('0x2a')]||_0x5af25d['context'];_0x5af25d[_0x2f46('0x2b')]=_0x49680c[_0x2f46('0x2b')];_0x5af25d[_0x2f46('0x2c')]=_0x49680c[_0x2f46('0x2c')]?_0x49680c[_0x2f46('0x2c')]-0x1:0x1;return null;}else if(_0x49680c&&_0x46e79a[_0x49680c[_0x2f46('0xb')]]){_0x20e222=_0x46e79a[_0x49680c['agicommand']](_0x49680c);logger['info']('response',JSON[_0x2f46('0x1d')](_0x20e222,null,0x2));if(_0x20e222&&_0x20e222[_0x2f46('0x2d')]===AGI_CODE_SUCCESS&&_0x20e222[_0x2f46('0x2e')]!==AGI_RESULT_ERROR&&!_0x5af25d[_0x2f46('0x2f')]){logger[_0x2f46('0x1c')](_0x2f46('0x30'),inspect(_0x20e222));return _['isUndefined'](_0x20e222[_0x2f46('0x2e')])?null:_0x20e222['result'][_0x2f46('0x31')]();}else{logger[_0x2f46('0x9')](_0x2f46('0x30'),inspect(_0x20e222));return null;}}else{logger[_0x2f46('0x9')](_0x2f46('0x32'));return null;}}catch(_0x4bcdd6){logger['error'](_0x4bcdd6[_0x2f46('0x33')]);return null;}});if(_0x59e053['finally']){logger[_0x2f46('0x21')](util[_0x2f46('0x1f')](_0x2f46('0x34'),_0x5af25d[_0x2f46('0x23')],_0x5af25d['calleridname'],_0x5af25d['callerid'],_0x5af25d[_0x2f46('0x26')],_0x5af25d[_0x2f46('0x35')]));_0x2f9d94['traverseBFS'](_0x59e053[_0x2f46('0x36')]['id'],function(_0x442e35){try{_0x442e35=_0x46e79a['clear'](_0x442e35);logger[_0x2f46('0x1c')]('vertex',JSON[_0x2f46('0x1d')](_0x442e35,null,0x2));if(_0x442e35&&_0x46e79a[_0x442e35[_0x2f46('0xb')]]){_0x20e222=_0x46e79a[_0x442e35['agicommand']](_0x442e35);if(_0x20e222){logger['debug'](_0x2f46('0x30'),inspect(_0x20e222));return _[_0x2f46('0x37')](_0x20e222[_0x2f46('0x2e')])?null:_0x20e222[_0x2f46('0x2e')]['toString']();}else{logger[_0x2f46('0x9')](_0x2f46('0x30'),inspect(_0x20e222));return null;}}else{logger[_0x2f46('0x9')](_0x2f46('0x32'));return null;}}catch(_0x3159c4){logger['error'](_0x3159c4[_0x2f46('0x33')]);return null;}});}logger[_0x2f46('0x21')](util[_0x2f46('0x1f')](_0x2f46('0x38'),_0x5af25d[_0x2f46('0x23')],_0x5af25d[_0x2f46('0x24')],_0x5af25d['callerid'],_0x5af25d[_0x2f46('0x26')],_0x5af25d[_0x2f46('0x35')]));logger['info'](util[_0x2f46('0x1f')](_0x2f46('0x39'),_0x5af25d['context'],_0x5af25d['extension'],parseInt(_0x5af25d[_0x2f46('0x2c')],0xa)+0x1));_0x5af25d[_0x2f46('0x3a')](_0x5af25d[_0x2f46('0x2a')],_0x5af25d[_0x2f46('0x2b')],parseInt(_0x5af25d['priority'],0xa)+0x1);_0x5af25d['close']();}function handleNotFound(_0x3864a3){logger['error'](util[_0x2f46('0x1f')](_0x2f46('0x3b'),_0x3864a3[_0x2f46('0x23')]));_0x3864a3[_0x2f46('0x3a')](_0x3864a3[_0x2f46('0x2a')],_0x3864a3['extension'],parseInt(_0x3864a3[_0x2f46('0x2c')],0xa)+0x1);_0x3864a3[_0x2f46('0x3c')]();}function handleUnpublished(_0x21aa95){logger[_0x2f46('0x9')](util['format'](_0x2f46('0x3d'),_0x21aa95[_0x2f46('0x23')]));_0x21aa95[_0x2f46('0x3a')](_0x21aa95['context'],_0x21aa95[_0x2f46('0x2b')],parseInt(_0x21aa95[_0x2f46('0x2c')],0xa)+0x1);_0x21aa95[_0x2f46('0x3c')]();}module[_0x2f46('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xc39e=['isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','clear','stack','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','lodash','moment','util','../../config/logger','agi','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','isArray','length','source','target','addEdge','value','mxGraphModel','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','traverseBFS','debug','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response'];(function(_0x2da3fe,_0x55ad2d){var _0x564b34=function(_0x1c0510){while(--_0x1c0510){_0x2da3fe['push'](_0x2da3fe['shift']());}};_0x564b34(++_0x55ad2d);}(_0xc39e,0x1cd));var _0xec39=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xc39e[_0x3b4b1d];return _0x488c36;};'use strict';var _=require(_0xec39('0x0'));var moment=require(_0xec39('0x1'));var parser=require('xml2json');var util=require(_0xec39('0x2'));var logger=require(_0xec39('0x3'))(_0xec39('0x4'));var rpc=require('./rpc');var mailRpc=require(_0xec39('0x5'));var Graph=require(_0xec39('0x6'));var Vertices=require(_0xec39('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xec39('0x8')](function(_0x4eba7b){logger[_0xec39('0x9')](_0xec39('0xa'),_0x4eba7b['stack']);return[];});}function addVertex(_0x20eacd,_0x53aeff,_0x8f90bb){_0x53aeff[_0xec39('0xb')]=_0x8f90bb;if(_0x53aeff[_0xec39('0xc')]('retry')){_0x53aeff['maxRetry']=parseInt(_0x53aeff[_0xec39('0xd')],0xa);}_0x20eacd[_0xec39('0xe')](_['omit'](_0x53aeff,'mxCell'));}function initGraph(_0xa48427,_0x1fe8cc){var _0x341f43=new Graph();for(var _0x5f05fd in _0xa48427){if(_0xa48427[_0xec39('0xc')](_0x5f05fd)){if(_[_0xec39('0xf')](_0xa48427[_0x5f05fd])){for(var _0x51952f=0x0;_0x51952f<_0xa48427[_0x5f05fd][_0xec39('0x10')];_0x51952f+=0x1){addVertex(_0x341f43,_0xa48427[_0x5f05fd][_0x51952f],_0x5f05fd);}}else{addVertex(_0x341f43,_0xa48427[_0x5f05fd],_0x5f05fd);}}}for(var _0x28d702=0x0;_0x28d702<_0x1fe8cc[_0xec39('0x10')];_0x28d702+=0x1){if(_0x1fe8cc[_0x28d702][_0xec39('0x11')]&&_0x1fe8cc[_0x28d702][_0xec39('0x12')]){_0x341f43[_0xec39('0x13')](_0x1fe8cc[_0x28d702]['source'],_0x1fe8cc[_0x28d702][_0xec39('0x12')],_0x1fe8cc[_0x28d702][_0xec39('0x14')]);}}return _0x341f43;}function getRoot(_0x228065){return parser['toJson'](_0x228065,{'object':!![]})[_0xec39('0x15')]['root'];}function inspect(_0x4035ca){return util['inspect'](_0x4035ca,{'showHidden':![],'depth':null});}function initialize(_0x46279d,_0x5f1e1a){var _0x50550d=getRoot(_0x46279d[_0xec39('0x16')]);if(!_0x50550d||!_0x50550d[_0xec39('0x17')])return;var _0x3b2593,_0x58ebbd,_0x443309;logger['debug']('root',JSON[_0xec39('0x18')](_0x50550d,null,0x2));_0x5f1e1a[_0xec39('0x19')]=moment()['format'](_0xec39('0x1a'));_0x3b2593=initGraph(_[_0xec39('0x1b')](_0x50550d,_0xec39('0x1c')),_0x50550d[_0xec39('0x1c')]);_0x58ebbd=new Vertices(_0x5f1e1a,rpc,mailRpc);logger[_0xec39('0x1d')](util[_0xec39('0x1e')](_0xec39('0x1f'),_0x5f1e1a[_0xec39('0x20')],_0x5f1e1a[_0xec39('0x21')],_0x5f1e1a[_0xec39('0x22')],_0x5f1e1a['dnid'],_0x5f1e1a['uniqueid']));_0x3b2593[_0xec39('0x23')](_0x50550d[_0xec39('0x17')]['id'],function(_0x1ef301){try{_0x1ef301=_0x58ebbd['clear'](_0x1ef301);logger[_0xec39('0x24')]('vertex',JSON[_0xec39('0x18')](_0x1ef301,null,0x2));if(_0x1ef301[_0xec39('0xb')]===_0xec39('0x25')){logger[_0xec39('0x1d')](_0xec39('0x26'));_0x5f1e1a[_0xec39('0x27')]=_0x1ef301[_0xec39('0x27')]||_0x5f1e1a[_0xec39('0x27')];_0x5f1e1a[_0xec39('0x28')]=_0x1ef301[_0xec39('0x28')];_0x5f1e1a[_0xec39('0x29')]=_0x1ef301[_0xec39('0x29')]?_0x1ef301[_0xec39('0x29')]-0x1:0x1;return null;}else if(_0x1ef301&&_0x58ebbd[_0x1ef301[_0xec39('0xb')]]){_0x443309=_0x58ebbd[_0x1ef301[_0xec39('0xb')]](_0x1ef301);logger[_0xec39('0x1d')]('response',JSON['stringify'](_0x443309,null,0x2));if(_0x443309&&_0x443309['code']===AGI_CODE_SUCCESS&&_0x443309['result']!==AGI_RESULT_ERROR&&!_0x5f1e1a['evtHangup']){logger[_0xec39('0x24')](_0xec39('0x2a'),inspect(_0x443309));return _[_0xec39('0x2b')](_0x443309[_0xec39('0x2c')])?null:_0x443309[_0xec39('0x2c')][_0xec39('0x2d')]();}else{logger[_0xec39('0x9')](_0xec39('0x2a'),inspect(_0x443309));return null;}}else{logger['error'](_0xec39('0x2e'));return null;}}catch(_0x32fc79){logger[_0xec39('0x9')](_0x32fc79['stack']);return null;}});if(_0x50550d[_0xec39('0x2f')]){logger[_0xec39('0x1d')](util[_0xec39('0x1e')](_0xec39('0x30'),_0x5f1e1a['arg_1'],_0x5f1e1a[_0xec39('0x21')],_0x5f1e1a[_0xec39('0x22')],_0x5f1e1a[_0xec39('0x31')],_0x5f1e1a[_0xec39('0x32')]));_0x3b2593[_0xec39('0x23')](_0x50550d[_0xec39('0x2f')]['id'],function(_0x4b85c3){try{_0x4b85c3=_0x58ebbd[_0xec39('0x33')](_0x4b85c3);logger[_0xec39('0x24')]('vertex',JSON[_0xec39('0x18')](_0x4b85c3,null,0x2));if(_0x4b85c3&&_0x58ebbd[_0x4b85c3[_0xec39('0xb')]]){_0x443309=_0x58ebbd[_0x4b85c3[_0xec39('0xb')]](_0x4b85c3);if(_0x443309){logger[_0xec39('0x24')](_0xec39('0x2a'),inspect(_0x443309));return _['isUndefined'](_0x443309[_0xec39('0x2c')])?null:_0x443309[_0xec39('0x2c')][_0xec39('0x2d')]();}else{logger[_0xec39('0x9')](_0xec39('0x2a'),inspect(_0x443309));return null;}}else{logger[_0xec39('0x9')](_0xec39('0x2e'));return null;}}catch(_0x1cb31f){logger[_0xec39('0x9')](_0x1cb31f[_0xec39('0x34')]);return null;}});}logger[_0xec39('0x1d')](util[_0xec39('0x1e')](_0xec39('0x35'),_0x5f1e1a['arg_1'],_0x5f1e1a['calleridname'],_0x5f1e1a[_0xec39('0x22')],_0x5f1e1a[_0xec39('0x31')],_0x5f1e1a[_0xec39('0x32')]));logger[_0xec39('0x1d')](util[_0xec39('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5f1e1a[_0xec39('0x27')],_0x5f1e1a[_0xec39('0x28')],parseInt(_0x5f1e1a['priority'],0xa)+0x1));_0x5f1e1a[_0xec39('0x36')](_0x5f1e1a['context'],_0x5f1e1a[_0xec39('0x28')],parseInt(_0x5f1e1a['priority'],0xa)+0x1);_0x5f1e1a[_0xec39('0x37')]();}function handleNotFound(_0x1fa7a8){logger['error'](util[_0xec39('0x1e')]('Project\x20%s\x20not\x20found',_0x1fa7a8[_0xec39('0x20')]));_0x1fa7a8['continueAt'](_0x1fa7a8[_0xec39('0x27')],_0x1fa7a8[_0xec39('0x28')],parseInt(_0x1fa7a8[_0xec39('0x29')],0xa)+0x1);_0x1fa7a8[_0xec39('0x37')]();}function handleUnpublished(_0x4a5387){logger['error'](util[_0xec39('0x1e')]('Project\x20%s\x20not\x20published',_0x4a5387['arg_1']));_0x4a5387[_0xec39('0x36')](_0x4a5387[_0xec39('0x27')],_0x4a5387['extension'],parseInt(_0x4a5387['priority'],0xa)+0x1);_0x4a5387[_0xec39('0x37')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index cf797b3..dd49736 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 _0x32e6=['trim','emit','headers','line','util','stream','Transform','call','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','_localBuffer','indexOf','substring','length','split','slice'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x32e6,0x82));var _0x632e=function(_0x2cf84d,_0x2cba31){_0x2cf84d=_0x2cf84d-0x0;var _0x38bf07=_0x32e6[_0x2cf84d];return _0x38bf07;};'use strict';var util=require(_0x632e('0x0'));var Transform=require(_0x632e('0x1'))[_0x632e('0x2')];function AGIReply(_0x4431e8){Transform[_0x632e('0x3')](this,_0x4431e8);this['_localBuffer']='';this[_0x632e('0x4')]=![];}util[_0x632e('0x5')](AGIReply,Transform);AGIReply[_0x632e('0x6')]['_transform']=function(_0xd3dceb,_0x297a1c,_0x1abc27){var _0x1d2800='\x0a',_0x40411d=['\x0a\x0a',_0x632e('0x7')],_0x11dea4=-0x1,_0x25e6a7=-0x1,_0x4665a5='',_0x541db6=0x0,_0x404ca6='',_0x32b732='';this['_localBuffer']+=_0xd3dceb['toString']();_0x404ca6=this[_0x632e('0x8')];if(!this[_0x632e('0x4')]){_0x541db6=0x0;while(_0x40411d[_0x541db6]){while((_0x25e6a7=_0x404ca6[_0x632e('0x9')](_0x40411d[_0x541db6]))!=-0x1){_0x4665a5=_0x40411d[_0x541db6];_0x32b732=_0x404ca6[_0x632e('0xa')](0x0,_0x25e6a7);_0x404ca6=_0x404ca6[_0x632e('0xa')](_0x25e6a7+_0x4665a5[_0x632e('0xb')]);var _0x5e0d62=_0x32b732[_0x632e('0xc')](_0x1d2800),_0xb08890=0x0,_0x5d005a={},_0x2690d3='',_0x264195='',_0xceffee=-0x1;while(_0x5e0d62[_0xb08890]){_0xceffee=_0x5e0d62[_0xb08890][_0x632e('0x9')](':');if(_0xceffee!=-0x1){_0x2690d3=_0x5e0d62[_0xb08890][_0x632e('0xd')](0x0,_0xceffee)['trim']();_0x264195=_0x5e0d62[_0xb08890][_0x632e('0xd')](_0xceffee+0x1)[_0x632e('0xe')]();if(_0x2690d3['length']>0x0){_0x5d005a[_0x2690d3]=_0x264195;}}else{}_0xb08890++;}this[_0x632e('0xf')](_0x632e('0x10'),_0x5d005a);this[_0x632e('0x4')]=!![];}_0x541db6++;}this[_0x632e('0x8')]=_0x404ca6;}else{while((_0x11dea4=_0x404ca6[_0x632e('0x9')](_0x1d2800))!=-0x1){_0x32b732=_0x404ca6['substring'](0x0,_0x11dea4);this[_0x632e('0xf')](_0x632e('0x11'),_0x32b732);_0x404ca6=_0x404ca6['substring'](_0x11dea4+_0x1d2800[_0x632e('0xb')]);}this['_localBuffer']=_0x404ca6;}_0x1abc27();};module['exports']=AGIReply; \ No newline at end of file +var _0x3c8e=['split','slice','trim','emit','line','util','stream','Transform','_inBody','inherits','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length'];(function(_0x66fdfd,_0x32389f){var _0x2d4f54=function(_0x2699f9){while(--_0x2699f9){_0x66fdfd['push'](_0x66fdfd['shift']());}};_0x2d4f54(++_0x32389f);}(_0x3c8e,0x65));var _0xe3c8=function(_0x48c870,_0x1cfae7){_0x48c870=_0x48c870-0x0;var _0x421a2d=_0x3c8e[_0x48c870];return _0x421a2d;};'use strict';var util=require(_0xe3c8('0x0'));var Transform=require(_0xe3c8('0x1'))[_0xe3c8('0x2')];function AGIReply(_0x117b59){Transform['call'](this,_0x117b59);this['_localBuffer']='';this[_0xe3c8('0x3')]=![];}util[_0xe3c8('0x4')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x4ebb94,_0x27e556,_0x1bb709){var _0xd7292b='\x0a',_0x2eca95=['\x0a\x0a',_0xe3c8('0x5')],_0x3091ce=-0x1,_0x505744=-0x1,_0x46cd46='',_0x93a4b7=0x0,_0x50227d='',_0x32b573='';this[_0xe3c8('0x6')]+=_0x4ebb94[_0xe3c8('0x7')]();_0x50227d=this[_0xe3c8('0x6')];if(!this['_inBody']){_0x93a4b7=0x0;while(_0x2eca95[_0x93a4b7]){while((_0x505744=_0x50227d[_0xe3c8('0x8')](_0x2eca95[_0x93a4b7]))!=-0x1){_0x46cd46=_0x2eca95[_0x93a4b7];_0x32b573=_0x50227d['substring'](0x0,_0x505744);_0x50227d=_0x50227d[_0xe3c8('0x9')](_0x505744+_0x46cd46[_0xe3c8('0xa')]);var _0x2d29eb=_0x32b573[_0xe3c8('0xb')](_0xd7292b),_0x24687b=0x0,_0x511572={},_0x29d174='',_0x46ea3e='',_0x55b9e1=-0x1;while(_0x2d29eb[_0x24687b]){_0x55b9e1=_0x2d29eb[_0x24687b][_0xe3c8('0x8')](':');if(_0x55b9e1!=-0x1){_0x29d174=_0x2d29eb[_0x24687b][_0xe3c8('0xc')](0x0,_0x55b9e1)['trim']();_0x46ea3e=_0x2d29eb[_0x24687b][_0xe3c8('0xc')](_0x55b9e1+0x1)[_0xe3c8('0xd')]();if(_0x29d174[_0xe3c8('0xa')]>0x0){_0x511572[_0x29d174]=_0x46ea3e;}}else{}_0x24687b++;}this[_0xe3c8('0xe')]('headers',_0x511572);this[_0xe3c8('0x3')]=!![];}_0x93a4b7++;}this[_0xe3c8('0x6')]=_0x50227d;}else{while((_0x3091ce=_0x50227d[_0xe3c8('0x8')](_0xd7292b))!=-0x1){_0x32b573=_0x50227d[_0xe3c8('0x9')](0x0,_0x3091ce);this[_0xe3c8('0xe')](_0xe3c8('0xf'),_0x32b573);_0x50227d=_0x50227d[_0xe3c8('0x9')](_0x3091ce+_0xd7292b['length']);}this[_0xe3c8('0x6')]=_0x50227d;}_0x1bb709();};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 10b664d..aec0f21 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 _0x25b5=['CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','catch','getSquareProjects','name','production','getSquareProject','ShowMailAccount','Smtp','CloudProvider','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','GetContactByPhone','phone','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createCmContact','ShowCmHopper'];(function(_0x11de96,_0x3b172b){var _0x26d213=function(_0x178662){while(--_0x178662){_0x11de96['push'](_0x11de96['shift']());}};_0x26d213(++_0x3b172b);}(_0x25b5,0x198));var _0x525b=function(_0x1271c0,_0x2b8ed4){_0x1271c0=_0x1271c0-0x0;var _0x355b93=_0x25b5[_0x1271c0];return _0x355b93;};'use strict';var _=require(_0x525b('0x0'));var moment=require(_0x525b('0x1'));var jayson=require(_0x525b('0x2'));var client=jayson[_0x525b('0x3')][_0x525b('0x4')]({'port':0x2329});function request(_0x55c204,_0x1086a1){return new Promise(function(_0x59aba3,_0xae34c2){return client[_0x525b('0x5')](_0x55c204,_0x1086a1)[_0x525b('0x6')](function(_0x5eca98){if(_0x5eca98['error']){return _0xae34c2(_0x5eca98[_0x525b('0x7')]['message']);}else{return _0x59aba3(_0x5eca98['result']);}})[_0x525b('0x8')](function(_0x3ef6f1){return _0xae34c2(_0x3ef6f1);});});}exports[_0x525b('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x525b('0xa'),_0x525b('0xb')]}});};exports[_0x525b('0xc')]=function(_0x535dd9){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x535dd9},'attributes':['production']}});};exports['getMailAccountById']=function(_0x27ce0f){return request(_0x525b('0xd'),{'options':{'raw':![],'where':{'id':_0x27ce0f},'include':[{'model':'MailServerOut','as':_0x525b('0xe'),'include':[{'model':_0x525b('0xf'),'as':_0x525b('0xf')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x525b('0x10')]=function(_0x1af427){return request(_0x525b('0x11'),{'options':{'where':{'id':_0x1af427},'attributes':[_0x525b('0xa')]}});};exports[_0x525b('0x12')]=function(_0x3897d5){return request(_0x525b('0x13'),{'options':{'where':{'id':_0x3897d5},'attributes':[_0x525b('0xa')]}});};exports[_0x525b('0x14')]=function(_0x28de50){return request(_0x525b('0x15'),{'options':{'where':{'id':_0x28de50},'attributes':['name']}});};exports[_0x525b('0x16')]=function(_0x170e3e){return request(_0x525b('0x17'),{'options':{'where':{'id':_0x170e3e},'attributes':['dsn']}});};exports['getUserById']=function(_0x43b941){return request(_0x525b('0x18'),{'options':{'where':{'id':_0x43b941},'attributes':[_0x525b('0xa')]}});};exports['getContactByPhone']=function(_0x19eabd){return request(_0x525b('0x19'),{'options':{'where':{'phone':_0x19eabd[_0x525b('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x4db72e){return request('ShowTrunk',{'options':{'where':{'id':_0x4db72e},'attributes':[_0x525b('0xa')]}});};exports[_0x525b('0x1b')]=function(_0xd93a42){return request(_0x525b('0x1c'),{'options':{'where':{'id':_0xd93a42},'attributes':[_0x525b('0x1d')]}});};exports[_0x525b('0x1e')]=function(_0x41ad32){return request(_0x525b('0x1f'),{'options':{'raw':![],'where':{'id':_0x41ad32},'include':[{'model':_0x525b('0x20'),'as':'Intervals'}]}});};exports[_0x525b('0x21')]=function(_0x3357a7){return request(_0x525b('0x22'),{'options':{'where':{'id':_0x3357a7},'attributes':['id','name']}});};exports[_0x525b('0x23')]=function(_0x29b5dc){return request(_0x525b('0x24'),{'body':_0x29b5dc});};exports['createSquareDetailsReport']=function(_0x497ca8){return request(_0x525b('0x25'),{'body':_0x497ca8});};exports[_0x525b('0x26')]=function(_0x1f22f8){return request(_0x525b('0x27'),{'body':_[_0x525b('0x28')](_0x1f22f8,{'project_name':_0x1f22f8[_0x525b('0x29')],'prev_project_name':_0x1f22f8[_0x525b('0x2a')]||'','is_subproject':_0x1f22f8[_0x525b('0x2a')]?!![]:![],'leaveAt':moment()[_0x525b('0x2b')](_0x525b('0x2c'))})});};exports[_0x525b('0x2d')]=function(_0x3448e7){return request('CreateSquareRecording',{'body':_0x3448e7});};exports['createSquareMessage']=function(_0x42a8ad){return request('CreateSquareMessage',{'body':_0x42a8ad});};exports[_0x525b('0x2e')]=function(_0x23a248){return request(_0x525b('0x2f'),{'options':{'raw':![],'where':{'phone':_0x23a248['phone'],'ListId':_0x23a248['ListId']}}})[_0x525b('0x6')](function(_0x3b2029){if(_0x3b2029){return _0x3b2029;}return request(_0x525b('0x30'),{'body':_0x23a248});});};exports[_0x525b('0x31')]=function(_0x268fb2){return request('ShowPause',{'options':{'where':{'id':_0x268fb2},'attributes':[_0x525b('0xa')]}});};exports[_0x525b('0x32')]=function(_0x642eb1,_0x5c1791){return request(_0x525b('0x33'),{'body':{'interface':_0x5c1791},'options':{'where':_0x642eb1}});};exports[_0x525b('0x34')]=function(_0x2ebdf3,_0x3abc26,_0x1319d7){return request(_0x525b('0x35'),{'body':{'type':_0x3abc26,'uniqueid':_0x1319d7},'options':{'where':_0x2ebdf3}});};exports['agentUnpause']=function(_0x417bf3){return request(_0x525b('0x36'),{'body':{},'options':{'where':_0x417bf3}});};exports[_0x525b('0x37')]=function(_0x3b00bc){return request(_0x525b('0x38'),{'body':{},'options':{'where':_0x3b00bc}});}; \ No newline at end of file +var _0x92e8=['phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentLogout','LogoutUser','lodash','client','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage'];(function(_0x2a4835,_0xbafeda){var _0x38dc52=function(_0x338c36){while(--_0x338c36){_0x2a4835['push'](_0x2a4835['shift']());}};_0x38dc52(++_0xbafeda);}(_0x92e8,0x7f));var _0x892e=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x92e8[_0x4d45c1];return _0x244478;};'use strict';var _=require(_0x892e('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0x892e('0x1')]['http']({'port':0x2329});function request(_0x232414,_0x35184e){return new Promise(function(_0x2cb68f,_0xe95e5f){return client[_0x892e('0x2')](_0x232414,_0x35184e)[_0x892e('0x3')](function(_0x547350){if(_0x547350[_0x892e('0x4')]){return _0xe95e5f(_0x547350['error'][_0x892e('0x5')]);}else{return _0x2cb68f(_0x547350['result']);}})[_0x892e('0x6')](function(_0x5bfa77){return _0xe95e5f(_0x5bfa77);});});}exports[_0x892e('0x7')]=function(){return request(_0x892e('0x8'),{'options':{'raw':![],'attributes':['id',_0x892e('0x9'),'production']}});};exports[_0x892e('0xa')]=function(_0x211bbf){return request(_0x892e('0xb'),{'options':{'raw':![],'where':{'name':_0x211bbf},'attributes':[_0x892e('0xc')]}});};exports[_0x892e('0xd')]=function(_0x5c5ef4){return request(_0x892e('0xe'),{'options':{'raw':![],'where':{'id':_0x5c5ef4},'include':[{'model':_0x892e('0xf'),'as':_0x892e('0x10'),'include':[{'model':'CloudProvider','as':_0x892e('0x11')}]}],'attributes':['id','name',_0x892e('0x12')],'smtp':!![]}});};exports[_0x892e('0x13')]=function(_0x20fe60){return request(_0x892e('0xb'),{'options':{'where':{'id':_0x20fe60},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x14')]=function(_0x2f727e){return request(_0x892e('0x15'),{'options':{'where':{'id':_0x2f727e},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x16')]=function(_0xbd35a5){return request('ShowVariable',{'options':{'where':{'id':_0xbd35a5},'attributes':[_0x892e('0x9')]}});};exports['getSquareOdbcById']=function(_0x1ff7f3){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1ff7f3},'attributes':['dsn']}});};exports[_0x892e('0x17')]=function(_0x111ee2){return request(_0x892e('0x18'),{'options':{'where':{'id':_0x111ee2},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x19')]=function(_0x628dc2){return request(_0x892e('0x1a'),{'options':{'where':{'phone':_0x628dc2['phone']},'attributes':['id']}});};exports[_0x892e('0x1b')]=function(_0x31cc52){return request(_0x892e('0x1c'),{'options':{'where':{'id':_0x31cc52},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x1d')]=function(_0xc7c673){return request(_0x892e('0x1e'),{'options':{'where':{'id':_0xc7c673},'attributes':[_0x892e('0x1f')]}});};exports[_0x892e('0x20')]=function(_0x3c29b7){return request(_0x892e('0x21'),{'options':{'raw':![],'where':{'id':_0x3c29b7},'include':[{'model':_0x892e('0x22'),'as':_0x892e('0x23')}]}});};exports['getSmsAccountById']=function(_0x49de36){return request(_0x892e('0x24'),{'options':{'where':{'id':_0x49de36},'attributes':['id',_0x892e('0x9')]}});};exports[_0x892e('0x25')]=function(_0x5aacac){return request(_0x892e('0x26'),{'body':_0x5aacac});};exports[_0x892e('0x27')]=function(_0x697285){return request('CreateSquareDetailsReport',{'body':_0x697285});};exports[_0x892e('0x28')]=function(_0x559c34){return request('CreateSquareReport',{'body':_['merge'](_0x559c34,{'project_name':_0x559c34[_0x892e('0x29')],'prev_project_name':_0x559c34[_0x892e('0x2a')]||'','is_subproject':_0x559c34[_0x892e('0x2a')]?!![]:![],'leaveAt':moment()[_0x892e('0x2b')](_0x892e('0x2c'))})});};exports['createSquareRecording']=function(_0x5bf238){return request(_0x892e('0x2d'),{'body':_0x5bf238});};exports[_0x892e('0x2e')]=function(_0x471abd){return request('CreateSquareMessage',{'body':_0x471abd});};exports['createCmContact']=function(_0x1fac3c){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1fac3c[_0x892e('0x2f')],'ListId':_0x1fac3c[_0x892e('0x30')]}}})['then'](function(_0x54f1eb){if(_0x54f1eb){return _0x54f1eb;}return request(_0x892e('0x31'),{'body':_0x1fac3c});});};exports[_0x892e('0x32')]=function(_0x561721){return request(_0x892e('0x33'),{'options':{'where':{'id':_0x561721},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x34')]=function(_0x3a6350,_0x2fa776){return request(_0x892e('0x35'),{'body':{'interface':_0x2fa776},'options':{'where':_0x3a6350}});};exports[_0x892e('0x36')]=function(_0xb6c376,_0x350148,_0x40fa3){return request(_0x892e('0x37'),{'body':{'type':_0x350148,'uniqueid':_0x40fa3},'options':{'where':_0xb6c376}});};exports['agentUnpause']=function(_0x573f7c){return request('UnpauseUser',{'body':{},'options':{'where':_0x573f7c}});};exports[_0x892e('0x38')]=function(_0xa0cbaa){return request(_0x892e('0x39'),{'body':{},'options':{'where':_0xa0cbaa}});}; \ 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 a69942c..8332839 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 _0xa647=['./polly','./lex','exports'];(function(_0x2b7520,_0x21098c){var _0xf91023=function(_0x1fee4e){while(--_0x1fee4e){_0x2b7520['push'](_0x2b7520['shift']());}};_0xf91023(++_0x21098c);}(_0xa647,0x81));var _0x7a64=function(_0x33c54e,_0xce27e0){_0x33c54e=_0x33c54e-0x0;var _0xd90453=_0xa647[_0x33c54e];return _0xd90453;};var polly=require(_0x7a64('0x0'));var lex=require(_0x7a64('0x1'));module[_0x7a64('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xfd6e=['./polly','exports'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd6e[_0x3dd15e];return _0x231fd0;};var polly=require(_0xefd6('0x0'));var lex=require('./lex');module[_0xefd6('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 9dfb070..d6d1f96 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 _0x4483=['exports','./lib/api'];(function(_0x53079f,_0x208f73){var _0x14ef16=function(_0x5337da){while(--_0x5337da){_0x53079f['push'](_0x53079f['shift']());}};_0x14ef16(++_0x208f73);}(_0x4483,0x1a3));var _0x3448=function(_0x4739e0,_0x3aa890){_0x4739e0=_0x4739e0-0x0;var _0x2ca372=_0x4483[_0x4739e0];return _0x2ca372;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file +var _0xf109=['./lib/api','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf109,0xce));var _0x9f10=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xf109[_0xbf8ebe];return _0x1e25e8;};'use strict';var lex=require(_0x9f10('0x0'));module[_0x9f10('0x1')]=function(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517){return lex(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 7041917..781fb02 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(_0x40fb00,_0x4da8f6){var _0x31754c=function(_0x198a46){while(--_0x198a46){_0x40fb00['push'](_0x40fb00['shift']());}};_0x31754c(++_0x4da8f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x4b5ef8,_0x463086){var _0x20b85c=function(_0x5ddbe8){while(--_0x5ddbe8){_0x4b5ef8['push'](_0x4b5ef8['shift']());}};_0x20b85c(++_0x463086);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 d8c98a2..2360603 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 _0xafbf=['exports','./lib/api'];(function(_0x37bfce,_0x4fc123){var _0x24bc5d=function(_0x2e3e81){while(--_0x2e3e81){_0x37bfce['push'](_0x37bfce['shift']());}};_0x24bc5d(++_0x4fc123);}(_0xafbf,0x113));var _0xfafb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xafbf[_0x1facfa];return _0x9ec701;};'use strict';var polly=require(_0xfafb('0x0'));module[_0xfafb('0x1')]=function(_0x87306e,_0x33738b,_0x487923,_0x5bd96f,_0x38a955,_0x11c968,_0x44e21a){return polly(_0x87306e,_0x33738b,_0x487923,_0x5bd96f,_0x38a955,_0x11c968,_0x44e21a);}; \ No newline at end of file +var _0x4500=['./lib/api','exports'];(function(_0x6fae81,_0x9c46c4){var _0x263615=function(_0x3794f1){while(--_0x3794f1){_0x6fae81['push'](_0x6fae81['shift']());}};_0x263615(++_0x9c46c4);}(_0x4500,0x18a));var _0x0450=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0x4500[_0x137da3];return _0x1ac46c;};'use strict';var polly=require(_0x0450('0x0'));module[_0x0450('0x1')]=function(_0x24bb5e,_0x17512,_0x79657b,_0x24cbf5,_0x554da6,_0x1e3a70,_0x14eab3){return polly(_0x24bb5e,_0x17512,_0x79657b,_0x24cbf5,_0x554da6,_0x1e3a70,_0x14eab3);}; \ 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 93427c0..dcc381d 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 _0x82fb=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x130c64,_0x24ce68){var _0x59d57e=function(_0x2af67f){while(--_0x2af67f){_0x130c64['push'](_0x130c64['shift']());}};_0x59d57e(++_0x24ce68);}(_0x82fb,0xab));var _0xb82f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x82fb[_0x413feb];return _0x40ee88;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xb82f('0x0'));var rs=require(_0xb82f('0x1'));var AWS=require(_0xb82f('0x2'));function pollyResult(_0x190284,_0x137097,_0x883930){return new BPromise(function(_0x404afc,_0x18e637){_0x190284[_0xb82f('0x3')](_0x137097,function(_0x4a50a3,_0x3944de){if(_0x4a50a3){_0x18e637(_0x4a50a3);}else if(_0x3944de){if(_0x3944de['AudioStream']instanceof Buffer){fs[_0xb82f('0x4')](_0x883930,_0x3944de[_0xb82f('0x5')],function(_0x35828a){if(_0x35828a){_0x18e637(_0x35828a);}else{_0x404afc();}});}else{_0x18e637(new Error(_0xb82f('0x6')));}}else{_0x18e637(new Error(_0xb82f('0x7')));}});});}module['exports']=function(_0x1144b7,_0x33ea9d,_0x499618,_0x49c4ac,_0x469dea,_0x1e8d16,_0x11b384){var _0x1d66c6=new AWS[(_0xb82f('0x8'))]({'accessKeyId':_0x1144b7,'secretAccessKey':_0x33ea9d,'region':_0x499618});var _0x1c6fb9={'Text':_0x469dea,'TextType':_0x1e8d16||_0xb82f('0x9'),'OutputFormat':_0xb82f('0xa'),'VoiceId':_0x49c4ac};return pollyResult(_0x1d66c6,_0x1c6fb9,_0x11b384);}; \ No newline at end of file +var _0x1e69=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird','randomstring','aws-sdk'];(function(_0x4094c5,_0x4b16ce){var _0x38e6bb=function(_0x4cec23){while(--_0x4cec23){_0x4094c5['push'](_0x4094c5['shift']());}};_0x38e6bb(++_0x4b16ce);}(_0x1e69,0xa5));var _0x91e6=function(_0x397f04,_0x2d9ef5){_0x397f04=_0x397f04-0x0;var _0x249786=_0x1e69[_0x397f04];return _0x249786;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x91e6('0x0'));var rs=require(_0x91e6('0x1'));var AWS=require(_0x91e6('0x2'));function pollyResult(_0x37235a,_0x3ee43b,_0xca856){return new BPromise(function(_0x3c61e7,_0x52bb7f){_0x37235a[_0x91e6('0x3')](_0x3ee43b,function(_0x2e1efb,_0x495130){if(_0x2e1efb){_0x52bb7f(_0x2e1efb);}else if(_0x495130){if(_0x495130[_0x91e6('0x4')]instanceof Buffer){fs[_0x91e6('0x5')](_0xca856,_0x495130[_0x91e6('0x4')],function(_0x42e255){if(_0x42e255){_0x52bb7f(_0x42e255);}else{_0x3c61e7();}});}else{_0x52bb7f(new Error(_0x91e6('0x6')));}}else{_0x52bb7f(new Error(_0x91e6('0x7')));}});});}module[_0x91e6('0x8')]=function(_0x353720,_0x6784d9,_0x527221,_0x2a2ab7,_0x343648,_0x3220f6,_0x4b9794){var _0x426e0e=new AWS[(_0x91e6('0x9'))]({'accessKeyId':_0x353720,'secretAccessKey':_0x6784d9,'region':_0x527221});var _0x2513e5={'Text':_0x343648,'TextType':_0x3220f6||_0x91e6('0xa'),'OutputFormat':_0x91e6('0xb'),'VoiceId':_0x2a2ab7};return pollyResult(_0x426e0e,_0x2513e5,_0x4b9794);}; \ 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 01086cf..db8b639 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 _0xaa38=['./lib/api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaa38,0xc0));var _0x8aa3=function(_0x596f83,_0x307d15){_0x596f83=_0x596f83-0x0;var _0x3bd2ca=_0xaa38[_0x596f83];return _0x3bd2ca;};'use strict';var asr=require(_0x8aa3('0x0'));module['exports']=function(_0x6a6d87,_0x4ab647,_0x481673,_0x5a8a03){return asr(_0x6a6d87,_0x4ab647,_0x481673);}; \ No newline at end of file +var _0x15d5=['./lib/api'];(function(_0x49e9e9,_0x40a4da){var _0x5a0fdd=function(_0x9ee675){while(--_0x9ee675){_0x49e9e9['push'](_0x49e9e9['shift']());}};_0x5a0fdd(++_0x40a4da);}(_0x15d5,0x1de));var _0x515d=function(_0x563594,_0x21e66e){_0x563594=_0x563594-0x0;var _0x41544d=_0x15d5[_0x563594];return _0x41544d;};'use strict';var asr=require(_0x515d('0x0'));module['exports']=function(_0x47f383,_0x29582a,_0x3b7702,_0x3aebfc){return asr(_0x47f383,_0x29582a,_0x3b7702);}; \ 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 ea5ee6c..2dbed27 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 _0x1152=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','base64','/v1/speech:recognize?key='];(function(_0x597d88,_0x4fb94c){var _0x553ae2=function(_0x45af54){while(--_0x45af54){_0x597d88['push'](_0x597d88['shift']());}};_0x553ae2(++_0x4fb94c);}(_0x1152,0x182));var _0x2115=function(_0x2567f0,_0x4fa60){_0x2567f0=_0x2567f0-0x0;var _0x14852a=_0x1152[_0x2567f0];return _0x14852a;};'use strict';var url=require(_0x2115('0x0'));var BPromise=require(_0x2115('0x1'));var fs=require('fs');var host=_0x2115('0x2');module[_0x2115('0x3')]=function(_0x20049f,_0x31ab3c,_0x31783d){return new BPromise(function(_0x3b8dfa,_0x4d0f31){var _0x1e8a26;if(typeof _0x20049f!=='string'||_0x20049f[_0x2115('0x4')]===0x0){return _0x4d0f31(_0x2115('0x5'));}if(typeof _0x31ab3c!=='string'||_0x31ab3c['length']===0x0){return _0x4d0f31('key\x20should\x20be\x20a\x20string');}if(typeof _0x31783d!=='undefined'&&(typeof _0x31783d!=='string'||_0x31783d[_0x2115('0x4')]===0x0)){return _0x4d0f31(_0x2115('0x6'));}try{_0x1e8a26=fs[_0x2115('0x7')](_0x20049f)['toString'](_0x2115('0x8'));}catch(_0x534958){return _0x4d0f31(_0x534958);}return _0x3b8dfa({'method':'POST','uri':host+_0x2115('0x9')+_0x31ab3c,'body':{'config':{'encoding':_0x2115('0xa'),'sampleRateHertz':_0x2115('0xb'),'languageCode':_0x31783d},'audio':{'content':_0x1e8a26}},'json':!![]});});}; \ No newline at end of file +var _0xee24=['LINEAR16','8000','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key='];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xee24,0x1a6));var _0x4ee2=function(_0xf878f4,_0x4bce12){_0xf878f4=_0xf878f4-0x0;var _0x3703bb=_0xee24[_0xf878f4];return _0x3703bb;};'use strict';var url=require('url');var BPromise=require(_0x4ee2('0x0'));var fs=require('fs');var host=_0x4ee2('0x1');module['exports']=function(_0x234b61,_0x4e09d3,_0x3ff71c){return new BPromise(function(_0x34b373,_0x5546e1){var _0x1aee89;if(typeof _0x234b61!==_0x4ee2('0x2')||_0x234b61[_0x4ee2('0x3')]===0x0){return _0x5546e1(_0x4ee2('0x4'));}if(typeof _0x4e09d3!=='string'||_0x4e09d3[_0x4ee2('0x3')]===0x0){return _0x5546e1(_0x4ee2('0x5'));}if(typeof _0x3ff71c!==_0x4ee2('0x6')&&(typeof _0x3ff71c!==_0x4ee2('0x2')||_0x3ff71c[_0x4ee2('0x3')]===0x0)){return _0x5546e1(_0x4ee2('0x7'));}try{_0x1aee89=fs[_0x4ee2('0x8')](_0x234b61)[_0x4ee2('0x9')]('base64');}catch(_0x519e87){return _0x5546e1(_0x519e87);}return _0x34b373({'method':_0x4ee2('0xa'),'uri':host+_0x4ee2('0xb')+_0x4e09d3,'body':{'config':{'encoding':_0x4ee2('0xc'),'sampleRateHertz':_0x4ee2('0xd'),'languageCode':_0x3ff71c},'audio':{'content':_0x1aee89}},'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 bec341d..a0d70b4 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 _0x8336=['./asr','exports'];(function(_0x1cd548,_0x2b0943){var _0x3da50=function(_0x3f790d){while(--_0x3f790d){_0x1cd548['push'](_0x1cd548['shift']());}};_0x3da50(++_0x2b0943);}(_0x8336,0x88));var _0x6833=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x8336[_0x2d61b2];return _0x12df89;};var asr=require(_0x6833('0x0'));module[_0x6833('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3ef9=['exports','./asr'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x3ef9,0xdf));var _0x93ef=function(_0x1e43f1,_0x5f1aa4){_0x1e43f1=_0x1e43f1-0x0;var _0x3231d2=_0x3ef9[_0x1e43f1];return _0x3231d2;};var asr=require(_0x93ef('0x0'));module[_0x93ef('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 a13d18b..a235db1 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 _0xbce6=['CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','http','https','path','querystring','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','pipe','end','WHAT_EVER','get','data','wav','error\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','.mp3','from','writeFile','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','googleDialogflowV2','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction'];(function(_0x5ecf73,_0x11e61d){var _0x43c2b7=function(_0x2cdfac){while(--_0x2cdfac){_0x5ecf73['push'](_0x5ecf73['shift']());}};_0x43c2b7(++_0x11e61d);}(_0xbce6,0x8f));var _0x6bce=function(_0x5b9252,_0x4bc2f8){_0x5b9252=_0x5b9252-0x0;var _0x1a4284=_0xbce6[_0x5b9252];return _0x1a4284;};'use strict';var apiai=require(_0x6bce('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x6bce('0x1'));var https=require(_0x6bce('0x2'));var md5=require('md5');var path=require(_0x6bce('0x3'));var querystring=require(_0x6bce('0x4'));var rp=require('request-promise');var rs=require(_0x6bce('0x5'));var sox=require(_0x6bce('0x6'));var tts=require(_0x6bce('0x7'));var urlParse=require('url')[_0x6bce('0x8')];var util=require(_0x6bce('0x9'));var aws=require(_0x6bce('0xa'));var google=require(_0x6bce('0xb'));var sestek=require(_0x6bce('0xc'));var tilde=require('./tilde');var logger=require(_0x6bce('0xd'))(_0x6bce('0xe'));var ISPEECH_API=_0x6bce('0xf');function downloadFile(_0xbed8f0,_0x4eec03){return new BPromise(function(_0x7bdbf6,_0x3d1cf3){var _0x45385d=urlParse(_0xbed8f0);var _0x53b8ed=_0x45385d[_0x6bce('0x10')]===_0x6bce('0x11')?https:http;var _0x4d805a={'host':_0x45385d[_0x6bce('0x12')],'path':_0x45385d[_0x6bce('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x53b8ed['get'](_0x4d805a,function(_0x37d189){if(_0x37d189[_0x6bce('0x13')]!==0xc8){logger[_0x6bce('0x14')](_0x6bce('0x15')+_0xbed8f0+_0x6bce('0x16')+_0x37d189[_0x6bce('0x13')]+'\x20('+_0x37d189[_0x6bce('0x17')]+')');_0x3d1cf3(new Error(_0x6bce('0x15')+_0xbed8f0+_0x6bce('0x16')+_0x37d189[_0x6bce('0x13')]+'\x20('+_0x37d189[_0x6bce('0x17')]+')'));return;}var _0x1e43d3=fs[_0x6bce('0x18')](_0x4eec03);_0x1e43d3['on']('finish',function(){logger[_0x6bce('0x19')](_0x6bce('0x1a'));_0x1e43d3[_0x6bce('0x1b')](_0x7bdbf6);});_0x1e43d3['on']('error',function(_0x479c33){fs['unlink'](_0x4eec03);logger['error']('download\x20error',_0x479c33);_0x3d1cf3(_0x479c33);});_0x37d189[_0x6bce('0x1c')](_0x1e43d3);})['on'](_0x6bce('0x14'),function(_0x504d36){logger['error'](_0x504d36);_0x3d1cf3(_0x504d36);})[_0x6bce('0x1d')]();});}function uploadFile(_0x43fe0a){return new BPromise(function(_0x2bfd45,_0x2540ea){var _0x53f23a=urlParse(_0x43fe0a);var _0x1551c4=_0x53f23a[_0x6bce('0x10')]===_0x6bce('0x11')?https:http;var _0x2d3a5d={'host':_0x53f23a[_0x6bce('0x12')],'path':_0x53f23a[_0x6bce('0x3')],'headers':{'user-agent':_0x6bce('0x1e')}};_0x1551c4[_0x6bce('0x1f')](_0x2d3a5d,function(_0x1651fe){if(_0x1651fe['statusCode']!==0xc8){_0x2540ea(new Error(_0x6bce('0x15')+_0x43fe0a+'\x20failed,\x20status\x20code\x20=\x20'+_0x1651fe['statusCode']+'\x20('+_0x1651fe[_0x6bce('0x17')]+')'));return;}var _0x3e5f9a='';_0x1651fe['on'](_0x6bce('0x20'),function(_0xdf40e2){_0x3e5f9a+=_0xdf40e2;});_0x1651fe['on'](_0x6bce('0x1d'),function(){_0x2bfd45(_0x3e5f9a);});})['on'](_0x6bce('0x14'),function(_0x491746){_0x2540ea(_0x491746);})[_0x6bce('0x1d')]();});}function convertFile(_0x2e3447,_0x1ebfc7){return new BPromise(function(_0x25c63d,_0xc0ce25){var _0x21298f=sox['transcode'](_0x2e3447,_0x1ebfc7,{'sampleRate':0x1f40,'format':_0x6bce('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21298f['on']('error',function(_0x159d17){logger[_0x6bce('0x14')](_0x6bce('0x22'),_0x159d17);_0xc0ce25(_0x159d17);});_0x21298f['on'](_0x6bce('0x1d'),function(){logger[_0x6bce('0x19')]('finish\x20to\x20convert');_0x25c63d();});_0x21298f[_0x6bce('0x23')]();});}function base64Decode(_0x15a2d9,_0x2562a7){var _0x58450e=path['resolve'](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x26'));fs[_0x6bce('0x27')](_0x58450e,_0x15a2d9,_0x6bce('0x28'));return convertFile(_0x58450e,_0x2562a7)[_0x6bce('0x29')](function(){try{fs[_0x6bce('0x2a')](_0x58450e);fs[_0x6bce('0x2b')](_0x2562a7,'777');}catch(_0xe6e3c1){logger['error'](_0xe6e3c1);}return _0x2562a7[_0x6bce('0x2c')]('.')[0x0];});}function base64Encode(_0x10220d){var _0x3a39d3=fs[_0x6bce('0x2d')](_0x10220d);return new Buffer(_0x3a39d3)[_0x6bce('0x2e')]('base64');}exports[_0x6bce('0x2f')]=function(_0x2ae307,_0x4fc9c5,_0x44bc52,_0x415544,_0x449f95,_0x468e4c){var _0x5ce8d7,_0x37c731;var _0x4b22fd=_0x6bce('0x30');var _0x565607=_0x6bce('0x31')+_0x2ae307;var _0xe68339={};if(_0x4fc9c5===_0x6bce('0x32')){_0xe68339[_0x6bce('0x33')]={'ssml':_0x44bc52};}else{_0xe68339[_0x6bce('0x33')]={'text':_0x44bc52};};_0xe68339[_0x6bce('0x34')]={'languageCode':_0x415544,'ssmlGender':_0x449f95};_0xe68339[_0x6bce('0x35')]={'audioEncoding':_0x6bce('0x36'),'sampleRateHertz':0x1f40};var _0x312366={'url':_0x4b22fd+_0x6bce('0x37')+_0x565607,'method':'POST','json':!![],'body':_0xe68339};return rp(_0x312366)[_0x6bce('0x29')](function(_0x48effa){return new BPromise(function(_0x449545,_0x2a8698){_0x5ce8d7=path[_0x6bce('0x38')](__dirname,'tmp',rs[_0x6bce('0x25')](0x4)+_0x6bce('0x39'));var _0x43a857=Buffer[_0x6bce('0x3a')](_0x48effa['audioContent'],_0x6bce('0x28'));return fs[_0x6bce('0x3b')](_0x5ce8d7,_0x43a857,function(_0x4b7521){_0x2a8698(_0x4b7521);},function(_0x2fbccd){fs['chmodSync'](_0x5ce8d7,_0x6bce('0x3c'));_0x449545(_0x2fbccd);});});})['then'](function(_0x4a6c84){_0x37c731=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x26'));return convertFile(_0x5ce8d7,_0x37c731);})['then'](function(){try{fs[_0x6bce('0x2a')](_0x5ce8d7);fs[_0x6bce('0x2b')](_0x37c731,'777');}catch(_0x247170){logger[_0x6bce('0x14')](_0x247170);}logger['info'](_0x6bce('0x3d'),_0x37c731[_0x6bce('0x2c')]('.')[0x0]);return _0x37c731[_0x6bce('0x2c')]('.')[0x0];});};exports['googleTTS']=function(_0x2b4771,_0x10f3cd){var _0x5b4694=_0x6bce('0x3e');var _0x19d2e0,_0x14530b;var _0xc724ab;var _0x5f36e0={'encoding':_0x6bce('0x3f'),'method':_0x6bce('0x40'),'timeout':0x2710,'url':_0x5b4694,'headers':{'Content-Type':_0x6bce('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x6bce('0x42')]([[['jQ1olc',JSON['stringify']([_0x2b4771,_0x10f3cd||'en',![],'null']),null,'generic']]]))};return rp(_0x5f36e0)[_0x6bce('0x29')](function(_0x19b0bc){try{_0xc724ab=eval(_0x19b0bc[_0x6bce('0x43')](0x5))[0x0][0x2];}catch(_0x594a34){throw new Error(_0x6bce('0x44')+_0x19b0bc[_0x6bce('0x20')]);}if(!_0xc724ab){if(_0x2b4771[_0x6bce('0x45')]>0xc8){throw new Error(_0x6bce('0x46'));}else{throw new Error(_0x6bce('0x47')+_0x10f3cd+_0x6bce('0x48'));}}try{_0xc724ab=eval(_0xc724ab)[0x0];}catch(_0x37870d){throw new Error(_0x6bce('0x44')+res[_0x6bce('0x20')]);}const _0x51f515=_0xc724ab;_0x19d2e0=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x39'));fs[_0x6bce('0x27')](_0x19d2e0,_0xc724ab,{'encoding':'base64'});_0x14530b=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x26'));return convertFile(_0x19d2e0,_0x14530b);})[_0x6bce('0x29')](function(){try{fs[_0x6bce('0x2a')](_0x19d2e0);fs['chmodSync'](_0x14530b,'777');}catch(_0x50659c){logger[_0x6bce('0x14')](_0x50659c);}logger[_0x6bce('0x19')](_0x6bce('0x49'),_0x14530b[_0x6bce('0x2c')]('.')[0x0]);return _0x14530b[_0x6bce('0x2c')]('.')[0x0];});};exports[_0x6bce('0x4a')]=function(_0x244940,_0x2ed81f,_0x10bbe2){return google[_0x6bce('0x4b')](_0x244940,_0x2ed81f,_0x10bbe2)[_0x6bce('0x29')](function(_0x591e2b){logger[_0x6bce('0x19')](_0x591e2b[_0x6bce('0x4c')]);return rp(_0x591e2b);})[_0x6bce('0x29')](function(_0x3984e0){var _0x119a06='';var _0x2dcc1a=0x0;try{fs[_0x6bce('0x2a')](_0x244940);}catch(_0x36d3f4){logger['error'](_0x36d3f4);}if(_0x3984e0&&_0x3984e0[_0x6bce('0x4d')]){_0x119a06=_0x3984e0[_0x6bce('0x4d')][_0x6bce('0x4e')](function(_0x25dc04){return _0x25dc04&&_0x25dc04[_0x6bce('0x4f')][0x0]&&_0x25dc04[_0x6bce('0x4f')][0x0]['transcript']?_0x25dc04[_0x6bce('0x4f')][0x0][_0x6bce('0x50')]:'';})[_0x6bce('0x51')]('\x0a');_0x2dcc1a=_0x3984e0[_0x6bce('0x4d')]['map'](function(_0xb478e2){return _0xb478e2&&_0xb478e2[_0x6bce('0x4f')][0x0]&&_0xb478e2[_0x6bce('0x4f')][0x0][_0x6bce('0x52')]?_0xb478e2[_0x6bce('0x4f')][0x0][_0x6bce('0x52')]:0x0;})[_0x6bce('0x51')]('\x0a');}logger[_0x6bce('0x19')](_0x6bce('0x53'),_0x119a06);logger[_0x6bce('0x19')](_0x6bce('0x54'),_0x2dcc1a);return{'transcript':_0x119a06,'confidence':_0x2dcc1a};})[_0x6bce('0x55')](function(_0x2df9c2){logger[_0x6bce('0x14')]('[%s]\x20%s:%s',_0x2df9c2[_0x6bce('0x13')],_0x2df9c2[_0x6bce('0x56')],_0x2df9c2[_0x6bce('0x57')]);});};exports[_0x6bce('0x58')]=function(_0x412c99,_0x4d6ecd,_0x43925b,_0x165ab6){var _0x5138d0=apiai(_0x4d6ecd,{'language':_0x165ab6||'en'});return _0x5138d0[_0x6bce('0x59')](_0x43925b,{'sessionId':md5(_0x412c99)})[_0x6bce('0x29')](function(_0x3c2c90){logger[_0x6bce('0x19')](JSON[_0x6bce('0x42')](_0x3c2c90));return{'source':_0x3c2c90[_0x6bce('0x5a')][_0x6bce('0x5b')],'resolvedQuery':_0x3c2c90['result']['resolvedQuery'],'action':_0x3c2c90[_0x6bce('0x5a')][_0x6bce('0x5c')],'actionIncomplete':_0x3c2c90['result'][_0x6bce('0x5d')],'speech':_0x3c2c90['result'][_0x6bce('0x5e')][_0x6bce('0x5f')],'score':_0x3c2c90[_0x6bce('0x5a')][_0x6bce('0x60')],'statusCode':_0x3c2c90[_0x6bce('0x61')][_0x6bce('0x62')],'endConversation':_0x3c2c90[_0x6bce('0x5a')]['metadata'][_0x6bce('0x63')]||![],'isFallbackIntent':_0x3c2c90[_0x6bce('0x5a')][_0x6bce('0x64')]['isFallbackIntent']};});};exports[_0x6bce('0x65')]=function(_0x160de8,_0x150ba4,_0x13f21a,_0x1eeeca,_0x297a40,_0x5df8e5){var _0x257753=_0x1eeeca['replace'](/\\n/g,'\x0a');var _0x3e94c2={'credentials':{'private_key':_0x257753,'client_email':_0x13f21a}};var _0x384082=new dialogflow['SessionsClient'](_0x3e94c2);var _0x26e18b=_0x384082[_0x6bce('0x66')](_0x150ba4,md5(_0x160de8));var _0x3dfb00={'session':_0x26e18b,'queryInput':{'text':{'text':_0x297a40,'languageCode':_0x5df8e5}}};return _0x384082[_0x6bce('0x67')](_0x3dfb00)[_0x6bce('0x29')](function(_0xdfb838){if(_0xdfb838&&_0xdfb838[_0x6bce('0x45')]){logger['info'](_0x6bce('0x68'),JSON[_0x6bce('0x42')](_0xdfb838));var _0xc7502b=_0xdfb838[0x0];if(_0xc7502b){var _0x569551={'action':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x5c')],'allRequiredParamsPresent':_0xc7502b[_0x6bce('0x69')]['allRequiredParamsPresent'],'endConversation':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x6a')]&&_0xc7502b[_0x6bce('0x69')]['diagnosticInfo']['fields']?_0xc7502b['queryResult']['diagnosticInfo'][_0x6bce('0x6b')][_0x6bce('0x6c')][_0x6bce('0x6d')]:![],'fulfillmentText':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x6e')],'intentName':_0xc7502b['queryResult'][_0x6bce('0x6f')][_0x6bce('0x56')],'intentDisplayName':_0xc7502b['queryResult'][_0x6bce('0x6f')][_0x6bce('0x70')],'isFallbackIntent':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x6f')][_0x6bce('0x71')],'languageCode':_0xc7502b[_0x6bce('0x69')]['languageCode'],'queryText':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x72')],'responseId':_0xc7502b[_0x6bce('0x73')],'score':_0xc7502b[_0x6bce('0x69')]['intentDetectionConfidence'],'speech':_0xc7502b[_0x6bce('0x69')][_0x6bce('0x6e')],'providerResponse':JSON[_0x6bce('0x42')](_0xdfb838)};return _0x569551;}}});};exports[_0x6bce('0x74')]=function(_0x317c83,_0x3f29cf,_0xad2fc7,_0x233fd8){return tilde[_0x6bce('0x4b')](_0x317c83,_0x3f29cf,_0xad2fc7,_0x233fd8)[_0x6bce('0x29')](function(_0xdb4f81){try{fs['unlink'](_0x317c83);}catch(_0x1035c2){logger[_0x6bce('0x14')](_0x1035c2);}logger['info'](_0x6bce('0x75'),_0xdb4f81[_0x6bce('0x50')]);logger[_0x6bce('0x19')](_0x6bce('0x76'),_0xdb4f81[_0x6bce('0x52')]);return _0xdb4f81;});};exports[_0x6bce('0x77')]=function(_0x19826d,_0x581a66,_0x4a673c,_0x2e8e47,_0xb5f91a,_0x1d72ce){var _0x31b38c=path[_0x6bce('0x38')](__dirname,'tmp',rs[_0x6bce('0x25')](0x4)+'.mp3');var _0x57a201;return aws[_0x6bce('0x78')](_0x19826d,_0x581a66,_0x4a673c,_0x2e8e47,_0xb5f91a,_0x1d72ce,_0x31b38c)[_0x6bce('0x29')](function(){_0x57a201=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+_0x6bce('0x26'));return convertFile(_0x31b38c,_0x57a201);})[_0x6bce('0x29')](function(){try{fs[_0x6bce('0x2a')](_0x31b38c);fs['chmodSync'](_0x57a201,_0x6bce('0x3c'));}catch(_0x22c649){logger[_0x6bce('0x14')](_0x22c649);}return _0x57a201[_0x6bce('0x2c')]('.')[0x0];});};exports[_0x6bce('0x79')]=function(_0x4f3b76,_0x509f33,_0x2b8e3a,_0x1246d7,_0x51a4bf,_0x2cb467){return aws[_0x6bce('0x7a')](_0x4f3b76,_0x509f33,_0x2b8e3a,_0x1246d7,_0x51a4bf,_0x2cb467)['then'](function(_0x1f04e){logger[_0x6bce('0x19')](JSON[_0x6bce('0x42')](_0x1f04e));return _0x1f04e;});};exports['ispeechTTS']=function(_0x2ec1fd,_0x3f4e75,_0x3a673d,_0x349edb){var _0x40cb09=util[_0x6bce('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2ec1fd,encodeURIComponent(_0x3f4e75),_0x3a673d,_0x349edb);var _0x3a1208=path[_0x6bce('0x38')](__dirname,'tmp',rs[_0x6bce('0x25')](0x4)+_0x6bce('0x39'));var _0x75e6ec;return downloadFile(_0x40cb09,_0x3a1208)[_0x6bce('0x29')](function(){_0x75e6ec=path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs[_0x6bce('0x25')](0x4)+'.wav');return convertFile(_0x3a1208,_0x75e6ec);})[_0x6bce('0x29')](function(){try{fs[_0x6bce('0x2a')](_0x3a1208);fs[_0x6bce('0x2b')](_0x75e6ec,'777');}catch(_0xacf30d){logger[_0x6bce('0x14')](_0xacf30d);}return _0x75e6ec[_0x6bce('0x2c')]('.')[0x0];});};exports[_0x6bce('0x7c')]=function(_0x24ca21,_0x2e1fd6,_0x1fabf8,_0x3c4d03){var _0x544781=util[_0x6bce('0x7b')](_0x6bce('0x7d'),ISPEECH_API,_0x2e1fd6,_0x1fabf8,base64Encode(_0x24ca21),_0x3c4d03?util[_0x6bce('0x7b')](_0x6bce('0x7e'),encodeURIComponent(_0x3c4d03)):_0x6bce('0x7f'));return uploadFile(_0x544781)['then'](function(_0x7d7c96){return querystring[_0x6bce('0x8')](_0x7d7c96);});};exports[_0x6bce('0x80')]=function(_0x23a67e,_0x573d93){return sestek[_0x6bce('0x81')](_0x23a67e,_0x573d93)[_0x6bce('0x29')](function(_0x4a608f){logger[_0x6bce('0x19')](JSON[_0x6bce('0x42')](_0x4a608f));var _0x586b39={'speech':_0x4a608f[_0x6bce('0x82')],'action':_0x4a608f[_0x6bce('0x83')]?_0x4a608f[_0x6bce('0x83')][_0x6bce('0x84')]:undefined,'actiondata':_0x4a608f[_0x6bce('0x83')]?_0x4a608f[_0x6bce('0x83')][_0x6bce('0x85')]:undefined};if(_0x4a608f[_0x6bce('0x83')]&&_0x4a608f[_0x6bce('0x83')][_0x6bce('0x86')]){return base64Decode(_0x4a608f[_0x6bce('0x83')][_0x6bce('0x86')][_0x6bce('0x87')],path[_0x6bce('0x38')](__dirname,_0x6bce('0x24'),rs['generate'](0x4)+_0x6bce('0x26')))[_0x6bce('0x29')](function(_0x28edef){_0x586b39[_0x6bce('0x88')]=_0x28edef;return _0x586b39;});}return _0x586b39;});};exports[_0x6bce('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0x2684=['error','request\x20to\x20','statusMessage','createWriteStream','info','close','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','unlink','777','split','readFileSync','toString','base64','googleCloudTTS','?key=','ssml','input','voice','MP3','POST','.mp3','from','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','slice','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','message','textRequest','result','action','actionIncomplete','speech','score','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','freeform=3','text','channelData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode'];(function(_0x565187,_0x465c53){var _0xabc62c=function(_0x5d4d7e){while(--_0x5d4d7e){_0x565187['push'](_0x565187['shift']());}};_0xabc62c(++_0x465c53);}(_0x2684,0x1ed));var _0x4268=function(_0x1aaaed,_0x855d38){_0x1aaaed=_0x1aaaed-0x0;var _0x25dd55=_0x2684[_0x1aaaed];return _0x25dd55;};'use strict';var apiai=require(_0x4268('0x0'));var BPromise=require(_0x4268('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x4268('0x2'));var https=require(_0x4268('0x3'));var md5=require('md5');var path=require(_0x4268('0x4'));var querystring=require(_0x4268('0x5'));var rp=require(_0x4268('0x6'));var rs=require('randomstring');var sox=require(_0x4268('0x7'));var tts=require(_0x4268('0x8'));var urlParse=require(_0x4268('0x9'))[_0x4268('0xa')];var util=require(_0x4268('0xb'));var aws=require(_0x4268('0xc'));var google=require(_0x4268('0xd'));var sestek=require('./sestek');var tilde=require(_0x4268('0xe'));var logger=require(_0x4268('0xf'))(_0x4268('0x10'));var ISPEECH_API=_0x4268('0x11');function downloadFile(_0x265337,_0x2a6c1c){return new BPromise(function(_0x39ff08,_0x5cb121){var _0x5b836c=urlParse(_0x265337);var _0x4d0b30=_0x5b836c[_0x4268('0x12')]===_0x4268('0x13')?https:http;var _0x2759e4={'host':_0x5b836c[_0x4268('0x14')],'path':_0x5b836c[_0x4268('0x4')],'headers':{'user-agent':_0x4268('0x15')}};_0x4d0b30['get'](_0x2759e4,function(_0x454d45){if(_0x454d45[_0x4268('0x16')]!==0xc8){logger[_0x4268('0x17')](_0x4268('0x18')+_0x265337+'\x20failed,\x20status\x20code\x20=\x20'+_0x454d45['statusCode']+'\x20('+_0x454d45[_0x4268('0x19')]+')');_0x5cb121(new Error(_0x4268('0x18')+_0x265337+'\x20failed,\x20status\x20code\x20=\x20'+_0x454d45[_0x4268('0x16')]+'\x20('+_0x454d45['statusMessage']+')'));return;}var _0x4b7a04=fs[_0x4268('0x1a')](_0x2a6c1c);_0x4b7a04['on']('finish',function(){logger[_0x4268('0x1b')]('finish\x20download\x20file');_0x4b7a04[_0x4268('0x1c')](_0x39ff08);});_0x4b7a04['on'](_0x4268('0x17'),function(_0x4326a7){fs['unlink'](_0x2a6c1c);logger['error']('download\x20error',_0x4326a7);_0x5cb121(_0x4326a7);});_0x454d45[_0x4268('0x1d')](_0x4b7a04);})['on'](_0x4268('0x17'),function(_0x465581){logger[_0x4268('0x17')](_0x465581);_0x5cb121(_0x465581);})[_0x4268('0x1e')]();});}function uploadFile(_0x29220d){return new BPromise(function(_0x18aee4,_0xfde624){var _0xd2b774=urlParse(_0x29220d);var _0x3d76e2=_0xd2b774[_0x4268('0x12')]===_0x4268('0x13')?https:http;var _0x5d6e57={'host':_0xd2b774[_0x4268('0x14')],'path':_0xd2b774[_0x4268('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x3d76e2['get'](_0x5d6e57,function(_0x55b932){if(_0x55b932[_0x4268('0x16')]!==0xc8){_0xfde624(new Error(_0x4268('0x18')+_0x29220d+'\x20failed,\x20status\x20code\x20=\x20'+_0x55b932[_0x4268('0x16')]+'\x20('+_0x55b932['statusMessage']+')'));return;}var _0x2b012a='';_0x55b932['on'](_0x4268('0x1f'),function(_0x57c627){_0x2b012a+=_0x57c627;});_0x55b932['on'](_0x4268('0x1e'),function(){_0x18aee4(_0x2b012a);});})['on'](_0x4268('0x17'),function(_0x5abf1f){_0xfde624(_0x5abf1f);})[_0x4268('0x1e')]();});}function convertFile(_0x5db026,_0xe057b3){return new BPromise(function(_0xfc8ac9,_0xfc3f84){var _0x5d4a4e=sox[_0x4268('0x20')](_0x5db026,_0xe057b3,{'sampleRate':0x1f40,'format':_0x4268('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5d4a4e['on'](_0x4268('0x17'),function(_0x304a7d){logger[_0x4268('0x17')](_0x4268('0x22'),_0x304a7d);_0xfc3f84(_0x304a7d);});_0x5d4a4e['on'](_0x4268('0x1e'),function(){logger[_0x4268('0x1b')](_0x4268('0x23'));_0xfc8ac9();});_0x5d4a4e[_0x4268('0x24')]();});}function base64Decode(_0x3864ca,_0x2ba134){var _0x3693f7=path[_0x4268('0x25')](__dirname,_0x4268('0x26'),rs[_0x4268('0x27')](0x4)+_0x4268('0x28'));fs[_0x4268('0x29')](_0x3693f7,_0x3864ca,'base64');return convertFile(_0x3693f7,_0x2ba134)[_0x4268('0x2a')](function(){try{fs[_0x4268('0x2b')](_0x3693f7);fs['chmodSync'](_0x2ba134,_0x4268('0x2c'));}catch(_0x1dfd69){logger[_0x4268('0x17')](_0x1dfd69);}return _0x2ba134[_0x4268('0x2d')]('.')[0x0];});}function base64Encode(_0x506a01){var _0x376cdd=fs[_0x4268('0x2e')](_0x506a01);return new Buffer(_0x376cdd)[_0x4268('0x2f')](_0x4268('0x30'));}exports[_0x4268('0x31')]=function(_0x13cd1c,_0x3e70b8,_0x98d8dd,_0x1e1e39,_0x5e8555,_0x16d9ef){var _0x30fe65,_0x4aa6d7;var _0x6f5a8a='https://texttospeech.googleapis.com/v1/';var _0x291e2a=_0x4268('0x32')+_0x13cd1c;var _0x4c0266={};if(_0x3e70b8===_0x4268('0x33')){_0x4c0266[_0x4268('0x34')]={'ssml':_0x98d8dd};}else{_0x4c0266[_0x4268('0x34')]={'text':_0x98d8dd};};_0x4c0266[_0x4268('0x35')]={'languageCode':_0x1e1e39,'ssmlGender':_0x5e8555};_0x4c0266['audioConfig']={'audioEncoding':_0x4268('0x36'),'sampleRateHertz':0x1f40};var _0x10c8f5={'url':_0x6f5a8a+'text:synthesize'+_0x291e2a,'method':_0x4268('0x37'),'json':!![],'body':_0x4c0266};return rp(_0x10c8f5)[_0x4268('0x2a')](function(_0xaf2ec8){return new BPromise(function(_0x590a3b,_0x2c9703){_0x30fe65=path[_0x4268('0x25')](__dirname,_0x4268('0x26'),rs['generate'](0x4)+_0x4268('0x38'));var _0x242c7a=Buffer[_0x4268('0x39')](_0xaf2ec8['audioContent'],_0x4268('0x30'));return fs[_0x4268('0x3a')](_0x30fe65,_0x242c7a,function(_0xa6f12f){_0x2c9703(_0xa6f12f);},function(_0x2997a9){fs['chmodSync'](_0x30fe65,_0x4268('0x2c'));_0x590a3b(_0x2997a9);});});})[_0x4268('0x2a')](function(_0xe9bd31){_0x4aa6d7=path[_0x4268('0x25')](__dirname,'tmp',rs[_0x4268('0x27')](0x4)+_0x4268('0x28'));return convertFile(_0x30fe65,_0x4aa6d7);})[_0x4268('0x2a')](function(){try{fs[_0x4268('0x2b')](_0x30fe65);fs[_0x4268('0x3b')](_0x4aa6d7,_0x4268('0x2c'));}catch(_0x373d51){logger['error'](_0x373d51);}logger[_0x4268('0x1b')](_0x4268('0x3c'),_0x4aa6d7[_0x4268('0x2d')]('.')[0x0]);return _0x4aa6d7['split']('.')[0x0];});};exports[_0x4268('0x3d')]=function(_0x15a8ff,_0xc16b13){var _0x4aed50=_0x4268('0x3e');var _0xc2477f,_0x26ce1c;var _0x19083d;var _0x11bc3d={'encoding':_0x4268('0x3f'),'method':_0x4268('0x37'),'timeout':0x2710,'url':_0x4aed50,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x4268('0x40')+encodeURIComponent(JSON[_0x4268('0x41')]([[[_0x4268('0x42'),JSON[_0x4268('0x41')]([_0x15a8ff,_0xc16b13||'en',![],_0x4268('0x43')]),null,'generic']]]))};return rp(_0x11bc3d)[_0x4268('0x2a')](function(_0xa07799){try{_0x19083d=eval(_0xa07799[_0x4268('0x44')](0x5))[0x0][0x2];}catch(_0x1e30ea){throw new Error('parse\x20response\x20failed:\x0a'+_0xa07799[_0x4268('0x1f')]);}if(!_0x19083d){if(_0x15a8ff[_0x4268('0x45')]>0xc8){throw new Error(_0x4268('0x46'));}else{throw new Error('lang\x20\x22'+_0xc16b13+_0x4268('0x47'));}}try{_0x19083d=eval(_0x19083d)[0x0];}catch(_0x15e806){throw new Error(_0x4268('0x48')+res['data']);}const _0x23a911=_0x19083d;_0xc2477f=path[_0x4268('0x25')](__dirname,_0x4268('0x26'),rs[_0x4268('0x27')](0x4)+'.mp3');fs['writeFileSync'](_0xc2477f,_0x19083d,{'encoding':_0x4268('0x30')});_0x26ce1c=path[_0x4268('0x25')](__dirname,_0x4268('0x26'),rs[_0x4268('0x27')](0x4)+'.wav');return convertFile(_0xc2477f,_0x26ce1c);})[_0x4268('0x2a')](function(){try{fs[_0x4268('0x2b')](_0xc2477f);fs[_0x4268('0x3b')](_0x26ce1c,_0x4268('0x2c'));}catch(_0x237abb){logger[_0x4268('0x17')](_0x237abb);}logger[_0x4268('0x1b')](_0x4268('0x49'),_0x26ce1c['split']('.')[0x0]);return _0x26ce1c[_0x4268('0x2d')]('.')[0x0];});};exports[_0x4268('0x4a')]=function(_0x53deb5,_0x358357,_0x983f0){return google[_0x4268('0x4b')](_0x53deb5,_0x358357,_0x983f0)[_0x4268('0x2a')](function(_0x2eb62d){logger[_0x4268('0x1b')](_0x2eb62d[_0x4268('0x4c')]);return rp(_0x2eb62d);})['then'](function(_0x5f5192){var _0x1bdf25='';var _0xf0e602=0x0;try{fs[_0x4268('0x2b')](_0x53deb5);}catch(_0xb3931b){logger['error'](_0xb3931b);}if(_0x5f5192&&_0x5f5192[_0x4268('0x4d')]){_0x1bdf25=_0x5f5192[_0x4268('0x4d')][_0x4268('0x4e')](function(_0x3729cc){return _0x3729cc&&_0x3729cc['alternatives'][0x0]&&_0x3729cc[_0x4268('0x4f')][0x0][_0x4268('0x50')]?_0x3729cc[_0x4268('0x4f')][0x0][_0x4268('0x50')]:'';})[_0x4268('0x51')]('\x0a');_0xf0e602=_0x5f5192[_0x4268('0x4d')][_0x4268('0x4e')](function(_0x22b747){return _0x22b747&&_0x22b747[_0x4268('0x4f')][0x0]&&_0x22b747[_0x4268('0x4f')][0x0][_0x4268('0x52')]?_0x22b747[_0x4268('0x4f')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x4268('0x1b')](_0x4268('0x53'),_0x1bdf25);logger['info'](_0x4268('0x54'),_0xf0e602);return{'transcript':_0x1bdf25,'confidence':_0xf0e602};})['catch'](function(_0x15e97b){logger[_0x4268('0x17')](_0x4268('0x55'),_0x15e97b['statusCode'],_0x15e97b['name'],_0x15e97b[_0x4268('0x56')]);});};exports['googleDialogflow']=function(_0x109d66,_0x3410b1,_0x5385af,_0x5b73ee){var _0x5a01d8=apiai(_0x3410b1,{'language':_0x5b73ee||'en'});return _0x5a01d8[_0x4268('0x57')](_0x5385af,{'sessionId':md5(_0x109d66)})[_0x4268('0x2a')](function(_0x350db5){logger[_0x4268('0x1b')](JSON[_0x4268('0x41')](_0x350db5));return{'source':_0x350db5['result']['source'],'resolvedQuery':_0x350db5[_0x4268('0x58')]['resolvedQuery'],'action':_0x350db5[_0x4268('0x58')][_0x4268('0x59')],'actionIncomplete':_0x350db5[_0x4268('0x58')][_0x4268('0x5a')],'speech':_0x350db5[_0x4268('0x58')]['fulfillment'][_0x4268('0x5b')],'score':_0x350db5[_0x4268('0x58')][_0x4268('0x5c')],'statusCode':_0x350db5['status']['code'],'endConversation':_0x350db5[_0x4268('0x58')][_0x4268('0x5d')][_0x4268('0x5e')]||![],'isFallbackIntent':_0x350db5[_0x4268('0x58')][_0x4268('0x5d')][_0x4268('0x5f')]};});};exports[_0x4268('0x60')]=function(_0x27e5a6,_0x5b7f38,_0x10e8f5,_0x4a04b2,_0x5df221,_0x36db05){var _0x122ab6=_0x4a04b2[_0x4268('0x61')](/\\n/g,'\x0a');var _0x408905={'credentials':{'private_key':_0x122ab6,'client_email':_0x10e8f5}};var _0x23c3ff=new dialogflow[(_0x4268('0x62'))](_0x408905);var _0x14f145=_0x23c3ff[_0x4268('0x63')](_0x5b7f38,md5(_0x27e5a6));var _0x2ce919={'session':_0x14f145,'queryInput':{'text':{'text':_0x5df221,'languageCode':_0x36db05}}};return _0x23c3ff[_0x4268('0x64')](_0x2ce919)['then'](function(_0x337982){if(_0x337982&&_0x337982['length']){logger[_0x4268('0x1b')](_0x4268('0x65'),JSON[_0x4268('0x41')](_0x337982));var _0x526914=_0x337982[0x0];if(_0x526914){var _0x9a7a7f={'action':_0x526914['queryResult'][_0x4268('0x59')],'allRequiredParamsPresent':_0x526914[_0x4268('0x66')]['allRequiredParamsPresent'],'endConversation':_0x526914['queryResult'][_0x4268('0x67')]&&_0x526914[_0x4268('0x66')][_0x4268('0x67')][_0x4268('0x68')]?_0x526914[_0x4268('0x66')]['diagnosticInfo'][_0x4268('0x68')][_0x4268('0x69')][_0x4268('0x6a')]:![],'fulfillmentText':_0x526914[_0x4268('0x66')][_0x4268('0x6b')],'intentName':_0x526914[_0x4268('0x66')][_0x4268('0x6c')][_0x4268('0x6d')],'intentDisplayName':_0x526914[_0x4268('0x66')][_0x4268('0x6c')][_0x4268('0x6e')],'isFallbackIntent':_0x526914[_0x4268('0x66')][_0x4268('0x6c')]['isFallback'],'languageCode':_0x526914[_0x4268('0x66')]['languageCode'],'queryText':_0x526914[_0x4268('0x66')]['queryText'],'responseId':_0x526914[_0x4268('0x6f')],'score':_0x526914[_0x4268('0x66')][_0x4268('0x70')],'speech':_0x526914[_0x4268('0x66')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x337982)};return _0x9a7a7f;}}});};exports[_0x4268('0x71')]=function(_0x3ce9ec,_0xa496ff,_0x558899,_0x43d986){return tilde['asr'](_0x3ce9ec,_0xa496ff,_0x558899,_0x43d986)[_0x4268('0x2a')](function(_0x1871a5){try{fs[_0x4268('0x2b')](_0x3ce9ec);}catch(_0x23f216){logger[_0x4268('0x17')](_0x23f216);}logger[_0x4268('0x1b')]('Tilde\x20ASR\x20transcription',_0x1871a5[_0x4268('0x50')]);logger[_0x4268('0x1b')](_0x4268('0x72'),_0x1871a5['confidence']);return _0x1871a5;});};exports[_0x4268('0x73')]=function(_0xfd1885,_0xb16b12,_0x5c74a9,_0x2fef1d,_0x526947,_0x399c02){var _0x4d0856=path[_0x4268('0x25')](__dirname,_0x4268('0x26'),rs['generate'](0x4)+_0x4268('0x38'));var _0x347d88;return aws['polly'](_0xfd1885,_0xb16b12,_0x5c74a9,_0x2fef1d,_0x526947,_0x399c02,_0x4d0856)['then'](function(){_0x347d88=path[_0x4268('0x25')](__dirname,_0x4268('0x26'),rs['generate'](0x4)+_0x4268('0x28'));return convertFile(_0x4d0856,_0x347d88);})['then'](function(){try{fs[_0x4268('0x2b')](_0x4d0856);fs[_0x4268('0x3b')](_0x347d88,_0x4268('0x2c'));}catch(_0x5dfe08){logger[_0x4268('0x17')](_0x5dfe08);}return _0x347d88[_0x4268('0x2d')]('.')[0x0];});};exports[_0x4268('0x74')]=function(_0xad56f2,_0x471033,_0x3552f3,_0x2572e5,_0x2c073a,_0x2a6426){return aws[_0x4268('0x75')](_0xad56f2,_0x471033,_0x3552f3,_0x2572e5,_0x2c073a,_0x2a6426)[_0x4268('0x2a')](function(_0xe21568){logger['info'](JSON['stringify'](_0xe21568));return _0xe21568;});};exports[_0x4268('0x76')]=function(_0x3534c3,_0x4db4fc,_0x26be21,_0x131cd3){var _0x5a5249=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3534c3,encodeURIComponent(_0x4db4fc),_0x26be21,_0x131cd3);var _0x1b1633=path[_0x4268('0x25')](__dirname,_0x4268('0x26'),rs['generate'](0x4)+_0x4268('0x38'));var _0x595409;return downloadFile(_0x5a5249,_0x1b1633)['then'](function(){_0x595409=path[_0x4268('0x25')](__dirname,'tmp',rs[_0x4268('0x27')](0x4)+_0x4268('0x28'));return convertFile(_0x1b1633,_0x595409);})[_0x4268('0x2a')](function(){try{fs[_0x4268('0x2b')](_0x1b1633);fs[_0x4268('0x3b')](_0x595409,_0x4268('0x2c'));}catch(_0xdbf3b9){logger['error'](_0xdbf3b9);}return _0x595409[_0x4268('0x2d')]('.')[0x0];});};exports[_0x4268('0x77')]=function(_0x2b0c18,_0x183173,_0x134844,_0x47d12e){var _0x23a981=util['format'](_0x4268('0x78'),ISPEECH_API,_0x183173,_0x134844,base64Encode(_0x2b0c18),_0x47d12e?util[_0x4268('0x79')]('model=%s',encodeURIComponent(_0x47d12e)):_0x4268('0x7a'));return uploadFile(_0x23a981)[_0x4268('0x2a')](function(_0x2e76ed){return querystring['parse'](_0x2e76ed);});};exports['sestekNDA']=function(_0x210db4,_0x5efd22){return sestek['nda'](_0x210db4,_0x5efd22)[_0x4268('0x2a')](function(_0x125258){logger[_0x4268('0x1b')](JSON[_0x4268('0x41')](_0x125258));var _0x4e79a6={'speech':_0x125258[_0x4268('0x7b')],'action':_0x125258[_0x4268('0x7c')]?_0x125258[_0x4268('0x7c')]['CustomAction']:undefined,'actiondata':_0x125258[_0x4268('0x7c')]?_0x125258[_0x4268('0x7c')]['CustomActionData']:undefined};if(_0x125258[_0x4268('0x7c')]&&_0x125258[_0x4268('0x7c')][_0x4268('0x7d')]){return base64Decode(_0x125258[_0x4268('0x7c')][_0x4268('0x7d')][_0x4268('0x7e')],path[_0x4268('0x25')](__dirname,'tmp',rs[_0x4268('0x27')](0x4)+_0x4268('0x28')))[_0x4268('0x2a')](function(_0x4e94c0){_0x4e79a6[_0x4268('0x7f')]=_0x4e94c0;return _0x4e79a6;});}return _0x4e79a6;});};exports[_0x4268('0x80')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 81ed73d..033d43a 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 _0x63e2=['./nda'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x63e2,0xe5));var _0x263e=function(_0x1e8e81,_0x240af8){_0x1e8e81=_0x1e8e81-0x0;var _0x583bcd=_0x63e2[_0x1e8e81];return _0x583bcd;};var nda=require(_0x263e('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xd946=['exports'];(function(_0x1ac597,_0x212532){var _0x4a84ac=function(_0x47f3c7){while(--_0x47f3c7){_0x1ac597['push'](_0x1ac597['shift']());}};_0x4a84ac(++_0x212532);}(_0xd946,0x99));var _0x6d94=function(_0x34128a,_0x2d3d81){_0x34128a=_0x34128a-0x0;var _0x2e2251=_0xd946[_0x34128a];return _0x2e2251;};var nda=require('./nda');module[_0x6d94('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 86edfd7..528503f 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 _0xbefe=['AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','ndagenerate_audio','body','channelData'];(function(_0x145eb2,_0x396cab){var _0x447d25=function(_0x432b6b){while(--_0x432b6b){_0x145eb2['push'](_0x145eb2['shift']());}};_0x447d25(++_0x396cab);}(_0xbefe,0x168));var _0xebef=function(_0x22cd0c,_0x4040b6){_0x22cd0c=_0x22cd0c-0x0;var _0x439eba=_0xbefe[_0x22cd0c];return _0x439eba;};'use strict';var rp=require('request-promise');var url=require(_0xebef('0x0'));var logger=require('../../../../../config/logger')(_0xebef('0x1'));module[_0xebef('0x2')]=function(_0x2f814c,_0x2cd3bf){var _0x1da4cd={'method':_0xebef('0x3'),'uri':url[_0xebef('0x4')](_0x2cd3bf[_0xebef('0x5')],'/token'),'form':{'grant_type':_0xebef('0x6'),'username':_0x2cd3bf[_0xebef('0x7')],'password':_0x2cd3bf[_0xebef('0x6')]},'json':!![]};return rp(_0x1da4cd)['then'](function(_0x4286bf){var _0x2fbd2c={'method':'POST','uri':url['resolve'](_0x2cd3bf[_0xebef('0x8')],_0xebef('0x9')),'body':{'type':_0x2cd3bf[_0xebef('0xa')]||_0xebef('0xb'),'channelId':_0xebef('0xc'),'conversation':{'id':_0x2f814c[_0xebef('0xd')]},'from':{'id':_0x2f814c[_0xebef('0xe')],'name':_0x2f814c[_0xebef('0xf')]},'recipient':{'id':_0x2f814c['dnid'],'name':_0x2f814c[_0xebef('0x10')]},'text':_0x2cd3bf[_0xebef('0x11')],'channelData':{}},'headers':{'Authorization':_0xebef('0x12')+_0x4286bf[_0xebef('0x13')]},'json':!![]};if(_0x2cd3bf[_0xebef('0x14')]){_0x2fbd2c['body']['channelData']['ProjectName']=_0x2cd3bf['project'];}if(_0x2cd3bf[_0xebef('0x15')]=='1'){_0x2fbd2c[_0xebef('0x16')][_0xebef('0x17')][_0xebef('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xebef('0x19')};}if(_0x2cd3bf[_0xebef('0x1a')]){_0x2fbd2c['body'][_0xebef('0x17')][_0xebef('0x1b')]=_0x2cd3bf[_0xebef('0x1a')];if(_0x2cd3bf[_0xebef('0x1c')]){_0x2fbd2c[_0xebef('0x16')][_0xebef('0x17')][_0xebef('0x1d')]=_0x2cd3bf[_0xebef('0x1c')];}}logger[_0xebef('0x1e')](JSON[_0xebef('0x1f')](_0x2fbd2c));return rp(_0x2fbd2c);});}; \ No newline at end of file +var _0x79d8=['ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','callerid','calleridname','dnid','text','Bearer\x20','project','body','ProjectName'];(function(_0xadcf1d,_0x13f4e8){var _0x23fb4f=function(_0x419eac){while(--_0x419eac){_0xadcf1d['push'](_0xadcf1d['shift']());}};_0x23fb4f(++_0x13f4e8);}(_0x79d8,0x67));var _0x879d=function(_0x36ed47,_0x5bacfb){_0x36ed47=_0x36ed47-0x0;var _0x2052af=_0x79d8[_0x36ed47];return _0x2052af;};'use strict';var rp=require(_0x879d('0x0'));var url=require(_0x879d('0x1'));var logger=require(_0x879d('0x2'))(_0x879d('0x3'));module['exports']=function(_0x20dbdc,_0x858c6){var _0x52d8df={'method':_0x879d('0x4'),'uri':url[_0x879d('0x5')](_0x858c6[_0x879d('0x6')],'/token'),'form':{'grant_type':_0x879d('0x7'),'username':_0x858c6[_0x879d('0x8')],'password':_0x858c6[_0x879d('0x7')]},'json':!![]};return rp(_0x52d8df)[_0x879d('0x9')](function(_0x49c05d){var _0x257050={'method':_0x879d('0x4'),'uri':url[_0x879d('0x5')](_0x858c6[_0x879d('0xa')],_0x879d('0xb')),'body':{'type':_0x858c6['ndaactivity_type']||_0x879d('0xc'),'channelId':'Nda','conversation':{'id':_0x20dbdc['uniqueid']},'from':{'id':_0x20dbdc[_0x879d('0xd')],'name':_0x20dbdc[_0x879d('0xe')]},'recipient':{'id':_0x20dbdc[_0x879d('0xf')],'name':_0x20dbdc['extension']},'text':_0x858c6[_0x879d('0x10')],'channelData':{}},'headers':{'Authorization':_0x879d('0x11')+_0x49c05d['access_token']},'json':!![]};if(_0x858c6[_0x879d('0x12')]){_0x257050[_0x879d('0x13')]['channelData'][_0x879d('0x14')]=_0x858c6['project'];}if(_0x858c6[_0x879d('0x15')]=='1'){_0x257050[_0x879d('0x13')][_0x879d('0x16')][_0x879d('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x879d('0x18')};}if(_0x858c6[_0x879d('0x19')]){_0x257050['body']['channelData'][_0x879d('0x1a')]=_0x858c6[_0x879d('0x19')];if(_0x858c6['custom_action_data']){_0x257050['body'][_0x879d('0x16')][_0x879d('0x1b')]=_0x858c6[_0x879d('0x1c')];}}logger[_0x879d('0x1d')](JSON[_0x879d('0x1e')](_0x257050));return rp(_0x257050);});}; \ 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 6b90fd2..f6d0dec 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 _0xd4f1=['./lib/api','exports'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xd4f1,0x1e6));var _0x1d4f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4f1[_0x14add3];return _0x4a174f;};'use strict';var asr=require(_0x1d4f('0x0'));module[_0x1d4f('0x1')]=function(_0x536ab2,_0x52bd3c,_0x569221,_0x3345e9){return asr(_0x536ab2,_0x52bd3c,_0x569221,_0x3345e9);}; \ No newline at end of file +var _0x326b=['./lib/api'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x326b,0x152));var _0xb326=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0x326b[_0x2132a3];return _0x21890c;};'use strict';var asr=require(_0xb326('0x0'));module['exports']=function(_0x1177de,_0x445ed2,_0x2307b9,_0x320cae){return asr(_0x1177de,_0x445ed2,_0x2307b9,_0x320cae);}; \ 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 066091a..ac4b741 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 _0xc82d=['send','stringify','createReadStream','close','error','Tilde\x20ASR\x20send\x20error','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','bluebird','lodash','moment','crypto','exports','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','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xc82d,0x113));var _0xdc82=function(_0x2089fe,_0x1a95c6){_0x2089fe=_0x2089fe-0x0;var _0x5eb20b=_0xc82d[_0x2089fe];return _0x5eb20b;};'use strict';var BPromise=require(_0xdc82('0x0'));var _=require(_0xdc82('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xdc82('0x2'));var crypto=require(_0xdc82('0x3'));var logger=require('../../../../../../config/logger')('agi');module[_0xdc82('0x4')]=function(_0x341cb5,_0x201567,_0xa8bafc,_0x13f5d0){return new BPromise(function(_0x3a41e9,_0x4d8f5d){logger['info'](_0xdc82('0x5'),_0x13f5d0||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x556b2c=new WebSocket(_0x13f5d0||_0xdc82('0x6'),{'perMessageDeflate':![]});var _0x57eff1='';var _0x750052='0';var _0x471416='1';var _0x1b5d90=_0xdc82('0x7');function _0x2af452(_0x4962f1){var _0x12264d=crypto['createHash']('sha1');_0x12264d[_0xdc82('0x8')](_0x4962f1);return _0x12264d['digest'](_0xdc82('0x9'));}function _0x4cee01(){try{logger[_0xdc82('0xa')](_0xdc82('0xb'));var _0xc68350=moment()[_0xdc82('0xc')]();var _0x36c083=_0x2af452(_0xc68350+_0x201567+_0xa8bafc);_0x556b2c[_0xdc82('0xd')](JSON[_0xdc82('0xe')]({'appID':_0x201567,'timestamp':_0xc68350,'appKey':_0x36c083}));var _0xc8968d=fs[_0xdc82('0xf')](_0x341cb5);_0xc8968d['on']('data',function(_0x535685){_0x556b2c[_0xdc82('0xd')](_0x535685);});_0xc8968d['on'](_0xdc82('0x10'),function(){_0x556b2c[_0xdc82('0xd')]('EOS');});}catch(_0x5ecb56){logger[_0xdc82('0x11')](_0xdc82('0x12'),JSON[_0xdc82('0xe')](_0x5ecb56));_0x556b2c['terminate']();}}function _0x312cf8(_0x46be2b){try{if(_0x46be2b){var _0x2b2811=JSON[_0xdc82('0x13')](_0x46be2b);switch(_0x2b2811[_0xdc82('0x14')]){case 0x0:if(_0x2b2811['result']){if(_0x2b2811['result'][_0xdc82('0x15')]){logger['info'](_0xdc82('0x16'),JSON[_0xdc82('0xe')](_0x2b2811[_0xdc82('0x17')][_0xdc82('0x18')]));_0x57eff1=_0x2b2811[_0xdc82('0x17')]['hypotheses'][0x0][_0xdc82('0x19')];_0x750052=_0x2b2811[_0xdc82('0x17')]['hypotheses'][0x0]['likelihood'];_0x471416='0';_0x1b5d90=_0xdc82('0x1a');_0x556b2c['terminate']();}}break;case 0x1:logger[_0xdc82('0xa')](_0xdc82('0x7'));_0x471416='1';_0x1b5d90=_0xdc82('0x7');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x471416='2';_0x1b5d90=_0xdc82('0x1b');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x471416='9';_0x1b5d90=_0xdc82('0x1c');break;case 0xa:logger['info'](_0xdc82('0x1d'));_0x471416='10';_0x1b5d90='Authentication\x20failed.';break;case 0xb:logger[_0xdc82('0xa')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x471416='11';_0x1b5d90=_0xdc82('0x1e');}}}catch(_0x42a7eb){logger['error'](_0xdc82('0x1f'),JSON[_0xdc82('0xe')](_0x42a7eb));_0x556b2c[_0xdc82('0x20')]();}}function _0x204649(){logger[_0xdc82('0xa')](_0xdc82('0x21'));_0x3a41e9({'transcript':_0x57eff1,'confidence':_0x750052,'status':_0x471416,'status_message':_0x1b5d90});}function _0x283895(_0x1adbb0){logger[_0xdc82('0x11')](_0xdc82('0x22'));if(!_['isNil'](_0x1adbb0)){logger['error'](_['isObject'](_0x1adbb0)?JSON[_0xdc82('0xe')](_0x1adbb0):_0x1adbb0);}}_0x556b2c['on'](_0xdc82('0x23'),_0x4cee01);_0x556b2c['on']('message',_0x312cf8);_0x556b2c['on'](_0xdc82('0x10'),_0x204649);_0x556b2c['on']('error',_0x283895);});}; \ No newline at end of file +var _0xdb0b=['final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xdb0b,0xe1));var _0xbdb0=function(_0x958d51,_0x4e73fe){_0x958d51=_0x958d51-0x0;var _0x4a5a95=_0xdb0b[_0x958d51];return _0x4a5a95;};'use strict';var BPromise=require('bluebird');var _=require(_0xbdb0('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbdb0('0x1'));var crypto=require('crypto');var logger=require(_0xbdb0('0x2'))(_0xbdb0('0x3'));module[_0xbdb0('0x4')]=function(_0x465f96,_0x364681,_0x4ab10f,_0xc9f29e){return new BPromise(function(_0x22fba0,_0x37749f){logger[_0xbdb0('0x5')](_0xbdb0('0x6'),_0xc9f29e||_0xbdb0('0x7'));var _0x1e64ff=new WebSocket(_0xc9f29e||_0xbdb0('0x7'),{'perMessageDeflate':![]});var _0x5dd47e='';var _0x5f65c1='0';var _0x33a440='1';var _0x334528=_0xbdb0('0x8');function _0x4fb13a(_0xbcf390){var _0x3cf4ac=crypto['createHash'](_0xbdb0('0x9'));_0x3cf4ac[_0xbdb0('0xa')](_0xbcf390);return _0x3cf4ac[_0xbdb0('0xb')](_0xbdb0('0xc'));}function _0x184fe7(){try{logger[_0xbdb0('0x5')](_0xbdb0('0xd'));var _0x4bb052=moment()[_0xbdb0('0xe')]();var _0x4e3ce2=_0x4fb13a(_0x4bb052+_0x364681+_0x4ab10f);_0x1e64ff[_0xbdb0('0xf')](JSON[_0xbdb0('0x10')]({'appID':_0x364681,'timestamp':_0x4bb052,'appKey':_0x4e3ce2}));var _0xb2998=fs[_0xbdb0('0x11')](_0x465f96);_0xb2998['on'](_0xbdb0('0x12'),function(_0x496a7b){_0x1e64ff[_0xbdb0('0xf')](_0x496a7b);});_0xb2998['on'](_0xbdb0('0x13'),function(){_0x1e64ff['send'](_0xbdb0('0x14'));});}catch(_0x5e62dd){logger[_0xbdb0('0x15')](_0xbdb0('0x16'),JSON[_0xbdb0('0x10')](_0x5e62dd));_0x1e64ff[_0xbdb0('0x17')]();}}function _0x4a30a0(_0x76069b){try{if(_0x76069b){var _0x524782=JSON[_0xbdb0('0x18')](_0x76069b);switch(_0x524782[_0xbdb0('0x19')]){case 0x0:if(_0x524782[_0xbdb0('0x1a')]){if(_0x524782[_0xbdb0('0x1a')][_0xbdb0('0x1b')]){logger['info'](_0xbdb0('0x1c'),JSON[_0xbdb0('0x10')](_0x524782[_0xbdb0('0x1a')]['hypotheses']));_0x5dd47e=_0x524782[_0xbdb0('0x1a')][_0xbdb0('0x1d')][0x0][_0xbdb0('0x1e')];_0x5f65c1=_0x524782[_0xbdb0('0x1a')][_0xbdb0('0x1d')][0x0][_0xbdb0('0x1f')];_0x33a440='0';_0x334528=_0xbdb0('0x20');_0x1e64ff[_0xbdb0('0x17')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x33a440='1';_0x334528=_0xbdb0('0x8');break;case 0x2:logger['info'](_0xbdb0('0x21'));_0x33a440='2';_0x334528='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x33a440='9';_0x334528='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xbdb0('0x5')](_0xbdb0('0x22'));_0x33a440='10';_0x334528=_0xbdb0('0x22');break;case 0xb:logger[_0xbdb0('0x5')](_0xbdb0('0x23'));_0x33a440='11';_0x334528=_0xbdb0('0x23');}}}catch(_0x2d2819){logger[_0xbdb0('0x15')](_0xbdb0('0x24'),JSON[_0xbdb0('0x10')](_0x2d2819));_0x1e64ff[_0xbdb0('0x17')]();}}function _0x345bf5(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x22fba0({'transcript':_0x5dd47e,'confidence':_0x5f65c1,'status':_0x33a440,'status_message':_0x334528});}function _0x34aa29(_0x52d9ab){logger[_0xbdb0('0x15')](_0xbdb0('0x25'));if(!_[_0xbdb0('0x26')](_0x52d9ab)){logger[_0xbdb0('0x15')](_[_0xbdb0('0x27')](_0x52d9ab)?JSON[_0xbdb0('0x10')](_0x52d9ab):_0x52d9ab);}}_0x1e64ff['on'](_0xbdb0('0x28'),_0x184fe7);_0x1e64ff['on'](_0xbdb0('0x29'),_0x4a30a0);_0x1e64ff['on'](_0xbdb0('0x13'),_0x345bf5);_0x1e64ff['on'](_0xbdb0('0x15'),_0x34aa29);});}; \ 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 750c8ad..e5293ae 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 _0xa813=['./asr','exports'];(function(_0x5f5164,_0xa128be){var _0x3ec41d=function(_0x3839fe){while(--_0x3839fe){_0x5f5164['push'](_0x5f5164['shift']());}};_0x3ec41d(++_0xa128be);}(_0xa813,0x17a));var _0x3a81=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xa813[_0x173441];return _0x2423a8;};var asr=require(_0x3a81('0x0'));module[_0x3a81('0x1')]={'asr':asr}; \ No newline at end of file +var _0x71fa=['exports'];(function(_0x42c128,_0x3d1fcc){var _0x3661db=function(_0x1c76ea){while(--_0x1c76ea){_0x42c128['push'](_0x42c128['shift']());}};_0x3661db(++_0x3d1fcc);}(_0x71fa,0x64));var _0xa71f=function(_0x63a46a,_0x3f0926){_0x63a46a=_0x63a46a-0x0;var _0x52b841=_0x71fa[_0x63a46a];return _0x52b841;};var asr=require('./asr');module[_0xa71f('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 03efe9e..034ef41 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x598419,_0x521a50){var _0x19c03c=function(_0x55b8ad){while(--_0x55b8ad){_0x598419['push'](_0x598419['shift']());}};_0x19c03c(++_0x521a50);}(_0x34e8,0x12c));var _0x834e=function(_0x8a07df,_0x85f200){_0x8a07df=_0x8a07df-0x0;var _0x2be95b=_0x34e8[_0x8a07df];return _0x2be95b;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 134b425..cd5cfb1 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 _0x0a9a=['callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','list_id','delay','add','minutes','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','isString','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','recordFile','intKey','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','mailRpc','prototype','rpc','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','scheduledAt'];(function(_0x3e7b5a,_0x4c06fe){var _0x4880aa=function(_0x2410ac){while(--_0x2410ac){_0x3e7b5a['push'](_0x3e7b5a['shift']());}};_0x4880aa(++_0x4c06fe);}(_0x0a9a,0x183));var _0xa0a9=function(_0x534bea,_0x1dc598){_0x534bea=_0x534bea-0x0;var _0xb6276=_0x0a9a[_0x534bea];return _0xb6276;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xa0a9('0x0'));var sh=require('shelljs');var odbc=require(_0xa0a9('0x1'))();var rs=require(_0xa0a9('0x2'));var moment=require(_0xa0a9('0x3'));var Mustache=require(_0xa0a9('0x4'));var rp=require('request-promise');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var scripts=require(_0xa0a9('0x7'));var FILES_PATH=_0xa0a9('0x8');var recursiveMapAttributes=[_0xa0a9('0x9'),_0xa0a9('0xa')];var verticesWithRetry=['menu',_0xa0a9('0xb'),'getsecretdigits'];var AGIVertices=function(_0x10aa8a,_0x221072,_0x12ce8a){this[_0xa0a9('0xc')]=_0x10aa8a;this['rpc']=_0x221072;this[_0xa0a9('0xd')]=_0x12ce8a;};AGIVertices[_0xa0a9('0xe')]['getVariable']=function(_0x5909cf,_0x13dc4a){this[_0xa0a9('0xf')]['getVariableById'](_0x5909cf)[_0xa0a9('0x10')](function(_0x5cc496){_0x13dc4a(null,_0x5cc496?_0x5cc496[_0xa0a9('0x11')]:![]);})['catch'](function(_0xb87a94){_0x13dc4a(_0xb87a94);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x12')]=function(_0x35e7cd,_0x13833c){this['rpc'][_0xa0a9('0x13')](_0x35e7cd)[_0xa0a9('0x10')](function(_0x31e716){_0x13833c(null,_0x31e716?_0x31e716[_0xa0a9('0x11')]:![]);})[_0xa0a9('0x14')](function(_0x1a7b8a){_0x13833c(_0x1a7b8a);});};AGIVertices['prototype'][_0xa0a9('0x15')]=function(_0x48c315,_0x4a57dd){this[_0xa0a9('0xf')][_0xa0a9('0x16')](_0x48c315)[_0xa0a9('0x10')](function(_0x16c3e3){_0x4a57dd(null,_0x16c3e3?_0x16c3e3['name']:![]);})[_0xa0a9('0x14')](function(_0x126401){_0x4a57dd(_0x126401);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x17')]=function(_0x292240,_0x3c1b3a){this['rpc'][_0xa0a9('0x18')](_0x292240)[_0xa0a9('0x10')](function(_0x4a8e80){_0x3c1b3a(null,_0x4a8e80?_0x4a8e80['dsn']:![]);})[_0xa0a9('0x14')](function(_0x1f6955){_0x3c1b3a(_0x1f6955);});};AGIVertices[_0xa0a9('0xe')]['getUser']=function(_0x307d7e,_0x4e6f4c){this[_0xa0a9('0xf')]['getUserById'](_0x307d7e)[_0xa0a9('0x10')](function(_0x504786){_0x4e6f4c(null,_0x504786?_0x504786[_0xa0a9('0x11')]:![]);})[_0xa0a9('0x14')](function(_0x4938da){_0x4e6f4c(_0x4938da);});};AGIVertices[_0xa0a9('0xe')]['getTrunk']=function(_0x20b318,_0x1f78e1){this[_0xa0a9('0xf')][_0xa0a9('0x19')](_0x20b318)['then'](function(_0x7c1502){_0x1f78e1(null,_0x7c1502?_0x7c1502[_0xa0a9('0x11')]:![]);})[_0xa0a9('0x14')](function(_0x3f4bea){_0x1f78e1(_0x3f4bea);});};AGIVertices['prototype'][_0xa0a9('0x1a')]=function(_0x38e454,_0x2eae30){var _0x5c446e=this;this['rpc'][_0xa0a9('0x1b')](_0x38e454)[_0xa0a9('0x10')](function(_0x10bbfd){_0x2eae30(null,_0x10bbfd?_0x5c446e[_0xa0a9('0x1c')](_0x10bbfd[_0xa0a9('0x1d')]):![]);})[_0xa0a9('0x14')](function(_0x2386c9){_0x2eae30(_0x2386c9);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1e')]=function(_0x42024c,_0x41e994){this['rpc'][_0xa0a9('0x1f')](_0x42024c)[_0xa0a9('0x10')](function(_0x4fc94a){_0x41e994(null,_0x4fc94a?_0x4fc94a:![]);})[_0xa0a9('0x14')](function(_0x122f56){_0x41e994(_0x122f56);});};AGIVertices['prototype']['sendMailMessage']=function(_0x45374e,_0x5291e3,_0x5a1095){this[_0xa0a9('0xd')][_0xa0a9('0x20')](_0x45374e,_0x5291e3)[_0xa0a9('0x10')](function(){_0x5a1095(null);})[_0xa0a9('0x14')](function(_0x37f2d){_0x5a1095(_0x37f2d);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x21')]=function(_0x4bbcc2,_0x366ba9){this[_0xa0a9('0xf')]['getIntervalById'](_0x4bbcc2)[_0xa0a9('0x10')](function(_0x2f98f6){if(_0x2f98f6){if(_0x2f98f6[_0xa0a9('0x22')]){_0x366ba9(null,[_0x2f98f6['interval']]);}else{_0x366ba9(null,_['map'](_0x2f98f6[_0xa0a9('0x23')],_0xa0a9('0x24')));}}else{_0x366ba9(null,![]);}})[_0xa0a9('0x14')](function(_0x42fd7a){_0x366ba9(_0x42fd7a);});};AGIVertices['prototype'][_0xa0a9('0x1c')]=function(_0x19a122){return util[_0xa0a9('0x25')]('%s/sounds/converted/%s',FILES_PATH,_0x19a122);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x26')]=function(_0x4e121e,_0x53dfd1,_0x3ae735){odbc[_0xa0a9('0x27')](_0x4e121e,function(_0x41c056){if(_0x41c056){logger[_0xa0a9('0x28')](_0xa0a9('0x29'),_0x41c056);_0x3ae735(_0x41c056);}else{logger[_0xa0a9('0x2a')](_0xa0a9('0x2b'));odbc[_0xa0a9('0x2c')](_0x53dfd1,function(_0x20e23d,_0x2ea301){if(_0x20e23d){logger[_0xa0a9('0x2a')](_0xa0a9('0x2d'),_0x53dfd1);_0x3ae735(_0x20e23d);}else{logger[_0xa0a9('0x2a')](_0xa0a9('0x2e'),_0x53dfd1);odbc[_0xa0a9('0x2f')](function(_0x1b1aff){if(_0x1b1aff){logger[_0xa0a9('0x28')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1b1aff);}_0x3ae735(null,_0x2ea301);});}});}});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x30')]=function(_0x3d3769,_0x5aadc9){this[_0xa0a9('0xf')][_0xa0a9('0x31')](_0x3d3769)[_0xa0a9('0x10')](function(_0xbbd377){_0x5aadc9(null,_0xbbd377?_0xbbd377:![]);})['catch'](function(_0x26ffb8){_0x5aadc9(_0x26ffb8);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x32')]=function(_0x17c40b,_0x38be3f){this['rpc'][_0xa0a9('0x32')](_0x17c40b)[_0xa0a9('0x10')](function(_0x39c02a){_0x38be3f(null,_0x39c02a);})[_0xa0a9('0x14')](function(_0x1c0fec){_0x38be3f(_0x1c0fec);});};AGIVertices['prototype'][_0xa0a9('0x33')]=function(_0x11c130,_0x27358c,_0x1a0c79){this[_0xa0a9('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0xa0a9('0xc')][_0xa0a9('0x34')],'node':_0x11c130['label'],'application':_0x11c130['agicommand'],'data':_0x27358c||null,'project_name':this[_0xa0a9('0xc')][_0xa0a9('0x35')],'callerid':this[_0xa0a9('0xc')][_0xa0a9('0x36')]})['then'](function(_0x464499){if(_0x1a0c79){_0x1a0c79(null,_0x464499);}})[_0xa0a9('0x14')](function(_0x1dc4ed){if(_0x1a0c79){_0x1a0c79(_0x1dc4ed);}});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x37')]=function(_0x1304e0,_0x39fa5b,_0x9690d6,_0xbdce0e){this[_0xa0a9('0xf')][_0xa0a9('0x37')]({'uniqueid':this[_0xa0a9('0xc')][_0xa0a9('0x34')],'callerid':this[_0xa0a9('0xc')][_0xa0a9('0x36')],'calleridname':this[_0xa0a9('0xc')][_0xa0a9('0x38')],'context':this['channel'][_0xa0a9('0x39')],'extension':this['channel'][_0xa0a9('0x3a')],'priority':this[_0xa0a9('0xc')][_0xa0a9('0x3b')],'accountcode':this[_0xa0a9('0xc')][_0xa0a9('0x3c')],'dnid':this[_0xa0a9('0xc')][_0xa0a9('0x3d')],'projectName':this[_0xa0a9('0xc')][_0xa0a9('0x35')],'saveName':_0x39fa5b,'filename':_0x1304e0['file']||_0x39fa5b,'savePath':_0x9690d6})[_0xa0a9('0x10')](function(_0x46a9ca){_0xbdce0e(null,_0x46a9ca);})[_0xa0a9('0x14')](function(_0x54cfa8){_0xbdce0e(_0x54cfa8);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x3e')]=function(_0x2c9c29,_0x4a35dd,_0xc1a16b,_0x7e1058,_0x2d0b1c){this[_0xa0a9('0xf')]['createSquareMessage']({'uniqueid':this[_0xa0a9('0xc')][_0xa0a9('0x34')],'body':_0x2c9c29,'direction':_0x4a35dd,'providerName':_0xc1a16b,'providerResponse':_0x7e1058})[_0xa0a9('0x10')](function(_0x2f97e2){if(_0x2d0b1c){_0x2d0b1c(null,_0x2f97e2);}})[_0xa0a9('0x14')](function(_0x41128b){if(_0x2d0b1c){_0x2d0b1c(_0x41128b);}});};AGIVertices[_0xa0a9('0xe')]['createCmContact']=function(_0x63cbda,_0x429c65){this['rpc'][_0xa0a9('0x3f')]({'firstName':_[_0xa0a9('0x40')](_0x63cbda[_0xa0a9('0x11')])||_['isNil'](_0x63cbda['name'])?_0xa0a9('0x41')+Math[_0xa0a9('0x42')]():_0x63cbda[_0xa0a9('0x11')],'lastName':_[_0xa0a9('0x40')](_0x63cbda['lastName'])||_['isNil'](_0x63cbda[_0xa0a9('0x43')])?null:_0x63cbda[_0xa0a9('0x43')],'phone':_0x63cbda['phone'],'ListId':_0x63cbda['list_id'],'scheduledat':_0x63cbda[_0xa0a9('0x44')],'callbackUniqueid':this[_0xa0a9('0xc')][_0xa0a9('0x34')],'tags':_0xa0a9('0x45'),'description':_0xa0a9('0x46')+_0x63cbda[_0xa0a9('0x44')][_0xa0a9('0x47')](),'priority':_0x63cbda[_0xa0a9('0x48')]})[_0xa0a9('0x10')](function(_0x23f1b1){_0x429c65(null,_0x23f1b1);})[_0xa0a9('0x14')](function(_0x52d34c){_0x429c65(_0x52d34c);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x49')]=function(_0xb0a05c,_0x481184){this[_0xa0a9('0xf')][_0xa0a9('0x4a')](_0xb0a05c)[_0xa0a9('0x10')](function(_0x4a1912){_0x481184(null,_0x4a1912?_0x4a1912[_0xa0a9('0x11')]:![]);})[_0xa0a9('0x14')](function(_0xe2d6f2){_0x481184(_0xe2d6f2);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x4b')]=function(_0x47107f,_0x12f97d,_0x577c1f){var _0x2b447f={'role':_0xa0a9('0x4c')};_0x2b447f[_0x47107f]=this[_0xa0a9('0xc')][_0xa0a9('0x36')];this[_0xa0a9('0xf')][_0xa0a9('0x4b')](_0x2b447f,_0x12f97d,this[_0xa0a9('0xc')]['uniqueid'])['then'](function(_0x4a2307){_0x577c1f(null,_[_0xa0a9('0x4d')](_0x4a2307)?![]:!![]);})['catch'](function(_0x331a0a){logger['error'](_0x331a0a);_0x577c1f(null,![]);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x4e')]=function(_0x5d06e0,_0x2f7ab4){var _0x31d3c0={'role':_0xa0a9('0x4c')};_0x31d3c0[_0x5d06e0]=this[_0xa0a9('0xc')][_0xa0a9('0x36')];this['rpc']['agentUnpause'](_0x31d3c0)[_0xa0a9('0x10')](function(_0x50249c){_0x2f7ab4(null,_[_0xa0a9('0x4d')](_0x50249c)?![]:!![]);})[_0xa0a9('0x14')](function(_0x3c526a){logger['error'](_0x3c526a);_0x2f7ab4(null,![]);});};AGIVertices[_0xa0a9('0xe')]['agentLogout']=function(_0x89b5bb,_0x194087){var _0x16873a={'role':'agent'};_0x16873a[_0x89b5bb]=this[_0xa0a9('0xc')]['callerid'];this[_0xa0a9('0xf')]['agentLogout'](_0x16873a)[_0xa0a9('0x10')](function(_0x4829f9){_0x194087(null,_[_0xa0a9('0x4d')](_0x4829f9)?![]:!![]);})[_0xa0a9('0x14')](function(_0x258aa4){logger[_0xa0a9('0x28')](_0x258aa4);_0x194087(null,![]);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x4f')]=function(_0x4cc06d,_0x2f5ea0){var _0x273a8c={'role':_0xa0a9('0x4c')};_0x273a8c[_0x4cc06d]=this['channel'][_0xa0a9('0x36')];var _0x184b0e=_0x4cc06d!=_0xa0a9('0x50')?util[_0xa0a9('0x25')](_0xa0a9('0x51'),'LOCAL',this[_0xa0a9('0xc')][_0xa0a9('0x36')]):undefined;this[_0xa0a9('0xf')][_0xa0a9('0x4f')](_0x273a8c,_0x184b0e)[_0xa0a9('0x10')](function(_0x3514d8){_0x2f5ea0(null,_[_0xa0a9('0x4d')](_0x3514d8)?![]:!![]);})[_0xa0a9('0x14')](function(_0x3a6b21){logger[_0xa0a9('0x28')](_0x3a6b21);_0x2f5ea0(null,![]);});};AGIVertices['prototype'][_0xa0a9('0x52')]=function(_0x1bae56,_0x183d4b){sh[_0xa0a9('0x53')](_[_0xa0a9('0x54')](_0x1bae56),function(_0x278cad,_0x1f47c){var _0x2bf2c2=_0x1f47c[_0xa0a9('0x55')](/(\r\n|\n|\r)/gm,'');_0x183d4b(null,_0x2bf2c2);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x56')]=function(_0x2915a4,_0x27cdcc){scripts[_0xa0a9('0x56')](_0x2915a4[_0xa0a9('0x57')],_0x2915a4[_0xa0a9('0x58')]||'text',_0x2915a4[_0xa0a9('0x59')],_0x2915a4['languageCode']||_0xa0a9('0x5a'),_0x2915a4['ssmlGender']||_0xa0a9('0x5b'),_0x2915a4[_0xa0a9('0x5c')]||_0xa0a9('0x5d'))[_0xa0a9('0x10')](function(_0x4755ce){_0x27cdcc(null,_0x4755ce);})[_0xa0a9('0x14')](function(_0x2aec78){_0x27cdcc(_0x2aec78);});};AGIVertices['prototype'][_0xa0a9('0x5e')]=function(_0x2faa44,_0x44a73b){scripts[_0xa0a9('0x5e')](_0x2faa44[_0xa0a9('0x59')],_0x2faa44[_0xa0a9('0x5f')]||'en',0x1)[_0xa0a9('0x10')](function(_0x23b7ca){_0x44a73b(null,_0x23b7ca);})[_0xa0a9('0x14')](function(_0x4da18d){_0x44a73b(_0x4da18d);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x60')]=function(_0x36dbf4,_0x2a0a40){var _0x465c12={'uri':_0x36dbf4[_0xa0a9('0x61')],'method':_0x36dbf4[_0xa0a9('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x36dbf4[_0xa0a9('0x63')])==='number'&&parseInt(_0x36dbf4[_0xa0a9('0x63')])>=0x1?parseInt(_0x36dbf4[_0xa0a9('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xa0a9('0x64'),_0xa0a9('0x65')],_0x465c12[_0xa0a9('0x62')][_0xa0a9('0x66')]())){try{_0x465c12[_0xa0a9('0x67')]=_0x36dbf4[_0xa0a9('0xa')]?JSON[_0xa0a9('0x68')](_0x36dbf4[_0xa0a9('0xa')]):{};}catch(_0x8a5178){logger[_0xa0a9('0x28')](_0xa0a9('0x69'),_0x8a5178);}}try{_0x465c12[_0xa0a9('0x6a')]=_0x36dbf4[_0xa0a9('0x9')]?JSON['parse'](_0x36dbf4['rawHeaders']):{};}catch(_0x3d809d){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3d809d);}if(_0x36dbf4[_0xa0a9('0x6b')]){try{var _0x2b408a=require(_0x36dbf4['computedVariables'])[_0xa0a9('0x6c')](this,_0x465c12);_0x465c12[_0xa0a9('0x6d')]=Mustache[_0xa0a9('0x6e')](_0x36dbf4[_0xa0a9('0x61')],_0x2b408a,{},['$$','$$']);if(_0x465c12[_0xa0a9('0x6a')]){_0x465c12[_0xa0a9('0x6a')]=JSON[_0xa0a9('0x68')](Mustache['render'](JSON[_0xa0a9('0x6f')](_0x465c12['headers']),_0x2b408a,{},['$$','$$']));}if(_0x465c12['body']){_0x465c12['body']=JSON[_0xa0a9('0x68')](Mustache[_0xa0a9('0x6e')](JSON['stringify'](_0x465c12[_0xa0a9('0x67')]),_0x2b408a,{},['$$','$$']));}}catch(_0x435f68){logger[_0xa0a9('0x28')](_0xa0a9('0x70'),_0x435f68);}}rp(_0x465c12)[_0xa0a9('0x10')](function(_0x26adae){var _0x1bd849={'statusCode':_0x26adae['statusCode']||0xc8,'statusMessage':_0x26adae[_0xa0a9('0x71')]||'OK','headers':_0x26adae['headers']||{},'body':_0x26adae[_0xa0a9('0x67')]||{}};_0x2a0a40(null,_0x1bd849);})[_0xa0a9('0x14')](function(_0x1a3fe4){var _0x132b50={'statusCode':_0x1a3fe4['statusCode']||0x1f4,'statusMessage':_0x1a3fe4['message']||_0xa0a9('0x72'),'headers':_0x1a3fe4[_0xa0a9('0x73')][_0xa0a9('0x6a')]||{},'body':_0x1a3fe4[_0xa0a9('0x73')][_0xa0a9('0x67')]||{}};_0x2a0a40(null,_0x132b50);});};AGIVertices[_0xa0a9('0xe')]['googleDialogflow']=function(_0x51bfd8,_0x44d006){scripts[_0xa0a9('0x74')](this[_0xa0a9('0xc')][_0xa0a9('0x34')],_0x51bfd8[_0xa0a9('0x75')],_0x51bfd8[_0xa0a9('0x59')],_0x51bfd8[_0xa0a9('0x76')]||'en')['then'](function(_0xfd9faf){_0x44d006(null,_0xfd9faf);})[_0xa0a9('0x14')](function(_0x503b24){_0x44d006(_0x503b24);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x77')]=function(_0x591449,_0x32575f){scripts[_0xa0a9('0x77')](this['channel']['uniqueid'],_0x591449['dialogflowV2_project_id'],_0x591449[_0xa0a9('0x78')],_0x591449['private_key'],_0x591449[_0xa0a9('0x59')],_0x591449[_0xa0a9('0x79')]||'en')[_0xa0a9('0x10')](function(_0x58e78e){_0x32575f(null,_0x58e78e);})['catch'](function(_0x51aa68){_0x32575f(_0x51aa68);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x7a')]=function(_0x4f0b5f,_0x53197f){scripts['sestekNDA'](this[_0xa0a9('0xc')],_0x4f0b5f)[_0xa0a9('0x10')](function(_0x295145){_0x53197f(null,_0x295145);})[_0xa0a9('0x14')](function(_0x50fae3){_0x53197f(_0x50fae3);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x7b')]=function(_0x5c943d,_0x455b37){scripts[_0xa0a9('0x7b')](_0x5c943d[_0xa0a9('0x75')],_0x5c943d['text'],_0x5c943d[_0xa0a9('0x7c')]||_0xa0a9('0x5a'),_0x5c943d[_0xa0a9('0x7d')])['then'](function(_0x10ff5a){_0x455b37(null,_0x10ff5a);})[_0xa0a9('0x14')](function(_0x5e793d){_0x455b37(_0x5e793d);});};AGIVertices[_0xa0a9('0xe')]['ispeechASR']=function(_0x565979,_0x930af7,_0x4ff01d){scripts['ispeechASR'](_0x930af7,_0x565979[_0xa0a9('0x75')],_0x565979[_0xa0a9('0x7e')]||'en-US',this[_0xa0a9('0x7f')](_0x565979['model'])?_0x565979[_0xa0a9('0x80')]:undefined)[_0xa0a9('0x10')](function(_0x5dc92b){_0x4ff01d(null,_0x5dc92b);})[_0xa0a9('0x14')](function(_0x130428){_0x4ff01d(_0x130428);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x81')]=function(_0x182ef3,_0x4ae8e2){scripts[_0xa0a9('0x81')](_0x182ef3[_0xa0a9('0x82')],_0x182ef3[_0xa0a9('0x83')],_0x182ef3[_0xa0a9('0x84')],_0x182ef3[_0xa0a9('0x85')]||'Amy',_0x182ef3[_0xa0a9('0x59')],_0x182ef3[_0xa0a9('0x86')]||_0xa0a9('0x59'))[_0xa0a9('0x10')](function(_0x48c9f5){_0x4ae8e2(null,_0x48c9f5);})[_0xa0a9('0x14')](function(_0x23a2bf){_0x4ae8e2(_0x23a2bf);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x87')]=function(_0x411c1a,_0x357bfe){scripts[_0xa0a9('0x87')](this['channel']['uniqueid'],_0x411c1a[_0xa0a9('0x82')],_0x411c1a[_0xa0a9('0x83')],_0x411c1a[_0xa0a9('0x88')],_0x411c1a[_0xa0a9('0x59')],_0x411c1a[_0xa0a9('0x89')])['then'](function(_0x4d3705){_0x357bfe(null,_0x4d3705);})[_0xa0a9('0x14')](function(_0x3ca8ed){_0x357bfe(_0x3ca8ed);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x8a')]=function(_0x3788d3,_0x19f07a,_0x3a742f){scripts[_0xa0a9('0x8a')](_0x19f07a,_0x3788d3[_0xa0a9('0x75')],_0x3788d3[_0xa0a9('0x8b')]||_0xa0a9('0x5a'))[_0xa0a9('0x10')](function(_0x27d117){_0x3a742f(null,_0x27d117);})[_0xa0a9('0x14')](function(_0x308196){_0x3a742f(_0x308196);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x8c')]=function(_0x160473,_0x3db961,_0x36a501){scripts[_0xa0a9('0x8c')](_0x3db961,_0x160473[_0xa0a9('0x8d')],_0x160473[_0xa0a9('0x8e')],_0x160473['uri'])['then'](function(_0x5cf91e){_0x36a501(null,_0x5cf91e);})[_0xa0a9('0x14')](function(_0x21e364){_0x36a501(_0x21e364);});};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x8f')]=function(_0x3ed1c3){var _0x283324=_['includes'](verticesWithRetry,_0x3ed1c3[_0xa0a9('0x90')])?_0x3ed1c3:_[_0xa0a9('0x91')](_0x3ed1c3);for(var _0x3b8d17 in _0x283324){if(_0x283324[_0xa0a9('0x92')](_0x3b8d17)){if(_0x283324[_0x3b8d17]&&_['isString'](_0x283324[_0x3b8d17])){if(_[_0xa0a9('0x93')](recursiveMapAttributes,_0x3b8d17)){_0x283324[_0x3b8d17]=this[_0xa0a9('0x94')](_0x283324[_0x3b8d17]);}else{_0x283324[_0x3b8d17]=this[_0xa0a9('0x95')](_0x283324[_0x3b8d17]);}}}}return _0x283324;};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x96')]=function(_0x6f0c1a){for(var _0x63e1f8 in _0x6f0c1a){if(_0x6f0c1a['hasOwnProperty'](_0x63e1f8)){if(_['isPlainObject'](_0x6f0c1a[_0x63e1f8])){this['recursiveNodeIndex'](_0x6f0c1a[_0x63e1f8]);}else if(_[_0xa0a9('0x97')](_0x6f0c1a[_0x63e1f8])){for(var _0x21bd11=0x0;_0x21bd11<_0x6f0c1a[_0x63e1f8][_0xa0a9('0x98')];_0x21bd11++){this[_0xa0a9('0x96')](_0x6f0c1a[_0x63e1f8][_0x21bd11]);}}else if(_['isString'](_0x6f0c1a[_0x63e1f8])){_0x6f0c1a[_0x63e1f8]=this['replaceAllVariables'](_0x6f0c1a[_0x63e1f8]);}}}};AGIVertices[_0xa0a9('0xe')]['saveRestApiResult']=function(_0x9d50c5,_0x5bdebb){for(var _0xb5dbbe in _0x9d50c5){if(_0x9d50c5[_0xa0a9('0x92')](_0xb5dbbe)){if(_['isPlainObject'](_0x9d50c5[_0xb5dbbe])){if(!_[_0xa0a9('0x40')](_0x9d50c5[_0xb5dbbe])){this[_0xa0a9('0x99')](_0x9d50c5[_0xb5dbbe],util['format'](_0xa0a9('0x9a'),_0x5bdebb,_0xb5dbbe));}}else if(_[_0xa0a9('0x97')](_0x9d50c5[_0xb5dbbe])){for(var _0xe93099=0x0;_0xe93099<_0x9d50c5[_0xb5dbbe][_0xa0a9('0x98')];_0xe93099++){this[_0xa0a9('0x99')](_0x9d50c5[_0xb5dbbe][_0xe93099],util[_0xa0a9('0x25')](_0xa0a9('0x9a'),_0x5bdebb,_0xb5dbbe+'['+_0xe93099+']'));}}else{if(!_['isNil'](_0x9d50c5[_0xb5dbbe])){this['channel'][_0xa0a9('0x9b')](util[_0xa0a9('0x25')]('%s.%s',_0x5bdebb,_0xb5dbbe),_0x9d50c5[_0xb5dbbe]);}}}}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x94')]=function(_0x13e6c5){try{var _0x2a1b0f=JSON[_0xa0a9('0x68')](_0x13e6c5);this[_0xa0a9('0x96')](_0x2a1b0f);return JSON['stringify'](_0x2a1b0f);}catch(_0x1b3c8e){return this['replaceAllVariables'](_0x13e6c5);}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x95')]=function(_0x54cc2e){var _0x8b0cdd=_0x54cc2e[_0xa0a9('0x9c')]('{');for(var _0x2f9e19=0x1;_0x2f9e19<_0x8b0cdd[_0xa0a9('0x98')];_0x2f9e19+=0x1){var _0x2c1e79=_0x8b0cdd[_0x2f9e19][_0xa0a9('0x9c')]('}');if(_0x2c1e79['length']>0x1){_0x54cc2e=_0x54cc2e[_0xa0a9('0x9d')]('{'+_0x2c1e79[0x0]+'}',this[_0xa0a9('0xc')][_0xa0a9('0x9e')](_0x2c1e79[0x0])[_0xa0a9('0x9f')]||_0x2c1e79[0x0]);}}if(_0x8b0cdd['length']===0x1){return _0x54cc2e[_0xa0a9('0x47')]();}return this['replaceAllVariables'](_0x54cc2e);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xa0')]=function(_0x44a188,_0x41dc60){var _0x49470a=this[_0xa0a9('0xc')][_0xa0a9('0x9e')](_0x44a188);if(_0x49470a['result']===-0x1){return _0x49470a;}logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xa1'),_0x41dc60,_0x49470a['extra']));return this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0x41dc60,_0x49470a[_0xa0a9('0x9f')]);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x7f')]=function(_0x1d0c93){return _0x1d0c93&&_0x1d0c93!=='0'&&_0x1d0c93!=='-1'&&_0x1d0c93!=='';};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xa2')]=function(_0x3de7b5){this['createSquareDetailsReport'][_0xa0a9('0x6c')](this,_0x3de7b5,'-');_0x3de7b5[_0xa0a9('0xa3')]=_0x3de7b5[_0xa0a9('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa0a9('0xe')]['mrcpsynth']=function(_0x5b5986){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xa4'),_0x5b5986[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x5b5986[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20text\x20configured');}var _0x3c9f79='\x22'+_0x5b5986[_0xa0a9('0x59')]+'\x22';if(this[_0xa0a9('0x7f')](_0x5b5986[_0xa0a9('0x73')])){_0x3c9f79+=','+_0x5b5986[_0xa0a9('0x73')];}var _0x3c1e9e=this[_0xa0a9('0xc')][_0xa0a9('0x53')]('MRCPSynth',_0x3c9f79);if(_0x3c1e9e[_0xa0a9('0xa7')]===-0x1){return _0x3c1e9e;}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0xa8'),_0x3c9f79));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xa9')]=function(_0x4a836e){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xaa'),_0x4a836e[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x4a836e[_0xa0a9('0xab')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20grammar\x20configured');}var _0x1dbada=_0x4a836e[_0xa0a9('0xab')];if(this[_0xa0a9('0x7f')](_0x4a836e[_0xa0a9('0x73')])){_0x1dbada+=','+_0x4a836e[_0xa0a9('0x73')];}var _0x2f2539=this[_0xa0a9('0xc')]['exec'](_0xa0a9('0xac'),_0x1dbada);if(_0x2f2539[_0xa0a9('0xa7')]===-0x1){return _0x2f2539;}var _0x91a180=this[_0xa0a9('0xa0')](_0xa0a9('0xad'),_0xa0a9('0xae'));if(_0x91a180[_0xa0a9('0xa7')]===-0x1){return _0x91a180;}var _0x436650=this[_0xa0a9('0xa0')](_0xa0a9('0xaf'),_0xa0a9('0xb0'));if(_0x436650[_0xa0a9('0xa7')]===-0x1){return _0x436650;}var _0x391446=this[_0xa0a9('0xa0')](_0xa0a9('0xb1'),_0xa0a9('0xb2'));if(_0x391446[_0xa0a9('0xa7')]===-0x1){return _0x391446;}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0xb3'),_0x1dbada));};AGIVertices['prototype'][_0xa0a9('0x6')]=function(_0x22841a){logger['info'](util[_0xa0a9('0x25')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x22841a['label']));return this[_0xa0a9('0xc')][_0xa0a9('0x6')]([_0x22841a[_0xa0a9('0xb4')],_0x22841a['args']]);};AGIVertices[_0xa0a9('0xe')]['answer']=function(_0x3ff32e){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xb5'),_0x3ff32e[_0xa0a9('0xa5')]));if(this[_0xa0a9('0x7f')](_0x3ff32e[_0xa0a9('0x63')])){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0xb6'),_0x3ff32e[_0xa0a9('0x63')]));var _0x27b2b9=this[_0xa0a9('0xc')][_0xa0a9('0xb7')](_0x3ff32e[_0xa0a9('0x63')]);if(_0x27b2b9['result']===-0x1){return _0x27b2b9;}}return this[_0xa0a9('0xc')][_0xa0a9('0xb8')]();};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x45')]=function(_0x14038e){logger['info'](util[_0xa0a9('0x25')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x14038e[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x14038e[_0xa0a9('0xb9')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x14038e,'no\x20list\x20selected');}_0x14038e[_0xa0a9('0x44')]=moment();if(this['isConfigured'](_0x14038e[_0xa0a9('0xba')])){_0x14038e[_0xa0a9('0x44')]=moment()[_0xa0a9('0xbb')](_0x14038e[_0xa0a9('0xba')],_0xa0a9('0xbc'));}if(!this['isConfigured'](_0x14038e[_0xa0a9('0x48')])){_0x14038e['callback_priority']=0x2;}this[_0xa0a9('0x3f')][_0xa0a9('0x6c')](this,_0x14038e);return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x14038e[_0xa0a9('0xbd')],_0x14038e['list_id'],_0x14038e[_0xa0a9('0x44')]));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xbe')]=function(_0x54f636){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0xbf'),_0x54f636['label']));var _0x58180d=this[_0xa0a9('0xc')]['exec'](_0x54f636['application'],_0x54f636['options']);if(_0x58180d[_0xa0a9('0xa7')]===-0x1){return _0x58180d;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('Executed\x20command\x20%s\x20%s',_0x54f636[_0xa0a9('0xc0')],_0x54f636['options']));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xc1')]=function(_0x3e6f25){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xc2'),_0x3e6f25[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x3e6f25[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}var _0x42628b='\x22'+_0x3e6f25[_0xa0a9('0x59')]+'\x22';if(this[_0xa0a9('0x7f')](_0x3e6f25['options'])){_0x42628b+=','+_0x3e6f25[_0xa0a9('0x73')];}var _0x2d43db=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0xc4'),_0x42628b);if(_0x2d43db[_0xa0a9('0xa7')]===-0x1){return _0x2d43db;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0xa8'),_0x42628b));};AGIVertices['prototype'][_0xa0a9('0xc5')]=function(_0x2d27bb){logger['info'](util['format'](_0xa0a9('0xc6'),_0x2d27bb[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x2d27bb[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}var _0x693cb8='\x22'+_0x2d27bb[_0xa0a9('0x59')]+'\x22';if(this[_0xa0a9('0x7f')](_0x2d27bb[_0xa0a9('0x73')])){_0x693cb8+=','+_0x2d27bb['options'];}var _0x5ba663=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0xc4'),_0x693cb8);if(_0x5ba663[_0xa0a9('0xa7')]===-0x1){return _0x5ba663;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xa8'),_0x693cb8));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xc7')]=function(_0x3c40e7){logger['info'](util[_0xa0a9('0x25')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3c40e7[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x3c40e7[_0xa0a9('0xab')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xc8'));}var _0x189a6d=_0x3c40e7[_0xa0a9('0xab')];if(this[_0xa0a9('0x7f')](_0x3c40e7[_0xa0a9('0x73')])){_0x189a6d+=','+_0x3c40e7[_0xa0a9('0x73')];}var _0x79cac0=this[_0xa0a9('0xc')][_0xa0a9('0x53')]('MRCPRecog',_0x189a6d);if(_0x79cac0[_0xa0a9('0xa7')]===-0x1){return _0x79cac0;}var _0x14a805=this[_0xa0a9('0xa0')]('RECOG_CONFIDENCE()',_0xa0a9('0xc9'));if(_0x14a805[_0xa0a9('0xa7')]===-0x1){return _0x14a805;}var _0x12b2fd=this[_0xa0a9('0xa0')]('RECOG_INPUT()',_0xa0a9('0xca'));if(_0x12b2fd[_0xa0a9('0xa7')]===-0x1){return _0x12b2fd;}var _0x397629=this[_0xa0a9('0xa0')]('RECOG_INSTANCE()',_0xa0a9('0xcb'));if(_0x397629[_0xa0a9('0xa7')]===-0x1){return _0x397629;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xb3'),_0x189a6d));};AGIVertices[_0xa0a9('0xe')]['sestekasr']=function(_0x132475){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x132475['label']));if(!this[_0xa0a9('0x7f')](_0x132475[_0xa0a9('0xab')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc8'));}var _0x519cf5=_0x132475[_0xa0a9('0xab')];if(this[_0xa0a9('0x7f')](_0x132475[_0xa0a9('0x73')])){_0x519cf5+=','+_0x132475['options'];}var _0x53b4b9=this[_0xa0a9('0xc')]['exec'](_0xa0a9('0xac'),_0x519cf5);if(_0x53b4b9[_0xa0a9('0xa7')]===-0x1){return _0x53b4b9;}var _0x1543ee=this['getAndSetVariable'](_0xa0a9('0xad'),'SESTEK_ASR_CONFIDENCE');if(_0x1543ee[_0xa0a9('0xa7')]===-0x1){return _0x1543ee;}var _0xd3816f=this['getAndSetVariable'](_0xa0a9('0xaf'),_0xa0a9('0xcc'));if(_0xd3816f['result']===-0x1){return _0xd3816f;}var _0xcd4e5b=this[_0xa0a9('0xa0')]('RECOG_INSTANCE()',_0xa0a9('0xcd'));if(_0xcd4e5b[_0xa0a9('0xa7')]===-0x1){return _0xcd4e5b;}return this['channel']['noop'](util[_0xa0a9('0x25')](_0xa0a9('0xb3'),_0x519cf5));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xce')]=function(_0x3ee61d){logger[_0xa0a9('0x2a')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3ee61d[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x3ee61d[_0xa0a9('0xcf')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x3ee61d,_0xa0a9('0xd0'));}var _0x568c78=this[_0xa0a9('0x17')][_0xa0a9('0x6c')](this,_0x3ee61d[_0xa0a9('0xcf')]);if(!_0x568c78){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x3ee61d,_0xa0a9('0xd1'));}if(!this['isConfigured'](_0x3ee61d[_0xa0a9('0x2c')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x3ee61d,_0xa0a9('0xd2'));}var _0x50987c=_0x3ee61d['query'][_0xa0a9('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xd3'),_0x50987c));var _0x6e8b08=this[_0xa0a9('0x26')][_0xa0a9('0x6c')](this,_0x568c78,_0x50987c);this['createSquareDetailsReport'][_0xa0a9('0x6c')](this,_0x3ee61d,_0x50987c);if(!this['isConfigured'](_0x3ee61d[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xd5'));}var _0x4761d5=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x3ee61d[_0xa0a9('0xd4')]);if(!_0x4761d5){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x3ee61d,_0xa0a9('0xd6'));}var _0x207e6f=this;_0x6e8b08['forEach'](function(_0x3f82e8,_0x5553ab){Object['keys'](_0x3f82e8)[_0xa0a9('0xd7')](function(_0x2776dc){_0x207e6f['channel']['setVariable'](util[_0xa0a9('0x25')](_0xa0a9('0xd8'),_0x4761d5,_0x5553ab,_0x2776dc),_0x3f82e8[_0x2776dc]);});});this[_0xa0a9('0xc')]['setVariable'](util[_0xa0a9('0x25')](_0xa0a9('0xd9'),_0x4761d5),_0x6e8b08[_0xa0a9('0x98')]);return this['channel'][_0xa0a9('0xa6')](util['format'](_0xa0a9('0xda'),_0x4761d5));};AGIVertices[_0xa0a9('0xe')]['dial']=function(_0x4c0f65){logger[_0xa0a9('0xdb')](util['format'](_0xa0a9('0xdc'),_0x4c0f65['label']));if(!this[_0xa0a9('0x7f')](_0x4c0f65[_0xa0a9('0xdd')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x4c0f65,'no\x20user\x20selected');}var _0x25c27b=this[_0xa0a9('0xde')][_0xa0a9('0x6c')](this,_0x4c0f65['sip_id']);if(!_0x25c27b){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x4c0f65,_0xa0a9('0xdf'));}var _0x1d3efd=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0xe0'),[util[_0xa0a9('0x25')](_0xa0a9('0xe1'),_0x25c27b),_0x4c0f65[_0xa0a9('0x63')],_0x4c0f65[_0xa0a9('0xe2')],_0x4c0f65['url']]);if(_0x1d3efd['result']===-0x1){return _0x1d3efd;}return this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xe3'),'DIAL'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0xe4')]=function(_0x4d1058){logger[_0xa0a9('0x2a')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4d1058[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x4d1058['key'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20key\x20configured');}if(!this[_0xa0a9('0x7f')](_0x4d1058[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xe5')]=!![];this['createSquareDetailsReport'](_0x4d1058);this[_0xa0a9('0x3e')](_0x4d1058[_0xa0a9('0x59')],'in','','');this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('Trying\x20Dialogflow:\x20%s',_0x4d1058['text']));var _0x425c9d=this[_0xa0a9('0x74')][_0xa0a9('0x6c')](this,_0x4d1058);if(_0x425c9d){for(var _0x142963 in _0x425c9d){if(_0x425c9d['hasOwnProperty'](_0x142963)){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util['format'](_0xa0a9('0xe6'),_0x142963[_0xa0a9('0x66')]()),_0x425c9d[_0x142963]);}}this[_0xa0a9('0x3e')](_0x425c9d[_0xa0a9('0xe7')],_0xa0a9('0xe8'),_0xa0a9('0xe4'),'');return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0xe9'),_0x425c9d[_0xa0a9('0xe7')]));}return this[_0xa0a9('0xc')]['error'](_0x4d1058,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['dialogflowV2']=function(_0x48cd82){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0xea'),_0x48cd82[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x48cd82[_0xa0a9('0xeb')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20project_id\x20configured');}if(!this[_0xa0a9('0x7f')](_0x48cd82[_0xa0a9('0x78')])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0xec'));}if(!this['isConfigured'](_0x48cd82['private_key'])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xed'));}if(!this['isConfigured'](_0x48cd82['dialogflowV2_language'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xee'));}if(!this[_0xa0a9('0x7f')](_0x48cd82['text'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xe5')]=!![];this[_0xa0a9('0x33')](_0x48cd82);this[_0xa0a9('0x3e')](_0x48cd82[_0xa0a9('0x59')],'in','','');this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xef'),_0x48cd82['text']));var _0x2f6e21=this[_0xa0a9('0x77')][_0xa0a9('0x6c')](this,_0x48cd82);if(_0x2f6e21){for(var _0x197d0f in _0x2f6e21){if(_0x2f6e21[_0xa0a9('0x92')](_0x197d0f)){if(_0x197d0f!==_0xa0a9('0xf0')){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util['format']('DIALOGFLOW_%s',_0x197d0f[_0xa0a9('0x66')]()),_0x2f6e21[_0x197d0f]);}}}this['createSquareMessage'](_0x2f6e21[_0xa0a9('0xe7')],_0xa0a9('0xe8'),_0xa0a9('0xf1'),_0x2f6e21[_0xa0a9('0xf0')]);return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0xf2'),_0x2f6e21[_0xa0a9('0xe7')]));}return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x48cd82,_0xa0a9('0xf3'));};AGIVertices['prototype'][_0xa0a9('0xf4')]=function(_0x3e4442){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0xf5'),_0x3e4442[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x3e4442['ndauth_url'])){return this['channel']['noop'](_0xa0a9('0xf6'));}if(!this[_0xa0a9('0x7f')](_0x3e4442['username'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xf7'));}if(!this[_0xa0a9('0x7f')](_0x3e4442[_0xa0a9('0xf8')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xf9'));}if(!this['isConfigured'](_0x3e4442[_0xa0a9('0xfa')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x3e4442);this[_0xa0a9('0x3e')](_0x3e4442[_0xa0a9('0x59')],'in','','');this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format']('Trying\x20SestekNDA:\x20%s',_0x3e4442[_0xa0a9('0x59')]));var _0x334e81=this[_0xa0a9('0x7a')][_0xa0a9('0x6c')](this,_0x3e4442);if(_0x334e81){for(var _0x38463d in _0x334e81){if(_0x334e81[_0xa0a9('0x92')](_0x38463d)){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util[_0xa0a9('0x25')](_0xa0a9('0xfb'),_0x38463d[_0xa0a9('0x66')]()),_0x334e81[_0x38463d]);}}this[_0xa0a9('0x3e')](_0x334e81[_0xa0a9('0xe7')],'out','sesteknda','');if(_0x334e81[_0xa0a9('0xfc')]){this[_0xa0a9('0xc')]['noop'](util['format'](_0xa0a9('0xfd'),_0x334e81[_0xa0a9('0xfc')]));var _0x3c9b49=this[_0xa0a9('0xc')][_0xa0a9('0xfe')](_0x334e81[_0xa0a9('0xfc')]);try{fs[_0xa0a9('0xff')](_0x334e81[_0xa0a9('0xfc')]+_0xa0a9('0x100'));}catch(_0x307abf){logger[_0xa0a9('0x28')](_0x307abf);}return _0x3c9b49;}else{return this['channel']['noop'](util['format'](_0xa0a9('0x101'),_0x334e81['speech']));}}return this['channel'][_0xa0a9('0x28')](_0x3e4442,_0xa0a9('0x102'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x103')]=function(_0xef2bd6){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x104'),_0xef2bd6[_0xa0a9('0xa5')]));return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0x103'));};AGIVertices['prototype'][_0xa0a9('0x105')]=function(_0xe0bda5){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe0bda5[_0xa0a9('0xa5')]));var _0x25b313='';if(_0xe0bda5['trunk_id']){if(!this[_0xa0a9('0x7f')](_0xe0bda5['trunk_id'])){return this['channel'][_0xa0a9('0x28')](_0xe0bda5,_0xa0a9('0x106'));}else{var _0x59c2a1=parseInt(_0xe0bda5[_0xa0a9('0x107')],0xa);if(isNaN(_0x59c2a1)){_0x25b313=_0xe0bda5[_0xa0a9('0x107')];}else{_0x25b313=this['getTrunk'][_0xa0a9('0x6c')](this,_0xe0bda5[_0xa0a9('0x107')]);if(!_0x25b313){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0xe0bda5,_0xa0a9('0x108'));}}}}else if(_0xe0bda5[_0xa0a9('0x109')]){_0x25b313=_0xe0bda5[_0xa0a9('0x109')];}else{return this[_0xa0a9('0xc')]['error'](_0xe0bda5,_0xa0a9('0x106'));}var _0x34c880=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0xe0'),[util[_0xa0a9('0x25')](_0xa0a9('0x10a'),_0x25b313,_0xe0bda5[_0xa0a9('0xbd')]),_0xe0bda5[_0xa0a9('0x63')],_0xe0bda5[_0xa0a9('0xe2')],_0xe0bda5[_0xa0a9('0x61')]]);if(_0x34c880[_0xa0a9('0xa7')]===-0x1){return _0x34c880;}return this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('Executed\x20command\x20%s',_0xa0a9('0xe0')));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x10b')]=function(_0x481ae1){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x10c'),_0x481ae1['label']));return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x10b'));};AGIVertices['prototype'][_0xa0a9('0xb')]=function(_0x170e40){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x170e40[_0xa0a9('0xa5')]));if(_0x170e40[_0xa0a9('0xa3')]===0x0){return this[_0xa0a9('0xa2')](_0x170e40);}_0x170e40[_0xa0a9('0xa3')]-=0x1;if(!this[_0xa0a9('0x7f')](_0x170e40[_0xa0a9('0x10d')])){return this['channel']['error'](_0x170e40,'no\x20file\x20audio\x20selected');}var _0x26ea60=this[_0xa0a9('0x1a')][_0xa0a9('0x6c')](this,_0x170e40[_0xa0a9('0x10d')]);if(!_0x26ea60){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x170e40,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x170e40[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5403b1=this[_0xa0a9('0xc')]['getData'](_0x26ea60,_0x170e40['response'],_0x170e40[_0xa0a9('0x10e')]);var _0x22b3a3=_0x5403b1['result']?_0x5403b1[_0xa0a9('0xa7')][_0xa0a9('0x47')]():'';logger[_0xa0a9('0x2a')]('test',JSON[_0xa0a9('0x6f')](_0x5403b1));if(_0x5403b1[_0xa0a9('0xa7')]===-0x1){this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x170e40,_0x22b3a3);return _0x5403b1;}else if(_0x5403b1['extra']===_0xa0a9('0x63')){_0x5403b1[_0xa0a9('0xa7')]=_0x22b3a3[_0xa0a9('0x98')]>=parseInt(_0x170e40[_0xa0a9('0x10f')])?'x':'i';}else{_0x5403b1[_0xa0a9('0xa7')]=_0x22b3a3[_0xa0a9('0x98')]>=parseInt(_0x170e40[_0xa0a9('0x10f')])&&_0x22b3a3['length']<=parseInt(_0x170e40['maxdigit'])?'x':'i';}var _0x51c79b=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x170e40[_0xa0a9('0xd4')]);if(!_0x51c79b){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x170e40,'no\x20variable\x20found');}this['channel'][_0xa0a9('0x9b')](_0x51c79b,_0x22b3a3);if(this[_0xa0a9('0x7f')](_0x170e40[_0xa0a9('0x110')])){var _0x57f984=parseInt(_0x170e40[_0xa0a9('0x110')],0xa);var _0x31b519=rs[_0xa0a9('0x111')]({'charset':'*','length':_0x57f984});var _0x3fa016=_0x22b3a3[_0xa0a9('0x98')];if(_0x3fa016>0x0){if(_0x3fa016>_0x57f984){this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x170e40,_0x170e40[_0xa0a9('0x112')]===_0xa0a9('0x113')?_0x31b519+_0x22b3a3[_0xa0a9('0x114')](_0x57f984):_0x22b3a3['substr'](0x0,_0x3fa016-_0x57f984)+_0x31b519);}else{this['createSquareDetailsReport'][_0xa0a9('0x6c')](this,_0x170e40,rs[_0xa0a9('0x111')]({'charset':'*','length':_0x3fa016}));}}else{this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x170e40,'');}}else{this[_0xa0a9('0x33')]['sync'](this,_0x170e40,_0x22b3a3);}return _0x5403b1;};AGIVertices['prototype'][_0xa0a9('0x115')]=function(_0x33cab2){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x33cab2[_0xa0a9('0xa5')]));return this[_0xa0a9('0xb')](_0x33cab2);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x116')]=function(_0x8c4d7b){logger['info'](util['format'](_0xa0a9('0x117'),_0x8c4d7b['label']));this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x8c4d7b,_0x8c4d7b['goalname']);return this['channel'][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x118'),_0x8c4d7b[_0xa0a9('0x119')]));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x11a')]=function(_0xcb18a8){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x11b'),_0xcb18a8['label']));if(!this[_0xa0a9('0x7f')](_0xcb18a8['aws_access_key_id'])||!this[_0xa0a9('0x7f')](_0xcb18a8[_0xa0a9('0x83')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xa0a9('0x7f')](_0xcb18a8['text'])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x11c'),_0xcb18a8[_0xa0a9('0x59')]));var _0x53707c=this[_0xa0a9('0x81')][_0xa0a9('0x6c')](this,_0xcb18a8);if(_0x53707c){this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x11d'),_0x53707c));var _0x527505=this[_0xa0a9('0xc')]['streamFile'](_0x53707c);try{fs[_0xa0a9('0xff')](_0x53707c+_0xa0a9('0x100'));}catch(_0x315f78){logger[_0xa0a9('0x28')](_0x315f78);}return _0x527505;}return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0xcb18a8,_0xa0a9('0x11e'));};AGIVertices['prototype'][_0xa0a9('0x11f')]=function(_0x460151){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x120'),_0x460151[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x460151[_0xa0a9('0x82')])||!this[_0xa0a9('0x7f')](_0x460151[_0xa0a9('0x83')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0x121'));}if(!this[_0xa0a9('0x7f')](_0x460151['aws_bot_name'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x122'));}if(!this[_0xa0a9('0x7f')](_0x460151[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this['channel'][_0xa0a9('0xe5')]=!![];this[_0xa0a9('0x33')](_0x460151);this[_0xa0a9('0x3e')](_0x460151[_0xa0a9('0x59')],'in','','');this['channel'][_0xa0a9('0xa6')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x460151[_0xa0a9('0x59')]));var _0x4c5e90=this[_0xa0a9('0x87')]['sync'](this,_0x460151);if(_0x4c5e90){for(var _0x39c99b in _0x4c5e90){if(_0x4c5e90[_0xa0a9('0x92')](_0x39c99b)&&_[_0xa0a9('0x123')](_0x4c5e90[_0x39c99b])){this[_0xa0a9('0xc')]['setVariable'](util[_0xa0a9('0x25')]('AWS_LEX_%s',_0x39c99b[_0xa0a9('0x66')]()),_0x4c5e90[_0x39c99b]);}}if(_[_0xa0a9('0x4d')](_0x4c5e90['message'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x124'));}else{this['createSquareMessage'](_0x4c5e90[_0xa0a9('0x125')],_0xa0a9('0xe8'),'amazonlex','');return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x4c5e90['message']));}}return this['channel'][_0xa0a9('0x28')](_0x460151,_0xa0a9('0x126'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x127')]=function(_0x533fbd){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x128'),_0x533fbd[_0xa0a9('0xa5')],_0x533fbd[_0xa0a9('0x63')]));if(!this[_0xa0a9('0x7f')](_0x533fbd[_0xa0a9('0x75')])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0x129'));}var _0x14ca83=_0xa0a9('0x12a');var _0x12beca=util[_0xa0a9('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xa0a9('0x111')](0x4));var _0x3c4a85=util[_0xa0a9('0x25')](_0xa0a9('0x9a'),_0x12beca,_0x14ca83);var _0x41b80b=!![];if(_0x533fbd[_0xa0a9('0x12b')]==='NOBEEP'){_0x41b80b=![];}var _0x46ef3a=this[_0xa0a9('0xc')][_0xa0a9('0x12c')](_0x12beca,_0x14ca83,_0x533fbd[_0xa0a9('0x12d')],_0x533fbd[_0xa0a9('0x63')],undefined,_0x41b80b);if(_0x46ef3a['result']!==-0x1){this['channel']['noop'](util[_0xa0a9('0x25')]('google\x20%s\x20file\x20created',_0x3c4a85));var _0x215ca8=this[_0xa0a9('0x8a')][_0xa0a9('0x6c')](this,_0x533fbd,_0x3c4a85);if(_0x215ca8){for(var _0x27c8fa in _0x215ca8){if(_0x215ca8[_0xa0a9('0x92')](_0x27c8fa)){this['channel'][_0xa0a9('0x9b')](util[_0xa0a9('0x25')]('GOOGLE_ASR_%s',_0x27c8fa[_0xa0a9('0x66')]()),_0x215ca8[_0x27c8fa]);}}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('GoogleASR\x20Result\x20%s',JSON[_0xa0a9('0x6f')](_0x215ca8)));}}return _0x46ef3a;};AGIVertices['prototype'][_0xa0a9('0x12e')]=function(_0x4ab3a0){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4ab3a0[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x4ab3a0['appid'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x12f'));}if(!this['isConfigured'](_0x4ab3a0[_0xa0a9('0x8e')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x130'));}var _0x53c26d=_0xa0a9('0x12a');var _0x217f42=util[_0xa0a9('0x25')](_0xa0a9('0x131'),FILES_PATH,rs[_0xa0a9('0x111')](0x4));var _0x55e686=util[_0xa0a9('0x25')]('%s.%s',_0x217f42,_0x53c26d);var _0x117ab2=!![];if(_0x4ab3a0[_0xa0a9('0x12b')]===_0xa0a9('0x132')){_0x117ab2=![];}var _0xc45312=this[_0xa0a9('0xc')]['recordFile'](_0x217f42,_0x53c26d,_0x4ab3a0[_0xa0a9('0x12d')],_0x4ab3a0[_0xa0a9('0x63')],undefined,_0x117ab2);if(_0xc45312[_0xa0a9('0xa7')]!==-0x1){this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x133'),_0x55e686));var _0x2a481e=this['tildeASR'][_0xa0a9('0x6c')](this,_0x4ab3a0,_0x55e686);if(_0x2a481e){for(var _0x43ba25 in _0x2a481e){if(_0x2a481e[_0xa0a9('0x92')](_0x43ba25)){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util['format'](_0xa0a9('0x134'),_0x43ba25[_0xa0a9('0x66')]()),_0x2a481e[_0x43ba25]);}}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x135'),JSON[_0xa0a9('0x6f')](_0x2a481e)));}}return _0xc45312;};AGIVertices[_0xa0a9('0xe')]['gotoc']=function(_0x10ab6e){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x10ab6e[_0xa0a9('0xa5')]));return this['channel'][_0xa0a9('0x136')](_0x10ab6e[_0xa0a9('0x39')],_0x10ab6e[_0xa0a9('0x3a')],_0x10ab6e[_0xa0a9('0x3b')]);};AGIVertices['prototype']['gotoif']=function(_0x520373){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x137'),_0x520373[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x520373[_0xa0a9('0x138')])){return this['channel']['error'](_0x520373,_0xa0a9('0x139'));}try{var _0x254905=eval(_0x520373['condition'])?'true':_0xa0a9('0x13a');this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x13b'),_0x520373[_0xa0a9('0x138')],_0x254905));return{'code':0xc8,'result':_0x254905};}catch(_0x52579d){return{'code':0xc8,'result':_0xa0a9('0x13a')};}};AGIVertices[_0xa0a9('0xe')]['gotoiftime']=function(_0x326dc1){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x13c'),_0x326dc1['label']));if(!this[_0xa0a9('0x7f')](_0x326dc1['interval_id'])){return this['channel']['error'](_0x326dc1,_0xa0a9('0x13d'));}var _0x53a278=this[_0xa0a9('0x21')][_0xa0a9('0x6c')](this,_0x326dc1[_0xa0a9('0x13e')]);if(!_0x53a278){return this[_0xa0a9('0xc')]['error'](_0x326dc1,_0xa0a9('0x13f'));}for(var _0x2220c1=0x0;_0x2220c1<_0x53a278['length'];_0x2220c1+=0x1){var _0x558886=this[_0xa0a9('0xc')]['getVariable'](util[_0xa0a9('0x25')](_0xa0a9('0x140'),_0x53a278[_0x2220c1]));if(_0x558886[_0xa0a9('0xa7')]===-0x1){return _0x558886;}logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x141'),_0x53a278[_0x2220c1],_0x558886[_0xa0a9('0x9f')]));if(_0x558886[_0xa0a9('0x9f')]==='true'){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x141'),_0x53a278[_0x2220c1],_0xa0a9('0x142')));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x141'),_0x53a278[_0x2220c1],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x141'),_0x53a278[_0x2220c1],_0xa0a9('0x13a')));this[_0xa0a9('0xc')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x53a278[_0x2220c1],_0xa0a9('0x13a')));}}return{'code':0xc8,'result':_0xa0a9('0x13a')};};AGIVertices['prototype']['hangup']=function(_0x20a3b5){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x143'),_0x20a3b5['label']));return this[_0xa0a9('0xc')][_0xa0a9('0x144')]();};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x145')]=function(_0x1b009a){logger['info'](util['format'](_0xa0a9('0x146'),_0x1b009a['label']));if(!this[_0xa0a9('0x7f')](_0x1b009a[_0xa0a9('0x75')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x129'));}var _0x4a6125=_0xa0a9('0x12a');var _0x19761c=util[_0xa0a9('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xa0a9('0x111')](0x4));var _0x40632c=util[_0xa0a9('0x25')](_0xa0a9('0x9a'),_0x19761c,_0x4a6125);var _0x2f0486=!![];if(_0x1b009a[_0xa0a9('0x12b')]===_0xa0a9('0x132')){_0x2f0486=![];}var _0x5bddb1=this[_0xa0a9('0xc')][_0xa0a9('0x12c')](_0x19761c,_0x4a6125,_0x1b009a[_0xa0a9('0x12d')],_0x1b009a[_0xa0a9('0x63')],undefined,_0x2f0486);if(_0x5bddb1[_0xa0a9('0xa7')]!==-0x1){this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x147'),_0x40632c));var _0x1df97c=this['ispeechASR'][_0xa0a9('0x6c')](this,_0x1b009a,_0x40632c);if(_0x1df97c){for(var _0x4bfa83 in _0x1df97c){if(_0x1df97c[_0xa0a9('0x92')](_0x4bfa83)){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](util[_0xa0a9('0x25')](_0xa0a9('0x148'),_0x4bfa83[_0xa0a9('0x66')]()),_0x1df97c[_0x4bfa83]);}}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x1df97c)));}}return _0x5bddb1;};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x149')]=function(_0x27a388){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x14a'),_0x27a388['label']));if(!this['isConfigured'](_0x27a388[_0xa0a9('0x75')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0x129'));}if(!this[_0xa0a9('0x7f')](_0x27a388[_0xa0a9('0x59')])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x14b'),_0x27a388[_0xa0a9('0x59')]));var _0x30ec81=this[_0xa0a9('0x7b')][_0xa0a9('0x6c')](this,_0x27a388);if(_0x30ec81){this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('ispeech\x20%s\x20file\x20created',_0x30ec81));var _0x2588f4=this['channel'][_0xa0a9('0xfe')](_0x30ec81,_0x27a388[_0xa0a9('0x12d')]);try{fs[_0xa0a9('0xff')](_0x30ec81+_0xa0a9('0x100'));}catch(_0x49e173){logger[_0xa0a9('0x28')](_0x49e173);}return _0x2588f4;}return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x27a388,_0xa0a9('0x14c'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x14d')]=function(_0x1c291d){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x14e'),_0x1c291d[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x1c291d[_0xa0a9('0x14f')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x1c291d,_0xa0a9('0x150'));}logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa0a9('0xc')]['callerid'],_0x1c291d[_0xa0a9('0x14f')]));var _0xddf2a0=this['agentLogin'][_0xa0a9('0x6c')](this,_0x1c291d[_0xa0a9('0x14f')]);if(_0xddf2a0){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x151'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x1c291d[_0xa0a9('0x14f')]));this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1c291d[_0xa0a9('0x14f')]));return{'code':0xc8,'result':_0xa0a9('0x152')};}else{logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')]['callerid'],_0x1c291d[_0xa0a9('0x14f')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x1c291d[_0xa0a9('0x14f')]));return{'code':0xc8,'result':_0xa0a9('0x154')};}};AGIVertices['prototype']['logout']=function(_0x5000f9){logger['info'](util[_0xa0a9('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5000f9[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x5000f9[_0xa0a9('0x14f')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x5000f9,_0xa0a9('0x150'));}logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x155'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5000f9['findBy']));var _0x3671cb=this[_0xa0a9('0x156')][_0xa0a9('0x6c')](this,_0x5000f9[_0xa0a9('0x14f')]);if(_0x3671cb){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x151'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5000f9['findBy']));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x151'),this['channel'][_0xa0a9('0x36')],_0x5000f9[_0xa0a9('0x14f')]));return{'code':0xc8,'result':_0xa0a9('0x152')};}else{logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')]['callerid'],_0x5000f9['findBy']));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa0a9('0x36')],_0x5000f9[_0xa0a9('0x14f')]));return{'code':0xc8,'result':_0xa0a9('0x154')};}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x157')]=function(_0x41f41e){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x158'),_0x41f41e['label']));if(!this['isConfigured'](_0x41f41e[_0xa0a9('0x159')])){return this['channel']['error'](_0x41f41e,_0xa0a9('0x15a'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x15b'),_0x41f41e[_0xa0a9('0x159')]));var _0x5e6a97=eval(_0x41f41e['operation']);if(!this[_0xa0a9('0x7f')](_0x41f41e[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0xd5'));}var _0x2488a5=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x41f41e[_0xa0a9('0xd4')]);if(!_0x2488a5){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x41f41e,_0xa0a9('0xd6'));}if(_['isArray'](_0x5e6a97)){var _0x54c63c=this;_0x5e6a97[_0xa0a9('0xd7')](function(_0x370cb1,_0x3afa59){_0x54c63c['channel'][_0xa0a9('0x9b')](util['format']('%s[%s]',_0x2488a5,_0x3afa59),_0x370cb1);});return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('variable\x20%s[key]\x20set',_0x2488a5));}else{return this['channel']['setVariable'](_0x2488a5,_0x5e6a97);}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x15c')]=function(_0x45eadb){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x15d'),_0x45eadb[_0xa0a9('0xa5')]));if(_0x45eadb[_0xa0a9('0xa3')]===0x0){return this[_0xa0a9('0xa2')](_0x45eadb);}_0x45eadb[_0xa0a9('0xa3')]-=0x1;if(!this[_0xa0a9('0x7f')](_0x45eadb[_0xa0a9('0x10d')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x45eadb,'no\x20file\x20audio\x20selected');}var _0xfe6dc9=this[_0xa0a9('0x1a')][_0xa0a9('0x6c')](this,_0x45eadb[_0xa0a9('0x10d')]);if(!_0xfe6dc9){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x45eadb,_0xa0a9('0x15e'));}var _0x474ed9=this[_0xa0a9('0xc')][_0xa0a9('0x15f')](_0xfe6dc9,_0x45eadb['response'],_0x45eadb[_0xa0a9('0x160')]);var _0x1d1895=_0x474ed9['result'];if(_0x474ed9['result']===-0x1){this[_0xa0a9('0x33')]['sync'](this,_0x45eadb,'-1');return _0x474ed9;}else if(_0x474ed9['extra']===_0xa0a9('0x63')){_0x474ed9['result']=_0x474ed9[_0xa0a9('0xa7')]['length']>0x0?_0x474ed9[_0xa0a9('0xa7')]:'t';}else if(_[_0xa0a9('0x40')](_0x474ed9[_0xa0a9('0xa7')])){_0x474ed9[_0xa0a9('0xa7')]='#';_0x1d1895='#';}if(!this[_0xa0a9('0x7f')](_0x45eadb['variable_id'])){this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2ec38c=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x45eadb[_0xa0a9('0xd4')]);if(!_0x2ec38c){return this['channel']['error'](_0x45eadb,_0xa0a9('0xd6'));}this[_0xa0a9('0xc')]['setVariable'](_0x2ec38c,_0x1d1895);}this[_0xa0a9('0x33')]['sync'](this,_0x45eadb,_0x1d1895);return _0x474ed9;};AGIVertices['prototype'][_0xa0a9('0xa6')]=function(_0x53ba4f){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x161'),_0x53ba4f[_0xa0a9('0xa5')]));return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0x53ba4f[_0xa0a9('0x162')]||_0x53ba4f['label']);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x163')]=function(_0x342a28){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x164'),_0x342a28[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x342a28[_0xa0a9('0x14f')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x342a28,_0xa0a9('0x150'));}logger['info'](util[_0xa0a9('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x342a28['findBy']));var _0x4b0f0e=this[_0xa0a9('0x49')][_0xa0a9('0x6c')](this,_0x342a28[_0xa0a9('0x165')]);var _0x3fab02=this[_0xa0a9('0x4b')][_0xa0a9('0x6c')](this,_0x342a28['findBy'],_0x4b0f0e);if(_0x3fab02){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x342a28['findBy']));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa0a9('0x36')],_0x342a28[_0xa0a9('0x14f')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')]['callerid'],_0x342a28[_0xa0a9('0x14f')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa0a9('0x36')],_0x342a28['findBy']));return{'code':0xc8,'result':_0xa0a9('0x154')};}};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x166')]=function(_0x1b5cb8){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x167'),_0x1b5cb8[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x1b5cb8[_0xa0a9('0x10d')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x1b5cb8,_0xa0a9('0x168'));}var _0x39ecb8=this[_0xa0a9('0x1a')]['sync'](this,_0x1b5cb8[_0xa0a9('0x10d')]);if(!_0x39ecb8){return this['channel'][_0xa0a9('0x28')](_0x1b5cb8,_0xa0a9('0x15e'));}var _0x26a86e=this[_0xa0a9('0xc')]['exec'](_0xa0a9('0x169'),[_0x39ecb8,_0x1b5cb8['opts']]);if(_0x26a86e[_0xa0a9('0xa7')]===-0x1){return _0x26a86e;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x16a'),_0xa0a9('0x169'),_0x39ecb8));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x16b')]=function(_0x205587){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x16c'),_0x205587['label']));if(!this[_0xa0a9('0x7f')](_0x205587[_0xa0a9('0x16d')])){return this['channel']['error'](_0x205587,'no\x20queue\x20selected');}var _0x30b59e='';var _0x27f23b=parseInt(_0x205587[_0xa0a9('0x16d')],0xa);if(isNaN(_0x27f23b)){_0x30b59e=_0x205587[_0xa0a9('0x16d')];}else{_0x30b59e=this['getVoiceQueue'][_0xa0a9('0x6c')](this,_0x205587[_0xa0a9('0x16d')]);if(!_0x30b59e){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x205587,'no\x20queue\x20found');}}var _0x39fe97='';if(this[_0xa0a9('0x7f')](_0x205587[_0xa0a9('0x10d')])){var _0x1277d2=this[_0xa0a9('0x1a')][_0xa0a9('0x6c')](this,_0x205587['file_id']);if(_0x1277d2){_0x39fe97=_0x1277d2;}}this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x205587,_0x30b59e);if(_0x205587[_0xa0a9('0xe2')][_0xa0a9('0x16e')]('x')<0x0){_0x205587['opts']+='x';}if(_0x205587[_0xa0a9('0xe2')][_0xa0a9('0x16e')]('X')<0x0){_0x205587[_0xa0a9('0xe2')]+='X';}this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0xa0a9('0x16f'),_0x30b59e?_0x30b59e[_0xa0a9('0x170')]():'');var _0x28fc06=this[_0xa0a9('0xc')]['exec'](_0xa0a9('0x171'),[_0x30b59e,_0x205587[_0xa0a9('0xe2')],_0x205587[_0xa0a9('0x61')],_0x39fe97,_0x205587[_0xa0a9('0x63')],_0x205587[_0xa0a9('0x6')],_0x205587[_0xa0a9('0x172')],_0x205587[_0xa0a9('0x173')],'',_0x205587[_0xa0a9('0x174')]]);if(_0x28fc06[_0xa0a9('0xa7')]===-0x1){return _0x28fc06;}return this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0x16a'),_0xa0a9('0x171'),_0x30b59e));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x175')]=function(_0x131589){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x176'),_0x131589[_0xa0a9('0xa5')]));var _0xe199cb=_0x131589[_0xa0a9('0x177')]||_0xa0a9('0x12a');var _0x95e1cc=util[_0xa0a9('0x25')](_0xa0a9('0x178'),this[_0xa0a9('0xc')][_0xa0a9('0x34')],rs[_0xa0a9('0x111')](0x5));var _0x3dea59=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x95e1cc,_0xe199cb);var _0x30bdf5=util[_0xa0a9('0x25')](_0xa0a9('0x131'),FILES_PATH,_0x95e1cc);this[_0xa0a9('0x37')]['sync'](this,_0x131589,_0x95e1cc,_0x3dea59);this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0xa0a9('0x179'),_0x95e1cc);logger['info'](_0xa0a9('0x17a'),_0x30bdf5,_0xe199cb,_0x131589[_0xa0a9('0x17b')],_0x131589[_0xa0a9('0x63')]);return this[_0xa0a9('0xc')][_0xa0a9('0x12c')](_0x30bdf5,_0xe199cb,_0x131589[_0xa0a9('0x17b')],_0x131589[_0xa0a9('0x63')],undefined,!![]);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x17c')]=function(_0x3b65b3){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x17d'),_0x3b65b3[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x3b65b3['url'])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0x17e'));}var _0x119cac=this['restAPI'][_0xa0a9('0x6c')](this,_0x3b65b3);logger['info'](util[_0xa0a9('0x25')]('Response:',util[_0xa0a9('0x17f')](_0x119cac,{'showHidden':![],'depth':null})));if(!this[_0xa0a9('0x7f')](_0x3b65b3[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x180'));}var _0x37f444=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x3b65b3[_0xa0a9('0xd4')]);if(!_0x37f444){return this[_0xa0a9('0xc')]['error'](_0x3b65b3,_0xa0a9('0xd6'));}this['channel'][_0xa0a9('0x9b')](util[_0xa0a9('0x25')]('%s_STATUS_CODE',_0x37f444),_0x119cac[_0xa0a9('0x181')]?_0x119cac[_0xa0a9('0x181')]:_0xa0a9('0x182'));this[_0xa0a9('0xc')]['setVariable'](util[_0xa0a9('0x25')](_0xa0a9('0x183'),_0x37f444),_0x119cac['statusMessage']?_0x119cac[_0xa0a9('0x71')]:'OK');if(_0x119cac[_0xa0a9('0x67')]){try{this[_0xa0a9('0x99')](_0x119cac[_0xa0a9('0x67')],_0x37f444);}catch(_0x2a9c9f){logger[_0xa0a9('0x28')](util['format'](_0xa0a9('0x184'),_0x37f444));}}return this['channel']['noop'](util['format']('variable\x20%s\x20set',_0x37f444));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x185')]=function(_0x340024){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x186'),_0x340024['label']));return this['channel'][_0xa0a9('0x187')](_0x340024['digits'][_0xa0a9('0x55')](/\s+/g,''),_0x340024['escape_digits']);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x188')]=function(_0x57108f){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x189'),_0x57108f['label']));return this[_0xa0a9('0xc')][_0xa0a9('0x18a')](_0x57108f[_0xa0a9('0x18b')][_0xa0a9('0x55')](/\s+/g,''),_0x57108f[_0xa0a9('0x17b')]);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x18c')]=function(_0x4e6bb2){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x18d'),_0x4e6bb2[_0xa0a9('0xa5')]));return this['channel'][_0xa0a9('0x18e')](_0x4e6bb2[_0xa0a9('0x59')],_0x4e6bb2[_0xa0a9('0x17b')]);};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x18f')]=function(_0x2a27d6){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2a27d6[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x2a27d6['account_id'])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('no\x20mail\x20account\x20configured');}var _0x522c5b=this[_0xa0a9('0x1e')][_0xa0a9('0x6c')](this,_0x2a27d6[_0xa0a9('0x190')]);if(!_0x522c5b||!_0x522c5b[_0xa0a9('0x191')]){return this['channel'][_0xa0a9('0x28')](_0x2a27d6,_0xa0a9('0x192'));}var _0x480ba2={'from':util['format'](_0xa0a9('0x193'),_0x522c5b[_0xa0a9('0x11')],_0x522c5b[_0xa0a9('0x194')]||_0x522c5b[_0xa0a9('0x191')][_0xa0a9('0x195')]),'to':_0x2a27d6['to']||'','cc':_0x2a27d6['cc']||'','bcc':_0x2a27d6[_0xa0a9('0x196')]||'','subject':_0x2a27d6[_0xa0a9('0x197')],'html':_0x2a27d6['text'],'text':_0x2a27d6['text']};if(this[_0xa0a9('0x7f')](_0x2a27d6[_0xa0a9('0x198')])){}logger[_0xa0a9('0xdb')]('sendMail\x20message',JSON[_0xa0a9('0x6f')](_0x480ba2));this['createSquareDetailsReport'][_0xa0a9('0x6c')](this,_0x2a27d6,_0x2a27d6['account_id']);this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x522c5b[_0xa0a9('0x11')]));this[_0xa0a9('0x20')][_0xa0a9('0x6c')](this,_0x522c5b[_0xa0a9('0x199')],_0x480ba2);return this[_0xa0a9('0xc')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa0a9('0xe')]['sendFax']=function(_0x42585f){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x19a'),_0x42585f[_0xa0a9('0xa5')]));return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xa0a9('0xe')]['sendSMS']=function(_0x2792d7){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x19b'),_0x2792d7[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x2792d7['sms_account_id'])){return this[_0xa0a9('0xc')]['noop'](_0xa0a9('0x19c'));}var _0x46706a=this[_0xa0a9('0x30')][_0xa0a9('0x6c')](this,_0x2792d7[_0xa0a9('0x19d')]);if(!_0x46706a){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x2792d7,'no\x20sms\x20account\x20found');}var _0x52bb5b={'body':_0x2792d7[_0xa0a9('0x19e')],'phone':_0x2792d7['to']||'','SmsAccountId':_0x46706a['id']};logger[_0xa0a9('0xdb')](_0xa0a9('0x19f'),JSON['stringify'](_0x52bb5b));this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x2792d7,_0x2792d7[_0xa0a9('0x19d')]);this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x46706a[_0xa0a9('0x11')]));this[_0xa0a9('0x32')][_0xa0a9('0x6c')](this,_0x52bb5b);return this[_0xa0a9('0xc')][_0xa0a9('0xa6')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1a0')]=function(_0x1259f1){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x1a1'),_0x1259f1[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x1259f1[_0xa0a9('0xd4')])){return this[_0xa0a9('0xc')]['error'](_0x1259f1,_0xa0a9('0x1a2'));}var _0x5c0ae9=this['getVariable'][_0xa0a9('0x6c')](this,_0x1259f1['variable_id']);if(!_0x5c0ae9){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x1259f1,_0xa0a9('0xd6'));}return this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0x5c0ae9,_0x1259f1['variable_value']);};AGIVertices['prototype']['start']=function(_0x39255b){logger['info'](util['format'](_0xa0a9('0x1a3'),_0x39255b[_0xa0a9('0xa5')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x1a4'));var _0x1c845c=this['channel'][_0xa0a9('0x9e')](_0xa0a9('0x1a5'));if(!_['isEmpty'](_0x1c845c[_0xa0a9('0x9f')])){this[_0xa0a9('0xc')][_0xa0a9('0x34')]=_0x1c845c[_0xa0a9('0x9f')];}if(_0x39255b[_0xa0a9('0xb8')]==='yes'){this[_0xa0a9('0xc')]['noop'](_0xa0a9('0x1a6'));return this[_0xa0a9('0xc')][_0xa0a9('0xb8')]();}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x1a7'));};AGIVertices[_0xa0a9('0xe')]['subproject']=function(_0x423b44){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x1a8'),_0x423b44['label']));if(!this[_0xa0a9('0x7f')](_0x423b44[_0xa0a9('0x1a9')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x423b44,_0xa0a9('0x1aa'));}var _0x257a29=this[_0xa0a9('0x15')][_0xa0a9('0x6c')](this,_0x423b44['project_id']);if(!this[_0xa0a9('0x7f')](_0x257a29)){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x423b44,util[_0xa0a9('0x25')](_0xa0a9('0x1ab'),_0x423b44[_0xa0a9('0x1a9')]));}if(_0x257a29===this[_0xa0a9('0xc')][_0xa0a9('0x35')]){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x423b44,_0xa0a9('0x1ac'));}this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x423b44,_0x257a29);var _0xcecd05=this['channel'][_0xa0a9('0x53')](_0xa0a9('0x1ad'),util[_0xa0a9('0x25')](_0xa0a9('0x1ae'),config[_0xa0a9('0x6')][_0xa0a9('0x1af')]||_0xa0a9('0x1b0'),_0x257a29,this[_0xa0a9('0xc')][_0xa0a9('0x35')]));if(_0xcecd05[_0xa0a9('0xa7')]===-0x1){return _0xcecd05;}return this['channel']['noop'](util[_0xa0a9('0x25')](_0xa0a9('0x16a'),_0xa0a9('0x1ad'),_0x257a29));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1b1')]=function(_0x4ee731){logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x1b2'),_0x4ee731[_0xa0a9('0xa5')]));var _0x2039e6=this[_0xa0a9('0x52')][_0xa0a9('0x6c')](this,_0x4ee731[_0xa0a9('0xb4')]);this[_0xa0a9('0x33')][_0xa0a9('0x6c')](this,_0x4ee731,_0x4ee731['command']);if(this[_0xa0a9('0x7f')](_0x4ee731[_0xa0a9('0xd4')])){var _0x53a95f=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x4ee731[_0xa0a9('0xd4')]);if(_0x53a95f){this[_0xa0a9('0xc')][_0xa0a9('0x9b')](_0x53a95f,_0x2039e6);return this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x1b3'),_0x4ee731[_0xa0a9('0xb4')],_0x53a95f));}}return this['channel'][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x1b4'),_0x4ee731['command']));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1b5')]=function(_0x11535b){logger['info'](util[_0xa0a9('0x25')](_0xa0a9('0x1b6'),_0x11535b[_0xa0a9('0xa5')]));_0x11535b[_0xa0a9('0x59')]=_0x11535b[_0xa0a9('0x59')][_0xa0a9('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x11535b[_0xa0a9('0x57')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0x1b7'));}if(!this[_0xa0a9('0x7f')](_0x11535b[_0xa0a9('0x59')])){return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x1b8'),_0x11535b[_0xa0a9('0x59')]));var _0x5f461a=this[_0xa0a9('0x56')][_0xa0a9('0x6c')](this,_0x11535b);if(_0x5f461a){this['channel'][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x1b9'),_0x5f461a));var _0x253557=this['channel'][_0xa0a9('0xfe')](_0x5f461a);try{fs[_0xa0a9('0xff')](_0x5f461a+_0xa0a9('0x100'));}catch(_0x111157){logger[_0xa0a9('0x28')](_0x111157);}return _0x253557;}return this[_0xa0a9('0xc')]['error'](_0x11535b,_0xa0a9('0x1ba'));};AGIVertices[_0xa0a9('0xe')][_0xa0a9('0x1bb')]=function(_0x22beaf){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x1bc'),_0x22beaf[_0xa0a9('0xa5')]));_0x22beaf['text']=_0x22beaf['text'][_0xa0a9('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa0a9('0x7f')](_0x22beaf['text'])){return this['channel'][_0xa0a9('0xa6')](_0xa0a9('0xc3'));}this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x1bd'),_0x22beaf[_0xa0a9('0x59')]));var _0x1ae48c=this[_0xa0a9('0x5e')]['sync'](this,_0x22beaf);if(_0x1ae48c){this[_0xa0a9('0xc')]['noop'](util[_0xa0a9('0x25')](_0xa0a9('0x1be'),_0x1ae48c));var _0x27f802=this[_0xa0a9('0xc')][_0xa0a9('0xfe')](_0x1ae48c);try{fs['unlink'](_0x1ae48c+_0xa0a9('0x100'));}catch(_0x3095f3){logger[_0xa0a9('0x28')](_0x3095f3);}return _0x27f802;}return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x22beaf,_0xa0a9('0x1bf'));};AGIVertices['prototype']['unpause']=function(_0x5d0d21){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x1c0'),_0x5d0d21[_0xa0a9('0xa5')]));if(!this['isConfigured'](_0x5d0d21[_0xa0a9('0x14f')])){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x5d0d21,_0xa0a9('0x150'));}logger[_0xa0a9('0x2a')](util['format'](_0xa0a9('0x155'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21['findBy']));var _0x103d3b=this[_0xa0a9('0x4e')]['sync'](this,_0x5d0d21[_0xa0a9('0x14f')]);if(_0x103d3b){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x151'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21[_0xa0a9('0x14f')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util['format'](_0xa0a9('0x151'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21['findBy']));return{'code':0xc8,'result':_0xa0a9('0x152')};}else{logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21[_0xa0a9('0x14f')]));this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x153'),this[_0xa0a9('0xc')][_0xa0a9('0x36')],_0x5d0d21['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa0a9('0x1c1')]=function(_0x47ee14){logger[_0xa0a9('0x2a')](util[_0xa0a9('0x25')](_0xa0a9('0x1c2'),_0x47ee14['label']));var _0x3ba09e=this[_0xa0a9('0xc')][_0xa0a9('0x53')](_0xa0a9('0x1c3'),[_0x47ee14[_0xa0a9('0x1c4')],_0x47ee14[_0xa0a9('0x73')]]);if(_0x3ba09e[_0xa0a9('0xa7')]===-0x1){return _0x3ba09e;}return this[_0xa0a9('0xc')][_0xa0a9('0xa6')](util[_0xa0a9('0x25')](_0xa0a9('0x16a'),_0xa0a9('0x1c3'),_0x47ee14['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x1d173a){logger['info'](util['format'](_0xa0a9('0x1c5'),_0x1d173a[_0xa0a9('0xa5')]));if(!this[_0xa0a9('0x7f')](_0x1d173a['variable_id'])){return this['channel'][_0xa0a9('0x28')](_0x1d173a,'no\x20variable\x20selected');}var _0x5d879a=this[_0xa0a9('0x9e')][_0xa0a9('0x6c')](this,_0x1d173a['variable_id']);if(!_0x5d879a){return this[_0xa0a9('0xc')][_0xa0a9('0x28')](_0x1d173a,_0xa0a9('0xd6'));}var _0x14961c=this[_0xa0a9('0xc')][_0xa0a9('0x9e')](_0x5d879a);return{'code':0xc8,'result':_0x14961c[_0xa0a9('0x9f')]?_0x14961c[_0xa0a9('0x9f')]:'-'};};String['prototype']['replaceAll']=function(_0x60e20a,_0x5ad400){return this['split'](_0x60e20a)[_0xa0a9('0x1c6')](_0x5ad400);};module[_0xa0a9('0x1c7')]=AGIVertices; \ No newline at end of file +var _0x2b83=['127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','failure','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','lodash','shelljs','randomstring','moment','mustache','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','mailRpc','getVariable','rpc','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareOdbcById','dsn','prototype','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','error','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','callerid','createSquareRecording','uniqueid','calleridname','context','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','url','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','hasOwnProperty','isString','includes','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','googleDialogflowV2','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','.wav','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','restapi','no\x20url\x20configured','Response:','%s_STATUS_MESSAGE','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','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','template_id','sendMail\x20message','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22'];(function(_0x16f19f,_0x21af7d){var _0x2ac7fb=function(_0x24298c){while(--_0x24298c){_0x16f19f['push'](_0x16f19f['shift']());}};_0x2ac7fb(++_0x21af7d);}(_0x2b83,0x1d3));var _0x32b8=function(_0xad6193,_0x2cc8b5){_0xad6193=_0xad6193-0x0;var _0x47735e=_0x2b83[_0xad6193];return _0x47735e;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x32b8('0x0'));var sh=require(_0x32b8('0x1'));var odbc=require('odbc')();var rs=require(_0x32b8('0x2'));var moment=require(_0x32b8('0x3'));var Mustache=require(_0x32b8('0x4'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x32b8('0x5'));var config=require(_0x32b8('0x6'));var scripts=require('./scripts');var FILES_PATH=_0x32b8('0x7');var recursiveMapAttributes=['rawHeaders',_0x32b8('0x8')];var verticesWithRetry=[_0x32b8('0x9'),_0x32b8('0xa'),_0x32b8('0xb')];var AGIVertices=function(_0x5cc6b2,_0x46be90,_0x2c9e57){this['channel']=_0x5cc6b2;this['rpc']=_0x46be90;this[_0x32b8('0xc')]=_0x2c9e57;};AGIVertices['prototype'][_0x32b8('0xd')]=function(_0x31b795,_0x465672){this[_0x32b8('0xe')]['getVariableById'](_0x31b795)[_0x32b8('0xf')](function(_0x3b6bc6){_0x465672(null,_0x3b6bc6?_0x3b6bc6['name']:![]);})['catch'](function(_0x30d00a){_0x465672(_0x30d00a);});};AGIVertices['prototype'][_0x32b8('0x10')]=function(_0x4b838f,_0x37aa93){this[_0x32b8('0xe')][_0x32b8('0x11')](_0x4b838f)[_0x32b8('0xf')](function(_0x2645b0){_0x37aa93(null,_0x2645b0?_0x2645b0['name']:![]);})['catch'](function(_0x5e7b4f){_0x37aa93(_0x5e7b4f);});};AGIVertices['prototype']['getSquareProject']=function(_0x576593,_0x834da1){this['rpc']['getSquareProjectById'](_0x576593)[_0x32b8('0xf')](function(_0x2ce0ea){_0x834da1(null,_0x2ce0ea?_0x2ce0ea[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x599bc3){_0x834da1(_0x599bc3);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x38f02b,_0x2ffea2){this[_0x32b8('0xe')][_0x32b8('0x14')](_0x38f02b)['then'](function(_0x34cf64){_0x2ffea2(null,_0x34cf64?_0x34cf64[_0x32b8('0x15')]:![]);})[_0x32b8('0x13')](function(_0x39a4f1){_0x2ffea2(_0x39a4f1);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x17')]=function(_0x222c77,_0xcd4b26){this['rpc']['getUserById'](_0x222c77)[_0x32b8('0xf')](function(_0x4c7471){_0xcd4b26(null,_0x4c7471?_0x4c7471[_0x32b8('0x12')]:![]);})['catch'](function(_0x1a4c2b){_0xcd4b26(_0x1a4c2b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x18')]=function(_0x189c4a,_0x2df3dc){this['rpc'][_0x32b8('0x19')](_0x189c4a)[_0x32b8('0xf')](function(_0x3eea54){_0x2df3dc(null,_0x3eea54?_0x3eea54[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x29988d){_0x2df3dc(_0x29988d);});};AGIVertices['prototype'][_0x32b8('0x1a')]=function(_0x15a8bf,_0x3b0049){var _0x3e1598=this;this[_0x32b8('0xe')][_0x32b8('0x1b')](_0x15a8bf)[_0x32b8('0xf')](function(_0x39ce15){_0x3b0049(null,_0x39ce15?_0x3e1598[_0x32b8('0x1c')](_0x39ce15[_0x32b8('0x1d')]):![]);})[_0x32b8('0x13')](function(_0x2bc3ce){_0x3b0049(_0x2bc3ce);});};AGIVertices[_0x32b8('0x16')]['getMailAccount']=function(_0x424721,_0x21c9fb){this[_0x32b8('0xe')][_0x32b8('0x1e')](_0x424721)[_0x32b8('0xf')](function(_0x1d83a5){_0x21c9fb(null,_0x1d83a5?_0x1d83a5:![]);})[_0x32b8('0x13')](function(_0x28ed75){_0x21c9fb(_0x28ed75);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1f')]=function(_0x521bf4,_0x1833af,_0x3c1122){this[_0x32b8('0xc')][_0x32b8('0x1f')](_0x521bf4,_0x1833af)['then'](function(){_0x3c1122(null);})['catch'](function(_0x287a6b){_0x3c1122(_0x287a6b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x20')]=function(_0x12ff7d,_0x523736){this[_0x32b8('0xe')][_0x32b8('0x21')](_0x12ff7d)[_0x32b8('0xf')](function(_0x42e9bc){if(_0x42e9bc){if(_0x42e9bc[_0x32b8('0x22')]){_0x523736(null,[_0x42e9bc[_0x32b8('0x23')]]);}else{_0x523736(null,_[_0x32b8('0x24')](_0x42e9bc[_0x32b8('0x25')],'interval'));}}else{_0x523736(null,![]);}})[_0x32b8('0x13')](function(_0x5e8af2){_0x523736(_0x5e8af2);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1c')]=function(_0xcf7b7){return util[_0x32b8('0x26')](_0x32b8('0x27'),FILES_PATH,_0xcf7b7);};AGIVertices[_0x32b8('0x16')]['getQueryOdbc']=function(_0x152209,_0x22ed5a,_0x7e13a9){odbc['open'](_0x152209,function(_0x470653){if(_0x470653){logger['error'](_0x32b8('0x28'),_0x470653);_0x7e13a9(_0x470653);}else{logger[_0x32b8('0x29')](_0x32b8('0x2a'));odbc[_0x32b8('0x2b')](_0x22ed5a,function(_0x5e7b75,_0x140cce){if(_0x5e7b75){logger[_0x32b8('0x29')](_0x32b8('0x2c'),_0x22ed5a);_0x7e13a9(_0x5e7b75);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x22ed5a);odbc[_0x32b8('0x2d')](function(_0x385e5d){if(_0x385e5d){logger[_0x32b8('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x385e5d);}_0x7e13a9(null,_0x140cce);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x1aa6ef,_0x1dff0e){this[_0x32b8('0xe')]['getSmsAccountById'](_0x1aa6ef)[_0x32b8('0xf')](function(_0x14c109){_0x1dff0e(null,_0x14c109?_0x14c109:![]);})[_0x32b8('0x13')](function(_0x273d5f){_0x1dff0e(_0x273d5f);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x2f')]=function(_0x8dd996,_0x24bdaf){this['rpc'][_0x32b8('0x2f')](_0x8dd996)['then'](function(_0x5c0416){_0x24bdaf(null,_0x5c0416);})['catch'](function(_0x5eb159){_0x24bdaf(_0x5eb159);});};AGIVertices[_0x32b8('0x16')]['createSquareDetailsReport']=function(_0x2a3968,_0x52709b,_0x5bd1de){this[_0x32b8('0xe')][_0x32b8('0x30')]({'uniqueid':this[_0x32b8('0x31')]['uniqueid'],'node':_0x2a3968[_0x32b8('0x32')],'application':_0x2a3968[_0x32b8('0x33')],'data':_0x52709b||null,'project_name':this[_0x32b8('0x31')]['arg_1'],'callerid':this['channel'][_0x32b8('0x34')]})['then'](function(_0xb7406c){if(_0x5bd1de){_0x5bd1de(null,_0xb7406c);}})['catch'](function(_0x25957b){if(_0x5bd1de){_0x5bd1de(_0x25957b);}});};AGIVertices['prototype'][_0x32b8('0x35')]=function(_0x43b294,_0x155ed6,_0x17791d,_0x47eea4){this['rpc'][_0x32b8('0x35')]({'uniqueid':this[_0x32b8('0x31')][_0x32b8('0x36')],'callerid':this['channel']['callerid'],'calleridname':this[_0x32b8('0x31')][_0x32b8('0x37')],'context':this['channel'][_0x32b8('0x38')],'extension':this['channel']['extension'],'priority':this['channel'][_0x32b8('0x39')],'accountcode':this[_0x32b8('0x31')][_0x32b8('0x3a')],'dnid':this[_0x32b8('0x31')]['dnid'],'projectName':this[_0x32b8('0x31')][_0x32b8('0x3b')],'saveName':_0x155ed6,'filename':_0x43b294[_0x32b8('0x3c')]||_0x155ed6,'savePath':_0x17791d})[_0x32b8('0xf')](function(_0x1a5bd4){_0x47eea4(null,_0x1a5bd4);})[_0x32b8('0x13')](function(_0x25a2a8){_0x47eea4(_0x25a2a8);});};AGIVertices['prototype'][_0x32b8('0x3d')]=function(_0xf99c9d,_0x2eee28,_0x17d6bb,_0x13f936,_0x2726bf){this[_0x32b8('0xe')][_0x32b8('0x3d')]({'uniqueid':this[_0x32b8('0x31')]['uniqueid'],'body':_0xf99c9d,'direction':_0x2eee28,'providerName':_0x17d6bb,'providerResponse':_0x13f936})['then'](function(_0x4032f1){if(_0x2726bf){_0x2726bf(null,_0x4032f1);}})[_0x32b8('0x13')](function(_0x3694dc){if(_0x2726bf){_0x2726bf(_0x3694dc);}});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x3e')]=function(_0x17c46a,_0x4f7c6f){this[_0x32b8('0xe')][_0x32b8('0x3e')]({'firstName':_[_0x32b8('0x3f')](_0x17c46a[_0x32b8('0x12')])||_['isNil'](_0x17c46a[_0x32b8('0x12')])?_0x32b8('0x40')+Math[_0x32b8('0x41')]():_0x17c46a['name'],'lastName':_[_0x32b8('0x3f')](_0x17c46a[_0x32b8('0x42')])||_[_0x32b8('0x43')](_0x17c46a[_0x32b8('0x42')])?null:_0x17c46a[_0x32b8('0x42')],'phone':_0x17c46a[_0x32b8('0x44')],'ListId':_0x17c46a[_0x32b8('0x45')],'scheduledat':_0x17c46a['scheduledAt'],'callbackUniqueid':this[_0x32b8('0x31')]['uniqueid'],'tags':'callback','description':_0x32b8('0x46')+_0x17c46a[_0x32b8('0x47')][_0x32b8('0x48')](),'priority':_0x17c46a[_0x32b8('0x49')]})[_0x32b8('0xf')](function(_0x5e3e6f){_0x4f7c6f(null,_0x5e3e6f);})[_0x32b8('0x13')](function(_0x3b9694){_0x4f7c6f(_0x3b9694);});};AGIVertices[_0x32b8('0x16')]['getPause']=function(_0x1dbe22,_0x2e41ee){this[_0x32b8('0xe')]['getPauseById'](_0x1dbe22)[_0x32b8('0xf')](function(_0x531b62){_0x2e41ee(null,_0x531b62?_0x531b62[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x40e1dd){_0x2e41ee(_0x40e1dd);});};AGIVertices[_0x32b8('0x16')]['agentPause']=function(_0xa39ab2,_0x567733,_0x7b4b88){var _0x5a6b2c={'role':'agent'};_0x5a6b2c[_0xa39ab2]=this['channel'][_0x32b8('0x34')];this[_0x32b8('0xe')][_0x32b8('0x4a')](_0x5a6b2c,_0x567733,this[_0x32b8('0x31')]['uniqueid'])[_0x32b8('0xf')](function(_0x391244){_0x7b4b88(null,_[_0x32b8('0x43')](_0x391244)?![]:!![]);})[_0x32b8('0x13')](function(_0x5077e4){logger[_0x32b8('0x2e')](_0x5077e4);_0x7b4b88(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4b')]=function(_0x43003e,_0x43c677){var _0x5fdb5a={'role':'agent'};_0x5fdb5a[_0x43003e]=this[_0x32b8('0x31')]['callerid'];this['rpc'][_0x32b8('0x4b')](_0x5fdb5a)[_0x32b8('0xf')](function(_0x216faf){_0x43c677(null,_['isNil'](_0x216faf)?![]:!![]);})[_0x32b8('0x13')](function(_0x1d2c07){logger[_0x32b8('0x2e')](_0x1d2c07);_0x43c677(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4c')]=function(_0x58fc0a,_0x1d6d52){var _0x8fddf8={'role':_0x32b8('0x4d')};_0x8fddf8[_0x58fc0a]=this['channel'][_0x32b8('0x34')];this[_0x32b8('0xe')]['agentLogout'](_0x8fddf8)[_0x32b8('0xf')](function(_0x9b7424){_0x1d6d52(null,_[_0x32b8('0x43')](_0x9b7424)?![]:!![]);})[_0x32b8('0x13')](function(_0x4118ac){logger[_0x32b8('0x2e')](_0x4118ac);_0x1d6d52(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4e')]=function(_0x2b5963,_0x532664){var _0x1add74={'role':_0x32b8('0x4d')};_0x1add74[_0x2b5963]=this['channel'][_0x32b8('0x34')];var _0x527986=_0x2b5963!=_0x32b8('0x4f')?util[_0x32b8('0x26')](_0x32b8('0x50'),_0x32b8('0x51'),this[_0x32b8('0x31')][_0x32b8('0x34')]):undefined;this[_0x32b8('0xe')][_0x32b8('0x4e')](_0x1add74,_0x527986)['then'](function(_0x4f745d){_0x532664(null,_[_0x32b8('0x43')](_0x4f745d)?![]:!![]);})['catch'](function(_0x195b37){logger[_0x32b8('0x2e')](_0x195b37);_0x532664(null,![]);});};AGIVertices[_0x32b8('0x16')]['shellCommand']=function(_0x17a175,_0x21c969){sh['exec'](_[_0x32b8('0x52')](_0x17a175),function(_0x4f4d5c,_0xeb73b8){var _0x308ebd=_0xeb73b8[_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'');_0x21c969(null,_0x308ebd);});};AGIVertices[_0x32b8('0x16')]['googleCloudTTS']=function(_0x374be5,_0x58a585){scripts[_0x32b8('0x54')](_0x374be5[_0x32b8('0x55')],_0x374be5['google_cloud_tts_text_type']||'text',_0x374be5[_0x32b8('0x56')],_0x374be5[_0x32b8('0x57')]||_0x32b8('0x58'),_0x374be5[_0x32b8('0x59')]||_0x32b8('0x5a'),_0x374be5[_0x32b8('0x5b')]||_0x32b8('0x5c'))['then'](function(_0x1c7bd3){_0x58a585(null,_0x1c7bd3);})['catch'](function(_0x16bb7b){_0x58a585(_0x16bb7b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5d')]=function(_0x5655ae,_0x4d3044){scripts[_0x32b8('0x5d')](_0x5655ae[_0x32b8('0x56')],_0x5655ae[_0x32b8('0x5e')]||'en',0x1)[_0x32b8('0xf')](function(_0x504530){_0x4d3044(null,_0x504530);})[_0x32b8('0x13')](function(_0xcc2677){_0x4d3044(_0xcc2677);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5f')]=function(_0x4c84b0,_0x570c4c){var _0x3a389={'uri':_0x4c84b0['url'],'method':_0x4c84b0[_0x32b8('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4c84b0[_0x32b8('0x61')])==='number'&&parseInt(_0x4c84b0[_0x32b8('0x61')])>=0x1?parseInt(_0x4c84b0[_0x32b8('0x61')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x32b8('0x62'),'PUT'],_0x3a389[_0x32b8('0x60')][_0x32b8('0x63')]())){try{_0x3a389[_0x32b8('0x64')]=_0x4c84b0[_0x32b8('0x8')]?JSON[_0x32b8('0x65')](_0x4c84b0['rawBody']):{};}catch(_0x245785){logger[_0x32b8('0x2e')](_0x32b8('0x66'),_0x245785);}}try{_0x3a389[_0x32b8('0x67')]=_0x4c84b0[_0x32b8('0x68')]?JSON[_0x32b8('0x65')](_0x4c84b0[_0x32b8('0x68')]):{};}catch(_0x17f806){logger['error'](_0x32b8('0x69'),_0x17f806);}if(_0x4c84b0['computedVariables']){try{var _0x238c22=require(_0x4c84b0['computedVariables'])[_0x32b8('0x6a')](this,_0x3a389);_0x3a389['uri']=Mustache['render'](_0x4c84b0[_0x32b8('0x6b')],_0x238c22,{},['$$','$$']);if(_0x3a389[_0x32b8('0x67')]){_0x3a389['headers']=JSON[_0x32b8('0x65')](Mustache[_0x32b8('0x6c')](JSON[_0x32b8('0x6d')](_0x3a389[_0x32b8('0x67')]),_0x238c22,{},['$$','$$']));}if(_0x3a389['body']){_0x3a389[_0x32b8('0x64')]=JSON[_0x32b8('0x65')](Mustache['render'](JSON[_0x32b8('0x6d')](_0x3a389['body']),_0x238c22,{},['$$','$$']));}}catch(_0x3f4034){logger[_0x32b8('0x2e')](_0x32b8('0x6e'),_0x3f4034);}}rp(_0x3a389)[_0x32b8('0xf')](function(_0x39ee79){var _0x311055={'statusCode':_0x39ee79[_0x32b8('0x6f')]||0xc8,'statusMessage':_0x39ee79[_0x32b8('0x70')]||'OK','headers':_0x39ee79[_0x32b8('0x67')]||{},'body':_0x39ee79['body']||{}};_0x570c4c(null,_0x311055);})[_0x32b8('0x13')](function(_0x1f8918){var _0x2b08fd={'statusCode':_0x1f8918[_0x32b8('0x6f')]||0x1f4,'statusMessage':_0x1f8918[_0x32b8('0x71')]||_0x32b8('0x72'),'headers':_0x1f8918[_0x32b8('0x73')][_0x32b8('0x67')]||{},'body':_0x1f8918[_0x32b8('0x73')][_0x32b8('0x64')]||{}};_0x570c4c(null,_0x2b08fd);});};AGIVertices[_0x32b8('0x16')]['googleDialogflow']=function(_0x56e39c,_0x534990){scripts[_0x32b8('0x74')](this['channel'][_0x32b8('0x36')],_0x56e39c[_0x32b8('0x75')],_0x56e39c[_0x32b8('0x56')],_0x56e39c['dialogflow_language']||'en')[_0x32b8('0xf')](function(_0x235ebc){_0x534990(null,_0x235ebc);})['catch'](function(_0x2a5cb0){_0x534990(_0x2a5cb0);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x4d78ae,_0x543331){scripts['googleDialogflowV2'](this['channel'][_0x32b8('0x36')],_0x4d78ae['dialogflowV2_project_id'],_0x4d78ae[_0x32b8('0x76')],_0x4d78ae['private_key'],_0x4d78ae[_0x32b8('0x56')],_0x4d78ae[_0x32b8('0x77')]||'en')[_0x32b8('0xf')](function(_0x2524a5){_0x543331(null,_0x2524a5);})[_0x32b8('0x13')](function(_0x3eaa5b){_0x543331(_0x3eaa5b);});};AGIVertices['prototype']['sestekNDA']=function(_0x435b12,_0x25835f){scripts[_0x32b8('0x78')](this[_0x32b8('0x31')],_0x435b12)['then'](function(_0x4a4784){_0x25835f(null,_0x4a4784);})['catch'](function(_0x2a74f9){_0x25835f(_0x2a74f9);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x79')]=function(_0x4cc70b,_0x68be4a){scripts['ispeechTTS'](_0x4cc70b[_0x32b8('0x75')],_0x4cc70b[_0x32b8('0x56')],_0x4cc70b[_0x32b8('0x7a')]||_0x32b8('0x58'),_0x4cc70b[_0x32b8('0x7b')])['then'](function(_0x2b1e0f){_0x68be4a(null,_0x2b1e0f);})[_0x32b8('0x13')](function(_0x34738b){_0x68be4a(_0x34738b);});};AGIVertices['prototype']['ispeechASR']=function(_0x34b5c9,_0x49112b,_0x407889){scripts[_0x32b8('0x7c')](_0x49112b,_0x34b5c9[_0x32b8('0x75')],_0x34b5c9['ispeech_asr_language']||_0x32b8('0x58'),this[_0x32b8('0x7d')](_0x34b5c9[_0x32b8('0x7e')])?_0x34b5c9['model']:undefined)[_0x32b8('0xf')](function(_0x37dc1e){_0x407889(null,_0x37dc1e);})['catch'](function(_0x4d1606){_0x407889(_0x4d1606);});};AGIVertices[_0x32b8('0x16')]['awsPolly']=function(_0x8eb753,_0x12576d){scripts[_0x32b8('0x7f')](_0x8eb753[_0x32b8('0x80')],_0x8eb753[_0x32b8('0x81')],_0x8eb753[_0x32b8('0x82')],_0x8eb753['aws_polly_voice']||_0x32b8('0x83'),_0x8eb753[_0x32b8('0x56')],_0x8eb753[_0x32b8('0x84')]||_0x32b8('0x56'))[_0x32b8('0xf')](function(_0x2f755e){_0x12576d(null,_0x2f755e);})[_0x32b8('0x13')](function(_0x447166){_0x12576d(_0x447166);});};AGIVertices['prototype']['awsLex']=function(_0x1d7d11,_0x42b81a){scripts['awsLex'](this[_0x32b8('0x31')][_0x32b8('0x36')],_0x1d7d11[_0x32b8('0x80')],_0x1d7d11['aws_secret_access_key'],_0x1d7d11[_0x32b8('0x85')],_0x1d7d11[_0x32b8('0x56')],_0x1d7d11[_0x32b8('0x86')])[_0x32b8('0xf')](function(_0xde7870){_0x42b81a(null,_0xde7870);})[_0x32b8('0x13')](function(_0x358a9e){_0x42b81a(_0x358a9e);});};AGIVertices[_0x32b8('0x16')]['googleASR']=function(_0x3b833e,_0x42e387,_0x46f1c0){scripts['googleASR'](_0x42e387,_0x3b833e[_0x32b8('0x75')],_0x3b833e[_0x32b8('0x87')]||'en-US')[_0x32b8('0xf')](function(_0x2ed151){_0x46f1c0(null,_0x2ed151);})['catch'](function(_0x2ec386){_0x46f1c0(_0x2ec386);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x88')]=function(_0x481746,_0xbe98ae,_0x23c08d){scripts[_0x32b8('0x88')](_0xbe98ae,_0x481746[_0x32b8('0x89')],_0x481746[_0x32b8('0x8a')],_0x481746[_0x32b8('0x8b')])[_0x32b8('0xf')](function(_0x354f94){_0x23c08d(null,_0x354f94);})['catch'](function(_0x2cb2a8){_0x23c08d(_0x2cb2a8);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x8c')]=function(_0x286a12){var _0x29f9cf=_['includes'](verticesWithRetry,_0x286a12[_0x32b8('0x33')])?_0x286a12:_[_0x32b8('0x8d')](_0x286a12);for(var _0x41d6db in _0x29f9cf){if(_0x29f9cf[_0x32b8('0x8e')](_0x41d6db)){if(_0x29f9cf[_0x41d6db]&&_[_0x32b8('0x8f')](_0x29f9cf[_0x41d6db])){if(_[_0x32b8('0x90')](recursiveMapAttributes,_0x41d6db)){_0x29f9cf[_0x41d6db]=this['replaceObjectAllVariables'](_0x29f9cf[_0x41d6db]);}else{_0x29f9cf[_0x41d6db]=this[_0x32b8('0x91')](_0x29f9cf[_0x41d6db]);}}}}return _0x29f9cf;};AGIVertices[_0x32b8('0x16')][_0x32b8('0x92')]=function(_0x1e29a1){for(var _0x1ee08f in _0x1e29a1){if(_0x1e29a1[_0x32b8('0x8e')](_0x1ee08f)){if(_[_0x32b8('0x93')](_0x1e29a1[_0x1ee08f])){this[_0x32b8('0x92')](_0x1e29a1[_0x1ee08f]);}else if(_['isArray'](_0x1e29a1[_0x1ee08f])){for(var _0x2591dc=0x0;_0x2591dc<_0x1e29a1[_0x1ee08f]['length'];_0x2591dc++){this[_0x32b8('0x92')](_0x1e29a1[_0x1ee08f][_0x2591dc]);}}else if(_[_0x32b8('0x8f')](_0x1e29a1[_0x1ee08f])){_0x1e29a1[_0x1ee08f]=this['replaceAllVariables'](_0x1e29a1[_0x1ee08f]);}}}};AGIVertices['prototype'][_0x32b8('0x94')]=function(_0x2d666b,_0x69b331){for(var _0x33becf in _0x2d666b){if(_0x2d666b[_0x32b8('0x8e')](_0x33becf)){if(_['isPlainObject'](_0x2d666b[_0x33becf])){if(!_['isEmpty'](_0x2d666b[_0x33becf])){this[_0x32b8('0x94')](_0x2d666b[_0x33becf],util[_0x32b8('0x26')](_0x32b8('0x95'),_0x69b331,_0x33becf));}}else if(_[_0x32b8('0x96')](_0x2d666b[_0x33becf])){for(var _0x317164=0x0;_0x317164<_0x2d666b[_0x33becf]['length'];_0x317164++){this[_0x32b8('0x94')](_0x2d666b[_0x33becf][_0x317164],util['format'](_0x32b8('0x95'),_0x69b331,_0x33becf+'['+_0x317164+']'));}}else{if(!_[_0x32b8('0x43')](_0x2d666b[_0x33becf])){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x95'),_0x69b331,_0x33becf),_0x2d666b[_0x33becf]);}}}}};AGIVertices['prototype'][_0x32b8('0x98')]=function(_0x58c791){try{var _0x164369=JSON[_0x32b8('0x65')](_0x58c791);this['recursiveNodeIndex'](_0x164369);return JSON[_0x32b8('0x6d')](_0x164369);}catch(_0x3e44f8){return this['replaceAllVariables'](_0x58c791);}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x91')]=function(_0x5ed377){var _0x2788b0=_0x5ed377[_0x32b8('0x99')]('{');for(var _0x40ebaa=0x1;_0x40ebaa<_0x2788b0[_0x32b8('0x9a')];_0x40ebaa+=0x1){var _0x528755=_0x2788b0[_0x40ebaa][_0x32b8('0x99')]('}');if(_0x528755[_0x32b8('0x9a')]>0x1){_0x5ed377=_0x5ed377[_0x32b8('0x9b')]('{'+_0x528755[0x0]+'}',this[_0x32b8('0x31')]['getVariable'](_0x528755[0x0])[_0x32b8('0x9c')]||_0x528755[0x0]);}}if(_0x2788b0[_0x32b8('0x9a')]===0x1){return _0x5ed377[_0x32b8('0x48')]();}return this[_0x32b8('0x91')](_0x5ed377);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x9d')]=function(_0x1a2d68,_0x4cc34c){var _0x12c3ab=this[_0x32b8('0x31')][_0x32b8('0xd')](_0x1a2d68);if(_0x12c3ab[_0x32b8('0x9e')]===-0x1){return _0x12c3ab;}logger['info'](util[_0x32b8('0x26')](_0x32b8('0x9f'),_0x4cc34c,_0x12c3ab[_0x32b8('0x9c')]));return this['channel']['setVariable'](_0x4cc34c,_0x12c3ab['extra']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x7d')]=function(_0x344ed7){return _0x344ed7&&_0x344ed7!=='0'&&_0x344ed7!=='-1'&&_0x344ed7!=='';};AGIVertices['prototype']['maxRetry']=function(_0x32c588){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x32c588,'-');_0x32c588['retry']=_0x32c588[_0x32b8('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x32b8('0x16')]['mrcpsynth']=function(_0x93dfa4){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xa1'),_0x93dfa4[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x93dfa4[_0x32b8('0x56')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}var _0x14320f='\x22'+_0x93dfa4[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x93dfa4[_0x32b8('0x73')])){_0x14320f+=','+_0x93dfa4['options'];}var _0x4c26aa=this[_0x32b8('0x31')]['exec'](_0x32b8('0xa3'),_0x14320f);if(_0x4c26aa[_0x32b8('0x9e')]===-0x1){return _0x4c26aa;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x14320f));};AGIVertices['prototype'][_0x32b8('0xa6')]=function(_0x29095e){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xa7'),_0x29095e['label']));if(!this[_0x32b8('0x7d')](_0x29095e[_0x32b8('0xa8')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa9'));}var _0x52ac94=_0x29095e[_0x32b8('0xa8')];if(this[_0x32b8('0x7d')](_0x29095e[_0x32b8('0x73')])){_0x52ac94+=','+_0x29095e['options'];}var _0x43fee6=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x52ac94);if(_0x43fee6['result']===-0x1){return _0x43fee6;}var _0x40ec2d=this[_0x32b8('0x9d')]('RECOG_CONFIDENCE()',_0x32b8('0xac'));if(_0x40ec2d[_0x32b8('0x9e')]===-0x1){return _0x40ec2d;}var _0x4a390f=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xad'));if(_0x4a390f[_0x32b8('0x9e')]===-0x1){return _0x4a390f;}var _0x45cb59=this[_0x32b8('0x9d')]('RECOG_INSTANCE()',_0x32b8('0xae'));if(_0x45cb59[_0x32b8('0x9e')]===-0x1){return _0x45cb59;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x52ac94));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5')]=function(_0x46d1d5){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xaf'),_0x46d1d5[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0x5')]([_0x46d1d5[_0x32b8('0xb0')],_0x46d1d5[_0x32b8('0xb1')]]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0xb2')]=function(_0x23f9ae){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xb3'),_0x23f9ae[_0x32b8('0x32')]));if(this[_0x32b8('0x7d')](_0x23f9ae[_0x32b8('0x61')])){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xb4'),_0x23f9ae[_0x32b8('0x61')]));var _0x226e17=this['channel'][_0x32b8('0xb5')](_0x23f9ae[_0x32b8('0x61')]);if(_0x226e17['result']===-0x1){return _0x226e17;}}return this[_0x32b8('0x31')][_0x32b8('0xb2')]();};AGIVertices[_0x32b8('0x16')][_0x32b8('0xb6')]=function(_0x4b695a){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4b695a[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4b695a[_0x32b8('0x45')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4b695a,'no\x20list\x20selected');}_0x4b695a[_0x32b8('0x47')]=moment();if(this['isConfigured'](_0x4b695a[_0x32b8('0xb7')])){_0x4b695a['scheduledAt']=moment()[_0x32b8('0xb8')](_0x4b695a[_0x32b8('0xb7')],_0x32b8('0xb9'));}if(!this[_0x32b8('0x7d')](_0x4b695a[_0x32b8('0x49')])){_0x4b695a[_0x32b8('0x49')]=0x2;}this[_0x32b8('0x3e')]['sync'](this,_0x4b695a);return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4b695a[_0x32b8('0x44')],_0x4b695a[_0x32b8('0x45')],_0x4b695a[_0x32b8('0x47')]));};AGIVertices['prototype'][_0x32b8('0xba')]=function(_0x5d0cd0){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xbb'),_0x5d0cd0[_0x32b8('0x32')]));var _0x135da4=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x5d0cd0[_0x32b8('0xbc')],_0x5d0cd0[_0x32b8('0x73')]);if(_0x135da4[_0x32b8('0x9e')]===-0x1){return _0x135da4;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0xbd'),_0x5d0cd0['application'],_0x5d0cd0['options']));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xbe')]=function(_0x29cc73){logger['info'](util[_0x32b8('0x26')](_0x32b8('0xbf'),_0x29cc73[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x29cc73[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}var _0x40ced6='\x22'+_0x29cc73[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x29cc73['options'])){_0x40ced6+=','+_0x29cc73[_0x32b8('0x73')];}var _0x16d088=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xa3'),_0x40ced6);if(_0x16d088['result']===-0x1){return _0x16d088;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x40ced6));};AGIVertices[_0x32b8('0x16')]['sestektts']=function(_0x4c09fe){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xc0'),_0x4c09fe[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4c09fe[_0x32b8('0x56')])){return this['channel'][_0x32b8('0xa4')](_0x32b8('0xa2'));}var _0x2b1dfa='\x22'+_0x4c09fe[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x4c09fe[_0x32b8('0x73')])){_0x2b1dfa+=','+_0x4c09fe['options'];}var _0x53d7f7=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xa3'),_0x2b1dfa);if(_0x53d7f7[_0x32b8('0x9e')]===-0x1){return _0x53d7f7;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x2b1dfa));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xc1')]=function(_0x554068){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xc2'),_0x554068[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x554068[_0x32b8('0xa8')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa9'));}var _0x339b89=_0x554068[_0x32b8('0xa8')];if(this[_0x32b8('0x7d')](_0x554068[_0x32b8('0x73')])){_0x339b89+=','+_0x554068[_0x32b8('0x73')];}var _0x138b01=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x339b89);if(_0x138b01[_0x32b8('0x9e')]===-0x1){return _0x138b01;}var _0x48b45f=this[_0x32b8('0x9d')](_0x32b8('0xc3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x48b45f[_0x32b8('0x9e')]===-0x1){return _0x48b45f;}var _0x4d29c3=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xc4'));if(_0x4d29c3[_0x32b8('0x9e')]===-0x1){return _0x4d29c3;}var _0x2c8691=this['getAndSetVariable'](_0x32b8('0xc5'),_0x32b8('0xc6'));if(_0x2c8691[_0x32b8('0x9e')]===-0x1){return _0x2c8691;}return this[_0x32b8('0x31')]['noop'](util['format'](_0x32b8('0xc7'),_0x339b89));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xc8')]=function(_0x47dc87){logger[_0x32b8('0x29')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x47dc87[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x47dc87['grammar'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa9'));}var _0x5e1472=_0x47dc87['grammar'];if(this[_0x32b8('0x7d')](_0x47dc87[_0x32b8('0x73')])){_0x5e1472+=','+_0x47dc87[_0x32b8('0x73')];}var _0x5486a9=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x5e1472);if(_0x5486a9['result']===-0x1){return _0x5486a9;}var _0x1ee61f=this[_0x32b8('0x9d')](_0x32b8('0xc3'),'SESTEK_ASR_CONFIDENCE');if(_0x1ee61f[_0x32b8('0x9e')]===-0x1){return _0x1ee61f;}var _0x555a81=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xc9'));if(_0x555a81[_0x32b8('0x9e')]===-0x1){return _0x555a81;}var _0x53c69f=this[_0x32b8('0x9d')](_0x32b8('0xc5'),_0x32b8('0xca'));if(_0x53c69f[_0x32b8('0x9e')]===-0x1){return _0x53c69f;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xc7'),_0x5e1472));};AGIVertices[_0x32b8('0x16')]['database']=function(_0x3badd1){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xcb'),_0x3badd1['label']));if(!this['isConfigured'](_0x3badd1[_0x32b8('0xcc')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,_0x32b8('0xcd'));}var _0x27da1f=this[_0x32b8('0xce')]['sync'](this,_0x3badd1[_0x32b8('0xcc')]);if(!_0x27da1f){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20odbc\x20database\x20found');}if(!this[_0x32b8('0x7d')](_0x3badd1['query'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20query\x20configured');}var _0x25c1c6=_0x3badd1[_0x32b8('0x2b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0xcf'),_0x25c1c6));var _0x4a5f66=this[_0x32b8('0xd0')][_0x32b8('0x6a')](this,_0x27da1f,_0x25c1c6);this[_0x32b8('0x30')]['sync'](this,_0x3badd1,_0x25c1c6);if(!this['isConfigured'](_0x3badd1['variable_id'])){return this['channel'][_0x32b8('0xa4')](_0x32b8('0xd1'));}var _0xb189be=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x3badd1[_0x32b8('0xd2')]);if(!_0xb189be){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20variable\x20found');}var _0x23ff8d=this;_0x4a5f66[_0x32b8('0xd3')](function(_0x5dbe57,_0x25f220){Object[_0x32b8('0xd4')](_0x5dbe57)[_0x32b8('0xd3')](function(_0x3633ea){_0x23ff8d[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xd5'),_0xb189be,_0x25f220,_0x3633ea),_0x5dbe57[_0x3633ea]);});});this[_0x32b8('0x31')][_0x32b8('0x97')](util['format'](_0x32b8('0xd6'),_0xb189be),_0x4a5f66[_0x32b8('0x9a')]);return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xd7'),_0xb189be));};AGIVertices[_0x32b8('0x16')]['dial']=function(_0x2bc9b5){logger[_0x32b8('0xd8')](util[_0x32b8('0x26')](_0x32b8('0xd9'),_0x2bc9b5[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x2bc9b5['sip_id'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x2bc9b5,'no\x20user\x20selected');}var _0xa90509=this[_0x32b8('0x17')]['sync'](this,_0x2bc9b5['sip_id']);if(!_0xa90509){return this[_0x32b8('0x31')]['error'](_0x2bc9b5,_0x32b8('0xda'));}var _0x219891=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xdb'),[util[_0x32b8('0x26')](_0x32b8('0xdc'),_0xa90509),_0x2bc9b5[_0x32b8('0x61')],_0x2bc9b5[_0x32b8('0xdd')],_0x2bc9b5[_0x32b8('0x6b')]]);if(_0x219891['result']===-0x1){return _0x219891;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xde'),_0x32b8('0xdb')));};AGIVertices[_0x32b8('0x16')]['dialogflow']=function(_0x504f12){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xdf'),_0x504f12[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x504f12[_0x32b8('0x75')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xe0'));}if(!this[_0x32b8('0x7d')](_0x504f12[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this['channel'][_0x32b8('0xe1')]=!![];this['createSquareDetailsReport'](_0x504f12);this[_0x32b8('0x3d')](_0x504f12['text'],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Trying\x20Dialogflow:\x20%s',_0x504f12[_0x32b8('0x56')]));var _0x120c12=this[_0x32b8('0x74')][_0x32b8('0x6a')](this,_0x504f12);if(_0x120c12){for(var _0x1b46c4 in _0x120c12){if(_0x120c12[_0x32b8('0x8e')](_0x1b46c4)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xe2'),_0x1b46c4[_0x32b8('0x63')]()),_0x120c12[_0x1b46c4]);}}this[_0x32b8('0x3d')](_0x120c12[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xe5'),'');return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xe6'),_0x120c12[_0x32b8('0xe3')]));}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x504f12,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x32b8('0x16')][_0x32b8('0xe7')]=function(_0x5cb7f2){logger['info'](util[_0x32b8('0x26')](_0x32b8('0xe8'),_0x5cb7f2[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0xe9')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xea'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0x76')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xeb'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0xec')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xed'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0x77')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20anguage\x20configured');}if(!this[_0x32b8('0x7d')](_0x5cb7f2['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')]['bot']=!![];this[_0x32b8('0x30')](_0x5cb7f2);this[_0x32b8('0x3d')](_0x5cb7f2['text'],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x5cb7f2[_0x32b8('0x56')]));var _0x9a0be=this[_0x32b8('0xee')][_0x32b8('0x6a')](this,_0x5cb7f2);if(_0x9a0be){for(var _0x4dcafc in _0x9a0be){if(_0x9a0be[_0x32b8('0x8e')](_0x4dcafc)){if(_0x4dcafc!==_0x32b8('0xef')){this[_0x32b8('0x31')]['setVariable'](util['format'](_0x32b8('0xe2'),_0x4dcafc[_0x32b8('0x63')]()),_0x9a0be[_0x4dcafc]);}}}this[_0x32b8('0x3d')](_0x9a0be[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xe7'),_0x9a0be['providerResponse']);return this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('DialogflowV2\x20Result\x20%s',_0x9a0be[_0x32b8('0xe3')]));}return this[_0x32b8('0x31')]['error'](_0x5cb7f2,_0x32b8('0xf0'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xf1')]=function(_0xac9ae9){logger['info'](util[_0x32b8('0x26')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xac9ae9[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf2')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xf3'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf4')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xf5'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf6')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xf7'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf8')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this['channel'][_0x32b8('0xe1')]=!![];this[_0x32b8('0x30')](_0xac9ae9);this['createSquareMessage'](_0xac9ae9[_0x32b8('0x56')],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xf9'),_0xac9ae9[_0x32b8('0x56')]));var _0x34a831=this[_0x32b8('0x78')][_0x32b8('0x6a')](this,_0xac9ae9);if(_0x34a831){for(var _0x35400 in _0x34a831){if(_0x34a831[_0x32b8('0x8e')](_0x35400)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xfa'),_0x35400['toUpperCase']()),_0x34a831[_0x35400]);}}this[_0x32b8('0x3d')](_0x34a831[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xf1'),'');if(_0x34a831[_0x32b8('0xfb')]){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x34a831[_0x32b8('0xfb')]));var _0x303852=this[_0x32b8('0x31')]['streamFile'](_0x34a831[_0x32b8('0xfb')]);try{fs['unlink'](_0x34a831['audiofile']+_0x32b8('0xfc'));}catch(_0x26c06e){logger[_0x32b8('0x2e')](_0x26c06e);}return _0x303852;}else{return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('SestekNDA\x20Result\x20%s',_0x34a831[_0x32b8('0xe3')]));}}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xac9ae9,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x324d2f){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xfd'),_0x324d2f[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xfe'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xff')]=function(_0xde691a){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x100'),_0xde691a[_0x32b8('0x32')]));var _0x15e414='';if(_0xde691a[_0x32b8('0x101')]){if(!this[_0x32b8('0x7d')](_0xde691a[_0x32b8('0x101')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,_0x32b8('0x102'));}else{var _0x9acaf0=parseInt(_0xde691a[_0x32b8('0x101')],0xa);if(isNaN(_0x9acaf0)){_0x15e414=_0xde691a[_0x32b8('0x101')];}else{_0x15e414=this[_0x32b8('0x18')][_0x32b8('0x6a')](this,_0xde691a[_0x32b8('0x101')]);if(!_0x15e414){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,'no\x20trunk\x20found');}}}}else if(_0xde691a[_0x32b8('0x103')]){_0x15e414=_0xde691a[_0x32b8('0x103')];}else{return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,_0x32b8('0x102'));}var _0x1b2830=this['channel']['exec'](_0x32b8('0xdb'),[util[_0x32b8('0x26')](_0x32b8('0x104'),_0x15e414,_0xde691a['phone']),_0xde691a[_0x32b8('0x61')],_0xde691a[_0x32b8('0xdd')],_0xde691a[_0x32b8('0x6b')]]);if(_0x1b2830[_0x32b8('0x9e')]===-0x1){return _0x1b2830;}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0xde'),_0x32b8('0xdb')));};AGIVertices[_0x32b8('0x16')]['finally']=function(_0x309194){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x309194[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x105'));};AGIVertices['prototype']['getdigits']=function(_0x4d3ed8){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x106'),_0x4d3ed8[_0x32b8('0x32')]));if(_0x4d3ed8[_0x32b8('0x107')]===0x0){return this[_0x32b8('0xa0')](_0x4d3ed8);}_0x4d3ed8['retry']-=0x1;if(!this['isConfigured'](_0x4d3ed8[_0x32b8('0x108')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4d3ed8,'no\x20file\x20audio\x20selected');}var _0x338acf=this[_0x32b8('0x1a')][_0x32b8('0x6a')](this,_0x4d3ed8[_0x32b8('0x108')]);if(!_0x338acf){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4d3ed8,_0x32b8('0x109'));}if(!this[_0x32b8('0x7d')](_0x4d3ed8[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x32b8('0xd1'));}var _0x115017=this['channel'][_0x32b8('0x10a')](_0x338acf,_0x4d3ed8[_0x32b8('0x10b')],_0x4d3ed8[_0x32b8('0x10c')]);var _0x540b5e=_0x115017[_0x32b8('0x9e')]?_0x115017[_0x32b8('0x9e')][_0x32b8('0x48')]():'';logger[_0x32b8('0x29')](_0x32b8('0x10d'),JSON['stringify'](_0x115017));if(_0x115017[_0x32b8('0x9e')]===-0x1){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,_0x540b5e);return _0x115017;}else if(_0x115017[_0x32b8('0x9c')]===_0x32b8('0x61')){_0x115017[_0x32b8('0x9e')]=_0x540b5e[_0x32b8('0x9a')]>=parseInt(_0x4d3ed8[_0x32b8('0x10e')])?'x':'i';}else{_0x115017[_0x32b8('0x9e')]=_0x540b5e[_0x32b8('0x9a')]>=parseInt(_0x4d3ed8[_0x32b8('0x10e')])&&_0x540b5e[_0x32b8('0x9a')]<=parseInt(_0x4d3ed8[_0x32b8('0x10c')])?'x':'i';}var _0x3d44ef=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x4d3ed8[_0x32b8('0xd2')]);if(!_0x3d44ef){return this['channel'][_0x32b8('0x2e')](_0x4d3ed8,_0x32b8('0x10f'));}this[_0x32b8('0x31')][_0x32b8('0x97')](_0x3d44ef,_0x540b5e);if(this[_0x32b8('0x7d')](_0x4d3ed8['hiddendigitsnum'])){var _0x82aba5=parseInt(_0x4d3ed8[_0x32b8('0x110')],0xa);var _0x3a3f66=rs[_0x32b8('0x111')]({'charset':'*','length':_0x82aba5});var _0x43ff42=_0x540b5e[_0x32b8('0x9a')];if(_0x43ff42>0x0){if(_0x43ff42>_0x82aba5){this[_0x32b8('0x30')]['sync'](this,_0x4d3ed8,_0x4d3ed8[_0x32b8('0x112')]===_0x32b8('0x113')?_0x3a3f66+_0x540b5e['substr'](_0x82aba5):_0x540b5e[_0x32b8('0x114')](0x0,_0x43ff42-_0x82aba5)+_0x3a3f66);}else{this['createSquareDetailsReport']['sync'](this,_0x4d3ed8,rs[_0x32b8('0x111')]({'charset':'*','length':_0x43ff42}));}}else{this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,'');}}else{this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,_0x540b5e);}return _0x115017;};AGIVertices[_0x32b8('0x16')]['getsecretdigits']=function(_0x179470){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x115'),_0x179470['label']));return this['getdigits'](_0x179470);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x116')]=function(_0x3c110c){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x117'),_0x3c110c[_0x32b8('0x32')]));this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x3c110c,_0x3c110c[_0x32b8('0x118')]);return this['channel']['noop'](util[_0x32b8('0x26')](_0x32b8('0x119'),_0x3c110c[_0x32b8('0x118')]));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x11a')]=function(_0x26ea0f){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x26ea0f[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x26ea0f['aws_access_key_id'])||!this[_0x32b8('0x7d')](_0x26ea0f[_0x32b8('0x81')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x26ea0f['text'])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x26ea0f[_0x32b8('0x56')]));var _0x218656=this[_0x32b8('0x7f')][_0x32b8('0x6a')](this,_0x26ea0f);if(_0x218656){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x11b'),_0x218656));var _0x1c5728=this[_0x32b8('0x31')][_0x32b8('0x11c')](_0x218656);try{fs[_0x32b8('0x11d')](_0x218656+'.wav');}catch(_0x15dacc){logger[_0x32b8('0x2e')](_0x15dacc);}return _0x1c5728;}return this['channel']['error'](_0x26ea0f,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x32b8('0x11e')]=function(_0x16649c){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x16649c['label']));if(!this['isConfigured'](_0x16649c['aws_access_key_id'])||!this['isConfigured'](_0x16649c['aws_secret_access_key'])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x11f'));}if(!this[_0x32b8('0x7d')](_0x16649c[_0x32b8('0x86')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x120'));}if(!this[_0x32b8('0x7d')](_0x16649c['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xe1')]=!![];this['createSquareDetailsReport'](_0x16649c);this[_0x32b8('0x3d')](_0x16649c[_0x32b8('0x56')],'in','','');this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x121'),_0x16649c[_0x32b8('0x56')]));var _0x3e48be=this[_0x32b8('0x122')][_0x32b8('0x6a')](this,_0x16649c);if(_0x3e48be){for(var _0x170295 in _0x3e48be){if(_0x3e48be['hasOwnProperty'](_0x170295)&&_[_0x32b8('0x8f')](_0x3e48be[_0x170295])){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x123'),_0x170295[_0x32b8('0x63')]()),_0x3e48be[_0x170295]);}}if(_[_0x32b8('0x43')](_0x3e48be[_0x32b8('0x71')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x124'));}else{this[_0x32b8('0x3d')](_0x3e48be[_0x32b8('0x71')],_0x32b8('0xe4'),_0x32b8('0x125'),'');return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x126'),_0x3e48be[_0x32b8('0x71')]));}}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x16649c,_0x32b8('0x127'));};AGIVertices['prototype'][_0x32b8('0x128')]=function(_0x598866){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x129'),_0x598866[_0x32b8('0x32')],_0x598866[_0x32b8('0x61')]));if(!this[_0x32b8('0x7d')](_0x598866['key'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20key\x20configured');}var _0x36bfcb=_0x32b8('0x12a');var _0x18785c=util[_0x32b8('0x26')](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x106d8d=util[_0x32b8('0x26')](_0x32b8('0x95'),_0x18785c,_0x36bfcb);var _0x224bac=!![];if(_0x598866[_0x32b8('0x12c')]==='NOBEEP'){_0x224bac=![];}var _0x33cca8=this[_0x32b8('0x31')]['recordFile'](_0x18785c,_0x36bfcb,_0x598866[_0x32b8('0x12d')],_0x598866['timeout'],undefined,_0x224bac);if(_0x33cca8[_0x32b8('0x9e')]!==-0x1){this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('google\x20%s\x20file\x20created',_0x106d8d));var _0x32ce9b=this[_0x32b8('0x12e')][_0x32b8('0x6a')](this,_0x598866,_0x106d8d);if(_0x32ce9b){for(var _0xcf2eba in _0x32ce9b){if(_0x32ce9b[_0x32b8('0x8e')](_0xcf2eba)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x12f'),_0xcf2eba['toUpperCase']()),_0x32ce9b[_0xcf2eba]);}}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x130'),JSON['stringify'](_0x32ce9b)));}}return _0x33cca8;};AGIVertices[_0x32b8('0x16')]['tildeasr']=function(_0x59d1fb){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x131'),_0x59d1fb[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x59d1fb['appid'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20appid\x20configured');}if(!this[_0x32b8('0x7d')](_0x59d1fb[_0x32b8('0x8a')])){return this[_0x32b8('0x31')]['noop']('no\x20appsecret\x20configured');}var _0x1e3e4d=_0x32b8('0x12a');var _0xe464b5=util['format'](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x308b68=util[_0x32b8('0x26')](_0x32b8('0x95'),_0xe464b5,_0x1e3e4d);var _0x5de46d=!![];if(_0x59d1fb['beep']==='NOBEEP'){_0x5de46d=![];}var _0x5da5a0=this[_0x32b8('0x31')]['recordFile'](_0xe464b5,_0x1e3e4d,_0x59d1fb[_0x32b8('0x12d')],_0x59d1fb[_0x32b8('0x61')],undefined,_0x5de46d);if(_0x5da5a0[_0x32b8('0x9e')]!==-0x1){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x132'),_0x308b68));var _0x45c9c7=this['tildeASR']['sync'](this,_0x59d1fb,_0x308b68);if(_0x45c9c7){for(var _0x30da9c in _0x45c9c7){if(_0x45c9c7['hasOwnProperty'](_0x30da9c)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x133'),_0x30da9c[_0x32b8('0x63')]()),_0x45c9c7[_0x30da9c]);}}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x134'),JSON[_0x32b8('0x6d')](_0x45c9c7)));}}return _0x5da5a0;};AGIVertices['prototype'][_0x32b8('0x135')]=function(_0x3a20d0){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3a20d0['label']));return this[_0x32b8('0x31')]['continueAt'](_0x3a20d0['context'],_0x3a20d0[_0x32b8('0x136')],_0x3a20d0[_0x32b8('0x39')]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x137')]=function(_0x53a793){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x138'),_0x53a793[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x53a793[_0x32b8('0x139')])){return this['channel'][_0x32b8('0x2e')](_0x53a793,_0x32b8('0x13a'));}try{var _0x5c2461=eval(_0x53a793[_0x32b8('0x139')])?_0x32b8('0x13b'):'false';this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x53a793[_0x32b8('0x139')],_0x5c2461));return{'code':0xc8,'result':_0x5c2461};}catch(_0x140aad){return{'code':0xc8,'result':_0x32b8('0x13c')};}};AGIVertices['prototype'][_0x32b8('0x13d')]=function(_0x5203f6){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5203f6[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x5203f6['interval_id'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x5203f6,_0x32b8('0x13e'));}var _0x510a83=this[_0x32b8('0x20')][_0x32b8('0x6a')](this,_0x5203f6[_0x32b8('0x13f')]);if(!_0x510a83){return this[_0x32b8('0x31')]['error'](_0x5203f6,'no\x20intervals\x20found');}for(var _0xd7d100=0x0;_0xd7d100<_0x510a83[_0x32b8('0x9a')];_0xd7d100+=0x1){var _0x3945fb=this[_0x32b8('0x31')]['getVariable'](util[_0x32b8('0x26')](_0x32b8('0x140'),_0x510a83[_0xd7d100]));if(_0x3945fb['result']===-0x1){return _0x3945fb;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x510a83[_0xd7d100],_0x3945fb['extra']));if(_0x3945fb['extra']===_0x32b8('0x13b')){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],'true'));this['channel']['noop'](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],_0x32b8('0x13b')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],'false'));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],_0x32b8('0x13c')));}}return{'code':0xc8,'result':_0x32b8('0x13c')};};AGIVertices[_0x32b8('0x16')][_0x32b8('0x142')]=function(_0x3d4e58){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x143'),_0x3d4e58[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0x142')]();};AGIVertices['prototype'][_0x32b8('0x144')]=function(_0x1f937d){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x145'),_0x1f937d[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1f937d[_0x32b8('0x75')])){return this['channel'][_0x32b8('0xa4')]('no\x20key\x20configured');}var _0x298300=_0x32b8('0x12a');var _0x512f90=util[_0x32b8('0x26')](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x165a1e=util['format'](_0x32b8('0x95'),_0x512f90,_0x298300);var _0x1f7cf7=!![];if(_0x1f937d['beep']===_0x32b8('0x146')){_0x1f7cf7=![];}var _0x1667ce=this['channel']['recordFile'](_0x512f90,_0x298300,_0x1f937d[_0x32b8('0x12d')],_0x1f937d[_0x32b8('0x61')],undefined,_0x1f7cf7);if(_0x1667ce[_0x32b8('0x9e')]!==-0x1){this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x147'),_0x165a1e));var _0x38b33e=this[_0x32b8('0x7c')]['sync'](this,_0x1f937d,_0x165a1e);if(_0x38b33e){for(var _0x536fdb in _0x38b33e){if(_0x38b33e[_0x32b8('0x8e')](_0x536fdb)){this[_0x32b8('0x31')][_0x32b8('0x97')](util['format'](_0x32b8('0x148'),_0x536fdb[_0x32b8('0x63')]()),_0x38b33e[_0x536fdb]);}}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x149'),JSON['stringify'](_0x38b33e)));}}return _0x1667ce;};AGIVertices['prototype'][_0x32b8('0x14a')]=function(_0x2e47d2){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x14b'),_0x2e47d2['label']));if(!this[_0x32b8('0x7d')](_0x2e47d2[_0x32b8('0x75')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xe0'));}if(!this[_0x32b8('0x7d')](_0x2e47d2['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('Trying\x20ispeech\x20TTS\x20%s',_0x2e47d2['text']));var _0x30c4f3=this['ispeechTTS']['sync'](this,_0x2e47d2);if(_0x30c4f3){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x147'),_0x30c4f3));var _0x2534ea=this[_0x32b8('0x31')][_0x32b8('0x11c')](_0x30c4f3,_0x2e47d2['intKey']);try{fs[_0x32b8('0x11d')](_0x30c4f3+_0x32b8('0xfc'));}catch(_0x348fff){logger['error'](_0x348fff);}return _0x2534ea;}return this['channel'][_0x32b8('0x2e')](_0x2e47d2,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x32b8('0x16')][_0x32b8('0x14c')]=function(_0x41b00a){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x14d'),_0x41b00a[_0x32b8('0x32')]));if(!this['isConfigured'](_0x41b00a[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x41b00a,_0x32b8('0x14f'));}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));var _0x2d3580=this['agentLogin'][_0x32b8('0x6a')](this,_0x41b00a[_0x32b8('0x14e')]);if(_0x2d3580){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a['findBy']));this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x32b8('0x153')]=function(_0x38956b){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x154'),_0x38956b['label']));if(!this[_0x32b8('0x7d')](_0x38956b[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x38956b,'no\x20find\x20by\x20configured');}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));var _0x4712be=this[_0x32b8('0x4c')][_0x32b8('0x6a')](this,_0x38956b['findBy']);if(_0x4712be){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x151'),this['channel'][_0x32b8('0x34')],_0x38956b['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel']['callerid'],_0x38956b[_0x32b8('0x14e')]));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x156')]=function(_0x38019b){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x157'),_0x38019b['label']));if(!this[_0x32b8('0x7d')](_0x38019b[_0x32b8('0x158')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x38019b,_0x32b8('0x159'));}this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0x15a'),_0x38019b[_0x32b8('0x158')]));var _0x5cc34d=eval(_0x38019b['operation']);if(!this[_0x32b8('0x7d')](_0x38019b['variable_id'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xd1'));}var _0x580d89=this['getVariable']['sync'](this,_0x38019b[_0x32b8('0xd2')]);if(!_0x580d89){return this[_0x32b8('0x31')]['error'](_0x38019b,_0x32b8('0x10f'));}if(_[_0x32b8('0x96')](_0x5cc34d)){var _0x140687=this;_0x5cc34d[_0x32b8('0xd3')](function(_0x2c8f86,_0x38de5b){_0x140687[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')]('%s[%s]',_0x580d89,_0x38de5b),_0x2c8f86);});return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('variable\x20%s[key]\x20set',_0x580d89));}else{return this[_0x32b8('0x31')][_0x32b8('0x97')](_0x580d89,_0x5cc34d);}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x9')]=function(_0x35aae6){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x15b'),_0x35aae6[_0x32b8('0x32')]));if(_0x35aae6[_0x32b8('0x107')]===0x0){return this[_0x32b8('0xa0')](_0x35aae6);}_0x35aae6[_0x32b8('0x107')]-=0x1;if(!this[_0x32b8('0x7d')](_0x35aae6['file_id'])){return this['channel'][_0x32b8('0x2e')](_0x35aae6,_0x32b8('0x15c'));}var _0x4337fd=this['getSound'][_0x32b8('0x6a')](this,_0x35aae6[_0x32b8('0x108')]);if(!_0x4337fd){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x35aae6,_0x32b8('0x109'));}var _0x2dbdb1=this[_0x32b8('0x31')]['getData'](_0x4337fd,_0x35aae6[_0x32b8('0x10b')],_0x35aae6[_0x32b8('0x15d')]);var _0x5ed878=_0x2dbdb1[_0x32b8('0x9e')];if(_0x2dbdb1[_0x32b8('0x9e')]===-0x1){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x35aae6,'-1');return _0x2dbdb1;}else if(_0x2dbdb1['extra']===_0x32b8('0x61')){_0x2dbdb1[_0x32b8('0x9e')]=_0x2dbdb1[_0x32b8('0x9e')]['length']>0x0?_0x2dbdb1[_0x32b8('0x9e')]:'t';}else if(_['isEmpty'](_0x2dbdb1['result'])){_0x2dbdb1['result']='#';_0x5ed878='#';}if(!this['isConfigured'](_0x35aae6['variable_id'])){this['channel'][_0x32b8('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x98b97e=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x35aae6[_0x32b8('0xd2')]);if(!_0x98b97e){return this['channel'][_0x32b8('0x2e')](_0x35aae6,'no\x20variable\x20found');}this[_0x32b8('0x31')][_0x32b8('0x97')](_0x98b97e,_0x5ed878);}this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x35aae6,_0x5ed878);return _0x2dbdb1;};AGIVertices[_0x32b8('0x16')][_0x32b8('0xa4')]=function(_0x179b7d){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x15e'),_0x179b7d[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x179b7d[_0x32b8('0x15f')]||_0x179b7d['label']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x160')]=function(_0x4ad3ae){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4ad3ae[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4ad3ae[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4ad3ae,_0x32b8('0x14f'));}logger['info'](util['format'](_0x32b8('0x150'),this[_0x32b8('0x31')]['callerid'],_0x4ad3ae[_0x32b8('0x14e')]));var _0x19077c=this['getPause'][_0x32b8('0x6a')](this,_0x4ad3ae[_0x32b8('0x161')]);var _0x471c1f=this['agentPause']['sync'](this,_0x4ad3ae[_0x32b8('0x14e')],_0x19077c);if(_0x471c1f){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x151'),this['channel'][_0x32b8('0x34')],_0x4ad3ae['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x4ad3ae[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x4ad3ae['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x4ad3ae[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x162')]=function(_0x57e2bb){logger['info'](util['format'](_0x32b8('0x163'),_0x57e2bb[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x57e2bb[_0x32b8('0x108')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x57e2bb,_0x32b8('0x15c'));}var _0x110969=this[_0x32b8('0x1a')]['sync'](this,_0x57e2bb[_0x32b8('0x108')]);if(!_0x110969){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x57e2bb,_0x32b8('0x109'));}var _0xa2747d=this[_0x32b8('0x31')][_0x32b8('0xaa')]('PLAYBACK',[_0x110969,_0x57e2bb['opts']]);if(_0xa2747d[_0x32b8('0x9e')]===-0x1){return _0xa2747d;}return this[_0x32b8('0x31')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x32b8('0x164'),_0x110969));};AGIVertices[_0x32b8('0x16')]['queue']=function(_0x1cdf43){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x165'),_0x1cdf43[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1cdf43[_0x32b8('0x166')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1cdf43,_0x32b8('0x167'));}var _0x2f1eb6='';var _0x5a4058=parseInt(_0x1cdf43[_0x32b8('0x166')],0xa);if(isNaN(_0x5a4058)){_0x2f1eb6=_0x1cdf43['queue_id'];}else{_0x2f1eb6=this[_0x32b8('0x10')][_0x32b8('0x6a')](this,_0x1cdf43['queue_id']);if(!_0x2f1eb6){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1cdf43,_0x32b8('0x168'));}}var _0x172724='';if(this[_0x32b8('0x7d')](_0x1cdf43['file_id'])){var _0x28a615=this[_0x32b8('0x1a')][_0x32b8('0x6a')](this,_0x1cdf43[_0x32b8('0x108')]);if(_0x28a615){_0x172724=_0x28a615;}}this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x1cdf43,_0x2f1eb6);if(_0x1cdf43['opts']['indexOf']('x')<0x0){_0x1cdf43['opts']+='x';}if(_0x1cdf43[_0x32b8('0xdd')][_0x32b8('0x169')]('X')<0x0){_0x1cdf43[_0x32b8('0xdd')]+='X';}this[_0x32b8('0x31')]['setVariable'](_0x32b8('0x16a'),_0x2f1eb6?_0x2f1eb6['toLowerCase']():'');var _0x38a1b1=this['channel'][_0x32b8('0xaa')]('QUEUE',[_0x2f1eb6,_0x1cdf43[_0x32b8('0xdd')],_0x1cdf43['url'],_0x172724,_0x1cdf43[_0x32b8('0x61')],_0x1cdf43[_0x32b8('0x5')],_0x1cdf43[_0x32b8('0x16b')],_0x1cdf43[_0x32b8('0x16c')],'',_0x1cdf43[_0x32b8('0x16d')]]);if(_0x38a1b1[_0x32b8('0x9e')]===-0x1){return _0x38a1b1;}return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x2f1eb6));};AGIVertices['prototype'][_0x32b8('0x16e')]=function(_0x310e8b){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x16f'),_0x310e8b['label']));var _0x47b85a=_0x310e8b[_0x32b8('0x170')]||_0x32b8('0x12a');var _0x696acd=util[_0x32b8('0x26')](_0x32b8('0x171'),this[_0x32b8('0x31')]['uniqueid'],rs[_0x32b8('0x111')](0x5));var _0x1e9a63=util[_0x32b8('0x26')](_0x32b8('0x172'),FILES_PATH,_0x696acd,_0x47b85a);var _0x2a1aaf=util['format']('%s/recordings/%s',FILES_PATH,_0x696acd);this[_0x32b8('0x35')][_0x32b8('0x6a')](this,_0x310e8b,_0x696acd,_0x1e9a63);this[_0x32b8('0x31')][_0x32b8('0x97')](_0x32b8('0x173'),_0x696acd);logger[_0x32b8('0x29')](_0x32b8('0x174'),_0x2a1aaf,_0x47b85a,_0x310e8b[_0x32b8('0x175')],_0x310e8b[_0x32b8('0x61')]);return this[_0x32b8('0x31')][_0x32b8('0x176')](_0x2a1aaf,_0x47b85a,_0x310e8b[_0x32b8('0x175')],_0x310e8b[_0x32b8('0x61')],undefined,!![]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x177')]=function(_0x241c74){logger[_0x32b8('0x29')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x241c74[_0x32b8('0x32')]));if(!this['isConfigured'](_0x241c74[_0x32b8('0x6b')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x178'));}var _0x5669a9=this[_0x32b8('0x5f')]['sync'](this,_0x241c74);logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x179'),util['inspect'](_0x5669a9,{'showHidden':![],'depth':null})));if(!this[_0x32b8('0x7d')](_0x241c74[_0x32b8('0xd2')])){return this[_0x32b8('0x31')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x42b69b=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x241c74[_0x32b8('0xd2')]);if(!_0x42b69b){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x241c74,_0x32b8('0x10f'));}this[_0x32b8('0x31')][_0x32b8('0x97')](util['format']('%s_STATUS_CODE',_0x42b69b),_0x5669a9[_0x32b8('0x6f')]?_0x5669a9['statusCode']:'200');this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x17a'),_0x42b69b),_0x5669a9[_0x32b8('0x70')]?_0x5669a9[_0x32b8('0x70')]:'OK');if(_0x5669a9[_0x32b8('0x64')]){try{this['saveRestApiResult'](_0x5669a9[_0x32b8('0x64')],_0x42b69b);}catch(_0x1d7036){logger[_0x32b8('0x2e')](util[_0x32b8('0x26')](_0x32b8('0x17b'),_0x42b69b));}}return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('variable\x20%s\x20set',_0x42b69b));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x17c')]=function(_0x3c7119){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x17d'),_0x3c7119['label']));return this[_0x32b8('0x31')][_0x32b8('0x17e')](_0x3c7119[_0x32b8('0x17f')][_0x32b8('0x53')](/\s+/g,''),_0x3c7119[_0x32b8('0x175')]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x180')]=function(_0x26880c){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x181'),_0x26880c[_0x32b8('0x32')]));return this['channel'][_0x32b8('0x182')](_0x26880c[_0x32b8('0x183')][_0x32b8('0x53')](/\s+/g,''),_0x26880c[_0x32b8('0x175')]);};AGIVertices[_0x32b8('0x16')]['sayphonetic']=function(_0xdc33df){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x184'),_0xdc33df['label']));return this[_0x32b8('0x31')]['sayPhonetic'](_0xdc33df[_0x32b8('0x56')],_0xdc33df[_0x32b8('0x175')]);};AGIVertices['prototype']['sendMail']=function(_0x2d4095){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x185'),_0x2d4095[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x2d4095[_0x32b8('0x186')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x187'));}var _0x45bb2a=this[_0x32b8('0x188')]['sync'](this,_0x2d4095[_0x32b8('0x186')]);if(!_0x45bb2a||!_0x45bb2a[_0x32b8('0x189')]){return this[_0x32b8('0x31')]['error'](_0x2d4095,_0x32b8('0x18a'));}var _0x41269e={'from':util[_0x32b8('0x26')]('\x22%s\x22\x20<%s>',_0x45bb2a[_0x32b8('0x12')],_0x45bb2a[_0x32b8('0x18b')]||_0x45bb2a[_0x32b8('0x189')]['user']),'to':_0x2d4095['to']||'','cc':_0x2d4095['cc']||'','bcc':_0x2d4095[_0x32b8('0x18c')]||'','subject':_0x2d4095[_0x32b8('0x18d')],'html':_0x2d4095[_0x32b8('0x56')],'text':_0x2d4095['text']};if(this[_0x32b8('0x7d')](_0x2d4095[_0x32b8('0x18e')])){}logger['debug'](_0x32b8('0x18f'),JSON[_0x32b8('0x6d')](_0x41269e));this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x2d4095,_0x2d4095[_0x32b8('0x186')]);this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x45bb2a[_0x32b8('0x12')]));this[_0x32b8('0x1f')]['sync'](this,_0x45bb2a[_0x32b8('0x190')],_0x41269e);return this[_0x32b8('0x31')][_0x32b8('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x32b8('0x16')]['sendFax']=function(_0x3cd177){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x191'),_0x3cd177['label']));return this['channel']['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x32b8('0x16')][_0x32b8('0x192')]=function(_0x41e410){logger['info'](util['format'](_0x32b8('0x193'),_0x41e410[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x41e410[_0x32b8('0x194')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x195'));}var _0xec689a=this[_0x32b8('0x196')][_0x32b8('0x6a')](this,_0x41e410[_0x32b8('0x194')]);if(!_0xec689a){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x41e410,'no\x20sms\x20account\x20found');}var _0xc209bd={'body':_0x41e410['sms_text'],'phone':_0x41e410['to']||'','SmsAccountId':_0xec689a['id']};logger[_0x32b8('0xd8')](_0x32b8('0x197'),JSON[_0x32b8('0x6d')](_0xc209bd));this[_0x32b8('0x30')]['sync'](this,_0x41e410,_0x41e410[_0x32b8('0x194')]);this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x198'),_0xec689a[_0x32b8('0x12')]));this[_0x32b8('0x2f')]['sync'](this,_0xc209bd);return this[_0x32b8('0x31')]['noop'](_0x32b8('0x199'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x19a')]=function(_0x1b1e29){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x19b'),_0x1b1e29[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1b1e29[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1b1e29,_0x32b8('0x19c'));}var _0x1a7098=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x1b1e29[_0x32b8('0xd2')]);if(!_0x1a7098){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1b1e29,_0x32b8('0x10f'));}return this[_0x32b8('0x31')][_0x32b8('0x97')](_0x1a7098,_0x1b1e29['variable_value']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x19d')]=function(_0x1bc2fb){logger['info'](util['format'](_0x32b8('0x19e'),_0x1bc2fb['label']));this[_0x32b8('0x31')]['noop'](_0x32b8('0x19f'));var _0x5d570f=this[_0x32b8('0x31')][_0x32b8('0xd')]('XMCS-UNIQUEID');if(!_[_0x32b8('0x3f')](_0x5d570f[_0x32b8('0x9c')])){this['channel']['uniqueid']=_0x5d570f[_0x32b8('0x9c')];}if(_0x1bc2fb[_0x32b8('0xb2')]===_0x32b8('0x1a0')){this[_0x32b8('0x31')]['noop']('Answer');return this[_0x32b8('0x31')][_0x32b8('0xb2')]();}return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x1a1'));};AGIVertices['prototype'][_0x32b8('0x1a2')]=function(_0x4e2706){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1a3'),_0x4e2706[_0x32b8('0x32')]));if(!this['isConfigured'](_0x4e2706[_0x32b8('0x1a4')])){return this['channel']['error'](_0x4e2706,_0x32b8('0x1a5'));}var _0x1ef7bf=this['getSquareProject'][_0x32b8('0x6a')](this,_0x4e2706[_0x32b8('0x1a4')]);if(!this[_0x32b8('0x7d')](_0x1ef7bf)){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4e2706,util['format'](_0x32b8('0x1a6'),_0x4e2706[_0x32b8('0x1a4')]));}if(_0x1ef7bf===this[_0x32b8('0x31')][_0x32b8('0x3b')]){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4e2706,_0x32b8('0x1a7'));}this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x4e2706,_0x1ef7bf);var _0xd2fce2=this['channel'][_0x32b8('0xaa')]('AGI',util['format'](_0x32b8('0x1a8'),config[_0x32b8('0x5')]['host']||_0x32b8('0x1a9'),_0x1ef7bf,this[_0x32b8('0x31')][_0x32b8('0x3b')]));if(_0xd2fce2[_0x32b8('0x9e')]===-0x1){return _0xd2fce2;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xbd'),_0x32b8('0x1aa'),_0x1ef7bf));};AGIVertices[_0x32b8('0x16')]['system']=function(_0x5ac6b2){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x1ab'),_0x5ac6b2[_0x32b8('0x32')]));var _0x4d4dc1=this[_0x32b8('0x1ac')][_0x32b8('0x6a')](this,_0x5ac6b2[_0x32b8('0xb0')]);this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x5ac6b2,_0x5ac6b2[_0x32b8('0xb0')]);if(this[_0x32b8('0x7d')](_0x5ac6b2['variable_id'])){var _0x1bab8c=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x5ac6b2[_0x32b8('0xd2')]);if(_0x1bab8c){this[_0x32b8('0x31')][_0x32b8('0x97')](_0x1bab8c,_0x4d4dc1);return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x1ad'),_0x5ac6b2[_0x32b8('0xb0')],_0x1bab8c));}}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x1ae'),_0x5ac6b2[_0x32b8('0xb0')]));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1af')]=function(_0x4c1d96){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1b0'),_0x4c1d96[_0x32b8('0x32')]));_0x4c1d96[_0x32b8('0x56')]=_0x4c1d96['text'][_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x32b8('0x7d')](_0x4c1d96[_0x32b8('0x55')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x1b1'));}if(!this[_0x32b8('0x7d')](_0x4c1d96[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4c1d96[_0x32b8('0x56')]));var _0x16a8c5=this['googleCloudTTS'][_0x32b8('0x6a')](this,_0x4c1d96);if(_0x16a8c5){this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x16a8c5));var _0x214267=this[_0x32b8('0x31')]['streamFile'](_0x16a8c5);try{fs[_0x32b8('0x11d')](_0x16a8c5+_0x32b8('0xfc'));}catch(_0x3aabdf){logger[_0x32b8('0x2e')](_0x3aabdf);}return _0x214267;}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4c1d96,_0x32b8('0x1b2'));};AGIVertices[_0x32b8('0x16')]['tts']=function(_0x179cb3){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x1b3'),_0x179cb3['label']));_0x179cb3[_0x32b8('0x56')]=_0x179cb3[_0x32b8('0x56')][_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x32b8('0x7d')](_0x179cb3[_0x32b8('0x56')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x1b4'),_0x179cb3[_0x32b8('0x56')]));var _0x2a2120=this[_0x32b8('0x5d')][_0x32b8('0x6a')](this,_0x179cb3);if(_0x2a2120){this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0x1b5'),_0x2a2120));var _0x4afef6=this[_0x32b8('0x31')]['streamFile'](_0x2a2120);try{fs[_0x32b8('0x11d')](_0x2a2120+_0x32b8('0xfc'));}catch(_0x20c503){logger[_0x32b8('0x2e')](_0x20c503);}return _0x4afef6;}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x179cb3,_0x32b8('0x1b6'));};AGIVertices['prototype'][_0x32b8('0x1b7')]=function(_0x228417){logger['info'](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x228417['label']));if(!this[_0x32b8('0x7d')](_0x228417[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x228417,'no\x20find\x20by\x20configured');}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));var _0x4744c7=this[_0x32b8('0x4b')][_0x32b8('0x6a')](this,_0x228417[_0x32b8('0x14e')]);if(_0x4744c7){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x1b8')};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1b9')]=function(_0x353bfa){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x1ba'),_0x353bfa['label']));var _0x30de5c=this[_0x32b8('0x31')]['exec'](_0x32b8('0x1bb'),[_0x353bfa['mailbox'],_0x353bfa[_0x32b8('0x73')]]);if(_0x30de5c['result']===-0x1){return _0x30de5c;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xbd'),'VOICEMAIL',_0x353bfa['mailbox']));};AGIVertices['prototype'][_0x32b8('0x1bc')]=function(_0xdf2888){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1bd'),_0xdf2888[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0xdf2888[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xdf2888,_0x32b8('0x19c'));}var _0x118bf5=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0xdf2888[_0x32b8('0xd2')]);if(!_0x118bf5){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xdf2888,_0x32b8('0x10f'));}var _0xd9151b=this[_0x32b8('0x31')][_0x32b8('0xd')](_0x118bf5);return{'code':0xc8,'result':_0xd9151b[_0x32b8('0x9c')]?_0xd9151b[_0x32b8('0x9c')]:'-'};};String[_0x32b8('0x16')][_0x32b8('0x9b')]=function(_0x7ed552,_0x428395){return this[_0x32b8('0x99')](_0x7ed552)['join'](_0x428395);};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 7efe9ff..dcb3d08 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 _0x25f1=['[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','syncHangup','bind','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','[ACW][START]\x20%s','stopAcw','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25f1,0x115));var _0x125f=function(_0x1d3019,_0x8dbbd5){_0x1d3019=_0x1d3019-0x0;var _0x36458e=_0x25f1[_0x1d3019];return _0x36458e;};'use strict';var _=require(_0x125f('0x0'));var moment=require(_0x125f('0x1'));var ami=require(_0x125f('0x2'));var logger=require('../../../config/logger')(_0x125f('0x3'));var RpcUser=require(_0x125f('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1a3fff){this[_0x125f('0x5')]=_0x1a3fff[_0x125f('0x5')];this[_0x125f('0x6')]=_0x1a3fff[_0x125f('0x6')];this[_0x125f('0x7')]=_0x1a3fff[_0x125f('0x7')];this[_0x125f('0x8')]={};ami['on'](_0x125f('0x9'),this[_0x125f('0xa')]['bind'](this));ami['on'](_0x125f('0xb'),this[_0x125f('0xc')]['bind'](this));ami['on']('hangup',this[_0x125f('0xd')][_0x125f('0xe')](this));ami['on']('agentringnoanswer',this[_0x125f('0xf')][_0x125f('0xe')](this));ami['on']('attendedtransfer',this[_0x125f('0x10')]['bind'](this));ami['on'](_0x125f('0x11'),this[_0x125f('0x12')][_0x125f('0xe')](this));ami['on'](_0x125f('0x13'),this[_0x125f('0x14')][_0x125f('0xe')](this));}function getDiff(_0xb13f9e){var _0x28c791=moment()['milliseconds'](0x0);var _0x3e3ddf=moment(_0xb13f9e)[_0x125f('0x15')](0x0);return _0x28c791[_0x125f('0x16')](_0x3e3ddf,_0x125f('0x17'));}Acw[_0x125f('0x18')][_0x125f('0x19')]=function(_0x3f4ce5,_0x54b14b){var _0x18bd6d=this;var _0x4d4cd6=getDiff(_0x18bd6d[_0x125f('0x7')][_0x3f4ce5]['lastPauseAt']);clearTimeout(_0x18bd6d[_0x125f('0x7')][_0x3f4ce5][_0x125f('0x1a')]);_0x18bd6d[_0x125f('0x7')][_0x3f4ce5]['timer']=![];return RpcVoiceAgentReport[_0x125f('0x1b')]({'acwtime':_0x4d4cd6},_0x18bd6d['timers'][_0x3f4ce5][_0x125f('0x1c')],_0x3f4ce5)[_0x125f('0x1d')](function(_0x3eae75){logger[_0x125f('0x1e')](_0x125f('0x1f'),_0x54b14b,_0x4d4cd6,_0x3eae75);})[_0x125f('0x20')](function(_0x314375){logger[_0x125f('0x21')]('[%s][UPDATE][ERRORS:%s]',_0x54b14b,_0x314375);})[_0x125f('0x22')](function(){delete _0x18bd6d[_0x125f('0x7')][_0x3f4ce5];});};Acw[_0x125f('0x18')][_0x125f('0x23')]=function(_0x1811a1){try{var _0x5ea2a0=this;var _0x39bc59=this['channels'][_0x1811a1][_0x125f('0x24')];var _0x1f6415=this[_0x125f('0x8')][_0x1811a1]['queue'];var _0x161d63=this['voiceQueues'][_0x1f6415];var _0x49d4a4=![];var _0x2e82fc=_0x125f('0x25');if(_0x161d63[_0x125f('0x26')]&&_0x161d63[_0x125f('0x27')][_0x125f('0x28')]){_0x49d4a4=!![];_0x2e82fc=_0x161d63[_0x125f('0x27')]['name'];}return ami[_0x125f('0x29')]({'action':_0x125f('0x2a'),'interface':_0x39bc59,'paused':!![],'reason':_0x2e82fc})[_0x125f('0x1d')](function(){if(_0x5ea2a0['agents'][_0x39bc59]){return RpcUser[_0x125f('0x2b')](_0x5ea2a0[_0x125f('0x6')][_0x39bc59]['id'])[_0x125f('0x1d')](function(_0x4c7a91){if(!_0x4c7a91||_0x4c7a91[_0x125f('0x2c')]){logger[_0x125f('0x1e')](_0x125f('0x2d'),_0x1811a1,_0x39bc59,_0x1f6415);return;}logger[_0x125f('0x1e')](_0x125f('0x2e'),_0x1811a1,_0x39bc59,_0x1f6415);var _0x96f29f=_0x5ea2a0[_0x125f('0x8')][_0x1811a1]['attended']&&_0x5ea2a0[_0x125f('0x8')][_0x1811a1]['destlinkedid']?_0x5ea2a0['channels'][_0x1811a1][_0x125f('0x2f')]:_0x1811a1;return RpcUser[_0x125f('0x30')](_0x5ea2a0['agents'][_0x39bc59],_0x2e82fc,_0x96f29f)[_0x125f('0x1d')](function(_0x4c6b23){_0x5ea2a0[_0x125f('0x5')][_0x1f6415]['available']-=0x1;_0x5ea2a0['voiceQueues'][_0x1f6415]['paused']+=0x1;return _0x4c6b23;});})[_0x125f('0x1d')](function(_0x4c9ffa){if(_0x49d4a4||!_0x4c9ffa){return;}_0x5ea2a0[_0x125f('0x7')][_0x39bc59]={};logger[_0x125f('0x1e')](_0x125f('0x31'),_0x1811a1,_0x5ea2a0['voiceQueues'][_0x1f6415][_0x125f('0x32')],_0x39bc59,_0x1f6415);_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x1a')]=setTimeout(_0x5ea2a0['stopAcw'][_0x125f('0xe')](_0x5ea2a0,_0x39bc59),_0x5ea2a0[_0x125f('0x5')][_0x1f6415][_0x125f('0x32')]*0x3e8);_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x33')]=moment()[_0x125f('0x34')](_0x125f('0x35'));_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x1c')]=_0x1811a1;_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x36')]=_0x1f6415;_0x5ea2a0[_0x125f('0x7')][_0x39bc59][_0x125f('0x19')]=_0x5ea2a0['updateAcw'][_0x125f('0xe')](_0x5ea2a0,_0x39bc59,_0x1811a1);});}})[_0x125f('0x20')](function(){logger[_0x125f('0x21')](_0x125f('0x31'),_0x1811a1,_0x5ea2a0['voiceQueues'][_0x1f6415][_0x125f('0x32')],_0x39bc59,_0x1f6415);})[_0x125f('0x22')](function(){delete _0x5ea2a0[_0x125f('0x8')][_0x1811a1];});}catch(_0x56f3d9){logger[_0x125f('0x21')](_0x125f('0x37'),_0x56f3d9['message']);}};Acw[_0x125f('0x18')][_0x125f('0x38')]=function(_0x47d671){try{var _0x1a39f4=this;if(_0x1a39f4[_0x125f('0x7')][_0x47d671]){_0x1a39f4[_0x125f('0x7')][_0x47d671][_0x125f('0x1a')]=![];var _0x48ad71=_0x1a39f4['timers'][_0x47d671][_0x125f('0x1c')];var _0x59bce1=_0x1a39f4[_0x125f('0x7')][_0x47d671][_0x125f('0x36')];var _0x27fefc=_0x1a39f4['voiceQueues'][_0x59bce1][_0x125f('0x32')];logger[_0x125f('0x1e')]('[%s][TIMER][STOP][AGENT:%s]',_0x48ad71,_0x47d671);RpcUser[_0x125f('0x2b')](this['agents'][_0x47d671]['id'])[_0x125f('0x1d')](function(_0x3c1256){if(_0x3c1256['pauseType']===_0x125f('0x25')){return RpcUser['saveUnpause'](_0x1a39f4[_0x125f('0x6')][_0x47d671]);}});RpcVoiceAgentReport[_0x125f('0x1b')]({'acwtime':_0x27fefc,'agentacw':!![]},_0x48ad71,_0x47d671)[_0x125f('0x1d')](function(_0x193346){logger[_0x125f('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0x48ad71,_0x27fefc,_0x193346);})[_0x125f('0x20')](function(_0x3b65e9){logger[_0x125f('0x21')](_0x125f('0x39'),_0x48ad71,_0x3b65e9);});}else{logger[_0x125f('0x21')](_0x125f('0x3a'),_0x47d671);if(_0x1a39f4[_0x125f('0x7')]){logger[_0x125f('0x1e')](_0x125f('0x3b'),JSON[_0x125f('0x3c')](_0x1a39f4[_0x125f('0x7')]));}}}catch(_0x3274da){logger['error'](_0x125f('0x3d'),_0x3274da[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')][_0x125f('0xa')]=function(_0x5ce824){try{if(this[_0x125f('0x5')][_0x5ce824['queue']]&&(this[_0x125f('0x5')][_0x5ce824['queue']]['acw']||this['voiceQueues'][_0x5ce824[_0x125f('0x36')]][_0x125f('0x26')])){if(this[_0x125f('0x6')][_0x5ce824[_0x125f('0x24')]]){this[_0x125f('0x8')][_0x5ce824[_0x125f('0x1c')]]={'queue':_0x5ce824['queue'],'interface':_0x5ce824[_0x125f('0x24')],'destlinkedid':_0x5ce824['destlinkedid']};}}}catch(_0x2de88a){logger[_0x125f('0x21')](_0x125f('0x3f'),_0x2de88a[_0x125f('0x3e')]);}};Acw['prototype'][_0x125f('0x14')]=function(_0x718168){try{if(this[_0x125f('0x5')][_0x718168['queue']]&&(this[_0x125f('0x5')][_0x718168[_0x125f('0x36')]][_0x125f('0x3')]||this[_0x125f('0x5')][_0x718168[_0x125f('0x36')]][_0x125f('0x26')])){if(this['agents'][_0x718168[_0x125f('0x24')]]){this[_0x125f('0x8')][_0x718168['uniqueid']]={'queue':_0x718168[_0x125f('0x36')],'interface':_0x718168[_0x125f('0x24')]};}}}catch(_0x5da6aa){logger['error'](_0x125f('0x40'),_0x5da6aa[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')][_0x125f('0xc')]=function(_0x5da585){try{if(this[_0x125f('0x8')][_0x5da585[_0x125f('0x1c')]]&&_[_0x125f('0x41')](this[_0x125f('0x8')][_0x5da585[_0x125f('0x1c')]][_0x125f('0x42')])){logger[_0x125f('0x1e')](_0x125f('0x43'),_0x5da585[_0x125f('0x1c')]);this['startAcw'](_0x5da585['uniqueid']);}else if(this[_0x125f('0x8')][_0x5da585[_0x125f('0x44')]]&&_['isUndefined'](this[_0x125f('0x8')][_0x5da585[_0x125f('0x44')]]['attended'])){logger[_0x125f('0x1e')](_0x125f('0x45'),_0x5da585[_0x125f('0x44')]);this[_0x125f('0x23')](_0x5da585[_0x125f('0x44')]);}}catch(_0x247fb0){logger[_0x125f('0x21')](_0x125f('0x46'),_0x247fb0[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')][_0x125f('0xd')]=function(_0x3a8ea2){try{if(this[_0x125f('0x8')][_0x3a8ea2['uniqueid']]&&this[_0x125f('0x8')][_0x3a8ea2['uniqueid']][_0x125f('0x42')]){logger[_0x125f('0x1e')](_0x125f('0x47'),_0x3a8ea2[_0x125f('0x1c')]);this[_0x125f('0x23')](_0x3a8ea2[_0x125f('0x1c')]);}else if(this['channels'][_0x3a8ea2['linkedid']]&&this[_0x125f('0x8')][_0x3a8ea2[_0x125f('0x44')]]['attended']){logger[_0x125f('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3a8ea2['linkedid']);this[_0x125f('0x23')](_0x3a8ea2[_0x125f('0x44')]);}}catch(_0x14abff){logger['error']('[ACW][syncHangup]\x20%s',_0x14abff[_0x125f('0x3e')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x3ac0da){try{if(!_[_0x125f('0x48')](this['channels'][_0x3ac0da['transfereeuniqueid']])){this[_0x125f('0x23')](_0x3ac0da[_0x125f('0x49')]);if(this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4a')]]){this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4a')]][_0x125f('0x42')]=!![];this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4b')]]=this['channels'][_0x3ac0da[_0x125f('0x4a')]];this[_0x125f('0x4c')](_0x3ac0da[_0x125f('0x4a')]);}}else if(!_[_0x125f('0x48')](this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4b')]])){this[_0x125f('0x23')](_0x3ac0da['transfertargetuniqueid']);if(this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4d')]]){this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x4d')]]['attended']=!![];this[_0x125f('0x8')][_0x3ac0da[_0x125f('0x49')]]=this[_0x125f('0x8')][_0x3ac0da['origtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x3ac0da['origtransfereruniqueid']);}}}catch(_0x1c90cb){logger[_0x125f('0x21')](_0x125f('0x4e'),_0x1c90cb[_0x125f('0x3e')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x5227df){try{if(this['channels'][_0x5227df[_0x125f('0x4f')]]){logger[_0x125f('0x1e')](_0x125f('0x50'),JSON[_0x125f('0x3c')](_0x5227df[_0x125f('0x4f')]));this['startAcw'](_0x5227df['transfereruniqueid']);}else if(this[_0x125f('0x8')][_0x5227df[_0x125f('0x51')]]){logger[_0x125f('0x1e')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x5227df[_0x125f('0x51')]));this['startAcw'](_0x5227df[_0x125f('0x51')]);}}catch(_0x1c0d81){logger[_0x125f('0x21')](_0x125f('0x52'),_0x1c0d81[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')]['syncAgentRingNoAnswer']=function(_0x38b5ea){try{if(this[_0x125f('0x5')][_0x38b5ea[_0x125f('0x36')]]&&this['voiceQueues'][_0x38b5ea[_0x125f('0x36')]][_0x125f('0x53')]==='all'){if(this[_0x125f('0x6')][_0x38b5ea['interface']]){logger['info'](_0x125f('0x54'),_0x38b5ea[_0x125f('0x1c')],_0x38b5ea['interface'],_0x38b5ea['queue']);return RpcUser[_0x125f('0x30')](this[_0x125f('0x6')][_0x38b5ea[_0x125f('0x24')]],'Auto-Pause',_0x38b5ea['uniqueid']);}}}catch(_0x636d6b){logger['error'](_0x125f('0x55'),_0x636d6b[_0x125f('0x3e')]);}};Acw[_0x125f('0x18')][_0x125f('0x4c')]=function(_0x33772b,_0x541857=0x2710){if(this[_0x125f('0x8')][_0x33772b]){setTimeout(()=>{delete this[_0x125f('0x8')][_0x33772b];},_0x541857);}};module['exports']=Acw; \ No newline at end of file +var _0x217a=['savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','destlinkedid','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','catch','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','ACW','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','attended','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]'];(function(_0x4a8a8e,_0x42fdbc){var _0x4590ac=function(_0x28450b){while(--_0x28450b){_0x4a8a8e['push'](_0x4a8a8e['shift']());}};_0x4590ac(++_0x42fdbc);}(_0x217a,0xbb));var _0xa217=function(_0x5c34e9,_0x5ae892){_0x5c34e9=_0x5c34e9-0x0;var _0x337571=_0x217a[_0x5c34e9];return _0x337571;};'use strict';var _=require(_0xa217('0x0'));var moment=require(_0xa217('0x1'));var ami=require(_0xa217('0x2'));var logger=require(_0xa217('0x3'))(_0xa217('0x4'));var RpcUser=require(_0xa217('0x5'));var RpcVoiceAgentReport=require(_0xa217('0x6'));function Acw(_0x2bd74b){this[_0xa217('0x7')]=_0x2bd74b[_0xa217('0x7')];this['agents']=_0x2bd74b[_0xa217('0x8')];this[_0xa217('0x9')]=_0x2bd74b[_0xa217('0x9')];this['channels']={};ami['on'](_0xa217('0xa'),this[_0xa217('0xb')][_0xa217('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xa217('0xc')](this));ami['on'](_0xa217('0xd'),this['syncHangup'][_0xa217('0xc')](this));ami['on'](_0xa217('0xe'),this[_0xa217('0xf')][_0xa217('0xc')](this));ami['on']('attendedtransfer',this[_0xa217('0x10')]['bind'](this));ami['on'](_0xa217('0x11'),this[_0xa217('0x12')][_0xa217('0xc')](this));ami['on']('custom:agentConnectPreview',this[_0xa217('0x13')][_0xa217('0xc')](this));}function getDiff(_0xd7f25){var _0x19d12f=moment()[_0xa217('0x14')](0x0);var _0x13a6f2=moment(_0xd7f25)[_0xa217('0x14')](0x0);return _0x19d12f[_0xa217('0x15')](_0x13a6f2,_0xa217('0x16'));}Acw[_0xa217('0x17')][_0xa217('0x18')]=function(_0x29183d,_0xac03fe){var _0x17aff1=this;var _0x14226d=getDiff(_0x17aff1[_0xa217('0x9')][_0x29183d][_0xa217('0x19')]);clearTimeout(_0x17aff1['timers'][_0x29183d]['timer']);_0x17aff1[_0xa217('0x9')][_0x29183d][_0xa217('0x1a')]=![];return RpcVoiceAgentReport[_0xa217('0x1b')]({'acwtime':_0x14226d},_0x17aff1[_0xa217('0x9')][_0x29183d][_0xa217('0x1c')],_0x29183d)['then'](function(_0x12dda0){logger[_0xa217('0x1d')](_0xa217('0x1e'),_0xac03fe,_0x14226d,_0x12dda0);})['catch'](function(_0x3aeb25){logger[_0xa217('0x1f')](_0xa217('0x20'),_0xac03fe,_0x3aeb25);})[_0xa217('0x21')](function(){delete _0x17aff1['timers'][_0x29183d];});};Acw[_0xa217('0x17')][_0xa217('0x22')]=function(_0x1afb89){try{var _0x425a8d=this;var _0x55066f=this[_0xa217('0x23')][_0x1afb89][_0xa217('0x24')];var _0x311d02=this[_0xa217('0x23')][_0x1afb89][_0xa217('0x25')];var _0x4953bc=this[_0xa217('0x7')][_0x311d02];var _0x119725=![];var _0x1a452d='ACW';if(_0x4953bc[_0xa217('0x26')]&&_0x4953bc[_0xa217('0x27')][_0xa217('0x28')]){_0x119725=!![];_0x1a452d=_0x4953bc[_0xa217('0x27')]['name'];}return ami['Action']({'action':_0xa217('0x29'),'interface':_0x55066f,'paused':!![],'reason':_0x1a452d})['then'](function(){if(_0x425a8d[_0xa217('0x8')][_0x55066f]){return RpcUser[_0xa217('0x2a')](_0x425a8d[_0xa217('0x8')][_0x55066f]['id'])[_0xa217('0x2b')](function(_0x405ccf){if(!_0x405ccf||_0x405ccf[_0xa217('0x2c')]){logger[_0xa217('0x1d')](_0xa217('0x2d'),_0x1afb89,_0x55066f,_0x311d02);return;}logger[_0xa217('0x1d')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x1afb89,_0x55066f,_0x311d02);var _0x43f1e6=_0x425a8d['channels'][_0x1afb89]['attended']&&_0x425a8d[_0xa217('0x23')][_0x1afb89][_0xa217('0x2e')]?_0x425a8d['channels'][_0x1afb89][_0xa217('0x2e')]:_0x1afb89;return RpcUser['savePause'](_0x425a8d[_0xa217('0x8')][_0x55066f],_0x1a452d,_0x43f1e6)['then'](function(_0x35743a){_0x425a8d[_0xa217('0x7')][_0x311d02][_0xa217('0x2f')]-=0x1;_0x425a8d[_0xa217('0x7')][_0x311d02][_0xa217('0x30')]+=0x1;return _0x35743a;});})[_0xa217('0x2b')](function(_0x475abf){if(_0x119725||!_0x475abf){return;}_0x425a8d[_0xa217('0x9')][_0x55066f]={};logger[_0xa217('0x1d')](_0xa217('0x31'),_0x1afb89,_0x425a8d[_0xa217('0x7')][_0x311d02][_0xa217('0x32')],_0x55066f,_0x311d02);_0x425a8d[_0xa217('0x9')][_0x55066f][_0xa217('0x1a')]=setTimeout(_0x425a8d[_0xa217('0x33')][_0xa217('0xc')](_0x425a8d,_0x55066f),_0x425a8d[_0xa217('0x7')][_0x311d02][_0xa217('0x32')]*0x3e8);_0x425a8d['timers'][_0x55066f]['lastPauseAt']=moment()['format'](_0xa217('0x34'));_0x425a8d[_0xa217('0x9')][_0x55066f]['uniqueid']=_0x1afb89;_0x425a8d[_0xa217('0x9')][_0x55066f]['queue']=_0x311d02;_0x425a8d[_0xa217('0x9')][_0x55066f][_0xa217('0x18')]=_0x425a8d[_0xa217('0x18')]['bind'](_0x425a8d,_0x55066f,_0x1afb89);});}})[_0xa217('0x35')](function(){logger['error'](_0xa217('0x31'),_0x1afb89,_0x425a8d[_0xa217('0x7')][_0x311d02]['acwTimeout'],_0x55066f,_0x311d02);})['finally'](function(){delete _0x425a8d[_0xa217('0x23')][_0x1afb89];});}catch(_0x9b6e0){logger['error'](_0xa217('0x36'),_0x9b6e0[_0xa217('0x37')]);}};Acw[_0xa217('0x17')]['stopAcw']=function(_0x5b9c30){try{var _0x32f1b9=this;if(_0x32f1b9[_0xa217('0x9')][_0x5b9c30]){_0x32f1b9[_0xa217('0x9')][_0x5b9c30][_0xa217('0x1a')]=![];var _0x25a4de=_0x32f1b9[_0xa217('0x9')][_0x5b9c30]['uniqueid'];var _0x497a9f=_0x32f1b9[_0xa217('0x9')][_0x5b9c30][_0xa217('0x25')];var _0x954fad=_0x32f1b9[_0xa217('0x7')][_0x497a9f][_0xa217('0x32')];logger[_0xa217('0x1d')](_0xa217('0x38'),_0x25a4de,_0x5b9c30);RpcUser['getAgent'](this[_0xa217('0x8')][_0x5b9c30]['id'])['then'](function(_0x5dadc7){if(_0x5dadc7[_0xa217('0x39')]===_0xa217('0x3a')){return RpcUser[_0xa217('0x3b')](_0x32f1b9[_0xa217('0x8')][_0x5b9c30]);}});RpcVoiceAgentReport[_0xa217('0x1b')]({'acwtime':_0x954fad,'agentacw':!![]},_0x25a4de,_0x5b9c30)[_0xa217('0x2b')](function(_0x2b4d5){logger['info'](_0xa217('0x1e'),_0x25a4de,_0x954fad,_0x2b4d5);})[_0xa217('0x35')](function(_0x2cef8a){logger[_0xa217('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x25a4de,_0x2cef8a);});}else{logger[_0xa217('0x1f')](_0xa217('0x3c'),_0x5b9c30);if(_0x32f1b9[_0xa217('0x9')]){logger[_0xa217('0x1d')](_0xa217('0x3d'),JSON[_0xa217('0x3e')](_0x32f1b9[_0xa217('0x9')]));}}}catch(_0x22ae54){logger[_0xa217('0x1f')](_0xa217('0x3f'),_0x22ae54[_0xa217('0x37')]);}};Acw[_0xa217('0x17')][_0xa217('0xb')]=function(_0xb8b301){try{if(this[_0xa217('0x7')][_0xb8b301[_0xa217('0x25')]]&&(this[_0xa217('0x7')][_0xb8b301[_0xa217('0x25')]][_0xa217('0x4')]||this[_0xa217('0x7')][_0xb8b301[_0xa217('0x25')]][_0xa217('0x26')])){if(this[_0xa217('0x8')][_0xb8b301[_0xa217('0x24')]]){this[_0xa217('0x23')][_0xb8b301[_0xa217('0x1c')]]={'queue':_0xb8b301['queue'],'interface':_0xb8b301[_0xa217('0x24')],'destlinkedid':_0xb8b301[_0xa217('0x2e')]};}}}catch(_0x4cc0c5){logger[_0xa217('0x1f')]('[ACW][syncAgentConnect]\x20%s',_0x4cc0c5['message']);}};Acw[_0xa217('0x17')][_0xa217('0x13')]=function(_0x4920d6){try{if(this[_0xa217('0x7')][_0x4920d6[_0xa217('0x25')]]&&(this[_0xa217('0x7')][_0x4920d6[_0xa217('0x25')]][_0xa217('0x4')]||this[_0xa217('0x7')][_0x4920d6[_0xa217('0x25')]][_0xa217('0x26')])){if(this[_0xa217('0x8')][_0x4920d6[_0xa217('0x24')]]){this[_0xa217('0x23')][_0x4920d6['uniqueid']]={'queue':_0x4920d6['queue'],'interface':_0x4920d6[_0xa217('0x24')]};}}}catch(_0x478f4e){logger['error'](_0xa217('0x40'),_0x478f4e[_0xa217('0x37')]);}};Acw['prototype'][_0xa217('0x41')]=function(_0xc0626b){try{if(this['channels'][_0xc0626b[_0xa217('0x1c')]]&&_[_0xa217('0x42')](this[_0xa217('0x23')][_0xc0626b[_0xa217('0x1c')]]['attended'])){logger[_0xa217('0x1d')](_0xa217('0x43'),_0xc0626b['uniqueid']);this['startAcw'](_0xc0626b[_0xa217('0x1c')]);}else if(this[_0xa217('0x23')][_0xc0626b[_0xa217('0x44')]]&&_[_0xa217('0x42')](this[_0xa217('0x23')][_0xc0626b[_0xa217('0x44')]]['attended'])){logger[_0xa217('0x1d')](_0xa217('0x45'),_0xc0626b[_0xa217('0x44')]);this['startAcw'](_0xc0626b[_0xa217('0x44')]);}}catch(_0x20350b){logger['error'](_0xa217('0x46'),_0x20350b[_0xa217('0x37')]);}};Acw[_0xa217('0x17')]['syncHangup']=function(_0x76aed3){try{if(this['channels'][_0x76aed3[_0xa217('0x1c')]]&&this[_0xa217('0x23')][_0x76aed3[_0xa217('0x1c')]][_0xa217('0x47')]){logger[_0xa217('0x1d')](_0xa217('0x48'),_0x76aed3[_0xa217('0x1c')]);this['startAcw'](_0x76aed3[_0xa217('0x1c')]);}else if(this[_0xa217('0x23')][_0x76aed3[_0xa217('0x44')]]&&this[_0xa217('0x23')][_0x76aed3['linkedid']][_0xa217('0x47')]){logger[_0xa217('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x76aed3['linkedid']);this[_0xa217('0x22')](_0x76aed3[_0xa217('0x44')]);}}catch(_0xe56b3c){logger[_0xa217('0x1f')](_0xa217('0x49'),_0xe56b3c[_0xa217('0x37')]);}};Acw[_0xa217('0x17')][_0xa217('0x10')]=function(_0x11a8fb){try{if(!_[_0xa217('0x4a')](this[_0xa217('0x23')][_0x11a8fb[_0xa217('0x4b')]])){this['startAcw'](_0x11a8fb[_0xa217('0x4b')]);if(this['channels'][_0x11a8fb[_0xa217('0x4c')]]){this[_0xa217('0x23')][_0x11a8fb[_0xa217('0x4c')]][_0xa217('0x47')]=!![];this[_0xa217('0x23')][_0x11a8fb[_0xa217('0x4d')]]=this[_0xa217('0x23')][_0x11a8fb['secondtransfereruniqueid']];this[_0xa217('0x4e')](_0x11a8fb[_0xa217('0x4c')]);}}else if(!_[_0xa217('0x4a')](this[_0xa217('0x23')][_0x11a8fb[_0xa217('0x4d')]])){this[_0xa217('0x22')](_0x11a8fb[_0xa217('0x4d')]);if(this['channels'][_0x11a8fb[_0xa217('0x4f')]]){this[_0xa217('0x23')][_0x11a8fb['origtransfereruniqueid']][_0xa217('0x47')]=!![];this[_0xa217('0x23')][_0x11a8fb[_0xa217('0x4b')]]=this[_0xa217('0x23')][_0x11a8fb[_0xa217('0x4f')]];this[_0xa217('0x4e')](_0x11a8fb[_0xa217('0x4f')]);}}}catch(_0x2b5759){logger[_0xa217('0x1f')](_0xa217('0x50'),_0x2b5759['message']);}};Acw[_0xa217('0x17')][_0xa217('0x12')]=function(_0x1efe4f){try{if(this[_0xa217('0x23')][_0x1efe4f[_0xa217('0x51')]]){logger[_0xa217('0x1d')](_0xa217('0x52'),JSON[_0xa217('0x3e')](_0x1efe4f['transfereruniqueid']));this[_0xa217('0x22')](_0x1efe4f[_0xa217('0x51')]);}else if(this[_0xa217('0x23')][_0x1efe4f['transfererlinkedid']]){logger[_0xa217('0x1d')](_0xa217('0x53'),JSON[_0xa217('0x3e')](_0x1efe4f[_0xa217('0x54')]));this[_0xa217('0x22')](_0x1efe4f[_0xa217('0x54')]);}}catch(_0x8774a3){logger[_0xa217('0x1f')](_0xa217('0x55'),_0x8774a3['message']);}};Acw[_0xa217('0x17')][_0xa217('0xf')]=function(_0x33046c){try{if(this['voiceQueues'][_0x33046c[_0xa217('0x25')]]&&this[_0xa217('0x7')][_0x33046c[_0xa217('0x25')]][_0xa217('0x56')]===_0xa217('0x57')){if(this[_0xa217('0x8')][_0x33046c[_0xa217('0x24')]]){logger['info'](_0xa217('0x58'),_0x33046c[_0xa217('0x1c')],_0x33046c[_0xa217('0x24')],_0x33046c[_0xa217('0x25')]);return RpcUser[_0xa217('0x59')](this[_0xa217('0x8')][_0x33046c[_0xa217('0x24')]],'Auto-Pause',_0x33046c[_0xa217('0x1c')]);}}}catch(_0x4d45d9){logger[_0xa217('0x1f')](_0xa217('0x5a'),_0x4d45d9[_0xa217('0x37')]);}};Acw['prototype'][_0xa217('0x4e')]=function(_0x22d60b,_0x5f5dd7=0x2710){if(this[_0xa217('0x23')][_0x22d60b]){setTimeout(()=>{delete this[_0xa217('0x23')][_0x22d60b];},_0x5f5dd7);}};module[_0xa217('0x5b')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 00986a7..3dbab3d 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 _0x72d8=['format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','port','asterisk','username','password','Action','promisify','action','error'];(function(_0x5b3784,_0x313e94){var _0x2f9d6d=function(_0x2fc710){while(--_0x2fc710){_0x5b3784['push'](_0x5b3784['shift']());}};_0x2f9d6d(++_0x313e94);}(_0x72d8,0x1c6));var _0x872d=function(_0x45afec,_0x18bc92){_0x45afec=_0x45afec-0x0;var _0x5a841a=_0x72d8[_0x45afec];return _0x5a841a;};'use strict';var Manager=require(_0x872d('0x0'));var BPromise=require(_0x872d('0x1'));var util=require(_0x872d('0x2'));var logger=require(_0x872d('0x3'))(_0x872d('0x4'));var config=require(_0x872d('0x5'));var ami=new Manager(config['asterisk'][_0x872d('0x6')],config[_0x872d('0x7')]['ip'],config[_0x872d('0x7')][_0x872d('0x8')],config[_0x872d('0x7')][_0x872d('0x9')],!![]);ami['keepConnected']();ami[_0x872d('0xa')]=BPromise[_0x872d('0xb')](ami[_0x872d('0xc')]);function error(_0x2c98a1){logger[_0x872d('0xd')](util[_0x872d('0xe')](_0x872d('0xf'),config[_0x872d('0x7')][_0x872d('0x8')],config[_0x872d('0x7')]['ip'],config[_0x872d('0x7')][_0x872d('0x6')],util[_0x872d('0x10')](_0x2c98a1,![],null)));}function close(){logger[_0x872d('0xd')](util[_0x872d('0xe')](_0x872d('0x11'),config['asterisk']['username'],config[_0x872d('0x7')]['ip'],config[_0x872d('0x7')]['port']));}ami[_0x872d('0x12')]=function(){return function(){return ami[_0x872d('0xa')]({'action':_0x872d('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x872d('0xa')]({'action':'devicestatelist'});};};ami[_0x872d('0x14')]=function(){return function(){return ami[_0x872d('0xa')]({'action':_0x872d('0x15')});};};ami[_0x872d('0x16')]=function(){return function(){return ami['Action']({'action':_0x872d('0x17')});};};ami[_0x872d('0x18')]=function(){return function(){return ami[_0x872d('0xa')]({'action':_0x872d('0x19')});};};function connect(){logger[_0x872d('0x1a')](util[_0x872d('0xe')](_0x872d('0x1b'),config['asterisk'][_0x872d('0x8')],config[_0x872d('0x7')]['ip'],config[_0x872d('0x7')][_0x872d('0x6')]));ami[_0x872d('0x1c')](_0x872d('0xd'),error);ami['once'](_0x872d('0x1d'),close);}ami['on'](_0x872d('0x1e'),connect);ami['on'](_0x872d('0x1f'),function(_0x37ee95){logger[_0x872d('0x1a')](util[_0x872d('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x872d('0x8')],config['asterisk']['ip'],config[_0x872d('0x7')]['port'],util[_0x872d('0x10')](_0x37ee95,![],null)));});ami['on'](_0x872d('0x20'),function(){logger[_0x872d('0x1a')](util[_0x872d('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x872d('0x7')][_0x872d('0x8')],config['asterisk']['ip'],config['asterisk'][_0x872d('0x6')]));return Promise[_0x872d('0x21')]()[_0x872d('0x22')](ami[_0x872d('0x12')]())[_0x872d('0x22')](ami[_0x872d('0x23')]())[_0x872d('0x22')](ami['actionSipPeerStatus']())[_0x872d('0x22')](ami[_0x872d('0x16')]())[_0x872d('0x22')](ami['actionCoreShowChannels']())[_0x872d('0x24')](function(_0x44e67e){logger[_0x872d('0xd')](_0x872d('0x25'),util[_0x872d('0x10')](_0x44e67e,{'showHidden':![],'depth':null}));});});ami[_0x872d('0x1c')](_0x872d('0xd'),error);ami[_0x872d('0x1c')](_0x872d('0x1d'),close);module[_0x872d('0x26')]=ami; \ No newline at end of file +var _0x228c=['actionSipShowRegistry','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Action','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','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','inspect','fullybooted','resolve','then'];(function(_0x22a263,_0x394c4c){var _0x5b8e5e=function(_0x4d6229){while(--_0x4d6229){_0x22a263['push'](_0x22a263['shift']());}};_0x5b8e5e(++_0x394c4c);}(_0x228c,0xb7));var _0xc228=function(_0x1da004,_0x3eb503){_0x1da004=_0x1da004-0x0;var _0x1ab396=_0x228c[_0x1da004];return _0x1ab396;};'use strict';var Manager=require(_0xc228('0x0'));var BPromise=require(_0xc228('0x1'));var util=require(_0xc228('0x2'));var logger=require(_0xc228('0x3'))(_0xc228('0x4'));var config=require(_0xc228('0x5'));var ami=new Manager(config[_0xc228('0x6')][_0xc228('0x7')],config[_0xc228('0x6')]['ip'],config[_0xc228('0x6')][_0xc228('0x8')],config[_0xc228('0x6')][_0xc228('0x9')],!![]);ami[_0xc228('0xa')]();ami['Action']=BPromise[_0xc228('0xb')](ami[_0xc228('0xc')]);function error(_0x563801){logger[_0xc228('0xd')](util[_0xc228('0xe')](_0xc228('0xf'),config[_0xc228('0x6')][_0xc228('0x8')],config[_0xc228('0x6')]['ip'],config[_0xc228('0x6')]['port'],util['inspect'](_0x563801,![],null)));}function close(){logger[_0xc228('0xd')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xc228('0x8')],config[_0xc228('0x6')]['ip'],config[_0xc228('0x6')][_0xc228('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xc228('0x10')]({'action':'sipshowregistry'});};};ami[_0xc228('0x11')]=function(){return function(){return ami[_0xc228('0x10')]({'action':_0xc228('0x12')});};};ami[_0xc228('0x13')]=function(){return function(){return ami[_0xc228('0x10')]({'action':_0xc228('0x14')});};};ami[_0xc228('0x15')]=function(){return function(){return ami[_0xc228('0x10')]({'action':'queuesummary'});};};ami[_0xc228('0x16')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(){logger[_0xc228('0x17')](util[_0xc228('0xe')](_0xc228('0x18'),config['asterisk'][_0xc228('0x8')],config[_0xc228('0x6')]['ip'],config[_0xc228('0x6')][_0xc228('0x7')]));ami['once'](_0xc228('0xd'),error);ami[_0xc228('0x19')](_0xc228('0x1a'),close);}ami['on'](_0xc228('0x1b'),connect);ami['on']('shutdown',function(_0x34fb52){logger[_0xc228('0x17')](util['format'](_0xc228('0x1c'),config[_0xc228('0x6')][_0xc228('0x8')],config['asterisk']['ip'],config[_0xc228('0x6')][_0xc228('0x7')],util[_0xc228('0x1d')](_0x34fb52,![],null)));});ami['on'](_0xc228('0x1e'),function(){logger[_0xc228('0x17')](util[_0xc228('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xc228('0x6')][_0xc228('0x8')],config[_0xc228('0x6')]['ip'],config[_0xc228('0x6')][_0xc228('0x7')]));return Promise[_0xc228('0x1f')]()[_0xc228('0x20')](ami[_0xc228('0x21')]())[_0xc228('0x20')](ami[_0xc228('0x11')]())[_0xc228('0x20')](ami[_0xc228('0x13')]())[_0xc228('0x20')](ami[_0xc228('0x15')]())['then'](ami['actionCoreShowChannels']())[_0xc228('0x22')](function(_0x5c3e2a){logger['error'](_0xc228('0x23'),util['inspect'](_0x5c3e2a,{'showHidden':![],'depth':null}));});});ami['once'](_0xc228('0xd'),error);ami['once'](_0xc228('0x1a'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 198101f..e12ad78 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xda3f,0xec));var _0xfda3=function(_0x405884,_0x51bc5a){_0x405884=_0x405884-0x0;var _0x350bab=_0xda3f[_0x405884];return _0x350bab;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x70e0,0x17b));var _0x070e=function(_0x23d30e,_0x44eb87){_0x23d30e=_0x23d30e-0x0;var _0x4de539=_0x70e0[_0x23d30e];return _0x4de539;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 8b3c553..fea11cb 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 _0x752a=['HANGUP','[syncHangupInAMDIvr]','createStateFinal','[syncHangup]','ivrAnswerCallsDay','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','[syncHangup2]','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','running','statusMessage','available','paused','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','reachable','resolve','map','Agent','user:%s','user:dialPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[actions]','undefined','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','handlePreviewRecallNotifications','launchHandleIvr','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','xcally-motion-dialer','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','run','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[handleIvr]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[handlePower]','[getContactCampaign2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[countReScheduled]\x20','[actionOriginatePredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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','[busyFactor]','Ts\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','CAMPAIGN_STATUS','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','[ifTime][Action]','stringify','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','push','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','Action','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','isIVRCampaign','isIVRCampaignActive','dialGlobalInterval','dialTimezone','[syncCampaigns]','dialMethod','handlePower','power','dialPowerLevel','Queue','silly','Dialer::ifTime()','intervalIftime','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','getSeconds','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','agiafterat','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','callAdditionalPhoneAfterMin','dialAbandonedRetryFrequency','VoiceQueueId','[rescheduleContact][Abandoned]','starttime','createHistory','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','roundrobin','isNil','locked','stateinterface','rrmemory','idHopper','[syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','[syncOriginateResponse]','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','value','[syncVarSet]','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x752a,0x103));var _0xa752=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x752a[_0x3c4a7c];return _0xf13d1e;};'use strict';var util=require(_0xa752('0x0'));var _=require(_0xa752('0x1'));var uuid=require(_0xa752('0x2'));var moment=require(_0xa752('0x3'));var rr=require('rr');var Redis=require(_0xa752('0x4'));var utils=require('./utils');var hopperUtils=require(_0xa752('0x5'));var ut=require(_0xa752('0x6'));var config=require(_0xa752('0x7'));var logger=require(_0xa752('0x8'))(_0xa752('0x9'));var loggerBooked=require('../../../config/logger')(_0xa752('0xa'));var loggerPredictive=require(_0xa752('0x8'))(_0xa752('0xb'));var loggerPredictiveCalls=require(_0xa752('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xa752('0x8'))(_0xa752('0xc'));var ami=require(_0xa752('0xd'));config[_0xa752('0xe')]=_['defaults'](config[_0xa752('0xe')],{'host':_0xa752('0xf'),'port':0x18eb});var io=require(_0xa752('0x10'))(new Redis(config[_0xa752('0xe')]));var cmHopper=require(_0xa752('0x11'));var voiceQueueRt=require(_0xa752('0x12'));var RpcSetting=require(_0xa752('0x13'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0xa752('0x14'));var Final=require(_0xa752('0x15'));var AgentComplete=require(_0xa752('0x16'));var QueueCallerAbandon=require(_0xa752('0x17'));var Hangup=require(_0xa752('0x18'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa752('0x19')]['enqueue']=function(_0x17501d){this[_0xa752('0x1a')]=this[_0xa752('0x1a')]?this[_0xa752('0x1a')][_0xa752('0x1b')](_0x17501d):_0x17501d();};function Dialer(_0x458c6d,_0x4a74b6){this[_0xa752('0x1c')]=new Sequence();this[_0xa752('0x1d')]=_0x4a74b6;this['voiceQueues']=_0x458c6d[_0xa752('0x1e')];this[_0xa752('0x1f')]=_0x458c6d[_0xa752('0x1f')];this[_0xa752('0x20')]=_0x458c6d[_0xa752('0x20')];this[_0xa752('0x21')]=_0x458c6d['trunks'];this[_0xa752('0x22')]=config[_0xa752('0x22')]||0x2;this[_0xa752('0x23')]={};this[_0xa752('0x24')]={};this[_0xa752('0x25')]={};this['uniqueId']={};this[_0xa752('0x26')]={};this[_0xa752('0x27')]={};this[_0xa752('0x28')]={};this[_0xa752('0x29')]={};this[_0xa752('0x2a')]={};this[_0xa752('0x2b')]={};this[_0xa752('0x2c')]={};ami['on'](_0xa752('0x2d'),this['syncAgentConnect'][_0xa752('0x2e')](this));ami['on'](_0xa752('0x2f'),this[_0xa752('0x30')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xa752('0x2e')](this));ami['on'](_0xa752('0x31'),this[_0xa752('0x32')][_0xa752('0x2e')](this));ami['on']('custom:queuesummary',this[_0xa752('0xc')][_0xa752('0x2e')](this));ami['on'](_0xa752('0x33'),this['syncQueueSummaryComplete'][_0xa752('0x2e')](this));ami['on'](_0xa752('0x34'),this[_0xa752('0x35')][_0xa752('0x2e')](this));ami['on']('newexten',this[_0xa752('0x36')][_0xa752('0x2e')](this));ami['on'](_0xa752('0x37'),this[_0xa752('0x38')]['bind'](this));ami['on']('queuemember',this[_0xa752('0x39')]['bind'](this));ami['on'](_0xa752('0x3a'),this[_0xa752('0x3b')][_0xa752('0x2e')](this));this[_0xa752('0x3c')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()['then'](function(_0x575347){previewRecallmeReminderInterval=_0x575347[_0xa752('0x3d')];});}function isNotNull(_0x57d950){return _0x57d950!==null&&!_[_0xa752('0x3e')](_0x57d950);}function msgResponse(_0x912318,_0x1785ed,_0x1275c2){return{'action':_0x912318,'response':_0x1785ed,'message':_0x1275c2,'stack':_0x1275c2};}function emit(_0x1782d6,_0x5361b6,_0x13d275){io['to'](_0x1782d6)[_0xa752('0x3f')](_0x5361b6,_0x13d275);}function emitOutboundVoiceQueueSummary(_0x201449){if(_0x201449[_0xa752('0x40')]===_0xa752('0x41')){logger[_0xa752('0x42')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xa752('0x43')](_0x201449,{'showHidden':![],'depth':null}));emit(util[_0xa752('0x44')](_0xa752('0x45'),_0x201449[_0xa752('0x46')]),_0xa752('0x47'),_0x201449);}}function checkGetDataPredictive(_0x403264){if(isNotNull(_0x403264)&&!_[_0xa752('0x48')](_0x403264)){loggerPredictive[_0xa752('0x49')](_0xa752('0x4a'));loggerPredictive[_0xa752('0x49')](_0xa752('0x4b'),_0x403264[_0xa752('0x4c')]);loggerPredictive[_0xa752('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x403264['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xa752('0x49')](_0xa752('0x4d'),_0x403264[_0xa752('0x4e')]);loggerPredictive[_0xa752('0x49')](_0xa752('0x4f'),_0x403264[_0xa752('0x50')]);loggerPredictive['info'](_0xa752('0x51'),_0x403264['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x403264[_0xa752('0x52')]);loggerPredictive[_0xa752('0x49')](_0xa752('0x53'));if(_0x403264[_0xa752('0x4c')]>0x0){if(!_[_0xa752('0x3e')](_0x403264[_0xa752('0x52')])&&_0x403264['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xa752('0x49')](_0xa752('0x54'));if(!_['isUndefined'](_0x403264[_0xa752('0x55')])&&_0x403264[_0xa752('0x55')]>0x0){return!![];}loggerPredictive[_0xa752('0x49')](_0xa752('0x56'));}else{loggerPredictive[_0xa752('0x49')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xa752('0x49')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x44e380){return function(_0xe3baf6){loggerPredictive[_0xa752('0x49')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xa752('0x49')](_0xa752('0x57'),_0xe3baf6[_0xa752('0x58')]);loggerPredictive[_0xa752('0x49')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe3baf6['erlangCallToSecond']);loggerPredictive[_0xa752('0x49')](_0xa752('0x59'),_0xe3baf6['erlangAbandonmentRate']);loggerPredictive[_0xa752('0x49')](_0xa752('0x5a'),_0xe3baf6[_0xa752('0x5b')]);loggerPredictive[_0xa752('0x49')](_0xa752('0x59'),_0xe3baf6[_0xa752('0x5c')]);loggerPredictive['info']('---------------------------');_[_0xa752('0x5d')](_0x44e380,_0xe3baf6);};}function ifInterval(_0x1e4ed4,_0xfb3799){if(_['isUndefined'](_0xfb3799)){return![];}return utils['getSeconds'](undefined,_0xfb3799)<_0x1e4ed4*0x3c;}function clearPredictiveAttributes(_0x3c4653){if(_0x3c4653[_0xa752('0x28')]){_0x3c4653[_0xa752('0x28')]=undefined;loggerPredictive[_0xa752('0x42')](_0x3c4653[_0xa752('0x46')],_0xa752('0x5e'));}if(_0x3c4653[_0xa752('0x27')]){_0x3c4653[_0xa752('0x27')]=undefined;loggerPredictive['debug'](_0x3c4653['name'],_0xa752('0x5f'));}if(_0x3c4653[_0xa752('0x60')]){clearInterval(_0x3c4653[_0xa752('0x60')]);_0x3c4653[_0xa752('0x60')]=undefined;loggerPredictive[_0xa752('0x42')](_0x3c4653[_0xa752('0x46')],_0xa752('0x61'));}}function loggerCatchPredictive(_0x9309bd,_0x4bbaa6){return function(_0x3c3905){loggerPredictive[_0xa752('0x62')](_0x4bbaa6[_0xa752('0x46')],_0x9309bd);loggerPredictive[_0xa752('0x62')](_0x3c3905[_0xa752('0x63')]);clearPredictiveAttributes(_0x4bbaa6);};}function loggerCatch(_0x44d4f3){return function(_0x3ea42f){logger[_0xa752('0x62')](_0x44d4f3,util[_0xa752('0x43')](_0x3ea42f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x39fa51){return function(_0x1f5f32){if(isNotNull(_0x1f5f32)&&isNotNull(_0x1f5f32[0x0])){if(_0x1f5f32[0x0][_0xa752('0x64')]>0x0){_0x39fa51[_0xa752('0x65')]=utils['CAMPAIGN_STATUS'][_0xa752('0x66')];logger[_0xa752('0x49')](_0xa752('0x67')+_0x39fa51[_0xa752('0x46')],_0x1f5f32[0x0][_0xa752('0x64')],_0xa752('0x68'));}else{_0x39fa51['message']=utils['CAMPAIGN_STATUS'][_0xa752('0x69')];logger[_0xa752('0x49')](_0xa752('0x6a')+_0x39fa51['name']);}}};}function createObjHistory(_0x71a097,_0x1d9aba,_0x4de8b6,_0x240c57,_0x463f10){_0x71a097[_0xa752('0x65')]=_0x4de8b6;var _0x440391=new Action(_0x71a097,_0x1d9aba);var _0xb244f6=new History(_0x440391);_0xb244f6[_0xa752('0x6b')]=_0x240c57;_0xb244f6[_0xa752('0x6c')]=_0x463f10;_0xb244f6[_0xa752('0x6d')]=_0x440391['starttime'];return _0xb244f6;}function unlockQueueStatus(_0x372f9c,_0x59b9e3){setTimeout(function(){if(_[_0xa752('0x3e')](_0x372f9c[_0xa752('0x6e')])){loggerBooked[_0xa752('0x62')](_0xa752('0x6f'),_0x59b9e3);}_0x372f9c[_0xa752('0x6e')]=!![];loggerBooked[_0xa752('0x49')](_0xa752('0x70'),_0x59b9e3,JSON['stringify'](_[_0xa752('0x71')](_0x372f9c,[_0xa752('0x46'),_0xa752('0x6e')])));},0x1f3);}function checkInterval(_0x32820b){return function(){if(!isNotNull(_0x32820b[_0xa752('0x72')])){_0x32820b['message']=utils[_0xa752('0x73')][_0xa752('0x74')];throw _0x32820b[_0xa752('0x46')]+_0xa752('0x75');}if(!isNotNull(_0x32820b['Interval']['Intervals'])){_0x32820b[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x74')];throw _0x32820b['name']+_0xa752('0x75');}if(!isNotNull(_['isEmpty'](_0x32820b[_0xa752('0x72')][_0xa752('0x76')]))){_0x32820b[_0xa752('0x65')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x32820b[_0xa752('0x46')]+_0xa752('0x75');}};}function checkIsIVRCampaignActive(_0x254215){return function(){if(!utils['isIVRCampaignActive'](_0x254215)){_0x254215[_0xa752('0x65')]=utils[_0xa752('0x73')]['INACTIVE'];throw _0x254215[_0xa752('0x46')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x37aedf){if(utils['isIVRCampaign'](_0x37aedf)){emit(util['format'](_0xa752('0x77'),_0x37aedf[_0xa752('0x46')]),_0xa752('0x78'),_0x37aedf);}}function loggerCatchQueueSummary(_0x27a6fb,_0x50bbf2){return function(_0x3a6779){clearPredictiveAttributes(_0x50bbf2);emitCampaignSummary(_0x50bbf2);loggerSyncQueueSummary[_0xa752('0x42')](_0x27a6fb,util[_0xa752('0x43')](_0x3a6779,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3c9071){if(_0x3c9071[_0xa752('0x79')]){if(_0x3c9071[_0xa752('0x7a')]===0x0){_0x3c9071['sendMessageOneNotActive']=![];_0x3c9071[_0xa752('0x65')]=utils['CAMPAIGN_STATUS'][_0xa752('0x7b')];loggerSyncQueueSummary[_0xa752('0x42')](_0xa752('0x7c'),_0x3c9071[_0xa752('0x46')],_0xa752('0x7d'));}else{_0x3c9071[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x7e')];loggerSyncQueueSummary[_0xa752('0x42')](_0xa752('0x7c'),_0x3c9071[_0xa752('0x46')],_0xa752('0x7f'));}emitCampaignSummary(_0x3c9071);}}function myreject(_0x566846){return function(_0x1ed648){return _0x566846(msgResponse(_0xa752('0x80'),'Error',JSON[_0xa752('0x81')](_0x1ed648)));};}Dialer['prototype'][_0xa752('0x82')]=function(_0x1f46be){return!_[_0xa752('0x3e')](_0x1f46be)&&_0x1f46be&&!_[_0xa752('0x3e')](_0x1f46be[_0xa752('0x46')])&&!_[_0xa752('0x3e')](_0x1f46be[_0xa752('0x83')])&&_0x1f46be[_0xa752('0x83')]&&(this['trunks'][util[_0xa752('0x44')](_0xa752('0x84'),_0x1f46be['name'])][_0xa752('0x85')]==='reachable'||this['trunks'][util[_0xa752('0x44')](_0xa752('0x84'),_0x1f46be[_0xa752('0x46')])][_0xa752('0x85')]===_0xa752('0x86'));};Dialer[_0xa752('0x19')][_0xa752('0x87')]=function(_0x2bfccd){var _0x5ba4e1=this;return function(){if(!_0x5ba4e1[_0xa752('0x82')](_0x2bfccd[_0xa752('0x88')])){if(!_0x5ba4e1[_0xa752('0x82')](_0x2bfccd[_0xa752('0x89')])){_0x2bfccd['message']=utils[_0xa752('0x73')][_0xa752('0x8a')];throw _0x2bfccd[_0xa752('0x46')]+_0xa752('0x8b');}}};};Dialer['prototype'][_0xa752('0x8c')]=function(_0x4d2819,_0x2b6c22,_0x12f7f9,_0x994fa3){var _0x212359=this;return function(){var _0x522372=!![];return _0x212359[_0xa752('0x8d')](_0x4d2819,_0x2b6c22,_0x12f7f9,_0x994fa3,_0x522372);};};Dialer[_0xa752('0x19')][_0xa752('0x8e')]=function(_0x3d9f23,_0x38eb74,_0xbb5c41,_0x470839){var _0xc60525=this;return function(){var _0x43ca86=![];return _0xc60525[_0xa752('0x8d')](_0x3d9f23[_0xa752('0x76')],_0x38eb74,_0xbb5c41,_0x470839,_0x43ca86);};};Dialer['prototype'][_0xa752('0x8d')]=function(_0x4674e5,_0x3be7c0,_0x365c5d,_0xbee7e1,_0x1681b6){var _0x57e4fe=[];return new Promise(function(_0x53efc6,_0x1da945){if(!isNotNull(_0x4674e5)){_0xbee7e1[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x74')];return _0x1da945(msgResponse(_0xa752('0x8f'),_0xa752('0x90'),_0x365c5d+_0xa752('0x91')));}if(_[_0xa752('0x48')](_0x4674e5)){_0xbee7e1['message']=utils[_0xa752('0x73')]['EMPTY_INTERVAL'];return _0x1da945(msgResponse(_0xa752('0x8f'),_0xa752('0x90'),_0x365c5d+_0xa752('0x92')));}if(_0x3be7c0&&_[_0xa752('0x3e')](config[_0xa752('0x93')][_0x3be7c0])){_0xbee7e1[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x94')];return _0x1da945(msgResponse(_0xa752('0x8f'),_0xa752('0x90'),_0x365c5d+_0xa752('0x95')+_0x3be7c0));}if(_['isArray'](_0x4674e5)){for(var _0x31c6bd=0x0;_0x31c6bd<_0x4674e5['length'];_0x31c6bd+=0x1){_0x57e4fe[_0xa752('0x96')](ami['Action']({'action':'command','command':util[_0xa752('0x44')](_0xa752('0x97'),_0x4674e5[_0x31c6bd][_0xa752('0x98')],!_[_0xa752('0x3e')](config[_0xa752('0x93')][_0x3be7c0])?_0x3be7c0:'')})[_0xa752('0x99')](function(_0x346ba6){return _0x346ba6[_0xa752('0x9a')][_0xa752('0x9b')](_0xa752('0x9c'))>=0x0;})[_0xa752('0x9d')](myreject(_0x1da945)));}}else{_0x57e4fe[_0xa752('0x96')](ami[_0xa752('0x9e')]({'action':'command','command':util[_0xa752('0x44')](_0xa752('0x97'),_0x4674e5,!_[_0xa752('0x3e')](config['timezones'][_0x3be7c0])?_0x3be7c0:'')})[_0xa752('0x99')](function(_0x246f04){return _0x246f04[_0xa752('0x9a')][_0xa752('0x9b')](_0xa752('0x9c'))>=0x0;})[_0xa752('0x9d')](myreject(_0x1da945)));}Promise[_0xa752('0x9f')](_0x57e4fe)[_0xa752('0x99')](function(_0x44b4c4){var _0x1c9103=_[_0xa752('0xa0')](_0x44b4c4);if(_0x1c9103){return _0x53efc6(_0x1c9103);}else{_0xbee7e1['message']=_0x1681b6?utils[_0xa752('0x73')][_0xa752('0xa1')]:utils['CAMPAIGN_STATUS'][_0xa752('0xa2')];return _0x1da945(msgResponse(_0xa752('0xa3'),'Failure',_0xa752('0xa4')+_0x1681b6+'\x20'+_0x365c5d+_0xa752('0xa5')+util[_0xa752('0x43')](_0x4674e5,{'showHidden':![],'depth':null})+_0xa752('0xa6')+_0x3be7c0));}})[_0xa752('0x9d')](function(_0x363248){return _0x1da945(msgResponse(_0xa752('0x8f'),_0xa752('0x90'),JSON[_0xa752('0x81')](_0x363248)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x3e12a2=this;return cmHopper[_0xa752('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0xa752('0x99')](function(){setInterval(function(){_0x3e12a2[_0xa752('0xa8')]();},0x3e8);});};Dialer[_0xa752('0x19')][_0xa752('0xa8')]=function(){var _0x513c56=this;var _0x330acd;for(var _0x3eb63a in this['campaigns']){if(typeof this['campaigns'][_0x3eb63a]!=='undefined'){_0x330acd=this['campaigns'][_0x3eb63a];if(utils[_0xa752('0xa9')](_0x330acd)&&utils[_0xa752('0xaa')](_0x330acd)){_0x330acd['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xa752('0x99')](checkIsIVRCampaignActive(_0x330acd))['then'](checkInterval(_0x330acd))[_0xa752('0x99')](_0x513c56[_0xa752('0x87')](_0x330acd))['then'](_0x513c56[_0xa752('0x8c')](_0x330acd[_0xa752('0xab')],_0x330acd[_0xa752('0xac')],_0x330acd[_0xa752('0x46')],_0x330acd))['then'](_0x513c56[_0xa752('0x8e')](_0x330acd[_0xa752('0x72')],_0x330acd[_0xa752('0xac')],_0x330acd['name'],_0x330acd))[_0xa752('0x99')](_0x513c56['launchHandleIvr'](_0x330acd))['catch'](loggerCatchQueueSummary(_0xa752('0xad'),_0x330acd));}else{notSendMessagesCampaign(_0x330acd);}}}};Dialer['prototype']['checkDialMethod']=function(_0x4a10cc){if(_0x4a10cc[_0xa752('0xae')]!==_0xa752('0xb')){clearPredictiveAttributes(_0x4a10cc);}switch(_0x4a10cc[_0xa752('0xae')]){case'progressive':this[_0xa752('0xaf')](_0x4a10cc,0x1);break;case _0xa752('0xb0'):this[_0xa752('0xaf')](_0x4a10cc,_0x4a10cc[_0xa752('0xb1')]);break;case'predictive':this[_0xa752('0xb')](_0x4a10cc);break;case _0xa752('0xa'):this['handlePower'](_0x4a10cc,0x1);break;default:logger[_0xa752('0x62')](_0xa752('0xb2'),_0x4a10cc[_0xa752('0x46')],'method\x20not\x20recognized');}};Dialer[_0xa752('0x19')][_0xa752('0x8f')]=function(_0x1b8534,_0x5ac707){var _0x1edc21=_0x1b8534[_0xa752('0xac')];var _0x332c35=_0x5ac707?_0x1b8534[_0xa752('0xab')]:_0x1b8534[_0xa752('0x72')][_0xa752('0x76')];logger[_0xa752('0xb3')](_0xa752('0xb4'),_0x332c35,_0x1edc21,_0x1b8534['name'],util[_0xa752('0x44')]('Voice\x20Queue\x20%s\x20$s',_0x1b8534[_0xa752('0x46')],_0x1b8534['id']));var _0x4d8256=null;return Interval[_0xa752('0xb5')](_0x332c35,_0x1edc21)[_0xa752('0x99')](function(_0x3f7427){if(_0x3f7427===!![]){return _0x3f7427;}else{_0x1b8534[_0xa752('0x65')]=_0x5ac707?utils[_0xa752('0x73')][_0xa752('0xa1')]:utils[_0xa752('0x73')][_0xa752('0xa2')];_0x4d8256=msgResponse(_0xa752('0xa3'),_0xa752('0x90'),'Global:\x20'+_0x5ac707+'\x20'+_0x1b8534[_0xa752('0x46')]+_0xa752('0xa5')+util[_0xa752('0x43')](_0x332c35,{'showHidden':![],'depth':null})+_0xa752('0xa6')+_0x1edc21);}if(_0x4d8256!==null){logger[_0xa752('0xb3')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x4d8256);_0x4d8256[_0xa752('0xb6')]=_0x5ac707;throw _0x4d8256;}})[_0xa752('0x9d')](function(_0x21a7ea){logger[_0xa752('0x62')](_0xa752('0xb7'),_0x21a7ea);throw msgResponse(_0xa752('0x80'),'Error',util[_0xa752('0x43')](_0x21a7ea,{'showHidden':![],'depth':null}));});};Dialer[_0xa752('0x19')][_0xa752('0xb8')]=function(_0x5ebecd){if(this['voiceQueues'][_0x5ebecd[_0xa752('0xb9')]]){if(this[_0xa752('0xba')][_0x5ebecd[_0xa752('0xbb')]]&&this[_0xa752('0xba')][_0x5ebecd[_0xa752('0xbb')]][_0xa752('0x40')]!==_0xa752('0xbc')){utils[_0xa752('0xbd')](this[_0xa752('0x1e')][_0x5ebecd[_0xa752('0xb9')]],_0xa752('0xbe'));this['uniqueId'][_0x5ebecd[_0xa752('0xbb')]][_0xa752('0xbf')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));}}};Dialer[_0xa752('0x19')][_0xa752('0x32')]=function(_0x5b4c79){var _0x3a271c=this['uniqueId'][_0x5b4c79[_0xa752('0xbb')]];if(this[_0xa752('0x1e')][_0x5b4c79[_0xa752('0xb9')]]){if(_0x3a271c&&_0x3a271c[_0xa752('0x40')]!==_0xa752('0xbc')){delete this[_0xa752('0xba')][_0x5b4c79[_0xa752('0xbb')]];this[_0xa752('0x1e')][_0x5b4c79[_0xa752('0xb9')]][_0xa752('0xc1')]+=0x1;var _0xaa71a=new AgentComplete(_0x3a271c,_0x5b4c79);if(_0x5b4c79['reason']===_0xa752('0xc2')){_0xaa71a['agiafterat']=this[_0xa752('0x1e')][_0x5b4c79[_0xa752('0xb9')]][_0xa752('0xc3')]&&this['voiceQueues'][_0x5b4c79[_0xa752('0xb9')]][_0xa752('0xc4')]?moment()[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0xaa71a)[_0xa752('0x9d')](loggerCatch(_0xa752('0xc5')));hopperUtils['moveContactManagedDialer'](_0xaa71a)['catch'](loggerCatch(_0xa752('0xc6')));}}};Dialer[_0xa752('0x19')][_0xa752('0x30')]=function(_0x3fa6b5){var _0x5eda7e=this[_0xa752('0xba')][_0x3fa6b5[_0xa752('0xbb')]];var _0x1356ec=this;var _0x119ebd=![];var _0x2d5a70;var _0x109f12;if(this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]]){if(_0x5eda7e&&_0x5eda7e['type']!==_0xa752('0xbc')){delete this[_0xa752('0xba')][_0x3fa6b5[_0xa752('0xbb')]];utils[_0xa752('0xbd')](this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]],_0xa752('0xc7'));_0x5eda7e[_0xa752('0xc8')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));var _0x1a444c=new QueueCallerAbandon(_0x5eda7e,_0x3fa6b5);if(utils[_0xa752('0xc9')](_0x5eda7e[_0xa752('0xc8')],_0x5eda7e['responsetime'])>=_0x5eda7e[_0xa752('0xca')]){this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0x4e')]+=0x1;this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xa752('0x1e')][_0x3fa6b5['queue']][_0xa752('0xcb')]+=0x1;_0x1a444c['state']=0xa;_0x1a444c['statedesc']=_0xa752('0xcc');_0x1a444c[_0xa752('0xcd')]='TIMEOUT';_0x1a444c[_0xa752('0xce')]=this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xc3')]?moment()[_0xa752('0x44')](_0xa752('0xc0')):undefined;_0x1a444c[_0xa752('0xcf')]+=0x1;_0x1a444c['countglobal']+=0x1;_0x2d5a70=this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xd0')];_0x109f12=this[_0xa752('0x1e')][_0x3fa6b5['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xa752('0xd1')](_0x1a444c,_0x1a444c[_0xa752('0x6b')],_0x5eda7e[_0xa752('0xd2')])[_0xa752('0x99')](function(_0x3504cd){_0x119ebd=_0x3504cd[_0xa752('0xd3')]==0x1;if(_0x1a444c[_0xa752('0xcf')]>=_0x1356ec['voiceQueues'][_0x3fa6b5[_0xa752('0xb9')]]['dialDropMaxRetry']){_0x1356ec[_0xa752('0xd4')](_0x1a444c,_0x3504cd['additional']);}else{hopperUtils[_0xa752('0xd5')]({'active':![],'countdropretry':_0x1a444c[_0xa752('0xcf')],'scheduledat':moment()[_0xa752('0xd6')](_0x1356ec[_0xa752('0x1e')][_0x3fa6b5['queue']]['dialDropRetryFrequency'],_0xa752('0xd7'))['format'](_0xa752('0xc0')),'ContactId':_0x5eda7e[_0xa752('0xd8')],'ListId':_0x5eda7e[_0xa752('0xd9')],'VoiceQueueId':_0x5eda7e['VoiceQueueId']||undefined,'CampaignId':_0x5eda7e[_0xa752('0xda')]||undefined})['catch'](loggerCatch(_0xa752('0xdb')));var _0x410fad=new History(_0x1a444c);_0x410fad[_0xa752('0x6b')]=0xa;_0x410fad['statedesc']='Drop';_0x410fad['starttime']=moment()[_0xa752('0x44')](_0xa752('0xc0'));_0x410fad[_0xa752('0x6d')]=_0x410fad['starttime'];_0x410fad[_0xa752('0xdc')]=_0x1a444c['calleridname'];_0x410fad[_0xa752('0xdd')]=_0x1a444c[_0xa752('0xdd')];hopperUtils['createHistory'](_0x410fad)['catch'](loggerCatch(_0xa752('0xde')));}})['then'](function(){if(_0x119ebd)hopperUtils['swapAdditionalPhones'](_0x1a444c,_0x2d5a70,_0x109f12)['then'](function(){return 0x1;});});}else{this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xdf')]+=0x1;_0x1a444c['state']=0xb;_0x1a444c[_0xa752('0x6c')]=_0xa752('0xe0');_0x1a444c[_0xa752('0xcd')]=_0xa752('0xe1');_0x1a444c[_0xa752('0xe2')]+=0x1;_0x1a444c[_0xa752('0xe3')]+=0x1;_0x2d5a70=this[_0xa752('0x1e')][_0x3fa6b5['queue']]['dialAbandonedRetryFrequency'];_0x109f12=this[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xe4')];hopperUtils['verifyAdditionalPhones'](_0x1a444c,_0x1a444c['state'],_0x5eda7e[_0xa752('0xd2')])['then'](function(_0xa4e9ee){if(_0x1a444c['countabandonedretry']>=_0x1356ec[_0xa752('0x1e')][_0x3fa6b5[_0xa752('0xb9')]]['dialAbandonedMaxRetry']){_0x1356ec[_0xa752('0xd4')](_0x1a444c,_0xa4e9ee[_0xa752('0xd3')]);}else{hopperUtils[_0xa752('0xd5')]({'active':![],'countabandonedretry':_0x1a444c[_0xa752('0xe2')],'scheduledat':moment()[_0xa752('0xd6')](_0x1356ec['voiceQueues'][_0x3fa6b5[_0xa752('0xb9')]][_0xa752('0xe5')],_0xa752('0xd7'))[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5eda7e['ContactId'],'ListId':_0x5eda7e[_0xa752('0xd9')],'VoiceQueueId':_0x5eda7e[_0xa752('0xe6')]||undefined,'CampaignId':_0x5eda7e[_0xa752('0xda')]||undefined})['catch'](loggerCatch(_0xa752('0xe7')));var _0x250d58=new History(_0x1a444c);_0x250d58['state']=0xb;_0x250d58[_0xa752('0x6c')]='Abandoned';_0x250d58[_0xa752('0xe8')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));_0x250d58[_0xa752('0x6d')]=_0x250d58[_0xa752('0xe8')];_0x250d58[_0xa752('0xdc')]=_0x1a444c[_0xa752('0xdc')];_0x250d58[_0xa752('0xdd')]=_0x1a444c[_0xa752('0xdd')];hopperUtils[_0xa752('0xe9')](_0x250d58)[_0xa752('0x9d')](loggerCatch(_0xa752('0xea')));}})[_0xa752('0x99')](function(){if(_0x119ebd)hopperUtils[_0xa752('0xeb')](_0x1a444c,_0x2d5a70,_0x109f12)[_0xa752('0x99')](function(){return 0x1;});});}}}};Dialer[_0xa752('0x19')][_0xa752('0x36')]=function(_0x1ef40c){if(this[_0xa752('0x24')][_0x1ef40c[_0xa752('0xbb')]]){this[_0xa752('0x24')][_0x1ef40c[_0xa752('0xbb')]]['channel']=_0x1ef40c[_0xa752('0xec')];}if(this[_0xa752('0xba')][_0x1ef40c[_0xa752('0xbb')]]){this[_0xa752('0xba')][_0x1ef40c['uniqueid']][_0xa752('0xec')]=_0x1ef40c[_0xa752('0xec')];}};Dialer[_0xa752('0x19')][_0xa752('0x39')]=function(_0x29dcae){if(!this[_0xa752('0x24')][_0x29dcae['actionid']]){return;}var _0x40427e=this['voiceQueues'][this['actions'][_0x29dcae[_0xa752('0xed')]][_0xa752('0xb9')]][_0xa752('0xee')]||'rrmemory';if(_0x40427e===_0xa752('0xef')){if(this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]]&&_[_0xa752('0xf0')](this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]][_0xa752('0xf1')])&&_0x29dcae[_0xa752('0x85')]==='1'&&_0x29dcae['paused']==='0'){if(this[_0xa752('0x20')][_0x29dcae[_0xa752('0xf2')]]){if(!this[_0xa752('0x20')][_0x29dcae[_0xa752('0xf2')]][_0xa752('0xf1')]){this[_0xa752('0x20')][_0x29dcae['stateinterface']][_0xa752('0xf1')]=!![];this['actions'][_0x29dcae[_0xa752('0xed')]][_0xa752('0xf1')]=!![];this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]][_0xa752('0xf2')]=_0x29dcae[_0xa752('0xf2')];}}}}else if(_0x40427e===_0xa752('0xf3')){if(this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]]){if(this[_0xa752('0x20')][_0x29dcae[_0xa752('0xf2')]]){this['actions'][_0x29dcae[_0xa752('0xed')]]['stateinterface']=_0x29dcae[_0xa752('0xf2')];if(_[_0xa752('0xf0')](this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]][_0xa752('0xb9')]])){this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]]['queue']]=[];}this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]][_0xa752('0xb9')]][_0xa752('0x96')](_[_0xa752('0x5d')](_['pick'](this[_0xa752('0x24')][_0x29dcae[_0xa752('0xed')]],[_0xa752('0xf4'),_0xa752('0xf2')]),{'status':_0x29dcae[_0xa752('0x85')],'paused':_0x29dcae['paused']}));}}}};Dialer[_0xa752('0x19')]['syncQueueStatusComplete']=function(_0x2b2653){if(!this[_0xa752('0x24')][_0x2b2653['actionid']]){return;}var _0x598c23=this;var _0x4f2762=this['voiceQueues'][this[_0xa752('0x24')][_0x2b2653['actionid']][_0xa752('0xb9')]];var _0x251167=_0x4f2762[_0xa752('0xee')]||_0xa752('0xf3');if(_0x251167===_0xa752('0xef')){if(this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]&&this[_0xa752('0x24')][_0x2b2653['actionid']][_0xa752('0xf2')]){this['preview']['run'](this['actions'][_0x2b2653[_0xa752('0xed')]][_0xa752('0xf4')],this['actions'][_0x2b2653[_0xa752('0xed')]][_0xa752('0xf2')])[_0xa752('0x9d')](function(_0x48f8dd){logger[_0xa752('0x62')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x48f8dd,{'showHidden':![],'depth':null}));})['finally'](function(){utils['decrementOriginate'](_0x598c23[_0xa752('0x1e')][_0x598c23[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]],'[syncQueueStatusComplete]');_0x598c23[_0xa752('0x20')][_0x598c23[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]['stateinterface']]['locked']=![];delete _0x598c23['actions'][_0x2b2653[_0xa752('0xed')]];unlockQueueStatus(_0x4f2762);});}else{utils[_0xa752('0xbd')](this[_0xa752('0x1e')][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]],_0xa752('0xf5'));hopperUtils[_0xa752('0xd5')]({'active':![],'ContactId':this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xd8')],'ListId':this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xd9')],'VoiceQueueId':this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x2b2653[_0xa752('0xed')]];unlockQueueStatus(_0x4f2762);}}else if(_0x251167===_0xa752('0xf3')){var _0x4b0dd5;if(this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]&&!_[_0xa752('0x48')](this['queueBooked'][this[_0xa752('0x24')][_0x2b2653['actionid']][_0xa752('0xb9')]])){if(this[_0xa752('0x2b')][_0x598c23[_0xa752('0x24')][_0x2b2653['actionid']]['queue']]){this[_0xa752('0x2b')][_0x598c23[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]['queue']]=this[_0xa752('0x2b')][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]]?this[_0xa752('0x2b')][this[_0xa752('0x24')][_0x2b2653['actionid']][_0xa752('0xb9')]]:this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]]?this[_0xa752('0x2a')][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]]['queue']][_0xa752('0xf6')]||0x0:0x0;}this['queueBooked'][this[_0xa752('0x24')][_0x2b2653[_0xa752('0xed')]][_0xa752('0xb9')]][_0xa752('0xf6')]=this[_0xa752('0x2b')][this[_0xa752('0x24')][_0x2b2653['actionid']]['queue']];for(var _0x27ec4b=0x0;_0x27ec4b=_0x3823ee[_0xa752('0x122')]){_0x36a2c3[_0xa752('0x123')](_0x108b5b,_0x5c88f5,_0x22b2e1,_0xa752('0x124'));}else{if(_0x108b5b[_0xa752('0x120')]>=_0x3823ee[_0xa752('0x125')]){_0x36a2c3['createStateFinal'](_0x108b5b,_0x5c88f5,_0x22b2e1,_0xa752('0x126'));}else{hopperUtils[_0xa752('0xd5')]({'active':![],'countmachineretry':_0x108b5b['countmachineretry'],'scheduledat':moment()[_0xa752('0xd6')](_0x3823ee[_0xa752('0x127')],_0xa752('0xd7'))[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0x108b5b[_0xa752('0xd8')],'ListId':_0x108b5b['ListId'],'VoiceQueueId':_0x108b5b[_0xa752('0xe6')]||undefined,'CampaignId':_0x108b5b[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x128')));_0x5c88f5({'reschedule':0x1});}}});}if(_0x446515['type']==='ivr'&&this[_0xa752('0x1f')][_0x446515[_0xa752('0xb9')]]['dialAMDActive']&&_0x310db9[_0xa752('0x10d')]===_0xa752('0x129')){delete this[_0xa752('0xba')][_0x310db9[_0xa752('0xbb')]];utils['decrementOriginate'](this['campaigns'][_0x446515[_0xa752('0xb9')]],_0xa752('0x10e'));_0x4a7ddb=new Hangup(_0x446515,_0x310db9);_0x4a7ddb[_0xa752('0x6b')]=0x12;_0x4a7ddb[_0xa752('0x6c')]=_0xa752('0x10f');_0x4a7ddb['membername']=_0xa752('0x111');ami[_0xa752('0x3f')](_0xa752('0x112'),ut[_0xa752('0x113')](_0x4a7ddb,_0xa752('0x114')));this[_0xa752('0x115')](_0x4a7ddb,'[syncHangupInAMDIvr][createHistory]',_0xa752('0x12a'));}if(_0x446515[_0xa752('0x40')]==='ivr'&&this[_0xa752('0x1f')][_0x446515['queue']][_0xa752('0x10c')]&&_0x310db9[_0xa752('0x10d')]===_0xa752('0x118')){return new Promise(function(_0x481fd8,_0x4f6e9a){delete _0x36a2c3['uniqueId'][_0x310db9[_0xa752('0xbb')]];utils['decrementOriginate'](_0x36a2c3['campaigns'][_0x446515[_0xa752('0xb9')]],'[syncVarSet]');_0x36a2c3[_0xa752('0x1f')][_0x446515[_0xa752('0xb9')]][_0xa752('0xc1')]+=0x1;_0x36a2c3[_0xa752('0x1f')][_0x446515['queue']][_0xa752('0x119')]+=0x1;var _0x4c497e=_0x36a2c3[_0xa752('0x1f')][_0x446515['queue']];var _0x3989f0=new Hangup(_0x446515,_0x310db9);_0x3989f0[_0xa752('0x6b')]=0x13;_0x3989f0['statedesc']=_0xa752('0x11a');_0x3989f0[_0xa752('0x110')]='AMD';_0x3989f0[_0xa752('0x120')]+=0x1;_0x3989f0[_0xa752('0xe3')]+=0x1;_0x3989f0[_0xa752('0x114')]=!![];ami[_0xa752('0x3f')](_0xa752('0x112'),ut[_0xa752('0x113')](_0x3989f0,'amd'));hopperUtils[_0xa752('0xe9')](_0x3989f0)[_0xa752('0x9d')](loggerCatch(_0xa752('0x11b')));if(_0x3989f0['countbusyretry']+_0x3989f0[_0xa752('0x11d')]+_0x3989f0[_0xa752('0x11e')]+_0x3989f0[_0xa752('0x11f')]+_0x3989f0['countdropretry']+_0x3989f0[_0xa752('0xe2')]+_0x3989f0[_0xa752('0x120')]+_0x3989f0[_0xa752('0x121')]>=_0x4c497e['dialGlobalMaxRetry']){_0x36a2c3[_0xa752('0x123')](_0x3989f0,_0x481fd8,_0x4f6e9a,'reason19\x20machine....');}else{if(_0x3989f0[_0xa752('0x120')]>=_0x4c497e[_0xa752('0x125')]){_0x36a2c3[_0xa752('0x12b')](_0x3989f0,_0x481fd8,_0x4f6e9a,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3989f0[_0xa752('0x120')],'scheduledat':moment()['add'](_0x4c497e[_0xa752('0x127')],'minutes')[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3989f0[_0xa752('0xd8')],'ListId':_0x3989f0['ListId'],'VoiceQueueId':_0x3989f0[_0xa752('0xe6')]||undefined,'CampaignId':_0x3989f0[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x128')));_0x481fd8({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x5a69d2){var _0x1a0347=this[_0xa752('0xba')][_0x5a69d2[_0xa752('0xbb')]];var _0x283cdd;if(!_0x1a0347){return;}if(_0x1a0347[_0xa752('0x40')]===_0xa752('0xbc')){delete this[_0xa752('0xba')][_0x5a69d2['uniqueid']];utils[_0xa752('0xbd')](this[_0xa752('0x1f')][_0x1a0347[_0xa752('0xb9')]],_0xa752('0x12c'));this['campaigns'][_0x1a0347[_0xa752('0xb9')]][_0xa752('0x12d')]+=0x1;if(_0x5a69d2['cause-txt']==='Normal\x20Clearing'){const _0x524790=new AgentComplete(_0x1a0347,_0x5a69d2);_0x524790[_0xa752('0xda')]=this[_0xa752('0x1f')][_0x1a0347[_0xa752('0xb9')]]['id'];hopperUtils[_0xa752('0xe9')](_0x524790)[_0xa752('0x9d')](loggerCatch(_0xa752('0x12e')));hopperUtils[_0xa752('0x12f')](_0x524790)[_0xa752('0x9d')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x283cdd=new Hangup(_0x1a0347,_0x5a69d2);hopperUtils['createHistory'](_0x283cdd)[_0xa752('0x9d')](loggerCatch(_0xa752('0x130')));hopperUtils[_0xa752('0x12f')](_0x283cdd)[_0xa752('0x9d')](loggerCatch(_0xa752('0x131')));}}else{if(isNotNull(this[_0xa752('0x1e')][_0x1a0347[_0xa752('0xb9')]][_0xa752('0x132')])){delete this[_0xa752('0xba')][_0x5a69d2[_0xa752('0xbb')]];utils[_0xa752('0xbd')](this[_0xa752('0x1e')][_0x1a0347[_0xa752('0xb9')]],_0xa752('0x12c'));this[_0xa752('0x1e')][_0x1a0347['queue']][_0xa752('0xc1')]+=0x1;this[_0xa752('0x1e')][_0x1a0347[_0xa752('0xb9')]][_0xa752('0x119')]+=0x1;_0x283cdd=new Hangup(_0x1a0347,_0x5a69d2);_0x283cdd[_0xa752('0x6b')]=0x10;_0x283cdd['statedesc']='AnswerAGI';_0x283cdd[_0xa752('0x110')]=_0xa752('0x133');hopperUtils[_0xa752('0xe9')](_0x283cdd)['catch'](loggerCatch(_0xa752('0x130')));hopperUtils[_0xa752('0x12f')](_0x283cdd)[_0xa752('0x9d')](loggerCatch(_0xa752('0x131')));}else{delete this[_0xa752('0xba')][_0x5a69d2[_0xa752('0xbb')]];utils['decrementOriginate'](this[_0xa752('0x1e')][_0x1a0347['queue']],_0xa752('0x134'));if(_0x5a69d2[_0xa752('0x135')]===_0xa752('0x136')){this['voiceQueues'][_0x1a0347[_0xa752('0xb9')]][_0xa752('0xc1')]+=0x1;const _0x53d1ba=new AgentComplete(_0x1a0347,_0x5a69d2);_0x53d1ba[_0xa752('0xe6')]=this[_0xa752('0x1e')][_0x1a0347[_0xa752('0xb9')]]['id'];hopperUtils[_0xa752('0xe9')](_0x53d1ba)[_0xa752('0x9d')](loggerCatch(_0xa752('0xc5')));hopperUtils[_0xa752('0x12f')](_0x53d1ba)[_0xa752('0x9d')](loggerCatch(_0xa752('0xc6')));}else{this['voiceQueues'][_0x1a0347['queue']][_0xa752('0x137')]+=0x1;_0x283cdd=new Hangup(_0x1a0347,_0x5a69d2);_0x283cdd['state']=0xc;_0x283cdd[_0xa752('0x6c')]=_0x5a69d2[_0xa752('0x135')];_0x283cdd[_0xa752('0x110')]='Unknown';hopperUtils[_0xa752('0xe9')](_0x283cdd)[_0xa752('0x9d')](loggerCatch('[syncHangup][createHistory]'));hopperUtils[_0xa752('0x12f')](_0x283cdd)[_0xa752('0x9d')](loggerCatch(_0xa752('0x12c')));}}}};Dialer[_0xa752('0x19')][_0xa752('0xc')]=function(_0x4baccf){var _0x5e4079=this;if(!_0x5e4079[_0xa752('0x2c')][_0x4baccf[_0xa752('0x46')]]){_0x5e4079[_0xa752('0x2c')][_0x4baccf[_0xa752('0x46')]]={'running':![]};}else if(_0x5e4079['queuesSummary'][_0x4baccf['name']][_0xa752('0x138')]===!![]){return;}else if(_0x5e4079[_0xa752('0x2c')][_0x4baccf[_0xa752('0x46')]][_0xa752('0x138')]===![]){_0x5e4079['queuesSummary'][_0x4baccf[_0xa752('0x46')]][_0xa752('0x138')]=!![];}var _0x1135f8=_0x5e4079[_0xa752('0x1e')][_0x4baccf[_0xa752('0x46')]];var _0x85a69a=_0x1135f8[_0xa752('0x65')]!==utils[_0xa752('0x73')][_0xa752('0x7b')];var _0x59de74=utils['isPreviewCampaign'](_0x1135f8);_0x1135f8[_0xa752('0x139')]=utils['getQueueCampaignStatusMessage'](_0x1135f8,_0x5e4079['trunks']);Promise['resolve']()['then'](function(){if(_0x1135f8[_0xa752('0x139')]===utils[_0xa752('0x73')][_0xa752('0x7b')]){if(_0x85a69a){clearPredictiveAttributes(_0x1135f8);_0x4baccf[_0xa752('0x27')]=undefined;_0x4baccf[_0xa752('0x28')]=undefined;}if(_0x1135f8['statusMessage']===utils[_0xa752('0x73')][_0xa752('0x7b')]){_0x4baccf[_0xa752('0x13a')]=0x0;_0x4baccf[_0xa752('0x13b')]=0x0;_0x4baccf[_0xa752('0x13c')]=0x0;_0x4baccf[_0xa752('0x13d')]=0x0;_0x4baccf[_0xa752('0x13e')]=0x0;}}else if(_0x1135f8['statusMessage']===utils[_0xa752('0x73')][_0xa752('0x13f')]&&!_0x59de74){return _0x5e4079[_0xa752('0x8f')](_0x1135f8,!![])[_0xa752('0x99')](function(){return _0x5e4079[_0xa752('0x8f')](_0x1135f8,![]);})[_0xa752('0x99')](function(){return _0x5e4079[_0xa752('0x140')](_0x1135f8);})[_0xa752('0x9d')](function(_0x5de342){loggerSyncQueueSummary[_0xa752('0x42')](_0xa752('0x141'),util[_0xa752('0x43')](_0x5de342,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1135f8);});}else{clearPredictiveAttributes(_0x1135f8);}})[_0xa752('0x99')](function(){var _0x2d9bc3=_0x4baccf[_0xa752('0x142')](_0x1135f8);if(_0x2d9bc3||_0x1135f8[_0xa752('0x143')]){_0x1135f8[_0xa752('0x143')]=![];_0x4baccf[_0xa752('0x144')](_0x1135f8);Object[_0xa752('0x145')](_0x1135f8,_0x4baccf);emitOutboundVoiceQueueSummary(_0x4baccf);}_0x5e4079[_0xa752('0x2c')][_0x1135f8[_0xa752('0x46')]]['running']=![];})[_0xa752('0x9d')](function(_0x2041e1){logger['error']('[syncQueueSummary]',util[_0xa752('0x43')](_0x2041e1,{'showHidden':![],'depth':null}));_0x5e4079[_0xa752('0x2c')][_0x1135f8[_0xa752('0x46')]]['running']=![];});};Dialer[_0xa752('0x19')][_0xa752('0x146')]=_[_0xa752('0x147')](function(){var _0x148cd8=_[_0xa752('0x148')](this[_0xa752('0x1e')],function(_0x119c02){return _0x119c02[_0xa752('0x149')];});var _0x168a20=_[_0xa752('0x148')](this[_0xa752('0x20')],function(_0x172367){return _0x172367[_0xa752('0x14a')]&&_0x172367['status']===_0xa752('0x14b');});if(_0x148cd8[_0xa752('0xf7')]>0x0&&_0x168a20[_0xa752('0xf7')]>0x0){return Promise[_0xa752('0x14c')]()[_0xa752('0x99')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x148cd8,'id'),previewRecallmeReminderInterval,_[_0xa752('0x14d')](_0x168a20,'id')))[_0xa752('0x99')](function(_0x334ce2){for(var _0x3ef904=0x0;_0x3ef904<_0x334ce2[_0xa752('0xf7')];_0x3ef904++){var _0x246b72=_0x334ce2[_0x3ef904][_0xa752('0x14e')][_0xa752('0x46')];if(_0x246b72)io['to'](util[_0xa752('0x44')](_0xa752('0x14f'),_0x246b72))['emit'](_0xa752('0x150'),{'hopper':_0x334ce2[_0x3ef904]});}})[_0xa752('0x9d')](function(_0x627cce){logger[_0xa752('0x62')]('checkPreviewRecallReminder',_0x627cce);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xa752('0x151')]=function(){var _0x2ec4c6=this;setInterval(function(){_0x2ec4c6[_0xa752('0x152')](_0x2ec4c6[_0xa752('0xba')],'[uniqueid]');_0x2ec4c6[_0xa752('0x152')](_0x2ec4c6[_0xa752('0x24')],_0xa752('0x153'));},0x32c8);};Dialer[_0xa752('0x19')]['clearZombieChannels']=function(_0x1d462d,_0x3467a3){var _0x482529=this;for(var _0x533ca9 in _0x1d462d){if(typeof _0x1d462d[_0x533ca9]!==_0xa752('0x154')){this['sequence'][_0xa752('0x155')](function(){if(!_['isNil'](_0x1d462d[_0x533ca9])){return ami[_0xa752('0x9e')]({'action':_0xa752('0x85'),'channel':_0x1d462d[_0x533ca9][_0xa752('0xec')]})[_0xa752('0x9d')](function(_0xe02a6e){if(_0xe02a6e[_0xa752('0x65')]===_0xa752('0x156')){setTimeout(function(){if(_0x1d462d[_0x533ca9]&&_0x1d462d[_0x533ca9][_0xa752('0x40')]!==_0xa752('0xbc')){utils[_0xa752('0xbd')](_0x482529[_0xa752('0x1e')][_0x1d462d[_0x533ca9]['queue']],'[clearZombieChannels]');logger[_0xa752('0x62')](_0xa752('0x157'),_0x3467a3,_0x533ca9,_0x1d462d[_0x533ca9]['queue']);delete _0x1d462d[_0x533ca9];}if(_0x1d462d[_0x533ca9]&&_0x1d462d[_0x533ca9]['type']==='ivr'){utils[_0xa752('0xbd')](_0x482529[_0xa752('0x1f')][_0x1d462d[_0x533ca9][_0xa752('0xb9')]],_0xa752('0x158'));logger[_0xa752('0x62')](_0xa752('0x159'),_0x3467a3,_0x533ca9,_0x1d462d[_0x533ca9][_0xa752('0xb9')]);delete _0x1d462d[_0x533ca9];}},0x2328);}});}});}}};Dialer[_0xa752('0x19')][_0xa752('0x15a')]=function(_0x188d3d){return Promise[_0xa752('0x14c')]()[_0xa752('0x99')](voiceQueueRt['getVoiceQueueRtPauses'](_0x188d3d))[_0xa752('0x9d')](loggerCatch(_0xa752('0x15b')));};Dialer['prototype'][_0xa752('0x15c')]=function(_0x2f7558,_0x4ff81c,_0x2f7c80){var _0x4ab125={'state':0x19,'statedesc':_0xa752('0x15d')};utils[_0xa752('0xbd')](_0x4ff81c,_0xa752('0x15e')+_0x2f7558);this[_0xa752('0x115')](_[_0xa752('0x5d')](_0x4ab125,_[_0xa752('0x71')](_0x2f7c80,[_0xa752('0xd8'),'ListId',_0xa752('0x15f'),_0xa752('0xe6'),_0xa752('0xda')])),_0xa752('0x160'),_0xa752('0x15e'));logger[_0xa752('0x62')](_0x2f7558);};Dialer[_0xa752('0x19')][_0xa752('0x115')]=function(_0xf8f284,_0x425ed,_0x2797af){hopperUtils['createHistory'](_0xf8f284)[_0xa752('0x9d')](loggerCatch(_0x425ed));hopperUtils[_0xa752('0x12f')](_0xf8f284)[_0xa752('0x9d')](loggerCatch(_0x2797af));};Dialer[_0xa752('0x19')][_0xa752('0xd4')]=function(_0x246688,_0x44d623){hopperUtils[_0xa752('0xe9')](_0x246688)['catch'](loggerCatch(_0xa752('0xc5')));if(_0x44d623==0x0){hopperUtils[_0xa752('0x12f')](_0x246688)[_0xa752('0x9d')](loggerCatch(_0xa752('0x161')));}};Dialer[_0xa752('0x19')][_0xa752('0x162')]=function(_0x144ca1){return Promise[_0xa752('0x14c')]()[_0xa752('0x99')](cmHopper[_0xa752('0x163')](_0x144ca1['id'],previewRecallmeReminderInterval))[_0xa752('0x99')](function(_0x3d1cfb){for(var _0x255394=0x0;_0x255394<_0x3d1cfb['length'];_0x255394++){var _0x4b906c=_0x3d1cfb[_0x255394][_0xa752('0x14e')][_0xa752('0x46')];if(_0x4b906c)io['to'](util[_0xa752('0x44')]('user:%s',_0x4b906c))[_0xa752('0x3f')](_0xa752('0x150'),{'hopper':_0x3d1cfb[_0x255394]});}})[_0xa752('0x9d')](function(){});};Dialer[_0xa752('0x19')][_0xa752('0x164')]=function(_0x39063f){var _0x1e69b5=this;return function(){_0x1e69b5[_0xa752('0x165')](_0x39063f);};};Dialer['prototype'][_0xa752('0x166')]=function(_0x31905a,_0x2aa5bf){var _0x5d3576=this;var _0x52cc38=uuid['v4']();this[_0xa752('0x24')][_0x52cc38]=new Action(_0x31905a,_0x2aa5bf,_0x52cc38);return new Promise(function(_0xa70795,_0x5e98f8){if(_['isUndefined'](_0x31905a)&&typeof _0x31905a!=='object'){return _0x5e98f8(msgResponse(_0xa752('0x167'),'Failure',_0xa752('0x168')));}if(_[_0xa752('0x3e')](_0x2aa5bf['phone'])||_0x2aa5bf[_0xa752('0x169')]===null){return _0x5e98f8(msgResponse('originate',_0xa752('0x90'),_0xa752('0x16a')));}var _0x3c55a0={'XMD-CALLERID':_0x5d3576[_0xa752('0x24')][_0x52cc38][_0xa752('0x16b')](),'XMD-AGI':_0x31905a[_0xa752('0x132')]?util[_0xa752('0x44')](_0xa752('0x16c'),ipAgi,_0x31905a['dialQueueProject']):_0xa752('0x16d'),'XMD-AGIAFTER':_0x31905a[_0xa752('0xc3')]?util[_0xa752('0x44')](_0xa752('0x16c'),ipAgi,_0x31905a[_0xa752('0xc3')]):_0xa752('0x16d'),'XMD-QUEUE':utils['isOutboundQueue'](_0x31905a)?util[_0xa752('0x44')]('\x22%s,%s%s,,,%s\x22',_0x31905a[_0xa752('0x46')],_0x31905a[_0xa752('0x16e')]||'',_0x31905a[_0xa752('0xc4')]?'c':'',_0x31905a[_0xa752('0xca')]||0x3):_0xa752('0x16d'),'XMD-CONTACTID':_0x2aa5bf[_0xa752('0xd8')],'XMD-CDRTYPE':_0xa752('0x9'),'CALLERID(all)':_0x5d3576[_0xa752('0x24')][_0x52cc38]['getCaller'](),'XMD-AMD':_0x31905a[_0xa752('0x10c')]?_0xa752('0x13f'):_0xa752('0x16d'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x31905a[_0xa752('0x10c')]){_0x3c55a0['XMD-AMDINITIALSILENCE']=_0x31905a[_0xa752('0x16f')]||0x9c4;_0x3c55a0[_0xa752('0x170')]=_0x31905a[_0xa752('0x171')]||0x5dc;_0x3c55a0[_0xa752('0x172')]=_0x31905a[_0xa752('0x173')]||0x320;_0x3c55a0[_0xa752('0x174')]=_0x31905a[_0xa752('0x175')]||0x1388;_0x3c55a0[_0xa752('0x176')]=_0x31905a[_0xa752('0x177')]||0x64;_0x3c55a0['XMD-AMDBETWEENWORDSSILENCE']=_0x31905a[_0xa752('0x178')]||0x32;_0x3c55a0[_0xa752('0x179')]=_0x31905a[_0xa752('0x17a')]||0x3;_0x3c55a0[_0xa752('0x17b')]=_0x31905a[_0xa752('0x17c')]||0x100;_0x3c55a0[_0xa752('0x17d')]=_0x31905a['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x31905a)){_0x3c55a0[_0xa752('0x17e')]=_0x2aa5bf[_0xa752('0xe6')];}else{_0x3c55a0[_0xa752('0x17f')]=_0x2aa5bf[_0xa752('0xda')];}var _0x3d7209=utils['setXMDContactVariables'](_0x2aa5bf[_0xa752('0x180')]);Object[_0xa752('0x145')](_0x3c55a0,_0x3d7209);var _0x20fba5=_0x5d3576[_0xa752('0x82')](_0x31905a[_0xa752('0x88')])?utils['getCallerId'](_0x31905a[_0xa752('0x88')][_0xa752('0x181')],_0x31905a[_0xa752('0x182')],_0x31905a[_0xa752('0x183')]>0x0?utils['getCallerIdRandom'](_0x31905a[_0xa752('0x184')],_0x31905a[_0xa752('0x183')]):_0x31905a[_0xa752('0x184')]):utils[_0xa752('0x185')](_[_0xa752('0xf0')](_0x31905a[_0xa752('0x89')])?_0x31905a['Trunk'][_0xa752('0x181')]:_0x31905a['TrunkBackup'][_0xa752('0x181')],_0x31905a[_0xa752('0x182')],_0x31905a[_0xa752('0x183')]>0x0?utils[_0xa752('0x186')](_0x31905a[_0xa752('0x184')],_0x31905a[_0xa752('0x183')]):_0x31905a['dialOriginateCallerIdNumber']);if(_0x20fba5){_0x3c55a0[_0xa752('0x187')]=_0x5d3576[_0xa752('0x24')][_0x52cc38][_0xa752('0x188')]=utils[_0xa752('0x189')](_0x20fba5);_0x3c55a0['XMD-ORIGINATECALLERIDNUM']=_0x2aa5bf[_0xa752('0x169')];}_0x31905a['variables']=_0x3c55a0;return ami[_0xa752('0x9e')]({'actionid':_0x52cc38,'action':_0xa752('0x167'),'channel':_0x5d3576['isTrunkReachable'](_0x31905a[_0xa752('0x88')])?util['format'](_0xa752('0x18a'),_0x31905a['Trunk'][_0xa752('0x46')],isNotNull(_0x31905a[_0xa752('0x18b')])?_0x31905a[_0xa752('0x18b')][_0xa752('0x18c')]()||'':'',_0x31905a[_0xa752('0x18d')]>0x0?_0x2aa5bf[_0xa752('0x169')][_0xa752('0x18e')](_0x31905a[_0xa752('0x18d')]):_0x2aa5bf[_0xa752('0x169')]):util[_0xa752('0x44')](_0xa752('0x18a'),_[_0xa752('0xf0')](_0x31905a[_0xa752('0x89')])?_0x31905a[_0xa752('0x88')]['name']:_0x31905a[_0xa752('0x89')][_0xa752('0x46')],isNotNull(_0x31905a[_0xa752('0x18b')])?_0x31905a[_0xa752('0x18b')]['trim']()||'':'',_0x31905a[_0xa752('0x18d')]>0x0?_0x2aa5bf['phone'][_0xa752('0x18e')](_0x31905a[_0xa752('0x18d')]):_0x2aa5bf['phone']),'callerid':_0x20fba5,'Exten':_0xa752('0x18f'),'Context':'from-sip','Priority':'1','variable':_0x3c55a0,'timeout':(_0x31905a[_0xa752('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x52cc38})[_0xa752('0x99')](function(_0x33ca88){return _0xa70795(_0x33ca88);})[_0xa752('0x9d')](function(_0x4c81ff){_0x31905a[_0xa752('0x191')]+=0x1;var _0x3d360e=new History(_0x5d3576['actions'][_0x52cc38]);logger['error'](util['format'](_0xa752('0x192'),JSON[_0xa752('0x81')](_0x4c81ff)));_0x3d360e[_0xa752('0x6b')]=0xe;_0x3d360e[_0xa752('0x6c')]=_0xa752('0x193');_0x3d360e[_0xa752('0xe8')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));_0x3d360e[_0xa752('0x6d')]=_0x3d360e[_0xa752('0xe8')];hopperUtils[_0xa752('0xe9')](_0x3d360e)['catch'](loggerCatch(_0xa752('0x194')));_0x5d3576[_0xa752('0x12f')](_0x3d360e)[_0xa752('0x9d')](loggerCatch('[originate][error]'))[_0xa752('0x1b')](function(){delete _0x5d3576['actions'][_0x52cc38];return _0x5e98f8(msgResponse(_0xa752('0x167'),_0xa752('0x195'),'originate\x20action\x20Error'));});});});};Dialer[_0xa752('0x19')]['checkRetriveMax']=function(_0x41ab53,_0x4b28ab,_0x1e8fa7){var _0xfee2f3=new History(_0x4b28ab);if(_0xfee2f3[_0xa752('0x11c')]+_0xfee2f3[_0xa752('0x11d')]+_0xfee2f3[_0xa752('0x11e')]+_0xfee2f3[_0xa752('0x11f')]+_0xfee2f3['countdropretry']+_0xfee2f3[_0xa752('0xe2')]+_0xfee2f3[_0xa752('0x120')]+_0xfee2f3['countagentrejectretry']>=_0x1e8fa7[_0xa752('0x122')]-0x1){return!![];}switch(_0x41ab53){case 0x3:if(_0xfee2f3[_0xa752('0x11e')]>=_0x1e8fa7['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countnoanswerretry':_0xfee2f3[_0xa752('0x11e')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7['dialNoAnswerRetryFrequency'],'minutes')[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3['VoiceQueueId']||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x196')));break;case 0x5:if(_0xfee2f3[_0xa752('0x11c')]>=_0x1e8fa7[_0xa752('0x197')]-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countbusyretry':_0xfee2f3['countbusyretry']+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0x198')],_0xa752('0xd7'))['format'](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3['VoiceQueueId']||undefined,'CampaignId':_0xfee2f3['CampaignId']||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x199')));break;case 0x8:if(_0xfee2f3[_0xa752('0x11d')]>=_0x1e8fa7['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countcongestionretry':_0xfee2f3[_0xa752('0x11d')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0x19a')],_0xa752('0xd7'))[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3[_0xa752('0xe6')]||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0xfee2f3[_0xa752('0x11f')]>=_0x1e8fa7[_0xa752('0x19b')]-0x1){return!![];}else{hopperUtils[_0xa752('0xd5')]({'active':![],'countnosuchnumberretry':_0xfee2f3[_0xa752('0x11f')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0x19c')],'minutes')[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3['ListId'],'VoiceQueueId':_0xfee2f3[_0xa752('0xe6')]||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0xfee2f3[_0xa752('0xcf')]>=_0x1e8fa7[_0xa752('0x19d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xfee2f3[_0xa752('0xcf')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0xd0')],_0xa752('0xd7'))[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3['VoiceQueueId']||undefined,'CampaignId':_0xfee2f3['CampaignId']||undefined})['catch'](loggerCatch(_0xa752('0xdb')));break;case 0xb:if(_0xfee2f3['countabandonedretry']>=_0x1e8fa7['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countabandonedretry':_0xfee2f3[_0xa752('0xe2')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7['dialAbandonedRetryFrequency'],_0xa752('0xd7'))[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3['ListId'],'VoiceQueueId':_0xfee2f3[_0xa752('0xe6')]||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0xfee2f3[_0xa752('0x120')]>=_0x1e8fa7['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countmachineretry':_0xfee2f3[_0xa752('0x120')]+=0x1,'scheduledat':moment()[_0xa752('0xd6')](_0x1e8fa7[_0xa752('0x127')],_0xa752('0xd7'))['format'](_0xa752('0xc0')),'ContactId':_0xfee2f3['ContactId'],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3[_0xa752('0xe6')]||undefined,'CampaignId':_0xfee2f3[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xfee2f3[_0xa752('0x121')]>=_0x1e8fa7[_0xa752('0x19e')]-0x1){return!![];}hopperUtils[_0xa752('0xd5')]({'active':![],'countagentrejectretry':_0xfee2f3[_0xa752('0x121')]+=0x1,'scheduledat':moment()['add'](_0x1e8fa7[_0xa752('0x19f')],_0xa752('0xd7'))[_0xa752('0x44')](_0xa752('0xc0')),'ContactId':_0xfee2f3[_0xa752('0xd8')],'ListId':_0xfee2f3[_0xa752('0xd9')],'VoiceQueueId':_0xfee2f3['VoiceQueueId']||undefined,'CampaignId':_0xfee2f3['CampaignId']||undefined})['catch'](loggerCatch(_0xa752('0x1a0')));break;default:return!![];}};Dialer[_0xa752('0x19')][_0xa752('0x108')]=function(_0xec8478,_0x4f4f42,_0x5f5586){var _0xf421bc=this;var _0x44c417=new History(_0xec8478);var _0x251775=![];var _0x53c6d2;var _0x5f3225;return new Promise(function(_0x357bef,_0x27d6cc){if(_[_0xa752('0x3e')](_0x4f4f42)&&typeof _0x4f4f42!==_0xa752('0x1a1')){return _0x27d6cc(msgResponse(_0xa752('0x1a2'),_0xa752('0x90'),_0xa752('0x1a3')));}if(_['isUndefined'](_0x5f5586)&&typeof _0x5f5586!==_0xa752('0x1a1')){return _0x27d6cc(msgResponse('[callProgressDetecting]','Failure',_0xa752('0x1a4')));}hopperUtils[_0xa752('0xd1')](_0x44c417,_0x5f5586[_0xa752('0x1a5')],_0x4f4f42)[_0xa752('0x99')](function(_0x26b9f8){if(_0x26b9f8['additional']==0x1)_0x251775=!![];switch(_0x5f5586[_0xa752('0x1a5')]){case'0':_0x4f4f42['outboundNoSuchCallsDay']+=0x1;_0x44c417[_0xa752('0x6b')]=0x0;_0x44c417[_0xa752('0x6c')]=_0xa752('0x1a6');_0x44c417[_0xa752('0x11f')]+=0x1;_0x44c417['countglobal']+=0x1;ami['emit'](_0xa752('0x1a7'),ut['buildObj'](_0xec8478,_0xa752('0x1a8')));_0x53c6d2=_0x4f4f42[_0xa752('0x19c')];_0x5f3225=_0x4f4f42[_0xa752('0xe4')];hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xf421bc[_0xa752('0x1a9')](0x0,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417['countnosuchnumberretry']>=_0x4f4f42[_0xa752('0x19b')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1aa'));}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1aa'));}}break;case'3':_0x4f4f42[_0xa752('0x1ab')]+=0x1;_0x44c417[_0xa752('0x6b')]=0x3;_0x44c417[_0xa752('0x6c')]=_0xa752('0x1ac');_0x44c417[_0xa752('0x11e')]+=0x1;_0x44c417['countglobal']+=0x1;var _0x5dec8e=ut[_0xa752('0x1ad')](_0xec8478,_0x4f4f42);ami[_0xa752('0x3f')](_0xa752('0x1ae'),_0x5dec8e);_0x53c6d2=_0x4f4f42['dialNoAnswerRetryFrequency'];_0x5f3225=_0x4f4f42['callAdditionalPhoneAfterMin'];hopperUtils[_0xa752('0xe9')](_0x44c417)['catch'](loggerCatch(_0xa752('0x1af')));if(_0xf421bc[_0xa752('0x1a9')](0x3,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417['countnoanswerretry']>=_0x4f4f42[_0xa752('0x1b0')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,'reason\x203\x20ringing\x20no\x20answer');}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4f4f42[_0xa752('0x1b1')]+=0x1;_0x44c417['state']=0x5;_0x44c417[_0xa752('0x6c')]=_0xa752('0x1b2');_0x44c417[_0xa752('0x11c')]+=0x1;_0x44c417[_0xa752('0xe3')]+=0x1;ami[_0xa752('0x3f')](_0xa752('0x1b3'),ut['buildObj'](_0xec8478,_0xa752('0x1b4')));_0x53c6d2=_0x4f4f42[_0xa752('0x198')];_0x5f3225=_0x4f4f42[_0xa752('0xe4')];hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch(_0xa752('0x1b5')));if(_0xf421bc[_0xa752('0x1a9')](0x5,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417[_0xa752('0x11c')]>=_0x4f4f42['dialBusyMaxRetry']){_0xf421bc['createStateFinal'](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1b6'));}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1b6'));}}break;case'8':_0x4f4f42['outboundCongestionCallsDay']+=0x1;_0x44c417['state']=0x8;_0x44c417['statedesc']=_0xa752('0x1b7');_0x44c417[_0xa752('0x11d')]+=0x1;_0x44c417['countglobal']+=0x1;_0x53c6d2=_0x4f4f42[_0xa752('0x19a')];_0x5f3225=_0x4f4f42['callAdditionalPhoneAfterMin'];ami[_0xa752('0x3f')](_0xa752('0x1b8'),ut['buildObj'](_0xec8478,_0xa752('0x1b9')));hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch(_0xa752('0x1ba')));if(_0xf421bc['checkRetriveMax'](0x8,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417['countcongestionretry']>=_0x4f4f42[_0xa752('0x1bb')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1bc'));}else{_0xf421bc['stateGlobal'](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1bc'));}}break;case'11':_0x4f4f42[_0xa752('0x1bd')]+=0x1;_0x44c417[_0xa752('0x6b')]=0xb;_0x44c417[_0xa752('0x6c')]=_0xa752('0xe0');_0x44c417[_0xa752('0xe2')]+=0x1;_0x44c417['countglobal']+=0x1;_0x53c6d2=_0x4f4f42[_0xa752('0xe5')];_0x5f3225=_0x4f4f42['callAdditionalPhoneAfterMin'];hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0xf421bc[_0xa752('0x1a9')](0xb,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417[_0xa752('0xe2')]>=_0x4f4f42[_0xa752('0x1be')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1bf'));}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1bf'));}}break;case'20':_0x4f4f42[_0xa752('0x1c0')]+=0x1;_0x44c417['state']=0x14;_0x44c417[_0xa752('0x6c')]=_0xa752('0x1c1');_0x44c417['countagentrejectretry']+=0x1;_0x44c417['countglobal']+=0x1;_0x53c6d2=_0x4f4f42[_0xa752('0x19f')];_0x5f3225=_0x4f4f42[_0xa752('0xe4')];ami[_0xa752('0x3f')]('custom:agentreject',ut[_0xa752('0x113')](_0xec8478,_0xa752('0x1c2')));hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xf421bc[_0xa752('0x1a9')](0x14,_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417[_0xa752('0x121')]>=_0x4f4f42[_0xa752('0x19e')]){_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1c3'));}else{_0xf421bc[_0xa752('0x123')](_0x44c417,_0x357bef,_0x27d6cc,_0xa752('0x1c3'));}}break;default:_0x4f4f42[_0xa752('0x137')]+=0x1;_0x44c417[_0xa752('0x6b')]=0xc;_0x44c417[_0xa752('0x6c')]=_0x5f5586[_0xa752('0x1a5')];_0x53c6d2=_0x4f4f42[_0xa752('0x19f')];_0x5f3225=_0x4f4f42[_0xa752('0xe4')];hopperUtils[_0xa752('0xe9')](_0x44c417)[_0xa752('0x9d')](loggerCatch(_0xa752('0x1c4')));if(_0xf421bc[_0xa752('0x1a9')](_0x5f5586[_0xa752('0x1a5')],_0xec8478,_0x4f4f42)&&!_0x251775){if(_0x44c417['countbusyretry']+_0x44c417[_0xa752('0x11d')]+_0x44c417[_0xa752('0x11e')]+_0x44c417[_0xa752('0x11f')]+_0x44c417[_0xa752('0xcf')]+_0x44c417[_0xa752('0xe2')]+_0x44c417[_0xa752('0x120')]+_0x44c417[_0xa752('0x121')]>=_0x4f4f42['dialGlobalMaxRetry']){_0xf421bc['stateGlobal'](_0x44c417,_0x357bef,_0x27d6cc,_0x5f5586[_0xa752('0x1a5')]);}else{_0xf421bc[_0xa752('0x12b')](_0x44c417,_0x357bef,_0x27d6cc,_0x5f5586[_0xa752('0x1a5')]);}}}})[_0xa752('0x99')](function(){if(_0x251775){hopperUtils[_0xa752('0xeb')](_0x44c417,_0x53c6d2,_0x5f3225)[_0xa752('0x99')](function(){return _0x357bef(0x1);});}});});};Dialer['prototype'][_0xa752('0x123')]=function(_0x129d3e,_0x370c98,_0x277871,_0x2dbb7f){var _0x45fffc=new Final(_0x129d3e);_0x45fffc[_0xa752('0x6b')]=0xf;_0x45fffc[_0xa752('0x6c')]='Global';this[_0xa752('0x12b')](_0x45fffc,_0x370c98,_0x277871,_0x2dbb7f);};Dialer[_0xa752('0x19')][_0xa752('0x12b')]=function(_0x12bc15,_0x3d6cb5,_0x5351fc,_0x2904e8){hopperUtils[_0xa752('0x12f')](_0x12bc15)[_0xa752('0x99')](function(){return _0x3d6cb5(msgResponse(_0xa752('0x1a2'),_0xa752('0x1c5'),_0x2904e8));})[_0xa752('0x9d')](function(){return _0x5351fc(msgResponse(_0xa752('0x1c6'),_0xa752('0x90'),'contact\x20not\x20moved'));});};Dialer[_0xa752('0x19')]['predictive']=function(_0x4db8a0){var _0xd81e3=_0x4db8a0[_0xa752('0x1c7')]/0x64;var _0x152d25=_0x4db8a0[_0xa752('0x1c8')]/(_0x4db8a0['outboundDropCallsDayTimeout']+_0x4db8a0[_0xa752('0xc1')]);var _0x149ed5=Math[_0xa752('0x1c9')](_0x4db8a0[_0xa752('0x1ca')]*(_0x4db8a0[_0xa752('0x1cb')]/0x64));var _0x5ac050=Math[_0xa752('0x1c9')](_0x4db8a0['predictiveIntervalAvailable']*(_0x4db8a0[_0xa752('0x1cc')]/0x64));var _0x5e4bff=_0x4db8a0[_0xa752('0x13a')]+_0x4db8a0['talking'];var _0x4f5789=Math[_0xa752('0x1cd')](_0x4db8a0['erlangCalls']*_0x4db8a0[_0xa752('0x5c')]*_0x4db8a0[_0xa752('0x1ce')]*_0x4db8a0[_0xa752('0x1cf')]);if(_[_0xa752('0x3e')](_0x4db8a0[_0xa752('0x28')])){if(!_[_0xa752('0x3e')](_0x4db8a0[_0xa752('0x27')])){_0x4db8a0[_0xa752('0x27')]=undefined;loggerPredictive['error'](_0xa752('0x1d0'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x4db8a0[_0xa752('0x60')])){loggerPredictive[_0xa752('0x62')](_0xa752('0x1d0'),_0xa752('0x1d1'));clearInterval(_0x4db8a0[_0xa752('0x60')]);_0x4db8a0[_0xa752('0x60')]=undefined;}_0x4db8a0[_0xa752('0x28')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));loggerPredictive['info'](_0x4db8a0[_0xa752('0x46')],_0xa752('0x1d2'),_0x4db8a0[_0xa752('0x28')]);this[_0xa752('0xaf')](_0x4db8a0,0x1);}else if(ifInterval(_0x4db8a0[_0xa752('0x1d3')],_0x4db8a0['startProgressive'])){this[_0xa752('0xaf')](_0x4db8a0,0x1);loggerPredictiveCalls[_0xa752('0x49')](_0xa752('0x1d4'),_0x4db8a0[_0xa752('0x28')],_0x4db8a0[_0xa752('0x46')]);_0x4db8a0['erlangCalls']=0x0;_0x4db8a0['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xd81e3<_0x152d25&&_0x4db8a0[_0xa752('0x1d5')]==='dropRate'){clearPredictiveAttributes(_0x4db8a0);loggerPredictive[_0xa752('0x49')](_0xa752('0x1d6'),_0xa752('0x1d7'),_0x152d25,_0xa752('0x28'),_0x4db8a0[_0xa752('0x46')]);}else if(_0x4f5789<_0x4db8a0['predictiveIntervalErlangCallsDroppedCalls']&&_0x4db8a0[_0xa752('0x1d5')]===_0xa752('0x1d8')){clearPredictiveAttributes(_0x4db8a0);loggerPredictive['info'](_0xa752('0x1d9'),_0xa752('0x1da'),_0x4f5789,_0xa752('0x1db'),_0x4db8a0[_0xa752('0xcb')],_0xa752('0x28'),_0x4db8a0['name']);}else if(!ifInterval(_0x4db8a0[_0xa752('0x1d3')],_0x4db8a0[_0xa752('0x28')])&&_[_0xa752('0x3e')](_0x4db8a0[_0xa752('0x27')])&&!_[_0xa752('0x3e')](_0x4db8a0[_0xa752('0x28')])){_0x4db8a0[_0xa752('0x27')]=moment()[_0xa752('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa752('0x49')](_0x4db8a0[_0xa752('0x46')],_0xa752('0x1dc'),_0x4db8a0[_0xa752('0x27')]);hopperUtils['avgHandleTime'](_0x4db8a0['dialPredictiveInterval'])[_0xa752('0x99')](this['getDataPredictive'](_0x4db8a0))['then'](mergeDataErlangB(_0x4db8a0))[_0xa752('0x99')](this[_0xa752('0x1dd')](_0x4db8a0))[_0xa752('0x9d')](loggerCatchPredictive(_0xa752('0x1de'),_0x4db8a0));}else if(!ifInterval(_0x4db8a0[_0xa752('0x1d3')],_0x4db8a0[_0xa752('0x27')])){_0x4db8a0['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4db8a0[_0xa752('0x27')]=moment()[_0xa752('0x44')](_0xa752('0xc0'));loggerPredictive[_0xa752('0x49')](_0x4db8a0['name'],_0xa752('0x1df'),_0x4db8a0['startPredictive']);clearInterval(_0x4db8a0[_0xa752('0x60')]);_0x4db8a0[_0xa752('0x60')]=undefined;hopperUtils[_0xa752('0x1e0')](_0x4db8a0[_0xa752('0x1d3')])[_0xa752('0x99')](this['getDataPredictive'](_0x4db8a0))['then'](mergeDataErlangB(_0x4db8a0))[_0xa752('0x99')](this[_0xa752('0x1dd')](_0x4db8a0))[_0xa752('0x9d')](loggerCatchPredictive(_0xa752('0x1e1'),_0x4db8a0));}else if(_0x4db8a0[_0xa752('0x1ca')]&&_0x5e4bff<_0x4db8a0[_0xa752('0x1ca')]-_0x5ac050){clearPredictiveAttributes(_0x4db8a0);loggerPredictive[_0xa752('0x49')](_0x4db8a0['name'],_0xa752('0x1e2'),_0x5e4bff,_0xa752('0x1e3'),_0x4db8a0[_0xa752('0x1ca')],'-',_0x5ac050,'=',_0x4db8a0[_0xa752('0x1ca')]-_0x5ac050,')');}else if(_0x4db8a0[_0xa752('0x1ca')]&&_0x5e4bff>_0x4db8a0[_0xa752('0x1ca')]+_0x149ed5){clearPredictiveAttributes(_0x4db8a0);loggerPredictive['info'](_0x4db8a0[_0xa752('0x46')],_0xa752('0x1e2'),_0x5e4bff,_0xa752('0x1e4'),_0x4db8a0[_0xa752('0x1ca')],'+',_0x149ed5,'=',_0x4db8a0[_0xa752('0x1ca')]+_0x149ed5,')');}};Dialer[_0xa752('0x19')][_0xa752('0x1e5')]=function(_0x5791a6){var _0x43f15d=this;return function(_0x17d0ed){return new Promise(function(_0x4503f5,_0x3675d1){_[_0xa752('0x5d')](_0x5791a6,_0x17d0ed[0x0]);if(checkGetDataPredictive(_0x17d0ed[0x0])){var _0x515d5f=_0x5791a6[_0xa752('0x1ca')]=_0x5791a6[_0xa752('0x13d')]+_0x5791a6[_0xa752('0x13a')];var _0x3340ab=_0x5791a6[_0xa752('0x1d3')]*0x3c;var _0x5de1b9=_0x17d0ed[0x0][_0xa752('0x52')]+_0x17d0ed[0x0][_0xa752('0x55')];var _0x9a3dd5=(_0x17d0ed[0x0][_0xa752('0x1e6')]+_0x17d0ed[0x0][_0xa752('0x4e')]+_0x17d0ed[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x17d0ed[0x0][_0xa752('0x4c')];_0x5791a6[_0xa752('0x1ce')]=_0x9a3dd5>0x0?_0x9a3dd5:0x1;switch(_0x5791a6[_0xa752('0x1d5')]){case _0xa752('0x1d8'):var _0x16f65b=_0x5791a6[_0xa752('0x1c7')]/0x64;return _0x43f15d[_0xa752('0x1e7')](_0x515d5f,_0x3340ab,_0x5de1b9,_0x9a3dd5,_0x16f65b)[_0xa752('0x99')](function(_0x1f9b04){return _0x4503f5(_0x1f9b04);});case _0xa752('0x1e8'):var _0x16b6c9=_0x5791a6[_0xa752('0x1c7')]/0x64;return _0x43f15d[_0xa752('0x1e9')](_0x515d5f,_0x3340ab,_0x5de1b9,_0x9a3dd5,_0x16b6c9)['then'](function(_0x2f08db){return _0x4503f5(_0x2f08db);});default:return _0x3675d1(msgResponse(_0xa752('0x1ea'),_0xa752('0x90'),_0xa752('0x1eb')));}}else{return _0x3675d1(msgResponse(_0xa752('0x1ea'),_0xa752('0x90'),_0xa752('0x1ec')));}});};};Dialer[_0xa752('0x19')]['getDataPredictiveOld']=function(_0x41ce4c){var _0x238490=this;return function(_0x22f417){return new Promise(function(_0x33b8cf,_0x4aaa79){_[_0xa752('0x5d')](_0x41ce4c,_0x22f417[0x0]);if(checkGetDataPredictive(_0x22f417[0x0])){loggerPredictive['info'](JSON['stringify'](_0x22f417[0x0]));if(_0x41ce4c[_0xa752('0x1d5')]===_0xa752('0x1d8')){return _0x238490[_0xa752('0x15a')](_0x41ce4c['id'])[_0xa752('0x99')](function(_0x196c38){var _0x3cbcb0=_0x41ce4c[_0xa752('0x1ed')]-_0x196c38[0x0][_0xa752('0x1ee')];var _0x49310b=_0x41ce4c[_0xa752('0x1d3')]*0x3c;var _0x4b3c63=_0x22f417[0x0][_0xa752('0x52')]+_0x22f417[0x0][_0xa752('0x55')];var _0x5d2dcf=(_0x22f417[0x0][_0xa752('0x1e6')]+_0x22f417[0x0][_0xa752('0x4e')]+_0x22f417[0x0][_0xa752('0x50')])/_0x22f417[0x0]['predictiveIntervalTotalCalls'];var _0xa893fd=_0x41ce4c[_0xa752('0x1c7')]/0x64;_0x41ce4c[_0xa752('0x1ef')]=_0x196c38[0x0][_0xa752('0x1ee')]||0x0;_0x41ce4c[_0xa752('0x1ce')]=_0x5d2dcf>0x0?_0x5d2dcf:0x1;return _0x238490[_0xa752('0x1e7')](_0x3cbcb0,_0x49310b,_0x4b3c63,_0x5d2dcf,_0xa893fd);})['then'](function(_0x459899){return _0x33b8cf(_0x459899);})[_0xa752('0x9d')](function(_0x18f753){return _0x4aaa79(msgResponse(_0xa752('0x1f0'),_0xa752('0x90'),JSON[_0xa752('0x81')](_0x18f753)));});}if(_0x41ce4c[_0xa752('0x1d5')]===_0xa752('0x1e8')){return _0x238490[_0xa752('0x15a')](_0x41ce4c['id'])['then'](function(_0x4ba3c0){var _0x4160fc=_0x41ce4c[_0xa752('0x1ed')]-_0x4ba3c0[0x0][_0xa752('0x1ee')];var _0x3729df=_0x41ce4c[_0xa752('0x1d3')]*0x3c;var _0x515326=_0x22f417[0x0][_0xa752('0x52')]+_0x22f417[0x0][_0xa752('0x55')];var _0x10b00c=(_0x22f417[0x0][_0xa752('0x1e6')]+_0x22f417[0x0][_0xa752('0x4e')]+_0x22f417[0x0][_0xa752('0x50')])/_0x22f417[0x0][_0xa752('0x4c')];var _0x58aa7f=_0x41ce4c[_0xa752('0x1c7')]/0x64;_0x41ce4c[_0xa752('0x1ef')]=_0x4ba3c0[0x0][_0xa752('0x1ee')]||0x0;_0x41ce4c[_0xa752('0x1ce')]=_0x10b00c>0x0?_0x10b00c:0x1;return _0x238490['busyFactor'](_0x4160fc,_0x3729df,_0x515326,_0x10b00c,_0x58aa7f);})[_0xa752('0x99')](function(_0x11c47d){return _0x33b8cf(_0x11c47d);})['catch'](function(_0x13e65d){return _0x4aaa79(msgResponse(_0xa752('0x1f0'),_0xa752('0x90'),JSON[_0xa752('0x81')](_0x13e65d)));});}}else{return _0x4aaa79(msgResponse('[getDataPredictive]',_0xa752('0x90'),_0xa752('0x1ec')));}});};};Dialer[_0xa752('0x19')]['startMethodPredictive']=function(_0x4c0413){var _0x30bb4=this;return function(){var _0xb26803=0x0;var _0x103e43=Math[_0xa752('0x1cd')](_0x4c0413['erlangCallToSecond']*0x3e8);if(_0x103e43>0x0){_0x103e43=_0x103e43<0x64?0x64:_0x103e43;loggerPredictive[_0xa752('0x49')](_0x4c0413['name'],'one\x20call\x20every:',_0x103e43,_0xa752('0x1f1'));_0x4c0413[_0xa752('0x60')]=setInterval(function(){_0x30bb4[_0xa752('0x60')](_0x4c0413);loggerPredictiveCalls[_0xa752('0x49')](_0xa752('0x1f2'),_0xb26803+=0x1);},_0x103e43);}else{loggerPredictive[_0xa752('0x49')](_0x4c0413['name'],_0xa752('0x1f3'));}};};Dialer[_0xa752('0x19')][_0xa752('0x1f4')]=function(_0x54628b,_0x515b2a){var _0x1548de=this;return function(_0x167071){if(_[_0xa752('0x48')](_0x167071)){if(_[_0xa752('0xf0')](_0x515b2a[_0xa752('0x15f')])||!_0x515b2a[_0xa752('0x1f5')]){if(_0x54628b[_0xa752('0xae')]===_0xa752('0xa')){_0x54628b[_0xa752('0x6e')]=_[_0xa752('0x3e')](_0x54628b[_0xa752('0x6e')])?!![]:_0x54628b['queueStatusComplete'];var _0x464d5f=uuid['v4']();_0x1548de[_0xa752('0x24')][_0x464d5f]=new Action(_0x54628b,_0x515b2a,_0x464d5f);loggerBooked['info'](_0xa752('0x1f6'),_0x464d5f,'queueStatusComplete:\x20',JSON[_0xa752('0x81')](_0x54628b[_0xa752('0x6e')]),_0xa752('0x1f7'),_0x54628b[_0xa752('0x46')]);if(_0x54628b[_0xa752('0x6e')]){_0x54628b['queueStatusComplete']=![];_0x1548de['queueBooked'][_0x1548de['actions'][_0x464d5f][_0xa752('0xb9')]]=[];ami[_0xa752('0x9e')]({'actionid':_0x464d5f,'action':_0xa752('0x1f8'),'queue':_0x54628b['name']})[_0xa752('0x9d')](function(){utils[_0xa752('0xbd')](_0x54628b,_0xa752('0x1f9'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1548de[_0xa752('0x24')][_0x464d5f]['ContactId'],'ListId':_0x1548de[_0xa752('0x24')][_0x464d5f][_0xa752('0xd9')],'VoiceQueueId':_0x1548de['actions'][_0x464d5f]['VoiceQueueId']||undefined,'CampaignId':_0x1548de[_0xa752('0x24')][_0x464d5f]['CampaignId']||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x1fa')));delete _0x1548de[_0xa752('0x24')][_0x464d5f];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xa752('0x81')](_0x54628b[_0xa752('0x6e')]),_0xa752('0x1f7'),_0x54628b[_0xa752('0x46')]);utils[_0xa752('0xbd')](_0x54628b,_0xa752('0x1f9'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1548de[_0xa752('0x24')][_0x464d5f]['ContactId'],'ListId':_0x1548de[_0xa752('0x24')][_0x464d5f][_0xa752('0xd9')],'VoiceQueueId':_0x1548de[_0xa752('0x24')][_0x464d5f][_0xa752('0xe6')]||undefined,'CampaignId':_0x1548de[_0xa752('0x24')][_0x464d5f][_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1548de[_0xa752('0x24')][_0x464d5f];}}else{return _0x1548de[_0xa752('0x166')](_0x54628b,_0x515b2a);}}else{if(utils[_0xa752('0xc9')](undefined,_0x515b2a[_0xa752('0x1fb')])<_0x54628b['dialRecallMeTimeout']*0x3c){if(_0x515b2a[_0xa752('0x14e')]&&!_0x515b2a[_0xa752('0x14e')][_0xa752('0x1fc')]){_0x1548de[_0xa752('0x1d')][_0xa752('0x1fd')](_0x515b2a['id'])['finally'](function(){utils[_0xa752('0xbd')](_0x54628b,'[checkContactBlack]');});}else{hopperUtils['unlockContact']({'active':![]},_0x515b2a['id'],0x1)[_0xa752('0x1b')](function(){utils[_0xa752('0xbd')](_0x54628b,'[checkContactBlack]');});}}else{_0x54628b['outboundReCallsDay']+=0x1;utils[_0xa752('0xbd')](_0x54628b,'[checkContactBlack]');if(_0x54628b[_0xa752('0x1fe')]){hopperUtils[_0xa752('0xd5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x515b2a[_0xa752('0xd8')],'ListId':_0x515b2a[_0xa752('0xd9')],'VoiceQueueId':_0x515b2a[_0xa752('0xe6')]||undefined,'CampaignId':_0x515b2a[_0xa752('0xda')]||undefined})[_0xa752('0x9d')](loggerCatch(_0xa752('0x1ff')));hopperUtils[_0xa752('0xe9')](createObjHistory(_0x54628b,_0x515b2a,utils[_0xa752('0x73')][_0xa752('0x200')],0x17,_0xa752('0x201')))['catch'](loggerCatch(_0xa752('0x202')));}else{_0x1548de[_0xa752('0x115')](createObjHistory(_0x54628b,_0x515b2a,utils[_0xa752('0x73')][_0xa752('0x203')],0x16,_0xa752('0x204')),_0xa752('0x205'),_0xa752('0x206'));}}}}else{_0x54628b[_0xa752('0x207')]+=0x1;_0x1548de[_0xa752('0x115')](createObjHistory(_0x54628b,_0x515b2a,utils[_0xa752('0x73')][_0xa752('0x208')],0xd,'Blacklist'),_0xa752('0x209'),_0xa752('0x20a'));throw _0xa752('0x20b');}};};Dialer[_0xa752('0x19')][_0xa752('0x165')]=function(_0x4fe1f6){var _0x553234=this;var _0x7222b0=_0x4fe1f6[_0xa752('0x20c')]-_0x4fe1f6['originated'];emitCampaignSummary(_0x4fe1f6);if(_0x7222b0>0x0&&_0x4fe1f6[_0xa752('0x20d')]==0x0){if(_0x7222b0>this['maxNumberOriginate']){_0x7222b0=this['maxNumberOriginate'];}_0x4fe1f6[_0xa752('0x20d')]=0x1;hopperUtils['getContactDialerIvr'](_0x4fe1f6,_0x7222b0)[_0xa752('0x99')](function(_0x32ee5f){_0x4fe1f6['temp']=0x0;if(_0x32ee5f){if(!utils[_0xa752('0x20e')](_0x32ee5f)){_0x4fe1f6[_0xa752('0x65')]=utils[_0xa752('0x73')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0xa752('0x20f')+_0x4fe1f6['name']);}else{_0x4fe1f6[_0xa752('0x7a')]+=_0x32ee5f['length'];_0x4fe1f6[_0xa752('0x65')]=utils[_0xa752('0x73')][_0xa752('0x210')];for(var _0x450dbe=0x0;_0x450dbe<_0x32ee5f['length'];_0x450dbe+=0x1){_0x4fe1f6[_0xa752('0x211')]+=0x1;if(_['isNil'](_0x32ee5f[_0x450dbe])||_[_0xa752('0xf0')](_0x32ee5f[_0x450dbe][_0xa752('0x180')])||_['isNil'](_0x32ee5f[_0x450dbe][_0xa752('0x169')])){_0x553234[_0xa752('0x15c')](_0xa752('0x212'),_0x4fe1f6,_0x32ee5f[_0x450dbe]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xa752('0x71')](_0x32ee5f[_0x450dbe],['CampaignId',_0xa752('0x169')]))['then'](_0x553234[_0xa752('0x1f4')](_0x4fe1f6,_0x32ee5f[_0x450dbe]))['catch'](function(_0x193db7){logger[_0xa752('0x62')]('[actionOriginateIvr]',_0x193db7);utils[_0xa752('0xbd')](_0x4fe1f6,_0xa752('0x213'));});}}}}})[_0xa752('0x9d')](function(_0x47b503){_0x4fe1f6[_0xa752('0x20d')]=0x0;logger[_0xa752('0x62')]('[getContactCampaign2]',_0x47b503);});}};Dialer[_0xa752('0x19')][_0xa752('0xaf')]=function(_0x44ca38,_0x6cbc84){var _0x29ad29=this;var _0x29126b=[];if(_0x6cbc84<0x1||_0x44ca38['dialMethod']==='booked'){_0x6cbc84=0x1;}var _0x1bd700=Math[_0xa752('0x1cd')](_0x44ca38[_0xa752('0x13a')]*_0x6cbc84)-_0x44ca38[_0xa752('0x7a')];if(_0x44ca38[_0xa752('0x214')]>0x0){var _0x15d172=_0x44ca38['dialLimitQueue']-_0x44ca38['originated']-_0x44ca38[_0xa752('0x13d')]-_0x44ca38[_0xa752('0x13e')];if(_0x1bd700>_0x15d172){_0x1bd700=_0x15d172;}}if(_0x1bd700>0x0&&_0x44ca38[_0xa752('0x20d')]==0x0){if(_0x44ca38['dialMethod']===_0xa752('0xa')){_0x1bd700=0x1;}if(_0x1bd700>this['maxNumberOriginate']){_0x1bd700=this[_0xa752('0x22')];}for(var _0x2c09bd in this['agents']){if(typeof this['agents'][_0x2c09bd]!==_0xa752('0x154')){if(this[_0xa752('0x20')][_0x2c09bd][_0xa752('0x6b')]===_0xa752('0x215')&&this[_0xa752('0x20')][_0x2c09bd][_0xa752('0x85')]===_0xa752('0x14b')){_0x29126b[_0xa752('0x96')](this[_0xa752('0x20')][_0x2c09bd]['id']);}}}_0x44ca38[_0xa752('0x20d')]=0x1;hopperUtils[_0xa752('0x216')](_0x44ca38,_0x29126b,_0x1bd700)[_0xa752('0x99')](function(_0x2f33ea){_0x44ca38['temp']=0x0;if(_0x2f33ea){if(!utils[_0xa752('0x20e')](_0x2f33ea)){hopperUtils[_0xa752('0x217')](_0x44ca38)['then'](sendMessageReschedule(_0x44ca38))[_0xa752('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x44ca38['originated']+=_0x2f33ea[_0xa752('0xf7')];_0x44ca38['message']=_0x44ca38[_0xa752('0xae')]===_0xa752('0xa')?utils[_0xa752('0x73')][_0xa752('0x13f')]:utils[_0xa752('0x73')][_0xa752('0x210')];for(var _0x5a4f59=0x0;_0x5a4f59<_0x2f33ea['length'];_0x5a4f59+=0x1){if(_[_0xa752('0xf0')](_0x2f33ea[_0x5a4f59])||_[_0xa752('0xf0')](_0x2f33ea[_0x5a4f59][_0xa752('0x180')])||_[_0xa752('0xf0')](_0x2f33ea[_0x5a4f59][_0xa752('0x169')])){_0x29ad29[_0xa752('0x15c')](_0xa752('0x212'),_0x44ca38,_0x2f33ea[_0x5a4f59]);}else{hopperUtils[_0xa752('0x218')](_[_0xa752('0x71')](_0x2f33ea[_0x5a4f59],['VoiceQueueId',_0xa752('0x169')]))[_0xa752('0x99')](_0x29ad29[_0xa752('0x1f4')](_0x44ca38,_0x2f33ea[_0x5a4f59]))[_0xa752('0x9d')](function(_0x5ed567){logger['error']('[actionOriginate]',_0x5ed567);utils['decrementOriginate'](_0x44ca38,_0xa752('0x219'));});}}}}})[_0xa752('0x9d')](function(_0x35a8e4){_0x44ca38[_0xa752('0x20d')]=0x0;logger[_0xa752('0x62')](_0xa752('0x21a'),_0x35a8e4);});}};Dialer['prototype'][_0xa752('0x60')]=function(_0x2f6d68){if(_0x2f6d68[_0xa752('0x214')]>0x0){var _0x526232=_0x2f6d68[_0xa752('0x214')]-_0x2f6d68[_0xa752('0x7a')]-_0x2f6d68[_0xa752('0x13d')];if(_0x526232>0x0&&_0x2f6d68['temp']==0x0){this['tryOriginatePredictive'](_0x2f6d68);}else{loggerPredictiveCalls['info'](_0xa752('0x21b'));}}else{this[_0xa752('0x21c')](_0x2f6d68);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x594c8f){var _0x4c3220=this;var _0x39ecb8=[];_0x594c8f['originated']+=0x1;for(var _0x4e21a9 in this['agents']){if(typeof this['agents'][_0x4e21a9]!==_0xa752('0x154')){if(this[_0xa752('0x20')][_0x4e21a9][_0xa752('0x6b')]===_0xa752('0x215')&&this[_0xa752('0x20')][_0x4e21a9][_0xa752('0x85')]===_0xa752('0x14b')){_0x39ecb8[_0xa752('0x96')](this['agents'][_0x4e21a9]['id']);}}}_0x594c8f[_0xa752('0x20d')]=0x1;return this[_0xa752('0x216')](_0x594c8f['id'],_0x39ecb8,0x1,_0x594c8f[_0xa752('0x21d')],_0x594c8f)[_0xa752('0x99')](function(_0x5d4366){_0x594c8f['temp']=0x1;if(_0x5d4366){if(!utils[_0xa752('0x20e')](_0x5d4366)){utils[_0xa752('0x21e')](_0x594c8f,0x1,0x0);return hopperUtils[_0xa752('0x217')](_0x594c8f)[_0xa752('0x99')](sendMessageReschedule(_0x594c8f))[_0xa752('0x9d')](loggerCatch(_0xa752('0x21f')));}else{_0x594c8f['message']=utils[_0xa752('0x73')][_0xa752('0x210')];if(_[_0xa752('0xf0')](_0x5d4366[0x0])||_[_0xa752('0xf0')](_0x5d4366[0x0][_0xa752('0x180')])||_[_0xa752('0xf0')](_0x5d4366[0x0][_0xa752('0x169')])){_0x4c3220['emptyContact'](_0xa752('0x212'),_0x594c8f,_0x5d4366[0x0]);}else{return hopperUtils[_0xa752('0x218')](_[_0xa752('0x71')](_0x5d4366[0x0],[_0xa752('0xe6'),'phone']))[_0xa752('0x99')](_0x4c3220['checkContactBlack'](_0x594c8f,_0x5d4366[0x0]))[_0xa752('0x9d')](function(_0x51a3e9){logger['error'](_0xa752('0x220'),_0x51a3e9);utils[_0xa752('0xbd')](_0x594c8f,_0xa752('0x220'));});}}}})[_0xa752('0x9d')](function(_0x5b5cec){_0x594c8f[_0xa752('0x20d')]=0x0;logger['error'](_0xa752('0x21a'),_0x5b5cec);});};Dialer['prototype'][_0xa752('0x1e7')]=function(_0x54c49b,_0x4057f4,_0x2835eb,_0x43af09,_0xac8ee2,_0xc003af){loggerPredictive[_0xa752('0x49')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xa752('0x49')](_0xa752('0x221'),_0x54c49b);loggerPredictive[_0xa752('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4057f4);loggerPredictive[_0xa752('0x49')](_0xa752('0x222'),_0x2835eb);loggerPredictive[_0xa752('0x49')]('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',_0x43af09);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xac8ee2);loggerPredictive[_0xa752('0x49')](_0xa752('0x53'));return new Promise(function(_0x3005c1,_0x371bc2){if(_0x54c49b<=0x0||isNaN(_0x54c49b)){return _0x371bc2(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x54c49b));}if(_0x2835eb<=0x0||isNaN(_0x2835eb)){return _0x371bc2(msgResponse(_0xa752('0x223'),'Error','Ts\x20=\x20'+_0x2835eb));}if(_0x43af09<=0x0||isNaN(_0x43af09)){return _0x371bc2(msgResponse('[abandonmentRate]',_0xa752('0x195'),_0xa752('0x224')+_0x43af09));}if(_0x4057f4<=0x0||isNaN(_0x4057f4)){return _0x371bc2(msgResponse('[abandonmentRate]','Error',_0xa752('0x225')+_0x4057f4));}if(_0xac8ee2<=0x0||isNaN(_0xac8ee2)){return _0x371bc2(msgResponse('[abandonmentRate]','Error',_0xa752('0x226')+_0xac8ee2));}_0xc003af=_0xc003af||0x0;var _0x2a6075=0x1/_0x2835eb;var _0x2338a2=0x0;var _0x23297f=0x0;var _0x1f2c57=0x0;var _0x474e97=0x0;for(var _0x2c5e94=0x0;_0x1f2c57<_0xac8ee2;_0x2c5e94+=0x1){_0x23297f=_0x2c5e94/_0x4057f4;_0x2338a2=(_0x43af09*_0x23297f+_0xc003af)/_0x2a6075;_0x1f2c57=utils[_0xa752('0x227')](_0x2338a2,_0x54c49b);_0x474e97=_0x2338a2/_0x54c49b*(0x1-utils['erlangb'](_0x2338a2,_0x54c49b));}return _0x3005c1({'erlangCalls':_0x2c5e94,'erlangCallToSecond':_0x4057f4/_0x2c5e94,'erlangAbandonmentRate':_0x1f2c57,'erlangBusyFactor':_0x474e97});});};Dialer[_0xa752('0x19')][_0xa752('0x1e9')]=function(_0x3e1d34,_0x4c1bba,_0x109694,_0x474feb,_0x240c76,_0x1e8105){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xa752('0x49')](_0xa752('0x221'),_0x3e1d34);loggerPredictive[_0xa752('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c1bba);loggerPredictive[_0xa752('0x49')](_0xa752('0x222'),_0x109694);loggerPredictive[_0xa752('0x49')](_0xa752('0x228'),_0x474feb);loggerPredictive[_0xa752('0x49')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x240c76);loggerPredictive[_0xa752('0x49')](_0xa752('0x53'));return new Promise(function(_0x5116e5,_0x514855){if(_0x3e1d34<=0x0||isNaN(_0x3e1d34)){return _0x514855(msgResponse(_0xa752('0x229'),_0xa752('0x195'),'m\x20=\x20'+_0x3e1d34));}if(_0x109694<=0x0||isNaN(_0x109694)){return _0x514855(msgResponse(_0xa752('0x229'),_0xa752('0x195'),_0xa752('0x22a')+_0x109694));}if(_0x474feb<=0x0||isNaN(_0x474feb)){return _0x514855(msgResponse('[busyFactor]','Error',_0xa752('0x224')+_0x474feb));}if(_0x4c1bba<=0x0||isNaN(_0x4c1bba)){return _0x514855(msgResponse(_0xa752('0x229'),'Error',_0xa752('0x225')+_0x4c1bba));}if(_0x240c76<=0x0||isNaN(_0x240c76)){return _0x514855(msgResponse(_0xa752('0x229'),_0xa752('0x195'),'Umin\x20=\x20'+_0x240c76));}_0x1e8105=_0x1e8105||0x0;var _0x13c892=0x1/_0x109694;var _0x1ff21f=0x0;var _0x36dd43=0x0;var _0xadfbd2=0x0;var _0x3b9e5e=0x0;for(var _0x155ae9=0x0;_0x3b9e5e<_0x240c76;_0x155ae9+=0x1){_0x36dd43=_0x155ae9/_0x4c1bba;_0x1ff21f=(_0x474feb*_0x36dd43+_0x1e8105)/_0x13c892;_0xadfbd2=utils[_0xa752('0x227')](_0x1ff21f,_0x3e1d34);_0x3b9e5e=_0x1ff21f/_0x3e1d34*(0x1-utils[_0xa752('0x227')](_0x1ff21f,_0x3e1d34));}return _0x5116e5({'erlangCalls':_0x155ae9,'erlangCallToSecond':_0x4c1bba/_0x155ae9,'erlangAbandonmentRate':_0xadfbd2,'erlangBusyFactor':_0x3b9e5e});});};module[_0xa752('0x22b')]=Dialer; \ No newline at end of file +var _0x1966=['countnoanswerretry','countnosuchnumberretry','stateGlobal','reason19\x20machine....','createStateFinal','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','Machine','countbusyretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncHangupIvr][createHistory]','[syncHangupIvr]','AGI','[syncHangup2]','outboundUnknownCallsDay','[syncHangup][createHistory]','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[clearZombieChannels]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','Error','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','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','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][MoveBlacklist]','handleIvr','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[actionOriginate]','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','checkContactLowerLimitOriginate','[countReScheduled]\x20','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','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','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','type','debug','format','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','error','inspect','CAMPAIGN_STATUS','contactsRescheduled','message','[getContactDialer2][Empty]','state','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','dialPowerLevel','Queue','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','uniqueid','ivr','queue','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','decrementOriginate','[syncQueueCallerAbandon]','droptime','responsetime','outboundDropCallsDayTimeout','statedesc','Drop','dropreason','TIMEOUT','agiafterat','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','countdropretry','queueCallerAbandonCreateState','add','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','countabandonedretry','dialAbandonedMaxRetry','ListId','swapAdditionalPhones','channel','actionid','rrmemory','isNil','locked','stateinterface','pick','idHopper','paused','syncQueueStatusComplete','strategy','roundrobin','run','[syncQueueStatusComplete]','rescheduleContact','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countcongestionretry'];(function(_0x54597a,_0x4ea42f){var _0x5a764f=function(_0x5c000b){while(--_0x5c000b){_0x54597a['push'](_0x54597a['shift']());}};_0x5a764f(++_0x4ea42f);}(_0x1966,0x10a));var _0x6196=function(_0x237fa9,_0x302fcf){_0x237fa9=_0x237fa9-0x0;var _0x1cab65=_0x1966[_0x237fa9];return _0x1cab65;};'use strict';var util=require(_0x6196('0x0'));var _=require(_0x6196('0x1'));var uuid=require('uuid');var moment=require(_0x6196('0x2'));var rr=require('rr');var Redis=require(_0x6196('0x3'));var utils=require('./utils');var hopperUtils=require(_0x6196('0x4'));var ut=require(_0x6196('0x5'));var config=require(_0x6196('0x6'));var logger=require(_0x6196('0x7'))(_0x6196('0x8'));var loggerBooked=require(_0x6196('0x7'))(_0x6196('0x9'));var loggerPredictive=require('../../../config/logger')(_0x6196('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x6196('0xb'));var loggerSyncQueueSummary=require(_0x6196('0x7'))(_0x6196('0xc'));var ami=require(_0x6196('0xd'));config[_0x6196('0xe')]=_['defaults'](config['redis'],{'host':_0x6196('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6196('0xe')]));var cmHopper=require(_0x6196('0x10'));var voiceQueueRt=require(_0x6196('0x11'));var RpcSetting=require(_0x6196('0x12'));var Interval=require(_0x6196('0x13'));var Action=require('./models/action');var History=require(_0x6196('0x14'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x6196('0x15'));var ipAgi=process['env'][_0x6196('0x16')]||_0x6196('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x6196('0x18')][_0x6196('0x19')]=function(_0x17b1e4){this[_0x6196('0x1a')]=this[_0x6196('0x1a')]?this[_0x6196('0x1a')][_0x6196('0x1b')](_0x17b1e4):_0x17b1e4();};function Dialer(_0x291981,_0x328559){this[_0x6196('0x1c')]=new Sequence();this[_0x6196('0x1d')]=_0x328559;this[_0x6196('0x1e')]=_0x291981[_0x6196('0x1e')];this[_0x6196('0x1f')]=_0x291981[_0x6196('0x1f')];this[_0x6196('0x20')]=_0x291981[_0x6196('0x20')];this[_0x6196('0x21')]=_0x291981[_0x6196('0x21')];this[_0x6196('0x22')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x6196('0x23')]={};this[_0x6196('0x24')]={};this[_0x6196('0x25')]={};this[_0x6196('0x26')]={};this['startPredictive']={};this[_0x6196('0x27')]={};this[_0x6196('0x28')]={};this[_0x6196('0x29')]={};this[_0x6196('0x2a')]={};this[_0x6196('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x6196('0x2c')](this));ami['on'](_0x6196('0x2d'),this[_0x6196('0x2e')]['bind'](this));ami['on'](_0x6196('0x2f'),this[_0x6196('0x30')][_0x6196('0x2c')](this));ami['on'](_0x6196('0x31'),this[_0x6196('0x32')]['bind'](this));ami['on']('custom:queuesummary',this[_0x6196('0xc')][_0x6196('0x2c')](this));ami['on'](_0x6196('0x33'),this[_0x6196('0x34')][_0x6196('0x2c')](this));ami['on'](_0x6196('0x35'),this[_0x6196('0x36')][_0x6196('0x2c')](this));ami['on'](_0x6196('0x37'),this[_0x6196('0x38')][_0x6196('0x2c')](this));ami['on']('varset',this[_0x6196('0x39')][_0x6196('0x2c')](this));ami['on'](_0x6196('0x3a'),this[_0x6196('0x3b')][_0x6196('0x2c')](this));ami['on'](_0x6196('0x3c'),this['syncQueueStatusComplete']['bind'](this));this[_0x6196('0x3d')]();this[_0x6196('0x3e')]();RpcSetting[_0x6196('0x3f')]()[_0x6196('0x40')](function(_0x2c10f4){previewRecallmeReminderInterval=_0x2c10f4['previewRecallmeReminderInterval'];});}function isNotNull(_0xf1586c){return _0xf1586c!==null&&!_[_0x6196('0x41')](_0xf1586c);}function msgResponse(_0x380f43,_0x550b1e,_0x13f15b){return{'action':_0x380f43,'response':_0x550b1e,'message':_0x13f15b,'stack':_0x13f15b};}function emit(_0x41c220,_0x5cf56d,_0x5e3ca0){io['to'](_0x41c220)['emit'](_0x5cf56d,_0x5e3ca0);}function emitOutboundVoiceQueueSummary(_0x4d1d1e){if(_0x4d1d1e[_0x6196('0x42')]==='outbound'){logger[_0x6196('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x4d1d1e,{'showHidden':![],'depth':null}));emit(util[_0x6196('0x44')]('voice:queue:%s',_0x4d1d1e['name']),_0x6196('0x45'),_0x4d1d1e);}}function checkGetDataPredictive(_0x561258){if(isNotNull(_0x561258)&&!_[_0x6196('0x46')](_0x561258)){loggerPredictive[_0x6196('0x47')](_0x6196('0x48'));loggerPredictive['info'](_0x6196('0x49'),_0x561258[_0x6196('0x4a')]);loggerPredictive[_0x6196('0x47')](_0x6196('0x4b'),_0x561258[_0x6196('0x4c')]);loggerPredictive[_0x6196('0x47')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x561258[_0x6196('0x4d')]);loggerPredictive[_0x6196('0x47')](_0x6196('0x4e'),_0x561258['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x6196('0x47')](_0x6196('0x4f'),_0x561258[_0x6196('0x50')]);loggerPredictive[_0x6196('0x47')](_0x6196('0x51'),_0x561258[_0x6196('0x52')]);loggerPredictive['info'](_0x6196('0x53'));if(_0x561258['predictiveIntervalTotalCalls']>0x0){if(!_[_0x6196('0x41')](_0x561258[_0x6196('0x52')])&&_0x561258[_0x6196('0x52')]>0x0){return!![];}loggerPredictive[_0x6196('0x47')](_0x6196('0x54'));if(!_[_0x6196('0x41')](_0x561258[_0x6196('0x50')])&&_0x561258[_0x6196('0x50')]>0x0){return!![];}loggerPredictive[_0x6196('0x47')](_0x6196('0x55'));}else{loggerPredictive[_0x6196('0x47')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x6196('0x47')](_0x6196('0x56'));}return![];}function mergeDataErlangB(_0x16cc10){return function(_0xc2bea7){loggerPredictive['info'](_0x6196('0x57'));loggerPredictive[_0x6196('0x47')](_0x6196('0x58'),_0xc2bea7[_0x6196('0x59')]);loggerPredictive[_0x6196('0x47')](_0x6196('0x5a'),_0xc2bea7[_0x6196('0x5b')]);loggerPredictive[_0x6196('0x47')](_0x6196('0x5c'),_0xc2bea7[_0x6196('0x5d')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc2bea7[_0x6196('0x5e')]);loggerPredictive[_0x6196('0x47')](_0x6196('0x5c'),_0xc2bea7['erlangAbandonmentRate']);loggerPredictive[_0x6196('0x47')]('---------------------------');_[_0x6196('0x5f')](_0x16cc10,_0xc2bea7);};}function ifInterval(_0x5e240e,_0x3a5b46){if(_[_0x6196('0x41')](_0x3a5b46)){return![];}return utils[_0x6196('0x60')](undefined,_0x3a5b46)<_0x5e240e*0x3c;}function clearPredictiveAttributes(_0x3cbeff){if(_0x3cbeff[_0x6196('0x27')]){_0x3cbeff['startProgressive']=undefined;loggerPredictive[_0x6196('0x43')](_0x3cbeff[_0x6196('0x61')],_0x6196('0x62'));}if(_0x3cbeff[_0x6196('0x63')]){_0x3cbeff[_0x6196('0x63')]=undefined;loggerPredictive[_0x6196('0x43')](_0x3cbeff[_0x6196('0x61')],_0x6196('0x64'));}if(_0x3cbeff['handlePredictive']){clearInterval(_0x3cbeff[_0x6196('0x65')]);_0x3cbeff[_0x6196('0x65')]=undefined;loggerPredictive[_0x6196('0x43')](_0x3cbeff[_0x6196('0x61')],_0x6196('0x66'));}}function loggerCatchPredictive(_0x177b9e,_0x1ef18b){return function(_0x59117d){loggerPredictive['error'](_0x1ef18b['name'],_0x177b9e);loggerPredictive['error'](_0x59117d[_0x6196('0x67')]);clearPredictiveAttributes(_0x1ef18b);};}function loggerCatch(_0x367d72){return function(_0x2e7744){logger[_0x6196('0x68')](_0x367d72,util[_0x6196('0x69')](_0x2e7744,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4a0631){return function(_0x1b91a3){if(isNotNull(_0x1b91a3)&&isNotNull(_0x1b91a3[0x0])){if(_0x1b91a3[0x0]['contactsRescheduled']>0x0){_0x4a0631['message']=utils[_0x6196('0x6a')]['CONTACTS_RESCHEDULED'];logger[_0x6196('0x47')]('[getContactDialer2][ReScheduled]'+_0x4a0631[_0x6196('0x61')],_0x1b91a3[0x0][_0x6196('0x6b')],'contacts');}else{_0x4a0631[_0x6196('0x6c')]=utils[_0x6196('0x6a')]['NO_AVAILABLE_CONTACTS'];logger[_0x6196('0x47')](_0x6196('0x6d')+_0x4a0631[_0x6196('0x61')]);}}};}function createObjHistory(_0x11f00e,_0x4351de,_0x3d4fdb,_0x59f2dc,_0x291a0f){_0x11f00e['message']=_0x3d4fdb;var _0x4f4579=new Action(_0x11f00e,_0x4351de);var _0x16f6e7=new History(_0x4f4579);_0x16f6e7[_0x6196('0x6e')]=_0x59f2dc;_0x16f6e7['statedesc']=_0x291a0f;_0x16f6e7[_0x6196('0x6f')]=_0x4f4579['starttime'];return _0x16f6e7;}function unlockQueueStatus(_0x3a6ce7,_0x360222){setTimeout(function(){if(_['isUndefined'](_0x3a6ce7[_0x6196('0x70')])){loggerBooked[_0x6196('0x68')](_0x6196('0x71'),_0x360222);}_0x3a6ce7['queueStatusComplete']=!![];loggerBooked[_0x6196('0x47')](_0x6196('0x72'),_0x360222,JSON[_0x6196('0x73')](_['pick'](_0x3a6ce7,[_0x6196('0x61'),_0x6196('0x70')])));},0x1f3);}function checkInterval(_0x4f30ef){return function(){if(!isNotNull(_0x4f30ef['Interval'])){_0x4f30ef['message']=utils[_0x6196('0x6a')]['NULL_INTERVAL'];throw _0x4f30ef[_0x6196('0x61')]+_0x6196('0x74');}if(!isNotNull(_0x4f30ef[_0x6196('0x75')][_0x6196('0x76')])){_0x4f30ef[_0x6196('0x6c')]=utils[_0x6196('0x6a')]['NULL_INTERVAL'];throw _0x4f30ef['name']+_0x6196('0x74');}if(!isNotNull(_[_0x6196('0x46')](_0x4f30ef[_0x6196('0x75')]['Intervals']))){_0x4f30ef['message']=utils[_0x6196('0x6a')][_0x6196('0x77')];throw _0x4f30ef[_0x6196('0x61')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x20c114){return function(){if(!utils['isIVRCampaignActive'](_0x20c114)){_0x20c114['message']=utils['CAMPAIGN_STATUS'][_0x6196('0x78')];throw _0x20c114['name']+_0x6196('0x79');}};}function emitCampaignSummary(_0x4ec046){if(utils[_0x6196('0x7a')](_0x4ec046)){emit(util[_0x6196('0x44')]('campaign:ivr:%s',_0x4ec046['name']),'campaign:save',_0x4ec046);}}function loggerCatchQueueSummary(_0x291fa3,_0xe68449){return function(_0x5ec95f){clearPredictiveAttributes(_0xe68449);emitCampaignSummary(_0xe68449);loggerSyncQueueSummary['debug'](_0x291fa3,util[_0x6196('0x69')](_0x5ec95f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x45e885){if(_0x45e885[_0x6196('0x7b')]){if(_0x45e885[_0x6196('0x7c')]===0x0){_0x45e885['sendMessageOneNotActive']=![];_0x45e885['message']=utils[_0x6196('0x6a')][_0x6196('0x78')];loggerSyncQueueSummary[_0x6196('0x43')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x45e885[_0x6196('0x61')],_0x6196('0x7d'));}else{_0x45e885['message']=utils[_0x6196('0x6a')][_0x6196('0x7e')];loggerSyncQueueSummary['debug'](_0x6196('0x7f'),_0x45e885[_0x6196('0x61')],'is\x20deactivated');}emitCampaignSummary(_0x45e885);}}function myreject(_0x2b2baf){return function(_0x3c9728){return _0x2b2baf(msgResponse(_0x6196('0x80'),'Error',JSON[_0x6196('0x73')](_0x3c9728)));};}Dialer['prototype']['isTrunkReachable']=function(_0x168996){return!_[_0x6196('0x41')](_0x168996)&&_0x168996&&!_[_0x6196('0x41')](_0x168996[_0x6196('0x61')])&&!_[_0x6196('0x41')](_0x168996[_0x6196('0x81')])&&_0x168996[_0x6196('0x81')]&&(this[_0x6196('0x21')][util[_0x6196('0x44')](_0x6196('0x82'),_0x168996[_0x6196('0x61')])]['status']===_0x6196('0x83')||this[_0x6196('0x21')][util[_0x6196('0x44')](_0x6196('0x82'),_0x168996[_0x6196('0x61')])][_0x6196('0x84')]===_0x6196('0x85'));};Dialer[_0x6196('0x18')][_0x6196('0x86')]=function(_0x4dbcf4){var _0x460560=this;return function(){if(!_0x460560[_0x6196('0x87')](_0x4dbcf4['Trunk'])){if(!_0x460560[_0x6196('0x87')](_0x4dbcf4[_0x6196('0x88')])){_0x4dbcf4[_0x6196('0x6c')]=utils[_0x6196('0x6a')][_0x6196('0x89')];throw _0x4dbcf4[_0x6196('0x61')]+_0x6196('0x8a');}}};};Dialer['prototype'][_0x6196('0x8b')]=function(_0x523908,_0x4eda37,_0x1634d9,_0x144cad){var _0x22c9d6=this;return function(){var _0x2aeeb7=!![];return _0x22c9d6[_0x6196('0x8c')](_0x523908,_0x4eda37,_0x1634d9,_0x144cad,_0x2aeeb7);};};Dialer[_0x6196('0x18')][_0x6196('0x8d')]=function(_0x637c41,_0x1f4428,_0x316d46,_0x35ebe1){var _0xf16deb=this;return function(){var _0x515a2e=![];return _0xf16deb[_0x6196('0x8c')](_0x637c41[_0x6196('0x76')],_0x1f4428,_0x316d46,_0x35ebe1,_0x515a2e);};};Dialer[_0x6196('0x18')]['ifTimeIvr']=function(_0x184d0b,_0x9a9953,_0x58df04,_0x30668e,_0x5d4320){var _0xbf31f1=[];return new Promise(function(_0x413c30,_0x210490){if(!isNotNull(_0x184d0b)){_0x30668e[_0x6196('0x6c')]=utils['CAMPAIGN_STATUS'][_0x6196('0x77')];return _0x210490(msgResponse(_0x6196('0x8e'),_0x6196('0x8f'),_0x58df04+_0x6196('0x90')));}if(_['isEmpty'](_0x184d0b)){_0x30668e['message']=utils[_0x6196('0x6a')]['EMPTY_INTERVAL'];return _0x210490(msgResponse('ifTime',_0x6196('0x8f'),_0x58df04+_0x6196('0x91')));}if(_0x9a9953&&_['isUndefined'](config[_0x6196('0x92')][_0x9a9953])){_0x30668e['message']=utils[_0x6196('0x6a')][_0x6196('0x93')];return _0x210490(msgResponse(_0x6196('0x8e'),'Failure',_0x58df04+_0x6196('0x94')+_0x9a9953));}if(_['isArray'](_0x184d0b)){for(var _0x24ce97=0x0;_0x24ce97<_0x184d0b[_0x6196('0x95')];_0x24ce97+=0x1){_0xbf31f1[_0x6196('0x96')](ami[_0x6196('0x97')]({'action':_0x6196('0x98'),'command':util[_0x6196('0x44')](_0x6196('0x99'),_0x184d0b[_0x24ce97][_0x6196('0x9a')],!_[_0x6196('0x41')](config[_0x6196('0x92')][_0x9a9953])?_0x9a9953:'')})[_0x6196('0x40')](function(_0x22d93f){return _0x22d93f[_0x6196('0x9b')][_0x6196('0x9c')]('true')>=0x0;})[_0x6196('0x9d')](myreject(_0x210490)));}}else{_0xbf31f1[_0x6196('0x96')](ami[_0x6196('0x97')]({'action':'command','command':util[_0x6196('0x44')](_0x6196('0x99'),_0x184d0b,!_['isUndefined'](config[_0x6196('0x92')][_0x9a9953])?_0x9a9953:'')})['then'](function(_0x1ed4c9){return _0x1ed4c9[_0x6196('0x9b')][_0x6196('0x9c')]('true')>=0x0;})[_0x6196('0x9d')](myreject(_0x210490)));}Promise[_0x6196('0x9e')](_0xbf31f1)[_0x6196('0x40')](function(_0x3a37f0){var _0x1c64ce=_[_0x6196('0x9f')](_0x3a37f0);if(_0x1c64ce){return _0x413c30(_0x1c64ce);}else{_0x30668e[_0x6196('0x6c')]=_0x5d4320?utils['CAMPAIGN_STATUS'][_0x6196('0xa0')]:utils[_0x6196('0x6a')][_0x6196('0xa1')];return _0x210490(msgResponse(_0x6196('0xa2'),_0x6196('0x8f'),_0x6196('0xa3')+_0x5d4320+'\x20'+_0x58df04+_0x6196('0xa4')+util[_0x6196('0x69')](_0x184d0b,{'showHidden':![],'depth':null})+_0x6196('0xa5')+_0x9a9953));}})[_0x6196('0x9d')](function(_0xe5ebb){return _0x210490(msgResponse(_0x6196('0x8e'),_0x6196('0x8f'),JSON['stringify'](_0xe5ebb)));});});};Dialer[_0x6196('0x18')][_0x6196('0x3d')]=function(){var _0x36b795=this;return cmHopper[_0x6196('0xa6')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x36b795['syncCampaigns']();},0x3e8);});};Dialer[_0x6196('0x18')][_0x6196('0xa7')]=function(){var _0x478371=this;var _0x49b07e;for(var _0x468e59 in this['campaigns']){if(typeof this['campaigns'][_0x468e59]!=='undefined'){_0x49b07e=this[_0x6196('0x1f')][_0x468e59];if(utils[_0x6196('0x7a')](_0x49b07e)&&utils[_0x6196('0xa8')](_0x49b07e)){_0x49b07e[_0x6196('0x7b')]=!![];Promise[_0x6196('0xa9')]()[_0x6196('0x40')](checkIsIVRCampaignActive(_0x49b07e))[_0x6196('0x40')](checkInterval(_0x49b07e))['then'](_0x478371[_0x6196('0x86')](_0x49b07e))[_0x6196('0x40')](_0x478371[_0x6196('0x8b')](_0x49b07e[_0x6196('0xaa')],_0x49b07e['dialTimezone'],_0x49b07e['name'],_0x49b07e))[_0x6196('0x40')](_0x478371[_0x6196('0x8d')](_0x49b07e[_0x6196('0x75')],_0x49b07e[_0x6196('0xab')],_0x49b07e[_0x6196('0x61')],_0x49b07e))[_0x6196('0x40')](_0x478371[_0x6196('0xac')](_0x49b07e))[_0x6196('0x9d')](loggerCatchQueueSummary(_0x6196('0xad'),_0x49b07e));}else{notSendMessagesCampaign(_0x49b07e);}}}};Dialer[_0x6196('0x18')][_0x6196('0xae')]=function(_0xb532ff){if(_0xb532ff['dialMethod']!==_0x6196('0xa')){clearPredictiveAttributes(_0xb532ff);}switch(_0xb532ff[_0x6196('0xaf')]){case'progressive':this['handlePower'](_0xb532ff,0x1);break;case'power':this[_0x6196('0xb0')](_0xb532ff,_0xb532ff[_0x6196('0xb1')]);break;case _0x6196('0xa'):this['predictive'](_0xb532ff);break;case _0x6196('0x9'):this[_0x6196('0xb0')](_0xb532ff,0x1);break;default:logger[_0x6196('0x68')](_0x6196('0xb2'),_0xb532ff[_0x6196('0x61')],'method\x20not\x20recognized');}};Dialer[_0x6196('0x18')]['ifTime']=function(_0x255a93,_0x390f4c){var _0x227446=_0x255a93[_0x6196('0xab')];var _0x5bcbe9=_0x390f4c?_0x255a93[_0x6196('0xaa')]:_0x255a93['Interval'][_0x6196('0x76')];logger[_0x6196('0xb3')](_0x6196('0xb4'),_0x5bcbe9,_0x227446,_0x255a93[_0x6196('0x61')],util[_0x6196('0x44')](_0x6196('0xb5'),_0x255a93['name'],_0x255a93['id']));var _0xf5a0e3=null;return Interval[_0x6196('0xb6')](_0x5bcbe9,_0x227446)[_0x6196('0x40')](function(_0x53209f){if(_0x53209f===!![]){return _0x53209f;}else{_0x255a93[_0x6196('0x6c')]=_0x390f4c?utils['CAMPAIGN_STATUS'][_0x6196('0xa0')]:utils['CAMPAIGN_STATUS'][_0x6196('0xa1')];_0xf5a0e3=msgResponse(_0x6196('0xa2'),'Failure',_0x6196('0xa3')+_0x390f4c+'\x20'+_0x255a93['name']+_0x6196('0xa4')+util[_0x6196('0x69')](_0x5bcbe9,{'showHidden':![],'depth':null})+_0x6196('0xa5')+_0x227446);}if(_0xf5a0e3!==null){logger[_0x6196('0xb3')](_0x6196('0xb7'),_0xf5a0e3);_0xf5a0e3[_0x6196('0xb8')]=_0x390f4c;throw _0xf5a0e3;}})[_0x6196('0x9d')](function(_0x40fca6){logger[_0x6196('0x68')](_0x6196('0xb9'),_0x40fca6);throw msgResponse(_0x6196('0x80'),'Error',util['inspect'](_0x40fca6,{'showHidden':![],'depth':null}));});};Dialer[_0x6196('0x18')][_0x6196('0xba')]=function(_0x15480d){if(this[_0x6196('0x1e')][_0x15480d['queue']]){if(this[_0x6196('0x25')][_0x15480d[_0x6196('0xbb')]]&&this[_0x6196('0x25')][_0x15480d['uniqueid']][_0x6196('0x42')]!==_0x6196('0xbc')){utils['decrementOriginate'](this[_0x6196('0x1e')][_0x15480d[_0x6196('0xbd')]],_0x6196('0xbe'));this[_0x6196('0x25')][_0x15480d[_0x6196('0xbb')]][_0x6196('0xbf')]=moment()['format'](_0x6196('0xc0'));}}};Dialer[_0x6196('0x18')]['syncAgentComplete']=function(_0x44380b){var _0xb7a257=this[_0x6196('0x25')][_0x44380b['uniqueid']];if(this['voiceQueues'][_0x44380b[_0x6196('0xbd')]]){if(_0xb7a257&&_0xb7a257['type']!=='ivr'){delete this[_0x6196('0x25')][_0x44380b['uniqueid']];this['voiceQueues'][_0x44380b['queue']][_0x6196('0xc1')]+=0x1;var _0x509d13=new AgentComplete(_0xb7a257,_0x44380b);if(_0x44380b['reason']==='agent'){_0x509d13['agiafterat']=this[_0x6196('0x1e')][_0x44380b[_0x6196('0xbd')]][_0x6196('0xc2')]&&this['voiceQueues'][_0x44380b[_0x6196('0xbd')]]['dialAgiAfterHangupAgent']?moment()[_0x6196('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x6196('0xc3')](_0x509d13)['catch'](loggerCatch(_0x6196('0xc4')));hopperUtils[_0x6196('0xc5')](_0x509d13)[_0x6196('0x9d')](loggerCatch(_0x6196('0xc6')));}}};Dialer[_0x6196('0x18')][_0x6196('0x2e')]=function(_0x130e5d){var _0x2e8449=this['uniqueId'][_0x130e5d[_0x6196('0xbb')]];var _0x305c92=this;var _0x5a50a3=![];var _0x501125;var _0x58f163;if(this['voiceQueues'][_0x130e5d[_0x6196('0xbd')]]){if(_0x2e8449&&_0x2e8449['type']!=='ivr'){delete this[_0x6196('0x25')][_0x130e5d['uniqueid']];utils[_0x6196('0xc7')](this[_0x6196('0x1e')][_0x130e5d[_0x6196('0xbd')]],_0x6196('0xc8'));_0x2e8449[_0x6196('0xc9')]=moment()[_0x6196('0x44')](_0x6196('0xc0'));var _0x327f69=new QueueCallerAbandon(_0x2e8449,_0x130e5d);if(utils[_0x6196('0x60')](_0x2e8449[_0x6196('0xc9')],_0x2e8449[_0x6196('0xca')])>=_0x2e8449['dialQueueTimeout']){this[_0x6196('0x1e')][_0x130e5d['queue']][_0x6196('0x4d')]+=0x1;this['voiceQueues'][_0x130e5d[_0x6196('0xbd')]][_0x6196('0xcb')]+=0x1;this[_0x6196('0x1e')][_0x130e5d['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x327f69['state']=0xa;_0x327f69[_0x6196('0xcc')]=_0x6196('0xcd');_0x327f69[_0x6196('0xce')]=_0x6196('0xcf');_0x327f69[_0x6196('0xd0')]=this['voiceQueues'][_0x130e5d[_0x6196('0xbd')]][_0x6196('0xc2')]?moment()[_0x6196('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x327f69['countdropretry']+=0x1;_0x327f69[_0x6196('0xd1')]+=0x1;_0x501125=this['voiceQueues'][_0x130e5d[_0x6196('0xbd')]][_0x6196('0xd2')];_0x58f163=this[_0x6196('0x1e')][_0x130e5d[_0x6196('0xbd')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x6196('0xd3')](_0x327f69,_0x327f69[_0x6196('0x6e')],_0x2e8449[_0x6196('0xd4')])[_0x6196('0x40')](function(_0x4292b7){_0x5a50a3=_0x4292b7[_0x6196('0xd5')]==0x1;if(_0x327f69[_0x6196('0xd6')]>=_0x305c92['voiceQueues'][_0x130e5d[_0x6196('0xbd')]]['dialDropMaxRetry']){_0x305c92[_0x6196('0xd7')](_0x327f69,_0x4292b7[_0x6196('0xd5')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x327f69['countdropretry'],'scheduledat':moment()[_0x6196('0xd8')](_0x305c92[_0x6196('0x1e')][_0x130e5d['queue']][_0x6196('0xd2')],_0x6196('0xd9'))[_0x6196('0x44')](_0x6196('0xc0')),'ContactId':_0x2e8449[_0x6196('0xda')],'ListId':_0x2e8449['ListId'],'VoiceQueueId':_0x2e8449[_0x6196('0xdb')]||undefined,'CampaignId':_0x2e8449[_0x6196('0xdc')]||undefined})['catch'](loggerCatch(_0x6196('0xdd')));var _0x7cc871=new History(_0x327f69);_0x7cc871[_0x6196('0x6e')]=0xa;_0x7cc871['statedesc']=_0x6196('0xcd');_0x7cc871[_0x6196('0xde')]=moment()[_0x6196('0x44')](_0x6196('0xc0'));_0x7cc871[_0x6196('0x6f')]=_0x7cc871['starttime'];_0x7cc871[_0x6196('0xdf')]=_0x327f69[_0x6196('0xdf')];_0x7cc871[_0x6196('0xe0')]=_0x327f69[_0x6196('0xe0')];hopperUtils[_0x6196('0xc3')](_0x7cc871)[_0x6196('0x9d')](loggerCatch(_0x6196('0xe1')));}})[_0x6196('0x40')](function(){if(_0x5a50a3)hopperUtils['swapAdditionalPhones'](_0x327f69,_0x501125,_0x58f163)[_0x6196('0x40')](function(){return 0x1;});});}else{this[_0x6196('0x1e')][_0x130e5d[_0x6196('0xbd')]][_0x6196('0xe2')]+=0x1;this['voiceQueues'][_0x130e5d[_0x6196('0xbd')]]['outboundDropCallsDayCallersExit']+=0x1;_0x327f69[_0x6196('0x6e')]=0xb;_0x327f69[_0x6196('0xcc')]=_0x6196('0xe3');_0x327f69['dropreason']=_0x6196('0xe4');_0x327f69['countabandonedretry']+=0x1;_0x327f69[_0x6196('0xd1')]+=0x1;_0x501125=this[_0x6196('0x1e')][_0x130e5d[_0x6196('0xbd')]][_0x6196('0xe5')];_0x58f163=this['voiceQueues'][_0x130e5d[_0x6196('0xbd')]][_0x6196('0xe6')];hopperUtils[_0x6196('0xd3')](_0x327f69,_0x327f69[_0x6196('0x6e')],_0x2e8449[_0x6196('0xd4')])[_0x6196('0x40')](function(_0x2dd717){if(_0x327f69[_0x6196('0xe7')]>=_0x305c92['voiceQueues'][_0x130e5d[_0x6196('0xbd')]][_0x6196('0xe8')]){_0x305c92[_0x6196('0xd7')](_0x327f69,_0x2dd717[_0x6196('0xd5')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x327f69['countabandonedretry'],'scheduledat':moment()[_0x6196('0xd8')](_0x305c92[_0x6196('0x1e')][_0x130e5d[_0x6196('0xbd')]]['dialAbandonedRetryFrequency'],_0x6196('0xd9'))[_0x6196('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e8449['ContactId'],'ListId':_0x2e8449[_0x6196('0xe9')],'VoiceQueueId':_0x2e8449['VoiceQueueId']||undefined,'CampaignId':_0x2e8449['CampaignId']||undefined})[_0x6196('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x504724=new History(_0x327f69);_0x504724['state']=0xb;_0x504724[_0x6196('0xcc')]=_0x6196('0xe3');_0x504724[_0x6196('0xde')]=moment()['format'](_0x6196('0xc0'));_0x504724[_0x6196('0x6f')]=_0x504724['starttime'];_0x504724[_0x6196('0xdf')]=_0x327f69[_0x6196('0xdf')];_0x504724[_0x6196('0xe0')]=_0x327f69[_0x6196('0xe0')];hopperUtils[_0x6196('0xc3')](_0x504724)[_0x6196('0x9d')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x6196('0x40')](function(){if(_0x5a50a3)hopperUtils[_0x6196('0xea')](_0x327f69,_0x501125,_0x58f163)[_0x6196('0x40')](function(){return 0x1;});});}}}};Dialer[_0x6196('0x18')]['syncNewExten']=function(_0xc49233){if(this['actions'][_0xc49233['uniqueid']]){this[_0x6196('0x23')][_0xc49233[_0x6196('0xbb')]][_0x6196('0xeb')]=_0xc49233['channel'];}if(this[_0x6196('0x25')][_0xc49233[_0x6196('0xbb')]]){this[_0x6196('0x25')][_0xc49233[_0x6196('0xbb')]][_0x6196('0xeb')]=_0xc49233['channel'];}};Dialer[_0x6196('0x18')][_0x6196('0x3b')]=function(_0x7a25e2){if(!this[_0x6196('0x23')][_0x7a25e2[_0x6196('0xec')]]){return;}var _0x356dea=this[_0x6196('0x1e')][this['actions'][_0x7a25e2[_0x6196('0xec')]][_0x6196('0xbd')]]['strategy']||_0x6196('0xed');if(_0x356dea==='roundrobin'){if(this[_0x6196('0x23')][_0x7a25e2['actionid']]&&_[_0x6196('0xee')](this['actions'][_0x7a25e2['actionid']][_0x6196('0xef')])&&_0x7a25e2['status']==='1'&&_0x7a25e2['paused']==='0'){if(this[_0x6196('0x20')][_0x7a25e2[_0x6196('0xf0')]]){if(!this[_0x6196('0x20')][_0x7a25e2['stateinterface']][_0x6196('0xef')]){this['agents'][_0x7a25e2[_0x6196('0xf0')]][_0x6196('0xef')]=!![];this['actions'][_0x7a25e2[_0x6196('0xec')]]['locked']=!![];this['actions'][_0x7a25e2[_0x6196('0xec')]][_0x6196('0xf0')]=_0x7a25e2['stateinterface'];}}}}else if(_0x356dea==='rrmemory'){if(this[_0x6196('0x23')][_0x7a25e2['actionid']]){if(this[_0x6196('0x20')][_0x7a25e2[_0x6196('0xf0')]]){this[_0x6196('0x23')][_0x7a25e2[_0x6196('0xec')]][_0x6196('0xf0')]=_0x7a25e2[_0x6196('0xf0')];if(_[_0x6196('0xee')](this['queueBooked'][this['actions'][_0x7a25e2[_0x6196('0xec')]][_0x6196('0xbd')]])){this[_0x6196('0x29')][this['actions'][_0x7a25e2[_0x6196('0xec')]][_0x6196('0xbd')]]=[];}this['queueBooked'][this['actions'][_0x7a25e2[_0x6196('0xec')]][_0x6196('0xbd')]][_0x6196('0x96')](_[_0x6196('0x5f')](_[_0x6196('0xf1')](this[_0x6196('0x23')][_0x7a25e2[_0x6196('0xec')]],[_0x6196('0xf2'),_0x6196('0xf0')]),{'status':_0x7a25e2[_0x6196('0x84')],'paused':_0x7a25e2[_0x6196('0xf3')]}));}}}};Dialer[_0x6196('0x18')][_0x6196('0xf4')]=function(_0x36cf08){if(!this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]]){return;}var _0xc18dbe=this;var _0x2c0a2e=this[_0x6196('0x1e')][this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]][_0x6196('0xbd')]];var _0x1a34e6=_0x2c0a2e[_0x6196('0xf5')]||_0x6196('0xed');if(_0x1a34e6===_0x6196('0xf6')){if(this[_0x6196('0x23')][_0x36cf08['actionid']]&&this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]][_0x6196('0xf0')]){this[_0x6196('0x1d')][_0x6196('0xf7')](this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]]['idHopper'],this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]][_0x6196('0xf0')])[_0x6196('0x9d')](function(_0x2ff1cb){logger[_0x6196('0x68')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x6196('0x69')](_0x2ff1cb,{'showHidden':![],'depth':null}));})[_0x6196('0x1b')](function(){utils[_0x6196('0xc7')](_0xc18dbe['voiceQueues'][_0xc18dbe[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]][_0x6196('0xbd')]],'[syncQueueStatusComplete]');_0xc18dbe['agents'][_0xc18dbe[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]][_0x6196('0xf0')]][_0x6196('0xef')]=![];delete _0xc18dbe[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]];unlockQueueStatus(_0x2c0a2e);});}else{utils[_0x6196('0xc7')](this['voiceQueues'][this['actions'][_0x36cf08[_0x6196('0xec')]][_0x6196('0xbd')]],_0x6196('0xf8'));hopperUtils[_0x6196('0xf9')]({'active':![],'ContactId':this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]][_0x6196('0xda')],'ListId':this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]]['ListId'],'VoiceQueueId':this[_0x6196('0x23')][_0x36cf08['actionid']][_0x6196('0xdb')]||undefined,'CampaignId':this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]]['CampaignId']||undefined})[_0x6196('0x9d')](loggerCatch(_0x6196('0xfa')));delete this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]];unlockQueueStatus(_0x2c0a2e);}}else if(_0x1a34e6==='rrmemory'){var _0x52d5fb;if(this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]]&&!_['isEmpty'](this[_0x6196('0x29')][this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]][_0x6196('0xbd')]])){if(this[_0x6196('0x2a')][_0xc18dbe[_0x6196('0x23')][_0x36cf08['actionid']][_0x6196('0xbd')]]){this[_0x6196('0x2a')][_0xc18dbe[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]]['queue']]=this['queueBookedRR'][this['actions'][_0x36cf08[_0x6196('0xec')]]['queue']]?this[_0x6196('0x2a')][this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]]['queue']]:this[_0x6196('0x29')][this['actions'][_0x36cf08[_0x6196('0xec')]][_0x6196('0xbd')]]?this[_0x6196('0x29')][this['actions'][_0x36cf08[_0x6196('0xec')]][_0x6196('0xbd')]][_0x6196('0xfb')]||0x0:0x0;}this[_0x6196('0x29')][this[_0x6196('0x23')][_0x36cf08[_0x6196('0xec')]]['queue']]['_rr']=this[_0x6196('0x2a')][this['actions'][_0x36cf08[_0x6196('0xec')]][_0x6196('0xbd')]];for(var _0x25d084=0x0;_0x25d084=_0x5ac68e['dialGlobalMaxRetry']){_0xec1be[_0x6196('0x124')](_0x3898f5,_0x1cf222,_0x489c01,_0x6196('0x125'));}else{if(_0x3898f5['countmachineretry']>=_0x5ac68e['dialMachineMaxRetry']){_0xec1be[_0x6196('0x126')](_0x3898f5,_0x1cf222,_0x489c01,'reason\x2019\x20machine....');}else{hopperUtils[_0x6196('0xf9')]({'active':![],'countmachineretry':_0x3898f5['countmachineretry'],'scheduledat':moment()['add'](_0x5ac68e['dialMachineRetryFrequency'],'minutes')[_0x6196('0x44')](_0x6196('0xc0')),'ContactId':_0x3898f5[_0x6196('0xda')],'ListId':_0x3898f5[_0x6196('0xe9')],'VoiceQueueId':_0x3898f5[_0x6196('0xdb')]||undefined,'CampaignId':_0x3898f5[_0x6196('0xdc')]||undefined})[_0x6196('0x9d')](loggerCatch(_0x6196('0x127')));_0x1cf222({'reschedule':0x1});}}});}if(_0x397ccf[_0x6196('0x42')]===_0x6196('0xbc')&&this[_0x6196('0x1f')][_0x397ccf[_0x6196('0xbd')]]['dialAMDActive']&&_0x5a63ce[_0x6196('0x11c')]===_0x6196('0x110')){delete this[_0x6196('0x25')][_0x5a63ce['uniqueid']];utils['decrementOriginate'](this[_0x6196('0x1f')][_0x397ccf[_0x6196('0xbd')]],_0x6196('0x111'));_0x502691=new Hangup(_0x397ccf,_0x5a63ce);_0x502691[_0x6196('0x6e')]=0x12;_0x502691[_0x6196('0xcc')]=_0x6196('0x113');_0x502691[_0x6196('0x114')]=_0x6196('0x115');ami[_0x6196('0x116')]('custom:amd',ut[_0x6196('0x118')](_0x502691,_0x6196('0x11f')));this[_0x6196('0x119')](_0x502691,_0x6196('0x128'),'[syncHangupInAMDIvr]');}if(_0x397ccf['type']===_0x6196('0xbc')&&this[_0x6196('0x1f')][_0x397ccf[_0x6196('0xbd')]][_0x6196('0x10f')]&&_0x5a63ce[_0x6196('0x11c')]==='MACHINE'){return new Promise(function(_0x6f31fb,_0x32132d){delete _0xec1be['uniqueId'][_0x5a63ce[_0x6196('0xbb')]];utils['decrementOriginate'](_0xec1be[_0x6196('0x1f')][_0x397ccf[_0x6196('0xbd')]],_0x6196('0x111'));_0xec1be[_0x6196('0x1f')][_0x397ccf[_0x6196('0xbd')]][_0x6196('0xc1')]+=0x1;_0xec1be[_0x6196('0x1f')][_0x397ccf[_0x6196('0xbd')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1ec96b=_0xec1be['campaigns'][_0x397ccf[_0x6196('0xbd')]];var _0x4990ad=new Hangup(_0x397ccf,_0x5a63ce);_0x4990ad[_0x6196('0x6e')]=0x13;_0x4990ad['statedesc']=_0x6196('0x129');_0x4990ad[_0x6196('0x114')]=_0x6196('0x115');_0x4990ad[_0x6196('0x11e')]+=0x1;_0x4990ad[_0x6196('0xd1')]+=0x1;_0x4990ad[_0x6196('0x11f')]=!![];ami[_0x6196('0x116')](_0x6196('0x117'),ut[_0x6196('0x118')](_0x4990ad,_0x6196('0x11f')));hopperUtils[_0x6196('0xc3')](_0x4990ad)[_0x6196('0x9d')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4990ad[_0x6196('0x12a')]+_0x4990ad[_0x6196('0x121')]+_0x4990ad[_0x6196('0x122')]+_0x4990ad[_0x6196('0x123')]+_0x4990ad['countdropretry']+_0x4990ad[_0x6196('0xe7')]+_0x4990ad['countmachineretry']+_0x4990ad[_0x6196('0x12b')]>=_0x1ec96b[_0x6196('0x12c')]){_0xec1be[_0x6196('0x124')](_0x4990ad,_0x6f31fb,_0x32132d,_0x6196('0x125'));}else{if(_0x4990ad[_0x6196('0x11e')]>=_0x1ec96b[_0x6196('0x12d')]){_0xec1be[_0x6196('0x126')](_0x4990ad,_0x6f31fb,_0x32132d,'reason\x2019\x20machine....');}else{hopperUtils[_0x6196('0xf9')]({'active':![],'countmachineretry':_0x4990ad[_0x6196('0x11e')],'scheduledat':moment()[_0x6196('0xd8')](_0x1ec96b['dialMachineRetryFrequency'],'minutes')[_0x6196('0x44')](_0x6196('0xc0')),'ContactId':_0x4990ad['ContactId'],'ListId':_0x4990ad[_0x6196('0xe9')],'VoiceQueueId':_0x4990ad[_0x6196('0xdb')]||undefined,'CampaignId':_0x4990ad[_0x6196('0xdc')]||undefined})[_0x6196('0x9d')](loggerCatch('[rescheduleContact][Machine]'));_0x6f31fb({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x43c7b1){var _0x13e4e7=this[_0x6196('0x25')][_0x43c7b1[_0x6196('0xbb')]];var _0x5ed229;if(!_0x13e4e7){return;}if(_0x13e4e7['type']===_0x6196('0xbc')){delete this[_0x6196('0x25')][_0x43c7b1[_0x6196('0xbb')]];utils['decrementOriginate'](this['campaigns'][_0x13e4e7[_0x6196('0xbd')]],'[syncHangup]');this[_0x6196('0x1f')][_0x13e4e7[_0x6196('0xbd')]][_0x6196('0x12e')]+=0x1;if(_0x43c7b1[_0x6196('0x12f')]===_0x6196('0x130')){const _0x22509a=new AgentComplete(_0x13e4e7,_0x43c7b1);_0x22509a['CampaignId']=this[_0x6196('0x1f')][_0x13e4e7[_0x6196('0xbd')]]['id'];hopperUtils[_0x6196('0xc3')](_0x22509a)[_0x6196('0x9d')](loggerCatch('[syncAgentCompleteIvr][createHistory]'));hopperUtils[_0x6196('0xc5')](_0x22509a)['catch'](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x5ed229=new Hangup(_0x13e4e7,_0x43c7b1);hopperUtils[_0x6196('0xc3')](_0x5ed229)['catch'](loggerCatch(_0x6196('0x131')));hopperUtils['moveContactManagedDialer'](_0x5ed229)['catch'](loggerCatch(_0x6196('0x132')));}}else{if(isNotNull(this[_0x6196('0x1e')][_0x13e4e7[_0x6196('0xbd')]]['dialQueueProject'])){delete this['uniqueId'][_0x43c7b1[_0x6196('0xbb')]];utils[_0x6196('0xc7')](this[_0x6196('0x1e')][_0x13e4e7[_0x6196('0xbd')]],'[syncHangup]');this[_0x6196('0x1e')][_0x13e4e7[_0x6196('0xbd')]]['outboundAnswerCallsDay']+=0x1;this[_0x6196('0x1e')][_0x13e4e7[_0x6196('0xbd')]][_0x6196('0x112')]+=0x1;_0x5ed229=new Hangup(_0x13e4e7,_0x43c7b1);_0x5ed229[_0x6196('0x6e')]=0x10;_0x5ed229[_0x6196('0xcc')]='AnswerAGI';_0x5ed229[_0x6196('0x114')]=_0x6196('0x133');hopperUtils[_0x6196('0xc3')](_0x5ed229)[_0x6196('0x9d')](loggerCatch(_0x6196('0x131')));hopperUtils[_0x6196('0xc5')](_0x5ed229)['catch'](loggerCatch(_0x6196('0x132')));}else{delete this[_0x6196('0x25')][_0x43c7b1[_0x6196('0xbb')]];utils[_0x6196('0xc7')](this[_0x6196('0x1e')][_0x13e4e7['queue']],_0x6196('0x134'));if(_0x43c7b1[_0x6196('0x12f')]===_0x6196('0x130')){this[_0x6196('0x1e')][_0x13e4e7[_0x6196('0xbd')]][_0x6196('0xc1')]+=0x1;const _0x10f8b0=new AgentComplete(_0x13e4e7,_0x43c7b1);_0x10f8b0[_0x6196('0xdb')]=this[_0x6196('0x1e')][_0x13e4e7['queue']]['id'];hopperUtils[_0x6196('0xc3')](_0x10f8b0)[_0x6196('0x9d')](loggerCatch(_0x6196('0xc4')));hopperUtils[_0x6196('0xc5')](_0x10f8b0)[_0x6196('0x9d')](loggerCatch('[syncAgentComplete]'));}else{this[_0x6196('0x1e')][_0x13e4e7[_0x6196('0xbd')]][_0x6196('0x135')]+=0x1;_0x5ed229=new Hangup(_0x13e4e7,_0x43c7b1);_0x5ed229['state']=0xc;_0x5ed229[_0x6196('0xcc')]=_0x43c7b1['cause-txt'];_0x5ed229[_0x6196('0x114')]='Unknown';hopperUtils[_0x6196('0xc3')](_0x5ed229)[_0x6196('0x9d')](loggerCatch(_0x6196('0x136')));hopperUtils[_0x6196('0xc5')](_0x5ed229)['catch'](loggerCatch('[syncHangup]'));}}}};Dialer['prototype'][_0x6196('0xc')]=function(_0x1259e8){var _0x2bcdfc=this;if(!_0x2bcdfc[_0x6196('0x2b')][_0x1259e8[_0x6196('0x61')]]){_0x2bcdfc['queuesSummary'][_0x1259e8['name']]={'running':![]};}else if(_0x2bcdfc[_0x6196('0x2b')][_0x1259e8['name']][_0x6196('0x137')]===!![]){return;}else if(_0x2bcdfc[_0x6196('0x2b')][_0x1259e8[_0x6196('0x61')]][_0x6196('0x137')]===![]){_0x2bcdfc[_0x6196('0x2b')][_0x1259e8[_0x6196('0x61')]][_0x6196('0x137')]=!![];}var _0x145be4=_0x2bcdfc[_0x6196('0x1e')][_0x1259e8[_0x6196('0x61')]];var _0xee8d93=_0x145be4['message']!==utils[_0x6196('0x6a')][_0x6196('0x78')];var _0x1ae29f=utils[_0x6196('0x138')](_0x145be4);_0x145be4['statusMessage']=utils[_0x6196('0x139')](_0x145be4,_0x2bcdfc[_0x6196('0x21')]);Promise[_0x6196('0xa9')]()[_0x6196('0x40')](function(){if(_0x145be4[_0x6196('0x13a')]===utils[_0x6196('0x6a')][_0x6196('0x78')]){if(_0xee8d93){clearPredictiveAttributes(_0x145be4);_0x1259e8[_0x6196('0x63')]=undefined;_0x1259e8[_0x6196('0x27')]=undefined;}if(_0x145be4['statusMessage']===utils['CAMPAIGN_STATUS'][_0x6196('0x78')]){_0x1259e8[_0x6196('0x13b')]=0x0;_0x1259e8['paused']=0x0;_0x1259e8[_0x6196('0x13c')]=0x0;_0x1259e8[_0x6196('0x13d')]=0x0;_0x1259e8[_0x6196('0x13e')]=0x0;}}else if(_0x145be4[_0x6196('0x13a')]===utils[_0x6196('0x6a')][_0x6196('0x13f')]&&!_0x1ae29f){return _0x2bcdfc[_0x6196('0x8e')](_0x145be4,!![])[_0x6196('0x40')](function(){return _0x2bcdfc[_0x6196('0x8e')](_0x145be4,![]);})['then'](function(){return _0x2bcdfc[_0x6196('0xae')](_0x145be4);})[_0x6196('0x9d')](function(_0x5b9842){loggerSyncQueueSummary['debug'](_0x6196('0x140'),util[_0x6196('0x69')](_0x5b9842,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x145be4);});}else{clearPredictiveAttributes(_0x145be4);}})[_0x6196('0x40')](function(){var _0x58049b=_0x1259e8[_0x6196('0x141')](_0x145be4);if(_0x58049b||_0x145be4[_0x6196('0x142')]){_0x145be4[_0x6196('0x142')]=![];_0x1259e8[_0x6196('0x143')](_0x145be4);Object[_0x6196('0x144')](_0x145be4,_0x1259e8);emitOutboundVoiceQueueSummary(_0x1259e8);}_0x2bcdfc[_0x6196('0x2b')][_0x145be4[_0x6196('0x61')]][_0x6196('0x137')]=![];})[_0x6196('0x9d')](function(_0x537322){logger[_0x6196('0x68')]('[syncQueueSummary]',util[_0x6196('0x69')](_0x537322,{'showHidden':![],'depth':null}));_0x2bcdfc[_0x6196('0x2b')][_0x145be4[_0x6196('0x61')]][_0x6196('0x137')]=![];});};Dialer[_0x6196('0x18')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x274200=_[_0x6196('0x145')](this['voiceQueues'],function(_0x20c268){return _0x20c268[_0x6196('0x146')];});var _0x364e42=_[_0x6196('0x145')](this[_0x6196('0x20')],function(_0x37c96e){return _0x37c96e[_0x6196('0x147')]&&_0x37c96e[_0x6196('0x84')]===_0x6196('0x83');});if(_0x274200['length']>0x0&&_0x364e42['length']>0x0){return Promise[_0x6196('0xa9')]()[_0x6196('0x40')](cmHopper[_0x6196('0x148')](_[_0x6196('0x149')](_0x274200,'id'),previewRecallmeReminderInterval,_[_0x6196('0x149')](_0x364e42,'id')))[_0x6196('0x40')](function(_0x211c2a){for(var _0x5e93aa=0x0;_0x5e93aa<_0x211c2a[_0x6196('0x95')];_0x5e93aa++){var _0x352ad0=_0x211c2a[_0x5e93aa][_0x6196('0x14a')][_0x6196('0x61')];if(_0x352ad0)io['to'](util[_0x6196('0x44')](_0x6196('0x14b'),_0x352ad0))['emit'](_0x6196('0x14c'),{'hopper':_0x211c2a[_0x5e93aa]});}})[_0x6196('0x9d')](function(_0x1e01ce){logger['error'](_0x6196('0x14d'),_0x1e01ce);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x6196('0x3e')]=function(){var _0x4a20cc=this;setInterval(function(){_0x4a20cc[_0x6196('0x14e')](_0x4a20cc[_0x6196('0x25')],_0x6196('0x14f'));_0x4a20cc[_0x6196('0x14e')](_0x4a20cc['actions'],_0x6196('0x150'));},0x32c8);};Dialer[_0x6196('0x18')][_0x6196('0x14e')]=function(_0x407340,_0xe0380d){var _0x40a78a=this;for(var _0x568347 in _0x407340){if(typeof _0x407340[_0x568347]!==_0x6196('0x151')){this[_0x6196('0x1c')][_0x6196('0x19')](function(){if(!_[_0x6196('0xee')](_0x407340[_0x568347])){return ami[_0x6196('0x97')]({'action':'status','channel':_0x407340[_0x568347][_0x6196('0xeb')]})['catch'](function(_0x5d12fa){if(_0x5d12fa[_0x6196('0x6c')]===_0x6196('0x152')){setTimeout(function(){if(_0x407340[_0x568347]&&_0x407340[_0x568347][_0x6196('0x42')]!==_0x6196('0xbc')){utils[_0x6196('0xc7')](_0x40a78a[_0x6196('0x1e')][_0x407340[_0x568347][_0x6196('0xbd')]],_0x6196('0x153'));logger[_0x6196('0x68')]('[Dialer][checkChannel]',_0xe0380d,_0x568347,_0x407340[_0x568347][_0x6196('0xbd')]);delete _0x407340[_0x568347];}if(_0x407340[_0x568347]&&_0x407340[_0x568347][_0x6196('0x42')]===_0x6196('0xbc')){utils[_0x6196('0xc7')](_0x40a78a[_0x6196('0x1f')][_0x407340[_0x568347][_0x6196('0xbd')]],_0x6196('0x153'));logger[_0x6196('0x68')]('[Dialer][checkChannel][ivr]',_0xe0380d,_0x568347,_0x407340[_0x568347][_0x6196('0xbd')]);delete _0x407340[_0x568347];}},0x2328);}});}});}}};Dialer[_0x6196('0x18')]['getVoiceQueueRtPauses']=function(_0x35233b){return Promise[_0x6196('0xa9')]()[_0x6196('0x40')](voiceQueueRt[_0x6196('0x154')](_0x35233b))[_0x6196('0x9d')](loggerCatch(_0x6196('0x155')));};Dialer[_0x6196('0x18')]['emptyContact']=function(_0x3e2844,_0x467e24,_0x4c7562){var _0x2ab610={'state':0x19,'statedesc':'notFound'};utils[_0x6196('0xc7')](_0x467e24,_0x6196('0x156')+_0x3e2844);this[_0x6196('0x119')](_[_0x6196('0x5f')](_0x2ab610,_[_0x6196('0xf1')](_0x4c7562,[_0x6196('0xda'),_0x6196('0xe9'),_0x6196('0x157'),_0x6196('0xdb'),'CampaignId'])),_0x6196('0x158'),_0x6196('0x156'));logger['error'](_0x3e2844);};Dialer[_0x6196('0x18')][_0x6196('0x119')]=function(_0x4d1429,_0x5e7911,_0x16083d){hopperUtils['createHistory'](_0x4d1429)[_0x6196('0x9d')](loggerCatch(_0x5e7911));hopperUtils[_0x6196('0xc5')](_0x4d1429)[_0x6196('0x9d')](loggerCatch(_0x16083d));};Dialer[_0x6196('0x18')][_0x6196('0xd7')]=function(_0x56666a,_0x341ad7){hopperUtils[_0x6196('0xc3')](_0x56666a)[_0x6196('0x9d')](loggerCatch(_0x6196('0xc4')));if(_0x341ad7==0x0){hopperUtils[_0x6196('0xc5')](_0x56666a)['catch'](loggerCatch(_0x6196('0x159')));}};Dialer[_0x6196('0x18')][_0x6196('0x14d')]=function(_0x198829){return Promise['resolve']()['then'](cmHopper[_0x6196('0x148')](_0x198829['id'],previewRecallmeReminderInterval))[_0x6196('0x40')](function(_0x32074c){for(var _0x13b57a=0x0;_0x13b57a<_0x32074c[_0x6196('0x95')];_0x13b57a++){var _0x47ba34=_0x32074c[_0x13b57a]['Agent'][_0x6196('0x61')];if(_0x47ba34)io['to'](util[_0x6196('0x44')]('user:%s',_0x47ba34))[_0x6196('0x116')](_0x6196('0x14c'),{'hopper':_0x32074c[_0x13b57a]});}})[_0x6196('0x9d')](function(){});};Dialer[_0x6196('0x18')]['launchHandleIvr']=function(_0x21128d){var _0x44d4e0=this;return function(){_0x44d4e0['handleIvr'](_0x21128d);};};Dialer[_0x6196('0x18')][_0x6196('0x15a')]=function(_0x269caf,_0xe4c036){var _0x4920d9=this;var _0x42aa87=uuid['v4']();this['actions'][_0x42aa87]=new Action(_0x269caf,_0xe4c036,_0x42aa87);return new Promise(function(_0x4cac39,_0x51f52e){if(_[_0x6196('0x41')](_0x269caf)&&typeof _0x269caf!==_0x6196('0x15b')){return _0x51f52e(msgResponse(_0x6196('0x15c'),_0x6196('0x8f'),_0x6196('0x15d')));}if(_[_0x6196('0x41')](_0xe4c036['phone'])||_0xe4c036[_0x6196('0x15e')]===null){return _0x51f52e(msgResponse(_0x6196('0x15c'),_0x6196('0x8f'),_0x6196('0x15f')));}var _0x447b4f={'XMD-CALLERID':_0x4920d9[_0x6196('0x23')][_0x42aa87][_0x6196('0x160')](),'XMD-AGI':_0x269caf[_0x6196('0x161')]?util[_0x6196('0x44')](_0x6196('0x162'),ipAgi,_0x269caf['dialQueueProject']):_0x6196('0x163'),'XMD-AGIAFTER':_0x269caf[_0x6196('0xc2')]?util[_0x6196('0x44')](_0x6196('0x162'),ipAgi,_0x269caf[_0x6196('0xc2')]):_0x6196('0x163'),'XMD-QUEUE':utils['isOutboundQueue'](_0x269caf)?util['format'](_0x6196('0x164'),_0x269caf[_0x6196('0x61')],_0x269caf[_0x6196('0x165')]||'',_0x269caf['dialAgiAfterHangupAgent']?'c':'',_0x269caf[_0x6196('0x166')]||0x3):_0x6196('0x163'),'XMD-CONTACTID':_0xe4c036[_0x6196('0xda')],'XMD-CDRTYPE':_0x6196('0x8'),'CALLERID(all)':_0x4920d9[_0x6196('0x23')][_0x42aa87]['getCaller'](),'XMD-AMD':_0x269caf['dialAMDActive']?_0x6196('0x13f'):_0x6196('0x163'),'XMD-DESTINATION':_0x6196('0x10e')};if(_0x269caf[_0x6196('0x10f')]){_0x447b4f[_0x6196('0x167')]=_0x269caf[_0x6196('0x168')]||0x9c4;_0x447b4f[_0x6196('0x169')]=_0x269caf[_0x6196('0x16a')]||0x5dc;_0x447b4f[_0x6196('0x16b')]=_0x269caf[_0x6196('0x16c')]||0x320;_0x447b4f[_0x6196('0x16d')]=_0x269caf[_0x6196('0x16e')]||0x1388;_0x447b4f[_0x6196('0x16f')]=_0x269caf[_0x6196('0x170')]||0x64;_0x447b4f[_0x6196('0x171')]=_0x269caf[_0x6196('0x172')]||0x32;_0x447b4f['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x269caf[_0x6196('0x173')]||0x3;_0x447b4f[_0x6196('0x174')]=_0x269caf[_0x6196('0x175')]||0x100;_0x447b4f[_0x6196('0x176')]=_0x269caf['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x6196('0x177')](_0x269caf)){_0x447b4f['XMD-VOICEQUEUEID']=_0xe4c036[_0x6196('0xdb')];}else{_0x447b4f[_0x6196('0x178')]=_0xe4c036[_0x6196('0xdc')];}var _0x414925=utils[_0x6196('0x179')](_0xe4c036[_0x6196('0x17a')]);Object[_0x6196('0x144')](_0x447b4f,_0x414925);var _0x303848=_0x4920d9[_0x6196('0x87')](_0x269caf[_0x6196('0x17b')])?utils[_0x6196('0x17c')](_0x269caf[_0x6196('0x17b')][_0x6196('0x17d')],_0x269caf['dialOriginateCallerIdName'],_0x269caf['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x6196('0x17e')](_0x269caf['dialOriginateCallerIdNumber'],_0x269caf['dialRandomLastDigitCallerIdNumber']):_0x269caf['dialOriginateCallerIdNumber']):utils[_0x6196('0x17c')](_[_0x6196('0xee')](_0x269caf['TrunkBackup'])?_0x269caf[_0x6196('0x17b')]['callerid']:_0x269caf[_0x6196('0x88')][_0x6196('0x17d')],_0x269caf[_0x6196('0x17f')],_0x269caf[_0x6196('0x180')]>0x0?utils['getCallerIdRandom'](_0x269caf[_0x6196('0x181')],_0x269caf[_0x6196('0x180')]):_0x269caf[_0x6196('0x181')]);if(_0x303848){_0x447b4f[_0x6196('0x182')]=_0x4920d9[_0x6196('0x23')][_0x42aa87]['originatecalleridname']=utils['extractCalleridName'](_0x303848);_0x447b4f[_0x6196('0x183')]=_0xe4c036['phone'];}_0x269caf['variables']=_0x447b4f;return ami[_0x6196('0x97')]({'actionid':_0x42aa87,'action':_0x6196('0x15c'),'channel':_0x4920d9[_0x6196('0x87')](_0x269caf['Trunk'])?util[_0x6196('0x44')]('SIP/%s/%s%s',_0x269caf[_0x6196('0x17b')][_0x6196('0x61')],isNotNull(_0x269caf['dialPrefix'])?_0x269caf[_0x6196('0x184')]['trim']()||'':'',_0x269caf[_0x6196('0x185')]>0x0?_0xe4c036[_0x6196('0x15e')][_0x6196('0x186')](_0x269caf['dialCutDigit']):_0xe4c036[_0x6196('0x15e')]):util[_0x6196('0x44')](_0x6196('0x187'),_[_0x6196('0xee')](_0x269caf['TrunkBackup'])?_0x269caf[_0x6196('0x17b')][_0x6196('0x61')]:_0x269caf[_0x6196('0x88')][_0x6196('0x61')],isNotNull(_0x269caf[_0x6196('0x184')])?_0x269caf[_0x6196('0x184')][_0x6196('0x188')]()||'':'',_0x269caf[_0x6196('0x185')]>0x0?_0xe4c036[_0x6196('0x15e')][_0x6196('0x186')](_0x269caf[_0x6196('0x185')]):_0xe4c036['phone']),'callerid':_0x303848,'Exten':_0x6196('0x10e'),'Context':'from-sip','Priority':'1','variable':_0x447b4f,'timeout':(_0x269caf[_0x6196('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x42aa87})[_0x6196('0x40')](function(_0x54a015){return _0x4cac39(_0x54a015);})[_0x6196('0x9d')](function(_0x4266d4){_0x269caf[_0x6196('0x18a')]+=0x1;var _0x58e91a=new History(_0x4920d9[_0x6196('0x23')][_0x42aa87]);logger[_0x6196('0x68')](util[_0x6196('0x44')](_0x6196('0x18b'),JSON['stringify'](_0x4266d4)));_0x58e91a['state']=0xe;_0x58e91a[_0x6196('0xcc')]='OriginateError';_0x58e91a[_0x6196('0xde')]=moment()[_0x6196('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x58e91a[_0x6196('0x6f')]=_0x58e91a[_0x6196('0xde')];hopperUtils[_0x6196('0xc3')](_0x58e91a)[_0x6196('0x9d')](loggerCatch(_0x6196('0x18c')));_0x4920d9['moveContactManagedDialer'](_0x58e91a)[_0x6196('0x9d')](loggerCatch(_0x6196('0x18c')))[_0x6196('0x1b')](function(){delete _0x4920d9[_0x6196('0x23')][_0x42aa87];return _0x51f52e(msgResponse('originate',_0x6196('0x18d'),_0x6196('0x18e')));});});});};Dialer[_0x6196('0x18')][_0x6196('0x18f')]=function(_0x19735e,_0x2ca1aa,_0x34f6d3){var _0x2072fd=new History(_0x2ca1aa);if(_0x2072fd[_0x6196('0x12a')]+_0x2072fd[_0x6196('0x121')]+_0x2072fd[_0x6196('0x122')]+_0x2072fd[_0x6196('0x123')]+_0x2072fd['countdropretry']+_0x2072fd[_0x6196('0xe7')]+_0x2072fd[_0x6196('0x11e')]+_0x2072fd[_0x6196('0x12b')]>=_0x34f6d3['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x19735e){case 0x3:if(_0x2072fd[_0x6196('0x122')]>=_0x34f6d3[_0x6196('0x190')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2072fd[_0x6196('0x122')]+=0x1,'scheduledat':moment()['add'](_0x34f6d3[_0x6196('0x191')],_0x6196('0xd9'))['format'](_0x6196('0xc0')),'ContactId':_0x2072fd[_0x6196('0xda')],'ListId':_0x2072fd[_0x6196('0xe9')],'VoiceQueueId':_0x2072fd[_0x6196('0xdb')]||undefined,'CampaignId':_0x2072fd[_0x6196('0xdc')]||undefined})['catch'](loggerCatch(_0x6196('0x192')));break;case 0x5:if(_0x2072fd['countbusyretry']>=_0x34f6d3[_0x6196('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x2072fd[_0x6196('0x12a')]+=0x1,'scheduledat':moment()['add'](_0x34f6d3[_0x6196('0x194')],_0x6196('0xd9'))['format'](_0x6196('0xc0')),'ContactId':_0x2072fd[_0x6196('0xda')],'ListId':_0x2072fd[_0x6196('0xe9')],'VoiceQueueId':_0x2072fd[_0x6196('0xdb')]||undefined,'CampaignId':_0x2072fd[_0x6196('0xdc')]||undefined})[_0x6196('0x9d')](loggerCatch(_0x6196('0x195')));break;case 0x8:if(_0x2072fd[_0x6196('0x121')]>=_0x34f6d3[_0x6196('0x196')]-0x1){return!![];}hopperUtils[_0x6196('0xf9')]({'active':![],'countcongestionretry':_0x2072fd[_0x6196('0x121')]+=0x1,'scheduledat':moment()[_0x6196('0xd8')](_0x34f6d3['dialCongestionRetryFrequency'],_0x6196('0xd9'))[_0x6196('0x44')](_0x6196('0xc0')),'ContactId':_0x2072fd[_0x6196('0xda')],'ListId':_0x2072fd['ListId'],'VoiceQueueId':_0x2072fd['VoiceQueueId']||undefined,'CampaignId':_0x2072fd[_0x6196('0xdc')]||undefined})[_0x6196('0x9d')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2072fd[_0x6196('0x123')]>=_0x34f6d3[_0x6196('0x197')]-0x1){return!![];}else{hopperUtils[_0x6196('0xf9')]({'active':![],'countnosuchnumberretry':_0x2072fd[_0x6196('0x123')]+=0x1,'scheduledat':moment()['add'](_0x34f6d3[_0x6196('0x198')],'minutes')[_0x6196('0x44')](_0x6196('0xc0')),'ContactId':_0x2072fd['ContactId'],'ListId':_0x2072fd[_0x6196('0xe9')],'VoiceQueueId':_0x2072fd[_0x6196('0xdb')]||undefined,'CampaignId':_0x2072fd[_0x6196('0xdc')]||undefined})[_0x6196('0x9d')](loggerCatch(_0x6196('0x199')));}break;case 0xa:if(_0x2072fd['countdropretry']>=_0x34f6d3['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x6196('0xf9')]({'active':![],'countdropretry':_0x2072fd[_0x6196('0xd6')]+=0x1,'scheduledat':moment()[_0x6196('0xd8')](_0x34f6d3[_0x6196('0xd2')],_0x6196('0xd9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2072fd['ContactId'],'ListId':_0x2072fd[_0x6196('0xe9')],'VoiceQueueId':_0x2072fd['VoiceQueueId']||undefined,'CampaignId':_0x2072fd[_0x6196('0xdc')]||undefined})[_0x6196('0x9d')](loggerCatch(_0x6196('0xdd')));break;case 0xb:if(_0x2072fd['countabandonedretry']>=_0x34f6d3['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2072fd[_0x6196('0xe7')]+=0x1,'scheduledat':moment()[_0x6196('0xd8')](_0x34f6d3['dialAbandonedRetryFrequency'],'minutes')[_0x6196('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2072fd[_0x6196('0xda')],'ListId':_0x2072fd[_0x6196('0xe9')],'VoiceQueueId':_0x2072fd[_0x6196('0xdb')]||undefined,'CampaignId':_0x2072fd[_0x6196('0xdc')]||undefined})['catch'](loggerCatch(_0x6196('0x19a')));break;case 0x13:if(_0x2072fd[_0x6196('0x11e')]>=_0x34f6d3[_0x6196('0x12d')]-0x1){return!![];}hopperUtils[_0x6196('0xf9')]({'active':![],'countmachineretry':_0x2072fd[_0x6196('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x34f6d3['dialMachineRetryFrequency'],_0x6196('0xd9'))[_0x6196('0x44')](_0x6196('0xc0')),'ContactId':_0x2072fd['ContactId'],'ListId':_0x2072fd[_0x6196('0xe9')],'VoiceQueueId':_0x2072fd[_0x6196('0xdb')]||undefined,'CampaignId':_0x2072fd[_0x6196('0xdc')]||undefined})['catch'](loggerCatch(_0x6196('0x127')));break;case 0x14:if(_0x2072fd[_0x6196('0x12b')]>=_0x34f6d3[_0x6196('0x19b')]-0x1){return!![];}hopperUtils[_0x6196('0xf9')]({'active':![],'countagentrejectretry':_0x2072fd['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x6196('0xd8')](_0x34f6d3[_0x6196('0x19c')],_0x6196('0xd9'))[_0x6196('0x44')](_0x6196('0xc0')),'ContactId':_0x2072fd[_0x6196('0xda')],'ListId':_0x2072fd[_0x6196('0xe9')],'VoiceQueueId':_0x2072fd[_0x6196('0xdb')]||undefined,'CampaignId':_0x2072fd[_0x6196('0xdc')]||undefined})[_0x6196('0x9d')](loggerCatch(_0x6196('0x19d')));break;default:return!![];}};Dialer[_0x6196('0x18')][_0x6196('0x19e')]=function(_0x1e3927,_0x571476,_0x2264c2){var _0x266124=this;var _0x4c17ae=new History(_0x1e3927);var _0x52f02c=![];var _0x431b77;var _0x465f97;return new Promise(function(_0x418803,_0x285c6b){if(_['isUndefined'](_0x571476)&&typeof _0x571476!=='object'){return _0x285c6b(msgResponse(_0x6196('0x19f'),_0x6196('0x8f'),_0x6196('0x1a0')));}if(_[_0x6196('0x41')](_0x2264c2)&&typeof _0x2264c2!==_0x6196('0x15b')){return _0x285c6b(msgResponse(_0x6196('0x19f'),'Failure',_0x6196('0x1a1')));}hopperUtils[_0x6196('0xd3')](_0x4c17ae,_0x2264c2[_0x6196('0x1a2')],_0x571476)[_0x6196('0x40')](function(_0x6261fc){if(_0x6261fc[_0x6196('0xd5')]==0x1)_0x52f02c=!![];switch(_0x2264c2['reason']){case'0':_0x571476[_0x6196('0x1a3')]+=0x1;_0x4c17ae[_0x6196('0x6e')]=0x0;_0x4c17ae[_0x6196('0xcc')]=_0x6196('0x1a4');_0x4c17ae[_0x6196('0x123')]+=0x1;_0x4c17ae['countglobal']+=0x1;ami['emit'](_0x6196('0x1a5'),ut[_0x6196('0x118')](_0x1e3927,'nosuchnumber'));_0x431b77=_0x571476['dialNoSuchNumberRetryFrequency'];_0x465f97=_0x571476[_0x6196('0xe6')];hopperUtils['createHistory'](_0x4c17ae)[_0x6196('0x9d')](loggerCatch(_0x6196('0x120')));if(_0x266124[_0x6196('0x18f')](0x0,_0x1e3927,_0x571476)&&!_0x52f02c){if(_0x4c17ae['countnosuchnumberretry']>=_0x571476['dialNoSuchNumberMaxRetry']){_0x266124[_0x6196('0x126')](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1a6'));}else{_0x266124[_0x6196('0x124')](_0x4c17ae,_0x418803,_0x285c6b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x571476[_0x6196('0x1a7')]+=0x1;_0x4c17ae[_0x6196('0x6e')]=0x3;_0x4c17ae[_0x6196('0xcc')]=_0x6196('0x1a8');_0x4c17ae[_0x6196('0x122')]+=0x1;_0x4c17ae['countglobal']+=0x1;var _0x2521bb=ut[_0x6196('0x1a9')](_0x1e3927,_0x571476);ami[_0x6196('0x116')](_0x6196('0x1aa'),_0x2521bb);_0x431b77=_0x571476[_0x6196('0x191')];_0x465f97=_0x571476['callAdditionalPhoneAfterMin'];hopperUtils[_0x6196('0xc3')](_0x4c17ae)[_0x6196('0x9d')](loggerCatch(_0x6196('0x1ab')));if(_0x266124[_0x6196('0x18f')](0x3,_0x1e3927,_0x571476)&&!_0x52f02c){if(_0x4c17ae[_0x6196('0x122')]>=_0x571476[_0x6196('0x190')]){_0x266124[_0x6196('0x126')](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1ac'));}else{_0x266124[_0x6196('0x124')](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1ac'));}}break;case'5':_0x571476[_0x6196('0x1ad')]+=0x1;_0x4c17ae[_0x6196('0x6e')]=0x5;_0x4c17ae['statedesc']=_0x6196('0x1ae');_0x4c17ae['countbusyretry']+=0x1;_0x4c17ae['countglobal']+=0x1;ami['emit'](_0x6196('0x1af'),ut[_0x6196('0x118')](_0x1e3927,_0x6196('0x1b0')));_0x431b77=_0x571476['dialBusyRetryFrequency'];_0x465f97=_0x571476[_0x6196('0xe6')];hopperUtils[_0x6196('0xc3')](_0x4c17ae)[_0x6196('0x9d')](loggerCatch(_0x6196('0x1b1')));if(_0x266124['checkRetriveMax'](0x5,_0x1e3927,_0x571476)&&!_0x52f02c){if(_0x4c17ae[_0x6196('0x12a')]>=_0x571476[_0x6196('0x193')]){_0x266124[_0x6196('0x126')](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1b2'));}else{_0x266124[_0x6196('0x124')](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1b2'));}}break;case'8':_0x571476[_0x6196('0x1b3')]+=0x1;_0x4c17ae[_0x6196('0x6e')]=0x8;_0x4c17ae[_0x6196('0xcc')]=_0x6196('0x1b4');_0x4c17ae[_0x6196('0x121')]+=0x1;_0x4c17ae[_0x6196('0xd1')]+=0x1;_0x431b77=_0x571476['dialCongestionRetryFrequency'];_0x465f97=_0x571476['callAdditionalPhoneAfterMin'];ami['emit'](_0x6196('0x1b5'),ut['buildObj'](_0x1e3927,_0x6196('0x1b6')));hopperUtils[_0x6196('0xc3')](_0x4c17ae)[_0x6196('0x9d')](loggerCatch(_0x6196('0x1b7')));if(_0x266124[_0x6196('0x18f')](0x8,_0x1e3927,_0x571476)&&!_0x52f02c){if(_0x4c17ae[_0x6196('0x121')]>=_0x571476[_0x6196('0x196')]){_0x266124[_0x6196('0x126')](_0x4c17ae,_0x418803,_0x285c6b,'reason\x208\x20congestion');}else{_0x266124[_0x6196('0x124')](_0x4c17ae,_0x418803,_0x285c6b,'reason\x208\x20congestion');}}break;case'11':_0x571476[_0x6196('0x1b8')]+=0x1;_0x4c17ae[_0x6196('0x6e')]=0xb;_0x4c17ae[_0x6196('0xcc')]=_0x6196('0xe3');_0x4c17ae[_0x6196('0xe7')]+=0x1;_0x4c17ae[_0x6196('0xd1')]+=0x1;_0x431b77=_0x571476[_0x6196('0xe5')];_0x465f97=_0x571476[_0x6196('0xe6')];hopperUtils[_0x6196('0xc3')](_0x4c17ae)[_0x6196('0x9d')](loggerCatch(_0x6196('0x1b9')));if(_0x266124[_0x6196('0x18f')](0xb,_0x1e3927,_0x571476)&&!_0x52f02c){if(_0x4c17ae['countabandonedretry']>=_0x571476[_0x6196('0xe8')]){_0x266124['createStateFinal'](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1ba'));}else{_0x266124[_0x6196('0x124')](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1ba'));}}break;case'20':_0x571476[_0x6196('0x1bb')]+=0x1;_0x4c17ae[_0x6196('0x6e')]=0x14;_0x4c17ae[_0x6196('0xcc')]=_0x6196('0x1bc');_0x4c17ae['countagentrejectretry']+=0x1;_0x4c17ae[_0x6196('0xd1')]+=0x1;_0x431b77=_0x571476[_0x6196('0x19c')];_0x465f97=_0x571476[_0x6196('0xe6')];ami[_0x6196('0x116')]('custom:agentreject',ut[_0x6196('0x118')](_0x1e3927,'agentreject'));hopperUtils[_0x6196('0xc3')](_0x4c17ae)[_0x6196('0x9d')](loggerCatch(_0x6196('0x1bd')));if(_0x266124[_0x6196('0x18f')](0x14,_0x1e3927,_0x571476)&&!_0x52f02c){if(_0x4c17ae[_0x6196('0x12b')]>=_0x571476['dialAgentRejectMaxRetry']){_0x266124[_0x6196('0x126')](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1be'));}else{_0x266124[_0x6196('0x124')](_0x4c17ae,_0x418803,_0x285c6b,_0x6196('0x1be'));}}break;default:_0x571476[_0x6196('0x135')]+=0x1;_0x4c17ae[_0x6196('0x6e')]=0xc;_0x4c17ae['statedesc']=_0x2264c2[_0x6196('0x1a2')];_0x431b77=_0x571476[_0x6196('0x19c')];_0x465f97=_0x571476['callAdditionalPhoneAfterMin'];hopperUtils[_0x6196('0xc3')](_0x4c17ae)[_0x6196('0x9d')](loggerCatch(_0x6196('0x1bf')));if(_0x266124[_0x6196('0x18f')](_0x2264c2['reason'],_0x1e3927,_0x571476)&&!_0x52f02c){if(_0x4c17ae[_0x6196('0x12a')]+_0x4c17ae['countcongestionretry']+_0x4c17ae[_0x6196('0x122')]+_0x4c17ae[_0x6196('0x123')]+_0x4c17ae['countdropretry']+_0x4c17ae['countabandonedretry']+_0x4c17ae['countmachineretry']+_0x4c17ae['countagentrejectretry']>=_0x571476[_0x6196('0x12c')]){_0x266124[_0x6196('0x124')](_0x4c17ae,_0x418803,_0x285c6b,_0x2264c2[_0x6196('0x1a2')]);}else{_0x266124['createStateFinal'](_0x4c17ae,_0x418803,_0x285c6b,_0x2264c2[_0x6196('0x1a2')]);}}}})['then'](function(){if(_0x52f02c){hopperUtils[_0x6196('0xea')](_0x4c17ae,_0x431b77,_0x465f97)[_0x6196('0x40')](function(){return _0x418803(0x1);});}});});};Dialer[_0x6196('0x18')][_0x6196('0x124')]=function(_0x3512e6,_0x29949e,_0x3c2545,_0x423c8c){var _0x30f8f8=new Final(_0x3512e6);_0x30f8f8[_0x6196('0x6e')]=0xf;_0x30f8f8[_0x6196('0xcc')]='Global';this[_0x6196('0x126')](_0x30f8f8,_0x29949e,_0x3c2545,_0x423c8c);};Dialer[_0x6196('0x18')]['createStateFinal']=function(_0xbb20f7,_0x235a31,_0x32c6da,_0x2c84ae){hopperUtils[_0x6196('0xc5')](_0xbb20f7)['then'](function(){return _0x235a31(msgResponse(_0x6196('0x19f'),'Success',_0x2c84ae));})[_0x6196('0x9d')](function(){return _0x32c6da(msgResponse('[moveContactManagedDialer][0]',_0x6196('0x8f'),_0x6196('0x1c0')));});};Dialer[_0x6196('0x18')][_0x6196('0xa')]=function(_0x41fbf3){var _0x474e2b=_0x41fbf3[_0x6196('0x1c1')]/0x64;var _0x116af1=_0x41fbf3[_0x6196('0xcb')]/(_0x41fbf3[_0x6196('0xcb')]+_0x41fbf3[_0x6196('0xc1')]);var _0x39b32f=Math[_0x6196('0x1c2')](_0x41fbf3[_0x6196('0x1c3')]*(_0x41fbf3[_0x6196('0x1c4')]/0x64));var _0x511b78=Math['round'](_0x41fbf3[_0x6196('0x1c3')]*(_0x41fbf3[_0x6196('0x1c5')]/0x64));var _0xa9679d=_0x41fbf3['available']+_0x41fbf3[_0x6196('0x13d')];var _0x5e539e=Math[_0x6196('0x1c6')](_0x41fbf3[_0x6196('0x59')]*_0x41fbf3[_0x6196('0x5d')]*_0x41fbf3[_0x6196('0x1c7')]*_0x41fbf3[_0x6196('0x1c8')]);if(_[_0x6196('0x41')](_0x41fbf3[_0x6196('0x27')])){if(!_[_0x6196('0x41')](_0x41fbf3[_0x6196('0x63')])){_0x41fbf3[_0x6196('0x63')]=undefined;loggerPredictive['error'](_0x6196('0x1c9'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x41fbf3[_0x6196('0x65')])){loggerPredictive[_0x6196('0x68')](_0x6196('0x1c9'),_0x6196('0x1ca'));clearInterval(_0x41fbf3[_0x6196('0x65')]);_0x41fbf3['handlePredictive']=undefined;}_0x41fbf3['startProgressive']=moment()[_0x6196('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x6196('0x47')](_0x41fbf3[_0x6196('0x61')],_0x6196('0x1cb'),_0x41fbf3['startProgressive']);this[_0x6196('0xb0')](_0x41fbf3,0x1);}else if(ifInterval(_0x41fbf3[_0x6196('0x1cc')],_0x41fbf3['startProgressive'])){this[_0x6196('0xb0')](_0x41fbf3,0x1);loggerPredictiveCalls['info'](_0x6196('0x1cd'),_0x41fbf3[_0x6196('0x27')],_0x41fbf3[_0x6196('0x61')]);_0x41fbf3[_0x6196('0x59')]=0x0;_0x41fbf3[_0x6196('0x1ce')]=0x0;}else if(_0x474e2b<_0x116af1&&_0x41fbf3[_0x6196('0x1cf')]==='dropRate'){clearPredictiveAttributes(_0x41fbf3);loggerPredictive[_0x6196('0x47')](_0x6196('0x1d0'),_0x6196('0x1d1'),_0x116af1,_0x6196('0x27'),_0x41fbf3[_0x6196('0x61')]);}else if(_0x5e539e<_0x41fbf3[_0x6196('0x1ce')]&&_0x41fbf3[_0x6196('0x1cf')]===_0x6196('0x1d2')){clearPredictiveAttributes(_0x41fbf3);loggerPredictive[_0x6196('0x47')](_0x6196('0x1d3'),_0x6196('0x1d4'),_0x5e539e,_0x6196('0x1d5'),_0x41fbf3[_0x6196('0x1ce')],_0x6196('0x27'),_0x41fbf3[_0x6196('0x61')]);}else if(!ifInterval(_0x41fbf3['dialPredictiveInterval'],_0x41fbf3['startProgressive'])&&_[_0x6196('0x41')](_0x41fbf3[_0x6196('0x63')])&&!_[_0x6196('0x41')](_0x41fbf3[_0x6196('0x27')])){_0x41fbf3['startPredictive']=moment()[_0x6196('0x44')](_0x6196('0xc0'));loggerPredictive['info'](_0x41fbf3[_0x6196('0x61')],'started\x20in\x20predictive\x20at',_0x41fbf3['startPredictive']);hopperUtils[_0x6196('0x1d6')](_0x41fbf3[_0x6196('0x1cc')])[_0x6196('0x40')](this[_0x6196('0x1d7')](_0x41fbf3))[_0x6196('0x40')](mergeDataErlangB(_0x41fbf3))[_0x6196('0x40')](this[_0x6196('0x1d8')](_0x41fbf3))[_0x6196('0x9d')](loggerCatchPredictive(_0x6196('0x1d9'),_0x41fbf3));}else if(!ifInterval(_0x41fbf3[_0x6196('0x1cc')],_0x41fbf3[_0x6196('0x63')])){_0x41fbf3[_0x6196('0x1ce')]=0x0;_0x41fbf3[_0x6196('0x63')]=moment()[_0x6196('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x6196('0x47')](_0x41fbf3[_0x6196('0x61')],_0x6196('0x1da'),_0x41fbf3['startPredictive']);clearInterval(_0x41fbf3[_0x6196('0x65')]);_0x41fbf3[_0x6196('0x65')]=undefined;hopperUtils[_0x6196('0x1d6')](_0x41fbf3['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x41fbf3))[_0x6196('0x40')](mergeDataErlangB(_0x41fbf3))[_0x6196('0x40')](this[_0x6196('0x1d8')](_0x41fbf3))[_0x6196('0x9d')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x41fbf3));}else if(_0x41fbf3[_0x6196('0x1c3')]&&_0xa9679d<_0x41fbf3['predictiveIntervalAvailable']-_0x511b78){clearPredictiveAttributes(_0x41fbf3);loggerPredictive[_0x6196('0x47')](_0x41fbf3[_0x6196('0x61')],_0x6196('0x1db'),_0xa9679d,_0x6196('0x1dc'),_0x41fbf3[_0x6196('0x1c3')],'-',_0x511b78,'=',_0x41fbf3['predictiveIntervalAvailable']-_0x511b78,')');}else if(_0x41fbf3[_0x6196('0x1c3')]&&_0xa9679d>_0x41fbf3[_0x6196('0x1c3')]+_0x39b32f){clearPredictiveAttributes(_0x41fbf3);loggerPredictive['info'](_0x41fbf3[_0x6196('0x61')],_0x6196('0x1db'),_0xa9679d,_0x6196('0x1dd'),_0x41fbf3[_0x6196('0x1c3')],'+',_0x39b32f,'=',_0x41fbf3[_0x6196('0x1c3')]+_0x39b32f,')');}};Dialer[_0x6196('0x18')][_0x6196('0x1d7')]=function(_0x6abc67){var _0x169a00=this;return function(_0x44934f){return new Promise(function(_0x4aeee0,_0x1d496a){_[_0x6196('0x5f')](_0x6abc67,_0x44934f[0x0]);if(checkGetDataPredictive(_0x44934f[0x0])){var _0xb9af1=_0x6abc67[_0x6196('0x1c3')]=_0x6abc67[_0x6196('0x13d')]+_0x6abc67[_0x6196('0x13b')];var _0x1bfa26=_0x6abc67[_0x6196('0x1cc')]*0x3c;var _0x2c0b20=_0x44934f[0x0]['predictiveIntervalAvgTalktime']+_0x44934f[0x0][_0x6196('0x50')];var _0x298a36=(_0x44934f[0x0]['predictiveIntervalAnsweredCalls']+_0x44934f[0x0][_0x6196('0x4d')]+_0x44934f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x44934f[0x0][_0x6196('0x4a')];_0x6abc67['predictiveIntervalHitRate']=_0x298a36>0x0?_0x298a36:0x1;switch(_0x6abc67[_0x6196('0x1cf')]){case'dropRate':var _0xe0766d=_0x6abc67[_0x6196('0x1c1')]/0x64;return _0x169a00[_0x6196('0x1de')](_0xb9af1,_0x1bfa26,_0x2c0b20,_0x298a36,_0xe0766d)[_0x6196('0x40')](function(_0x542b64){return _0x4aeee0(_0x542b64);});case _0x6196('0x1df'):var _0x24f224=_0x6abc67[_0x6196('0x1c1')]/0x64;return _0x169a00[_0x6196('0x1e0')](_0xb9af1,_0x1bfa26,_0x2c0b20,_0x298a36,_0x24f224)[_0x6196('0x40')](function(_0x135a44){return _0x4aeee0(_0x135a44);});default:return _0x1d496a(msgResponse(_0x6196('0x1e1'),_0x6196('0x8f'),_0x6196('0x1e2')));}}else{return _0x1d496a(msgResponse(_0x6196('0x1e1'),_0x6196('0x8f'),_0x6196('0x1e3')));}});};};Dialer['prototype'][_0x6196('0x1e4')]=function(_0x500372){var _0x4b3bf5=this;return function(_0xcf45a5){return new Promise(function(_0x54928c,_0x282d1c){_[_0x6196('0x5f')](_0x500372,_0xcf45a5[0x0]);if(checkGetDataPredictive(_0xcf45a5[0x0])){loggerPredictive[_0x6196('0x47')](JSON[_0x6196('0x73')](_0xcf45a5[0x0]));if(_0x500372[_0x6196('0x1cf')]===_0x6196('0x1d2')){return _0x4b3bf5[_0x6196('0x154')](_0x500372['id'])[_0x6196('0x40')](function(_0x146c07){var _0x303254=_0x500372['loggedIn']-_0x146c07[0x0][_0x6196('0x1e5')];var _0x39224e=_0x500372[_0x6196('0x1cc')]*0x3c;var _0x52ac9d=_0xcf45a5[0x0][_0x6196('0x52')]+_0xcf45a5[0x0][_0x6196('0x50')];var _0x31eb0a=(_0xcf45a5[0x0][_0x6196('0x4c')]+_0xcf45a5[0x0][_0x6196('0x4d')]+_0xcf45a5[0x0][_0x6196('0xe2')])/_0xcf45a5[0x0]['predictiveIntervalTotalCalls'];var _0x22ae12=_0x500372[_0x6196('0x1c1')]/0x64;_0x500372[_0x6196('0x1e6')]=_0x146c07[0x0][_0x6196('0x1e5')]||0x0;_0x500372[_0x6196('0x1c7')]=_0x31eb0a>0x0?_0x31eb0a:0x1;return _0x4b3bf5[_0x6196('0x1de')](_0x303254,_0x39224e,_0x52ac9d,_0x31eb0a,_0x22ae12);})[_0x6196('0x40')](function(_0x3b9fd4){return _0x54928c(_0x3b9fd4);})[_0x6196('0x9d')](function(_0x2f0b64){return _0x282d1c(msgResponse(_0x6196('0x1e7'),_0x6196('0x8f'),JSON['stringify'](_0x2f0b64)));});}if(_0x500372[_0x6196('0x1cf')]==='agentBusyFactor'){return _0x4b3bf5[_0x6196('0x154')](_0x500372['id'])['then'](function(_0xdd169a){var _0x26b5f9=_0x500372[_0x6196('0x1e8')]-_0xdd169a[0x0][_0x6196('0x1e5')];var _0x1ea942=_0x500372['dialPredictiveInterval']*0x3c;var _0x58946b=_0xcf45a5[0x0][_0x6196('0x52')]+_0xcf45a5[0x0][_0x6196('0x50')];var _0x4e8455=(_0xcf45a5[0x0][_0x6196('0x4c')]+_0xcf45a5[0x0][_0x6196('0x4d')]+_0xcf45a5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xcf45a5[0x0][_0x6196('0x4a')];var _0x1cd53e=_0x500372[_0x6196('0x1c1')]/0x64;_0x500372['predictiveIntervalPauses']=_0xdd169a[0x0][_0x6196('0x1e5')]||0x0;_0x500372[_0x6196('0x1c7')]=_0x4e8455>0x0?_0x4e8455:0x1;return _0x4b3bf5[_0x6196('0x1e0')](_0x26b5f9,_0x1ea942,_0x58946b,_0x4e8455,_0x1cd53e);})[_0x6196('0x40')](function(_0x2d6203){return _0x54928c(_0x2d6203);})[_0x6196('0x9d')](function(_0x60410a){return _0x282d1c(msgResponse(_0x6196('0x1e7'),_0x6196('0x8f'),JSON[_0x6196('0x73')](_0x60410a)));});}}else{return _0x282d1c(msgResponse(_0x6196('0x1e1'),_0x6196('0x8f'),_0x6196('0x1e3')));}});};};Dialer[_0x6196('0x18')]['startMethodPredictive']=function(_0xb7885a){var _0x65d714=this;return function(){var _0x24f69f=0x0;var _0x5e4a91=Math[_0x6196('0x1c6')](_0xb7885a[_0x6196('0x5b')]*0x3e8);if(_0x5e4a91>0x0){_0x5e4a91=_0x5e4a91<0x64?0x64:_0x5e4a91;loggerPredictive['info'](_0xb7885a['name'],'one\x20call\x20every:',_0x5e4a91,_0x6196('0x1e9'));_0xb7885a[_0x6196('0x65')]=setInterval(function(){_0x65d714[_0x6196('0x65')](_0xb7885a);loggerPredictiveCalls[_0x6196('0x47')](_0x6196('0x1ea'),_0x24f69f+=0x1);},_0x5e4a91);}else{loggerPredictive[_0x6196('0x47')](_0xb7885a[_0x6196('0x61')],_0x6196('0x1eb'));}};};Dialer['prototype'][_0x6196('0x1ec')]=function(_0x3bcebb,_0x3441d7){var _0x54a513=this;return function(_0x5ba7eb){if(_[_0x6196('0x46')](_0x5ba7eb)){if(_[_0x6196('0xee')](_0x3441d7[_0x6196('0x157')])||!_0x3441d7['recallme']){if(_0x3bcebb['dialMethod']===_0x6196('0x9')){_0x3bcebb[_0x6196('0x70')]=_[_0x6196('0x41')](_0x3bcebb['queueStatusComplete'])?!![]:_0x3bcebb[_0x6196('0x70')];var _0x1dc5a2=uuid['v4']();_0x54a513[_0x6196('0x23')][_0x1dc5a2]=new Action(_0x3bcebb,_0x3441d7,_0x1dc5a2);loggerBooked['info'](_0x6196('0x1ed'),_0x1dc5a2,_0x6196('0x1ee'),JSON['stringify'](_0x3bcebb['queueStatusComplete']),_0x6196('0x1ef'),_0x3bcebb[_0x6196('0x61')]);if(_0x3bcebb[_0x6196('0x70')]){_0x3bcebb[_0x6196('0x70')]=![];_0x54a513[_0x6196('0x29')][_0x54a513[_0x6196('0x23')][_0x1dc5a2]['queue']]=[];ami[_0x6196('0x97')]({'actionid':_0x1dc5a2,'action':_0x6196('0x1f0'),'queue':_0x3bcebb['name']})[_0x6196('0x9d')](function(){utils[_0x6196('0xc7')](_0x3bcebb,_0x6196('0x1f1'));hopperUtils[_0x6196('0xf9')]({'active':![],'ContactId':_0x54a513[_0x6196('0x23')][_0x1dc5a2][_0x6196('0xda')],'ListId':_0x54a513[_0x6196('0x23')][_0x1dc5a2][_0x6196('0xe9')],'VoiceQueueId':_0x54a513[_0x6196('0x23')][_0x1dc5a2][_0x6196('0xdb')]||undefined,'CampaignId':_0x54a513[_0x6196('0x23')][_0x1dc5a2][_0x6196('0xdc')]||undefined})[_0x6196('0x9d')](loggerCatch(_0x6196('0x1f2')));delete _0x54a513[_0x6196('0x23')][_0x1dc5a2];});}else{loggerBooked[_0x6196('0x47')](_0x6196('0x1f3'),JSON['stringify'](_0x3bcebb[_0x6196('0x70')]),_0x6196('0x1ef'),_0x3bcebb[_0x6196('0x61')]);utils[_0x6196('0xc7')](_0x3bcebb,'[checkContactBlack]');hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x54a513[_0x6196('0x23')][_0x1dc5a2]['ContactId'],'ListId':_0x54a513[_0x6196('0x23')][_0x1dc5a2][_0x6196('0xe9')],'VoiceQueueId':_0x54a513[_0x6196('0x23')][_0x1dc5a2][_0x6196('0xdb')]||undefined,'CampaignId':_0x54a513[_0x6196('0x23')][_0x1dc5a2][_0x6196('0xdc')]||undefined})['catch'](loggerCatch(_0x6196('0x1f2')));delete _0x54a513[_0x6196('0x23')][_0x1dc5a2];}}else{return _0x54a513['actionOriginate'](_0x3bcebb,_0x3441d7);}}else{if(utils[_0x6196('0x60')](undefined,_0x3441d7[_0x6196('0x1f4')])<_0x3bcebb[_0x6196('0x1f5')]*0x3c){if(_0x3441d7[_0x6196('0x14a')]&&!_0x3441d7['Agent']['voicePause']){_0x54a513['preview'][_0x6196('0xf7')](_0x3441d7['id'])['finally'](function(){utils[_0x6196('0xc7')](_0x3bcebb,_0x6196('0x1f1'));});}else{hopperUtils[_0x6196('0x1f6')]({'active':![]},_0x3441d7['id'],0x1)[_0x6196('0x1b')](function(){utils[_0x6196('0xc7')](_0x3bcebb,_0x6196('0x1f1'));});}}else{_0x3bcebb['outboundReCallsDay']+=0x1;utils['decrementOriginate'](_0x3bcebb,_0x6196('0x1f1'));if(_0x3bcebb[_0x6196('0x1f7')]){hopperUtils[_0x6196('0xf9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3441d7[_0x6196('0xda')],'ListId':_0x3441d7[_0x6196('0xe9')],'VoiceQueueId':_0x3441d7[_0x6196('0xdb')]||undefined,'CampaignId':_0x3441d7[_0x6196('0xdc')]||undefined})['catch'](loggerCatch(_0x6196('0x1f8')));hopperUtils[_0x6196('0xc3')](createObjHistory(_0x3bcebb,_0x3441d7,utils[_0x6196('0x6a')][_0x6196('0x1f9')],0x17,_0x6196('0x1fa')))['catch'](loggerCatch(_0x6196('0x1fb')));}else{_0x54a513[_0x6196('0x119')](createObjHistory(_0x3bcebb,_0x3441d7,utils['CAMPAIGN_STATUS'][_0x6196('0x1fc')],0x16,_0x6196('0x1fd')),_0x6196('0x1fe'),'[Originate][HistoryRecallClose]');}}}}else{_0x3bcebb[_0x6196('0x1ff')]+=0x1;_0x54a513['saveInDb'](createObjHistory(_0x3bcebb,_0x3441d7,utils[_0x6196('0x6a')][_0x6196('0x200')],0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x6196('0x201'));throw'inBlackList';}};};Dialer['prototype'][_0x6196('0x202')]=function(_0x21df38){var _0x5b1a75=this;var _0x1ff65c=_0x21df38['limitCalls']-_0x21df38['originated'];emitCampaignSummary(_0x21df38);if(_0x1ff65c>0x0&&_0x21df38[_0x6196('0x203')]==0x0){if(_0x1ff65c>this['maxNumberOriginate']){_0x1ff65c=this[_0x6196('0x22')];}_0x21df38[_0x6196('0x203')]=0x1;hopperUtils[_0x6196('0x204')](_0x21df38,_0x1ff65c)[_0x6196('0x40')](function(_0x9cf98){_0x21df38['temp']=0x0;if(_0x9cf98){if(!utils[_0x6196('0x205')](_0x9cf98)){_0x21df38[_0x6196('0x6c')]=utils[_0x6196('0x6a')][_0x6196('0x206')];logger[_0x6196('0x47')](_0x6196('0x207')+_0x21df38[_0x6196('0x61')]);}else{_0x21df38[_0x6196('0x7c')]+=_0x9cf98[_0x6196('0x95')];_0x21df38['message']=utils[_0x6196('0x6a')][_0x6196('0x208')];for(var _0x4cfdcf=0x0;_0x4cfdcf<_0x9cf98[_0x6196('0x95')];_0x4cfdcf+=0x1){_0x21df38[_0x6196('0x209')]+=0x1;if(_[_0x6196('0xee')](_0x9cf98[_0x4cfdcf])||_[_0x6196('0xee')](_0x9cf98[_0x4cfdcf][_0x6196('0x17a')])||_[_0x6196('0xee')](_0x9cf98[_0x4cfdcf]['phone'])){_0x5b1a75[_0x6196('0x20a')](_0x6196('0x20b'),_0x21df38,_0x9cf98[_0x4cfdcf]);}else{hopperUtils[_0x6196('0x20c')](_[_0x6196('0xf1')](_0x9cf98[_0x4cfdcf],[_0x6196('0xdc'),_0x6196('0x15e')]))[_0x6196('0x40')](_0x5b1a75[_0x6196('0x1ec')](_0x21df38,_0x9cf98[_0x4cfdcf]))[_0x6196('0x9d')](function(_0x3a1680){logger['error'](_0x6196('0x20d'),_0x3a1680);utils['decrementOriginate'](_0x21df38,'[handleIvr]');});}}}}})[_0x6196('0x9d')](function(_0x429908){_0x21df38[_0x6196('0x203')]=0x0;logger[_0x6196('0x68')](_0x6196('0x20e'),_0x429908);});}};Dialer[_0x6196('0x18')][_0x6196('0xb0')]=function(_0x5683a4,_0x3b3a31){var _0x5be0b5=this;var _0x57ceb4=[];if(_0x3b3a31<0x1||_0x5683a4[_0x6196('0xaf')]==='booked'){_0x3b3a31=0x1;}var _0x5e059e=Math[_0x6196('0x1c6')](_0x5683a4['available']*_0x3b3a31)-_0x5683a4[_0x6196('0x7c')];if(_0x5683a4[_0x6196('0x20f')]>0x0){var _0x1e7fbf=_0x5683a4[_0x6196('0x20f')]-_0x5683a4['originated']-_0x5683a4[_0x6196('0x13d')]-_0x5683a4[_0x6196('0x13e')];if(_0x5e059e>_0x1e7fbf){_0x5e059e=_0x1e7fbf;}}if(_0x5e059e>0x0&&_0x5683a4['temp']==0x0){if(_0x5683a4['dialMethod']===_0x6196('0x9')){_0x5e059e=0x1;}if(_0x5e059e>this[_0x6196('0x22')]){_0x5e059e=this[_0x6196('0x22')];}for(var _0x58451e in this['agents']){if(typeof this['agents'][_0x58451e]!==_0x6196('0x151')){if(this[_0x6196('0x20')][_0x58451e][_0x6196('0x6e')]===_0x6196('0x210')&&this[_0x6196('0x20')][_0x58451e][_0x6196('0x84')]==='reachable'){_0x57ceb4['push'](this[_0x6196('0x20')][_0x58451e]['id']);}}}_0x5683a4[_0x6196('0x203')]=0x1;hopperUtils[_0x6196('0x211')](_0x5683a4,_0x57ceb4,_0x5e059e)['then'](function(_0x5513ce){_0x5683a4[_0x6196('0x203')]=0x0;if(_0x5513ce){if(!utils['checkContactEmpty'](_0x5513ce)){hopperUtils[_0x6196('0x212')](_0x5683a4)[_0x6196('0x40')](sendMessageReschedule(_0x5683a4))[_0x6196('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x5683a4[_0x6196('0x7c')]+=_0x5513ce[_0x6196('0x95')];_0x5683a4[_0x6196('0x6c')]=_0x5683a4[_0x6196('0xaf')]===_0x6196('0x9')?utils[_0x6196('0x6a')]['ACTIVE']:utils['CAMPAIGN_STATUS'][_0x6196('0x208')];for(var _0x2dd2ce=0x0;_0x2dd2ce<_0x5513ce['length'];_0x2dd2ce+=0x1){if(_[_0x6196('0xee')](_0x5513ce[_0x2dd2ce])||_[_0x6196('0xee')](_0x5513ce[_0x2dd2ce][_0x6196('0x17a')])||_[_0x6196('0xee')](_0x5513ce[_0x2dd2ce][_0x6196('0x15e')])){_0x5be0b5[_0x6196('0x20a')](_0x6196('0x20b'),_0x5683a4,_0x5513ce[_0x2dd2ce]);}else{hopperUtils[_0x6196('0x213')](_[_0x6196('0xf1')](_0x5513ce[_0x2dd2ce],[_0x6196('0xdb'),_0x6196('0x15e')]))[_0x6196('0x40')](_0x5be0b5[_0x6196('0x1ec')](_0x5683a4,_0x5513ce[_0x2dd2ce]))[_0x6196('0x9d')](function(_0x501ad8){logger[_0x6196('0x68')](_0x6196('0x214'),_0x501ad8);utils[_0x6196('0xc7')](_0x5683a4,_0x6196('0x215'));});}}}}})[_0x6196('0x9d')](function(_0x54e25c){_0x5683a4[_0x6196('0x203')]=0x0;logger['error'](_0x6196('0x20e'),_0x54e25c);});}};Dialer[_0x6196('0x18')][_0x6196('0x65')]=function(_0x38b415){if(_0x38b415[_0x6196('0x20f')]>0x0){var _0x1d06ce=_0x38b415['dialLimitQueue']-_0x38b415[_0x6196('0x7c')]-_0x38b415[_0x6196('0x13d')];if(_0x1d06ce>0x0&&_0x38b415[_0x6196('0x203')]==0x0){this['tryOriginatePredictive'](_0x38b415);}else{loggerPredictiveCalls[_0x6196('0x47')](_0x6196('0x216'));}}else{this[_0x6196('0x217')](_0x38b415);}};Dialer[_0x6196('0x18')][_0x6196('0x217')]=function(_0x519166){var _0x59a8ea=this;var _0x5c1462=[];_0x519166[_0x6196('0x7c')]+=0x1;for(var _0x10efcb in this['agents']){if(typeof this[_0x6196('0x20')][_0x10efcb]!==_0x6196('0x151')){if(this[_0x6196('0x20')][_0x10efcb][_0x6196('0x6e')]===_0x6196('0x210')&&this[_0x6196('0x20')][_0x10efcb]['status']==='reachable'){_0x5c1462['push'](this[_0x6196('0x20')][_0x10efcb]['id']);}}}_0x519166[_0x6196('0x203')]=0x1;return this[_0x6196('0x211')](_0x519166['id'],_0x5c1462,0x1,_0x519166['dialOrderByScheduledAt'],_0x519166)['then'](function(_0x289c65){_0x519166[_0x6196('0x203')]=0x1;if(_0x289c65){if(!utils[_0x6196('0x205')](_0x289c65)){utils[_0x6196('0x218')](_0x519166,0x1,0x0);return hopperUtils[_0x6196('0x212')](_0x519166)[_0x6196('0x40')](sendMessageReschedule(_0x519166))[_0x6196('0x9d')](loggerCatch(_0x6196('0x219')));}else{_0x519166['message']=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0x6196('0xee')](_0x289c65[0x0])||_[_0x6196('0xee')](_0x289c65[0x0][_0x6196('0x17a')])||_['isNil'](_0x289c65[0x0][_0x6196('0x15e')])){_0x59a8ea[_0x6196('0x20a')]('[actionOriginate]\x20',_0x519166,_0x289c65[0x0]);}else{return hopperUtils[_0x6196('0x213')](_[_0x6196('0xf1')](_0x289c65[0x0],['VoiceQueueId',_0x6196('0x15e')]))['then'](_0x59a8ea[_0x6196('0x1ec')](_0x519166,_0x289c65[0x0]))[_0x6196('0x9d')](function(_0x40cfb9){logger[_0x6196('0x68')]('[actionOriginatePredictive]',_0x40cfb9);utils[_0x6196('0xc7')](_0x519166,_0x6196('0x21a'));});}}}})[_0x6196('0x9d')](function(_0x424d6b){_0x519166[_0x6196('0x203')]=0x0;logger[_0x6196('0x68')](_0x6196('0x20e'),_0x424d6b);});};Dialer['prototype'][_0x6196('0x1de')]=function(_0xcc5e44,_0xd676b3,_0x102cba,_0x323b94,_0x3770a2,_0x2e1635){loggerPredictive[_0x6196('0x47')](_0x6196('0x21b'));loggerPredictive[_0x6196('0x47')](_0x6196('0x21c'),_0xcc5e44);loggerPredictive[_0x6196('0x47')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xd676b3);loggerPredictive[_0x6196('0x47')](_0x6196('0x21d'),_0x102cba);loggerPredictive[_0x6196('0x47')]('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',_0x323b94);loggerPredictive[_0x6196('0x47')](_0x6196('0x21e'),_0x3770a2);loggerPredictive['info'](_0x6196('0x53'));return new Promise(function(_0x575a79,_0xce58f7){if(_0xcc5e44<=0x0||isNaN(_0xcc5e44)){return _0xce58f7(msgResponse(_0x6196('0x21f'),'Error',_0x6196('0x220')+_0xcc5e44));}if(_0x102cba<=0x0||isNaN(_0x102cba)){return _0xce58f7(msgResponse(_0x6196('0x21f'),_0x6196('0x18d'),_0x6196('0x221')+_0x102cba));}if(_0x323b94<=0x0||isNaN(_0x323b94)){return _0xce58f7(msgResponse(_0x6196('0x21f'),_0x6196('0x18d'),_0x6196('0x222')+_0x323b94));}if(_0xd676b3<=0x0||isNaN(_0xd676b3)){return _0xce58f7(msgResponse(_0x6196('0x21f'),_0x6196('0x18d'),_0x6196('0x223')+_0xd676b3));}if(_0x3770a2<=0x0||isNaN(_0x3770a2)){return _0xce58f7(msgResponse(_0x6196('0x21f'),_0x6196('0x18d'),'Amax\x20=\x20'+_0x3770a2));}_0x2e1635=_0x2e1635||0x0;var _0x2d8a39=0x1/_0x102cba;var _0x2f87c8=0x0;var _0x563eaf=0x0;var _0x23b4be=0x0;var _0x31a89a=0x0;for(var _0x106e55=0x0;_0x23b4be<_0x3770a2;_0x106e55+=0x1){_0x563eaf=_0x106e55/_0xd676b3;_0x2f87c8=(_0x323b94*_0x563eaf+_0x2e1635)/_0x2d8a39;_0x23b4be=utils[_0x6196('0x224')](_0x2f87c8,_0xcc5e44);_0x31a89a=_0x2f87c8/_0xcc5e44*(0x1-utils['erlangb'](_0x2f87c8,_0xcc5e44));}return _0x575a79({'erlangCalls':_0x106e55,'erlangCallToSecond':_0xd676b3/_0x106e55,'erlangAbandonmentRate':_0x23b4be,'erlangBusyFactor':_0x31a89a});});};Dialer[_0x6196('0x18')][_0x6196('0x1e0')]=function(_0x322c11,_0x22c75b,_0x2fb34e,_0x3fc6eb,_0x33f437,_0x1e9d9a){loggerPredictive[_0x6196('0x47')](_0x6196('0x225'));loggerPredictive[_0x6196('0x47')]('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',_0x322c11);loggerPredictive['info'](_0x6196('0x226'),_0x22c75b);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2fb34e);loggerPredictive['info'](_0x6196('0x227'),_0x3fc6eb);loggerPredictive[_0x6196('0x47')](_0x6196('0x228'),_0x33f437);loggerPredictive['info'](_0x6196('0x53'));return new Promise(function(_0x6f01eb,_0x37eafe){if(_0x322c11<=0x0||isNaN(_0x322c11)){return _0x37eafe(msgResponse('[busyFactor]','Error',_0x6196('0x220')+_0x322c11));}if(_0x2fb34e<=0x0||isNaN(_0x2fb34e)){return _0x37eafe(msgResponse('[busyFactor]',_0x6196('0x18d'),_0x6196('0x221')+_0x2fb34e));}if(_0x3fc6eb<=0x0||isNaN(_0x3fc6eb)){return _0x37eafe(msgResponse(_0x6196('0x229'),'Error','p\x20=\x20'+_0x3fc6eb));}if(_0x22c75b<=0x0||isNaN(_0x22c75b)){return _0x37eafe(msgResponse('[busyFactor]',_0x6196('0x18d'),_0x6196('0x223')+_0x22c75b));}if(_0x33f437<=0x0||isNaN(_0x33f437)){return _0x37eafe(msgResponse('[busyFactor]',_0x6196('0x18d'),_0x6196('0x22a')+_0x33f437));}_0x1e9d9a=_0x1e9d9a||0x0;var _0x4a69d0=0x1/_0x2fb34e;var _0x19daa1=0x0;var _0x5f0dec=0x0;var _0x21883b=0x0;var _0x40559c=0x0;for(var _0x3e20ae=0x0;_0x40559c<_0x33f437;_0x3e20ae+=0x1){_0x5f0dec=_0x3e20ae/_0x22c75b;_0x19daa1=(_0x3fc6eb*_0x5f0dec+_0x1e9d9a)/_0x4a69d0;_0x21883b=utils[_0x6196('0x224')](_0x19daa1,_0x322c11);_0x40559c=_0x19daa1/_0x322c11*(0x1-utils['erlangb'](_0x19daa1,_0x322c11));}return _0x6f01eb({'erlangCalls':_0x3e20ae,'erlangCallToSecond':_0x22c75b/_0x3e20ae,'erlangAbandonmentRate':_0x21883b,'erlangBusyFactor':_0x40559c});});};module[_0x6196('0x22b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index b65e87e..dc7855a 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x721f=['phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','voiceQueue','dialCutDigit','substring','getQueue','lodash','moment','string','isNil','uniqueid','Contact','lastName','number'];(function(_0x1c7cb4,_0x268921){var _0x5bd55a=function(_0x1ef638){while(--_0x1ef638){_0x1c7cb4['push'](_0x1c7cb4['shift']());}};_0x5bd55a(++_0x268921);}(_0x721f,0x1cc));var _0xf721=function(_0x18f9f6,_0xd24ec2){_0x18f9f6=_0x18f9f6-0x0;var _0x1ba1a9=_0x721f[_0x18f9f6];return _0x1ba1a9;};'use strict';var util=require('util');var _=require(_0xf721('0x0'));var moment=require(_0xf721('0x1'));function checkNameSurname(_0x57959d,_0x27378c,_0x4138fe){var _0x35bea6='';if(!_['isNil'](_0x27378c)&&_0xf721('0x2')===typeof _0x27378c){_0x35bea6+=_0x27378c;}if(!_[_0xf721('0x3')](_0x4138fe)&&'string'===typeof _0x4138fe){_0x35bea6+='\x20'+_0x4138fe;}if(_0x35bea6!==''){return _0x35bea6;}return _0x57959d;}function Action(_0x3884d9,_0x6b2b3b,_0x33356c){this['voiceQueue']=_0x3884d9;this[_0xf721('0x4')]=_0x33356c||undefined;this['name']=checkNameSurname(_0x6b2b3b[_0xf721('0x5')]['phone'],_0x6b2b3b[_0xf721('0x5')]['firstName'],_0x6b2b3b[_0xf721('0x5')][_0xf721('0x6')]);this[_0xf721('0x7')]=_0x6b2b3b[_0xf721('0x8')];this[_0xf721('0x9')]=_0x3884d9[_0xf721('0xa')];this[_0xf721('0xb')]=_0x6b2b3b['active']||![];this[_0xf721('0xc')]=_0x3884d9['type'];this[_0xf721('0xd')]=_0x3884d9[_0xf721('0xd')]||0x3;this[_0xf721('0xe')]=_0x6b2b3b[_0xf721('0xe')];this['countbusyretry']=_0x6b2b3b[_0xf721('0xf')];this[_0xf721('0x10')]=_0x6b2b3b[_0xf721('0x10')];this['countnoanswerretry']=_0x6b2b3b['countnoanswerretry'];this[_0xf721('0x11')]=_0x6b2b3b['countnosuchnumberretry'];this[_0xf721('0x12')]=_0x6b2b3b[_0xf721('0x12')];this[_0xf721('0x13')]=_0x6b2b3b[_0xf721('0x13')];this['countmachineretry']=_0x6b2b3b['countmachineretry'];this[_0xf721('0x14')]=_0x6b2b3b[_0xf721('0x14')];this[_0xf721('0x15')]=_0x6b2b3b[_0xf721('0x15')];this[_0xf721('0x16')]=_0x6b2b3b[_0xf721('0x16')];this[_0xf721('0x17')]=_0x6b2b3b[_0xf721('0x17')];this[_0xf721('0x18')]=_0x6b2b3b[_0xf721('0x18')];this[_0xf721('0x19')]=_0x6b2b3b[_0xf721('0x19')];this[_0xf721('0x1a')]=_0x6b2b3b['id'];this['ContactFirstName']=_0x6b2b3b['Contact'][_0xf721('0x1b')]||'';this['starttime']=moment()[_0xf721('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf721('0x1d')]=_0x6b2b3b['callback'];this[_0xf721('0x1e')]=_0x6b2b3b[_0xf721('0x1e')];this['callbackat']=_0x6b2b3b[_0xf721('0x1f')];this['recallme']=_0x6b2b3b[_0xf721('0x20')];this[_0xf721('0x21')]='';this['originatecalleridname']='';}Action['prototype'][_0xf721('0x22')]=function(){return util[_0xf721('0x1c')]('\x22%s\x22\x20<%s>',this[_0xf721('0xa')],this[_0xf721('0x23')][_0xf721('0x24')]>0x0?this[_0xf721('0x7')][_0xf721('0x25')](this[_0xf721('0x23')][_0xf721('0x24')]):this[_0xf721('0x7')]);};Action['prototype'][_0xf721('0x26')]=function(){return this[_0xf721('0x9')];};module['exports']=Action; \ No newline at end of file +var _0xc2d5=['dialQueueTimeout','scheduledat','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','queue','util','lodash','moment','string','isNil','uniqueid','phone','Contact','firstName','lastName','name','active','type'];(function(_0x176325,_0x15c28f){var _0x50f643=function(_0x3eab20){while(--_0x3eab20){_0x176325['push'](_0x176325['shift']());}};_0x50f643(++_0x15c28f);}(_0xc2d5,0x1c1));var _0x5c2d=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xc2d5[_0x43d16c];return _0x208cce;};'use strict';var util=require(_0x5c2d('0x0'));var _=require(_0x5c2d('0x1'));var moment=require(_0x5c2d('0x2'));function checkNameSurname(_0x3bd33e,_0x4c1fe7,_0x586cce){var _0x3ca5e8='';if(!_['isNil'](_0x4c1fe7)&&_0x5c2d('0x3')===typeof _0x4c1fe7){_0x3ca5e8+=_0x4c1fe7;}if(!_[_0x5c2d('0x4')](_0x586cce)&&_0x5c2d('0x3')===typeof _0x586cce){_0x3ca5e8+='\x20'+_0x586cce;}if(_0x3ca5e8!==''){return _0x3ca5e8;}return _0x3bd33e;}function Action(_0x1a0201,_0x427c0a,_0x144d03){this['voiceQueue']=_0x1a0201;this[_0x5c2d('0x5')]=_0x144d03||undefined;this['name']=checkNameSurname(_0x427c0a['Contact'][_0x5c2d('0x6')],_0x427c0a[_0x5c2d('0x7')][_0x5c2d('0x8')],_0x427c0a['Contact'][_0x5c2d('0x9')]);this['number']=_0x427c0a[_0x5c2d('0x6')];this['queue']=_0x1a0201[_0x5c2d('0xa')];this['active']=_0x427c0a[_0x5c2d('0xb')]||![];this[_0x5c2d('0xc')]=_0x1a0201[_0x5c2d('0xc')];this['dialQueueTimeout']=_0x1a0201[_0x5c2d('0xd')]||0x3;this[_0x5c2d('0xe')]=_0x427c0a[_0x5c2d('0xe')];this['countbusyretry']=_0x427c0a['countbusyretry'];this['countcongestionretry']=_0x427c0a[_0x5c2d('0xf')];this['countnoanswerretry']=_0x427c0a['countnoanswerretry'];this[_0x5c2d('0x10')]=_0x427c0a['countnosuchnumberretry'];this['countdropretry']=_0x427c0a[_0x5c2d('0x11')];this[_0x5c2d('0x12')]=_0x427c0a['countabandonedretry'];this[_0x5c2d('0x13')]=_0x427c0a[_0x5c2d('0x13')];this[_0x5c2d('0x14')]=_0x427c0a[_0x5c2d('0x14')];this[_0x5c2d('0x15')]=_0x427c0a[_0x5c2d('0x15')];this[_0x5c2d('0x16')]=_0x427c0a[_0x5c2d('0x16')];this['UserId']=_0x427c0a[_0x5c2d('0x17')];this[_0x5c2d('0x18')]=_0x427c0a[_0x5c2d('0x18')];this[_0x5c2d('0x19')]=_0x427c0a['CampaignId'];this['idHopper']=_0x427c0a['id'];this[_0x5c2d('0x1a')]=_0x427c0a['Contact'][_0x5c2d('0x8')]||'';this[_0x5c2d('0x1b')]=moment()[_0x5c2d('0x1c')](_0x5c2d('0x1d'));this[_0x5c2d('0x1e')]=_0x427c0a[_0x5c2d('0x1e')];this['callbackuniqueid']=_0x427c0a[_0x5c2d('0x1f')];this[_0x5c2d('0x20')]=_0x427c0a['callbackat'];this[_0x5c2d('0x21')]=_0x427c0a['recallme'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x5c2d('0x22')]['getCaller']=function(){return util[_0x5c2d('0x1c')](_0x5c2d('0x23'),this['name'],this[_0x5c2d('0x24')][_0x5c2d('0x25')]>0x0?this[_0x5c2d('0x26')][_0x5c2d('0x27')](this['voiceQueue'][_0x5c2d('0x25')]):this[_0x5c2d('0x26')]);};Action[_0x5c2d('0x22')][_0x5c2d('0x28')]=function(){return this[_0x5c2d('0x29')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 044082a..480a7c5 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x583c=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime'];(function(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0x583c,0x12a));var _0xc583=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x583c[_0x1a9e78];return _0x113e06;};'use strict';var moment=require('moment');var utils=require(_0xc583('0x0'));function AgentComplete(_0x114df2,_0x3f9f8d){this[_0xc583('0x1')]=0x4;this[_0xc583('0x2')]=_0xc583('0x3');this[_0xc583('0x4')]=_0x114df2['scheduledat'];this[_0xc583('0x5')]=_0x114df2[_0xc583('0x5')];this[_0xc583('0x6')]=_0x114df2[_0xc583('0x5')]===_0xc583('0x7')?_0xc583('0x8'):_0x114df2['type'];this[_0xc583('0x9')]=_0x114df2[_0xc583('0x9')];this[_0xc583('0xa')]=_0x114df2['countcongestionretry'];this[_0xc583('0xb')]=_0x114df2[_0xc583('0xb')];this[_0xc583('0xc')]=_0x114df2['countbusyretry']+_0x114df2[_0xc583('0xa')]+_0x114df2[_0xc583('0xb')]+_0x114df2['countnosuchnumberretry']+_0x114df2[_0xc583('0xd')]+_0x114df2[_0xc583('0xe')]+_0x114df2['countmachineretry']+_0x114df2[_0xc583('0xf')];this[_0xc583('0x10')]=_0x114df2[_0xc583('0x10')];this[_0xc583('0xd')]=_0x114df2[_0xc583('0xd')];this[_0xc583('0xe')]=_0x114df2['countabandonedretry'];this['countmachineretry']=_0x114df2[_0xc583('0x11')];this[_0xc583('0xf')]=_0x114df2[_0xc583('0xf')];this['uniqueid']=_0x3f9f8d[_0xc583('0x12')];this[_0xc583('0x13')]=_0x114df2['name'];this[_0xc583('0x14')]=_0x114df2['number'];this[_0xc583('0x15')]=_0x114df2[_0xc583('0x15')];this[_0xc583('0x16')]=_0x114df2[_0xc583('0x16')];this[_0xc583('0x17')]=_0x114df2[_0xc583('0x17')];this[_0xc583('0x18')]=moment()[_0xc583('0x19')](_0xc583('0x1a'));this[_0xc583('0x1b')]=utils[_0xc583('0x1c')](_0x114df2[_0xc583('0x16')],_0x114df2[_0xc583('0x15')]);this[_0xc583('0x1d')]=utils['getSeconds'](_0x114df2[_0xc583('0x17')],_0x114df2[_0xc583('0x16')]);this[_0xc583('0x1e')]=utils[_0xc583('0x1c')](this[_0xc583('0x18')],_0x114df2['answertime']);this[_0xc583('0x8')]=_0x3f9f8d[_0xc583('0x8')];this[_0xc583('0x1f')]=_0x3f9f8d[_0xc583('0x1f')];this[_0xc583('0x20')]=_0x3f9f8d[_0xc583('0x20')];this[_0xc583('0x21')]=_0x114df2[_0xc583('0x21')];this[_0xc583('0x22')]=_0x114df2[_0xc583('0x22')];this[_0xc583('0x23')]=_0x114df2['callbackat'];this[_0xc583('0x24')]=_0x114df2[_0xc583('0x24')];this[_0xc583('0x25')]=_0x114df2[_0xc583('0x25')];this[_0xc583('0x26')]=_0x114df2[_0xc583('0x26')];this[_0xc583('0x27')]=_0x114df2[_0xc583('0x27')];this[_0xc583('0x28')]=_0x114df2[_0xc583('0x28')];this['CampaignId']=_0x114df2[_0xc583('0x29')];this[_0xc583('0x2a')]=_0x114df2[_0xc583('0x2a')]||'';this[_0xc583('0x2b')]=_0x114df2[_0xc583('0x2b')]||'';this[_0xc583('0x2c')]=_0x114df2[_0xc583('0x2c')];}module[_0xc583('0x2d')]=AgentComplete; \ No newline at end of file +var _0x4e75=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','../utils','state','statedesc','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x4e75,0xaa));var _0x54e7=function(_0x213bdb,_0x412b9a){_0x213bdb=_0x213bdb-0x0;var _0x4ab32b=_0x4e75[_0x213bdb];return _0x4ab32b;};'use strict';var moment=require('moment');var utils=require(_0x54e7('0x0'));function AgentComplete(_0xfe4858,_0x12e6b4){this[_0x54e7('0x1')]=0x4;this[_0x54e7('0x2')]='Answer';this['scheduledat']=_0xfe4858[_0x54e7('0x3')];this[_0x54e7('0x4')]=_0xfe4858[_0x54e7('0x4')];this['campaigntype']=_0xfe4858['type']==='outbound'?_0x54e7('0x5'):_0xfe4858[_0x54e7('0x4')];this[_0x54e7('0x6')]=_0xfe4858[_0x54e7('0x6')];this[_0x54e7('0x7')]=_0xfe4858['countcongestionretry'];this[_0x54e7('0x8')]=_0xfe4858[_0x54e7('0x8')];this[_0x54e7('0x9')]=_0xfe4858[_0x54e7('0x6')]+_0xfe4858[_0x54e7('0x7')]+_0xfe4858[_0x54e7('0x8')]+_0xfe4858[_0x54e7('0xa')]+_0xfe4858[_0x54e7('0xb')]+_0xfe4858[_0x54e7('0xc')]+_0xfe4858[_0x54e7('0xd')]+_0xfe4858[_0x54e7('0xe')];this[_0x54e7('0xa')]=_0xfe4858[_0x54e7('0xa')];this[_0x54e7('0xb')]=_0xfe4858[_0x54e7('0xb')];this[_0x54e7('0xc')]=_0xfe4858[_0x54e7('0xc')];this['countmachineretry']=_0xfe4858['countmachineretry'];this['countagentrejectretry']=_0xfe4858[_0x54e7('0xe')];this['uniqueid']=_0x12e6b4[_0x54e7('0xf')];this[_0x54e7('0x10')]=_0xfe4858[_0x54e7('0x11')];this[_0x54e7('0x12')]=_0xfe4858[_0x54e7('0x13')];this[_0x54e7('0x14')]=_0xfe4858[_0x54e7('0x14')];this[_0x54e7('0x15')]=_0xfe4858[_0x54e7('0x15')];this[_0x54e7('0x16')]=_0xfe4858['answertime'];this[_0x54e7('0x17')]=moment()[_0x54e7('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x54e7('0x19')]=utils[_0x54e7('0x1a')](_0xfe4858[_0x54e7('0x15')],_0xfe4858[_0x54e7('0x14')]);this['holdtime']=utils[_0x54e7('0x1a')](_0xfe4858['answertime'],_0xfe4858[_0x54e7('0x15')]);this[_0x54e7('0x1b')]=utils[_0x54e7('0x1a')](this[_0x54e7('0x17')],_0xfe4858[_0x54e7('0x16')]);this[_0x54e7('0x5')]=_0x12e6b4[_0x54e7('0x5')];this[_0x54e7('0x1c')]=_0x12e6b4['membername'];this[_0x54e7('0x1d')]=_0x12e6b4[_0x54e7('0x1d')];this['callback']=_0xfe4858[_0x54e7('0x1e')];this[_0x54e7('0x1f')]=_0xfe4858['callbackuniqueid'];this['callbackat']=_0xfe4858['callbackat'];this[_0x54e7('0x20')]=_0xfe4858[_0x54e7('0x20')];this[_0x54e7('0x21')]=_0xfe4858['ContactId'];this[_0x54e7('0x22')]=_0xfe4858[_0x54e7('0x22')];this[_0x54e7('0x23')]=_0xfe4858[_0x54e7('0x23')];this[_0x54e7('0x24')]=_0xfe4858[_0x54e7('0x24')];this[_0x54e7('0x25')]=_0xfe4858[_0x54e7('0x25')];this[_0x54e7('0x26')]=_0xfe4858[_0x54e7('0x26')]||'';this[_0x54e7('0x27')]=_0xfe4858['originatecalleridname']||'';this['agiafterat']=_0xfe4858['agiafterat'];}module[_0x54e7('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 4a72eee..376fc15 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa220=['countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','campaigntype','type','queue','countcongestionretry','countnoanswerretry'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa220,0xc5));var _0x0a22=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa220[_0x4b369d];return _0x571a98;};'use strict';function Final(_0x3373cc){this[_0x0a22('0x0')]=_0x3373cc[_0x0a22('0x0')];this[_0x0a22('0x1')]=_0x3373cc['scheduledat'];this['type']=_0x3373cc['type'];this[_0x0a22('0x2')]=_0x3373cc[_0x0a22('0x3')]==='outbound'?_0x0a22('0x4'):_0x3373cc['type'];this['countbusyretry']=_0x3373cc['countbusyretry'];this[_0x0a22('0x5')]=_0x3373cc['countcongestionretry'];this['countnoanswerretry']=_0x3373cc[_0x0a22('0x6')];this['countglobal']=_0x3373cc[_0x0a22('0x7')]+_0x3373cc['countcongestionretry']+_0x3373cc['countnoanswerretry']+_0x3373cc[_0x0a22('0x8')]+_0x3373cc['countdropretry']+_0x3373cc[_0x0a22('0x9')]+_0x3373cc[_0x0a22('0xa')]+_0x3373cc[_0x0a22('0xb')];this['countnosuchnumberretry']=_0x3373cc[_0x0a22('0x8')];this[_0x0a22('0xc')]=_0x3373cc[_0x0a22('0xc')];this[_0x0a22('0x9')]=_0x3373cc[_0x0a22('0x9')];this['countmachineretry']=_0x3373cc['countmachineretry'];this['countagentrejectretry']=_0x3373cc[_0x0a22('0xb')];this[_0x0a22('0x4')]=_0x3373cc[_0x0a22('0x4')];this['calleridname']=_0x3373cc[_0x0a22('0xd')];this[_0x0a22('0xe')]=_0x3373cc[_0x0a22('0xe')];this['starttime']=_0x3373cc[_0x0a22('0xf')];this['responsetime']=_0x3373cc['responsetime'];this[_0x0a22('0x10')]=_0x3373cc[_0x0a22('0x11')];this[_0x0a22('0x12')]=_0x3373cc[_0x0a22('0x12')]||0x0;this[_0x0a22('0x13')]=_0x3373cc['holdtime']||0x0;this[_0x0a22('0x14')]=_0x3373cc[_0x0a22('0x14')]||0x0;this[_0x0a22('0x15')]=_0x3373cc['callback'];this[_0x0a22('0x16')]=_0x3373cc[_0x0a22('0x16')];this[_0x0a22('0x17')]=_0x3373cc[_0x0a22('0x17')];this[_0x0a22('0x18')]=_0x3373cc[_0x0a22('0x18')];this[_0x0a22('0x19')]=_0x3373cc['ContactId'];this[_0x0a22('0x1a')]=_0x3373cc[_0x0a22('0x1a')];this[_0x0a22('0x1b')]=_0x3373cc[_0x0a22('0x1b')];this[_0x0a22('0x1c')]=_0x3373cc[_0x0a22('0x1c')];this[_0x0a22('0x1d')]=_0x3373cc['CampaignId'];this[_0x0a22('0x1e')]=_0x3373cc['originatecalleridnum']||'';this[_0x0a22('0x1f')]=_0x3373cc[_0x0a22('0x1f')]||'';this[_0x0a22('0x20')]=_0x3373cc[_0x0a22('0x20')];this[_0x0a22('0x21')]=_0x3373cc['statedesc'];}module['exports']=Final; \ No newline at end of file +var _0x12d6=['originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x12d6,0xdc));var _0x612d=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x12d6[_0xaf29da];return _0x295c51;};'use strict';function Final(_0x3ed821){this[_0x612d('0x0')]=_0x3ed821[_0x612d('0x0')];this[_0x612d('0x1')]=_0x3ed821[_0x612d('0x1')];this[_0x612d('0x2')]=_0x3ed821[_0x612d('0x2')];this[_0x612d('0x3')]=_0x3ed821['type']===_0x612d('0x4')?'queue':_0x3ed821['type'];this[_0x612d('0x5')]=_0x3ed821[_0x612d('0x5')];this[_0x612d('0x6')]=_0x3ed821[_0x612d('0x6')];this[_0x612d('0x7')]=_0x3ed821[_0x612d('0x7')];this[_0x612d('0x8')]=_0x3ed821[_0x612d('0x5')]+_0x3ed821['countcongestionretry']+_0x3ed821['countnoanswerretry']+_0x3ed821[_0x612d('0x9')]+_0x3ed821[_0x612d('0xa')]+_0x3ed821[_0x612d('0xb')]+_0x3ed821[_0x612d('0xc')]+_0x3ed821[_0x612d('0xd')];this[_0x612d('0x9')]=_0x3ed821[_0x612d('0x9')];this['countdropretry']=_0x3ed821[_0x612d('0xa')];this[_0x612d('0xb')]=_0x3ed821['countabandonedretry'];this[_0x612d('0xc')]=_0x3ed821[_0x612d('0xc')];this[_0x612d('0xd')]=_0x3ed821[_0x612d('0xd')];this['queue']=_0x3ed821[_0x612d('0xe')];this[_0x612d('0xf')]=_0x3ed821[_0x612d('0xf')];this['calleridnum']=_0x3ed821[_0x612d('0x10')];this['starttime']=_0x3ed821[_0x612d('0x11')];this[_0x612d('0x12')]=_0x3ed821[_0x612d('0x12')];this[_0x612d('0x13')]=_0x3ed821['responsetime'];this[_0x612d('0x14')]=_0x3ed821['ringtime']||0x0;this['holdtime']=_0x3ed821['holdtime']||0x0;this[_0x612d('0x15')]=_0x3ed821[_0x612d('0x15')]||0x0;this[_0x612d('0x16')]=_0x3ed821[_0x612d('0x16')];this[_0x612d('0x17')]=_0x3ed821[_0x612d('0x17')];this[_0x612d('0x18')]=_0x3ed821[_0x612d('0x18')];this[_0x612d('0x19')]=_0x3ed821[_0x612d('0x19')];this[_0x612d('0x1a')]=_0x3ed821[_0x612d('0x1a')];this[_0x612d('0x1b')]=_0x3ed821['ListId'];this[_0x612d('0x1c')]=_0x3ed821['UserId'];this[_0x612d('0x1d')]=_0x3ed821[_0x612d('0x1d')];this[_0x612d('0x1e')]=_0x3ed821[_0x612d('0x1e')];this[_0x612d('0x1f')]=_0x3ed821[_0x612d('0x1f')]||'';this[_0x612d('0x20')]=_0x3ed821['originatecalleridname']||'';this[_0x612d('0x21')]=_0x3ed821[_0x612d('0x21')];this[_0x612d('0x22')]=_0x3ed821[_0x612d('0x22')];}module[_0x612d('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 2ea433a..2fe2c90 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67cc=['endtime','format','ringtime','getSeconds','holdtime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridnum','number','starttime','responsetime'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x67cc,0x90));var _0xc67c=function(_0x1d227e,_0x361094){_0x1d227e=_0x1d227e-0x0;var _0x7ccf13=_0x67cc[_0x1d227e];return _0x7ccf13;};'use strict';var moment=require(_0xc67c('0x0'));var utils=require(_0xc67c('0x1'));function Hangup(_0x5097f0,_0x5404ce){this[_0xc67c('0x2')]=0x4;this[_0xc67c('0x3')]=_0xc67c('0x4');this[_0xc67c('0x5')]=_0x5097f0[_0xc67c('0x5')];this[_0xc67c('0x6')]=_0x5097f0[_0xc67c('0x6')];this[_0xc67c('0x7')]=_0x5097f0[_0xc67c('0x6')]===_0xc67c('0x8')?_0xc67c('0x9'):_0x5097f0[_0xc67c('0x6')];this[_0xc67c('0xa')]=_0x5097f0['amd']||![];this[_0xc67c('0xb')]=_0x5097f0['countbusyretry'];this[_0xc67c('0xc')]=_0x5097f0[_0xc67c('0xc')];this['countnoanswerretry']=_0x5097f0[_0xc67c('0xd')];this['countglobal']=_0x5097f0[_0xc67c('0xb')]+_0x5097f0['countcongestionretry']+_0x5097f0[_0xc67c('0xd')]+_0x5097f0[_0xc67c('0xe')]+_0x5097f0[_0xc67c('0xf')]+_0x5097f0['countabandonedretry']+_0x5097f0[_0xc67c('0x10')]+_0x5097f0[_0xc67c('0x11')];this[_0xc67c('0xe')]=_0x5097f0[_0xc67c('0xe')];this[_0xc67c('0xf')]=_0x5097f0[_0xc67c('0xf')];this[_0xc67c('0x12')]=_0x5097f0[_0xc67c('0x12')];this[_0xc67c('0x10')]=_0x5097f0[_0xc67c('0x10')];this[_0xc67c('0x11')]=_0x5097f0[_0xc67c('0x11')];this[_0xc67c('0x13')]=_0x5404ce[_0xc67c('0x13')];this['calleridname']=_0x5097f0['name'];this[_0xc67c('0x14')]=_0x5097f0[_0xc67c('0x15')];this['starttime']=_0x5097f0[_0xc67c('0x16')];this[_0xc67c('0x17')]=_0x5097f0[_0xc67c('0x17')];this[_0xc67c('0x18')]=moment()[_0xc67c('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc67c('0x1a')]=utils[_0xc67c('0x1b')](_0x5097f0[_0xc67c('0x17')],_0x5097f0[_0xc67c('0x16')]);this[_0xc67c('0x1c')]=0x0;this['talktime']=utils[_0xc67c('0x1b')](this[_0xc67c('0x18')],_0x5097f0[_0xc67c('0x17')]);this['queue']=_0x5097f0['queue'];this[_0xc67c('0x1d')]='IVR';this[_0xc67c('0x1e')]=_0x5404ce[_0xc67c('0x1f')];this[_0xc67c('0x20')]=_0x5097f0[_0xc67c('0x20')];this[_0xc67c('0x21')]=_0x5097f0[_0xc67c('0x21')];this['callbackat']=_0x5097f0[_0xc67c('0x22')];this[_0xc67c('0x23')]=_0x5097f0['recallme'];this[_0xc67c('0x24')]=_0x5097f0['ContactId'];this['ListId']=_0x5097f0[_0xc67c('0x25')];this[_0xc67c('0x26')]=_0x5097f0[_0xc67c('0x26')];this[_0xc67c('0x27')]=_0x5097f0[_0xc67c('0x27')];this[_0xc67c('0x28')]=_0x5097f0['CampaignId'];}module[_0xc67c('0x29')]=Hangup; \ No newline at end of file +var _0x7b89=['format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','moment','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x412dc5,_0x28406e){var _0x2c5649=function(_0x9afd9e){while(--_0x9afd9e){_0x412dc5['push'](_0x412dc5['shift']());}};_0x2c5649(++_0x28406e);}(_0x7b89,0xad));var _0x97b8=function(_0x105aed,_0x3130cf){_0x105aed=_0x105aed-0x0;var _0x3ebfa7=_0x7b89[_0x105aed];return _0x3ebfa7;};'use strict';var moment=require(_0x97b8('0x0'));var utils=require('../utils');function Hangup(_0x4a80ab,_0x556c02){this['state']=0x4;this[_0x97b8('0x1')]=_0x97b8('0x2');this[_0x97b8('0x3')]=_0x4a80ab[_0x97b8('0x3')];this[_0x97b8('0x4')]=_0x4a80ab[_0x97b8('0x4')];this['campaigntype']=_0x4a80ab[_0x97b8('0x4')]===_0x97b8('0x5')?_0x97b8('0x6'):_0x4a80ab[_0x97b8('0x4')];this['amd']=_0x4a80ab[_0x97b8('0x7')]||![];this[_0x97b8('0x8')]=_0x4a80ab['countbusyretry'];this['countcongestionretry']=_0x4a80ab['countcongestionretry'];this[_0x97b8('0x9')]=_0x4a80ab[_0x97b8('0x9')];this['countglobal']=_0x4a80ab[_0x97b8('0x8')]+_0x4a80ab[_0x97b8('0xa')]+_0x4a80ab['countnoanswerretry']+_0x4a80ab[_0x97b8('0xb')]+_0x4a80ab[_0x97b8('0xc')]+_0x4a80ab[_0x97b8('0xd')]+_0x4a80ab[_0x97b8('0xe')]+_0x4a80ab[_0x97b8('0xf')];this[_0x97b8('0xb')]=_0x4a80ab[_0x97b8('0xb')];this[_0x97b8('0xc')]=_0x4a80ab[_0x97b8('0xc')];this[_0x97b8('0xd')]=_0x4a80ab[_0x97b8('0xd')];this[_0x97b8('0xe')]=_0x4a80ab[_0x97b8('0xe')];this[_0x97b8('0xf')]=_0x4a80ab[_0x97b8('0xf')];this['uniqueid']=_0x556c02['uniqueid'];this[_0x97b8('0x10')]=_0x4a80ab[_0x97b8('0x11')];this[_0x97b8('0x12')]=_0x4a80ab[_0x97b8('0x13')];this[_0x97b8('0x14')]=_0x4a80ab[_0x97b8('0x14')];this['responsetime']=_0x4a80ab[_0x97b8('0x15')];this['endtime']=moment()[_0x97b8('0x16')](_0x97b8('0x17'));this['ringtime']=utils[_0x97b8('0x18')](_0x4a80ab[_0x97b8('0x15')],_0x4a80ab['starttime']);this[_0x97b8('0x19')]=0x0;this[_0x97b8('0x1a')]=utils[_0x97b8('0x18')](this['endtime'],_0x4a80ab[_0x97b8('0x15')]);this[_0x97b8('0x6')]=_0x4a80ab['queue'];this[_0x97b8('0x1b')]=_0x97b8('0x1c');this['reason']=_0x556c02[_0x97b8('0x1d')];this[_0x97b8('0x1e')]=_0x4a80ab['callback'];this[_0x97b8('0x1f')]=_0x4a80ab[_0x97b8('0x1f')];this[_0x97b8('0x20')]=_0x4a80ab[_0x97b8('0x20')];this[_0x97b8('0x21')]=_0x4a80ab[_0x97b8('0x21')];this[_0x97b8('0x22')]=_0x4a80ab['ContactId'];this['ListId']=_0x4a80ab[_0x97b8('0x23')];this[_0x97b8('0x24')]=_0x4a80ab['UserId'];this[_0x97b8('0x25')]=_0x4a80ab[_0x97b8('0x25')];this['CampaignId']=_0x4a80ab['CampaignId'];}module[_0x97b8('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 8ad747c..da98486 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda88=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','../utils','uniqueid','scheduledat'];(function(_0x5d1204,_0x5dce3b){var _0x2d0ee7=function(_0x455678){while(--_0x455678){_0x5d1204['push'](_0x5d1204['shift']());}};_0x2d0ee7(++_0x5dce3b);}(_0xda88,0x1a1));var _0x8da8=function(_0x25dfe3,_0x35dc3b){_0x25dfe3=_0x25dfe3-0x0;var _0xfcb743=_0xda88[_0x25dfe3];return _0xfcb743;};'use strict';var utils=require(_0x8da8('0x0'));function History(_0x115fda){this[_0x8da8('0x1')]=_0x115fda[_0x8da8('0x1')];this[_0x8da8('0x2')]=_0x115fda['scheduledat']||undefined;this[_0x8da8('0x3')]=_0x115fda['type'];this[_0x8da8('0x4')]=_0x115fda[_0x8da8('0x3')]===_0x8da8('0x5')?_0x8da8('0x6'):_0x115fda[_0x8da8('0x3')];this[_0x8da8('0x7')]=_0x115fda[_0x8da8('0x7')];this[_0x8da8('0x8')]=_0x115fda[_0x8da8('0x8')];this[_0x8da8('0x9')]=_0x115fda[_0x8da8('0x9')];this[_0x8da8('0xa')]=_0x115fda[_0x8da8('0x7')]+_0x115fda[_0x8da8('0x8')]+_0x115fda[_0x8da8('0x9')]+_0x115fda[_0x8da8('0xb')]+_0x115fda[_0x8da8('0xc')]+_0x115fda['countabandonedretry']+_0x115fda[_0x8da8('0xd')]+_0x115fda[_0x8da8('0xe')];this['countnosuchnumberretry']=_0x115fda[_0x8da8('0xb')];this[_0x8da8('0xc')]=_0x115fda['countdropretry'];this[_0x8da8('0xf')]=_0x115fda[_0x8da8('0xf')];this[_0x8da8('0xd')]=_0x115fda[_0x8da8('0xd')];this[_0x8da8('0xe')]=_0x115fda[_0x8da8('0xe')];this['queue']=_0x115fda[_0x8da8('0x6')];this[_0x8da8('0x10')]=_0x115fda['name'];this['calleridnum']=_0x115fda['number'];this['starttime']=_0x115fda[_0x8da8('0x11')];this[_0x8da8('0x12')]=_0x115fda[_0x8da8('0x12')];this['endtime']=_0x115fda[_0x8da8('0x12')];this[_0x8da8('0x13')]=utils[_0x8da8('0x14')](_0x115fda[_0x8da8('0x12')],_0x115fda[_0x8da8('0x11')]);this[_0x8da8('0x15')]=0x0;this[_0x8da8('0x16')]=0x0;this[_0x8da8('0x17')]=_0x115fda['callback'];this[_0x8da8('0x18')]=_0x115fda[_0x8da8('0x18')];this[_0x8da8('0x19')]=_0x115fda[_0x8da8('0x19')];this[_0x8da8('0x1a')]=_0x115fda[_0x8da8('0x1a')];this[_0x8da8('0x1b')]=_0x115fda[_0x8da8('0x1b')];this[_0x8da8('0x1c')]=_0x115fda['ListId'];this[_0x8da8('0x1d')]=_0x115fda[_0x8da8('0x1d')];this[_0x8da8('0x1e')]=_0x115fda[_0x8da8('0x1e')];this[_0x8da8('0x1f')]=_0x115fda[_0x8da8('0x1f')];this[_0x8da8('0x20')]=_0x115fda[_0x8da8('0x20')]||'';this['originatecalleridname']=_0x115fda['originatecalleridname']||'';this[_0x8da8('0x21')]=_0x115fda[_0x8da8('0x21')];this[_0x8da8('0x22')]=_0x115fda[_0x8da8('0x22')];}module['exports']=History; \ No newline at end of file +var _0xaff2=['../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','starttime','endtime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0x2ab1c1,_0x39b0b6){var _0x527164=function(_0x467967){while(--_0x467967){_0x2ab1c1['push'](_0x2ab1c1['shift']());}};_0x527164(++_0x39b0b6);}(_0xaff2,0x156));var _0x2aff=function(_0x4dd479,_0x26d87a){_0x4dd479=_0x4dd479-0x0;var _0x1b6807=_0xaff2[_0x4dd479];return _0x1b6807;};'use strict';var utils=require(_0x2aff('0x0'));function History(_0x3e73f5){this[_0x2aff('0x1')]=_0x3e73f5[_0x2aff('0x1')];this[_0x2aff('0x2')]=_0x3e73f5[_0x2aff('0x2')]||undefined;this[_0x2aff('0x3')]=_0x3e73f5[_0x2aff('0x3')];this[_0x2aff('0x4')]=_0x3e73f5[_0x2aff('0x3')]===_0x2aff('0x5')?'queue':_0x3e73f5[_0x2aff('0x3')];this[_0x2aff('0x6')]=_0x3e73f5[_0x2aff('0x6')];this[_0x2aff('0x7')]=_0x3e73f5[_0x2aff('0x7')];this[_0x2aff('0x8')]=_0x3e73f5[_0x2aff('0x8')];this[_0x2aff('0x9')]=_0x3e73f5['countbusyretry']+_0x3e73f5[_0x2aff('0x7')]+_0x3e73f5[_0x2aff('0x8')]+_0x3e73f5[_0x2aff('0xa')]+_0x3e73f5[_0x2aff('0xb')]+_0x3e73f5[_0x2aff('0xc')]+_0x3e73f5[_0x2aff('0xd')]+_0x3e73f5['countagentrejectretry'];this[_0x2aff('0xa')]=_0x3e73f5[_0x2aff('0xa')];this[_0x2aff('0xb')]=_0x3e73f5[_0x2aff('0xb')];this[_0x2aff('0xc')]=_0x3e73f5['countabandonedretry'];this['countmachineretry']=_0x3e73f5[_0x2aff('0xd')];this[_0x2aff('0xe')]=_0x3e73f5[_0x2aff('0xe')];this[_0x2aff('0xf')]=_0x3e73f5['queue'];this['calleridname']=_0x3e73f5[_0x2aff('0x10')];this[_0x2aff('0x11')]=_0x3e73f5[_0x2aff('0x12')];this[_0x2aff('0x13')]=_0x3e73f5['starttime'];this['responsetime']=_0x3e73f5['responsetime'];this[_0x2aff('0x14')]=_0x3e73f5[_0x2aff('0x15')];this[_0x2aff('0x16')]=utils[_0x2aff('0x17')](_0x3e73f5[_0x2aff('0x15')],_0x3e73f5['starttime']);this[_0x2aff('0x18')]=0x0;this[_0x2aff('0x19')]=0x0;this[_0x2aff('0x1a')]=_0x3e73f5[_0x2aff('0x1a')];this['callbackuniqueid']=_0x3e73f5[_0x2aff('0x1b')];this['callbackat']=_0x3e73f5['callbackat'];this['recallme']=_0x3e73f5[_0x2aff('0x1c')];this[_0x2aff('0x1d')]=_0x3e73f5[_0x2aff('0x1d')];this[_0x2aff('0x1e')]=_0x3e73f5['ListId'];this['UserId']=_0x3e73f5[_0x2aff('0x1f')];this[_0x2aff('0x20')]=_0x3e73f5[_0x2aff('0x20')];this[_0x2aff('0x21')]=_0x3e73f5['CampaignId'];this[_0x2aff('0x22')]=_0x3e73f5['originatecalleridnum']||'';this['originatecalleridname']=_0x3e73f5[_0x2aff('0x23')]||'';this[_0x2aff('0x24')]=_0x3e73f5[_0x2aff('0x24')];this['statedesc']=_0x3e73f5[_0x2aff('0x25')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 67d0f79..56c34ef 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x300b=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x205796,_0x1a1ac7){var _0x30f173=function(_0xc5c0b1){while(--_0xc5c0b1){_0x205796['push'](_0x205796['shift']());}};_0x30f173(++_0x1a1ac7);}(_0x300b,0x1c4));var _0xb300=function(_0x38d7a0,_0x32a096){_0x38d7a0=_0x38d7a0-0x0;var _0x350821=_0x300b[_0x38d7a0];return _0x350821;};'use strict';var utils=require(_0xb300('0x0'));function QueueCallerAbandon(_0x16a684,_0xf4863a){this[_0xb300('0x1')]=_0x16a684[_0xb300('0x1')];this[_0xb300('0x2')]=_0x16a684[_0xb300('0x2')];this[_0xb300('0x3')]=_0x16a684[_0xb300('0x2')]===_0xb300('0x4')?'queue':_0x16a684['type'];this[_0xb300('0x5')]=_0x16a684[_0xb300('0x5')];this['countcongestionretry']=_0x16a684[_0xb300('0x6')];this[_0xb300('0x7')]=_0x16a684[_0xb300('0x7')];this[_0xb300('0x8')]=_0x16a684['countbusyretry']+_0x16a684[_0xb300('0x6')]+_0x16a684[_0xb300('0x7')]+_0x16a684[_0xb300('0x9')]+_0x16a684[_0xb300('0xa')]+_0x16a684[_0xb300('0xb')]+_0x16a684[_0xb300('0xc')]+_0x16a684[_0xb300('0xd')];this[_0xb300('0x9')]=_0x16a684['countnosuchnumberretry'];this[_0xb300('0xa')]=_0x16a684[_0xb300('0xa')];this[_0xb300('0xb')]=_0x16a684[_0xb300('0xb')];this[_0xb300('0xc')]=_0x16a684[_0xb300('0xc')];this[_0xb300('0xd')]=_0x16a684[_0xb300('0xd')];this[_0xb300('0xe')]=_0xf4863a[_0xb300('0xe')];this[_0xb300('0xf')]=_0x16a684['name'];this['calleridnum']=_0x16a684[_0xb300('0x10')];this['starttime']=_0x16a684[_0xb300('0x11')];this[_0xb300('0x12')]=_0x16a684[_0xb300('0x12')];this[_0xb300('0x13')]=_0x16a684[_0xb300('0x13')];this['dropreason']=_0x16a684[_0xb300('0x14')];this[_0xb300('0x15')]=this[_0xb300('0x13')];this[_0xb300('0x16')]=utils[_0xb300('0x17')](_0x16a684[_0xb300('0x12')],_0x16a684[_0xb300('0x11')]);this[_0xb300('0x18')]=utils['getSeconds'](this['droptime'],_0x16a684['responsetime']);this[_0xb300('0x19')]=0x0;this[_0xb300('0x1a')]=_0xf4863a[_0xb300('0x1a')];this['membername']=_0xf4863a[_0xb300('0x1b')];this['reason']=_0xf4863a[_0xb300('0x1c')];this[_0xb300('0x1d')]=_0x16a684[_0xb300('0x1d')];this[_0xb300('0x1e')]=_0x16a684[_0xb300('0x1e')];this['callbackat']=_0x16a684['callbackat'];this[_0xb300('0x1f')]=_0x16a684[_0xb300('0x1f')];this[_0xb300('0x20')]=_0x16a684['ContactId'];this[_0xb300('0x21')]=_0x16a684[_0xb300('0x21')];this[_0xb300('0x22')]=_0x16a684['UserId'];this[_0xb300('0x23')]=_0x16a684[_0xb300('0x23')];this['CampaignId']=_0x16a684['CampaignId'];this[_0xb300('0x24')]=_0x16a684[_0xb300('0x24')]||'';this[_0xb300('0x25')]=_0x16a684[_0xb300('0x25')]||'';this[_0xb300('0x26')]=_0x16a684[_0xb300('0x26')];this[_0xb300('0x27')]=_0x16a684['state'];this['statedesc']=_0x16a684[_0xb300('0x28')];}module[_0xb300('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xd6d1=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6d1,0x16f));var _0x1d6d=function(_0x2eed83,_0x18863e){_0x2eed83=_0x2eed83-0x0;var _0x343941=_0xd6d1[_0x2eed83];return _0x343941;};'use strict';var utils=require(_0x1d6d('0x0'));function QueueCallerAbandon(_0x24bc51,_0x2da115){this['scheduledat']=_0x24bc51['scheduledat'];this[_0x1d6d('0x1')]=_0x24bc51[_0x1d6d('0x1')];this[_0x1d6d('0x2')]=_0x24bc51['type']===_0x1d6d('0x3')?_0x1d6d('0x4'):_0x24bc51['type'];this['countbusyretry']=_0x24bc51[_0x1d6d('0x5')];this[_0x1d6d('0x6')]=_0x24bc51[_0x1d6d('0x6')];this['countnoanswerretry']=_0x24bc51[_0x1d6d('0x7')];this[_0x1d6d('0x8')]=_0x24bc51[_0x1d6d('0x5')]+_0x24bc51[_0x1d6d('0x6')]+_0x24bc51[_0x1d6d('0x7')]+_0x24bc51[_0x1d6d('0x9')]+_0x24bc51[_0x1d6d('0xa')]+_0x24bc51[_0x1d6d('0xb')]+_0x24bc51[_0x1d6d('0xc')]+_0x24bc51['countagentrejectretry'];this[_0x1d6d('0x9')]=_0x24bc51[_0x1d6d('0x9')];this[_0x1d6d('0xa')]=_0x24bc51[_0x1d6d('0xa')];this[_0x1d6d('0xb')]=_0x24bc51[_0x1d6d('0xb')];this[_0x1d6d('0xc')]=_0x24bc51[_0x1d6d('0xc')];this[_0x1d6d('0xd')]=_0x24bc51['countagentrejectretry'];this[_0x1d6d('0xe')]=_0x2da115[_0x1d6d('0xe')];this[_0x1d6d('0xf')]=_0x24bc51[_0x1d6d('0x10')];this[_0x1d6d('0x11')]=_0x24bc51[_0x1d6d('0x12')];this[_0x1d6d('0x13')]=_0x24bc51['starttime'];this[_0x1d6d('0x14')]=_0x24bc51[_0x1d6d('0x14')];this['droptime']=_0x24bc51[_0x1d6d('0x15')];this[_0x1d6d('0x16')]=_0x24bc51[_0x1d6d('0x16')];this[_0x1d6d('0x17')]=this['droptime'];this[_0x1d6d('0x18')]=utils[_0x1d6d('0x19')](_0x24bc51['responsetime'],_0x24bc51['starttime']);this[_0x1d6d('0x1a')]=utils['getSeconds'](this['droptime'],_0x24bc51[_0x1d6d('0x14')]);this[_0x1d6d('0x1b')]=0x0;this[_0x1d6d('0x4')]=_0x2da115[_0x1d6d('0x4')];this[_0x1d6d('0x1c')]=_0x2da115[_0x1d6d('0x1d')];this['reason']=_0x2da115['reason'];this['callback']=_0x24bc51[_0x1d6d('0x1e')];this[_0x1d6d('0x1f')]=_0x24bc51[_0x1d6d('0x1f')];this[_0x1d6d('0x20')]=_0x24bc51[_0x1d6d('0x20')];this[_0x1d6d('0x21')]=_0x24bc51[_0x1d6d('0x21')];this[_0x1d6d('0x22')]=_0x24bc51['ContactId'];this[_0x1d6d('0x23')]=_0x24bc51[_0x1d6d('0x23')];this[_0x1d6d('0x24')]=_0x24bc51[_0x1d6d('0x24')];this[_0x1d6d('0x25')]=_0x24bc51[_0x1d6d('0x25')];this[_0x1d6d('0x26')]=_0x24bc51['CampaignId'];this[_0x1d6d('0x27')]=_0x24bc51[_0x1d6d('0x27')]||'';this[_0x1d6d('0x28')]=_0x24bc51[_0x1d6d('0x28')]||'';this[_0x1d6d('0x29')]=_0x24bc51[_0x1d6d('0x29')];this['state']=_0x24bc51[_0x1d6d('0x2a')];this[_0x1d6d('0x2b')]=_0x24bc51[_0x1d6d('0x2b')];}module[_0x1d6d('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index f3f5e45..07b1154 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61e=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xf61e,0x191));var _0xef61=function(_0x26314b,_0x34edcb){_0x26314b=_0x26314b-0x0;var _0x577189=_0xf61e[_0x26314b];return _0x577189;};'use strict';var util=require(_0xef61('0x0'));var logger=require(_0xef61('0x1'))(_0xef61('0x2'));var cmHopper=require(_0xef61('0x3'));var cmHopperAdditionalPhone=require(_0xef61('0x4'));var cmHopperBlack=require(_0xef61('0x5'));var cmHopperHistory=require(_0xef61('0x6'));function inspectError(_0x40509e){return util[_0xef61('0x7')](_0x40509e,{'showHidden':![],'depth':null});}function getContactDialer(_0x14122a,_0x239fa9,_0x45a18d){return cmHopper['getContactDialer'](_0x14122a['id'],_0x239fa9,_0x45a18d,_0x14122a[_0xef61('0x8')])[_0xef61('0x9')](function(_0x4f0cc5){_0x14122a[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xc'),inspectError(_0x4f0cc5));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x47d0a7,_0x188894){return cmHopper[_0xef61('0xd')](_0x47d0a7['id'],_0x188894,_0x47d0a7[_0xef61('0x8')])[_0xef61('0x9')](function(_0x2af74c){_0x47d0a7[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xe'),inspectError(_0x2af74c));});}exports[_0xef61('0xd')]=getContactDialerIvr;function countReScheduled(_0x66e7b2){return cmHopper[_0xef61('0xf')](_0x66e7b2)[_0xef61('0x9')](function(_0x114e1f){logger[_0xef61('0xb')]('[countReScheduled]',inspectError(_0x114e1f));});}exports[_0xef61('0xf')]=countReScheduled;function rescheduleContact(_0x58d9a0){return cmHopper[_0xef61('0x10')](_0x58d9a0)[_0xef61('0x9')](function(_0x370ee0){logger[_0xef61('0xb')]('[rescheduleContact]',inspectError(_0x370ee0));});}exports[_0xef61('0x10')]=rescheduleContact;function unlockContact(_0x435beb,_0x1224c2,_0x78ff22){return cmHopper['unlockContact'](_0x435beb,_0x1224c2,_0x78ff22)[_0xef61('0x9')](function(_0xbe23a7){logger['error'](_0xef61('0x11'),inspectError(_0xbe23a7));});}exports[_0xef61('0x12')]=unlockContact;function moveContactManagedDialer(_0x36f558){return cmHopper[_0xef61('0x13')](_0x36f558)[_0xef61('0x9')](function(_0x28315a){logger[_0xef61('0xb')]('[moveContactManagedDialer]',inspectError(_0x28315a));});}exports[_0xef61('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x2c8dad){return cmHopperBlack['checkIsBlackList'](_0x2c8dad)[_0xef61('0x9')](function(_0x36966a){logger[_0xef61('0xb')](_0xef61('0x14'),inspectError(_0x36966a));});}exports[_0xef61('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x2ed61e){return cmHopperBlack[_0xef61('0x16')](_0x2ed61e)['catch'](function(_0x536e9e){logger[_0xef61('0xb')]('[checkIsBlackListIvr]',inspectError(_0x536e9e));});}exports[_0xef61('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5ae7a2,_0x488b47,_0x2f0569){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5ae7a2,_0x488b47,_0x2f0569)['catch'](function(_0xfbee94){logger[_0xef61('0xb')](_0xef61('0x17'),inspectError(_0xfbee94));});}exports[_0xef61('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5e56da,_0x16b144,_0x4e738f){return cmHopperAdditionalPhone[_0xef61('0x19')](_0x5e56da,_0x16b144,_0x4e738f)[_0xef61('0x9')](function(_0x2419a9){logger[_0xef61('0xb')](_0xef61('0x1a'),inspectError(_0x2419a9));});}exports[_0xef61('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x258b5a){return cmHopperHistory[_0xef61('0x1b')](_0x258b5a)[_0xef61('0x9')](function(_0x1ee27b){logger[_0xef61('0xb')](_0xef61('0x1c'),inspectError(_0x1ee27b));});}exports[_0xef61('0x1b')]=avgHandleTime;function createHistory(_0x63edd4){return cmHopperHistory[_0xef61('0x1d')](_0x63edd4)[_0xef61('0x9')](function(_0x39c15e){logger[_0xef61('0xb')](_0xef61('0x1e'),inspectError(_0x39c15e));});}exports[_0xef61('0x1d')]=createHistory; \ No newline at end of file +var _0x7096=['countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[createHistory]','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','getContactDialerIvr','[getContactDialerIvr]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7096,0x10c));var _0x6709=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7096[_0x397e5f];return _0x5302b8;};'use strict';var util=require('util');var logger=require(_0x6709('0x0'))('dialer');var cmHopper=require(_0x6709('0x1'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x6709('0x2'));var cmHopperHistory=require(_0x6709('0x3'));function inspectError(_0x3e85e4){return util[_0x6709('0x4')](_0x3e85e4,{'showHidden':![],'depth':null});}function getContactDialer(_0x3cd087,_0x3c8599,_0xb8fe6d){return cmHopper[_0x6709('0x5')](_0x3cd087['id'],_0x3c8599,_0xb8fe6d,_0x3cd087[_0x6709('0x6')])[_0x6709('0x7')](function(_0x11ad23){_0x3cd087[_0x6709('0x8')]=0x0;logger[_0x6709('0x9')]('[getContactDialer]',inspectError(_0x11ad23));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x2c07b1,_0x2d8c0b){return cmHopper[_0x6709('0xa')](_0x2c07b1['id'],_0x2d8c0b,_0x2c07b1[_0x6709('0x6')])[_0x6709('0x7')](function(_0x426ea1){_0x2c07b1['temp']=0x0;logger['error'](_0x6709('0xb'),inspectError(_0x426ea1));});}exports[_0x6709('0xa')]=getContactDialerIvr;function countReScheduled(_0x275dd3){return cmHopper[_0x6709('0xc')](_0x275dd3)[_0x6709('0x7')](function(_0x288f51){logger[_0x6709('0x9')](_0x6709('0xd'),inspectError(_0x288f51));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x78ce3){return cmHopper[_0x6709('0xe')](_0x78ce3)[_0x6709('0x7')](function(_0x3706e1){logger['error'](_0x6709('0xf'),inspectError(_0x3706e1));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x41af1f,_0x4bc059,_0x149233){return cmHopper[_0x6709('0x10')](_0x41af1f,_0x4bc059,_0x149233)[_0x6709('0x7')](function(_0x3d5c28){logger['error']('[unlockContact]',inspectError(_0x3d5c28));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x3fa5b1){return cmHopper[_0x6709('0x11')](_0x3fa5b1)['catch'](function(_0x9c1fd8){logger[_0x6709('0x9')](_0x6709('0x12'),inspectError(_0x9c1fd8));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x13cf04){return cmHopperBlack[_0x6709('0x13')](_0x13cf04)[_0x6709('0x7')](function(_0x27a27b){logger['error'](_0x6709('0x14'),inspectError(_0x27a27b));});}exports[_0x6709('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x373047){return cmHopperBlack[_0x6709('0x15')](_0x373047)[_0x6709('0x7')](function(_0x224e8a){logger[_0x6709('0x9')](_0x6709('0x16'),inspectError(_0x224e8a));});}exports[_0x6709('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1c5153,_0x2f3415,_0xa36371){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x1c5153,_0x2f3415,_0xa36371)[_0x6709('0x7')](function(_0x81138e){logger[_0x6709('0x9')]('[verifyAdditionalPhone]',inspectError(_0x81138e));});}exports[_0x6709('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x32d346,_0x20a347,_0x44b465){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x32d346,_0x20a347,_0x44b465)[_0x6709('0x7')](function(_0x3076fe){logger['error'](_0x6709('0x18'),inspectError(_0x3076fe));});}exports[_0x6709('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x5dbb87){return cmHopperHistory[_0x6709('0x1a')](_0x5dbb87)[_0x6709('0x7')](function(_0x50ada6){logger[_0x6709('0x9')]('[avgHandleTime]',inspectError(_0x50ada6));});}exports[_0x6709('0x1a')]=avgHandleTime;function createHistory(_0x3cd555){return cmHopperHistory['createHistory'](_0x3cd555)[_0x6709('0x7')](function(_0x4e6989){logger[_0x6709('0x9')](_0x6709('0x1b'),inspectError(_0x4e6989));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 23a14d0..4d7b206 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x054f=['loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','TrunkBackup','status','ACTIVE','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','extractCalleridName','isUndefined','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','tags','updatedAt','undefined','XMD-','substring','toUpperCase','setXMDContactVariables','util','../../../../config/logger','dialer','../../../../config/environment/shared','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','isQueueCampaignActive','active','diff','seconds','dialActive','available'];(function(_0xf39fd0,_0x9f4f32){var _0x459ebf=function(_0x43268f){while(--_0x43268f){_0xf39fd0['push'](_0xf39fd0['shift']());}};_0x459ebf(++_0x9f4f32);}(_0x054f,0x1cb));var _0xf054=function(_0x4bc5f5,_0x3fc086){_0x4bc5f5=_0x4bc5f5-0x0;var _0x54d2c5=_0x054f[_0x4bc5f5];return _0x54d2c5;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xf054('0x0'));var logger=require(_0xf054('0x1'))(_0xf054('0x2'));var timezones=require(_0xf054('0x3'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xf054('0x4'),'CONTACTS_RESCHEDULED':_0xf054('0x5'),'DEACTIVATED':_0xf054('0x6'),'DISACTIVED':_0xf054('0x7'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xf054('0x8'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xf054('0x9'),'NULL_INTERVAL':_0xf054('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xf054('0xb'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xf054('0xc'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xf054('0xd')};exports[_0xf054('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1553f3){return _0x1553f3[_0xf054('0xf')]==='preview';}exports[_0xf054('0x10')]=isPreviewCampaign;function isIVRCampaign(_0x417dbf){return _0x417dbf[_0xf054('0x11')]===_0xf054('0x12');}exports[_0xf054('0x13')]=isIVRCampaign;function isOutboundQueue(_0x410c50){return _0x410c50['type']==='outbound';}exports[_0xf054('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x2d4e4d){return _0x2d4e4d['dialActive'];}exports[_0xf054('0x15')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5cc876){return _0x5cc876[_0xf054('0x16')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x401d6a,_0x4f0932){var _0x102c08=moment(_0x401d6a)['milliseconds'](0x0);var _0x5601e1=moment(_0x4f0932)['milliseconds'](0x0);return _0x102c08[_0xf054('0x17')](_0x5601e1,_0xf054('0x18'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x7f6094,_0x3799e6){var _0x42fd72=![];var _0x249e28=_0x7f6094[_0xf054('0xf')]!==_0x3799e6[_0xf054('0xf')]||_0x7f6094[_0xf054('0x19')]!==_0x3799e6[_0xf054('0x19')]||_0x7f6094['message']!==_0x3799e6['message'];var _0x1d3197=_0x7f6094['available']!==_0x3799e6[_0xf054('0x1a')]||_0x7f6094[_0xf054('0x1b')]!==_0x3799e6[_0xf054('0x1b')]||_0x7f6094[_0xf054('0x1c')]!==_0x3799e6[_0xf054('0x1c')]||_0x7f6094[_0xf054('0x1d')]!==_0x3799e6[_0xf054('0x1d')]||_0x7f6094['talking']!==_0x3799e6[_0xf054('0x1e')]||_0x7f6094[_0xf054('0x1f')]!==_0x3799e6['pTalking']||_0x7f6094[_0xf054('0x20')]!==_0x3799e6[_0xf054('0x20')]||_0x7f6094[_0xf054('0x21')]!==_0x3799e6[_0xf054('0x21')]||_0x7f6094[_0xf054('0x22')]!==_0x3799e6['originated'];if(_0x7f6094['Trunk']&&_0x3799e6[_0xf054('0x23')]){_0x42fd72=_0x7f6094['Trunk'][_0xf054('0x24')]!==_0x3799e6[_0xf054('0x23')][_0xf054('0x24')]||_0x7f6094[_0xf054('0x23')]['active']!==_0x3799e6['Trunk']['active'];}return _0x249e28||_0x1d3197||_0x42fd72;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x380146){var _0x339c08=null;var _0x5317ab=_0x380146[_0xf054('0x25')];if(_[_0xf054('0x26')](_0x380146[_0xf054('0x27')])||_[_0xf054('0x26')](_0x380146[_0xf054('0x28')])||_[_0xf054('0x26')](_0x380146[_0xf054('0x28')][_0xf054('0x29')])){_0x339c08=CAMPAIGN_STATUS[_0xf054('0x2a')];}else if(_[_0xf054('0x2b')](_0x380146[_0xf054('0x27')])||_[_0xf054('0x2b')](_0x380146['Interval']['Intervals'])){_0x339c08=CAMPAIGN_STATUS[_0xf054('0x2c')];}else if(_0x5317ab&&!timezones[_0x5317ab]){_0x339c08=CAMPAIGN_STATUS[_0xf054('0x2d')];}return _0x339c08;}function checkAnyValidTrunk(_0x23a8f4,_0x1c8a1f){var _0x55a827=null;var _0x1c31a8=_0xf054('0x2e');var _0x3e8409=[_0xf054('0x2f'),_0xf054('0x30')];var _0x57e572=!![];if(_0x23a8f4['Trunk']&&_0x23a8f4[_0xf054('0x23')][_0xf054('0x16')]){_0x1c31a8+=_0x23a8f4[_0xf054('0x23')]['name'];_0x55a827=_0x1c8a1f[_0x1c31a8];_0x57e572=_0x3e8409[_0xf054('0x31')](_0x55a827['status']);}else if(_0x23a8f4[_0xf054('0x32')]&&_0x23a8f4['TrunkBackup']['active']){_0x1c31a8+=_0x23a8f4[_0xf054('0x32')][_0xf054('0x24')];_0x55a827=_0x1c8a1f[_0x1c31a8];_0x57e572=_0x3e8409[_0xf054('0x31')](_0x55a827[_0xf054('0x33')]);}return _0x57e572;}function getQueueCampaignStatusMessage(_0x292499,_0x4317ed){var _0x1fe678=CAMPAIGN_STATUS[_0xf054('0x34')];var _0x243acd=isPreviewCampaign(_0x292499);if(!isQueueCampaignActive(_0x292499)){if(_0x243acd){_0x1fe678=CAMPAIGN_STATUS[_0xf054('0x35')];}else{if(_0x292499[_0xf054('0x22')]===0x0&&_0x292499['talking']===0x0&&_0x292499[_0xf054('0x20')]===0x0&&(_0x292499[_0xf054('0x1f')]||0x0)===0x0){_0x1fe678=CAMPAIGN_STATUS[_0xf054('0x35')];}else{_0x1fe678=CAMPAIGN_STATUS[_0xf054('0x36')];}}}else if(_0x292499[_0xf054('0x1b')]===0x0){_0x1fe678=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x292499,_0x4317ed)){_0x1fe678=CAMPAIGN_STATUS[_0xf054('0x37')];}else if(!isPreviewCampaign(_0x292499)){var _0x55e732=checkAnyValidQueueCampaignInterval(_0x292499);if(_0x55e732){_0x1fe678=_0x55e732;}}return _0x1fe678;}exports[_0xf054('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5d8e44){var _0x1b8d91=CAMPAIGN_STATUS['DISACTIVED'];if(_0x5d8e44['originated']===0x0&&_0x5d8e44[_0xf054('0x1e')]===0x0&&_0x5d8e44[_0xf054('0x20')]===0x0&&(_0x5d8e44['pTalking']||0x0)===0x0){_0x1b8d91=CAMPAIGN_STATUS[_0xf054('0x35')];}return _0x1b8d91;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2d7148){var _0x520cec=_0x2d7148['match'](/"(.*?)"/);return _0x520cec?_0x520cec[0x1]:_0x2d7148;}exports[_0xf054('0x39')]=extractCalleridName;function getCallerId(_0x431443,_0x119d99,_0x55cf87){if(!_[_0xf054('0x3a')](_0x55cf87)&&typeof _0x55cf87==='string'&&!_[_0xf054('0x2b')](_0x55cf87)){if(!_[_0xf054('0x3a')](_0x119d99)&&typeof _0x119d99==='string'&&!_['isEmpty'](_0x119d99)){return util[_0xf054('0x3b')](_0xf054('0x3c'),_0x119d99,_0x55cf87);}return util['format'](_0xf054('0x3c'),_0x55cf87,_0x55cf87);}if(!_[_0xf054('0x3a')](_0x431443)&&typeof _0x431443===_0xf054('0x3d')&&!_[_0xf054('0x2b')](_0x431443)){return _0x431443;}return _0xf054('0x3e');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x38b5e3,_0x146282){var _0x12a87e;var _0x4db53c;var _0xd1857a;if(_0x146282<=0x0){_0x146282=0x1;}_0x12a87e=new RegExp(_0xf054('0x3f')+_0x146282+'}$');_0x4db53c=Math['pow'](0xa,_0x146282-0x1);_0xd1857a=Math[_0xf054('0x40')](0xa,_0x146282)-0x1;return util[_0xf054('0x3b')]('%s',_['replace'](_0x38b5e3,_0x12a87e,_[_0xf054('0x41')](_0x4db53c,_0xd1857a)[_0xf054('0x42')]()));}exports[_0xf054('0x43')]=getCallerIdRandom;function decrementOriginate(_0x169e93,_0xb02c2c){if(_0x169e93[_0xf054('0x22')]&&_0x169e93[_0xf054('0x22')]>0x0){_0x169e93[_0xf054('0x22')]-=0x1;}else{logger[_0xf054('0x44')](_0xf054('0x45'),_0xb02c2c);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x3d41e9){return _0x3d41e9&&_0x3d41e9[_0xf054('0x46')]>0x0;}exports[_0xf054('0x47')]=checkContactEmpty;function erlangb(_0x4358c0,_0x4e9929){if(_0x4e9929===0x0){return 0x0;}var _0x387a96=0x1;for(var _0xcc3094=0x1;_0xcc3094<=_0x4e9929;_0xcc3094+=0x1){_0x387a96=0x1+_0x387a96*_0xcc3094/_0x4358c0;}return 0x1/_0x387a96;}exports[_0xf054('0x48')]=erlangb;function checkContactLowerLimitOriginate(_0x16801f,_0x45f515,_0x46c06a){if(_0x45f515>_0x46c06a){for(var _0x37d34d=0x0;_0x37d34d<_0x45f515-_0x46c06a;_0x37d34d+=0x1){decrementOriginate(_0x16801f,_0xf054('0x49'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x269871){var _0x120b55={};var _0x2eb3f0=['id','createdAt',_0xf054('0x4a'),_0xf054('0x4b')];const _0x4e26e0=0xfa;if(_0x269871){for(var _0x34a524 in _0x269871){if(typeof _0x269871[_0x34a524]!==_0xf054('0x4c')){if(!_[_0xf054('0x26')](_0x269871[_0x34a524])&&!_0x2eb3f0['includes'](_0x34a524)){if(_0x34a524==='description'&&_0x269871[_0x34a524][_0xf054('0x46')]>_0x4e26e0){_0x120b55[_0xf054('0x4d')+_0x34a524['toUpperCase']()]=_0x269871[_0x34a524][_0xf054('0x42')]()[_0xf054('0x4e')](0x0,_0x4e26e0);}else{_0x120b55[_0xf054('0x4d')+_0x34a524[_0xf054('0x4f')]()]=_0x269871[_0x34a524];}}}}}return _0x120b55;}exports[_0xf054('0x50')]=setXMDContactVariables; \ No newline at end of file +var _0xeb27=['RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','checkContactEmpty','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','updatedAt','undefined','length','XMD-','toUpperCase','toString','setXMDContactVariables','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xeb27,0x9f));var _0x7eb2=function(_0x24cd66,_0x5e1ca9){_0x24cd66=_0x24cd66-0x0;var _0x320cf4=_0xeb27[_0x24cd66];return _0x320cf4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var logger=require(_0x7eb2('0x0'))(_0x7eb2('0x1'));var timezones=require('../../../../config/environment/shared')[_0x7eb2('0x2')];var CAMPAIGN_STATUS={'ACTIVE':_0x7eb2('0x3'),'BLACKLIST':_0x7eb2('0x4'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x7eb2('0x5'),'DISACTIVED':_0x7eb2('0x6'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x7eb2('0x7'),'NO_AGENTS_LOGGED':_0x7eb2('0x8'),'NO_AVAILABLE_CONTACTS':_0x7eb2('0x9'),'NULL_INTERVAL':_0x7eb2('0xa'),'OVERTIME_INTERVAL':_0x7eb2('0xb'),'OVERTIME_GLOBAL_INTERVAL':_0x7eb2('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x7eb2('0xd'),'RUNNING':_0x7eb2('0xe'),'UNKNOWN_TIMEZONE':_0x7eb2('0xf'),'UNREACHABLE_TRUNK':_0x7eb2('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0xd67b29){return _0xd67b29[_0x7eb2('0x11')]==='preview';}exports[_0x7eb2('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x1911d2){return _0x1911d2[_0x7eb2('0x13')]===_0x7eb2('0x14');}exports[_0x7eb2('0x15')]=isIVRCampaign;function isOutboundQueue(_0x3ef33b){return _0x3ef33b[_0x7eb2('0x13')]===_0x7eb2('0x16');}exports[_0x7eb2('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x3319bb){return _0x3319bb[_0x7eb2('0x18')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x1a0b19){return _0x1a0b19[_0x7eb2('0x19')];}exports[_0x7eb2('0x1a')]=isIVRCampaignActive;function getSeconds(_0x1f6e54,_0x3eb7df){var _0x37f445=moment(_0x1f6e54)[_0x7eb2('0x1b')](0x0);var _0x244fe1=moment(_0x3eb7df)['milliseconds'](0x0);return _0x37f445[_0x7eb2('0x1c')](_0x244fe1,_0x7eb2('0x1d'));}exports[_0x7eb2('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x3a960c,_0x2096ae){var _0x17a55f=![];var _0x410375=_0x3a960c['dialMethod']!==_0x2096ae[_0x7eb2('0x11')]||_0x3a960c['dialActive']!==_0x2096ae['dialActive']||_0x3a960c[_0x7eb2('0x1f')]!==_0x2096ae[_0x7eb2('0x1f')];var _0xf543ed=_0x3a960c[_0x7eb2('0x20')]!==_0x2096ae['available']||_0x3a960c[_0x7eb2('0x21')]!==_0x2096ae['loggedIn']||_0x3a960c['loggedInDb']!==_0x2096ae['loggedInDb']||_0x3a960c[_0x7eb2('0x22')]!==_0x2096ae[_0x7eb2('0x22')]||_0x3a960c[_0x7eb2('0x23')]!==_0x2096ae['talking']||_0x3a960c['pTalking']!==_0x2096ae[_0x7eb2('0x24')]||_0x3a960c[_0x7eb2('0x25')]!==_0x2096ae[_0x7eb2('0x25')]||_0x3a960c[_0x7eb2('0x26')]!==_0x2096ae['inUse']||_0x3a960c['originated']!==_0x2096ae[_0x7eb2('0x27')];if(_0x3a960c[_0x7eb2('0x28')]&&_0x2096ae['Trunk']){_0x17a55f=_0x3a960c[_0x7eb2('0x28')][_0x7eb2('0x29')]!==_0x2096ae[_0x7eb2('0x28')][_0x7eb2('0x29')]||_0x3a960c[_0x7eb2('0x28')][_0x7eb2('0x19')]!==_0x2096ae[_0x7eb2('0x28')][_0x7eb2('0x19')];}return _0x410375||_0xf543ed||_0x17a55f;}exports[_0x7eb2('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x57449e){var _0x5c9478=null;var _0x5a959f=_0x57449e['dialTimezone'];if(_[_0x7eb2('0x2b')](_0x57449e[_0x7eb2('0x2c')])||_[_0x7eb2('0x2b')](_0x57449e[_0x7eb2('0x2d')])||_[_0x7eb2('0x2b')](_0x57449e['Interval']['Intervals'])){_0x5c9478=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x57449e['dialGlobalInterval'])||_[_0x7eb2('0x2e')](_0x57449e[_0x7eb2('0x2d')][_0x7eb2('0x2f')])){_0x5c9478=CAMPAIGN_STATUS[_0x7eb2('0x30')];}else if(_0x5a959f&&!timezones[_0x5a959f]){_0x5c9478=CAMPAIGN_STATUS[_0x7eb2('0x31')];}return _0x5c9478;}function checkAnyValidTrunk(_0x349053,_0x47b3c6){var _0x3bf4a5=null;var _0x231938=_0x7eb2('0x32');var _0x2127a3=[_0x7eb2('0x33'),_0x7eb2('0x34')];var _0xef17e1=!![];if(_0x349053[_0x7eb2('0x28')]&&_0x349053[_0x7eb2('0x28')][_0x7eb2('0x19')]){_0x231938+=_0x349053[_0x7eb2('0x28')][_0x7eb2('0x29')];_0x3bf4a5=_0x47b3c6[_0x231938];_0xef17e1=_0x2127a3[_0x7eb2('0x35')](_0x3bf4a5[_0x7eb2('0x36')]);}else if(_0x349053[_0x7eb2('0x37')]&&_0x349053[_0x7eb2('0x37')][_0x7eb2('0x19')]){_0x231938+=_0x349053[_0x7eb2('0x37')][_0x7eb2('0x29')];_0x3bf4a5=_0x47b3c6[_0x231938];_0xef17e1=_0x2127a3['includes'](_0x3bf4a5[_0x7eb2('0x36')]);}return _0xef17e1;}function getQueueCampaignStatusMessage(_0x543331,_0x2c0812){var _0x568177=CAMPAIGN_STATUS[_0x7eb2('0x3')];var _0x1f2ea2=isPreviewCampaign(_0x543331);if(!isQueueCampaignActive(_0x543331)){if(_0x1f2ea2){_0x568177=CAMPAIGN_STATUS[_0x7eb2('0x38')];}else{if(_0x543331[_0x7eb2('0x27')]===0x0&&_0x543331[_0x7eb2('0x23')]===0x0&&_0x543331[_0x7eb2('0x25')]===0x0&&(_0x543331[_0x7eb2('0x24')]||0x0)===0x0){_0x568177=CAMPAIGN_STATUS[_0x7eb2('0x38')];}else{_0x568177=CAMPAIGN_STATUS[_0x7eb2('0x39')];}}}else if(_0x543331[_0x7eb2('0x21')]===0x0){_0x568177=CAMPAIGN_STATUS[_0x7eb2('0x3a')];}else if(!checkAnyValidTrunk(_0x543331,_0x2c0812)){_0x568177=CAMPAIGN_STATUS[_0x7eb2('0x3b')];}else if(!isPreviewCampaign(_0x543331)){var _0x3daccf=checkAnyValidQueueCampaignInterval(_0x543331);if(_0x3daccf){_0x568177=_0x3daccf;}}return _0x568177;}exports[_0x7eb2('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3f47ac){var _0x34435f=CAMPAIGN_STATUS['DISACTIVED'];if(_0x3f47ac[_0x7eb2('0x27')]===0x0&&_0x3f47ac['talking']===0x0&&_0x3f47ac['waiting']===0x0&&(_0x3f47ac['pTalking']||0x0)===0x0){_0x34435f=CAMPAIGN_STATUS['INACTIVE'];}return _0x34435f;}exports[_0x7eb2('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x157808){var _0x482cc8=_0x157808[_0x7eb2('0x3e')](/"(.*?)"/);return _0x482cc8?_0x482cc8[0x1]:_0x157808;}exports[_0x7eb2('0x3f')]=extractCalleridName;function getCallerId(_0x341303,_0x596d59,_0x2056b1){if(!_['isUndefined'](_0x2056b1)&&typeof _0x2056b1===_0x7eb2('0x40')&&!_[_0x7eb2('0x2e')](_0x2056b1)){if(!_[_0x7eb2('0x41')](_0x596d59)&&typeof _0x596d59==='string'&&!_[_0x7eb2('0x2e')](_0x596d59)){return util[_0x7eb2('0x42')](_0x7eb2('0x43'),_0x596d59,_0x2056b1);}return util[_0x7eb2('0x42')](_0x7eb2('0x43'),_0x2056b1,_0x2056b1);}if(!_[_0x7eb2('0x41')](_0x341303)&&typeof _0x341303===_0x7eb2('0x40')&&!_[_0x7eb2('0x2e')](_0x341303)){return _0x341303;}return _0x7eb2('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x3a3bf3,_0x180846){var _0x46d6fa;var _0x338274;var _0x172f57;if(_0x180846<=0x0){_0x180846=0x1;}_0x46d6fa=new RegExp(_0x7eb2('0x45')+_0x180846+'}$');_0x338274=Math[_0x7eb2('0x46')](0xa,_0x180846-0x1);_0x172f57=Math[_0x7eb2('0x46')](0xa,_0x180846)-0x1;return util[_0x7eb2('0x42')]('%s',_[_0x7eb2('0x47')](_0x3a3bf3,_0x46d6fa,_[_0x7eb2('0x48')](_0x338274,_0x172f57)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x11145f,_0x261aee){if(_0x11145f[_0x7eb2('0x27')]&&_0x11145f[_0x7eb2('0x27')]>0x0){_0x11145f[_0x7eb2('0x27')]-=0x1;}else{logger[_0x7eb2('0x49')](_0x7eb2('0x4a'),_0x261aee);}}exports[_0x7eb2('0x4b')]=decrementOriginate;function checkContactEmpty(_0x598057){return _0x598057&&_0x598057['length']>0x0;}exports[_0x7eb2('0x4c')]=checkContactEmpty;function erlangb(_0x155065,_0x2f9045){if(_0x2f9045===0x0){return 0x0;}var _0x401347=0x1;for(var _0x2a8eb5=0x1;_0x2a8eb5<=_0x2f9045;_0x2a8eb5+=0x1){_0x401347=0x1+_0x401347*_0x2a8eb5/_0x155065;}return 0x1/_0x401347;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x2e8cf8,_0x25661f,_0x2a55d0){if(_0x25661f>_0x2a55d0){for(var _0x32571d=0x0;_0x32571d<_0x25661f-_0x2a55d0;_0x32571d+=0x1){decrementOriginate(_0x2e8cf8,_0x7eb2('0x4d'));}}}exports[_0x7eb2('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2d51e4){var _0x5954b1={};var _0x41ca8d=['id','createdAt','tags',_0x7eb2('0x4f')];const _0x2dfcff=0xfa;if(_0x2d51e4){for(var _0x3ea7c1 in _0x2d51e4){if(typeof _0x2d51e4[_0x3ea7c1]!==_0x7eb2('0x50')){if(!_[_0x7eb2('0x2b')](_0x2d51e4[_0x3ea7c1])&&!_0x41ca8d[_0x7eb2('0x35')](_0x3ea7c1)){if(_0x3ea7c1==='description'&&_0x2d51e4[_0x3ea7c1][_0x7eb2('0x51')]>_0x2dfcff){_0x5954b1[_0x7eb2('0x52')+_0x3ea7c1[_0x7eb2('0x53')]()]=_0x2d51e4[_0x3ea7c1][_0x7eb2('0x54')]()['substring'](0x0,_0x2dfcff);}else{_0x5954b1[_0x7eb2('0x52')+_0x3ea7c1[_0x7eb2('0x53')]()]=_0x2d51e4[_0x3ea7c1];}}}}}return _0x5954b1;}exports[_0x7eb2('0x55')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index bb3b7c6..ebb13c7 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(_0x3fb38d,_0x1462ee){var _0x400fa8=function(_0x18c344){while(--_0x18c344){_0x3fb38d['push'](_0x3fb38d['shift']());}};_0x400fa8(++_0x1462ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x50c1dd,_0x473669){var _0x18b0c1=function(_0x169869){while(--_0x169869){_0x50c1dd['push'](_0x50c1dd['shift']());}};_0x18b0c1(++_0x473669);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 c46dd5e..84f28fd 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 _0x9696=['catch','syncOriginateResponse','actions','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','reachable','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','deleteChannelAfterTimeout','util','lodash','uuid','path','tiff2pdf','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','value','operation','status','filename','remotestationid','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','error','\x20notify\x20','stringify'];(function(_0x1fb7d1,_0x108781){var _0x2480d8=function(_0x9bc3d9){while(--_0x9bc3d9){_0x1fb7d1['push'](_0x1fb7d1['shift']());}};_0x2480d8(++_0x108781);}(_0x9696,0x17f));var _0x6969=function(_0x39e357,_0x4ab758){_0x39e357=_0x39e357-0x0;var _0x1fe3f7=_0x9696[_0x39e357];return _0x1fe3f7;};'use strict';var util=require(_0x6969('0x0'));var _=require(_0x6969('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6969('0x2'));var moment=require('moment');var path=require(_0x6969('0x3'));var tiff2pdf=require(_0x6969('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x6969('0x5'));var ami=require(_0x6969('0x6'));var rpcDb=require(_0x6969('0x7'));var Channel=require('./channel');var ut=require(_0x6969('0x8'));var Action=require(_0x6969('0x9'));var faxAccount=require(_0x6969('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x6969('0xb'));function Fax(_0x1865b7){this[_0x6969('0xc')]={};this[_0x6969('0xd')]=_0x1865b7[_0x6969('0xd')];this[_0x6969('0xe')]=_0x1865b7[_0x6969('0xe')];this['actions']={};ami['on'](_0x6969('0xf'),this[_0x6969('0x10')]['bind'](this));ami['on'](_0x6969('0x11'),this[_0x6969('0x12')][_0x6969('0x13')](this));ami['on'](_0x6969('0x14'),this[_0x6969('0x15')]['bind'](this));ami['on'](_0x6969('0x16'),this[_0x6969('0x17')][_0x6969('0x13')](this));ami['on']('faxstatus',this[_0x6969('0x18')]['bind'](this));ami['on']('receivefax',this[_0x6969('0x19')][_0x6969('0x13')](this));ami['on'](_0x6969('0x1a'),this[_0x6969('0x1b')][_0x6969('0x13')](this));ami['on'](_0x6969('0x1c'),this['syncOriginateResponse'][_0x6969('0x13')](this));}Fax[_0x6969('0x1d')][_0x6969('0x10')]=function(_0x2f7aa7){if(_0x2f7aa7['context']===_0x6969('0x1e')){for(var _0x35318d in this['faxAccounts']){if(this[_0x6969('0xd')][_0x6969('0x1f')](_0x35318d)){if(_0x2f7aa7[_0x6969('0x20')]===this[_0x6969('0xd')][_0x35318d][_0x6969('0x21')]){this[_0x6969('0xc')][_0x2f7aa7['uniqueid']]={};this['channels'][_0x2f7aa7[_0x6969('0x22')]][_0x6969('0x23')]=_0x2f7aa7[_0x6969('0x23')];this['channels'][_0x2f7aa7['uniqueid']]['id']=this[_0x6969('0xd')][_0x35318d]['id'];this[_0x6969('0xc')][_0x2f7aa7[_0x6969('0x22')]][_0x6969('0x24')]=this['faxAccounts'][_0x35318d][_0x6969('0x24')];logger[_0x6969('0x25')](_0x2f7aa7[_0x6969('0x22')],_0x6969('0x26'));}}}}if(this['actions'][_0x2f7aa7[_0x6969('0x22')]]){this[_0x6969('0xc')][_0x2f7aa7[_0x6969('0x22')]]={};this[_0x6969('0xc')][_0x2f7aa7[_0x6969('0x22')]][_0x6969('0x23')]=_0x2f7aa7['channel'];logger['info'](_0x2f7aa7[_0x6969('0x22')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x3207d9){if(this[_0x6969('0xc')][_0x3207d9[_0x6969('0x22')]]){for(var _0x21b0cb in _0x3207d9[_0x6969('0x27')]){if(_0x3207d9[_0x6969('0x27')][_0x6969('0x1f')](_0x21b0cb)){this[_0x6969('0xc')][_0x3207d9['uniqueid']][_0x21b0cb]=_0x3207d9['value'];}}}};Fax[_0x6969('0x1d')]['syncNewState']=function(_0x5bb61e){if(this['channels'][_0x5bb61e[_0x6969('0x22')]]){this['channels'][_0x5bb61e[_0x6969('0x22')]][_0x6969('0x28')]=_0x5bb61e[_0x6969('0x28')];this[_0x6969('0xc')][_0x5bb61e[_0x6969('0x22')]]['channelstatedesc']=_0x5bb61e['channelstatedesc'];}};Fax[_0x6969('0x1d')][_0x6969('0x17')]=function(_0x5dae90){if(this[_0x6969('0xc')][_0x5dae90[_0x6969('0x22')]]){for(var _0x2e9cf0 in _0x5dae90[_0x6969('0x27')]){if(_0x5dae90['variable'][_0x6969('0x1f')](_0x2e9cf0)){this[_0x6969('0xc')][_0x5dae90[_0x6969('0x22')]][_0x2e9cf0]=_0x5dae90[_0x6969('0x29')];}}}};Fax[_0x6969('0x1d')][_0x6969('0x18')]=function(_0x2ec5c8){if(this[_0x6969('0xc')][_0x2ec5c8[_0x6969('0x22')]]){this[_0x6969('0xc')][_0x2ec5c8['uniqueid']][_0x6969('0x2a')]=_0x2ec5c8[_0x6969('0x2a')];this['channels'][_0x2ec5c8[_0x6969('0x22')]][_0x6969('0x2b')]=_0x2ec5c8[_0x6969('0x2b')];this['channels'][_0x2ec5c8[_0x6969('0x22')]][_0x6969('0x21')]=_0x2ec5c8['localstationid'];this[_0x6969('0xc')][_0x2ec5c8[_0x6969('0x22')]][_0x6969('0x2c')]=_0x2ec5c8['filename'];logger['info'](_0x2ec5c8['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x6969('0x1d')]['syncReceiveFax']=function(_0x5c4403){var _0x3701ca=this;if(this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]]){var _0x198751=this[_0x6969('0xc')][_0x5c4403['uniqueid']]['id'];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]]['remotestationid']=_0x5c4403[_0x6969('0x2d')];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x2e')]=_0x5c4403['pagestransferred'];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x21')]=_0x5c4403[_0x6969('0x21')];this['channels'][_0x5c4403[_0x6969('0x22')]][_0x6969('0x2f')]=_0x5c4403[_0x6969('0x2f')];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]]['transferrate']=_0x5c4403['transferrate'];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x2c')]=_0x5c4403['filename'];this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x30')]=_0x5c4403[_0x6969('0x30')];if(this[_0x6969('0xc')][_0x5c4403[_0x6969('0x22')]][_0x6969('0x2e')]>0x0){tiff2pdf(_0x5c4403[_0x6969('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x5b9cbb){logger[_0x6969('0x25')](_0x5c4403[_0x6969('0x22')],_0x6969('0x31'),_0x5b9cbb[_0x6969('0x32')]);attachment['create']({'name':path[_0x6969('0x33')](_0x5c4403['filename'])[_0x6969('0x24')],'basename':path[_0x6969('0x33')](_0x5c4403[_0x6969('0x2c')])[_0x6969('0x24')]+_0x6969('0x34'),'type':'application/pdf'})[_0x6969('0x35')](function(_0x542eb6){faxAccount['notify'](_0x198751,{'from':_0x5c4403[_0x6969('0x30')],'mapKey':'fax','body':path[_0x6969('0x33')](_0x5c4403[_0x6969('0x2c')])[_0x6969('0x24')]+_0x6969('0x34'),'AttachmentId':_0x542eb6['id']})['catch'](function(_0x1c7275){logger[_0x6969('0x36')](_0x5c4403['uniqueid'],_0x6969('0x37'),JSON[_0x6969('0x38')](_0x1c7275));});})[_0x6969('0x39')](function(_0x5e9fd8){logger[_0x6969('0x36')](_0x5c4403[_0x6969('0x22')],'\x20receiveFax\x20',JSON[_0x6969('0x38')](_0x5e9fd8));});});}logger[_0x6969('0x25')](_0x5c4403[_0x6969('0x22')],'\x20receiveFax\x20');}};Fax['prototype'][_0x6969('0x3a')]=function(_0x4ed9da){if(this[_0x6969('0x3b')][_0x4ed9da[_0x6969('0x22')]]){_[_0x6969('0x3c')](this[_0x6969('0xc')][_0x4ed9da[_0x6969('0x22')]],_[_0x6969('0x3d')](_0x4ed9da,[_0x6969('0x3e'),_0x6969('0x3f')]));}};function updateStatus(_0x3d8dcc){if(_0x3d8dcc[_0x6969('0x40')]){faxMessage['update'](_0x3d8dcc[_0x6969('0x40')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x6969('0x35')](function(_0x4d65fa){ut[_0x6969('0x41')](_0x6969('0x42'),_0x4d65fa);})[_0x6969('0x39')](function(_0xb2793a){ut['logger'](_0x6969('0x43'),_0xb2793a);});}else{ut[_0x6969('0x41')](_0x6969('0x44'));}}Fax[_0x6969('0x1d')][_0x6969('0x45')]=function(_0x58e3a2,_0x4e545f,_0x1cfb49){var _0x10232e=this;var _0x111b1c={};if(_0x4e545f){_0x111b1c={'read':_0x4e545f};}else{_0x111b1c={'failMessage':_0x1cfb49};}if(this[_0x6969('0x3b')][_0x58e3a2][_0x6969('0x40')]){faxMessage['update'](this[_0x6969('0x3b')][_0x58e3a2][_0x6969('0x40')],_0x111b1c)[_0x6969('0x35')](function(_0x5f09cb){ut['logger'](_0x6969('0x46'),_0x5f09cb);})['catch'](function(_0x48208b){ut[_0x6969('0x41')]('[Fax][Message][NoUpdate1]',_0x48208b);})['finally'](function(){delete _0x10232e['channels'][_0x58e3a2];delete _0x10232e[_0x6969('0x3b')][_0x58e3a2];});}else{ut[_0x6969('0x41')](_0x6969('0x47'));this['deleteChannelAfterTimeout'](_0x58e3a2);delete this[_0x6969('0x3b')][_0x58e3a2];}};Fax['prototype'][_0x6969('0x1b')]=function(_0x1f7830){var _0x2bfc67=this;if(this[_0x6969('0xc')][_0x1f7830[_0x6969('0x22')]]){if(this[_0x6969('0x3b')][_0x1f7830[_0x6969('0x22')]]){this[_0x6969('0xc')][_0x1f7830['uniqueid']]['id']=this['actions'][_0x1f7830['uniqueid']]['id'];this[_0x6969('0xc')][_0x1f7830[_0x6969('0x22')]][_0x6969('0x24')]=this[_0x6969('0x3b')][_0x1f7830[_0x6969('0x22')]][_0x6969('0x24')];}logger[_0x6969('0x25')](_0x1f7830[_0x6969('0x22')],this[_0x6969('0x3b')][_0x1f7830[_0x6969('0x22')]]?_0x6969('0x48'):_0x6969('0x49'),JSON['stringify'](this[_0x6969('0xc')][_0x1f7830[_0x6969('0x22')]]));if(this['actions'][_0x1f7830['uniqueid']]){if(this[_0x6969('0xc')][_0x1f7830['uniqueid']]['faxpages']>0x0&&this[_0x6969('0xc')][_0x1f7830['uniqueid']][_0x6969('0x4a')]===_0x6969('0x4b')){this[_0x6969('0x45')](_0x1f7830[_0x6969('0x22')],!![]);}else{this['updateStatus'](_0x1f7830[_0x6969('0x22')],![],this[_0x6969('0xc')][_0x1f7830['uniqueid']][_0x6969('0x4c')]?'SENDING\x20FAILED:\x20'+this[_0x6969('0xc')][_0x1f7830['uniqueid']][_0x6969('0x4c')]:_0x6969('0x4d'));}}}};Fax['prototype']['send']=function(_0x391cd9){var _0x1aa579=this;return new BPromise(function(_0x3eb0ad,_0x64cbb7){_0x1aa579[_0x6969('0x4e')](_0x391cd9,_0x1aa579[_0x6969('0xd')][_0x391cd9['FaxAccountId']])['then'](function(_0x266fa1){ut[_0x6969('0x41')]('[Fax][execOriginate][success]',_0x266fa1);_0x3eb0ad(ut[_0x6969('0x32')](_0x6969('0x4f')));})[_0x6969('0x39')](function(_0x3e8354){ut[_0x6969('0x41')](_0x6969('0x50'),_0x3e8354);updateStatus(_0x391cd9);_0x64cbb7(ut[_0x6969('0x32')](_0x6969('0x51')));});});};Fax['prototype'][_0x6969('0x52')]=function(_0xb1019b){var _0x134655=this;return new BPromise(function(_0x7d1a50,_0x3509ff){var _0x2e426e=_0x134655[_0x6969('0x53')](_0x134655[_0x6969('0xd')][_0xb1019b[_0x6969('0x54')]][_0x6969('0x55')],_0xb1019b);if(_0x2e426e['isValid']){_0x7d1a50(ut[_0x6969('0x32')](_0x6969('0x56')));}else{_0x3509ff(ut[_0x6969('0x32')](_0x2e426e['message']));}});};function originate(_0x5da553,_0x2ff7dc,_0xf71db9){return new BPromise(function(_0x1d2d1f,_0x3b6c89){if(_0xf71db9){var _0x3b10b7=util[_0x6969('0x57')](_0x6969('0x58'),path[_0x6969('0x33')](_0x5da553['path'])[_0x6969('0x24')],_0x5da553[_0x6969('0x3')]);gs[_0x6969('0x59')](_0x3b10b7)[_0x6969('0x35')](function(){_0x5da553[_0x6969('0x3')]=util[_0x6969('0x57')](_0x6969('0x5a'),path[_0x6969('0x33')](_0x5da553[_0x6969('0x3')])[_0x6969('0x5b')],path[_0x6969('0x33')](_0x5da553[_0x6969('0x3')])[_0x6969('0x24')]);_0x2ff7dc[_0x6969('0x5c')]=_0x5da553['path'];ut['logger'](_0x6969('0x5d'),'');ami[_0x6969('0x5e')](ut[_0x6969('0x5f')](_0x5da553,_0x2ff7dc))[_0x6969('0x35')](function(_0x294916){_0x1d2d1f(_0x294916);})[_0x6969('0x39')](function(_0x2d442f){_0x3b6c89(_0x2d442f);});})[_0x6969('0x39')](function(_0x26d129){_0x3b6c89(_0x26d129);});}else{ami[_0x6969('0x5e')](ut[_0x6969('0x5f')](_0x5da553,_0x2ff7dc))[_0x6969('0x35')](function(_0x17332f){_0x1d2d1f(_0x17332f);})[_0x6969('0x39')](function(_0x37d49d){_0x3b6c89(_0x37d49d);});}});}Fax[_0x6969('0x1d')][_0x6969('0x4e')]=function(_0x2b244a,_0x582922){var _0x56f73a=this;return new BPromise(function(_0x124f82,_0xa5e5e7){var _0x4b1478=uuid['v4']();var _0xef980f=ut[_0x6969('0x60')](_0x2b244a,_0x582922);_0x56f73a[_0x6969('0x3b')][_0x4b1478]=new Action(_0x4b1478,_0x582922,_0x2b244a);var _0x9ffa4=_0x56f73a[_0x6969('0x3b')][_0x4b1478];if(path[_0x6969('0x33')](_0x2b244a['path'])[_0x6969('0x61')]===_0x6969('0x34')){originate(_0x9ffa4,_0xef980f,!![])['then'](function(_0x30b938){_0x124f82(_0x30b938);})[_0x6969('0x39')](function(_0x1948b3){_0xa5e5e7(_0x1948b3);});}else{originate(_0x9ffa4,_0xef980f,![])['then'](function(_0x14fa2b){_0x124f82(_0x14fa2b);})[_0x6969('0x39')](function(_0x2f78d9){_0xa5e5e7(_0x2f78d9);});}});};Fax[_0x6969('0x1d')][_0x6969('0x62')]=function(_0xb17206){return!_[_0x6969('0x63')](_0xb17206)&&!_['isNil'](_0xb17206[_0x6969('0x24')])&&!_[_0x6969('0x63')](_0xb17206[_0x6969('0x64')])&&_0xb17206[_0x6969('0x64')]&&!_[_0x6969('0x63')](this[_0x6969('0xe')][util[_0x6969('0x57')]('SIP/%s',_0xb17206['name'])])&&!_[_0x6969('0x63')](this[_0x6969('0xe')][util[_0x6969('0x57')]('SIP/%s',_0xb17206[_0x6969('0x24')])][_0x6969('0x2b')])&&(this['trunks'][util['format']('SIP/%s',_0xb17206[_0x6969('0x24')])][_0x6969('0x2b')]===_0x6969('0x65')||this[_0x6969('0xe')][util[_0x6969('0x57')](_0x6969('0x66'),_0xb17206[_0x6969('0x24')])][_0x6969('0x2b')]===_0x6969('0x67'));};Fax[_0x6969('0x1d')]['checkTrunk']=function(_0x8758c2,_0x5cbe62){if(!this[_0x6969('0x62')](_0x8758c2)){ut[_0x6969('0x41')](_0x6969('0x68'),_['isNil'](_0x8758c2)?'':_0x8758c2[_0x6969('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x6969('0x63')](_0x5cbe62[_0x6969('0x5')])){ut[_0x6969('0x41')](_0x6969('0x69'),JSON[_0x6969('0x38')](_0x5cbe62));return{'isValid':![],'message':_0x6969('0x6a')};}if(_[_0x6969('0x63')](_0x5cbe62[_0x6969('0x3')])){ut[_0x6969('0x41')](_0x6969('0x6b'),JSON[_0x6969('0x38')](_0x5cbe62));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x6969('0x6c')};};Fax[_0x6969('0x1d')][_0x6969('0x6d')]=function(_0x434825,_0x1ad50e=0x2710){if(this[_0x6969('0xc')][_0x434825]){setTimeout(()=>{delete this[_0x6969('0xc')][_0x434825];},_0x1ad50e);}};module['exports']=Fax; \ No newline at end of file +var _0x8f93=['\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','bluebird','uuid','moment','path','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','syncNewState','newexten','syncNewExten','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error'];(function(_0x4a944e,_0x4143d8){var _0x1da079=function(_0x425393){while(--_0x425393){_0x4a944e['push'](_0x4a944e['shift']());}};_0x1da079(++_0x4143d8);}(_0x8f93,0xb4));var _0x38f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f93[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x38f9('0x0'));var _=require('lodash');var BPromise=require(_0x38f9('0x1'));var uuid=require(_0x38f9('0x2'));var moment=require(_0x38f9('0x3'));var path=require(_0x38f9('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x38f9('0x5'))('fax');var ami=require(_0x38f9('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x38f9('0x7'));var ut=require(_0x38f9('0x8'));var Action=require(_0x38f9('0x9'));var faxAccount=require(_0x38f9('0xa'));var attachment=require(_0x38f9('0xb'));var faxMessage=require(_0x38f9('0xc'));function Fax(_0x271ee1){this['channels']={};this['faxAccounts']=_0x271ee1[_0x38f9('0xd')];this[_0x38f9('0xe')]=_0x271ee1[_0x38f9('0xe')];this[_0x38f9('0xf')]={};ami['on'](_0x38f9('0x10'),this[_0x38f9('0x11')]['bind'](this));ami['on'](_0x38f9('0x12'),this[_0x38f9('0x13')][_0x38f9('0x14')](this));ami['on']('newstate',this[_0x38f9('0x15')][_0x38f9('0x14')](this));ami['on'](_0x38f9('0x16'),this[_0x38f9('0x17')]['bind'](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x38f9('0x14')](this));ami['on'](_0x38f9('0x18'),this[_0x38f9('0x19')][_0x38f9('0x14')](this));ami['on'](_0x38f9('0x1a'),this['syncHangup'][_0x38f9('0x14')](this));ami['on'](_0x38f9('0x1b'),this[_0x38f9('0x1c')][_0x38f9('0x14')](this));}Fax[_0x38f9('0x1d')][_0x38f9('0x11')]=function(_0x3e8749){if(_0x3e8749['context']===_0x38f9('0x1e')){for(var _0x236a37 in this[_0x38f9('0xd')]){if(this['faxAccounts'][_0x38f9('0x1f')](_0x236a37)){if(_0x3e8749[_0x38f9('0x20')]===this[_0x38f9('0xd')][_0x236a37][_0x38f9('0x21')]){this['channels'][_0x3e8749['uniqueid']]={};this[_0x38f9('0x22')][_0x3e8749[_0x38f9('0x23')]][_0x38f9('0x24')]=_0x3e8749['channel'];this[_0x38f9('0x22')][_0x3e8749[_0x38f9('0x23')]]['id']=this[_0x38f9('0xd')][_0x236a37]['id'];this['channels'][_0x3e8749[_0x38f9('0x23')]][_0x38f9('0x25')]=this[_0x38f9('0xd')][_0x236a37][_0x38f9('0x25')];logger[_0x38f9('0x26')](_0x3e8749[_0x38f9('0x23')],_0x38f9('0x27'));}}}}if(this[_0x38f9('0xf')][_0x3e8749['uniqueid']]){this[_0x38f9('0x22')][_0x3e8749[_0x38f9('0x23')]]={};this['channels'][_0x3e8749[_0x38f9('0x23')]][_0x38f9('0x24')]=_0x3e8749[_0x38f9('0x24')];logger[_0x38f9('0x26')](_0x3e8749[_0x38f9('0x23')],_0x38f9('0x27'));}};Fax['prototype'][_0x38f9('0x13')]=function(_0x2c5910){if(this[_0x38f9('0x22')][_0x2c5910[_0x38f9('0x23')]]){for(var _0x348586 in _0x2c5910[_0x38f9('0x28')]){if(_0x2c5910['variable'][_0x38f9('0x1f')](_0x348586)){this[_0x38f9('0x22')][_0x2c5910[_0x38f9('0x23')]][_0x348586]=_0x2c5910[_0x38f9('0x29')];}}}};Fax['prototype']['syncNewState']=function(_0x594cde){if(this[_0x38f9('0x22')][_0x594cde[_0x38f9('0x23')]]){this['channels'][_0x594cde[_0x38f9('0x23')]][_0x38f9('0x2a')]=_0x594cde[_0x38f9('0x2a')];this[_0x38f9('0x22')][_0x594cde[_0x38f9('0x23')]][_0x38f9('0x2b')]=_0x594cde[_0x38f9('0x2b')];}};Fax['prototype']['syncNewExten']=function(_0x549201){if(this[_0x38f9('0x22')][_0x549201['uniqueid']]){for(var _0xd750a9 in _0x549201[_0x38f9('0x28')]){if(_0x549201[_0x38f9('0x28')]['hasOwnProperty'](_0xd750a9)){this[_0x38f9('0x22')][_0x549201[_0x38f9('0x23')]][_0xd750a9]=_0x549201[_0x38f9('0x29')];}}}};Fax[_0x38f9('0x1d')][_0x38f9('0x2c')]=function(_0xc4ae89){if(this['channels'][_0xc4ae89['uniqueid']]){this['channels'][_0xc4ae89[_0x38f9('0x23')]][_0x38f9('0x2d')]=_0xc4ae89[_0x38f9('0x2d')];this[_0x38f9('0x22')][_0xc4ae89[_0x38f9('0x23')]][_0x38f9('0x2e')]=_0xc4ae89['status'];this[_0x38f9('0x22')][_0xc4ae89[_0x38f9('0x23')]][_0x38f9('0x21')]=_0xc4ae89[_0x38f9('0x21')];this['channels'][_0xc4ae89['uniqueid']][_0x38f9('0x2f')]=_0xc4ae89[_0x38f9('0x2f')];logger[_0x38f9('0x26')](_0xc4ae89[_0x38f9('0x23')],_0x38f9('0x30'));}};Fax[_0x38f9('0x1d')][_0x38f9('0x19')]=function(_0x1f2998){var _0x2c92b6=this;if(this['channels'][_0x1f2998[_0x38f9('0x23')]]){var _0x2b9cf5=this[_0x38f9('0x22')][_0x1f2998['uniqueid']]['id'];this[_0x38f9('0x22')][_0x1f2998[_0x38f9('0x23')]][_0x38f9('0x31')]=_0x1f2998[_0x38f9('0x31')];this['channels'][_0x1f2998[_0x38f9('0x23')]][_0x38f9('0x32')]=_0x1f2998[_0x38f9('0x32')];this['channels'][_0x1f2998[_0x38f9('0x23')]][_0x38f9('0x21')]=_0x1f2998[_0x38f9('0x21')];this['channels'][_0x1f2998[_0x38f9('0x23')]]['resolution']=_0x1f2998[_0x38f9('0x33')];this[_0x38f9('0x22')][_0x1f2998[_0x38f9('0x23')]][_0x38f9('0x34')]=_0x1f2998[_0x38f9('0x34')];this[_0x38f9('0x22')][_0x1f2998[_0x38f9('0x23')]][_0x38f9('0x2f')]=_0x1f2998[_0x38f9('0x2f')];this[_0x38f9('0x22')][_0x1f2998[_0x38f9('0x23')]][_0x38f9('0x35')]=_0x1f2998[_0x38f9('0x35')];if(this[_0x38f9('0x22')][_0x1f2998['uniqueid']][_0x38f9('0x32')]>0x0){tiff2pdf(_0x1f2998['filename'],_0x38f9('0x36'),function(_0x5f2c12){logger[_0x38f9('0x26')](_0x1f2998[_0x38f9('0x23')],_0x38f9('0x37'),_0x5f2c12[_0x38f9('0x38')]);attachment[_0x38f9('0x39')]({'name':path[_0x38f9('0x3a')](_0x1f2998[_0x38f9('0x2f')])[_0x38f9('0x25')],'basename':path[_0x38f9('0x3a')](_0x1f2998[_0x38f9('0x2f')])['name']+_0x38f9('0x3b'),'type':_0x38f9('0x3c')})[_0x38f9('0x3d')](function(_0x328d43){faxAccount[_0x38f9('0x3e')](_0x2b9cf5,{'from':_0x1f2998[_0x38f9('0x35')],'mapKey':_0x38f9('0x3f'),'body':path['parse'](_0x1f2998[_0x38f9('0x2f')])[_0x38f9('0x25')]+_0x38f9('0x3b'),'AttachmentId':_0x328d43['id']})[_0x38f9('0x40')](function(_0x163e89){logger[_0x38f9('0x41')](_0x1f2998[_0x38f9('0x23')],_0x38f9('0x42'),JSON[_0x38f9('0x43')](_0x163e89));});})[_0x38f9('0x40')](function(_0x226ca9){logger[_0x38f9('0x41')](_0x1f2998['uniqueid'],_0x38f9('0x44'),JSON[_0x38f9('0x43')](_0x226ca9));});});}logger[_0x38f9('0x26')](_0x1f2998[_0x38f9('0x23')],_0x38f9('0x44'));}};Fax[_0x38f9('0x1d')][_0x38f9('0x1c')]=function(_0x5d9d47){if(this[_0x38f9('0xf')][_0x5d9d47['uniqueid']]){_['merge'](this['channels'][_0x5d9d47[_0x38f9('0x23')]],_[_0x38f9('0x45')](_0x5d9d47,[_0x38f9('0x46'),_0x38f9('0x47')]));}};function updateStatus(_0x39d78c){if(_0x39d78c[_0x38f9('0x48')]){faxMessage[_0x38f9('0x49')](_0x39d78c[_0x38f9('0x48')],{'failMessage':_0x38f9('0x4a')})[_0x38f9('0x3d')](function(_0x115ef0){ut[_0x38f9('0x4b')](_0x38f9('0x4c'),_0x115ef0);})[_0x38f9('0x40')](function(_0x35b536){ut['logger'](_0x38f9('0x4d'),_0x35b536);});}else{ut[_0x38f9('0x4b')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x38f9('0x1d')][_0x38f9('0x4e')]=function(_0x157356,_0x23bfb3,_0x26c278){var _0x4bcbf9=this;var _0x3c367d={};if(_0x23bfb3){_0x3c367d={'read':_0x23bfb3};}else{_0x3c367d={'failMessage':_0x26c278};}if(this['actions'][_0x157356][_0x38f9('0x48')]){faxMessage[_0x38f9('0x49')](this[_0x38f9('0xf')][_0x157356][_0x38f9('0x48')],_0x3c367d)[_0x38f9('0x3d')](function(_0x6cf443){ut[_0x38f9('0x4b')](_0x38f9('0x4f'),_0x6cf443);})['catch'](function(_0x190a79){ut[_0x38f9('0x4b')](_0x38f9('0x50'),_0x190a79);})[_0x38f9('0x51')](function(){delete _0x4bcbf9[_0x38f9('0x22')][_0x157356];delete _0x4bcbf9[_0x38f9('0xf')][_0x157356];});}else{ut[_0x38f9('0x4b')](_0x38f9('0x52'));this[_0x38f9('0x53')](_0x157356);delete this[_0x38f9('0xf')][_0x157356];}};Fax['prototype']['syncHangup']=function(_0x514302){var _0x2df719=this;if(this[_0x38f9('0x22')][_0x514302[_0x38f9('0x23')]]){if(this[_0x38f9('0xf')][_0x514302[_0x38f9('0x23')]]){this[_0x38f9('0x22')][_0x514302['uniqueid']]['id']=this[_0x38f9('0xf')][_0x514302[_0x38f9('0x23')]]['id'];this[_0x38f9('0x22')][_0x514302[_0x38f9('0x23')]][_0x38f9('0x25')]=this[_0x38f9('0xf')][_0x514302[_0x38f9('0x23')]][_0x38f9('0x25')];}logger[_0x38f9('0x26')](_0x514302[_0x38f9('0x23')],this[_0x38f9('0xf')][_0x514302[_0x38f9('0x23')]]?_0x38f9('0x54'):_0x38f9('0x55'),JSON[_0x38f9('0x43')](this['channels'][_0x514302['uniqueid']]));if(this[_0x38f9('0xf')][_0x514302['uniqueid']]){if(this[_0x38f9('0x22')][_0x514302[_0x38f9('0x23')]][_0x38f9('0x56')]>0x0&&this[_0x38f9('0x22')][_0x514302[_0x38f9('0x23')]][_0x38f9('0x57')]==='SUCCESS'){this['updateStatus'](_0x514302[_0x38f9('0x23')],!![]);}else{this[_0x38f9('0x4e')](_0x514302['uniqueid'],![],this['channels'][_0x514302[_0x38f9('0x23')]][_0x38f9('0x58')]?_0x38f9('0x59')+this[_0x38f9('0x22')][_0x514302[_0x38f9('0x23')]][_0x38f9('0x58')]:_0x38f9('0x5a'));}}}};Fax[_0x38f9('0x1d')][_0x38f9('0x5b')]=function(_0x1c7d71){var _0x588b90=this;return new BPromise(function(_0x497732,_0x3ff442){_0x588b90[_0x38f9('0x5c')](_0x1c7d71,_0x588b90[_0x38f9('0xd')][_0x1c7d71[_0x38f9('0x5d')]])[_0x38f9('0x3d')](function(_0x2253de){ut[_0x38f9('0x4b')](_0x38f9('0x5e'),_0x2253de);_0x497732(ut[_0x38f9('0x38')](_0x38f9('0x5f')));})[_0x38f9('0x40')](function(_0x51e332){ut[_0x38f9('0x4b')](_0x38f9('0x60'),_0x51e332);updateStatus(_0x1c7d71);_0x3ff442(ut[_0x38f9('0x38')]('Fax\x20failed'));});});};Fax[_0x38f9('0x1d')][_0x38f9('0x61')]=function(_0x2a5dfa){var _0x2494d5=this;return new BPromise(function(_0x16a456,_0x2df84d){var _0x18e562=_0x2494d5['checkTrunk'](_0x2494d5[_0x38f9('0xd')][_0x2a5dfa['FaxAccountId']]['Trunk'],_0x2a5dfa);if(_0x18e562[_0x38f9('0x62')]){_0x16a456(ut[_0x38f9('0x38')](_0x38f9('0x63')));}else{_0x2df84d(ut[_0x38f9('0x38')](_0x18e562[_0x38f9('0x38')]));}});};function originate(_0x1aa424,_0x49f7be,_0x5dcb3a){return new BPromise(function(_0x5f02d8,_0xe0913){if(_0x5dcb3a){var _0x5a5b83=util[_0x38f9('0x64')](_0x38f9('0x65'),path['parse'](_0x1aa424[_0x38f9('0x4')])['name'],_0x1aa424[_0x38f9('0x4')]);gs[_0x38f9('0x66')](_0x5a5b83)[_0x38f9('0x3d')](function(){_0x1aa424[_0x38f9('0x4')]=util[_0x38f9('0x64')](_0x38f9('0x67'),path[_0x38f9('0x3a')](_0x1aa424[_0x38f9('0x4')])[_0x38f9('0x68')],path['parse'](_0x1aa424['path'])['name']);_0x49f7be[_0x38f9('0x69')]=_0x1aa424[_0x38f9('0x4')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x38f9('0x6a')](ut[_0x38f9('0x6b')](_0x1aa424,_0x49f7be))[_0x38f9('0x3d')](function(_0x58b170){_0x5f02d8(_0x58b170);})[_0x38f9('0x40')](function(_0x56365f){_0xe0913(_0x56365f);});})['catch'](function(_0x2664a4){_0xe0913(_0x2664a4);});}else{ami[_0x38f9('0x6a')](ut[_0x38f9('0x6b')](_0x1aa424,_0x49f7be))[_0x38f9('0x3d')](function(_0x4203de){_0x5f02d8(_0x4203de);})[_0x38f9('0x40')](function(_0xb53f6f){_0xe0913(_0xb53f6f);});}});}Fax['prototype'][_0x38f9('0x5c')]=function(_0x4dc4bf,_0x330a02){var _0x353b0d=this;return new BPromise(function(_0x1f1eec,_0x55f3ec){var _0x37dccc=uuid['v4']();var _0x346716=ut[_0x38f9('0x6c')](_0x4dc4bf,_0x330a02);_0x353b0d['actions'][_0x37dccc]=new Action(_0x37dccc,_0x330a02,_0x4dc4bf);var _0x210e53=_0x353b0d['actions'][_0x37dccc];if(path[_0x38f9('0x3a')](_0x4dc4bf[_0x38f9('0x4')])['ext']==='.pdf'){originate(_0x210e53,_0x346716,!![])[_0x38f9('0x3d')](function(_0x17722c){_0x1f1eec(_0x17722c);})[_0x38f9('0x40')](function(_0x55afaa){_0x55f3ec(_0x55afaa);});}else{originate(_0x210e53,_0x346716,![])[_0x38f9('0x3d')](function(_0x3cb206){_0x1f1eec(_0x3cb206);})[_0x38f9('0x40')](function(_0x1fa720){_0x55f3ec(_0x1fa720);});}});};Fax[_0x38f9('0x1d')]['isTrunkReachable']=function(_0x4009ef){return!_[_0x38f9('0x6d')](_0x4009ef)&&!_[_0x38f9('0x6d')](_0x4009ef[_0x38f9('0x25')])&&!_[_0x38f9('0x6d')](_0x4009ef['active'])&&_0x4009ef[_0x38f9('0x6e')]&&!_[_0x38f9('0x6d')](this[_0x38f9('0xe')][util[_0x38f9('0x64')](_0x38f9('0x6f'),_0x4009ef[_0x38f9('0x25')])])&&!_[_0x38f9('0x6d')](this[_0x38f9('0xe')][util[_0x38f9('0x64')](_0x38f9('0x6f'),_0x4009ef[_0x38f9('0x25')])][_0x38f9('0x2e')])&&(this['trunks'][util['format']('SIP/%s',_0x4009ef[_0x38f9('0x25')])][_0x38f9('0x2e')]===_0x38f9('0x70')||this[_0x38f9('0xe')][util[_0x38f9('0x64')]('SIP/%s',_0x4009ef[_0x38f9('0x25')])]['status']===_0x38f9('0x71'));};Fax[_0x38f9('0x1d')][_0x38f9('0x72')]=function(_0x584447,_0x2ab033){if(!this[_0x38f9('0x73')](_0x584447)){ut[_0x38f9('0x4b')](_0x38f9('0x74'),_[_0x38f9('0x6d')](_0x584447)?'':_0x584447['name']+_0x38f9('0x75'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x38f9('0x6d')](_0x2ab033[_0x38f9('0x3f')])){ut['logger'](_0x38f9('0x76'),JSON[_0x38f9('0x43')](_0x2ab033));return{'isValid':![],'message':_0x38f9('0x77')};}if(_[_0x38f9('0x6d')](_0x2ab033[_0x38f9('0x4')])){ut[_0x38f9('0x4b')](_0x38f9('0x78'),JSON[_0x38f9('0x43')](_0x2ab033));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x38f9('0x79')};};Fax[_0x38f9('0x1d')]['deleteChannelAfterTimeout']=function(_0x4589bc,_0x4bf42c=0x2710){if(this[_0x38f9('0x22')][_0x4589bc]){setTimeout(()=>{delete this[_0x38f9('0x22')][_0x4589bc];},_0x4bf42c);}};module[_0x38f9('0x7a')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f6d4bbd..4b5e7fe 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 _0xfed7=['[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x29d335,_0x4346a8){var _0x3b0563=function(_0x1fe7b2){while(--_0x1fe7b2){_0x29d335['push'](_0x29d335['shift']());}};_0x3b0563(++_0x4346a8);}(_0xfed7,0xfb));var _0x7fed=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xfed7[_0x1ee351];return _0x245aaf;};'use strict';var util=require(_0x7fed('0x0'));var BPromise=require(_0x7fed('0x1'));var logger=require(_0x7fed('0x2'))('preview');var _=require(_0x7fed('0x3'));var faxAccount=require(_0x7fed('0x4'));function loggerCatch(_0x3d6ed1){return function(_0x535a24){logger[_0x7fed('0x5')](_0x3d6ed1,util[_0x7fed('0x6')](_0x535a24,{'showHidden':![],'depth':null}));};}exports[_0x7fed('0x7')]=function(_0x551aab,_0x17640f){return BPromise[_0x7fed('0x8')]()['then'](faxAccount[_0x7fed('0x7')](_0x551aab,_0x17640f))['catch'](loggerCatch(_0x7fed('0x9')));}; \ No newline at end of file +var _0xd9e2=['../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0xd9e2,0xbe));var _0x2d9e=function(_0xa1eb2e,_0x2f4b19){_0xa1eb2e=_0xa1eb2e-0x0;var _0x55f5ff=_0xd9e2[_0xa1eb2e];return _0x55f5ff;};'use strict';var util=require(_0x2d9e('0x0'));var BPromise=require(_0x2d9e('0x1'));var logger=require(_0x2d9e('0x2'))(_0x2d9e('0x3'));var _=require(_0x2d9e('0x4'));var faxAccount=require(_0x2d9e('0x5'));function loggerCatch(_0x8e523){return function(_0x5918ab){logger[_0x2d9e('0x6')](_0x8e523,util[_0x2d9e('0x7')](_0x5918ab,{'showHidden':![],'depth':null}));};}exports[_0x2d9e('0x8')]=function(_0x5ec6d1,_0x5cac24){return BPromise[_0x2d9e('0x9')]()[_0x2d9e('0xa')](faxAccount[_0x2d9e('0x8')](_0x5ec6d1,_0x5cac24))[_0x2d9e('0xb')](loggerCatch(_0x2d9e('0xc')));}; \ 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 79d40fa..dc7d505 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 _0x13ed=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x335afe,_0x163f27){var _0x248dcd=function(_0x5c70ba){while(--_0x5c70ba){_0x335afe['push'](_0x335afe['shift']());}};_0x248dcd(++_0x163f27);}(_0x13ed,0x1f2));var _0xd13e=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x13ed[_0x5e3701];return _0x345dcf;};'use strict';var util=require(_0xd13e('0x0'));var logger=require(_0xd13e('0x1'))('fax');var BPromise=require(_0xd13e('0x2'));var exec=require(_0xd13e('0x3'))[_0xd13e('0x4')];exports[_0xd13e('0x5')]=function(_0x28ed88){return new BPromise(function(_0x19a905,_0x42ac5e){exec(_0x28ed88,function(_0x16bcc6,_0x389035,_0x3dc87d){logger[_0xd13e('0x6')]('Exec\x20gs',_0x389035);if(_0x16bcc6){logger[_0xd13e('0x6')](_0xd13e('0x7'),_0xd13e('0x8'),util[_0xd13e('0x9')](_0x16bcc6,{'showHidden':![],'depth':null}),_0x389035,_0x3dc87d);_0x42ac5e(_0x16bcc6);}_0x19a905(_0x389035);});});}; \ No newline at end of file +var _0xffed=['../../../../config/logger','fax','bluebird','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util'];(function(_0x349851,_0x5f0a0b){var _0x43577e=function(_0xdebd5d){while(--_0xdebd5d){_0x349851['push'](_0x349851['shift']());}};_0x43577e(++_0x5f0a0b);}(_0xffed,0x196));var _0xdffe=function(_0x2e5b3f,_0x52ee05){_0x2e5b3f=_0x2e5b3f-0x0;var _0x57659c=_0xffed[_0x2e5b3f];return _0x57659c;};'use strict';var util=require(_0xdffe('0x0'));var logger=require(_0xdffe('0x1'))(_0xdffe('0x2'));var BPromise=require(_0xdffe('0x3'));var exec=require(_0xdffe('0x4'))[_0xdffe('0x5')];exports[_0xdffe('0x6')]=function(_0x17ed3f){return new BPromise(function(_0x5ef1ff,_0x533a03){exec(_0x17ed3f,function(_0x6e9ae3,_0x31edb4,_0x37d4d7){logger['info'](_0xdffe('0x7'),_0x31edb4);if(_0x6e9ae3){logger[_0xdffe('0x8')](_0xdffe('0x7'),_0xdffe('0x9'),util[_0xdffe('0xa')](_0x6e9ae3,{'showHidden':![],'depth':null}),_0x31edb4,_0x37d4d7);_0x533a03(_0x6e9ae3);}_0x5ef1ff(_0x31edb4);});});}; \ 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 9bd906d..bb6e277 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 _0xc9d4=['../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment'];(function(_0x504fa7,_0x11a97b){var _0x11986f=function(_0x89a311){while(--_0x89a311){_0x504fa7['push'](_0x504fa7['shift']());}};_0x11986f(++_0x11a97b);}(_0xc9d4,0xf0));var _0x4c9d=function(_0x203a6d,_0x20da4c){_0x203a6d=_0x203a6d-0x0;var _0x132fa8=_0xc9d4[_0x203a6d];return _0x132fa8;};'use strict';var util=require(_0x4c9d('0x0'));var _=require(_0x4c9d('0x1'));var moment=require(_0x4c9d('0x2'));var logger=require(_0x4c9d('0x3'))(_0x4c9d('0x4'));exports[_0x4c9d('0x5')]=function(_0x4202cf){return{'message':_0x4202cf};};exports[_0x4c9d('0x6')]=function(_0x33f939,_0x231e0e){logger[_0x4c9d('0x7')](_0x33f939,util[_0x4c9d('0x8')](_0x231e0e,{'showHidden':![],'depth':null}));};exports[_0x4c9d('0x9')]=function(_0x21d81d,_0xd7e665){var _0xb576c2={'XMF-ECM':_0xd7e665['ecm'],'XMF-HEADERINFO':_0xd7e665[_0x4c9d('0xa')],'XMF-MINRATE':_0xd7e665['minrate'],'XMF-MAXRATE':_0xd7e665[_0x4c9d('0xb')],'XMF-MODEM':util[_0x4c9d('0xc')](_0x4c9d('0xd'),_0xd7e665[_0x4c9d('0xe')]),'XMF-GATEWAY':_0xd7e665[_0x4c9d('0xf')],'XMF-FAXDETECT':_0xd7e665[_0x4c9d('0x10')],'XMF-T38TIMEOUT':_0xd7e665[_0x4c9d('0x11')],'XMF-LOCALSTATIONID':_0xd7e665[_0x4c9d('0x12')],'XMF-PATH':_0x21d81d[_0x4c9d('0x13')]};return _0xb576c2;};exports[_0x4c9d('0x14')]=function(_0x497d13,_0x5352e8){return{'actionid':_0x497d13[_0x4c9d('0x15')],'action':_0x4c9d('0x16'),'channel':_0x497d13[_0x4c9d('0x17')],'Exten':_0x4c9d('0x18'),'Context':_0x4c9d('0x19'),'Priority':'1','callerid':util['format'](_0x4c9d('0x1a'),_0x497d13[_0x4c9d('0xa')]?_0x497d13['headerinfo']:'',_0x497d13['localstationid']),'variable':_0x5352e8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x497d13[_0x4c9d('0x15')]};}; \ No newline at end of file +var _0x8120=['modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','fax','logger','info','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22'];(function(_0x41edee,_0x34f2f9){var _0x873a81=function(_0x49011d){while(--_0x49011d){_0x41edee['push'](_0x41edee['shift']());}};_0x873a81(++_0x34f2f9);}(_0x8120,0x152));var _0x0812=function(_0x1ad23b,_0x3b6a85){_0x1ad23b=_0x1ad23b-0x0;var _0x647258=_0x8120[_0x1ad23b];return _0x647258;};'use strict';var util=require(_0x0812('0x0'));var _=require(_0x0812('0x1'));var moment=require(_0x0812('0x2'));var logger=require('../../../../config/logger')(_0x0812('0x3'));exports['message']=function(_0x372cdd){return{'message':_0x372cdd};};exports[_0x0812('0x4')]=function(_0x28fc31,_0x38130b){logger[_0x0812('0x5')](_0x28fc31,util['inspect'](_0x38130b,{'showHidden':![],'depth':null}));};exports[_0x0812('0x6')]=function(_0x37f424,_0x5f2fbf){var _0x5f5467={'XMF-ECM':_0x5f2fbf[_0x0812('0x7')],'XMF-HEADERINFO':_0x5f2fbf[_0x0812('0x8')],'XMF-MINRATE':_0x5f2fbf['minrate'],'XMF-MAXRATE':_0x5f2fbf[_0x0812('0x9')],'XMF-MODEM':util[_0x0812('0xa')](_0x0812('0xb'),_0x5f2fbf[_0x0812('0xc')]),'XMF-GATEWAY':_0x5f2fbf[_0x0812('0xd')],'XMF-FAXDETECT':_0x5f2fbf[_0x0812('0xe')],'XMF-T38TIMEOUT':_0x5f2fbf[_0x0812('0xf')],'XMF-LOCALSTATIONID':_0x5f2fbf[_0x0812('0x10')],'XMF-PATH':_0x37f424[_0x0812('0x11')]};return _0x5f5467;};exports[_0x0812('0x12')]=function(_0x5492f8,_0x1f6007){return{'actionid':_0x5492f8[_0x0812('0x13')],'action':_0x0812('0x14'),'channel':_0x5492f8[_0x0812('0x15')],'Exten':_0x0812('0x16'),'Context':_0x0812('0x17'),'Priority':'1','callerid':util[_0x0812('0xa')](_0x0812('0x18'),_0x5492f8[_0x0812('0x8')]?_0x5492f8[_0x0812('0x8')]:'',_0x5492f8['localstationid']),'variable':_0x1f6007,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5492f8[_0x0812('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 12d59a7..a38722e 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 _0x6000=['./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk'];(function(_0x46ac08,_0x1f4418){var _0x525ea7=function(_0x1932c9){while(--_0x1932c9){_0x46ac08['push'](_0x46ac08['shift']());}};_0x525ea7(++_0x1f4418);}(_0x6000,0x77));var _0x0600=function(_0xafd54c,_0x4cf5e5){_0xafd54c=_0xafd54c-0x0;var _0x5686f2=_0x6000[_0xafd54c];return _0x5686f2;};'use strict';var util=require(_0x0600('0x0'));var moment=require(_0x0600('0x1'));var server=require(_0x0600('0x2'));var Realtime=require(_0x0600('0x3'));var Report=require(_0x0600('0x4'));var Acw=require(_0x0600('0x5'));var Trigger=require(_0x0600('0x6'));var Dialer=require(_0x0600('0x7'));var Preview=require('./preview');var Fax=require(_0x0600('0x8'));var user=require(_0x0600('0x9'));var voiceQueue=require(_0x0600('0xa'));var voiceQueueReport=require(_0x0600('0xb'));var voiceCallReport=require(_0x0600('0xc'));var trunk=require(_0x0600('0xd'));var trigger=require('./rpc/trigger');var template=require(_0x0600('0xe'));var cmHopperHistory=require(_0x0600('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x0600('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x0600('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x0600('0x12'));var desk=require(_0x0600('0x13'));var zoho=require(_0x0600('0x14'));var vtiger=require(_0x0600('0x15'));var freshsales=require(_0x0600('0x16'));var servicenow=require(_0x0600('0x17'));var dynamics365=require(_0x0600('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0600('0x19'))(_0x0600('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0600('0x1b')](_0x0600('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0600('0x1b')](_0x0600('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x0600('0x1d')]()[_0x0600('0x1e')](user['getAgents']())[_0x0600('0x1e')](realtime['initAgents']())['then'](user[_0x0600('0x1f')]())[_0x0600('0x1e')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x0600('0x1e')](realtime[_0x0600('0x20')]())[_0x0600('0x1e')](voiceQueue[_0x0600('0x21')]())['then'](realtime[_0x0600('0x22')]())[_0x0600('0x1e')](trigger[_0x0600('0x23')]())['then'](realtime[_0x0600('0x24')]())[_0x0600('0x1e')](template[_0x0600('0x25')]())[_0x0600('0x1e')](realtime[_0x0600('0x26')]())[_0x0600('0x1e')](zendesk[_0x0600('0x27')]())[_0x0600('0x1e')](realtime['initZendeskAccounts']())['then'](salesforce[_0x0600('0x28')]())[_0x0600('0x1e')](realtime[_0x0600('0x29')]())[_0x0600('0x1e')](sugarcrm[_0x0600('0x2a')]())[_0x0600('0x1e')](realtime[_0x0600('0x2b')]())['then'](freshdesk[_0x0600('0x2c')]())[_0x0600('0x1e')](realtime[_0x0600('0x2d')]())['then'](desk[_0x0600('0x2e')]())[_0x0600('0x1e')](realtime[_0x0600('0x2f')]())[_0x0600('0x1e')](zoho['getZohoAccounts']())[_0x0600('0x1e')](realtime['initZohoAccounts']())[_0x0600('0x1e')](vtiger[_0x0600('0x30')]())[_0x0600('0x1e')](realtime[_0x0600('0x31')]())[_0x0600('0x1e')](freshsales[_0x0600('0x32')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x0600('0x33')]())[_0x0600('0x1e')](realtime[_0x0600('0x34')]())['then'](dynamics365[_0x0600('0x35')]())['then'](realtime['initDynamics365Accounts']())['then'](campaign[_0x0600('0x36')]())[_0x0600('0x1e')](realtime['initCampaigns']())[_0x0600('0x1e')](voiceExtension[_0x0600('0x37')]())[_0x0600('0x1e')](realtime[_0x0600('0x38')]())[_0x0600('0x1e')](faxAccount['getFaxAccounts']())[_0x0600('0x1e')](realtime[_0x0600('0x39')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x0600('0x1d')]()[_0x0600('0x1e')](voiceQueueReport[_0x0600('0x3a')]())[_0x0600('0x1e')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x0600('0x3b')]())[_0x0600('0x1e')](realtime[_0x0600('0x3c')]())[_0x0600('0x1e')](cmHopperHistory[_0x0600('0x3d')]())[_0x0600('0x1e')](realtime[_0x0600('0x3e')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x0600('0x1e')](realtime[_0x0600('0x3f')]())[_0x0600('0x40')](function(_0x47dffb){logger[_0x0600('0x41')](_0x0600('0x42'),util[_0x0600('0x43')](_0x47dffb,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x0600('0x1e')](function(){return initRealtime();})[_0x0600('0x1e')](function(){return initParams();})[_0x0600('0x1e')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0xbc611c){logger[_0x0600('0x41')](_0x0600('0x44'),util['inspect'](_0xbc611c,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x77b7=['resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTemplates','getZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','listen','error','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour'];(function(_0x3f62d8,_0x4ebd4a){var _0x4a649d=function(_0x2b69dc){while(--_0x2b69dc){_0x3f62d8['push'](_0x3f62d8['shift']());}};_0x4a649d(++_0x4ebd4a);}(_0x77b7,0xeb));var _0x777b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x77b7[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require(_0x777b('0x0'));var moment=require(_0x777b('0x1'));var server=require(_0x777b('0x2'));var Realtime=require(_0x777b('0x3'));var Report=require(_0x777b('0x4'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x777b('0x5'));var Preview=require(_0x777b('0x6'));var Fax=require(_0x777b('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x777b('0x8'));var voiceQueueReport=require(_0x777b('0x9'));var voiceCallReport=require(_0x777b('0xa'));var trunk=require(_0x777b('0xb'));var trigger=require('./rpc/trigger');var template=require(_0x777b('0xc'));var cmHopperHistory=require(_0x777b('0xd'));var campaign=require(_0x777b('0xe'));var voiceExtension=require(_0x777b('0xf'));var faxAccount=require(_0x777b('0x10'));var zendesk=require(_0x777b('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x777b('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x777b('0x13'));var servicenow=require(_0x777b('0x14'));var dynamics365=require(_0x777b('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x777b('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x777b('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x777b('0x17')](_0x777b('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x777b('0x19')]()[_0x777b('0x1a')](user['getAgents']())[_0x777b('0x1a')](realtime[_0x777b('0x1b')]())[_0x777b('0x1a')](user[_0x777b('0x1c')]())[_0x777b('0x1a')](realtime[_0x777b('0x1d')]())[_0x777b('0x1a')](trunk[_0x777b('0x1e')]())[_0x777b('0x1a')](realtime[_0x777b('0x1f')]())[_0x777b('0x1a')](voiceQueue['getVoiceQueues']())[_0x777b('0x1a')](realtime[_0x777b('0x20')]())[_0x777b('0x1a')](trigger['getTriggers']())[_0x777b('0x1a')](realtime['initTriggers']())[_0x777b('0x1a')](template['getTemplates']())[_0x777b('0x1a')](realtime[_0x777b('0x21')]())[_0x777b('0x1a')](zendesk[_0x777b('0x22')]())['then'](realtime['initZendeskAccounts']())['then'](salesforce['getSalesforceAccounts']())[_0x777b('0x1a')](realtime[_0x777b('0x23')]())[_0x777b('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x777b('0x1a')](realtime['initSugarcrmAccounts']())[_0x777b('0x1a')](freshdesk['getFreshdeskAccounts']())[_0x777b('0x1a')](realtime[_0x777b('0x24')]())[_0x777b('0x1a')](desk[_0x777b('0x25')]())[_0x777b('0x1a')](realtime[_0x777b('0x26')]())[_0x777b('0x1a')](zoho[_0x777b('0x27')]())[_0x777b('0x1a')](realtime[_0x777b('0x28')]())[_0x777b('0x1a')](vtiger[_0x777b('0x29')]())[_0x777b('0x1a')](realtime['initVtigerAccounts']())['then'](freshsales['getFreshsalesAccounts']())[_0x777b('0x1a')](realtime[_0x777b('0x2a')]())[_0x777b('0x1a')](servicenow['getServicenowAccounts']())[_0x777b('0x1a')](realtime[_0x777b('0x2b')]())[_0x777b('0x1a')](dynamics365[_0x777b('0x2c')]())[_0x777b('0x1a')](realtime[_0x777b('0x2d')]())[_0x777b('0x1a')](campaign[_0x777b('0x2e')]())[_0x777b('0x1a')](realtime[_0x777b('0x2f')]())['then'](voiceExtension[_0x777b('0x30')]())[_0x777b('0x1a')](realtime[_0x777b('0x31')]())[_0x777b('0x1a')](faxAccount[_0x777b('0x32')]())[_0x777b('0x1a')](realtime[_0x777b('0x33')]())[_0x777b('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x777b('0x19')]()[_0x777b('0x1a')](voiceQueueReport[_0x777b('0x34')]())['then'](realtime[_0x777b('0x35')]())[_0x777b('0x1a')](cmHopperHistory[_0x777b('0x36')]())[_0x777b('0x1a')](realtime[_0x777b('0x37')]())[_0x777b('0x1a')](cmHopperHistory[_0x777b('0x38')]())[_0x777b('0x1a')](realtime['initCampaignHopperHistory']())[_0x777b('0x1a')](voiceCallReport[_0x777b('0x39')]())[_0x777b('0x1a')](realtime[_0x777b('0x3a')]())[_0x777b('0x3b')](function(_0x3d9afd){logger['error'](_0x777b('0x3c'),util['inspect'](_0x3d9afd,{'showHidden':![],'depth':null}));});}function main(){return server[_0x777b('0x3d')](realtime,preview,fax)[_0x777b('0x1a')](function(){return initRealtime();})[_0x777b('0x1a')](function(){return initParams();})[_0x777b('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x5c6c2f){logger[_0x777b('0x3e')](_0x777b('0x3f'),util[_0x777b('0x40')](_0x5c6c2f,{'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 8848604..626a822 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 _0x34ac=['md5','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','interface','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','state','online','stringify','format','user:%s','user:ami:update','omit','emit','lodash','moment'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0x34ac,0x70));var _0xc34a=function(_0x234fdc,_0x55471c){_0x234fdc=_0x234fdc-0x0;var _0x58a1aa=_0x34ac[_0x234fdc];return _0x58a1aa;};'use strict';var _=require(_0xc34a('0x0'));var util=require('util');var moment=require(_0xc34a('0x1'));var md5=require(_0xc34a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0xc34a('0x3'),'port':0x18eb});var io=require(_0xc34a('0x4'))(new Redis(config['redis']));function Agent(_0x2c6e9c){this['id']=_0x2c6e9c['id']||0x0;this[_0xc34a('0x5')]=_0x2c6e9c[_0xc34a('0x5')]||'';this['email']=_0x2c6e9c[_0xc34a('0x6')]||'';this[_0xc34a('0x7')]=_0x2c6e9c[_0xc34a('0x7')]||'';this[_0xc34a('0x8')]=_0x2c6e9c[_0xc34a('0x8')]||'';this['state']=_0xc34a('0x9');this[_0xc34a('0xa')]=0x0;this[_0xc34a('0xb')]='unknown';this[_0xc34a('0xc')]='';this[_0xc34a('0xd')]='';this['mobile']='';this[_0xc34a('0xe')]='';this['online']=_0x2c6e9c['online']||![];this[_0xc34a('0xf')]=_0xc34a('0x9');this[_0xc34a('0x10')]=0x0;this[_0xc34a('0x11')]='';this[_0xc34a('0x12')]='';this[_0xc34a('0x13')]=![];this[_0xc34a('0x14')]=![];this['md5']='';}Agent[_0xc34a('0x15')][_0xc34a('0x16')]=function(_0x30a326){var _0x26a75f;if(_0x30a326&&_0x30a326['state']){_0x26a75f=_0x30a326['state'][_0xc34a('0x17')]();switch(_0x26a75f){case _0xc34a('0x18'):_0x26a75f=_0xc34a('0x19');break;case _0xc34a('0x1a'):_0x26a75f=_0xc34a('0x1b');break;}}if(_0x26a75f&&this['voiceStatus']!==_0x26a75f||_0x30a326[_0xc34a('0x1c')]){this[_0xc34a('0x10')]=_[_0xc34a('0x1d')](moment()['format']('x'));}if(_0x26a75f){this['voiceStatus']=_0x26a75f;}var _0x82107e={'id':this['id'],'name':this[_0xc34a('0x5')],'email':this[_0xc34a('0x6')],'accountcode':this[_0xc34a('0x7')],'fullname':this[_0xc34a('0x8')],'state':this[_0xc34a('0x1e')],'stateTime':this[_0xc34a('0xa')],'status':this[_0xc34a('0xb')],'address':this[_0xc34a('0xc')],'online':this[_0xc34a('0x1f')],'voiceStatus':this[_0xc34a('0xf')],'voiceStatusTime':this[_0xc34a('0x10')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xc34a('0x12')],'interface':this[_0xc34a('0xe')],'onhold':this[_0xc34a('0x13')]};var _0x476fb7=md5(JSON[_0xc34a('0x20')](_0x82107e));if(this[_0xc34a('0x2')]!==_0x476fb7){this[_0xc34a('0x2')]=_0x476fb7;io['to'](util[_0xc34a('0x21')](_0xc34a('0x22'),_0x82107e['name']))['emit'](_0xc34a('0x23'),_[_0xc34a('0x24')](_0x82107e,[_0xc34a('0x1f')]));io[_0xc34a('0x25')]('user:presence',_0x82107e);}};module['exports']=Agent; \ No newline at end of file +var _0xf71d=['user:presence','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','interface','online','voiceStatus','voiceStatusTime','onhold','local','state','not_inuse','idle','inuse','talking','statePause','format','voiceStatusCallerIdNumber','voiceStatusQueue','user:ami:update','omit'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0xf71d,0xda));var _0xdf71=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xf71d[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xdf71('0x0'));var util=require('util');var moment=require(_0xdf71('0x1'));var md5=require(_0xdf71('0x2'));var Redis=require(_0xdf71('0x3'));var config=require('../../../config/environment');config[_0xdf71('0x4')]=_[_0xdf71('0x5')](config[_0xdf71('0x4')],{'host':_0xdf71('0x6'),'port':0x18eb});var io=require(_0xdf71('0x7'))(new Redis(config[_0xdf71('0x4')]));function Agent(_0x707335){this['id']=_0x707335['id']||0x0;this[_0xdf71('0x8')]=_0x707335[_0xdf71('0x8')]||'';this[_0xdf71('0x9')]=_0x707335[_0xdf71('0x9')]||'';this['accountcode']=_0x707335[_0xdf71('0xa')]||'';this['fullname']=_0x707335[_0xdf71('0xb')]||'';this['state']=_0xdf71('0xc');this[_0xdf71('0xd')]=0x0;this[_0xdf71('0xe')]=_0xdf71('0xc');this[_0xdf71('0xf')]='';this[_0xdf71('0x10')]='';this['mobile']='';this[_0xdf71('0x11')]='';this[_0xdf71('0x12')]=_0x707335['online']||![];this[_0xdf71('0x13')]=_0xdf71('0xc');this[_0xdf71('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0xdf71('0x15')]=![];this[_0xdf71('0x16')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x4987b4){var _0x5e682e;if(_0x4987b4&&_0x4987b4[_0xdf71('0x17')]){_0x5e682e=_0x4987b4['state']['toLowerCase']();switch(_0x5e682e){case _0xdf71('0x18'):_0x5e682e=_0xdf71('0x19');break;case _0xdf71('0x1a'):_0x5e682e=_0xdf71('0x1b');break;}}if(_0x5e682e&&this['voiceStatus']!==_0x5e682e||_0x4987b4[_0xdf71('0x1c')]){this['voiceStatusTime']=_['toNumber'](moment()[_0xdf71('0x1d')]('x'));}if(_0x5e682e){this[_0xdf71('0x13')]=_0x5e682e;}var _0x379f5c={'id':this['id'],'name':this[_0xdf71('0x8')],'email':this[_0xdf71('0x9')],'accountcode':this[_0xdf71('0xa')],'fullname':this[_0xdf71('0xb')],'state':this[_0xdf71('0x17')],'stateTime':this['stateTime'],'status':this[_0xdf71('0xe')],'address':this[_0xdf71('0xf')],'online':this[_0xdf71('0x12')],'voiceStatus':this[_0xdf71('0x13')],'voiceStatusTime':this[_0xdf71('0x14')],'voiceStatusCallerIdNumber':this[_0xdf71('0x1e')],'voiceStatusQueue':this[_0xdf71('0x1f')],'interface':this[_0xdf71('0x11')],'onhold':this[_0xdf71('0x15')]};var _0x5018b1=md5(JSON['stringify'](_0x379f5c));if(this[_0xdf71('0x2')]!==_0x5018b1){this[_0xdf71('0x2')]=_0x5018b1;io['to'](util[_0xdf71('0x1d')]('user:%s',_0x379f5c['name']))['emit'](_0xdf71('0x20'),_[_0xdf71('0x21')](_0x379f5c,[_0xdf71('0x12')]));io['emit'](_0xdf71('0x22'),_0x379f5c);}};module[_0xdf71('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 870b9c8..a9efb09 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 _0x3791=['Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x496790,_0x3de1ef){var _0x5e7fe1=function(_0x3b6304){while(--_0x3b6304){_0x496790['push'](_0x496790['shift']());}};_0x5e7fe1(++_0x3de1ef);}(_0x3791,0x184));var _0x1379=function(_0x3bc630,_0xfcae02){_0x3bc630=_0x3bc630-0x0;var _0x2cef17=_0x3791[_0x3bc630];return _0x2cef17;};'use strict';function Campaign(_0x45a209){this['id']=_0x45a209['id']||0x0;this[_0x1379('0x0')]=_0x45a209['name']||'';this['type']=_0x45a209['type']||_0x1379('0x1');this[_0x1379('0x2')]=0x0;this['temp']=0x0;this[_0x1379('0x3')]=0x0;this[_0x1379('0x4')]=0x0;this[_0x1379('0x5')]='';this[_0x1379('0x6')]=!![];this[_0x1379('0x7')]=_0x45a209[_0x1379('0x7')];this['limitCalls']=_0x45a209[_0x1379('0x8')];this[_0x1379('0x9')]=_0x45a209['dialTimezone']||null;this[_0x1379('0xa')]=_0x45a209[_0x1379('0xa')]?_0x45a209[_0x1379('0xa')]:null;this[_0x1379('0xb')]=_0x45a209['dialOriginateCallerIdName'];this[_0x1379('0xc')]=_0x45a209[_0x1379('0xc')];this['dialOriginateTimeout']=_0x45a209[_0x1379('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x45a209['dialCongestionMaxRetry'];this[_0x1379('0xe')]=_0x45a209[_0x1379('0xe')];this[_0x1379('0xf')]=_0x45a209[_0x1379('0xf')];this['dialBusyRetryFrequency']=_0x45a209[_0x1379('0x10')];this['dialNoAnswerMaxRetry']=_0x45a209['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x45a209['dialNoAnswerRetryFrequency'];this[_0x1379('0x11')]=_0x45a209[_0x1379('0x11')];this['dialNoSuchNumberMaxRetry']=_0x45a209[_0x1379('0x12')]||0x3;this[_0x1379('0x13')]=_0x45a209['dialNoSuchNumberRetryFrequency']||0x96;this[_0x1379('0x14')]=_0x45a209['dialDropMaxRetry']||0x3;this[_0x1379('0x15')]=_0x45a209[_0x1379('0x15')]||0x96;this[_0x1379('0x16')]=_0x45a209[_0x1379('0x16')]||0x3;this[_0x1379('0x17')]=_0x45a209['dialAbandonedRetryFrequency']||0x96;this[_0x1379('0x18')]=_0x45a209[_0x1379('0x18')]||0x3;this[_0x1379('0x19')]=_0x45a209[_0x1379('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0x45a209[_0x1379('0x1a')]||0x3;this[_0x1379('0x1b')]=_0x45a209[_0x1379('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x45a209[_0x1379('0x1c')]||_0x1379('0x1d');this['dialPrefix']=_0x45a209[_0x1379('0x1e')]||undefined;this[_0x1379('0x1f')]=_0x45a209[_0x1379('0x1f')]||undefined;this[_0x1379('0x20')]=_0x45a209['dialCutDigit']||undefined;this[_0x1379('0x21')]=_0x45a209[_0x1379('0x21')]?_0x45a209[_0x1379('0x21')]:undefined;this[_0x1379('0x22')]=_0x45a209[_0x1379('0x22')]?_0x45a209[_0x1379('0x22')]:undefined;this[_0x1379('0x23')]=_0x45a209[_0x1379('0x23')]?_0x45a209['Interval']:undefined;this['SquareProject']=_0x45a209[_0x1379('0x24')]?_0x45a209['SquareProject']:undefined;this['dialQueueProject']=_0x45a209[_0x1379('0x24')]?_0x45a209[_0x1379('0x24')][_0x1379('0x0')]:undefined;this[_0x1379('0x25')]=_0x45a209[_0x1379('0x25')]||![];this[_0x1379('0x26')]=_0x45a209['dialAMDInitialSilence'];this[_0x1379('0x27')]=_0x45a209['dialAMDGreeting'];this[_0x1379('0x28')]=_0x45a209[_0x1379('0x28')];this['dialAMDTotalAnalysisTime']=_0x45a209[_0x1379('0x29')];this['dialAMDMinWordLength']=_0x45a209[_0x1379('0x2a')];this[_0x1379('0x2b')]=_0x45a209[_0x1379('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x45a209['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x45a209[_0x1379('0x2c')];this['dialAMDMaximumWordLength']=_0x45a209[_0x1379('0x2d')];}module[_0x1379('0x2e')]=Campaign; \ No newline at end of file +var _0x94c3=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x273182,_0x3be797){var _0x343441=function(_0x2dafd){while(--_0x2dafd){_0x273182['push'](_0x273182['shift']());}};_0x343441(++_0x3be797);}(_0x94c3,0x92));var _0x394c=function(_0x5b04e4,_0x2849c1){_0x5b04e4=_0x5b04e4-0x0;var _0x17e034=_0x94c3[_0x5b04e4];return _0x17e034;};'use strict';function Campaign(_0x552883){this['id']=_0x552883['id']||0x0;this['name']=_0x552883[_0x394c('0x0')]||'';this['type']=_0x552883[_0x394c('0x1')]||_0x394c('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x394c('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x394c('0x4')]='';this[_0x394c('0x5')]=!![];this[_0x394c('0x6')]=_0x552883[_0x394c('0x6')];this[_0x394c('0x7')]=_0x552883['limitCalls'];this[_0x394c('0x8')]=_0x552883[_0x394c('0x8')]||null;this[_0x394c('0x9')]=_0x552883['dialGlobalInterval']?_0x552883[_0x394c('0x9')]:null;this[_0x394c('0xa')]=_0x552883[_0x394c('0xa')];this[_0x394c('0xb')]=_0x552883['dialOriginateCallerIdNumber'];this[_0x394c('0xc')]=_0x552883[_0x394c('0xc')]||0x1e;this[_0x394c('0xd')]=_0x552883[_0x394c('0xd')];this[_0x394c('0xe')]=_0x552883[_0x394c('0xe')];this['dialBusyMaxRetry']=_0x552883[_0x394c('0xf')];this[_0x394c('0x10')]=_0x552883['dialBusyRetryFrequency'];this[_0x394c('0x11')]=_0x552883[_0x394c('0x11')];this[_0x394c('0x12')]=_0x552883[_0x394c('0x12')];this['dialGlobalMaxRetry']=_0x552883['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x552883['dialNoSuchNumberMaxRetry']||0x3;this[_0x394c('0x13')]=_0x552883[_0x394c('0x13')]||0x96;this[_0x394c('0x14')]=_0x552883[_0x394c('0x14')]||0x3;this[_0x394c('0x15')]=_0x552883[_0x394c('0x15')]||0x96;this[_0x394c('0x16')]=_0x552883[_0x394c('0x16')]||0x3;this['dialAbandonedRetryFrequency']=_0x552883['dialAbandonedRetryFrequency']||0x96;this[_0x394c('0x17')]=_0x552883[_0x394c('0x17')]||0x3;this[_0x394c('0x18')]=_0x552883[_0x394c('0x18')]||0x96;this[_0x394c('0x19')]=_0x552883[_0x394c('0x19')]||0x3;this[_0x394c('0x1a')]=_0x552883['dialAgentRejectRetryFrequency']||0x96;this[_0x394c('0x1b')]=_0x552883['dialOrderByScheduledAt']||_0x394c('0x1c');this[_0x394c('0x1d')]=_0x552883['dialPrefix']||undefined;this[_0x394c('0x1e')]=_0x552883['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x394c('0x1f')]=_0x552883[_0x394c('0x1f')]||undefined;this[_0x394c('0x20')]=_0x552883[_0x394c('0x20')]?_0x552883[_0x394c('0x20')]:undefined;this[_0x394c('0x21')]=_0x552883[_0x394c('0x21')]?_0x552883[_0x394c('0x21')]:undefined;this[_0x394c('0x22')]=_0x552883[_0x394c('0x22')]?_0x552883['Interval']:undefined;this['SquareProject']=_0x552883[_0x394c('0x23')]?_0x552883[_0x394c('0x23')]:undefined;this[_0x394c('0x24')]=_0x552883[_0x394c('0x23')]?_0x552883[_0x394c('0x23')]['name']:undefined;this[_0x394c('0x25')]=_0x552883['dialAMDActive']||![];this[_0x394c('0x26')]=_0x552883[_0x394c('0x26')];this[_0x394c('0x27')]=_0x552883[_0x394c('0x27')];this[_0x394c('0x28')]=_0x552883[_0x394c('0x28')];this[_0x394c('0x29')]=_0x552883[_0x394c('0x29')];this[_0x394c('0x2a')]=_0x552883[_0x394c('0x2a')];this[_0x394c('0x2b')]=_0x552883['dialAMDBetweenWordsSilence'];this[_0x394c('0x2c')]=_0x552883[_0x394c('0x2c')];this[_0x394c('0x2d')]=_0x552883[_0x394c('0x2d')];this[_0x394c('0x2e')]=_0x552883[_0x394c('0x2e')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index b7bda60..92b717b 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 _0xfdb5=['type','disposition','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answertime','endtime','unmanaged','abandoned','lastdata','billableseconds','holdtime'];(function(_0x16ebba,_0x28fea7){var _0x160cb6=function(_0x5d1361){while(--_0x5d1361){_0x16ebba['push'](_0x16ebba['shift']());}};_0x160cb6(++_0x28fea7);}(_0xfdb5,0x18f));var _0x5fdb=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xfdb5[_0x38ced4];return _0x547c07;};'use strict';function Channel(){this[_0x5fdb('0x0')]=null;this['channel']='';this[_0x5fdb('0x1')]='';this[_0x5fdb('0x2')]=0x0;this[_0x5fdb('0x3')]='';this[_0x5fdb('0x4')]=undefined;this[_0x5fdb('0x5')]=undefined;this[_0x5fdb('0x6')]=0x0;this[_0x5fdb('0x7')]='';this[_0x5fdb('0x8')]=0x0;this['linkedid']=0x0;this[_0x5fdb('0x9')]=0x0;this['answered']=![];this[_0x5fdb('0xa')]=null;this[_0x5fdb('0xb')]=null;this[_0x5fdb('0xc')]=![];this[_0x5fdb('0xd')]=![];this['lastapplication']='';this[_0x5fdb('0xe')]='';this['duration']=0x0;this[_0x5fdb('0xf')]=0x0;this[_0x5fdb('0x10')]=0x0;this[_0x5fdb('0x11')]=null;this['tag']=null;this[_0x5fdb('0x12')]=null;this[_0x5fdb('0x13')]=![];this[_0x5fdb('0x14')]=null;this['queue']=null;this['monitors']=[];this[_0x5fdb('0x15')]=undefined;this[_0x5fdb('0x16')]=undefined;this[_0x5fdb('0x17')]=undefined;this[_0x5fdb('0x18')]=0x0;}module[_0x5fdb('0x19')]=Channel; \ No newline at end of file +var _0x00ea=['abandoned','lastapplication','duration','billableseconds','type','tag','disposition','monitorFilename','queue','transfercalleridnum','transferType','mohtime','exports','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime'];(function(_0x2140d3,_0x45bb8d){var _0x3825fe=function(_0x180bd6){while(--_0x180bd6){_0x2140d3['push'](_0x2140d3['shift']());}};_0x3825fe(++_0x45bb8d);}(_0x00ea,0x19d));var _0xa00e=function(_0x4b678f,_0x5ae287){_0x4b678f=_0x4b678f-0x0;var _0x11d7ac=_0x00ea[_0x4b678f];return _0x11d7ac;};'use strict';function Channel(){this['starttime']=null;this[_0xa00e('0x0')]='';this[_0xa00e('0x1')]='';this['calleridnum']=0x0;this[_0xa00e('0x2')]='';this[_0xa00e('0x3')]=undefined;this[_0xa00e('0x4')]=undefined;this[_0xa00e('0x5')]=0x0;this[_0xa00e('0x6')]='';this[_0xa00e('0x7')]=0x0;this['linkedid']=0x0;this[_0xa00e('0x8')]=0x0;this[_0xa00e('0x9')]=![];this[_0xa00e('0xa')]=null;this[_0xa00e('0xb')]=null;this['unmanaged']=![];this[_0xa00e('0xc')]=![];this[_0xa00e('0xd')]='';this['lastdata']='';this[_0xa00e('0xe')]=0x0;this[_0xa00e('0xf')]=0x0;this['holdtime']=0x0;this[_0xa00e('0x10')]=null;this[_0xa00e('0x11')]=null;this[_0xa00e('0x12')]=null;this['monitor']=![];this[_0xa00e('0x13')]=null;this[_0xa00e('0x14')]=null;this['monitors']=[];this[_0xa00e('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xa00e('0x16')]=undefined;this[_0xa00e('0x17')]=0x0;}module[_0xa00e('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index f031b1a..61c7e4d 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 _0xef9f=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x41d61d,_0x16ee95){var _0x35e06f=function(_0x41ebcf){while(--_0x41ebcf){_0x41d61d['push'](_0x41d61d['shift']());}};_0x35e06f(++_0x16ee95);}(_0xef9f,0x8f));var _0xfef9=function(_0x12ce75,_0x393661){_0x12ce75=_0x12ce75-0x0;var _0x521554=_0xef9f[_0x12ce75];return _0x521554;};'use strict';function DeskAccount(_0x7fea36){this['id']=_0x7fea36['id']||0x0;this[_0xfef9('0x0')]=_0x7fea36[_0xfef9('0x0')]||'';this[_0xfef9('0x1')]=_0x7fea36[_0xfef9('0x1')]||'';this[_0xfef9('0x2')]=_0x7fea36[_0xfef9('0x2')]||'';this[_0xfef9('0x3')]=_0x7fea36[_0xfef9('0x3')]||'';this['password']=_0x7fea36[_0xfef9('0x4')]||'';this['consumerKey']=_0x7fea36[_0xfef9('0x5')]||'';this[_0xfef9('0x6')]=_0x7fea36[_0xfef9('0x6')]||'';this[_0xfef9('0x7')]=_0x7fea36[_0xfef9('0x7')]||'';this[_0xfef9('0x8')]=_0x7fea36[_0xfef9('0x8')]||'';this[_0xfef9('0x9')]=_0x7fea36['type']||'';this[_0xfef9('0xa')]=_0x7fea36[_0xfef9('0xa')]||'';this[_0xfef9('0xb')]=_0x7fea36[_0xfef9('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x001b=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x1a3be4,_0x2b7e2b){var _0xcd3271=function(_0x49b1d3){while(--_0x49b1d3){_0x1a3be4['push'](_0x1a3be4['shift']());}};_0xcd3271(++_0x2b7e2b);}(_0x001b,0x75));var _0xb001=function(_0x4607ca,_0x1a223b){_0x4607ca=_0x4607ca-0x0;var _0x95941c=_0x001b[_0x4607ca];return _0x95941c;};'use strict';function DeskAccount(_0x398fa0){this['id']=_0x398fa0['id']||0x0;this[_0xb001('0x0')]=_0x398fa0['name']||'';this['username']=_0x398fa0[_0xb001('0x1')]||'';this[_0xb001('0x2')]=_0x398fa0[_0xb001('0x2')]||'';this[_0xb001('0x3')]=_0x398fa0['authType']||'';this[_0xb001('0x4')]=_0x398fa0['password']||'';this[_0xb001('0x5')]=_0x398fa0[_0xb001('0x5')]||'';this[_0xb001('0x6')]=_0x398fa0['consumerSecret']||'';this[_0xb001('0x7')]=_0x398fa0[_0xb001('0x7')]||'';this[_0xb001('0x8')]=_0x398fa0[_0xb001('0x8')]||'';this[_0xb001('0x9')]=_0x398fa0['type']||'';this['serverUrl']=_0x398fa0[_0xb001('0xa')]||'';this[_0xb001('0xb')]=_0x398fa0[_0xb001('0xb')]||{};}module[_0xb001('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index fb3128e..bd13cbd 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 _0x9220=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x1953af,_0x5e86ed){var _0x3b0a7f=function(_0x300818){while(--_0x300818){_0x1953af['push'](_0x1953af['shift']());}};_0x3b0a7f(++_0x5e86ed);}(_0x9220,0x1ef));var _0x0922=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x9220[_0x36884e];return _0x1cc367;};'use strict';function Dynamics365Account(_0x149850){this['id']=_0x149850['id']||0x0;this[_0x0922('0x0')]=_0x149850['name']||'';this[_0x0922('0x1')]=_0x149850[_0x0922('0x1')]||'';this[_0x0922('0x2')]=_0x149850[_0x0922('0x2')]||'';this[_0x0922('0x3')]=_0x149850['remoteUri']||'';this[_0x0922('0x4')]=_0x149850[_0x0922('0x4')]||'';this[_0x0922('0x5')]=_0x149850[_0x0922('0x5')]||'';this[_0x0922('0x6')]=_0x149850[_0x0922('0x6')]||{};this[_0x0922('0x7')]=_0x149850[_0x0922('0x7')]||'';this['modernAuthentication']=_0x149850[_0x0922('0x8')]||![];this[_0x0922('0x9')]=_0x149850[_0x0922('0x9')]||{};this[_0x0922('0xa')]=_0x149850[_0x0922('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x50a0=['Configurations','CloudProvider','exports','name','username','password','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x2fe0ea,_0x5e7b1e){var _0x2952e2=function(_0x10aa57){while(--_0x10aa57){_0x2fe0ea['push'](_0x2fe0ea['shift']());}};_0x2952e2(++_0x5e7b1e);}(_0x50a0,0x19a));var _0x050a=function(_0x35dda3,_0x340120){_0x35dda3=_0x35dda3-0x0;var _0x2b917f=_0x50a0[_0x35dda3];return _0x2b917f;};'use strict';function Dynamics365Account(_0x176b8e){this['id']=_0x176b8e['id']||0x0;this[_0x050a('0x0')]=_0x176b8e['name']||'';this[_0x050a('0x1')]=_0x176b8e['username']||'';this[_0x050a('0x2')]=_0x176b8e[_0x050a('0x2')]||'';this['remoteUri']=_0x176b8e['remoteUri']||'';this[_0x050a('0x3')]=_0x176b8e['tenantId']||'';this[_0x050a('0x4')]=_0x176b8e[_0x050a('0x4')]||'';this['clientSecret']=_0x176b8e[_0x050a('0x5')]||{};this['serverUrl']=_0x176b8e[_0x050a('0x6')]||'';this[_0x050a('0x7')]=_0x176b8e[_0x050a('0x7')]||![];this[_0x050a('0x8')]=_0x176b8e[_0x050a('0x8')]||{};this[_0x050a('0x9')]=_0x176b8e[_0x050a('0x9')]||{};}module[_0x050a('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 464a928..2df0536 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 _0x1279=['tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x1279,0x1a5));var _0x9127=function(_0x45da43,_0x8a2bd0){_0x45da43=_0x45da43-0x0;var _0x37e01b=_0x1279[_0x45da43];return _0x37e01b;};'use strict';function FaxAccount(_0x43630e){this['id']=_0x43630e['id']||0x0;this[_0x9127('0x0')]=_0x43630e[_0x9127('0x0')]||'';this['description']=_0x43630e[_0x9127('0x1')];this[_0x9127('0x2')]=_0x43630e[_0x9127('0x2')];this[_0x9127('0x3')]=_0x43630e[_0x9127('0x3')];this[_0x9127('0x4')]=_0x43630e['localstationid'];this[_0x9127('0x5')]=_0x43630e[_0x9127('0x5')]||0x960;this[_0x9127('0x6')]=_0x43630e['maxrate']||0x3840;this[_0x9127('0x7')]=_0x43630e[_0x9127('0x7')]||'v17,v27,v29';this[_0x9127('0x8')]=_0x43630e[_0x9127('0x8')]||'no';this['faxdetect']=_0x43630e[_0x9127('0x9')]||'no';this[_0x9127('0xa')]=_0x43630e[_0x9127('0xa')]||0x1388;this['tech']=_0x43630e[_0x9127('0xb')]||'SIP';this[_0x9127('0xc')]=_0x43630e[_0x9127('0xc')]?_0x43630e[_0x9127('0xc')]:undefined;this[_0x9127('0xd')]=_0x43630e[_0x9127('0xd')];this[_0x9127('0xe')]=_0x43630e[_0x9127('0xe')];}module[_0x9127('0xf')]=FaxAccount; \ No newline at end of file +var _0x0622=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x260d3b,_0x5827de){var _0x3b5143=function(_0x4b53db){while(--_0x4b53db){_0x260d3b['push'](_0x260d3b['shift']());}};_0x3b5143(++_0x5827de);}(_0x0622,0x199));var _0x2062=function(_0x4b6643,_0x9e4308){_0x4b6643=_0x4b6643-0x0;var _0x3dc376=_0x0622[_0x4b6643];return _0x3dc376;};'use strict';function FaxAccount(_0x28bcea){this['id']=_0x28bcea['id']||0x0;this[_0x2062('0x0')]=_0x28bcea['name']||'';this[_0x2062('0x1')]=_0x28bcea['description'];this['ecm']=_0x28bcea[_0x2062('0x2')];this['headerinfo']=_0x28bcea[_0x2062('0x3')];this['localstationid']=_0x28bcea[_0x2062('0x4')];this[_0x2062('0x5')]=_0x28bcea[_0x2062('0x5')]||0x960;this[_0x2062('0x6')]=_0x28bcea[_0x2062('0x6')]||0x3840;this[_0x2062('0x7')]=_0x28bcea[_0x2062('0x7')]||'v17,v27,v29';this['gateway']=_0x28bcea[_0x2062('0x8')]||'no';this[_0x2062('0x9')]=_0x28bcea[_0x2062('0x9')]||'no';this[_0x2062('0xa')]=_0x28bcea['t38timeout']||0x1388;this[_0x2062('0xb')]=_0x28bcea[_0x2062('0xb')]||_0x2062('0xc');this[_0x2062('0xd')]=_0x28bcea[_0x2062('0xd')]?_0x28bcea['Trunk']:undefined;this[_0x2062('0xe')]=_0x28bcea['ListId'];this['key']=_0x28bcea[_0x2062('0xf')];}module[_0x2062('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ec242ef..74a9073 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 _0xbb2b=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x4fe461,_0x180210){var _0x4aa96b=function(_0x523fd8){while(--_0x523fd8){_0x4fe461['push'](_0x4fe461['shift']());}};_0x4aa96b(++_0x180210);}(_0xbb2b,0x1dd));var _0xbbb2=function(_0x362388,_0x58e346){_0x362388=_0x362388-0x0;var _0x495aeb=_0xbb2b[_0x362388];return _0x495aeb;};'use strict';function FreshdeskAccount(_0x271e18){this['id']=_0x271e18['id']||0x0;this[_0xbbb2('0x0')]=_0x271e18[_0xbbb2('0x0')]||'';this[_0xbbb2('0x1')]=_0x271e18['username']||'';this['apiKey']=_0x271e18[_0xbbb2('0x2')]||'';this[_0xbbb2('0x3')]=_0x271e18[_0xbbb2('0x3')]||'';this[_0xbbb2('0x4')]=_0x271e18[_0xbbb2('0x4')]||'';this[_0xbbb2('0x5')]=_0x271e18[_0xbbb2('0x5')]||{};}module[_0xbbb2('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xe880=['Configurations','exports','username','apiKey','remoteUri','serverUrl'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0xe880,0xb0));var _0x0e88=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xe880[_0xfa634c];return _0x73e478;};'use strict';function FreshdeskAccount(_0x369f82){this['id']=_0x369f82['id']||0x0;this['name']=_0x369f82['name']||'';this['username']=_0x369f82[_0x0e88('0x0')]||'';this[_0x0e88('0x1')]=_0x369f82['token']||'';this[_0x0e88('0x2')]=_0x369f82[_0x0e88('0x2')]||'';this[_0x0e88('0x3')]=_0x369f82[_0x0e88('0x3')]||'';this[_0x0e88('0x4')]=_0x369f82[_0x0e88('0x4')]||{};}module[_0x0e88('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 9644bf1..20b8934 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 _0xac4f=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x582e89,_0x4ef581){var _0x3a5e42=function(_0x438a6a){while(--_0x438a6a){_0x582e89['push'](_0x582e89['shift']());}};_0x3a5e42(++_0x4ef581);}(_0xac4f,0x122));var _0xfac4=function(_0x3f7101,_0x3af08b){_0x3f7101=_0x3f7101-0x0;var _0x1a30a0=_0xac4f[_0x3f7101];return _0x1a30a0;};'use strict';function FreshsalesAccount(_0x1d3686){this['id']=_0x1d3686['id']||0x0;this['name']=_0x1d3686[_0xfac4('0x0')]||'';this['username']=_0x1d3686[_0xfac4('0x1')]||'';this['apiKey']=_0x1d3686['token']||'';this[_0xfac4('0x2')]=_0x1d3686[_0xfac4('0x2')]||'';this['serverUrl']=_0x1d3686[_0xfac4('0x3')]||'';this[_0xfac4('0x4')]=_0x1d3686[_0xfac4('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xbdb9=['Configurations','exports','name','username','token'];(function(_0x482a91,_0x4e2e62){var _0x29c856=function(_0x128ccc){while(--_0x128ccc){_0x482a91['push'](_0x482a91['shift']());}};_0x29c856(++_0x4e2e62);}(_0xbdb9,0xac));var _0x9bdb=function(_0x37d261,_0x4e57c7){_0x37d261=_0x37d261-0x0;var _0xfac099=_0xbdb9[_0x37d261];return _0xfac099;};'use strict';function FreshsalesAccount(_0x49fd37){this['id']=_0x49fd37['id']||0x0;this[_0x9bdb('0x0')]=_0x49fd37[_0x9bdb('0x0')]||'';this[_0x9bdb('0x1')]=_0x49fd37[_0x9bdb('0x1')]||'';this['apiKey']=_0x49fd37[_0x9bdb('0x2')]||'';this['remoteUri']=_0x49fd37['remoteUri']||'';this['serverUrl']=_0x49fd37['serverUrl']||'';this[_0x9bdb('0x3')]=_0x49fd37['Configurations']||{};}module[_0x9bdb('0x4')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 3778187..bbe99a4 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 _0xede7=['mohtime','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','exten','priority','holdtime','lastAssignedTo','motionChannel'];(function(_0x5ad0c6,_0x56ee17){var _0x167958=function(_0x32dd81){while(--_0x32dd81){_0x5ad0c6['push'](_0x5ad0c6['shift']());}};_0x167958(++_0x56ee17);}(_0xede7,0x1a0));var _0x7ede=function(_0x59f31e,_0x1fd672){_0x59f31e=_0x59f31e-0x0;var _0x1258af=_0xede7[_0x59f31e];return _0x1258af;};'use strict';function QueueReport(){this['type']=_0x7ede('0x0');this[_0x7ede('0x1')]='';this[_0x7ede('0x2')]='';this[_0x7ede('0x3')]='';this[_0x7ede('0x4')]='';this[_0x7ede('0x5')]=null;this[_0x7ede('0x6')]=null;this[_0x7ede('0x7')]=0x1;this['count']=0x1;this[_0x7ede('0x8')]=![];this[_0x7ede('0x9')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x7ede('0xa')]=![];this[_0x7ede('0xb')]=null;this[_0x7ede('0xc')]=0x1;this[_0x7ede('0xd')]='';this[_0x7ede('0xe')]='';this[_0x7ede('0xf')]='';this['accountcode']='';this['context']='';this[_0x7ede('0x10')]='';this[_0x7ede('0x11')]='';this[_0x7ede('0x12')]=0x0;this['assigned']=![];this[_0x7ede('0x13')]='';this[_0x7ede('0x14')]='voice';this[_0x7ede('0x15')]=0x0;this['variables']={};}module[_0x7ede('0x16')]=QueueReport; \ No newline at end of file +var _0x2440=['context','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x2440,0x126));var _0x0244=function(_0x3f423d,_0x530a45){_0x3f423d=_0x3f423d-0x0;var _0xffa802=_0x2440[_0x3f423d];return _0xffa802;};'use strict';function QueueReport(){this[_0x0244('0x0')]=_0x0244('0x1');this[_0x0244('0x2')]='';this[_0x0244('0x3')]='';this[_0x0244('0x4')]='';this[_0x0244('0x5')]='';this['queuecallerjoinAt']=null;this[_0x0244('0x6')]=null;this['position']=0x1;this[_0x0244('0x7')]=0x1;this[_0x0244('0x8')]=![];this[_0x0244('0x9')]=null;this[_0x0244('0xa')]=![];this[_0x0244('0xb')]=null;this[_0x0244('0xc')]=![];this[_0x0244('0xd')]=null;this[_0x0244('0xe')]=0x1;this[_0x0244('0xf')]='';this[_0x0244('0x10')]='';this[_0x0244('0x11')]='';this['accountcode']='';this[_0x0244('0x12')]='';this['exten']='';this[_0x0244('0x13')]='';this[_0x0244('0x14')]=0x0;this[_0x0244('0x15')]=![];this[_0x0244('0x16')]='';this[_0x0244('0x17')]='voice';this[_0x0244('0x18')]=0x0;this['variables']={};}module[_0x0244('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 76c3232..3a0a884 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 _0xbffe=['securityToken','type','serverUrl','Configurations','name','remoteUri','password','clientSecret'];(function(_0x15ceb6,_0x1be291){var _0x2d5b6f=function(_0x342d3e){while(--_0x342d3e){_0x15ceb6['push'](_0x15ceb6['shift']());}};_0x2d5b6f(++_0x1be291);}(_0xbffe,0x1d4));var _0xebff=function(_0xc8fd78,_0xee5396){_0xc8fd78=_0xc8fd78-0x0;var _0x383e49=_0xbffe[_0xc8fd78];return _0x383e49;};'use strict';function SalesforceAccount(_0x1d28d6){this['id']=_0x1d28d6['id']||0x0;this['name']=_0x1d28d6[_0xebff('0x0')]||'';this['username']=_0x1d28d6['username']||'';this[_0xebff('0x1')]=_0x1d28d6[_0xebff('0x1')]||'';this['password']=_0x1d28d6[_0xebff('0x2')]||'';this['clientId']=_0x1d28d6['clientId']||'';this[_0xebff('0x3')]=_0x1d28d6[_0xebff('0x3')]||'';this[_0xebff('0x4')]=_0x1d28d6[_0xebff('0x4')]||'';this[_0xebff('0x5')]=_0x1d28d6[_0xebff('0x5')]||'integrationTab';this[_0xebff('0x6')]=_0x1d28d6['serverUrl']||'';this[_0xebff('0x7')]=_0x1d28d6['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x5142=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','username','remoteUri','password','clientId'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x5142,0x196));var _0x2514=function(_0x1f29f7,_0x448270){_0x1f29f7=_0x1f29f7-0x0;var _0x3b99c3=_0x5142[_0x1f29f7];return _0x3b99c3;};'use strict';function SalesforceAccount(_0x468a35){this['id']=_0x468a35['id']||0x0;this['name']=_0x468a35['name']||'';this[_0x2514('0x0')]=_0x468a35[_0x2514('0x0')]||'';this[_0x2514('0x1')]=_0x468a35[_0x2514('0x1')]||'';this[_0x2514('0x2')]=_0x468a35[_0x2514('0x2')]||'';this[_0x2514('0x3')]=_0x468a35[_0x2514('0x3')]||'';this[_0x2514('0x4')]=_0x468a35[_0x2514('0x4')]||'';this[_0x2514('0x5')]=_0x468a35[_0x2514('0x5')]||'';this[_0x2514('0x6')]=_0x468a35[_0x2514('0x6')]||_0x2514('0x7');this[_0x2514('0x8')]=_0x468a35['serverUrl']||'';this[_0x2514('0x9')]=_0x468a35[_0x2514('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 e273eee..8d6b259 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 _0x9bdd=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x9bdd,0x6d));var _0xd9bd=function(_0x3b7cec,_0x5aa2c3){_0x3b7cec=_0x3b7cec-0x0;var _0x46a7d9=_0x9bdd[_0x3b7cec];return _0x46a7d9;};'use strict';function ServicenowAccount(_0xbb0550){this['id']=_0xbb0550['id']||0x0;this[_0xd9bd('0x0')]=_0xbb0550[_0xd9bd('0x0')]||'';this[_0xd9bd('0x1')]=_0xbb0550[_0xd9bd('0x1')]||'';this['password']=_0xbb0550['password']||'';this[_0xd9bd('0x2')]=_0xbb0550[_0xd9bd('0x2')]||'';this[_0xd9bd('0x3')]=_0xbb0550[_0xd9bd('0x3')]||'';this[_0xd9bd('0x4')]=_0xbb0550['Configurations']||{};}module[_0xd9bd('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xaa14=['name','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x3c2155,_0x4a0493){var _0x37e699=function(_0x326bef){while(--_0x326bef){_0x3c2155['push'](_0x3c2155['shift']());}};_0x37e699(++_0x4a0493);}(_0xaa14,0x1b0));var _0x4aa1=function(_0x33d020,_0x5249f4){_0x33d020=_0x33d020-0x0;var _0xc3bfca=_0xaa14[_0x33d020];return _0xc3bfca;};'use strict';function ServicenowAccount(_0x2d6540){this['id']=_0x2d6540['id']||0x0;this[_0x4aa1('0x0')]=_0x2d6540[_0x4aa1('0x0')]||'';this['username']=_0x2d6540['username']||'';this[_0x4aa1('0x1')]=_0x2d6540[_0x4aa1('0x1')]||'';this[_0x4aa1('0x2')]=_0x2d6540[_0x4aa1('0x2')]||'';this[_0x4aa1('0x3')]=_0x2d6540[_0x4aa1('0x3')]||'';this[_0x4aa1('0x4')]=_0x2d6540[_0x4aa1('0x4')]||{};}module[_0x4aa1('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 3f5b38a..09353fb 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 _0x9c36=['exports','username','password','remoteUri','serverUrl','Configurations'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9c36,0x163));var _0x69c3=function(_0x40f217,_0x41a107){_0x40f217=_0x40f217-0x0;var _0x9e9b27=_0x9c36[_0x40f217];return _0x9e9b27;};'use strict';function SugarcrmAccount(_0x1e2d00){this['id']=_0x1e2d00['id']||0x0;this['name']=_0x1e2d00['name']||'';this[_0x69c3('0x0')]=_0x1e2d00[_0x69c3('0x0')]||'';this['password']=_0x1e2d00[_0x69c3('0x1')]||'';this['remoteUri']=_0x1e2d00[_0x69c3('0x2')]||'';this[_0x69c3('0x3')]=_0x1e2d00[_0x69c3('0x3')]||'';this[_0x69c3('0x4')]=_0x1e2d00[_0x69c3('0x4')]||{};}module[_0x69c3('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x9ee9=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2f3184,_0x4f5e57){var _0x199542=function(_0x207913){while(--_0x207913){_0x2f3184['push'](_0x2f3184['shift']());}};_0x199542(++_0x4f5e57);}(_0x9ee9,0x124));var _0x99ee=function(_0x499964,_0x19e41c){_0x499964=_0x499964-0x0;var _0x12fe1c=_0x9ee9[_0x499964];return _0x12fe1c;};'use strict';function SugarcrmAccount(_0x451275){this['id']=_0x451275['id']||0x0;this[_0x99ee('0x0')]=_0x451275[_0x99ee('0x0')]||'';this[_0x99ee('0x1')]=_0x451275[_0x99ee('0x1')]||'';this[_0x99ee('0x2')]=_0x451275[_0x99ee('0x2')]||'';this[_0x99ee('0x3')]=_0x451275[_0x99ee('0x3')]||'';this[_0x99ee('0x4')]=_0x451275[_0x99ee('0x4')]||'';this[_0x99ee('0x5')]=_0x451275[_0x99ee('0x5')]||{};}module[_0x99ee('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 2e431ea..115a165 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 _0x0817=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x412cad,_0x3f7070){var _0x42359b=function(_0x4ea5c8){while(--_0x4ea5c8){_0x412cad['push'](_0x412cad['shift']());}};_0x42359b(++_0x3f7070);}(_0x0817,0x90));var _0x7081=function(_0x4265d9,_0x2792b3){_0x4265d9=_0x4265d9-0x0;var _0x302e38=_0x0817[_0x4265d9];return _0x302e38;};'use strict';function Telephone(_0x4c6044){this['id']=_0x4c6044['id']||0x0;this['name']=_0x4c6044[_0x7081('0x0')]||'';this[_0x7081('0x1')]=_0x4c6044[_0x7081('0x1')]||'';this[_0x7081('0x2')]=_0x7081('0x3');this[_0x7081('0x4')]=0x0;this[_0x7081('0x5')]=_0x7081('0x3');this[_0x7081('0x6')]='';}module[_0x7081('0x7')]=Telephone; \ No newline at end of file +var _0xed65=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x139c1a,_0x17cb4f){var _0x4fe26f=function(_0x152017){while(--_0x152017){_0x139c1a['push'](_0x139c1a['shift']());}};_0x4fe26f(++_0x17cb4f);}(_0xed65,0xd6));var _0x5ed6=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0xed65[_0xb1174e];return _0x285bac;};'use strict';function Telephone(_0x570414){this['id']=_0x570414['id']||0x0;this[_0x5ed6('0x0')]=_0x570414[_0x5ed6('0x0')]||'';this[_0x5ed6('0x1')]=_0x570414[_0x5ed6('0x1')]||'';this[_0x5ed6('0x2')]=_0x5ed6('0x3');this[_0x5ed6('0x4')]=0x0;this[_0x5ed6('0x5')]=_0x5ed6('0x3');this[_0x5ed6('0x6')]='';}module[_0x5ed6('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 67d857a..f12071f 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(_0x3bad78,_0x22c997){var _0x2a76bd=function(_0x35511e){while(--_0x35511e){_0x3bad78['push'](_0x3bad78['shift']());}};_0x2a76bd(++_0x22c997);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x9ae00d,_0x14a87a){var _0x231470=function(_0x39b838){while(--_0x39b838){_0x9ae00d['push'](_0x9ae00d['shift']());}};_0x231470(++_0x14a87a);}(_0xb10b,0x12a));var _0xbb10=function(_0x91964a,_0x2dc2f6){_0x91964a=_0x91964a-0x0;var _0x4490b1=_0xb10b[_0x91964a];return _0x4490b1;};'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 168bb88..1ec4c65 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0xd93776,_0x15d253){var _0x5d8165=function(_0x4300bd){while(--_0x4300bd){_0xd93776['push'](_0xd93776['shift']());}};_0x5d8165(++_0x15d253);}(_0x757a,0xde));var _0xa757=function(_0x138af9,_0x1f2813){_0x138af9=_0x138af9-0x0;var _0x477896=_0x757a[_0x138af9];return _0x477896;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1a85,0x178));var _0x51a8=function(_0x47cde9,_0x19d013){_0x47cde9=_0x47cde9-0x0;var _0x26fdf1=_0x1a85[_0x47cde9];return _0x26fdf1;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index c5345b3..f292bd0 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 _0x21de=['registrationtime','address','defaultuser','exports','active','name','state','registry','indexOf','host','domain','domainport','refresh','stateRegistry'];(function(_0x5db4b0,_0x17dfb5){var _0x126c9f=function(_0x1f87f2){while(--_0x1f87f2){_0x5db4b0['push'](_0x5db4b0['shift']());}};_0x126c9f(++_0x17dfb5);}(_0x21de,0x74));var _0xe21d=function(_0x983ba4,_0x6babf5){_0x983ba4=_0x983ba4-0x0;var _0x3a91b9=_0x21de[_0x983ba4];return _0x3a91b9;};'use strict';function Trunk(_0x512e47){this['id']=_0x512e47['id']||0x0;this[_0xe21d('0x0')]=_0x512e47[_0xe21d('0x0')]||![];this[_0xe21d('0x1')]=_0x512e47[_0xe21d('0x1')]||'';this[_0xe21d('0x2')]='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0xe21d('0x3')]=_0x512e47['registry']&&_0x512e47[_0xe21d('0x3')][_0xe21d('0x4')](':')?_0x512e47[_0xe21d('0x3')]['split'](':')[0x0]:'';this[_0xe21d('0x5')]='';this['port']='';this[_0xe21d('0x6')]='';this[_0xe21d('0x7')]='';this[_0xe21d('0x8')]='';this[_0xe21d('0x9')]='unknown';this[_0xe21d('0xa')]='';this[_0xe21d('0xb')]='';this[_0xe21d('0xc')]=_0x512e47[_0xe21d('0xc')]||'';}module[_0xe21d('0xd')]=Trunk; \ No newline at end of file +var _0xb120=['state','unknown','stateTime','status','registry','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name'];(function(_0x849132,_0x104c4e){var _0x597dd6=function(_0x2a13f8){while(--_0x2a13f8){_0x849132['push'](_0x849132['shift']());}};_0x597dd6(++_0x104c4e);}(_0xb120,0x86));var _0x0b12=function(_0x3fa2a8,_0x1bef4c){_0x3fa2a8=_0x3fa2a8-0x0;var _0x2c40b7=_0xb120[_0x3fa2a8];return _0x2c40b7;};'use strict';function Trunk(_0x529975){this['id']=_0x529975['id']||0x0;this[_0x0b12('0x0')]=_0x529975[_0x0b12('0x0')]||![];this[_0x0b12('0x1')]=_0x529975[_0x0b12('0x1')]||'';this[_0x0b12('0x2')]=_0x0b12('0x3');this[_0x0b12('0x4')]=0x0;this[_0x0b12('0x5')]=_0x0b12('0x3');this[_0x0b12('0x6')]=_0x529975[_0x0b12('0x6')]&&_0x529975['registry']['indexOf'](':')?_0x529975[_0x0b12('0x6')][_0x0b12('0x7')](':')[0x0]:'';this['host']='';this[_0x0b12('0x8')]='';this[_0x0b12('0x9')]='';this[_0x0b12('0xa')]='';this[_0x0b12('0xb')]='';this[_0x0b12('0xc')]=_0x0b12('0x3');this[_0x0b12('0xd')]='';this[_0x0b12('0xe')]='';this[_0x0b12('0xf')]=_0x529975[_0x0b12('0xf')]||'';}module[_0x0b12('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0088238..df0fc4d 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 _0x8d8c=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x69c9f5,_0x23cfde){var _0x8178a0=function(_0x380ae0){while(--_0x380ae0){_0x69c9f5['push'](_0x69c9f5['shift']());}};_0x8178a0(++_0x23cfde);}(_0x8d8c,0x143));var _0xc8d8=function(_0x5d7c7d,_0xb243cc){_0x5d7c7d=_0x5d7c7d-0x0;var _0x30ae4f=_0x8d8c[_0x5d7c7d];return _0x30ae4f;};'use strict';function voiceExtension(_0x221b75){this['id']=_0x221b75['id']||0x0;this[_0xc8d8('0x0')]=_0x221b75[_0xc8d8('0x0')]||'';this[_0xc8d8('0x1')]=_0x221b75[_0xc8d8('0x1')]||'none';this[_0xc8d8('0x2')]=_0x221b75[_0xc8d8('0x2')]||![];}module[_0xc8d8('0x3')]=voiceExtension; \ No newline at end of file +var _0xf907=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf907,0xd1));var _0x7f90=function(_0x26930f,_0x2d582e){_0x26930f=_0x26930f-0x0;var _0x22ec6e=_0xf907[_0x26930f];return _0x22ec6e;};'use strict';function voiceExtension(_0xae4f17){this['id']=_0xae4f17['id']||0x0;this[_0x7f90('0x0')]=_0xae4f17[_0x7f90('0x0')]||'';this[_0x7f90('0x1')]=_0xae4f17[_0x7f90('0x1')]||_0x7f90('0x2');this[_0x7f90('0x3')]=_0xae4f17[_0x7f90('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 81f99bb..9ff4d25 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 _0xb073=['erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','onHold','paused','ringing','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb073,0x187));var _0x3b07=function(_0x5957c0,_0x33813b){_0x5957c0=_0x5957c0-0x0;var _0x5d0529=_0xb073[_0x5957c0];return _0x5d0529;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x3b07('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':_0x3b07('0x1'),'leastrecent':_0x3b07('0x2'),'linear':_0x3b07('0x3'),'random':'random','ringall':_0x3b07('0x4'),'rr':_0x3b07('0x5'),'rrmemory':_0x3b07('0x6'),'rrordered':'rrordered','wrandom':_0x3b07('0x7')};function VoiceQueue(_0x27d168){this['id']=_0x27d168['id']||0x0;this[_0x3b07('0x8')]=_0x27d168[_0x3b07('0x8')]||'';this[_0x3b07('0x9')]=_0x27d168[_0x3b07('0x9')]||'';this[_0x3b07('0xa')]=_0x27d168[_0x3b07('0xa')]||'inbound';this['waiting']=0x0;this[_0x3b07('0xb')]=0x0;this[_0x3b07('0xc')]=0x0;this[_0x3b07('0xd')]=0x0;this[_0x3b07('0xe')]=0x0;this[_0x3b07('0xf')]=0x0;this[_0x3b07('0x10')]=0x0;this[_0x3b07('0x11')]=0x0;this[_0x3b07('0x12')]=0x0;this[_0x3b07('0x13')]=0x0;this[_0x3b07('0x14')]=0x0;this[_0x3b07('0x15')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0x3b07('0x16')]=0x0;this[_0x3b07('0x17')]=0x0;this[_0x3b07('0x18')]=0x0;this['ringInUse']=0x0;this[_0x3b07('0x19')]=0x0;this['unavailable']=0x0;this[_0x3b07('0x1a')]=0x0;this[_0x3b07('0x1b')]=_0x27d168[_0x3b07('0x1b')]||![];this[_0x3b07('0x1c')]=_0x27d168[_0x3b07('0x1c')]||0xa;this[_0x3b07('0x1d')]=_0x27d168[_0x3b07('0x1d')]||'no';this[_0x3b07('0x1e')]=!![];this[_0x3b07('0x1f')]='';this[_0x3b07('0x20')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x27d168[_0x3b07('0x21')]||null;this[_0x3b07('0x22')]=_0x27d168['dialGlobalInterval']?_0x27d168['dialGlobalInterval']:null;this['dialActive']=_0x27d168[_0x3b07('0x23')];this['dialMethod']=_0x27d168[_0x3b07('0x24')]||_0x3b07('0x25');this[_0x3b07('0x26')]=_0x27d168[_0x3b07('0x26')]||0x0;this[_0x3b07('0x27')]=_0x27d168[_0x3b07('0x27')]||0x0;this[_0x3b07('0x28')]=_0x27d168[_0x3b07('0x28')]||0x1;this[_0x3b07('0x29')]=_0x27d168[_0x3b07('0x29')]||_0x3b07('0x2a');this['dialPredictiveOptimizationPercentage']=_0x27d168[_0x3b07('0x2b')]||0.03;this['dialPredictiveInterval']=_0x27d168[_0x3b07('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0x27d168[_0x3b07('0x2d')]||'anonymous';this[_0x3b07('0x2e')]=_0x27d168[_0x3b07('0x2e')]||_0x3b07('0x2f');this['dialOriginateTimeout']=_0x27d168[_0x3b07('0x30')]||0x1e;this['dialQueueOptions']=_0x27d168[_0x3b07('0x31')]||'tTxX';this[_0x3b07('0x32')]=_0x27d168[_0x3b07('0x32')]||0x3;this[_0x3b07('0x33')]=_0x27d168[_0x3b07('0x33')]||undefined;this[_0x3b07('0x34')]=_0x27d168[_0x3b07('0x34')]||0x3;this[_0x3b07('0x35')]=_0x27d168['dialCongestionRetryFrequency']||0x96;this[_0x3b07('0x36')]=_0x27d168[_0x3b07('0x36')]||0x3;this[_0x3b07('0x37')]=_0x27d168[_0x3b07('0x37')]||0x96;this[_0x3b07('0x38')]=_0x27d168[_0x3b07('0x38')]||0x3;this['dialNoAnswerRetryFrequency']=_0x27d168['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x27d168['dialNoSuchNumberMaxRetry']||0x3;this[_0x3b07('0x39')]=_0x27d168[_0x3b07('0x39')]||0x96;this[_0x3b07('0x3a')]=_0x27d168[_0x3b07('0x3a')]||0x3;this[_0x3b07('0x3b')]=_0x27d168[_0x3b07('0x3b')]||0x96;this['dialAbandonedMaxRetry']=_0x27d168['dialAbandonedMaxRetry']||0x3;this[_0x3b07('0x3c')]=_0x27d168[_0x3b07('0x3c')]||0x96;this[_0x3b07('0x3d')]=_0x27d168['dialMachineMaxRetry']||0x3;this[_0x3b07('0x3e')]=_0x27d168[_0x3b07('0x3e')]||0x96;this[_0x3b07('0x3f')]=_0x27d168[_0x3b07('0x3f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x27d168[_0x3b07('0x40')]||0x96;this[_0x3b07('0x41')]=_0x27d168[_0x3b07('0x41')]||0x3;this[_0x3b07('0x42')]=_0x27d168['dialGlobalMaxRetry']||0x4;this[_0x3b07('0x43')]=_0x27d168[_0x3b07('0x43')]?_0x27d168[_0x3b07('0x43')]:undefined;this[_0x3b07('0x44')]=_0x27d168[_0x3b07('0x44')]?_0x27d168[_0x3b07('0x44')]:undefined;this[_0x3b07('0x45')]=_0x27d168[_0x3b07('0x45')]||undefined;this[_0x3b07('0x46')]=_0x27d168['Interval']?_0x27d168[_0x3b07('0x46')]:undefined;this[_0x3b07('0x47')]=_0x27d168[_0x3b07('0x47')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x27d168[_0x3b07('0x48')]||undefined;this[_0x3b07('0x49')]=_0x27d168[_0x3b07('0x49')]||undefined;this[_0x3b07('0x4a')]=strategy[_0x27d168['strategy']];this[_0x3b07('0x4b')]=!![];this[_0x3b07('0x4c')]=_0x27d168[_0x3b07('0x4c')]||![];this['dialAMDInitialSilence']=_0x27d168[_0x3b07('0x4d')];this['dialAMDGreeting']=_0x27d168[_0x3b07('0x4e')];this[_0x3b07('0x4f')]=_0x27d168[_0x3b07('0x4f')];this[_0x3b07('0x50')]=_0x27d168[_0x3b07('0x50')];this[_0x3b07('0x51')]=_0x27d168[_0x3b07('0x51')];this[_0x3b07('0x52')]=_0x27d168['dialAMDBetweenWordsSilence'];this[_0x3b07('0x53')]=_0x27d168[_0x3b07('0x53')];this['dialAMDSilenceThreshold']=_0x27d168[_0x3b07('0x54')];this['dialAMDMaximumWordLength']=_0x27d168['dialAMDMaximumWordLength'];this[_0x3b07('0x55')]=0x0;this[_0x3b07('0x56')]=0x0;this['timeout']=_0x27d168[_0x3b07('0x57')];this[_0x3b07('0x58')]=0x0;this[_0x3b07('0x59')]=0x0;this[_0x3b07('0x5a')]=0x0;this[_0x3b07('0x5b')]=0x0;this[_0x3b07('0x5c')]=0x0;this[_0x3b07('0x5d')]=0x0;this[_0x3b07('0x5e')]=0x0;this[_0x3b07('0x5f')]=0x0;this[_0x3b07('0x60')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x3b07('0x61')]=0x0;this[_0x3b07('0x62')]=0x0;this[_0x3b07('0x63')]=0x0;this['startProgressive']=undefined;this[_0x3b07('0x64')]=undefined;this[_0x3b07('0x65')]=undefined;this[_0x3b07('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x3b07('0x67')]=0x0;this[_0x3b07('0x68')]=0x0;this[_0x3b07('0x69')]=0x0;this[_0x3b07('0x6a')]=0x0;this[_0x3b07('0x6b')]=0x0;this[_0x3b07('0x6c')]=_0x27d168[_0x3b07('0x6d')]||0x14;this[_0x3b07('0x6e')]=_0x27d168[_0x3b07('0x6d')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x3b07('0x6f')]=0x0;this[_0x3b07('0x70')]=0x1;this[_0x3b07('0x71')]=0x0;this[_0x3b07('0x72')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x3b07('0x73')]=0x0;this[_0x3b07('0x74')]=_0x27d168[_0x3b07('0x74')]||0x1e;this['dialRecallInQueue']=_0x27d168[_0x3b07('0x75')]||![];this['dialPreviewAutoRecallMe']=!!_0x27d168[_0x3b07('0x76')]||![];this[_0x3b07('0x77')]=!!_0x27d168['dialPreviewRecallmeReminder']||![];this[_0x3b07('0x78')]=_0x27d168[_0x3b07('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x27d168[_0x3b07('0x79')]||![];this[_0x3b07('0x7a')]=_0x27d168[_0x3b07('0x7a')]||![];this[_0x3b07('0x9')]=monitorFormat[_0x27d168[_0x3b07('0x9')]]?monitorFormat[_0x27d168['monitor_format']]:undefined;this[_0x3b07('0x7b')]=_0x27d168['mandatoryDisposition']||![];this[_0x3b07('0x7c')]=_0x27d168[_0x3b07('0x7c')]?_0x27d168[_0x3b07('0x7c')]:undefined;this[_0x3b07('0x7d')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0x5cd5=['dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','waiting','answered','sumDuration','sumBillable','unmanaged','abandoned','busy','inUse','loggedIn','paused','ringing','ringInUse','talking','unavailable','unknown','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x5cd5,0x149));var _0x55cd=function(_0x1fa5d7,_0x4d7958){_0x1fa5d7=_0x1fa5d7-0x0;var _0x3cda88=_0x5cd5[_0x1fa5d7];return _0x3cda88;};'use strict';var monitorFormat={'wav':_0x55cd('0x0'),'wav49':_0x55cd('0x1'),'gsm':_0x55cd('0x2')};var strategy={'fewestcalls':_0x55cd('0x3'),'leastrecent':_0x55cd('0x4'),'linear':'linear','random':_0x55cd('0x5'),'ringall':_0x55cd('0x6'),'rr':_0x55cd('0x7'),'rrmemory':_0x55cd('0x8'),'rrordered':_0x55cd('0x9'),'wrandom':'wrandom'};function VoiceQueue(_0x4ffba1){this['id']=_0x4ffba1['id']||0x0;this[_0x55cd('0xa')]=_0x4ffba1['name']||'';this[_0x55cd('0xb')]=_0x4ffba1[_0x55cd('0xb')]||'';this[_0x55cd('0xc')]=_0x4ffba1[_0x55cd('0xc')]||'inbound';this[_0x55cd('0xd')]=0x0;this['total']=0x0;this[_0x55cd('0xe')]=0x0;this[_0x55cd('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0x55cd('0x10')]=0x0;this[_0x55cd('0x11')]=0x0;this[_0x55cd('0x12')]=0x0;this['available']=0x0;this[_0x55cd('0x13')]=0x0;this[_0x55cd('0x14')]=0x0;this['invalid']=0x0;this[_0x55cd('0x15')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x55cd('0x16')]=0x0;this[_0x55cd('0x17')]=0x0;this[_0x55cd('0x18')]=0x0;this[_0x55cd('0x19')]=0x0;this[_0x55cd('0x1a')]=0x0;this[_0x55cd('0x1b')]=0x0;this['acw']=_0x4ffba1['acw']||![];this['acwTimeout']=_0x4ffba1[_0x55cd('0x1c')]||0xa;this[_0x55cd('0x1d')]=_0x4ffba1['autopause']||'no';this[_0x55cd('0x1e')]=!![];this[_0x55cd('0x1f')]='';this[_0x55cd('0x20')]='';this['originated']=0x0;this[_0x55cd('0x21')]=0x0;this[_0x55cd('0x22')]=_0x4ffba1[_0x55cd('0x22')]||null;this[_0x55cd('0x23')]=_0x4ffba1['dialGlobalInterval']?_0x4ffba1[_0x55cd('0x23')]:null;this[_0x55cd('0x24')]=_0x4ffba1['dialActive'];this['dialMethod']=_0x4ffba1[_0x55cd('0x25')]||_0x55cd('0x26');this[_0x55cd('0x27')]=_0x4ffba1[_0x55cd('0x27')]||0x0;this[_0x55cd('0x28')]=_0x4ffba1['dialLimitQueue']||0x0;this[_0x55cd('0x29')]=_0x4ffba1[_0x55cd('0x29')]||0x1;this[_0x55cd('0x2a')]=_0x4ffba1[_0x55cd('0x2a')]||'dropRate';this[_0x55cd('0x2b')]=_0x4ffba1['dialPredictiveOptimizationPercentage']||0.03;this[_0x55cd('0x2c')]=_0x4ffba1[_0x55cd('0x2c')]||0x258;this[_0x55cd('0x2d')]=_0x4ffba1['dialOriginateCallerIdName']||_0x55cd('0x2e');this[_0x55cd('0x2f')]=_0x4ffba1[_0x55cd('0x2f')]||'anonymous';this['dialOriginateTimeout']=_0x4ffba1[_0x55cd('0x30')]||0x1e;this[_0x55cd('0x31')]=_0x4ffba1[_0x55cd('0x31')]||'tTxX';this[_0x55cd('0x32')]=_0x4ffba1['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x4ffba1[_0x55cd('0x33')]||undefined;this[_0x55cd('0x34')]=_0x4ffba1[_0x55cd('0x34')]||0x3;this[_0x55cd('0x35')]=_0x4ffba1[_0x55cd('0x35')]||0x96;this[_0x55cd('0x36')]=_0x4ffba1[_0x55cd('0x36')]||0x3;this[_0x55cd('0x37')]=_0x4ffba1[_0x55cd('0x37')]||0x96;this[_0x55cd('0x38')]=_0x4ffba1['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x4ffba1[_0x55cd('0x39')]||0x96;this[_0x55cd('0x3a')]=_0x4ffba1[_0x55cd('0x3a')]||0x3;this[_0x55cd('0x3b')]=_0x4ffba1[_0x55cd('0x3b')]||0x96;this[_0x55cd('0x3c')]=_0x4ffba1[_0x55cd('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x4ffba1[_0x55cd('0x3d')]||0x96;this[_0x55cd('0x3e')]=_0x4ffba1[_0x55cd('0x3e')]||0x3;this['dialAbandonedRetryFrequency']=_0x4ffba1[_0x55cd('0x3f')]||0x96;this[_0x55cd('0x40')]=_0x4ffba1[_0x55cd('0x40')]||0x3;this[_0x55cd('0x41')]=_0x4ffba1['dialMachineRetryFrequency']||0x96;this[_0x55cd('0x42')]=_0x4ffba1[_0x55cd('0x42')]||0x3;this[_0x55cd('0x43')]=_0x4ffba1[_0x55cd('0x43')]||0x96;this[_0x55cd('0x44')]=_0x4ffba1[_0x55cd('0x44')]||0x3;this[_0x55cd('0x45')]=_0x4ffba1[_0x55cd('0x45')]||0x4;this['Trunk']=_0x4ffba1[_0x55cd('0x46')]?_0x4ffba1[_0x55cd('0x46')]:undefined;this['TrunkBackup']=_0x4ffba1[_0x55cd('0x47')]?_0x4ffba1[_0x55cd('0x47')]:undefined;this[_0x55cd('0x48')]=_0x4ffba1[_0x55cd('0x48')]||undefined;this[_0x55cd('0x49')]=_0x4ffba1[_0x55cd('0x49')]?_0x4ffba1[_0x55cd('0x49')]:undefined;this[_0x55cd('0x4a')]=_0x4ffba1[_0x55cd('0x4a')]||_0x55cd('0x4b');this[_0x55cd('0x4c')]=_0x4ffba1[_0x55cd('0x4c')]||undefined;this[_0x55cd('0x4d')]=_0x4ffba1[_0x55cd('0x4d')]||undefined;this['strategy']=strategy[_0x4ffba1['strategy']];this[_0x55cd('0x4e')]=!![];this[_0x55cd('0x4f')]=_0x4ffba1[_0x55cd('0x4f')]||![];this[_0x55cd('0x50')]=_0x4ffba1[_0x55cd('0x50')];this[_0x55cd('0x51')]=_0x4ffba1[_0x55cd('0x51')];this[_0x55cd('0x52')]=_0x4ffba1['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x4ffba1['dialAMDTotalAnalysisTime'];this[_0x55cd('0x53')]=_0x4ffba1['dialAMDMinWordLength'];this[_0x55cd('0x54')]=_0x4ffba1[_0x55cd('0x54')];this[_0x55cd('0x55')]=_0x4ffba1[_0x55cd('0x55')];this[_0x55cd('0x56')]=_0x4ffba1[_0x55cd('0x56')];this[_0x55cd('0x57')]=_0x4ffba1[_0x55cd('0x57')];this[_0x55cd('0x58')]=0x0;this[_0x55cd('0x59')]=0x0;this[_0x55cd('0x5a')]=_0x4ffba1[_0x55cd('0x5a')];this[_0x55cd('0x5b')]=0x0;this[_0x55cd('0x5c')]=0x0;this[_0x55cd('0x5d')]=0x0;this[_0x55cd('0x5e')]=0x0;this[_0x55cd('0x5f')]=0x0;this[_0x55cd('0x60')]=0x0;this[_0x55cd('0x61')]=0x0;this[_0x55cd('0x62')]=0x0;this[_0x55cd('0x63')]=0x0;this[_0x55cd('0x64')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x55cd('0x65')]=0x0;this[_0x55cd('0x66')]=0x0;this[_0x55cd('0x67')]=0x0;this[_0x55cd('0x68')]=undefined;this['startPredictive']=undefined;this[_0x55cd('0x69')]=undefined;this[_0x55cd('0x6a')]=1.05;this[_0x55cd('0x6b')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x55cd('0x6c')]=0x0;this[_0x55cd('0x6d')]=0x0;this[_0x55cd('0x6e')]=0x0;this[_0x55cd('0x6f')]=0x0;this[_0x55cd('0x70')]=0x0;this[_0x55cd('0x71')]=_0x4ffba1[_0x55cd('0x72')]||0x14;this[_0x55cd('0x73')]=_0x4ffba1[_0x55cd('0x72')]||0xa;this[_0x55cd('0x74')]=0x0;this[_0x55cd('0x75')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x55cd('0x76')]=0x0;this[_0x55cd('0x77')]=0x0;this[_0x55cd('0x78')]=0x0;this['erlangBusyFactor']=0x0;this[_0x55cd('0x79')]=_0x4ffba1[_0x55cd('0x79')]||0x1e;this['dialRecallInQueue']=_0x4ffba1[_0x55cd('0x7a')]||![];this[_0x55cd('0x7b')]=!!_0x4ffba1[_0x55cd('0x7b')]||![];this[_0x55cd('0x7c')]=!!_0x4ffba1[_0x55cd('0x7c')]||![];this[_0x55cd('0x7d')]=_0x4ffba1[_0x55cd('0x7d')]||undefined;this[_0x55cd('0x7e')]=_0x4ffba1['dialAgiAfterHangupClient']||![];this[_0x55cd('0x7f')]=_0x4ffba1[_0x55cd('0x7f')]||![];this[_0x55cd('0xb')]=monitorFormat[_0x4ffba1[_0x55cd('0xb')]]?monitorFormat[_0x4ffba1['monitor_format']]:undefined;this[_0x55cd('0x80')]=_0x4ffba1[_0x55cd('0x80')]||![];this[_0x55cd('0x81')]=_0x4ffba1[_0x55cd('0x81')]?_0x4ffba1[_0x55cd('0x81')]:undefined;this[_0x55cd('0x82')]=![];}module[_0x55cd('0x83')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 3b91773..b92a819 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c1=['onHold','notInUse','ringInUse','sumBillable','sumHoldTime','talking','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','length','SIP/','online','incall','includes','status','booked','queue','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','exports','loggedInDb','paused','ringing','waiting','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumDuration','total','name','strategy','abandoned','available','busy','invalid'];(function(_0x283fe1,_0x312094){var _0x1937b3=function(_0x37da3f){while(--_0x37da3f){_0x283fe1['push'](_0x283fe1['shift']());}};_0x1937b3(++_0x312094);}(_0xf6c1,0x99));var _0x1f6c=function(_0x12decc,_0x145ff9){_0x12decc=_0x12decc-0x0;var _0x42e2fd=_0xf6c1[_0x12decc];return _0x42e2fd;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0x1f6c('0x0'),_0x1f6c('0x1'),_0x1f6c('0x2'),'talking',_0x1f6c('0x3')];var OUTBOUND_COUNTERS=['available',_0x1f6c('0x4'),_0x1f6c('0x5'),_0x1f6c('0x6'),_0x1f6c('0x0'),_0x1f6c('0x7'),_0x1f6c('0x8'),'outboundAnswerCallsDay',_0x1f6c('0x9'),_0x1f6c('0xa'),_0x1f6c('0xb'),_0x1f6c('0xc'),_0x1f6c('0xd'),_0x1f6c('0xe'),_0x1f6c('0xf'),_0x1f6c('0x10'),_0x1f6c('0x1'),'pTalking','talking','sumBillable',_0x1f6c('0x11'),_0x1f6c('0x12'),_0x1f6c('0x3')];function VoiceQueueSummary(_0x4739ec){this['id']=_0x4739ec['id'];this[_0x1f6c('0x13')]=_0x4739ec[_0x1f6c('0x13')];this['strategy']=_0x4739ec[_0x1f6c('0x14')];this[_0x1f6c('0x15')]=_0x4739ec[_0x1f6c('0x15')]||0x0;this[_0x1f6c('0x4')]=_0x4739ec[_0x1f6c('0x4')]||0x0;this[_0x1f6c('0x16')]=_0x4739ec[_0x1f6c('0x16')]||0x0;this[_0x1f6c('0x17')]=_0x4739ec['busy']||0x0;this[_0x1f6c('0x5')]=_0x4739ec[_0x1f6c('0x5')]||0x0;this[_0x1f6c('0x18')]=_0x4739ec[_0x1f6c('0x18')]||0x0;this[_0x1f6c('0x6')]=_0x4739ec[_0x1f6c('0x6')]||0x0;this['loggedInDb']=_0x4739ec['loggedInDb']||0x0;this[_0x1f6c('0x19')]=_0x4739ec[_0x1f6c('0x19')]||0x0;this['notInUse']=_0x4739ec[_0x1f6c('0x1a')]||0x0;this['paused']=_0x4739ec[_0x1f6c('0x1')]||0x0;this[_0x1f6c('0x2')]=_0x4739ec[_0x1f6c('0x2')]||0x0;this[_0x1f6c('0x1b')]=_0x4739ec[_0x1f6c('0x1b')];this[_0x1f6c('0x1c')]=_0x4739ec[_0x1f6c('0x1c')];this[_0x1f6c('0x11')]=_0x4739ec[_0x1f6c('0x11')];this[_0x1f6c('0x1d')]=_0x4739ec[_0x1f6c('0x1d')]||0x0;this[_0x1f6c('0x1e')]=_0x4739ec[_0x1f6c('0x1e')]||0x0;this[_0x1f6c('0x12')]=_0x4739ec[_0x1f6c('0x12')]||0x0;this['type']=_0x4739ec[_0x1f6c('0x1f')];this['unavailable']=_0x4739ec[_0x1f6c('0x20')]||0x0;this[_0x1f6c('0x21')]=_0x4739ec['unknown']||0x0;this[_0x1f6c('0x22')]=_0x4739ec['unmanaged']||0x0;this[_0x1f6c('0x3')]=_0x4739ec[_0x1f6c('0x3')]||0x0;if(_0x4739ec[_0x1f6c('0x1f')]===_0x1f6c('0x23')){this[_0x1f6c('0x24')]=_0x4739ec[_0x1f6c('0x24')]||0x0;this[_0x1f6c('0x25')]=_0x4739ec[_0x1f6c('0x25')];this[_0x1f6c('0x26')]=_0x4739ec[_0x1f6c('0x26')];this['dialOriginateCallerIdName']=_0x4739ec[_0x1f6c('0x27')];this[_0x1f6c('0x28')]=_0x4739ec[_0x1f6c('0x28')];this['dialOriginateTimeout']=_0x4739ec[_0x1f6c('0x29')];this[_0x1f6c('0x2a')]=_0x4739ec[_0x1f6c('0x2a')];this[_0x1f6c('0x2b')]=_0x4739ec[_0x1f6c('0x2b')];this[_0x1f6c('0x2c')]=_0x4739ec['outboundAnswerAgiCallsDay'];this[_0x1f6c('0x2d')]=_0x4739ec['outboundAnswerCallsDay'];this[_0x1f6c('0x9')]=_0x4739ec[_0x1f6c('0x9')];this[_0x1f6c('0xa')]=_0x4739ec[_0x1f6c('0xa')];this[_0x1f6c('0xb')]=_0x4739ec['outboundCongestionCallsDay'];this[_0x1f6c('0x2e')]=_0x4739ec['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x4739ec[_0x1f6c('0x2f')];this[_0x1f6c('0x30')]=_0x4739ec[_0x1f6c('0x30')];this[_0x1f6c('0xc')]=_0x4739ec['outboundNoAnswerCallsDay'];this[_0x1f6c('0xd')]=_0x4739ec[_0x1f6c('0xd')];this[_0x1f6c('0x31')]=_0x4739ec[_0x1f6c('0x31')];this[_0x1f6c('0xe')]=_0x4739ec['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x4739ec[_0x1f6c('0xf')];this[_0x1f6c('0x10')]=_0x4739ec[_0x1f6c('0x10')];this[_0x1f6c('0x32')]=_0x4739ec['predictiveIntervalAnsweredCalls'];this[_0x1f6c('0x33')]=_0x4739ec['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x4739ec[_0x1f6c('0x34')];this[_0x1f6c('0x35')]=_0x4739ec[_0x1f6c('0x35')];this[_0x1f6c('0x36')]=_0x4739ec[_0x1f6c('0x36')];this[_0x1f6c('0x37')]=_0x4739ec[_0x1f6c('0x37')];this[_0x1f6c('0x38')]=_0x4739ec[_0x1f6c('0x38')];this[_0x1f6c('0x39')]=_0x4739ec[_0x1f6c('0x39')];this[_0x1f6c('0x3a')]=_0x4739ec[_0x1f6c('0x3a')];this[_0x1f6c('0x3b')]=_0x4739ec[_0x1f6c('0x3b')];this[_0x1f6c('0x3c')]=_0x4739ec[_0x1f6c('0x3c')];this['predictiveIntervalTotalCalls']=_0x4739ec[_0x1f6c('0x3d')];this[_0x1f6c('0x7')]=_0x4739ec[_0x1f6c('0x7')];this[_0x1f6c('0x3e')]=_0x4739ec[_0x1f6c('0x3e')];this['erlangCallToSecond']=_0x4739ec['erlangCallToSecond'];this[_0x1f6c('0x3f')]=_0x4739ec[_0x1f6c('0x3f')];this[_0x1f6c('0x40')]=_0x4739ec[_0x1f6c('0x40')];this[_0x1f6c('0x41')]=_0x4739ec[_0x1f6c('0x41')];this['startProgressive']=_0x4739ec[_0x1f6c('0x42')];this[_0x1f6c('0x43')]=_0x4739ec[_0x1f6c('0x43')];this[_0x1f6c('0x44')]=_0x4739ec[_0x1f6c('0x44')];}if(_0x4739ec[_0x1f6c('0x45')]){this[_0x1f6c('0x45')]={'id':_0x4739ec[_0x1f6c('0x45')]['id'],'name':_0x4739ec['Trunk']['name'],'active':_0x4739ec[_0x1f6c('0x45')]['active'],'callerid':_0x4739ec['Trunk'][_0x1f6c('0x46')]};}}VoiceQueueSummary[_0x1f6c('0x47')][_0x1f6c('0x48')]=function(_0x1a2fff,_0x158900,_0x25e350,_0x73e00){this[_0x1f6c('0x0')]=0x0;this['talking']=0x0;this[_0x1f6c('0x1')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x1f6c('0x5')]=0x0;this[_0x1f6c('0x17')]=0x0;this[_0x1f6c('0x18')]=0x0;this['unavailable']=0x0;this[_0x1f6c('0x2')]=0x0;this[_0x1f6c('0x1b')]=0x0;this[_0x1f6c('0x19')]=0x0;if(_0x25e350){if(_0x25e350[_0x1f6c('0x16')]){this['available']=Number(_0x25e350[_0x1f6c('0x16')]);}if(_0x25e350['loggedin']){this[_0x1f6c('0x6')]=Number(_0x25e350[_0x1f6c('0x49')]);}if(_0x25e350['callers']){this[_0x1f6c('0x3')]=Number(_0x25e350['callers']);}}for(var _0x533f21=0x0;_0x533f21<_0x1a2fff[_0x1f6c('0x4a')];_0x533f21++){var _0x500dc4=_0x158900[_0x1f6c('0x4b')+_0x1a2fff[_0x533f21]['name']];if(_0x500dc4&&_0x500dc4[_0x1f6c('0x4c')]){this[_0x1f6c('0x0')]+=0x1;}if(_0x1a2fff[_0x533f21][_0x1f6c('0x4d')]==='1'){this['talking']+=0x1;}if(_0x1a2fff[_0x533f21][_0x1f6c('0x1')]==='1'&&!['2','7','8'][_0x1f6c('0x4e')](_0x1a2fff[_0x533f21][_0x1f6c('0x4f')])){this['paused']+=0x1;}switch(_0x1a2fff[_0x533f21]['status']){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x1f6c('0x5')]+=0x1;break;case'3':this[_0x1f6c('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x1f6c('0x2')]+=0x1;break;case'7':this[_0x1f6c('0x1b')]+=0x1;break;case'8':this[_0x1f6c('0x19')]+=0x1;break;}}if(this[_0x1f6c('0x26')]===_0x1f6c('0x50')){var _0x4153c8=Object['keys'](_0x73e00);for(var _0x303c50=0x0;_0x303c50<_0x4153c8[_0x1f6c('0x4a')];_0x303c50++){var _0x5a3c54=_0x4153c8[_0x303c50];var _0x306f60=_0x73e00[_0x5a3c54];if(_0x306f60[_0x1f6c('0x51')]===this['name']&&_0x306f60[_0x1f6c('0x1f')]==='dialer'&&_0x306f60[_0x1f6c('0x52')]===_0x1f6c('0x53')){this[_0x1f6c('0x1e')]+=0x1;}}if(this['talking']>this[_0x1f6c('0x5')]){this[_0x1f6c('0x1e')]=this['inUse'];}this[_0x1f6c('0x24')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x1f6c('0x54')]=function(_0x437726){var _0x150908=![];if(_0x437726){_0x150908=INBOUND_COUNTERS['some'](function(_0xde9d68){return this[_0xde9d68]!==_0x437726[_0xde9d68];},this);}return _0x150908;};VoiceQueueSummary[_0x1f6c('0x47')]['compareToOutboundQueue']=function(_0x286367){var _0x56fe49=![];var _0x3fb957=![];var _0x3b135c=![];if(_0x286367){_0x56fe49=this[_0x1f6c('0x26')]!==_0x286367[_0x1f6c('0x26')]||this['dialActive']!==_0x286367['dialActive']||this['message']!==_0x286367[_0x1f6c('0x43')]||this[_0x1f6c('0x44')]!==_0x286367[_0x1f6c('0x44')];_0x3fb957=OUTBOUND_COUNTERS[_0x1f6c('0x55')](function(_0x279d44){return this[_0x279d44]!==_0x286367[_0x279d44];},this);if(this[_0x1f6c('0x45')]&&_0x286367[_0x1f6c('0x45')]){_0x3b135c=this[_0x1f6c('0x45')][_0x1f6c('0x13')]!==_0x286367[_0x1f6c('0x45')][_0x1f6c('0x13')]||this[_0x1f6c('0x45')][_0x1f6c('0x56')]!==_0x286367[_0x1f6c('0x45')][_0x1f6c('0x56')];}}return _0x56fe49||_0x3fb957||_0x3b135c;};VoiceQueueSummary[_0x1f6c('0x47')][_0x1f6c('0x57')]=function(_0xdc959a){this[_0x1f6c('0x4')]=_0xdc959a['answered'];this[_0x1f6c('0x43')]=_0xdc959a['message'];this[_0x1f6c('0x44')]=_0xdc959a[_0x1f6c('0x44')];this['originated']=_0xdc959a[_0x1f6c('0x7')];this[_0x1f6c('0x8')]=_0xdc959a[_0x1f6c('0x8')];this['outboundAnswerCallsDay']=_0xdc959a[_0x1f6c('0x2d')];this[_0x1f6c('0x9')]=_0xdc959a['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0xdc959a['outboundBusyCallsDay'];this[_0x1f6c('0xb')]=_0xdc959a['outboundCongestionCallsDay'];this[_0x1f6c('0xc')]=_0xdc959a[_0x1f6c('0xc')];this[_0x1f6c('0xd')]=_0xdc959a[_0x1f6c('0xd')];this[_0x1f6c('0xe')]=_0xdc959a['outboundReCallsDay'];this[_0x1f6c('0xf')]=_0xdc959a[_0x1f6c('0xf')];this[_0x1f6c('0x10')]=_0xdc959a[_0x1f6c('0x10')];this[_0x1f6c('0x1c')]=_0xdc959a[_0x1f6c('0x1c')];this[_0x1f6c('0x11')]=_0xdc959a[_0x1f6c('0x11')];this[_0x1f6c('0x12')]=_0xdc959a[_0x1f6c('0x12')];if(this[_0x1f6c('0x26')]==='preview'){this[_0x1f6c('0x24')]=_0xdc959a['pTalking'];}};module[_0x1f6c('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x80c3=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','notInUse','callers','SIP/','online','incall','includes','status','ringing','booked','keys','length','queue','exten','compareToOutboundQueue','dialMethod','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','outboundCongestionCallsDay','preview','exports','available','paused','talking','waiting','loggedInDb','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','answered','busy','inUse','invalid','loggedIn','onHold','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x5c6046,_0x25dcd8){var _0x4c462d=function(_0x4615c8){while(--_0x4615c8){_0x5c6046['push'](_0x5c6046['shift']());}};_0x4c462d(++_0x25dcd8);}(_0x80c3,0x18f));var _0x380c=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x80c3[_0x58965a];return _0x254efc;};'use strict';var INBOUND_COUNTERS=[_0x380c('0x0'),'loggedIn','loggedInDb',_0x380c('0x1'),'ringing',_0x380c('0x2'),_0x380c('0x3')];var OUTBOUND_COUNTERS=[_0x380c('0x0'),'answered','inUse','loggedIn',_0x380c('0x4'),'originated','outboundAbandonedCallsDay',_0x380c('0x5'),_0x380c('0x6'),_0x380c('0x7'),'outboundCongestionCallsDay',_0x380c('0x8'),_0x380c('0x9'),'outboundReCallsDay',_0x380c('0xa'),_0x380c('0xb'),'paused',_0x380c('0xc'),_0x380c('0x2'),_0x380c('0xd'),'sumDuration',_0x380c('0xe'),_0x380c('0x3')];function VoiceQueueSummary(_0x1bd451){this['id']=_0x1bd451['id'];this[_0x380c('0xf')]=_0x1bd451[_0x380c('0xf')];this[_0x380c('0x10')]=_0x1bd451[_0x380c('0x10')];this[_0x380c('0x11')]=_0x1bd451[_0x380c('0x11')]||0x0;this[_0x380c('0x12')]=_0x1bd451['answered']||0x0;this[_0x380c('0x0')]=_0x1bd451[_0x380c('0x0')]||0x0;this['busy']=_0x1bd451[_0x380c('0x13')]||0x0;this[_0x380c('0x14')]=_0x1bd451[_0x380c('0x14')]||0x0;this[_0x380c('0x15')]=_0x1bd451[_0x380c('0x15')]||0x0;this[_0x380c('0x16')]=_0x1bd451[_0x380c('0x16')]||0x0;this[_0x380c('0x4')]=_0x1bd451[_0x380c('0x4')]||0x0;this['onHold']=_0x1bd451[_0x380c('0x17')]||0x0;this['notInUse']=_0x1bd451['notInUse']||0x0;this[_0x380c('0x1')]=_0x1bd451['paused']||0x0;this['ringing']=_0x1bd451['ringing']||0x0;this['ringInUse']=_0x1bd451[_0x380c('0x18')];this[_0x380c('0xd')]=_0x1bd451[_0x380c('0xd')];this[_0x380c('0x19')]=_0x1bd451[_0x380c('0x19')];this[_0x380c('0x1a')]=_0x1bd451[_0x380c('0x1a')]||0x0;this[_0x380c('0x2')]=_0x1bd451[_0x380c('0x2')]||0x0;this[_0x380c('0xe')]=_0x1bd451[_0x380c('0xe')]||0x0;this[_0x380c('0x1b')]=_0x1bd451[_0x380c('0x1b')];this[_0x380c('0x1c')]=_0x1bd451[_0x380c('0x1c')]||0x0;this[_0x380c('0x1d')]=_0x1bd451[_0x380c('0x1d')]||0x0;this[_0x380c('0x1e')]=_0x1bd451[_0x380c('0x1e')]||0x0;this[_0x380c('0x3')]=_0x1bd451[_0x380c('0x3')]||0x0;if(_0x1bd451['type']===_0x380c('0x1f')){this['pTalking']=_0x1bd451[_0x380c('0xc')]||0x0;this['dialActive']=_0x1bd451[_0x380c('0x20')];this['dialMethod']=_0x1bd451['dialMethod'];this[_0x380c('0x21')]=_0x1bd451[_0x380c('0x21')];this['dialOriginateCallerIdNumber']=_0x1bd451[_0x380c('0x22')];this[_0x380c('0x23')]=_0x1bd451[_0x380c('0x23')];this[_0x380c('0x24')]=_0x1bd451[_0x380c('0x24')];this[_0x380c('0x25')]=_0x1bd451[_0x380c('0x25')];this[_0x380c('0x26')]=_0x1bd451['outboundAnswerAgiCallsDay'];this[_0x380c('0x5')]=_0x1bd451[_0x380c('0x5')];this[_0x380c('0x6')]=_0x1bd451[_0x380c('0x6')];this[_0x380c('0x7')]=_0x1bd451['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x1bd451['outboundCongestionCallsDay'];this[_0x380c('0x27')]=_0x1bd451['outboundDropCallsDayACS'];this[_0x380c('0x28')]=_0x1bd451[_0x380c('0x28')];this['outboundDropCallsDayTimeout']=_0x1bd451[_0x380c('0x29')];this[_0x380c('0x8')]=_0x1bd451[_0x380c('0x8')];this[_0x380c('0x9')]=_0x1bd451['outboundNoSuchCallsDay'];this[_0x380c('0x2a')]=_0x1bd451[_0x380c('0x2a')];this[_0x380c('0x2b')]=_0x1bd451[_0x380c('0x2b')];this[_0x380c('0xa')]=_0x1bd451[_0x380c('0xa')];this[_0x380c('0xb')]=_0x1bd451[_0x380c('0xb')];this['predictiveIntervalAnsweredCalls']=_0x1bd451['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x1bd451[_0x380c('0x2c')];this['predictiveIntervalAvgTalktime']=_0x1bd451[_0x380c('0x2d')];this['predictiveIntervalDroppedCallsCallersExit']=_0x1bd451[_0x380c('0x2e')];this[_0x380c('0x2f')]=_0x1bd451[_0x380c('0x2f')];this['predictiveIntervalErlangCalls']=_0x1bd451[_0x380c('0x30')];this[_0x380c('0x31')]=_0x1bd451[_0x380c('0x31')];this[_0x380c('0x32')]=_0x1bd451['predictiveIntervalHitRate'];this[_0x380c('0x33')]=_0x1bd451['predictiveIntervalMultiplicativeFactor'];this[_0x380c('0x34')]=_0x1bd451['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x1bd451[_0x380c('0x35')];this[_0x380c('0x36')]=_0x1bd451[_0x380c('0x36')];this[_0x380c('0x37')]=_0x1bd451[_0x380c('0x37')];this[_0x380c('0x38')]=_0x1bd451['erlangCalls'];this[_0x380c('0x39')]=_0x1bd451['erlangCallToSecond'];this[_0x380c('0x3a')]=_0x1bd451[_0x380c('0x3a')];this[_0x380c('0x3b')]=_0x1bd451['erlangBusyFactor'];this[_0x380c('0x3c')]=_0x1bd451[_0x380c('0x3c')];this[_0x380c('0x3d')]=_0x1bd451[_0x380c('0x3d')];this['message']=_0x1bd451[_0x380c('0x3e')];this[_0x380c('0x3f')]=_0x1bd451[_0x380c('0x3f')];}if(_0x1bd451['Trunk']){this[_0x380c('0x40')]={'id':_0x1bd451[_0x380c('0x40')]['id'],'name':_0x1bd451[_0x380c('0x40')][_0x380c('0xf')],'active':_0x1bd451['Trunk'][_0x380c('0x41')],'callerid':_0x1bd451[_0x380c('0x40')][_0x380c('0x42')]};}}VoiceQueueSummary[_0x380c('0x43')]['createReport']=function(_0x1b06ac,_0x1476c2,_0x1c6ae0,_0xbf7d00){this['loggedInDb']=0x0;this[_0x380c('0x2')]=0x0;this[_0x380c('0x1')]=0x0;this[_0x380c('0x1d')]=0x0;this[_0x380c('0x44')]=0x0;this[_0x380c('0x14')]=0x0;this[_0x380c('0x13')]=0x0;this[_0x380c('0x15')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x380c('0x18')]=0x0;this['onHold']=0x0;if(_0x1c6ae0){if(_0x1c6ae0[_0x380c('0x0')]){this[_0x380c('0x0')]=Number(_0x1c6ae0[_0x380c('0x0')]);}if(_0x1c6ae0['loggedin']){this['loggedIn']=Number(_0x1c6ae0['loggedin']);}if(_0x1c6ae0[_0x380c('0x45')]){this['waiting']=Number(_0x1c6ae0[_0x380c('0x45')]);}}for(var _0xafeb59=0x0;_0xafeb59<_0x1b06ac['length'];_0xafeb59++){var _0x1af89b=_0x1476c2[_0x380c('0x46')+_0x1b06ac[_0xafeb59][_0x380c('0xf')]];if(_0x1af89b&&_0x1af89b[_0x380c('0x47')]){this['loggedInDb']+=0x1;}if(_0x1b06ac[_0xafeb59][_0x380c('0x48')]==='1'){this[_0x380c('0x2')]+=0x1;}if(_0x1b06ac[_0xafeb59]['paused']==='1'&&!['2','7','8'][_0x380c('0x49')](_0x1b06ac[_0xafeb59]['status'])){this['paused']+=0x1;}switch(_0x1b06ac[_0xafeb59][_0x380c('0x4a')]){case'0':this[_0x380c('0x1d')]+=0x1;break;case'1':this[_0x380c('0x44')]+=0x1;break;case'2':this[_0x380c('0x14')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x380c('0x15')]+=0x1;break;case'5':this[_0x380c('0x1c')]+=0x1;break;case'6':this[_0x380c('0x4b')]+=0x1;break;case'7':this[_0x380c('0x18')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x380c('0x4c')){var _0x53adf9=Object[_0x380c('0x4d')](_0xbf7d00);for(var _0x20c47e=0x0;_0x20c47e<_0x53adf9[_0x380c('0x4e')];_0x20c47e++){var _0x29cf7a=_0x53adf9[_0x20c47e];var _0x28dd3b=_0xbf7d00[_0x29cf7a];if(_0x28dd3b[_0x380c('0x4f')]===this[_0x380c('0xf')]&&_0x28dd3b[_0x380c('0x1b')]==='dialer'&&_0x28dd3b[_0x380c('0x50')]==='xcally-motion-preview'){this[_0x380c('0x2')]+=0x1;}}if(this['talking']>this['inUse']){this[_0x380c('0x2')]=this[_0x380c('0x14')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x380c('0x43')]['compareToInboundQueue']=function(_0x128e25){var _0x1acff9=![];if(_0x128e25){_0x1acff9=INBOUND_COUNTERS['some'](function(_0x4e503d){return this[_0x4e503d]!==_0x128e25[_0x4e503d];},this);}return _0x1acff9;};VoiceQueueSummary['prototype'][_0x380c('0x51')]=function(_0x272939){var _0x520fa4=![];var _0x28967c=![];var _0x437518=![];if(_0x272939){_0x520fa4=this[_0x380c('0x52')]!==_0x272939[_0x380c('0x52')]||this[_0x380c('0x20')]!==_0x272939['dialActive']||this['message']!==_0x272939['message']||this[_0x380c('0x3f')]!==_0x272939['statusMessage'];_0x28967c=OUTBOUND_COUNTERS[_0x380c('0x53')](function(_0x3bb8ac){return this[_0x3bb8ac]!==_0x272939[_0x3bb8ac];},this);if(this[_0x380c('0x40')]&&_0x272939[_0x380c('0x40')]){_0x437518=this[_0x380c('0x40')][_0x380c('0xf')]!==_0x272939[_0x380c('0x40')][_0x380c('0xf')]||this[_0x380c('0x40')][_0x380c('0x41')]!==_0x272939[_0x380c('0x40')][_0x380c('0x41')];}}return _0x520fa4||_0x28967c||_0x437518;};VoiceQueueSummary[_0x380c('0x43')][_0x380c('0x54')]=function(_0x120783){this[_0x380c('0x12')]=_0x120783['answered'];this[_0x380c('0x3e')]=_0x120783[_0x380c('0x3e')];this['statusMessage']=_0x120783['statusMessage'];this[_0x380c('0x37')]=_0x120783[_0x380c('0x37')];this[_0x380c('0x55')]=_0x120783[_0x380c('0x55')];this[_0x380c('0x5')]=_0x120783[_0x380c('0x5')];this[_0x380c('0x6')]=_0x120783[_0x380c('0x6')];this[_0x380c('0x7')]=_0x120783['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x120783[_0x380c('0x56')];this['outboundNoAnswerCallsDay']=_0x120783[_0x380c('0x8')];this[_0x380c('0x9')]=_0x120783[_0x380c('0x9')];this[_0x380c('0x2b')]=_0x120783[_0x380c('0x2b')];this[_0x380c('0xa')]=_0x120783['outboundRejectCallsDay'];this[_0x380c('0xb')]=_0x120783[_0x380c('0xb')];this['sumBillable']=_0x120783['sumBillable'];this[_0x380c('0x19')]=_0x120783[_0x380c('0x19')];this[_0x380c('0xe')]=_0x120783[_0x380c('0xe')];if(this['dialMethod']===_0x380c('0x57')){this['pTalking']=_0x120783[_0x380c('0xc')];}};module[_0x380c('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 82ee277..2a9bd21 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 _0xa1b6=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x3c62ab,_0x33f23d){var _0x536970=function(_0x3a4759){while(--_0x3a4759){_0x3c62ab['push'](_0x3c62ab['shift']());}};_0x536970(++_0x33f23d);}(_0xa1b6,0x137));var _0x6a1b=function(_0x1787fd,_0xf44dec){_0x1787fd=_0x1787fd-0x0;var _0xbf4c6=_0xa1b6[_0x1787fd];return _0xbf4c6;};'use strict';function VtigerAccount(_0x423e13){this['id']=_0x423e13['id']||0x0;this[_0x6a1b('0x0')]=_0x423e13[_0x6a1b('0x0')]||'';this[_0x6a1b('0x1')]=_0x423e13[_0x6a1b('0x1')]||'';this['accessKey']=_0x423e13[_0x6a1b('0x2')]||'';this['remoteUri']=_0x423e13[_0x6a1b('0x3')]||'';this[_0x6a1b('0x4')]=_0x423e13[_0x6a1b('0x4')]||'';this[_0x6a1b('0x5')]=_0x423e13[_0x6a1b('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xd9ed=['accessKey','serverUrl','Configurations','name','username'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd9ed,0x152));var _0xdd9e=function(_0x2cc88e,_0xa5797a){_0x2cc88e=_0x2cc88e-0x0;var _0x5306d7=_0xd9ed[_0x2cc88e];return _0x5306d7;};'use strict';function VtigerAccount(_0x979488){this['id']=_0x979488['id']||0x0;this[_0xdd9e('0x0')]=_0x979488[_0xdd9e('0x0')]||'';this[_0xdd9e('0x1')]=_0x979488['username']||'';this[_0xdd9e('0x2')]=_0x979488[_0xdd9e('0x2')]||'';this['remoteUri']=_0x979488['remoteUri']||'';this[_0xdd9e('0x3')]=_0x979488['serverUrl']||'';this[_0xdd9e('0x4')]=_0x979488[_0xdd9e('0x4')]||{};}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 35104c6..825594b 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 _0x8c3d=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','type'];(function(_0x697b6e,_0xd5ab09){var _0x4ea11c=function(_0x1ab3cf){while(--_0x1ab3cf){_0x697b6e['push'](_0x697b6e['shift']());}};_0x4ea11c(++_0xd5ab09);}(_0x8c3d,0x1bc));var _0xd8c3=function(_0x491468,_0x42f169){_0x491468=_0x491468-0x0;var _0x5b8c22=_0x8c3d[_0x491468];return _0x5b8c22;};'use strict';function ZendeskAccount(_0x2db4e3){this['id']=_0x2db4e3['id']||0x0;this[_0xd8c3('0x0')]=_0x2db4e3[_0xd8c3('0x0')]||'';this[_0xd8c3('0x1')]=_0x2db4e3[_0xd8c3('0x1')]||'';this[_0xd8c3('0x2')]=_0x2db4e3[_0xd8c3('0x2')]||'';this[_0xd8c3('0x3')]=_0x2db4e3['token']||'';this[_0xd8c3('0x4')]=_0x2db4e3[_0xd8c3('0x4')]||'';this['authType']=_0x2db4e3['authType']||'';this[_0xd8c3('0x5')]=_0x2db4e3[_0xd8c3('0x5')]||'integrationTab';this[_0xd8c3('0x6')]=_0x2db4e3[_0xd8c3('0x6')]||'';this[_0xd8c3('0x7')]=_0x2db4e3[_0xd8c3('0x7')]||{};}module[_0xd8c3('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x1dd4=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x980527,_0x1d95e6){var _0x15c9cb=function(_0x4334ab){while(--_0x4334ab){_0x980527['push'](_0x980527['shift']());}};_0x15c9cb(++_0x1d95e6);}(_0x1dd4,0xf0));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';function ZendeskAccount(_0x1a77fb){this['id']=_0x1a77fb['id']||0x0;this['name']=_0x1a77fb[_0x41dd('0x0')]||'';this[_0x41dd('0x1')]=_0x1a77fb[_0x41dd('0x1')]||'';this[_0x41dd('0x2')]=_0x1a77fb['password']||'';this[_0x41dd('0x3')]=_0x1a77fb[_0x41dd('0x3')]||'';this[_0x41dd('0x4')]=_0x1a77fb[_0x41dd('0x4')]||'';this[_0x41dd('0x5')]=_0x1a77fb[_0x41dd('0x5')]||'';this['type']=_0x1a77fb[_0x41dd('0x6')]||_0x41dd('0x7');this['serverUrl']=_0x1a77fb[_0x41dd('0x8')]||'';this[_0x41dd('0x9')]=_0x1a77fb['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 399cd04..c58e8e7 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 _0xf81c=['clientSecret','serverUrl','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x5794bb,_0x23ed8d){var _0x501067=function(_0xd4b8c){while(--_0xd4b8c){_0x5794bb['push'](_0x5794bb['shift']());}};_0x501067(++_0x23ed8d);}(_0xf81c,0xff));var _0xcf81=function(_0x274509,_0x1353f7){_0x274509=_0x274509-0x0;var _0x47298c=_0xf81c[_0x274509];return _0x47298c;};'use strict';function ZohoAccount(_0x5a158a){this['id']=_0x5a158a['id']||0x0;this[_0xcf81('0x0')]=_0x5a158a['name']||'';this[_0xcf81('0x1')]=_0x5a158a[_0xcf81('0x1')]||'';this['host']=_0x5a158a[_0xcf81('0x2')]||'';this[_0xcf81('0x3')]=_0x5a158a[_0xcf81('0x3')]||'';this[_0xcf81('0x4')]=_0x5a158a[_0xcf81('0x4')]||'';this[_0xcf81('0x5')]=_0x5a158a[_0xcf81('0x5')]||'';this['serverUrl']=_0x5a158a[_0xcf81('0x6')]||'';this['code']=_0x5a158a['code']||'';this[_0xcf81('0x7')]=_0x5a158a[_0xcf81('0x7')]||'';this[_0xcf81('0x8')]=_0x5a158a[_0xcf81('0x8')]||{};}module[_0xcf81('0x9')]=ZohoAccount; \ No newline at end of file +var _0xa8b1=['serverUrl','code','refreshToken','Configurations','exports','name','description','zone','clientId','clientSecret'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa8b1,0x1a9));var _0x1a8b=function(_0x5cf08e,_0x5c1234){_0x5cf08e=_0x5cf08e-0x0;var _0x1d5b44=_0xa8b1[_0x5cf08e];return _0x1d5b44;};'use strict';function ZohoAccount(_0x3fadb3){this['id']=_0x3fadb3['id']||0x0;this[_0x1a8b('0x0')]=_0x3fadb3['name']||'';this[_0x1a8b('0x1')]=_0x3fadb3[_0x1a8b('0x1')]||'';this['host']=_0x3fadb3['host']||'';this[_0x1a8b('0x2')]=_0x3fadb3['zone']||'';this['clientId']=_0x3fadb3[_0x1a8b('0x3')]||'';this[_0x1a8b('0x4')]=_0x3fadb3[_0x1a8b('0x4')]||'';this[_0x1a8b('0x5')]=_0x3fadb3['serverUrl']||'';this['code']=_0x3fadb3[_0x1a8b('0x6')]||'';this[_0x1a8b('0x7')]=_0x3fadb3[_0x1a8b('0x7')]||'';this[_0x1a8b('0x8')]=_0x3fadb3[_0x1a8b('0x8')]||{};}module[_0x1a8b('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 00b58ad..f002972 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 _0xe511=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','util','lodash','string','isNil','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x588336,_0x5a353c){var _0x3e1cb5=function(_0x4893ed){while(--_0x4893ed){_0x588336['push'](_0x588336['shift']());}};_0x3e1cb5(++_0x5a353c);}(_0xe511,0x16f));var _0x1e51=function(_0x57834a,_0xfac574){_0x57834a=_0x57834a-0x0;var _0x5788d9=_0xe511[_0x57834a];return _0x5788d9;};'use strict';var util=require(_0x1e51('0x0'));var _=require(_0x1e51('0x1'));var moment=require('moment');function checkNameSurname(_0x2a5905,_0x5b9e45,_0x253e96){var _0xb75a96='';if(!_['isNil'](_0x5b9e45)&&_0x1e51('0x2')===typeof _0x5b9e45){_0xb75a96+=_0x5b9e45;}if(!_[_0x1e51('0x3')](_0x253e96)&&_0x1e51('0x2')===typeof _0x253e96){_0xb75a96+='\x20'+_0x253e96;}if(_0xb75a96!==''){return _0xb75a96;}return _0x2a5905;}function Action(_0x16ec99,_0x480cca,_0x26b22c,_0x21ed6b,_0x5c4590){this['uniqueid']=_0x26b22c||undefined;this[_0x1e51('0x4')]=_0x16ec99['id'];this[_0x1e51('0x5')]=_0x480cca['name'];this['type']=_0x480cca[_0x1e51('0x6')];this[_0x1e51('0x7')]=_0x1e51('0x5');this[_0x1e51('0x8')]=![];this[_0x1e51('0x9')]=_[_0x1e51('0x3')](_0x16ec99['Agent'])?undefined:_0x16ec99[_0x1e51('0xa')][_0x1e51('0xb')];this[_0x1e51('0xc')]=this[_0x1e51('0x9')]?util[_0x1e51('0xd')](_0x1e51('0xe'),this['membername']):_0x21ed6b||undefined;this[_0x1e51('0xf')]=checkNameSurname(_0x16ec99[_0x1e51('0x10')][_0x1e51('0x11')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x12')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x13')]);this[_0x1e51('0x14')]=_0x16ec99[_0x1e51('0x14')]||![];this[_0x1e51('0x15')]=_0x16ec99['phone'];this[_0x1e51('0x16')]=_0x16ec99[_0x1e51('0x16')];this[_0x1e51('0x17')]=_0x16ec99['countbusyretry']||0x0;this[_0x1e51('0x18')]=_0x16ec99['countcongestionretry']||0x0;this['countnoanswerretry']=_0x16ec99[_0x1e51('0x19')]||0x0;this[_0x1e51('0x1a')]=(_0x16ec99[_0x1e51('0x17')]||0x0)+(_0x16ec99[_0x1e51('0x18')]||0x0)+(_0x16ec99[_0x1e51('0x19')]||0x0)+(_0x16ec99[_0x1e51('0x1b')]||0x0)+(_0x16ec99['countdropretry']||0x0)+(_0x16ec99[_0x1e51('0x1c')]||0x0)+(_0x16ec99['countmachineretry']||0x0)+(_0x16ec99[_0x1e51('0x1d')]||0x0);this[_0x1e51('0x1b')]=_0x16ec99[_0x1e51('0x1b')]||0x0;this[_0x1e51('0x1e')]=_0x16ec99['countdropretry']||0x0;this['countabandonedretry']=_0x16ec99['countabandonedretry']||0x0;this['countmachineretry']=_0x16ec99[_0x1e51('0x1f')]||0x0;this['countagentrejectretry']=_0x16ec99[_0x1e51('0x1d')]||0x0;this[_0x1e51('0x20')]=_0x16ec99[_0x1e51('0x20')];this[_0x1e51('0x21')]=_0x16ec99[_0x1e51('0x21')];this[_0x1e51('0x22')]=_0x16ec99[_0x1e51('0x22')];this[_0x1e51('0x23')]=_0x16ec99['recallme'];this['ContactId']=_0x16ec99[_0x1e51('0x24')];this[_0x1e51('0x25')]=_0x16ec99[_0x1e51('0x25')];this[_0x1e51('0x26')]=_['isNil'](_0x16ec99['Agent'])?_0x16ec99['UserId']:_0x16ec99[_0x1e51('0xa')]['id'];this[_0x1e51('0x27')]=_0x16ec99[_0x1e51('0x27')];this['originatecalleridnum']='';this[_0x1e51('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x1e51('0xd')]('\x22%s\x22\x20<%s>',this[_0x1e51('0xf')],this[_0x1e51('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0x160f=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','type','campaigntype','queue','Agent','channelAgent','membername','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat'];(function(_0x45d1fa,_0x2ff76f){var _0x380621=function(_0x1fd143){while(--_0x1fd143){_0x45d1fa['push'](_0x45d1fa['shift']());}};_0x380621(++_0x2ff76f);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf160('0x0'));var _=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));function checkNameSurname(_0x2966aa,_0x5bf9e1,_0x4513f1){var _0x2fb414='';if(!_[_0xf160('0x3')](_0x5bf9e1)&&_0xf160('0x4')===typeof _0x5bf9e1){_0x2fb414+=_0x5bf9e1;}if(!_[_0xf160('0x3')](_0x4513f1)&&_0xf160('0x4')===typeof _0x4513f1){_0x2fb414+='\x20'+_0x4513f1;}if(_0x2fb414!==''){return _0x2fb414;}return _0x2966aa;}function Action(_0x4a6f3d,_0x311d63,_0x11902f,_0x49fe49,_0x59440e){this[_0xf160('0x5')]=_0x11902f||undefined;this['idContact']=_0x4a6f3d['id'];this['queue']=_0x311d63['name'];this[_0xf160('0x6')]=_0x311d63[_0xf160('0x6')];this[_0xf160('0x7')]=_0xf160('0x8');this['dialAnswer']=![];this['membername']=_[_0xf160('0x3')](_0x4a6f3d[_0xf160('0x9')])?undefined:_0x4a6f3d[_0xf160('0x9')]['name'];this[_0xf160('0xa')]=this[_0xf160('0xb')]?util[_0xf160('0xc')](_0xf160('0xd'),this[_0xf160('0xb')]):_0x49fe49||undefined;this['calleridname']=checkNameSurname(_0x4a6f3d[_0xf160('0xe')]['phone'],_0x4a6f3d[_0xf160('0xe')][_0xf160('0xf')],_0x4a6f3d[_0xf160('0xe')][_0xf160('0x10')]);this[_0xf160('0x11')]=_0x4a6f3d[_0xf160('0x11')]||![];this[_0xf160('0x12')]=_0x4a6f3d[_0xf160('0x13')];this[_0xf160('0x14')]=_0x4a6f3d['scheduledat'];this[_0xf160('0x15')]=_0x4a6f3d[_0xf160('0x15')]||0x0;this[_0xf160('0x16')]=_0x4a6f3d[_0xf160('0x16')]||0x0;this['countnoanswerretry']=_0x4a6f3d[_0xf160('0x17')]||0x0;this['countglobal']=(_0x4a6f3d[_0xf160('0x15')]||0x0)+(_0x4a6f3d[_0xf160('0x16')]||0x0)+(_0x4a6f3d[_0xf160('0x17')]||0x0)+(_0x4a6f3d[_0xf160('0x18')]||0x0)+(_0x4a6f3d[_0xf160('0x19')]||0x0)+(_0x4a6f3d[_0xf160('0x1a')]||0x0)+(_0x4a6f3d[_0xf160('0x1b')]||0x0)+(_0x4a6f3d[_0xf160('0x1c')]||0x0);this[_0xf160('0x18')]=_0x4a6f3d['countnosuchnumberretry']||0x0;this[_0xf160('0x19')]=_0x4a6f3d[_0xf160('0x19')]||0x0;this[_0xf160('0x1a')]=_0x4a6f3d['countabandonedretry']||0x0;this[_0xf160('0x1b')]=_0x4a6f3d[_0xf160('0x1b')]||0x0;this[_0xf160('0x1c')]=_0x4a6f3d[_0xf160('0x1c')]||0x0;this[_0xf160('0x1d')]=_0x4a6f3d[_0xf160('0x1d')];this[_0xf160('0x1e')]=_0x4a6f3d['callbackuniqueid'];this[_0xf160('0x1f')]=_0x4a6f3d[_0xf160('0x1f')];this[_0xf160('0x20')]=_0x4a6f3d[_0xf160('0x20')];this['ContactId']=_0x4a6f3d[_0xf160('0x21')];this[_0xf160('0x22')]=_0x4a6f3d['ListId'];this['UserId']=_[_0xf160('0x3')](_0x4a6f3d[_0xf160('0x9')])?_0x4a6f3d[_0xf160('0x23')]:_0x4a6f3d['Agent']['id'];this[_0xf160('0x24')]=_0x4a6f3d[_0xf160('0x24')];this[_0xf160('0x25')]='';this[_0xf160('0x26')]='';}Action[_0xf160('0x27')][_0xf160('0x28')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0xf160('0x29')]);};module[_0xf160('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index e6efb15..913db7a 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 _0xf0e4=['[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','buildObj','connect','acw','mandatoryDisposition','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','unlockAgent','swapAdditionalPhones','CONGESTION','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','active','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','Contact','assign','variables','[originated][increment]','[originateFailure][logOriginateFailure]','channel','actionid','clone','response','unlockContact','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','[syncHangup][talking][transfer]','syncDialEnd','addVariable','filterKey','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','prototype','tail','finally','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','dialMethod','booked','type','clearZombieChannels','dialPreviewAutoRecallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','actions','originated:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','agentReadyId','length','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','totalGlobal','logCustomer','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','responsetime','answertime'];(function(_0xa27fe,_0x56b4be){var _0x2f7f97=function(_0x3eae92){while(--_0x3eae92){_0xa27fe['push'](_0xa27fe['shift']());}};_0x2f7f97(++_0x56b4be);}(_0xf0e4,0xb1));var _0x4f0e=function(_0x5a4157,_0x5000a0){_0x5a4157=_0x5a4157-0x0;var _0x49e1cd=_0xf0e4[_0x5a4157];return _0x49e1cd;};'use strict';var util=require(_0x4f0e('0x0'));var _=require(_0x4f0e('0x1'));var uuid=require(_0x4f0e('0x2'));var moment=require(_0x4f0e('0x3'));var Redis=require(_0x4f0e('0x4'));var config=require(_0x4f0e('0x5'));var logger=require(_0x4f0e('0x6'))(_0x4f0e('0x7'));var loggerAction=require('../../../config/logger')(_0x4f0e('0x8'));var ami=require(_0x4f0e('0x9'));var rpcDb=require(_0x4f0e('0xa'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x4f0e('0xb'));var ut=require(_0x4f0e('0xc'));var utils=require('../dialer/utils');config[_0x4f0e('0xd')]=_[_0x4f0e('0xe')](config[_0x4f0e('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f0e('0xd')]));var Sequence=function(){};Sequence[_0x4f0e('0xf')]['enqueue']=function(_0x31eabb){this[_0x4f0e('0x10')]=this['tail']?this['tail'][_0x4f0e('0x11')](_0x31eabb):_0x31eabb();};function Preview(_0x391935){this['sequence']=new Sequence();this[_0x4f0e('0x12')]=_0x391935[_0x4f0e('0x13')];this[_0x4f0e('0x14')]=_0x391935[_0x4f0e('0x14')];this['actions']={};this['agents']=_0x391935[_0x4f0e('0x15')];this[_0x4f0e('0x16')]=0x0;ami['on'](_0x4f0e('0x17'),this[_0x4f0e('0x18')][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x1a'),this[_0x4f0e('0x1b')][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x1c'),this[_0x4f0e('0x1d')][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x1e'),this['syncDialEnd'][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x1f'),this[_0x4f0e('0x20')]['bind'](this));ami['on'](_0x4f0e('0x21'),this[_0x4f0e('0x22')]['bind'](this));ami['on'](_0x4f0e('0x23'),this['syncAttendedTransfer'][_0x4f0e('0x19')](this));ami['on'](_0x4f0e('0x24'),this['syncBlindTransfer']['bind'](this));this[_0x4f0e('0x25')](this[_0x4f0e('0x12')]);}function emit(_0x1f195a,_0x14c2a3,_0x551a9d){io['to'](_0x1f195a)['emit'](_0x14c2a3,_0x551a9d);}function emitVoiceQueueChannelRemove(_0x2050fe){logger[_0x4f0e('0x26')](_0x4f0e('0x27'),JSON[_0x4f0e('0x28')](_0x2050fe));emit(util[_0x4f0e('0x29')](_0x4f0e('0x2a'),_0x2050fe[_0x4f0e('0x2b')]),_0x4f0e('0x2c'),_0x2050fe);io[_0x4f0e('0x2d')](_0x4f0e('0x2e'),_0x2050fe);}function notSendMessagesQueue(_0x28afee){if(_0x28afee[_0x4f0e('0x2f')]){if(_0x28afee[_0x4f0e('0x30')]===0x0&&_0x28afee[_0x4f0e('0x31')]===0x0){_0x28afee[_0x4f0e('0x2f')]=![];_0x28afee[_0x4f0e('0x32')]=0x0;_0x28afee[_0x4f0e('0x33')]=0x0;_0x28afee[_0x4f0e('0x34')]=utils[_0x4f0e('0x35')][_0x4f0e('0x36')];ut[_0x4f0e('0x37')](_0x4f0e('0x38'),_0x28afee[_0x4f0e('0x2b')]+'\x20is\x20not\x20active');}else{_0x28afee[_0x4f0e('0x34')]=utils['CAMPAIGN_STATUS'][_0x4f0e('0x39')];ut[_0x4f0e('0x37')](_0x4f0e('0x38'),_0x28afee[_0x4f0e('0x2b')]+_0x4f0e('0x3a'));}}}Preview[_0x4f0e('0xf')][_0x4f0e('0x25')]=function(){var _0x607c53=this;setInterval(function(){_0x607c53[_0x4f0e('0x3b')]();},0x7cf);};Preview[_0x4f0e('0xf')]['syncCampaigns']=function(){var _0x5a4a9f=this['campaignsPreview'];this[_0x4f0e('0x16')]+=0x1;for(var _0x35cc8c in _0x5a4a9f){if(_0x5a4a9f['hasOwnProperty'](_0x35cc8c)&&(_0x5a4a9f[_0x35cc8c][_0x4f0e('0x3c')]===_0x4f0e('0x7')||_0x5a4a9f[_0x35cc8c][_0x4f0e('0x3c')]===_0x4f0e('0x3d'))&&_0x5a4a9f[_0x35cc8c][_0x4f0e('0x3e')]==='outbound'){if(this[_0x4f0e('0x16')]>0x7){this[_0x4f0e('0x16')]=0x0;this[_0x4f0e('0x3f')]();}}if(_0x5a4a9f['hasOwnProperty'](_0x35cc8c)&&_0x5a4a9f[_0x35cc8c]['dialMethod']==='preview'&&_0x5a4a9f[_0x35cc8c][_0x4f0e('0x3e')]==='outbound'){if(_0x5a4a9f[_0x35cc8c]['dialActive']){this['setMessage'](_0x5a4a9f[_0x35cc8c]);if(_0x5a4a9f[_0x35cc8c][_0x4f0e('0x40')])this['recallMe'](_0x5a4a9f[_0x35cc8c]);}else{notSendMessagesQueue(_0x5a4a9f[_0x35cc8c]);}}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x41')]=function(_0x542742){var _0x2a88d9=this;this[_0x4f0e('0x42')]['enqueue'](function(){if(!_[_0x4f0e('0x43')](_0x2a88d9['actions'][_0x542742])){loggerAction[_0x4f0e('0x26')](_0x4f0e('0x44'),_0x542742,_0x4f0e('0x45'),_0x2a88d9[_0x4f0e('0x46')][_0x542742]['queue'],_0x4f0e('0x47'),JSON[_0x4f0e('0x28')](_0x2a88d9[_0x4f0e('0x12')][_0x2a88d9['actions'][_0x542742][_0x4f0e('0x48')]][_0x4f0e('0x30')]),'pTalking:\x20',JSON[_0x4f0e('0x28')](_0x2a88d9[_0x4f0e('0x12')][_0x2a88d9[_0x4f0e('0x46')][_0x542742][_0x4f0e('0x48')]][_0x4f0e('0x31')]),JSON[_0x4f0e('0x28')](_0x2a88d9[_0x4f0e('0x46')][_0x542742][_0x4f0e('0x49')]),JSON['stringify'](_[_0x4f0e('0x4a')](_0x2a88d9['actions'][_0x542742],[_0x4f0e('0x4b'),_0x4f0e('0x4c'),_0x4f0e('0x4d'),_0x4f0e('0x4e')])));return ami[_0x4f0e('0x4f')]({'action':_0x4f0e('0x50'),'channel':_0x2a88d9['actions'][_0x542742]['channel']})[_0x4f0e('0x51')](function(_0x1b6378){if(_0x1b6378[_0x4f0e('0x34')]===_0x4f0e('0x52')){setTimeout(function(){if(_0x2a88d9['actions'][_0x542742]){utils[_0x4f0e('0x53')](_0x2a88d9['campaignsPreview'][_0x2a88d9[_0x4f0e('0x46')][_0x542742][_0x4f0e('0x48')]],_0x4f0e('0x54'));if(_0x2a88d9[_0x4f0e('0x46')][_0x542742][_0x4f0e('0x49')]===!![]){ut[_0x4f0e('0x55')](_0x2a88d9[_0x4f0e('0x12')][_0x2a88d9[_0x4f0e('0x46')][_0x542742]['queue']],'[clearZombieChannel]');ut[_0x4f0e('0x56')](_0x4f0e('0x57')+_0x542742,_0x2a88d9[_0x4f0e('0x46')][_0x542742]['queue']);}ut['loggerError'](_0x4f0e('0x58')+_0x542742,_0x2a88d9['actions'][_0x542742][_0x4f0e('0x48')]);delete _0x2a88d9[_0x4f0e('0x46')][_0x542742];}},0x2328);}});}});};Preview[_0x4f0e('0xf')][_0x4f0e('0x3f')]=function(){var _0x356894=this;loggerAction[_0x4f0e('0x26')](_0x4f0e('0x59'),_[_0x4f0e('0x5a')](this[_0x4f0e('0x46')]));for(var _0xdb7015 in this['actions']){if(_0x356894[_0x4f0e('0x46')]['hasOwnProperty'](_0xdb7015)){_0x356894[_0x4f0e('0x41')](_0xdb7015);}}};Preview['prototype'][_0x4f0e('0x5b')]=function(_0x88831f){var _0x1fb7e7=this;rpcDb['getContactRecallMe'](_0x88831f['id'],ut[_0x4f0e('0x5c')](this[_0x4f0e('0x15')]))['then'](function(_0x3ae0dd){if(!_[_0x4f0e('0x43')](_0x3ae0dd)){for(var _0x1005fa=0x0;_0x1005fa<_0x3ae0dd[_0x4f0e('0x5d')];_0x1005fa+=0x1){if(ut['getDiff'](_0x3ae0dd[_0x1005fa][_0x4f0e('0x5e')])<_0x88831f[_0x4f0e('0x5f')]*0x3c){if(_0x3ae0dd[_0x1005fa][_0x4f0e('0x60')]&&!_0x3ae0dd[_0x1005fa][_0x4f0e('0x60')]['voicePause']){_0x1fb7e7[_0x4f0e('0x61')](_0x3ae0dd[_0x1005fa]['id'])[_0x4f0e('0x62')](ut[_0x4f0e('0x63')]('[RecallMe]'))['catch'](ut[_0x4f0e('0x63')]('[RecallMe]'));}else{rpcDb[_0x4f0e('0x64')](_0x3ae0dd[_0x1005fa]['id']);}}else{var _0x1caede=new Action(_0x3ae0dd[_0x1005fa],_0x88831f);_0x1caede[_0x4f0e('0x65')]=moment()['format'](_0x4f0e('0x66'));_0x88831f['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x1caede,0x17,_0x4f0e('0x67'));if(_0x88831f[_0x4f0e('0x68')]){rpcDb[_0x4f0e('0x69')](ut[_0x4f0e('0x6a')](_0x3ae0dd[_0x1005fa]));rpcDb[_0x4f0e('0x6b')](_0x1caede,_0x4f0e('0x6c'));}else{ut['logCustomer'](_0x1caede,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x1caede,_0x4f0e('0x6d'));rpcDb['createCustomerFinal'](_0x1caede,_0x4f0e('0x6d'));}}}}})['catch'](ut['logger2'](_0x4f0e('0x6e')));};Preview[_0x4f0e('0xf')]['setMessage']=function(_0x3701fc){_0x3701fc['sendMessageOneNotActive']=!![];if(ut[_0x4f0e('0x6f')](_0x3701fc[_0x4f0e('0x70')])){_0x3701fc['message']=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0x4f0e('0x71')](_0x3701fc['dialActive'])){_0x3701fc['message']=utils[_0x4f0e('0x35')][_0x4f0e('0x36')];}else if(!this[_0x4f0e('0x72')](_0x3701fc[_0x4f0e('0x73')])){if(!this['isTrunkReachable'](_0x3701fc[_0x4f0e('0x74')])){_0x3701fc['message']=utils['CAMPAIGN_STATUS'][_0x4f0e('0x75')];}else{_0x3701fc[_0x4f0e('0x34')]=utils[_0x4f0e('0x35')][_0x4f0e('0x76')];}}else{_0x3701fc[_0x4f0e('0x34')]=utils[_0x4f0e('0x35')]['ACTIVE'];}};Preview[_0x4f0e('0xf')][_0x4f0e('0x77')]=function(_0x440d4c,_0x4f04a5,_0x38dc08){var _0xc45dc2=this;var _0x51976a=this[_0x4f0e('0x46')][_0x4f04a5];var _0x4679f9=this[_0x4f0e('0x12')][_0x51976a[_0x4f0e('0x48')]];var _0x45d1e6;var _0x349c85=![];var _0x3b3577=0x2;var _0x947981=0x3;if(_0x4679f9){switch(_0x38dc08){case'1':_0x4679f9[_0x4f0e('0x78')]+=0x1;_0x51976a['countnosuchnumberretry']+=0x1;_0x51976a['countglobal']=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x0,_0x4f0e('0x7b'));ami['emit'](_0x4f0e('0x7c'),ut['buildObj'](_0x51976a,_0x4f0e('0x7d')));rpcDb['createCustomerHistory'](_0x51976a,_0x4f0e('0x7e'));_0xc45dc2['verifyAdditionalPhones'](_0x51976a,'0',_0x4679f9)[_0x4f0e('0x62')](function(_0x2ad4ec){_0x349c85=_0x2ad4ec[_0x4f0e('0x7f')]==0x1;_0x3b3577=_0x4679f9['dialNoSuchNumberRetryFrequency'];_0x947981=_0x4679f9['callAdditionalPhoneAfterMin'];if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut['cloneAction'](_0x51976a,0xf,_0x4f0e('0x81'));rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0x83'));}else{if(_0x51976a[_0x4f0e('0x84')]>=_0x4679f9[_0x4f0e('0x85')]){rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0x83'));}else{rpcDb[_0x4f0e('0x86')](ut[_0x4f0e('0x87')](_0x51976a,_0x4f0e('0x84'),_0x4679f9['dialNoSuchNumberRetryFrequency']),_0x51976a['unlockAgent'],_0x51976a[_0x4f0e('0x88')]);}}delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0x89')]];}else{_0x51976a[_0x4f0e('0x84')]++;logger[_0x4f0e('0x26')](_0x4f0e('0x8a'),_0x51976a[_0x4f0e('0x84')]);logger['info']('id',_0x51976a[_0x4f0e('0x8b')]);_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnosuchnumberretry':_0x51976a[_0x4f0e('0x84')]}})[_0x4f0e('0x62')](function(){_0xc45dc2['swapAdditionalPhones'](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});break;case _0x4f0e('0x8d'):var _0x58435e=moment()['format'](_0x4f0e('0x66'));_0x51976a[_0x4f0e('0x8e')]=_0x58435e;_0x51976a[_0x4f0e('0x8f')]=_0x58435e;_0x51976a[_0x4f0e('0x49')]=!![];_0x4679f9[_0x4f0e('0x31')]+=0x1;logger[_0x4f0e('0x26')](_0x4f0e('0x90'),_0x51976a[_0x4f0e('0x91')],_0x4f0e('0x92'),_0x4679f9[_0x4f0e('0x2b')],_0x4f0e('0x93'),_0x4679f9[_0x4f0e('0x31')]);ami[_0x4f0e('0x2d')]('custom:agentconnect',ut[_0x4f0e('0x94')](_0x51976a,_0x4f0e('0x95'),this[_0x4f0e('0x12')][_0x51976a[_0x4f0e('0x48')]]));if(_0x4679f9[_0x4f0e('0x96')]||_0x4679f9[_0x4f0e('0x97')]){ami[_0x4f0e('0x2d')](_0x4f0e('0x98'),{'queue':_0x51976a[_0x4f0e('0x48')],'interface':_0x51976a['channelAgent'],'uniqueid':_0x51976a[_0x4f0e('0x91')]});}break;case'16':ami[_0x4f0e('0x2d')](_0x4f0e('0x99'),ut['buildObj'](_0x51976a,_0x4f0e('0x9a'),this[_0x4f0e('0x12')][_0x51976a[_0x4f0e('0x48')]]));emitVoiceQueueChannelRemove(ut[_0x4f0e('0x94')](_0x51976a,_0x4f0e('0x9a')));_0x4679f9[_0x4f0e('0x9b')]+=0x1;_0x4679f9[_0x4f0e('0x9c')]+=0x1;_0x4679f9[_0x4f0e('0x9d')]+=0x1;ut['decrementTalking'](_0x4679f9,_0x4f0e('0x9e'));_0x51976a['countglobal']=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x4,_0x4f0e('0x9f'));rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xa0'));rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0xa1'));rpcDb[_0x4f0e('0xa2')](_0x51976a);_0x4679f9['sumDuration']+=_0x51976a['talktime'];_0x4679f9[_0x4f0e('0xa3')]+=_0x51976a[_0x4f0e('0xa4')];logger[_0x4f0e('0x26')](_0x4f0e('0xa5'),_0x51976a[_0x4f0e('0x91')],_0x4f0e('0x92'),_0x4679f9[_0x4f0e('0x2b')],'pTalking:\x20',_0x4679f9['pTalking']);delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0x89')]];break;case _0x4f0e('0xa6'):_0x4679f9[_0x4f0e('0xa7')]+=0x1;_0x51976a[_0x4f0e('0xa8')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut['totalGlobal'](_0x51976a);ut['logCustomer'](_0x51976a,0x5,'Busy');_0x3b3577=_0x4679f9[_0x4f0e('0xaa')];_0x947981=_0x4679f9[_0x4f0e('0xab')];ami['emit']('custom:agentbusy',ut['buildObj'](_0x51976a,_0x4f0e('0xac')));rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xad'));_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'5',_0x4679f9)[_0x4f0e('0x62')](function(_0x19f949){_0x349c85=_0x19f949['additional']==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,'Global');rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0xb0'));}else{if(_0x51976a['countbusyretry']>=_0x4679f9[_0x4f0e('0xb1')]){rpcDb['createCustomerFinal'](_0x51976a,_0x4f0e('0xad'));}else{rpcDb[_0x4f0e('0x86')](ut['scheduledAt'](_0x51976a,_0x4f0e('0xa8'),_0x4679f9[_0x4f0e('0xaa')]),_0x51976a['unlockAgent'],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a['countbusyretry']++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countbusyretry':_0x51976a[_0x4f0e('0xa8')]}})[_0x4f0e('0x62')](function(){_0xc45dc2['swapAdditionalPhones'](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});break;case _0x4f0e('0xb2'):_0x4679f9[_0x4f0e('0xb3')]+=0x1;_0x51976a[_0x4f0e('0xb4')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut[_0x4f0e('0x79')](_0x51976a);ut['logCustomer'](_0x51976a,0x3,_0x4f0e('0xb5'));_0x3b3577=_0x4679f9[_0x4f0e('0xb6')];_0x947981=_0x4679f9[_0x4f0e('0xab')];var _0x1e3322=ut['buildNoAnswerEventPayload'](_0x51976a,_0x4679f9);ami[_0x4f0e('0x2d')](_0x4f0e('0xb7'),_0x1e3322);rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xb8'));_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'3',_0x4679f9)[_0x4f0e('0x62')](function(_0x594104){_0x349c85=_0x594104['additional']==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9['dialGlobalMaxRetry']){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,_0x4f0e('0x81'));rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0xb9'));}else{if(_0x51976a[_0x4f0e('0xb4')]>=_0x4679f9[_0x4f0e('0xba')]){rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0xb8'));}else{rpcDb[_0x4f0e('0x86')](ut[_0x4f0e('0x87')](_0x51976a,_0x4f0e('0xb4'),_0x4679f9[_0x4f0e('0xb6')]),_0x51976a[_0x4f0e('0xbb')],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a[_0x4f0e('0xb4')]++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a[_0x4f0e('0xb4')]}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});break;case _0x4f0e('0xbd'):_0x4679f9[_0x4f0e('0xbe')]+=0x1;_0x51976a[_0x4f0e('0xbf')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut['totalGlobal'](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x8,'Congestion');_0x3b3577=_0x4679f9[_0x4f0e('0xc0')];_0x947981=_0x4679f9[_0x4f0e('0xab')];ami[_0x4f0e('0x2d')](_0x4f0e('0xc1'),ut['buildObj'](_0x51976a,_0x4f0e('0xc2')));rpcDb['createCustomerHistory'](_0x51976a,'[callProgressDetectingCustomer][logCongestion]');_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'8',_0x4679f9)[_0x4f0e('0x62')](function(_0x1b36f0){_0x349c85=_0x1b36f0[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9['dialGlobalMaxRetry']){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,_0x4f0e('0x81'));rpcDb['createCustomerFinal'](_0x45d1e6,_0x4f0e('0xc3'));}else{if(_0x51976a[_0x4f0e('0xbf')]>=_0x4679f9['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x51976a,_0x4f0e('0xc4'));}else{rpcDb['rescheduleContact'](ut[_0x4f0e('0x87')](_0x51976a,'countcongestionretry',_0x4679f9['dialBusyRetryFrequency']),_0x51976a[_0x4f0e('0xbb')],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a[_0x4f0e('0xbf')]++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a['idContact'],'field':{'countcongestionretry':_0x51976a[_0x4f0e('0xbf')]}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)['then'](function(){});});}});break;case _0x4f0e('0xc5'):_0x4679f9['outboundRejectCallsDay']+=0x1;_0x51976a[_0x4f0e('0xc6')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut['totalGlobal'](_0x51976a);ut['logCustomer'](_0x51976a,0x14,'AgentReject');_0x3b3577=_0x4679f9['dialAgentRejectRetryFrequency'];_0x947981=_0x4679f9['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0x4f0e('0x94')](_0x51976a,_0x4f0e('0xc7')));rpcDb[_0x4f0e('0x6b')](_0x51976a,'[syncHangupRequest][logAgentReject]');_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'20',_0x4679f9)['then'](function(_0x1e66e0){_0x349c85=_0x1e66e0[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut['totalGlobal'](_0x51976a)>=_0x4679f9['dialGlobalMaxRetry']){_0x45d1e6=ut['cloneAction'](_0x51976a,0x14,_0x4f0e('0xc8'));rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0xc9'));}else{if(_0x51976a[_0x4f0e('0xc6')]>=_0x4679f9['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x51976a,_0x4f0e('0xc9'));}else{rpcDb[_0x4f0e('0x86')](ut['scheduledAt'](_0x51976a,_0x4f0e('0xc6'),_0x4679f9[_0x4f0e('0xca')]),_0x51976a[_0x4f0e('0xbb')],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a[_0x4f0e('0xb4')]++;_0xc45dc2['incrementPreviewCounters']({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a[_0x4f0e('0xb4')]}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});break;case'ABANDONED':_0x4679f9[_0x4f0e('0xcb')]+=0x1;_0x51976a[_0x4f0e('0xcc')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0xb,_0x4f0e('0xcd'));rpcDb[_0x4f0e('0x6b')](_0x51976a,'[callProgressDetectingCustomer][logAbandoned]');_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'11',_0x4679f9)[_0x4f0e('0x62')](function(_0x20d7ba){_0x349c85=_0x20d7ba[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,'Global');rpcDb['createCustomerFinal'](_0x45d1e6,_0x4f0e('0xce'));}else{if(_0x51976a['countabandonedetry']>=_0x4679f9['dialAbandonedMaxRety']){rpcDb[_0x4f0e('0x82')](_0x51976a,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x51976a,_0x4f0e('0xcc'),_0x4679f9['dialAbandonedRetryFrequency']),_0x51976a[_0x4f0e('0xbb')],_0x51976a[_0x4f0e('0x88')]);}}}else{_0x51976a['countnoanswerretry']++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a['countnoanswerretry']}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)['then'](function(){});});}});break;case'18':_0x4679f9[_0x4f0e('0xcf')]+=0x1;_0x51976a[_0x4f0e('0xd0')]+=0x1;_0x51976a['countglobal']=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x12,_0x440d4c[_0x4f0e('0xd1')]||_0x440d4c[_0x4f0e('0xd2')]);ami[_0x4f0e('0x2d')](_0x4f0e('0xd3'),ut[_0x4f0e('0x94')](_0x51976a,'amd'));rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xd4'));_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'18',_0x4679f9)[_0x4f0e('0x62')](function(_0xe4f85a){_0x349c85=_0xe4f85a[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut['totalGlobal'](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0x12,_0x4f0e('0x81'));rpcDb[_0x4f0e('0x82')](_0x45d1e6,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0xd4'));}}else{_0x51976a['countnoanswerretry']++;_0xc45dc2['incrementPreviewCounters']({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a['countnoanswerretry']}})[_0x4f0e('0x62')](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});});}});delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0x89')]];break;case'19':_0x4679f9[_0x4f0e('0xcf')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0x13,_0x440d4c[_0x4f0e('0xd1')]||_0x440d4c[_0x4f0e('0xd2')]);ami[_0x4f0e('0x2d')](_0x4f0e('0xd3'),ut[_0x4f0e('0x94')](_0x51976a,_0x4f0e('0xd5')));rpcDb[_0x4f0e('0x6b')](_0x51976a,_0x4f0e('0xd6'));_0xc45dc2['verifyAdditionalPhones'](_0x51976a,'18',_0x4679f9)[_0x4f0e('0x62')](function(_0x29372a){_0x349c85=_0x29372a[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut[_0x4f0e('0xaf')](_0x51976a,0xf,'Global');rpcDb['createCustomerFinal'](_0x45d1e6,_0x4f0e('0xd6'));}else{rpcDb[_0x4f0e('0x82')](_0x51976a,'[callProgressDetectingCustomer][machine]');}}else{_0x51976a[_0x4f0e('0xb4')]++;_0xc45dc2[_0x4f0e('0x8c')]({'id':_0x51976a[_0x4f0e('0x8b')],'field':{'countnoanswerretry':_0x51976a[_0x4f0e('0xb4')]}})['then'](function(){_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)['then'](function(){});});}});delete this['actions'][_0x440d4c[_0x4f0e('0x89')]];break;default:if(_0x51976a[_0x4f0e('0x49')]){ut[_0x4f0e('0x55')](_0x4679f9,_0x4f0e('0xd7'));ut[_0x4f0e('0x56')](_0x4f0e('0xd8')+_0x4679f9['name'],_0x440d4c);}_0x4679f9[_0x4f0e('0xcf')]+=0x1;_0x51976a[_0x4f0e('0xa9')]=ut[_0x4f0e('0x79')](_0x51976a);ut[_0x4f0e('0x7a')](_0x51976a,0xc,_0x440d4c[_0x4f0e('0xd1')]||_0x440d4c[_0x4f0e('0xd2')]);_0x3b3577=_0x4679f9[_0x4f0e('0xca')];_0x947981=_0x4679f9[_0x4f0e('0xab')];rpcDb['createCustomerHistory'](_0x51976a,_0x4f0e('0xd9'));_0xc45dc2[_0x4f0e('0xae')](_0x51976a,'20',_0x4679f9)[_0x4f0e('0x62')](function(_0x568aaa){_0x349c85=_0x568aaa[_0x4f0e('0x7f')]==0x1;if(!_0x349c85){if(ut[_0x4f0e('0x79')](_0x51976a)>=_0x4679f9[_0x4f0e('0x80')]){_0x45d1e6=ut['cloneAction'](_0x51976a,0xf,'Global');rpcDb[_0x4f0e('0x82')](_0x45d1e6,_0x4f0e('0xda'));}else{rpcDb[_0x4f0e('0x82')](_0x51976a,_0x4f0e('0xda'));}delete this['actions'][_0x440d4c['linkedid']];}else{_0xc45dc2[_0x4f0e('0xbc')](_0x51976a,_0x3b3577,_0x947981)[_0x4f0e('0x62')](function(){});}});}if(!(_0x51976a[_0x4f0e('0x49')]&&_0x38dc08==='16')){utils['decrementOriginate'](_0x4679f9,_0x4f0e('0xdb'));logger[_0x4f0e('0x26')](_0x4f0e('0xdc'),_0x51976a[_0x4f0e('0x91')],'\x20Queue',_0x4679f9[_0x4f0e('0x2b')],_0x4f0e('0x47'),_0x4679f9['originated']);}if(_0x38dc08!=='ANSWER'){delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0x89')]];delete this[_0x4f0e('0x46')][_0x440d4c[_0x4f0e('0xdd')]];}_0x4679f9[_0x4f0e('0xde')]=!![];}};Preview[_0x4f0e('0xf')]['callProgressDetectingAgent']=function(_0x432785,_0x4301fc,_0x68b352){if(_[_0x4f0e('0xdf')](_0x4301fc)&&_0x4f0e('0xe0')!==typeof _0x4301fc){return;}if(_['isUndefined'](_0x68b352)&&_0x4f0e('0xe0')!==typeof _0x68b352){return;}switch(_0x68b352[_0x4f0e('0xe1')]){case'0':ut[_0x4f0e('0xe2')](_0x432785,0x0,_0x4f0e('0x7b'));rpcDb[_0x4f0e('0xe3')](_0x432785,_0x4f0e('0xe4'));break;case'3':ut[_0x4f0e('0xe2')](_0x432785,0x3,'NoAnswer');rpcDb[_0x4f0e('0xe3')](_0x432785,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x4f0e('0xe2')](_0x432785,0x5,'Busy');rpcDb[_0x4f0e('0xe3')](_0x432785,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x432785,0x8,'Congestion');rpcDb[_0x4f0e('0xe3')](_0x432785,_0x4f0e('0xe5'));break;case'22':ut[_0x4f0e('0xe2')](_0x432785,0x16,_0x4f0e('0xe6'));rpcDb['createAgentHistory'](_0x432785,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x4f0e('0xe2')](_0x432785,0xc,_0x68b352[_0x4f0e('0xe1')]);rpcDb['createAgentHistory'](_0x432785,_0x4f0e('0xe5'));}utils[_0x4f0e('0x53')](_0x4301fc,_0x4f0e('0xe7'));logger[_0x4f0e('0x26')](_0x4f0e('0xe8'),_0x432785[_0x4f0e('0x91')],_0x4f0e('0x92'),_0x4301fc[_0x4f0e('0x2b')],'originated:\x20',_0x4301fc['originated']);delete this['actions'][_0x432785[_0x4f0e('0x91')]];};Preview[_0x4f0e('0xf')][_0x4f0e('0xae')]=function(_0x2694fc,_0x31670d,_0x1949ef){return cmHopperAdditionalPhone[_0x4f0e('0xae')](_0x2694fc,_0x31670d,_0x1949ef)[_0x4f0e('0x51')](logger['info'](_0x4f0e('0xe9')));};Preview[_0x4f0e('0xf')][_0x4f0e('0xbc')]=function(_0x138bcb,_0x51d4fe,_0x127029){return cmHopperAdditionalPhone[_0x4f0e('0xbc')](_0x138bcb,_0x51d4fe,_0x127029)[_0x4f0e('0x51')](logger[_0x4f0e('0x26')](_0x4f0e('0xea')));};Preview['prototype']['incrementPreviewCounters']=function(_0xfd8cff){return Promise['resolve']()[_0x4f0e('0x62')](cmHopperAdditionalPhone[_0x4f0e('0x8c')](_0xfd8cff))[_0x4f0e('0x51')](logger[_0x4f0e('0x26')](_0x4f0e('0xeb')));};Preview[_0x4f0e('0xf')]['checkInBlack']=function(_0x4ad242,_0x2e00be,_0x36f0b4,_0x4f0128,_0x3b64a9){var _0x2ddc34=this;return new Promise(function(_0x587dbf,_0x501f2b){if(_[_0x4f0e('0x43')](_0x2e00be)||_['isNil'](_0x2e00be['Contact'])||_[_0x4f0e('0x43')](_0x2e00be[_0x4f0e('0xec')])||_[_0x4f0e('0x43')](_0x2e00be[_0x4f0e('0x4d')])){_0x501f2b(ut[_0x4f0e('0x34')](_0x4f0e('0xed'),_0x4f0128,_0x3b64a9));return;}var _0x459653=uuid['v4']();var _0x3288aa=_0x2ddc34[_0x4f0e('0x12')][_0x2e00be[_0x4f0e('0x45')]['name']];var _0x442554=_0x36f0b4?_0x2ddc34[_0x4f0e('0x15')][_0x36f0b4]['id']:undefined;_0x2ddc34[_0x4f0e('0x46')][_0x459653]=new Action(_0x2e00be,_0x3288aa,_0x459653,_0x36f0b4,_0x442554);var _0x164947=_0x2ddc34[_0x4f0e('0x46')][_0x459653];_0x164947[_0x4f0e('0xbb')]=_0x4f0128;_0x164947['activeContact']=_0x3b64a9;_0x164947[_0x4f0e('0xee')]=_0x36f0b4;if(_[_0x4f0e('0xef')](_0x4ad242)){_0x2ddc34[_0x4f0e('0xf0')](_0x164947,_0x3288aa,_0x2e00be,_0x36f0b4)[_0x4f0e('0x62')](function(_0x346d2d){logger[_0x4f0e('0x26')](_0x4f0e('0xf1'),_0x4f0e('0xf2')+_0x164947[_0x4f0e('0x48')]+_0x4f0e('0xf3')+_0x164947[_0x4f0e('0x8b')],JSON[_0x4f0e('0x28')](_0x346d2d));ami[_0x4f0e('0x2d')]('custom:agentcalled',ut['buildObj'](_0x164947,_0x4f0e('0xf4'),_0x2ddc34[_0x4f0e('0x12')][_0x164947['queue']]));_0x587dbf(ut[_0x4f0e('0x34')]('Calling'));})[_0x4f0e('0x51')](function(_0x34e2b2){ut[_0x4f0e('0x37')](_0x4f0e('0xf5'),_0x34e2b2);_0x501f2b(ut[_0x4f0e('0x34')](_0x4f0e('0xf6'),_0x4f0128,_0x3b64a9));});}else{_0x3288aa[_0x4f0e('0xf7')]+=0x1;ut[_0x4f0e('0xf8')](_0x164947);rpcDb[_0x4f0e('0xf9')](_0x164947,'[Blacklist][error]');delete _0x2ddc34['actions'][_0x459653];_0x501f2b(ut[_0x4f0e('0x34')]('Contact\x20in\x20black\x20List',_0x4f0128,_0x3b64a9));}});};Preview[_0x4f0e('0xf')][_0x4f0e('0x72')]=function(_0x8b00a4){return!_[_0x4f0e('0x43')](_0x8b00a4)&&!_[_0x4f0e('0x43')](_0x8b00a4[_0x4f0e('0x2b')])&&!_['isNil'](_0x8b00a4[_0x4f0e('0xfa')])&&_0x8b00a4[_0x4f0e('0xfa')]&&!_['isNil'](this[_0x4f0e('0x14')][util['format']('SIP/%s',_0x8b00a4[_0x4f0e('0x2b')])])&&!_[_0x4f0e('0x43')](this['trunks'][util[_0x4f0e('0x29')]('SIP/%s',_0x8b00a4[_0x4f0e('0x2b')])][_0x4f0e('0x50')])&&(this[_0x4f0e('0x14')][util['format'](_0x4f0e('0xfb'),_0x8b00a4[_0x4f0e('0x2b')])][_0x4f0e('0x50')]===_0x4f0e('0xfc')||this['trunks'][util['format']('SIP/%s',_0x8b00a4['name'])][_0x4f0e('0x50')]===_0x4f0e('0xfd'));};Preview[_0x4f0e('0xf')][_0x4f0e('0x61')]=function(_0x3bc34b,_0x2fe5f8){return this[_0x4f0e('0xfe')](_0x3bc34b,_0x2fe5f8)[_0x4f0e('0x62')](function(_0x10d41d){return _['pick'](_0x10d41d,[_0x4f0e('0x34')]);})[_0x4f0e('0x51')](function(_0x4453ae){if(_0x4453ae[_0x4f0e('0xff')]){rpcDb['unlockContact'](_0x3bc34b);}if(_0x4453ae['active']){rpcDb['disableContact'](_0x3bc34b);}throw _[_0x4f0e('0x4a')](_0x4453ae,[_0x4f0e('0x34')]);});};Preview[_0x4f0e('0xf')][_0x4f0e('0xfe')]=function(_0x138eca,_0x11a1c8){var _0xd69c68=this;var _0x2302e8,_0x2445d4;return rpcDb[_0x4f0e('0x100')](_0x138eca)[_0x4f0e('0x62')](function(_0x32b296){if(!_[_0x4f0e('0x43')](_0x32b296[0x0])){_0x2445d4=_0x32b296[0x0]['recallme']?![]:!![];_0x2302e8=_0x32b296[0x0][_0x4f0e('0x101')]?!![]:![];_0x2302e8=_0x11a1c8?!![]:_0x2302e8;}var _0xb8b037=_0xd69c68[_0x4f0e('0x102')](_0x32b296);if(_0xb8b037[_0x4f0e('0x103')]){rpcDb[_0x4f0e('0x104')](_[_0x4f0e('0x4a')](_0x32b296[0x0],[_0x4f0e('0x4d'),_0x4f0e('0xec')]))[_0x4f0e('0x62')](function(_0x227715){_0xd69c68[_0x4f0e('0x105')](_0x227715,_0x32b296[0x0],_0x11a1c8,_0x2445d4,_0x2302e8)[_0x4f0e('0x62')](function(_0x560682){return _0x560682;})[_0x4f0e('0x51')](function(_0x14b24d){throw _0x14b24d;});})[_0x4f0e('0x51')](function(_0x4cf25f){ut[_0x4f0e('0x37')](_0x4f0e('0x106'),_0x4cf25f);throw ut['message'](_0x4f0e('0x107'),_0x2445d4,_0x2302e8);});}else{throw ut[_0x4f0e('0x34')](_0xb8b037[_0x4f0e('0x34')],_0x2445d4,_0x2302e8);}})['catch'](function(_0x556945){ut[_0x4f0e('0x37')]('[Preview][getContactPreview]',_0x556945);throw ut[_0x4f0e('0x34')](_0x4f0e('0x107'),![],!![]);});};Preview[_0x4f0e('0xf')][_0x4f0e('0x102')]=function(_0x3008c0){if(_[_0x4f0e('0x43')](_0x3008c0)||_[_0x4f0e('0xef')](_0x3008c0)||!_[_0x4f0e('0x43')](_0x3008c0[0x0][_0x4f0e('0x60')])&&_[_0x4f0e('0x43')](_0x3008c0[0x0][_0x4f0e('0x60')][_0x4f0e('0x2b')])){ut[_0x4f0e('0x37')]('[Preview][validateContact][Empty\x20Contact]',_0x3008c0);return{'isValid':![],'message':_0x4f0e('0x108')};}var _0x387ccf=this[_0x4f0e('0x12')][_0x3008c0[0x0][_0x4f0e('0x45')][_0x4f0e('0x2b')]];_0x387ccf[_0x4f0e('0x34')]=utils[_0x4f0e('0x35')][_0x4f0e('0x76')];if(_[_0x4f0e('0x43')](_0x387ccf)){ut[_0x4f0e('0x37')](_0x4f0e('0x109'),_0x387ccf);return{'isValid':![],'message':_0x4f0e('0x10a')};}if(!this[_0x4f0e('0x72')](_0x387ccf['Trunk'])){ut[_0x4f0e('0x37')](_0x4f0e('0x10b'),_0x4f0e('0x10c')+_0x387ccf['name']+_0x4f0e('0x10d'));if(!this[_0x4f0e('0x72')](_0x387ccf['TrunkBackup'])){ut[_0x4f0e('0x37')](_0x4f0e('0x10b'),_0x387ccf[_0x4f0e('0x2b')]+_0x4f0e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x4f0e('0x71')](_0x387ccf[_0x4f0e('0x10f')])){ut[_0x4f0e('0x37')](_0x4f0e('0x110'),_0x387ccf[_0x4f0e('0x2b')]+_0x4f0e('0x111'));return{'isValid':![],'message':_0x4f0e('0x10c')+_0x387ccf[_0x4f0e('0x2b')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x4f0e('0x112')};};Preview[_0x4f0e('0xf')][_0x4f0e('0xf0')]=function(_0xb8d87b,_0x829e81,_0x11b22b,_0x2d945c){var _0x2ef851=this;return new Promise(function(_0x316fb9,_0x37d8cf){var _0x59c502=_0xb8d87b[_0x4f0e('0x91')];var _0x1adcd4=_0x2ef851[_0x4f0e('0x72')](_0x829e81[_0x4f0e('0x73')])?util[_0x4f0e('0x29')](_0x4f0e('0x113'),_0x829e81['Trunk'][_0x4f0e('0x2b')],_[_0x4f0e('0x43')](_0x829e81[_0x4f0e('0x114')])?'':_0x829e81[_0x4f0e('0x114')]['trim']()||'',_0x829e81[_0x4f0e('0x115')]>0x0?_0x11b22b[_0x4f0e('0xec')][_0x4f0e('0x116')](_0x829e81['dialCutDigit']):_0x11b22b[_0x4f0e('0xec')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x829e81[_0x4f0e('0x74')])?_0x829e81[_0x4f0e('0x73')][_0x4f0e('0x2b')]:_0x829e81[_0x4f0e('0x74')][_0x4f0e('0x2b')],_[_0x4f0e('0x43')](_0x829e81[_0x4f0e('0x114')])?'':_0x829e81['dialPrefix'][_0x4f0e('0x117')]()||'',_0x829e81[_0x4f0e('0x115')]>0x0?_0x11b22b[_0x4f0e('0xec')]['substring'](_0x829e81[_0x4f0e('0x115')]):_0x11b22b[_0x4f0e('0xec')]);var _0x454ceb=_0x2ef851[_0x4f0e('0x72')](_0x829e81[_0x4f0e('0x73')])?ut['getCallerId'](_0x829e81['Trunk']['callerid'],_0x829e81[_0x4f0e('0x118')],_0x829e81['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4f0e('0x119')](_0x829e81[_0x4f0e('0x11a')],_0x829e81[_0x4f0e('0x11b')]):_0x829e81['dialOriginateCallerIdNumber']):ut[_0x4f0e('0x11c')](_[_0x4f0e('0x43')](_0x829e81['TrunkBackup'])?_0x829e81[_0x4f0e('0x73')][_0x4f0e('0x11d')]:_0x829e81[_0x4f0e('0x74')][_0x4f0e('0x11d')],_0x829e81['dialOriginateCallerIdName'],_0x829e81[_0x4f0e('0x11b')]>0x0?ut['getCallerIdRandom'](_0x829e81[_0x4f0e('0x11a')],_0x829e81['dialRandomLastDigitCallerIdNumber']):_0x829e81[_0x4f0e('0x11a')]);if(_0x454ceb){_0xb8d87b[_0x4f0e('0x11e')]=ut[_0x4f0e('0x11f')](_0x454ceb);_0xb8d87b[_0x4f0e('0x120')]=ut[_0x4f0e('0x121')](_0x454ceb);}var _0x1e9474=ut['addVariables'](_0x829e81,_0x11b22b,_0x1adcd4,_0x454ceb,_0x59c502,_0xb8d87b);var _0xfc3b3b=utils['setXMDContactVariables'](_0x11b22b[_0x4f0e('0x122')]);Object[_0x4f0e('0x123')](_0x1e9474,_0xfc3b3b);_['merge'](_0xb8d87b,ut['toLowerVariables'](_0x1e9474));_0xb8d87b['starttime']=moment()[_0x4f0e('0x29')](_0x4f0e('0x66'));_0x829e81[_0x4f0e('0x124')]=_0x1e9474;var _0x16fc50=ut['variablesAction'](_0xb8d87b,_0x829e81,_0x1e9474,_0xb8d87b[_0x4f0e('0x88')],_0x2d945c);return ami[_0x4f0e('0x4f')](_0x16fc50)[_0x4f0e('0x62')](function(_0x5d0268){_0x829e81[_0x4f0e('0x30')]+=0x1;logger['info'](_0x4f0e('0x125'),_0x59c502,_0x4f0e('0x92'),_0x829e81['name'],_0x4f0e('0x47'),_0x829e81[_0x4f0e('0x30')]);_0x316fb9(_0x5d0268);})[_0x4f0e('0x51')](function(_0x16b390){ut[_0x4f0e('0xe2')](_0xb8d87b,0xe,'OriginateError');rpcDb[_0x4f0e('0xe3')](_0xb8d87b,_0x4f0e('0x126'));_0x37d8cf(_0x16b390);});});};Preview[_0x4f0e('0xf')][_0x4f0e('0x20')]=function(_0x2a5402){if(this['actions'][_0x2a5402[_0x4f0e('0x89')]]){this[_0x4f0e('0x46')][_0x2a5402[_0x4f0e('0x89')]][_0x4f0e('0x127')]=_0x2a5402['channel'];}};Preview[_0x4f0e('0xf')][_0x4f0e('0x18')]=function(_0x4e5a1b){var _0x55a96c=this;var _0x3db672=this[_0x4f0e('0x46')][_0x4e5a1b[_0x4f0e('0x128')]];if(_0x3db672){if(_0x3db672[_0x4f0e('0xee')]&&this[_0x4f0e('0x15')][_0x3db672[_0x4f0e('0xee')]]){ut['logLookAgent'](_0x3db672,this[_0x4f0e('0x15')][_0x3db672[_0x4f0e('0xee')]][_0x4f0e('0x2b')],this['agents'][_0x3db672['lookAgent']]['id']);}var _0x6e3303=_[_0x4f0e('0x129')](_0x3db672);_0x6e3303[_0x4f0e('0x8e')]=moment()[_0x4f0e('0x29')](_0x4f0e('0x66'));var _0x32c065=_0x55a96c[_0x4f0e('0x12')][_0x3db672[_0x4f0e('0x48')]];if(ut['isFailure'](_0x4e5a1b[_0x4f0e('0x12a')])){if(_0x3db672[_0x4f0e('0xbb')]){rpcDb[_0x4f0e('0x12b')](_0x3db672[_0x4f0e('0x8b')]);}if(_0x3db672[_0x4f0e('0x88')]){rpcDb['disableContact'](_0x3db672[_0x4f0e('0x8b')]);}ami[_0x4f0e('0x2d')](_0x4f0e('0x12c'),ut[_0x4f0e('0x94')](_0x3db672,'rejected',this['campaignsPreview'][_0x3db672['queue']]));this[_0x4f0e('0x12d')](_0x6e3303,_0x32c065,_0x4e5a1b);}else{_0x3db672['starttime']=moment()[_0x4f0e('0x29')](_0x4f0e('0x66'));ut['logAgent'](_0x6e3303,0x4,'Answer');rpcDb[_0x4f0e('0xe3')](_0x6e3303,_0x4f0e('0x12e'));}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x1b')]=function(_0x1b9088){var _0x40ef37=this['actions'][_0x1b9088[_0x4f0e('0x89')]];var _0x3ce795;if(_0x40ef37){_0x3ce795=this['campaignsPreview'][_0x40ef37[_0x4f0e('0x48')]];logger['info'](_0x4f0e('0x12f'),_0x1b9088[_0x4f0e('0x89')],_0x4f0e('0x92'),_0x3ce795[_0x4f0e('0x2b')],'pTalking:\x20',_0x3ce795[_0x4f0e('0x31')]);}if(this[_0x4f0e('0x46')][_0x1b9088[_0x4f0e('0x89')]]&&_0x1b9088[_0x4f0e('0x89')]!==_0x1b9088[_0x4f0e('0x91')]){if(_0x1b9088[_0x4f0e('0x130')]==='16'&&this[_0x4f0e('0x46')][_0x1b9088[_0x4f0e('0x89')]][_0x4f0e('0x49')]){this[_0x4f0e('0x77')](_0x1b9088,_0x1b9088['linkedid'],_0x1b9088['cause']);}else if(this[_0x4f0e('0x46')][_0x1b9088['linkedid']]['dialAnswer']){logger['info'](_0x4f0e('0x131'),_0x1b9088[_0x4f0e('0x89')],_0x1b9088[_0x4f0e('0x130')],'\x20Queue',_0x3ce795[_0x4f0e('0x2b')],_0x4f0e('0x93'),_0x3ce795[_0x4f0e('0x31')]);this[_0x4f0e('0x77')](_0x1b9088,_0x1b9088[_0x4f0e('0x89')],_0x1b9088['cause']);}}else if(_0x40ef37&&_[_0x4f0e('0x43')](_0x40ef37['statedesc'])&&_0x3ce795[_0x4f0e('0x132')]&&_0x1b9088['linkedid']===_0x1b9088[_0x4f0e('0x91')]&&_[_0x4f0e('0x43')](_0x1b9088[_0x4f0e('0xe1')])&&_0x1b9088[_0x4f0e('0x130')]==='16'&&_0x1b9088[_0x4f0e('0x133')]==='6'&&_[_0x4f0e('0xdf')](_0x40ef37['transfer'])){if(_0x40ef37[_0x4f0e('0xbb')]){rpcDb[_0x4f0e('0x12b')](_0x40ef37[_0x4f0e('0x8b')]);}if(_0x40ef37[_0x4f0e('0x88')]){rpcDb[_0x4f0e('0x64')](_0x40ef37[_0x4f0e('0x8b')]);}_0x1b9088['reason']='22';this[_0x4f0e('0x12d')](_0x40ef37,_0x3ce795,_0x1b9088);}else if(_0x40ef37&&_0x40ef37['transfer']){if(_0x1b9088['cause']==='16'&&this['actions'][_0x1b9088['linkedid']][_0x4f0e('0x49')]){logger[_0x4f0e('0x26')](_0x4f0e('0x134'),_0x1b9088[_0x4f0e('0x89')],_0x1b9088['cause'],_0x4f0e('0x92'),_0x3ce795[_0x4f0e('0x2b')],_0x4f0e('0x93'),_0x3ce795['pTalking']);this[_0x4f0e('0x77')](_0x1b9088,_0x1b9088[_0x4f0e('0x89')],_0x1b9088[_0x4f0e('0x130')]);}else if(this[_0x4f0e('0x46')][_0x1b9088['linkedid']][_0x4f0e('0x49')]){logger[_0x4f0e('0x26')](_0x4f0e('0x131'),_0x1b9088[_0x4f0e('0x89')],_0x1b9088[_0x4f0e('0x130')],_0x4f0e('0x92'),_0x3ce795['name'],_0x4f0e('0x93'),_0x3ce795[_0x4f0e('0x31')]);this['callProgressDetectingCustomer'](_0x1b9088,_0x1b9088['linkedid'],_0x1b9088[_0x4f0e('0x130')]);}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x135')]=function(_0x1a63af){if(this[_0x4f0e('0x46')][_0x1a63af[_0x4f0e('0xdd')]]&&_0x1a63af[_0x4f0e('0xdd')]!==_0x1a63af['destuniqueid']){this[_0x4f0e('0x77')](_0x1a63af,_0x1a63af[_0x4f0e('0xdd')],_0x1a63af[_0x4f0e('0xd2')]);}};Preview[_0x4f0e('0xf')][_0x4f0e('0x1d')]=function(_0xc4320c){if(this[_0x4f0e('0x46')][_0xc4320c[_0x4f0e('0x89')]]&&_0xc4320c['linkedid']!==_0xc4320c[_0x4f0e('0x91')]&&!this['actions'][_0xc4320c[_0x4f0e('0x89')]][_0x4f0e('0x49')]){if(_0xc4320c[_0x4f0e('0x130')]==='1'){this['callProgressDetectingCustomer'](_0xc4320c,_0xc4320c['linkedid'],_0xc4320c[_0x4f0e('0x130')]);}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x136')]=function(_0x5cedf3,_0x32f0ff,_0x530985){if(this[_0x4f0e('0x46')][_0x5cedf3]){if(_[_0x4f0e('0x43')](this[_0x4f0e('0x46')][_0x5cedf3][_0x4f0e('0x124')])){this[_0x4f0e('0x46')][_0x5cedf3][_0x4f0e('0x124')]={};}this[_0x4f0e('0x46')][_0x5cedf3][_0x4f0e('0x124')][_0x32f0ff]=_0x530985;}};Preview['prototype'][_0x4f0e('0x22')]=function(_0x2e52e5){try{if(!_[_0x4f0e('0x43')](_0x2e52e5)){if(ut[_0x4f0e('0x137')](_[_0x4f0e('0x138')](_0x2e52e5[_0x4f0e('0x139')])[0x0])){this['addVariable'](_0x2e52e5['uniqueid'],_['keys'](_0x2e52e5['variable'])[0x0],_0x2e52e5[_0x4f0e('0x13a')]);}}}catch(_0x1605f5){logger['error'](_0x4f0e('0x13b'),util['inspect'](_0x1605f5,{'showHidden':![],'depth':null}));}};Preview[_0x4f0e('0xf')]['syncAttendedTransfer']=function(_0xdbe74c){if(_0xdbe74c){if(this[_0x4f0e('0x46')][_0xdbe74c['transfertargetlinkedid']]){this[_0x4f0e('0x46')][_0xdbe74c[_0x4f0e('0x13c')]][_0x4f0e('0x13d')]=!![];}}};Preview[_0x4f0e('0xf')][_0x4f0e('0x13e')]=function(_0xc52537){if(_0xc52537){if(this[_0x4f0e('0x46')][_0xc52537[_0x4f0e('0x13f')]]){this[_0x4f0e('0x46')][_0xc52537[_0x4f0e('0x13f')]][_0x4f0e('0x13d')]=!![];}}};module[_0x4f0e('0x140')]=Preview; \ No newline at end of file +var _0xa886=['[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','Queue','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','run','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','phone','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','actionid','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','syncHangupRequest','syncVarSet','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hanguprequest','dialend','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','recallMe','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','UserId','VoiceQueueId','ListId','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','complete','total','answered','[16]','totalGlobal','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','Busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','[callProgressDetectingCustomer][logBusy]','scheduledAt','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','verifyAdditionalPhones','dialNoAnswerMaxRetry','activeContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]'];(function(_0x5eaf80,_0x16418f){var _0x2c2824=function(_0x2941b7){while(--_0x2941b7){_0x5eaf80['push'](_0x5eaf80['shift']());}};_0x2c2824(++_0x16418f);}(_0xa886,0x19f));var _0x6a88=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa886[_0x432682];return _0x463d05;};'use strict';var util=require(_0x6a88('0x0'));var _=require(_0x6a88('0x1'));var uuid=require(_0x6a88('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x6a88('0x3'));var logger=require(_0x6a88('0x4'))(_0x6a88('0x5'));var loggerAction=require(_0x6a88('0x4'))('actionPreview');var ami=require(_0x6a88('0x6'));var rpcDb=require(_0x6a88('0x7'));var cmHopperAdditionalPhone=require(_0x6a88('0x8'));var Action=require('./action');var ut=require(_0x6a88('0x9'));var utils=require(_0x6a88('0xa'));config[_0x6a88('0xb')]=_['defaults'](config[_0x6a88('0xb')],{'host':_0x6a88('0xc'),'port':0x18eb});var io=require(_0x6a88('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x6a88('0xe')][_0x6a88('0xf')]=function(_0xe23a67){this['tail']=this[_0x6a88('0x10')]?this[_0x6a88('0x10')][_0x6a88('0x11')](_0xe23a67):_0xe23a67();};function Preview(_0x1ddc20){this[_0x6a88('0x12')]=new Sequence();this[_0x6a88('0x13')]=_0x1ddc20[_0x6a88('0x14')];this[_0x6a88('0x15')]=_0x1ddc20[_0x6a88('0x15')];this[_0x6a88('0x16')]={};this[_0x6a88('0x17')]=_0x1ddc20[_0x6a88('0x17')];this[_0x6a88('0x18')]=0x0;ami['on'](_0x6a88('0x19'),this[_0x6a88('0x1a')][_0x6a88('0x1b')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x6a88('0x1c'),this['syncHangupRequest'][_0x6a88('0x1b')](this));ami['on'](_0x6a88('0x1d'),this['syncDialEnd'][_0x6a88('0x1b')](this));ami['on'](_0x6a88('0x1e'),this[_0x6a88('0x1f')][_0x6a88('0x1b')](this));ami['on'](_0x6a88('0x20'),this['syncVarSet'][_0x6a88('0x1b')](this));ami['on'](_0x6a88('0x21'),this[_0x6a88('0x22')][_0x6a88('0x1b')](this));ami['on'](_0x6a88('0x23'),this['syncBlindTransfer']['bind'](this));this['loopCampaigns'](this[_0x6a88('0x13')]);}function emit(_0x55312d,_0x7f64d5,_0x15ba7c){io['to'](_0x55312d)['emit'](_0x7f64d5,_0x15ba7c);}function emitVoiceQueueChannelRemove(_0x43acb7){logger[_0x6a88('0x24')](_0x6a88('0x25'),JSON[_0x6a88('0x26')](_0x43acb7));emit(util[_0x6a88('0x27')](_0x6a88('0x28'),_0x43acb7[_0x6a88('0x29')]),_0x6a88('0x2a'),_0x43acb7);io[_0x6a88('0x2b')](_0x6a88('0x2c'),_0x43acb7);}function notSendMessagesQueue(_0x470584){if(_0x470584[_0x6a88('0x2d')]){if(_0x470584[_0x6a88('0x2e')]===0x0&&_0x470584['pTalking']===0x0){_0x470584[_0x6a88('0x2d')]=![];_0x470584[_0x6a88('0x2f')]=0x0;_0x470584[_0x6a88('0x30')]=0x0;_0x470584['message']=utils[_0x6a88('0x31')]['INACTIVE'];ut[_0x6a88('0x32')](_0x6a88('0x33'),_0x470584['name']+_0x6a88('0x34'));}else{_0x470584[_0x6a88('0x35')]=utils[_0x6a88('0x31')][_0x6a88('0x36')];ut['logger'](_0x6a88('0x33'),_0x470584[_0x6a88('0x29')]+_0x6a88('0x37'));}}}Preview[_0x6a88('0xe')][_0x6a88('0x38')]=function(){var _0x2c4907=this;setInterval(function(){_0x2c4907[_0x6a88('0x39')]();},0x7cf);};Preview[_0x6a88('0xe')][_0x6a88('0x39')]=function(){var _0x2727ea=this[_0x6a88('0x13')];this[_0x6a88('0x18')]+=0x1;for(var _0x12f2a7 in _0x2727ea){if(_0x2727ea[_0x6a88('0x3a')](_0x12f2a7)&&(_0x2727ea[_0x12f2a7][_0x6a88('0x3b')]===_0x6a88('0x5')||_0x2727ea[_0x12f2a7][_0x6a88('0x3b')]===_0x6a88('0x3c'))&&_0x2727ea[_0x12f2a7]['type']===_0x6a88('0x3d')){if(this[_0x6a88('0x18')]>0x7){this[_0x6a88('0x18')]=0x0;this[_0x6a88('0x3e')]();}}if(_0x2727ea[_0x6a88('0x3a')](_0x12f2a7)&&_0x2727ea[_0x12f2a7]['dialMethod']===_0x6a88('0x5')&&_0x2727ea[_0x12f2a7][_0x6a88('0x3f')]===_0x6a88('0x3d')){if(_0x2727ea[_0x12f2a7][_0x6a88('0x40')]){this['setMessage'](_0x2727ea[_0x12f2a7]);if(_0x2727ea[_0x12f2a7]['dialPreviewAutoRecallMe'])this[_0x6a88('0x41')](_0x2727ea[_0x12f2a7]);}else{notSendMessagesQueue(_0x2727ea[_0x12f2a7]);}}}};Preview[_0x6a88('0xe')][_0x6a88('0x42')]=function(_0x4a14e0){var _0x17c4e1=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x17c4e1[_0x6a88('0x16')][_0x4a14e0])){loggerAction[_0x6a88('0x24')](_0x6a88('0x43'),_0x4a14e0,'Queue',_0x17c4e1[_0x6a88('0x16')][_0x4a14e0][_0x6a88('0x44')],_0x6a88('0x45'),JSON[_0x6a88('0x26')](_0x17c4e1[_0x6a88('0x13')][_0x17c4e1[_0x6a88('0x16')][_0x4a14e0][_0x6a88('0x44')]][_0x6a88('0x2e')]),_0x6a88('0x46'),JSON['stringify'](_0x17c4e1[_0x6a88('0x13')][_0x17c4e1[_0x6a88('0x16')][_0x4a14e0]['queue']][_0x6a88('0x47')]),JSON[_0x6a88('0x26')](_0x17c4e1[_0x6a88('0x16')][_0x4a14e0][_0x6a88('0x48')]),JSON[_0x6a88('0x26')](_[_0x6a88('0x49')](_0x17c4e1[_0x6a88('0x16')][_0x4a14e0],['contactId',_0x6a88('0x4a'),_0x6a88('0x4b'),_0x6a88('0x4c')])));return ami['Action']({'action':'status','channel':_0x17c4e1[_0x6a88('0x16')][_0x4a14e0][_0x6a88('0x4d')]})[_0x6a88('0x4e')](function(_0x57c01f){if(_0x57c01f[_0x6a88('0x35')]===_0x6a88('0x4f')){setTimeout(function(){if(_0x17c4e1[_0x6a88('0x16')][_0x4a14e0]){utils[_0x6a88('0x50')](_0x17c4e1[_0x6a88('0x13')][_0x17c4e1[_0x6a88('0x16')][_0x4a14e0][_0x6a88('0x44')]],_0x6a88('0x51'));if(_0x17c4e1[_0x6a88('0x16')][_0x4a14e0]['dialAnswer']===!![]){ut[_0x6a88('0x52')](_0x17c4e1[_0x6a88('0x13')][_0x17c4e1['actions'][_0x4a14e0]['queue']],_0x6a88('0x51'));ut[_0x6a88('0x53')](_0x6a88('0x54')+_0x4a14e0,_0x17c4e1[_0x6a88('0x16')][_0x4a14e0]['queue']);}ut[_0x6a88('0x53')](_0x6a88('0x55')+_0x4a14e0,_0x17c4e1[_0x6a88('0x16')][_0x4a14e0][_0x6a88('0x44')]);delete _0x17c4e1[_0x6a88('0x16')][_0x4a14e0];}},0x2328);}});}});};Preview['prototype'][_0x6a88('0x3e')]=function(){var _0x43c9ae=this;loggerAction[_0x6a88('0x24')](_0x6a88('0x56'),_['size'](this['actions']));for(var _0x27de90 in this[_0x6a88('0x16')]){if(_0x43c9ae[_0x6a88('0x16')]['hasOwnProperty'](_0x27de90)){_0x43c9ae[_0x6a88('0x42')](_0x27de90);}}};Preview['prototype'][_0x6a88('0x41')]=function(_0x8fedd9){var _0x461ec6=this;rpcDb[_0x6a88('0x57')](_0x8fedd9['id'],ut[_0x6a88('0x58')](this[_0x6a88('0x17')]))[_0x6a88('0x59')](function(_0x31a688){if(!_[_0x6a88('0x5a')](_0x31a688)){for(var _0x591907=0x0;_0x591907<_0x31a688[_0x6a88('0x5b')];_0x591907+=0x1){if(ut[_0x6a88('0x5c')](_0x31a688[_0x591907]['scheduledat'])<_0x8fedd9[_0x6a88('0x5d')]*0x3c){if(_0x31a688[_0x591907][_0x6a88('0x5e')]&&!_0x31a688[_0x591907][_0x6a88('0x5e')][_0x6a88('0x5f')]){_0x461ec6['run'](_0x31a688[_0x591907]['id'])['then'](ut[_0x6a88('0x60')](_0x6a88('0x61')))[_0x6a88('0x4e')](ut[_0x6a88('0x60')](_0x6a88('0x61')));}else{rpcDb[_0x6a88('0x62')](_0x31a688[_0x591907]['id']);}}else{var _0x4a5b2d=new Action(_0x31a688[_0x591907],_0x8fedd9);_0x4a5b2d[_0x6a88('0x63')]=moment()['format'](_0x6a88('0x64'));_0x8fedd9['outboundReCallsDay']+=0x1;ut[_0x6a88('0x65')](_0x4a5b2d,0x17,_0x6a88('0x66'));if(_0x8fedd9[_0x6a88('0x67')]){rpcDb[_0x6a88('0x68')](ut[_0x6a88('0x69')](_0x31a688[_0x591907]));rpcDb['createCustomerHistory'](_0x4a5b2d,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6a88('0x65')](_0x4a5b2d,0x16,_0x6a88('0x6a'));rpcDb[_0x6a88('0x6b')](_0x4a5b2d,_0x6a88('0x6c'));rpcDb[_0x6a88('0x6d')](_0x4a5b2d,_0x6a88('0x6c'));}}}}})[_0x6a88('0x4e')](ut[_0x6a88('0x60')]('[getContactRecallMe]'));};Preview[_0x6a88('0xe')]['setMessage']=function(_0x5c30eb){_0x5c30eb[_0x6a88('0x2d')]=!![];if(ut[_0x6a88('0x6e')](_0x5c30eb[_0x6a88('0x6f')])){_0x5c30eb[_0x6a88('0x35')]=utils[_0x6a88('0x31')][_0x6a88('0x70')];}else if(!ut[_0x6a88('0x71')](_0x5c30eb[_0x6a88('0x40')])){_0x5c30eb['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0x6a88('0x72')](_0x5c30eb[_0x6a88('0x73')])){if(!this[_0x6a88('0x72')](_0x5c30eb['TrunkBackup'])){_0x5c30eb[_0x6a88('0x35')]=utils[_0x6a88('0x31')]['UNREACHABLE_TRUNK'];}else{_0x5c30eb[_0x6a88('0x35')]=utils[_0x6a88('0x31')]['ACTIVE'];}}else{_0x5c30eb[_0x6a88('0x35')]=utils[_0x6a88('0x31')]['ACTIVE'];}};Preview[_0x6a88('0xe')][_0x6a88('0x74')]=function(_0x2a6f6c,_0x215da1,_0x3bf999){var _0x36070c=this;var _0x117408=this[_0x6a88('0x16')][_0x215da1];var _0xe8b784=this[_0x6a88('0x13')][_0x117408[_0x6a88('0x44')]];var _0x243e85;var _0xbf7021=![];var _0x18ade0=0x2;var _0x46a389=0x3;if(_0xe8b784){switch(_0x3bf999){case'1':_0xe8b784[_0x6a88('0x75')]+=0x1;_0x117408[_0x6a88('0x76')]+=0x1;_0x117408['countglobal']=ut['totalGlobal'](_0x117408);ut[_0x6a88('0x65')](_0x117408,0x0,'NoSuchNumber');ami[_0x6a88('0x2b')](_0x6a88('0x77'),ut[_0x6a88('0x78')](_0x117408,_0x6a88('0x79')));rpcDb[_0x6a88('0x6b')](_0x117408,_0x6a88('0x7a'));_0x36070c['verifyAdditionalPhones'](_0x117408,'0',_0xe8b784)[_0x6a88('0x59')](function(_0x14ed77){_0xbf7021=_0x14ed77[_0x6a88('0x7b')]==0x1;_0x18ade0=_0xe8b784[_0x6a88('0x7c')];_0x46a389=_0xe8b784[_0x6a88('0x7d')];if(!_0xbf7021){if(ut['totalGlobal'](_0x117408)>=_0xe8b784['dialGlobalMaxRetry']){_0x243e85=ut[_0x6a88('0x7e')](_0x117408,0xf,_0x6a88('0x7f'));rpcDb[_0x6a88('0x6d')](_0x243e85,_0x6a88('0x80'));}else{if(_0x117408['countnosuchnumberretry']>=_0xe8b784[_0x6a88('0x81')]){rpcDb['createCustomerFinal'](_0x117408,_0x6a88('0x80'));}else{rpcDb[_0x6a88('0x82')](ut['scheduledAt'](_0x117408,'countnosuchnumberretry',_0xe8b784[_0x6a88('0x7c')]),_0x117408[_0x6a88('0x83')],_0x117408['activeContact']);}}delete this[_0x6a88('0x16')][_0x2a6f6c[_0x6a88('0x84')]];}else{_0x117408[_0x6a88('0x76')]++;logger[_0x6a88('0x24')](_0x6a88('0x85'),_0x117408['countnosuchnumberretry']);logger[_0x6a88('0x24')]('id',_0x117408[_0x6a88('0x86')]);_0x36070c[_0x6a88('0x87')]({'id':_0x117408[_0x6a88('0x86')],'field':{'countnosuchnumberretry':_0x117408['countnosuchnumberretry']}})[_0x6a88('0x59')](function(){_0x36070c[_0x6a88('0x88')](_0x117408,_0x18ade0,_0x46a389)[_0x6a88('0x59')](function(){});});}});break;case _0x6a88('0x89'):var _0x47a906=moment()['format'](_0x6a88('0x64'));_0x117408['responsetime']=_0x47a906;_0x117408[_0x6a88('0x8a')]=_0x47a906;_0x117408[_0x6a88('0x48')]=!![];_0xe8b784[_0x6a88('0x47')]+=0x1;logger[_0x6a88('0x24')](_0x6a88('0x8b'),_0x117408[_0x6a88('0x8c')],_0x6a88('0x8d'),_0xe8b784[_0x6a88('0x29')],_0x6a88('0x46'),_0xe8b784[_0x6a88('0x47')]);ami[_0x6a88('0x2b')](_0x6a88('0x8e'),ut[_0x6a88('0x78')](_0x117408,_0x6a88('0x8f'),this[_0x6a88('0x13')][_0x117408['queue']]));if(_0xe8b784[_0x6a88('0x90')]||_0xe8b784[_0x6a88('0x91')]){ami[_0x6a88('0x2b')](_0x6a88('0x92'),{'queue':_0x117408[_0x6a88('0x44')],'interface':_0x117408['channelAgent'],'uniqueid':_0x117408[_0x6a88('0x8c')]});}break;case'16':ami[_0x6a88('0x2b')]('custom:agentcomplete',ut[_0x6a88('0x78')](_0x117408,_0x6a88('0x93'),this[_0x6a88('0x13')][_0x117408[_0x6a88('0x44')]]));emitVoiceQueueChannelRemove(ut[_0x6a88('0x78')](_0x117408,'complete'));_0xe8b784['outboundAnswerCallsDay']+=0x1;_0xe8b784[_0x6a88('0x94')]+=0x1;_0xe8b784[_0x6a88('0x95')]+=0x1;ut[_0x6a88('0x52')](_0xe8b784,_0x6a88('0x96'));_0x117408['countglobal']=ut[_0x6a88('0x97')](_0x117408);ut['logCustomer'](_0x117408,0x4,'Answer');rpcDb[_0x6a88('0x6b')](_0x117408,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x6a88('0x6d')](_0x117408,_0x6a88('0x98'));rpcDb[_0x6a88('0x99')](_0x117408);_0xe8b784[_0x6a88('0x9a')]+=_0x117408[_0x6a88('0x9b')];_0xe8b784[_0x6a88('0x9c')]+=_0x117408['talktime'];logger[_0x6a88('0x24')]('[syncHangup][talking][decrement]',_0x117408['uniqueid'],_0x6a88('0x8d'),_0xe8b784[_0x6a88('0x29')],_0x6a88('0x46'),_0xe8b784['pTalking']);delete this[_0x6a88('0x16')][_0x2a6f6c[_0x6a88('0x84')]];break;case _0x6a88('0x9d'):_0xe8b784[_0x6a88('0x9e')]+=0x1;_0x117408[_0x6a88('0x9f')]+=0x1;_0x117408[_0x6a88('0xa0')]=ut['totalGlobal'](_0x117408);ut[_0x6a88('0x65')](_0x117408,0x5,_0x6a88('0xa1'));_0x18ade0=_0xe8b784['dialBusyRetryFrequency'];_0x46a389=_0xe8b784[_0x6a88('0x7d')];ami[_0x6a88('0x2b')]('custom:agentbusy',ut[_0x6a88('0x78')](_0x117408,'busy'));rpcDb[_0x6a88('0x6b')](_0x117408,'[callProgressDetectingCustomer][logBusy]');_0x36070c['verifyAdditionalPhones'](_0x117408,'5',_0xe8b784)[_0x6a88('0x59')](function(_0x55ef23){_0xbf7021=_0x55ef23[_0x6a88('0x7b')]==0x1;if(!_0xbf7021){if(ut[_0x6a88('0x97')](_0x117408)>=_0xe8b784[_0x6a88('0xa2')]){_0x243e85=ut[_0x6a88('0x7e')](_0x117408,0xf,_0x6a88('0x7f'));rpcDb[_0x6a88('0x6d')](_0x243e85,_0x6a88('0xa3'));}else{if(_0x117408[_0x6a88('0x9f')]>=_0xe8b784['dialBusyMaxRetry']){rpcDb[_0x6a88('0x6d')](_0x117408,_0x6a88('0xa4'));}else{rpcDb[_0x6a88('0x82')](ut[_0x6a88('0xa5')](_0x117408,_0x6a88('0x9f'),_0xe8b784['dialBusyRetryFrequency']),_0x117408[_0x6a88('0x83')],_0x117408['activeContact']);}}}else{_0x117408[_0x6a88('0x9f')]++;_0x36070c[_0x6a88('0x87')]({'id':_0x117408['idContact'],'field':{'countbusyretry':_0x117408[_0x6a88('0x9f')]}})['then'](function(){_0x36070c['swapAdditionalPhones'](_0x117408,_0x18ade0,_0x46a389)[_0x6a88('0x59')](function(){});});}});break;case'NOANSWER':_0xe8b784[_0x6a88('0xa6')]+=0x1;_0x117408[_0x6a88('0xa7')]+=0x1;_0x117408[_0x6a88('0xa0')]=ut['totalGlobal'](_0x117408);ut['logCustomer'](_0x117408,0x3,_0x6a88('0xa8'));_0x18ade0=_0xe8b784[_0x6a88('0xa9')];_0x46a389=_0xe8b784[_0x6a88('0x7d')];var _0x11b357=ut['buildNoAnswerEventPayload'](_0x117408,_0xe8b784);ami[_0x6a88('0x2b')]('custom:agentnoanswer',_0x11b357);rpcDb[_0x6a88('0x6b')](_0x117408,_0x6a88('0xaa'));_0x36070c[_0x6a88('0xab')](_0x117408,'3',_0xe8b784)['then'](function(_0x11da06){_0xbf7021=_0x11da06['additional']==0x1;if(!_0xbf7021){if(ut[_0x6a88('0x97')](_0x117408)>=_0xe8b784[_0x6a88('0xa2')]){_0x243e85=ut[_0x6a88('0x7e')](_0x117408,0xf,_0x6a88('0x7f'));rpcDb[_0x6a88('0x6d')](_0x243e85,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x117408[_0x6a88('0xa7')]>=_0xe8b784[_0x6a88('0xac')]){rpcDb[_0x6a88('0x6d')](_0x117408,_0x6a88('0xaa'));}else{rpcDb['rescheduleContact'](ut[_0x6a88('0xa5')](_0x117408,_0x6a88('0xa7'),_0xe8b784[_0x6a88('0xa9')]),_0x117408[_0x6a88('0x83')],_0x117408[_0x6a88('0xad')]);}}}else{_0x117408['countnoanswerretry']++;_0x36070c[_0x6a88('0x87')]({'id':_0x117408[_0x6a88('0x86')],'field':{'countnoanswerretry':_0x117408[_0x6a88('0xa7')]}})[_0x6a88('0x59')](function(){_0x36070c[_0x6a88('0x88')](_0x117408,_0x18ade0,_0x46a389)[_0x6a88('0x59')](function(){});});}});break;case _0x6a88('0xae'):_0xe8b784[_0x6a88('0xaf')]+=0x1;_0x117408[_0x6a88('0xb0')]+=0x1;_0x117408[_0x6a88('0xa0')]=ut[_0x6a88('0x97')](_0x117408);ut[_0x6a88('0x65')](_0x117408,0x8,_0x6a88('0xb1'));_0x18ade0=_0xe8b784[_0x6a88('0xb2')];_0x46a389=_0xe8b784[_0x6a88('0x7d')];ami[_0x6a88('0x2b')](_0x6a88('0xb3'),ut[_0x6a88('0x78')](_0x117408,_0x6a88('0xb4')));rpcDb[_0x6a88('0x6b')](_0x117408,_0x6a88('0xb5'));_0x36070c[_0x6a88('0xab')](_0x117408,'8',_0xe8b784)['then'](function(_0x35a048){_0xbf7021=_0x35a048[_0x6a88('0x7b')]==0x1;if(!_0xbf7021){if(ut[_0x6a88('0x97')](_0x117408)>=_0xe8b784[_0x6a88('0xa2')]){_0x243e85=ut[_0x6a88('0x7e')](_0x117408,0xf,_0x6a88('0x7f'));rpcDb[_0x6a88('0x6d')](_0x243e85,_0x6a88('0xb6'));}else{if(_0x117408[_0x6a88('0xb0')]>=_0xe8b784['dialCongestionMaxRetry']){rpcDb[_0x6a88('0x6d')](_0x117408,_0x6a88('0xb5'));}else{rpcDb[_0x6a88('0x82')](ut[_0x6a88('0xa5')](_0x117408,_0x6a88('0xb0'),_0xe8b784[_0x6a88('0xb7')]),_0x117408[_0x6a88('0x83')],_0x117408[_0x6a88('0xad')]);}}}else{_0x117408[_0x6a88('0xb0')]++;_0x36070c['incrementPreviewCounters']({'id':_0x117408[_0x6a88('0x86')],'field':{'countcongestionretry':_0x117408[_0x6a88('0xb0')]}})[_0x6a88('0x59')](function(){_0x36070c['swapAdditionalPhones'](_0x117408,_0x18ade0,_0x46a389)[_0x6a88('0x59')](function(){});});}});break;case'CANCEL':_0xe8b784[_0x6a88('0xb8')]+=0x1;_0x117408[_0x6a88('0xb9')]+=0x1;_0x117408[_0x6a88('0xa0')]=ut[_0x6a88('0x97')](_0x117408);ut['logCustomer'](_0x117408,0x14,_0x6a88('0xba'));_0x18ade0=_0xe8b784[_0x6a88('0xbb')];_0x46a389=_0xe8b784[_0x6a88('0x7d')];ami[_0x6a88('0x2b')](_0x6a88('0xbc'),ut[_0x6a88('0x78')](_0x117408,_0x6a88('0xbd')));rpcDb['createCustomerHistory'](_0x117408,_0x6a88('0xbe'));_0x36070c['verifyAdditionalPhones'](_0x117408,'20',_0xe8b784)[_0x6a88('0x59')](function(_0x533390){_0xbf7021=_0x533390['additional']==0x1;if(!_0xbf7021){if(ut[_0x6a88('0x97')](_0x117408)>=_0xe8b784[_0x6a88('0xa2')]){_0x243e85=ut[_0x6a88('0x7e')](_0x117408,0x14,'AgentReject');rpcDb[_0x6a88('0x6d')](_0x243e85,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x117408[_0x6a88('0xb9')]>=_0xe8b784[_0x6a88('0xbf')]){rpcDb[_0x6a88('0x6d')](_0x117408,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x6a88('0x82')](ut[_0x6a88('0xa5')](_0x117408,_0x6a88('0xb9'),_0xe8b784[_0x6a88('0xbb')]),_0x117408[_0x6a88('0x83')],_0x117408['activeContact']);}}}else{_0x117408['countnoanswerretry']++;_0x36070c[_0x6a88('0x87')]({'id':_0x117408[_0x6a88('0x86')],'field':{'countnoanswerretry':_0x117408[_0x6a88('0xa7')]}})['then'](function(){_0x36070c[_0x6a88('0x88')](_0x117408,_0x18ade0,_0x46a389)[_0x6a88('0x59')](function(){});});}});break;case _0x6a88('0xc0'):_0xe8b784[_0x6a88('0xc1')]+=0x1;_0x117408[_0x6a88('0xc2')]+=0x1;_0x117408['countglobal']=ut['totalGlobal'](_0x117408);ut[_0x6a88('0x65')](_0x117408,0xb,_0x6a88('0xc3'));rpcDb['createCustomerHistory'](_0x117408,_0x6a88('0xc4'));_0x36070c[_0x6a88('0xab')](_0x117408,'11',_0xe8b784)[_0x6a88('0x59')](function(_0xaaade8){_0xbf7021=_0xaaade8[_0x6a88('0x7b')]==0x1;if(!_0xbf7021){if(ut[_0x6a88('0x97')](_0x117408)>=_0xe8b784['dialGlobalMaxRetry']){_0x243e85=ut[_0x6a88('0x7e')](_0x117408,0xf,_0x6a88('0x7f'));rpcDb[_0x6a88('0x6d')](_0x243e85,_0x6a88('0xc4'));}else{if(_0x117408['countabandonedetry']>=_0xe8b784[_0x6a88('0xc5')]){rpcDb[_0x6a88('0x6d')](_0x117408,_0x6a88('0xc4'));}else{rpcDb[_0x6a88('0x82')](ut['scheduledAt'](_0x117408,'countabandonedretry',_0xe8b784[_0x6a88('0xc6')]),_0x117408[_0x6a88('0x83')],_0x117408[_0x6a88('0xad')]);}}}else{_0x117408[_0x6a88('0xa7')]++;_0x36070c['incrementPreviewCounters']({'id':_0x117408[_0x6a88('0x86')],'field':{'countnoanswerretry':_0x117408[_0x6a88('0xa7')]}})[_0x6a88('0x59')](function(){_0x36070c[_0x6a88('0x88')](_0x117408,_0x18ade0,_0x46a389)['then'](function(){});});}});break;case'18':_0xe8b784[_0x6a88('0xc7')]+=0x1;_0x117408[_0x6a88('0xc8')]+=0x1;_0x117408[_0x6a88('0xa0')]=ut[_0x6a88('0x97')](_0x117408);ut[_0x6a88('0x65')](_0x117408,0x12,_0x2a6f6c[_0x6a88('0xc9')]||_0x2a6f6c[_0x6a88('0xca')]);ami[_0x6a88('0x2b')](_0x6a88('0xcb'),ut[_0x6a88('0x78')](_0x117408,_0x6a88('0xcc')));rpcDb[_0x6a88('0x6b')](_0x117408,_0x6a88('0xcd'));_0x36070c[_0x6a88('0xab')](_0x117408,'18',_0xe8b784)[_0x6a88('0x59')](function(_0x27a4ed){_0xbf7021=_0x27a4ed['additional']==0x1;if(!_0xbf7021){if(ut['totalGlobal'](_0x117408)>=_0xe8b784[_0x6a88('0xa2')]){_0x243e85=ut['cloneAction'](_0x117408,0x12,'Global');rpcDb['createCustomerFinal'](_0x243e85,_0x6a88('0xcd'));}else{rpcDb[_0x6a88('0x6d')](_0x117408,_0x6a88('0xcd'));}}else{_0x117408[_0x6a88('0xa7')]++;_0x36070c[_0x6a88('0x87')]({'id':_0x117408['idContact'],'field':{'countnoanswerretry':_0x117408['countnoanswerretry']}})[_0x6a88('0x59')](function(){_0x36070c[_0x6a88('0x88')](_0x117408,_0x18ade0,_0x46a389)['then'](function(){});});}});delete this[_0x6a88('0x16')][_0x2a6f6c[_0x6a88('0x84')]];break;case'19':_0xe8b784[_0x6a88('0xc7')]+=0x1;_0x117408['countglobal']=ut[_0x6a88('0x97')](_0x117408);ut[_0x6a88('0x65')](_0x117408,0x13,_0x2a6f6c['cause-txt']||_0x2a6f6c[_0x6a88('0xca')]);ami[_0x6a88('0x2b')](_0x6a88('0xcb'),ut[_0x6a88('0x78')](_0x117408,_0x6a88('0xcc')));rpcDb[_0x6a88('0x6b')](_0x117408,_0x6a88('0xce'));_0x36070c[_0x6a88('0xab')](_0x117408,'18',_0xe8b784)[_0x6a88('0x59')](function(_0xfa4ca1){_0xbf7021=_0xfa4ca1[_0x6a88('0x7b')]==0x1;if(!_0xbf7021){if(ut['totalGlobal'](_0x117408)>=_0xe8b784['dialGlobalMaxRetry']){_0x243e85=ut['cloneAction'](_0x117408,0xf,'Global');rpcDb[_0x6a88('0x6d')](_0x243e85,_0x6a88('0xce'));}else{rpcDb[_0x6a88('0x6d')](_0x117408,'[callProgressDetectingCustomer][machine]');}}else{_0x117408[_0x6a88('0xa7')]++;_0x36070c[_0x6a88('0x87')]({'id':_0x117408[_0x6a88('0x86')],'field':{'countnoanswerretry':_0x117408[_0x6a88('0xa7')]}})[_0x6a88('0x59')](function(){_0x36070c[_0x6a88('0x88')](_0x117408,_0x18ade0,_0x46a389)['then'](function(){});});}});delete this[_0x6a88('0x16')][_0x2a6f6c['linkedid']];break;default:if(_0x117408[_0x6a88('0x48')]){ut[_0x6a88('0x52')](_0xe8b784,'[default]');ut['loggerError'](_0x6a88('0xcf')+_0xe8b784[_0x6a88('0x29')],_0x2a6f6c);}_0xe8b784['outboundUnknownCallsDay']+=0x1;_0x117408[_0x6a88('0xa0')]=ut[_0x6a88('0x97')](_0x117408);ut[_0x6a88('0x65')](_0x117408,0xc,_0x2a6f6c[_0x6a88('0xc9')]||_0x2a6f6c[_0x6a88('0xca')]);_0x18ade0=_0xe8b784[_0x6a88('0xbb')];_0x46a389=_0xe8b784[_0x6a88('0x7d')];rpcDb[_0x6a88('0x6b')](_0x117408,_0x6a88('0xd0'));_0x36070c['verifyAdditionalPhones'](_0x117408,'20',_0xe8b784)['then'](function(_0x519067){_0xbf7021=_0x519067[_0x6a88('0x7b')]==0x1;if(!_0xbf7021){if(ut[_0x6a88('0x97')](_0x117408)>=_0xe8b784[_0x6a88('0xa2')]){_0x243e85=ut[_0x6a88('0x7e')](_0x117408,0xf,_0x6a88('0x7f'));rpcDb[_0x6a88('0x6d')](_0x243e85,_0x6a88('0xd1'));}else{rpcDb[_0x6a88('0x6d')](_0x117408,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x6a88('0x16')][_0x2a6f6c[_0x6a88('0x84')]];}else{_0x36070c['swapAdditionalPhones'](_0x117408,_0x18ade0,_0x46a389)[_0x6a88('0x59')](function(){});}});}if(!(_0x117408['dialAnswer']&&_0x3bf999==='16')){utils[_0x6a88('0x50')](_0xe8b784,_0x6a88('0xd2'));logger[_0x6a88('0x24')]('[originated][decrement][callProgressDetectingCustomer]',_0x117408[_0x6a88('0x8c')],'\x20Queue',_0xe8b784[_0x6a88('0x29')],_0x6a88('0x45'),_0xe8b784[_0x6a88('0x2e')]);}if(_0x3bf999!==_0x6a88('0x89')){delete this['actions'][_0x2a6f6c[_0x6a88('0x84')]];delete this[_0x6a88('0x16')][_0x2a6f6c[_0x6a88('0xd3')]];}_0xe8b784[_0x6a88('0xd4')]=!![];}};Preview[_0x6a88('0xe')][_0x6a88('0xd5')]=function(_0x41f56f,_0x53315c,_0x1f28a8){if(_['isUndefined'](_0x53315c)&&_0x6a88('0xd6')!==typeof _0x53315c){return;}if(_[_0x6a88('0xd7')](_0x1f28a8)&&'object'!==typeof _0x1f28a8){return;}switch(_0x1f28a8[_0x6a88('0xd8')]){case'0':ut['logAgent'](_0x41f56f,0x0,_0x6a88('0xd9'));rpcDb[_0x6a88('0xda')](_0x41f56f,_0x6a88('0xdb'));break;case'3':ut['logAgent'](_0x41f56f,0x3,_0x6a88('0xa8'));rpcDb[_0x6a88('0xda')](_0x41f56f,_0x6a88('0xdc'));break;case'5':ut[_0x6a88('0xdd')](_0x41f56f,0x5,'Busy');rpcDb[_0x6a88('0xda')](_0x41f56f,_0x6a88('0xde'));break;case'8':ut[_0x6a88('0xdd')](_0x41f56f,0x8,_0x6a88('0xb1'));rpcDb['createAgentHistory'](_0x41f56f,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x41f56f,0x16,_0x6a88('0xdf'));rpcDb[_0x6a88('0xda')](_0x41f56f,_0x6a88('0xe0'));break;default:ut[_0x6a88('0xdd')](_0x41f56f,0xc,_0x1f28a8[_0x6a88('0xd8')]);rpcDb[_0x6a88('0xda')](_0x41f56f,_0x6a88('0xe1'));}utils[_0x6a88('0x50')](_0x53315c,_0x6a88('0xe2'));logger['info'](_0x6a88('0xe3'),_0x41f56f[_0x6a88('0x8c')],_0x6a88('0x8d'),_0x53315c[_0x6a88('0x29')],_0x6a88('0x45'),_0x53315c[_0x6a88('0x2e')]);delete this['actions'][_0x41f56f['uniqueid']];};Preview['prototype'][_0x6a88('0xab')]=function(_0x89e25c,_0x463168,_0x573cc0){return cmHopperAdditionalPhone[_0x6a88('0xab')](_0x89e25c,_0x463168,_0x573cc0)[_0x6a88('0x4e')](logger[_0x6a88('0x24')](_0x6a88('0xe4')));};Preview[_0x6a88('0xe')]['swapAdditionalPhones']=function(_0x575550,_0x37efaa,_0x2c30e1){return cmHopperAdditionalPhone[_0x6a88('0x88')](_0x575550,_0x37efaa,_0x2c30e1)[_0x6a88('0x4e')](logger[_0x6a88('0x24')](_0x6a88('0xe5')));};Preview[_0x6a88('0xe')][_0x6a88('0x87')]=function(_0x2fc3f6){return Promise[_0x6a88('0xe6')]()[_0x6a88('0x59')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x2fc3f6))[_0x6a88('0x4e')](logger[_0x6a88('0x24')](_0x6a88('0xe7')));};Preview['prototype']['checkInBlack']=function(_0x9c5a86,_0x1e3411,_0xd3c4db,_0x164efc,_0x49c5e5){var _0x5b5737=this;return new Promise(function(_0x26f381,_0x4592d4){if(_['isNil'](_0x1e3411)||_['isNil'](_0x1e3411[_0x6a88('0xe8')])||_[_0x6a88('0x5a')](_0x1e3411['phone'])||_[_0x6a88('0x5a')](_0x1e3411[_0x6a88('0x4b')])){_0x4592d4(ut[_0x6a88('0x35')]('Contact\x20is\x20undefined',_0x164efc,_0x49c5e5));return;}var _0x5f3e7f=uuid['v4']();var _0x16c915=_0x5b5737[_0x6a88('0x13')][_0x1e3411[_0x6a88('0xe9')]['name']];var _0x1c7d45=_0xd3c4db?_0x5b5737[_0x6a88('0x17')][_0xd3c4db]['id']:undefined;_0x5b5737['actions'][_0x5f3e7f]=new Action(_0x1e3411,_0x16c915,_0x5f3e7f,_0xd3c4db,_0x1c7d45);var _0x4c6022=_0x5b5737[_0x6a88('0x16')][_0x5f3e7f];_0x4c6022[_0x6a88('0x83')]=_0x164efc;_0x4c6022[_0x6a88('0xad')]=_0x49c5e5;_0x4c6022[_0x6a88('0xea')]=_0xd3c4db;if(_[_0x6a88('0xeb')](_0x9c5a86)){_0x5b5737[_0x6a88('0xec')](_0x4c6022,_0x16c915,_0x1e3411,_0xd3c4db)[_0x6a88('0x59')](function(_0x52b1ae){logger[_0x6a88('0x24')]('[Preview][execCall][success]',_0x6a88('0xed')+_0x4c6022[_0x6a88('0x44')]+_0x6a88('0xee')+_0x4c6022[_0x6a88('0x86')],JSON[_0x6a88('0x26')](_0x52b1ae));ami[_0x6a88('0x2b')](_0x6a88('0xef'),ut[_0x6a88('0x78')](_0x4c6022,_0x6a88('0xf0'),_0x5b5737[_0x6a88('0x13')][_0x4c6022[_0x6a88('0x44')]]));_0x26f381(ut[_0x6a88('0x35')](_0x6a88('0xf1')));})[_0x6a88('0x4e')](function(_0x2793c0){ut[_0x6a88('0x32')]('[Preview][execCall][failure]',_0x2793c0);_0x4592d4(ut[_0x6a88('0x35')]('Call\x20failed',_0x164efc,_0x49c5e5));});}else{_0x16c915['outboundBlacklistCallsDay']+=0x1;ut[_0x6a88('0xf2')](_0x4c6022);rpcDb[_0x6a88('0xf3')](_0x4c6022,_0x6a88('0xf4'));delete _0x5b5737[_0x6a88('0x16')][_0x5f3e7f];_0x4592d4(ut[_0x6a88('0x35')](_0x6a88('0xf5'),_0x164efc,_0x49c5e5));}});};Preview['prototype']['isTrunkReachable']=function(_0x2b601a){return!_['isNil'](_0x2b601a)&&!_['isNil'](_0x2b601a[_0x6a88('0x29')])&&!_[_0x6a88('0x5a')](_0x2b601a[_0x6a88('0xf6')])&&_0x2b601a['active']&&!_['isNil'](this[_0x6a88('0x15')][util[_0x6a88('0x27')](_0x6a88('0xf7'),_0x2b601a[_0x6a88('0x29')])])&&!_[_0x6a88('0x5a')](this['trunks'][util[_0x6a88('0x27')](_0x6a88('0xf7'),_0x2b601a[_0x6a88('0x29')])][_0x6a88('0xf8')])&&(this[_0x6a88('0x15')][util[_0x6a88('0x27')](_0x6a88('0xf7'),_0x2b601a['name'])][_0x6a88('0xf8')]===_0x6a88('0xf9')||this[_0x6a88('0x15')][util[_0x6a88('0x27')](_0x6a88('0xf7'),_0x2b601a['name'])]['status']===_0x6a88('0xfa'));};Preview[_0x6a88('0xe')][_0x6a88('0xfb')]=function(_0x3920a5,_0x2ceb64){return this['execRun'](_0x3920a5,_0x2ceb64)['then'](function(_0x12c0b6){return _[_0x6a88('0x49')](_0x12c0b6,['message']);})[_0x6a88('0x4e')](function(_0xc17b8f){if(_0xc17b8f['unlock']){rpcDb[_0x6a88('0xfc')](_0x3920a5);}if(_0xc17b8f[_0x6a88('0xf6')]){rpcDb[_0x6a88('0x62')](_0x3920a5);}throw _[_0x6a88('0x49')](_0xc17b8f,['message']);});};Preview['prototype']['execRun']=function(_0x3fb049,_0xb67e25){var _0x451486=this;var _0x266957,_0x4a3ebb;return rpcDb[_0x6a88('0xfd')](_0x3fb049)[_0x6a88('0x59')](function(_0x10fb30){if(!_[_0x6a88('0x5a')](_0x10fb30[0x0])){_0x4a3ebb=_0x10fb30[0x0][_0x6a88('0xfe')]?![]:!![];_0x266957=_0x10fb30[0x0][_0x6a88('0xfe')]?!![]:![];_0x266957=_0xb67e25?!![]:_0x266957;}var _0x337877=_0x451486[_0x6a88('0xff')](_0x10fb30);if(_0x337877['isValid']){rpcDb[_0x6a88('0x100')](_[_0x6a88('0x49')](_0x10fb30[0x0],[_0x6a88('0x4b'),_0x6a88('0x101')]))[_0x6a88('0x59')](function(_0x3960de){_0x451486[_0x6a88('0x102')](_0x3960de,_0x10fb30[0x0],_0xb67e25,_0x4a3ebb,_0x266957)[_0x6a88('0x59')](function(_0x4befd3){return _0x4befd3;})[_0x6a88('0x4e')](function(_0x544de2){throw _0x544de2;});})[_0x6a88('0x4e')](function(_0x15c4ca){ut[_0x6a88('0x32')]('[Preview][checkIsBlackList]',_0x15c4ca);throw ut[_0x6a88('0x35')](_0x6a88('0x103'),_0x4a3ebb,_0x266957);});}else{throw ut['message'](_0x337877[_0x6a88('0x35')],_0x4a3ebb,_0x266957);}})['catch'](function(_0x587924){ut['logger'](_0x6a88('0x104'),_0x587924);throw ut[_0x6a88('0x35')](_0x6a88('0x103'),![],!![]);});};Preview['prototype']['validateContact']=function(_0x563475){if(_[_0x6a88('0x5a')](_0x563475)||_[_0x6a88('0xeb')](_0x563475)||!_['isNil'](_0x563475[0x0][_0x6a88('0x5e')])&&_[_0x6a88('0x5a')](_0x563475[0x0][_0x6a88('0x5e')]['name'])){ut[_0x6a88('0x32')](_0x6a88('0x105'),_0x563475);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3278b8=this['campaignsPreview'][_0x563475[0x0]['Queue'][_0x6a88('0x29')]];_0x3278b8[_0x6a88('0x35')]=utils[_0x6a88('0x31')][_0x6a88('0x106')];if(_['isNil'](_0x3278b8)){ut['logger'](_0x6a88('0x107'),_0x3278b8);return{'isValid':![],'message':_0x6a88('0x108')};}if(!this['isTrunkReachable'](_0x3278b8[_0x6a88('0x73')])){ut['logger'](_0x6a88('0x109'),_0x6a88('0x10a')+_0x3278b8[_0x6a88('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x6a88('0x72')](_0x3278b8[_0x6a88('0x10b')])){ut['logger'](_0x6a88('0x109'),_0x3278b8['name']+_0x6a88('0x10c'));return{'isValid':![],'message':_0x6a88('0x10d')};}}if(!ut[_0x6a88('0x71')](_0x3278b8['dialActive'])){ut[_0x6a88('0x32')]('[Preview][validateContact][Campaign\x20Active]',_0x3278b8[_0x6a88('0x29')]+_0x6a88('0x10e'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3278b8['name']+_0x6a88('0x10e')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x6a88('0xe')][_0x6a88('0xec')]=function(_0x114c72,_0x295f14,_0x4f1b71,_0x11be52){var _0x33ceef=this;return new Promise(function(_0x320397,_0x1ac0ba){var _0x51c694=_0x114c72[_0x6a88('0x8c')];var _0x2da50a=_0x33ceef[_0x6a88('0x72')](_0x295f14[_0x6a88('0x73')])?util['format'](_0x6a88('0x10f'),_0x295f14[_0x6a88('0x73')][_0x6a88('0x29')],_[_0x6a88('0x5a')](_0x295f14[_0x6a88('0x110')])?'':_0x295f14[_0x6a88('0x110')][_0x6a88('0x111')]()||'',_0x295f14[_0x6a88('0x112')]>0x0?_0x4f1b71['phone'][_0x6a88('0x113')](_0x295f14[_0x6a88('0x112')]):_0x4f1b71[_0x6a88('0x101')]):util[_0x6a88('0x27')]('SIP/%s/%s%s',_[_0x6a88('0x5a')](_0x295f14['TrunkBackup'])?_0x295f14[_0x6a88('0x73')][_0x6a88('0x29')]:_0x295f14[_0x6a88('0x10b')][_0x6a88('0x29')],_['isNil'](_0x295f14[_0x6a88('0x110')])?'':_0x295f14[_0x6a88('0x110')]['trim']()||'',_0x295f14[_0x6a88('0x112')]>0x0?_0x4f1b71['phone'][_0x6a88('0x113')](_0x295f14['dialCutDigit']):_0x4f1b71['phone']);var _0x48d532=_0x33ceef[_0x6a88('0x72')](_0x295f14['Trunk'])?ut[_0x6a88('0x114')](_0x295f14['Trunk'][_0x6a88('0x115')],_0x295f14[_0x6a88('0x116')],_0x295f14[_0x6a88('0x117')]>0x0?ut[_0x6a88('0x118')](_0x295f14[_0x6a88('0x119')],_0x295f14[_0x6a88('0x117')]):_0x295f14[_0x6a88('0x119')]):ut[_0x6a88('0x114')](_[_0x6a88('0x5a')](_0x295f14[_0x6a88('0x10b')])?_0x295f14[_0x6a88('0x73')][_0x6a88('0x115')]:_0x295f14['TrunkBackup'][_0x6a88('0x115')],_0x295f14['dialOriginateCallerIdName'],_0x295f14[_0x6a88('0x117')]>0x0?ut[_0x6a88('0x118')](_0x295f14[_0x6a88('0x119')],_0x295f14[_0x6a88('0x117')]):_0x295f14[_0x6a88('0x119')]);if(_0x48d532){_0x114c72[_0x6a88('0x11a')]=ut[_0x6a88('0x11b')](_0x48d532);_0x114c72[_0x6a88('0x11c')]=ut['extractCalleridNumber'](_0x48d532);}var _0x5779bd=ut['addVariables'](_0x295f14,_0x4f1b71,_0x2da50a,_0x48d532,_0x51c694,_0x114c72);var _0x3901de=utils[_0x6a88('0x11d')](_0x4f1b71[_0x6a88('0xe8')]);Object[_0x6a88('0x11e')](_0x5779bd,_0x3901de);_[_0x6a88('0x11f')](_0x114c72,ut[_0x6a88('0x120')](_0x5779bd));_0x114c72[_0x6a88('0x63')]=moment()[_0x6a88('0x27')](_0x6a88('0x64'));_0x295f14[_0x6a88('0x121')]=_0x5779bd;var _0x1429be=ut[_0x6a88('0x122')](_0x114c72,_0x295f14,_0x5779bd,_0x114c72['activeContact'],_0x11be52);return ami['Action'](_0x1429be)[_0x6a88('0x59')](function(_0x598a65){_0x295f14[_0x6a88('0x2e')]+=0x1;logger[_0x6a88('0x24')](_0x6a88('0x123'),_0x51c694,'\x20Queue',_0x295f14[_0x6a88('0x29')],_0x6a88('0x45'),_0x295f14[_0x6a88('0x2e')]);_0x320397(_0x598a65);})[_0x6a88('0x4e')](function(_0x1e04af){ut[_0x6a88('0xdd')](_0x114c72,0xe,_0x6a88('0x124'));rpcDb[_0x6a88('0xda')](_0x114c72,'[originateFailure][logOriginateFailure]');_0x1ac0ba(_0x1e04af);});});};Preview[_0x6a88('0xe')][_0x6a88('0x1f')]=function(_0x31ea36){if(this[_0x6a88('0x16')][_0x31ea36[_0x6a88('0x84')]]){this[_0x6a88('0x16')][_0x31ea36[_0x6a88('0x84')]][_0x6a88('0x4d')]=_0x31ea36['channel'];}};Preview[_0x6a88('0xe')]['syncOriginateResponse']=function(_0x435684){var _0x1f73cd=this;var _0x2852c7=this['actions'][_0x435684[_0x6a88('0x125')]];if(_0x2852c7){if(_0x2852c7[_0x6a88('0xea')]&&this[_0x6a88('0x17')][_0x2852c7[_0x6a88('0xea')]]){ut['logLookAgent'](_0x2852c7,this['agents'][_0x2852c7[_0x6a88('0xea')]]['name'],this[_0x6a88('0x17')][_0x2852c7['lookAgent']]['id']);}var _0x58f926=_[_0x6a88('0x126')](_0x2852c7);_0x58f926['responsetime']=moment()[_0x6a88('0x27')](_0x6a88('0x64'));var _0x273054=_0x1f73cd[_0x6a88('0x13')][_0x2852c7[_0x6a88('0x44')]];if(ut[_0x6a88('0x127')](_0x435684[_0x6a88('0x128')])){if(_0x2852c7[_0x6a88('0x83')]){rpcDb['unlockContact'](_0x2852c7[_0x6a88('0x86')]);}if(_0x2852c7['activeContact']){rpcDb[_0x6a88('0x62')](_0x2852c7[_0x6a88('0x86')]);}ami[_0x6a88('0x2b')](_0x6a88('0x129'),ut['buildObj'](_0x2852c7,_0x6a88('0x12a'),this[_0x6a88('0x13')][_0x2852c7[_0x6a88('0x44')]]));this[_0x6a88('0xd5')](_0x58f926,_0x273054,_0x435684);}else{_0x2852c7[_0x6a88('0x63')]=moment()[_0x6a88('0x27')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x6a88('0xdd')](_0x58f926,0x4,'Answer');rpcDb[_0x6a88('0xda')](_0x58f926,_0x6a88('0x12b'));}}};Preview[_0x6a88('0xe')]['syncHangup']=function(_0xba8fb8){var _0x474349=this[_0x6a88('0x16')][_0xba8fb8[_0x6a88('0x84')]];var _0x3cfbcd;if(_0x474349){_0x3cfbcd=this[_0x6a88('0x13')][_0x474349[_0x6a88('0x44')]];logger[_0x6a88('0x24')]('[syncHangup][talking]',_0xba8fb8['linkedid'],_0x6a88('0x8d'),_0x3cfbcd[_0x6a88('0x29')],_0x6a88('0x46'),_0x3cfbcd[_0x6a88('0x47')]);}if(this[_0x6a88('0x16')][_0xba8fb8[_0x6a88('0x84')]]&&_0xba8fb8[_0x6a88('0x84')]!==_0xba8fb8[_0x6a88('0x8c')]){if(_0xba8fb8[_0x6a88('0x12c')]==='16'&&this['actions'][_0xba8fb8[_0x6a88('0x84')]][_0x6a88('0x48')]){this[_0x6a88('0x74')](_0xba8fb8,_0xba8fb8[_0x6a88('0x84')],_0xba8fb8[_0x6a88('0x12c')]);}else if(this['actions'][_0xba8fb8[_0x6a88('0x84')]][_0x6a88('0x48')]){logger[_0x6a88('0x24')](_0x6a88('0x12d'),_0xba8fb8['linkedid'],_0xba8fb8[_0x6a88('0x12c')],'\x20Queue',_0x3cfbcd[_0x6a88('0x29')],_0x6a88('0x46'),_0x3cfbcd[_0x6a88('0x47')]);this[_0x6a88('0x74')](_0xba8fb8,_0xba8fb8['linkedid'],_0xba8fb8[_0x6a88('0x12c')]);}}else if(_0x474349&&_[_0x6a88('0x5a')](_0x474349['statedesc'])&&_0x3cfbcd[_0x6a88('0x12e')]&&_0xba8fb8[_0x6a88('0x84')]===_0xba8fb8[_0x6a88('0x8c')]&&_[_0x6a88('0x5a')](_0xba8fb8['reason'])&&_0xba8fb8['cause']==='16'&&_0xba8fb8[_0x6a88('0x12f')]==='6'&&_[_0x6a88('0xd7')](_0x474349[_0x6a88('0x130')])){if(_0x474349['unlockAgent']){rpcDb[_0x6a88('0xfc')](_0x474349[_0x6a88('0x86')]);}if(_0x474349[_0x6a88('0xad')]){rpcDb[_0x6a88('0x62')](_0x474349['idContact']);}_0xba8fb8[_0x6a88('0xd8')]='22';this[_0x6a88('0xd5')](_0x474349,_0x3cfbcd,_0xba8fb8);}else if(_0x474349&&_0x474349['transfer']){if(_0xba8fb8[_0x6a88('0x12c')]==='16'&&this[_0x6a88('0x16')][_0xba8fb8[_0x6a88('0x84')]][_0x6a88('0x48')]){logger[_0x6a88('0x24')](_0x6a88('0x131'),_0xba8fb8['linkedid'],_0xba8fb8[_0x6a88('0x12c')],_0x6a88('0x8d'),_0x3cfbcd[_0x6a88('0x29')],_0x6a88('0x46'),_0x3cfbcd['pTalking']);this['callProgressDetectingCustomer'](_0xba8fb8,_0xba8fb8['linkedid'],_0xba8fb8['cause']);}else if(this['actions'][_0xba8fb8[_0x6a88('0x84')]][_0x6a88('0x48')]){logger[_0x6a88('0x24')](_0x6a88('0x12d'),_0xba8fb8[_0x6a88('0x84')],_0xba8fb8[_0x6a88('0x12c')],_0x6a88('0x8d'),_0x3cfbcd[_0x6a88('0x29')],_0x6a88('0x46'),_0x3cfbcd['pTalking']);this[_0x6a88('0x74')](_0xba8fb8,_0xba8fb8['linkedid'],_0xba8fb8['cause']);}}};Preview[_0x6a88('0xe')][_0x6a88('0x132')]=function(_0x3a64d5){if(this[_0x6a88('0x16')][_0x3a64d5['destlinkedid']]&&_0x3a64d5[_0x6a88('0xd3')]!==_0x3a64d5[_0x6a88('0x133')]){this[_0x6a88('0x74')](_0x3a64d5,_0x3a64d5[_0x6a88('0xd3')],_0x3a64d5[_0x6a88('0xca')]);}};Preview[_0x6a88('0xe')][_0x6a88('0x134')]=function(_0x443de2){if(this[_0x6a88('0x16')][_0x443de2[_0x6a88('0x84')]]&&_0x443de2['linkedid']!==_0x443de2['uniqueid']&&!this[_0x6a88('0x16')][_0x443de2[_0x6a88('0x84')]]['dialAnswer']){if(_0x443de2[_0x6a88('0x12c')]==='1'){this[_0x6a88('0x74')](_0x443de2,_0x443de2[_0x6a88('0x84')],_0x443de2[_0x6a88('0x12c')]);}}};Preview[_0x6a88('0xe')]['addVariable']=function(_0x237ee9,_0x3a6dbb,_0x4549b2){if(this['actions'][_0x237ee9]){if(_['isNil'](this[_0x6a88('0x16')][_0x237ee9]['variables'])){this[_0x6a88('0x16')][_0x237ee9]['variables']={};}this[_0x6a88('0x16')][_0x237ee9][_0x6a88('0x121')][_0x3a6dbb]=_0x4549b2;}};Preview[_0x6a88('0xe')][_0x6a88('0x135')]=function(_0x5be289){try{if(!_[_0x6a88('0x5a')](_0x5be289)){if(ut[_0x6a88('0x136')](_[_0x6a88('0x137')](_0x5be289[_0x6a88('0x138')])[0x0])){this[_0x6a88('0x139')](_0x5be289['uniqueid'],_['keys'](_0x5be289[_0x6a88('0x138')])[0x0],_0x5be289[_0x6a88('0x13a')]);}}}catch(_0x4e1a65){logger[_0x6a88('0x13b')](_0x6a88('0x13c'),util['inspect'](_0x4e1a65,{'showHidden':![],'depth':null}));}};Preview[_0x6a88('0xe')][_0x6a88('0x22')]=function(_0x28d85f){if(_0x28d85f){if(this['actions'][_0x28d85f[_0x6a88('0x13d')]]){this[_0x6a88('0x16')][_0x28d85f[_0x6a88('0x13d')]][_0x6a88('0x130')]=!![];}}};Preview[_0x6a88('0xe')][_0x6a88('0x13e')]=function(_0x36a262){if(_0x36a262){if(this[_0x6a88('0x16')][_0x36a262[_0x6a88('0x13f')]]){this[_0x6a88('0x16')][_0x36a262[_0x6a88('0x13f')]][_0x6a88('0x130')]=!![];}}};module[_0x6a88('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3fedfc9..af89b42 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 _0x8827=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8827,0x1d5));var _0x7882=function(_0x333737,_0x56320a){_0x333737=_0x333737-0x0;var _0xd21e71=_0x8827[_0x333737];return _0xd21e71;};'use strict';var util=require('util');var BPromise=require(_0x7882('0x0'));var logger=require(_0x7882('0x1'))(_0x7882('0x2'));var cmHopper=require(_0x7882('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x7882('0x4'));var agentReportPreview=require(_0x7882('0x5'));var voiceQueueReport=require(_0x7882('0x6'));function loggerCatch(_0x5250b6){return function(_0x48294a){logger['error'](_0x5250b6,util[_0x7882('0x7')](_0x48294a,{'showHidden':![],'depth':null}));};}function create(_0x17dbac){return cmHopperHistory[_0x7882('0x8')](_0x17dbac)[_0x7882('0x9')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x48216d){return BPromise[_0x7882('0xa')]()[_0x7882('0xb')](agentReportPreview[_0x7882('0x8')](_0x48216d))[_0x7882('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5cb9df){return cmHopper[_0x7882('0xc')](_0x5cb9df,!![])[_0x7882('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x7882('0xd')]=function(_0x4903ab){return cmHopperBlack['checkIsBlackList'](_0x4903ab)[_0x7882('0x9')](loggerCatch(_0x7882('0xe')));};exports[_0x7882('0xf')]=function(_0x4377a3){return BPromise[_0x7882('0xa')]()[_0x7882('0xb')](cmHopper[_0x7882('0xf')](_0x4377a3))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x7882('0x8')]=function(_0xff5c66,_0x294369){create(_0xff5c66)[_0x7882('0x9')](loggerCatch(_0x294369));moveContact(_0xff5c66)[_0x7882('0x9')](loggerCatch(_0x294369));};exports['createAgentHistory']=function(_0x28fd43,_0x5c6566){createAgent(_0x28fd43)[_0x7882('0x9')](loggerCatch(_0x5c6566));};exports[_0x7882('0x10')]=function(_0x356615,_0x45a3a6){create(_0x356615)[_0x7882('0x9')](loggerCatch(_0x45a3a6));};exports['createCustomerFinal']=function(_0x20bae1,_0x1d6d97){moveContact(_0x20bae1)['catch'](loggerCatch(_0x1d6d97));};exports[_0x7882('0x11')]=function(_0x5db910,_0x3121fe,_0x3e3e16){if(_0x3121fe){_0x5db910[_0x7882('0x12')]=null;}if(_0x3e3e16){_0x5db910[_0x7882('0x13')]=![];}return cmHopper[_0x7882('0x11')](_0x5db910)[_0x7882('0x9')](loggerCatch(_0x7882('0x14')));};exports[_0x7882('0x15')]=function(_0x2c0b5c){return cmHopper['countReScheduled'](_0x2c0b5c)[_0x7882('0x9')](loggerCatch(_0x7882('0x16')));};exports['unlockContact']=function(_0x2bba75){return cmHopper[_0x7882('0x17')]({'UserId':null},_0x2bba75,0x1)[_0x7882('0x9')](loggerCatch(_0x7882('0x18')));};exports[_0x7882('0x19')]=function(_0x2e286a){return cmHopper[_0x7882('0x17')]({'active':![]},_0x2e286a,0x1)[_0x7882('0x9')](loggerCatch(_0x7882('0x1a')));};exports[_0x7882('0x1b')]=function(_0x3bc897){var _0x3bc56c={};_0x3bc56c['type']=_0x3bc897[_0x7882('0x1c')];_0x3bc56c[_0x7882('0x1d')]=_0x3bc897[_0x7882('0x1d')];_0x3bc56c['calleridnum']=_0x3bc897['calleridnum'];_0x3bc56c[_0x7882('0x1e')]=_0x3bc897[_0x7882('0x1e')];_0x3bc56c[_0x7882('0x1f')]=_0x3bc897['queue'];_0x3bc56c['queuecallerjoinAt']=_0x3bc897[_0x7882('0x20')];_0x3bc56c['queuecallerleaveAt']=_0x3bc897['answertime'];_0x3bc56c[_0x7882('0x21')]=0x1;_0x3bc56c[_0x7882('0x22')]=_0x3bc897[_0x7882('0x23')];_0x3bc56c[_0x7882('0x24')]=_0x3bc897[_0x7882('0x25')];_0x3bc56c[_0x7882('0x26')]=_0x7882('0x27');_0x3bc56c[_0x7882('0x28')]=_0x7882('0x29');_0x3bc56c[_0x7882('0x2a')]=0x0;_0x3bc56c['assigned']=0x1;_0x3bc56c[_0x7882('0x2b')]=_0x3bc897[_0x7882('0x25')];_0x3bc56c['queuecallerexitreason']=_0x7882('0x2c');return BPromise['resolve']()[_0x7882('0xb')](voiceQueueReport['create'](_0x3bc56c))[_0x7882('0x9')](loggerCatch(_0x7882('0x2d')));};exports[_0x7882('0x2e')]=function(_0x404d1c,_0x1006d2){return BPromise[_0x7882('0xa')]()[_0x7882('0xb')](cmHopper[_0x7882('0x2e')](_0x404d1c,_0x1006d2))[_0x7882('0x9')](loggerCatch(_0x7882('0x2f')));};exports['rescheduleContactInQueue']=function(_0x50eec4){return cmHopper[_0x7882('0x11')](_0x50eec4,!![],!![])[_0x7882('0x9')](loggerCatch(_0x7882('0x30')));}; \ No newline at end of file +var _0xf89d=['from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','catch','[createHistory]\x20','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','resolve','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context'];(function(_0x589c79,_0x5c835c){var _0xb5ac67=function(_0x2b7ed0){while(--_0x2b7ed0){_0x589c79['push'](_0x589c79['shift']());}};_0xb5ac67(++_0x5c835c);}(_0xf89d,0x78));var _0xdf89=function(_0x4a5c3a,_0x339595){_0x4a5c3a=_0x4a5c3a-0x0;var _0x55c463=_0xf89d[_0x4a5c3a];return _0x55c463;};'use strict';var util=require(_0xdf89('0x0'));var BPromise=require('bluebird');var logger=require(_0xdf89('0x1'))(_0xdf89('0x2'));var cmHopper=require(_0xdf89('0x3'));var cmHopperHistory=require(_0xdf89('0x4'));var cmHopperBlack=require(_0xdf89('0x5'));var agentReportPreview=require(_0xdf89('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4eee25){return function(_0x1af243){logger[_0xdf89('0x7')](_0x4eee25,util[_0xdf89('0x8')](_0x1af243,{'showHidden':![],'depth':null}));};}function create(_0x1761d0){return cmHopperHistory['createHistory'](_0x1761d0)[_0xdf89('0x9')](loggerCatch(_0xdf89('0xa')));}function createAgent(_0x9fc4fc){return BPromise['resolve']()[_0xdf89('0xb')](agentReportPreview[_0xdf89('0xc')](_0x9fc4fc))[_0xdf89('0x9')](loggerCatch(_0xdf89('0xa')));}function moveContact(_0x35527b){return cmHopper[_0xdf89('0xd')](_0x35527b,!![])[_0xdf89('0x9')](loggerCatch(_0xdf89('0xe')));}exports[_0xdf89('0xf')]=function(_0x494d4e){return cmHopperBlack[_0xdf89('0xf')](_0x494d4e)[_0xdf89('0x9')](loggerCatch(_0xdf89('0x10')));};exports['getContactPreview']=function(_0x81e73c){return BPromise[_0xdf89('0x11')]()['then'](cmHopper[_0xdf89('0x12')](_0x81e73c))[_0xdf89('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0xdf89('0xc')]=function(_0x2d9780,_0x35a1f5){create(_0x2d9780)[_0xdf89('0x9')](loggerCatch(_0x35a1f5));moveContact(_0x2d9780)[_0xdf89('0x9')](loggerCatch(_0x35a1f5));};exports[_0xdf89('0x13')]=function(_0x43f5f0,_0x4c2df2){createAgent(_0x43f5f0)[_0xdf89('0x9')](loggerCatch(_0x4c2df2));};exports['createCustomerHistory']=function(_0x72b393,_0x24c605){create(_0x72b393)['catch'](loggerCatch(_0x24c605));};exports[_0xdf89('0x14')]=function(_0xc141d4,_0x5f0aea){moveContact(_0xc141d4)[_0xdf89('0x9')](loggerCatch(_0x5f0aea));};exports[_0xdf89('0x15')]=function(_0x2e723b,_0x1033f1,_0x5301be){if(_0x1033f1){_0x2e723b[_0xdf89('0x16')]=null;}if(_0x5301be){_0x2e723b[_0xdf89('0x17')]=![];}return cmHopper[_0xdf89('0x15')](_0x2e723b)[_0xdf89('0x9')](loggerCatch(_0xdf89('0x18')));};exports[_0xdf89('0x19')]=function(_0x4fea76){return cmHopper[_0xdf89('0x19')](_0x4fea76)[_0xdf89('0x9')](loggerCatch('[countReScheduled]\x20'));};exports[_0xdf89('0x1a')]=function(_0x43225d){return cmHopper[_0xdf89('0x1a')]({'UserId':null},_0x43225d,0x1)[_0xdf89('0x9')](loggerCatch(_0xdf89('0x1b')));};exports[_0xdf89('0x1c')]=function(_0x41d58c){return cmHopper['unlockContact']({'active':![]},_0x41d58c,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xdf89('0x1d')]=function(_0x1a3db8){var _0x459a32={};_0x459a32[_0xdf89('0x1e')]=_0x1a3db8[_0xdf89('0x1e')];_0x459a32[_0xdf89('0x1f')]=_0x1a3db8[_0xdf89('0x1f')];_0x459a32['calleridnum']=_0x1a3db8[_0xdf89('0x20')];_0x459a32[_0xdf89('0x21')]=_0x1a3db8[_0xdf89('0x21')];_0x459a32[_0xdf89('0x22')]=_0x1a3db8[_0xdf89('0x22')];_0x459a32[_0xdf89('0x23')]=_0x1a3db8[_0xdf89('0x24')];_0x459a32[_0xdf89('0x25')]=_0x1a3db8[_0xdf89('0x24')];_0x459a32['queuecallercomplete']=0x1;_0x459a32['queuecallercompleteAt']=_0x1a3db8[_0xdf89('0x26')];_0x459a32[_0xdf89('0x27')]=_0x1a3db8[_0xdf89('0x28')];_0x459a32[_0xdf89('0x29')]=_0xdf89('0x2a');_0x459a32[_0xdf89('0x2b')]=_0xdf89('0x2c');_0x459a32[_0xdf89('0x2d')]=0x0;_0x459a32[_0xdf89('0x2e')]=0x1;_0x459a32[_0xdf89('0x2f')]=_0x1a3db8[_0xdf89('0x28')];_0x459a32['queuecallerexitreason']='COMPLETED';return BPromise[_0xdf89('0x11')]()[_0xdf89('0xb')](voiceQueueReport[_0xdf89('0x30')](_0x459a32))['catch'](loggerCatch(_0xdf89('0x31')));};exports['getContactRecallMe']=function(_0x7b34ee,_0x9b1ce6){return BPromise[_0xdf89('0x11')]()[_0xdf89('0xb')](cmHopper[_0xdf89('0x32')](_0x7b34ee,_0x9b1ce6))[_0xdf89('0x9')](loggerCatch(_0xdf89('0x33')));};exports[_0xdf89('0x34')]=function(_0x1f2b3f){return cmHopper['rescheduleContact'](_0x1f2b3f,!![],!![])[_0xdf89('0x9')](loggerCatch(_0xdf89('0x35')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 0a81429..ccb66e6 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 _0x0dc0=['../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','logBlacklist','state','statedesc','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','logLookAgent','membername','getSeconds','talktime','answertime','Failure','RECALL','BOOKED','uniqueid','calleridnum','xcally-motion-preview','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','active','scheduledat','add','ListId','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','status','getDiff','milliseconds','seconds','createBody','CampaignId','idContact','queue','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','UserId','sipcallid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','forEach','toLowerCase','util','moment','preview','env','127.0.0.1'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x0dc0,0x178));var _0x00dc=function(_0xf6aea1,_0x5e4811){_0xf6aea1=_0xf6aea1-0x0;var _0x304a1e=_0x0dc0[_0xf6aea1];return _0x304a1e;};'use strict';var util=require(_0x00dc('0x0'));var _=require('lodash');var moment=require(_0x00dc('0x1'));var logger=require('../../../../config/logger')(_0x00dc('0x2'));var ipAgi=process[_0x00dc('0x3')]['XCALLY_IP_AGI']||_0x00dc('0x4');var utils=require(_0x00dc('0x5'));exports[_0x00dc('0x6')]=function(_0x9e1b41){return function(_0x46aa40){logger[_0x00dc('0x7')](_0x9e1b41,util[_0x00dc('0x8')](_0x46aa40,{'showHidden':![],'depth':null}));};};exports[_0x00dc('0x9')]=function(_0x12f018,_0x256f4c){logger[_0x00dc('0xa')](_0x12f018,util[_0x00dc('0x8')](_0x256f4c,{'showHidden':![],'depth':null}));};exports[_0x00dc('0xb')]=function(_0x346b88,_0x1d074b){logger[_0x00dc('0x7')](_0x346b88,util[_0x00dc('0x8')](_0x1d074b,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x13d7a8){return function(_0x4d331f){logger[_0x00dc('0xa')](_0x13d7a8,util[_0x00dc('0x8')](_0x4d331f,{'showHidden':![],'depth':null}));};};exports[_0x00dc('0xc')]=function(_0x17bdd8,_0x290b1d,_0x3c35e6){return{'message':_0x17bdd8,'unlock':_0x290b1d,'active':_0x3c35e6};};exports[_0x00dc('0xd')]=function(_0x1ba4f8,_0x522613,_0x2d2575){if(!_[_0x00dc('0xe')](_0x2d2575)&&_0x00dc('0xf')===typeof _0x2d2575&&!_[_0x00dc('0x10')](_0x2d2575)){if(!_[_0x00dc('0xe')](_0x522613)&&_0x00dc('0xf')===typeof _0x522613&&!_[_0x00dc('0x10')](_0x522613)){return util[_0x00dc('0x11')](_0x00dc('0x12'),_0x522613,_0x2d2575);}return util['format']('\x22%s\x22\x20<%s>',_0x2d2575,_0x2d2575);}if(!_['isUndefined'](_0x1ba4f8)&&'string'===typeof _0x1ba4f8&&!_[_0x00dc('0x10')](_0x1ba4f8)){return _0x1ba4f8;}return _0x00dc('0x13');};exports[_0x00dc('0x14')]=function(_0x2e9279){if(_[_0x00dc('0x15')](_0x2e9279)){return![];}return _0x2e9279;};exports['addVariables']=function(_0x3a21fe,_0x533e05,_0x4c64da,_0x4337e8,_0x31af72,_0x1daf51){var _0xb828fc={'XMD-QUEUE':_0x533e05['Queue']?_0x533e05['Queue'][_0x00dc('0x16')]:'','XMD-CALLERID':_0x4337e8,'XMD-CALLERID-PREVIEW':_0x1daf51?util[_0x00dc('0x11')](_0x00dc('0x12'),_0x1daf51[_0x00dc('0x17')],_0x1daf51['calleridnum']):_0x4337e8,'XMD-DIALID':_0x31af72,'XMD-CONTACTID':_0x533e05[_0x00dc('0x18')],'XMD-CDRTYPE':_0x00dc('0x19'),'CALLERID(all)':_0x4337e8,'XMD-VOICEQUEUEID':_0x533e05[_0x00dc('0x1a')],'XMD-DIALCHANNEL':_0x4c64da,'XMD-DIALTIMEOUT':_0x3a21fe[_0x00dc('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x3a21fe[_0x00dc('0x1c')]?'g':'',_[_0x00dc('0x10')](_0x3a21fe[_0x00dc('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3a21fe[_0x00dc('0x1e')]||'','XMD-AGI':_0x3a21fe['dialQueueProject']?util[_0x00dc('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3a21fe[_0x00dc('0x1f')]):_0x00dc('0x20'),'XMD-AGIAFTER':_0x3a21fe[_0x00dc('0x1c')]?util[_0x00dc('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3a21fe['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1daf51?_0x1daf51[_0x00dc('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x1daf51?_0x1daf51[_0x00dc('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x00dc('0x23')};if(!_[_0x00dc('0x10')](_0x3a21fe['monitor_format'])){_0xb828fc[util[_0x00dc('0x11')]('%s',_0x00dc('0x24'))]=_0x3a21fe[_0x00dc('0x1d')];_0xb828fc[util[_0x00dc('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x31af72;}return _0xb828fc;};exports[_0x00dc('0x25')]=function(_0x53e3af){var _0x17b5e5={};for(var _0x3f8704 in _0x53e3af){if(_0x53e3af[_0x00dc('0x26')](_0x3f8704)){_0x17b5e5[util['format']('%s',_[_0x00dc('0x27')](_0x3f8704))]=_0x53e3af[_0x3f8704];}}return{'variables':_0x17b5e5};};exports[_0x00dc('0x28')]=function(_0x4702d1){var _0x43ed9e=moment()[_0x00dc('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4702d1[_0x00dc('0x29')]=0xd;_0x4702d1[_0x00dc('0x2a')]=_0x00dc('0x2b');_0x4702d1[_0x00dc('0x2c')]=_0x43ed9e;_0x4702d1['responsetime']=_0x43ed9e;_0x4702d1[_0x00dc('0x2d')]=_0x43ed9e;};exports[_0x00dc('0x2e')]=function(_0x507d4d,_0x1a0233,_0x46ebd9){var _0x1cfe06=moment()[_0x00dc('0x11')](_0x00dc('0x2f'));_0x507d4d['state']=_0x1a0233;_0x507d4d[_0x00dc('0x2a')]=_0x46ebd9;_0x507d4d[_0x00dc('0x30')]=_0x1cfe06;_0x507d4d[_0x00dc('0x31')]=utils['getSeconds'](_0x507d4d[_0x00dc('0x30')],_0x507d4d[_0x00dc('0x2c')]);};exports[_0x00dc('0x32')]=function(_0x2952c8,_0x1dc315,_0x4aae69){_0x2952c8[_0x00dc('0x33')]=_0x1dc315;_0x2952c8['UserId']=_0x4aae69;};exports['logCustomer']=function(_0x313803,_0x46d52b,_0x43e00){var _0x2bde8b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x313803[_0x00dc('0x29')]=_0x46d52b;_0x313803[_0x00dc('0x2a')]=_0x43e00;_0x313803[_0x00dc('0x30')]=_0x313803[_0x00dc('0x30')]?_0x313803['responsetime']:_0x2bde8b;_0x313803[_0x00dc('0x2d')]=_0x313803['endtime']?_0x313803[_0x00dc('0x2d')]:_0x2bde8b;_0x313803[_0x00dc('0x31')]=utils[_0x00dc('0x34')](_0x313803['responsetime']||0x0,_0x313803['starttime']||0x0);_0x313803[_0x00dc('0x35')]=_0x313803['answertime']?utils[_0x00dc('0x34')](_0x313803[_0x00dc('0x2d')],_0x313803[_0x00dc('0x36')]):0x0;};exports['isFailure']=function(_0x3009f4){return _0x3009f4===_0x00dc('0x37');};exports['variablesAction']=function(_0x5a0311,_0xa0fef2,_0x579275,_0x342f3f,_0x5f1e12){var _0x1e6b37=_0x342f3f?_0x00dc('0x38'):_0x5a0311[_0x00dc('0x17')];_0x1e6b37=_0x5f1e12?_0x00dc('0x39'):_0x1e6b37;return{'actionid':_0x5a0311[_0x00dc('0x3a')],'action':'originate','channel':_0x5a0311['channelAgent'],'callerid':util[_0x00dc('0x11')](_0x00dc('0x12'),_0x1e6b37,_0x5a0311[_0x00dc('0x3b')]),'Exten':_0x00dc('0x3c'),'Context':'from-sip','Priority':'1','variable':_0x579275,'timeout':(_0xa0fef2[_0x00dc('0x3d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5a0311[_0x00dc('0x3a')]};};exports[_0x00dc('0x3e')]=function(_0x289b95){return _0x289b95[_0x00dc('0x3f')]+_0x289b95['countcongestionretry']+_0x289b95[_0x00dc('0x40')]+_0x289b95[_0x00dc('0x41')]+_0x289b95['countnosuchnumberretry'];};exports[_0x00dc('0x42')]=function(_0x48e940){var _0x434783=_['clone'](_0x48e940);_0x434783['state']=0xf;_0x434783[_0x00dc('0x2a')]=_0x00dc('0x43');return _0x434783;};exports['scheduledAt']=function(_0x324584,_0x4d1205,_0x3547ff){var _0x5b342b={};_0x5b342b[_0x4d1205]=_0x324584[_0x4d1205];_0x5b342b[_0x00dc('0x44')]=![];_0x5b342b[_0x00dc('0x45')]=moment()[_0x00dc('0x46')](_0x3547ff,'minutes')['format'](_0x00dc('0x2f'));_0x5b342b[_0x00dc('0x18')]=_0x324584['ContactId'];_0x5b342b[_0x00dc('0x47')]=_0x324584[_0x00dc('0x47')];_0x5b342b[_0x00dc('0x1a')]=_0x324584[_0x00dc('0x1a')]||undefined;return _0x5b342b;};exports['decrementTalking']=function(_0x1fc920,_0x22a252){if(!_[_0x00dc('0x15')](_0x1fc920)){if(_0x1fc920['pTalking']>0x0){_0x1fc920[_0x00dc('0x48')]-=0x1;}else{logger[_0x00dc('0xa')](_0x22a252,_0x00dc('0x49'));}}else{logger[_0x00dc('0x7')](_0x22a252,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0x00dc('0x4a')]=function(_0x383e67){if(_0x383e67<=0x0){return!![];}return![];};function buildObj(_0x538fb0,_0x2af773,_0x904645){_0x538fb0['lastevent']=_0x2af773;_0x538fb0[_0x00dc('0x16')]=_0x538fb0['queue'];_0x538fb0[_0x00dc('0x4b')]=_0x538fb0[_0x00dc('0x4c')];_0x538fb0[_0x00dc('0x4d')]=_0x00dc('0x4e');if(_0x904645){_0x538fb0[_0x00dc('0x4f')]=_0x904645['mandatoryDisposition'];}return _0x538fb0;}exports[_0x00dc('0x50')]=buildObj;exports[_0x00dc('0x51')]=function(_0x76d24e){var _0x4c2296=[];for(var _0x475008 in _0x76d24e){if(_0x76d24e['hasOwnProperty'](_0x475008)){if(!_[_0x00dc('0x15')](_0x76d24e[_0x475008])&&_0x76d24e[_0x475008]['state']==='not_inuse'&&_0x76d24e[_0x475008][_0x00dc('0x52')]==='reachable'){_0x4c2296['push'](_0x76d24e[_0x475008]['id']);}}}return _0x4c2296;};exports[_0x00dc('0x53')]=function(_0x315bee){var _0x1569f8=moment()['milliseconds'](0x0);var _0x1fd8e0=moment(_0x315bee)[_0x00dc('0x54')](0x0);return _0x1569f8['diff'](_0x1fd8e0,_0x00dc('0x55'));};exports[_0x00dc('0x56')]=function(_0x1cfca9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1cfca9[_0x00dc('0x18')],'ListId':_0x1cfca9[_0x00dc('0x47')],'VoiceQueueId':_0x1cfca9[_0x00dc('0x1a')]||undefined,'CampaignId':_0x1cfca9[_0x00dc('0x57')]||undefined};};exports['filterKey']=function(_0x2d8def){if(_0x2d8def===_0x00dc('0x3a')||_0x2d8def===_0x00dc('0x58')||_0x2d8def===_0x00dc('0x59')||_0x2d8def===_0x00dc('0x5a')||_0x2d8def===_0x00dc('0x5b')||_0x2d8def==='dialAnswer'||_0x2d8def===_0x00dc('0x33')||_0x2d8def===_0x00dc('0x4c')||_0x2d8def===_0x00dc('0x17')||_0x2d8def===_0x00dc('0x44')||_0x2d8def==='calleridnum'||_0x2d8def==='scheduledat'||_0x2d8def==='countbusyretry'||_0x2d8def==='countcongestionretry'||_0x2d8def==='countnoanswerretry'||_0x2d8def===_0x00dc('0x5c')||_0x2d8def===_0x00dc('0x5d')||_0x2d8def===_0x00dc('0x5e')||_0x2d8def===_0x00dc('0x5f')||_0x2d8def==='recallme'||_0x2d8def===_0x00dc('0x18')||_0x2d8def===_0x00dc('0x47')||_0x2d8def===_0x00dc('0x60')||_0x2d8def===_0x00dc('0x1a')||_0x2d8def===_0x00dc('0x61')||_0x2d8def==='xmd-voicequeueid'||_0x2d8def==='xmd-queue'||_0x2d8def===_0x00dc('0x62')||_0x2d8def===_0x00dc('0x63')||_0x2d8def==='xmd-dialurl'||_0x2d8def===_0x00dc('0x64')||_0x2d8def==='xmd-dialoptions'||_0x2d8def==='xmd-dialid'||_0x2d8def===_0x00dc('0x65')||_0x2d8def===_0x00dc('0x66')||_0x2d8def===_0x00dc('0x67')||_0x2d8def===_0x00dc('0x68')||_0x2d8def==='xmd-agiafter'||_0x2d8def===_0x00dc('0x69')||_0x2d8def==='rtpaudioqos'||_0x2d8def==='rtpaudioqosbridged'||_0x2d8def===_0x00dc('0x6a')||_0x2d8def===_0x00dc('0x6b')||_0x2d8def==='rtpaudioqosloss'||_0x2d8def===_0x00dc('0x6c')||_0x2d8def===_0x00dc('0x6d')||_0x2d8def==='rtpaudioqosrttbridged'||_0x2d8def===_0x00dc('0x6e')||_0x2d8def==='rtpaudioqosbridged'||_0x2d8def===_0x00dc('0x6a')||_0x2d8def===_0x00dc('0x6b')||_0x2d8def===_0x00dc('0x6f')||_0x2d8def==='rtpaudioqoslossbridged'||_0x2d8def===_0x00dc('0x6d')||_0x2d8def===_0x00dc('0x70')||_0x2d8def===_0x00dc('0x71')||_0x2d8def===_0x00dc('0x72')||_0x2d8def===_0x00dc('0x29')||_0x2d8def===_0x00dc('0x2a')){return![];}return!![];};exports[_0x00dc('0x73')]=function(_0x6ab7e0,_0x386e85){var _0x31c063,_0x153372,_0x47bbd8;if(_0x386e85<=0x0){_0x386e85=0x1;}_0x31c063=new RegExp(_0x00dc('0x74')+_0x386e85+'}$');_0x153372=Math[_0x00dc('0x75')](0xa,_0x386e85-0x1);_0x47bbd8=Math[_0x00dc('0x75')](0xa,_0x386e85)-0x1;return util[_0x00dc('0x11')]('%s',_[_0x00dc('0x76')](_0x6ab7e0,_0x31c063,_[_0x00dc('0x77')](_0x153372,_0x47bbd8)));};exports[_0x00dc('0x78')]=function(_0x4abec8){var _0xfec33f=_0x4abec8[_0x00dc('0x79')](/"(.*?)"/);return _0xfec33f?_0xfec33f[0x1]:_0x4abec8;};exports[_0x00dc('0x7a')]=function(_0x271e9d){var _0x1a95e0=_0x271e9d[_0x00dc('0x79')](/<(.*?)>/);return _0x1a95e0?_0x1a95e0[0x1]:_0x271e9d;};function buildNoAnswerEventPayload(_0x2bfb53,_0x5f1454){var _0x5c34f2=buildObj(_0x2bfb53,_0x00dc('0x7b'));if(!_['isEmpty'](_0x5f1454['variables'])){Object[_0x00dc('0x7c')](_0x5f1454['variables'])[_0x00dc('0x7d')](function(_0x39ecf4){_0x5c34f2[_0x39ecf4[_0x00dc('0x7e')]()]=_0x5f1454['variables'][_0x39ecf4];});}return _0x5c34f2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x705e=['ListId','decrementTalking','pTalking','info','[decrementTalking]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','channelAgent','motionChannel','voice','mandatoryDisposition','agentReadyId','hasOwnProperty','not_inuse','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','idContact','type','dialAnswer','membername','countcongestionretry','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','toLowerVariables','toLower','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','ringtime','getSeconds','starttime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','minutes'];(function(_0x151b07,_0x208f7f){var _0x55664a=function(_0x4919a5){while(--_0x4919a5){_0x151b07['push'](_0x151b07['shift']());}};_0x55664a(++_0x208f7f);}(_0x705e,0xc7));var _0xe705=function(_0x567f64,_0x1f0ad4){_0x567f64=_0x567f64-0x0;var _0x409e97=_0x705e[_0x567f64];return _0x409e97;};'use strict';var util=require(_0xe705('0x0'));var _=require(_0xe705('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xe705('0x2'));var ipAgi=process[_0xe705('0x3')][_0xe705('0x4')]||'127.0.0.1';var utils=require(_0xe705('0x5'));exports[_0xe705('0x6')]=function(_0x5f52eb){return function(_0x445cb2){logger[_0xe705('0x7')](_0x5f52eb,util[_0xe705('0x8')](_0x445cb2,{'showHidden':![],'depth':null}));};};exports[_0xe705('0x9')]=function(_0x148d6e,_0x422e5b){logger['info'](_0x148d6e,util[_0xe705('0x8')](_0x422e5b,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4af423,_0x479097){logger[_0xe705('0x7')](_0x4af423,util['inspect'](_0x479097,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2a51fe){return function(_0x2c88da){logger['info'](_0x2a51fe,util[_0xe705('0x8')](_0x2c88da,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x54f60e,_0x1c7b55,_0x49c297){return{'message':_0x54f60e,'unlock':_0x1c7b55,'active':_0x49c297};};exports[_0xe705('0xa')]=function(_0x47d174,_0x1aff91,_0x62dc47){if(!_[_0xe705('0xb')](_0x62dc47)&&_0xe705('0xc')===typeof _0x62dc47&&!_[_0xe705('0xd')](_0x62dc47)){if(!_[_0xe705('0xb')](_0x1aff91)&&_0xe705('0xc')===typeof _0x1aff91&&!_[_0xe705('0xd')](_0x1aff91)){return util[_0xe705('0xe')](_0xe705('0xf'),_0x1aff91,_0x62dc47);}return util[_0xe705('0xe')](_0xe705('0xf'),_0x62dc47,_0x62dc47);}if(!_['isUndefined'](_0x47d174)&&'string'===typeof _0x47d174&&!_[_0xe705('0xd')](_0x47d174)){return _0x47d174;}return _0xe705('0x10');};exports[_0xe705('0x11')]=function(_0x2d1ae0){if(_[_0xe705('0x12')](_0x2d1ae0)){return![];}return _0x2d1ae0;};exports[_0xe705('0x13')]=function(_0x3ad47f,_0x6f7200,_0x3c477b,_0x404685,_0xf590f0,_0x24885d){var _0x5e218e={'XMD-QUEUE':_0x6f7200['Queue']?_0x6f7200[_0xe705('0x14')][_0xe705('0x15')]:'','XMD-CALLERID':_0x404685,'XMD-CALLERID-PREVIEW':_0x24885d?util[_0xe705('0xe')](_0xe705('0xf'),_0x24885d['calleridname'],_0x24885d[_0xe705('0x16')]):_0x404685,'XMD-DIALID':_0xf590f0,'XMD-CONTACTID':_0x6f7200[_0xe705('0x17')],'XMD-CDRTYPE':_0xe705('0x18'),'CALLERID(all)':_0x404685,'XMD-VOICEQUEUEID':_0x6f7200[_0xe705('0x19')],'XMD-DIALCHANNEL':_0x3c477b,'XMD-DIALTIMEOUT':_0x3ad47f['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xe705('0xe')](_0xe705('0x1a'),_0x3ad47f['dialQueueProject2']?'g':'',_['isEmpty'](_0x3ad47f['monitor_format'])?'':_0xe705('0x1b')),'XMD-DIALURL':_0x3ad47f[_0xe705('0x1c')]||'','XMD-AGI':_0x3ad47f['dialQueueProject']?util[_0xe705('0xe')](_0xe705('0x1d'),ipAgi,_0x3ad47f[_0xe705('0x1e')]):_0xe705('0x1f'),'XMD-AGIAFTER':_0x3ad47f['dialQueueProject2']?util['format'](_0xe705('0x1d'),ipAgi,_0x3ad47f['dialQueueProject2']):_0xe705('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x24885d?_0x24885d[_0xe705('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x24885d?_0x24885d['originatecalleridname']:'','XMD-DESTINATION':_0xe705('0x21'),'SIPADDHEADER':_0xe705('0x22')};if(!_[_0xe705('0xd')](_0x3ad47f[_0xe705('0x23')])){_0x5e218e[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3ad47f['monitor_format'];_0x5e218e[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xf590f0;}return _0x5e218e;};exports[_0xe705('0x24')]=function(_0xca4484){var _0x2d68f9={};for(var _0x56311c in _0xca4484){if(_0xca4484['hasOwnProperty'](_0x56311c)){_0x2d68f9[util['format']('%s',_[_0xe705('0x25')](_0x56311c))]=_0xca4484[_0x56311c];}}return{'variables':_0x2d68f9};};exports['logBlacklist']=function(_0x2c6ee4){var _0x5d07da=moment()[_0xe705('0xe')](_0xe705('0x26'));_0x2c6ee4[_0xe705('0x27')]=0xd;_0x2c6ee4[_0xe705('0x28')]=_0xe705('0x29');_0x2c6ee4['starttime']=_0x5d07da;_0x2c6ee4[_0xe705('0x2a')]=_0x5d07da;_0x2c6ee4[_0xe705('0x2b')]=_0x5d07da;};exports['logAgent']=function(_0x119878,_0x36aaa5,_0x31e5aa){var _0x36af42=moment()[_0xe705('0xe')](_0xe705('0x26'));_0x119878[_0xe705('0x27')]=_0x36aaa5;_0x119878[_0xe705('0x28')]=_0x31e5aa;_0x119878[_0xe705('0x2a')]=_0x36af42;_0x119878[_0xe705('0x2c')]=utils[_0xe705('0x2d')](_0x119878[_0xe705('0x2a')],_0x119878[_0xe705('0x2e')]);};exports[_0xe705('0x2f')]=function(_0x41ce3b,_0x3394ad,_0x255089){_0x41ce3b['membername']=_0x3394ad;_0x41ce3b[_0xe705('0x30')]=_0x255089;};exports[_0xe705('0x31')]=function(_0x400abf,_0x481445,_0x1e7b9e){var _0x2f99c5=moment()['format'](_0xe705('0x26'));_0x400abf[_0xe705('0x27')]=_0x481445;_0x400abf[_0xe705('0x28')]=_0x1e7b9e;_0x400abf[_0xe705('0x2a')]=_0x400abf[_0xe705('0x2a')]?_0x400abf['responsetime']:_0x2f99c5;_0x400abf[_0xe705('0x2b')]=_0x400abf['endtime']?_0x400abf['endtime']:_0x2f99c5;_0x400abf[_0xe705('0x2c')]=utils[_0xe705('0x2d')](_0x400abf[_0xe705('0x2a')]||0x0,_0x400abf[_0xe705('0x2e')]||0x0);_0x400abf[_0xe705('0x32')]=_0x400abf[_0xe705('0x33')]?utils[_0xe705('0x2d')](_0x400abf[_0xe705('0x2b')],_0x400abf['answertime']):0x0;};exports[_0xe705('0x34')]=function(_0x24404d){return _0x24404d===_0xe705('0x35');};exports[_0xe705('0x36')]=function(_0x5eab5b,_0x39c252,_0x6b56b,_0x51d7af,_0x26ccce){var _0xb69b5b=_0x51d7af?_0xe705('0x37'):_0x5eab5b[_0xe705('0x38')];_0xb69b5b=_0x26ccce?_0xe705('0x39'):_0xb69b5b;return{'actionid':_0x5eab5b[_0xe705('0x3a')],'action':_0xe705('0x3b'),'channel':_0x5eab5b['channelAgent'],'callerid':util[_0xe705('0xe')](_0xe705('0xf'),_0xb69b5b,_0x5eab5b['calleridnum']),'Exten':_0xe705('0x21'),'Context':'from-sip','Priority':'1','variable':_0x6b56b,'timeout':(_0x39c252['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5eab5b['uniqueid']};};exports[_0xe705('0x3c')]=function(_0x930ce){return _0x930ce[_0xe705('0x3d')]+_0x930ce['countcongestionretry']+_0x930ce[_0xe705('0x3e')]+_0x930ce[_0xe705('0x3f')]+_0x930ce[_0xe705('0x40')];};exports[_0xe705('0x41')]=function(_0x26a8f2){var _0x50f622=_[_0xe705('0x42')](_0x26a8f2);_0x50f622[_0xe705('0x27')]=0xf;_0x50f622['statedesc']='Global';return _0x50f622;};exports[_0xe705('0x43')]=function(_0x22d4f4,_0xace451,_0x56035d){var _0x4da7c1={};_0x4da7c1[_0xace451]=_0x22d4f4[_0xace451];_0x4da7c1[_0xe705('0x44')]=![];_0x4da7c1[_0xe705('0x45')]=moment()['add'](_0x56035d,_0xe705('0x46'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4da7c1[_0xe705('0x17')]=_0x22d4f4[_0xe705('0x17')];_0x4da7c1[_0xe705('0x47')]=_0x22d4f4['ListId'];_0x4da7c1[_0xe705('0x19')]=_0x22d4f4[_0xe705('0x19')]||undefined;return _0x4da7c1;};exports[_0xe705('0x48')]=function(_0x203644,_0x5891d1){if(!_[_0xe705('0x12')](_0x203644)){if(_0x203644[_0xe705('0x49')]>0x0){_0x203644[_0xe705('0x49')]-=0x1;}else{logger[_0xe705('0x4a')](_0x5891d1,_0xe705('0x4b'));}}else{logger[_0xe705('0x7')](_0x5891d1,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0xe705('0x4c')]=function(_0x505216){if(_0x505216<=0x0){return!![];}return![];};function buildObj(_0x3e7e43,_0x30e455,_0x1afed8){_0x3e7e43[_0xe705('0x4d')]=_0x30e455;_0x3e7e43['name']=_0x3e7e43[_0xe705('0x4e')];_0x3e7e43['interface']=_0x3e7e43[_0xe705('0x4f')];_0x3e7e43[_0xe705('0x50')]=_0xe705('0x51');if(_0x1afed8){_0x3e7e43['mandatoryDisposition']=_0x1afed8[_0xe705('0x52')];}return _0x3e7e43;}exports['buildObj']=buildObj;exports[_0xe705('0x53')]=function(_0x502544){var _0x51e14e=[];for(var _0x5d298c in _0x502544){if(_0x502544[_0xe705('0x54')](_0x5d298c)){if(!_['isNil'](_0x502544[_0x5d298c])&&_0x502544[_0x5d298c][_0xe705('0x27')]===_0xe705('0x55')&&_0x502544[_0x5d298c][_0xe705('0x56')]===_0xe705('0x57')){_0x51e14e[_0xe705('0x58')](_0x502544[_0x5d298c]['id']);}}}return _0x51e14e;};exports['getDiff']=function(_0x21d40d){var _0x319188=moment()[_0xe705('0x59')](0x0);var _0x1ffafb=moment(_0x21d40d)[_0xe705('0x59')](0x0);return _0x319188[_0xe705('0x5a')](_0x1ffafb,_0xe705('0x5b'));};exports[_0xe705('0x5c')]=function(_0x83d5fb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x83d5fb[_0xe705('0x17')],'ListId':_0x83d5fb[_0xe705('0x47')],'VoiceQueueId':_0x83d5fb[_0xe705('0x19')]||undefined,'CampaignId':_0x83d5fb[_0xe705('0x5d')]||undefined};};exports['filterKey']=function(_0x12b3d5){if(_0x12b3d5===_0xe705('0x3a')||_0x12b3d5===_0xe705('0x5e')||_0x12b3d5===_0xe705('0x4e')||_0x12b3d5===_0xe705('0x5f')||_0x12b3d5==='campaigntype'||_0x12b3d5===_0xe705('0x60')||_0x12b3d5===_0xe705('0x61')||_0x12b3d5===_0xe705('0x4f')||_0x12b3d5===_0xe705('0x38')||_0x12b3d5===_0xe705('0x44')||_0x12b3d5===_0xe705('0x16')||_0x12b3d5===_0xe705('0x45')||_0x12b3d5===_0xe705('0x3d')||_0x12b3d5===_0xe705('0x62')||_0x12b3d5===_0xe705('0x3e')||_0x12b3d5==='countglobal'||_0x12b3d5===_0xe705('0x63')||_0x12b3d5==='callbackuniqueid'||_0x12b3d5===_0xe705('0x64')||_0x12b3d5===_0xe705('0x65')||_0x12b3d5===_0xe705('0x17')||_0x12b3d5===_0xe705('0x47')||_0x12b3d5===_0xe705('0x30')||_0x12b3d5===_0xe705('0x19')||_0x12b3d5===_0xe705('0x66')||_0x12b3d5===_0xe705('0x67')||_0x12b3d5===_0xe705('0x68')||_0x12b3d5==='xmd-phone'||_0x12b3d5===_0xe705('0x69')||_0x12b3d5===_0xe705('0x6a')||_0x12b3d5===_0xe705('0x6b')||_0x12b3d5===_0xe705('0x6c')||_0x12b3d5===_0xe705('0x6d')||_0x12b3d5===_0xe705('0x6e')||_0x12b3d5==='xmd-contactid'||_0x12b3d5===_0xe705('0x6f')||_0x12b3d5===_0xe705('0x70')||_0x12b3d5===_0xe705('0x71')||_0x12b3d5===_0xe705('0x72')||_0x12b3d5===_0xe705('0x73')||_0x12b3d5===_0xe705('0x74')||_0x12b3d5===_0xe705('0x75')||_0x12b3d5==='rtpaudioqosjitterbridged'||_0x12b3d5==='rtpaudioqosloss'||_0x12b3d5==='rtpaudioqoslossbridged'||_0x12b3d5===_0xe705('0x76')||_0x12b3d5===_0xe705('0x77')||_0x12b3d5===_0xe705('0x73')||_0x12b3d5===_0xe705('0x74')||_0x12b3d5===_0xe705('0x75')||_0x12b3d5==='rtpaudioqosjitterbridged'||_0x12b3d5===_0xe705('0x78')||_0x12b3d5===_0xe705('0x79')||_0x12b3d5==='rtpaudioqosrtt'||_0x12b3d5===_0xe705('0x77')||_0x12b3d5===_0xe705('0x7a')||_0x12b3d5===_0xe705('0x7b')||_0x12b3d5==='state'||_0x12b3d5==='statedesc'){return![];}return!![];};exports[_0xe705('0x7c')]=function(_0x201f9c,_0x3bd002){var _0x1d3c54,_0x344fe0,_0x6cd2a0;if(_0x3bd002<=0x0){_0x3bd002=0x1;}_0x1d3c54=new RegExp('\x5cw{0,'+_0x3bd002+'}$');_0x344fe0=Math[_0xe705('0x7d')](0xa,_0x3bd002-0x1);_0x6cd2a0=Math['pow'](0xa,_0x3bd002)-0x1;return util['format']('%s',_[_0xe705('0x7e')](_0x201f9c,_0x1d3c54,_[_0xe705('0x7f')](_0x344fe0,_0x6cd2a0)));};exports['extractCalleridName']=function(_0x5b0b9f){var _0x72a5e5=_0x5b0b9f[_0xe705('0x80')](/"(.*?)"/);return _0x72a5e5?_0x72a5e5[0x1]:_0x5b0b9f;};exports[_0xe705('0x81')]=function(_0x227822){var _0x3a6f29=_0x227822[_0xe705('0x80')](/<(.*?)>/);return _0x3a6f29?_0x3a6f29[0x1]:_0x227822;};function buildNoAnswerEventPayload(_0x12e8ab,_0xd3ec53){var _0x48ce5c=buildObj(_0x12e8ab,_0xe705('0x82'));if(!_[_0xe705('0xd')](_0xd3ec53[_0xe705('0x83')])){Object[_0xe705('0x84')](_0xd3ec53[_0xe705('0x83')])['forEach'](function(_0x2c3c4e){_0x48ce5c[_0x2c3c4e[_0xe705('0x85')]()]=_0xd3ec53[_0xe705('0x83')][_0x2c3c4e];});}return _0x48ce5c;}exports[_0xe705('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0b04d2d..dc08e1c 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 _0x05b0=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','voicequeuechannel'];(function(_0x562e5f,_0x734a68){var _0x5627a4=function(_0x36bdbb){while(--_0x36bdbb){_0x562e5f['push'](_0x562e5f['shift']());}};_0x5627a4(++_0x734a68);}(_0x05b0,0xfa));var _0x005b=function(_0x2cfb34,_0x481e32){_0x2cfb34=_0x2cfb34-0x0;var _0xc4dd5c=_0x05b0[_0x2cfb34];return _0xc4dd5c;};'use strict';exports[_0x005b('0x0')]={'queue':{'type':_0x005b('0x1'),'required':!![]},'interface':{'type':_0x005b('0x1'),'required':!![]},'membername':{'type':_0x005b('0x1'),'required':!![]},'penalty':{'type':_0x005b('0x2'),'required':![]},'paused':{'type':_0x005b('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x005b('0x1'),'required':!![]},'interface':{'type':_0x005b('0x1'),'required':!![]}};exports[_0x005b('0x4')]={'interface':{'type':_0x005b('0x1'),'required':!![]},'paused':{'type':_0x005b('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x005b('0x1'),'required':![]}};exports[_0x005b('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x005b('0x1')},'format':{'type':_0x005b('0x1')},'mixmonitorid':{'type':_0x005b('0x1')}};exports[_0x005b('0x6')]={'uniqueid':{'type':_0x005b('0x1'),'required':!![]}};exports[_0x005b('0x7')]={'uniqueid':{'type':_0x005b('0x1'),'required':!![]},'exten':{'type':_0x005b('0x1'),'required':!![]},'context':{'type':_0x005b('0x1')}}; \ No newline at end of file +var _0x9165=['number','boolean','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0x9165,0x194));var _0x5916=function(_0x30ec83,_0x31fe48){_0x30ec83=_0x30ec83-0x0;var _0x232efc=_0x9165[_0x30ec83];return _0x232efc;};'use strict';exports[_0x5916('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x5916('0x1'),'required':!![]},'penalty':{'type':_0x5916('0x2'),'required':![]},'paused':{'type':_0x5916('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x5916('0x1'),'required':!![]},'interface':{'type':_0x5916('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x5916('0x1'),'required':!![]},'paused':{'type':_0x5916('0x3')},'reason':{'type':_0x5916('0x1'),'required':![]}};exports[_0x5916('0x4')]={'module':{'type':_0x5916('0x1'),'required':![]}};exports[_0x5916('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x5916('0x1'),'required':!![]},'filename':{'type':_0x5916('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x5916('0x6')]={'uniqueid':{'type':_0x5916('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x5916('0x1'),'required':!![]},'exten':{'type':_0x5916('0x1'),'required':!![]},'context':{'type':_0x5916('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 597c6f7..9c7affb 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0xd39328,_0xc84656){var _0x17aa80=function(_0x28b818){while(--_0x28b818){_0xd39328['push'](_0xd39328['shift']());}};_0x17aa80(++_0xc84656);}(_0x757a,0xde));var _0xa757=function(_0x19ca19,_0x12f4ab){_0x19ca19=_0x19ca19-0x0;var _0x317eb9=_0x757a[_0x19ca19];return _0x317eb9;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x3e759d,_0x44385e){var _0x2ab447=function(_0xb96dec){while(--_0xb96dec){_0x3e759d['push'](_0x3e759d['shift']());}};_0x2ab447(++_0x44385e);}(_0xadb5,0xad));var _0x5adb=function(_0x1db3ac,_0x518abf){_0x1db3ac=_0x1db3ac-0x0;var _0x3262ba=_0xadb5[_0x1db3ac];return _0x3262ba;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index f7c1da8..58b8ae5 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32be=['hasOwnProperty','assign'];(function(_0x2b0074,_0x42d50b){var _0x25b012=function(_0x53d3b9){while(--_0x53d3b9){_0x2b0074['push'](_0x2b0074['shift']());}};_0x25b012(++_0x42d50b);}(_0x32be,0xb9));var _0xe32b=function(_0x5950bd,_0x103e16){_0x5950bd=_0x5950bd-0x0;var _0x33e816=_0x32be[_0x5950bd];return _0x33e816;};'use strict';function mergeDBDataToRealtime(_0x5b4f17,_0x306652){var _0x289a11=Object[_0xe32b('0x0')]({},_0x5b4f17);for(var _0x47a65a in _0x306652){if(_0x289a11[_0xe32b('0x1')](_0x47a65a)){_0x289a11[_0x47a65a]=_0x306652[_0x47a65a];}}return _0x289a11;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x8a50=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x8a50,0x183));var _0x08a5=function(_0x34e67f,_0x124398){_0x34e67f=_0x34e67f-0x0;var _0x1af67c=_0x8a50[_0x34e67f];return _0x1af67c;};'use strict';function mergeDBDataToRealtime(_0x502082,_0x229c06){var _0x59d116=Object[_0x08a5('0x0')]({},_0x502082);for(var _0x2e4773 in _0x229c06){if(_0x59d116[_0x08a5('0x1')](_0x2e4773)){_0x59d116[_0x2e4773]=_0x229c06[_0x2e4773];}}return _0x59d116;}exports[_0x08a5('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 33db2a0..179e29a 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 _0xa5cd=['transfereelinkedid','UserId','membername','create','monitor','monitors','filename','createdAt','connectedlinenum','connectedlinename','xcally-motion-dialer','isArray','startsWith','substring','indexOf','mobile','phone','voiceDialReport','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','blindtransfer','blindTransfer','attendedTransfer','prototype','findAgent','name','isNil','find','accountcode','format','SIP/%s','length','assigned','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','match','keys','getCallType','channel','split','getAgentByInternal','calleridnum','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-sip','calleridpreview','originatecalleridnum','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid'];(function(_0x5840a5,_0x374e6c){var _0x2d3e92=function(_0x96cad4){while(--_0x96cad4){_0x5840a5['push'](_0x5840a5['shift']());}};_0x2d3e92(++_0x374e6c);}(_0xa5cd,0x1cc));var _0xda5c=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xa5cd[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xda5c('0x0'));var moment=require(_0xda5c('0x1'));var util=require('util');var config=require(_0xda5c('0x2'));var ami=require(_0xda5c('0x3'));var RpcVoiceAgentReport=require(_0xda5c('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xda5c('0x5'));var RpcVoiceQueueReport=require(_0xda5c('0x6'));var RpcVoiceRecording=require(_0xda5c('0x7'));var RpcVoiceTransferReport=require(_0xda5c('0x8'));var VoiceQueueReport=require(_0xda5c('0x9'));var VoiceCallReport=require(_0xda5c('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xda5c('0xb'));var UserReport=require(_0xda5c('0xc'));function Report(_0x41660c){this[_0xda5c('0xd')]=_0x41660c;this[_0xda5c('0xe')]=_0x41660c[_0xda5c('0xe')];this[_0xda5c('0xf')]=_0x41660c[_0xda5c('0xf')];}Report['prototype'][_0xda5c('0x10')]=function(_0x2e69a4){var _0x26368c=new VoiceQueueReport(this[_0xda5c('0xd')]);var _0x1777a4=new VoiceAgentReport(this[_0xda5c('0xd')]);var _0x5379dc=new VoiceDialReport(this[_0xda5c('0xd')]);var _0x4eb706=new VoiceCallReport(this[_0xda5c('0xd')]);var _0x277b35=new UserReport(this['realtime']);if(config[_0xda5c('0x11')]&&config[_0xda5c('0x11')][_0xda5c('0x12')]){ami['on'](_0xda5c('0x13'),this[_0xda5c('0x14')][_0xda5c('0x15')](this));ami['on'](_0xda5c('0x16'),this[_0xda5c('0x17')][_0xda5c('0x15')](this));ami['on'](_0xda5c('0x18'),this['voiceAgentReport']['bind'](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0xda5c('0x15')](this));ami['on'](_0xda5c('0x19'),this[_0xda5c('0x1a')]['bind'](this));ami['on']('attendedtransfer',this[_0xda5c('0x1b')][_0xda5c('0x15')](this));}};Report[_0xda5c('0x1c')][_0xda5c('0x1d')]=function(_0x2c96bb){var _0xafca74;_0xafca74=_['find'](this[_0xda5c('0xe')],function(_0x380384){return _0x380384['accountcode']==_0x2c96bb||_0x380384[_0xda5c('0x1e')]==_0x2c96bb;});if(_[_0xda5c('0x1f')](_0xafca74)){var _0x52f30b=_[_0xda5c('0x20')](this[_0xda5c('0xf')],function(_0x42ff46){return _0x42ff46[_0xda5c('0x21')]==_0x2c96bb||_0x42ff46['name']==_0x2c96bb;});if(_0x52f30b){_0xafca74=_[_0xda5c('0x20')](this[_0xda5c('0xe')],function(_0x1b99e8){return _0x1b99e8['interface']==util[_0xda5c('0x22')](_0xda5c('0x23'),_0x52f30b['name']);});}}return _0xafca74;};Report[_0xda5c('0x1c')][_0xda5c('0x14')]=function(_0x52b626){for(var _0x502759=0x0;_0x502759<_0x52b626[_0xda5c('0x24')];_0x502759+=0x1){var _0x3a8fb1=this[_0xda5c('0x1d')](_0x52b626[_0x502759]['connectedlinenum']);if(_0x3a8fb1){_0x52b626[_0x502759][_0xda5c('0x21')]=_0x3a8fb1[_0xda5c('0x21')];_0x52b626[_0x502759][_0xda5c('0x25')]=!![];_0x52b626[_0x502759]['lastAssignedTo']=_0x3a8fb1[_0xda5c('0x1e')];_0x52b626[_0x502759]['interface']=_['isNil'](_0x3a8fb1[_0xda5c('0x26')])?util['format'](_0xda5c('0x23'),_0x3a8fb1[_0xda5c('0x1e')]):_0x3a8fb1[_0xda5c('0x26')];if(_0x52b626[_0x502759][_0xda5c('0x27')]){_0x52b626[_0x502759][_0xda5c('0x28')]=moment()[_0xda5c('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x52b626[_0x502759][_0xda5c('0x29')]){_0x52b626[_0x502759]['queuecallerexitAt']=moment()[_0xda5c('0x22')](_0xda5c('0x2a'));}RpcMemberReport[_0xda5c('0x14')](_0x52b626[_0x502759]);}RpcVoiceQueueReport['create'](_0x52b626[_0x502759]);}};function extractCalleridNumber(_0x3b13ad){var _0x2cf9cc=_0x3b13ad[_0xda5c('0x2b')](/<(.*?)>/);return _0x2cf9cc?_0x2cf9cc[0x1]:_0x3b13ad;}Report[_0xda5c('0x1c')]['getAgentByInternal']=function(_0x1a2075){for(var _0x99c584=0x0;_0x99c584/);return _0x1e0fad?_0x1e0fad[0x1]:_0x439a92;}Report[_0x209f('0xf')][_0x209f('0x2e')]=function(_0x231b41){for(var _0x269ed5=0x0;_0x269ed5',_0x5a832a[_0x209f('0x43')],_0x5a832a[_0x209f('0x31')]);}if(RpcVoiceTransferReport[_0x209f('0x44')][_0x5a832a[_0x209f('0x45')]]){var _0x5ad421=RpcVoiceTransferReport[_0x209f('0x44')][_0x5a832a[_0x209f('0x45')]];_0x5ad421[_0x209f('0x46')]=_0x5a832a[_0x209f('0x47')];RpcVoiceTransferReport[_0x209f('0x1c')](_0x5ad421);delete RpcVoiceTransferReport[_0x209f('0x44')][_0x5a832a[_0x209f('0x45')]];}if(_[_0x209f('0x22')](_0x5a832a['type'])){_0x5a832a[_0x209f('0x35')]=this['getCallType'](_0x5a832a);}if(_[_0x209f('0x22')](_0x5a832a[_0x209f('0x48')])){var _0x522891=_0x5a832a[_0x209f('0x41')][_0x209f('0x49')]('-')[0x0];var _0x15333b=this['agents'][_0x522891];if(!_0x15333b)_0x15333b=this[_0x209f('0x2e')](_0x5a832a['accountcode']);if(_0x15333b){_0x5a832a[_0x209f('0x48')]=_0x15333b['id'];_0x5a832a['membername']=_0x15333b['name'];}}RpcVoiceCallReport['create'](_0x5a832a);if(_0x5a832a[_0x209f('0x4a')]){for(var _0x6f18e1=0x0;_0x6f18e1<_0x5a832a[_0x209f('0x4b')][_0x209f('0x27')];_0x6f18e1+=0x1){_0x5a832a['monitorFilename']=_0x5a832a[_0x209f('0x4b')][_0x6f18e1]['filename'];_0x5a832a[_0x209f('0x4c')]=_0x5a832a[_0x209f('0x4b')][_0x6f18e1][_0x209f('0x4c')];if(_0x5a832a[_0x209f('0x34')]==_0x209f('0x3d')){_0x5a832a['calleridnum']=_0x5a832a['connectedlinenum'];_0x5a832a[_0x209f('0x43')]=_0x5a832a[_0x209f('0x4d')];_0x5a832a[_0x209f('0x28')]=_0x5a832a['accountcode'];_0x5a832a[_0x209f('0x4d')]=_0x5a832a[_0x209f('0x4e')];_0x5a832a[_0x209f('0x34')]=_0x5a832a['originatecalleridnum'];}else if(_0x5a832a[_0x209f('0x34')]==_0x209f('0x4f')){_0x5a832a[_0x209f('0x31')]=_0x5a832a['destination'];_0x5a832a[_0x209f('0x34')]=_0x5a832a[_0x209f('0x3f')];}RpcVoiceRecording[_0x209f('0x2d')](_0x5a832a);}}};Report['prototype'][_0x209f('0x19')]=function(_0x3d77df){if(_[_0x209f('0x50')](_0x3d77df)){_0x3d77df['forEach'](function(_0x3488dc){RpcVoiceAgentReport[_0x209f('0x2d')](_0x3488dc);});}else{RpcVoiceAgentReport[_0x209f('0x2d')](_0x3d77df);}};Report[_0x209f('0xf')][_0x209f('0x51')]=function(_0x22c6e8){RpcVoiceDialReport[_0x209f('0x2d')](_0x22c6e8);var _0x5dd7c0;var _0x2ddf18;var _0x2fedf4=_0x22c6e8[_0x209f('0x41')];if(_[_0x209f('0x52')](_0x2fedf4,_0x209f('0x53'))){_0x2ddf18=_0x2fedf4[_0x209f('0x54')](_0x2fedf4['indexOf']('/')+0x1,_0x2fedf4[_0x209f('0x55')]('@'));_0x5dd7c0=_[_0x209f('0x20')](this[_0x209f('0xd')],function(_0x1eef81){return _0x1eef81[_0x209f('0x56')]==_0x2ddf18||_0x1eef81[_0x209f('0x57')]==_0x2ddf18||_0x1eef81[_0x209f('0x23')]==_0x2ddf18;});}else{_0x2ddf18=_0x2fedf4['substring'](_0x2fedf4[_0x209f('0x55')]('/')+0x1,_0x2fedf4['lastIndexOf']('-'));_0x5dd7c0=this[_0x209f('0x1f')](_0x2ddf18);}if(_0x5dd7c0){_0x22c6e8[_0x209f('0x24')]=_[_0x209f('0x22')](_0x5dd7c0[_0x209f('0x24')])?util[_0x209f('0x25')](_0x209f('0x26'),_0x5dd7c0[_0x209f('0x21')]):_0x5dd7c0[_0x209f('0x24')];_0x22c6e8[_0x209f('0x4e')]=_0x5dd7c0[_0x209f('0x21')];_0x22c6e8['accountcode']=_0x5dd7c0['accountcode'];RpcMemberReport['voiceDialReport'](_0x22c6e8);}};Report[_0x209f('0xf')][_0x209f('0x1c')]=function(_0x42a3ab){RpcVoiceTransferReport[_0x209f('0x44')][_0x42a3ab[_0x209f('0x58')]]=_0x42a3ab;};Report[_0x209f('0xf')][_0x209f('0x1e')]=function(_0x4c2d10){RpcVoiceTransferReport[_0x209f('0x1e')](_0x4c2d10);};module[_0x209f('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 226368a..c33ada4 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b3b=['local','inuse','toLowerCase','stateTime','toNumber','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','[userReport][peerstatus]','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','registry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','prototype','emit','username','debug','[userReport][registry]','find','stateRegistry','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','isNotNull','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]'];(function(_0x30db62,_0x2dde8c){var _0xd7f568=function(_0x139fd0){while(--_0x139fd0){_0x30db62['push'](_0x30db62['shift']());}};_0xd7f568(++_0x2dde8c);}(_0x7b3b,0xba));var _0xb7b3=function(_0x381916,_0x5a8b5f){_0x381916=_0x381916-0x0;var _0x1a5993=_0x7b3b[_0x381916];return _0x1a5993;};'use strict';var _=require(_0xb7b3('0x0'));var moment=require('moment');var util=require(_0xb7b3('0x1'));var Redis=require(_0xb7b3('0x2'));var BPromise=require(_0xb7b3('0x3'));var config=require(_0xb7b3('0x4'));var logger=require('../../../config/logger')(_0xb7b3('0x5'));var ami=require(_0xb7b3('0x6'));config[_0xb7b3('0x7')]=_[_0xb7b3('0x8')](config[_0xb7b3('0x7')],{'host':_0xb7b3('0x9'),'port':0x18eb});var io=require(_0xb7b3('0xa'))(new Redis(config['redis']));function UserReport(_0x443218){this[_0xb7b3('0xb')]=_0x443218[_0xb7b3('0xb')];this['agents']=_0x443218[_0xb7b3('0xc')];this[_0xb7b3('0xd')]=_0x443218[_0xb7b3('0xd')];ami['on'](_0xb7b3('0xe'),this['syncRegistry']['bind'](this));ami['on'](_0xb7b3('0xf'),this[_0xb7b3('0x10')][_0xb7b3('0x11')](this));ami['on'](_0xb7b3('0x12'),this[_0xb7b3('0x13')]['bind'](this));ami['on'](_0xb7b3('0x14'),this[_0xb7b3('0x15')]['bind'](this));return this[_0xb7b3('0x16')]();}function showSipRegistrations(){Promise[_0xb7b3('0x17')]()[_0xb7b3('0x18')](ami[_0xb7b3('0x19')]())[_0xb7b3('0x1a')](function(_0x1d447f){logger['error'](_0xb7b3('0x1b'),util[_0xb7b3('0x1c')](_0x1d447f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xb7b3('0x18')](ami[_0xb7b3('0x1d')]())[_0xb7b3('0x1a')](function(_0x32cce8){logger[_0xb7b3('0x1e')](_0xb7b3('0x1f'),util[_0xb7b3('0x1c')](_0x32cce8,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb7b3('0x17')]()['then'](ami[_0xb7b3('0x20')]())[_0xb7b3('0x1a')](function(_0x580d5f){logger[_0xb7b3('0x1e')]('[userReport][sippeerstatus]',util[_0xb7b3('0x1c')](_0x580d5f,{'showHidden':![],'depth':null}));});}UserReport[_0xb7b3('0x21')][_0xb7b3('0x16')]=function(){setInterval(function(){BPromise[_0xb7b3('0x17')]()[_0xb7b3('0x18')](showSipRegistrations())[_0xb7b3('0x18')](listDeviceStates())[_0xb7b3('0x18')](showPeersStatus());},0x32c8);};UserReport[_0xb7b3('0x21')]['isNotNull']=function(_0x3f4545){return _0x3f4545!==null&&!_['isUndefined'](_0x3f4545);};UserReport['prototype'][_0xb7b3('0x22')]=function(_0x1b8629,_0x329caf,_0x347d7a){io['to'](_0x1b8629)[_0xb7b3('0x22')](_0x329caf,_0x347d7a);};UserReport[_0xb7b3('0x21')][_0xb7b3('0x10')]=function(_0x392dcc){try{if(this['isNotNull'](_0x392dcc)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0x392dcc[_0xb7b3('0x23')],_0x392dcc['state']);logger[_0xb7b3('0x24')](_0xb7b3('0x25'),util[_0xb7b3('0x1c')](_0x392dcc,{'showHidden':![],'depth':null}));var _0x3c57bd=_[_0xb7b3('0x26')](this[_0xb7b3('0xb')],{'defaultuser':_0x392dcc['username']});if(_0x3c57bd){_0x392dcc[_0xb7b3('0x27')]=_0x392dcc[_0xb7b3('0x28')];_[_0xb7b3('0x29')](_0x3c57bd,_[_0xb7b3('0x2a')](_0x392dcc,[_0xb7b3('0x2b'),_0xb7b3('0x2c'),'username','state']));logger[_0xb7b3('0x24')](_0xb7b3('0x2d'),util[_0xb7b3('0x1c')](_0x3c57bd,{'showHidden':![],'depth':null}));this[_0xb7b3('0x22')](util[_0xb7b3('0x2e')](_0xb7b3('0x2f'),_0x3c57bd[_0xb7b3('0x30')]),'trunk:save',_0x3c57bd);}}}catch(_0x5bf27c){logger['error'](_0xb7b3('0x25'),util[_0xb7b3('0x1c')](_0x5bf27c,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xb7b3('0x13')]=function(_0x583a2d){try{if(this[_0xb7b3('0x31')](_0x583a2d)){logger[_0xb7b3('0x32')](_0xb7b3('0x33'),_0x583a2d[_0xb7b3('0x34')],_0x583a2d[_0xb7b3('0x28')]);logger[_0xb7b3('0x24')](_0xb7b3('0x35'),util[_0xb7b3('0x1c')](_0x583a2d,{'showHidden':![],'depth':null}));if(this[_0xb7b3('0xc')][_0x583a2d[_0xb7b3('0x34')]]){if(!this['agents'][_0x583a2d[_0xb7b3('0x34')]][_0xb7b3('0x36')]||_0x583a2d[_0xb7b3('0x28')]['toLowerCase']()==_0xb7b3('0x37')){this[_0xb7b3('0xc')][_0x583a2d['device']]['local']=![];if(this[_0xb7b3('0xc')][_0x583a2d['device']][_0xb7b3('0x28')]!==_0x583a2d[_0xb7b3('0x28')]['toLowerCase']()){this[_0xb7b3('0xc')][_0x583a2d['device']]['stateTime']=_['toNumber'](moment()[_0xb7b3('0x2e')]('x'));}this[_0xb7b3('0xc')][_0x583a2d[_0xb7b3('0x34')]][_0xb7b3('0x28')]=_0x583a2d[_0xb7b3('0x28')][_0xb7b3('0x38')]();this[_0xb7b3('0xc')][_0x583a2d[_0xb7b3('0x34')]]['updateStatusRealtime'](_0x583a2d);}}else if(this[_0xb7b3('0xd')][_0x583a2d[_0xb7b3('0x34')]]){if(this[_0xb7b3('0xd')][_0x583a2d[_0xb7b3('0x34')]][_0xb7b3('0x28')]!==_0x583a2d[_0xb7b3('0x28')][_0xb7b3('0x38')]()){this[_0xb7b3('0xd')][_0x583a2d[_0xb7b3('0x34')]][_0xb7b3('0x39')]=_[_0xb7b3('0x3a')](moment()[_0xb7b3('0x2e')]('x'));}this[_0xb7b3('0xd')][_0x583a2d[_0xb7b3('0x34')]]['state']=_0x583a2d[_0xb7b3('0x28')][_0xb7b3('0x38')]();logger[_0xb7b3('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0xb7b3('0xd')][_0x583a2d[_0xb7b3('0x34')]],{'showHidden':![],'depth':null}));this[_0xb7b3('0x22')](util[_0xb7b3('0x2e')](_0xb7b3('0x3b'),this[_0xb7b3('0xd')][_0x583a2d[_0xb7b3('0x34')]][_0xb7b3('0x30')]),_0xb7b3('0x3c'),this['telephones'][_0x583a2d[_0xb7b3('0x34')]]);}else if(this[_0xb7b3('0xb')][_0x583a2d[_0xb7b3('0x34')]]){if(this[_0xb7b3('0xb')][_0x583a2d[_0xb7b3('0x34')]][_0xb7b3('0x28')]!==_0x583a2d['state'][_0xb7b3('0x38')]()){this['trunks'][_0x583a2d[_0xb7b3('0x34')]]['stateTime']=_[_0xb7b3('0x3a')](moment()['format']('x'));}this[_0xb7b3('0xb')][_0x583a2d[_0xb7b3('0x34')]][_0xb7b3('0x28')]=_0x583a2d[_0xb7b3('0x28')]['toLowerCase']();logger[_0xb7b3('0x24')](_0xb7b3('0x3d'),util['inspect'](this[_0xb7b3('0xb')][_0x583a2d['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xb7b3('0x2f'),this['trunks'][_0x583a2d[_0xb7b3('0x34')]]['name']),_0xb7b3('0x3e'),this[_0xb7b3('0xb')][_0x583a2d['device']]);}else if(_[_0xb7b3('0x3f')](_0x583a2d[_0xb7b3('0x34')],_0xb7b3('0x40'))){var _0x1db9d5=_0x583a2d[_0xb7b3('0x34')];var _0x4386cf=_0x1db9d5[_0xb7b3('0x41')](_0x1db9d5[_0xb7b3('0x42')]('/')+0x1,_0x1db9d5['indexOf']('@'));var _0x59e854=_[_0xb7b3('0x26')](this[_0xb7b3('0xc')],function(_0x133e04){return _0x133e04[_0xb7b3('0x43')]==_0x4386cf||_0x133e04[_0xb7b3('0x44')]==_0x4386cf||_0x133e04[_0xb7b3('0x45')]==_0x4386cf;});if(_0x59e854){if(_0x59e854[_0xb7b3('0x28')]!==_0x583a2d[_0xb7b3('0x28')][_0xb7b3('0x38')]()){_0x59e854[_0xb7b3('0x39')]=_['toNumber'](moment()[_0xb7b3('0x2e')]('x'));}_0x59e854[_0xb7b3('0x28')]=_0x583a2d[_0xb7b3('0x28')][_0xb7b3('0x38')]();_0x59e854[_0xb7b3('0x36')]=!![];_0x59e854[_0xb7b3('0x46')](_0x583a2d);}}}}catch(_0x260b3c){logger[_0xb7b3('0x1e')](_0xb7b3('0x35'),util['inspect'](_0x260b3c,{'showHidden':![],'depth':null}));}};UserReport[_0xb7b3('0x21')][_0xb7b3('0x15')]=function(_0x4a53f5){try{if(this[_0xb7b3('0x31')](_0x4a53f5)&&this[_0xb7b3('0x31')](_0x4a53f5[_0xb7b3('0x14')])){logger[_0xb7b3('0x32')](_0xb7b3('0x47'),_0x4a53f5['peer'],_0x4a53f5['address'],_0x4a53f5[_0xb7b3('0x14')]);logger[_0xb7b3('0x24')](_0xb7b3('0x48'),util[_0xb7b3('0x1c')](_0x4a53f5,{'showHidden':![],'depth':null}));if(this['agents'][_0x4a53f5[_0xb7b3('0x49')]]){if(!this[_0xb7b3('0xc')][_0x4a53f5[_0xb7b3('0x49')]][_0xb7b3('0x36')]||_0x4a53f5[_0xb7b3('0x14')][_0xb7b3('0x38')]()==_0xb7b3('0x4a')){this[_0xb7b3('0xc')][_0x4a53f5[_0xb7b3('0x49')]][_0xb7b3('0x36')]=![];this['agents'][_0x4a53f5[_0xb7b3('0x49')]][_0xb7b3('0x4b')]=_0x4a53f5[_0xb7b3('0x14')][_0xb7b3('0x38')]();this[_0xb7b3('0xc')][_0x4a53f5[_0xb7b3('0x49')]][_0xb7b3('0x4c')]=_0x4a53f5[_0xb7b3('0x4c')];this['agents'][_0x4a53f5['peer']]['updateStatusRealtime'](_0x4a53f5);}}else if(this[_0xb7b3('0xd')][_0x4a53f5[_0xb7b3('0x49')]]){this[_0xb7b3('0xd')][_0x4a53f5[_0xb7b3('0x49')]][_0xb7b3('0x4b')]=_0x4a53f5[_0xb7b3('0x14')][_0xb7b3('0x38')]();this['telephones'][_0x4a53f5[_0xb7b3('0x49')]][_0xb7b3('0x4c')]=_0x4a53f5['address'];logger[_0xb7b3('0x24')](_0xb7b3('0x4d'),util['inspect'](this[_0xb7b3('0xd')][_0x4a53f5['peer']],{'showHidden':![],'depth':null}));this[_0xb7b3('0x22')](util['format'](_0xb7b3('0x3b'),this[_0xb7b3('0xd')][_0x4a53f5[_0xb7b3('0x49')]]['name']),_0xb7b3('0x3c'),this[_0xb7b3('0xd')][_0x4a53f5[_0xb7b3('0x49')]]);}else if(this[_0xb7b3('0xb')][_0x4a53f5[_0xb7b3('0x49')]]){this[_0xb7b3('0xb')][_0x4a53f5['peer']][_0xb7b3('0x4b')]=_0x4a53f5['peerstatus']['toLowerCase']();this[_0xb7b3('0xb')][_0x4a53f5['peer']][_0xb7b3('0x4c')]=_0x4a53f5[_0xb7b3('0x4c')];logger[_0xb7b3('0x24')](_0xb7b3('0x4e'),util[_0xb7b3('0x1c')](this[_0xb7b3('0xb')][_0x4a53f5[_0xb7b3('0x49')]],{'showHidden':![],'depth':null}));this[_0xb7b3('0x22')](util[_0xb7b3('0x2e')]('trunk:%s',this[_0xb7b3('0xb')][_0x4a53f5['peer']][_0xb7b3('0x30')]),_0xb7b3('0x3e'),this[_0xb7b3('0xb')][_0x4a53f5[_0xb7b3('0x49')]]);}}}catch(_0x30b079){logger[_0xb7b3('0x1e')]('[userReport][peerstatus]',util[_0xb7b3('0x1c')](_0x30b079,{'showHidden':![],'depth':null}));}};module[_0xb7b3('0x4f')]=UserReport; \ No newline at end of file +var _0x7919=['telephone:save','toNumber','trunk:save','startsWith','Local','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','[userReport][peerstatus]','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','localhost','socket.io-emitter','redis','trunks','agents','telephones','registryentry','syncRegistry','registry','devicestatechange','syncDeviceState','bind','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','stateRegistry','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','stateTime','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s'];(function(_0x4d1be0,_0x1fe3a4){var _0x119a3d=function(_0x36ca02){while(--_0x36ca02){_0x4d1be0['push'](_0x4d1be0['shift']());}};_0x119a3d(++_0x1fe3a4);}(_0x7919,0x1ed));var _0x9791=function(_0x31c13b,_0x5cb710){_0x31c13b=_0x31c13b-0x0;var _0x377e3b=_0x7919[_0x31c13b];return _0x377e3b;};'use strict';var _=require(_0x9791('0x0'));var moment=require(_0x9791('0x1'));var util=require(_0x9791('0x2'));var Redis=require(_0x9791('0x3'));var BPromise=require('bluebird');var config=require(_0x9791('0x4'));var logger=require(_0x9791('0x5'))(_0x9791('0x6'));var ami=require(_0x9791('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x9791('0x8'),'port':0x18eb});var io=require(_0x9791('0x9'))(new Redis(config[_0x9791('0xa')]));function UserReport(_0x3bc2f1){this[_0x9791('0xb')]=_0x3bc2f1[_0x9791('0xb')];this[_0x9791('0xc')]=_0x3bc2f1[_0x9791('0xc')];this[_0x9791('0xd')]=_0x3bc2f1[_0x9791('0xd')];ami['on'](_0x9791('0xe'),this[_0x9791('0xf')]['bind'](this));ami['on'](_0x9791('0x10'),this[_0x9791('0xf')]['bind'](this));ami['on'](_0x9791('0x11'),this[_0x9791('0x12')][_0x9791('0x13')](this));ami['on'](_0x9791('0x14'),this[_0x9791('0x15')][_0x9791('0x13')](this));return this[_0x9791('0x16')]();}function showSipRegistrations(){Promise[_0x9791('0x17')]()[_0x9791('0x18')](ami[_0x9791('0x19')]())[_0x9791('0x1a')](function(_0x178ed1){logger[_0x9791('0x1b')](_0x9791('0x1c'),util[_0x9791('0x1d')](_0x178ed1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x9791('0x18')](ami[_0x9791('0x1e')]())[_0x9791('0x1a')](function(_0x1f0b61){logger[_0x9791('0x1b')](_0x9791('0x1f'),util['inspect'](_0x1f0b61,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9791('0x17')]()[_0x9791('0x18')](ami['actionSipPeerStatus']())[_0x9791('0x1a')](function(_0x5a63cd){logger[_0x9791('0x1b')](_0x9791('0x20'),util[_0x9791('0x1d')](_0x5a63cd,{'showHidden':![],'depth':null}));});}UserReport[_0x9791('0x21')][_0x9791('0x16')]=function(){setInterval(function(){BPromise[_0x9791('0x17')]()[_0x9791('0x18')](showSipRegistrations())[_0x9791('0x18')](listDeviceStates())[_0x9791('0x18')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x9791('0x22')]=function(_0x13ee01){return _0x13ee01!==null&&!_[_0x9791('0x23')](_0x13ee01);};UserReport[_0x9791('0x21')][_0x9791('0x24')]=function(_0x147f69,_0x198723,_0x488a30){io['to'](_0x147f69)[_0x9791('0x24')](_0x198723,_0x488a30);};UserReport[_0x9791('0x21')][_0x9791('0xf')]=function(_0x66c29e){try{if(this[_0x9791('0x22')](_0x66c29e)){logger[_0x9791('0x25')](_0x9791('0x26'),_0x66c29e[_0x9791('0x27')],_0x66c29e['state']);logger[_0x9791('0x28')](_0x9791('0x29'),util[_0x9791('0x1d')](_0x66c29e,{'showHidden':![],'depth':null}));var _0x33e2bd=_['find'](this['trunks'],{'defaultuser':_0x66c29e[_0x9791('0x27')]});if(_0x33e2bd){_0x66c29e[_0x9791('0x2a')]=_0x66c29e[_0x9791('0x2b')];_[_0x9791('0x2c')](_0x33e2bd,_[_0x9791('0x2d')](_0x66c29e,[_0x9791('0x2e'),_0x9791('0x2f'),_0x9791('0x27'),_0x9791('0x2b')]));logger['debug'](_0x9791('0x30'),util[_0x9791('0x1d')](_0x33e2bd,{'showHidden':![],'depth':null}));this[_0x9791('0x24')](util[_0x9791('0x31')]('trunk:%s',_0x33e2bd[_0x9791('0x32')]),'trunk:save',_0x33e2bd);}}}catch(_0x44685c){logger['error'](_0x9791('0x29'),util[_0x9791('0x1d')](_0x44685c,{'showHidden':![],'depth':null}));}};UserReport[_0x9791('0x21')][_0x9791('0x12')]=function(_0x19154d){try{if(this[_0x9791('0x22')](_0x19154d)){logger['info'](_0x9791('0x33'),_0x19154d['device'],_0x19154d[_0x9791('0x2b')]);logger[_0x9791('0x28')](_0x9791('0x34'),util['inspect'](_0x19154d,{'showHidden':![],'depth':null}));if(this['agents'][_0x19154d[_0x9791('0x35')]]){if(!this[_0x9791('0xc')][_0x19154d[_0x9791('0x35')]][_0x9791('0x36')]||_0x19154d[_0x9791('0x2b')][_0x9791('0x37')]()=='inuse'){this[_0x9791('0xc')][_0x19154d[_0x9791('0x35')]][_0x9791('0x36')]=![];if(this[_0x9791('0xc')][_0x19154d[_0x9791('0x35')]][_0x9791('0x2b')]!==_0x19154d[_0x9791('0x2b')][_0x9791('0x37')]()){this['agents'][_0x19154d[_0x9791('0x35')]][_0x9791('0x38')]=_['toNumber'](moment()[_0x9791('0x31')]('x'));}this['agents'][_0x19154d[_0x9791('0x35')]][_0x9791('0x2b')]=_0x19154d[_0x9791('0x2b')][_0x9791('0x37')]();this[_0x9791('0xc')][_0x19154d['device']][_0x9791('0x39')](_0x19154d);}}else if(this[_0x9791('0xd')][_0x19154d[_0x9791('0x35')]]){if(this[_0x9791('0xd')][_0x19154d['device']][_0x9791('0x2b')]!==_0x19154d[_0x9791('0x2b')][_0x9791('0x37')]()){this[_0x9791('0xd')][_0x19154d['device']][_0x9791('0x38')]=_['toNumber'](moment()[_0x9791('0x31')]('x'));}this[_0x9791('0xd')][_0x19154d['device']][_0x9791('0x2b')]=_0x19154d[_0x9791('0x2b')][_0x9791('0x37')]();logger['debug'](_0x9791('0x3a'),util[_0x9791('0x1d')](this[_0x9791('0xd')][_0x19154d[_0x9791('0x35')]],{'showHidden':![],'depth':null}));this[_0x9791('0x24')](util[_0x9791('0x31')](_0x9791('0x3b'),this[_0x9791('0xd')][_0x19154d[_0x9791('0x35')]][_0x9791('0x32')]),_0x9791('0x3c'),this[_0x9791('0xd')][_0x19154d[_0x9791('0x35')]]);}else if(this['trunks'][_0x19154d['device']]){if(this[_0x9791('0xb')][_0x19154d['device']][_0x9791('0x2b')]!==_0x19154d[_0x9791('0x2b')]['toLowerCase']()){this[_0x9791('0xb')][_0x19154d[_0x9791('0x35')]][_0x9791('0x38')]=_[_0x9791('0x3d')](moment()[_0x9791('0x31')]('x'));}this[_0x9791('0xb')][_0x19154d[_0x9791('0x35')]]['state']=_0x19154d[_0x9791('0x2b')][_0x9791('0x37')]();logger[_0x9791('0x28')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x9791('0x1d')](this['trunks'][_0x19154d[_0x9791('0x35')]],{'showHidden':![],'depth':null}));this[_0x9791('0x24')](util[_0x9791('0x31')]('trunk:%s',this[_0x9791('0xb')][_0x19154d['device']][_0x9791('0x32')]),_0x9791('0x3e'),this[_0x9791('0xb')][_0x19154d[_0x9791('0x35')]]);}else if(_[_0x9791('0x3f')](_0x19154d[_0x9791('0x35')],_0x9791('0x40'))){var _0x1c1338=_0x19154d[_0x9791('0x35')];var _0x384286=_0x1c1338['substring'](_0x1c1338[_0x9791('0x41')]('/')+0x1,_0x1c1338[_0x9791('0x41')]('@'));var _0x2086c8=_['find'](this[_0x9791('0xc')],function(_0x22d7e0){return _0x22d7e0[_0x9791('0x42')]==_0x384286||_0x22d7e0[_0x9791('0x43')]==_0x384286||_0x22d7e0[_0x9791('0x44')]==_0x384286;});if(_0x2086c8){if(_0x2086c8[_0x9791('0x2b')]!==_0x19154d[_0x9791('0x2b')][_0x9791('0x37')]()){_0x2086c8[_0x9791('0x38')]=_[_0x9791('0x3d')](moment()['format']('x'));}_0x2086c8[_0x9791('0x2b')]=_0x19154d[_0x9791('0x2b')][_0x9791('0x37')]();_0x2086c8[_0x9791('0x36')]=!![];_0x2086c8[_0x9791('0x39')](_0x19154d);}}}}catch(_0x105e81){logger[_0x9791('0x1b')](_0x9791('0x34'),util[_0x9791('0x1d')](_0x105e81,{'showHidden':![],'depth':null}));}};UserReport[_0x9791('0x21')][_0x9791('0x15')]=function(_0xf7b8a1){try{if(this[_0x9791('0x22')](_0xf7b8a1)&&this[_0x9791('0x22')](_0xf7b8a1['peerstatus'])){logger[_0x9791('0x25')](_0x9791('0x45'),_0xf7b8a1['peer'],_0xf7b8a1['address'],_0xf7b8a1[_0x9791('0x14')]);logger['debug'](_0x9791('0x46'),util['inspect'](_0xf7b8a1,{'showHidden':![],'depth':null}));if(this['agents'][_0xf7b8a1[_0x9791('0x47')]]){if(!this[_0x9791('0xc')][_0xf7b8a1[_0x9791('0x47')]]['local']||_0xf7b8a1[_0x9791('0x14')][_0x9791('0x37')]()==_0x9791('0x48')){this[_0x9791('0xc')][_0xf7b8a1[_0x9791('0x47')]]['local']=![];this[_0x9791('0xc')][_0xf7b8a1[_0x9791('0x47')]][_0x9791('0x49')]=_0xf7b8a1[_0x9791('0x14')][_0x9791('0x37')]();this['agents'][_0xf7b8a1[_0x9791('0x47')]][_0x9791('0x4a')]=_0xf7b8a1[_0x9791('0x4a')];this[_0x9791('0xc')][_0xf7b8a1['peer']][_0x9791('0x39')](_0xf7b8a1);}}else if(this['telephones'][_0xf7b8a1['peer']]){this[_0x9791('0xd')][_0xf7b8a1['peer']][_0x9791('0x49')]=_0xf7b8a1[_0x9791('0x14')][_0x9791('0x37')]();this[_0x9791('0xd')][_0xf7b8a1[_0x9791('0x47')]][_0x9791('0x4a')]=_0xf7b8a1[_0x9791('0x4a')];logger[_0x9791('0x28')](_0x9791('0x4b'),util[_0x9791('0x1d')](this[_0x9791('0xd')][_0xf7b8a1['peer']],{'showHidden':![],'depth':null}));this[_0x9791('0x24')](util['format'](_0x9791('0x3b'),this[_0x9791('0xd')][_0xf7b8a1[_0x9791('0x47')]]['name']),_0x9791('0x3c'),this[_0x9791('0xd')][_0xf7b8a1[_0x9791('0x47')]]);}else if(this[_0x9791('0xb')][_0xf7b8a1[_0x9791('0x47')]]){this[_0x9791('0xb')][_0xf7b8a1['peer']][_0x9791('0x49')]=_0xf7b8a1[_0x9791('0x14')]['toLowerCase']();this[_0x9791('0xb')][_0xf7b8a1[_0x9791('0x47')]][_0x9791('0x4a')]=_0xf7b8a1[_0x9791('0x4a')];logger[_0x9791('0x28')](_0x9791('0x4c'),util[_0x9791('0x1d')](this[_0x9791('0xb')][_0xf7b8a1[_0x9791('0x47')]],{'showHidden':![],'depth':null}));this[_0x9791('0x24')](util['format'](_0x9791('0x4d'),this[_0x9791('0xb')][_0xf7b8a1[_0x9791('0x47')]]['name']),_0x9791('0x3e'),this[_0x9791('0xb')][_0xf7b8a1['peer']]);}}}catch(_0x40581f){logger['error'](_0x9791('0x46'),util[_0x9791('0x1d')](_0x40581f,{'showHidden':![],'depth':null}));}};module[_0x9791('0x4e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 0250028..e75f475 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac41=['[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','deleteChannelAfterTimeout','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','bind','agentringnoanswer','queuecallerabandon','varset','syncVarSet','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','isUndefined','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','voice','assign','event','privilege','inspect','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','error','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','merge','destconnectedlinenum','name','accountcode','custom:agentconnect','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:'];(function(_0x403738,_0x21f15d){var _0x3cbe9a=function(_0x175e6a){while(--_0x175e6a){_0x403738['push'](_0x403738['shift']());}};_0x3cbe9a(++_0x21f15d);}(_0xac41,0xdd));var _0x1ac4=function(_0x2eae0e,_0x3df171){_0x2eae0e=_0x2eae0e-0x0;var _0x54d33a=_0xac41[_0x2eae0e];return _0x54d33a;};'use strict';var _=require(_0x1ac4('0x0'));var moment=require(_0x1ac4('0x1'));var util=require(_0x1ac4('0x2'));var Redis=require(_0x1ac4('0x3'));var config=require(_0x1ac4('0x4'));var logger=require(_0x1ac4('0x5'))(_0x1ac4('0x6'));var ami=require(_0x1ac4('0x7'));config['redis']=_[_0x1ac4('0x8')](config[_0x1ac4('0x9')],{'host':_0x1ac4('0xa'),'port':0x18eb});var io=require(_0x1ac4('0xb'))(new Redis(config[_0x1ac4('0x9')]));function VoiceAgentReport(_0x2ad173){this[_0x1ac4('0xc')]={};this[_0x1ac4('0xd')]=_0x2ad173[_0x1ac4('0xc')];this[_0x1ac4('0xe')]=_0x2ad173[_0x1ac4('0xe')];this[_0x1ac4('0xf')]=_0x2ad173[_0x1ac4('0xf')];this[_0x1ac4('0x10')]={};ami['on'](_0x1ac4('0x11'),this[_0x1ac4('0x12')]['bind'](this));ami['on'](_0x1ac4('0x13'),this['syncAgentConnect'][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x15'),this['syncAgentRingNoAnswer'][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x16'),this['syncQueueCallerAbandon'][_0x1ac4('0x14')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x1ac4('0x17'),this[_0x1ac4('0x18')][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x19'),this[_0x1ac4('0x1a')][_0x1ac4('0x14')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x1b'),this[_0x1ac4('0x1c')]['bind'](this));ami['on'](_0x1ac4('0x1d'),this[_0x1ac4('0x1e')][_0x1ac4('0x14')](this));ami['on'](_0x1ac4('0x1f'),this[_0x1ac4('0x20')][_0x1ac4('0x14')](this));}VoiceAgentReport[_0x1ac4('0x21')]['emit']=function(_0x535891,_0x9c8678,_0x1dc9b3){io['to'](_0x535891)[_0x1ac4('0x22')](_0x9c8678,_0x1dc9b3);};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x23')]=function(_0x5c7c4a){return _0x5c7c4a!==null&&!_['isUndefined'](_0x5c7c4a);};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x12')]=function(_0x479110){try{if(this[_0x1ac4('0x23')](_0x479110)){logger[_0x1ac4('0x24')](_0x1ac4('0x25'),_0x479110[_0x1ac4('0x26')],_0x479110['membername'],_0x479110[_0x1ac4('0x27')]);logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x479110[_0x1ac4('0x26')],util['inspect'](_0x479110,{'showHidden':![],'depth':null}));if(_[_0x1ac4('0x29')](this[_0x1ac4('0xc')][_0x479110[_0x1ac4('0x26')]])){this[_0x1ac4('0xc')][_0x479110['uniqueid']]={};}var _0x1ddf22=this['agents'][_0x479110[_0x1ac4('0x2a')]];var _0x2163f9=this[_0x1ac4('0xc')][_0x479110[_0x1ac4('0x26')]][_0x479110[_0x1ac4('0x27')]];var _0x13a85d=this[_0x1ac4('0xe')][_0x479110[_0x1ac4('0x2b')]];var _0x21a10e=this[_0x1ac4('0x10')][_0x479110[_0x1ac4('0x26')]];if(_[_0x1ac4('0x29')](_0x2163f9)){_0x2163f9={'agentcalledAt':moment()[_0x1ac4('0x2c')](_0x1ac4('0x2d')),'lastevent':_0x1ac4('0x2e'),'mandatoryDisposition':_0x13a85d&&_0x13a85d[_0x1ac4('0x2f')]?_0x13a85d[_0x1ac4('0x2f')]:![],'type':_0x13a85d&&_0x13a85d['type']?_0x13a85d['type']:'inbound','variables':_0x21a10e,'motionChannel':_0x1ac4('0x30')};}Object[_0x1ac4('0x31')](_0x2163f9,_['omit'](_0x479110,[_0x1ac4('0x32'),_0x1ac4('0x33')]));this[_0x1ac4('0xc')][_0x479110['uniqueid']][_0x479110[_0x1ac4('0x27')]]=_0x2163f9;logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x479110[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x2163f9,{'showHidden':![],'depth':null}));ami[_0x1ac4('0x22')]('custom:agentcalled',_0x2163f9);var _0xd8ed1b={'id':_0x1ddf22['id'],'calleridnum':_0x2163f9[_0x1ac4('0x35')],'queue':_0x2163f9[_0x1ac4('0x2b')],'variables':_0x2163f9[_0x1ac4('0x10')],'uniqueid':_0x479110[_0x1ac4('0x26')]};logger['debug'](_0x1ac4('0x36'),_0x479110[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0xd8ed1b,{'showHidden':![],'depth':null}));this[_0x1ac4('0x22')](util[_0x1ac4('0x2c')](_0x1ac4('0x37'),_0x479110[_0x1ac4('0x38')]),'user:called',_0xd8ed1b);}}catch(_0x302f2e){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][agentcalled]',_0x479110[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x302f2e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1ac4('0x3a')]=function(_0x2709e7){try{if(this[_0x1ac4('0x23')](_0x2709e7)){if(this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]]){for(var _0x3d8694 in this[_0x1ac4('0xc')][_0x2709e7['uniqueid']]){if(this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x1ac4('0x3b')](_0x3d8694)){if(_0x2709e7[_0x1ac4('0x27')]===_0x3d8694){logger[_0x1ac4('0x24')](_0x1ac4('0x3c'),_0x2709e7[_0x1ac4('0x26')],_0x2709e7['membername'],_0x2709e7['destuniqueid']);this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694]['agentconnectAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x3d')]=_0x2709e7[_0x1ac4('0x3d')];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x3e')]=_0x2709e7[_0x1ac4('0x3e')];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x3f')]=_0x2709e7[_0x1ac4('0x3f')];this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x3d8694][_0x1ac4('0x40')]=_0x2709e7[_0x1ac4('0x40')];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x41')]=_0x2709e7['holdtime'];this['channels'][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x42')]='connect';_[_0x1ac4('0x43')](this['agents'][_0x2709e7[_0x1ac4('0x2a')]],_['pick'](_0x2709e7,[_0x1ac4('0x2b'),_0x1ac4('0x44')]));var _0x2758a9=this[_0x1ac4('0xf')][_0x2709e7[_0x1ac4('0x2a')]];var _0x39adae={'id':_0x2758a9['id'],'name':_0x2758a9[_0x1ac4('0x45')],'agentconnected':!![],'destaccountcode':_0x2758a9[_0x1ac4('0x46')],'destconnectedlinenum':this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x2709e7[_0x1ac4('0x27')]]['exten'],'queue':this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x2709e7[_0x1ac4('0x27')]][_0x1ac4('0x2b')],'uniqueid':this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x2709e7[_0x1ac4('0x27')]]['uniqueid']};ami['emit'](_0x1ac4('0x47'),this['channels'][_0x2709e7[_0x1ac4('0x26')]][_0x2709e7[_0x1ac4('0x27')]]);this[_0x1ac4('0x22')](util['format'](_0x1ac4('0x37'),_0x2709e7[_0x1ac4('0x38')]),_0x1ac4('0x48'),_0x39adae);}else if(!this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x15')]&&!this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x3d8694][_0x1ac4('0x49')]){logger['info'](_0x1ac4('0x4a'),_0x2709e7[_0x1ac4('0x26')],this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x38')],_0x3d8694);this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x15')]=!![];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694]['agentringnoanswerAt']=moment()['format'](_0x1ac4('0x2d'));this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x4b')]=_0x2709e7['destuniqueid'];this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694][_0x1ac4('0x4c')]=_0x2709e7['membername'];this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x3d8694][_0x1ac4('0x42')]=_0x1ac4('0x4d');this[_0x1ac4('0xc')][_0x2709e7['uniqueid']][_0x3d8694][_0x1ac4('0x4e')]='answered_elsewhere';logger['debug'](_0x1ac4('0x4f'),_0x2709e7['uniqueid'],util[_0x1ac4('0x34')](this[_0x1ac4('0xc')][_0x2709e7[_0x1ac4('0x26')]][_0x3d8694],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this['channels'][_0x2709e7['uniqueid']][_0x3d8694]);}else{logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x2709e7[_0x1ac4('0x26')]);}}}}}}catch(_0x2e88b1){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][agentconnect]',_0x2709e7[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x2e88b1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x50')]=function(_0x3bd1f2){try{if(this['isNotNull'](_0x3bd1f2)){logger[_0x1ac4('0x28')](_0x1ac4('0x51'),_0x3bd1f2['uniqueid'],util[_0x1ac4('0x34')](_0x3bd1f2,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x3bd1f2[_0x1ac4('0x26')]]&&this[_0x1ac4('0xc')][_0x3bd1f2[_0x1ac4('0x26')]][_0x3bd1f2[_0x1ac4('0x27')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x3bd1f2[_0x1ac4('0x26')],_0x3bd1f2[_0x1ac4('0x38')],_0x3bd1f2[_0x1ac4('0x27')]);var _0x362ed7=this[_0x1ac4('0xf')][_0x3bd1f2[_0x1ac4('0x2a')]];var _0xffd8e0=this[_0x1ac4('0xc')][_0x3bd1f2[_0x1ac4('0x26')]][_0x3bd1f2[_0x1ac4('0x27')]];_0xffd8e0[_0x1ac4('0x15')]=!![];_0xffd8e0[_0x1ac4('0x52')]=moment()[_0x1ac4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0xffd8e0['lastevent']=_0x1ac4('0x53');_0xffd8e0[_0x1ac4('0x4e')]=_0x1ac4('0x53');var _0x210523={'id':_0x362ed7['id'],'name':_0x362ed7[_0x1ac4('0x45')],'queue':_0xffd8e0[_0x1ac4('0x2b')],'uniqueid':_0xffd8e0['uniqueid']};logger['debug'](_0x1ac4('0x54'),_0x3bd1f2[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x210523,{'showHidden':![],'depth':null}));this[_0x1ac4('0x22')](util[_0x1ac4('0x2c')](_0x1ac4('0x37'),_0x362ed7[_0x1ac4('0x45')]),'user:agentringnoanswer',_0x210523);ami[_0x1ac4('0x22')]('custom:agentringnoanswer',_0xffd8e0);this['channels'][_0x3bd1f2[_0x1ac4('0x26')]][_0x3bd1f2[_0x1ac4('0x27')]]=Object[_0x1ac4('0x31')]({},_0xffd8e0);}}}catch(_0x37210b){logger[_0x1ac4('0x39')](_0x1ac4('0x55'),_0x3bd1f2[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x37210b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x56')]=function(_0x42a81f){try{if(this[_0x1ac4('0x23')](_0x42a81f)){logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x42a81f[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x42a81f,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]]){for(var _0xf76dac in this[_0x1ac4('0xc')][_0x42a81f['uniqueid']]){if(this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0x1ac4('0x3b')](_0xf76dac)&&!this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x15')]&&!this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x49')]){logger[_0x1ac4('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x42a81f[_0x1ac4('0x26')],this['channels'][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x38')],_0xf76dac);this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac]['agentringnoanswer']=!![];this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x52')]=moment()[_0x1ac4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ac4('0xc')][_0x42a81f['uniqueid']][_0xf76dac][_0x1ac4('0x42')]=_0x1ac4('0x57');this['channels'][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac][_0x1ac4('0x4e')]='abandoned';logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x42a81f['uniqueid'],util[_0x1ac4('0x34')](this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac],{'showHidden':![],'depth':null}));ami[_0x1ac4('0x22')](_0x1ac4('0x58'),this[_0x1ac4('0xc')][_0x42a81f[_0x1ac4('0x26')]][_0xf76dac]);}}}}}catch(_0x4b5f12){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][queuecallerabandon]',_0x42a81f[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x4b5f12,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')]['syncAgentComplete']=function(_0x28887d){try{if(this[_0x1ac4('0x23')](_0x28887d)){logger[_0x1ac4('0x28')](_0x1ac4('0x59'),_0x28887d[_0x1ac4('0x26')],util['inspect'](_0x28887d,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]]){for(var _0x26dd62 in this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]]){if(this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x1ac4('0x3b')](_0x26dd62)){if(this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]['agentconnectAt']&&!this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62][_0x1ac4('0x49')]){logger[_0x1ac4('0x24')](_0x1ac4('0x5a'),_0x28887d[_0x1ac4('0x26')],this['channels'][_0x28887d['uniqueid']][_0x26dd62][_0x1ac4('0x38')],_0x26dd62);this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]['agentcomplete']=!![];this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62][_0x1ac4('0x5b')]=moment()[_0x1ac4('0x2c')](_0x1ac4('0x2d'));this['channels'][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]['lastevent']=_0x1ac4('0x5c');this[_0x1ac4('0xc')][_0x28887d['uniqueid']][_0x26dd62][_0x1ac4('0x4e')]=_0x28887d[_0x1ac4('0x4e')]==_0x1ac4('0x5d')?'agent':_0x28887d['reason'];this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]['talktime']=_0x28887d[_0x1ac4('0x5e')];if(this[_0x1ac4('0xe')][_0x28887d[_0x1ac4('0x2b')]]&&this[_0x1ac4('0xe')][_0x28887d[_0x1ac4('0x2b')]][_0x1ac4('0x5f')]){this[_0x1ac4('0xc')][_0x28887d['uniqueid']][_0x26dd62]['acwtime']=this['voiceQueues'][_0x28887d[_0x1ac4('0x2b')]][_0x1ac4('0x60')];this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62][_0x1ac4('0x61')]=!![];}this[_0x1ac4('0xf')][_0x28887d[_0x1ac4('0x2a')]]=_['omit'](this['agents'][_0x28887d['interface']],[_0x1ac4('0x2b'),_0x1ac4('0x44')]);logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x28887d[_0x1ac4('0x26')],util[_0x1ac4('0x34')](this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62],{'showHidden':![],'depth':null}));ami['emit'](_0x1ac4('0x62'),this[_0x1ac4('0xc')][_0x28887d[_0x1ac4('0x26')]][_0x26dd62]);logger['debug'](_0x1ac4('0x63'),_0x28887d[_0x1ac4('0x26')],util[_0x1ac4('0x34')]({'id':this[_0x1ac4('0xf')][_0x28887d[_0x1ac4('0x2a')]]['id'],'destaccountcode':_0x28887d[_0x1ac4('0x64')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1ac4('0x2c')](_0x1ac4('0x37'),_0x28887d[_0x1ac4('0x38')]),_0x1ac4('0x65'),{'id':this[_0x1ac4('0xf')][_0x28887d[_0x1ac4('0x2a')]]['id'],'destaccountcode':Number(_0x28887d[_0x1ac4('0x64')])});}}}}}}catch(_0x4ccb4e){logger[_0x1ac4('0x39')](_0x1ac4('0x66'),_0x28887d[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x4ccb4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1ac4('0x18')]=function(_0x11d8bf){try{if(this[_0x1ac4('0x23')](_0x11d8bf)){logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][varset]\x20event:',_0x11d8bf[_0x1ac4('0x26')],util['inspect'](_0x11d8bf,{'showHidden':![],'depth':null}));this[_0x1ac4('0x67')](_0x11d8bf[_0x1ac4('0x26')],_['keys'](_0x11d8bf[_0x1ac4('0x68')])[0x0],_0x11d8bf[_0x1ac4('0x69')]);if(this[_0x1ac4('0xc')][_0x11d8bf[_0x1ac4('0x26')]]){for(var _0x53a19b in this[_0x1ac4('0xc')][_0x11d8bf[_0x1ac4('0x26')]]){if(this[_0x1ac4('0xc')][_0x11d8bf['uniqueid']]['hasOwnProperty'](_0x53a19b)){logger[_0x1ac4('0x24')](_0x1ac4('0x6a'),_0x11d8bf[_0x1ac4('0x26')],_0x53a19b,_[_0x1ac4('0x6b')](_0x11d8bf[_0x1ac4('0x68')])[0x0],_0x11d8bf[_0x1ac4('0x69')]);if(_[_0x1ac4('0x29')](this[_0x1ac4('0xc')][_0x11d8bf['uniqueid']][_0x53a19b][_0x1ac4('0x10')])){this['channels'][_0x11d8bf['uniqueid']][_0x53a19b][_0x1ac4('0x10')]={};}this['channels'][_0x11d8bf[_0x1ac4('0x26')]][_0x53a19b][_0x1ac4('0x10')]=this[_0x1ac4('0x10')][_0x11d8bf['uniqueid']];}}}}}catch(_0x385351){logger['error'](_0x1ac4('0x6c'),_0x11d8bf[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x385351,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x67')]=function(_0xf10760,_0x5835fd,_0x544e17){var _0x239e65=[_0x1ac4('0x6d'),_0x1ac4('0x6e'),_0x1ac4('0x6f'),_0x1ac4('0x70'),'rtpaudioqosloss',_0x1ac4('0x71'),_0x1ac4('0x72'),_0x1ac4('0x73'),_0x1ac4('0x74'),'sipuri',_0x1ac4('0x75'),_0x1ac4('0x76'),_0x1ac4('0x77'),_0x1ac4('0x78'),_0x1ac4('0x79'),_0x1ac4('0x7a'),'membername',_0x1ac4('0x7b'),_0x1ac4('0x7c')];if(!_[_0x1ac4('0x7d')](_0x5835fd)&&!_[_0x1ac4('0x7e')](_0x239e65,_0x5835fd)){if(_['isUndefined'](this[_0x1ac4('0x10')][_0xf10760])){this['variables'][_0xf10760]={};}this[_0x1ac4('0x10')][_0xf10760][_0x5835fd]=_0x544e17;}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x1a')]=function(_0x259f79){try{if(this[_0x1ac4('0x23')](_0x259f79)){logger[_0x1ac4('0x28')](_0x1ac4('0x7f'),_0x259f79[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x259f79,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]]){for(var _0x8301e in this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]]){if(this['channels'][_0x259f79[_0x1ac4('0x26')]][_0x1ac4('0x3b')](_0x8301e)){if(this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]][_0x8301e][_0x1ac4('0x4e')]==_0x1ac4('0x5d')&&this['channels'][_0x259f79[_0x1ac4('0x26')]][_0x8301e][_0x1ac4('0x49')]){logger[_0x1ac4('0x24')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x259f79[_0x1ac4('0x26')],_0x8301e);this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]][_0x8301e]['agentcompleteAt']=moment()[_0x1ac4('0x2c')](_0x1ac4('0x2d'));}}}logger['debug'](_0x1ac4('0x80'),_0x259f79[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_[_0x1ac4('0x81')](this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x1ac4('0x22')](_0x1ac4('0x82'),_['values'](this[_0x1ac4('0xc')][_0x259f79[_0x1ac4('0x26')]]));this['deleteChannelAfterTimeout'](_0x259f79['uniqueid']);}if(this[_0x1ac4('0x10')][_0x259f79['uniqueid']]){delete this['variables'][_0x259f79['uniqueid']];}}}catch(_0xdf1b52){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][hangup]',_0x259f79[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0xdf1b52,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1ac4('0x1e')]=function(_0x20279e){try{if(this[_0x1ac4('0x23')](_0x20279e)){logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x20279e[_0x1ac4('0x26')],util['inspect'](_0x20279e,{'showHidden':![],'depth':null}));if(this['channels'][_0x20279e[_0x1ac4('0x83')]]){for(var _0x365482 in this['channels'][_0x20279e[_0x1ac4('0x83')]]){if(this[_0x1ac4('0xc')][_0x20279e['transfereeuniqueid']][_0x1ac4('0x3b')](_0x365482)){if(_0x20279e[_0x1ac4('0x84')]===_0x365482){logger['info'](_0x1ac4('0x85'),_0x20279e[_0x1ac4('0x26')],this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]][_0x365482][_0x1ac4('0x38')],_0x365482);var _0x16fc9c=moment();this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]][_0x365482][_0x1ac4('0x49')]=!![];this[_0x1ac4('0xc')][_0x20279e['transfereeuniqueid']][_0x365482][_0x1ac4('0x5b')]=moment()[_0x1ac4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]][_0x365482][_0x1ac4('0x42')]=_0x1ac4('0x5c');this['channels'][_0x20279e['transfereeuniqueid']][_0x365482][_0x1ac4('0x4e')]='transfer';this[_0x1ac4('0xc')][_0x20279e['transfereeuniqueid']][_0x365482][_0x1ac4('0x5e')]=_0x16fc9c[_0x1ac4('0x86')](this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]][_0x365482]['agentconnectAt'],_0x1ac4('0x87'));}}}}if(this[_0x1ac4('0xc')][_0x20279e['secondtransfereruniqueid']]){var _0x576c16=this[_0x1ac4('0xc')][_0x20279e['secondtransfereruniqueid']];this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x88')]]=this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]];this[_0x1ac4('0xc')][_0x20279e[_0x1ac4('0x83')]]=_0x576c16;}}}catch(_0x4e3a91){logger[_0x1ac4('0x39')](_0x1ac4('0x89'),_0x20279e[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x4e3a91,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x221448){try{if(this[_0x1ac4('0x23')](_0x221448)){logger[_0x1ac4('0x28')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x221448['uniqueid'],util[_0x1ac4('0x34')](_0x221448,{'showHidden':![],'depth':null}));if(this[_0x1ac4('0xc')][_0x221448['transfereeuniqueid']]){for(var _0x475a0f in this['channels'][_0x221448[_0x1ac4('0x83')]]){if(this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]]['hasOwnProperty'](_0x475a0f)){if(_0x221448[_0x1ac4('0x8a')]===_0x475a0f){logger[_0x1ac4('0x24')](_0x1ac4('0x8b'),_0x221448['uniqueid'],this[_0x1ac4('0xc')][_0x221448['transfereeuniqueid']][_0x475a0f][_0x1ac4('0x38')],_0x475a0f);var _0x297792=moment();this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f][_0x1ac4('0x49')]=!![];this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f][_0x1ac4('0x5b')]=_0x297792;this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f]['lastevent']=_0x1ac4('0x5c');this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f][_0x1ac4('0x4e')]=_0x1ac4('0x5d');this['channels'][_0x221448[_0x1ac4('0x83')]][_0x475a0f]['talktime']=_0x297792[_0x1ac4('0x86')](this[_0x1ac4('0xc')][_0x221448[_0x1ac4('0x83')]][_0x475a0f]['agentconnectAt'],_0x1ac4('0x87'));}}}}}}catch(_0x3fc8b5){logger[_0x1ac4('0x39')](_0x1ac4('0x8c'),_0x221448['uniqueid'],util[_0x1ac4('0x34')](_0x3fc8b5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x8d')]=function(_0x505c83){var _0x376c26='';try{if(this[_0x1ac4('0x23')](_0x505c83)){logger[_0x1ac4('0x28')](_0x1ac4('0x8e'),_0x505c83[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x505c83,{'showHidden':![],'depth':null}));if(_0x505c83[_0x1ac4('0x8f')]){_0x376c26=_0x505c83['channel'][_0x1ac4('0x90')](0x0,_0x505c83[_0x1ac4('0x8f')]['lastIndexOf']('-'));if(this[_0x1ac4('0xf')][_0x376c26]){logger[_0x1ac4('0x24')](_0x1ac4('0x91'),_0x505c83[_0x1ac4('0x26')],_0x376c26);this[_0x1ac4('0xf')][_0x376c26][_0x1ac4('0x92')]=!![];}}}}catch(_0x498cd2){logger[_0x1ac4('0x39')]('[%s][voiceAgentReport][musiconholdstart]',_0x505c83[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x498cd2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1ac4('0x1c')]=function(_0x420873){var _0x173f52='';try{if(this['isNotNull'](_0x420873)){logger['debug'](_0x1ac4('0x93'),_0x420873[_0x1ac4('0x26')],util[_0x1ac4('0x34')](_0x420873,{'showHidden':![],'depth':null}));if(_0x420873[_0x1ac4('0x8f')]){_0x173f52=_0x420873[_0x1ac4('0x8f')][_0x1ac4('0x90')](0x0,_0x420873[_0x1ac4('0x8f')][_0x1ac4('0x94')]('-'));if(this['agents'][_0x173f52]){logger[_0x1ac4('0x24')](_0x1ac4('0x95'),_0x420873['uniqueid'],_0x173f52);this[_0x1ac4('0xf')][_0x173f52][_0x1ac4('0x92')]=![];}}}}catch(_0x3af1b4){logger[_0x1ac4('0x39')](_0x1ac4('0x96'),_0x420873['uniqueid'],util[_0x1ac4('0x34')](_0x3af1b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1ac4('0x21')][_0x1ac4('0x97')]=function(_0x2fe8ce,_0xb86fb6=0x2710){if(this[_0x1ac4('0xc')][_0x2fe8ce]){setTimeout(()=>{delete this[_0x1ac4('0xc')][_0x2fe8ce];},_0xb86fb6);}};module[_0x1ac4('0x98')]=VoiceAgentReport; \ No newline at end of file +var _0x613e=['rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberlastcall','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','diff','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','deleteChannelAfterTimeout','exports','util','ioredis','../../../config/logger','../ami','redis','localhost','channels','voiceChannels','voiceQueues','agents','variables','agentconnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','queue','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged'];(function(_0x44d555,_0x3503cc){var _0x1c8312=function(_0x503800){while(--_0x503800){_0x44d555['push'](_0x44d555['shift']());}};_0x1c8312(++_0x3503cc);}(_0x613e,0xbb));var _0xe613=function(_0x33f08b,_0x393efb){_0x33f08b=_0x33f08b-0x0;var _0x522686=_0x613e[_0x33f08b];return _0x522686;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xe613('0x0'));var Redis=require(_0xe613('0x1'));var config=require('../../../config/environment');var logger=require(_0xe613('0x2'))('ami');var ami=require(_0xe613('0x3'));config[_0xe613('0x4')]=_['defaults'](config['redis'],{'host':_0xe613('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe613('0x4')]));function VoiceAgentReport(_0x24241e){this[_0xe613('0x6')]={};this[_0xe613('0x7')]=_0x24241e['channels'];this[_0xe613('0x8')]=_0x24241e[_0xe613('0x8')];this['agents']=_0x24241e[_0xe613('0x9')];this[_0xe613('0xa')]={};ami['on']('agentcalled',this['syncAgentCalled']['bind'](this));ami['on'](_0xe613('0xb'),this['syncAgentConnect'][_0xe613('0xc')](this));ami['on'](_0xe613('0xd'),this[_0xe613('0xe')][_0xe613('0xc')](this));ami['on'](_0xe613('0xf'),this[_0xe613('0x10')][_0xe613('0xc')](this));ami['on'](_0xe613('0x11'),this[_0xe613('0x12')][_0xe613('0xc')](this));ami['on'](_0xe613('0x13'),this[_0xe613('0x14')][_0xe613('0xc')](this));ami['on'](_0xe613('0x15'),this['syncHangup']['bind'](this));ami['on'](_0xe613('0x16'),this[_0xe613('0x17')][_0xe613('0xc')](this));ami['on'](_0xe613('0x18'),this[_0xe613('0x19')][_0xe613('0xc')](this));ami['on'](_0xe613('0x1a'),this[_0xe613('0x1b')]['bind'](this));ami['on'](_0xe613('0x1c'),this[_0xe613('0x1d')][_0xe613('0xc')](this));}VoiceAgentReport[_0xe613('0x1e')][_0xe613('0x1f')]=function(_0x2756a8,_0x415530,_0x149d66){io['to'](_0x2756a8)[_0xe613('0x1f')](_0x415530,_0x149d66);};VoiceAgentReport[_0xe613('0x1e')][_0xe613('0x20')]=function(_0x22273f){return _0x22273f!==null&&!_[_0xe613('0x21')](_0x22273f);};VoiceAgentReport['prototype'][_0xe613('0x22')]=function(_0x10d538){try{if(this[_0xe613('0x20')](_0x10d538)){logger[_0xe613('0x23')](_0xe613('0x24'),_0x10d538[_0xe613('0x25')],_0x10d538[_0xe613('0x26')],_0x10d538[_0xe613('0x27')]);logger[_0xe613('0x28')](_0xe613('0x29'),_0x10d538[_0xe613('0x25')],util[_0xe613('0x2a')](_0x10d538,{'showHidden':![],'depth':null}));if(_[_0xe613('0x21')](this['channels'][_0x10d538[_0xe613('0x25')]])){this[_0xe613('0x6')][_0x10d538[_0xe613('0x25')]]={};}var _0xa4b208=this['agents'][_0x10d538['interface']];var _0x11ee75=this['channels'][_0x10d538[_0xe613('0x25')]][_0x10d538[_0xe613('0x27')]];var _0xffd85d=this[_0xe613('0x8')][_0x10d538[_0xe613('0x2b')]];var _0x2cc0eb=this['variables'][_0x10d538[_0xe613('0x25')]];if(_[_0xe613('0x21')](_0x11ee75)){_0x11ee75={'agentcalledAt':moment()['format'](_0xe613('0x2c')),'lastevent':_0xe613('0x2d'),'mandatoryDisposition':_0xffd85d&&_0xffd85d[_0xe613('0x2e')]?_0xffd85d[_0xe613('0x2e')]:![],'type':_0xffd85d&&_0xffd85d[_0xe613('0x2f')]?_0xffd85d[_0xe613('0x2f')]:_0xe613('0x30'),'variables':_0x2cc0eb,'motionChannel':_0xe613('0x31')};}Object[_0xe613('0x32')](_0x11ee75,_[_0xe613('0x33')](_0x10d538,[_0xe613('0x34'),_0xe613('0x35')]));this['channels'][_0x10d538[_0xe613('0x25')]][_0x10d538[_0xe613('0x27')]]=_0x11ee75;logger[_0xe613('0x28')](_0xe613('0x36'),_0x10d538[_0xe613('0x25')],util['inspect'](_0x11ee75,{'showHidden':![],'depth':null}));ami[_0xe613('0x1f')]('custom:agentcalled',_0x11ee75);var _0x1d0cd8={'id':_0xa4b208['id'],'calleridnum':_0x11ee75[_0xe613('0x37')],'queue':_0x11ee75['queue'],'variables':_0x11ee75['variables'],'uniqueid':_0x10d538[_0xe613('0x25')]};logger[_0xe613('0x28')](_0xe613('0x38'),_0x10d538['uniqueid'],util[_0xe613('0x2a')](_0x1d0cd8,{'showHidden':![],'depth':null}));this[_0xe613('0x1f')](util[_0xe613('0x39')](_0xe613('0x3a'),_0x10d538[_0xe613('0x26')]),'user:called',_0x1d0cd8);}}catch(_0x54d0ee){logger[_0xe613('0x3b')](_0xe613('0x3c'),_0x10d538[_0xe613('0x25')],util['inspect'](_0x54d0ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe613('0x3d')]=function(_0x4aa2df){try{if(this[_0xe613('0x20')](_0x4aa2df)){if(this['channels'][_0x4aa2df[_0xe613('0x25')]]){for(var _0x4c905f in this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]]){if(this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0xe613('0x3e')](_0x4c905f)){if(_0x4aa2df[_0xe613('0x27')]===_0x4c905f){logger['info'](_0xe613('0x3f'),_0x4aa2df[_0xe613('0x25')],_0x4aa2df['membername'],_0x4aa2df['destuniqueid']);this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0x40')]=moment()[_0xe613('0x39')](_0xe613('0x2c'));this['channels'][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0x41')]=_0x4aa2df['connectedlinename'];this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0x42')]=_0x4aa2df[_0xe613('0x42')];this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0x43')]=_0x4aa2df[_0xe613('0x43')];this['channels'][_0x4aa2df['uniqueid']][_0x4c905f][_0xe613('0x44')]=_0x4aa2df['destchannelstatedesc'];this['channels'][_0x4aa2df[_0xe613('0x25')]][_0x4c905f]['holdtime']=_0x4aa2df[_0xe613('0x45')];this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0x46')]=_0xe613('0x47');_['merge'](this[_0xe613('0x9')][_0x4aa2df[_0xe613('0x48')]],_[_0xe613('0x49')](_0x4aa2df,[_0xe613('0x2b'),'destconnectedlinenum']));var _0x5105e9=this[_0xe613('0x9')][_0x4aa2df[_0xe613('0x48')]];var _0x4fef44={'id':_0x5105e9['id'],'name':_0x5105e9['name'],'agentconnected':!![],'destaccountcode':_0x5105e9[_0xe613('0x4a')],'destconnectedlinenum':this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4aa2df[_0xe613('0x27')]][_0xe613('0x4b')],'queue':this[_0xe613('0x6')][_0x4aa2df['uniqueid']][_0x4aa2df['destuniqueid']][_0xe613('0x2b')],'uniqueid':this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4aa2df['destuniqueid']][_0xe613('0x25')]};ami['emit'](_0xe613('0x4c'),this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4aa2df[_0xe613('0x27')]]);this[_0xe613('0x1f')](util[_0xe613('0x39')]('user:%s',_0x4aa2df[_0xe613('0x26')]),_0xe613('0x4d'),_0x4fef44);}else if(!this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0xd')]&&!this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f]['agentcomplete']){logger[_0xe613('0x23')](_0xe613('0x4e'),_0x4aa2df[_0xe613('0x25')],this[_0xe613('0x6')][_0x4aa2df['uniqueid']][_0x4c905f][_0xe613('0x26')],_0x4c905f);this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0xd')]=!![];this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0x4f')]=moment()[_0xe613('0x39')](_0xe613('0x2c'));this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f]['answeredelsewheredestinationuniqueid']=_0x4aa2df[_0xe613('0x27')];this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f][_0xe613('0x50')]=_0x4aa2df[_0xe613('0x26')];this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f]['lastevent']='answered_elsewhere';this[_0xe613('0x6')][_0x4aa2df['uniqueid']][_0x4c905f][_0xe613('0x51')]='answered_elsewhere';logger[_0xe613('0x28')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x4aa2df[_0xe613('0x25')],util[_0xe613('0x2a')](this[_0xe613('0x6')][_0x4aa2df[_0xe613('0x25')]][_0x4c905f],{'showHidden':![],'depth':null}));ami['emit'](_0xe613('0x52'),this[_0xe613('0x6')][_0x4aa2df['uniqueid']][_0x4c905f]);}else{logger[_0xe613('0x28')](_0xe613('0x53'),_0x4aa2df[_0xe613('0x25')]);}}}}}}catch(_0x3178a5){logger[_0xe613('0x3b')](_0xe613('0x54'),_0x4aa2df['uniqueid'],util['inspect'](_0x3178a5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe613('0x1e')]['syncAgentRingNoAnswer']=function(_0x106a4d){try{if(this[_0xe613('0x20')](_0x106a4d)){logger[_0xe613('0x28')](_0xe613('0x55'),_0x106a4d[_0xe613('0x25')],util['inspect'](_0x106a4d,{'showHidden':![],'depth':null}));if(this[_0xe613('0x6')][_0x106a4d['uniqueid']]&&this[_0xe613('0x6')][_0x106a4d[_0xe613('0x25')]][_0x106a4d[_0xe613('0x27')]]){logger['info'](_0xe613('0x56'),_0x106a4d['uniqueid'],_0x106a4d['membername'],_0x106a4d[_0xe613('0x27')]);var _0x164406=this['agents'][_0x106a4d[_0xe613('0x48')]];var _0x4c02f1=this[_0xe613('0x6')][_0x106a4d[_0xe613('0x25')]][_0x106a4d[_0xe613('0x27')]];_0x4c02f1[_0xe613('0xd')]=!![];_0x4c02f1['agentringnoanswerAt']=moment()[_0xe613('0x39')](_0xe613('0x2c'));_0x4c02f1['lastevent']=_0xe613('0x57');_0x4c02f1['reason']=_0xe613('0x57');var _0x4937f4={'id':_0x164406['id'],'name':_0x164406['name'],'queue':_0x4c02f1['queue'],'uniqueid':_0x4c02f1['uniqueid']};logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x106a4d[_0xe613('0x25')],util[_0xe613('0x2a')](_0x4937f4,{'showHidden':![],'depth':null}));this[_0xe613('0x1f')](util['format'](_0xe613('0x3a'),_0x164406['name']),_0xe613('0x58'),_0x4937f4);ami[_0xe613('0x1f')](_0xe613('0x59'),_0x4c02f1);this['channels'][_0x106a4d['uniqueid']][_0x106a4d[_0xe613('0x27')]]=Object[_0xe613('0x32')]({},_0x4c02f1);}}}catch(_0x13b5cb){logger[_0xe613('0x3b')]('[%s][voiceAgentReport][agentringnoanswer]',_0x106a4d[_0xe613('0x25')],util['inspect'](_0x13b5cb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe613('0x1e')][_0xe613('0x10')]=function(_0x105e12){try{if(this[_0xe613('0x20')](_0x105e12)){logger['debug'](_0xe613('0x5a'),_0x105e12[_0xe613('0x25')],util[_0xe613('0x2a')](_0x105e12,{'showHidden':![],'depth':null}));if(this[_0xe613('0x6')][_0x105e12[_0xe613('0x25')]]){for(var _0x4e6ea0 in this[_0xe613('0x6')][_0x105e12[_0xe613('0x25')]]){if(this[_0xe613('0x6')][_0x105e12[_0xe613('0x25')]][_0xe613('0x3e')](_0x4e6ea0)&&!this['channels'][_0x105e12[_0xe613('0x25')]][_0x4e6ea0]['agentringnoanswer']&&!this['channels'][_0x105e12[_0xe613('0x25')]][_0x4e6ea0][_0xe613('0x11')]){logger[_0xe613('0x23')](_0xe613('0x5b'),_0x105e12[_0xe613('0x25')],this[_0xe613('0x6')][_0x105e12['uniqueid']][_0x4e6ea0][_0xe613('0x26')],_0x4e6ea0);this['channels'][_0x105e12[_0xe613('0x25')]][_0x4e6ea0][_0xe613('0xd')]=!![];this[_0xe613('0x6')][_0x105e12[_0xe613('0x25')]][_0x4e6ea0][_0xe613('0x4f')]=moment()[_0xe613('0x39')](_0xe613('0x2c'));this[_0xe613('0x6')][_0x105e12[_0xe613('0x25')]][_0x4e6ea0][_0xe613('0x46')]=_0xe613('0x5c');this[_0xe613('0x6')][_0x105e12['uniqueid']][_0x4e6ea0][_0xe613('0x51')]=_0xe613('0x5c');logger[_0xe613('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x105e12['uniqueid'],util[_0xe613('0x2a')](this['channels'][_0x105e12[_0xe613('0x25')]][_0x4e6ea0],{'showHidden':![],'depth':null}));ami['emit'](_0xe613('0x5d'),this['channels'][_0x105e12[_0xe613('0x25')]][_0x4e6ea0]);}}}}}catch(_0x4f8908){logger[_0xe613('0x3b')]('[%s][voiceAgentReport][queuecallerabandon]',_0x105e12[_0xe613('0x25')],util[_0xe613('0x2a')](_0x4f8908,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe613('0x1e')][_0xe613('0x12')]=function(_0x5b3576){try{if(this[_0xe613('0x20')](_0x5b3576)){logger[_0xe613('0x28')](_0xe613('0x5e'),_0x5b3576['uniqueid'],util[_0xe613('0x2a')](_0x5b3576,{'showHidden':![],'depth':null}));if(this[_0xe613('0x6')][_0x5b3576[_0xe613('0x25')]]){for(var _0x44a2b in this[_0xe613('0x6')][_0x5b3576[_0xe613('0x25')]]){if(this[_0xe613('0x6')][_0x5b3576[_0xe613('0x25')]][_0xe613('0x3e')](_0x44a2b)){if(this[_0xe613('0x6')][_0x5b3576['uniqueid']][_0x44a2b][_0xe613('0x40')]&&!this[_0xe613('0x6')][_0x5b3576[_0xe613('0x25')]][_0x44a2b][_0xe613('0x11')]){logger[_0xe613('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5b3576[_0xe613('0x25')],this[_0xe613('0x6')][_0x5b3576['uniqueid']][_0x44a2b][_0xe613('0x26')],_0x44a2b);this['channels'][_0x5b3576[_0xe613('0x25')]][_0x44a2b][_0xe613('0x11')]=!![];this[_0xe613('0x6')][_0x5b3576[_0xe613('0x25')]][_0x44a2b][_0xe613('0x5f')]=moment()[_0xe613('0x39')](_0xe613('0x2c'));this['channels'][_0x5b3576[_0xe613('0x25')]][_0x44a2b][_0xe613('0x46')]=_0xe613('0x60');this[_0xe613('0x6')][_0x5b3576[_0xe613('0x25')]][_0x44a2b][_0xe613('0x51')]=_0x5b3576[_0xe613('0x51')]==_0xe613('0x61')?_0xe613('0x62'):_0x5b3576[_0xe613('0x51')];this[_0xe613('0x6')][_0x5b3576['uniqueid']][_0x44a2b][_0xe613('0x63')]=_0x5b3576['talktime'];if(this[_0xe613('0x8')][_0x5b3576[_0xe613('0x2b')]]&&this[_0xe613('0x8')][_0x5b3576[_0xe613('0x2b')]][_0xe613('0x64')]){this[_0xe613('0x6')][_0x5b3576['uniqueid']][_0x44a2b][_0xe613('0x65')]=this[_0xe613('0x8')][_0x5b3576[_0xe613('0x2b')]][_0xe613('0x66')];this[_0xe613('0x6')][_0x5b3576[_0xe613('0x25')]][_0x44a2b]['agentacw']=!![];}this['agents'][_0x5b3576['interface']]=_[_0xe613('0x33')](this[_0xe613('0x9')][_0x5b3576[_0xe613('0x48')]],['queue',_0xe613('0x67')]);logger[_0xe613('0x28')](_0xe613('0x68'),_0x5b3576[_0xe613('0x25')],util['inspect'](this['channels'][_0x5b3576['uniqueid']][_0x44a2b],{'showHidden':![],'depth':null}));ami['emit'](_0xe613('0x69'),this[_0xe613('0x6')][_0x5b3576['uniqueid']][_0x44a2b]);logger[_0xe613('0x28')](_0xe613('0x6a'),_0x5b3576['uniqueid'],util[_0xe613('0x2a')]({'id':this[_0xe613('0x9')][_0x5b3576[_0xe613('0x48')]]['id'],'destaccountcode':_0x5b3576[_0xe613('0x6b')]},{'showHidden':![],'depth':null}));this[_0xe613('0x1f')](util[_0xe613('0x39')](_0xe613('0x3a'),_0x5b3576['membername']),_0xe613('0x6c'),{'id':this['agents'][_0x5b3576[_0xe613('0x48')]]['id'],'destaccountcode':Number(_0x5b3576[_0xe613('0x6b')])});}}}}}}catch(_0x28c5f5){logger[_0xe613('0x3b')](_0xe613('0x6d'),_0x5b3576[_0xe613('0x25')],util[_0xe613('0x2a')](_0x28c5f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe613('0x1e')]['syncVarSet']=function(_0x7fce60){try{if(this['isNotNull'](_0x7fce60)){logger[_0xe613('0x28')](_0xe613('0x6e'),_0x7fce60[_0xe613('0x25')],util[_0xe613('0x2a')](_0x7fce60,{'showHidden':![],'depth':null}));this['addVariable'](_0x7fce60[_0xe613('0x25')],_[_0xe613('0x6f')](_0x7fce60[_0xe613('0x70')])[0x0],_0x7fce60[_0xe613('0x71')]);if(this[_0xe613('0x6')][_0x7fce60[_0xe613('0x25')]]){for(var _0x53a8fb in this['channels'][_0x7fce60['uniqueid']]){if(this[_0xe613('0x6')][_0x7fce60[_0xe613('0x25')]][_0xe613('0x3e')](_0x53a8fb)){logger[_0xe613('0x23')](_0xe613('0x72'),_0x7fce60['uniqueid'],_0x53a8fb,_[_0xe613('0x6f')](_0x7fce60['variable'])[0x0],_0x7fce60[_0xe613('0x71')]);if(_[_0xe613('0x21')](this[_0xe613('0x6')][_0x7fce60[_0xe613('0x25')]][_0x53a8fb]['variables'])){this[_0xe613('0x6')][_0x7fce60[_0xe613('0x25')]][_0x53a8fb][_0xe613('0xa')]={};}this[_0xe613('0x6')][_0x7fce60[_0xe613('0x25')]][_0x53a8fb][_0xe613('0xa')]=this[_0xe613('0xa')][_0x7fce60[_0xe613('0x25')]];}}}}}catch(_0x12c476){logger[_0xe613('0x3b')](_0xe613('0x73'),_0x7fce60[_0xe613('0x25')],util[_0xe613('0x2a')](_0x12c476,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe613('0x74')]=function(_0x17a8d6,_0x22a07b,_0xa856b5){var _0x56c10c=[_0xe613('0x75'),_0xe613('0x76'),_0xe613('0x77'),_0xe613('0x78'),_0xe613('0x79'),_0xe613('0x7a'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xe613('0x7b'),_0xe613('0x7c'),'bridgepeer',_0xe613('0x7d'),'membercalls',_0xe613('0x7e'),'memberinterface',_0xe613('0x7f'),'membername','memberpenalty',_0xe613('0x80')];if(!_['isNil'](_0x22a07b)&&!_[_0xe613('0x81')](_0x56c10c,_0x22a07b)){if(_[_0xe613('0x21')](this[_0xe613('0xa')][_0x17a8d6])){this[_0xe613('0xa')][_0x17a8d6]={};}this[_0xe613('0xa')][_0x17a8d6][_0x22a07b]=_0xa856b5;}};VoiceAgentReport[_0xe613('0x1e')]['syncHangup']=function(_0x547eae){try{if(this['isNotNull'](_0x547eae)){logger[_0xe613('0x28')](_0xe613('0x82'),_0x547eae['uniqueid'],util[_0xe613('0x2a')](_0x547eae,{'showHidden':![],'depth':null}));if(this['channels'][_0x547eae[_0xe613('0x25')]]){for(var _0x4d7edb in this[_0xe613('0x6')][_0x547eae[_0xe613('0x25')]]){if(this[_0xe613('0x6')][_0x547eae['uniqueid']][_0xe613('0x3e')](_0x4d7edb)){if(this['channels'][_0x547eae[_0xe613('0x25')]][_0x4d7edb]['reason']==_0xe613('0x61')&&this[_0xe613('0x6')][_0x547eae[_0xe613('0x25')]][_0x4d7edb][_0xe613('0x11')]){logger[_0xe613('0x23')](_0xe613('0x83'),_0x547eae['uniqueid'],_0x4d7edb);this[_0xe613('0x6')][_0x547eae[_0xe613('0x25')]][_0x4d7edb][_0xe613('0x5f')]=moment()['format'](_0xe613('0x2c'));}}}logger[_0xe613('0x28')](_0xe613('0x84'),_0x547eae[_0xe613('0x25')],util[_0xe613('0x2a')](_[_0xe613('0x85')](this[_0xe613('0x6')][_0x547eae[_0xe613('0x25')]]),{'showHidden':![],'depth':null}));ami[_0xe613('0x1f')]('custom:voiceAgentReport',_['values'](this['channels'][_0x547eae[_0xe613('0x25')]]));this['deleteChannelAfterTimeout'](_0x547eae['uniqueid']);}if(this[_0xe613('0xa')][_0x547eae['uniqueid']]){delete this[_0xe613('0xa')][_0x547eae[_0xe613('0x25')]];}}}catch(_0x3c3aed){logger['error'](_0xe613('0x86'),_0x547eae[_0xe613('0x25')],util[_0xe613('0x2a')](_0x3c3aed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe613('0x1e')][_0xe613('0x1b')]=function(_0x14336f){try{if(this['isNotNull'](_0x14336f)){logger[_0xe613('0x28')](_0xe613('0x87'),_0x14336f['uniqueid'],util[_0xe613('0x2a')](_0x14336f,{'showHidden':![],'depth':null}));if(this[_0xe613('0x6')][_0x14336f[_0xe613('0x88')]]){for(var _0x25df38 in this[_0xe613('0x6')][_0x14336f[_0xe613('0x88')]]){if(this['channels'][_0x14336f[_0xe613('0x88')]]['hasOwnProperty'](_0x25df38)){if(_0x14336f[_0xe613('0x89')]===_0x25df38){logger[_0xe613('0x23')](_0xe613('0x8a'),_0x14336f[_0xe613('0x25')],this[_0xe613('0x6')][_0x14336f['transfereeuniqueid']][_0x25df38][_0xe613('0x26')],_0x25df38);var _0x32a0e7=moment();this[_0xe613('0x6')][_0x14336f[_0xe613('0x88')]][_0x25df38][_0xe613('0x11')]=!![];this[_0xe613('0x6')][_0x14336f['transfereeuniqueid']][_0x25df38]['agentcompleteAt']=moment()[_0xe613('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe613('0x6')][_0x14336f['transfereeuniqueid']][_0x25df38][_0xe613('0x46')]=_0xe613('0x60');this[_0xe613('0x6')][_0x14336f[_0xe613('0x88')]][_0x25df38][_0xe613('0x51')]=_0xe613('0x61');this[_0xe613('0x6')][_0x14336f[_0xe613('0x88')]][_0x25df38]['talktime']=_0x32a0e7['diff'](this['channels'][_0x14336f[_0xe613('0x88')]][_0x25df38][_0xe613('0x40')],_0xe613('0x8b'));}}}}if(this['channels'][_0x14336f['secondtransfereruniqueid']]){var _0x19e319=this[_0xe613('0x6')][_0x14336f[_0xe613('0x8c')]];this['channels'][_0x14336f[_0xe613('0x8c')]]=this[_0xe613('0x6')][_0x14336f['transfereeuniqueid']];this[_0xe613('0x6')][_0x14336f['transfereeuniqueid']]=_0x19e319;}}}catch(_0x9b7a13){logger['error'](_0xe613('0x8d'),_0x14336f[_0xe613('0x25')],util['inspect'](_0x9b7a13,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe613('0x1d')]=function(_0x26a276){try{if(this[_0xe613('0x20')](_0x26a276)){logger['debug'](_0xe613('0x8e'),_0x26a276[_0xe613('0x25')],util[_0xe613('0x2a')](_0x26a276,{'showHidden':![],'depth':null}));if(this['channels'][_0x26a276[_0xe613('0x88')]]){for(var _0x3b3f75 in this[_0xe613('0x6')][_0x26a276[_0xe613('0x88')]]){if(this[_0xe613('0x6')][_0x26a276[_0xe613('0x88')]][_0xe613('0x3e')](_0x3b3f75)){if(_0x26a276['transfereruniqueid']===_0x3b3f75){logger[_0xe613('0x23')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x26a276[_0xe613('0x25')],this[_0xe613('0x6')][_0x26a276['transfereeuniqueid']][_0x3b3f75]['membername'],_0x3b3f75);var _0x5e4790=moment();this['channels'][_0x26a276[_0xe613('0x88')]][_0x3b3f75][_0xe613('0x11')]=!![];this[_0xe613('0x6')][_0x26a276[_0xe613('0x88')]][_0x3b3f75]['agentcompleteAt']=_0x5e4790;this[_0xe613('0x6')][_0x26a276[_0xe613('0x88')]][_0x3b3f75]['lastevent']=_0xe613('0x60');this[_0xe613('0x6')][_0x26a276[_0xe613('0x88')]][_0x3b3f75][_0xe613('0x51')]=_0xe613('0x61');this['channels'][_0x26a276[_0xe613('0x88')]][_0x3b3f75][_0xe613('0x63')]=_0x5e4790[_0xe613('0x8f')](this[_0xe613('0x6')][_0x26a276[_0xe613('0x88')]][_0x3b3f75][_0xe613('0x40')],'seconds');}}}}}}catch(_0x345e0c){logger[_0xe613('0x3b')]('[%s][voiceAgentReport][blindtransfer]',_0x26a276['uniqueid'],util[_0xe613('0x2a')](_0x345e0c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe613('0x1e')][_0xe613('0x17')]=function(_0x55d28d){var _0x41e880='';try{if(this[_0xe613('0x20')](_0x55d28d)){logger[_0xe613('0x28')](_0xe613('0x90'),_0x55d28d[_0xe613('0x25')],util[_0xe613('0x2a')](_0x55d28d,{'showHidden':![],'depth':null}));if(_0x55d28d[_0xe613('0x91')]){_0x41e880=_0x55d28d[_0xe613('0x91')][_0xe613('0x92')](0x0,_0x55d28d[_0xe613('0x91')][_0xe613('0x93')]('-'));if(this[_0xe613('0x9')][_0x41e880]){logger[_0xe613('0x23')](_0xe613('0x94'),_0x55d28d['uniqueid'],_0x41e880);this[_0xe613('0x9')][_0x41e880][_0xe613('0x95')]=!![];}}}}catch(_0x140dad){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x55d28d['uniqueid'],util[_0xe613('0x2a')](_0x140dad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe613('0x1e')][_0xe613('0x19')]=function(_0x35ad78){var _0x2ef37b='';try{if(this[_0xe613('0x20')](_0x35ad78)){logger[_0xe613('0x28')](_0xe613('0x96'),_0x35ad78['uniqueid'],util['inspect'](_0x35ad78,{'showHidden':![],'depth':null}));if(_0x35ad78['channel']){_0x2ef37b=_0x35ad78[_0xe613('0x91')][_0xe613('0x92')](0x0,_0x35ad78['channel'][_0xe613('0x93')]('-'));if(this[_0xe613('0x9')][_0x2ef37b]){logger[_0xe613('0x23')](_0xe613('0x97'),_0x35ad78['uniqueid'],_0x2ef37b);this[_0xe613('0x9')][_0x2ef37b][_0xe613('0x95')]=![];}}}}catch(_0x27d1d4){logger[_0xe613('0x3b')]('[%s][voiceAgentReport][musiconholdstop]',_0x35ad78[_0xe613('0x25')],util['inspect'](_0x27d1d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe613('0x1e')][_0xe613('0x98')]=function(_0x1c7e87,_0x3b78fa=0x2710){if(this[_0xe613('0x6')][_0x1c7e87]){setTimeout(()=>{delete this[_0xe613('0x6')][_0x1c7e87];},_0x3b78fa);}};module[_0xe613('0x99')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index af5e443..8741386 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c9b=['merge','pick','context','from-sip','channel','split','xcally-motion-preview','destconnectedlinenum','format','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','blindTransfers','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','undefined','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','keys','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','toNumber','membername','name','UserId','syncMixMonitorFilename','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','rec','[%s][voiceCallReport][varset]\x20event:','value','variable','xmd-phone','xmd-callerid','callerid','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','deleteChannelAfterTimeout','exports','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','../rpc/setting','set','queue','agi','dial','playback','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid'];(function(_0xce399d,_0x3da11c){var _0x4b35d3=function(_0x3f8139){while(--_0x3f8139){_0xce399d['push'](_0xce399d['shift']());}};_0x4b35d3(++_0x3da11c);}(_0x2c9b,0x14a));var _0xb2c9=function(_0x344e48,_0xce9158){_0x344e48=_0x344e48-0x0;var _0x5de200=_0x2c9b[_0x344e48];return _0x5de200;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var path=require(_0xb2c9('0x0'));var Redis=require(_0xb2c9('0x1'));var config=require(_0xb2c9('0x2'));var logger=require(_0xb2c9('0x3'))('ami');var ami=require('../ami');var Channel=require(_0xb2c9('0x4'));var RpcSetting=require(_0xb2c9('0x5'));var applications=[_0xb2c9('0x6'),_0xb2c9('0x7'),_0xb2c9('0x8'),_0xb2c9('0x9'),_0xb2c9('0xa'),'voicemail'];var dispositions=['NO\x20ANSWER',_0xb2c9('0xb'),'FAILED',_0xb2c9('0xc'),'NO\x20ANSWER','NO\x20ANSWER',_0xb2c9('0xd'),_0xb2c9('0xe'),_0xb2c9('0xb'),'FAILED','FAILED'];config[_0xb2c9('0xf')]=_['defaults'](config[_0xb2c9('0xf')],{'host':_0xb2c9('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb2c9('0xf')]));function VoiceCallReport(_0x3596a6){this[_0xb2c9('0x11')]=_0x3596a6[_0xb2c9('0x11')];this[_0xb2c9('0x12')]=_0x3596a6[_0xb2c9('0x12')];this['blindTransfers']={};ami['on'](_0xb2c9('0x13'),this[_0xb2c9('0x14')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x16'),this[_0xb2c9('0x14')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x17'),this[_0xb2c9('0x18')][_0xb2c9('0x15')](this));ami['on']('newstate',this[_0xb2c9('0x19')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x1a'),this[_0xb2c9('0x1b')]['bind'](this));ami['on'](_0xb2c9('0x1c'),this[_0xb2c9('0x1d')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x1e'),this[_0xb2c9('0x1f')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x20'),this[_0xb2c9('0x21')]['bind'](this));ami['on'](_0xb2c9('0x22'),this[_0xb2c9('0x23')][_0xb2c9('0x15')](this));ami['on'](_0xb2c9('0x24'),this[_0xb2c9('0x25')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xb2c9('0x15')](this));try{logger[_0xb2c9('0x26')](_0xb2c9('0x27'));ami[_0xb2c9('0x28')]();}catch(_0xf76b87){logger[_0xb2c9('0x29')](_0xb2c9('0x2a'),util[_0xb2c9('0x2b')](_0xf76b87,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xb2c9('0x2c')]['isNotNull']=function(_0x505439){return _0x505439!==null&&!_[_0xb2c9('0x2d')](_0x505439);};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x2e')]=function(_0x514566,_0x974502,_0x288b4f){io['to'](_0x514566)['emit'](_0x974502,_0x288b4f);};VoiceCallReport[_0xb2c9('0x2c')]['syncNewCallerId']=function(_0x744097){try{if(this[_0xb2c9('0x2f')](_0x744097)){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x744097[_0xb2c9('0x30')],_0x744097[_0xb2c9('0x31')],_0x744097[_0xb2c9('0x32')]);logger[_0xb2c9('0x33')](_0xb2c9('0x34'),_0x744097[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x744097,{'showHidden':![],'depth':null}));if(_0x744097[_0xb2c9('0x30')]===_0x744097[_0xb2c9('0x35')]){if(!_[_0xb2c9('0x2d')](this[_0xb2c9('0x11')][_0x744097['uniqueid']])){_[_0xb2c9('0x36')](this[_0xb2c9('0x11')][_0x744097[_0xb2c9('0x30')]],_[_0xb2c9('0x37')](_0x744097,_['keys'](this[_0xb2c9('0x11')][_0x744097[_0xb2c9('0x30')]])));}}if(_0x744097[_0xb2c9('0x38')]===_0xb2c9('0x39')){var _0x3a9a32=this[_0xb2c9('0x12')][_0x744097[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]];if(_0x3a9a32){if(_0x744097['exten']==_0xb2c9('0x3c')){_0x3a9a32[_0xb2c9('0x3d')]=_0x744097['connectedlinenum'];this[_0xb2c9('0x2e')](util[_0xb2c9('0x3e')](_0xb2c9('0x3f'),_0x3a9a32['name']),_0xb2c9('0x40'),{'id':_0x3a9a32['id'],'destaccountcode':_0x3a9a32[_0xb2c9('0x41')],'destconnectedlinenum':_0x744097['connectedlinenum']});}}}}}catch(_0x44d497){logger[_0xb2c9('0x29')](_0xb2c9('0x42'),_0x744097[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x44d497,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x18')]=function(_0x47be3a){try{if(this[_0xb2c9('0x2f')](_0x47be3a)){logger[_0xb2c9('0x33')](_0xb2c9('0x43'),_0x47be3a[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x47be3a,{'showHidden':![],'depth':null}));if(this['channels'][_0x47be3a[_0xb2c9('0x30')]]){return;}if(_0x47be3a[_0xb2c9('0x3a')]==='OutgoingSpoolFailed'){return;}if(_0x47be3a[_0xb2c9('0x30')]!==_0x47be3a[_0xb2c9('0x35')]&&!this[_0xb2c9('0x44')][_0x47be3a[_0xb2c9('0x35')]]){return;}logger[_0xb2c9('0x26')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x47be3a[_0xb2c9('0x30')],_0x47be3a[_0xb2c9('0x38')],_0x47be3a[_0xb2c9('0x45')]);this['channels'][_0x47be3a[_0xb2c9('0x30')]]=new Channel();this[_0xb2c9('0x11')][_0x47be3a[_0xb2c9('0x30')]][_0xb2c9('0x46')]=moment()[_0xb2c9('0x3e')](_0xb2c9('0x47'));this[_0xb2c9('0x11')][_0x47be3a['uniqueid']][_0xb2c9('0x48')]=dispositions[_['toNumber'](_0x47be3a[_0xb2c9('0x49')])];_[_0xb2c9('0x36')](this[_0xb2c9('0x11')][_0x47be3a[_0xb2c9('0x30')]],_[_0xb2c9('0x37')](_0x47be3a,_['keys'](this[_0xb2c9('0x11')][_0x47be3a[_0xb2c9('0x30')]])));if(_0x47be3a[_0xb2c9('0x38')]==='from-sip'){var _0x31d262=this[_0xb2c9('0x12')][_0x47be3a[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]];if(_0x31d262&&typeof _0x31d262[_0xb2c9('0x3d')]===_0xb2c9('0x4a')){_0x31d262[_0xb2c9('0x3d')]=_0x47be3a['exten'];logger[_0xb2c9('0x33')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x47be3a[_0xb2c9('0x30')],util[_0xb2c9('0x2b')]({'id':_0x31d262['id'],'destaccountcode':_0x31d262[_0xb2c9('0x41')],'destconnectedlinenum':_0x47be3a[_0xb2c9('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xb2c9('0x3e')](_0xb2c9('0x3f'),_0x31d262['name']),_0xb2c9('0x40'),{'id':_0x31d262['id'],'destaccountcode':_0x31d262[_0xb2c9('0x41')],'destconnectedlinenum':_0x47be3a[_0xb2c9('0x45')]});}}}}catch(_0x10c0ff){logger['error'](_0xb2c9('0x4b'),_0x47be3a['uniqueid'],util['inspect'](_0x10c0ff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x14')]=function(_0x8c4b96){try{if(this[_0xb2c9('0x2f')](_0x8c4b96)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x8c4b96[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x8c4b96,{'showHidden':![],'depth':null}));if(_0x8c4b96[_0xb2c9('0x3a')]===_0xb2c9('0x4c')||_0x8c4b96[_0xb2c9('0x45')]==='h')return;if(_0x8c4b96[_0xb2c9('0x30')]===_0x8c4b96[_0xb2c9('0x35')]||this[_0xb2c9('0x44')][_0x8c4b96[_0xb2c9('0x35')]]){_0x8c4b96['application']=_0x8c4b96[_0xb2c9('0x4d')]?_0x8c4b96[_0xb2c9('0x4d')][_0xb2c9('0x4e')]():undefined;_0x8c4b96[_0xb2c9('0x4f')]=_0x8c4b96['appdata']||_0x8c4b96[_0xb2c9('0x4f')];if(_0x8c4b96[_0xb2c9('0x50')]&&_0x8c4b96[_0xb2c9('0x4d')]!==_0xb2c9('0x7')){_0x8c4b96['applicationdata']=_0x8c4b96[_0xb2c9('0x4f')][_0xb2c9('0x4e')]();}logger[_0xb2c9('0x26')](_0xb2c9('0x51'),_0x8c4b96[_0xb2c9('0x30')],_0x8c4b96['application'],_0x8c4b96[_0xb2c9('0x4f')]);if(_[_0xb2c9('0x2d')](this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]])){this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]]=new Channel();this[_0xb2c9('0x11')][_0x8c4b96['uniqueid']][_0xb2c9('0x46')]=_0x8c4b96[_0xb2c9('0x52')]?moment()[_0xb2c9('0x53')](moment['duration'](_0x8c4b96[_0xb2c9('0x52')])[_0xb2c9('0x54')](),'seconds')[_0xb2c9('0x3e')](_0xb2c9('0x47')):moment()[_0xb2c9('0x3e')](_0xb2c9('0x47'));this[_0xb2c9('0x11')][_0x8c4b96['uniqueid']][_0xb2c9('0x48')]='NO\x20ANSWER';}_[_0xb2c9('0x36')](this[_0xb2c9('0x11')][_0x8c4b96['uniqueid']],_[_0xb2c9('0x37')](_0x8c4b96,_[_0xb2c9('0x55')](this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]])));if(_[_0xb2c9('0x56')](applications,_0x8c4b96[_0xb2c9('0x4d')])){this['channels'][_0x8c4b96['uniqueid']][_0xb2c9('0x57')]=_0x8c4b96[_0xb2c9('0x4d')];this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]][_0xb2c9('0x58')]=_0x8c4b96[_0xb2c9('0x4f')];if(_0x8c4b96[_0xb2c9('0x4d')]===_0xb2c9('0x6')&&_[_0xb2c9('0x59')](_0x8c4b96[_0xb2c9('0x4f')][_0xb2c9('0x4e')](),_0xb2c9('0x5a'))){var _0x25ad90=_0x8c4b96[_0xb2c9('0x4f')][_0xb2c9('0x3b')]('=');var _0x2f8fe1=_0x25ad90[0x0][_0xb2c9('0x4e')]()[_0xb2c9('0x5b')](/cdr\((.*)\)/);if(_0x2f8fe1){if(_0x2f8fe1[0x1]===_0xb2c9('0x5c')&&!_[_0xb2c9('0x5d')](this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]][_0x2f8fe1[0x1]]))return;this[_0xb2c9('0x11')][_0x8c4b96[_0xb2c9('0x30')]][_0x2f8fe1[0x1]]=_0x25ad90[0x1];}}else if(_0x8c4b96[_0xb2c9('0x4d')]===_0xb2c9('0x7')){this['channels'][_0x8c4b96['uniqueid']][_0xb2c9('0x7')]=_0x8c4b96[_0xb2c9('0x4f')][_0xb2c9('0x3b')](',')[0x0];}}}}}catch(_0x561bb1){logger[_0xb2c9('0x29')](_0xb2c9('0x5e'),_0x8c4b96[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x561bb1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')]['syncNewState']=function(_0x305f13){try{if(this['isNotNull'](_0x305f13)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x305f13[_0xb2c9('0x30')],_0x305f13[_0xb2c9('0x35')],_0x305f13['calleridname'],_0x305f13['calleridnum']);logger[_0xb2c9('0x33')](_0xb2c9('0x5f'),_0x305f13[_0xb2c9('0x30')],util[_0xb2c9('0x2b')](_0x305f13,{'showHidden':![],'depth':null}));if(_0x305f13['channelstate']!=='6')return;var _0x208356=this['agents'][_0x305f13[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]];if(_0x305f13[_0xb2c9('0x30')]!==_0x305f13[_0xb2c9('0x35')]){var _0x4b0793=moment();if(this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]]){if(!this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x60')]){this['channels'][_0x305f13[_0xb2c9('0x35')]]['answered']=!![];this[_0xb2c9('0x11')][_0x305f13['linkedid']][_0xb2c9('0x61')]=_0x4b0793[_0xb2c9('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]]['starttime']){this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x62')]=_0x4b0793[_0xb2c9('0x63')](this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x46')],'seconds');}}this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x35')]=_0x305f13[_0xb2c9('0x30')];if(_0x305f13[_0xb2c9('0x32')]!==_0xb2c9('0x3c')){this['channels'][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x64')]=_0x305f13[_0xb2c9('0x32')];}this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x65')]=_0x305f13[_0xb2c9('0x31')];this['channels'][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x66')]=_0x305f13[_0xb2c9('0x3a')];this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]]['disposition']=dispositions[_[_0xb2c9('0x67')](_0x305f13[_0xb2c9('0x49')])];if(_0x208356){this[_0xb2c9('0x11')][_0x305f13['linkedid']]['UserId']=_0x208356['id'];this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x35')]][_0xb2c9('0x68')]=_0x208356[_0xb2c9('0x69')];}}if(this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]]){if(!this['channels'][_0x305f13['uniqueid']][_0xb2c9('0x60')]){this['channels'][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x60')]=!![];this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x61')]=_0x4b0793[_0xb2c9('0x3e')](_0xb2c9('0x47'));if(this['channels'][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x46')]){this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x62')]=_0x4b0793[_0xb2c9('0x63')](this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x46')],_0xb2c9('0x54'));}}if(_0x305f13['calleridnum']!==_0xb2c9('0x3c')){this[_0xb2c9('0x11')][_0x305f13['uniqueid']][_0xb2c9('0x64')]=_0x305f13[_0xb2c9('0x32')];}this[_0xb2c9('0x11')][_0x305f13['uniqueid']][_0xb2c9('0x65')]=_0x305f13[_0xb2c9('0x31')];this['channels'][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x66')]=_0x305f13[_0xb2c9('0x3a')];this[_0xb2c9('0x11')][_0x305f13['uniqueid']]['disposition']=dispositions[_[_0xb2c9('0x67')](_0x305f13[_0xb2c9('0x49')])];}}else{if(this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]]){if(_0x208356){this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x6a')]=_0x208356['id'];this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]][_0xb2c9('0x68')]=_0x208356[_0xb2c9('0x69')];}}}if(_0x305f13[_0xb2c9('0x38')]==='from-sip'){if(_0x208356){_0x208356[_0xb2c9('0x3d')]=_0x305f13[_0xb2c9('0x45')];var _0x5699a7;if(this[_0xb2c9('0x11')][_0x305f13['uniqueid']]){_0x5699a7=this[_0xb2c9('0x11')][_0x305f13[_0xb2c9('0x30')]]['queue'];}else if(this['channels'][_0x305f13['linkedid']]){_0x5699a7=this[_0xb2c9('0x11')][_0x305f13['linkedid']]['queue'];}_0x208356[_0xb2c9('0x7')]=_0x5699a7;var _0x475bc5={'id':_0x208356['id'],'name':_0x208356[_0xb2c9('0x69')],'agentconnected':!![],'destaccountcode':_0x208356[_0xb2c9('0x41')],'destconnectedlinenum':_0x305f13[_0xb2c9('0x45')],'queue':_0x5699a7||undefined,'uniqueid':_0x305f13[_0xb2c9('0x35')]};logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x305f13[_0xb2c9('0x30')],util['inspect'](_0x475bc5,{'showHidden':![],'depth':null}));this[_0xb2c9('0x2e')](util[_0xb2c9('0x3e')](_0xb2c9('0x3f'),_0x208356[_0xb2c9('0x69')]),_0xb2c9('0x40'),_0x475bc5);}}}}catch(_0x4ee72f){logger['error']('[%s][voiceCallReport][newstate]',_0x305f13['uniqueid'],util[_0xb2c9('0x2b')](_0x4ee72f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x6b')]=function(_0x883918,_0x3f131a){try{if(this[_0xb2c9('0x11')][_0x883918]){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x883918,_0x3f131a);this[_0xb2c9('0x11')][_0x883918]['monitor']=!![];if(_[_0xb2c9('0x6c')](_0x3f131a,'.wav49')){_0x3f131a=_0x3f131a[_0xb2c9('0x6d')](_0xb2c9('0x6e'),_0xb2c9('0x6f'));}this[_0xb2c9('0x11')][_0x883918][_0xb2c9('0x70')]=_0x3f131a;var _0x3a90e7=_[_0xb2c9('0x71')](this[_0xb2c9('0x11')][_0x883918][_0xb2c9('0x72')],{'filename':_0x3f131a});if(_[_0xb2c9('0x5d')](_0x3a90e7)){this[_0xb2c9('0x11')][_0x883918][_0xb2c9('0x72')]['push']({'filename':_0x3f131a,'createdAt':moment()['format'](_0xb2c9('0x47')),'mixmonitorid':'','status':_0xb2c9('0x73')});}}}catch(_0x15e33b){logger[_0xb2c9('0x29')]('[%s][voiceCallReport][mixMonitorFilename]',_0x883918,util['inspect'](_0x15e33b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x1b')]=function(_0xc7b427){try{if(this[_0xb2c9('0x2f')](_0xc7b427)){logger[_0xb2c9('0x33')](_0xb2c9('0x74'),_0xc7b427['uniqueid'],util[_0xb2c9('0x2b')](_0xc7b427,{'showHidden':![],'depth':null}));if(this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]]&&_0xc7b427[_0xb2c9('0x3a')]!=_0xb2c9('0x4c')){if(this[_0xb2c9('0x2f')](_0xc7b427['variable'])){if(this[_0xb2c9('0x2f')](_0xc7b427['variable']['mixmonitor_filename'])){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]);this['syncMixMonitorFilename'](_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]);}else if(this['isNotNull'](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x77')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]][_0xb2c9('0x32')]=_0xc7b427['value'];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x78')])){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]][_0xb2c9('0x79')]=_0xc7b427[_0xb2c9('0x75')];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')]['xmd-cdrtype'])){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]][_0xb2c9('0x5c')]=_0xc7b427[_0xb2c9('0x75')];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x7a')])){logger[_0xb2c9('0x26')](_0xb2c9('0x7b'),_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]['split'](',')[0x0]);this[_0xb2c9('0x11')][_0xc7b427['uniqueid']][_0xb2c9('0x7')]=_0xc7b427[_0xb2c9('0x75')][_0xb2c9('0x3b')](',')[0x0];}else if(this[_0xb2c9('0x2f')](_0xc7b427['variable'][_0xb2c9('0x7c')])){logger[_0xb2c9('0x26')](_0xb2c9('0x7d'),_0xc7b427[_0xb2c9('0x30')],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]][_0xb2c9('0x7e')]=_0xc7b427[_0xb2c9('0x75')];}else if(this['isNotNull'](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x7f')])){logger[_0xb2c9('0x26')](_0xb2c9('0x80'),_0xc7b427[_0xb2c9('0x30')],_0xc7b427[_0xb2c9('0x75')]);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]]['destination']=_0xc7b427['value'];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x81')])){logger[_0xb2c9('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0xc7b427[_0xb2c9('0x30')],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427['uniqueid']]['calleridpreview']=_0xc7b427[_0xb2c9('0x75')];}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x82')])){logger['info'](_0xb2c9('0x83'),_0xc7b427['uniqueid'],_0xc7b427[_0xb2c9('0x75')]);this[_0xb2c9('0x11')][_0xc7b427[_0xb2c9('0x30')]]['queue']=_0xc7b427[_0xb2c9('0x75')];}else if(this['isNotNull'](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x84')])){logger[_0xb2c9('0x26')](_0xb2c9('0x85'),_0xc7b427['uniqueid'],_0xc7b427['value']);this[_0xb2c9('0x11')][_0xc7b427['uniqueid']]['sipcalluniqueid']=_0xc7b427[_0xb2c9('0x75')];}}}else if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x86')])){if(_0xc7b427[_0xb2c9('0x75')]){var _0xe9f693=path[_0xb2c9('0x87')](_0xc7b427[_0xb2c9('0x75')])['name'];logger[_0xb2c9('0x26')](_0xb2c9('0x88'),_0xe9f693,_0xc7b427['value']);this[_0xb2c9('0x6b')](_0xe9f693,_0xc7b427[_0xb2c9('0x75')]);}}else if(this['channels'][_0xc7b427[_0xb2c9('0x35')]]){if(this[_0xb2c9('0x2f')](_0xc7b427[_0xb2c9('0x76')])){if(this['isNotNull'](_0xc7b427[_0xb2c9('0x76')][_0xb2c9('0x84')])){logger[_0xb2c9('0x26')](_0xb2c9('0x85'),_0xc7b427['linkedid'],_0xc7b427[_0xb2c9('0x75')]);this[_0xb2c9('0x11')][_0xc7b427['linkedid']]['sipcalllinkedid']=_0xc7b427[_0xb2c9('0x75')];}}}}}catch(_0x3e80ad){logger[_0xb2c9('0x29')](_0xb2c9('0x89'),_0xc7b427[_0xb2c9('0x30')],util['inspect'](_0x3e80ad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb2c9('0x2c')][_0xb2c9('0x1d')]=function(_0x40db00){try{if(this[_0xb2c9('0x2f')](_0x40db00)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x40db00[_0xb2c9('0x30')],util['inspect'](_0x40db00,{'showHidden':![],'depth':null}));if(this[_0xb2c9('0x44')][_0x40db00['linkedid']]){if(this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['linkedid']]){this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['linkedid']][_0xb2c9('0x30')]=_0x40db00[_0xb2c9('0x30')];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x35')]]['answered']=this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x60')];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['linkedid']][_0xb2c9('0x61')]=this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]['answertime'];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]]['linkedid']][_0xb2c9('0x66')]=this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']][_0xb2c9('0x35')]][_0xb2c9('0x3a')];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x35')]][_0xb2c9('0x48')]=this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x48')];this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]=this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['linkedid']];this['deleteChannelAfterTimeout'](this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x35')]);}else if(this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']][_0xb2c9('0x30')]]){this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]]['uniqueid']][_0xb2c9('0x30')]=[this[_0xb2c9('0x11')][this['blindTransfers'][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]][_0xb2c9('0x35')],this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['uniqueid']]['linkedid']=this['channels'][this[_0xb2c9('0x44')][_0x40db00['linkedid']][_0xb2c9('0x30')]]['uniqueid']][0x0];this[_0xb2c9('0x11')][this['blindTransfers'][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]]['answered']=this[_0xb2c9('0x11')][_0x40db00['uniqueid']][_0xb2c9('0x60')];this['channels'][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]][_0xb2c9('0x61')]=this['channels'][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x61')];this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]][_0xb2c9('0x66')]=this['channels'][this[_0xb2c9('0x44')][_0x40db00['linkedid']]['uniqueid']]['channel'];this['channels'][this[_0xb2c9('0x44')][_0x40db00['linkedid']][_0xb2c9('0x30')]][_0xb2c9('0x48')]=this[_0xb2c9('0x11')][_0x40db00['uniqueid']][_0xb2c9('0x48')];this['channels'][_0x40db00['uniqueid']]=this[_0xb2c9('0x11')][this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]][_0xb2c9('0x30')]];this['deleteChannelAfterTimeout'](this[_0xb2c9('0x44')][_0x40db00[_0xb2c9('0x35')]]['uniqueid']);}}if(this['channels'][_0x40db00[_0xb2c9('0x30')]]){logger[_0xb2c9('0x26')](_0xb2c9('0x8a'),_0x40db00[_0xb2c9('0x30')],_0x40db00['cause-txt']);var _0x497ccd=moment();this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]['endtime']=_0x497ccd[_0xb2c9('0x3e')](_0xb2c9('0x47'));this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x52')]=_0x497ccd[_0xb2c9('0x63')](this['channels'][_0x40db00[_0xb2c9('0x30')]]['starttime'],_0xb2c9('0x54'));if(this['channels'][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x60')]){this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x8b')]=_0x497ccd[_0xb2c9('0x63')](this['channels'][_0x40db00[_0xb2c9('0x30')]][_0xb2c9('0x61')],_0xb2c9('0x54'));this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]['holdtime']=this[_0xb2c9('0x11')][_0x40db00['uniqueid']][_0xb2c9('0x52')]-this[_0xb2c9('0x11')][_0x40db00[_0xb2c9('0x30')]]['billableseconds'];}if(_0x40db00[_0xb2c9('0x38')]===_0xb2c9('0x39')){if(this[_0xb2c9('0x12')][_0x40db00['channel'][_0xb2c9('0x3b')]('-')[0x0]]){this['agents'][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]]=_[_0xb2c9('0x8c')](this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]],[_0xb2c9('0x3d')]);logger[_0xb2c9('0x33')](_0xb2c9('0x8d'),_0x40db00[_0xb2c9('0x30')],util['inspect']({'id':this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xb2c9('0x12')][_0x40db00['channel'][_0xb2c9('0x3b')]('-')[0x0]][_0xb2c9('0x41')]},{'showHidden':![],'depth':null}));this[_0xb2c9('0x2e')](util['format'](_0xb2c9('0x3f'),this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]][_0xb2c9('0x69')]),'user:agentcomplete',{'id':this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xb2c9('0x12')][_0x40db00[_0xb2c9('0x3a')][_0xb2c9('0x3b')]('-')[0x0]][_0xb2c9('0x41')]});for(var _0x353ea0=0x0;_0x353ea0{delete this[_0xb2c9('0x11')][_0x127a42];},_0x4971af);}};module[_0xb2c9('0xbf')]=VoiceCallReport; \ No newline at end of file +var _0x79d7=['queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newchannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','actionCoreShowChannels','error','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','pick','keys','context','channel','split','exten','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','application','applicationdata','appdata','duration','seconds','merge','includes','lastapplication','startsWith','cdr(','match','type','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','diff','destinationchannel','membername','answertime','holdtime','xcally-motion-preview','connectedlinename','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','undefined','transferToInternal','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','StopMixMonitor','catch','webbar:stopmonitors','event','BlindTransfer','custom:voiceCallReport','[%s][voiceCallReport][hangup]','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfercalleridnum','origtransferercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set'];(function(_0x286f55,_0xec5470){var _0x91cab6=function(_0x3b12ea){while(--_0x3b12ea){_0x286f55['push'](_0x286f55['shift']());}};_0x91cab6(++_0xec5470);}(_0x79d7,0x17b));var _0x779d=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x79d7[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x779d('0x0'));var moment=require(_0x779d('0x1'));var util=require('util');var path=require(_0x779d('0x2'));var Redis=require(_0x779d('0x3'));var config=require(_0x779d('0x4'));var logger=require(_0x779d('0x5'))(_0x779d('0x6'));var ami=require(_0x779d('0x7'));var Channel=require(_0x779d('0x8'));var RpcSetting=require(_0x779d('0x9'));var applications=[_0x779d('0xa'),_0x779d('0xb'),_0x779d('0xc'),_0x779d('0xd'),_0x779d('0xe'),_0x779d('0xf')];var dispositions=[_0x779d('0x10'),'FAILED','FAILED',_0x779d('0x10'),_0x779d('0x10'),_0x779d('0x10'),_0x779d('0x11'),_0x779d('0x12'),'FAILED',_0x779d('0x13'),_0x779d('0x13')];config['redis']=_['defaults'](config[_0x779d('0x14')],{'host':_0x779d('0x15'),'port':0x18eb});var io=require(_0x779d('0x16'))(new Redis(config[_0x779d('0x14')]));function VoiceCallReport(_0x2119c1){this[_0x779d('0x17')]=_0x2119c1['channels'];this[_0x779d('0x18')]=_0x2119c1[_0x779d('0x18')];this[_0x779d('0x19')]={};ami['on']('coreshowchannel',this['syncNewExten']['bind'](this));ami['on']('newexten',this[_0x779d('0x1a')][_0x779d('0x1b')](this));ami['on'](_0x779d('0x1c'),this['syncNewChannel'][_0x779d('0x1b')](this));ami['on'](_0x779d('0x1d'),this[_0x779d('0x1e')][_0x779d('0x1b')](this));ami['on'](_0x779d('0x1f'),this['syncVarSet'][_0x779d('0x1b')](this));ami['on'](_0x779d('0x20'),this[_0x779d('0x21')][_0x779d('0x1b')](this));ami['on'](_0x779d('0x22'),this[_0x779d('0x23')][_0x779d('0x1b')](this));ami['on'](_0x779d('0x24'),this[_0x779d('0x25')][_0x779d('0x1b')](this));ami['on']('blindtransfer',this[_0x779d('0x26')]['bind'](this));ami['on'](_0x779d('0x27'),this['syncMusicOnHoldStart'][_0x779d('0x1b')](this));ami['on'](_0x779d('0x28'),this['syncMusicOnHoldStop'][_0x779d('0x1b')](this));try{logger[_0x779d('0x29')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x779d('0x2a')]();}catch(_0x2272f1){logger[_0x779d('0x2b')]('[voiceCallReport][coreshowchannels]',util[_0x779d('0x2c')](_0x2272f1,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x779d('0x2d')]['isNotNull']=function(_0x2dde5d){return _0x2dde5d!==null&&!_[_0x779d('0x2e')](_0x2dde5d);};VoiceCallReport[_0x779d('0x2d')]['emit']=function(_0x1b8aad,_0x204b83,_0x44ad85){io['to'](_0x1b8aad)[_0x779d('0x2f')](_0x204b83,_0x44ad85);};VoiceCallReport[_0x779d('0x2d')]['syncNewCallerId']=function(_0x3103a2){try{if(this[_0x779d('0x30')](_0x3103a2)){logger[_0x779d('0x29')](_0x779d('0x31'),_0x3103a2[_0x779d('0x32')],_0x3103a2[_0x779d('0x33')],_0x3103a2[_0x779d('0x34')]);logger[_0x779d('0x35')](_0x779d('0x36'),_0x3103a2[_0x779d('0x32')],util[_0x779d('0x2c')](_0x3103a2,{'showHidden':![],'depth':null}));if(_0x3103a2[_0x779d('0x32')]===_0x3103a2['linkedid']){if(!_['isUndefined'](this[_0x779d('0x17')][_0x3103a2['uniqueid']])){_['merge'](this[_0x779d('0x17')][_0x3103a2['uniqueid']],_[_0x779d('0x37')](_0x3103a2,_[_0x779d('0x38')](this['channels'][_0x3103a2['uniqueid']])));}}if(_0x3103a2[_0x779d('0x39')]==='from-sip'){var _0x272306=this[_0x779d('0x18')][_0x3103a2[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]];if(_0x272306){if(_0x3103a2[_0x779d('0x3c')]=='xcally-motion-preview'){_0x272306['destconnectedlinenum']=_0x3103a2[_0x779d('0x3d')];this['emit'](util[_0x779d('0x3e')](_0x779d('0x3f'),_0x272306[_0x779d('0x40')]),_0x779d('0x41'),{'id':_0x272306['id'],'destaccountcode':_0x272306[_0x779d('0x42')],'destconnectedlinenum':_0x3103a2[_0x779d('0x3d')]});}}}}}catch(_0x14987d){logger['error'](_0x779d('0x43'),_0x3103a2[_0x779d('0x32')],util[_0x779d('0x2c')](_0x14987d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x779d('0x2d')][_0x779d('0x44')]=function(_0x24791c){try{if(this['isNotNull'](_0x24791c)){logger[_0x779d('0x35')](_0x779d('0x45'),_0x24791c[_0x779d('0x32')],util[_0x779d('0x2c')](_0x24791c,{'showHidden':![],'depth':null}));if(this[_0x779d('0x17')][_0x24791c[_0x779d('0x32')]]){return;}if(_0x24791c[_0x779d('0x3a')]===_0x779d('0x46')){return;}if(_0x24791c['uniqueid']!==_0x24791c[_0x779d('0x47')]&&!this[_0x779d('0x19')][_0x24791c[_0x779d('0x47')]]){return;}logger[_0x779d('0x29')](_0x779d('0x48'),_0x24791c[_0x779d('0x32')],_0x24791c['context'],_0x24791c[_0x779d('0x3c')]);this[_0x779d('0x17')][_0x24791c['uniqueid']]=new Channel();this[_0x779d('0x17')][_0x24791c['uniqueid']][_0x779d('0x49')]=moment()['format'](_0x779d('0x4a'));this[_0x779d('0x17')][_0x24791c[_0x779d('0x32')]][_0x779d('0x4b')]=dispositions[_[_0x779d('0x4c')](_0x24791c[_0x779d('0x4d')])];_['merge'](this[_0x779d('0x17')][_0x24791c[_0x779d('0x32')]],_[_0x779d('0x37')](_0x24791c,_[_0x779d('0x38')](this[_0x779d('0x17')][_0x24791c['uniqueid']])));if(_0x24791c['context']===_0x779d('0x4e')){var _0x4817c2=this[_0x779d('0x18')][_0x24791c[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]];if(_0x4817c2&&typeof _0x4817c2[_0x779d('0x4f')]==='undefined'){_0x4817c2['destconnectedlinenum']=_0x24791c[_0x779d('0x3c')];logger['debug'](_0x779d('0x50'),_0x24791c['uniqueid'],util[_0x779d('0x2c')]({'id':_0x4817c2['id'],'destaccountcode':_0x4817c2['accountcode'],'destconnectedlinenum':_0x24791c[_0x779d('0x3c')]},{'showHidden':![],'depth':null}));this[_0x779d('0x2f')](util[_0x779d('0x3e')]('user:%s',_0x4817c2['name']),_0x779d('0x41'),{'id':_0x4817c2['id'],'destaccountcode':_0x4817c2[_0x779d('0x42')],'destconnectedlinenum':_0x24791c[_0x779d('0x3c')]});}}}}catch(_0x39cc8c){logger[_0x779d('0x2b')](_0x779d('0x51'),_0x24791c[_0x779d('0x32')],util[_0x779d('0x2c')](_0x39cc8c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x779d('0x2d')][_0x779d('0x1a')]=function(_0xb6e975){try{if(this['isNotNull'](_0xb6e975)){logger[_0x779d('0x35')]('[%s][voiceCallReport][newexten]\x20event:',_0xb6e975[_0x779d('0x32')],util[_0x779d('0x2c')](_0xb6e975,{'showHidden':![],'depth':null}));if(_0xb6e975[_0x779d('0x3a')]===_0x779d('0x46')||_0xb6e975[_0x779d('0x3c')]==='h')return;if(_0xb6e975[_0x779d('0x32')]===_0xb6e975[_0x779d('0x47')]||this[_0x779d('0x19')][_0xb6e975[_0x779d('0x47')]]){_0xb6e975[_0x779d('0x52')]=_0xb6e975[_0x779d('0x52')]?_0xb6e975[_0x779d('0x52')]['toLowerCase']():undefined;_0xb6e975[_0x779d('0x53')]=_0xb6e975['appdata']||_0xb6e975[_0x779d('0x53')];if(_0xb6e975[_0x779d('0x54')]&&_0xb6e975[_0x779d('0x52')]!=='queue'){_0xb6e975['applicationdata']=_0xb6e975[_0x779d('0x53')]['toLowerCase']();}logger[_0x779d('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0xb6e975[_0x779d('0x32')],_0xb6e975['application'],_0xb6e975[_0x779d('0x53')]);if(_['isUndefined'](this[_0x779d('0x17')][_0xb6e975[_0x779d('0x32')]])){this['channels'][_0xb6e975[_0x779d('0x32')]]=new Channel();this[_0x779d('0x17')][_0xb6e975[_0x779d('0x32')]]['starttime']=_0xb6e975[_0x779d('0x55')]?moment()['subtract'](moment['duration'](_0xb6e975[_0x779d('0x55')])[_0x779d('0x56')](),_0x779d('0x56'))['format'](_0x779d('0x4a')):moment()['format'](_0x779d('0x4a'));this[_0x779d('0x17')][_0xb6e975['uniqueid']][_0x779d('0x4b')]=_0x779d('0x10');}_[_0x779d('0x57')](this[_0x779d('0x17')][_0xb6e975[_0x779d('0x32')]],_[_0x779d('0x37')](_0xb6e975,_[_0x779d('0x38')](this[_0x779d('0x17')][_0xb6e975[_0x779d('0x32')]])));if(_[_0x779d('0x58')](applications,_0xb6e975[_0x779d('0x52')])){this[_0x779d('0x17')][_0xb6e975[_0x779d('0x32')]][_0x779d('0x59')]=_0xb6e975[_0x779d('0x52')];this['channels'][_0xb6e975[_0x779d('0x32')]]['lastdata']=_0xb6e975[_0x779d('0x53')];if(_0xb6e975['application']===_0x779d('0xa')&&_[_0x779d('0x5a')](_0xb6e975[_0x779d('0x53')]['toLowerCase'](),_0x779d('0x5b'))){var _0x28ebd4=_0xb6e975[_0x779d('0x53')][_0x779d('0x3b')]('=');var _0x3cc6bc=_0x28ebd4[0x0]['toLowerCase']()[_0x779d('0x5c')](/cdr\((.*)\)/);if(_0x3cc6bc){if(_0x3cc6bc[0x1]===_0x779d('0x5d')&&!_['isNil'](this[_0x779d('0x17')][_0xb6e975[_0x779d('0x32')]][_0x3cc6bc[0x1]]))return;this['channels'][_0xb6e975[_0x779d('0x32')]][_0x3cc6bc[0x1]]=_0x28ebd4[0x1];}}else if(_0xb6e975['application']==='queue'){this[_0x779d('0x17')][_0xb6e975[_0x779d('0x32')]]['queue']=_0xb6e975[_0x779d('0x53')][_0x779d('0x3b')](',')[0x0];}}}}}catch(_0x3bca83){logger['error']('[%s][voiceCallReport][newexten]',_0xb6e975[_0x779d('0x32')],util[_0x779d('0x2c')](_0x3bca83,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x779d('0x2d')][_0x779d('0x1e')]=function(_0x6276d9){try{if(this[_0x779d('0x30')](_0x6276d9)){logger[_0x779d('0x29')](_0x779d('0x5e'),_0x6276d9['uniqueid'],_0x6276d9[_0x779d('0x47')],_0x6276d9[_0x779d('0x33')],_0x6276d9[_0x779d('0x34')]);logger[_0x779d('0x35')](_0x779d('0x5f'),_0x6276d9['uniqueid'],util[_0x779d('0x2c')](_0x6276d9,{'showHidden':![],'depth':null}));if(_0x6276d9[_0x779d('0x4d')]!=='6')return;var _0x314e8f=this[_0x779d('0x18')][_0x6276d9[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]];if(_0x6276d9['uniqueid']!==_0x6276d9[_0x779d('0x47')]){var _0x22db81=moment();if(this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]]){if(!this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]][_0x779d('0x60')]){this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]][_0x779d('0x60')]=!![];this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]]['answertime']=_0x22db81[_0x779d('0x3e')](_0x779d('0x4a'));if(this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]]['starttime']){this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]]['holdtime']=_0x22db81[_0x779d('0x61')](this[_0x779d('0x17')][_0x6276d9['linkedid']]['starttime'],_0x779d('0x56'));}}this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]][_0x779d('0x47')]=_0x6276d9[_0x779d('0x32')];if(_0x6276d9[_0x779d('0x34')]!=='xcally-motion-preview'){this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]][_0x779d('0x3d')]=_0x6276d9[_0x779d('0x34')];}this['channels'][_0x6276d9[_0x779d('0x47')]]['connectedlinename']=_0x6276d9[_0x779d('0x33')];this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]][_0x779d('0x62')]=_0x6276d9['channel'];this['channels'][_0x6276d9[_0x779d('0x47')]][_0x779d('0x4b')]=dispositions[_['toNumber'](_0x6276d9[_0x779d('0x4d')])];if(_0x314e8f){this['channels'][_0x6276d9[_0x779d('0x47')]]['UserId']=_0x314e8f['id'];this[_0x779d('0x17')][_0x6276d9[_0x779d('0x47')]][_0x779d('0x63')]=_0x314e8f[_0x779d('0x40')];}}if(this[_0x779d('0x17')][_0x6276d9[_0x779d('0x32')]]){if(!this[_0x779d('0x17')][_0x6276d9['uniqueid']][_0x779d('0x60')]){this[_0x779d('0x17')][_0x6276d9[_0x779d('0x32')]]['answered']=!![];this[_0x779d('0x17')][_0x6276d9['uniqueid']][_0x779d('0x64')]=_0x22db81[_0x779d('0x3e')](_0x779d('0x4a'));if(this[_0x779d('0x17')][_0x6276d9[_0x779d('0x32')]][_0x779d('0x49')]){this[_0x779d('0x17')][_0x6276d9['uniqueid']][_0x779d('0x65')]=_0x22db81[_0x779d('0x61')](this[_0x779d('0x17')][_0x6276d9['uniqueid']][_0x779d('0x49')],_0x779d('0x56'));}}if(_0x6276d9[_0x779d('0x34')]!==_0x779d('0x66')){this['channels'][_0x6276d9[_0x779d('0x32')]]['connectedlinenum']=_0x6276d9[_0x779d('0x34')];}this[_0x779d('0x17')][_0x6276d9[_0x779d('0x32')]][_0x779d('0x67')]=_0x6276d9[_0x779d('0x33')];this['channels'][_0x6276d9[_0x779d('0x32')]][_0x779d('0x62')]=_0x6276d9[_0x779d('0x3a')];this[_0x779d('0x17')][_0x6276d9[_0x779d('0x32')]]['disposition']=dispositions[_['toNumber'](_0x6276d9[_0x779d('0x4d')])];}}else{if(this[_0x779d('0x17')][_0x6276d9[_0x779d('0x32')]]){if(_0x314e8f){this['channels'][_0x6276d9[_0x779d('0x32')]][_0x779d('0x68')]=_0x314e8f['id'];this[_0x779d('0x17')][_0x6276d9[_0x779d('0x32')]]['membername']=_0x314e8f[_0x779d('0x40')];}}}if(_0x6276d9[_0x779d('0x39')]==='from-sip'){if(_0x314e8f){_0x314e8f[_0x779d('0x4f')]=_0x6276d9[_0x779d('0x3c')];var _0x34a659;if(this['channels'][_0x6276d9[_0x779d('0x32')]]){_0x34a659=this[_0x779d('0x17')][_0x6276d9['uniqueid']][_0x779d('0xb')];}else if(this['channels'][_0x6276d9[_0x779d('0x47')]]){_0x34a659=this['channels'][_0x6276d9['linkedid']][_0x779d('0xb')];}_0x314e8f['queue']=_0x34a659;var _0x5e1249={'id':_0x314e8f['id'],'name':_0x314e8f[_0x779d('0x40')],'agentconnected':!![],'destaccountcode':_0x314e8f[_0x779d('0x42')],'destconnectedlinenum':_0x6276d9[_0x779d('0x3c')],'queue':_0x34a659||undefined,'uniqueid':_0x6276d9[_0x779d('0x47')]};logger[_0x779d('0x35')](_0x779d('0x69'),_0x6276d9[_0x779d('0x32')],util[_0x779d('0x2c')](_0x5e1249,{'showHidden':![],'depth':null}));this[_0x779d('0x2f')](util[_0x779d('0x3e')](_0x779d('0x3f'),_0x314e8f['name']),_0x779d('0x41'),_0x5e1249);}}}}catch(_0x1cd7c4){logger['error'](_0x779d('0x6a'),_0x6276d9[_0x779d('0x32')],util[_0x779d('0x2c')](_0x1cd7c4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x779d('0x2d')][_0x779d('0x6b')]=function(_0x16f92b,_0x41d6a1){try{if(this['channels'][_0x16f92b]){logger[_0x779d('0x29')](_0x779d('0x6c'),_0x16f92b,_0x41d6a1);this['channels'][_0x16f92b]['monitor']=!![];if(_[_0x779d('0x6d')](_0x41d6a1,_0x779d('0x6e'))){_0x41d6a1=_0x41d6a1[_0x779d('0x6f')](_0x779d('0x6e'),_0x779d('0x70'));}this[_0x779d('0x17')][_0x16f92b][_0x779d('0x71')]=_0x41d6a1;var _0x3ba739=_['find'](this[_0x779d('0x17')][_0x16f92b][_0x779d('0x72')],{'filename':_0x41d6a1});if(_['isNil'](_0x3ba739)){this[_0x779d('0x17')][_0x16f92b]['monitors'][_0x779d('0x73')]({'filename':_0x41d6a1,'createdAt':moment()[_0x779d('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x46f8f){logger[_0x779d('0x2b')](_0x779d('0x74'),_0x16f92b,util['inspect'](_0x46f8f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x779d('0x2d')][_0x779d('0x75')]=function(_0x41baaf){try{if(this['isNotNull'](_0x41baaf)){logger[_0x779d('0x35')]('[%s][voiceCallReport][varset]\x20event:',_0x41baaf['uniqueid'],util[_0x779d('0x2c')](_0x41baaf,{'showHidden':![],'depth':null}));if(this['channels'][_0x41baaf[_0x779d('0x32')]]&&_0x41baaf['channel']!='OutgoingSpoolFailed'){if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')])){if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')]['mixmonitor_filename'])){logger[_0x779d('0x29')](_0x779d('0x77'),_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')]);this[_0x779d('0x6b')](_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')]);}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')][_0x779d('0x79')])){logger[_0x779d('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x41baaf['uniqueid'],_0x41baaf[_0x779d('0x78')]);this[_0x779d('0x17')][_0x41baaf[_0x779d('0x32')]][_0x779d('0x34')]=_0x41baaf['value'];}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')][_0x779d('0x7a')])){logger[_0x779d('0x29')](_0x779d('0x7b'),_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')]);this[_0x779d('0x17')][_0x41baaf[_0x779d('0x32')]][_0x779d('0x7c')]=_0x41baaf[_0x779d('0x78')];}else if(this[_0x779d('0x30')](_0x41baaf['variable'][_0x779d('0x7d')])){logger[_0x779d('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')]);this['channels'][_0x41baaf[_0x779d('0x32')]][_0x779d('0x5d')]=_0x41baaf[_0x779d('0x78')];}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')][_0x779d('0x7e')])){logger[_0x779d('0x29')](_0x779d('0x7f'),_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')][_0x779d('0x3b')](',')[0x0]);this[_0x779d('0x17')][_0x41baaf[_0x779d('0x32')]][_0x779d('0xb')]=_0x41baaf[_0x779d('0x78')][_0x779d('0x3b')](',')[0x0];}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')][_0x779d('0x80')])){logger[_0x779d('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x41baaf[_0x779d('0x32')],_0x41baaf['value']);this[_0x779d('0x17')][_0x41baaf[_0x779d('0x32')]][_0x779d('0x81')]=_0x41baaf[_0x779d('0x78')];}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')][_0x779d('0x82')])){logger[_0x779d('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')]);this[_0x779d('0x17')][_0x41baaf[_0x779d('0x32')]][_0x779d('0x83')]=_0x41baaf['value'];}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')][_0x779d('0x84')])){logger[_0x779d('0x29')](_0x779d('0x85'),_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')]);this['channels'][_0x41baaf[_0x779d('0x32')]][_0x779d('0x86')]=_0x41baaf['value'];}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')]['xmcs-queue'])){logger[_0x779d('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')]);this[_0x779d('0x17')][_0x41baaf[_0x779d('0x32')]][_0x779d('0xb')]=_0x41baaf[_0x779d('0x78')];}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')][_0x779d('0x87')])){logger[_0x779d('0x29')](_0x779d('0x88'),_0x41baaf[_0x779d('0x32')],_0x41baaf[_0x779d('0x78')]);this[_0x779d('0x17')][_0x41baaf[_0x779d('0x32')]][_0x779d('0x89')]=_0x41baaf['value'];}}}else if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')][_0x779d('0x8a')])){if(_0x41baaf[_0x779d('0x78')]){var _0x534fe2=path[_0x779d('0x8b')](_0x41baaf[_0x779d('0x78')])[_0x779d('0x40')];logger[_0x779d('0x29')](_0x779d('0x77'),_0x534fe2,_0x41baaf[_0x779d('0x78')]);this[_0x779d('0x6b')](_0x534fe2,_0x41baaf[_0x779d('0x78')]);}}else if(this[_0x779d('0x17')][_0x41baaf['linkedid']]){if(this[_0x779d('0x30')](_0x41baaf['variable'])){if(this[_0x779d('0x30')](_0x41baaf[_0x779d('0x76')]['sipcallid'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x41baaf[_0x779d('0x47')],_0x41baaf[_0x779d('0x78')]);this[_0x779d('0x17')][_0x41baaf['linkedid']]['sipcalllinkedid']=_0x41baaf[_0x779d('0x78')];}}}}}catch(_0x8b307d){logger[_0x779d('0x2b')](_0x779d('0x8c'),_0x41baaf[_0x779d('0x32')],util['inspect'](_0x8b307d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x5c42eb){try{if(this[_0x779d('0x30')](_0x5c42eb)){logger['debug'](_0x779d('0x8d'),_0x5c42eb['uniqueid'],util['inspect'](_0x5c42eb,{'showHidden':![],'depth':null}));if(this[_0x779d('0x19')][_0x5c42eb['linkedid']]){if(this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb['linkedid']]['linkedid']]){this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb['linkedid']][_0x779d('0x47')]][_0x779d('0x32')]=_0x5c42eb['uniqueid'];this['channels'][this[_0x779d('0x19')][_0x5c42eb['linkedid']][_0x779d('0x47')]]['answered']=this[_0x779d('0x17')][_0x5c42eb['uniqueid']][_0x779d('0x60')];this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x47')]][_0x779d('0x64')]=this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x64')];this['channels'][this[_0x779d('0x19')][_0x5c42eb['linkedid']]['linkedid']][_0x779d('0x62')]=this[_0x779d('0x17')][this['blindTransfers'][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x47')]][_0x779d('0x3a')];this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x47')]][_0x779d('0x4b')]=this[_0x779d('0x17')][_0x5c42eb['uniqueid']][_0x779d('0x4b')];this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]]=this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb[_0x779d('0x47')]]['linkedid']];this['deleteChannelAfterTimeout'](this[_0x779d('0x19')][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x47')]);}else if(this[_0x779d('0x17')][this['blindTransfers'][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x32')]]){this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x32')]][_0x779d('0x32')]=[this[_0x779d('0x17')][this['blindTransfers'][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x32')]][_0x779d('0x47')],this['channels'][this[_0x779d('0x19')][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x32')]][_0x779d('0x47')]=this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x32')]][_0x779d('0x32')]][0x0];this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb[_0x779d('0x47')]][_0x779d('0x32')]][_0x779d('0x60')]=this[_0x779d('0x17')][_0x5c42eb['uniqueid']][_0x779d('0x60')];this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb['linkedid']][_0x779d('0x32')]]['answertime']=this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x64')];this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb['linkedid']][_0x779d('0x32')]][_0x779d('0x62')]=this[_0x779d('0x17')][this[_0x779d('0x19')][_0x5c42eb['linkedid']]['uniqueid']][_0x779d('0x3a')];this['channels'][this[_0x779d('0x19')][_0x5c42eb['linkedid']]['uniqueid']][_0x779d('0x4b')]=this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x4b')];this['channels'][_0x5c42eb[_0x779d('0x32')]]=this[_0x779d('0x17')][this['blindTransfers'][_0x5c42eb[_0x779d('0x47')]]['uniqueid']];this[_0x779d('0x8e')](this['blindTransfers'][_0x5c42eb[_0x779d('0x47')]]['uniqueid']);}}if(this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x5c42eb[_0x779d('0x32')],_0x5c42eb['cause-txt']);var _0x34609f=moment();this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x8f')]=_0x34609f[_0x779d('0x3e')](_0x779d('0x4a'));this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x55')]=_0x34609f[_0x779d('0x61')](this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x49')],_0x779d('0x56'));if(this[_0x779d('0x17')][_0x5c42eb['uniqueid']][_0x779d('0x60')]){this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x90')]=_0x34609f[_0x779d('0x61')](this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x64')],_0x779d('0x56'));this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]]['holdtime']=this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]][_0x779d('0x55')]-this[_0x779d('0x17')][_0x5c42eb[_0x779d('0x32')]]['billableseconds'];}if(_0x5c42eb[_0x779d('0x39')]===_0x779d('0x4e')){if(this[_0x779d('0x18')][_0x5c42eb['channel'][_0x779d('0x3b')]('-')[0x0]]){this[_0x779d('0x18')][_0x5c42eb[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]]=_[_0x779d('0x91')](this[_0x779d('0x18')][_0x5c42eb[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x779d('0x92'),_0x5c42eb[_0x779d('0x32')],util[_0x779d('0x2c')]({'id':this[_0x779d('0x18')][_0x5c42eb[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x779d('0x18')][_0x5c42eb[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x779d('0x3e')](_0x779d('0x3f'),this[_0x779d('0x18')][_0x5c42eb[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]][_0x779d('0x40')]),_0x779d('0x93'),{'id':this[_0x779d('0x18')][_0x5c42eb['channel'][_0x779d('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x779d('0x18')][_0x5c42eb[_0x779d('0x3a')][_0x779d('0x3b')]('-')[0x0]][_0x779d('0x42')]});for(var _0x1fc3e4=0x0;_0x1fc3e4{delete this[_0x779d('0x17')][_0x2270f2];},_0x23e9d4);}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index d589395..2fb848f 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x076c=['variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','isNotNull','isUndefined','prototype','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','info','membername','interface','debug','voice:outbound','voice_outbound_channel:save','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','holdtime','billableseconds','sumBillable','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','outbound','applications'];(function(_0x34c1c5,_0x40a4d3){var _0x33608b=function(_0x2d6cd3){while(--_0x2d6cd3){_0x34c1c5['push'](_0x34c1c5['shift']());}};_0x33608b(++_0x40a4d3);}(_0x076c,0xce));var _0xc076=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x076c[_0x46a3e8];return _0xf1442e;};'use strict';var _=require('lodash');var moment=require(_0xc076('0x0'));var util=require(_0xc076('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xc076('0x2'))('ami');var ami=require('../ami');config[_0xc076('0x3')]=_[_0xc076('0x4')](config[_0xc076('0x3')],{'host':_0xc076('0x5'),'port':0x18eb});var io=require(_0xc076('0x6'))(new Redis(config[_0xc076('0x3')]));function VoiceDialReport(_0x30a953){this[_0xc076('0x7')]=_0x30a953['outboundChannels'];this[_0xc076('0x8')]=_0x30a953[_0xc076('0x8')];this[_0xc076('0x9')]={};this[_0xc076('0xa')]={};ami['on'](_0xc076('0xb'),this[_0xc076('0xc')][_0xc076('0xd')](this));ami['on']('dialend',this[_0xc076('0xe')]['bind'](this));ami['on'](_0xc076('0xf'),this['syncVarSet'][_0xc076('0xd')](this));ami['on']('hangup',this['syncHangup'][_0xc076('0xd')](this));}VoiceDialReport['prototype'][_0xc076('0x10')]=function(_0x2f76e2){return _0x2f76e2!==null&&!_[_0xc076('0x11')](_0x2f76e2);};VoiceDialReport[_0xc076('0x12')][_0xc076('0x13')]=function(_0x35dea0,_0x3ae08e,_0x735189){io['to'](_0x35dea0)[_0xc076('0x13')](_0x3ae08e,_0x735189);};VoiceDialReport[_0xc076('0x12')][_0xc076('0xc')]=function(_0x4d8b75){try{if(this[_0xc076('0x10')](_0x4d8b75)){logger['debug'](_0xc076('0x14'),_0x4d8b75[_0xc076('0x15')],util[_0xc076('0x16')](_0x4d8b75,{'showHidden':![],'depth':null}));if(this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]]){_[_0xc076('0x17')](this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]],{'starttime':moment()[_0xc076('0x18')](_0xc076('0x19')),'lastevent':_0xc076('0x1a'),'interface':_0x4d8b75[_0xc076('0x1b')]['substring'](0x0,_0x4d8b75[_0xc076('0x1b')][_0xc076('0x1c')]('-')),'membername':_0x4d8b75[_0xc076('0x1b')][_0xc076('0x1d')](_0x4d8b75['channel'][_0xc076('0x1c')]('/')+0x1,_0x4d8b75[_0xc076('0x1b')][_0xc076('0x1c')]('-'))},_[_0xc076('0x1e')](_0x4d8b75,['event','privilege']));logger[_0xc076('0x1f')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x4d8b75[_0xc076('0x15')],this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]][_0xc076('0x20')],this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]][_0xc076('0x21')]);logger[_0xc076('0x22')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4d8b75[_0xc076('0x15')],util['inspect'](this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]],{'showHidden':![],'depth':null}));if(this[_0xc076('0x9')][_0x4d8b75[_0xc076('0x15')]])_[_0xc076('0x17')](this[_0xc076('0x7')][_0x4d8b75['uniqueid']],this[_0xc076('0x9')][_0x4d8b75['uniqueid']]);this[_0xc076('0x13')](_0xc076('0x23'),_0xc076('0x24'),this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]]);logger[_0xc076('0x22')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4d8b75['uniqueid'],util[_0xc076('0x16')](this[_0xc076('0x7')][_0x4d8b75['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xc076('0x13')]('custom:dialbegin',this[_0xc076('0x7')][_0x4d8b75[_0xc076('0x15')]]);}}}catch(_0x4dfc92){logger[_0xc076('0x25')]('[%s][voiceDialReport][dialbegin]',_0x4d8b75[_0xc076('0x15')],util[_0xc076('0x16')](_0x4dfc92,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc076('0x12')][_0xc076('0xe')]=function(_0x41df55){try{if(this[_0xc076('0x10')](_0x41df55)){logger[_0xc076('0x22')]('[%s][voiceDialReport][dialend]\x20event:',_0x41df55['uniqueid'],util[_0xc076('0x16')](_0x41df55,{'showHidden':![],'depth':null}));if(this['channels'][_0x41df55[_0xc076('0x15')]]){this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]][_0xc076('0x26')]=_0x41df55[_0xc076('0x26')];if(_0x41df55[_0xc076('0x26')]===_0xc076('0x27')){this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]][_0xc076('0x28')]=_0x41df55[_0xc076('0x28')];this['channels'][_0x41df55[_0xc076('0x15')]][_0xc076('0x29')]=_0x41df55[_0xc076('0x29')];this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]][_0xc076('0x2a')]=moment()['format'](_0xc076('0x19'));this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]][_0xc076('0x2b')]='connect';logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x41df55[_0xc076('0x15')],_0x41df55['channel'][_0xc076('0x1d')](_0x41df55['channel'][_0xc076('0x1c')]('/')+0x1,_0x41df55[_0xc076('0x1b')][_0xc076('0x1c')]('-')));logger[_0xc076('0x22')](_0xc076('0x2c'),_0x41df55[_0xc076('0x15')],util[_0xc076('0x16')](this['channels'][_0x41df55[_0xc076('0x15')]],{'showHidden':![],'depth':null}));ami[_0xc076('0x13')](_0xc076('0x2d'),this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]]);}logger[_0xc076('0x22')](_0xc076('0x2e'),_0x41df55[_0xc076('0x15')],util[_0xc076('0x16')](this['channels'][_0x41df55[_0xc076('0x15')]],{'showHidden':![],'depth':null}));this[_0xc076('0x13')](_0xc076('0x23'),'voice_outbound_channel:save',this[_0xc076('0x7')][_0x41df55[_0xc076('0x15')]]);}}}catch(_0x3c580f){logger['error']('[%s][voiceDialReport][dialend]',_0x41df55[_0xc076('0x15')],util[_0xc076('0x16')](_0x3c580f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc076('0x12')]['syncVarSet']=function(_0x4d755f){try{if(this[_0xc076('0x10')](_0x4d755f)){logger[_0xc076('0x22')](_0xc076('0x2f'),_0x4d755f[_0xc076('0x15')],util[_0xc076('0x16')](_0x4d755f,{'showHidden':![],'depth':null}));this[_0xc076('0x30')](_0x4d755f['uniqueid'],_[_0xc076('0x31')](_0x4d755f[_0xc076('0x32')])[0x0],_0x4d755f[_0xc076('0x33')]);if(this['isNotNull'](_0x4d755f[_0xc076('0x32')])&&this[_0xc076('0x10')](_0x4d755f[_0xc076('0x32')][_0xc076('0x34')])){if(_[_0xc076('0x11')](this[_0xc076('0x7')][_0x4d755f['uniqueid']])){this['channels'][_0x4d755f[_0xc076('0x15')]]={'routeId':_0x4d755f[_0xc076('0x33')],'variables':this[_0xc076('0xa')][_0x4d755f[_0xc076('0x15')]],'motionChannel':_0xc076('0x35')};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x4d755f[_0xc076('0x15')],_0x4d755f[_0xc076('0x32')]['outboundrouteid'],_[_0xc076('0x31')](_0x4d755f[_0xc076('0x32')])[0x0],_0x4d755f[_0xc076('0x33')]);logger['debug'](_0xc076('0x36'),_0x4d755f[_0xc076('0x15')],util['inspect'](this['channels'][_0x4d755f[_0xc076('0x15')]],{'showHidden':![],'depth':null}));this[_0xc076('0x13')](_0xc076('0x23'),_0xc076('0x24'),this['channels'][_0x4d755f[_0xc076('0x15')]]);}}}}catch(_0x33dc5f){logger[_0xc076('0x25')](_0xc076('0x37'),_0x4d755f['uniqueid'],util[_0xc076('0x16')](_0x33dc5f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc076('0x12')][_0xc076('0x30')]=function(_0x9e9eec,_0x5e7d92,_0x315db1){var _0x1fe081=[_0xc076('0x38'),_0xc076('0x39'),_0xc076('0x3a'),_0xc076('0x3b'),_0xc076('0x3c'),_0xc076('0x3d'),_0xc076('0x3e'),_0xc076('0x3f'),_0xc076('0x40'),_0xc076('0x41'),_0xc076('0x42'),_0xc076('0x43'),_0xc076('0x44'),_0xc076('0x45'),_0xc076('0x46'),'memberlastcall',_0xc076('0x20'),'memberpenalty','memberrealtime'];if(!_[_0xc076('0x47')](_0x5e7d92)&&!_[_0xc076('0x48')](_0x1fe081,_0x5e7d92)){if(_[_0xc076('0x11')](this[_0xc076('0xa')][_0x9e9eec])){this[_0xc076('0xa')][_0x9e9eec]={};}this[_0xc076('0xa')][_0x9e9eec][_0x5e7d92]=_0x315db1;}};VoiceDialReport[_0xc076('0x12')][_0xc076('0x49')]=function(_0x3f9919){try{if(this[_0xc076('0x10')](_0x3f9919)){logger[_0xc076('0x22')](_0xc076('0x4a'),_0x3f9919[_0xc076('0x15')],util['inspect'](_0x3f9919,{'showHidden':![],'depth':null}));if(this['channels'][_0x3f9919[_0xc076('0x15')]]){logger[_0xc076('0x1f')](_0xc076('0x4b'),_0x3f9919[_0xc076('0x15')],_0x3f9919[_0xc076('0x4c')]);this[_0xc076('0x7')][_0x3f9919['uniqueid']][_0xc076('0x4d')]=moment()['format'](_0xc076('0x19'));this['channels'][_0x3f9919['uniqueid']][_0xc076('0x4e')]=moment(this['channels'][_0x3f9919[_0xc076('0x15')]][_0xc076('0x4d')])[_0xc076('0x4f')](this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x50')],_0xc076('0x51'));this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x2b')]=_0xc076('0x52');this['outbound'][_0xc076('0x53')]+=0x1;if(this[_0xc076('0x7')][_0x3f9919['uniqueid']]['answertime']){this[_0xc076('0x8')]['answered']+=0x1;this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x54')]=moment(this['channels'][_0x3f9919['uniqueid']][_0xc076('0x2a')])[_0xc076('0x4f')](this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x50')],_0xc076('0x51'));this[_0xc076('0x7')][_0x3f9919['uniqueid']][_0xc076('0x55')]=moment(this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x4d')])['diff'](this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x2a')],_0xc076('0x51'));this[_0xc076('0x8')]['sumHoldTime']+=this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]][_0xc076('0x54')]||0x0;this[_0xc076('0x8')][_0xc076('0x56')]+=this[_0xc076('0x7')][_0x3f9919['uniqueid']][_0xc076('0x55')];}this['outbound']['sumDuration']+=this['channels'][_0x3f9919[_0xc076('0x15')]][_0xc076('0x4e')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x3f9919[_0xc076('0x15')],util['inspect'](this[_0xc076('0x7')][_0x3f9919['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xc076('0x13')](_0xc076('0x57'),this['channels'][_0x3f9919[_0xc076('0x15')]]);logger[_0xc076('0x22')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x3f9919[_0xc076('0x15')],util[_0xc076('0x16')](this['channels'][_0x3f9919[_0xc076('0x15')]],{'showHidden':![],'depth':null}));ami[_0xc076('0x13')](_0xc076('0x58'),this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]]);logger[_0xc076('0x22')](_0xc076('0x59'),_0x3f9919[_0xc076('0x15')],util['inspect'](this['channels'][_0x3f9919[_0xc076('0x15')]],{'showHidden':![],'depth':null}));this['emit'](_0xc076('0x23'),_0xc076('0x5a'),this['outbound']);logger[_0xc076('0x1f')](_0xc076('0x5b'),JSON[_0xc076('0x5c')](this['channels'][_0x3f9919[_0xc076('0x15')]]));logger[_0xc076('0x22')](_0xc076('0x5d'),_0x3f9919[_0xc076('0x15')],util[_0xc076('0x16')](this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]],{'showHidden':![],'depth':null}));this[_0xc076('0x13')](_0xc076('0x23'),'voice_outbound_channel:remove',this[_0xc076('0x7')][_0x3f9919[_0xc076('0x15')]]);this[_0xc076('0x5e')](_0x3f9919[_0xc076('0x15')]);}else if(this[_0xc076('0x7')][_0x3f9919[_0xc076('0x5f')]]){this[_0xc076('0x7')][_0x3f9919[_0xc076('0x5f')]][_0xc076('0x15')]=this[_0xc076('0x7')][_0x3f9919[_0xc076('0x5f')]][_0xc076('0x60')];}if(this['variables'][_0x3f9919[_0xc076('0x15')]]){delete this[_0xc076('0xa')][_0x3f9919[_0xc076('0x15')]];}}}catch(_0x2d8887){logger[_0xc076('0x25')](_0xc076('0x61'),_0x3f9919[_0xc076('0x15')],util['inspect'](_0x2d8887,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc076('0x12')][_0xc076('0x62')]=function(_0x4ffd18){try{if(this[_0xc076('0x10')](_0x4ffd18)){logger[_0xc076('0x22')](_0xc076('0x63'),_0x4ffd18[_0xc076('0x15')],util[_0xc076('0x16')](_0x4ffd18,{'showHidden':![],'depth':null}));if(_0x4ffd18[_0xc076('0x64')][_0xc076('0x65')]()==='set'){_0x4ffd18[_0xc076('0x66')]=(_0x4ffd18[_0xc076('0x67')]||_0x4ffd18[_0xc076('0x66')])['toLowerCase']();if(_['startsWith'](_0x4ffd18[_0xc076('0x66')],'cdr(')){if(_['isUndefined'](this[_0xc076('0x9')][_0x4ffd18['uniqueid']]))this[_0xc076('0x9')][_0x4ffd18[_0xc076('0x15')]]={};logger['info']('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x4ffd18['uniqueid'],_0x4ffd18[_0xc076('0x64')],_0x4ffd18[_0xc076('0x66')]);var _0x416448=_0x4ffd18[_0xc076('0x66')][_0xc076('0x68')]('=');var _0x3f906a=_0x416448[0x0][_0xc076('0x69')](/cdr\((.*)\)/);if(_0x3f906a)this[_0xc076('0x9')][_0x4ffd18[_0xc076('0x15')]][_0x3f906a[0x1]]=_0x416448[0x1];}}}}catch(_0x39b4f4){logger[_0xc076('0x25')](_0xc076('0x6a'),_0x4ffd18[_0xc076('0x15')],util[_0xc076('0x16')](_0x39b4f4,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xc076('0x5e')]=function(_0x2d74a7,_0x2e8aa2=0x2710){if(this[_0xc076('0x7')][_0x2d74a7]){setTimeout(()=>{delete this[_0xc076('0x7')][_0x2d74a7];},_0x2e8aa2);}};module[_0xc076('0x6b')]=VoiceDialReport; \ No newline at end of file +var _0xf3ac=['deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','application','toLowerCase','applicationdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','merge','channels','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','isNotNull','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','lastevent','connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','complete','total','answertime','diff','seconds','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xf3ac,0x89));var _0xcf3a=function(_0x55b383,_0x483b43){_0x55b383=_0x55b383-0x0;var _0x407abf=_0xf3ac[_0x55b383];return _0x407abf;};'use strict';var _=require('lodash');var moment=require(_0xcf3a('0x0'));var util=require(_0xcf3a('0x1'));var Redis=require('ioredis');var config=require(_0xcf3a('0x2'));var logger=require(_0xcf3a('0x3'))('ami');var ami=require('../ami');config['redis']=_[_0xcf3a('0x4')](config[_0xcf3a('0x5')],{'host':_0xcf3a('0x6'),'port':0x18eb});var io=require(_0xcf3a('0x7'))(new Redis(config['redis']));function VoiceDialReport(_0x5f10b6){this['channels']=_0x5f10b6[_0xcf3a('0x8')];this[_0xcf3a('0x9')]=_0x5f10b6[_0xcf3a('0x9')];this[_0xcf3a('0xa')]={};this['variables']={};ami['on'](_0xcf3a('0xb'),this[_0xcf3a('0xc')][_0xcf3a('0xd')](this));ami['on'](_0xcf3a('0xe'),this[_0xcf3a('0xf')][_0xcf3a('0xd')](this));ami['on'](_0xcf3a('0x10'),this[_0xcf3a('0x11')][_0xcf3a('0xd')](this));ami['on'](_0xcf3a('0x12'),this[_0xcf3a('0x13')][_0xcf3a('0xd')](this));}VoiceDialReport[_0xcf3a('0x14')]['isNotNull']=function(_0x3d58d1){return _0x3d58d1!==null&&!_[_0xcf3a('0x15')](_0x3d58d1);};VoiceDialReport[_0xcf3a('0x14')][_0xcf3a('0x16')]=function(_0xb519a0,_0x8f186f,_0x15c505){io['to'](_0xb519a0)[_0xcf3a('0x16')](_0x8f186f,_0x15c505);};VoiceDialReport[_0xcf3a('0x14')]['syncDialBegin']=function(_0x2e6960){try{if(this['isNotNull'](_0x2e6960)){logger[_0xcf3a('0x17')](_0xcf3a('0x18'),_0x2e6960['uniqueid'],util[_0xcf3a('0x19')](_0x2e6960,{'showHidden':![],'depth':null}));if(this['channels'][_0x2e6960['uniqueid']]){_[_0xcf3a('0x1a')](this[_0xcf3a('0x1b')][_0x2e6960[_0xcf3a('0x1c')]],{'starttime':moment()[_0xcf3a('0x1d')](_0xcf3a('0x1e')),'lastevent':_0xcf3a('0x1f'),'interface':_0x2e6960[_0xcf3a('0x20')]['substring'](0x0,_0x2e6960['channel'][_0xcf3a('0x21')]('-')),'membername':_0x2e6960[_0xcf3a('0x20')]['substring'](_0x2e6960['channel']['lastIndexOf']('/')+0x1,_0x2e6960['channel'][_0xcf3a('0x21')]('-'))},_[_0xcf3a('0x22')](_0x2e6960,[_0xcf3a('0x23'),_0xcf3a('0x24')]));logger[_0xcf3a('0x25')](_0xcf3a('0x26'),_0x2e6960[_0xcf3a('0x1c')],this[_0xcf3a('0x1b')][_0x2e6960['uniqueid']][_0xcf3a('0x27')],this[_0xcf3a('0x1b')][_0x2e6960[_0xcf3a('0x1c')]][_0xcf3a('0x28')]);logger[_0xcf3a('0x17')](_0xcf3a('0x29'),_0x2e6960[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](this['channels'][_0x2e6960[_0xcf3a('0x1c')]],{'showHidden':![],'depth':null}));if(this[_0xcf3a('0xa')][_0x2e6960[_0xcf3a('0x1c')]])_[_0xcf3a('0x1a')](this[_0xcf3a('0x1b')][_0x2e6960[_0xcf3a('0x1c')]],this[_0xcf3a('0xa')][_0x2e6960['uniqueid']]);this[_0xcf3a('0x16')](_0xcf3a('0x2a'),_0xcf3a('0x2b'),this[_0xcf3a('0x1b')][_0x2e6960[_0xcf3a('0x1c')]]);logger['debug'](_0xcf3a('0x2c'),_0x2e6960[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](this[_0xcf3a('0x1b')][_0x2e6960[_0xcf3a('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xcf3a('0x16')](_0xcf3a('0x2d'),this['channels'][_0x2e6960[_0xcf3a('0x1c')]]);}}}catch(_0x4ecafa){logger[_0xcf3a('0x2e')](_0xcf3a('0x2f'),_0x2e6960[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](_0x4ecafa,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf3a('0x14')][_0xcf3a('0xf')]=function(_0x30ae38){try{if(this[_0xcf3a('0x30')](_0x30ae38)){logger[_0xcf3a('0x17')](_0xcf3a('0x31'),_0x30ae38['uniqueid'],util[_0xcf3a('0x19')](_0x30ae38,{'showHidden':![],'depth':null}));if(this[_0xcf3a('0x1b')][_0x30ae38[_0xcf3a('0x1c')]]){this['channels'][_0x30ae38[_0xcf3a('0x1c')]][_0xcf3a('0x32')]=_0x30ae38[_0xcf3a('0x32')];if(_0x30ae38[_0xcf3a('0x32')]==='ANSWER'){this[_0xcf3a('0x1b')][_0x30ae38[_0xcf3a('0x1c')]][_0xcf3a('0x33')]=_0x30ae38['connectedlinenum'];this[_0xcf3a('0x1b')][_0x30ae38[_0xcf3a('0x1c')]][_0xcf3a('0x34')]=_0x30ae38['connectedlinename'];this[_0xcf3a('0x1b')][_0x30ae38[_0xcf3a('0x1c')]]['answertime']=moment()[_0xcf3a('0x1d')](_0xcf3a('0x1e'));this[_0xcf3a('0x1b')][_0x30ae38['uniqueid']][_0xcf3a('0x35')]=_0xcf3a('0x36');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x30ae38[_0xcf3a('0x1c')],_0x30ae38[_0xcf3a('0x20')][_0xcf3a('0x37')](_0x30ae38['channel'][_0xcf3a('0x21')]('/')+0x1,_0x30ae38[_0xcf3a('0x20')][_0xcf3a('0x21')]('-')));logger[_0xcf3a('0x17')](_0xcf3a('0x38'),_0x30ae38[_0xcf3a('0x1c')],util['inspect'](this[_0xcf3a('0x1b')][_0x30ae38['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xcf3a('0x16')]('custom:dialconnect',this[_0xcf3a('0x1b')][_0x30ae38[_0xcf3a('0x1c')]]);}logger['debug'](_0xcf3a('0x39'),_0x30ae38[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](this[_0xcf3a('0x1b')][_0x30ae38[_0xcf3a('0x1c')]],{'showHidden':![],'depth':null}));this[_0xcf3a('0x16')](_0xcf3a('0x2a'),_0xcf3a('0x2b'),this[_0xcf3a('0x1b')][_0x30ae38[_0xcf3a('0x1c')]]);}}}catch(_0x3f5ae4){logger[_0xcf3a('0x2e')](_0xcf3a('0x3a'),_0x30ae38[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](_0x3f5ae4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf3a('0x14')][_0xcf3a('0x11')]=function(_0x53ec9f){try{if(this[_0xcf3a('0x30')](_0x53ec9f)){logger[_0xcf3a('0x17')](_0xcf3a('0x3b'),_0x53ec9f[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](_0x53ec9f,{'showHidden':![],'depth':null}));this[_0xcf3a('0x3c')](_0x53ec9f['uniqueid'],_['keys'](_0x53ec9f[_0xcf3a('0x3d')])[0x0],_0x53ec9f[_0xcf3a('0x3e')]);if(this[_0xcf3a('0x30')](_0x53ec9f['variable'])&&this['isNotNull'](_0x53ec9f[_0xcf3a('0x3d')][_0xcf3a('0x3f')])){if(_['isUndefined'](this['channels'][_0x53ec9f[_0xcf3a('0x1c')]])){this['channels'][_0x53ec9f[_0xcf3a('0x1c')]]={'routeId':_0x53ec9f['value'],'variables':this[_0xcf3a('0x40')][_0x53ec9f[_0xcf3a('0x1c')]],'motionChannel':_0xcf3a('0x41')};logger[_0xcf3a('0x25')](_0xcf3a('0x42'),_0x53ec9f[_0xcf3a('0x1c')],_0x53ec9f[_0xcf3a('0x3d')][_0xcf3a('0x3f')],_[_0xcf3a('0x43')](_0x53ec9f[_0xcf3a('0x3d')])[0x0],_0x53ec9f['value']);logger['debug'](_0xcf3a('0x44'),_0x53ec9f['uniqueid'],util[_0xcf3a('0x19')](this[_0xcf3a('0x1b')][_0x53ec9f[_0xcf3a('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0xcf3a('0x2a'),_0xcf3a('0x2b'),this[_0xcf3a('0x1b')][_0x53ec9f[_0xcf3a('0x1c')]]);}}}}catch(_0x4c840a){logger[_0xcf3a('0x2e')](_0xcf3a('0x45'),_0x53ec9f[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](_0x4c840a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf3a('0x14')][_0xcf3a('0x3c')]=function(_0x25e9f5,_0x1cbbf6,_0x256252){var _0x4fd08f=[_0xcf3a('0x46'),_0xcf3a('0x47'),_0xcf3a('0x48'),_0xcf3a('0x49'),_0xcf3a('0x4a'),'rtpaudioqoslossbridged',_0xcf3a('0x4b'),'rtpaudioqosrttbridged',_0xcf3a('0x4c'),_0xcf3a('0x4d'),_0xcf3a('0x4e'),'bridgepvtcallid',_0xcf3a('0x4f'),_0xcf3a('0x50'),_0xcf3a('0x51'),'memberlastcall',_0xcf3a('0x27'),_0xcf3a('0x52'),_0xcf3a('0x53')];if(!_[_0xcf3a('0x54')](_0x1cbbf6)&&!_[_0xcf3a('0x55')](_0x4fd08f,_0x1cbbf6)){if(_[_0xcf3a('0x15')](this[_0xcf3a('0x40')][_0x25e9f5])){this[_0xcf3a('0x40')][_0x25e9f5]={};}this[_0xcf3a('0x40')][_0x25e9f5][_0x1cbbf6]=_0x256252;}};VoiceDialReport[_0xcf3a('0x14')][_0xcf3a('0x13')]=function(_0x57eece){try{if(this[_0xcf3a('0x30')](_0x57eece)){logger[_0xcf3a('0x17')](_0xcf3a('0x56'),_0x57eece[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](_0x57eece,{'showHidden':![],'depth':null}));if(this[_0xcf3a('0x1b')][_0x57eece['uniqueid']]){logger[_0xcf3a('0x25')](_0xcf3a('0x57'),_0x57eece[_0xcf3a('0x1c')],_0x57eece['cause-txt']);this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x58')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x59')]=moment(this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x58')])['diff'](this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x5a')],'seconds');this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x35')]=_0xcf3a('0x5b');this[_0xcf3a('0x9')][_0xcf3a('0x5c')]+=0x1;if(this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x5d')]){this['outbound']['answered']+=0x1;this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]]['holdtime']=moment(this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x5d')])[_0xcf3a('0x5e')](this[_0xcf3a('0x1b')][_0x57eece['uniqueid']]['starttime'],_0xcf3a('0x5f'));this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]]['billableseconds']=moment(this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x58')])['diff'](this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x5d')],_0xcf3a('0x5f'));this[_0xcf3a('0x9')][_0xcf3a('0x60')]+=this['channels'][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x61')]||0x0;this[_0xcf3a('0x9')][_0xcf3a('0x62')]+=this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]]['billableseconds'];}this[_0xcf3a('0x9')][_0xcf3a('0x63')]+=this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]][_0xcf3a('0x59')];logger[_0xcf3a('0x17')](_0xcf3a('0x64'),_0x57eece[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](this['channels'][_0x57eece[_0xcf3a('0x1c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]]);logger['debug'](_0xcf3a('0x65'),_0x57eece[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xcf3a('0x16')](_0xcf3a('0x66'),this[_0xcf3a('0x1b')][_0x57eece['uniqueid']]);logger[_0xcf3a('0x17')](_0xcf3a('0x67'),_0x57eece[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](this[_0xcf3a('0x1b')][_0x57eece['uniqueid']],{'showHidden':![],'depth':null}));this[_0xcf3a('0x16')]('voice:outbound',_0xcf3a('0x68'),this[_0xcf3a('0x9')]);logger[_0xcf3a('0x25')](_0xcf3a('0x69'),JSON[_0xcf3a('0x6a')](this['channels'][_0x57eece[_0xcf3a('0x1c')]]));logger[_0xcf3a('0x17')](_0xcf3a('0x6b'),_0x57eece['uniqueid'],util[_0xcf3a('0x19')](this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x1c')]],{'showHidden':![],'depth':null}));this[_0xcf3a('0x16')](_0xcf3a('0x2a'),_0xcf3a('0x6c'),this[_0xcf3a('0x1b')][_0x57eece['uniqueid']]);this[_0xcf3a('0x6d')](_0x57eece[_0xcf3a('0x1c')]);}else if(this[_0xcf3a('0x1b')][_0x57eece[_0xcf3a('0x6e')]]){this[_0xcf3a('0x1b')][_0x57eece['linkedid']]['uniqueid']=this[_0xcf3a('0x1b')][_0x57eece['linkedid']][_0xcf3a('0x6f')];}if(this['variables'][_0x57eece['uniqueid']]){delete this[_0xcf3a('0x40')][_0x57eece[_0xcf3a('0x1c')]];}}}catch(_0x3bb726){logger[_0xcf3a('0x2e')](_0xcf3a('0x70'),_0x57eece[_0xcf3a('0x1c')],util['inspect'](_0x3bb726,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf3a('0x14')][_0xcf3a('0x71')]=function(_0x357917){try{if(this[_0xcf3a('0x30')](_0x357917)){logger[_0xcf3a('0x17')]('[%s][voiceDialReport][newexten]\x20event:',_0x357917[_0xcf3a('0x1c')],util['inspect'](_0x357917,{'showHidden':![],'depth':null}));if(_0x357917[_0xcf3a('0x72')][_0xcf3a('0x73')]()==='set'){_0x357917[_0xcf3a('0x74')]=(_0x357917['appdata']||_0x357917[_0xcf3a('0x74')])[_0xcf3a('0x73')]();if(_[_0xcf3a('0x75')](_0x357917[_0xcf3a('0x74')],_0xcf3a('0x76'))){if(_[_0xcf3a('0x15')](this[_0xcf3a('0xa')][_0x357917['uniqueid']]))this[_0xcf3a('0xa')][_0x357917[_0xcf3a('0x1c')]]={};logger[_0xcf3a('0x25')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x357917[_0xcf3a('0x1c')],_0x357917['application'],_0x357917[_0xcf3a('0x74')]);var _0x5deb8a=_0x357917[_0xcf3a('0x74')][_0xcf3a('0x77')]('=');var _0x5d8610=_0x5deb8a[0x0][_0xcf3a('0x78')](/cdr\((.*)\)/);if(_0x5d8610)this[_0xcf3a('0xa')][_0x357917[_0xcf3a('0x1c')]][_0x5d8610[0x1]]=_0x5deb8a[0x1];}}}}catch(_0xf52b26){logger[_0xcf3a('0x2e')](_0xcf3a('0x79'),_0x357917[_0xcf3a('0x1c')],util[_0xcf3a('0x19')](_0xf52b26,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf3a('0x14')][_0xcf3a('0x6d')]=function(_0x37cefc,_0x1149c0=0x2710){if(this[_0xcf3a('0x1b')][_0x37cefc]){setTimeout(()=>{delete this['channels'][_0x37cefc];},_0x1149c0);}};module[_0xcf3a('0x7a')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index e2020a1..3ff8a4b 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fdc=['queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','originated','isEmpty','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','switch','isNil','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','agents','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','Action','queues','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','summaryEvent','createReport','compareToInboundQueue','assign','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','completeEvent','debug','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','variable','value','CONTINUE','TIMEOUT','lastevent','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','length','sumHoldTime','diff','sumDuration','milliseconds','total','sumBillable','unmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','transferid','handleHangup','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transfereeuniqueid','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','secondtransfererexten','[%s][voiceQueueReport][attendedtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','[%s][voiceQueueReport][newexten]','exports','util','ioredis','../../../config/environment','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','channels','queueChannels','voiceQueues','campaigns','summary','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','syncQueueMember'];(function(_0x5f53ab,_0x324327){var _0x116166=function(_0x2e8e6a){while(--_0x2e8e6a){_0x5f53ab['push'](_0x5f53ab['shift']());}};_0x116166(++_0x324327);}(_0x6fdc,0xd7));var _0xc6fd=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x6fdc[_0x11f249];return _0x5c3656;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xc6fd('0x0'));var Redis=require(_0xc6fd('0x1'));var config=require(_0xc6fd('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0xc6fd('0x3'));var QueueReport=require(_0xc6fd('0x4'));var VoiceQueueSummary=require(_0xc6fd('0x5'));config[_0xc6fd('0x6')]=_[_0xc6fd('0x7')](config[_0xc6fd('0x6')],{'host':_0xc6fd('0x8'),'port':0x18eb});var io=require(_0xc6fd('0x9'))(new Redis(config[_0xc6fd('0x6')]));var Sequence=function(){};Sequence[_0xc6fd('0xa')][_0xc6fd('0xb')]=function(_0x25d23c){this['tail']=this['tail']?this[_0xc6fd('0xc')][_0xc6fd('0xd')](_0x25d23c):_0x25d23c();};function VoiceQueueReport(_0x336a99){this[_0xc6fd('0xe')]=new Sequence();this[_0xc6fd('0xf')]={};this[_0xc6fd('0x10')]=_0x336a99;this['agents']=_0x336a99['agents'];this[_0xc6fd('0x11')]=_0x336a99[_0xc6fd('0x12')];this[_0xc6fd('0x13')]=_0x336a99[_0xc6fd('0x13')];this[_0xc6fd('0x14')]=_0x336a99['campaigns'];this[_0xc6fd('0x15')]=initializeSummary();this['variables']={};ami['on'](_0xc6fd('0x16'),this[_0xc6fd('0x17')]['bind'](this));ami['on'](_0xc6fd('0x18'),this[_0xc6fd('0x19')][_0xc6fd('0x1a')](this));ami['on']('queuemember',this[_0xc6fd('0x1b')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x1c'),this['syncQueueStatusComplete'][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x1d'),this[_0xc6fd('0x1e')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x1f'),this[_0xc6fd('0x20')][_0xc6fd('0x1a')](this));ami['on']('queuecallerleave',this[_0xc6fd('0x21')][_0xc6fd('0x1a')](this));ami['on']('agentcomplete',this[_0xc6fd('0x22')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x23'),this[_0xc6fd('0x24')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x25'),this[_0xc6fd('0x26')][_0xc6fd('0x1a')](this));ami['on']('hangup',this[_0xc6fd('0x27')][_0xc6fd('0x1a')](this));ami['on']('fullybooted',this[_0xc6fd('0x28')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x29'),this[_0xc6fd('0x2a')]['bind'](this));ami['on']('musiconholdstop',this[_0xc6fd('0x2b')][_0xc6fd('0x1a')](this));ami['on'](_0xc6fd('0x2c'),this[_0xc6fd('0x2d')][_0xc6fd('0x1a')](this));ami['on']('blindtransfer',this[_0xc6fd('0x2e')][_0xc6fd('0x1a')](this));this[_0xc6fd('0x2f')]();this[_0xc6fd('0x30')]();}function clearChannels(_0x3d3f87){if(!_['isEmpty'](_0x3d3f87)){for(var _0x583c5d in _0x3d3f87){if(_0x3d3f87[_0xc6fd('0x31')](_0x583c5d)){delete _0x3d3f87[_0x583c5d];}}}}function clearCampaigns(_0x3341d2){if(!_['isEmpty'](_0x3341d2)){for(var _0x425bc2 in _0x3341d2){if(_0x3341d2[_0xc6fd('0x31')](_0x425bc2)){_0x3341d2[_0x425bc2][_0xc6fd('0x32')]=0x0;}}}}function clearVoiceQueues(_0x954132){if(!_[_0xc6fd('0x33')](_0x954132)){for(var _0x19ffb7 in _0x954132){if(_0x954132[_0xc6fd('0x31')](_0x19ffb7)){_0x954132[_0x19ffb7][_0xc6fd('0x32')]=0x0;_0x954132[_0x19ffb7][_0xc6fd('0x34')]=0x0;_0x954132[_0x19ffb7][_0xc6fd('0x35')]=0x0;_0x954132[_0x19ffb7][_0xc6fd('0x36')]=0x0;_0x954132[_0x19ffb7][_0xc6fd('0x37')]=!![];}}}}function clearAgentBooked(_0x5118aa){if(!_[_0xc6fd('0x33')](_0x5118aa)){for(var _0x38ab0d in _0x5118aa){if(_0x5118aa[_0xc6fd('0x31')](_0x38ab0d)){_0x5118aa[_0x38ab0d][_0xc6fd('0x38')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x397088){return _0x397088[_0xc6fd('0x39')]||_0x397088[_0xc6fd('0x1f')]||_0x397088[_0xc6fd('0x3a')];}VoiceQueueReport[_0xc6fd('0xa')]['clearZombieChannels']=function(){var _0x43b18c=this;for(var _0x2c9712 in this[_0xc6fd('0x11')]){if(this[_0xc6fd('0x11')][_0xc6fd('0x31')](_0x2c9712)&&!this[_0xc6fd('0x11')][_0x2c9712][_0xc6fd('0x3b')]){this[_0xc6fd('0xe')][_0xc6fd('0xb')](function(){if(!_[_0xc6fd('0x3c')](_0x43b18c[_0xc6fd('0x11')][_0x2c9712])){return ami['Action']({'action':'status','channel':_0x43b18c[_0xc6fd('0x11')][_0x2c9712]['channel']})[_0xc6fd('0x3d')](function(_0x1523be){if(_0x1523be[_0xc6fd('0x3e')]===_0xc6fd('0x3f')){setTimeout(function(){if(_0x43b18c[_0xc6fd('0x11')][_0x2c9712]){delete _0x43b18c[_0xc6fd('0x11')][_0x2c9712];logger[_0xc6fd('0x40')](_0xc6fd('0x41'),_0x2c9712,util[_0xc6fd('0x42')](_0x1523be,{'showHidden':![],'depth':null}));}if(_0x43b18c[_0xc6fd('0xf')][_0x2c9712]){delete _0x43b18c[_0xc6fd('0xf')][_0x2c9712];logger['error'](_0xc6fd('0x43'),_0x2c9712,util[_0xc6fd('0x42')](_0x1523be,{'showHidden':![],'depth':null}));}if(_0x43b18c[_0xc6fd('0x44')][_0x2c9712]){delete _0x43b18c['variables'][_0x2c9712];logger[_0xc6fd('0x40')](_0xc6fd('0x45'),_0x2c9712,util['inspect'](_0x1523be,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x28')]=function(){logger[_0xc6fd('0x40')](_0xc6fd('0x46'));clearChannels(this[_0xc6fd('0x11')]);this[_0xc6fd('0x47')](this['queueReports']);clearAgentBooked(this[_0xc6fd('0x48')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xc6fd('0x14')]);this[_0xc6fd('0x15')]=initializeSummary();};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x47')]=function(_0x4744b6){var _0x761d73=this;if(!_[_0xc6fd('0x33')](_0x4744b6)){for(var _0x4e8ef6 in _0x4744b6){if(_0x4744b6[_0xc6fd('0x31')](_0x4e8ef6)){_0x761d73[_0xc6fd('0x49')](_0x4744b6[_0x4e8ef6],'clearqueuereport');delete _0x4744b6[_0x4e8ef6];}}}};VoiceQueueReport['prototype'][_0xc6fd('0x4a')]=function(_0x261abd,_0x238a2b,_0x190ba0){io['to'](_0x261abd)[_0xc6fd('0x4a')](_0x238a2b,_0x190ba0);};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x4b')]=function(_0x4231ce,_0x53d155){logger['debug'](_0xc6fd('0x4c')+_0x53d155+_0xc6fd('0x4d'),_0x4231ce[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x4231ce,{'showHidden':![],'depth':null}));this[_0xc6fd('0x4a')](util[_0xc6fd('0x4f')](_0xc6fd('0x50'),_0x4231ce[_0xc6fd('0x51')]),_0xc6fd('0x52'),_0x4231ce);io['emit']('voice_queue_presence:save',_0x4231ce);};VoiceQueueReport['prototype'][_0xc6fd('0x49')]=function(_0xb14baa,_0x4dc380){logger['debug'](_0xc6fd('0x4c')+_0x4dc380+_0xc6fd('0x53'),_0xb14baa[_0xc6fd('0x4e')],util['inspect'](_0xb14baa,{'showHidden':![],'depth':null}));if(_0xb14baa[_0xc6fd('0x54')]===_0xc6fd('0x55')){return;}this[_0xc6fd('0x4a')](util[_0xc6fd('0x4f')](_0xc6fd('0x50'),_0xb14baa['queue']),_0xc6fd('0x56'),_0xb14baa);io[_0xc6fd('0x4a')](_0xc6fd('0x57'),_0xb14baa);};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x58')]=function(_0x463bcf){if(_0x463bcf[_0xc6fd('0x59')]===_0xc6fd('0x5a')){logger['debug'](_0xc6fd('0x5b'),util[_0xc6fd('0x42')](_0x463bcf,{'showHidden':![],'depth':null}));this['emit'](util[_0xc6fd('0x4f')]('voice:queue:%s',_0x463bcf[_0xc6fd('0x5c')]),_0xc6fd('0x5d'),_0x463bcf);}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x5e')]=function(_0xae8771){return _0xae8771!==null&&!_[_0xc6fd('0x5f')](_0xae8771);};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x30')]=function(){var _0x51f5ca=this;setInterval(function(){_0x51f5ca[_0xc6fd('0x60')]();ami[_0xc6fd('0x61')]({'action':_0xc6fd('0x62')})[_0xc6fd('0x3d')](function(_0x264add){logger[_0xc6fd('0x40')](_0xc6fd('0x63'),util[_0xc6fd('0x42')](_0x264add,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xc6fd('0xa')]['loopQueueSummary']=function(){var _0x49bf71=this;setInterval(function(){if(!_0x49bf71[_0xc6fd('0x15')][_0xc6fd('0x64')]){return ami[_0xc6fd('0x61')]({'action':'queuesummary'})[_0xc6fd('0x65')](function(_0x57374f){_0x49bf71[_0xc6fd('0x15')]['id']=_0x57374f[_0xc6fd('0x66')];_0x49bf71[_0xc6fd('0x15')]['isRunning']=!![];_0x49bf71[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x57374f['actionid']]={};})[_0xc6fd('0x3d')](function(_0x427b32){logger[_0xc6fd('0x40')](_0xc6fd('0x68'),util[_0xc6fd('0x42')](_0x427b32,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xc6fd('0xa')]['createQueueSummaryReport']=function(_0x468f99,_0x1f9f3d){var _0x1ed0c1;if(this['summary']&&this[_0xc6fd('0x15')][_0xc6fd('0x62')]&&this[_0xc6fd('0x15')][_0xc6fd('0x62')][_0x468f99['name']]){_0x1ed0c1=this[_0xc6fd('0x15')][_0xc6fd('0x62')][_0x468f99[_0xc6fd('0x5c')]][_0xc6fd('0x69')];}var _0x35a2b6=new VoiceQueueSummary(_0x468f99);return _0x35a2b6[_0xc6fd('0x6a')](_0x1f9f3d['agents'],this[_0xc6fd('0x48')],_0x1ed0c1,this[_0xc6fd('0x10')][_0xc6fd('0x11')]);};VoiceQueueReport[_0xc6fd('0xa')]['handleInboundQueueSummaryReport']=function(_0x58fe43,_0x27bbb1){var _0x52246c=this['createQueueSummaryReport'](_0x58fe43,_0x27bbb1);var _0x1c7849=![];_0x1c7849=_0x52246c[_0xc6fd('0x6b')](_0x58fe43);if(_0x1c7849){Object[_0xc6fd('0x6c')](_0x58fe43,_0x52246c);this[_0xc6fd('0x10')][_0xc6fd('0x13')][_0x58fe43[_0xc6fd('0x5c')]]=_0x58fe43;this['emitInboundVoiceQueueSummary'](_0x52246c);}};VoiceQueueReport[_0xc6fd('0xa')]['syncQueueStatusComplete']=function(_0x7f33a3){var _0x4d2a2a=null;var _0x36e613=this[_0xc6fd('0x15')]['id'];if(this[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x36e613]){_0x4d2a2a=this[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x36e613][_0x7f33a3[_0xc6fd('0x66')]];}if(!_0x4d2a2a){this['summary']=initializeSummary();return;}var _0x21befd=this[_0xc6fd('0x13')][_0x4d2a2a[_0xc6fd('0x51')]];if(_0x21befd[_0xc6fd('0x59')]===_0xc6fd('0x5a')){this[_0xc6fd('0x6d')](_0x21befd,_0x4d2a2a);}else if(_0x21befd['type']===_0xc6fd('0x6e')){var _0x41f5f9=this['createQueueSummaryReport'](_0x21befd,_0x4d2a2a);ami[_0xc6fd('0x4a')](_0xc6fd('0x6f'),_0x41f5f9);}this[_0xc6fd('0x15')][_0xc6fd('0x70')]-=0x1;var _0x187c95=this[_0xc6fd('0x15')][_0xc6fd('0x70')]>0x0?!![]:![];if(!_0x187c95){return this[_0xc6fd('0x19')](this[_0xc6fd('0x15')][_0xc6fd('0x71')]);}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x1b')]=function(_0x36c7ba){var _0x132248=this[_0xc6fd('0x15')]['id'];if(this['summary'][_0xc6fd('0x67')][_0x132248]&&this[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x132248][_0x36c7ba[_0xc6fd('0x66')]]){this[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x132248][_0x36c7ba[_0xc6fd('0x66')]]['agents']['push'](_0x36c7ba);}};VoiceQueueReport['prototype'][_0xc6fd('0x17')]=function(_0x17c514){var _0x457bd5=this;try{if(this[_0xc6fd('0x5e')](_0x17c514)&&this[_0xc6fd('0x5e')](_0x17c514['queue'])){logger[_0xc6fd('0x72')](_0xc6fd('0x73'),util[_0xc6fd('0x42')](_0x17c514,{'showHidden':![],'depth':null}));var _0x25d1c8=this['voiceQueues'][_0x17c514[_0xc6fd('0x51')]];if(_0x25d1c8){logger[_0xc6fd('0x72')](_0xc6fd('0x74'),_0x25d1c8[_0xc6fd('0x5c')]);this[_0xc6fd('0x15')]['queues'][_0x25d1c8[_0xc6fd('0x5c')]]={'summaryEvent':_0x17c514};this['summary']['statusRequests']+=0x1;return ami[_0xc6fd('0x61')]({'action':_0xc6fd('0x67'),'queue':_0x25d1c8[_0xc6fd('0x5c')]})[_0xc6fd('0x65')](function(_0x5e9926){if(!_0x457bd5[_0xc6fd('0x15')][_0xc6fd('0x67')][_0x17c514['actionid']]){_0x457bd5['summary']['queuestatus'][_0x17c514[_0xc6fd('0x66')]]={};}_0x457bd5['summary'][_0xc6fd('0x67')][_0x17c514[_0xc6fd('0x66')]][_0x5e9926[_0xc6fd('0x66')]]={'queue':_0x25d1c8['name'],'agents':[]};})[_0xc6fd('0x3d')](function(_0x53d75c){throw _0x53d75c;});}}}catch(_0x2d6eb7){logger[_0xc6fd('0x40')](_0xc6fd('0x68'),util[_0xc6fd('0x42')](_0x2d6eb7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x19')]=function(_0x2e0fa9){if(this[_0xc6fd('0x15')]['statusRequests']>0x0){this[_0xc6fd('0x15')][_0xc6fd('0x71')]=_0x2e0fa9;return;}logger[_0xc6fd('0x72')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xc6fd('0x42')](_0x2e0fa9,{'showHidden':![],'depth':null}));this[_0xc6fd('0x15')]=initializeSummary();ami[_0xc6fd('0x4a')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xc6fd('0xa')]['syncQueueCallerJoin']=function(_0x3c8566){try{if(this[_0xc6fd('0x5e')](_0x3c8566)){logger[_0xc6fd('0x72')](_0xc6fd('0x75'),_0x3c8566[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x3c8566,{'showHidden':![],'depth':null}));if(_[_0xc6fd('0x5f')](this[_0xc6fd('0xf')][_0x3c8566['uniqueid']])){this['queueReports'][_0x3c8566[_0xc6fd('0x4e')]]=[];}if(_['isUndefined'](this[_0xc6fd('0x11')][_0x3c8566['uniqueid']])){this[_0xc6fd('0x11')][_0x3c8566[_0xc6fd('0x4e')]]={};}var _0x1d76b8=new QueueReport();_0x1d76b8['queue']=_0x3c8566[_0xc6fd('0x51')];_0x1d76b8['type']=this[_0xc6fd('0x13')][_0x1d76b8[_0xc6fd('0x51')]]&&this[_0xc6fd('0x13')][_0x1d76b8[_0xc6fd('0x51')]][_0xc6fd('0x59')]?this[_0xc6fd('0x13')][_0x1d76b8['queue']][_0xc6fd('0x59')]||'inbound':'inbound';_0x1d76b8[_0xc6fd('0x76')]=moment()[_0xc6fd('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d76b8[_0xc6fd('0x77')]=_0x3c8566[_0xc6fd('0x77')];_0x1d76b8['count']=_0x3c8566['count'];_0x1d76b8[_0xc6fd('0x4e')]=_0x3c8566[_0xc6fd('0x4e')];logger[_0xc6fd('0x78')](_0xc6fd('0x79'),_0x1d76b8[_0xc6fd('0x51')],_0x1d76b8[_0xc6fd('0x59')]);Object['assign'](_0x1d76b8,_[_0xc6fd('0x7a')](_0x3c8566,_[_0xc6fd('0x7b')](_0x1d76b8)));this[_0xc6fd('0xf')][_0x3c8566[_0xc6fd('0x4e')]]['push'](_0x1d76b8);this[_0xc6fd('0x11')][_0x3c8566[_0xc6fd('0x4e')]]=_0x1d76b8;this[_0xc6fd('0x4b')](_0x1d76b8,_0xc6fd('0x1d'));}}catch(_0x6a9d6a){logger[_0xc6fd('0x40')](_0xc6fd('0x75'),_0x3c8566['uniqueid'],util['inspect'](_0x6a9d6a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x1bbbbe){try{if(this['isNotNull'](_0x1bbbbe)){logger[_0xc6fd('0x72')](_0xc6fd('0x7c'),_0x1bbbbe[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x1bbbbe,{'showHidden':![],'depth':null}));if(this[_0xc6fd('0xf')][_0x1bbbbe[_0xc6fd('0x4e')]]){var _0x19dc59=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x1bbbbe[_0xc6fd('0x4e')]]);_0x19dc59[_0xc6fd('0x3a')]=![];_0x19dc59[_0xc6fd('0x7e')]=null;_0x19dc59[_0xc6fd('0x7f')]=_0x1bbbbe[_0xc6fd('0x7f')];_0x19dc59[_0xc6fd('0x80')]=_0x1bbbbe['originalposition'];_0x19dc59[_0xc6fd('0x1f')]=!![];_0x19dc59[_0xc6fd('0x81')]=moment()[_0xc6fd('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x19dc59['queuecallerexitreason']=_0xc6fd('0x82');_0x19dc59[_0xc6fd('0x83')]=null;logger[_0xc6fd('0x78')](_0xc6fd('0x84'),_0x19dc59['queue'],_0x19dc59[_0xc6fd('0x59')]);this['channels'][_0x1bbbbe[_0xc6fd('0x4e')]]=_0x19dc59;this[_0xc6fd('0x49')](_0x19dc59,_0xc6fd('0x1f'));}}}catch(_0x38adee){logger[_0xc6fd('0x40')](_0xc6fd('0x7c'),_0x1bbbbe[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x38adee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x21')]=function(_0x208e94){try{if(this['isNotNull'](_0x208e94)){logger[_0xc6fd('0x72')](_0xc6fd('0x85'),_0x208e94['uniqueid'],util['inspect'](_0x208e94,{'showHidden':![],'depth':null}));if(this[_0xc6fd('0xf')][_0x208e94[_0xc6fd('0x4e')]]){var _0x44381d=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x208e94['uniqueid']]);_0x44381d['queuecallerleaveAt']=moment()[_0xc6fd('0x4f')](_0xc6fd('0x86'));_0x44381d[_0xc6fd('0x87')]=_0x208e94['connectedlinenum'];_0x44381d[_0xc6fd('0x88')]=_0x208e94['connectedlinename'];logger[_0xc6fd('0x78')](_0xc6fd('0x89'),_0x44381d[_0xc6fd('0x51')],_0x44381d[_0xc6fd('0x59')],_0x208e94['connectedlinenum'],_0x208e94[_0xc6fd('0x88')]);this[_0xc6fd('0x11')][_0x208e94[_0xc6fd('0x4e')]]=_0x44381d;this[_0xc6fd('0x4b')](_0x44381d,_0xc6fd('0x8a'));}}}catch(_0x211b43){logger['error'](_0xc6fd('0x85'),_0x208e94[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x211b43,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x24')]=function(_0x27de50){try{if(this[_0xc6fd('0x5e')](_0x27de50)){logger[_0xc6fd('0x72')](_0xc6fd('0x8b'),_0x27de50[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x27de50,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x27de50[_0xc6fd('0x4e')]]){var _0x3697e0=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x27de50[_0xc6fd('0x4e')]]);_0x3697e0[_0xc6fd('0x3a')]=!![];_0x3697e0['queuecallerexitreason']=_0xc6fd('0x8c');logger[_0xc6fd('0x78')](_0xc6fd('0x8d'),_0x3697e0[_0xc6fd('0x51')],_0x3697e0[_0xc6fd('0x59')]);}}}catch(_0x39558b){logger[_0xc6fd('0x40')](_0xc6fd('0x8b'),_0x27de50[_0xc6fd('0x4e')],util['inspect'](_0x39558b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')]['syncAgentComplete']=function(_0x51912b){try{if(this[_0xc6fd('0x5e')](_0x51912b)){logger['debug'](_0xc6fd('0x8e'),_0x51912b[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x51912b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x51912b[_0xc6fd('0x4e')]]){var _0x52167b=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x51912b['uniqueid']]);_0x52167b[_0xc6fd('0x1f')]=![];_0x52167b[_0xc6fd('0x81')]=null;_0x52167b['assigned']=!![];_0x52167b['lastAssignedTo']=_0x51912b[_0xc6fd('0x8f')];_0x52167b['holdtime']=_0x51912b['holdtime'];_0x52167b[_0xc6fd('0x3a')]=!![];_0x52167b['queuecallerexit']=![];_0x52167b[_0xc6fd('0x90')]=null;if(!_0x52167b[_0xc6fd('0x91')]){if(_0x51912b[_0xc6fd('0x92')]==_0xc6fd('0x91')){_0x52167b[_0xc6fd('0x54')]=_0xc6fd('0x93');logger[_0xc6fd('0x78')](_0xc6fd('0x94'),_0x52167b[_0xc6fd('0x51')],_0x52167b[_0xc6fd('0x59')]);}else{if(_[_0xc6fd('0x95')](_0x51912b['channel'][_0xc6fd('0x96')](),_0xc6fd('0x97'))){if(this['queueReports'][_0x51912b[_0xc6fd('0x98')]]){var _0x3cef54=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x51912b[_0xc6fd('0x98')]]);_0x3cef54[_0xc6fd('0x3a')]=![];_0x3cef54['queuecallerexit']=!![];_0x3cef54[_0xc6fd('0x90')]=moment(_0x52167b[_0xc6fd('0x76')])[_0xc6fd('0x99')](_0x51912b[_0xc6fd('0x7f')],_0xc6fd('0x9a'))[_0xc6fd('0x4f')](_0xc6fd('0x86'));_0x3cef54[_0xc6fd('0x54')]=_0xc6fd('0x9b');_0x3cef54['transfer']=!![];_0x3cef54[_0xc6fd('0x9c')]='FORWARD';_0x3cef54[_0xc6fd('0x9d')]=_0x51912b['destexten'];_0x3cef54[_0xc6fd('0x9e')]=_0x51912b['uniqueid'];logger[_0xc6fd('0x78')](_0xc6fd('0x9f'),_0x3cef54['queue'],_0x3cef54[_0xc6fd('0x59')]);var _0x5422e3=this[_0xc6fd('0xf')][_0x51912b[_0xc6fd('0x98')]];this['queueReports'][_0x51912b[_0xc6fd('0x98')]]=this['queueReports'][_0x51912b[_0xc6fd('0x4e')]];this[_0xc6fd('0xf')][_0x51912b[_0xc6fd('0x4e')]]=_0x5422e3;}}else{_0x52167b[_0xc6fd('0x54')]=_0xc6fd('0xa0')+_0x51912b['reason'][_0xc6fd('0xa1')]();logger[_0xc6fd('0x78')](_0xc6fd('0xa2'),_0x52167b[_0xc6fd('0x51')],_0x52167b[_0xc6fd('0x59')],_0x52167b[_0xc6fd('0x54')]);}}}this[_0xc6fd('0x11')][_0x51912b[_0xc6fd('0x4e')]]=_0x52167b;}}}catch(_0x4a3a3c){logger['error'](_0xc6fd('0x8e'),_0x51912b[_0xc6fd('0x4e')],util['inspect'](_0x4a3a3c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc6fd('0xa')][_0xc6fd('0x26')]=function(_0x1d0558){try{if(this[_0xc6fd('0x5e')](_0x1d0558)){logger[_0xc6fd('0x72')](_0xc6fd('0xa3'),_0x1d0558[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x1d0558,{'showHidden':![],'depth':null}));this['addVariable'](_0x1d0558[_0xc6fd('0x4e')],_[_0xc6fd('0x7b')](_0x1d0558[_0xc6fd('0xa4')])[0x0],_0x1d0558[_0xc6fd('0xa5')]);if(this[_0xc6fd('0xf')][_0x1d0558['uniqueid']]){var _0x22e97a=_[_0xc6fd('0x7d')](this[_0xc6fd('0xf')][_0x1d0558[_0xc6fd('0x4e')]]);if(_0x22e97a){if(this[_0xc6fd('0x5e')](_0x1d0558[_0xc6fd('0xa4')])&&this['isNotNull'](_0x1d0558['variable'][_0xc6fd('0x67')])){switch(_0x1d0558[_0xc6fd('0xa5')]){case _0xc6fd('0xa6'):_0x22e97a['queuecallerexit']=![];_0x22e97a['queuecallerexitAt']=null;break;case _0xc6fd('0xa7'):_0x22e97a[_0xc6fd('0xa8')]='timeout';_0x22e97a[_0xc6fd('0x39')]=!![];_0x22e97a[_0xc6fd('0x90')]=moment()['format'](_0xc6fd('0x86'));_0x22e97a[_0xc6fd('0xa9')]=moment()[_0xc6fd('0x4f')](_0xc6fd('0x86'));logger[_0xc6fd('0x72')](_0xc6fd('0xaa'),_0x1d0558[_0xc6fd('0x4e')],util[_0xc6fd('0x42')](_0x22e97a,{'showHidden':![],'depth':null}));ami[_0xc6fd('0x4a')](_0xc6fd('0xab'),_0x22e97a);break;default:_0x22e97a[_0xc6fd('0x39')]=!![];_0x22e97a[_0xc6fd('0x90')]=moment()[_0xc6fd('0x4f')](_0xc6fd('0x86'));_0x22e97a[_0xc6fd('0xa9')]=moment()['format'](_0xc6fd('0x86'));}_0x22e97a['queuecallerabandon']=![];_0x22e97a[_0xc6fd('0x81')]=null;_0x22e97a[_0xc6fd('0x54')]=_0x1d0558[_0xc6fd('0xa5')];this[_0xc6fd('0x11')][_0x1d0558[_0xc6fd('0x4e')]]=_0x22e97a;this[_0xc6fd('0x49')](_0x22e97a,_0xc6fd('0x25'));}else if(this[_0xc6fd('0x5e')](_0x1d0558['variable'])&&this[_0xc6fd('0x5e')](_0x1d0558['variable'][_0xc6fd('0xac')])){if(!_0x22e97a[_0xc6fd('0x1f')]){_0x22e97a[_0xc6fd('0x39')]=!![];_0x22e97a[_0xc6fd('0x90')]=moment()[_0xc6fd('0x4f')](_0xc6fd('0x86'));_0x22e97a[_0xc6fd('0x54')]=_0xc6fd('0xad');_0x22e97a['queuecallerleaveAt']=moment()['format'](_0xc6fd('0x86'));this[_0xc6fd('0x11')][_0x1d0558['uniqueid']]=_0x22e97a;}}logger[_0xc6fd('0x78')](_0xc6fd('0xae'),_0x1d0558[_0xc6fd('0x4e')],_0x22e97a[_0xc6fd('0x51')],_0x22e97a[_0xc6fd('0x59')],_[_0xc6fd('0x7b')](_0x1d0558['variable'])[0x0],_0x1d0558[_0xc6fd('0xa5')]);_0x22e97a[_0xc6fd('0x44')]=this[_0xc6fd('0x44')][_0x1d0558[_0xc6fd('0x4e')]];}}}}catch(_0x2f21cd){logger[_0xc6fd('0x40')](_0xc6fd('0xa3'),_0x1d0558[_0xc6fd('0x4e')],util['inspect'](_0x2f21cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc6fd('0xaf')]=function(_0x637452,_0x32a67e,_0x44df6a){var _0x5d710e=['rtpaudioqos',_0xc6fd('0xb0'),'rtpaudioqosjitter',_0xc6fd('0xb1'),_0xc6fd('0xb2'),_0xc6fd('0xb3'),_0xc6fd('0xb4'),_0xc6fd('0xb5'),_0xc6fd('0xb6'),_0xc6fd('0xb7'),_0xc6fd('0xb8'),'bridgepvtcallid',_0xc6fd('0xb9'),_0xc6fd('0xba'),_0xc6fd('0xbb'),_0xc6fd('0xbc'),_0xc6fd('0x8f'),_0xc6fd('0xbd'),_0xc6fd('0xbe')];if(!_['isNil'](_0x32a67e)&&!_['includes'](_0x5d710e,_0x32a67e)){if(_[_0xc6fd('0x5f')](this[_0xc6fd('0x44')][_0x637452])){this[_0xc6fd('0x44')][_0x637452]={};}this['variables'][_0x637452][_0x32a67e]=_0x44df6a;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x15cc48,_0x3a1a2f,_0x1b43d3){try{var _0x370172={};if(this['queueReports'][_0x15cc48]){for(var _0x415e03=0x0;_0x415e03{delete this[_0xc6fd('0x11')][_0xd912a];},_0x13a43f);}};module[_0xc6fd('0xf2')]=VoiceQueueReport; \ No newline at end of file +var _0x352c=['syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncVarSet','hangup','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','format','voice:queue:%s','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','queue','voice_queue_channel:remove','voice_queue_presence:remove','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','queues','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','assign','pick','keys','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','syncAgentConnect','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','transferuniqueid','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','diff','length','sumDuration','milliseconds','total','sumBillable','unmanaged','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','ATTENDED','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','origtransfererexten','transferid','BLIND','extension','BlindTransfer','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','set','applicationdata','appdata','cdr(','application','match','[%s][voiceQueueReport][newexten]','exports','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x352c,0xd7));var _0xc352=function(_0x4ee799,_0x22e2c2){_0x4ee799=_0x4ee799-0x0;var _0x26fe5b=_0x352c[_0x4ee799];return _0x26fe5b;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xc352('0x0'));var Redis=require(_0xc352('0x1'));var config=require(_0xc352('0x2'));var logger=require(_0xc352('0x3'))(_0xc352('0x4'));var ami=require(_0xc352('0x5'));var QueueReport=require(_0xc352('0x6'));var VoiceQueueSummary=require(_0xc352('0x7'));config['redis']=_[_0xc352('0x8')](config[_0xc352('0x9')],{'host':_0xc352('0xa'),'port':0x18eb});var io=require(_0xc352('0xb'))(new Redis(config[_0xc352('0x9')]));var Sequence=function(){};Sequence[_0xc352('0xc')][_0xc352('0xd')]=function(_0x2afb9c){this[_0xc352('0xe')]=this[_0xc352('0xe')]?this[_0xc352('0xe')]['finally'](_0x2afb9c):_0x2afb9c();};function VoiceQueueReport(_0x969641){this[_0xc352('0xf')]=new Sequence();this[_0xc352('0x10')]={};this['realtime']=_0x969641;this[_0xc352('0x11')]=_0x969641[_0xc352('0x11')];this[_0xc352('0x12')]=_0x969641[_0xc352('0x13')];this[_0xc352('0x14')]=_0x969641[_0xc352('0x14')];this[_0xc352('0x15')]=_0x969641[_0xc352('0x15')];this[_0xc352('0x16')]=initializeSummary();this[_0xc352('0x17')]={};ami['on'](_0xc352('0x18'),this[_0xc352('0x19')][_0xc352('0x1a')](this));ami['on']('queuesummarycomplete',this[_0xc352('0x1b')][_0xc352('0x1a')](this));ami['on'](_0xc352('0x1c'),this[_0xc352('0x1d')][_0xc352('0x1a')](this));ami['on'](_0xc352('0x1e'),this[_0xc352('0x1f')][_0xc352('0x1a')](this));ami['on'](_0xc352('0x20'),this[_0xc352('0x21')][_0xc352('0x1a')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xc352('0x1a')](this));ami['on'](_0xc352('0x22'),this[_0xc352('0x23')][_0xc352('0x1a')](this));ami['on']('agentcomplete',this[_0xc352('0x24')][_0xc352('0x1a')](this));ami['on'](_0xc352('0x25'),this['syncAgentConnect'][_0xc352('0x1a')](this));ami['on']('varset',this[_0xc352('0x26')][_0xc352('0x1a')](this));ami['on'](_0xc352('0x27'),this[_0xc352('0x28')][_0xc352('0x1a')](this));ami['on']('fullybooted',this[_0xc352('0x29')][_0xc352('0x1a')](this));ami['on'](_0xc352('0x2a'),this[_0xc352('0x2b')]['bind'](this));ami['on'](_0xc352('0x2c'),this[_0xc352('0x2d')][_0xc352('0x1a')](this));ami['on'](_0xc352('0x2e'),this[_0xc352('0x2f')][_0xc352('0x1a')](this));ami['on'](_0xc352('0x30'),this[_0xc352('0x31')][_0xc352('0x1a')](this));this[_0xc352('0x32')]();this[_0xc352('0x33')]();}function clearChannels(_0x593ac3){if(!_[_0xc352('0x34')](_0x593ac3)){for(var _0x13eda8 in _0x593ac3){if(_0x593ac3['hasOwnProperty'](_0x13eda8)){delete _0x593ac3[_0x13eda8];}}}}function clearCampaigns(_0x2ba775){if(!_[_0xc352('0x34')](_0x2ba775)){for(var _0x788fa1 in _0x2ba775){if(_0x2ba775[_0xc352('0x35')](_0x788fa1)){_0x2ba775[_0x788fa1][_0xc352('0x36')]=0x0;}}}}function clearVoiceQueues(_0x472f8c){if(!_[_0xc352('0x34')](_0x472f8c)){for(var _0x5c01ac in _0x472f8c){if(_0x472f8c[_0xc352('0x35')](_0x5c01ac)){_0x472f8c[_0x5c01ac][_0xc352('0x36')]=0x0;_0x472f8c[_0x5c01ac][_0xc352('0x37')]=0x0;_0x472f8c[_0x5c01ac][_0xc352('0x38')]=0x0;_0x472f8c[_0x5c01ac][_0xc352('0x39')]=0x0;_0x472f8c[_0x5c01ac][_0xc352('0x3a')]=!![];}}}}function clearAgentBooked(_0x1e9bdf){if(!_['isEmpty'](_0x1e9bdf)){for(var _0x4060d7 in _0x1e9bdf){if(_0x1e9bdf[_0xc352('0x35')](_0x4060d7)){_0x1e9bdf[_0x4060d7][_0xc352('0x3b')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x428242){return _0x428242[_0xc352('0x3c')]||_0x428242[_0xc352('0x3d')]||_0x428242[_0xc352('0x3e')];}VoiceQueueReport[_0xc352('0xc')][_0xc352('0x3f')]=function(){var _0x3d5f3e=this;for(var _0x12aa9f in this[_0xc352('0x12')]){if(this[_0xc352('0x12')][_0xc352('0x35')](_0x12aa9f)&&!this['channels'][_0x12aa9f][_0xc352('0x40')]){this[_0xc352('0xf')]['enqueue'](function(){if(!_[_0xc352('0x41')](_0x3d5f3e[_0xc352('0x12')][_0x12aa9f])){return ami[_0xc352('0x42')]({'action':_0xc352('0x43'),'channel':_0x3d5f3e[_0xc352('0x12')][_0x12aa9f][_0xc352('0x44')]})[_0xc352('0x45')](function(_0xca9634){if(_0xca9634[_0xc352('0x46')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3d5f3e[_0xc352('0x12')][_0x12aa9f]){delete _0x3d5f3e[_0xc352('0x12')][_0x12aa9f];logger[_0xc352('0x47')](_0xc352('0x48'),_0x12aa9f,util[_0xc352('0x49')](_0xca9634,{'showHidden':![],'depth':null}));}if(_0x3d5f3e['queueReports'][_0x12aa9f]){delete _0x3d5f3e[_0xc352('0x10')][_0x12aa9f];logger[_0xc352('0x47')](_0xc352('0x4a'),_0x12aa9f,util[_0xc352('0x49')](_0xca9634,{'showHidden':![],'depth':null}));}if(_0x3d5f3e[_0xc352('0x17')][_0x12aa9f]){delete _0x3d5f3e['variables'][_0x12aa9f];logger['error'](_0xc352('0x4b'),_0x12aa9f,util[_0xc352('0x49')](_0xca9634,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xc352('0x29')]=function(){logger[_0xc352('0x47')](_0xc352('0x4c'));clearChannels(this[_0xc352('0x12')]);this['clearQueueReport'](this[_0xc352('0x10')]);clearAgentBooked(this[_0xc352('0x11')]);clearVoiceQueues(this[_0xc352('0x14')]);clearCampaigns(this[_0xc352('0x15')]);this[_0xc352('0x16')]=initializeSummary();};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x4d')]=function(_0x263a97){var _0x1df0d8=this;if(!_['isEmpty'](_0x263a97)){for(var _0x1156d2 in _0x263a97){if(_0x263a97[_0xc352('0x35')](_0x1156d2)){_0x1df0d8[_0xc352('0x4e')](_0x263a97[_0x1156d2],'clearqueuereport');delete _0x263a97[_0x1156d2];}}}};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x4f')]=function(_0x5f1928,_0x2eec99,_0x178b13){io['to'](_0x5f1928)['emit'](_0x2eec99,_0x178b13);};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x50')]=function(_0x3b7e23,_0x3b8bbe){logger[_0xc352('0x51')](_0xc352('0x52')+_0x3b8bbe+']\x20sending\x20voice_queue_channel:save\x20event:',_0x3b7e23['uniqueid'],util[_0xc352('0x49')](_0x3b7e23,{'showHidden':![],'depth':null}));this['emit'](util[_0xc352('0x53')](_0xc352('0x54'),_0x3b7e23['queue']),_0xc352('0x55'),_0x3b7e23);io[_0xc352('0x4f')](_0xc352('0x56'),_0x3b7e23);};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x4e')]=function(_0x2facb8,_0x5a0129){logger[_0xc352('0x51')](_0xc352('0x52')+_0x5a0129+_0xc352('0x57'),_0x2facb8[_0xc352('0x58')],util[_0xc352('0x49')](_0x2facb8,{'showHidden':![],'depth':null}));if(_0x2facb8[_0xc352('0x59')]===_0xc352('0x5a')){return;}this[_0xc352('0x4f')](util[_0xc352('0x53')](_0xc352('0x54'),_0x2facb8[_0xc352('0x5b')]),_0xc352('0x5c'),_0x2facb8);io['emit'](_0xc352('0x5d'),_0x2facb8);};VoiceQueueReport[_0xc352('0xc')]['emitInboundVoiceQueueSummary']=function(_0x1a4501){if(_0x1a4501[_0xc352('0x5e')]==='inbound'){logger[_0xc352('0x51')](_0xc352('0x5f'),util[_0xc352('0x49')](_0x1a4501,{'showHidden':![],'depth':null}));this['emit'](util[_0xc352('0x53')](_0xc352('0x54'),_0x1a4501[_0xc352('0x60')]),_0xc352('0x61'),_0x1a4501);}};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x62')]=function(_0x513fef){return _0x513fef!==null&&!_[_0xc352('0x63')](_0x513fef);};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x33')]=function(){var _0x3ab9fd=this;setInterval(function(){_0x3ab9fd[_0xc352('0x3f')]();ami[_0xc352('0x42')]({'action':'queues'})['catch'](function(_0x3c328e){logger[_0xc352('0x47')](_0xc352('0x64'),util['inspect'](_0x3c328e,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x32')]=function(){var _0x4ef6dd=this;setInterval(function(){if(!_0x4ef6dd['summary'][_0xc352('0x65')]){return ami[_0xc352('0x42')]({'action':_0xc352('0x18')})[_0xc352('0x66')](function(_0x54835f){_0x4ef6dd[_0xc352('0x16')]['id']=_0x54835f[_0xc352('0x67')];_0x4ef6dd[_0xc352('0x16')][_0xc352('0x65')]=!![];_0x4ef6dd[_0xc352('0x16')][_0xc352('0x68')][_0x54835f[_0xc352('0x67')]]={};})[_0xc352('0x45')](function(_0x4692c9){logger['error'](_0xc352('0x69'),util['inspect'](_0x4692c9,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xc352('0x6a')]=function(_0x12b509,_0x1dc269){var _0x1eba2a;if(this[_0xc352('0x16')]&&this[_0xc352('0x16')][_0xc352('0x6b')]&&this[_0xc352('0x16')]['queues'][_0x12b509[_0xc352('0x60')]]){_0x1eba2a=this['summary'][_0xc352('0x6b')][_0x12b509['name']][_0xc352('0x6c')];}var _0x3323fd=new VoiceQueueSummary(_0x12b509);return _0x3323fd[_0xc352('0x6d')](_0x1dc269['agents'],this[_0xc352('0x11')],_0x1eba2a,this[_0xc352('0x6e')][_0xc352('0x12')]);};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x6f')]=function(_0x7c2e7a,_0x22c256){var _0x5140e4=this[_0xc352('0x6a')](_0x7c2e7a,_0x22c256);var _0x15e3f8=![];_0x15e3f8=_0x5140e4[_0xc352('0x70')](_0x7c2e7a);if(_0x15e3f8){Object['assign'](_0x7c2e7a,_0x5140e4);this[_0xc352('0x6e')][_0xc352('0x14')][_0x7c2e7a[_0xc352('0x60')]]=_0x7c2e7a;this['emitInboundVoiceQueueSummary'](_0x5140e4);}};VoiceQueueReport[_0xc352('0xc')]['syncQueueStatusComplete']=function(_0x37b13f){var _0x4b967f=null;var _0x41884c=this['summary']['id'];if(this[_0xc352('0x16')][_0xc352('0x68')][_0x41884c]){_0x4b967f=this[_0xc352('0x16')]['queuestatus'][_0x41884c][_0x37b13f[_0xc352('0x67')]];}if(!_0x4b967f){this[_0xc352('0x16')]=initializeSummary();return;}var _0x38f785=this['voiceQueues'][_0x4b967f['queue']];if(_0x38f785[_0xc352('0x5e')]==='inbound'){this[_0xc352('0x6f')](_0x38f785,_0x4b967f);}else if(_0x38f785['type']==='outbound'){var _0x22d89f=this[_0xc352('0x6a')](_0x38f785,_0x4b967f);ami['emit']('custom:queuesummary',_0x22d89f);}this[_0xc352('0x16')][_0xc352('0x71')]-=0x1;var _0x2bc3b1=this[_0xc352('0x16')][_0xc352('0x71')]>0x0?!![]:![];if(!_0x2bc3b1){return this[_0xc352('0x1b')](this[_0xc352('0x16')][_0xc352('0x72')]);}};VoiceQueueReport[_0xc352('0xc')]['syncQueueMember']=function(_0x59de58){var _0x4d8752=this['summary']['id'];if(this[_0xc352('0x16')][_0xc352('0x68')][_0x4d8752]&&this['summary'][_0xc352('0x68')][_0x4d8752][_0x59de58[_0xc352('0x67')]]){this[_0xc352('0x16')][_0xc352('0x68')][_0x4d8752][_0x59de58[_0xc352('0x67')]][_0xc352('0x11')][_0xc352('0x73')](_0x59de58);}};VoiceQueueReport['prototype'][_0xc352('0x19')]=function(_0x28014b){var _0x294a92=this;try{if(this['isNotNull'](_0x28014b)&&this[_0xc352('0x62')](_0x28014b[_0xc352('0x5b')])){logger[_0xc352('0x51')](_0xc352('0x74'),util[_0xc352('0x49')](_0x28014b,{'showHidden':![],'depth':null}));var _0x6117c0=this[_0xc352('0x14')][_0x28014b[_0xc352('0x5b')]];if(_0x6117c0){logger[_0xc352('0x51')](_0xc352('0x75'),_0x6117c0['name']);this[_0xc352('0x16')][_0xc352('0x6b')][_0x6117c0['name']]={'summaryEvent':_0x28014b};this[_0xc352('0x16')][_0xc352('0x71')]+=0x1;return ami[_0xc352('0x42')]({'action':_0xc352('0x68'),'queue':_0x6117c0[_0xc352('0x60')]})[_0xc352('0x66')](function(_0x329b1f){if(!_0x294a92[_0xc352('0x16')][_0xc352('0x68')][_0x28014b[_0xc352('0x67')]]){_0x294a92[_0xc352('0x16')]['queuestatus'][_0x28014b['actionid']]={};}_0x294a92[_0xc352('0x16')][_0xc352('0x68')][_0x28014b['actionid']][_0x329b1f[_0xc352('0x67')]]={'queue':_0x6117c0[_0xc352('0x60')],'agents':[]};})[_0xc352('0x45')](function(_0x2b941d){throw _0x2b941d;});}}}catch(_0x103917){logger[_0xc352('0x47')]('[voiceQueueReport][queuesummary]',util[_0xc352('0x49')](_0x103917,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc352('0xc')]['syncQueueSummaryComplete']=function(_0x3b862e){if(this[_0xc352('0x16')]['statusRequests']>0x0){this['summary'][_0xc352('0x72')]=_0x3b862e;return;}logger['debug'](_0xc352('0x76'),util[_0xc352('0x49')](_0x3b862e,{'showHidden':![],'depth':null}));this[_0xc352('0x16')]=initializeSummary();ami[_0xc352('0x4f')](_0xc352('0x77'),{});};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x21')]=function(_0xf99dd0){try{if(this[_0xc352('0x62')](_0xf99dd0)){logger['debug'](_0xc352('0x78'),_0xf99dd0['uniqueid'],util[_0xc352('0x49')](_0xf99dd0,{'showHidden':![],'depth':null}));if(_[_0xc352('0x63')](this[_0xc352('0x10')][_0xf99dd0[_0xc352('0x58')]])){this['queueReports'][_0xf99dd0[_0xc352('0x58')]]=[];}if(_['isUndefined'](this[_0xc352('0x12')][_0xf99dd0[_0xc352('0x58')]])){this[_0xc352('0x12')][_0xf99dd0[_0xc352('0x58')]]={};}var _0x28a364=new QueueReport();_0x28a364[_0xc352('0x5b')]=_0xf99dd0[_0xc352('0x5b')];_0x28a364['type']=this[_0xc352('0x14')][_0x28a364[_0xc352('0x5b')]]&&this['voiceQueues'][_0x28a364['queue']][_0xc352('0x5e')]?this['voiceQueues'][_0x28a364['queue']][_0xc352('0x5e')]||_0xc352('0x79'):'inbound';_0x28a364[_0xc352('0x7a')]=moment()[_0xc352('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x28a364[_0xc352('0x7b')]=_0xf99dd0[_0xc352('0x7b')];_0x28a364[_0xc352('0x7c')]=_0xf99dd0[_0xc352('0x7c')];_0x28a364[_0xc352('0x58')]=_0xf99dd0[_0xc352('0x58')];logger[_0xc352('0x7d')](_0xc352('0x7e'),_0x28a364[_0xc352('0x5b')],_0x28a364[_0xc352('0x5e')]);Object[_0xc352('0x7f')](_0x28a364,_[_0xc352('0x80')](_0xf99dd0,_[_0xc352('0x81')](_0x28a364)));this[_0xc352('0x10')][_0xf99dd0[_0xc352('0x58')]][_0xc352('0x73')](_0x28a364);this[_0xc352('0x12')][_0xf99dd0[_0xc352('0x58')]]=_0x28a364;this[_0xc352('0x50')](_0x28a364,'queuecallerjoin');}}catch(_0x41e6e7){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0xf99dd0[_0xc352('0x58')],util['inspect'](_0x41e6e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x82')]=function(_0x4460bd){try{if(this[_0xc352('0x62')](_0x4460bd)){logger['debug'](_0xc352('0x83'),_0x4460bd['uniqueid'],util[_0xc352('0x49')](_0x4460bd,{'showHidden':![],'depth':null}));if(this[_0xc352('0x10')][_0x4460bd[_0xc352('0x58')]]){var _0x277de2=_[_0xc352('0x84')](this[_0xc352('0x10')][_0x4460bd[_0xc352('0x58')]]);_0x277de2[_0xc352('0x3e')]=![];_0x277de2[_0xc352('0x85')]=null;_0x277de2[_0xc352('0x86')]=_0x4460bd[_0xc352('0x86')];_0x277de2[_0xc352('0x87')]=_0x4460bd[_0xc352('0x87')];_0x277de2['queuecallerabandon']=!![];_0x277de2[_0xc352('0x88')]=moment()[_0xc352('0x53')](_0xc352('0x89'));_0x277de2[_0xc352('0x59')]='ABANDONED';_0x277de2[_0xc352('0x8a')]=null;logger[_0xc352('0x7d')](_0xc352('0x8b'),_0x277de2[_0xc352('0x5b')],_0x277de2[_0xc352('0x5e')]);this[_0xc352('0x12')][_0x4460bd['uniqueid']]=_0x277de2;this['emitVoiceQueueChannelRemove'](_0x277de2,_0xc352('0x3d'));}}}catch(_0x2d82a2){logger[_0xc352('0x47')](_0xc352('0x83'),_0x4460bd[_0xc352('0x58')],util[_0xc352('0x49')](_0x2d82a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc352('0x23')]=function(_0x296999){try{if(this['isNotNull'](_0x296999)){logger[_0xc352('0x51')](_0xc352('0x8c'),_0x296999['uniqueid'],util['inspect'](_0x296999,{'showHidden':![],'depth':null}));if(this[_0xc352('0x10')][_0x296999['uniqueid']]){var _0x4f4171=_[_0xc352('0x84')](this['queueReports'][_0x296999[_0xc352('0x58')]]);_0x4f4171['queuecallerleaveAt']=moment()[_0xc352('0x53')](_0xc352('0x89'));_0x4f4171[_0xc352('0x8d')]=_0x296999[_0xc352('0x8d')];_0x4f4171['connectedlinename']=_0x296999['connectedlinename'];logger[_0xc352('0x7d')](_0xc352('0x8e'),_0x4f4171[_0xc352('0x5b')],_0x4f4171[_0xc352('0x5e')],_0x296999[_0xc352('0x8d')],_0x296999[_0xc352('0x8f')]);this[_0xc352('0x12')][_0x296999[_0xc352('0x58')]]=_0x4f4171;this['emitVoiceQueueChannelSave'](_0x4f4171,'queuecallerleave');}}}catch(_0x2e3252){logger[_0xc352('0x47')]('[%s][voiceQueueReport][queuecallerleave]',_0x296999[_0xc352('0x58')],util[_0xc352('0x49')](_0x2e3252,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x90')]=function(_0x58c305){try{if(this['isNotNull'](_0x58c305)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x58c305[_0xc352('0x58')],util['inspect'](_0x58c305,{'showHidden':![],'depth':null}));if(this[_0xc352('0x10')][_0x58c305['uniqueid']]){var _0x246dce=_['last'](this[_0xc352('0x10')][_0x58c305[_0xc352('0x58')]]);_0x246dce[_0xc352('0x3e')]=!![];_0x246dce[_0xc352('0x59')]=_0xc352('0x91');logger['info'](_0xc352('0x92'),_0x246dce[_0xc352('0x5b')],_0x246dce[_0xc352('0x5e')]);}}}catch(_0x156ea7){logger[_0xc352('0x47')](_0xc352('0x93'),_0x58c305['uniqueid'],util['inspect'](_0x156ea7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x24')]=function(_0x478e7b){try{if(this[_0xc352('0x62')](_0x478e7b)){logger[_0xc352('0x51')](_0xc352('0x94'),_0x478e7b[_0xc352('0x58')],util['inspect'](_0x478e7b,{'showHidden':![],'depth':null}));if(this[_0xc352('0x10')][_0x478e7b[_0xc352('0x58')]]){var _0x949c5d=_[_0xc352('0x84')](this['queueReports'][_0x478e7b[_0xc352('0x58')]]);_0x949c5d[_0xc352('0x3d')]=![];_0x949c5d[_0xc352('0x88')]=null;_0x949c5d[_0xc352('0x95')]=!![];_0x949c5d[_0xc352('0x8a')]=_0x478e7b[_0xc352('0x96')];_0x949c5d['holdtime']=_0x478e7b['holdtime'];_0x949c5d['queuecallercomplete']=!![];_0x949c5d[_0xc352('0x3c')]=![];_0x949c5d[_0xc352('0x97')]=null;if(!_0x949c5d[_0xc352('0x98')]){if(_0x478e7b['reason']=='transfer'){_0x949c5d[_0xc352('0x59')]=_0xc352('0x99');logger[_0xc352('0x7d')](_0xc352('0x9a'),_0x949c5d[_0xc352('0x5b')],_0x949c5d[_0xc352('0x5e')]);}else{if(_[_0xc352('0x9b')](_0x478e7b[_0xc352('0x44')][_0xc352('0x9c')](),_0xc352('0x9d'))){if(this[_0xc352('0x10')][_0x478e7b[_0xc352('0x9e')]]){var _0x26f610=_[_0xc352('0x84')](this[_0xc352('0x10')][_0x478e7b['linkedid']]);_0x26f610[_0xc352('0x3e')]=![];_0x26f610[_0xc352('0x3c')]=!![];_0x26f610['queuecallerexitAt']=moment(_0x949c5d['queuecallerjoinAt'])[_0xc352('0x9f')](_0x478e7b[_0xc352('0x86')],_0xc352('0xa0'))[_0xc352('0x53')](_0xc352('0x89'));_0x26f610[_0xc352('0x59')]=_0xc352('0xa1');_0x26f610[_0xc352('0x98')]=!![];_0x26f610[_0xc352('0xa2')]=_0xc352('0xa3');_0x26f610[_0xc352('0xa4')]=_0x478e7b['destexten'];_0x26f610[_0xc352('0xa5')]=_0x478e7b['uniqueid'];logger[_0xc352('0x7d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x26f610['queue'],_0x26f610[_0xc352('0x5e')]);var _0x2110bc=this[_0xc352('0x10')][_0x478e7b[_0xc352('0x9e')]];this[_0xc352('0x10')][_0x478e7b[_0xc352('0x9e')]]=this[_0xc352('0x10')][_0x478e7b[_0xc352('0x58')]];this[_0xc352('0x10')][_0x478e7b[_0xc352('0x58')]]=_0x2110bc;}}else{_0x949c5d[_0xc352('0x59')]='COMPLETEDBY'+_0x478e7b['reason'][_0xc352('0xa6')]();logger['info'](_0xc352('0xa7'),_0x949c5d[_0xc352('0x5b')],_0x949c5d[_0xc352('0x5e')],_0x949c5d[_0xc352('0x59')]);}}}this[_0xc352('0x12')][_0x478e7b['uniqueid']]=_0x949c5d;}}}catch(_0xc08a18){logger[_0xc352('0x47')](_0xc352('0x94'),_0x478e7b[_0xc352('0x58')],util['inspect'](_0xc08a18,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc352('0xc')][_0xc352('0x26')]=function(_0x353838){try{if(this[_0xc352('0x62')](_0x353838)){logger['debug'](_0xc352('0xa8'),_0x353838[_0xc352('0x58')],util[_0xc352('0x49')](_0x353838,{'showHidden':![],'depth':null}));this[_0xc352('0xa9')](_0x353838[_0xc352('0x58')],_[_0xc352('0x81')](_0x353838[_0xc352('0xaa')])[0x0],_0x353838[_0xc352('0xab')]);if(this[_0xc352('0x10')][_0x353838[_0xc352('0x58')]]){var _0x55480e=_[_0xc352('0x84')](this[_0xc352('0x10')][_0x353838[_0xc352('0x58')]]);if(_0x55480e){if(this[_0xc352('0x62')](_0x353838[_0xc352('0xaa')])&&this['isNotNull'](_0x353838[_0xc352('0xaa')][_0xc352('0x68')])){switch(_0x353838[_0xc352('0xab')]){case _0xc352('0xac'):_0x55480e[_0xc352('0x3c')]=![];_0x55480e[_0xc352('0x97')]=null;break;case _0xc352('0xad'):_0x55480e['lastevent']=_0xc352('0xae');_0x55480e[_0xc352('0x3c')]=!![];_0x55480e[_0xc352('0x97')]=moment()[_0xc352('0x53')](_0xc352('0x89'));_0x55480e[_0xc352('0xaf')]=moment()[_0xc352('0x53')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xc352('0x51')](_0xc352('0xb0'),_0x353838[_0xc352('0x58')],util[_0xc352('0x49')](_0x55480e,{'showHidden':![],'depth':null}));ami[_0xc352('0x4f')](_0xc352('0xb1'),_0x55480e);break;default:_0x55480e[_0xc352('0x3c')]=!![];_0x55480e['queuecallerexitAt']=moment()[_0xc352('0x53')](_0xc352('0x89'));_0x55480e['queuecallerleaveAt']=moment()['format'](_0xc352('0x89'));}_0x55480e[_0xc352('0x3d')]=![];_0x55480e['queuecallerabandonAt']=null;_0x55480e[_0xc352('0x59')]=_0x353838['value'];this[_0xc352('0x12')][_0x353838[_0xc352('0x58')]]=_0x55480e;this[_0xc352('0x4e')](_0x55480e,'varset');}else if(this['isNotNull'](_0x353838[_0xc352('0xaa')])&&this[_0xc352('0x62')](_0x353838[_0xc352('0xaa')]['queueposition'])){if(!_0x55480e[_0xc352('0x3d')]){_0x55480e[_0xc352('0x3c')]=!![];_0x55480e[_0xc352('0x97')]=moment()[_0xc352('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x55480e['queuecallerexitreason']=_0xc352('0xb2');_0x55480e[_0xc352('0xaf')]=moment()[_0xc352('0x53')](_0xc352('0x89'));this[_0xc352('0x12')][_0x353838[_0xc352('0x58')]]=_0x55480e;}}logger[_0xc352('0x7d')](_0xc352('0xb3'),_0x353838[_0xc352('0x58')],_0x55480e[_0xc352('0x5b')],_0x55480e['type'],_[_0xc352('0x81')](_0x353838[_0xc352('0xaa')])[0x0],_0x353838[_0xc352('0xab')]);_0x55480e['variables']=this[_0xc352('0x17')][_0x353838[_0xc352('0x58')]];}}}}catch(_0x2ee652){logger[_0xc352('0x47')](_0xc352('0xa8'),_0x353838[_0xc352('0x58')],util[_0xc352('0x49')](_0x2ee652,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc352('0xc')]['addVariable']=function(_0x28d1c6,_0x57eff3,_0xbfddcf){var _0x218ed1=[_0xc352('0xb4'),_0xc352('0xb5'),_0xc352('0xb6'),'rtpaudioqosjitterbridged',_0xc352('0xb7'),'rtpaudioqoslossbridged',_0xc352('0xb8'),'rtpaudioqosrttbridged',_0xc352('0xb9'),_0xc352('0xba'),_0xc352('0xbb'),'bridgepvtcallid',_0xc352('0xbc'),_0xc352('0xbd'),_0xc352('0xbe'),_0xc352('0xbf'),_0xc352('0x96'),_0xc352('0xc0'),_0xc352('0xc1')];if(!_[_0xc352('0x41')](_0x57eff3)&&!_[_0xc352('0xc2')](_0x218ed1,_0x57eff3)){if(_[_0xc352('0x63')](this[_0xc352('0x17')][_0x28d1c6])){this[_0xc352('0x17')][_0x28d1c6]={};}this['variables'][_0x28d1c6][_0x57eff3]=_0xbfddcf;}};VoiceQueueReport[_0xc352('0xc')][_0xc352('0xc3')]=function(_0x19f1fb,_0x110232,_0x55ddd1){try{var _0x5c40e8={};if(this[_0xc352('0x10')][_0x19f1fb]){for(var _0x2db579=0x0;_0x2db579{delete this[_0xc352('0x12')][_0x395ba5];},_0x17a90b);}};module[_0xc352('0xf3')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 4b1d8e4..c9a12e9 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb83=['queue','Request','CreateReportAgentPreview','../client','campaign'];(function(_0x34f9f6,_0x299d0c){var _0x2e241c=function(_0x1a2302){while(--_0x1a2302){_0x34f9f6['push'](_0x34f9f6['shift']());}};_0x2e241c(++_0x299d0c);}(_0xeb83,0x12f));var _0x3eb8=function(_0x64d6e3,_0x5054af){_0x64d6e3=_0x64d6e3-0x0;var _0x4bf000=_0xeb83[_0x64d6e3];return _0x4bf000;};'use strict';var client=require(_0x3eb8('0x0'));exports['createHistory']=function(_0x1b39dc){return function(){_0x1b39dc[_0x3eb8('0x1')]=_0x1b39dc[_0x3eb8('0x2')];return client[_0x3eb8('0x3')]('CreateReportAgentPreview',{'body':_0x1b39dc,'log':_0x3eb8('0x4')});};}; \ No newline at end of file +var _0xef49=['campaign','queue','CreateReportAgentPreview','../client','createHistory'];(function(_0xf68d71,_0x58d872){var _0x4b5531=function(_0x30b6a2){while(--_0x30b6a2){_0xf68d71['push'](_0xf68d71['shift']());}};_0x4b5531(++_0x58d872);}(_0xef49,0xbc));var _0x9ef4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xef49[_0x334841];return _0x5beb4b;};'use strict';var client=require(_0x9ef4('0x0'));exports[_0x9ef4('0x1')]=function(_0x18faea){return function(){_0x18faea[_0x9ef4('0x2')]=_0x18faea[_0x9ef4('0x3')];return client['Request'](_0x9ef4('0x4'),{'body':_0x18faea,'log':_0x9ef4('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index e77c2cc..dfa3277 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe086=['../client','Request','CreateAttachment'];(function(_0x37f4d8,_0x4ec257){var _0x10ebd8=function(_0x189b79){while(--_0x189b79){_0x37f4d8['push'](_0x37f4d8['shift']());}};_0x10ebd8(++_0x4ec257);}(_0xe086,0x15f));var _0x6e08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe086[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6e08('0x0'));exports['create']=function(_0x2a7cd4){return client[_0x6e08('0x1')](_0x6e08('0x2'),{'body':_0x2a7cd4,'log':_0x6e08('0x2')});}; \ No newline at end of file +var _0x2396=['Request','CreateAttachment','../client'];(function(_0x4544c8,_0x5de2d7){var _0x5afe0e=function(_0x7fd16c){while(--_0x7fd16c){_0x4544c8['push'](_0x4544c8['shift']());}};_0x5afe0e(++_0x5de2d7);}(_0x2396,0xb9));var _0x6239=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0x2396[_0x25a0b9];return _0x30b9ab;};'use strict';var client=require(_0x6239('0x0'));exports['create']=function(_0x1d84a8){return client[_0x6239('0x1')](_0x6239('0x2'),{'body':_0x1d84a8,'log':_0x6239('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 2bf40bc..9df95df 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['Interval','interval','SquareProject','getCampaign','getCampaigns','Request','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','TrunkBackup','callerid'];(function(_0x11b6f5,_0x4789c9){var _0x455ec7=function(_0x3b494f){while(--_0x3b494f){_0x11b6f5['push'](_0x11b6f5['shift']());}};_0x455ec7(++_0x4789c9);}(_0x1261,0x144));var _0x1126=function(_0x137f1a,_0x2887df){_0x137f1a=_0x137f1a-0x0;var _0x439923=_0x1261[_0x137f1a];return _0x439923;};'use strict';var client=require('../client');exports[_0x1126('0x0')]=function(){return function(){return client[_0x1126('0x1')](_0x1126('0x2'),{'options':{'raw':![],'attributes':['id',_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x1126('0xa'),_0x1126('0xb'),'dialNoAnswerMaxRetry',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'dialDropRetryFrequency',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'dialMachineRetryFrequency',_0x1126('0x14'),'dialAgentRejectRetryFrequency','dialTimezone',_0x1126('0x15'),'dialAMDActive',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'dialOrderByScheduledAt','dialPrefix',_0x1126('0x1f'),_0x1126('0x20')],'include':[{'model':_0x1126('0x21'),'as':'Trunk','attributes':['id',_0x1126('0x3'),'callerid',_0x1126('0x5')]},{'model':_0x1126('0x21'),'as':_0x1126('0x22'),'attributes':['id','name',_0x1126('0x23'),_0x1126('0x5')]},{'model':'Interval','as':'Interval','attributes':['id',_0x1126('0x3')],'include':[{'model':_0x1126('0x24'),'as':'Intervals','attributes':['id','name',_0x1126('0x25')]}]},{'model':'SquareProject','as':_0x1126('0x26'),'attributes':['id',_0x1126('0x3')]}]},'log':_0x1126('0x27')});};}; \ No newline at end of file +var _0xdb28=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x4ae954,_0x1e9a62){var _0xdc6196=function(_0x2a9e2d){while(--_0x2a9e2d){_0x4ae954['push'](_0x4ae954['shift']());}};_0xdc6196(++_0x1e9a62);}(_0xdb28,0x106));var _0x8db2=function(_0x5b8e6b,_0x47ade5){_0x5b8e6b=_0x5b8e6b-0x0;var _0xa12c17=_0xdb28[_0x5b8e6b];return _0xa12c17;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'dialOriginateTimeout',_0x8db2('0x9'),_0x8db2('0xa'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'dialAbandonedMaxRetry',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'dialAgentRejectMaxRetry',_0x8db2('0x15'),_0x8db2('0x16'),'dialGlobalInterval',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22')],'include':[{'model':_0x8db2('0x23'),'as':_0x8db2('0x23'),'attributes':['id',_0x8db2('0x24'),'callerid',_0x8db2('0x5')]},{'model':_0x8db2('0x23'),'as':'TrunkBackup','attributes':['id',_0x8db2('0x24'),_0x8db2('0x25'),_0x8db2('0x5')]},{'model':_0x8db2('0x26'),'as':_0x8db2('0x26'),'attributes':['id',_0x8db2('0x24')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8db2('0x24'),_0x8db2('0x27')]}]},{'model':_0x8db2('0x28'),'as':_0x8db2('0x28'),'attributes':['id','name']}]},'log':_0x8db2('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 7c028a0..3c20691 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa24=['../client','createContact','Request','CreateCmContact','GetCmContact'];(function(_0x255b93,_0xd7d179){var _0x4f3427=function(_0x3410a){while(--_0x3410a){_0x255b93['push'](_0x255b93['shift']());}};_0x4f3427(++_0xd7d179);}(_0xfa24,0x69));var _0x4fa2=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0xfa24[_0x379799];return _0x46e431;};'use strict';var client=require(_0x4fa2('0x0'));exports[_0x4fa2('0x1')]=function(_0x5a2cbd){return function(){return client[_0x4fa2('0x2')](_0x4fa2('0x3'),{'body':_0x5a2cbd,'log':_0x4fa2('0x3')});};};exports['getContacts']=function(_0x1755f){return function(){return client[_0x4fa2('0x2')](_0x4fa2('0x4'),{'options':_0x1755f,'log':_0x4fa2('0x4')});};}; \ No newline at end of file +var _0xc185=['Request','CreateCmContact','getContacts','GetCmContact','../client','createContact'];(function(_0x139163,_0x5896ab){var _0x36a50f=function(_0x42c202){while(--_0x42c202){_0x139163['push'](_0x139163['shift']());}};_0x36a50f(++_0x5896ab);}(_0xc185,0x15a));var _0x5c18=function(_0x39183c,_0x471423){_0x39183c=_0x39183c-0x0;var _0x20755a=_0xc185[_0x39183c];return _0x20755a;};'use strict';var client=require(_0x5c18('0x0'));exports[_0x5c18('0x1')]=function(_0x4c5a9f){return function(){return client[_0x5c18('0x2')]('CreateCmContact',{'body':_0x4c5a9f,'log':_0x5c18('0x3')});};};exports[_0x5c18('0x4')]=function(_0x1f8cfe){return function(){return client[_0x5c18('0x2')](_0x5c18('0x5'),{'options':_0x1f8cfe,'log':_0x5c18('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 9eb38bb..cc7459e 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf569=['CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','VoiceQueueId','countReScheduled','getContactPreview','GetCmHopperPreview','User','VoiceQueue','Queue','name','getCmHopper','unlockContact','GetContactRecallMe','Agent','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','moment','getContacts','Request','GetCmHopper','CmContact','Contact','updateContacts','UpdateCmHopper','format','rescheduleContact','ContactId','ListId'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0xf569,0xd0));var _0x9f56=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf569[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require('../client');var moment=require(_0x9f56('0x0'));exports[_0x9f56('0x1')]=function(_0x156de2,_0x9c192){return function(){return client[_0x9f56('0x2')](_0x9f56('0x3'),{'options':{'where':{'VoiceQueueId':_0x156de2},'include':[{'model':_0x9f56('0x4'),'as':_0x9f56('0x5')}],'limit':_0x9c192,'raw':![]},'log':'getCmHopper'});};};exports[_0x9f56('0x6')]=function(_0x5ebdbd,_0x467a46,_0x3488f2){return function(){return client['Request'](_0x9f56('0x7'),{'body':_0x5ebdbd,'options':{'where':{'VoiceQueueId':_0x467a46,'scheduledat':{'$lte':moment()[_0x9f56('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x3488f2},'log':_0x9f56('0x7')});};};exports[_0x9f56('0x9')]=function(_0x40a384){return client['Request']('UpdateCmHopper',{'body':_0x40a384,'options':{'where':{'ContactId':_0x40a384[_0x9f56('0xa')],'ListId':_0x40a384[_0x9f56('0xb')],'VoiceQueueId':_0x40a384['VoiceQueueId'],'CampaignId':_0x40a384[_0x9f56('0xc')]}},'log':_0x9f56('0x9')});};exports[_0x9f56('0xd')]=function(_0x4baac9,_0x5b0e94,_0x19a5e1){return function(){return client['Request'](_0x9f56('0xe'),{'options':{'where':{'VoiceQueueId':_0x4baac9,'ListId':_0x5b0e94,'ContactId':_0x19a5e1}},'log':'DestroyCmHopper'});};};exports['getContactDialer']=function(_0x293687,_0x4230ea,_0x5af8ab,_0x227587){return client[_0x9f56('0x2')](_0x9f56('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x293687,'active':![],'scheduledat':{'$lte':moment()[_0x9f56('0x8')](_0x9f56('0x10'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4230ea}}]},'order':[[_0x9f56('0x11'),_0x9f56('0x12')],[_0x9f56('0x13'),_0x227587],['id',_0x9f56('0x14')]],'raw':!![],'limit':_0x5af8ab},'log':_0x9f56('0xf')});};exports[_0x9f56('0x15')]=function(_0x13ebfa,_0x25a100,_0x9c39ec){return client[_0x9f56('0x2')](_0x9f56('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x13ebfa,'active':![],'scheduledat':{'$lte':moment()[_0x9f56('0x8')](_0x9f56('0x10'))}},'include':[{'model':'CmContact','as':'Contact'}],'order':[[_0x9f56('0x11'),_0x9f56('0x12')],[_0x9f56('0x13'),_0x9c39ec],['id',_0x9f56('0x14')]],'raw':!![],'limit':_0x25a100},'log':_0x9f56('0x16')});};exports['moveContactManagedDialer']=function(_0x433418,_0x25d1ea){_0x433418[_0x9f56('0x17')]=_0x433418[_0x9f56('0x18')];return client[_0x9f56('0x2')](_0x9f56('0x19'),{'body':_0x433418,'options':{'where':{'ContactId':_0x433418[_0x9f56('0xa')],'ListId':_0x433418['ListId'],'VoiceQueueId':_0x433418[_0x9f56('0x1a')],'CampaignId':_0x433418['CampaignId'],'active':_0x25d1ea?undefined:!![]}},'log':_0x9f56('0x19')});};exports[_0x9f56('0x1b')]=function(_0x43aae6){return client[_0x9f56('0x2')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x43aae6['id']?_0x43aae6['id']||null:null}},'log':_0x9f56('0x1b')});};exports[_0x9f56('0x1c')]=function(_0x573e31){return function(){return client[_0x9f56('0x2')](_0x9f56('0x1d'),{'options':{'where':{'id':_0x573e31},'include':[{'model':'CmContact','as':_0x9f56('0x5')},{'model':_0x9f56('0x1e'),'as':'Agent','attributes':['id','name']},{'model':_0x9f56('0x1f'),'as':_0x9f56('0x20'),'attributes':['id',_0x9f56('0x21')]}],'raw':!![]},'log':_0x9f56('0x22')});};};exports[_0x9f56('0x23')]=function(_0x2aaf54,_0x48da87,_0x76b04f){return client[_0x9f56('0x2')](_0x9f56('0x7'),{'body':_0x2aaf54,'options':{'where':{'id':_0x48da87},'limit':_0x76b04f},'log':_0x9f56('0x7')});};exports['getContactRecallMe']=function(_0x1157ca,_0x25bc7e){return function(){return client[_0x9f56('0x2')](_0x9f56('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1157ca,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x9f56('0x8')](_0x9f56('0x10'))},'UserId':{'$in':_0x25bc7e}},'order':[[_0x9f56('0x11'),_0x9f56('0x12')],[_0x9f56('0x13'),_0x9f56('0x12')],['id',_0x9f56('0x14')]],'include':[{'model':_0x9f56('0x4'),'as':'Contact'},{'model':'User','as':_0x9f56('0x25'),'attributes':['id','name',_0x9f56('0x26')]}],'group':_0x9f56('0x27'),'raw':!![]},'log':_0x9f56('0xf')});};};exports[_0x9f56('0x28')]=function(_0xe8d198,_0x4513a2){return client[_0x9f56('0x2')]('ResetActiveCalls',{'body':_0xe8d198,'options':_0x4513a2||{},'log':_0x9f56('0x29')});};exports['handlePreviewRecallNotifications']=function(_0xcdf778,_0x3e9d62,_0x2063ae){return function(){return client[_0x9f56('0x2')](_0x9f56('0x2a'),{'body':{'where':{'voiceQueueIds':_0xcdf778,'interval':_0x3e9d62,'availableAgentsIds':_0x2063ae}},'log':_0x9f56('0x2b')});};}; \ No newline at end of file +var _0xa423=['CmContact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','Request','ContactId','ListId','VoiceQueueId','destroyContact','DestroyCmHopper','getContactDialer','priority','scheduledat','ASC','GetContactDialer','Contact','DESC','GetContactDialerIvr','campaign','queue','CampaignId','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','unlockContact','getContactRecallMe','GetContactRecallMe','Agent','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','GetCmHopper'];(function(_0x11b762,_0xe936b4){var _0x418383=function(_0x4061ea){while(--_0x4061ea){_0x11b762['push'](_0x11b762['shift']());}};_0x418383(++_0xe936b4);}(_0xa423,0x16c));var _0x3a42=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xa423[_0x31a938];return _0x1bf341;};'use strict';var client=require(_0x3a42('0x0'));var moment=require(_0x3a42('0x1'));exports[_0x3a42('0x2')]=function(_0x26be32,_0x27fd92){return function(){return client['Request'](_0x3a42('0x3'),{'options':{'where':{'VoiceQueueId':_0x26be32},'include':[{'model':_0x3a42('0x4'),'as':'Contact'}],'limit':_0x27fd92,'raw':![]},'log':_0x3a42('0x5')});};};exports[_0x3a42('0x6')]=function(_0x44ba12,_0x1bbd5b,_0x3a83e1){return function(){return client['Request'](_0x3a42('0x7'),{'body':_0x44ba12,'options':{'where':{'VoiceQueueId':_0x1bbd5b,'scheduledat':{'$lte':moment()[_0x3a42('0x8')](_0x3a42('0x9'))}},'limit':_0x3a83e1},'log':_0x3a42('0x7')});};};exports[_0x3a42('0xa')]=function(_0x30f605){return client[_0x3a42('0xb')](_0x3a42('0x7'),{'body':_0x30f605,'options':{'where':{'ContactId':_0x30f605[_0x3a42('0xc')],'ListId':_0x30f605[_0x3a42('0xd')],'VoiceQueueId':_0x30f605[_0x3a42('0xe')],'CampaignId':_0x30f605['CampaignId']}},'log':_0x3a42('0xa')});};exports[_0x3a42('0xf')]=function(_0x1f50f4,_0x168835,_0x578a1d){return function(){return client['Request'](_0x3a42('0x10'),{'options':{'where':{'VoiceQueueId':_0x1f50f4,'ListId':_0x168835,'ContactId':_0x578a1d}},'log':'DestroyCmHopper'});};};exports[_0x3a42('0x11')]=function(_0x2f210f,_0x198bf1,_0x1fc71f,_0x891963){return client[_0x3a42('0xb')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2f210f,'active':![],'scheduledat':{'$lte':moment()[_0x3a42('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x198bf1}}]},'order':[[_0x3a42('0x12'),'DESC'],[_0x3a42('0x13'),_0x891963],['id',_0x3a42('0x14')]],'raw':!![],'limit':_0x1fc71f},'log':_0x3a42('0x15')});};exports['getContactDialerIvr']=function(_0x486c74,_0x4eae89,_0x26c844){return client[_0x3a42('0xb')](_0x3a42('0x15'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x486c74,'active':![],'scheduledat':{'$lte':moment()[_0x3a42('0x8')](_0x3a42('0x9'))}},'include':[{'model':'CmContact','as':_0x3a42('0x16')}],'order':[[_0x3a42('0x12'),_0x3a42('0x17')],[_0x3a42('0x13'),_0x26c844],['id',_0x3a42('0x14')]],'raw':!![],'limit':_0x4eae89},'log':_0x3a42('0x18')});};exports['moveContactManagedDialer']=function(_0x1fcea4,_0x3f4afb){_0x1fcea4[_0x3a42('0x19')]=_0x1fcea4[_0x3a42('0x1a')];return client[_0x3a42('0xb')]('MoveContactManagedDialer',{'body':_0x1fcea4,'options':{'where':{'ContactId':_0x1fcea4[_0x3a42('0xc')],'ListId':_0x1fcea4[_0x3a42('0xd')],'VoiceQueueId':_0x1fcea4[_0x3a42('0xe')],'CampaignId':_0x1fcea4[_0x3a42('0x1b')],'active':_0x3f4afb?undefined:!![]}},'log':_0x3a42('0x1c')});};exports['countReScheduled']=function(_0xab8ab7){return client[_0x3a42('0xb')](_0x3a42('0x1d'),{'options':{'where':{'VoiceQueueId':_0xab8ab7['id']?_0xab8ab7['id']||null:null}},'log':_0x3a42('0x1e')});};exports[_0x3a42('0x1f')]=function(_0x258917){return function(){return client[_0x3a42('0xb')](_0x3a42('0x20'),{'options':{'where':{'id':_0x258917},'include':[{'model':_0x3a42('0x4'),'as':_0x3a42('0x16')},{'model':_0x3a42('0x21'),'as':'Agent','attributes':['id',_0x3a42('0x22')]},{'model':_0x3a42('0x23'),'as':'Queue','attributes':['id',_0x3a42('0x22')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x3a42('0x24')]=function(_0x2a4878,_0x409910,_0x299282){return client[_0x3a42('0xb')](_0x3a42('0x7'),{'body':_0x2a4878,'options':{'where':{'id':_0x409910},'limit':_0x299282},'log':'UpdateCmHopper'});};exports[_0x3a42('0x25')]=function(_0xdb014d,_0x1dc0c0){return function(){return client[_0x3a42('0xb')](_0x3a42('0x26'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xdb014d,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x3a42('0x8')](_0x3a42('0x9'))},'UserId':{'$in':_0x1dc0c0}},'order':[['priority',_0x3a42('0x17')],[_0x3a42('0x13'),_0x3a42('0x17')],['id',_0x3a42('0x14')]],'include':[{'model':_0x3a42('0x4'),'as':'Contact'},{'model':'User','as':_0x3a42('0x27'),'attributes':['id','name',_0x3a42('0x28')]}],'group':_0x3a42('0x29'),'raw':!![]},'log':_0x3a42('0x15')});};};exports[_0x3a42('0x2a')]=function(_0x37defa,_0x26f4c5){return client['Request'](_0x3a42('0x2b'),{'body':_0x37defa,'options':_0x26f4c5||{},'log':_0x3a42('0x2b')});};exports[_0x3a42('0x2c')]=function(_0x5583b0,_0x5871bf,_0x41df56){return function(){return client[_0x3a42('0xb')](_0x3a42('0x2d'),{'body':{'where':{'voiceQueueIds':_0x5583b0,'interval':_0x5871bf,'availableAgentsIds':_0x41df56}},'log':_0x3a42('0x2c')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 870a94e..232eba3 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3243=['Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','verifyAdditionalPhones','VerifyAdditionalPhones'];(function(_0xbfc560,_0x311fba){var _0x47b022=function(_0x2cd37f){while(--_0x2cd37f){_0xbfc560['push'](_0xbfc560['shift']());}};_0x47b022(++_0x311fba);}(_0x3243,0x196));var _0x3324=function(_0x222fb3,_0x2751e7){_0x222fb3=_0x222fb3-0x0;var _0x2cb8f0=_0x3243[_0x222fb3];return _0x2cb8f0;};'use strict';var client=require('../client');exports[_0x3324('0x0')]=function(_0x55a794,_0x235b2b,_0x4bd6d6){return client['Request'](_0x3324('0x1'),{'body':_0x55a794,'reason':_0x235b2b,'entity':_0x4bd6d6,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x2acaf2,_0x4d2322,_0x5f14ef){return client[_0x3324('0x2')]('SwapAdditionalPhones',{'body':_0x2acaf2,'duration':_0x4d2322,'waitTime':_0x5f14ef,'log':_0x3324('0x3')});};exports[_0x3324('0x4')]=function(_0x1a9bfb){return function(){return client[_0x3324('0x2')](_0x3324('0x5'),{'body':_0x1a9bfb,'log':_0x3324('0x5')});};}; \ No newline at end of file +var _0x692b=['verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters'];(function(_0xfa86e7,_0xc99c3d){var _0x51a321=function(_0x42f072){while(--_0x42f072){_0xfa86e7['push'](_0xfa86e7['shift']());}};_0x51a321(++_0xc99c3d);}(_0x692b,0xfc));var _0xb692=function(_0x30c653,_0x2d8df4){_0x30c653=_0x30c653-0x0;var _0x47fd4a=_0x692b[_0x30c653];return _0x47fd4a;};'use strict';var client=require('../client');exports[_0xb692('0x0')]=function(_0x331cc8,_0xac816e,_0x1795ca){return client[_0xb692('0x1')](_0xb692('0x2'),{'body':_0x331cc8,'reason':_0xac816e,'entity':_0x1795ca,'log':'VerifyAdditionalPhones'});};exports[_0xb692('0x3')]=function(_0x22c842,_0x1e7577,_0x18cb75){return client[_0xb692('0x1')](_0xb692('0x4'),{'body':_0x22c842,'duration':_0x1e7577,'waitTime':_0x18cb75,'log':_0xb692('0x4')});};exports[_0xb692('0x5')]=function(_0x36dc0b){return function(){return client[_0xb692('0x1')]('IncrementPreviewCounters',{'body':_0x36dc0b,'log':_0xb692('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index cb25bfa..6df924b 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd822=['CampaignId','../client','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr'];(function(_0x2a8f68,_0x23b0fe){var _0x31f2f5=function(_0x490617){while(--_0x490617){_0x2a8f68['push'](_0x2a8f68['shift']());}};_0x31f2f5(++_0x23b0fe);}(_0xd822,0x1ac));var _0x2d82=function(_0x42b71c,_0x35e86b){_0x42b71c=_0x42b71c-0x0;var _0x49017f=_0xd822[_0x42b71c];return _0x49017f;};'use strict';var client=require(_0x2d82('0x0'));exports['checkIsBlackList']=function(_0x51bfb3){return client[_0x2d82('0x1')](_0x2d82('0x2'),{'options':{'where':{'VoiceQueueId':_0x51bfb3[_0x2d82('0x3')],'phone':_0x51bfb3[_0x2d82('0x4')]},'raw':![]},'log':_0x2d82('0x2')});};exports[_0x2d82('0x5')]=function(_0x182e81){return client[_0x2d82('0x1')](_0x2d82('0x2'),{'options':{'where':{'CampaignId':_0x182e81[_0x2d82('0x6')],'phone':_0x182e81[_0x2d82('0x4')]},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file +var _0x7262=['phone','checkIsBlackListIvr','GetCmHopperBlack','GetCmHopperBlackIvr','checkIsBlackList','Request','VoiceQueueId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7262,0x1a8));var _0x2726=function(_0xc0976e,_0x370ad4){_0xc0976e=_0xc0976e-0x0;var _0x2db9c7=_0x7262[_0xc0976e];return _0x2db9c7;};'use strict';var client=require('../client');exports[_0x2726('0x0')]=function(_0x29f2b0){return client[_0x2726('0x1')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x29f2b0[_0x2726('0x2')],'phone':_0x29f2b0[_0x2726('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x2726('0x4')]=function(_0x40992d){return client[_0x2726('0x1')](_0x2726('0x5'),{'options':{'where':{'CampaignId':_0x40992d['CampaignId'],'phone':_0x40992d['phone']},'raw':![]},'log':_0x2726('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index d5f672a..3164f09 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61b6=['../client','createContact','Request','CreateCmHopperFinal'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x61b6,0x158));var _0x661b=function(_0x38d510,_0x38bdfe){_0x38d510=_0x38d510-0x0;var _0x34ab19=_0x61b6[_0x38d510];return _0x34ab19;};'use strict';var client=require(_0x661b('0x0'));exports[_0x661b('0x1')]=function(_0x14c4b8){return function(){_0x14c4b8['campaign']=_0x14c4b8['queue'];return client[_0x661b('0x2')](_0x661b('0x3'),{'body':_0x14c4b8,'log':_0x661b('0x3')});};}; \ No newline at end of file +var _0x9a32=['CreateCmHopperFinal'];(function(_0x29124a,_0x395641){var _0x36379d=function(_0x57df7c){while(--_0x57df7c){_0x29124a['push'](_0x29124a['shift']());}};_0x36379d(++_0x395641);}(_0x9a32,0xa6));var _0x29a3=function(_0x171e6d,_0x25f8e8){_0x171e6d=_0x171e6d-0x0;var _0x40aebb=_0x9a32[_0x171e6d];return _0x40aebb;};'use strict';var client=require('../client');exports['createContact']=function(_0xfe7376){return function(){_0xfe7376['campaign']=_0xfe7376['queue'];return client['Request'](_0x29a3('0x0'),{'body':_0xfe7376,'log':_0x29a3('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 3bbfd49..2a33f9f 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d7f=['getCampaignHopperHistory','GetCampaignHopperHistory','startOf','ivr','../client','moment','createHistory','campaign','queue','Request','CreateCmHopperHistory','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','endOf','day'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x8d7f,0x1a8));var _0xf8d7=function(_0x559d86,_0x25096b){_0x559d86=_0x559d86-0x0;var _0x325cf9=_0x8d7f[_0x559d86];return _0x325cf9;};'use strict';var client=require(_0xf8d7('0x0'));var moment=require(_0xf8d7('0x1'));exports[_0xf8d7('0x2')]=function(_0x1582f8){_0x1582f8[_0xf8d7('0x3')]=_0x1582f8[_0xf8d7('0x4')];return client[_0xf8d7('0x5')](_0xf8d7('0x6'),{'body':_0x1582f8,'log':'CreateCmHopperHistory'});};exports['avgHandleTime']=function(_0x3c65d7){return client['Request'](_0xf8d7('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0xf8d7('0x8')](_0x3c65d7,_0xf8d7('0x9'))[_0xf8d7('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf8d7('0xa')](_0xf8d7('0xb'))]}},'raw':![]},'log':_0xf8d7('0xc')});};exports[_0xf8d7('0xd')]=function(){return function(){return client['Request'](_0xf8d7('0xe'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xf8d7('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf8d7('0xf')](_0xf8d7('0x10'))[_0xf8d7('0xa')](_0xf8d7('0xb'))]},'campaigntype':'queue'},'raw':![]},'log':_0xf8d7('0xe')});};};exports[_0xf8d7('0x11')]=function(){return function(){return client['Request'](_0xf8d7('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xf8d7('0x13')](_0xf8d7('0x10'))[_0xf8d7('0xa')](_0xf8d7('0xb')),moment()['endOf'](_0xf8d7('0x10'))['format'](_0xf8d7('0xb'))]},'campaigntype':_0xf8d7('0x14')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file +var _0xbe48=['getCampaignHopperHistory','day','ivr','GetCampaignHopperHistory','../client','moment','createHistory','campaign','CreateCmHopperHistory','Request','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','endOf','queue'];(function(_0x56188a,_0x483c31){var _0x4dbd75=function(_0x2de41e){while(--_0x2de41e){_0x56188a['push'](_0x56188a['shift']());}};_0x4dbd75(++_0x483c31);}(_0xbe48,0x121));var _0x8be4=function(_0x31f991,_0x2e95d4){_0x31f991=_0x31f991-0x0;var _0xa94a7a=_0xbe48[_0x31f991];return _0xa94a7a;};'use strict';var client=require(_0x8be4('0x0'));var moment=require(_0x8be4('0x1'));exports[_0x8be4('0x2')]=function(_0x2c6733){_0x2c6733[_0x8be4('0x3')]=_0x2c6733['queue'];return client['Request'](_0x8be4('0x4'),{'body':_0x2c6733,'log':_0x8be4('0x4')});};exports['avgHandleTime']=function(_0x191a88){return client[_0x8be4('0x5')](_0x8be4('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x8be4('0x7')](_0x191a88,_0x8be4('0x8'))[_0x8be4('0x9')](_0x8be4('0xa')),moment()['format'](_0x8be4('0xa'))]}},'raw':![]},'log':_0x8be4('0xb')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client['Request'](_0x8be4('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0x8be4('0x9')](_0x8be4('0xa')),moment()[_0x8be4('0xd')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x8be4('0xe')},'raw':![]},'log':_0x8be4('0xc')});};};exports[_0x8be4('0xf')]=function(){return function(){return client[_0x8be4('0x5')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x8be4('0x10'))[_0x8be4('0x9')](_0x8be4('0xa')),moment()[_0x8be4('0xd')]('day')[_0x8be4('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x8be4('0x11')},'raw':![]},'log':_0x8be4('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 8186014..13889da 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdacc=['Trunk','callerid','active','getFaxAccount','NotifyFaxAccount','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key'];(function(_0x28a635,_0xdbb2ac){var _0x44b855=function(_0x90130f){while(--_0x90130f){_0x28a635['push'](_0x28a635['shift']());}};_0x44b855(++_0xdbb2ac);}(_0xdacc,0x14f));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xcdac('0x0')]=function(){return function(){return client[_0xcdac('0x1')](_0xcdac('0x2'),{'options':{'raw':![],'attributes':['id',_0xcdac('0x3'),_0xcdac('0x4'),_0xcdac('0x5'),_0xcdac('0x6'),'localstationid',_0xcdac('0x7'),_0xcdac('0x8'),_0xcdac('0x9'),_0xcdac('0xa'),_0xcdac('0xb'),_0xcdac('0xc'),_0xcdac('0xd'),_0xcdac('0xe'),_0xcdac('0xf'),_0xcdac('0x10')],'include':[{'model':_0xcdac('0x11'),'as':_0xcdac('0x11'),'attributes':['id',_0xcdac('0x3'),_0xcdac('0x12'),_0xcdac('0x13')]}]},'log':_0xcdac('0x14')});};};exports['notify']=function(_0x3c105b,_0x611799){return client['Request'](_0xcdac('0x15'),{'account':{'id':_0x3c105b},'body':_0x611799,'log':_0xcdac('0x15')});}; \ No newline at end of file +var _0xde9f=['minrate','maxrate','modem','gateway','tech','TrunkId','key','Trunk','callerid','active','getFaxAccount','notify','Request','NotifyFaxAccount','../client','GetFaxAccount','name','ecm','headerinfo'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xde9f,0x118));var _0xfde9=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0xde9f[_0x124f88];return _0xed0e3b;};'use strict';var client=require(_0xfde9('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0xfde9('0x1'),{'options':{'raw':![],'attributes':['id',_0xfde9('0x2'),'description',_0xfde9('0x3'),_0xfde9('0x4'),'localstationid',_0xfde9('0x5'),_0xfde9('0x6'),_0xfde9('0x7'),_0xfde9('0x8'),'faxdetect','t38timeout',_0xfde9('0x9'),_0xfde9('0xa'),'ListId',_0xfde9('0xb')],'include':[{'model':_0xfde9('0xc'),'as':_0xfde9('0xc'),'attributes':['id',_0xfde9('0x2'),_0xfde9('0xd'),_0xfde9('0xe')]}]},'log':_0xfde9('0xf')});};};exports[_0xfde9('0x10')]=function(_0x3fa916,_0x3c13d0){return client[_0xfde9('0x11')](_0xfde9('0x12'),{'account':{'id':_0x3fa916},'body':_0x3c13d0,'log':_0xfde9('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 26a8c0f..a54fdef 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x537a=['update','Request'];(function(_0x548d2f,_0x5e4697){var _0x1c5652=function(_0x22ff01){while(--_0x22ff01){_0x548d2f['push'](_0x548d2f['shift']());}};_0x1c5652(++_0x5e4697);}(_0x537a,0x14c));var _0xa537=function(_0x1e306b,_0x28da15){_0x1e306b=_0x1e306b-0x0;var _0x2aef66=_0x537a[_0x1e306b];return _0x2aef66;};'use strict';var client=require('../client');exports[_0xa537('0x0')]=function(_0x57d18b,_0x3b9a2c){return client[_0xa537('0x1')]('UpdateFaxMessage',{'body':_0x3b9a2c,'options':{'where':{'AttachmentId':_0x57d18b}},'log':'UpdateFaxMessage'});}; \ No newline at end of file +var _0x5d1e=['Request','UpdateFaxMessage','../client','update'];(function(_0x372d70,_0x79c98c){var _0x6ff9b1=function(_0x2014a9){while(--_0x2014a9){_0x372d70['push'](_0x372d70['shift']());}};_0x6ff9b1(++_0x79c98c);}(_0x5d1e,0x7a));var _0xe5d1=function(_0x2564af,_0x1afb94){_0x2564af=_0x2564af-0x0;var _0x4a7d8f=_0x5d1e[_0x2564af];return _0x4a7d8f;};'use strict';var client=require(_0xe5d1('0x0'));exports[_0xe5d1('0x1')]=function(_0x99b785,_0x44b891){return client[_0xe5d1('0x2')](_0xe5d1('0x3'),{'body':_0x44b891,'options':{'where':{'AttachmentId':_0x99b785}},'log':_0xe5d1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 5f304fe..be2f06b 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69c7=['../../client','getDeskAccounts','Request','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','content','Descriptions','key','keyType','keyContent','variableName','Variable','Fields','idField','customField','Tags'];(function(_0x28d296,_0x4b0063){var _0x1433f7=function(_0x500a82){while(--_0x500a82){_0x28d296['push'](_0x28d296['shift']());}};_0x1433f7(++_0x4b0063);}(_0x69c7,0x104));var _0x769c=function(_0x5f28f1,_0xd00b79){_0x5f28f1=_0x5f28f1-0x0;var _0x500181=_0x69c7[_0x5f28f1];return _0x500181;};'use strict';var client=require(_0x769c('0x0'));exports[_0x769c('0x1')]=function(){return function(_0x54d34e){return client[_0x769c('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x769c('0x3'),_0x769c('0x4'),_0x769c('0x5'),_0x769c('0x6'),_0x769c('0x7'),_0x769c('0x8'),_0x769c('0x9'),_0x769c('0xa')],'include':[{'model':_0x769c('0xb'),'as':_0x769c('0xc'),'attributes':['id',_0x769c('0x3')],'include':[{'model':_0x769c('0xd'),'as':_0x769c('0xe'),'attributes':['id',_0x769c('0x9'),_0x769c('0xf'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x769c('0x3')]}]},{'model':_0x769c('0xd'),'as':_0x769c('0x10'),'attributes':['id',_0x769c('0x9'),_0x769c('0xf'),_0x769c('0x11'),_0x769c('0x12'),_0x769c('0x13'),_0x769c('0x14')],'include':[{'model':_0x769c('0x15'),'as':_0x769c('0x15'),'attributes':['id','name']}]},{'model':_0x769c('0xd'),'as':_0x769c('0x16'),'attributes':['id',_0x769c('0x9'),'content',_0x769c('0x17'),'nameField',_0x769c('0x18'),_0x769c('0x14')],'include':[{'model':'Variable','as':_0x769c('0x15'),'attributes':['id',_0x769c('0x3')]}]},{'model':'Tag','as':_0x769c('0x19'),'attributes':['id',_0x769c('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0x5cf9=['variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','Tag','GetDeskAccount','../../client','Request','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','content'];(function(_0x32b59c,_0x11dc38){var _0x2b8b2b=function(_0x5e1cae){while(--_0x5e1cae){_0x32b59c['push'](_0x32b59c['shift']());}};_0x2b8b2b(++_0x11dc38);}(_0x5cf9,0x16b));var _0x95cf=function(_0x1853dc,_0xb54663){_0x1853dc=_0x1853dc-0x0;var _0x1c8e1a=_0x5cf9[_0x1853dc];return _0x1c8e1a;};'use strict';var client=require(_0x95cf('0x0'));exports['getDeskAccounts']=function(){return function(_0x47bbc1){return client[_0x95cf('0x1')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x95cf('0x2'),_0x95cf('0x3'),_0x95cf('0x4'),_0x95cf('0x5'),_0x95cf('0x6'),_0x95cf('0x7'),_0x95cf('0x8'),_0x95cf('0x9')],'include':[{'model':_0x95cf('0xa'),'as':_0x95cf('0xb'),'attributes':['id','name'],'include':[{'model':_0x95cf('0xc'),'as':_0x95cf('0xd'),'attributes':['id','type',_0x95cf('0xe'),_0x95cf('0xf')],'include':[{'model':_0x95cf('0x10'),'as':_0x95cf('0x10'),'attributes':['id',_0x95cf('0x2')]}]},{'model':'DeskField','as':_0x95cf('0x11'),'attributes':['id','type',_0x95cf('0xe'),_0x95cf('0x12'),_0x95cf('0x13'),_0x95cf('0x14'),_0x95cf('0xf')],'include':[{'model':'Variable','as':_0x95cf('0x10'),'attributes':['id',_0x95cf('0x2')]}]},{'model':'DeskField','as':_0x95cf('0x15'),'attributes':['id',_0x95cf('0x8'),_0x95cf('0xe'),_0x95cf('0x16'),_0x95cf('0x17'),_0x95cf('0x18'),_0x95cf('0xf')],'include':[{'model':_0x95cf('0x10'),'as':_0x95cf('0x10'),'attributes':['id',_0x95cf('0x2')]}]},{'model':_0x95cf('0x19'),'as':'Tags','attributes':['id',_0x95cf('0x2')]}]}]},'log':_0x95cf('0x1a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 7b75aef..ac8d926 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['data5','data7','getDynamics365Accounts','Request','GetDynamics365Account','name','tenantId','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','additionalSearchContact','openNewTab','Subjects','type','content','variableName','Variable','Dynamics365Field','key','keyType','keyContent','Fields','idField','nameField','customField','CloudProvider','data2'];(function(_0x9148ba,_0x2cb1b5){var _0x355e3b=function(_0x134846){while(--_0x134846){_0x9148ba['push'](_0x9148ba['shift']());}};_0x355e3b(++_0x2cb1b5);}(_0xda2d,0x102));var _0xdda2=function(_0x328ee2,_0x2f3f7c){_0x328ee2=_0x328ee2-0x0;var _0x36a71f=_0xda2d[_0x328ee2];return _0x36a71f;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4'),_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9')],'include':[{'model':_0xdda2('0xa'),'as':_0xdda2('0xb'),'attributes':['id',_0xdda2('0x3'),_0xdda2('0xc'),'moduleCreate',_0xdda2('0xd'),_0xdda2('0xe')],'include':[{'model':'Dynamics365Field','as':_0xdda2('0xf'),'attributes':['id',_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12')],'include':[{'model':_0xdda2('0x13'),'as':_0xdda2('0x13'),'attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x14'),'as':'Descriptions','attributes':['id','type','content',_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x12')],'include':[{'model':_0xdda2('0x13'),'as':_0xdda2('0x13'),'attributes':['id',_0xdda2('0x3')]}]},{'model':'Dynamics365Field','as':_0xdda2('0x18'),'attributes':['id','type',_0xdda2('0x11'),_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]},{'model':'CloudProvider','as':_0xdda2('0x1c'),'attributes':['id',_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f')]}]},'log':_0xdda2('0x2')});};}; \ No newline at end of file +var _0xbb59=['name','username','password','remoteUri','tenantId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','keyContent','nameField','customField','CloudProvider','data2','data5','data7','GetDynamics365Account','../../client','getDynamics365Accounts'];(function(_0x2e5c35,_0x394e57){var _0x532e77=function(_0x4b40ad){while(--_0x4b40ad){_0x2e5c35['push'](_0x2e5c35['shift']());}};_0x532e77(++_0x394e57);}(_0xbb59,0xec));var _0x9bb5=function(_0x24dec3,_0x185df2){_0x24dec3=_0x24dec3-0x0;var _0x31334a=_0xbb59[_0x24dec3];return _0x31334a;};'use strict';var client=require(_0x9bb5('0x0'));exports[_0x9bb5('0x1')]=function(){return function(_0xc97996){return client['Request']('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0x9bb5('0x2'),_0x9bb5('0x3'),_0x9bb5('0x4'),_0x9bb5('0x5'),_0x9bb5('0x6'),'clientId',_0x9bb5('0x7'),_0x9bb5('0x8'),_0x9bb5('0x9'),_0x9bb5('0xa')],'include':[{'model':_0x9bb5('0xb'),'as':_0x9bb5('0xc'),'attributes':['id',_0x9bb5('0x2'),_0x9bb5('0xd'),_0x9bb5('0xe'),_0x9bb5('0xf'),_0x9bb5('0x10')],'include':[{'model':_0x9bb5('0x11'),'as':_0x9bb5('0x12'),'attributes':['id','type',_0x9bb5('0x13'),_0x9bb5('0x14')],'include':[{'model':_0x9bb5('0x15'),'as':_0x9bb5('0x15'),'attributes':['id',_0x9bb5('0x2')]}]},{'model':_0x9bb5('0x11'),'as':_0x9bb5('0x16'),'attributes':['id',_0x9bb5('0x17'),_0x9bb5('0x13'),_0x9bb5('0x18'),_0x9bb5('0x19'),_0x9bb5('0x1a'),_0x9bb5('0x14')],'include':[{'model':_0x9bb5('0x15'),'as':'Variable','attributes':['id','name']}]},{'model':_0x9bb5('0x11'),'as':'Fields','attributes':['id','type',_0x9bb5('0x13'),'idField',_0x9bb5('0x1b'),_0x9bb5('0x1c'),_0x9bb5('0x14')],'include':[{'model':'Variable','as':_0x9bb5('0x15'),'attributes':['id',_0x9bb5('0x2')]}]}]},{'model':_0x9bb5('0x1d'),'as':_0x9bb5('0x1d'),'attributes':['id',_0x9bb5('0x1e'),_0x9bb5('0x1f'),_0x9bb5('0x20')]}]},'log':_0x9bb5('0x21')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 846a021..12d350b 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2964=['type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','FreshdeskConfiguration','Configurations','Tag','FreshdeskField'];(function(_0x5e5ba1,_0x414dd8){var _0x15cb4f=function(_0x3d84b1){while(--_0x3d84b1){_0x5e5ba1['push'](_0x5e5ba1['shift']());}};_0x15cb4f(++_0x414dd8);}(_0x2964,0x108));var _0x4296=function(_0x549a15,_0x21290f){_0x549a15=_0x549a15-0x0;var _0x21275e=_0x2964[_0x549a15];return _0x21275e;};'use strict';var client=require(_0x4296('0x0'));exports[_0x4296('0x1')]=function(){return function(_0x31be5e){return client[_0x4296('0x2')](_0x4296('0x3'),{'options':{'raw':![],'attributes':['id',_0x4296('0x4'),_0x4296('0x5'),_0x4296('0x6'),_0x4296('0x7'),'serverUrl'],'include':[{'model':_0x4296('0x8'),'as':_0x4296('0x9'),'attributes':['id',_0x4296('0x4')],'include':[{'model':_0x4296('0xa'),'attributes':['id',_0x4296('0x4')]},{'model':_0x4296('0xb'),'as':'Subjects','attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x10'),'attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0x11'),_0x4296('0x12'),'keyContent',_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x13'),'attributes':['id',_0x4296('0xc'),'content',_0x4296('0x14'),_0x4296('0x15'),_0x4296('0x16'),'variableName'],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0xd8b0=['Fields','idField','nameField','customField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','name','username','apiKey','remoteUri','serverUrl','Tag','Subjects','type','variableName','Variable','FreshdeskField','Descriptions','content','keyType'];(function(_0x16de06,_0x415370){var _0xe182c=function(_0x3c22c9){while(--_0x3c22c9){_0x16de06['push'](_0x16de06['shift']());}};_0xe182c(++_0x415370);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(_0x5a55a3){return client['Request']('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x0d8b('0x2'),_0x0d8b('0x3'),_0x0d8b('0x4'),_0x0d8b('0x5'),_0x0d8b('0x6')],'include':[{'model':'FreshdeskConfiguration','as':'Configurations','attributes':['id',_0x0d8b('0x2')],'include':[{'model':_0x0d8b('0x7'),'attributes':['id',_0x0d8b('0x2')]},{'model':'FreshdeskField','as':_0x0d8b('0x8'),'attributes':['id',_0x0d8b('0x9'),'content',_0x0d8b('0xa')],'include':[{'model':_0x0d8b('0xb'),'as':_0x0d8b('0xb'),'attributes':['id',_0x0d8b('0x2')]}]},{'model':_0x0d8b('0xc'),'as':_0x0d8b('0xd'),'attributes':['id',_0x0d8b('0x9'),_0x0d8b('0xe'),'key',_0x0d8b('0xf'),'keyContent',_0x0d8b('0xa')],'include':[{'model':_0x0d8b('0xb'),'as':_0x0d8b('0xb'),'attributes':['id',_0x0d8b('0x2')]}]},{'model':_0x0d8b('0xc'),'as':_0x0d8b('0x10'),'attributes':['id',_0x0d8b('0x9'),_0x0d8b('0xe'),_0x0d8b('0x11'),_0x0d8b('0x12'),_0x0d8b('0x13'),_0x0d8b('0xa')],'include':[{'model':_0x0d8b('0xb'),'as':_0x0d8b('0xb'),'attributes':['id','name']}]}]}]},'log':_0x0d8b('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index a584f80..82d453f 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07e8=['Descriptions','key','keyType','keyContent','GetFreshsalesccount','../../client','getFreshsalesAccounts','GetFreshsalesAccount','username','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','variableName','Variable','name'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0x07e8,0x10f));var _0x807e=function(_0x59934f,_0x11b7f3){_0x59934f=_0x59934f-0x0;var _0x13fabd=_0x07e8[_0x59934f];return _0x13fabd;};'use strict';var client=require(_0x807e('0x0'));exports[_0x807e('0x1')]=function(){return function(_0x25e72e){return client['Request'](_0x807e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x807e('0x3'),'apiKey','remoteUri',_0x807e('0x4')],'include':[{'model':_0x807e('0x5'),'as':_0x807e('0x6'),'attributes':['id','name'],'include':[{'model':_0x807e('0x7'),'as':_0x807e('0x8'),'attributes':['id',_0x807e('0x9'),_0x807e('0xa'),_0x807e('0xb')],'include':[{'model':'Variable','as':_0x807e('0xc'),'attributes':['id',_0x807e('0xd')]}]},{'model':_0x807e('0x7'),'as':_0x807e('0xe'),'attributes':['id',_0x807e('0x9'),_0x807e('0xa'),_0x807e('0xf'),_0x807e('0x10'),_0x807e('0x11'),_0x807e('0xb')],'include':[{'model':_0x807e('0xc'),'as':_0x807e('0xc'),'attributes':['id',_0x807e('0xd')]}]}]}]},'log':_0x807e('0x12')});};}; \ No newline at end of file +var _0x6596=['FreshsalesField','Subjects','type','Variable','Descriptions','key','variableName','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','username','apiKey','remoteUri','Configurations'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x6596,0x1d3));var _0x6659=function(_0xcabeca,_0x110799){_0xcabeca=_0xcabeca-0x0;var _0x150411=_0x6596[_0xcabeca];return _0x150411;};'use strict';var client=require(_0x6659('0x0'));exports[_0x6659('0x1')]=function(){return function(_0x51eb88){return client[_0x6659('0x2')](_0x6659('0x3'),{'options':{'raw':![],'attributes':['id',_0x6659('0x4'),_0x6659('0x5'),_0x6659('0x6'),_0x6659('0x7'),'serverUrl'],'include':[{'model':'FreshsalesConfiguration','as':_0x6659('0x8'),'attributes':['id',_0x6659('0x4')],'include':[{'model':_0x6659('0x9'),'as':_0x6659('0xa'),'attributes':['id',_0x6659('0xb'),'content','variableName'],'include':[{'model':_0x6659('0xc'),'as':_0x6659('0xc'),'attributes':['id',_0x6659('0x4')]}]},{'model':_0x6659('0x9'),'as':_0x6659('0xd'),'attributes':['id',_0x6659('0xb'),'content',_0x6659('0xe'),'keyType','keyContent',_0x6659('0xf')],'include':[{'model':'Variable','as':_0x6659('0xc'),'attributes':['id',_0x6659('0x4')]}]}]}]},'log':_0x6659('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 351c1bb..4e7be19 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3557=['SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchLead','SalesforceField','Variable','Descriptions','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','serverUrl'];(function(_0x2b91df,_0x47a223){var _0x217663=function(_0x49525d){while(--_0x49525d){_0x2b91df['push'](_0x2b91df['shift']());}};_0x217663(++_0x47a223);}(_0x3557,0x137));var _0x7355=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x3557[_0x231b2e];return _0x3feb2a;};'use strict';var client=require('../../client');exports['getSalesforceAccounts']=function(){return function(_0x3801e6){return client[_0x7355('0x0')](_0x7355('0x1'),{'options':{'raw':![],'attributes':['id',_0x7355('0x2'),_0x7355('0x3'),_0x7355('0x4'),_0x7355('0x5'),_0x7355('0x6'),_0x7355('0x7'),'securityToken',_0x7355('0x8'),'type'],'include':[{'model':_0x7355('0x9'),'as':_0x7355('0xa'),'attributes':['id',_0x7355('0x2'),_0x7355('0xb'),_0x7355('0xc'),_0x7355('0xd'),_0x7355('0xe'),_0x7355('0xf'),'additionalSearchContact',_0x7355('0x10')],'include':[{'model':_0x7355('0x11'),'as':'Subjects','include':[{'model':_0x7355('0x12'),'as':_0x7355('0x12'),'attributes':['id','name']}]},{'model':_0x7355('0x11'),'as':_0x7355('0x13'),'include':[{'model':_0x7355('0x12'),'as':_0x7355('0x12'),'attributes':['id',_0x7355('0x2')]}]},{'model':'SalesforceField','as':'Fields','include':[{'model':_0x7355('0x12'),'as':_0x7355('0x12'),'attributes':['id',_0x7355('0x2')]}]}]}]},'log':_0x7355('0x1')});};}; \ No newline at end of file +var _0x1619=['Variable','GetSalesforceAccount','name','username','remoteUri','clientSecret','type','SalesforceConfiguration','moduleSearch','ticketType','additionalSearchAccount','additionalSearchLead','SalesforceField','Subjects'];(function(_0x25bb67,_0x39e812){var _0x58896a=function(_0x410c3b){while(--_0x410c3b){_0x25bb67['push'](_0x25bb67['shift']());}};_0x58896a(++_0x39e812);}(_0x1619,0x189));var _0x9161=function(_0x5e1d96,_0x468e89){_0x5e1d96=_0x5e1d96-0x0;var _0x35cb1d=_0x1619[_0x5e1d96];return _0x35cb1d;};'use strict';var client=require('../../client');exports['getSalesforceAccounts']=function(){return function(_0x84b42c){return client['Request'](_0x9161('0x0'),{'options':{'raw':![],'attributes':['id',_0x9161('0x1'),_0x9161('0x2'),'password',_0x9161('0x3'),'clientId',_0x9161('0x4'),'securityToken','serverUrl',_0x9161('0x5')],'include':[{'model':_0x9161('0x6'),'as':'Configurations','attributes':['id',_0x9161('0x1'),_0x9161('0x7'),'moduleCreate',_0x9161('0x8'),'leadId',_0x9161('0x9'),'additionalSearchContact',_0x9161('0xa')],'include':[{'model':_0x9161('0xb'),'as':_0x9161('0xc'),'include':[{'model':_0x9161('0xd'),'as':_0x9161('0xd'),'attributes':['id',_0x9161('0x1')]}]},{'model':_0x9161('0xb'),'as':'Descriptions','include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x9161('0xb'),'as':'Fields','include':[{'model':_0x9161('0xd'),'as':_0x9161('0xd'),'attributes':['id',_0x9161('0x1')]}]}]}]},'log':_0x9161('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 5c9669f..51369a4 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['password','email','ServicenowConfiguration','name','Subjects','type','content','Variable','ServicenowField','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','getServicenowAccounts','Request','GetServicenowAccount','username'];(function(_0x4dd5a3,_0x1753c4){var _0x41613d=function(_0x155f52){while(--_0x155f52){_0x4dd5a3['push'](_0x4dd5a3['shift']());}};_0x41613d(++_0x1753c4);}(_0xabce,0x103));var _0xeabc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xabce[_0x4bfac3];return _0x15f0f2;};'use strict';var client=require(_0xeabc('0x0'));exports[_0xeabc('0x1')]=function(){return function(_0x357cda){return client[_0xeabc('0x2')](_0xeabc('0x3'),{'options':{'raw':![],'attributes':['id','name','description',_0xeabc('0x4'),_0xeabc('0x5'),_0xeabc('0x6'),'remoteUri','serverUrl'],'include':[{'model':_0xeabc('0x7'),'as':'Configurations','attributes':['id',_0xeabc('0x8')],'include':[{'model':'ServicenowField','as':_0xeabc('0x9'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),'variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0xe'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),_0xeabc('0xf'),_0xeabc('0x10'),_0xeabc('0x11'),_0xeabc('0x12')],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0x13'),'attributes':['id','type',_0xeabc('0xb'),_0xeabc('0x14'),_0xeabc('0x15'),'customField','variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0x4137=['Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts'];(function(_0x594921,_0x305c63){var _0x42ec6a=function(_0x35be16){while(--_0x35be16){_0x594921['push'](_0x594921['shift']());}};_0x42ec6a(++_0x305c63);}(_0x4137,0xf8));var _0x7413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4137[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x7413('0x0'));exports[_0x7413('0x1')]=function(){return function(_0x370399){return client[_0x7413('0x2')](_0x7413('0x3'),{'options':{'raw':![],'attributes':['id',_0x7413('0x4'),_0x7413('0x5'),_0x7413('0x6'),_0x7413('0x7'),_0x7413('0x8'),_0x7413('0x9'),_0x7413('0xa')],'include':[{'model':'ServicenowConfiguration','as':_0x7413('0xb'),'attributes':['id',_0x7413('0x4')],'include':[{'model':_0x7413('0xc'),'as':_0x7413('0xd'),'attributes':['id','type',_0x7413('0xe'),_0x7413('0xf')],'include':[{'model':'Variable','as':_0x7413('0x10'),'attributes':['id',_0x7413('0x4')]}]},{'model':'ServicenowField','as':_0x7413('0x11'),'attributes':['id',_0x7413('0x12'),_0x7413('0xe'),_0x7413('0x13'),_0x7413('0x14'),'keyContent',_0x7413('0xf')],'include':[{'model':_0x7413('0x10'),'as':'Variable','attributes':['id',_0x7413('0x4')]}]},{'model':_0x7413('0xc'),'as':_0x7413('0x15'),'attributes':['id','type','content','idField',_0x7413('0x16'),_0x7413('0x17'),'variableName'],'include':[{'model':_0x7413('0x10'),'as':_0x7413('0x10'),'attributes':['id','name']}]}]}]},'log':_0x7413('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 46bdc75..d32260b 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['Configurations','SugarcrmField','Subjects','variableName','Variable','Descriptions','type','key','keyType','Fields','content','idField','customField','../../client','GetSugarcrmAccount','name','username','password','remoteUri','serverUrl','SugarcrmConfiguration'];(function(_0x414cbe,_0x16a463){var _0x2793fe=function(_0x3a75f6){while(--_0x3a75f6){_0x414cbe['push'](_0x414cbe['shift']());}};_0x2793fe(++_0x16a463);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x0b0e[_0x1304c6];return _0x2e6654;};'use strict';var client=require(_0xe0b0('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0xc416e3){return client['Request'](_0xe0b0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6')],'include':[{'model':_0xe0b0('0x7'),'as':_0xe0b0('0x8'),'attributes':['id',_0xe0b0('0x2')],'include':[{'model':_0xe0b0('0x9'),'as':_0xe0b0('0xa'),'attributes':['id','type','content',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]},{'model':'SugarcrmField','as':_0xe0b0('0xd'),'attributes':['id',_0xe0b0('0xe'),'content',_0xe0b0('0xf'),_0xe0b0('0x10'),'keyContent',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id','name']}]},{'model':_0xe0b0('0x9'),'as':_0xe0b0('0x11'),'attributes':['id',_0xe0b0('0xe'),_0xe0b0('0x12'),_0xe0b0('0x13'),'nameField',_0xe0b0('0x14'),_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file +var _0x5f66=['nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','serverUrl','Configurations','type','content','variableName','Variable','key','keyType','Fields','idField'];(function(_0x1a8b4b,_0x14654b){var _0x2df39a=function(_0x2006a7){while(--_0x2006a7){_0x1a8b4b['push'](_0x1a8b4b['shift']());}};_0x2df39a(++_0x14654b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var client=require('../../client');exports[_0x65f6('0x0')]=function(){return function(_0x4a3887){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'options':{'raw':![],'attributes':['id',_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'remoteUri',_0x65f6('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x65f6('0x7'),'attributes':['id',_0x65f6('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xc'),_0x65f6('0xd'),'keyContent',_0x65f6('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':_0x65f6('0xe'),'attributes':['id','type',_0x65f6('0x9'),_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]}]}]},'log':_0x65f6('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 069fa4b..9c834f6 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b18=['key','keyContent','name','idField','nameField','customField','../../client','getVtigerAccounts','GetVtigerAccount','description','username','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','variableName','Variable','Descriptions','content'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0x7b18,0xa0));var _0x87b1=function(_0x338601,_0x53e9af){_0x338601=_0x338601-0x0;var _0x5aa144=_0x7b18[_0x338601];return _0x5aa144;};'use strict';var client=require(_0x87b1('0x0'));exports[_0x87b1('0x1')]=function(){return function(_0x1663fd){return client['Request'](_0x87b1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x87b1('0x3'),_0x87b1('0x4'),'accessKey',_0x87b1('0x5'),_0x87b1('0x6')],'include':[{'model':_0x87b1('0x7'),'as':_0x87b1('0x8'),'attributes':['id','name'],'include':[{'model':_0x87b1('0x9'),'as':_0x87b1('0xa'),'attributes':['id',_0x87b1('0xb'),'content',_0x87b1('0xc')],'include':[{'model':_0x87b1('0xd'),'as':_0x87b1('0xd'),'attributes':['id','name']}]},{'model':'VtigerField','as':_0x87b1('0xe'),'attributes':['id','type',_0x87b1('0xf'),_0x87b1('0x10'),'keyType',_0x87b1('0x11'),'variableName'],'include':[{'model':_0x87b1('0xd'),'as':_0x87b1('0xd'),'attributes':['id',_0x87b1('0x12')]}]},{'model':_0x87b1('0x9'),'as':'Fields','attributes':['id',_0x87b1('0xb'),_0x87b1('0xf'),_0x87b1('0x13'),_0x87b1('0x14'),_0x87b1('0x15'),'variableName'],'include':[{'model':_0x87b1('0xd'),'as':'Variable','attributes':['id',_0x87b1('0x12')]}]}]}]},'log':_0x87b1('0x2')});};}; \ No newline at end of file +var _0x1df6=['customField','GetVtigerAccount','../../client','getVtigerAccounts','Request','name','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','content','variableName','Variable','type','key','keyType','keyContent','Fields','idField','nameField'];(function(_0x2dd752,_0x59b4fc){var _0x297823=function(_0x44a37f){while(--_0x44a37f){_0x2dd752['push'](_0x2dd752['shift']());}};_0x297823(++_0x59b4fc);}(_0x1df6,0x13a));var _0x61df=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1df6[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x61df('0x0'));exports[_0x61df('0x1')]=function(){return function(_0x172d44){return client[_0x61df('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0x61df('0x3'),'description',_0x61df('0x4'),_0x61df('0x5'),_0x61df('0x6'),_0x61df('0x7')],'include':[{'model':_0x61df('0x8'),'as':_0x61df('0x9'),'attributes':['id',_0x61df('0x3')],'include':[{'model':_0x61df('0xa'),'as':_0x61df('0xb'),'attributes':['id','type',_0x61df('0xc'),_0x61df('0xd')],'include':[{'model':_0x61df('0xe'),'as':'Variable','attributes':['id',_0x61df('0x3')]}]},{'model':_0x61df('0xa'),'as':'Descriptions','attributes':['id',_0x61df('0xf'),_0x61df('0xc'),_0x61df('0x10'),_0x61df('0x11'),_0x61df('0x12'),'variableName'],'include':[{'model':_0x61df('0xe'),'as':'Variable','attributes':['id',_0x61df('0x3')]}]},{'model':'VtigerField','as':_0x61df('0x13'),'attributes':['id',_0x61df('0xf'),_0x61df('0xc'),_0x61df('0x14'),_0x61df('0x15'),_0x61df('0x16'),_0x61df('0xd')],'include':[{'model':_0x61df('0xe'),'as':'Variable','attributes':['id',_0x61df('0x3')]}]}]}]},'log':_0x61df('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 15038bc..32bb18f 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9d1=['password','token','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName','Variable','key','keyType','keyContent','Fields','nameField','GetZendeskAccount','../../client','getZendeskAccounts','Request','name'];(function(_0x4bd181,_0x1175d8){var _0x1ca876=function(_0x2ebc74){while(--_0x2ebc74){_0x4bd181['push'](_0x4bd181['shift']());}};_0x1ca876(++_0x1175d8);}(_0xf9d1,0x1e0));var _0x1f9d=function(_0x2f8169,_0x549933){_0x2f8169=_0x2f8169-0x0;var _0x3f85d1=_0xf9d1[_0x2f8169];return _0x3f85d1;};'use strict';var client=require(_0x1f9d('0x0'));exports[_0x1f9d('0x1')]=function(){return function(_0x144329){return client[_0x1f9d('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x1f9d('0x3'),'username',_0x1f9d('0x4'),_0x1f9d('0x5'),'remoteUri','authType',_0x1f9d('0x6'),_0x1f9d('0x7')],'include':[{'model':_0x1f9d('0x8'),'as':_0x1f9d('0x9'),'attributes':['id',_0x1f9d('0x3')],'include':[{'model':_0x1f9d('0xa'),'attributes':['id',_0x1f9d('0x3')]},{'model':_0x1f9d('0xb'),'as':_0x1f9d('0xc'),'attributes':['id','type',_0x1f9d('0xd'),_0x1f9d('0xe')],'include':[{'model':_0x1f9d('0xf'),'as':_0x1f9d('0xf'),'attributes':['id',_0x1f9d('0x3')]}]},{'model':_0x1f9d('0xb'),'as':'Descriptions','attributes':['id','type',_0x1f9d('0xd'),_0x1f9d('0x10'),_0x1f9d('0x11'),_0x1f9d('0x12'),_0x1f9d('0xe')],'include':[{'model':_0x1f9d('0xf'),'as':_0x1f9d('0xf'),'attributes':['id',_0x1f9d('0x3')]}]},{'model':'ZendeskField','as':_0x1f9d('0x13'),'attributes':['id',_0x1f9d('0x7'),_0x1f9d('0xd'),'idField',_0x1f9d('0x14'),'customField','variableName'],'include':[{'model':_0x1f9d('0xf'),'as':_0x1f9d('0xf'),'attributes':['id',_0x1f9d('0x3')]}]}]}]},'log':_0x1f9d('0x15')});};}; \ No newline at end of file +var _0x2c90=['key','keyType','Fields','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','password','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','content','variableName','Variable','ZendeskField'];(function(_0x38b3ec,_0x476ff7){var _0x5ae1ce=function(_0x1a3ee5){while(--_0x1a3ee5){_0x38b3ec['push'](_0x38b3ec['shift']());}};_0x5ae1ce(++_0x476ff7);}(_0x2c90,0x1a4));var _0x02c9=function(_0x250577,_0x48ee0b){_0x250577=_0x250577-0x0;var _0xfab504=_0x2c90[_0x250577];return _0xfab504;};'use strict';var client=require(_0x02c9('0x0'));exports[_0x02c9('0x1')]=function(){return function(_0x3c387d){return client[_0x02c9('0x2')](_0x02c9('0x3'),{'options':{'raw':![],'attributes':['id',_0x02c9('0x4'),'username',_0x02c9('0x5'),'token',_0x02c9('0x6'),_0x02c9('0x7'),_0x02c9('0x8'),_0x02c9('0x9')],'include':[{'model':_0x02c9('0xa'),'as':_0x02c9('0xb'),'attributes':['id','name'],'include':[{'model':_0x02c9('0xc'),'attributes':['id',_0x02c9('0x4')]},{'model':'ZendeskField','as':'Subjects','attributes':['id','type',_0x02c9('0xd'),_0x02c9('0xe')],'include':[{'model':_0x02c9('0xf'),'as':_0x02c9('0xf'),'attributes':['id','name']}]},{'model':_0x02c9('0x10'),'as':'Descriptions','attributes':['id','type',_0x02c9('0xd'),_0x02c9('0x11'),_0x02c9('0x12'),'keyContent','variableName'],'include':[{'model':_0x02c9('0xf'),'as':'Variable','attributes':['id',_0x02c9('0x4')]}]},{'model':_0x02c9('0x10'),'as':_0x02c9('0x13'),'attributes':['id','type',_0x02c9('0xd'),_0x02c9('0x14'),_0x02c9('0x15'),_0x02c9('0x16'),_0x02c9('0xe')],'include':[{'model':_0x02c9('0xf'),'as':_0x02c9('0xf'),'attributes':['id',_0x02c9('0x4')]}]}]}]},'log':_0x02c9('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 9865829..bbc626d 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8052=['variableName','Variable','Descriptions','content','key','keyType','Fields','customField','Request','GetZohoAccount','name','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','moduleCreate','moduleSearch','description','ZohoField','Subjects','type'];(function(_0xa9f2ac,_0x2d4d4f){var _0x9bb6d3=function(_0x36a6fc){while(--_0x36a6fc){_0xa9f2ac['push'](_0xa9f2ac['shift']());}};_0x9bb6d3(++_0x2d4d4f);}(_0x8052,0x102));var _0x2805=function(_0x2eab1d,_0x54edd4){_0x2eab1d=_0x2eab1d-0x0;var _0x37cfed=_0x8052[_0x2eab1d];return _0x37cfed;};'use strict';var client=require('../../client');exports['getZohoAccounts']=function(){return function(_0x3472f1){return client[_0x2805('0x0')](_0x2805('0x1'),{'options':{'raw':![],'attributes':['id',_0x2805('0x2'),'description',_0x2805('0x3'),_0x2805('0x4'),_0x2805('0x5'),_0x2805('0x6'),_0x2805('0x7'),_0x2805('0x8'),_0x2805('0x9')],'include':[{'model':_0x2805('0xa'),'as':'Configurations','attributes':['id',_0x2805('0x2'),_0x2805('0xb'),_0x2805('0xc'),_0x2805('0xd')],'include':[{'model':_0x2805('0xe'),'as':_0x2805('0xf'),'attributes':['id',_0x2805('0x10'),'content',_0x2805('0x11')],'include':[{'model':_0x2805('0x12'),'as':_0x2805('0x12'),'attributes':['id','name']}]},{'model':_0x2805('0xe'),'as':_0x2805('0x13'),'attributes':['id','type',_0x2805('0x14'),_0x2805('0x15'),_0x2805('0x16'),'keyContent',_0x2805('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x2805('0x2')]}]},{'model':_0x2805('0xe'),'as':_0x2805('0x17'),'attributes':['id','type',_0x2805('0x14'),'idField','nameField',_0x2805('0x18'),_0x2805('0x11')],'include':[{'model':'Variable','as':_0x2805('0x12'),'attributes':['id','name']}]}]}]},'log':_0x2805('0x1')});};}; \ No newline at end of file +var _0x54c3=['Configurations','moduleCreate','ZohoField','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration'];(function(_0x4fba40,_0x34414c){var _0xd2651b=function(_0x266095){while(--_0x266095){_0x4fba40['push'](_0x4fba40['shift']());}};_0xd2651b(++_0x34414c);}(_0x54c3,0x7f));var _0x354c=function(_0x1bb29c,_0x297df2){_0x1bb29c=_0x1bb29c-0x0;var _0x7262c6=_0x54c3[_0x1bb29c];return _0x7262c6;};'use strict';var client=require(_0x354c('0x0'));exports[_0x354c('0x1')]=function(){return function(_0x3fc9ab){return client[_0x354c('0x2')](_0x354c('0x3'),{'options':{'raw':![],'attributes':['id',_0x354c('0x4'),_0x354c('0x5'),_0x354c('0x6'),_0x354c('0x7'),'clientId',_0x354c('0x8'),_0x354c('0x9'),_0x354c('0xa'),_0x354c('0xb')],'include':[{'model':_0x354c('0xc'),'as':_0x354c('0xd'),'attributes':['id','name',_0x354c('0xe'),'moduleSearch',_0x354c('0x5')],'include':[{'model':_0x354c('0xf'),'as':'Subjects','attributes':['id',_0x354c('0x10'),_0x354c('0x11'),'variableName'],'include':[{'model':_0x354c('0x12'),'as':_0x354c('0x12'),'attributes':['id','name']}]},{'model':_0x354c('0xf'),'as':_0x354c('0x13'),'attributes':['id',_0x354c('0x10'),'content',_0x354c('0x14'),_0x354c('0x15'),_0x354c('0x16'),_0x354c('0x17')],'include':[{'model':_0x354c('0x12'),'as':_0x354c('0x12'),'attributes':['id',_0x354c('0x4')]}]},{'model':'ZohoField','as':_0x354c('0x18'),'attributes':['id',_0x354c('0x10'),_0x354c('0x11'),_0x354c('0x19'),_0x354c('0x1a'),_0x354c('0x1b'),_0x354c('0x17')],'include':[{'model':_0x354c('0x12'),'as':_0x354c('0x12'),'attributes':['id',_0x354c('0x4')]}]}]}]},'log':_0x354c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index ddce377..026d752 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f22=['concat','Request','IntervalIftime','intervalIftime','../../../config/logger','trim','silly','intervalIftime\x20called\x20with','isArray','length','every','number','string','map'];(function(_0x35b2c9,_0x54f081){var _0x482dbf=function(_0x13bcd3){while(--_0x13bcd3){_0x35b2c9['push'](_0x35b2c9['shift']());}};_0x482dbf(++_0x54f081);}(_0x3f22,0x66));var _0x23f2=function(_0x563eb2,_0x4315d1){_0x563eb2=_0x563eb2-0x0;var _0x26d258=_0x3f22[_0x563eb2];return _0x26d258;};var logger=require(_0x23f2('0x0'))('dialer');var client=require('../client');function intervalIftime(_0xc30414,_0xff3f6b){const _0x36d800=new Error()['stack']['replace'](/^Error/,'')[_0x23f2('0x1')]();logger[_0x23f2('0x2')](_0x23f2('0x3'),_0xc30414,_0xff3f6b,_0x36d800);const _0x512ed7=Array[_0x23f2('0x4')](_0xc30414);if(!_0xc30414||_0x512ed7&&_0xc30414[_0x23f2('0x5')]===0x0){return Promise['resolve'](![]);}else{var _0x3adbbe=[];var _0x2297d0=[];var _0x479c31=_0x512ed7?_0xc30414:[_0xc30414];var _0x2d33a2=_0x479c31[_0x23f2('0x6')](function(_0x163343){return typeof _0x163343===_0x23f2('0x7');});var _0x264275=_0x479c31['every'](function(_0x1639a4){return typeof _0x1639a4===_0x23f2('0x8');});if(!_0x2d33a2&&!_0x264275){_0x3adbbe=_0x479c31[_0x23f2('0x9')](function(_0x44a53b){return _0x44a53b['id'];});if(_0x3adbbe[_0x23f2('0x5')]===0x0){_0x2297d0=_0x479c31[_0x23f2('0x9')](function(_0x401aeb){return _0x401aeb['interval'];});}}else{if(_0x2d33a2){_0x3adbbe=_0x3adbbe['concat'](_0x479c31);}if(_0x264275){_0x2297d0=_0x2297d0[_0x23f2('0xa')](_0x479c31);}}return client[_0x23f2('0xb')](_0x23f2('0xc'),{'intervalIds':_0x3adbbe,'intervals':_0x2297d0,'timezone':_0xff3f6b,'log':_0x23f2('0xc')});}}exports[_0x23f2('0xd')]=intervalIftime; \ No newline at end of file +var _0x9fcb=['IntervalIftime','../../../config/logger','dialer','stack','replace','trim','silly','intervalIftime\x20called\x20with','isArray','resolve','number','every','string','map','length','concat','Request'];(function(_0x3d2438,_0x2e7922){var _0xd18de5=function(_0xe8a130){while(--_0xe8a130){_0x3d2438['push'](_0x3d2438['shift']());}};_0xd18de5(++_0x2e7922);}(_0x9fcb,0x166));var _0xb9fc=function(_0x3af45d,_0x1c96c9){_0x3af45d=_0x3af45d-0x0;var _0x4c5640=_0x9fcb[_0x3af45d];return _0x4c5640;};var logger=require(_0xb9fc('0x0'))(_0xb9fc('0x1'));var client=require('../client');function intervalIftime(_0x4c685f,_0x2447c3){const _0x30803f=new Error()[_0xb9fc('0x2')][_0xb9fc('0x3')](/^Error/,'')[_0xb9fc('0x4')]();logger[_0xb9fc('0x5')](_0xb9fc('0x6'),_0x4c685f,_0x2447c3,_0x30803f);const _0x184e7a=Array[_0xb9fc('0x7')](_0x4c685f);if(!_0x4c685f||_0x184e7a&&_0x4c685f['length']===0x0){return Promise[_0xb9fc('0x8')](![]);}else{var _0x38091b=[];var _0xdae3aa=[];var _0x5dc08a=_0x184e7a?_0x4c685f:[_0x4c685f];var _0x4b2c1d=_0x5dc08a['every'](function(_0x113e8e){return typeof _0x113e8e===_0xb9fc('0x9');});var _0x577748=_0x5dc08a[_0xb9fc('0xa')](function(_0x1f61ba){return typeof _0x1f61ba===_0xb9fc('0xb');});if(!_0x4b2c1d&&!_0x577748){_0x38091b=_0x5dc08a[_0xb9fc('0xc')](function(_0x45ff38){return _0x45ff38['id'];});if(_0x38091b[_0xb9fc('0xd')]===0x0){_0xdae3aa=_0x5dc08a[_0xb9fc('0xc')](function(_0x16e252){return _0x16e252['interval'];});}}else{if(_0x4b2c1d){_0x38091b=_0x38091b[_0xb9fc('0xe')](_0x5dc08a);}if(_0x577748){_0xdae3aa=_0xdae3aa['concat'](_0x5dc08a);}}return client[_0xb9fc('0xf')](_0xb9fc('0x10'),{'intervalIds':_0x38091b,'intervals':_0xdae3aa,'timezone':_0x2447c3,'log':_0xb9fc('0x10')});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 323e95d..9577f4f 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1529=['SIP/%s','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','TALKING','starttime','endtime','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x1529,0x1d4));var _0x9152=function(_0x34c6a3,_0x3e1a91){_0x34c6a3=_0x34c6a3-0x0;var _0x58fcda=_0x1529[_0x34c6a3];return _0x58fcda;};'use strict';var moment=require('moment');var _=require(_0x9152('0x0'));var util=require(_0x9152('0x1'));var client=require(_0x9152('0x2'));exports[_0x9152('0x3')]=function(_0x262375){var _0x3bb6c9=_0x262375[_0x9152('0x4')]||_0x262375[_0x9152('0x5')];return client[_0x9152('0x6')]('CreateMemberReport',{'body':{'channel':_0x9152('0x7'),'membername':_0x262375[_0x9152('0x8')],'interface':_[_0x9152('0x9')](_0x262375[_0x9152('0xa')])?util[_0x9152('0xb')](_0x9152('0xc'),_0x262375['lastAssignedTo']):_0x262375['interface'],'type':'TALKING','enterAt':_0x262375[_0x9152('0xd')],'exitAt':_0x3bb6c9,'duration':moment(_0x3bb6c9)[_0x9152('0xe')](_0x262375[_0x9152('0xd')],_0x9152('0xf')),'data1':'inbound','data2':_0x262375[_0x9152('0x10')],'data3':_0x262375[_0x9152('0x11')],'data4':null,'data5':_0x262375[_0x9152('0x12')],'role':_0x9152('0x13'),'internal':_0x262375[_0x9152('0x14')]?_[_0x9152('0x15')](_0x262375[_0x9152('0x14')]):undefined,'uniqueid':_0x262375[_0x9152('0x16')]},'log':_0x9152('0x17')});};exports[_0x9152('0x18')]=function(_0x13f419){return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x13f419[_0x9152('0x19')],'interface':_0x13f419[_0x9152('0xa')],'type':_0x9152('0x1a'),'enterAt':_0x13f419[_0x9152('0x1b')],'exitAt':_0x13f419['endtime'],'duration':moment(_0x13f419[_0x9152('0x1c')])[_0x9152('0xe')](_0x13f419['starttime'],_0x9152('0xf'))>=0x0?moment(_0x13f419['endtime'])['diff'](_0x13f419[_0x9152('0x1b')],_0x9152('0xf')):null,'data1':'outbound','data2':_0x13f419[_0x9152('0x14')],'data3':_0x13f419[_0x9152('0x11')],'data4':_0x13f419[_0x9152('0x1d')]||null,'role':'agent','internal':_0x13f419[_0x9152('0x14')]?_[_0x9152('0x15')](_0x13f419['accountcode']):undefined,'uniqueid':_0x13f419['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x847f=['voiceDialReport','membername','starttime','endtime','exten','dialstring','moment','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','queue','agent','toNumber','accountcode','uniqueid'];(function(_0x2679b0,_0x2a1a6f){var _0x192302=function(_0x258202){while(--_0x258202){_0x2679b0['push'](_0x2679b0['shift']());}};_0x192302(++_0x2a1a6f);}(_0x847f,0x7a));var _0xf847=function(_0x3cb260,_0x329d33){_0x3cb260=_0x3cb260-0x0;var _0xa99a90=_0x847f[_0x3cb260];return _0xa99a90;};'use strict';var moment=require(_0xf847('0x0'));var _=require('lodash');var util=require(_0xf847('0x1'));var client=require(_0xf847('0x2'));exports[_0xf847('0x3')]=function(_0x5dbc9a){var _0x3d7098=_0x5dbc9a[_0xf847('0x4')]||_0x5dbc9a['queuecallerexitAt'];return client[_0xf847('0x5')](_0xf847('0x6'),{'body':{'channel':_0xf847('0x7'),'membername':_0x5dbc9a[_0xf847('0x8')],'interface':_[_0xf847('0x9')](_0x5dbc9a[_0xf847('0xa')])?util[_0xf847('0xb')](_0xf847('0xc'),_0x5dbc9a[_0xf847('0x8')]):_0x5dbc9a[_0xf847('0xa')],'type':_0xf847('0xd'),'enterAt':_0x5dbc9a[_0xf847('0xe')],'exitAt':_0x3d7098,'duration':moment(_0x3d7098)[_0xf847('0xf')](_0x5dbc9a[_0xf847('0xe')],_0xf847('0x10')),'data1':'inbound','data2':_0x5dbc9a[_0xf847('0x11')],'data3':_0x5dbc9a['exten'],'data4':null,'data5':_0x5dbc9a[_0xf847('0x12')],'role':_0xf847('0x13'),'internal':_0x5dbc9a['accountcode']?_[_0xf847('0x14')](_0x5dbc9a[_0xf847('0x15')]):undefined,'uniqueid':_0x5dbc9a[_0xf847('0x16')]},'log':_0xf847('0x6')});};exports[_0xf847('0x17')]=function(_0x1926d0){return client['Request']('CreateMemberReport',{'body':{'channel':_0xf847('0x7'),'membername':_0x1926d0[_0xf847('0x18')],'interface':_0x1926d0[_0xf847('0xa')],'type':_0xf847('0xd'),'enterAt':_0x1926d0[_0xf847('0x19')],'exitAt':_0x1926d0[_0xf847('0x1a')],'duration':moment(_0x1926d0[_0xf847('0x1a')])[_0xf847('0xf')](_0x1926d0['starttime'],_0xf847('0x10'))>=0x0?moment(_0x1926d0[_0xf847('0x1a')])[_0xf847('0xf')](_0x1926d0[_0xf847('0x19')],_0xf847('0x10')):null,'data1':'outbound','data2':_0x1926d0[_0xf847('0x15')],'data3':_0x1926d0[_0xf847('0x1b')],'data4':_0x1926d0[_0xf847('0x1c')]||null,'role':'agent','internal':_0x1926d0['accountcode']?_[_0xf847('0x14')](_0x1926d0[_0xf847('0x15')]):undefined,'uniqueid':_0x1926d0[_0xf847('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index df6c87e..1ee055f 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 _0xbd8e=['GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbd8e[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0xebd8('0x0'));exports[_0xebd8('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xebd8('0x2'),'previewRecallmeReminderInterval']},'log':_0xebd8('0x3')});}; \ No newline at end of file +var _0x0135=['../client','getSettings','Request','ShowSetting'];(function(_0x57f7ea,_0x54da6b){var _0x54a7e4=function(_0x2c9d4f){while(--_0x2c9d4f){_0x57f7ea['push'](_0x57f7ea['shift']());}};_0x54a7e4(++_0x54da6b);}(_0x0135,0x188));var _0x5013=function(_0x1ed778,_0x3f4f51){_0x1ed778=_0x1ed778-0x0;var _0x40f022=_0x0135[_0x1ed778];return _0x40f022;};'use strict';var client=require(_0x5013('0x0'));exports[_0x5013('0x1')]=function(){return client[_0x5013('0x2')](_0x5013('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 4c5eb9c..fa4bee0 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 _0xb337=['Request','GetTemplate','name','../client','getTemplates'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0xb337,0x175));var _0x7b33=function(_0x27559d,_0x1a77d9){_0x27559d=_0x27559d-0x0;var _0x41d5d2=_0xb337[_0x27559d];return _0x41d5d2;};'use strict';var client=require(_0x7b33('0x0'));exports[_0x7b33('0x1')]=function(_0x594c25){return function(_0x48c76f){return client[_0x7b33('0x2')](_0x7b33('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7b33('0x4'),'html']},'log':_0x7b33('0x3')});};}; \ No newline at end of file +var _0xf4ce=['GetTemplate','name','../client','Request'];(function(_0x57c172,_0x17630e){var _0x1597e4=function(_0x492dd3){while(--_0x492dd3){_0x57c172['push'](_0x57c172['shift']());}};_0x1597e4(++_0x17630e);}(_0xf4ce,0xf2));var _0xef4c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf4ce[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xef4c('0x0'));exports['getTemplates']=function(_0x4914ae){return function(_0x3b586d){return client[_0xef4c('0x1')](_0xef4c('0x2'),{'options':{'raw':!![],'attributes':['id',_0xef4c('0x3'),'html']},'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 d362809..1df948c 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 _0xa599=['data2','data3','data4','data6','data7','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Actions','action','data1'];(function(_0x1da60f,_0x1f1642){var _0x1556f1=function(_0x232b94){while(--_0x232b94){_0x1da60f['push'](_0x1da60f['shift']());}};_0x1556f1(++_0x1f1642);}(_0xa599,0x148));var _0x9a59=function(_0xa6a7e7,_0x31326a){_0xa6a7e7=_0xa6a7e7-0x0;var _0x5d8892=_0xa599[_0xa6a7e7];return _0x5d8892;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x38d0ed){return function(_0x3bf233){return client[_0x9a59('0x0')](_0x9a59('0x1'),{'options':{'raw':![],'attributes':['id',_0x9a59('0x2'),_0x9a59('0x3'),_0x9a59('0x4')],'include':[{'model':_0x9a59('0x5'),'as':_0x9a59('0x6'),'attributes':['id',_0x9a59('0x7'),_0x9a59('0x8'),_0x9a59('0x9')]},{'model':_0x9a59('0x5'),'as':_0x9a59('0xa'),'attributes':['id',_0x9a59('0x7'),_0x9a59('0x8'),'value']},{'model':'Action','as':_0x9a59('0xb'),'attributes':['id',_0x9a59('0xc'),_0x9a59('0xd'),_0x9a59('0xe'),_0x9a59('0xf'),_0x9a59('0x10'),'data5',_0x9a59('0x11'),_0x9a59('0x12')]}]},'log':_0x9a59('0x1')});};}; \ No newline at end of file +var _0x9de2=['../client','getTriggers','Request','GetTrigger','name','AllConditions','field','operator','value','Condition','AnyConditions','Action','action','data1','data2','data3','data4','data5'];(function(_0x37e7a4,_0xb7a496){var _0x269b2a=function(_0x19ee3f){while(--_0x19ee3f){_0x37e7a4['push'](_0x37e7a4['shift']());}};_0x269b2a(++_0xb7a496);}(_0x9de2,0x18c));var _0x29de=function(_0x1ea272,_0x503ab2){_0x1ea272=_0x1ea272-0x0;var _0x3172d2=_0x9de2[_0x1ea272];return _0x3172d2;};'use strict';var client=require(_0x29de('0x0'));exports[_0x29de('0x1')]=function(_0x4a27ed){return function(_0x12d1b2){return client[_0x29de('0x2')](_0x29de('0x3'),{'options':{'raw':![],'attributes':['id',_0x29de('0x4'),'channel','status'],'include':[{'model':'Condition','as':_0x29de('0x5'),'attributes':['id',_0x29de('0x6'),_0x29de('0x7'),_0x29de('0x8')]},{'model':_0x29de('0x9'),'as':_0x29de('0xa'),'attributes':['id','field',_0x29de('0x7'),'value']},{'model':_0x29de('0xb'),'as':'Actions','attributes':['id',_0x29de('0xc'),_0x29de('0xd'),_0x29de('0xe'),_0x29de('0xf'),_0x29de('0x10'),_0x29de('0x11'),'data6','data7']}]},'log':_0x29de('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ac54f24..fe404b4 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 _0xdb13=['GetTrunk','name','defaultuser','getTrunks','Request'];(function(_0x2acf96,_0x23fc67){var _0x3e692b=function(_0x484137){while(--_0x484137){_0x2acf96['push'](_0x2acf96['shift']());}};_0x3e692b(++_0x23fc67);}(_0xdb13,0x10c));var _0x3db1=function(_0x1ae7a8,_0x39f94e){_0x1ae7a8=_0x1ae7a8-0x0;var _0x264fd7=_0xdb13[_0x1ae7a8];return _0x264fd7;};'use strict';var client=require('../client');exports[_0x3db1('0x0')]=function(_0x366725){return function(_0x38d692){return client[_0x3db1('0x1')](_0x3db1('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3db1('0x3'),'registry',_0x3db1('0x4')]},'log':_0x3db1('0x2')});};}; \ No newline at end of file +var _0xeea2=['defaultuser','../client','Request','GetTrunk','name'];(function(_0x1ada1b,_0x17ae08){var _0x3aa8d3=function(_0x27966e){while(--_0x27966e){_0x1ada1b['push'](_0x1ada1b['shift']());}};_0x3aa8d3(++_0x17ae08);}(_0xeea2,0xce));var _0x2eea=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xeea2[_0x307d86];return _0x361745;};'use strict';var client=require(_0x2eea('0x0'));exports['getTrunks']=function(_0x5a2a7f){return function(_0x418b56){return client[_0x2eea('0x1')](_0x2eea('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2eea('0x3'),'registry',_0x2eea('0x4')]},'log':_0x2eea('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 956a759..1b90f4f 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x32b1c7,_0x928c12){var _0x1ba7ee=function(_0x51a406){while(--_0x51a406){_0x32b1c7['push'](_0x32b1c7['shift']());}};_0x1ba7ee(++_0x928c12);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x3ba82b,_0x3830fa){var _0x2cc144=function(_0x282b81){while(--_0x282b81){_0x3ba82b['push'](_0x3ba82b['shift']());}};_0x2cc144(++_0x3830fa);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ec76c03..2f9a60f 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 _0x0537=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0537,0x1be));var _0x7053=function(_0x468a75,_0xd34746){_0x468a75=_0x468a75-0x0;var _0x1cf284=_0x0537[_0x468a75];return _0x1cf284;};'use strict';var client=require(_0x7053('0x0'));exports[_0x7053('0x1')]=function(_0x8ab46){return client['Request'](_0x7053('0x2'),{'body':_0x8ab46,'log':_0x7053('0x2')});};exports['update']=function(_0x441346,_0x5e49a4,_0x11f623){return client[_0x7053('0x3')](_0x7053('0x4'),{'body':_0x441346,'options':{'where':{'uniqueid':_0x5e49a4,'interface':_0x11f623,'agentcomplete':!![]}},'log':_0x7053('0x4')});}; \ No newline at end of file +var _0xc3a0=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x24a8a0,_0x2d581f){var _0x3fe3ef=function(_0x12287e){while(--_0x12287e){_0x24a8a0['push'](_0x24a8a0['shift']());}};_0x3fe3ef(++_0x2d581f);}(_0xc3a0,0x1ba));var _0x0c3a=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xc3a0[_0x86b219];return _0x1f320c;};'use strict';var client=require(_0x0c3a('0x0'));exports[_0x0c3a('0x1')]=function(_0x5ab688){return client[_0x0c3a('0x2')](_0x0c3a('0x3'),{'body':_0x5ab688,'log':_0x0c3a('0x3')});};exports[_0x0c3a('0x4')]=function(_0x580218,_0x15e595,_0xef2461){return client[_0x0c3a('0x2')]('UpdateVoiceAgentReport',{'body':_0x580218,'options':{'where':{'uniqueid':_0x15e595,'interface':_0xef2461,'agentcomplete':!![]}},'log':_0x0c3a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 1fc6b89..8d4bb5c 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 _0xd551=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound'];(function(_0x972692,_0x2a1c56){var _0x542e84=function(_0xe63f21){while(--_0xe63f21){_0x972692['push'](_0x972692['shift']());}};_0x542e84(++_0x2a1c56);}(_0xd551,0x163));var _0x1d55=function(_0x89d6d9,_0x51362d){_0x89d6d9=_0x89d6d9-0x0;var _0x1ddb0b=_0xd551[_0x89d6d9];return _0x1ddb0b;};'use strict';var moment=require(_0x1d55('0x0'));var util=require(_0x1d55('0x1'));var _=require(_0x1d55('0x2'));var client=require(_0x1d55('0x3'));exports[_0x1d55('0x4')]=function(_0x2f1fed){return client['Request'](_0x1d55('0x5'),{'body':_[_0x1d55('0x6')](_0x2f1fed,{'source':_0x2f1fed[_0x1d55('0x7')],'destinationcontext':_0x2f1fed[_0x1d55('0x8')],'callerid':_0x2f1fed[_0x1d55('0x9')],'amaflags':_0x1d55('0xa')}),'log':_0x1d55('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x1d55('0xb'),{'options':{'where':{'type':[_0x1d55('0xc')],'createdAt':{'$between':[moment()[_0x1d55('0xd')](_0x1d55('0xe'))[_0x1d55('0xf')](_0x1d55('0x10')),moment()[_0x1d55('0x11')](_0x1d55('0xe'))[_0x1d55('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x1d55('0x12'),_0x1d55('0x13'),_0x1d55('0x14'),_0x1d55('0x15')]},'log':_0x1d55('0x16')});};}; \ No newline at end of file +var _0x769f=['context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','moment','util','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x51a4ab,_0x3e5507){var _0x207a8a=function(_0x3e7d06){while(--_0x3e7d06){_0x51a4ab['push'](_0x51a4ab['shift']());}};_0x207a8a(++_0x3e5507);}(_0x769f,0x111));var _0xf769=function(_0x4d518d,_0x4cac74){_0x4d518d=_0x4d518d-0x0;var _0x22b52f=_0x769f[_0x4d518d];return _0x22b52f;};'use strict';var moment=require(_0xf769('0x0'));var util=require(_0xf769('0x1'));var _=require(_0xf769('0x2'));var client=require(_0xf769('0x3'));exports[_0xf769('0x4')]=function(_0x968062){return client[_0xf769('0x5')](_0xf769('0x6'),{'body':_['merge'](_0x968062,{'source':_0x968062['calleridnum'],'destinationcontext':_0x968062[_0xf769('0x7')],'callerid':_0x968062[_0xf769('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xf769('0x6')});};exports[_0xf769('0x9')]=function(){return function(){return client[_0xf769('0x5')](_0xf769('0xa'),{'options':{'where':{'type':[_0xf769('0xb')],'createdAt':{'$between':[moment()[_0xf769('0xc')](_0xf769('0xd'))[_0xf769('0xe')](_0xf769('0xf')),moment()[_0xf769('0x10')](_0xf769('0xd'))[_0xf769('0xe')](_0xf769('0xf'))]}},'attributes':[_0xf769('0x11'),_0xf769('0x12'),'duration',_0xf769('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index ef202c8..aef39a7 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 _0x743f=['CreateVoiceDialReport','../client','create','Request'];(function(_0x599960,_0x292b74){var _0xae3b3c=function(_0x49b02a){while(--_0x49b02a){_0x599960['push'](_0x599960['shift']());}};_0xae3b3c(++_0x292b74);}(_0x743f,0x185));var _0xf743=function(_0x30b1c7,_0x5dbc45){_0x30b1c7=_0x30b1c7-0x0;var _0xaa0f18=_0x743f[_0x30b1c7];return _0xaa0f18;};'use strict';var client=require(_0xf743('0x0'));exports[_0xf743('0x1')]=function(_0x22d4fa){return client[_0xf743('0x2')](_0xf743('0x3'),{'body':_0x22d4fa,'log':_0xf743('0x3')});}; \ No newline at end of file +var _0x4d5e=['CreateVoiceDialReport','create','Request'];(function(_0x3b4026,_0x179d74){var _0x118086=function(_0x477441){while(--_0x477441){_0x3b4026['push'](_0x3b4026['shift']());}};_0x118086(++_0x179d74);}(_0x4d5e,0x130));var _0xe4d5=function(_0x65b914,_0x1720e8){_0x65b914=_0x65b914-0x0;var _0x714de4=_0x4d5e[_0x65b914];return _0x714de4;};'use strict';var client=require('../client');exports[_0xe4d5('0x0')]=function(_0x18b8ce){return client[_0xe4d5('0x1')](_0xe4d5('0x2'),{'body':_0x18b8ce,'log':_0xe4d5('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c9281f1..c5a3bdd 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 _0xb84e=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x4e46ab,_0x6c98b6){var _0x37710a=function(_0x279255){while(--_0x279255){_0x4e46ab['push'](_0x4e46ab['shift']());}};_0x37710a(++_0x6c98b6);}(_0xb84e,0xbf));var _0xeb84=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0xb84e[_0x888385];return _0x22d5c2;};'use strict';var client=require('../client');exports[_0xeb84('0x0')]=function(){return function(){return client[_0xeb84('0x1')](_0xeb84('0x2'),{'options':{'raw':!![],'attributes':['id',_0xeb84('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x6b19=['GetVoiceExtension','../client','getVoiceExtensions'];(function(_0x486561,_0x2296ad){var _0x106253=function(_0x55dbda){while(--_0x55dbda){_0x486561['push'](_0x486561['shift']());}};_0x106253(++_0x2296ad);}(_0x6b19,0xe8));var _0x96b1=function(_0x1bf7a0,_0x2551ac){_0x1bf7a0=_0x1bf7a0-0x0;var _0x3846d7=_0x6b19[_0x1bf7a0];return _0x3846d7;};'use strict';var client=require(_0x96b1('0x0'));exports[_0x96b1('0x1')]=function(){return function(){return client['Request'](_0x96b1('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x96b1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d398aeb..e3979cc 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 _0x5981=['GetVoiceQueue','name','acw','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','callerid','active','Interval','Intervals','interval','getVoiceQueues'];(function(_0x2316b9,_0x87059b){var _0x4405a9=function(_0xd9a3e1){while(--_0xd9a3e1){_0x2316b9['push'](_0x2316b9['shift']());}};_0x4405a9(++_0x87059b);}(_0x5981,0x127));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x1598('0x0'),{'options':{'raw':![],'attributes':['id',_0x1598('0x1'),_0x1598('0x2'),'acwTimeout','autopause',_0x1598('0x3'),'type',_0x1598('0x4'),_0x1598('0x5'),_0x1598('0x6'),'dialLimitQueue',_0x1598('0x7'),'dialPredictiveOptimization',_0x1598('0x8'),'dialPredictiveInterval',_0x1598('0x9'),'dialOriginateCallerIdNumber',_0x1598('0xa'),_0x1598('0xb'),_0x1598('0xc'),_0x1598('0xd'),_0x1598('0xe'),_0x1598('0xf'),'dialBusyMaxRetry',_0x1598('0x10'),_0x1598('0x11'),_0x1598('0x12'),'dialGlobalMaxRetry',_0x1598('0x13'),_0x1598('0x14'),_0x1598('0x15'),_0x1598('0x16'),'dialAMDActive',_0x1598('0x17'),_0x1598('0x18'),_0x1598('0x19'),_0x1598('0x1a'),_0x1598('0x1b'),_0x1598('0x1c'),'dialAMDMaximumNumberOfWords',_0x1598('0x1d'),_0x1598('0x1e'),_0x1598('0x1f'),_0x1598('0x20'),_0x1598('0x21'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x1598('0x22'),_0x1598('0x23'),'monitor_format','strategy',_0x1598('0x24'),_0x1598('0x25'),_0x1598('0x26'),_0x1598('0x27'),_0x1598('0x28'),_0x1598('0x29'),_0x1598('0x2a'),_0x1598('0x2b'),_0x1598('0x2c'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x1598('0x2d'),_0x1598('0x2e'),_0x1598('0x2f'),'dialPredictiveIntervalMinThreshold',_0x1598('0x30'),_0x1598('0x31')],'include':[{'model':_0x1598('0x32'),'as':_0x1598('0x32'),'attributes':['id',_0x1598('0x1'),'callerid','active']},{'model':_0x1598('0x33'),'as':_0x1598('0x34'),'attributes':['id',_0x1598('0x1')]},{'model':_0x1598('0x32'),'as':'TrunkBackup','attributes':['id','name',_0x1598('0x35'),_0x1598('0x36')]},{'model':_0x1598('0x37'),'as':_0x1598('0x37'),'attributes':['id',_0x1598('0x1')],'include':[{'model':'Interval','as':_0x1598('0x38'),'attributes':['id',_0x1598('0x1'),_0x1598('0x39')]}]}]},'log':_0x1598('0x3a')});};}; \ No newline at end of file +var _0xb81d=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x5543ca,_0x55f97b){var _0x92882a=function(_0x407cf2){while(--_0x407cf2){_0x5543ca['push'](_0x5543ca['shift']());}};_0x92882a(++_0x55f97b);}(_0xb81d,0xb4));var _0xdb81=function(_0x635fea,_0x427e3b){_0x635fea=_0x635fea-0x0;var _0x2fb3ed=_0xb81d[_0x635fea];return _0x2fb3ed;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0xdb81('0x0')](_0xdb81('0x1'),{'options':{'raw':![],'attributes':['id',_0xdb81('0x2'),'acw',_0xdb81('0x3'),_0xdb81('0x4'),_0xdb81('0x5'),_0xdb81('0x6'),_0xdb81('0x7'),_0xdb81('0x8'),_0xdb81('0x9'),'dialLimitQueue',_0xdb81('0xa'),_0xdb81('0xb'),_0xdb81('0xc'),_0xdb81('0xd'),_0xdb81('0xe'),_0xdb81('0xf'),_0xdb81('0x10'),_0xdb81('0x11'),'dialQueueTimeout',_0xdb81('0x12'),_0xdb81('0x13'),_0xdb81('0x14'),_0xdb81('0x15'),'dialBusyRetryFrequency',_0xdb81('0x16'),_0xdb81('0x17'),'dialGlobalMaxRetry','dialTimezone',_0xdb81('0x18'),_0xdb81('0x19'),'dialCheckDuplicateType',_0xdb81('0x1a'),_0xdb81('0x1b'),_0xdb81('0x1c'),_0xdb81('0x1d'),_0xdb81('0x1e'),_0xdb81('0x1f'),_0xdb81('0x20'),_0xdb81('0x21'),_0xdb81('0x22'),_0xdb81('0x23'),_0xdb81('0x24'),_0xdb81('0x25'),_0xdb81('0x26'),_0xdb81('0x27'),_0xdb81('0x28'),_0xdb81('0x29'),_0xdb81('0x2a'),'monitor_format','strategy',_0xdb81('0x2b'),_0xdb81('0x2c'),_0xdb81('0x2d'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xdb81('0x2e'),_0xdb81('0x2f'),_0xdb81('0x30'),'dialMachineMaxRetry',_0xdb81('0x31'),_0xdb81('0x32'),_0xdb81('0x33'),_0xdb81('0x34'),_0xdb81('0x35'),_0xdb81('0x36'),_0xdb81('0x37'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xdb81('0x38'),'attributes':['id',_0xdb81('0x2'),_0xdb81('0x39'),_0xdb81('0x3a')]},{'model':_0xdb81('0x3b'),'as':_0xdb81('0x3c'),'attributes':['id','name']},{'model':_0xdb81('0x38'),'as':_0xdb81('0x3d'),'attributes':['id',_0xdb81('0x2'),_0xdb81('0x39'),_0xdb81('0x3a')]},{'model':_0xdb81('0x3e'),'as':'Interval','attributes':['id',_0xdb81('0x2')],'include':[{'model':_0xdb81('0x3e'),'as':_0xdb81('0x3f'),'attributes':['id',_0xdb81('0x2'),_0xdb81('0x40')]}]}]},'log':_0xdb81('0x41')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index a4f3410..5d5ff42 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(_0xb2cdc8,_0x54467e){var _0x4d954b=function(_0x1b5ced){while(--_0x1b5ced){_0xb2cdc8['push'](_0xb2cdc8['shift']());}};_0x4d954b(++_0x54467e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x552edb,_0x18c3a3){var _0xddfab=function(_0x5f59db){while(--_0x5f59db){_0x552edb['push'](_0x552edb['shift']());}};_0xddfab(++_0x18c3a3);}(_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 e2f5683..3a79126 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 _0x0e27=['GetVoiceQueueRtPauses','Request'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x0e27,0x1df));var _0x70e2=function(_0x48baa3,_0x3cebbf){_0x48baa3=_0x48baa3-0x0;var _0x394bba=_0x0e27[_0x48baa3];return _0x394bba;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x49e38e){return function(){return client[_0x70e2('0x0')](_0x70e2('0x1'),{'options':{'where':{'VoiceQueueId':_0x49e38e,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xa180=['Request','getVoiceQueueRtPauses'];(function(_0x50c436,_0x399ecd){var _0x4aff9d=function(_0x35f0d2){while(--_0x35f0d2){_0x50c436['push'](_0x50c436['shift']());}};_0x4aff9d(++_0x399ecd);}(_0xa180,0x1c5));var _0x0a18=function(_0x263796,_0x332637){_0x263796=_0x263796-0x0;var _0x10be1f=_0xa180[_0x263796];return _0x10be1f;};'use strict';var client=require('../client');exports[_0x0a18('0x0')]=function(_0x216349){return function(){return client[_0x0a18('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x216349,'paused':!![]},'raw':!![]},'log':_0x0a18('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e584f57..90274a1 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(_0x1bbefc,_0x35cc58){var _0x2ae080=function(_0xdbcd83){while(--_0xdbcd83){_0x1bbefc['push'](_0x1bbefc['shift']());}};_0x2ae080(++_0x35cc58);}(_0x7a54,0x106));var _0x47a5=function(_0x5ea3d7,_0x2d9917){_0x5ea3d7=_0x5ea3d7-0x0;var _0x45887a=_0x7a54[_0x5ea3d7];return _0x45887a;};'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(_0x749cf3,_0x101619){var _0x181719=function(_0x240152){while(--_0x240152){_0x749cf3['push'](_0x749cf3['shift']());}};_0x181719(++_0x101619);}(_0x7a54,0x106));var _0x47a5=function(_0x445df3,_0x4bf6e6){_0x445df3=_0x445df3-0x0;var _0xddf554=_0x7a54[_0x445df3];return _0xddf554;};'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 0ecc06b..e74241d 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 _0x8460=['transfers','blindTransfer','Request','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','result','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','attended','../client'];(function(_0x3cb2d9,_0x4bdb75){var _0x5278bf=function(_0x2559da){while(--_0x2559da){_0x3cb2d9['push'](_0x3cb2d9['shift']());}};_0x5278bf(++_0x4bdb75);}(_0x8460,0x68));var _0x0846=function(_0xa587a,_0xc7ebc7){_0xa587a=_0xa587a-0x0;var _0x2af6f3=_0x8460[_0xa587a];return _0x2af6f3;};'use strict';var client=require(_0x0846('0x0'));exports[_0x0846('0x1')]={};exports[_0x0846('0x2')]=function(_0x2c4750){return client[_0x0846('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x2c4750['result'],'transfererchannel':_0x2c4750[_0x0846('0x4')],'transferercalleridnum':_0x2c4750[_0x0846('0x5')],'transferercalleridname':_0x2c4750['transferercalleridname'],'transfererconnectedlinenum':_0x2c4750[_0x0846('0x6')],'transfererconnectedlinename':_0x2c4750['transfererconnectedlinename'],'transfereraccountcode':_0x2c4750[_0x0846('0x7')],'transferercontext':_0x2c4750[_0x0846('0x8')],'transfererexten':_0x2c4750[_0x0846('0x9')],'transfererlinkedid':_0x2c4750['transfererlinkedid'],'transfereechannel':_0x2c4750[_0x0846('0xa')],'transfereecalleridnum':_0x2c4750[_0x0846('0xb')],'transfereecalleridname':_0x2c4750[_0x0846('0xc')],'transfereeconnectedlinenum':_0x2c4750[_0x0846('0xd')],'transfereeconnectedlinename':_0x2c4750[_0x0846('0xe')],'transfereeaccountcode':_0x2c4750['transfereeaccountcode'],'transfereecontext':_0x2c4750['transfereecontext'],'transfereeexten':_0x2c4750[_0x0846('0xf')],'transfereelinkedid':_0x2c4750['transfereelinkedid'],'isexternal':_0x2c4750[_0x0846('0x10')],'context':_0x2c4750[_0x0846('0x11')],'extension':_0x2c4750[_0x0846('0x12')],'type':_0x0846('0x13')},'log':_0x0846('0x14')});};exports['attendedTransfer']=function(_0x1487d0){return client[_0x0846('0x3')](_0x0846('0x14'),{'body':{'result':_0x1487d0[_0x0846('0x15')],'transfererchannel':_0x1487d0['origtransfererchannel'],'transferercalleridnum':_0x1487d0[_0x0846('0x16')],'transferercalleridname':_0x1487d0['origtransferercalleridname'],'transfererconnectedlinenum':_0x1487d0[_0x0846('0x17')],'transfererconnectedlinename':_0x1487d0['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1487d0[_0x0846('0x18')],'transferercontext':_0x1487d0[_0x0846('0x19')],'transfererexten':_0x1487d0[_0x0846('0x1a')],'transfererlinkedid':_0x1487d0['origtransfererlinkedid'],'transfereechannel':_0x1487d0[_0x0846('0x1b')],'transfereecalleridnum':_0x1487d0[_0x0846('0x1c')],'transfereecalleridname':_0x1487d0[_0x0846('0x1d')],'transfereeconnectedlinenum':_0x1487d0['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1487d0[_0x0846('0x1e')],'transfereeaccountcode':_0x1487d0[_0x0846('0x1f')],'transfereecontext':_0x1487d0['transfertargetcontext'],'transfereeexten':_0x1487d0[_0x0846('0x20')],'transfereelinkedid':_0x1487d0[_0x0846('0x21')],'isexternal':_0x1487d0[_0x0846('0x10')],'context':_0x1487d0['origtransferercontext'],'extension':_0x1487d0['origtransfererexten'],'type':_0x0846('0x22')},'log':_0x0846('0x14')});}; \ No newline at end of file +var _0x58a7=['origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','../client','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','Request','result'];(function(_0x127418,_0x480a1b){var _0x5d2ca7=function(_0x566f2f){while(--_0x566f2f){_0x127418['push'](_0x127418['shift']());}};_0x5d2ca7(++_0x480a1b);}(_0x58a7,0x157));var _0x758a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x58a7[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x758a('0x0'));exports[_0x758a('0x1')]={};exports[_0x758a('0x2')]=function(_0x4318df){return client['Request'](_0x758a('0x3'),{'body':{'result':_0x4318df['result'],'transfererchannel':_0x4318df[_0x758a('0x4')],'transferercalleridnum':_0x4318df[_0x758a('0x5')],'transferercalleridname':_0x4318df[_0x758a('0x6')],'transfererconnectedlinenum':_0x4318df[_0x758a('0x7')],'transfererconnectedlinename':_0x4318df[_0x758a('0x8')],'transfereraccountcode':_0x4318df[_0x758a('0x9')],'transferercontext':_0x4318df['transferercontext'],'transfererexten':_0x4318df[_0x758a('0xa')],'transfererlinkedid':_0x4318df[_0x758a('0xb')],'transfereechannel':_0x4318df['transfereechannel'],'transfereecalleridnum':_0x4318df[_0x758a('0xc')],'transfereecalleridname':_0x4318df[_0x758a('0xd')],'transfereeconnectedlinenum':_0x4318df[_0x758a('0xe')],'transfereeconnectedlinename':_0x4318df[_0x758a('0xf')],'transfereeaccountcode':_0x4318df[_0x758a('0x10')],'transfereecontext':_0x4318df[_0x758a('0x11')],'transfereeexten':_0x4318df[_0x758a('0x12')],'transfereelinkedid':_0x4318df[_0x758a('0x13')],'isexternal':_0x4318df['isexternal'],'context':_0x4318df[_0x758a('0x14')],'extension':_0x4318df[_0x758a('0x15')],'type':_0x758a('0x16')},'log':_0x758a('0x3')});};exports[_0x758a('0x17')]=function(_0x5f19ac){return client[_0x758a('0x18')](_0x758a('0x3'),{'body':{'result':_0x5f19ac[_0x758a('0x19')],'transfererchannel':_0x5f19ac[_0x758a('0x1a')],'transferercalleridnum':_0x5f19ac['origtransferercalleridnum'],'transferercalleridname':_0x5f19ac[_0x758a('0x1b')],'transfererconnectedlinenum':_0x5f19ac[_0x758a('0x1c')],'transfererconnectedlinename':_0x5f19ac[_0x758a('0x1d')],'transfereraccountcode':_0x5f19ac['origtransfereraccountcode'],'transferercontext':_0x5f19ac[_0x758a('0x1e')],'transfererexten':_0x5f19ac[_0x758a('0x1f')],'transfererlinkedid':_0x5f19ac[_0x758a('0x20')],'transfereechannel':_0x5f19ac[_0x758a('0x21')],'transfereecalleridnum':_0x5f19ac['transfertargetcalleridnum'],'transfereecalleridname':_0x5f19ac['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5f19ac[_0x758a('0x22')],'transfereeconnectedlinename':_0x5f19ac[_0x758a('0x23')],'transfereeaccountcode':_0x5f19ac[_0x758a('0x24')],'transfereecontext':_0x5f19ac[_0x758a('0x25')],'transfereeexten':_0x5f19ac[_0x758a('0x26')],'transfereelinkedid':_0x5f19ac[_0x758a('0x27')],'isexternal':_0x5f19ac[_0x758a('0x28')],'context':_0x5f19ac['origtransferercontext'],'extension':_0x5f19ac['origtransfererexten'],'type':'attended'},'log':_0x758a('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index f9b378d..72c9b0a 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x4d5346,_0x50519a){var _0x518145=function(_0x414584){while(--_0x414584){_0x4d5346['push'](_0x4d5346['shift']());}};_0x518145(++_0x50519a);}(_0xb10b,0x12a));var _0xbb10=function(_0x12309b,_0x59dd8c){_0x12309b=_0x12309b-0x0;var _0x482e4d=_0xb10b[_0x12309b];return _0x482e4d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x1f4204,_0x255e6d){var _0x49b4f9=function(_0x7a1188){while(--_0x7a1188){_0x1f4204['push'](_0x1f4204['shift']());}};_0x49b4f9(++_0x255e6d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f1f3b,_0x227aa9){_0x1f1f3b=_0x1f1f3b-0x0;var _0x2e63aa=_0xb10b[_0x1f1f3b];return _0x2e63aa;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+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 9fcb98c..6bec2fa 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 _0xbfa3=['then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','length','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','destcalleridnum','routeId','lastName','mobile','fax','scheduledAt','updatedAt'];(function(_0x2ee7d2,_0xb4acf5){var _0x560ea2=function(_0x446923){while(--_0x446923){_0x2ee7d2['push'](_0x2ee7d2['shift']());}};_0x560ea2(++_0xb4acf5);}(_0xbfa3,0x1f4));var _0x3bfa=function(_0x5e86a0,_0x279e01){_0x5e86a0=_0x5e86a0-0x0;var _0x19055e=_0xbfa3[_0x5e86a0];return _0x19055e;};'use strict';var _=require('lodash');var BPromise=require(_0x3bfa('0x0'));var Redis=require('ioredis');var util=require(_0x3bfa('0x1'));var config=require(_0x3bfa('0x2'));var logger=require(_0x3bfa('0x3'))(_0x3bfa('0x4'));var cmContactRpc=require(_0x3bfa('0x5'));config[_0x3bfa('0x6')]=_['defaults'](config[_0x3bfa('0x6')],{'host':_0x3bfa('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3bfa('0x6')]));function emit(_0x302414,_0x24d489,_0x3eed7f,_0x345e0d,_0x74154b){logger[_0x3bfa('0x8')](_0x3bfa('0x9'),_0x302414,_0x24d489['id'],_0x3eed7f,_0x345e0d,JSON[_0x3bfa('0xa')](_0x74154b));io['to'](_0x3eed7f)[_0x3bfa('0xb')](_0x345e0d,_0x74154b);}exports[_0x3bfa('0xc')]=function(_0x93ed94,_0x58af97,_0xbc9db5,_0x32f681){var _0x24f12e,_0x1d1cd7;var _0x352199={};var _0x487f3d;var _0x2756d2=Number(_0xbc9db5[_0x3bfa('0xd')]);var _0x50ed33=_0xbc9db5[_0x3bfa('0xe')]?Boolean(Number(_0xbc9db5['data2'])):![];var _0x124bec;var _0xe008a6=![];if(!_[_0x3bfa('0xf')](_0xbc9db5[_0x3bfa('0x10')])){if(_0xbc9db5[_0x3bfa('0x10')]=='1')_0xe008a6=!![];}if(!_0xe008a6){if(_0x32f681[_0x3bfa('0x11')]){_0x352199['id']=_0x32f681[_0x3bfa('0x11')];}}if(!_0x352199['id']){_0x352199[_0x3bfa('0x12')]=_0x2756d2;_0x124bec=_0xbc9db5[_0x3bfa('0x13')]&&_0xbc9db5['data3']!=='0'?_0xbc9db5[_0x3bfa('0x13')]['split'](','):[_0x3bfa('0x14')];_0x352199[_0x3bfa('0x15')]=_[_0x3bfa('0x16')](_0x124bec,function(_0x7bbade){var _0x1797f4={};_0x1797f4[_0x7bbade]=_0x32f681['routeId']?_0x32f681[_0x3bfa('0x17')]:_0x32f681['calleridnum'];return _0x1797f4;});_0x487f3d=_0x32f681[_0x3bfa('0x18')]?_0x32f681[_0x3bfa('0x17')]:_0x32f681['calleridnum'];}var _0x4f0e4f=['id','firstName',_0x3bfa('0x19'),_0x3bfa('0x14'),_0x3bfa('0x1a'),_0x3bfa('0x1b'),'ListId','createdAt',_0x3bfa('0x1c'),_0x3bfa('0x1d')];var _0x2634c7=_['union'](_0x4f0e4f,_0x124bec);BPromise['resolve']()['then'](cmContactRpc['getContacts']({'attributes':_0x2634c7,'where':_0x352199,'phone':_0x487f3d}))[_0x3bfa('0x1e')](function(_0x218b64){_0x1d1cd7=_0x218b64;if(!_[_0x3bfa('0x1f')](_0x1d1cd7)){if(_0x1d1cd7['length']===0x1){_0x24f12e=_0x1d1cd7[0x0];logger[_0x3bfa('0x8')](_0x3bfa('0x20'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id'],_0x24f12e['id']);}else{logger[_0x3bfa('0x8')](_0x3bfa('0x22'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id'],_['map'](_0x1d1cd7,'id')[_0x3bfa('0x23')](','));}return;}else{logger[_0x3bfa('0x8')](_0x3bfa('0x24'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id']);var _0x45eb41={'ListId':_0x2756d2};var _0x423d00=_0xbc9db5[_0x3bfa('0x25')]&&_0xbc9db5[_0x3bfa('0x25')]!=='0'?_0xbc9db5[_0x3bfa('0x25')]:_0x3bfa('0x14');if(_0x50ed33){logger[_0x3bfa('0x8')](_0x3bfa('0x26'),_0x32f681['uniqueid'],_0x58af97['id']);_0x45eb41[_0x423d00]=_[_0x3bfa('0xf')](_0x32f681[_0x3bfa('0x18')])?_0x32f681[_0x3bfa('0x27')]:_0x32f681[_0x3bfa('0x17')];if(_[_0x3bfa('0xf')](_0x32f681[_0x3bfa('0x18')])){_0x45eb41[_0x3bfa('0x28')]=_0x32f681[_0x3bfa('0x29')]&&_0x32f681['calleridname']!==_0x3bfa('0x2a')?_0x32f681[_0x3bfa('0x29')]:_0x3bfa('0x2b');}else{_0x45eb41[_0x3bfa('0x28')]=_0x32f681['destcalleridname']&&_0x32f681[_0x3bfa('0x2c')]!==_0x3bfa('0x2a')?_0x32f681['destcalleridname']:'Unknown';}return BPromise['resolve']()[_0x3bfa('0x1e')](cmContactRpc[_0x3bfa('0x2d')](_0x45eb41))[_0x3bfa('0x1e')](function(_0x252a43){_0x24f12e=_0x252a43;_0x1d1cd7[_0x3bfa('0x2e')](_0x252a43);if(_0x24f12e){logger[_0x3bfa('0x8')](_0x3bfa('0x2f'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id'],_0x24f12e['id']);}return;});}else{logger[_0x3bfa('0x8')](_0x3bfa('0x30'),_0x32f681[_0x3bfa('0x21')],_0x58af97['id']);_0x45eb41[_0x423d00]=_['isNil'](_0x32f681[_0x3bfa('0x18')])?_0x32f681[_0x3bfa('0x27')]:_0x32f681[_0x3bfa('0x17')];if(_[_0x3bfa('0xf')](_0x32f681[_0x3bfa('0x18')])){_0x45eb41[_0x3bfa('0x28')]=_0x32f681[_0x3bfa('0x29')]&&_0x32f681[_0x3bfa('0x29')]!==_0x3bfa('0x2a')?_0x32f681[_0x3bfa('0x29')]:_0x3bfa('0x2b');}else{_0x45eb41['firstName']=_0x32f681['destcalleridname']&&_0x32f681[_0x3bfa('0x2c')]!==''?_0x32f681[_0x3bfa('0x2c')]:_0x3bfa('0x2b');}_0x24f12e=_0x45eb41;_0x1d1cd7[_0x3bfa('0x2e')](_0x45eb41);return;}}})[_0x3bfa('0x1e')](function(){if(_0x93ed94){emit(_0x32f681['uniqueid'],_0x58af97,util[_0x3bfa('0x31')](_0x3bfa('0x32'),_0x93ed94['name']),util['format'](_0x3bfa('0x33'),_0xbc9db5['action']['toLowerCase']()),{'evt':_['merge'](_0x32f681,{'autoCreate':_0x50ed33}),'contact':_0x24f12e===undefined?{}:_0x24f12e,'contacts':_0x1d1cd7[_0x3bfa('0x34')]===0x0?undefined:_0x1d1cd7});}});}; \ No newline at end of file +var _0x6a47=['data4','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x2474ac,_0x335d3a){var _0x384a8f=function(_0x402bf6){while(--_0x402bf6){_0x2474ac['push'](_0x2474ac['shift']());}};_0x384a8f(++_0x335d3a);}(_0x6a47,0x84));var _0x76a4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6a47[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x76a4('0x0'));var BPromise=require(_0x76a4('0x1'));var Redis=require(_0x76a4('0x2'));var util=require(_0x76a4('0x3'));var config=require(_0x76a4('0x4'));var logger=require(_0x76a4('0x5'))(_0x76a4('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x76a4('0x7')]=_[_0x76a4('0x8')](config[_0x76a4('0x7')],{'host':_0x76a4('0x9'),'port':0x18eb});var io=require(_0x76a4('0xa'))(new Redis(config[_0x76a4('0x7')]));function emit(_0x481862,_0x1b5cf6,_0x46c86b,_0x5a7cda,_0x3ced93){logger['info'](_0x76a4('0xb'),_0x481862,_0x1b5cf6['id'],_0x46c86b,_0x5a7cda,JSON[_0x76a4('0xc')](_0x3ced93));io['to'](_0x46c86b)[_0x76a4('0xd')](_0x5a7cda,_0x3ced93);}exports[_0x76a4('0xe')]=function(_0x24bba2,_0x4e4e63,_0x9290cb,_0x18d994){var _0x2e5966,_0x194c94;var _0x43d71c={};var _0x27a15b;var _0x29cc9c=Number(_0x9290cb[_0x76a4('0xf')]);var _0x138010=_0x9290cb['data2']?Boolean(Number(_0x9290cb[_0x76a4('0x10')])):![];var _0x118a53;var _0x1260d0=![];if(!_[_0x76a4('0x11')](_0x9290cb['data5'])){if(_0x9290cb[_0x76a4('0x12')]=='1')_0x1260d0=!![];}if(!_0x1260d0){if(_0x18d994[_0x76a4('0x13')]){_0x43d71c['id']=_0x18d994[_0x76a4('0x13')];}}if(!_0x43d71c['id']){_0x43d71c[_0x76a4('0x14')]=_0x29cc9c;_0x118a53=_0x9290cb[_0x76a4('0x15')]&&_0x9290cb[_0x76a4('0x15')]!=='0'?_0x9290cb[_0x76a4('0x15')][_0x76a4('0x16')](','):[_0x76a4('0x17')];_0x43d71c[_0x76a4('0x18')]=_[_0x76a4('0x19')](_0x118a53,function(_0x1cfc51){var _0x3d43ca={};_0x3d43ca[_0x1cfc51]=_0x18d994[_0x76a4('0x1a')]?_0x18d994[_0x76a4('0x1b')]:_0x18d994['calleridnum'];return _0x3d43ca;});_0x27a15b=_0x18d994[_0x76a4('0x1a')]?_0x18d994[_0x76a4('0x1b')]:_0x18d994[_0x76a4('0x1c')];}var _0x17e734=['id',_0x76a4('0x1d'),'lastName','phone','mobile',_0x76a4('0x1e'),_0x76a4('0x14'),_0x76a4('0x1f'),_0x76a4('0x20'),_0x76a4('0x21')];var _0x15eeb6=_['union'](_0x17e734,_0x118a53);BPromise[_0x76a4('0x22')]()[_0x76a4('0x23')](cmContactRpc[_0x76a4('0x24')]({'attributes':_0x15eeb6,'where':_0x43d71c,'phone':_0x27a15b}))[_0x76a4('0x23')](function(_0x4df760){_0x194c94=_0x4df760;if(!_[_0x76a4('0x25')](_0x194c94)){if(_0x194c94[_0x76a4('0x26')]===0x1){_0x2e5966=_0x194c94[0x0];logger['info'](_0x76a4('0x27'),_0x18d994[_0x76a4('0x28')],_0x4e4e63['id'],_0x2e5966['id']);}else{logger[_0x76a4('0x29')](_0x76a4('0x2a'),_0x18d994[_0x76a4('0x28')],_0x4e4e63['id'],_[_0x76a4('0x19')](_0x194c94,'id')[_0x76a4('0x2b')](','));}return;}else{logger['info'](_0x76a4('0x2c'),_0x18d994[_0x76a4('0x28')],_0x4e4e63['id']);var _0x145f2c={'ListId':_0x29cc9c};var _0x114fbe=_0x9290cb[_0x76a4('0x2d')]&&_0x9290cb[_0x76a4('0x2d')]!=='0'?_0x9290cb[_0x76a4('0x2d')]:_0x76a4('0x17');if(_0x138010){logger[_0x76a4('0x29')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x18d994['uniqueid'],_0x4e4e63['id']);_0x145f2c[_0x114fbe]=_[_0x76a4('0x11')](_0x18d994[_0x76a4('0x1a')])?_0x18d994[_0x76a4('0x1c')]:_0x18d994[_0x76a4('0x1b')];if(_[_0x76a4('0x11')](_0x18d994[_0x76a4('0x1a')])){_0x145f2c[_0x76a4('0x1d')]=_0x18d994['calleridname']&&_0x18d994[_0x76a4('0x2e')]!==_0x76a4('0x2f')?_0x18d994[_0x76a4('0x2e')]:_0x76a4('0x30');}else{_0x145f2c[_0x76a4('0x1d')]=_0x18d994[_0x76a4('0x31')]&&_0x18d994[_0x76a4('0x31')]!==_0x76a4('0x2f')?_0x18d994['destcalleridname']:_0x76a4('0x30');}return BPromise[_0x76a4('0x22')]()[_0x76a4('0x23')](cmContactRpc[_0x76a4('0x32')](_0x145f2c))['then'](function(_0x4763d3){_0x2e5966=_0x4763d3;_0x194c94['push'](_0x4763d3);if(_0x2e5966){logger[_0x76a4('0x29')](_0x76a4('0x33'),_0x18d994['uniqueid'],_0x4e4e63['id'],_0x2e5966['id']);}return;});}else{logger['info'](_0x76a4('0x34'),_0x18d994[_0x76a4('0x28')],_0x4e4e63['id']);_0x145f2c[_0x114fbe]=_[_0x76a4('0x11')](_0x18d994['routeId'])?_0x18d994[_0x76a4('0x1c')]:_0x18d994[_0x76a4('0x1b')];if(_['isNil'](_0x18d994[_0x76a4('0x1a')])){_0x145f2c[_0x76a4('0x1d')]=_0x18d994[_0x76a4('0x2e')]&&_0x18d994[_0x76a4('0x2e')]!==_0x76a4('0x2f')?_0x18d994[_0x76a4('0x2e')]:_0x76a4('0x30');}else{_0x145f2c[_0x76a4('0x1d')]=_0x18d994['destcalleridname']&&_0x18d994[_0x76a4('0x31')]!==_0x76a4('0x2f')?_0x18d994['destcalleridname']:'Unknown';}_0x2e5966=_0x145f2c;_0x194c94[_0x76a4('0x35')](_0x145f2c);return;}}})[_0x76a4('0x23')](function(){if(_0x24bba2){emit(_0x18d994['uniqueid'],_0x4e4e63,util[_0x76a4('0x36')](_0x76a4('0x37'),_0x24bba2[_0x76a4('0x38')]),util[_0x76a4('0x36')]('trigger:%s',_0x9290cb['action'][_0x76a4('0x39')]()),{'evt':_[_0x76a4('0x3a')](_0x18d994,{'autoCreate':_0x138010}),'contact':_0x2e5966===undefined?{}:_0x2e5966,'contacts':_0x194c94['length']===0x0?undefined:_0x194c94});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7e3c1ce..f922017 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 _0xcbe1=['emit','info','clone','motionChannel','undefined','voice','inspect','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','browser','html','render','uri','buildUri','data2','data3','isNil','location','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','winArguments','format','user:%s','trigger:%s:%s','jscripty','trigger:%s','data1','name','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','field','account','chat','ChatWebsiteId','operator','value','upperFirst','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','equals','util','lodash','url','ioredis','./cmContact','../../../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','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype'];(function(_0x53e19d,_0x604957){var _0x5ba332=function(_0x34f66e){while(--_0x34f66e){_0x53e19d['push'](_0x53e19d['shift']());}};_0x5ba332(++_0x604957);}(_0xcbe1,0xd7));var _0x1cbe=function(_0x127728,_0x11c9c5){_0x127728=_0x127728-0x0;var _0x3b6cfe=_0xcbe1[_0x127728];return _0x3b6cfe;};'use strict';var util=require(_0x1cbe('0x0'));var _=require(_0x1cbe('0x1'));var url=require(_0x1cbe('0x2'));var Mustache=require('mustache');var Redis=require(_0x1cbe('0x3'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0x1cbe('0x4'));var script=require('./script');var config=require(_0x1cbe('0x5'));var logger=require(_0x1cbe('0x6'))(_0x1cbe('0x7'));var ami=require(_0x1cbe('0x8'));config[_0x1cbe('0x9')]=_[_0x1cbe('0xa')](config[_0x1cbe('0x9')],{'host':_0x1cbe('0xb'),'port':0x18eb});var io=require(_0x1cbe('0xc'))(new Redis(config[_0x1cbe('0x9')]));var operators={'equals':function(_0x196b5a,_0x2325bc){return _0x196b5a==_0x2325bc;},'not_equals':function(_0x2cd82b,_0x22268c){return _0x2cd82b!=_0x22268c;}};var barAndWebActions=[_0x1cbe('0xd'),_0x1cbe('0x2'),_0x1cbe('0xe')];function Trigger(_0x1d10e3){this[_0x1cbe('0xf')]=_0x1d10e3[_0x1cbe('0xf')];this[_0x1cbe('0x10')]=_0x1d10e3['agents'];this[_0x1cbe('0x11')]=_0x1d10e3[_0x1cbe('0x11')];this[_0x1cbe('0x12')]=_0x1d10e3[_0x1cbe('0x12')];this[_0x1cbe('0x13')]=_0x1d10e3[_0x1cbe('0x13')];this[_0x1cbe('0x14')]=_0x1d10e3['zendeskAccounts'];this['freshdeskAccounts']=_0x1d10e3[_0x1cbe('0x15')];this[_0x1cbe('0x16')]=_0x1d10e3[_0x1cbe('0x16')];this[_0x1cbe('0x17')]=_0x1d10e3[_0x1cbe('0x17')];this[_0x1cbe('0x18')]=_0x1d10e3[_0x1cbe('0x18')];this[_0x1cbe('0x19')]=_0x1d10e3[_0x1cbe('0x19')];this[_0x1cbe('0x1a')]=_0x1d10e3[_0x1cbe('0x1a')];this[_0x1cbe('0x1b')]=_0x1d10e3[_0x1cbe('0x1b')];this[_0x1cbe('0x1c')]=_0x1d10e3['dynamics365Accounts'];this[_0x1cbe('0x1d')]=_0x1d10e3[_0x1cbe('0x1d')];this[_0x1cbe('0x1e')]={'zendesk':this[_0x1cbe('0x14')],'salesforce':this[_0x1cbe('0x16')],'freshdesk':this[_0x1cbe('0x15')],'sugarcrm':this[_0x1cbe('0x17')],'zoho':this[_0x1cbe('0x18')],'desk':this[_0x1cbe('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x1cbe('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0x1cbe('0x1f'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x22'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on']('custom:agentringnoanswer',this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x23'),this[_0x1cbe('0x20')]['bind'](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent']['bind'](this));ami['on'](_0x1cbe('0x24'),this['syncCustomEvent'][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x25'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x26'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0x1cbe('0x28'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x29'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x2a'),this['syncCustomEvent'][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x2b'),this[_0x1cbe('0x2c')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x2d'),this[_0x1cbe('0x2c')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x2e'),this['syncAgentDial'][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x2f'),this[_0x1cbe('0x20')]['bind'](this));ami['on'](_0x1cbe('0x30'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x31'),this['syncCustomEvent'][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x32'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x33'),this[_0x1cbe('0x20')][_0x1cbe('0x21')](this));ami['on'](_0x1cbe('0x34'),this[_0x1cbe('0x20')]['bind'](this));ami['on'](_0x1cbe('0x35'),this['syncCustomEvent'][_0x1cbe('0x21')](this));}Trigger[_0x1cbe('0x36')][_0x1cbe('0x37')]=function(_0x29dad7,_0x13f6a5,_0x4c2880){logger[_0x1cbe('0x38')](_0x29dad7,_0x13f6a5,JSON['stringify'](_0x4c2880));io['to'](_0x29dad7)[_0x1cbe('0x37')](_0x13f6a5,_0x4c2880);};Trigger[_0x1cbe('0x36')][_0x1cbe('0x20')]=function(_0x46a439){var _0x5bb94c=_[_0x1cbe('0x39')](_0x46a439);if(typeof _0x5bb94c[_0x1cbe('0x3a')]===_0x1cbe('0x3b')){_0x5bb94c[_0x1cbe('0x3a')]=_0x1cbe('0x3c');}logger['debug'](_0x1cbe('0x20'),util[_0x1cbe('0x3d')](_0x5bb94c,{'showHidden':!![],'depth':null}));this[_0x1cbe('0x3e')](_0x5bb94c);};Trigger[_0x1cbe('0x36')][_0x1cbe('0x2c')]=function(_0x4df798){if(this['agents'][_0x4df798['interface']]){this['syncCustomEvent'](_0x4df798);}};Trigger[_0x1cbe('0x36')]['checkTriggers']=function(_0x55b454){var _0x2418ad;for(var _0x2f75a0 in this[_0x1cbe('0xf')]){if(this[_0x1cbe('0xf')][_0x1cbe('0x3f')](_0x2f75a0)){if(this[_0x1cbe('0xf')][_0x2f75a0][_0x1cbe('0x40')]){_0x2418ad=this[_0x1cbe('0x41')](this['triggers'][_0x2f75a0],_0x55b454);if(_0x2418ad){_[_0x1cbe('0x42')](_0x55b454,_0x55b454[_0x1cbe('0x43')]);for(var _0x2a23a9=0x0,_0x5ea8f8,_0x3db552,_0x196a48;_0x2a23a90x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x2b4bf0,_0x22559a){var _0x2c5ed2=function(_0x5ec933){while(--_0x5ec933){_0x2b4bf0['push'](_0x2b4bf0['shift']());}};_0x2c5ed2(++_0x22559a);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index fc4f34f..00b308b 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 _0x03f0=['nameField','idField','indexOf','content','ticketType','incidents','assign','getString','Descriptions','Fields','phonecall','callDirection','queue','phonecalls','/contacts(','lastIndexOf','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','modernAuthentication','CloudProvider','tenantId','data5','clientId','remoteUri','username','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','4.0','body','odata-entityid','substring','enduserId','message','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type'];(function(_0x5e263f,_0x37f92c){var _0x48e40b=function(_0x25b0e6){while(--_0x25b0e6){_0x5e263f['push'](_0x5e263f['shift']());}};_0x48e40b(++_0x37f92c);}(_0x03f0,0x16a));var _0x003f=function(_0x477fa6,_0x5f19b7){_0x477fa6=_0x477fa6-0x0;var _0x177936=_0x03f0[_0x477fa6];return _0x177936;};'use strict';var _=require(_0x003f('0x0'));var rp=require(_0x003f('0x1'));var util=require(_0x003f('0x2'));var intUtil=require('./util');var md5=require(_0x003f('0x3'));var Redis=require(_0x003f('0x4'));var logger=require('../../../../config/logger')(_0x003f('0x5'));var config=require(_0x003f('0x6'));config[_0x003f('0x7')]=_[_0x003f('0x8')](config[_0x003f('0x7')],{'host':_0x003f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x003f('0x7')]));function getAuthToken(_0x356452,_0x93e81b,_0x100565){if(_0x356452[_0x003f('0xa')]){_0x356452['remoteUri']=_0x356452[_0x003f('0xb')]['data7'];_0x356452[_0x003f('0xc')]=_0x356452[_0x003f('0xb')]['data2'];return Promise['resolve'](_0x356452[_0x003f('0xb')][_0x003f('0xd')]);}var _0x5a5eef={'method':'POST','uri':_0x93e81b,'form':{'client_id':_0x356452[_0x003f('0xe')],'resource':_0x356452[_0x003f('0xf')],'username':_0x356452[_0x003f('0x10')],'password':_0x356452['password'],'grant_type':'password','client_secret':_0x356452[_0x003f('0x11')]},'json':!![]};return rp(_0x5a5eef)[_0x003f('0x12')](function(_0x5468cd){return _0x5468cd[_0x003f('0x13')];})[_0x003f('0x14')](function(_0x3ee1cb){logger[_0x003f('0x15')]('['+[_0x100565[_0x003f('0x16')]()]+_0x003f('0x17'));return _0x3ee1cb['message'];});}function getUser(_0x31df6b,_0x1f2db1,_0x570df8,_0x4e4f55,_0x3c7abd,_0x5f58e9){return new Promise(function(_0x15ea17,_0x4153b2){return getAuthToken(_0x1f2db1,_0x4e4f55,_0x5f58e9)[_0x003f('0x12')](function(_0x3f1488){var _0x2d31c9={'method':_0x003f('0x18'),'uri':_0x3c7abd+_0x003f('0x19'),'headers':{'Authorization':_0x003f('0x1a')+_0x3f1488,'OData-Version':'4.0'},'json':!![]};return rp(_0x2d31c9);})[_0x003f('0x12')](function(_0x43f7ab){var _0x1a58e3=_0x43f7ab['value'];var _0x58e54a=![];var _0x571056=null;if(!_[_0x003f('0x1b')](_0x570df8)){if(intUtil[_0x003f('0x1c')](_0x570df8['email'])){_0x31df6b[_0x003f('0x1d')]=_0x570df8[_0x003f('0x1e')];for(_0x571056=0x0;_0x571056<_0x1a58e3[_0x003f('0x1f')];_0x571056++){if(_0x1a58e3[_0x571056][_0x003f('0x20')]===_0x570df8['email']&&!_0x1a58e3[_0x571056][_0x003f('0x21')]){_0x58e54a=!![];logger['info']('['+[_0x5f58e9[_0x003f('0x16')]()]+_0x003f('0x22')+_0x1a58e3[_0x571056][_0x003f('0x23')]+'!');_0x31df6b[_0x003f('0x24')]=_0x1a58e3[_0x571056][_0x003f('0x23')];}}}}if(!_0x58e54a){logger[_0x003f('0x25')]('['+[_0x5f58e9[_0x003f('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x31df6b[_0x003f('0x1d')]=_0x1f2db1[_0x003f('0x10')];for(_0x571056=0x0;_0x571056<_0x1a58e3[_0x003f('0x1f')];_0x571056++){if(_0x1a58e3[_0x571056][_0x003f('0x20')]===_0x1f2db1[_0x003f('0x10')]){_0x31df6b[_0x003f('0x24')]=_0x1a58e3[_0x571056]['systemuserid'];}}}_0x15ea17(_0x31df6b);})[_0x003f('0x14')](function(_0x3e226c){_0x4153b2(_0x3e226c['message']);});});}function createEndUser(_0x5c7e89,_0x3c76cf,_0x2c0fd5,_0x2015bb,_0x44b546,_0x167673,_0x3569a3){return new Promise(function(_0x1954d8,_0x376516){return getAuthToken(_0x3c76cf,_0x2c0fd5,_0x167673)[_0x003f('0x12')](function(_0x3213ca){var _0x48fbd4=_0x167673[_0x003f('0x26')]()===_0x003f('0x27')?_0x44b546['destcalleridnum']:_0x44b546[_0x003f('0x28')];var _0x5d958f={'method':_0x003f('0x29'),'uri':_0x2015bb+_0x003f('0x2a'),'body':{'fullname':_0x48fbd4,'firstname':_0x48fbd4,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x003f('0x2b')+_0x5c7e89[_0x003f('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x3213ca,'OData-Version':_0x003f('0x2c')},'json':!![],'resolveWithFullResponse':!![]};_0x5d958f[_0x003f('0x2d')][_0x3569a3]=_0x48fbd4;return rp(_0x5d958f);})[_0x003f('0x12')](function(_0x17b21c){var _0x3f1fd1=_0x17b21c['headers'][_0x003f('0x2e')];var _0x5a4b0e=_0x3f1fd1[_0x003f('0x2f')](_0x3f1fd1['lastIndexOf']('(')+0x1,_0x3f1fd1['lastIndexOf'](')'));_0x5c7e89[_0x003f('0x30')]=_0x5a4b0e;_0x1954d8(_0x5c7e89);})[_0x003f('0x14')](function(_0x1570e7){_0x376516(_0x1570e7[_0x003f('0x31')]);});});}function getEndUser(_0x3d4982,_0x302d74,_0x5272de,_0x73d97a,_0x3c510d,_0x2660f3,_0x1f1adf,_0x27e5e9){var _0xe0af84=_0x2660f3['toLowerCase']()===_0x003f('0x27')?_0x3c510d['destcalleridnum']:_0x3c510d[_0x003f('0x28')];return getAuthToken(_0x302d74,_0x5272de,_0x2660f3)[_0x003f('0x12')](function(_0x50fc68){_0x27e5e9=_0x27e5e9?_0x27e5e9:'telephone1';var _0x3c8590={'method':_0x003f('0x18'),'uri':_0x73d97a+_0x003f('0x32')+_0x27e5e9+_0x003f('0x33')+_0x27e5e9+_0x003f('0x34')+_0xe0af84[_0x003f('0x35')]('+','%2b')+'\x27','headers':{'Authorization':_0x003f('0x1a')+_0x50fc68,'If-None-Match':null,'OData-Version':_0x003f('0x2c')},'json':!![]};return rp(_0x3c8590);})[_0x003f('0x12')](function(_0x4e20c2){var _0x294830=![];if(!_0x4e20c2)return _0x294830;var _0x3f6819=_0x4e20c2[_0x003f('0x36')];for(var _0x42cac1=0x0;_0x42cac1<_0x3f6819[_0x003f('0x1f')];_0x42cac1++){if(_0x3f6819[_0x42cac1][_0x27e5e9]===_0xe0af84){_0x294830=!![];_0x3d4982['enduserId']=_0x3f6819[_0x42cac1]['contactid'];}}return _0x294830;})['then'](function(_0xb654e6){if(_0xb654e6)return _0x3d4982;if(_0x1f1adf===_0x003f('0x37')){logger[_0x003f('0x25')]('['+[_0x2660f3[_0x003f('0x16')]()]+_0x003f('0x38'));return _0x3d4982;}return createEndUser(_0x3d4982,_0x302d74,_0x5272de,_0x73d97a,_0x3c510d,_0x2660f3,_0x27e5e9)[_0x003f('0x12')](function(_0x5d5ac2){logger['info']('['+[_0x2660f3[_0x003f('0x16')]()]+_0x003f('0x39'),_0x5d5ac2[_0x003f('0x30')]);return _0x5d5ac2;});});}function getCustomFields(_0x12f7f1,_0x414fb0,_0x21c9f1){var _0x27425f={};if(_0x12f7f1[_0x003f('0x1f')]>0x0){_[_0x003f('0x3a')](_0x12f7f1,function(_0x29ae68){if(_[_0x003f('0x3b')]([_0x003f('0x3c'),'picklist'],_0x29ae68[_0x003f('0x3d')])&&_0x29ae68[_0x003f('0x3e')]&&!_0x29ae68['customField']){var _0x53291a=_0x29ae68[_0x003f('0x3f')][_0x003f('0x26')]();var _0x18ede6=_0x53291a[_0x003f('0x2f')](0x0,_0x53291a[_0x003f('0x40')]('_'));var _0x5e793d=_0x53291a[_0x003f('0x2f')](_0x53291a[_0x003f('0x40')]('_')+0x1);if(_0x18ede6===_0x21c9f1){_0x27425f[_0x5e793d]=_0x29ae68[_0x003f('0x41')];}}});}return _0x27425f;}function getTicket(_0xf602cc,_0xc094cb,_0x21342b,_0x5b6bbb,_0x2d4c8c,_0x4e0307,_0x5e6a54){return new Promise(function(_0x923ed2,_0x4b3d0e){var _0xeaa911;return getAuthToken(_0xc094cb,_0x21342b,_0x5e6a54)[_0x003f('0x12')](function(_0x473514){if(_0x4e0307[_0x003f('0x42')]==='incident'){_0xeaa911={'method':'POST','uri':_0x5b6bbb+_0x003f('0x43'),'body':Object[_0x003f('0x44')]({},{'title':intUtil[_0x003f('0x45')](_0x4e0307['Subjects'],_0x2d4c8c,'\x20'),'description':intUtil[_0x003f('0x45')](_0x4e0307[_0x003f('0x46')],_0x2d4c8c,'\x0a'),'customerid_contact@odata.bind':_0xf602cc[_0x003f('0x30')]?'/contacts('+_0xf602cc[_0x003f('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xf602cc[_0x003f('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x4e0307[_0x003f('0x47')],_0x2d4c8c,_0x4e0307[_0x003f('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x473514,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4e0307['ticketType']===_0x003f('0x48')){var _0x1ac7ba=_0xf602cc['enduserId']?[{'partyid_systemuser@odata.bind':_0x003f('0x2b')+_0xf602cc[_0x003f('0x24')]+')','participationtypemask':_0xf602cc[_0x003f('0x49')]===_0x003f('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0xf602cc['enduserId']+')','participationtypemask':_0xf602cc['callDirection']===_0x003f('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xf602cc['userId']+')','participationtypemask':_0xf602cc[_0x003f('0x49')]===_0x003f('0x4a')?0x2:0x1}];_0xeaa911={'method':_0x003f('0x29'),'uri':_0x5b6bbb+_0x003f('0x4b'),'body':Object[_0x003f('0x44')]({},{'subject':intUtil[_0x003f('0x45')](_0x4e0307['Subjects'],_0x2d4c8c,'\x20'),'phonenumber':String(_0x2d4c8c[_0x003f('0x28')]),'description':intUtil[_0x003f('0x45')](_0x4e0307[_0x003f('0x46')],_0x2d4c8c,'\x0a'),'regardingobjectid_contact@odata.bind':_0xf602cc[_0x003f('0x30')]?_0x003f('0x4c')+_0xf602cc[_0x003f('0x30')]+')':undefined,'ownerid@odata.bind':_0x003f('0x2b')+_0xf602cc[_0x003f('0x24')]+')','directioncode':_0xf602cc[_0x003f('0x49')]==='queue'?![]:!![],'phonecall_activity_parties':_0x1ac7ba},getCustomFields(_0x4e0307[_0x003f('0x47')],_0x2d4c8c,_0x4e0307[_0x003f('0x42')])),'headers':{'Authorization':_0x003f('0x1a')+_0x473514,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xeaa911);})[_0x003f('0x12')](function(_0x4f31e0){var _0x362a1b=_0x4f31e0['headers'][_0x003f('0x2e')];var _0x43335a=_0x362a1b[_0x003f('0x2f')](_0x362a1b[_0x003f('0x4d')]('(')+0x1,_0x362a1b[_0x003f('0x4d')](')'));_0xf602cc[_0x003f('0x4e')]=_0x43335a;_0x923ed2(_0xf602cc);})['catch'](function(_0x3aae20){_0x4b3d0e(_0x3aae20[_0x003f('0x31')]);});});}function emit(_0xe42d6c,_0x4e241e,_0xaed7f3,_0x2cc43b){var _0x77139e={'uri':util['format'](_0x003f('0x4f'),_0xe42d6c,_0xaed7f3,_0x2cc43b)};io['to'](util[_0x003f('0x50')](_0x003f('0x51'),_0x4e241e))[_0x003f('0x52')]('trigger:browser:url',_0x77139e);}exports['cs']=function(_0xcb5c2b,_0xc378be,_0x23dbe9,_0x1d7409,_0xe4d459,_0x3fef7c,_0x43d7df,_0x247722){var _0x49ffb5={};_0x3fef7c[_0x003f('0xf')]=_0x3fef7c[_0x003f('0xa')]?intUtil[_0x003f('0x53')](_0x3fef7c['CloudProvider']['data7']):intUtil[_0x003f('0x53')](_0x3fef7c['remoteUri']);_0x3fef7c[_0x003f('0x54')]=intUtil['stripTrailingSlash'](_0x3fef7c[_0x003f('0x54')]);_0x49ffb5[_0x003f('0x49')]=_0x247722===_0x003f('0x4a')||_0x247722===_0x003f('0x55')?_0x003f('0x4a'):_0x003f('0x27');var _0x20cab6=_0x3fef7c[_0x003f('0xa')]?util['format'](_0x003f('0x56'),_0x3fef7c[_0x003f('0xb')][_0x003f('0x57')]):util['format']('%s/api/data/v9.0/',_0x3fef7c['remoteUri']);var _0x3bb643=util[_0x003f('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3fef7c[_0x003f('0xc')]);var _0x2a364e=util[_0x003f('0x50')](_0x003f('0x58'),_0x3fef7c[_0x003f('0x54')],_0xc378be[_0x003f('0x59')],md5(_0xc378be['uniqueid']));if(_0xe4d459&&_0xe4d459['monitor_format']){logger['info'](_0x003f('0x5a'),_0x003f('0x5b'));_0xc378be[_0x003f('0x5c')]=_0x2a364e;}else if(_0x43d7df&&_0x43d7df['recordingFormat']&&_0x43d7df[_0x003f('0x5d')]!==_0x003f('0x5e')){logger[_0x003f('0x25')](_0x003f('0x5f'),_0x003f('0x5b'));_0xc378be[_0x003f('0x5c')]=_0x2a364e;}else{_0xc378be['recordingURL']='';}return getUser(_0x49ffb5,_0x3fef7c,_0x1d7409,_0x3bb643,_0x20cab6,_0x247722)[_0x003f('0x12')](function(_0x2c76b9){logger[_0x003f('0x25')]('['+_0x247722[_0x003f('0x16')]()+_0x003f('0x60'),_0x2c76b9[_0x003f('0x24')]);logger['info']('['+_0x247722[_0x003f('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x2c76b9[_0x003f('0x1d')]);return getEndUser(_0x2c76b9,_0x3fef7c,_0x3bb643,_0x20cab6,_0xc378be,_0x247722,_0x23dbe9[_0x003f('0x61')],_0x23dbe9[_0x003f('0x62')]);})['then'](function(_0x386589){logger['info']('['+_0x247722['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x386589[_0x003f('0x30')]);logger[_0x003f('0x25')]('['+_0x247722['toUpperCase']()+_0x003f('0x63'),_0xc378be[_0x003f('0x28')]);return getTicket(_0x386589,_0x3fef7c,_0x3bb643,_0x20cab6,_0xc378be,_0x23dbe9,_0x247722);})[_0x003f('0x12')](function(_0x2e8eac){logger[_0x003f('0x25')](util[_0x003f('0x50')]('['+_0x247722['toUpperCase']()+_0x003f('0x64'),_0x23dbe9['ticketType'],_0x2e8eac['ticketId']));logger[_0x003f('0x25')](util[_0x003f('0x50')]('['+_0x247722['toUpperCase']()+_0x003f('0x65'),_0x247722));if(_0x247722!==_0x003f('0x55')&&_0x23dbe9[_0x003f('0x66')]){logger[_0x003f('0x25')]('['+_0x247722[_0x003f('0x16')]()+']',_0x003f('0x67'));emit(_0x3fef7c['remoteUri'],_0x1d7409['name'],_0x23dbe9[_0x003f('0x42')],_0x2e8eac[_0x003f('0x4e')]);}})[_0x003f('0x14')](function(_0x53794b){logger[_0x003f('0x15')]('['+_0x247722['toUpperCase']()+_0x003f('0x68'),_0x53794b['message']);console[_0x003f('0x15')](_0x003f('0x69'),_0x53794b);});}; \ No newline at end of file +var _0x0b53=['toLowerCase','contacts','/systemusers(','Bearer\x20','body','headers','substring','lastIndexOf','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','enduserId','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','type','nameField','customField','indexOf','content','incident','incidents','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','Subjects','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','outbound','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','calleridnum',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','openNewTab','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','POST','clientId','username','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','message'];(function(_0x1b26ac,_0x5ea577){var _0x2d88ec=function(_0x4d6110){while(--_0x4d6110){_0x1b26ac['push'](_0x1b26ac['shift']());}};_0x2d88ec(++_0x5ea577);}(_0x0b53,0x11b));var _0x30b5=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x0b53[_0x421cf8];return _0x145c48;};'use strict';var _=require('lodash');var rp=require(_0x30b5('0x0'));var util=require(_0x30b5('0x1'));var intUtil=require('./util');var md5=require(_0x30b5('0x2'));var Redis=require(_0x30b5('0x3'));var logger=require(_0x30b5('0x4'))(_0x30b5('0x5'));var config=require('../../../../config/environment');config[_0x30b5('0x6')]=_['defaults'](config['redis'],{'host':_0x30b5('0x7'),'port':0x18eb});var io=require(_0x30b5('0x8'))(new Redis(config['redis']));function getAuthToken(_0x1101ed,_0xc01566,_0x42c705){if(_0x1101ed[_0x30b5('0x9')]){_0x1101ed[_0x30b5('0xa')]=_0x1101ed[_0x30b5('0xb')][_0x30b5('0xc')];_0x1101ed[_0x30b5('0xd')]=_0x1101ed[_0x30b5('0xb')][_0x30b5('0xe')];return Promise['resolve'](_0x1101ed[_0x30b5('0xb')]['data5']);}var _0x564003={'method':_0x30b5('0xf'),'uri':_0xc01566,'form':{'client_id':_0x1101ed[_0x30b5('0x10')],'resource':_0x1101ed[_0x30b5('0xa')],'username':_0x1101ed[_0x30b5('0x11')],'password':_0x1101ed[_0x30b5('0x12')],'grant_type':_0x30b5('0x12'),'client_secret':_0x1101ed[_0x30b5('0x13')]},'json':!![]};return rp(_0x564003)[_0x30b5('0x14')](function(_0x2731c1){return _0x2731c1[_0x30b5('0x15')];})['catch'](function(_0xbe6f8c){logger[_0x30b5('0x16')]('['+[_0x42c705['toUpperCase']()]+_0x30b5('0x17'));return _0xbe6f8c['message'];});}function getUser(_0x2d9b58,_0x292746,_0x5e2c88,_0x24286f,_0x217673,_0x5e8af0){return new Promise(function(_0x5eeb14,_0x5f1935){return getAuthToken(_0x292746,_0x24286f,_0x5e8af0)[_0x30b5('0x14')](function(_0x1a3000){var _0xf46f8={'method':'GET','uri':_0x217673+_0x30b5('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x1a3000,'OData-Version':_0x30b5('0x19')},'json':!![]};return rp(_0xf46f8);})[_0x30b5('0x14')](function(_0x346246){var _0x208599=_0x346246[_0x30b5('0x1a')];var _0x5bf4a2=![];var _0x4128dd=null;if(!_[_0x30b5('0x1b')](_0x5e2c88)){if(intUtil['validateEmail'](_0x5e2c88[_0x30b5('0x1c')])){_0x2d9b58[_0x30b5('0x1d')]=_0x5e2c88[_0x30b5('0x1c')];for(_0x4128dd=0x0;_0x4128dd<_0x208599[_0x30b5('0x1e')];_0x4128dd++){if(_0x208599[_0x4128dd][_0x30b5('0x1f')]===_0x5e2c88['email']&&!_0x208599[_0x4128dd][_0x30b5('0x20')]){_0x5bf4a2=!![];logger[_0x30b5('0x21')]('['+[_0x5e8af0[_0x30b5('0x22')]()]+_0x30b5('0x23')+_0x208599[_0x4128dd][_0x30b5('0x24')]+'!');_0x2d9b58[_0x30b5('0x25')]=_0x208599[_0x4128dd][_0x30b5('0x24')];}}}}if(!_0x5bf4a2){logger['info']('['+[_0x5e8af0['toUpperCase']()]+_0x30b5('0x26'));_0x2d9b58[_0x30b5('0x1d')]=_0x292746[_0x30b5('0x11')];for(_0x4128dd=0x0;_0x4128dd<_0x208599[_0x30b5('0x1e')];_0x4128dd++){if(_0x208599[_0x4128dd][_0x30b5('0x1f')]===_0x292746[_0x30b5('0x11')]){_0x2d9b58[_0x30b5('0x25')]=_0x208599[_0x4128dd][_0x30b5('0x24')];}}}_0x5eeb14(_0x2d9b58);})[_0x30b5('0x27')](function(_0x4099fa){_0x5f1935(_0x4099fa[_0x30b5('0x28')]);});});}function createEndUser(_0x193d3c,_0x16d32a,_0x40c1ad,_0x3b4723,_0x214f05,_0x3bf8c9,_0x18ce73){return new Promise(function(_0x44352f,_0x2022dd){return getAuthToken(_0x16d32a,_0x40c1ad,_0x3bf8c9)[_0x30b5('0x14')](function(_0x373bdf){var _0x112ecc=_0x3bf8c9[_0x30b5('0x29')]()==='outbound'?_0x214f05['destcalleridnum']:_0x214f05['calleridnum'];var _0x71442a={'method':_0x30b5('0xf'),'uri':_0x3b4723+_0x30b5('0x2a'),'body':{'fullname':_0x112ecc,'firstname':_0x112ecc,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x30b5('0x2b')+_0x193d3c[_0x30b5('0x25')]+')'},'headers':{'Authorization':_0x30b5('0x2c')+_0x373bdf,'OData-Version':_0x30b5('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x71442a[_0x30b5('0x2d')][_0x18ce73]=_0x112ecc;return rp(_0x71442a);})[_0x30b5('0x14')](function(_0x38d3bc){var _0x10518e=_0x38d3bc[_0x30b5('0x2e')]['odata-entityid'];var _0xe84da9=_0x10518e[_0x30b5('0x2f')](_0x10518e['lastIndexOf']('(')+0x1,_0x10518e[_0x30b5('0x30')](')'));_0x193d3c['enduserId']=_0xe84da9;_0x44352f(_0x193d3c);})[_0x30b5('0x27')](function(_0x478cca){_0x2022dd(_0x478cca[_0x30b5('0x28')]);});});}function getEndUser(_0x2e267d,_0x579797,_0x1da0d4,_0xca792d,_0x59aba3,_0x244baf,_0x162231,_0x2ce881){var _0x388b0d=_0x244baf['toLowerCase']()==='outbound'?_0x59aba3['destcalleridnum']:_0x59aba3['calleridnum'];return getAuthToken(_0x579797,_0x1da0d4,_0x244baf)[_0x30b5('0x14')](function(_0x326b8f){_0x2ce881=_0x2ce881?_0x2ce881:_0x30b5('0x31');var _0x393172={'method':_0x30b5('0x32'),'uri':_0xca792d+_0x30b5('0x33')+_0x2ce881+_0x30b5('0x34')+_0x2ce881+_0x30b5('0x35')+_0x388b0d[_0x30b5('0x36')]('+','%2b')+'\x27','headers':{'Authorization':_0x30b5('0x2c')+_0x326b8f,'If-None-Match':null,'OData-Version':_0x30b5('0x19')},'json':!![]};return rp(_0x393172);})[_0x30b5('0x14')](function(_0x49a1c6){var _0x58120d=![];if(!_0x49a1c6)return _0x58120d;var _0x478226=_0x49a1c6['value'];for(var _0x2ffe07=0x0;_0x2ffe07<_0x478226[_0x30b5('0x1e')];_0x2ffe07++){if(_0x478226[_0x2ffe07][_0x2ce881]===_0x388b0d){_0x58120d=!![];_0x2e267d[_0x30b5('0x37')]=_0x478226[_0x2ffe07][_0x30b5('0x38')];}}return _0x58120d;})['then'](function(_0x351fb9){if(_0x351fb9)return _0x2e267d;if(_0x162231==='nothing'){logger[_0x30b5('0x21')]('['+[_0x244baf[_0x30b5('0x22')]()]+_0x30b5('0x39'));return _0x2e267d;}return createEndUser(_0x2e267d,_0x579797,_0x1da0d4,_0xca792d,_0x59aba3,_0x244baf,_0x2ce881)[_0x30b5('0x14')](function(_0x342648){logger[_0x30b5('0x21')]('['+[_0x244baf[_0x30b5('0x22')]()]+_0x30b5('0x3a'),_0x342648[_0x30b5('0x37')]);return _0x342648;});});}function getCustomFields(_0x408f49,_0x20bffd,_0x5cb748){var _0x4a5be2={};if(_0x408f49[_0x30b5('0x1e')]>0x0){_['forEach'](_0x408f49,function(_0x1a78ab){if(_[_0x30b5('0x3b')]([_0x30b5('0x3c'),'picklist'],_0x1a78ab[_0x30b5('0x3d')])&&_0x1a78ab[_0x30b5('0x3e')]&&!_0x1a78ab[_0x30b5('0x3f')]){var _0x173f7f=_0x1a78ab['idField'][_0x30b5('0x29')]();var _0x3b7b5d=_0x173f7f[_0x30b5('0x2f')](0x0,_0x173f7f['indexOf']('_'));var _0x1fa07e=_0x173f7f[_0x30b5('0x2f')](_0x173f7f[_0x30b5('0x40')]('_')+0x1);if(_0x3b7b5d===_0x5cb748){_0x4a5be2[_0x1fa07e]=_0x1a78ab[_0x30b5('0x41')];}}});}return _0x4a5be2;}function getTicket(_0x1cdb5d,_0x3decf0,_0x38955d,_0x5e018b,_0x4b6f56,_0xff88f8,_0x4c4e92){return new Promise(function(_0x1a1e01,_0x59fd1e){var _0x58766e;return getAuthToken(_0x3decf0,_0x38955d,_0x4c4e92)[_0x30b5('0x14')](function(_0x4c2220){if(_0xff88f8['ticketType']===_0x30b5('0x42')){_0x58766e={'method':_0x30b5('0xf'),'uri':_0x5e018b+_0x30b5('0x43'),'body':Object['assign']({},{'title':intUtil[_0x30b5('0x44')](_0xff88f8['Subjects'],_0x4b6f56,'\x20'),'description':intUtil[_0x30b5('0x44')](_0xff88f8[_0x30b5('0x45')],_0x4b6f56,'\x0a'),'customerid_contact@odata.bind':_0x1cdb5d[_0x30b5('0x37')]?_0x30b5('0x46')+_0x1cdb5d[_0x30b5('0x37')]+')':undefined,'ownerid@odata.bind':_0x30b5('0x2b')+_0x1cdb5d[_0x30b5('0x25')]+')','caseorigincode':'1'},getCustomFields(_0xff88f8[_0x30b5('0x47')],_0x4b6f56,_0xff88f8[_0x30b5('0x48')])),'headers':{'Authorization':_0x30b5('0x2c')+_0x4c2220,'OData-Version':_0x30b5('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xff88f8[_0x30b5('0x48')]===_0x30b5('0x49')){var _0x497042=_0x1cdb5d[_0x30b5('0x37')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1cdb5d['userId']+')','participationtypemask':_0x1cdb5d['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x1cdb5d[_0x30b5('0x37')]+')','participationtypemask':_0x1cdb5d[_0x30b5('0x4a')]===_0x30b5('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x30b5('0x2b')+_0x1cdb5d[_0x30b5('0x25')]+')','participationtypemask':_0x1cdb5d[_0x30b5('0x4a')]===_0x30b5('0x4b')?0x2:0x1}];_0x58766e={'method':_0x30b5('0xf'),'uri':_0x5e018b+_0x30b5('0x4c'),'body':Object['assign']({},{'subject':intUtil['getString'](_0xff88f8[_0x30b5('0x4d')],_0x4b6f56,'\x20'),'phonenumber':String(_0x4b6f56['calleridnum']),'description':intUtil[_0x30b5('0x44')](_0xff88f8[_0x30b5('0x45')],_0x4b6f56,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1cdb5d[_0x30b5('0x37')]?_0x30b5('0x46')+_0x1cdb5d[_0x30b5('0x37')]+')':undefined,'ownerid@odata.bind':_0x30b5('0x2b')+_0x1cdb5d[_0x30b5('0x25')]+')','directioncode':_0x1cdb5d['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x497042},getCustomFields(_0xff88f8[_0x30b5('0x47')],_0x4b6f56,_0xff88f8[_0x30b5('0x48')])),'headers':{'Authorization':'Bearer\x20'+_0x4c2220,'OData-Version':_0x30b5('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x58766e);})[_0x30b5('0x14')](function(_0x2725c3){var _0x529c45=_0x2725c3[_0x30b5('0x2e')][_0x30b5('0x4e')];var _0x2753cb=_0x529c45[_0x30b5('0x2f')](_0x529c45[_0x30b5('0x30')]('(')+0x1,_0x529c45[_0x30b5('0x30')](')'));_0x1cdb5d['ticketId']=_0x2753cb;_0x1a1e01(_0x1cdb5d);})['catch'](function(_0x73cb5b){_0x59fd1e(_0x73cb5b['message']);});});}function emit(_0x209d9f,_0x1873a0,_0x352908,_0x583ea7){var _0x55a58c={'uri':util[_0x30b5('0x4f')](_0x30b5('0x50'),_0x209d9f,_0x352908,_0x583ea7)};io['to'](util[_0x30b5('0x4f')](_0x30b5('0x51'),_0x1873a0))['emit'](_0x30b5('0x52'),_0x55a58c);}exports['cs']=function(_0x56c56a,_0xa83905,_0x3bcb9c,_0x3d461d,_0xbbed69,_0x388076,_0x44e915,_0x41619a){var _0x3be9e1={};_0x388076[_0x30b5('0xa')]=_0x388076[_0x30b5('0x9')]?intUtil[_0x30b5('0x53')](_0x388076[_0x30b5('0xb')][_0x30b5('0xc')]):intUtil[_0x30b5('0x53')](_0x388076[_0x30b5('0xa')]);_0x388076[_0x30b5('0x54')]=intUtil[_0x30b5('0x53')](_0x388076[_0x30b5('0x54')]);_0x3be9e1[_0x30b5('0x4a')]=_0x41619a===_0x30b5('0x4b')||_0x41619a==='unmanaged'?_0x30b5('0x4b'):_0x30b5('0x55');var _0x563c4f=_0x388076[_0x30b5('0x9')]?util[_0x30b5('0x4f')]('%s/api/data/v9.0/',_0x388076['CloudProvider'][_0x30b5('0xc')]):util[_0x30b5('0x4f')](_0x30b5('0x56'),_0x388076['remoteUri']);var _0xa57d0d=util[_0x30b5('0x4f')]('https://login.microsoftonline.com/%s/oauth2/token',_0x388076[_0x30b5('0xd')]);var _0xce761a=util[_0x30b5('0x4f')](_0x30b5('0x57'),_0x388076['serverUrl'],_0xa83905['uniqueid'],md5(_0xa83905[_0x30b5('0x58')]));if(_0xbbed69&&_0xbbed69[_0x30b5('0x59')]){logger[_0x30b5('0x21')](_0x30b5('0x5a'),'Recording\x20is\x20enabled!');_0xa83905[_0x30b5('0x5b')]=_0xce761a;}else if(_0x44e915&&_0x44e915[_0x30b5('0x5c')]&&_0x44e915[_0x30b5('0x5c')]!=='none'){logger['info'](_0x30b5('0x5d'),_0x30b5('0x5e'));_0xa83905[_0x30b5('0x5b')]=_0xce761a;}else{_0xa83905[_0x30b5('0x5b')]='';}return getUser(_0x3be9e1,_0x388076,_0x3d461d,_0xa57d0d,_0x563c4f,_0x41619a)[_0x30b5('0x14')](function(_0x2b7d61){logger[_0x30b5('0x21')]('['+_0x41619a['toUpperCase']()+_0x30b5('0x5f'),_0x2b7d61[_0x30b5('0x25')]);logger[_0x30b5('0x21')]('['+_0x41619a[_0x30b5('0x22')]()+_0x30b5('0x60'),_0x2b7d61[_0x30b5('0x1d')]);return getEndUser(_0x2b7d61,_0x388076,_0xa57d0d,_0x563c4f,_0xa83905,_0x41619a,_0x3bcb9c[_0x30b5('0x61')],_0x3bcb9c['additionalSearchContact']);})[_0x30b5('0x14')](function(_0x370e96){logger[_0x30b5('0x21')]('['+_0x41619a[_0x30b5('0x22')]()+_0x30b5('0x62'),_0x370e96[_0x30b5('0x37')]);logger[_0x30b5('0x21')]('['+_0x41619a[_0x30b5('0x22')]()+_0x30b5('0x63'),_0xa83905[_0x30b5('0x64')]);return getTicket(_0x370e96,_0x388076,_0xa57d0d,_0x563c4f,_0xa83905,_0x3bcb9c,_0x41619a);})[_0x30b5('0x14')](function(_0x338505){logger[_0x30b5('0x21')](util[_0x30b5('0x4f')]('['+_0x41619a[_0x30b5('0x22')]()+_0x30b5('0x65'),_0x3bcb9c[_0x30b5('0x48')],_0x338505['ticketId']));logger[_0x30b5('0x21')](util[_0x30b5('0x4f')]('['+_0x41619a[_0x30b5('0x22')]()+']\x20Call\x20direction:\x20%s',_0x41619a));if(_0x41619a!==_0x30b5('0x66')&&_0x3bcb9c[_0x30b5('0x67')]){logger[_0x30b5('0x21')]('['+_0x41619a[_0x30b5('0x22')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x388076['remoteUri'],_0x3d461d[_0x30b5('0x68')],_0x3bcb9c[_0x30b5('0x48')],_0x338505[_0x30b5('0x69')]);}})['catch'](function(_0x2ddbc4){logger['error']('['+_0x41619a['toUpperCase']()+_0x30b5('0x6a'),_0x2ddbc4[_0x30b5('0x28')]);console['error'](_0x30b5('0x6b'),_0x2ddbc4);});}; \ 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 6df3b52..2cb808e 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 _0xb359=['lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','keyBy','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','find','contact','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','[HTTP]','GET','map','length','forEach','string','nameField','content','includes','picklist','type','idField','customField','variable','variableName','push','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','stringify','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:'];(function(_0x539bde,_0x14b7db){var _0x1718d4=function(_0x1d35e0){while(--_0x1d35e0){_0x539bde['push'](_0x539bde['shift']());}};_0x1718d4(++_0x14b7db);}(_0xb359,0x178));var _0x9b35=function(_0x43d6c0,_0x3b4a61){_0x43d6c0=_0x43d6c0-0x0;var _0x30d273=_0xb359[_0x43d6c0];return _0x30d273;};'use strict';var _=require(_0x9b35('0x0'));var rp=require(_0x9b35('0x1'));var md5=require(_0x9b35('0x2'));var util=require('util');var Redis=require(_0x9b35('0x3'));var intUtil=require(_0x9b35('0x4'));var config=require(_0x9b35('0x5'));var logger=require(_0x9b35('0x6'))(_0x9b35('0x7'));config[_0x9b35('0x8')]=_[_0x9b35('0x9')](config[_0x9b35('0x8')],{'host':_0x9b35('0xa'),'port':0x18eb});var io=require(_0x9b35('0xb'))(new Redis(config[_0x9b35('0x8')]));var headers={'Content-Type':_0x9b35('0xc'),'Accept':_0x9b35('0xc')};function emit(_0x26b3fa,_0x546993,_0x551143){io['to'](_0x26b3fa)[_0x9b35('0xd')](_0x546993,_0x551143);}function getTicket(_0x3f1bbb,_0x39302b,_0x17e401,_0x31905d,_0x30e996){logger[_0x9b35('0xe')](_0x9b35('0xf'));var _0x42d461=_['merge']({'responder_id':_0x39302b['id'],'requester_id':_0x17e401['id'],'name':util[_0x9b35('0x10')](_0x9b35('0x11'),_0x30e996[_0x9b35('0x12')]),'phone':_0x30e996['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9b35('0x13')](_0x31905d[_0x9b35('0x14')],_0x30e996,'\x20'),'description':intUtil[_0x9b35('0x13')](_0x31905d[_0x9b35('0x15')],_0x30e996,_0x9b35('0x16')),'tags':getTags(_0x31905d[_0x9b35('0x17')],'name')},getCustomFields(_0x31905d[_0x9b35('0x18')],_0x30e996));_0x42d461[_0x9b35('0x19')]=_['mapValues'](_[_0x9b35('0x1a')](_0x42d461[_0x9b35('0x19')],'id'),'value');return request({'uri':util[_0x9b35('0x10')](_0x9b35('0x1b'),_0x3f1bbb['remoteUri']),'method':_0x9b35('0x1c'),'body':_0x42d461})[_0x9b35('0x1d')](function(_0x4458e6){logger[_0x9b35('0xe')](_0x9b35('0x1e'));return _0x4458e6;});}function getUser(_0x37a256,_0x1c9693){if(intUtil[_0x9b35('0x1f')](_0x1c9693)){return request({'uri':util[_0x9b35('0x10')](_0x9b35('0x20'),_0x37a256[_0x9b35('0x21')]),'qs':{'email':_0x1c9693}})[_0x9b35('0x1d')](function(_0x2ed78d){if(_0x2ed78d['length']){logger['info']('Agent\x20found!');return _[_0x9b35('0x22')](_0x2ed78d,function(_0x195a50){return _0x195a50[_0x9b35('0x23')]['email']===_0x1c9693;});}else{logger[_0x9b35('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9b35('0x10')]('%s/api/v2/agents/me',_0x37a256[_0x9b35('0x21')])})[_0x9b35('0x1d')](function(_0x817181){logger[_0x9b35('0xe')]('Admin\x20account\x20selected.');return _0x817181;});}});}else{logger[_0x9b35('0xe')](_0x9b35('0x24'));return request({'uri':util[_0x9b35('0x10')](_0x9b35('0x25'),_0x37a256[_0x9b35('0x21')])})['then'](function(_0x2e0d71){logger[_0x9b35('0xe')](_0x9b35('0x26'));return _0x2e0d71;});}}function getEndUser(_0x32578a,_0x6fc6d2,_0x1aab45){logger[_0x9b35('0xe')](_0x9b35('0x27'),_0x1aab45);return request({'uri':util['format'](_0x9b35('0x28'),_0x32578a[_0x9b35('0x21')]),'qs':{'phone':_0x1aab45}})[_0x9b35('0x1d')](function(_0x4eac8f){if(_0x4eac8f['length']){logger['info'](_0x9b35('0x29'));return _['find'](_0x4eac8f,{'phone':_0x1aab45});}else{logger['info'](_0x9b35('0x2a'));return request({'uri':util[_0x9b35('0x10')](_0x9b35('0x28'),_0x32578a[_0x9b35('0x21')]),'method':_0x9b35('0x1c'),'body':{'name':_0x6fc6d2,'phone':_0x1aab45}})[_0x9b35('0x1d')](function(_0x4af75b){logger['info'](_0x9b35('0x2b'));return _0x4af75b;});}});}function getAuth(_0x41c221){return util[_0x9b35('0x10')]('Basic\x20%s',new Buffer(_0x41c221[_0x9b35('0x2c')]+':X')[_0x9b35('0x2d')](_0x9b35('0x2e')));}function request(_0x3b04d3){logger['debug'](_0x9b35('0x2f'),JSON['stringify'](_0x3b04d3));return rp(_['defaults'](_0x3b04d3,{'method':_0x9b35('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x503a6c,_0x343f7f){var _0x1bbffa=[];if(_0x503a6c&&_0x503a6c['length']>0x0){_0x1bbffa=_[_0x9b35('0x31')](_0x503a6c,_0x343f7f);}return _0x1bbffa;}function getCustomFields(_0x2a449d,_0x4b9586){var _0x494e09=[];var _0x19e773={'custom_fields':[]};if(_0x2a449d[_0x9b35('0x32')]>0x0){_[_0x9b35('0x33')](_0x2a449d,function(_0x4f6402){if(_['includes']([_0x9b35('0x34'),'picklist'],_0x4f6402['type'])&&_0x4f6402[_0x9b35('0x35')]&&!_0x4f6402['customField']){_0x19e773[_0x4f6402['nameField']['toLowerCase']()]=_0x4f6402[_0x9b35('0x36')][_0x9b35('0x2d')]();}else if(_[_0x9b35('0x37')](['string',_0x9b35('0x38')],_0x4f6402[_0x9b35('0x39')])&&_0x4f6402[_0x9b35('0x3a')]&&_0x4f6402[_0x9b35('0x3b')]){_0x19e773['custom_fields']['push']({'id':_0x4f6402[_0x9b35('0x3a')],'value':_0x4f6402[_0x9b35('0x36')][_0x9b35('0x2d')]()});}else if(_0x4f6402[_0x9b35('0x39')]===_0x9b35('0x3c')&&_0x4f6402[_0x9b35('0x3d')]&&_0x4f6402['idField']&&_0x4f6402[_0x9b35('0x3b')]){_0x4b9586[_0x4f6402[_0x9b35('0x3d')]]&&_0x19e773[_0x9b35('0x19')][_0x9b35('0x3e')]({'id':_0x4f6402[_0x9b35('0x3a')],'value':_0x4b9586[_0x4f6402[_0x9b35('0x3d')]][_0x9b35('0x2d')]()});}else if(_0x4f6402[_0x9b35('0x39')]===_0x9b35('0x3f')&&_0x4f6402[_0x9b35('0x40')]&&_0x4f6402['Variable'][_0x9b35('0x41')]&&_0x4f6402[_0x9b35('0x3a')]&&_0x4f6402[_0x9b35('0x3b')]){_0x4b9586[_0x4f6402[_0x9b35('0x40')][_0x9b35('0x41')]['toLowerCase']()]&&_0x19e773[_0x9b35('0x19')][_0x9b35('0x3e')]({'id':_0x4f6402[_0x9b35('0x3a')],'value':_0x4b9586[_0x4f6402[_0x9b35('0x40')][_0x9b35('0x41')]['toLowerCase']()][_0x9b35('0x2d')]()});}});}return _0x19e773;}exports['queue']=function(_0x17335b,_0x13e03b,_0x151bbe,_0x1ee517,_0x137cb8,_0x5add6e){var _0x3c1f3d,_0x75f662;_0x5add6e[_0x9b35('0x21')]=intUtil[_0x9b35('0x42')](_0x5add6e[_0x9b35('0x21')]);_0x5add6e[_0x9b35('0x43')]=intUtil[_0x9b35('0x42')](_0x5add6e['serverUrl']);if(_0x137cb8&&_0x137cb8[_0x9b35('0x44')]){logger[_0x9b35('0xe')]('[QUEUE]',_0x9b35('0x45'));_0x13e03b[_0x9b35('0x46')]=util[_0x9b35('0x10')](_0x9b35('0x47'),_0x5add6e[_0x9b35('0x43')],_0x13e03b[_0x9b35('0x48')],md5(_0x13e03b[_0x9b35('0x48')]));}else{_0x13e03b[_0x9b35('0x46')]='';}headers[_0x9b35('0x49')]=getAuth(_0x5add6e);return getUser(_0x5add6e,_0x1ee517[_0x9b35('0x4a')])[_0x9b35('0x1d')](function(_0x122d36){_0x3c1f3d=_0x122d36;logger[_0x9b35('0xe')]('The\x20User\x20ID\x20is:',_0x3c1f3d['id']);return getEndUser(_0x5add6e,_0x13e03b['calleridname'],_0x13e03b[_0x9b35('0x4b')]);})[_0x9b35('0x1d')](function(_0x1721bf){_0x75f662=_0x1721bf;logger['info'](_0x9b35('0x4c'),_0x75f662['id']);return getTicket(_0x5add6e,_0x3c1f3d,_0x75f662,_0x151bbe,_0x13e03b);})[_0x9b35('0x1d')](function(_0xa9ef26){if(_0xa9ef26&&_0xa9ef26['id']){logger[_0x9b35('0xe')](_0x9b35('0x1e'));logger[_0x9b35('0xe')]('The\x20Ticket\x20ID\x20is:',_0xa9ef26['id']);logger[_0x9b35('0xe')](_0x9b35('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9b35('0x10')](_0x9b35('0x4e'),_0x1ee517['name']),_0x9b35('0x4f'),{'uri':util[_0x9b35('0x10')](_0x9b35('0x50'),_0x5add6e[_0x9b35('0x21')],_0xa9ef26['id'])});}})[_0x9b35('0x51')](function(_0x4c378b){logger[_0x9b35('0x52')]('[QUEUE]',JSON['stringify'](_0x4c378b));});};exports['outbound']=function(_0x5be49a,_0x542d44,_0x2ba3e8,_0x50d402,_0x3194d7,_0x2ca85d,_0xa78189){var _0xc837bc,_0x4b98dc;_0x2ca85d['remoteUri']=intUtil['stripTrailingSlash'](_0x2ca85d[_0x9b35('0x21')]);_0x2ca85d[_0x9b35('0x43')]=intUtil[_0x9b35('0x42')](_0x2ca85d[_0x9b35('0x43')]);if(_0xa78189&&_0xa78189[_0x9b35('0x53')]&&_0xa78189[_0x9b35('0x53')]!==_0x9b35('0x54')){logger['info'](_0x9b35('0x55'),_0x9b35('0x45'));_0x542d44[_0x9b35('0x46')]=util['format'](_0x9b35('0x47'),_0x2ca85d[_0x9b35('0x43')],_0x542d44[_0x9b35('0x48')],md5(_0x542d44[_0x9b35('0x48')]));}headers[_0x9b35('0x49')]=getAuth(_0x2ca85d);return getUser(_0x2ca85d,_0x50d402[_0x9b35('0x4a')])[_0x9b35('0x1d')](function(_0x1d00bd){_0xc837bc=_0x1d00bd;logger['info'](_0x9b35('0x56'),_0xc837bc['id']);return getEndUser(_0x2ca85d,_0x542d44['destcalleridname'],_0x542d44[_0x9b35('0x57')]);})['then'](function(_0x40efc9){_0x4b98dc=_0x40efc9;logger[_0x9b35('0xe')](_0x9b35('0x4c'),_0x4b98dc['id']);return getTicket(_0x2ca85d,_0xc837bc,_0x4b98dc,_0x2ba3e8,_0x542d44);})[_0x9b35('0x1d')](function(_0x2ba26d){if(_0x2ba26d&&_0x2ba26d['id']){logger['info'](_0x9b35('0x1e'));logger[_0x9b35('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2ba26d['id']);logger['info'](_0x9b35('0x55'),_0x9b35('0x58'));emit(util[_0x9b35('0x10')](_0x9b35('0x4e'),_0x50d402['name']),_0x9b35('0x4f'),{'uri':util['format'](_0x9b35('0x50'),_0x2ca85d['remoteUri'],_0x2ba26d['id'])});}})[_0x9b35('0x51')](function(_0x11af33){logger[_0x9b35('0x52')](_0x9b35('0x55'),JSON[_0x9b35('0x59')](_0x11af33));});};exports[_0x9b35('0x5a')]=function(_0x2904b9,_0x1c38e9,_0x1775b2,_0xd38fd1,_0x510aee,_0x7755e){var _0x436cd2,_0x369e45;_0x7755e['remoteUri']=intUtil[_0x9b35('0x42')](_0x7755e[_0x9b35('0x21')]);_0x7755e[_0x9b35('0x43')]=intUtil[_0x9b35('0x42')](_0x7755e['serverUrl']);if(_0x510aee&&_0x510aee[_0x9b35('0x44')]){logger[_0x9b35('0xe')]('['+_0x1c38e9[_0x9b35('0x5b')][_0x9b35('0x5c')]()+']','Recording\x20is\x20enabled!');_0x1c38e9['recordingURL']=util[_0x9b35('0x10')](_0x9b35('0x47'),_0x7755e[_0x9b35('0x43')],_0x1c38e9[_0x9b35('0x48')],md5(_0x1c38e9[_0x9b35('0x48')]));}else{_0x1c38e9[_0x9b35('0x46')]='';}headers[_0x9b35('0x49')]=getAuth(_0x7755e);return getUser(_0x7755e,'')[_0x9b35('0x1d')](function(_0x37d3aa){_0x436cd2=_0x37d3aa;logger['info'](_0x9b35('0x56'),_0x436cd2['id']);return getEndUser(_0x7755e,_0x1c38e9[_0x9b35('0x12')],_0x1c38e9['calleridnum']);})[_0x9b35('0x1d')](function(_0x1739ca){_0x369e45=_0x1739ca;logger[_0x9b35('0xe')](_0x9b35('0x4c'),_0x369e45['id']);return getTicket(_0x7755e,_0x436cd2,_0x369e45,_0x1775b2,_0x1c38e9);})['then'](function(_0x539901){if(_0x539901){logger[_0x9b35('0xe')](_0x9b35('0x1e'));logger[_0x9b35('0xe')](_0x9b35('0x5d'),_0x539901['id']);}})[_0x9b35('0x51')](function(_0x5384fa){logger[_0x9b35('0x52')]('['+_0x1c38e9[_0x9b35('0x5b')][_0x9b35('0x5c')]()+']',JSON['stringify'](_0x5384fa));});}; \ No newline at end of file +var _0x796e=['calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','keyBy','value','info','validateEmail','remoteUri','then','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname'];(function(_0x4c0296,_0x278f9f){var _0x1c6d8e=function(_0x144bab){while(--_0x144bab){_0x4c0296['push'](_0x4c0296['shift']());}};_0x1c6d8e(++_0x278f9f);}(_0x796e,0x1c5));var _0xe796=function(_0x44e67c,_0x4b16c8){_0x44e67c=_0x44e67c-0x0;var _0x3cf335=_0x796e[_0x44e67c];return _0x3cf335;};'use strict';var _=require(_0xe796('0x0'));var rp=require(_0xe796('0x1'));var md5=require(_0xe796('0x2'));var util=require(_0xe796('0x3'));var Redis=require(_0xe796('0x4'));var intUtil=require(_0xe796('0x5'));var config=require(_0xe796('0x6'));var logger=require(_0xe796('0x7'))('freshdesk');config[_0xe796('0x8')]=_[_0xe796('0x9')](config[_0xe796('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe796('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xe796('0xb'),'Accept':'application/json'};function emit(_0x32ed94,_0x2db9a1,_0x372d16){io['to'](_0x32ed94)[_0xe796('0xc')](_0x2db9a1,_0x372d16);}function getTicket(_0x13dd91,_0x7d596,_0x4d25a2,_0x3e02c2,_0x47b58b){logger['info'](_0xe796('0xd'));var _0x4e6712=_[_0xe796('0xe')]({'responder_id':_0x7d596['id'],'requester_id':_0x4d25a2['id'],'name':util[_0xe796('0xf')]('Caller\x20-\x20%s',_0x47b58b[_0xe796('0x10')]),'phone':_0x47b58b[_0xe796('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe796('0x12')](_0x3e02c2[_0xe796('0x13')],_0x47b58b,'\x20'),'description':intUtil[_0xe796('0x12')](_0x3e02c2['Descriptions'],_0x47b58b,_0xe796('0x14')),'tags':getTags(_0x3e02c2['Tags'],_0xe796('0x15'))},getCustomFields(_0x3e02c2[_0xe796('0x16')],_0x47b58b));_0x4e6712[_0xe796('0x17')]=_[_0xe796('0x18')](_[_0xe796('0x19')](_0x4e6712[_0xe796('0x17')],'id'),_0xe796('0x1a'));return request({'uri':util[_0xe796('0xf')]('%s/api/v2/tickets',_0x13dd91['remoteUri']),'method':'POST','body':_0x4e6712})['then'](function(_0x1803fc){logger[_0xe796('0x1b')]('Ticket\x20created!');return _0x1803fc;});}function getUser(_0x5a1445,_0x51fb22){if(intUtil[_0xe796('0x1c')](_0x51fb22)){return request({'uri':util[_0xe796('0xf')]('%s/api/v2/agents',_0x5a1445[_0xe796('0x1d')]),'qs':{'email':_0x51fb22}})[_0xe796('0x1e')](function(_0x1632ef){if(_0x1632ef['length']){logger[_0xe796('0x1b')](_0xe796('0x1f'));return _[_0xe796('0x20')](_0x1632ef,function(_0x1f438c){return _0x1f438c[_0xe796('0x21')]['email']===_0x51fb22;});}else{logger[_0xe796('0x1b')](_0xe796('0x22'));return request({'uri':util[_0xe796('0xf')](_0xe796('0x23'),_0x5a1445[_0xe796('0x1d')])})[_0xe796('0x1e')](function(_0xe7d36f){logger[_0xe796('0x1b')](_0xe796('0x24'));return _0xe7d36f;});}});}else{logger[_0xe796('0x1b')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe796('0xf')](_0xe796('0x23'),_0x5a1445[_0xe796('0x1d')])})[_0xe796('0x1e')](function(_0x47946a){logger['info'](_0xe796('0x24'));return _0x47946a;});}}function getEndUser(_0x3eb640,_0x540ddb,_0x4ec3b9){logger['info'](_0xe796('0x25'),_0x4ec3b9);return request({'uri':util[_0xe796('0xf')]('%s/api/v2/contacts',_0x3eb640[_0xe796('0x1d')]),'qs':{'phone':_0x4ec3b9}})[_0xe796('0x1e')](function(_0x184d8f){if(_0x184d8f[_0xe796('0x26')]){logger[_0xe796('0x1b')](_0xe796('0x27'));return _['find'](_0x184d8f,{'phone':_0x4ec3b9});}else{logger[_0xe796('0x1b')](_0xe796('0x28'));return request({'uri':util[_0xe796('0xf')](_0xe796('0x29'),_0x3eb640[_0xe796('0x1d')]),'method':_0xe796('0x2a'),'body':{'name':_0x540ddb,'phone':_0x4ec3b9}})[_0xe796('0x1e')](function(_0x44ed1b){logger['info'](_0xe796('0x2b'));return _0x44ed1b;});}});}function getAuth(_0xd4cfcb){return util[_0xe796('0xf')]('Basic\x20%s',new Buffer(_0xd4cfcb[_0xe796('0x2c')]+':X')[_0xe796('0x2d')](_0xe796('0x2e')));}function request(_0x8df1fe){logger[_0xe796('0x2f')](_0xe796('0x30'),JSON[_0xe796('0x31')](_0x8df1fe));return rp(_[_0xe796('0x9')](_0x8df1fe,{'method':_0xe796('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x23eed7,_0x1b2347){var _0x24eaad=[];if(_0x23eed7&&_0x23eed7[_0xe796('0x26')]>0x0){_0x24eaad=_['map'](_0x23eed7,_0x1b2347);}return _0x24eaad;}function getCustomFields(_0x29f7fb,_0x25f7ba){var _0x3036e3=[];var _0x45c7de={'custom_fields':[]};if(_0x29f7fb[_0xe796('0x26')]>0x0){_[_0xe796('0x33')](_0x29f7fb,function(_0x5c8420){if(_[_0xe796('0x34')]([_0xe796('0x35'),_0xe796('0x36')],_0x5c8420[_0xe796('0x37')])&&_0x5c8420['nameField']&&!_0x5c8420[_0xe796('0x38')]){_0x45c7de[_0x5c8420[_0xe796('0x39')][_0xe796('0x3a')]()]=_0x5c8420[_0xe796('0x3b')][_0xe796('0x2d')]();}else if(_[_0xe796('0x34')]([_0xe796('0x35'),_0xe796('0x36')],_0x5c8420[_0xe796('0x37')])&&_0x5c8420[_0xe796('0x3c')]&&_0x5c8420['customField']){_0x45c7de['custom_fields']['push']({'id':_0x5c8420[_0xe796('0x3c')],'value':_0x5c8420['content'][_0xe796('0x2d')]()});}else if(_0x5c8420[_0xe796('0x37')]===_0xe796('0x3d')&&_0x5c8420[_0xe796('0x3e')]&&_0x5c8420[_0xe796('0x3c')]&&_0x5c8420['customField']){_0x25f7ba[_0x5c8420[_0xe796('0x3e')]]&&_0x45c7de[_0xe796('0x17')][_0xe796('0x3f')]({'id':_0x5c8420['idField'],'value':_0x25f7ba[_0x5c8420[_0xe796('0x3e')]][_0xe796('0x2d')]()});}else if(_0x5c8420[_0xe796('0x37')]===_0xe796('0x40')&&_0x5c8420[_0xe796('0x41')]&&_0x5c8420[_0xe796('0x41')][_0xe796('0x15')]&&_0x5c8420[_0xe796('0x3c')]&&_0x5c8420[_0xe796('0x38')]){_0x25f7ba[_0x5c8420[_0xe796('0x41')][_0xe796('0x15')][_0xe796('0x3a')]()]&&_0x45c7de['custom_fields'][_0xe796('0x3f')]({'id':_0x5c8420[_0xe796('0x3c')],'value':_0x25f7ba[_0x5c8420[_0xe796('0x41')][_0xe796('0x15')][_0xe796('0x3a')]()][_0xe796('0x2d')]()});}});}return _0x45c7de;}exports[_0xe796('0x42')]=function(_0x1e6145,_0x34b131,_0x40b550,_0x22567b,_0x530f30,_0x2c51bc){var _0x19ff14,_0x3c311a;_0x2c51bc[_0xe796('0x1d')]=intUtil[_0xe796('0x43')](_0x2c51bc['remoteUri']);_0x2c51bc[_0xe796('0x44')]=intUtil[_0xe796('0x43')](_0x2c51bc[_0xe796('0x44')]);if(_0x530f30&&_0x530f30['monitor_format']){logger[_0xe796('0x1b')](_0xe796('0x45'),_0xe796('0x46'));_0x34b131[_0xe796('0x47')]=util[_0xe796('0xf')](_0xe796('0x48'),_0x2c51bc[_0xe796('0x44')],_0x34b131[_0xe796('0x49')],md5(_0x34b131[_0xe796('0x49')]));}else{_0x34b131[_0xe796('0x47')]='';}headers[_0xe796('0x4a')]=getAuth(_0x2c51bc);return getUser(_0x2c51bc,_0x22567b[_0xe796('0x4b')])[_0xe796('0x1e')](function(_0x37cd5b){_0x19ff14=_0x37cd5b;logger['info'](_0xe796('0x4c'),_0x19ff14['id']);return getEndUser(_0x2c51bc,_0x34b131['calleridname'],_0x34b131['calleridnum']);})[_0xe796('0x1e')](function(_0x4cf96b){_0x3c311a=_0x4cf96b;logger[_0xe796('0x1b')](_0xe796('0x4d'),_0x3c311a['id']);return getTicket(_0x2c51bc,_0x19ff14,_0x3c311a,_0x40b550,_0x34b131);})[_0xe796('0x1e')](function(_0xcdfe92){if(_0xcdfe92&&_0xcdfe92['id']){logger[_0xe796('0x1b')](_0xe796('0x4e'));logger[_0xe796('0x1b')]('The\x20Ticket\x20ID\x20is:',_0xcdfe92['id']);logger[_0xe796('0x1b')](_0xe796('0x45'),_0xe796('0x4f'));emit(util[_0xe796('0xf')](_0xe796('0x50'),_0x22567b[_0xe796('0x15')]),_0xe796('0x51'),{'uri':util[_0xe796('0xf')](_0xe796('0x52'),_0x2c51bc[_0xe796('0x1d')],_0xcdfe92['id'])});}})[_0xe796('0x53')](function(_0x4651cd){logger[_0xe796('0x54')](_0xe796('0x45'),JSON[_0xe796('0x31')](_0x4651cd));});};exports[_0xe796('0x55')]=function(_0x6e6a2c,_0x58057e,_0x52c5ab,_0x1e54e0,_0x230cdd,_0x4b370b,_0x5b3912){var _0x16e956,_0x4499f1;_0x4b370b['remoteUri']=intUtil[_0xe796('0x43')](_0x4b370b['remoteUri']);_0x4b370b['serverUrl']=intUtil[_0xe796('0x43')](_0x4b370b[_0xe796('0x44')]);if(_0x5b3912&&_0x5b3912[_0xe796('0x56')]&&_0x5b3912['recordingFormat']!=='none'){logger[_0xe796('0x1b')](_0xe796('0x57'),_0xe796('0x46'));_0x58057e[_0xe796('0x47')]=util[_0xe796('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b370b[_0xe796('0x44')],_0x58057e[_0xe796('0x49')],md5(_0x58057e[_0xe796('0x49')]));}headers[_0xe796('0x4a')]=getAuth(_0x4b370b);return getUser(_0x4b370b,_0x1e54e0[_0xe796('0x4b')])['then'](function(_0x1e4b34){_0x16e956=_0x1e4b34;logger[_0xe796('0x1b')](_0xe796('0x4c'),_0x16e956['id']);return getEndUser(_0x4b370b,_0x58057e[_0xe796('0x58')],_0x58057e[_0xe796('0x59')]);})[_0xe796('0x1e')](function(_0x104f48){_0x4499f1=_0x104f48;logger[_0xe796('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x4499f1['id']);return getTicket(_0x4b370b,_0x16e956,_0x4499f1,_0x52c5ab,_0x58057e);})[_0xe796('0x1e')](function(_0x5e5fc6){if(_0x5e5fc6&&_0x5e5fc6['id']){logger[_0xe796('0x1b')](_0xe796('0x4e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5e5fc6['id']);logger[_0xe796('0x1b')](_0xe796('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1e54e0[_0xe796('0x15')]),_0xe796('0x51'),{'uri':util['format'](_0xe796('0x52'),_0x4b370b[_0xe796('0x1d')],_0x5e5fc6['id'])});}})[_0xe796('0x53')](function(_0x5f4c03){logger['error']('[OUTBOUND]',JSON[_0xe796('0x31')](_0x5f4c03));});};exports[_0xe796('0x5a')]=function(_0x1aef59,_0x10442c,_0x4f2721,_0x4a2b91,_0x4f5f06,_0x4ecbdf){var _0x323fb3,_0x3cb4e9;_0x4ecbdf['remoteUri']=intUtil['stripTrailingSlash'](_0x4ecbdf[_0xe796('0x1d')]);_0x4ecbdf[_0xe796('0x44')]=intUtil[_0xe796('0x43')](_0x4ecbdf[_0xe796('0x44')]);if(_0x4f5f06&&_0x4f5f06[_0xe796('0x5b')]){logger['info']('['+_0x10442c[_0xe796('0x5c')][_0xe796('0x5d')]()+']',_0xe796('0x46'));_0x10442c['recordingURL']=util['format'](_0xe796('0x48'),_0x4ecbdf['serverUrl'],_0x10442c[_0xe796('0x49')],md5(_0x10442c[_0xe796('0x49')]));}else{_0x10442c[_0xe796('0x47')]='';}headers[_0xe796('0x4a')]=getAuth(_0x4ecbdf);return getUser(_0x4ecbdf,'')['then'](function(_0x4054a6){_0x323fb3=_0x4054a6;logger[_0xe796('0x1b')]('The\x20User\x20ID\x20is:',_0x323fb3['id']);return getEndUser(_0x4ecbdf,_0x10442c[_0xe796('0x10')],_0x10442c[_0xe796('0x11')]);})[_0xe796('0x1e')](function(_0x145c69){_0x3cb4e9=_0x145c69;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3cb4e9['id']);return getTicket(_0x4ecbdf,_0x323fb3,_0x3cb4e9,_0x4f2721,_0x10442c);})['then'](function(_0x3e58fb){if(_0x3e58fb){logger['info'](_0xe796('0x4e'));logger[_0xe796('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x3e58fb['id']);}})['catch'](function(_0x3723f2){logger[_0xe796('0x54')]('['+_0x10442c[_0xe796('0x5c')][_0xe796('0x5d')]()+']',JSON[_0xe796('0x31')](_0x3723f2));});}; \ 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 1f62267..b4d94e2 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 _0x2b24=['destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','Admin\x20selected','userEmail','catch','GET','/api/lookup?q=','&f=','&entities=contact','then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound'];(function(_0x5393ea,_0x3526d9){var _0x58b30f=function(_0x35e871){while(--_0x35e871){_0x5393ea['push'](_0x5393ea['shift']());}};_0x58b30f(++_0x3526d9);}(_0x2b24,0x104));var _0x42b2=function(_0x2a119b,_0x5b7d64){_0x2a119b=_0x2a119b-0x0;var _0x493775=_0x2b24[_0x2a119b];return _0x493775;};'use strict';var _=require(_0x42b2('0x0'));var rp=require(_0x42b2('0x1'));var md5=require(_0x42b2('0x2'));var util=require(_0x42b2('0x3'));var moment=require(_0x42b2('0x4'));var Promise=require(_0x42b2('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x42b2('0x6'));var logger=require(_0x42b2('0x7'))(_0x42b2('0x8'));config['redis']=_['defaults'](config[_0x42b2('0x9')],{'host':_0x42b2('0xa'),'port':0x18eb});var io=require(_0x42b2('0xb'))(new Redis(config[_0x42b2('0x9')]));function getAdminId(_0x358480,_0x1ba4eb,_0x3e3abc,_0x4b8b2b){return new Promise(function(_0x3328fb,_0x45f0b9){var _0x48ff92=![];var _0x349eb6={'method':'GET','uri':_0x4b8b2b+_0x42b2('0xc'),'json':!![]};_0x349eb6[_0x42b2('0xd')]=_0x3e3abc;logger[_0x42b2('0xe')](_0x42b2('0xf'));return rp(_0x349eb6)['then'](function(_0x3fadfe){if(_0x3fadfe){var _0x4184e1=_0x3fadfe[_0x42b2('0x10')];var _0x25d651=null;for(_0x25d651=0x0;_0x25d651<_0x4184e1[_0x42b2('0x11')];_0x25d651++){if(_0x4184e1[_0x25d651][_0x42b2('0x12')]===_0x358480[_0x42b2('0x13')]){_0x358480['adminId']=_0x4184e1[_0x25d651]['id'];_0x48ff92=!![];}}if(_0x48ff92){logger[_0x42b2('0xe')]('Admin\x20found:',_0x358480[_0x42b2('0x14')]);_0x3328fb(_0x358480);}else{_0x45f0b9({'statusCode':0x194,'message':_0x42b2('0x15')});}}else{_0x45f0b9({'statusCode':0x194,'message':_0x42b2('0x15')});}})['catch'](function(_0x508b4c){logger[_0x42b2('0x16')]('['+[_0x1ba4eb[_0x42b2('0x17')]()]+']',_0x508b4c[_0x42b2('0x18')]);_0x45f0b9(_0x508b4c);});});}function getUser(_0x341294,_0x7e443b,_0x2fb1a9){return function(_0x57b1a4){return new Promise(function(_0x5af522,_0x31dcb1){var _0x48fd45={'method':'GET','uri':_0x2fb1a9+_0x42b2('0xc'),'json':!![]};_0x48fd45[_0x42b2('0xd')]=_0x7e443b;logger[_0x42b2('0xe')](_0x42b2('0x19'));return rp(_0x48fd45)['then'](function(_0x24060d){if(_0x24060d){var _0xd5ca29=_0x24060d['users'];var _0x20f58c=![];var _0x3ea4b6=null;if(_0x57b1a4['agentEmail']!==null){logger[_0x42b2('0xe')]('Getting\x20user\x20with\x20email',_0x57b1a4[_0x42b2('0x1a')]);_0x57b1a4['userEmail']=_0x57b1a4['agentEmail'];for(_0x3ea4b6=0x0;_0x3ea4b6<_0xd5ca29[_0x42b2('0x11')];_0x3ea4b6++){if(_0xd5ca29[_0x3ea4b6][_0x42b2('0x12')]===_0x57b1a4[_0x42b2('0x1a')]){_0x20f58c=!![];_0x57b1a4[_0x42b2('0x1b')]=_0xd5ca29[_0x3ea4b6]['id'];logger[_0x42b2('0xe')]('User\x20found:',_0x57b1a4[_0x42b2('0x1b')]);}}}if(!_0x20f58c){logger['info'](_0x42b2('0x1c'));_0x57b1a4[_0x42b2('0x1d')]=_0x57b1a4[_0x42b2('0x13')];_0x57b1a4[_0x42b2('0x1b')]=_0x57b1a4['adminId'];_0x20f58c=!![];}if(_0x20f58c){_0x5af522(_0x57b1a4);}else{_0x31dcb1({'statusCode':0x194,'message':_0x42b2('0x15')});}}else{_0x31dcb1({'statusCode':0x194,'message':_0x42b2('0x15')});}})[_0x42b2('0x1e')](function(_0x2df06b){logger[_0x42b2('0x16')]('['+[_0x341294[_0x42b2('0x17')]()]+']',_0x2df06b[_0x42b2('0x18')]);_0x31dcb1(_0x2df06b);});});};}function searchContact(_0x308c9c,_0x409598,_0x232606,_0x480026){return new Promise(function(_0xc3ba4,_0x399029){var _0xa35f34={'method':_0x42b2('0x1f'),'headers':_0x409598,'uri':_0x308c9c+_0x42b2('0x20')+_0x480026+_0x42b2('0x21')+_0x232606+_0x42b2('0x22'),'json':!![]};rp(_0xa35f34)[_0x42b2('0x23')](function(_0x53ae2f){var _0x48eaad=_[_0x42b2('0x24')](_0x53ae2f[_0x42b2('0x25')][_0x42b2('0x25')],[_0x232606,_0x480026]);_0xc3ba4(_0x48eaad);})['catch'](function(_0x148e1d){_0x399029(_0x148e1d);});});}function getEndUser(_0x5321e5,_0x50c226,_0x4fc2c3){return function(_0x4e3a84){return new Promise(function(_0x3223d1,_0x39c15e){logger[_0x42b2('0xe')](util[_0x42b2('0x26')](_0x42b2('0x27'),_0x4e3a84[_0x42b2('0x28')]));searchContact(_0x4fc2c3,_0x50c226,_0x42b2('0x29'),_0x4e3a84[_0x42b2('0x28')])[_0x42b2('0x23')](function(_0x5d691c){if(_0x5d691c){_0x4e3a84[_0x42b2('0x2a')]=_0x5d691c['id'];logger['info'](_0x42b2('0x2b'),_0x4e3a84[_0x42b2('0x2a')]);return _0x3223d1(_0x4e3a84);}searchContact(_0x4fc2c3,_0x50c226,'work_number',_0x4e3a84[_0x42b2('0x28')])[_0x42b2('0x23')](function(_0x1568ab){if(_0x1568ab){_0x4e3a84['endUserId']=_0x1568ab['id'];logger[_0x42b2('0xe')](_0x42b2('0x2c'),_0x4e3a84[_0x42b2('0x2a')]);return _0x3223d1(_0x4e3a84);}createEndUser(_0x4e3a84,_0x5321e5,_0x50c226,_0x4fc2c3)[_0x42b2('0x23')](function(_0x1e6725){logger[_0x42b2('0xe')](_0x42b2('0x2d'),_0x1e6725[_0x42b2('0x2a')]);return _0x3223d1(_0x1e6725);});});})[_0x42b2('0x1e')](function(_0x45bb10){_0x39c15e(_0x45bb10);});});};}function createEndUser(_0x10795e,_0x348d90,_0x5764b3,_0x5b38e1){return new Promise(function(_0x54bc36,_0x20bc96){var _0x3a2037=moment();var _0x4f6693={'method':_0x42b2('0x2e'),'uri':_0x5b38e1+'/api/contacts','body':{'contact':{'last_name':_0x10795e[_0x42b2('0x28')],'work_number':_0x10795e[_0x42b2('0x28')],'mobile_number':_0x10795e[_0x42b2('0x28')],'owner_id':_0x10795e['userId'],'created_at':_0x3a2037[_0x42b2('0x26')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4f6693[_0x42b2('0xd')]=_0x5764b3;logger[_0x42b2('0xe')](_0x42b2('0x2f'));return rp(_0x4f6693)[_0x42b2('0x23')](function(_0x37b153){_0x10795e[_0x42b2('0x2a')]=_0x37b153['contact']['id'];_0x54bc36(_0x10795e);})[_0x42b2('0x1e')](function(_0x5c9ad1){logger[_0x42b2('0x16')]('['+[_0x348d90[_0x42b2('0x17')]()]+']',_0x5c9ad1[_0x42b2('0x18')]);_0x20bc96(_0x5c9ad1['message']);});});}function getTicket(_0x346728,_0x3b8c4b,_0x55c49c,_0x5f021d,_0x229bb7){return function(_0x254506){logger[_0x42b2('0xe')](_0x42b2('0x30'));return new Promise(function(_0x3e168c,_0x5b553c){var _0x84fc88=moment();var _0x39936a={'method':_0x42b2('0x2e'),'uri':_0x55c49c+_0x42b2('0x31'),'body':{'title':intUtil[_0x42b2('0x32')](_0x5f021d[_0x42b2('0x33')],_0x229bb7,'\x20'),'description':intUtil[_0x42b2('0x32')](_0x5f021d['Descriptions'],_0x229bb7,'\x0a'),'owner_id':_0x254506['userId'],'creater_id':_0x254506[_0x42b2('0x14')],'targetable_id':_0x254506[_0x42b2('0x2a')],'targetable_type':_0x42b2('0x34'),'created_at':_0x84fc88[_0x42b2('0x26')](_0x42b2('0x35')),'due_date':_0x84fc88['add'](0x1e,'m')[_0x42b2('0x26')](_0x42b2('0x35'))},'json':!![]};_0x39936a[_0x42b2('0xd')]=_0x3b8c4b;return rp(_0x39936a)[_0x42b2('0x23')](function(_0x379434){_0x254506[_0x42b2('0x36')]=_0x379434[_0x42b2('0x37')]['id'];logger[_0x42b2('0xe')](_0x42b2('0x38'),_0x254506[_0x42b2('0x36')]);_0x3e168c(_0x254506);})[_0x42b2('0x1e')](function(_0x2172ce){logger[_0x42b2('0x16')]('['+[_0x346728[_0x42b2('0x17')]()]+']',_0x2172ce['message']);_0x5b553c(_0x2172ce['message']);});});};}function emit(_0x545b9d,_0x5b1bcc,_0x1de258){var _0x44c0b3={'uri':_0x545b9d+_0x42b2('0x39')+_0x1de258};io['to'](util[_0x42b2('0x26')](_0x42b2('0x3a'),_0x5b1bcc))[_0x42b2('0x3b')](_0x42b2('0x3c'),_0x44c0b3);}exports['cs']=function(_0x398a70,_0x157b3e,_0x3812e8,_0x1c6251,_0x1c3851,_0x1970c0,_0x3fd04d,_0x4274e1){var _0x11a62a={};var _0x5bfeb9={'Authorization':_0x42b2('0x3d')+_0x1970c0['apiKey']};_0x1970c0['remoteUri']=intUtil[_0x42b2('0x3e')](_0x1970c0[_0x42b2('0x3f')]);_0x1970c0[_0x42b2('0x40')]=intUtil[_0x42b2('0x3e')](_0x1970c0[_0x42b2('0x40')]);var _0x47567d=_0x1970c0[_0x42b2('0x3f')];_0x11a62a[_0x42b2('0x13')]=_0x1970c0[_0x42b2('0x41')];_0x11a62a['contactNumber']=_0x4274e1[_0x42b2('0x42')]()===_0x42b2('0x43')?_0x157b3e[_0x42b2('0x44')]:_0x157b3e[_0x42b2('0x45')];_0x11a62a[_0x42b2('0x46')]=_0x4274e1===_0x42b2('0x47')||_0x4274e1===_0x42b2('0x48')?_0x42b2('0x47'):'outbound';if(_0x1c6251){_0x11a62a['agentEmail']=_0x1c6251[_0x42b2('0x12')];}var _0x20d5a0=util[_0x42b2('0x26')](_0x42b2('0x49'),_0x1970c0[_0x42b2('0x40')],_0x157b3e['uniqueid'],md5(_0x157b3e['uniqueid']));if(_0x1c3851&&_0x1c3851[_0x42b2('0x4a')]){logger[_0x42b2('0xe')]('[QUEUE]',_0x42b2('0x4b'));_0x157b3e[_0x42b2('0x4c')]=_0x20d5a0;}else if(_0x3fd04d&&_0x3fd04d[_0x42b2('0x4d')]&&_0x3fd04d['recordingFormat']!==_0x42b2('0x4e')){logger[_0x42b2('0xe')](_0x42b2('0x4f'),'Recording\x20is\x20enabled!');_0x157b3e[_0x42b2('0x4c')]=_0x20d5a0;}else{_0x157b3e[_0x42b2('0x4c')]='';}return getAdminId(_0x11a62a,_0x4274e1,_0x5bfeb9,_0x47567d)[_0x42b2('0x23')](getUser(_0x4274e1,_0x5bfeb9,_0x47567d))[_0x42b2('0x23')](getEndUser(_0x4274e1,_0x5bfeb9,_0x47567d))[_0x42b2('0x23')](getTicket(_0x4274e1,_0x5bfeb9,_0x47567d,_0x3812e8,_0x157b3e))['then'](function(_0x5291f1){logger[_0x42b2('0xe')](util[_0x42b2('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5291f1[_0x42b2('0x36')]));if(_0x4274e1!==_0x42b2('0x48')){logger[_0x42b2('0xe')]('['+[_0x4274e1[_0x42b2('0x17')]()]+']',_0x42b2('0x50'));emit(_0x47567d,_0x1c6251['name'],_0x5291f1['endUserId']);}})[_0x42b2('0x1e')](function(_0x145dcc){logger['error']('['+[_0x4274e1[_0x42b2('0x17')]()]+_0x42b2('0x51'),util['inspect'](_0x145dcc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa71c=['trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','length','email','adminId','info','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','then','users','agentEmail','userEmail','Admin\x20selected','adminEmail','error','toUpperCase','GET','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','userId','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','/contacts/','user:%s','emit'];(function(_0x34ce26,_0x16daab){var _0x11a16c=function(_0x15a995){while(--_0x15a995){_0x34ce26['push'](_0x34ce26['shift']());}};_0x11a16c(++_0x16daab);}(_0xa71c,0x65));var _0xca71=function(_0x3c634,_0x4f1511){_0x3c634=_0x3c634-0x0;var _0x42d233=_0xa71c[_0x3c634];return _0x42d233;};'use strict';var _=require(_0xca71('0x0'));var rp=require('request-promise');var md5=require(_0xca71('0x1'));var util=require('util');var moment=require(_0xca71('0x2'));var Promise=require(_0xca71('0x3'));var Redis=require(_0xca71('0x4'));var intUtil=require('./util');var config=require(_0xca71('0x5'));var logger=require(_0xca71('0x6'))(_0xca71('0x7'));config[_0xca71('0x8')]=_['defaults'](config[_0xca71('0x8')],{'host':_0xca71('0x9'),'port':0x18eb});var io=require(_0xca71('0xa'))(new Redis(config[_0xca71('0x8')]));function getAdminId(_0x51a28d,_0x4eefce,_0x2f6c39,_0x3c3aec){return new Promise(function(_0x400aa2,_0xb91dc9){var _0x5bee3f=![];var _0x47f9c7={'method':'GET','uri':_0x3c3aec+_0xca71('0xb'),'json':!![]};_0x47f9c7[_0xca71('0xc')]=_0x2f6c39;logger['info'](_0xca71('0xd'));return rp(_0x47f9c7)['then'](function(_0x59d967){if(_0x59d967){var _0x552829=_0x59d967['users'];var _0x54406c=null;for(_0x54406c=0x0;_0x54406c<_0x552829[_0xca71('0xe')];_0x54406c++){if(_0x552829[_0x54406c][_0xca71('0xf')]===_0x51a28d['adminEmail']){_0x51a28d[_0xca71('0x10')]=_0x552829[_0x54406c]['id'];_0x5bee3f=!![];}}if(_0x5bee3f){logger[_0xca71('0x11')]('Admin\x20found:',_0x51a28d['adminId']);_0x400aa2(_0x51a28d);}else{_0xb91dc9({'statusCode':0x194,'message':_0xca71('0x12')});}}else{_0xb91dc9({'statusCode':0x194,'message':_0xca71('0x12')});}})[_0xca71('0x13')](function(_0xb64efa){logger['error']('['+[_0x4eefce['toUpperCase']()]+']',_0xb64efa[_0xca71('0x14')]);_0xb91dc9(_0xb64efa);});});}function getUser(_0x40a43c,_0xeeefd7,_0x1919a2){return function(_0x7641bc){return new Promise(function(_0x34737e,_0x109c00){var _0x5d3c21={'method':'GET','uri':_0x1919a2+_0xca71('0xb'),'json':!![]};_0x5d3c21[_0xca71('0xc')]=_0xeeefd7;logger[_0xca71('0x11')](_0xca71('0x15'));return rp(_0x5d3c21)[_0xca71('0x16')](function(_0x195f51){if(_0x195f51){var _0x168552=_0x195f51[_0xca71('0x17')];var _0x1564be=![];var _0x4fc97f=null;if(_0x7641bc[_0xca71('0x18')]!==null){logger[_0xca71('0x11')]('Getting\x20user\x20with\x20email',_0x7641bc[_0xca71('0x18')]);_0x7641bc[_0xca71('0x19')]=_0x7641bc[_0xca71('0x18')];for(_0x4fc97f=0x0;_0x4fc97f<_0x168552[_0xca71('0xe')];_0x4fc97f++){if(_0x168552[_0x4fc97f][_0xca71('0xf')]===_0x7641bc[_0xca71('0x18')]){_0x1564be=!![];_0x7641bc['userId']=_0x168552[_0x4fc97f]['id'];logger[_0xca71('0x11')]('User\x20found:',_0x7641bc['userId']);}}}if(!_0x1564be){logger[_0xca71('0x11')](_0xca71('0x1a'));_0x7641bc[_0xca71('0x19')]=_0x7641bc[_0xca71('0x1b')];_0x7641bc['userId']=_0x7641bc['adminId'];_0x1564be=!![];}if(_0x1564be){_0x34737e(_0x7641bc);}else{_0x109c00({'statusCode':0x194,'message':_0xca71('0x12')});}}else{_0x109c00({'statusCode':0x194,'message':_0xca71('0x12')});}})[_0xca71('0x13')](function(_0x4ea405){logger[_0xca71('0x1c')]('['+[_0x40a43c[_0xca71('0x1d')]()]+']',_0x4ea405['message']);_0x109c00(_0x4ea405);});});};}function searchContact(_0x349f81,_0x38f966,_0x3b8493,_0x38dd43){return new Promise(function(_0xb9056d,_0x4a14f6){var _0x5d7070={'method':_0xca71('0x1e'),'headers':_0x38f966,'uri':_0x349f81+'/api/lookup?q='+_0x38dd43+_0xca71('0x1f')+_0x3b8493+_0xca71('0x20'),'json':!![]};rp(_0x5d7070)[_0xca71('0x16')](function(_0x95c99c){var _0x5bbef8=_['find'](_0x95c99c['contacts'][_0xca71('0x21')],[_0x3b8493,_0x38dd43]);_0xb9056d(_0x5bbef8);})[_0xca71('0x13')](function(_0x6de971){_0x4a14f6(_0x6de971);});});}function getEndUser(_0x554566,_0x357c88,_0x268972){return function(_0x143717){return new Promise(function(_0x2b6cfb,_0x7dde49){logger['info'](util[_0xca71('0x22')](_0xca71('0x23'),_0x143717[_0xca71('0x24')]));searchContact(_0x268972,_0x357c88,_0xca71('0x25'),_0x143717[_0xca71('0x24')])[_0xca71('0x16')](function(_0x4417bf){if(_0x4417bf){_0x143717[_0xca71('0x26')]=_0x4417bf['id'];logger[_0xca71('0x11')](_0xca71('0x27'),_0x143717[_0xca71('0x26')]);return _0x2b6cfb(_0x143717);}searchContact(_0x268972,_0x357c88,_0xca71('0x28'),_0x143717[_0xca71('0x24')])[_0xca71('0x16')](function(_0x45fd2d){if(_0x45fd2d){_0x143717[_0xca71('0x26')]=_0x45fd2d['id'];logger[_0xca71('0x11')](_0xca71('0x29'),_0x143717[_0xca71('0x26')]);return _0x2b6cfb(_0x143717);}createEndUser(_0x143717,_0x554566,_0x357c88,_0x268972)['then'](function(_0x2241e0){logger['info'](_0xca71('0x2a'),_0x2241e0['endUserId']);return _0x2b6cfb(_0x2241e0);});});})[_0xca71('0x13')](function(_0x4fe124){_0x7dde49(_0x4fe124);});});};}function createEndUser(_0x496d31,_0x45dc15,_0x58de43,_0x2a9f71){return new Promise(function(_0x51f326,_0x5125d2){var _0x267ec2=moment();var _0x55c69d={'method':'POST','uri':_0x2a9f71+_0xca71('0x2b'),'body':{'contact':{'last_name':_0x496d31['contactNumber'],'work_number':_0x496d31[_0xca71('0x24')],'mobile_number':_0x496d31[_0xca71('0x24')],'owner_id':_0x496d31[_0xca71('0x2c')],'created_at':_0x267ec2[_0xca71('0x22')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x55c69d[_0xca71('0xc')]=_0x58de43;logger[_0xca71('0x11')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x55c69d)[_0xca71('0x16')](function(_0x37c0d8){_0x496d31[_0xca71('0x26')]=_0x37c0d8[_0xca71('0x2d')]['id'];_0x51f326(_0x496d31);})[_0xca71('0x13')](function(_0x54b5dd){logger[_0xca71('0x1c')]('['+[_0x45dc15[_0xca71('0x1d')]()]+']',_0x54b5dd[_0xca71('0x14')]);_0x5125d2(_0x54b5dd[_0xca71('0x14')]);});});}function getTicket(_0x3d6814,_0x5b93ee,_0x38125f,_0x1c81d1,_0x19bf92){return function(_0x18edd){logger[_0xca71('0x11')](_0xca71('0x2e'));return new Promise(function(_0x141f6d,_0x2ab5ff){var _0x510d30=moment();var _0x188caa={'method':'POST','uri':_0x38125f+_0xca71('0x2f'),'body':{'title':intUtil[_0xca71('0x30')](_0x1c81d1[_0xca71('0x31')],_0x19bf92,'\x20'),'description':intUtil['getString'](_0x1c81d1[_0xca71('0x32')],_0x19bf92,'\x0a'),'owner_id':_0x18edd[_0xca71('0x2c')],'creater_id':_0x18edd[_0xca71('0x10')],'targetable_id':_0x18edd[_0xca71('0x26')],'targetable_type':_0xca71('0x33'),'created_at':_0x510d30[_0xca71('0x22')](_0xca71('0x34')),'due_date':_0x510d30[_0xca71('0x35')](0x1e,'m')[_0xca71('0x22')](_0xca71('0x34'))},'json':!![]};_0x188caa['headers']=_0x5b93ee;return rp(_0x188caa)[_0xca71('0x16')](function(_0x8e1f3e){_0x18edd[_0xca71('0x36')]=_0x8e1f3e[_0xca71('0x37')]['id'];logger[_0xca71('0x11')]('Task\x20created:',_0x18edd[_0xca71('0x36')]);_0x141f6d(_0x18edd);})[_0xca71('0x13')](function(_0x4b509d){logger[_0xca71('0x1c')]('['+[_0x3d6814[_0xca71('0x1d')]()]+']',_0x4b509d[_0xca71('0x14')]);_0x2ab5ff(_0x4b509d[_0xca71('0x14')]);});});};}function emit(_0x3617cb,_0x3b6f25,_0x3946a2){var _0x5ee07e={'uri':_0x3617cb+_0xca71('0x38')+_0x3946a2};io['to'](util['format'](_0xca71('0x39'),_0x3b6f25))[_0xca71('0x3a')](_0xca71('0x3b'),_0x5ee07e);}exports['cs']=function(_0x4392b5,_0x58f6c3,_0x351822,_0x2f8f40,_0x2ce50b,_0x37a44b,_0x231819,_0x1450df){var _0x47dd5a={};var _0x20e589={'Authorization':_0xca71('0x3c')+_0x37a44b['apiKey']};_0x37a44b[_0xca71('0x3d')]=intUtil[_0xca71('0x3e')](_0x37a44b[_0xca71('0x3d')]);_0x37a44b[_0xca71('0x3f')]=intUtil[_0xca71('0x3e')](_0x37a44b[_0xca71('0x3f')]);var _0x353215=_0x37a44b[_0xca71('0x3d')];_0x47dd5a[_0xca71('0x1b')]=_0x37a44b['username'];_0x47dd5a['contactNumber']=_0x1450df['toLowerCase']()===_0xca71('0x40')?_0x58f6c3[_0xca71('0x41')]:_0x58f6c3['calleridnum'];_0x47dd5a[_0xca71('0x42')]=_0x1450df===_0xca71('0x43')||_0x1450df==='unmanaged'?_0xca71('0x43'):_0xca71('0x40');if(_0x2f8f40){_0x47dd5a[_0xca71('0x18')]=_0x2f8f40[_0xca71('0xf')];}var _0x489f28=util[_0xca71('0x22')](_0xca71('0x44'),_0x37a44b[_0xca71('0x3f')],_0x58f6c3[_0xca71('0x45')],md5(_0x58f6c3[_0xca71('0x45')]));if(_0x2ce50b&&_0x2ce50b[_0xca71('0x46')]){logger[_0xca71('0x11')](_0xca71('0x47'),'Recording\x20is\x20enabled!');_0x58f6c3['recordingURL']=_0x489f28;}else if(_0x231819&&_0x231819[_0xca71('0x48')]&&_0x231819[_0xca71('0x48')]!=='none'){logger[_0xca71('0x11')]('[OUTBOUND]',_0xca71('0x49'));_0x58f6c3[_0xca71('0x4a')]=_0x489f28;}else{_0x58f6c3[_0xca71('0x4a')]='';}return getAdminId(_0x47dd5a,_0x1450df,_0x20e589,_0x353215)[_0xca71('0x16')](getUser(_0x1450df,_0x20e589,_0x353215))[_0xca71('0x16')](getEndUser(_0x1450df,_0x20e589,_0x353215))[_0xca71('0x16')](getTicket(_0x1450df,_0x20e589,_0x353215,_0x351822,_0x58f6c3))[_0xca71('0x16')](function(_0x1b31b2){logger['info'](util[_0xca71('0x22')](_0xca71('0x4b'),_0x1b31b2['ticketId']));if(_0x1450df!==_0xca71('0x4c')){logger[_0xca71('0x11')]('['+[_0x1450df['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x353215,_0x2f8f40[_0xca71('0x4d')],_0x1b31b2['endUserId']);}})[_0xca71('0x13')](function(_0x2d5764){logger[_0xca71('0x1c')]('['+[_0x1450df[_0xca71('0x1d')]()]+_0xca71('0x4e'),util[_0xca71('0x4f')](_0x2d5764,{'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 b87b1cf..8b04aac 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 _0xfdc4=['outbound','log','unmanaged','sugarcrm','zoho','vtiger','dynamics365','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','desk','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','routeId'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xfdc4,0x1a4));var _0x4fdc=function(_0x19707c,_0x578fa7){_0x19707c=_0x19707c-0x0;var _0x4bad4c=_0xfdc4[_0x19707c];return _0x4bad4c;};'use strict';var _=require(_0x4fdc('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x4fdc('0x1'));var sugarcrm=require(_0x4fdc('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x4fdc('0x3'));var desk=require(_0x4fdc('0x4'));var vtiger=require(_0x4fdc('0x5'));var servicenow=require(_0x4fdc('0x6'));var dynamics365=require(_0x4fdc('0x7'));var freshsales=require(_0x4fdc('0x8'));var integrations=[_0x4fdc('0x9'),_0x4fdc('0xa'),'sugarcrm',_0x4fdc('0xb'),'zoho',_0x4fdc('0xc'),'vtiger','dynamics365',_0x4fdc('0xd'),_0x4fdc('0xe')];exports[_0x4fdc('0xf')]=function(_0x129394,_0x14100d,_0x26de85,_0x548e21,_0x7e2ad9,_0x303e4e){if(_0x26de85){if(_[_0x4fdc('0x10')](integrations,_0x129394['data1']['toLowerCase']())){try{var _0x4d5ab4=null;var _0x3a7502='';var _0x29e0c8=_0x26de85[_0x129394[_0x4fdc('0x11')][_0x4fdc('0x12')]()];if(_0x29e0c8){var _0x596fd6=_0x29e0c8[_0x129394[_0x4fdc('0x13')]];if(_0x596fd6){var _0x63c22e=_[_0x4fdc('0x14')](_0x596fd6[_0x4fdc('0x15')],{'id':parseInt(_0x129394[_0x4fdc('0x16')],0xa)});if(_0x63c22e){if(_0x548e21){if(_0x7e2ad9&&_0x14100d['queue']){_0x3a7502='queue';}else if(_0x14100d[_0x4fdc('0x17')]){_0x3a7502=_0x4fdc('0x18');}else{console[_0x4fdc('0x19')]('EVENT\x20UNKNOWN',_0x14100d);}}else{_0x3a7502=_0x4fdc('0x1a');}switch(_0x129394[_0x4fdc('0x11')]['toLowerCase']()){case _0x4fdc('0x9'):zendesk[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case'salesforce':salesforce[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0x1b'):sugarcrm[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case'freshdesk':freshdesk[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0x1c'):zoho[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0xc'):desk[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0x1d'):vtiger[_0x3a7502](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e);break;case _0x4fdc('0xd'):freshsales['cs'](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e,_0x3a7502);break;case _0x4fdc('0xe'):servicenow['cs'](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e,_0x3a7502);break;case _0x4fdc('0x1e'):dynamics365['cs'](_0x129394,_0x14100d,_0x63c22e,_0x548e21,_0x7e2ad9,_0x596fd6,_0x303e4e,_0x3a7502);break;default:console[_0x4fdc('0x19')](_0x4fdc('0x1f'));}}else{_0x4d5ab4=require('../../../../config/logger')(_0x129394['data1'][_0x4fdc('0x12')]());_0x4d5ab4[_0x4fdc('0x20')](_0x4fdc('0x21'),util[_0x4fdc('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x129394[_0x4fdc('0x11')][_0x4fdc('0x12')](),_0x129394[_0x4fdc('0x16')]));}}else{_0x4d5ab4=require(_0x4fdc('0x23'))(_0x129394[_0x4fdc('0x11')][_0x4fdc('0x12')]());_0x4d5ab4[_0x4fdc('0x20')]('[EXEC]',util['format'](_0x4fdc('0x24'),_0x129394['data1'][_0x4fdc('0x12')](),_0x129394['data2']));}}else{}}catch(_0x4824da){console[_0x4fdc('0x20')](_0x4824da);}}}}; \ No newline at end of file +var _0x27c5=['vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./zoho','./vtiger','./dynamics365','zendesk','salesforce','freshdesk','zoho','desk'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x27c5,0x1f2));var _0x527c=function(_0x82158f,_0x4e103e){_0x82158f=_0x82158f-0x0;var _0x5f475f=_0x27c5[_0x82158f];return _0x5f475f;};'use strict';var _=require(_0x527c('0x0'));var util=require(_0x527c('0x1'));var zendesk=require(_0x527c('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x527c('0x3'));var zoho=require(_0x527c('0x4'));var desk=require('./desk');var vtiger=require(_0x527c('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x527c('0x6'));var freshsales=require('./freshsales');var integrations=[_0x527c('0x7'),_0x527c('0x8'),'sugarcrm',_0x527c('0x9'),_0x527c('0xa'),_0x527c('0xb'),_0x527c('0xc'),_0x527c('0xd'),_0x527c('0xe'),_0x527c('0xf')];exports[_0x527c('0x10')]=function(_0x94143f,_0x38ee84,_0x252b80,_0x3acc74,_0x227362,_0x5d4e8d){if(_0x252b80){if(_[_0x527c('0x11')](integrations,_0x94143f[_0x527c('0x12')][_0x527c('0x13')]())){try{var _0x545096=null;var _0x3d28c1='';var _0x188889=_0x252b80[_0x94143f[_0x527c('0x12')][_0x527c('0x13')]()];if(_0x188889){var _0x12f5b4=_0x188889[_0x94143f[_0x527c('0x14')]];if(_0x12f5b4){var _0x5b4e5d=_[_0x527c('0x15')](_0x12f5b4[_0x527c('0x16')],{'id':parseInt(_0x94143f[_0x527c('0x17')],0xa)});if(_0x5b4e5d){if(_0x3acc74){if(_0x227362&&_0x38ee84[_0x527c('0x18')]){_0x3d28c1=_0x527c('0x18');}else if(_0x38ee84[_0x527c('0x19')]){_0x3d28c1=_0x527c('0x1a');}else{console[_0x527c('0x1b')]('EVENT\x20UNKNOWN',_0x38ee84);}}else{_0x3d28c1='unmanaged';}switch(_0x94143f[_0x527c('0x12')][_0x527c('0x13')]()){case _0x527c('0x7'):zendesk[_0x3d28c1](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d);break;case _0x527c('0x8'):salesforce[_0x3d28c1](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d);break;case'sugarcrm':sugarcrm[_0x3d28c1](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d);break;case _0x527c('0x9'):freshdesk[_0x3d28c1](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d);break;case _0x527c('0xa'):zoho[_0x3d28c1](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d);break;case'desk':desk[_0x3d28c1](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d);break;case _0x527c('0xc'):vtiger[_0x3d28c1](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d);break;case _0x527c('0xe'):freshsales['cs'](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d,_0x3d28c1);break;case'servicenow':servicenow['cs'](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d,_0x3d28c1);break;case _0x527c('0xd'):dynamics365['cs'](_0x94143f,_0x38ee84,_0x5b4e5d,_0x3acc74,_0x227362,_0x12f5b4,_0x5d4e8d,_0x3d28c1);break;default:console[_0x527c('0x1b')](_0x527c('0x1c'));}}else{_0x545096=require('../../../../config/logger')(_0x94143f[_0x527c('0x12')]['toLowerCase']());_0x545096[_0x527c('0x1d')](_0x527c('0x1e'),util[_0x527c('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x94143f[_0x527c('0x12')][_0x527c('0x13')](),_0x94143f[_0x527c('0x17')]));}}else{_0x545096=require(_0x527c('0x20'))(_0x94143f[_0x527c('0x12')][_0x527c('0x13')]());_0x545096['error'](_0x527c('0x1e'),util['format'](_0x527c('0x21'),_0x94143f['data1'][_0x527c('0x13')](),_0x94143f[_0x527c('0x14')]));}}else{}}catch(_0x22d129){console[_0x527c('0x1d')](_0x22d129);}}}}; \ 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 fe6976a..0e392c1 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 _0xb249=['error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','contact','endUserType','lead','WhoId','account','Case','ContactId','leadId','info','sobject','create','validateEmail','User','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','includes','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb249,0x178));var _0x9b24=function(_0x9d074f,_0x88a810){_0x9d074f=_0x9d074f-0x0;var _0x453398=_0xb249[_0x9d074f];return _0x453398;};'use strict';var _=require(_0x9b24('0x0'));var rp=require('request-promise');var moment=require(_0x9b24('0x1'));var BPromise=require(_0x9b24('0x2'));var md5=require(_0x9b24('0x3'));var jsforce=require('jsforce');var util=require(_0x9b24('0x4'));var Redis=require('ioredis');var intUtil=require(_0x9b24('0x5'));var config=require(_0x9b24('0x6'));var logger=require(_0x9b24('0x7'))('salesforce');config['redis']=_['defaults'](config[_0x9b24('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9b24('0x9'))(new Redis(config[_0x9b24('0x8')]));function emit(_0xe1bcd8,_0x4ab35c,_0x5a5d38){io['to'](_0xe1bcd8)['emit'](_0x4ab35c,_0x5a5d38);}function getTicket(_0x28e592,_0x32774c,_0x4c0673,_0xa54749,_0x2fdef0,_0x5e76e1,_0x4cf2ef,_0x290c0e){var _0x5167f4=Object['assign']({},{'OwnerId':_0x32774c['id'],'Subject':intUtil['getString'](_0xa54749['Subjects'],_0x2fdef0,'\x20'),'Description':intUtil['getString'](_0xa54749[_0x9b24('0xa')],_0x2fdef0,'\x0a')},getCustomFields(_0x5e76e1,_0x2fdef0));if(_0x4c0673){if(_0xa54749[_0x9b24('0xb')]===_0x9b24('0xc')){_0x5167f4[_0x9b24('0xd')]=moment['utc']();_0x5167f4[_0x9b24('0xe')]=![];_0x5167f4['IsRecurrence']=![];if(_0x4c0673['endUserType']===_0x9b24('0xf')||_0x4c0673[_0x9b24('0x10')]===_0x9b24('0x11')){_0x5167f4[_0x9b24('0x12')]=_0x4c0673['id'];}else if(_0x4c0673['endUserType']===_0x9b24('0x13')){_0x5167f4['WhatId']=_0x4c0673['id'];}}else if(_0xa54749[_0x9b24('0xb')]===_0x9b24('0x14')){if(_0x4c0673[_0x9b24('0x10')]===_0x9b24('0xf')){_0x5167f4[_0x9b24('0x15')]=_0x4c0673['id'];}else if(_0x4c0673['endUserType']===_0x9b24('0x13')){_0x5167f4['AccountId']=_0x4c0673['id'];}else if(_0x4c0673['endUserType']===_0x9b24('0x11')&&_0xa54749['leadId']){_0x5167f4[_0xa54749[_0x9b24('0x16')]]=_0x4c0673['id'];}else{logger[_0x9b24('0x17')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4cf2ef[_0x9b24('0x18')](_0xa54749[_0x9b24('0xb')])[_0x9b24('0x19')](_0x5167f4);}function getUser(_0xb5d446,_0x1b3c59,_0x2440d3){if(!_['isNil'](_0x1b3c59)&&intUtil[_0x9b24('0x1a')](_0x1b3c59)){var _0x67b594={'Email':_0x1b3c59};var _0x5463af={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2440d3[_0x9b24('0x18')](_0x9b24('0x1b'))[_0x9b24('0x1c')](_0x67b594,_0x5463af)[_0x9b24('0x1d')]()[_0x9b24('0x1e')](function(_0x505392){if(_0x505392[_0x9b24('0x1f')]){var _0x507d11=_['find'](_0x505392,function(_0x2bf830){return _0x2bf830[_0x9b24('0x20')]===_0x1b3c59;});if(_0x507d11){logger[_0x9b24('0x17')]('Agent\x20%s\x20found.',_0x1b3c59);return BPromise[_0x9b24('0x21')]({'id':_0x507d11['Id'],'name':_0x507d11[_0x9b24('0x22')]});}}else{logger['info'](_0x9b24('0x23'),_0x1b3c59);return _0x2440d3[_0x9b24('0x24')]()[_0x9b24('0x1e')](function(_0x5548a2){return BPromise[_0x9b24('0x21')]({'id':_0x5548a2[_0x9b24('0x25')],'name':_0x5548a2[_0x9b24('0x26')]});});}});}else{logger[_0x9b24('0x17')](_0x9b24('0x23'),_0x1b3c59);return _0x2440d3[_0x9b24('0x24')]()[_0x9b24('0x1e')](function(_0x5e196e){return BPromise['resolve']({'id':_0x5e196e[_0x9b24('0x25')],'name':_0x5e196e[_0x9b24('0x26')]});});}}function getEndUser(_0x34f827,_0xe44fd6,_0x22bf95,_0x258da4,_0x214791){var _0x15a87d={'$or':{'Phone':_0x258da4}};var _0x963a3e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x9b24('0x17')](_0x9b24('0x27'),_0x258da4,_0xe44fd6[_0x9b24('0x28')]);switch(_0xe44fd6[_0x9b24('0x28')]){case _0x9b24('0x29'):var _0x2b90e7=_['cloneDeep'](_0x15a87d);if(_0xe44fd6['additionalSearchContact']){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x2a')]]=_0x258da4;_[_0x9b24('0x2b')](_0x2b90e7['$or'],_0x4f6e52);}return _0x214791['sobject'](_0x9b24('0x2c'))[_0x9b24('0x1c')](_0x2b90e7,_0x963a3e)[_0x9b24('0x1d')]()[_0x9b24('0x1e')](function(_0x5632b0){if(_0x5632b0&&_0x5632b0[_0x9b24('0x1f')]){return _0x5632b0;}else{var _0x78dfe3=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x2e')]){var _0xc85461={};_0xc85461[_0xe44fd6[_0x9b24('0x2e')]]=_0x258da4;_[_0x9b24('0x2b')](_0x78dfe3[_0x9b24('0x2f')],_0xc85461);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x30'))[_0x9b24('0x1c')](_0x78dfe3,_0x963a3e);}});case _0x9b24('0x31'):var _0x240d02=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x32')]){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x32')]]=_0x258da4;_[_0x9b24('0x2b')](_0x240d02[_0x9b24('0x2f')],_0x4f6e52);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x33'))['find'](_0x240d02,_0x963a3e)['execute']()[_0x9b24('0x1e')](function(_0xbb3f94){if(_0xbb3f94&&_0xbb3f94[_0x9b24('0x1f')]){return _0xbb3f94;}else{var _0x4016d2=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x2a')]){var _0x26b61b={};_0x26b61b[_0xe44fd6[_0x9b24('0x2a')]]=_0x258da4;_[_0x9b24('0x2b')](_0x4016d2['$or'],_0x26b61b);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x2c'))[_0x9b24('0x1c')](_0x4016d2,_0x963a3e)[_0x9b24('0x1e')](function(_0x5c620b){if(_0x5c620b&&_0x5c620b['length']){return _0x5c620b;}else{var _0x206dda=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x2e')]){var _0x2c7e3f={};_0x2c7e3f[_0xe44fd6[_0x9b24('0x2e')]]=_0x258da4;_[_0x9b24('0x2b')](_0x206dda[_0x9b24('0x2f')],_0x2c7e3f);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x30'))[_0x9b24('0x1c')](_0x206dda,_0x963a3e);}});}});case _0x9b24('0xf'):var _0x2b90e7=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6['additionalSearchContact']){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x2a')]]=_0x258da4;_[_0x9b24('0x2b')](_0x2b90e7[_0x9b24('0x2f')],_0x4f6e52);}return _0x214791[_0x9b24('0x18')]('Contact')['find'](_0x2b90e7,_0x963a3e)[_0x9b24('0x1d')]();case'lead':var _0x4642e4=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x2e')]){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x2e')]]=_0x258da4;_[_0x9b24('0x2b')](_0x4642e4[_0x9b24('0x2f')],_0x4f6e52);}return _0x214791['sobject'](_0x9b24('0x30'))[_0x9b24('0x1c')](_0x4642e4,_0x963a3e);case'account':var _0x240d02=_[_0x9b24('0x2d')](_0x15a87d);if(_0xe44fd6[_0x9b24('0x32')]){var _0x4f6e52={};_0x4f6e52[_0xe44fd6[_0x9b24('0x32')]]=_0x258da4;_[_0x9b24('0x2b')](_0x240d02[_0x9b24('0x2f')],_0x4f6e52);}return _0x214791[_0x9b24('0x18')](_0x9b24('0x33'))[_0x9b24('0x1c')](_0x240d02,_0x963a3e);default:return null;}})['then'](function(_0xddbb14){if(_0xddbb14&&_0xddbb14[_0x9b24('0x1f')]){var _0x1bd942=_[_0x9b24('0x34')](_0xddbb14);if(_0x1bd942){return BPromise['resolve']({'id':_0x1bd942['Id'],'name':_0x1bd942[_0x9b24('0x22')],'phone':_0x1bd942['Phone'],'endUserType':_0x1bd942[_0x9b24('0x35')][_0x9b24('0x36')]['toLowerCase']()});}}})[_0x9b24('0x1e')](function(_0xe4f596){if(_0xe4f596){logger[_0x9b24('0x17')](_0x9b24('0x37'),_0xe4f596[_0x9b24('0x10')],_0x258da4);return BPromise[_0x9b24('0x21')](_0xe4f596);}else{logger[_0x9b24('0x17')](_0x9b24('0x38'),_0x258da4);var _0xe22ffc={'Phone':_0x258da4};if(_0xe44fd6[_0x9b24('0x39')]){if(_0xe44fd6[_0x9b24('0x39')]===_0x9b24('0xf')){logger['info'](_0x9b24('0x3a'),_0x258da4,_0xe44fd6[_0x9b24('0x39')]);_0xe22ffc['LastName']=_0x22bf95!==''?_0x22bf95:util[_0x9b24('0x3b')](_0x9b24('0x3c'),_0x258da4);}else if(_0xe44fd6[_0x9b24('0x39')]===_0x9b24('0x11')){logger['info'](_0x9b24('0x3a'),_0x258da4,_0xe44fd6[_0x9b24('0x39')]);_0xe22ffc['LastName']=_0x22bf95!==_0x9b24('0x3d')?_0x22bf95:util[_0x9b24('0x3b')]('Caller\x20-\x20%s',_0x258da4);_0xe22ffc[_0x9b24('0x3e')]=_0x9b24('0x3f');}else if(_0xe44fd6['moduleCreate']===_0x9b24('0x13')){logger[_0x9b24('0x17')](_0x9b24('0x3a'),_0x258da4,_0xe44fd6['moduleCreate']);_0xe22ffc[_0x9b24('0x22')]=_0x22bf95!==''?_0x22bf95:util[_0x9b24('0x3b')](_0x9b24('0x3c'),_0x258da4);}else{return null;}}return _0x214791['sobject'](_[_0x9b24('0x40')](_0xe44fd6[_0x9b24('0x39')]))[_0x9b24('0x19')](_0xe22ffc)[_0x9b24('0x1e')](function(_0x1ddb99){return BPromise[_0x9b24('0x21')]({'id':_0x1ddb99['id'],'endUserType':_0xe44fd6['moduleCreate']});});}});}function getCustomFields(_0x33d72d,_0x527f2d){var _0x57e108={};if(_0x33d72d['length']>0x0){_['forEach'](_0x33d72d,function(_0x45242a){if(_[_0x9b24('0x41')]([_0x9b24('0x42'),'picklist'],_0x45242a[_0x9b24('0x36')])&&_0x45242a['idField']){_0x57e108[_0x45242a[_0x9b24('0x43')]]=_0x45242a['content'][_0x9b24('0x44')]();}else if(_0x45242a['type']===_0x9b24('0x45')&&_0x45242a['variableName']&&_0x45242a[_0x9b24('0x43')]){_0x527f2d[_0x45242a[_0x9b24('0x46')]]&&(_0x57e108[_0x45242a['idField']]=_0x527f2d[_0x45242a[_0x9b24('0x46')]][_0x9b24('0x44')]());}else if(_0x45242a[_0x9b24('0x36')]===_0x9b24('0x47')&&_0x45242a['Variable']&&_0x45242a[_0x9b24('0x48')]['name']&&_0x45242a[_0x9b24('0x43')]){_0x527f2d[_0x45242a[_0x9b24('0x48')][_0x9b24('0x49')][_0x9b24('0x4a')]()]&&(_0x57e108[_0x45242a['idField']]=_0x527f2d[_0x45242a[_0x9b24('0x48')][_0x9b24('0x49')][_0x9b24('0x4a')]()][_0x9b24('0x44')]());}});}return _0x57e108;}function getConnection(_0x18f233){var _0x16fef1=_0x18f233[_0x9b24('0x4b')][_0x9b24('0x4c')](_0x18f233[_0x9b24('0x4d')]);var _0x17e5b2=new jsforce[(_0x9b24('0x4e'))]({'oauth2':{'loginUrl':_0x18f233[_0x9b24('0x4f')]||_0x9b24('0x50'),'clientId':_0x18f233[_0x9b24('0x51')],'clientSecret':_0x18f233[_0x9b24('0x52')]}});return _0x17e5b2[_0x9b24('0x53')](_0x18f233[_0x9b24('0x54')],_0x16fef1)['then'](function(){logger[_0x9b24('0x17')](_0x9b24('0x55'));return _0x17e5b2;});}exports['queue']=function(_0x40edfe,_0x364712,_0x4088cc,_0x228a1a,_0x403a0e,_0x48ce76){var _0x3edeaa,_0x2784ca,_0x58e922,_0x18d907;_0x48ce76[_0x9b24('0x56')]=intUtil[_0x9b24('0x57')](_0x48ce76[_0x9b24('0x56')]);_0x48ce76[_0x9b24('0x4f')]=intUtil[_0x9b24('0x57')](_0x48ce76[_0x9b24('0x4f')]);if(_0x403a0e&&_0x403a0e[_0x9b24('0x58')]){logger[_0x9b24('0x17')]('[QUEUE]',_0x9b24('0x59'));_0x364712['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48ce76[_0x9b24('0x56')],_0x364712[_0x9b24('0x5a')],md5(_0x364712[_0x9b24('0x5a')]));}else{_0x364712[_0x9b24('0x5b')]='';}return getConnection(_0x48ce76)[_0x9b24('0x1e')](function(_0xa9d592){_0x18d907=_0xa9d592;return getUser(_0x48ce76,_0x228a1a[_0x9b24('0x5c')],_0x18d907);})[_0x9b24('0x1e')](function(_0x330b13){_0x3edeaa=_0x330b13;return getEndUser(_0x48ce76,_0x4088cc,_0x364712[_0x9b24('0x5d')],_0x364712[_0x9b24('0x5e')],_0x18d907);})['then'](function(_0xcdf65d){_0x2784ca=_0xcdf65d;return getTicket(_0x48ce76,_0x3edeaa,_0x2784ca,_0x4088cc,_0x364712,_0x4088cc[_0x9b24('0x5f')],_0x18d907,_0x9b24('0x60'));})[_0x9b24('0x1e')](function(_0x4d6bdd){_0x58e922=_0x4d6bdd;logger[_0x9b24('0x17')](_0x9b24('0x61'),_0x58e922['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x58e922['id'],_0x228a1a['name'],_0x48ce76[_0x9b24('0x36')]);switch(_0x48ce76[_0x9b24('0x36')]){case _0x9b24('0x62'):emit(util[_0x9b24('0x3b')]('user:%s',_0x228a1a[_0x9b24('0x49')]),_0x9b24('0x63'),{'recordId':_0x58e922['id']});break;case'newTab':emit(util[_0x9b24('0x3b')](_0x9b24('0x64'),_0x228a1a[_0x9b24('0x49')]),_0x9b24('0x65'),{'uri':util[_0x9b24('0x3b')](_0x9b24('0x66'),_0x18d907[_0x9b24('0x67')],_0x58e922['id'])});break;default:logger[_0x9b24('0x68')](_0x9b24('0x69'));}})['catch'](function(_0x4b774e){logger[_0x9b24('0x68')](_0x9b24('0x6a'),_0x4b774e);});};exports['outbound']=function(_0x57e756,_0x40b8a0,_0xc08a53,_0x88d396,_0x537c19,_0x512ae9,_0x33efd3){var _0x2519d9,_0x807d45,_0x1cee89,_0x4865bb;_0x512ae9[_0x9b24('0x56')]=intUtil[_0x9b24('0x57')](_0x512ae9[_0x9b24('0x56')]);_0x512ae9[_0x9b24('0x4f')]=intUtil[_0x9b24('0x57')](_0x512ae9['remoteUri']);if(_0x33efd3&&_0x33efd3[_0x9b24('0x6b')]&&_0x33efd3[_0x9b24('0x6b')]!==_0x9b24('0x6c')){logger[_0x9b24('0x17')]('[OUTBOUND]',_0x9b24('0x59'));_0x40b8a0[_0x9b24('0x5b')]=util['format'](_0x9b24('0x6d'),_0x512ae9[_0x9b24('0x56')],_0x40b8a0[_0x9b24('0x5a')],md5(_0x40b8a0['uniqueid']));}return getConnection(_0x512ae9)[_0x9b24('0x1e')](function(_0x3107be){_0x4865bb=_0x3107be;return getUser(_0x512ae9,_0x88d396[_0x9b24('0x5c')],_0x4865bb);})['then'](function(_0x5eea09){_0x2519d9=_0x5eea09;return getEndUser(_0x512ae9,_0xc08a53,_0x40b8a0[_0x9b24('0x6e')],_0x40b8a0['destcalleridnum'],_0x4865bb);})[_0x9b24('0x1e')](function(_0x167560){_0x807d45=_0x167560;return getTicket(_0x512ae9,_0x2519d9,_0x807d45,_0xc08a53,_0x40b8a0,_0xc08a53['Fields'],_0x4865bb,'outbound');})[_0x9b24('0x1e')](function(_0x327f5f){_0x1cee89=_0x327f5f;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x1cee89['id']);logger['info'](_0x9b24('0x6f'),_0x1cee89['id'],_0x88d396['name'],_0x512ae9[_0x9b24('0x36')]);switch(_0x512ae9[_0x9b24('0x36')]){case _0x9b24('0x62'):emit(util['format']('user:%s',_0x88d396[_0x9b24('0x49')]),_0x9b24('0x63'),{'recordId':_0x1cee89['id']});break;case _0x9b24('0x70'):emit(util[_0x9b24('0x3b')](_0x9b24('0x64'),_0x88d396[_0x9b24('0x49')]),_0x9b24('0x65'),{'uri':util[_0x9b24('0x3b')](_0x9b24('0x66'),_0x4865bb[_0x9b24('0x67')],_0x1cee89['id'])});break;default:logger[_0x9b24('0x68')](_0x9b24('0x71'),_0x9b24('0x72'));}})[_0x9b24('0x73')](function(_0x335b49){logger[_0x9b24('0x68')]('[OUTBOUND]',_0x335b49);});};exports[_0x9b24('0x74')]=function(_0x5e09fd,_0xdc60f7,_0x5aa99d,_0x55efd7,_0x3dc0f1,_0x3978d0){var _0x336881,_0x529612,_0x4856e4,_0x25200d;_0x3978d0[_0x9b24('0x56')]=intUtil['stripTrailingSlash'](_0x3978d0['serverUrl']);_0x3978d0[_0x9b24('0x4f')]=intUtil['stripTrailingSlash'](_0x3978d0[_0x9b24('0x4f')]);if(_0x3dc0f1&&_0x3dc0f1[_0x9b24('0x58')]){logger['info']('['+_0xdc60f7[_0x9b24('0x75')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xdc60f7[_0x9b24('0x5b')]=util['format'](_0x9b24('0x6d'),_0x3978d0['serverUrl'],_0xdc60f7[_0x9b24('0x5a')],md5(_0xdc60f7[_0x9b24('0x5a')]));}else{_0xdc60f7[_0x9b24('0x5b')]='';}return getConnection(_0x3978d0)[_0x9b24('0x1e')](function(_0x40feb6){_0x25200d=_0x40feb6;if(!_['isNil'](_0x55efd7)){return getUser(_0x3978d0,_0x55efd7['name'],_0x25200d);}else{return getUser(_0x3978d0,null,_0x25200d);}})[_0x9b24('0x1e')](function(_0x2d9e5c){_0x336881=_0x2d9e5c;return getEndUser(_0x3978d0,_0x5aa99d,_0xdc60f7[_0x9b24('0x5d')],_0xdc60f7[_0x9b24('0x5e')],_0x25200d);})[_0x9b24('0x1e')](function(_0x1d9098){_0x529612=_0x1d9098;return getTicket(_0x3978d0,_0x336881,_0x529612,_0x5aa99d,_0xdc60f7,_0x5aa99d[_0x9b24('0x5f')],_0x25200d);})[_0x9b24('0x1e')](function(_0x2278e6){_0x4856e4=_0x2278e6;logger[_0x9b24('0x17')]('['+_0xdc60f7[_0x9b24('0x75')][_0x9b24('0x76')]()+']\x20Ticket\x20%s\x20created.',_0x4856e4['id']);logger['info']('['+_0xdc60f7[_0x9b24('0x75')]['toUpperCase']()+_0x9b24('0x77'),_0x3978d0['type']);})[_0x9b24('0x73')](function(_0x303c5a){logger[_0x9b24('0x68')]('['+_0xdc60f7['lastevent'][_0x9b24('0x76')]()+']',_0x303c5a);});}; \ No newline at end of file +var _0x2a1a=['remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','queue','[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','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','util','./util','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','utc','IsRecurrence','endUserType','contact','account','WhatId','ContactId','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','sobject','find','then','length','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','execute','Contact','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection'];(function(_0x5bf45b,_0x2da30c){var _0x322617=function(_0x4014f3){while(--_0x4014f3){_0x5bf45b['push'](_0x5bf45b['shift']());}};_0x322617(++_0x2da30c);}(_0x2a1a,0x125));var _0xa2a1=function(_0x4237fa,_0x4ad50c){_0x4237fa=_0x4237fa-0x0;var _0x1e9fc6=_0x2a1a[_0x4237fa];return _0x1e9fc6;};'use strict';var _=require(_0xa2a1('0x0'));var rp=require(_0xa2a1('0x1'));var moment=require(_0xa2a1('0x2'));var BPromise=require('bluebird');var md5=require(_0xa2a1('0x3'));var jsforce=require('jsforce');var util=require(_0xa2a1('0x4'));var Redis=require('ioredis');var intUtil=require(_0xa2a1('0x5'));var config=require('../../../../config/environment');var logger=require(_0xa2a1('0x6'))(_0xa2a1('0x7'));config[_0xa2a1('0x8')]=_[_0xa2a1('0x9')](config[_0xa2a1('0x8')],{'host':_0xa2a1('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa2a1('0x8')]));function emit(_0x42140e,_0x3da7c4,_0x5de1b0){io['to'](_0x42140e)[_0xa2a1('0xb')](_0x3da7c4,_0x5de1b0);}function getTicket(_0x3ba55c,_0x23bd4b,_0x470e14,_0x2e1bc3,_0x5528e8,_0x1ee224,_0x5369c5,_0x42c646){var _0x2849ad=Object[_0xa2a1('0xc')]({},{'OwnerId':_0x23bd4b['id'],'Subject':intUtil[_0xa2a1('0xd')](_0x2e1bc3[_0xa2a1('0xe')],_0x5528e8,'\x20'),'Description':intUtil[_0xa2a1('0xd')](_0x2e1bc3[_0xa2a1('0xf')],_0x5528e8,'\x0a')},getCustomFields(_0x1ee224,_0x5528e8));if(_0x470e14){if(_0x2e1bc3[_0xa2a1('0x10')]==='Task'){_0x2849ad['ActivityDate']=moment[_0xa2a1('0x11')]();_0x2849ad['IsReminderSet']=![];_0x2849ad[_0xa2a1('0x12')]=![];if(_0x470e14[_0xa2a1('0x13')]===_0xa2a1('0x14')||_0x470e14[_0xa2a1('0x13')]==='lead'){_0x2849ad['WhoId']=_0x470e14['id'];}else if(_0x470e14[_0xa2a1('0x13')]===_0xa2a1('0x15')){_0x2849ad[_0xa2a1('0x16')]=_0x470e14['id'];}}else if(_0x2e1bc3['ticketType']==='Case'){if(_0x470e14[_0xa2a1('0x13')]===_0xa2a1('0x14')){_0x2849ad[_0xa2a1('0x17')]=_0x470e14['id'];}else if(_0x470e14[_0xa2a1('0x13')]===_0xa2a1('0x15')){_0x2849ad[_0xa2a1('0x18')]=_0x470e14['id'];}else if(_0x470e14[_0xa2a1('0x13')]===_0xa2a1('0x19')&&_0x2e1bc3[_0xa2a1('0x1a')]){_0x2849ad[_0x2e1bc3['leadId']]=_0x470e14['id'];}else{logger['info'](_0xa2a1('0x1b'));}}}return _0x5369c5['sobject'](_0x2e1bc3['ticketType'])[_0xa2a1('0x1c')](_0x2849ad);}function getUser(_0x3ef547,_0x38f175,_0x58d888){if(!_['isNil'](_0x38f175)&&intUtil[_0xa2a1('0x1d')](_0x38f175)){var _0x39dd70={'Email':_0x38f175};var _0x202b54={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x58d888[_0xa2a1('0x1e')]('User')[_0xa2a1('0x1f')](_0x39dd70,_0x202b54)['execute']()[_0xa2a1('0x20')](function(_0x1ce7f2){if(_0x1ce7f2[_0xa2a1('0x21')]){var _0x18afdf=_[_0xa2a1('0x1f')](_0x1ce7f2,function(_0x27841e){return _0x27841e['Email']===_0x38f175;});if(_0x18afdf){logger[_0xa2a1('0x22')]('Agent\x20%s\x20found.',_0x38f175);return BPromise[_0xa2a1('0x23')]({'id':_0x18afdf['Id'],'name':_0x18afdf[_0xa2a1('0x24')]});}}else{logger[_0xa2a1('0x22')](_0xa2a1('0x25'),_0x38f175);return _0x58d888[_0xa2a1('0x26')]()[_0xa2a1('0x20')](function(_0x19225f){return BPromise[_0xa2a1('0x23')]({'id':_0x19225f['user_id'],'name':_0x19225f['display_name']});});}});}else{logger[_0xa2a1('0x22')](_0xa2a1('0x25'),_0x38f175);return _0x58d888[_0xa2a1('0x26')]()['then'](function(_0x2ae7f5){return BPromise[_0xa2a1('0x23')]({'id':_0x2ae7f5['user_id'],'name':_0x2ae7f5[_0xa2a1('0x27')]});});}}function getEndUser(_0x5ccee3,_0x57c097,_0x5707a9,_0x540264,_0xd0837d){var _0x500779={'$or':{'Phone':_0x540264}};var _0xab1f42={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa2a1('0x23')]()['then'](function(){logger[_0xa2a1('0x22')](_0xa2a1('0x28'),_0x540264,_0x57c097[_0xa2a1('0x29')]);switch(_0x57c097[_0xa2a1('0x29')]){case _0xa2a1('0x2a'):var _0xcff9e9=_['cloneDeep'](_0x500779);if(_0x57c097[_0xa2a1('0x2b')]){var _0x275455={};_0x275455[_0x57c097['additionalSearchContact']]=_0x540264;_[_0xa2a1('0x2c')](_0xcff9e9[_0xa2a1('0x2d')],_0x275455);}return _0xd0837d[_0xa2a1('0x1e')]('Contact')[_0xa2a1('0x1f')](_0xcff9e9,_0xab1f42)['execute']()[_0xa2a1('0x20')](function(_0x3669fb){if(_0x3669fb&&_0x3669fb['length']){return _0x3669fb;}else{var _0x2c21b4=_[_0xa2a1('0x2e')](_0x500779);if(_0x57c097[_0xa2a1('0x2f')]){var _0x919413={};_0x919413[_0x57c097['additionalSearchLead']]=_0x540264;_['merge'](_0x2c21b4[_0xa2a1('0x2d')],_0x919413);}return _0xd0837d['sobject'](_0xa2a1('0x30'))[_0xa2a1('0x1f')](_0x2c21b4,_0xab1f42);}});case _0xa2a1('0x31'):var _0x5a31dc=_[_0xa2a1('0x2e')](_0x500779);if(_0x57c097[_0xa2a1('0x32')]){var _0x275455={};_0x275455[_0x57c097[_0xa2a1('0x32')]]=_0x540264;_['merge'](_0x5a31dc[_0xa2a1('0x2d')],_0x275455);}return _0xd0837d[_0xa2a1('0x1e')](_0xa2a1('0x33'))['find'](_0x5a31dc,_0xab1f42)[_0xa2a1('0x34')]()[_0xa2a1('0x20')](function(_0x2ce2c4){if(_0x2ce2c4&&_0x2ce2c4['length']){return _0x2ce2c4;}else{var _0x57327c=_[_0xa2a1('0x2e')](_0x500779);if(_0x57c097[_0xa2a1('0x2b')]){var _0x2d559c={};_0x2d559c[_0x57c097[_0xa2a1('0x2b')]]=_0x540264;_[_0xa2a1('0x2c')](_0x57327c[_0xa2a1('0x2d')],_0x2d559c);}return _0xd0837d[_0xa2a1('0x1e')](_0xa2a1('0x35'))[_0xa2a1('0x1f')](_0x57327c,_0xab1f42)[_0xa2a1('0x20')](function(_0x11b21b){if(_0x11b21b&&_0x11b21b[_0xa2a1('0x21')]){return _0x11b21b;}else{var _0x5f4b86=_[_0xa2a1('0x2e')](_0x500779);if(_0x57c097[_0xa2a1('0x2f')]){var _0x170311={};_0x170311[_0x57c097[_0xa2a1('0x2f')]]=_0x540264;_[_0xa2a1('0x2c')](_0x5f4b86[_0xa2a1('0x2d')],_0x170311);}return _0xd0837d[_0xa2a1('0x1e')]('Lead')[_0xa2a1('0x1f')](_0x5f4b86,_0xab1f42);}});}});case _0xa2a1('0x14'):var _0xcff9e9=_['cloneDeep'](_0x500779);if(_0x57c097[_0xa2a1('0x2b')]){var _0x275455={};_0x275455[_0x57c097[_0xa2a1('0x2b')]]=_0x540264;_[_0xa2a1('0x2c')](_0xcff9e9[_0xa2a1('0x2d')],_0x275455);}return _0xd0837d['sobject'](_0xa2a1('0x35'))['find'](_0xcff9e9,_0xab1f42)[_0xa2a1('0x34')]();case _0xa2a1('0x19'):var _0x3e1c7f=_[_0xa2a1('0x2e')](_0x500779);if(_0x57c097['additionalSearchLead']){var _0x275455={};_0x275455[_0x57c097[_0xa2a1('0x2f')]]=_0x540264;_[_0xa2a1('0x2c')](_0x3e1c7f[_0xa2a1('0x2d')],_0x275455);}return _0xd0837d[_0xa2a1('0x1e')](_0xa2a1('0x30'))['find'](_0x3e1c7f,_0xab1f42);case _0xa2a1('0x15'):var _0x5a31dc=_[_0xa2a1('0x2e')](_0x500779);if(_0x57c097[_0xa2a1('0x32')]){var _0x275455={};_0x275455[_0x57c097['additionalSearchAccount']]=_0x540264;_[_0xa2a1('0x2c')](_0x5a31dc[_0xa2a1('0x2d')],_0x275455);}return _0xd0837d[_0xa2a1('0x1e')](_0xa2a1('0x33'))[_0xa2a1('0x1f')](_0x5a31dc,_0xab1f42);default:return null;}})[_0xa2a1('0x20')](function(_0x532804){if(_0x532804&&_0x532804[_0xa2a1('0x21')]){var _0x51156b=_[_0xa2a1('0x36')](_0x532804);if(_0x51156b){return BPromise[_0xa2a1('0x23')]({'id':_0x51156b['Id'],'name':_0x51156b[_0xa2a1('0x24')],'phone':_0x51156b[_0xa2a1('0x37')],'endUserType':_0x51156b['attributes'][_0xa2a1('0x38')][_0xa2a1('0x39')]()});}}})[_0xa2a1('0x20')](function(_0x59ac52){if(_0x59ac52){logger[_0xa2a1('0x22')](_0xa2a1('0x3a'),_0x59ac52[_0xa2a1('0x13')],_0x540264);return BPromise[_0xa2a1('0x23')](_0x59ac52);}else{logger[_0xa2a1('0x22')](_0xa2a1('0x3b'),_0x540264);var _0x517328={'Phone':_0x540264};if(_0x57c097[_0xa2a1('0x3c')]){if(_0x57c097[_0xa2a1('0x3c')]==='contact'){logger[_0xa2a1('0x22')](_0xa2a1('0x3d'),_0x540264,_0x57c097[_0xa2a1('0x3c')]);_0x517328[_0xa2a1('0x3e')]=_0x5707a9!==_0xa2a1('0x3f')?_0x5707a9:util['format'](_0xa2a1('0x40'),_0x540264);}else if(_0x57c097[_0xa2a1('0x3c')]==='lead'){logger[_0xa2a1('0x22')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x540264,_0x57c097[_0xa2a1('0x3c')]);_0x517328['LastName']=_0x5707a9!==_0xa2a1('0x3f')?_0x5707a9:util[_0xa2a1('0x41')](_0xa2a1('0x40'),_0x540264);_0x517328[_0xa2a1('0x42')]='No\x20Company';}else if(_0x57c097[_0xa2a1('0x3c')]===_0xa2a1('0x15')){logger['info'](_0xa2a1('0x3d'),_0x540264,_0x57c097[_0xa2a1('0x3c')]);_0x517328[_0xa2a1('0x24')]=_0x5707a9!==''?_0x5707a9:util[_0xa2a1('0x41')]('Caller\x20-\x20%s',_0x540264);}else{return null;}}return _0xd0837d[_0xa2a1('0x1e')](_['upperFirst'](_0x57c097['moduleCreate']))['create'](_0x517328)['then'](function(_0x25e5d4){return BPromise[_0xa2a1('0x23')]({'id':_0x25e5d4['id'],'endUserType':_0x57c097[_0xa2a1('0x3c')]});});}});}function getCustomFields(_0x103b92,_0x191f42){var _0x2d809a={};if(_0x103b92[_0xa2a1('0x21')]>0x0){_[_0xa2a1('0x43')](_0x103b92,function(_0x44e463){if(_[_0xa2a1('0x44')]([_0xa2a1('0x45'),_0xa2a1('0x46')],_0x44e463[_0xa2a1('0x38')])&&_0x44e463[_0xa2a1('0x47')]){_0x2d809a[_0x44e463[_0xa2a1('0x47')]]=_0x44e463[_0xa2a1('0x48')][_0xa2a1('0x49')]();}else if(_0x44e463[_0xa2a1('0x38')]===_0xa2a1('0x4a')&&_0x44e463[_0xa2a1('0x4b')]&&_0x44e463[_0xa2a1('0x47')]){_0x191f42[_0x44e463[_0xa2a1('0x4b')]]&&(_0x2d809a[_0x44e463['idField']]=_0x191f42[_0x44e463['variableName']][_0xa2a1('0x49')]());}else if(_0x44e463['type']===_0xa2a1('0x4c')&&_0x44e463[_0xa2a1('0x4d')]&&_0x44e463[_0xa2a1('0x4d')][_0xa2a1('0x4e')]&&_0x44e463[_0xa2a1('0x47')]){_0x191f42[_0x44e463[_0xa2a1('0x4d')][_0xa2a1('0x4e')]['toLowerCase']()]&&(_0x2d809a[_0x44e463[_0xa2a1('0x47')]]=_0x191f42[_0x44e463[_0xa2a1('0x4d')][_0xa2a1('0x4e')][_0xa2a1('0x39')]()][_0xa2a1('0x49')]());}});}return _0x2d809a;}function getConnection(_0x5ab7fa){var _0xc3e189=_0x5ab7fa[_0xa2a1('0x4f')]['concat'](_0x5ab7fa[_0xa2a1('0x50')]);var _0xb1c0=new jsforce[(_0xa2a1('0x51'))]({'oauth2':{'loginUrl':_0x5ab7fa[_0xa2a1('0x52')]||_0xa2a1('0x53'),'clientId':_0x5ab7fa[_0xa2a1('0x54')],'clientSecret':_0x5ab7fa[_0xa2a1('0x55')]}});return _0xb1c0[_0xa2a1('0x56')](_0x5ab7fa[_0xa2a1('0x57')],_0xc3e189)['then'](function(){logger[_0xa2a1('0x22')]('Connection\x20established.');return _0xb1c0;});}exports['queue']=function(_0x2ad8fd,_0x1adb73,_0x3096f3,_0xaeaff1,_0x2f8a11,_0x4909da){var _0x211e56,_0x475a29,_0x2d1255,_0x4eb73c;_0x4909da[_0xa2a1('0x58')]=intUtil[_0xa2a1('0x59')](_0x4909da[_0xa2a1('0x58')]);_0x4909da[_0xa2a1('0x52')]=intUtil[_0xa2a1('0x59')](_0x4909da['remoteUri']);if(_0x2f8a11&&_0x2f8a11[_0xa2a1('0x5a')]){logger[_0xa2a1('0x22')](_0xa2a1('0x5b'),'Recording\x20is\x20enabled!');_0x1adb73[_0xa2a1('0x5c')]=util[_0xa2a1('0x41')](_0xa2a1('0x5d'),_0x4909da[_0xa2a1('0x58')],_0x1adb73[_0xa2a1('0x5e')],md5(_0x1adb73[_0xa2a1('0x5e')]));}else{_0x1adb73[_0xa2a1('0x5c')]='';}return getConnection(_0x4909da)[_0xa2a1('0x20')](function(_0x18aaa3){_0x4eb73c=_0x18aaa3;return getUser(_0x4909da,_0xaeaff1[_0xa2a1('0x5f')],_0x4eb73c);})[_0xa2a1('0x20')](function(_0x842303){_0x211e56=_0x842303;return getEndUser(_0x4909da,_0x3096f3,_0x1adb73[_0xa2a1('0x60')],_0x1adb73['calleridnum'],_0x4eb73c);})[_0xa2a1('0x20')](function(_0x274b90){_0x475a29=_0x274b90;return getTicket(_0x4909da,_0x211e56,_0x475a29,_0x3096f3,_0x1adb73,_0x3096f3[_0xa2a1('0x61')],_0x4eb73c,_0xa2a1('0x62'));})['then'](function(_0x3c201c){_0x2d1255=_0x3c201c;logger[_0xa2a1('0x22')](_0xa2a1('0x63'),_0x2d1255['id']);logger[_0xa2a1('0x22')](_0xa2a1('0x64'),_0x2d1255['id'],_0xaeaff1[_0xa2a1('0x4e')],_0x4909da[_0xa2a1('0x38')]);switch(_0x4909da[_0xa2a1('0x38')]){case _0xa2a1('0x65'):emit(util['format'](_0xa2a1('0x66'),_0xaeaff1[_0xa2a1('0x4e')]),_0xa2a1('0x67'),{'recordId':_0x2d1255['id']});break;case _0xa2a1('0x68'):emit(util[_0xa2a1('0x41')](_0xa2a1('0x66'),_0xaeaff1[_0xa2a1('0x4e')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x4eb73c[_0xa2a1('0x69')],_0x2d1255['id'])});break;default:logger['error'](_0xa2a1('0x6a'));}})[_0xa2a1('0x6b')](function(_0xe3cc4f){logger[_0xa2a1('0x6c')](_0xa2a1('0x5b'),_0xe3cc4f);});};exports['outbound']=function(_0x4a5729,_0x176ee9,_0x5ade5c,_0xe61357,_0x1e136d,_0x7b3671,_0x1fcff8){var _0xe2d222,_0x44eacf,_0x496d00,_0x12edd8;_0x7b3671[_0xa2a1('0x58')]=intUtil[_0xa2a1('0x59')](_0x7b3671[_0xa2a1('0x58')]);_0x7b3671[_0xa2a1('0x52')]=intUtil[_0xa2a1('0x59')](_0x7b3671[_0xa2a1('0x52')]);if(_0x1fcff8&&_0x1fcff8[_0xa2a1('0x6d')]&&_0x1fcff8[_0xa2a1('0x6d')]!=='none'){logger['info'](_0xa2a1('0x6e'),_0xa2a1('0x6f'));_0x176ee9[_0xa2a1('0x5c')]=util[_0xa2a1('0x41')](_0xa2a1('0x5d'),_0x7b3671[_0xa2a1('0x58')],_0x176ee9['uniqueid'],md5(_0x176ee9[_0xa2a1('0x5e')]));}return getConnection(_0x7b3671)[_0xa2a1('0x20')](function(_0x2ac0b4){_0x12edd8=_0x2ac0b4;return getUser(_0x7b3671,_0xe61357['email'],_0x12edd8);})['then'](function(_0xd7cc1e){_0xe2d222=_0xd7cc1e;return getEndUser(_0x7b3671,_0x5ade5c,_0x176ee9['destcalleridname'],_0x176ee9[_0xa2a1('0x70')],_0x12edd8);})[_0xa2a1('0x20')](function(_0x104af3){_0x44eacf=_0x104af3;return getTicket(_0x7b3671,_0xe2d222,_0x44eacf,_0x5ade5c,_0x176ee9,_0x5ade5c[_0xa2a1('0x61')],_0x12edd8,'outbound');})['then'](function(_0x1f9bc3){_0x496d00=_0x1f9bc3;logger[_0xa2a1('0x22')](_0xa2a1('0x71'),_0x496d00['id']);logger[_0xa2a1('0x22')](_0xa2a1('0x72'),_0x496d00['id'],_0xe61357[_0xa2a1('0x4e')],_0x7b3671['type']);switch(_0x7b3671[_0xa2a1('0x38')]){case'integrationTab':emit(util[_0xa2a1('0x41')](_0xa2a1('0x66'),_0xe61357[_0xa2a1('0x4e')]),_0xa2a1('0x67'),{'recordId':_0x496d00['id']});break;case _0xa2a1('0x68'):emit(util[_0xa2a1('0x41')]('user:%s',_0xe61357[_0xa2a1('0x4e')]),_0xa2a1('0x73'),{'uri':util['format'](_0xa2a1('0x74'),_0x12edd8[_0xa2a1('0x69')],_0x496d00['id'])});break;default:logger['error'](_0xa2a1('0x6e'),_0xa2a1('0x75'));}})[_0xa2a1('0x6b')](function(_0x59f081){logger[_0xa2a1('0x6c')](_0xa2a1('0x6e'),_0x59f081);});};exports[_0xa2a1('0x76')]=function(_0x19e9b8,_0x58a691,_0x154eee,_0x4f4611,_0x412c4f,_0x19599d){var _0x462bb2,_0x546460,_0xc3437e,_0x38bc1d;_0x19599d['serverUrl']=intUtil[_0xa2a1('0x59')](_0x19599d['serverUrl']);_0x19599d[_0xa2a1('0x52')]=intUtil[_0xa2a1('0x59')](_0x19599d[_0xa2a1('0x52')]);if(_0x412c4f&&_0x412c4f[_0xa2a1('0x5a')]){logger[_0xa2a1('0x22')]('['+_0x58a691[_0xa2a1('0x77')][_0xa2a1('0x78')]()+']',_0xa2a1('0x6f'));_0x58a691[_0xa2a1('0x5c')]=util[_0xa2a1('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19599d[_0xa2a1('0x58')],_0x58a691[_0xa2a1('0x5e')],md5(_0x58a691[_0xa2a1('0x5e')]));}else{_0x58a691[_0xa2a1('0x5c')]='';}return getConnection(_0x19599d)[_0xa2a1('0x20')](function(_0x58a5c9){_0x38bc1d=_0x58a5c9;if(!_[_0xa2a1('0x79')](_0x4f4611)){return getUser(_0x19599d,_0x4f4611[_0xa2a1('0x4e')],_0x38bc1d);}else{return getUser(_0x19599d,null,_0x38bc1d);}})[_0xa2a1('0x20')](function(_0x2dc5cd){_0x462bb2=_0x2dc5cd;return getEndUser(_0x19599d,_0x154eee,_0x58a691['calleridname'],_0x58a691[_0xa2a1('0x7a')],_0x38bc1d);})[_0xa2a1('0x20')](function(_0x5a745e){_0x546460=_0x5a745e;return getTicket(_0x19599d,_0x462bb2,_0x546460,_0x154eee,_0x58a691,_0x154eee['Fields'],_0x38bc1d);})[_0xa2a1('0x20')](function(_0x17c3e2){_0xc3437e=_0x17c3e2;logger[_0xa2a1('0x22')]('['+_0x58a691[_0xa2a1('0x77')][_0xa2a1('0x78')]()+_0xa2a1('0x7b'),_0xc3437e['id']);logger[_0xa2a1('0x22')]('['+_0x58a691[_0xa2a1('0x77')]['toUpperCase']()+_0xa2a1('0x7c'),_0x19599d[_0xa2a1('0x38')]);})[_0xa2a1('0x6b')](function(_0x8d279){logger[_0xa2a1('0x6c')]('['+_0x58a691[_0xa2a1('0x77')][_0xa2a1('0x78')]()+']',_0x8d279);});}; \ 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 b0c1c04..8d83f94 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 _0x8abc=['includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variableName','toString','customVariable','Variable','name','outbound','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','ticketId','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','stripTrailingSlash','remoteUri','serverUrl','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach'];(function(_0x48afa8,_0x2814cb){var _0x3ccd6b=function(_0x59b5ff){while(--_0x59b5ff){_0x48afa8['push'](_0x48afa8['shift']());}};_0x3ccd6b(++_0x2814cb);}(_0x8abc,0xb3));var _0xc8ab=function(_0x544010,_0x94a6ce){_0x544010=_0x544010-0x0;var _0x15443a=_0x8abc[_0x544010];return _0x15443a;};'use strict';var _=require('lodash');var Promise=require(_0xc8ab('0x0'));var rp=require('request-promise');var util=require(_0xc8ab('0x1'));var md5=require(_0xc8ab('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xc8ab('0x3'));var logger=require(_0xc8ab('0x4'))(_0xc8ab('0x5'));config[_0xc8ab('0x6')]=_['defaults'](config[_0xc8ab('0x6')],{'host':_0xc8ab('0x7'),'port':0x18eb});var io=require(_0xc8ab('0x8'))(new Redis(config['redis']));function getAdminUser(_0x28c9a1,_0x1b5ca2,_0x1af907,_0x51ce32,_0x28c78c,_0x2909fe){return new Promise(function(_0x140b8e,_0x57b1fa){var _0x3025fd={'method':_0xc8ab('0x9'),'uri':_0x51ce32+_0xc8ab('0xa')+'&'+_0x28c78c+'&'+_0x2909fe,'auth':_0x1b5ca2,'json':!![]};return rp(_0x3025fd)['then'](function(_0xc774c2){if(_0xc774c2['result'][_0xc8ab('0xb')]>0x0){_0x1af907[_0xc8ab('0xc')]=_0xc774c2[_0xc8ab('0xd')][0x0][_0xc8ab('0xe')];}logger[_0xc8ab('0xf')]('['+[_0x28c9a1[_0xc8ab('0x10')]()]+_0xc8ab('0x11'),_0x1af907);_0x140b8e(_0x1af907);})[_0xc8ab('0x12')](function(_0x2808e6){logger[_0xc8ab('0x13')]('['+[_0x28c9a1[_0xc8ab('0x10')]()]+']',_0x2808e6[_0xc8ab('0x14')]);_0x57b1fa(_0x2808e6[_0xc8ab('0x14')]);});});}function getUser(_0x489677,_0x63a96c,_0x20c058,_0x121367,_0x130a26){return function(_0x262769){logger[_0xc8ab('0xf')]('['+[_0x489677['toUpperCase']()]+_0xc8ab('0x15'),_0x262769);return new Promise(function(_0x1730b8,_0x1d73aa){if(intUtil[_0xc8ab('0x16')](_0x262769[_0xc8ab('0x17')])){var _0x4ffbde={'method':'GET','uri':_0x20c058+_0xc8ab('0x18')+_0x262769[_0xc8ab('0x17')]+'&'+_0x121367+'&'+_0x130a26,'auth':_0x63a96c,'json':!![]};logger[_0xc8ab('0xf')]('['+[_0x489677[_0xc8ab('0x10')]()]+_0xc8ab('0x19'),_0x4ffbde);return rp(_0x4ffbde)['then'](function(_0x1f28e4){logger[_0xc8ab('0xf')]('['+[_0x489677[_0xc8ab('0x10')]()]+_0xc8ab('0x1a'),_0x1f28e4);if(_0x1f28e4[_0xc8ab('0xd')]['length']>0x0&&String(_0x1f28e4[_0xc8ab('0xd')][0x0][_0xc8ab('0x1b')])===_0xc8ab('0x1c')){_0x262769[_0xc8ab('0x1d')]=_0x1f28e4[_0xc8ab('0xd')][0x0][_0xc8ab('0xe')];}else{_0x262769['userId']=_0x262769[_0xc8ab('0xc')];_0x262769['userEmail']=_0x262769[_0xc8ab('0x1e')];}logger[_0xc8ab('0xf')]('['+[_0x489677[_0xc8ab('0x10')]()]+'],\x20getUser\x20crm',_0x262769);_0x1730b8(_0x262769);})[_0xc8ab('0x12')](function(_0x343168){logger[_0xc8ab('0x13')]('['+[_0x489677['toUpperCase']()]+']',_0x343168[_0xc8ab('0x14')]);_0x1d73aa(_0x343168[_0xc8ab('0x14')]);});}else{logger[_0xc8ab('0xf')]('['+[_0x489677['toUpperCase']()]+_0xc8ab('0x1f'));_0x262769[_0xc8ab('0x1d')]=_0x262769[_0xc8ab('0xc')];_0x262769[_0xc8ab('0x17')]=_0x262769[_0xc8ab('0x1e')];_0x1730b8(_0x262769);}});};}function createEndUser(_0x2751c6,_0x280c5c,_0xa5a73f,_0x23c4e9,_0xb79ede){logger[_0xc8ab('0xf')]('['+[_0x2751c6[_0xc8ab('0x10')]()]+_0xc8ab('0x20'),_0xa5a73f);return new Promise(function(_0x12f075,_0x31e6db){var _0x4852a8={'method':_0xc8ab('0x21'),'uri':_0x23c4e9+'sys_user?'+_0xb79ede,'body':{'user_name':_0xa5a73f[_0xc8ab('0x22')],'roles':_0xc8ab('0x23'),'first_name':_0xa5a73f['endUserNumber'],'active':'true','date_format':_0xc8ab('0x24'),'phone':_0xa5a73f[_0xc8ab('0x22')]},'auth':_0x280c5c,'json':!![]};return rp(_0x4852a8)[_0xc8ab('0x25')](function(_0x239211){logger[_0xc8ab('0xf')]('['+[_0x2751c6[_0xc8ab('0x10')]()]+_0xc8ab('0x26'),_0x239211[_0xc8ab('0xd')]);_0xa5a73f[_0xc8ab('0x27')]=_0x239211[_0xc8ab('0xd')][_0xc8ab('0xe')];_0x12f075(_0xa5a73f);})[_0xc8ab('0x12')](function(_0x3e9135){logger['error']('['+[_0x2751c6[_0xc8ab('0x10')]()]+']',_0x3e9135[_0xc8ab('0x14')]);_0x31e6db(_0x3e9135[_0xc8ab('0x14')]);});});}function getEndUser(_0x22b836,_0xf5b28d,_0x4e5f02,_0x153003,_0x17bebc){return function(_0xb3453a){logger[_0xc8ab('0xf')]('['+[_0x22b836[_0xc8ab('0x10')]()]+_0xc8ab('0x28'),_0xb3453a);return new Promise(function(_0x190b7e,_0x4232d9){var _0x22542a={'method':_0xc8ab('0x9'),'uri':_0x4e5f02+_0xc8ab('0x29')+_0xb3453a[_0xc8ab('0x22')]+'&'+_0x153003+'&'+_0x17bebc,'auth':_0xf5b28d,'json':!![]};return rp(_0x22542a)['then'](function(_0x1551c4){if(_0x1551c4[_0xc8ab('0xd')][_0xc8ab('0xb')]>0x0){_0xb3453a[_0xc8ab('0x27')]=_0x1551c4[_0xc8ab('0xd')][0x0][_0xc8ab('0xe')];logger[_0xc8ab('0xf')]('['+[_0x22b836[_0xc8ab('0x10')]()]+_0xc8ab('0x2a'),_0xb3453a);_0x190b7e(_0xb3453a);}else{return createEndUser(_0x22b836,_0xf5b28d,_0xb3453a,_0x4e5f02,_0x153003)[_0xc8ab('0x25')](function(_0x28a772){logger['info']('['+[_0x22b836[_0xc8ab('0x10')]()]+_0xc8ab('0x2b'),_0x28a772);_0x190b7e(_0x28a772);});}})[_0xc8ab('0x12')](function(_0x374b37){logger[_0xc8ab('0x13')]('['+[_0x22b836['toUpperCase']()]+']',_0x374b37[_0xc8ab('0x14')]);_0x4232d9(_0x374b37[_0xc8ab('0x14')]);});});};}function getCustomFields(_0x300212,_0x19957d){var _0x19f069={};if(_0x300212[_0xc8ab('0xb')]>0x0){_[_0xc8ab('0x2c')](_0x300212,function(_0x352a01){if(_[_0xc8ab('0x2d')]([_0xc8ab('0x2e'),_0xc8ab('0x2f')],_0x352a01[_0xc8ab('0x30')])&&_0x352a01[_0xc8ab('0x31')]&&!_0x352a01[_0xc8ab('0x32')]){_0x19f069[_0x352a01['nameField'][_0xc8ab('0x33')]()]=_0x352a01[_0xc8ab('0x34')]['toString']();}else if(_[_0xc8ab('0x2d')](['string',_0xc8ab('0x2f')],_0x352a01[_0xc8ab('0x30')])&&_0x352a01['idField']&&_0x352a01[_0xc8ab('0x32')]){_0x19f069[_0x352a01[_0xc8ab('0x35')]['toLowerCase']()]=_0x352a01[_0xc8ab('0x34')]['toString']();}else if(_0x352a01[_0xc8ab('0x30')]==='variable'&&_0x352a01[_0xc8ab('0x36')]&&_0x352a01['idField']&&_0x352a01[_0xc8ab('0x32')]){_0x19f069[_0x352a01[_0xc8ab('0x35')][_0xc8ab('0x33')]()]=_0x19957d[_0x352a01[_0xc8ab('0x36')]][_0xc8ab('0x37')]();}else if(_0x352a01[_0xc8ab('0x30')]===_0xc8ab('0x38')&&_0x352a01[_0xc8ab('0x39')]&&_0x352a01[_0xc8ab('0x39')][_0xc8ab('0x3a')]&&_0x352a01[_0xc8ab('0x35')]&&_0x352a01[_0xc8ab('0x32')]){_0x19f069[_0x352a01[_0xc8ab('0x35')][_0xc8ab('0x33')]()]=_0x19957d[_0x352a01[_0xc8ab('0x39')]['name'][_0xc8ab('0x33')]()][_0xc8ab('0x37')]();}});}return _0x19f069;}function getTicket(_0x18dfec,_0xb16651,_0x272443,_0x1be4ad,_0x36e0ea,_0x3e9643){return function(_0x1a26bc){logger[_0xc8ab('0xf')]('['+[_0x18dfec[_0xc8ab('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x1a26bc);return new Promise(function(_0x234ee4,_0x393abe){var _0x4ef82d=_0x18dfec[_0xc8ab('0x33')]()===_0xc8ab('0x3b')?_0x1a26bc[_0xc8ab('0x1d')]:_0x1a26bc[_0xc8ab('0x27')];var _0x4b0139={'method':'POST','uri':_0x272443+_0xc8ab('0x3c')+'?'+_0x3e9643,'body':Object[_0xc8ab('0x3d')]({},{'active':_0xc8ab('0x1c'),'caller_id':_0x4ef82d,'assigned_to':_0x1a26bc[_0xc8ab('0x1d')],'short_description':intUtil['getString'](_0x1be4ad[_0xc8ab('0x3e')],_0x36e0ea,'\x20'),'description':intUtil[_0xc8ab('0x3f')](_0x1be4ad[_0xc8ab('0x40')],_0x36e0ea,'\x0a')},getCustomFields(_0x1be4ad[_0xc8ab('0x41')],_0x36e0ea)),'auth':_0xb16651,'json':!![]};return rp(_0x4b0139)[_0xc8ab('0x25')](function(_0x50da89){logger[_0xc8ab('0xf')]('['+[_0x18dfec[_0xc8ab('0x10')]()]+_0xc8ab('0x42'),_0x50da89['result']);_0x1a26bc['ticketId']=_0x50da89['result'][_0xc8ab('0xe')];_0x1a26bc[_0xc8ab('0x43')]=_0x50da89['result'][_0xc8ab('0x44')];logger[_0xc8ab('0xf')]('['+[_0x18dfec[_0xc8ab('0x10')]()]+_0xc8ab('0x45'),_0x1a26bc);_0x234ee4(_0x1a26bc);})[_0xc8ab('0x12')](function(_0x352f44){logger[_0xc8ab('0x13')]('['+[_0x18dfec[_0xc8ab('0x10')]()]+']',_0x352f44[_0xc8ab('0x14')]);_0x393abe(_0x352f44['message']);});});};}function createRemoteTag(_0x585675,_0x745ed4,_0x590e56,_0x30ae38){return new Promise(function(_0x2ceeaa,_0x2e8bc6){var _0x534681={'method':'POST','uri':_0x590e56+_0xc8ab('0x46')+'?'+_0x30ae38,'body':{'short_description':_0x585675,'global':!![],'active':!![],'name':_0x585675},'auth':_0x745ed4,'json':!![]};return rp(_0x534681)[_0xc8ab('0x25')](function(_0x123655){var _0x4d3a9a=_0x123655[_0xc8ab('0xd')][_0xc8ab('0xe')];_0x2ceeaa(_0x4d3a9a);});});}function getRemoteTag(_0x2dd327,_0x4d9c68,_0x326627,_0xda1e22,_0x5bf96a){return new Promise(function(_0x5efeb7,_0x640854){var _0x4abbfc={'method':_0xc8ab('0x9'),'uri':_0x326627+'label'+_0xc8ab('0x47')+_0x2dd327+'&'+_0xda1e22,'auth':_0x4d9c68,'json':!![]};return rp(_0x4abbfc)[_0xc8ab('0x25')](function(_0x20883d){if(_0x20883d[_0xc8ab('0xd')][_0xc8ab('0xb')]>0x0){var _0x88b6f1=_0x20883d[_0xc8ab('0xd')][0x0]['sys_id'];_0x5efeb7(_0x88b6f1);}else{return createRemoteTag(_0x2dd327,_0x4d9c68,_0x326627,_0xda1e22)[_0xc8ab('0x25')](function(_0x4f36e2){_0x5efeb7(_0x4f36e2);});}});});}function assignTagToIncident(_0x1242c5,_0x3f3960,_0x5a392b,_0x4a5caa,_0x2f4edc){return new Promise(function(_0x52ba49,_0x5a33cb){var _0x1e36f3={'method':'POST','uri':_0x5a392b+_0xc8ab('0x48')+'?'+_0x2f4edc,'body':{'label':_0x1242c5,'table':_0xc8ab('0x3c'),'id_type':'Incident','table_key':_0x4a5caa[_0xc8ab('0x49')],'title':_0xc8ab('0x4a')+_0x4a5caa['ticketNumber'],'id_display':_0x4a5caa['ticketNumber']},'auth':_0x3f3960,'json':!![]};return rp(_0x1e36f3)['then'](function(_0x194f70){_0x52ba49();})[_0xc8ab('0x12')](function(){_0x52ba49();});});}function manageTags(_0x119781,_0x13fa0e,_0x577f54,_0x543c60,_0x1a83c6,_0x33a51c,_0x52e6e5){return new Promise(function(_0x180d4d,_0x1d114d){var _0x4948d5=[];_0x13fa0e[_0xc8ab('0x2c')](function(_0x2267c1){_0x4948d5[_0xc8ab('0x4b')](getRemoteTag(_0x2267c1,_0x577f54,_0x543c60,_0x33a51c,_0x52e6e5));});return Promise['all'](_0x4948d5)['then'](function(_0x18ddc3){if(_0x18ddc3[_0xc8ab('0xb')]){logger[_0xc8ab('0xf')]('['+[_0x119781[_0xc8ab('0x10')]()]+_0xc8ab('0x4c'),_0x18ddc3);var _0x512edd=[];_0x18ddc3[_0xc8ab('0x2c')](function(_0x8ed0d4){_0x512edd[_0xc8ab('0x4b')](assignTagToIncident(_0x8ed0d4,_0x577f54,_0x543c60,_0x1a83c6,_0x33a51c));});return Promise[_0xc8ab('0x4d')](_0x512edd)[_0xc8ab('0x25')](function(){_0x180d4d();})['catch'](function(){_0x180d4d();});}else{_0x180d4d();}});});}function getTags(_0x144055,_0x50cc26,_0x44be9b,_0x53f5db,_0x1a3ce7,_0xb66710){return function(_0x1c29e0){return new Promise(function(_0x4ac522,_0x13ef67){var _0x1ac12d=[];var _0x1d7da6=_0x53f5db[_0xc8ab('0x4e')];if(_0x1d7da6&&_0x1d7da6[_0xc8ab('0xb')]>0x0){_0x1ac12d=_[_0xc8ab('0x4f')](_0x1d7da6,_0xc8ab('0x3a'));}if(_0x1ac12d[_0xc8ab('0xb')]>0x0){return manageTags(_0x144055,_0x1ac12d,_0x50cc26,_0x44be9b,_0x1c29e0,_0x1a3ce7,_0xb66710)[_0xc8ab('0x25')](function(){_0x4ac522(_0x1c29e0);});}else{_0x4ac522(_0x1c29e0);}});};}function emit(_0x4a11d1,_0x4b272f,_0xeea841){var _0x36c2a6=_0xc8ab('0x50')+_0xc8ab('0x51')+_0xc8ab('0x52')+'%255EORDERBYDESCnumber';var _0x393afc={'uri':_0x4a11d1+_0xc8ab('0x53')+_0xeea841+_0x36c2a6};io['to'](util[_0xc8ab('0x54')](_0xc8ab('0x55'),_0x4b272f))[_0xc8ab('0x56')](_0xc8ab('0x57'),_0x393afc);}exports['cs']=function(_0x11f13d,_0x51baec,_0x343ea0,_0x5bda6f,_0x3e0de9,_0x5f145a,_0x25d67b,_0x490913){var _0x394ff6={};var _0x5ef9c0={'user':_0x5f145a[_0xc8ab('0x58')],'pass':_0x5f145a[_0xc8ab('0x59')]};var _0x32f526='sysparm_limit=1';var _0x4f73cd='sysparm_display_value=true';_0x5f145a['remoteUri']=intUtil[_0xc8ab('0x5a')](_0x5f145a[_0xc8ab('0x5b')]);_0x5f145a['serverUrl']=intUtil[_0xc8ab('0x5a')](_0x5f145a[_0xc8ab('0x5c')]);var _0x2cd1f2=util[_0xc8ab('0x54')]('%s/api/now/table/',_0x5f145a['remoteUri']);_0x394ff6[_0xc8ab('0x17')]=!_[_0xc8ab('0x5d')](_0x5bda6f)?_0x5bda6f[_0xc8ab('0x5e')]:null;_0x394ff6['adminEmail']=_0x5f145a[_0xc8ab('0x5e')];_0x394ff6[_0xc8ab('0x22')]=_0x490913[_0xc8ab('0x33')]()==='outbound'?_0x51baec['destcalleridnum']:_0x51baec[_0xc8ab('0x5f')];_0x394ff6[_0xc8ab('0x60')]=_0x490913===_0xc8ab('0x61')||_0x490913===_0xc8ab('0x62')?_0xc8ab('0x61'):_0xc8ab('0x3b');var _0xee12c5=util[_0xc8ab('0x54')](_0xc8ab('0x63'),_0x5f145a[_0xc8ab('0x5c')],_0x51baec[_0xc8ab('0x64')],md5(_0x51baec[_0xc8ab('0x64')]));if(_0x3e0de9&&_0x3e0de9[_0xc8ab('0x65')]){logger['info'](_0xc8ab('0x66'),_0xc8ab('0x67'));_0x51baec[_0xc8ab('0x68')]=_0xee12c5;}else if(_0x25d67b&&_0x25d67b[_0xc8ab('0x69')]&&_0x25d67b['recordingFormat']!==_0xc8ab('0x6a')){logger['info']('[OUTBOUND]',_0xc8ab('0x67'));_0x51baec['recordingURL']=_0xee12c5;}else{_0x51baec[_0xc8ab('0x68')]='';}return getAdminUser(_0x490913,_0x5ef9c0,_0x394ff6,_0x2cd1f2,_0x4f73cd,_0x32f526)[_0xc8ab('0x25')](getUser(_0x490913,_0x5ef9c0,_0x2cd1f2,_0x4f73cd,_0x32f526))[_0xc8ab('0x25')](getEndUser(_0x490913,_0x5ef9c0,_0x2cd1f2,_0x4f73cd,_0x32f526))[_0xc8ab('0x25')](getTicket(_0x490913,_0x5ef9c0,_0x2cd1f2,_0x343ea0,_0x51baec,_0x4f73cd))[_0xc8ab('0x25')](function(_0x9f4cdb){logger[_0xc8ab('0xf')](util['format'](_0xc8ab('0x6b'),_0x9f4cdb['ticketId']));logger[_0xc8ab('0xf')](util[_0xc8ab('0x54')](_0xc8ab('0x6c'),_0x490913));if(_0x490913!=='unmanaged'){logger[_0xc8ab('0xf')]('['+[_0x490913['toUpperCase']()]+']',_0xc8ab('0x6d'));emit(_0x5f145a['remoteUri'],_0x5bda6f['name'],_0x9f4cdb['ticketId']);}})[_0xc8ab('0x12')](function(_0x1f3c0f){logger[_0xc8ab('0x13')]('['+[_0x490913[_0xc8ab('0x10')]()]+_0xc8ab('0x6e'),util[_0xc8ab('0x6f')](_0x1f3c0f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3d7a=['then','result','length','adminId','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','sys_id','userId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','customField','nameField','toLowerCase','content','toString','string','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','format','emit','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','md5','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x3d7a,0x132));var _0xa3d7=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0x3d7a[_0x3ae2b2];return _0x1dbf00;};'use strict';var _=require(_0xa3d7('0x0'));var Promise=require(_0xa3d7('0x1'));var rp=require(_0xa3d7('0x2'));var util=require('util');var md5=require(_0xa3d7('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xa3d7('0x4'));var logger=require(_0xa3d7('0x5'))('servicenow');config[_0xa3d7('0x6')]=_[_0xa3d7('0x7')](config[_0xa3d7('0x6')],{'host':_0xa3d7('0x8'),'port':0x18eb});var io=require(_0xa3d7('0x9'))(new Redis(config[_0xa3d7('0x6')]));function getAdminUser(_0x17b84d,_0xf4bb98,_0x1764b9,_0xefc616,_0xabc978,_0x1f9d72){return new Promise(function(_0xd04c0f,_0xf320c3){var _0x27eefb={'method':_0xa3d7('0xa'),'uri':_0xefc616+_0xa3d7('0xb')+'&'+_0xabc978+'&'+_0x1f9d72,'auth':_0xf4bb98,'json':!![]};return rp(_0x27eefb)[_0xa3d7('0xc')](function(_0x1c3026){if(_0x1c3026[_0xa3d7('0xd')][_0xa3d7('0xe')]>0x0){_0x1764b9[_0xa3d7('0xf')]=_0x1c3026['result'][0x0]['sys_id'];}logger[_0xa3d7('0x10')]('['+[_0x17b84d[_0xa3d7('0x11')]()]+'],\x20getAdminUser\x20crm',_0x1764b9);_0xd04c0f(_0x1764b9);})[_0xa3d7('0x12')](function(_0xf8d07d){logger[_0xa3d7('0x13')]('['+[_0x17b84d[_0xa3d7('0x11')]()]+']',_0xf8d07d[_0xa3d7('0x14')]);_0xf320c3(_0xf8d07d[_0xa3d7('0x14')]);});});}function getUser(_0x409f45,_0x517f3b,_0x31c9c9,_0x1ac402,_0x3e7b56){return function(_0x34040b){logger['info']('['+[_0x409f45[_0xa3d7('0x11')]()]+_0xa3d7('0x15'),_0x34040b);return new Promise(function(_0x518e94,_0x47d331){if(intUtil[_0xa3d7('0x16')](_0x34040b[_0xa3d7('0x17')])){var _0x120668={'method':'GET','uri':_0x31c9c9+_0xa3d7('0x18')+_0x34040b[_0xa3d7('0x17')]+'&'+_0x1ac402+'&'+_0x3e7b56,'auth':_0x517f3b,'json':!![]};logger[_0xa3d7('0x10')]('['+[_0x409f45[_0xa3d7('0x11')]()]+_0xa3d7('0x19'),_0x120668);return rp(_0x120668)[_0xa3d7('0xc')](function(_0x517fca){logger['info']('['+[_0x409f45[_0xa3d7('0x11')]()]+_0xa3d7('0x1a'),_0x517fca);if(_0x517fca['result'][_0xa3d7('0xe')]>0x0&&String(_0x517fca[_0xa3d7('0xd')][0x0][_0xa3d7('0x1b')])===_0xa3d7('0x1c')){_0x34040b['userId']=_0x517fca[_0xa3d7('0xd')][0x0][_0xa3d7('0x1d')];}else{_0x34040b[_0xa3d7('0x1e')]=_0x34040b['adminId'];_0x34040b[_0xa3d7('0x17')]=_0x34040b['adminEmail'];}logger['info']('['+[_0x409f45[_0xa3d7('0x11')]()]+'],\x20getUser\x20crm',_0x34040b);_0x518e94(_0x34040b);})[_0xa3d7('0x12')](function(_0x4fe746){logger['error']('['+[_0x409f45[_0xa3d7('0x11')]()]+']',_0x4fe746[_0xa3d7('0x14')]);_0x47d331(_0x4fe746[_0xa3d7('0x14')]);});}else{logger[_0xa3d7('0x10')]('['+[_0x409f45[_0xa3d7('0x11')]()]+_0xa3d7('0x1f'));_0x34040b[_0xa3d7('0x1e')]=_0x34040b['adminId'];_0x34040b[_0xa3d7('0x17')]=_0x34040b[_0xa3d7('0x20')];_0x518e94(_0x34040b);}});};}function createEndUser(_0x5e9f84,_0x38011e,_0x3fb55e,_0x33c67f,_0x3660b1){logger['info']('['+[_0x5e9f84['toUpperCase']()]+_0xa3d7('0x21'),_0x3fb55e);return new Promise(function(_0x384f30,_0x44e88c){var _0x2aba2c={'method':'POST','uri':_0x33c67f+_0xa3d7('0x22')+_0x3660b1,'body':{'user_name':_0x3fb55e['endUserNumber'],'roles':_0xa3d7('0x23'),'first_name':_0x3fb55e[_0xa3d7('0x24')],'active':_0xa3d7('0x1c'),'date_format':_0xa3d7('0x25'),'phone':_0x3fb55e[_0xa3d7('0x24')]},'auth':_0x38011e,'json':!![]};return rp(_0x2aba2c)[_0xa3d7('0xc')](function(_0x54c0db){logger[_0xa3d7('0x10')]('['+[_0x5e9f84[_0xa3d7('0x11')]()]+_0xa3d7('0x26'),_0x54c0db[_0xa3d7('0xd')]);_0x3fb55e[_0xa3d7('0x27')]=_0x54c0db[_0xa3d7('0xd')]['sys_id'];_0x384f30(_0x3fb55e);})['catch'](function(_0x257fb3){logger[_0xa3d7('0x13')]('['+[_0x5e9f84['toUpperCase']()]+']',_0x257fb3[_0xa3d7('0x14')]);_0x44e88c(_0x257fb3[_0xa3d7('0x14')]);});});}function getEndUser(_0xe616f,_0x42751d,_0x25032f,_0x2a9fb4,_0x48c777){return function(_0x4792f8){logger[_0xa3d7('0x10')]('['+[_0xe616f[_0xa3d7('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x4792f8);return new Promise(function(_0x2133bf,_0x2cdae3){var _0x5e9bfa={'method':_0xa3d7('0xa'),'uri':_0x25032f+_0xa3d7('0x28')+_0x4792f8[_0xa3d7('0x24')]+'&'+_0x2a9fb4+'&'+_0x48c777,'auth':_0x42751d,'json':!![]};return rp(_0x5e9bfa)[_0xa3d7('0xc')](function(_0xffc2b9){if(_0xffc2b9[_0xa3d7('0xd')][_0xa3d7('0xe')]>0x0){_0x4792f8['endUserId']=_0xffc2b9[_0xa3d7('0xd')][0x0][_0xa3d7('0x1d')];logger['info']('['+[_0xe616f[_0xa3d7('0x11')]()]+_0xa3d7('0x29'),_0x4792f8);_0x2133bf(_0x4792f8);}else{return createEndUser(_0xe616f,_0x42751d,_0x4792f8,_0x25032f,_0x2a9fb4)[_0xa3d7('0xc')](function(_0x3fcf7f){logger[_0xa3d7('0x10')]('['+[_0xe616f['toUpperCase']()]+_0xa3d7('0x2a'),_0x3fcf7f);_0x2133bf(_0x3fcf7f);});}})['catch'](function(_0x5dff28){logger[_0xa3d7('0x13')]('['+[_0xe616f[_0xa3d7('0x11')]()]+']',_0x5dff28[_0xa3d7('0x14')]);_0x2cdae3(_0x5dff28['message']);});});};}function getCustomFields(_0x39c6a1,_0x3de87b){var _0x1a1908={};if(_0x39c6a1[_0xa3d7('0xe')]>0x0){_[_0xa3d7('0x2b')](_0x39c6a1,function(_0x274c0b){if(_[_0xa3d7('0x2c')](['string',_0xa3d7('0x2d')],_0x274c0b[_0xa3d7('0x2e')])&&_0x274c0b['nameField']&&!_0x274c0b[_0xa3d7('0x2f')]){_0x1a1908[_0x274c0b[_0xa3d7('0x30')][_0xa3d7('0x31')]()]=_0x274c0b[_0xa3d7('0x32')][_0xa3d7('0x33')]();}else if(_['includes']([_0xa3d7('0x34'),_0xa3d7('0x2d')],_0x274c0b['type'])&&_0x274c0b[_0xa3d7('0x35')]&&_0x274c0b[_0xa3d7('0x2f')]){_0x1a1908[_0x274c0b['idField'][_0xa3d7('0x31')]()]=_0x274c0b[_0xa3d7('0x32')][_0xa3d7('0x33')]();}else if(_0x274c0b[_0xa3d7('0x2e')]===_0xa3d7('0x36')&&_0x274c0b[_0xa3d7('0x37')]&&_0x274c0b['idField']&&_0x274c0b[_0xa3d7('0x2f')]){_0x1a1908[_0x274c0b[_0xa3d7('0x35')][_0xa3d7('0x31')]()]=_0x3de87b[_0x274c0b['variableName']][_0xa3d7('0x33')]();}else if(_0x274c0b[_0xa3d7('0x2e')]==='customVariable'&&_0x274c0b[_0xa3d7('0x38')]&&_0x274c0b[_0xa3d7('0x38')][_0xa3d7('0x39')]&&_0x274c0b[_0xa3d7('0x35')]&&_0x274c0b[_0xa3d7('0x2f')]){_0x1a1908[_0x274c0b[_0xa3d7('0x35')][_0xa3d7('0x31')]()]=_0x3de87b[_0x274c0b[_0xa3d7('0x38')][_0xa3d7('0x39')][_0xa3d7('0x31')]()][_0xa3d7('0x33')]();}});}return _0x1a1908;}function getTicket(_0x50bbe2,_0x28404d,_0x14f14b,_0x55e999,_0x56b8ef,_0x2a11c1){return function(_0x46df7a){logger[_0xa3d7('0x10')]('['+[_0x50bbe2[_0xa3d7('0x11')]()]+_0xa3d7('0x3a'),_0x46df7a);return new Promise(function(_0x24efa5,_0x81bcc5){var _0x99ca86=_0x50bbe2['toLowerCase']()===_0xa3d7('0x3b')?_0x46df7a[_0xa3d7('0x1e')]:_0x46df7a[_0xa3d7('0x27')];var _0x5f4179={'method':'POST','uri':_0x14f14b+_0xa3d7('0x3c')+'?'+_0x2a11c1,'body':Object['assign']({},{'active':'true','caller_id':_0x99ca86,'assigned_to':_0x46df7a['userId'],'short_description':intUtil[_0xa3d7('0x3d')](_0x55e999[_0xa3d7('0x3e')],_0x56b8ef,'\x20'),'description':intUtil['getString'](_0x55e999[_0xa3d7('0x3f')],_0x56b8ef,'\x0a')},getCustomFields(_0x55e999[_0xa3d7('0x40')],_0x56b8ef)),'auth':_0x28404d,'json':!![]};return rp(_0x5f4179)[_0xa3d7('0xc')](function(_0x15c1bb){logger[_0xa3d7('0x10')]('['+[_0x50bbe2[_0xa3d7('0x11')]()]+_0xa3d7('0x41'),_0x15c1bb[_0xa3d7('0xd')]);_0x46df7a[_0xa3d7('0x42')]=_0x15c1bb[_0xa3d7('0xd')]['sys_id'];_0x46df7a[_0xa3d7('0x43')]=_0x15c1bb['result']['number'];logger[_0xa3d7('0x10')]('['+[_0x50bbe2[_0xa3d7('0x11')]()]+_0xa3d7('0x44'),_0x46df7a);_0x24efa5(_0x46df7a);})[_0xa3d7('0x12')](function(_0x453e97){logger[_0xa3d7('0x13')]('['+[_0x50bbe2[_0xa3d7('0x11')]()]+']',_0x453e97[_0xa3d7('0x14')]);_0x81bcc5(_0x453e97['message']);});});};}function createRemoteTag(_0x58776c,_0x3b3b98,_0x4b33a2,_0x567553){return new Promise(function(_0x108b70,_0x1a0bbe){var _0x55d457={'method':_0xa3d7('0x45'),'uri':_0x4b33a2+_0xa3d7('0x46')+'?'+_0x567553,'body':{'short_description':_0x58776c,'global':!![],'active':!![],'name':_0x58776c},'auth':_0x3b3b98,'json':!![]};return rp(_0x55d457)['then'](function(_0x5832aa){var _0x1b4153=_0x5832aa['result'][_0xa3d7('0x1d')];_0x108b70(_0x1b4153);});});}function getRemoteTag(_0x263eb8,_0x517195,_0x2814fb,_0x28cb4d,_0x53a223){return new Promise(function(_0x6a6b6f,_0x54acb6){var _0x18db00={'method':_0xa3d7('0xa'),'uri':_0x2814fb+_0xa3d7('0x46')+_0xa3d7('0x47')+_0x263eb8+'&'+_0x28cb4d,'auth':_0x517195,'json':!![]};return rp(_0x18db00)[_0xa3d7('0xc')](function(_0x246de5){if(_0x246de5['result'][_0xa3d7('0xe')]>0x0){var _0x926f57=_0x246de5[_0xa3d7('0xd')][0x0][_0xa3d7('0x1d')];_0x6a6b6f(_0x926f57);}else{return createRemoteTag(_0x263eb8,_0x517195,_0x2814fb,_0x28cb4d)[_0xa3d7('0xc')](function(_0xbe5a2b){_0x6a6b6f(_0xbe5a2b);});}});});}function assignTagToIncident(_0x4fe5b7,_0x446d71,_0x5c0eb0,_0x4139de,_0x4bf6a8){return new Promise(function(_0x423d92,_0x1be45b){var _0x22e91e={'method':'POST','uri':_0x5c0eb0+'label_entry'+'?'+_0x4bf6a8,'body':{'label':_0x4fe5b7,'table':_0xa3d7('0x3c'),'id_type':_0xa3d7('0x48'),'table_key':_0x4139de[_0xa3d7('0x42')],'title':_0xa3d7('0x49')+_0x4139de['ticketNumber'],'id_display':_0x4139de[_0xa3d7('0x43')]},'auth':_0x446d71,'json':!![]};return rp(_0x22e91e)[_0xa3d7('0xc')](function(_0x3db40a){_0x423d92();})[_0xa3d7('0x12')](function(){_0x423d92();});});}function manageTags(_0x2bf5c9,_0x291c10,_0x10ac16,_0x150bd7,_0x2adc03,_0x3fe4f8,_0x31dbfd){return new Promise(function(_0x321eb2,_0x5aa885){var _0x3574f6=[];_0x291c10[_0xa3d7('0x2b')](function(_0x1270f9){_0x3574f6[_0xa3d7('0x4a')](getRemoteTag(_0x1270f9,_0x10ac16,_0x150bd7,_0x3fe4f8,_0x31dbfd));});return Promise[_0xa3d7('0x4b')](_0x3574f6)[_0xa3d7('0xc')](function(_0x494e49){if(_0x494e49[_0xa3d7('0xe')]){logger['info']('['+[_0x2bf5c9['toUpperCase']()]+_0xa3d7('0x4c'),_0x494e49);var _0x28a4ce=[];_0x494e49[_0xa3d7('0x2b')](function(_0x46e5b7){_0x28a4ce[_0xa3d7('0x4a')](assignTagToIncident(_0x46e5b7,_0x10ac16,_0x150bd7,_0x2adc03,_0x3fe4f8));});return Promise[_0xa3d7('0x4b')](_0x28a4ce)[_0xa3d7('0xc')](function(){_0x321eb2();})[_0xa3d7('0x12')](function(){_0x321eb2();});}else{_0x321eb2();}});});}function getTags(_0x409290,_0x124e03,_0x5c046d,_0x437071,_0x13adb1,_0x1b22ac){return function(_0x259962){return new Promise(function(_0x19b21b,_0x3e8637){var _0x1869ef=[];var _0x44b818=_0x437071[_0xa3d7('0x4d')];if(_0x44b818&&_0x44b818[_0xa3d7('0xe')]>0x0){_0x1869ef=_['map'](_0x44b818,_0xa3d7('0x39'));}if(_0x1869ef[_0xa3d7('0xe')]>0x0){return manageTags(_0x409290,_0x1869ef,_0x124e03,_0x5c046d,_0x259962,_0x13adb1,_0x1b22ac)[_0xa3d7('0xc')](function(){_0x19b21b(_0x259962);});}else{_0x19b21b(_0x259962);}});};}function emit(_0x5d71db,_0x808d17,_0x473918){var _0x411fc0=_0xa3d7('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x370097={'uri':_0x5d71db+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x473918+_0x411fc0};io['to'](util[_0xa3d7('0x4f')]('user:%s',_0x808d17))[_0xa3d7('0x50')]('trigger:browser:url',_0x370097);}exports['cs']=function(_0x388512,_0x51a81c,_0x263ff9,_0xf4cc32,_0x24fd6d,_0x365b9,_0x2c658a,_0x33595b){var _0x5530c7={};var _0x42cd00={'user':_0x365b9[_0xa3d7('0x51')],'pass':_0x365b9[_0xa3d7('0x52')]};var _0x571185=_0xa3d7('0x53');var _0x12bc1b='sysparm_display_value=true';_0x365b9[_0xa3d7('0x54')]=intUtil['stripTrailingSlash'](_0x365b9[_0xa3d7('0x54')]);_0x365b9[_0xa3d7('0x55')]=intUtil[_0xa3d7('0x56')](_0x365b9[_0xa3d7('0x55')]);var _0x3004b1=util['format'](_0xa3d7('0x57'),_0x365b9[_0xa3d7('0x54')]);_0x5530c7['userEmail']=!_['isNil'](_0xf4cc32)?_0xf4cc32[_0xa3d7('0x58')]:null;_0x5530c7[_0xa3d7('0x20')]=_0x365b9[_0xa3d7('0x58')];_0x5530c7[_0xa3d7('0x24')]=_0x33595b['toLowerCase']()===_0xa3d7('0x3b')?_0x51a81c[_0xa3d7('0x59')]:_0x51a81c[_0xa3d7('0x5a')];_0x5530c7[_0xa3d7('0x5b')]=_0x33595b===_0xa3d7('0x5c')||_0x33595b==='unmanaged'?_0xa3d7('0x5c'):_0xa3d7('0x3b');var _0xaaa77b=util['format'](_0xa3d7('0x5d'),_0x365b9['serverUrl'],_0x51a81c[_0xa3d7('0x5e')],md5(_0x51a81c[_0xa3d7('0x5e')]));if(_0x24fd6d&&_0x24fd6d[_0xa3d7('0x5f')]){logger[_0xa3d7('0x10')](_0xa3d7('0x60'),_0xa3d7('0x61'));_0x51a81c[_0xa3d7('0x62')]=_0xaaa77b;}else if(_0x2c658a&&_0x2c658a[_0xa3d7('0x63')]&&_0x2c658a[_0xa3d7('0x63')]!=='none'){logger[_0xa3d7('0x10')](_0xa3d7('0x64'),'Recording\x20is\x20enabled!');_0x51a81c[_0xa3d7('0x62')]=_0xaaa77b;}else{_0x51a81c['recordingURL']='';}return getAdminUser(_0x33595b,_0x42cd00,_0x5530c7,_0x3004b1,_0x12bc1b,_0x571185)[_0xa3d7('0xc')](getUser(_0x33595b,_0x42cd00,_0x3004b1,_0x12bc1b,_0x571185))[_0xa3d7('0xc')](getEndUser(_0x33595b,_0x42cd00,_0x3004b1,_0x12bc1b,_0x571185))[_0xa3d7('0xc')](getTicket(_0x33595b,_0x42cd00,_0x3004b1,_0x263ff9,_0x51a81c,_0x12bc1b))[_0xa3d7('0xc')](function(_0xcdcd90){logger[_0xa3d7('0x10')](util[_0xa3d7('0x4f')](_0xa3d7('0x65'),_0xcdcd90['ticketId']));logger[_0xa3d7('0x10')](util['format'](_0xa3d7('0x66'),_0x33595b));if(_0x33595b!==_0xa3d7('0x67')){logger[_0xa3d7('0x10')]('['+[_0x33595b[_0xa3d7('0x11')]()]+']',_0xa3d7('0x68'));emit(_0x365b9['remoteUri'],_0xf4cc32[_0xa3d7('0x39')],_0xcdcd90[_0xa3d7('0x42')]);}})[_0xa3d7('0x12')](function(_0x489f69){logger[_0xa3d7('0x13')]('['+[_0x33595b[_0xa3d7('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xa3d7('0x69')](_0x489f69,{'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 1a970ed..a9bed5c 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 _0xb895=['Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','trigger:browser:url','catch','recordingFormat','none','destcalleridname','Outbound','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','unmanaged','monitor_format','lastevent','toUpperCase','users','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','Descriptions','slice','replace','duration_hours','duration_minutes','parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','user_name','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','value','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','map','string','nameField','customField','toLowerCase','content','type','variable','custom_fields','customVariable','Variable','POST','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb895,0x1e6));var _0x5b89=function(_0xe25c01,_0x3c30e1){_0xe25c01=_0xe25c01-0x0;var _0x5a5fbb=_0xb895[_0xe25c01];return _0x5a5fbb;};'use strict';var _=require('lodash');var rp=require(_0x5b89('0x0'));var BPromise=require(_0x5b89('0x1'));var md5=require(_0x5b89('0x2'));var util=require('util');var Redis=require(_0x5b89('0x3'));var intUtil=require(_0x5b89('0x4'));var config=require(_0x5b89('0x5'));var logger=require('../../../../config/logger')(_0x5b89('0x6'));config['redis']=_['defaults'](config[_0x5b89('0x7')],{'host':_0x5b89('0x8'),'port':0x18eb});var io=require(_0x5b89('0x9'))(new Redis(config[_0x5b89('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x59c365,_0x4b5c0a,_0x909736){io['to'](_0x59c365)['emit'](_0x4b5c0a,_0x909736);}function getTicket(_0x125c1f,_0x29aa67,_0x1ef93a,_0x1d5c0a,_0x504f87,_0x5d1be7,_0xe49cde,_0x5244f4){logger[_0x5b89('0xa')](_0x5b89('0xb'));var _0x21df75=new Date();var _0x564250=[{'name':_0x5b89('0xc'),'value':intUtil[_0x5b89('0xd')](_0x1d5c0a['Subjects'],_0x504f87,'\x20')},{'name':_0x5b89('0xe'),'value':_0x29aa67['id']},{'name':'created_by','value':_0x29aa67['id']},{'name':_0x5b89('0xf'),'value':intUtil[_0x5b89('0xd')](_0x1d5c0a[_0x5b89('0x10')],_0x504f87,'\x0a')},{'name':'date_start','value':_0x21df75['toISOString']()[_0x5b89('0x11')](0x0,0x13)[_0x5b89('0x12')]('T','\x20')},{'name':_0x5b89('0x13'),'value':'0'},{'name':_0x5b89('0x14'),'value':'15'},{'name':'parent_id','value':_0x1ef93a['id']},{'name':_0x5b89('0x15'),'value':'Contacts'},{'name':_0x5b89('0x16'),'value':_0x1ef93a[_0x5b89('0xc')]},{'name':_0x5b89('0x17'),'value':_0x5244f4}];if(_0x5d1be7[_0x5b89('0x18')]){_[_0x5b89('0x19')](_0x5d1be7,function(_0xeca95a){if(_0x504f87[_0xeca95a[_0x5b89('0x1a')]]){_0x564250[_0x5b89('0x1b')]({'name':_0xeca95a[_0x5b89('0x1c')],'value':_0x504f87[_0xeca95a[_0x5b89('0x1a')]]});}});}return request({'form':{'method':_0x5b89('0x1d'),'input_type':_0x5b89('0x1e'),'response_type':_0x5b89('0x1e'),'rest_data':JSON[_0x5b89('0x1f')]({'session':_0xe49cde['id'],'module_name':_0x5b89('0x20'),'name_value_list':_0x564250})}});}function getAuth(_0x39c7c1){return util[_0x5b89('0x21')](_0x5b89('0x22'),new Buffer(_0x39c7c1[_0x5b89('0x23')]+':X')[_0x5b89('0x24')](_0x5b89('0x25')));}function getServerInfo(_0x9234e3){return request({'form':{'method':_0x5b89('0x26'),'input_type':_0x5b89('0x1e'),'response_type':_0x5b89('0x1e'),'rest_data':JSON['stringify']({'session':_0x9234e3['id']})}});}function getUser(_0x368544,_0xc80bb8,_0x5231f9){if(!_[_0x5b89('0x27')](_0xc80bb8)){logger[_0x5b89('0xa')]('Getting\x20agent\x20with\x20name',_0xc80bb8);return request({'form':{'method':_0x5b89('0x28'),'input_type':_0x5b89('0x1e'),'response_type':_0x5b89('0x1e'),'rest_data':JSON[_0x5b89('0x1f')]({'session':_0x5231f9['id'],'module_name':_0x5b89('0x29'),'query':util[_0x5b89('0x21')](_0x5b89('0x2a'),_0xc80bb8),'order_by':'','offset':'0','select_fields':['id',_0x5b89('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5b89('0x2b')](function(_0x24945e){if(_0x24945e['entry_list'][_0x5b89('0x18')]){var _0x27b790=_['find'](_0x24945e[_0x5b89('0x2c')],function(_0x47da5f){return _0x47da5f['name_value_list'][_0x5b89('0x2d')]['value']===_0xc80bb8;});if(_0x27b790){logger[_0x5b89('0xa')](_0x5b89('0x2e'));return BPromise['resolve']({'id':_0x27b790[_0x5b89('0x2f')]['id']['value'],'name':_0x27b790[_0x5b89('0x2f')][_0x5b89('0xc')]['value']});}}logger[_0x5b89('0xa')](_0x5b89('0x30'));return BPromise[_0x5b89('0x31')]({'id':_0x5231f9[_0x5b89('0x2f')][_0x5b89('0x32')][_0x5b89('0x33')],'name':_0x5231f9[_0x5b89('0x2f')][_0x5b89('0x2d')]['value']});});}else{logger[_0x5b89('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5b89('0x31')]({'id':_0x5231f9['name_value_list']['user_id'][_0x5b89('0x33')],'name':_0x5231f9['name_value_list']['user_name'][_0x5b89('0x33')]});}}function getEndUser(_0x2a18b3,_0x4bfd7b,_0x351b7e,_0x569759){logger['info'](_0x5b89('0x34'),_0x351b7e);return request({'form':{'method':_0x5b89('0x28'),'input_type':'JSON','response_type':_0x5b89('0x1e'),'rest_data':JSON[_0x5b89('0x1f')]({'session':_0x569759['id'],'module_name':_0x5b89('0x35'),'query':util[_0x5b89('0x21')](_0x5b89('0x36'),_0x351b7e),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5b89('0x2b')](function(_0x50a3b3){if(_0x50a3b3['entry_list'][_0x5b89('0x18')]){var _0x4e9e23=_[_0x5b89('0x37')](_0x50a3b3[_0x5b89('0x2c')],function(_0x2ff7a7){return _0x2ff7a7[_0x5b89('0x2f')][_0x5b89('0x38')]['value']===_0x351b7e;});if(_0x4e9e23){logger[_0x5b89('0xa')](_0x5b89('0x39'));return BPromise[_0x5b89('0x31')]({'id':_0x4e9e23['name_value_list']['id'][_0x5b89('0x33')],'name':_0x4e9e23[_0x5b89('0x2f')][_0x5b89('0xc')][_0x5b89('0x33')],'phone':_0x4e9e23[_0x5b89('0x2f')][_0x5b89('0x38')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x5b89('0x1d'),'input_type':'JSON','response_type':_0x5b89('0x1e'),'rest_data':JSON[_0x5b89('0x1f')]({'session':_0x569759['id'],'module_name':_0x5b89('0x35'),'name_value_list':[{'name':_0x5b89('0x3a'),'value':_0x4bfd7b!==_0x5b89('0x3b')?_0x4bfd7b:util[_0x5b89('0x21')](_0x5b89('0x3c'),_0x351b7e)},{'name':_0x5b89('0x38'),'value':_0x351b7e}]})}})[_0x5b89('0x2b')](function(_0x2c857c){logger[_0x5b89('0xa')](_0x5b89('0x3d'));return BPromise[_0x5b89('0x31')]({'id':_0x2c857c['id'],'name':_0x2c857c[_0x5b89('0x2c')][_0x5b89('0x3a')][_0x5b89('0x33')],'phone':_0x2c857c['entry_list']['phone_home'][_0x5b89('0x33')]});});}});}function request(_0x4679d6){logger[_0x5b89('0x3e')]('[HTTP]',JSON[_0x5b89('0x1f')](_0x4679d6));return rp(_['merge'](def,_0x4679d6));}function getTags(_0x3d944f,_0x31fe8f){var _0x588c07=[];if(_0x3d944f&&_0x3d944f[_0x5b89('0x18')]>0x0){_0x588c07=_[_0x5b89('0x3f')](_0x3d944f,_0x31fe8f);}return _0x588c07;}function getCustomFields(_0x25fca5,_0x3d770a){var _0x5e4f1e=[];var _0x350bea={'custom_fields':[]};if(_0x25fca5[_0x5b89('0x18')]>0x0){_['forEach'](_0x25fca5,function(_0x476f54){if(_0x476f54['type']===_0x5b89('0x40')&&_0x476f54[_0x5b89('0x41')]&&!_0x476f54[_0x5b89('0x42')]){_0x350bea[_0x476f54[_0x5b89('0x41')][_0x5b89('0x43')]()]=_0x476f54[_0x5b89('0x44')][_0x5b89('0x24')]();}else if(_0x476f54[_0x5b89('0x45')]===_0x5b89('0x40')&&_0x476f54[_0x5b89('0x1c')]&&_0x476f54[_0x5b89('0x42')]){_0x350bea['custom_fields'][_0x5b89('0x1b')]({'id':_0x476f54[_0x5b89('0x1c')],'value':_0x476f54[_0x5b89('0x44')][_0x5b89('0x24')]()});}else if(_0x476f54[_0x5b89('0x45')]===_0x5b89('0x46')&&_0x476f54['variableName']&&_0x476f54[_0x5b89('0x1c')]&&_0x476f54[_0x5b89('0x42')]){_0x3d770a[_0x476f54[_0x5b89('0x1a')]]&&_0x350bea[_0x5b89('0x47')]['push']({'id':_0x476f54['idField'],'value':_0x3d770a[_0x476f54[_0x5b89('0x1a')]][_0x5b89('0x24')]()});}else if(_0x476f54[_0x5b89('0x45')]===_0x5b89('0x48')&&_0x476f54[_0x5b89('0x49')]&&_0x476f54['Variable']['name']&&_0x476f54['idField']&&_0x476f54[_0x5b89('0x42')]){_0x3d770a[_0x476f54[_0x5b89('0x49')]['name']['toLowerCase']()]&&_0x350bea[_0x5b89('0x47')][_0x5b89('0x1b')]({'id':_0x476f54[_0x5b89('0x1c')],'value':_0x3d770a[_0x476f54[_0x5b89('0x49')]['name'][_0x5b89('0x43')]()][_0x5b89('0x24')]()});}});}return _0x350bea;}function getConnection(_0xb5a862){return request({'method':_0x5b89('0x4a'),'form':{'method':'login','input_type':_0x5b89('0x1e'),'response_type':'JSON','rest_data':JSON[_0x5b89('0x1f')]({'user_auth':{'user_name':_0xb5a862[_0x5b89('0x4b')],'password':_0xb5a862['password'],'encryption':_0x5b89('0x4c')},'application':_0x5b89('0x4d')})}})['then'](function(_0x1609a9){var _0x231928=_0x1609a9;if(_0x231928['id']){def[_0x5b89('0x4e')]=_0x231928['id'];return BPromise['resolve'](_0x231928);}else{throw new Error(util[_0x5b89('0x21')](_0x5b89('0x4f'),_0xb5a862['id']));}});}function setRelationship(_0x30f429,_0x440f7d,_0x4e78db,_0x53a692){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x5b89('0x1e'),'rest_data':JSON['stringify']({'session':_0x30f429['id'],'module_name':_0x5b89('0x20'),'module_id':_0x4e78db['id'],'link_field_name':_0x53a692,'related_ids':[_0x440f7d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5b89('0x50')]=function(_0x1e9fe3,_0x482ca4,_0x55b2ac,_0x1b81d8,_0x2195cb,_0x27f5bd){var _0x1b8dff,_0x1de6ed,_0xe76f55,_0x1e8222;_0x27f5bd[_0x5b89('0x51')]=intUtil[_0x5b89('0x52')](_0x27f5bd[_0x5b89('0x51')]);_0x27f5bd[_0x5b89('0x53')]=intUtil[_0x5b89('0x52')](_0x27f5bd[_0x5b89('0x53')]);def[_0x5b89('0x54')]=util['format'](_0x5b89('0x55'),_0x27f5bd[_0x5b89('0x51')]);if(_0x2195cb&&_0x2195cb['monitor_format']){logger[_0x5b89('0xa')]('[QUEUE]',_0x5b89('0x56'));_0x482ca4['recordingURL']=util[_0x5b89('0x21')](_0x5b89('0x57'),_0x27f5bd[_0x5b89('0x53')],_0x482ca4[_0x5b89('0x58')],md5(_0x482ca4[_0x5b89('0x58')]));}else{_0x482ca4[_0x5b89('0x59')]='';}return getConnection(_0x27f5bd)['then'](function(_0x134494){_0x1e8222=_0x134494;return getUser(_0x27f5bd,_0x1b81d8[_0x5b89('0xc')],_0x1e8222);})[_0x5b89('0x2b')](function(_0x3b56a8){_0x1b8dff=_0x3b56a8;logger['info'](_0x5b89('0x5a'),_0x1b8dff['id']);return getEndUser(_0x27f5bd,_0x482ca4[_0x5b89('0x5b')],_0x482ca4[_0x5b89('0x5c')],_0x1e8222);})[_0x5b89('0x2b')](function(_0x4162fb){_0x1de6ed=_0x4162fb;logger[_0x5b89('0xa')]('The\x20Enduser\x20ID\x20is:',_0x1de6ed['id']);return getTicket(_0x27f5bd,_0x1b8dff,_0x1de6ed,_0x55b2ac,_0x482ca4,_0x55b2ac[_0x5b89('0x5d')],_0x1e8222,'Inbound');})[_0x5b89('0x2b')](function(_0x21b067){_0xe76f55=_0x21b067;logger['info'](_0x5b89('0x5e'));logger[_0x5b89('0xa')](_0x5b89('0x5f'),_0xe76f55['id']);return setRelationship(_0x1e8222,_0x1b8dff,_0xe76f55,'users');})[_0x5b89('0x2b')](function(){return setRelationship(_0x1e8222,_0x1de6ed,_0xe76f55,_0x5b89('0x60'));})[_0x5b89('0x2b')](function(){return getServerInfo(_0x1e8222);})[_0x5b89('0x2b')](function(_0x4f535d){var _0xbba781=parseInt(_0x4f535d['version'][_0x5b89('0x61')](0x0));var _0x9c9d2e=util[_0x5b89('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x27f5bd[_0x5b89('0x51')],_0xe76f55['id']);if(_0xbba781>0x6){_0x9c9d2e=util[_0x5b89('0x21')](_0x5b89('0x62'),_0x27f5bd['remoteUri'],_0xe76f55['id']);}logger[_0x5b89('0xa')](_0x5b89('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1b81d8[_0x5b89('0xc')]),_0x5b89('0x64'),{'uri':_0x9c9d2e});})[_0x5b89('0x65')](function(_0x39ba4e){logger['error']('[QUEUE]',JSON[_0x5b89('0x1f')](_0x39ba4e));});};exports['outbound']=function(_0x4fef3e,_0x2dbd7e,_0x3dcbfa,_0x58b891,_0x323846,_0x14cd47,_0x4f7d15){var _0x14c760,_0x196296,_0x220566,_0x3dc9ba;_0x14cd47[_0x5b89('0x51')]=intUtil[_0x5b89('0x52')](_0x14cd47[_0x5b89('0x51')]);_0x14cd47[_0x5b89('0x53')]=intUtil[_0x5b89('0x52')](_0x14cd47['serverUrl']);def['uri']=util['format'](_0x5b89('0x55'),_0x14cd47[_0x5b89('0x51')]);if(_0x4f7d15&&_0x4f7d15['recordingFormat']&&_0x4f7d15[_0x5b89('0x66')]!==_0x5b89('0x67')){logger[_0x5b89('0xa')]('[OUTBOUND]',_0x5b89('0x56'));_0x2dbd7e['recordingURL']=util[_0x5b89('0x21')](_0x5b89('0x57'),_0x14cd47['serverUrl'],_0x2dbd7e[_0x5b89('0x58')],md5(_0x2dbd7e['uniqueid']));}return getConnection(_0x14cd47)[_0x5b89('0x2b')](function(_0x389d61){_0x3dc9ba=_0x389d61;return getUser(_0x14cd47,_0x58b891['name'],_0x3dc9ba);})[_0x5b89('0x2b')](function(_0x31f8e8){_0x14c760=_0x31f8e8;logger['info']('The\x20User\x20ID\x20is:',_0x14c760['id']);return getEndUser(_0x14cd47,_0x2dbd7e[_0x5b89('0x68')],_0x2dbd7e['destcalleridnum'],_0x3dc9ba);})[_0x5b89('0x2b')](function(_0x2d9a13){_0x196296=_0x2d9a13;logger[_0x5b89('0xa')]('The\x20Enduser\x20ID\x20is:',_0x196296['id']);return getTicket(_0x14cd47,_0x14c760,_0x196296,_0x3dcbfa,_0x2dbd7e,_0x3dcbfa[_0x5b89('0x5d')],_0x3dc9ba,_0x5b89('0x69'));})[_0x5b89('0x2b')](function(_0x1f1373){_0x220566=_0x1f1373;logger[_0x5b89('0xa')](_0x5b89('0x5e'));logger[_0x5b89('0xa')](_0x5b89('0x5f'),_0x220566['id']);return setRelationship(_0x3dc9ba,_0x14c760,_0x220566,'users');})[_0x5b89('0x2b')](function(){return setRelationship(_0x3dc9ba,_0x196296,_0x220566,_0x5b89('0x60'));})[_0x5b89('0x2b')](function(){return getServerInfo(_0x3dc9ba);})[_0x5b89('0x2b')](function(_0x6331c4){var _0x4434c5=parseInt(_0x6331c4[_0x5b89('0x6a')][_0x5b89('0x61')](0x0));var _0x2c227a=util[_0x5b89('0x21')](_0x5b89('0x6b'),_0x14cd47[_0x5b89('0x51')],_0x220566['id']);if(_0x4434c5>0x6){_0x2c227a=util[_0x5b89('0x21')](_0x5b89('0x62'),_0x14cd47[_0x5b89('0x51')],_0x220566['id']);}logger[_0x5b89('0xa')](_0x5b89('0x6c'),_0x5b89('0x6d'));emit(util[_0x5b89('0x21')]('user:%s',_0x58b891[_0x5b89('0xc')]),'trigger:browser:url',{'uri':_0x2c227a});})[_0x5b89('0x65')](function(_0x45b06d){logger[_0x5b89('0x6e')]('[OUTBOUND]',JSON[_0x5b89('0x1f')](_0x45b06d));});};exports[_0x5b89('0x6f')]=function(_0x14cdc1,_0x52520c,_0x37ecb1,_0x2678d4,_0x329529,_0x417c05){var _0x5e182e,_0x35eaee,_0x2f8ab9,_0x3ddb73;_0x417c05['remoteUri']=intUtil[_0x5b89('0x52')](_0x417c05[_0x5b89('0x51')]);_0x417c05[_0x5b89('0x53')]=intUtil[_0x5b89('0x52')](_0x417c05[_0x5b89('0x53')]);def[_0x5b89('0x54')]=util[_0x5b89('0x21')](_0x5b89('0x55'),_0x417c05[_0x5b89('0x51')]);if(_0x329529&&_0x329529[_0x5b89('0x70')]){logger[_0x5b89('0xa')]('['+_0x52520c[_0x5b89('0x71')][_0x5b89('0x72')]()+']',_0x5b89('0x56'));_0x52520c['recordingURL']=util['format'](_0x5b89('0x57'),_0x417c05[_0x5b89('0x53')],_0x52520c[_0x5b89('0x58')],md5(_0x52520c[_0x5b89('0x58')]));}else{_0x52520c[_0x5b89('0x59')]='';}return getConnection(_0x417c05)[_0x5b89('0x2b')](function(_0x3b3118){_0x3ddb73=_0x3b3118;if(!_[_0x5b89('0x27')](_0x2678d4)){return getUser(_0x417c05,_0x2678d4['name'],_0x3ddb73);}else{return getUser(_0x417c05,null,_0x3ddb73);}})[_0x5b89('0x2b')](function(_0x1f1555){_0x5e182e=_0x1f1555;logger[_0x5b89('0xa')](_0x5b89('0x5a'),_0x5e182e['id']);return getEndUser(_0x417c05,_0x52520c[_0x5b89('0x5b')],_0x52520c[_0x5b89('0x5c')],_0x3ddb73);})['then'](function(_0x5dad1c){_0x35eaee=_0x5dad1c;logger[_0x5b89('0xa')]('The\x20Enduser\x20ID\x20is:',_0x35eaee['id']);return getTicket(_0x417c05,_0x5e182e,_0x35eaee,_0x37ecb1,_0x52520c,_0x37ecb1[_0x5b89('0x5d')],_0x3ddb73,'Inbound');})[_0x5b89('0x2b')](function(_0x58663d){_0x2f8ab9=_0x58663d;logger[_0x5b89('0xa')](_0x5b89('0x5e'));logger[_0x5b89('0xa')](_0x5b89('0x5f'),_0x2f8ab9['id']);return setRelationship(_0x3ddb73,_0x5e182e,_0x2f8ab9,_0x5b89('0x73'));})[_0x5b89('0x2b')](function(){return setRelationship(_0x3ddb73,_0x35eaee,_0x2f8ab9,_0x5b89('0x60'));})['then'](function(){return getServerInfo(_0x3ddb73);})[_0x5b89('0x65')](function(_0x25880d){logger['error']('['+_0x52520c['lastevent'][_0x5b89('0x72')]()+']',JSON[_0x5b89('0x1f')](_0x25880d));});}; \ No newline at end of file +var _0xa6fd=['info','Getting\x20agent\x20with\x20name','Employees','user_name','entry_list','find','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','format','contacts.phone_home\x20=\x20\x22%s\x22','then','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','content','push','customVariable','Variable','login','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','Recording\x20is\x20enabled!','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','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','user:%s','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','Ticket\x20created!','trigger:browser:url','unmanaged','monitor_format','lastevent','toUpperCase','Fields','users','error','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','sugarcrm','redis','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','get_server_info','isNil'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xa6fd,0xc5));var _0xda6f=function(_0x16ae34,_0x1dc6d){_0x16ae34=_0x16ae34-0x0;var _0x184836=_0xa6fd[_0x16ae34];return _0x184836;};'use strict';var _=require(_0xda6f('0x0'));var rp=require(_0xda6f('0x1'));var BPromise=require(_0xda6f('0x2'));var md5=require(_0xda6f('0x3'));var util=require(_0xda6f('0x4'));var Redis=require(_0xda6f('0x5'));var intUtil=require('./util');var config=require(_0xda6f('0x6'));var logger=require('../../../../config/logger')(_0xda6f('0x7'));config[_0xda6f('0x8')]=_['defaults'](config[_0xda6f('0x8')],{'host':_0xda6f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda6f('0x8')]));var def={'method':_0xda6f('0xa'),'json':!![]};function emit(_0x1021ef,_0x133bd4,_0xc7c694){io['to'](_0x1021ef)[_0xda6f('0xb')](_0x133bd4,_0xc7c694);}function getTicket(_0x8f594e,_0x514f92,_0x1aa56c,_0x111a3f,_0x1cad8e,_0x17c2b1,_0xd44fe8,_0x2a4184){logger['info'](_0xda6f('0xc'));var _0x274ec2=new Date();var _0x2d26d0=[{'name':_0xda6f('0xd'),'value':intUtil[_0xda6f('0xe')](_0x111a3f[_0xda6f('0xf')],_0x1cad8e,'\x20')},{'name':_0xda6f('0x10'),'value':_0x514f92['id']},{'name':_0xda6f('0x11'),'value':_0x514f92['id']},{'name':'description','value':intUtil[_0xda6f('0xe')](_0x111a3f[_0xda6f('0x12')],_0x1cad8e,'\x0a')},{'name':_0xda6f('0x13'),'value':_0x274ec2[_0xda6f('0x14')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xda6f('0x15'),'value':_0x1aa56c['id']},{'name':_0xda6f('0x16'),'value':_0xda6f('0x17')},{'name':_0xda6f('0x18'),'value':_0x1aa56c[_0xda6f('0xd')]},{'name':_0xda6f('0x19'),'value':_0x2a4184}];if(_0x17c2b1[_0xda6f('0x1a')]){_[_0xda6f('0x1b')](_0x17c2b1,function(_0x9e93a1){if(_0x1cad8e[_0x9e93a1[_0xda6f('0x1c')]]){_0x2d26d0['push']({'name':_0x9e93a1[_0xda6f('0x1d')],'value':_0x1cad8e[_0x9e93a1[_0xda6f('0x1c')]]});}});}return request({'form':{'method':_0xda6f('0x1e'),'input_type':_0xda6f('0x1f'),'response_type':_0xda6f('0x1f'),'rest_data':JSON[_0xda6f('0x20')]({'session':_0xd44fe8['id'],'module_name':_0xda6f('0x21'),'name_value_list':_0x2d26d0})}});}function getAuth(_0x5eafc2){return util['format'](_0xda6f('0x22'),new Buffer(_0x5eafc2[_0xda6f('0x23')]+':X')[_0xda6f('0x24')]('base64'));}function getServerInfo(_0x5426bf){return request({'form':{'method':_0xda6f('0x25'),'input_type':'JSON','response_type':_0xda6f('0x1f'),'rest_data':JSON[_0xda6f('0x20')]({'session':_0x5426bf['id']})}});}function getUser(_0x4e5e37,_0x4cec23,_0x62ec29){if(!_[_0xda6f('0x26')](_0x4cec23)){logger[_0xda6f('0x27')](_0xda6f('0x28'),_0x4cec23);return request({'form':{'method':'get_entry_list','input_type':_0xda6f('0x1f'),'response_type':_0xda6f('0x1f'),'rest_data':JSON[_0xda6f('0x20')]({'session':_0x62ec29['id'],'module_name':_0xda6f('0x29'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x4cec23),'order_by':'','offset':'0','select_fields':['id',_0xda6f('0xd'),_0xda6f('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x448f4e){if(_0x448f4e[_0xda6f('0x2b')][_0xda6f('0x1a')]){var _0x4aee8c=_[_0xda6f('0x2c')](_0x448f4e[_0xda6f('0x2b')],function(_0x52b223){return _0x52b223[_0xda6f('0x2d')][_0xda6f('0x2a')]['value']===_0x4cec23;});if(_0x4aee8c){logger['info']('Agent\x20found!');return BPromise[_0xda6f('0x2e')]({'id':_0x4aee8c[_0xda6f('0x2d')]['id'][_0xda6f('0x2f')],'name':_0x4aee8c['name_value_list']['name']['value']});}}logger[_0xda6f('0x27')](_0xda6f('0x30'));return BPromise[_0xda6f('0x2e')]({'id':_0x62ec29[_0xda6f('0x2d')][_0xda6f('0x31')]['value'],'name':_0x62ec29['name_value_list']['user_name'][_0xda6f('0x2f')]});});}else{logger['info'](_0xda6f('0x32'));return BPromise[_0xda6f('0x2e')]({'id':_0x62ec29[_0xda6f('0x2d')][_0xda6f('0x31')][_0xda6f('0x2f')],'name':_0x62ec29['name_value_list'][_0xda6f('0x2a')][_0xda6f('0x2f')]});}}function getEndUser(_0x39a062,_0x412193,_0x3fb553,_0x3ab562){logger[_0xda6f('0x27')](_0xda6f('0x33'),_0x3fb553);return request({'form':{'method':_0xda6f('0x34'),'input_type':_0xda6f('0x1f'),'response_type':_0xda6f('0x1f'),'rest_data':JSON['stringify']({'session':_0x3ab562['id'],'module_name':_0xda6f('0x17'),'query':util[_0xda6f('0x35')](_0xda6f('0x36'),_0x3fb553),'order_by':'','offset':'0','select_fields':['id',_0xda6f('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xda6f('0x37')](function(_0x3ff15f){if(_0x3ff15f[_0xda6f('0x2b')][_0xda6f('0x1a')]){var _0x231163=_[_0xda6f('0x2c')](_0x3ff15f['entry_list'],function(_0xe886db){return _0xe886db[_0xda6f('0x2d')]['phone_home']['value']===_0x3fb553;});if(_0x231163){logger[_0xda6f('0x27')](_0xda6f('0x38'));return BPromise[_0xda6f('0x2e')]({'id':_0x231163['name_value_list']['id'][_0xda6f('0x2f')],'name':_0x231163[_0xda6f('0x2d')]['name']['value'],'phone':_0x231163[_0xda6f('0x2d')][_0xda6f('0x39')]['value']});}}else{logger[_0xda6f('0x27')](_0xda6f('0x3a'));return request({'form':{'method':_0xda6f('0x1e'),'input_type':_0xda6f('0x1f'),'response_type':'JSON','rest_data':JSON[_0xda6f('0x20')]({'session':_0x3ab562['id'],'module_name':_0xda6f('0x17'),'name_value_list':[{'name':_0xda6f('0x3b'),'value':_0x412193!==''?_0x412193:util[_0xda6f('0x35')](_0xda6f('0x3c'),_0x3fb553)},{'name':'phone_home','value':_0x3fb553}]})}})[_0xda6f('0x37')](function(_0x1a9c98){logger[_0xda6f('0x27')]('Enduser\x20created.');return BPromise[_0xda6f('0x2e')]({'id':_0x1a9c98['id'],'name':_0x1a9c98[_0xda6f('0x2b')]['first_name'][_0xda6f('0x2f')],'phone':_0x1a9c98[_0xda6f('0x2b')][_0xda6f('0x39')][_0xda6f('0x2f')]});});}});}function request(_0x1ff97a){logger[_0xda6f('0x3d')](_0xda6f('0x3e'),JSON[_0xda6f('0x20')](_0x1ff97a));return rp(_[_0xda6f('0x3f')](def,_0x1ff97a));}function getTags(_0x54cd6b,_0x25c12e){var _0x220e82=[];if(_0x54cd6b&&_0x54cd6b[_0xda6f('0x1a')]>0x0){_0x220e82=_[_0xda6f('0x40')](_0x54cd6b,_0x25c12e);}return _0x220e82;}function getCustomFields(_0x4da11a,_0x31f0cf){var _0x2d6cf6=[];var _0x2e1109={'custom_fields':[]};if(_0x4da11a['length']>0x0){_['forEach'](_0x4da11a,function(_0x48c54d){if(_0x48c54d[_0xda6f('0x41')]===_0xda6f('0x42')&&_0x48c54d[_0xda6f('0x43')]&&!_0x48c54d[_0xda6f('0x44')]){_0x2e1109[_0x48c54d['nameField'][_0xda6f('0x45')]()]=_0x48c54d['content']['toString']();}else if(_0x48c54d[_0xda6f('0x41')]===_0xda6f('0x42')&&_0x48c54d[_0xda6f('0x1d')]&&_0x48c54d[_0xda6f('0x44')]){_0x2e1109[_0xda6f('0x46')]['push']({'id':_0x48c54d[_0xda6f('0x1d')],'value':_0x48c54d[_0xda6f('0x47')][_0xda6f('0x24')]()});}else if(_0x48c54d[_0xda6f('0x41')]==='variable'&&_0x48c54d[_0xda6f('0x1c')]&&_0x48c54d[_0xda6f('0x1d')]&&_0x48c54d[_0xda6f('0x44')]){_0x31f0cf[_0x48c54d['variableName']]&&_0x2e1109[_0xda6f('0x46')][_0xda6f('0x48')]({'id':_0x48c54d[_0xda6f('0x1d')],'value':_0x31f0cf[_0x48c54d[_0xda6f('0x1c')]]['toString']()});}else if(_0x48c54d[_0xda6f('0x41')]===_0xda6f('0x49')&&_0x48c54d['Variable']&&_0x48c54d[_0xda6f('0x4a')][_0xda6f('0xd')]&&_0x48c54d[_0xda6f('0x1d')]&&_0x48c54d['customField']){_0x31f0cf[_0x48c54d['Variable']['name'][_0xda6f('0x45')]()]&&_0x2e1109['custom_fields'][_0xda6f('0x48')]({'id':_0x48c54d[_0xda6f('0x1d')],'value':_0x31f0cf[_0x48c54d[_0xda6f('0x4a')][_0xda6f('0xd')][_0xda6f('0x45')]()]['toString']()});}});}return _0x2e1109;}function getConnection(_0x2977cf){return request({'method':_0xda6f('0xa'),'form':{'method':_0xda6f('0x4b'),'input_type':_0xda6f('0x1f'),'response_type':_0xda6f('0x1f'),'rest_data':JSON[_0xda6f('0x20')]({'user_auth':{'user_name':_0x2977cf['username'],'password':_0x2977cf[_0xda6f('0x4c')],'encryption':_0xda6f('0x4d')},'application':_0xda6f('0x4e')})}})[_0xda6f('0x37')](function(_0x32129b){var _0x56678d=_0x32129b;if(_0x56678d['id']){def[_0xda6f('0x4f')]=_0x56678d['id'];return BPromise[_0xda6f('0x2e')](_0x56678d);}else{throw new Error(util['format'](_0xda6f('0x50'),_0x2977cf['id']));}});}function setRelationship(_0x247c2f,_0x4e4d81,_0x5a8bd2,_0x593b3e){return request({'form':{'method':_0xda6f('0x51'),'input_type':_0xda6f('0x1f'),'response_type':_0xda6f('0x1f'),'rest_data':JSON[_0xda6f('0x20')]({'session':_0x247c2f['id'],'module_name':'Calls','module_id':_0x5a8bd2['id'],'link_field_name':_0x593b3e,'related_ids':[_0x4e4d81['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xda6f('0x52')]=function(_0x3a7887,_0x314418,_0x577364,_0x45dbca,_0x27d72d,_0x57e8cd){var _0x4b0062,_0x412d76,_0x592f24,_0x305ce3;_0x57e8cd[_0xda6f('0x53')]=intUtil[_0xda6f('0x54')](_0x57e8cd[_0xda6f('0x53')]);_0x57e8cd[_0xda6f('0x55')]=intUtil['stripTrailingSlash'](_0x57e8cd[_0xda6f('0x55')]);def[_0xda6f('0x56')]=util[_0xda6f('0x35')](_0xda6f('0x57'),_0x57e8cd[_0xda6f('0x53')]);if(_0x27d72d&&_0x27d72d['monitor_format']){logger[_0xda6f('0x27')]('[QUEUE]',_0xda6f('0x58'));_0x314418[_0xda6f('0x59')]=util[_0xda6f('0x35')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57e8cd[_0xda6f('0x55')],_0x314418['uniqueid'],md5(_0x314418['uniqueid']));}else{_0x314418[_0xda6f('0x59')]='';}return getConnection(_0x57e8cd)[_0xda6f('0x37')](function(_0x59fa22){_0x305ce3=_0x59fa22;return getUser(_0x57e8cd,_0x45dbca['name'],_0x305ce3);})['then'](function(_0x245b55){_0x4b0062=_0x245b55;logger['info'](_0xda6f('0x5a'),_0x4b0062['id']);return getEndUser(_0x57e8cd,_0x314418[_0xda6f('0x5b')],_0x314418[_0xda6f('0x5c')],_0x305ce3);})[_0xda6f('0x37')](function(_0x2eb546){_0x412d76=_0x2eb546;logger[_0xda6f('0x27')](_0xda6f('0x5d'),_0x412d76['id']);return getTicket(_0x57e8cd,_0x4b0062,_0x412d76,_0x577364,_0x314418,_0x577364['Fields'],_0x305ce3,_0xda6f('0x5e'));})['then'](function(_0x224277){_0x592f24=_0x224277;logger[_0xda6f('0x27')]('Ticket\x20created!');logger['info'](_0xda6f('0x5f'),_0x592f24['id']);return setRelationship(_0x305ce3,_0x4b0062,_0x592f24,'users');})[_0xda6f('0x37')](function(){return setRelationship(_0x305ce3,_0x412d76,_0x592f24,_0xda6f('0x60'));})[_0xda6f('0x37')](function(){return getServerInfo(_0x305ce3);})[_0xda6f('0x37')](function(_0x5cd731){var _0x579ce0=parseInt(_0x5cd731[_0xda6f('0x61')][_0xda6f('0x62')](0x0));var _0x133513=util[_0xda6f('0x35')](_0xda6f('0x63'),_0x57e8cd['remoteUri'],_0x592f24['id']);if(_0x579ce0>0x6){_0x133513=util[_0xda6f('0x35')](_0xda6f('0x64'),_0x57e8cd['remoteUri'],_0x592f24['id']);}logger[_0xda6f('0x27')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xda6f('0x35')](_0xda6f('0x65'),_0x45dbca[_0xda6f('0xd')]),'trigger:browser:url',{'uri':_0x133513});})[_0xda6f('0x66')](function(_0x15a842){logger['error']('[QUEUE]',JSON[_0xda6f('0x20')](_0x15a842));});};exports[_0xda6f('0x67')]=function(_0x4888d1,_0x10acab,_0x27e7b7,_0x225ae5,_0x7ae8d4,_0x141957,_0x40a5c3){var _0x5734a5,_0x5b6d16,_0xe08109,_0x35a9e9;_0x141957[_0xda6f('0x53')]=intUtil[_0xda6f('0x54')](_0x141957['remoteUri']);_0x141957['serverUrl']=intUtil[_0xda6f('0x54')](_0x141957[_0xda6f('0x55')]);def[_0xda6f('0x56')]=util['format'](_0xda6f('0x57'),_0x141957[_0xda6f('0x53')]);if(_0x40a5c3&&_0x40a5c3['recordingFormat']&&_0x40a5c3[_0xda6f('0x68')]!=='none'){logger['info'](_0xda6f('0x69'),_0xda6f('0x58'));_0x10acab[_0xda6f('0x59')]=util[_0xda6f('0x35')](_0xda6f('0x6a'),_0x141957[_0xda6f('0x55')],_0x10acab[_0xda6f('0x6b')],md5(_0x10acab[_0xda6f('0x6b')]));}return getConnection(_0x141957)['then'](function(_0x495b56){_0x35a9e9=_0x495b56;return getUser(_0x141957,_0x225ae5[_0xda6f('0xd')],_0x35a9e9);})['then'](function(_0x50f74c){_0x5734a5=_0x50f74c;logger[_0xda6f('0x27')](_0xda6f('0x5a'),_0x5734a5['id']);return getEndUser(_0x141957,_0x10acab[_0xda6f('0x6c')],_0x10acab['destcalleridnum'],_0x35a9e9);})['then'](function(_0x5550ea){_0x5b6d16=_0x5550ea;logger[_0xda6f('0x27')](_0xda6f('0x5d'),_0x5b6d16['id']);return getTicket(_0x141957,_0x5734a5,_0x5b6d16,_0x27e7b7,_0x10acab,_0x27e7b7['Fields'],_0x35a9e9,'Outbound');})[_0xda6f('0x37')](function(_0x3ace93){_0xe08109=_0x3ace93;logger[_0xda6f('0x27')](_0xda6f('0x6d'));logger[_0xda6f('0x27')]('The\x20Ticket\x20ID\x20is:',_0xe08109['id']);return setRelationship(_0x35a9e9,_0x5734a5,_0xe08109,'users');})['then'](function(){return setRelationship(_0x35a9e9,_0x5b6d16,_0xe08109,_0xda6f('0x60'));})[_0xda6f('0x37')](function(){return getServerInfo(_0x35a9e9);})[_0xda6f('0x37')](function(_0x9a761f){var _0x5011ba=parseInt(_0x9a761f[_0xda6f('0x61')]['charAt'](0x0));var _0x3e6c92=util['format'](_0xda6f('0x63'),_0x141957[_0xda6f('0x53')],_0xe08109['id']);if(_0x5011ba>0x6){_0x3e6c92=util[_0xda6f('0x35')](_0xda6f('0x64'),_0x141957[_0xda6f('0x53')],_0xe08109['id']);}logger['info'](_0xda6f('0x69'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xda6f('0x35')](_0xda6f('0x65'),_0x225ae5[_0xda6f('0xd')]),_0xda6f('0x6e'),{'uri':_0x3e6c92});})[_0xda6f('0x66')](function(_0x1e28f0){logger['error'](_0xda6f('0x69'),JSON[_0xda6f('0x20')](_0x1e28f0));});};exports[_0xda6f('0x6f')]=function(_0x5d4a34,_0x15cb0e,_0x3aad6e,_0x328a31,_0x207dbd,_0xd5b1fd){var _0x373efd,_0x1a67e5,_0x29b3ef,_0xc631fa;_0xd5b1fd[_0xda6f('0x53')]=intUtil[_0xda6f('0x54')](_0xd5b1fd['remoteUri']);_0xd5b1fd[_0xda6f('0x55')]=intUtil['stripTrailingSlash'](_0xd5b1fd[_0xda6f('0x55')]);def['uri']=util[_0xda6f('0x35')]('%s/service/v4_1/rest.php',_0xd5b1fd[_0xda6f('0x53')]);if(_0x207dbd&&_0x207dbd[_0xda6f('0x70')]){logger[_0xda6f('0x27')]('['+_0x15cb0e[_0xda6f('0x71')][_0xda6f('0x72')]()+']',_0xda6f('0x58'));_0x15cb0e['recordingURL']=util['format'](_0xda6f('0x6a'),_0xd5b1fd[_0xda6f('0x55')],_0x15cb0e['uniqueid'],md5(_0x15cb0e[_0xda6f('0x6b')]));}else{_0x15cb0e[_0xda6f('0x59')]='';}return getConnection(_0xd5b1fd)[_0xda6f('0x37')](function(_0x4df440){_0xc631fa=_0x4df440;if(!_[_0xda6f('0x26')](_0x328a31)){return getUser(_0xd5b1fd,_0x328a31['name'],_0xc631fa);}else{return getUser(_0xd5b1fd,null,_0xc631fa);}})[_0xda6f('0x37')](function(_0x4e2066){_0x373efd=_0x4e2066;logger[_0xda6f('0x27')](_0xda6f('0x5a'),_0x373efd['id']);return getEndUser(_0xd5b1fd,_0x15cb0e[_0xda6f('0x5b')],_0x15cb0e[_0xda6f('0x5c')],_0xc631fa);})[_0xda6f('0x37')](function(_0x141a7d){_0x1a67e5=_0x141a7d;logger[_0xda6f('0x27')]('The\x20Enduser\x20ID\x20is:',_0x1a67e5['id']);return getTicket(_0xd5b1fd,_0x373efd,_0x1a67e5,_0x3aad6e,_0x15cb0e,_0x3aad6e[_0xda6f('0x73')],_0xc631fa,'Inbound');})[_0xda6f('0x37')](function(_0x4c266f){_0x29b3ef=_0x4c266f;logger['info']('Ticket\x20created!');logger[_0xda6f('0x27')]('The\x20Ticket\x20ID\x20is:',_0x29b3ef['id']);return setRelationship(_0xc631fa,_0x373efd,_0x29b3ef,_0xda6f('0x74'));})[_0xda6f('0x37')](function(){return setRelationship(_0xc631fa,_0x1a67e5,_0x29b3ef,_0xda6f('0x60'));})[_0xda6f('0x37')](function(){return getServerInfo(_0xc631fa);})[_0xda6f('0x66')](function(_0xa28195){logger[_0xda6f('0x75')]('['+_0x15cb0e[_0xda6f('0x71')]['toUpperCase']()+']',JSON[_0xda6f('0x20')](_0xa28195));});}; \ 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 3aaad0b..77a3dbf 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 _0xef71=['variableName','toString','Variable','name','toLowerCase','%s:\x20%s','keyType','format','key','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable'];(function(_0x2c20a3,_0x15183b){var _0x474693=function(_0x5d851f){while(--_0x5d851f){_0x2c20a3['push'](_0x2c20a3['shift']());}};_0x474693(++_0x15183b);}(_0xef71,0xc7));var _0x1ef7=function(_0x46c59b,_0x5635dd){_0x46c59b=_0x46c59b-0x0;var _0x16dd2d=_0xef71[_0x46c59b];return _0x16dd2d;};'use strict';var _=require(_0x1ef7('0x0'));var util=require(_0x1ef7('0x1'));exports[_0x1ef7('0x2')]=function(_0x33ebd8,_0x55bdac,_0x9126a7){var _0x2e17de=[];if(_0x33ebd8[_0x1ef7('0x3')]>0x0){var _0x5982de=_[_0x1ef7('0x4')](_0x33ebd8,['id']);for(var _0x36ac23=0x0;_0x36ac23<_0x5982de[_0x1ef7('0x3')];_0x36ac23++){var _0xe0dc10=_0x5982de[_0x36ac23];if(_0xe0dc10[_0x1ef7('0x5')]===_0x1ef7('0x6')){_0x2e17de[_0x1ef7('0x7')](_0xe0dc10['content']);}else if(_0xe0dc10[_0x1ef7('0x5')]===_0x1ef7('0x8')&&_0xe0dc10[_0x1ef7('0x9')]){_0x55bdac[_0xe0dc10['variableName']]&&_0x2e17de['push'](_0x55bdac[_0xe0dc10[_0x1ef7('0x9')]][_0x1ef7('0xa')]());}else if(_0xe0dc10['type']==='customVariable'&&_0xe0dc10[_0x1ef7('0xb')]&&_0xe0dc10[_0x1ef7('0xb')][_0x1ef7('0xc')]){_0x55bdac[_0xe0dc10[_0x1ef7('0xb')][_0x1ef7('0xc')][_0x1ef7('0xd')]()]&&_0x2e17de[_0x1ef7('0x7')](_0x55bdac[_0xe0dc10[_0x1ef7('0xb')]['name']['toLowerCase']()][_0x1ef7('0xa')]());}else if(_0xe0dc10[_0x1ef7('0x5')]==='keyValue'){if(_0xe0dc10['keyType']===_0x1ef7('0x6')&&_0xe0dc10['key']){_0x2e17de[_0x1ef7('0x7')](util['format'](_0x1ef7('0xe'),_0xe0dc10['key'],_0xe0dc10['keyContent']));}else if(_0xe0dc10[_0x1ef7('0xf')]===_0x1ef7('0x8')&&_0xe0dc10['variableName']&&_0xe0dc10['key']){_0x55bdac[_0xe0dc10[_0x1ef7('0x9')]]&&_0x2e17de['push'](util[_0x1ef7('0x10')](_0x1ef7('0xe'),_0xe0dc10[_0x1ef7('0x11')],_0x55bdac[_0xe0dc10[_0x1ef7('0x9')]]));}else if(_0xe0dc10[_0x1ef7('0xf')]==='customVariable'&&_0xe0dc10[_0x1ef7('0xb')]&&_0xe0dc10['Variable']['name']&&_0xe0dc10[_0x1ef7('0x11')]){_0x55bdac[_0xe0dc10[_0x1ef7('0xb')][_0x1ef7('0xc')][_0x1ef7('0xd')]()]&&_0x2e17de[_0x1ef7('0x7')](util[_0x1ef7('0x10')](_0x1ef7('0xe'),_0xe0dc10[_0x1ef7('0x11')],_0x55bdac[_0xe0dc10['Variable'][_0x1ef7('0xc')][_0x1ef7('0xd')]()]));}}}}return _0x2e17de[_0x1ef7('0x12')](_0x9126a7);};exports[_0x1ef7('0x13')]=function(_0x51ef12){var _0x515468=_0x51ef12[_0x1ef7('0x14')](-0x1);if(_0x515468==='/'){_0x51ef12=_0x51ef12[_0x1ef7('0x15')](0x0,_0x51ef12[_0x1ef7('0x16')](_0x515468));}return _0x51ef12;};exports[_0x1ef7('0x17')]=function(_0x46ff08){if(!_[_0x1ef7('0x18')](_0x46ff08)&&_0x46ff08!==''){var _0x3cc659=/^(([^<>()\[\]\\.,;:\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 _0x3cc659[_0x1ef7('0x19')](String(_0x46ff08)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xa2ce=['test','lodash','getString','length','push','content','type','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','%s:\x20%s','keyContent','format','join','slice','substring','validateEmail','isNil'];(function(_0x59038f,_0x4496ce){var _0x14fc95=function(_0x9c972f){while(--_0x9c972f){_0x59038f['push'](_0x59038f['shift']());}};_0x14fc95(++_0x4496ce);}(_0xa2ce,0xa2));var _0xea2c=function(_0x3ee778,_0x577076){_0x3ee778=_0x3ee778-0x0;var _0x13b32a=_0xa2ce[_0x3ee778];return _0x13b32a;};'use strict';var _=require(_0xea2c('0x0'));var util=require('util');exports[_0xea2c('0x1')]=function(_0x3dfd45,_0x414259,_0x201d7b){var _0x283a19=[];if(_0x3dfd45[_0xea2c('0x2')]>0x0){var _0x279eb1=_['sortBy'](_0x3dfd45,['id']);for(var _0x12b8e1=0x0;_0x12b8e1<_0x279eb1[_0xea2c('0x2')];_0x12b8e1++){var _0x568da7=_0x279eb1[_0x12b8e1];if(_0x568da7['type']==='string'){_0x283a19[_0xea2c('0x3')](_0x568da7[_0xea2c('0x4')]);}else if(_0x568da7[_0xea2c('0x5')]==='variable'&&_0x568da7['variableName']){_0x414259[_0x568da7[_0xea2c('0x6')]]&&_0x283a19[_0xea2c('0x3')](_0x414259[_0x568da7[_0xea2c('0x6')]][_0xea2c('0x7')]());}else if(_0x568da7[_0xea2c('0x5')]===_0xea2c('0x8')&&_0x568da7[_0xea2c('0x9')]&&_0x568da7[_0xea2c('0x9')][_0xea2c('0xa')]){_0x414259[_0x568da7['Variable']['name'][_0xea2c('0xb')]()]&&_0x283a19[_0xea2c('0x3')](_0x414259[_0x568da7['Variable']['name'][_0xea2c('0xb')]()][_0xea2c('0x7')]());}else if(_0x568da7['type']==='keyValue'){if(_0x568da7[_0xea2c('0xc')]==='string'&&_0x568da7[_0xea2c('0xd')]){_0x283a19[_0xea2c('0x3')](util['format'](_0xea2c('0xe'),_0x568da7[_0xea2c('0xd')],_0x568da7[_0xea2c('0xf')]));}else if(_0x568da7[_0xea2c('0xc')]==='variable'&&_0x568da7[_0xea2c('0x6')]&&_0x568da7[_0xea2c('0xd')]){_0x414259[_0x568da7[_0xea2c('0x6')]]&&_0x283a19[_0xea2c('0x3')](util[_0xea2c('0x10')](_0xea2c('0xe'),_0x568da7['key'],_0x414259[_0x568da7[_0xea2c('0x6')]]));}else if(_0x568da7[_0xea2c('0xc')]==='customVariable'&&_0x568da7[_0xea2c('0x9')]&&_0x568da7[_0xea2c('0x9')]['name']&&_0x568da7[_0xea2c('0xd')]){_0x414259[_0x568da7[_0xea2c('0x9')]['name'][_0xea2c('0xb')]()]&&_0x283a19[_0xea2c('0x3')](util['format']('%s:\x20%s',_0x568da7[_0xea2c('0xd')],_0x414259[_0x568da7[_0xea2c('0x9')]['name'][_0xea2c('0xb')]()]));}}}}return _0x283a19[_0xea2c('0x11')](_0x201d7b);};exports['stripTrailingSlash']=function(_0x32605e){var _0x592f46=_0x32605e[_0xea2c('0x12')](-0x1);if(_0x592f46==='/'){_0x32605e=_0x32605e[_0xea2c('0x13')](0x0,_0x32605e['lastIndexOf'](_0x592f46));}return _0x32605e;};exports[_0xea2c('0x14')]=function(_0x2bf267){if(!_[_0xea2c('0x15')](_0x2bf267)&&_0x2bf267!==''){var _0x556aa0=/^(([^<>()\[\]\\.,;:\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 _0x556aa0[_0xea2c('0x16')](String(_0x2bf267)[_0xea2c('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index ca03b39..5f46f56 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(_0x39b1bd,_0x554c9f){var _0x1dfb46=function(_0x4a15de){while(--_0x4a15de){_0x39b1bd['push'](_0x39b1bd['shift']());}};_0x1dfb46(++_0x554c9f);}(_0xe706,0xa3));var _0x6e70=function(_0x58e2a5,_0x4e822c){_0x58e2a5=_0x58e2a5-0x0;var _0x440ba0=_0xe706[_0x58e2a5];return _0x440ba0;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index a6c04b6..8d59d7b 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 _0x4ba4=['email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/agent/tickets/%s','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','POST','getString','Subjects','Descriptions','Fields','then','info','validateEmail','format','%s/search.json','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','picklist','nameField','customField','toLowerCase','content','includes','string','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','Authorization'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x4ba4,0x7b));var _0x44ba=function(_0xaf2024,_0x452360){_0xaf2024=_0xaf2024-0x0;var _0x2e301c=_0x4ba4[_0xaf2024];return _0x2e301c;};'use strict';var _=require(_0x44ba('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x44ba('0x1'));var Redis=require(_0x44ba('0x2'));var intUtil=require('./util');var config=require(_0x44ba('0x3'));var logger=require(_0x44ba('0x4'))(_0x44ba('0x5'));config[_0x44ba('0x6')]=_[_0x44ba('0x7')](config[_0x44ba('0x6')],{'host':_0x44ba('0x8'),'port':0x18eb});var io=require(_0x44ba('0x9'))(new Redis(config['redis']));function emit(_0x41972d,_0x231b0a,_0x2649fb){io['to'](_0x41972d)[_0x44ba('0xa')](_0x231b0a,_0x2649fb);}var headers={'Content-Type':_0x44ba('0xb'),'Accept':_0x44ba('0xb')};function getTicket(_0x1145ad,_0x2e71b2,_0x44b866,_0x4882e5,_0x578608){logger['info'](_0x44ba('0xc'));return request({'uri':util['format']('%s/tickets.json',_0x1145ad['remoteUri']),'method':_0x44ba('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x44b866['id'],'submitter_id':_0x2e71b2?_0x2e71b2['id']:undefined,'assignee_id':_0x2e71b2?_0x2e71b2['id']:undefined,'tags':getTags(_0x4882e5['Tags'],'name'),'subject':intUtil[_0x44ba('0xe')](_0x4882e5[_0x44ba('0xf')],_0x578608,'\x20'),'description':intUtil[_0x44ba('0xe')](_0x4882e5[_0x44ba('0x10')],_0x578608,'\x0a'),'comment':{'public':![],'body':intUtil[_0x44ba('0xe')](_0x4882e5['Descriptions'],_0x578608,'\x0a')}},getCustomFields(_0x4882e5[_0x44ba('0x11')],_0x578608))}})[_0x44ba('0x12')](function(_0x29b6e3){logger[_0x44ba('0x13')]('Ticket\x20created!');return _0x29b6e3['ticket'];});}function getUser(_0x401e76,_0x12099f){if(intUtil[_0x44ba('0x14')](_0x12099f)){logger[_0x44ba('0x13')]('Getting\x20agent\x20with\x20email',_0x12099f);return request({'uri':util[_0x44ba('0x15')](_0x44ba('0x16'),_0x401e76['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x12099f)}})['then'](function(_0x470f12){if(_0x470f12[_0x44ba('0x17')]){logger['info'](_0x44ba('0x18'));return _[_0x44ba('0x19')](_0x470f12[_0x44ba('0x1a')],{'email':_0x12099f,'role':'agent'});}else{logger[_0x44ba('0x13')](_0x44ba('0x1b'));return request({'uri':util[_0x44ba('0x15')](_0x44ba('0x1c'),_0x401e76[_0x44ba('0x1d')])})[_0x44ba('0x12')](function(_0x2f282a){logger[_0x44ba('0x13')](_0x44ba('0x1e'));return _0x2f282a['user'];});}});}else{logger[_0x44ba('0x13')](_0x44ba('0x1b'));return request({'uri':util[_0x44ba('0x15')]('%s/users/me.json',_0x401e76['remoteUri'])})[_0x44ba('0x12')](function(_0x49a4c5){logger[_0x44ba('0x13')](_0x44ba('0x1e'));return _0x49a4c5['user'];});}}function getEndUser(_0x1ad19f,_0x6330ec,_0x5e286c){logger['info'](_0x44ba('0x1f'),_0x5e286c);return request({'uri':util[_0x44ba('0x15')]('%s/search.json',_0x1ad19f['remoteUri']),'qs':{'query':util['format'](_0x44ba('0x20'),_0x5e286c)}})[_0x44ba('0x12')](function(_0x33996e){var _0x429597;if(_0x33996e[_0x44ba('0x1a')][_0x44ba('0x21')]){_0x33996e[_0x44ba('0x1a')]=_[_0x44ba('0x22')](_0x33996e[_0x44ba('0x1a')],{'suspended':![],'role':_0x44ba('0x23')});if(_0x33996e[_0x44ba('0x1a')][_0x44ba('0x21')]){_0x429597=_['first'](_0x33996e[_0x44ba('0x1a')]);}}if(_0x429597){logger[_0x44ba('0x13')](_0x44ba('0x24'));return _0x429597;}else{logger[_0x44ba('0x13')](_0x44ba('0x25'));return request({'uri':util['format']('%s/users.json',_0x1ad19f[_0x44ba('0x1d')]),'method':_0x44ba('0xd'),'body':{'user':{'role':_0x44ba('0x23'),'name':util[_0x44ba('0x15')](_0x44ba('0x26'),_0x6330ec||_0x5e286c),'phone':_0x5e286c}}})['then'](function(_0x45dae4){logger[_0x44ba('0x13')](_0x44ba('0x27'));return _0x45dae4[_0x44ba('0x28')];});}});}function getAuth(_0x5eacd7){var _0x29ff3f;if(_0x5eacd7[_0x44ba('0x29')]===_0x44ba('0x2a')){_0x29ff3f=util[_0x44ba('0x15')]('%s:%s',_0x5eacd7[_0x44ba('0x2b')],_0x5eacd7[_0x44ba('0x2a')]);}else if(_0x5eacd7['authType']===_0x44ba('0x2c')){_0x29ff3f=util[_0x44ba('0x15')](_0x44ba('0x2d'),_0x5eacd7[_0x44ba('0x2b')],_0x5eacd7[_0x44ba('0x2c')]);}return util[_0x44ba('0x15')](_0x44ba('0x2e'),new Buffer(_0x29ff3f)[_0x44ba('0x2f')]('base64'));}function request(_0x2a9d1f){logger[_0x44ba('0x30')](_0x44ba('0x31'),JSON[_0x44ba('0x32')](_0x2a9d1f));return rp(_['defaults'](_0x2a9d1f,{'method':_0x44ba('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x21fe40,_0x2edb5c){var _0x559624=[];if(_0x21fe40&&_0x21fe40[_0x44ba('0x21')]>0x0){_0x559624=_[_0x44ba('0x34')](_0x21fe40,_0x2edb5c);}return _0x559624;}function getCustomFields(_0x3e1149,_0x524ac4){var _0x56a15d=[];var _0x36ebc4={'custom_fields':[]};if(_0x3e1149[_0x44ba('0x21')]>0x0){_['forEach'](_0x3e1149,function(_0x5bfa7c){if(_['includes'](['string',_0x44ba('0x35')],_0x5bfa7c['type'])&&_0x5bfa7c[_0x44ba('0x36')]&&!_0x5bfa7c[_0x44ba('0x37')]){_0x36ebc4[_0x5bfa7c[_0x44ba('0x36')][_0x44ba('0x38')]()]=_0x5bfa7c[_0x44ba('0x39')][_0x44ba('0x2f')]();}else if(_[_0x44ba('0x3a')]([_0x44ba('0x3b'),_0x44ba('0x35')],_0x5bfa7c[_0x44ba('0x3c')])&&_0x5bfa7c[_0x44ba('0x3d')]&&_0x5bfa7c[_0x44ba('0x37')]){_0x36ebc4[_0x44ba('0x3e')][_0x44ba('0x3f')]({'id':_0x5bfa7c['idField'],'value':_0x5bfa7c[_0x44ba('0x39')][_0x44ba('0x2f')]()});}else if(_0x5bfa7c[_0x44ba('0x3c')]===_0x44ba('0x40')&&_0x5bfa7c[_0x44ba('0x41')]&&_0x5bfa7c['idField']&&_0x5bfa7c[_0x44ba('0x37')]){_0x524ac4[_0x5bfa7c[_0x44ba('0x41')]]&&_0x36ebc4[_0x44ba('0x3e')][_0x44ba('0x3f')]({'id':_0x5bfa7c[_0x44ba('0x3d')],'value':_0x524ac4[_0x5bfa7c[_0x44ba('0x41')]][_0x44ba('0x2f')]()});}else if(_0x5bfa7c[_0x44ba('0x3c')]===_0x44ba('0x42')&&_0x5bfa7c[_0x44ba('0x43')]&&_0x5bfa7c[_0x44ba('0x43')][_0x44ba('0x44')]&&_0x5bfa7c['idField']&&_0x5bfa7c[_0x44ba('0x37')]){_0x524ac4[_0x5bfa7c[_0x44ba('0x43')]['name'][_0x44ba('0x38')]()]&&_0x36ebc4[_0x44ba('0x3e')]['push']({'id':_0x5bfa7c[_0x44ba('0x3d')],'value':_0x524ac4[_0x5bfa7c['Variable']['name'][_0x44ba('0x38')]()][_0x44ba('0x2f')]()});}});}return _0x36ebc4;}exports[_0x44ba('0x45')]=function(_0x820f74,_0x63083a,_0x32269d,_0x30d9ff,_0x48128d,_0x334343){var _0x32920e,_0xfea13e;_0x334343[_0x44ba('0x1d')]=intUtil[_0x44ba('0x46')](_0x334343[_0x44ba('0x1d')]);_0x334343[_0x44ba('0x47')]=intUtil['stripTrailingSlash'](_0x334343[_0x44ba('0x47')]);if(_0x48128d&&_0x48128d['monitor_format']){logger[_0x44ba('0x13')](_0x44ba('0x48'),_0x44ba('0x49'));_0x63083a[_0x44ba('0x4a')]=util[_0x44ba('0x15')](_0x44ba('0x4b'),_0x334343[_0x44ba('0x47')],_0x63083a[_0x44ba('0x4c')],md5(_0x63083a[_0x44ba('0x4c')]));}else{_0x63083a['recordingURL']='';}headers['Authorization']=getAuth(_0x334343);return getUser(_0x334343,_0x30d9ff['email'])['then'](function(_0xc338ae){_0x32920e=_0xc338ae;logger[_0x44ba('0x13')]('The\x20User\x20ID\x20is:',_0x32920e['id']);return getEndUser(_0x334343,_0x63083a[_0x44ba('0x4d')],_0x63083a[_0x44ba('0x4e')]);})[_0x44ba('0x12')](function(_0x5aecc0){_0xfea13e=_0x5aecc0;logger['info'](_0x44ba('0x4f'),_0xfea13e['id']);return getTicket(_0x334343,_0x32920e,_0xfea13e,_0x32269d,_0x63083a);})[_0x44ba('0x12')](function(_0xc84f92){if(_0xc84f92){logger[_0x44ba('0x13')](_0x44ba('0x50'),_0xc84f92['id']);switch(_0x334343[_0x44ba('0x3c')]){case _0x44ba('0x51'):logger[_0x44ba('0x13')]('[QUEUE]',_0x44ba('0x52'));return request({'uri':util[_0x44ba('0x15')](_0x44ba('0x53'),_0x334343[_0x44ba('0x1d')],_0x32920e['id'],_0xc84f92['id']),'method':_0x44ba('0xd')});case _0x44ba('0x54'):logger[_0x44ba('0x13')](_0x44ba('0x48'),_0x44ba('0x55'));emit(util[_0x44ba('0x15')](_0x44ba('0x56'),_0x30d9ff['name']),_0x44ba('0x57'),{'uri':util[_0x44ba('0x15')]('%s/agent/tickets/%s',_0x334343[_0x44ba('0x1d')][_0x44ba('0x58')](_0x44ba('0x59'),''),_0xc84f92['id'])});break;default:logger[_0x44ba('0x5a')](_0x44ba('0x48'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x44ba('0x5b')](function(_0x43d2e5){logger[_0x44ba('0x5a')](_0x44ba('0x5c'),util[_0x44ba('0x5d')](_0x43d2e5,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x595c61,_0x52d302,_0x2b32a7,_0x59f7e6,_0x4d24d4,_0x1eb765,_0x67eeca){var _0x120121,_0x13f387;_0x1eb765[_0x44ba('0x1d')]=intUtil['stripTrailingSlash'](_0x1eb765[_0x44ba('0x1d')]);_0x1eb765[_0x44ba('0x47')]=intUtil[_0x44ba('0x46')](_0x1eb765[_0x44ba('0x47')]);if(_0x67eeca&&_0x67eeca['recordingFormat']&&_0x67eeca[_0x44ba('0x5e')]!==_0x44ba('0x5f')){logger['info']('[OUTBOUND]',_0x44ba('0x49'));_0x52d302[_0x44ba('0x4a')]=util[_0x44ba('0x15')](_0x44ba('0x4b'),_0x1eb765[_0x44ba('0x47')],_0x52d302['uniqueid'],md5(_0x52d302[_0x44ba('0x4c')]));}headers[_0x44ba('0x60')]=getAuth(_0x1eb765);return getUser(_0x1eb765,_0x59f7e6[_0x44ba('0x61')])[_0x44ba('0x12')](function(_0x199d5d){_0x120121=_0x199d5d;logger[_0x44ba('0x13')](_0x44ba('0x62'),_0x120121['id']);return getEndUser(_0x1eb765,_0x52d302[_0x44ba('0x63')],_0x52d302[_0x44ba('0x64')]);})['then'](function(_0xbdb457){_0x13f387=_0xbdb457;logger[_0x44ba('0x13')](_0x44ba('0x4f'),_0x13f387['id']);return getTicket(_0x1eb765,_0x120121,_0x13f387,_0x2b32a7,_0x52d302);})[_0x44ba('0x12')](function(_0x492d63){if(_0x492d63){logger[_0x44ba('0x13')]('The\x20Ticket\x20ID\x20is:',_0x492d63['id']);switch(_0x1eb765['type']){case'integrationTab':logger[_0x44ba('0x13')]('[OUTBOUND]',_0x44ba('0x52'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1eb765[_0x44ba('0x1d')],_0x120121['id'],_0x492d63['id']),'method':_0x44ba('0xd')});case'newTab':logger[_0x44ba('0x13')]('[OUTBOUND]',_0x44ba('0x55'));emit(util[_0x44ba('0x15')](_0x44ba('0x56'),_0x59f7e6[_0x44ba('0x44')]),_0x44ba('0x57'),{'uri':util[_0x44ba('0x15')](_0x44ba('0x65'),_0x1eb765[_0x44ba('0x1d')][_0x44ba('0x58')](_0x44ba('0x59'),''),_0x492d63['id'])});break;default:logger[_0x44ba('0x5a')](_0x44ba('0x66'),_0x44ba('0x67'));}}})['catch'](function(_0x1b1560){logger[_0x44ba('0x5a')](_0x44ba('0x68'),util['inspect'](_0x1b1560,{'showHidden':!![],'depth':null}));});};exports[_0x44ba('0x69')]=function(_0x51294c,_0x2f712f,_0x21d2b1,_0xe2ded,_0x455fd4,_0x4b4c04){var _0x472c5a,_0x18a6b8;_0x4b4c04[_0x44ba('0x1d')]=intUtil['stripTrailingSlash'](_0x4b4c04[_0x44ba('0x1d')]);_0x4b4c04['serverUrl']=intUtil[_0x44ba('0x46')](_0x4b4c04[_0x44ba('0x47')]);if(_0x455fd4&&_0x455fd4[_0x44ba('0x6a')]){logger[_0x44ba('0x13')]('['+_0x2f712f[_0x44ba('0x6b')][_0x44ba('0x6c')]()+']',_0x44ba('0x49'));_0x2f712f['recordingURL']=util[_0x44ba('0x15')](_0x44ba('0x4b'),_0x4b4c04[_0x44ba('0x47')],_0x2f712f[_0x44ba('0x4c')],md5(_0x2f712f['uniqueid']));}else{_0x2f712f[_0x44ba('0x4a')]='';}headers[_0x44ba('0x60')]=getAuth(_0x4b4c04);return getUser(_0x4b4c04)[_0x44ba('0x12')](function(_0x497005){_0x472c5a=_0x497005;logger[_0x44ba('0x13')]('The\x20User\x20ID\x20is:',_0x472c5a['id']);return getEndUser(_0x4b4c04,_0x2f712f[_0x44ba('0x4d')],_0x2f712f[_0x44ba('0x4e')]);})[_0x44ba('0x12')](function(_0x6277be){_0x18a6b8=_0x6277be;logger['info'](_0x44ba('0x4f'),_0x18a6b8['id']);return getTicket(_0x4b4c04,_0x472c5a,_0x18a6b8,_0x21d2b1,_0x2f712f);})[_0x44ba('0x12')](function(_0x1c577b){if(_0x1c577b){logger[_0x44ba('0x13')](_0x44ba('0x50'),_0x1c577b['id']);}})[_0x44ba('0x5b')](function(_0x4f0f95){logger[_0x44ba('0x5a')]('['+_0x2f712f[_0x44ba('0x6b')][_0x44ba('0x6c')]()+']'+_0x44ba('0x6d'),util[_0x44ba('0x5d')](_0x4f0f95,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7621=['recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','destcalleridnum','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','username','token','base64','debug','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','toLowerCase','toString','includes','idField','content','variable','variableName','custom_fields','push','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0x7621,0x1dd));var _0x1762=function(_0x2533b6,_0x467fba){_0x2533b6=_0x2533b6-0x0;var _0x1d57ef=_0x7621[_0x2533b6];return _0x1d57ef;};'use strict';var _=require('lodash');var rp=require(_0x1762('0x0'));var md5=require(_0x1762('0x1'));var util=require(_0x1762('0x2'));var Redis=require(_0x1762('0x3'));var intUtil=require(_0x1762('0x4'));var config=require(_0x1762('0x5'));var logger=require(_0x1762('0x6'))(_0x1762('0x7'));config[_0x1762('0x8')]=_[_0x1762('0x9')](config[_0x1762('0x8')],{'host':_0x1762('0xa'),'port':0x18eb});var io=require(_0x1762('0xb'))(new Redis(config[_0x1762('0x8')]));function emit(_0x3d1d6a,_0x5662ec,_0x4e0767){io['to'](_0x3d1d6a)['emit'](_0x5662ec,_0x4e0767);}var headers={'Content-Type':_0x1762('0xc'),'Accept':_0x1762('0xc')};function getTicket(_0x5e0cf6,_0x6b4ab7,_0x42492d,_0x1bf26d,_0x10949e){logger[_0x1762('0xd')](_0x1762('0xe'));return request({'uri':util[_0x1762('0xf')]('%s/tickets.json',_0x5e0cf6[_0x1762('0x10')]),'method':_0x1762('0x11'),'body':{'ticket':_[_0x1762('0x12')]({'requester_id':_0x42492d['id'],'submitter_id':_0x6b4ab7?_0x6b4ab7['id']:undefined,'assignee_id':_0x6b4ab7?_0x6b4ab7['id']:undefined,'tags':getTags(_0x1bf26d[_0x1762('0x13')],_0x1762('0x14')),'subject':intUtil[_0x1762('0x15')](_0x1bf26d[_0x1762('0x16')],_0x10949e,'\x20'),'description':intUtil[_0x1762('0x15')](_0x1bf26d[_0x1762('0x17')],_0x10949e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1762('0x15')](_0x1bf26d[_0x1762('0x17')],_0x10949e,'\x0a')}},getCustomFields(_0x1bf26d['Fields'],_0x10949e))}})[_0x1762('0x18')](function(_0x3571f1){logger[_0x1762('0xd')](_0x1762('0x19'));return _0x3571f1[_0x1762('0x1a')];});}function getUser(_0x5b64a9,_0x47ced2){if(intUtil['validateEmail'](_0x47ced2)){logger[_0x1762('0xd')](_0x1762('0x1b'),_0x47ced2);return request({'uri':util[_0x1762('0xf')]('%s/search.json',_0x5b64a9[_0x1762('0x10')]),'qs':{'query':util['format'](_0x1762('0x1c'),_0x47ced2)}})[_0x1762('0x18')](function(_0x5e05da){if(_0x5e05da[_0x1762('0x1d')]){logger['info'](_0x1762('0x1e'));return _['find'](_0x5e05da[_0x1762('0x1f')],{'email':_0x47ced2,'role':_0x1762('0x20')});}else{logger[_0x1762('0xd')](_0x1762('0x21'));return request({'uri':util[_0x1762('0xf')](_0x1762('0x22'),_0x5b64a9[_0x1762('0x10')])})[_0x1762('0x18')](function(_0x147bfe){logger[_0x1762('0xd')](_0x1762('0x23'));return _0x147bfe['user'];});}});}else{logger[_0x1762('0xd')](_0x1762('0x21'));return request({'uri':util[_0x1762('0xf')](_0x1762('0x22'),_0x5b64a9[_0x1762('0x10')])})[_0x1762('0x18')](function(_0x24eefe){logger[_0x1762('0xd')](_0x1762('0x23'));return _0x24eefe[_0x1762('0x24')];});}}function getEndUser(_0x2cb253,_0x44b96a,_0x58dab8){logger[_0x1762('0xd')](_0x1762('0x25'),_0x58dab8);return request({'uri':util[_0x1762('0xf')](_0x1762('0x26'),_0x2cb253[_0x1762('0x10')]),'qs':{'query':util[_0x1762('0xf')](_0x1762('0x27'),_0x58dab8)}})[_0x1762('0x18')](function(_0x35b858){var _0x2090e6;if(_0x35b858[_0x1762('0x1f')][_0x1762('0x28')]){_0x35b858['results']=_[_0x1762('0x29')](_0x35b858['results'],{'suspended':![],'role':_0x1762('0x2a')});if(_0x35b858['results'][_0x1762('0x28')]){_0x2090e6=_[_0x1762('0x2b')](_0x35b858[_0x1762('0x1f')]);}}if(_0x2090e6){logger['info'](_0x1762('0x2c'));return _0x2090e6;}else{logger[_0x1762('0xd')](_0x1762('0x2d'));return request({'uri':util[_0x1762('0xf')](_0x1762('0x2e'),_0x2cb253[_0x1762('0x10')]),'method':_0x1762('0x11'),'body':{'user':{'role':_0x1762('0x2a'),'name':util[_0x1762('0xf')]('Caller\x20-\x20%s',_0x44b96a||_0x58dab8),'phone':_0x58dab8}}})['then'](function(_0x38f370){logger['info']('Enduser\x20created.');return _0x38f370[_0x1762('0x24')];});}});}function getAuth(_0x572271){var _0x13a241;if(_0x572271[_0x1762('0x2f')]===_0x1762('0x30')){_0x13a241=util[_0x1762('0xf')]('%s:%s',_0x572271[_0x1762('0x31')],_0x572271[_0x1762('0x30')]);}else if(_0x572271[_0x1762('0x2f')]===_0x1762('0x32')){_0x13a241=util['format']('%s/token:%s',_0x572271['username'],_0x572271[_0x1762('0x32')]);}return util[_0x1762('0xf')]('Basic\x20%s',new Buffer(_0x13a241)['toString'](_0x1762('0x33')));}function request(_0x4f6bec){logger[_0x1762('0x34')](_0x1762('0x35'),JSON[_0x1762('0x36')](_0x4f6bec));return rp(_[_0x1762('0x9')](_0x4f6bec,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x48ac75,_0x3979a8){var _0x18828f=[];if(_0x48ac75&&_0x48ac75[_0x1762('0x28')]>0x0){_0x18828f=_[_0x1762('0x37')](_0x48ac75,_0x3979a8);}return _0x18828f;}function getCustomFields(_0x3f9433,_0x1f7139){var _0x27c596=[];var _0x2a6056={'custom_fields':[]};if(_0x3f9433[_0x1762('0x28')]>0x0){_[_0x1762('0x38')](_0x3f9433,function(_0xfa4efb){if(_['includes']([_0x1762('0x39'),_0x1762('0x3a')],_0xfa4efb[_0x1762('0x3b')])&&_0xfa4efb[_0x1762('0x3c')]&&!_0xfa4efb[_0x1762('0x3d')]){_0x2a6056[_0xfa4efb[_0x1762('0x3c')][_0x1762('0x3e')]()]=_0xfa4efb['content'][_0x1762('0x3f')]();}else if(_[_0x1762('0x40')]([_0x1762('0x39'),_0x1762('0x3a')],_0xfa4efb[_0x1762('0x3b')])&&_0xfa4efb[_0x1762('0x41')]&&_0xfa4efb['customField']){_0x2a6056['custom_fields']['push']({'id':_0xfa4efb[_0x1762('0x41')],'value':_0xfa4efb[_0x1762('0x42')][_0x1762('0x3f')]()});}else if(_0xfa4efb['type']===_0x1762('0x43')&&_0xfa4efb[_0x1762('0x44')]&&_0xfa4efb[_0x1762('0x41')]&&_0xfa4efb[_0x1762('0x3d')]){_0x1f7139[_0xfa4efb[_0x1762('0x44')]]&&_0x2a6056[_0x1762('0x45')][_0x1762('0x46')]({'id':_0xfa4efb[_0x1762('0x41')],'value':_0x1f7139[_0xfa4efb['variableName']][_0x1762('0x3f')]()});}else if(_0xfa4efb['type']===_0x1762('0x47')&&_0xfa4efb[_0x1762('0x48')]&&_0xfa4efb[_0x1762('0x48')][_0x1762('0x14')]&&_0xfa4efb[_0x1762('0x41')]&&_0xfa4efb[_0x1762('0x3d')]){_0x1f7139[_0xfa4efb[_0x1762('0x48')]['name']['toLowerCase']()]&&_0x2a6056[_0x1762('0x45')][_0x1762('0x46')]({'id':_0xfa4efb[_0x1762('0x41')],'value':_0x1f7139[_0xfa4efb[_0x1762('0x48')][_0x1762('0x14')]['toLowerCase']()][_0x1762('0x3f')]()});}});}return _0x2a6056;}exports['queue']=function(_0x5ec676,_0x17a9d2,_0x4f232a,_0x2e9b3e,_0x42fec9,_0x109e11){var _0x3cda39,_0x4915f7;_0x109e11[_0x1762('0x10')]=intUtil['stripTrailingSlash'](_0x109e11[_0x1762('0x10')]);_0x109e11[_0x1762('0x49')]=intUtil[_0x1762('0x4a')](_0x109e11[_0x1762('0x49')]);if(_0x42fec9&&_0x42fec9[_0x1762('0x4b')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x17a9d2['recordingURL']=util[_0x1762('0xf')](_0x1762('0x4c'),_0x109e11[_0x1762('0x49')],_0x17a9d2[_0x1762('0x4d')],md5(_0x17a9d2[_0x1762('0x4d')]));}else{_0x17a9d2[_0x1762('0x4e')]='';}headers['Authorization']=getAuth(_0x109e11);return getUser(_0x109e11,_0x2e9b3e[_0x1762('0x4f')])[_0x1762('0x18')](function(_0x25540d){_0x3cda39=_0x25540d;logger[_0x1762('0xd')](_0x1762('0x50'),_0x3cda39['id']);return getEndUser(_0x109e11,_0x17a9d2[_0x1762('0x51')],_0x17a9d2[_0x1762('0x52')]);})[_0x1762('0x18')](function(_0x53c099){_0x4915f7=_0x53c099;logger[_0x1762('0xd')](_0x1762('0x53'),_0x4915f7['id']);return getTicket(_0x109e11,_0x3cda39,_0x4915f7,_0x4f232a,_0x17a9d2);})[_0x1762('0x18')](function(_0x1f453f){if(_0x1f453f){logger['info'](_0x1762('0x54'),_0x1f453f['id']);switch(_0x109e11[_0x1762('0x3b')]){case _0x1762('0x55'):logger['info'](_0x1762('0x56'),_0x1762('0x57'));return request({'uri':util['format'](_0x1762('0x58'),_0x109e11[_0x1762('0x10')],_0x3cda39['id'],_0x1f453f['id']),'method':'POST'});case'newTab':logger[_0x1762('0xd')]('[QUEUE]',_0x1762('0x59'));emit(util[_0x1762('0xf')](_0x1762('0x5a'),_0x2e9b3e[_0x1762('0x14')]),_0x1762('0x5b'),{'uri':util['format'](_0x1762('0x5c'),_0x109e11['remoteUri'][_0x1762('0x5d')]('/api/v2',''),_0x1f453f['id'])});break;default:logger[_0x1762('0x5e')]('[QUEUE]',_0x1762('0x5f'));}}})[_0x1762('0x60')](function(_0x897d2a){logger[_0x1762('0x5e')](_0x1762('0x61'),util[_0x1762('0x62')](_0x897d2a,{'showHidden':!![],'depth':null}));});};exports[_0x1762('0x63')]=function(_0xbb4e9,_0x4bf9b5,_0x418065,_0x415172,_0x5b7da1,_0x51bf89,_0x1ef5b4){var _0x353dff,_0x221130;_0x51bf89['remoteUri']=intUtil[_0x1762('0x4a')](_0x51bf89['remoteUri']);_0x51bf89[_0x1762('0x49')]=intUtil['stripTrailingSlash'](_0x51bf89[_0x1762('0x49')]);if(_0x1ef5b4&&_0x1ef5b4[_0x1762('0x64')]&&_0x1ef5b4[_0x1762('0x64')]!==_0x1762('0x65')){logger[_0x1762('0xd')](_0x1762('0x66'),_0x1762('0x67'));_0x4bf9b5['recordingURL']=util['format'](_0x1762('0x4c'),_0x51bf89[_0x1762('0x49')],_0x4bf9b5[_0x1762('0x4d')],md5(_0x4bf9b5[_0x1762('0x4d')]));}headers[_0x1762('0x68')]=getAuth(_0x51bf89);return getUser(_0x51bf89,_0x415172[_0x1762('0x4f')])[_0x1762('0x18')](function(_0x1aac7e){_0x353dff=_0x1aac7e;logger[_0x1762('0xd')](_0x1762('0x50'),_0x353dff['id']);return getEndUser(_0x51bf89,_0x4bf9b5['destcalleridname'],_0x4bf9b5[_0x1762('0x69')]);})[_0x1762('0x18')](function(_0x5cb556){_0x221130=_0x5cb556;logger[_0x1762('0xd')](_0x1762('0x53'),_0x221130['id']);return getTicket(_0x51bf89,_0x353dff,_0x221130,_0x418065,_0x4bf9b5);})[_0x1762('0x18')](function(_0x354ceb){if(_0x354ceb){logger['info']('The\x20Ticket\x20ID\x20is:',_0x354ceb['id']);switch(_0x51bf89['type']){case _0x1762('0x55'):logger[_0x1762('0xd')](_0x1762('0x66'),_0x1762('0x57'));return request({'uri':util[_0x1762('0xf')](_0x1762('0x58'),_0x51bf89[_0x1762('0x10')],_0x353dff['id'],_0x354ceb['id']),'method':_0x1762('0x11')});case _0x1762('0x6a'):logger[_0x1762('0xd')](_0x1762('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1762('0xf')](_0x1762('0x5a'),_0x415172['name']),_0x1762('0x5b'),{'uri':util[_0x1762('0xf')](_0x1762('0x5c'),_0x51bf89['remoteUri'][_0x1762('0x5d')]('/api/v2',''),_0x354ceb['id'])});break;default:logger['error'](_0x1762('0x66'),_0x1762('0x5f'));}}})[_0x1762('0x60')](function(_0x25ba10){logger[_0x1762('0x5e')](_0x1762('0x6b'),util[_0x1762('0x62')](_0x25ba10,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x18c97c,_0x1eb353,_0xf3bbb8,_0x3d547f,_0xdcee35,_0x3bd89f){var _0x5e938b,_0x19eb64;_0x3bd89f[_0x1762('0x10')]=intUtil['stripTrailingSlash'](_0x3bd89f['remoteUri']);_0x3bd89f[_0x1762('0x49')]=intUtil[_0x1762('0x4a')](_0x3bd89f[_0x1762('0x49')]);if(_0xdcee35&&_0xdcee35['monitor_format']){logger['info']('['+_0x1eb353[_0x1762('0x6c')][_0x1762('0x6d')]()+']','Recording\x20is\x20enabled!');_0x1eb353[_0x1762('0x4e')]=util[_0x1762('0xf')](_0x1762('0x4c'),_0x3bd89f[_0x1762('0x49')],_0x1eb353['uniqueid'],md5(_0x1eb353[_0x1762('0x4d')]));}else{_0x1eb353[_0x1762('0x4e')]='';}headers['Authorization']=getAuth(_0x3bd89f);return getUser(_0x3bd89f)[_0x1762('0x18')](function(_0x469d81){_0x5e938b=_0x469d81;logger['info']('The\x20User\x20ID\x20is:',_0x5e938b['id']);return getEndUser(_0x3bd89f,_0x1eb353[_0x1762('0x51')],_0x1eb353['calleridnum']);})[_0x1762('0x18')](function(_0x51dbc0){_0x19eb64=_0x51dbc0;logger[_0x1762('0xd')](_0x1762('0x53'),_0x19eb64['id']);return getTicket(_0x3bd89f,_0x5e938b,_0x19eb64,_0xf3bbb8,_0x1eb353);})[_0x1762('0x18')](function(_0x1af6a0){if(_0x1af6a0){logger[_0x1762('0xd')](_0x1762('0x54'),_0x1af6a0['id']);}})[_0x1762('0x60')](function(_0x598eaa){logger[_0x1762('0x5e')]('['+_0x1eb353[_0x1762('0x6c')][_0x1762('0x6d')]()+']'+_0x1762('0x6e'),util[_0x1762('0x62')](_0x598eaa,{'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 2225062..a3f9a13 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 _0xb315=['then','add','catch','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','getString','Subjects','Description','Descriptions','enduserType','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','Fields','Call\x20created!','err','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','zoho.eu','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','unmanaged','monitor_format','toUpperCase','lodash','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xb315,0x6f));var _0x5b31=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xb315[_0x361d3f];return _0x320229;};'use strict';var _=require(_0x5b31('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x5b31('0x1'));var intUtil=require(_0x5b31('0x2'));var moment=require(_0x5b31('0x3'));var Redis=require(_0x5b31('0x4'));var BPromise=require('bluebird');var config=require(_0x5b31('0x5'));var logger=require(_0x5b31('0x6'))(_0x5b31('0x7'));config[_0x5b31('0x8')]=_['defaults'](config[_0x5b31('0x8')],{'host':_0x5b31('0x9'),'port':0x18eb});var io=require(_0x5b31('0xa'))(new Redis(config['redis']));function emit(_0xc60941,_0x53c6ca,_0x3114a7){io['to'](_0xc60941)[_0x5b31('0xb')](_0x53c6ca,_0x3114a7);}function request(_0x162557){logger[_0x5b31('0xc')](_0x5b31('0xd'),JSON[_0x5b31('0xe')](_0x162557));return rp(_0x162557);}function getCustomFields(_0x1d6418,_0x186950){var _0x490007={};if(_0x1d6418['length']>0x0){_['forEach'](_0x1d6418,function(_0x465c08){if(_['includes']([_0x5b31('0xf'),_0x5b31('0x10')],_0x465c08[_0x5b31('0x11')])&&_0x465c08[_0x5b31('0x12')]){_0x490007[_0x465c08[_0x5b31('0x12')]]=_0x465c08[_0x5b31('0x13')][_0x5b31('0x14')]();}else if(_0x465c08['type']===_0x5b31('0x15')&&_0x465c08[_0x5b31('0x16')]&&_0x465c08[_0x5b31('0x12')]&&_0x186950[_0x465c08[_0x5b31('0x16')]]){_0x490007[_0x465c08[_0x5b31('0x12')]]=_0x186950[_0x465c08[_0x5b31('0x16')]][_0x5b31('0x14')]();}else if(_0x465c08[_0x5b31('0x11')]===_0x5b31('0x17')&&_0x465c08[_0x5b31('0x18')]&&_0x465c08[_0x5b31('0x18')]['name']&&_0x465c08['idField']&&_0x186950[_0x465c08[_0x5b31('0x18')][_0x5b31('0x19')][_0x5b31('0x1a')]()]){_0x490007[_0x465c08[_0x5b31('0x12')]]=_0x186950[_0x465c08[_0x5b31('0x18')]['name']['toLowerCase']()]['toString']();}});}return _0x490007;}function getName(_0x45ac12){if(_0x45ac12[_0x5b31('0x1b')]('\x20')>0x0){var _0x26c88c=_0x45ac12['split'](/ (.+)/);if(_0x26c88c[0x1]){return _0x26c88c;}}return[_0x45ac12,_0x45ac12];}var accountsTokens={};function getAccessToken(_0x5abf97){return new Promise(function(_0x59548c,_0x109f2b){if(!_[_0x5b31('0x1c')](accountsTokens[_0x5abf97['id']])&&!_[_0x5b31('0x1c')](accountsTokens[_0x5abf97['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x5abf97['id']][_0x5b31('0x1d')])){_0x59548c(accountsTokens[_0x5abf97['id']][_0x5b31('0x1e')]);}}var _0x5bea9e;switch(_0x5abf97[_0x5b31('0x1f')]){case'US':_0x5bea9e=_0x5b31('0x20');break;case'AU':_0x5bea9e=_0x5b31('0x21');break;case'EU':_0x5bea9e=_0x5b31('0x22');break;case'IN':_0x5bea9e='https://accounts.zoho.in';break;case'CN':_0x5bea9e=_0x5b31('0x23');break;default:_0x5bea9e=_0x5b31('0x22');break;}var _0x36e27d={'method':_0x5b31('0x24'),'uri':_0x5bea9e+_0x5b31('0x25'),'qs':{'refresh_token':_0x5abf97[_0x5b31('0x26')],'client_id':_0x5abf97[_0x5b31('0x27')],'client_secret':_0x5abf97['clientSecret'],'grant_type':_0x5b31('0x28')},'json':!![]};return rp(_0x36e27d)[_0x5b31('0x29')](function(_0x1304ab){accountsTokens[_0x5abf97['id']]={'access_token':_0x1304ab[_0x5b31('0x1e')],'expires_in':moment()[_0x5b31('0x2a')](_0x1304ab['expires_in'],'seconds')};_0x59548c(_0x1304ab[_0x5b31('0x1e')]);})[_0x5b31('0x2b')](function(_0x1b556c){logger['error']('Failing\x20creating\x20the\x20access_token',_0x1b556c[_0x5b31('0x2c')]);_0x109f2b(_0x1b556c);});});}function getUser(_0x1ee8a5,_0x556561,_0xda9640,_0x1611ca){logger[_0x5b31('0x2d')]('Search\x20user');return request({'method':_0x5b31('0x2e'),'uri':util[_0x5b31('0x2f')](_0x5b31('0x30'),_0x556561),'qs':{'type':_0x5b31('0x31')},'headers':{'Authorization':_0x5b31('0x32')+_0x1ee8a5},'json':!![]})['then'](function(_0x4e444c){if(_0x4e444c['users']){var _0x1585d9=-0x1;if(_[_0x5b31('0x33')](_0x4e444c[_0x5b31('0x34')])){if(!_[_0x5b31('0x1c')](_0x1611ca)){_0x1585d9=_[_0x5b31('0x35')](_0x4e444c[_0x5b31('0x34')],function(_0x64fee2){return _0x64fee2[_0x5b31('0x36')]===_0x1611ca;});}if(_0x1585d9>=0x0){logger[_0x5b31('0x2d')](_0x5b31('0x37'));}else{logger['info'](_0x5b31('0x38'));_0x1585d9=_[_0x5b31('0x35')](_0x4e444c[_0x5b31('0x34')],function(_0x4e019a){return _0x4e019a[_0x5b31('0x39')][_0x5b31('0x19')]===_0x5b31('0x3a');});}return _0x4e444c['users'][_0x1585d9];}else{if(_0x4e444c[_0x5b31('0x3b')][_0x5b31('0x39')][_0x5b31('0x19')]===_0x5b31('0x3a')){logger[_0x5b31('0x2d')](_0x5b31('0x38'));user=_0x4e444c[_0x5b31('0x3b')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x5b31('0xe')](_0x4e444c));throw new Error(_0x5b31('0x3c')+JSON[_0x5b31('0xe')](_0x4e444c));}}}else{logger[_0x5b31('0x3d')]('The\x20failing\x20result\x20is',JSON[_0x5b31('0xe')](_0x4e444c));throw new Error(_0x5b31('0x3c')+JSON[_0x5b31('0xe')](_0x4e444c));}})[_0x5b31('0x2b')](function(_0x10d417){console[_0x5b31('0x3d')](_0x10d417);});}function getZohoUser(_0x4bc822,_0x5edb2a){return new BPromise(function(_0x4003f6,_0x34e5a0){request(_0x4bc822)['then'](function(_0x2e8bc3){var _0x22cb76=null;if(_0x2e8bc3){_0x22cb76=_0x2e8bc3[_0x5b31('0x3e')][0x0];_0x22cb76['enduserType']=_0x5edb2a;}_0x4003f6(_0x22cb76);})[_0x5b31('0x2b')](function(_0x29cc51){_0x34e5a0(_0x29cc51);});});}function createEndUser(_0x488279,_0x390352,_0x5ed808,_0x5de10d,_0x3a3993,_0xd6f17b){var _0x5ed808=getName(_0x5ed808);return request({'method':_0x5b31('0x24'),'uri':'https://www.zohoapis.'+_0x390352+_0x5b31('0x3f')+_[_0x5b31('0x40')](_0xd6f17b[_0x5b31('0x41')])+'s','body':{'data':[{'Last_Name':_0x5ed808[0x1],'First_Name':_0x5ed808[0x0],'Phone':_0x5de10d,'Owner':{'name':!_['isNil'](_0x3a3993[_0x5b31('0x42')][_0x5b31('0x19')])?_0x3a3993['role'][_0x5b31('0x19')]:!_['isNil'](_0x3a3993[_0x5b31('0x43')])?_0x3a3993[_0x5b31('0x43')]+'\x20'+_0x3a3993['last_name']:_0x3a3993[_0x5b31('0x44')],'id':_0x3a3993['id']}}]},'headers':{'Authorization':_0x5b31('0x32')+_0x488279},'json':!![]})['then'](function(_0x55c320){if(_0x55c320&&_0x55c320[_0x5b31('0x3e')][0x0][_0x5b31('0x45')]===_0x5b31('0x46')){var _0x24d22c=_0x55c320[_0x5b31('0x3e')][0x0][_0x5b31('0x47')];_0x24d22c['enduserType']=_[_0x5b31('0x40')](_0xd6f17b[_0x5b31('0x41')])+'s';return _0x24d22c;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x5b31('0xe')](data));throw new Error(_0x5b31('0x48')+JSON[_0x5b31('0xe')](data));})[_0x5b31('0x2b')](function(_0x42a415){console[_0x5b31('0x49')](_0x5b31('0x4a'),_0x42a415);});}function getEndUser(_0x45bc82,_0x22ef84,_0x45ceb0,_0x5ccea3,_0x1ac981,_0x657cbf,_0x27554c){var _0x16af4d={'method':_0x5b31('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45bc82},'json':!![]};switch(_0x27554c['moduleSearch']){case'contact_lead':_0x16af4d[_0x5b31('0x4b')]='https://www.zohoapis.'+_0x22ef84+_0x5b31('0x4c')+_0x1ac981+'))';return getZohoUser(_0x16af4d,_0x5b31('0x4d'))['then'](function(_0x1f7f96){if(_0x1f7f96)return _0x1f7f96;_0x16af4d[_0x5b31('0x4b')]=_0x5b31('0x4e')+_0x22ef84+_0x5b31('0x4f')+_0x1ac981+'))';return getZohoUser(_0x16af4d,_0x5b31('0x50'))[_0x5b31('0x29')](function(_0x1e3fd9){if(_0x1e3fd9)return _0x1e3fd9;if(_0x27554c[_0x5b31('0x41')]!=_0x5b31('0x51')){return createEndUser(_0x45bc82,_0x22ef84,_0x5ccea3,_0x1ac981,_0x657cbf,_0x27554c);}else{return{};}});});break;case _0x5b31('0x52'):_0x16af4d['uri']=_0x5b31('0x4e')+_0x22ef84+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1ac981+'))';return getZohoUser(_0x16af4d,'Contacts')['then'](function(_0x58c8b8){if(_0x58c8b8)return _0x58c8b8;if(_0x27554c[_0x5b31('0x41')]!=_0x5b31('0x51')){return createEndUser(_0x45bc82,_0x22ef84,_0x5ccea3,_0x1ac981,_0x657cbf,_0x27554c);}else{return{};}});break;case _0x5b31('0x53'):_0x16af4d['uri']=_0x5b31('0x4e')+_0x22ef84+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1ac981+'))';return getZohoUser(_0x16af4d,_0x5b31('0x50'))[_0x5b31('0x29')](function(_0x3a04ac){if(_0x3a04ac)return _0x3a04ac;if(_0x27554c[_0x5b31('0x41')]!=_0x5b31('0x51')){return createEndUser(_0x45bc82,_0x22ef84,_0x5ccea3,_0x1ac981,_0x657cbf,_0x27554c);}else{return{};}});break;}}function getCall(_0x2126f5,_0x4966dd,_0x450f77,_0x23f5a2,_0x2a0829,_0x20f383,_0x5e36e0,_0x1991f3){logger['info'](_0x5b31('0x54'));var _0x955df5={};_0x955df5[_0x5b31('0x55')]={'name':!_['isNil'](_0x23f5a2[_0x5b31('0x42')][_0x5b31('0x19')])&&!_[_0x5b31('0x1c')](_0x23f5a2[_0x5b31('0x39')]['name'])&&_0x23f5a2[_0x5b31('0x39')][_0x5b31('0x19')]==='administrator'?_0x23f5a2[_0x5b31('0x42')][_0x5b31('0x19')]:!_[_0x5b31('0x1c')](_0x23f5a2[_0x5b31('0x43')])?_0x23f5a2['first_name']+'\x20'+_0x23f5a2[_0x5b31('0x44')]:_0x23f5a2[_0x5b31('0x44')],'id':_0x23f5a2['id']};_0x955df5['Subject']=intUtil[_0x5b31('0x56')](_0x20f383[_0x5b31('0x57')],_0x5e36e0,'\x20');_0x955df5[_0x5b31('0x58')]=intUtil['getString'](_0x20f383[_0x5b31('0x59')],_0x5e36e0,'\x0a');if(_0x2a0829[_0x5b31('0x5a')]===_0x5b31('0x4d')){_0x955df5[_0x5b31('0x5b')]={'name':!_[_0x5b31('0x1c')](_0x2a0829['Full_Name'])?_0x2a0829['Full_Name']:!_['isNil'](_0x2a0829[_0x5b31('0x5c')])?_0x2a0829[_0x5b31('0x5c')]+'\x20'+_0x2a0829['Last_Name']:_0x2a0829[_0x5b31('0x5d')],'id':_0x2a0829['id']};}if(_0x2a0829['enduserType']===_0x5b31('0x50')){_0x955df5[_0x5b31('0x5e')]={'name':!_[_0x5b31('0x1c')](_0x2a0829[_0x5b31('0x5f')])?_0x2a0829['Full_Name']:!_[_0x5b31('0x1c')](_0x2a0829[_0x5b31('0x5c')])?_0x2a0829[_0x5b31('0x5c')]+'\x20'+_0x2a0829['Last_Name']:_0x2a0829['Last_Name'],'id':_0x2a0829['id']};_0x955df5[_0x5b31('0x60')]=_[_0x5b31('0x40')](_0x2a0829['enduserType']);}if(_0x5e36e0[_0x5b31('0x61')]){_0x955df5[_0x5b31('0x62')]=moment[_0x5b31('0x63')](parseInt(_0x5e36e0[_0x5b31('0x61')])*0x3e8)[_0x5b31('0x2f')](_0x5b31('0x64'));}else if(_0x5e36e0[_0x5b31('0x65')]&&_0x5e36e0['endtime']){_0x955df5[_0x5b31('0x62')]=moment[_0x5b31('0x63')](moment(_0x5e36e0['endtime'],_0x5b31('0x66'))[_0x5b31('0x67')](moment(_0x5e36e0[_0x5b31('0x68')],_0x5b31('0x66'))))[_0x5b31('0x2f')](_0x5b31('0x64'));}switch(_0x5e36e0[_0x5b31('0x69')]){case _0x5b31('0x6a'):_0x955df5['Call_Result']=_0x5b31('0x6b');break;case _0x5b31('0x6c'):case _0x5b31('0x6d'):_0x955df5[_0x5b31('0x6e')]=_0x5b31('0x6f');break;case _0x5b31('0x70'):_0x955df5[_0x5b31('0x6e')]=_0x5b31('0x71');break;case'abandoned':_0x955df5['Call_Result']=_0x5b31('0x72');break;case _0x5b31('0x73'):_0x955df5[_0x5b31('0x6e')]=_0x5b31('0x74');default:}_0x955df5['Call_Start_Time']=(_0x1991f3===_0x5b31('0x75')?moment(_0x5e36e0[_0x5b31('0x68')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x5e36e0['agentcalledAt'])[_0x5b31('0x2f')](_0x5b31('0x66')))||moment()[_0x5b31('0x2f')](_0x5b31('0x66'));_0x955df5[_0x5b31('0x76')]=_0x1991f3||_0x5b31('0x77');_0x955df5=_['merge'](_0x955df5,getCustomFields(_0x20f383[_0x5b31('0x78')],_0x5e36e0));return request({'method':'POST','uri':_0x5b31('0x4e')+_0x4966dd+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2126f5},'body':{'data':[_0x955df5]},'json':!![]})[_0x5b31('0x29')](function(_0x3cf737){if(_0x3cf737&&_0x3cf737['data'][0x0][_0x5b31('0x45')]===_0x5b31('0x46')){logger['info'](_0x5b31('0x79'));return{'id':_0x3cf737[_0x5b31('0x3e')][0x0]['details']['id']};}})['catch'](function(_0x3e0503){logger[_0x5b31('0x2d')](_0x5b31('0x7a'),_0x3e0503[_0x5b31('0x2c')]);console[_0x5b31('0x49')](_0x5b31('0x7a'),_0x3e0503);});}exports['queue']=function(_0x2d5e2e,_0x3991a2,_0x4f51e3,_0x30ca30,_0x4ae003,_0x585ace){var _0x1db39b,_0x524f4f,_0xa80529;_0x585ace[_0x5b31('0x7b')]=intUtil['stripTrailingSlash'](_0x585ace['host']);_0x585ace[_0x5b31('0x7c')]=intUtil['stripTrailingSlash'](_0x585ace[_0x5b31('0x7c')]);if(_0x4ae003&&_0x4ae003['monitor_format']){logger['info'](_0x5b31('0x7d'),_0x5b31('0x7e'));_0x3991a2[_0x5b31('0x7f')]=_0x585ace['serverUrl']+_0x5b31('0x80')+_0x3991a2[_0x5b31('0x81')]+_0x5b31('0x82')+md5(_0x3991a2[_0x5b31('0x81')]);}else{_0x3991a2[_0x5b31('0x7f')]='';}var _0x592590=_0x585ace[_0x5b31('0x7b')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x585ace)[_0x5b31('0x29')](function(_0x409552){_0xa80529=_0x409552;return getUser(_0xa80529,_0x592590,_0x585ace,_0x30ca30[_0x5b31('0x36')]);})[_0x5b31('0x29')](function(_0x2e6be3){_0x1db39b=_0x2e6be3;logger[_0x5b31('0x2d')]('The\x20User\x20ID\x20is:',_0x1db39b['id']);return getEndUser(_0xa80529,_0x592590,_0x585ace,_0x3991a2[_0x5b31('0x83')],_0x3991a2[_0x5b31('0x84')],_0x1db39b,_0x4f51e3);})[_0x5b31('0x29')](function(_0x475679){_0x524f4f=_0x475679;return getCall(_0xa80529,_0x592590,_0x585ace,_0x1db39b,_0x524f4f,_0x4f51e3,_0x3991a2,_0x5b31('0x77'));})[_0x5b31('0x29')](function(_0x20b160){if(_0x20b160){logger[_0x5b31('0x2d')]('The\x20Call\x20ID\x20is:',_0x20b160['id']);logger[_0x5b31('0x2d')](_0x5b31('0x7d'),_0x5b31('0x85'));emit(util[_0x5b31('0x2f')](_0x5b31('0x86'),_0x30ca30[_0x5b31('0x19')]),'trigger:browser:url',{'uri':_0x5b31('0x87')+_0x585ace[_0x5b31('0x7b')]+_0x5b31('0x88')+_0x20b160['id']});}})[_0x5b31('0x2b')](function(_0x335bb8){logger[_0x5b31('0x3d')](_0x5b31('0x7d'),JSON[_0x5b31('0xe')](_0x335bb8));});};exports['outbound']=function(_0x23fa5d,_0x1debb5,_0x14d5cd,_0x16e6ae,_0x49c5a4,_0x5acbf1,_0x3d8e21){var _0x2c4d94,_0x450ca2,_0x3bcbf3;_0x5acbf1['host']=intUtil['stripTrailingSlash'](_0x5acbf1[_0x5b31('0x7b')]);_0x5acbf1['serverUrl']=intUtil[_0x5b31('0x89')](_0x5acbf1['serverUrl']);if(_0x3d8e21&&_0x3d8e21[_0x5b31('0x8a')]&&_0x3d8e21[_0x5b31('0x8a')]!==_0x5b31('0x8b')){logger[_0x5b31('0x2d')](_0x5b31('0x8c'),'Recording\x20is\x20enabled!');_0x1debb5[_0x5b31('0x7f')]=_0x5acbf1[_0x5b31('0x7c')]+_0x5b31('0x80')+_0x1debb5[_0x5b31('0x81')]+_0x5b31('0x82')+md5(_0x1debb5[_0x5b31('0x81')]);}var _0x35250b=_0x5acbf1[_0x5b31('0x7b')]===_0x5b31('0x8d')?'eu':_0x5b31('0x8e');return getAccessToken(_0x5acbf1)['then'](function(_0xa29ca6){_0x3bcbf3=_0xa29ca6;return getUser(_0x3bcbf3,_0x35250b,_0x5acbf1,_0x16e6ae[_0x5b31('0x36')]);})[_0x5b31('0x29')](function(_0x52cceb){_0x2c4d94=_0x52cceb;logger[_0x5b31('0x2d')](_0x5b31('0x8f'),_0x2c4d94['id']);return getEndUser(_0x3bcbf3,_0x35250b,_0x5acbf1,_0x1debb5[_0x5b31('0x90')],_0x1debb5[_0x5b31('0x91')],_0x2c4d94,_0x14d5cd);})[_0x5b31('0x29')](function(_0x58014b){_0x450ca2=_0x58014b;return getCall(_0x3bcbf3,_0x35250b,_0x5acbf1,_0x2c4d94,_0x450ca2,_0x14d5cd,_0x1debb5,_0x5b31('0x92'));})[_0x5b31('0x29')](function(_0x833617){if(_0x833617){logger['info'](_0x5b31('0x93'),_0x833617['id']);logger[_0x5b31('0x2d')]('[OUTBOUND]',_0x5b31('0x85'));emit(util[_0x5b31('0x2f')](_0x5b31('0x86'),_0x16e6ae[_0x5b31('0x19')]),_0x5b31('0x94'),{'uri':_0x5b31('0x87')+_0x5acbf1['host']+_0x5b31('0x88')+_0x833617['id']});}})['catch'](function(_0x468a34){logger[_0x5b31('0x3d')](_0x5b31('0x8c'),JSON[_0x5b31('0xe')](_0x468a34));});};exports[_0x5b31('0x95')]=function(_0x3dee74,_0x46c717,_0x3ac1b7,_0xfe32f2,_0x520e33,_0x32b64f){var _0x5d5293,_0x103624,_0x25b474;_0x32b64f[_0x5b31('0x7b')]=intUtil[_0x5b31('0x89')](_0x32b64f[_0x5b31('0x7b')]);_0x32b64f[_0x5b31('0x7c')]=intUtil[_0x5b31('0x89')](_0x32b64f[_0x5b31('0x7c')]);if(_0x520e33&&_0x520e33[_0x5b31('0x96')]){logger['info']('['+_0x46c717[_0x5b31('0x69')][_0x5b31('0x97')]()+']','Recording\x20is\x20enabled!');_0x46c717['recordingURL']=_0x32b64f[_0x5b31('0x7c')]+'/api/voice/recordings/'+_0x46c717['uniqueid']+_0x5b31('0x82')+md5(_0x46c717[_0x5b31('0x81')]);}else{_0x46c717[_0x5b31('0x7f')]='';}var _0x49ff7c=_0x32b64f[_0x5b31('0x7b')]==='zoho.eu'?'eu':_0x5b31('0x8e');return getAccessToken(_0x32b64f)['then'](function(_0x871d2d){_0x25b474=_0x871d2d;return getUser(_0x25b474,_0x49ff7c,_0x32b64f);})[_0x5b31('0x29')](function(_0x17b34e){_0x5d5293=_0x17b34e;logger['info'](_0x5b31('0x8f'),_0x5d5293['id']);return getEndUser(_0x25b474,_0x49ff7c,_0x32b64f,_0x46c717[_0x5b31('0x83')],_0x46c717[_0x5b31('0x84')],_0x5d5293,_0x3ac1b7);})['then'](function(_0x18bcdf){_0x103624=_0x18bcdf;return getCall(_0x25b474,_0x49ff7c,_0x32b64f,_0x5d5293,_0x103624,_0x3ac1b7,_0x46c717,_0x5b31('0x77'));})['then'](function(_0x50afe7){if(_0x50afe7){logger[_0x5b31('0x2d')](_0x5b31('0x93'),_0x50afe7['id']);}})[_0x5b31('0x2b')](function(_0x49481a){logger[_0x5b31('0x3d')]('['+_0x46c717[_0x5b31('0x69')][_0x5b31('0x97')]()+']',JSON[_0x5b31('0xe')](_0x49481a));});}; \ No newline at end of file +var _0x2bb0=['moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','details','enduserType','startCase','Error:\x20','log','CREATE\x20ERROR','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','Outbound','The\x20Call\x20ID\x20is:','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','./util','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','length','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','add','seconds','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','then','isArrayLikeObject','findIndex','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','https://www.zohoapis.','/crm/v2/'];(function(_0x3ad0a4,_0x450472){var _0x598727=function(_0x4513cc){while(--_0x4513cc){_0x3ad0a4['push'](_0x3ad0a4['shift']());}};_0x598727(++_0x450472);}(_0x2bb0,0xf3));var _0x02bb=function(_0x21070,_0x211851){_0x21070=_0x21070-0x0;var _0x1e3854=_0x2bb0[_0x21070];return _0x1e3854;};'use strict';var _=require(_0x02bb('0x0'));var rp=require(_0x02bb('0x1'));var md5=require(_0x02bb('0x2'));var util=require('util');var intUtil=require(_0x02bb('0x3'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x02bb('0x4'));var config=require('../../../../config/environment');var logger=require(_0x02bb('0x5'))(_0x02bb('0x6'));config[_0x02bb('0x7')]=_[_0x02bb('0x8')](config[_0x02bb('0x7')],{'host':_0x02bb('0x9'),'port':0x18eb});var io=require(_0x02bb('0xa'))(new Redis(config['redis']));function emit(_0x6d064a,_0x15e425,_0x23f816){io['to'](_0x6d064a)['emit'](_0x15e425,_0x23f816);}function request(_0x3d28d5){logger['debug'](_0x02bb('0xb'),JSON[_0x02bb('0xc')](_0x3d28d5));return rp(_0x3d28d5);}function getCustomFields(_0x4d3418,_0x3f861e){var _0x1c1915={};if(_0x4d3418[_0x02bb('0xd')]>0x0){_['forEach'](_0x4d3418,function(_0x2de7a2){if(_['includes']([_0x02bb('0xe'),_0x02bb('0xf')],_0x2de7a2[_0x02bb('0x10')])&&_0x2de7a2['idField']){_0x1c1915[_0x2de7a2[_0x02bb('0x11')]]=_0x2de7a2[_0x02bb('0x12')][_0x02bb('0x13')]();}else if(_0x2de7a2['type']===_0x02bb('0x14')&&_0x2de7a2['variableName']&&_0x2de7a2[_0x02bb('0x11')]&&_0x3f861e[_0x2de7a2[_0x02bb('0x15')]]){_0x1c1915[_0x2de7a2[_0x02bb('0x11')]]=_0x3f861e[_0x2de7a2[_0x02bb('0x15')]][_0x02bb('0x13')]();}else if(_0x2de7a2[_0x02bb('0x10')]==='customVariable'&&_0x2de7a2['Variable']&&_0x2de7a2[_0x02bb('0x16')][_0x02bb('0x17')]&&_0x2de7a2[_0x02bb('0x11')]&&_0x3f861e[_0x2de7a2[_0x02bb('0x16')][_0x02bb('0x17')][_0x02bb('0x18')]()]){_0x1c1915[_0x2de7a2['idField']]=_0x3f861e[_0x2de7a2[_0x02bb('0x16')]['name'][_0x02bb('0x18')]()][_0x02bb('0x13')]();}});}return _0x1c1915;}function getName(_0x1b607f){if(_0x1b607f['indexOf']('\x20')>0x0){var _0x1331fa=_0x1b607f[_0x02bb('0x19')](/ (.+)/);if(_0x1331fa[0x1]){return _0x1331fa;}}return[_0x1b607f,_0x1b607f];}var accountsTokens={};function getAccessToken(_0x147f48){return new Promise(function(_0x47b976,_0x1410b8){if(!_[_0x02bb('0x1a')](accountsTokens[_0x147f48['id']])&&!_['isNil'](accountsTokens[_0x147f48['id']][_0x02bb('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x147f48['id']][_0x02bb('0x1c')])){_0x47b976(accountsTokens[_0x147f48['id']][_0x02bb('0x1b')]);}}var _0x21e550;switch(_0x147f48[_0x02bb('0x1d')]){case'US':_0x21e550=_0x02bb('0x1e');break;case'AU':_0x21e550=_0x02bb('0x1f');break;case'EU':_0x21e550=_0x02bb('0x20');break;case'IN':_0x21e550='https://accounts.zoho.in';break;case'CN':_0x21e550='https://accounts.zoho.com.cn';break;default:_0x21e550=_0x02bb('0x20');break;}var _0x5ac511={'method':_0x02bb('0x21'),'uri':_0x21e550+_0x02bb('0x22'),'qs':{'refresh_token':_0x147f48[_0x02bb('0x23')],'client_id':_0x147f48['clientId'],'client_secret':_0x147f48[_0x02bb('0x24')],'grant_type':_0x02bb('0x25')},'json':!![]};return rp(_0x5ac511)['then'](function(_0x3c483f){accountsTokens[_0x147f48['id']]={'access_token':_0x3c483f[_0x02bb('0x1b')],'expires_in':moment()[_0x02bb('0x26')](_0x3c483f[_0x02bb('0x1c')],_0x02bb('0x27'))};_0x47b976(_0x3c483f[_0x02bb('0x1b')]);})['catch'](function(_0x1f2be8){logger['error'](_0x02bb('0x28'),_0x1f2be8[_0x02bb('0x29')]);_0x1410b8(_0x1f2be8);});});}function getUser(_0x426c90,_0x4ae755,_0x548f1b,_0x3cd365){logger[_0x02bb('0x2a')]('Search\x20user');return request({'method':_0x02bb('0x2b'),'uri':util[_0x02bb('0x2c')](_0x02bb('0x2d'),_0x4ae755),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x426c90},'json':!![]})[_0x02bb('0x2e')](function(_0x545174){if(_0x545174['users']){var _0x713096=-0x1;if(_[_0x02bb('0x2f')](_0x545174['users'])){if(!_[_0x02bb('0x1a')](_0x3cd365)){_0x713096=_[_0x02bb('0x30')](_0x545174[_0x02bb('0x31')],function(_0x4aaf67){return _0x4aaf67[_0x02bb('0x32')]===_0x3cd365;});}if(_0x713096>=0x0){logger[_0x02bb('0x2a')](_0x02bb('0x33'));}else{logger[_0x02bb('0x2a')](_0x02bb('0x34'));_0x713096=_[_0x02bb('0x30')](_0x545174[_0x02bb('0x31')],function(_0x167bfd){return _0x167bfd[_0x02bb('0x35')][_0x02bb('0x17')]==='Administrator';});}return _0x545174[_0x02bb('0x31')][_0x713096];}else{if(_0x545174[_0x02bb('0x36')]['profile'][_0x02bb('0x17')]===_0x02bb('0x37')){logger[_0x02bb('0x2a')](_0x02bb('0x34'));user=_0x545174['user'];return user;}else{logger[_0x02bb('0x38')]('The\x20failing\x20result\x20is',JSON[_0x02bb('0xc')](_0x545174));throw new Error(_0x02bb('0x39')+JSON[_0x02bb('0xc')](_0x545174));}}}else{logger[_0x02bb('0x38')](_0x02bb('0x3a'),JSON[_0x02bb('0xc')](_0x545174));throw new Error(_0x02bb('0x39')+JSON['stringify'](_0x545174));}})[_0x02bb('0x3b')](function(_0x218d7b){console['error'](_0x218d7b);});}function getZohoUser(_0x128574,_0xc63774){return new BPromise(function(_0x128a12,_0x336aab){request(_0x128574)[_0x02bb('0x2e')](function(_0xee8e8e){var _0x51ad66=null;if(_0xee8e8e){_0x51ad66=_0xee8e8e[_0x02bb('0x3c')][0x0];_0x51ad66['enduserType']=_0xc63774;}_0x128a12(_0x51ad66);})[_0x02bb('0x3b')](function(_0x313b9d){_0x336aab(_0x313b9d);});});}function createEndUser(_0x3bfe54,_0x18a50f,_0x22e05d,_0x36d878,_0x2f24f1,_0x2fdacd){var _0x22e05d=getName(_0x22e05d);return request({'method':'POST','uri':_0x02bb('0x3d')+_0x18a50f+_0x02bb('0x3e')+_['startCase'](_0x2fdacd[_0x02bb('0x3f')])+'s','body':{'data':[{'Last_Name':_0x22e05d[0x1],'First_Name':_0x22e05d[0x0],'Phone':_0x36d878,'Owner':{'name':!_[_0x02bb('0x1a')](_0x2f24f1['role']['name'])?_0x2f24f1[_0x02bb('0x40')][_0x02bb('0x17')]:!_[_0x02bb('0x1a')](_0x2f24f1[_0x02bb('0x41')])?_0x2f24f1[_0x02bb('0x41')]+'\x20'+_0x2f24f1[_0x02bb('0x42')]:_0x2f24f1['last_name'],'id':_0x2f24f1['id']}}]},'headers':{'Authorization':_0x02bb('0x43')+_0x3bfe54},'json':!![]})['then'](function(_0x56da28){if(_0x56da28&&_0x56da28[_0x02bb('0x3c')][0x0][_0x02bb('0x44')]==='SUCCESS'){var _0x38e17c=_0x56da28['data'][0x0][_0x02bb('0x45')];_0x38e17c[_0x02bb('0x46')]=_[_0x02bb('0x47')](_0x2fdacd['moduleCreate'])+'s';return _0x38e17c;}logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x02bb('0x48')+JSON[_0x02bb('0xc')](data));})[_0x02bb('0x3b')](function(_0x5be6b9){console[_0x02bb('0x49')](_0x02bb('0x4a'),_0x5be6b9);});}function getEndUser(_0x24743e,_0x493a2c,_0x130e38,_0x40b76c,_0x23b8d6,_0x43ede8,_0xfb1754){var _0x55ca10={'method':'GET','uri':'','headers':{'Authorization':_0x02bb('0x43')+_0x24743e},'json':!![]};switch(_0xfb1754['moduleSearch']){case'contact_lead':_0x55ca10[_0x02bb('0x4b')]=_0x02bb('0x3d')+_0x493a2c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x23b8d6+'))';return getZohoUser(_0x55ca10,_0x02bb('0x4c'))[_0x02bb('0x2e')](function(_0x38267b){if(_0x38267b)return _0x38267b;_0x55ca10['uri']=_0x02bb('0x3d')+_0x493a2c+_0x02bb('0x4d')+_0x23b8d6+'))';return getZohoUser(_0x55ca10,_0x02bb('0x4e'))[_0x02bb('0x2e')](function(_0x14b866){if(_0x14b866)return _0x14b866;if(_0xfb1754[_0x02bb('0x3f')]!=_0x02bb('0x4f')){return createEndUser(_0x24743e,_0x493a2c,_0x40b76c,_0x23b8d6,_0x43ede8,_0xfb1754);}else{return{};}});});break;case'contact':_0x55ca10[_0x02bb('0x4b')]=_0x02bb('0x3d')+_0x493a2c+_0x02bb('0x50')+_0x23b8d6+'))';return getZohoUser(_0x55ca10,_0x02bb('0x4c'))['then'](function(_0x171f85){if(_0x171f85)return _0x171f85;if(_0xfb1754[_0x02bb('0x3f')]!=_0x02bb('0x4f')){return createEndUser(_0x24743e,_0x493a2c,_0x40b76c,_0x23b8d6,_0x43ede8,_0xfb1754);}else{return{};}});break;case _0x02bb('0x51'):_0x55ca10[_0x02bb('0x4b')]=_0x02bb('0x3d')+_0x493a2c+_0x02bb('0x4d')+_0x23b8d6+'))';return getZohoUser(_0x55ca10,_0x02bb('0x4e'))[_0x02bb('0x2e')](function(_0x292d38){if(_0x292d38)return _0x292d38;if(_0xfb1754[_0x02bb('0x3f')]!='nothing'){return createEndUser(_0x24743e,_0x493a2c,_0x40b76c,_0x23b8d6,_0x43ede8,_0xfb1754);}else{return{};}});break;}}function getCall(_0x476d23,_0x488f13,_0x90bb4b,_0x460758,_0x3d2846,_0x121174,_0x13c357,_0x1792dd){logger[_0x02bb('0x2a')](_0x02bb('0x52'));var _0x47c1bb={};_0x47c1bb[_0x02bb('0x53')]={'name':!_[_0x02bb('0x1a')](_0x460758[_0x02bb('0x40')][_0x02bb('0x17')])&&!_[_0x02bb('0x1a')](_0x460758[_0x02bb('0x35')]['name'])&&_0x460758[_0x02bb('0x35')][_0x02bb('0x17')]===_0x02bb('0x54')?_0x460758['role'][_0x02bb('0x17')]:!_['isNil'](_0x460758[_0x02bb('0x41')])?_0x460758[_0x02bb('0x41')]+'\x20'+_0x460758[_0x02bb('0x42')]:_0x460758[_0x02bb('0x42')],'id':_0x460758['id']};_0x47c1bb[_0x02bb('0x55')]=intUtil[_0x02bb('0x56')](_0x121174[_0x02bb('0x57')],_0x13c357,'\x20');_0x47c1bb[_0x02bb('0x58')]=intUtil[_0x02bb('0x56')](_0x121174[_0x02bb('0x59')],_0x13c357,'\x0a');if(_0x3d2846['enduserType']===_0x02bb('0x4c')){_0x47c1bb[_0x02bb('0x5a')]={'name':!_[_0x02bb('0x1a')](_0x3d2846['Full_Name'])?_0x3d2846[_0x02bb('0x5b')]:!_[_0x02bb('0x1a')](_0x3d2846[_0x02bb('0x5c')])?_0x3d2846[_0x02bb('0x5c')]+'\x20'+_0x3d2846[_0x02bb('0x5d')]:_0x3d2846['Last_Name'],'id':_0x3d2846['id']};}if(_0x3d2846[_0x02bb('0x46')]===_0x02bb('0x4e')){_0x47c1bb[_0x02bb('0x5e')]={'name':!_[_0x02bb('0x1a')](_0x3d2846[_0x02bb('0x5b')])?_0x3d2846[_0x02bb('0x5b')]:!_[_0x02bb('0x1a')](_0x3d2846[_0x02bb('0x5c')])?_0x3d2846[_0x02bb('0x5c')]+'\x20'+_0x3d2846[_0x02bb('0x5d')]:_0x3d2846[_0x02bb('0x5d')],'id':_0x3d2846['id']};_0x47c1bb[_0x02bb('0x5f')]=_['startCase'](_0x3d2846[_0x02bb('0x46')]);}if(_0x13c357[_0x02bb('0x60')]){_0x47c1bb['Call_Duration']=moment[_0x02bb('0x61')](parseInt(_0x13c357[_0x02bb('0x60')])*0x3e8)[_0x02bb('0x2c')](_0x02bb('0x62'));}else if(_0x13c357[_0x02bb('0x63')]&&_0x13c357[_0x02bb('0x64')]){_0x47c1bb['Call_Duration']=moment[_0x02bb('0x61')](moment(_0x13c357[_0x02bb('0x64')],_0x02bb('0x65'))[_0x02bb('0x66')](moment(_0x13c357[_0x02bb('0x67')],_0x02bb('0x65'))))[_0x02bb('0x2c')](_0x02bb('0x62'));}switch(_0x13c357['lastevent']){case _0x02bb('0x68'):_0x47c1bb[_0x02bb('0x69')]='Called';break;case _0x02bb('0x6a'):case _0x02bb('0x6b'):_0x47c1bb[_0x02bb('0x69')]=_0x02bb('0x6c');break;case _0x02bb('0x6d'):_0x47c1bb[_0x02bb('0x69')]=_0x02bb('0x6e');break;case _0x02bb('0x6f'):_0x47c1bb[_0x02bb('0x69')]=_0x02bb('0x70');break;case _0x02bb('0x71'):_0x47c1bb[_0x02bb('0x69')]=_0x02bb('0x72');default:}_0x47c1bb[_0x02bb('0x73')]=(_0x1792dd===_0x02bb('0x74')?moment(_0x13c357[_0x02bb('0x67')])['format'](_0x02bb('0x65')):moment(_0x13c357[_0x02bb('0x75')])[_0x02bb('0x2c')](_0x02bb('0x65')))||moment()[_0x02bb('0x2c')](_0x02bb('0x65'));_0x47c1bb[_0x02bb('0x76')]=_0x1792dd||'Inbound';_0x47c1bb=_['merge'](_0x47c1bb,getCustomFields(_0x121174[_0x02bb('0x77')],_0x13c357));return request({'method':_0x02bb('0x21'),'uri':_0x02bb('0x3d')+_0x488f13+_0x02bb('0x78'),'headers':{'Authorization':_0x02bb('0x43')+_0x476d23},'body':{'data':[_0x47c1bb]},'json':!![]})[_0x02bb('0x2e')](function(_0x282adc){if(_0x282adc&&_0x282adc[_0x02bb('0x3c')][0x0][_0x02bb('0x44')]==='SUCCESS'){logger[_0x02bb('0x2a')](_0x02bb('0x79'));return{'id':_0x282adc['data'][0x0][_0x02bb('0x45')]['id']};}})[_0x02bb('0x3b')](function(_0x52bcfc){logger[_0x02bb('0x2a')]('err',_0x52bcfc['stack']);console['log'](_0x02bb('0x7a'),_0x52bcfc);});}exports[_0x02bb('0x7b')]=function(_0x3b33c1,_0x31f98d,_0x4a6d30,_0x312c0f,_0x2bee65,_0x255927){var _0x45ede0,_0x59e519,_0x2f427b;_0x255927['host']=intUtil['stripTrailingSlash'](_0x255927[_0x02bb('0x7c')]);_0x255927[_0x02bb('0x7d')]=intUtil['stripTrailingSlash'](_0x255927[_0x02bb('0x7d')]);if(_0x2bee65&&_0x2bee65['monitor_format']){logger[_0x02bb('0x2a')](_0x02bb('0x7e'),_0x02bb('0x7f'));_0x31f98d[_0x02bb('0x80')]=_0x255927[_0x02bb('0x7d')]+_0x02bb('0x81')+_0x31f98d[_0x02bb('0x82')]+_0x02bb('0x83')+md5(_0x31f98d[_0x02bb('0x82')]);}else{_0x31f98d[_0x02bb('0x80')]='';}var _0x4e3dc4=_0x255927[_0x02bb('0x7c')]===_0x02bb('0x84')?'eu':_0x02bb('0x85');return getAccessToken(_0x255927)[_0x02bb('0x2e')](function(_0xacef0f){_0x2f427b=_0xacef0f;return getUser(_0x2f427b,_0x4e3dc4,_0x255927,_0x312c0f['email']);})['then'](function(_0x37a944){_0x45ede0=_0x37a944;logger[_0x02bb('0x2a')]('The\x20User\x20ID\x20is:',_0x45ede0['id']);return getEndUser(_0x2f427b,_0x4e3dc4,_0x255927,_0x31f98d[_0x02bb('0x86')],_0x31f98d[_0x02bb('0x87')],_0x45ede0,_0x4a6d30);})[_0x02bb('0x2e')](function(_0x165ac2){_0x59e519=_0x165ac2;return getCall(_0x2f427b,_0x4e3dc4,_0x255927,_0x45ede0,_0x59e519,_0x4a6d30,_0x31f98d,_0x02bb('0x88'));})[_0x02bb('0x2e')](function(_0xf0d86e){if(_0xf0d86e){logger['info']('The\x20Call\x20ID\x20is:',_0xf0d86e['id']);logger[_0x02bb('0x2a')](_0x02bb('0x7e'),_0x02bb('0x89'));emit(util[_0x02bb('0x2c')](_0x02bb('0x8a'),_0x312c0f[_0x02bb('0x17')]),_0x02bb('0x8b'),{'uri':_0x02bb('0x8c')+_0x255927[_0x02bb('0x7c')]+_0x02bb('0x8d')+_0xf0d86e['id']});}})['catch'](function(_0xea8936){logger['error'](_0x02bb('0x7e'),JSON[_0x02bb('0xc')](_0xea8936));});};exports[_0x02bb('0x74')]=function(_0x37b659,_0x29b6a2,_0x2248c8,_0xda2ae4,_0x102802,_0x4379b9,_0x435030){var _0x161e70,_0x1fa3e4,_0x5ceaf1;_0x4379b9[_0x02bb('0x7c')]=intUtil['stripTrailingSlash'](_0x4379b9['host']);_0x4379b9[_0x02bb('0x7d')]=intUtil[_0x02bb('0x8e')](_0x4379b9[_0x02bb('0x7d')]);if(_0x435030&&_0x435030[_0x02bb('0x8f')]&&_0x435030[_0x02bb('0x8f')]!==_0x02bb('0x90')){logger['info'](_0x02bb('0x91'),'Recording\x20is\x20enabled!');_0x29b6a2['recordingURL']=_0x4379b9[_0x02bb('0x7d')]+_0x02bb('0x81')+_0x29b6a2[_0x02bb('0x82')]+_0x02bb('0x83')+md5(_0x29b6a2[_0x02bb('0x82')]);}var _0x35265c=_0x4379b9[_0x02bb('0x7c')]===_0x02bb('0x84')?'eu':_0x02bb('0x85');return getAccessToken(_0x4379b9)['then'](function(_0x3837ce){_0x5ceaf1=_0x3837ce;return getUser(_0x5ceaf1,_0x35265c,_0x4379b9,_0xda2ae4[_0x02bb('0x32')]);})[_0x02bb('0x2e')](function(_0x52355e){_0x161e70=_0x52355e;logger[_0x02bb('0x2a')](_0x02bb('0x92'),_0x161e70['id']);return getEndUser(_0x5ceaf1,_0x35265c,_0x4379b9,_0x29b6a2['destcalleridname'],_0x29b6a2['destcalleridnum'],_0x161e70,_0x2248c8);})[_0x02bb('0x2e')](function(_0x275414){_0x1fa3e4=_0x275414;return getCall(_0x5ceaf1,_0x35265c,_0x4379b9,_0x161e70,_0x1fa3e4,_0x2248c8,_0x29b6a2,_0x02bb('0x93'));})[_0x02bb('0x2e')](function(_0x27cfe1){if(_0x27cfe1){logger[_0x02bb('0x2a')](_0x02bb('0x94'),_0x27cfe1['id']);logger[_0x02bb('0x2a')](_0x02bb('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x02bb('0x2c')](_0x02bb('0x8a'),_0xda2ae4['name']),_0x02bb('0x8b'),{'uri':_0x02bb('0x8c')+_0x4379b9[_0x02bb('0x7c')]+_0x02bb('0x8d')+_0x27cfe1['id']});}})[_0x02bb('0x3b')](function(_0x381ba4){logger[_0x02bb('0x38')]('[OUTBOUND]',JSON[_0x02bb('0xc')](_0x381ba4));});};exports[_0x02bb('0x95')]=function(_0x73d2b3,_0x5d7967,_0x38f4de,_0xd9a87f,_0x569364,_0x5bef5d){var _0x427407,_0x2e4b49,_0x53520f;_0x5bef5d[_0x02bb('0x7c')]=intUtil[_0x02bb('0x8e')](_0x5bef5d[_0x02bb('0x7c')]);_0x5bef5d[_0x02bb('0x7d')]=intUtil[_0x02bb('0x8e')](_0x5bef5d[_0x02bb('0x7d')]);if(_0x569364&&_0x569364[_0x02bb('0x96')]){logger[_0x02bb('0x2a')]('['+_0x5d7967[_0x02bb('0x97')][_0x02bb('0x98')]()+']','Recording\x20is\x20enabled!');_0x5d7967[_0x02bb('0x80')]=_0x5bef5d[_0x02bb('0x7d')]+_0x02bb('0x81')+_0x5d7967[_0x02bb('0x82')]+_0x02bb('0x83')+md5(_0x5d7967[_0x02bb('0x82')]);}else{_0x5d7967['recordingURL']='';}var _0x178c48=_0x5bef5d[_0x02bb('0x7c')]==='zoho.eu'?'eu':_0x02bb('0x85');return getAccessToken(_0x5bef5d)[_0x02bb('0x2e')](function(_0x2037d0){_0x53520f=_0x2037d0;return getUser(_0x53520f,_0x178c48,_0x5bef5d);})[_0x02bb('0x2e')](function(_0x152758){_0x427407=_0x152758;logger['info'](_0x02bb('0x92'),_0x427407['id']);return getEndUser(_0x53520f,_0x178c48,_0x5bef5d,_0x5d7967[_0x02bb('0x86')],_0x5d7967[_0x02bb('0x87')],_0x427407,_0x38f4de);})[_0x02bb('0x2e')](function(_0x430c2a){_0x2e4b49=_0x430c2a;return getCall(_0x53520f,_0x178c48,_0x5bef5d,_0x427407,_0x2e4b49,_0x38f4de,_0x5d7967,_0x02bb('0x88'));})[_0x02bb('0x2e')](function(_0x5f9088){if(_0x5f9088){logger['info'](_0x02bb('0x94'),_0x5f9088['id']);}})[_0x02bb('0x3b')](function(_0x4b8e41){logger[_0x02bb('0x38')]('['+_0x5d7967['lastevent'][_0x02bb('0x98')]()+']',JSON[_0x02bb('0xc')](_0x4b8e41));});}; \ 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 17ec081..0c92f5d 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 _0x80f0=['%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','../../../../config/logger','exec','data2','Script','data3','render','error','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x80f0,0x161));var _0x080f=function(_0x5149a1,_0x4fcea3){_0x5149a1=_0x5149a1-0x0;var _0x6a23e0=_0x80f0[_0x5149a1];return _0x6a23e0;};'use strict';var util=require(_0x080f('0x0'));var sh=require(_0x080f('0x1'));var Mustache=require(_0x080f('0x2'));var logger=require(_0x080f('0x3'))('trigger');exports[_0x080f('0x4')]=function(_0x4db21e,_0x3e472e){var _0x56c52d=_0x4db21e[_0x080f('0x5')]?_0x4db21e['data2']:_0x080f('0x6');var _0x56b079=_0x4db21e[_0x080f('0x7')]?Mustache[_0x080f('0x8')](_0x4db21e[_0x080f('0x7')],_0x3e472e):_0x3e472e;sh['exec'](_0x56b079,function(_0x196099,_0x46b478,_0xc91abc){if(_0x196099!==0x0){logger[_0x080f('0x9')](util[_0x080f('0xa')](_0x080f('0xb'),_0x56c52d,_0x56b079,_0x196099,_0xc91abc));}else{logger[_0x080f('0xc')](util[_0x080f('0xa')](_0x080f('0xd'),_0x56c52d,_0x56b079,_0x46b478));}});}; \ No newline at end of file +var _0x13e9=['format','mustache','../../../../config/logger','data2','data3','render','exec','error'];(function(_0x17ccae,_0x2d3ff4){var _0x112892=function(_0xebdf45){while(--_0xebdf45){_0x17ccae['push'](_0x17ccae['shift']());}};_0x112892(++_0x2d3ff4);}(_0x13e9,0x71));var _0x913e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x13e9[_0x1d1779];return _0x2377e9;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x913e('0x0'));var logger=require(_0x913e('0x1'))('trigger');exports['exec']=function(_0x51bb63,_0xa03a9c){var _0xbdccfc=_0x51bb63[_0x913e('0x2')]?_0x51bb63[_0x913e('0x2')]:'Script';var _0x5b164f=_0x51bb63[_0x913e('0x3')]?Mustache[_0x913e('0x4')](_0x51bb63[_0x913e('0x3')],_0xa03a9c):_0xa03a9c;sh[_0x913e('0x5')](_0x5b164f,function(_0x295045,_0x2129c4,_0x46d58e){if(_0x295045!==0x0){logger[_0x913e('0x6')](util[_0x913e('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0xbdccfc,_0x5b164f,_0x295045,_0x46d58e));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0xbdccfc,_0x5b164f,_0x2129c4));}});}; \ 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 2135b77..35988a2 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 _0x3f57=['GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil','object','stringify','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6','parse','render','error','stack'];(function(_0x518ce4,_0x40f7df){var _0x1c6e8c=function(_0x38b43f){while(--_0x38b43f){_0x518ce4['push'](_0x518ce4['shift']());}};_0x1c6e8c(++_0x40f7df);}(_0x3f57,0x99));var _0x73f5=function(_0x11a8f1,_0x2403ec){_0x11a8f1=_0x11a8f1-0x0;var _0x157fd6=_0x3f57[_0x11a8f1];return _0x157fd6;};'use strict';var rp=require(_0x73f5('0x0'));var util=require(_0x73f5('0x1'));var _=require(_0x73f5('0x2'));var Mustache=require(_0x73f5('0x3'));var logger=require('../../../../config/logger')(_0x73f5('0x4'));exports[_0x73f5('0x5')]=function(_0x42ec3c,_0x2766c0){var _0x4ded3a,_0x412b83;var _0x355583={'method':_0x42ec3c[_0x73f5('0x6')][_0x73f5('0x7')](),'uri':Mustache['render'](_0x42ec3c[_0x73f5('0x8')],_0x2766c0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x42ec3c[_0x73f5('0x9')])===_0x73f5('0xa')&&parseInt(_0x42ec3c['data5'])>=0x1&&parseInt(_0x42ec3c['data5'])<=0xa?parseInt(_0x42ec3c[_0x73f5('0x9')])*0x3e8:0x5*0x3e8};try{_0x355583[_0x73f5('0xb')]=_0x42ec3c[_0x73f5('0xc')]?JSON[_0x73f5('0xd')](Mustache[_0x73f5('0xe')](_0x42ec3c[_0x73f5('0xc')],_0x2766c0)):{};}catch(_0x34b70d){logger[_0x73f5('0xf')](_0x34b70d[_0x73f5('0x10')]);}switch(_0x42ec3c[_0x73f5('0x6')]['toUpperCase']()){case _0x73f5('0x11'):case'DELETE':_0x4ded3a=null;_0x355583['qs']=_0x2766c0;break;case _0x73f5('0x12'):case _0x73f5('0x13'):if(_0x42ec3c['data7']){try{_0x4ded3a=JSON['parse'](Mustache['render'](_0x42ec3c[_0x73f5('0x14')],_0x2766c0));_0x355583[_0x73f5('0x15')]=_0x4ded3a;}catch(_0x1324f8){logger[_0x73f5('0xf')](_0x1324f8[_0x73f5('0x10')]);logger['error'](_0x73f5('0x16'));}}else{_0x4ded3a=_0x2766c0;_0x355583[_0x73f5('0x15')]=_0x4ded3a;}break;}logger[_0x73f5('0x17')](util[_0x73f5('0x18')](_0x73f5('0x19'),_0x42ec3c[_0x73f5('0x6')],_0x42ec3c[_0x73f5('0x8')],JSON['stringify'](_0x355583)));rp(_0x355583)[_0x73f5('0x1a')](function(_0x4957d6){_0x4ded3a=!_[_0x73f5('0x1b')](_0x4ded3a)?',\x20request\x20body:\x20'+_0x4ded3a:'';_0x412b83=typeof _0x4957d6[_0x73f5('0x15')]===_0x73f5('0x1c')?JSON[_0x73f5('0x1d')](_0x4957d6['body']):_0x4957d6[_0x73f5('0x15')];logger[_0x73f5('0x17')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x42ec3c[_0x73f5('0x6')],_0x42ec3c[_0x73f5('0x8')],_0x4957d6[_0x73f5('0x1e')],_0x412b83));})['catch'](function(_0x3825ae){logger[_0x73f5('0xf')](util[_0x73f5('0x18')](_0x73f5('0x1f'),_0x42ec3c['data1'],_0x42ec3c[_0x73f5('0x8')],_0x3825ae[_0x73f5('0x1e')],_0x3825ae[_0x73f5('0x20')],_0x3825ae[_0x73f5('0x21')]));});}; \ No newline at end of file +var _0xa049=['data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','headers','data6','error','stack','GET','POST','PUT'];(function(_0x27c4f8,_0x6b1fcf){var _0x1f30f0=function(_0x26b303){while(--_0x26b303){_0x27c4f8['push'](_0x27c4f8['shift']());}};_0x1f30f0(++_0x6b1fcf);}(_0xa049,0x1ca));var _0x9a04=function(_0x260a78,_0x20c234){_0x260a78=_0x260a78-0x0;var _0x56c872=_0xa049[_0x260a78];return _0x56c872;};'use strict';var rp=require('request-promise');var util=require(_0x9a04('0x0'));var _=require(_0x9a04('0x1'));var Mustache=require(_0x9a04('0x2'));var logger=require(_0x9a04('0x3'))(_0x9a04('0x4'));exports[_0x9a04('0x5')]=function(_0x15c65e,_0x467db9){var _0x121036,_0xbad573;var _0x14ffb3={'method':_0x15c65e[_0x9a04('0x6')][_0x9a04('0x7')](),'uri':Mustache[_0x9a04('0x8')](_0x15c65e[_0x9a04('0x9')],_0x467db9),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x15c65e[_0x9a04('0xa')])==='number'&&parseInt(_0x15c65e[_0x9a04('0xa')])>=0x1&&parseInt(_0x15c65e[_0x9a04('0xa')])<=0xa?parseInt(_0x15c65e[_0x9a04('0xa')])*0x3e8:0x5*0x3e8};try{_0x14ffb3[_0x9a04('0xb')]=_0x15c65e[_0x9a04('0xc')]?JSON['parse'](Mustache[_0x9a04('0x8')](_0x15c65e['data6'],_0x467db9)):{};}catch(_0x219ed9){logger[_0x9a04('0xd')](_0x219ed9[_0x9a04('0xe')]);}switch(_0x15c65e[_0x9a04('0x6')][_0x9a04('0x7')]()){case _0x9a04('0xf'):case'DELETE':_0x121036=null;_0x14ffb3['qs']=_0x467db9;break;case _0x9a04('0x10'):case _0x9a04('0x11'):if(_0x15c65e[_0x9a04('0x12')]){try{_0x121036=JSON['parse'](Mustache['render'](_0x15c65e[_0x9a04('0x12')],_0x467db9));_0x14ffb3[_0x9a04('0x13')]=_0x121036;}catch(_0x25d46b){logger['error'](_0x25d46b['stack']);logger[_0x9a04('0xd')](_0x9a04('0x14'));}}else{_0x121036=_0x467db9;_0x14ffb3['body']=_0x121036;}break;}logger[_0x9a04('0x15')](util[_0x9a04('0x16')](_0x9a04('0x17'),_0x15c65e[_0x9a04('0x6')],_0x15c65e[_0x9a04('0x9')],JSON[_0x9a04('0x18')](_0x14ffb3)));rp(_0x14ffb3)[_0x9a04('0x19')](function(_0xddbd3a){_0x121036=!_[_0x9a04('0x1a')](_0x121036)?_0x9a04('0x1b')+_0x121036:'';_0xbad573=typeof _0xddbd3a['body']==='object'?JSON[_0x9a04('0x18')](_0xddbd3a['body']):_0xddbd3a[_0x9a04('0x13')];logger[_0x9a04('0x15')](util['format'](_0x9a04('0x1c'),_0x15c65e['data1'],_0x15c65e['data2'],_0xddbd3a[_0x9a04('0x1d')],_0xbad573));})[_0x9a04('0x1e')](function(_0x27071b){logger[_0x9a04('0xd')](util[_0x9a04('0x16')](_0x9a04('0x1f'),_0x15c65e[_0x9a04('0x6')],_0x15c65e[_0x9a04('0x9')],_0x27071b[_0x9a04('0x1d')],_0x27071b[_0x9a04('0x20')],_0x27071b[_0x9a04('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index a6a53ba..9b1fe66 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 _0x5c44=['../../config/logger','routing','client','http','Request','request','then','error','rpc','message','result','catch','exports','bluebird'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x5c44,0x99));var _0x45c4=function(_0x4e02f2,_0x486243){_0x4e02f2=_0x4e02f2-0x0;var _0x327ed8=_0x5c44[_0x4e02f2];return _0x327ed8;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x45c4('0x0'));var logger=require(_0x45c4('0x1'))(_0x45c4('0x2'));var client=jayson[_0x45c4('0x3')][_0x45c4('0x4')]({'port':0x2329});client[_0x45c4('0x5')]=function(_0x5603fe,_0x5e32eb){return new BPromise(function(_0x134a33,_0x237a04){return client[_0x45c4('0x6')](_0x5603fe,_0x5e32eb)[_0x45c4('0x7')](function(_0x2ea13a){logger['debug']('rpc','routing',_0x5603fe,_0x5e32eb,_0x2ea13a);if(_0x2ea13a['error']){logger[_0x45c4('0x8')](_0x45c4('0x9'),_0x45c4('0x2'),_0x5603fe,_0x2ea13a[_0x45c4('0x8')][_0x45c4('0xa')],_0x5e32eb);return _0x237a04(_0x2ea13a[_0x45c4('0x8')][_0x45c4('0xa')]);}else{return _0x134a33(_0x2ea13a[_0x45c4('0xb')]);}})[_0x45c4('0xc')](function(_0x4da76d){logger[_0x45c4('0x8')]('rpc',_0x45c4('0x2'),_0x5603fe,_0x4da76d,_0x5e32eb);return _0x237a04(_0x4da76d);});});};module[_0x45c4('0xd')]=client; \ No newline at end of file +var _0xdac1=['Request','request','then','debug','rpc','error','result','jayson/promise','bluebird','../../config/logger','routing','http'];(function(_0x4028e3,_0x968024){var _0x41cbd9=function(_0x1ab765){while(--_0x1ab765){_0x4028e3['push'](_0x4028e3['shift']());}};_0x41cbd9(++_0x968024);}(_0xdac1,0x127));var _0x1dac=function(_0x2b8477,_0x5a5326){_0x2b8477=_0x2b8477-0x0;var _0x188929=_0xdac1[_0x2b8477];return _0x188929;};'use strict';var jayson=require(_0x1dac('0x0'));var BPromise=require(_0x1dac('0x1'));var logger=require(_0x1dac('0x2'))(_0x1dac('0x3'));var client=jayson['client'][_0x1dac('0x4')]({'port':0x2329});client[_0x1dac('0x5')]=function(_0x2c3393,_0x2e9a55){return new BPromise(function(_0x2ab11b,_0x2cf838){return client[_0x1dac('0x6')](_0x2c3393,_0x2e9a55)[_0x1dac('0x7')](function(_0x4aaa32){logger[_0x1dac('0x8')](_0x1dac('0x9'),_0x1dac('0x3'),_0x2c3393,_0x2e9a55,_0x4aaa32);if(_0x4aaa32['error']){logger[_0x1dac('0xa')](_0x1dac('0x9'),'routing',_0x2c3393,_0x4aaa32[_0x1dac('0xa')]['message'],_0x2e9a55);return _0x2cf838(_0x4aaa32[_0x1dac('0xa')]['message']);}else{return _0x2ab11b(_0x4aaa32[_0x1dac('0xb')]);}})['catch'](function(_0x5eb1aa){logger['error'](_0x1dac('0x9'),_0x1dac('0x3'),_0x2c3393,_0x5eb1aa,_0x2e9a55);return _0x2cf838(_0x5eb1aa);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ab2579f..203e5eb 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 _0x6c97=['listen','getSettings','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/setting','resolve','getMailAccounts','then','mailAccounts'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x6c97,0x14e));var _0x76c9=function(_0x4437b9,_0x56a6ce){_0x4437b9=_0x4437b9-0x0;var _0x271140=_0x6c97[_0x4437b9];return _0x271140;};'use strict';var server=require('./server');var Realtime=require(_0x76c9('0x0'));var EmailChannel=require(_0x76c9('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x76c9('0x2'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x76c9('0x3')]()['then'](mailAccount[_0x76c9('0x4')]())[_0x76c9('0x5')](realtime['initMailAccounts']())[_0x76c9('0x5')](function(){email['refresh'](realtime[_0x76c9('0x6')]);return realtime;});}function main(){return server[_0x76c9('0x7')](realtime,email)['then'](function(){return initRealtime();})[_0x76c9('0x5')](function(){return setting[_0x76c9('0x8')]();})['then'](function(_0x417527){return setInterval(initRealtime,_0x417527['loginMailFrequency']*0x3e8);})['catch'](function(_0x4dcb00){logger[_0x76c9('0x9')](_0x76c9('0xa'),_0x4dcb00);});}main(); \ No newline at end of file +var _0x0470=['listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts'];(function(_0x2211d2,_0x1674b3){var _0xf7bfc3=function(_0x1225e2){while(--_0x1225e2){_0x2211d2['push'](_0x2211d2['shift']());}};_0xf7bfc3(++_0x1674b3);}(_0x0470,0xb0));var _0x0047=function(_0x29b98b,_0xa52e57){_0x29b98b=_0x29b98b-0x0;var _0x5b8db3=_0x0470[_0x29b98b];return _0x5b8db3;};'use strict';var server=require(_0x0047('0x0'));var Realtime=require(_0x0047('0x1'));var EmailChannel=require(_0x0047('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x0047('0x3'));var logger=require('../../config/logger')(_0x0047('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0047('0x5')]()[_0x0047('0x6')](mailAccount[_0x0047('0x7')]())[_0x0047('0x6')](realtime[_0x0047('0x8')]())[_0x0047('0x6')](function(){email[_0x0047('0x9')](realtime[_0x0047('0xa')]);return realtime;});}function main(){return server[_0x0047('0xb')](realtime,email)['then'](function(){return initRealtime();})[_0x0047('0x6')](function(){return setting[_0x0047('0xc')]();})[_0x0047('0x6')](function(_0x11c4d3){return setInterval(initRealtime,_0x11c4d3[_0x0047('0xd')]*0x3e8);})[_0x0047('0xe')](function(_0x1e5d18){logger[_0x0047('0xf')](_0x0047('0x10'),_0x1e5d18);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9e7f79f..40a5a92 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 _0x2496=['error','handleImapError','disabled','handleImapBox','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','lastSync','send','verifySmtp','Smtp','verify','verified','exports','lodash','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','info','mailAccounts','imapAccounts','smtp','prototype','emit','active','Imap','status','messageStatus','total','isNil','stringify','md5','hasOwnProperty','service','provider','custom','box','bind','handleImapEmail','end','handleImapEnd'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x2496,0x146));var _0x6249=function(_0x361e50,_0xc348da){_0x361e50=_0x361e50-0x0;var _0xf4ae47=_0x2496[_0x361e50];return _0xf4ae47;};'use strict';var _=require(_0x6249('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x6249('0x1'));var config=require('../../../config/environment');var logger=require(_0x6249('0x2'))(_0x6249('0x3'));config[_0x6249('0x4')]=_['defaults'](config[_0x6249('0x4')],{'host':_0x6249('0x5'),'port':0x18eb});var io=require(_0x6249('0x6'))(new Redis(config['redis']));var EmailImap=require(_0x6249('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3d3b6a){logger[_0x6249('0x8')]('start\x20email\x20channel');this['mailAccounts']=_0x3d3b6a[_0x6249('0x9')];this[_0x6249('0xa')]={};this[_0x6249('0xb')]=new EmailSmtp();}EmailChannel[_0x6249('0xc')][_0x6249('0xd')]=function(_0x381a67){var _0x542fe1=this['mailAccounts'][_0x381a67];var _0x4aa303={'id':_0x542fe1['id'],'name':_0x542fe1['name'],'key':_0x542fe1['key'],'active':_0x542fe1[_0x6249('0xe')],'Imap':{'status':_0x542fe1[_0x6249('0xf')][_0x6249('0x10')],'messageStatus':_0x542fe1['Imap'][_0x6249('0x11')],'total':_0x542fe1[_0x6249('0xf')][_0x6249('0x12')]}};if(_[_0x6249('0x13')](md5Accounts[_0x381a67])){md5Accounts[_0x381a67]={};}var _0x61ba9e=md5(JSON[_0x6249('0x14')](_0x4aa303));if(md5Accounts[_0x381a67][_0x6249('0x15')]!==_0x61ba9e){md5Accounts[_0x381a67]['md5']=_0x61ba9e;io[_0x6249('0xd')]('mailAccount:update',_0x4aa303);}};EmailChannel[_0x6249('0xc')]['refresh']=function(_0x1845d2){for(var _0x31dd6a in _0x1845d2){if(_0x1845d2[_0x6249('0x16')](_0x31dd6a)){if(_0x1845d2[_0x31dd6a][_0x6249('0xf')]&&_0x1845d2[_0x31dd6a]['active']){var _0x594ad7=_0x1845d2[_0x31dd6a][_0x6249('0xf')];if(!_0x594ad7[_0x6249('0x17')]&&_0x1845d2[_0x31dd6a][_0x6249('0x18')]!==_0x6249('0x19'))_0x594ad7['service']=_0x1845d2[_0x31dd6a][_0x6249('0x18')];if(!this[_0x6249('0xa')][_0x6249('0x16')](_0x594ad7['id'])){this['imapAccounts'][_0x594ad7['id']]=new EmailImap(_0x594ad7,_0x1845d2[_0x31dd6a][_0x6249('0x3')]);this[_0x6249('0xa')][_0x594ad7['id']]['on'](_0x6249('0x1a'),this['handleImapBox'][_0x6249('0x1b')](this,_0x31dd6a));this[_0x6249('0xa')][_0x594ad7['id']]['on'](_0x6249('0x3'),this[_0x6249('0x1c')][_0x6249('0x1b')](this,_0x31dd6a));this['imapAccounts'][_0x594ad7['id']]['on'](_0x6249('0x1d'),this[_0x6249('0x1e')][_0x6249('0x1b')](this,_0x31dd6a));this[_0x6249('0xa')][_0x594ad7['id']]['on'](_0x6249('0x1f'),this[_0x6249('0x20')][_0x6249('0x1b')](this,_0x31dd6a));}}else{if(_[_0x6249('0x13')](this['mailAccounts'][_0x31dd6a][_0x6249('0xf')])){this[_0x6249('0x9')][_0x31dd6a]['Imap']={};}this['mailAccounts'][_0x31dd6a][_0x6249('0xf')][_0x6249('0x10')]=_0x6249('0x21');this[_0x6249('0x9')][_0x31dd6a][_0x6249('0xf')][_0x6249('0x11')]='';this[_0x6249('0xd')](_0x31dd6a);}}}};EmailChannel['prototype'][_0x6249('0x22')]=function(_0x2d443d,_0x4fd022){if(this[_0x6249('0x9')][_0x2d443d]){this[_0x6249('0x9')][_0x2d443d][_0x6249('0xf')][_0x6249('0x10')]='connected';this[_0x6249('0x9')][_0x2d443d][_0x6249('0xf')][_0x6249('0x11')]=_0x4fd022[_0x6249('0x23')];if(_0x4fd022['messages']){this[_0x6249('0x9')][_0x2d443d][_0x6249('0xf')][_0x6249('0x12')]=_0x4fd022[_0x6249('0x24')]['total'];}return this[_0x6249('0xd')](_0x2d443d);}};EmailChannel[_0x6249('0xc')][_0x6249('0x1c')]=function(_0x333ade,_0x41e7cb){logger[_0x6249('0x8')](_0x6249('0x25'),_0x41e7cb[_0x6249('0x26')],_0x41e7cb[_0x6249('0x27')],_0x41e7cb[_0x6249('0x28')],_0x333ade);if(this[_0x6249('0x9')][_0x333ade]){return mailAccount[_0x6249('0x29')](_0x333ade,_0x41e7cb)['then'](function(_0x5ede4d){if(_0x5ede4d){logger[_0x6249('0x8')](_0x6249('0x2a'));}})[_0x6249('0x2b')](function(_0x31db7b){logger[_0x6249('0x1f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x31db7b));});}};EmailChannel[_0x6249('0xc')]['handleImapEnd']=function(_0x50726d){if(this[_0x6249('0x9')][_0x50726d]&&this[_0x6249('0x9')][_0x50726d][_0x6249('0xf')]){if(this[_0x6249('0xa')][this[_0x6249('0x9')][_0x50726d][_0x6249('0xf')]['id']]){delete this[_0x6249('0xa')][this['mailAccounts'][_0x50726d][_0x6249('0xf')]['id']];}this[_0x6249('0x9')][_0x50726d][_0x6249('0xf')][_0x6249('0x2c')]=moment();this[_0x6249('0xd')](_0x50726d);}};EmailChannel[_0x6249('0xc')][_0x6249('0x20')]=function(_0x11a26e,_0x4c310a){if(this[_0x6249('0x9')][_0x11a26e]){this[_0x6249('0x9')][_0x11a26e]['Imap'][_0x6249('0x10')]='error';this['mailAccounts'][_0x11a26e]['Imap'][_0x6249('0x11')]=_0x4c310a;return this[_0x6249('0xd')](_0x11a26e);}};EmailChannel['prototype']['sendMail']=function(_0x54a27d,_0x451fe2){return this[_0x6249('0xb')][_0x6249('0x2d')](_0x54a27d,_0x451fe2);};EmailChannel['prototype'][_0x6249('0x2e')]=function(_0x504be8){var _0x45fab4=this;if(this[_0x6249('0x9')][_0x504be8['id']]){if(_['isNil'](this[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')])){this['mailAccounts'][_0x504be8['id']]['Smtp']={};}this[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')]['lastSync']=moment();return new BPromise(function(_0x3de313,_0x1dbe7d){return _0x45fab4['smtp'][_0x6249('0x30')](_0x504be8)['then'](function(_0x133d8d){_0x45fab4[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')][_0x6249('0x10')]=_0x6249('0x31');_0x45fab4[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')][_0x6249('0x11')]='';_0x45fab4[_0x6249('0xd')](_0x504be8['id']);_0x3de313(_0x133d8d);})['catch'](function(_0x3bee87){_0x45fab4[_0x6249('0x9')][_0x504be8['id']][_0x6249('0x2f')][_0x6249('0x10')]='error';_0x45fab4[_0x6249('0x9')][_0x504be8['id']]['Smtp']['messageStatus']=_0x3bee87;_0x45fab4[_0x6249('0xd')](_0x504be8['id']);_0x1dbe7d(_0x3bee87);});});}return this[_0x6249('0xb')][_0x6249('0x30')](_0x504be8);};module[_0x6249('0x32')]=EmailChannel; \ No newline at end of file +var _0xe091=['end','handleImapEnd','error','handleImapError','status','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','md5','mailAccount:update','refresh','provider','hasOwnProperty','box','bind','handleImapEmail'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe091,0x105));var _0x1e09=function(_0x51f5f7,_0x4e1492){_0x51f5f7=_0x51f5f7-0x0;var _0x6afaa=_0xe091[_0x51f5f7];return _0x6afaa;};'use strict';var _=require(_0x1e09('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x1e09('0x1'));var config=require(_0x1e09('0x2'));var logger=require(_0x1e09('0x3'))(_0x1e09('0x4'));config[_0x1e09('0x5')]=_[_0x1e09('0x6')](config[_0x1e09('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1e09('0x7'))(new Redis(config[_0x1e09('0x5')]));var EmailImap=require(_0x1e09('0x8'));var EmailSmtp=require(_0x1e09('0x9'));var mailAccount=require(_0x1e09('0xa'));var md5Accounts={};function EmailChannel(_0x3b0881){logger[_0x1e09('0xb')](_0x1e09('0xc'));this[_0x1e09('0xd')]=_0x3b0881[_0x1e09('0xd')];this[_0x1e09('0xe')]={};this[_0x1e09('0xf')]=new EmailSmtp();}EmailChannel[_0x1e09('0x10')][_0x1e09('0x11')]=function(_0x5581a5){var _0x50d70d=this[_0x1e09('0xd')][_0x5581a5];var _0x2441dd={'id':_0x50d70d['id'],'name':_0x50d70d[_0x1e09('0x12')],'key':_0x50d70d[_0x1e09('0x13')],'active':_0x50d70d[_0x1e09('0x14')],'Imap':{'status':_0x50d70d[_0x1e09('0x15')]['status'],'messageStatus':_0x50d70d[_0x1e09('0x15')][_0x1e09('0x16')],'total':_0x50d70d[_0x1e09('0x15')][_0x1e09('0x17')]}};if(_[_0x1e09('0x18')](md5Accounts[_0x5581a5])){md5Accounts[_0x5581a5]={};}var _0x3e9db9=md5(JSON[_0x1e09('0x19')](_0x2441dd));if(md5Accounts[_0x5581a5][_0x1e09('0x1a')]!==_0x3e9db9){md5Accounts[_0x5581a5][_0x1e09('0x1a')]=_0x3e9db9;io[_0x1e09('0x11')](_0x1e09('0x1b'),_0x2441dd);}};EmailChannel[_0x1e09('0x10')][_0x1e09('0x1c')]=function(_0x172e75){for(var _0x2609cd in _0x172e75){if(_0x172e75['hasOwnProperty'](_0x2609cd)){if(_0x172e75[_0x2609cd][_0x1e09('0x15')]&&_0x172e75[_0x2609cd]['active']){var _0x107083=_0x172e75[_0x2609cd][_0x1e09('0x15')];if(!_0x107083['service']&&_0x172e75[_0x2609cd]['provider']!=='custom')_0x107083['service']=_0x172e75[_0x2609cd][_0x1e09('0x1d')];if(!this['imapAccounts'][_0x1e09('0x1e')](_0x107083['id'])){this[_0x1e09('0xe')][_0x107083['id']]=new EmailImap(_0x107083,_0x172e75[_0x2609cd][_0x1e09('0x4')]);this['imapAccounts'][_0x107083['id']]['on'](_0x1e09('0x1f'),this['handleImapBox'][_0x1e09('0x20')](this,_0x2609cd));this[_0x1e09('0xe')][_0x107083['id']]['on']('email',this[_0x1e09('0x21')][_0x1e09('0x20')](this,_0x2609cd));this[_0x1e09('0xe')][_0x107083['id']]['on'](_0x1e09('0x22'),this[_0x1e09('0x23')]['bind'](this,_0x2609cd));this['imapAccounts'][_0x107083['id']]['on'](_0x1e09('0x24'),this[_0x1e09('0x25')][_0x1e09('0x20')](this,_0x2609cd));}}else{if(_['isNil'](this['mailAccounts'][_0x2609cd][_0x1e09('0x15')])){this[_0x1e09('0xd')][_0x2609cd][_0x1e09('0x15')]={};}this[_0x1e09('0xd')][_0x2609cd][_0x1e09('0x15')][_0x1e09('0x26')]=_0x1e09('0x27');this[_0x1e09('0xd')][_0x2609cd][_0x1e09('0x15')][_0x1e09('0x16')]='';this[_0x1e09('0x11')](_0x2609cd);}}}};EmailChannel[_0x1e09('0x10')][_0x1e09('0x28')]=function(_0x19c4bc,_0xa3f5b2){if(this['mailAccounts'][_0x19c4bc]){this['mailAccounts'][_0x19c4bc][_0x1e09('0x15')]['status']=_0x1e09('0x29');this[_0x1e09('0xd')][_0x19c4bc][_0x1e09('0x15')][_0x1e09('0x16')]=_0xa3f5b2[_0x1e09('0x12')];if(_0xa3f5b2[_0x1e09('0x2a')]){this[_0x1e09('0xd')][_0x19c4bc][_0x1e09('0x15')]['total']=_0xa3f5b2[_0x1e09('0x2a')][_0x1e09('0x17')];}return this[_0x1e09('0x11')](_0x19c4bc);}};EmailChannel[_0x1e09('0x10')][_0x1e09('0x21')]=function(_0x1fc742,_0x4261f0){logger[_0x1e09('0xb')](_0x1e09('0x2b'),_0x4261f0[_0x1e09('0x2c')],_0x4261f0[_0x1e09('0x2d')],_0x4261f0[_0x1e09('0x2e')],_0x1fc742);if(this[_0x1e09('0xd')][_0x1fc742]){return mailAccount[_0x1e09('0x2f')](_0x1fc742,_0x4261f0)[_0x1e09('0x30')](function(_0x4d9264){if(_0x4d9264){logger[_0x1e09('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0x1e09('0x31')](function(_0x10812f){logger[_0x1e09('0x24')](_0x1e09('0x32'),JSON[_0x1e09('0x19')](_0x10812f));});}};EmailChannel[_0x1e09('0x10')]['handleImapEnd']=function(_0x337a43){if(this[_0x1e09('0xd')][_0x337a43]&&this[_0x1e09('0xd')][_0x337a43]['Imap']){if(this[_0x1e09('0xe')][this['mailAccounts'][_0x337a43]['Imap']['id']]){delete this[_0x1e09('0xe')][this['mailAccounts'][_0x337a43][_0x1e09('0x15')]['id']];}this[_0x1e09('0xd')][_0x337a43]['Imap']['lastSync']=moment();this[_0x1e09('0x11')](_0x337a43);}};EmailChannel[_0x1e09('0x10')][_0x1e09('0x25')]=function(_0x14bbb2,_0x4d8f1e){if(this[_0x1e09('0xd')][_0x14bbb2]){this[_0x1e09('0xd')][_0x14bbb2][_0x1e09('0x15')][_0x1e09('0x26')]=_0x1e09('0x24');this[_0x1e09('0xd')][_0x14bbb2][_0x1e09('0x15')][_0x1e09('0x16')]=_0x4d8f1e;return this[_0x1e09('0x11')](_0x14bbb2);}};EmailChannel[_0x1e09('0x10')][_0x1e09('0x33')]=function(_0x5f4dd6,_0x44abb2){return this[_0x1e09('0xf')][_0x1e09('0x34')](_0x5f4dd6,_0x44abb2);};EmailChannel[_0x1e09('0x10')][_0x1e09('0x35')]=function(_0x46628b){var _0x711132=this;if(this[_0x1e09('0xd')][_0x46628b['id']]){if(_[_0x1e09('0x18')](this[_0x1e09('0xd')][_0x46628b['id']][_0x1e09('0x36')])){this[_0x1e09('0xd')][_0x46628b['id']]['Smtp']={};}this[_0x1e09('0xd')][_0x46628b['id']][_0x1e09('0x36')][_0x1e09('0x37')]=moment();return new BPromise(function(_0x3cbf3d,_0x4fa049){return _0x711132[_0x1e09('0xf')][_0x1e09('0x38')](_0x46628b)[_0x1e09('0x30')](function(_0x13404e){_0x711132[_0x1e09('0xd')][_0x46628b['id']][_0x1e09('0x36')][_0x1e09('0x26')]=_0x1e09('0x39');_0x711132['mailAccounts'][_0x46628b['id']][_0x1e09('0x36')]['messageStatus']='';_0x711132[_0x1e09('0x11')](_0x46628b['id']);_0x3cbf3d(_0x13404e);})[_0x1e09('0x31')](function(_0x516203){_0x711132['mailAccounts'][_0x46628b['id']][_0x1e09('0x36')][_0x1e09('0x26')]=_0x1e09('0x24');_0x711132[_0x1e09('0xd')][_0x46628b['id']][_0x1e09('0x36')][_0x1e09('0x16')]=_0x516203;_0x711132[_0x1e09('0x11')](_0x46628b['id']);_0x4fa049(_0x516203);});});}return this['smtp'][_0x1e09('0x38')](_0x46628b);};module[_0x1e09('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index d5ef80a..bf7c198 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 _0xd6a6=['host','port','tls','required','openBox','prototype','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','message','handleFetchMessage','error','handleFetchError','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','handleFetchEnd','closeBox','textCode','hasOwnProperty','upperFirst','exports','lodash','util','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','once','ready','bind','end','handleEnd','handleError','inherits','connTimeout','authTimeout','service','user','xoauth2','CloudProvider','password','anonymous@xcally.com'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd6a6,0x1b4));var _0x6d6a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6a6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d6a('0x0'));var util=require(_0x6d6a('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x6d6a('0x2')];var Iconv=require(_0x6d6a('0x3'))[_0x6d6a('0x4')];var EventEmitter=require('events')[_0x6d6a('0x5')];var utils=require(_0x6d6a('0x6'));var logger=require(_0x6d6a('0x7'))(_0x6d6a('0x8'));function EmailImap(_0xc55179,_0x17ad3b){this[_0x6d6a('0x9')]=_0xc55179['mailbox'];this[_0x6d6a('0xa')]=this[_0x6d6a('0xb')](_0xc55179,_0x17ad3b);this[_0x6d6a('0xc')]=new Imap(this[_0x6d6a('0xa')]);this[_0x6d6a('0xc')][_0x6d6a('0xd')](_0x6d6a('0xe'),this['handleReady'][_0x6d6a('0xf')](this));this[_0x6d6a('0xc')]['once'](_0x6d6a('0x10'),this[_0x6d6a('0x11')][_0x6d6a('0xf')](this));this[_0x6d6a('0xc')]['on']('error',this[_0x6d6a('0x12')][_0x6d6a('0xf')](this));this['imap']['connect']();}util[_0x6d6a('0x13')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x17c097,_0x2535c8){var _0x5a7697={'connTimeout':_0x17c097[_0x6d6a('0x14')]?_0x17c097[_0x6d6a('0x14')]*0x3e8:0x2710,'authTimeout':_0x17c097[_0x6d6a('0x15')]?_0x17c097['authTimeout']*0x3e8:0x1388};if(_0x17c097[_0x6d6a('0x16')]){_0x5a7697[_0x6d6a('0x17')]=_0x17c097[_0x6d6a('0x17')];if(_0x17c097['modernAuthentication']){_0x5a7697[_0x6d6a('0x18')]=utils['generateXOAuth2Token'](_0x17c097[_0x6d6a('0x19')]['data5'],_0x17c097[_0x6d6a('0x17')]);}else{_0x5a7697[_0x6d6a('0x1a')]=_0x17c097[_0x6d6a('0x1a')];}}else{if(_0x17c097['authentication']){_0x5a7697[_0x6d6a('0x17')]=_0x17c097[_0x6d6a('0x17')];_0x5a7697['password']=_0x17c097[_0x6d6a('0x1a')];}}_0x5a7697[_0x6d6a('0x8')]=_0x2535c8||_0x17c097['user']||_0x6d6a('0x1b');_0x5a7697['host']=_0x17c097[_0x6d6a('0x1c')];_0x5a7697[_0x6d6a('0x1d')]=_0x17c097[_0x6d6a('0x1d')]||0x3e1;if(_0x17c097[_0x6d6a('0x1e')]){_0x5a7697['tls']=!![];}else{_0x5a7697[_0x6d6a('0x1e')]=![];_0x5a7697['autotls']=_0x6d6a('0x1f');}return _0x5a7697;};EmailImap['prototype']['handleReady']=function(){this[_0x6d6a('0xc')][_0x6d6a('0x20')](this[_0x6d6a('0x9')],![],this['handleOpenBox'][_0x6d6a('0xf')](this));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x22')]=function(_0xb2d78b,_0x179e2){if(_0xb2d78b){this[_0x6d6a('0x12')](_0xb2d78b,!![]);}else{this[_0x6d6a('0x23')](_0x6d6a('0x24'),_0x179e2);this[_0x6d6a('0x25')]();}};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x26')]=function(_0x4fdd0d){if(_0x4fdd0d){this[_0x6d6a('0x12')](_0x4fdd0d,!![]);}else{this[_0x6d6a('0xc')][_0x6d6a('0x10')]();}};EmailImap[_0x6d6a('0x21')]['readUnseen']=function(){this[_0x6d6a('0xc')][_0x6d6a('0x27')](['UNSEEN'],this[_0x6d6a('0x28')][_0x6d6a('0xf')](this));};EmailImap['prototype'][_0x6d6a('0x28')]=function(_0x2bd929,_0x554e37){if(_0x2bd929){this[_0x6d6a('0x12')](_0x2bd929,!![]);}else{if(_0x554e37['length']){try{var _0x300132=this[_0x6d6a('0xc')]['fetch'](_0x554e37['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x300132['on'](_0x6d6a('0x29'),this[_0x6d6a('0x2a')][_0x6d6a('0xf')](this));_0x300132[_0x6d6a('0xd')](_0x6d6a('0x2b'),this[_0x6d6a('0x2c')][_0x6d6a('0xf')](this));_0x300132[_0x6d6a('0xd')](_0x6d6a('0x10'),this['handleFetchEnd']['bind'](this));}catch(_0x5b98a8){logger[_0x6d6a('0x2b')](_0x5b98a8);}}else{this['imap']['closeBox'](!![],this[_0x6d6a('0x26')][_0x6d6a('0xf')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x411883){_0x411883['on'](_0x6d6a('0x2d'),this[_0x6d6a('0x2e')][_0x6d6a('0xf')](this));_0x411883[_0x6d6a('0xd')](_0x6d6a('0x2f'),this[_0x6d6a('0x30')]['bind'](this));_0x411883[_0x6d6a('0xd')]('end',this['handleMessageEnd'][_0x6d6a('0xf')](this));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x2e')]=function(_0x19f57c){simpleParser(_0x19f57c,{'Iconv':Iconv},this[_0x6d6a('0x31')][_0x6d6a('0xf')](this));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x30')]=function(){};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x32')]=function(){};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x31')]=function(_0x35db84,_0x1647a8){if(_0x35db84){logger[_0x6d6a('0x2b')](_0x35db84);}else{var _0x5a3644=this;utils[_0x6d6a('0x33')](this[_0x6d6a('0xa')],_0x1647a8,function(_0x5694e8){_0x5a3644[_0x6d6a('0x23')](_0x6d6a('0x8'),_0x5694e8);});}};EmailImap['prototype'][_0x6d6a('0x34')]=function(){this[_0x6d6a('0xc')][_0x6d6a('0x35')](!![],this[_0x6d6a('0x26')][_0x6d6a('0xf')](this));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x2c')]=function(_0x151b01){this[_0x6d6a('0x12')](_0x151b01);this[_0x6d6a('0xc')][_0x6d6a('0x35')](!![],this[_0x6d6a('0x26')]['bind'](this));};EmailImap['prototype'][_0x6d6a('0x11')]=function(){this[_0x6d6a('0x23')](_0x6d6a('0x10'));};EmailImap[_0x6d6a('0x21')][_0x6d6a('0x12')]=function(_0x13015b,_0x1dfabe){logger[_0x6d6a('0x2b')]('handleError',this[_0x6d6a('0xa')]['email'],JSON['stringify'](_0x13015b));var _0x9a9ae='';if(_0x13015b){if(_0x13015b[_0x6d6a('0x36')]){_0x9a9ae=_0x13015b[_0x6d6a('0x36')];}else{for(var _0x1a2f4e in _0x13015b){if(_0x13015b[_0x6d6a('0x37')](_0x1a2f4e)){_0x9a9ae+=_[_0x6d6a('0x38')](_0x1a2f4e)+':\x20'+_0x13015b[_0x1a2f4e]+'\x0a';}}}}if(_0x1dfabe){this[_0x6d6a('0xc')][_0x6d6a('0x10')]();}else{this[_0x6d6a('0x23')](_0x6d6a('0x2b'),_0x9a9ae);this[_0x6d6a('0x23')](_0x6d6a('0x10'));}};module[_0x6d6a('0x39')]=EmailImap; \ No newline at end of file +var _0x4776=['handleReady','bind','end','error','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','slice','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleEnd','hasOwnProperty','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','account','once','ready'];(function(_0x5dd8f9,_0x30a8ff){var _0x270d4a=function(_0x3e5c8b){while(--_0x3e5c8b){_0x5dd8f9['push'](_0x5dd8f9['shift']());}};_0x270d4a(++_0x30a8ff);}(_0x4776,0xdf));var _0x6477=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4776[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x6477('0x0'));var util=require(_0x6477('0x1'));var Imap=require(_0x6477('0x2'));var simpleParser=require(_0x6477('0x3'))[_0x6477('0x4')];var Iconv=require(_0x6477('0x5'))[_0x6477('0x6')];var EventEmitter=require(_0x6477('0x7'))[_0x6477('0x8')];var utils=require(_0x6477('0x9'));var logger=require(_0x6477('0xa'))(_0x6477('0xb'));function EmailImap(_0x166696,_0x2788b1){this['mailbox']=_0x166696[_0x6477('0xc')];this['account']=this[_0x6477('0xd')](_0x166696,_0x2788b1);this[_0x6477('0x2')]=new Imap(this[_0x6477('0xe')]);this['imap'][_0x6477('0xf')](_0x6477('0x10'),this[_0x6477('0x11')][_0x6477('0x12')](this));this[_0x6477('0x2')][_0x6477('0xf')](_0x6477('0x13'),this['handleEnd'][_0x6477('0x12')](this));this['imap']['on'](_0x6477('0x14'),this['handleError'][_0x6477('0x12')](this));this[_0x6477('0x2')]['connect']();}util[_0x6477('0x15')](EmailImap,EventEmitter);EmailImap[_0x6477('0x16')][_0x6477('0xd')]=function(_0x11f523,_0x2fe8fe){var _0x1878eb={'connTimeout':_0x11f523['connTimeout']?_0x11f523[_0x6477('0x17')]*0x3e8:0x2710,'authTimeout':_0x11f523['authTimeout']?_0x11f523[_0x6477('0x18')]*0x3e8:0x1388};if(_0x11f523['service']){_0x1878eb[_0x6477('0x19')]=_0x11f523[_0x6477('0x19')];if(_0x11f523[_0x6477('0x1a')]){_0x1878eb[_0x6477('0x1b')]=utils[_0x6477('0x1c')](_0x11f523['CloudProvider'][_0x6477('0x1d')],_0x11f523[_0x6477('0x19')]);}else{_0x1878eb[_0x6477('0x1e')]=_0x11f523[_0x6477('0x1e')];}}else{if(_0x11f523['authentication']){_0x1878eb['user']=_0x11f523[_0x6477('0x19')];_0x1878eb['password']=_0x11f523['password'];}}_0x1878eb[_0x6477('0xb')]=_0x2fe8fe||_0x11f523[_0x6477('0x19')]||_0x6477('0x1f');_0x1878eb['host']=_0x11f523[_0x6477('0x20')];_0x1878eb[_0x6477('0x21')]=_0x11f523[_0x6477('0x21')]||0x3e1;if(_0x11f523[_0x6477('0x22')]){_0x1878eb[_0x6477('0x22')]=!![];}else{_0x1878eb[_0x6477('0x22')]=![];_0x1878eb[_0x6477('0x23')]=_0x6477('0x24');}return _0x1878eb;};EmailImap[_0x6477('0x16')]['handleReady']=function(){this[_0x6477('0x2')][_0x6477('0x25')](this[_0x6477('0xc')],![],this[_0x6477('0x26')][_0x6477('0x12')](this));};EmailImap[_0x6477('0x16')][_0x6477('0x26')]=function(_0x4ec09,_0x42c344){if(_0x4ec09){this[_0x6477('0x27')](_0x4ec09,!![]);}else{this[_0x6477('0x28')]('box',_0x42c344);this[_0x6477('0x29')]();}};EmailImap[_0x6477('0x16')][_0x6477('0x2a')]=function(_0x48621d){if(_0x48621d){this[_0x6477('0x27')](_0x48621d,!![]);}else{this[_0x6477('0x2')][_0x6477('0x13')]();}};EmailImap['prototype'][_0x6477('0x29')]=function(){this[_0x6477('0x2')][_0x6477('0x2b')]([_0x6477('0x2c')],this[_0x6477('0x2d')][_0x6477('0x12')](this));};EmailImap[_0x6477('0x16')][_0x6477('0x2d')]=function(_0x6e16ce,_0x2cff63){if(_0x6e16ce){this[_0x6477('0x27')](_0x6e16ce,!![]);}else{if(_0x2cff63['length']){try{var _0x319898=this[_0x6477('0x2')][_0x6477('0x2e')](_0x2cff63[_0x6477('0x2f')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x319898['on'](_0x6477('0x30'),this[_0x6477('0x31')][_0x6477('0x12')](this));_0x319898['once'](_0x6477('0x14'),this[_0x6477('0x32')][_0x6477('0x12')](this));_0x319898[_0x6477('0xf')](_0x6477('0x13'),this[_0x6477('0x33')][_0x6477('0x12')](this));}catch(_0x1d2ae0){logger[_0x6477('0x14')](_0x1d2ae0);}}else{this['imap'][_0x6477('0x34')](!![],this[_0x6477('0x2a')][_0x6477('0x12')](this));}}};EmailImap[_0x6477('0x16')]['handleFetchMessage']=function(_0x2350f6){_0x2350f6['on'](_0x6477('0x35'),this['handleMessageBody'][_0x6477('0x12')](this));_0x2350f6[_0x6477('0xf')](_0x6477('0x36'),this[_0x6477('0x37')][_0x6477('0x12')](this));_0x2350f6['once'](_0x6477('0x13'),this[_0x6477('0x38')][_0x6477('0x12')](this));};EmailImap[_0x6477('0x16')]['handleMessageBody']=function(_0x5576c9){simpleParser(_0x5576c9,{'Iconv':Iconv},this[_0x6477('0x39')][_0x6477('0x12')](this));};EmailImap[_0x6477('0x16')][_0x6477('0x37')]=function(){};EmailImap['prototype'][_0x6477('0x38')]=function(){};EmailImap[_0x6477('0x16')]['handleSimpleParser']=function(_0x3ff2ff,_0x2d6065){if(_0x3ff2ff){logger[_0x6477('0x14')](_0x3ff2ff);}else{var _0x3ffea5=this;utils['parser'](this[_0x6477('0xe')],_0x2d6065,function(_0x4b64e4){_0x3ffea5[_0x6477('0x28')]('email',_0x4b64e4);});}};EmailImap[_0x6477('0x16')][_0x6477('0x33')]=function(){this[_0x6477('0x2')][_0x6477('0x34')](!![],this[_0x6477('0x2a')][_0x6477('0x12')](this));};EmailImap[_0x6477('0x16')]['handleFetchError']=function(_0x9eea1){this['handleError'](_0x9eea1);this[_0x6477('0x2')][_0x6477('0x34')](!![],this[_0x6477('0x2a')][_0x6477('0x12')](this));};EmailImap[_0x6477('0x16')][_0x6477('0x3a')]=function(){this['emit']('end');};EmailImap[_0x6477('0x16')][_0x6477('0x27')]=function(_0x130bbc,_0xc9f662){logger[_0x6477('0x14')]('handleError',this['account']['email'],JSON['stringify'](_0x130bbc));var _0x528c45='';if(_0x130bbc){if(_0x130bbc['textCode']){_0x528c45=_0x130bbc['textCode'];}else{for(var _0xe0c840 in _0x130bbc){if(_0x130bbc[_0x6477('0x3b')](_0xe0c840)){_0x528c45+=_['upperFirst'](_0xe0c840)+':\x20'+_0x130bbc[_0xe0c840]+'\x0a';}}}}if(_0xc9f662){this[_0x6477('0x2')][_0x6477('0x13')]();}else{this[_0x6477('0x28')](_0x6477('0x14'),_0x528c45);this[_0x6477('0x28')](_0x6477('0x13'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 9ee0059..0602ecb 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 _0x5552=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x47d546,_0x316c75){var _0xe94939=function(_0x567029){while(--_0x567029){_0x47d546['push'](_0x47d546['shift']());}};_0xe94939(++_0x316c75);}(_0x5552,0x1ac));var _0x2555=function(_0x114b81,_0x4a54e0){_0x114b81=_0x114b81-0x0;var _0x5e4b67=_0x5552[_0x114b81];return _0x5e4b67;};'use strict';var nodemailer=require(_0x2555('0x0'));var inlineBase64=require(_0x2555('0x1'));function EmailSmtp(){}EmailSmtp[_0x2555('0x2')][_0x2555('0x3')]=function(_0x4ec579,_0x5afd03){return new Promise(function(_0x1dcc28,_0x2c1902){var _0x219e70=nodemailer[_0x2555('0x4')](_0x4ec579);_0x219e70[_0x2555('0x5')]('compile',inlineBase64());_0x219e70[_0x2555('0x6')](_0x5afd03,function(_0x4af339,_0x45bbda){if(_0x4af339){_0x2c1902(_0x4af339[_0x2555('0x7')]());}else{_0x1dcc28(_0x45bbda);}});});};EmailSmtp[_0x2555('0x2')][_0x2555('0x8')]=function(_0x3587aa){return new Promise(function(_0x2e8996,_0x485f31){var _0x4cd769=nodemailer[_0x2555('0x4')](_0x3587aa);_0x4cd769[_0x2555('0x8')](function(_0x485008,_0x30acc4){if(_0x485008){_0x485f31(_0x485008[_0x2555('0x7')]());}else{if(_0x30acc4){_0x2e8996(_0x30acc4);}else{_0x485f31(_0x2555('0x9'));}}});});};module[_0x2555('0xa')]=EmailSmtp; \ No newline at end of file +var _0x6b15=['verify','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','toString'];(function(_0x5e492d,_0x2a095d){var _0x1710b9=function(_0x67c050){while(--_0x67c050){_0x5e492d['push'](_0x5e492d['shift']());}};_0x1710b9(++_0x2a095d);}(_0x6b15,0x141));var _0x56b1=function(_0x68434,_0x4187eb){_0x68434=_0x68434-0x0;var _0x5ea401=_0x6b15[_0x68434];return _0x5ea401;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x56b1('0x0'));function EmailSmtp(){}EmailSmtp[_0x56b1('0x1')][_0x56b1('0x2')]=function(_0x3a865a,_0x1f95ac){return new Promise(function(_0x4581fa,_0x2aa38f){var _0x15e6c6=nodemailer[_0x56b1('0x3')](_0x3a865a);_0x15e6c6['use'](_0x56b1('0x4'),inlineBase64());_0x15e6c6[_0x56b1('0x5')](_0x1f95ac,function(_0x36a187,_0x352072){if(_0x36a187){_0x2aa38f(_0x36a187[_0x56b1('0x6')]());}else{_0x4581fa(_0x352072);}});});};EmailSmtp['prototype']['verify']=function(_0x20e185){return new Promise(function(_0x3af60d,_0x346bad){var _0x498c5b=nodemailer[_0x56b1('0x3')](_0x20e185);_0x498c5b[_0x56b1('0x7')](function(_0x20b602,_0x4e4581){if(_0x20b602){_0x346bad(_0x20b602[_0x56b1('0x6')]());}else{if(_0x4e4581){_0x3af60d(_0x4e4581);}else{_0x346bad('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2d70a86..a4b1998 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 _0xca5b=['from','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','BodyHTML','Attachments','Title','Data','

Empty\x20message

','user=','utf-8','lodash','moment','path','node-tnef','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','Anonymous','split','pop','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','email','isEmpty','originCc','bcc','attachments','attach','type','attachment-','format','%s-%s','join','root','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser'];(function(_0x1361ce,_0x34af53){var _0x2cbb10=function(_0x11eb3d){while(--_0x11eb3d){_0x1361ce['push'](_0x1361ce['shift']());}};_0x2cbb10(++_0x34af53);}(_0xca5b,0x1da));var _0xbca5=function(_0x1b29b2,_0x3b6b11){_0x1b29b2=_0x1b29b2-0x0;var _0x560b68=_0xca5b[_0x1b29b2];return _0x560b68;};'use strict';var _=require(_0xbca5('0x0'));var moment=require(_0xbca5('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xbca5('0x2'));var util=require('util');var tnef=require(_0xbca5('0x3'));var logger=require('../../../config/logger')('email');var config=require(_0xbca5('0x4'));function getAddress(_0x4e3661){var _0x510abb=_[_0xbca5('0x5')](_0x4e3661[_0xbca5('0x6')]);return _0x510abb&&_0x510abb[_0xbca5('0x7')]?_0x510abb[_0xbca5('0x7')]:_0xbca5('0x8')+random[_0xbca5('0x9')](0x6)+_0xbca5('0xa');}function getFirstName(_0xb29c9f){var _0x3ac27a=_[_0xbca5('0x5')](_0xb29c9f[_0xbca5('0x6')]);if(_0x3ac27a&&_0x3ac27a[_0xbca5('0xb')]){if(_0x3ac27a[_0xbca5('0xb')]==_0x3ac27a[_0xbca5('0x7')]){return _0x3ac27a['name'][_0xbca5('0xc')](0x0,_0x3ac27a[_0xbca5('0xb')][_0xbca5('0xd')]('@'));}var _0x2a944=_0x3ac27a['name']['split'](/\s+/);return _0x2a944[_0xbca5('0xe')]>0x1?_0x2a944['slice'](0x0,-0x1)['join']('\x20'):_0x3ac27a[_0xbca5('0xb')];}return _0xbca5('0xf');}function getLastName(_0x1ed1ee){var _0x40c708=_[_0xbca5('0x5')](_0x1ed1ee[_0xbca5('0x6')]);if(_0x40c708&&_0x40c708[_0xbca5('0xb')]){var _0x2e7e66=_0x40c708['name'][_0xbca5('0x10')](/\s+/);return _0x2e7e66[_0xbca5('0xe')]>0x1?_0x2e7e66[_0xbca5('0x11')]():'';}return'';}function getMails(_0x85dc59,_0x2b5da3){var _0x34b57f='';for(var _0x35708a=0x0;_0x35708a<_0x2b5da3[_0xbca5('0x6')][_0xbca5('0xe')];_0x35708a+=0x1){if(_0x2b5da3[_0xbca5('0x6')][_0x35708a][_0xbca5('0x7')]!==_0x85dc59){if(!_['isEmpty'](_0x34b57f)){_0x34b57f+=',';}_0x34b57f+=_0x2b5da3[_0xbca5('0x6')][_0x35708a][_0xbca5('0xb')]||_0x2b5da3[_0xbca5('0x6')][_0x35708a][_0xbca5('0x7')]||'';_0x34b57f+='\x20<';_0x34b57f+=_0x2b5da3['value'][_0x35708a][_0xbca5('0x7')]?_0x2b5da3[_0xbca5('0x6')][_0x35708a][_0xbca5('0x7')]:_0xbca5('0x8')+random[_0xbca5('0x9')](0x6)+_0xbca5('0xa');_0x34b57f+='>';}}return _0x34b57f;}function parseEmail(_0x234738,_0x481ad1,_0xc72024){if(_0x481ad1[_0xbca5('0x12')]){var _0x5902ec=/)<[^<]*)*<\/script>/gi;while(_0x5902ec[_0xbca5('0x13')](_0x481ad1[_0xbca5('0x12')])){_0x481ad1[_0xbca5('0x12')]=_0x481ad1[_0xbca5('0x12')][_0xbca5('0x14')](_0x5902ec,'');}if(_0x481ad1['html'][_0xbca5('0x15')](_0xbca5('0x16'))){var _0x316954=[];_0x481ad1['attachments'][_0xbca5('0x17')](_0x26b5b7=>{_0x316954[_0xbca5('0x18')](_0x26b5b7[_0xbca5('0x19')]);});var _0x162caa=/]+>/g;var _0x28d06a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x561064=_0x481ad1[_0xbca5('0x12')]['replace'](_0x28d06a,_0xbca5('0x1a'));var _0x3d75db=_0x561064[_0xbca5('0x14')](_0x162caa,_0xbca5('0x1b'));for(let _0x2d30cc=0x0;_0x2d30cc<_0x316954[_0xbca5('0xe')];_0x2d30cc++){var _0x2ac450=_0x3d75db[_0xbca5('0x14')](_0xbca5('0x1b'),_0xbca5('0x1c')+_0x316954[_0x2d30cc]+_0xbca5('0x1d'));_0x3d75db=_0x2ac450;}_0x481ad1[_0xbca5('0x12')]=_0x3d75db;}_0xc72024[_0xbca5('0x1e')]=_0x481ad1[_0xbca5('0x12')];}else{_0xc72024[_0xbca5('0x1e')]=_0x481ad1[_0xbca5('0x1f')];}if(_0xc72024[_0xbca5('0x1e')]){_0xc72024[_0xbca5('0x1e')]=_0xc72024['body'][_0xbca5('0x14')](/0x0){var _0x32ff54=[_0xbca5('0x31'),_0xbca5('0x32'),_0xbca5('0x33')];for(var _0x456789=0x0;_0x456789<_0x481ad1['headerLines'][_0xbca5('0xe')];_0x456789++){var _0xe50026=_['indexOf'](_0x32ff54,_0x481ad1[_0xbca5('0x30')][_0x456789][_0xbca5('0x34')]);if(_0xe50026>=0x0){_0xc72024['isAutoreply']=!![];}}}return _0xc72024;}exports[_0xbca5('0x35')]=function(_0x335d3b,_0x55a0b6,_0x369d32){var _0x59a196={'from':getAddress(_0x55a0b6[_0xbca5('0x36')]),'firstName':getFirstName(_0x55a0b6[_0xbca5('0x36')]),'lastName':getLastName(_0x55a0b6[_0xbca5('0x36')]),'mapKey':_0xbca5('0x22'),'message':{'from':getMails(_0x335d3b[_0xbca5('0x22')],_0x55a0b6[_0xbca5('0x36')]),'to':_0x335d3b[_0xbca5('0x22')],'cc':'','subject':_0x55a0b6['subject']||'','messageId':_0x55a0b6['messageId'],'inReplyTo':_0x55a0b6['inReplyTo'],'sentAt':moment(_0x55a0b6['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x55a0b6[_0xbca5('0x12')]&&!_0x55a0b6[_0xbca5('0x1f')]){var _0x2658d7=_['filter'](_0x55a0b6[_0xbca5('0x26')],{'contentType':'application/ms-tnef'});if(_0x2658d7[_0xbca5('0xe')]){logger[_0xbca5('0x37')](util[_0xbca5('0x2a')](_0xbca5('0x38'),_0x55a0b6[_0xbca5('0x39')]));tnef[_0xbca5('0x3a')](_['first'](_0x2658d7)[_0xbca5('0x2f')],function(_0x12605a,_0x50740c){if(_0x50740c){_0x55a0b6[_0xbca5('0x12')]=_0x50740c[_0xbca5('0x3b')]||'

Empty\x20message

';if(_0x50740c[_0xbca5('0x3c')]){for(var _0x3089e7=0x0;_0x3089e7<_0x50740c['Attachments'][_0xbca5('0xe')];_0x3089e7++){var _0x50b527=_0x50740c[_0xbca5('0x3c')][_0x3089e7];_0x59a196[_0xbca5('0x20')]['attachments'][_0xbca5('0x18')]({'filename':_0x50b527[_0xbca5('0x3d')],'content':Buffer[_0xbca5('0x36')](_0x50b527[_0xbca5('0x3e')])});}}}_0x369d32(parseEmail(_0x335d3b,_0x55a0b6,_0x59a196));});}else{_0x55a0b6[_0xbca5('0x12')]=_0xbca5('0x3f');_0x369d32(parseEmail(_0x335d3b,_0x55a0b6,_0x59a196));}}else{_0x369d32(parseEmail(_0x335d3b,_0x55a0b6,_0x59a196));}};exports['generateXOAuth2Token']=function(_0x5d77dd,_0x1e9a1e){var _0x6fc1c9=[_0xbca5('0x40')+(_0x1e9a1e||''),'auth=Bearer\x20'+_0x5d77dd,'',''];return Buffer[_0xbca5('0x36')](_0x6fc1c9[_0xbca5('0x2c')](''),_0xbca5('0x41'))['toString']('base64');}; \ No newline at end of file +var _0xd46e=['\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','path','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','test','includes','0x1?_0xd5daa7[_0xed46('0x11')](0x0,-0x1)[_0xed46('0x12')]('\x20'):_0x5f2fb7[_0xed46('0xc')];}return _0xed46('0x13');}function getLastName(_0x2c9163){var _0x4402d0=_[_0xed46('0x6')](_0x2c9163[_0xed46('0x7')]);if(_0x4402d0&&_0x4402d0[_0xed46('0xc')]){var _0x30a89f=_0x4402d0[_0xed46('0xc')][_0xed46('0xf')](/\s+/);return _0x30a89f['length']>0x1?_0x30a89f[_0xed46('0x14')]():'';}return'';}function getMails(_0x2b87eb,_0x5e91b6){var _0x55fbf2='';for(var _0x4d8e9f=0x0;_0x4d8e9f<_0x5e91b6[_0xed46('0x7')][_0xed46('0x10')];_0x4d8e9f+=0x1){if(_0x5e91b6[_0xed46('0x7')][_0x4d8e9f]['address']!==_0x2b87eb){if(!_[_0xed46('0x15')](_0x55fbf2)){_0x55fbf2+=',';}_0x55fbf2+=_0x5e91b6['value'][_0x4d8e9f]['name']||_0x5e91b6[_0xed46('0x7')][_0x4d8e9f][_0xed46('0x8')]||'';_0x55fbf2+='\x20<';_0x55fbf2+=_0x5e91b6[_0xed46('0x7')][_0x4d8e9f][_0xed46('0x8')]?_0x5e91b6[_0xed46('0x7')][_0x4d8e9f][_0xed46('0x8')]:_0xed46('0x9')+random[_0xed46('0xa')](0x6)+_0xed46('0xb');_0x55fbf2+='>';}}return _0x55fbf2;}function parseEmail(_0x1052e2,_0x25fc7e,_0x292b82){if(_0x25fc7e[_0xed46('0x16')]){var _0x1a8e42=/)<[^<]*)*<\/script>/gi;while(_0x1a8e42[_0xed46('0x17')](_0x25fc7e[_0xed46('0x16')])){_0x25fc7e[_0xed46('0x16')]=_0x25fc7e[_0xed46('0x16')]['replace'](_0x1a8e42,'');}if(_0x25fc7e[_0xed46('0x16')][_0xed46('0x18')](_0xed46('0x19'))){var _0x5e8d84=[];_0x25fc7e[_0xed46('0x1a')][_0xed46('0x1b')](_0x1715df=>{_0x5e8d84[_0xed46('0x1c')](_0x1715df[_0xed46('0x1d')]);});var _0x146fbc=/]+>/g;var _0x1e6dcb=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x59bf36=_0x25fc7e[_0xed46('0x16')][_0xed46('0x1e')](_0x1e6dcb,'_SRC');var _0x5c2482=_0x59bf36[_0xed46('0x1e')](_0x146fbc,_0xed46('0x1f'));for(let _0x161da6=0x0;_0x161da6<_0x5e8d84['length'];_0x161da6++){var _0x261a32=_0x5c2482['replace'](_0xed46('0x1f'),_0xed46('0x20')+_0x5e8d84[_0x161da6]+_0xed46('0x21'));_0x5c2482=_0x261a32;}_0x25fc7e['html']=_0x5c2482;}_0x292b82[_0xed46('0x22')]=_0x25fc7e[_0xed46('0x16')];}else{_0x292b82[_0xed46('0x22')]=_0x25fc7e[_0xed46('0x23')];}if(_0x292b82['body']){_0x292b82[_0xed46('0x22')]=_0x292b82['body']['replace'](/0x0){var _0x4f71f2=[_0xed46('0x34'),_0xed46('0x35'),_0xed46('0x36')];for(var _0x76f36e=0x0;_0x76f36e<_0x25fc7e[_0xed46('0x33')][_0xed46('0x10')];_0x76f36e++){var _0x1de9df=_[_0xed46('0xe')](_0x4f71f2,_0x25fc7e[_0xed46('0x33')][_0x76f36e][_0xed46('0x37')]);if(_0x1de9df>=0x0){_0x292b82[_0xed46('0x38')]=!![];}}}return _0x292b82;}exports[_0xed46('0x39')]=function(_0x42d36e,_0x996e22,_0x9ec63c){var _0x345944={'from':getAddress(_0x996e22[_0xed46('0x3a')]),'firstName':getFirstName(_0x996e22[_0xed46('0x3a')]),'lastName':getLastName(_0x996e22[_0xed46('0x3a')]),'mapKey':_0xed46('0x27'),'message':{'from':getMails(_0x42d36e[_0xed46('0x27')],_0x996e22[_0xed46('0x3a')]),'to':_0x42d36e[_0xed46('0x27')],'cc':'','subject':_0x996e22[_0xed46('0x3b')]||'','messageId':_0x996e22['messageId'],'inReplyTo':_0x996e22[_0xed46('0x3c')],'sentAt':moment(_0x996e22[_0xed46('0x3d')])[_0xed46('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x996e22['html']&&!_0x996e22['textAsHtml']){var _0x4087eb=_[_0xed46('0x3e')](_0x996e22['attachments'],{'contentType':_0xed46('0x3f')});if(_0x4087eb[_0xed46('0x10')]){logger['info'](util[_0xed46('0x2c')](_0xed46('0x40'),_0x996e22[_0xed46('0x41')]));tnef[_0xed46('0x42')](_[_0xed46('0x43')](_0x4087eb)[_0xed46('0x31')],function(_0x1c41a2,_0x2022cd){if(_0x2022cd){_0x996e22[_0xed46('0x16')]=_0x2022cd[_0xed46('0x44')]||'

Empty\x20message

';if(_0x2022cd['Attachments']){for(var _0x42fb83=0x0;_0x42fb83<_0x2022cd['Attachments']['length'];_0x42fb83++){var _0x322724=_0x2022cd[_0xed46('0x45')][_0x42fb83];_0x345944[_0xed46('0x25')][_0xed46('0x1a')][_0xed46('0x1c')]({'filename':_0x322724[_0xed46('0x46')],'content':Buffer[_0xed46('0x3a')](_0x322724[_0xed46('0x47')])});}}}_0x9ec63c(parseEmail(_0x42d36e,_0x996e22,_0x345944));});}else{_0x996e22['html']=_0xed46('0x48');_0x9ec63c(parseEmail(_0x42d36e,_0x996e22,_0x345944));}}else{_0x9ec63c(parseEmail(_0x42d36e,_0x996e22,_0x345944));}};exports[_0xed46('0x49')]=function(_0x2e9430,_0x116e44){var _0x3e01aa=[_0xed46('0x4a')+(_0x116e44||''),_0xed46('0x4b')+_0x2e9430,'',''];return Buffer[_0xed46('0x3a')](_0x3e01aa[_0xed46('0x12')](''),'utf-8')[_0xed46('0x4c')](_0xed46('0x4d'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 083b846..0981072 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 _0xc0b7=['name','Service','key','active','Imap','Smtp','exports','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc0b7,0x13f));var _0x7c0b=function(_0x1e1c2f,_0x527584){_0x1e1c2f=_0x1e1c2f-0x0;var _0x25ca95=_0xc0b7[_0x1e1c2f];return _0x25ca95;};'use strict';var _=require(_0x7c0b('0x0'));function MailAccount(_0x45c6b9){this['id']=_0x45c6b9['id']||0x0;this[_0x7c0b('0x1')]=_0x45c6b9['name']||_0x7c0b('0x2');this[_0x7c0b('0x3')]=_0x45c6b9[_0x7c0b('0x3')]||'SERV';this[_0x7c0b('0x4')]=_0x45c6b9[_0x7c0b('0x4')]||![];this[_0x7c0b('0x5')]=_0x45c6b9[_0x7c0b('0x5')]||[];this['Smtp']=_0x45c6b9[_0x7c0b('0x6')]||[];}module[_0x7c0b('0x7')]=MailAccount; \ No newline at end of file +var _0x8fb2=['Service','key','SERV','active','Imap','Smtp','exports','name'];(function(_0x34a119,_0x1d66fb){var _0x1e3d6f=function(_0x204119){while(--_0x204119){_0x34a119['push'](_0x34a119['shift']());}};_0x1e3d6f(++_0x1d66fb);}(_0x8fb2,0x107));var _0x28fb=function(_0x4fa056,_0x422e81){_0x4fa056=_0x4fa056-0x0;var _0x5c9909=_0x8fb2[_0x4fa056];return _0x5c9909;};'use strict';var _=require('lodash');function MailAccount(_0x11d85f){this['id']=_0x11d85f['id']||0x0;this[_0x28fb('0x0')]=_0x11d85f[_0x28fb('0x0')]||_0x28fb('0x1');this['key']=_0x11d85f[_0x28fb('0x2')]||_0x28fb('0x3');this[_0x28fb('0x4')]=_0x11d85f['active']||![];this[_0x28fb('0x5')]=_0x11d85f['Imap']||[];this['Smtp']=_0x11d85f[_0x28fb('0x6')]||[];}module[_0x28fb('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 64427ce..e53a7f7 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 _0xb25d=['mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x28f06b,_0x1e18e1){var _0x5ad54b=function(_0x345264){while(--_0x345264){_0x28f06b['push'](_0x28f06b['shift']());}};_0x5ad54b(++_0x1e18e1);}(_0xb25d,0x15d));var _0xdb25=function(_0x224090,_0x38f7e4){_0x224090=_0x224090-0x0;var _0xd97361=_0xb25d[_0x224090];return _0xd97361;};'use strict';var _=require(_0xdb25('0x0'));var MailAccount=require(_0xdb25('0x1'));var Realtime=function(){this[_0xdb25('0x2')]={};};function freeIsNotKey(_0x3e2463,_0x59ee82,_0x1389f9){var _0x3aaa4e=_[_0xdb25('0x3')](_0x3e2463,function(_0x1a63a3,_0xc3f4b5){return _0x1a63a3[_0x1389f9];});for(var _0x53a1dd in _0x59ee82){if(_0x59ee82[_0xdb25('0x4')](_0x53a1dd)){if(!_0x3aaa4e[_0x53a1dd]){delete _0x59ee82[_0x53a1dd];}}}}Realtime[_0xdb25('0x5')]['mergeFromDatabase']=function(_0x79e43f,_0x2a4bbb){for(var _0x3c8188 in _0x2a4bbb){if(_0x79e43f[_0xdb25('0x4')](_0x3c8188)){_0x79e43f[_0x3c8188]=_0x2a4bbb[_0x3c8188];}}};Realtime[_0xdb25('0x5')][_0xdb25('0x6')]=function(){var _0x777501=this;return function(_0x3122d9){if(_0x3122d9){freeIsNotKey(_0x3122d9,_0x777501[_0xdb25('0x2')],'id');for(var _0x35cb4d=0x0,_0x10625d={},_0x195b72={};_0x35cb4d<_0x3122d9[_0xdb25('0x7')];_0x35cb4d+=0x1){_0x10625d=_0x3122d9[_0x35cb4d];if(_[_0xdb25('0x8')](_0x777501[_0xdb25('0x2')][_0x10625d['id']])){_0x777501['mailAccounts'][_0x10625d['id']]=new MailAccount(_0x10625d);}else{_[_0xdb25('0x9')](_0x777501[_0xdb25('0x2')][_0x10625d['id']],_0x10625d);}}}return _0x777501[_0xdb25('0x2')];};};module[_0xdb25('0xa')]=Realtime; \ No newline at end of file +var _0x8a4b=['prototype','mergeFromDatabase','length','isUndefined','merge','exports','lodash','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x266c2b,_0x10f31a){var _0x257e9f=function(_0x38c32c){while(--_0x38c32c){_0x266c2b['push'](_0x266c2b['shift']());}};_0x257e9f(++_0x10f31a);}(_0x8a4b,0x164));var _0xb8a4=function(_0x4192ad,_0x488f5c){_0x4192ad=_0x4192ad-0x0;var _0x415dc3=_0x8a4b[_0x4192ad];return _0x415dc3;};'use strict';var _=require(_0xb8a4('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xb8a4('0x1')]={};};function freeIsNotKey(_0xa37e0c,_0x21b09d,_0x160c09){var _0xd12cb2=_[_0xb8a4('0x2')](_0xa37e0c,function(_0x165a00,_0x524542){return _0x165a00[_0x160c09];});for(var _0x2f779b in _0x21b09d){if(_0x21b09d[_0xb8a4('0x3')](_0x2f779b)){if(!_0xd12cb2[_0x2f779b]){delete _0x21b09d[_0x2f779b];}}}}Realtime[_0xb8a4('0x4')][_0xb8a4('0x5')]=function(_0x110257,_0x4364f7){for(var _0x296304 in _0x4364f7){if(_0x110257[_0xb8a4('0x3')](_0x296304)){_0x110257[_0x296304]=_0x4364f7[_0x296304];}}};Realtime[_0xb8a4('0x4')]['initMailAccounts']=function(){var _0x3a6b4e=this;return function(_0x5dbeaa){if(_0x5dbeaa){freeIsNotKey(_0x5dbeaa,_0x3a6b4e[_0xb8a4('0x1')],'id');for(var _0x47c22a=0x0,_0x457585={},_0x2be03a={};_0x47c22a<_0x5dbeaa[_0xb8a4('0x6')];_0x47c22a+=0x1){_0x457585=_0x5dbeaa[_0x47c22a];if(_[_0xb8a4('0x7')](_0x3a6b4e[_0xb8a4('0x1')][_0x457585['id']])){_0x3a6b4e[_0xb8a4('0x1')][_0x457585['id']]=new MailAccount(_0x457585);}else{_[_0xb8a4('0x8')](_0x3a6b4e[_0xb8a4('0x1')][_0x457585['id']],_0x457585);}}}return _0x3a6b4e[_0xb8a4('0x1')];};};module[_0xb8a4('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 4448261..6308107 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 _0x598a=['service','type','data5','CloudProvider','MailServerOut','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','active','ListId','MailServerIn','Imap'];(function(_0x57b74a,_0x373d32){var _0x595ea3=function(_0x44fbf2){while(--_0x44fbf2){_0x57b74a['push'](_0x57b74a['shift']());}};_0x595ea3(++_0x373d32);}(_0x598a,0x1c9));var _0xa598=function(_0x595b92,_0x3d52b5){_0x595b92=_0x595b92-0x0;var _0x246999=_0x598a[_0x595b92];return _0x246999;};'use strict';var client=require(_0xa598('0x0'));exports[_0xa598('0x1')]=function(){return function(){return client[_0xa598('0x2')](_0xa598('0x3'),{'options':{'attributes':['id',_0xa598('0x4'),_0xa598('0x5'),'service',_0xa598('0x6'),_0xa598('0x7'),'key',_0xa598('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0xa598('0x9'),'as':_0xa598('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0xa598('0x4'),_0xa598('0xb'),_0xa598('0xc'),_0xa598('0xd')],'as':_0xa598('0xe')}]},{'model':_0xa598('0xf'),'as':'Smtp','include':[{'model':_0xa598('0xe'),'attributes':['id',_0xa598('0x4'),_0xa598('0xb'),'type',_0xa598('0xd')],'as':_0xa598('0xe')}]}]},'log':_0xa598('0x10')});};};exports['notify']=function(_0x41133d,_0x537154){return client['Request'](_0xa598('0x11'),{'account':{'id':_0x41133d},'body':_0x537154,'log':_0xa598('0x11')});}; \ No newline at end of file +var _0x06f1=['Imap','CloudProvider','data5','MailServerOut','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','service','key','ListId','TemplateId','MailServerIn'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x06f1,0x6e));var _0x106f=function(_0x4203f2,_0x2c843a){_0x4203f2=_0x4203f2-0x0;var _0x181ecd=_0x06f1[_0x4203f2];return _0x181ecd;};'use strict';var client=require(_0x106f('0x0'));exports[_0x106f('0x1')]=function(){return function(){return client[_0x106f('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x106f('0x3'),'provider',_0x106f('0x4'),'email','active',_0x106f('0x5'),_0x106f('0x6'),_0x106f('0x7')],'raw':![],'include':[{'model':_0x106f('0x8'),'as':_0x106f('0x9'),'include':[{'model':_0x106f('0xa'),'attributes':['id','name',_0x106f('0x4'),'type',_0x106f('0xb')],'as':_0x106f('0xa')}]},{'model':_0x106f('0xc'),'as':'Smtp','include':[{'model':_0x106f('0xa'),'attributes':['id',_0x106f('0x3'),_0x106f('0x4'),_0x106f('0xd'),_0x106f('0xb')],'as':_0x106f('0xa')}]}]},'log':_0x106f('0xe')});};};exports[_0x106f('0xf')]=function(_0x6894d8,_0x244c4d){return client['Request'](_0x106f('0x10'),{'account':{'id':_0x6894d8},'body':_0x244c4d,'log':_0x106f('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index c511f9d..ec2707d 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 _0x8d95=['GetSettings','../client','Request','ShowSetting','loginMailFrequency'];(function(_0x324146,_0x36f7b5){var _0x3ece02=function(_0x45f025){while(--_0x45f025){_0x324146['push'](_0x324146['shift']());}};_0x3ece02(++_0x36f7b5);}(_0x8d95,0x14b));var _0x58d9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d95[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x58d9('0x0'));exports['getSettings']=function(){return client[_0x58d9('0x1')](_0x58d9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x58d9('0x3')]},'log':_0x58d9('0x4')});}; \ No newline at end of file +var _0x20b5=['loginMailFrequency','GetSettings'];(function(_0xb9985e,_0x4564c1){var _0x37ef9c=function(_0x548989){while(--_0x548989){_0xb9985e['push'](_0xb9985e['shift']());}};_0x37ef9c(++_0x4564c1);}(_0x20b5,0x156));var _0x520b=function(_0x12dc73,_0x31d60e){_0x12dc73=_0x12dc73-0x0;var _0x51866f=_0x20b5[_0x12dc73];return _0x51866f;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x520b('0x0')]},'log':_0x520b('0x1')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 9d0bfd1..030e67a 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 b580ca9..c9188d4 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 _0x9752=['../../config/triggers','default','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis'];(function(_0x364997,_0x3ce8bd){var _0x27e571=function(_0x433e6b){while(--_0x433e6b){_0x364997['push'](_0x364997['shift']());}};_0x27e571(++_0x3ce8bd);}(_0x9752,0xe2));var _0x2975=function(_0x138b84,_0x4309c4){_0x138b84=_0x138b84-0x0;var _0x558529=_0x9752[_0x138b84];return _0x558529;};'use strict';var _=require(_0x2975('0x0'));var http=require(_0x2975('0x1'));var express=require(_0x2975('0x2'));var sticky=require(_0x2975('0x3'));var Redis=require(_0x2975('0x4'));var config=require(_0x2975('0x5'));var app=express();var server=http[_0x2975('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0x2975('0x7')](server,config[_0x2975('0x8')])){var socketio=require(_0x2975('0x9'))(server,{'transports':[_0x2975('0xa'),_0x2975('0xb')]});config[_0x2975('0xc')]=_['defaults'](config['redis'],{'host':_0x2975('0xd'),'port':0x18eb});socketio[_0x2975('0xe')](require(_0x2975('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x2975('0xc')])}));require(_0x2975('0x10'))[_0x2975('0x11')]();require('../../config/socketio')[_0x2975('0x11')](socketio);require('../../config/express')[_0x2975('0x11')](app);require(_0x2975('0x12'))[_0x2975('0x11')](app);}else{server['once'](_0x2975('0x13'),function(){console[_0x2975('0x14')](_0x2975('0x15'),config[_0x2975('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xe7de=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','localhost','adapter','../../config/triggers','default','../../config/express','../../routes','once','listening'];(function(_0x59150e,_0x27100a){var _0x41dbab=function(_0x117308){while(--_0x117308){_0x59150e['push'](_0x59150e['shift']());}};_0x41dbab(++_0x27100a);}(_0xe7de,0x1b2));var _0xee7d=function(_0x4b766c,_0x4ed209){_0x4b766c=_0x4b766c-0x0;var _0x4b07a1=_0xe7de[_0x4b766c];return _0x4b07a1;};'use strict';var _=require(_0xee7d('0x0'));var http=require(_0xee7d('0x1'));var express=require(_0xee7d('0x2'));var sticky=require(_0xee7d('0x3'));var Redis=require(_0xee7d('0x4'));var config=require(_0xee7d('0x5'));var app=express();var server=http[_0xee7d('0x6')](app);server[_0xee7d('0x7')]=0xdbba0;if(sticky[_0xee7d('0x8')](server,config[_0xee7d('0x9')])){var socketio=require(_0xee7d('0xa'))(server,{'transports':[_0xee7d('0xb'),_0xee7d('0xc')]});config[_0xee7d('0xd')]=_['defaults'](config[_0xee7d('0xd')],{'host':_0xee7d('0xe'),'port':0x18eb});socketio[_0xee7d('0xf')](require('socket.io-redis')({'pubClient':new Redis(config[_0xee7d('0xd')]),'subClient':new Redis(config[_0xee7d('0xd')])}));require(_0xee7d('0x10'))['default']();require('../../config/socketio')[_0xee7d('0x11')](socketio);require(_0xee7d('0x12'))[_0xee7d('0x11')](app);require(_0xee7d('0x13'))[_0xee7d('0x11')](app);}else{server[_0xee7d('0x14')](_0xee7d('0x15'),function(){console[_0xee7d('0x16')](_0xee7d('0x17'),config[_0xee7d('0x9')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 9fdab86..13d5067 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 _0x8560=['rpc','routing','error','message','result','catch','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug'];(function(_0x40efdb,_0x57f69b){var _0xe7bdab=function(_0x3e0679){while(--_0x3e0679){_0x40efdb['push'](_0x40efdb['shift']());}};_0xe7bdab(++_0x57f69b);}(_0x8560,0x7e));var _0x0856=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x8560[_0x4017b0];return _0x5ed4f7;};'use strict';var jayson=require(_0x0856('0x0'));var BPromise=require(_0x0856('0x1'));var logger=require(_0x0856('0x2'))('routing');var client=jayson[_0x0856('0x3')][_0x0856('0x4')]({'port':0x2329});client[_0x0856('0x5')]=function(_0x170eea,_0x2dc443){return new BPromise(function(_0x35c94a,_0xc085d6){return client[_0x0856('0x6')](_0x170eea,_0x2dc443)[_0x0856('0x7')](function(_0x51d918){logger[_0x0856('0x8')](_0x0856('0x9'),_0x0856('0xa'),_0x170eea,_0x2dc443,_0x51d918);if(_0x51d918['error']){logger[_0x0856('0xb')]('rpc','routing',_0x170eea,_0x51d918[_0x0856('0xb')][_0x0856('0xc')],_0x2dc443);return _0xc085d6(_0x51d918[_0x0856('0xb')][_0x0856('0xc')]);}else{return _0x35c94a(_0x51d918[_0x0856('0xd')]);}})[_0x0856('0xe')](function(_0x366dda){logger[_0x0856('0xb')](_0x0856('0x9'),_0x0856('0xa'),_0x170eea,_0x366dda,_0x2dc443);return _0xc085d6(_0x366dda);});});};module['exports']=client; \ No newline at end of file +var _0x9d06=['../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','exports','jayson/promise','bluebird'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9d06,0x80));var _0x69d0=function(_0x501424,_0x2be7d8){_0x501424=_0x501424-0x0;var _0x1494c7=_0x9d06[_0x501424];return _0x1494c7;};'use strict';var jayson=require(_0x69d0('0x0'));var BPromise=require(_0x69d0('0x1'));var logger=require(_0x69d0('0x2'))(_0x69d0('0x3'));var client=jayson[_0x69d0('0x4')][_0x69d0('0x5')]({'port':0x2329});client[_0x69d0('0x6')]=function(_0x3fa393,_0x528751){return new BPromise(function(_0x454223,_0x119456){return client[_0x69d0('0x7')](_0x3fa393,_0x528751)['then'](function(_0x375c7c){logger[_0x69d0('0x8')](_0x69d0('0x9'),_0x69d0('0x3'),_0x3fa393,_0x528751,_0x375c7c);if(_0x375c7c[_0x69d0('0xa')]){logger[_0x69d0('0xa')](_0x69d0('0x9'),_0x69d0('0x3'),_0x3fa393,_0x375c7c[_0x69d0('0xa')][_0x69d0('0xb')],_0x528751);return _0x119456(_0x375c7c[_0x69d0('0xa')][_0x69d0('0xb')]);}else{return _0x454223(_0x375c7c['result']);}})['catch'](function(_0x3f8d3){logger['error']('rpc',_0x69d0('0x3'),_0x3fa393,_0x3f8d3,_0x528751);return _0x119456(_0x3f8d3);});});};module[_0x69d0('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 921d11d..3422cc8 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 _0x6ea0=['./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/openchannelQueue','./rpc/mailQueue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6ea0,0x1a4));var _0x06ea=function(_0x4c6e65,_0x41de11){_0x4c6e65=_0x4c6e65-0x0;var _0x38f9b7=_0x6ea0[_0x4c6e65];return _0x38f9b7;};'use strict';var BPromise=require(_0x06ea('0x0'));var server=require(_0x06ea('0x1'));var Realtime=require(_0x06ea('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0x06ea('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x06ea('0x4'));var faxQueue=require(_0x06ea('0x5'));var whatsappQueue=require(_0x06ea('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x06ea('0x7')]()[_0x06ea('0x8')](user['getAgents']())[_0x06ea('0x8')](realtime[_0x06ea('0x9')]())['then'](interval[_0x06ea('0xa')]())[_0x06ea('0x8')](realtime[_0x06ea('0xb')]())[_0x06ea('0x8')](openchannelQueue[_0x06ea('0xc')]())[_0x06ea('0x8')](realtime[_0x06ea('0xd')]())[_0x06ea('0x8')](chatQueue[_0x06ea('0xe')]())[_0x06ea('0x8')](realtime[_0x06ea('0xf')]())[_0x06ea('0x8')](smsQueue[_0x06ea('0x10')]())[_0x06ea('0x8')](realtime['initSmsQueues']())['then'](mailQueue[_0x06ea('0x11')]())[_0x06ea('0x8')](realtime[_0x06ea('0x12')]())[_0x06ea('0x8')](faxQueue[_0x06ea('0x13')]())[_0x06ea('0x8')](realtime[_0x06ea('0x14')]())[_0x06ea('0x8')](whatsappQueue[_0x06ea('0x15')]())[_0x06ea('0x8')](realtime['initWhatsappQueues']())[_0x06ea('0x8')](function(){return realtime;});}function main(){return server[_0x06ea('0x16')](realtime)[_0x06ea('0x8')](function(_0x4658da){return initRealtime();})['then'](function(_0x33f31b){return setInterval(initRealtime,0x1388);})[_0x06ea('0x17')](function(_0x1e8f58){console[_0x06ea('0x18')](_0x1e8f58);});}main(); \ No newline at end of file +var _0xb017=['initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0xb017,0x19e));var _0x7b01=function(_0x381e21,_0x3bb7cd){_0x381e21=_0x381e21-0x0;var _0x53d548=_0xb017[_0x381e21];return _0x53d548;};'use strict';var BPromise=require(_0x7b01('0x0'));var server=require(_0x7b01('0x1'));var Realtime=require(_0x7b01('0x2'));var user=require('./rpc/user');var interval=require(_0x7b01('0x3'));var openchannelQueue=require(_0x7b01('0x4'));var chatQueue=require(_0x7b01('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x7b01('0x6'));var faxQueue=require(_0x7b01('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x7b01('0x8')]()[_0x7b01('0x9')](user[_0x7b01('0xa')]())['then'](realtime[_0x7b01('0xb')]())[_0x7b01('0x9')](interval[_0x7b01('0xc')]())[_0x7b01('0x9')](realtime[_0x7b01('0xd')]())[_0x7b01('0x9')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x7b01('0xe')]())[_0x7b01('0x9')](chatQueue[_0x7b01('0xf')]())[_0x7b01('0x9')](realtime['initChatQueues']())['then'](smsQueue['getSmsQueues']())[_0x7b01('0x9')](realtime[_0x7b01('0x10')]())[_0x7b01('0x9')](mailQueue[_0x7b01('0x11')]())[_0x7b01('0x9')](realtime[_0x7b01('0x12')]())[_0x7b01('0x9')](faxQueue[_0x7b01('0x13')]())[_0x7b01('0x9')](realtime[_0x7b01('0x14')]())[_0x7b01('0x9')](whatsappQueue[_0x7b01('0x15')]())[_0x7b01('0x9')](realtime[_0x7b01('0x16')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x86640c){return initRealtime();})[_0x7b01('0x9')](function(_0x43ab67){return setInterval(initRealtime,0x1388);})[_0x7b01('0x17')](function(_0x446e4a){console[_0x7b01('0x18')](_0x446e4a);});}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 6911cf7..53165d3 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x402718,_0x22529c){var _0x3e6afb=function(_0x456b60){while(--_0x456b60){_0x402718['push'](_0x402718['shift']());}};_0x3e6afb(++_0x22529c);}(_0x814b,0x1a2));var _0xb814=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x814b[_0x387dc1];return _0x17567c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x28eff8,_0x2c6caa){var _0x564f95=function(_0x1251bd){while(--_0x1251bd){_0x28eff8['push'](_0x28eff8['shift']());}};_0x564f95(++_0x2c6caa);}(_0x5fc3,0xa8));var _0x35fc=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x5fc3[_0x40d8d7];return _0x3454cc;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};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 78756ea..35dcf99 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 _0xb6e7=['SendMail','bluebird','jayson/promise','client','request','then','error','message','result','catch'];(function(_0x3d183f,_0x114702){var _0x555746=function(_0x5d3ea2){while(--_0x5d3ea2){_0x3d183f['push'](_0x3d183f['shift']());}};_0x555746(++_0x114702);}(_0xb6e7,0x137));var _0x7b6e=function(_0x27b3de,_0x5286a4){_0x27b3de=_0x27b3de-0x0;var _0x2b3f25=_0xb6e7[_0x27b3de];return _0x2b3f25;};'use strict';var BPromise=require(_0x7b6e('0x0'));var jayson=require(_0x7b6e('0x1'));var client=jayson[_0x7b6e('0x2')]['http']({'port':0x232b});function request(_0x4b6ad1,_0x2eb3ab){return new BPromise(function(_0x534b31,_0x598507){return client[_0x7b6e('0x3')](_0x4b6ad1,_0x2eb3ab)[_0x7b6e('0x4')](function(_0x1bdc1e){if(_0x1bdc1e[_0x7b6e('0x5')]){return _0x598507(_0x1bdc1e['error'][_0x7b6e('0x6')]);}else{return _0x534b31(_0x1bdc1e[_0x7b6e('0x7')]);}})[_0x7b6e('0x8')](function(_0x1bd90a){return _0x598507(_0x1bd90a);});});}exports['sendMailMessage']=function(_0x215ec0,_0x55e7b5){return request(_0x7b6e('0x9'),{'account':_0x215ec0,'message':_0x55e7b5});}; \ No newline at end of file +var _0x8764=['SendMail','bluebird','jayson/promise','client','http','request','then','error','sendMailMessage'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x8764,0x172));var _0x4876=function(_0x2d3808,_0x511c67){_0x2d3808=_0x2d3808-0x0;var _0x58ab67=_0x8764[_0x2d3808];return _0x58ab67;};'use strict';var BPromise=require(_0x4876('0x0'));var jayson=require(_0x4876('0x1'));var client=jayson[_0x4876('0x2')][_0x4876('0x3')]({'port':0x232b});function request(_0x4a1183,_0x276f4c){return new BPromise(function(_0x4685ef,_0x57c60c){return client[_0x4876('0x4')](_0x4a1183,_0x276f4c)[_0x4876('0x5')](function(_0x5ad9aa){if(_0x5ad9aa[_0x4876('0x6')]){return _0x57c60c(_0x5ad9aa[_0x4876('0x6')]['message']);}else{return _0x4685ef(_0x5ad9aa['result']);}})['catch'](function(_0x23fe44){return _0x57c60c(_0x23fe44);});});}exports[_0x4876('0x7')]=function(_0x4d67ed,_0x441d10){return request(_0x4876('0x8'),{'account':_0x4d67ed,'message':_0x441d10});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 9e83968..22bd287 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 _0x3e24=['emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','chatStatus','faxStatusTime','busy','openchannelWaitingInteractions','stringify'];(function(_0x5d5ef4,_0x349302){var _0x832942=function(_0x419eb2){while(--_0x419eb2){_0x5d5ef4['push'](_0x5d5ef4['shift']());}};_0x832942(++_0x349302);}(_0x3e24,0x167));var _0x43e2=function(_0xa20086,_0x3978a9){_0xa20086=_0xa20086-0x0;var _0x121c6e=_0x3e24[_0xa20086];return _0x121c6e;};'use strict';var _=require(_0x43e2('0x0'));var md5=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var Redis=require(_0x43e2('0x3'));var config=require(_0x43e2('0x4'));config['redis']=_[_0x43e2('0x5')](config[_0x43e2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x43e2('0x7'))(new Redis(config[_0x43e2('0x6')]));function Agent(_0x1a89fc){this['id']=_0x1a89fc['id']||0x0;this[_0x43e2('0x8')]=_0x1a89fc[_0x43e2('0x8')]||'';this[_0x43e2('0x9')]=_0x1a89fc[_0x43e2('0x9')]||!![];this['voicePause']=_0x1a89fc[_0x43e2('0xa')]||![];this[_0x43e2('0xb')]=_0x1a89fc['chatPause']||![];this[_0x43e2('0xc')]=_0x1a89fc[_0x43e2('0xc')]||![];this['faxPause']=_0x1a89fc[_0x43e2('0xd')]||![];this[_0x43e2('0xe')]=_0x1a89fc['smsPause']||![];this[_0x43e2('0xf')]=_0x1a89fc['openchannelPause']||![];this['chatStatus']='unknown';this[_0x43e2('0x10')]=0x0;this[_0x43e2('0x11')]=_0x1a89fc[_0x43e2('0x11')]||0x0;this[_0x43e2('0x12')]=0x0;this[_0x43e2('0x13')]=_0x43e2('0x14');this[_0x43e2('0x15')]=0x0;this[_0x43e2('0x16')]=_0x1a89fc[_0x43e2('0x16')]||0x0;this[_0x43e2('0x17')]=0x0;this[_0x43e2('0x18')]=_0x43e2('0x14');this['faxStatusTime']=0x0;this[_0x43e2('0x19')]=_0x1a89fc[_0x43e2('0x19')]||0x0;this[_0x43e2('0x1a')]=0x0;this[_0x43e2('0x1b')]='unknown';this['smsStatusTime']=0x0;this[_0x43e2('0x1c')]=_0x1a89fc[_0x43e2('0x1c')]||0x0;this[_0x43e2('0x1d')]=0x0;this[_0x43e2('0x1e')]=_0x43e2('0x14');this[_0x43e2('0x1f')]=0x0;this[_0x43e2('0x20')]=_0x1a89fc[_0x43e2('0x20')]||0x0;this[_0x43e2('0x21')]=0x0;this[_0x43e2('0x22')]='unknown';this[_0x43e2('0x23')]=0x0;this[_0x43e2('0x24')]=_0x1a89fc['openchannelCapacity']||0x0;this[_0x43e2('0x25')]=0x0;this['busy']=![];this[_0x43e2('0x26')]=undefined;this[_0x43e2('0x1')]='';this[_0x43e2('0x27')]={};this[_0x43e2('0x28')]={};this[_0x43e2('0x29')]={};this['openchannelWaitingInteractions']={};this[_0x43e2('0x2a')]={};this[_0x43e2('0x2b')]={};this[_0x43e2('0x2c')]();}Agent['prototype'][_0x43e2('0x2d')]=function(_0x32f048){if(this[_0x32f048+_0x43e2('0x2e')]>0x0){if(this[_0x32f048+_0x43e2('0x2f')]>0x0&&this[_0x32f048+'CurrentCapacity']>=this[_0x32f048+_0x43e2('0x2f')]){return _0x43e2('0x30');}else{return _0x43e2('0x31');}}else{return _0x43e2('0x32');}};Agent[_0x43e2('0x33')][_0x43e2('0x2c')]=function(){var _0x3ca16b=[_0x43e2('0x34'),_0x43e2('0x35'),_0x43e2('0x36'),_0x43e2('0x37'),_0x43e2('0x38'),'whatsapp'];for(var _0x430a0e=0x0;_0x430a0e<_0x3ca16b[_0x43e2('0x39')];_0x430a0e+=0x1){var _0x545246=this[_0x43e2('0x2d')](_0x3ca16b[_0x430a0e]);if(this[_0x3ca16b[_0x430a0e]+_0x43e2('0x3a')]!==_0x545246){this[_0x3ca16b[_0x430a0e]+_0x43e2('0x3b')]=_[_0x43e2('0x3c')](moment()[_0x43e2('0x3d')]('x'));}this[_0x3ca16b[_0x430a0e]+'Status']=_0x545246;}var _0x42f495={'id':this['id'],'name':this[_0x43e2('0x8')],'online':this[_0x43e2('0x9')],'voicePause':this[_0x43e2('0xa')],'chatPause':this[_0x43e2('0xb')],'mailPause':this[_0x43e2('0xc')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x43e2('0xf')],'chatStatus':this[_0x43e2('0x3e')],'chatStatusTime':this[_0x43e2('0x10')],'chatCapacity':this[_0x43e2('0x11')],'chatCurrentCapacity':this[_0x43e2('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x43e2('0x15')],'mailCapacity':this[_0x43e2('0x16')],'mailCurrentCapacity':this[_0x43e2('0x17')],'faxStatus':this[_0x43e2('0x18')],'faxStatusTime':this[_0x43e2('0x3f')],'faxCapacity':this[_0x43e2('0x19')],'faxCurrentCapacity':this[_0x43e2('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x43e2('0x1c')],'smsCurrentCapacity':this[_0x43e2('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x43e2('0x1f')],'whatsappCapacity':this[_0x43e2('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x43e2('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x43e2('0x40')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x43e2('0x27')],'faxWaitingInteractions':this[_0x43e2('0x28')],'mailWaitingInteractions':this[_0x43e2('0x29')],'openchannelWaitingInteractions':this[_0x43e2('0x41')],'smsWaitingInteractions':this[_0x43e2('0x2a')],'whatsappWaitingInteractions':this[_0x43e2('0x2b')]};var _0x1cf8e5=md5(JSON[_0x43e2('0x42')](_0x42f495));if(this[_0x43e2('0x1')]!==_0x1cf8e5){this[_0x43e2('0x1')]=_0x1cf8e5;io[_0x43e2('0x43')](_0x43e2('0x44'),_[_0x43e2('0x45')](_0x42f495,[_0x43e2('0x9')]));}};module[_0x43e2('0x46')]=Agent; \ No newline at end of file +var _0x32f4=['whatsappCurrentCapacity','whatsappWaitingInteractions','stringify','emit','omit','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','Capacity','CurrentCapacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','StatusTime','format','faxCurrentCapacity'];(function(_0x4121e4,_0x2bd868){var _0x1ed069=function(_0x4237fe){while(--_0x4237fe){_0x4121e4['push'](_0x4121e4['shift']());}};_0x1ed069(++_0x2bd868);}(_0x32f4,0x154));var _0x432f=function(_0x464c32,_0x241609){_0x464c32=_0x464c32-0x0;var _0x1db3f3=_0x32f4[_0x464c32];return _0x1db3f3;};'use strict';var _=require(_0x432f('0x0'));var md5=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var Redis=require(_0x432f('0x3'));var config=require('../../../config/environment');config[_0x432f('0x4')]=_[_0x432f('0x5')](config['redis'],{'host':_0x432f('0x6'),'port':0x18eb});var io=require(_0x432f('0x7'))(new Redis(config[_0x432f('0x4')]));function Agent(_0x355b02){this['id']=_0x355b02['id']||0x0;this[_0x432f('0x8')]=_0x355b02['name']||'';this['online']=_0x355b02[_0x432f('0x9')]||!![];this[_0x432f('0xa')]=_0x355b02['voicePause']||![];this[_0x432f('0xb')]=_0x355b02['chatPause']||![];this[_0x432f('0xc')]=_0x355b02[_0x432f('0xc')]||![];this[_0x432f('0xd')]=_0x355b02[_0x432f('0xd')]||![];this[_0x432f('0xe')]=_0x355b02['smsPause']||![];this[_0x432f('0xf')]=_0x355b02['openchannelPause']||![];this[_0x432f('0x10')]='unknown';this[_0x432f('0x11')]=0x0;this[_0x432f('0x12')]=_0x355b02['chatCapacity']||0x0;this[_0x432f('0x13')]=0x0;this[_0x432f('0x14')]='unknown';this[_0x432f('0x15')]=0x0;this[_0x432f('0x16')]=_0x355b02['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x432f('0x17')]=_0x432f('0x18');this[_0x432f('0x19')]=0x0;this[_0x432f('0x1a')]=_0x355b02[_0x432f('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x432f('0x1b')]=_0x432f('0x18');this[_0x432f('0x1c')]=0x0;this[_0x432f('0x1d')]=_0x355b02['smsCapacity']||0x0;this[_0x432f('0x1e')]=0x0;this[_0x432f('0x1f')]=_0x432f('0x18');this[_0x432f('0x20')]=0x0;this[_0x432f('0x21')]=_0x355b02[_0x432f('0x21')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x432f('0x22')]='unknown';this[_0x432f('0x23')]=0x0;this[_0x432f('0x24')]=_0x355b02[_0x432f('0x24')]||0x0;this[_0x432f('0x25')]=0x0;this[_0x432f('0x26')]=![];this[_0x432f('0x27')]=undefined;this[_0x432f('0x1')]='';this[_0x432f('0x28')]={};this[_0x432f('0x29')]={};this[_0x432f('0x2a')]={};this[_0x432f('0x2b')]={};this[_0x432f('0x2c')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x432f('0x2d')]['getChannelStatus']=function(_0x28968e){if(this[_0x28968e+'CurrentCapacity']>0x0){if(this[_0x28968e+_0x432f('0x2e')]>0x0&&this[_0x28968e+_0x432f('0x2f')]>=this[_0x28968e+_0x432f('0x2e')]){return _0x432f('0x30');}else{return _0x432f('0x31');}}else{return _0x432f('0x32');}};Agent['prototype'][_0x432f('0x33')]=function(){var _0x33edec=['mail',_0x432f('0x34'),_0x432f('0x35'),_0x432f('0x36'),_0x432f('0x37'),_0x432f('0x38')];for(var _0x781862=0x0;_0x781862<_0x33edec[_0x432f('0x39')];_0x781862+=0x1){var _0x5a3d18=this[_0x432f('0x3a')](_0x33edec[_0x781862]);if(this[_0x33edec[_0x781862]+'Status']!==_0x5a3d18){this[_0x33edec[_0x781862]+_0x432f('0x3b')]=_['toNumber'](moment()[_0x432f('0x3c')]('x'));}this[_0x33edec[_0x781862]+'Status']=_0x5a3d18;}var _0x3f768b={'id':this['id'],'name':this['name'],'online':this[_0x432f('0x9')],'voicePause':this[_0x432f('0xa')],'chatPause':this[_0x432f('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x432f('0xe')],'faxPause':this[_0x432f('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x432f('0x11')],'chatCapacity':this[_0x432f('0x12')],'chatCurrentCapacity':this[_0x432f('0x13')],'mailStatus':this[_0x432f('0x14')],'mailStatusTime':this[_0x432f('0x15')],'mailCapacity':this[_0x432f('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x432f('0x19')],'faxCapacity':this[_0x432f('0x1a')],'faxCurrentCapacity':this[_0x432f('0x3d')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x432f('0x1c')],'smsCapacity':this[_0x432f('0x1d')],'smsCurrentCapacity':this[_0x432f('0x1e')],'whatsappStatus':this[_0x432f('0x1f')],'whatsappStatusTime':this[_0x432f('0x20')],'whatsappCapacity':this[_0x432f('0x21')],'whatsappCurrentCapacity':this[_0x432f('0x3e')],'openchannelStatus':this[_0x432f('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x432f('0x25')],'busy':this[_0x432f('0x26')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x432f('0x2a')],'openchannelWaitingInteractions':this[_0x432f('0x2b')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x432f('0x3f')]};var _0x2c1bc1=md5(JSON[_0x432f('0x40')](_0x3f768b));if(this['md5']!==_0x2c1bc1){this[_0x432f('0x1')]=_0x2c1bc1;io[_0x432f('0x41')]('user:routing:update',_[_0x432f('0x42')](_0x3f768b,[_0x432f('0x9')]));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4b9d332..6960f76 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 _0xa956=['exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','chatPause','paused','available','stringify','format'];(function(_0x28ad0a,_0x1c7181){var _0x1d1116=function(_0x23606e){while(--_0x23606e){_0x28ad0a['push'](_0x28ad0a['shift']());}};_0x1d1116(++_0x1c7181);}(_0xa956,0xc5));var _0x6a95=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xa956[_0x1a7846];return _0x48049;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x6a95('0x0'));var config=require(_0x6a95('0x1'));config[_0x6a95('0x2')]=_[_0x6a95('0x3')](config[_0x6a95('0x2')],{'host':_0x6a95('0x4'),'port':0x18eb});var io=require(_0x6a95('0x5'))(new Redis(config[_0x6a95('0x2')]));function ChatQueue(_0x12c119){this['id']=_0x12c119['id']||0x0;this[_0x6a95('0x6')]=_0x12c119[_0x6a95('0x6')]||'';this[_0x6a95('0x7')]=_0x12c119[_0x6a95('0x7')]||0xa;this[_0x6a95('0x8')]=_0x12c119[_0x6a95('0x8')]||_0x6a95('0x9');this[_0x6a95('0xa')]=_0x12c119[_0x6a95('0xa')];this[_0x6a95('0xb')]={};this[_0x6a95('0xc')]=0x0;this[_0x6a95('0xd')]='';this[_0x6a95('0xe')]();this[_0x6a95('0xf')]();}ChatQueue[_0x6a95('0x10')]['updateRouting']=function(){var _0x14351b=this[_0x6a95('0xb')][_0x6a95('0x11')];this['mapAgentsId']=_[_0x6a95('0x12')](this[_0x6a95('0xa')],'id');this['mapAgentsId']['_rr']=_0x14351b;};ChatQueue[_0x6a95('0x10')][_0x6a95('0xf')]=function(){this[_0x6a95('0x13')]=0x0;this['paused']=0x0;for(var _0x10d9e8=0x0;_0x10d9e8=0x0?this[_0x6a95('0x18')]:0x0;var _0x4a339e={'id':this['id'],'available':this[_0x6a95('0x18')],'loggedIn':this[_0x6a95('0x13')],'name':this['name'],'paused':this[_0x6a95('0x17')],'waiting':this[_0x6a95('0xc')]};var _0x5153ee=md5(JSON[_0x6a95('0x19')](_0x4a339e));if(this[_0x6a95('0xd')]!==_0x5153ee){this[_0x6a95('0xd')]=_0x5153ee;io['to'](util[_0x6a95('0x1a')]('chat:queue:%s',_0x4a339e[_0x6a95('0x6')]))['emit']('chat_queue:save',_0x4a339e);}};module[_0x6a95('0x1b')]=ChatQueue; \ No newline at end of file +var _0x2576=['loggedIn','chatPause','available','stringify','format','emit','chat_queue:save','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','paused','length','online'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x2576,0xcb));var _0x6257=function(_0x4e69e2,_0x2c8598){_0x4e69e2=_0x4e69e2-0x0;var _0x54eac0=_0x2576[_0x4e69e2];return _0x54eac0;};'use strict';var _=require('lodash');var md5=require(_0x6257('0x0'));var util=require(_0x6257('0x1'));var Redis=require(_0x6257('0x2'));var config=require(_0x6257('0x3'));config[_0x6257('0x4')]=_['defaults'](config['redis'],{'host':_0x6257('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x5eb791){this['id']=_0x5eb791['id']||0x0;this[_0x6257('0x6')]=_0x5eb791[_0x6257('0x6')]||'';this[_0x6257('0x7')]=_0x5eb791[_0x6257('0x7')]||0xa;this[_0x6257('0x8')]=_0x5eb791[_0x6257('0x8')]||_0x6257('0x9');this['Agents']=_0x5eb791[_0x6257('0xa')];this[_0x6257('0xb')]={};this[_0x6257('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x6257('0xd')]();}ChatQueue[_0x6257('0xe')][_0x6257('0xf')]=function(){var _0x11c43a=this['mapAgentsId'][_0x6257('0x10')];this[_0x6257('0xb')]=_[_0x6257('0x11')](this['Agents'],'id');this[_0x6257('0xb')][_0x6257('0x10')]=_0x11c43a;};ChatQueue[_0x6257('0xe')][_0x6257('0xd')]=function(){this['loggedIn']=0x0;this[_0x6257('0x12')]=0x0;for(var _0x2d42e7=0x0;_0x2d42e7=0x0?this['available']:0x0;var _0x4eccf2={'id':this['id'],'available':this[_0x6257('0x17')],'loggedIn':this[_0x6257('0x15')],'name':this[_0x6257('0x6')],'paused':this[_0x6257('0x12')],'waiting':this[_0x6257('0xc')]};var _0x1f41ab=md5(JSON[_0x6257('0x18')](_0x4eccf2));if(this[_0x6257('0x0')]!==_0x1f41ab){this[_0x6257('0x0')]=_0x1f41ab;io['to'](util[_0x6257('0x19')]('chat:queue:%s',_0x4eccf2[_0x6257('0x6')]))[_0x6257('0x1a')](_0x6257('0x1b'),_0x4eccf2);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 91deab7..2b7fea3 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 _0xea47=['_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype'];(function(_0x146574,_0x30f429){var _0x264337=function(_0xa89fcf){while(--_0xa89fcf){_0x146574['push'](_0x146574['shift']());}};_0x264337(++_0x30f429);}(_0xea47,0x1dc));var _0x7ea4=function(_0x1087e5,_0x416079){_0x1087e5=_0x1087e5-0x0;var _0x565ee6=_0xea47[_0x1087e5];return _0x565ee6;};'use strict';var _=require(_0x7ea4('0x0'));var md5=require(_0x7ea4('0x1'));var util=require(_0x7ea4('0x2'));var Redis=require(_0x7ea4('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x7ea4('0x4')](config['redis'],{'host':_0x7ea4('0x5'),'port':0x18eb});var io=require(_0x7ea4('0x6'))(new Redis(config[_0x7ea4('0x7')]));function FaxQueue(_0x4478d2){this['id']=_0x4478d2['id']||0x0;this[_0x7ea4('0x8')]=_0x4478d2[_0x7ea4('0x8')]||'';this[_0x7ea4('0x9')]=_0x4478d2[_0x7ea4('0x9')]||0xa;this[_0x7ea4('0xa')]=_0x4478d2['strategy']||_0x7ea4('0xb');this['Agents']=_0x4478d2[_0x7ea4('0xc')];this[_0x7ea4('0xd')]={};this[_0x7ea4('0xe')]=0x0;this[_0x7ea4('0x1')]='';this['updateRouting']();this[_0x7ea4('0xf')]();}FaxQueue[_0x7ea4('0x10')]['updateRouting']=function(){var _0x5baf67=this[_0x7ea4('0xd')][_0x7ea4('0x11')];this[_0x7ea4('0xd')]=_['map'](this[_0x7ea4('0xc')],'id');this[_0x7ea4('0xd')][_0x7ea4('0x11')]=_0x5baf67;};FaxQueue[_0x7ea4('0x10')][_0x7ea4('0xf')]=function(){this[_0x7ea4('0x12')]=0x0;this[_0x7ea4('0x13')]=0x0;for(var _0x520e5c=0x0;_0x520e5c=0x0?this[_0x7ea4('0x17')]:0x0;var _0x1c3e7a={'id':this['id'],'available':this[_0x7ea4('0x17')],'loggedIn':this[_0x7ea4('0x12')],'name':this[_0x7ea4('0x8')],'paused':this[_0x7ea4('0x13')],'waiting':this['waiting']};var _0x4493e7=md5(JSON[_0x7ea4('0x18')](_0x1c3e7a));if(this['md5']!==_0x4493e7){this[_0x7ea4('0x1')]=_0x4493e7;io['to'](util[_0x7ea4('0x19')](_0x7ea4('0x1a'),_0x1c3e7a[_0x7ea4('0x8')]))[_0x7ea4('0x1b')](_0x7ea4('0x1c'),_0x1c3e7a);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xc976=['faxPause','available','stringify','fax:queue:%s','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc976,0x7a));var _0x6c97=function(_0x420539,_0x3b7a58){_0x420539=_0x420539-0x0;var _0x80e458=_0xc976[_0x420539];return _0x80e458;};'use strict';var _=require('lodash');var md5=require(_0x6c97('0x0'));var util=require(_0x6c97('0x1'));var Redis=require(_0x6c97('0x2'));var config=require(_0x6c97('0x3'));config[_0x6c97('0x4')]=_[_0x6c97('0x5')](config[_0x6c97('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x6c97('0x6'))(new Redis(config['redis']));function FaxQueue(_0x3ceaf1){this['id']=_0x3ceaf1['id']||0x0;this[_0x6c97('0x7')]=_0x3ceaf1[_0x6c97('0x7')]||'';this[_0x6c97('0x8')]=_0x3ceaf1[_0x6c97('0x8')]||0xa;this[_0x6c97('0x9')]=_0x3ceaf1[_0x6c97('0x9')]||_0x6c97('0xa');this[_0x6c97('0xb')]=_0x3ceaf1[_0x6c97('0xb')];this[_0x6c97('0xc')]={};this[_0x6c97('0xd')]=0x0;this[_0x6c97('0x0')]='';this[_0x6c97('0xe')]();this[_0x6c97('0xf')]();}FaxQueue[_0x6c97('0x10')][_0x6c97('0xe')]=function(){var _0x989483=this['mapAgentsId'][_0x6c97('0x11')];this[_0x6c97('0xc')]=_[_0x6c97('0x12')](this['Agents'],'id');this[_0x6c97('0xc')][_0x6c97('0x11')]=_0x989483;};FaxQueue[_0x6c97('0x10')]['updateRealtime']=function(){this[_0x6c97('0x13')]=0x0;this[_0x6c97('0x14')]=0x0;for(var _0x3607b2=0x0;_0x3607b2=0x0?this[_0x6c97('0x18')]:0x0;var _0x13df4c={'id':this['id'],'available':this[_0x6c97('0x18')],'loggedIn':this[_0x6c97('0x13')],'name':this[_0x6c97('0x7')],'paused':this['paused'],'waiting':this[_0x6c97('0xd')]};var _0x4fbcf2=md5(JSON[_0x6c97('0x19')](_0x13df4c));if(this[_0x6c97('0x0')]!==_0x4fbcf2){this[_0x6c97('0x0')]=_0x4fbcf2;io['to'](util['format'](_0x6c97('0x1a'),_0x13df4c[_0x6c97('0x7')]))['emit'](_0x6c97('0x1b'),_0x13df4c);}};module[_0x6c97('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 7457751..1546991 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 _0x5856=['name','Intervals','exports'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x5856,0x102));var _0x6585=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x5856[_0x3a3758];return _0x1a9234;};'use strict';function Interval(_0x4f36c6){this['id']=_0x4f36c6['id']||0x0;this['name']=_0x4f36c6[_0x6585('0x0')]||'';this[_0x6585('0x1')]=_0x4f36c6['Intervals']||{};}module[_0x6585('0x2')]=Interval; \ No newline at end of file +var _0xf114=['name','Intervals','exports'];(function(_0x2cef28,_0x2ae1ba){var _0x22749a=function(_0x1491e9){while(--_0x1491e9){_0x2cef28['push'](_0x2cef28['shift']());}};_0x22749a(++_0x2ae1ba);}(_0xf114,0x135));var _0x4f11=function(_0x3e7141,_0x5b52a4){_0x3e7141=_0x3e7141-0x0;var _0x234628=_0xf114[_0x3e7141];return _0x234628;};'use strict';function Interval(_0x54ac58){this['id']=_0x54ac58['id']||0x0;this['name']=_0x54ac58[_0x4f11('0x0')]||'';this['Intervals']=_0x54ac58[_0x4f11('0x1')]||{};}module[_0x4f11('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 13b78b5..98c3a0c 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 _0x6a98=['mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','mailPause','available','stringify'];(function(_0x22cbd3,_0x36f0e8){var _0x4681f0=function(_0x10aefe){while(--_0x10aefe){_0x22cbd3['push'](_0x22cbd3['shift']());}};_0x4681f0(++_0x36f0e8);}(_0x6a98,0x13b));var _0x86a9=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x6a98[_0xd158dc];return _0x12d25f;};'use strict';var _=require(_0x86a9('0x0'));var md5=require(_0x86a9('0x1'));var util=require(_0x86a9('0x2'));var Redis=require(_0x86a9('0x3'));var config=require(_0x86a9('0x4'));config[_0x86a9('0x5')]=_[_0x86a9('0x6')](config[_0x86a9('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x86a9('0x5')]));function MailQueue(_0x5e0040){this['id']=_0x5e0040['id']||0x0;this['name']=_0x5e0040[_0x86a9('0x7')]||'';this['timeout']=_0x5e0040[_0x86a9('0x8')]||0xa;this['strategy']=_0x5e0040[_0x86a9('0x9')]||_0x86a9('0xa');this['Agents']=_0x5e0040[_0x86a9('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x86a9('0x1')]='';this['updateRouting']();this[_0x86a9('0xc')]();}MailQueue[_0x86a9('0xd')]['updateRouting']=function(){var _0x5d816b=this[_0x86a9('0xe')][_0x86a9('0xf')];this[_0x86a9('0xe')]=_[_0x86a9('0x10')](this[_0x86a9('0xb')],'id');this[_0x86a9('0xe')]['_rr']=_0x5d816b;};MailQueue[_0x86a9('0xd')][_0x86a9('0xc')]=function(){this[_0x86a9('0x11')]=0x0;this[_0x86a9('0x12')]=0x0;for(var _0x242492=0x0;_0x242492=0x0?this[_0x86a9('0x15')]:0x0;var _0x557550={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x86a9('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x3ccbde=md5(JSON[_0x86a9('0x16')](_0x557550));if(this[_0x86a9('0x1')]!==_0x3ccbde){this[_0x86a9('0x1')]=_0x3ccbde;io['to'](util['format'](_0x86a9('0x17'),_0x557550[_0x86a9('0x7')]))[_0x86a9('0x18')](_0x86a9('0x19'),_0x557550);}};module['exports']=MailQueue; \ No newline at end of file +var _0x1a56=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','_rr','prototype','loggedIn','length','mailPause','available','paused','stringify','format','mail:queue:%s','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x1a56,0x17a));var _0x61a5=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x1a56[_0x39872b];return _0x55fa18;};'use strict';var _=require(_0x61a5('0x0'));var md5=require(_0x61a5('0x1'));var util=require(_0x61a5('0x2'));var Redis=require(_0x61a5('0x3'));var config=require(_0x61a5('0x4'));config[_0x61a5('0x5')]=_[_0x61a5('0x6')](config['redis'],{'host':_0x61a5('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x24a0c1){this['id']=_0x24a0c1['id']||0x0;this[_0x61a5('0x8')]=_0x24a0c1['name']||'';this[_0x61a5('0x9')]=_0x24a0c1[_0x61a5('0x9')]||0xa;this[_0x61a5('0xa')]=_0x24a0c1['strategy']||_0x61a5('0xb');this[_0x61a5('0xc')]=_0x24a0c1['Agents'];this[_0x61a5('0xd')]={};this[_0x61a5('0xe')]=0x0;this[_0x61a5('0x1')]='';this['updateRouting']();this[_0x61a5('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0x21cb36=this['mapAgentsId'][_0x61a5('0x10')];this[_0x61a5('0xd')]=_['map'](this[_0x61a5('0xc')],'id');this[_0x61a5('0xd')][_0x61a5('0x10')]=_0x21cb36;};MailQueue[_0x61a5('0x11')][_0x61a5('0xf')]=function(){this[_0x61a5('0x12')]=0x0;this['paused']=0x0;for(var _0x35e6f7=0x0;_0x35e6f7=0x0?this[_0x61a5('0x15')]:0x0;var _0x5410d0={'id':this['id'],'available':this['available'],'loggedIn':this[_0x61a5('0x12')],'name':this['name'],'paused':this[_0x61a5('0x16')],'waiting':this['waiting']};var _0x4f0697=md5(JSON[_0x61a5('0x17')](_0x5410d0));if(this[_0x61a5('0x1')]!==_0x4f0697){this[_0x61a5('0x1')]=_0x4f0697;io['to'](util[_0x61a5('0x18')](_0x61a5('0x19'),_0x5410d0[_0x61a5('0x8')]))['emit']('mail_queue:save',_0x5410d0);}};module[_0x61a5('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7c70e71..a127418 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x7a54,0x106));var _0x47a5=function(_0xcded6f,_0x8512f3){_0xcded6f=_0xcded6f-0x0;var _0x56c7d5=_0x7a54[_0xcded6f];return _0x56c7d5;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x1a59a6,_0x37f523){var _0x127d2d=function(_0x4e1b48){while(--_0x4e1b48){_0x1a59a6['push'](_0x1a59a6['shift']());}};_0x127d2d(++_0x37f523);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x5fc3[_0x54a2e4];return _0x4742d0;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index cccd40a..5de6fe9 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 _0x5455=['emit','sms_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','paused','length','online','loggedIn','smsPause','available','stringify','sms:queue:%s','name'];(function(_0x4cbaa2,_0x296688){var _0x2c0e29=function(_0x4a78a3){while(--_0x4a78a3){_0x4cbaa2['push'](_0x4cbaa2['shift']());}};_0x2c0e29(++_0x296688);}(_0x5455,0x197));var _0x5545=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5455[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var md5=require(_0x5545('0x0'));var util=require(_0x5545('0x1'));var Redis=require(_0x5545('0x2'));var config=require(_0x5545('0x3'));config[_0x5545('0x4')]=_[_0x5545('0x5')](config[_0x5545('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5545('0x4')]));function SmsQueue(_0x6688e5){this['id']=_0x6688e5['id']||0x0;this['name']=_0x6688e5['name']||'';this[_0x5545('0x6')]=_0x6688e5[_0x5545('0x6')]||0xa;this['strategy']=_0x6688e5[_0x5545('0x7')]||_0x5545('0x8');this['Agents']=_0x6688e5[_0x5545('0x9')];this[_0x5545('0xa')]={};this[_0x5545('0xb')]=0x0;this[_0x5545('0x0')]='';this[_0x5545('0xc')]();this[_0x5545('0xd')]();}SmsQueue[_0x5545('0xe')][_0x5545('0xc')]=function(){var _0xbb13a0=this['mapAgentsId']['_rr'];this[_0x5545('0xa')]=_[_0x5545('0xf')](this[_0x5545('0x9')],'id');this[_0x5545('0xa')]['_rr']=_0xbb13a0;};SmsQueue[_0x5545('0xe')][_0x5545('0xd')]=function(){this['loggedIn']=0x0;this[_0x5545('0x10')]=0x0;for(var _0x167f3d=0x0;_0x167f3d=0x0?this[_0x5545('0x15')]:0x0;var _0x373f92={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5545('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x5f13ef=md5(JSON[_0x5545('0x16')](_0x373f92));if(this[_0x5545('0x0')]!==_0x5f13ef){this[_0x5545('0x0')]=_0x5f13ef;io['to'](util['format'](_0x5545('0x17'),_0x373f92[_0x5545('0x18')]))[_0x5545('0x19')](_0x5545('0x1a'),_0x373f92);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xf403=['sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','length','online','smsPause','paused','available','md5','format'];(function(_0x8e6dc3,_0x41aa19){var _0x3f95fb=function(_0x47c607){while(--_0x47c607){_0x8e6dc3['push'](_0x8e6dc3['shift']());}};_0x3f95fb(++_0x41aa19);}(_0xf403,0x1d3));var _0x3f40=function(_0x56c03e,_0x3187ad){_0x56c03e=_0x56c03e-0x0;var _0x46a1be=_0xf403[_0x56c03e];return _0x46a1be;};'use strict';var _=require(_0x3f40('0x0'));var md5=require('md5');var util=require(_0x3f40('0x1'));var Redis=require(_0x3f40('0x2'));var config=require(_0x3f40('0x3'));config[_0x3f40('0x4')]=_[_0x3f40('0x5')](config[_0x3f40('0x4')],{'host':_0x3f40('0x6'),'port':0x18eb});var io=require(_0x3f40('0x7'))(new Redis(config['redis']));function SmsQueue(_0x4e91bb){this['id']=_0x4e91bb['id']||0x0;this[_0x3f40('0x8')]=_0x4e91bb[_0x3f40('0x8')]||'';this[_0x3f40('0x9')]=_0x4e91bb[_0x3f40('0x9')]||0xa;this['strategy']=_0x4e91bb[_0x3f40('0xa')]||'beepall';this['Agents']=_0x4e91bb[_0x3f40('0xb')];this[_0x3f40('0xc')]={};this[_0x3f40('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x3f40('0xe')]();}SmsQueue[_0x3f40('0xf')][_0x3f40('0x10')]=function(){var _0x4e30e2=this[_0x3f40('0xc')][_0x3f40('0x11')];this[_0x3f40('0xc')]=_['map'](this[_0x3f40('0xb')],'id');this['mapAgentsId'][_0x3f40('0x11')]=_0x4e30e2;};SmsQueue[_0x3f40('0xf')][_0x3f40('0xe')]=function(){this[_0x3f40('0x12')]=0x0;this['paused']=0x0;for(var _0x2b2bfe=0x0;_0x2b2bfe=0x0?this[_0x3f40('0x17')]:0x0;var _0x374644={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3f40('0x12')],'name':this[_0x3f40('0x8')],'paused':this[_0x3f40('0x16')],'waiting':this[_0x3f40('0xd')]};var _0x3129e2=md5(JSON['stringify'](_0x374644));if(this[_0x3f40('0x18')]!==_0x3129e2){this['md5']=_0x3129e2;io['to'](util[_0x3f40('0x19')](_0x3f40('0x1a'),_0x374644[_0x3f40('0x8')]))[_0x3f40('0x1b')](_0x3f40('0x1c'),_0x374644);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 534bccb..3c22096 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 _0x2684=['available','stringify','whatsapp:queue:%s','exports','lodash','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','_rr','map','mapAgentsId','prototype','paused','length','loggedIn','whatsappPause'];(function(_0x35095b,_0x28c169){var _0x3e2667=function(_0x1acdba){while(--_0x1acdba){_0x35095b['push'](_0x35095b['shift']());}};_0x3e2667(++_0x28c169);}(_0x2684,0xdc));var _0x4268=function(_0x1fac5e,_0x1edf0e){_0x1fac5e=_0x1fac5e-0x0;var _0x1416c9=_0x2684[_0x1fac5e];return _0x1416c9;};'use strict';var _=require(_0x4268('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x4268('0x1'));var config=require('../../../config/environment');config[_0x4268('0x2')]=_[_0x4268('0x3')](config[_0x4268('0x2')],{'host':_0x4268('0x4'),'port':0x18eb});var io=require(_0x4268('0x5'))(new Redis(config[_0x4268('0x2')]));function WhatsappQueue(_0x363e92){this['id']=_0x363e92['id']||0x0;this[_0x4268('0x6')]=_0x363e92[_0x4268('0x6')]||'';this['timeout']=_0x363e92[_0x4268('0x7')]||0xa;this[_0x4268('0x8')]=_0x363e92[_0x4268('0x8')]||_0x4268('0x9');this['Agents']=_0x363e92[_0x4268('0xa')];this['mapAgentsId']={};this[_0x4268('0xb')]=0x0;this[_0x4268('0xc')]='';this[_0x4268('0xd')]();this[_0x4268('0xe')]();}WhatsappQueue['prototype'][_0x4268('0xd')]=function(){var _0x27e8b7=this['mapAgentsId'][_0x4268('0xf')];this['mapAgentsId']=_[_0x4268('0x10')](this[_0x4268('0xa')],'id');this[_0x4268('0x11')][_0x4268('0xf')]=_0x27e8b7;};WhatsappQueue[_0x4268('0x12')][_0x4268('0xe')]=function(){this['loggedIn']=0x0;this[_0x4268('0x13')]=0x0;for(var _0x3fcd7e=0x0;_0x3fcd7e=0x0?this[_0x4268('0x17')]:0x0;var _0x3205a7={'id':this['id'],'available':this[_0x4268('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x4268('0x6')],'paused':this[_0x4268('0x13')],'waiting':this[_0x4268('0xb')]};var _0xcfb219=md5(JSON[_0x4268('0x18')](_0x3205a7));if(this[_0x4268('0xc')]!==_0xcfb219){this[_0x4268('0xc')]=_0xcfb219;io['to'](util['format'](_0x4268('0x19'),_0x3205a7[_0x4268('0x6')]))['emit']('whatsapp_queue:save',_0x3205a7);}};module[_0x4268('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x8a14=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','md5','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','name'];(function(_0x4e019c,_0x55ff32){var _0x37dedf=function(_0xfac621){while(--_0xfac621){_0x4e019c['push'](_0x4e019c['shift']());}};_0x37dedf(++_0x55ff32);}(_0x8a14,0x143));var _0x48a1=function(_0x3ed0a8,_0x299b0f){_0x3ed0a8=_0x3ed0a8-0x0;var _0x4b24fb=_0x8a14[_0x3ed0a8];return _0x4b24fb;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x48a1('0x0'));var Redis=require(_0x48a1('0x1'));var config=require(_0x48a1('0x2'));config['redis']=_[_0x48a1('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x48a1('0x4'))(new Redis(config[_0x48a1('0x5')]));function WhatsappQueue(_0x1cd187){this['id']=_0x1cd187['id']||0x0;this[_0x48a1('0x6')]=_0x1cd187[_0x48a1('0x6')]||'';this[_0x48a1('0x7')]=_0x1cd187[_0x48a1('0x7')]||0xa;this[_0x48a1('0x8')]=_0x1cd187[_0x48a1('0x8')]||_0x48a1('0x9');this[_0x48a1('0xa')]=_0x1cd187[_0x48a1('0xa')];this[_0x48a1('0xb')]={};this[_0x48a1('0xc')]=0x0;this['md5']='';this[_0x48a1('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x48a1('0xe')][_0x48a1('0xd')]=function(){var _0x654374=this['mapAgentsId']['_rr'];this[_0x48a1('0xb')]=_[_0x48a1('0xf')](this[_0x48a1('0xa')],'id');this[_0x48a1('0xb')][_0x48a1('0x10')]=_0x654374;};WhatsappQueue[_0x48a1('0xe')][_0x48a1('0x11')]=function(){this[_0x48a1('0x12')]=0x0;this[_0x48a1('0x13')]=0x0;for(var _0xf2af8c=0x0;_0xf2af8c=0x0?this[_0x48a1('0x17')]:0x0;var _0x2f8ce8={'id':this['id'],'available':this[_0x48a1('0x17')],'loggedIn':this[_0x48a1('0x12')],'name':this[_0x48a1('0x6')],'paused':this[_0x48a1('0x13')],'waiting':this[_0x48a1('0xc')]};var _0x5a80c8=md5(JSON[_0x48a1('0x18')](_0x2f8ce8));if(this[_0x48a1('0x19')]!==_0x5a80c8){this[_0x48a1('0x19')]=_0x5a80c8;io['to'](util['format'](_0x48a1('0x1a'),_0x2f8ce8[_0x48a1('0x6')]))[_0x48a1('0x1b')](_0x48a1('0x1c'),_0x2f8ce8);}};module[_0x48a1('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9bee213..a5af436 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x8f3a86,_0x3a7837){var _0x3a20c6=function(_0x3924dc){while(--_0x3924dc){_0x8f3a86['push'](_0x8f3a86['shift']());}};_0x3a20c6(++_0x3a7837);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a87fc,_0x30a039){_0x2a87fc=_0x2a87fc-0x0;var _0x32d9f5=_0xb10b[_0x2a87fc];return _0x32d9f5;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 7f6ab59..28b0505 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 _0xa99b=['UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x730dc3,_0x33d8b9){var _0x1059af=function(_0x123c14){while(--_0x123c14){_0x730dc3['push'](_0x730dc3['shift']());}};_0x1059af(++_0x33d8b9);}(_0xa99b,0x12e));var _0xba99=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xa99b[_0x513aa5];return _0x1a1a7c;};'use strict';var client=require(_0xba99('0x0'));exports[_0xba99('0x1')]=function(_0x4174c4,_0x3e8b8f){return client['Request'](_0xba99('0x2'),{'body':_0x3e8b8f,'options':{'where':{'id':_0x4174c4}},'log':_0xba99('0x3')});};exports[_0xba99('0x4')]=function(_0x531d74,_0x377d36){return client[_0xba99('0x5')](_0xba99('0x6'),{'body':_0x377d36,'options':{'where':{'id':_0x531d74}},'log':_0xba99('0x7')});}; \ No newline at end of file +var _0xce6b=['../client','update','Request','AddTagsToChatInteraction'];(function(_0x473d60,_0xbd8502){var _0xdf6b4f=function(_0x58ed0e){while(--_0x58ed0e){_0x473d60['push'](_0x473d60['shift']());}};_0xdf6b4f(++_0xbd8502);}(_0xce6b,0x1c4));var _0xbce6=function(_0x17d3de,_0x51f98d){_0x17d3de=_0x17d3de-0x0;var _0x2ac8d9=_0xce6b[_0x17d3de];return _0x2ac8d9;};'use strict';var client=require(_0xbce6('0x0'));exports[_0xbce6('0x1')]=function(_0x59f684,_0x22bd66){return client[_0xbce6('0x2')]('UpdateChatInteraction',{'body':_0x22bd66,'options':{'where':{'id':_0x59f684}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x2759ef,_0x2709ee){return client[_0xbce6('0x2')](_0xbce6('0x3'),{'body':_0x2709ee,'options':{'where':{'id':_0x2759ef}},'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 8cd7e21..80de398 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 _0x89fa=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x29139c,_0x37cc9d){var _0x4d0793=function(_0x8ad64e){while(--_0x8ad64e){_0x29139c['push'](_0x29139c['shift']());}};_0x4d0793(++_0x37cc9d);}(_0x89fa,0x140));var _0xa89f=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x89fa[_0x32b993];return _0x482780;};'use strict';var client=require('../client');exports[_0xa89f('0x0')]=function(_0x2adc4a){return client[_0xa89f('0x1')](_0xa89f('0x2'),{'body':_0x2adc4a,'log':_0xa89f('0x3')});}; \ No newline at end of file +var _0xa357=['createChatMessage','create','Request'];(function(_0xd3160c,_0x422e7c){var _0x215b8a=function(_0x17c4f1){while(--_0x17c4f1){_0xd3160c['push'](_0xd3160c['shift']());}};_0x215b8a(++_0x422e7c);}(_0xa357,0x16c));var _0x7a35=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0xa357[_0x11deef];return _0xe9ba85;};'use strict';var client=require('../client');exports[_0x7a35('0x0')]=function(_0x3c7380){return client[_0x7a35('0x1')]('CreateChatMessage',{'body':_0x3c7380,'log':_0x7a35('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 54519cf..e74a9a5 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 _0xcb57=['chatPause','../client','getChatQueues','GetChatQueue','timeout','User','Agents','online'];(function(_0x5266e7,_0x97b16b){var _0x5470f1=function(_0x10258e){while(--_0x10258e){_0x5266e7['push'](_0x5266e7['shift']());}};_0x5470f1(++_0x97b16b);}(_0xcb57,0xa1));var _0x7cb5=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xcb57[_0x7e2eb0];return _0xd92de4;};'use strict';var client=require(_0x7cb5('0x0'));exports[_0x7cb5('0x1')]=function(){return function(){return client['Request'](_0x7cb5('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7cb5('0x3'),'strategy'],'include':[{'model':_0x7cb5('0x4'),'as':_0x7cb5('0x5'),'attributes':['id','name',_0x7cb5('0x6'),_0x7cb5('0x7')]}]},'log':_0x7cb5('0x1')});};}; \ No newline at end of file +var _0x818f=['User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x13b796,_0x19507b){var _0x54757d=function(_0x5805ea){while(--_0x5805ea){_0x13b796['push'](_0x13b796['shift']());}};_0x54757d(++_0x19507b);}(_0x818f,0x1da));var _0xf818=function(_0x56ba1b,_0x36ef36){_0x56ba1b=_0x56ba1b-0x0;var _0x57bc39=_0x818f[_0x56ba1b];return _0x57bc39;};'use strict';var client=require(_0xf818('0x0'));exports[_0xf818('0x1')]=function(){return function(){return client[_0xf818('0x2')](_0xf818('0x3'),{'options':{'raw':![],'attributes':['id',_0xf818('0x4'),_0xf818('0x5'),'strategy'],'include':[{'model':_0xf818('0x6'),'as':_0xf818('0x7'),'attributes':['id',_0xf818('0x4'),_0xf818('0x8'),_0xf818('0x9')]}]},'log':_0xf818('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d8ef7f6..36751f6 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 _0x81d5=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x81d5,0x1ab));var _0x581d=function(_0x4c1d47,_0x4868bd){_0x4c1d47=_0x4c1d47-0x0;var _0x39736b=_0x81d5[_0x4c1d47];return _0x39736b;};'use strict';var client=require(_0x581d('0x0'));exports[_0x581d('0x1')]=function(_0x55fd33){return client[_0x581d('0x2')](_0x581d('0x3'),{'body':_0x55fd33,'log':_0x581d('0x3')});};exports[_0x581d('0x4')]=function(_0x477e28,_0x553617){return client['Request'](_0x581d('0x5'),{'body':_0x553617,'options':{'where':{'uniqueid':_0x477e28},'order':[['id',_0x581d('0x6')]],'limit':0x1},'log':_0x581d('0x5')});}; \ No newline at end of file +var _0xb647=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x50b9be,_0x118120){var _0x5e7235=function(_0x12d730){while(--_0x12d730){_0x50b9be['push'](_0x50b9be['shift']());}};_0x5e7235(++_0x118120);}(_0xb647,0xdb));var _0x7b64=function(_0x36993,_0x332df5){_0x36993=_0x36993-0x0;var _0x5962e2=_0xb647[_0x36993];return _0x5962e2;};'use strict';var client=require(_0x7b64('0x0'));exports[_0x7b64('0x1')]=function(_0x3cf0d4){return client[_0x7b64('0x2')](_0x7b64('0x3'),{'body':_0x3cf0d4,'log':_0x7b64('0x3')});};exports[_0x7b64('0x4')]=function(_0x2b0ff5,_0x54eee8){return client[_0x7b64('0x2')]('UpdateChatQueueReport',{'body':_0x54eee8,'options':{'where':{'uniqueid':_0x2b0ff5},'order':[['id',_0x7b64('0x5')]],'limit':0x1},'log':_0x7b64('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index d46963f..ca01d71 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(_0x5202f9,_0x300a19){var _0x136d7e=function(_0x5bb26c){while(--_0x5bb26c){_0x5202f9['push'](_0x5202f9['shift']());}};_0x136d7e(++_0x300a19);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x307e6e,_0x3ba068){var _0x38c6e9=function(_0x30431d){while(--_0x30431d){_0x307e6e['push'](_0x307e6e['shift']());}};_0x38c6e9(++_0x3ba068);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 219402e..5133000 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 _0x9ce8=['create','Request','createFaxMessage'];(function(_0x9e50f0,_0x3a4f8f){var _0x964658=function(_0x1f6606){while(--_0x1f6606){_0x9e50f0['push'](_0x9e50f0['shift']());}};_0x964658(++_0x3a4f8f);}(_0x9ce8,0x1bc));var _0x89ce=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x9ce8[_0x158f01];return _0x5ef74e;};'use strict';var client=require('../client');exports[_0x89ce('0x0')]=function(_0x1adee7){return client[_0x89ce('0x1')]('CreateFaxMessage',{'body':_0x1adee7,'log':_0x89ce('0x2')});}; \ No newline at end of file +var _0x2cac=['CreateFaxMessage','createFaxMessage'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2cac,0x1c4));var _0xc2ca=function(_0x5be52f,_0x24a872){_0x5be52f=_0x5be52f-0x0;var _0x529c08=_0x2cac[_0x5be52f];return _0x529c08;};'use strict';var client=require('../client');exports['create']=function(_0x22990c){return client['Request'](_0xc2ca('0x0'),{'body':_0x22990c,'log':_0xc2ca('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 967d835..0d76bc5 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 _0xed2f=['timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x2375e1,_0x3d125a){var _0x2ccc7d=function(_0x343bb6){while(--_0x343bb6){_0x2375e1['push'](_0x2375e1['shift']());}};_0x2ccc7d(++_0x3d125a);}(_0xed2f,0x13a));var _0xfed2=function(_0x2d1ce5,_0x548c52){_0x2d1ce5=_0x2d1ce5-0x0;var _0x1b1d16=_0xed2f[_0x2d1ce5];return _0x1b1d16;};'use strict';var client=require(_0xfed2('0x0'));exports[_0xfed2('0x1')]=function(){return function(){return client[_0xfed2('0x2')](_0xfed2('0x3'),{'options':{'raw':![],'attributes':['id',_0xfed2('0x4'),_0xfed2('0x5'),_0xfed2('0x6')],'include':[{'model':_0xfed2('0x7'),'as':_0xfed2('0x8'),'attributes':['id',_0xfed2('0x4'),_0xfed2('0x9'),_0xfed2('0xa')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xbe9a=['getFaxQueues','name','timeout','User','Agents','online','faxPause'];(function(_0x5f4f5a,_0x533b54){var _0x543793=function(_0x55beca){while(--_0x55beca){_0x5f4f5a['push'](_0x5f4f5a['shift']());}};_0x543793(++_0x533b54);}(_0xbe9a,0x120));var _0xabe9=function(_0x5ef776,_0x3ca725){_0x5ef776=_0x5ef776-0x0;var _0x3b3769=_0xbe9a[_0x5ef776];return _0x3b3769;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xabe9('0x0'),_0xabe9('0x1'),'strategy'],'include':[{'model':_0xabe9('0x2'),'as':_0xabe9('0x3'),'attributes':['id',_0xabe9('0x0'),_0xabe9('0x4'),_0xabe9('0x5')]}]},'log':_0xabe9('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index dec80cf..b9c972a 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 _0x7ea9=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x1bf051,_0x12b969){var _0x424a7a=function(_0x2563fe){while(--_0x2563fe){_0x1bf051['push'](_0x1bf051['shift']());}};_0x424a7a(++_0x12b969);}(_0x7ea9,0xef));var _0x97ea=function(_0x12ad09,_0x1504ba){_0x12ad09=_0x12ad09-0x0;var _0x19f28e=_0x7ea9[_0x12ad09];return _0x19f28e;};'use strict';var client=require(_0x97ea('0x0'));exports[_0x97ea('0x1')]=function(_0x5ff9a2){return client[_0x97ea('0x2')](_0x97ea('0x3'),{'body':_0x5ff9a2,'log':_0x97ea('0x3')});};exports[_0x97ea('0x4')]=function(_0x13e32e,_0x4d9de2){return client[_0x97ea('0x2')]('UpdateFaxQueueReport',{'body':_0x4d9de2,'options':{'where':{'uniqueid':_0x13e32e},'order':[['id',_0x97ea('0x5')]],'limit':0x1},'log':_0x97ea('0x6')});}; \ No newline at end of file +var _0x5996=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x4ad072,_0x2582f1){var _0x4f7ae5=function(_0x5abb9e){while(--_0x5abb9e){_0x4ad072['push'](_0x4ad072['shift']());}};_0x4f7ae5(++_0x2582f1);}(_0x5996,0x133));var _0x6599=function(_0x2e522d,_0x360fed){_0x2e522d=_0x2e522d-0x0;var _0x1172e1=_0x5996[_0x2e522d];return _0x1172e1;};'use strict';var client=require(_0x6599('0x0'));exports[_0x6599('0x1')]=function(_0x9e36d7){return client[_0x6599('0x2')]('CreateFaxQueueReport',{'body':_0x9e36d7,'log':_0x6599('0x3')});};exports['update']=function(_0x451353,_0x2ce1a9){return client[_0x6599('0x2')](_0x6599('0x4'),{'body':_0x2ce1a9,'options':{'where':{'uniqueid':_0x451353},'order':[['id',_0x6599('0x5')]],'limit':0x1},'log':_0x6599('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2ba9571..acf40ed 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 _0x80f7=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x80f7,0x8d));var _0x780f=function(_0x35d06e,_0x2e3503){_0x35d06e=_0x35d06e-0x0;var _0x9e9053=_0x80f7[_0x35d06e];return _0x9e9053;};'use strict';var client=require(_0x780f('0x0'));exports[_0x780f('0x1')]=function(){return function(){return client[_0x780f('0x2')](_0x780f('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x780f('0x4')],'include':[{'model':_0x780f('0x5'),'as':_0x780f('0x6'),'attributes':['id',_0x780f('0x4'),_0x780f('0x7')]}]},'log':_0x780f('0x1')});};}; \ No newline at end of file +var _0x4119=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x4c536f,_0x235773){var _0x378fb7=function(_0xf7873a){while(--_0xf7873a){_0x4c536f['push'](_0x4c536f['shift']());}};_0x378fb7(++_0x235773);}(_0x4119,0x10d));var _0x9411=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x4119[_0x8de54f];return _0x14cba4;};'use strict';var client=require(_0x9411('0x0'));exports[_0x9411('0x1')]=function(){return function(){return client[_0x9411('0x2')](_0x9411('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9411('0x4')],'include':[{'model':_0x9411('0x5'),'as':_0x9411('0x6'),'attributes':['id','name',_0x9411('0x7')]}]},'log':_0x9411('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f7bce18..bcb4d32 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 _0xda2d=['UpdateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request'];(function(_0x5cca6e,_0x5282cc){var _0x1a6c2c=function(_0x4e3669){while(--_0x4e3669){_0x5cca6e['push'](_0x5cca6e['shift']());}};_0x1a6c2c(++_0x5282cc);}(_0xda2d,0x102));var _0xdda2=function(_0x1e9edb,_0x25ad79){_0x1e9edb=_0x1e9edb-0x0;var _0xa987d9=_0xda2d[_0x1e9edb];return _0xa987d9;};'use strict';var client=require('../client');exports[_0xdda2('0x0')]=function(_0x35f029,_0xd495d2){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'body':_0xd495d2,'options':{'where':{'id':_0x35f029}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x5a5f9f,_0x357e97){return client[_0xdda2('0x1')](_0xdda2('0x3'),{'body':_0x357e97,'options':{'where':{'id':_0x5a5f9f}},'log':_0xdda2('0x4')});}; \ No newline at end of file +var _0x28f2=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x19cedb,_0x35c5ae){var _0x4a51b9=function(_0x20464a){while(--_0x20464a){_0x19cedb['push'](_0x19cedb['shift']());}};_0x4a51b9(++_0x35c5ae);}(_0x28f2,0x193));var _0x228f=function(_0x480a4d,_0x5cf1aa){_0x480a4d=_0x480a4d-0x0;var _0x511ade=_0x28f2[_0x480a4d];return _0x511ade;};'use strict';var client=require(_0x228f('0x0'));exports[_0x228f('0x1')]=function(_0x108337,_0x2e5e0b){return client[_0x228f('0x2')]('UpdateMailInteraction',{'body':_0x2e5e0b,'options':{'where':{'id':_0x108337}},'log':_0x228f('0x3')});};exports[_0x228f('0x4')]=function(_0x79ed5f,_0x4303c3){return client[_0x228f('0x2')](_0x228f('0x5'),{'body':_0x4303c3,'options':{'where':{'id':_0x79ed5f}},'log':_0x228f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f0d75db..5e3d443 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 _0xf6fa=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x33b00c,_0x147745){var _0x5697dc=function(_0x45abc0){while(--_0x45abc0){_0x33b00c['push'](_0x33b00c['shift']());}};_0x5697dc(++_0x147745);}(_0xf6fa,0x1a5));var _0xaf6f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf6fa[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0xaf6f('0x0'));exports['create']=function(_0x4ed77e){return client[_0xaf6f('0x1')](_0xaf6f('0x2'),{'body':_0x4ed77e,'log':_0xaf6f('0x3')});}; \ No newline at end of file +var _0x2d20=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x110ceb,_0x11e017){var _0x490863=function(_0x1c926e){while(--_0x1c926e){_0x110ceb['push'](_0x110ceb['shift']());}};_0x490863(++_0x11e017);}(_0x2d20,0x80));var _0x02d2=function(_0x5431d6,_0x5862e9){_0x5431d6=_0x5431d6-0x0;var _0x36b764=_0x2d20[_0x5431d6];return _0x36b764;};'use strict';var client=require(_0x02d2('0x0'));exports[_0x02d2('0x1')]=function(_0x298a56){return client[_0x02d2('0x2')](_0x02d2('0x3'),{'body':_0x298a56,'log':_0x02d2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ed13fac..ac2475a 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 _0x3a9b=['timeout','strategy','User','mailPause','getMailQueues','../client','GetMailQueue','name'];(function(_0x4a96e5,_0x2379a8){var _0x1e2db4=function(_0x5e9b08){while(--_0x5e9b08){_0x4a96e5['push'](_0x4a96e5['shift']());}};_0x1e2db4(++_0x2379a8);}(_0x3a9b,0x10d));var _0xb3a9=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x3a9b[_0x29d915];return _0x160f86;};'use strict';var client=require(_0xb3a9('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0xb3a9('0x1'),{'options':{'raw':![],'attributes':['id',_0xb3a9('0x2'),_0xb3a9('0x3'),_0xb3a9('0x4')],'include':[{'model':_0xb3a9('0x5'),'as':'Agents','attributes':['id',_0xb3a9('0x2'),'online',_0xb3a9('0x6')]}]},'log':_0xb3a9('0x7')});};}; \ No newline at end of file +var _0x1b89=['getMailQueues','GetMailQueue','name','timeout','User','online','mailPause','../client'];(function(_0x48104c,_0x8157b8){var _0x327f9c=function(_0x428ed2){while(--_0x428ed2){_0x48104c['push'](_0x48104c['shift']());}};_0x327f9c(++_0x8157b8);}(_0x1b89,0x187));var _0x91b8=function(_0x457b8b,_0x2c5625){_0x457b8b=_0x457b8b-0x0;var _0x14d82b=_0x1b89[_0x457b8b];return _0x14d82b;};'use strict';var client=require(_0x91b8('0x0'));exports[_0x91b8('0x1')]=function(){return function(){return client['Request'](_0x91b8('0x2'),{'options':{'raw':![],'attributes':['id',_0x91b8('0x3'),_0x91b8('0x4'),'strategy'],'include':[{'model':_0x91b8('0x5'),'as':'Agents','attributes':['id',_0x91b8('0x3'),_0x91b8('0x6'),_0x91b8('0x7')]}]},'log':_0x91b8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 29f07a4..205d5e0 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 _0xc00e=['DESC','../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x4bcb3f,_0x45fbab){var _0x9293fc=function(_0x494874){while(--_0x494874){_0x4bcb3f['push'](_0x4bcb3f['shift']());}};_0x9293fc(++_0x45fbab);}(_0xc00e,0x187));var _0xec00=function(_0x19b583,_0x24c475){_0x19b583=_0x19b583-0x0;var _0x38f2f7=_0xc00e[_0x19b583];return _0x38f2f7;};'use strict';var client=require(_0xec00('0x0'));exports['create']=function(_0x3f49e7){return client[_0xec00('0x1')](_0xec00('0x2'),{'body':_0x3f49e7,'log':'CreateMailQueueReport'});};exports[_0xec00('0x3')]=function(_0x12a4df,_0x281700){return client[_0xec00('0x1')](_0xec00('0x4'),{'body':_0x281700,'options':{'where':{'uniqueid':_0x12a4df},'order':[['id',_0xec00('0x5')]],'limit':0x1},'log':_0xec00('0x4')});}; \ No newline at end of file +var _0x90fa=['CreateMailQueueReport','update','Request','DESC','UpdateMailQueueReport','../client','create'];(function(_0x1ba786,_0x4c332e){var _0x112979=function(_0x274bee){while(--_0x274bee){_0x1ba786['push'](_0x1ba786['shift']());}};_0x112979(++_0x4c332e);}(_0x90fa,0x16a));var _0xa90f=function(_0x5c3047,_0x163f1d){_0x5c3047=_0x5c3047-0x0;var _0x3d010a=_0x90fa[_0x5c3047];return _0x3d010a;};'use strict';var client=require(_0xa90f('0x0'));exports[_0xa90f('0x1')]=function(_0x6e5141){return client['Request'](_0xa90f('0x2'),{'body':_0x6e5141,'log':_0xa90f('0x2')});};exports[_0xa90f('0x3')]=function(_0x4456ec,_0x54cc50){return client[_0xa90f('0x4')]('UpdateMailQueueReport',{'body':_0x54cc50,'options':{'where':{'uniqueid':_0x4456ec},'order':[['id',_0xa90f('0x5')]],'limit':0x1},'log':_0xa90f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 5103f36..20a8cbd 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 _0xa028=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request'];(function(_0x555491,_0x6d2949){var _0x35f65f=function(_0xa18694){while(--_0xa18694){_0x555491['push'](_0x555491['shift']());}};_0x35f65f(++_0x6d2949);}(_0xa028,0xf9));var _0x8a02=function(_0x34d37e,_0x18f3c1){_0x34d37e=_0x34d37e-0x0;var _0x27b91c=_0xa028[_0x34d37e];return _0x27b91c;};'use strict';var client=require(_0x8a02('0x0'));exports[_0x8a02('0x1')]=function(_0x4b837f,_0xb90257){return client[_0x8a02('0x2')](_0x8a02('0x3'),{'body':_0xb90257,'options':{'where':{'id':_0x4b837f}},'log':_0x8a02('0x4')});};exports[_0x8a02('0x5')]=function(_0x2c93dd,_0x348701){return client[_0x8a02('0x2')](_0x8a02('0x6'),{'body':_0x348701,'options':{'where':{'id':_0x2c93dd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4fdf=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x24cf7f,_0xcda231){var _0x4c6742=function(_0x2469db){while(--_0x2469db){_0x24cf7f['push'](_0x24cf7f['shift']());}};_0x4c6742(++_0xcda231);}(_0x4fdf,0x96));var _0xf4fd=function(_0x2e0921,_0x45ef06){_0x2e0921=_0x2e0921-0x0;var _0x44bc33=_0x4fdf[_0x2e0921];return _0x44bc33;};'use strict';var client=require(_0xf4fd('0x0'));exports[_0xf4fd('0x1')]=function(_0x51029d,_0x448023){return client[_0xf4fd('0x2')](_0xf4fd('0x3'),{'body':_0x448023,'options':{'where':{'id':_0x51029d}},'log':_0xf4fd('0x4')});};exports[_0xf4fd('0x5')]=function(_0x578884,_0x5716a9){return client['Request'](_0xf4fd('0x6'),{'body':_0x5716a9,'options':{'where':{'id':_0x578884}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 75b4333..2d4feb1 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 _0xedec=['create','Request','createOpenchannelMessage','../client'];(function(_0x540d58,_0x55d976){var _0x2c618c=function(_0x26eb2c){while(--_0x26eb2c){_0x540d58['push'](_0x540d58['shift']());}};_0x2c618c(++_0x55d976);}(_0xedec,0x18b));var _0xcede=function(_0x76ced3,_0x8abc01){_0x76ced3=_0x76ced3-0x0;var _0x4fea70=_0xedec[_0x76ced3];return _0x4fea70;};'use strict';var client=require(_0xcede('0x0'));exports[_0xcede('0x1')]=function(_0x103fe3){return client[_0xcede('0x2')]('CreateOpenchannelMessage',{'body':_0x103fe3,'log':_0xcede('0x3')});}; \ No newline at end of file +var _0xc200=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x4c8b69,_0x24afaf){var _0x458f9f=function(_0x1e8479){while(--_0x1e8479){_0x4c8b69['push'](_0x4c8b69['shift']());}};_0x458f9f(++_0x24afaf);}(_0xc200,0x163));var _0x0c20=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc200[_0x3ab9ee];return _0x82ee88;};'use strict';var client=require(_0x0c20('0x0'));exports['create']=function(_0x424fc1){return client[_0x0c20('0x1')](_0x0c20('0x2'),{'body':_0x424fc1,'log':_0x0c20('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5ebb396..982c179 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 _0x219f=['GetOpenchannelQueue','name','timeout','strategy','Agents','online','../client','getOpenchannelQueues','Request'];(function(_0x261497,_0x5977f7){var _0x1da692=function(_0x239be3){while(--_0x239be3){_0x261497['push'](_0x261497['shift']());}};_0x1da692(++_0x5977f7);}(_0x219f,0xc3));var _0xf219=function(_0x4b612c,_0x8fa416){_0x4b612c=_0x4b612c-0x0;var _0x44953b=_0x219f[_0x4b612c];return _0x44953b;};'use strict';var client=require(_0xf219('0x0'));exports[_0xf219('0x1')]=function(){return function(){return client[_0xf219('0x2')](_0xf219('0x3'),{'options':{'raw':![],'attributes':['id',_0xf219('0x4'),_0xf219('0x5'),_0xf219('0x6')],'include':[{'model':'User','as':_0xf219('0x7'),'attributes':['id',_0xf219('0x4'),_0xf219('0x8'),'openchannelPause']}]},'log':_0xf219('0x1')});};}; \ No newline at end of file +var _0xd86f=['strategy','User','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0xd86f,0xf6));var _0xfd86=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd86f[_0x1928c9];return _0x51b5fb;};'use strict';var client=require(_0xfd86('0x0'));exports[_0xfd86('0x1')]=function(){return function(){return client[_0xfd86('0x2')](_0xfd86('0x3'),{'options':{'raw':![],'attributes':['id',_0xfd86('0x4'),_0xfd86('0x5'),_0xfd86('0x6')],'include':[{'model':_0xfd86('0x7'),'as':'Agents','attributes':['id','name','online',_0xfd86('0x8')]}]},'log':_0xfd86('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ca31335..c4c45fc 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 _0x073c=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create','Request'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x073c,0x118));var _0xc073=function(_0x2538e6,_0x273863){_0x2538e6=_0x2538e6-0x0;var _0x9e91e7=_0x073c[_0x2538e6];return _0x9e91e7;};'use strict';var client=require('../client');exports[_0xc073('0x0')]=function(_0x2e4394){return client[_0xc073('0x1')](_0xc073('0x2'),{'body':_0x2e4394,'log':_0xc073('0x2')});};exports[_0xc073('0x3')]=function(_0x59250c,_0xed9735){return client['Request'](_0xc073('0x4'),{'body':_0xed9735,'options':{'where':{'uniqueid':_0x59250c},'order':[['id',_0xc073('0x5')]],'limit':0x1},'log':_0xc073('0x4')});}; \ No newline at end of file +var _0xb16f=['Request','../client','create','CreateOpenchannelQueueReport','update'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0xb16f,0xf6));var _0xfb16=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0xb16f[_0x5401ae];return _0x286068;};'use strict';var client=require(_0xfb16('0x0'));exports[_0xfb16('0x1')]=function(_0x3c5723){return client['Request'](_0xfb16('0x2'),{'body':_0x3c5723,'log':_0xfb16('0x2')});};exports[_0xfb16('0x3')]=function(_0x262e26,_0x5caa17){return client[_0xfb16('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x5caa17,'options':{'where':{'uniqueid':_0x262e26},'order':[['id','DESC']],'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 9d03761..a11fac3 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 _0xe548=['../client','update','Request','addTagsToSmsInteraction'];(function(_0x459349,_0x2e6797){var _0x35de00=function(_0x1f5a19){while(--_0x1f5a19){_0x459349['push'](_0x459349['shift']());}};_0x35de00(++_0x2e6797);}(_0xe548,0x184));var _0x8e54=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0xe548[_0x148879];return _0x4f7027;};'use strict';var client=require(_0x8e54('0x0'));exports[_0x8e54('0x1')]=function(_0x294af0,_0x2b10bd){return client[_0x8e54('0x2')]('UpdateSmsInteraction',{'body':_0x2b10bd,'options':{'where':{'id':_0x294af0}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x4aa36a,_0x4b69ef){return client[_0x8e54('0x2')]('AddTagsToSmsInteraction',{'body':_0x4b69ef,'options':{'where':{'id':_0x4aa36a}},'log':_0x8e54('0x3')});}; \ No newline at end of file +var _0xf021=['update','Request','updateSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x3ab0f6,_0x12dcbe){var _0x214e55=function(_0x4cd2dd){while(--_0x4cd2dd){_0x3ab0f6['push'](_0x3ab0f6['shift']());}};_0x214e55(++_0x12dcbe);}(_0xf021,0x18f));var _0x1f02=function(_0x1f97e8,_0x445a4a){_0x1f97e8=_0x1f97e8-0x0;var _0x1ed77c=_0xf021[_0x1f97e8];return _0x1ed77c;};'use strict';var client=require(_0x1f02('0x0'));exports[_0x1f02('0x1')]=function(_0x20e504,_0x46d604){return client[_0x1f02('0x2')]('UpdateSmsInteraction',{'body':_0x46d604,'options':{'where':{'id':_0x20e504}},'log':_0x1f02('0x3')});};exports['addTags']=function(_0x2e8594,_0x3164f0){return client['Request']('AddTagsToSmsInteraction',{'body':_0x3164f0,'options':{'where':{'id':_0x2e8594}},'log':_0x1f02('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2d17883..311cb47 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 _0x8d6c=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x1d255e,_0x110095){var _0xc012ce=function(_0x24b26d){while(--_0x24b26d){_0x1d255e['push'](_0x1d255e['shift']());}};_0xc012ce(++_0x110095);}(_0x8d6c,0x16e));var _0xc8d6=function(_0x395e18,_0x277448){_0x395e18=_0x395e18-0x0;var _0x22d205=_0x8d6c[_0x395e18];return _0x22d205;};'use strict';var client=require(_0xc8d6('0x0'));exports[_0xc8d6('0x1')]=function(_0x518d8b){return client['Request'](_0xc8d6('0x2'),{'body':_0x518d8b,'log':_0xc8d6('0x3')});}; \ No newline at end of file +var _0x9efa=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x2a3e74,_0x33f889){var _0xa054b=function(_0x152b89){while(--_0x152b89){_0x2a3e74['push'](_0x2a3e74['shift']());}};_0xa054b(++_0x33f889);}(_0x9efa,0x15a));var _0xa9ef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9efa[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xa9ef('0x0'));exports[_0xa9ef('0x1')]=function(_0x131450){return client[_0xa9ef('0x2')](_0xa9ef('0x3'),{'body':_0x131450,'log':_0xa9ef('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 534f2c2..3aa9adc 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_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 +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x315a95,_0x580ecd){var _0x2e485e=function(_0x2c5758){while(--_0x2c5758){_0x315a95['push'](_0x315a95['shift']());}};_0x2e485e(++_0x580ecd);}(_0x70e0,0x17b));var _0x070e=function(_0x1c389d,_0x37ce5f){_0x1c389d=_0x1c389d-0x0;var _0x4a6199=_0x70e0[_0x1c389d];return _0x4a6199;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 979534d..be7bff2 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(_0x1f16bb,_0x1b27a9){var _0x14e6e4=function(_0x23d2e3){while(--_0x23d2e3){_0x1f16bb['push'](_0x1f16bb['shift']());}};_0x14e6e4(++_0x1b27a9);}(_0x70e0,0x17b));var _0x070e=function(_0x47ea7e,_0x5f427d){_0x47ea7e=_0x47ea7e-0x0;var _0x518f7e=_0x70e0[_0x47ea7e];return _0x518f7e;};'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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5639e1,_0x421603){var _0x197e82=function(_0x150da4){while(--_0x150da4){_0x5639e1['push'](_0x5639e1['shift']());}};_0x197e82(++_0x421603);}(_0x008c,0x188));var _0xc008=function(_0x22942f,_0x56e2ae){_0x22942f=_0x22942f-0x0;var _0x17dde5=_0x008c[_0x22942f];return _0x17dde5;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index d0cdc74..b594496 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(_0x3575b0,_0x150d4f){var _0x2f6998=function(_0xb70e09){while(--_0xb70e09){_0x3575b0['push'](_0x3575b0['shift']());}};_0x2f6998(++_0x150d4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x54eca8,_0x253c1e){var _0x387211=function(_0x1341a0){while(--_0x1341a0){_0x54eca8['push'](_0x54eca8['shift']());}};_0x387211(++_0x253c1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 42c6154..67b3b6d 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 _0x6455=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x43b621,_0x75352f){var _0x1427d2=function(_0x4fd30c){while(--_0x4fd30c){_0x43b621['push'](_0x43b621['shift']());}};_0x1427d2(++_0x75352f);}(_0x6455,0x97));var _0x5645=function(_0x12ba02,_0x5efe9c){_0x12ba02=_0x12ba02-0x0;var _0xb05b13=_0x6455[_0x12ba02];return _0xb05b13;};'use strict';var client=require(_0x5645('0x0'));exports['update']=function(_0x6b9a7e,_0x2294f5){return client[_0x5645('0x1')](_0x5645('0x2'),{'body':_0x2294f5,'options':{'where':{'id':_0x6b9a7e}},'log':_0x5645('0x3')});};exports[_0x5645('0x4')]=function(_0x5388ff,_0x233875){return client[_0x5645('0x1')](_0x5645('0x5'),{'body':_0x233875,'options':{'where':{'id':_0x5388ff}},'log':_0x5645('0x6')});}; \ No newline at end of file +var _0x0618=['Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x51c1cc,_0x3a0cfd){var _0x2625fa=function(_0x3f6fed){while(--_0x3f6fed){_0x51c1cc['push'](_0x51c1cc['shift']());}};_0x2625fa(++_0x3a0cfd);}(_0x0618,0x1c6));var _0x8061=function(_0xbbe43e,_0x2b1e42){_0xbbe43e=_0xbbe43e-0x0;var _0x5a3377=_0x0618[_0xbbe43e];return _0x5a3377;};'use strict';var client=require(_0x8061('0x0'));exports[_0x8061('0x1')]=function(_0x4e65f1,_0x973865){return client[_0x8061('0x2')]('UpdateWhatsappInteraction',{'body':_0x973865,'options':{'where':{'id':_0x4e65f1}},'log':'updateWhatsappInteraction'});};exports[_0x8061('0x3')]=function(_0x6aff35,_0x382b13){return client[_0x8061('0x2')](_0x8061('0x4'),{'body':_0x382b13,'options':{'where':{'id':_0x6aff35}},'log':_0x8061('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index bc9fdc2..2f6cee6 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 _0x4d5e=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x390dad,_0x3a3e5a){var _0x490148=function(_0x4a2c87){while(--_0x4a2c87){_0x390dad['push'](_0x390dad['shift']());}};_0x490148(++_0x3a3e5a);}(_0x4d5e,0x197));var _0xe4d5=function(_0x5d2ba8,_0x1b1791){_0x5d2ba8=_0x5d2ba8-0x0;var _0x1932d2=_0x4d5e[_0x5d2ba8];return _0x1932d2;};'use strict';var client=require('../client');exports[_0xe4d5('0x0')]=function(_0x337a70){return client['Request'](_0xe4d5('0x1'),{'body':_0x337a70,'log':_0xe4d5('0x2')});}; \ No newline at end of file +var _0xa6a7=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0xa6a7,0x112));var _0x7a6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa6a7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7a6a('0x0'));exports[_0x7a6a('0x1')]=function(_0x516ada){return client[_0x7a6a('0x2')](_0x7a6a('0x3'),{'body':_0x516ada,'log':_0x7a6a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b186764..7079296 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 _0x13fd=['name','timeout','strategy','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x1f77d4,_0x23b7a4){var _0x167453=function(_0x43d38b){while(--_0x43d38b){_0x1f77d4['push'](_0x1f77d4['shift']());}};_0x167453(++_0x23b7a4);}(_0x13fd,0x11c));var _0xd13f=function(_0x1ed017,_0x28c947){_0x1ed017=_0x1ed017-0x0;var _0x5d3fe2=_0x13fd[_0x1ed017];return _0x5d3fe2;};'use strict';var client=require(_0xd13f('0x0'));exports[_0xd13f('0x1')]=function(){return function(){return client[_0xd13f('0x2')](_0xd13f('0x3'),{'options':{'raw':![],'attributes':['id',_0xd13f('0x4'),_0xd13f('0x5'),_0xd13f('0x6')],'include':[{'model':'User','as':_0xd13f('0x7'),'attributes':['id',_0xd13f('0x4'),_0xd13f('0x8'),'whatsappPause']}]},'log':_0xd13f('0x1')});};}; \ No newline at end of file +var _0xa337=['User','Agents','whatsappPause','getWhatsappQueues','Request','name','timeout','strategy'];(function(_0x281ba7,_0x30e002){var _0x2501ce=function(_0x41575a){while(--_0x41575a){_0x281ba7['push'](_0x281ba7['shift']());}};_0x2501ce(++_0x30e002);}(_0xa337,0x1bb));var _0x7a33=function(_0xb29867,_0x5aa119){_0xb29867=_0xb29867-0x0;var _0x1dded0=_0xa337[_0xb29867];return _0x1dded0;};'use strict';var client=require('../client');exports[_0x7a33('0x0')]=function(){return function(){return client[_0x7a33('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x7a33('0x2'),_0x7a33('0x3'),_0x7a33('0x4')],'include':[{'model':_0x7a33('0x5'),'as':_0x7a33('0x6'),'attributes':['id',_0x7a33('0x2'),'online',_0x7a33('0x7')]}]},'log':_0x7a33('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index d04e353..a21e576 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 _0x0367=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x188cb8,_0x3b12b3){var _0x25eb9b=function(_0x11770b){while(--_0x11770b){_0x188cb8['push'](_0x188cb8['shift']());}};_0x25eb9b(++_0x3b12b3);}(_0x0367,0x9a));var _0x7036=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0367[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x7036('0x0'));exports[_0x7036('0x1')]=function(_0x96d7f1){return client[_0x7036('0x2')](_0x7036('0x3'),{'body':_0x96d7f1,'log':'CreateWhatsappQueueReport'});};exports[_0x7036('0x4')]=function(_0x545efe,_0x190a51){return client[_0x7036('0x2')](_0x7036('0x5'),{'body':_0x190a51,'options':{'where':{'uniqueid':_0x545efe},'order':[['id',_0x7036('0x6')]],'limit':0x1},'log':_0x7036('0x5')});}; \ No newline at end of file +var _0xb5ba=['UpdateWhatsappQueueReport','../client','CreateWhatsappQueueReport','update','Request'];(function(_0x1203b3,_0x1168dc){var _0x59bafa=function(_0xb97023){while(--_0xb97023){_0x1203b3['push'](_0x1203b3['shift']());}};_0x59bafa(++_0x1168dc);}(_0xb5ba,0x173));var _0xab5b=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xb5ba[_0x525af9];return _0x129fbf;};'use strict';var client=require(_0xab5b('0x0'));exports['create']=function(_0xed7202){return client['Request'](_0xab5b('0x1'),{'body':_0xed7202,'log':_0xab5b('0x1')});};exports[_0xab5b('0x2')]=function(_0x3fbe6d,_0x3cde89){return client[_0xab5b('0x3')]('UpdateWhatsappQueueReport',{'body':_0x3cde89,'options':{'where':{'uniqueid':_0x3fbe6d},'order':[['id','DESC']],'limit':0x1},'log':_0xab5b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 2ffaf15..a261d46 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 _0x6df2=['message','join','stop','find','agents','createQueue','atimeout','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','info','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','map'];(function(_0x27c28c,_0x49ba23){var _0x1f5669=function(_0x257683){while(--_0x257683){_0x27c28c['push'](_0x27c28c['shift']());}};_0x1f5669(++_0x49ba23);}(_0x6df2,0x1b6));var _0x26df=function(_0x182f76,_0x325311){_0x182f76=_0x182f76-0x0;var _0x4d0b12=_0x6df2[_0x182f76];return _0x4d0b12;};'use strict';var schema=require(_0x26df('0x0'));var _=require(_0x26df('0x1'));var util=require(_0x26df('0x2'));var seqqueue=require(_0x26df('0x3'));var logger=require(_0x26df('0x4'))(_0x26df('0x5'));var strategy=require(_0x26df('0x6'));var queue=schema({'name':{'type':_0x26df('0x7'),'required':!![],'message':_0x26df('0x8')},'timeout':{'type':_0x26df('0x9'),'message':_0x26df('0xa')}});function writeLog(_0x1fe91a,_0x274d4f,_0x59e9b2){return logger['info'](util[_0x26df('0xb')](_0x26df('0xc'),_0x1fe91a,_0x274d4f[_0x26df('0xd')],_0x59e9b2));}function handleFindAgent(_0x220df7){return function(_0x6e7c40){return _0x6e7c40[_0x26df('0xd')][_0x26df('0xe')]()===_0x220df7['toLowerCase']();};}exports[_0x26df('0xf')]=function(_0x3900af,_0x50eb2b,_0x30f42b,_0x3a4c84){return function(_0x5f08ff){try{var _0x1acb07={'name':_0x50eb2b[0x0],'timeout':_0x50eb2b[0x1]};var _0x42dfe8=queue[_0x26df('0x0')](_0x1acb07,{'typecast':!![]});if(_0x42dfe8['length']){logger[_0x26df('0x10')]('[%s][AGENT]\x20%s',_0x3900af,_[_0x26df('0x11')](_0x42dfe8,_0x26df('0x12'))[_0x26df('0x13')](',\x20'));_0x5f08ff[_0x26df('0x14')]();}else{var _0x1ac58a=_[_0x26df('0x15')](_0x30f42b[_0x26df('0x16')],handleFindAgent(_0x1acb07[_0x26df('0xd')]));if(_0x1ac58a){var _0x1cbef0=(_0x1acb07['timeout']||0xa)*0x3e8;var _0x1404de,_0x5afd5e;var _0x1ab3ec=seqqueue[_0x26df('0x17')](_0x1cbef0);_0x1ab3ec['id']=_0x3900af;_0x1ab3ec[_0x26df('0x18')]=_0x1cbef0;_0x1ab3ec['channel']=_0x3a4c84['channel'];writeLog(_0x3900af,_0x1ac58a,util[_0x26df('0xb')](_0x26df('0x19'),_0x1cbef0));_0x30f42b[_0x26df('0x1a')][_0x3900af]['on'](_0x26df('0x1b'),function(){logger['info'](_0x26df('0x1c'),_0x3900af);clearTimeout(_0x5afd5e);_0x5afd5e=undefined;_0x1ab3ec['close']();if(_0x30f42b[_0x26df('0x1a')][_0x3900af]){delete _0x30f42b[_0x26df('0x1a')][_0x3900af];}_0x5f08ff[_0x26df('0x14')]();});_0x30f42b[_0x26df('0x1a')][_0x3900af]['on'](_0x26df('0x1d'),function(){if(_0x30f42b['rules'][_0x3900af]){delete _0x30f42b[_0x26df('0x1a')][_0x3900af];}});_0x5afd5e=setTimeout(function(){logger[_0x26df('0x1e')]('[%s][AGENT]\x20ROUTING\x20END',_0x3900af);clearTimeout(_0x5afd5e);_0x1ab3ec[_0x26df('0x1f')]();_0x5f08ff[_0x26df('0x20')]();},_0x1cbef0);strategy[_0x26df('0x21')](_0x1ab3ec,_0x1ac58a,_0x30f42b,_0x3a4c84);}else{logger[_0x26df('0x10')](_0x26df('0x22'),_0x3900af,_0x1acb07['name']);_0x5f08ff[_0x26df('0x14')]();}}}catch(_0x427592){console[_0x26df('0x23')](_0x427592);logger[_0x26df('0x10')](_0x26df('0x24'),_0x3900af,_0x427592[_0x26df('0x25')]);_0x5f08ff[_0x26df('0x14')]();}};}; \ No newline at end of file +var _0xb401=['toLowerCase','consequence','length','[%s][AGENT]\x20%s','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','validate','../../../../config/logger','routing','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x3dbe2b,_0x1d3c89){var _0x3f1e44=function(_0x4fba64){while(--_0x4fba64){_0x3dbe2b['push'](_0x3dbe2b['shift']());}};_0x3f1e44(++_0x1d3c89);}(_0xb401,0x1e0));var _0x1b40=function(_0x22ca3d,_0x1447eb){_0x22ca3d=_0x22ca3d-0x0;var _0x2ba60f=_0xb401[_0x22ca3d];return _0x2ba60f;};'use strict';var schema=require(_0x1b40('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x1b40('0x1'))(_0x1b40('0x2'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x1b40('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x1b40('0x4'),'message':_0x1b40('0x5')}});function writeLog(_0x33a114,_0x412442,_0xa9433a){return logger[_0x1b40('0x6')](util[_0x1b40('0x7')](_0x1b40('0x8'),_0x33a114,_0x412442[_0x1b40('0x9')],_0xa9433a));}function handleFindAgent(_0x35fe1e){return function(_0x30c1fe){return _0x30c1fe[_0x1b40('0x9')]['toLowerCase']()===_0x35fe1e[_0x1b40('0xa')]();};}exports[_0x1b40('0xb')]=function(_0x12bf0b,_0x33d8ac,_0x5698f7,_0x35d8f9){return function(_0x3f7011){try{var _0x2c41d9={'name':_0x33d8ac[0x0],'timeout':_0x33d8ac[0x1]};var _0x1ba189=queue[_0x1b40('0x0')](_0x2c41d9,{'typecast':!![]});if(_0x1ba189[_0x1b40('0xc')]){logger['error'](_0x1b40('0xd'),_0x12bf0b,_['map'](_0x1ba189,_0x1b40('0xe'))[_0x1b40('0xf')](',\x20'));_0x3f7011[_0x1b40('0x10')]();}else{var _0x2aacb2=_['find'](_0x5698f7[_0x1b40('0x11')],handleFindAgent(_0x2c41d9[_0x1b40('0x9')]));if(_0x2aacb2){var _0x589b55=(_0x2c41d9[_0x1b40('0x12')]||0xa)*0x3e8;var _0x4f1eb3,_0x2a3a40;var _0x29f637=seqqueue[_0x1b40('0x13')](_0x589b55);_0x29f637['id']=_0x12bf0b;_0x29f637[_0x1b40('0x14')]=_0x589b55;_0x29f637[_0x1b40('0x15')]=_0x35d8f9['channel'];writeLog(_0x12bf0b,_0x2aacb2,util[_0x1b40('0x7')](_0x1b40('0x16'),_0x589b55));_0x5698f7['rules'][_0x12bf0b]['on']('end',function(){logger[_0x1b40('0x6')](_0x1b40('0x17'),_0x12bf0b);clearTimeout(_0x2a3a40);_0x2a3a40=undefined;_0x29f637[_0x1b40('0x18')]();if(_0x5698f7['rules'][_0x12bf0b]){delete _0x5698f7[_0x1b40('0x19')][_0x12bf0b];}_0x3f7011[_0x1b40('0x10')]();});_0x5698f7[_0x1b40('0x19')][_0x12bf0b]['on'](_0x1b40('0x1a'),function(){if(_0x5698f7[_0x1b40('0x19')][_0x12bf0b]){delete _0x5698f7[_0x1b40('0x19')][_0x12bf0b];}});_0x2a3a40=setTimeout(function(){logger['info'](_0x1b40('0x1b'),_0x12bf0b);clearTimeout(_0x2a3a40);_0x29f637[_0x1b40('0x18')]();_0x3f7011[_0x1b40('0x1c')]();},_0x589b55);strategy[_0x1b40('0x1d')](_0x29f637,_0x2aacb2,_0x5698f7,_0x35d8f9);}else{logger['error'](_0x1b40('0x1e'),_0x12bf0b,_0x2c41d9[_0x1b40('0x9')]);_0x3f7011['stop']();}}}catch(_0x4d9ec7){console[_0x1b40('0x1f')](_0x4d9ec7);logger[_0x1b40('0x20')](_0x1b40('0x21'),_0x12bf0b,_0x4d9ec7[_0x1b40('0x22')]);_0x3f7011[_0x1b40('0x10')]();}};}; \ 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 743312d..557c659 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 _0x388d=['sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','body','Message','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','toString','postText','amazonlex','providerResponse','dialogState','catch','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x5258bb,_0x4a5311){var _0x50424d=function(_0x122913){while(--_0x122913){_0x5258bb['push'](_0x5258bb['shift']());}};_0x50424d(++_0x4a5311);}(_0x388d,0xa7));var _0xd388=function(_0x40b777,_0x2760c0){_0x40b777=_0x40b777-0x0;var _0x2b0539=_0x388d[_0x40b777];return _0x2b0539;};'use strict';var _=require(_0xd388('0x0'));var moment=require(_0xd388('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xd388('0x2'))(_0xd388('0x3'));var rpc={'chatMessage':require(_0xd388('0x4')),'openchannelMessage':require(_0xd388('0x5')),'mailMessage':require(_0xd388('0x6')),'smsMessage':require(_0xd388('0x7')),'faxMessage':require(_0xd388('0x8')),'whatsappMessage':require(_0xd388('0x9'))};exports[_0xd388('0xa')]=function(_0x3f9f22,_0x3e7e57){return function(_0x42d3e4){try{if(!_[_0xd388('0xb')](this['interaction'][_0xd388('0xc')])){logger[_0xd388('0xd')](_0xd388('0xe'),_0x3f9f22,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x42d3e4[_0xd388('0xf')]();}var _0x4b3189={'ContactId':this[_0xd388('0x10')]['id'],'sentAt':moment()[_0xd388('0x11')](_0xd388('0x12')),'direction':_0xd388('0x13')};if(this[_0xd388('0x14')]===_0xd388('0x15')||this[_0xd388('0x14')]===_0xd388('0x16')){_0x4b3189[_0xd388('0x17')]=this[_0xd388('0x18')][_0xd388('0x17')];}var _0x2b1da9=this[_0xd388('0x14')];if(_0x2b1da9===_0xd388('0x19')){_0x4b3189[_0xd388('0x1a')]=this[_0xd388('0x1b')]['id'];}else{_0x4b3189[_[_0xd388('0x1c')](_0x2b1da9)+'AccountId']=this[_0xd388('0x1b')]['id'];}_0x4b3189[_[_0xd388('0x1c')](_0x2b1da9)+'InteractionId']=this['interaction']['id'];if(this['interaction']['created']){var _0x46fe67=_0x3e7e57[0x4];if(!_['isEmpty'](_0x46fe67)){_0x4b3189[_0xd388('0x1d')]=utils['getMustacheRender'](_0x46fe67,this);return rpc[_0x2b1da9+_0xd388('0x1e')][_0xd388('0x1f')](_0x4b3189)[_0xd388('0x20')](function(_0x2a6d4e){logger[_0xd388('0xd')](_0xd388('0xe'),_0x3f9f22,_0x4b3189[_0xd388('0x1d')]);})['catch'](function(_0x2b84a9){logger[_0xd388('0x21')](_0xd388('0xe'),_0x3f9f22,JSON[_0xd388('0x22')](_0x2b84a9));})[_0xd388('0x23')](function(){logger[_0xd388('0xd')](_0xd388('0x24'),_0x3f9f22);_0x42d3e4['stop']();});}else{logger[_0xd388('0xd')](_0xd388('0x25'),_0x3f9f22);_0x42d3e4[_0xd388('0x26')]();}}else{var _0x302de5=this;var _0x3841e1=new AWS[(_0xd388('0x27'))]({'accessKeyId':_0x3e7e57[0x0],'secretAccessKey':_0x3e7e57[0x1],'region':_0x3e7e57[0x2]});var _0x1a1d87={'botAlias':'$LATEST','botName':_0x3e7e57[0x3],'inputText':this[_0xd388('0x28')][_0xd388('0x1d')],'userId':this[_0xd388('0x14')]+':'+this[_0xd388('0x18')]['id'][_0xd388('0x29')]()};_0x3841e1[_0xd388('0x2a')](_0x1a1d87,function(_0x5533e4,_0x39b953){if(_0x5533e4){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3f9f22,_0x5533e4[_0xd388('0x28')]);_0x42d3e4[_0xd388('0xf')]();}else if(_0x39b953&&_0x39b953['message']){_0x302de5[_0xd388('0x1d')]['amazonlex']=_0x39b953;_0x4b3189[_0xd388('0x1d')]=_0x39b953[_0xd388('0x28')];_0x4b3189['providerName']=_0xd388('0x2b');_0x4b3189[_0xd388('0x2c')]=JSON[_0xd388('0x22')](_0x39b953);return rpc[_0x2b1da9+_0xd388('0x1e')]['create'](_0x4b3189)[_0xd388('0x20')](function(_0x19682b){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3f9f22,_0x4b3189[_0xd388('0x1d')]);if(_0x39b953[_0xd388('0x2d')]=='Failed'){_0x42d3e4[_0xd388('0xf')]();}else{_0x42d3e4[_0xd388('0x26')]();}})[_0xd388('0x2e')](function(_0x1fd9b4){logger['error'](_0xd388('0xe'),_0x3f9f22,JSON[_0xd388('0x22')](_0x1fd9b4));_0x42d3e4[_0xd388('0xf')]();});}else{_0x42d3e4[_0xd388('0xf')]();}});}}catch(_0x4b957f){logger['error'](_0xd388('0xe'),_0x3f9f22,JSON[_0xd388('0x22')](_0x4b957f));_0x42d3e4[_0xd388('0x26')]();}};}; \ No newline at end of file +var _0x46df=['info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','postText','message','amazonlex','providerResponse','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','isNil','interaction'];(function(_0x431659,_0x142014){var _0xf11fbc=function(_0x58a41d){while(--_0x58a41d){_0x431659['push'](_0x431659['shift']());}};_0xf11fbc(++_0x142014);}(_0x46df,0xfd));var _0xf46d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x46df[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xf46d('0x0'));var moment=require(_0xf46d('0x1'));var AWS=require(_0xf46d('0x2'));var utils=require(_0xf46d('0x3'));var logger=require(_0xf46d('0x4'))(_0xf46d('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf46d('0x6')),'mailMessage':require(_0xf46d('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf46d('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x428a2b,_0x24044f){return function(_0x5acfd9){try{if(!_[_0xf46d('0x9')](this[_0xf46d('0xa')]['UserId'])){logger[_0xf46d('0xb')](_0xf46d('0xc'),_0x428a2b,_0xf46d('0xd'));return _0x5acfd9[_0xf46d('0xe')]();}var _0x63126e={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf46d('0xf')](_0xf46d('0x10')),'direction':_0xf46d('0x11')};if(this[_0xf46d('0x12')]===_0xf46d('0x13')||this[_0xf46d('0x12')]==='whatsapp'){_0x63126e['phone']=this[_0xf46d('0xa')][_0xf46d('0x14')];}var _0x44d97e=this[_0xf46d('0x12')];if(_0x44d97e==='chat'){_0x63126e[_0xf46d('0x15')]=this[_0xf46d('0x16')]['id'];}else{_0x63126e[_[_0xf46d('0x17')](_0x44d97e)+_0xf46d('0x18')]=this[_0xf46d('0x16')]['id'];}_0x63126e[_[_0xf46d('0x17')](_0x44d97e)+_0xf46d('0x19')]=this[_0xf46d('0xa')]['id'];if(this['interaction']['created']){var _0x261b8b=_0x24044f[0x4];if(!_[_0xf46d('0x1a')](_0x261b8b)){_0x63126e[_0xf46d('0x1b')]=utils[_0xf46d('0x1c')](_0x261b8b,this);return rpc[_0x44d97e+_0xf46d('0x1d')][_0xf46d('0x1e')](_0x63126e)['then'](function(_0x38e298){logger['info']('[%s][AMAZONLEX]\x20%s',_0x428a2b,_0x63126e['body']);})['catch'](function(_0x5f321f){logger[_0xf46d('0x1f')](_0xf46d('0xc'),_0x428a2b,JSON[_0xf46d('0x20')](_0x5f321f));})[_0xf46d('0x21')](function(){logger[_0xf46d('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x428a2b);_0x5acfd9[_0xf46d('0x22')]();});}else{logger[_0xf46d('0xb')](_0xf46d('0x23'),_0x428a2b);_0x5acfd9[_0xf46d('0x22')]();}}else{var _0x25ed25=this;var _0x5ba756=new AWS['LexRuntime']({'accessKeyId':_0x24044f[0x0],'secretAccessKey':_0x24044f[0x1],'region':_0x24044f[0x2]});var _0x5d3db5={'botAlias':_0xf46d('0x24'),'botName':_0x24044f[0x3],'inputText':this['message'][_0xf46d('0x1b')],'userId':this['channel']+':'+this[_0xf46d('0xa')]['id']['toString']()};_0x5ba756[_0xf46d('0x25')](_0x5d3db5,function(_0x58215a,_0x42603d){if(_0x58215a){logger['error'](_0xf46d('0xc'),_0x428a2b,_0x58215a[_0xf46d('0x26')]);_0x5acfd9['next']();}else if(_0x42603d&&_0x42603d['message']){_0x25ed25[_0xf46d('0x1b')]['amazonlex']=_0x42603d;_0x63126e['body']=_0x42603d['message'];_0x63126e['providerName']=_0xf46d('0x27');_0x63126e[_0xf46d('0x28')]=JSON['stringify'](_0x42603d);return rpc[_0x44d97e+_0xf46d('0x1d')]['create'](_0x63126e)[_0xf46d('0x29')](function(_0x5c3bb4){logger[_0xf46d('0xb')](_0xf46d('0xc'),_0x428a2b,_0x63126e[_0xf46d('0x1b')]);if(_0x42603d[_0xf46d('0x2a')]==_0xf46d('0x2b')){_0x5acfd9[_0xf46d('0xe')]();}else{_0x5acfd9[_0xf46d('0x22')]();}})['catch'](function(_0x3611a3){logger['error'](_0xf46d('0xc'),_0x428a2b,JSON[_0xf46d('0x20')](_0x3611a3));_0x5acfd9[_0xf46d('0xe')]();});}else{_0x5acfd9['next']();}});}}catch(_0x58caf5){logger['error'](_0xf46d('0xc'),_0x428a2b,JSON[_0xf46d('0x20')](_0x58caf5));_0x5acfd9[_0xf46d('0x22')]();}};}; \ 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 5d9c9e0..dc638b4 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 _0x495c=['next','isNil','interaction','created','info','autoreplyExecuted','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','html','','replace','','headers','auto-replied','All','sendMailMessage','smtpOptions','then','messageId','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x495c,0x147));var _0xc495=function(_0x50be3c,_0x529b7c){_0x50be3c=_0x50be3c-0x0;var _0x337e14=_0x495c[_0x50be3c];return _0x337e14;};'use strict';var _=require(_0xc495('0x0'));var moment=require(_0xc495('0x1'));var utils=require(_0xc495('0x2'));var logger=require('../../../../config/logger')(_0xc495('0x3'));var rpc={'chatMessage':require(_0xc495('0x4')),'openchannelMessage':require(_0xc495('0x5')),'mailMessage':require(_0xc495('0x6')),'smsMessage':require(_0xc495('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc495('0x8')),'chatInteraction':require(_0xc495('0x9')),'openchannelInteraction':require(_0xc495('0xa')),'mailInteraction':require(_0xc495('0xb')),'smsInteraction':require(_0xc495('0xc')),'faxInteraction':require(_0xc495('0xd')),'whatsappInteraction':require(_0xc495('0xe'))};var mailRpc=require(_0xc495('0xf'));exports[_0xc495('0x10')]=function(_0x358fc0,_0x41d9b1,_0x439331,_0x334856){return function(_0x2a423d){try{var _0x16dc71=this[_0xc495('0x11')];if(_0x16dc71===_0xc495('0x12')&&_0x334856[_0xc495('0x13')][_0xc495('0x14')]){logger['info'](_0xc495('0x15'),_0x358fc0,_0xc495('0x16'));return _0x2a423d[_0xc495('0x17')]();}if(_0x41d9b1[0x0]==='1'&&(_[_0xc495('0x18')](this[_0xc495('0x19')]['created'])||!this[_0xc495('0x19')][_0xc495('0x1a')])){logger[_0xc495('0x1b')]('[%s][AUTOREPLY]\x20%s',_0x358fc0,'Autoreply\x20already\x20sent');return _0x2a423d[_0xc495('0x17')]();}if(_0x41d9b1[0x0]==='2'&&this[_0xc495('0x19')][_0xc495('0x1c')]){logger[_0xc495('0x1b')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x358fc0,'One\x20Time\x20already\x20sent');return _0x2a423d[_0xc495('0x17')]();}var _0x10488d={'ContactId':this[_0xc495('0x1d')]['id'],'sentAt':moment()[_0xc495('0x1e')](_0xc495('0x1f')),'direction':_0xc495('0x20')};if(this['channel']===_0xc495('0x12')){_0x10488d[_0xc495('0x13')]=utils[_0xc495('0x21')](_0x41d9b1[0x2],this);}else{_0x10488d['body']=utils[_0xc495('0x21')](_0x41d9b1[0x1],this);}if(this[_0xc495('0x22')]){_0x10488d['to']=this[_0xc495('0x22')][_0xc495('0x23')]||'';if(this[_0xc495('0x11')]===_0xc495('0x12')&&_0x41d9b1[0x1]==='1'){_0x10488d['cc']=this['message']['cc']||'';}_0x10488d[_0xc495('0x23')]=this[_0xc495('0x22')]['to']||'';_0x10488d[_0xc495('0x24')]=this['message']['phone']||'';_0x10488d['read']=!![];if(this['message'][_0xc495('0x25')]){_0x10488d[_0xc495('0x25')]='';_0x10488d[_0xc495('0x25')]+=_['startsWith'](this[_0xc495('0x22')][_0xc495('0x25')],_0xc495('0x26'))?'':'Re:\x20';_0x10488d[_0xc495('0x25')]+=this[_0xc495('0x22')][_0xc495('0x25')];}}if(this[_0xc495('0x11')]===_0xc495('0x27')){_0x10488d[_0xc495('0x28')]=this['account']['id'];}else{_0x10488d[_[_0xc495('0x29')](this[_0xc495('0x11')])+_0xc495('0x2a')]=this[_0xc495('0x2b')]['id'];}_0x10488d[_['upperFirst'](this[_0xc495('0x11')])+_0xc495('0x2c')]=this[_0xc495('0x19')]['id'];var _0x11be08=this[_0xc495('0x19')];if(rpc[this[_0xc495('0x11')]+'Message']){if(this[_0xc495('0x11')]==='mail'){_0x10488d['inReplyTo']=this[_0xc495('0x22')]['messageId'];_0x10488d[_0xc495('0x2d')]=_0xc495('0x2e')+_[_0xc495('0x2f')](_0x10488d[_0xc495('0x13')],_0xc495('0x30'),_0xc495('0x31'))+_0xc495('0x32');_0x10488d[_0xc495('0x33')]={'Auto-Submitted':_0xc495('0x34'),'X-Auto-Response-Suppress':_0xc495('0x35'),'Precedence':'auto_reply'};return mailRpc[_0xc495('0x36')](this[_0xc495('0x2b')][_0xc495('0x37')],_0x10488d)[_0xc495('0x38')](function(_0x3fe511){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x358fc0);_0x10488d[_0xc495('0x39')]=_0x3fe511['message']['messageId'];return rpc[_0x16dc71+_0xc495('0x3a')][_0xc495('0x3b')](_0x10488d);})['then'](function(_0x157ddf){logger[_0xc495('0x1b')]('[%s][AUTOREPLY]\x20%s',_0x358fc0,JSON[_0xc495('0x3c')](_0x157ddf));})[_0xc495('0x3d')](function(_0xd01ddb){logger[_0xc495('0x3e')](_0xc495('0x3f'),_0x358fc0,JSON[_0xc495('0x3c')](_0xd01ddb));})[_0xc495('0x40')](function(){Promise[_0xc495('0x41')]()[_0xc495('0x38')](function(){if(_0x41d9b1[0x0]!=='2'||_0x11be08[_0xc495('0x1c')])return;return rpc[_0x16dc71+_0xc495('0x42')]['update'](_0x11be08['id'],{'autoreplyExecuted':!![]})[_0xc495('0x38')](function(_0x1d7047){logger[_0xc495('0x1b')](_0xc495('0x43'),_0x358fc0,JSON[_0xc495('0x3c')](_0x1d7047));})[_0xc495('0x3d')](function(_0x4e625a){logger[_0xc495('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x358fc0,JSON[_0xc495('0x3c')](_0x4e625a));});})[_0xc495('0x38')](function(){_0x2a423d[_0xc495('0x17')]();});});}else{return rpc[this['channel']+_0xc495('0x3a')][_0xc495('0x3b')](_0x10488d)[_0xc495('0x38')](function(){logger['info'](_0xc495('0x15'),_0x358fc0,_0x10488d[_0xc495('0x13')]);})[_0xc495('0x3d')](function(_0x14caeb){logger['error'](_0xc495('0x15'),_0x358fc0,JSON['stringify'](_0x14caeb));})['finally'](function(){Promise[_0xc495('0x41')]()[_0xc495('0x38')](function(){if(_0x41d9b1[0x0]!=='2'||_0x11be08['autoreplyExecuted'])return;return rpc[_0x16dc71+_0xc495('0x42')][_0xc495('0x44')](_0x11be08['id'],{'autoreplyExecuted':!![]})[_0xc495('0x38')](function(_0x6e10b1){logger[_0xc495('0x1b')](_0xc495('0x43'),_0x358fc0,JSON[_0xc495('0x3c')](_0x6e10b1));})['catch'](function(_0x1d894b){logger[_0xc495('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x358fc0,JSON['stringify'](_0x1d894b));});})['then'](function(){_0x2a423d['next']();});});}}}catch(_0x27975e){logger[_0xc495('0x3e')](_0xc495('0x15'),_0x358fc0,JSON[_0xc495('0x3c')](_0x27975e));_0x2a423d[_0xc495('0x45')]();}};}; \ No newline at end of file +var _0x75fa=['routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','replace','','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','catch','error','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','lodash','./utils','../../../../config/logger'];(function(_0x1b5398,_0x2fbbc2){var _0x19b6f3=function(_0x1c066b){while(--_0x1c066b){_0x1b5398['push'](_0x1b5398['shift']());}};_0x19b6f3(++_0x2fbbc2);}(_0x75fa,0x19b));var _0xa75f=function(_0x31cf9a,_0x47707b){_0x31cf9a=_0x31cf9a-0x0;var _0x3fae6d=_0x75fa[_0x31cf9a];return _0x3fae6d;};'use strict';var _=require(_0xa75f('0x0'));var moment=require('moment');var utils=require(_0xa75f('0x1'));var logger=require(_0xa75f('0x2'))(_0xa75f('0x3'));var rpc={'chatMessage':require(_0xa75f('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa75f('0x5')),'faxMessage':require(_0xa75f('0x6')),'whatsappMessage':require(_0xa75f('0x7')),'chatInteraction':require(_0xa75f('0x8')),'openchannelInteraction':require(_0xa75f('0x9')),'mailInteraction':require(_0xa75f('0xa')),'smsInteraction':require(_0xa75f('0xb')),'faxInteraction':require(_0xa75f('0xc')),'whatsappInteraction':require(_0xa75f('0xd'))};var mailRpc=require(_0xa75f('0xe'));exports[_0xa75f('0xf')]=function(_0x183b0a,_0x4dcc7c,_0x1aff5d,_0x3ea0ad){return function(_0x54098f){try{var _0x11a0a5=this[_0xa75f('0x10')];if(_0x11a0a5===_0xa75f('0x11')&&_0x3ea0ad['body'][_0xa75f('0x12')]){logger[_0xa75f('0x13')](_0xa75f('0x14'),_0x183b0a,_0xa75f('0x15'));return _0x54098f[_0xa75f('0x16')]();}if(_0x4dcc7c[0x0]==='1'&&(_[_0xa75f('0x17')](this['interaction'][_0xa75f('0x18')])||!this[_0xa75f('0x19')]['created'])){logger[_0xa75f('0x13')]('[%s][AUTOREPLY]\x20%s',_0x183b0a,_0xa75f('0x1a'));return _0x54098f['next']();}if(_0x4dcc7c[0x0]==='2'&&this['interaction'][_0xa75f('0x1b')]){logger[_0xa75f('0x13')](_0xa75f('0x1c'),_0x183b0a,_0xa75f('0x1d'));return _0x54098f[_0xa75f('0x16')]();}var _0x1a6fd8={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa75f('0x1e')](_0xa75f('0x1f')),'direction':_0xa75f('0x20')};if(this[_0xa75f('0x10')]===_0xa75f('0x11')){_0x1a6fd8[_0xa75f('0x21')]=utils[_0xa75f('0x22')](_0x4dcc7c[0x2],this);}else{_0x1a6fd8[_0xa75f('0x21')]=utils[_0xa75f('0x22')](_0x4dcc7c[0x1],this);}if(this[_0xa75f('0x23')]){_0x1a6fd8['to']=this['message']['from']||'';if(this[_0xa75f('0x10')]===_0xa75f('0x11')&&_0x4dcc7c[0x1]==='1'){_0x1a6fd8['cc']=this[_0xa75f('0x23')]['cc']||'';}_0x1a6fd8[_0xa75f('0x24')]=this[_0xa75f('0x23')]['to']||'';_0x1a6fd8[_0xa75f('0x25')]=this[_0xa75f('0x23')][_0xa75f('0x25')]||'';_0x1a6fd8[_0xa75f('0x26')]=!![];if(this[_0xa75f('0x23')][_0xa75f('0x27')]){_0x1a6fd8[_0xa75f('0x27')]='';_0x1a6fd8[_0xa75f('0x27')]+=_['startsWith'](this[_0xa75f('0x23')][_0xa75f('0x27')],'Re:')?'':_0xa75f('0x28');_0x1a6fd8[_0xa75f('0x27')]+=this[_0xa75f('0x23')][_0xa75f('0x27')];}}if(this[_0xa75f('0x10')]===_0xa75f('0x29')){_0x1a6fd8['ChatWebsiteId']=this[_0xa75f('0x2a')]['id'];}else{_0x1a6fd8[_[_0xa75f('0x2b')](this[_0xa75f('0x10')])+_0xa75f('0x2c')]=this['account']['id'];}_0x1a6fd8[_[_0xa75f('0x2b')](this['channel'])+_0xa75f('0x2d')]=this[_0xa75f('0x19')]['id'];var _0x18252a=this[_0xa75f('0x19')];if(rpc[this[_0xa75f('0x10')]+_0xa75f('0x2e')]){if(this['channel']===_0xa75f('0x11')){_0x1a6fd8[_0xa75f('0x2f')]=this[_0xa75f('0x23')]['messageId'];_0x1a6fd8[_0xa75f('0x30')]=''+_[_0xa75f('0x31')](_0x1a6fd8[_0xa75f('0x21')],_0xa75f('0x32'),_0xa75f('0x33'))+_0xa75f('0x34');_0x1a6fd8['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xa75f('0x35'),'Precedence':_0xa75f('0x36')};return mailRpc[_0xa75f('0x37')](this[_0xa75f('0x2a')][_0xa75f('0x38')],_0x1a6fd8)[_0xa75f('0x39')](function(_0x5dd667){logger['info'](_0xa75f('0x3a'),_0x183b0a);_0x1a6fd8[_0xa75f('0x3b')]=_0x5dd667['message'][_0xa75f('0x3b')];return rpc[_0x11a0a5+'Message']['create'](_0x1a6fd8);})['then'](function(_0x39a53b){logger[_0xa75f('0x13')](_0xa75f('0x14'),_0x183b0a,JSON[_0xa75f('0x3c')](_0x39a53b));})[_0xa75f('0x3d')](function(_0xb3ec26){logger[_0xa75f('0x3e')]('[RPC][%s][AUTOREPLY]\x20%s',_0x183b0a,JSON[_0xa75f('0x3c')](_0xb3ec26));})[_0xa75f('0x3f')](function(){Promise[_0xa75f('0x40')]()[_0xa75f('0x39')](function(){if(_0x4dcc7c[0x0]!=='2'||_0x18252a['autoreplyExecuted'])return;return rpc[_0x11a0a5+'Interaction'][_0xa75f('0x41')](_0x18252a['id'],{'autoreplyExecuted':!![]})[_0xa75f('0x39')](function(_0x4b4866){logger[_0xa75f('0x13')](_0xa75f('0x1c'),_0x183b0a,JSON[_0xa75f('0x3c')](_0x4b4866));})[_0xa75f('0x3d')](function(_0xb93922){logger['error'](_0xa75f('0x42'),_0x183b0a,JSON[_0xa75f('0x3c')](_0xb93922));});})['then'](function(){_0x54098f[_0xa75f('0x16')]();});});}else{return rpc[this[_0xa75f('0x10')]+'Message']['create'](_0x1a6fd8)[_0xa75f('0x39')](function(){logger[_0xa75f('0x13')]('[%s][AUTOREPLY]\x20%s',_0x183b0a,_0x1a6fd8[_0xa75f('0x21')]);})[_0xa75f('0x3d')](function(_0x4d3625){logger[_0xa75f('0x3e')](_0xa75f('0x14'),_0x183b0a,JSON[_0xa75f('0x3c')](_0x4d3625));})['finally'](function(){Promise[_0xa75f('0x40')]()['then'](function(){if(_0x4dcc7c[0x0]!=='2'||_0x18252a['autoreplyExecuted'])return;return rpc[_0x11a0a5+_0xa75f('0x43')][_0xa75f('0x41')](_0x18252a['id'],{'autoreplyExecuted':!![]})[_0xa75f('0x39')](function(_0x1714a1){logger[_0xa75f('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x183b0a,JSON['stringify'](_0x1714a1));})[_0xa75f('0x3d')](function(_0x281981){logger[_0xa75f('0x3e')](_0xa75f('0x42'),_0x183b0a,JSON[_0xa75f('0x3c')](_0x281981));});})[_0xa75f('0x39')](function(){_0x54098f['next']();});});}}}catch(_0x3b36ec){logger[_0xa75f('0x3e')](_0xa75f('0x14'),_0x183b0a,JSON['stringify'](_0x3b36ec));_0x54098f[_0xa75f('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 3b80594..cbfb748 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 _0x03e5=['interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','finally','stop','error','[%s][CLOSE]\x20%s','moment','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x03e5,0x159));var _0x503e=function(_0x4783c4,_0x2fb5ee){_0x4783c4=_0x4783c4-0x0;var _0x1f4af1=_0x03e5[_0x4783c4];return _0x1f4af1;};'use strict';var moment=require(_0x503e('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x503e('0x1')),'openchannelInteraction':require(_0x503e('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x503e('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x503e('0x4'))};exports['consequence']=function(_0x15a00a,_0x91ed70,_0x4bb46e,_0x28ad59){return function(_0x49e6c1){try{logger[_0x503e('0x5')](_0x503e('0x6'),_0x15a00a,_0x91ed70[0x0]);var _0x1b0410={'closed':0x1,'closedAt':moment()[_0x503e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x503e('0x8'),'disposition':_0x91ed70[0x0]};if(rpc[_0x28ad59[_0x503e('0x9')]+_0x503e('0xa')]){rpc[_0x28ad59[_0x503e('0x9')]+'Interaction'][_0x503e('0xb')](_0x28ad59[_0x503e('0xc')]['id'],_0x1b0410)[_0x503e('0xd')](function(_0x49aa50){logger[_0x503e('0x5')](_0x503e('0xe'),_0x15a00a,_0x28ad59[_0x503e('0xc')]['id']);})[_0x503e('0xf')](function(_0x428de9){logger['error']('[%s][CLOSE]\x20%s',_0x15a00a,JSON[_0x503e('0x10')](_0x428de9));})[_0x503e('0x11')](function(){_0x49e6c1[_0x503e('0x12')]();});}}catch(_0x3656eb){logger[_0x503e('0x13')](_0x503e('0x14'),_0x15a00a,JSON[_0x503e('0x10')](_0x3656eb));_0x49e6c1[_0x503e('0x12')]();}};}; \ No newline at end of file +var _0x6fa2=['error','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','[%s][CLOSE]\x20%s','stringify','stop'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6fa2,0x18d));var _0x26fa=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6fa2[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x26fa('0x0'));var logger=require('../../../../config/logger')(_0x26fa('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x26fa('0x2')),'smsInteraction':require(_0x26fa('0x3')),'mailInteraction':require(_0x26fa('0x4')),'faxInteraction':require(_0x26fa('0x5')),'whatsappInteraction':require(_0x26fa('0x6'))};exports[_0x26fa('0x7')]=function(_0x1c1abd,_0xbca1a8,_0x35af38,_0x3dea32){return function(_0x28c58d){try{logger[_0x26fa('0x8')](_0x26fa('0x9'),_0x1c1abd,_0xbca1a8[0x0]);var _0x59e11b={'closed':0x1,'closedAt':moment()[_0x26fa('0xa')](_0x26fa('0xb')),'closeReason':'system','disposition':_0xbca1a8[0x0]};if(rpc[_0x3dea32[_0x26fa('0xc')]+_0x26fa('0xd')]){rpc[_0x3dea32['channel']+_0x26fa('0xd')][_0x26fa('0xe')](_0x3dea32['interaction']['id'],_0x59e11b)[_0x26fa('0xf')](function(_0x171541){logger['info'](_0x26fa('0x10'),_0x1c1abd,_0x3dea32[_0x26fa('0x11')]['id']);})['catch'](function(_0x622d7a){logger['error'](_0x26fa('0x12'),_0x1c1abd,JSON[_0x26fa('0x13')](_0x622d7a));})['finally'](function(){_0x28c58d[_0x26fa('0x14')]();});}}catch(_0x4e90e4){logger[_0x26fa('0x15')]('[%s][CLOSE]\x20%s',_0x1c1abd,JSON[_0x26fa('0x13')](_0x4e90e4));_0x28c58d[_0x26fa('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 8ed8e0a..d2a9074 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 _0x87d3=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','created','isEmpty','body','getMustacheRender','Message','then','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','providerResponse','create','result','metadata','endConversation','catch','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s'];(function(_0xe8f4d7,_0x22d9ad){var _0x5f36d8=function(_0x1117b7){while(--_0x1117b7){_0xe8f4d7['push'](_0xe8f4d7['shift']());}};_0x5f36d8(++_0x22d9ad);}(_0x87d3,0x86));var _0x387d=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0x87d3[_0x5786f9];return _0x22c3cf;};'use strict';var _=require(_0x387d('0x0'));var moment=require(_0x387d('0x1'));var apiai=require(_0x387d('0x2'));var md5=require(_0x387d('0x3'));var utils=require(_0x387d('0x4'));var logger=require(_0x387d('0x5'))('routing');var rpc={'chatMessage':require(_0x387d('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x387d('0x7')),'smsMessage':require(_0x387d('0x8')),'faxMessage':require(_0x387d('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x387d('0xa')]=function(_0x265532,_0x3b1d5b){return function(_0x689c51){try{if(!_[_0x387d('0xb')](this[_0x387d('0xc')][_0x387d('0xd')])){logger[_0x387d('0xe')](_0x387d('0xf'),_0x265532,_0x387d('0x10'));return _0x689c51[_0x387d('0x11')]();}var _0x588ef4={'ContactId':this[_0x387d('0x12')]['id'],'sentAt':moment()[_0x387d('0x13')](_0x387d('0x14')),'direction':_0x387d('0x15')};if(this[_0x387d('0x16')]===_0x387d('0x17')||this[_0x387d('0x16')]===_0x387d('0x18')){_0x588ef4[_0x387d('0x19')]=this[_0x387d('0xc')][_0x387d('0x19')];}var _0x207f47=this[_0x387d('0x16')];if(_0x207f47===_0x387d('0x1a')){_0x588ef4[_0x387d('0x1b')]=this['account']['id'];}else{_0x588ef4[_['upperFirst'](_0x207f47)+_0x387d('0x1c')]=this['account']['id'];}_0x588ef4[_['upperFirst'](_0x207f47)+'InteractionId']=this[_0x387d('0xc')]['id'];if(this[_0x387d('0xc')][_0x387d('0x1d')]){var _0x2998e9=_0x3b1d5b[0x2];if(!_[_0x387d('0x1e')](_0x2998e9)){_0x588ef4[_0x387d('0x1f')]=utils[_0x387d('0x20')](_0x2998e9,this);return rpc[_0x207f47+_0x387d('0x21')]['create'](_0x588ef4)[_0x387d('0x22')](function(_0xa50585){logger[_0x387d('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x265532,_0x588ef4[_0x387d('0x1f')]);})['catch'](function(_0x476c69){logger['error'](_0x387d('0xf'),_0x265532,JSON[_0x387d('0x23')](_0x476c69));})[_0x387d('0x24')](function(){logger[_0x387d('0xe')](_0x387d('0x25'),_0x265532);_0x689c51['stop']();});}else{logger['info'](_0x387d('0x26'),_0x265532);_0x689c51[_0x387d('0x27')]();}}else{var _0x2f2827=this;var _0x580a6e=apiai(_0x3b1d5b[0x0],{'language':_0x3b1d5b[0x1]||'en'});return _0x580a6e[_0x387d('0x28')](this[_0x387d('0x29')][_0x387d('0x1f')],{'sessionId':md5(this[_0x387d('0xc')]['id'])})[_0x387d('0x22')](function(_0x5569db){_0x2f2827['body']['dialogflow']=_0x5569db;_0x588ef4[_0x387d('0x1f')]=_0x5569db['result']['fulfillment']['speech'];_0x588ef4['providerName']=_0x387d('0x2a');_0x588ef4[_0x387d('0x2b')]=JSON[_0x387d('0x23')](_0x5569db);return rpc[_0x207f47+_0x387d('0x21')][_0x387d('0x2c')](_0x588ef4)[_0x387d('0x22')](function(_0x1d3f3a){logger[_0x387d('0xe')](_0x387d('0xf'),_0x265532,_0x588ef4[_0x387d('0x1f')]);if(_0x5569db[_0x387d('0x2d')][_0x387d('0x2e')][_0x387d('0x2f')]){_0x689c51[_0x387d('0x11')]();}else{_0x689c51[_0x387d('0x27')]();}})[_0x387d('0x30')](function(_0x5da92e){logger[_0x387d('0x31')](_0x387d('0xf'),_0x265532,JSON[_0x387d('0x23')](_0x5da92e));_0x689c51['next']();});})[_0x387d('0x30')](function(_0x452a11){logger[_0x387d('0x31')](_0x387d('0xf'),_0x265532,_0x452a11[_0x387d('0x29')]);_0x689c51['next']();});}}catch(_0xd3fecf){logger[_0x387d('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x265532,JSON['stringify'](_0xd3fecf));_0x689c51[_0x387d('0x27')]();}};}; \ No newline at end of file +var _0x25fa=['body','getMustacheRender','Message','create','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','fulfillment','speech','then','result','endConversation','catch','error','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty'];(function(_0x55ffe6,_0x1a7ce9){var _0x594f36=function(_0x59a8ca){while(--_0x59a8ca){_0x55ffe6['push'](_0x55ffe6['shift']());}};_0x594f36(++_0x1a7ce9);}(_0x25fa,0x109));var _0xa25f=function(_0x37ddf8,_0x12862f){_0x37ddf8=_0x37ddf8-0x0;var _0x2ccb89=_0x25fa[_0x37ddf8];return _0x2ccb89;};'use strict';var _=require(_0xa25f('0x0'));var moment=require('moment');var apiai=require(_0xa25f('0x1'));var md5=require(_0xa25f('0x2'));var utils=require('./utils');var logger=require(_0xa25f('0x3'))(_0xa25f('0x4'));var rpc={'chatMessage':require(_0xa25f('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa25f('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa25f('0x7'))};exports[_0xa25f('0x8')]=function(_0x29666d,_0x455225){return function(_0x22982b){try{if(!_[_0xa25f('0x9')](this[_0xa25f('0xa')][_0xa25f('0xb')])){logger[_0xa25f('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x29666d,_0xa25f('0xd'));return _0x22982b[_0xa25f('0xe')]();}var _0x507a36={'ContactId':this[_0xa25f('0xf')]['id'],'sentAt':moment()[_0xa25f('0x10')](_0xa25f('0x11')),'direction':_0xa25f('0x12')};if(this['channel']===_0xa25f('0x13')||this[_0xa25f('0x14')]==='whatsapp'){_0x507a36[_0xa25f('0x15')]=this[_0xa25f('0xa')]['phone'];}var _0x41280c=this[_0xa25f('0x14')];if(_0x41280c===_0xa25f('0x16')){_0x507a36[_0xa25f('0x17')]=this[_0xa25f('0x18')]['id'];}else{_0x507a36[_[_0xa25f('0x19')](_0x41280c)+_0xa25f('0x1a')]=this[_0xa25f('0x18')]['id'];}_0x507a36[_[_0xa25f('0x19')](_0x41280c)+_0xa25f('0x1b')]=this[_0xa25f('0xa')]['id'];if(this[_0xa25f('0xa')]['created']){var _0x2d4f0f=_0x455225[0x2];if(!_[_0xa25f('0x1c')](_0x2d4f0f)){_0x507a36[_0xa25f('0x1d')]=utils[_0xa25f('0x1e')](_0x2d4f0f,this);return rpc[_0x41280c+_0xa25f('0x1f')][_0xa25f('0x20')](_0x507a36)['then'](function(_0x292171){logger['info'](_0xa25f('0x21'),_0x29666d,_0x507a36['body']);})['catch'](function(_0x7daeda){logger['error'](_0xa25f('0x21'),_0x29666d,JSON[_0xa25f('0x22')](_0x7daeda));})[_0xa25f('0x23')](function(){logger[_0xa25f('0xc')](_0xa25f('0x24'),_0x29666d);_0x22982b['stop']();});}else{logger[_0xa25f('0xc')](_0xa25f('0x25'),_0x29666d);_0x22982b[_0xa25f('0x26')]();}}else{var _0x14b7f6=this;var _0x5d2803=apiai(_0x455225[0x0],{'language':_0x455225[0x1]||'en'});return _0x5d2803[_0xa25f('0x27')](this[_0xa25f('0x28')][_0xa25f('0x1d')],{'sessionId':md5(this[_0xa25f('0xa')]['id'])})['then'](function(_0x2b710f){_0x14b7f6[_0xa25f('0x1d')][_0xa25f('0x29')]=_0x2b710f;_0x507a36[_0xa25f('0x1d')]=_0x2b710f['result'][_0xa25f('0x2a')][_0xa25f('0x2b')];_0x507a36['providerName']=_0xa25f('0x29');_0x507a36['providerResponse']=JSON[_0xa25f('0x22')](_0x2b710f);return rpc[_0x41280c+'Message'][_0xa25f('0x20')](_0x507a36)[_0xa25f('0x2c')](function(_0x493de0){logger[_0xa25f('0xc')](_0xa25f('0x21'),_0x29666d,_0x507a36['body']);if(_0x2b710f[_0xa25f('0x2d')]['metadata'][_0xa25f('0x2e')]){_0x22982b[_0xa25f('0xe')]();}else{_0x22982b[_0xa25f('0x26')]();}})[_0xa25f('0x2f')](function(_0x334629){logger['error'](_0xa25f('0x21'),_0x29666d,JSON[_0xa25f('0x22')](_0x334629));_0x22982b[_0xa25f('0xe')]();});})[_0xa25f('0x2f')](function(_0x3bdde0){logger['error'](_0xa25f('0x21'),_0x29666d,_0x3bdde0[_0xa25f('0x28')]);_0x22982b[_0xa25f('0xe')]();});}}catch(_0x1a6005){logger[_0xa25f('0x30')](_0xa25f('0x21'),_0x29666d,JSON[_0xa25f('0x22')](_0x1a6005));_0x22982b[_0xa25f('0x26')]();}};}; \ 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 d5727db..7b90340 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 _0x51a3=['create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','out','channel','phone','chat','ChatWebsiteId','upperFirst','InteractionId','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','all','next','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message'];(function(_0x3d0821,_0x17dff6){var _0x3e61a9=function(_0x1cfdb1){while(--_0x1cfdb1){_0x3d0821['push'](_0x3d0821['shift']());}};_0x3e61a9(++_0x17dff6);}(_0x51a3,0x1a5));var _0x351a=function(_0x26445d,_0x4a66f2){_0x26445d=_0x26445d-0x0;var _0x4395f0=_0x51a3[_0x26445d];return _0x4395f0;};'use strict';var _=require(_0x351a('0x0'));var dialogflow=require(_0x351a('0x1'));var md5=require(_0x351a('0x2'));var moment=require(_0x351a('0x3'));var Promise=require(_0x351a('0x4'));var logger=require(_0x351a('0x5'))(_0x351a('0x6'));var utils=require(_0x351a('0x7'));var rpc={'chatMessage':require(_0x351a('0x8')),'openchannelMessage':require(_0x351a('0x9')),'mailMessage':require(_0x351a('0xa')),'smsMessage':require(_0x351a('0xb')),'faxMessage':require(_0x351a('0xc')),'whatsappMessage':require(_0x351a('0xd'))};function createMessage(_0x1ceac2,_0x446aec,_0x54beed,_0x1b78f3){return new Promise(function(_0x643217,_0x2c54fb){var _0x586bb3=_[_0x351a('0xe')](_0x54beed);_0x586bb3[_0x351a('0xf')]=_0x1b78f3;return rpc[_0x446aec+_0x351a('0x10')][_0x351a('0x11')](_0x586bb3)[_0x351a('0x12')](function(){logger[_0x351a('0x13')](_0x351a('0x14'),_0x1ceac2,_0x586bb3['body']);_0x643217();})[_0x351a('0x15')](function(_0x19ec7c){logger[_0x351a('0x16')](_0x351a('0x14'),_0x1ceac2,JSON[_0x351a('0x17')](_0x19ec7c));_0x2c54fb(_0x19ec7c);});});}exports[_0x351a('0x18')]=function(_0x51bb3a,_0x488e8e){return function(_0x2294f1){try{if(!_[_0x351a('0x19')](this[_0x351a('0x1a')][_0x351a('0x1b')])){logger[_0x351a('0x13')](_0x351a('0x14'),_0x51bb3a,_0x351a('0x1c'));return _0x2294f1['next']();}var _0x583088={'ContactId':this['contact']['id'],'sentAt':moment()[_0x351a('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x351a('0x1e')};if(this[_0x351a('0x1f')]==='sms'||this[_0x351a('0x1f')]==='whatsapp'){_0x583088[_0x351a('0x20')]=this[_0x351a('0x1a')][_0x351a('0x20')];}var _0x36000e=this[_0x351a('0x1f')];if(_0x36000e===_0x351a('0x21')){_0x583088[_0x351a('0x22')]=this['account']['id'];}else{_0x583088[_[_0x351a('0x23')](_0x36000e)+'AccountId']=this['account']['id'];}_0x583088[_[_0x351a('0x23')](_0x36000e)+_0x351a('0x24')]=this[_0x351a('0x1a')]['id'];if(this[_0x351a('0x1a')][_0x351a('0x25')]){var _0x2c98c4=_0x488e8e[0x4];if(!_[_0x351a('0x26')](_0x2c98c4)){_0x583088['body']=utils['getMustacheRender'](_0x2c98c4,this);return rpc[_0x36000e+'Message'][_0x351a('0x11')](_0x583088)[_0x351a('0x12')](function(_0x46f73f){logger[_0x351a('0x13')](_0x351a('0x14'),_0x51bb3a,_0x583088[_0x351a('0xf')]);})['catch'](function(_0x3aa9a3){logger[_0x351a('0x16')](_0x351a('0x14'),_0x51bb3a,JSON[_0x351a('0x17')](_0x3aa9a3));})[_0x351a('0x27')](function(){logger[_0x351a('0x13')](_0x351a('0x28'),_0x51bb3a);_0x2294f1[_0x351a('0x29')]();});}else{logger[_0x351a('0x13')](_0x351a('0x2a'),_0x51bb3a);_0x2294f1[_0x351a('0x29')]();}}else{var _0x2a73d1=this;var _0x389b6d=_0x488e8e[0x2][_0x351a('0x2b')](/\\n/g,'\x0a');var _0x446d9f={'credentials':{'private_key':_0x389b6d,'client_email':_0x488e8e[0x1]}};var _0x2acbee=new dialogflow[(_0x351a('0x2c'))](_0x446d9f);var _0x126490=_0x2acbee[_0x351a('0x2d')](_0x488e8e[0x0],md5(_0x2a73d1[_0x351a('0x1a')]['id']));var _0xfbb862={'session':_0x126490,'queryInput':{'text':{'text':_0x2a73d1[_0x351a('0x2e')][_0x351a('0xf')],'languageCode':_0x488e8e[0x3]||'en'}}};return _0x2acbee[_0x351a('0x2f')](_0xfbb862)[_0x351a('0x12')](function(_0x15b70e){if(_0x15b70e&&_0x15b70e[_0x351a('0x30')]){_0x2a73d1[_0x351a('0xf')]['dialogflowV2']=_0x15b70e;var _0x335b21=_0x15b70e[0x0];var _0x28b400=_0x335b21[_0x351a('0x31')][_0x351a('0x32')]&&_0x335b21['queryResult'][_0x351a('0x32')][_0x351a('0x33')]?_0x335b21['queryResult'][_0x351a('0x32')][_0x351a('0x33')][_0x351a('0x34')][_0x351a('0x35')]:![];_0x2a73d1[_0x351a('0xf')]['DIALOGFLOWV2_ACTION']=_0x335b21['queryResult'][_0x351a('0x36')];_0x2a73d1['body'][_0x351a('0x37')]=_0x335b21[_0x351a('0x31')][_0x351a('0x38')];_0x2a73d1[_0x351a('0xf')][_0x351a('0x39')]=_0x335b21[_0x351a('0x31')][_0x351a('0x32')]&&_0x335b21[_0x351a('0x31')][_0x351a('0x32')]['fields']?_0x335b21[_0x351a('0x31')]['diagnosticInfo'][_0x351a('0x33')][_0x351a('0x34')]['boolValue']:![];_0x2a73d1[_0x351a('0xf')][_0x351a('0x3a')]=_0x335b21['queryResult']['intent'][_0x351a('0x3b')];_0x2a73d1['body'][_0x351a('0x3c')]=_0x335b21['queryResult'][_0x351a('0x3d')]['displayName'];_0x2a73d1[_0x351a('0xf')][_0x351a('0x3e')]=_0x335b21[_0x351a('0x31')][_0x351a('0x3d')]['isFallback'];_0x2a73d1['body'][_0x351a('0x3f')]=_0x335b21['queryResult'][_0x351a('0x40')];_0x2a73d1[_0x351a('0xf')]['DIALOGFLOWV2_QUERYTEXT']=_0x335b21[_0x351a('0x31')][_0x351a('0x41')];_0x2a73d1['body']['DIALOGFLOWV2_SCORE']=_0x335b21[_0x351a('0x31')][_0x351a('0x42')];_0x583088['providerName']=_0x351a('0x43');_0x583088[_0x351a('0x44')]=JSON[_0x351a('0x17')](_0x15b70e);var _0x5d0e5c=[];for(var _0x41b156=0x0;_0x41b156<_0x15b70e['length'];_0x41b156++){var _0x1040dd=_0x15b70e[_0x41b156];if(_0x1040dd&&_0x1040dd[_0x351a('0x31')]&&_0x1040dd[_0x351a('0x31')][_0x351a('0x45')]){_0x5d0e5c['push'](createMessage(_0x51bb3a,_0x36000e,_0x583088,_0x1040dd[_0x351a('0x31')][_0x351a('0x45')]));}}return Promise[_0x351a('0x46')](_0x5d0e5c)['then'](function(){if(_0x28b400){_0x2294f1[_0x351a('0x47')]();}else{_0x2294f1['stop']();}})[_0x351a('0x15')](function(_0x521125){logger[_0x351a('0x16')](_0x351a('0x14'),_0x51bb3a,JSON[_0x351a('0x17')](_0x521125));_0x2294f1['next']();});}})['catch'](function(_0x1afc56){logger[_0x351a('0x16')](_0x351a('0x14'),_0x51bb3a,_0x1afc56[_0x351a('0x2e')],_0x1afc56[_0x351a('0x48')]);_0x2294f1[_0x351a('0x47')]();});}}catch(_0x1ccc61){logger[_0x351a('0x16')](_0x351a('0x14'),_0x51bb3a,JSON[_0x351a('0x17')](_0x1ccc61));_0x2294f1[_0x351a('0x29')]();}};}; \ No newline at end of file +var _0x09a8=['moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','account','upperFirst','created','isEmpty','getMustacheRender','stop','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','all','message','stack','lodash','dialogflow'];(function(_0x1bfe96,_0x11af23){var _0x55eb72=function(_0x5fc931){while(--_0x5fc931){_0x1bfe96['push'](_0x1bfe96['shift']());}};_0x55eb72(++_0x11af23);}(_0x09a8,0x82));var _0x809a=function(_0x8a0961,_0x4666a0){_0x8a0961=_0x8a0961-0x0;var _0x500a69=_0x09a8[_0x8a0961];return _0x500a69;};'use strict';var _=require(_0x809a('0x0'));var dialogflow=require(_0x809a('0x1'));var md5=require('md5');var moment=require(_0x809a('0x2'));var Promise=require(_0x809a('0x3'));var logger=require(_0x809a('0x4'))(_0x809a('0x5'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x809a('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x809a('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x468512,_0x3f0368,_0x3afb93,_0xcc0c37){return new Promise(function(_0x2d5fbc,_0x29b73d){var _0x32702f=_[_0x809a('0x8')](_0x3afb93);_0x32702f[_0x809a('0x9')]=_0xcc0c37;return rpc[_0x3f0368+_0x809a('0xa')][_0x809a('0xb')](_0x32702f)[_0x809a('0xc')](function(){logger[_0x809a('0xd')](_0x809a('0xe'),_0x468512,_0x32702f[_0x809a('0x9')]);_0x2d5fbc();})[_0x809a('0xf')](function(_0x319c59){logger[_0x809a('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x468512,JSON[_0x809a('0x11')](_0x319c59));_0x29b73d(_0x319c59);});});}exports[_0x809a('0x12')]=function(_0x44fc93,_0x4ad54d){return function(_0x494047){try{if(!_['isNil'](this[_0x809a('0x13')][_0x809a('0x14')])){logger[_0x809a('0xd')](_0x809a('0xe'),_0x44fc93,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x494047[_0x809a('0x15')]();}var _0x444267={'ContactId':this[_0x809a('0x16')]['id'],'sentAt':moment()[_0x809a('0x17')](_0x809a('0x18')),'direction':_0x809a('0x19')};if(this['channel']===_0x809a('0x1a')||this[_0x809a('0x1b')]===_0x809a('0x1c')){_0x444267['phone']=this[_0x809a('0x13')][_0x809a('0x1d')];}var _0x45d7bf=this[_0x809a('0x1b')];if(_0x45d7bf==='chat'){_0x444267['ChatWebsiteId']=this[_0x809a('0x1e')]['id'];}else{_0x444267[_[_0x809a('0x1f')](_0x45d7bf)+'AccountId']=this[_0x809a('0x1e')]['id'];}_0x444267[_[_0x809a('0x1f')](_0x45d7bf)+'InteractionId']=this['interaction']['id'];if(this[_0x809a('0x13')][_0x809a('0x20')]){var _0x256c4c=_0x4ad54d[0x4];if(!_[_0x809a('0x21')](_0x256c4c)){_0x444267[_0x809a('0x9')]=utils[_0x809a('0x22')](_0x256c4c,this);return rpc[_0x45d7bf+_0x809a('0xa')][_0x809a('0xb')](_0x444267)[_0x809a('0xc')](function(_0xba317a){logger[_0x809a('0xd')](_0x809a('0xe'),_0x44fc93,_0x444267[_0x809a('0x9')]);})['catch'](function(_0x6f726e){logger[_0x809a('0x10')](_0x809a('0xe'),_0x44fc93,JSON[_0x809a('0x11')](_0x6f726e));})['finally'](function(){logger[_0x809a('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x44fc93);_0x494047[_0x809a('0x23')]();});}else{logger[_0x809a('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x44fc93);_0x494047['stop']();}}else{var _0x3840e3=this;var _0x5e2c9f=_0x4ad54d[0x2]['replace'](/\\n/g,'\x0a');var _0x54dcd6={'credentials':{'private_key':_0x5e2c9f,'client_email':_0x4ad54d[0x1]}};var _0x3cb4c6=new dialogflow[(_0x809a('0x24'))](_0x54dcd6);var _0x369209=_0x3cb4c6[_0x809a('0x25')](_0x4ad54d[0x0],md5(_0x3840e3[_0x809a('0x13')]['id']));var _0x42fef9={'session':_0x369209,'queryInput':{'text':{'text':_0x3840e3['message'][_0x809a('0x9')],'languageCode':_0x4ad54d[0x3]||'en'}}};return _0x3cb4c6[_0x809a('0x26')](_0x42fef9)[_0x809a('0xc')](function(_0x2dc289){if(_0x2dc289&&_0x2dc289[_0x809a('0x27')]){_0x3840e3['body'][_0x809a('0x28')]=_0x2dc289;var _0x1daddd=_0x2dc289[0x0];var _0x4084fc=_0x1daddd[_0x809a('0x29')][_0x809a('0x2a')]&&_0x1daddd[_0x809a('0x29')][_0x809a('0x2a')][_0x809a('0x2b')]?_0x1daddd[_0x809a('0x29')]['diagnosticInfo'][_0x809a('0x2b')]['end_conversation']['boolValue']:![];_0x3840e3[_0x809a('0x9')][_0x809a('0x2c')]=_0x1daddd['queryResult']['action'];_0x3840e3[_0x809a('0x9')][_0x809a('0x2d')]=_0x1daddd['queryResult'][_0x809a('0x2e')];_0x3840e3['body'][_0x809a('0x2f')]=_0x1daddd[_0x809a('0x29')][_0x809a('0x2a')]&&_0x1daddd[_0x809a('0x29')][_0x809a('0x2a')][_0x809a('0x2b')]?_0x1daddd[_0x809a('0x29')][_0x809a('0x2a')]['fields'][_0x809a('0x30')][_0x809a('0x31')]:![];_0x3840e3['body'][_0x809a('0x32')]=_0x1daddd['queryResult'][_0x809a('0x33')][_0x809a('0x34')];_0x3840e3['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1daddd['queryResult']['intent'][_0x809a('0x35')];_0x3840e3[_0x809a('0x9')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1daddd[_0x809a('0x29')]['intent'][_0x809a('0x36')];_0x3840e3[_0x809a('0x9')][_0x809a('0x37')]=_0x1daddd[_0x809a('0x29')]['languageCode'];_0x3840e3[_0x809a('0x9')][_0x809a('0x38')]=_0x1daddd[_0x809a('0x29')][_0x809a('0x39')];_0x3840e3[_0x809a('0x9')][_0x809a('0x3a')]=_0x1daddd[_0x809a('0x29')][_0x809a('0x3b')];_0x444267[_0x809a('0x3c')]='dialogflowV2';_0x444267['providerResponse']=JSON[_0x809a('0x11')](_0x2dc289);var _0x23c2bc=[];for(var _0x4eb42a=0x0;_0x4eb42a<_0x2dc289[_0x809a('0x27')];_0x4eb42a++){var _0x9c0c80=_0x2dc289[_0x4eb42a];if(_0x9c0c80&&_0x9c0c80['queryResult']&&_0x9c0c80[_0x809a('0x29')][_0x809a('0x3d')]){_0x23c2bc[_0x809a('0x3e')](createMessage(_0x44fc93,_0x45d7bf,_0x444267,_0x9c0c80[_0x809a('0x29')][_0x809a('0x3d')]));}}return Promise[_0x809a('0x3f')](_0x23c2bc)[_0x809a('0xc')](function(){if(_0x4084fc){_0x494047[_0x809a('0x15')]();}else{_0x494047[_0x809a('0x23')]();}})[_0x809a('0xf')](function(_0x362087){logger[_0x809a('0x10')](_0x809a('0xe'),_0x44fc93,JSON[_0x809a('0x11')](_0x362087));_0x494047[_0x809a('0x15')]();});}})[_0x809a('0xf')](function(_0xeae0e7){logger[_0x809a('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x44fc93,_0xeae0e7[_0x809a('0x40')],_0xeae0e7[_0x809a('0x41')]);_0x494047[_0x809a('0x15')]();});}}catch(_0xfa321d){logger[_0x809a('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x44fc93,JSON[_0x809a('0x11')](_0xfa321d));_0x494047[_0x809a('0x23')]();}};}; \ 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 3a38b61..dd9f995 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 _0xea8c=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','error','map','join','stop','condition','priorityFalse','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string'];(function(_0x39867f,_0x5c1b6e){var _0x30fc37=function(_0x344549){while(--_0x344549){_0x39867f['push'](_0x39867f['shift']());}};_0x30fc37(++_0x5c1b6e);}(_0xea8c,0x172));var _0xcea8=function(_0x596d18,_0x369e8b){_0x596d18=_0x596d18-0x0;var _0x4b2238=_0xea8c[_0x596d18];return _0x4b2238;};'use strict';var schema=require(_0xcea8('0x0'));var _=require(_0xcea8('0x1'));var htmlToText=require(_0xcea8('0x2'));var utils=require(_0xcea8('0x3'));var logger=require(_0xcea8('0x4'))(_0xcea8('0x5'));var gotoif=schema({'condition':{'type':_0xcea8('0x6'),'required':!![],'message':_0xcea8('0x7')},'priorityTrue':{'type':_0xcea8('0x8'),'message':_0xcea8('0x9')},'priorityFalse':{'type':'number','message':_0xcea8('0xa')}});exports['consequence']=function(_0xfe0684,_0x502203){return function(_0x117cc6){try{var _0x78b9a6={'condition':htmlToText[_0xcea8('0xb')](utils['getMustacheRender'](_0x502203[0x0],this),{'wordwrap':![]})[_0xcea8('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x502203[0x1],'priorityFalse':_0x502203[0x2]};var _0x5d7441=gotoif[_0xcea8('0x0')](_0x78b9a6,{'typecast':!![]});if(_0x5d7441[_0xcea8('0xd')]){logger[_0xcea8('0xe')]('[%s][GOTOIF]\x20%s',_0xfe0684,_[_0xcea8('0xf')](_0x5d7441,'message')[_0xcea8('0x10')](',\x20'));_0x117cc6[_0xcea8('0x11')]();}else{try{var _0x2832ee=eval('('+_0x78b9a6[_0xcea8('0x12')]+')');var _0x38de9e=_0x2832ee?_0x78b9a6['priorityTrue']:_0x78b9a6[_0xcea8('0x13')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xfe0684,_0x78b9a6[_0xcea8('0x12')],_0x2832ee,_0x38de9e||_0xcea8('0x14'));if(_0x38de9e){var _0x28fdfc=_[_0xcea8('0x15')](_0x117cc6['rules'](),{'p':_0x38de9e});if(_0x28fdfc>=0x0){logger[_0xcea8('0x16')](_0xcea8('0x17'),_0xfe0684,_0x38de9e||_0xcea8('0x14'),_0x28fdfc);_0x117cc6['next'](_0x28fdfc);}else{logger[_0xcea8('0x16')](_0xcea8('0x18'),_0xfe0684,_0x38de9e||_0xcea8('0x14'));_0x117cc6[_0xcea8('0x11')]();}}else{_0x117cc6['next']();}}catch(_0x416911){logger[_0xcea8('0xe')](_0xcea8('0x19'),_0xfe0684,_0x416911[_0xcea8('0x1a')]);_0x117cc6[_0xcea8('0x11')]();}}}catch(_0x27c40a){logger[_0xcea8('0xe')](_0xcea8('0x1b'),_0xfe0684,JSON[_0xcea8('0x1c')](_0x27c40a));_0x117cc6['stop']();}};}; \ No newline at end of file +var _0xc1d2=['rules','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex'];(function(_0x19ab55,_0x1444de){var _0x574e44=function(_0x33ef87){while(--_0x33ef87){_0x19ab55['push'](_0x19ab55['shift']());}};_0x574e44(++_0x1444de);}(_0xc1d2,0xe3));var _0x2c1d=function(_0x5aa3ab,_0x7176b6){_0x5aa3ab=_0x5aa3ab-0x0;var _0x4406bd=_0xc1d2[_0x5aa3ab];return _0x4406bd;};'use strict';var schema=require(_0x2c1d('0x0'));var _=require(_0x2c1d('0x1'));var htmlToText=require(_0x2c1d('0x2'));var utils=require('./utils');var logger=require(_0x2c1d('0x3'))(_0x2c1d('0x4'));var gotoif=schema({'condition':{'type':_0x2c1d('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x2c1d('0x6')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x2c1d('0x7')]=function(_0x81bf4b,_0x5120b7){return function(_0xee927f){try{var _0x351374={'condition':htmlToText[_0x2c1d('0x8')](utils[_0x2c1d('0x9')](_0x5120b7[0x0],this),{'wordwrap':![]})[_0x2c1d('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5120b7[0x1],'priorityFalse':_0x5120b7[0x2]};var _0x1fe932=gotoif[_0x2c1d('0x0')](_0x351374,{'typecast':!![]});if(_0x1fe932[_0x2c1d('0xb')]){logger[_0x2c1d('0xc')](_0x2c1d('0xd'),_0x81bf4b,_[_0x2c1d('0xe')](_0x1fe932,_0x2c1d('0xf'))[_0x2c1d('0x10')](',\x20'));_0xee927f[_0x2c1d('0x11')]();}else{try{var _0x73d699=eval('('+_0x351374['condition']+')');var _0x4d5a2f=_0x73d699?_0x351374[_0x2c1d('0x12')]:_0x351374['priorityFalse'];logger[_0x2c1d('0x13')](_0x2c1d('0x14'),_0x81bf4b,_0x351374['condition'],_0x73d699,_0x4d5a2f||_0x2c1d('0x15'));if(_0x4d5a2f){var _0x2aa64c=_[_0x2c1d('0x16')](_0xee927f[_0x2c1d('0x17')](),{'p':_0x4d5a2f});if(_0x2aa64c>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x81bf4b,_0x4d5a2f||_0x2c1d('0x15'),_0x2aa64c);_0xee927f[_0x2c1d('0x15')](_0x2aa64c);}else{logger[_0x2c1d('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x81bf4b,_0x4d5a2f||_0x2c1d('0x15'));_0xee927f[_0x2c1d('0x11')]();}}else{_0xee927f[_0x2c1d('0x15')]();}}catch(_0x210aa0){logger[_0x2c1d('0xc')](_0x2c1d('0x18'),_0x81bf4b,_0x210aa0[_0x2c1d('0xf')]);_0xee927f[_0x2c1d('0x11')]();}}}catch(_0x3a3f39){logger['error'](_0x2c1d('0xd'),_0x81bf4b,JSON['stringify'](_0x3a3f39));_0xee927f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 5e7acc4..9d7ddd3 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 _0xa2da=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x18bac5,_0x2e54fc){var _0xdc6c44=function(_0x1d7a29){while(--_0x1d7a29){_0x18bac5['push'](_0x18bac5['shift']());}};_0xdc6c44(++_0x2e54fc);}(_0xa2da,0x17f));var _0xaa2d=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0xa2da[_0x578275];return _0xf78041;};'use strict';var schema=require(_0xaa2d('0x0'));var _=require(_0xaa2d('0x1'));var logger=require('../../../../config/logger')(_0xaa2d('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xaa2d('0x3')}});exports['consequence']=function(_0x236ea4,_0x53a430){return function(_0x5d7920){try{var _0x3f12d0={'priority':_0x53a430[0x0]};var _0x8f662a=gotop[_0xaa2d('0x0')](_0x3f12d0,{'typecast':!![]});if(_0x8f662a[_0xaa2d('0x4')]){logger['error'](_0xaa2d('0x5'),_0x236ea4,_[_0xaa2d('0x6')](_0x8f662a,_0xaa2d('0x7'))[_0xaa2d('0x8')](',\x20'));_0x5d7920['stop']();}else{logger[_0xaa2d('0x9')](_0xaa2d('0xa'),_0x236ea4,_0x3f12d0[_0xaa2d('0xb')]);if(_0x3f12d0[_0xaa2d('0xb')]){var _0x31dd12=_[_0xaa2d('0xc')](_0x5d7920[_0xaa2d('0xd')](),{'p':_0x3f12d0[_0xaa2d('0xb')]});if(_0x31dd12>=0x0){logger[_0xaa2d('0x9')](_0xaa2d('0xe'),_0x236ea4,_0x3f12d0[_0xaa2d('0xb')]||_0xaa2d('0xf'),_0x31dd12);_0x5d7920[_0xaa2d('0xf')](_0x31dd12);}else{logger[_0xaa2d('0x9')](_0xaa2d('0x10'),_0x236ea4,_0x3f12d0[_0xaa2d('0xb')]||_0xaa2d('0xf'));_0x5d7920['stop']();}}else{_0x5d7920[_0xaa2d('0xf')]();}}}catch(_0x40ba06){logger['error']('[%s][GOTOP]\x20%s',_0x236ea4,JSON[_0xaa2d('0x11')](_0x40ba06));_0x5d7920['stop']();}};}; \ No newline at end of file +var _0x8303=['map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x8303,0x1ee));var _0x3830=function(_0x958e36,_0xf77758){_0x958e36=_0x958e36-0x0;var _0x2dbf39=_0x8303[_0x958e36];return _0x2dbf39;};'use strict';var schema=require(_0x3830('0x0'));var _=require(_0x3830('0x1'));var logger=require(_0x3830('0x2'))(_0x3830('0x3'));var gotop=schema({'priority':{'type':_0x3830('0x4'),'required':!![],'message':_0x3830('0x5')}});exports[_0x3830('0x6')]=function(_0xb85024,_0xac3a8e){return function(_0x24e958){try{var _0x37330b={'priority':_0xac3a8e[0x0]};var _0x26a92c=gotop[_0x3830('0x0')](_0x37330b,{'typecast':!![]});if(_0x26a92c[_0x3830('0x7')]){logger[_0x3830('0x8')](_0x3830('0x9'),_0xb85024,_[_0x3830('0xa')](_0x26a92c,_0x3830('0xb'))['join'](',\x20'));_0x24e958[_0x3830('0xc')]();}else{logger[_0x3830('0xd')](_0x3830('0xe'),_0xb85024,_0x37330b[_0x3830('0xf')]);if(_0x37330b[_0x3830('0xf')]){var _0x259d4c=_[_0x3830('0x10')](_0x24e958[_0x3830('0x11')](),{'p':_0x37330b['priority']});if(_0x259d4c>=0x0){logger['info'](_0x3830('0x12'),_0xb85024,_0x37330b['priority']||_0x3830('0x13'),_0x259d4c);_0x24e958[_0x3830('0x13')](_0x259d4c);}else{logger[_0x3830('0xd')](_0x3830('0x14'),_0xb85024,_0x37330b[_0x3830('0xf')]||_0x3830('0x13'));_0x24e958[_0x3830('0xc')]();}}else{_0x24e958[_0x3830('0x13')]();}}}catch(_0xea11fa){logger['error'](_0x3830('0x9'),_0xb85024,JSON['stringify'](_0xea11fa));_0x24e958[_0x3830('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 afd7098..14a13a7 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 _0x69e6=['info','next','error','[%s][MESSAGE]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then'];(function(_0xa81e24,_0x44e214){var _0xd95dbc=function(_0x3d5890){while(--_0x3d5890){_0xa81e24['push'](_0xa81e24['shift']());}};_0xd95dbc(++_0x44e214);}(_0x69e6,0x1e0));var _0x669e=function(_0xe1e5dc,_0x31d22f){_0xe1e5dc=_0xe1e5dc-0x0;var _0x1c1d67=_0x69e6[_0xe1e5dc];return _0x1c1d67;};'use strict';var _=require('lodash');var utils=require(_0x669e('0x0'));var logger=require(_0x669e('0x1'))(_0x669e('0x2'));var rpc={'chatMessage':require(_0x669e('0x3')),'openchannelMessage':require(_0x669e('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x669e('0x5')),'faxMessage':require(_0x669e('0x6')),'whatsappMessage':require(_0x669e('0x7'))};exports[_0x669e('0x8')]=function(_0x3258f7,_0x1be88f){return function(_0x28f1d9){try{var _0x132e5e={'body':utils[_0x669e('0x9')](_0x1be88f[0x0],this),'ContactId':this[_0x669e('0xa')]['id']};if(this[_0x669e('0xb')]===_0x669e('0xc')){_0x132e5e['ChatWebsiteId']=this[_0x669e('0xd')]['id'];}else{_0x132e5e[_[_0x669e('0xe')](this[_0x669e('0xb')])+'AccountId']=this['account']['id'];}_0x132e5e[_['upperFirst'](this[_0x669e('0xb')])+_0x669e('0xf')]=this[_0x669e('0x10')]['id'];if(rpc[this[_0x669e('0xb')]+_0x669e('0x11')]){return rpc[this['channel']+'Message'][_0x669e('0x12')](_0x132e5e)[_0x669e('0x13')](function(_0x344b70){logger[_0x669e('0x14')]('[%s][MESSAGE]\x20%s',_0x3258f7,_0x132e5e['body']);_0x28f1d9[_0x669e('0x15')]();})['catch'](function(_0x2e53db){logger[_0x669e('0x16')](_0x669e('0x17'),_0x3258f7,JSON['stringify'](_0x2e53db));_0x28f1d9[_0x669e('0x18')]();});}}catch(_0x255d4e){logger[_0x669e('0x16')](_0x669e('0x17'),_0x3258f7,JSON['stringify'](_0x255d4e));_0x28f1d9[_0x669e('0x18')]();}};}; \ No newline at end of file +var _0x38dc=['ChatWebsiteId','account','upperFirst','channel','AccountId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat'];(function(_0xa22054,_0x464303){var _0x4bee13=function(_0x26b6d7){while(--_0x26b6d7){_0xa22054['push'](_0xa22054['shift']());}};_0x4bee13(++_0x464303);}(_0x38dc,0x117));var _0xc38d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x38dc[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xc38d('0x0'))(_0xc38d('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc38d('0x2')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc38d('0x3'))};exports['consequence']=function(_0x2b0e87,_0x300a12){return function(_0x501765){try{var _0x15a1fc={'body':utils[_0xc38d('0x4')](_0x300a12[0x0],this),'ContactId':this[_0xc38d('0x5')]['id']};if(this['channel']===_0xc38d('0x6')){_0x15a1fc[_0xc38d('0x7')]=this[_0xc38d('0x8')]['id'];}else{_0x15a1fc[_[_0xc38d('0x9')](this[_0xc38d('0xa')])+_0xc38d('0xb')]=this[_0xc38d('0x8')]['id'];}_0x15a1fc[_[_0xc38d('0x9')](this[_0xc38d('0xa')])+'InteractionId']=this[_0xc38d('0xc')]['id'];if(rpc[this['channel']+_0xc38d('0xd')]){return rpc[this['channel']+_0xc38d('0xd')][_0xc38d('0xe')](_0x15a1fc)['then'](function(_0x5d1a05){logger['info'](_0xc38d('0xf'),_0x2b0e87,_0x15a1fc[_0xc38d('0x10')]);_0x501765[_0xc38d('0x11')]();})[_0xc38d('0x12')](function(_0x21c3f9){logger[_0xc38d('0x13')](_0xc38d('0xf'),_0x2b0e87,JSON['stringify'](_0x21c3f9));_0x501765[_0xc38d('0x14')]();});}}catch(_0x5e9785){logger[_0xc38d('0x13')](_0xc38d('0xf'),_0x2b0e87,JSON[_0xc38d('0x15')](_0x5e9785));_0x501765[_0xc38d('0x14')]();}};}; \ 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 dee91bb..92c4ef6 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 _0xd8f7=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','../../../../config/logger'];(function(_0xac7226,_0x2c5ab9){var _0x20f7a2=function(_0x1df5c8){while(--_0x1df5c8){_0xac7226['push'](_0xac7226['shift']());}};_0x20f7a2(++_0x2c5ab9);}(_0xd8f7,0xc7));var _0x7d8f=function(_0x12b775,_0x2f9efb){_0x12b775=_0x12b775-0x0;var _0x3a6e60=_0xd8f7[_0x12b775];return _0x3a6e60;};'use strict';var utils=require('./utils');var logger=require(_0x7d8f('0x0'))(_0x7d8f('0x1'));exports['consequence']=function(_0x41aa96,_0x10068c){return function(_0x5ab60a){try{logger[_0x7d8f('0x2')](_0x7d8f('0x3'),_0x41aa96,utils[_0x7d8f('0x4')](_0x10068c[0x0],this));_0x5ab60a[_0x7d8f('0x5')]();}catch(_0x4ca6b4){logger[_0x7d8f('0x6')](_0x7d8f('0x3'),_0x41aa96,JSON[_0x7d8f('0x7')](_0x4ca6b4));_0x5ab60a['stop']();}};}; \ No newline at end of file +var _0x2cc9=['[%s][NOOP]\x20%s','next','error','stringify','./utils','../../../../config/logger','routing','consequence'];(function(_0x3143eb,_0x4ca843){var _0x52d19b=function(_0x18110d){while(--_0x18110d){_0x3143eb['push'](_0x3143eb['shift']());}};_0x52d19b(++_0x4ca843);}(_0x2cc9,0x1ac));var _0x92cc=function(_0x51ae86,_0x46cf71){_0x51ae86=_0x51ae86-0x0;var _0x5cb646=_0x2cc9[_0x51ae86];return _0x5cb646;};'use strict';var utils=require(_0x92cc('0x0'));var logger=require(_0x92cc('0x1'))(_0x92cc('0x2'));exports[_0x92cc('0x3')]=function(_0xcd36d7,_0xe29664){return function(_0x58a161){try{logger['info'](_0x92cc('0x4'),_0xcd36d7,utils['getMustacheRender'](_0xe29664[0x0],this));_0x58a161[_0x92cc('0x5')]();}catch(_0x1687ea){logger[_0x92cc('0x6')](_0x92cc('0x4'),_0xcd36d7,JSON[_0x92cc('0x7')](_0x1687ea));_0x58a161['stop']();}};}; \ 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 b81814e..20b7352 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 _0x1be9=['message','chat','AccountId','account','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','waiting','info','[%s][STOP:QUEUE][NAME:%s]','body','update','interaction','then','error','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','qtimeout','rules','end','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','MessageId'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x1be9,0x77));var _0x91be=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x1be9[_0x4b7895];return _0x264180;};'use strict';var schema=require(_0x91be('0x0'));var _=require(_0x91be('0x1'));var util=require(_0x91be('0x2'));var seqqueue=require(_0x91be('0x3'));var moment=require('moment');var Redis=require(_0x91be('0x4'));var config=require('../../../../config/environment');var logger=require(_0x91be('0x5'))(_0x91be('0x6'));var strategy=require(_0x91be('0x7'));config[_0x91be('0x8')]=_['defaults'](config['redis'],{'host':_0x91be('0x9'),'port':0x18eb});var io=require(_0x91be('0xa'))(new Redis(config[_0x91be('0x8')]));var attributes=['id',_0x91be('0xb'),'account',_0x91be('0xc'),_0x91be('0xd'),_0x91be('0xe')];function emit(_0x5326d3,_0x149863,_0x443f3a){io['to'](_0x5326d3)['emit'](_0x149863,_0x443f3a);}function emitChannelQueueInteraction(_0x50468c,_0x32a1c0,_0x576664,_0x4aa273,_0x259ffc,_0x216e00,_0x26f111,_0x18f6d1){var _0x11074c=_[_0x91be('0xf')](_0x576664);_0x11074c[_0x91be('0xb')]=_0x18f6d1;_0x11074c[_0x91be('0xc')]=_0x32a1c0;_0x11074c['account']=_0x4aa273;_0x11074c['id']=_0x259ffc;if(_0x216e00){attributes[_0x91be('0x10')](_[_0x91be('0x11')](_0x50468c)+_0x91be('0x12'));_0x26f111[util[_0x91be('0x13')](_0x91be('0x14'),_0x50468c)][_0x259ffc]=_[_0x91be('0x15')](_0x11074c,attributes);}else{delete _0x26f111[util[_0x91be('0x13')](_0x91be('0x14'),_0x50468c)][_0x259ffc];}emit(util[_0x91be('0x13')](_0x91be('0x16'),_0x50468c,_0x32a1c0),util[_0x91be('0x13')]('%s_queue_waiting_interaction:%s',_0x50468c,_0x216e00?'save':'remove'),_['pick'](_0x11074c,attributes));}var rpc={'openchannelQueueReport':require(_0x91be('0x17')),'mailQueueReport':require(_0x91be('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x91be('0x19')),'faxQueueReport':require(_0x91be('0x1a')),'whatsappQueueReport':require(_0x91be('0x1b')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x91be('0x1c')),'mailInteraction':require(_0x91be('0x1d')),'openchannelInteraction':require(_0x91be('0x1e')),'smsInteraction':require(_0x91be('0x1f')),'whatsappInteraction':require(_0x91be('0x20'))};var queue=schema({'name':{'type':_0x91be('0x21'),'required':!![],'message':_0x91be('0x22')},'timeout':{'type':_0x91be('0x23'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x3c2afc,_0x93255b,_0x579f29,_0x3c3add){if(_0x3c2afc&&_0x93255b&&_0x579f29){_0x93255b['waiting']+=0x1;var _0x1fc15a={'uniqueid':_0x3c2afc,'from':_0x579f29['body']?_0x579f29['body']['from']:'','joinAt':moment()[_0x91be('0x13')](_0x91be('0x24')),'ContactId':_0x579f29[_0x91be('0x25')]?_0x579f29[_0x91be('0x25')]['id']:null,'ListId':_0x579f29[_0x91be('0x26')]?_0x579f29[_0x91be('0x26')]['id']:null};_0x1fc15a[_[_0x91be('0x27')](_0x579f29['channel'])+_0x91be('0x28')]=_0x93255b['id']||null;_0x1fc15a[_['upperFirst'](_0x579f29[_0x91be('0x29')])+_0x91be('0x12')]=_0x579f29['interaction']?_0x579f29['interaction']['id']:null;_0x1fc15a[_[_0x91be('0x27')](_0x579f29['channel'])+_0x91be('0x2a')]=_0x579f29[_0x91be('0x2b')]?_0x579f29[_0x91be('0x2b')]['id']:null;_0x1fc15a[_[_0x91be('0x27')](_0x579f29[_0x91be('0x29')])+(_0x579f29[_0x91be('0x29')]!==_0x91be('0x2c')?_0x91be('0x2d'):'WebsiteId')]=_0x579f29['account']?_0x579f29[_0x91be('0x2e')]['id']:null;logger['info'](util['format'](_0x91be('0x2f'),_0x3c2afc,_0x93255b[_0x91be('0x30')]));emitChannelQueueInteraction(_0x579f29[_0x91be('0x29')],_0x93255b[_0x91be('0x30')],_0x1fc15a,_0x579f29[_0x91be('0x2e')][_0x91be('0x30')],_0x579f29[_0x91be('0x2b')]['id'],!![],_0x3c3add,_0x93255b['id']);if(rpc[_0x579f29[_0x91be('0x29')]+_0x91be('0x31')]){return rpc[_0x579f29['channel']+_0x91be('0x31')][_0x91be('0x32')](_0x1fc15a)[_0x91be('0x33')](function(_0x3e2354){logger['error'](_0x91be('0x34'),_0x3e2354);});}}}function stopRouting(_0x45f2bc,_0xab685f,_0x29f88d,_0x12384d){if(_0x45f2bc&&_0xab685f){_0xab685f[_0x91be('0x35')]-=0x1;var _0x364a75={'leaveAt':moment()[_0x91be('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x91be('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x91be('0x36')](util['format'](_0x91be('0x37'),_0x45f2bc,_0xab685f[_0x91be('0x30')]));emitChannelQueueInteraction(_0x29f88d[_0x91be('0x29')],_0xab685f['name'],_0x29f88d[_0x91be('0x38')],_0x29f88d['account'][_0x91be('0x30')],_0x29f88d[_0x91be('0x2b')]['id'],![],_0x12384d,_0xab685f['id']);return rpc[_0x29f88d['channel']+'Interaction'][_0x91be('0x39')](_0x29f88d[_0x91be('0x3a')]['id'],{'queueId':_0xab685f['id']})[_0x91be('0x3b')](function(){if(rpc[_0x29f88d[_0x91be('0x29')]+_0x91be('0x31')]){return rpc[_0x29f88d[_0x91be('0x29')]+'QueueReport'][_0x91be('0x39')](_0x45f2bc,_0x364a75)[_0x91be('0x33')](function(_0x296ea7){logger[_0x91be('0x3c')]('update\x20queue\x20report',_0x296ea7);});}});}}function endRouting(_0x48ce84,_0x4d334f,_0x3d0682,_0x3d351c){if(_0x48ce84&&_0x4d334f){_0x4d334f[_0x91be('0x35')]-=0x1;var _0x5e4cbc={'leaveAt':moment()[_0x91be('0x13')](_0x91be('0x24')),'exitAt':moment()[_0x91be('0x13')](_0x91be('0x24')),'reason':_0x91be('0x3d')};logger[_0x91be('0x36')](util['format'](_0x91be('0x3e'),_0x48ce84,_0x4d334f[_0x91be('0x30')]));emitChannelQueueInteraction(_0x3d0682['channel'],_0x4d334f['name'],_0x3d0682['body'],_0x3d0682[_0x91be('0x2e')][_0x91be('0x30')],_0x3d0682[_0x91be('0x2b')]['id'],![],_0x3d351c);if(rpc[_0x3d0682[_0x91be('0x29')]+_0x91be('0x31')]){return rpc[_0x3d0682['channel']+_0x91be('0x31')][_0x91be('0x39')](_0x48ce84,_0x5e4cbc)[_0x91be('0x33')](function(_0x1cccd1){logger[_0x91be('0x3c')](_0x91be('0x3f'),_0x1cccd1);});}}}function handleFindQueue(_0x4b8bca){return function(_0x153747){return _0x153747[_0x91be('0x30')][_0x91be('0x40')]()===_0x4b8bca['toLowerCase']();};}exports[_0x91be('0x41')]=function(_0x5ac644,_0xbe4440,_0x3d6033,_0x5ccba7){return function(_0x1e86dc){try{var _0x3a0c4b={'name':_0xbe4440[0x0],'timeout':_0xbe4440[0x1]};var _0x475329=queue[_0x91be('0x0')](_0x3a0c4b,{'typecast':!![]});if(_0x475329[_0x91be('0x42')]){logger[_0x91be('0x3c')](_0x91be('0x43'),_0x5ac644,_[_0x91be('0x44')](_0x475329,_0x91be('0x2b'))['join'](',\x20'));_0x1e86dc[_0x91be('0x45')]();}else{var _0x2b77cf=_['find'](_0x3d6033[_0x5ccba7[_0x91be('0x29')]+_0x91be('0x46')],handleFindQueue(_0x3a0c4b[_0x91be('0x30')]));if(_0x2b77cf){startRouting(_0x5ac644,_0x2b77cf,_0x5ccba7,_0x3d6033);var _0x3919ad=(_0x2b77cf[_0x91be('0x3d')]||0xa)*0x3e8;var _0x18c9d8=(_0x3a0c4b[_0x91be('0x3d')]||0x14)*0x3e8;var _0x2ed1da;if(_0x3919ad>_0x18c9d8){_0x18c9d8=_0x3919ad;}var _0x123049=seqqueue[_0x91be('0x47')](_0x3919ad);_0x123049['id']=_0x5ac644;_0x123049[_0x91be('0x48')]=_0x3919ad;_0x123049[_0x91be('0x49')]=_0x18c9d8;_0x123049['channel']=_0x5ccba7[_0x91be('0x29')];_0x3d6033[_0x91be('0x4a')][_0x5ac644]['on'](_0x91be('0x4b'),function(){logger[_0x91be('0x36')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5ac644);stopRouting(_0x5ac644,_0x2b77cf,_0x5ccba7,_0x3d6033);clearTimeout(_0x2ed1da);_0x2ed1da=undefined;_0x123049['close'](!![]);if(_0x3d6033[_0x91be('0x4a')][_0x5ac644]){delete _0x3d6033[_0x91be('0x4a')][_0x5ac644];}_0x1e86dc['stop']();});_0x3d6033[_0x91be('0x4a')][_0x5ac644]['on']('complete',function(){if(_0x3d6033[_0x91be('0x4a')][_0x5ac644]){delete _0x3d6033[_0x91be('0x4a')][_0x5ac644];}});_0x2ed1da=setTimeout(function(){logger[_0x91be('0x36')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x5ac644);endRouting(_0x5ac644,_0x2b77cf,_0x5ccba7,_0x3d6033);clearTimeout(_0x2ed1da);_0x123049['close'](!![]);_0x1e86dc[_0x91be('0x4c')]();},_0x18c9d8);switch(_0x2b77cf['strategy']){case _0x91be('0x4d'):strategy['rrmemory'](_0x123049,_0x2b77cf,_0x3d6033,_0x5ccba7);break;default:strategy[_0x91be('0x4e')](_0x123049,_0x2b77cf,_0x3d6033,_0x5ccba7);}}else{logger[_0x91be('0x3c')](_0x91be('0x4f'),_0x5ac644,_0x3a0c4b['name']);_0x1e86dc['stop']();}}}catch(_0x10a544){logger['error'](_0x91be('0x43'),_0x5ac644,_0x10a544[_0x91be('0x50')]);_0x1e86dc[_0x91be('0x45')]();}};}; \ No newline at end of file +var _0x2656=['WebsiteId','info','name','QueueReport','create','catch','create\x20queue\x20report','waiting','[%s][STOP:QUEUE][NAME:%s]','update','then','error','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','qtimeout','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','push','capitalize','format','%sQueuesWaitingInteractions','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','message','chat','AccountId'];(function(_0x383568,_0x30be55){var _0x52a2df=function(_0x2e65f2){while(--_0x2e65f2){_0x383568['push'](_0x383568['shift']());}};_0x52a2df(++_0x30be55);}(_0x2656,0x115));var _0x6265=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x2656[_0x589aee];return _0x2f5ed4;};'use strict';var schema=require(_0x6265('0x0'));var _=require(_0x6265('0x1'));var util=require(_0x6265('0x2'));var seqqueue=require(_0x6265('0x3'));var moment=require(_0x6265('0x4'));var Redis=require(_0x6265('0x5'));var config=require(_0x6265('0x6'));var logger=require(_0x6265('0x7'))(_0x6265('0x8'));var strategy=require(_0x6265('0x9'));config[_0x6265('0xa')]=_[_0x6265('0xb')](config['redis'],{'host':_0x6265('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6265('0xa')]));var attributes=['id','queue_id',_0x6265('0xd'),_0x6265('0xe'),_0x6265('0xf'),_0x6265('0x10')];function emit(_0x437945,_0x149394,_0x36cd3e){io['to'](_0x437945)[_0x6265('0x11')](_0x149394,_0x36cd3e);}function emitChannelQueueInteraction(_0x2ffdf8,_0x1e8ddb,_0x1cc1c3,_0x5290bb,_0x2ad798,_0x2da8b9,_0xb41ee1,_0x5f5cbf){var _0x3c3db6=_[_0x6265('0x12')](_0x1cc1c3);_0x3c3db6['queue_id']=_0x5f5cbf;_0x3c3db6[_0x6265('0xe')]=_0x1e8ddb;_0x3c3db6[_0x6265('0xd')]=_0x5290bb;_0x3c3db6['id']=_0x2ad798;if(_0x2da8b9){attributes[_0x6265('0x13')](_[_0x6265('0x14')](_0x2ffdf8)+'InteractionId');_0xb41ee1[util[_0x6265('0x15')](_0x6265('0x16'),_0x2ffdf8)][_0x2ad798]=_['pick'](_0x3c3db6,attributes);}else{delete _0xb41ee1[util[_0x6265('0x15')](_0x6265('0x16'),_0x2ffdf8)][_0x2ad798];}emit(util[_0x6265('0x15')]('%s:queue:%s',_0x2ffdf8,_0x1e8ddb),util[_0x6265('0x15')]('%s_queue_waiting_interaction:%s',_0x2ffdf8,_0x2da8b9?_0x6265('0x17'):_0x6265('0x18')),_[_0x6265('0x19')](_0x3c3db6,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6265('0x1a')),'chatQueueReport':require(_0x6265('0x1b')),'smsQueueReport':require(_0x6265('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6265('0x1d')),'chatInteraction':require(_0x6265('0x1e')),'faxInteraction':require(_0x6265('0x1f')),'mailInteraction':require(_0x6265('0x20')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6265('0x21')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x6265('0x22')},'timeout':{'type':_0x6265('0x23'),'message':_0x6265('0x24')}});function startRouting(_0x539bc3,_0x1b9554,_0x33cc74,_0x415f77){if(_0x539bc3&&_0x1b9554&&_0x33cc74){_0x1b9554['waiting']+=0x1;var _0x2cb854={'uniqueid':_0x539bc3,'from':_0x33cc74['body']?_0x33cc74[_0x6265('0x25')]['from']:'','joinAt':moment()['format'](_0x6265('0x26')),'ContactId':_0x33cc74[_0x6265('0x27')]?_0x33cc74['contact']['id']:null,'ListId':_0x33cc74[_0x6265('0x28')]?_0x33cc74[_0x6265('0x28')]['id']:null};_0x2cb854[_[_0x6265('0x29')](_0x33cc74['channel'])+'QueueId']=_0x1b9554['id']||null;_0x2cb854[_[_0x6265('0x29')](_0x33cc74[_0x6265('0x2a')])+'InteractionId']=_0x33cc74['interaction']?_0x33cc74[_0x6265('0x2b')]['id']:null;_0x2cb854[_['upperFirst'](_0x33cc74['channel'])+'MessageId']=_0x33cc74['message']?_0x33cc74[_0x6265('0x2c')]['id']:null;_0x2cb854[_['upperFirst'](_0x33cc74[_0x6265('0x2a')])+(_0x33cc74[_0x6265('0x2a')]!==_0x6265('0x2d')?_0x6265('0x2e'):_0x6265('0x2f'))]=_0x33cc74[_0x6265('0xd')]?_0x33cc74['account']['id']:null;logger[_0x6265('0x30')](util[_0x6265('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x539bc3,_0x1b9554['name']));emitChannelQueueInteraction(_0x33cc74[_0x6265('0x2a')],_0x1b9554[_0x6265('0x31')],_0x2cb854,_0x33cc74[_0x6265('0xd')][_0x6265('0x31')],_0x33cc74[_0x6265('0x2c')]['id'],!![],_0x415f77,_0x1b9554['id']);if(rpc[_0x33cc74[_0x6265('0x2a')]+'QueueReport']){return rpc[_0x33cc74[_0x6265('0x2a')]+_0x6265('0x32')][_0x6265('0x33')](_0x2cb854)[_0x6265('0x34')](function(_0x57c000){logger['error'](_0x6265('0x35'),_0x57c000);});}}}function stopRouting(_0x2090c6,_0x448fc1,_0x4ef278,_0x1f57c9){if(_0x2090c6&&_0x448fc1){_0x448fc1[_0x6265('0x36')]-=0x1;var _0x4c7a07={'leaveAt':moment()[_0x6265('0x15')](_0x6265('0x26')),'acceptAt':moment()[_0x6265('0x15')](_0x6265('0x26')),'reason':'accepted'};logger[_0x6265('0x30')](util[_0x6265('0x15')](_0x6265('0x37'),_0x2090c6,_0x448fc1['name']));emitChannelQueueInteraction(_0x4ef278[_0x6265('0x2a')],_0x448fc1[_0x6265('0x31')],_0x4ef278[_0x6265('0x25')],_0x4ef278['account'][_0x6265('0x31')],_0x4ef278[_0x6265('0x2c')]['id'],![],_0x1f57c9,_0x448fc1['id']);return rpc[_0x4ef278[_0x6265('0x2a')]+'Interaction'][_0x6265('0x38')](_0x4ef278['interaction']['id'],{'queueId':_0x448fc1['id']})[_0x6265('0x39')](function(){if(rpc[_0x4ef278['channel']+'QueueReport']){return rpc[_0x4ef278[_0x6265('0x2a')]+_0x6265('0x32')][_0x6265('0x38')](_0x2090c6,_0x4c7a07)[_0x6265('0x34')](function(_0x4a5fe7){logger[_0x6265('0x3a')]('update\x20queue\x20report',_0x4a5fe7);});}});}}function endRouting(_0x15a81d,_0x411f25,_0x54b048,_0x259026){if(_0x15a81d&&_0x411f25){_0x411f25[_0x6265('0x36')]-=0x1;var _0x508aa6={'leaveAt':moment()[_0x6265('0x15')](_0x6265('0x26')),'exitAt':moment()[_0x6265('0x15')](_0x6265('0x26')),'reason':_0x6265('0x3b')};logger['info'](util['format'](_0x6265('0x3c'),_0x15a81d,_0x411f25[_0x6265('0x31')]));emitChannelQueueInteraction(_0x54b048[_0x6265('0x2a')],_0x411f25['name'],_0x54b048[_0x6265('0x25')],_0x54b048[_0x6265('0xd')]['name'],_0x54b048['message']['id'],![],_0x259026);if(rpc[_0x54b048[_0x6265('0x2a')]+_0x6265('0x32')]){return rpc[_0x54b048[_0x6265('0x2a')]+_0x6265('0x32')][_0x6265('0x38')](_0x15a81d,_0x508aa6)['catch'](function(_0x2da813){logger[_0x6265('0x3a')](_0x6265('0x3d'),_0x2da813);});}}}function handleFindQueue(_0x1058fd){return function(_0x509790){return _0x509790[_0x6265('0x31')][_0x6265('0x3e')]()===_0x1058fd[_0x6265('0x3e')]();};}exports[_0x6265('0x3f')]=function(_0x5c7f00,_0x45ec5a,_0x2c35f3,_0xa11699){return function(_0x55da5a){try{var _0x151adb={'name':_0x45ec5a[0x0],'timeout':_0x45ec5a[0x1]};var _0x59bdfe=queue[_0x6265('0x0')](_0x151adb,{'typecast':!![]});if(_0x59bdfe[_0x6265('0x40')]){logger[_0x6265('0x3a')](_0x6265('0x41'),_0x5c7f00,_[_0x6265('0x42')](_0x59bdfe,'message')['join'](',\x20'));_0x55da5a[_0x6265('0x43')]();}else{var _0x1a6674=_['find'](_0x2c35f3[_0xa11699[_0x6265('0x2a')]+_0x6265('0x44')],handleFindQueue(_0x151adb[_0x6265('0x31')]));if(_0x1a6674){startRouting(_0x5c7f00,_0x1a6674,_0xa11699,_0x2c35f3);var _0x4819dc=(_0x1a6674[_0x6265('0x3b')]||0xa)*0x3e8;var _0x1e57fe=(_0x151adb[_0x6265('0x3b')]||0x14)*0x3e8;var _0x123eea;if(_0x4819dc>_0x1e57fe){_0x1e57fe=_0x4819dc;}var _0xa77b=seqqueue[_0x6265('0x45')](_0x4819dc);_0xa77b['id']=_0x5c7f00;_0xa77b[_0x6265('0x46')]=_0x4819dc;_0xa77b[_0x6265('0x47')]=_0x1e57fe;_0xa77b[_0x6265('0x2a')]=_0xa11699[_0x6265('0x2a')];_0x2c35f3[_0x6265('0x48')][_0x5c7f00]['on'](_0x6265('0x49'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5c7f00);stopRouting(_0x5c7f00,_0x1a6674,_0xa11699,_0x2c35f3);clearTimeout(_0x123eea);_0x123eea=undefined;_0xa77b['close'](!![]);if(_0x2c35f3[_0x6265('0x48')][_0x5c7f00]){delete _0x2c35f3[_0x6265('0x48')][_0x5c7f00];}_0x55da5a[_0x6265('0x43')]();});_0x2c35f3[_0x6265('0x48')][_0x5c7f00]['on'](_0x6265('0x4a'),function(){if(_0x2c35f3['rules'][_0x5c7f00]){delete _0x2c35f3[_0x6265('0x48')][_0x5c7f00];}});_0x123eea=setTimeout(function(){logger[_0x6265('0x30')](_0x6265('0x4b'),_0x5c7f00);endRouting(_0x5c7f00,_0x1a6674,_0xa11699,_0x2c35f3);clearTimeout(_0x123eea);_0xa77b[_0x6265('0x4c')](!![]);_0x55da5a[_0x6265('0x4d')]();},_0x1e57fe);switch(_0x1a6674['strategy']){case _0x6265('0x4e'):strategy[_0x6265('0x4e')](_0xa77b,_0x1a6674,_0x2c35f3,_0xa11699);break;default:strategy[_0x6265('0x4f')](_0xa77b,_0x1a6674,_0x2c35f3,_0xa11699);}}else{logger[_0x6265('0x3a')](_0x6265('0x50'),_0x5c7f00,_0x151adb[_0x6265('0x31')]);_0x55da5a[_0x6265('0x43')]();}}}catch(_0x523a95){logger['error'](_0x6265('0x41'),_0x5c7f00,_0x523a95['stack']);_0x55da5a['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 b3e07f7..ed91000 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 _0x4d9e=['lodash','../../../../../config/logger','squeue','agent','realtime','routing','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','debug','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports'];(function(_0x30d526,_0x44d080){var _0x2cef94=function(_0x226038){while(--_0x226038){_0x30d526['push'](_0x30d526['shift']());}};_0x2cef94(++_0x44d080);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x26f92c,_0x465ebb){_0x26f92c=_0x26f92c-0x0;var _0x109058=_0x4d9e[_0x26f92c];return _0x109058;};'use strict';var _=require(_0xe4d9('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xe4d9('0x1'))('routing');var Agent=function(_0x36adac,_0x4d7687,_0x2c6990,_0x2deaef){this['notificationId']=uuid['v4']();this[_0xe4d9('0x2')]=_0x36adac;this[_0xe4d9('0x3')]=_0x4d7687;this[_0xe4d9('0x4')]=_0x2c6990;this[_0xe4d9('0x5')]=_0x2deaef;this[_0xe4d9('0x2')][_0xe4d9('0x6')](this['handleRun'][_0xe4d9('0x7')](this),this[_0xe4d9('0x8')][_0xe4d9('0x7')](this));this[_0xe4d9('0x2')]['on'](_0xe4d9('0x9'),this[_0xe4d9('0x8')]['bind'](this));this[_0xe4d9('0x2')]['on'](_0xe4d9('0xa'),this[_0xe4d9('0xb')][_0xe4d9('0x7')](this));};Agent[_0xe4d9('0xc')][_0xe4d9('0x6')]=function(){this[_0xe4d9('0x2')]['push'](this['handleRun']['bind'](this),this['handleTimeout']['bind'](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xe4d9('0xc')][_0xe4d9('0xd')]=function(){logger[_0xe4d9('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x3')]['id']);if(_[_0xe4d9('0xf')](this[_0xe4d9('0x4')]['agents'][this[_0xe4d9('0x3')]['id']])){logger[_0xe4d9('0xe')](_0xe4d9('0x10'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xe4d9('0x6')][_0xe4d9('0x7')](this),0x3e8);}else{if(this['routing'][_0xe4d9('0x11')]||util['isAgentAvailable'](this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']],this['squeue'][_0xe4d9('0x13')],![])){this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']][_0xe4d9('0x14')]=!![];this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']][_0xe4d9('0x15')]=undefined;util['saveWaitingNotification'](this[_0xe4d9('0x4')],this[_0xe4d9('0x5')],this['agent'],this[_0xe4d9('0x2')]['channel']);util[_0xe4d9('0x16')](this[_0xe4d9('0x17')],this['squeue']['id'],this[_0xe4d9('0x4')][_0xe4d9('0x12')][this['agent']['id']],null,this[_0xe4d9('0x5')]);util[_0xe4d9('0x18')](this[_0xe4d9('0x2')]['id'],this['realtime']['agents'][this[_0xe4d9('0x3')]['id']],_0xe4d9('0x19')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xe4d9('0x1a'),this['squeue']['id'],this[_0xe4d9('0x3')]['id']);setTimeout(this[_0xe4d9('0x6')][_0xe4d9('0x7')](this),0x3e8);}}};Agent['prototype'][_0xe4d9('0x8')]=function(_0x2a0d1f){if(_[_0xe4d9('0xf')](this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']])){return logger[_0xe4d9('0xe')](_0xe4d9('0x10'),this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x3')]['id']);}else{logger[_0xe4d9('0xe')](_0xe4d9('0x1b'),this['squeue']['id'],this[_0xe4d9('0x3')]['id']);util[_0xe4d9('0x1c')](this[_0xe4d9('0x17')],this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x4')][_0xe4d9('0x12')][this['agent']['id']],null,this['routing']);this['realtime'][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']][_0xe4d9('0x14')]=![];this['realtime']['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xe4d9('0x1d')](this[_0xe4d9('0x4')],this['routing'],this[_0xe4d9('0x3')],this[_0xe4d9('0x2')]['channel']);util[_0xe4d9('0x18')](this[_0xe4d9('0x2')]['id'],this[_0xe4d9('0x4')][_0xe4d9('0x12')][this[_0xe4d9('0x3')]['id']],_0x2a0d1f?_0xe4d9('0x1e'):_0xe4d9('0x1f'));}if(!_0x2a0d1f){setTimeout(this[_0xe4d9('0x6')][_0xe4d9('0x7')](this),0x3e8);}};function agent(_0x20cc89,_0x179618,_0x517f24,_0x234b62){return new Agent(_0x20cc89,_0x179618,_0x517f24,_0x234b62);}module[_0xe4d9('0x20')]=agent; \ No newline at end of file +var _0xc3b5=['agents','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x10b301,_0x565f95){_0x10b301=_0x10b301-0x0;var _0x440a6b=_0xc3b5[_0x10b301];return _0x440a6b;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x5c3b('0x0'));var logger=require(_0x5c3b('0x1'))(_0x5c3b('0x2'));var Agent=function(_0x3acf12,_0x2f9a72,_0x34be81,_0x237a61){this[_0x5c3b('0x3')]=uuid['v4']();this['squeue']=_0x3acf12;this[_0x5c3b('0x4')]=_0x2f9a72;this[_0x5c3b('0x5')]=_0x34be81;this['routing']=_0x237a61;this[_0x5c3b('0x6')][_0x5c3b('0x7')](this[_0x5c3b('0x8')][_0x5c3b('0x9')](this),this['handleTimeout'][_0x5c3b('0x9')](this));this[_0x5c3b('0x6')]['on'](_0x5c3b('0xa'),this[_0x5c3b('0xb')]['bind'](this));this[_0x5c3b('0x6')]['on'](_0x5c3b('0xc'),this[_0x5c3b('0xd')][_0x5c3b('0x9')](this));};Agent[_0x5c3b('0xe')]['push']=function(){this[_0x5c3b('0x6')][_0x5c3b('0x7')](this['handleRun'][_0x5c3b('0x9')](this),this[_0x5c3b('0xb')]['bind'](this));};Agent[_0x5c3b('0xe')][_0x5c3b('0xd')]=function(){this[_0x5c3b('0xb')](!![]);};Agent[_0x5c3b('0xe')][_0x5c3b('0x8')]=function(){logger[_0x5c3b('0xf')](_0x5c3b('0x10'),this['squeue']['id'],this[_0x5c3b('0x4')]['id']);if(_['isNil'](this['realtime'][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']])){logger[_0x5c3b('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5c3b('0x6')]['id'],this[_0x5c3b('0x4')]['id']);setTimeout(this[_0x5c3b('0x7')]['bind'](this),0x3e8);}else{if(this[_0x5c3b('0x2')][_0x5c3b('0x12')]||util['isAgentAvailable'](this[_0x5c3b('0x6')]['id'],this[_0x5c3b('0x5')][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']],this[_0x5c3b('0x6')][_0x5c3b('0x13')],![])){this[_0x5c3b('0x5')][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']][_0x5c3b('0x14')]=!![];this['realtime']['agents'][this[_0x5c3b('0x4')]['id']][_0x5c3b('0x15')]=undefined;util['saveWaitingNotification'](this[_0x5c3b('0x5')],this['routing'],this[_0x5c3b('0x4')],this[_0x5c3b('0x6')][_0x5c3b('0x13')]);util[_0x5c3b('0x16')](this['notificationId'],this[_0x5c3b('0x6')]['id'],this[_0x5c3b('0x5')]['agents'][this[_0x5c3b('0x4')]['id']],null,this[_0x5c3b('0x2')]);util[_0x5c3b('0x17')](this[_0x5c3b('0x6')]['id'],this['realtime'][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']],_0x5c3b('0x18')+(this[_0x5c3b('0x2')][_0x5c3b('0x12')]?_0x5c3b('0x19'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x5c3b('0x4')]['id']);setTimeout(this[_0x5c3b('0x7')]['bind'](this),0x3e8);}}};Agent[_0x5c3b('0xe')][_0x5c3b('0xb')]=function(_0x421d96){if(_[_0x5c3b('0x1a')](this[_0x5c3b('0x5')][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']])){return logger[_0x5c3b('0xf')](_0x5c3b('0x1b'),this[_0x5c3b('0x6')]['id'],this[_0x5c3b('0x4')]['id']);}else{logger[_0x5c3b('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x5c3b('0x6')]['id'],this[_0x5c3b('0x4')]['id']);util[_0x5c3b('0x1c')](this[_0x5c3b('0x3')],this[_0x5c3b('0x6')]['id'],this[_0x5c3b('0x5')][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']],null,this[_0x5c3b('0x2')]);this[_0x5c3b('0x5')][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']][_0x5c3b('0x14')]=![];this[_0x5c3b('0x5')][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']][_0x5c3b('0x15')]=undefined;util['removeWaitingNotification'](this[_0x5c3b('0x5')],this[_0x5c3b('0x2')],this[_0x5c3b('0x4')],this[_0x5c3b('0x6')]['channel']);util[_0x5c3b('0x17')](this[_0x5c3b('0x6')]['id'],this['realtime'][_0x5c3b('0x11')][this[_0x5c3b('0x4')]['id']],_0x421d96?_0x5c3b('0x1d'):_0x5c3b('0x1e'));}if(!_0x421d96){setTimeout(this[_0x5c3b('0x7')][_0x5c3b('0x9')](this),0x3e8);}};function agent(_0x27b34d,_0x22fe25,_0x1fa1df,_0x5217bd){return new Agent(_0x27b34d,_0x22fe25,_0x1fa1df,_0x5217bd);}module[_0x5c3b('0x1f')]=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 4fac2b8..cb79068 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 _0x4f07=['routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','name','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','busyQueue','removeWaitingNotification','lodash','uuid','./util','../../../../../config/logger'];(function(_0x784e31,_0x51f0f1){var _0x221db5=function(_0x18c42c){while(--_0x18c42c){_0x784e31['push'](_0x784e31['shift']());}};_0x221db5(++_0x51f0f1);}(_0x4f07,0xb5));var _0x74f0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4f07[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x74f0('0x0'));var uuid=require(_0x74f0('0x1'));var util=require(_0x74f0('0x2'));var logger=require(_0x74f0('0x3'))(_0x74f0('0x4'));var Beepall=function(_0x5f0100,_0x1207e5,_0xdccd0b,_0x259cda){this[_0x74f0('0x5')]=uuid['v4']();this[_0x74f0('0x6')]=_0x5f0100;this[_0x74f0('0x7')]=_0x1207e5;this[_0x74f0('0x8')]=_0xdccd0b;this['routing']=_0x259cda;this[_0x74f0('0x6')][_0x74f0('0x9')](this[_0x74f0('0xa')]['bind'](this),this[_0x74f0('0xb')][_0x74f0('0xc')](this));this[_0x74f0('0x6')]['on'](_0x74f0('0xd'),this['handleTimeout'][_0x74f0('0xc')](this));this['squeue']['on'](_0x74f0('0xe'),this[_0x74f0('0xf')][_0x74f0('0xc')](this));};Beepall[_0x74f0('0x10')][_0x74f0('0x9')]=function(){this[_0x74f0('0x6')]['push'](this[_0x74f0('0xa')][_0x74f0('0xc')](this),this[_0x74f0('0xb')][_0x74f0('0xc')](this));};Beepall[_0x74f0('0x10')][_0x74f0('0xf')]=function(){this[_0x74f0('0xb')](!![]);};Beepall['prototype'][_0x74f0('0xa')]=function(){var _0x281199=!![];if(!_[_0x74f0('0x11')](this[_0x74f0('0x7')])&&!_['isNil'](this[_0x74f0('0x7')][_0x74f0('0x12')])&&this[_0x74f0('0x7')][_0x74f0('0x12')][_0x74f0('0x13')]>0x0){for(var _0x2806b6=0x0,_0x4eb8ca;_0x2806b60x0){for(var _0x4fe0e4=0x0,_0x2502c5;_0x4fe0e40x0&&_0x5762cc[_0x31999f+_0x3754('0x22')]>=_0x5762cc[_0x31999f+_0x3754('0x21')]){writeLog(_0x3149eb,_0x5762cc,_0x31999f['toUpperCase']()+_0x3754('0x23'));return![];}}return!![];};exports[_0x3754('0x24')]=function(_0x1ca092,_0x73707c,_0x132a34,_0x327f58,_0x1d1879){return sendNotification(!![],_0x1ca092,_0x73707c,_0x132a34,_0x327f58,_0x1d1879);};exports['hideNotification']=function(_0xc04375,_0x21b7c3,_0x78f082,_0x16d172,_0x510783){return sendNotification(![],_0xc04375,_0x21b7c3,_0x78f082,_0x16d172,_0x510783);};exports[_0x3754('0x25')]=function(_0x29c3b9,_0x2a4d0c,_0x27a327){var _0x13ba06=_0x2a4d0c[_0x3754('0x26')]['UserId'];if(!_0x13ba06&&_0x27a327){_0x13ba06=_0x27a327['id'];}var _0x45215e=_[_0x3754('0x27')](_0x29c3b9[_0x2a4d0c[_0x3754('0x28')]+_0x3754('0x29')],function(_0x335f4e){var _0x181977=_['capitalize'](_0x2a4d0c['channel'])+_0x3754('0x2a');return _0x335f4e[_0x181977]===_0x2a4d0c[_0x3754('0x26')]['id'];});if(!_0x45215e&&_0x13ba06&&_0x29c3b9[_0x3754('0x2b')][_0x13ba06]){_0x45215e=_['some'](_0x29c3b9[_0x3754('0x2b')][_0x13ba06][_0x2a4d0c['channel']+_0x3754('0x2c')],function(_0x136172){return _0x136172['id']===_0x2a4d0c[_0x3754('0x26')]['id'];});}return _0x45215e;};exports[_0x3754('0x2d')]=function(_0x373831,_0x62c0a3,_0x297e35,_0x4a6e23){if(_0x297e35&&_0x297e35['id']&&_0x373831[_0x3754('0x2b')]&&_0x373831['agents'][_0x297e35['id']]){_0x373831[_0x3754('0x2b')][_0x297e35['id']][_0x4a6e23+'WaitingInteractions'][_0x62c0a3[_0x3754('0x2e')]['id']]={'id':_0x62c0a3[_0x3754('0x26')]['id']};}};exports[_0x3754('0x2f')]=function(_0x207fe7,_0x466b5f,_0x4be655,_0x2d7dbe){if(_0x4be655&&_0x4be655['id']&&_0x207fe7[_0x3754('0x2b')]&&_0x207fe7[_0x3754('0x2b')][_0x4be655['id']]){delete _0x207fe7[_0x3754('0x2b')][_0x4be655['id']][_0x2d7dbe+_0x3754('0x2c')][_0x466b5f[_0x3754('0x2e')]['id']];}};exports[_0x3754('0x30')]=writeLog; \ No newline at end of file +var _0xde4d=['InteractionId','interaction','agents','saveWaitingNotification','WaitingInteractions','message','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','socket.io-emitter','split','\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','error','format','user:%s','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','UserId','channel','capitalize'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0xde4d,0xf1));var _0xdde4=function(_0x376c55,_0x24a86b){_0x376c55=_0x376c55-0x0;var _0x5bfaf2=_0xde4d[_0x376c55];return _0x5bfaf2;};'use strict';var _=require(_0xdde4('0x0'));var util=require(_0xdde4('0x1'));var utils=require(_0xdde4('0x2'));var Redis=require(_0xdde4('0x3'));var config=require(_0xdde4('0x4'));var logger=require(_0xdde4('0x5'))('routing');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdde4('0x6'))(new Redis(config['redis']));function sendNotification(_0x3d7216,_0x4aaec3,_0xa7be0e,_0x130f05,_0x3b998e,_0x29f975){var _0x2d358e=_0x29f975||{};var _0x49ab01=_0xa7be0e[_0xdde4('0x7')]('.');var _0x507d62={'uniqueid':_0x4aaec3,'channel':_0x49ab01[0x0],'id':_0x49ab01[0x1],'title':_0x49ab01[0x0]+_0xdde4('0x8'),'interactionId':_0x49ab01[0x2],'queue':_0x3b998e?_0x3b998e[_0xdde4('0x9')]:null,'sound':_0x2d358e[_0xdde4('0xa')][_0xdde4('0xb')],'shake':_0x2d358e[_0xdde4('0xa')]['notificationShake']};try{if(!_0x2d358e[_0xdde4('0xc')]){_0x2d358e['body']={};}if(_0x3b998e){_0x2d358e[_0xdde4('0xc')][_0xdde4('0xd')]=_0x3b998e;}else if(_0x2d358e[_0xdde4('0xc')][_0xdde4('0xd')]){delete _0x2d358e[_0xdde4('0xc')][_0xdde4('0xd')];}_0x507d62[_0xdde4('0xe')]=utils[_0xdde4('0xf')](_0x2d358e[_0xdde4('0xa')][_0xdde4('0x10')],_0x2d358e);}catch(_0x1d7223){_0x507d62[_0xdde4('0xe')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xdde4('0x11')](util[_0xdde4('0x12')]('[%s][QUEUE]\x20%s',_0x4aaec3,_0x1d7223['message']));}io['to'](util[_0xdde4('0x12')](_0xdde4('0x13'),_0x130f05[_0xdde4('0x9')]))[_0xdde4('0x14')](util['format'](_0xdde4('0x15'),_0x3d7216?_0xdde4('0x16'):_0xdde4('0x17')),_0x507d62);}function writeLog(_0x5c9e18,_0x1bb1f1,_0x4908f0){return logger[_0xdde4('0x18')](util[_0xdde4('0x12')](_0xdde4('0x19'),_0x5c9e18,_0x1bb1f1[_0xdde4('0x9')],_0x4908f0));}exports['isAgentAvailable']=function(_0x3e4731,_0x5ce7e5,_0xc64917,_0x1dcc69){if(_0x5ce7e5[_0xdde4('0x1a')]){writeLog(_0x3e4731,_0x5ce7e5,'BUSY');return![];}if(!_0x5ce7e5[_0xdde4('0x1b')]){writeLog(_0x3e4731,_0x5ce7e5,_0xdde4('0x1c'));return![];}if(_0x5ce7e5[_0xc64917+_0xdde4('0x1d')]){writeLog(_0x3e4731,_0x5ce7e5,_0xdde4('0x1e'));return![];}if(_0x1dcc69&&_0x5ce7e5[_0xdde4('0x1f')](_0xc64917+_0xdde4('0x20'))&&_0x5ce7e5['hasOwnProperty'](_0xc64917+'CurrentCapacity')){if(_0x5ce7e5[_0xc64917+_0xdde4('0x20')]>0x0&&_0x5ce7e5[_0xc64917+'CurrentCapacity']>=_0x5ce7e5[_0xc64917+_0xdde4('0x20')]){writeLog(_0x3e4731,_0x5ce7e5,_0xc64917[_0xdde4('0x21')]()+_0xdde4('0x22'));return![];}}return!![];};exports[_0xdde4('0x23')]=function(_0x277d2c,_0x45c31a,_0x3f6387,_0x53f398,_0xc3fe73){return sendNotification(!![],_0x277d2c,_0x45c31a,_0x3f6387,_0x53f398,_0xc3fe73);};exports[_0xdde4('0x24')]=function(_0x4a95ed,_0x46ddf9,_0x4517e6,_0x112370,_0x171d41){return sendNotification(![],_0x4a95ed,_0x46ddf9,_0x4517e6,_0x112370,_0x171d41);};exports[_0xdde4('0x25')]=function(_0x3e704c,_0x2bc358,_0x1df433){var _0x1890b3=_0x2bc358['interaction'][_0xdde4('0x26')];if(!_0x1890b3&&_0x1df433){_0x1890b3=_0x1df433['id'];}var _0x46199d=_['some'](_0x3e704c[_0x2bc358[_0xdde4('0x27')]+'QueuesWaitingInteractions'],function(_0x5d92b9){var _0x17c4ba=_[_0xdde4('0x28')](_0x2bc358['channel'])+_0xdde4('0x29');return _0x5d92b9[_0x17c4ba]===_0x2bc358[_0xdde4('0x2a')]['id'];});if(!_0x46199d&&_0x1890b3&&_0x3e704c[_0xdde4('0x2b')][_0x1890b3]){_0x46199d=_['some'](_0x3e704c[_0xdde4('0x2b')][_0x1890b3][_0x2bc358[_0xdde4('0x27')]+'WaitingInteractions'],function(_0x20e542){return _0x20e542['id']===_0x2bc358[_0xdde4('0x2a')]['id'];});}return _0x46199d;};exports[_0xdde4('0x2c')]=function(_0x3d9968,_0x1605b3,_0xcf46af,_0x2bab62){if(_0xcf46af&&_0xcf46af['id']&&_0x3d9968[_0xdde4('0x2b')]&&_0x3d9968[_0xdde4('0x2b')][_0xcf46af['id']]){_0x3d9968['agents'][_0xcf46af['id']][_0x2bab62+_0xdde4('0x2d')][_0x1605b3['message']['id']]={'id':_0x1605b3[_0xdde4('0x2a')]['id']};}};exports['removeWaitingNotification']=function(_0xc2934d,_0x4c1c1f,_0x1e2d95,_0x132afb){if(_0x1e2d95&&_0x1e2d95['id']&&_0xc2934d[_0xdde4('0x2b')]&&_0xc2934d['agents'][_0x1e2d95['id']]){delete _0xc2934d[_0xdde4('0x2b')][_0x1e2d95['id']][_0x132afb+_0xdde4('0x2d')][_0x4c1c1f[_0xdde4('0x2e')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 4b4758c..d68b21c 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 _0x9366=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x596fb9,_0x3f0673){var _0x365533=function(_0x2b61bc){while(--_0x2b61bc){_0x596fb9['push'](_0x596fb9['shift']());}};_0x365533(++_0x3f0673);}(_0x9366,0x14a));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var sh=require(_0x6936('0x0'));var _=require(_0x6936('0x1'));var utils=require(_0x6936('0x2'));var logger=require(_0x6936('0x3'))(_0x6936('0x4'));var system=schema({'command':{'type':_0x6936('0x5'),'required':!![],'message':_0x6936('0x6')}});exports['consequence']=function(_0xe46b2a,_0x441795){return function(_0x29ac43){try{var _0x2b36cc={'command':_0x441795[0x0]};var _0x3ad113=system['validate'](_0x2b36cc,{'typecast':!![]});if(_0x3ad113['length']){logger[_0x6936('0x7')](_0x6936('0x8'),_0xe46b2a,_['map'](_0x3ad113,'message')['join'](',\x20'));logger[_0x6936('0x9')](_0x6936('0xa'),_0xe46b2a);_0x29ac43[_0x6936('0xb')]();}else{var _0x2b0b94=this;var _0x36e364=utils['getMustacheRender'](_0x441795[0x0],this);logger[_0x6936('0x9')]('[%s][SYSTEM]\x20commnad:\x20%s',_0xe46b2a,_0x36e364);sh[_0x6936('0xc')](_[_0x6936('0xd')](_0x36e364),function(_0x52b163,_0x13c5d2){logger[_0x6936('0x9')](_0x6936('0xe'),_0xe46b2a,_0x52b163);if(_0x52b163==0x0){var _0x3d50f4=_0x13c5d2[_0x6936('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x441795[0x1])||_[_0x6936('0x10')](_0x441795[0x1])){logger[_0x6936('0x9')](_0x6936('0x11'),_0xe46b2a);_0x2b0b94['body'][_0x441795[0x1]]=_0x3d50f4;}else{logger[_0x6936('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xe46b2a,_0x441795[0x1],_0x3d50f4);_0x2b0b94[_0x6936('0x12')][_0x441795[0x1]]=_0x3d50f4;}}_0x29ac43[_0x6936('0xb')]();});}}catch(_0x37a9c1){logger[_0x6936('0x7')](_0x6936('0x8'),_0xe46b2a,_[_0x6936('0x13')](_0x37a9c1)?JSON[_0x6936('0x14')](_0x37a9c1):_0x37a9c1);logger[_0x6936('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xe46b2a);_0x29ac43['next']();}};}; \ No newline at end of file +var _0xeb1e=['isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','next','info','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body'];(function(_0x44e0a9,_0x59eee7){var _0x4ceee4=function(_0x2947d4){while(--_0x2947d4){_0x44e0a9['push'](_0x44e0a9['shift']());}};_0x4ceee4(++_0x59eee7);}(_0xeb1e,0x115));var _0xeeb1=function(_0x5489ae,_0x397f55){_0x5489ae=_0x5489ae-0x0;var _0x48b009=_0xeb1e[_0x5489ae];return _0x48b009;};'use strict';var schema=require(_0xeeb1('0x0'));var sh=require(_0xeeb1('0x1'));var _=require(_0xeeb1('0x2'));var utils=require(_0xeeb1('0x3'));var logger=require('../../../../config/logger')(_0xeeb1('0x4'));var system=schema({'command':{'type':_0xeeb1('0x5'),'required':!![],'message':_0xeeb1('0x6')}});exports[_0xeeb1('0x7')]=function(_0x593f23,_0x120eae){return function(_0x27e405){try{var _0x51716a={'command':_0x120eae[0x0]};var _0x3b7d8d=system['validate'](_0x51716a,{'typecast':!![]});if(_0x3b7d8d[_0xeeb1('0x8')]){logger[_0xeeb1('0x9')](_0xeeb1('0xa'),_0x593f23,_[_0xeeb1('0xb')](_0x3b7d8d,_0xeeb1('0xc'))['join'](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x593f23);_0x27e405[_0xeeb1('0xd')]();}else{var _0x31b91d=this;var _0x55b2e3=utils['getMustacheRender'](_0x120eae[0x0],this);logger[_0xeeb1('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x593f23,_0x55b2e3);sh[_0xeeb1('0xf')](_[_0xeeb1('0x10')](_0x55b2e3),function(_0x5148ef,_0x2fb682){logger[_0xeeb1('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x593f23,_0x5148ef);if(_0x5148ef==0x0){var _0x32871d=_0x2fb682[_0xeeb1('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xeeb1('0x12')](_0x120eae[0x1])||_[_0xeeb1('0x13')](_0x120eae[0x1])){logger['info'](_0xeeb1('0x14'),_0x593f23);_0x31b91d['body'][_0x120eae[0x1]]=_0x32871d;}else{logger[_0xeeb1('0xe')](_0xeeb1('0x15'),_0x593f23,_0x120eae[0x1],_0x32871d);_0x31b91d[_0xeeb1('0x16')][_0x120eae[0x1]]=_0x32871d;}}_0x27e405[_0xeeb1('0xd')]();});}}catch(_0x34a3b5){logger[_0xeeb1('0x9')](_0xeeb1('0xa'),_0x593f23,_[_0xeeb1('0x17')](_0x34a3b5)?JSON['stringify'](_0x34a3b5):_0x34a3b5);logger[_0xeeb1('0xe')](_0xeeb1('0x18'),_0x593f23);_0x27e405['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index d7953d1..c4b7233 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 _0xaafe=['addTags','interaction','then','catch','[%s][TAG]\x20%s','stringify','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../../../config/logger','routing','consequence','length','error','map','message','join','next','channel','Interaction'];(function(_0xed03d5,_0x5e89f6){var _0x291d16=function(_0x2bd203){while(--_0x2bd203){_0xed03d5['push'](_0xed03d5['shift']());}};_0x291d16(++_0x5e89f6);}(_0xaafe,0x18a));var _0xeaaf=function(_0x4f7648,_0x4bc880){_0x4f7648=_0x4f7648-0x0;var _0x1b224a=_0xaafe[_0x4f7648];return _0x1b224a;};'use strict';var schema=require(_0xeaaf('0x0'));var _=require(_0xeaaf('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xeaaf('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xeaaf('0x3'))(_0xeaaf('0x4'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xeaaf('0x5')]=function(_0x554d10,_0x4a8d7c,_0x2bd94d,_0xd0443e){return function(_0x4f0928){try{var _0x50adb2={'tag':_0x4a8d7c[0x0]};var _0x327b3d=tag['validate'](_0x50adb2,{'typecast':!![]});if(_0x327b3d[_0xeaaf('0x6')]){logger[_0xeaaf('0x7')]('[%s][TAG]\x20%s',_0x554d10,_[_0xeaaf('0x8')](_0x327b3d,_0xeaaf('0x9'))[_0xeaaf('0xa')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x554d10);_0x4f0928[_0xeaaf('0xb')]();}else{var _0x17b881={'ids':[_0x4a8d7c[0x0]]};if(rpc[_0xd0443e[_0xeaaf('0xc')]+_0xeaaf('0xd')]){rpc[_0xd0443e[_0xeaaf('0xc')]+_0xeaaf('0xd')][_0xeaaf('0xe')](_0xd0443e[_0xeaaf('0xf')]['id'],_0x17b881)[_0xeaaf('0x10')](function(_0x43c10d){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x554d10,_0x4a8d7c[0x1],_0xd0443e[_0xeaaf('0xc')],_0xd0443e[_0xeaaf('0xf')]['id']);})[_0xeaaf('0x11')](function(_0x593156){logger[_0xeaaf('0x7')](_0xeaaf('0x12'),_0x554d10,JSON[_0xeaaf('0x13')](_0x593156));logger[_0xeaaf('0x14')](_0xeaaf('0x15'),_0x554d10);})[_0xeaaf('0x16')](function(){_0x4f0928[_0xeaaf('0xb')]();});}}}catch(_0x417443){logger[_0xeaaf('0x7')](_0xeaaf('0x12'),_0x554d10,_[_0xeaaf('0x17')](_0x417443)?JSON[_0xeaaf('0x13')](_0x417443):_0x417443);logger[_0xeaaf('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x554d10);_0x4f0928[_0xeaaf('0xb')]();}};}; \ No newline at end of file +var _0x002e=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','validate','length','error','[%s][TAG]\x20%s','message','join','next','Interaction','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0x002e,0x156));var _0xe002=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x002e[_0x188703];return _0x1a0c81;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0xe002('0x0')),'openchannelInteraction':require(_0xe002('0x1')),'smsInteraction':require(_0xe002('0x2')),'mailInteraction':require(_0xe002('0x3')),'faxInteraction':require(_0xe002('0x4')),'whatsappInteraction':require(_0xe002('0x5'))};var logger=require(_0xe002('0x6'))(_0xe002('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1b10d7,_0x89ffeb,_0xc0fc0e,_0x1772de){return function(_0x32803a){try{var _0x2777ae={'tag':_0x89ffeb[0x0]};var _0x5b2a97=tag[_0xe002('0x8')](_0x2777ae,{'typecast':!![]});if(_0x5b2a97[_0xe002('0x9')]){logger[_0xe002('0xa')](_0xe002('0xb'),_0x1b10d7,_['map'](_0x5b2a97,_0xe002('0xc'))[_0xe002('0xd')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1b10d7);_0x32803a[_0xe002('0xe')]();}else{var _0x15608b={'ids':[_0x89ffeb[0x0]]};if(rpc[_0x1772de['channel']+_0xe002('0xf')]){rpc[_0x1772de[_0xe002('0x10')]+_0xe002('0xf')][_0xe002('0x11')](_0x1772de['interaction']['id'],_0x15608b)[_0xe002('0x12')](function(_0x4bad1b){logger['info'](_0xe002('0x13'),_0x1b10d7,_0x89ffeb[0x1],_0x1772de[_0xe002('0x10')],_0x1772de[_0xe002('0x14')]['id']);})['catch'](function(_0x2826ab){logger[_0xe002('0xa')](_0xe002('0xb'),_0x1b10d7,JSON[_0xe002('0x15')](_0x2826ab));logger[_0xe002('0x16')](_0xe002('0x17'),_0x1b10d7);})[_0xe002('0x18')](function(){_0x32803a[_0xe002('0xe')]();});}}}catch(_0x4cbd5f){logger[_0xe002('0xa')]('[%s][TAG]\x20%s',_0x1b10d7,_[_0xe002('0x19')](_0x4cbd5f)?JSON[_0xe002('0x15')](_0x4cbd5f):_0x4cbd5f);logger[_0xe002('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1b10d7);_0x32803a[_0xe002('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index c856abf..3825ca3 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 _0x76ff=['[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','jsonrpc','2.0','method','login','params','POST','application/json-rpc','then','parse','result','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error'];(function(_0x1d6cbc,_0x808bd9){var _0x1be56e=function(_0x5a0dd7){while(--_0x5a0dd7){_0x1d6cbc['push'](_0x1d6cbc['shift']());}};_0x1be56e(++_0x808bd9);}(_0x76ff,0x177));var _0xf76f=function(_0xf06cc3,_0x5740f3){_0xf06cc3=_0xf06cc3-0x0;var _0x39c474=_0x76ff[_0xf06cc3];return _0x39c474;};'use strict';var rp=require(_0xf76f('0x0'));var logger=require(_0xf76f('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0xf76f('0x2')]=function(_0x28530f,_0x4eab02){return function(_0x1f7396){var _0x4885ae=_0x4eab02[0xa];var _0x2637ed=_0x4eab02[0xb];var _0x3ddc52=_0x4eab02[0xc];var _0x177f25=_0x4eab02[0xd];var _0x135a7d=_0x4eab02[0xe];var _0x2b7c91=_0x4eab02[0xf][_0xf76f('0x3')](/\n/g,_0xf76f('0x4'));var _0x58dd39=_0x4eab02[0x10][_0xf76f('0x3')](/\n/g,'\x20');if(!arr[_0xf76f('0x5')](_0x2637ed)){arr[_0xf76f('0x6')](_0x2637ed);var _0x44a88f=_0x4eab02[0x3];var _0x1c1fed=_0x4eab02[0x4];var _0x27d44d=_0x4eab02[0x1];var _0xb76926=_0x4eab02[0x0];var _0x51e7de={};_0x51e7de[_0xf76f('0x7')]=_0x4eab02[0x8]+_0xf76f('0x8')+_0x3ddc52+'|'+_0x4885ae+'|'+_0x177f25+'|'+_0x2637ed+'|'+_0x135a7d;_0x51e7de['urlOnRing']=_0x4eab02[0x7]+_0xf76f('0x8')+_0x3ddc52+'|'+_0x4885ae+'|'+_0x177f25+'|'+_0x2637ed+'|'+_0x135a7d+'|'+_0x2b7c91+'|'+_0x58dd39;_0x51e7de['title']=_0x4eab02[0x9];var _0x170dfa={};_0x170dfa[_0xf76f('0x9')]=_0xf76f('0xa');_0x170dfa[_0xf76f('0xb')]=_0xf76f('0xc');var _0x3fadcc=[];_0x3fadcc['push'](_0x4eab02[0x2]);_0x3fadcc[_0xf76f('0x6')](_0x4eab02[0x5]);_0x3fadcc[_0xf76f('0x6')](_0x4eab02[0x6]);_0x170dfa[_0xf76f('0xd')]=_0x3fadcc;_0x170dfa['id']=0x1;var _0x31a3d8=JSON['stringify'](_0x170dfa);var _0x2e4d42={'encoding':'utf8','method':_0xf76f('0xe'),'timeout':0x2710,'url':_0x44a88f,'headers':{'Content-Type':_0xf76f('0xf')},'body':_0x31a3d8};return rp(_0x2e4d42)[_0xf76f('0x10')](function(_0x360364){const _0x58bcac=JSON[_0xf76f('0x11')](_0x360364);if(!_0x58bcac[_0xf76f('0x12')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0xf243d3=_0x2637ed;var _0x284a6f=_0xf76f('0x13')+_0x27d44d+_0xf76f('0x14')+_0xb76926+_0xf76f('0x15')+_0xf243d3+_0xf76f('0x16')+JSON[_0xf76f('0x17')](_0x51e7de);var _0x45899f=_0x1c1fed+'?'+_0x284a6f;return rp(_0x45899f);})[_0xf76f('0x10')](function(_0x5ecb70){logger[_0xf76f('0x18')](_0xf76f('0x19'),_0x28530f,_0x5ecb70);_0x1f7396[_0xf76f('0x1a')]();})['catch'](function(_0x5f1f7f){logger[_0xf76f('0x1b')](_0xf76f('0x1c'),_0x28530f,_[_0xf76f('0x1d')](_0x5f1f7f)?JSON['stringify'](_0x5f1f7f):_0x5f1f7f);_0x1f7396[_0xf76f('0x1a')]();});}else{logger['info'](_0xf76f('0x1e'),_0x28530f);_0x1f7396['next']();}};}; \ No newline at end of file +var _0x0103=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','2.0','method','login','stringify','utf8','application/json-rpc','parse','result'];(function(_0x5ca55d,_0x3d7a3c){var _0x2f2f0d=function(_0x2711af){while(--_0x2711af){_0x5ca55d['push'](_0x5ca55d['shift']());}};_0x2f2f0d(++_0x3d7a3c);}(_0x0103,0x102));var _0x3010=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0x0103[_0x246f92];return _0x2b8e7d;};'use strict';var rp=require(_0x3010('0x0'));var logger=require(_0x3010('0x1'))('routing');var _=require(_0x3010('0x2'));var arr=[];exports[_0x3010('0x3')]=function(_0x6544c0,_0xb11009){return function(_0x27d852){var _0x1099cc=_0xb11009[0xa];var _0x232fde=_0xb11009[0xb];var _0x22ff47=_0xb11009[0xc];var _0x3faa97=_0xb11009[0xd];var _0x546843=_0xb11009[0xe];var _0x5646a0=_0xb11009[0xf][_0x3010('0x4')](/\n/g,_0x3010('0x5'));var _0x31a625=_0xb11009[0x10][_0x3010('0x4')](/\n/g,'\x20');if(!arr[_0x3010('0x6')](_0x232fde)){arr[_0x3010('0x7')](_0x232fde);var _0x1fb76a=_0xb11009[0x3];var _0x393654=_0xb11009[0x4];var _0x13d9d4=_0xb11009[0x1];var _0xd3265c=_0xb11009[0x0];var _0x2e8d18={};_0x2e8d18[_0x3010('0x8')]=_0xb11009[0x8]+'?params='+_0x22ff47+'|'+_0x1099cc+'|'+_0x3faa97+'|'+_0x232fde+'|'+_0x546843;_0x2e8d18[_0x3010('0x9')]=_0xb11009[0x7]+_0x3010('0xa')+_0x22ff47+'|'+_0x1099cc+'|'+_0x3faa97+'|'+_0x232fde+'|'+_0x546843+'|'+_0x5646a0+'|'+_0x31a625;_0x2e8d18[_0x3010('0xb')]=_0xb11009[0x9];var _0x294daa={};_0x294daa[_0x3010('0xc')]=_0x3010('0xd');_0x294daa[_0x3010('0xe')]=_0x3010('0xf');var _0xe0329c=[];_0xe0329c[_0x3010('0x7')](_0xb11009[0x2]);_0xe0329c[_0x3010('0x7')](_0xb11009[0x5]);_0xe0329c[_0x3010('0x7')](_0xb11009[0x6]);_0x294daa['params']=_0xe0329c;_0x294daa['id']=0x1;var _0x312a23=JSON[_0x3010('0x10')](_0x294daa);var _0x42a9fa={'encoding':_0x3010('0x11'),'method':'POST','timeout':0x2710,'url':_0x1fb76a,'headers':{'Content-Type':_0x3010('0x12')},'body':_0x312a23};return rp(_0x42a9fa)['then'](function(_0x377a09){const _0x2f047a=JSON[_0x3010('0x13')](_0x377a09);if(!_0x2f047a[_0x3010('0x14')]['logged']){throw new Error(_0x3010('0x15'));}var _0x598cc3=_0x232fde;var _0x3d8b2e=_0x3010('0x16')+_0x13d9d4+'&serviceId='+_0xd3265c+_0x3010('0x17')+_0x598cc3+'&data='+JSON[_0x3010('0x10')](_0x2e8d18);var _0x468f58=_0x393654+'?'+_0x3d8b2e;return rp(_0x468f58);})['then'](function(_0x1e89b0){logger['info'](_0x3010('0x18'),_0x6544c0,_0x1e89b0);_0x27d852[_0x3010('0x19')]();})[_0x3010('0x1a')](function(_0x99f5d7){logger[_0x3010('0x1b')](_0x3010('0x1c'),_0x6544c0,_[_0x3010('0x1d')](_0x99f5d7)?JSON[_0x3010('0x10')](_0x99f5d7):_0x99f5d7);_0x27d852[_0x3010('0x19')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x6544c0);_0x27d852[_0x3010('0x1e')]();}};}; \ 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 507bac8..52c0eff 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x503fe9,_0x277316){var _0x513a64=function(_0x4b1188){while(--_0x4b1188){_0x503fe9['push'](_0x503fe9['shift']());}};_0x513a64(++_0x277316);}(_0xe706,0xa3));var _0x6e70=function(_0x183b21,_0x271b8e){_0x183b21=_0x183b21-0x0;var _0x4dbe1b=_0xe706[_0x183b21];return _0x4dbe1b;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x2e9e27,_0x4da9e2){var _0xfa36d4=function(_0x2d67a2){while(--_0x2d67a2){_0x2e9e27['push'](_0x2e9e27['shift']());}};_0xfa36d4(++_0x4da9e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 262e844..fb09016 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 _0x60ca=['execute','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','checkWaitingNotifications','applications','length','app','.js','toLowerCase','split','channel','mail','push','slice','join','dialogflow','appdata','dialogflowv2','amazonlex','TagId','tvox','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','Please\x20create\x20a\x20new\x20file\x20under','rules'];(function(_0x486526,_0x7ce885){var _0x54e275=function(_0x53ed0e){while(--_0x53ed0e){_0x486526['push'](_0x486526['shift']());}};_0x54e275(++_0x7ce885);}(_0x60ca,0x92));var _0xa60c=function(_0x522c81,_0x4cdbd3){_0x522c81=_0x522c81-0x0;var _0x35c98c=_0x60ca[_0x522c81];return _0x35c98c;};'use strict';var _=require(_0xa60c('0x0'));var util=require(_0xa60c('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xa60c('0x2'));var utils=require(_0xa60c('0x3'));var sUtils=require(_0xa60c('0x4'));var logger=require(_0xa60c('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0xa60c('0x6')),'mailQueueReport':require(_0xa60c('0x7')),'chatQueueReport':require(_0xa60c('0x8')),'smsQueueReport':require(_0xa60c('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa60c('0xa'))};var RuleEngine=require(_0xa60c('0xb'));function getId(_0x4bd35b,_0x52f1b1,_0x3617a4){return util[_0xa60c('0xc')](_0xa60c('0xd'),_0x4bd35b,_0x52f1b1||0x0,_0x3617a4||0x0);}function getIntervals(_0x19ad5c,_0x3c7bf4){var _0x5179f2=[];if(!_[_0xa60c('0xe')](_0x3c7bf4[_0xa60c('0xf')])&&!_['isNil'](_0x19ad5c[_0x3c7bf4[_0xa60c('0xf')]])&&!_[_0xa60c('0xe')](_0x19ad5c[_0x3c7bf4[_0xa60c('0xf')]][_0xa60c('0x10')])){_0x5179f2=_[_0xa60c('0x11')](_0x19ad5c[_0x3c7bf4[_0xa60c('0xf')]][_0xa60c('0x10')],_0xa60c('0x12'));}else if(!_[_0xa60c('0xe')](_0x3c7bf4[_0xa60c('0x12')])){_0x5179f2=[_0x3c7bf4['interval']];}return _0x5179f2;}exports[_0xa60c('0x13')]=function(_0x1a9fef){_0x1a9fef['rules']={};return new BPromise(function(_0x37c668,_0x2a8a49){var _0xe3bd09={'Start':function(_0x1ceaa1){var _0x54eb78=this;return new Promise(function(_0x1caa26,_0x5f0ff4){if(_0x1ceaa1){try{var _0x29a590=[];var _0x54cccd=getId(_0x1ceaa1['channel'],_0x1ceaa1[_0xa60c('0x14')]?_0x1ceaa1[_0xa60c('0x14')]['id']:0x0,_0x1ceaa1['interaction']?_0x1ceaa1[_0xa60c('0x15')]['id']:0x0);var _0x188679=sUtils[_0xa60c('0x16')](_0x1a9fef,_0x1ceaa1);if(_0x1ceaa1['transfer']||!_0x188679&&_0x1ceaa1[_0xa60c('0x17')]&&_['isArray'](_0x1ceaa1[_0xa60c('0x17')])&&_0x1ceaa1[_0xa60c('0x17')][_0xa60c('0x18')]){for(var _0x1c1363=0x0;_0x1c1363<_0x1ceaa1[_0xa60c('0x17')][_0xa60c('0x18')];_0x1c1363+=0x1){var _0x52270e=_0x1ceaa1[_0xa60c('0x17')][_0x1c1363];if(fs['existsSync'](path['join'](__dirname,'applications',_0x52270e[_0xa60c('0x19')]+_0xa60c('0x1a')))){var _0x498fe5=[];switch(_0x52270e[_0xa60c('0x19')][_0xa60c('0x1b')]()){case'autoreply':var _0x3d1557=_0x52270e['appdata'][_0xa60c('0x1c')](',');if(_0x1ceaa1[_0xa60c('0x1d')]===_0xa60c('0x1e')){_0x498fe5[_0xa60c('0x1f')](_0x3d1557[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x3d1557[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x3d1557[_0xa60c('0x20')](0x2,_0x3d1557[_0xa60c('0x18')])[_0xa60c('0x21')](','));}else{_0x498fe5[_0xa60c('0x1f')](_0x3d1557[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x3d1557[_0xa60c('0x20')](0x1,_0x3d1557[_0xa60c('0x18')])['join'](','));}break;case _0xa60c('0x22'):var _0x2611ab=_0x52270e[_0xa60c('0x23')][_0xa60c('0x1c')](',');_0x498fe5['push'](_0x2611ab[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x2611ab[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x2611ab[_0xa60c('0x20')](0x2,_0x2611ab[_0xa60c('0x18')])[_0xa60c('0x21')](','));break;case _0xa60c('0x24'):var _0x216ace=_0x52270e[_0xa60c('0x23')][_0xa60c('0x1c')](',');_0x498fe5['push'](_0x216ace[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x216ace[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x216ace[0x2]);_0x498fe5[_0xa60c('0x1f')](_0x216ace[0x3]);_0x498fe5[_0xa60c('0x1f')](_0x216ace[_0xa60c('0x20')](0x4,_0x216ace['length'])['join'](','));break;case _0xa60c('0x25'):var _0x58ffa3=_0x52270e['appdata'][_0xa60c('0x1c')](',');_0x498fe5[_0xa60c('0x1f')](_0x58ffa3[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x58ffa3[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x58ffa3[0x2]);_0x498fe5[_0xa60c('0x1f')](_0x58ffa3[0x3]);_0x498fe5['push'](_0x58ffa3[_0xa60c('0x20')](0x4,_0x58ffa3[_0xa60c('0x18')])['join'](','));break;case _0xa60c('0x14'):_0x498fe5[_0xa60c('0x1f')](_0x52270e['appdata']);break;case'tag':_0x498fe5[_0xa60c('0x1f')](_0x52270e[_0xa60c('0x26')]);_0x498fe5['push'](_0x52270e[_0xa60c('0x23')]);break;case _0xa60c('0x27'):var _0x5e5e5f=utils['getMustacheRender'](_0x1ceaa1[_0xa60c('0x28')][_0xa60c('0x29')],_0x1ceaa1);var _0x10053c=_0x52270e[_0xa60c('0x23')][_0xa60c('0x1c')](',');_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x0]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x1]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x2]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x3]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x4]);_0x498fe5['push'](_0x10053c[0x5]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x6]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x7]);_0x498fe5[_0xa60c('0x1f')](_0x10053c[0x8]);_0x498fe5['push'](_0x10053c[0x9]);_0x498fe5['push'](_0x10053c[0xa]);_0x498fe5[_0xa60c('0x1f')](_0x1ceaa1[_0xa60c('0x15')]['id']);_0x498fe5[_0xa60c('0x1f')](_0x1ceaa1[_0xa60c('0x14')]['id']);_0x498fe5[_0xa60c('0x1f')](_0x52270e[_0xa60c('0x2a')]);_0x498fe5['push'](_0x1ceaa1[_0xa60c('0x15')]['ContactId']);_0x498fe5[_0xa60c('0x1f')](_0x1ceaa1[_0xa60c('0x2b')][_0xa60c('0x2b')]);_0x498fe5[_0xa60c('0x1f')](_0x5e5e5f);break;default:_0x498fe5=_[_0xa60c('0xe')](_0x52270e['appdata'])?[]:_0x52270e[_0xa60c('0x23')][_0xa60c('0x1c')](',');}var _0x4fcf48={'id':util[_0xa60c('0xc')](_0xa60c('0x2c'),_0x54cccd,_0x52270e['id'],_0x52270e[_0xa60c('0x19')]),'condition':require(_0xa60c('0x2d'))[_0xa60c('0x2e')](_0x54cccd,getIntervals(_0x1a9fef[_0xa60c('0x2f')],_0x52270e),_0x1a9fef),'consequence':require('./applications/'+_0x52270e['app'])[_0xa60c('0x30')](_0x54cccd,_0x498fe5,_0x1a9fef,_0x1ceaa1),'p':_0x52270e[_0xa60c('0x31')]||0x0};logger[_0xa60c('0x32')](_0xa60c('0x33'),_0x4fcf48['id'],'on\x20interval',getIntervals(_0x1a9fef[_0xa60c('0x2f')],_0x52270e)[_0xa60c('0x21')]('\x20|\x20'));_0x29a590['push'](_0x4fcf48);}else{logger['error'](_0xa60c('0x34'),path['join'](__dirname,_0xa60c('0x17'),_0x52270e[_0xa60c('0x19')]+_0xa60c('0x1a')));}}_0x1a9fef[_0xa60c('0x35')][_0x54cccd]=new RuleEngine(_0x29a590);_0x1a9fef['rules'][_0x54cccd][_0xa60c('0x36')](_0x1ceaa1,function(_0x302763){logger[_0xa60c('0x32')](_0xa60c('0x37'),JSON[_0xa60c('0x38')](_0x302763[_0xa60c('0x39')]));if(_0x1a9fef[_0xa60c('0x35')][_0x54cccd]){_0x1a9fef[_0xa60c('0x35')][_0x54cccd][_0xa60c('0x3a')]('complete');}});return _0x1caa26({'code':0xc8,'message':_0x1ceaa1});}else{if(_0x188679){logger[_0xa60c('0x32')](util[_0xa60c('0xc')](_0xa60c('0x3b'),_0x54cccd));}else{logger[_0xa60c('0x32')](_0xa60c('0x3c'));}return _0x1caa26({'code':0xc8,'message':_0x1ceaa1});}}catch(_0x22c6df){logger[_0xa60c('0x3d')](_0x22c6df[_0xa60c('0x3e')]);return _0x5f0ff4(_0x54eb78[_0xa60c('0x3d')](0x1f4,_0x22c6df));}}return _0x5f0ff4(_0xa60c('0x3f'));});},'AcceptMessage':function(_0xcf4028){var _0x358c7c=this;return new Promise(function(_0x37c710,_0x4e0dde){if(_0xcf4028[_0xa60c('0x40')]&&_0xcf4028[_0xa60c('0x40')]['id']){if(_0x1a9fef[_0xa60c('0x41')][_0xcf4028['agent']['id']]){_0x1a9fef[_0xa60c('0x41')][_0xcf4028[_0xa60c('0x40')]['id']][_0xa60c('0x42')]=![];_0x1a9fef[_0xa60c('0x41')][_0xcf4028[_0xa60c('0x40')]['id']][_0xa60c('0x43')]=undefined;}}if(_0xcf4028['message']&&_0xcf4028[_0xa60c('0x14')]['id']){try{var _0x1feb01=getId(_0xcf4028[_0xa60c('0x1d')],_0xcf4028[_0xa60c('0x14')]?_0xcf4028[_0xa60c('0x14')]['id']:0x0,_0xcf4028[_0xa60c('0x15')]?_0xcf4028[_0xa60c('0x15')]['id']:0x0);if(_0x1a9fef[_0xa60c('0x35')][_0x1feb01]){_0x1a9fef[_0xa60c('0x35')][_0x1feb01]['emit'](_0xa60c('0x44'));if(rpc[_0xcf4028[_0xa60c('0x1d')]+_0xa60c('0x45')]){rpc[_0xcf4028[_0xa60c('0x1d')]+_0xa60c('0x45')][_0xa60c('0x46')](_0x1feb01,{'UserId':_0xcf4028[_0xa60c('0x14')]['UserId']})['catch'](function(){logger[_0xa60c('0x3d')](_0xa60c('0x47'));});}}return _0x37c710({'code':0xc8,'message':_0xcf4028});}catch(_0x4c2a17){logger[_0xa60c('0x3d')](_0x4c2a17['stack']);return _0x4e0dde(_0x358c7c[_0xa60c('0x3d')](0x1f4,_0x4c2a17));}}logger[_0xa60c('0x3d')]('message\x20is\x20empty');return _0x4e0dde(_0x358c7c[_0xa60c('0x3d')](0x1f4,_0xa60c('0x48')));});},'RejectMessage':function(_0x4bdfc2){var _0x543819=this;return new Promise(function(_0x50ac8,_0x568c23){if(_0x4bdfc2[_0xa60c('0x40')]&&_0x4bdfc2[_0xa60c('0x40')]['id']){try{if(_0x1a9fef['agents'][_0x4bdfc2['agent']['id']]){_0x1a9fef['agents'][_0x4bdfc2[_0xa60c('0x40')]['id']][_0xa60c('0x42')]=![];_0x1a9fef[_0xa60c('0x41')][_0x4bdfc2['agent']['id']][_0xa60c('0x43')]=undefined;}return _0x50ac8({'code':0xc8,'message':_0x4bdfc2});}catch(_0x273adb){logger[_0xa60c('0x3d')](_0x273adb[_0xa60c('0x3e')]);return _0x568c23(_0x543819[_0xa60c('0x3d')](0x1f4,_0x273adb));}}logger[_0xa60c('0x3d')](_0xa60c('0x48'));return _0x568c23(_0x543819['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xddd36f){var _0x1fe45f=this;return new Promise(function(_0x1a0b92,_0x1729f5){if(_0xddd36f[_0xa60c('0x1d')]&&_0xddd36f[_0xa60c('0x15')]&&_0xddd36f['interaction']['id']){try{var _0x1fa307=getId(_0xddd36f[_0xa60c('0x1d')],_0xddd36f[_0xa60c('0x14')]?_0xddd36f[_0xa60c('0x14')]['id']:0x0,_0xddd36f['interaction']?_0xddd36f[_0xa60c('0x15')]['id']:0x0);if(_0x1a9fef[_0xa60c('0x35')][_0x1fa307]){_0x1a9fef[_0xa60c('0x35')][_0x1fa307][_0xa60c('0x3a')]('end');}return _0x1a0b92({'code':0xc8,'message':_0xddd36f});}catch(_0x5733fe){logger['error'](_0x5733fe[_0xa60c('0x3e')]);return _0x1729f5(_0x1fe45f[_0xa60c('0x3d')](0x1f4,_0x5733fe));}}logger[_0xa60c('0x3d')](_0xa60c('0x48'));return _0x1729f5(_0x1fe45f[_0xa60c('0x3d')](0x1f4,_0xa60c('0x48')));});},'AgentCapacity':function(_0x5b968b){var _0x59df02=this;return new Promise(function(_0x45fecd,_0x13726d){if(_0x1a9fef[_0xa60c('0x41')][_0xa60c('0x49')](_0x5b968b['id'])){for(var _0x1d61a9 in _0x5b968b[_0xa60c('0x4a')]){if(_0x5b968b[_0xa60c('0x4a')][_0xa60c('0x49')](_0x1d61a9)){if(_0x1a9fef[_0xa60c('0x41')][_0x5b968b['id']][_0xa60c('0x49')](_0x1d61a9+_0xa60c('0x4b'))){_0x1a9fef['agents'][_0x5b968b['id']][_0x1d61a9+_0xa60c('0x4b')]=parseInt(_0x5b968b['capacity'][_0x1d61a9],0xa);}}}_0x1a9fef[_0xa60c('0x41')][_0x5b968b['id']]['updateRealtime']();return _0x45fecd({'code':0xc8,'message':_0x1a9fef[_0xa60c('0x41')][_0x5b968b['id']]});}else{return _0x13726d(_0x59df02[_0xa60c('0x3d')](0x1f4,_0xa60c('0x4c')));}});},'Agents':function(_0x58e047){return new Promise(function(_0x13a3df){var _0x348763=_['values'](_0x1a9fef[_0xa60c('0x41')]);if(_0x58e047&&_0x58e047['id']){var _0x38f9a1=_[_0xa60c('0x4d')](_0x348763,function(_0x1c600b){return _0x1c600b['id']===_0x58e047['id'];});_0x13a3df(_0x38f9a1);}else{_0x13a3df({'count':_0x348763['length'],'rows':_0x348763});}});},'ChatQueues':function(){return new Promise(function(_0x48e680){var _0x3593e6=[];for(var _0x29d069 in _0x1a9fef[_0xa60c('0x4e')]){if(_0x1a9fef['chatQueues'][_0xa60c('0x49')](_0x29d069)){var _0x350538=_0x1a9fef[_0xa60c('0x4e')][_0x29d069];var _0xb8ff73={'id':_0x350538['id'],'available':_0x350538[_0xa60c('0x4f')],'loggedIn':_0x350538[_0xa60c('0x50')],'name':_0x350538[_0xa60c('0x51')],'paused':_0x350538[_0xa60c('0x52')],'waiting':_0x350538[_0xa60c('0x53')]};_0x3593e6['push'](_0xb8ff73);}}_0x48e680({'count':_0x3593e6[_0xa60c('0x18')],'rows':_0x3593e6});});},'MailQueues':function(){return new Promise(function(_0x3ffb2f){var _0x578988=[];for(var _0x4f33cb in _0x1a9fef[_0xa60c('0x54')]){if(_0x1a9fef[_0xa60c('0x54')][_0xa60c('0x49')](_0x4f33cb)){var _0x4559c5=_0x1a9fef[_0xa60c('0x54')][_0x4f33cb];var _0xc30f12={'id':_0x4559c5['id'],'available':_0x4559c5[_0xa60c('0x4f')],'loggedIn':_0x4559c5[_0xa60c('0x50')],'name':_0x4559c5[_0xa60c('0x51')],'paused':_0x4559c5['paused'],'waiting':_0x4559c5['waiting']};_0x578988[_0xa60c('0x1f')](_0xc30f12);}}_0x3ffb2f({'count':_0x578988[_0xa60c('0x18')],'rows':_0x578988});});},'OpenchannelQueues':function(){return new Promise(function(_0x5058f3){var _0x46265e=[];for(var _0x26f8b6 in _0x1a9fef[_0xa60c('0x55')]){if(_0x1a9fef['openchannelQueues'][_0xa60c('0x49')](_0x26f8b6)){var _0x4f4b98=_0x1a9fef[_0xa60c('0x55')][_0x26f8b6];var _0x15b118={'id':_0x4f4b98['id'],'available':_0x4f4b98['available'],'loggedIn':_0x4f4b98[_0xa60c('0x50')],'name':_0x4f4b98[_0xa60c('0x51')],'paused':_0x4f4b98[_0xa60c('0x52')],'waiting':_0x4f4b98['waiting']};_0x46265e[_0xa60c('0x1f')](_0x15b118);}}_0x5058f3({'count':_0x46265e['length'],'rows':_0x46265e});});},'SmsQueues':function(){return new Promise(function(_0x507c61){var _0x539202=[];for(var _0x361a5a in _0x1a9fef[_0xa60c('0x56')]){if(_0x1a9fef[_0xa60c('0x56')]['hasOwnProperty'](_0x361a5a)){var _0x3e79c4=_0x1a9fef[_0xa60c('0x56')][_0x361a5a];var _0x55467c={'id':_0x3e79c4['id'],'available':_0x3e79c4[_0xa60c('0x4f')],'loggedIn':_0x3e79c4[_0xa60c('0x50')],'name':_0x3e79c4['name'],'paused':_0x3e79c4[_0xa60c('0x52')],'waiting':_0x3e79c4[_0xa60c('0x53')]};_0x539202[_0xa60c('0x1f')](_0x55467c);}}_0x507c61({'count':_0x539202[_0xa60c('0x18')],'rows':_0x539202});});},'FaxQueues':function(){return new Promise(function(_0x2ac78a){var _0x4fa60a=[];for(var _0x47013f in _0x1a9fef['faxQueues']){if(_0x1a9fef['faxQueues'][_0xa60c('0x49')](_0x47013f)){var _0xcd5f45=_0x1a9fef[_0xa60c('0x57')][_0x47013f];var _0x23794c={'id':_0xcd5f45['id'],'available':_0xcd5f45[_0xa60c('0x4f')],'loggedIn':_0xcd5f45[_0xa60c('0x50')],'name':_0xcd5f45[_0xa60c('0x51')],'paused':_0xcd5f45[_0xa60c('0x52')],'waiting':_0xcd5f45[_0xa60c('0x53')]};_0x4fa60a[_0xa60c('0x1f')](_0x23794c);}}_0x2ac78a({'count':_0x4fa60a[_0xa60c('0x18')],'rows':_0x4fa60a});});},'WhatsappQueues':function(){return new Promise(function(_0x50bcc4){var _0x3328c3=[];for(var _0x4aa17e in _0x1a9fef[_0xa60c('0x58')]){if(_0x1a9fef[_0xa60c('0x58')][_0xa60c('0x49')](_0x4aa17e)){var _0x33a7fd=_0x1a9fef[_0xa60c('0x58')][_0x4aa17e];var _0x27b801={'id':_0x33a7fd['id'],'available':_0x33a7fd[_0xa60c('0x4f')],'loggedIn':_0x33a7fd[_0xa60c('0x50')],'name':_0x33a7fd[_0xa60c('0x51')],'paused':_0x33a7fd[_0xa60c('0x52')],'waiting':_0x33a7fd[_0xa60c('0x53')]};_0x3328c3[_0xa60c('0x1f')](_0x27b801);}}_0x50bcc4({'count':_0x3328c3[_0xa60c('0x18')],'rows':_0x3328c3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5e60f9){var _0x4f8f5d=_[_0xa60c('0x59')](_0x1a9fef[_0xa60c('0x5a')]);_0x5e60f9({'count':_0x4f8f5d['length'],'rows':_0x4f8f5d});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x291779){var _0x38f896=_['values'](_0x1a9fef[_0xa60c('0x5b')]);_0x291779({'count':_0x38f896[_0xa60c('0x18')],'rows':_0x38f896});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x57f3cd){var _0x35aa45=_[_0xa60c('0x59')](_0x1a9fef[_0xa60c('0x5c')]);_0x57f3cd({'count':_0x35aa45[_0xa60c('0x18')],'rows':_0x35aa45});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3fc556){var _0x36bb0c=_[_0xa60c('0x59')](_0x1a9fef[_0xa60c('0x5d')]);_0x3fc556({'count':_0x36bb0c[_0xa60c('0x18')],'rows':_0x36bb0c});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x52b8d2){var _0x34b0a4=_[_0xa60c('0x59')](_0x1a9fef['faxQueuesWaitingInteractions']);_0x52b8d2({'count':_0x34b0a4[_0xa60c('0x18')],'rows':_0x34b0a4});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x20eba1){var _0xbb8a31=_[_0xa60c('0x59')](_0x1a9fef[_0xa60c('0x5e')]);_0x20eba1({'count':_0xbb8a31['length'],'rows':_0xbb8a31});});}};var _0x56efa0=jayson[_0xa60c('0x5f')](_0xe3bd09)[_0xa60c('0x60')]();_0x56efa0['on'](_0xa60c('0x3d'),function(_0x56a787){logger[_0xa60c('0x3d')](JSON[_0xa60c('0x38')](_0x56a787));return _0x2a8a49(_0x56a787);});_0x56efa0[_0xa60c('0x13')](0x232c,_0xa60c('0x61'),function(){console[_0xa60c('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x37c668(_0xa60c('0x63')+0x232c);});});}; \ No newline at end of file +var _0x9a0a=['find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','message','interaction','checkWaitingNotifications','transfer','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','.js','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agents','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values'];(function(_0x192c6a,_0xaafed6){var _0x49fe49=function(_0x20d337){while(--_0x20d337){_0x192c6a['push'](_0x192c6a['shift']());}};_0x49fe49(++_0xaafed6);}(_0x9a0a,0x7c));var _0xa9a0=function(_0x587914,_0x1bf578){_0x587914=_0x587914-0x0;var _0x271dfb=_0x9a0a[_0x587914];return _0x271dfb;};'use strict';var _=require(_0xa9a0('0x0'));var util=require(_0xa9a0('0x1'));var path=require(_0xa9a0('0x2'));var fs=require('fs');var jayson=require(_0xa9a0('0x3'));var BPromise=require(_0xa9a0('0x4'));var utils=require(_0xa9a0('0x5'));var sUtils=require(_0xa9a0('0x6'));var logger=require(_0xa9a0('0x7'))(_0xa9a0('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xa9a0('0x9')),'chatQueueReport':require(_0xa9a0('0xa')),'smsQueueReport':require(_0xa9a0('0xb')),'faxQueueReport':require(_0xa9a0('0xc')),'whatsappQueueReport':require(_0xa9a0('0xd'))};var RuleEngine=require(_0xa9a0('0xe'));function getId(_0x48070c,_0x13b1c0,_0xbd243b){return util[_0xa9a0('0xf')](_0xa9a0('0x10'),_0x48070c,_0x13b1c0||0x0,_0xbd243b||0x0);}function getIntervals(_0x316175,_0x58a289){var _0x25d433=[];if(!_['isNil'](_0x58a289[_0xa9a0('0x11')])&&!_[_0xa9a0('0x12')](_0x316175[_0x58a289[_0xa9a0('0x11')]])&&!_[_0xa9a0('0x12')](_0x316175[_0x58a289['IntervalId']][_0xa9a0('0x13')])){_0x25d433=_[_0xa9a0('0x14')](_0x316175[_0x58a289[_0xa9a0('0x11')]][_0xa9a0('0x13')],_0xa9a0('0x15'));}else if(!_[_0xa9a0('0x12')](_0x58a289[_0xa9a0('0x15')])){_0x25d433=[_0x58a289['interval']];}return _0x25d433;}exports[_0xa9a0('0x16')]=function(_0x64285a){_0x64285a[_0xa9a0('0x17')]={};return new BPromise(function(_0x142fbc,_0x19d6c5){var _0xa3c21e={'Start':function(_0x14f3aa){var _0x2533bc=this;return new Promise(function(_0xae4300,_0x43e0be){if(_0x14f3aa){try{var _0x4aabec=[];var _0x2538b7=getId(_0x14f3aa['channel'],_0x14f3aa[_0xa9a0('0x18')]?_0x14f3aa[_0xa9a0('0x18')]['id']:0x0,_0x14f3aa[_0xa9a0('0x19')]?_0x14f3aa[_0xa9a0('0x19')]['id']:0x0);var _0x1e3f5d=sUtils[_0xa9a0('0x1a')](_0x64285a,_0x14f3aa);if(_0x14f3aa[_0xa9a0('0x1b')]||!_0x1e3f5d&&_0x14f3aa['applications']&&_[_0xa9a0('0x1c')](_0x14f3aa[_0xa9a0('0x1d')])&&_0x14f3aa['applications'][_0xa9a0('0x1e')]){for(var _0x5e68dc=0x0;_0x5e68dc<_0x14f3aa[_0xa9a0('0x1d')][_0xa9a0('0x1e')];_0x5e68dc+=0x1){var _0x4a17f9=_0x14f3aa[_0xa9a0('0x1d')][_0x5e68dc];if(fs[_0xa9a0('0x1f')](path[_0xa9a0('0x20')](__dirname,_0xa9a0('0x1d'),_0x4a17f9[_0xa9a0('0x21')]+'.js'))){var _0x47d72f=[];switch(_0x4a17f9[_0xa9a0('0x21')][_0xa9a0('0x22')]()){case _0xa9a0('0x23'):var _0x382bcb=_0x4a17f9[_0xa9a0('0x24')][_0xa9a0('0x25')](',');if(_0x14f3aa[_0xa9a0('0x26')]===_0xa9a0('0x27')){_0x47d72f[_0xa9a0('0x28')](_0x382bcb[0x0]);_0x47d72f[_0xa9a0('0x28')](_0x382bcb[0x1]);_0x47d72f[_0xa9a0('0x28')](_0x382bcb[_0xa9a0('0x29')](0x2,_0x382bcb[_0xa9a0('0x1e')])[_0xa9a0('0x20')](','));}else{_0x47d72f[_0xa9a0('0x28')](_0x382bcb[0x0]);_0x47d72f[_0xa9a0('0x28')](_0x382bcb[_0xa9a0('0x29')](0x1,_0x382bcb[_0xa9a0('0x1e')])[_0xa9a0('0x20')](','));}break;case'dialogflow':var _0x251bc0=_0x4a17f9['appdata'][_0xa9a0('0x25')](',');_0x47d72f[_0xa9a0('0x28')](_0x251bc0[0x0]);_0x47d72f[_0xa9a0('0x28')](_0x251bc0[0x1]);_0x47d72f[_0xa9a0('0x28')](_0x251bc0[_0xa9a0('0x29')](0x2,_0x251bc0[_0xa9a0('0x1e')])[_0xa9a0('0x20')](','));break;case _0xa9a0('0x2a'):var _0x3d4109=_0x4a17f9[_0xa9a0('0x24')][_0xa9a0('0x25')](',');_0x47d72f[_0xa9a0('0x28')](_0x3d4109[0x0]);_0x47d72f['push'](_0x3d4109[0x1]);_0x47d72f[_0xa9a0('0x28')](_0x3d4109[0x2]);_0x47d72f[_0xa9a0('0x28')](_0x3d4109[0x3]);_0x47d72f['push'](_0x3d4109['slice'](0x4,_0x3d4109[_0xa9a0('0x1e')])[_0xa9a0('0x20')](','));break;case _0xa9a0('0x2b'):var _0x232ee4=_0x4a17f9[_0xa9a0('0x24')]['split'](',');_0x47d72f[_0xa9a0('0x28')](_0x232ee4[0x0]);_0x47d72f[_0xa9a0('0x28')](_0x232ee4[0x1]);_0x47d72f[_0xa9a0('0x28')](_0x232ee4[0x2]);_0x47d72f[_0xa9a0('0x28')](_0x232ee4[0x3]);_0x47d72f[_0xa9a0('0x28')](_0x232ee4['slice'](0x4,_0x232ee4['length'])[_0xa9a0('0x20')](','));break;case'message':_0x47d72f[_0xa9a0('0x28')](_0x4a17f9['appdata']);break;case _0xa9a0('0x2c'):_0x47d72f[_0xa9a0('0x28')](_0x4a17f9[_0xa9a0('0x2d')]);_0x47d72f['push'](_0x4a17f9[_0xa9a0('0x24')]);break;case _0xa9a0('0x2e'):var _0x2ecb61=utils[_0xa9a0('0x2f')](_0x14f3aa[_0xa9a0('0x30')]['notificationTemplate'],_0x14f3aa);var _0x3e7376=_0x4a17f9[_0xa9a0('0x24')][_0xa9a0('0x25')](',');_0x47d72f['push'](_0x3e7376[0x0]);_0x47d72f['push'](_0x3e7376[0x1]);_0x47d72f[_0xa9a0('0x28')](_0x3e7376[0x2]);_0x47d72f[_0xa9a0('0x28')](_0x3e7376[0x3]);_0x47d72f['push'](_0x3e7376[0x4]);_0x47d72f['push'](_0x3e7376[0x5]);_0x47d72f[_0xa9a0('0x28')](_0x3e7376[0x6]);_0x47d72f[_0xa9a0('0x28')](_0x3e7376[0x7]);_0x47d72f[_0xa9a0('0x28')](_0x3e7376[0x8]);_0x47d72f[_0xa9a0('0x28')](_0x3e7376[0x9]);_0x47d72f[_0xa9a0('0x28')](_0x3e7376[0xa]);_0x47d72f[_0xa9a0('0x28')](_0x14f3aa[_0xa9a0('0x19')]['id']);_0x47d72f[_0xa9a0('0x28')](_0x14f3aa[_0xa9a0('0x18')]['id']);_0x47d72f['push'](_0x4a17f9[_0xa9a0('0x31')]);_0x47d72f[_0xa9a0('0x28')](_0x14f3aa[_0xa9a0('0x19')][_0xa9a0('0x32')]);_0x47d72f[_0xa9a0('0x28')](_0x14f3aa[_0xa9a0('0x33')][_0xa9a0('0x33')]);_0x47d72f[_0xa9a0('0x28')](_0x2ecb61);break;default:_0x47d72f=_[_0xa9a0('0x12')](_0x4a17f9[_0xa9a0('0x24')])?[]:_0x4a17f9[_0xa9a0('0x24')][_0xa9a0('0x25')](',');}var _0x38e40d={'id':util['format'](_0xa9a0('0x34'),_0x2538b7,_0x4a17f9['id'],_0x4a17f9[_0xa9a0('0x21')]),'condition':require(_0xa9a0('0x35'))['condition'](_0x2538b7,getIntervals(_0x64285a[_0xa9a0('0x36')],_0x4a17f9),_0x64285a),'consequence':require(_0xa9a0('0x37')+_0x4a17f9[_0xa9a0('0x21')])['consequence'](_0x2538b7,_0x47d72f,_0x64285a,_0x14f3aa),'p':_0x4a17f9['priority']||0x0};logger[_0xa9a0('0x38')](_0xa9a0('0x39'),_0x38e40d['id'],_0xa9a0('0x3a'),getIntervals(_0x64285a[_0xa9a0('0x36')],_0x4a17f9)[_0xa9a0('0x20')](_0xa9a0('0x3b')));_0x4aabec[_0xa9a0('0x28')](_0x38e40d);}else{logger[_0xa9a0('0x3c')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xa9a0('0x20')](__dirname,_0xa9a0('0x1d'),_0x4a17f9[_0xa9a0('0x21')]+_0xa9a0('0x3d')));}}_0x64285a[_0xa9a0('0x17')][_0x2538b7]=new RuleEngine(_0x4aabec);_0x64285a['rules'][_0x2538b7][_0xa9a0('0x3e')](_0x14f3aa,function(_0x4be558){logger['info'](_0xa9a0('0x3f'),JSON[_0xa9a0('0x40')](_0x4be558['matchPath']));if(_0x64285a[_0xa9a0('0x17')][_0x2538b7]){_0x64285a['rules'][_0x2538b7][_0xa9a0('0x41')](_0xa9a0('0x42'));}});return _0xae4300({'code':0xc8,'message':_0x14f3aa});}else{if(_0x1e3f5d){logger[_0xa9a0('0x38')](util[_0xa9a0('0xf')]('Skipped\x20routing\x20for\x20%s',_0x2538b7));}else{logger[_0xa9a0('0x38')](_0xa9a0('0x43'));}return _0xae4300({'code':0xc8,'message':_0x14f3aa});}}catch(_0x139637){logger['error'](_0x139637[_0xa9a0('0x44')]);return _0x43e0be(_0x2533bc[_0xa9a0('0x3c')](0x1f4,_0x139637));}}return _0x43e0be(_0xa9a0('0x45'));});},'AcceptMessage':function(_0x2f1c07){var _0x59d8a8=this;return new Promise(function(_0x23c786,_0x5d9f45){if(_0x2f1c07[_0xa9a0('0x46')]&&_0x2f1c07[_0xa9a0('0x46')]['id']){if(_0x64285a['agents'][_0x2f1c07[_0xa9a0('0x46')]['id']]){_0x64285a['agents'][_0x2f1c07[_0xa9a0('0x46')]['id']][_0xa9a0('0x47')]=![];_0x64285a['agents'][_0x2f1c07[_0xa9a0('0x46')]['id']][_0xa9a0('0x48')]=undefined;}}if(_0x2f1c07['message']&&_0x2f1c07['message']['id']){try{var _0x5242bc=getId(_0x2f1c07[_0xa9a0('0x26')],_0x2f1c07[_0xa9a0('0x18')]?_0x2f1c07[_0xa9a0('0x18')]['id']:0x0,_0x2f1c07[_0xa9a0('0x19')]?_0x2f1c07[_0xa9a0('0x19')]['id']:0x0);if(_0x64285a[_0xa9a0('0x17')][_0x5242bc]){_0x64285a[_0xa9a0('0x17')][_0x5242bc][_0xa9a0('0x41')](_0xa9a0('0x49'));if(rpc[_0x2f1c07[_0xa9a0('0x26')]+_0xa9a0('0x4a')]){rpc[_0x2f1c07['channel']+'QueueReport']['update'](_0x5242bc,{'UserId':_0x2f1c07[_0xa9a0('0x18')][_0xa9a0('0x4b')]})[_0xa9a0('0x4c')](function(){logger['error'](_0xa9a0('0x4d'));});}}return _0x23c786({'code':0xc8,'message':_0x2f1c07});}catch(_0x380e05){logger[_0xa9a0('0x3c')](_0x380e05[_0xa9a0('0x44')]);return _0x5d9f45(_0x59d8a8[_0xa9a0('0x3c')](0x1f4,_0x380e05));}}logger['error'](_0xa9a0('0x4e'));return _0x5d9f45(_0x59d8a8[_0xa9a0('0x3c')](0x1f4,_0xa9a0('0x4e')));});},'RejectMessage':function(_0x50a983){var _0x697de0=this;return new Promise(function(_0x53beb9,_0x1f6598){if(_0x50a983[_0xa9a0('0x46')]&&_0x50a983[_0xa9a0('0x46')]['id']){try{if(_0x64285a[_0xa9a0('0x4f')][_0x50a983[_0xa9a0('0x46')]['id']]){_0x64285a['agents'][_0x50a983[_0xa9a0('0x46')]['id']]['busy']=![];_0x64285a[_0xa9a0('0x4f')][_0x50a983['agent']['id']]['busyQueue']=undefined;}return _0x53beb9({'code':0xc8,'message':_0x50a983});}catch(_0x15978b){logger['error'](_0x15978b[_0xa9a0('0x44')]);return _0x1f6598(_0x697de0[_0xa9a0('0x3c')](0x1f4,_0x15978b));}}logger[_0xa9a0('0x3c')](_0xa9a0('0x4e'));return _0x1f6598(_0x697de0['error'](0x1f4,_0xa9a0('0x4e')));});},'AbandonInteraction':function(_0x4a6798){var _0x376ad8=this;return new Promise(function(_0x3283e8,_0x29ead1){if(_0x4a6798[_0xa9a0('0x26')]&&_0x4a6798[_0xa9a0('0x19')]&&_0x4a6798[_0xa9a0('0x19')]['id']){try{var _0x329e8f=getId(_0x4a6798[_0xa9a0('0x26')],_0x4a6798[_0xa9a0('0x18')]?_0x4a6798[_0xa9a0('0x18')]['id']:0x0,_0x4a6798[_0xa9a0('0x19')]?_0x4a6798['interaction']['id']:0x0);if(_0x64285a[_0xa9a0('0x17')][_0x329e8f]){_0x64285a[_0xa9a0('0x17')][_0x329e8f][_0xa9a0('0x41')](_0xa9a0('0x49'));}return _0x3283e8({'code':0xc8,'message':_0x4a6798});}catch(_0x5c4468){logger[_0xa9a0('0x3c')](_0x5c4468[_0xa9a0('0x44')]);return _0x29ead1(_0x376ad8[_0xa9a0('0x3c')](0x1f4,_0x5c4468));}}logger['error'](_0xa9a0('0x4e'));return _0x29ead1(_0x376ad8['error'](0x1f4,_0xa9a0('0x4e')));});},'AgentCapacity':function(_0x16c40d){var _0x38fafc=this;return new Promise(function(_0x1fef34,_0x9b4d8d){if(_0x64285a[_0xa9a0('0x4f')]['hasOwnProperty'](_0x16c40d['id'])){for(var _0xbf1aa1 in _0x16c40d[_0xa9a0('0x50')]){if(_0x16c40d[_0xa9a0('0x50')][_0xa9a0('0x51')](_0xbf1aa1)){if(_0x64285a[_0xa9a0('0x4f')][_0x16c40d['id']]['hasOwnProperty'](_0xbf1aa1+'CurrentCapacity')){_0x64285a[_0xa9a0('0x4f')][_0x16c40d['id']][_0xbf1aa1+_0xa9a0('0x52')]=parseInt(_0x16c40d[_0xa9a0('0x50')][_0xbf1aa1],0xa);}}}_0x64285a[_0xa9a0('0x4f')][_0x16c40d['id']][_0xa9a0('0x53')]();return _0x1fef34({'code':0xc8,'message':_0x64285a[_0xa9a0('0x4f')][_0x16c40d['id']]});}else{return _0x9b4d8d(_0x38fafc[_0xa9a0('0x3c')](0x1f4,_0xa9a0('0x54')));}});},'Agents':function(_0x4ff945){return new Promise(function(_0x410458){var _0x4e093d=_[_0xa9a0('0x55')](_0x64285a[_0xa9a0('0x4f')]);if(_0x4ff945&&_0x4ff945['id']){var _0x883503=_[_0xa9a0('0x56')](_0x4e093d,function(_0x5134d5){return _0x5134d5['id']===_0x4ff945['id'];});_0x410458(_0x883503);}else{_0x410458({'count':_0x4e093d[_0xa9a0('0x1e')],'rows':_0x4e093d});}});},'ChatQueues':function(){return new Promise(function(_0xc291f7){var _0x435854=[];for(var _0x322ddf in _0x64285a['chatQueues']){if(_0x64285a[_0xa9a0('0x57')][_0xa9a0('0x51')](_0x322ddf)){var _0x3b4af8=_0x64285a[_0xa9a0('0x57')][_0x322ddf];var _0x242c91={'id':_0x3b4af8['id'],'available':_0x3b4af8[_0xa9a0('0x58')],'loggedIn':_0x3b4af8[_0xa9a0('0x59')],'name':_0x3b4af8[_0xa9a0('0x5a')],'paused':_0x3b4af8[_0xa9a0('0x5b')],'waiting':_0x3b4af8[_0xa9a0('0x5c')]};_0x435854['push'](_0x242c91);}}_0xc291f7({'count':_0x435854[_0xa9a0('0x1e')],'rows':_0x435854});});},'MailQueues':function(){return new Promise(function(_0x3784cb){var _0xc79226=[];for(var _0x480c33 in _0x64285a['mailQueues']){if(_0x64285a[_0xa9a0('0x5d')]['hasOwnProperty'](_0x480c33)){var _0x265e40=_0x64285a['mailQueues'][_0x480c33];var _0x2f6510={'id':_0x265e40['id'],'available':_0x265e40[_0xa9a0('0x58')],'loggedIn':_0x265e40[_0xa9a0('0x59')],'name':_0x265e40[_0xa9a0('0x5a')],'paused':_0x265e40[_0xa9a0('0x5b')],'waiting':_0x265e40[_0xa9a0('0x5c')]};_0xc79226['push'](_0x2f6510);}}_0x3784cb({'count':_0xc79226['length'],'rows':_0xc79226});});},'OpenchannelQueues':function(){return new Promise(function(_0x555de6){var _0x36e0=[];for(var _0x4a396e in _0x64285a['openchannelQueues']){if(_0x64285a[_0xa9a0('0x5e')][_0xa9a0('0x51')](_0x4a396e)){var _0x1f585b=_0x64285a[_0xa9a0('0x5e')][_0x4a396e];var _0x303160={'id':_0x1f585b['id'],'available':_0x1f585b[_0xa9a0('0x58')],'loggedIn':_0x1f585b[_0xa9a0('0x59')],'name':_0x1f585b[_0xa9a0('0x5a')],'paused':_0x1f585b[_0xa9a0('0x5b')],'waiting':_0x1f585b[_0xa9a0('0x5c')]};_0x36e0[_0xa9a0('0x28')](_0x303160);}}_0x555de6({'count':_0x36e0[_0xa9a0('0x1e')],'rows':_0x36e0});});},'SmsQueues':function(){return new Promise(function(_0x202bb8){var _0x237b6a=[];for(var _0x558a52 in _0x64285a[_0xa9a0('0x5f')]){if(_0x64285a[_0xa9a0('0x5f')][_0xa9a0('0x51')](_0x558a52)){var _0x499e6f=_0x64285a[_0xa9a0('0x5f')][_0x558a52];var _0x5d1a0f={'id':_0x499e6f['id'],'available':_0x499e6f[_0xa9a0('0x58')],'loggedIn':_0x499e6f[_0xa9a0('0x59')],'name':_0x499e6f[_0xa9a0('0x5a')],'paused':_0x499e6f[_0xa9a0('0x5b')],'waiting':_0x499e6f[_0xa9a0('0x5c')]};_0x237b6a[_0xa9a0('0x28')](_0x5d1a0f);}}_0x202bb8({'count':_0x237b6a['length'],'rows':_0x237b6a});});},'FaxQueues':function(){return new Promise(function(_0x4ae5d5){var _0x33b348=[];for(var _0x36f9a9 in _0x64285a[_0xa9a0('0x60')]){if(_0x64285a[_0xa9a0('0x60')]['hasOwnProperty'](_0x36f9a9)){var _0x75113d=_0x64285a[_0xa9a0('0x60')][_0x36f9a9];var _0x819611={'id':_0x75113d['id'],'available':_0x75113d[_0xa9a0('0x58')],'loggedIn':_0x75113d['loggedIn'],'name':_0x75113d[_0xa9a0('0x5a')],'paused':_0x75113d[_0xa9a0('0x5b')],'waiting':_0x75113d['waiting']};_0x33b348['push'](_0x819611);}}_0x4ae5d5({'count':_0x33b348['length'],'rows':_0x33b348});});},'WhatsappQueues':function(){return new Promise(function(_0x179420){var _0xb1ba3d=[];for(var _0x275b1b in _0x64285a[_0xa9a0('0x61')]){if(_0x64285a[_0xa9a0('0x61')][_0xa9a0('0x51')](_0x275b1b)){var _0x3579d5=_0x64285a[_0xa9a0('0x61')][_0x275b1b];var _0x2bf682={'id':_0x3579d5['id'],'available':_0x3579d5['available'],'loggedIn':_0x3579d5[_0xa9a0('0x59')],'name':_0x3579d5[_0xa9a0('0x5a')],'paused':_0x3579d5['paused'],'waiting':_0x3579d5[_0xa9a0('0x5c')]};_0xb1ba3d[_0xa9a0('0x28')](_0x2bf682);}}_0x179420({'count':_0xb1ba3d[_0xa9a0('0x1e')],'rows':_0xb1ba3d});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x579a96){var _0x33aa88=_[_0xa9a0('0x55')](_0x64285a['chatQueuesWaitingInteractions']);_0x579a96({'count':_0x33aa88['length'],'rows':_0x33aa88});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x34176b){var _0x37a653=_['values'](_0x64285a[_0xa9a0('0x62')]);_0x34176b({'count':_0x37a653[_0xa9a0('0x1e')],'rows':_0x37a653});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x429efc){var _0x510b3b=_[_0xa9a0('0x55')](_0x64285a['openchannelQueuesWaitingInteractions']);_0x429efc({'count':_0x510b3b['length'],'rows':_0x510b3b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x214a59){var _0x41020f=_['values'](_0x64285a[_0xa9a0('0x63')]);_0x214a59({'count':_0x41020f[_0xa9a0('0x1e')],'rows':_0x41020f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x480493){var _0xb343bb=_[_0xa9a0('0x55')](_0x64285a[_0xa9a0('0x64')]);_0x480493({'count':_0xb343bb['length'],'rows':_0xb343bb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2fca0d){var _0x419a0a=_[_0xa9a0('0x55')](_0x64285a['whatsappQueuesWaitingInteractions']);_0x2fca0d({'count':_0x419a0a[_0xa9a0('0x1e')],'rows':_0x419a0a});});}};var _0x23dac9=jayson['server'](_0xa3c21e)[_0xa9a0('0x65')]();_0x23dac9['on'](_0xa9a0('0x3c'),function(_0x6bc583){logger[_0xa9a0('0x3c')](JSON[_0xa9a0('0x40')](_0x6bc583));return _0x19d6c5(_0x6bc583);});_0x23dac9[_0xa9a0('0x16')](0x232c,'127.0.0.1',function(){console[_0xa9a0('0x66')](_0xa9a0('0x67'),0x232c);return _0x142fbc(_0xa9a0('0x68')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 2ae4f5c..dcc23d9 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 _0x4120=['all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','format','[%s][INTERVAL]\x20%s'];(function(_0x759f5b,_0x314bd8){var _0x3b73b4=function(_0x21e68c){while(--_0x21e68c){_0x759f5b['push'](_0x759f5b['shift']());}};_0x3b73b4(++_0x314bd8);}(_0x4120,0x1b7));var _0x0412=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4120[_0x37bd26];return _0xe83dc4;};'use strict';var util=require('util');var BPromise=require(_0x0412('0x0'));var jayson=require(_0x0412('0x1'));var _=require(_0x0412('0x2'));var logger=require(_0x0412('0x3'))(_0x0412('0x4'));var client=jayson[_0x0412('0x5')]['http']({'port':0x232a});function request(_0x145559,_0x47f566){return new BPromise(function(_0x42d121,_0x24d333){return client[_0x0412('0x6')](_0x145559,_0x47f566)[_0x0412('0x7')](function(_0x15a2e5){if(_0x15a2e5[_0x0412('0x8')]){return _0x24d333(_0x15a2e5['error'][_0x0412('0x9')]);}else{return _0x42d121(_0x15a2e5[_0x0412('0xa')]);}})[_0x0412('0xb')](function(_0x3af258){return _0x24d333(_0x3af258);});});}exports['condition']=function(_0x52e7a6,_0x233aa9,_0x5d5614){return function(_0xeae84e){if(_0x5d5614['rules']&&!_0x5d5614[_0x0412('0xc')][_0x52e7a6]){logger[_0x0412('0xd')](_0x0412('0xe'),_0x52e7a6);return _0xeae84e['stop']();}var _0x1bbf7=[];for(var _0x13ff65=0x0;_0x13ff65<_0x233aa9['length'];_0x13ff65+=0x1){_0x1bbf7['push'](request('Command',{'command':util[_0x0412('0xf')]('iftime\x20%s',_0x233aa9[_0x13ff65])})[_0x0412('0x7')](function(_0x4c7d1a){return _0x4c7d1a&&_0x4c7d1a['message']&&_0x4c7d1a[_0x0412('0x9')]['indexOf']('true')>=0x0?!![]:![];})['catch'](function(){logger[_0x0412('0x8')](_0x0412('0x10'),_0x52e7a6,_0x233aa9[_0x13ff65]);}));}BPromise[_0x0412('0x11')](_0x1bbf7)['then'](function(_0x563ec9){var _0x52d6a9=_[_0x0412('0x12')](_0x563ec9);logger[_0x0412('0xd')](_0x0412('0x13'),_0x52e7a6,_0x233aa9['join'](_0x0412('0x14')),_0x52d6a9);_0xeae84e[_0x0412('0x15')](_0x52d6a9);})[_0x0412('0xb')](function(_0x207837){logger[_0x0412('0x8')](_0x0412('0x13'),_0x52e7a6,_0x233aa9[_0x0412('0x16')]('\x20|\x20'),_0x207837[_0x0412('0x17')]);_0xeae84e['stop']();});};}; \ No newline at end of file +var _0xddc0=['true','catch','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','jayson/promise','lodash','routing','client','http','request','error','message','result','condition','rules','info','stop','length','Command','format','then','indexOf'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xddc0,0x167));var _0x0ddc=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xddc0[_0x2706da];return _0x3ba87e;};'use strict';var util=require(_0x0ddc('0x0'));var BPromise=require('bluebird');var jayson=require(_0x0ddc('0x1'));var _=require(_0x0ddc('0x2'));var logger=require('../../../config/logger')(_0x0ddc('0x3'));var client=jayson[_0x0ddc('0x4')][_0x0ddc('0x5')]({'port':0x232a});function request(_0x2be16d,_0x4b3aca){return new BPromise(function(_0x4bd19a,_0x5b15b5){return client[_0x0ddc('0x6')](_0x2be16d,_0x4b3aca)['then'](function(_0x4eef15){if(_0x4eef15[_0x0ddc('0x7')]){return _0x5b15b5(_0x4eef15['error'][_0x0ddc('0x8')]);}else{return _0x4bd19a(_0x4eef15[_0x0ddc('0x9')]);}})['catch'](function(_0x46611a){return _0x5b15b5(_0x46611a);});});}exports[_0x0ddc('0xa')]=function(_0xc9d569,_0xaca9ee,_0x1fcc04){return function(_0x2a7713){if(_0x1fcc04[_0x0ddc('0xb')]&&!_0x1fcc04[_0x0ddc('0xb')][_0xc9d569]){logger[_0x0ddc('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xc9d569);return _0x2a7713[_0x0ddc('0xd')]();}var _0x1d5ee9=[];for(var _0x301829=0x0;_0x301829<_0xaca9ee[_0x0ddc('0xe')];_0x301829+=0x1){_0x1d5ee9['push'](request(_0x0ddc('0xf'),{'command':util[_0x0ddc('0x10')]('iftime\x20%s',_0xaca9ee[_0x301829])})[_0x0ddc('0x11')](function(_0x5d36e8){return _0x5d36e8&&_0x5d36e8[_0x0ddc('0x8')]&&_0x5d36e8[_0x0ddc('0x8')][_0x0ddc('0x12')](_0x0ddc('0x13'))>=0x0?!![]:![];})[_0x0ddc('0x14')](function(){logger['error']('[%s][INTERVAL]\x20%s',_0xc9d569,_0xaca9ee[_0x301829]);}));}BPromise[_0x0ddc('0x15')](_0x1d5ee9)[_0x0ddc('0x11')](function(_0x3bc178){var _0x2cc762=_['some'](_0x3bc178);logger[_0x0ddc('0xc')](_0x0ddc('0x16'),_0xc9d569,_0xaca9ee[_0x0ddc('0x17')](_0x0ddc('0x18')),_0x2cc762);_0x2a7713[_0x0ddc('0x19')](_0x2cc762);})[_0x0ddc('0x14')](function(_0x5e0782){logger[_0x0ddc('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0xc9d569,_0xaca9ee[_0x0ddc('0x17')]('\x20|\x20'),_0x5e0782[_0x0ddc('0x1a')]);_0x2a7713[_0x0ddc('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c2d1fa8..97abc10 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 _0xd64b=['[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','complete','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten'];(function(_0x476cc5,_0x151f9e){var _0x57dce3=function(_0x2d21b1){while(--_0x2d21b1){_0x476cc5['push'](_0x476cc5['shift']());}};_0x57dce3(++_0x151f9e);}(_0xd64b,0xc1));var _0xbd64=function(_0x5b162f,_0x4cc7bd){_0x5b162f=_0x5b162f-0x0;var _0x2881a1=_0xd64b[_0x5b162f];return _0x2881a1;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var utils=require(_0xbd64('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4bfb7c,_0x30b9b3){utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x4'),_0x4bfb7c[_0xbd64('0x5')],_0x4bfb7c['channel'],_0x4bfb7c['queue'],_0x4bfb7c['membername'],_0x4bfb7c['interface'],_0x4bfb7c[_0xbd64('0x6')],_0x4bfb7c[_0xbd64('0x7')],_0x4bfb7c[_0xbd64('0x8')]));if(_0x4bfb7c[_0xbd64('0x9')]){utils[_0xbd64('0xa')](_0x4bfb7c[_0xbd64('0x9')])[_0xbd64('0xb')](function(_0x5d32b8){if(_0x5d32b8){_0x4bfb7c['type']=_0x5d32b8[_0xbd64('0xc')];_0x4bfb7c[_0xbd64('0xd')]=_0x4bfb7c[_0xbd64('0xe')]?_0x5d32b8['acw']:![];_0x4bfb7c[_0xbd64('0xf')]=_0x4bfb7c[_0xbd64('0xd')]?_0x5d32b8[_0xbd64('0x10')]:0x0;}utils[_0xbd64('0x11')]('CreateVoiceAgentReport',_0x4bfb7c);});}else{utils[_0xbd64('0x11')]('CreateVoiceAgentReport',_0x4bfb7c);}if(_0x30b9b3){delete transfers[_0x4bfb7c[_0xbd64('0x5')]];}else{delete agents[_0x4bfb7c[_0xbd64('0x12')]];}}exports[_0xbd64('0x13')]=function(_0x2183e2){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x15'),_0x2183e2[_0xbd64('0x5')]),_0x2183e2);agents[_0x2183e2[_0xbd64('0x12')]]=_0x2183e2;agents[_0x2183e2['destuniqueid']][_0xbd64('0x16')]=utils[_0xbd64('0x17')]();agents[_0x2183e2[_0xbd64('0x12')]][_0xbd64('0x8')]=_0xbd64('0x18');agents[_0x2183e2['destuniqueid']][_0xbd64('0x7')]=null;agents[_0x2183e2['destuniqueid']][_0xbd64('0x19')]=null;utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x1a'),_0x2183e2[_0xbd64('0x5')],agents[_0x2183e2[_0xbd64('0x12')]][_0xbd64('0x1b')],_0x2183e2[_0xbd64('0x12')]));}catch(_0x5d3b00){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')]('[%s][agents][agentcalled]',_0x2183e2['uniqueid']),_0x5d3b00);}};exports[_0xbd64('0x1d')]=function(_0x42b328){try{if(!_[_0xbd64('0x1e')](agents[_0x42b328[_0xbd64('0x12')]])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')]('[%s][agents][agentringnoanswer]',_0x42b328['uniqueid']),_0x42b328);utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x1f'),_0x42b328[_0xbd64('0x5')],agents[_0x42b328['destuniqueid']]['membername'],_0x42b328[_0xbd64('0x12')]));agents[_0x42b328['destuniqueid']][_0xbd64('0x1d')]=!![];agents[_0x42b328['destuniqueid']][_0xbd64('0x20')]=utils[_0xbd64('0x17')]();agents[_0x42b328[_0xbd64('0x12')]][_0xbd64('0x8')]='timeout';agents[_0x42b328[_0xbd64('0x12')]][_0xbd64('0x21')]=_0xbd64('0x22');agents[_0x42b328[_0xbd64('0x12')]]['holdtime']=_0x42b328['ringtime']?parseInt(_0x42b328[_0xbd64('0x23')])/0x3e8:0x0;agents[_0x42b328['destuniqueid']]['talktime']=0x0;unanswered[_0xbd64('0x24')](_0x42b328['destuniqueid']);}}catch(_0x3cf5b7){utils['error'](util[_0xbd64('0x3')]('[%s][agents][agentringnoanswer]',_0x42b328[_0xbd64('0x5')]),_0x3cf5b7);}};exports[_0xbd64('0x25')]=function(_0x3be63a){try{_[_0xbd64('0x26')](agents,function(_0x306f19,_0x207ffc){if(_0x306f19['uniqueid']==_0x3be63a[_0xbd64('0x5')]&&!_[_0xbd64('0x27')](unanswered,_0x306f19[_0xbd64('0x12')])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x28'),_0x3be63a['uniqueid']),_0x3be63a);utils['info'](util[_0xbd64('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3be63a[_0xbd64('0x5')],_0x306f19[_0xbd64('0x1b')],_0x306f19['destuniqueid']));_0x306f19['agentringnoanswer']=!![];_0x306f19[_0xbd64('0x20')]=utils['now']();_0x306f19['lastevent']=_0xbd64('0x29');_0x306f19[_0xbd64('0x21')]=_0xbd64('0x29');_0x306f19['holdtime']=_0x3be63a[_0xbd64('0x2a')];_0x306f19['talktime']=0x0;writeDB(_0x306f19);}});}catch(_0x1fc9cf){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x28'),_0x3be63a[_0xbd64('0x5')]),_0x1fc9cf);}};exports[_0xbd64('0x2b')]=function(_0x513339){try{if(agents[_0x513339['destuniqueid']]){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x2c'),_0x513339[_0xbd64('0x5')]),_0x513339);utils[_0xbd64('0x2')](util[_0xbd64('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x513339['uniqueid'],agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x1b')],_0x513339[_0xbd64('0x12')]));agents[_0x513339['destuniqueid']]['agentconnectAt']=utils[_0xbd64('0x17')]();agents[_0x513339['destuniqueid']][_0xbd64('0x7')]=_0x513339['connectedlinenum'];agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x19')]=_0x513339['connectedlinename'];agents[_0x513339[_0xbd64('0x12')]]['holdtime']=_0x513339['ringtime'];agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x8')]=_0xbd64('0x2d');_['forIn'](agents,function(_0x540e2a,_0x5d6bcf){if(_0x540e2a[_0xbd64('0x12')]!=_0x513339[_0xbd64('0x12')]&&_0x540e2a['uniqueid']==_0x513339[_0xbd64('0x5')]){_0x540e2a[_0xbd64('0x2e')]=0x0;_0x540e2a[_0xbd64('0x2a')]=_0x513339[_0xbd64('0x23')];_0x540e2a['agentringnoanswer']=!![];_0x540e2a['agentringnoanswerAt']=utils[_0xbd64('0x17')]();_0x540e2a['lastevent']='answered_elsewhere';_0x540e2a[_0xbd64('0x21')]=_0xbd64('0x2f');_0x540e2a[_0xbd64('0x30')]=_0x513339[_0xbd64('0x12')];_0x540e2a[_0xbd64('0x31')]=_0x513339[_0xbd64('0x1b')];writeDB(_0x540e2a);}});}}catch(_0x247775){utils[_0xbd64('0x1c')](util['format'](_0xbd64('0x2c'),_0x513339[_0xbd64('0x5')]),_0x247775);}};exports['agentcomplete']=function(_0x41b27a){try{if(!_[_0xbd64('0x1e')](agents[_0x41b27a[_0xbd64('0x12')]])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x32'),_0x41b27a[_0xbd64('0x5')]),_0x41b27a);utils['info'](util[_0xbd64('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x41b27a[_0xbd64('0x5')],agents[_0x41b27a['destuniqueid']][_0xbd64('0x1b')],_0x41b27a[_0xbd64('0x12')]));agents[_0x41b27a[_0xbd64('0x12')]]['agentcomplete']=!![];agents[_0x41b27a[_0xbd64('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x41b27a['destuniqueid']][_0xbd64('0x2e')]=utils[_0xbd64('0x33')](agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x34')],agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x35')]);agents[_0x41b27a[_0xbd64('0x12')]]['reason']=_0x41b27a[_0xbd64('0x21')];agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x8')]='complete';writeDB(agents[_0x41b27a[_0xbd64('0x12')]]);}}catch(_0x436f36){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x32'),_0x41b27a['uniqueid']),_0x436f36);}};exports[_0xbd64('0x36')]=function(_0x1a9ec8){try{if(!_[_0xbd64('0x1e')](agents[_0x1a9ec8[_0xbd64('0x37')]])){utils['debug'](util['format'](_0xbd64('0x38'),_0x1a9ec8[_0xbd64('0x5')]),_0x1a9ec8);utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x39'),_0x1a9ec8[_0xbd64('0x5')],agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x1b')],agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x5')]));agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x3a')]=!![];agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x3b')]=_0xbd64('0x3c');agents[_0x1a9ec8['transfereruniqueid']][_0xbd64('0x3d')]=_0x1a9ec8['extension'];agents[_0x1a9ec8['transfereruniqueid']]['transferuniqueid']=agents[_0x1a9ec8['transfereruniqueid']][_0xbd64('0x5')];}}catch(_0x2f56df){utils['error'](util[_0xbd64('0x3')](_0xbd64('0x38'),_0x1a9ec8[_0xbd64('0x5')]),_0x2f56df);}};exports['attendedtransfer']=function(_0x2c42fd){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x3e'),_0x2c42fd[_0xbd64('0x3f')]),_0x2c42fd);if(_0x2c42fd[_0xbd64('0x3f')]==_0x2c42fd['origtransfererlinkedid']){if(!_['isNil'](agents[_0x2c42fd['secondtransfereruniqueid']])){utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x40'),_0x2c42fd[_0xbd64('0x3f')],agents[_0x2c42fd['secondtransfereruniqueid']][_0xbd64('0x1b')]));agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x3a')]=!![];agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x3b')]=_0xbd64('0x42');agents[_0x2c42fd['secondtransfereruniqueid']][_0xbd64('0x3d')]=_0x2c42fd[_0xbd64('0x43')];agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x44')]=_0x2c42fd[_0xbd64('0x3f')];}if(_0x2c42fd[_0xbd64('0x45')]&&agents[_0x2c42fd[_0xbd64('0x45')]]){agents[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x46')]=0x1;transfers[_0x2c42fd[_0xbd64('0x45')]]=_[_0xbd64('0x47')](agents[_0x2c42fd[_0xbd64('0x45')]]);transfers[_0x2c42fd['transfereeuniqueid']]['calleridnum']=agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x6')];transfers[_0x2c42fd['transfereeuniqueid']]['calleridname']=agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x48')];transfers[_0x2c42fd['transfereeuniqueid']][_0xbd64('0x16')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x35')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x2a')]=0x0;transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x46')]=0x2;}}else if(_0x2c42fd['secondtransfereruniqueid']==_0x2c42fd[_0xbd64('0x49')]){if(!_[_0xbd64('0x1e')](agents[_0x2c42fd[_0xbd64('0x3f')]])){utils['info'](util[_0xbd64('0x3')](_0xbd64('0x40'),_0x2c42fd['origtransfereruniqueid'],agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x1b')]));agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3a')]=!![];agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3b')]='ATTENDED';agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3d')]=_0x2c42fd[_0xbd64('0x4a')];agents[_0x2c42fd[_0xbd64('0x3f')]]['transferuniqueid']=_0x2c42fd[_0xbd64('0x41')];}if(_0x2c42fd[_0xbd64('0x4b')]&&agents[_0x2c42fd['transfertargetuniqueid']]){agents[_0x2c42fd[_0xbd64('0x4b')]]['agententerreason']=0x1;transfers[_0x2c42fd[_0xbd64('0x4b')]]=_[_0xbd64('0x47')](agents[_0x2c42fd[_0xbd64('0x4b')]]);transfers[_0x2c42fd[_0xbd64('0x4b')]]['calleridnum']=agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x6')];transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x48')]=agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x48')];transfers[_0x2c42fd['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x35')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x2a')]=0x0;transfers[_0x2c42fd[_0xbd64('0x4b')]]['agententerreason']=0x2;}}}catch(_0x30eddc){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x3e'),_0x2c42fd[_0xbd64('0x3f')]),_0x30eddc);}};exports[_0xbd64('0x4c')]=function(_0x2f3516){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x4d'),_0x2f3516[_0xbd64('0x5')]),_0x2f3516);if(agents[_0x2f3516[_0xbd64('0x5')]]&&agents[_0x2f3516['uniqueid']]['reason']===_0xbd64('0x22')){if(_0x2f3516[_0xbd64('0x4e')]==='21'){agents[_0x2f3516[_0xbd64('0x5')]]['reason']=_0xbd64('0x4f');agents[_0x2f3516['uniqueid']][_0xbd64('0x8')]=_0xbd64('0x4f');}utils[_0xbd64('0x2')](util[_0xbd64('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2f3516[_0xbd64('0x5')],agents[_0x2f3516['uniqueid']][_0xbd64('0x1b')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(agents[_0x2f3516['uniqueid']]);var _0x43780f=unanswered[_0xbd64('0x50')](_0x2f3516['uniqueid']);if(_0x43780f>-0x1){unanswered[_0xbd64('0x51')](_0x43780f,0x1);}}if(transfers[_0x2f3516[_0xbd64('0x5')]]){transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0xe')]=!![];transfers[_0x2f3516['uniqueid']][_0xbd64('0x34')]=utils['now']();transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x2e')]=utils[_0xbd64('0x33')](transfers[_0x2f3516['uniqueid']]['agentcompleteAt'],transfers[_0x2f3516['uniqueid']]['agentconnectAt']);transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')]=_0xbd64('0x52');transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]='complete';utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x53'),_0x2f3516[_0xbd64('0x5')],transfers[_0x2f3516[_0xbd64('0x5')]]['membername'],transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(transfers[_0x2f3516['uniqueid']],!![]);}if(agents[_0x2f3516['uniqueid']]&&agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x35')]){agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0xe')]=!![];agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x34')]=utils[_0xbd64('0x17')]();agents[_0x2f3516[_0xbd64('0x5')]]['talktime']=utils[_0xbd64('0x33')](agents[_0x2f3516['uniqueid']][_0xbd64('0x34')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x35')]);agents[_0x2f3516['uniqueid']][_0xbd64('0x21')]=agents[_0x2f3516['uniqueid']]['transfer']?_0xbd64('0x3a'):_0xbd64('0x52');agents[_0x2f3516[_0xbd64('0x5')]]['lastevent']=_0xbd64('0x54');utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x53'),_0x2f3516['uniqueid'],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x1b')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(agents[_0x2f3516[_0xbd64('0x5')]]);}}catch(_0x439bbd){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x4d'),_0x2f3516[_0xbd64('0x5')]),_0x439bbd);}}; \ No newline at end of file +var _0x96cc=['rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause'];(function(_0x5228d5,_0x5da64e){var _0x40695d=function(_0x362474){while(--_0x362474){_0x5228d5['push'](_0x5228d5['shift']());}};_0x40695d(++_0x5da64e);}(_0x96cc,0x16c));var _0xc96c=function(_0x2c2954,_0x3cadf4){_0x2c2954=_0x2c2954-0x0;var _0x1e834e=_0x96cc[_0x2c2954];return _0x1e834e;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var utils=require(_0xc96c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f11f2,_0x30bf8a){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x4'),_0x5f11f2[_0xc96c('0x5')],_0x5f11f2[_0xc96c('0x6')],_0x5f11f2[_0xc96c('0x7')],_0x5f11f2[_0xc96c('0x8')],_0x5f11f2[_0xc96c('0x9')],_0x5f11f2['calleridnum'],_0x5f11f2[_0xc96c('0xa')],_0x5f11f2[_0xc96c('0xb')]));if(_0x5f11f2[_0xc96c('0x7')]){utils[_0xc96c('0xc')](_0x5f11f2[_0xc96c('0x7')])[_0xc96c('0xd')](function(_0x36b2b4){if(_0x36b2b4){_0x5f11f2['type']=_0x36b2b4[_0xc96c('0xe')];_0x5f11f2[_0xc96c('0xf')]=_0x5f11f2[_0xc96c('0x10')]?_0x36b2b4['acw']:![];_0x5f11f2[_0xc96c('0x11')]=_0x5f11f2['agentacw']?_0x36b2b4[_0xc96c('0x12')]:0x0;}utils['request'](_0xc96c('0x13'),_0x5f11f2);});}else{utils[_0xc96c('0x14')](_0xc96c('0x13'),_0x5f11f2);}if(_0x30bf8a){delete transfers[_0x5f11f2[_0xc96c('0x5')]];}else{delete agents[_0x5f11f2['destuniqueid']];}}exports[_0xc96c('0x15')]=function(_0x43fcaa){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')]('[%s][agents][agentcalled]',_0x43fcaa[_0xc96c('0x5')]),_0x43fcaa);agents[_0x43fcaa[_0xc96c('0x17')]]=_0x43fcaa;agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0x18')]=utils[_0xc96c('0x19')]();agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x1a');agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xa')]=null;agents[_0x43fcaa[_0xc96c('0x17')]]['connectedlinename']=null;utils['info'](util[_0xc96c('0x3')](_0xc96c('0x1b'),_0x43fcaa[_0xc96c('0x5')],agents[_0x43fcaa[_0xc96c('0x17')]]['membername'],_0x43fcaa[_0xc96c('0x17')]));}catch(_0x100fdb){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x1d'),_0x43fcaa[_0xc96c('0x5')]),_0x100fdb);}};exports[_0xc96c('0x1e')]=function(_0x41daba){try{if(!_[_0xc96c('0x1f')](agents[_0x41daba[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x41daba);utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x21'),_0x41daba['uniqueid'],agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x8')],_0x41daba[_0xc96c('0x17')]));agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x1e')]=!![];agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x22')]=utils[_0xc96c('0x19')]();agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0xb')]='timeout';agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x23')]=_0xc96c('0x24');agents[_0x41daba[_0xc96c('0x17')]]['holdtime']=_0x41daba['ringtime']?parseInt(_0x41daba[_0xc96c('0x25')])/0x3e8:0x0;agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x26')]=0x0;unanswered[_0xc96c('0x27')](_0x41daba[_0xc96c('0x17')]);}}catch(_0x5e1727){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x5e1727);}};exports[_0xc96c('0x28')]=function(_0x40c72b){try{_[_0xc96c('0x29')](agents,function(_0x328ee4,_0x556108){if(_0x328ee4[_0xc96c('0x5')]==_0x40c72b['uniqueid']&&!_[_0xc96c('0x2a')](unanswered,_0x328ee4[_0xc96c('0x17')])){utils[_0xc96c('0x16')](util['format'](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x40c72b);utils[_0xc96c('0x2')](util[_0xc96c('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x40c72b['uniqueid'],_0x328ee4[_0xc96c('0x8')],_0x328ee4[_0xc96c('0x17')]));_0x328ee4[_0xc96c('0x1e')]=!![];_0x328ee4['agentringnoanswerAt']=utils[_0xc96c('0x19')]();_0x328ee4[_0xc96c('0xb')]=_0xc96c('0x2c');_0x328ee4[_0xc96c('0x23')]='abandoned';_0x328ee4[_0xc96c('0x2d')]=_0x40c72b[_0xc96c('0x2d')];_0x328ee4['talktime']=0x0;writeDB(_0x328ee4);}});}catch(_0x2b1dec){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x2b1dec);}};exports[_0xc96c('0x2e')]=function(_0x4e8241){try{if(agents[_0x4e8241[_0xc96c('0x17')]]){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4e8241);utils[_0xc96c('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4e8241[_0xc96c('0x5')],agents[_0x4e8241[_0xc96c('0x17')]]['membername'],_0x4e8241['destuniqueid']));agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xa')]=_0x4e8241[_0xc96c('0xa')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x31')]=_0x4e8241[_0xc96c('0x31')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x2d')]=_0x4e8241['ringtime'];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x32');_[_0xc96c('0x29')](agents,function(_0x4eb180,_0x167671){if(_0x4eb180[_0xc96c('0x17')]!=_0x4e8241[_0xc96c('0x17')]&&_0x4eb180['uniqueid']==_0x4e8241['uniqueid']){_0x4eb180[_0xc96c('0x26')]=0x0;_0x4eb180[_0xc96c('0x2d')]=_0x4e8241[_0xc96c('0x25')];_0x4eb180['agentringnoanswer']=!![];_0x4eb180[_0xc96c('0x22')]=utils[_0xc96c('0x19')]();_0x4eb180[_0xc96c('0xb')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x23')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x34')]=_0x4e8241[_0xc96c('0x17')];_0x4eb180[_0xc96c('0x35')]=_0x4e8241['membername'];writeDB(_0x4eb180);}});}}catch(_0x4c3088){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4c3088);}};exports['agentcomplete']=function(_0x5ee6ac){try{if(!_[_0xc96c('0x1f')](agents[_0x5ee6ac[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x5ee6ac);utils[_0xc96c('0x2')](util['format'](_0xc96c('0x37'),_0x5ee6ac[_0xc96c('0x5')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x8')],_0x5ee6ac['destuniqueid']));agents[_0x5ee6ac['destuniqueid']][_0xc96c('0x10')]=!![];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x30')]);agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x23')]=_0x5ee6ac['reason'];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x3a');writeDB(agents[_0x5ee6ac[_0xc96c('0x17')]]);}}catch(_0x56bce1){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x56bce1);}};exports['blindtransfer']=function(_0x2581ae){try{if(!_[_0xc96c('0x1f')](agents[_0x2581ae[_0xc96c('0x3b')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x3c'),_0x2581ae['uniqueid']),_0x2581ae);utils['info'](util['format'](_0xc96c('0x3d'),_0x2581ae['uniqueid'],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x8')],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')]));agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3e')]=!![];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3f')]=_0xc96c('0x40');agents[_0x2581ae[_0xc96c('0x3b')]]['transferexten']=_0x2581ae[_0xc96c('0x41')];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x42')]=agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')];}}catch(_0xcde9){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][blindtransfer]',_0x2581ae['uniqueid']),_0xcde9);}};exports['attendedtransfer']=function(_0x5c3d95){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0x5c3d95);if(_0x5c3d95[_0xc96c('0x44')]==_0x5c3d95[_0xc96c('0x45')]){if(!_[_0xc96c('0x1f')](agents[_0x5c3d95['secondtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x8')]));agents[_0x5c3d95[_0xc96c('0x47')]]['transfer']=!![];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x3f')]=_0xc96c('0x48');agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x4a')];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x42')]=_0x5c3d95[_0xc96c('0x44')];}if(_0x5c3d95[_0xc96c('0x4b')]&&agents[_0x5c3d95[_0xc96c('0x4b')]]){agents[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x4b')]]=_['clone'](agents[_0x5c3d95[_0xc96c('0x4b')]]);transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4d')];transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x4e')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4e')];transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentcalledAt']=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x2;}}else if(_0x5c3d95[_0xc96c('0x47')]==_0x5c3d95[_0xc96c('0x4f')]){if(!_['isNil'](agents[_0x5c3d95['origtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x44')]]['membername']));agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3e')]=!![];agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3f')]='ATTENDED';agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x50')];agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x42')]=_0x5c3d95['secondtransfereruniqueid'];}if(_0x5c3d95[_0xc96c('0x51')]&&agents[_0x5c3d95[_0xc96c('0x51')]]){agents[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x51')]]=_[_0xc96c('0x52')](agents[_0x5c3d95[_0xc96c('0x51')]]);transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x44')]]['calleridnum'];transfers[_0x5c3d95[_0xc96c('0x51')]]['calleridname']=agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x4e')];transfers[_0x5c3d95['transfertargetuniqueid']][_0xc96c('0x18')]=utils['now']();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x2;}}}catch(_0xbd6525){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0xbd6525);}};exports[_0xc96c('0x53')]=function(_0x43f94e){try{utils['debug'](util[_0xc96c('0x3')](_0xc96c('0x54'),_0x43f94e['uniqueid']),_0x43f94e);if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]]['reason']===_0xc96c('0x24')){if(_0x43f94e[_0xc96c('0x55')]==='21'){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')]=_0xc96c('0x56');agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]=_0xc96c('0x56');}utils[_0xc96c('0x2')](util['format'](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e[_0xc96c('0x5')]]['membername'],agents[_0x43f94e['uniqueid']][_0xc96c('0x23')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);var _0x1efa88=unanswered[_0xc96c('0x58')](_0x43f94e[_0xc96c('0x5')]);if(_0x1efa88>-0x1){unanswered['splice'](_0x1efa88,0x1);}}if(transfers[_0x43f94e[_0xc96c('0x5')]]){transfers[_0x43f94e[_0xc96c('0x5')]]['agentcomplete']=!![];transfers[_0x43f94e[_0xc96c('0x5')]]['agentcompleteAt']=utils[_0xc96c('0x19')]();transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);transfers[_0x43f94e[_0xc96c('0x5')]]['reason']=_0xc96c('0x59');transfers[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils['info'](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],transfers[_0x43f94e['uniqueid']][_0xc96c('0x8')],transfers[_0x43f94e[_0xc96c('0x5')]]['reason'],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(transfers[_0x43f94e[_0xc96c('0x5')]],!![]);}if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x10')]=!![];agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);agents[_0x43f94e[_0xc96c('0x5')]]['reason']=agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x3e')]?_0xc96c('0x3e'):_0xc96c('0x59');agents[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e['uniqueid']]['membername'],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')],agents[_0x43f94e['uniqueid']][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);}}catch(_0x563449){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][hangup]',_0x43f94e[_0xc96c('0x5')]),_0x563449);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ea08091..6b9f70e 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 _0x5a69=['connectedlinenum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%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','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','lastIndexOf','includes','noop','execif','lastdata','lodash','util','./utils','NO\x20ANSWER','BUSY','FAILED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum'];(function(_0x491ed9,_0x526af9){var _0x6a3002=function(_0x1a51f7){while(--_0x1a51f7){_0x491ed9['push'](_0x491ed9['shift']());}};_0x6a3002(++_0x526af9);}(_0x5a69,0x19b));var _0x95a6=function(_0x440201,_0x61b02e){_0x440201=_0x440201-0x0;var _0x208fc8=_0x5a69[_0x440201];return _0x208fc8;};'use strict';var _=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var utils=require(_0x95a6('0x2'));var dispositions=[_0x95a6('0x3'),'FAILED','FAILED',_0x95a6('0x3'),_0x95a6('0x3'),_0x95a6('0x3'),'ANSWERED',_0x95a6('0x4'),_0x95a6('0x5'),_0x95a6('0x5'),_0x95a6('0x5')];var channels={};function writeDB(_0x22fdd5){utils['info'](util[_0x95a6('0x6')](_0x95a6('0x7'),_0x22fdd5[_0x95a6('0x8')],_0x22fdd5['channel'],_0x22fdd5[_0x95a6('0x9')],_0x22fdd5[_0x95a6('0xa')],_0x22fdd5[_0x95a6('0xb')],_0x22fdd5[_0x95a6('0xc')],_0x22fdd5[_0x95a6('0xd')],_0x22fdd5[_0x95a6('0xe')]));if(_0x22fdd5[_0x95a6('0xf')]){utils[_0x95a6('0x10')](_0x22fdd5['accountcode'])[_0x95a6('0x11')](function(_0x3c88b3){if(_0x3c88b3){_0x22fdd5['UserId']=_0x3c88b3['id'];}utils['request'](_0x95a6('0x12'),_0x22fdd5);});}else{utils[_0x95a6('0x13')](_0x95a6('0x12'),_0x22fdd5);}if(channels[_0x22fdd5['uniqueid']]){delete channels[_0x22fdd5[_0x95a6('0x8')]];}}exports[_0x95a6('0x14')]=function(_0x4429fd){try{utils[_0x95a6('0x15')](util[_0x95a6('0x6')]('[%s][calls][newchannel]',_0x4429fd['uniqueid']),_0x4429fd);if(_0x4429fd[_0x95a6('0x8')]==_0x4429fd[_0x95a6('0x16')]&&_0x4429fd['channel']!=_0x95a6('0x17')){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x19'),_0x4429fd['uniqueid'],_0x4429fd[_0x95a6('0x1a')],_0x4429fd['exten']));channels[_0x4429fd['uniqueid']]={'uniqueid':_0x4429fd[_0x95a6('0x8')],'accountcode':_0x4429fd[_0x95a6('0xf')],'source':_0x4429fd[_0x95a6('0xc')],'destination':_0x4429fd[_0x95a6('0x1b')],'destinationcontext':_0x4429fd[_0x95a6('0x1a')],'channel':_0x4429fd[_0x95a6('0x1c')],'starttime':utils[_0x95a6('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x95a6('0x1e')};}}catch(_0x455a34){utils[_0x95a6('0x1f')](util['format'](_0x95a6('0x20'),_0x4429fd[_0x95a6('0x8')]),_0x455a34);}};exports[_0x95a6('0x21')]=function(_0x2db894){try{utils[_0x95a6('0x15')](util[_0x95a6('0x6')]('[%s][calls][newstate]',_0x2db894[_0x95a6('0x8')]),_0x2db894);if(!_[_0x95a6('0x22')](channels[_0x2db894[_0x95a6('0x8')]])&&_0x2db894[_0x95a6('0x23')]==0x6){utils['info'](util[_0x95a6('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2db894[_0x95a6('0x8')],_0x2db894[_0x95a6('0x1a')],_0x2db894[_0x95a6('0x1c')]));if(_[_0x95a6('0x22')](channels[_0x2db894[_0x95a6('0x8')]]['systemanswertime'])){channels[_0x2db894[_0x95a6('0x8')]][_0x95a6('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x2db894[_0x95a6('0x16')]])&&_0x2db894[_0x95a6('0x23')]==0x6&&_0x2db894['context']!=_0x95a6('0x25')){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x26'),_0x2db894['uniqueid'],_0x2db894['linkedid'],_0x2db894[_0x95a6('0x1a')],_0x2db894[_0x95a6('0x1c')]));channels[_0x2db894[_0x95a6('0x16')]][_0x95a6('0xf')]=_0x2db894[_0x95a6('0xf')];channels[_0x2db894[_0x95a6('0x16')]][_0x95a6('0x27')]=_0x2db894[_0x95a6('0x1c')];if(_[_0x95a6('0x22')](channels[_0x2db894['linkedid']]['answertime'])){channels[_0x2db894[_0x95a6('0x16')]][_0x95a6('0x28')]=utils['now']();}channels[_0x2db894['linkedid']][_0x95a6('0x29')]=dispositions[_['toNumber'](_0x2db894[_0x95a6('0x23')])]||_0x95a6('0x2a');}}catch(_0x4fc40c){utils[_0x95a6('0x1f')](util[_0x95a6('0x6')]('[%s][calls][newstate]',_0x2db894[_0x95a6('0x8')]),_0x4fc40c);}};exports[_0x95a6('0x2b')]=function(_0x109834){try{if(!_['isNil'](channels[_0x109834[_0x95a6('0x8')]])){utils[_0x95a6('0x15')](util['format']('[%s][calls][hangup]',_0x109834[_0x95a6('0x8')]),_0x109834);if(_['isNil'](channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x2c')])){channels[_0x109834['uniqueid']][_0x95a6('0x2c')]=_0x109834['calleridname']+'\x20<'+_0x109834[_0x95a6('0xc')]+'>';}utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x2d'),_0x109834[_0x95a6('0x8')],channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x2c')],_0x109834[_0x95a6('0x2e')]));channels[_0x109834['uniqueid']][_0x95a6('0x2f')]=utils[_0x95a6('0x1d')]();channels[_0x109834[_0x95a6('0x8')]]['duration']=utils['diffTime'](channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x2f')],channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x30')]);channels[_0x109834['uniqueid']][_0x95a6('0x31')]=channels[_0x109834[_0x95a6('0x8')]][_0x95a6('0x28')]?utils[_0x95a6('0x32')](channels[_0x109834[_0x95a6('0x8')]]['endtime'],channels[_0x109834[_0x95a6('0x8')]]['answertime']):0x0;writeDB(channels[_0x109834[_0x95a6('0x8')]]);}}catch(_0x2b8ad2){utils['error'](util['format'](_0x95a6('0x33'),_0x109834[_0x95a6('0x8')]),_0x2b8ad2);}};exports[_0x95a6('0x34')]=function(_0x5f551b){try{if(!_[_0x95a6('0x22')](channels[_0x5f551b[_0x95a6('0x35')]])){utils['debug'](util[_0x95a6('0x6')]('[%s][calls][attendedtransfer]',_0x5f551b['origtransfereruniqueid']),_0x5f551b);if(channels[_0x5f551b[_0x95a6('0x35')]][_0x95a6('0x1c')]==_0x5f551b[_0x95a6('0x36')]){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x37'),_0x5f551b[_0x95a6('0x38')],_0x5f551b[_0x95a6('0x35')],_0x5f551b[_0x95a6('0x39')]));channels[_0x5f551b[_0x95a6('0x35')]]['destinationchannel']=_0x5f551b[_0x95a6('0x39')];channels[_0x5f551b['localtwolinkedid']][_0x95a6('0x3a')]=_0x95a6('0x3b');}else if(channels[_0x5f551b[_0x95a6('0x35')]][_0x95a6('0x1c')]=_0x5f551b['transfertargetchannel']){utils[_0x95a6('0x18')](util['format'](_0x95a6('0x37'),_0x5f551b[_0x95a6('0x38')],_0x5f551b[_0x95a6('0x35')],_0x5f551b[_0x95a6('0x3c')]));channels[_0x5f551b[_0x95a6('0x35')]][_0x95a6('0x27')]=_0x5f551b[_0x95a6('0x3c')];channels[_0x5f551b['localtwolinkedid']]['userfield']=_0x95a6('0x3b');}}}catch(_0x9554d8){utils[_0x95a6('0x1f')](util['format'](_0x95a6('0x3d'),_0x5f551b[_0x95a6('0x38')]),_0x9554d8);}};exports[_0x95a6('0x3e')]=function(_0x3a4f6d){try{if(!_['isNil'](channels[_0x3a4f6d[_0x95a6('0x8')]])){utils[_0x95a6('0x15')](util['format'](_0x95a6('0x3f'),_0x3a4f6d['uniqueid']),_0x3a4f6d);channels[_0x3a4f6d[_0x95a6('0x8')]][_0x95a6('0x40')]=utils[_0x95a6('0x1d')]();utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x41'),_0x3a4f6d[_0x95a6('0x8')],channels[_0x3a4f6d[_0x95a6('0x8')]][_0x95a6('0x40')]));}}catch(_0x35d2d0){utils[_0x95a6('0x1f')](util['format'](_0x95a6('0x3f'),_0x3a4f6d[_0x95a6('0x8')]),_0x35d2d0);}};exports[_0x95a6('0x42')]=function(_0x13bff3){try{if(!_[_0x95a6('0x22')](channels[_0x13bff3[_0x95a6('0x8')]])){utils['debug'](util[_0x95a6('0x6')](_0x95a6('0x43'),_0x13bff3[_0x95a6('0x8')]),_0x13bff3);if(!_['isNil'](channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x40')])){channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x44')]+=utils[_0x95a6('0x32')](utils[_0x95a6('0x1d')](),channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x40')]);utils['info'](util[_0x95a6('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x13bff3[_0x95a6('0x8')],channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x44')]));delete channels[_0x13bff3[_0x95a6('0x8')]][_0x95a6('0x40')];}}}catch(_0x154038){utils[_0x95a6('0x1f')](util[_0x95a6('0x6')](_0x95a6('0x43'),_0x13bff3['uniqueid']),_0x154038);}};exports[_0x95a6('0x45')]=function(_0x4a5490){try{if(!_['isNil'](channels[_0x4a5490[_0x95a6('0x8')]])){utils[_0x95a6('0x15')](util['format']('[%s][calls][varset]',_0x4a5490[_0x95a6('0x8')]),_0x4a5490);if(!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x47')])){utils[_0x95a6('0x18')](util['format'](_0x95a6('0x48'),_0x4a5490[_0x95a6('0x8')],_0x4a5490['value']));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x49')]=_0x4a5490[_0x95a6('0x4a')];}if(!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x4b')])){utils[_0x95a6('0x18')](util['format'](_0x95a6('0x4c'),_0x4a5490['uniqueid'],_0x4a5490['value']));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x4d')]=_0x4a5490[_0x95a6('0x4a')];channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x2c')]='\x22'+_0x4a5490['value']+'\x22\x20<'+_0x4a5490[_0x95a6('0x4a')]+'>';}if(!_['isNil'](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x4e')])||!_['isNil'](_0x4a5490[_0x95a6('0x46')]['xmd-callerid'])){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x4f'),_0x4a5490[_0x95a6('0x8')],!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')]['xmd-callerid-preview'])?_0x95a6('0x4e'):_0x95a6('0x50'),_0x4a5490[_0x95a6('0x4a')]));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x2c')]=_0x4a5490[_0x95a6('0x4a')];}if(!_['isNil'](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x51')])||!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x52')])){utils[_0x95a6('0x18')](util[_0x95a6('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4a5490[_0x95a6('0x8')],!_['isNil'](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x51')])?'xmd-queue':_0x95a6('0x52'),_0x4a5490[_0x95a6('0x4a')]));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x53')]=_0x95a6('0x54');channels[_0x4a5490[_0x95a6('0x8')]]['lastdata']=_0x4a5490[_0x95a6('0x4a')];channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x9')]=!![];}if(!_[_0x95a6('0x22')](_0x4a5490['variable']['xmd-contactid'])){utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x55'),_0x4a5490[_0x95a6('0x8')],_0x4a5490[_0x95a6('0x4a')]));channels[_0x4a5490['uniqueid']][_0x95a6('0x56')]=_0x4a5490[_0x95a6('0x4a')];}if(!_['isNil'](_0x4a5490['variable']['xmd-cdrtype'])){utils['info'](util[_0x95a6('0x6')](_0x95a6('0x57'),_0x4a5490[_0x95a6('0x8')],_0x4a5490['value']));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x58')]=_0x4a5490[_0x95a6('0x4a')];}if(!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')][_0x95a6('0x59')])){utils[_0x95a6('0x18')](util[_0x95a6('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x4a5490[_0x95a6('0x8')],_0x4a5490[_0x95a6('0x4a')]));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x5a')]=_0x4a5490[_0x95a6('0x4a')];}if(!_[_0x95a6('0x22')](_0x4a5490[_0x95a6('0x46')]['sipcallid'])){utils[_0x95a6('0x18')](util['format'](_0x95a6('0x5b'),_0x4a5490[_0x95a6('0x8')],_0x4a5490['value']));channels[_0x4a5490[_0x95a6('0x8')]][_0x95a6('0x5c')]=_0x4a5490[_0x95a6('0x4a')];}}}catch(_0xc2e83f){utils[_0x95a6('0x1f')](util[_0x95a6('0x6')]('[%s][calls][varset]',_0x4a5490[_0x95a6('0x8')]),_0xc2e83f);}};exports[_0x95a6('0x5d')]=function(_0x13d312){try{if(!_[_0x95a6('0x22')](channels[_0x13d312[_0x95a6('0x8')]])){utils[_0x95a6('0x15')](util['format'](_0x95a6('0x5e'),_0x13d312[_0x95a6('0x8')]),_0x13d312);utils[_0x95a6('0x18')](util[_0x95a6('0x6')](_0x95a6('0x5f'),_0x13d312[_0x95a6('0x8')],_0x13d312[_0x95a6('0x60')],_0x13d312[_0x95a6('0x61')]));if(_0x13d312['application'][_0x95a6('0x62')]()==_0x95a6('0x63')&&_['startsWith'](_0x13d312[_0x95a6('0x61')][_0x95a6('0x62')](),_0x95a6('0x64'))){var _0x5d35b1=_0x13d312[_0x95a6('0x61')]['split']('=');var _0x249990=_0x5d35b1[0x0]['substring'](_0x5d35b1[0x0][_0x95a6('0x65')]('(')+0x1,_0x5d35b1[0x0]['lastIndexOf'](')'));var _0x20f2b9=_0x5d35b1[0x1];channels[_0x13d312[_0x95a6('0x8')]][_0x249990]=_0x20f2b9;}if(!_[_0x95a6('0x66')]([_0x95a6('0x2b'),_0x95a6('0x67'),_0x95a6('0x68'),_0x95a6('0x63'),'gotoif'],_0x13d312[_0x95a6('0x60')]['toLowerCase']())){channels[_0x13d312[_0x95a6('0x8')]]['lastapplication']=_0x13d312[_0x95a6('0x60')];channels[_0x13d312['uniqueid']][_0x95a6('0x69')]=_0x13d312[_0x95a6('0x61')];}}}catch(_0x498f7c){utils[_0x95a6('0x1f')](util[_0x95a6('0x6')](_0x95a6('0x5e'),_0x13d312[_0x95a6('0x8')]),_0x498f7c);}}; \ No newline at end of file +var _0x0684=['value','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','hangup','execif','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][hangup]','callerid','endtime','duration','starttime','diffTime','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source'];(function(_0x5a57a3,_0x2a7018){var _0x2ef960=function(_0x9de98f){while(--_0x9de98f){_0x5a57a3['push'](_0x5a57a3['shift']());}};_0x2ef960(++_0x2a7018);}(_0x0684,0x1b8));var _0x4068=function(_0x41c43f,_0x543174){_0x41c43f=_0x41c43f-0x0;var _0x375578=_0x0684[_0x41c43f];return _0x375578;};'use strict';var _=require('lodash');var util=require(_0x4068('0x0'));var utils=require(_0x4068('0x1'));var dispositions=[_0x4068('0x2'),_0x4068('0x3'),'FAILED',_0x4068('0x2'),_0x4068('0x2'),_0x4068('0x2'),_0x4068('0x4'),_0x4068('0x5'),_0x4068('0x3'),_0x4068('0x3'),_0x4068('0x3')];var channels={};function writeDB(_0xc5bdf4){utils[_0x4068('0x6')](util[_0x4068('0x7')](_0x4068('0x8'),_0xc5bdf4[_0x4068('0x9')],_0xc5bdf4[_0x4068('0xa')],_0xc5bdf4[_0x4068('0xb')],_0xc5bdf4[_0x4068('0xc')],_0xc5bdf4[_0x4068('0xd')],_0xc5bdf4[_0x4068('0xe')],_0xc5bdf4['connectedlinenum'],_0xc5bdf4[_0x4068('0xf')]));if(_0xc5bdf4[_0x4068('0x10')]){utils['getUserByInternal'](_0xc5bdf4[_0x4068('0x10')])[_0x4068('0x11')](function(_0x47902e){if(_0x47902e){_0xc5bdf4[_0x4068('0x12')]=_0x47902e['id'];}utils[_0x4068('0x13')](_0x4068('0x14'),_0xc5bdf4);});}else{utils['request'](_0x4068('0x14'),_0xc5bdf4);}if(channels[_0xc5bdf4[_0x4068('0x9')]]){delete channels[_0xc5bdf4[_0x4068('0x9')]];}}exports[_0x4068('0x15')]=function(_0x419706){try{utils[_0x4068('0x16')](util[_0x4068('0x7')]('[%s][calls][newchannel]',_0x419706[_0x4068('0x9')]),_0x419706);if(_0x419706[_0x4068('0x9')]==_0x419706[_0x4068('0x17')]&&_0x419706[_0x4068('0xa')]!=_0x4068('0x18')){utils[_0x4068('0x6')](util['format'](_0x4068('0x19'),_0x419706[_0x4068('0x9')],_0x419706[_0x4068('0x1a')],_0x419706[_0x4068('0x1b')]));channels[_0x419706[_0x4068('0x9')]]={'uniqueid':_0x419706[_0x4068('0x9')],'accountcode':_0x419706[_0x4068('0x10')],'source':_0x419706[_0x4068('0xe')],'destination':_0x419706['exten'],'destinationcontext':_0x419706[_0x4068('0x1a')],'channel':_0x419706[_0x4068('0xa')],'starttime':utils[_0x4068('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4068('0x2'),'amaflags':_0x4068('0x1d')};}}catch(_0x3085b1){utils[_0x4068('0x1e')](util['format'](_0x4068('0x1f'),_0x419706['uniqueid']),_0x3085b1);}};exports[_0x4068('0x20')]=function(_0x363e2c){try{utils[_0x4068('0x16')](util[_0x4068('0x7')](_0x4068('0x21'),_0x363e2c[_0x4068('0x9')]),_0x363e2c);if(!_['isNil'](channels[_0x363e2c[_0x4068('0x9')]])&&_0x363e2c['channelstate']==0x6){utils['info'](util[_0x4068('0x7')](_0x4068('0x22'),_0x363e2c[_0x4068('0x9')],_0x363e2c[_0x4068('0x1a')],_0x363e2c['channel']));if(_[_0x4068('0x23')](channels[_0x363e2c['uniqueid']][_0x4068('0x24')])){channels[_0x363e2c[_0x4068('0x9')]][_0x4068('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x363e2c[_0x4068('0x17')]])&&_0x363e2c[_0x4068('0x25')]==0x6&&_0x363e2c['context']!=_0x4068('0x26')){utils[_0x4068('0x6')](util['format'](_0x4068('0x27'),_0x363e2c['uniqueid'],_0x363e2c[_0x4068('0x17')],_0x363e2c[_0x4068('0x1a')],_0x363e2c[_0x4068('0xa')]));channels[_0x363e2c[_0x4068('0x17')]][_0x4068('0x10')]=_0x363e2c[_0x4068('0x10')];channels[_0x363e2c['linkedid']][_0x4068('0x28')]=_0x363e2c[_0x4068('0xa')];if(_[_0x4068('0x23')](channels[_0x363e2c[_0x4068('0x17')]][_0x4068('0x29')])){channels[_0x363e2c[_0x4068('0x17')]][_0x4068('0x29')]=utils[_0x4068('0x1c')]();}channels[_0x363e2c['linkedid']]['disposition']=dispositions[_[_0x4068('0x2a')](_0x363e2c[_0x4068('0x25')])]||_0x4068('0x4');}}catch(_0x21fb81){utils[_0x4068('0x1e')](util[_0x4068('0x7')](_0x4068('0x21'),_0x363e2c['uniqueid']),_0x21fb81);}};exports['hangup']=function(_0x474e1e){try{if(!_[_0x4068('0x23')](channels[_0x474e1e[_0x4068('0x9')]])){utils[_0x4068('0x16')](util[_0x4068('0x7')](_0x4068('0x2b'),_0x474e1e['uniqueid']),_0x474e1e);if(_[_0x4068('0x23')](channels[_0x474e1e[_0x4068('0x9')]][_0x4068('0x2c')])){channels[_0x474e1e[_0x4068('0x9')]][_0x4068('0x2c')]=_0x474e1e['calleridname']+'\x20<'+_0x474e1e[_0x4068('0xe')]+'>';}utils[_0x4068('0x6')](util[_0x4068('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x474e1e['uniqueid'],channels[_0x474e1e[_0x4068('0x9')]][_0x4068('0x2c')],_0x474e1e['cause-txt']));channels[_0x474e1e[_0x4068('0x9')]][_0x4068('0x2d')]=utils[_0x4068('0x1c')]();channels[_0x474e1e[_0x4068('0x9')]][_0x4068('0x2e')]=utils['diffTime'](channels[_0x474e1e[_0x4068('0x9')]][_0x4068('0x2d')],channels[_0x474e1e['uniqueid']][_0x4068('0x2f')]);channels[_0x474e1e['uniqueid']]['billableseconds']=channels[_0x474e1e[_0x4068('0x9')]]['answertime']?utils[_0x4068('0x30')](channels[_0x474e1e[_0x4068('0x9')]][_0x4068('0x2d')],channels[_0x474e1e['uniqueid']]['answertime']):0x0;writeDB(channels[_0x474e1e[_0x4068('0x9')]]);}}catch(_0x183462){utils[_0x4068('0x1e')](util[_0x4068('0x7')]('[%s][calls][hangup]',_0x474e1e['uniqueid']),_0x183462);}};exports['attendedtransfer']=function(_0x37821a){try{if(!_[_0x4068('0x23')](channels[_0x37821a['localtwolinkedid']])){utils[_0x4068('0x16')](util[_0x4068('0x7')](_0x4068('0x31'),_0x37821a[_0x4068('0x32')]),_0x37821a);if(channels[_0x37821a[_0x4068('0x33')]][_0x4068('0xa')]==_0x37821a[_0x4068('0x34')]){utils[_0x4068('0x6')](util['format'](_0x4068('0x35'),_0x37821a[_0x4068('0x32')],_0x37821a['localtwolinkedid'],_0x37821a[_0x4068('0x36')]));channels[_0x37821a[_0x4068('0x33')]][_0x4068('0x28')]=_0x37821a[_0x4068('0x36')];channels[_0x37821a[_0x4068('0x33')]][_0x4068('0x37')]=_0x4068('0x38');}else if(channels[_0x37821a[_0x4068('0x33')]]['channel']=_0x37821a['transfertargetchannel']){utils['info'](util[_0x4068('0x7')](_0x4068('0x35'),_0x37821a[_0x4068('0x32')],_0x37821a['localtwolinkedid'],_0x37821a[_0x4068('0x39')]));channels[_0x37821a[_0x4068('0x33')]][_0x4068('0x28')]=_0x37821a[_0x4068('0x39')];channels[_0x37821a[_0x4068('0x33')]][_0x4068('0x37')]=_0x4068('0x38');}}}catch(_0x51978b){utils['error'](util[_0x4068('0x7')]('[%s][calls][attendedtransfer]',_0x37821a[_0x4068('0x32')]),_0x51978b);}};exports[_0x4068('0x3a')]=function(_0x170316){try{if(!_['isNil'](channels[_0x170316[_0x4068('0x9')]])){utils[_0x4068('0x16')](util['format'](_0x4068('0x3b'),_0x170316[_0x4068('0x9')]),_0x170316);channels[_0x170316[_0x4068('0x9')]][_0x4068('0x3c')]=utils[_0x4068('0x1c')]();utils[_0x4068('0x6')](util[_0x4068('0x7')](_0x4068('0x3d'),_0x170316[_0x4068('0x9')],channels[_0x170316[_0x4068('0x9')]][_0x4068('0x3c')]));}}catch(_0x170d2e){utils[_0x4068('0x1e')](util['format'](_0x4068('0x3b'),_0x170316['uniqueid']),_0x170d2e);}};exports['musiconholdstop']=function(_0x4ee059){try{if(!_[_0x4068('0x23')](channels[_0x4ee059[_0x4068('0x9')]])){utils['debug'](util[_0x4068('0x7')]('[%s][calls][musiconholdstop]',_0x4ee059[_0x4068('0x9')]),_0x4ee059);if(!_[_0x4068('0x23')](channels[_0x4ee059[_0x4068('0x9')]]['musiconholdstartAt'])){channels[_0x4ee059[_0x4068('0x9')]][_0x4068('0x3e')]+=utils[_0x4068('0x30')](utils[_0x4068('0x1c')](),channels[_0x4ee059[_0x4068('0x9')]]['musiconholdstartAt']);utils[_0x4068('0x6')](util['format'](_0x4068('0x3f'),_0x4ee059['uniqueid'],channels[_0x4ee059['uniqueid']][_0x4068('0x3e')]));delete channels[_0x4ee059[_0x4068('0x9')]][_0x4068('0x3c')];}}}catch(_0x14b8a1){utils[_0x4068('0x1e')](util[_0x4068('0x7')]('[%s][calls][musiconholdstop]',_0x4ee059[_0x4068('0x9')]),_0x14b8a1);}};exports[_0x4068('0x40')]=function(_0x4a0160){try{if(!_[_0x4068('0x23')](channels[_0x4a0160['uniqueid']])){utils[_0x4068('0x16')](util['format'](_0x4068('0x41'),_0x4a0160[_0x4068('0x9')]),_0x4a0160);if(!_['isNil'](_0x4a0160[_0x4068('0x42')][_0x4068('0x43')])){utils[_0x4068('0x6')](util[_0x4068('0x7')](_0x4068('0x44'),_0x4a0160['uniqueid'],_0x4a0160['value']));channels[_0x4a0160[_0x4068('0x9')]][_0x4068('0x45')]=_0x4a0160[_0x4068('0x46')];}if(!_['isNil'](_0x4a0160[_0x4068('0x42')]['xmd-phone'])){utils[_0x4068('0x6')](util[_0x4068('0x7')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4a0160[_0x4068('0x9')],_0x4a0160[_0x4068('0x46')]));channels[_0x4a0160[_0x4068('0x9')]][_0x4068('0x47')]=_0x4a0160['value'];channels[_0x4a0160[_0x4068('0x9')]][_0x4068('0x2c')]='\x22'+_0x4a0160[_0x4068('0x46')]+'\x22\x20<'+_0x4a0160['value']+'>';}if(!_['isNil'](_0x4a0160[_0x4068('0x42')][_0x4068('0x48')])||!_[_0x4068('0x23')](_0x4a0160[_0x4068('0x42')][_0x4068('0x49')])){utils[_0x4068('0x6')](util[_0x4068('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4a0160[_0x4068('0x9')],!_[_0x4068('0x23')](_0x4a0160[_0x4068('0x42')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0x4068('0x49'),_0x4a0160[_0x4068('0x46')]));channels[_0x4a0160['uniqueid']][_0x4068('0x2c')]=_0x4a0160[_0x4068('0x46')];}if(!_[_0x4068('0x23')](_0x4a0160['variable'][_0x4068('0x4a')])||!_[_0x4068('0x23')](_0x4a0160[_0x4068('0x42')]['xmcs-queue'])){utils[_0x4068('0x6')](util[_0x4068('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4a0160[_0x4068('0x9')],!_[_0x4068('0x23')](_0x4a0160[_0x4068('0x42')][_0x4068('0x4a')])?'xmd-queue':_0x4068('0x4b'),_0x4a0160['value']));channels[_0x4a0160[_0x4068('0x9')]][_0x4068('0x4c')]=_0x4068('0x4d');channels[_0x4a0160[_0x4068('0x9')]][_0x4068('0x4e')]=_0x4a0160[_0x4068('0x46')];channels[_0x4a0160[_0x4068('0x9')]][_0x4068('0xb')]=!![];}if(!_[_0x4068('0x23')](_0x4a0160['variable'][_0x4068('0x4f')])){utils['info'](util[_0x4068('0x7')](_0x4068('0x50'),_0x4a0160['uniqueid'],_0x4a0160['value']));channels[_0x4a0160[_0x4068('0x9')]][_0x4068('0x51')]=_0x4a0160[_0x4068('0x46')];}if(!_[_0x4068('0x23')](_0x4a0160[_0x4068('0x42')][_0x4068('0x52')])){utils[_0x4068('0x6')](util[_0x4068('0x7')](_0x4068('0x53'),_0x4a0160[_0x4068('0x9')],_0x4a0160[_0x4068('0x46')]));channels[_0x4a0160[_0x4068('0x9')]][_0x4068('0x54')]=_0x4a0160[_0x4068('0x46')];}if(!_[_0x4068('0x23')](_0x4a0160[_0x4068('0x42')][_0x4068('0x55')])){utils[_0x4068('0x6')](util[_0x4068('0x7')](_0x4068('0x56'),_0x4a0160[_0x4068('0x9')],_0x4a0160[_0x4068('0x46')]));channels[_0x4a0160['uniqueid']][_0x4068('0x57')]=_0x4a0160[_0x4068('0x46')];}if(!_[_0x4068('0x23')](_0x4a0160['variable']['sipcallid'])){utils[_0x4068('0x6')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x4a0160[_0x4068('0x9')],_0x4a0160[_0x4068('0x46')]));channels[_0x4a0160[_0x4068('0x9')]]['sipcallid']=_0x4a0160[_0x4068('0x46')];}}}catch(_0x5ec763){utils[_0x4068('0x1e')](util[_0x4068('0x7')](_0x4068('0x41'),_0x4a0160[_0x4068('0x9')]),_0x5ec763);}};exports[_0x4068('0x58')]=function(_0x127789){try{if(!_[_0x4068('0x23')](channels[_0x127789[_0x4068('0x9')]])){utils[_0x4068('0x16')](util[_0x4068('0x7')](_0x4068('0x59'),_0x127789[_0x4068('0x9')]),_0x127789);utils[_0x4068('0x6')](util[_0x4068('0x7')](_0x4068('0x5a'),_0x127789[_0x4068('0x9')],_0x127789[_0x4068('0x5b')],_0x127789[_0x4068('0x5c')]));if(_0x127789['application'][_0x4068('0x5d')]()==_0x4068('0x5e')&&_[_0x4068('0x5f')](_0x127789['appdata'][_0x4068('0x5d')](),'cdr')){var _0x1b7170=_0x127789['appdata'][_0x4068('0x60')]('=');var _0x5564a1=_0x1b7170[0x0][_0x4068('0x61')](_0x1b7170[0x0][_0x4068('0x62')]('(')+0x1,_0x1b7170[0x0][_0x4068('0x62')](')'));var _0x5b2ee2=_0x1b7170[0x1];channels[_0x127789[_0x4068('0x9')]][_0x5564a1]=_0x5b2ee2;}if(!_[_0x4068('0x63')]([_0x4068('0x64'),'noop',_0x4068('0x65'),_0x4068('0x5e'),'gotoif'],_0x127789[_0x4068('0x5b')][_0x4068('0x5d')]())){channels[_0x127789[_0x4068('0x9')]][_0x4068('0x4c')]=_0x127789[_0x4068('0x5b')];channels[_0x127789['uniqueid']]['lastdata']=_0x127789['appdata'];}}}catch(_0x1a7b8b){utils[_0x4068('0x1e')](util['format'](_0x4068('0x59'),_0x127789[_0x4068('0x9')]),_0x1a7b8b);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 7c3452a..ed41520 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 _0x176c=['info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected','[core]\x20shutdown','fullybooted'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x176c,0x14b));var _0xc176=function(_0x563679,_0x3ed5a5){_0x563679=_0x563679-0x0;var _0x398d95=_0x176c[_0x563679];return _0x398d95;};'use strict';var utils=require(_0xc176('0x0'));exports[_0xc176('0x1')]=function(){utils['info'](_0xc176('0x2'));};exports['shutdown']=function(){utils['info'](_0xc176('0x3'));};exports[_0xc176('0x4')]=function(){utils[_0xc176('0x5')](_0xc176('0x6'));};exports[_0xc176('0x7')]=function(_0x3c66fa){utils[_0xc176('0x7')](_0xc176('0x8'),_0x3c66fa);};exports[_0xc176('0x9')]=function(){utils[_0xc176('0x5')](_0xc176('0xa'));};exports[_0xc176('0xb')]=function(_0x27da56){}; \ No newline at end of file +var _0x6a9a=['managerevent','./utils','connect','[core]\x20connected','shutdown','[core]\x20shutdown','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x2a969d,_0x47b56a){var _0x1ee87c=function(_0x55ee6b){while(--_0x55ee6b){_0x2a969d['push'](_0x2a969d['shift']());}};_0x1ee87c(++_0x47b56a);}(_0x6a9a,0x1bd));var _0xa6a9=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x6a9a[_0x4a7631];return _0x1a5a6f;};'use strict';var utils=require(_0xa6a9('0x0'));exports[_0xa6a9('0x1')]=function(){utils['info'](_0xa6a9('0x2'));};exports[_0xa6a9('0x3')]=function(){utils['info'](_0xa6a9('0x4'));};exports['fullybooted']=function(){utils[_0xa6a9('0x5')](_0xa6a9('0x6'));};exports['error']=function(_0x1c75aa){utils[_0xa6a9('0x7')](_0xa6a9('0x8'),_0x1c75aa);};exports[_0xa6a9('0x9')]=function(){utils[_0xa6a9('0x5')](_0xa6a9('0xa'));};exports[_0xa6a9('0xb')]=function(_0x21ecf2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 152e226..a9a9629 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 _0xb776=['cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','value','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','cause-txt','diffTime','endtime','holdtime','lodash','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','appdata','application','toLowerCase','startsWith'];(function(_0x3de45a,_0x22c557){var _0x496b8a=function(_0x43c2a3){while(--_0x43c2a3){_0x3de45a['push'](_0x3de45a['shift']());}};_0x496b8a(++_0x22c557);}(_0xb776,0x101));var _0x6b77=function(_0x338211,_0x254dae){_0x338211=_0x338211-0x0;var _0x5deff8=_0xb776[_0x338211];return _0x5deff8;};'use strict';var _=require(_0x6b77('0x0'));var util=require(_0x6b77('0x1'));var utils=require(_0x6b77('0x2'));var dials={};function writeDB(_0x1d766c){utils[_0x6b77('0x3')](util[_0x6b77('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1d766c[_0x6b77('0x5')],_0x1d766c[_0x6b77('0x6')],_0x1d766c[_0x6b77('0x7')],_0x1d766c[_0x6b77('0x8')],_0x1d766c[_0x6b77('0x9')],_0x1d766c[_0x6b77('0xa')]));utils['request'](_0x6b77('0xb'),_0x1d766c);delete dials[_0x1d766c[_0x6b77('0x5')]];}exports[_0x6b77('0xc')]=function(_0x2c80ea){try{utils[_0x6b77('0xd')](util[_0x6b77('0x4')](_0x6b77('0xe'),_0x2c80ea['uniqueid']),_0x2c80ea);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x2c80ea[_0x6b77('0x5')],_0x2c80ea['application'],_0x2c80ea[_0x6b77('0xf')]));if(_0x2c80ea[_0x6b77('0x10')][_0x6b77('0x11')]()=='set'&&_[_0x6b77('0x12')](_0x2c80ea['appdata'][_0x6b77('0x11')](),_0x6b77('0x13'))){var _0x9c2080=_0x2c80ea[_0x6b77('0xf')][_0x6b77('0x14')]('=');dials[_0x2c80ea[_0x6b77('0x5')]]={'routeId':_0x9c2080[0x1]};}}catch(_0x2990b6){utils[_0x6b77('0x15')](util[_0x6b77('0x4')]('[%s][dials][newexten]',_0x2c80ea[_0x6b77('0x5')]),_0x2990b6);}};exports[_0x6b77('0x16')]=function(_0x43160b){try{utils['debug'](util[_0x6b77('0x4')](_0x6b77('0x17'),_0x43160b['uniqueid']),_0x43160b);if(!_['isNil'](_0x43160b[_0x6b77('0x18')][_0x6b77('0x19')])){utils[_0x6b77('0x3')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x43160b['uniqueid'],_0x43160b[_0x6b77('0x1a')]));dials[_0x43160b[_0x6b77('0x5')]]={'routeId':_0x43160b['value']};}}catch(_0x5c0f1d){utils[_0x6b77('0x15')](util[_0x6b77('0x4')](_0x6b77('0x17'),_0x43160b[_0x6b77('0x5')]),_0x5c0f1d);}};exports['dialbegin']=function(_0x4ca482){try{if(!_[_0x6b77('0x1b')](dials[_0x4ca482[_0x6b77('0x5')]])){utils['debug'](util['format'](_0x6b77('0x1c'),_0x4ca482[_0x6b77('0x5')]),_0x4ca482);dials[_0x4ca482[_0x6b77('0x5')]]=_['assign'](dials[_0x4ca482[_0x6b77('0x5')]],_0x4ca482);dials[_0x4ca482[_0x6b77('0x5')]][_0x6b77('0x1d')]=utils[_0x6b77('0x1e')]();dials[_0x4ca482['uniqueid']][_0x6b77('0x1f')]='called';utils[_0x6b77('0x3')](util[_0x6b77('0x4')](_0x6b77('0x20'),_0x4ca482['uniqueid'],dials[_0x4ca482[_0x6b77('0x5')]][_0x6b77('0x1d')]));}}catch(_0x49d90d){utils['error'](util[_0x6b77('0x4')](_0x6b77('0x1c'),_0x4ca482[_0x6b77('0x5')]),_0x49d90d);}};exports[_0x6b77('0x21')]=function(_0x584822){try{if(!_[_0x6b77('0x1b')](dials[_0x584822[_0x6b77('0x5')]])){utils[_0x6b77('0xd')](util[_0x6b77('0x4')](_0x6b77('0x22'),_0x584822[_0x6b77('0x5')]),_0x584822);dials[_0x584822[_0x6b77('0x5')]][_0x6b77('0xa')]=_0x584822[_0x6b77('0xa')];if(_0x584822[_0x6b77('0xa')]==_0x6b77('0x23')){dials[_0x584822[_0x6b77('0x5')]]=_[_0x6b77('0x24')](dials[_0x584822[_0x6b77('0x5')]],_0x584822);dials[_0x584822[_0x6b77('0x5')]][_0x6b77('0x25')]=utils[_0x6b77('0x1e')]();dials[_0x584822[_0x6b77('0x5')]]['lastevent']=_0x6b77('0x26');utils[_0x6b77('0x3')](util[_0x6b77('0x4')](_0x6b77('0x27'),_0x584822[_0x6b77('0x5')],_0x584822['dialstatus'],dials[_0x584822['uniqueid']][_0x6b77('0x25')]));}else{utils[_0x6b77('0x3')](util[_0x6b77('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x584822[_0x6b77('0x5')],_0x584822['dialstatus']));}}}catch(_0xe886e0){utils[_0x6b77('0x15')](util[_0x6b77('0x4')](_0x6b77('0x22'),_0x584822[_0x6b77('0x5')]),_0xe886e0);}};exports[_0x6b77('0x28')]=function(_0x36a4b6){try{if(!_[_0x6b77('0x1b')](dials[_0x36a4b6[_0x6b77('0x5')]])){utils[_0x6b77('0xd')](util['format'](_0x6b77('0x29'),_0x36a4b6[_0x6b77('0x5')]),_0x36a4b6);utils[_0x6b77('0x3')](util[_0x6b77('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x36a4b6[_0x6b77('0x5')],_0x36a4b6['calleridnum'],_0x36a4b6['calleridname'],_0x36a4b6[_0x6b77('0x2a')]));dials[_0x36a4b6[_0x6b77('0x5')]]=_['assign'](dials[_0x36a4b6[_0x6b77('0x5')]],{'endtime':utils[_0x6b77('0x1e')](),'lastevent':'complete'});dials[_0x36a4b6[_0x6b77('0x5')]]['duration']=utils[_0x6b77('0x2b')](dials[_0x36a4b6['uniqueid']][_0x6b77('0x2c')],dials[_0x36a4b6[_0x6b77('0x5')]][_0x6b77('0x1d')]);dials[_0x36a4b6['uniqueid']][_0x6b77('0x2d')]=utils['diffTime'](dials[_0x36a4b6[_0x6b77('0x5')]]['answertime']||dials[_0x36a4b6[_0x6b77('0x5')]][_0x6b77('0x2c')],dials[_0x36a4b6['uniqueid']]['starttime']);dials[_0x36a4b6[_0x6b77('0x5')]]['billableseconds']=dials[_0x36a4b6['uniqueid']]['answertime']?utils[_0x6b77('0x2b')](dials[_0x36a4b6['uniqueid']][_0x6b77('0x2c')],dials[_0x36a4b6[_0x6b77('0x5')]][_0x6b77('0x25')]):0x0;writeDB(dials[_0x36a4b6['uniqueid']]);}}catch(_0x53b76d){utils[_0x6b77('0x15')](util['format'](_0x6b77('0x29'),_0x36a4b6[_0x6b77('0x5')]),_0x53b76d);}}; \ No newline at end of file +var _0xc9ad=['endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','debug','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','complete','duration','diffTime','holdtime'];(function(_0x525e9c,_0x5ec606){var _0x3fa370=function(_0x2338ad){while(--_0x2338ad){_0x525e9c['push'](_0x525e9c['shift']());}};_0x3fa370(++_0x5ec606);}(_0xc9ad,0x182));var _0xdc9a=function(_0x4d59ed,_0x50eb7a){_0x4d59ed=_0x4d59ed-0x0;var _0x32d85d=_0xc9ad[_0x4d59ed];return _0x32d85d;};'use strict';var _=require(_0xdc9a('0x0'));var util=require(_0xdc9a('0x1'));var utils=require(_0xdc9a('0x2'));var dials={};function writeDB(_0x5a6b75){utils[_0xdc9a('0x3')](util[_0xdc9a('0x4')](_0xdc9a('0x5'),_0x5a6b75[_0xdc9a('0x6')],_0x5a6b75['channel'],_0x5a6b75[_0xdc9a('0x7')],_0x5a6b75[_0xdc9a('0x8')],_0x5a6b75['connectedlinenum'],_0x5a6b75[_0xdc9a('0x9')]));utils[_0xdc9a('0xa')](_0xdc9a('0xb'),_0x5a6b75);delete dials[_0x5a6b75[_0xdc9a('0x6')]];}exports['newexten']=function(_0x23a06a){try{utils['debug'](util['format'](_0xdc9a('0xc'),_0x23a06a['uniqueid']),_0x23a06a);utils['info'](util[_0xdc9a('0x4')](_0xdc9a('0xd'),_0x23a06a[_0xdc9a('0x6')],_0x23a06a['application'],_0x23a06a[_0xdc9a('0xe')]));if(_0x23a06a[_0xdc9a('0xf')][_0xdc9a('0x10')]()==_0xdc9a('0x11')&&_[_0xdc9a('0x12')](_0x23a06a[_0xdc9a('0xe')][_0xdc9a('0x10')](),_0xdc9a('0x13'))){var _0x3d8058=_0x23a06a['appdata']['split']('=');dials[_0x23a06a[_0xdc9a('0x6')]]={'routeId':_0x3d8058[0x1]};}}catch(_0x179258){utils[_0xdc9a('0x14')](util[_0xdc9a('0x4')](_0xdc9a('0xc'),_0x23a06a[_0xdc9a('0x6')]),_0x179258);}};exports[_0xdc9a('0x15')]=function(_0x34e951){try{utils['debug'](util[_0xdc9a('0x4')](_0xdc9a('0x16'),_0x34e951['uniqueid']),_0x34e951);if(!_['isNil'](_0x34e951[_0xdc9a('0x17')][_0xdc9a('0x18')])){utils[_0xdc9a('0x3')](util[_0xdc9a('0x4')](_0xdc9a('0x19'),_0x34e951[_0xdc9a('0x6')],_0x34e951[_0xdc9a('0x1a')]));dials[_0x34e951[_0xdc9a('0x6')]]={'routeId':_0x34e951['value']};}}catch(_0x5accef){utils['error'](util[_0xdc9a('0x4')](_0xdc9a('0x16'),_0x34e951[_0xdc9a('0x6')]),_0x5accef);}};exports['dialbegin']=function(_0x999c66){try{if(!_[_0xdc9a('0x1b')](dials[_0x999c66['uniqueid']])){utils['debug'](util[_0xdc9a('0x4')](_0xdc9a('0x1c'),_0x999c66[_0xdc9a('0x6')]),_0x999c66);dials[_0x999c66[_0xdc9a('0x6')]]=_[_0xdc9a('0x1d')](dials[_0x999c66[_0xdc9a('0x6')]],_0x999c66);dials[_0x999c66[_0xdc9a('0x6')]]['starttime']=utils[_0xdc9a('0x1e')]();dials[_0x999c66[_0xdc9a('0x6')]][_0xdc9a('0x1f')]=_0xdc9a('0x20');utils['info'](util['format'](_0xdc9a('0x21'),_0x999c66['uniqueid'],dials[_0x999c66[_0xdc9a('0x6')]][_0xdc9a('0x22')]));}}catch(_0x159ed1){utils[_0xdc9a('0x14')](util['format'](_0xdc9a('0x1c'),_0x999c66[_0xdc9a('0x6')]),_0x159ed1);}};exports['dialend']=function(_0x47d27c){try{if(!_[_0xdc9a('0x1b')](dials[_0x47d27c[_0xdc9a('0x6')]])){utils[_0xdc9a('0x23')](util[_0xdc9a('0x4')](_0xdc9a('0x24'),_0x47d27c[_0xdc9a('0x6')]),_0x47d27c);dials[_0x47d27c[_0xdc9a('0x6')]]['dialstatus']=_0x47d27c[_0xdc9a('0x9')];if(_0x47d27c[_0xdc9a('0x9')]==_0xdc9a('0x25')){dials[_0x47d27c[_0xdc9a('0x6')]]=_[_0xdc9a('0x1d')](dials[_0x47d27c[_0xdc9a('0x6')]],_0x47d27c);dials[_0x47d27c[_0xdc9a('0x6')]][_0xdc9a('0x26')]=utils[_0xdc9a('0x1e')]();dials[_0x47d27c['uniqueid']][_0xdc9a('0x1f')]='connect';utils[_0xdc9a('0x3')](util[_0xdc9a('0x4')](_0xdc9a('0x27'),_0x47d27c[_0xdc9a('0x6')],_0x47d27c[_0xdc9a('0x9')],dials[_0x47d27c[_0xdc9a('0x6')]][_0xdc9a('0x26')]));}else{utils[_0xdc9a('0x3')](util[_0xdc9a('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x47d27c[_0xdc9a('0x6')],_0x47d27c['dialstatus']));}}}catch(_0x45c66b){utils[_0xdc9a('0x14')](util[_0xdc9a('0x4')]('[%s][dials][dialend]',_0x47d27c[_0xdc9a('0x6')]),_0x45c66b);}};exports[_0xdc9a('0x28')]=function(_0x17148c){try{if(!_['isNil'](dials[_0x17148c[_0xdc9a('0x6')]])){utils['debug'](util[_0xdc9a('0x4')](_0xdc9a('0x29'),_0x17148c[_0xdc9a('0x6')]),_0x17148c);utils['info'](util[_0xdc9a('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x17148c[_0xdc9a('0x6')],_0x17148c['calleridnum'],_0x17148c['calleridname'],_0x17148c['cause-txt']));dials[_0x17148c['uniqueid']]=_['assign'](dials[_0x17148c['uniqueid']],{'endtime':utils[_0xdc9a('0x1e')](),'lastevent':_0xdc9a('0x2a')});dials[_0x17148c[_0xdc9a('0x6')]][_0xdc9a('0x2b')]=utils[_0xdc9a('0x2c')](dials[_0x17148c[_0xdc9a('0x6')]]['endtime'],dials[_0x17148c[_0xdc9a('0x6')]][_0xdc9a('0x22')]);dials[_0x17148c[_0xdc9a('0x6')]][_0xdc9a('0x2d')]=utils['diffTime'](dials[_0x17148c['uniqueid']]['answertime']||dials[_0x17148c[_0xdc9a('0x6')]][_0xdc9a('0x2e')],dials[_0x17148c['uniqueid']][_0xdc9a('0x22')]);dials[_0x17148c['uniqueid']][_0xdc9a('0x2f')]=dials[_0x17148c[_0xdc9a('0x6')]][_0xdc9a('0x26')]?utils[_0xdc9a('0x2c')](dials[_0x17148c[_0xdc9a('0x6')]]['endtime'],dials[_0x17148c['uniqueid']][_0xdc9a('0x26')]):0x0;writeDB(dials[_0x17148c[_0xdc9a('0x6')]]);}}catch(_0xf5062c){utils['error'](util['format'](_0xdc9a('0x29'),_0x17148c[_0xdc9a('0x6')]),_0xf5062c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e468263..4511c85 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 _0x21a9=['[%s][index][agentcalled]','uniqueid','debug','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','format'];(function(_0x1c3637,_0x2d04ce){var _0x593979=function(_0xdbcfae){while(--_0xdbcfae){_0x1c3637['push'](_0x1c3637['shift']());}};_0x593979(++_0x2d04ce);}(_0x21a9,0xba));var _0x921a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x21a9[_0x46e363];return _0x3fb059;};var AsteriskManager=require(_0x921a('0x0'));var config=require(_0x921a('0x1'));var utils=require(_0x921a('0x2'));var util=require(_0x921a('0x3'));var isXDREnabled=config[_0x921a('0x4')]&&config[_0x921a('0x4')][_0x921a('0x5')]?!config[_0x921a('0x4')][_0x921a('0x5')]:!![];var isProduction=config[_0x921a('0x6')]===_0x921a('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0x921a('0x4')][_0x921a('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x921a('0x9')]['port'],config[_0x921a('0x9')]['ip'],config[_0x921a('0x9')][_0x921a('0xa')],config[_0x921a('0x9')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x921a('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x921a('0xc')](_0x921a('0xd'));}else{var agents=require(_0x921a('0xe'));var calls=require(_0x921a('0xf'));var queues=require(_0x921a('0x10'));var recordings=require(_0x921a('0x11'));var members=require(_0x921a('0x12'));var dials=require(_0x921a('0x13'));var transfers=require(_0x921a('0x14'));var core=require(_0x921a('0x15'));ami['on'](_0x921a('0x16'),core[_0x921a('0x16')]);ami['on'](_0x921a('0x17'),core[_0x921a('0x17')]);ami['on'](_0x921a('0x18'),core[_0x921a('0x18')]);ami['on'](_0x921a('0x19'),core['error']);ami['on'](_0x921a('0x1a'),core[_0x921a('0x1a')]);ami['on'](_0x921a('0x1b'),core['managerevent']);ami['on'](_0x921a('0x1c'),function(_0xebf967){try{utils['debug'](util['format'](_0x921a('0x1d'),_0xebf967[_0x921a('0x1e')]),_0xebf967);members[_0x921a('0x1c')](_0xebf967);}catch(_0x17e39d){utils['error'](util['format']('[%s][index][devicestatechange]',_0xebf967[_0x921a('0x1e')]),_0x17e39d);}});ami['on'](_0x921a('0x1f'),function(_0x3b7d49){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x21'),_0x3b7d49[_0x921a('0x22')]),_0x3b7d49);agents[_0x921a('0x1f')](_0x3b7d49);}catch(_0x519bfa){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x21'),_0x3b7d49['uniqueid']),_0x519bfa);}});ami['on']('agentringnoanswer',function(_0x52121c){try{utils[_0x921a('0x23')](util[_0x921a('0x20')]('[%s][index][agentringnoanswer]',_0x52121c[_0x921a('0x22')]),_0x52121c);agents[_0x921a('0x24')](_0x52121c);}catch(_0x25234d){utils['error'](util[_0x921a('0x20')](_0x921a('0x25'),_0x52121c[_0x921a('0x22')]),_0x25234d);}});ami['on']('agentconnect',function(_0x43e278){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x26'),_0x43e278[_0x921a('0x22')]),_0x43e278);agents[_0x921a('0x27')](_0x43e278);queues[_0x921a('0x27')](_0x43e278);}catch(_0xe9d298){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x26'),_0x43e278[_0x921a('0x22')]),_0xe9d298);}});ami['on'](_0x921a('0x28'),function(_0x407b2e){try{utils[_0x921a('0x23')](util[_0x921a('0x20')](_0x921a('0x29'),_0x407b2e[_0x921a('0x22')]),_0x407b2e);agents[_0x921a('0x28')](_0x407b2e);queues[_0x921a('0x28')](_0x407b2e);members['agentcomplete'](_0x407b2e);}catch(_0x41bbdb){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x29'),_0x407b2e[_0x921a('0x22')]),_0x41bbdb);}});ami['on']('queuecallerabandon',function(_0x2e15cf){try{utils[_0x921a('0x23')](util[_0x921a('0x20')]('[%s][index][queuecallerabandon]',_0x2e15cf[_0x921a('0x22')]),_0x2e15cf);agents[_0x921a('0x2a')](_0x2e15cf);queues[_0x921a('0x2a')](_0x2e15cf);}catch(_0x3e8568){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x2b'),_0x2e15cf[_0x921a('0x22')]),_0x3e8568);}});ami['on'](_0x921a('0x2c'),function(_0x3a8340){try{utils[_0x921a('0x23')](util[_0x921a('0x20')](_0x921a('0x2d'),_0x3a8340[_0x921a('0x22')]),_0x3a8340);queues[_0x921a('0x2c')](_0x3a8340);recordings[_0x921a('0x2c')](_0x3a8340);}catch(_0x3d047b){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x2d'),_0x3a8340[_0x921a('0x22')]),_0x3d047b);}});ami['on'](_0x921a('0x2e'),function(_0x2be8b7){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x2f'),_0x2be8b7[_0x921a('0x22')]),_0x2be8b7);queues[_0x921a('0x2e')](_0x2be8b7);}catch(_0x3a6839){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x2f'),_0x2be8b7[_0x921a('0x22')]),_0x3a6839);}});ami['on'](_0x921a('0x30'),function(_0x3647ca){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x31'),_0x3647ca[_0x921a('0x22')]),_0x3647ca);queues[_0x921a('0x30')](_0x3647ca);calls['musiconholdstart'](_0x3647ca);}catch(_0x4be430){utils['error'](util[_0x921a('0x20')](_0x921a('0x31'),_0x3647ca[_0x921a('0x22')]),_0x4be430);}});ami['on'](_0x921a('0x32'),function(_0x505cd7){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x33'),_0x505cd7[_0x921a('0x22')]),_0x505cd7);queues['musiconholdstop'](_0x505cd7);calls[_0x921a('0x32')](_0x505cd7);}catch(_0x4d1a1d){utils[_0x921a('0x19')](util[_0x921a('0x20')]('[%s][index][musiconholdstop]',_0x505cd7[_0x921a('0x22')]),_0x4d1a1d);}});ami['on'](_0x921a('0x34'),function(_0x41bc16){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x35'),_0x41bc16[_0x921a('0x22')]),_0x41bc16);calls[_0x921a('0x34')](_0x41bc16);recordings['newstate'](_0x41bc16);}catch(_0x3ab28e){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x35'),_0x41bc16['uniqueid']),_0x3ab28e);}});ami['on'](_0x921a('0x36'),function(_0x17373f){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x37'),_0x17373f['uniqueid']),_0x17373f);calls[_0x921a('0x36')](_0x17373f);recordings['hangup'](_0x17373f);dials[_0x921a('0x36')](_0x17373f);agents[_0x921a('0x36')](_0x17373f);queues['hangup'](_0x17373f);}catch(_0x32f522){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x37'),_0x17373f['uniqueid']),_0x32f522);}});ami['on'](_0x921a('0x38'),function(_0x26158f){try{utils[_0x921a('0x23')](util[_0x921a('0x20')](_0x921a('0x39'),_0x26158f[_0x921a('0x22')]),_0x26158f);members[_0x921a('0x38')](_0x26158f);}catch(_0x18aa5c){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x39'),_0x26158f[_0x921a('0x22')]),_0x18aa5c);}});ami['on'](_0x921a('0x3a'),function(_0x25aedb){try{utils[_0x921a('0x23')](util['format'](_0x921a('0x3b'),_0x25aedb[_0x921a('0x22')]),_0x25aedb);queues[_0x921a('0x3a')](_0x25aedb);agents[_0x921a('0x3a')](_0x25aedb);transfers[_0x921a('0x3a')](_0x25aedb);}catch(_0x395749){utils[_0x921a('0x19')](util['format'](_0x921a('0x3b'),_0x25aedb['uniqueid']),_0x395749);}});ami['on'](_0x921a('0x3c'),function(_0x249cb9){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x3d'),_0x249cb9[_0x921a('0x3e')]),_0x249cb9);queues[_0x921a('0x3c')](_0x249cb9);transfers[_0x921a('0x3c')](_0x249cb9);agents[_0x921a('0x3c')](_0x249cb9);calls[_0x921a('0x3c')](_0x249cb9);}catch(_0x4e2ed8){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x3d'),_0x249cb9['origtransfereruniqueid']),_0x4e2ed8);}});ami['on'](_0x921a('0x3f'),function(_0x5881e3){try{utils[_0x921a('0x23')](util[_0x921a('0x20')](_0x921a('0x40'),_0x5881e3['uniqueid']),_0x5881e3);queues[_0x921a('0x3f')](_0x5881e3);recordings[_0x921a('0x3f')](_0x5881e3);calls[_0x921a('0x3f')](_0x5881e3);dials[_0x921a('0x3f')](_0x5881e3);}catch(_0x493ab8){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x40'),_0x5881e3[_0x921a('0x22')]),_0x493ab8);}});ami['on'](_0x921a('0x41'),function(_0x5be271){try{utils['debug'](util['format']('[%s][index][newexten]',_0x5be271[_0x921a('0x22')]),_0x5be271);calls['newexten'](_0x5be271);recordings[_0x921a('0x41')](_0x5be271);dials[_0x921a('0x41')](_0x5be271);}catch(_0x65a9da){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x42'),_0x5be271[_0x921a('0x22')]),_0x65a9da);}});ami['on'](_0x921a('0x43'),function(_0x5b403f){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x44'),_0x5b403f[_0x921a('0x22')]),_0x5b403f);calls[_0x921a('0x43')](_0x5b403f);recordings[_0x921a('0x43')](_0x5b403f);}catch(_0x1f00cb){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x44'),_0x5b403f[_0x921a('0x22')]),_0x1f00cb);}});ami['on'](_0x921a('0x45'),function(_0x5c0b3c){try{utils['debug'](util[_0x921a('0x20')](_0x921a('0x46'),_0x5c0b3c[_0x921a('0x22')]),_0x5c0b3c);dials['dialbegin'](_0x5c0b3c);}catch(_0x15b663){utils[_0x921a('0x19')](util[_0x921a('0x20')](_0x921a('0x47'),_0x5c0b3c[_0x921a('0x22')]),_0x15b663);}});ami['on']('dialend',function(_0x1b289d){try{utils['debug'](util[_0x921a('0x20')]('[%s][index][dialend]',_0x1b289d['uniqueid']),_0x1b289d);dials[_0x921a('0x48')](_0x1b289d);}catch(_0x1319f5){utils[_0x921a('0x19')](util['format']('[%s][index][dialend]',_0x1b289d[_0x921a('0x22')]),_0x1319f5);}});} \ No newline at end of file +var _0x0268=['./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','debug','[%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]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller'];(function(_0x537d24,_0x3ea8bb){var _0x56e7f2=function(_0x263a02){while(--_0x263a02){_0x537d24['push'](_0x537d24['shift']());}};_0x56e7f2(++_0x3ea8bb);}(_0x0268,0x155));var _0x8026=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x0268[_0x491a7f];return _0x3d8f44;};var AsteriskManager=require(_0x8026('0x0'));var config=require(_0x8026('0x1'));var utils=require(_0x8026('0x2'));var util=require(_0x8026('0x3'));var isXDREnabled=config[_0x8026('0x4')]&&config[_0x8026('0x4')][_0x8026('0x5')]?!config[_0x8026('0x4')]['disabled']:!![];var isProduction=config[_0x8026('0x6')]===_0x8026('0x7')||![];var isLocalAsterisk=config[_0x8026('0x4')]&&config[_0x8026('0x4')][_0x8026('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x8026('0x9')][_0x8026('0xa')],config[_0x8026('0x9')]['ip'],config['asterisk'][_0x8026('0xb')],config[_0x8026('0x9')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x8026('0xc')](_0x8026('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8026('0xc')](_0x8026('0xe'));}else{var agents=require(_0x8026('0xf'));var calls=require(_0x8026('0x10'));var queues=require('./queues.controller');var recordings=require(_0x8026('0x11'));var members=require(_0x8026('0x12'));var dials=require(_0x8026('0x13'));var transfers=require(_0x8026('0x14'));var core=require(_0x8026('0x15'));ami['on'](_0x8026('0x16'),core['connect']);ami['on']('shutdown',core[_0x8026('0x17')]);ami['on'](_0x8026('0x18'),core[_0x8026('0x18')]);ami['on'](_0x8026('0x19'),core[_0x8026('0x19')]);ami['on'](_0x8026('0x1a'),core['close']);ami['on']('managerevent',core[_0x8026('0x1b')]);ami['on'](_0x8026('0x1c'),function(_0x2b9824){try{utils['debug'](util['format'](_0x8026('0x1d'),_0x2b9824[_0x8026('0x1e')]),_0x2b9824);members['devicestatechange'](_0x2b9824);}catch(_0x481d14){utils[_0x8026('0x19')](util[_0x8026('0x1f')](_0x8026('0x1d'),_0x2b9824[_0x8026('0x1e')]),_0x481d14);}});ami['on'](_0x8026('0x20'),function(_0x38fb60){try{utils['debug'](util['format'](_0x8026('0x21'),_0x38fb60[_0x8026('0x22')]),_0x38fb60);agents[_0x8026('0x20')](_0x38fb60);}catch(_0x12bd5d){utils[_0x8026('0x19')](util['format'](_0x8026('0x21'),_0x38fb60['uniqueid']),_0x12bd5d);}});ami['on'](_0x8026('0x23'),function(_0x1e1b88){try{utils['debug'](util[_0x8026('0x1f')]('[%s][index][agentringnoanswer]',_0x1e1b88['uniqueid']),_0x1e1b88);agents['agentringnoanswer'](_0x1e1b88);}catch(_0x1de15e){utils[_0x8026('0x19')](util['format'](_0x8026('0x24'),_0x1e1b88[_0x8026('0x22')]),_0x1de15e);}});ami['on']('agentconnect',function(_0x2d998f){try{utils['debug'](util[_0x8026('0x1f')]('[%s][index][agentconnect]',_0x2d998f[_0x8026('0x22')]),_0x2d998f);agents[_0x8026('0x25')](_0x2d998f);queues[_0x8026('0x25')](_0x2d998f);}catch(_0x98af4e){utils[_0x8026('0x19')](util['format'](_0x8026('0x26'),_0x2d998f[_0x8026('0x22')]),_0x98af4e);}});ami['on'](_0x8026('0x27'),function(_0x4b9c72){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x29'),_0x4b9c72[_0x8026('0x22')]),_0x4b9c72);agents[_0x8026('0x27')](_0x4b9c72);queues[_0x8026('0x27')](_0x4b9c72);members[_0x8026('0x27')](_0x4b9c72);}catch(_0x3a1180){utils[_0x8026('0x19')](util[_0x8026('0x1f')](_0x8026('0x29'),_0x4b9c72[_0x8026('0x22')]),_0x3a1180);}});ami['on'](_0x8026('0x2a'),function(_0x1c81df){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')]('[%s][index][queuecallerabandon]',_0x1c81df[_0x8026('0x22')]),_0x1c81df);agents['queuecallerabandon'](_0x1c81df);queues[_0x8026('0x2a')](_0x1c81df);}catch(_0x1a07b3){utils[_0x8026('0x19')](util['format'](_0x8026('0x2b'),_0x1c81df[_0x8026('0x22')]),_0x1a07b3);}});ami['on'](_0x8026('0x2c'),function(_0x512e3b){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x2d'),_0x512e3b[_0x8026('0x22')]),_0x512e3b);queues[_0x8026('0x2c')](_0x512e3b);recordings['queuecallerjoin'](_0x512e3b);}catch(_0x451575){utils['error'](util['format'](_0x8026('0x2d'),_0x512e3b[_0x8026('0x22')]),_0x451575);}});ami['on'](_0x8026('0x2e'),function(_0x146f08){try{utils['debug'](util[_0x8026('0x1f')](_0x8026('0x2f'),_0x146f08['uniqueid']),_0x146f08);queues[_0x8026('0x2e')](_0x146f08);}catch(_0x20fd21){utils[_0x8026('0x19')](util['format']('[%s][index][queuecallerleave]',_0x146f08[_0x8026('0x22')]),_0x20fd21);}});ami['on'](_0x8026('0x30'),function(_0x38f522){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x31'),_0x38f522['uniqueid']),_0x38f522);queues[_0x8026('0x30')](_0x38f522);calls['musiconholdstart'](_0x38f522);}catch(_0x2fd8b2){utils[_0x8026('0x19')](util[_0x8026('0x1f')](_0x8026('0x31'),_0x38f522['uniqueid']),_0x2fd8b2);}});ami['on'](_0x8026('0x32'),function(_0x2bf020){try{utils['debug'](util['format'](_0x8026('0x33'),_0x2bf020[_0x8026('0x22')]),_0x2bf020);queues[_0x8026('0x32')](_0x2bf020);calls['musiconholdstop'](_0x2bf020);}catch(_0x355c92){utils[_0x8026('0x19')](util[_0x8026('0x1f')]('[%s][index][musiconholdstop]',_0x2bf020[_0x8026('0x22')]),_0x355c92);}});ami['on'](_0x8026('0x34'),function(_0x55cf8f){try{utils['debug'](util[_0x8026('0x1f')](_0x8026('0x35'),_0x55cf8f[_0x8026('0x22')]),_0x55cf8f);calls[_0x8026('0x34')](_0x55cf8f);recordings[_0x8026('0x34')](_0x55cf8f);}catch(_0x43efb0){utils[_0x8026('0x19')](util[_0x8026('0x1f')](_0x8026('0x35'),_0x55cf8f[_0x8026('0x22')]),_0x43efb0);}});ami['on'](_0x8026('0x36'),function(_0x5a4262){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x37'),_0x5a4262[_0x8026('0x22')]),_0x5a4262);calls[_0x8026('0x36')](_0x5a4262);recordings[_0x8026('0x36')](_0x5a4262);dials[_0x8026('0x36')](_0x5a4262);agents[_0x8026('0x36')](_0x5a4262);queues[_0x8026('0x36')](_0x5a4262);}catch(_0x2fc259){utils[_0x8026('0x19')](util[_0x8026('0x1f')]('[%s][index][hangup]',_0x5a4262[_0x8026('0x22')]),_0x2fc259);}});ami['on']('cdr',function(_0x5968ff){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x38'),_0x5968ff['uniqueid']),_0x5968ff);members[_0x8026('0x39')](_0x5968ff);}catch(_0x569067){utils[_0x8026('0x19')](util[_0x8026('0x1f')](_0x8026('0x38'),_0x5968ff[_0x8026('0x22')]),_0x569067);}});ami['on'](_0x8026('0x3a'),function(_0x2f6879){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x3b'),_0x2f6879[_0x8026('0x22')]),_0x2f6879);queues[_0x8026('0x3a')](_0x2f6879);agents['blindtransfer'](_0x2f6879);transfers[_0x8026('0x3a')](_0x2f6879);}catch(_0x21ba12){utils[_0x8026('0x19')](util['format'](_0x8026('0x3b'),_0x2f6879[_0x8026('0x22')]),_0x21ba12);}});ami['on'](_0x8026('0x3c'),function(_0x4dfeba){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x3d'),_0x4dfeba['origtransfereruniqueid']),_0x4dfeba);queues['attendedtransfer'](_0x4dfeba);transfers[_0x8026('0x3c')](_0x4dfeba);agents[_0x8026('0x3c')](_0x4dfeba);calls[_0x8026('0x3c')](_0x4dfeba);}catch(_0x523e4b){utils[_0x8026('0x19')](util['format']('[%s][index][attendedtransfer]',_0x4dfeba['origtransfereruniqueid']),_0x523e4b);}});ami['on'](_0x8026('0x3e'),function(_0xbb7797){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x3f'),_0xbb7797[_0x8026('0x22')]),_0xbb7797);queues[_0x8026('0x3e')](_0xbb7797);recordings[_0x8026('0x3e')](_0xbb7797);calls['varset'](_0xbb7797);dials[_0x8026('0x3e')](_0xbb7797);}catch(_0x576b50){utils['error'](util['format']('[%s][index][varset]',_0xbb7797[_0x8026('0x22')]),_0x576b50);}});ami['on'](_0x8026('0x40'),function(_0x1e7b5c){try{utils[_0x8026('0x28')](util['format']('[%s][index][newexten]',_0x1e7b5c[_0x8026('0x22')]),_0x1e7b5c);calls[_0x8026('0x40')](_0x1e7b5c);recordings[_0x8026('0x40')](_0x1e7b5c);dials['newexten'](_0x1e7b5c);}catch(_0x25f03f){utils[_0x8026('0x19')](util['format'](_0x8026('0x41'),_0x1e7b5c['uniqueid']),_0x25f03f);}});ami['on'](_0x8026('0x42'),function(_0x1e0dff){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')]('[%s][index][newchannel]',_0x1e0dff[_0x8026('0x22')]),_0x1e0dff);calls[_0x8026('0x42')](_0x1e0dff);recordings[_0x8026('0x42')](_0x1e0dff);}catch(_0x3ef4d9){utils[_0x8026('0x19')](util[_0x8026('0x1f')]('[%s][index][newchannel]',_0x1e0dff[_0x8026('0x22')]),_0x3ef4d9);}});ami['on']('dialbegin',function(_0x9278c){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x43'),_0x9278c['uniqueid']),_0x9278c);dials[_0x8026('0x44')](_0x9278c);}catch(_0x457408){utils[_0x8026('0x19')](util[_0x8026('0x1f')](_0x8026('0x45'),_0x9278c['uniqueid']),_0x457408);}});ami['on'](_0x8026('0x46'),function(_0x3ba79c){try{utils[_0x8026('0x28')](util[_0x8026('0x1f')](_0x8026('0x47'),_0x3ba79c[_0x8026('0x22')]),_0x3ba79c);dials[_0x8026('0x46')](_0x3ba79c);}catch(_0x2733a4){utils[_0x8026('0x19')](util[_0x8026('0x1f')](_0x8026('0x47'),_0x3ba79c[_0x8026('0x22')]),_0x2733a4);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4e7259b..0a08362 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 _0x32f6=['format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','type','interface','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','some','startsWith','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','TALKING','agent','isNil','exitAt','now','duration','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','data1','./utils','Local/_attended@transfer','info'];(function(_0x46f157,_0x25ee0e){var _0x8f305a=function(_0xcad742){while(--_0xcad742){_0x46f157['push'](_0x46f157['shift']());}};_0x8f305a(++_0x25ee0e);}(_0x32f6,0xbd));var _0x632f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x32f6[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x632f('0x0'));var members={};var exclude=[_0x632f('0x1'),'Queue:'];function writeDB(_0x4338c6){utils[_0x632f('0x2')](util[_0x632f('0x3')](_0x632f('0x4'),_0x4338c6[_0x632f('0x5')],_0x4338c6['interface'],_0x4338c6['channel'],_0x4338c6['data2'],_0x4338c6['membername'],_0x4338c6[_0x632f('0x6')]));if(_0x4338c6[_0x632f('0x7')]){utils[_0x632f('0x8')](_0x4338c6[_0x632f('0x7')])[_0x632f('0x9')](function(_0x3b07a3){if(_0x3b07a3){_0x4338c6[_0x632f('0xa')]=_0x3b07a3[_0x632f('0xb')];_0x4338c6[_0x632f('0xc')]=_0x3b07a3['internal'];utils[_0x632f('0xd')](_0x632f('0xe'),_0x4338c6);}else{utils['getUserByName'](_0x4338c6['interface']['split']('/')[0x1])['then'](function(_0x74a7d7){if(_0x74a7d7){_0x4338c6['membername']=_0x74a7d7[_0x632f('0xb')];_0x4338c6[_0x632f('0xc')]=_0x74a7d7[_0x632f('0xc')];utils['request']('CreateMemberReport',_0x4338c6);}});}})['catch'](function(_0x50df7e){utils['error'](util['format']('[%s][members][writeDB]',_0x4338c6[_0x632f('0x5')]),_0x50df7e);});}delete members[_0x4338c6[_0x632f('0x7')]];}function startsWith(_0x5754c6,_0x1fa404){return _[_0x632f('0xf')](_0x5754c6,function(_0x1bdbc0){return _[_0x632f('0x10')](_0x1fa404,_0x1bdbc0);});}exports['devicestatechange']=function(_0xa81024){try{utils[_0x632f('0x11')](util[_0x632f('0x3')](_0x632f('0x12'),members[_0xa81024[_0x632f('0x13')]]?members[_0xa81024[_0x632f('0x13')]]['uniqueid']:_0xa81024[_0x632f('0x13')]),_0xa81024);utils[_0x632f('0x2')](util[_0x632f('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0xa81024['device']]?members[_0xa81024['device']][_0x632f('0x5')]:_0xa81024[_0x632f('0x13')],_0xa81024[_0x632f('0x14')],_0xa81024[_0x632f('0x13')]));switch(_0xa81024[_0x632f('0x14')]){case'INUSE':case _0x632f('0x15'):if(!startsWith(exclude,_0xa81024['device'])){members[_0xa81024[_0x632f('0x13')]]={'channel':_0x632f('0x16'),'interface':_0xa81024[_0x632f('0x13')],'type':_0x632f('0x17'),'enterAt':utils['now'](),'role':_0x632f('0x18')};}break;case'NOT_INUSE':if(!_[_0x632f('0x19')](members[_0xa81024['device']])){members[_0xa81024['device']][_0x632f('0x1a')]=utils[_0x632f('0x1b')]();members[_0xa81024[_0x632f('0x13')]][_0x632f('0x1c')]=utils[_0x632f('0x1d')](members[_0xa81024['device']][_0x632f('0x1a')],members[_0xa81024['device']][_0x632f('0x1e')]);if(members[_0xa81024[_0x632f('0x13')]][_0x632f('0x5')]){writeDB(members[_0xa81024[_0x632f('0x13')]]);}}break;default:break;}}catch(_0x217d78){utils[_0x632f('0x1f')](util['format']('[%s][members][devicestatechange]',members[_0xa81024[_0x632f('0x13')]]?members[_0xa81024[_0x632f('0x13')]][_0x632f('0x5')]:_0xa81024[_0x632f('0x13')]),_0x217d78);}};exports[_0x632f('0x20')]=function(_0x1014ba){try{if(!_[_0x632f('0x19')](members[_0x1014ba[_0x632f('0x7')]])){utils[_0x632f('0x11')](util[_0x632f('0x3')]('[%s][members][agentcomplete]',_0x1014ba[_0x632f('0x5')]),_0x1014ba);utils[_0x632f('0x2')](util[_0x632f('0x3')](_0x632f('0x21'),_0x1014ba['uniqueid'],_0x1014ba['interface'],_0x1014ba[_0x632f('0x22')]));members[_0x1014ba[_0x632f('0x7')]]=_[_0x632f('0x23')](members[_0x1014ba[_0x632f('0x7')]],{'data4':_0x1014ba[_0x632f('0x22')],'uniqueid':_0x1014ba[_0x632f('0x5')]});}}catch(_0xb0572f){utils[_0x632f('0x1f')](util[_0x632f('0x3')](_0x632f('0x24'),_0x1014ba[_0x632f('0x5')]),_0xb0572f);}};exports[_0x632f('0x25')]=function(_0x14d689){try{utils['debug'](util['format'](_0x632f('0x26'),_0x14d689['uniqueid']),_0x14d689);if(_0x14d689['channel']){var _0x490959=_0x14d689[_0x632f('0x27')]['split']('-')[0x0];if(!_[_0x632f('0x19')](members[_0x490959])){members[_0x490959]=_[_0x632f('0x23')](members[_0x490959],{'data1':members[_0x490959]['data1']||_0x14d689[_0x632f('0x6')],'data2':members[_0x490959][_0x632f('0x28')]||_0x14d689[_0x632f('0x29')],'data3':members[_0x490959][_0x632f('0x2a')]||_0x14d689[_0x632f('0x2b')],'uniqueid':members[_0x490959][_0x632f('0x5')]||_0x14d689['uniqueid']});utils['info'](util['format'](_0x632f('0x2c'),_0x14d689['uniqueid'],members[_0x490959]['data1'],members[_0x490959]['data2'],members[_0x490959][_0x632f('0x2a')]));if(members[_0x490959][_0x632f('0x1a')]){writeDB(members[_0x490959]);}}}if(_0x14d689[_0x632f('0x2d')]){var _0x29ae69=_0x14d689['destinationchannel'][_0x632f('0x2e')]('-')[0x0];if(!_[_0x632f('0x19')](members[_0x29ae69])){members[_0x29ae69]=_[_0x632f('0x23')](members[_0x29ae69],{'data1':members[_0x29ae69]['data1']||_0x14d689[_0x632f('0x6')],'data2':members[_0x29ae69][_0x632f('0x28')]||_0x14d689[_0x632f('0x29')],'data3':members[_0x29ae69]['data3']||_0x14d689[_0x632f('0x2b')],'uniqueid':members[_0x29ae69]['uniqueid']||_0x14d689['uniqueid']});utils[_0x632f('0x2')](util['format'](_0x632f('0x2c'),_0x14d689[_0x632f('0x5')],members[_0x29ae69][_0x632f('0x2f')],members[_0x29ae69]['data2'],members[_0x29ae69]['data3']));if(members[_0x29ae69][_0x632f('0x1a')]){writeDB(members[_0x29ae69]);}}}}catch(_0x5a4218){utils[_0x632f('0x1f')](util[_0x632f('0x3')]('[%s][members][cdr]',_0x14d689[_0x632f('0x5')]),_0x5a4218);}}; \ No newline at end of file +var _0x245e=['NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Queue:','info','format','uniqueid','interface','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent'];(function(_0xebdaea,_0x5afdc4){var _0x67f341=function(_0x39624c){while(--_0x39624c){_0xebdaea['push'](_0xebdaea['shift']());}};_0x67f341(++_0x5afdc4);}(_0x245e,0x11d));var _0xe245=function(_0x4ece18,_0x287596){_0x4ece18=_0x4ece18-0x0;var _0x3008ce=_0x245e[_0x4ece18];return _0x3008ce;};'use strict';var _=require(_0xe245('0x0'));var util=require(_0xe245('0x1'));var utils=require(_0xe245('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xe245('0x3')];function writeDB(_0x433e16){utils[_0xe245('0x4')](util[_0xe245('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x433e16[_0xe245('0x6')],_0x433e16[_0xe245('0x7')],_0x433e16['channel'],_0x433e16[_0xe245('0x8')],_0x433e16[_0xe245('0x9')],_0x433e16[_0xe245('0xa')]));if(_0x433e16[_0xe245('0x7')]){utils[_0xe245('0xb')](_0x433e16['interface'])[_0xe245('0xc')](function(_0x40baca){if(_0x40baca){_0x433e16[_0xe245('0x9')]=_0x40baca['name'];_0x433e16[_0xe245('0xd')]=_0x40baca[_0xe245('0xd')];utils[_0xe245('0xe')](_0xe245('0xf'),_0x433e16);}else{utils[_0xe245('0x10')](_0x433e16[_0xe245('0x7')][_0xe245('0x11')]('/')[0x1])['then'](function(_0x3d3055){if(_0x3d3055){_0x433e16[_0xe245('0x9')]=_0x3d3055[_0xe245('0x12')];_0x433e16[_0xe245('0xd')]=_0x3d3055[_0xe245('0xd')];utils['request'](_0xe245('0xf'),_0x433e16);}});}})[_0xe245('0x13')](function(_0x2f3e3b){utils[_0xe245('0x14')](util['format'](_0xe245('0x15'),_0x433e16['uniqueid']),_0x2f3e3b);});}delete members[_0x433e16['interface']];}function startsWith(_0x2bc605,_0xe34891){return _[_0xe245('0x16')](_0x2bc605,function(_0x2c7094){return _['startsWith'](_0xe34891,_0x2c7094);});}exports[_0xe245('0x17')]=function(_0x398bda){try{utils['debug'](util[_0xe245('0x5')](_0xe245('0x18'),members[_0x398bda[_0xe245('0x19')]]?members[_0x398bda[_0xe245('0x19')]][_0xe245('0x6')]:_0x398bda[_0xe245('0x19')]),_0x398bda);utils[_0xe245('0x4')](util[_0xe245('0x5')](_0xe245('0x1a'),members[_0x398bda[_0xe245('0x19')]]?members[_0x398bda['device']][_0xe245('0x6')]:_0x398bda['device'],_0x398bda['state'],_0x398bda[_0xe245('0x19')]));switch(_0x398bda[_0xe245('0x1b')]){case'INUSE':case _0xe245('0x1c'):if(!startsWith(exclude,_0x398bda[_0xe245('0x19')])){members[_0x398bda['device']]={'channel':_0xe245('0x1d'),'interface':_0x398bda[_0xe245('0x19')],'type':_0xe245('0x1e'),'enterAt':utils[_0xe245('0x1f')](),'role':_0xe245('0x20')};}break;case _0xe245('0x21'):if(!_[_0xe245('0x22')](members[_0x398bda[_0xe245('0x19')]])){members[_0x398bda['device']][_0xe245('0x23')]=utils[_0xe245('0x1f')]();members[_0x398bda[_0xe245('0x19')]][_0xe245('0x24')]=utils[_0xe245('0x25')](members[_0x398bda[_0xe245('0x19')]][_0xe245('0x23')],members[_0x398bda['device']]['enterAt']);if(members[_0x398bda[_0xe245('0x19')]][_0xe245('0x6')]){writeDB(members[_0x398bda['device']]);}}break;default:break;}}catch(_0x3e2145){utils[_0xe245('0x14')](util[_0xe245('0x5')](_0xe245('0x18'),members[_0x398bda[_0xe245('0x19')]]?members[_0x398bda['device']][_0xe245('0x6')]:_0x398bda['device']),_0x3e2145);}};exports[_0xe245('0x26')]=function(_0x375ec6){try{if(!_[_0xe245('0x22')](members[_0x375ec6['interface']])){utils[_0xe245('0x27')](util[_0xe245('0x5')](_0xe245('0x28'),_0x375ec6[_0xe245('0x6')]),_0x375ec6);utils['info'](util['format'](_0xe245('0x29'),_0x375ec6[_0xe245('0x6')],_0x375ec6['interface'],_0x375ec6[_0xe245('0x2a')]));members[_0x375ec6['interface']]=_[_0xe245('0x2b')](members[_0x375ec6[_0xe245('0x7')]],{'data4':_0x375ec6[_0xe245('0x2a')],'uniqueid':_0x375ec6[_0xe245('0x6')]});}}catch(_0x5b5d88){utils['error'](util['format'](_0xe245('0x28'),_0x375ec6[_0xe245('0x6')]),_0x5b5d88);}};exports[_0xe245('0x2c')]=function(_0xc391e1){try{utils['debug'](util[_0xe245('0x5')]('[%s][members][cdr]',_0xc391e1[_0xe245('0x6')]),_0xc391e1);if(_0xc391e1[_0xe245('0x2d')]){var _0x17c144=_0xc391e1[_0xe245('0x2d')][_0xe245('0x11')]('-')[0x0];if(!_[_0xe245('0x22')](members[_0x17c144])){members[_0x17c144]=_['assign'](members[_0x17c144],{'data1':members[_0x17c144]['data1']||_0xc391e1[_0xe245('0xa')],'data2':members[_0x17c144][_0xe245('0x8')]||_0xc391e1[_0xe245('0x2e')],'data3':members[_0x17c144][_0xe245('0x2f')]||_0xc391e1[_0xe245('0x30')],'uniqueid':members[_0x17c144]['uniqueid']||_0xc391e1[_0xe245('0x6')]});utils[_0xe245('0x4')](util['format'](_0xe245('0x31'),_0xc391e1['uniqueid'],members[_0x17c144][_0xe245('0x32')],members[_0x17c144][_0xe245('0x8')],members[_0x17c144][_0xe245('0x2f')]));if(members[_0x17c144]['exitAt']){writeDB(members[_0x17c144]);}}}if(_0xc391e1[_0xe245('0x33')]){var _0x4e4c44=_0xc391e1['destinationchannel'][_0xe245('0x11')]('-')[0x0];if(!_[_0xe245('0x22')](members[_0x4e4c44])){members[_0x4e4c44]=_[_0xe245('0x2b')](members[_0x4e4c44],{'data1':members[_0x4e4c44]['data1']||_0xc391e1[_0xe245('0xa')],'data2':members[_0x4e4c44][_0xe245('0x8')]||_0xc391e1[_0xe245('0x2e')],'data3':members[_0x4e4c44]['data3']||_0xc391e1[_0xe245('0x30')],'uniqueid':members[_0x4e4c44][_0xe245('0x6')]||_0xc391e1[_0xe245('0x6')]});utils['info'](util[_0xe245('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xc391e1[_0xe245('0x6')],members[_0x4e4c44][_0xe245('0x32')],members[_0x4e4c44][_0xe245('0x8')],members[_0x4e4c44][_0xe245('0x2f')]));if(members[_0x4e4c44][_0xe245('0x23')]){writeDB(members[_0x4e4c44]);}}}}catch(_0x1f1f00){utils['error'](util[_0xe245('0x5')](_0xe245('0x34'),_0xc391e1[_0xe245('0x6')]),_0x1f1f00);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 83e23f7..f3ac553 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 _0xa077=['secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','value','queuecallerabandon','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','error','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferexten','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid'];(function(_0x72493a,_0x158721){var _0x4c6027=function(_0x471e97){while(--_0x471e97){_0x72493a['push'](_0x72493a['shift']());}};_0x4c6027(++_0x158721);}(_0xa077,0x73));var _0x7a07=function(_0x5bc489,_0x4fbbcf){_0x5bc489=_0x5bc489-0x0;var _0x4a558f=_0xa077[_0x5bc489];return _0x4a558f;};'use strict';var _=require(_0x7a07('0x0'));var util=require(_0x7a07('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1e1733){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1e1733[_0x7a07('0x2')],_0x1e1733[_0x7a07('0x3')],_0x1e1733[_0x7a07('0x4')],_0x1e1733['lastAssignedTo'],_0x1e1733[_0x7a07('0x5')],_0x1e1733[_0x7a07('0x6')],_0x1e1733[_0x7a07('0x7')]));if(_0x1e1733[_0x7a07('0x4')]){utils[_0x7a07('0x8')](_0x1e1733['queue'])[_0x7a07('0x9')](function(_0x5e9c10){if(_0x5e9c10){_0x1e1733[_0x7a07('0xa')]=_0x5e9c10['type'];}utils[_0x7a07('0xb')](_0x7a07('0xc'),_0x1e1733);});}else{utils[_0x7a07('0xb')](_0x7a07('0xc'),_0x1e1733);}if(_0x1e1733[_0x7a07('0xd')]){delete queues[_0x1e1733[_0x7a07('0xd')]];}else{delete queues[_0x1e1733['uniqueid']];}}exports[_0x7a07('0xe')]=function(_0x5585c1){try{utils[_0x7a07('0xf')](util[_0x7a07('0x10')](_0x7a07('0x11'),_0x5585c1[_0x7a07('0x2')]),_0x5585c1);utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x13'),_0x5585c1[_0x7a07('0x2')],_0x5585c1[_0x7a07('0x4')],_0x5585c1[_0x7a07('0x14')]));queues[_0x5585c1[_0x7a07('0x2')]]=_[_0x7a07('0x15')](_0x5585c1,{'originalposition':_0x5585c1[_0x7a07('0x14')],'queuecallerjoinAt':utils[_0x7a07('0x16')](),'mohtime':0x0});}catch(_0x487e90){utils['error'](util[_0x7a07('0x10')](_0x7a07('0x11'),_0x5585c1[_0x7a07('0x2')]),_0x487e90);}};exports[_0x7a07('0x17')]=function(_0x163928){try{if(!_[_0x7a07('0x18')](queues[_0x163928['uniqueid']])){utils[_0x7a07('0xf')](util[_0x7a07('0x10')]('[%s][queues][hangup]',_0x163928[_0x7a07('0x2')]),_0x163928);if(queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x19')]){if(!queues[_0x163928[_0x7a07('0x2')]]['queuecallerabandon']&&!queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x1a')]){queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x1b')]=!![];queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x1c')]=utils[_0x7a07('0x16')]();queues[_0x163928['uniqueid']][_0x7a07('0x7')]=_0x7a07('0x1d');}utils[_0x7a07('0x12')](util['format'](_0x7a07('0x1e'),_0x163928['uniqueid'],queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0x1f')],queues[_0x163928[_0x7a07('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x163928[_0x7a07('0x2')]]);}else if(queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0xd')]){utils['info'](util[_0x7a07('0x10')](_0x7a07('0x20'),_0x163928['uniqueid'],queues[_0x163928['uniqueid']][_0x7a07('0x1f')],queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0xd')]));queues[queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0xd')]]=queues[_0x163928['uniqueid']];queues[queues[_0x163928[_0x7a07('0x2')]][_0x7a07('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x163928['uniqueid']];}}}catch(_0x366558){utils['error'](util[_0x7a07('0x10')](_0x7a07('0x21'),_0x163928[_0x7a07('0x2')]),_0x366558);}};exports[_0x7a07('0x22')]=function(_0xa011b0){try{utils[_0x7a07('0xf')](util['format'](_0x7a07('0x23'),_0xa011b0[_0x7a07('0x2')]),_0xa011b0);if(!_[_0x7a07('0x18')](_0xa011b0[_0x7a07('0x24')]['queuestatus'])&&_0xa011b0[_0x7a07('0x25')]['toUpperCase']()!=='CONTINUE'){if(!_[_0x7a07('0x18')](queues[_0xa011b0[_0x7a07('0x2')]])){queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x26')]=![];queues[_0xa011b0[_0x7a07('0x2')]]['queuecallerabandonAt']=null;queues[_0xa011b0['uniqueid']][_0x7a07('0x1a')]=!![];queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x27')]=utils[_0x7a07('0x16')]();queues[_0xa011b0[_0x7a07('0x2')]]['queuecallerexitreason']=_0xa011b0[_0x7a07('0x25')][_0x7a07('0x28')]();utils['info'](util[_0x7a07('0x10')](_0x7a07('0x29'),_0xa011b0[_0x7a07('0x2')],queues[_0xa011b0['uniqueid']][_0x7a07('0x1f')],_0xa011b0[_0x7a07('0x25')],queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x7')]));writeDB(queues[_0xa011b0[_0x7a07('0x2')]]);}}else if(!_[_0x7a07('0x18')](_0xa011b0[_0x7a07('0x24')][_0x7a07('0x2a')])){if(!_[_0x7a07('0x18')](queues[_0xa011b0['uniqueid']])&&!queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x26')]){queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x26')]=![];queues[_0xa011b0['uniqueid']][_0x7a07('0x2b')]=null;queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x1a')]=!![];queues[_0xa011b0['uniqueid']][_0x7a07('0x27')]=utils['now']();queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x7')]=_0x7a07('0x2c');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xa011b0[_0x7a07('0x2')],queues[_0xa011b0[_0x7a07('0x2')]]['name'],_0xa011b0[_0x7a07('0x25')],queues[_0xa011b0[_0x7a07('0x2')]][_0x7a07('0x7')]));}}}catch(_0x18d347){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')]('[%s][queues][varset]',_0xa011b0[_0x7a07('0x2')]),_0x18d347);}};exports[_0x7a07('0x26')]=function(_0x4ef928){try{if(!_[_0x7a07('0x18')](queues[_0x4ef928['uniqueid']])){utils[_0x7a07('0xf')](util['format'](_0x7a07('0x2e'),_0x4ef928[_0x7a07('0x2')]),_0x4ef928);queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x1a')]=![];queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x27')]=null;queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x26')]=!![];queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x2b')]=utils[_0x7a07('0x16')]();queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x7')]='ABANDONED';utils[_0x7a07('0x12')](util[_0x7a07('0x10')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4ef928[_0x7a07('0x2')],queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x1f')],queues[_0x4ef928[_0x7a07('0x2')]][_0x7a07('0x7')]));}}catch(_0x164f05){utils[_0x7a07('0x2d')](util['format'](_0x7a07('0x2e'),_0x4ef928[_0x7a07('0x2')]),_0x164f05);}};exports['queuecallerleave']=function(_0x5d24d0){try{if(!_['isNil'](queues[_0x5d24d0[_0x7a07('0x2')]])){utils[_0x7a07('0xf')](util[_0x7a07('0x10')](_0x7a07('0x2f'),_0x5d24d0['uniqueid']),_0x5d24d0);utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x30'),_0x5d24d0[_0x7a07('0x2')],queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x1f')],_0x5d24d0[_0x7a07('0x31')],_0x5d24d0[_0x7a07('0x32')]));queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x33')]=!![];queues[_0x5d24d0['uniqueid']][_0x7a07('0x19')]=utils[_0x7a07('0x16')]();queues[_0x5d24d0['uniqueid']][_0x7a07('0x34')]=utils[_0x7a07('0x35')](queues[_0x5d24d0['uniqueid']][_0x7a07('0x19')],queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x36')]);queues[_0x5d24d0['uniqueid']]['position']=_0x5d24d0[_0x7a07('0x14')];queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x37')]=_0x5d24d0['count'];queues[_0x5d24d0['uniqueid']][_0x7a07('0x31')]=_0x5d24d0[_0x7a07('0x31')];queues[_0x5d24d0[_0x7a07('0x2')]][_0x7a07('0x32')]=_0x5d24d0['connectedlinename'];}}catch(_0x4e113b){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')](_0x7a07('0x2f'),_0x5d24d0[_0x7a07('0x2')]),_0x4e113b);}};exports[_0x7a07('0x38')]=function(_0x27bb4e){try{if(!_[_0x7a07('0x18')](queues[_0x27bb4e[_0x7a07('0x2')]])){utils['debug'](util[_0x7a07('0x10')](_0x7a07('0x39'),_0x27bb4e[_0x7a07('0x2')]),_0x27bb4e);utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x3a'),_0x27bb4e[_0x7a07('0x2')],queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x1f')],_0x27bb4e[_0x7a07('0x3b')],_0x27bb4e[_0x7a07('0x3c')]));queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x26')]=![];queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x26')]=![];queues[_0x27bb4e[_0x7a07('0x2')]]['queuecallerabandonAt']=null;queues[_0x27bb4e[_0x7a07('0x2')]]['queuecallerexit']=![];queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x7')]=null;queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x27')]=null;queues[_0x27bb4e['uniqueid']][_0x7a07('0x3d')]=!![];queues[_0x27bb4e[_0x7a07('0x2')]][_0x7a07('0x6')]=_0x27bb4e[_0x7a07('0x3c')];queues[_0x27bb4e['uniqueid']][_0x7a07('0x3e')]=_0x27bb4e[_0x7a07('0x3b')];}}catch(_0xe05635){utils[_0x7a07('0x2d')](util['format'](_0x7a07('0x39'),_0x27bb4e['uniqueid']),_0xe05635);}};exports[_0x7a07('0x3f')]=function(_0xc3e716){try{if(!_['isNil'](queues[_0xc3e716[_0x7a07('0x2')]])){if(queues[_0xc3e716['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x7a07('0x10')]('[%s][queues][agentcomplete]',_0xc3e716['uniqueid']),_0xc3e716);queues[_0xc3e716['uniqueid']][_0x7a07('0x26')]=![];queues[_0xc3e716['uniqueid']]['queuecallerabandon']=![];queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x2b')]=null;queues[_0xc3e716['uniqueid']][_0x7a07('0x1a')]=![];queues[_0xc3e716[_0x7a07('0x2')]]['queuecallerexitAt']=null;queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x3d')]=!![];queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x3e')]=_0xc3e716[_0x7a07('0x3b')];queues[_0xc3e716['uniqueid']][_0x7a07('0x1b')]=!![];queues[_0xc3e716['uniqueid']][_0x7a07('0x1c')]=utils[_0x7a07('0x16')]();if(_0xc3e716[_0x7a07('0x40')]==_0x7a07('0x41')){if(!queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x41')]){queues[_0xc3e716['uniqueid']][_0x7a07('0x7')]=_0x7a07('0x42');}}else{queues[_0xc3e716['uniqueid']][_0x7a07('0x7')]=_0x7a07('0x43')+_0xc3e716['reason'][_0x7a07('0x28')]();}utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x44'),_0xc3e716[_0x7a07('0x2')],queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x1f')],_0xc3e716[_0x7a07('0x3b')],queues[_0xc3e716[_0x7a07('0x2')]][_0x7a07('0x7')]));writeDB(queues[_0xc3e716[_0x7a07('0x2')]]);}}}catch(_0x51fd0f){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')](_0x7a07('0x45'),_0xc3e716[_0x7a07('0x2')]),_0x51fd0f);}};exports[_0x7a07('0x46')]=function(_0x43efcd){try{if(!_['isNil'](queues[_0x43efcd['transfereeuniqueid']])){utils[_0x7a07('0xf')](util['format'](_0x7a07('0x47'),_0x43efcd[_0x7a07('0x2')]),_0x43efcd);queues[_0x43efcd[_0x7a07('0x48')]][_0x7a07('0x41')]=!![];queues[_0x43efcd[_0x7a07('0x48')]]['transfertype']=_0x7a07('0x49');queues[_0x43efcd[_0x7a07('0x48')]]['transferexten']=_0x43efcd[_0x7a07('0x4a')];queues[_0x43efcd[_0x7a07('0x48')]][_0x7a07('0x4b')]=_0x43efcd['transfereeuniqueid'];queues[_0x43efcd[_0x7a07('0x48')]][_0x7a07('0x7')]=_0x7a07('0x4c');utils[_0x7a07('0x12')](util[_0x7a07('0x10')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x43efcd[_0x7a07('0x2')],queues[_0x43efcd['transfereeuniqueid']][_0x7a07('0x1f')],_0x43efcd[_0x7a07('0x48')],_0x43efcd[_0x7a07('0x4a')]));}}catch(_0x40a36c){utils[_0x7a07('0x2d')](util['format'](_0x7a07('0x47'),_0x43efcd[_0x7a07('0x2')]),_0x40a36c);}};exports['attendedtransfer']=function(_0x1ebf14){try{utils[_0x7a07('0xf')](util['format'](_0x7a07('0x4d'),_0x1ebf14[_0x7a07('0x4e')]),_0x1ebf14);if(_0x1ebf14[_0x7a07('0x4e')]==_0x1ebf14[_0x7a07('0x4f')]){if(!_[_0x7a07('0x18')](queues[_0x1ebf14[_0x7a07('0x50')]])){utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x51'),_0x1ebf14['origtransfereruniqueid'],queues[_0x1ebf14['secondtransfererlinkedid']][_0x7a07('0x1f')],_0x1ebf14[_0x7a07('0x52')]));queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x41')]=!![];queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x53')]=_0x7a07('0x54');queues[_0x1ebf14['secondtransfererlinkedid']][_0x7a07('0x55')]=_0x1ebf14[_0x7a07('0x52')];queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x4b')]=_0x1ebf14[_0x7a07('0x4e')];queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x7a07('0x18')](queues[_0x1ebf14[_0x7a07('0x4f')]])){if(_0x1ebf14[_0x7a07('0x56')]&&queues[_0x1ebf14[_0x7a07('0x56')]]){queues[_0x1ebf14[_0x7a07('0x56')]][_0x7a07('0x57')]=0x1;queues[_0x1ebf14['transfereeuniqueid']]=_[_0x7a07('0x58')](queues[_0x1ebf14[_0x7a07('0x56')]]);queues[_0x1ebf14['transfereeuniqueid']][_0x7a07('0xd')]=_0x1ebf14[_0x7a07('0x59')];queues[_0x1ebf14['transfereeuniqueid']][_0x7a07('0x57')]=0x2;queues[_0x1ebf14['transfereeuniqueid']][_0x7a07('0x5')]=queues[_0x1ebf14[_0x7a07('0x50')]]['calleridnum'];queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x5a')]=queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x5a')];queues[_0x1ebf14[_0x7a07('0x48')]]['queuecallerjoinAt']=utils['now']();queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x19')]=utils[_0x7a07('0x16')]();queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x34')]=0x0;queues[_0x1ebf14['transfereeuniqueid']][_0x7a07('0x5b')]=0x0;utils[_0x7a07('0x12')](util[_0x7a07('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1ebf14[_0x7a07('0x4e')],queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x1f')],queues[_0x1ebf14[_0x7a07('0x48')]]['calleridnum'],queues[_0x1ebf14[_0x7a07('0x48')]][_0x7a07('0x5a')]));}else{utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x5c'),_0x1ebf14['origtransfereruniqueid'],queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x1f')],_0x1ebf14[_0x7a07('0x50')]));queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0xd')]=_0x1ebf14[_0x7a07('0x50')];}}}else if(_0x1ebf14['secondtransfereruniqueid']==_0x1ebf14['secondtransfererlinkedid']){if(!_[_0x7a07('0x18')](queues[_0x1ebf14[_0x7a07('0x4f')]])){utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x5d'),_0x1ebf14[_0x7a07('0x4e')],queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x1f')],_0x1ebf14[_0x7a07('0x5e')],_0x1ebf14['secondtransfererexten']));queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x41')]=!![];queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x53')]=_0x7a07('0x54');queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x55')]=_0x1ebf14[_0x7a07('0x5f')];queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x4b')]=_0x1ebf14['secondtransfereruniqueid'];queues[_0x1ebf14[_0x7a07('0x4f')]]['queuecallerexitreason']=_0x7a07('0x60');}if(!_[_0x7a07('0x18')](queues[_0x1ebf14['secondtransfererlinkedid']])){if(_0x1ebf14[_0x7a07('0x61')]&&queues[_0x1ebf14[_0x7a07('0x61')]]){queues[_0x1ebf14[_0x7a07('0x61')]][_0x7a07('0x57')]=0x1;queues[_0x1ebf14[_0x7a07('0x59')]]=_[_0x7a07('0x58')](queues[_0x1ebf14[_0x7a07('0x61')]]);queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0xd')]=_0x1ebf14[_0x7a07('0x59')];queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0x57')]=0x2;queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0x5')]=queues[_0x1ebf14[_0x7a07('0x4f')]]['calleridnum'];queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0x5a')]=queues[_0x1ebf14[_0x7a07('0x4f')]][_0x7a07('0x5a')];queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0x36')]=utils[_0x7a07('0x16')]();queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0x19')]=utils['now']();queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0x34')]=0x0;queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0x5b')]=0x0;utils['info'](util[_0x7a07('0x10')](_0x7a07('0x62'),_0x1ebf14[_0x7a07('0x4e')],queues[_0x1ebf14[_0x7a07('0x59')]]['name'],queues[_0x1ebf14[_0x7a07('0x59')]][_0x7a07('0xd')],queues[_0x1ebf14['transfertargetuniqueid']][_0x7a07('0x5')],queues[_0x1ebf14[_0x7a07('0x59')]]['calleridname']));}else{utils[_0x7a07('0x12')](util[_0x7a07('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ebf14[_0x7a07('0x4e')],queues[_0x1ebf14[_0x7a07('0x50')]][_0x7a07('0x1f')],_0x1ebf14[_0x7a07('0x4f')]));queues[_0x1ebf14[_0x7a07('0x50')]]['transfereduniqueid']=_0x1ebf14[_0x7a07('0x4f')];}}}}catch(_0x25f126){utils['error'](util[_0x7a07('0x10')](_0x7a07('0x4d'),_0x1ebf14['origtransfereruniqueid']),_0x25f126);}};exports[_0x7a07('0x63')]=function(_0x1a9276){try{if(!_[_0x7a07('0x18')](queues[_0x1a9276[_0x7a07('0x2')]])){utils[_0x7a07('0xf')](util[_0x7a07('0x10')](_0x7a07('0x64'),_0x1a9276['uniqueid']),_0x1a9276);queues[_0x1a9276[_0x7a07('0x2')]][_0x7a07('0x65')]=utils[_0x7a07('0x16')]();utils[_0x7a07('0x12')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1a9276[_0x7a07('0x2')],queues[_0x1a9276[_0x7a07('0x2')]][_0x7a07('0x1f')],queues[_0x1a9276['uniqueid']][_0x7a07('0x65')]));}}catch(_0x5acdbf){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')]('[%s][queues][musiconholdstart]',_0x1a9276[_0x7a07('0x2')]),_0x5acdbf);}};exports[_0x7a07('0x66')]=function(_0x58fbdf){try{if(!_[_0x7a07('0x18')](queues[_0x58fbdf['uniqueid']])){if(!_[_0x7a07('0x18')](queues[_0x58fbdf[_0x7a07('0x2')]][_0x7a07('0x65')])){utils[_0x7a07('0xf')](util['format'](_0x7a07('0x67'),_0x58fbdf[_0x7a07('0x2')]),_0x58fbdf);queues[_0x58fbdf[_0x7a07('0x2')]][_0x7a07('0x5b')]+=utils[_0x7a07('0x35')](utils['now'](),queues[_0x58fbdf[_0x7a07('0x2')]][_0x7a07('0x65')]);utils[_0x7a07('0x12')](util[_0x7a07('0x10')](_0x7a07('0x68'),_0x58fbdf['uniqueid'],queues[_0x58fbdf['uniqueid']][_0x7a07('0x1f')],queues[_0x58fbdf['uniqueid']]['mohtime']));delete queues[_0x58fbdf[_0x7a07('0x2')]][_0x7a07('0x65')];}}}catch(_0x1aa25d){utils[_0x7a07('0x2d')](util[_0x7a07('0x10')](_0x7a07('0x67'),_0x58fbdf[_0x7a07('0x2')]),_0x1aa25d);}}; \ No newline at end of file +var _0x336f=['debug','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','membername','reason','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfer','transfertype','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','uniqueid','assign','now','error','[%s][queues][queuecallerjoin]','hangup'];(function(_0x3cb530,_0x170e8c){var _0x4168ea=function(_0x83990a){while(--_0x83990a){_0x3cb530['push'](_0x3cb530['shift']());}};_0x4168ea(++_0x170e8c);}(_0x336f,0xc3));var _0xf336=function(_0x50d34b,_0x12938d){_0x50d34b=_0x50d34b-0x0;var _0x55290b=_0x336f[_0x50d34b];return _0x55290b;};'use strict';var _=require(_0xf336('0x0'));var util=require(_0xf336('0x1'));var utils=require(_0xf336('0x2'));var queues={};function writeDB(_0x29a9f4){utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x5'),_0x29a9f4['uniqueid'],_0x29a9f4[_0xf336('0x6')],_0x29a9f4[_0xf336('0x7')],_0x29a9f4[_0xf336('0x8')],_0x29a9f4[_0xf336('0x9')],_0x29a9f4[_0xf336('0xa')],_0x29a9f4[_0xf336('0xb')]));if(_0x29a9f4[_0xf336('0x7')]){utils[_0xf336('0xc')](_0x29a9f4[_0xf336('0x7')])[_0xf336('0xd')](function(_0x58b2d3){if(_0x58b2d3){_0x29a9f4[_0xf336('0xe')]=_0x58b2d3['type'];}utils['request'](_0xf336('0xf'),_0x29a9f4);});}else{utils[_0xf336('0x10')]('CreateVoiceQueueReport',_0x29a9f4);}if(_0x29a9f4[_0xf336('0x11')]){delete queues[_0x29a9f4[_0xf336('0x11')]];}else{delete queues[_0x29a9f4['uniqueid']];}}exports[_0xf336('0x12')]=function(_0xe54faa){try{utils['debug'](util[_0xf336('0x4')]('[%s][queues][queuecallerjoin]',_0xe54faa['uniqueid']),_0xe54faa);utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x13'),_0xe54faa['uniqueid'],_0xe54faa[_0xf336('0x7')],_0xe54faa[_0xf336('0x14')]));queues[_0xe54faa[_0xf336('0x15')]]=_[_0xf336('0x16')](_0xe54faa,{'originalposition':_0xe54faa['position'],'queuecallerjoinAt':utils[_0xf336('0x17')](),'mohtime':0x0});}catch(_0x870ac1){utils[_0xf336('0x18')](util['format'](_0xf336('0x19'),_0xe54faa['uniqueid']),_0x870ac1);}};exports[_0xf336('0x1a')]=function(_0x502b2e){try{if(!_['isNil'](queues[_0x502b2e['uniqueid']])){utils[_0xf336('0x1b')](util[_0xf336('0x4')](_0xf336('0x1c'),_0x502b2e[_0xf336('0x15')]),_0x502b2e);if(queues[_0x502b2e[_0xf336('0x15')]]['queuecallerleaveAt']){if(!queues[_0x502b2e[_0xf336('0x15')]]['queuecallerabandon']&&!queues[_0x502b2e[_0xf336('0x15')]][_0xf336('0x1d')]){queues[_0x502b2e[_0xf336('0x15')]][_0xf336('0x1e')]=!![];queues[_0x502b2e[_0xf336('0x15')]][_0xf336('0x1f')]=utils['now']();queues[_0x502b2e[_0xf336('0x15')]][_0xf336('0xb')]=_0xf336('0x20');}utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x21'),_0x502b2e[_0xf336('0x15')],queues[_0x502b2e['uniqueid']][_0xf336('0x22')],queues[_0x502b2e[_0xf336('0x15')]]['queuecallerexitreason']));writeDB(queues[_0x502b2e[_0xf336('0x15')]]);}else if(queues[_0x502b2e['uniqueid']][_0xf336('0x11')]){utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x23'),_0x502b2e[_0xf336('0x15')],queues[_0x502b2e[_0xf336('0x15')]][_0xf336('0x22')],queues[_0x502b2e[_0xf336('0x15')]][_0xf336('0x11')]));queues[queues[_0x502b2e[_0xf336('0x15')]][_0xf336('0x11')]]=queues[_0x502b2e[_0xf336('0x15')]];queues[queues[_0x502b2e[_0xf336('0x15')]][_0xf336('0x11')]][_0xf336('0x24')]=0x2;delete queues[_0x502b2e[_0xf336('0x15')]];}}}catch(_0x35ab92){utils[_0xf336('0x18')](util[_0xf336('0x4')](_0xf336('0x1c'),_0x502b2e[_0xf336('0x15')]),_0x35ab92);}};exports[_0xf336('0x25')]=function(_0x36d592){try{utils[_0xf336('0x1b')](util[_0xf336('0x4')]('[%s][queues][varset]',_0x36d592[_0xf336('0x15')]),_0x36d592);if(!_[_0xf336('0x26')](_0x36d592[_0xf336('0x27')][_0xf336('0x28')])&&_0x36d592[_0xf336('0x29')][_0xf336('0x2a')]()!==_0xf336('0x2b')){if(!_[_0xf336('0x26')](queues[_0x36d592[_0xf336('0x15')]])){queues[_0x36d592['uniqueid']][_0xf336('0x2c')]=![];queues[_0x36d592[_0xf336('0x15')]][_0xf336('0x2d')]=null;queues[_0x36d592['uniqueid']]['queuecallerexit']=!![];queues[_0x36d592[_0xf336('0x15')]]['queuecallerexitAt']=utils[_0xf336('0x17')]();queues[_0x36d592[_0xf336('0x15')]][_0xf336('0xb')]=_0x36d592[_0xf336('0x29')][_0xf336('0x2a')]();utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x2e'),_0x36d592['uniqueid'],queues[_0x36d592[_0xf336('0x15')]][_0xf336('0x22')],_0x36d592['value'],queues[_0x36d592[_0xf336('0x15')]][_0xf336('0xb')]));writeDB(queues[_0x36d592[_0xf336('0x15')]]);}}else if(!_['isNil'](_0x36d592['variable'][_0xf336('0x2f')])){if(!_['isNil'](queues[_0x36d592[_0xf336('0x15')]])&&!queues[_0x36d592[_0xf336('0x15')]][_0xf336('0x2c')]){queues[_0x36d592[_0xf336('0x15')]][_0xf336('0x2c')]=![];queues[_0x36d592[_0xf336('0x15')]][_0xf336('0x2d')]=null;queues[_0x36d592[_0xf336('0x15')]][_0xf336('0x1d')]=!![];queues[_0x36d592[_0xf336('0x15')]][_0xf336('0x30')]=utils[_0xf336('0x17')]();queues[_0x36d592['uniqueid']][_0xf336('0xb')]=_0xf336('0x31');utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x32'),_0x36d592[_0xf336('0x15')],queues[_0x36d592[_0xf336('0x15')]]['name'],_0x36d592[_0xf336('0x29')],queues[_0x36d592[_0xf336('0x15')]][_0xf336('0xb')]));}}}catch(_0x56c24c){utils['error'](util['format'](_0xf336('0x33'),_0x36d592[_0xf336('0x15')]),_0x56c24c);}};exports[_0xf336('0x2c')]=function(_0x4c8a5a){try{if(!_[_0xf336('0x26')](queues[_0x4c8a5a[_0xf336('0x15')]])){utils[_0xf336('0x1b')](util[_0xf336('0x4')](_0xf336('0x34'),_0x4c8a5a['uniqueid']),_0x4c8a5a);queues[_0x4c8a5a[_0xf336('0x15')]][_0xf336('0x1d')]=![];queues[_0x4c8a5a[_0xf336('0x15')]][_0xf336('0x30')]=null;queues[_0x4c8a5a['uniqueid']][_0xf336('0x2c')]=!![];queues[_0x4c8a5a[_0xf336('0x15')]]['queuecallerabandonAt']=utils[_0xf336('0x17')]();queues[_0x4c8a5a[_0xf336('0x15')]][_0xf336('0xb')]=_0xf336('0x35');utils[_0xf336('0x3')](util['format'](_0xf336('0x36'),_0x4c8a5a[_0xf336('0x15')],queues[_0x4c8a5a['uniqueid']][_0xf336('0x22')],queues[_0x4c8a5a[_0xf336('0x15')]]['queuecallerexitreason']));}}catch(_0x3751f6){utils[_0xf336('0x18')](util['format'](_0xf336('0x34'),_0x4c8a5a['uniqueid']),_0x3751f6);}};exports[_0xf336('0x37')]=function(_0x505bc7){try{if(!_['isNil'](queues[_0x505bc7[_0xf336('0x15')]])){utils[_0xf336('0x1b')](util[_0xf336('0x4')](_0xf336('0x38'),_0x505bc7[_0xf336('0x15')]),_0x505bc7);utils['info'](util[_0xf336('0x4')](_0xf336('0x39'),_0x505bc7[_0xf336('0x15')],queues[_0x505bc7['uniqueid']]['name'],_0x505bc7[_0xf336('0x3a')],_0x505bc7[_0xf336('0x3b')]));queues[_0x505bc7[_0xf336('0x15')]][_0xf336('0x37')]=!![];queues[_0x505bc7[_0xf336('0x15')]]['queuecallerleaveAt']=utils[_0xf336('0x17')]();queues[_0x505bc7[_0xf336('0x15')]][_0xf336('0x3c')]=utils[_0xf336('0x3d')](queues[_0x505bc7[_0xf336('0x15')]][_0xf336('0x3e')],queues[_0x505bc7[_0xf336('0x15')]][_0xf336('0x3f')]);queues[_0x505bc7[_0xf336('0x15')]][_0xf336('0x14')]=_0x505bc7['position'];queues[_0x505bc7['uniqueid']][_0xf336('0x40')]=_0x505bc7['count'];queues[_0x505bc7[_0xf336('0x15')]][_0xf336('0x3a')]=_0x505bc7[_0xf336('0x3a')];queues[_0x505bc7[_0xf336('0x15')]][_0xf336('0x3b')]=_0x505bc7['connectedlinename'];}}catch(_0x219a21){utils[_0xf336('0x18')](util[_0xf336('0x4')](_0xf336('0x38'),_0x505bc7[_0xf336('0x15')]),_0x219a21);}};exports['agentconnect']=function(_0x42b711){try{if(!_['isNil'](queues[_0x42b711[_0xf336('0x15')]])){utils['debug'](util['format'](_0xf336('0x41'),_0x42b711[_0xf336('0x15')]),_0x42b711);utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x42'),_0x42b711[_0xf336('0x15')],queues[_0x42b711['uniqueid']][_0xf336('0x22')],_0x42b711['membername'],_0x42b711[_0xf336('0x43')]));queues[_0x42b711['uniqueid']][_0xf336('0x2c')]=![];queues[_0x42b711[_0xf336('0x15')]][_0xf336('0x2c')]=![];queues[_0x42b711[_0xf336('0x15')]][_0xf336('0x2d')]=null;queues[_0x42b711[_0xf336('0x15')]][_0xf336('0x1d')]=![];queues[_0x42b711[_0xf336('0x15')]][_0xf336('0xb')]=null;queues[_0x42b711[_0xf336('0x15')]][_0xf336('0x30')]=null;queues[_0x42b711[_0xf336('0x15')]]['assigned']=!![];queues[_0x42b711[_0xf336('0x15')]]['accountcode']=_0x42b711[_0xf336('0x43')];queues[_0x42b711[_0xf336('0x15')]][_0xf336('0x8')]=_0x42b711['membername'];}}catch(_0x1fd0b4){utils[_0xf336('0x18')](util[_0xf336('0x4')]('[%s][queues][agentconnect]',_0x42b711[_0xf336('0x15')]),_0x1fd0b4);}};exports[_0xf336('0x44')]=function(_0x29c8ca){try{if(!_[_0xf336('0x26')](queues[_0x29c8ca[_0xf336('0x15')]])){if(queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x3e')]){utils[_0xf336('0x1b')](util[_0xf336('0x4')](_0xf336('0x45'),_0x29c8ca[_0xf336('0x15')]),_0x29c8ca);queues[_0x29c8ca['uniqueid']]['queuecallerabandon']=![];queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x2c')]=![];queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x2d')]=null;queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x1d')]=![];queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x30')]=null;queues[_0x29c8ca['uniqueid']][_0xf336('0x46')]=!![];queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x8')]=_0x29c8ca[_0xf336('0x47')];queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x1e')]=!![];queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x1f')]=utils['now']();if(_0x29c8ca[_0xf336('0x48')]=='transfer'){if(!queues[_0x29c8ca[_0xf336('0x15')]]['transfer']){queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0xb')]=_0xf336('0x49');}}else{queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0xb')]=_0xf336('0x4a')+_0x29c8ca[_0xf336('0x48')][_0xf336('0x2a')]();}utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x4b'),_0x29c8ca[_0xf336('0x15')],queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0x22')],_0x29c8ca[_0xf336('0x47')],queues[_0x29c8ca[_0xf336('0x15')]][_0xf336('0xb')]));writeDB(queues[_0x29c8ca[_0xf336('0x15')]]);}}}catch(_0x4214aa){utils[_0xf336('0x18')](util[_0xf336('0x4')](_0xf336('0x45'),_0x29c8ca[_0xf336('0x15')]),_0x4214aa);}};exports[_0xf336('0x4c')]=function(_0x429579){try{if(!_[_0xf336('0x26')](queues[_0x429579[_0xf336('0x4d')]])){utils[_0xf336('0x1b')](util[_0xf336('0x4')](_0xf336('0x4e'),_0x429579[_0xf336('0x15')]),_0x429579);queues[_0x429579[_0xf336('0x4d')]][_0xf336('0x4f')]=!![];queues[_0x429579['transfereeuniqueid']][_0xf336('0x50')]='BLIND';queues[_0x429579[_0xf336('0x4d')]][_0xf336('0x51')]=_0x429579[_0xf336('0x52')];queues[_0x429579[_0xf336('0x4d')]]['transferuniqueid']=_0x429579[_0xf336('0x4d')];queues[_0x429579[_0xf336('0x4d')]][_0xf336('0xb')]=_0xf336('0x53');utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x54'),_0x429579[_0xf336('0x15')],queues[_0x429579[_0xf336('0x4d')]][_0xf336('0x22')],_0x429579[_0xf336('0x4d')],_0x429579[_0xf336('0x52')]));}}catch(_0x489416){utils['error'](util[_0xf336('0x4')]('[%s][queues][blindtransfer]',_0x429579[_0xf336('0x15')]),_0x489416);}};exports['attendedtransfer']=function(_0x4b3a4d){try{utils[_0xf336('0x1b')](util[_0xf336('0x4')](_0xf336('0x55'),_0x4b3a4d[_0xf336('0x56')]),_0x4b3a4d);if(_0x4b3a4d[_0xf336('0x56')]==_0x4b3a4d[_0xf336('0x57')]){if(!_[_0xf336('0x26')](queues[_0x4b3a4d[_0xf336('0x58')]])){utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x59'),_0x4b3a4d[_0xf336('0x56')],queues[_0x4b3a4d[_0xf336('0x58')]][_0xf336('0x22')],_0x4b3a4d['origtransfererexten']));queues[_0x4b3a4d[_0xf336('0x58')]][_0xf336('0x4f')]=!![];queues[_0x4b3a4d[_0xf336('0x58')]]['transfertype']=_0xf336('0x5a');queues[_0x4b3a4d[_0xf336('0x58')]][_0xf336('0x51')]=_0x4b3a4d[_0xf336('0x5b')];queues[_0x4b3a4d['secondtransfererlinkedid']][_0xf336('0x5c')]=_0x4b3a4d[_0xf336('0x56')];queues[_0x4b3a4d[_0xf336('0x58')]][_0xf336('0xb')]=_0xf336('0x5d');}if(!_[_0xf336('0x26')](queues[_0x4b3a4d[_0xf336('0x57')]])){if(_0x4b3a4d[_0xf336('0x5e')]&&queues[_0x4b3a4d['transfereelinkedid']]){queues[_0x4b3a4d[_0xf336('0x5e')]][_0xf336('0x24')]=0x1;queues[_0x4b3a4d[_0xf336('0x4d')]]=_[_0xf336('0x5f')](queues[_0x4b3a4d[_0xf336('0x5e')]]);queues[_0x4b3a4d[_0xf336('0x4d')]]['transfereduniqueid']=_0x4b3a4d[_0xf336('0x60')];queues[_0x4b3a4d[_0xf336('0x4d')]]['queuecallerenterreason']=0x2;queues[_0x4b3a4d[_0xf336('0x4d')]][_0xf336('0x9')]=queues[_0x4b3a4d[_0xf336('0x58')]]['calleridnum'];queues[_0x4b3a4d[_0xf336('0x4d')]][_0xf336('0x61')]=queues[_0x4b3a4d['secondtransfererlinkedid']][_0xf336('0x61')];queues[_0x4b3a4d[_0xf336('0x4d')]]['queuecallerjoinAt']=utils[_0xf336('0x17')]();queues[_0x4b3a4d[_0xf336('0x4d')]]['queuecallerleaveAt']=utils[_0xf336('0x17')]();queues[_0x4b3a4d[_0xf336('0x4d')]][_0xf336('0x3c')]=0x0;queues[_0x4b3a4d[_0xf336('0x4d')]][_0xf336('0x62')]=0x0;utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x63'),_0x4b3a4d['origtransfereruniqueid'],queues[_0x4b3a4d[_0xf336('0x4d')]]['name'],queues[_0x4b3a4d[_0xf336('0x4d')]][_0xf336('0x9')],queues[_0x4b3a4d['transfereeuniqueid']]['calleridname']));}else{utils['info'](util[_0xf336('0x4')](_0xf336('0x64'),_0x4b3a4d[_0xf336('0x56')],queues[_0x4b3a4d[_0xf336('0x57')]]['name'],_0x4b3a4d[_0xf336('0x58')]));queues[_0x4b3a4d[_0xf336('0x57')]][_0xf336('0x11')]=_0x4b3a4d[_0xf336('0x58')];}}}else if(_0x4b3a4d[_0xf336('0x65')]==_0x4b3a4d['secondtransfererlinkedid']){if(!_[_0xf336('0x26')](queues[_0x4b3a4d['origtransfererlinkedid']])){utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x66'),_0x4b3a4d[_0xf336('0x56')],queues[_0x4b3a4d[_0xf336('0x57')]]['name'],_0x4b3a4d[_0xf336('0x65')],_0x4b3a4d['secondtransfererexten']));queues[_0x4b3a4d[_0xf336('0x57')]]['transfer']=!![];queues[_0x4b3a4d[_0xf336('0x57')]][_0xf336('0x50')]='ATTENDED';queues[_0x4b3a4d[_0xf336('0x57')]][_0xf336('0x51')]=_0x4b3a4d[_0xf336('0x67')];queues[_0x4b3a4d[_0xf336('0x57')]][_0xf336('0x5c')]=_0x4b3a4d['secondtransfereruniqueid'];queues[_0x4b3a4d[_0xf336('0x57')]][_0xf336('0xb')]=_0xf336('0x5d');}if(!_[_0xf336('0x26')](queues[_0x4b3a4d['secondtransfererlinkedid']])){if(_0x4b3a4d[_0xf336('0x68')]&&queues[_0x4b3a4d['transfertargetlinkedid']]){queues[_0x4b3a4d[_0xf336('0x68')]][_0xf336('0x24')]=0x1;queues[_0x4b3a4d['transfertargetuniqueid']]=_[_0xf336('0x5f')](queues[_0x4b3a4d[_0xf336('0x68')]]);queues[_0x4b3a4d[_0xf336('0x60')]][_0xf336('0x11')]=_0x4b3a4d[_0xf336('0x60')];queues[_0x4b3a4d[_0xf336('0x60')]][_0xf336('0x24')]=0x2;queues[_0x4b3a4d[_0xf336('0x60')]][_0xf336('0x9')]=queues[_0x4b3a4d['origtransfererlinkedid']][_0xf336('0x9')];queues[_0x4b3a4d[_0xf336('0x60')]][_0xf336('0x61')]=queues[_0x4b3a4d[_0xf336('0x57')]][_0xf336('0x61')];queues[_0x4b3a4d[_0xf336('0x60')]][_0xf336('0x3f')]=utils['now']();queues[_0x4b3a4d[_0xf336('0x60')]][_0xf336('0x3e')]=utils['now']();queues[_0x4b3a4d[_0xf336('0x60')]]['holdtime']=0x0;queues[_0x4b3a4d[_0xf336('0x60')]][_0xf336('0x62')]=0x0;utils[_0xf336('0x3')](util['format'](_0xf336('0x69'),_0x4b3a4d['origtransfereruniqueid'],queues[_0x4b3a4d['transfertargetuniqueid']][_0xf336('0x22')],queues[_0x4b3a4d['transfertargetuniqueid']][_0xf336('0x11')],queues[_0x4b3a4d[_0xf336('0x60')]]['calleridnum'],queues[_0x4b3a4d['transfertargetuniqueid']][_0xf336('0x61')]));}else{utils[_0xf336('0x3')](util[_0xf336('0x4')](_0xf336('0x64'),_0x4b3a4d[_0xf336('0x56')],queues[_0x4b3a4d[_0xf336('0x58')]][_0xf336('0x22')],_0x4b3a4d['origtransfererlinkedid']));queues[_0x4b3a4d[_0xf336('0x58')]][_0xf336('0x11')]=_0x4b3a4d[_0xf336('0x57')];}}}}catch(_0x36c2b6){utils[_0xf336('0x18')](util['format'](_0xf336('0x55'),_0x4b3a4d[_0xf336('0x56')]),_0x36c2b6);}};exports[_0xf336('0x6a')]=function(_0x301b50){try{if(!_[_0xf336('0x26')](queues[_0x301b50[_0xf336('0x15')]])){utils[_0xf336('0x1b')](util[_0xf336('0x4')](_0xf336('0x6b'),_0x301b50[_0xf336('0x15')]),_0x301b50);queues[_0x301b50[_0xf336('0x15')]][_0xf336('0x6c')]=utils['now']();utils[_0xf336('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x301b50[_0xf336('0x15')],queues[_0x301b50[_0xf336('0x15')]]['name'],queues[_0x301b50[_0xf336('0x15')]][_0xf336('0x6c')]));}}catch(_0x26c2e2){utils['error'](util[_0xf336('0x4')]('[%s][queues][musiconholdstart]',_0x301b50[_0xf336('0x15')]),_0x26c2e2);}};exports[_0xf336('0x6d')]=function(_0x3ca5d4){try{if(!_[_0xf336('0x26')](queues[_0x3ca5d4[_0xf336('0x15')]])){if(!_[_0xf336('0x26')](queues[_0x3ca5d4[_0xf336('0x15')]][_0xf336('0x6c')])){utils[_0xf336('0x1b')](util[_0xf336('0x4')](_0xf336('0x6e'),_0x3ca5d4['uniqueid']),_0x3ca5d4);queues[_0x3ca5d4['uniqueid']][_0xf336('0x62')]+=utils[_0xf336('0x3d')](utils[_0xf336('0x17')](),queues[_0x3ca5d4[_0xf336('0x15')]][_0xf336('0x6c')]);utils['info'](util[_0xf336('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3ca5d4[_0xf336('0x15')],queues[_0x3ca5d4['uniqueid']]['name'],queues[_0x3ca5d4[_0xf336('0x15')]]['mohtime']));delete queues[_0x3ca5d4[_0xf336('0x15')]][_0xf336('0x6c')];}}}catch(_0x1e2fb7){utils[_0xf336('0x18')](util[_0xf336('0x4')](_0xf336('0x6e'),_0x3ca5d4[_0xf336('0x15')]),_0x1e2fb7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f39f81a..ab759ee 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 _0x601e=['split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','newchannel','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith'];(function(_0xb32de3,_0x25ca42){var _0xf3f5ea=function(_0x4ba88d){while(--_0x4ba88d){_0xb32de3['push'](_0xb32de3['shift']());}};_0xf3f5ea(++_0x25ca42);}(_0x601e,0x10b));var _0xe601=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x601e[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xe601('0x0'));var util=require(_0xe601('0x1'));var utils=require(_0xe601('0x2'));var recordings={};function writeDB(_0x2e9397){utils['info'](util[_0xe601('0x3')](_0xe601('0x4'),_0x2e9397[_0xe601('0x5')]));if(_0x2e9397[_0xe601('0x6')]){utils[_0xe601('0x7')](_0x2e9397[_0xe601('0x6')])[_0xe601('0x8')](function(_0x3a2f2c){if(_0x3a2f2c){_0x2e9397[_0xe601('0x9')]=_0x3a2f2c['name'];_0x2e9397[_0xe601('0xa')]=_0x3a2f2c['id'];}utils[_0xe601('0xb')]('CreateVoiceRecording',_0x2e9397);});}else{utils[_0xe601('0xb')]('CreateVoiceRecording',_0x2e9397);}}exports[_0xe601('0xc')]=function(_0x3ca857){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x3ca857['uniqueid']),_0x3ca857);if(_0x3ca857[_0xe601('0x5')]==_0x3ca857[_0xe601('0xd')]){utils[_0xe601('0xe')](util[_0xe601('0x3')](_0xe601('0xf'),_0x3ca857[_0xe601('0x5')],_0x3ca857[_0xe601('0x10')],_0x3ca857[_0xe601('0x11')]));recordings[_0x3ca857['uniqueid']]={'uniqueid':_0x3ca857['uniqueid'],'accountcode':_0x3ca857[_0xe601('0x6')],'exten':_0x3ca857[_0xe601('0x11')],'context':_0x3ca857[_0xe601('0x10')],'channel':_0x3ca857[_0xe601('0x12')],'monitors':[]};}}catch(_0x47967f){utils[_0xe601('0x13')](util[_0xe601('0x3')]('[%s][recordings][newchannel]',_0x3ca857[_0xe601('0x5')]),_0x47967f);}};exports['newstate']=function(_0x2a9d3f){try{utils['debug'](util[_0xe601('0x3')]('[%s][recordings][newstate]',_0x2a9d3f[_0xe601('0x5')]),_0x2a9d3f);if(!_[_0xe601('0x14')](recordings[_0x2a9d3f[_0xe601('0x5')]])&&_0x2a9d3f[_0xe601('0x15')]==0x6){utils[_0xe601('0xe')](util[_0xe601('0x3')](_0xe601('0x16'),_0x2a9d3f[_0xe601('0x5')],_0x2a9d3f[_0xe601('0x10')],_0x2a9d3f['channel']));}else if(!_[_0xe601('0x14')](recordings[_0x2a9d3f[_0xe601('0xd')]])&&_0x2a9d3f['channelstate']==0x6&&_0x2a9d3f[_0xe601('0x10')]!=_0xe601('0x17')){utils['info'](util[_0xe601('0x3')](_0xe601('0x18'),_0x2a9d3f['uniqueid'],_0x2a9d3f['linkedid'],_0x2a9d3f[_0xe601('0x10')],_0x2a9d3f[_0xe601('0x12')]));recordings[_0x2a9d3f[_0xe601('0xd')]][_0xe601('0x6')]=_0x2a9d3f[_0xe601('0x6')];}}catch(_0xcfd4ea){utils[_0xe601('0x13')](util['format'](_0xe601('0x19'),_0x2a9d3f[_0xe601('0x5')]),_0xcfd4ea);}};exports[_0xe601('0x1a')]=function(_0x3883c7){try{if(!_[_0xe601('0x14')](_0x3883c7[_0xe601('0x1b')])&&!_[_0xe601('0x14')](_0x3883c7[_0xe601('0x1b')][_0xe601('0x1c')])){utils[_0xe601('0x1d')](util[_0xe601('0x3')](_0xe601('0x1e'),_0x3883c7[_0xe601('0x5')]),_0x3883c7);utils[_0xe601('0xe')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3883c7['uniqueid'],_0x3883c7[_0xe601('0x1b')],_0x3883c7['value']));if(_[_0xe601('0x1f')](_0x3883c7[_0xe601('0x20')],_0xe601('0x21'))){_0x3883c7[_0xe601('0x20')]=_0x3883c7[_0xe601('0x20')][_0xe601('0x22')]('.wav49',_0xe601('0x23'));}if(recordings[_0x3883c7['linkedid']]){var _0x357456=_[_0xe601('0x24')](recordings[_0x3883c7[_0xe601('0xd')]]['monitors'],{'value':_0x3883c7['value']});if(_['isNil'](_0x357456)){recordings[_0x3883c7[_0xe601('0xd')]][_0xe601('0x25')][_0xe601('0x26')]({'value':_0x3883c7[_0xe601('0x20')]});}}}}catch(_0x12df50){utils['error'](util[_0xe601('0x3')](_0xe601('0x1e'),_0x3883c7['uniqueid']),_0x12df50);}};exports[_0xe601('0x27')]=function(_0x5a2af1){try{if(!_[_0xe601('0x14')](recordings[_0x5a2af1[_0xe601('0x5')]])){utils['debug'](util[_0xe601('0x3')]('[%s][recordings][hangup]',_0x5a2af1['uniqueid']),_0x5a2af1);utils[_0xe601('0xe')](util[_0xe601('0x3')](_0xe601('0x28'),_0x5a2af1['uniqueid'],_0x5a2af1['calleridnum'],_0x5a2af1['calleridname'],_0x5a2af1[_0xe601('0x29')]));recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2a')]=_0x5a2af1[_0xe601('0x2a')];recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2b')]=_0x5a2af1[_0xe601('0x2b')];recordings[_0x5a2af1['uniqueid']][_0xe601('0x2c')]=_0x5a2af1[_0xe601('0x2c')];recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2d')]=_0x5a2af1['connectedlinename'];if(recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2e')]==_0xe601('0x2f')&&recordings[_0x5a2af1[_0xe601('0x5')]]['accountcode']){recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2c')]=recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x6')];recordings[_0x5a2af1[_0xe601('0x5')]][_0xe601('0x2d')]='';}recordings[_0x5a2af1[_0xe601('0x5')]]['monitors'][_0xe601('0x30')](function(_0x542a4e){var _0x2eacb5=_[_0xe601('0x31')](recordings[_0x5a2af1['uniqueid']]);_0x2eacb5[_0xe601('0x20')]=_0x542a4e[_0xe601('0x20')];writeDB(_0x2eacb5);});delete recordings[_0x5a2af1[_0xe601('0x5')]];}}catch(_0x4e26fb){utils[_0xe601('0x13')](util[_0xe601('0x3')](_0xe601('0x32'),_0x5a2af1[_0xe601('0x5')]),_0x4e26fb);}};exports[_0xe601('0x33')]=function(_0x2ae853){try{if(!_[_0xe601('0x14')](recordings[_0x2ae853['uniqueid']])){utils[_0xe601('0x1d')](util[_0xe601('0x3')]('[%s][recordings][newexten]',_0x2ae853['uniqueid']),_0x2ae853);utils[_0xe601('0xe')](util['format'](_0xe601('0x34'),_0x2ae853[_0xe601('0x5')],_0x2ae853[_0xe601('0x35')],_0x2ae853[_0xe601('0x36')]));if(_0x2ae853['application'][_0xe601('0x37')]()==_0xe601('0x38')&&_[_0xe601('0x39')](_0x2ae853['appdata']['toLowerCase'](),'cdr')){var _0x2945be=_0x2ae853[_0xe601('0x36')][_0xe601('0x3a')]('=');var _0x2c6bfb=_0x2945be[0x0]['substring'](_0x2945be[0x0][_0xe601('0x3b')]('(')+0x1,_0x2945be[0x0][_0xe601('0x3b')](')'));var _0x322681=_0x2945be[0x1];recordings[_0x2ae853[_0xe601('0x5')]][_0x2c6bfb]=_0x322681;}}}catch(_0x2e2d26){utils['error'](util['format'](_0xe601('0x3c'),_0x2ae853[_0xe601('0x5')]),_0x2e2d26);}};exports[_0xe601('0x3d')]=function(_0x335025){try{if(!_[_0xe601('0x14')](recordings[_0x335025['uniqueid']])){utils[_0xe601('0x1d')](util[_0xe601('0x3')](_0xe601('0x3e'),_0x335025[_0xe601('0x5')]),_0x335025);utils[_0xe601('0xe')](util[_0xe601('0x3')](_0xe601('0x3f'),_0x335025[_0xe601('0x5')],_0x335025[_0xe601('0x40')]));recordings[_0x335025['uniqueid']][_0xe601('0x40')]=_0x335025[_0xe601('0x40')];}}catch(_0x1c7d51){utils[_0xe601('0x13')](util[_0xe601('0x3')](_0xe601('0x3e'),_0x335025[_0xe601('0x5')]),_0x1c7d51);}}; \ No newline at end of file +var _0x3abd=['context','channel','error','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','accountcode','[%s][recordings][newstate]','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','hangup','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','monitors','forEach','newexten','[%s][recordings][newexten]','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten'];(function(_0x304655,_0x15b109){var _0x2fa58a=function(_0x7d144){while(--_0x7d144){_0x304655['push'](_0x304655['shift']());}};_0x2fa58a(++_0x15b109);}(_0x3abd,0x156));var _0xd3ab=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x3abd[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0xd3ab('0x0'));var util=require(_0xd3ab('0x1'));var utils=require(_0xd3ab('0x2'));var recordings={};function writeDB(_0x15b5fa){utils[_0xd3ab('0x3')](util[_0xd3ab('0x4')](_0xd3ab('0x5'),_0x15b5fa[_0xd3ab('0x6')]));if(_0x15b5fa['accountcode']){utils['getUserByInternal'](_0x15b5fa['accountcode'])[_0xd3ab('0x7')](function(_0x92dad9){if(_0x92dad9){_0x15b5fa[_0xd3ab('0x8')]=_0x92dad9[_0xd3ab('0x9')];_0x15b5fa[_0xd3ab('0xa')]=_0x92dad9['id'];}utils['request'](_0xd3ab('0xb'),_0x15b5fa);});}else{utils[_0xd3ab('0xc')](_0xd3ab('0xb'),_0x15b5fa);}}exports[_0xd3ab('0xd')]=function(_0x5dd506){try{utils[_0xd3ab('0xe')](util[_0xd3ab('0x4')]('[%s][recordings][newchannel]',_0x5dd506['uniqueid']),_0x5dd506);if(_0x5dd506[_0xd3ab('0x6')]==_0x5dd506[_0xd3ab('0xf')]){utils[_0xd3ab('0x3')](util[_0xd3ab('0x4')](_0xd3ab('0x10'),_0x5dd506[_0xd3ab('0x6')],_0x5dd506['context'],_0x5dd506[_0xd3ab('0x11')]));recordings[_0x5dd506['uniqueid']]={'uniqueid':_0x5dd506[_0xd3ab('0x6')],'accountcode':_0x5dd506['accountcode'],'exten':_0x5dd506[_0xd3ab('0x11')],'context':_0x5dd506[_0xd3ab('0x12')],'channel':_0x5dd506[_0xd3ab('0x13')],'monitors':[]};}}catch(_0x56c831){utils[_0xd3ab('0x14')](util[_0xd3ab('0x4')](_0xd3ab('0x15'),_0x5dd506['uniqueid']),_0x56c831);}};exports[_0xd3ab('0x16')]=function(_0x2a46e9){try{utils[_0xd3ab('0xe')](util[_0xd3ab('0x4')]('[%s][recordings][newstate]',_0x2a46e9[_0xd3ab('0x6')]),_0x2a46e9);if(!_[_0xd3ab('0x17')](recordings[_0x2a46e9[_0xd3ab('0x6')]])&&_0x2a46e9[_0xd3ab('0x18')]==0x6){utils[_0xd3ab('0x3')](util[_0xd3ab('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2a46e9['uniqueid'],_0x2a46e9[_0xd3ab('0x12')],_0x2a46e9['channel']));}else if(!_[_0xd3ab('0x17')](recordings[_0x2a46e9['linkedid']])&&_0x2a46e9[_0xd3ab('0x18')]==0x6&&_0x2a46e9['context']!='transfer'){utils['info'](util['format'](_0xd3ab('0x19'),_0x2a46e9[_0xd3ab('0x6')],_0x2a46e9[_0xd3ab('0xf')],_0x2a46e9[_0xd3ab('0x12')],_0x2a46e9[_0xd3ab('0x13')]));recordings[_0x2a46e9[_0xd3ab('0xf')]][_0xd3ab('0x1a')]=_0x2a46e9[_0xd3ab('0x1a')];}}catch(_0x43ad5a){utils['error'](util['format'](_0xd3ab('0x1b'),_0x2a46e9[_0xd3ab('0x6')]),_0x43ad5a);}};exports['varset']=function(_0x1c53ad){try{if(!_['isNil'](_0x1c53ad[_0xd3ab('0x1c')])&&!_[_0xd3ab('0x17')](_0x1c53ad['variable']['mixmonitor_filename'])){utils['debug'](util['format'](_0xd3ab('0x1d'),_0x1c53ad[_0xd3ab('0x6')]),_0x1c53ad);utils['info'](util[_0xd3ab('0x4')](_0xd3ab('0x1e'),_0x1c53ad['uniqueid'],_0x1c53ad[_0xd3ab('0x1c')],_0x1c53ad[_0xd3ab('0x1f')]));if(_[_0xd3ab('0x20')](_0x1c53ad[_0xd3ab('0x1f')],_0xd3ab('0x21'))){_0x1c53ad[_0xd3ab('0x1f')]=_0x1c53ad['value']['replace'](_0xd3ab('0x21'),_0xd3ab('0x22'));}if(recordings[_0x1c53ad[_0xd3ab('0xf')]]){var _0x3aedc0=_[_0xd3ab('0x23')](recordings[_0x1c53ad[_0xd3ab('0xf')]]['monitors'],{'value':_0x1c53ad[_0xd3ab('0x1f')]});if(_[_0xd3ab('0x17')](_0x3aedc0)){recordings[_0x1c53ad[_0xd3ab('0xf')]]['monitors']['push']({'value':_0x1c53ad['value']});}}}}catch(_0x5ebff6){utils[_0xd3ab('0x14')](util[_0xd3ab('0x4')](_0xd3ab('0x1d'),_0x1c53ad['uniqueid']),_0x5ebff6);}};exports[_0xd3ab('0x24')]=function(_0x5ca86c){try{if(!_['isNil'](recordings[_0x5ca86c['uniqueid']])){utils[_0xd3ab('0xe')](util[_0xd3ab('0x4')](_0xd3ab('0x25'),_0x5ca86c[_0xd3ab('0x6')]),_0x5ca86c);utils[_0xd3ab('0x3')](util[_0xd3ab('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5ca86c['uniqueid'],_0x5ca86c[_0xd3ab('0x26')],_0x5ca86c['calleridname'],_0x5ca86c[_0xd3ab('0x27')]));recordings[_0x5ca86c[_0xd3ab('0x6')]][_0xd3ab('0x26')]=_0x5ca86c['calleridnum'];recordings[_0x5ca86c[_0xd3ab('0x6')]][_0xd3ab('0x28')]=_0x5ca86c['calleridname'];recordings[_0x5ca86c[_0xd3ab('0x6')]]['connectedlinenum']=_0x5ca86c[_0xd3ab('0x29')];recordings[_0x5ca86c['uniqueid']][_0xd3ab('0x2a')]=_0x5ca86c[_0xd3ab('0x2a')];if(recordings[_0x5ca86c['uniqueid']][_0xd3ab('0x2b')]=='outbound'&&recordings[_0x5ca86c[_0xd3ab('0x6')]][_0xd3ab('0x1a')]){recordings[_0x5ca86c[_0xd3ab('0x6')]][_0xd3ab('0x29')]=recordings[_0x5ca86c[_0xd3ab('0x6')]]['accountcode'];recordings[_0x5ca86c[_0xd3ab('0x6')]][_0xd3ab('0x2a')]='';}recordings[_0x5ca86c['uniqueid']][_0xd3ab('0x2c')][_0xd3ab('0x2d')](function(_0x40f147){var _0x118678=_['clone'](recordings[_0x5ca86c['uniqueid']]);_0x118678[_0xd3ab('0x1f')]=_0x40f147[_0xd3ab('0x1f')];writeDB(_0x118678);});delete recordings[_0x5ca86c['uniqueid']];}}catch(_0x2b951a){utils[_0xd3ab('0x14')](util[_0xd3ab('0x4')](_0xd3ab('0x25'),_0x5ca86c['uniqueid']),_0x2b951a);}};exports[_0xd3ab('0x2e')]=function(_0x2fd68c){try{if(!_['isNil'](recordings[_0x2fd68c[_0xd3ab('0x6')]])){utils[_0xd3ab('0xe')](util[_0xd3ab('0x4')](_0xd3ab('0x2f'),_0x2fd68c[_0xd3ab('0x6')]),_0x2fd68c);utils[_0xd3ab('0x3')](util[_0xd3ab('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x2fd68c['uniqueid'],_0x2fd68c['application'],_0x2fd68c[_0xd3ab('0x30')]));if(_0x2fd68c[_0xd3ab('0x31')][_0xd3ab('0x32')]()==_0xd3ab('0x33')&&_['startsWith'](_0x2fd68c[_0xd3ab('0x30')][_0xd3ab('0x32')](),_0xd3ab('0x34'))){var _0xfd42ac=_0x2fd68c[_0xd3ab('0x30')][_0xd3ab('0x35')]('=');var _0x4da949=_0xfd42ac[0x0][_0xd3ab('0x36')](_0xfd42ac[0x0][_0xd3ab('0x37')]('(')+0x1,_0xfd42ac[0x0]['lastIndexOf'](')'));var _0x51e5be=_0xfd42ac[0x1];recordings[_0x2fd68c[_0xd3ab('0x6')]][_0x4da949]=_0x51e5be;}}}catch(_0x1fee49){utils['error'](util['format'](_0xd3ab('0x2f'),_0x2fd68c[_0xd3ab('0x6')]),_0x1fee49);}};exports[_0xd3ab('0x38')]=function(_0x4d844b){try{if(!_['isNil'](recordings[_0x4d844b[_0xd3ab('0x6')]])){utils[_0xd3ab('0xe')](util[_0xd3ab('0x4')](_0xd3ab('0x39'),_0x4d844b['uniqueid']),_0x4d844b);utils[_0xd3ab('0x3')](util[_0xd3ab('0x4')](_0xd3ab('0x3a'),_0x4d844b['uniqueid'],_0x4d844b[_0xd3ab('0x3b')]));recordings[_0x4d844b[_0xd3ab('0x6')]]['queue']=_0x4d844b[_0xd3ab('0x3b')];}}catch(_0x1bf4bd){utils[_0xd3ab('0x14')](util[_0xd3ab('0x4')](_0xd3ab('0x39'),_0x4d844b['uniqueid']),_0x1bf4bd);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 297d35e..550e81d 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 _0xb32c=['type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb32c,0x195));var _0xcb32=function(_0x2c7b52,_0x2dbf6e){_0x2c7b52=_0x2c7b52-0x0;var _0x7b6e73=_0xb32c[_0x2c7b52];return _0x7b6e73;};'use strict';var _=require(_0xcb32('0x0'));var util=require(_0xcb32('0x1'));var utils=require(_0xcb32('0x2'));function writeDB(_0x47777a){utils[_0xcb32('0x3')](util['format'](_0xcb32('0x4'),_0x47777a[_0xcb32('0x5')]===_0xcb32('0x6')?_0x47777a[_0xcb32('0x7')]:_0x47777a['uniqueid'],_0x47777a['type']));utils[_0xcb32('0x8')](_0xcb32('0x9'),_0x47777a);}exports['blindtransfer']=function(_0x34adf4){try{utils[_0xcb32('0xa')](util[_0xcb32('0xb')](_0xcb32('0xc'),_0x34adf4[_0xcb32('0xd')]),_0x34adf4);utils['info'](util['format'](_0xcb32('0xe'),_0x34adf4['uniqueid'],_0x34adf4[_0xcb32('0xf')],_0x34adf4[_0xcb32('0x10')],_0x34adf4['transfereecalleridnum'],_0x34adf4[_0xcb32('0x11')]));_0x34adf4[_0xcb32('0x5')]=_0xcb32('0x12');writeDB(_0x34adf4);}catch(_0x4ca952){utils['error'](util[_0xcb32('0xb')]('[%s][transfers][blindtransfer]',_0x34adf4[_0xcb32('0xd')]),_0x4ca952);}};exports[_0xcb32('0x13')]=function(_0x40c66a){try{utils['debug'](util['format']('[%s][transfers][attendedtransfer]',_0x40c66a[_0xcb32('0x7')]),_0x40c66a);utils['info'](util[_0xcb32('0xb')](_0xcb32('0x14'),_0x40c66a[_0xcb32('0x7')],_0x40c66a[_0xcb32('0x15')],_0x40c66a[_0xcb32('0x16')],_0x40c66a[_0xcb32('0x17')],_0x40c66a[_0xcb32('0x18')]));_0x40c66a=_[_0xcb32('0x19')](_0x40c66a,{'transfererchannel':_0x40c66a[_0xcb32('0x1a')],'transferercalleridnum':_0x40c66a[_0xcb32('0x15')],'transferercalleridname':_0x40c66a[_0xcb32('0x16')],'transfererconnectedlinenum':_0x40c66a[_0xcb32('0x1b')],'transfererconnectedlinename':_0x40c66a['secondtransfererconnectedlinename'],'transfereraccountcode':_0x40c66a[_0xcb32('0x1c')],'transferercontext':_0x40c66a[_0xcb32('0x1d')],'transfererexten':_0x40c66a[_0xcb32('0x1e')],'transfererlinkedid':_0x40c66a[_0xcb32('0x1f')],'context':_0x40c66a[_0xcb32('0x20')],'extension':_0x40c66a['origtransfererexten'],'type':'attended'});if(_[_0xcb32('0x21')](_0x40c66a['transfereechannel'])){_0x40c66a=_[_0xcb32('0x19')](_0x40c66a,{'transfereechannel':_0x40c66a[_0xcb32('0x22')],'transfereecalleridnum':_0x40c66a[_0xcb32('0x17')],'transfereecalleridname':_0x40c66a[_0xcb32('0x18')],'transfereeconnectedlinenum':_0x40c66a['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x40c66a[_0xcb32('0x23')],'transfereeaccountcode':_0x40c66a[_0xcb32('0x24')],'transfereecontext':_0x40c66a[_0xcb32('0x25')],'transfereeexten':_0x40c66a['transfertargetexten'],'transfereelinkedid':_0x40c66a[_0xcb32('0x26')]});}writeDB(_0x40c66a);}catch(_0x430223){utils[_0xcb32('0x27')](util[_0xcb32('0xb')](_0xcb32('0x28'),_0x40c66a[_0xcb32('0x7')]),_0x430223);}}; \ No newline at end of file +var _0x2a8a=['attended','origtransfereruniqueid','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','attendedtransfer','format','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','[%s][transfers][writeDB]\x20type:%s','type'];(function(_0x54332e,_0x286092){var _0x44d685=function(_0x17a296){while(--_0x17a296){_0x54332e['push'](_0x54332e['shift']());}};_0x44d685(++_0x286092);}(_0x2a8a,0x85));var _0xa2a8=function(_0x282ae8,_0x5826e4){_0x282ae8=_0x282ae8-0x0;var _0xf67a2d=_0x2a8a[_0x282ae8];return _0xf67a2d;};'use strict';var _=require(_0xa2a8('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0xfe3d68){utils['info'](util['format'](_0xa2a8('0x1'),_0xfe3d68[_0xa2a8('0x2')]===_0xa2a8('0x3')?_0xfe3d68[_0xa2a8('0x4')]:_0xfe3d68['uniqueid'],_0xfe3d68[_0xa2a8('0x2')]));utils['request']('CreateVoiceTransferReport',_0xfe3d68);}exports['blindtransfer']=function(_0x2346e3){try{utils['debug'](util['format'](_0xa2a8('0x5'),_0x2346e3[_0xa2a8('0x6')]),_0x2346e3);utils['info'](util['format'](_0xa2a8('0x7'),_0x2346e3[_0xa2a8('0x6')],_0x2346e3[_0xa2a8('0x8')],_0x2346e3[_0xa2a8('0x9')],_0x2346e3[_0xa2a8('0xa')],_0x2346e3['transfereecalleridname']));_0x2346e3['type']=_0xa2a8('0xb');writeDB(_0x2346e3);}catch(_0x42ce0e){utils['error'](util['format'](_0xa2a8('0x5'),_0x2346e3[_0xa2a8('0x6')]),_0x42ce0e);}};exports[_0xa2a8('0xc')]=function(_0x4cedd8){try{utils['debug'](util[_0xa2a8('0xd')](_0xa2a8('0xe'),_0x4cedd8[_0xa2a8('0x4')]),_0x4cedd8);utils['info'](util[_0xa2a8('0xd')](_0xa2a8('0xf'),_0x4cedd8[_0xa2a8('0x4')],_0x4cedd8['origtransferercalleridnum'],_0x4cedd8[_0xa2a8('0x10')],_0x4cedd8['transfertargetcalleridnum'],_0x4cedd8['transfertargetcalleridname']));_0x4cedd8=_[_0xa2a8('0x11')](_0x4cedd8,{'transfererchannel':_0x4cedd8[_0xa2a8('0x12')],'transferercalleridnum':_0x4cedd8['origtransferercalleridnum'],'transferercalleridname':_0x4cedd8[_0xa2a8('0x10')],'transfererconnectedlinenum':_0x4cedd8[_0xa2a8('0x13')],'transfererconnectedlinename':_0x4cedd8[_0xa2a8('0x14')],'transfereraccountcode':_0x4cedd8[_0xa2a8('0x15')],'transferercontext':_0x4cedd8[_0xa2a8('0x16')],'transfererexten':_0x4cedd8[_0xa2a8('0x17')],'transfererlinkedid':_0x4cedd8[_0xa2a8('0x18')],'context':_0x4cedd8[_0xa2a8('0x19')],'extension':_0x4cedd8[_0xa2a8('0x1a')],'type':_0xa2a8('0x3')});if(_[_0xa2a8('0x1b')](_0x4cedd8['transfereechannel'])){_0x4cedd8=_['assign'](_0x4cedd8,{'transfereechannel':_0x4cedd8['transfertargetchannel'],'transfereecalleridnum':_0x4cedd8[_0xa2a8('0x1c')],'transfereecalleridname':_0x4cedd8[_0xa2a8('0x1d')],'transfereeconnectedlinenum':_0x4cedd8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4cedd8[_0xa2a8('0x1e')],'transfereeaccountcode':_0x4cedd8['transfertargetaccountcode'],'transfereecontext':_0x4cedd8[_0xa2a8('0x1f')],'transfereeexten':_0x4cedd8[_0xa2a8('0x20')],'transfereelinkedid':_0x4cedd8[_0xa2a8('0x21')]});}writeDB(_0x4cedd8);}catch(_0x54e0ea){utils['error'](util[_0xa2a8('0xd')]('[%s][transfers][attendedtransfer]',_0x4cedd8[_0xa2a8('0x4')]),_0x54e0ea);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 7da928b..769c355 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 _0xc15b=['[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','isAfter','isBefore','bluebird','client','http','../../config/logger','xdr','info','inspect','error','request','then','debug','catch','GetUser','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface'];(function(_0x21b771,_0x4bbdaa){var _0x485e47=function(_0x4a1149){while(--_0x4a1149){_0x21b771['push'](_0x21b771['shift']());}};_0x485e47(++_0x4bbdaa);}(_0xc15b,0x159));var _0xbc15=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xc15b[_0x377a6e];return _0x37f751;};'use strict';var BPromise=require(_0xbc15('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson[_0xbc15('0x1')][_0xbc15('0x2')]({'port':0x2329});var logger=require(_0xbc15('0x3'))(_0xbc15('0x4'));exports[_0xbc15('0x5')]=function(_0x7d9dc7,_0x3c1cf4){logger[_0xbc15('0x5')](_0x7d9dc7,_0x3c1cf4?util[_0xbc15('0x6')](_0x3c1cf4,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x20f628,_0x5816d1){logger['debug'](_0x20f628,_0x5816d1?util[_0xbc15('0x6')](_0x5816d1,{'showHidden':![],'depth':null}):'');};exports[_0xbc15('0x7')]=function(_0x40db8b,_0x5a1f5d){logger[_0xbc15('0x7')](_0x40db8b,_0x5a1f5d?util[_0xbc15('0x6')](_0x5a1f5d,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5e2eff,_0x2e834c){return client[_0xbc15('0x8')](_0x5e2eff,{'body':_0x2e834c})[_0xbc15('0x9')](function(_0x4c48fc){logger[_0xbc15('0xa')]('[utils][request]\x20name:%s',_0x5e2eff,_0x4c48fc?util[_0xbc15('0x6')](_0x4c48fc,{'showHidden':![],'depth':null}):'');})[_0xbc15('0xb')](function(_0x59b19b){logger[_0xbc15('0x7')]('[utils][request]\x20name:%s',_0x5e2eff,_0x59b19b?util[_0xbc15('0x6')](_0x59b19b,{'showHidden':![],'depth':null}):'');});};function getUser(_0xefb2d6){return client['request'](_0xbc15('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name','interface'],'where':_0xefb2d6,'limit':0x1}})[_0xbc15('0x9')](function(_0x2975e3){logger[_0xbc15('0xa')](_0xbc15('0xd'),JSON[_0xbc15('0xe')](_0xefb2d6),_0x2975e3?util[_0xbc15('0x6')](_0x2975e3,{'showHidden':![],'depth':null}):'');return _0x2975e3[_0xbc15('0xf')][_0xbc15('0x10')]?_0x2975e3[_0xbc15('0xf')][0x0]:null;});}exports[_0xbc15('0x11')]=function(_0x1040b8){return new BPromise(function(_0x1b4d24,_0x277c37){if(_0x1040b8){return getUser({'internal':_0x1040b8})[_0xbc15('0x9')](function(_0x548681){logger['info'](_0xbc15('0x12'),_0x1040b8,_0x548681?_0xbc15('0x13'):_0xbc15('0x14'));return _0x1b4d24(_0x548681);})[_0xbc15('0xb')](function(_0x58cc43){logger[_0xbc15('0x7')](_0xbc15('0x15'),_0x58cc43?util[_0xbc15('0x6')](_0x58cc43,{'showHidden':![],'depth':null}):'');return _0x1b4d24(null);});}return _0x1b4d24(null);});};exports[_0xbc15('0x16')]=function(_0x2f9f4){return new BPromise(function(_0x24315e,_0x576d38){if(_0x2f9f4){return getUser({'interface':_0x2f9f4})[_0xbc15('0x9')](function(_0x5d8bda){logger[_0xbc15('0x5')](_0xbc15('0x17'),_0x2f9f4,_0x5d8bda?_0xbc15('0x13'):_0xbc15('0x14'));return _0x24315e(_0x5d8bda);})[_0xbc15('0xb')](function(_0x19d76f){logger['error'](_0xbc15('0x18'),_0x19d76f?util['inspect'](_0x19d76f,{'showHidden':![],'depth':null}):'');return _0x24315e(null);});}return _0x24315e(null);});};exports[_0xbc15('0x19')]=function(_0x4daeb5){return new BPromise(function(_0x24d64e,_0x4e738a){if(_0x4daeb5){return getUser({'name':_0x4daeb5})[_0xbc15('0x9')](function(_0x1d81d2){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x4daeb5,_0x1d81d2?_0xbc15('0x13'):_0xbc15('0x14'));return _0x24d64e(_0x1d81d2);})[_0xbc15('0xb')](function(_0x133954){logger[_0xbc15('0x7')](_0xbc15('0x1a'),_0x133954?util[_0xbc15('0x6')](_0x133954,{'showHidden':![],'depth':null}):'');return _0x24d64e(null);});}return _0x24d64e(null);});};exports[_0xbc15('0x1b')]=function(_0x39a532){return new BPromise(function(_0x5f4387,_0x4962da){if(_0x39a532){return client[_0xbc15('0x8')](_0xbc15('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xbc15('0x1d'),_0xbc15('0x1e'),_0xbc15('0x1f'),_0xbc15('0x20')],'where':{'name':_0x39a532},'limit':0x1}})['then'](function(_0x56f2a4){logger[_0xbc15('0xa')](_0xbc15('0x21'),_0x39a532,_0x56f2a4?util[_0xbc15('0x6')](_0x56f2a4,{'showHidden':![],'depth':null}):'');logger[_0xbc15('0x5')](_0xbc15('0x22'),_0x39a532,_0x56f2a4?_0xbc15('0x13'):_0xbc15('0x14'));return _0x5f4387(_0x56f2a4[_0xbc15('0xf')][_0xbc15('0x10')]?_0x56f2a4[_0xbc15('0xf')][0x0]:null);})[_0xbc15('0xb')](function(_0xc5fd0a){logger[_0xbc15('0x7')]('[utils][getVoiceQueueByName]',_0xc5fd0a?util[_0xbc15('0x6')](_0xc5fd0a,{'showHidden':![],'depth':null}):'');return _0x5f4387(null);});}return _0x5f4387(null);});};exports[_0xbc15('0x23')]=function(_0x36e7c0,_0x134ba2){return moment(_0x36e7c0)[_0xbc15('0x24')](_0x134ba2,_0xbc15('0x25'))[_0xbc15('0x26')](_0xbc15('0x27'));};exports[_0xbc15('0x28')]=function(_0x1f3ade,_0x792bf2){return moment(_0x1f3ade)[_0xbc15('0x29')](_0x792bf2,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xbc15('0x2a')]=function(_0x1bb668,_0x3c8c4f){return moment(_0x1bb668)['diff'](moment(_0x3c8c4f),_0xbc15('0x25'));};exports[_0xbc15('0x2b')]=function(_0x123463,_0x492b2c){return parseInt(_0x123463,0xa)+parseInt(_0x492b2c,0xa);};exports['now']=function(){return moment()['format'](_0xbc15('0x27'));};exports[_0xbc15('0x2c')]=function(_0x4d4390,_0x119dd2){if(_0x119dd2){return moment(_0x4d4390)['isAfter'](_0x119dd2);}return!![];};exports['isBefore']=function(_0xf6b693,_0x5bf875){if(_0x5bf875){return moment(_0xf6b693)[_0xbc15('0x2d')](_0x5bf875);}else if(_0xf6b693){return!![];}return![];}; \ No newline at end of file +var _0x69e3=['length','info','found','notfound','error','getUserByInterface','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acw','acwTimeout','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','../../config/logger','xdr','inspect','request','debug','[utils][request]\x20name:%s','catch','GetUser','name','then','[utils][getUser]\x20where:%s','result'];(function(_0x4496e2,_0x34670b){var _0x2f62df=function(_0xd933d){while(--_0xd933d){_0x4496e2['push'](_0x4496e2['shift']());}};_0x2f62df(++_0x34670b);}(_0x69e3,0x1d0));var _0x369e=function(_0x371759,_0x1040fa){_0x371759=_0x371759-0x0;var _0x3e5481=_0x69e3[_0x371759];return _0x3e5481;};'use strict';var BPromise=require(_0x369e('0x0'));var jayson=require(_0x369e('0x1'));var moment=require(_0x369e('0x2'));var util=require('util');var client=jayson[_0x369e('0x3')]['http']({'port':0x2329});var logger=require(_0x369e('0x4'))(_0x369e('0x5'));exports['info']=function(_0x233b39,_0x1e1f93){logger['info'](_0x233b39,_0x1e1f93?util[_0x369e('0x6')](_0x1e1f93,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x489332,_0x32a93a){logger['debug'](_0x489332,_0x32a93a?util['inspect'](_0x32a93a,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4e2317,_0x5028ee){logger['error'](_0x4e2317,_0x5028ee?util['inspect'](_0x5028ee,{'showHidden':![],'depth':null}):'');};exports[_0x369e('0x7')]=function(_0x340937,_0x267cb3){return client[_0x369e('0x7')](_0x340937,{'body':_0x267cb3})['then'](function(_0x57640e){logger[_0x369e('0x8')](_0x369e('0x9'),_0x340937,_0x57640e?util[_0x369e('0x6')](_0x57640e,{'showHidden':![],'depth':null}):'');})[_0x369e('0xa')](function(_0x39b989){logger['error'](_0x369e('0x9'),_0x340937,_0x39b989?util[_0x369e('0x6')](_0x39b989,{'showHidden':![],'depth':null}):'');});};function getUser(_0x354beb){return client[_0x369e('0x7')](_0x369e('0xb'),{'options':{'raw':!![],'attributes':['id','internal',_0x369e('0xc'),'interface'],'where':_0x354beb,'limit':0x1}})[_0x369e('0xd')](function(_0x9aa309){logger[_0x369e('0x8')](_0x369e('0xe'),JSON['stringify'](_0x354beb),_0x9aa309?util[_0x369e('0x6')](_0x9aa309,{'showHidden':![],'depth':null}):'');return _0x9aa309[_0x369e('0xf')][_0x369e('0x10')]?_0x9aa309[_0x369e('0xf')][0x0]:null;});}exports['getUserByInternal']=function(_0x495d3a){return new BPromise(function(_0x28e987,_0xffe1d){if(_0x495d3a){return getUser({'internal':_0x495d3a})[_0x369e('0xd')](function(_0x46ee75){logger[_0x369e('0x11')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x495d3a,_0x46ee75?_0x369e('0x12'):_0x369e('0x13'));return _0x28e987(_0x46ee75);})[_0x369e('0xa')](function(_0x589e22){logger[_0x369e('0x14')]('[utils][getUserByInternal]',_0x589e22?util[_0x369e('0x6')](_0x589e22,{'showHidden':![],'depth':null}):'');return _0x28e987(null);});}return _0x28e987(null);});};exports[_0x369e('0x15')]=function(_0x53847e){return new BPromise(function(_0x21abc3,_0x30bb5a){if(_0x53847e){return getUser({'interface':_0x53847e})[_0x369e('0xd')](function(_0x1ba882){logger[_0x369e('0x11')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x53847e,_0x1ba882?_0x369e('0x12'):_0x369e('0x13'));return _0x21abc3(_0x1ba882);})['catch'](function(_0xf451bb){logger[_0x369e('0x14')](_0x369e('0x16'),_0xf451bb?util['inspect'](_0xf451bb,{'showHidden':![],'depth':null}):'');return _0x21abc3(null);});}return _0x21abc3(null);});};exports['getUserByName']=function(_0x4d9341){return new BPromise(function(_0x366a28,_0xeae574){if(_0x4d9341){return getUser({'name':_0x4d9341})[_0x369e('0xd')](function(_0x12dc3f){logger[_0x369e('0x11')](_0x369e('0x17'),_0x4d9341,_0x12dc3f?_0x369e('0x12'):_0x369e('0x13'));return _0x366a28(_0x12dc3f);})[_0x369e('0xa')](function(_0x3305ad){logger[_0x369e('0x14')](_0x369e('0x18'),_0x3305ad?util[_0x369e('0x6')](_0x3305ad,{'showHidden':![],'depth':null}):'');return _0x366a28(null);});}return _0x366a28(null);});};exports['getVoiceQueueByName']=function(_0x1e3e55){return new BPromise(function(_0x2c224f,_0x139069){if(_0x1e3e55){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x369e('0xc'),_0x369e('0x19'),_0x369e('0x1a'),_0x369e('0x1b')],'where':{'name':_0x1e3e55},'limit':0x1}})[_0x369e('0xd')](function(_0x4e7189){logger[_0x369e('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x1e3e55,_0x4e7189?util[_0x369e('0x6')](_0x4e7189,{'showHidden':![],'depth':null}):'');logger[_0x369e('0x11')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1e3e55,_0x4e7189?_0x369e('0x12'):_0x369e('0x13'));return _0x2c224f(_0x4e7189[_0x369e('0xf')][_0x369e('0x10')]?_0x4e7189[_0x369e('0xf')][0x0]:null);})[_0x369e('0xa')](function(_0x1f7d3d){logger[_0x369e('0x14')](_0x369e('0x1c'),_0x1f7d3d?util[_0x369e('0x6')](_0x1f7d3d,{'showHidden':![],'depth':null}):'');return _0x2c224f(null);});}return _0x2c224f(null);});};exports[_0x369e('0x1d')]=function(_0x49da08,_0x29c4fc){return moment(_0x49da08)[_0x369e('0x1e')](_0x29c4fc,_0x369e('0x1f'))['format'](_0x369e('0x20'));};exports[_0x369e('0x21')]=function(_0x2fe2fc,_0x3966df){return moment(_0x2fe2fc)['subtract'](_0x3966df,_0x369e('0x1f'))[_0x369e('0x22')](_0x369e('0x20'));};exports[_0x369e('0x23')]=function(_0x841944,_0x5981bf){return moment(_0x841944)[_0x369e('0x24')](moment(_0x5981bf),'seconds');};exports['sumTime']=function(_0x17c5c2,_0x15dcd4){return parseInt(_0x17c5c2,0xa)+parseInt(_0x15dcd4,0xa);};exports[_0x369e('0x25')]=function(){return moment()[_0x369e('0x22')](_0x369e('0x20'));};exports['isAfter']=function(_0x16b7fb,_0x48d1ae){if(_0x48d1ae){return moment(_0x16b7fb)[_0x369e('0x26')](_0x48d1ae);}return!![];};exports[_0x369e('0x27')]=function(_0x1a3658,_0xe28d23){if(_0xe28d23){return moment(_0x1a3658)[_0x369e('0x27')](_0xe28d23);}else if(_0x1a3658){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index cf92818..11d4d05 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc219=['other','agent_name','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','role','name','then','client','catch','user','no-user','data','timestamp','error','api','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','body','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)'];(function(_0x2f9736,_0x50c372){var _0x4aaa26=function(_0x2b0c6c){while(--_0x2b0c6c){_0x2f9736['push'](_0x2f9736['shift']());}};_0x4aaa26(++_0x50c372);}(_0xc219,0x116));var _0x9c21=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0xc219[_0x418549];return _0x288826;};var fs=require(_0x9c21('0x0'));var _=require(_0x9c21('0x1'));var ewinston=require(_0x9c21('0x2'));var path=require(_0x9c21('0x3'));var util=require('util');var fileLogger=require(_0x9c21('0x4'))[_0x9c21('0x5')];var safeTemplate=require(_0x9c21('0x6'))[_0x9c21('0x7')];var maskSensitiveData=require(_0x9c21('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x349c6e(_0x33c9db){var _0x2ea01e=path[_0x9c21('0x9')](_0x9c21('0xa'),_0x9c21('0xb'),_0x9c21('0xc'));var _0x355a62=path[_0x9c21('0x9')]('client',_0x33c9db[_0x9c21('0xd')]+'-'+_0x33c9db[_0x9c21('0xe')]);return fs['ensureDir'](path[_0x9c21('0x9')](_0x2ea01e,_0x355a62))[_0x9c21('0xf')](function(){var _0x3bd935=fileLogger(_0x9c21('0x10'),path[_0x9c21('0x9')](_0x2ea01e,_0x355a62));return _0x3bd935;})[_0x9c21('0x11')](function(_0x3d812b){throw _0x3d812b;});}this['log']=function(_0x5c51b5,_0x356fe7,_0x4d2094,_0x4bfb06){return _0x349c6e(_0x5c51b5[_0x9c21('0x12')])[_0x9c21('0xf')](function(_0x403bbc){var _0x9747d6=_0x403bbc[_0x356fe7];return _0x9747d6;})[_0x9c21('0xf')](function(_0x23b98e){var _0x2326d3=_0x5c51b5[_0x9c21('0x12')]?_0x5c51b5[_0x9c21('0x12')]['id']:_0x9c21('0x13');var _0x524b2b=_0x4bfb06[_0x9c21('0x14')];var _0x344f29=_0x4bfb06[_0x9c21('0x15')];var _0x54499d=new Date(Number(_0x344f29));return _0x23b98e(_0x2326d3,_0x54499d,_0x4d2094,_0x524b2b);})[_0x9c21('0x11')](function(_0x3e838d){fileLogger(_0x9c21('0x10'))[_0x9c21('0x16')](_0x3e838d);});};}function setupLoggers(_0x35a2e8){return new Promise(function(_0x5eb458){var _0x94d007=new ClientSideLogger();var _0x3b54ed=fileLogger(_0x9c21('0x17'));var _0x33cdda=fileLogger(_0x9c21('0x18'));_0x35a2e8[_0x9c21('0x19')]('client-side-logger',_0x94d007);_0x35a2e8[_0x9c21('0x1a')](ewinston[_0x9c21('0x1b')]({'winstonInstance':_0x3b54ed,'meta':![],'statusLevels':!![],'msg':function(_0x2675ed,_0x126508){var _0x3af6f0=_0x9c21('0x1c');if(!_[_0x9c21('0x1d')](_0x2675ed['body'])){_0x3af6f0+=_0x9c21('0x1e');var _0x3d8c8f=_0x2675ed['body'];maskSensitiveData(_0x3d8c8f);}return safeTemplate(util[_0x9c21('0x1f')](_0x3af6f0,_0x2675ed[_0x9c21('0x20')],_0x2675ed[_0x9c21('0x21')]['x-forwarded-for']?_0x2675ed[_0x9c21('0x21')][_0x9c21('0x22')]:_0x2675ed[_0x9c21('0x23')][_0x9c21('0x24')]||_0x2675ed['ip'],_0x2675ed[_0x9c21('0x25')],_0x126508[_0x9c21('0x26')],_0x126508[_0x9c21('0x27')],_0x2675ed[_0x9c21('0x12')]?_0x2675ed['user']['id']:null,_0x2675ed['user']?_0x2675ed[_0x9c21('0x12')][_0x9c21('0xe')]:null,_0x2675ed[_0x9c21('0x12')]?_0x2675ed[_0x9c21('0x12')]['role']:null,_0x3d8c8f?util['inspect'](_0x3d8c8f,![],null):''));}}));_0x35a2e8['use'](ewinston[_0x9c21('0x1b')]({'winstonInstance':_0x33cdda,'meta':![],'statusLevels':!![],'msg':function(_0xf3df35,_0x3e3f45){var _0x3b2f09='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xf3df35[_0x9c21('0x28')]&&_0xf3df35[_0x9c21('0x28')][_0x9c21('0x29')]&&_0xf3df35[_0x9c21('0x28')][_0x9c21('0x2a')]){_0x3b2f09=_0x9c21('0x2b');}return util['format'](_0x3b2f09,_0xf3df35['method'],_0xf3df35[_0x9c21('0x21')][_0x9c21('0x22')]?_0xf3df35['headers'][_0x9c21('0x22')]:_0xf3df35[_0x9c21('0x23')][_0x9c21('0x24')]||_0xf3df35['ip'],_0xf3df35[_0x9c21('0x25')],_0x3e3f45[_0x9c21('0x26')],_0x3e3f45[_0x9c21('0x27')],_0xf3df35['user']?_0xf3df35[_0x9c21('0x12')]['id']:null,_0xf3df35[_0x9c21('0x12')]?_0xf3df35[_0x9c21('0x12')][_0x9c21('0xe')]:null,_0xf3df35[_0x9c21('0x12')]?_0xf3df35[_0x9c21('0x12')][_0x9c21('0xd')]:null,_0xf3df35['body']&&_0xf3df35['body'][_0x9c21('0x29')]?_0xf3df35[_0x9c21('0x28')]['device']:_0x9c21('0x2c'),_0xf3df35[_0x9c21('0x28')]&&_0xf3df35['body'][_0x9c21('0x2a')]?_0xf3df35['body'][_0x9c21('0x2a')]:'',_0xf3df35[_0x9c21('0x28')]&&_0xf3df35[_0x9c21('0x28')][_0x9c21('0x2d')]?_0xf3df35[_0x9c21('0x28')]['agent_name']:'');},'ignoreRoute':function(_0x5b2d0b){var _0xeffbaf=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xeffbaf['test'](_0x5b2d0b[_0x9c21('0x25')]);}}));return _0x5eb458();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xf9c4=['body','\x20body=%s','format','x-forwarded-for','headers','connection','url','statusCode','responseTime','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','./safe-template','./mask-sensitive-data','maskSensitiveData','/var','xcally','join','client','name','ensureDir','then','catch','log','user','no-user','data','timestamp','api','set','client-side-logger','use','isEmpty'];(function(_0x3846b6,_0x192ca1){var _0x39ba59=function(_0x95f850){while(--_0x95f850){_0x3846b6['push'](_0x3846b6['shift']());}};_0x39ba59(++_0x192ca1);}(_0xf9c4,0x159));var _0x4f9c=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0xf9c4[_0x1ae491];return _0x4958a5;};var fs=require(_0x4f9c('0x0'));var _=require(_0x4f9c('0x1'));var ewinston=require(_0x4f9c('0x2'));var path=require('path');var util=require('util');var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x4f9c('0x3'))['safeTemplate'];var maskSensitiveData=require(_0x4f9c('0x4'))[_0x4f9c('0x5')];function ClientSideLogger(){function _0x12aaa3(_0x70501){var _0x16f2ef=path['join'](_0x4f9c('0x6'),'log',_0x4f9c('0x7'));var _0xf6594d=path[_0x4f9c('0x8')](_0x4f9c('0x9'),_0x70501['role']+'-'+_0x70501[_0x4f9c('0xa')]);return fs[_0x4f9c('0xb')](path['join'](_0x16f2ef,_0xf6594d))[_0x4f9c('0xc')](function(){var _0x43190f=fileLogger(_0x4f9c('0x9'),path[_0x4f9c('0x8')](_0x16f2ef,_0xf6594d));return _0x43190f;})[_0x4f9c('0xd')](function(_0x4c82ee){throw _0x4c82ee;});}this[_0x4f9c('0xe')]=function(_0x5c408a,_0x5ccda8,_0x1fdcc6,_0x2cdf52){return _0x12aaa3(_0x5c408a[_0x4f9c('0xf')])[_0x4f9c('0xc')](function(_0x393a88){var _0x1db01b=_0x393a88[_0x5ccda8];return _0x1db01b;})[_0x4f9c('0xc')](function(_0xddb3){var _0x5113cd=_0x5c408a[_0x4f9c('0xf')]?_0x5c408a['user']['id']:_0x4f9c('0x10');var _0x486203=_0x2cdf52[_0x4f9c('0x11')];var _0x300c0a=_0x2cdf52[_0x4f9c('0x12')];var _0x23e75e=new Date(Number(_0x300c0a));return _0xddb3(_0x5113cd,_0x23e75e,_0x1fdcc6,_0x486203);})[_0x4f9c('0xd')](function(_0xf3e5ce){fileLogger(_0x4f9c('0x9'))['error'](_0xf3e5ce);});};}function setupLoggers(_0x1ef03a){return new Promise(function(_0x3173d1){var _0x1cd993=new ClientSideLogger();var _0x18b58a=fileLogger(_0x4f9c('0x13'));var _0x2f27c8=fileLogger('auth');_0x1ef03a[_0x4f9c('0x14')](_0x4f9c('0x15'),_0x1cd993);_0x1ef03a[_0x4f9c('0x16')](ewinston['logger']({'winstonInstance':_0x18b58a,'meta':![],'statusLevels':!![],'msg':function(_0x3bf440,_0x2a0ed8){var _0x3cd62d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x4f9c('0x17')](_0x3bf440[_0x4f9c('0x18')])){_0x3cd62d+=_0x4f9c('0x19');var _0x27da7a=_0x3bf440[_0x4f9c('0x18')];maskSensitiveData(_0x27da7a);}return safeTemplate(util[_0x4f9c('0x1a')](_0x3cd62d,_0x3bf440['method'],_0x3bf440['headers'][_0x4f9c('0x1b')]?_0x3bf440[_0x4f9c('0x1c')][_0x4f9c('0x1b')]:_0x3bf440[_0x4f9c('0x1d')]['remoteAddress']||_0x3bf440['ip'],_0x3bf440[_0x4f9c('0x1e')],_0x2a0ed8[_0x4f9c('0x1f')],_0x2a0ed8[_0x4f9c('0x20')],_0x3bf440[_0x4f9c('0xf')]?_0x3bf440[_0x4f9c('0xf')]['id']:null,_0x3bf440[_0x4f9c('0xf')]?_0x3bf440[_0x4f9c('0xf')][_0x4f9c('0xa')]:null,_0x3bf440[_0x4f9c('0xf')]?_0x3bf440[_0x4f9c('0xf')][_0x4f9c('0x21')]:null,_0x27da7a?util[_0x4f9c('0x22')](_0x27da7a,![],null):''));}}));_0x1ef03a['use'](ewinston['logger']({'winstonInstance':_0x2f27c8,'meta':![],'statusLevels':!![],'msg':function(_0x4fb4a7,_0x3b8900){var _0x325cf3=_0x4f9c('0x23');if(_0x4fb4a7[_0x4f9c('0x18')]&&_0x4fb4a7[_0x4f9c('0x18')][_0x4f9c('0x24')]&&_0x4fb4a7[_0x4f9c('0x18')]['agent_id']){_0x325cf3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4f9c('0x1a')](_0x325cf3,_0x4fb4a7['method'],_0x4fb4a7[_0x4f9c('0x1c')][_0x4f9c('0x1b')]?_0x4fb4a7[_0x4f9c('0x1c')][_0x4f9c('0x1b')]:_0x4fb4a7[_0x4f9c('0x1d')]['remoteAddress']||_0x4fb4a7['ip'],_0x4fb4a7[_0x4f9c('0x1e')],_0x3b8900[_0x4f9c('0x1f')],_0x3b8900[_0x4f9c('0x20')],_0x4fb4a7[_0x4f9c('0xf')]?_0x4fb4a7['user']['id']:null,_0x4fb4a7['user']?_0x4fb4a7[_0x4f9c('0xf')][_0x4f9c('0xa')]:null,_0x4fb4a7[_0x4f9c('0xf')]?_0x4fb4a7['user'][_0x4f9c('0x21')]:null,_0x4fb4a7[_0x4f9c('0x18')]&&_0x4fb4a7['body'][_0x4f9c('0x24')]?_0x4fb4a7[_0x4f9c('0x18')]['device']:'other',_0x4fb4a7[_0x4f9c('0x18')]&&_0x4fb4a7[_0x4f9c('0x18')]['agent_id']?_0x4fb4a7[_0x4f9c('0x18')][_0x4f9c('0x25')]:'',_0x4fb4a7[_0x4f9c('0x18')]&&_0x4fb4a7[_0x4f9c('0x18')]['agent_name']?_0x4fb4a7[_0x4f9c('0x18')][_0x4f9c('0x26')]:'');},'ignoreRoute':function(_0x34fd02){var _0x29ab8d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x29ab8d[_0x4f9c('0x27')](_0x34fd02[_0x4f9c('0x1e')]);}}));return _0x3173d1();});}exports[_0x4f9c('0x28')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 57a0749..1fee01f 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cba=['startOf','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','format','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore'];(function(_0x3ef856,_0x5a4b4e){var _0x1a78ca=function(_0x22b922){while(--_0x22b922){_0x3ef856['push'](_0x3ef856['shift']());}};_0x1a78ca(++_0x5a4b4e);}(_0x4cba,0x1a4));var _0xa4cb=function(_0x1bb8d1,_0x48b94d){_0x1bb8d1=_0x1bb8d1-0x0;var _0x4f775e=_0x4cba[_0x1bb8d1];return _0x4f775e;};var _=require(_0xa4cb('0x0'));var moment=require(_0xa4cb('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xa4cb('0x2')](function(_0x5c8a85){return _0x5c8a85[_0xa4cb('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa4cb('0x4');var EINVALID_DATE=_0xa4cb('0x5');function throwIfDateNotValid(_0x3bf1ae){if(!_0x3bf1ae[_0xa4cb('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x285e9c){var _0x244d87=_0x285e9c[_0xa4cb('0x7')](':')[_0xa4cb('0x2')](function(_0x5a9c34){return parseInt(_0x5a9c34,0xa);});var _0x4eedd8=_0x244d87[0x0];var _0x3f6af9=_0x244d87[0x1];if(_0x4eedd8<0x0||_0x4eedd8>0x17||_0x3f6af9<0x0||_0x3f6af9>0x3b){throw new Error(EINVALID_DATE);}return[_0x4eedd8,_0x3f6af9];}function circularDoWInterval(_0x387f41,_0xa79dcb){if(_0x387f41===_0xa79dcb){return[_0x387f41];}else{var _0x1803c7=moment[_0xa4cb('0x8')]();moment['locale']('en');var _0xebf6eb=moment[_0xa4cb('0x9')]()[_0xa4cb('0x2')](function(_0x3ebd88){return _0x3ebd88[_0xa4cb('0xa')]();});moment[_0xa4cb('0x8')](_0x1803c7);var _0x3e157c=_0xebf6eb[_0xa4cb('0xb')](_0x387f41);var _0x3331ef=_0xebf6eb[_0xa4cb('0xb')](_0xa79dcb);if(_0x3331ef>_0x3e157c){return _0xebf6eb[_0xa4cb('0xc')](_0x3e157c,_0x3331ef+0x1);}else{var _0x555d00=_0xebf6eb['slice'](0x0,_0x3331ef+0x1);var _0x2a0e50=_0xebf6eb[_0xa4cb('0xc')](_0x3e157c);return _0x2a0e50[_0xa4cb('0xd')](_0x555d00);}}}module[_0xa4cb('0xe')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x527989,_0x28b8a2){if(_0x527989===_0x28b8a2){return[_0x527989];}else{var _0x491a81=moment[_0xa4cb('0x8')]();moment[_0xa4cb('0x8')]('en');var _0x559c1c=moment[_0xa4cb('0xf')]()[_0xa4cb('0x2')](function(_0x5b3ff8){return _0x5b3ff8[_0xa4cb('0xa')]();});moment[_0xa4cb('0x8')](_0x491a81);var _0x17f5f8=_0x559c1c[_0xa4cb('0xb')](_0x527989);var _0x4562f4=_0x559c1c['indexOf'](_0x28b8a2);if(_0x4562f4>_0x17f5f8){return _0x559c1c['slice'](_0x17f5f8,_0x4562f4+0x1);}else{var _0x51b0a7=_0x559c1c[_0xa4cb('0xc')](0x0,_0x4562f4+0x1);var _0xcc427e=_0x559c1c[_0xa4cb('0xc')](_0x17f5f8);return _0xcc427e['concat'](_0x51b0a7);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x20dd6f){var _0x50d5ee=parseInt(_0x20dd6f,0xa);if(_0x50d5ee<0x1||_0x50d5ee>0x1f){throw new Error(EINVALID_DATE);}return _0x50d5ee;}function timeCompare(_0x27f84a,_0x49fee6,_0x1459b2){var _0x293b02=_0x27f84a[_0xa4cb('0x10')]();var _0x56178d=extractTime(_0x49fee6);var _0x5a53aa=_0x56178d[0x0];var _0x5f4a80=_0x56178d[0x1];var _0x1a80ec=_0x27f84a[_0xa4cb('0x10')]()[_0xa4cb('0x11')](_0x5a53aa)[_0xa4cb('0x12')](_0x5f4a80);throwIfDateNotValid(_0x1a80ec);var _0x56cafc=extractTime(_0x1459b2);var _0x925ad8=_0x56cafc[0x0];var _0x1af589=_0x56cafc[0x1];var _0x22cbe2=_0x27f84a[_0xa4cb('0x10')]()[_0xa4cb('0x11')](_0x925ad8)['minutes'](_0x1af589);throwIfDateNotValid(_0x22cbe2);if(_0x22cbe2[_0xa4cb('0x13')](_0x1a80ec)){var _0x99227c=_0x293b02[_0xa4cb('0x10')]()[_0xa4cb('0x14')](_0xa4cb('0x15'));var _0x92a4c4=_0x293b02[_0xa4cb('0x10')]()[_0xa4cb('0x16')]('day');return _0x293b02[_0xa4cb('0x17')](_0x1a80ec,_0x92a4c4,undefined,'[]')||_0x293b02[_0xa4cb('0x17')](_0x99227c,_0x22cbe2,undefined,'[]');}else{return _0x293b02[_0xa4cb('0x17')](_0x1a80ec,_0x22cbe2,undefined,'[]');}}module['exports'][_0xa4cb('0x18')]=timeCompare;function dowCompare(_0x5d5a7e,_0x2a2566,_0x5d3e59){var _0x2a90b3=_0x5d5a7e[_0xa4cb('0x8')]('en')['format'](_0xa4cb('0x19'))['toLowerCase']();return circularDoWInterval(_0x2a2566,_0x5d3e59)[_0xa4cb('0x1a')](_0x2a90b3);}module[_0xa4cb('0xe')][_0xa4cb('0x1b')]=dowCompare;function domCompare(_0x2f3504,_0x1f7010,_0x108590){var _0x47cff0=_0x2f3504[_0xa4cb('0x1c')]();if(_0x1f7010===_0x108590){return _0x47cff0===_0x1f7010;}else{var _0x2da811=_0x2f3504[_0xa4cb('0x1d')]();var _0x2d8cae=_0x1f7010<_0x108590;let _0x3dacf8=![];var _0x267a44=0x0;var _0x2c8b8e=0x0;if(_0x2d8cae){_0x267a44=Math[_0xa4cb('0x1e')](0x1,_0x1f7010);_0x2c8b8e=Math[_0xa4cb('0x1f')](_0x108590,_0x2da811);_0x3dacf8=_0x47cff0>=_0x267a44&&_0x47cff0<=_0x2c8b8e;}else{_0x267a44=Math[_0xa4cb('0x1f')](_0x1f7010,_0x2da811);_0x2c8b8e=Math[_0xa4cb('0x1e')](0x1,_0x108590);_0x3dacf8=_0x47cff0>=_0x267a44||_0x47cff0<=_0x2c8b8e;}return _0x3dacf8;}}module[_0xa4cb('0xe')][_0xa4cb('0x20')]=domCompare;function monthCompare(_0x4cac52,_0x56a2bb,_0x34bad2){var _0x4be4f0=_0x4cac52[_0xa4cb('0x8')]('en')[_0xa4cb('0x21')]('MMM')['toLowerCase']();return circularMonthInterval(_0x56a2bb,_0x34bad2)[_0xa4cb('0x1a')](_0x4be4f0);}module[_0xa4cb('0xe')][_0xa4cb('0x22')]=monthCompare;function iftime(_0x82652,_0x426011=moment['tz']['guess'](),_0x5c6d57=moment()){if(!validateRx[_0xa4cb('0x23')](_0x82652)){throw new Error(EINVALID_STRING);}else{var _0xac5c6c=(moment[_0xa4cb('0x24')](_0x5c6d57)?_0x5c6d57[_0xa4cb('0x10')]():moment(_0x5c6d57))['tz'](_0x426011)[_0xa4cb('0x8')]('en');throwIfDateNotValid(_0xac5c6c);var _0x44d822=_0x82652[_0xa4cb('0x7')](',');var _0x17e10a=_0x44d822[0x0];var _0x4ba811=_0x44d822[0x1];var _0x4107f6=_0x44d822[0x2];var _0x2f672e=_0x44d822[0x3];let _0x3a6031=!![];if(_0x17e10a!=='*'){var _0x280efb=_0x17e10a[_0xa4cb('0x7')]('-');var _0x32c673=_[_0xa4cb('0x25')](_0x280efb[0x0],0x5,'0');var _0x5ba337=_0x280efb[_0xa4cb('0x26')]===0x2?_['padStart'](_0x280efb[0x1],0x5,'0'):_0x32c673;_0x3a6031=timeCompare(_0xac5c6c,_0x32c673,_0x5ba337);}let _0x4c739a=!![];if(_0x4ba811!=='*'){var _0x28cf7f=_0x4ba811[_0xa4cb('0x7')]('-');var _0x2ac1c4=_0x28cf7f[0x0];var _0x1622aa=_0x28cf7f[_0xa4cb('0x26')]===0x2?_0x28cf7f[0x1]:_0x2ac1c4;_0x4c739a=dowCompare(_0xac5c6c,_0x2ac1c4,_0x1622aa);}let _0x395117=!![];if(_0x4107f6!=='*'){var _0x3f3b7e=_0x4107f6[_0xa4cb('0x7')]('-');var _0x330783=parseDom(_0x3f3b7e[0x0]);var _0x26ca7e=_0x3f3b7e[_0xa4cb('0x26')]===0x2?parseDom(_0x3f3b7e[0x1]):_0x330783;_0x395117=domCompare(_0xac5c6c,_0x330783,_0x26ca7e);}let _0x35321f=!![];if(_0x2f672e!=='*'){var _0x558156=_0x2f672e[_0xa4cb('0x7')]('-');var _0x3e0604=_0x558156[0x0];var _0x27033c=_0x558156[_0xa4cb('0x26')]===0x2?_0x558156[0x1]:_0x558156[0x0];_0x35321f=monthCompare(_0xac5c6c,_0x3e0604,_0x27033c);}return _0x3a6031&&_0x4c739a&&_0x395117&&_0x35321f;}}module[_0xa4cb('0xe')][_0xa4cb('0x27')]=iftime; \ No newline at end of file +var _0xe966=['iftime','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','slice','concat','exports','circularDoWInterval','indexOf','circularMonthInterval','clone','hours','isBefore','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','split','padStart','length'];(function(_0x21e1ee,_0x1268a6){var _0x4f750d=function(_0x1be4ec){while(--_0x1be4ec){_0x21e1ee['push'](_0x21e1ee['shift']());}};_0x4f750d(++_0x1268a6);}(_0xe966,0xc4));var _0x6e96=function(_0x73171f,_0x52fd5c){_0x73171f=_0x73171f-0x0;var _0x5e8d13=_0xe966[_0x73171f];return _0x5e8d13;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x6e96('0x0')](function(_0x590435){return _0x590435[_0x6e96('0x1')];})[_0x6e96('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6e96('0x3');var EINVALID_DATE=_0x6e96('0x4');function throwIfDateNotValid(_0x1c6740){if(!_0x1c6740[_0x6e96('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xadc767){var _0x164a15=_0xadc767['split'](':')[_0x6e96('0x0')](function(_0x16b854){return parseInt(_0x16b854,0xa);});var _0x53868a=_0x164a15[0x0];var _0x19c9a4=_0x164a15[0x1];if(_0x53868a<0x0||_0x53868a>0x17||_0x19c9a4<0x0||_0x19c9a4>0x3b){throw new Error(EINVALID_DATE);}return[_0x53868a,_0x19c9a4];}function circularDoWInterval(_0x4a47d2,_0x22ea79){if(_0x4a47d2===_0x22ea79){return[_0x4a47d2];}else{var _0x51751e=moment[_0x6e96('0x6')]();moment[_0x6e96('0x6')]('en');var _0xfb4c5=moment[_0x6e96('0x7')]()[_0x6e96('0x0')](function(_0x409b08){return _0x409b08[_0x6e96('0x8')]();});moment[_0x6e96('0x6')](_0x51751e);var _0x2779ed=_0xfb4c5['indexOf'](_0x4a47d2);var _0x33d4f4=_0xfb4c5['indexOf'](_0x22ea79);if(_0x33d4f4>_0x2779ed){return _0xfb4c5[_0x6e96('0x9')](_0x2779ed,_0x33d4f4+0x1);}else{var _0x373fbd=_0xfb4c5[_0x6e96('0x9')](0x0,_0x33d4f4+0x1);var _0x2a3b19=_0xfb4c5[_0x6e96('0x9')](_0x2779ed);return _0x2a3b19[_0x6e96('0xa')](_0x373fbd);}}}module[_0x6e96('0xb')][_0x6e96('0xc')]=circularDoWInterval;function circularMonthInterval(_0x533506,_0x4099f8){if(_0x533506===_0x4099f8){return[_0x533506];}else{var _0x122f81=moment[_0x6e96('0x6')]();moment[_0x6e96('0x6')]('en');var _0x4cf4b8=moment['monthsShort']()[_0x6e96('0x0')](function(_0x24de7f){return _0x24de7f[_0x6e96('0x8')]();});moment[_0x6e96('0x6')](_0x122f81);var _0x3c5f17=_0x4cf4b8[_0x6e96('0xd')](_0x533506);var _0x3f20ad=_0x4cf4b8['indexOf'](_0x4099f8);if(_0x3f20ad>_0x3c5f17){return _0x4cf4b8[_0x6e96('0x9')](_0x3c5f17,_0x3f20ad+0x1);}else{var _0x2f170f=_0x4cf4b8[_0x6e96('0x9')](0x0,_0x3f20ad+0x1);var _0x3f5134=_0x4cf4b8[_0x6e96('0x9')](_0x3c5f17);return _0x3f5134[_0x6e96('0xa')](_0x2f170f);}}}module[_0x6e96('0xb')][_0x6e96('0xe')]=circularMonthInterval;function parseDom(_0x5010fe){var _0x198eba=parseInt(_0x5010fe,0xa);if(_0x198eba<0x1||_0x198eba>0x1f){throw new Error(EINVALID_DATE);}return _0x198eba;}function timeCompare(_0x23578a,_0x5b7f1b,_0x589f98){var _0x1b6d0d=_0x23578a[_0x6e96('0xf')]();var _0x244498=extractTime(_0x5b7f1b);var _0x4ed721=_0x244498[0x0];var _0x1e9aa6=_0x244498[0x1];var _0x419907=_0x23578a[_0x6e96('0xf')]()[_0x6e96('0x10')](_0x4ed721)['minutes'](_0x1e9aa6);throwIfDateNotValid(_0x419907);var _0x5d316a=extractTime(_0x589f98);var _0x55837b=_0x5d316a[0x0];var _0xe39fd6=_0x5d316a[0x1];var _0x29c215=_0x23578a[_0x6e96('0xf')]()[_0x6e96('0x10')](_0x55837b)['minutes'](_0xe39fd6);throwIfDateNotValid(_0x29c215);if(_0x29c215[_0x6e96('0x11')](_0x419907)){var _0x1b557f=_0x1b6d0d[_0x6e96('0xf')]()[_0x6e96('0x12')]('day');var _0x2ee61e=_0x1b6d0d[_0x6e96('0xf')]()[_0x6e96('0x13')](_0x6e96('0x14'));return _0x1b6d0d[_0x6e96('0x15')](_0x419907,_0x2ee61e,undefined,'[]')||_0x1b6d0d[_0x6e96('0x15')](_0x1b557f,_0x29c215,undefined,'[]');}else{return _0x1b6d0d[_0x6e96('0x15')](_0x419907,_0x29c215,undefined,'[]');}}module[_0x6e96('0xb')][_0x6e96('0x16')]=timeCompare;function dowCompare(_0x591fc1,_0x463f88,_0x380a19){var _0x301460=_0x591fc1['locale']('en')[_0x6e96('0x17')](_0x6e96('0x18'))[_0x6e96('0x8')]();return circularDoWInterval(_0x463f88,_0x380a19)[_0x6e96('0x19')](_0x301460);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x14892f,_0x2fa816,_0x5b7066){var _0x40d4d4=_0x14892f[_0x6e96('0x1a')]();if(_0x2fa816===_0x5b7066){return _0x40d4d4===_0x2fa816;}else{var _0x20345f=_0x14892f[_0x6e96('0x1b')]();var _0x3918de=_0x2fa816<_0x5b7066;let _0x44a12f=![];var _0xf18917=0x0;var _0x577d8c=0x0;if(_0x3918de){_0xf18917=Math[_0x6e96('0x1c')](0x1,_0x2fa816);_0x577d8c=Math['min'](_0x5b7066,_0x20345f);_0x44a12f=_0x40d4d4>=_0xf18917&&_0x40d4d4<=_0x577d8c;}else{_0xf18917=Math[_0x6e96('0x1d')](_0x2fa816,_0x20345f);_0x577d8c=Math[_0x6e96('0x1c')](0x1,_0x5b7066);_0x44a12f=_0x40d4d4>=_0xf18917||_0x40d4d4<=_0x577d8c;}return _0x44a12f;}}module[_0x6e96('0xb')][_0x6e96('0x1e')]=domCompare;function monthCompare(_0x5cbd6d,_0x38a84a,_0x52c315){var _0x1dc099=_0x5cbd6d['locale']('en')[_0x6e96('0x17')](_0x6e96('0x1f'))['toLowerCase']();return circularMonthInterval(_0x38a84a,_0x52c315)[_0x6e96('0x19')](_0x1dc099);}module['exports'][_0x6e96('0x20')]=monthCompare;function iftime(_0x3a9252,_0x2890f0=moment['tz'][_0x6e96('0x21')](),_0x35e7fb=moment()){if(!validateRx[_0x6e96('0x22')](_0x3a9252)){throw new Error(EINVALID_STRING);}else{var _0xa26435=(moment['isMoment'](_0x35e7fb)?_0x35e7fb['clone']():moment(_0x35e7fb))['tz'](_0x2890f0)['locale']('en');throwIfDateNotValid(_0xa26435);var _0x582bfd=_0x3a9252[_0x6e96('0x23')](',');var _0x57f4d8=_0x582bfd[0x0];var _0x327255=_0x582bfd[0x1];var _0x5b4e3c=_0x582bfd[0x2];var _0x143dfe=_0x582bfd[0x3];let _0x31c42f=!![];if(_0x57f4d8!=='*'){var _0x526470=_0x57f4d8['split']('-');var _0x33e3d0=_[_0x6e96('0x24')](_0x526470[0x0],0x5,'0');var _0x184d37=_0x526470[_0x6e96('0x25')]===0x2?_[_0x6e96('0x24')](_0x526470[0x1],0x5,'0'):_0x33e3d0;_0x31c42f=timeCompare(_0xa26435,_0x33e3d0,_0x184d37);}let _0x30f5e0=!![];if(_0x327255!=='*'){var _0x4ccb5d=_0x327255['split']('-');var _0x3f8720=_0x4ccb5d[0x0];var _0x9a931d=_0x4ccb5d[_0x6e96('0x25')]===0x2?_0x4ccb5d[0x1]:_0x3f8720;_0x30f5e0=dowCompare(_0xa26435,_0x3f8720,_0x9a931d);}let _0x25d927=!![];if(_0x5b4e3c!=='*'){var _0x13015f=_0x5b4e3c['split']('-');var _0x28fc78=parseDom(_0x13015f[0x0]);var _0x3dd731=_0x13015f['length']===0x2?parseDom(_0x13015f[0x1]):_0x28fc78;_0x25d927=domCompare(_0xa26435,_0x28fc78,_0x3dd731);}let _0x153ef3=!![];if(_0x143dfe!=='*'){var _0x54a3cc=_0x143dfe[_0x6e96('0x23')]('-');var _0x48c4cc=_0x54a3cc[0x0];var _0x3bbef4=_0x54a3cc['length']===0x2?_0x54a3cc[0x1]:_0x54a3cc[0x0];_0x153ef3=monthCompare(_0xa26435,_0x48c4cc,_0x3bbef4);}return _0x31c42f&&_0x30f5e0&&_0x25d927&&_0x153ef3;}}module[_0x6e96('0xb')][_0x6e96('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 37ec86f..b8b497c 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dd2=['moment','debugLevel','info','redBG\x20white','bold\x20yellow','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','{{{','}}}','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','%s-%s','error','File','consoleLogger','fileLogger','path'];(function(_0xf88c12,_0x33e0f0){var _0x29c7b2=function(_0x3a9353){while(--_0x3a9353){_0xf88c12['push'](_0xf88c12['shift']());}};_0x29c7b2(++_0x33e0f0);}(_0x6dd2,0x71));var _0x26dd=function(_0x3fca4d,_0xc13bff){_0x3fca4d=_0x3fca4d-0x0;var _0x181248=_0x6dd2[_0x3fca4d];return _0x181248;};'use strict';var path=require(_0x26dd('0x0'));var util=require('util');var moment=require(_0x26dd('0x1'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0x26dd('0x2')]?config[_0x26dd('0x2')]['toLowerCase']():_0x26dd('0x3');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x26dd('0x4'),'error':'red','warn':_0x26dd('0x5'),'info':_0x26dd('0x6'),'print':_0x26dd('0x7'),'success':'bold\x20green','http':_0x26dd('0x8'),'verbose':_0x26dd('0x9'),'debug':_0x26dd('0xa'),'silly':_0x26dd('0xb')};winston[_0x26dd('0xc')](XC_LOG_COLORS);function getLogFileName(_0x159d21,_0xbd9c6,_0x12036c){var _0x37ff5d=_0x159d21||_0x26dd('0xd');return path[_0x26dd('0xe')](_0x37ff5d,util[_0x26dd('0xf')](_0x26dd('0x10'),_0xbd9c6,_0x12036c));}function formatter(_0x423700,_0x46d169){_0x46d169['message']=_0x46d169[_0x26dd('0x11')][_0x26dd('0x12')](/@@{/g,'{{{')[_0x26dd('0x12')](/}@@/g,'}}}')[_0x26dd('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x26dd('0x13'),moment()['format'](_0x26dd('0x14')),_0x46d169[_0x26dd('0x15')]['toUpperCase'](),_0x423700,_0x46d169[_0x26dd('0x11')]);}function fileFormat(_0x4c22eb,_0x158fdb){_0x158fdb[_0x26dd('0x11')]=_0x158fdb[_0x26dd('0x11')]['replace'](/@@{/g,_0x26dd('0x16'))[_0x26dd('0x12')](/}@@/g,_0x26dd('0x17'))[_0x26dd('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x437c61=_0x158fdb[_0x26dd('0x18')]&&Object[_0x26dd('0x19')](_0x158fdb[_0x26dd('0x18')])[_0x26dd('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x158fdb[_0x26dd('0x18')]):'';return util[_0x26dd('0xf')](_0x26dd('0x1b'),moment()['format'](_0x26dd('0x14')),_0x158fdb[_0x26dd('0x15')][_0x26dd('0x1c')](),_0x4c22eb,_0x158fdb[_0x26dd('0x11')],_0x437c61);}function consoleLogger(){var _0x381643=new winston[(_0x26dd('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x26dd('0x1e'))][(_0x26dd('0x1f'))]({'level':_0x26dd('0x20'),'json':![],'formatter':function(_0x218cf9){return formatter('',_0x218cf9);}})]});return _0x381643;}function fileLogger(_0x72637,_0x21309c){var _0x33be40=new winston[(_0x26dd('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x26dd('0x1e'))]['File']({'name':util[_0x26dd('0xf')](_0x26dd('0x21'),_0x72637,_0x26dd('0x22')),'filename':getLogFileName(_0x21309c,_0x72637,_0x26dd('0x22')),'level':_0x26dd('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4980f8){return fileFormat(_0x72637,_0x4980f8);}}),new winston[(_0x26dd('0x1e'))][(_0x26dd('0x23'))]({'name':util[_0x26dd('0xf')](_0x26dd('0x21'),_0x72637,debugLevel),'filename':getLogFileName(_0x21309c,_0x72637,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e4703){return fileFormat(_0x72637,_0x1e4703);}}),new winston[(_0x26dd('0x1e'))]['Console']({'level':_0x26dd('0x20'),'json':![],'formatter':function(_0x32883e){return fileFormat(_0x72637,_0x32883e);}})]});return _0x33be40;}exports[_0x26dd('0x24')]=consoleLogger;exports[_0x26dd('0x25')]=fileLogger; \ No newline at end of file +var _0xe142=['length','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','fileLogger','../config/environment','debugLevel','toLowerCase','info','red','white','bold\x20white','bold\x20green','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','meta','keys'];(function(_0x1ad6d4,_0x10fbe3){var _0x74df49=function(_0x470d44){while(--_0x470d44){_0x1ad6d4['push'](_0x1ad6d4['shift']());}};_0x74df49(++_0x10fbe3);}(_0xe142,0x15e));var _0x2e14=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0xe142[_0x5ce15c];return _0x36e4f5;};'use strict';var path=require('path');var util=require('util');var moment=require('moment');var winston=require('winston');var config=require(_0x2e14('0x0'));var debugLevel=config[_0x2e14('0x1')]?config['debugLevel'][_0x2e14('0x2')]():_0x2e14('0x3');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x2e14('0x4'),'warn':'bold\x20yellow','info':_0x2e14('0x5'),'print':_0x2e14('0x6'),'success':_0x2e14('0x7'),'http':'gray','verbose':'bold\x20magenta','debug':_0x2e14('0x8'),'silly':_0x2e14('0x9')};winston[_0x2e14('0xa')](XC_LOG_COLORS);function getLogFileName(_0xb7b7f0,_0x2c756d,_0x391066){var _0x1922f6=_0xb7b7f0||_0x2e14('0xb');return path[_0x2e14('0xc')](_0x1922f6,util[_0x2e14('0xd')](_0x2e14('0xe'),_0x2c756d,_0x391066));}function formatter(_0x2b2deb,_0x58560e){_0x58560e[_0x2e14('0xf')]=_0x58560e['message']['replace'](/@@{/g,'{{{')[_0x2e14('0x10')](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x2e14('0xd')](_0x2e14('0x11'),moment()[_0x2e14('0xd')](_0x2e14('0x12')),_0x58560e[_0x2e14('0x13')][_0x2e14('0x14')](),_0x2b2deb,_0x58560e[_0x2e14('0xf')]);}function fileFormat(_0x57ba32,_0x24104c){_0x24104c[_0x2e14('0xf')]=_0x24104c['message'][_0x2e14('0x10')](/@@{/g,'{{{')[_0x2e14('0x10')](/}@@/g,_0x2e14('0x15'))[_0x2e14('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x4f111c=_0x24104c[_0x2e14('0x16')]&&Object[_0x2e14('0x17')](_0x24104c[_0x2e14('0x16')])[_0x2e14('0x18')]?'\x0a\x09'+JSON['stringify'](_0x24104c[_0x2e14('0x16')]):'';return util[_0x2e14('0xd')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x2e14('0x12')),_0x24104c[_0x2e14('0x13')][_0x2e14('0x14')](),_0x57ba32,_0x24104c['message'],_0x4f111c);}function consoleLogger(){var _0x3c54cc=new winston[(_0x2e14('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2e14('0x1a'))][(_0x2e14('0x1b'))]({'level':_0x2e14('0x1c'),'json':![],'formatter':function(_0x3a8c10){return formatter('',_0x3a8c10);}})]});return _0x3c54cc;}function fileLogger(_0x2e8e2d,_0x7ae349){var _0x5e3e15=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x2e14('0x1d'))]({'name':util['format']('%s-%s',_0x2e8e2d,_0x2e14('0x1e')),'filename':getLogFileName(_0x7ae349,_0x2e8e2d,_0x2e14('0x1e')),'level':_0x2e14('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4beaf3){return fileFormat(_0x2e8e2d,_0x4beaf3);}}),new winston[(_0x2e14('0x1a'))][(_0x2e14('0x1d'))]({'name':util[_0x2e14('0xd')](_0x2e14('0x1f'),_0x2e8e2d,debugLevel),'filename':getLogFileName(_0x7ae349,_0x2e8e2d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f89b1){return fileFormat(_0x2e8e2d,_0x2f89b1);}}),new winston[(_0x2e14('0x1a'))][(_0x2e14('0x1b'))]({'level':_0x2e14('0x1c'),'json':![],'formatter':function(_0x3d295b){return fileFormat(_0x2e8e2d,_0x3d295b);}})]});return _0x5e3e15;}exports[_0x2e14('0x20')]=consoleLogger;exports[_0x2e14('0x21')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 10e95ed..d35c9d3 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x57ca,0x108));var _0xa57c=function(_0x5b39ea,_0x3ba359){_0x5b39ea=_0x5b39ea-0x0;var _0x2a010a=_0x57ca[_0x5b39ea];return _0x2a010a;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x36a94b,_0x2be56c){var _0x389cf3=function(_0x1006f7){while(--_0x1006f7){_0x36a94b['push'](_0x36a94b['shift']());}};_0x389cf3(++_0x2be56c);}(_0x66fa,0x117));var _0xa66f=function(_0x283290,_0x51995c){_0x283290=_0x283290-0x0;var _0xe6cfdc=_0x66fa[_0x283290];return _0xe6cfdc;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 9d8729c..39de95a 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['exports','replace'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0295,0x1f0));var _0x5029=function(_0x535c2b,_0x13368b){_0x535c2b=_0x535c2b-0x0;var _0x347f9d=_0x0295[_0x535c2b];return _0x347f9d;};module[_0x5029('0x0')]={'escapeRegExp'(_0x4e737b,_0x5e71d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4e737b[_0x5029('0x1')](_0x5e71d0,'\x5c$&');}}; \ No newline at end of file +var _0x66fa=['exports','replace','\x5c$&'];(function(_0x2dc448,_0x44cb37){var _0x11d610=function(_0x32ec8f){while(--_0x32ec8f){_0x2dc448['push'](_0x2dc448['shift']());}};_0x11d610(++_0x44cb37);}(_0x66fa,0x117));var _0xa66f=function(_0x12ba71,_0x517e53){_0x12ba71=_0x12ba71-0x0;var _0x442f26=_0x66fa[_0x12ba71];return _0x442f26;};module[_0xa66f('0x0')]={'escapeRegExp'(_0x3c905a,_0x52947a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x3c905a[_0xa66f('0x1')](_0x52947a,_0xa66f('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index e9837b7..a616c05 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['lodash','\x20}\x20}','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x517247,_0x42e2d4){var _0xc5e066=function(_0x45d18e){while(--_0x45d18e){_0x517247['push'](_0x517247['shift']());}};_0xc5e066(++_0x42e2d4);}(_0x7708,0x188));var _0x8770=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x7708[_0x590b63];return _0x3c9380;};var _=require(_0x8770('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24909b){return _0x24909b==='{{'?'{\x20{\x20':_0x8770('0x1');}function safeTemplate(_0x5a8b5b){var _0x5ca46f=_0x5a8b5b;if(typeof _0x5a8b5b==='string'){_0x5ca46f=_0x5a8b5b['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8770('0x2')](_0x5a8b5b)){_0x5ca46f=_0x5a8b5b[_0x8770('0x3')](function(_0x577b13){return safeTemplate(_0x577b13);});}else if(_[_0x8770('0x4')](_0x5a8b5b)){_0x5ca46f=Object['keys'](_0x5a8b5b)[_0x8770('0x5')](function(_0x42d305,_0x2b0295){_0x42d305[_0x2b0295]=safeTemplate(_0x5a8b5b[_0x2b0295]);return _0x42d305;},{});}return _0x5ca46f;}module[_0x8770('0x6')][_0x8770('0x7')]=safeTemplate; \ No newline at end of file +var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x8952,0x17e));var _0x2895=function(_0x5adb6e,_0x3124ef){_0x5adb6e=_0x5adb6e-0x0;var _0x33a028=_0x8952[_0x5adb6e];return _0x33a028;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index bdbc0dc..7266669 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x001e=['path','resolve','server/app.json','apps','findIndex','motion2','NODE_PATH','env','pathExists','readJSON','Updating\x20app.json','writeJSON','exports','fs-extra'];(function(_0x8e7772,_0x9d77b0){var _0x408200=function(_0x1c61b6){while(--_0x1c61b6){_0x8e7772['push'](_0x8e7772['shift']());}};_0x408200(++_0x9d77b0);}(_0x001e,0xb5));var _0xe001=function(_0x25ac1c,_0x5b55dd){_0x25ac1c=_0x25ac1c-0x0;var _0x3f172b=_0x001e[_0x25ac1c];return _0x3f172b;};var fs=require(_0xe001('0x0'));var path=require(_0xe001('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0xe001('0x2')](root,_0xe001('0x3'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x50275b){let _0x4258e6=![];if(Array['isArray'](_0x50275b[_0xe001('0x4')])){var _0x75217b=_0x50275b[_0xe001('0x4')][_0xe001('0x5')](function(_0x1d1622){return _0x1d1622['name']===_0xe001('0x6');});if(_0x75217b>-0x1){var _0x2a2b31=_0x50275b[_0xe001('0x4')][_0x75217b];if(typeof _0x2a2b31['env'][_0xe001('0x7')]!=='string'){_0x2a2b31[_0xe001('0x8')][_0xe001('0x7')]=NODEPATH;_0x4258e6=!![];}}return{'appConfig':_0x50275b,'updated':_0x4258e6};}}function updateAppConfig(_0x4ba0d5){return fs[_0xe001('0x9')](APP_JSON_PATH)['then'](function(_0x3cb623){if(_0x3cb623){return fs[_0xe001('0xa')](APP_JSON_PATH)['then'](function(_0x2221d7){var _0x5d6d68=setLegacyLibsNodeEnvPath(_0x2221d7);if(_0x5d6d68['updated']){_0x4ba0d5['info'](_0xe001('0xb'));return fs[_0xe001('0xc')](APP_JSON_PATH,_0x2221d7,{'spaces':0x2});}else{return Promise[_0xe001('0x2')]();}});}else{return Promise[_0xe001('0x2')]();}});}module[_0xe001('0xd')]=updateAppConfig; \ No newline at end of file +var _0xe911=['writeJSON','fs-extra','path','../config/environment','resolve','legacy-libs','name','apps','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json'];(function(_0x3a36aa,_0x34ec23){var _0x54501a=function(_0x738ca6){while(--_0x738ca6){_0x3a36aa['push'](_0x3a36aa['shift']());}};_0x54501a(++_0x34ec23);}(_0xe911,0x166));var _0x1e91=function(_0x101a91,_0x1b77e8){_0x101a91=_0x101a91-0x0;var _0x3dc2eb=_0xe911[_0x101a91];return _0x3dc2eb;};var fs=require(_0x1e91('0x0'));var path=require(_0x1e91('0x1'));var config=require(_0x1e91('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x1e91('0x3')](root,'server/app.json');var NODEPATH=path[_0x1e91('0x3')](root,_0x1e91('0x4'));function setLegacyLibsNodeEnvPath(_0x4f2a2c){let _0x5cb2f3=![];if(Array['isArray'](_0x4f2a2c['apps'])){var _0x3e42f9=_0x4f2a2c['apps']['findIndex'](function(_0x5f432e){return _0x5f432e[_0x1e91('0x5')]==='motion2';});if(_0x3e42f9>-0x1){var _0x15ad90=_0x4f2a2c[_0x1e91('0x6')][_0x3e42f9];if(typeof _0x15ad90[_0x1e91('0x7')][_0x1e91('0x8')]!==_0x1e91('0x9')){_0x15ad90['env'][_0x1e91('0x8')]=NODEPATH;_0x5cb2f3=!![];}}return{'appConfig':_0x4f2a2c,'updated':_0x5cb2f3};}}function updateAppConfig(_0x4f9d32){return fs[_0x1e91('0xa')](APP_JSON_PATH)[_0x1e91('0xb')](function(_0x12c2b5){if(_0x12c2b5){return fs[_0x1e91('0xc')](APP_JSON_PATH)[_0x1e91('0xb')](function(_0x27c6a7){var _0x185850=setLegacyLibsNodeEnvPath(_0x27c6a7);if(_0x185850[_0x1e91('0xd')]){_0x4f9d32[_0x1e91('0xe')](_0x1e91('0xf'));return fs[_0x1e91('0x10')](APP_JSON_PATH,_0x27c6a7,{'spaces':0x2});}else{return Promise[_0x1e91('0x3')]();}});}else{return Promise[_0x1e91('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file